From: support Date: Fri, 8 Jul 2022 15:46:11 +0000 (+0000) Subject: Built motion from commit 8720aabd.|2.6.12 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=f3134827ba63bca4345ba83643ba5db2b076e1d9;p=motion2.git Built motion from commit 8720aabd.|2.6.12 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 1de1db7..148e498 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-07-08T15:23:52.876Z", + "time": "2022-07-08T15:38:16.667Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 636c380..76e23cb 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-07-08T15:23:52.876Z", + "time": "2022-07-08T15:38:16.667Z", "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 7b3b132..8ef1884 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 _0xd40a=['urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','getDataValue','action','STRING','integration','motionbar','jscripty','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[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]'];(function(_0x36d3c1,_0x15a8c1){var _0x1a75f3=function(_0x4ddb54){while(--_0x4ddb54){_0x36d3c1['push'](_0x36d3c1['shift']());}};_0x1a75f3(++_0x15a8c1);}(_0xd40a,0x17d));var _0xad40=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd40a[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xad40('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3e91cc){return this[_0xad40('0x1')](_0xad40('0x2'));}},'action':{'type':Sequelize[_0xad40('0x3')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xad40('0x4'),_0xad40('0x5'),_0xad40('0x6'),_0xad40('0x7'),_0xad40('0x8'),_0xad40('0x9'),'script']],'msg':_0xad40('0xa')}},'comment':_0xad40('0xa')},'data1':{'type':Sequelize[_0xad40('0x3')](0x1000),'comment':_0xad40('0xb')},'data2':{'type':Sequelize[_0xad40('0x3')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xad40('0x3')](0x1000),'comment':_0xad40('0xc')},'data4':{'type':Sequelize[_0xad40('0x3')](0x1000),'comments':_0xad40('0xd')},'data5':{'type':Sequelize[_0xad40('0x3')](0x1000),'comments':_0xad40('0xe')},'data6':{'type':Sequelize[_0xad40('0x3')],'comments':_0xad40('0xf')},'data7':{'type':Sequelize[_0xad40('0x10')],'comments':_0xad40('0x11')}}; \ No newline at end of file +var _0x0a30=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','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]','sequelize','VIRTUAL','getDataValue','action','integration','jscripty','urlForward','browser','bot','script'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a30,0xaa));var _0x00a3=function(_0x52eb8f,_0x3fdd3e){_0x52eb8f=_0x52eb8f-0x0;var _0xbeac90=_0x0a30[_0x52eb8f];return _0xbeac90;};'use strict';var Sequelize=require(_0x00a3('0x0'));module['exports']={'name':{'type':Sequelize[_0x00a3('0x1')],'get':function(_0x52f39c){return this[_0x00a3('0x2')](_0x00a3('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x00a3('0x4'),'motionbar',_0x00a3('0x5'),_0x00a3('0x6'),_0x00a3('0x7'),_0x00a3('0x8'),_0x00a3('0x9')]],'msg':_0x00a3('0xa')}},'comment':_0x00a3('0xa')},'data1':{'type':Sequelize[_0x00a3('0xb')](0x1000),'comment':_0x00a3('0xc')},'data2':{'type':Sequelize[_0x00a3('0xb')](0x1000),'comment':_0x00a3('0xd')},'data3':{'type':Sequelize[_0x00a3('0xb')](0x1000),'comment':_0x00a3('0xe')},'data4':{'type':Sequelize[_0x00a3('0xb')](0x1000),'comments':_0x00a3('0xf')},'data5':{'type':Sequelize[_0x00a3('0xb')](0x1000),'comments':_0x00a3('0x10')},'data6':{'type':Sequelize['STRING'],'comments':_0x00a3('0x11')},'data7':{'type':Sequelize['TEXT'],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 1962c33..a53217f 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 _0xff8d=['name','body','Action','find','params','catch','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','Content-Range','apply','update','then','destroy'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xff8d,0xfc));var _0xdff8=function(_0x14d58f,_0x1bfe6f){_0x14d58f=_0x14d58f-0x0;var _0xde8e01=_0xff8d[_0x14d58f];return _0xde8e01;};'use strict';var emlformat=require(_0xdff8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdff8('0x1'));var rp=require(_0xdff8('0x2'));var moment=require(_0xdff8('0x3'));var BPromise=require(_0xdff8('0x4'));var Mustache=require(_0xdff8('0x5'));var util=require('util');var path=require(_0xdff8('0x6'));var sox=require(_0xdff8('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdff8('0x8'));var squel=require(_0xdff8('0x9'));var crypto=require(_0xdff8('0xa'));var jsforce=require(_0xdff8('0xb'));var deskjs=require(_0xdff8('0xc'));var toCsv=require('to-csv');var querystring=require(_0xdff8('0xd'));var Papa=require('papaparse');var Redis=require(_0xdff8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xdff8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdff8('0x10'));var logger=require('../../config/logger')(_0xdff8('0x11'));var utils=require(_0xdff8('0x12'));var config=require(_0xdff8('0x13'));var licenseUtil=require(_0xdff8('0x14'));var db=require(_0xdff8('0x15'))['db'];function respondWithStatusCode(_0x3f21ef,_0x1a975e){_0x1a975e=_0x1a975e||0xcc;return function(_0x33662d){if(_0x33662d){return _0x3f21ef[_0xdff8('0x16')](_0x1a975e);}return _0x3f21ef['status'](_0x1a975e)[_0xdff8('0x17')]();};}function respondWithResult(_0x2b6ca2,_0x10997e){_0x10997e=_0x10997e||0xc8;return function(_0x446db5){if(_0x446db5){return _0x2b6ca2['status'](_0x10997e)[_0xdff8('0x18')](_0x446db5);}};}function respondWithFilteredResult(_0x4524aa,_0x364d17){return function(_0x4ce82e){if(_0x4ce82e){var _0x2acd32=typeof _0x364d17[_0xdff8('0x19')]==='undefined'&&typeof _0x364d17[_0xdff8('0x1a')]===_0xdff8('0x1b');var _0x5c0e28=_0x4ce82e[_0xdff8('0x1c')];var _0x595f28=_0x2acd32?0x0:_0x364d17[_0xdff8('0x19')];var _0x28ed14=_0x2acd32?_0x4ce82e[_0xdff8('0x1c')]:_0x364d17['offset']+_0x364d17[_0xdff8('0x1a')];var _0x1e75f3;if(_0x28ed14>=_0x5c0e28){_0x28ed14=_0x5c0e28;_0x1e75f3=0xc8;}else{_0x1e75f3=0xce;}_0x4524aa[_0xdff8('0x1d')](_0x1e75f3);return _0x4524aa['set'](_0xdff8('0x1e'),_0x595f28+'-'+_0x28ed14+'/'+_0x5c0e28)[_0xdff8('0x18')](_0x4ce82e);}return null;};}function patchUpdates(_0x145d27){return function(_0x427715){try{jsonpatch[_0xdff8('0x1f')](_0x427715,_0x145d27,!![]);}catch(_0x625a14){return BPromise['reject'](_0x625a14);}return _0x427715['save']();};}function saveUpdates(_0x4b23a5,_0x5a260e){return function(_0x17b30e){if(_0x17b30e){return _0x17b30e[_0xdff8('0x20')](_0x4b23a5)[_0xdff8('0x21')](function(_0x2dbdc7){return _0x2dbdc7;});}return null;};}function removeEntity(_0x56bb78,_0x3baaa3){return function(_0x49a619){if(_0x49a619){return _0x49a619[_0xdff8('0x22')]()[_0xdff8('0x21')](function(){_0x56bb78[_0xdff8('0x1d')](0xcc)[_0xdff8('0x17')]();});}};}function handleEntityNotFound(_0x1bc9fa,_0x2e4d08){return function(_0x5e896d){if(!_0x5e896d){_0x1bc9fa[_0xdff8('0x16')](0x194);}return _0x5e896d;};}function handleError(_0x5ad5df,_0x33eeea){_0x33eeea=_0x33eeea||0x1f4;return function(_0x5ae239){logger['error'](_0x5ae239['stack']);if(_0x5ae239[_0xdff8('0x23')]){delete _0x5ae239[_0xdff8('0x23')];}_0x5ad5df[_0xdff8('0x1d')](_0x33eeea)['send'](_0x5ae239);};}exports[_0xdff8('0x20')]=function(_0x5b5122,_0x29ceb8){if(_0x5b5122[_0xdff8('0x24')]['id']){delete _0x5b5122[_0xdff8('0x24')]['id'];}return db[_0xdff8('0x25')][_0xdff8('0x26')]({'where':{'id':_0x5b5122[_0xdff8('0x27')]['id']}})[_0xdff8('0x21')](handleEntityNotFound(_0x29ceb8,null))[_0xdff8('0x21')](saveUpdates(_0x5b5122['body'],null))[_0xdff8('0x21')](respondWithResult(_0x29ceb8,null))[_0xdff8('0x28')](handleError(_0x29ceb8,null));};exports[_0xdff8('0x22')]=function(_0x19c934,_0x5b1141){return db[_0xdff8('0x25')][_0xdff8('0x26')]({'where':{'id':_0x19c934[_0xdff8('0x27')]['id']}})['then'](handleEntityNotFound(_0x5b1141,null))['then'](removeEntity(_0x5b1141,null))[_0xdff8('0x28')](handleError(_0x5b1141,null));}; \ No newline at end of file +var _0x34e9=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','body','find','params','catch','destroy','Action','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0x34e9,0x167));var _0x934e=function(_0x1a130d,_0x2cb189){_0x1a130d=_0x1a130d-0x0;var _0xab6801=_0x34e9[_0x1a130d];return _0xab6801;};'use strict';var emlformat=require(_0x934e('0x0'));var rimraf=require(_0x934e('0x1'));var zipdir=require(_0x934e('0x2'));var jsonpatch=require(_0x934e('0x3'));var rp=require('request-promise');var moment=require(_0x934e('0x4'));var BPromise=require(_0x934e('0x5'));var Mustache=require(_0x934e('0x6'));var util=require(_0x934e('0x7'));var path=require(_0x934e('0x8'));var sox=require('sox');var csv=require(_0x934e('0x9'));var ejs=require(_0x934e('0xa'));var fs=require('fs');var fs_extra=require(_0x934e('0xb'));var _=require('lodash');var squel=require(_0x934e('0xc'));var crypto=require(_0x934e('0xd'));var jsforce=require(_0x934e('0xe'));var deskjs=require(_0x934e('0xf'));var toCsv=require(_0x934e('0x9'));var querystring=require('querystring');var Papa=require(_0x934e('0x10'));var Redis=require(_0x934e('0x11'));var authService=require(_0x934e('0x12'));var qs=require(_0x934e('0x13'));var as=require(_0x934e('0x14'));var hardwareService=require(_0x934e('0x15'));var logger=require(_0x934e('0x16'))(_0x934e('0x17'));var utils=require(_0x934e('0x18'));var config=require(_0x934e('0x19'));var licenseUtil=require(_0x934e('0x1a'));var db=require(_0x934e('0x1b'))['db'];function respondWithStatusCode(_0x5105be,_0x44b24f){_0x44b24f=_0x44b24f||0xcc;return function(_0x1cb98b){if(_0x1cb98b){return _0x5105be[_0x934e('0x1c')](_0x44b24f);}return _0x5105be['status'](_0x44b24f)[_0x934e('0x1d')]();};}function respondWithResult(_0xaa0389,_0x4d7ea2){_0x4d7ea2=_0x4d7ea2||0xc8;return function(_0x2800f1){if(_0x2800f1){return _0xaa0389[_0x934e('0x1e')](_0x4d7ea2)[_0x934e('0x1f')](_0x2800f1);}};}function respondWithFilteredResult(_0xecd785,_0x35ded2){return function(_0x13ff7a){if(_0x13ff7a){var _0x268fbe=typeof _0x35ded2[_0x934e('0x20')]===_0x934e('0x21')&&typeof _0x35ded2[_0x934e('0x22')]==='undefined';var _0x2e209b=_0x13ff7a[_0x934e('0x23')];var _0x5c1f4f=_0x268fbe?0x0:_0x35ded2[_0x934e('0x20')];var _0x28a4cd=_0x268fbe?_0x13ff7a[_0x934e('0x23')]:_0x35ded2[_0x934e('0x20')]+_0x35ded2[_0x934e('0x22')];var _0x3a79ce;if(_0x28a4cd>=_0x2e209b){_0x28a4cd=_0x2e209b;_0x3a79ce=0xc8;}else{_0x3a79ce=0xce;}_0xecd785[_0x934e('0x1e')](_0x3a79ce);return _0xecd785[_0x934e('0x24')](_0x934e('0x25'),_0x5c1f4f+'-'+_0x28a4cd+'/'+_0x2e209b)['json'](_0x13ff7a);}return null;};}function patchUpdates(_0x30443a){return function(_0x110d75){try{jsonpatch[_0x934e('0x26')](_0x110d75,_0x30443a,!![]);}catch(_0x54628a){return BPromise[_0x934e('0x27')](_0x54628a);}return _0x110d75[_0x934e('0x28')]();};}function saveUpdates(_0x50d966,_0x52cd5c){return function(_0x5cac08){if(_0x5cac08){return _0x5cac08[_0x934e('0x29')](_0x50d966)[_0x934e('0x2a')](function(_0x10f86d){return _0x10f86d;});}return null;};}function removeEntity(_0x4ea607,_0x439f16){return function(_0x5e17dd){if(_0x5e17dd){return _0x5e17dd['destroy']()[_0x934e('0x2a')](function(){_0x4ea607[_0x934e('0x1e')](0xcc)[_0x934e('0x1d')]();});}};}function handleEntityNotFound(_0x7b5a60,_0x58bc7e){return function(_0x14beb1){if(!_0x14beb1){_0x7b5a60[_0x934e('0x1c')](0x194);}return _0x14beb1;};}function handleError(_0x47d46c,_0x3a4622){_0x3a4622=_0x3a4622||0x1f4;return function(_0xc01d53){logger[_0x934e('0x2b')](_0xc01d53[_0x934e('0x2c')]);if(_0xc01d53[_0x934e('0x2d')]){delete _0xc01d53['name'];}_0x47d46c[_0x934e('0x1e')](_0x3a4622)[_0x934e('0x2e')](_0xc01d53);};}exports['update']=function(_0xe9ad0c,_0xe965a){if(_0xe9ad0c[_0x934e('0x2f')]['id']){delete _0xe9ad0c[_0x934e('0x2f')]['id'];}return db['Action'][_0x934e('0x30')]({'where':{'id':_0xe9ad0c[_0x934e('0x31')]['id']}})['then'](handleEntityNotFound(_0xe965a,null))[_0x934e('0x2a')](saveUpdates(_0xe9ad0c[_0x934e('0x2f')],null))[_0x934e('0x2a')](respondWithResult(_0xe965a,null))[_0x934e('0x32')](handleError(_0xe965a,null));};exports[_0x934e('0x33')]=function(_0x4bfb2a,_0x234680){return db[_0x934e('0x34')][_0x934e('0x30')]({'where':{'id':_0x4bfb2a[_0x934e('0x31')]['id']}})['then'](handleEntityNotFound(_0x234680,null))[_0x934e('0x2a')](removeEntity(_0x234680,null))[_0x934e('0x32')](handleError(_0x234680,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 7e55111..39a0f12 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 _0x4797=['rimraf','../../config/environment','./action.attributes','define','Action','tools_actions','util','moment','bluebird','request-promise','path'];(function(_0x259d17,_0x220710){var _0x407535=function(_0x49bc38){while(--_0x49bc38){_0x259d17['push'](_0x259d17['shift']());}};_0x407535(++_0x220710);}(_0x4797,0x150));var _0x7479=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4797[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x7479('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7479('0x1'));var BPromise=require(_0x7479('0x2'));var rp=require(_0x7479('0x3'));var fs=require('fs');var path=require(_0x7479('0x4'));var rimraf=require(_0x7479('0x5'));var config=require(_0x7479('0x6'));var attributes=require(_0x7479('0x7'));module['exports']=function(_0x3e6767,_0xa6b352){return _0x3e6767[_0x7479('0x8')](_0x7479('0x9'),attributes,{'tableName':_0x7479('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f65=['Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./action.attributes','exports','define'];(function(_0x1e9c78,_0xc01460){var _0x2fc4c7=function(_0x58c08b){while(--_0x58c08b){_0x1e9c78['push'](_0x1e9c78['shift']());}};_0x2fc4c7(++_0xc01460);}(_0x7f65,0x91));var _0x57f6=function(_0x52c3de,_0x2b6bb4){_0x52c3de=_0x52c3de-0x0;var _0xed6378=_0x7f65[_0x52c3de];return _0xed6378;};'use strict';var _=require(_0x57f6('0x0'));var util=require(_0x57f6('0x1'));var logger=require(_0x57f6('0x2'))(_0x57f6('0x3'));var moment=require(_0x57f6('0x4'));var BPromise=require(_0x57f6('0x5'));var rp=require(_0x57f6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x57f6('0x7'));var config=require('../../config/environment');var attributes=require(_0x57f6('0x8'));module[_0x57f6('0x9')]=function(_0x5ba2bf,_0x2d19ae){return _0x5ba2bf[_0x57f6('0xa')](_0x57f6('0xb'),attributes,{'tableName':_0x57f6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 9f212e0..e199ee4 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 _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x3fae6a,_0x5f28ac){var _0x18fc2a=function(_0x3b487f){while(--_0x3b487f){_0x3fae6a['push'](_0x3fae6a['shift']());}};_0x18fc2a(++_0x5f28ac);}(_0xabce,0x103));var _0xeabc=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xabce[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Action,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file +var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x53ec,0x192));var _0xc53e=function(_0x17e4ac,_0x315ed6){_0x17e4ac=_0x17e4ac-0x0;var _0x7a9a6a=_0x53ec[_0x17e4ac];return _0x7a9a6a;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 903e690..14414be 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 _0x9084=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','delete'];(function(_0x2dc734,_0x7e7cd1){var _0x5b377f=function(_0x57631e){while(--_0x57631e){_0x2dc734['push'](_0x2dc734['shift']());}};_0x5b377f(++_0x7e7cd1);}(_0x9084,0x151));var _0x4908=function(_0x5e2991,_0x282bf7){_0x5e2991=_0x5e2991-0x0;var _0x5ede0d=_0x9084[_0x5e2991];return _0x5ede0d;};'use strict';var multer=require(_0x4908('0x0'));var util=require(_0x4908('0x1'));var path=require('path');var timeout=require(_0x4908('0x2'));var express=require(_0x4908('0x3'));var router=express[_0x4908('0x4')]();var fs_extra=require(_0x4908('0x5'));var auth=require(_0x4908('0x6'));var interaction=require(_0x4908('0x7'));var config=require('../../config/environment');var controller=require(_0x4908('0x8'));router[_0x4908('0x9')](_0x4908('0xa'),auth[_0x4908('0xb')](),controller['update']);router[_0x4908('0xc')](_0x4908('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x4908('0xd')]=router; \ No newline at end of file +var _0xae41=['/:id','destroy','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','put','update'];(function(_0x440fde,_0x445ce0){var _0x11052c=function(_0x49f547){while(--_0x49f547){_0x440fde['push'](_0x440fde['shift']());}};_0x11052c(++_0x445ce0);}(_0xae41,0xce));var _0x1ae4=function(_0x5bf1b0,_0x4755db){_0x5bf1b0=_0x5bf1b0-0x0;var _0x1fcdbc=_0xae41[_0x5bf1b0];return _0x1fcdbc;};'use strict';var multer=require('multer');var util=require(_0x1ae4('0x0'));var path=require(_0x1ae4('0x1'));var timeout=require(_0x1ae4('0x2'));var express=require(_0x1ae4('0x3'));var router=express['Router']();var fs_extra=require(_0x1ae4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1ae4('0x5'));var config=require(_0x1ae4('0x6'));var controller=require(_0x1ae4('0x7'));router[_0x1ae4('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1ae4('0x9')]);router['delete'](_0x1ae4('0xa'),auth['isAuthenticated'](),controller[_0x1ae4('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index e2e0ffc..d3a0632 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 _0xdbf5=['exports','STRING','TEXT'];(function(_0x728ec9,_0x2f0d21){var _0xf5ef3=function(_0x16921a){while(--_0x16921a){_0x728ec9['push'](_0x728ec9['shift']());}};_0xf5ef3(++_0x2f0d21);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x1dcb03,_0xce8ff4){_0x1dcb03=_0x1dcb03-0x0;var _0x2f4fbc=_0xdbf5[_0x1dcb03];return _0x2f4fbc;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x5dbf('0x1')]},'table':{'type':Sequelize[_0x5dbf('0x1')]},'conditions':{'type':Sequelize[_0x5dbf('0x2')]},'joins':{'type':Sequelize[_0x5dbf('0x2')]}}; \ No newline at end of file +var _0x2675=['sequelize','STRING','TEXT'];(function(_0x593d89,_0x45145f){var _0x4aa403=function(_0x21f674){while(--_0x21f674){_0x593d89['push'](_0x593d89['shift']());}};_0x4aa403(++_0x45145f);}(_0x2675,0x75));var _0x5267=function(_0x4c699c,_0x4cf981){_0x4c699c=_0x4c699c-0x0;var _0x50c0a8=_0x2675[_0x4c699c];return _0x50c0a8;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x5267('0x1')]},'table':{'type':Sequelize[_0x5267('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x5267('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 9242de9..bf2bf16 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 _0xe67c=['user','role','UserProfileSection','autoAssociation','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_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)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','select','from','table','MetricId','field','function','format','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','right_join','cross_join','SUM(%s)','MIN(%s)','IS\x20NOT\x20NULL','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','metric','replace','groupBy','output','web','fullPath','%s-%s.%s','randomstring','generate','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','value','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','AnalyticCustomReport','include','findAll','rows','catch','show','params','includeAll','options','find','create','body'];(function(_0x2de3f0,_0x59af1b){var _0x25efc7=function(_0x55f8bc){while(--_0x55f8bc){_0x2de3f0['push'](_0x2de3f0['shift']());}};_0x25efc7(++_0x59af1b);}(_0xe67c,0x1a9));var _0xce67=function(_0x5cc514,_0x1ef0e3){_0x5cc514=_0x5cc514-0x0;var _0x459a4d=_0xe67c[_0x5cc514];return _0x459a4d;};'use strict';var emlformat=require(_0xce67('0x0'));var rimraf=require(_0xce67('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce67('0x2'));var rp=require(_0xce67('0x3'));var moment=require(_0xce67('0x4'));var BPromise=require(_0xce67('0x5'));var Mustache=require(_0xce67('0x6'));var util=require(_0xce67('0x7'));var path=require('path');var sox=require(_0xce67('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xce67('0x9'));var _=require(_0xce67('0xa'));var squel=require(_0xce67('0xb'));var crypto=require(_0xce67('0xc'));var jsforce=require(_0xce67('0xd'));var deskjs=require(_0xce67('0xe'));var toCsv=require(_0xce67('0xf'));var querystring=require(_0xce67('0x10'));var Papa=require(_0xce67('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xce67('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce67('0x13'));var logger=require(_0xce67('0x14'))(_0xce67('0x15'));var utils=require(_0xce67('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xce67('0x17'))['db'];var dbH=require(_0xce67('0x17'))['dbH'];function respondWithStatusCode(_0x13f5b2,_0x4eea04){_0x4eea04=_0x4eea04||0xcc;return function(_0x5c0097){if(_0x5c0097){return _0x13f5b2[_0xce67('0x18')](_0x4eea04);}return _0x13f5b2[_0xce67('0x19')](_0x4eea04)[_0xce67('0x1a')]();};}function respondWithResult(_0x25f0d9,_0x4de3ce){_0x4de3ce=_0x4de3ce||0xc8;return function(_0x1c611a){if(_0x1c611a){return _0x25f0d9['status'](_0x4de3ce)[_0xce67('0x1b')](_0x1c611a);}};}function respondWithFilteredResult(_0x29fe4d,_0x18d225){return function(_0x3a585a){if(_0x3a585a){var _0x3db006=typeof _0x18d225['offset']===_0xce67('0x1c')&&typeof _0x18d225[_0xce67('0x1d')]===_0xce67('0x1c');var _0xddd4c8=_0x3a585a[_0xce67('0x1e')];var _0x277a38=_0x3db006?0x0:_0x18d225[_0xce67('0x1f')];var _0x382ab9=_0x3db006?_0x3a585a[_0xce67('0x1e')]:_0x18d225['offset']+_0x18d225['limit'];var _0x4c190f;if(_0x382ab9>=_0xddd4c8){_0x382ab9=_0xddd4c8;_0x4c190f=0xc8;}else{_0x4c190f=0xce;}_0x29fe4d[_0xce67('0x19')](_0x4c190f);return _0x29fe4d[_0xce67('0x20')](_0xce67('0x21'),_0x277a38+'-'+_0x382ab9+'/'+_0xddd4c8)['json'](_0x3a585a);}return null;};}function patchUpdates(_0x386395){return function(_0x6c2628){try{jsonpatch[_0xce67('0x22')](_0x6c2628,_0x386395,!![]);}catch(_0x469051){return BPromise[_0xce67('0x23')](_0x469051);}return _0x6c2628['save']();};}function saveUpdates(_0x551366,_0x50c141){return function(_0x953286){if(_0x953286){return _0x953286[_0xce67('0x24')](_0x551366)[_0xce67('0x25')](function(_0x33162f){return _0x33162f;});}return null;};}function removeEntity(_0x3dfe9c,_0x2a6b6c){return function(_0x1d7339){if(_0x1d7339){return _0x1d7339[_0xce67('0x26')]()[_0xce67('0x25')](function(){var _0xbe1b0b=_0x1d7339[_0xce67('0x27')]({'plain':!![]});var _0x2dee01='CustomReports';return db[_0xce67('0x28')]['destroy']({'where':{'type':_0x2dee01,'resourceId':_0xbe1b0b['id']}})[_0xce67('0x25')](function(){return _0x1d7339;});})[_0xce67('0x25')](function(){_0x3dfe9c[_0xce67('0x19')](0xcc)[_0xce67('0x1a')]();});}};}function handleEntityNotFound(_0xbd85b6,_0x14a270){return function(_0x1de675){if(!_0x1de675){_0xbd85b6[_0xce67('0x18')](0x194);}return _0x1de675;};}function handleError(_0x2f529b,_0x54c1cd){_0x54c1cd=_0x54c1cd||0x1f4;return function(_0x2365fc){logger['error'](_0x2365fc[_0xce67('0x29')]);if(_0x2365fc[_0xce67('0x2a')]){delete _0x2365fc['name'];}_0x2f529b[_0xce67('0x19')](_0x54c1cd)[_0xce67('0x2b')](_0x2365fc);};}exports[_0xce67('0x2c')]=function(_0x2f5c42,_0x5e4758){var _0x204bfc={},_0x55855a={},_0x38e88e={'count':0x0,'rows':[]};var _0x18af35=_[_0xce67('0x2d')](db['AnalyticCustomReport'][_0xce67('0x2e')],function(_0x2ba7f2){return{'name':_0x2ba7f2[_0xce67('0x2f')],'type':_0x2ba7f2['type'][_0xce67('0x30')]};});_0x55855a[_0xce67('0x31')]=_[_0xce67('0x2d')](_0x18af35,_0xce67('0x2a'));_0x55855a[_0xce67('0x32')]=_[_0xce67('0x33')](_0x2f5c42[_0xce67('0x32')]);_0x55855a[_0xce67('0x34')]=_[_0xce67('0x35')](_0x55855a['model'],_0x55855a[_0xce67('0x32')]);_0x204bfc[_0xce67('0x36')]=_[_0xce67('0x35')](_0x55855a[_0xce67('0x31')],qs[_0xce67('0x37')](_0x2f5c42[_0xce67('0x32')][_0xce67('0x37')]));_0x204bfc[_0xce67('0x36')]=_0x204bfc[_0xce67('0x36')][_0xce67('0x38')]?_0x204bfc[_0xce67('0x36')]:_0x55855a[_0xce67('0x31')];if(!_0x2f5c42['query'][_0xce67('0x39')](_0xce67('0x3a'))){_0x204bfc[_0xce67('0x1d')]=qs[_0xce67('0x1d')](_0x2f5c42[_0xce67('0x32')][_0xce67('0x1d')]);_0x204bfc[_0xce67('0x1f')]=qs[_0xce67('0x1f')](_0x2f5c42[_0xce67('0x32')][_0xce67('0x1f')]);}_0x204bfc[_0xce67('0x3b')]=qs[_0xce67('0x3c')](_0x2f5c42[_0xce67('0x32')][_0xce67('0x3c')]);_0x204bfc[_0xce67('0x3d')]=qs[_0xce67('0x34')](_[_0xce67('0x3e')](_0x2f5c42[_0xce67('0x32')],_0x55855a[_0xce67('0x34')]),_0x18af35);if(_0x2f5c42[_0xce67('0x32')][_0xce67('0x3f')]){_0x204bfc[_0xce67('0x3d')]=_[_0xce67('0x40')](_0x204bfc[_0xce67('0x3d')],{'$or':_['map'](_0x18af35,function(_0x27e656){if(_0x27e656[_0xce67('0x41')]!==_0xce67('0x42')){var _0x32094e={};_0x32094e[_0x27e656['name']]={'$like':'%'+_0x2f5c42['query'][_0xce67('0x3f')]+'%'};return _0x32094e;}})});}_0x204bfc=_[_0xce67('0x40')]({},_0x204bfc,_0x2f5c42['options']);var _0x51a38c={'where':_0x204bfc[_0xce67('0x3d')]};return db[_0xce67('0x43')][_0xce67('0x1e')](_0x51a38c)[_0xce67('0x25')](function(_0x1fef56){_0x38e88e[_0xce67('0x1e')]=_0x1fef56;if(_0x2f5c42[_0xce67('0x32')]['includeAll']){_0x204bfc[_0xce67('0x44')]=[{'all':!![]}];}return db[_0xce67('0x43')][_0xce67('0x45')](_0x204bfc);})[_0xce67('0x25')](function(_0x494c1a){_0x38e88e[_0xce67('0x46')]=_0x494c1a;return _0x38e88e;})[_0xce67('0x25')](respondWithFilteredResult(_0x5e4758,_0x204bfc))[_0xce67('0x47')](handleError(_0x5e4758,null));};exports[_0xce67('0x48')]=function(_0x21af4f,_0x3e32af){var _0x3669cb={'raw':![],'where':{'id':_0x21af4f[_0xce67('0x49')]['id']}},_0x2423d1={};_0x2423d1[_0xce67('0x31')]=_[_0xce67('0x33')](db[_0xce67('0x43')][_0xce67('0x2e')]);_0x2423d1[_0xce67('0x32')]=_[_0xce67('0x33')](_0x21af4f[_0xce67('0x32')]);_0x2423d1[_0xce67('0x34')]=_['intersection'](_0x2423d1[_0xce67('0x31')],_0x2423d1[_0xce67('0x32')]);_0x3669cb[_0xce67('0x36')]=_[_0xce67('0x35')](_0x2423d1[_0xce67('0x31')],qs[_0xce67('0x37')](_0x21af4f[_0xce67('0x32')][_0xce67('0x37')]));_0x3669cb[_0xce67('0x36')]=_0x3669cb['attributes'][_0xce67('0x38')]?_0x3669cb['attributes']:_0x2423d1['model'];if(_0x21af4f[_0xce67('0x32')][_0xce67('0x4a')]){_0x3669cb[_0xce67('0x44')]=[{'all':!![]}];}_0x3669cb=_['merge']({},_0x3669cb,_0x21af4f[_0xce67('0x4b')]);return db[_0xce67('0x43')][_0xce67('0x4c')](_0x3669cb)[_0xce67('0x25')](handleEntityNotFound(_0x3e32af,null))[_0xce67('0x25')](respondWithResult(_0x3e32af,null))[_0xce67('0x47')](handleError(_0x3e32af,null));};exports[_0xce67('0x4d')]=function(_0x2f11ed,_0x157227){return db['AnalyticCustomReport'][_0xce67('0x4d')](_0x2f11ed[_0xce67('0x4e')],{})[_0xce67('0x25')](function(_0x406435){var _0x373e75=_0x2f11ed[_0xce67('0x4f')]['get']({'plain':!![]});if(!_0x373e75)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x373e75[_0xce67('0x50')]===_0xce67('0x4f')){var _0x2df4d8=_0x406435[_0xce67('0x27')]({'plain':!![]});var _0x580d64='Reports';return db[_0xce67('0x51')]['find']({'where':{'name':_0x580d64,'userProfileId':_0x373e75['userProfileId']},'raw':!![]})['then'](function(_0x27be8f){if(_0x27be8f&&_0x27be8f[_0xce67('0x52')]===0x0){return db[_0xce67('0x28')]['create']({'name':_0x2df4d8[_0xce67('0x2a')],'resourceId':_0x2df4d8['id'],'type':_0xce67('0x53'),'sectionId':_0x27be8f['id']},{})[_0xce67('0x25')](function(){return _0x406435;});}else{return _0x406435;}})[_0xce67('0x47')](function(_0xfa392d){logger[_0xce67('0x54')](_0xce67('0x55'),_0xfa392d);throw _0xfa392d;});}return _0x406435;})[_0xce67('0x25')](respondWithResult(_0x157227,0xc9))[_0xce67('0x47')](handleError(_0x157227,null));};exports[_0xce67('0x24')]=function(_0x582f87,_0x37ada4){if(_0x582f87[_0xce67('0x4e')]['id']){delete _0x582f87['body']['id'];}return db['AnalyticCustomReport'][_0xce67('0x4c')]({'where':{'id':_0x582f87['params']['id']}})[_0xce67('0x25')](handleEntityNotFound(_0x37ada4,null))[_0xce67('0x25')](saveUpdates(_0x582f87['body'],null))['then'](respondWithResult(_0x37ada4,null))[_0xce67('0x47')](handleError(_0x37ada4,null));};exports[_0xce67('0x26')]=function(_0x1c2093,_0x17fa48){return db[_0xce67('0x43')][_0xce67('0x4c')]({'where':{'id':_0x1c2093[_0xce67('0x49')]['id']}})['then'](handleEntityNotFound(_0x17fa48,null))['then'](removeEntity(_0x17fa48,null))[_0xce67('0x47')](handleError(_0x17fa48,null));};exports[_0xce67('0x56')]=function(_0x5d47b3,_0x42c1a8){var _0x7c508d=0xa;var _0x54578c=[_0xce67('0x57'),_0xce67('0x58'),'right_join','cross_join'];var _0x66087b={'SUM':'SUM(%s)','COUNT':_0xce67('0x59'),'COUNT DISTINCT':_0xce67('0x5a'),'MAX':_0xce67('0x5b'),'MIN':'MIN(%s)','AVG':_0xce67('0x5c'),'GROUP_CONCAT':_0xce67('0x5d'),'GROUP_CONCAT ASC':_0xce67('0x5e'),'GROUP_CONCAT DESC':_0xce67('0x5f')};var _0x44dc48={'SEC_TO_TIME':_0xce67('0x60'),'DATE':_0xce67('0x61'),'HOUR':_0xce67('0x62'),'ROUND':_0xce67('0x63'),'UNIX_TIMESTAMP':_0xce67('0x64')};var _0x3784d5=function(_0x29b186){return!_[_0xce67('0x65')](['IS\x20NULL','IS\x20NOT\x20NULL',_0xce67('0x66'),_0xce67('0x67')],_0x29b186);};var _0x19961a=function(_0xf6dfbe){if(!_0xf6dfbe||!_0xf6dfbe['rules'][_0xce67('0x38')]){return'';}for(var _0x3404f6='(',_0x5b34c9=0x0;_0x5b34c9<_0xf6dfbe[_0xce67('0x68')][_0xce67('0x38')];_0x5b34c9+=0x1){_0x5b34c9>0x0&&(_0x3404f6+='\x20'+_0xf6dfbe[_0xce67('0x69')]+'\x20');_0x3404f6+=_0xf6dfbe[_0xce67('0x68')][_0x5b34c9][_0xce67('0x6a')]?_0x19961a(_0xf6dfbe[_0xce67('0x68')][_0x5b34c9][_0xce67('0x6a')]):_0xf6dfbe[_0xce67('0x68')][_0x5b34c9]['field']+'\x20'+_0xf6dfbe[_0xce67('0x68')][_0x5b34c9]['condition']+(_0x3784d5(_0xf6dfbe[_0xce67('0x68')][_0x5b34c9][_0xce67('0x6b')])?'\x20'+_0xf6dfbe['rules'][_0x5b34c9]['value']:'');}return _0x3404f6+')';};var _0x5d458e={'where':{'id':_0x5d47b3[_0xce67('0x49')]['id']}},_0x40148e,_0x51e455,_0x193247,_0x13a76e,_0x2a0201;_0x5d458e=_[_0xce67('0x40')]({},_0x5d458e,_0x5d47b3[_0xce67('0x4b')]);return db['AnalyticCustomReport'][_0xce67('0x4c')](_0x5d458e)[_0xce67('0x25')](function(_0x2e8ffb){if(_0x2e8ffb){_0x40148e=_0x2e8ffb;return _0x2e8ffb[_0xce67('0x6c')]();}return null;})[_0xce67('0x25')](function(_0x33ddfe){if(_0x33ddfe){if(!_0x33ddfe[_0xce67('0x38')]){throw new db[(_0xce67('0x6d'))][(_0xce67('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x51e455=_0x33ddfe;return db[_0xce67('0x6f')]['findAll']({'raw':!![]});}return null;})[_0xce67('0x25')](function(_0x4c2003){if(_0x4c2003){_0x193247=_['keyBy'](_0x4c2003,'id');var _0xba749e;var _0x21f045=squel[_0xce67('0x70')]();_0x21f045[_0xce67('0x71')](_0x40148e[_0xce67('0x72')]);for(var _0x12af5d=0x0;_0x12af5d<_0x51e455['length'];_0x12af5d+=0x1){_0xba749e=_0x51e455[_0x12af5d][_0xce67('0x73')]?_0x193247[_0x51e455[_0x12af5d]['MetricId']]['metric']:_0x51e455[_0x12af5d][_0xce67('0x74')];_0xba749e=_0x51e455[_0x12af5d]['function']?_['replace'](_0x66087b[_0x51e455[_0x12af5d][_0xce67('0x75')]],'%s',_0xba749e):_0xba749e;_0xba749e=_0x51e455[_0x12af5d][_0xce67('0x76')]?_['replace'](_0x44dc48[_0x51e455[_0x12af5d][_0xce67('0x76')]],'%s',_0xba749e):_0xba749e;if(_0x51e455[_0x12af5d]['groupBy']){_0x21f045[_0xce67('0x6a')](_0xba749e);}_0x51e455[_0x12af5d][_0xce67('0x77')]&&_0x21f045['order'](_0xba749e,_0x51e455[_0x12af5d][_0xce67('0x77')]===_0xce67('0x78')?![]:!![]);_0x21f045[_0xce67('0x74')](_0xba749e,_0x51e455[_0x12af5d][_0xce67('0x79')]||_0xba749e);}if(_0x40148e['joins']){_0x40148e[_0xce67('0x7a')]=JSON['parse'](_0x40148e[_0xce67('0x7a')]);for(var _0x182d06=0x0;_0x182d06<_0x40148e[_0xce67('0x7a')][_0xce67('0x38')];_0x182d06+=0x1){if(_0x40148e['joins'][_0x182d06][_0xce67('0x41')]&&_[_0xce67('0x65')](_0x54578c,_0x40148e[_0xce67('0x7a')][_0x182d06]['type'])&&_0x40148e[_0xce67('0x7a')][_0x182d06][_0xce67('0x7b')]&&_0x40148e[_0xce67('0x7a')][_0x182d06][_0xce67('0x7c')]&&_0x40148e[_0xce67('0x7a')][_0x182d06][_0xce67('0x7d')]){_0x21f045[_0x40148e['joins'][_0x182d06]['type']](_0x40148e[_0xce67('0x7a')][_0x182d06][_0xce67('0x7c')],null,util[_0xce67('0x76')](_0xce67('0x7e'),_0x40148e[_0xce67('0x72')],_0x40148e[_0xce67('0x7a')][_0x182d06]['parentKey'],_0x40148e[_0xce67('0x7a')][_0x182d06][_0xce67('0x7c')],_0x40148e[_0xce67('0x7a')][_0x182d06][_0xce67('0x7d')]));}}}if(_0x40148e[_0xce67('0x7f')]){_0x40148e['conditions']=JSON[_0xce67('0x80')](_0x40148e[_0xce67('0x7f')]);_0x21f045['where'](_0x19961a(_0x40148e['conditions'][_0xce67('0x6a')]));}_0x2a0201=_0x21f045[_0xce67('0x81')]();_0x21f045[_0xce67('0x1d')](_0x7c508d);_0x21f045[_0xce67('0x1f')](0x0);logger[_0xce67('0x82')](_0xce67('0x83'),_0x21f045[_0xce67('0x84')]());return dbH[_0xce67('0x85')][_0xce67('0x32')](_0x21f045['toString'](),{'type':dbH[_0xce67('0x85')][_0xce67('0x86')][_0xce67('0x87')]});}})[_0xce67('0x25')](respondWithResult(_0x42c1a8,null))[_0xce67('0x47')](handleError(_0x42c1a8,null));};function runReport(_0x3001d8,_0x32483e,_0x4d3ac2){var _0x3c3d92=_0x32483e[_0xce67('0x2a')];var _0x4b1433=0xa;var _0x2f671f=[_0xce67('0x57'),_0xce67('0x58'),_0xce67('0x88'),_0xce67('0x89')];var _0xd109d6={'SUM':_0xce67('0x8a'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xce67('0x5a'),'MAX':_0xce67('0x5b'),'MIN':_0xce67('0x8b'),'AVG':_0xce67('0x5c'),'GROUP_CONCAT':_0xce67('0x5d'),'GROUP_CONCAT ASC':_0xce67('0x5e'),'GROUP_CONCAT DESC':_0xce67('0x5f')};var _0x42d215={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xce67('0x61'),'HOUR':_0xce67('0x62'),'ROUND':_0xce67('0x63'),'UNIX_TIMESTAMP':_0xce67('0x64')};var _0xfb36cf=function(_0x375316){return!_[_0xce67('0x65')](['IS\x20NULL',_0xce67('0x8c'),_0xce67('0x66'),_0xce67('0x67')],_0x375316);};var _0x217259=function(_0x2c6ea4){if(!_0x2c6ea4||!_0x2c6ea4[_0xce67('0x68')][_0xce67('0x38')]){return'';}for(var _0xeb4aea='(',_0xed2674=0x0;_0xed2674<_0x2c6ea4[_0xce67('0x68')][_0xce67('0x38')];_0xed2674+=0x1){_0xed2674>0x0&&(_0xeb4aea+='\x20'+_0x2c6ea4[_0xce67('0x69')]+'\x20');_0xeb4aea+=_0x2c6ea4[_0xce67('0x68')][_0xed2674][_0xce67('0x6a')]?_0x217259(_0x2c6ea4[_0xce67('0x68')][_0xed2674][_0xce67('0x6a')]):_0x2c6ea4['rules'][_0xed2674][_0xce67('0x74')]+'\x20'+_0x2c6ea4[_0xce67('0x68')][_0xed2674]['condition']+(_0xfb36cf(_0x2c6ea4['rules'][_0xed2674]['condition'])?'\x20'+_0x2c6ea4[_0xce67('0x68')][_0xed2674]['value']:'');}return _0xeb4aea+')';};var _0x7fd509={'where':{'id':_0x3001d8['id']}},_0x260324,_0x4e6a55,_0x4f0b03,_0x34cc88,_0x12ed35;_0x7fd509=_[_0xce67('0x40')]({},_0x7fd509,_0x4d3ac2);return db[_0xce67('0x43')][_0xce67('0x4c')](_0x7fd509)['then'](function(_0x3807b4){if(_0x3807b4){_0x260324=_0x3807b4;return _0x3807b4['getFields']();}return null;})['then'](function(_0x5e353f){if(_0x5e353f){if(!_0x5e353f[_0xce67('0x38')]){throw new db[(_0xce67('0x6d'))]['ValidationErrorItem'](_0xce67('0x8d'),0x193);}_0x4e6a55=_0x5e353f;return db['AnalyticMetric'][_0xce67('0x45')]({'raw':!![]});}return null;})[_0xce67('0x25')](function(_0x1149dd){if(_0x1149dd){_0x4f0b03=_[_0xce67('0x8e')](_0x1149dd,'id');var _0x2b4147;var _0x31c923=squel['select']();_0x31c923[_0xce67('0x71')](_0x260324[_0xce67('0x72')]);for(var _0x366b32=0x0;_0x366b32<_0x4e6a55[_0xce67('0x38')];_0x366b32+=0x1){_0x2b4147=_0x4e6a55[_0x366b32][_0xce67('0x73')]?_0x4f0b03[_0x4e6a55[_0x366b32]['MetricId']][_0xce67('0x8f')]:_0x4e6a55[_0x366b32][_0xce67('0x74')];_0x2b4147=_0x4e6a55[_0x366b32][_0xce67('0x75')]?_[_0xce67('0x90')](_0xd109d6[_0x4e6a55[_0x366b32][_0xce67('0x75')]],'%s',_0x2b4147):_0x2b4147;_0x2b4147=_0x4e6a55[_0x366b32][_0xce67('0x76')]?_['replace'](_0x42d215[_0x4e6a55[_0x366b32][_0xce67('0x76')]],'%s',_0x2b4147):_0x2b4147;if(_0x4e6a55[_0x366b32][_0xce67('0x91')]){_0x31c923[_0xce67('0x6a')](_0x2b4147);}_0x4e6a55[_0x366b32]['orderBy']&&_0x31c923[_0xce67('0x3b')](_0x2b4147,_0x4e6a55[_0x366b32]['orderBy']==='DESC'?![]:!![]);_0x31c923[_0xce67('0x74')](_0x2b4147,_0x4e6a55[_0x366b32][_0xce67('0x79')]||_0x2b4147);}if(_0x260324[_0xce67('0x7a')]){_0x260324[_0xce67('0x7a')]=JSON[_0xce67('0x80')](_0x260324['joins']);for(var _0x118c92=0x0;_0x118c92<_0x260324[_0xce67('0x7a')][_0xce67('0x38')];_0x118c92+=0x1){if(_0x260324['joins'][_0x118c92][_0xce67('0x41')]&&_[_0xce67('0x65')](_0x2f671f,_0x260324['joins'][_0x118c92][_0xce67('0x41')])&&_0x260324[_0xce67('0x7a')][_0x118c92][_0xce67('0x7b')]&&_0x260324[_0xce67('0x7a')][_0x118c92][_0xce67('0x7c')]&&_0x260324[_0xce67('0x7a')][_0x118c92][_0xce67('0x7d')]){_0x31c923[_0x260324['joins'][_0x118c92][_0xce67('0x41')]](_0x260324[_0xce67('0x7a')][_0x118c92][_0xce67('0x7c')],null,util[_0xce67('0x76')](_0xce67('0x7e'),_0x260324[_0xce67('0x72')],_0x260324[_0xce67('0x7a')][_0x118c92][_0xce67('0x7b')],_0x260324['joins'][_0x118c92][_0xce67('0x7c')],_0x260324[_0xce67('0x7a')][_0x118c92][_0xce67('0x7d')]));}}}if(_0x260324[_0xce67('0x7f')]){_0x260324[_0xce67('0x7f')]=JSON['parse'](_0x260324[_0xce67('0x7f')]);_0x31c923[_0xce67('0x3d')](_0x217259(_0x260324[_0xce67('0x7f')][_0xce67('0x6a')]));}_0x12ed35=_0x31c923[_0xce67('0x81')]();_0x31c923['limit'](_0x4b1433);_0x31c923[_0xce67('0x1f')](0x0);return;}})['then'](function(){if(_0x32483e[_0xce67('0x92')]===_0xce67('0x93')){return null;}var _0x13d9c2=_[_0xce67('0x40')](_0x32483e,{'name':_0x32483e[_0xce67('0x94')]||_0x32483e[_0xce67('0x2a')]||_0x260324[_0xce67('0x2a')],'basename':_0x3c3d92,'savename':util['format'](_0xce67('0x95'),_0x32483e[_0xce67('0x2a')]||_0x260324[_0xce67('0x2a')],require(_0xce67('0x96'))[_0xce67('0x97')](0x4),_0x32483e[_0xce67('0x92')]||'csv'),'reportId':_0x260324['id'],'reportType':'custom'});return db['AnalyticExtractedReport']['create'](_0x13d9c2,{'raw':!![]});})['then'](function(_0x5d2042){if(_0x260324[_0xce67('0x72')]===_0xce67('0x98')){_0x12ed35['where'](_0x260324[_0xce67('0x72')]+_0xce67('0x99'),_0x32483e['startDate'],_0x32483e[_0xce67('0x9a')]);}else{_0x12ed35[_0xce67('0x3d')](_0x260324[_0xce67('0x72')]+_0xce67('0x9b'),_0x32483e[_0xce67('0x9c')],_0x32483e['endDate']);}if(_0x5d2042){logger[_0xce67('0x9d')](_0xce67('0x9e'),_0x12ed35[_0xce67('0x84')]());require(_0xce67('0x9f'))['fork'](path[_0xce67('0x57')](__dirname,_0xce67('0xa0'),_0x5d2042[_0xce67('0x92')]),[_0x5d2042['id'],_0x12ed35[_0xce67('0x84')](),path['join'](__dirname,_0xce67('0xa1'),_0x5d2042[_0xce67('0xa2')]),_0x3c3d92]);return _0x5d2042;}else{var _0x3abca2=squel[_0xce67('0x70')]();_0x3abca2[_0xce67('0x71')]('('+_0x12ed35[_0xce67('0x84')]()+')',_0xce67('0xa3'));_0x3abca2[_0xce67('0x74')](_0xce67('0xa4'),'count');_0x12ed35[_0xce67('0x1d')](_0x32483e[_0xce67('0x1d')]||_0x4b1433);_0x12ed35[_0xce67('0x1f')](_0x32483e[_0xce67('0x1f')]||0x0);return dbH[_0xce67('0x85')][_0xce67('0x32')](_0x3abca2[_0xce67('0x84')](),{'type':dbH['sequelize'][_0xce67('0x86')]['SELECT']})[_0xce67('0x25')](function(_0x2d2b22){if(!_0x2d2b22[_0xce67('0x38')]){_0x34cc88=0x0;}else{_0x34cc88=_0x2d2b22[0x0][_0xce67('0x1e')]||0x0;}return dbH['sequelize'][_0xce67('0x32')](_0x12ed35[_0xce67('0x84')](),{'type':dbH[_0xce67('0x85')][_0xce67('0x86')][_0xce67('0x87')]});})[_0xce67('0x25')](function(_0xb3c6da){return{'rows':_0xb3c6da||[],'count':_0x34cc88};});}});}exports[_0xce67('0xa5')]=function(_0x520f9b,_0x3e308f){return runReport(_0x520f9b[_0xce67('0x49')],_0x520f9b[_0xce67('0x32')],_0x520f9b[_0xce67('0x4b')])['then'](respondWithResult(_0x3e308f,null))[_0xce67('0x47')](handleError(_0x3e308f,null));};exports[_0xce67('0xa6')]=runReport;exports[_0xce67('0x32')]=function(_0x265b57,_0x1d97ef){var _0x3ef56d=0xa;var _0x3991db=[_0xce67('0x57'),_0xce67('0x58'),_0xce67('0x88'),_0xce67('0x89')];var _0x3cb30e={'SUM':'SUM(%s)','COUNT':_0xce67('0x59'),'COUNT DISTINCT':_0xce67('0x5a'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xce67('0x5f')};var _0x5e3b3a={'SEC_TO_TIME':_0xce67('0x60'),'DATE':_0xce67('0x61'),'HOUR':_0xce67('0x62'),'ROUND':_0xce67('0x63'),'UNIX_TIMESTAMP':_0xce67('0x64')};var _0xabdb2=function(_0x555fd7){return!_[_0xce67('0x65')](['IS\x20NULL',_0xce67('0x8c'),_0xce67('0x66'),'IS\x20NOT\x20EMPTY'],_0x555fd7);};var _0x387bc5=function(_0x87061c){if(!_0x87061c||!_0x87061c[_0xce67('0x68')][_0xce67('0x38')]){return'';}for(var _0x17bb98='(',_0x5ef878=0x0;_0x5ef878<_0x87061c[_0xce67('0x68')][_0xce67('0x38')];_0x5ef878+=0x1){_0x5ef878>0x0&&(_0x17bb98+='\x20'+_0x87061c['operator']+'\x20');_0x17bb98+=_0x87061c['rules'][_0x5ef878]['group']?_0x387bc5(_0x87061c[_0xce67('0x68')][_0x5ef878][_0xce67('0x6a')]):_0x87061c['rules'][_0x5ef878][_0xce67('0x74')]+'\x20'+_0x87061c['rules'][_0x5ef878][_0xce67('0x6b')]+(_0xabdb2(_0x87061c[_0xce67('0x68')][_0x5ef878][_0xce67('0x6b')])?'\x20'+_0x87061c[_0xce67('0x68')][_0x5ef878][_0xce67('0xa7')]:'');}return _0x17bb98+')';};var _0x5dddc8={'where':{'id':_0x265b57[_0xce67('0x49')]['id']}},_0x26e151,_0x35b720,_0x190835,_0x207f7c,_0x118125;_0x5dddc8=_[_0xce67('0x40')]({},_0x5dddc8,_0x265b57[_0xce67('0x4b')]);return db[_0xce67('0x43')][_0xce67('0x4c')](_0x5dddc8)['then'](function(_0x498005){if(_0x498005){_0x26e151=_0x498005;return _0x498005[_0xce67('0x6c')]();}return null;})['then'](function(_0x40673a){if(_0x40673a){if(!_0x40673a[_0xce67('0x38')]){throw new db[(_0xce67('0x6d'))][(_0xce67('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x35b720=_0x40673a;return db[_0xce67('0x6f')][_0xce67('0x45')]({'raw':!![]});}return null;})[_0xce67('0x25')](function(_0x21bd2c){if(_0x21bd2c){_0x190835=_[_0xce67('0x8e')](_0x21bd2c,'id');var _0x32b129;var _0x572e7c=squel['select']();_0x572e7c['from'](_0x26e151['table']);for(var _0x520fb1=0x0;_0x520fb1<_0x35b720[_0xce67('0x38')];_0x520fb1+=0x1){_0x32b129=_0x35b720[_0x520fb1][_0xce67('0x73')]?_0x190835[_0x35b720[_0x520fb1][_0xce67('0x73')]][_0xce67('0x8f')]:_0x35b720[_0x520fb1][_0xce67('0x74')];_0x32b129=_0x35b720[_0x520fb1]['function']?_[_0xce67('0x90')](_0x3cb30e[_0x35b720[_0x520fb1][_0xce67('0x75')]],'%s',_0x32b129):_0x32b129;_0x32b129=_0x35b720[_0x520fb1]['format']?_['replace'](_0x5e3b3a[_0x35b720[_0x520fb1][_0xce67('0x76')]],'%s',_0x32b129):_0x32b129;if(_0x35b720[_0x520fb1][_0xce67('0x91')]){_0x572e7c[_0xce67('0x6a')](_0x32b129);}_0x35b720[_0x520fb1][_0xce67('0x77')]&&_0x572e7c[_0xce67('0x3b')](_0x32b129,_0x35b720[_0x520fb1]['orderBy']==='DESC'?![]:!![]);_0x572e7c[_0xce67('0x74')](_0x32b129,_0x35b720[_0x520fb1][_0xce67('0x79')]||_0x32b129);}if(_0x26e151[_0xce67('0x7a')]){_0x26e151[_0xce67('0x7a')]=JSON['parse'](_0x26e151[_0xce67('0x7a')]);for(var _0x3540ad=0x0;_0x3540ad<_0x26e151[_0xce67('0x7a')]['length'];_0x3540ad+=0x1){if(_0x26e151[_0xce67('0x7a')][_0x3540ad][_0xce67('0x41')]&&_[_0xce67('0x65')](_0x3991db,_0x26e151[_0xce67('0x7a')][_0x3540ad]['type'])&&_0x26e151[_0xce67('0x7a')][_0x3540ad][_0xce67('0x7b')]&&_0x26e151[_0xce67('0x7a')][_0x3540ad]['foreignTable']&&_0x26e151[_0xce67('0x7a')][_0x3540ad][_0xce67('0x7d')]){_0x572e7c[_0x26e151[_0xce67('0x7a')][_0x3540ad][_0xce67('0x41')]](_0x26e151[_0xce67('0x7a')][_0x3540ad][_0xce67('0x7c')],null,util[_0xce67('0x76')](_0xce67('0x7e'),_0x26e151['table'],_0x26e151[_0xce67('0x7a')][_0x3540ad][_0xce67('0x7b')],_0x26e151[_0xce67('0x7a')][_0x3540ad]['foreignTable'],_0x26e151['joins'][_0x3540ad][_0xce67('0x7d')]));}}}if(_0x26e151[_0xce67('0x7f')]){_0x26e151[_0xce67('0x7f')]=JSON[_0xce67('0x80')](_0x26e151[_0xce67('0x7f')]);_0x572e7c['where'](_0x387bc5(_0x26e151['conditions'][_0xce67('0x6a')]));}_0x118125=_0x572e7c[_0xce67('0x81')]();_0x572e7c['limit'](_0x3ef56d);_0x572e7c['offset'](0x0);logger['debug']('Limited\x20Query:',_0x572e7c[_0xce67('0x84')]());return dbH[_0xce67('0x85')][_0xce67('0x32')](_0x572e7c[_0xce67('0x84')](),{'type':dbH[_0xce67('0x85')]['QueryTypes'][_0xce67('0x87')]});}})[_0xce67('0x25')](function(){return{'sql':_0x118125[_0xce67('0x84')]()};})['then'](respondWithResult(_0x1d97ef,null))['catch'](handleError(_0x1d97ef,null));}; \ No newline at end of file +var _0xc8f2=['join','right_join','COUNT(%s)','MAX(%s)','MIN(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','DESC','alias','output','web','fullPath','randomstring','generate','csv','AnalyticExtractedReport','startDate','endDate','info','Run\x20Query:','child_process','../../components/export/','SELECT','run','runReport','operator','ValidationErrorItem','metric','groupBy','Limited\x20Query:','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','then','get','UserProfileResource','error','stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','count','includeAll','findAll','rows','catch','show','params','keys','intersection','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','preview','left_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','options','getFields','Sequelize','select','table','MetricId','function','format','replace','orderBy','order','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','toString','sequelize','QueryTypes'];(function(_0x3b2421,_0xf30f91){var _0x288bde=function(_0x1d1db6){while(--_0x1d1db6){_0x3b2421['push'](_0x3b2421['shift']());}};_0x288bde(++_0xf30f91);}(_0xc8f2,0xc3));var _0x2c8f=function(_0x33089b,_0x5b755d){_0x33089b=_0x33089b-0x0;var _0x3299b9=_0xc8f2[_0x33089b];return _0x3299b9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2c8f('0x0'));var zipdir=require(_0x2c8f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2c8f('0x2'));var moment=require(_0x2c8f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2c8f('0x4'));var util=require('util');var path=require(_0x2c8f('0x5'));var sox=require(_0x2c8f('0x6'));var csv=require(_0x2c8f('0x7'));var ejs=require(_0x2c8f('0x8'));var fs=require('fs');var fs_extra=require(_0x2c8f('0x9'));var _=require('lodash');var squel=require(_0x2c8f('0xa'));var crypto=require(_0x2c8f('0xb'));var jsforce=require(_0x2c8f('0xc'));var deskjs=require(_0x2c8f('0xd'));var toCsv=require(_0x2c8f('0x7'));var querystring=require('querystring');var Papa=require(_0x2c8f('0xe'));var Redis=require(_0x2c8f('0xf'));var authService=require(_0x2c8f('0x10'));var qs=require(_0x2c8f('0x11'));var as=require(_0x2c8f('0x12'));var hardwareService=require(_0x2c8f('0x13'));var logger=require('../../config/logger')(_0x2c8f('0x14'));var utils=require(_0x2c8f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2c8f('0x16'));var db=require(_0x2c8f('0x17'))['db'];var dbH=require(_0x2c8f('0x17'))[_0x2c8f('0x18')];function respondWithStatusCode(_0x45864c,_0x68f273){_0x68f273=_0x68f273||0xcc;return function(_0x1b8ded){if(_0x1b8ded){return _0x45864c[_0x2c8f('0x19')](_0x68f273);}return _0x45864c[_0x2c8f('0x1a')](_0x68f273)[_0x2c8f('0x1b')]();};}function respondWithResult(_0x3d0298,_0x3a70ba){_0x3a70ba=_0x3a70ba||0xc8;return function(_0x41de1c){if(_0x41de1c){return _0x3d0298[_0x2c8f('0x1a')](_0x3a70ba)[_0x2c8f('0x1c')](_0x41de1c);}};}function respondWithFilteredResult(_0x5150d3,_0x5c6252){return function(_0x41bb0a){if(_0x41bb0a){var _0x47080a=typeof _0x5c6252[_0x2c8f('0x1d')]===_0x2c8f('0x1e')&&typeof _0x5c6252[_0x2c8f('0x1f')]==='undefined';var _0x4eefd9=_0x41bb0a['count'];var _0x837d03=_0x47080a?0x0:_0x5c6252['offset'];var _0x571411=_0x47080a?_0x41bb0a['count']:_0x5c6252[_0x2c8f('0x1d')]+_0x5c6252[_0x2c8f('0x1f')];var _0x1bac03;if(_0x571411>=_0x4eefd9){_0x571411=_0x4eefd9;_0x1bac03=0xc8;}else{_0x1bac03=0xce;}_0x5150d3['status'](_0x1bac03);return _0x5150d3[_0x2c8f('0x20')]('Content-Range',_0x837d03+'-'+_0x571411+'/'+_0x4eefd9)[_0x2c8f('0x1c')](_0x41bb0a);}return null;};}function patchUpdates(_0x926143){return function(_0x222400){try{jsonpatch[_0x2c8f('0x21')](_0x222400,_0x926143,!![]);}catch(_0x1b5f77){return BPromise[_0x2c8f('0x22')](_0x1b5f77);}return _0x222400['save']();};}function saveUpdates(_0x562cdb,_0x1600ce){return function(_0x3e1b59){if(_0x3e1b59){return _0x3e1b59['update'](_0x562cdb)[_0x2c8f('0x23')](function(_0x2b83e1){return _0x2b83e1;});}return null;};}function removeEntity(_0x276bdb,_0x50d3d8){return function(_0x1930ce){if(_0x1930ce){return _0x1930ce['destroy']()[_0x2c8f('0x23')](function(){var _0x106737=_0x1930ce[_0x2c8f('0x24')]({'plain':!![]});var _0x5f4b92='CustomReports';return db[_0x2c8f('0x25')]['destroy']({'where':{'type':_0x5f4b92,'resourceId':_0x106737['id']}})[_0x2c8f('0x23')](function(){return _0x1930ce;});})['then'](function(){_0x276bdb['status'](0xcc)[_0x2c8f('0x1b')]();});}};}function handleEntityNotFound(_0x92f7fd,_0x1c83b8){return function(_0x474755){if(!_0x474755){_0x92f7fd['sendStatus'](0x194);}return _0x474755;};}function handleError(_0x224f80,_0x2aac35){_0x2aac35=_0x2aac35||0x1f4;return function(_0x56215b){logger[_0x2c8f('0x26')](_0x56215b[_0x2c8f('0x27')]);if(_0x56215b[_0x2c8f('0x28')]){delete _0x56215b['name'];}_0x224f80[_0x2c8f('0x1a')](_0x2aac35)['send'](_0x56215b);};}exports[_0x2c8f('0x29')]=function(_0x3de2ab,_0x28656b){var _0x16ab0a={},_0x793710={},_0x274df2={'count':0x0,'rows':[]};var _0x152733=_[_0x2c8f('0x2a')](db[_0x2c8f('0x2b')][_0x2c8f('0x2c')],function(_0x3e4f17){return{'name':_0x3e4f17[_0x2c8f('0x2d')],'type':_0x3e4f17[_0x2c8f('0x2e')][_0x2c8f('0x2f')]};});_0x793710['model']=_['map'](_0x152733,_0x2c8f('0x28'));_0x793710[_0x2c8f('0x30')]=_['keys'](_0x3de2ab[_0x2c8f('0x30')]);_0x793710[_0x2c8f('0x31')]=_['intersection'](_0x793710[_0x2c8f('0x32')],_0x793710[_0x2c8f('0x30')]);_0x16ab0a['attributes']=_['intersection'](_0x793710['model'],qs[_0x2c8f('0x33')](_0x3de2ab['query'][_0x2c8f('0x33')]));_0x16ab0a['attributes']=_0x16ab0a[_0x2c8f('0x34')][_0x2c8f('0x35')]?_0x16ab0a[_0x2c8f('0x34')]:_0x793710[_0x2c8f('0x32')];if(!_0x3de2ab['query'][_0x2c8f('0x36')](_0x2c8f('0x37'))){_0x16ab0a[_0x2c8f('0x1f')]=qs[_0x2c8f('0x1f')](_0x3de2ab[_0x2c8f('0x30')][_0x2c8f('0x1f')]);_0x16ab0a[_0x2c8f('0x1d')]=qs[_0x2c8f('0x1d')](_0x3de2ab[_0x2c8f('0x30')][_0x2c8f('0x1d')]);}_0x16ab0a['order']=qs[_0x2c8f('0x38')](_0x3de2ab[_0x2c8f('0x30')][_0x2c8f('0x38')]);_0x16ab0a[_0x2c8f('0x39')]=qs[_0x2c8f('0x31')](_['pick'](_0x3de2ab['query'],_0x793710['filters']),_0x152733);if(_0x3de2ab[_0x2c8f('0x30')]['filter']){_0x16ab0a[_0x2c8f('0x39')]=_[_0x2c8f('0x3a')](_0x16ab0a[_0x2c8f('0x39')],{'$or':_['map'](_0x152733,function(_0x14374d){if(_0x14374d[_0x2c8f('0x2e')]!==_0x2c8f('0x3b')){var _0x1b7de4={};_0x1b7de4[_0x14374d['name']]={'$like':'%'+_0x3de2ab[_0x2c8f('0x30')][_0x2c8f('0x3c')]+'%'};return _0x1b7de4;}})});}_0x16ab0a=_['merge']({},_0x16ab0a,_0x3de2ab['options']);var _0x1a8971={'where':_0x16ab0a[_0x2c8f('0x39')]};return db[_0x2c8f('0x2b')][_0x2c8f('0x3d')](_0x1a8971)[_0x2c8f('0x23')](function(_0x19b18c){_0x274df2[_0x2c8f('0x3d')]=_0x19b18c;if(_0x3de2ab['query'][_0x2c8f('0x3e')]){_0x16ab0a['include']=[{'all':!![]}];}return db[_0x2c8f('0x2b')][_0x2c8f('0x3f')](_0x16ab0a);})['then'](function(_0x4ca9b1){_0x274df2[_0x2c8f('0x40')]=_0x4ca9b1;return _0x274df2;})[_0x2c8f('0x23')](respondWithFilteredResult(_0x28656b,_0x16ab0a))[_0x2c8f('0x41')](handleError(_0x28656b,null));};exports[_0x2c8f('0x42')]=function(_0x465100,_0x385574){var _0x920042={'raw':![],'where':{'id':_0x465100[_0x2c8f('0x43')]['id']}},_0x2b110b={};_0x2b110b[_0x2c8f('0x32')]=_[_0x2c8f('0x44')](db[_0x2c8f('0x2b')][_0x2c8f('0x2c')]);_0x2b110b[_0x2c8f('0x30')]=_['keys'](_0x465100[_0x2c8f('0x30')]);_0x2b110b[_0x2c8f('0x31')]=_[_0x2c8f('0x45')](_0x2b110b[_0x2c8f('0x32')],_0x2b110b[_0x2c8f('0x30')]);_0x920042[_0x2c8f('0x34')]=_[_0x2c8f('0x45')](_0x2b110b[_0x2c8f('0x32')],qs[_0x2c8f('0x33')](_0x465100['query']['fields']));_0x920042[_0x2c8f('0x34')]=_0x920042[_0x2c8f('0x34')][_0x2c8f('0x35')]?_0x920042['attributes']:_0x2b110b[_0x2c8f('0x32')];if(_0x465100[_0x2c8f('0x30')][_0x2c8f('0x3e')]){_0x920042[_0x2c8f('0x46')]=[{'all':!![]}];}_0x920042=_['merge']({},_0x920042,_0x465100['options']);return db[_0x2c8f('0x2b')][_0x2c8f('0x47')](_0x920042)[_0x2c8f('0x23')](handleEntityNotFound(_0x385574,null))[_0x2c8f('0x23')](respondWithResult(_0x385574,null))['catch'](handleError(_0x385574,null));};exports[_0x2c8f('0x48')]=function(_0x154da4,_0x25f2ed){return db[_0x2c8f('0x2b')][_0x2c8f('0x48')](_0x154da4[_0x2c8f('0x49')],{})['then'](function(_0x2c6cea){var _0x344a23=_0x154da4[_0x2c8f('0x4a')]['get']({'plain':!![]});if(!_0x344a23)throw new Error(_0x2c8f('0x4b'));if(_0x344a23['role']==='user'){var _0x287ec1=_0x2c6cea['get']({'plain':!![]});var _0x52cb52=_0x2c8f('0x4c');return db[_0x2c8f('0x4d')][_0x2c8f('0x47')]({'where':{'name':_0x52cb52,'userProfileId':_0x344a23[_0x2c8f('0x4e')]},'raw':!![]})[_0x2c8f('0x23')](function(_0x1e826e){if(_0x1e826e&&_0x1e826e['autoAssociation']===0x0){return db[_0x2c8f('0x25')][_0x2c8f('0x48')]({'name':_0x287ec1[_0x2c8f('0x28')],'resourceId':_0x287ec1['id'],'type':'CustomReports','sectionId':_0x1e826e['id']},{})[_0x2c8f('0x23')](function(){return _0x2c6cea;});}else{return _0x2c6cea;}})[_0x2c8f('0x41')](function(_0xbcfb9c){logger['error'](_0x2c8f('0x4f'),_0xbcfb9c);throw _0xbcfb9c;});}return _0x2c6cea;})['then'](respondWithResult(_0x25f2ed,0xc9))[_0x2c8f('0x41')](handleError(_0x25f2ed,null));};exports[_0x2c8f('0x50')]=function(_0x427dbe,_0x596d9d){if(_0x427dbe[_0x2c8f('0x49')]['id']){delete _0x427dbe[_0x2c8f('0x49')]['id'];}return db[_0x2c8f('0x2b')][_0x2c8f('0x47')]({'where':{'id':_0x427dbe[_0x2c8f('0x43')]['id']}})['then'](handleEntityNotFound(_0x596d9d,null))[_0x2c8f('0x23')](saveUpdates(_0x427dbe[_0x2c8f('0x49')],null))[_0x2c8f('0x23')](respondWithResult(_0x596d9d,null))[_0x2c8f('0x41')](handleError(_0x596d9d,null));};exports[_0x2c8f('0x51')]=function(_0x1f6978,_0x562269){return db[_0x2c8f('0x2b')][_0x2c8f('0x47')]({'where':{'id':_0x1f6978[_0x2c8f('0x43')]['id']}})['then'](handleEntityNotFound(_0x562269,null))[_0x2c8f('0x23')](removeEntity(_0x562269,null))[_0x2c8f('0x41')](handleError(_0x562269,null));};exports[_0x2c8f('0x52')]=function(_0x41082c,_0x3efad4){var _0x1007a1=0xa;var _0x8c69d4=['join',_0x2c8f('0x53'),'right_join',_0x2c8f('0x54')];var _0x2834f3={'SUM':_0x2c8f('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x2c8f('0x56'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x2c8f('0x57'),'GROUP_CONCAT':_0x2c8f('0x58'),'GROUP_CONCAT ASC':_0x2c8f('0x59'),'GROUP_CONCAT DESC':_0x2c8f('0x5a')};var _0x175ca3={'SEC_TO_TIME':_0x2c8f('0x5b'),'DATE':_0x2c8f('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0x2c8f('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xfca46a=function(_0x5409a0){return!_[_0x2c8f('0x5e')]([_0x2c8f('0x5f'),_0x2c8f('0x60'),_0x2c8f('0x61'),_0x2c8f('0x62')],_0x5409a0);};var _0xe12fb=function(_0x42c459){if(!_0x42c459||!_0x42c459[_0x2c8f('0x63')][_0x2c8f('0x35')]){return'';}for(var _0xb45ccb='(',_0x3f3295=0x0;_0x3f3295<_0x42c459[_0x2c8f('0x63')]['length'];_0x3f3295+=0x1){_0x3f3295>0x0&&(_0xb45ccb+='\x20'+_0x42c459['operator']+'\x20');_0xb45ccb+=_0x42c459['rules'][_0x3f3295][_0x2c8f('0x64')]?_0xe12fb(_0x42c459[_0x2c8f('0x63')][_0x3f3295][_0x2c8f('0x64')]):_0x42c459['rules'][_0x3f3295][_0x2c8f('0x65')]+'\x20'+_0x42c459[_0x2c8f('0x63')][_0x3f3295][_0x2c8f('0x66')]+(_0xfca46a(_0x42c459[_0x2c8f('0x63')][_0x3f3295][_0x2c8f('0x66')])?'\x20'+_0x42c459['rules'][_0x3f3295][_0x2c8f('0x67')]:'');}return _0xb45ccb+')';};var _0x580874={'where':{'id':_0x41082c[_0x2c8f('0x43')]['id']}},_0x77e2f1,_0x5ed789,_0x3ec447,_0x517292,_0x552dac;_0x580874=_[_0x2c8f('0x3a')]({},_0x580874,_0x41082c[_0x2c8f('0x68')]);return db['AnalyticCustomReport']['find'](_0x580874)['then'](function(_0x1d04a0){if(_0x1d04a0){_0x77e2f1=_0x1d04a0;return _0x1d04a0[_0x2c8f('0x69')]();}return null;})[_0x2c8f('0x23')](function(_0x37e113){if(_0x37e113){if(!_0x37e113['length']){throw new db[(_0x2c8f('0x6a'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5ed789=_0x37e113;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x2ef4c2){if(_0x2ef4c2){_0x3ec447=_['keyBy'](_0x2ef4c2,'id');var _0x18b8c1;var _0x5abde5=squel[_0x2c8f('0x6b')]();_0x5abde5['from'](_0x77e2f1[_0x2c8f('0x6c')]);for(var _0x562cfe=0x0;_0x562cfe<_0x5ed789['length'];_0x562cfe+=0x1){_0x18b8c1=_0x5ed789[_0x562cfe][_0x2c8f('0x6d')]?_0x3ec447[_0x5ed789[_0x562cfe]['MetricId']]['metric']:_0x5ed789[_0x562cfe]['field'];_0x18b8c1=_0x5ed789[_0x562cfe][_0x2c8f('0x6e')]?_['replace'](_0x2834f3[_0x5ed789[_0x562cfe][_0x2c8f('0x6e')]],'%s',_0x18b8c1):_0x18b8c1;_0x18b8c1=_0x5ed789[_0x562cfe][_0x2c8f('0x6f')]?_[_0x2c8f('0x70')](_0x175ca3[_0x5ed789[_0x562cfe][_0x2c8f('0x6f')]],'%s',_0x18b8c1):_0x18b8c1;if(_0x5ed789[_0x562cfe]['groupBy']){_0x5abde5[_0x2c8f('0x64')](_0x18b8c1);}_0x5ed789[_0x562cfe][_0x2c8f('0x71')]&&_0x5abde5[_0x2c8f('0x72')](_0x18b8c1,_0x5ed789[_0x562cfe][_0x2c8f('0x71')]==='DESC'?![]:!![]);_0x5abde5[_0x2c8f('0x65')](_0x18b8c1,_0x5ed789[_0x562cfe]['alias']||_0x18b8c1);}if(_0x77e2f1[_0x2c8f('0x73')]){_0x77e2f1[_0x2c8f('0x73')]=JSON[_0x2c8f('0x74')](_0x77e2f1[_0x2c8f('0x73')]);for(var _0xb6bb81=0x0;_0xb6bb81<_0x77e2f1['joins'][_0x2c8f('0x35')];_0xb6bb81+=0x1){if(_0x77e2f1[_0x2c8f('0x73')][_0xb6bb81][_0x2c8f('0x2e')]&&_[_0x2c8f('0x5e')](_0x8c69d4,_0x77e2f1['joins'][_0xb6bb81]['type'])&&_0x77e2f1[_0x2c8f('0x73')][_0xb6bb81][_0x2c8f('0x75')]&&_0x77e2f1['joins'][_0xb6bb81][_0x2c8f('0x76')]&&_0x77e2f1[_0x2c8f('0x73')][_0xb6bb81][_0x2c8f('0x77')]){_0x5abde5[_0x77e2f1['joins'][_0xb6bb81][_0x2c8f('0x2e')]](_0x77e2f1[_0x2c8f('0x73')][_0xb6bb81]['foreignTable'],null,util[_0x2c8f('0x6f')](_0x2c8f('0x78'),_0x77e2f1['table'],_0x77e2f1[_0x2c8f('0x73')][_0xb6bb81][_0x2c8f('0x75')],_0x77e2f1[_0x2c8f('0x73')][_0xb6bb81]['foreignTable'],_0x77e2f1['joins'][_0xb6bb81][_0x2c8f('0x77')]));}}}if(_0x77e2f1['conditions']){_0x77e2f1['conditions']=JSON[_0x2c8f('0x74')](_0x77e2f1['conditions']);_0x5abde5[_0x2c8f('0x39')](_0xe12fb(_0x77e2f1[_0x2c8f('0x79')][_0x2c8f('0x64')]));}_0x552dac=_0x5abde5[_0x2c8f('0x7a')]();_0x5abde5['limit'](_0x1007a1);_0x5abde5[_0x2c8f('0x1d')](0x0);logger[_0x2c8f('0x7b')]('Limited\x20Query:',_0x5abde5[_0x2c8f('0x7c')]());return dbH[_0x2c8f('0x7d')][_0x2c8f('0x30')](_0x5abde5[_0x2c8f('0x7c')](),{'type':dbH[_0x2c8f('0x7d')][_0x2c8f('0x7e')]['SELECT']});}})[_0x2c8f('0x23')](respondWithResult(_0x3efad4,null))[_0x2c8f('0x41')](handleError(_0x3efad4,null));};function runReport(_0x4a3ae1,_0x30af09,_0x1d4706){var _0x1e5b47=_0x30af09[_0x2c8f('0x28')];var _0x177be1=0xa;var _0x517b64=[_0x2c8f('0x7f'),'left_join',_0x2c8f('0x80'),_0x2c8f('0x54')];var _0x292e0c={'SUM':_0x2c8f('0x55'),'COUNT':_0x2c8f('0x81'),'COUNT DISTINCT':_0x2c8f('0x56'),'MAX':_0x2c8f('0x82'),'MIN':_0x2c8f('0x83'),'AVG':_0x2c8f('0x57'),'GROUP_CONCAT':_0x2c8f('0x58'),'GROUP_CONCAT ASC':_0x2c8f('0x59'),'GROUP_CONCAT DESC':_0x2c8f('0x5a')};var _0x434f87={'SEC_TO_TIME':_0x2c8f('0x5b'),'DATE':'DATE(%s)','HOUR':_0x2c8f('0x84'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x2c8f('0x85')};var _0x55e0aa=function(_0x43819b){return!_[_0x2c8f('0x5e')]([_0x2c8f('0x5f'),_0x2c8f('0x60'),_0x2c8f('0x61'),'IS\x20NOT\x20EMPTY'],_0x43819b);};var _0x5aab29=function(_0x4e5094){if(!_0x4e5094||!_0x4e5094[_0x2c8f('0x63')][_0x2c8f('0x35')]){return'';}for(var _0x390ee6='(',_0x161311=0x0;_0x161311<_0x4e5094[_0x2c8f('0x63')][_0x2c8f('0x35')];_0x161311+=0x1){_0x161311>0x0&&(_0x390ee6+='\x20'+_0x4e5094['operator']+'\x20');_0x390ee6+=_0x4e5094[_0x2c8f('0x63')][_0x161311][_0x2c8f('0x64')]?_0x5aab29(_0x4e5094[_0x2c8f('0x63')][_0x161311][_0x2c8f('0x64')]):_0x4e5094[_0x2c8f('0x63')][_0x161311][_0x2c8f('0x65')]+'\x20'+_0x4e5094['rules'][_0x161311][_0x2c8f('0x66')]+(_0x55e0aa(_0x4e5094['rules'][_0x161311]['condition'])?'\x20'+_0x4e5094[_0x2c8f('0x63')][_0x161311][_0x2c8f('0x67')]:'');}return _0x390ee6+')';};var _0x1f9721={'where':{'id':_0x4a3ae1['id']}},_0x2d08b3,_0x159eb5,_0x54d8d1,_0x56e696,_0x130906;_0x1f9721=_['merge']({},_0x1f9721,_0x1d4706);return db[_0x2c8f('0x2b')][_0x2c8f('0x47')](_0x1f9721)[_0x2c8f('0x23')](function(_0x2ede28){if(_0x2ede28){_0x2d08b3=_0x2ede28;return _0x2ede28[_0x2c8f('0x69')]();}return null;})[_0x2c8f('0x23')](function(_0x3cac24){if(_0x3cac24){if(!_0x3cac24[_0x2c8f('0x35')]){throw new db[(_0x2c8f('0x6a'))]['ValidationErrorItem'](_0x2c8f('0x86'),0x193);}_0x159eb5=_0x3cac24;return db[_0x2c8f('0x87')]['findAll']({'raw':!![]});}return null;})[_0x2c8f('0x23')](function(_0x15828c){if(_0x15828c){_0x54d8d1=_[_0x2c8f('0x88')](_0x15828c,'id');var _0x51ac40;var _0x280b1f=squel[_0x2c8f('0x6b')]();_0x280b1f[_0x2c8f('0x89')](_0x2d08b3[_0x2c8f('0x6c')]);for(var _0x12f950=0x0;_0x12f950<_0x159eb5['length'];_0x12f950+=0x1){_0x51ac40=_0x159eb5[_0x12f950][_0x2c8f('0x6d')]?_0x54d8d1[_0x159eb5[_0x12f950][_0x2c8f('0x6d')]]['metric']:_0x159eb5[_0x12f950][_0x2c8f('0x65')];_0x51ac40=_0x159eb5[_0x12f950][_0x2c8f('0x6e')]?_['replace'](_0x292e0c[_0x159eb5[_0x12f950]['function']],'%s',_0x51ac40):_0x51ac40;_0x51ac40=_0x159eb5[_0x12f950]['format']?_[_0x2c8f('0x70')](_0x434f87[_0x159eb5[_0x12f950][_0x2c8f('0x6f')]],'%s',_0x51ac40):_0x51ac40;if(_0x159eb5[_0x12f950]['groupBy']){_0x280b1f[_0x2c8f('0x64')](_0x51ac40);}_0x159eb5[_0x12f950]['orderBy']&&_0x280b1f[_0x2c8f('0x72')](_0x51ac40,_0x159eb5[_0x12f950][_0x2c8f('0x71')]===_0x2c8f('0x8a')?![]:!![]);_0x280b1f['field'](_0x51ac40,_0x159eb5[_0x12f950][_0x2c8f('0x8b')]||_0x51ac40);}if(_0x2d08b3[_0x2c8f('0x73')]){_0x2d08b3[_0x2c8f('0x73')]=JSON[_0x2c8f('0x74')](_0x2d08b3['joins']);for(var _0x2a2897=0x0;_0x2a2897<_0x2d08b3['joins'][_0x2c8f('0x35')];_0x2a2897+=0x1){if(_0x2d08b3['joins'][_0x2a2897]['type']&&_[_0x2c8f('0x5e')](_0x517b64,_0x2d08b3[_0x2c8f('0x73')][_0x2a2897][_0x2c8f('0x2e')])&&_0x2d08b3[_0x2c8f('0x73')][_0x2a2897][_0x2c8f('0x75')]&&_0x2d08b3[_0x2c8f('0x73')][_0x2a2897]['foreignTable']&&_0x2d08b3['joins'][_0x2a2897][_0x2c8f('0x77')]){_0x280b1f[_0x2d08b3[_0x2c8f('0x73')][_0x2a2897][_0x2c8f('0x2e')]](_0x2d08b3[_0x2c8f('0x73')][_0x2a2897]['foreignTable'],null,util[_0x2c8f('0x6f')]('%s.%s\x20=\x20%s.%s',_0x2d08b3[_0x2c8f('0x6c')],_0x2d08b3['joins'][_0x2a2897][_0x2c8f('0x75')],_0x2d08b3['joins'][_0x2a2897][_0x2c8f('0x76')],_0x2d08b3[_0x2c8f('0x73')][_0x2a2897][_0x2c8f('0x77')]));}}}if(_0x2d08b3[_0x2c8f('0x79')]){_0x2d08b3['conditions']=JSON['parse'](_0x2d08b3[_0x2c8f('0x79')]);_0x280b1f[_0x2c8f('0x39')](_0x5aab29(_0x2d08b3[_0x2c8f('0x79')][_0x2c8f('0x64')]));}_0x130906=_0x280b1f[_0x2c8f('0x7a')]();_0x280b1f['limit'](_0x177be1);_0x280b1f[_0x2c8f('0x1d')](0x0);return;}})[_0x2c8f('0x23')](function(){if(_0x30af09[_0x2c8f('0x8c')]===_0x2c8f('0x8d')){return null;}var _0x350e7f=_[_0x2c8f('0x3a')](_0x30af09,{'name':_0x30af09[_0x2c8f('0x8e')]||_0x30af09['name']||_0x2d08b3[_0x2c8f('0x28')],'basename':_0x1e5b47,'savename':util['format']('%s-%s.%s',_0x30af09['name']||_0x2d08b3[_0x2c8f('0x28')],require(_0x2c8f('0x8f'))[_0x2c8f('0x90')](0x4),_0x30af09[_0x2c8f('0x8c')]||_0x2c8f('0x91')),'reportId':_0x2d08b3['id'],'reportType':'custom'});return db[_0x2c8f('0x92')]['create'](_0x350e7f,{'raw':!![]});})[_0x2c8f('0x23')](function(_0x1f9a9d){if(_0x2d08b3[_0x2c8f('0x6c')]==='cdr'){_0x130906['where'](_0x2d08b3[_0x2c8f('0x6c')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x30af09[_0x2c8f('0x93')],_0x30af09[_0x2c8f('0x94')]);}else{_0x130906['where'](_0x2d08b3[_0x2c8f('0x6c')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x30af09[_0x2c8f('0x93')],_0x30af09[_0x2c8f('0x94')]);}if(_0x1f9a9d){logger[_0x2c8f('0x95')](_0x2c8f('0x96'),_0x130906[_0x2c8f('0x7c')]());require(_0x2c8f('0x97'))['fork'](path['join'](__dirname,_0x2c8f('0x98'),_0x1f9a9d[_0x2c8f('0x8c')]),[_0x1f9a9d['id'],_0x130906[_0x2c8f('0x7c')](),path['join'](__dirname,'../../files/reports',_0x1f9a9d['savename']),_0x1e5b47]);return _0x1f9a9d;}else{var _0xea96c1=squel[_0x2c8f('0x6b')]();_0xea96c1[_0x2c8f('0x89')]('('+_0x130906['toString']()+')','countTable');_0xea96c1['field']('COUNT(*)','count');_0x130906[_0x2c8f('0x1f')](_0x30af09[_0x2c8f('0x1f')]||_0x177be1);_0x130906['offset'](_0x30af09[_0x2c8f('0x1d')]||0x0);return dbH[_0x2c8f('0x7d')]['query'](_0xea96c1[_0x2c8f('0x7c')](),{'type':dbH[_0x2c8f('0x7d')]['QueryTypes'][_0x2c8f('0x99')]})[_0x2c8f('0x23')](function(_0x1649c4){if(!_0x1649c4[_0x2c8f('0x35')]){_0x56e696=0x0;}else{_0x56e696=_0x1649c4[0x0][_0x2c8f('0x3d')]||0x0;}return dbH[_0x2c8f('0x7d')]['query'](_0x130906[_0x2c8f('0x7c')](),{'type':dbH[_0x2c8f('0x7d')][_0x2c8f('0x7e')][_0x2c8f('0x99')]});})['then'](function(_0x24d49e){return{'rows':_0x24d49e||[],'count':_0x56e696};});}});}exports[_0x2c8f('0x9a')]=function(_0x1dbd27,_0x53235b){return runReport(_0x1dbd27[_0x2c8f('0x43')],_0x1dbd27[_0x2c8f('0x30')],_0x1dbd27[_0x2c8f('0x68')])['then'](respondWithResult(_0x53235b,null))['catch'](handleError(_0x53235b,null));};exports[_0x2c8f('0x9b')]=runReport;exports[_0x2c8f('0x30')]=function(_0x564615,_0x211e56){var _0x3f3bbe=0xa;var _0x1a637a=['join','left_join',_0x2c8f('0x80'),_0x2c8f('0x54')];var _0x178657={'SUM':_0x2c8f('0x55'),'COUNT':_0x2c8f('0x81'),'COUNT DISTINCT':_0x2c8f('0x56'),'MAX':_0x2c8f('0x82'),'MIN':_0x2c8f('0x83'),'AVG':_0x2c8f('0x57'),'GROUP_CONCAT':_0x2c8f('0x58'),'GROUP_CONCAT ASC':_0x2c8f('0x59'),'GROUP_CONCAT DESC':_0x2c8f('0x5a')};var _0xbc9c76={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x2c8f('0x5c'),'HOUR':_0x2c8f('0x84'),'ROUND':_0x2c8f('0x5d'),'UNIX_TIMESTAMP':_0x2c8f('0x85')};var _0x30da1d=function(_0x5422fb){return!_[_0x2c8f('0x5e')](['IS\x20NULL',_0x2c8f('0x60'),'IS\x20EMPTY',_0x2c8f('0x62')],_0x5422fb);};var _0xa76f0d=function(_0xe6e4a8){if(!_0xe6e4a8||!_0xe6e4a8['rules'][_0x2c8f('0x35')]){return'';}for(var _0x1e685f='(',_0x4c53dc=0x0;_0x4c53dc<_0xe6e4a8[_0x2c8f('0x63')]['length'];_0x4c53dc+=0x1){_0x4c53dc>0x0&&(_0x1e685f+='\x20'+_0xe6e4a8[_0x2c8f('0x9c')]+'\x20');_0x1e685f+=_0xe6e4a8[_0x2c8f('0x63')][_0x4c53dc]['group']?_0xa76f0d(_0xe6e4a8[_0x2c8f('0x63')][_0x4c53dc][_0x2c8f('0x64')]):_0xe6e4a8[_0x2c8f('0x63')][_0x4c53dc][_0x2c8f('0x65')]+'\x20'+_0xe6e4a8[_0x2c8f('0x63')][_0x4c53dc][_0x2c8f('0x66')]+(_0x30da1d(_0xe6e4a8[_0x2c8f('0x63')][_0x4c53dc][_0x2c8f('0x66')])?'\x20'+_0xe6e4a8['rules'][_0x4c53dc]['value']:'');}return _0x1e685f+')';};var _0x5abc9c={'where':{'id':_0x564615[_0x2c8f('0x43')]['id']}},_0x4ace06,_0x4c5bd8,_0x22008d,_0x53bebd,_0x1795b0;_0x5abc9c=_[_0x2c8f('0x3a')]({},_0x5abc9c,_0x564615['options']);return db[_0x2c8f('0x2b')][_0x2c8f('0x47')](_0x5abc9c)[_0x2c8f('0x23')](function(_0x3a8832){if(_0x3a8832){_0x4ace06=_0x3a8832;return _0x3a8832[_0x2c8f('0x69')]();}return null;})[_0x2c8f('0x23')](function(_0xc539a0){if(_0xc539a0){if(!_0xc539a0['length']){throw new db['Sequelize'][(_0x2c8f('0x9d'))](_0x2c8f('0x86'),0x193);}_0x4c5bd8=_0xc539a0;return db[_0x2c8f('0x87')][_0x2c8f('0x3f')]({'raw':!![]});}return null;})[_0x2c8f('0x23')](function(_0xa9273b){if(_0xa9273b){_0x22008d=_['keyBy'](_0xa9273b,'id');var _0x2d3730;var _0x298143=squel[_0x2c8f('0x6b')]();_0x298143[_0x2c8f('0x89')](_0x4ace06[_0x2c8f('0x6c')]);for(var _0x5411e1=0x0;_0x5411e1<_0x4c5bd8[_0x2c8f('0x35')];_0x5411e1+=0x1){_0x2d3730=_0x4c5bd8[_0x5411e1][_0x2c8f('0x6d')]?_0x22008d[_0x4c5bd8[_0x5411e1][_0x2c8f('0x6d')]][_0x2c8f('0x9e')]:_0x4c5bd8[_0x5411e1][_0x2c8f('0x65')];_0x2d3730=_0x4c5bd8[_0x5411e1]['function']?_[_0x2c8f('0x70')](_0x178657[_0x4c5bd8[_0x5411e1][_0x2c8f('0x6e')]],'%s',_0x2d3730):_0x2d3730;_0x2d3730=_0x4c5bd8[_0x5411e1][_0x2c8f('0x6f')]?_['replace'](_0xbc9c76[_0x4c5bd8[_0x5411e1]['format']],'%s',_0x2d3730):_0x2d3730;if(_0x4c5bd8[_0x5411e1][_0x2c8f('0x9f')]){_0x298143[_0x2c8f('0x64')](_0x2d3730);}_0x4c5bd8[_0x5411e1]['orderBy']&&_0x298143[_0x2c8f('0x72')](_0x2d3730,_0x4c5bd8[_0x5411e1][_0x2c8f('0x71')]===_0x2c8f('0x8a')?![]:!![]);_0x298143['field'](_0x2d3730,_0x4c5bd8[_0x5411e1][_0x2c8f('0x8b')]||_0x2d3730);}if(_0x4ace06[_0x2c8f('0x73')]){_0x4ace06[_0x2c8f('0x73')]=JSON[_0x2c8f('0x74')](_0x4ace06[_0x2c8f('0x73')]);for(var _0x1bfd93=0x0;_0x1bfd93<_0x4ace06[_0x2c8f('0x73')][_0x2c8f('0x35')];_0x1bfd93+=0x1){if(_0x4ace06['joins'][_0x1bfd93][_0x2c8f('0x2e')]&&_[_0x2c8f('0x5e')](_0x1a637a,_0x4ace06[_0x2c8f('0x73')][_0x1bfd93][_0x2c8f('0x2e')])&&_0x4ace06[_0x2c8f('0x73')][_0x1bfd93][_0x2c8f('0x75')]&&_0x4ace06[_0x2c8f('0x73')][_0x1bfd93]['foreignTable']&&_0x4ace06['joins'][_0x1bfd93][_0x2c8f('0x77')]){_0x298143[_0x4ace06[_0x2c8f('0x73')][_0x1bfd93][_0x2c8f('0x2e')]](_0x4ace06['joins'][_0x1bfd93][_0x2c8f('0x76')],null,util['format'](_0x2c8f('0x78'),_0x4ace06['table'],_0x4ace06['joins'][_0x1bfd93]['parentKey'],_0x4ace06[_0x2c8f('0x73')][_0x1bfd93][_0x2c8f('0x76')],_0x4ace06[_0x2c8f('0x73')][_0x1bfd93][_0x2c8f('0x77')]));}}}if(_0x4ace06[_0x2c8f('0x79')]){_0x4ace06['conditions']=JSON[_0x2c8f('0x74')](_0x4ace06['conditions']);_0x298143[_0x2c8f('0x39')](_0xa76f0d(_0x4ace06[_0x2c8f('0x79')][_0x2c8f('0x64')]));}_0x1795b0=_0x298143['clone']();_0x298143['limit'](_0x3f3bbe);_0x298143[_0x2c8f('0x1d')](0x0);logger['debug'](_0x2c8f('0xa0'),_0x298143[_0x2c8f('0x7c')]());return dbH[_0x2c8f('0x7d')][_0x2c8f('0x30')](_0x298143[_0x2c8f('0x7c')](),{'type':dbH['sequelize'][_0x2c8f('0x7e')][_0x2c8f('0x99')]});}})['then'](function(){return{'sql':_0x1795b0[_0x2c8f('0x7c')]()};})[_0x2c8f('0x23')](respondWithResult(_0x211e56,null))[_0x2c8f('0x41')](handleError(_0x211e56,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 666f437..5ea529e 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 _0xa8e8=['analytics_custom_reports','util','../../config/logger','moment','request-promise','path','rimraf','./analyticCustomReport.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8e8,0xb5));var _0x8a8e=function(_0xc2dde6,_0x1cccc9){_0xc2dde6=_0xc2dde6-0x0;var _0x9fc29c=_0xa8e8[_0xc2dde6];return _0x9fc29c;};'use strict';var _=require('lodash');var util=require(_0x8a8e('0x0'));var logger=require(_0x8a8e('0x1'))('api');var moment=require(_0x8a8e('0x2'));var BPromise=require('bluebird');var rp=require(_0x8a8e('0x3'));var fs=require('fs');var path=require(_0x8a8e('0x4'));var rimraf=require(_0x8a8e('0x5'));var config=require('../../config/environment');var attributes=require(_0x8a8e('0x6'));module[_0x8a8e('0x7')]=function(_0x51a8e6,_0x19322d){return _0x51a8e6[_0x8a8e('0x8')]('AnalyticCustomReport',attributes,{'tableName':_0x8a8e('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf6f=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','moment'];(function(_0x3016ed,_0x4f12d5){var _0x2c146f=function(_0x5f02e5){while(--_0x5f02e5){_0x3016ed['push'](_0x3016ed['shift']());}};_0x2c146f(++_0x4f12d5);}(_0xbf6f,0x15c));var _0xfbf6=function(_0x56a758,_0x381a41){_0x56a758=_0x56a758-0x0;var _0x4252ef=_0xbf6f[_0x56a758];return _0x4252ef;};'use strict';var _=require(_0xfbf6('0x0'));var util=require('util');var logger=require(_0xfbf6('0x1'))('api');var moment=require(_0xfbf6('0x2'));var BPromise=require(_0xfbf6('0x3'));var rp=require(_0xfbf6('0x4'));var fs=require('fs');var path=require(_0xfbf6('0x5'));var rimraf=require(_0xfbf6('0x6'));var config=require(_0xfbf6('0x7'));var attributes=require(_0xfbf6('0x8'));module[_0xfbf6('0x9')]=function(_0x20485f,_0x2973b2){return _0x20485f[_0xfbf6('0xa')](_0xfbf6('0xb'),attributes,{'tableName':_0xfbf6('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 86897be..9a0f43d 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 _0xfcf6=['request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x529ec2,_0x1043d1){var _0x31f562=function(_0x2ce479){while(--_0x2ce479){_0x529ec2['push'](_0x529ec2['shift']());}};_0x31f562(++_0x1043d1);}(_0xfcf6,0x1ac));var _0x6fcf=function(_0x1d0a32,_0x4ad5ac){_0x1d0a32=_0x1d0a32-0x0;var _0x355601=_0xfcf6[_0x1d0a32];return _0x355601;};'use strict';var _=require(_0x6fcf('0x0'));var util=require('util');var moment=require(_0x6fcf('0x1'));var BPromise=require('bluebird');var rs=require(_0x6fcf('0x2'));var fs=require('fs');var Redis=require(_0x6fcf('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6fcf('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6fcf('0x5'));var jayson=require(_0x6fcf('0x6'));var client=jayson[_0x6fcf('0x7')][_0x6fcf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2824ca,_0x26a20c,_0x705d5){return new BPromise(function(_0x4964f2,_0x5c8b84){return client[_0x6fcf('0x9')](_0x2824ca,_0x705d5)[_0x6fcf('0xa')](function(_0x24b284){logger[_0x6fcf('0xb')](_0x6fcf('0xc'),_0x26a20c,_0x6fcf('0xd'));logger[_0x6fcf('0xe')](_0x6fcf('0xf'),_0x26a20c,_0x6fcf('0xd'),JSON[_0x6fcf('0x10')](_0x24b284));if(_0x24b284[_0x6fcf('0x11')]){if(_0x24b284[_0x6fcf('0x11')][_0x6fcf('0x12')]===0x1f4){logger[_0x6fcf('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x26a20c,_0x24b284['error'][_0x6fcf('0x13')]);return _0x5c8b84(_0x24b284['error'][_0x6fcf('0x13')]);}logger[_0x6fcf('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x26a20c,_0x24b284[_0x6fcf('0x11')][_0x6fcf('0x13')]);return _0x4964f2(_0x24b284[_0x6fcf('0x11')][_0x6fcf('0x13')]);}else{logger[_0x6fcf('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0x26a20c,_0x6fcf('0xd'));_0x4964f2(_0x24b284[_0x6fcf('0x14')][_0x6fcf('0x13')]);}})['catch'](function(_0x4a7bbf){logger['error'](_0x6fcf('0xc'),_0x26a20c,_0x4a7bbf);_0x5c8b84(_0x4a7bbf);});});} \ No newline at end of file +var _0xbdd8=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xd9921a,_0x271e08){var _0x2ef96b=function(_0x466e84){while(--_0x466e84){_0xd9921a['push'](_0xd9921a['shift']());}};_0x2ef96b(++_0x271e08);}(_0xbdd8,0xab));var _0x8bdd=function(_0x5e152a,_0x3ecde7){_0x5e152a=_0x5e152a-0x0;var _0x387327=_0xbdd8[_0x5e152a];return _0x387327;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8bdd('0x0'));var BPromise=require(_0x8bdd('0x1'));var rs=require(_0x8bdd('0x2'));var fs=require('fs');var Redis=require(_0x8bdd('0x3'));var db=require(_0x8bdd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8bdd('0x5'))('rpc');var config=require(_0x8bdd('0x6'));var jayson=require(_0x8bdd('0x7'));var client=jayson[_0x8bdd('0x8')][_0x8bdd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57a5dd,_0xe8d442,_0x4f1b83){return new BPromise(function(_0x1e0660,_0x219883){return client[_0x8bdd('0xa')](_0x57a5dd,_0x4f1b83)[_0x8bdd('0xb')](function(_0x573a22){logger[_0x8bdd('0xc')](_0x8bdd('0xd'),_0xe8d442,_0x8bdd('0xe'));logger['debug'](_0x8bdd('0xf'),_0xe8d442,_0x8bdd('0xe'),JSON[_0x8bdd('0x10')](_0x573a22));if(_0x573a22[_0x8bdd('0x11')]){if(_0x573a22['error'][_0x8bdd('0x12')]===0x1f4){logger['error'](_0x8bdd('0xd'),_0xe8d442,_0x573a22[_0x8bdd('0x11')]['message']);return _0x219883(_0x573a22['error'][_0x8bdd('0x13')]);}logger[_0x8bdd('0x11')](_0x8bdd('0xd'),_0xe8d442,_0x573a22[_0x8bdd('0x11')][_0x8bdd('0x13')]);return _0x1e0660(_0x573a22[_0x8bdd('0x11')][_0x8bdd('0x13')]);}else{logger[_0x8bdd('0xc')](_0x8bdd('0xd'),_0xe8d442,_0x8bdd('0xe'));_0x1e0660(_0x573a22[_0x8bdd('0x14')][_0x8bdd('0x13')]);}})[_0x8bdd('0x15')](function(_0x1fc7e5){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0xe8d442,_0x1fc7e5);_0x219883(_0x1fc7e5);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index c0497ae..006d41d 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 _0x2117=['/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put'];(function(_0x3ad738,_0x592dbd){var _0x1a0c81=function(_0x217a1d){while(--_0x217a1d){_0x3ad738['push'](_0x3ad738['shift']());}};_0x1a0c81(++_0x592dbd);}(_0x2117,0x17f));var _0x7211=function(_0x56e6ce,_0x4b1780){_0x56e6ce=_0x56e6ce-0x0;var _0x1755d0=_0x2117[_0x56e6ce];return _0x1755d0;};'use strict';var multer=require('multer');var util=require(_0x7211('0x0'));var path=require(_0x7211('0x1'));var timeout=require(_0x7211('0x2'));var express=require(_0x7211('0x3'));var router=express[_0x7211('0x4')]();var fs_extra=require(_0x7211('0x5'));var auth=require(_0x7211('0x6'));var interaction=require(_0x7211('0x7'));var config=require('../../config/environment');var controller=require(_0x7211('0x8'));router[_0x7211('0x9')]('/',auth[_0x7211('0xa')](),controller[_0x7211('0xb')]);router[_0x7211('0x9')]('/:id',auth[_0x7211('0xa')](),controller[_0x7211('0xc')]);router[_0x7211('0x9')](_0x7211('0xd'),auth[_0x7211('0xa')](),controller[_0x7211('0xe')]);router[_0x7211('0x9')](_0x7211('0xf'),auth['isAuthenticated'](),controller[_0x7211('0x10')]);router['get'](_0x7211('0x11'),auth['isAuthenticated'](),controller[_0x7211('0x12')]);router[_0x7211('0x13')]('/',auth['isAuthenticated'](),controller[_0x7211('0x14')]);router[_0x7211('0x15')](_0x7211('0x16'),auth['isAuthenticated'](),controller[_0x7211('0x17')]);router[_0x7211('0x18')](_0x7211('0x16'),auth[_0x7211('0xa')](),controller[_0x7211('0x19')]);module[_0x7211('0x1a')]=router; \ No newline at end of file +var _0x1444=['update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id/preview','preview','run','/:id/query','query','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1444,0x180));var _0x4144=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x1444[_0x20589d];return _0x422de9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4144('0x0'));var timeout=require(_0x4144('0x1'));var express=require(_0x4144('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4144('0x3'));var interaction=require(_0x4144('0x4'));var config=require(_0x4144('0x5'));var controller=require(_0x4144('0x6'));router[_0x4144('0x7')]('/',auth[_0x4144('0x8')](),controller[_0x4144('0x9')]);router[_0x4144('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x4144('0xa'),auth[_0x4144('0x8')](),controller[_0x4144('0xb')]);router[_0x4144('0x7')]('/:id/run',auth['isAuthenticated'](),controller[_0x4144('0xc')]);router[_0x4144('0x7')](_0x4144('0xd'),auth[_0x4144('0x8')](),controller[_0x4144('0xe')]);router['post']('/',auth[_0x4144('0x8')](),controller['create']);router['put'](_0x4144('0xf'),auth['isAuthenticated'](),controller[_0x4144('0x10')]);router[_0x4144('0x11')]('/:id',auth[_0x4144('0x8')](),controller[_0x4144('0x12')]);module[_0x4144('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 398dc5a..9e9f942 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 _0x9957=['exports','STRING','TEXT','sequelize'];(function(_0x5400b,_0x55943a){var _0x36a39b=function(_0x56963c){while(--_0x56963c){_0x5400b['push'](_0x5400b['shift']());}};_0x36a39b(++_0x55943a);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7995('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x7995('0x2')]},'conditions':{'type':Sequelize[_0x7995('0x3')]},'joins':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file +var _0x98a8=['sequelize','exports','STRING','TEXT'];(function(_0x1f6fda,_0x41513a){var _0x4c0adc=function(_0x31ba03){while(--_0x31ba03){_0x1f6fda['push'](_0x1f6fda['shift']());}};_0x4c0adc(++_0x41513a);}(_0x98a8,0x12c));var _0x898a=function(_0x359ad2,_0x19aa5d){_0x359ad2=_0x359ad2-0x0;var _0x111b54=_0x98a8[_0x359ad2];return _0x111b54;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'name':{'type':Sequelize[_0x898a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x898a('0x2')]},'parent':{'type':Sequelize[_0x898a('0x2')]},'table':{'type':Sequelize[_0x898a('0x2')]},'conditions':{'type':Sequelize[_0x898a('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 8d3336c..db7f0a8 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 _0x0295=['default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','fork','../../files/reports','COUNT(*)','SELECT','run','runReport','MAX(%s)','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','UserProfileResource','destroy','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','group','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20EMPTY','operator','getFields','findAll','select','replace','output','web','%s-%s.%s','randomstring','generate','csv'];(function(_0x113b1e,_0xae7a8d){var _0x32f372=function(_0x30e181){while(--_0x30e181){_0x113b1e['push'](_0x113b1e['shift']());}};_0x32f372(++_0xae7a8d);}(_0x0295,0x1f0));var _0x5029=function(_0x12fcbd,_0x884804){_0x12fcbd=_0x12fcbd-0x0;var _0x28ec2a=_0x0295[_0x12fcbd];return _0x28ec2a;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];var dbH=require(_0x5029('0x14'))['dbH'];function respondWithStatusCode(_0x4fa22d,_0x49f836){_0x49f836=_0x49f836||0xcc;return function(_0x4aebb6){if(_0x4aebb6){return _0x4fa22d[_0x5029('0x15')](_0x49f836);}return _0x4fa22d[_0x5029('0x16')](_0x49f836)[_0x5029('0x17')]();};}function respondWithResult(_0x434630,_0x2c0b33){_0x2c0b33=_0x2c0b33||0xc8;return function(_0x11c24b){if(_0x11c24b){return _0x434630[_0x5029('0x16')](_0x2c0b33)[_0x5029('0x18')](_0x11c24b);}};}function respondWithFilteredResult(_0x10bf55,_0x326923){return function(_0x457c73){if(_0x457c73){var _0x353cba=typeof _0x326923[_0x5029('0x19')]===_0x5029('0x1a')&&typeof _0x326923[_0x5029('0x1b')]==='undefined';var _0x1ed567=_0x457c73[_0x5029('0x1c')];var _0x35de81=_0x353cba?0x0:_0x326923[_0x5029('0x19')];var _0x8cea01=_0x353cba?_0x457c73[_0x5029('0x1c')]:_0x326923[_0x5029('0x19')]+_0x326923['limit'];var _0x226a5c;if(_0x8cea01>=_0x1ed567){_0x8cea01=_0x1ed567;_0x226a5c=0xc8;}else{_0x226a5c=0xce;}_0x10bf55['status'](_0x226a5c);return _0x10bf55[_0x5029('0x1d')](_0x5029('0x1e'),_0x35de81+'-'+_0x8cea01+'/'+_0x1ed567)[_0x5029('0x18')](_0x457c73);}return null;};}function patchUpdates(_0x3cf0fb){return function(_0x4b5854){try{jsonpatch['apply'](_0x4b5854,_0x3cf0fb,!![]);}catch(_0x4c9184){return BPromise['reject'](_0x4c9184);}return _0x4b5854[_0x5029('0x1f')]();};}function saveUpdates(_0x853a34,_0x1eb228){return function(_0x2bbbcb){if(_0x2bbbcb){return _0x2bbbcb[_0x5029('0x20')](_0x853a34)[_0x5029('0x21')](function(_0x125c26){return _0x125c26;});}return null;};}function removeEntity(_0x356dac,_0x3e857d){return function(_0x4ceaae){if(_0x4ceaae){return _0x4ceaae['destroy']()['then'](function(){var _0x588d90=_0x4ceaae[_0x5029('0x22')]({'plain':!![]});var _0x51093c='DefaultReports';return db[_0x5029('0x23')][_0x5029('0x24')]({'where':{'type':_0x51093c,'resourceId':_0x588d90['id']}})[_0x5029('0x21')](function(){return _0x4ceaae;});})['then'](function(){_0x356dac[_0x5029('0x16')](0xcc)[_0x5029('0x17')]();});}};}function handleEntityNotFound(_0x5e45c4,_0x2b6d99){return function(_0x31f0a0){if(!_0x31f0a0){_0x5e45c4[_0x5029('0x15')](0x194);}return _0x31f0a0;};}function handleError(_0x4a24b9,_0x32da06){_0x32da06=_0x32da06||0x1f4;return function(_0x251f99){logger[_0x5029('0x25')](_0x251f99['stack']);if(_0x251f99[_0x5029('0x26')]){delete _0x251f99[_0x5029('0x26')];}_0x4a24b9['status'](_0x32da06)[_0x5029('0x27')](_0x251f99);};}exports[_0x5029('0x28')]=function(_0x4434ff,_0x1c3dd9){var _0x196830={},_0x2a1ed6={},_0x44255a={'count':0x0,'rows':[]};var _0x465153=_[_0x5029('0x29')](db[_0x5029('0x2a')][_0x5029('0x2b')],function(_0x4519c8){return{'name':_0x4519c8['fieldName'],'type':_0x4519c8[_0x5029('0x2c')]['key']};});_0x2a1ed6[_0x5029('0x2d')]=_['map'](_0x465153,'name');_0x2a1ed6[_0x5029('0x2e')]=_[_0x5029('0x2f')](_0x4434ff[_0x5029('0x2e')]);_0x2a1ed6['filters']=_[_0x5029('0x30')](_0x2a1ed6[_0x5029('0x2d')],_0x2a1ed6[_0x5029('0x2e')]);_0x196830[_0x5029('0x31')]=_[_0x5029('0x30')](_0x2a1ed6[_0x5029('0x2d')],qs[_0x5029('0x32')](_0x4434ff[_0x5029('0x2e')][_0x5029('0x32')]));_0x196830['attributes']=_0x196830[_0x5029('0x31')][_0x5029('0x33')]?_0x196830[_0x5029('0x31')]:_0x2a1ed6[_0x5029('0x2d')];if(!_0x4434ff['query'][_0x5029('0x34')](_0x5029('0x35'))){_0x196830[_0x5029('0x1b')]=qs['limit'](_0x4434ff['query'][_0x5029('0x1b')]);_0x196830[_0x5029('0x19')]=qs['offset'](_0x4434ff['query'][_0x5029('0x19')]);}_0x196830[_0x5029('0x36')]=qs[_0x5029('0x37')](_0x4434ff[_0x5029('0x2e')][_0x5029('0x37')]);_0x196830[_0x5029('0x38')]=qs[_0x5029('0x39')](_[_0x5029('0x3a')](_0x4434ff[_0x5029('0x2e')],_0x2a1ed6[_0x5029('0x39')]),_0x465153);if(_0x4434ff[_0x5029('0x2e')][_0x5029('0x3b')]){_0x196830[_0x5029('0x38')]=_[_0x5029('0x3c')](_0x196830['where'],{'$or':_['map'](_0x465153,function(_0x73797c){if(_0x73797c[_0x5029('0x2c')]!==_0x5029('0x3d')){var _0x48c9eb={};_0x48c9eb[_0x73797c[_0x5029('0x26')]]={'$like':'%'+_0x4434ff[_0x5029('0x2e')]['filter']+'%'};return _0x48c9eb;}})});}_0x196830=_[_0x5029('0x3c')]({},_0x196830,_0x4434ff['options']);var _0x506f0d={'where':_0x196830['where']};return db[_0x5029('0x2a')][_0x5029('0x1c')](_0x506f0d)[_0x5029('0x21')](function(_0x78768){_0x44255a[_0x5029('0x1c')]=_0x78768;if(_0x4434ff[_0x5029('0x2e')][_0x5029('0x3e')]){_0x196830[_0x5029('0x3f')]=[{'all':!![]}];}return db[_0x5029('0x2a')]['findAll'](_0x196830);})[_0x5029('0x21')](function(_0x236455){_0x44255a[_0x5029('0x40')]=_0x236455;return _0x44255a;})[_0x5029('0x21')](respondWithFilteredResult(_0x1c3dd9,_0x196830))[_0x5029('0x41')](handleError(_0x1c3dd9,null));};exports[_0x5029('0x42')]=function(_0x5658a7,_0x259db8){var _0xa1580a={'raw':!![],'where':{'id':_0x5658a7[_0x5029('0x43')]['id']}},_0x9434ed={};_0x9434ed[_0x5029('0x2d')]=_['keys'](db[_0x5029('0x2a')][_0x5029('0x2b')]);_0x9434ed[_0x5029('0x2e')]=_[_0x5029('0x2f')](_0x5658a7[_0x5029('0x2e')]);_0x9434ed[_0x5029('0x39')]=_[_0x5029('0x30')](_0x9434ed[_0x5029('0x2d')],_0x9434ed[_0x5029('0x2e')]);_0xa1580a['attributes']=_[_0x5029('0x30')](_0x9434ed[_0x5029('0x2d')],qs[_0x5029('0x32')](_0x5658a7[_0x5029('0x2e')]['fields']));_0xa1580a['attributes']=_0xa1580a[_0x5029('0x31')][_0x5029('0x33')]?_0xa1580a[_0x5029('0x31')]:_0x9434ed[_0x5029('0x2d')];if(_0x5658a7[_0x5029('0x2e')][_0x5029('0x3e')]){_0xa1580a[_0x5029('0x3f')]=[{'all':!![]}];}_0xa1580a=_[_0x5029('0x3c')]({},_0xa1580a,_0x5658a7[_0x5029('0x44')]);return db[_0x5029('0x2a')][_0x5029('0x45')](_0xa1580a)[_0x5029('0x21')](handleEntityNotFound(_0x259db8,null))[_0x5029('0x21')](respondWithResult(_0x259db8,null))[_0x5029('0x41')](handleError(_0x259db8,null));};exports[_0x5029('0x46')]=function(_0x175cc0,_0x10fc07){return db[_0x5029('0x2a')][_0x5029('0x46')](_0x175cc0[_0x5029('0x47')],{})[_0x5029('0x21')](function(_0x489457){var _0x1069c4=_0x175cc0['user'][_0x5029('0x22')]({'plain':!![]});if(!_0x1069c4)throw new Error(_0x5029('0x48'));if(_0x1069c4['role']==='user'){var _0x319bff=_0x489457['get']({'plain':!![]});var _0x4aaa43=_0x5029('0x49');return db[_0x5029('0x4a')][_0x5029('0x45')]({'where':{'name':_0x4aaa43,'userProfileId':_0x1069c4['userProfileId']},'raw':!![]})['then'](function(_0x1510bb){if(_0x1510bb&&_0x1510bb[_0x5029('0x4b')]===0x0){return db['UserProfileResource'][_0x5029('0x46')]({'name':_0x319bff['name'],'resourceId':_0x319bff['id'],'type':_0x5029('0x4c'),'sectionId':_0x1510bb['id']},{})['then'](function(){return _0x489457;});}else{return _0x489457;}})[_0x5029('0x41')](function(_0x27e1c0){logger[_0x5029('0x25')](_0x5029('0x4d'),_0x27e1c0);throw _0x27e1c0;});}return _0x489457;})[_0x5029('0x21')](respondWithResult(_0x10fc07,0xc9))[_0x5029('0x41')](handleError(_0x10fc07,null));};exports[_0x5029('0x20')]=function(_0xa25013,_0x586936){if(_0xa25013[_0x5029('0x47')]['id']){delete _0xa25013['body']['id'];}return db[_0x5029('0x2a')][_0x5029('0x45')]({'where':{'id':_0xa25013['params']['id']}})[_0x5029('0x21')](handleEntityNotFound(_0x586936,null))['then'](saveUpdates(_0xa25013['body'],null))['then'](respondWithResult(_0x586936,null))[_0x5029('0x41')](handleError(_0x586936,null));};exports['destroy']=function(_0x49d1db,_0x353ae4){return db[_0x5029('0x2a')]['find']({'where':{'id':_0x49d1db[_0x5029('0x43')]['id']}})['then'](handleEntityNotFound(_0x353ae4,null))['then'](removeEntity(_0x353ae4,null))[_0x5029('0x41')](handleError(_0x353ae4,null));};exports[_0x5029('0x4e')]=function(_0x81e39c,_0x448273){var _0x164179=0xa;var _0x4e8d9f=[_0x5029('0x4f'),_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x4dca54={'SUM':_0x5029('0x53'),'COUNT':_0x5029('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':_0x5029('0x57'),'GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4208ab={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':_0x5029('0x5c'),'UNIX_TIMESTAMP':_0x5029('0x5d')};var _0x59a718=function(_0x560324){return!_[_0x5029('0x5e')]([_0x5029('0x5f'),_0x5029('0x60'),'IS\x20EMPTY',_0x5029('0x61')],_0x560324);};var _0x2d439a=function(_0x105638){if(!_0x105638||!_0x105638[_0x5029('0x62')][_0x5029('0x33')]){return'';}for(var _0x5264c6='(',_0x2ec5d0=0x0;_0x2ec5d0<_0x105638[_0x5029('0x62')][_0x5029('0x33')];_0x2ec5d0+=0x1){_0x2ec5d0>0x0&&(_0x5264c6+='\x20'+_0x105638['operator']+'\x20');_0x5264c6+=_0x105638[_0x5029('0x62')][_0x2ec5d0]['group']?_0x2d439a(_0x105638[_0x5029('0x62')][_0x2ec5d0]['group']):_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x63')]+'\x20'+_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x64')]+(_0x59a718(_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x64')])?'\x20'+_0x105638['rules'][_0x2ec5d0][_0x5029('0x65')]:'');}return _0x5264c6+')';};var _0x19220d={'where':{'id':_0x81e39c['params']['id']}},_0x1ff8df,_0x151562,_0x389700,_0x506f74,_0x13ca47;_0x19220d=_[_0x5029('0x3c')]({},_0x19220d,_0x81e39c['options']);return db[_0x5029('0x2a')]['find'](_0x19220d)[_0x5029('0x21')](function(_0x54daf9){if(_0x54daf9){_0x1ff8df=_0x54daf9;return _0x54daf9['getFields']();}return null;})[_0x5029('0x21')](function(_0x575f09){if(_0x575f09){if(!_0x575f09[_0x5029('0x33')]){throw new db[(_0x5029('0x66'))][(_0x5029('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x151562=_0x575f09;return db[_0x5029('0x68')]['findAll']({'raw':!![]});}return null;})[_0x5029('0x21')](function(_0x255dfb){if(_0x255dfb){_0x389700=_[_0x5029('0x69')](_0x255dfb,'id');var _0x1cca02;var _0x1deed7=squel['select']();_0x1deed7[_0x5029('0x6a')](_0x1ff8df[_0x5029('0x6b')]);for(var _0x5890ac=0x0;_0x5890ac<_0x151562[_0x5029('0x33')];_0x5890ac+=0x1){_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6c')]?_0x389700[_0x151562[_0x5890ac][_0x5029('0x6c')]][_0x5029('0x6d')]:_0x151562[_0x5890ac][_0x5029('0x63')];_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6e')]?_['replace'](_0x4dca54[_0x151562[_0x5890ac]['function']],'%s',_0x1cca02):_0x1cca02;_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6f')]?_['replace'](_0x4208ab[_0x151562[_0x5890ac][_0x5029('0x6f')]],'%s',_0x1cca02):_0x1cca02;if(_0x151562[_0x5890ac][_0x5029('0x70')]){_0x1deed7['group'](_0x1cca02);}_0x151562[_0x5890ac][_0x5029('0x71')]&&_0x1deed7['order'](_0x1cca02,_0x151562[_0x5890ac]['orderBy']===_0x5029('0x72')?![]:!![]);_0x1deed7[_0x5029('0x63')](_0x1cca02,_0x151562[_0x5890ac][_0x5029('0x73')]||_0x1cca02);}if(_0x1ff8df[_0x5029('0x74')]){_0x1ff8df['joins']=JSON[_0x5029('0x75')](_0x1ff8df[_0x5029('0x74')]);for(var _0x4a2ce8=0x0;_0x4a2ce8<_0x1ff8df[_0x5029('0x74')][_0x5029('0x33')];_0x4a2ce8+=0x1){if(_0x1ff8df['joins'][_0x4a2ce8]['type']&&_['includes'](_0x4e8d9f,_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x2c')])&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x76')]&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x77')]&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x78')]){_0x1deed7[_0x1ff8df[_0x5029('0x74')][_0x4a2ce8]['type']](_0x1ff8df['joins'][_0x4a2ce8][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x1ff8df[_0x5029('0x6b')],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x76')],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8]['foreignTable'],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x78')]));}}}if(_0x1ff8df[_0x5029('0x7a')]){_0x1ff8df['conditions']=JSON[_0x5029('0x75')](_0x1ff8df[_0x5029('0x7a')]);_0x1deed7[_0x5029('0x38')](_0x2d439a(_0x1ff8df['conditions'][_0x5029('0x7b')]));}_0x13ca47=_0x1deed7[_0x5029('0x7c')]();_0x1deed7[_0x5029('0x1b')](_0x164179);_0x1deed7['offset'](0x0);logger[_0x5029('0x7d')](_0x5029('0x7e'),_0x1deed7['toString']());return dbH[_0x5029('0x7f')][_0x5029('0x2e')](_0x1deed7[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')][_0x5029('0x81')]['SELECT']});}})[_0x5029('0x21')](respondWithResult(_0x448273,null))[_0x5029('0x41')](handleError(_0x448273,null));};function runReport(_0x426d70,_0xe6ac28,_0x153cdc){var _0x5e7f50=_0xe6ac28[_0x5029('0x26')];var _0x202c51=0xa;var _0x344203=['join',_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x3e47bd={'SUM':_0x5029('0x53'),'COUNT':_0x5029('0x54'),'COUNT DISTINCT':_0x5029('0x82'),'MAX':'MAX(%s)','MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':_0x5029('0x57'),'GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':_0x5029('0x83')};var _0x4c40d1={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5029('0x5d')};var _0x41e2d8=function(_0x51098a){return!_['includes'](['IS\x20NULL',_0x5029('0x60'),_0x5029('0x84'),_0x5029('0x61')],_0x51098a);};var _0x4007c8=function(_0x3dc05a){if(!_0x3dc05a||!_0x3dc05a['rules'][_0x5029('0x33')]){return'';}for(var _0x2e4782='(',_0x2c0540=0x0;_0x2c0540<_0x3dc05a['rules']['length'];_0x2c0540+=0x1){_0x2c0540>0x0&&(_0x2e4782+='\x20'+_0x3dc05a[_0x5029('0x85')]+'\x20');_0x2e4782+=_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x7b')]?_0x4007c8(_0x3dc05a[_0x5029('0x62')][_0x2c0540]['group']):_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x63')]+'\x20'+_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x64')]+(_0x41e2d8(_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x64')])?'\x20'+_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x65')]:'');}return _0x2e4782+')';};var _0x5aecc2={'where':{'id':_0x426d70['id']}},_0x159450,_0x556c7a,_0x48bbe2,_0x3e3150,_0x533ee2;_0x5aecc2=_[_0x5029('0x3c')]({},_0x5aecc2,_0x153cdc);return db[_0x5029('0x2a')][_0x5029('0x45')](_0x5aecc2)[_0x5029('0x21')](function(_0x1b6f4c){if(_0x1b6f4c){_0x159450=_0x1b6f4c;return _0x1b6f4c[_0x5029('0x86')]();}return null;})[_0x5029('0x21')](function(_0x1d6092){if(_0x1d6092){if(!_0x1d6092['length']){throw new db['Sequelize'][(_0x5029('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x556c7a=_0x1d6092;return db['AnalyticMetric'][_0x5029('0x87')]({'raw':!![]});}return null;})['then'](function(_0x4b25ed){if(_0x4b25ed){_0x48bbe2=_[_0x5029('0x69')](_0x4b25ed,'id');var _0xb8da0b;var _0x13e07e=squel[_0x5029('0x88')]();_0x13e07e[_0x5029('0x6a')](_0x159450['table']);for(var _0x38c02a=0x0;_0x38c02a<_0x556c7a[_0x5029('0x33')];_0x38c02a+=0x1){_0xb8da0b=_0x556c7a[_0x38c02a][_0x5029('0x6c')]?_0x48bbe2[_0x556c7a[_0x38c02a]['MetricId']][_0x5029('0x6d')]:_0x556c7a[_0x38c02a][_0x5029('0x63')];_0xb8da0b=_0x556c7a[_0x38c02a][_0x5029('0x6e')]?_[_0x5029('0x89')](_0x3e47bd[_0x556c7a[_0x38c02a][_0x5029('0x6e')]],'%s',_0xb8da0b):_0xb8da0b;_0xb8da0b=_0x556c7a[_0x38c02a]['format']?_['replace'](_0x4c40d1[_0x556c7a[_0x38c02a][_0x5029('0x6f')]],'%s',_0xb8da0b):_0xb8da0b;if(_0x556c7a[_0x38c02a][_0x5029('0x70')]){_0x13e07e['group'](_0xb8da0b);}_0x556c7a[_0x38c02a][_0x5029('0x71')]&&_0x13e07e[_0x5029('0x36')](_0xb8da0b,_0x556c7a[_0x38c02a][_0x5029('0x71')]===_0x5029('0x72')?![]:!![]);_0x13e07e[_0x5029('0x63')](_0xb8da0b,_0x556c7a[_0x38c02a][_0x5029('0x73')]||_0xb8da0b);}if(_0x159450[_0x5029('0x74')]){_0x159450[_0x5029('0x74')]=JSON['parse'](_0x159450['joins']);for(var _0x4243c3=0x0;_0x4243c3<_0x159450['joins'][_0x5029('0x33')];_0x4243c3+=0x1){if(_0x159450['joins'][_0x4243c3][_0x5029('0x2c')]&&_[_0x5029('0x5e')](_0x344203,_0x159450[_0x5029('0x74')][_0x4243c3]['type'])&&_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x76')]&&_0x159450[_0x5029('0x74')][_0x4243c3]['foreignTable']&&_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x78')]){_0x13e07e[_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x2c')]](_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x159450[_0x5029('0x6b')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x76')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x77')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x78')]));}}}if(_0x159450[_0x5029('0x7a')]){_0x159450[_0x5029('0x7a')]=JSON[_0x5029('0x75')](_0x159450['conditions']);_0x13e07e[_0x5029('0x38')](_0x4007c8(_0x159450[_0x5029('0x7a')][_0x5029('0x7b')]));}_0x533ee2=_0x13e07e[_0x5029('0x7c')]();_0x13e07e[_0x5029('0x1b')](_0x202c51);_0x13e07e['offset'](0x0);return;}})[_0x5029('0x21')](function(){if(_0xe6ac28[_0x5029('0x8a')]===_0x5029('0x8b')){return null;}var _0xf7729c=_[_0x5029('0x3c')](_0xe6ac28,{'name':_0xe6ac28['fullPath']||_0xe6ac28[_0x5029('0x26')]||_0x159450[_0x5029('0x26')],'basename':_0x5e7f50,'savename':util[_0x5029('0x6f')](_0x5029('0x8c'),_0xe6ac28[_0x5029('0x26')]||_0x159450['name'],require(_0x5029('0x8d'))[_0x5029('0x8e')](0x4),_0xe6ac28[_0x5029('0x8a')]||_0x5029('0x8f')),'reportId':_0x159450['id'],'reportType':_0x5029('0x90')});return db[_0x5029('0x91')][_0x5029('0x46')](_0xf7729c,{'raw':!![]});})[_0x5029('0x21')](function(_0x4a7535){if(_0x159450['table']===_0x5029('0x92')){_0x533ee2[_0x5029('0x38')](_0x159450[_0x5029('0x6b')]+_0x5029('0x93'),_0xe6ac28[_0x5029('0x94')],_0xe6ac28['endDate']);}else{_0x533ee2[_0x5029('0x38')](_0x159450['table']+_0x5029('0x95'),_0xe6ac28[_0x5029('0x94')],_0xe6ac28[_0x5029('0x96')]);}if(_0x4a7535){logger[_0x5029('0x97')](_0x5029('0x98'),_0x533ee2[_0x5029('0x80')]());require('child_process')[_0x5029('0x99')](path[_0x5029('0x4f')](__dirname,'../../components/export/',_0x4a7535[_0x5029('0x8a')]),[_0x4a7535['id'],_0x533ee2[_0x5029('0x80')](),path['join'](__dirname,_0x5029('0x9a'),_0x4a7535['savename']),_0x5e7f50]);return _0x4a7535;}else{var _0x54c0f3=squel['select']();_0x54c0f3['from']('('+_0x533ee2[_0x5029('0x80')]()+')','countTable');_0x54c0f3[_0x5029('0x63')](_0x5029('0x9b'),'count');_0x533ee2[_0x5029('0x1b')](_0xe6ac28[_0x5029('0x1b')]||_0x202c51);_0x533ee2['offset'](_0xe6ac28[_0x5029('0x19')]||0x0);return dbH[_0x5029('0x7f')]['query'](_0x54c0f3[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')]['QueryTypes'][_0x5029('0x9c')]})[_0x5029('0x21')](function(_0x17c755){if(!_0x17c755[_0x5029('0x33')]){_0x3e3150=0x0;}else{_0x3e3150=_0x17c755[0x0][_0x5029('0x1c')]||0x0;}return dbH[_0x5029('0x7f')]['query'](_0x533ee2[_0x5029('0x80')](),{'type':dbH['sequelize'][_0x5029('0x81')][_0x5029('0x9c')]});})[_0x5029('0x21')](function(_0x3ebe00){return{'rows':_0x3ebe00||[],'count':_0x3e3150};});}});}exports[_0x5029('0x9d')]=function(_0x2138cc,_0x331af8){return runReport(_0x2138cc[_0x5029('0x43')],_0x2138cc[_0x5029('0x2e')],_0x2138cc[_0x5029('0x44')])[_0x5029('0x21')](respondWithResult(_0x331af8,null))[_0x5029('0x41')](handleError(_0x331af8,null));};exports[_0x5029('0x9e')]=runReport;exports[_0x5029('0x2e')]=function(_0x9de076,_0x2ac88e){var _0x55ee4f=0xa;var _0x1fa9eb=[_0x5029('0x4f'),_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x405d47={'SUM':'SUM(%s)','COUNT':_0x5029('0x54'),'COUNT DISTINCT':_0x5029('0x82'),'MAX':_0x5029('0x9f'),'MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':_0x5029('0x83')};var _0x29c3a2={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':_0x5029('0x5c'),'UNIX_TIMESTAMP':_0x5029('0x5d')};var _0xb39e9d=function(_0x124c5e){return!_['includes']([_0x5029('0x5f'),'IS\x20NOT\x20NULL',_0x5029('0x84'),_0x5029('0x61')],_0x124c5e);};var _0x120acc=function(_0x21bb22){if(!_0x21bb22||!_0x21bb22['rules'][_0x5029('0x33')]){return'';}for(var _0x339112='(',_0x5d7c1a=0x0;_0x5d7c1a<_0x21bb22[_0x5029('0x62')][_0x5029('0x33')];_0x5d7c1a+=0x1){_0x5d7c1a>0x0&&(_0x339112+='\x20'+_0x21bb22['operator']+'\x20');_0x339112+=_0x21bb22[_0x5029('0x62')][_0x5d7c1a][_0x5029('0x7b')]?_0x120acc(_0x21bb22['rules'][_0x5d7c1a]['group']):_0x21bb22[_0x5029('0x62')][_0x5d7c1a]['field']+'\x20'+_0x21bb22['rules'][_0x5d7c1a][_0x5029('0x64')]+(_0xb39e9d(_0x21bb22['rules'][_0x5d7c1a][_0x5029('0x64')])?'\x20'+_0x21bb22[_0x5029('0x62')][_0x5d7c1a]['value']:'');}return _0x339112+')';};var _0x327299={'where':{'id':_0x9de076['params']['id']}},_0x3463cc,_0x590cc2,_0x3ac39a,_0x37c47b,_0x62e4af;_0x327299=_[_0x5029('0x3c')]({},_0x327299,_0x9de076['options']);return db[_0x5029('0x2a')][_0x5029('0x45')](_0x327299)[_0x5029('0x21')](function(_0x5e7ec8){if(_0x5e7ec8){_0x3463cc=_0x5e7ec8;return _0x5e7ec8[_0x5029('0x86')]();}return null;})[_0x5029('0x21')](function(_0x5aa480){if(_0x5aa480){if(!_0x5aa480[_0x5029('0x33')]){throw new db[(_0x5029('0x66'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x590cc2=_0x5aa480;return db[_0x5029('0x68')][_0x5029('0x87')]({'raw':!![]});}return null;})['then'](function(_0x5842a5){if(_0x5842a5){_0x3ac39a=_['keyBy'](_0x5842a5,'id');var _0x313bdb;var _0x1d38e0=squel[_0x5029('0x88')]();_0x1d38e0['from'](_0x3463cc[_0x5029('0x6b')]);for(var _0x581237=0x0;_0x581237<_0x590cc2[_0x5029('0x33')];_0x581237+=0x1){_0x313bdb=_0x590cc2[_0x581237]['MetricId']?_0x3ac39a[_0x590cc2[_0x581237]['MetricId']]['metric']:_0x590cc2[_0x581237]['field'];_0x313bdb=_0x590cc2[_0x581237][_0x5029('0x6e')]?_[_0x5029('0x89')](_0x405d47[_0x590cc2[_0x581237][_0x5029('0x6e')]],'%s',_0x313bdb):_0x313bdb;_0x313bdb=_0x590cc2[_0x581237][_0x5029('0x6f')]?_[_0x5029('0x89')](_0x29c3a2[_0x590cc2[_0x581237]['format']],'%s',_0x313bdb):_0x313bdb;if(_0x590cc2[_0x581237][_0x5029('0x70')]){_0x1d38e0[_0x5029('0x7b')](_0x313bdb);}_0x590cc2[_0x581237][_0x5029('0x71')]&&_0x1d38e0[_0x5029('0x36')](_0x313bdb,_0x590cc2[_0x581237][_0x5029('0x71')]===_0x5029('0x72')?![]:!![]);_0x1d38e0['field'](_0x313bdb,_0x590cc2[_0x581237][_0x5029('0x73')]||_0x313bdb);}if(_0x3463cc[_0x5029('0x74')]){_0x3463cc[_0x5029('0x74')]=JSON['parse'](_0x3463cc['joins']);for(var _0xd05bc9=0x0;_0xd05bc9<_0x3463cc[_0x5029('0x74')][_0x5029('0x33')];_0xd05bc9+=0x1){if(_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x2c')]&&_[_0x5029('0x5e')](_0x1fa9eb,_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x2c')])&&_0x3463cc['joins'][_0xd05bc9][_0x5029('0x76')]&&_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x77')]&&_0x3463cc['joins'][_0xd05bc9][_0x5029('0x78')]){_0x1d38e0[_0x3463cc['joins'][_0xd05bc9][_0x5029('0x2c')]](_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x3463cc[_0x5029('0x6b')],_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x76')],_0x3463cc['joins'][_0xd05bc9]['foreignTable'],_0x3463cc['joins'][_0xd05bc9][_0x5029('0x78')]));}}}if(_0x3463cc[_0x5029('0x7a')]){_0x3463cc[_0x5029('0x7a')]=JSON[_0x5029('0x75')](_0x3463cc[_0x5029('0x7a')]);_0x1d38e0['where'](_0x120acc(_0x3463cc[_0x5029('0x7a')][_0x5029('0x7b')]));}_0x62e4af=_0x1d38e0[_0x5029('0x7c')]();_0x1d38e0[_0x5029('0x1b')](_0x55ee4f);_0x1d38e0[_0x5029('0x19')](0x0);logger['debug'](_0x5029('0x7e'),_0x1d38e0[_0x5029('0x80')]());return dbH[_0x5029('0x7f')][_0x5029('0x2e')](_0x1d38e0[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')][_0x5029('0x81')][_0x5029('0x9c')]});}})[_0x5029('0x21')](function(){return{'sql':_0x62e4af[_0x5029('0x80')]()};})[_0x5029('0x21')](respondWithResult(_0x2ac88e,null))[_0x5029('0x41')](handleError(_0x2ac88e,null));}; \ No newline at end of file +var _0x31f0=['fullPath','%s-%s.%s','randomstring','generate','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','../../components/export/','../../files/reports','countTable','COUNT(*)','run','runReport','DATE(%s)','keyBy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','get','DefaultReports','destroy','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','rows','catch','params','length','find','create','user','role','Reports','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','function','replace','format','orderBy','DESC','field','alias','parse','joins','parentKey','foreignKey','%s.%s\x20=\x20%s.%s','foreignTable','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','COUNT(DISTINCT\x20%s)','AVG(%s)','HOUR(%s)','ROUND(%s)','IS\x20NOT\x20NULL','getFields','MetricId','metric','groupBy','output','web'];(function(_0x10d023,_0x6ad4ad){var _0x31371b=function(_0x210693){while(--_0x210693){_0x10d023['push'](_0x10d023['shift']());}};_0x31371b(++_0x6ad4ad);}(_0x31f0,0xb7));var _0x031f=function(_0x2a9ef6,_0x525920){_0x2a9ef6=_0x2a9ef6-0x0;var _0x557e08=_0x31f0[_0x2a9ef6];return _0x557e08;};'use strict';var emlformat=require(_0x031f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x031f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x031f('0x2'));var moment=require(_0x031f('0x3'));var BPromise=require(_0x031f('0x4'));var Mustache=require(_0x031f('0x5'));var util=require('util');var path=require(_0x031f('0x6'));var sox=require(_0x031f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x031f('0x8'));var squel=require('squel');var crypto=require(_0x031f('0x9'));var jsforce=require(_0x031f('0xa'));var deskjs=require(_0x031f('0xb'));var toCsv=require(_0x031f('0xc'));var querystring=require('querystring');var Papa=require(_0x031f('0xd'));var Redis=require(_0x031f('0xe'));var authService=require(_0x031f('0xf'));var qs=require(_0x031f('0x10'));var as=require(_0x031f('0x11'));var hardwareService=require(_0x031f('0x12'));var logger=require(_0x031f('0x13'))(_0x031f('0x14'));var utils=require('../../config/utils');var config=require(_0x031f('0x15'));var licenseUtil=require(_0x031f('0x16'));var db=require(_0x031f('0x17'))['db'];var dbH=require(_0x031f('0x17'))[_0x031f('0x18')];function respondWithStatusCode(_0x405896,_0x1c230d){_0x1c230d=_0x1c230d||0xcc;return function(_0x5d0457){if(_0x5d0457){return _0x405896[_0x031f('0x19')](_0x1c230d);}return _0x405896[_0x031f('0x1a')](_0x1c230d)[_0x031f('0x1b')]();};}function respondWithResult(_0x2e3dfe,_0x2ea549){_0x2ea549=_0x2ea549||0xc8;return function(_0x57f9c0){if(_0x57f9c0){return _0x2e3dfe['status'](_0x2ea549)[_0x031f('0x1c')](_0x57f9c0);}};}function respondWithFilteredResult(_0x3a10aa,_0xe4fc1d){return function(_0x286177){if(_0x286177){var _0x5196b1=typeof _0xe4fc1d[_0x031f('0x1d')]===_0x031f('0x1e')&&typeof _0xe4fc1d['limit']===_0x031f('0x1e');var _0x535e70=_0x286177[_0x031f('0x1f')];var _0x5f2199=_0x5196b1?0x0:_0xe4fc1d[_0x031f('0x1d')];var _0xaa155=_0x5196b1?_0x286177[_0x031f('0x1f')]:_0xe4fc1d[_0x031f('0x1d')]+_0xe4fc1d[_0x031f('0x20')];var _0x2825ef;if(_0xaa155>=_0x535e70){_0xaa155=_0x535e70;_0x2825ef=0xc8;}else{_0x2825ef=0xce;}_0x3a10aa[_0x031f('0x1a')](_0x2825ef);return _0x3a10aa[_0x031f('0x21')](_0x031f('0x22'),_0x5f2199+'-'+_0xaa155+'/'+_0x535e70)['json'](_0x286177);}return null;};}function patchUpdates(_0xf72793){return function(_0x33926c){try{jsonpatch[_0x031f('0x23')](_0x33926c,_0xf72793,!![]);}catch(_0x4d6706){return BPromise['reject'](_0x4d6706);}return _0x33926c[_0x031f('0x24')]();};}function saveUpdates(_0x4d0f92,_0x3472a2){return function(_0x57f6c4){if(_0x57f6c4){return _0x57f6c4['update'](_0x4d0f92)['then'](function(_0x971691){return _0x971691;});}return null;};}function removeEntity(_0x12c406,_0x2920cd){return function(_0x4c8126){if(_0x4c8126){return _0x4c8126['destroy']()[_0x031f('0x25')](function(){var _0x5a64c0=_0x4c8126[_0x031f('0x26')]({'plain':!![]});var _0x1f5a14=_0x031f('0x27');return db['UserProfileResource'][_0x031f('0x28')]({'where':{'type':_0x1f5a14,'resourceId':_0x5a64c0['id']}})[_0x031f('0x25')](function(){return _0x4c8126;});})['then'](function(){_0x12c406[_0x031f('0x1a')](0xcc)[_0x031f('0x1b')]();});}};}function handleEntityNotFound(_0x2403e9,_0x5395ea){return function(_0xa308b){if(!_0xa308b){_0x2403e9[_0x031f('0x19')](0x194);}return _0xa308b;};}function handleError(_0xb6ed6c,_0xaf5bea){_0xaf5bea=_0xaf5bea||0x1f4;return function(_0xfaa36){logger[_0x031f('0x29')](_0xfaa36['stack']);if(_0xfaa36[_0x031f('0x2a')]){delete _0xfaa36[_0x031f('0x2a')];}_0xb6ed6c[_0x031f('0x1a')](_0xaf5bea)[_0x031f('0x2b')](_0xfaa36);};}exports[_0x031f('0x2c')]=function(_0x2d24f0,_0x378692){var _0x87dc07={},_0x2034ac={},_0xfc4a89={'count':0x0,'rows':[]};var _0x2cf3a8=_['map'](db[_0x031f('0x2d')][_0x031f('0x2e')],function(_0xb3a6bd){return{'name':_0xb3a6bd[_0x031f('0x2f')],'type':_0xb3a6bd[_0x031f('0x30')][_0x031f('0x31')]};});_0x2034ac[_0x031f('0x32')]=_[_0x031f('0x33')](_0x2cf3a8,_0x031f('0x2a'));_0x2034ac[_0x031f('0x34')]=_[_0x031f('0x35')](_0x2d24f0[_0x031f('0x34')]);_0x2034ac[_0x031f('0x36')]=_['intersection'](_0x2034ac[_0x031f('0x32')],_0x2034ac[_0x031f('0x34')]);_0x87dc07['attributes']=_[_0x031f('0x37')](_0x2034ac[_0x031f('0x32')],qs['fields'](_0x2d24f0[_0x031f('0x34')][_0x031f('0x38')]));_0x87dc07[_0x031f('0x39')]=_0x87dc07[_0x031f('0x39')]['length']?_0x87dc07['attributes']:_0x2034ac[_0x031f('0x32')];if(!_0x2d24f0['query'][_0x031f('0x3a')](_0x031f('0x3b'))){_0x87dc07[_0x031f('0x20')]=qs['limit'](_0x2d24f0['query'][_0x031f('0x20')]);_0x87dc07['offset']=qs['offset'](_0x2d24f0[_0x031f('0x34')][_0x031f('0x1d')]);}_0x87dc07[_0x031f('0x3c')]=qs[_0x031f('0x3d')](_0x2d24f0[_0x031f('0x34')][_0x031f('0x3d')]);_0x87dc07[_0x031f('0x3e')]=qs['filters'](_[_0x031f('0x3f')](_0x2d24f0[_0x031f('0x34')],_0x2034ac[_0x031f('0x36')]),_0x2cf3a8);if(_0x2d24f0[_0x031f('0x34')]['filter']){_0x87dc07[_0x031f('0x3e')]=_[_0x031f('0x40')](_0x87dc07[_0x031f('0x3e')],{'$or':_['map'](_0x2cf3a8,function(_0x24ec95){if(_0x24ec95[_0x031f('0x30')]!=='VIRTUAL'){var _0x36bafa={};_0x36bafa[_0x24ec95[_0x031f('0x2a')]]={'$like':'%'+_0x2d24f0['query']['filter']+'%'};return _0x36bafa;}})});}_0x87dc07=_[_0x031f('0x40')]({},_0x87dc07,_0x2d24f0[_0x031f('0x41')]);var _0x9efbc4={'where':_0x87dc07[_0x031f('0x3e')]};return db[_0x031f('0x2d')][_0x031f('0x1f')](_0x9efbc4)[_0x031f('0x25')](function(_0x5a212c){_0xfc4a89[_0x031f('0x1f')]=_0x5a212c;if(_0x2d24f0[_0x031f('0x34')]['includeAll']){_0x87dc07[_0x031f('0x42')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x031f('0x43')](_0x87dc07);})[_0x031f('0x25')](function(_0x56dd24){_0xfc4a89[_0x031f('0x44')]=_0x56dd24;return _0xfc4a89;})[_0x031f('0x25')](respondWithFilteredResult(_0x378692,_0x87dc07))[_0x031f('0x45')](handleError(_0x378692,null));};exports['show']=function(_0x98747f,_0x213e1c){var _0x1d3324={'raw':!![],'where':{'id':_0x98747f[_0x031f('0x46')]['id']}},_0x2a6cba={};_0x2a6cba[_0x031f('0x32')]=_[_0x031f('0x35')](db[_0x031f('0x2d')][_0x031f('0x2e')]);_0x2a6cba['query']=_[_0x031f('0x35')](_0x98747f[_0x031f('0x34')]);_0x2a6cba[_0x031f('0x36')]=_[_0x031f('0x37')](_0x2a6cba[_0x031f('0x32')],_0x2a6cba[_0x031f('0x34')]);_0x1d3324[_0x031f('0x39')]=_[_0x031f('0x37')](_0x2a6cba[_0x031f('0x32')],qs['fields'](_0x98747f[_0x031f('0x34')]['fields']));_0x1d3324['attributes']=_0x1d3324[_0x031f('0x39')][_0x031f('0x47')]?_0x1d3324[_0x031f('0x39')]:_0x2a6cba[_0x031f('0x32')];if(_0x98747f[_0x031f('0x34')]['includeAll']){_0x1d3324[_0x031f('0x42')]=[{'all':!![]}];}_0x1d3324=_[_0x031f('0x40')]({},_0x1d3324,_0x98747f[_0x031f('0x41')]);return db['AnalyticDefaultReport'][_0x031f('0x48')](_0x1d3324)[_0x031f('0x25')](handleEntityNotFound(_0x213e1c,null))[_0x031f('0x25')](respondWithResult(_0x213e1c,null))[_0x031f('0x45')](handleError(_0x213e1c,null));};exports[_0x031f('0x49')]=function(_0x12d28e,_0x5caeb5){return db['AnalyticDefaultReport'][_0x031f('0x49')](_0x12d28e['body'],{})[_0x031f('0x25')](function(_0x3bba44){var _0x5a29e0=_0x12d28e[_0x031f('0x4a')]['get']({'plain':!![]});if(!_0x5a29e0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a29e0[_0x031f('0x4b')]==='user'){var _0x16bade=_0x3bba44['get']({'plain':!![]});var _0x11bf43=_0x031f('0x4c');return db['UserProfileSection'][_0x031f('0x48')]({'where':{'name':_0x11bf43,'userProfileId':_0x5a29e0[_0x031f('0x4d')]},'raw':!![]})['then'](function(_0x46471a){if(_0x46471a&&_0x46471a['autoAssociation']===0x0){return db[_0x031f('0x4e')]['create']({'name':_0x16bade[_0x031f('0x2a')],'resourceId':_0x16bade['id'],'type':_0x031f('0x27'),'sectionId':_0x46471a['id']},{})[_0x031f('0x25')](function(){return _0x3bba44;});}else{return _0x3bba44;}})[_0x031f('0x45')](function(_0x691a68){logger['error'](_0x031f('0x4f'),_0x691a68);throw _0x691a68;});}return _0x3bba44;})['then'](respondWithResult(_0x5caeb5,0xc9))[_0x031f('0x45')](handleError(_0x5caeb5,null));};exports[_0x031f('0x50')]=function(_0x4d49f8,_0x1f9c55){if(_0x4d49f8[_0x031f('0x51')]['id']){delete _0x4d49f8['body']['id'];}return db[_0x031f('0x2d')][_0x031f('0x48')]({'where':{'id':_0x4d49f8[_0x031f('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f9c55,null))[_0x031f('0x25')](saveUpdates(_0x4d49f8['body'],null))[_0x031f('0x25')](respondWithResult(_0x1f9c55,null))['catch'](handleError(_0x1f9c55,null));};exports[_0x031f('0x28')]=function(_0x561a2b,_0xa52a54){return db[_0x031f('0x2d')]['find']({'where':{'id':_0x561a2b['params']['id']}})[_0x031f('0x25')](handleEntityNotFound(_0xa52a54,null))[_0x031f('0x25')](removeEntity(_0xa52a54,null))['catch'](handleError(_0xa52a54,null));};exports[_0x031f('0x52')]=function(_0xb44c73,_0x255003){var _0x286d4e=0xa;var _0x21a89d=[_0x031f('0x53'),_0x031f('0x54'),_0x031f('0x55'),'cross_join'];var _0xe452c2={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x031f('0x58'),'MIN':_0x031f('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':_0x031f('0x5c')};var _0x198e2e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x031f('0x5d')};var _0xcf8b7=function(_0x4a7fbb){return!_[_0x031f('0x5e')]([_0x031f('0x5f'),'IS\x20NOT\x20NULL',_0x031f('0x60'),_0x031f('0x61')],_0x4a7fbb);};var _0x451c71=function(_0x22d211){if(!_0x22d211||!_0x22d211[_0x031f('0x62')][_0x031f('0x47')]){return'';}for(var _0x2ddf15='(',_0x4527e5=0x0;_0x4527e5<_0x22d211[_0x031f('0x62')]['length'];_0x4527e5+=0x1){_0x4527e5>0x0&&(_0x2ddf15+='\x20'+_0x22d211[_0x031f('0x63')]+'\x20');_0x2ddf15+=_0x22d211['rules'][_0x4527e5][_0x031f('0x64')]?_0x451c71(_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x64')]):_0x22d211['rules'][_0x4527e5]['field']+'\x20'+_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x65')]+(_0xcf8b7(_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x65')])?'\x20'+_0x22d211['rules'][_0x4527e5][_0x031f('0x66')]:'');}return _0x2ddf15+')';};var _0x5a181c={'where':{'id':_0xb44c73[_0x031f('0x46')]['id']}},_0x478982,_0x2179ee,_0x534bae,_0x50d618,_0x71e67;_0x5a181c=_[_0x031f('0x40')]({},_0x5a181c,_0xb44c73[_0x031f('0x41')]);return db[_0x031f('0x2d')]['find'](_0x5a181c)['then'](function(_0x214eec){if(_0x214eec){_0x478982=_0x214eec;return _0x214eec['getFields']();}return null;})[_0x031f('0x25')](function(_0xa921b2){if(_0xa921b2){if(!_0xa921b2['length']){throw new db[(_0x031f('0x67'))][(_0x031f('0x68'))](_0x031f('0x69'),0x193);}_0x2179ee=_0xa921b2;return db[_0x031f('0x6a')][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x5bea08){if(_0x5bea08){_0x534bae=_['keyBy'](_0x5bea08,'id');var _0x3bcc7e;var _0x232b62=squel[_0x031f('0x6b')]();_0x232b62[_0x031f('0x6c')](_0x478982[_0x031f('0x6d')]);for(var _0x26fa57=0x0;_0x26fa57<_0x2179ee[_0x031f('0x47')];_0x26fa57+=0x1){_0x3bcc7e=_0x2179ee[_0x26fa57]['MetricId']?_0x534bae[_0x2179ee[_0x26fa57]['MetricId']]['metric']:_0x2179ee[_0x26fa57]['field'];_0x3bcc7e=_0x2179ee[_0x26fa57][_0x031f('0x6e')]?_[_0x031f('0x6f')](_0xe452c2[_0x2179ee[_0x26fa57][_0x031f('0x6e')]],'%s',_0x3bcc7e):_0x3bcc7e;_0x3bcc7e=_0x2179ee[_0x26fa57]['format']?_[_0x031f('0x6f')](_0x198e2e[_0x2179ee[_0x26fa57][_0x031f('0x70')]],'%s',_0x3bcc7e):_0x3bcc7e;if(_0x2179ee[_0x26fa57]['groupBy']){_0x232b62[_0x031f('0x64')](_0x3bcc7e);}_0x2179ee[_0x26fa57][_0x031f('0x71')]&&_0x232b62[_0x031f('0x3c')](_0x3bcc7e,_0x2179ee[_0x26fa57][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x232b62[_0x031f('0x73')](_0x3bcc7e,_0x2179ee[_0x26fa57][_0x031f('0x74')]||_0x3bcc7e);}if(_0x478982['joins']){_0x478982['joins']=JSON[_0x031f('0x75')](_0x478982['joins']);for(var _0x2ed9c1=0x0;_0x2ed9c1<_0x478982['joins'][_0x031f('0x47')];_0x2ed9c1+=0x1){if(_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x30')]&&_['includes'](_0x21a89d,_0x478982[_0x031f('0x76')][_0x2ed9c1]['type'])&&_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x77')]&&_0x478982[_0x031f('0x76')][_0x2ed9c1]['foreignTable']&&_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x78')]){_0x232b62[_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x30')]](_0x478982[_0x031f('0x76')][_0x2ed9c1]['foreignTable'],null,util['format'](_0x031f('0x79'),_0x478982[_0x031f('0x6d')],_0x478982['joins'][_0x2ed9c1][_0x031f('0x77')],_0x478982['joins'][_0x2ed9c1][_0x031f('0x7a')],_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x78')]));}}}if(_0x478982[_0x031f('0x7b')]){_0x478982['conditions']=JSON[_0x031f('0x75')](_0x478982[_0x031f('0x7b')]);_0x232b62[_0x031f('0x3e')](_0x451c71(_0x478982['conditions'][_0x031f('0x64')]));}_0x71e67=_0x232b62[_0x031f('0x7c')]();_0x232b62['limit'](_0x286d4e);_0x232b62[_0x031f('0x1d')](0x0);logger[_0x031f('0x7d')](_0x031f('0x7e'),_0x232b62[_0x031f('0x7f')]());return dbH[_0x031f('0x80')][_0x031f('0x34')](_0x232b62[_0x031f('0x7f')](),{'type':dbH['sequelize'][_0x031f('0x81')][_0x031f('0x82')]});}})[_0x031f('0x25')](respondWithResult(_0x255003,null))['catch'](handleError(_0x255003,null));};function runReport(_0x4f4aff,_0x26de7c,_0x5bd344){var _0x54f02d=_0x26de7c[_0x031f('0x2a')];var _0x184bbd=0xa;var _0x1c8055=[_0x031f('0x53'),_0x031f('0x54'),_0x031f('0x55'),_0x031f('0x83')];var _0x32c626={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':_0x031f('0x84'),'MAX':'MAX(%s)','MIN':_0x031f('0x59'),'AVG':_0x031f('0x85'),'GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x6970f5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x031f('0x86'),'ROUND':_0x031f('0x87'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x510bb6=function(_0x3cfaa4){return!_[_0x031f('0x5e')]([_0x031f('0x5f'),_0x031f('0x88'),_0x031f('0x60'),_0x031f('0x61')],_0x3cfaa4);};var _0x5e0853=function(_0x263658){if(!_0x263658||!_0x263658[_0x031f('0x62')]['length']){return'';}for(var _0x25ea89='(',_0x2f2e96=0x0;_0x2f2e96<_0x263658[_0x031f('0x62')][_0x031f('0x47')];_0x2f2e96+=0x1){_0x2f2e96>0x0&&(_0x25ea89+='\x20'+_0x263658[_0x031f('0x63')]+'\x20');_0x25ea89+=_0x263658[_0x031f('0x62')][_0x2f2e96][_0x031f('0x64')]?_0x5e0853(_0x263658['rules'][_0x2f2e96][_0x031f('0x64')]):_0x263658['rules'][_0x2f2e96][_0x031f('0x73')]+'\x20'+_0x263658[_0x031f('0x62')][_0x2f2e96][_0x031f('0x65')]+(_0x510bb6(_0x263658['rules'][_0x2f2e96]['condition'])?'\x20'+_0x263658['rules'][_0x2f2e96][_0x031f('0x66')]:'');}return _0x25ea89+')';};var _0xee744={'where':{'id':_0x4f4aff['id']}},_0x8f0afd,_0x2985fe,_0x290f82,_0x307246,_0x232aa0;_0xee744=_['merge']({},_0xee744,_0x5bd344);return db['AnalyticDefaultReport'][_0x031f('0x48')](_0xee744)[_0x031f('0x25')](function(_0x54d86e){if(_0x54d86e){_0x8f0afd=_0x54d86e;return _0x54d86e[_0x031f('0x89')]();}return null;})['then'](function(_0x1c31d5){if(_0x1c31d5){if(!_0x1c31d5[_0x031f('0x47')]){throw new db['Sequelize'][(_0x031f('0x68'))](_0x031f('0x69'),0x193);}_0x2985fe=_0x1c31d5;return db['AnalyticMetric'][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x1b588e){if(_0x1b588e){_0x290f82=_['keyBy'](_0x1b588e,'id');var _0xa9b5e2;var _0x31504b=squel[_0x031f('0x6b')]();_0x31504b[_0x031f('0x6c')](_0x8f0afd[_0x031f('0x6d')]);for(var _0x2b3326=0x0;_0x2b3326<_0x2985fe['length'];_0x2b3326+=0x1){_0xa9b5e2=_0x2985fe[_0x2b3326][_0x031f('0x8a')]?_0x290f82[_0x2985fe[_0x2b3326][_0x031f('0x8a')]][_0x031f('0x8b')]:_0x2985fe[_0x2b3326][_0x031f('0x73')];_0xa9b5e2=_0x2985fe[_0x2b3326]['function']?_[_0x031f('0x6f')](_0x32c626[_0x2985fe[_0x2b3326][_0x031f('0x6e')]],'%s',_0xa9b5e2):_0xa9b5e2;_0xa9b5e2=_0x2985fe[_0x2b3326]['format']?_[_0x031f('0x6f')](_0x6970f5[_0x2985fe[_0x2b3326][_0x031f('0x70')]],'%s',_0xa9b5e2):_0xa9b5e2;if(_0x2985fe[_0x2b3326][_0x031f('0x8c')]){_0x31504b[_0x031f('0x64')](_0xa9b5e2);}_0x2985fe[_0x2b3326][_0x031f('0x71')]&&_0x31504b[_0x031f('0x3c')](_0xa9b5e2,_0x2985fe[_0x2b3326][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x31504b[_0x031f('0x73')](_0xa9b5e2,_0x2985fe[_0x2b3326][_0x031f('0x74')]||_0xa9b5e2);}if(_0x8f0afd[_0x031f('0x76')]){_0x8f0afd[_0x031f('0x76')]=JSON[_0x031f('0x75')](_0x8f0afd[_0x031f('0x76')]);for(var _0x2433ce=0x0;_0x2433ce<_0x8f0afd['joins'][_0x031f('0x47')];_0x2433ce+=0x1){if(_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')]&&_[_0x031f('0x5e')](_0x1c8055,_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')])&&_0x8f0afd['joins'][_0x2433ce]['parentKey']&&_0x8f0afd['joins'][_0x2433ce][_0x031f('0x7a')]&&_0x8f0afd[_0x031f('0x76')][_0x2433ce]['foreignKey']){_0x31504b[_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')]](_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x7a')],null,util['format'](_0x031f('0x79'),_0x8f0afd[_0x031f('0x6d')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x77')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x7a')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x78')]));}}}if(_0x8f0afd[_0x031f('0x7b')]){_0x8f0afd[_0x031f('0x7b')]=JSON[_0x031f('0x75')](_0x8f0afd[_0x031f('0x7b')]);_0x31504b['where'](_0x5e0853(_0x8f0afd[_0x031f('0x7b')][_0x031f('0x64')]));}_0x232aa0=_0x31504b['clone']();_0x31504b[_0x031f('0x20')](_0x184bbd);_0x31504b[_0x031f('0x1d')](0x0);return;}})['then'](function(){if(_0x26de7c[_0x031f('0x8d')]===_0x031f('0x8e')){return null;}var _0x1ade73=_[_0x031f('0x40')](_0x26de7c,{'name':_0x26de7c[_0x031f('0x8f')]||_0x26de7c[_0x031f('0x2a')]||_0x8f0afd[_0x031f('0x2a')],'basename':_0x54f02d,'savename':util[_0x031f('0x70')](_0x031f('0x90'),_0x26de7c['name']||_0x8f0afd[_0x031f('0x2a')],require(_0x031f('0x91'))[_0x031f('0x92')](0x4),_0x26de7c['output']||'csv'),'reportId':_0x8f0afd['id'],'reportType':_0x031f('0x93')});return db['AnalyticExtractedReport'][_0x031f('0x49')](_0x1ade73,{'raw':!![]});})[_0x031f('0x25')](function(_0x4a96f2){if(_0x8f0afd[_0x031f('0x6d')]===_0x031f('0x94')){_0x232aa0[_0x031f('0x3e')](_0x8f0afd[_0x031f('0x6d')]+_0x031f('0x95'),_0x26de7c[_0x031f('0x96')],_0x26de7c[_0x031f('0x97')]);}else{_0x232aa0[_0x031f('0x3e')](_0x8f0afd[_0x031f('0x6d')]+_0x031f('0x98'),_0x26de7c[_0x031f('0x96')],_0x26de7c[_0x031f('0x97')]);}if(_0x4a96f2){logger[_0x031f('0x99')]('Run\x20Query:',_0x232aa0['toString']());require(_0x031f('0x9a'))['fork'](path[_0x031f('0x53')](__dirname,_0x031f('0x9b'),_0x4a96f2[_0x031f('0x8d')]),[_0x4a96f2['id'],_0x232aa0['toString'](),path[_0x031f('0x53')](__dirname,_0x031f('0x9c'),_0x4a96f2['savename']),_0x54f02d]);return _0x4a96f2;}else{var _0x185085=squel[_0x031f('0x6b')]();_0x185085[_0x031f('0x6c')]('('+_0x232aa0[_0x031f('0x7f')]()+')',_0x031f('0x9d'));_0x185085[_0x031f('0x73')](_0x031f('0x9e'),'count');_0x232aa0[_0x031f('0x20')](_0x26de7c[_0x031f('0x20')]||_0x184bbd);_0x232aa0[_0x031f('0x1d')](_0x26de7c[_0x031f('0x1d')]||0x0);return dbH['sequelize']['query'](_0x185085[_0x031f('0x7f')](),{'type':dbH['sequelize']['QueryTypes'][_0x031f('0x82')]})['then'](function(_0x579ade){if(!_0x579ade[_0x031f('0x47')]){_0x307246=0x0;}else{_0x307246=_0x579ade[0x0][_0x031f('0x1f')]||0x0;}return dbH[_0x031f('0x80')][_0x031f('0x34')](_0x232aa0[_0x031f('0x7f')](),{'type':dbH[_0x031f('0x80')]['QueryTypes'][_0x031f('0x82')]});})[_0x031f('0x25')](function(_0x52a3f0){return{'rows':_0x52a3f0||[],'count':_0x307246};});}});}exports[_0x031f('0x9f')]=function(_0x355e1a,_0x30c32f){return runReport(_0x355e1a[_0x031f('0x46')],_0x355e1a['query'],_0x355e1a['options'])['then'](respondWithResult(_0x30c32f,null))[_0x031f('0x45')](handleError(_0x30c32f,null));};exports[_0x031f('0xa0')]=runReport;exports[_0x031f('0x34')]=function(_0x3ec98a,_0x3ed663){var _0xac324f=0xa;var _0xcf0af9=[_0x031f('0x53'),_0x031f('0x54'),'right_join',_0x031f('0x83')];var _0xde544e={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':_0x031f('0x84'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':_0x031f('0x5c')};var _0x84cd0c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x031f('0xa1'),'HOUR':'HOUR(%s)','ROUND':_0x031f('0x87'),'UNIX_TIMESTAMP':_0x031f('0x5d')};var _0x24aff3=function(_0x35a1f1){return!_[_0x031f('0x5e')](['IS\x20NULL',_0x031f('0x88'),_0x031f('0x60'),_0x031f('0x61')],_0x35a1f1);};var _0x3cb099=function(_0x4a4d8f){if(!_0x4a4d8f||!_0x4a4d8f[_0x031f('0x62')][_0x031f('0x47')]){return'';}for(var _0x578201='(',_0xdbf09f=0x0;_0xdbf09f<_0x4a4d8f['rules'][_0x031f('0x47')];_0xdbf09f+=0x1){_0xdbf09f>0x0&&(_0x578201+='\x20'+_0x4a4d8f[_0x031f('0x63')]+'\x20');_0x578201+=_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x64')]?_0x3cb099(_0x4a4d8f[_0x031f('0x62')][_0xdbf09f]['group']):_0x4a4d8f[_0x031f('0x62')][_0xdbf09f]['field']+'\x20'+_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x65')]+(_0x24aff3(_0x4a4d8f['rules'][_0xdbf09f][_0x031f('0x65')])?'\x20'+_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x66')]:'');}return _0x578201+')';};var _0x123b4d={'where':{'id':_0x3ec98a['params']['id']}},_0x3f80b5,_0x53cd67,_0x516f11,_0x50cdb2,_0x2e9a3b;_0x123b4d=_[_0x031f('0x40')]({},_0x123b4d,_0x3ec98a[_0x031f('0x41')]);return db[_0x031f('0x2d')][_0x031f('0x48')](_0x123b4d)[_0x031f('0x25')](function(_0x53911d){if(_0x53911d){_0x3f80b5=_0x53911d;return _0x53911d[_0x031f('0x89')]();}return null;})['then'](function(_0x30fa18){if(_0x30fa18){if(!_0x30fa18[_0x031f('0x47')]){throw new db[(_0x031f('0x67'))]['ValidationErrorItem'](_0x031f('0x69'),0x193);}_0x53cd67=_0x30fa18;return db[_0x031f('0x6a')][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x5b092c){if(_0x5b092c){_0x516f11=_[_0x031f('0xa2')](_0x5b092c,'id');var _0x7b8699;var _0x14a497=squel[_0x031f('0x6b')]();_0x14a497[_0x031f('0x6c')](_0x3f80b5[_0x031f('0x6d')]);for(var _0x59fd9a=0x0;_0x59fd9a<_0x53cd67[_0x031f('0x47')];_0x59fd9a+=0x1){_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x8a')]?_0x516f11[_0x53cd67[_0x59fd9a][_0x031f('0x8a')]][_0x031f('0x8b')]:_0x53cd67[_0x59fd9a][_0x031f('0x73')];_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x6e')]?_[_0x031f('0x6f')](_0xde544e[_0x53cd67[_0x59fd9a]['function']],'%s',_0x7b8699):_0x7b8699;_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x70')]?_[_0x031f('0x6f')](_0x84cd0c[_0x53cd67[_0x59fd9a][_0x031f('0x70')]],'%s',_0x7b8699):_0x7b8699;if(_0x53cd67[_0x59fd9a][_0x031f('0x8c')]){_0x14a497[_0x031f('0x64')](_0x7b8699);}_0x53cd67[_0x59fd9a]['orderBy']&&_0x14a497[_0x031f('0x3c')](_0x7b8699,_0x53cd67[_0x59fd9a][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x14a497[_0x031f('0x73')](_0x7b8699,_0x53cd67[_0x59fd9a][_0x031f('0x74')]||_0x7b8699);}if(_0x3f80b5['joins']){_0x3f80b5[_0x031f('0x76')]=JSON[_0x031f('0x75')](_0x3f80b5[_0x031f('0x76')]);for(var _0x110747=0x0;_0x110747<_0x3f80b5[_0x031f('0x76')]['length'];_0x110747+=0x1){if(_0x3f80b5['joins'][_0x110747][_0x031f('0x30')]&&_[_0x031f('0x5e')](_0xcf0af9,_0x3f80b5['joins'][_0x110747][_0x031f('0x30')])&&_0x3f80b5['joins'][_0x110747][_0x031f('0x77')]&&_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x7a')]&&_0x3f80b5[_0x031f('0x76')][_0x110747]['foreignKey']){_0x14a497[_0x3f80b5['joins'][_0x110747][_0x031f('0x30')]](_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x7a')],null,util[_0x031f('0x70')]('%s.%s\x20=\x20%s.%s',_0x3f80b5[_0x031f('0x6d')],_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x77')],_0x3f80b5['joins'][_0x110747][_0x031f('0x7a')],_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x78')]));}}}if(_0x3f80b5['conditions']){_0x3f80b5[_0x031f('0x7b')]=JSON[_0x031f('0x75')](_0x3f80b5[_0x031f('0x7b')]);_0x14a497[_0x031f('0x3e')](_0x3cb099(_0x3f80b5[_0x031f('0x7b')]['group']));}_0x2e9a3b=_0x14a497[_0x031f('0x7c')]();_0x14a497[_0x031f('0x20')](_0xac324f);_0x14a497[_0x031f('0x1d')](0x0);logger[_0x031f('0x7d')](_0x031f('0x7e'),_0x14a497[_0x031f('0x7f')]());return dbH['sequelize']['query'](_0x14a497[_0x031f('0x7f')](),{'type':dbH[_0x031f('0x80')][_0x031f('0x81')][_0x031f('0x82')]});}})[_0x031f('0x25')](function(){return{'sql':_0x2e9a3b[_0x031f('0x7f')]()};})[_0x031f('0x25')](respondWithResult(_0x3ed663,null))['catch'](handleError(_0x3ed663,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 983dccc..6e71cc9 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 _0xa6e6=['moment','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','../../config/logger','api'];(function(_0x2ab048,_0x982e4a){var _0xe7898=function(_0x37abe8){while(--_0x37abe8){_0x2ab048['push'](_0x2ab048['shift']());}};_0xe7898(++_0x982e4a);}(_0xa6e6,0x17a));var _0x6a6e=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0xa6e6[_0x585d81];return _0x1aca0d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6a6e('0x0'))(_0x6a6e('0x1'));var moment=require(_0x6a6e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6a6e('0x3'));var rimraf=require(_0x6a6e('0x4'));var config=require(_0x6a6e('0x5'));var attributes=require(_0x6a6e('0x6'));module[_0x6a6e('0x7')]=function(_0x55cee3,_0x112288){return _0x55cee3['define'](_0x6a6e('0x8'),attributes,{'tableName':_0x6a6e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2897=['rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x5206dd,_0x100a63){var _0x3269bd=function(_0x2f2948){while(--_0x2f2948){_0x5206dd['push'](_0x5206dd['shift']());}};_0x3269bd(++_0x100a63);}(_0x2897,0x1c1));var _0x7289=function(_0x3b22d5,_0x57004e){_0x3b22d5=_0x3b22d5-0x0;var _0x4d9620=_0x2897[_0x3b22d5];return _0x4d9620;};'use strict';var _=require(_0x7289('0x0'));var util=require(_0x7289('0x1'));var logger=require(_0x7289('0x2'))(_0x7289('0x3'));var moment=require('moment');var BPromise=require(_0x7289('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7289('0x5'));var rimraf=require(_0x7289('0x6'));var config=require(_0x7289('0x7'));var attributes=require(_0x7289('0x8'));module[_0x7289('0x9')]=function(_0x102fa6,_0x5c00cb){return _0x102fa6[_0x7289('0xa')](_0x7289('0xb'),attributes,{'tableName':_0x7289('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 4152f06..c204a38 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 _0x67c7=['info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then'];(function(_0x52a68f,_0x517cb5){var _0x59d65c=function(_0x450d82){while(--_0x450d82){_0x52a68f['push'](_0x52a68f['shift']());}};_0x59d65c(++_0x517cb5);}(_0x67c7,0x1d8));var _0x767c=function(_0x37dbbb,_0x1909de){_0x37dbbb=_0x37dbbb-0x0;var _0x10068f=_0x67c7[_0x37dbbb];return _0x10068f;};'use strict';var _=require(_0x767c('0x0'));var util=require(_0x767c('0x1'));var moment=require(_0x767c('0x2'));var BPromise=require(_0x767c('0x3'));var rs=require(_0x767c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x767c('0x5'))['db'];var utils=require(_0x767c('0x6'));var logger=require(_0x767c('0x7'))('rpc');var config=require(_0x767c('0x8'));var jayson=require(_0x767c('0x9'));var client=jayson['client'][_0x767c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdb3b40,_0x573fa3,_0x86025e){return new BPromise(function(_0x3ad571,_0x1b1a49){return client['request'](_0xdb3b40,_0x86025e)[_0x767c('0xb')](function(_0x2cbdf1){logger[_0x767c('0xc')](_0x767c('0xd'),_0x573fa3,_0x767c('0xe'));logger[_0x767c('0xf')](_0x767c('0x10'),_0x573fa3,_0x767c('0xe'),JSON[_0x767c('0x11')](_0x2cbdf1));if(_0x2cbdf1[_0x767c('0x12')]){if(_0x2cbdf1[_0x767c('0x12')]['code']===0x1f4){logger[_0x767c('0x12')](_0x767c('0xd'),_0x573fa3,_0x2cbdf1['error'][_0x767c('0x13')]);return _0x1b1a49(_0x2cbdf1[_0x767c('0x12')][_0x767c('0x13')]);}logger[_0x767c('0x12')](_0x767c('0xd'),_0x573fa3,_0x2cbdf1[_0x767c('0x12')][_0x767c('0x13')]);return _0x3ad571(_0x2cbdf1[_0x767c('0x12')][_0x767c('0x13')]);}else{logger[_0x767c('0xc')](_0x767c('0xd'),_0x573fa3,_0x767c('0xe'));_0x3ad571(_0x2cbdf1[_0x767c('0x14')][_0x767c('0x13')]);}})[_0x767c('0x15')](function(_0x4fe436){logger[_0x767c('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x573fa3,_0x4fe436);_0x1b1a49(_0x4fe436);});});} \ No newline at end of file +var _0x8234=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x9c36e9,_0x5154e6){var _0x5a393f=function(_0x5387cb){while(--_0x5387cb){_0x9c36e9['push'](_0x9c36e9['shift']());}};_0x5a393f(++_0x5154e6);}(_0x8234,0xfb));var _0x4823=function(_0x3b29b7,_0x31831e){_0x3b29b7=_0x3b29b7-0x0;var _0x2b2669=_0x8234[_0x3b29b7];return _0x2b2669;};'use strict';var _=require(_0x4823('0x0'));var util=require(_0x4823('0x1'));var moment=require(_0x4823('0x2'));var BPromise=require(_0x4823('0x3'));var rs=require(_0x4823('0x4'));var fs=require('fs');var Redis=require(_0x4823('0x5'));var db=require(_0x4823('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4823('0x7'))(_0x4823('0x8'));var config=require(_0x4823('0x9'));var jayson=require(_0x4823('0xa'));var client=jayson[_0x4823('0xb')][_0x4823('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x17c455,_0x8cdaa6,_0x1003a2){return new BPromise(function(_0x1c6180,_0x107b64){return client[_0x4823('0xd')](_0x17c455,_0x1003a2)[_0x4823('0xe')](function(_0x54d8d8){logger[_0x4823('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x8cdaa6,_0x4823('0x10'));logger['debug'](_0x4823('0x11'),_0x8cdaa6,_0x4823('0x10'),JSON['stringify'](_0x54d8d8));if(_0x54d8d8[_0x4823('0x12')]){if(_0x54d8d8[_0x4823('0x12')]['code']===0x1f4){logger[_0x4823('0x12')](_0x4823('0x13'),_0x8cdaa6,_0x54d8d8[_0x4823('0x12')][_0x4823('0x14')]);return _0x107b64(_0x54d8d8['error']['message']);}logger[_0x4823('0x12')](_0x4823('0x13'),_0x8cdaa6,_0x54d8d8[_0x4823('0x12')][_0x4823('0x14')]);return _0x1c6180(_0x54d8d8[_0x4823('0x12')][_0x4823('0x14')]);}else{logger[_0x4823('0xf')](_0x4823('0x13'),_0x8cdaa6,_0x4823('0x10'));_0x1c6180(_0x54d8d8[_0x4823('0x15')][_0x4823('0x14')]);}})[_0x4823('0x16')](function(_0x59335a){logger[_0x4823('0x12')](_0x4823('0x13'),_0x8cdaa6,_0x59335a);_0x107b64(_0x59335a);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index eaead47..57e74f8 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 _0xf21a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','preview','/:id/run','run','/:id/query','query','post','delete','exports','multer','util'];(function(_0x555c03,_0x2c7e0b){var _0x2da81a=function(_0x527b52){while(--_0x527b52){_0x555c03['push'](_0x555c03['shift']());}};_0x2da81a(++_0x2c7e0b);}(_0xf21a,0x116));var _0xaf21=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xf21a[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xaf21('0x0'));var util=require(_0xaf21('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaf21('0x2')]();var fs_extra=require(_0xaf21('0x3'));var auth=require(_0xaf21('0x4'));var interaction=require(_0xaf21('0x5'));var config=require(_0xaf21('0x6'));var controller=require('./analyticDefaultReport.controller');router[_0xaf21('0x7')]('/',auth[_0xaf21('0x8')](),controller[_0xaf21('0x9')]);router[_0xaf21('0x7')](_0xaf21('0xa'),auth[_0xaf21('0x8')](),controller[_0xaf21('0xb')]);router[_0xaf21('0x7')]('/:id/preview',auth[_0xaf21('0x8')](),controller[_0xaf21('0xc')]);router[_0xaf21('0x7')](_0xaf21('0xd'),auth[_0xaf21('0x8')](),controller[_0xaf21('0xe')]);router[_0xaf21('0x7')](_0xaf21('0xf'),auth[_0xaf21('0x8')](),controller[_0xaf21('0x10')]);router[_0xaf21('0x11')]('/',auth[_0xaf21('0x8')](),controller['create']);router['put'](_0xaf21('0xa'),auth[_0xaf21('0x8')](),controller['update']);router[_0xaf21('0x12')]('/:id',auth[_0xaf21('0x8')](),controller['destroy']);module[_0xaf21('0x13')]=router; \ No newline at end of file +var _0x4ac9=['show','/:id/preview','preview','/:id/run','run','/:id/query','query','create','put','update','delete','/:id','destroy','util','express','Router','fs-extra','../../components/auth/service','./analyticDefaultReport.controller','get','isAuthenticated','index'];(function(_0x2aeb8f,_0x127e59){var _0x2c255e=function(_0x55bc2b){while(--_0x55bc2b){_0x2aeb8f['push'](_0x2aeb8f['shift']());}};_0x2c255e(++_0x127e59);}(_0x4ac9,0xe9));var _0x94ac=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x4ac9[_0x273c39];return _0x46d6b5;};'use strict';var multer=require('multer');var util=require(_0x94ac('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x94ac('0x1'));var router=express[_0x94ac('0x2')]();var fs_extra=require(_0x94ac('0x3'));var auth=require(_0x94ac('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x94ac('0x5'));router[_0x94ac('0x6')]('/',auth[_0x94ac('0x7')](),controller[_0x94ac('0x8')]);router[_0x94ac('0x6')]('/:id',auth[_0x94ac('0x7')](),controller[_0x94ac('0x9')]);router['get'](_0x94ac('0xa'),auth[_0x94ac('0x7')](),controller[_0x94ac('0xb')]);router[_0x94ac('0x6')](_0x94ac('0xc'),auth[_0x94ac('0x7')](),controller[_0x94ac('0xd')]);router[_0x94ac('0x6')](_0x94ac('0xe'),auth[_0x94ac('0x7')](),controller[_0x94ac('0xf')]);router['post']('/',auth[_0x94ac('0x7')](),controller[_0x94ac('0x10')]);router[_0x94ac('0x11')]('/:id',auth[_0x94ac('0x7')](),controller[_0x94ac('0x12')]);router[_0x94ac('0x13')](_0x94ac('0x14'),auth[_0x94ac('0x7')](),controller[_0x94ac('0x15')]);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 a0b9c3e..1655a67 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 _0x6ef1=['csv','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM'];(function(_0x197796,_0x3654b4){var _0x217dc0=function(_0x149864){while(--_0x149864){_0x197796['push'](_0x197796['shift']());}};_0x217dc0(++_0x3654b4);}(_0x6ef1,0x19f));var _0x16ef=function(_0x2bfb09,_0x22677b){_0x2bfb09=_0x2bfb09-0x0;var _0x634bb=_0x6ef1[_0x2bfb09];return _0x634bb;};'use strict';var Sequelize=require(_0x16ef('0x0'));var moment=require(_0x16ef('0x1'));module[_0x16ef('0x2')]={'name':{'type':Sequelize[_0x16ef('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x16ef('0x4')](_0x16ef('0x5'),'pdf','xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x16ef('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x16ef('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x16ef('0x7')},'type':{'type':Sequelize['ENUM'](_0x16ef('0x8'),_0x16ef('0x9')),'allowNull':![],'defaultValue':_0x16ef('0x8')},'reportId':{'type':Sequelize[_0x16ef('0xa')](0xb)[_0x16ef('0xb')]},'reportType':{'type':Sequelize[_0x16ef('0x3')]}}; \ No newline at end of file +var _0xaaf6=['STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','scheduled','UNSIGNED','moment'];(function(_0xd6dd72,_0x495753){var _0xa712a2=function(_0x43f66f){while(--_0x43f66f){_0xd6dd72['push'](_0xd6dd72['shift']());}};_0xa712a2(++_0x495753);}(_0xaaf6,0x128));var _0x6aaf=function(_0x53b6f0,_0x134603){_0x53b6f0=_0x53b6f0-0x0;var _0xcbc09d=_0xaaf6[_0x53b6f0];return _0xcbc09d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6aaf('0x0'));module['exports']={'name':{'type':Sequelize[_0x6aaf('0x1')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x6aaf('0x2')](_0x6aaf('0x3'),_0x6aaf('0x4'),_0x6aaf('0x5')),'allowNull':![],'defaultValue':_0x6aaf('0x3')},'savename':{'type':Sequelize[_0x6aaf('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x6aaf('0x6')]},'endDate':{'type':Sequelize[_0x6aaf('0x6')]},'status':{'type':Sequelize[_0x6aaf('0x1')],'defaultValue':_0x6aaf('0x7')},'type':{'type':Sequelize[_0x6aaf('0x2')](_0x6aaf('0x8'),_0x6aaf('0x9')),'allowNull':![],'defaultValue':_0x6aaf('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x6aaf('0xa')]},'reportType':{'type':Sequelize[_0x6aaf('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 9a0e9bd..845c40e 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 _0xd9c5=['output','existsSync','join','root','exists','server/files/reports','format','%s.%s','toLowerCase','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','get','ExtractedReports','UserProfileResource','destroy','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','body','basename','savename'];(function(_0x2ad9cf,_0x285deb){var _0x1ab3d5=function(_0x43bba8){while(--_0x43bba8){_0x2ad9cf['push'](_0x2ad9cf['shift']());}};_0x1ab3d5(++_0x285deb);}(_0xd9c5,0x181));var _0x5d9c=function(_0x42b27b,_0x2d4e16){_0x42b27b=_0x42b27b-0x0;var _0x43ce39=_0xd9c5[_0x42b27b];return _0x43ce39;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5d9c('0x0'));var zipdir=require(_0x5d9c('0x1'));var jsonpatch=require(_0x5d9c('0x2'));var rp=require(_0x5d9c('0x3'));var moment=require(_0x5d9c('0x4'));var BPromise=require(_0x5d9c('0x5'));var Mustache=require(_0x5d9c('0x6'));var util=require(_0x5d9c('0x7'));var path=require(_0x5d9c('0x8'));var sox=require(_0x5d9c('0x9'));var csv=require(_0x5d9c('0xa'));var ejs=require(_0x5d9c('0xb'));var fs=require('fs');var fs_extra=require(_0x5d9c('0xc'));var _=require(_0x5d9c('0xd'));var squel=require('squel');var crypto=require(_0x5d9c('0xe'));var jsforce=require(_0x5d9c('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5d9c('0x10'));var Redis=require('ioredis');var authService=require(_0x5d9c('0x11'));var qs=require(_0x5d9c('0x12'));var as=require(_0x5d9c('0x13'));var hardwareService=require(_0x5d9c('0x14'));var logger=require(_0x5d9c('0x15'))(_0x5d9c('0x16'));var utils=require(_0x5d9c('0x17'));var config=require(_0x5d9c('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20662f,_0x1097cd){_0x1097cd=_0x1097cd||0xcc;return function(_0xdcf58b){if(_0xdcf58b){return _0x20662f[_0x5d9c('0x19')](_0x1097cd);}return _0x20662f[_0x5d9c('0x1a')](_0x1097cd)[_0x5d9c('0x1b')]();};}function respondWithResult(_0x19f50c,_0x32c784){_0x32c784=_0x32c784||0xc8;return function(_0x4fac90){if(_0x4fac90){return _0x19f50c[_0x5d9c('0x1a')](_0x32c784)[_0x5d9c('0x1c')](_0x4fac90);}};}function respondWithFilteredResult(_0x1a69e3,_0x5e4490){return function(_0x39e992){if(_0x39e992){var _0x2faf43=typeof _0x5e4490[_0x5d9c('0x1d')]===_0x5d9c('0x1e')&&typeof _0x5e4490['limit']===_0x5d9c('0x1e');var _0xa2176a=_0x39e992['count'];var _0xd96854=_0x2faf43?0x0:_0x5e4490['offset'];var _0xf64aa9=_0x2faf43?_0x39e992[_0x5d9c('0x1f')]:_0x5e4490[_0x5d9c('0x1d')]+_0x5e4490[_0x5d9c('0x20')];var _0x3f7c45;if(_0xf64aa9>=_0xa2176a){_0xf64aa9=_0xa2176a;_0x3f7c45=0xc8;}else{_0x3f7c45=0xce;}_0x1a69e3[_0x5d9c('0x1a')](_0x3f7c45);return _0x1a69e3['set'](_0x5d9c('0x21'),_0xd96854+'-'+_0xf64aa9+'/'+_0xa2176a)[_0x5d9c('0x1c')](_0x39e992);}return null;};}function patchUpdates(_0x355414){return function(_0x2d22cc){try{jsonpatch[_0x5d9c('0x22')](_0x2d22cc,_0x355414,!![]);}catch(_0x316a7f){return BPromise[_0x5d9c('0x23')](_0x316a7f);}return _0x2d22cc[_0x5d9c('0x24')]();};}function saveUpdates(_0x282f34,_0x4b730a){return function(_0x485578){if(_0x485578){return _0x485578['update'](_0x282f34)['then'](function(_0x276558){return _0x276558;});}return null;};}function removeEntity(_0x3b7036,_0x29901b){return function(_0x369b1c){if(_0x369b1c){return _0x369b1c['destroy']()[_0x5d9c('0x25')](function(){var _0x2dc606=_0x369b1c[_0x5d9c('0x26')]({'plain':!![]});var _0x583787=_0x5d9c('0x27');return db[_0x5d9c('0x28')][_0x5d9c('0x29')]({'where':{'type':_0x583787,'resourceId':_0x2dc606['id']}})[_0x5d9c('0x25')](function(){return _0x369b1c;});})['then'](function(){_0x3b7036[_0x5d9c('0x1a')](0xcc)[_0x5d9c('0x1b')]();});}};}function handleEntityNotFound(_0x367385,_0x3ca696){return function(_0x304c72){if(!_0x304c72){_0x367385[_0x5d9c('0x19')](0x194);}return _0x304c72;};}function handleError(_0x5f7c07,_0xceda1f){_0xceda1f=_0xceda1f||0x1f4;return function(_0x2bed87){logger[_0x5d9c('0x2a')](_0x2bed87[_0x5d9c('0x2b')]);if(_0x2bed87['name']){delete _0x2bed87[_0x5d9c('0x2c')];}_0x5f7c07[_0x5d9c('0x1a')](_0xceda1f)['send'](_0x2bed87);};}exports[_0x5d9c('0x2d')]=function(_0x114290,_0x4ada52){var _0x14a1f6={},_0x30ff0c={},_0x47980f={'count':0x0,'rows':[]};var _0x3ca206=_[_0x5d9c('0x2e')](db[_0x5d9c('0x2f')][_0x5d9c('0x30')],function(_0x3fd8d5){return{'name':_0x3fd8d5[_0x5d9c('0x31')],'type':_0x3fd8d5[_0x5d9c('0x32')]['key']};});_0x30ff0c[_0x5d9c('0x33')]=_[_0x5d9c('0x2e')](_0x3ca206,_0x5d9c('0x2c'));_0x30ff0c['query']=_[_0x5d9c('0x34')](_0x114290[_0x5d9c('0x35')]);_0x30ff0c[_0x5d9c('0x36')]=_[_0x5d9c('0x37')](_0x30ff0c[_0x5d9c('0x33')],_0x30ff0c[_0x5d9c('0x35')]);_0x14a1f6[_0x5d9c('0x38')]=_['intersection'](_0x30ff0c[_0x5d9c('0x33')],qs[_0x5d9c('0x39')](_0x114290[_0x5d9c('0x35')][_0x5d9c('0x39')]));_0x14a1f6[_0x5d9c('0x38')]=_0x14a1f6[_0x5d9c('0x38')][_0x5d9c('0x3a')]?_0x14a1f6[_0x5d9c('0x38')]:_0x30ff0c[_0x5d9c('0x33')];if(!_0x114290[_0x5d9c('0x35')][_0x5d9c('0x3b')](_0x5d9c('0x3c'))){_0x14a1f6[_0x5d9c('0x20')]=qs[_0x5d9c('0x20')](_0x114290[_0x5d9c('0x35')][_0x5d9c('0x20')]);_0x14a1f6[_0x5d9c('0x1d')]=qs['offset'](_0x114290['query'][_0x5d9c('0x1d')]);}_0x14a1f6['order']=qs[_0x5d9c('0x3d')](_0x114290['query'][_0x5d9c('0x3d')]);_0x14a1f6[_0x5d9c('0x3e')]=qs[_0x5d9c('0x36')](_[_0x5d9c('0x3f')](_0x114290[_0x5d9c('0x35')],_0x30ff0c['filters']),_0x3ca206);if(_0x114290[_0x5d9c('0x35')][_0x5d9c('0x40')]){_0x14a1f6[_0x5d9c('0x3e')]=_['merge'](_0x14a1f6[_0x5d9c('0x3e')],{'$or':_[_0x5d9c('0x2e')](_0x3ca206,function(_0xbba1f){if(_0xbba1f[_0x5d9c('0x32')]!==_0x5d9c('0x41')){var _0x56e9d2={};_0x56e9d2[_0xbba1f[_0x5d9c('0x2c')]]={'$like':'%'+_0x114290[_0x5d9c('0x35')]['filter']+'%'};return _0x56e9d2;}})});}_0x14a1f6=_['merge']({},_0x14a1f6,_0x114290['options']);var _0x57d96e={'where':_0x14a1f6['where']};return db[_0x5d9c('0x2f')]['count'](_0x57d96e)[_0x5d9c('0x25')](function(_0xbb4ae4){_0x47980f[_0x5d9c('0x1f')]=_0xbb4ae4;if(_0x114290[_0x5d9c('0x35')][_0x5d9c('0x42')]){_0x14a1f6['include']=[{'all':!![]}];}return db[_0x5d9c('0x2f')][_0x5d9c('0x43')](_0x14a1f6);})[_0x5d9c('0x25')](function(_0x277557){_0x47980f[_0x5d9c('0x44')]=_0x277557;return _0x47980f;})['then'](respondWithFilteredResult(_0x4ada52,_0x14a1f6))[_0x5d9c('0x45')](handleError(_0x4ada52,null));};exports[_0x5d9c('0x46')]=function(_0x5461d0,_0xc9492c){var _0xc42554={'raw':!![],'where':{'id':_0x5461d0[_0x5d9c('0x47')]['id']}},_0x2e2291={};_0x2e2291[_0x5d9c('0x33')]=_['keys'](db[_0x5d9c('0x2f')][_0x5d9c('0x30')]);_0x2e2291[_0x5d9c('0x35')]=_[_0x5d9c('0x34')](_0x5461d0['query']);_0x2e2291['filters']=_[_0x5d9c('0x37')](_0x2e2291['model'],_0x2e2291['query']);_0xc42554[_0x5d9c('0x38')]=_[_0x5d9c('0x37')](_0x2e2291[_0x5d9c('0x33')],qs['fields'](_0x5461d0[_0x5d9c('0x35')][_0x5d9c('0x39')]));_0xc42554[_0x5d9c('0x38')]=_0xc42554['attributes'][_0x5d9c('0x3a')]?_0xc42554[_0x5d9c('0x38')]:_0x2e2291[_0x5d9c('0x33')];if(_0x5461d0[_0x5d9c('0x35')][_0x5d9c('0x42')]){_0xc42554[_0x5d9c('0x48')]=[{'all':!![]}];}_0xc42554=_['merge']({},_0xc42554,_0x5461d0[_0x5d9c('0x49')]);return db[_0x5d9c('0x2f')]['find'](_0xc42554)[_0x5d9c('0x25')](handleEntityNotFound(_0xc9492c,null))[_0x5d9c('0x25')](respondWithResult(_0xc9492c,null))[_0x5d9c('0x45')](handleError(_0xc9492c,null));};exports['create']=function(_0x21dc86,_0x5c1e2b){return db[_0x5d9c('0x2f')][_0x5d9c('0x4a')](_0x21dc86['body'],{})[_0x5d9c('0x25')](function(_0x2e1c88){var _0x51ec17=_0x21dc86[_0x5d9c('0x4b')][_0x5d9c('0x26')]({'plain':!![]});if(!_0x51ec17)throw new Error(_0x5d9c('0x4c'));if(_0x51ec17[_0x5d9c('0x4d')]===_0x5d9c('0x4b')){var _0x47dad4=_0x2e1c88[_0x5d9c('0x26')]({'plain':!![]});var _0x1fc18b=_0x5d9c('0x27');return db[_0x5d9c('0x4e')][_0x5d9c('0x4f')]({'where':{'name':_0x1fc18b,'userProfileId':_0x51ec17[_0x5d9c('0x50')]},'raw':!![]})[_0x5d9c('0x25')](function(_0x18158f){if(_0x18158f&&_0x18158f[_0x5d9c('0x51')]===0x0){return db[_0x5d9c('0x28')][_0x5d9c('0x4a')]({'name':_0x47dad4['name'],'resourceId':_0x47dad4['id'],'type':_0x18158f[_0x5d9c('0x2c')],'sectionId':_0x18158f['id']},{})['then'](function(){return _0x2e1c88;});}else{return _0x2e1c88;}})[_0x5d9c('0x45')](function(_0x5c13e0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c13e0);throw _0x5c13e0;});}return _0x2e1c88;})['then'](respondWithResult(_0x5c1e2b,0xc9))[_0x5d9c('0x45')](handleError(_0x5c1e2b,null));};exports['update']=function(_0x4a7541,_0x5517a7){if(_0x4a7541[_0x5d9c('0x52')]['id']){delete _0x4a7541['body']['id'];}return db['AnalyticExtractedReport'][_0x5d9c('0x4f')]({'where':{'id':_0x4a7541[_0x5d9c('0x47')]['id']}})[_0x5d9c('0x25')](handleEntityNotFound(_0x5517a7,null))['then'](saveUpdates(_0x4a7541[_0x5d9c('0x52')],null))[_0x5d9c('0x25')](respondWithResult(_0x5517a7,null))[_0x5d9c('0x45')](handleError(_0x5517a7,null));};exports[_0x5d9c('0x29')]=function(_0x5dc4fa,_0x5cd3c7){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x5dc4fa['params']['id']}})[_0x5d9c('0x25')](handleEntityNotFound(_0x5cd3c7,null))[_0x5d9c('0x25')](removeEntity(_0x5cd3c7,null))[_0x5d9c('0x45')](handleError(_0x5cd3c7,null));};exports['download']=function(_0x167fcb,_0x1d4898,_0x300e52){return db[_0x5d9c('0x2f')][_0x5d9c('0x4f')]({'where':{'id':_0x167fcb[_0x5d9c('0x47')]['id']},'attributes':[_0x5d9c('0x2c'),_0x5d9c('0x53'),_0x5d9c('0x54'),_0x5d9c('0x55')],'raw':!![]})[_0x5d9c('0x25')](handleEntityNotFound(_0x1d4898,null))[_0x5d9c('0x25')](function(_0xd5027c){if(_0xd5027c){if(!fs[_0x5d9c('0x56')](path[_0x5d9c('0x57')](config[_0x5d9c('0x58')],'server/files/reports',_0xd5027c[_0x5d9c('0x54')]))){throw new db['Sequelize']['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x167fcb[_0x5d9c('0x35')][_0x5d9c('0x59')]){return _0x1d4898[_0x5d9c('0x19')](0xc8);}return _0x1d4898['download'](path['join'](config[_0x5d9c('0x58')],_0x5d9c('0x5a'),_0xd5027c[_0x5d9c('0x54')]),util[_0x5d9c('0x5b')](_0x5d9c('0x5c'),_0xd5027c['basename']||_0xd5027c['name'],_0xd5027c['output'][_0x5d9c('0x5d')]()));}})[_0x5d9c('0x45')](handleError(_0x1d4898,null));}; \ No newline at end of file +var _0x86ea=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','sendStatus','error','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','AnalyticExtractedReport','findAll','rows','catch','show','params','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','download','basename','output','join','root','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis'];(function(_0x30570d,_0x5c2202){var _0x4feb88=function(_0x28d335){while(--_0x28d335){_0x30570d['push'](_0x30570d['shift']());}};_0x4feb88(++_0x5c2202);}(_0x86ea,0x16b));var _0xa86e=function(_0xd031fb,_0x33009d){_0xd031fb=_0xd031fb-0x0;var _0x5c513f=_0x86ea[_0xd031fb];return _0x5c513f;};'use strict';var emlformat=require(_0xa86e('0x0'));var rimraf=require(_0xa86e('0x1'));var zipdir=require(_0xa86e('0x2'));var jsonpatch=require(_0xa86e('0x3'));var rp=require('request-promise');var moment=require(_0xa86e('0x4'));var BPromise=require(_0xa86e('0x5'));var Mustache=require(_0xa86e('0x6'));var util=require(_0xa86e('0x7'));var path=require(_0xa86e('0x8'));var sox=require(_0xa86e('0x9'));var csv=require('to-csv');var ejs=require(_0xa86e('0xa'));var fs=require('fs');var fs_extra=require(_0xa86e('0xb'));var _=require(_0xa86e('0xc'));var squel=require('squel');var crypto=require(_0xa86e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa86e('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa86e('0xf'));var Redis=require(_0xa86e('0x10'));var authService=require(_0xa86e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa86e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa86e('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd7f557,_0x2bc30d){_0x2bc30d=_0x2bc30d||0xcc;return function(_0x85b3c){if(_0x85b3c){return _0xd7f557['sendStatus'](_0x2bc30d);}return _0xd7f557[_0xa86e('0x14')](_0x2bc30d)[_0xa86e('0x15')]();};}function respondWithResult(_0x51c791,_0x13065e){_0x13065e=_0x13065e||0xc8;return function(_0x5718d7){if(_0x5718d7){return _0x51c791[_0xa86e('0x14')](_0x13065e)[_0xa86e('0x16')](_0x5718d7);}};}function respondWithFilteredResult(_0x2ad980,_0x17b34e){return function(_0x56ef4b){if(_0x56ef4b){var _0x4790f1=typeof _0x17b34e[_0xa86e('0x17')]==='undefined'&&typeof _0x17b34e[_0xa86e('0x18')]===_0xa86e('0x19');var _0x279a04=_0x56ef4b['count'];var _0xc73d87=_0x4790f1?0x0:_0x17b34e[_0xa86e('0x17')];var _0x3a9931=_0x4790f1?_0x56ef4b['count']:_0x17b34e[_0xa86e('0x17')]+_0x17b34e[_0xa86e('0x18')];var _0x2c3856;if(_0x3a9931>=_0x279a04){_0x3a9931=_0x279a04;_0x2c3856=0xc8;}else{_0x2c3856=0xce;}_0x2ad980['status'](_0x2c3856);return _0x2ad980[_0xa86e('0x1a')](_0xa86e('0x1b'),_0xc73d87+'-'+_0x3a9931+'/'+_0x279a04)[_0xa86e('0x16')](_0x56ef4b);}return null;};}function patchUpdates(_0x2679fc){return function(_0x518e1a){try{jsonpatch[_0xa86e('0x1c')](_0x518e1a,_0x2679fc,!![]);}catch(_0x36e425){return BPromise[_0xa86e('0x1d')](_0x36e425);}return _0x518e1a[_0xa86e('0x1e')]();};}function saveUpdates(_0x244b83,_0x9fa30c){return function(_0x1df386){if(_0x1df386){return _0x1df386['update'](_0x244b83)[_0xa86e('0x1f')](function(_0x93850f){return _0x93850f;});}return null;};}function removeEntity(_0x1bef3c,_0x58392c){return function(_0x1f9902){if(_0x1f9902){return _0x1f9902['destroy']()['then'](function(){var _0xc82683=_0x1f9902[_0xa86e('0x20')]({'plain':!![]});var _0x56c2e9='ExtractedReports';return db[_0xa86e('0x21')][_0xa86e('0x22')]({'where':{'type':_0x56c2e9,'resourceId':_0xc82683['id']}})['then'](function(){return _0x1f9902;});})[_0xa86e('0x1f')](function(){_0x1bef3c[_0xa86e('0x14')](0xcc)[_0xa86e('0x15')]();});}};}function handleEntityNotFound(_0x5d812a,_0x274250){return function(_0x134dce){if(!_0x134dce){_0x5d812a[_0xa86e('0x23')](0x194);}return _0x134dce;};}function handleError(_0x26fd7b,_0xc33c3f){_0xc33c3f=_0xc33c3f||0x1f4;return function(_0x2ead7f){logger[_0xa86e('0x24')](_0x2ead7f['stack']);if(_0x2ead7f[_0xa86e('0x25')]){delete _0x2ead7f[_0xa86e('0x25')];}_0x26fd7b[_0xa86e('0x14')](_0xc33c3f)[_0xa86e('0x26')](_0x2ead7f);};}exports[_0xa86e('0x27')]=function(_0x1b613c,_0x2bff49){var _0x123c8e={},_0x539dec={},_0x1e7af2={'count':0x0,'rows':[]};var _0x38c601=_['map'](db['AnalyticExtractedReport'][_0xa86e('0x28')],function(_0xda05e5){return{'name':_0xda05e5[_0xa86e('0x29')],'type':_0xda05e5['type'][_0xa86e('0x2a')]};});_0x539dec[_0xa86e('0x2b')]=_[_0xa86e('0x2c')](_0x38c601,_0xa86e('0x25'));_0x539dec[_0xa86e('0x2d')]=_[_0xa86e('0x2e')](_0x1b613c[_0xa86e('0x2d')]);_0x539dec[_0xa86e('0x2f')]=_[_0xa86e('0x30')](_0x539dec[_0xa86e('0x2b')],_0x539dec[_0xa86e('0x2d')]);_0x123c8e[_0xa86e('0x31')]=_['intersection'](_0x539dec[_0xa86e('0x2b')],qs[_0xa86e('0x32')](_0x1b613c[_0xa86e('0x2d')][_0xa86e('0x32')]));_0x123c8e[_0xa86e('0x31')]=_0x123c8e[_0xa86e('0x31')][_0xa86e('0x33')]?_0x123c8e[_0xa86e('0x31')]:_0x539dec['model'];if(!_0x1b613c[_0xa86e('0x2d')]['hasOwnProperty'](_0xa86e('0x34'))){_0x123c8e[_0xa86e('0x18')]=qs[_0xa86e('0x18')](_0x1b613c['query']['limit']);_0x123c8e[_0xa86e('0x17')]=qs[_0xa86e('0x17')](_0x1b613c[_0xa86e('0x2d')][_0xa86e('0x17')]);}_0x123c8e[_0xa86e('0x35')]=qs[_0xa86e('0x36')](_0x1b613c[_0xa86e('0x2d')]['sort']);_0x123c8e[_0xa86e('0x37')]=qs[_0xa86e('0x2f')](_[_0xa86e('0x38')](_0x1b613c['query'],_0x539dec[_0xa86e('0x2f')]),_0x38c601);if(_0x1b613c[_0xa86e('0x2d')][_0xa86e('0x39')]){_0x123c8e[_0xa86e('0x37')]=_[_0xa86e('0x3a')](_0x123c8e['where'],{'$or':_[_0xa86e('0x2c')](_0x38c601,function(_0x5cc7a9){if(_0x5cc7a9['type']!==_0xa86e('0x3b')){var _0x5196b0={};_0x5196b0[_0x5cc7a9[_0xa86e('0x25')]]={'$like':'%'+_0x1b613c['query'][_0xa86e('0x39')]+'%'};return _0x5196b0;}})});}_0x123c8e=_[_0xa86e('0x3a')]({},_0x123c8e,_0x1b613c[_0xa86e('0x3c')]);var _0x3d5e7e={'where':_0x123c8e[_0xa86e('0x37')]};return db['AnalyticExtractedReport'][_0xa86e('0x3d')](_0x3d5e7e)['then'](function(_0x433e8f){_0x1e7af2[_0xa86e('0x3d')]=_0x433e8f;if(_0x1b613c[_0xa86e('0x2d')]['includeAll']){_0x123c8e[_0xa86e('0x3e')]=[{'all':!![]}];}return db[_0xa86e('0x3f')][_0xa86e('0x40')](_0x123c8e);})[_0xa86e('0x1f')](function(_0x1c3bde){_0x1e7af2[_0xa86e('0x41')]=_0x1c3bde;return _0x1e7af2;})[_0xa86e('0x1f')](respondWithFilteredResult(_0x2bff49,_0x123c8e))[_0xa86e('0x42')](handleError(_0x2bff49,null));};exports[_0xa86e('0x43')]=function(_0x149633,_0x3aba37){var _0x7c51da={'raw':!![],'where':{'id':_0x149633[_0xa86e('0x44')]['id']}},_0x4fef0f={};_0x4fef0f[_0xa86e('0x2b')]=_[_0xa86e('0x2e')](db['AnalyticExtractedReport'][_0xa86e('0x28')]);_0x4fef0f[_0xa86e('0x2d')]=_['keys'](_0x149633[_0xa86e('0x2d')]);_0x4fef0f[_0xa86e('0x2f')]=_[_0xa86e('0x30')](_0x4fef0f[_0xa86e('0x2b')],_0x4fef0f[_0xa86e('0x2d')]);_0x7c51da[_0xa86e('0x31')]=_['intersection'](_0x4fef0f['model'],qs[_0xa86e('0x32')](_0x149633[_0xa86e('0x2d')][_0xa86e('0x32')]));_0x7c51da[_0xa86e('0x31')]=_0x7c51da[_0xa86e('0x31')][_0xa86e('0x33')]?_0x7c51da['attributes']:_0x4fef0f[_0xa86e('0x2b')];if(_0x149633[_0xa86e('0x2d')][_0xa86e('0x45')]){_0x7c51da[_0xa86e('0x3e')]=[{'all':!![]}];}_0x7c51da=_[_0xa86e('0x3a')]({},_0x7c51da,_0x149633[_0xa86e('0x3c')]);return db['AnalyticExtractedReport'][_0xa86e('0x46')](_0x7c51da)[_0xa86e('0x1f')](handleEntityNotFound(_0x3aba37,null))[_0xa86e('0x1f')](respondWithResult(_0x3aba37,null))[_0xa86e('0x42')](handleError(_0x3aba37,null));};exports[_0xa86e('0x47')]=function(_0x5421c6,_0x3729d6){return db[_0xa86e('0x3f')]['create'](_0x5421c6['body'],{})['then'](function(_0x359d89){var _0x3aaafa=_0x5421c6['user'][_0xa86e('0x20')]({'plain':!![]});if(!_0x3aaafa)throw new Error(_0xa86e('0x48'));if(_0x3aaafa[_0xa86e('0x49')]===_0xa86e('0x4a')){var _0x396403=_0x359d89[_0xa86e('0x20')]({'plain':!![]});var _0xb28e1a=_0xa86e('0x4b');return db[_0xa86e('0x4c')]['find']({'where':{'name':_0xb28e1a,'userProfileId':_0x3aaafa[_0xa86e('0x4d')]},'raw':!![]})[_0xa86e('0x1f')](function(_0x58f871){if(_0x58f871&&_0x58f871[_0xa86e('0x4e')]===0x0){return db[_0xa86e('0x21')][_0xa86e('0x47')]({'name':_0x396403[_0xa86e('0x25')],'resourceId':_0x396403['id'],'type':_0x58f871['name'],'sectionId':_0x58f871['id']},{})[_0xa86e('0x1f')](function(){return _0x359d89;});}else{return _0x359d89;}})['catch'](function(_0xf7b460){logger[_0xa86e('0x24')](_0xa86e('0x4f'),_0xf7b460);throw _0xf7b460;});}return _0x359d89;})['then'](respondWithResult(_0x3729d6,0xc9))['catch'](handleError(_0x3729d6,null));};exports[_0xa86e('0x50')]=function(_0x36dad7,_0x1b0b6c){if(_0x36dad7[_0xa86e('0x51')]['id']){delete _0x36dad7[_0xa86e('0x51')]['id'];}return db['AnalyticExtractedReport'][_0xa86e('0x46')]({'where':{'id':_0x36dad7[_0xa86e('0x44')]['id']}})[_0xa86e('0x1f')](handleEntityNotFound(_0x1b0b6c,null))[_0xa86e('0x1f')](saveUpdates(_0x36dad7[_0xa86e('0x51')],null))[_0xa86e('0x1f')](respondWithResult(_0x1b0b6c,null))[_0xa86e('0x42')](handleError(_0x1b0b6c,null));};exports[_0xa86e('0x22')]=function(_0x25351e,_0x143856){return db[_0xa86e('0x3f')][_0xa86e('0x46')]({'where':{'id':_0x25351e['params']['id']}})[_0xa86e('0x1f')](handleEntityNotFound(_0x143856,null))[_0xa86e('0x1f')](removeEntity(_0x143856,null))[_0xa86e('0x42')](handleError(_0x143856,null));};exports[_0xa86e('0x52')]=function(_0x42c27e,_0x5e5580,_0x38c9c8){return db[_0xa86e('0x3f')][_0xa86e('0x46')]({'where':{'id':_0x42c27e[_0xa86e('0x44')]['id']},'attributes':[_0xa86e('0x25'),_0xa86e('0x53'),'savename',_0xa86e('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x5e5580,null))[_0xa86e('0x1f')](function(_0x425e3d){if(_0x425e3d){if(!fs['existsSync'](path[_0xa86e('0x55')](config[_0xa86e('0x56')],_0xa86e('0x57'),_0x425e3d[_0xa86e('0x58')]))){throw new db[(_0xa86e('0x59'))][(_0xa86e('0x5a'))](_0xa86e('0x5b'));}if(_0x42c27e[_0xa86e('0x2d')][_0xa86e('0x5c')]){return _0x5e5580[_0xa86e('0x23')](0xc8);}return _0x5e5580[_0xa86e('0x52')](path[_0xa86e('0x55')](config[_0xa86e('0x56')],_0xa86e('0x57'),_0x425e3d[_0xa86e('0x58')]),util['format'](_0xa86e('0x5d'),_0x425e3d['basename']||_0x425e3d[_0xa86e('0x25')],_0x425e3d[_0xa86e('0x54')][_0xa86e('0x5e')]()));}})['catch'](handleError(_0x5e5580,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 2e2dfa7..7f69711 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 _0x03c6=['analytics_extracted_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','define','AnalyticExtractedReport'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x03c6,0x141));var _0x603c=function(_0xe6e2b7,_0x326653){_0xe6e2b7=_0xe6e2b7-0x0;var _0x267b79=_0x03c6[_0xe6e2b7];return _0x267b79;};'use strict';var _=require(_0x603c('0x0'));var util=require(_0x603c('0x1'));var logger=require(_0x603c('0x2'))('api');var moment=require(_0x603c('0x3'));var BPromise=require(_0x603c('0x4'));var rp=require(_0x603c('0x5'));var fs=require('fs');var path=require(_0x603c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x15b3f0,_0x24c883){return _0x15b3f0[_0x603c('0x7')](_0x603c('0x8'),attributes,{'tableName':_0x603c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x179a=['api','moment','request-promise','path','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','lodash','util','../../config/logger'];(function(_0x3c789f,_0x9dacd1){var _0x3e8568=function(_0x456552){while(--_0x456552){_0x3c789f['push'](_0x3c789f['shift']());}};_0x3e8568(++_0x9dacd1);}(_0x179a,0x1a1));var _0xa179=function(_0x403f5f,_0x283f67){_0x403f5f=_0x403f5f-0x0;var _0x15b1cd=_0x179a[_0x403f5f];return _0x15b1cd;};'use strict';var _=require(_0xa179('0x0'));var util=require(_0xa179('0x1'));var logger=require(_0xa179('0x2'))(_0xa179('0x3'));var moment=require(_0xa179('0x4'));var BPromise=require('bluebird');var rp=require(_0xa179('0x5'));var fs=require('fs');var path=require(_0xa179('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa179('0x7'));module[_0xa179('0x8')]=function(_0xccaaac,_0x2ccec6){return _0xccaaac['define'](_0xa179('0x9'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 9bba010..533bc7a 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 _0x081c=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message'];(function(_0x420d8d,_0x78b67f){var _0x4865d7=function(_0x2965df){while(--_0x2965df){_0x420d8d['push'](_0x420d8d['shift']());}};_0x4865d7(++_0x78b67f);}(_0x081c,0x16a));var _0xc081=function(_0x356307,_0xe0a012){_0x356307=_0x356307-0x0;var _0x59e722=_0x081c[_0x356307];return _0x59e722;};'use strict';var _=require(_0xc081('0x0'));var util=require('util');var moment=require(_0xc081('0x1'));var BPromise=require(_0xc081('0x2'));var rs=require(_0xc081('0x3'));var fs=require('fs');var Redis=require(_0xc081('0x4'));var db=require(_0xc081('0x5'))['db'];var utils=require(_0xc081('0x6'));var logger=require(_0xc081('0x7'))(_0xc081('0x8'));var config=require(_0xc081('0x9'));var jayson=require(_0xc081('0xa'));var client=jayson['client'][_0xc081('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58a8fa,_0x3161f3,_0x4b539d){return new BPromise(function(_0x51b7a1,_0x2855fe){return client[_0xc081('0xc')](_0x58a8fa,_0x4b539d)[_0xc081('0xd')](function(_0x295a89){logger[_0xc081('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3161f3,_0xc081('0xf'));logger[_0xc081('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x3161f3,_0xc081('0xf'),JSON[_0xc081('0x11')](_0x295a89));if(_0x295a89[_0xc081('0x12')]){if(_0x295a89[_0xc081('0x12')][_0xc081('0x13')]===0x1f4){logger['error'](_0xc081('0x14'),_0x3161f3,_0x295a89['error'][_0xc081('0x15')]);return _0x2855fe(_0x295a89[_0xc081('0x12')]['message']);}logger[_0xc081('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3161f3,_0x295a89['error'][_0xc081('0x15')]);return _0x51b7a1(_0x295a89[_0xc081('0x12')]['message']);}else{logger[_0xc081('0xe')](_0xc081('0x14'),_0x3161f3,_0xc081('0xf'));_0x51b7a1(_0x295a89[_0xc081('0x16')][_0xc081('0x15')]);}})[_0xc081('0x17')](function(_0x5116ed){logger['error'](_0xc081('0x14'),_0x3161f3,_0x5116ed);_0x2855fe(_0x5116ed);});});} \ No newline at end of file +var _0x79cc=['http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x3632ae,_0x54fb49){var _0x3c0124=function(_0x5ba362){while(--_0x5ba362){_0x3632ae['push'](_0x3632ae['shift']());}};_0x3c0124(++_0x54fb49);}(_0x79cc,0x19a));var _0xc79c=function(_0x5c1850,_0x48bf66){_0x5c1850=_0x5c1850-0x0;var _0x236435=_0x79cc[_0x5c1850];return _0x236435;};'use strict';var _=require(_0xc79c('0x0'));var util=require(_0xc79c('0x1'));var moment=require('moment');var BPromise=require(_0xc79c('0x2'));var rs=require(_0xc79c('0x3'));var fs=require('fs');var Redis=require(_0xc79c('0x4'));var db=require(_0xc79c('0x5'))['db'];var utils=require(_0xc79c('0x6'));var logger=require(_0xc79c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc79c('0x8'));var client=jayson[_0xc79c('0x9')][_0xc79c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x326e60,_0x55a927,_0x7e12b8){return new BPromise(function(_0x23b14c,_0x3de5ff){return client[_0xc79c('0xb')](_0x326e60,_0x7e12b8)[_0xc79c('0xc')](function(_0x1c955a){logger[_0xc79c('0xd')](_0xc79c('0xe'),_0x55a927,_0xc79c('0xf'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x55a927,_0xc79c('0xf'),JSON['stringify'](_0x1c955a));if(_0x1c955a[_0xc79c('0x10')]){if(_0x1c955a[_0xc79c('0x10')][_0xc79c('0x11')]===0x1f4){logger[_0xc79c('0x10')](_0xc79c('0xe'),_0x55a927,_0x1c955a['error']['message']);return _0x3de5ff(_0x1c955a[_0xc79c('0x10')][_0xc79c('0x12')]);}logger[_0xc79c('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x55a927,_0x1c955a[_0xc79c('0x10')]['message']);return _0x23b14c(_0x1c955a[_0xc79c('0x10')]['message']);}else{logger[_0xc79c('0xd')](_0xc79c('0xe'),_0x55a927,_0xc79c('0xf'));_0x23b14c(_0x1c955a[_0xc79c('0x13')][_0xc79c('0x12')]);}})[_0xc79c('0x14')](function(_0x485f82){logger['error'](_0xc79c('0xe'),_0x55a927,_0x485f82);_0x3de5ff(_0x485f82);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 7e8031d..75f920e 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 _0x774a=['isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x774a,0x112));var _0xa774=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x774a[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xa774('0x0'));var util=require(_0xa774('0x1'));var path=require(_0xa774('0x2'));var timeout=require(_0xa774('0x3'));var express=require(_0xa774('0x4'));var router=express[_0xa774('0x5')]();var fs_extra=require(_0xa774('0x6'));var auth=require(_0xa774('0x7'));var interaction=require(_0xa774('0x8'));var config=require(_0xa774('0x9'));var controller=require(_0xa774('0xa'));router[_0xa774('0xb')]('/',auth[_0xa774('0xc')](),controller['index']);router[_0xa774('0xb')](_0xa774('0xd'),auth[_0xa774('0xc')](),controller[_0xa774('0xe')]);router[_0xa774('0xb')](_0xa774('0xf'),auth[_0xa774('0xc')](),controller[_0xa774('0x10')]);router[_0xa774('0x11')]('/',auth[_0xa774('0xc')](),controller[_0xa774('0x12')]);router[_0xa774('0x13')](_0xa774('0xd'),auth[_0xa774('0xc')](),controller['update']);router[_0xa774('0x14')](_0xa774('0xd'),auth[_0xa774('0xc')](),controller[_0xa774('0x15')]);module['exports']=router; \ No newline at end of file +var _0x20d3=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','index','isAuthenticated','show','download','post','create','/:id','update'];(function(_0x2d10a6,_0x334b39){var _0x18b66e=function(_0x404a26){while(--_0x404a26){_0x2d10a6['push'](_0x2d10a6['shift']());}};_0x18b66e(++_0x334b39);}(_0x20d3,0xa4));var _0x320d=function(_0x1a4835,_0x546c72){_0x1a4835=_0x1a4835-0x0;var _0x1af593=_0x20d3[_0x1a4835];return _0x1af593;};'use strict';var multer=require(_0x320d('0x0'));var util=require(_0x320d('0x1'));var path=require(_0x320d('0x2'));var timeout=require(_0x320d('0x3'));var express=require(_0x320d('0x4'));var router=express[_0x320d('0x5')]();var fs_extra=require(_0x320d('0x6'));var auth=require(_0x320d('0x7'));var interaction=require(_0x320d('0x8'));var config=require(_0x320d('0x9'));var controller=require(_0x320d('0xa'));router[_0x320d('0xb')]('/',auth['isAuthenticated'](),controller[_0x320d('0xc')]);router[_0x320d('0xb')]('/:id',auth[_0x320d('0xd')](),controller[_0x320d('0xe')]);router[_0x320d('0xb')]('/:id/download',auth[_0x320d('0xd')](),controller[_0x320d('0xf')]);router[_0x320d('0x10')]('/',auth[_0x320d('0xd')](),controller[_0x320d('0x11')]);router['put'](_0x320d('0x12'),auth['isAuthenticated'](),controller[_0x320d('0x13')]);router[_0x320d('0x14')](_0x320d('0x12'),auth['isAuthenticated'](),controller[_0x320d('0x15')]);module[_0x320d('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 58d725e..e289264 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 _0x9008=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x34c18a,_0x4c0291){var _0x569d39=function(_0x41f1aa){while(--_0x41f1aa){_0x34c18a['push'](_0x34c18a['shift']());}};_0x569d39(++_0x4c0291);}(_0x9008,0x6b));var _0x8900=function(_0x50b342,_0x3fdd5a){_0x50b342=_0x50b342-0x0;var _0x3426d5=_0x9008[_0x50b342];return _0x3426d5;};'use strict';var Sequelize=require(_0x8900('0x0'));module[_0x8900('0x1')]={'field':{'type':Sequelize[_0x8900('0x2')]},'alias':{'type':Sequelize[_0x8900('0x3')]},'function':{'type':Sequelize[_0x8900('0x3')]},'format':{'type':Sequelize[_0x8900('0x3')]},'groupBy':{'type':Sequelize[_0x8900('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x8900('0x3')]},'custom':{'type':Sequelize[_0x8900('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xbda4=['sequelize','TEXT','STRING','BOOLEAN'];(function(_0x26ab15,_0x5575d6){var _0x574794=function(_0x537c7d){while(--_0x537c7d){_0x26ab15['push'](_0x26ab15['shift']());}};_0x574794(++_0x5575d6);}(_0xbda4,0x88));var _0x4bda=function(_0x233e13,_0x2fa2de){_0x233e13=_0x233e13-0x0;var _0x53b1a2=_0xbda4[_0x233e13];return _0x53b1a2;};'use strict';var Sequelize=require(_0x4bda('0x0'));module['exports']={'field':{'type':Sequelize[_0x4bda('0x1')]},'alias':{'type':Sequelize[_0x4bda('0x2')]},'function':{'type':Sequelize[_0x4bda('0x2')]},'format':{'type':Sequelize[_0x4bda('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x4bda('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 62e1ded..d074a3f 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 _0xf4b5=['addFields','sequelize','transaction','rimraf','zip-dir','fast-json-patch','bluebird','path','to-csv','ejs','fs-extra','lodash','crypto','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','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','stack','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','bulkCreate','update','params','bulkDestroy','ids'];(function(_0xb6f7a8,_0x2673ff){var _0x3b0043=function(_0x1bffa0){while(--_0x1bffa0){_0xb6f7a8['push'](_0xb6f7a8['shift']());}};_0x3b0043(++_0x2673ff);}(_0xf4b5,0xa1));var _0x5f4b=function(_0x4dbf68,_0x390d94){_0x4dbf68=_0x4dbf68-0x0;var _0x4c372f=_0xf4b5[_0x4dbf68];return _0x4c372f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f4b('0x0'));var zipdir=require(_0x5f4b('0x1'));var jsonpatch=require(_0x5f4b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5f4b('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5f4b('0x4'));var sox=require('sox');var csv=require(_0x5f4b('0x5'));var ejs=require(_0x5f4b('0x6'));var fs=require('fs');var fs_extra=require(_0x5f4b('0x7'));var _=require(_0x5f4b('0x8'));var squel=require('squel');var crypto=require(_0x5f4b('0x9'));var jsforce=require(_0x5f4b('0xa'));var deskjs=require(_0x5f4b('0xb'));var toCsv=require(_0x5f4b('0x5'));var querystring=require(_0x5f4b('0xc'));var Papa=require(_0x5f4b('0xd'));var Redis=require(_0x5f4b('0xe'));var authService=require(_0x5f4b('0xf'));var qs=require(_0x5f4b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f4b('0x11'));var logger=require(_0x5f4b('0x12'))(_0x5f4b('0x13'));var utils=require(_0x5f4b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5f4b('0x15'));var db=require(_0x5f4b('0x16'))['db'];function respondWithStatusCode(_0x5ece8b,_0x54dda4){_0x54dda4=_0x54dda4||0xcc;return function(_0x4edeb9){if(_0x4edeb9){return _0x5ece8b[_0x5f4b('0x17')](_0x54dda4);}return _0x5ece8b[_0x5f4b('0x18')](_0x54dda4)[_0x5f4b('0x19')]();};}function respondWithResult(_0x4f9d29,_0x17a2a9){_0x17a2a9=_0x17a2a9||0xc8;return function(_0x4b4243){if(_0x4b4243){return _0x4f9d29['status'](_0x17a2a9)[_0x5f4b('0x1a')](_0x4b4243);}};}function respondWithFilteredResult(_0x519f25,_0x28fb97){return function(_0x320ba8){if(_0x320ba8){var _0x4d83a2=typeof _0x28fb97[_0x5f4b('0x1b')]===_0x5f4b('0x1c')&&typeof _0x28fb97[_0x5f4b('0x1d')]===_0x5f4b('0x1c');var _0xdfb47c=_0x320ba8['count'];var _0x4f1bb4=_0x4d83a2?0x0:_0x28fb97[_0x5f4b('0x1b')];var _0x475c33=_0x4d83a2?_0x320ba8[_0x5f4b('0x1e')]:_0x28fb97[_0x5f4b('0x1b')]+_0x28fb97[_0x5f4b('0x1d')];var _0x145975;if(_0x475c33>=_0xdfb47c){_0x475c33=_0xdfb47c;_0x145975=0xc8;}else{_0x145975=0xce;}_0x519f25[_0x5f4b('0x18')](_0x145975);return _0x519f25[_0x5f4b('0x1f')](_0x5f4b('0x20'),_0x4f1bb4+'-'+_0x475c33+'/'+_0xdfb47c)[_0x5f4b('0x1a')](_0x320ba8);}return null;};}function patchUpdates(_0x518c07){return function(_0x7d411f){try{jsonpatch[_0x5f4b('0x21')](_0x7d411f,_0x518c07,!![]);}catch(_0x41e910){return BPromise[_0x5f4b('0x22')](_0x41e910);}return _0x7d411f['save']();};}function saveUpdates(_0x2de394,_0x1caf13){return function(_0x72ba9f){if(_0x72ba9f){return _0x72ba9f['update'](_0x2de394)[_0x5f4b('0x23')](function(_0xbf93e6){return _0xbf93e6;});}return null;};}function removeEntity(_0x62fd24,_0x3edecb){return function(_0x2f3108){if(_0x2f3108){return _0x2f3108[_0x5f4b('0x24')]()[_0x5f4b('0x23')](function(){_0x62fd24[_0x5f4b('0x18')](0xcc)[_0x5f4b('0x19')]();});}};}function handleEntityNotFound(_0xa558b,_0xf328df){return function(_0x5c2a96){if(!_0x5c2a96){_0xa558b['sendStatus'](0x194);}return _0x5c2a96;};}function handleError(_0x1a5d20,_0x1464e8){_0x1464e8=_0x1464e8||0x1f4;return function(_0x94e27c){logger['error'](_0x94e27c[_0x5f4b('0x25')]);if(_0x94e27c[_0x5f4b('0x26')]){delete _0x94e27c['name'];}_0x1a5d20[_0x5f4b('0x18')](_0x1464e8)[_0x5f4b('0x27')](_0x94e27c);};}exports['index']=function(_0x1366d7,_0x364ba0){var _0x3a60a6={},_0x23784e={},_0x5b8db1={'count':0x0,'rows':[]};var _0x4c3297=_[_0x5f4b('0x28')](db[_0x5f4b('0x29')][_0x5f4b('0x2a')],function(_0x626cea){return{'name':_0x626cea[_0x5f4b('0x2b')],'type':_0x626cea[_0x5f4b('0x2c')][_0x5f4b('0x2d')]};});_0x23784e[_0x5f4b('0x2e')]=_['map'](_0x4c3297,_0x5f4b('0x26'));_0x23784e[_0x5f4b('0x2f')]=_[_0x5f4b('0x30')](_0x1366d7[_0x5f4b('0x2f')]);_0x23784e[_0x5f4b('0x31')]=_[_0x5f4b('0x32')](_0x23784e['model'],_0x23784e[_0x5f4b('0x2f')]);_0x3a60a6[_0x5f4b('0x33')]=_['intersection'](_0x23784e[_0x5f4b('0x2e')],qs[_0x5f4b('0x34')](_0x1366d7[_0x5f4b('0x2f')][_0x5f4b('0x34')]));_0x3a60a6['attributes']=_0x3a60a6['attributes']['length']?_0x3a60a6['attributes']:_0x23784e[_0x5f4b('0x2e')];if(!_0x1366d7[_0x5f4b('0x2f')][_0x5f4b('0x35')](_0x5f4b('0x36'))){_0x3a60a6[_0x5f4b('0x1d')]=qs[_0x5f4b('0x1d')](_0x1366d7['query'][_0x5f4b('0x1d')]);_0x3a60a6['offset']=qs[_0x5f4b('0x1b')](_0x1366d7[_0x5f4b('0x2f')][_0x5f4b('0x1b')]);}_0x3a60a6['order']=qs['sort'](_0x1366d7['query'][_0x5f4b('0x37')]);_0x3a60a6[_0x5f4b('0x38')]=qs[_0x5f4b('0x31')](_[_0x5f4b('0x39')](_0x1366d7[_0x5f4b('0x2f')],_0x23784e[_0x5f4b('0x31')]),_0x4c3297);if(_0x1366d7[_0x5f4b('0x2f')]['filter']){_0x3a60a6[_0x5f4b('0x38')]=_['merge'](_0x3a60a6[_0x5f4b('0x38')],{'$or':_[_0x5f4b('0x28')](_0x4c3297,function(_0x1214fb){if(_0x1214fb[_0x5f4b('0x2c')]!=='VIRTUAL'){var _0x591232={};_0x591232[_0x1214fb[_0x5f4b('0x26')]]={'$like':'%'+_0x1366d7['query'][_0x5f4b('0x3a')]+'%'};return _0x591232;}})});}_0x3a60a6=_[_0x5f4b('0x3b')]({},_0x3a60a6,_0x1366d7[_0x5f4b('0x3c')]);var _0x142c45={'where':_0x3a60a6[_0x5f4b('0x38')]};return db['AnalyticFieldReport'][_0x5f4b('0x1e')](_0x142c45)[_0x5f4b('0x23')](function(_0x281b25){_0x5b8db1[_0x5f4b('0x1e')]=_0x281b25;if(_0x1366d7[_0x5f4b('0x2f')][_0x5f4b('0x3d')]){_0x3a60a6[_0x5f4b('0x3e')]=[{'all':!![]}];}return db[_0x5f4b('0x29')][_0x5f4b('0x3f')](_0x3a60a6);})[_0x5f4b('0x23')](function(_0x53dbf2){_0x5b8db1[_0x5f4b('0x40')]=_0x53dbf2;return _0x5b8db1;})[_0x5f4b('0x23')](respondWithFilteredResult(_0x364ba0,_0x3a60a6))[_0x5f4b('0x41')](handleError(_0x364ba0,null));};exports[_0x5f4b('0x42')]=function(_0x3b1590,_0x29ef84){var _0x2cd9d6={'raw':![],'where':{'id':_0x3b1590['params']['id']}},_0xb3bca8={};_0xb3bca8['model']=_['keys'](db[_0x5f4b('0x29')][_0x5f4b('0x2a')]);_0xb3bca8[_0x5f4b('0x2f')]=_[_0x5f4b('0x30')](_0x3b1590['query']);_0xb3bca8[_0x5f4b('0x31')]=_[_0x5f4b('0x32')](_0xb3bca8['model'],_0xb3bca8[_0x5f4b('0x2f')]);_0x2cd9d6['attributes']=_[_0x5f4b('0x32')](_0xb3bca8[_0x5f4b('0x2e')],qs[_0x5f4b('0x34')](_0x3b1590[_0x5f4b('0x2f')][_0x5f4b('0x34')]));_0x2cd9d6['attributes']=_0x2cd9d6['attributes'][_0x5f4b('0x43')]?_0x2cd9d6[_0x5f4b('0x33')]:_0xb3bca8[_0x5f4b('0x2e')];if(_0x3b1590[_0x5f4b('0x2f')][_0x5f4b('0x3d')]){_0x2cd9d6[_0x5f4b('0x3e')]=[{'all':!![]}];}_0x2cd9d6=_['merge']({},_0x2cd9d6,_0x3b1590['options']);return db[_0x5f4b('0x29')][_0x5f4b('0x44')](_0x2cd9d6)[_0x5f4b('0x23')](handleEntityNotFound(_0x29ef84,null))[_0x5f4b('0x23')](respondWithResult(_0x29ef84,null))[_0x5f4b('0x41')](handleError(_0x29ef84,null));};exports[_0x5f4b('0x45')]=function(_0x2b7980,_0x33f295){return db[_0x5f4b('0x29')][_0x5f4b('0x45')](_0x2b7980[_0x5f4b('0x46')],{})['then'](respondWithResult(_0x33f295,0xc9))['catch'](handleError(_0x33f295,null));};exports[_0x5f4b('0x47')]=function(_0x417587,_0x171d08){return db[_0x5f4b('0x29')][_0x5f4b('0x47')](_0x417587[_0x5f4b('0x46')],{'raw':![],'individualHooks':!![]})[_0x5f4b('0x23')](respondWithResult(_0x171d08,0xc9))['catch'](handleError(_0x171d08,null));};exports[_0x5f4b('0x48')]=function(_0x197294,_0x45afd4){if(_0x197294[_0x5f4b('0x46')]['id']){delete _0x197294[_0x5f4b('0x46')]['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x197294[_0x5f4b('0x49')]['id']}})[_0x5f4b('0x23')](handleEntityNotFound(_0x45afd4,null))[_0x5f4b('0x23')](saveUpdates(_0x197294['body'],null))[_0x5f4b('0x23')](respondWithResult(_0x45afd4,null))[_0x5f4b('0x41')](handleError(_0x45afd4,null));};exports[_0x5f4b('0x24')]=function(_0x12af94,_0x15cca6){return db['AnalyticFieldReport'][_0x5f4b('0x44')]({'where':{'id':_0x12af94['params']['id']}})[_0x5f4b('0x23')](handleEntityNotFound(_0x15cca6,null))['then'](removeEntity(_0x15cca6,null))[_0x5f4b('0x41')](handleError(_0x15cca6,null));};exports[_0x5f4b('0x4a')]=function(_0x3eb42e,_0x24369b){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x3eb42e[_0x5f4b('0x2f')][_0x5f4b('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x5f4b('0x23')](respondWithResult(_0x24369b,0xcc))[_0x5f4b('0x41')](handleError(_0x24369b,null));};exports[_0x5f4b('0x4c')]=function(_0x5a79f9,_0x5da708,_0x1982bf){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x5a79f9['params']['id']}})[_0x5f4b('0x23')](handleEntityNotFound(_0x5da708,null))[_0x5f4b('0x23')](function(_0x153cbb){if(_0x153cbb){return db[_0x5f4b('0x4d')][_0x5f4b('0x4e')](function(_0x58a486){return db[_0x5f4b('0x29')][_0x5f4b('0x24')]({'where':{'CustomReportId':_0x5a79f9[_0x5f4b('0x49')]['id']},'transaction':_0x58a486})[_0x5f4b('0x23')](function(_0x1cde64){var _0x19c7c0=_['map'](_0x5a79f9[_0x5f4b('0x46')],function(_0xaa3fde){delete _0xaa3fde['id'];_0xaa3fde['CustomReportId']=_0x5a79f9['params']['id'];return _0xaa3fde;});return db[_0x5f4b('0x29')][_0x5f4b('0x47')](_0x19c7c0,{'transaction':_0x58a486});});})['then'](function(){return db['AnalyticFieldReport'][_0x5f4b('0x3f')]({'where':{'CustomReportId':_0x5a79f9['params']['id']}});});}})[_0x5f4b('0x23')](respondWithResult(_0x5da708,null))[_0x5f4b('0x41')](handleError(_0x5da708,null));}; \ No newline at end of file +var _0x0940=['status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticFieldReport','includeAll','findAll','rows','catch','show','params','find','create','body','bulkCreate','update','ids','sequelize','transaction','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus'];(function(_0x5743e3,_0x4a2aab){var _0x24d100=function(_0x10737c){while(--_0x10737c){_0x5743e3['push'](_0x5743e3['shift']());}};_0x24d100(++_0x4a2aab);}(_0x0940,0x84));var _0x0094=function(_0x159849,_0x4ff62b){_0x159849=_0x159849-0x0;var _0x433b4f=_0x0940[_0x159849];return _0x433b4f;};'use strict';var emlformat=require(_0x0094('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0094('0x1'));var jsonpatch=require(_0x0094('0x2'));var rp=require(_0x0094('0x3'));var moment=require(_0x0094('0x4'));var BPromise=require(_0x0094('0x5'));var Mustache=require('mustache');var util=require(_0x0094('0x6'));var path=require(_0x0094('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0094('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0094('0x9'));var squel=require(_0x0094('0xa'));var crypto=require(_0x0094('0xb'));var jsforce=require(_0x0094('0xc'));var deskjs=require(_0x0094('0xd'));var toCsv=require(_0x0094('0xe'));var querystring=require(_0x0094('0xf'));var Papa=require(_0x0094('0x10'));var Redis=require(_0x0094('0x11'));var authService=require(_0x0094('0x12'));var qs=require(_0x0094('0x13'));var as=require(_0x0094('0x14'));var hardwareService=require(_0x0094('0x15'));var logger=require(_0x0094('0x16'))(_0x0094('0x17'));var utils=require('../../config/utils');var config=require(_0x0094('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a7ef9,_0x565be4){_0x565be4=_0x565be4||0xcc;return function(_0xa6dc42){if(_0xa6dc42){return _0x2a7ef9[_0x0094('0x19')](_0x565be4);}return _0x2a7ef9[_0x0094('0x1a')](_0x565be4)[_0x0094('0x1b')]();};}function respondWithResult(_0x5c886c,_0x477887){_0x477887=_0x477887||0xc8;return function(_0x302155){if(_0x302155){return _0x5c886c[_0x0094('0x1a')](_0x477887)[_0x0094('0x1c')](_0x302155);}};}function respondWithFilteredResult(_0x5bb384,_0x52030e){return function(_0x29b60c){if(_0x29b60c){var _0x40dd4f=typeof _0x52030e[_0x0094('0x1d')]===_0x0094('0x1e')&&typeof _0x52030e[_0x0094('0x1f')]==='undefined';var _0x298bd3=_0x29b60c[_0x0094('0x20')];var _0x585e92=_0x40dd4f?0x0:_0x52030e['offset'];var _0x1ea161=_0x40dd4f?_0x29b60c[_0x0094('0x20')]:_0x52030e[_0x0094('0x1d')]+_0x52030e[_0x0094('0x1f')];var _0xb8d6ac;if(_0x1ea161>=_0x298bd3){_0x1ea161=_0x298bd3;_0xb8d6ac=0xc8;}else{_0xb8d6ac=0xce;}_0x5bb384['status'](_0xb8d6ac);return _0x5bb384[_0x0094('0x21')]('Content-Range',_0x585e92+'-'+_0x1ea161+'/'+_0x298bd3)['json'](_0x29b60c);}return null;};}function patchUpdates(_0x23b3ac){return function(_0x4ac754){try{jsonpatch[_0x0094('0x22')](_0x4ac754,_0x23b3ac,!![]);}catch(_0x22ae6d){return BPromise[_0x0094('0x23')](_0x22ae6d);}return _0x4ac754[_0x0094('0x24')]();};}function saveUpdates(_0x469858,_0x312b6a){return function(_0x2336f8){if(_0x2336f8){return _0x2336f8['update'](_0x469858)[_0x0094('0x25')](function(_0x3e93ca){return _0x3e93ca;});}return null;};}function removeEntity(_0x28a34b,_0xe66ba4){return function(_0x278299){if(_0x278299){return _0x278299[_0x0094('0x26')]()[_0x0094('0x25')](function(){_0x28a34b[_0x0094('0x1a')](0xcc)[_0x0094('0x1b')]();});}};}function handleEntityNotFound(_0x99c9b9,_0xe91b52){return function(_0x3d0de5){if(!_0x3d0de5){_0x99c9b9['sendStatus'](0x194);}return _0x3d0de5;};}function handleError(_0x4e2218,_0x23fb9b){_0x23fb9b=_0x23fb9b||0x1f4;return function(_0x18d3ee){logger[_0x0094('0x27')](_0x18d3ee[_0x0094('0x28')]);if(_0x18d3ee[_0x0094('0x29')]){delete _0x18d3ee[_0x0094('0x29')];}_0x4e2218[_0x0094('0x1a')](_0x23fb9b)['send'](_0x18d3ee);};}exports['index']=function(_0x178ebf,_0x2e3198){var _0x3211ff={},_0x51b654={},_0x53e210={'count':0x0,'rows':[]};var _0x2625cf=_[_0x0094('0x2a')](db['AnalyticFieldReport'][_0x0094('0x2b')],function(_0x28c712){return{'name':_0x28c712[_0x0094('0x2c')],'type':_0x28c712[_0x0094('0x2d')][_0x0094('0x2e')]};});_0x51b654[_0x0094('0x2f')]=_[_0x0094('0x2a')](_0x2625cf,_0x0094('0x29'));_0x51b654['query']=_[_0x0094('0x30')](_0x178ebf[_0x0094('0x31')]);_0x51b654[_0x0094('0x32')]=_[_0x0094('0x33')](_0x51b654[_0x0094('0x2f')],_0x51b654['query']);_0x3211ff[_0x0094('0x34')]=_[_0x0094('0x33')](_0x51b654[_0x0094('0x2f')],qs[_0x0094('0x35')](_0x178ebf[_0x0094('0x31')][_0x0094('0x35')]));_0x3211ff['attributes']=_0x3211ff[_0x0094('0x34')][_0x0094('0x36')]?_0x3211ff[_0x0094('0x34')]:_0x51b654[_0x0094('0x2f')];if(!_0x178ebf[_0x0094('0x31')]['hasOwnProperty']('nolimit')){_0x3211ff[_0x0094('0x1f')]=qs[_0x0094('0x1f')](_0x178ebf[_0x0094('0x31')][_0x0094('0x1f')]);_0x3211ff[_0x0094('0x1d')]=qs['offset'](_0x178ebf['query'][_0x0094('0x1d')]);}_0x3211ff[_0x0094('0x37')]=qs[_0x0094('0x38')](_0x178ebf['query'][_0x0094('0x38')]);_0x3211ff[_0x0094('0x39')]=qs['filters'](_[_0x0094('0x3a')](_0x178ebf[_0x0094('0x31')],_0x51b654[_0x0094('0x32')]),_0x2625cf);if(_0x178ebf['query'][_0x0094('0x3b')]){_0x3211ff['where']=_[_0x0094('0x3c')](_0x3211ff[_0x0094('0x39')],{'$or':_['map'](_0x2625cf,function(_0x38f320){if(_0x38f320[_0x0094('0x2d')]!==_0x0094('0x3d')){var _0x19ad2a={};_0x19ad2a[_0x38f320[_0x0094('0x29')]]={'$like':'%'+_0x178ebf[_0x0094('0x31')]['filter']+'%'};return _0x19ad2a;}})});}_0x3211ff=_[_0x0094('0x3c')]({},_0x3211ff,_0x178ebf[_0x0094('0x3e')]);var _0x2af0c8={'where':_0x3211ff['where']};return db[_0x0094('0x3f')][_0x0094('0x20')](_0x2af0c8)[_0x0094('0x25')](function(_0x29d33d){_0x53e210[_0x0094('0x20')]=_0x29d33d;if(_0x178ebf[_0x0094('0x31')][_0x0094('0x40')]){_0x3211ff['include']=[{'all':!![]}];}return db[_0x0094('0x3f')][_0x0094('0x41')](_0x3211ff);})[_0x0094('0x25')](function(_0xbb6ba4){_0x53e210[_0x0094('0x42')]=_0xbb6ba4;return _0x53e210;})[_0x0094('0x25')](respondWithFilteredResult(_0x2e3198,_0x3211ff))[_0x0094('0x43')](handleError(_0x2e3198,null));};exports[_0x0094('0x44')]=function(_0x482e33,_0x8abeb2){var _0x503b8e={'raw':![],'where':{'id':_0x482e33[_0x0094('0x45')]['id']}},_0x4c9da0={};_0x4c9da0[_0x0094('0x2f')]=_[_0x0094('0x30')](db[_0x0094('0x3f')]['rawAttributes']);_0x4c9da0[_0x0094('0x31')]=_['keys'](_0x482e33[_0x0094('0x31')]);_0x4c9da0['filters']=_[_0x0094('0x33')](_0x4c9da0[_0x0094('0x2f')],_0x4c9da0['query']);_0x503b8e[_0x0094('0x34')]=_['intersection'](_0x4c9da0[_0x0094('0x2f')],qs[_0x0094('0x35')](_0x482e33[_0x0094('0x31')][_0x0094('0x35')]));_0x503b8e[_0x0094('0x34')]=_0x503b8e['attributes'][_0x0094('0x36')]?_0x503b8e['attributes']:_0x4c9da0[_0x0094('0x2f')];if(_0x482e33['query'][_0x0094('0x40')]){_0x503b8e['include']=[{'all':!![]}];}_0x503b8e=_[_0x0094('0x3c')]({},_0x503b8e,_0x482e33[_0x0094('0x3e')]);return db[_0x0094('0x3f')][_0x0094('0x46')](_0x503b8e)[_0x0094('0x25')](handleEntityNotFound(_0x8abeb2,null))[_0x0094('0x25')](respondWithResult(_0x8abeb2,null))[_0x0094('0x43')](handleError(_0x8abeb2,null));};exports[_0x0094('0x47')]=function(_0x5cb953,_0x198258){return db[_0x0094('0x3f')][_0x0094('0x47')](_0x5cb953[_0x0094('0x48')],{})[_0x0094('0x25')](respondWithResult(_0x198258,0xc9))['catch'](handleError(_0x198258,null));};exports[_0x0094('0x49')]=function(_0x11d10b,_0x5708ba){return db[_0x0094('0x3f')][_0x0094('0x49')](_0x11d10b[_0x0094('0x48')],{'raw':![],'individualHooks':!![]})[_0x0094('0x25')](respondWithResult(_0x5708ba,0xc9))[_0x0094('0x43')](handleError(_0x5708ba,null));};exports[_0x0094('0x4a')]=function(_0x4c4388,_0xead7eb){if(_0x4c4388['body']['id']){delete _0x4c4388[_0x0094('0x48')]['id'];}return db['AnalyticFieldReport'][_0x0094('0x46')]({'where':{'id':_0x4c4388['params']['id']}})[_0x0094('0x25')](handleEntityNotFound(_0xead7eb,null))[_0x0094('0x25')](saveUpdates(_0x4c4388['body'],null))[_0x0094('0x25')](respondWithResult(_0xead7eb,null))[_0x0094('0x43')](handleError(_0xead7eb,null));};exports[_0x0094('0x26')]=function(_0x42b2a6,_0x2fa047){return db[_0x0094('0x3f')]['find']({'where':{'id':_0x42b2a6[_0x0094('0x45')]['id']}})[_0x0094('0x25')](handleEntityNotFound(_0x2fa047,null))[_0x0094('0x25')](removeEntity(_0x2fa047,null))[_0x0094('0x43')](handleError(_0x2fa047,null));};exports['bulkDestroy']=function(_0x4f8d9d,_0x289936){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x4f8d9d[_0x0094('0x31')][_0x0094('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x0094('0x25')](respondWithResult(_0x289936,0xcc))['catch'](handleError(_0x289936,null));};exports['addFields']=function(_0x390165,_0x11149b,_0x336236){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x390165[_0x0094('0x45')]['id']}})[_0x0094('0x25')](handleEntityNotFound(_0x11149b,null))[_0x0094('0x25')](function(_0x388957){if(_0x388957){return db[_0x0094('0x4c')][_0x0094('0x4d')](function(_0x5c1596){return db['AnalyticFieldReport'][_0x0094('0x26')]({'where':{'CustomReportId':_0x390165[_0x0094('0x45')]['id']},'transaction':_0x5c1596})[_0x0094('0x25')](function(_0x4167ba){var _0x5244d3=_[_0x0094('0x2a')](_0x390165[_0x0094('0x48')],function(_0x212a6f){delete _0x212a6f['id'];_0x212a6f[_0x0094('0x4e')]=_0x390165[_0x0094('0x45')]['id'];return _0x212a6f;});return db[_0x0094('0x3f')]['bulkCreate'](_0x5244d3,{'transaction':_0x5c1596});});})[_0x0094('0x25')](function(){return db['AnalyticFieldReport'][_0x0094('0x41')]({'where':{'CustomReportId':_0x390165[_0x0094('0x45')]['id']}});});}})[_0x0094('0x25')](respondWithResult(_0x11149b,null))[_0x0094('0x43')](handleError(_0x11149b,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index d35ca75..e90cbfb 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 _0xd87b=['request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','moment'];(function(_0x5d3905,_0x561ef9){var _0x3e462f=function(_0x13c1b4){while(--_0x13c1b4){_0x5d3905['push'](_0x5d3905['shift']());}};_0x3e462f(++_0x561ef9);}(_0xd87b,0xcd));var _0xbd87=function(_0x5a4d24,_0x5da2db){_0x5a4d24=_0x5a4d24-0x0;var _0x132b4a=_0xd87b[_0x5a4d24];return _0x132b4a;};'use strict';var _=require(_0xbd87('0x0'));var util=require(_0xbd87('0x1'));var logger=require(_0xbd87('0x2'))('api');var moment=require(_0xbd87('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd87('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd87('0x5'));var config=require(_0xbd87('0x6'));var attributes=require(_0xbd87('0x7'));module[_0xbd87('0x8')]=function(_0x4d022c,_0xe9aa92){return _0x4d022c['define'](_0xbd87('0x9'),attributes,{'tableName':_0xbd87('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1569=['define','AnalyticFieldReport','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','exports'];(function(_0x1abcd0,_0x448c52){var _0x4e43dd=function(_0x31bd92){while(--_0x31bd92){_0x1abcd0['push'](_0x1abcd0['shift']());}};_0x4e43dd(++_0x448c52);}(_0x1569,0x146));var _0x9156=function(_0x15d6de,_0x5807c6){_0x15d6de=_0x15d6de-0x0;var _0x51e84a=_0x1569[_0x15d6de];return _0x51e84a;};'use strict';var _=require(_0x9156('0x0'));var util=require(_0x9156('0x1'));var logger=require('../../config/logger')(_0x9156('0x2'));var moment=require(_0x9156('0x3'));var BPromise=require(_0x9156('0x4'));var rp=require(_0x9156('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9156('0x6'));var config=require(_0x9156('0x7'));var attributes=require(_0x9156('0x8'));module[_0x9156('0x9')]=function(_0x523a6e,_0x223dce){return _0x523a6e[_0x9156('0xa')](_0x9156('0xb'),attributes,{'tableName':'analytics_report_fields','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 2608a1b..7b6230b 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 _0xdd7e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','lodash','util'];(function(_0x413aac,_0x5e2430){var _0x569b11=function(_0x52e060){while(--_0x52e060){_0x413aac['push'](_0x413aac['shift']());}};_0x569b11(++_0x5e2430);}(_0xdd7e,0x124));var _0xedd7=function(_0x356959,_0x465499){_0x356959=_0x356959-0x0;var _0x4b33d1=_0xdd7e[_0x356959];return _0x4b33d1;};'use strict';var _=require(_0xedd7('0x0'));var util=require(_0xedd7('0x1'));var moment=require(_0xedd7('0x2'));var BPromise=require(_0xedd7('0x3'));var rs=require(_0xedd7('0x4'));var fs=require('fs');var Redis=require(_0xedd7('0x5'));var db=require(_0xedd7('0x6'))['db'];var utils=require(_0xedd7('0x7'));var logger=require(_0xedd7('0x8'))('rpc');var config=require(_0xedd7('0x9'));var jayson=require(_0xedd7('0xa'));var client=jayson[_0xedd7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x318d35,_0xed8968,_0x1c717f){return new BPromise(function(_0x2e994f,_0x5a2207){return client[_0xedd7('0xc')](_0x318d35,_0x1c717f)[_0xedd7('0xd')](function(_0x5277e5){logger['info'](_0xedd7('0xe'),_0xed8968,'request\x20sent');logger['debug'](_0xedd7('0xf'),_0xed8968,_0xedd7('0x10'),JSON[_0xedd7('0x11')](_0x5277e5));if(_0x5277e5[_0xedd7('0x12')]){if(_0x5277e5[_0xedd7('0x12')]['code']===0x1f4){logger[_0xedd7('0x12')](_0xedd7('0xe'),_0xed8968,_0x5277e5[_0xedd7('0x12')][_0xedd7('0x13')]);return _0x5a2207(_0x5277e5[_0xedd7('0x12')][_0xedd7('0x13')]);}logger[_0xedd7('0x12')](_0xedd7('0xe'),_0xed8968,_0x5277e5[_0xedd7('0x12')][_0xedd7('0x13')]);return _0x2e994f(_0x5277e5[_0xedd7('0x12')][_0xedd7('0x13')]);}else{logger[_0xedd7('0x14')]('AnalyticFieldReport,\x20%s,\x20%s',_0xed8968,_0xedd7('0x10'));_0x2e994f(_0x5277e5['result'][_0xedd7('0x13')]);}})['catch'](function(_0x4ddcd1){logger['error'](_0xedd7('0xe'),_0xed8968,_0x4ddcd1);_0x5a2207(_0x4ddcd1);});});} \ No newline at end of file +var _0x0306=['error','code','message','AnalyticFieldReport,\x20%s,\x20%s','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','debug','request\x20sent'];(function(_0x5626b,_0x4fd403){var _0x50874e=function(_0x24c81b){while(--_0x24c81b){_0x5626b['push'](_0x5626b['shift']());}};_0x50874e(++_0x4fd403);}(_0x0306,0x1d2));var _0x6030=function(_0x15dc98,_0x3217fa){_0x15dc98=_0x15dc98-0x0;var _0x1d3dc1=_0x0306[_0x15dc98];return _0x1d3dc1;};'use strict';var _=require(_0x6030('0x0'));var util=require(_0x6030('0x1'));var moment=require(_0x6030('0x2'));var BPromise=require(_0x6030('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6030('0x4'));var db=require(_0x6030('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6030('0x6'))('rpc');var config=require(_0x6030('0x7'));var jayson=require(_0x6030('0x8'));var client=jayson[_0x6030('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe33fef,_0xfce43e,_0x30e8b8){return new BPromise(function(_0x4a14e2,_0x207ec6){return client[_0x6030('0xa')](_0xe33fef,_0x30e8b8)[_0x6030('0xb')](function(_0x267b8c){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0xfce43e,'request\x20sent');logger[_0x6030('0xc')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0xfce43e,_0x6030('0xd'),JSON['stringify'](_0x267b8c));if(_0x267b8c['error']){if(_0x267b8c[_0x6030('0xe')][_0x6030('0xf')]===0x1f4){logger[_0x6030('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0xfce43e,_0x267b8c['error'][_0x6030('0x10')]);return _0x207ec6(_0x267b8c[_0x6030('0xe')][_0x6030('0x10')]);}logger[_0x6030('0xe')](_0x6030('0x11'),_0xfce43e,_0x267b8c[_0x6030('0xe')][_0x6030('0x10')]);return _0x4a14e2(_0x267b8c['error']['message']);}else{logger[_0x6030('0x12')](_0x6030('0x11'),_0xfce43e,_0x6030('0xd'));_0x4a14e2(_0x267b8c[_0x6030('0x13')]['message']);}})['catch'](function(_0x2c08f8){logger['error'](_0x6030('0x11'),_0xfce43e,_0x2c08f8);_0x207ec6(_0x2c08f8);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index fd601a5..e18dc83 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(_0xedc8f8,_0x766f36){var _0x1b78f5=function(_0x48fc9e){while(--_0x48fc9e){_0xedc8f8['push'](_0xedc8f8['shift']());}};_0x1b78f5(++_0x766f36);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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(_0x2e5f54,_0x13dd84){var _0x407d00=function(_0x51f778){while(--_0x51f778){_0x2e5f54['push'](_0x2e5f54['shift']());}};_0x407d00(++_0x13dd84);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 a231e82..31ad5c0 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 _0x3c2c=['sequelize','exports','STRING','name'];(function(_0x405197,_0x25d440){var _0xeabd13=function(_0x40aff3){while(--_0x40aff3){_0x405197['push'](_0x405197['shift']());}};_0xeabd13(++_0x25d440);}(_0x3c2c,0x160));var _0xc3c2=function(_0x597d6d,_0x22f63c){_0x597d6d=_0x597d6d-0x0;var _0x929d0d=_0x3c2c[_0x597d6d];return _0x929d0d;};'use strict';var Sequelize=require(_0xc3c2('0x0'));module[_0xc3c2('0x1')]={'name':{'type':Sequelize[_0xc3c2('0x2')],'allowNull':![],'unique':_0xc3c2('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xc3c2('0x2')]}}; \ No newline at end of file +var _0x4de7=['STRING','name','TEXT','sequelize'];(function(_0x5433e8,_0x419b0b){var _0x43fac2=function(_0x485d83){while(--_0x485d83){_0x5433e8['push'](_0x5433e8['shift']());}};_0x43fac2(++_0x419b0b);}(_0x4de7,0x1f3));var _0x74de=function(_0x442c77,_0x3a95fc){_0x442c77=_0x442c77-0x0;var _0x50aed8=_0x4de7[_0x442c77];return _0x50aed8;};'use strict';var Sequelize=require(_0x74de('0x0'));module['exports']={'name':{'type':Sequelize[_0x74de('0x1')],'allowNull':![],'unique':_0x74de('0x2')},'table':{'type':Sequelize[_0x74de('0x1')]},'metric':{'type':Sequelize[_0x74de('0x3')]},'description':{'type':Sequelize[_0x74de('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index bdb1eb6..c2767bb 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 _0x46ed=['where','pick','filter','merge','map','type','options','count','includeAll','include','findAll','rows','params','keys','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','reject','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x33b59d,_0x30f9f4){var _0x1c1ac6=function(_0x239280){while(--_0x239280){_0x33b59d['push'](_0x33b59d['shift']());}};_0x1c1ac6(++_0x30f9f4);}(_0x46ed,0x168));var _0xd46e=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x46ed[_0x599f41];return _0x2e4d58;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=typeof _0x44a620[_0xd46e('0x1c')]==='undefined'&&typeof _0x44a620[_0xd46e('0x1d')]===_0xd46e('0x1e');var _0x3583a5=_0x417402['count'];var _0x5ddd04=_0x3d72ce?0x0:_0x44a620[_0xd46e('0x1c')];var _0x1bd574=_0x3d72ce?_0x417402['count']:_0x44a620['offset']+_0x44a620[_0xd46e('0x1d')];var _0x2f2571;if(_0x1bd574>=_0x3583a5){_0x1bd574=_0x3583a5;_0x2f2571=0xc8;}else{_0x2f2571=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x2f2571);return _0x3b6d25[_0xd46e('0x1f')](_0xd46e('0x20'),_0x5ddd04+'-'+_0x1bd574+'/'+_0x3583a5)[_0xd46e('0x21')](_0x417402);}return null;};}function patchUpdates(_0x3b5fa4){return function(_0x327b7e){try{jsonpatch[_0xd46e('0x22')](_0x327b7e,_0x3b5fa4,!![]);}catch(_0x3c7e91){return BPromise[_0xd46e('0x23')](_0x3c7e91);}return _0x327b7e['save']();};}function saveUpdates(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')](_0x259072)[_0xd46e('0x25')](function(_0xc1af7f){return _0xc1af7f;});}return null;};}function removeEntity(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(_0x62dea5){return _0x62dea5['destroy']()[_0xd46e('0x25')](function(){var _0x5424e5=_0x62dea5['get']({'plain':!![]});var _0x371054=_0xd46e('0x26');return db[_0xd46e('0x27')][_0xd46e('0x28')]({'where':{'type':_0x371054,'resourceId':_0x5424e5['id']}})[_0xd46e('0x25')](function(){return _0x62dea5;});})[_0xd46e('0x25')](function(){_0x33c2e0[_0xd46e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d789,_0x3c301a){return function(_0xddbce9){if(!_0xddbce9){_0x45d789[_0xd46e('0x1a')](0x194);}return _0xddbce9;};}function handleError(_0x96f15c,_0x16e941){_0x16e941=_0x16e941||0x1f4;return function(_0x58aeef){logger[_0xd46e('0x29')](_0x58aeef[_0xd46e('0x2a')]);if(_0x58aeef[_0xd46e('0x2b')]){delete _0x58aeef[_0xd46e('0x2b')];}_0x96f15c[_0xd46e('0x1b')](_0x16e941)[_0xd46e('0x2c')](_0x58aeef);};}exports[_0xd46e('0x2d')]=function(_0x2c5ec7,_0x18f060){var _0x45ea47={},_0x2ff785={},_0x504324={'count':0x0,'rows':[]};var _0x2f4a1b=_['map'](db[_0xd46e('0x2e')][_0xd46e('0x2f')],function(_0x4f5718){return{'name':_0x4f5718[_0xd46e('0x30')],'type':_0x4f5718['type'][_0xd46e('0x31')]};});_0x2ff785[_0xd46e('0x32')]=_['map'](_0x2f4a1b,_0xd46e('0x2b'));_0x2ff785[_0xd46e('0x33')]=_['keys'](_0x2c5ec7[_0xd46e('0x33')]);_0x2ff785[_0xd46e('0x34')]=_[_0xd46e('0x35')](_0x2ff785['model'],_0x2ff785['query']);_0x45ea47[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x2ff785[_0xd46e('0x32')],qs[_0xd46e('0x37')](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x37')]));_0x45ea47[_0xd46e('0x36')]=_0x45ea47[_0xd46e('0x36')]['length']?_0x45ea47[_0xd46e('0x36')]:_0x2ff785[_0xd46e('0x32')];if(!_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x38')](_0xd46e('0x39'))){_0x45ea47[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x2c5ec7['query'][_0xd46e('0x1d')]);_0x45ea47[_0xd46e('0x1c')]=qs['offset'](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x1c')]);}_0x45ea47[_0xd46e('0x3a')]=qs[_0xd46e('0x3b')](_0x2c5ec7['query'][_0xd46e('0x3b')]);_0x45ea47[_0xd46e('0x3c')]=qs[_0xd46e('0x34')](_[_0xd46e('0x3d')](_0x2c5ec7[_0xd46e('0x33')],_0x2ff785[_0xd46e('0x34')]),_0x2f4a1b);if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x3e')]){_0x45ea47['where']=_[_0xd46e('0x3f')](_0x45ea47[_0xd46e('0x3c')],{'$or':_[_0xd46e('0x40')](_0x2f4a1b,function(_0x25657a){if(_0x25657a[_0xd46e('0x41')]!=='VIRTUAL'){var _0x964c66={};_0x964c66[_0x25657a['name']]={'$like':'%'+_0x2c5ec7['query']['filter']+'%'};return _0x964c66;}})});}_0x45ea47=_['merge']({},_0x45ea47,_0x2c5ec7[_0xd46e('0x42')]);var _0x54949f={'where':_0x45ea47[_0xd46e('0x3c')]};return db[_0xd46e('0x2e')]['count'](_0x54949f)[_0xd46e('0x25')](function(_0x4114e6){_0x504324[_0xd46e('0x43')]=_0x4114e6;if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x44')]){_0x45ea47[_0xd46e('0x45')]=[{'all':!![]}];}return db[_0xd46e('0x2e')][_0xd46e('0x46')](_0x45ea47);})[_0xd46e('0x25')](function(_0xec367d){_0x504324[_0xd46e('0x47')]=_0xec367d;return _0x504324;})['then'](respondWithFilteredResult(_0x18f060,_0x45ea47))['catch'](handleError(_0x18f060,null));};exports['show']=function(_0x2b4a5a,_0x4e1d94){var _0x168d35={'raw':!![],'where':{'id':_0x2b4a5a[_0xd46e('0x48')]['id']}},_0x272f5f={};_0x272f5f[_0xd46e('0x32')]=_[_0xd46e('0x49')](db[_0xd46e('0x2e')][_0xd46e('0x2f')]);_0x272f5f[_0xd46e('0x33')]=_['keys'](_0x2b4a5a[_0xd46e('0x33')]);_0x272f5f['filters']=_[_0xd46e('0x35')](_0x272f5f[_0xd46e('0x32')],_0x272f5f[_0xd46e('0x33')]);_0x168d35[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x272f5f['model'],qs[_0xd46e('0x37')](_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x37')]));_0x168d35[_0xd46e('0x36')]=_0x168d35[_0xd46e('0x36')]['length']?_0x168d35[_0xd46e('0x36')]:_0x272f5f[_0xd46e('0x32')];if(_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x44')]){_0x168d35[_0xd46e('0x45')]=[{'all':!![]}];}_0x168d35=_['merge']({},_0x168d35,_0x2b4a5a[_0xd46e('0x42')]);return db[_0xd46e('0x2e')][_0xd46e('0x4a')](_0x168d35)[_0xd46e('0x25')](handleEntityNotFound(_0x4e1d94,null))[_0xd46e('0x25')](respondWithResult(_0x4e1d94,null))[_0xd46e('0x4b')](handleError(_0x4e1d94,null));};exports[_0xd46e('0x4c')]=function(_0x440dcc,_0x5188f6){return db[_0xd46e('0x2e')][_0xd46e('0x4c')](_0x440dcc[_0xd46e('0x4d')],{})[_0xd46e('0x25')](function(_0x1f1941){var _0x4e84c8=_0x440dcc['user'][_0xd46e('0x4e')]({'plain':!![]});if(!_0x4e84c8)throw new Error(_0xd46e('0x4f'));if(_0x4e84c8[_0xd46e('0x50')]==='user'){var _0x479711=_0x1f1941[_0xd46e('0x4e')]({'plain':!![]});var _0x9d8638='Metrics';return db[_0xd46e('0x51')][_0xd46e('0x4a')]({'where':{'name':_0x9d8638,'userProfileId':_0x4e84c8[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x25')](function(_0x1bd8a5){if(_0x1bd8a5&&_0x1bd8a5[_0xd46e('0x53')]===0x0){return db[_0xd46e('0x27')][_0xd46e('0x4c')]({'name':_0x479711['name'],'resourceId':_0x479711['id'],'type':_0x1bd8a5[_0xd46e('0x2b')],'sectionId':_0x1bd8a5['id']},{})[_0xd46e('0x25')](function(){return _0x1f1941;});}else{return _0x1f1941;}})[_0xd46e('0x4b')](function(_0x63ee74){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x63ee74);throw _0x63ee74;});}return _0x1f1941;})[_0xd46e('0x25')](respondWithResult(_0x5188f6,0xc9))['catch'](handleError(_0x5188f6,null));};exports[_0xd46e('0x24')]=function(_0x2af20b,_0x393cb9){if(_0x2af20b[_0xd46e('0x4d')]['id']){delete _0x2af20b[_0xd46e('0x4d')]['id'];}return db[_0xd46e('0x2e')]['find']({'where':{'id':_0x2af20b[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x393cb9,null))[_0xd46e('0x25')](saveUpdates(_0x2af20b['body'],null))[_0xd46e('0x25')](respondWithResult(_0x393cb9,null))[_0xd46e('0x4b')](handleError(_0x393cb9,null));};exports[_0xd46e('0x28')]=function(_0x2042d4,_0x1886e6){return db[_0xd46e('0x2e')][_0xd46e('0x4a')]({'where':{'id':_0x2042d4[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x1886e6,null))[_0xd46e('0x25')](removeEntity(_0x1886e6,null))[_0xd46e('0x4b')](handleError(_0x1886e6,null));}; \ No newline at end of file +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(_0x25a05b,_0x15616a){var _0x125e2c=function(_0xb3975e){while(--_0xb3975e){_0x25a05b['push'](_0x25a05b['shift']());}};_0x125e2c(++_0x15616a);}(_0xe5b3,0x133));var _0x3e5b=function(_0x3843af,_0x375e94){_0x3843af=_0x3843af-0x0;var _0x20543c=_0xe5b3[_0x3843af];return _0x20543c;};'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 0c04be7..c46bdb7 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 _0x5785=['request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','lodash','util','../../config/logger','api','moment'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x5785,0x119));var _0x5578=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x5785[_0x25d386];return _0x857f4a;};'use strict';var _=require(_0x5578('0x0'));var util=require(_0x5578('0x1'));var logger=require(_0x5578('0x2'))(_0x5578('0x3'));var moment=require(_0x5578('0x4'));var BPromise=require('bluebird');var rp=require(_0x5578('0x5'));var fs=require('fs');var path=require(_0x5578('0x6'));var rimraf=require(_0x5578('0x7'));var config=require(_0x5578('0x8'));var attributes=require(_0x5578('0x9'));module[_0x5578('0xa')]=function(_0x35a1f4,_0x1a9d73){return _0x35a1f4[_0x5578('0xb')](_0x5578('0xc'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdedd=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x1696c2,_0x4edb9e){var _0x378d16=function(_0x409a89){while(--_0x409a89){_0x1696c2['push'](_0x1696c2['shift']());}};_0x378d16(++_0x4edb9e);}(_0xdedd,0x197));var _0xdded=function(_0x28ef7c,_0x33f487){_0x28ef7c=_0x28ef7c-0x0;var _0x4f4eff=_0xdedd[_0x28ef7c];return _0x4f4eff;};'use strict';var _=require(_0xdded('0x0'));var util=require(_0xdded('0x1'));var logger=require(_0xdded('0x2'))(_0xdded('0x3'));var moment=require(_0xdded('0x4'));var BPromise=require('bluebird');var rp=require(_0xdded('0x5'));var fs=require('fs');var path=require(_0xdded('0x6'));var rimraf=require(_0xdded('0x7'));var config=require(_0xdded('0x8'));var attributes=require(_0xdded('0x9'));module[_0xdded('0xa')]=function(_0x2e327c,_0x277fab){return _0x2e327c['define']('AnalyticMetric',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 f823c45..a924b43 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 _0x169a=['error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x402763,_0x6fd307){var _0x40ab5=function(_0xa3dfc7){while(--_0xa3dfc7){_0x402763['push'](_0x402763['shift']());}};_0x40ab5(++_0x6fd307);}(_0x169a,0x6e));var _0xa169=function(_0x28381a,_0x4a6ed2){_0x28381a=_0x28381a-0x0;var _0x3f350d=_0x169a[_0x28381a];return _0x3f350d;};'use strict';var _=require(_0xa169('0x0'));var util=require(_0xa169('0x1'));var moment=require('moment');var BPromise=require(_0xa169('0x2'));var rs=require(_0xa169('0x3'));var fs=require('fs');var Redis=require(_0xa169('0x4'));var db=require(_0xa169('0x5'))['db'];var utils=require(_0xa169('0x6'));var logger=require(_0xa169('0x7'))(_0xa169('0x8'));var config=require(_0xa169('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa169('0xa')][_0xa169('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ee0a2,_0x185fc6,_0x9012cb){return new BPromise(function(_0x2f6c2a,_0x189769){return client['request'](_0x3ee0a2,_0x9012cb)['then'](function(_0x2c4d21){logger[_0xa169('0xc')](_0xa169('0xd'),_0x185fc6,_0xa169('0xe'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x185fc6,_0xa169('0xe'),JSON[_0xa169('0xf')](_0x2c4d21));if(_0x2c4d21[_0xa169('0x10')]){if(_0x2c4d21[_0xa169('0x10')][_0xa169('0x11')]===0x1f4){logger[_0xa169('0x10')](_0xa169('0xd'),_0x185fc6,_0x2c4d21[_0xa169('0x10')][_0xa169('0x12')]);return _0x189769(_0x2c4d21[_0xa169('0x10')][_0xa169('0x12')]);}logger[_0xa169('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x185fc6,_0x2c4d21[_0xa169('0x10')]['message']);return _0x2f6c2a(_0x2c4d21[_0xa169('0x10')][_0xa169('0x12')]);}else{logger['info'](_0xa169('0xd'),_0x185fc6,_0xa169('0xe'));_0x2f6c2a(_0x2c4d21[_0xa169('0x13')][_0xa169('0x12')]);}})[_0xa169('0x14')](function(_0x159f88){logger[_0xa169('0x10')](_0xa169('0xd'),_0x185fc6,_0x159f88);_0x189769(_0x159f88);});});} \ No newline at end of file +var _0x4724=['AnalyticMetric,\x20%s,\x20%s,\x20%s','code','error','message','AnalyticMetric,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug'];(function(_0x3c2303,_0x2c9560){var _0x97a5ed=function(_0x5e97a8){while(--_0x5e97a8){_0x3c2303['push'](_0x3c2303['shift']());}};_0x97a5ed(++_0x2c9560);}(_0x4724,0x187));var _0x4472=function(_0xd343,_0x47ddff){_0xd343=_0xd343-0x0;var _0x4886fa=_0x4724[_0xd343];return _0x4886fa;};'use strict';var _=require(_0x4472('0x0'));var util=require(_0x4472('0x1'));var moment=require(_0x4472('0x2'));var BPromise=require(_0x4472('0x3'));var rs=require(_0x4472('0x4'));var fs=require('fs');var Redis=require(_0x4472('0x5'));var db=require(_0x4472('0x6'))['db'];var utils=require(_0x4472('0x7'));var logger=require('../../config/logger')(_0x4472('0x8'));var config=require(_0x4472('0x9'));var jayson=require(_0x4472('0xa'));var client=jayson[_0x4472('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17dc23,_0x1190ac,_0xd0e0fc){return new BPromise(function(_0x2f9ac6,_0x492d6a){return client[_0x4472('0xc')](_0x17dc23,_0xd0e0fc)[_0x4472('0xd')](function(_0x5ef6c9){logger[_0x4472('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x1190ac,_0x4472('0xf'));logger[_0x4472('0x10')](_0x4472('0x11'),_0x1190ac,_0x4472('0xf'),JSON['stringify'](_0x5ef6c9));if(_0x5ef6c9['error']){if(_0x5ef6c9['error'][_0x4472('0x12')]===0x1f4){logger[_0x4472('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x1190ac,_0x5ef6c9['error'][_0x4472('0x14')]);return _0x492d6a(_0x5ef6c9[_0x4472('0x13')][_0x4472('0x14')]);}logger[_0x4472('0x13')](_0x4472('0x15'),_0x1190ac,_0x5ef6c9[_0x4472('0x13')][_0x4472('0x14')]);return _0x2f9ac6(_0x5ef6c9['error'][_0x4472('0x14')]);}else{logger[_0x4472('0xe')](_0x4472('0x15'),_0x1190ac,'request\x20sent');_0x2f9ac6(_0x5ef6c9[_0x4472('0x16')][_0x4472('0x14')]);}})[_0x4472('0x17')](function(_0x1e6989){logger['error'](_0x4472('0x15'),_0x1190ac,_0x1e6989);_0x492d6a(_0x1e6989);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 18d122b..d58477c 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 _0x9a6b=['post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show'];(function(_0x286a2c,_0x587871){var _0x356e75=function(_0x26a4cc){while(--_0x26a4cc){_0x286a2c['push'](_0x286a2c['shift']());}};_0x356e75(++_0x587871);}(_0x9a6b,0x77));var _0xb9a6=function(_0x21e98d,_0xc09284){_0x21e98d=_0x21e98d-0x0;var _0x140c2b=_0x9a6b[_0x21e98d];return _0x140c2b;};'use strict';var multer=require(_0xb9a6('0x0'));var util=require(_0xb9a6('0x1'));var path=require(_0xb9a6('0x2'));var timeout=require(_0xb9a6('0x3'));var express=require(_0xb9a6('0x4'));var router=express[_0xb9a6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb9a6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb9a6('0x7'));var controller=require(_0xb9a6('0x8'));router[_0xb9a6('0x9')]('/',auth[_0xb9a6('0xa')](),controller[_0xb9a6('0xb')]);router[_0xb9a6('0x9')](_0xb9a6('0xc'),auth[_0xb9a6('0xa')](),controller[_0xb9a6('0xd')]);router[_0xb9a6('0xe')]('/',auth['isAuthenticated'](),controller[_0xb9a6('0xf')]);router[_0xb9a6('0x10')]('/:id',auth[_0xb9a6('0xa')](),controller[_0xb9a6('0x11')]);router[_0xb9a6('0x12')](_0xb9a6('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x78b7=['create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x487f48,_0x5dd2dc){var _0x3a39f8=function(_0x4afbf4){while(--_0x4afbf4){_0x487f48['push'](_0x487f48['shift']());}};_0x3a39f8(++_0x5dd2dc);}(_0x78b7,0x194));var _0x778b=function(_0x270305,_0x43a385){_0x270305=_0x270305-0x0;var _0x4014e3=_0x78b7[_0x270305];return _0x4014e3;};'use strict';var multer=require(_0x778b('0x0'));var util=require(_0x778b('0x1'));var path=require('path');var timeout=require(_0x778b('0x2'));var express=require(_0x778b('0x3'));var router=express[_0x778b('0x4')]();var fs_extra=require(_0x778b('0x5'));var auth=require(_0x778b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x778b('0x7'));router[_0x778b('0x8')]('/',auth[_0x778b('0x9')](),controller[_0x778b('0xa')]);router[_0x778b('0x8')](_0x778b('0xb'),auth['isAuthenticated'](),controller[_0x778b('0xc')]);router[_0x778b('0xd')]('/',auth[_0x778b('0x9')](),controller[_0x778b('0xe')]);router[_0x778b('0xf')]('/:id',auth[_0x778b('0x9')](),controller[_0x778b('0x10')]);router['delete'](_0x778b('0xb'),auth[_0x778b('0x9')](),controller[_0x778b('0x11')]);module[_0x778b('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 5c6c57d..5c7d107 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 _0x2ed4=['TEXT','sequelize'];(function(_0x3f3bdd,_0x59bbec){var _0x1a0457=function(_0x420e04){while(--_0x420e04){_0x3f3bdd['push'](_0x3f3bdd['shift']());}};_0x1a0457(++_0x59bbec);}(_0x2ed4,0x1b3));var _0x42ed=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0x2ed4[_0x903228];return _0xcec81d;};'use strict';var Sequelize=require(_0x42ed('0x0'));module['exports']={'tree':{'type':Sequelize[_0x42ed('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xa668=['exports','TEXT'];(function(_0x2cabd5,_0x31dbd){var _0x4c02d7=function(_0x4a908c){while(--_0x4a908c){_0x2cabd5['push'](_0x2cabd5['shift']());}};_0x4c02d7(++_0x31dbd);}(_0xa668,0xe6));var _0x8a66=function(_0x3f6269,_0x3fd5ea){_0x3f6269=_0x3f6269-0x0;var _0x58f14d=_0xa668[_0x3f6269];return _0x58f14d;};'use strict';var Sequelize=require('sequelize');module[_0x8a66('0x0')]={'tree':{'type':Sequelize[_0x8a66('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index a964af8..9e8d6dc 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 _0x2d84=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','index','AnalyticTreeReport','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','includeAll','include','catch','show','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv'];(function(_0x164760,_0x5874b0){var _0x8b91b2=function(_0x40d20a){while(--_0x40d20a){_0x164760['push'](_0x164760['shift']());}};_0x8b91b2(++_0x5874b0);}(_0x2d84,0x166));var _0x42d8=function(_0x4dc60f,_0x2e44b4){_0x4dc60f=_0x4dc60f-0x0;var _0x187a06=_0x2d84[_0x4dc60f];return _0x187a06;};'use strict';var emlformat=require(_0x42d8('0x0'));var rimraf=require(_0x42d8('0x1'));var zipdir=require(_0x42d8('0x2'));var jsonpatch=require(_0x42d8('0x3'));var rp=require(_0x42d8('0x4'));var moment=require(_0x42d8('0x5'));var BPromise=require(_0x42d8('0x6'));var Mustache=require('mustache');var util=require(_0x42d8('0x7'));var path=require(_0x42d8('0x8'));var sox=require(_0x42d8('0x9'));var csv=require('to-csv');var ejs=require(_0x42d8('0xa'));var fs=require('fs');var fs_extra=require(_0x42d8('0xb'));var _=require(_0x42d8('0xc'));var squel=require('squel');var crypto=require(_0x42d8('0xd'));var jsforce=require(_0x42d8('0xe'));var deskjs=require(_0x42d8('0xf'));var toCsv=require(_0x42d8('0x10'));var querystring=require(_0x42d8('0x11'));var Papa=require(_0x42d8('0x12'));var Redis=require(_0x42d8('0x13'));var authService=require(_0x42d8('0x14'));var qs=require(_0x42d8('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x42d8('0x16'));var logger=require(_0x42d8('0x17'))(_0x42d8('0x18'));var utils=require(_0x42d8('0x19'));var config=require(_0x42d8('0x1a'));var licenseUtil=require(_0x42d8('0x1b'));var db=require(_0x42d8('0x1c'))['db'];function respondWithStatusCode(_0x182d01,_0x573c50){_0x573c50=_0x573c50||0xcc;return function(_0x36e4df){if(_0x36e4df){return _0x182d01['sendStatus'](_0x573c50);}return _0x182d01[_0x42d8('0x1d')](_0x573c50)[_0x42d8('0x1e')]();};}function respondWithResult(_0x123cfa,_0x186cbd){_0x186cbd=_0x186cbd||0xc8;return function(_0x33de85){if(_0x33de85){return _0x123cfa[_0x42d8('0x1d')](_0x186cbd)[_0x42d8('0x1f')](_0x33de85);}};}function respondWithFilteredResult(_0x258e40,_0x42a59d){return function(_0x25d2fc){if(_0x25d2fc){var _0x2a1866=typeof _0x42a59d[_0x42d8('0x20')]===_0x42d8('0x21')&&typeof _0x42a59d['limit']==='undefined';var _0x83b1ec=_0x25d2fc[_0x42d8('0x22')];var _0x9b0388=_0x2a1866?0x0:_0x42a59d['offset'];var _0x2e0778=_0x2a1866?_0x25d2fc[_0x42d8('0x22')]:_0x42a59d[_0x42d8('0x20')]+_0x42a59d[_0x42d8('0x23')];var _0x846b76;if(_0x2e0778>=_0x83b1ec){_0x2e0778=_0x83b1ec;_0x846b76=0xc8;}else{_0x846b76=0xce;}_0x258e40[_0x42d8('0x1d')](_0x846b76);return _0x258e40[_0x42d8('0x24')](_0x42d8('0x25'),_0x9b0388+'-'+_0x2e0778+'/'+_0x83b1ec)[_0x42d8('0x1f')](_0x25d2fc);}return null;};}function patchUpdates(_0x313cfa){return function(_0x3dd941){try{jsonpatch[_0x42d8('0x26')](_0x3dd941,_0x313cfa,!![]);}catch(_0x3e7111){return BPromise['reject'](_0x3e7111);}return _0x3dd941[_0x42d8('0x27')]();};}function saveUpdates(_0x269fa5,_0x243171){return function(_0x33af13){if(_0x33af13){return _0x33af13[_0x42d8('0x28')](_0x269fa5)[_0x42d8('0x29')](function(_0x12a63a){return _0x12a63a;});}return null;};}function removeEntity(_0x5b5065,_0x3413ea){return function(_0x42a6cd){if(_0x42a6cd){return _0x42a6cd[_0x42d8('0x2a')]()['then'](function(){_0x5b5065[_0x42d8('0x1d')](0xcc)[_0x42d8('0x1e')]();});}};}function handleEntityNotFound(_0xed917f,_0x3dd4ca){return function(_0x5e9bd9){if(!_0x5e9bd9){_0xed917f[_0x42d8('0x2b')](0x194);}return _0x5e9bd9;};}function handleError(_0x1465c2,_0x5f0615){_0x5f0615=_0x5f0615||0x1f4;return function(_0x337167){logger[_0x42d8('0x2c')](_0x337167['stack']);if(_0x337167[_0x42d8('0x2d')]){delete _0x337167[_0x42d8('0x2d')];}_0x1465c2[_0x42d8('0x1d')](_0x5f0615)[_0x42d8('0x2e')](_0x337167);};}exports[_0x42d8('0x2f')]=function(_0x10a9ea,_0x5e5ad9){var _0x4b4140={},_0x283c20={},_0x42b12b={'count':0x0,'rows':[]};var _0x95429e=_['map'](db[_0x42d8('0x30')][_0x42d8('0x31')],function(_0x4099ab){return{'name':_0x4099ab['fieldName'],'type':_0x4099ab['type'][_0x42d8('0x32')]};});_0x283c20[_0x42d8('0x33')]=_[_0x42d8('0x34')](_0x95429e,_0x42d8('0x2d'));_0x283c20[_0x42d8('0x35')]=_[_0x42d8('0x36')](_0x10a9ea[_0x42d8('0x35')]);_0x283c20[_0x42d8('0x37')]=_[_0x42d8('0x38')](_0x283c20[_0x42d8('0x33')],_0x283c20[_0x42d8('0x35')]);_0x4b4140[_0x42d8('0x39')]=_[_0x42d8('0x38')](_0x283c20[_0x42d8('0x33')],qs[_0x42d8('0x3a')](_0x10a9ea[_0x42d8('0x35')][_0x42d8('0x3a')]));_0x4b4140[_0x42d8('0x39')]=_0x4b4140[_0x42d8('0x39')][_0x42d8('0x3b')]?_0x4b4140[_0x42d8('0x39')]:_0x283c20[_0x42d8('0x33')];if(!_0x10a9ea[_0x42d8('0x35')]['hasOwnProperty'](_0x42d8('0x3c'))){_0x4b4140[_0x42d8('0x23')]=qs['limit'](_0x10a9ea['query'][_0x42d8('0x23')]);_0x4b4140[_0x42d8('0x20')]=qs[_0x42d8('0x20')](_0x10a9ea[_0x42d8('0x35')][_0x42d8('0x20')]);}_0x4b4140[_0x42d8('0x3d')]=qs[_0x42d8('0x3e')](_0x10a9ea[_0x42d8('0x35')][_0x42d8('0x3e')]);_0x4b4140[_0x42d8('0x3f')]=qs[_0x42d8('0x37')](_[_0x42d8('0x40')](_0x10a9ea[_0x42d8('0x35')],_0x283c20[_0x42d8('0x37')]),_0x95429e);if(_0x10a9ea[_0x42d8('0x35')]['filter']){_0x4b4140[_0x42d8('0x3f')]=_['merge'](_0x4b4140[_0x42d8('0x3f')],{'$or':_[_0x42d8('0x34')](_0x95429e,function(_0xa25d5b){if(_0xa25d5b['type']!=='VIRTUAL'){var _0x16e336={};_0x16e336[_0xa25d5b['name']]={'$like':'%'+_0x10a9ea[_0x42d8('0x35')][_0x42d8('0x41')]+'%'};return _0x16e336;}})});}_0x4b4140=_['merge']({},_0x4b4140,_0x10a9ea['options']);var _0x5598fb={'where':_0x4b4140[_0x42d8('0x3f')]};return db[_0x42d8('0x30')][_0x42d8('0x22')](_0x5598fb)[_0x42d8('0x29')](function(_0x36b3f6){_0x42b12b[_0x42d8('0x22')]=_0x36b3f6;if(_0x10a9ea[_0x42d8('0x35')][_0x42d8('0x42')]){_0x4b4140[_0x42d8('0x43')]=[{'all':!![]}];}return db[_0x42d8('0x30')]['findAll'](_0x4b4140);})[_0x42d8('0x29')](function(_0x405c55){_0x42b12b['rows']=_0x405c55;return _0x42b12b;})[_0x42d8('0x29')](respondWithFilteredResult(_0x5e5ad9,_0x4b4140))[_0x42d8('0x44')](handleError(_0x5e5ad9,null));};exports[_0x42d8('0x45')]=function(_0x17fb8d,_0x5ebda6){var _0x48c38e={'raw':!![],'where':{'id':_0x17fb8d['params']['id']}},_0x42d09e={};_0x42d09e[_0x42d8('0x33')]=_[_0x42d8('0x36')](db[_0x42d8('0x30')][_0x42d8('0x31')]);_0x42d09e['query']=_['keys'](_0x17fb8d[_0x42d8('0x35')]);_0x42d09e[_0x42d8('0x37')]=_[_0x42d8('0x38')](_0x42d09e[_0x42d8('0x33')],_0x42d09e[_0x42d8('0x35')]);_0x48c38e['attributes']=_['intersection'](_0x42d09e[_0x42d8('0x33')],qs[_0x42d8('0x3a')](_0x17fb8d[_0x42d8('0x35')][_0x42d8('0x3a')]));_0x48c38e['attributes']=_0x48c38e[_0x42d8('0x39')][_0x42d8('0x3b')]?_0x48c38e[_0x42d8('0x39')]:_0x42d09e[_0x42d8('0x33')];if(_0x17fb8d[_0x42d8('0x35')][_0x42d8('0x42')]){_0x48c38e['include']=[{'all':!![]}];}_0x48c38e=_['merge']({},_0x48c38e,_0x17fb8d[_0x42d8('0x46')]);return db[_0x42d8('0x30')][_0x42d8('0x47')](_0x48c38e)[_0x42d8('0x29')](handleEntityNotFound(_0x5ebda6,null))[_0x42d8('0x29')](respondWithResult(_0x5ebda6,null))['catch'](handleError(_0x5ebda6,null));};exports['create']=function(_0x2b0ef7,_0x7cecc5){return db[_0x42d8('0x30')][_0x42d8('0x48')](_0x2b0ef7['body'],{})[_0x42d8('0x29')](respondWithResult(_0x7cecc5,0xc9))[_0x42d8('0x44')](handleError(_0x7cecc5,null));};exports[_0x42d8('0x28')]=function(_0x1993cd,_0x4ba5da){if(_0x1993cd[_0x42d8('0x49')]['id']){delete _0x1993cd[_0x42d8('0x49')]['id'];}return db['AnalyticTreeReport'][_0x42d8('0x47')]({'where':{'id':_0x1993cd[_0x42d8('0x4a')]['id']}})[_0x42d8('0x29')](handleEntityNotFound(_0x4ba5da,null))[_0x42d8('0x29')](saveUpdates(_0x1993cd[_0x42d8('0x49')],null))[_0x42d8('0x29')](respondWithResult(_0x4ba5da,null))[_0x42d8('0x44')](handleError(_0x4ba5da,null));};exports['destroy']=function(_0xcb73e2,_0x634b2d){return db[_0x42d8('0x30')]['find']({'where':{'id':_0xcb73e2['params']['id']}})[_0x42d8('0x29')](handleEntityNotFound(_0x634b2d,null))[_0x42d8('0x29')](removeEntity(_0x634b2d,null))['catch'](handleError(_0x634b2d,null));}; \ No newline at end of file +var _0x13e6=['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','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0xcd816,_0x140292){var _0x3a19c3=function(_0x501714){while(--_0x501714){_0xcd816['push'](_0xcd816['shift']());}};_0x3a19c3(++_0x140292);}(_0x13e6,0x136));var _0x613e=function(_0xe7c4c3,_0x1586c9){_0xe7c4c3=_0xe7c4c3-0x0;var _0x5b4d0a=_0x13e6[_0xe7c4c3];return _0x5b4d0a;};'use strict';var emlformat=require(_0x613e('0x0'));var rimraf=require(_0x613e('0x1'));var zipdir=require(_0x613e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x613e('0x3'));var moment=require(_0x613e('0x4'));var BPromise=require(_0x613e('0x5'));var Mustache=require(_0x613e('0x6'));var util=require(_0x613e('0x7'));var path=require(_0x613e('0x8'));var sox=require(_0x613e('0x9'));var csv=require('to-csv');var ejs=require(_0x613e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x613e('0xb'));var squel=require(_0x613e('0xc'));var crypto=require(_0x613e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x613e('0xe'));var toCsv=require(_0x613e('0xf'));var querystring=require(_0x613e('0x10'));var Papa=require(_0x613e('0x11'));var Redis=require(_0x613e('0x12'));var authService=require(_0x613e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x613e('0x14'));var hardwareService=require(_0x613e('0x15'));var logger=require(_0x613e('0x16'))(_0x613e('0x17'));var utils=require(_0x613e('0x18'));var config=require(_0x613e('0x19'));var licenseUtil=require(_0x613e('0x1a'));var db=require(_0x613e('0x1b'))['db'];function respondWithStatusCode(_0x1895c7,_0x5c6f6b){_0x5c6f6b=_0x5c6f6b||0xcc;return function(_0x5f0c76){if(_0x5f0c76){return _0x1895c7[_0x613e('0x1c')](_0x5c6f6b);}return _0x1895c7[_0x613e('0x1d')](_0x5c6f6b)[_0x613e('0x1e')]();};}function respondWithResult(_0x4e2011,_0x5f5d14){_0x5f5d14=_0x5f5d14||0xc8;return function(_0x43fd1f){if(_0x43fd1f){return _0x4e2011[_0x613e('0x1d')](_0x5f5d14)['json'](_0x43fd1f);}};}function respondWithFilteredResult(_0x350b5d,_0x59a20a){return function(_0x106aef){if(_0x106aef){var _0x476cb2=typeof _0x59a20a['offset']===_0x613e('0x1f')&&typeof _0x59a20a[_0x613e('0x20')]===_0x613e('0x1f');var _0x24f757=_0x106aef[_0x613e('0x21')];var _0x2f5e8c=_0x476cb2?0x0:_0x59a20a[_0x613e('0x22')];var _0x526013=_0x476cb2?_0x106aef[_0x613e('0x21')]:_0x59a20a[_0x613e('0x22')]+_0x59a20a['limit'];var _0xede698;if(_0x526013>=_0x24f757){_0x526013=_0x24f757;_0xede698=0xc8;}else{_0xede698=0xce;}_0x350b5d['status'](_0xede698);return _0x350b5d[_0x613e('0x23')]('Content-Range',_0x2f5e8c+'-'+_0x526013+'/'+_0x24f757)[_0x613e('0x24')](_0x106aef);}return null;};}function patchUpdates(_0x4b988e){return function(_0x3d5bdb){try{jsonpatch[_0x613e('0x25')](_0x3d5bdb,_0x4b988e,!![]);}catch(_0x15c59a){return BPromise[_0x613e('0x26')](_0x15c59a);}return _0x3d5bdb[_0x613e('0x27')]();};}function saveUpdates(_0x4bfb00,_0x3c35e0){return function(_0x31b6a3){if(_0x31b6a3){return _0x31b6a3[_0x613e('0x28')](_0x4bfb00)[_0x613e('0x29')](function(_0x16d728){return _0x16d728;});}return null;};}function removeEntity(_0x1bd581,_0x46bdba){return function(_0x4288a5){if(_0x4288a5){return _0x4288a5[_0x613e('0x2a')]()[_0x613e('0x29')](function(){_0x1bd581[_0x613e('0x1d')](0xcc)[_0x613e('0x1e')]();});}};}function handleEntityNotFound(_0x145133,_0x4f5e85){return function(_0x1468ec){if(!_0x1468ec){_0x145133[_0x613e('0x1c')](0x194);}return _0x1468ec;};}function handleError(_0x5e5db2,_0x19ad4c){_0x19ad4c=_0x19ad4c||0x1f4;return function(_0x1e62b7){logger[_0x613e('0x2b')](_0x1e62b7[_0x613e('0x2c')]);if(_0x1e62b7[_0x613e('0x2d')]){delete _0x1e62b7[_0x613e('0x2d')];}_0x5e5db2[_0x613e('0x1d')](_0x19ad4c)[_0x613e('0x2e')](_0x1e62b7);};}exports[_0x613e('0x2f')]=function(_0x340cce,_0x377cab){var _0x13262f={},_0x571365={},_0x28dea6={'count':0x0,'rows':[]};var _0x3a011e=_[_0x613e('0x30')](db[_0x613e('0x31')][_0x613e('0x32')],function(_0x5e6322){return{'name':_0x5e6322['fieldName'],'type':_0x5e6322['type'][_0x613e('0x33')]};});_0x571365[_0x613e('0x34')]=_[_0x613e('0x30')](_0x3a011e,'name');_0x571365[_0x613e('0x35')]=_[_0x613e('0x36')](_0x340cce[_0x613e('0x35')]);_0x571365[_0x613e('0x37')]=_[_0x613e('0x38')](_0x571365[_0x613e('0x34')],_0x571365[_0x613e('0x35')]);_0x13262f['attributes']=_[_0x613e('0x38')](_0x571365[_0x613e('0x34')],qs[_0x613e('0x39')](_0x340cce[_0x613e('0x35')]['fields']));_0x13262f[_0x613e('0x3a')]=_0x13262f[_0x613e('0x3a')]['length']?_0x13262f[_0x613e('0x3a')]:_0x571365[_0x613e('0x34')];if(!_0x340cce[_0x613e('0x35')][_0x613e('0x3b')](_0x613e('0x3c'))){_0x13262f[_0x613e('0x20')]=qs['limit'](_0x340cce[_0x613e('0x35')][_0x613e('0x20')]);_0x13262f[_0x613e('0x22')]=qs[_0x613e('0x22')](_0x340cce[_0x613e('0x35')]['offset']);}_0x13262f[_0x613e('0x3d')]=qs['sort'](_0x340cce[_0x613e('0x35')][_0x613e('0x3e')]);_0x13262f[_0x613e('0x3f')]=qs[_0x613e('0x37')](_[_0x613e('0x40')](_0x340cce[_0x613e('0x35')],_0x571365[_0x613e('0x37')]),_0x3a011e);if(_0x340cce[_0x613e('0x35')]['filter']){_0x13262f[_0x613e('0x3f')]=_[_0x613e('0x41')](_0x13262f['where'],{'$or':_[_0x613e('0x30')](_0x3a011e,function(_0x11d0ea){if(_0x11d0ea[_0x613e('0x42')]!=='VIRTUAL'){var _0x544293={};_0x544293[_0x11d0ea[_0x613e('0x2d')]]={'$like':'%'+_0x340cce[_0x613e('0x35')][_0x613e('0x43')]+'%'};return _0x544293;}})});}_0x13262f=_[_0x613e('0x41')]({},_0x13262f,_0x340cce[_0x613e('0x44')]);var _0x51256c={'where':_0x13262f['where']};return db[_0x613e('0x31')][_0x613e('0x21')](_0x51256c)['then'](function(_0x2b930a){_0x28dea6[_0x613e('0x21')]=_0x2b930a;if(_0x340cce['query'][_0x613e('0x45')]){_0x13262f[_0x613e('0x46')]=[{'all':!![]}];}return db[_0x613e('0x31')][_0x613e('0x47')](_0x13262f);})['then'](function(_0xeedb5a){_0x28dea6[_0x613e('0x48')]=_0xeedb5a;return _0x28dea6;})[_0x613e('0x29')](respondWithFilteredResult(_0x377cab,_0x13262f))[_0x613e('0x49')](handleError(_0x377cab,null));};exports[_0x613e('0x4a')]=function(_0x2fd59f,_0x33ce72){var _0x4f170a={'raw':!![],'where':{'id':_0x2fd59f[_0x613e('0x4b')]['id']}},_0x30b39a={};_0x30b39a['model']=_[_0x613e('0x36')](db[_0x613e('0x31')][_0x613e('0x32')]);_0x30b39a[_0x613e('0x35')]=_['keys'](_0x2fd59f['query']);_0x30b39a[_0x613e('0x37')]=_[_0x613e('0x38')](_0x30b39a[_0x613e('0x34')],_0x30b39a[_0x613e('0x35')]);_0x4f170a['attributes']=_[_0x613e('0x38')](_0x30b39a['model'],qs[_0x613e('0x39')](_0x2fd59f[_0x613e('0x35')][_0x613e('0x39')]));_0x4f170a[_0x613e('0x3a')]=_0x4f170a[_0x613e('0x3a')][_0x613e('0x4c')]?_0x4f170a['attributes']:_0x30b39a['model'];if(_0x2fd59f[_0x613e('0x35')]['includeAll']){_0x4f170a[_0x613e('0x46')]=[{'all':!![]}];}_0x4f170a=_[_0x613e('0x41')]({},_0x4f170a,_0x2fd59f['options']);return db[_0x613e('0x31')]['find'](_0x4f170a)['then'](handleEntityNotFound(_0x33ce72,null))[_0x613e('0x29')](respondWithResult(_0x33ce72,null))[_0x613e('0x49')](handleError(_0x33ce72,null));};exports['create']=function(_0x37a03f,_0x5224db){return db['AnalyticTreeReport'][_0x613e('0x4d')](_0x37a03f[_0x613e('0x4e')],{})[_0x613e('0x29')](respondWithResult(_0x5224db,0xc9))['catch'](handleError(_0x5224db,null));};exports[_0x613e('0x28')]=function(_0x44a715,_0x1991b4){if(_0x44a715[_0x613e('0x4e')]['id']){delete _0x44a715[_0x613e('0x4e')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x44a715[_0x613e('0x4b')]['id']}})[_0x613e('0x29')](handleEntityNotFound(_0x1991b4,null))['then'](saveUpdates(_0x44a715[_0x613e('0x4e')],null))[_0x613e('0x29')](respondWithResult(_0x1991b4,null))['catch'](handleError(_0x1991b4,null));};exports['destroy']=function(_0x223fee,_0x4fd1f4){return db[_0x613e('0x31')][_0x613e('0x4f')]({'where':{'id':_0x223fee[_0x613e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4fd1f4,null))[_0x613e('0x29')](removeEntity(_0x4fd1f4,null))[_0x613e('0x49')](handleError(_0x4fd1f4,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 7f58e98..0c73d0f 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 _0x2506=['rimraf','exports','AnalyticTreeReport','analytics_report_trees','lodash','api','moment','bluebird'];(function(_0x4432f2,_0x22697a){var _0x1c97d6=function(_0x1ab5df){while(--_0x1ab5df){_0x4432f2['push'](_0x4432f2['shift']());}};_0x1c97d6(++_0x22697a);}(_0x2506,0xf4));var _0x6250=function(_0x3ff448,_0x37439f){_0x3ff448=_0x3ff448-0x0;var _0xa318e5=_0x2506[_0x3ff448];return _0xa318e5;};'use strict';var _=require(_0x6250('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6250('0x1'));var moment=require(_0x6250('0x2'));var BPromise=require(_0x6250('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6250('0x4'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module[_0x6250('0x5')]=function(_0x3f29cc,_0x5a8d2b){return _0x3f29cc['define'](_0x6250('0x6'),attributes,{'tableName':_0x6250('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab03=['define','AnalyticTreeReport','analytics_report_trees','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports'];(function(_0x40a58a,_0x1dfcdf){var _0x58106f=function(_0x30b369){while(--_0x30b369){_0x40a58a['push'](_0x40a58a['shift']());}};_0x58106f(++_0x1dfcdf);}(_0xab03,0x196));var _0x3ab0=function(_0x223035,_0xbdad82){_0x223035=_0x223035-0x0;var _0x3d2958=_0xab03[_0x223035];return _0x3d2958;};'use strict';var _=require(_0x3ab0('0x0'));var util=require(_0x3ab0('0x1'));var logger=require('../../config/logger')(_0x3ab0('0x2'));var moment=require(_0x3ab0('0x3'));var BPromise=require(_0x3ab0('0x4'));var rp=require(_0x3ab0('0x5'));var fs=require('fs');var path=require(_0x3ab0('0x6'));var rimraf=require('rimraf');var config=require(_0x3ab0('0x7'));var attributes=require(_0x3ab0('0x8'));module[_0x3ab0('0x9')]=function(_0x2ab3be,_0x241f30){return _0x2ab3be[_0x3ab0('0xa')](_0x3ab0('0xb'),attributes,{'tableName':_0x3ab0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index b2f72f2..ab9d212 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x1118b2,_0x21baa2){var _0x68c2d1=function(_0x4c42fe){while(--_0x4c42fe){_0x1118b2['push'](_0x1118b2['shift']());}};_0x68c2d1(++_0x21baa2);}(_0x2ef3,0xba));var _0x32ef=function(_0x1b45a6,_0x29f534){_0x1b45a6=_0x1b45a6-0x0;var _0x1f78bd=_0x2ef3[_0x1b45a6];return _0x1f78bd;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x4da137,_0x5eb38c){var _0x34fa68=function(_0x367529){while(--_0x367529){_0x4da137['push'](_0x4da137['shift']());}};_0x34fa68(++_0x5eb38c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xc4aa[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index efbaf18..e7c0ae8 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 _0x9ffe=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','multer','path','express','Router'];(function(_0x4fd109,_0x33c503){var _0x30f0a6=function(_0xc11c0d){while(--_0xc11c0d){_0x4fd109['push'](_0x4fd109['shift']());}};_0x30f0a6(++_0x33c503);}(_0x9ffe,0x119));var _0xe9ff=function(_0x15e634,_0x28558e){_0x15e634=_0x15e634-0x0;var _0x4d5d95=_0x9ffe[_0x15e634];return _0x4d5d95;};'use strict';var multer=require(_0xe9ff('0x0'));var util=require('util');var path=require(_0xe9ff('0x1'));var timeout=require('connect-timeout');var express=require(_0xe9ff('0x2'));var router=express[_0xe9ff('0x3')]();var fs_extra=require(_0xe9ff('0x4'));var auth=require(_0xe9ff('0x5'));var interaction=require(_0xe9ff('0x6'));var config=require(_0xe9ff('0x7'));var controller=require(_0xe9ff('0x8'));router[_0xe9ff('0x9')]('/',auth['isAuthenticated'](),controller[_0xe9ff('0xa')]);router[_0xe9ff('0x9')](_0xe9ff('0xb'),auth[_0xe9ff('0xc')](),controller[_0xe9ff('0xd')]);router[_0xe9ff('0xe')]('/',auth[_0xe9ff('0xc')](),controller[_0xe9ff('0xf')]);router[_0xe9ff('0x10')](_0xe9ff('0xb'),auth[_0xe9ff('0xc')](),controller[_0xe9ff('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe9ff('0x12')]);module['exports']=router; \ No newline at end of file +var _0xce0a=['./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','update','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x450865,_0x46391a){var _0x4cb11a=function(_0x56dd61){while(--_0x56dd61){_0x450865['push'](_0x450865['shift']());}};_0x4cb11a(++_0x46391a);}(_0xce0a,0x8f));var _0xace0=function(_0x31c27f,_0x40294c){_0x31c27f=_0x31c27f-0x0;var _0x28f9c6=_0xce0a[_0x31c27f];return _0x28f9c6;};'use strict';var multer=require(_0xace0('0x0'));var util=require(_0xace0('0x1'));var path=require(_0xace0('0x2'));var timeout=require(_0xace0('0x3'));var express=require('express');var router=express[_0xace0('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xace0('0x5'));var config=require(_0xace0('0x6'));var controller=require(_0xace0('0x7'));router[_0xace0('0x8')]('/',auth[_0xace0('0x9')](),controller[_0xace0('0xa')]);router[_0xace0('0x8')](_0xace0('0xb'),auth[_0xace0('0x9')](),controller[_0xace0('0xc')]);router['post']('/',auth[_0xace0('0x9')](),controller['create']);router['put'](_0xace0('0xb'),auth['isAuthenticated'](),controller[_0xace0('0xd')]);router['delete'](_0xace0('0xb'),auth[_0xace0('0x9')](),controller['destroy']);module[_0xace0('0xe')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 1fbf74e..0b6e875 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 _0xbdfd=['STRING','sequelize'];(function(_0x3dc1c6,_0x8529a1){var _0x3c82ce=function(_0x5212d1){while(--_0x5212d1){_0x3dc1c6['push'](_0x3dc1c6['shift']());}};_0x3c82ce(++_0x8529a1);}(_0xbdfd,0x135));var _0xdbdf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbdfd[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xdbdf('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xdbdf('0x1')]},'type':{'type':Sequelize[_0xdbdf('0x1')]}}; \ No newline at end of file +var _0xa049=['STRING','sequelize','exports'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xa049,0x1db));var _0x9a04=function(_0x504582,_0x5b3965){_0x504582=_0x504582-0x0;var _0x43c6ce=_0xa049[_0x504582];return _0x43c6ce;};'use strict';var Sequelize=require(_0x9a04('0x0'));module[_0x9a04('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x9a04('0x2')]},'type':{'type':Sequelize[_0x9a04('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 3d2f76b..28375c3 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 _0x1035=['originalname','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','save','update','then','stack','name','send','index','map','Attachment','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','clone','include','get','createdAt','updatedAt','body','create','file'];(function(_0x103e0c,_0x4fd0b5){var _0x52267f=function(_0x2a3126){while(--_0x2a3126){_0x103e0c['push'](_0x103e0c['shift']());}};_0x52267f(++_0x4fd0b5);}(_0x1035,0x1cc));var _0x5103=function(_0x279755,_0x42ad77){_0x279755=_0x279755-0x0;var _0x138178=_0x1035[_0x279755];return _0x138178;};'use strict';var emlformat=require(_0x5103('0x0'));var rimraf=require(_0x5103('0x1'));var zipdir=require(_0x5103('0x2'));var jsonpatch=require(_0x5103('0x3'));var rp=require(_0x5103('0x4'));var moment=require(_0x5103('0x5'));var BPromise=require(_0x5103('0x6'));var Mustache=require('mustache');var util=require(_0x5103('0x7'));var path=require('path');var sox=require(_0x5103('0x8'));var csv=require(_0x5103('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5103('0xa'));var _=require('lodash');var squel=require(_0x5103('0xb'));var crypto=require(_0x5103('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5103('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5103('0xe'));var Papa=require('papaparse');var Redis=require(_0x5103('0xf'));var authService=require(_0x5103('0x10'));var qs=require(_0x5103('0x11'));var as=require(_0x5103('0x12'));var hardwareService=require(_0x5103('0x13'));var logger=require(_0x5103('0x14'))('api');var utils=require(_0x5103('0x15'));var config=require(_0x5103('0x16'));var licenseUtil=require(_0x5103('0x17'));var db=require(_0x5103('0x18'))['db'];function respondWithStatusCode(_0x180734,_0x8483ee){_0x8483ee=_0x8483ee||0xcc;return function(_0x5a30c1){if(_0x5a30c1){return _0x180734[_0x5103('0x19')](_0x8483ee);}return _0x180734[_0x5103('0x1a')](_0x8483ee)[_0x5103('0x1b')]();};}function respondWithResult(_0x3b588f,_0x1b0cdb){_0x1b0cdb=_0x1b0cdb||0xc8;return function(_0x29c11c){if(_0x29c11c){return _0x3b588f[_0x5103('0x1a')](_0x1b0cdb)[_0x5103('0x1c')](_0x29c11c);}};}function respondWithFilteredResult(_0x412f2d,_0x41565d){return function(_0xcc4251){if(_0xcc4251){var _0x223a6e=typeof _0x41565d['offset']===_0x5103('0x1d')&&typeof _0x41565d[_0x5103('0x1e')]===_0x5103('0x1d');var _0x449b9c=_0xcc4251['count'];var _0x355383=_0x223a6e?0x0:_0x41565d[_0x5103('0x1f')];var _0x4d0396=_0x223a6e?_0xcc4251['count']:_0x41565d[_0x5103('0x1f')]+_0x41565d[_0x5103('0x1e')];var _0x5d82c2;if(_0x4d0396>=_0x449b9c){_0x4d0396=_0x449b9c;_0x5d82c2=0xc8;}else{_0x5d82c2=0xce;}_0x412f2d['status'](_0x5d82c2);return _0x412f2d[_0x5103('0x20')](_0x5103('0x21'),_0x355383+'-'+_0x4d0396+'/'+_0x449b9c)['json'](_0xcc4251);}return null;};}function patchUpdates(_0x1833ed){return function(_0xb76285){try{jsonpatch[_0x5103('0x22')](_0xb76285,_0x1833ed,!![]);}catch(_0x441f3c){return BPromise['reject'](_0x441f3c);}return _0xb76285[_0x5103('0x23')]();};}function saveUpdates(_0x192b83,_0x4fbd87){return function(_0x251110){if(_0x251110){return _0x251110[_0x5103('0x24')](_0x192b83)[_0x5103('0x25')](function(_0x3ce836){return _0x3ce836;});}return null;};}function removeEntity(_0x395371,_0x5abfd0){return function(_0x1afbf8){if(_0x1afbf8){return _0x1afbf8['destroy']()[_0x5103('0x25')](function(){_0x395371[_0x5103('0x1a')](0xcc)[_0x5103('0x1b')]();});}};}function handleEntityNotFound(_0x1b53f5,_0x45a8fe){return function(_0x4b8b6d){if(!_0x4b8b6d){_0x1b53f5[_0x5103('0x19')](0x194);}return _0x4b8b6d;};}function handleError(_0xdfb136,_0x801e5d){_0x801e5d=_0x801e5d||0x1f4;return function(_0x44c120){logger['error'](_0x44c120[_0x5103('0x26')]);if(_0x44c120[_0x5103('0x27')]){delete _0x44c120[_0x5103('0x27')];}_0xdfb136[_0x5103('0x1a')](_0x801e5d)[_0x5103('0x28')](_0x44c120);};}exports[_0x5103('0x29')]=function(_0x3dbb6e,_0x3da022){var _0x3ce146={},_0x3313d3={},_0x4234fc={'count':0x0,'rows':[]};var _0x4a19ba=_[_0x5103('0x2a')](db[_0x5103('0x2b')]['rawAttributes'],function(_0x31a482){return{'name':_0x31a482[_0x5103('0x2c')],'type':_0x31a482[_0x5103('0x2d')][_0x5103('0x2e')]};});_0x3313d3[_0x5103('0x2f')]=_[_0x5103('0x2a')](_0x4a19ba,_0x5103('0x27'));_0x3313d3[_0x5103('0x30')]=_['keys'](_0x3dbb6e[_0x5103('0x30')]);_0x3313d3[_0x5103('0x31')]=_[_0x5103('0x32')](_0x3313d3[_0x5103('0x2f')],_0x3313d3['query']);_0x3ce146['attributes']=_[_0x5103('0x32')](_0x3313d3[_0x5103('0x2f')],qs[_0x5103('0x33')](_0x3dbb6e['query']['fields']));_0x3ce146['attributes']=_0x3ce146[_0x5103('0x34')][_0x5103('0x35')]?_0x3ce146[_0x5103('0x34')]:_0x3313d3['model'];if(!_0x3dbb6e[_0x5103('0x30')][_0x5103('0x36')](_0x5103('0x37'))){_0x3ce146[_0x5103('0x1e')]=qs[_0x5103('0x1e')](_0x3dbb6e[_0x5103('0x30')][_0x5103('0x1e')]);_0x3ce146['offset']=qs[_0x5103('0x1f')](_0x3dbb6e[_0x5103('0x30')][_0x5103('0x1f')]);}_0x3ce146['order']=qs[_0x5103('0x38')](_0x3dbb6e[_0x5103('0x30')][_0x5103('0x38')]);_0x3ce146[_0x5103('0x39')]=qs[_0x5103('0x31')](_[_0x5103('0x3a')](_0x3dbb6e[_0x5103('0x30')],_0x3313d3[_0x5103('0x31')]),_0x4a19ba);if(_0x3dbb6e[_0x5103('0x30')][_0x5103('0x3b')]){_0x3ce146[_0x5103('0x39')]=_[_0x5103('0x3c')](_0x3ce146[_0x5103('0x39')],{'$or':_[_0x5103('0x2a')](_0x4a19ba,function(_0x4d6c20){if(_0x4d6c20['type']!==_0x5103('0x3d')){var _0x32a4a2={};_0x32a4a2[_0x4d6c20[_0x5103('0x27')]]={'$like':'%'+_0x3dbb6e[_0x5103('0x30')][_0x5103('0x3b')]+'%'};return _0x32a4a2;}})});}_0x3ce146=_[_0x5103('0x3c')]({},_0x3ce146,_0x3dbb6e[_0x5103('0x3e')]);var _0x46a92f={'where':_0x3ce146[_0x5103('0x39')]};return db['Attachment'][_0x5103('0x3f')](_0x46a92f)[_0x5103('0x25')](function(_0x139069){_0x4234fc[_0x5103('0x3f')]=_0x139069;if(_0x3dbb6e[_0x5103('0x30')]['includeAll']){_0x3ce146['include']=[{'all':!![]}];}return db[_0x5103('0x2b')][_0x5103('0x40')](_0x3ce146);})['then'](function(_0x4712b9){_0x4234fc[_0x5103('0x41')]=_0x4712b9;return _0x4234fc;})[_0x5103('0x25')](respondWithFilteredResult(_0x3da022,_0x3ce146))[_0x5103('0x42')](handleError(_0x3da022,null));};exports[_0x5103('0x43')]=function(_0x165c6c,_0x342e46){var _0x129c07={'raw':!![],'where':{'id':_0x165c6c[_0x5103('0x44')]['id']}},_0x359a09={};_0x359a09[_0x5103('0x2f')]=_[_0x5103('0x45')](db[_0x5103('0x2b')][_0x5103('0x46')]);_0x359a09[_0x5103('0x30')]=_['keys'](_0x165c6c[_0x5103('0x30')]);_0x359a09[_0x5103('0x31')]=_[_0x5103('0x32')](_0x359a09['model'],_0x359a09[_0x5103('0x30')]);_0x129c07[_0x5103('0x34')]=_[_0x5103('0x32')](_0x359a09[_0x5103('0x2f')],qs[_0x5103('0x33')](_0x165c6c['query']['fields']));_0x129c07['attributes']=_0x129c07[_0x5103('0x34')][_0x5103('0x35')]?_0x129c07[_0x5103('0x34')]:_0x359a09[_0x5103('0x2f')];if(_0x165c6c[_0x5103('0x30')][_0x5103('0x47')]){_0x129c07['include']=[{'all':!![]}];}_0x129c07=_[_0x5103('0x3c')]({},_0x129c07,_0x165c6c[_0x5103('0x3e')]);return db[_0x5103('0x2b')]['find'](_0x129c07)[_0x5103('0x25')](handleEntityNotFound(_0x342e46,null))[_0x5103('0x25')](respondWithResult(_0x342e46,null))[_0x5103('0x42')](handleError(_0x342e46,null));};exports[_0x5103('0x48')]=function(_0x285068,_0x99c47f){var _0x2ec36c={'where':{'id':_0x285068['params']['id']}},_0x2f8838={};_0x2f8838[_0x5103('0x2f')]=_[_0x5103('0x45')](db[_0x5103('0x2b')][_0x5103('0x46')]);_0x2ec36c[_0x5103('0x34')]=_[_0x5103('0x32')](_0x2f8838['model'],qs['fields'](_0x285068[_0x5103('0x30')][_0x5103('0x33')]));_0x2ec36c[_0x5103('0x34')]=_0x2ec36c['attributes'][_0x5103('0x35')]?_0x2ec36c[_0x5103('0x34')]:_0x2f8838[_0x5103('0x2f')];if(_0x285068[_0x5103('0x30')][_0x5103('0x47')]){_0x2ec36c[_0x5103('0x49')]=[{'all':!![]}];}_0x2ec36c=_[_0x5103('0x3c')]({},_0x2ec36c,_0x285068[_0x5103('0x3e')]);return db[_0x5103('0x2b')]['find'](_0x2ec36c)[_0x5103('0x25')](handleEntityNotFound(_0x99c47f,null))['then'](function(_0x5790b9){if(_0x5790b9){var _0x4bf5a1=_0x5790b9[_0x5103('0x4a')]({'plain':!![]});_0x4bf5a1=qs['omit'](_0x4bf5a1,['id',_0x5103('0x4b'),_0x5103('0x4c')]);_0x285068[_0x5103('0x4d')]=_['omit'](_0x285068[_0x5103('0x4d')],['id','createdAt',_0x5103('0x4c')]);return db['Attachment'][_0x5103('0x4e')](_['merge'](_0x4bf5a1,_0x285068[_0x5103('0x4d')]),{'include':_0x285068['query'][_0x5103('0x47')]?[{'all':!![]}]:undefined});}})[_0x5103('0x25')](respondWithResult(_0x99c47f,0xc9))[_0x5103('0x42')](handleError(_0x99c47f,null));};exports[_0x5103('0x24')]=function(_0x4b133e,_0x3ad6eb){if(_0x4b133e['body']['id']){delete _0x4b133e[_0x5103('0x4d')]['id'];}return db[_0x5103('0x2b')]['find']({'where':{'id':_0x4b133e['params']['id']}})[_0x5103('0x25')](handleEntityNotFound(_0x3ad6eb,null))[_0x5103('0x25')](saveUpdates(_0x4b133e['body'],null))[_0x5103('0x25')](respondWithResult(_0x3ad6eb,null))[_0x5103('0x42')](handleError(_0x3ad6eb,null));};exports['destroy']=function(_0x410d9d,_0x48bc3f){return db[_0x5103('0x2b')]['find']({'where':{'id':_0x410d9d[_0x5103('0x44')]['id']}})['then'](handleEntityNotFound(_0x48bc3f,null))['then'](removeEntity(_0x48bc3f,null))[_0x5103('0x42')](handleError(_0x48bc3f,null));};exports[_0x5103('0x4e')]=function(_0x2a397d,_0x5a2fc8,_0x323a71){_0x2a397d[_0x5103('0x4d')][_0x5103('0x27')]=_0x2a397d[_0x5103('0x4f')][_0x5103('0x50')];_0x2a397d[_0x5103('0x4d')]['basename']=_0x2a397d[_0x5103('0x4f')]['filename'];_0x2a397d[_0x5103('0x4d')][_0x5103('0x2d')]=_0x2a397d[_0x5103('0x4f')][_0x5103('0x51')];return db[_0x5103('0x2b')]['create'](_0x2a397d[_0x5103('0x4d')])[_0x5103('0x25')](respondWithResult(_0x5a2fc8,0xc9))[_0x5103('0x42')](handleError(_0x5a2fc8,null));};exports[_0x5103('0x52')]=function(_0x35bc6c,_0x36767b,_0x17268c){return db[_0x5103('0x2b')][_0x5103('0x53')]({'where':{'id':_0x35bc6c[_0x5103('0x44')]['id']},'raw':!![]})[_0x5103('0x25')](handleEntityNotFound(_0x36767b,null))[_0x5103('0x25')](function(_0x1ec2c8){if(_0x1ec2c8){var _0x3128de=_0x1ec2c8[_0x5103('0x54')]!==null;var _0x47e9eb=path[_0x5103('0x55')](config[_0x5103('0x56')],_0x5103('0x57'));if(_0x3128de){_0x47e9eb=path['join'](_0x47e9eb,_0x5103('0x58'));}var _0x3bdef0=path[_0x5103('0x55')](_0x47e9eb,_0x1ec2c8[_0x5103('0x59')]);return _0x36767b[_0x5103('0x52')](_0x3bdef0);}})[_0x5103('0x42')](handleError(_0x36767b,null));}; \ No newline at end of file +var _0x3da9=['undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','type','VIRTUAL','options','Attachment','includeAll','rows','show','params','include','find','catch','clone','merge','get','omit','createdAt','updatedAt','body','create','originalname','file','filename','findOne','root','offline-chat/','basename','download','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x87898f,_0x52c7ac){var _0x3a48f0=function(_0x2fdbe8){while(--_0x2fdbe8){_0x87898f['push'](_0x87898f['shift']());}};_0x3a48f0(++_0x52c7ac);}(_0x3da9,0xeb));var _0x93da=function(_0x37cbcb,_0x11161d){_0x37cbcb=_0x37cbcb-0x0;var _0x4fc549=_0x3da9[_0x37cbcb];return _0x4fc549;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x93da('0x0'));var zipdir=require(_0x93da('0x1'));var jsonpatch=require(_0x93da('0x2'));var rp=require('request-promise');var moment=require(_0x93da('0x3'));var BPromise=require(_0x93da('0x4'));var Mustache=require(_0x93da('0x5'));var util=require(_0x93da('0x6'));var path=require(_0x93da('0x7'));var sox=require(_0x93da('0x8'));var csv=require('to-csv');var ejs=require(_0x93da('0x9'));var fs=require('fs');var fs_extra=require(_0x93da('0xa'));var _=require(_0x93da('0xb'));var squel=require(_0x93da('0xc'));var crypto=require('crypto');var jsforce=require(_0x93da('0xd'));var deskjs=require(_0x93da('0xe'));var toCsv=require(_0x93da('0xf'));var querystring=require(_0x93da('0x10'));var Papa=require(_0x93da('0x11'));var Redis=require(_0x93da('0x12'));var authService=require(_0x93da('0x13'));var qs=require(_0x93da('0x14'));var as=require(_0x93da('0x15'));var hardwareService=require(_0x93da('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x93da('0x17'));var config=require(_0x93da('0x18'));var licenseUtil=require(_0x93da('0x19'));var db=require(_0x93da('0x1a'))['db'];function respondWithStatusCode(_0x5918ad,_0x198e8d){_0x198e8d=_0x198e8d||0xcc;return function(_0x261922){if(_0x261922){return _0x5918ad[_0x93da('0x1b')](_0x198e8d);}return _0x5918ad[_0x93da('0x1c')](_0x198e8d)[_0x93da('0x1d')]();};}function respondWithResult(_0x4cb859,_0x489c6b){_0x489c6b=_0x489c6b||0xc8;return function(_0x1d02b8){if(_0x1d02b8){return _0x4cb859[_0x93da('0x1c')](_0x489c6b)[_0x93da('0x1e')](_0x1d02b8);}};}function respondWithFilteredResult(_0x4b9fb2,_0x8cb76d){return function(_0x28cbb9){if(_0x28cbb9){var _0x23d523=typeof _0x8cb76d[_0x93da('0x1f')]===_0x93da('0x20')&&typeof _0x8cb76d[_0x93da('0x21')]===_0x93da('0x20');var _0x15a7ec=_0x28cbb9[_0x93da('0x22')];var _0x3768e1=_0x23d523?0x0:_0x8cb76d['offset'];var _0x569cdb=_0x23d523?_0x28cbb9['count']:_0x8cb76d[_0x93da('0x1f')]+_0x8cb76d[_0x93da('0x21')];var _0x5b3eb9;if(_0x569cdb>=_0x15a7ec){_0x569cdb=_0x15a7ec;_0x5b3eb9=0xc8;}else{_0x5b3eb9=0xce;}_0x4b9fb2[_0x93da('0x1c')](_0x5b3eb9);return _0x4b9fb2['set'](_0x93da('0x23'),_0x3768e1+'-'+_0x569cdb+'/'+_0x15a7ec)[_0x93da('0x1e')](_0x28cbb9);}return null;};}function patchUpdates(_0x15d6d1){return function(_0x1b3ee1){try{jsonpatch[_0x93da('0x24')](_0x1b3ee1,_0x15d6d1,!![]);}catch(_0x48ffe4){return BPromise[_0x93da('0x25')](_0x48ffe4);}return _0x1b3ee1[_0x93da('0x26')]();};}function saveUpdates(_0x4a28b,_0x56b219){return function(_0x43a153){if(_0x43a153){return _0x43a153[_0x93da('0x27')](_0x4a28b)[_0x93da('0x28')](function(_0x1a6194){return _0x1a6194;});}return null;};}function removeEntity(_0x54ca65,_0x53968b){return function(_0x6486ed){if(_0x6486ed){return _0x6486ed[_0x93da('0x29')]()[_0x93da('0x28')](function(){_0x54ca65[_0x93da('0x1c')](0xcc)[_0x93da('0x1d')]();});}};}function handleEntityNotFound(_0x212289,_0x2dff5d){return function(_0x29187d){if(!_0x29187d){_0x212289['sendStatus'](0x194);}return _0x29187d;};}function handleError(_0x146593,_0x168620){_0x168620=_0x168620||0x1f4;return function(_0xea0e58){logger[_0x93da('0x2a')](_0xea0e58[_0x93da('0x2b')]);if(_0xea0e58[_0x93da('0x2c')]){delete _0xea0e58[_0x93da('0x2c')];}_0x146593['status'](_0x168620)['send'](_0xea0e58);};}exports[_0x93da('0x2d')]=function(_0xae710c,_0x59072f){var _0x31b715={},_0x363545={},_0x2eed8a={'count':0x0,'rows':[]};var _0x503403=_[_0x93da('0x2e')](db['Attachment'][_0x93da('0x2f')],function(_0x42717b){return{'name':_0x42717b['fieldName'],'type':_0x42717b['type'][_0x93da('0x30')]};});_0x363545[_0x93da('0x31')]=_[_0x93da('0x2e')](_0x503403,_0x93da('0x2c'));_0x363545[_0x93da('0x32')]=_[_0x93da('0x33')](_0xae710c['query']);_0x363545[_0x93da('0x34')]=_[_0x93da('0x35')](_0x363545[_0x93da('0x31')],_0x363545['query']);_0x31b715[_0x93da('0x36')]=_[_0x93da('0x35')](_0x363545[_0x93da('0x31')],qs[_0x93da('0x37')](_0xae710c[_0x93da('0x32')][_0x93da('0x37')]));_0x31b715[_0x93da('0x36')]=_0x31b715['attributes'][_0x93da('0x38')]?_0x31b715[_0x93da('0x36')]:_0x363545['model'];if(!_0xae710c[_0x93da('0x32')]['hasOwnProperty'](_0x93da('0x39'))){_0x31b715[_0x93da('0x21')]=qs['limit'](_0xae710c['query'][_0x93da('0x21')]);_0x31b715[_0x93da('0x1f')]=qs[_0x93da('0x1f')](_0xae710c['query'][_0x93da('0x1f')]);}_0x31b715['order']=qs[_0x93da('0x3a')](_0xae710c['query'][_0x93da('0x3a')]);_0x31b715[_0x93da('0x3b')]=qs[_0x93da('0x34')](_[_0x93da('0x3c')](_0xae710c[_0x93da('0x32')],_0x363545['filters']),_0x503403);if(_0xae710c['query'][_0x93da('0x3d')]){_0x31b715[_0x93da('0x3b')]=_['merge'](_0x31b715[_0x93da('0x3b')],{'$or':_[_0x93da('0x2e')](_0x503403,function(_0x167af0){if(_0x167af0[_0x93da('0x3e')]!==_0x93da('0x3f')){var _0x1b76d0={};_0x1b76d0[_0x167af0[_0x93da('0x2c')]]={'$like':'%'+_0xae710c['query']['filter']+'%'};return _0x1b76d0;}})});}_0x31b715=_['merge']({},_0x31b715,_0xae710c[_0x93da('0x40')]);var _0x30494f={'where':_0x31b715['where']};return db[_0x93da('0x41')]['count'](_0x30494f)[_0x93da('0x28')](function(_0x2228e5){_0x2eed8a[_0x93da('0x22')]=_0x2228e5;if(_0xae710c[_0x93da('0x32')][_0x93da('0x42')]){_0x31b715['include']=[{'all':!![]}];}return db[_0x93da('0x41')]['findAll'](_0x31b715);})[_0x93da('0x28')](function(_0x2024fc){_0x2eed8a[_0x93da('0x43')]=_0x2024fc;return _0x2eed8a;})['then'](respondWithFilteredResult(_0x59072f,_0x31b715))['catch'](handleError(_0x59072f,null));};exports[_0x93da('0x44')]=function(_0x1776f6,_0x2b8b2a){var _0x22ac0e={'raw':!![],'where':{'id':_0x1776f6[_0x93da('0x45')]['id']}},_0x32c14a={};_0x32c14a['model']=_[_0x93da('0x33')](db[_0x93da('0x41')][_0x93da('0x2f')]);_0x32c14a[_0x93da('0x32')]=_['keys'](_0x1776f6[_0x93da('0x32')]);_0x32c14a[_0x93da('0x34')]=_[_0x93da('0x35')](_0x32c14a[_0x93da('0x31')],_0x32c14a['query']);_0x22ac0e[_0x93da('0x36')]=_[_0x93da('0x35')](_0x32c14a[_0x93da('0x31')],qs[_0x93da('0x37')](_0x1776f6[_0x93da('0x32')][_0x93da('0x37')]));_0x22ac0e[_0x93da('0x36')]=_0x22ac0e[_0x93da('0x36')]['length']?_0x22ac0e[_0x93da('0x36')]:_0x32c14a[_0x93da('0x31')];if(_0x1776f6['query']['includeAll']){_0x22ac0e[_0x93da('0x46')]=[{'all':!![]}];}_0x22ac0e=_['merge']({},_0x22ac0e,_0x1776f6[_0x93da('0x40')]);return db[_0x93da('0x41')][_0x93da('0x47')](_0x22ac0e)[_0x93da('0x28')](handleEntityNotFound(_0x2b8b2a,null))[_0x93da('0x28')](respondWithResult(_0x2b8b2a,null))[_0x93da('0x48')](handleError(_0x2b8b2a,null));};exports[_0x93da('0x49')]=function(_0x14029d,_0x49545f){var _0x495f49={'where':{'id':_0x14029d[_0x93da('0x45')]['id']}},_0x1c43b8={};_0x1c43b8[_0x93da('0x31')]=_[_0x93da('0x33')](db[_0x93da('0x41')][_0x93da('0x2f')]);_0x495f49[_0x93da('0x36')]=_[_0x93da('0x35')](_0x1c43b8[_0x93da('0x31')],qs[_0x93da('0x37')](_0x14029d[_0x93da('0x32')]['fields']));_0x495f49[_0x93da('0x36')]=_0x495f49[_0x93da('0x36')][_0x93da('0x38')]?_0x495f49['attributes']:_0x1c43b8[_0x93da('0x31')];if(_0x14029d[_0x93da('0x32')][_0x93da('0x42')]){_0x495f49[_0x93da('0x46')]=[{'all':!![]}];}_0x495f49=_[_0x93da('0x4a')]({},_0x495f49,_0x14029d[_0x93da('0x40')]);return db[_0x93da('0x41')][_0x93da('0x47')](_0x495f49)[_0x93da('0x28')](handleEntityNotFound(_0x49545f,null))[_0x93da('0x28')](function(_0x566ecc){if(_0x566ecc){var _0x50f364=_0x566ecc[_0x93da('0x4b')]({'plain':!![]});_0x50f364=qs[_0x93da('0x4c')](_0x50f364,['id',_0x93da('0x4d'),_0x93da('0x4e')]);_0x14029d[_0x93da('0x4f')]=_['omit'](_0x14029d[_0x93da('0x4f')],['id',_0x93da('0x4d'),'updatedAt']);return db[_0x93da('0x41')][_0x93da('0x50')](_[_0x93da('0x4a')](_0x50f364,_0x14029d[_0x93da('0x4f')]),{'include':_0x14029d['query'][_0x93da('0x42')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x49545f,0xc9))['catch'](handleError(_0x49545f,null));};exports[_0x93da('0x27')]=function(_0x41b3f1,_0x1c629b){if(_0x41b3f1[_0x93da('0x4f')]['id']){delete _0x41b3f1['body']['id'];}return db[_0x93da('0x41')]['find']({'where':{'id':_0x41b3f1[_0x93da('0x45')]['id']}})[_0x93da('0x28')](handleEntityNotFound(_0x1c629b,null))[_0x93da('0x28')](saveUpdates(_0x41b3f1['body'],null))[_0x93da('0x28')](respondWithResult(_0x1c629b,null))['catch'](handleError(_0x1c629b,null));};exports[_0x93da('0x29')]=function(_0x158f76,_0x16f5e5){return db[_0x93da('0x41')]['find']({'where':{'id':_0x158f76[_0x93da('0x45')]['id']}})[_0x93da('0x28')](handleEntityNotFound(_0x16f5e5,null))[_0x93da('0x28')](removeEntity(_0x16f5e5,null))[_0x93da('0x48')](handleError(_0x16f5e5,null));};exports['create']=function(_0x287317,_0x4ab71f,_0x47dd5b){_0x287317[_0x93da('0x4f')][_0x93da('0x2c')]=_0x287317['file'][_0x93da('0x51')];_0x287317[_0x93da('0x4f')]['basename']=_0x287317[_0x93da('0x52')][_0x93da('0x53')];_0x287317[_0x93da('0x4f')][_0x93da('0x3e')]=_0x287317[_0x93da('0x52')]['mimetype'];return db[_0x93da('0x41')][_0x93da('0x50')](_0x287317[_0x93da('0x4f')])['then'](respondWithResult(_0x4ab71f,0xc9))[_0x93da('0x48')](handleError(_0x4ab71f,null));};exports['download']=function(_0xe5c385,_0x3250d9,_0x2dabf9){return db[_0x93da('0x41')][_0x93da('0x54')]({'where':{'id':_0xe5c385['params']['id']},'raw':!![]})[_0x93da('0x28')](handleEntityNotFound(_0x3250d9,null))[_0x93da('0x28')](function(_0x3065b7){if(_0x3065b7){var _0x5443c5=_0x3065b7['ChatOfflineMessageId']!==null;var _0x4bc9d3=path['join'](config[_0x93da('0x55')],'server/files/attachments/');if(_0x5443c5){_0x4bc9d3=path['join'](_0x4bc9d3,_0x93da('0x56'));}var _0x42f732=path['join'](_0x4bc9d3,_0x3065b7[_0x93da('0x57')]);return _0x3250d9[_0x93da('0x58')](_0x42f732);}})['catch'](handleError(_0x3250d9,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 5aca596..85466aa 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 _0x09d5=['Attachment','attachments','lodash','api','moment','path','../../config/environment','./attachment.attributes'];(function(_0x28bd3f,_0x1cca1f){var _0x5c2f6e=function(_0x30f90d){while(--_0x30f90d){_0x28bd3f['push'](_0x28bd3f['shift']());}};_0x5c2f6e(++_0x1cca1f);}(_0x09d5,0xb2));var _0x509d=function(_0x50cd8f,_0x3dd413){_0x50cd8f=_0x50cd8f-0x0;var _0x150e52=_0x09d5[_0x50cd8f];return _0x150e52;};'use strict';var _=require(_0x509d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x509d('0x1'));var moment=require(_0x509d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x509d('0x3'));var rimraf=require('rimraf');var config=require(_0x509d('0x4'));var attributes=require(_0x509d('0x5'));module['exports']=function(_0x38887f,_0x4071b0){return _0x38887f['define'](_0x509d('0x6'),attributes,{'tableName':_0x509d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3483=['rimraf','../../config/environment','./attachment.attributes','exports','Attachment','attachments','lodash','api','moment','bluebird','request-promise'];(function(_0x3121f2,_0x3b6a45){var _0x5d1785=function(_0x34b030){while(--_0x34b030){_0x3121f2['push'](_0x3121f2['shift']());}};_0x5d1785(++_0x3b6a45);}(_0x3483,0x150));var _0x3348=function(_0x5bd6a0,_0x42fe62){_0x5bd6a0=_0x5bd6a0-0x0;var _0x5be3c1=_0x3483[_0x5bd6a0];return _0x5be3c1;};'use strict';var _=require(_0x3348('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3348('0x1'));var moment=require(_0x3348('0x2'));var BPromise=require(_0x3348('0x3'));var rp=require(_0x3348('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3348('0x5'));var config=require(_0x3348('0x6'));var attributes=require(_0x3348('0x7'));module[_0x3348('0x8')]=function(_0x5ec477,_0x118108){return _0x5ec477['define'](_0x3348('0x9'),attributes,{'tableName':_0x3348('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index d4adf99..ce24fbe 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 _0x447b=['catch','CreateAttachment','body','options','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x541c32,_0x3265d9){var _0x5b506a=function(_0x4e1936){while(--_0x4e1936){_0x541c32['push'](_0x541c32['shift']());}};_0x5b506a(++_0x3265d9);}(_0x447b,0xe4));var _0xb447=function(_0x2bbbc2,_0x2fd8b9){_0x2bbbc2=_0x2bbbc2-0x0;var _0x1f0319=_0x447b[_0x2bbbc2];return _0x1f0319;};'use strict';var _=require(_0xb447('0x0'));var util=require(_0xb447('0x1'));var moment=require('moment');var BPromise=require(_0xb447('0x2'));var rs=require(_0xb447('0x3'));var fs=require('fs');var Redis=require(_0xb447('0x4'));var db=require(_0xb447('0x5'))['db'];var utils=require(_0xb447('0x6'));var logger=require(_0xb447('0x7'))(_0xb447('0x8'));var config=require(_0xb447('0x9'));var jayson=require(_0xb447('0xa'));var client=jayson[_0xb447('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e0f42,_0x2e919c,_0x588700){return new BPromise(function(_0x3ea00b,_0x210bc5){return client[_0xb447('0xc')](_0x4e0f42,_0x588700)[_0xb447('0xd')](function(_0x1972c9){logger['info'](_0xb447('0xe'),_0x2e919c,_0xb447('0xf'));logger[_0xb447('0x10')](_0xb447('0x11'),_0x2e919c,'request\x20sent',JSON[_0xb447('0x12')](_0x1972c9));if(_0x1972c9[_0xb447('0x13')]){if(_0x1972c9[_0xb447('0x13')][_0xb447('0x14')]===0x1f4){logger[_0xb447('0x13')](_0xb447('0xe'),_0x2e919c,_0x1972c9[_0xb447('0x13')][_0xb447('0x15')]);return _0x210bc5(_0x1972c9[_0xb447('0x13')]['message']);}logger['error'](_0xb447('0xe'),_0x2e919c,_0x1972c9[_0xb447('0x13')]['message']);return _0x3ea00b(_0x1972c9[_0xb447('0x13')][_0xb447('0x15')]);}else{logger[_0xb447('0x16')]('Attachment,\x20%s,\x20%s',_0x2e919c,'request\x20sent');_0x3ea00b(_0x1972c9[_0xb447('0x17')]['message']);}})[_0xb447('0x18')](function(_0x5c98a9){logger[_0xb447('0x13')](_0xb447('0xe'),_0x2e919c,_0x5c98a9);_0x210bc5(_0x5c98a9);});});}exports[_0xb447('0x19')]=function(_0x23825c){var _0x1552bd=this;return new Promise(function(_0x3015ab,_0x2a019c){return db['Attachment']['create'](_0x23825c[_0xb447('0x1a')],{'raw':_0x23825c[_0xb447('0x1b')]?_0x23825c[_0xb447('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xb447('0xd')](function(_0x176366){logger[_0xb447('0x16')](_0xb447('0x19'),_0x23825c);logger[_0xb447('0x10')]('CreateAttachment',_0x23825c,JSON[_0xb447('0x12')](_0x176366));_0x3015ab(_0x176366);})[_0xb447('0x18')](function(_0xcba626){logger[_0xb447('0x13')](_0xb447('0x19'),_0xcba626[_0xb447('0x15')],_0x23825c);_0x2a019c(_0x1552bd['error'](0x1f4,_0xcba626[_0xb447('0x15')]));});});}; \ No newline at end of file +var _0xb903=['Attachment,\x20%s,\x20%s','message','info','result','create','options','then','CreateAttachment','debug','stringify','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x55df9b,_0x256647){var _0x1859cd=function(_0x20e23e){while(--_0x20e23e){_0x55df9b['push'](_0x55df9b['shift']());}};_0x1859cd(++_0x256647);}(_0xb903,0x185));var _0x3b90=function(_0x1c5e30,_0x4e5b0e){_0x1c5e30=_0x1c5e30-0x0;var _0x4880b5=_0xb903[_0x1c5e30];return _0x4880b5;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var BPromise=require(_0x3b90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b90('0x4'));var db=require(_0x3b90('0x5'))['db'];var utils=require(_0x3b90('0x6'));var logger=require(_0x3b90('0x7'))(_0x3b90('0x8'));var config=require(_0x3b90('0x9'));var jayson=require(_0x3b90('0xa'));var client=jayson['client'][_0x3b90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e845a,_0x55792c,_0x153283){return new BPromise(function(_0x2e4c06,_0x42efe8){return client[_0x3b90('0xc')](_0x5e845a,_0x153283)['then'](function(_0x5cda1d){logger['info']('Attachment,\x20%s,\x20%s',_0x55792c,'request\x20sent');logger['debug'](_0x3b90('0xd'),_0x55792c,_0x3b90('0xe'),JSON['stringify'](_0x5cda1d));if(_0x5cda1d[_0x3b90('0xf')]){if(_0x5cda1d[_0x3b90('0xf')]['code']===0x1f4){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x5cda1d[_0x3b90('0xf')]['message']);return _0x42efe8(_0x5cda1d['error'][_0x3b90('0x11')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x55792c,_0x5cda1d[_0x3b90('0xf')][_0x3b90('0x11')]);return _0x2e4c06(_0x5cda1d['error']['message']);}else{logger[_0x3b90('0x12')](_0x3b90('0x10'),_0x55792c,_0x3b90('0xe'));_0x2e4c06(_0x5cda1d[_0x3b90('0x13')][_0x3b90('0x11')]);}})['catch'](function(_0x494970){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x494970);_0x42efe8(_0x494970);});});}exports['CreateAttachment']=function(_0x269488){var _0x3cf281=this;return new Promise(function(_0x11ad7d,_0x131f3f){return db['Attachment'][_0x3b90('0x14')](_0x269488['body'],{'raw':_0x269488[_0x3b90('0x15')]?_0x269488[_0x3b90('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x3b90('0x16')](function(_0x12e1cf){logger[_0x3b90('0x12')](_0x3b90('0x17'),_0x269488);logger[_0x3b90('0x18')](_0x3b90('0x17'),_0x269488,JSON[_0x3b90('0x19')](_0x12e1cf));_0x11ad7d(_0x12e1cf);})[_0x3b90('0x1a')](function(_0xa98414){logger[_0x3b90('0xf')]('CreateAttachment',_0xa98414[_0x3b90('0x11')],_0x269488);_0x131f3f(_0x3cf281[_0x3b90('0xf')](0x1f4,_0xa98414[_0x3b90('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index b1582ba..9db9da4 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdb28,0x106));var _0x8db2=function(_0xd27165,_0x1c6d99){_0xd27165=_0xd27165-0x0;var _0x4cb772=_0xdb28[_0xd27165];return _0x4cb772;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file +var _0x757a=['put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','post','/:id/clone','clone','diskStorage','%s-%s','replace','single','file','create'];(function(_0x277715,_0x589457){var _0x4af325=function(_0x46a470){while(--_0x46a470){_0x277715['push'](_0x277715['shift']());}};_0x4af325(++_0x589457);}(_0x757a,0xde));var _0xa757=function(_0x174a5f,_0x4e580b){_0x174a5f=_0x174a5f-0x0;var _0x30dd50=_0x757a[_0x174a5f];return _0x30dd50;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['download']);router[_0xa757('0xc')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);var upload=multer({'storage':multer[_0xa757('0xf')]({'destination':function(_0x188ad5,_0x17408b,_0x483d77){_0x483d77(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4db68e,_0x421040,_0x544b45){_0x544b45(null,util['format'](_0xa757('0x10'),Date['now'](),_0x421040['originalname'][_0xa757('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa757('0xc')]('/',upload[_0xa757('0x12')](_0xa757('0x13')),controller[_0xa757('0x14')]);router[_0xa757('0x15')](_0xa757('0x16'),auth[_0xa757('0x9')](),controller[_0xa757('0x17')]);router[_0xa757('0x18')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0x19')]);module[_0xa757('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 896a7ae..ca823d8 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 _0xc9db=['ad-login','online','use','password','User','passport','passport-local','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','findOne','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt','role','disabled','blocked','blockedAt','admin','add','blockDuration','minutes','clearBlockUser','getLicense','status','send','message','login'];(function(_0x273de2,_0x1cb97d){var _0x25cad5=function(_0x145b4e){while(--_0x145b4e){_0x273de2['push'](_0x273de2['shift']());}};_0x25cad5(++_0x1cb97d);}(_0xc9db,0x1ac));var _0xbc9d=function(_0x1a1179,_0x443b7d){_0x1a1179=_0x1a1179-0x0;var _0x360a5e=_0xc9db[_0x1a1179];return _0x360a5e;};'use strict';var passport=require(_0xbc9d('0x0'));var LocalStrategy=require(_0xbc9d('0x1'))['Strategy'];var moment=require('moment');var ActiveDirectory=require(_0xbc9d('0x2'));var BPromise=require(_0xbc9d('0x3'));var util=require(_0xbc9d('0x4'));var db=require(_0xbc9d('0x5'))['db'];var authService=require(_0xbc9d('0x6'));var utils=require(_0xbc9d('0x7'));var config=require(_0xbc9d('0x8'));var logger=require(_0xbc9d('0x9'))(_0xbc9d('0xa'));function isActiveDirectoryConfigured(_0x2f4f4a){var _0x188590=![];if(typeof _0x2f4f4a[_0xbc9d('0xb')]!==_0xbc9d('0xc')){_0x188590=_0x2f4f4a[_0xbc9d('0xb')][_0xbc9d('0xd')]&&_0x2f4f4a[_0xbc9d('0xb')][_0xbc9d('0xe')]&&_0x2f4f4a['activedirectory']['domain'];}return _0x188590;}function adAuthenticate(_0x177643,_0x31eca8,_0x28079f){return new BPromise(function(_0x13b430,_0x5937d5){try{var _0x3001d7=new ActiveDirectory(_0x177643);_0x3001d7[_0xbc9d('0xf')](_0x31eca8,_0x28079f,function(_0x3d7f67,_0x31690){if(_0x3d7f67){logger[_0xbc9d('0x10')](_0xbc9d('0x11'),_0x31eca8,util[_0xbc9d('0x12')](_0x3d7f67,{'showHidden':![],'depth':null}));_0x5937d5(_0xbc9d('0x13'));}else if(!_0x31690){logger[_0xbc9d('0x10')](_0xbc9d('0x14'),_0x31eca8);_0x5937d5(_0xbc9d('0x13'));}else{_0x13b430(_0x31690);}});}catch(_0x339dad){_0x5937d5(_0x339dad);}});}function ActiveDirectoryAuthenticate(_0x27c0b6,_0x3c394b,_0x128996,_0x464c2c){var _0x1476ba,_0x159e4f;if(!isActiveDirectoryConfigured(config)){logger[_0xbc9d('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x3c394b);return _0x464c2c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xbc9d('0x15')][_0xbc9d('0x16')]({'where':{'id':0x1},'attributes':['adSsoEnabled','blockDuration'],'raw':!![]})[_0xbc9d('0x17')](function(_0x56bfd6){_0x1476ba=_0x56bfd6;if(!_0x1476ba[_0xbc9d('0x18')]){logger[_0xbc9d('0x10')](_0xbc9d('0x19'),_0x3c394b);throw new Error(_0xbc9d('0x13'));}return _0x27c0b6['findOne']({'attributes':['id',_0xbc9d('0x1a'),'password',_0xbc9d('0x1b'),_0xbc9d('0x1c'),_0xbc9d('0x1d'),_0xbc9d('0x1e'),_0xbc9d('0x1f'),'online'],'where':{'name':_0x3c394b,'role':{'$or':[_0xbc9d('0x20'),'user','agent']},'adSsoEnabled':!![]}});})[_0xbc9d('0x17')](function(_0x1f0231){if(!_0x1f0231||_0x1f0231&&_0x1f0231[_0xbc9d('0x1a')]!==_0x3c394b){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x159e4f=_0x1f0231;var _0x58b4ae=_0x159e4f[_0xbc9d('0x1a')]+'@'+config[_0xbc9d('0xb')]['domain'];return adAuthenticate(config[_0xbc9d('0xb')],_0x58b4ae,_0x128996);})[_0xbc9d('0x17')](function(_0x5bdfc5){if(_0x159e4f[_0xbc9d('0x1d')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x1476ba['blockDuration']>0x0){if(_0x159e4f[_0xbc9d('0x1e')]){if(moment(_0x159e4f[_0xbc9d('0x1f')])[_0xbc9d('0x21')](_0x1476ba[_0xbc9d('0x22')],_0xbc9d('0x23'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xbc9d('0x24')](_0x159e4f,0x0,![],null)[_0xbc9d('0x17')](function(){return utils[_0xbc9d('0x25')](_0x159e4f);})['then'](function(){return _0x464c2c(null,_0x159e4f);});}else{return utils[_0xbc9d('0x25')](_0x159e4f)[_0xbc9d('0x17')](function(){return _0x464c2c(null,_0x159e4f);});}}else{return utils[_0xbc9d('0x25')](_0x159e4f)[_0xbc9d('0x17')](function(){return _0x464c2c(null,_0x159e4f);});}})['catch'](function(_0x16fc46){return _0x464c2c(null,![],_0x16fc46);});}function handleError(_0x1cf218,_0x1dd135,_0x3dbe20){return _0x1cf218[_0xbc9d('0x26')](_0x1dd135||0x1f4)[_0xbc9d('0x27')]({'message':_0x3dbe20?_0x3dbe20[_0xbc9d('0x28')]||_0x3dbe20:''});}exports[_0xbc9d('0x29')]=function(_0x23e812,_0x4968bf,_0x1694d2){passport['authenticate'](_0xbc9d('0x2a'),function(_0x5a2e9c,_0x515a0a,_0x5769a4){var _0x23b8e0=_0x5a2e9c||_0x5769a4;if(_0x23b8e0){return handleError(_0x4968bf,0x191,_0x23b8e0);}if(!_0x515a0a){return handleError(_0x4968bf,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x483386={'payload':{'id':_0x515a0a['id'],'role':_0x515a0a['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x483386)[_0xbc9d('0x17')](function(_0x558440){_0x4968bf['json']({'id':_0x515a0a['id'],'token':_0x558440,'statusCall':'','isAlreadyLogged':_0x515a0a[_0xbc9d('0x2b')]});});}})(_0x23e812,_0x4968bf,_0x1694d2);};passport[_0xbc9d('0x2c')](_0xbc9d('0x2a'),new LocalStrategy({'usernameField':_0xbc9d('0x1a'),'passwordField':_0xbc9d('0x2d')},function(_0x1e4bd2,_0xb9542e,_0x41a1f6){return ActiveDirectoryAuthenticate(db[_0xbc9d('0x2e')],_0x1e4bd2,_0xb9542e,_0x41a1f6);})); \ No newline at end of file +var _0x87af=['role','disabled','blockedAt','online','user','then','minutes','clearBlockUser','getLicense','catch','send','message','login','json','use','ad-login','password','User','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/environment','../../config/logger','activedirectory','undefined','baseDN','url','domain','authenticate','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt'];(function(_0x397dcd,_0x44f397){var _0x431acf=function(_0x256b48){while(--_0x256b48){_0x397dcd['push'](_0x397dcd['shift']());}};_0x431acf(++_0x44f397);}(_0x87af,0x14d));var _0xf87a=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x87af[_0x3ab9ee];return _0x82ee88;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xf87a('0x0'))[_0xf87a('0x1')];var moment=require(_0xf87a('0x2'));var ActiveDirectory=require(_0xf87a('0x3'));var BPromise=require(_0xf87a('0x4'));var util=require(_0xf87a('0x5'));var db=require(_0xf87a('0x6'))['db'];var authService=require(_0xf87a('0x7'));var utils=require('../../config/utils');var config=require(_0xf87a('0x8'));var logger=require(_0xf87a('0x9'))('api');function isActiveDirectoryConfigured(_0x22d068){var _0x5f8973=![];if(typeof _0x22d068[_0xf87a('0xa')]!==_0xf87a('0xb')){_0x5f8973=_0x22d068[_0xf87a('0xa')][_0xf87a('0xc')]&&_0x22d068['activedirectory'][_0xf87a('0xd')]&&_0x22d068[_0xf87a('0xa')][_0xf87a('0xe')];}return _0x5f8973;}function adAuthenticate(_0x2aa8c0,_0x415e89,_0x274201){return new BPromise(function(_0x312e69,_0x1d5e4d){try{var _0x303024=new ActiveDirectory(_0x2aa8c0);_0x303024[_0xf87a('0xf')](_0x415e89,_0x274201,function(_0x3b6fd9,_0x4aa1c5){if(_0x3b6fd9){logger[_0xf87a('0x10')]('Error\x20authenticate\x20%s:\x20%s',_0x415e89,util[_0xf87a('0x11')](_0x3b6fd9,{'showHidden':![],'depth':null}));_0x1d5e4d(_0xf87a('0x12'));}else if(!_0x4aa1c5){logger[_0xf87a('0x10')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x415e89);_0x1d5e4d(_0xf87a('0x12'));}else{_0x312e69(_0x4aa1c5);}});}catch(_0x50c2ff){_0x1d5e4d(_0x50c2ff);}});}function ActiveDirectoryAuthenticate(_0x3a75e6,_0x3dccf8,_0x3ce17a,_0x2b7710){var _0x256491,_0x4f5201;if(!isActiveDirectoryConfigured(config)){logger[_0xf87a('0x10')](_0xf87a('0x13'),_0x3dccf8);return _0x2b7710(null,![],{'message':_0xf87a('0x12')});}return db[_0xf87a('0x14')][_0xf87a('0x15')]({'where':{'id':0x1},'attributes':[_0xf87a('0x16'),_0xf87a('0x17')],'raw':!![]})['then'](function(_0x61faf9){_0x256491=_0x61faf9;if(!_0x256491[_0xf87a('0x16')]){logger['error'](_0xf87a('0x18'),_0x3dccf8);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x3a75e6[_0xf87a('0x15')]({'attributes':['id',_0xf87a('0x19'),'password',_0xf87a('0x1a'),_0xf87a('0x1b'),_0xf87a('0x1c'),'blocked',_0xf87a('0x1d'),_0xf87a('0x1e')],'where':{'name':_0x3dccf8,'role':{'$or':['admin',_0xf87a('0x1f'),'agent']},'adSsoEnabled':!![]}});})['then'](function(_0x15289e){if(!_0x15289e||_0x15289e&&_0x15289e[_0xf87a('0x19')]!==_0x3dccf8){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x4f5201=_0x15289e;var _0x55174e=_0x4f5201[_0xf87a('0x19')]+'@'+config[_0xf87a('0xa')][_0xf87a('0xe')];return adAuthenticate(config[_0xf87a('0xa')],_0x55174e,_0x3ce17a);})[_0xf87a('0x20')](function(_0x516b43){if(_0x4f5201['disabled']){throw new Error(_0xf87a('0x12'));}if(_0x256491[_0xf87a('0x17')]>0x0){if(_0x4f5201['blocked']){if(moment(_0x4f5201[_0xf87a('0x1d')])['add'](_0x256491['blockDuration'],_0xf87a('0x21'))>moment()){throw new Error(_0xf87a('0x12'));}return utils[_0xf87a('0x22')](_0x4f5201,0x0,![],null)[_0xf87a('0x20')](function(){return utils[_0xf87a('0x23')](_0x4f5201);})[_0xf87a('0x20')](function(){return _0x2b7710(null,_0x4f5201);});}else{return utils[_0xf87a('0x23')](_0x4f5201)[_0xf87a('0x20')](function(){return _0x2b7710(null,_0x4f5201);});}}else{return utils[_0xf87a('0x23')](_0x4f5201)[_0xf87a('0x20')](function(){return _0x2b7710(null,_0x4f5201);});}})[_0xf87a('0x24')](function(_0x1d1d7a){return _0x2b7710(null,![],_0x1d1d7a);});}function handleError(_0x34d778,_0x51dfb0,_0x34c8a2){return _0x34d778['status'](_0x51dfb0||0x1f4)[_0xf87a('0x25')]({'message':_0x34c8a2?_0x34c8a2[_0xf87a('0x26')]||_0x34c8a2:''});}exports[_0xf87a('0x27')]=function(_0xcc288f,_0x43c8ad,_0x15da1c){passport[_0xf87a('0xf')]('ad-login',function(_0x3b8eae,_0xe97e46,_0x1dd4ab){var _0x270f0=_0x3b8eae||_0x1dd4ab;if(_0x270f0){return handleError(_0x43c8ad,0x191,_0x270f0);}if(!_0xe97e46){return handleError(_0x43c8ad,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x3263fb={'payload':{'id':_0xe97e46['id'],'role':_0xe97e46[_0xf87a('0x1b')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x3263fb)[_0xf87a('0x20')](function(_0x4d4a55){_0x43c8ad[_0xf87a('0x28')]({'id':_0xe97e46['id'],'token':_0x4d4a55,'statusCall':'','isAlreadyLogged':_0xe97e46[_0xf87a('0x1e')]});});}})(_0xcc288f,_0x43c8ad,_0x15da1c);};passport[_0xf87a('0x29')](_0xf87a('0x2a'),new LocalStrategy({'usernameField':_0xf87a('0x19'),'passwordField':_0xf87a('0x2b')},function(_0x3e1099,_0x533898,_0x274f41){return ActiveDirectoryAuthenticate(db[_0xf87a('0x2c')],_0x3e1099,_0x533898,_0x274f41);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 1176116..4e299d7 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 _0x5f4e=['Router','./authActiveDirectory.controller','post','login','exports'];(function(_0x4b57f8,_0x5b6df7){var _0x244e05=function(_0x14c9e1){while(--_0x14c9e1){_0x4b57f8['push'](_0x4b57f8['shift']());}};_0x244e05(++_0x5b6df7);}(_0x5f4e,0x12c));var _0xe5f4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5f4e[_0x20a584];return _0x4b41a8;};'use strict';var express=require('express');var router=express[_0xe5f4('0x0')]();var controller=require(_0xe5f4('0x1'));router[_0xe5f4('0x2')]('/',controller[_0xe5f4('0x3')]);module[_0xe5f4('0x4')]=router; \ No newline at end of file +var _0x2fb9=['Router','./authActiveDirectory.controller','post','exports','express'];(function(_0x535f2d,_0x2ca297){var _0x34a5d7=function(_0x21090b){while(--_0x21090b){_0x535f2d['push'](_0x535f2d['shift']());}};_0x34a5d7(++_0x2ca297);}(_0x2fb9,0x1e9));var _0x92fb=function(_0x3fea18,_0x386ae8){_0x3fea18=_0x3fea18-0x0;var _0x47a122=_0x2fb9[_0x3fea18];return _0x47a122;};'use strict';var express=require(_0x92fb('0x0'));var router=express[_0x92fb('0x1')]();var controller=require(_0x92fb('0x2'));router[_0x92fb('0x3')]('/',controller['login']);module[_0x92fb('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 525109c..d814197 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(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x7a54,0x106));var _0x47a5=function(_0xd45231,_0x4f9b8b){_0xd45231=_0xd45231-0x0;var _0x27d5cd=_0x7a54[_0xd45231];return _0x27d5cd;};'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(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x7a54,0x106));var _0x47a5=function(_0x388e39,_0x5ccd06){_0x388e39=_0x388e39-0x0;var _0x295484=_0x7a54[_0x388e39];return _0x295484;};'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 33361eb..35eda37 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 _0x7563=['express','Router','../user/user.controller.js','../../components/auth/service','get','/callback','callback','isMiddleware','login'];(function(_0x25b1f2,_0x3dcbc9){var _0x2bf065=function(_0x1ec50a){while(--_0x1ec50a){_0x25b1f2['push'](_0x25b1f2['shift']());}};_0x2bf065(++_0x3dcbc9);}(_0x7563,0x1a7));var _0x3756=function(_0x37dd70,_0x3f4854){_0x37dd70=_0x37dd70-0x0;var _0x1cc1c8=_0x7563[_0x37dd70];return _0x1cc1c8;};'use strict';var express=require(_0x3756('0x0'));var passport=require('passport');var router=express[_0x3756('0x1')]();var controller=require('./authGoogle.controller');var userController=require(_0x3756('0x2'));var authService=require(_0x3756('0x3'));router[_0x3756('0x4')]('/',controller['login']);router[_0x3756('0x4')](_0x3756('0x5'),controller[_0x3756('0x6')],authService[_0x3756('0x7')],userController[_0x3756('0x8')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file +var _0xeb84=['../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb84,0x194));var _0x4eb8=function(_0x330723,_0x8de382){_0x330723=_0x330723-0x0;var _0x60c546=_0xeb84[_0x330723];return _0x60c546;};'use strict';var express=require(_0x4eb8('0x0'));var passport=require(_0x4eb8('0x1'));var router=express[_0x4eb8('0x2')]();var controller=require(_0x4eb8('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0x4eb8('0x4'));router[_0x4eb8('0x5')]('/',controller[_0x4eb8('0x6')]);router[_0x4eb8('0x5')](_0x4eb8('0x7'),controller[_0x4eb8('0x8')],authService[_0x4eb8('0x9')],userController['login'],authService[_0x4eb8('0xa')]);module[_0x4eb8('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index e1b24b3..64e8590 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 _0x145f=['Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','password','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','use','util','passport','Strategy','jayson/promise','lodash','randomstring','moment','../../components/auth/service','../../config/utils','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','catch','find','email','CloudProvider','getSmtpOptions','format','Smtp','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','signToken','json','body','Email\x20parameter\x20is\x20missing','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','token','now'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x145f,0x9a));var _0xf145=function(_0x966cb1,_0x1ef843){_0x966cb1=_0x966cb1-0x0;var _0xc8b298=_0x145f[_0x966cb1];return _0xc8b298;};'use strict';var util=require(_0xf145('0x0'));var passport=require(_0xf145('0x1'));var LocalStrategy=require('passport-local')[_0xf145('0x2')];var jayson=require(_0xf145('0x3'));var _=require(_0xf145('0x4'));var rs=require(_0xf145('0x5'));var moment=require(_0xf145('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0xf145('0x7'));var utils=require(_0xf145('0x8'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x302b83,_0x3dd489,_0x15171c,_0x148e49){var _0x4da518,_0x128363;return db[_0xf145('0x9')][_0xf145('0xa')]({'where':{'id':0x1},'attributes':[_0xf145('0xb'),_0xf145('0xc')],'raw':!![]})[_0xf145('0xd')](function(_0x2c8875){_0x4da518=_0x2c8875;return _0x302b83[_0xf145('0xa')]({'attributes':['id',_0xf145('0xe'),'password','salt',_0xf145('0xf'),_0xf145('0x10'),_0xf145('0x11'),_0xf145('0x12'),_0xf145('0x13')],'where':{'name':_0x3dd489,'role':{'$or':[_0xf145('0x14'),_0xf145('0x15'),_0xf145('0x16')]}}});})[_0xf145('0xd')](function(_0x558e0a){if(!_0x558e0a||_0x558e0a&&_0x558e0a['name']!==_0x3dd489){throw new Error(_0xf145('0x17'));}else{_0x128363=_0x558e0a;return _0x128363;}})[_0xf145('0xd')](function(){_0x128363[_0xf145('0x18')](_0x15171c,function(_0x3fbe54,_0x1d7138){var _0x358be4=_0x128363[_0xf145('0x13')]+0x1;if(_0x3fbe54){return _0x148e49(_0x3fbe54);}else if(!_0x1d7138){if(_0x128363[_0xf145('0x10')]){return _0x148e49(null,![],{'message':_0xf145('0x17')});}else if(_0x4da518[_0xf145('0xb')]>0x0){if(_0x128363[_0xf145('0x11')]){if(_0x4da518[_0xf145('0xc')]>0x0){if(moment(_0x128363[_0xf145('0x12')])[_0xf145('0x19')](_0x4da518[_0xf145('0xc')],_0xf145('0x1a'))>moment()){return _0x148e49(null,![],{'message':_0xf145('0x17')});}else{return utils['clearBlockUser'](_0x128363,_0x358be4,![],null)['then'](function(){return _0x148e49(null,![],{'message':_0xf145('0x17')});});}}else{return _0x148e49(null,![],{'message':_0xf145('0x17')});}}else{if(_0x358be4>=_0x4da518[_0xf145('0xb')]){return utils['clearBlockUser'](_0x128363,0x0,!![],moment())[_0xf145('0xd')](function(){return _0x148e49(null,![],{'message':_0xf145('0x17')});});}else{return utils[_0xf145('0x1b')](_0x128363,_0x358be4,![],null)['then'](function(){return _0x148e49(null,![],{'message':_0xf145('0x17')});});}}}else{return _0x148e49(null,![],{'message':_0xf145('0x17')});}}else{if(_0x128363[_0xf145('0x10')]){return _0x148e49(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4da518[_0xf145('0xb')]>0x0){if(_0x128363['blocked']){if(_0x4da518['blockDuration']>0x0){if(moment(_0x128363[_0xf145('0x12')])[_0xf145('0x19')](_0x4da518[_0xf145('0xc')],_0xf145('0x1a'))>moment()){return _0x148e49(null,![],{'message':_0xf145('0x17')});}else{return utils[_0xf145('0x1b')](_0x128363,0x0,![],null)[_0xf145('0xd')](function(){return utils['getLicense'](_0x128363);})[_0xf145('0xd')](function(){return _0x148e49(null,_0x128363);});}}else{return _0x148e49(null,![],{'message':_0xf145('0x17')});}}else{return utils['clearBlockUser'](_0x128363,0x0,![],null)['then'](function(){return utils[_0xf145('0x1c')](_0x128363);})['then'](function(){return _0x148e49(null,_0x128363);})[_0xf145('0x1d')](function(_0x26d6e8){return _0x148e49(null,![],_0x26d6e8);});}}else{if(_0x128363[_0xf145('0x11')]){return _0x148e49(null,![],{'message':_0xf145('0x17')});}else{return utils[_0xf145('0x1c')](_0x128363)[_0xf145('0xd')](function(){return _0x148e49(null,_0x128363);});}}}});})[_0xf145('0x1d')](function(_0x50d6d9){return _0x148e49(null,![],_0x50d6d9);});}function sendServiceMail(_0x4aac3e){return db['MailAccount'][_0xf145('0x1e')]({'where':{'service':!![]},'attributes':['id',_0xf145('0xe'),_0xf145('0x1f')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0xf145('0x20')],'as':'CloudProvider'}]}]})['then'](function(_0x344034){if(!_0x344034){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x35e3c8=_0x344034[_0xf145('0x21')]();var _0x5b4985={'account':_0x35e3c8,'message':_['merge']({'from':util[_0xf145('0x22')]('\x22%s\x22\x20<%s>',_0x344034[_0xf145('0xe')],_0x344034[_0xf145('0x1f')]||_0x344034[_0xf145('0x23')][_0xf145('0x15')])},_0x4aac3e)};return client['request'](_0xf145('0x24'),_0x5b4985);})[_0xf145('0xd')](function(_0x1fcedb){if(_0x1fcedb[_0xf145('0x25')]){throw new Error(util[_0xf145('0x22')](_0xf145('0x26'),_0x1fcedb[_0xf145('0x25')][_0xf145('0x27')]||JSON[_0xf145('0x28')](_0x1fcedb[_0xf145('0x25')])));}return!![];});}function handleError(_0x58bf8f,_0x371ba4,_0x4bd458){return _0x58bf8f[_0xf145('0x29')](_0x371ba4||0x1f4)[_0xf145('0x2a')]({'message':_0x4bd458?_0x4bd458[_0xf145('0x27')]||_0x4bd458:''});}exports[_0xf145('0x2b')]=function(_0x109586,_0x5bc873,_0x57d00b){passport[_0xf145('0x18')](_0xf145('0x2c'),function(_0x6ae016,_0x48ddce,_0x33ddcd){var _0x238f8b=_0x6ae016||_0x33ddcd;if(_0x238f8b){return handleError(_0x5bc873,0x191,_0x238f8b);}if(!_0x48ddce){return handleError(_0x5bc873,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x12a5bc={'payload':{'id':_0x48ddce['id'],'role':_0x48ddce[_0xf145('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0xf145('0x2d')](_0x12a5bc)[_0xf145('0xd')](function(_0x2cc30c){_0x5bc873[_0xf145('0x2e')]({'id':_0x48ddce['id'],'token':_0x2cc30c,'statusCall':'','isAlreadyLogged':_0x48ddce['online']});});}})(_0x109586,_0x5bc873,_0x57d00b);};exports['forgot']=function(_0x421095,_0x3a49aa){if(!_0x421095[_0xf145('0x2f')][_0xf145('0x1f')]){return handleError(_0x3a49aa,0x1f4,{'message':_0xf145('0x30')});}var _0x4e8d63=rs['generate']();_0x421095[_0xf145('0x2f')]['email']=_0x421095[_0xf145('0x2f')][_0xf145('0x1f')]['trim']()[_0xf145('0x31')]();var _0x596de9;return db[_0xf145('0x9')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xf145('0xc')],'raw':!![]})[_0xf145('0xd')](function(_0x45acf9){_0x596de9=_0x45acf9;return db[_0xf145('0x32')][_0xf145('0x1e')]({'where':{'email':_0x421095[_0xf145('0x2f')]['email']}});})[_0xf145('0xd')](function(_0x4fe2e3){if(!_0x4fe2e3){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x4fe2e3['disabled']){throw new Error(_0xf145('0x33'));}if(_0x4fe2e3['blocked']){if(moment(_0x4fe2e3['blockedAt'])[_0xf145('0x19')](_0x596de9[_0xf145('0xc')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x4fe2e3[_0xf145('0x11')]=![];_0x4fe2e3['blockedAt']=null;}}_0x4fe2e3[_0xf145('0x34')]=_0x4e8d63;_0x4fe2e3['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x4fe2e3[_0xf145('0x35')]();})['then'](function(){return sendServiceMail({'to':_0x421095['body'][_0xf145('0x1f')],'subject':_0xf145('0x36'),'text':_0xf145('0x37')+_0xf145('0x38')+'https://'+_0x421095[_0xf145('0x39')][_0xf145('0x3a')]+_0xf145('0x3b')+_0x4e8d63+'\x0a\x0a'+_0xf145('0x3c')});})[_0xf145('0xd')](function(){_0x3a49aa[_0xf145('0x29')](0xc8)[_0xf145('0x2a')]({'message':_0xf145('0x3d')});})[_0xf145('0x1d')](function(_0x4e1c6c){return handleError(_0x3a49aa,0x1f4,_0x4e1c6c);});};exports['reset']=function(_0x5cd105,_0x148c64){return db['User'][_0xf145('0x1e')]({'where':{'resetPasswordToken':_0x5cd105[_0xf145('0x3e')][_0xf145('0x3f')],'resetPasswordExpires':{'$gt':Date[_0xf145('0x40')]()}}})['then'](function(_0xf75ca7){if(!_0xf75ca7){throw new Error(_0xf145('0x41'));}return db[_0xf145('0x9')]['findOne']({'attributes':['id',_0xf145('0x42'),_0xf145('0x43'),'passwordHistoryLimit']})[_0xf145('0xd')](function(_0xe252d4){if(_0xe252d4[_0xf145('0x42')])authService['validatePasswordPattern'](_0x5cd105[_0xf145('0x2f')][_0xf145('0x44')]);if(!_0xe252d4['enforcePasswordHistory']||!_0xf75ca7['previousPasswords'])return _0xf75ca7;authService[_0xf145('0x45')](_0x5cd105['body'][_0xf145('0x44')],_0xf75ca7['previousPasswords'],_0xe252d4['passwordHistoryLimit']);return _0xf75ca7;})['then'](function(){_0xf75ca7['password']=_0x5cd105[_0xf145('0x2f')]['password'];_0xf75ca7[_0xf145('0x34')]=null;_0xf75ca7[_0xf145('0x46')]=null;return _0xf75ca7['save']();});})[_0xf145('0xd')](function(){_0x148c64[_0xf145('0x29')](0xc8)[_0xf145('0x2a')]({'message':_0xf145('0x47')});})[_0xf145('0x1d')](function(_0x51102c){return handleError(_0x148c64,0x1f4,_0x51102c);});};passport[_0xf145('0x48')](_0xf145('0x2c'),new LocalStrategy({'usernameField':_0xf145('0xe'),'passwordField':_0xf145('0x44')},function(_0x4b9df9,_0x2f67f0,_0x2de518){return localAuthenticate(db['User'],_0x4b9df9,_0x2f67f0,_0x2de518);})); \ No newline at end of file +var _0x546e=['merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','body','Email\x20parameter\x20is\x20missing','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','previousPasswords','save','use','util','passport','passport-local','Strategy','jayson/promise','randomstring','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','getSmtpOptions'];(function(_0x381900,_0x2d2804){var _0x54da53=function(_0x56d214){while(--_0x56d214){_0x381900['push'](_0x381900['shift']());}};_0x54da53(++_0x2d2804);}(_0x546e,0x1bf));var _0xe546=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x546e[_0x1f9f37];return _0x21c080;};'use strict';var util=require(_0xe546('0x0'));var passport=require(_0xe546('0x1'));var LocalStrategy=require(_0xe546('0x2'))[_0xe546('0x3')];var jayson=require(_0xe546('0x4'));var _=require('lodash');var rs=require(_0xe546('0x5'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0xe546('0x6'));var utils=require(_0xe546('0x7'));var client=jayson['client'][_0xe546('0x8')]({'port':0x232b});function localAuthenticate(_0x425f62,_0x461cd5,_0x1cbfc1,_0x37ed73){var _0x58d355,_0x25bb51;return db[_0xe546('0x9')][_0xe546('0xa')]({'where':{'id':0x1},'attributes':[_0xe546('0xb'),_0xe546('0xc')],'raw':!![]})[_0xe546('0xd')](function(_0x3bbaec){_0x58d355=_0x3bbaec;return _0x425f62[_0xe546('0xa')]({'attributes':['id',_0xe546('0xe'),_0xe546('0xf'),_0xe546('0x10'),_0xe546('0x11'),_0xe546('0x12'),_0xe546('0x13'),_0xe546('0x14'),_0xe546('0x15')],'where':{'name':_0x461cd5,'role':{'$or':[_0xe546('0x16'),_0xe546('0x17'),_0xe546('0x18')]}}});})[_0xe546('0xd')](function(_0x2c861a){if(!_0x2c861a||_0x2c861a&&_0x2c861a['name']!==_0x461cd5){throw new Error(_0xe546('0x19'));}else{_0x25bb51=_0x2c861a;return _0x25bb51;}})[_0xe546('0xd')](function(){_0x25bb51[_0xe546('0x1a')](_0x1cbfc1,function(_0x2755e3,_0xb889a9){var _0x9701f2=_0x25bb51['loginAttempts']+0x1;if(_0x2755e3){return _0x37ed73(_0x2755e3);}else if(!_0xb889a9){if(_0x25bb51[_0xe546('0x12')]){return _0x37ed73(null,![],{'message':_0xe546('0x19')});}else if(_0x58d355[_0xe546('0xb')]>0x0){if(_0x25bb51[_0xe546('0x13')]){if(_0x58d355[_0xe546('0xc')]>0x0){if(moment(_0x25bb51[_0xe546('0x14')])[_0xe546('0x1b')](_0x58d355[_0xe546('0xc')],_0xe546('0x1c'))>moment()){return _0x37ed73(null,![],{'message':_0xe546('0x19')});}else{return utils[_0xe546('0x1d')](_0x25bb51,_0x9701f2,![],null)[_0xe546('0xd')](function(){return _0x37ed73(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x37ed73(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x9701f2>=_0x58d355['allowedLoginAttempts']){return utils[_0xe546('0x1d')](_0x25bb51,0x0,!![],moment())[_0xe546('0xd')](function(){return _0x37ed73(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xe546('0x1d')](_0x25bb51,_0x9701f2,![],null)[_0xe546('0xd')](function(){return _0x37ed73(null,![],{'message':_0xe546('0x19')});});}}}else{return _0x37ed73(null,![],{'message':_0xe546('0x19')});}}else{if(_0x25bb51['disabled']){return _0x37ed73(null,![],{'message':_0xe546('0x19')});}else if(_0x58d355[_0xe546('0xb')]>0x0){if(_0x25bb51[_0xe546('0x13')]){if(_0x58d355[_0xe546('0xc')]>0x0){if(moment(_0x25bb51[_0xe546('0x14')])[_0xe546('0x1b')](_0x58d355[_0xe546('0xc')],_0xe546('0x1c'))>moment()){return _0x37ed73(null,![],{'message':_0xe546('0x19')});}else{return utils[_0xe546('0x1d')](_0x25bb51,0x0,![],null)[_0xe546('0xd')](function(){return utils[_0xe546('0x1e')](_0x25bb51);})[_0xe546('0xd')](function(){return _0x37ed73(null,_0x25bb51);});}}else{return _0x37ed73(null,![],{'message':_0xe546('0x19')});}}else{return utils[_0xe546('0x1d')](_0x25bb51,0x0,![],null)[_0xe546('0xd')](function(){return utils['getLicense'](_0x25bb51);})['then'](function(){return _0x37ed73(null,_0x25bb51);})[_0xe546('0x1f')](function(_0x29134b){return _0x37ed73(null,![],_0x29134b);});}}else{if(_0x25bb51[_0xe546('0x13')]){return _0x37ed73(null,![],{'message':_0xe546('0x19')});}else{return utils[_0xe546('0x1e')](_0x25bb51)[_0xe546('0xd')](function(){return _0x37ed73(null,_0x25bb51);});}}}});})[_0xe546('0x1f')](function(_0x142016){return _0x37ed73(null,![],_0x142016);});}function sendServiceMail(_0x2e92f1){return db[_0xe546('0x20')][_0xe546('0x21')]({'where':{'service':!![]},'attributes':['id',_0xe546('0xe'),_0xe546('0x22')],'include':[{'model':db[_0xe546('0x23')],'as':_0xe546('0x24'),'include':[{'model':db[_0xe546('0x25')],'as':_0xe546('0x25')}]}]})[_0xe546('0xd')](function(_0x476738){if(!_0x476738){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x500226=_0x476738[_0xe546('0x26')]();var _0x59d9fb={'account':_0x500226,'message':_[_0xe546('0x27')]({'from':util[_0xe546('0x28')](_0xe546('0x29'),_0x476738[_0xe546('0xe')],_0x476738[_0xe546('0x22')]||_0x476738[_0xe546('0x24')][_0xe546('0x17')])},_0x2e92f1)};return client[_0xe546('0x2a')](_0xe546('0x2b'),_0x59d9fb);})[_0xe546('0xd')](function(_0x3783e8){if(_0x3783e8[_0xe546('0x2c')]){throw new Error(util[_0xe546('0x28')](_0xe546('0x2d'),_0x3783e8[_0xe546('0x2c')][_0xe546('0x2e')]||JSON[_0xe546('0x2f')](_0x3783e8[_0xe546('0x2c')])));}return!![];});}function handleError(_0x592397,_0x57c10c,_0x25b043){return _0x592397[_0xe546('0x30')](_0x57c10c||0x1f4)[_0xe546('0x31')]({'message':_0x25b043?_0x25b043[_0xe546('0x2e')]||_0x25b043:''});}exports[_0xe546('0x32')]=function(_0x1b3369,_0x35d24b,_0x46df24){passport[_0xe546('0x1a')](_0xe546('0x33'),function(_0xda4e00,_0x13d599,_0x24fce4){var _0x363144=_0xda4e00||_0x24fce4;if(_0x363144){return handleError(_0x35d24b,0x191,_0x363144);}if(!_0x13d599){return handleError(_0x35d24b,0x194,{'message':_0xe546('0x34')});}else{var _0x38b4a3={'payload':{'id':_0x13d599['id'],'role':_0x13d599['role']},'options':{'expiresIn':0x15180}};return authService[_0xe546('0x35')](_0x38b4a3)['then'](function(_0x3f2721){_0x35d24b[_0xe546('0x36')]({'id':_0x13d599['id'],'token':_0x3f2721,'statusCall':'','isAlreadyLogged':_0x13d599['online']});});}})(_0x1b3369,_0x35d24b,_0x46df24);};exports['forgot']=function(_0x468e04,_0x54a4ac){if(!_0x468e04[_0xe546('0x37')][_0xe546('0x22')]){return handleError(_0x54a4ac,0x1f4,{'message':_0xe546('0x38')});}var _0x5a75c0=rs['generate']();_0x468e04[_0xe546('0x37')]['email']=_0x468e04['body'][_0xe546('0x22')]['trim']()[_0xe546('0x39')]();var _0x4292c2;return db[_0xe546('0x9')][_0xe546('0xa')]({'where':{'id':0x1},'attributes':[_0xe546('0xb'),'blockDuration'],'raw':!![]})[_0xe546('0xd')](function(_0x42f8bf){_0x4292c2=_0x42f8bf;return db['User'][_0xe546('0x21')]({'where':{'email':_0x468e04[_0xe546('0x37')][_0xe546('0x22')]}});})[_0xe546('0xd')](function(_0x3874f7){if(!_0x3874f7){throw new Error(_0xe546('0x3a'));}if(_0x3874f7['disabled']){throw new Error(_0xe546('0x3b'));}if(_0x3874f7[_0xe546('0x13')]){if(moment(_0x3874f7[_0xe546('0x14')])[_0xe546('0x1b')](_0x4292c2[_0xe546('0xc')],_0xe546('0x1c'))>moment()){throw new Error(_0xe546('0x3c'));}else{_0x3874f7[_0xe546('0x13')]=![];_0x3874f7[_0xe546('0x14')]=null;}}_0x3874f7[_0xe546('0x3d')]=_0x5a75c0;_0x3874f7[_0xe546('0x3e')]=Date[_0xe546('0x3f')]()+0x36ee80;return _0x3874f7['save']();})[_0xe546('0xd')](function(){return sendServiceMail({'to':_0x468e04['body']['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xe546('0x40')+_0xe546('0x41')+_0xe546('0x42')+_0x468e04['headers'][_0xe546('0x43')]+_0xe546('0x44')+_0x5a75c0+'\x0a\x0a'+_0xe546('0x45')});})[_0xe546('0xd')](function(){_0x54a4ac['status'](0xc8)[_0xe546('0x31')]({'message':_0xe546('0x46')});})[_0xe546('0x1f')](function(_0x364564){return handleError(_0x54a4ac,0x1f4,_0x364564);});};exports[_0xe546('0x47')]=function(_0x5c2675,_0x22a91a){return db[_0xe546('0x48')][_0xe546('0x21')]({'where':{'resetPasswordToken':_0x5c2675['params'][_0xe546('0x49')],'resetPasswordExpires':{'$gt':Date[_0xe546('0x3f')]()}}})[_0xe546('0xd')](function(_0x3ba48a){if(!_0x3ba48a){throw new Error(_0xe546('0x4a'));}return db[_0xe546('0x9')][_0xe546('0xa')]({'attributes':['id','securePassword',_0xe546('0x4b'),_0xe546('0x4c')]})[_0xe546('0xd')](function(_0x525981){if(_0x525981[_0xe546('0x4d')])authService['validatePasswordPattern'](_0x5c2675[_0xe546('0x37')][_0xe546('0xf')]);if(!_0x525981['enforcePasswordHistory']||!_0x3ba48a['previousPasswords'])return _0x3ba48a;authService['validatePasswordHistory'](_0x5c2675[_0xe546('0x37')][_0xe546('0xf')],_0x3ba48a[_0xe546('0x4e')],_0x525981[_0xe546('0x4c')]);return _0x3ba48a;})[_0xe546('0xd')](function(){_0x3ba48a[_0xe546('0xf')]=_0x5c2675[_0xe546('0x37')][_0xe546('0xf')];_0x3ba48a[_0xe546('0x3d')]=null;_0x3ba48a[_0xe546('0x3e')]=null;return _0x3ba48a[_0xe546('0x4f')]();});})[_0xe546('0xd')](function(){_0x22a91a[_0xe546('0x30')](0xc8)[_0xe546('0x31')]({'message':'Password\x20reset!'});})['catch'](function(_0x538f1d){return handleError(_0x22a91a,0x1f4,_0x538f1d);});};passport[_0xe546('0x50')](_0xe546('0x33'),new LocalStrategy({'usernameField':_0xe546('0xe'),'passwordField':_0xe546('0xf')},function(_0x23b569,_0x537302,_0x267f3e){return localAuthenticate(db[_0xe546('0x48')],_0x23b569,_0x537302,_0x267f3e);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index ae53503..b5b93d8 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 _0x686e=['reset','Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token'];(function(_0x4ea44b,_0x546b89){var _0x418cc9=function(_0x1eb1e5){while(--_0x1eb1e5){_0x4ea44b['push'](_0x4ea44b['shift']());}};_0x418cc9(++_0x546b89);}(_0x686e,0xb9));var _0xe686=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x686e[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var router=express[_0xe686('0x0')]();var controller=require(_0xe686('0x1'));router[_0xe686('0x2')]('/',controller[_0xe686('0x3')]);router[_0xe686('0x2')](_0xe686('0x4'),controller[_0xe686('0x5')]);router[_0xe686('0x2')](_0xe686('0x6'),controller[_0xe686('0x7')]);module['exports']=router; \ No newline at end of file +var _0xdea2=['reset','exports','post','login','/forgot','forgot','/reset/:token'];(function(_0x301b80,_0x3aefbf){var _0x46ee80=function(_0x174fc1){while(--_0x174fc1){_0x301b80['push'](_0x301b80['shift']());}};_0x46ee80(++_0x3aefbf);}(_0xdea2,0xbf));var _0x2dea=function(_0x2e488e,_0x50b586){_0x2e488e=_0x2e488e-0x0;var _0x2b0900=_0xdea2[_0x2e488e];return _0x2b0900;};'use strict';var express=require('express');var router=express['Router']();var controller=require('./authLocal.controller');router[_0x2dea('0x0')]('/',controller[_0x2dea('0x1')]);router['post'](_0x2dea('0x2'),controller[_0x2dea('0x3')]);router[_0x2dea('0x0')](_0x2dea('0x4'),controller[_0x2dea('0x5')]);module[_0x2dea('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index c57c5a8..545f370 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 _0xec61=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x1443be,_0x31b17d){var _0x38823d=function(_0x2e57d7){while(--_0x2e57d7){_0x1443be['push'](_0x1443be['shift']());}};_0x38823d(++_0x31b17d);}(_0xec61,0x126));var _0x1ec6=function(_0x12f37d,_0x1f5e9d){_0x12f37d=_0x12f37d-0x0;var _0x205ab3=_0xec61[_0x12f37d];return _0x205ab3;};'use strict';var Sequelize=require(_0x1ec6('0x0'));module[_0x1ec6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x1ec6('0x2')]},'description':{'type':Sequelize[_0x1ec6('0x2')]},'status':{'type':Sequelize[_0x1ec6('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x1ec6('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x98d2=['STRING','sequelize','exports'];(function(_0x2a4578,_0x104646){var _0xb18fe7=function(_0x351cd){while(--_0x351cd){_0x2a4578['push'](_0x2a4578['shift']());}};_0xb18fe7(++_0x104646);}(_0x98d2,0xeb));var _0x298d=function(_0x2e76a7,_0x23871a){_0x2e76a7=_0x2e76a7-0x0;var _0x454cde=_0x98d2[_0x2e76a7];return _0x454cde;};'use strict';var Sequelize=require(_0x298d('0x0'));module[_0x298d('0x1')]={'name':{'type':Sequelize[_0x298d('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x298d('0x2')]},'description':{'type':Sequelize[_0x298d('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index a2543eb..62124de 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 _0x49f0=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','destroy','addConditions','Condition','ids','omit','getConditions','nolimit','Action','addActions','getActions','eml-format','request-promise','moment','mustache','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x56daff,_0xadca9a){var _0x132c82=function(_0x19e0d7){while(--_0x19e0d7){_0x56daff['push'](_0x56daff['shift']());}};_0x132c82(++_0xadca9a);}(_0x49f0,0xe0));var _0x049f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x49f0[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x049f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x049f('0x1'));var moment=require(_0x049f('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x049f('0x3'));var util=require('util');var path=require(_0x049f('0x4'));var sox=require(_0x049f('0x5'));var csv=require('to-csv');var ejs=require(_0x049f('0x6'));var fs=require('fs');var fs_extra=require(_0x049f('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x049f('0x8'));var jsforce=require(_0x049f('0x9'));var deskjs=require(_0x049f('0xa'));var toCsv=require(_0x049f('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x049f('0xc'));var qs=require(_0x049f('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x049f('0xe'));var logger=require(_0x049f('0xf'))(_0x049f('0x10'));var utils=require(_0x049f('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x049f('0x12'));var db=require(_0x049f('0x13'))['db'];function respondWithStatusCode(_0xd1f5b1,_0x2ae9bf){_0x2ae9bf=_0x2ae9bf||0xcc;return function(_0x4599e6){if(_0x4599e6){return _0xd1f5b1[_0x049f('0x14')](_0x2ae9bf);}return _0xd1f5b1[_0x049f('0x15')](_0x2ae9bf)[_0x049f('0x16')]();};}function respondWithResult(_0x4c7fe9,_0x560506){_0x560506=_0x560506||0xc8;return function(_0x2e4b1d){if(_0x2e4b1d){return _0x4c7fe9[_0x049f('0x15')](_0x560506)[_0x049f('0x17')](_0x2e4b1d);}};}function respondWithFilteredResult(_0x480ce9,_0x2f0cf1){return function(_0x3b5f02){if(_0x3b5f02){var _0x4117d8=typeof _0x2f0cf1['offset']===_0x049f('0x18')&&typeof _0x2f0cf1[_0x049f('0x19')]===_0x049f('0x18');var _0x39dc4f=_0x3b5f02[_0x049f('0x1a')];var _0x3298a4=_0x4117d8?0x0:_0x2f0cf1[_0x049f('0x1b')];var _0x15ea1e=_0x4117d8?_0x3b5f02[_0x049f('0x1a')]:_0x2f0cf1[_0x049f('0x1b')]+_0x2f0cf1['limit'];var _0x1b3ea2;if(_0x15ea1e>=_0x39dc4f){_0x15ea1e=_0x39dc4f;_0x1b3ea2=0xc8;}else{_0x1b3ea2=0xce;}_0x480ce9[_0x049f('0x15')](_0x1b3ea2);return _0x480ce9[_0x049f('0x1c')]('Content-Range',_0x3298a4+'-'+_0x15ea1e+'/'+_0x39dc4f)['json'](_0x3b5f02);}return null;};}function patchUpdates(_0x4f3d55){return function(_0x130097){try{jsonpatch[_0x049f('0x1d')](_0x130097,_0x4f3d55,!![]);}catch(_0x5442cb){return BPromise[_0x049f('0x1e')](_0x5442cb);}return _0x130097[_0x049f('0x1f')]();};}function saveUpdates(_0x4f23f4,_0x3c42f8){return function(_0xff7bd9){if(_0xff7bd9){return _0xff7bd9[_0x049f('0x20')](_0x4f23f4)[_0x049f('0x21')](function(_0x25c5d5){return _0x25c5d5;});}return null;};}function removeEntity(_0x4baf70,_0x3c690d){return function(_0x5225a1){if(_0x5225a1){return _0x5225a1['destroy']()[_0x049f('0x21')](function(){_0x4baf70['status'](0xcc)[_0x049f('0x16')]();});}};}function handleEntityNotFound(_0x42d4dd,_0x444449){return function(_0x146c45){if(!_0x146c45){_0x42d4dd[_0x049f('0x14')](0x194);}return _0x146c45;};}function handleError(_0x47c2b4,_0x49740b){_0x49740b=_0x49740b||0x1f4;return function(_0xa31b90){logger['error'](_0xa31b90[_0x049f('0x22')]);if(_0xa31b90[_0x049f('0x23')]){delete _0xa31b90[_0x049f('0x23')];}_0x47c2b4[_0x049f('0x15')](_0x49740b)[_0x049f('0x24')](_0xa31b90);};}exports[_0x049f('0x25')]=function(_0x49ccf9,_0x356d30){var _0x6d3c74={},_0x51ce65={},_0x31d7a4={'count':0x0,'rows':[]};var _0x5eb7f4=_[_0x049f('0x26')](db[_0x049f('0x27')][_0x049f('0x28')],function(_0x49baf0){return{'name':_0x49baf0[_0x049f('0x29')],'type':_0x49baf0[_0x049f('0x2a')][_0x049f('0x2b')]};});_0x51ce65[_0x049f('0x2c')]=_[_0x049f('0x26')](_0x5eb7f4,_0x049f('0x23'));_0x51ce65['query']=_[_0x049f('0x2d')](_0x49ccf9[_0x049f('0x2e')]);_0x51ce65[_0x049f('0x2f')]=_[_0x049f('0x30')](_0x51ce65['model'],_0x51ce65[_0x049f('0x2e')]);_0x6d3c74[_0x049f('0x31')]=_['intersection'](_0x51ce65[_0x049f('0x2c')],qs[_0x049f('0x32')](_0x49ccf9[_0x049f('0x2e')][_0x049f('0x32')]));_0x6d3c74['attributes']=_0x6d3c74[_0x049f('0x31')][_0x049f('0x33')]?_0x6d3c74['attributes']:_0x51ce65[_0x049f('0x2c')];if(!_0x49ccf9[_0x049f('0x2e')][_0x049f('0x34')]('nolimit')){_0x6d3c74[_0x049f('0x19')]=qs[_0x049f('0x19')](_0x49ccf9[_0x049f('0x2e')]['limit']);_0x6d3c74[_0x049f('0x1b')]=qs[_0x049f('0x1b')](_0x49ccf9[_0x049f('0x2e')][_0x049f('0x1b')]);}_0x6d3c74[_0x049f('0x35')]=qs[_0x049f('0x36')](_0x49ccf9[_0x049f('0x2e')][_0x049f('0x36')]);_0x6d3c74[_0x049f('0x37')]=qs['filters'](_['pick'](_0x49ccf9['query'],_0x51ce65[_0x049f('0x2f')]),_0x5eb7f4);if(_0x49ccf9['query'][_0x049f('0x38')]){_0x6d3c74[_0x049f('0x37')]=_[_0x049f('0x39')](_0x6d3c74['where'],{'$or':_[_0x049f('0x26')](_0x5eb7f4,function(_0x4a86a8){if(_0x4a86a8[_0x049f('0x2a')]!==_0x049f('0x3a')){var _0x301a4a={};_0x301a4a[_0x4a86a8[_0x049f('0x23')]]={'$like':'%'+_0x49ccf9[_0x049f('0x2e')][_0x049f('0x38')]+'%'};return _0x301a4a;}})});}_0x6d3c74=_[_0x049f('0x39')]({},_0x6d3c74,_0x49ccf9[_0x049f('0x3b')]);var _0x4a3076={'where':_0x6d3c74['where']};return db[_0x049f('0x27')][_0x049f('0x1a')](_0x4a3076)[_0x049f('0x21')](function(_0xdad0e){_0x31d7a4[_0x049f('0x1a')]=_0xdad0e;if(_0x49ccf9[_0x049f('0x2e')][_0x049f('0x3c')]){_0x6d3c74['include']=[{'all':!![]}];}return db[_0x049f('0x27')][_0x049f('0x3d')](_0x6d3c74);})[_0x049f('0x21')](function(_0x3f3521){_0x31d7a4[_0x049f('0x3e')]=_0x3f3521;return _0x31d7a4;})[_0x049f('0x21')](respondWithFilteredResult(_0x356d30,_0x6d3c74))[_0x049f('0x3f')](handleError(_0x356d30,null));};exports[_0x049f('0x40')]=function(_0x53e015,_0x360027){var _0x3a20c6={'raw':![],'where':{'id':_0x53e015['params']['id']}},_0xafb877={};_0xafb877['model']=_[_0x049f('0x2d')](db[_0x049f('0x27')][_0x049f('0x28')]);_0xafb877['query']=_[_0x049f('0x2d')](_0x53e015[_0x049f('0x2e')]);_0xafb877[_0x049f('0x2f')]=_['intersection'](_0xafb877[_0x049f('0x2c')],_0xafb877[_0x049f('0x2e')]);_0x3a20c6[_0x049f('0x31')]=_['intersection'](_0xafb877['model'],qs['fields'](_0x53e015[_0x049f('0x2e')][_0x049f('0x32')]));_0x3a20c6[_0x049f('0x31')]=_0x3a20c6[_0x049f('0x31')]['length']?_0x3a20c6[_0x049f('0x31')]:_0xafb877[_0x049f('0x2c')];if(_0x53e015[_0x049f('0x2e')][_0x049f('0x3c')]){_0x3a20c6[_0x049f('0x41')]=[{'all':!![]}];}_0x3a20c6=_['merge']({},_0x3a20c6,_0x53e015[_0x049f('0x3b')]);return db[_0x049f('0x27')][_0x049f('0x42')](_0x3a20c6)[_0x049f('0x21')](handleEntityNotFound(_0x360027,null))['then'](respondWithResult(_0x360027,null))['catch'](handleError(_0x360027,null));};exports['create']=function(_0x326547,_0x192963){return db[_0x049f('0x27')][_0x049f('0x43')](_0x326547[_0x049f('0x44')],{})[_0x049f('0x21')](respondWithResult(_0x192963,0xc9))[_0x049f('0x3f')](handleError(_0x192963,null));};exports['update']=function(_0x53177e,_0x108486){if(_0x53177e[_0x049f('0x44')]['id']){delete _0x53177e['body']['id'];}return db[_0x049f('0x27')][_0x049f('0x42')]({'where':{'id':_0x53177e[_0x049f('0x45')]['id']}})['then'](handleEntityNotFound(_0x108486,null))[_0x049f('0x21')](saveUpdates(_0x53177e[_0x049f('0x44')],null))[_0x049f('0x21')](respondWithResult(_0x108486,null))[_0x049f('0x3f')](handleError(_0x108486,null));};exports[_0x049f('0x46')]=function(_0x309bd4,_0x36a9fa){return db[_0x049f('0x27')]['find']({'where':{'id':_0x309bd4[_0x049f('0x45')]['id']}})['then'](handleEntityNotFound(_0x36a9fa,null))[_0x049f('0x21')](removeEntity(_0x36a9fa,null))[_0x049f('0x3f')](handleError(_0x36a9fa,null));};exports[_0x049f('0x47')]=function(_0x5c3632,_0x4297f1,_0x4941d4){return db[_0x049f('0x48')]['find']({'where':{'id':_0x5c3632[_0x049f('0x45')]['id']}})['then'](handleEntityNotFound(_0x4297f1,null))['then'](function(_0x386fe3){if(_0x386fe3){return _0x386fe3['addConditions'](_0x5c3632['body'][_0x049f('0x49')],_[_0x049f('0x4a')](_0x5c3632[_0x049f('0x44')],[_0x049f('0x49'),'id'])||{});}})['then'](respondWithResult(_0x4297f1,null))[_0x049f('0x3f')](handleError(_0x4297f1,null));};exports['getConditions']=function(_0x14c617,_0x116cbe,_0x65f513){var _0x47d354={};var _0x500e41={};var _0x4eca13;var _0x43af32;return db[_0x049f('0x27')]['findOne']({'where':{'id':_0x14c617[_0x049f('0x45')]['id']}})[_0x049f('0x21')](handleEntityNotFound(_0x116cbe,null))[_0x049f('0x21')](function(_0x3d301a){if(_0x3d301a){_0x4eca13=_0x3d301a;_0x500e41[_0x049f('0x2c')]=_[_0x049f('0x2d')](db[_0x049f('0x48')]['rawAttributes']);_0x500e41['query']=_[_0x049f('0x2d')](_0x14c617['query']);_0x500e41[_0x049f('0x2f')]=_[_0x049f('0x30')](_0x500e41[_0x049f('0x2c')],_0x500e41[_0x049f('0x2e')]);_0x47d354[_0x049f('0x31')]=_[_0x049f('0x30')](_0x500e41[_0x049f('0x2c')],qs['fields'](_0x14c617[_0x049f('0x2e')][_0x049f('0x32')]));_0x47d354['attributes']=_0x47d354[_0x049f('0x31')][_0x049f('0x33')]?_0x47d354[_0x049f('0x31')]:_0x500e41[_0x049f('0x2c')];_0x47d354[_0x049f('0x35')]=qs[_0x049f('0x36')](_0x14c617[_0x049f('0x2e')][_0x049f('0x36')]);_0x47d354[_0x049f('0x37')]=qs[_0x049f('0x2f')](_['pick'](_0x14c617[_0x049f('0x2e')],_0x500e41[_0x049f('0x2f')]));if(_0x14c617[_0x049f('0x2e')][_0x049f('0x38')]){_0x47d354[_0x049f('0x37')]=_[_0x049f('0x39')](_0x47d354[_0x049f('0x37')],{'$or':_[_0x049f('0x26')](_0x47d354[_0x049f('0x31')],function(_0x5232e3){var _0x5311f1={};_0x5311f1[_0x5232e3]={'$like':'%'+_0x14c617[_0x049f('0x2e')][_0x049f('0x38')]+'%'};return _0x5311f1;})});}_0x47d354=_[_0x049f('0x39')]({},_0x47d354,_0x14c617[_0x049f('0x3b')]);return _0x4eca13[_0x049f('0x4b')](_0x47d354);}})[_0x049f('0x21')](function(_0x4f4d7a){if(_0x4f4d7a){_0x43af32=_0x4f4d7a[_0x049f('0x33')];if(!_0x14c617['query']['hasOwnProperty'](_0x049f('0x4c'))){_0x47d354[_0x049f('0x19')]=qs[_0x049f('0x19')](_0x14c617[_0x049f('0x2e')][_0x049f('0x19')]);_0x47d354[_0x049f('0x1b')]=qs[_0x049f('0x1b')](_0x14c617[_0x049f('0x2e')][_0x049f('0x1b')]);}return _0x4eca13[_0x049f('0x4b')](_0x47d354);}})[_0x049f('0x21')](function(_0x138920){if(_0x138920){return _0x138920?{'count':_0x43af32,'rows':_0x138920}:null;}})[_0x049f('0x21')](respondWithResult(_0x116cbe,null))[_0x049f('0x3f')](handleError(_0x116cbe,null));};exports['addActions']=function(_0x590b7e,_0x55fdc6,_0x556c34){return db[_0x049f('0x4d')][_0x049f('0x42')]({'where':{'id':_0x590b7e[_0x049f('0x45')]['id']}})[_0x049f('0x21')](handleEntityNotFound(_0x55fdc6,null))[_0x049f('0x21')](function(_0xbb2e0c){if(_0xbb2e0c){return _0xbb2e0c[_0x049f('0x4e')](_0x590b7e['body'][_0x049f('0x49')],_['omit'](_0x590b7e[_0x049f('0x44')],['ids','id'])||{});}})[_0x049f('0x21')](respondWithResult(_0x55fdc6,null))['catch'](handleError(_0x55fdc6,null));};exports[_0x049f('0x4f')]=function(_0x5b821a,_0x43150a,_0x55be58){var _0x5180c6={};var _0x505c52={};var _0x4a2e8b;var _0x2b4a11;return db[_0x049f('0x27')]['findOne']({'where':{'id':_0x5b821a[_0x049f('0x45')]['id']}})[_0x049f('0x21')](handleEntityNotFound(_0x43150a,null))[_0x049f('0x21')](function(_0xd05b05){if(_0xd05b05){_0x4a2e8b=_0xd05b05;_0x505c52['model']=_[_0x049f('0x2d')](db[_0x049f('0x4d')][_0x049f('0x28')]);_0x505c52[_0x049f('0x2e')]=_['keys'](_0x5b821a[_0x049f('0x2e')]);_0x505c52[_0x049f('0x2f')]=_[_0x049f('0x30')](_0x505c52[_0x049f('0x2c')],_0x505c52[_0x049f('0x2e')]);_0x5180c6['attributes']=_[_0x049f('0x30')](_0x505c52[_0x049f('0x2c')],qs[_0x049f('0x32')](_0x5b821a[_0x049f('0x2e')][_0x049f('0x32')]));_0x5180c6[_0x049f('0x31')]=_0x5180c6[_0x049f('0x31')][_0x049f('0x33')]?_0x5180c6[_0x049f('0x31')]:_0x505c52[_0x049f('0x2c')];_0x5180c6[_0x049f('0x35')]=qs[_0x049f('0x36')](_0x5b821a[_0x049f('0x2e')][_0x049f('0x36')]);_0x5180c6['where']=qs['filters'](_['pick'](_0x5b821a['query'],_0x505c52['filters']));if(_0x5b821a[_0x049f('0x2e')][_0x049f('0x38')]){_0x5180c6['where']=_[_0x049f('0x39')](_0x5180c6[_0x049f('0x37')],{'$or':_[_0x049f('0x26')](_0x5180c6[_0x049f('0x31')],function(_0x48f875){var _0x44af70={};_0x44af70[_0x48f875]={'$like':'%'+_0x5b821a[_0x049f('0x2e')][_0x049f('0x38')]+'%'};return _0x44af70;})});}_0x5180c6=_[_0x049f('0x39')]({},_0x5180c6,_0x5b821a[_0x049f('0x3b')]);return _0x4a2e8b['getActions'](_0x5180c6);}})[_0x049f('0x21')](function(_0x1e4af9){if(_0x1e4af9){_0x2b4a11=_0x1e4af9[_0x049f('0x33')];if(!_0x5b821a[_0x049f('0x2e')][_0x049f('0x34')](_0x049f('0x4c'))){_0x5180c6['limit']=qs['limit'](_0x5b821a[_0x049f('0x2e')]['limit']);_0x5180c6[_0x049f('0x1b')]=qs['offset'](_0x5b821a[_0x049f('0x2e')]['offset']);}return _0x4a2e8b[_0x049f('0x4f')](_0x5180c6);}})[_0x049f('0x21')](function(_0x56c689){if(_0x56c689){return _0x56c689?{'count':_0x2b4a11,'rows':_0x56c689}:null;}})[_0x049f('0x21')](respondWithResult(_0x43150a,null))['catch'](handleError(_0x43150a,null));}; \ No newline at end of file +var _0x70bf=['reject','save','update','then','destroy','error','stack','name','map','Automation','rawAttributes','fieldName','key','query','keys','filters','model','intersection','fields','attributes','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','length','find','create','body','params','addConditions','ids','getConditions','findOne','Condition','hasOwnProperty','nolimit','addActions','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','Content-Range','json','apply'];(function(_0x202838,_0x277181){var _0x51e925=function(_0x3caa95){while(--_0x3caa95){_0x202838['push'](_0x202838['shift']());}};_0x51e925(++_0x277181);}(_0x70bf,0x124));var _0xf70b=function(_0x3443e4,_0x4a7dbc){_0x3443e4=_0x3443e4-0x0;var _0x35fed3=_0x70bf[_0x3443e4];return _0x35fed3;};'use strict';var emlformat=require(_0xf70b('0x0'));var rimraf=require(_0xf70b('0x1'));var zipdir=require(_0xf70b('0x2'));var jsonpatch=require(_0xf70b('0x3'));var rp=require(_0xf70b('0x4'));var moment=require('moment');var BPromise=require(_0xf70b('0x5'));var Mustache=require('mustache');var util=require(_0xf70b('0x6'));var path=require(_0xf70b('0x7'));var sox=require(_0xf70b('0x8'));var csv=require(_0xf70b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf70b('0xa'));var jsforce=require(_0xf70b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf70b('0x9'));var querystring=require(_0xf70b('0xc'));var Papa=require(_0xf70b('0xd'));var Redis=require('ioredis');var authService=require(_0xf70b('0xe'));var qs=require(_0xf70b('0xf'));var as=require(_0xf70b('0x10'));var hardwareService=require(_0xf70b('0x11'));var logger=require(_0xf70b('0x12'))(_0xf70b('0x13'));var utils=require(_0xf70b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf70b('0x15'));var db=require(_0xf70b('0x16'))['db'];function respondWithStatusCode(_0x5a8d7e,_0x367d5d){_0x367d5d=_0x367d5d||0xcc;return function(_0x2316f5){if(_0x2316f5){return _0x5a8d7e['sendStatus'](_0x367d5d);}return _0x5a8d7e['status'](_0x367d5d)[_0xf70b('0x17')]();};}function respondWithResult(_0xc2420e,_0x104e42){_0x104e42=_0x104e42||0xc8;return function(_0x586a56){if(_0x586a56){return _0xc2420e[_0xf70b('0x18')](_0x104e42)['json'](_0x586a56);}};}function respondWithFilteredResult(_0x212a1b,_0x443d78){return function(_0x50cdb6){if(_0x50cdb6){var _0x421bec=typeof _0x443d78[_0xf70b('0x19')]===_0xf70b('0x1a')&&typeof _0x443d78[_0xf70b('0x1b')]===_0xf70b('0x1a');var _0x1f2a38=_0x50cdb6[_0xf70b('0x1c')];var _0x38e919=_0x421bec?0x0:_0x443d78['offset'];var _0x10ea82=_0x421bec?_0x50cdb6[_0xf70b('0x1c')]:_0x443d78['offset']+_0x443d78[_0xf70b('0x1b')];var _0x1fe4ae;if(_0x10ea82>=_0x1f2a38){_0x10ea82=_0x1f2a38;_0x1fe4ae=0xc8;}else{_0x1fe4ae=0xce;}_0x212a1b[_0xf70b('0x18')](_0x1fe4ae);return _0x212a1b['set'](_0xf70b('0x1d'),_0x38e919+'-'+_0x10ea82+'/'+_0x1f2a38)[_0xf70b('0x1e')](_0x50cdb6);}return null;};}function patchUpdates(_0xa573d9){return function(_0xffc986){try{jsonpatch[_0xf70b('0x1f')](_0xffc986,_0xa573d9,!![]);}catch(_0x4eedd0){return BPromise[_0xf70b('0x20')](_0x4eedd0);}return _0xffc986[_0xf70b('0x21')]();};}function saveUpdates(_0xf778b7,_0x5285ea){return function(_0x5528cd){if(_0x5528cd){return _0x5528cd[_0xf70b('0x22')](_0xf778b7)[_0xf70b('0x23')](function(_0x4e0616){return _0x4e0616;});}return null;};}function removeEntity(_0x34de13,_0x5a116b){return function(_0x206c44){if(_0x206c44){return _0x206c44[_0xf70b('0x24')]()[_0xf70b('0x23')](function(){_0x34de13[_0xf70b('0x18')](0xcc)[_0xf70b('0x17')]();});}};}function handleEntityNotFound(_0x30b24b,_0x28a006){return function(_0x5870d3){if(!_0x5870d3){_0x30b24b['sendStatus'](0x194);}return _0x5870d3;};}function handleError(_0x5083c9,_0x413646){_0x413646=_0x413646||0x1f4;return function(_0x4bd39c){logger[_0xf70b('0x25')](_0x4bd39c[_0xf70b('0x26')]);if(_0x4bd39c[_0xf70b('0x27')]){delete _0x4bd39c['name'];}_0x5083c9['status'](_0x413646)['send'](_0x4bd39c);};}exports['index']=function(_0x31d696,_0x51f29d){var _0x222ae5={},_0x4f55a9={},_0x8de6ad={'count':0x0,'rows':[]};var _0x377cf1=_[_0xf70b('0x28')](db[_0xf70b('0x29')][_0xf70b('0x2a')],function(_0x453c95){return{'name':_0x453c95[_0xf70b('0x2b')],'type':_0x453c95['type'][_0xf70b('0x2c')]};});_0x4f55a9['model']=_['map'](_0x377cf1,_0xf70b('0x27'));_0x4f55a9[_0xf70b('0x2d')]=_[_0xf70b('0x2e')](_0x31d696['query']);_0x4f55a9[_0xf70b('0x2f')]=_['intersection'](_0x4f55a9[_0xf70b('0x30')],_0x4f55a9[_0xf70b('0x2d')]);_0x222ae5['attributes']=_[_0xf70b('0x31')](_0x4f55a9[_0xf70b('0x30')],qs['fields'](_0x31d696[_0xf70b('0x2d')][_0xf70b('0x32')]));_0x222ae5[_0xf70b('0x33')]=_0x222ae5[_0xf70b('0x33')]['length']?_0x222ae5[_0xf70b('0x33')]:_0x4f55a9['model'];if(!_0x31d696[_0xf70b('0x2d')]['hasOwnProperty']('nolimit')){_0x222ae5[_0xf70b('0x1b')]=qs['limit'](_0x31d696[_0xf70b('0x2d')]['limit']);_0x222ae5['offset']=qs[_0xf70b('0x19')](_0x31d696[_0xf70b('0x2d')]['offset']);}_0x222ae5[_0xf70b('0x34')]=qs[_0xf70b('0x35')](_0x31d696[_0xf70b('0x2d')][_0xf70b('0x35')]);_0x222ae5[_0xf70b('0x36')]=qs[_0xf70b('0x2f')](_[_0xf70b('0x37')](_0x31d696['query'],_0x4f55a9[_0xf70b('0x2f')]),_0x377cf1);if(_0x31d696[_0xf70b('0x2d')][_0xf70b('0x38')]){_0x222ae5[_0xf70b('0x36')]=_['merge'](_0x222ae5[_0xf70b('0x36')],{'$or':_['map'](_0x377cf1,function(_0x1e9274){if(_0x1e9274[_0xf70b('0x39')]!==_0xf70b('0x3a')){var _0x4fd0a5={};_0x4fd0a5[_0x1e9274[_0xf70b('0x27')]]={'$like':'%'+_0x31d696[_0xf70b('0x2d')]['filter']+'%'};return _0x4fd0a5;}})});}_0x222ae5=_[_0xf70b('0x3b')]({},_0x222ae5,_0x31d696[_0xf70b('0x3c')]);var _0x1bede1={'where':_0x222ae5[_0xf70b('0x36')]};return db[_0xf70b('0x29')]['count'](_0x1bede1)[_0xf70b('0x23')](function(_0x397db3){_0x8de6ad['count']=_0x397db3;if(_0x31d696[_0xf70b('0x2d')][_0xf70b('0x3d')]){_0x222ae5[_0xf70b('0x3e')]=[{'all':!![]}];}return db[_0xf70b('0x29')][_0xf70b('0x3f')](_0x222ae5);})[_0xf70b('0x23')](function(_0x369417){_0x8de6ad[_0xf70b('0x40')]=_0x369417;return _0x8de6ad;})[_0xf70b('0x23')](respondWithFilteredResult(_0x51f29d,_0x222ae5))[_0xf70b('0x41')](handleError(_0x51f29d,null));};exports['show']=function(_0xaf2297,_0x3e80dd){var _0x5b5ca2={'raw':![],'where':{'id':_0xaf2297['params']['id']}},_0x2960a2={};_0x2960a2['model']=_[_0xf70b('0x2e')](db[_0xf70b('0x29')][_0xf70b('0x2a')]);_0x2960a2[_0xf70b('0x2d')]=_[_0xf70b('0x2e')](_0xaf2297['query']);_0x2960a2[_0xf70b('0x2f')]=_['intersection'](_0x2960a2['model'],_0x2960a2['query']);_0x5b5ca2[_0xf70b('0x33')]=_[_0xf70b('0x31')](_0x2960a2['model'],qs['fields'](_0xaf2297[_0xf70b('0x2d')][_0xf70b('0x32')]));_0x5b5ca2[_0xf70b('0x33')]=_0x5b5ca2['attributes'][_0xf70b('0x42')]?_0x5b5ca2[_0xf70b('0x33')]:_0x2960a2[_0xf70b('0x30')];if(_0xaf2297[_0xf70b('0x2d')]['includeAll']){_0x5b5ca2[_0xf70b('0x3e')]=[{'all':!![]}];}_0x5b5ca2=_[_0xf70b('0x3b')]({},_0x5b5ca2,_0xaf2297['options']);return db['Automation'][_0xf70b('0x43')](_0x5b5ca2)[_0xf70b('0x23')](handleEntityNotFound(_0x3e80dd,null))[_0xf70b('0x23')](respondWithResult(_0x3e80dd,null))[_0xf70b('0x41')](handleError(_0x3e80dd,null));};exports[_0xf70b('0x44')]=function(_0x2b6b38,_0x4383d7){return db[_0xf70b('0x29')][_0xf70b('0x44')](_0x2b6b38[_0xf70b('0x45')],{})['then'](respondWithResult(_0x4383d7,0xc9))[_0xf70b('0x41')](handleError(_0x4383d7,null));};exports[_0xf70b('0x22')]=function(_0x24eb3b,_0x5984f0){if(_0x24eb3b[_0xf70b('0x45')]['id']){delete _0x24eb3b['body']['id'];}return db[_0xf70b('0x29')]['find']({'where':{'id':_0x24eb3b['params']['id']}})[_0xf70b('0x23')](handleEntityNotFound(_0x5984f0,null))['then'](saveUpdates(_0x24eb3b[_0xf70b('0x45')],null))['then'](respondWithResult(_0x5984f0,null))[_0xf70b('0x41')](handleError(_0x5984f0,null));};exports[_0xf70b('0x24')]=function(_0x146e02,_0x5f4560){return db[_0xf70b('0x29')]['find']({'where':{'id':_0x146e02[_0xf70b('0x46')]['id']}})[_0xf70b('0x23')](handleEntityNotFound(_0x5f4560,null))[_0xf70b('0x23')](removeEntity(_0x5f4560,null))[_0xf70b('0x41')](handleError(_0x5f4560,null));};exports[_0xf70b('0x47')]=function(_0x57d22c,_0x3d42de,_0x39d549){return db['Condition'][_0xf70b('0x43')]({'where':{'id':_0x57d22c[_0xf70b('0x46')]['id']}})[_0xf70b('0x23')](handleEntityNotFound(_0x3d42de,null))['then'](function(_0xcf32b9){if(_0xcf32b9){return _0xcf32b9[_0xf70b('0x47')](_0x57d22c[_0xf70b('0x45')][_0xf70b('0x48')],_['omit'](_0x57d22c[_0xf70b('0x45')],[_0xf70b('0x48'),'id'])||{});}})['then'](respondWithResult(_0x3d42de,null))[_0xf70b('0x41')](handleError(_0x3d42de,null));};exports[_0xf70b('0x49')]=function(_0xab5e1d,_0x2676b0,_0x4b80f4){var _0x504366={};var _0x34c981={};var _0x40e9b1;var _0x55dd53;return db[_0xf70b('0x29')][_0xf70b('0x4a')]({'where':{'id':_0xab5e1d[_0xf70b('0x46')]['id']}})['then'](handleEntityNotFound(_0x2676b0,null))[_0xf70b('0x23')](function(_0x2446ce){if(_0x2446ce){_0x40e9b1=_0x2446ce;_0x34c981[_0xf70b('0x30')]=_['keys'](db[_0xf70b('0x4b')][_0xf70b('0x2a')]);_0x34c981[_0xf70b('0x2d')]=_['keys'](_0xab5e1d[_0xf70b('0x2d')]);_0x34c981[_0xf70b('0x2f')]=_[_0xf70b('0x31')](_0x34c981[_0xf70b('0x30')],_0x34c981[_0xf70b('0x2d')]);_0x504366[_0xf70b('0x33')]=_[_0xf70b('0x31')](_0x34c981[_0xf70b('0x30')],qs[_0xf70b('0x32')](_0xab5e1d[_0xf70b('0x2d')][_0xf70b('0x32')]));_0x504366[_0xf70b('0x33')]=_0x504366[_0xf70b('0x33')][_0xf70b('0x42')]?_0x504366[_0xf70b('0x33')]:_0x34c981[_0xf70b('0x30')];_0x504366[_0xf70b('0x34')]=qs[_0xf70b('0x35')](_0xab5e1d[_0xf70b('0x2d')][_0xf70b('0x35')]);_0x504366[_0xf70b('0x36')]=qs[_0xf70b('0x2f')](_[_0xf70b('0x37')](_0xab5e1d[_0xf70b('0x2d')],_0x34c981[_0xf70b('0x2f')]));if(_0xab5e1d['query'][_0xf70b('0x38')]){_0x504366[_0xf70b('0x36')]=_[_0xf70b('0x3b')](_0x504366[_0xf70b('0x36')],{'$or':_[_0xf70b('0x28')](_0x504366[_0xf70b('0x33')],function(_0x3ab410){var _0x5db767={};_0x5db767[_0x3ab410]={'$like':'%'+_0xab5e1d[_0xf70b('0x2d')][_0xf70b('0x38')]+'%'};return _0x5db767;})});}_0x504366=_[_0xf70b('0x3b')]({},_0x504366,_0xab5e1d[_0xf70b('0x3c')]);return _0x40e9b1[_0xf70b('0x49')](_0x504366);}})[_0xf70b('0x23')](function(_0x1321ff){if(_0x1321ff){_0x55dd53=_0x1321ff[_0xf70b('0x42')];if(!_0xab5e1d[_0xf70b('0x2d')][_0xf70b('0x4c')](_0xf70b('0x4d'))){_0x504366['limit']=qs[_0xf70b('0x1b')](_0xab5e1d[_0xf70b('0x2d')][_0xf70b('0x1b')]);_0x504366[_0xf70b('0x19')]=qs[_0xf70b('0x19')](_0xab5e1d[_0xf70b('0x2d')][_0xf70b('0x19')]);}return _0x40e9b1[_0xf70b('0x49')](_0x504366);}})[_0xf70b('0x23')](function(_0x179eb1){if(_0x179eb1){return _0x179eb1?{'count':_0x55dd53,'rows':_0x179eb1}:null;}})[_0xf70b('0x23')](respondWithResult(_0x2676b0,null))[_0xf70b('0x41')](handleError(_0x2676b0,null));};exports[_0xf70b('0x4e')]=function(_0x325702,_0x30623d,_0x4a9326){return db['Action']['find']({'where':{'id':_0x325702[_0xf70b('0x46')]['id']}})['then'](handleEntityNotFound(_0x30623d,null))[_0xf70b('0x23')](function(_0x20647b){if(_0x20647b){return _0x20647b[_0xf70b('0x4e')](_0x325702[_0xf70b('0x45')][_0xf70b('0x48')],_['omit'](_0x325702['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x30623d,null))[_0xf70b('0x41')](handleError(_0x30623d,null));};exports[_0xf70b('0x4f')]=function(_0x5cba8a,_0x1e99f9,_0x16bb59){var _0x3c32ba={};var _0x3ef8db={};var _0x15084c;var _0xcc5434;return db[_0xf70b('0x29')][_0xf70b('0x4a')]({'where':{'id':_0x5cba8a[_0xf70b('0x46')]['id']}})[_0xf70b('0x23')](handleEntityNotFound(_0x1e99f9,null))[_0xf70b('0x23')](function(_0x170aac){if(_0x170aac){_0x15084c=_0x170aac;_0x3ef8db[_0xf70b('0x30')]=_[_0xf70b('0x2e')](db[_0xf70b('0x50')]['rawAttributes']);_0x3ef8db['query']=_[_0xf70b('0x2e')](_0x5cba8a[_0xf70b('0x2d')]);_0x3ef8db[_0xf70b('0x2f')]=_[_0xf70b('0x31')](_0x3ef8db['model'],_0x3ef8db[_0xf70b('0x2d')]);_0x3c32ba[_0xf70b('0x33')]=_['intersection'](_0x3ef8db[_0xf70b('0x30')],qs['fields'](_0x5cba8a['query'][_0xf70b('0x32')]));_0x3c32ba[_0xf70b('0x33')]=_0x3c32ba['attributes'][_0xf70b('0x42')]?_0x3c32ba['attributes']:_0x3ef8db['model'];_0x3c32ba['order']=qs[_0xf70b('0x35')](_0x5cba8a[_0xf70b('0x2d')][_0xf70b('0x35')]);_0x3c32ba[_0xf70b('0x36')]=qs[_0xf70b('0x2f')](_[_0xf70b('0x37')](_0x5cba8a[_0xf70b('0x2d')],_0x3ef8db[_0xf70b('0x2f')]));if(_0x5cba8a['query'][_0xf70b('0x38')]){_0x3c32ba[_0xf70b('0x36')]=_[_0xf70b('0x3b')](_0x3c32ba['where'],{'$or':_[_0xf70b('0x28')](_0x3c32ba[_0xf70b('0x33')],function(_0x392db2){var _0x23e74a={};_0x23e74a[_0x392db2]={'$like':'%'+_0x5cba8a[_0xf70b('0x2d')][_0xf70b('0x38')]+'%'};return _0x23e74a;})});}_0x3c32ba=_['merge']({},_0x3c32ba,_0x5cba8a['options']);return _0x15084c[_0xf70b('0x4f')](_0x3c32ba);}})[_0xf70b('0x23')](function(_0x21e8d3){if(_0x21e8d3){_0xcc5434=_0x21e8d3[_0xf70b('0x42')];if(!_0x5cba8a[_0xf70b('0x2d')]['hasOwnProperty'](_0xf70b('0x4d'))){_0x3c32ba[_0xf70b('0x1b')]=qs[_0xf70b('0x1b')](_0x5cba8a[_0xf70b('0x2d')][_0xf70b('0x1b')]);_0x3c32ba[_0xf70b('0x19')]=qs['offset'](_0x5cba8a['query'][_0xf70b('0x19')]);}return _0x15084c['getActions'](_0x3c32ba);}})[_0xf70b('0x23')](function(_0x34a971){if(_0x34a971){return _0x34a971?{'count':_0xcc5434,'rows':_0x34a971}:null;}})[_0xf70b('0x23')](respondWithResult(_0x1e99f9,null))[_0xf70b('0x41')](handleError(_0x1e99f9,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 75df509..d76217d 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 _0xbaa4=['api','bluebird','rimraf','../../config/environment','exports','define','Automation','tools_automations','lodash','../../config/logger'];(function(_0x4f1a47,_0x4d6f1d){var _0x1e67c8=function(_0x14b9d1){while(--_0x14b9d1){_0x4f1a47['push'](_0x4f1a47['shift']());}};_0x1e67c8(++_0x4d6f1d);}(_0xbaa4,0x166));var _0x4baa=function(_0x274042,_0x3647e8){_0x274042=_0x274042-0x0;var _0x5a087d=_0xbaa4[_0x274042];return _0x5a087d;};'use strict';var _=require(_0x4baa('0x0'));var util=require('util');var logger=require(_0x4baa('0x1'))(_0x4baa('0x2'));var moment=require('moment');var BPromise=require(_0x4baa('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4baa('0x4'));var config=require(_0x4baa('0x5'));var attributes=require('./automation.attributes');module[_0x4baa('0x6')]=function(_0x23c088,_0x356fc5){return _0x23c088[_0x4baa('0x7')](_0x4baa('0x8'),attributes,{'tableName':_0x4baa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47c1=['bluebird','request-promise','path','rimraf','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment'];(function(_0xa9ac7a,_0xa358de){var _0x58aae7=function(_0x1fb29c){while(--_0x1fb29c){_0xa9ac7a['push'](_0xa9ac7a['shift']());}};_0x58aae7(++_0xa358de);}(_0x47c1,0xa3));var _0x147c=function(_0x58284c,_0x52bfa7){_0x58284c=_0x58284c-0x0;var _0x4fc8bb=_0x47c1[_0x58284c];return _0x4fc8bb;};'use strict';var _=require(_0x147c('0x0'));var util=require(_0x147c('0x1'));var logger=require(_0x147c('0x2'))(_0x147c('0x3'));var moment=require(_0x147c('0x4'));var BPromise=require(_0x147c('0x5'));var rp=require(_0x147c('0x6'));var fs=require('fs');var path=require(_0x147c('0x7'));var rimraf=require(_0x147c('0x8'));var config=require('../../config/environment');var attributes=require(_0x147c('0x9'));module[_0x147c('0xa')]=function(_0x469075,_0x1930c5){return _0x469075[_0x147c('0xb')](_0x147c('0xc'),attributes,{'tableName':_0x147c('0xd'),'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 70798a3..ea72c34 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 _0xd070=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x403112,_0x2c1dc3){var _0x91f216=function(_0x57da53){while(--_0x57da53){_0x403112['push'](_0x403112['shift']());}};_0x91f216(++_0x2c1dc3);}(_0xd070,0x8e));var _0x0d07=function(_0x1c0079,_0x171763){_0x1c0079=_0x1c0079-0x0;var _0x361ec3=_0xd070[_0x1c0079];return _0x361ec3;};'use strict';var _=require(_0x0d07('0x0'));var util=require('util');var moment=require(_0x0d07('0x1'));var BPromise=require(_0x0d07('0x2'));var rs=require(_0x0d07('0x3'));var fs=require('fs');var Redis=require(_0x0d07('0x4'));var db=require(_0x0d07('0x5'))['db'];var utils=require(_0x0d07('0x6'));var logger=require(_0x0d07('0x7'))(_0x0d07('0x8'));var config=require(_0x0d07('0x9'));var jayson=require(_0x0d07('0xa'));var client=jayson[_0x0d07('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13d75a,_0x5a4366,_0x20fd56){return new BPromise(function(_0x8c16d8,_0x1f989e){return client[_0x0d07('0xc')](_0x13d75a,_0x20fd56)[_0x0d07('0xd')](function(_0xc5b04d){logger[_0x0d07('0xe')](_0x0d07('0xf'),_0x5a4366,_0x0d07('0x10'));logger[_0x0d07('0x11')]('Automation,\x20%s,\x20%s,\x20%s',_0x5a4366,'request\x20sent',JSON[_0x0d07('0x12')](_0xc5b04d));if(_0xc5b04d[_0x0d07('0x13')]){if(_0xc5b04d['error'][_0x0d07('0x14')]===0x1f4){logger['error'](_0x0d07('0xf'),_0x5a4366,_0xc5b04d[_0x0d07('0x13')]['message']);return _0x1f989e(_0xc5b04d[_0x0d07('0x13')][_0x0d07('0x15')]);}logger[_0x0d07('0x13')](_0x0d07('0xf'),_0x5a4366,_0xc5b04d[_0x0d07('0x13')][_0x0d07('0x15')]);return _0x8c16d8(_0xc5b04d['error'][_0x0d07('0x15')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x5a4366,_0x0d07('0x10'));_0x8c16d8(_0xc5b04d[_0x0d07('0x16')][_0x0d07('0x15')]);}})[_0x0d07('0x17')](function(_0x220203){logger['error']('Automation,\x20%s,\x20%s',_0x5a4366,_0x220203);_0x1f989e(_0x220203);});});} \ No newline at end of file +var _0xb6da=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x203bf4,_0x25fd0c){var _0x3a6598=function(_0x1caaf2){while(--_0x1caaf2){_0x203bf4['push'](_0x203bf4['shift']());}};_0x3a6598(++_0x25fd0c);}(_0xb6da,0x8e));var _0xab6d=function(_0x17976c,_0x5205e7){_0x17976c=_0x17976c-0x0;var _0x68ac6f=_0xb6da[_0x17976c];return _0x68ac6f;};'use strict';var _=require(_0xab6d('0x0'));var util=require('util');var moment=require(_0xab6d('0x1'));var BPromise=require(_0xab6d('0x2'));var rs=require(_0xab6d('0x3'));var fs=require('fs');var Redis=require(_0xab6d('0x4'));var db=require(_0xab6d('0x5'))['db'];var utils=require(_0xab6d('0x6'));var logger=require(_0xab6d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xab6d('0x8'));var client=jayson[_0xab6d('0x9')][_0xab6d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x130285,_0x359bef,_0x44d5fa){return new BPromise(function(_0x4ba0f7,_0x2e30f1){return client['request'](_0x130285,_0x44d5fa)[_0xab6d('0xb')](function(_0x590cfa){logger['info'](_0xab6d('0xc'),_0x359bef,_0xab6d('0xd'));logger['debug'](_0xab6d('0xe'),_0x359bef,'request\x20sent',JSON['stringify'](_0x590cfa));if(_0x590cfa[_0xab6d('0xf')]){if(_0x590cfa[_0xab6d('0xf')][_0xab6d('0x10')]===0x1f4){logger[_0xab6d('0xf')](_0xab6d('0xc'),_0x359bef,_0x590cfa[_0xab6d('0xf')][_0xab6d('0x11')]);return _0x2e30f1(_0x590cfa[_0xab6d('0xf')]['message']);}logger[_0xab6d('0xf')](_0xab6d('0xc'),_0x359bef,_0x590cfa[_0xab6d('0xf')][_0xab6d('0x11')]);return _0x4ba0f7(_0x590cfa[_0xab6d('0xf')][_0xab6d('0x11')]);}else{logger['info'](_0xab6d('0xc'),_0x359bef,_0xab6d('0xd'));_0x4ba0f7(_0x590cfa[_0xab6d('0x12')]['message']);}})[_0xab6d('0x13')](function(_0x3bd40a){logger[_0xab6d('0xf')](_0xab6d('0xc'),_0x359bef,_0x3bd40a);_0x2e30f1(_0x3bd40a);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 8b3dac1..6be8d69 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 _0x2b37=['/:id/conditions','/:id/actions','getActions','post','create','addActions','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x8e8ca7,_0x5a5e07){var _0x561381=function(_0x2f4bda){while(--_0x2f4bda){_0x8e8ca7['push'](_0x8e8ca7['shift']());}};_0x561381(++_0x5a5e07);}(_0x2b37,0x12b));var _0x72b3=function(_0x1c6250,_0x4ba01d){_0x1c6250=_0x1c6250-0x0;var _0x5e2f3a=_0x2b37[_0x1c6250];return _0x5e2f3a;};'use strict';var multer=require(_0x72b3('0x0'));var util=require(_0x72b3('0x1'));var path=require(_0x72b3('0x2'));var timeout=require(_0x72b3('0x3'));var express=require(_0x72b3('0x4'));var router=express[_0x72b3('0x5')]();var fs_extra=require(_0x72b3('0x6'));var auth=require(_0x72b3('0x7'));var interaction=require(_0x72b3('0x8'));var config=require(_0x72b3('0x9'));var controller=require('./automation.controller');router[_0x72b3('0xa')]('/',auth[_0x72b3('0xb')](),controller['index']);router[_0x72b3('0xa')](_0x72b3('0xc'),auth[_0x72b3('0xb')](),controller['show']);router[_0x72b3('0xa')](_0x72b3('0xd'),auth[_0x72b3('0xb')](),controller['getConditions']);router[_0x72b3('0xa')](_0x72b3('0xe'),auth[_0x72b3('0xb')](),controller[_0x72b3('0xf')]);router[_0x72b3('0x10')]('/',auth[_0x72b3('0xb')](),controller[_0x72b3('0x11')]);router['post'](_0x72b3('0xd'),auth[_0x72b3('0xb')](),controller['addConditions']);router[_0x72b3('0x10')]('/:id/actions',auth['isAuthenticated'](),controller[_0x72b3('0x12')]);router[_0x72b3('0x13')](_0x72b3('0xc'),auth[_0x72b3('0xb')](),controller[_0x72b3('0x14')]);router[_0x72b3('0x15')](_0x72b3('0xc'),auth[_0x72b3('0xb')](),controller[_0x72b3('0x16')]);module[_0x72b3('0x17')]=router; \ No newline at end of file +var _0x8fe4=['../../config/environment','./automation.controller','get','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','post','create','addActions','put','/:id','update','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8fe4,0x170));var _0x48fe=function(_0x23b801,_0x2b2c30){_0x23b801=_0x23b801-0x0;var _0x340c60=_0x8fe4[_0x23b801];return _0x340c60;};'use strict';var multer=require(_0x48fe('0x0'));var util=require(_0x48fe('0x1'));var path=require('path');var timeout=require(_0x48fe('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x48fe('0x3'));var auth=require(_0x48fe('0x4'));var interaction=require(_0x48fe('0x5'));var config=require(_0x48fe('0x6'));var controller=require(_0x48fe('0x7'));router[_0x48fe('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x48fe('0x9')](),controller[_0x48fe('0xa')]);router[_0x48fe('0x8')](_0x48fe('0xb'),auth['isAuthenticated'](),controller[_0x48fe('0xc')]);router[_0x48fe('0x8')](_0x48fe('0xd'),auth[_0x48fe('0x9')](),controller['getActions']);router[_0x48fe('0xe')]('/',auth[_0x48fe('0x9')](),controller[_0x48fe('0xf')]);router[_0x48fe('0xe')](_0x48fe('0xb'),auth[_0x48fe('0x9')](),controller['addConditions']);router[_0x48fe('0xe')](_0x48fe('0xd'),auth['isAuthenticated'](),controller[_0x48fe('0x10')]);router[_0x48fe('0x11')](_0x48fe('0x12'),auth[_0x48fe('0x9')](),controller[_0x48fe('0x13')]);router['delete'](_0x48fe('0x12'),auth[_0x48fe('0x9')](),controller[_0x48fe('0x14')]);module[_0x48fe('0x15')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 1eda04a..807d71e 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 _0x9699=['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','BOOLEAN','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','ENUM','ivr','STRING','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)'];(function(_0x4d7b4a,_0x5aa87c){var _0x5d0a11=function(_0x389304){while(--_0x389304){_0x4d7b4a['push'](_0x4d7b4a['shift']());}};_0x5d0a11(++_0x5aa87c);}(_0x9699,0xd4));var _0x9969=function(_0x1bbbb5,_0x459f80){_0x1bbbb5=_0x1bbbb5-0x0;var _0x4db298=_0x9699[_0x1bbbb5];return _0x4db298;};'use strict';var Sequelize=require(_0x9969('0x0'));module[_0x9969('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x9969('0x2')](_0x9969('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x9969('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x9969('0x5')](0x4)[_0x9969('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x9969('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x9969('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9969('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x9969('0x5')](0x3)[_0x9969('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x9969('0x5')](0x3)[_0x9969('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9969('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9969('0x5')](0x5)[_0x9969('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x9969('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9969('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9969('0x5')](0x5)[_0x9969('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9969('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9969('0x5')](0x3)[_0x9969('0x6')],'defaultValue':0x3,'comment':_0x9969('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9969('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9969('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x9969('0x5')](0x3)[_0x9969('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9969('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9969('0x4')],'defaultValue':_0x9969('0xe')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x9969('0xf'),_0x9969('0x10'),_0x9969('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x9969('0x12')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x9969('0x5')](0x9)[_0x9969('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9969('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x9969('0x5')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9969('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9969('0x5')](0x9)[_0x9969('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9969('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x9969('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x9969('0x5')](0x9)[_0x9969('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9969('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9969('0x5')](0x9)[_0x9969('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9969('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9969('0x5')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9969('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9969('0x5')](0x5)[_0x9969('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9969('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9969('0x5')](0x9)[_0x9969('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9969('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9969('0x2')](_0x9969('0x1b'),'ASC'),'defaultValue':_0x9969('0x1b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9969('0x5')](0x3)[_0x9969('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9969('0x1c')},'dialCutDigit':{'type':Sequelize[_0x9969('0x5')](0x3)[_0x9969('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9969('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9969('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9969('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9969('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x9969('0x5')](0x3)[_0x9969('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9969('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x9969('0x5')](0x5)[_0x9969('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9969('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9969('0x5')](0x3)[_0x9969('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9969('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9969('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9969('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x9969('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x9969('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9969('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9969('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9969('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9969('0x24')}}; \ No newline at end of file +var _0x1b5b=['#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','name','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','Max\x20200\x20calls.','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x1b5b,0x74));var _0xb1b5=function(_0x269ee8,_0x477226){_0x269ee8=_0x269ee8-0x0;var _0x4d98bd=_0x1b5b[_0x269ee8];return _0x4d98bd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb1b5('0x0'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xb1b5('0x1')](_0xb1b5('0x2')),'allowNull':![],'defaultValue':_0xb1b5('0x2')},'description':{'type':Sequelize[_0xb1b5('0x3')]},'active':{'type':Sequelize[_0xb1b5('0x4')],'defaultValue':0x0,'comment':_0xb1b5('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xb1b5('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0xb1b5('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xb1b5('0x3')]},'dialOriginateTimeout':{'type':Sequelize[_0xb1b5('0x7')](0x3)[_0xb1b5('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb1b5('0x9')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb1b5('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xb1b5('0x7')](0x5)[_0xb1b5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xb1b5('0x7')](0x3)[_0xb1b5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb1b5('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xb1b5('0x7')](0x5)[_0xb1b5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb1b5('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xb1b5('0x7')](0x3)[_0xb1b5('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb1b5('0x7')](0x5)[_0xb1b5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb1b5('0xd')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb1b5('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xb1b5('0x3')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb1b5('0x3')],'defaultValue':_0xb1b5('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xb1b5('0x1')](_0xb1b5('0xf'),_0xb1b5('0x10'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xb1b5('0x4')],'defaultValue':0x0,'comment':_0xb1b5('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0xb1b5('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xb1b5('0x12')},'dialAMDGreeting':{'type':Sequelize[_0xb1b5('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb1b5('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xb1b5('0x7')](0x9)[_0xb1b5('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xb1b5('0x7')](0x9)[_0xb1b5('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb1b5('0x14')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xb1b5('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xb1b5('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xb1b5('0x7')](0x9)[_0xb1b5('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xb1b5('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb1b5('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xb1b5('0x7')](0x5)[_0xb1b5('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xb1b5('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xb1b5('0x7')](0x9)[_0xb1b5('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xb1b5('0x1')]('DESC','ASC'),'defaultValue':_0xb1b5('0x18')},'dialPrefix':{'type':Sequelize[_0xb1b5('0x3')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xb1b5('0x7')](0x3)[_0xb1b5('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb1b5('0x19')},'dialCutDigit':{'type':Sequelize[_0xb1b5('0x7')](0x3)[_0xb1b5('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xb1b5('0x7')](0x3)[_0xb1b5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb1b5('0x1a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xb1b5('0x7')](0x5)[_0xb1b5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb1b5('0x1b')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb1b5('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0xb1b5('0x7')](0x5)[_0xb1b5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb1b5('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xb1b5('0x7')](0x3)[_0xb1b5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb1b5('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xb1b5('0x7')](0x5)[_0xb1b5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb1b5('0x1f')},'dialMachineMaxRetry':{'type':Sequelize[_0xb1b5('0x7')](0x3)[_0xb1b5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb1b5('0x20')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb1b5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb1b5('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xb1b5('0x7')](0x3)[_0xb1b5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb1b5('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xb1b5('0x7')](0x5)[_0xb1b5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb1b5('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index f96af01..2801a79 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 _0xcd31=['getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','YYYY-MM-DD\x20HH:mm:ss','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','h.id','ci.OrderBY','OrderBy','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','ids','getBlackLists','format','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','count','limit','set','Content-Range','reject','update','then','IvrCampaigns','UserProfileResource','end','stack','name','send','map','Campaign','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filter','merge','where','VIRTUAL','options','includeAll','findAll','show','params','find','create','body','user','get','role','userProfileId','autoAssociation','catch','error','clone','include','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','getHoppers','CmHopper','sort','pick','CampaignId','getHopperHistories','findOne','CmHopperHistory','rows'];(function(_0x5bb2bc,_0xb9319c){var _0x4d8912=function(_0x115771){while(--_0x115771){_0x5bb2bc['push'](_0x5bb2bc['shift']());}};_0x4d8912(++_0xb9319c);}(_0xcd31,0x15d));var _0x1cd3=function(_0xd64ea1,_0x5a40d9){_0xd64ea1=_0xd64ea1-0x0;var _0x11a857=_0xcd31[_0xd64ea1];return _0x11a857;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1cd3('0x0'));var zipdir=require(_0x1cd3('0x1'));var jsonpatch=require(_0x1cd3('0x2'));var rp=require('request-promise');var moment=require(_0x1cd3('0x3'));var BPromise=require(_0x1cd3('0x4'));var Mustache=require(_0x1cd3('0x5'));var util=require(_0x1cd3('0x6'));var path=require(_0x1cd3('0x7'));var sox=require(_0x1cd3('0x8'));var csv=require('to-csv');var ejs=require(_0x1cd3('0x9'));var fs=require('fs');var fs_extra=require(_0x1cd3('0xa'));var _=require(_0x1cd3('0xb'));var squel=require('squel');var crypto=require(_0x1cd3('0xc'));var jsforce=require(_0x1cd3('0xd'));var deskjs=require(_0x1cd3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1cd3('0xf'));var Papa=require(_0x1cd3('0x10'));var Redis=require(_0x1cd3('0x11'));var authService=require(_0x1cd3('0x12'));var qs=require(_0x1cd3('0x13'));var as=require(_0x1cd3('0x14'));var hardwareService=require(_0x1cd3('0x15'));var logger=require('../../config/logger')(_0x1cd3('0x16'));var utils=require(_0x1cd3('0x17'));var config=require(_0x1cd3('0x18'));var licenseUtil=require(_0x1cd3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfe288e,_0x4c9c6d){_0x4c9c6d=_0x4c9c6d||0xcc;return function(_0x41016f){if(_0x41016f){return _0xfe288e[_0x1cd3('0x1a')](_0x4c9c6d);}return _0xfe288e[_0x1cd3('0x1b')](_0x4c9c6d)['end']();};}function respondWithResult(_0x5b885f,_0x1a874c){_0x1a874c=_0x1a874c||0xc8;return function(_0x1def57){if(_0x1def57){return _0x5b885f[_0x1cd3('0x1b')](_0x1a874c)['json'](_0x1def57);}};}function respondWithFilteredResult(_0x2b28cf,_0x40cbbf){return function(_0x5a2b84){if(_0x5a2b84){var _0x418da3=typeof _0x40cbbf['offset']==='undefined'&&typeof _0x40cbbf['limit']==='undefined';var _0x5ca15c=_0x5a2b84['count'];var _0x14c491=_0x418da3?0x0:_0x40cbbf[_0x1cd3('0x1c')];var _0xf82a46=_0x418da3?_0x5a2b84[_0x1cd3('0x1d')]:_0x40cbbf[_0x1cd3('0x1c')]+_0x40cbbf[_0x1cd3('0x1e')];var _0x35870b;if(_0xf82a46>=_0x5ca15c){_0xf82a46=_0x5ca15c;_0x35870b=0xc8;}else{_0x35870b=0xce;}_0x2b28cf[_0x1cd3('0x1b')](_0x35870b);return _0x2b28cf[_0x1cd3('0x1f')](_0x1cd3('0x20'),_0x14c491+'-'+_0xf82a46+'/'+_0x5ca15c)['json'](_0x5a2b84);}return null;};}function patchUpdates(_0x33fc72){return function(_0x2368b3){try{jsonpatch['apply'](_0x2368b3,_0x33fc72,!![]);}catch(_0x26b59a){return BPromise[_0x1cd3('0x21')](_0x26b59a);}return _0x2368b3['save']();};}function saveUpdates(_0x20cda5,_0x159d22){return function(_0x330741){if(_0x330741){return _0x330741[_0x1cd3('0x22')](_0x20cda5)['then'](function(_0x4f6920){return _0x4f6920;});}return null;};}function removeEntity(_0x29ff8c,_0x1a6dad){return function(_0x49c7b1){if(_0x49c7b1){return _0x49c7b1['destroy']()[_0x1cd3('0x23')](function(){var _0x44b162=_0x49c7b1['get']({'plain':!![]});var _0x55aa9c=_0x1cd3('0x24');return db[_0x1cd3('0x25')]['destroy']({'where':{'type':_0x55aa9c,'resourceId':_0x44b162['id']}})['then'](function(){return _0x49c7b1;});})[_0x1cd3('0x23')](function(){_0x29ff8c[_0x1cd3('0x1b')](0xcc)[_0x1cd3('0x26')]();});}};}function handleEntityNotFound(_0x5e4dc7,_0x55d29b){return function(_0x334ce2){if(!_0x334ce2){_0x5e4dc7['sendStatus'](0x194);}return _0x334ce2;};}function handleError(_0x173f0d,_0x2279c0){_0x2279c0=_0x2279c0||0x1f4;return function(_0x268501){logger['error'](_0x268501[_0x1cd3('0x27')]);if(_0x268501['name']){delete _0x268501[_0x1cd3('0x28')];}_0x173f0d[_0x1cd3('0x1b')](_0x2279c0)[_0x1cd3('0x29')](_0x268501);};}exports['index']=function(_0x2b65d7,_0x909bc6){var _0x3d4963={},_0x4399a1={},_0x2126a2={'count':0x0,'rows':[]};var _0x5a3347=_[_0x1cd3('0x2a')](db[_0x1cd3('0x2b')][_0x1cd3('0x2c')],function(_0x5ea13d){return{'name':_0x5ea13d[_0x1cd3('0x2d')],'type':_0x5ea13d[_0x1cd3('0x2e')]['key']};});_0x4399a1[_0x1cd3('0x2f')]=_[_0x1cd3('0x2a')](_0x5a3347,'name');_0x4399a1['query']=_[_0x1cd3('0x30')](_0x2b65d7[_0x1cd3('0x31')]);_0x4399a1[_0x1cd3('0x32')]=_[_0x1cd3('0x33')](_0x4399a1[_0x1cd3('0x2f')],_0x4399a1['query']);_0x3d4963[_0x1cd3('0x34')]=_['intersection'](_0x4399a1['model'],qs[_0x1cd3('0x35')](_0x2b65d7[_0x1cd3('0x31')][_0x1cd3('0x35')]));_0x3d4963[_0x1cd3('0x34')]=_0x3d4963['attributes'][_0x1cd3('0x36')]?_0x3d4963['attributes']:_0x4399a1[_0x1cd3('0x2f')];if(!_0x2b65d7[_0x1cd3('0x31')][_0x1cd3('0x37')](_0x1cd3('0x38'))){_0x3d4963['limit']=qs['limit'](_0x2b65d7[_0x1cd3('0x31')]['limit']);_0x3d4963[_0x1cd3('0x1c')]=qs[_0x1cd3('0x1c')](_0x2b65d7[_0x1cd3('0x31')][_0x1cd3('0x1c')]);}_0x3d4963[_0x1cd3('0x39')]=qs['sort'](_0x2b65d7['query']['sort']);_0x3d4963['where']=qs[_0x1cd3('0x32')](_['pick'](_0x2b65d7[_0x1cd3('0x31')],_0x4399a1['filters']),_0x5a3347);if(_0x2b65d7[_0x1cd3('0x31')][_0x1cd3('0x3a')]){_0x3d4963['where']=_[_0x1cd3('0x3b')](_0x3d4963[_0x1cd3('0x3c')],{'$or':_[_0x1cd3('0x2a')](_0x5a3347,function(_0x4bec6f){if(_0x4bec6f['type']!==_0x1cd3('0x3d')){var _0x203dc0={};_0x203dc0[_0x4bec6f[_0x1cd3('0x28')]]={'$like':'%'+_0x2b65d7[_0x1cd3('0x31')][_0x1cd3('0x3a')]+'%'};return _0x203dc0;}})});}_0x3d4963=_[_0x1cd3('0x3b')]({},_0x3d4963,_0x2b65d7[_0x1cd3('0x3e')]);var _0x178d60={'where':_0x3d4963[_0x1cd3('0x3c')]};return db['Campaign']['count'](_0x178d60)['then'](function(_0x42a2ed){_0x2126a2[_0x1cd3('0x1d')]=_0x42a2ed;if(_0x2b65d7['query'][_0x1cd3('0x3f')]){_0x3d4963['include']=[{'all':!![]}];}return db[_0x1cd3('0x2b')][_0x1cd3('0x40')](_0x3d4963);})[_0x1cd3('0x23')](function(_0x326f08){_0x2126a2['rows']=_0x326f08;return _0x2126a2;})['then'](respondWithFilteredResult(_0x909bc6,_0x3d4963))['catch'](handleError(_0x909bc6,null));};exports[_0x1cd3('0x41')]=function(_0x5a495b,_0x54fdbb){var _0x3ea51f={'raw':![],'where':{'id':_0x5a495b[_0x1cd3('0x42')]['id']}},_0x522890={};_0x522890[_0x1cd3('0x2f')]=_[_0x1cd3('0x30')](db[_0x1cd3('0x2b')][_0x1cd3('0x2c')]);_0x522890[_0x1cd3('0x31')]=_[_0x1cd3('0x30')](_0x5a495b[_0x1cd3('0x31')]);_0x522890['filters']=_[_0x1cd3('0x33')](_0x522890[_0x1cd3('0x2f')],_0x522890[_0x1cd3('0x31')]);_0x3ea51f['attributes']=_['intersection'](_0x522890[_0x1cd3('0x2f')],qs[_0x1cd3('0x35')](_0x5a495b[_0x1cd3('0x31')][_0x1cd3('0x35')]));_0x3ea51f[_0x1cd3('0x34')]=_0x3ea51f[_0x1cd3('0x34')][_0x1cd3('0x36')]?_0x3ea51f['attributes']:_0x522890[_0x1cd3('0x2f')];if(_0x5a495b[_0x1cd3('0x31')][_0x1cd3('0x3f')]){_0x3ea51f['include']=[{'all':!![]}];}_0x3ea51f=_['merge']({},_0x3ea51f,_0x5a495b[_0x1cd3('0x3e')]);return db[_0x1cd3('0x2b')][_0x1cd3('0x43')](_0x3ea51f)[_0x1cd3('0x23')](handleEntityNotFound(_0x54fdbb,null))[_0x1cd3('0x23')](respondWithResult(_0x54fdbb,null))['catch'](handleError(_0x54fdbb,null));};exports['create']=function(_0x500fcf,_0x3cde0b){return db[_0x1cd3('0x2b')][_0x1cd3('0x44')](_0x500fcf[_0x1cd3('0x45')],{})[_0x1cd3('0x23')](function(_0x4ab5d1){var _0x52256a=_0x500fcf[_0x1cd3('0x46')][_0x1cd3('0x47')]({'plain':!![]});if(!_0x52256a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52256a[_0x1cd3('0x48')]===_0x1cd3('0x46')){var _0x2542f6=_0x4ab5d1['get']({'plain':!![]});var _0x4ddfba=_0x1cd3('0x24');return db['UserProfileSection'][_0x1cd3('0x43')]({'where':{'name':_0x4ddfba,'userProfileId':_0x52256a[_0x1cd3('0x49')]},'raw':!![]})[_0x1cd3('0x23')](function(_0x3d2f46){if(_0x3d2f46&&_0x3d2f46[_0x1cd3('0x4a')]===0x0){return db[_0x1cd3('0x25')][_0x1cd3('0x44')]({'name':_0x2542f6[_0x1cd3('0x28')],'resourceId':_0x2542f6['id'],'type':_0x3d2f46['name'],'sectionId':_0x3d2f46['id']},{})[_0x1cd3('0x23')](function(){return _0x4ab5d1;});}else{return _0x4ab5d1;}})[_0x1cd3('0x4b')](function(_0xbd4ea2){logger[_0x1cd3('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbd4ea2);throw _0xbd4ea2;});}return _0x4ab5d1;})[_0x1cd3('0x23')](respondWithResult(_0x3cde0b,0xc9))[_0x1cd3('0x4b')](handleError(_0x3cde0b,null));};exports[_0x1cd3('0x4d')]=function(_0x4a493a,_0x5e97af){var _0x41dd90={'where':{'id':_0x4a493a[_0x1cd3('0x42')]['id']}},_0x5e31b2={};_0x5e31b2[_0x1cd3('0x2f')]=_[_0x1cd3('0x30')](db[_0x1cd3('0x2b')]['rawAttributes']);_0x41dd90[_0x1cd3('0x34')]=_[_0x1cd3('0x33')](_0x5e31b2[_0x1cd3('0x2f')],qs[_0x1cd3('0x35')](_0x4a493a['query'][_0x1cd3('0x35')]));_0x41dd90[_0x1cd3('0x34')]=_0x41dd90['attributes']['length']?_0x41dd90[_0x1cd3('0x34')]:_0x5e31b2['model'];if(_0x4a493a[_0x1cd3('0x31')][_0x1cd3('0x3f')]){_0x41dd90[_0x1cd3('0x4e')]=[{'all':!![]}];}_0x41dd90=_[_0x1cd3('0x3b')]({},_0x41dd90,_0x4a493a[_0x1cd3('0x3e')]);return db[_0x1cd3('0x2b')][_0x1cd3('0x43')](_0x41dd90)['then'](handleEntityNotFound(_0x5e97af,null))[_0x1cd3('0x23')](function(_0x219a91){if(_0x219a91){var _0x22ea88=_0x219a91[_0x1cd3('0x47')]({'plain':!![]});_0x22ea88=qs[_0x1cd3('0x4f')](_0x22ea88,['id',_0x1cd3('0x50'),_0x1cd3('0x51')]);_0x4a493a[_0x1cd3('0x45')]=_[_0x1cd3('0x4f')](_0x4a493a[_0x1cd3('0x45')],['id',_0x1cd3('0x50'),_0x1cd3('0x51')]);return db[_0x1cd3('0x2b')]['create'](_[_0x1cd3('0x3b')](_0x22ea88,_0x4a493a['body']),{'include':_0x4a493a[_0x1cd3('0x31')][_0x1cd3('0x3f')]?[{'all':!![]}]:undefined})[_0x1cd3('0x23')](function(_0x4ee36a){var _0x24b5d4=_0x4a493a[_0x1cd3('0x46')][_0x1cd3('0x47')]({'plain':!![]});if(!_0x24b5d4)throw new Error(_0x1cd3('0x52'));if(_0x24b5d4[_0x1cd3('0x48')]===_0x1cd3('0x46')){var _0x24893d=_0x4ee36a[_0x1cd3('0x47')]({'plain':!![]});var _0x2775f2='IvrCampaigns';return db[_0x1cd3('0x53')][_0x1cd3('0x43')]({'where':{'name':_0x2775f2,'userProfileId':_0x24b5d4[_0x1cd3('0x49')]},'raw':!![]})[_0x1cd3('0x23')](function(_0x512838){if(_0x512838&&_0x512838[_0x1cd3('0x4a')]===0x0){return db[_0x1cd3('0x25')][_0x1cd3('0x44')]({'name':_0x24893d[_0x1cd3('0x28')],'resourceId':_0x24893d['id'],'type':_0x512838[_0x1cd3('0x28')],'sectionId':_0x512838['id']},{})[_0x1cd3('0x23')](function(){return _0x4ee36a;});}else{return _0x4ee36a;}})['catch'](function(_0x66accf){logger[_0x1cd3('0x4c')](_0x1cd3('0x54'),_0x66accf);throw _0x66accf;});}return _0x4ee36a;});}})[_0x1cd3('0x23')](respondWithResult(_0x5e97af,0xc9))[_0x1cd3('0x4b')](handleError(_0x5e97af,null));};exports[_0x1cd3('0x22')]=function(_0x332bd2,_0x1160da){if(_0x332bd2[_0x1cd3('0x45')]['id']){delete _0x332bd2[_0x1cd3('0x45')]['id'];}return db['Campaign'][_0x1cd3('0x43')]({'where':{'id':_0x332bd2[_0x1cd3('0x42')]['id']}})[_0x1cd3('0x23')](handleEntityNotFound(_0x1160da,null))[_0x1cd3('0x23')](saveUpdates(_0x332bd2[_0x1cd3('0x45')],null))[_0x1cd3('0x23')](respondWithResult(_0x1160da,null))[_0x1cd3('0x4b')](handleError(_0x1160da,null));};exports[_0x1cd3('0x55')]=function(_0x116288,_0x4fbf04){return db[_0x1cd3('0x2b')]['find']({'where':{'id':_0x116288[_0x1cd3('0x42')]['id']}})[_0x1cd3('0x23')](handleEntityNotFound(_0x4fbf04,null))['then'](removeEntity(_0x4fbf04,null))[_0x1cd3('0x4b')](handleError(_0x4fbf04,null));};exports[_0x1cd3('0x56')]=function(_0x22da0b,_0x5de6f0,_0x3ced1a){var _0xf29b07={'raw':!![],'where':{}};var _0x11c167={};var _0x106a18={'count':0x0,'rows':[]};return db[_0x1cd3('0x2b')]['findOne']({'where':{'id':_0x22da0b['params']['id']}})[_0x1cd3('0x23')](handleEntityNotFound(_0x5de6f0,null))[_0x1cd3('0x23')](function(_0x578733){if(_0x578733){_0x11c167[_0x1cd3('0x2f')]=_['keys'](db[_0x1cd3('0x57')]['rawAttributes']);_0x11c167['query']=_[_0x1cd3('0x30')](_0x22da0b['query']);_0x11c167[_0x1cd3('0x32')]=_['intersection'](_0x11c167[_0x1cd3('0x2f')],_0x11c167[_0x1cd3('0x31')]);_0xf29b07[_0x1cd3('0x34')]=_[_0x1cd3('0x33')](_0x11c167['model'],qs[_0x1cd3('0x35')](_0x22da0b[_0x1cd3('0x31')]['fields']));_0xf29b07[_0x1cd3('0x34')]=_0xf29b07[_0x1cd3('0x34')]['length']?_0xf29b07[_0x1cd3('0x34')]:_0x11c167[_0x1cd3('0x2f')];if(!_0x22da0b[_0x1cd3('0x31')]['hasOwnProperty'](_0x1cd3('0x38'))){_0xf29b07['limit']=qs[_0x1cd3('0x1e')](_0x22da0b[_0x1cd3('0x31')][_0x1cd3('0x1e')]);_0xf29b07[_0x1cd3('0x1c')]=qs['offset'](_0x22da0b[_0x1cd3('0x31')][_0x1cd3('0x1c')]);}_0xf29b07[_0x1cd3('0x39')]=qs[_0x1cd3('0x58')](_0x22da0b['query'][_0x1cd3('0x58')]);_0xf29b07[_0x1cd3('0x3c')]=qs[_0x1cd3('0x32')](_[_0x1cd3('0x59')](_0x22da0b['query'],_0x11c167[_0x1cd3('0x32')]));_0xf29b07['where'][_0x1cd3('0x5a')]=_0x578733['id'];if(_0x22da0b[_0x1cd3('0x31')][_0x1cd3('0x3a')]){_0xf29b07['where']=_[_0x1cd3('0x3b')](_0xf29b07[_0x1cd3('0x3c')],{'$or':_[_0x1cd3('0x2a')](_0xf29b07[_0x1cd3('0x34')],function(_0x23da64){var _0x29b2ec={};_0x29b2ec[_0x23da64]={'$like':'%'+_0x22da0b[_0x1cd3('0x31')][_0x1cd3('0x3a')]+'%'};return _0x29b2ec;})});}_0xf29b07=_[_0x1cd3('0x3b')]({},_0xf29b07,_0x22da0b[_0x1cd3('0x3e')]);return db['CmHopper'][_0x1cd3('0x1d')]({'where':_0xf29b07[_0x1cd3('0x3c')]})['then'](function(_0x257288){_0x106a18[_0x1cd3('0x1d')]=_0x257288;if(_0x22da0b[_0x1cd3('0x31')][_0x1cd3('0x3f')]){_0xf29b07[_0x1cd3('0x4e')]=[{'all':!![]}];}return db[_0x1cd3('0x57')][_0x1cd3('0x40')](_0xf29b07);})[_0x1cd3('0x23')](function(_0x1bb464){_0x106a18['rows']=_0x1bb464;return _0x106a18;});}})[_0x1cd3('0x23')](respondWithFilteredResult(_0x5de6f0,_0xf29b07))['catch'](handleError(_0x5de6f0,null));};exports[_0x1cd3('0x5b')]=function(_0x435a41,_0x498f23,_0x5e3846){var _0x5e1146={'raw':!![],'where':{}};var _0x43f489={};var _0x26c2d3={'count':0x0,'rows':[]};return db['Campaign'][_0x1cd3('0x5c')]({'where':{'id':_0x435a41[_0x1cd3('0x42')]['id']}})[_0x1cd3('0x23')](handleEntityNotFound(_0x498f23,null))['then'](function(_0x369879){if(_0x369879){_0x43f489[_0x1cd3('0x2f')]=_['keys'](db[_0x1cd3('0x5d')][_0x1cd3('0x2c')]);_0x43f489[_0x1cd3('0x31')]=_[_0x1cd3('0x30')](_0x435a41[_0x1cd3('0x31')]);_0x43f489[_0x1cd3('0x32')]=_['intersection'](_0x43f489[_0x1cd3('0x2f')],_0x43f489['query']);_0x5e1146[_0x1cd3('0x34')]=_[_0x1cd3('0x33')](_0x43f489[_0x1cd3('0x2f')],qs[_0x1cd3('0x35')](_0x435a41[_0x1cd3('0x31')][_0x1cd3('0x35')]));_0x5e1146[_0x1cd3('0x34')]=_0x5e1146[_0x1cd3('0x34')][_0x1cd3('0x36')]?_0x5e1146[_0x1cd3('0x34')]:_0x43f489['model'];if(!_0x435a41[_0x1cd3('0x31')][_0x1cd3('0x37')]('nolimit')){_0x5e1146[_0x1cd3('0x1e')]=qs['limit'](_0x435a41[_0x1cd3('0x31')][_0x1cd3('0x1e')]);_0x5e1146[_0x1cd3('0x1c')]=qs[_0x1cd3('0x1c')](_0x435a41[_0x1cd3('0x31')][_0x1cd3('0x1c')]);}_0x5e1146[_0x1cd3('0x39')]=qs[_0x1cd3('0x58')](_0x435a41[_0x1cd3('0x31')][_0x1cd3('0x58')]);_0x5e1146[_0x1cd3('0x3c')]=qs[_0x1cd3('0x32')](_['pick'](_0x435a41[_0x1cd3('0x31')],_0x43f489[_0x1cd3('0x32')]));_0x5e1146[_0x1cd3('0x3c')][_0x1cd3('0x5a')]=_0x369879['id'];if(_0x435a41[_0x1cd3('0x31')][_0x1cd3('0x3a')]){_0x5e1146[_0x1cd3('0x3c')]=_[_0x1cd3('0x3b')](_0x5e1146[_0x1cd3('0x3c')],{'$or':_['map'](_0x5e1146['attributes'],function(_0x4213d9){var _0x4d3724={};_0x4d3724[_0x4213d9]={'$like':'%'+_0x435a41[_0x1cd3('0x31')]['filter']+'%'};return _0x4d3724;})});}_0x5e1146=_[_0x1cd3('0x3b')]({},_0x5e1146,_0x435a41[_0x1cd3('0x3e')]);return db[_0x1cd3('0x5d')][_0x1cd3('0x1d')]({'where':_0x5e1146['where']})[_0x1cd3('0x23')](function(_0x347313){_0x26c2d3['count']=_0x347313;if(_0x435a41['query'][_0x1cd3('0x3f')]){_0x5e1146[_0x1cd3('0x4e')]=[{'all':!![]}];}return db[_0x1cd3('0x5d')][_0x1cd3('0x40')](_0x5e1146);})[_0x1cd3('0x23')](function(_0xa6f0d0){_0x26c2d3[_0x1cd3('0x5e')]=_0xa6f0d0;return _0x26c2d3;});}})['then'](respondWithFilteredResult(_0x498f23,_0x5e1146))[_0x1cd3('0x4b')](handleError(_0x498f23,null));};exports[_0x1cd3('0x5f')]=function(_0x5afaf2,_0xb29fec,_0x1a48c4){var _0x54b93b={'raw':!![],'where':{}};var _0x5e6bc6={};var _0x47df12={'count':0x0,'rows':[]};return db['Campaign'][_0x1cd3('0x5c')]({'where':{'id':_0x5afaf2[_0x1cd3('0x42')]['id']}})[_0x1cd3('0x23')](handleEntityNotFound(_0xb29fec,null))['then'](function(_0x58acc1){if(_0x58acc1){_0x5e6bc6[_0x1cd3('0x2f')]=_['keys'](db[_0x1cd3('0x60')]['rawAttributes']);_0x5e6bc6[_0x1cd3('0x31')]=_[_0x1cd3('0x30')](_0x5afaf2[_0x1cd3('0x31')]);_0x5e6bc6['filters']=_['intersection'](_0x5e6bc6[_0x1cd3('0x2f')],_0x5e6bc6[_0x1cd3('0x31')]);_0x54b93b[_0x1cd3('0x34')]=_['intersection'](_0x5e6bc6['model'],qs['fields'](_0x5afaf2[_0x1cd3('0x31')][_0x1cd3('0x35')]));_0x54b93b['attributes']=_0x54b93b['attributes']['length']?_0x54b93b[_0x1cd3('0x34')]:_0x5e6bc6[_0x1cd3('0x2f')];if(!_0x5afaf2[_0x1cd3('0x31')][_0x1cd3('0x37')]('nolimit')){_0x54b93b['limit']=qs[_0x1cd3('0x1e')](_0x5afaf2[_0x1cd3('0x31')][_0x1cd3('0x1e')]);_0x54b93b[_0x1cd3('0x1c')]=qs['offset'](_0x5afaf2[_0x1cd3('0x31')][_0x1cd3('0x1c')]);}_0x54b93b[_0x1cd3('0x39')]=qs['sort'](_0x5afaf2[_0x1cd3('0x31')]['sort']);_0x54b93b[_0x1cd3('0x3c')]=qs['filters'](_[_0x1cd3('0x59')](_0x5afaf2[_0x1cd3('0x31')],_0x5e6bc6['filters']));_0x54b93b[_0x1cd3('0x3c')]['CampaignId']=_0x58acc1['id'];if(_0x5afaf2[_0x1cd3('0x31')][_0x1cd3('0x3a')]){_0x54b93b[_0x1cd3('0x3c')]=_[_0x1cd3('0x3b')](_0x54b93b[_0x1cd3('0x3c')],{'$or':_[_0x1cd3('0x2a')](_0x54b93b[_0x1cd3('0x34')],function(_0x501cb6){var _0x4d09b3={};_0x4d09b3[_0x501cb6]={'$like':'%'+_0x5afaf2[_0x1cd3('0x31')][_0x1cd3('0x3a')]+'%'};return _0x4d09b3;})});}_0x54b93b=_[_0x1cd3('0x3b')]({},_0x54b93b,_0x5afaf2['options']);return db[_0x1cd3('0x60')][_0x1cd3('0x1d')]({'where':_0x54b93b[_0x1cd3('0x3c')]})[_0x1cd3('0x23')](function(_0x1e211a){_0x47df12[_0x1cd3('0x1d')]=_0x1e211a;if(_0x5afaf2[_0x1cd3('0x31')][_0x1cd3('0x3f')]){_0x54b93b[_0x1cd3('0x4e')]=[{'all':!![]}];}return db[_0x1cd3('0x60')][_0x1cd3('0x40')](_0x54b93b);})['then'](function(_0x1a1303){_0x47df12[_0x1cd3('0x5e')]=_0x1a1303;return _0x47df12;});}})[_0x1cd3('0x23')](respondWithFilteredResult(_0xb29fec,_0x54b93b))[_0x1cd3('0x4b')](handleError(_0xb29fec,null));};exports[_0x1cd3('0x61')]=function(_0x57ec93,_0x3877bb,_0x4553fa){var _0x33ce86={'raw':!![],'where':{}};var _0x4ff342={};var _0x5ec840={'count':0x0,'rows':[]};return db[_0x1cd3('0x2b')][_0x1cd3('0x5c')]({'where':{'id':_0x57ec93[_0x1cd3('0x42')]['id']}})[_0x1cd3('0x23')](handleEntityNotFound(_0x3877bb,null))['then'](function(_0x3f2413){if(_0x3f2413){_0x4ff342['model']=_[_0x1cd3('0x30')](db[_0x1cd3('0x62')][_0x1cd3('0x2c')]);_0x4ff342['query']=_[_0x1cd3('0x30')](_0x57ec93[_0x1cd3('0x31')]);_0x4ff342[_0x1cd3('0x32')]=_[_0x1cd3('0x33')](_0x4ff342[_0x1cd3('0x2f')],_0x4ff342[_0x1cd3('0x31')]);_0x33ce86[_0x1cd3('0x34')]=_['intersection'](_0x4ff342[_0x1cd3('0x2f')],qs[_0x1cd3('0x35')](_0x57ec93[_0x1cd3('0x31')][_0x1cd3('0x35')]));_0x33ce86[_0x1cd3('0x34')]=_0x33ce86[_0x1cd3('0x34')]['length']?_0x33ce86['attributes']:_0x4ff342[_0x1cd3('0x2f')];if(!_0x57ec93[_0x1cd3('0x31')][_0x1cd3('0x37')](_0x1cd3('0x38'))){_0x33ce86[_0x1cd3('0x1e')]=qs[_0x1cd3('0x1e')](_0x57ec93[_0x1cd3('0x31')]['limit']);_0x33ce86['offset']=qs[_0x1cd3('0x1c')](_0x57ec93[_0x1cd3('0x31')][_0x1cd3('0x1c')]);}_0x33ce86[_0x1cd3('0x39')]=qs['sort'](_0x57ec93[_0x1cd3('0x31')]['sort']);_0x33ce86[_0x1cd3('0x3c')]=qs['filters'](_[_0x1cd3('0x59')](_0x57ec93[_0x1cd3('0x31')],_0x4ff342[_0x1cd3('0x32')]));_0x33ce86['where'][_0x1cd3('0x5a')]=_0x3f2413['id'];if(_0x57ec93['query'][_0x1cd3('0x3a')]){_0x33ce86['where']=_['merge'](_0x33ce86[_0x1cd3('0x3c')],{'$or':_[_0x1cd3('0x2a')](_0x33ce86[_0x1cd3('0x34')],function(_0x314959){var _0x58e2ea={};_0x58e2ea[_0x314959]={'$like':'%'+_0x57ec93['query'][_0x1cd3('0x3a')]+'%'};return _0x58e2ea;})});}_0x33ce86=_['merge']({},_0x33ce86,_0x57ec93['options']);return db[_0x1cd3('0x62')][_0x1cd3('0x1d')]({'where':_0x33ce86['where']})[_0x1cd3('0x23')](function(_0x380fa3){_0x5ec840[_0x1cd3('0x1d')]=_0x380fa3;if(_0x57ec93[_0x1cd3('0x31')]['includeAll']){_0x33ce86[_0x1cd3('0x4e')]=[{'all':!![]}];}return db[_0x1cd3('0x62')][_0x1cd3('0x40')](_0x33ce86);})[_0x1cd3('0x23')](function(_0x334083){_0x5ec840[_0x1cd3('0x5e')]=_0x334083;return _0x5ec840;});}})[_0x1cd3('0x23')](respondWithFilteredResult(_0x3877bb,_0x33ce86))[_0x1cd3('0x4b')](handleError(_0x3877bb,null));};exports[_0x1cd3('0x63')]=function(_0x223a28,_0x2a0e4b,_0x14f20f){var _0x316c7b={};var _0x3c4056={};var _0x355046;var _0x5f2445;return db['Campaign'][_0x1cd3('0x5c')]({'where':{'id':_0x223a28['params']['id']}})['then'](handleEntityNotFound(_0x2a0e4b,null))['then'](function(_0x267854){if(_0x267854){_0x355046=_0x267854;_0x3c4056[_0x1cd3('0x2f')]=_[_0x1cd3('0x30')](db[_0x1cd3('0x64')][_0x1cd3('0x2c')]);_0x3c4056[_0x1cd3('0x31')]=_[_0x1cd3('0x30')](_0x223a28[_0x1cd3('0x31')]);_0x3c4056[_0x1cd3('0x32')]=_[_0x1cd3('0x33')](_0x3c4056[_0x1cd3('0x2f')],_0x3c4056[_0x1cd3('0x31')]);_0x316c7b[_0x1cd3('0x34')]=_['intersection'](_0x3c4056['model'],qs['fields'](_0x223a28[_0x1cd3('0x31')][_0x1cd3('0x35')]));_0x316c7b[_0x1cd3('0x34')]=_0x316c7b['attributes'][_0x1cd3('0x36')]?_0x316c7b['attributes']:_0x3c4056['model'];_0x316c7b['order']=qs['sort'](_0x223a28['query']['sort']);_0x316c7b[_0x1cd3('0x3c')]=qs[_0x1cd3('0x32')](_[_0x1cd3('0x59')](_0x223a28[_0x1cd3('0x31')],_0x3c4056[_0x1cd3('0x32')]));if(_0x223a28[_0x1cd3('0x31')]['filter']){_0x316c7b['where']=_[_0x1cd3('0x3b')](_0x316c7b[_0x1cd3('0x3c')],{'$or':_[_0x1cd3('0x2a')](_0x316c7b['attributes'],function(_0x333af1){var _0xda0d41={};_0xda0d41[_0x333af1]={'$like':'%'+_0x223a28[_0x1cd3('0x31')][_0x1cd3('0x3a')]+'%'};return _0xda0d41;})});}_0x316c7b=_[_0x1cd3('0x3b')]({},_0x316c7b,_0x223a28[_0x1cd3('0x3e')]);return _0x355046[_0x1cd3('0x63')](_0x316c7b);}})[_0x1cd3('0x23')](function(_0x1b2fb8){if(_0x1b2fb8){_0x5f2445=_0x1b2fb8['length'];if(!_0x223a28[_0x1cd3('0x31')][_0x1cd3('0x37')]('nolimit')){_0x316c7b['limit']=qs[_0x1cd3('0x1e')](_0x223a28[_0x1cd3('0x31')][_0x1cd3('0x1e')]);_0x316c7b[_0x1cd3('0x1c')]=qs[_0x1cd3('0x1c')](_0x223a28['query'][_0x1cd3('0x1c')]);}return _0x355046[_0x1cd3('0x63')](_0x316c7b);}})['then'](function(_0x5a208f){if(_0x5a208f){return _0x5a208f?{'count':_0x5f2445,'rows':_0x5a208f}:null;}})[_0x1cd3('0x23')](respondWithResult(_0x2a0e4b,null))[_0x1cd3('0x4b')](handleError(_0x2a0e4b,null));};exports['addLists']=function(_0x1d24bf,_0x3a7fc8,_0x162b34){var _0x1a720e,_0x374369;var _0x1218be=[];var _0xfb5b55=moment()['format'](_0x1cd3('0x65'));return db[_0x1cd3('0x2b')][_0x1cd3('0x43')]({'where':{'id':_0x1d24bf[_0x1cd3('0x42')]['id']}})['then'](handleEntityNotFound(_0x3a7fc8,null))[_0x1cd3('0x23')](function(_0x1eab54){if(_0x1eab54){_0x374369=_0x1eab54;return _0x1eab54[_0x1cd3('0x66')](_0x1d24bf['body']['ids'],_[_0x1cd3('0x4f')](_0x1d24bf[_0x1cd3('0x45')],['ids','id'])||{});}return null;})['spread'](function(_0x2b6983){var _0x52adab;var _0x45f346;_0x1a720e=_0x2b6983||[];var _0xcccb18=[];if(_0x2b6983){for(var _0x2d9d2c=0x0;_0x2d9d2c<_0x2b6983[_0x1cd3('0x36')];_0x2d9d2c+=0x1){var _0x438f7e=_0x2b6983[_0x2d9d2c]['get']({'plain':!![]});_0x374369['dialCheckDuplicateType']=_0x1d24bf[_0x1cd3('0x45')][_0x1cd3('0x67')]?_0x1d24bf[_0x1cd3('0x45')][_0x1cd3('0x67')]:_0x374369['dialCheckDuplicateType'];switch(_0x374369[_0x1cd3('0x67')]){case _0x1cd3('0x68'):_0x52adab=squel[_0x1cd3('0x69')]()[_0x1cd3('0x6a')](_0x1cd3('0x6b'))[_0x1cd3('0x6c')]([_0x1cd3('0x6d'),_0x1cd3('0x6e'),_0x1cd3('0x6f'),_0x1cd3('0x70'),_0x1cd3('0x5a'),'createdAt',_0x1cd3('0x51')],squel[_0x1cd3('0x71')]()[_0x1cd3('0x72')](_0x1cd3('0x6d'),_0x1cd3('0x6d'))[_0x1cd3('0x72')](_0x1cd3('0x73'),_0x1cd3('0x6e'))[_0x1cd3('0x72')]('id','ContactId')[_0x1cd3('0x72')](_0x438f7e[_0x1cd3('0x74')][_0x1cd3('0x75')](),_0x1cd3('0x70'))[_0x1cd3('0x72')](_0x1d24bf['params']['id'][_0x1cd3('0x75')](),_0x1cd3('0x5a'))[_0x1cd3('0x72')]('\x27'+_0xfb5b55+'\x27',_0x1cd3('0x50'))['field']('\x27'+_0xfb5b55+'\x27',_0x1cd3('0x51'))['from'](_0x1cd3('0x76'))[_0x1cd3('0x3c')](_0x1cd3('0x77'))[_0x1cd3('0x3c')](_0x1cd3('0x78'),_0x438f7e[_0x1cd3('0x74')][_0x1cd3('0x75')]())['where'](_0x1cd3('0x79'))[_0x1cd3('0x3c')](_0x1cd3('0x7a'),squel[_0x1cd3('0x71')]()[_0x1cd3('0x72')](_0x1cd3('0x7b'))[_0x1cd3('0x7c')]('cm_hopper_final')[_0x1cd3('0x3c')]('CampaignId\x20=\x20?',_0x1d24bf[_0x1cd3('0x42')]['id'][_0x1cd3('0x75')]()))['where'](_0x1cd3('0x7a'),squel[_0x1cd3('0x71')]()[_0x1cd3('0x72')](_0x1cd3('0x7d'))[_0x1cd3('0x7c')](_0x1cd3('0x6b'))[_0x1cd3('0x3c')](_0x1cd3('0x7e'),_0x1d24bf[_0x1cd3('0x42')]['id']['toString']())))[_0x1cd3('0x75')]();break;case'onlyIfOpen':_0x52adab=squel[_0x1cd3('0x69')]()[_0x1cd3('0x6a')]('cm_hopper')[_0x1cd3('0x6c')]([_0x1cd3('0x6d'),_0x1cd3('0x6e'),_0x1cd3('0x6f'),_0x1cd3('0x70'),_0x1cd3('0x5a'),_0x1cd3('0x50'),_0x1cd3('0x51')],squel['select']()[_0x1cd3('0x72')](_0x1cd3('0x6d'),_0x1cd3('0x6d'))[_0x1cd3('0x72')](_0x1cd3('0x73'),_0x1cd3('0x6e'))[_0x1cd3('0x72')]('id',_0x1cd3('0x6f'))[_0x1cd3('0x72')](_0x438f7e['CmListId']['toString'](),_0x1cd3('0x70'))[_0x1cd3('0x72')](_0x1d24bf['params']['id'][_0x1cd3('0x75')](),_0x1cd3('0x5a'))[_0x1cd3('0x72')]('\x27'+_0xfb5b55+'\x27',_0x1cd3('0x50'))[_0x1cd3('0x72')]('\x27'+_0xfb5b55+'\x27',_0x1cd3('0x51'))[_0x1cd3('0x7c')](_0x1cd3('0x76'))[_0x1cd3('0x3c')](_0x1cd3('0x77'))['where'](_0x1cd3('0x78'),_0x438f7e[_0x1cd3('0x74')][_0x1cd3('0x75')]())[_0x1cd3('0x3c')](_0x1cd3('0x79'))['where'](_0x1cd3('0x7a'),squel[_0x1cd3('0x71')]()['field']('COALESCE(phone,\x27\x27)')[_0x1cd3('0x7c')](_0x1cd3('0x6b'))[_0x1cd3('0x3c')](_0x1cd3('0x7e'),_0x1d24bf[_0x1cd3('0x42')]['id']['toString']())))[_0x1cd3('0x75')]();break;default:_0x52adab=squel['insert']()[_0x1cd3('0x6a')]('cm_hopper')[_0x1cd3('0x6c')](['phone','scheduledAt','ContactId',_0x1cd3('0x70'),_0x1cd3('0x5a'),_0x1cd3('0x50'),_0x1cd3('0x51')],squel[_0x1cd3('0x71')]()[_0x1cd3('0x72')]('phone',_0x1cd3('0x6d'))[_0x1cd3('0x72')](_0x1cd3('0x73'),_0x1cd3('0x6e'))[_0x1cd3('0x72')]('id',_0x1cd3('0x6f'))[_0x1cd3('0x72')](_0x438f7e[_0x1cd3('0x74')][_0x1cd3('0x75')](),_0x1cd3('0x70'))['field'](_0x1d24bf[_0x1cd3('0x42')]['id'][_0x1cd3('0x75')](),_0x1cd3('0x5a'))[_0x1cd3('0x72')]('\x27'+_0xfb5b55+'\x27','createdAt')[_0x1cd3('0x72')]('\x27'+_0xfb5b55+'\x27',_0x1cd3('0x51'))[_0x1cd3('0x7c')](_0x1cd3('0x76'))[_0x1cd3('0x3c')](_0x1cd3('0x77'))[_0x1cd3('0x3c')](_0x1cd3('0x78'),_0x438f7e[_0x1cd3('0x74')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1cd3('0x75')]();}_0x45f346=squel['insert']()['into'](_0x1cd3('0x7f'))[_0x1cd3('0x6c')]([_0x1cd3('0x80'),_0x1cd3('0x6e'),_0x1cd3('0x6d'),'OrderBy',_0x1cd3('0x50'),_0x1cd3('0x51')],squel[_0x1cd3('0x71')]()[_0x1cd3('0x72')](_0x1cd3('0x81'),'id')[_0x1cd3('0x72')]('NOW()',_0x1cd3('0x6e'))[_0x1cd3('0x72')]('ci.item',_0x1cd3('0x6d'))['field'](_0x1cd3('0x82'),_0x1cd3('0x83'))[_0x1cd3('0x72')]('\x27'+_0xfb5b55+'\x27',_0x1cd3('0x50'))[_0x1cd3('0x72')]('\x27'+_0xfb5b55+'\x27',_0x1cd3('0x51'))[_0x1cd3('0x7c')](_0x1cd3('0x84'),'ci')[_0x1cd3('0x85')]('cm_hopper','h',_0x1cd3('0x86'))['where'](_0x1cd3('0x87'),_0x438f7e['CmListId']['toString']())[_0x1cd3('0x3c')](_0x1cd3('0x88'),_0x1d24bf[_0x1cd3('0x42')]['id'][_0x1cd3('0x75')]())['where'](_0x1cd3('0x89'),_0xfb5b55))[_0x1cd3('0x75')]();_0xcccb18['push'](db[_0x1cd3('0x8a')]['query'](_0x52adab));_0x1218be[_0x1cd3('0x8b')](db[_0x1cd3('0x8a')][_0x1cd3('0x31')](_0x45f346));}return BPromise[_0x1cd3('0x8c')](_0xcccb18);}})[_0x1cd3('0x23')](function(){return BPromise[_0x1cd3('0x8c')](_0x1218be);})[_0x1cd3('0x23')](function(){return _0x1a720e;})[_0x1cd3('0x23')](respondWithResult(_0x3a7fc8,null))['catch'](handleError(_0x3a7fc8,null));};exports[_0x1cd3('0x8d')]=function(_0x3eda9b,_0x25b2f2,_0x248b2c){return db[_0x1cd3('0x2b')][_0x1cd3('0x43')]({'where':{'id':_0x3eda9b[_0x1cd3('0x42')]['id']}})[_0x1cd3('0x23')](handleEntityNotFound(_0x25b2f2,null))[_0x1cd3('0x23')](function(_0x4c970e){if(_0x4c970e){return _0x4c970e[_0x1cd3('0x8d')](_0x3eda9b[_0x1cd3('0x31')][_0x1cd3('0x8e')]);}})[_0x1cd3('0x23')](function(_0x235574){if(_0x235574){return db['CmHopper']['destroy']({'where':{'ListId':_0x3eda9b[_0x1cd3('0x31')][_0x1cd3('0x8e')],'CampaignId':_0x3eda9b[_0x1cd3('0x42')]['id']}})[_0x1cd3('0x23')](function(){return _0x235574;});}})['then'](respondWithStatusCode(_0x25b2f2,null))[_0x1cd3('0x4b')](handleError(_0x25b2f2,null));};exports[_0x1cd3('0x8f')]=function(_0x9e08b0,_0x1d549b,_0x21509d){var _0x54f80e={};var _0xe6f8f3={};var _0x118241;var _0xe7687;return db[_0x1cd3('0x2b')][_0x1cd3('0x5c')]({'where':{'id':_0x9e08b0['params']['id']}})[_0x1cd3('0x23')](handleEntityNotFound(_0x1d549b,null))['then'](function(_0x3162cc){if(_0x3162cc){_0x118241=_0x3162cc;_0xe6f8f3[_0x1cd3('0x2f')]=_['keys'](db[_0x1cd3('0x64')][_0x1cd3('0x2c')]);_0xe6f8f3[_0x1cd3('0x31')]=_['keys'](_0x9e08b0[_0x1cd3('0x31')]);_0xe6f8f3[_0x1cd3('0x32')]=_[_0x1cd3('0x33')](_0xe6f8f3['model'],_0xe6f8f3[_0x1cd3('0x31')]);_0x54f80e[_0x1cd3('0x34')]=_[_0x1cd3('0x33')](_0xe6f8f3[_0x1cd3('0x2f')],qs['fields'](_0x9e08b0['query'][_0x1cd3('0x35')]));_0x54f80e[_0x1cd3('0x34')]=_0x54f80e['attributes'][_0x1cd3('0x36')]?_0x54f80e['attributes']:_0xe6f8f3['model'];_0x54f80e[_0x1cd3('0x39')]=qs[_0x1cd3('0x58')](_0x9e08b0[_0x1cd3('0x31')]['sort']);_0x54f80e[_0x1cd3('0x3c')]=qs[_0x1cd3('0x32')](_[_0x1cd3('0x59')](_0x9e08b0[_0x1cd3('0x31')],_0xe6f8f3[_0x1cd3('0x32')]));if(_0x9e08b0[_0x1cd3('0x31')][_0x1cd3('0x3a')]){_0x54f80e[_0x1cd3('0x3c')]=_['merge'](_0x54f80e[_0x1cd3('0x3c')],{'$or':_[_0x1cd3('0x2a')](_0x54f80e['attributes'],function(_0x4800d4){var _0x2bf3b7={};_0x2bf3b7[_0x4800d4]={'$like':'%'+_0x9e08b0['query']['filter']+'%'};return _0x2bf3b7;})});}_0x54f80e=_[_0x1cd3('0x3b')]({},_0x54f80e,_0x9e08b0['options']);return _0x118241[_0x1cd3('0x8f')](_0x54f80e);}})[_0x1cd3('0x23')](function(_0x5ddf28){if(_0x5ddf28){_0xe7687=_0x5ddf28['length'];if(!_0x9e08b0[_0x1cd3('0x31')][_0x1cd3('0x37')](_0x1cd3('0x38'))){_0x54f80e[_0x1cd3('0x1e')]=qs[_0x1cd3('0x1e')](_0x9e08b0['query']['limit']);_0x54f80e['offset']=qs['offset'](_0x9e08b0[_0x1cd3('0x31')][_0x1cd3('0x1c')]);}return _0x118241[_0x1cd3('0x8f')](_0x54f80e);}})[_0x1cd3('0x23')](function(_0x1ef24b){if(_0x1ef24b){return _0x1ef24b?{'count':_0xe7687,'rows':_0x1ef24b}:null;}})[_0x1cd3('0x23')](respondWithResult(_0x1d549b,null))['catch'](handleError(_0x1d549b,null));};exports['addBlackLists']=function(_0x21106d,_0x53966a,_0x13a18f){var _0x4b0ad9,_0x3e2888;var _0x598320=[];var _0x3864e2=moment()[_0x1cd3('0x90')](_0x1cd3('0x65'));return db[_0x1cd3('0x2b')]['find']({'where':{'id':_0x21106d[_0x1cd3('0x42')]['id']}})['then'](handleEntityNotFound(_0x53966a,null))['then'](function(_0x284d11){if(_0x284d11){_0x3e2888=_0x284d11;return _0x284d11[_0x1cd3('0x91')](_0x21106d[_0x1cd3('0x45')][_0x1cd3('0x8e')],_[_0x1cd3('0x4f')](_0x21106d[_0x1cd3('0x45')],[_0x1cd3('0x8e'),'id'])||{});}return null;})['spread'](function(_0x4e56c4){var _0x54a3e6;var _0x3f747c;_0x4b0ad9=_0x4e56c4||[];var _0x174d04=[];if(_0x4e56c4){for(var _0x552fd7=0x0;_0x552fd7<_0x4e56c4[_0x1cd3('0x36')];_0x552fd7+=0x1){var _0x204452=_0x4e56c4[_0x552fd7][_0x1cd3('0x47')]({'plain':!![]});_0x54a3e6=squel[_0x1cd3('0x69')]()[_0x1cd3('0x6a')](_0x1cd3('0x92'))[_0x1cd3('0x6c')]([_0x1cd3('0x6d'),_0x1cd3('0x6f'),'ListId',_0x1cd3('0x5a'),_0x1cd3('0x50'),_0x1cd3('0x51')],squel[_0x1cd3('0x71')]()[_0x1cd3('0x72')](_0x1cd3('0x6d'),_0x1cd3('0x6d'))[_0x1cd3('0x72')]('id','ContactId')[_0x1cd3('0x72')](_0x204452[_0x1cd3('0x74')][_0x1cd3('0x75')](),_0x1cd3('0x70'))[_0x1cd3('0x72')](_0x21106d[_0x1cd3('0x42')]['id'][_0x1cd3('0x75')](),_0x1cd3('0x5a'))[_0x1cd3('0x72')](_0x1cd3('0x73'),_0x1cd3('0x50'))[_0x1cd3('0x72')](_0x1cd3('0x73'),_0x1cd3('0x51'))[_0x1cd3('0x7c')]('cm_contacts')[_0x1cd3('0x3c')](_0x1cd3('0x77'))[_0x1cd3('0x3c')](_0x1cd3('0x78'),_0x204452['CmListId']['toString']())['where'](_0x1cd3('0x79')))[_0x1cd3('0x75')]();_0x174d04[_0x1cd3('0x8b')](db[_0x1cd3('0x8a')][_0x1cd3('0x31')](_0x54a3e6));}return BPromise['all'](_0x174d04);}})['then'](function(){return _0x4b0ad9;})[_0x1cd3('0x23')](respondWithResult(_0x53966a,null))[_0x1cd3('0x4b')](handleError(_0x53966a,null));};exports[_0x1cd3('0x93')]=function(_0x403c43,_0x2ac542,_0x2bac13){return db['Campaign']['find']({'where':{'id':_0x403c43[_0x1cd3('0x42')]['id']}})[_0x1cd3('0x23')](handleEntityNotFound(_0x2ac542,null))[_0x1cd3('0x23')](function(_0xb45f39){if(_0xb45f39){return _0xb45f39['removeBlackLists'](_0x403c43['query']['ids']);}})['then'](function(_0x5ac299){if(_0x5ac299){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x403c43['query'][_0x1cd3('0x8e')],'CampaignId':_0x403c43[_0x1cd3('0x42')]['id']}})['then'](function(){return _0x5ac299;});}})[_0x1cd3('0x23')](respondWithStatusCode(_0x2ac542,null))[_0x1cd3('0x4b')](handleError(_0x2ac542,null));}; \ No newline at end of file +var _0x6324=['CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','into','fromQuery','ListId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.createdAt\x20=\x20?','push','sequelize','all','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','map','Campaign','fieldName','type','keys','query','filters','intersection','model','attributes','nolimit','order','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','fields','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','omit','updatedAt','body','getHoppers','findOne','CmHopper','hasOwnProperty','sort','getHopperHistories','CmHopperHistory','CampaignId','rows','getHopperFinals','CmHopperFinal','pick','CmHopperBlack','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','cm_hopper','scheduledAt','ContactId','ListId','createdAt','select','field','phone','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final'];(function(_0x110f59,_0x31ef13){var _0x5b77e8=function(_0x317244){while(--_0x317244){_0x110f59['push'](_0x110f59['shift']());}};_0x5b77e8(++_0x31ef13);}(_0x6324,0x142));var _0x4632=function(_0x4afc33,_0x5088fd){_0x4afc33=_0x4afc33-0x0;var _0x448b1c=_0x6324[_0x4afc33];return _0x448b1c;};'use strict';var emlformat=require(_0x4632('0x0'));var rimraf=require(_0x4632('0x1'));var zipdir=require(_0x4632('0x2'));var jsonpatch=require(_0x4632('0x3'));var rp=require('request-promise');var moment=require(_0x4632('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4632('0x5'));var util=require('util');var path=require(_0x4632('0x6'));var sox=require('sox');var csv=require(_0x4632('0x7'));var ejs=require(_0x4632('0x8'));var fs=require('fs');var fs_extra=require(_0x4632('0x9'));var _=require(_0x4632('0xa'));var squel=require('squel');var crypto=require(_0x4632('0xb'));var jsforce=require(_0x4632('0xc'));var deskjs=require(_0x4632('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4632('0xe'));var Papa=require(_0x4632('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4632('0x10'));var as=require(_0x4632('0x11'));var hardwareService=require(_0x4632('0x12'));var logger=require(_0x4632('0x13'))(_0x4632('0x14'));var utils=require(_0x4632('0x15'));var config=require(_0x4632('0x16'));var licenseUtil=require(_0x4632('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b3f0f,_0x499d88){_0x499d88=_0x499d88||0xcc;return function(_0x4719f7){if(_0x4719f7){return _0x2b3f0f[_0x4632('0x18')](_0x499d88);}return _0x2b3f0f[_0x4632('0x19')](_0x499d88)[_0x4632('0x1a')]();};}function respondWithResult(_0x51ee37,_0x3ba361){_0x3ba361=_0x3ba361||0xc8;return function(_0x255882){if(_0x255882){return _0x51ee37[_0x4632('0x19')](_0x3ba361)[_0x4632('0x1b')](_0x255882);}};}function respondWithFilteredResult(_0x1c1be0,_0x5438ab){return function(_0x47b349){if(_0x47b349){var _0x2fd7ae=typeof _0x5438ab[_0x4632('0x1c')]===_0x4632('0x1d')&&typeof _0x5438ab[_0x4632('0x1e')]==='undefined';var _0x158831=_0x47b349[_0x4632('0x1f')];var _0x1a94c0=_0x2fd7ae?0x0:_0x5438ab['offset'];var _0x3cddfa=_0x2fd7ae?_0x47b349[_0x4632('0x1f')]:_0x5438ab['offset']+_0x5438ab['limit'];var _0x1c0523;if(_0x3cddfa>=_0x158831){_0x3cddfa=_0x158831;_0x1c0523=0xc8;}else{_0x1c0523=0xce;}_0x1c1be0[_0x4632('0x19')](_0x1c0523);return _0x1c1be0[_0x4632('0x20')](_0x4632('0x21'),_0x1a94c0+'-'+_0x3cddfa+'/'+_0x158831)[_0x4632('0x1b')](_0x47b349);}return null;};}function patchUpdates(_0x3d2d23){return function(_0x9ab826){try{jsonpatch[_0x4632('0x22')](_0x9ab826,_0x3d2d23,!![]);}catch(_0x29f875){return BPromise[_0x4632('0x23')](_0x29f875);}return _0x9ab826[_0x4632('0x24')]();};}function saveUpdates(_0x2d656a,_0x2ca6a5){return function(_0x263907){if(_0x263907){return _0x263907[_0x4632('0x25')](_0x2d656a)[_0x4632('0x26')](function(_0x4264d5){return _0x4264d5;});}return null;};}function removeEntity(_0x3537ed,_0x380a9f){return function(_0x1e1b86){if(_0x1e1b86){return _0x1e1b86[_0x4632('0x27')]()[_0x4632('0x26')](function(){var _0x3b0823=_0x1e1b86[_0x4632('0x28')]({'plain':!![]});var _0xb074d=_0x4632('0x29');return db[_0x4632('0x2a')][_0x4632('0x27')]({'where':{'type':_0xb074d,'resourceId':_0x3b0823['id']}})[_0x4632('0x26')](function(){return _0x1e1b86;});})[_0x4632('0x26')](function(){_0x3537ed[_0x4632('0x19')](0xcc)[_0x4632('0x1a')]();});}};}function handleEntityNotFound(_0x438354,_0x4d9098){return function(_0x57798a){if(!_0x57798a){_0x438354[_0x4632('0x18')](0x194);}return _0x57798a;};}function handleError(_0x244743,_0x2f6656){_0x2f6656=_0x2f6656||0x1f4;return function(_0x35a533){logger[_0x4632('0x2b')](_0x35a533[_0x4632('0x2c')]);if(_0x35a533[_0x4632('0x2d')]){delete _0x35a533['name'];}_0x244743[_0x4632('0x19')](_0x2f6656)[_0x4632('0x2e')](_0x35a533);};}exports['index']=function(_0x216119,_0x5316f7){var _0x6599ad={},_0x4cb661={},_0x4fda35={'count':0x0,'rows':[]};var _0x1973eb=_[_0x4632('0x2f')](db[_0x4632('0x30')]['rawAttributes'],function(_0x5ed4d6){return{'name':_0x5ed4d6[_0x4632('0x31')],'type':_0x5ed4d6[_0x4632('0x32')]['key']};});_0x4cb661['model']=_[_0x4632('0x2f')](_0x1973eb,_0x4632('0x2d'));_0x4cb661['query']=_[_0x4632('0x33')](_0x216119[_0x4632('0x34')]);_0x4cb661[_0x4632('0x35')]=_[_0x4632('0x36')](_0x4cb661[_0x4632('0x37')],_0x4cb661['query']);_0x6599ad[_0x4632('0x38')]=_[_0x4632('0x36')](_0x4cb661['model'],qs['fields'](_0x216119[_0x4632('0x34')]['fields']));_0x6599ad['attributes']=_0x6599ad[_0x4632('0x38')]['length']?_0x6599ad[_0x4632('0x38')]:_0x4cb661[_0x4632('0x37')];if(!_0x216119[_0x4632('0x34')]['hasOwnProperty'](_0x4632('0x39'))){_0x6599ad[_0x4632('0x1e')]=qs[_0x4632('0x1e')](_0x216119[_0x4632('0x34')][_0x4632('0x1e')]);_0x6599ad['offset']=qs['offset'](_0x216119[_0x4632('0x34')][_0x4632('0x1c')]);}_0x6599ad[_0x4632('0x3a')]=qs['sort'](_0x216119['query']['sort']);_0x6599ad[_0x4632('0x3b')]=qs[_0x4632('0x35')](_['pick'](_0x216119[_0x4632('0x34')],_0x4cb661[_0x4632('0x35')]),_0x1973eb);if(_0x216119[_0x4632('0x34')][_0x4632('0x3c')]){_0x6599ad[_0x4632('0x3b')]=_[_0x4632('0x3d')](_0x6599ad[_0x4632('0x3b')],{'$or':_[_0x4632('0x2f')](_0x1973eb,function(_0x21c6a5){if(_0x21c6a5[_0x4632('0x32')]!==_0x4632('0x3e')){var _0x3b6258={};_0x3b6258[_0x21c6a5['name']]={'$like':'%'+_0x216119[_0x4632('0x34')][_0x4632('0x3c')]+'%'};return _0x3b6258;}})});}_0x6599ad=_['merge']({},_0x6599ad,_0x216119[_0x4632('0x3f')]);var _0x1c39bc={'where':_0x6599ad['where']};return db[_0x4632('0x30')]['count'](_0x1c39bc)[_0x4632('0x26')](function(_0x28df3b){_0x4fda35[_0x4632('0x1f')]=_0x28df3b;if(_0x216119[_0x4632('0x34')]['includeAll']){_0x6599ad[_0x4632('0x40')]=[{'all':!![]}];}return db[_0x4632('0x30')][_0x4632('0x41')](_0x6599ad);})[_0x4632('0x26')](function(_0x5cc716){_0x4fda35['rows']=_0x5cc716;return _0x4fda35;})[_0x4632('0x26')](respondWithFilteredResult(_0x5316f7,_0x6599ad))[_0x4632('0x42')](handleError(_0x5316f7,null));};exports[_0x4632('0x43')]=function(_0x512db1,_0x330f21){var _0x1467c8={'raw':![],'where':{'id':_0x512db1[_0x4632('0x44')]['id']}},_0x66598d={};_0x66598d[_0x4632('0x37')]=_[_0x4632('0x33')](db[_0x4632('0x30')]['rawAttributes']);_0x66598d[_0x4632('0x34')]=_[_0x4632('0x33')](_0x512db1[_0x4632('0x34')]);_0x66598d[_0x4632('0x35')]=_[_0x4632('0x36')](_0x66598d['model'],_0x66598d['query']);_0x1467c8[_0x4632('0x38')]=_[_0x4632('0x36')](_0x66598d[_0x4632('0x37')],qs[_0x4632('0x45')](_0x512db1['query'][_0x4632('0x45')]));_0x1467c8[_0x4632('0x38')]=_0x1467c8[_0x4632('0x38')][_0x4632('0x46')]?_0x1467c8[_0x4632('0x38')]:_0x66598d['model'];if(_0x512db1[_0x4632('0x34')][_0x4632('0x47')]){_0x1467c8[_0x4632('0x40')]=[{'all':!![]}];}_0x1467c8=_[_0x4632('0x3d')]({},_0x1467c8,_0x512db1[_0x4632('0x3f')]);return db[_0x4632('0x30')][_0x4632('0x48')](_0x1467c8)[_0x4632('0x26')](handleEntityNotFound(_0x330f21,null))[_0x4632('0x26')](respondWithResult(_0x330f21,null))[_0x4632('0x42')](handleError(_0x330f21,null));};exports[_0x4632('0x49')]=function(_0x517584,_0xc3ffd0){return db[_0x4632('0x30')][_0x4632('0x49')](_0x517584['body'],{})[_0x4632('0x26')](function(_0x5f4fb5){var _0x1309aa=_0x517584[_0x4632('0x4a')][_0x4632('0x28')]({'plain':!![]});if(!_0x1309aa)throw new Error(_0x4632('0x4b'));if(_0x1309aa[_0x4632('0x4c')]===_0x4632('0x4a')){var _0x1f43b6=_0x5f4fb5[_0x4632('0x28')]({'plain':!![]});var _0x4e89e3=_0x4632('0x29');return db[_0x4632('0x4d')]['find']({'where':{'name':_0x4e89e3,'userProfileId':_0x1309aa[_0x4632('0x4e')]},'raw':!![]})[_0x4632('0x26')](function(_0x18cc47){if(_0x18cc47&&_0x18cc47[_0x4632('0x4f')]===0x0){return db[_0x4632('0x2a')][_0x4632('0x49')]({'name':_0x1f43b6[_0x4632('0x2d')],'resourceId':_0x1f43b6['id'],'type':_0x18cc47[_0x4632('0x2d')],'sectionId':_0x18cc47['id']},{})[_0x4632('0x26')](function(){return _0x5f4fb5;});}else{return _0x5f4fb5;}})[_0x4632('0x42')](function(_0x3e66d8){logger[_0x4632('0x2b')](_0x4632('0x50'),_0x3e66d8);throw _0x3e66d8;});}return _0x5f4fb5;})[_0x4632('0x26')](respondWithResult(_0xc3ffd0,0xc9))[_0x4632('0x42')](handleError(_0xc3ffd0,null));};exports[_0x4632('0x51')]=function(_0x32cd35,_0x6c2864){var _0xb1456b={'where':{'id':_0x32cd35['params']['id']}},_0x36c824={};_0x36c824[_0x4632('0x37')]=_[_0x4632('0x33')](db[_0x4632('0x30')][_0x4632('0x52')]);_0xb1456b[_0x4632('0x38')]=_[_0x4632('0x36')](_0x36c824['model'],qs[_0x4632('0x45')](_0x32cd35[_0x4632('0x34')][_0x4632('0x45')]));_0xb1456b['attributes']=_0xb1456b[_0x4632('0x38')][_0x4632('0x46')]?_0xb1456b['attributes']:_0x36c824[_0x4632('0x37')];if(_0x32cd35[_0x4632('0x34')][_0x4632('0x47')]){_0xb1456b['include']=[{'all':!![]}];}_0xb1456b=_[_0x4632('0x3d')]({},_0xb1456b,_0x32cd35[_0x4632('0x3f')]);return db[_0x4632('0x30')][_0x4632('0x48')](_0xb1456b)[_0x4632('0x26')](handleEntityNotFound(_0x6c2864,null))[_0x4632('0x26')](function(_0x180662){if(_0x180662){var _0x4658de=_0x180662[_0x4632('0x28')]({'plain':!![]});_0x4658de=qs[_0x4632('0x53')](_0x4658de,['id','createdAt',_0x4632('0x54')]);_0x32cd35[_0x4632('0x55')]=_['omit'](_0x32cd35[_0x4632('0x55')],['id','createdAt','updatedAt']);return db[_0x4632('0x30')][_0x4632('0x49')](_[_0x4632('0x3d')](_0x4658de,_0x32cd35[_0x4632('0x55')]),{'include':_0x32cd35[_0x4632('0x34')][_0x4632('0x47')]?[{'all':!![]}]:undefined})[_0x4632('0x26')](function(_0x3e2849){var _0x133cb6=_0x32cd35[_0x4632('0x4a')][_0x4632('0x28')]({'plain':!![]});if(!_0x133cb6)throw new Error(_0x4632('0x4b'));if(_0x133cb6[_0x4632('0x4c')]===_0x4632('0x4a')){var _0x5442c9=_0x3e2849['get']({'plain':!![]});var _0x2e34d9=_0x4632('0x29');return db[_0x4632('0x4d')][_0x4632('0x48')]({'where':{'name':_0x2e34d9,'userProfileId':_0x133cb6[_0x4632('0x4e')]},'raw':!![]})[_0x4632('0x26')](function(_0x5b66ee){if(_0x5b66ee&&_0x5b66ee[_0x4632('0x4f')]===0x0){return db[_0x4632('0x2a')][_0x4632('0x49')]({'name':_0x5442c9[_0x4632('0x2d')],'resourceId':_0x5442c9['id'],'type':_0x5b66ee['name'],'sectionId':_0x5b66ee['id']},{})['then'](function(){return _0x3e2849;});}else{return _0x3e2849;}})[_0x4632('0x42')](function(_0x4c547c){logger[_0x4632('0x2b')](_0x4632('0x50'),_0x4c547c);throw _0x4c547c;});}return _0x3e2849;});}})[_0x4632('0x26')](respondWithResult(_0x6c2864,0xc9))[_0x4632('0x42')](handleError(_0x6c2864,null));};exports[_0x4632('0x25')]=function(_0x5e5669,_0x61aa92){if(_0x5e5669[_0x4632('0x55')]['id']){delete _0x5e5669['body']['id'];}return db['Campaign'][_0x4632('0x48')]({'where':{'id':_0x5e5669[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x61aa92,null))[_0x4632('0x26')](saveUpdates(_0x5e5669['body'],null))['then'](respondWithResult(_0x61aa92,null))['catch'](handleError(_0x61aa92,null));};exports[_0x4632('0x27')]=function(_0x5b37cc,_0x3af9ec){return db[_0x4632('0x30')][_0x4632('0x48')]({'where':{'id':_0x5b37cc[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x3af9ec,null))[_0x4632('0x26')](removeEntity(_0x3af9ec,null))[_0x4632('0x42')](handleError(_0x3af9ec,null));};exports[_0x4632('0x56')]=function(_0x44590d,_0x321969,_0x1dbba9){var _0x2b4c83={'raw':!![],'where':{}};var _0x1c5c49={};var _0x3d5e65={'count':0x0,'rows':[]};return db[_0x4632('0x30')][_0x4632('0x57')]({'where':{'id':_0x44590d['params']['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x321969,null))[_0x4632('0x26')](function(_0x3bc386){if(_0x3bc386){_0x1c5c49[_0x4632('0x37')]=_[_0x4632('0x33')](db[_0x4632('0x58')][_0x4632('0x52')]);_0x1c5c49[_0x4632('0x34')]=_[_0x4632('0x33')](_0x44590d[_0x4632('0x34')]);_0x1c5c49[_0x4632('0x35')]=_[_0x4632('0x36')](_0x1c5c49[_0x4632('0x37')],_0x1c5c49['query']);_0x2b4c83[_0x4632('0x38')]=_[_0x4632('0x36')](_0x1c5c49[_0x4632('0x37')],qs[_0x4632('0x45')](_0x44590d[_0x4632('0x34')][_0x4632('0x45')]));_0x2b4c83['attributes']=_0x2b4c83[_0x4632('0x38')][_0x4632('0x46')]?_0x2b4c83['attributes']:_0x1c5c49[_0x4632('0x37')];if(!_0x44590d[_0x4632('0x34')][_0x4632('0x59')](_0x4632('0x39'))){_0x2b4c83[_0x4632('0x1e')]=qs['limit'](_0x44590d[_0x4632('0x34')][_0x4632('0x1e')]);_0x2b4c83[_0x4632('0x1c')]=qs['offset'](_0x44590d[_0x4632('0x34')][_0x4632('0x1c')]);}_0x2b4c83[_0x4632('0x3a')]=qs[_0x4632('0x5a')](_0x44590d[_0x4632('0x34')][_0x4632('0x5a')]);_0x2b4c83[_0x4632('0x3b')]=qs[_0x4632('0x35')](_['pick'](_0x44590d[_0x4632('0x34')],_0x1c5c49[_0x4632('0x35')]));_0x2b4c83[_0x4632('0x3b')]['CampaignId']=_0x3bc386['id'];if(_0x44590d[_0x4632('0x34')][_0x4632('0x3c')]){_0x2b4c83['where']=_['merge'](_0x2b4c83[_0x4632('0x3b')],{'$or':_[_0x4632('0x2f')](_0x2b4c83['attributes'],function(_0x63d3e1){var _0x27e95f={};_0x27e95f[_0x63d3e1]={'$like':'%'+_0x44590d[_0x4632('0x34')][_0x4632('0x3c')]+'%'};return _0x27e95f;})});}_0x2b4c83=_[_0x4632('0x3d')]({},_0x2b4c83,_0x44590d[_0x4632('0x3f')]);return db[_0x4632('0x58')][_0x4632('0x1f')]({'where':_0x2b4c83['where']})[_0x4632('0x26')](function(_0x3f7dff){_0x3d5e65[_0x4632('0x1f')]=_0x3f7dff;if(_0x44590d[_0x4632('0x34')]['includeAll']){_0x2b4c83[_0x4632('0x40')]=[{'all':!![]}];}return db[_0x4632('0x58')][_0x4632('0x41')](_0x2b4c83);})[_0x4632('0x26')](function(_0x3cee1d){_0x3d5e65['rows']=_0x3cee1d;return _0x3d5e65;});}})[_0x4632('0x26')](respondWithFilteredResult(_0x321969,_0x2b4c83))[_0x4632('0x42')](handleError(_0x321969,null));};exports[_0x4632('0x5b')]=function(_0x2f3fd2,_0x1440ee,_0x219017){var _0x35b01a={'raw':!![],'where':{}};var _0x399037={};var _0x56a39b={'count':0x0,'rows':[]};return db[_0x4632('0x30')][_0x4632('0x57')]({'where':{'id':_0x2f3fd2[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x1440ee,null))[_0x4632('0x26')](function(_0x3a2560){if(_0x3a2560){_0x399037['model']=_[_0x4632('0x33')](db[_0x4632('0x5c')][_0x4632('0x52')]);_0x399037[_0x4632('0x34')]=_[_0x4632('0x33')](_0x2f3fd2[_0x4632('0x34')]);_0x399037[_0x4632('0x35')]=_['intersection'](_0x399037[_0x4632('0x37')],_0x399037[_0x4632('0x34')]);_0x35b01a[_0x4632('0x38')]=_[_0x4632('0x36')](_0x399037[_0x4632('0x37')],qs[_0x4632('0x45')](_0x2f3fd2[_0x4632('0x34')]['fields']));_0x35b01a[_0x4632('0x38')]=_0x35b01a['attributes'][_0x4632('0x46')]?_0x35b01a[_0x4632('0x38')]:_0x399037[_0x4632('0x37')];if(!_0x2f3fd2[_0x4632('0x34')][_0x4632('0x59')](_0x4632('0x39'))){_0x35b01a[_0x4632('0x1e')]=qs[_0x4632('0x1e')](_0x2f3fd2[_0x4632('0x34')]['limit']);_0x35b01a[_0x4632('0x1c')]=qs[_0x4632('0x1c')](_0x2f3fd2[_0x4632('0x34')]['offset']);}_0x35b01a[_0x4632('0x3a')]=qs[_0x4632('0x5a')](_0x2f3fd2[_0x4632('0x34')][_0x4632('0x5a')]);_0x35b01a[_0x4632('0x3b')]=qs[_0x4632('0x35')](_['pick'](_0x2f3fd2['query'],_0x399037[_0x4632('0x35')]));_0x35b01a[_0x4632('0x3b')][_0x4632('0x5d')]=_0x3a2560['id'];if(_0x2f3fd2['query'][_0x4632('0x3c')]){_0x35b01a['where']=_[_0x4632('0x3d')](_0x35b01a['where'],{'$or':_[_0x4632('0x2f')](_0x35b01a[_0x4632('0x38')],function(_0x49ebe8){var _0x219a62={};_0x219a62[_0x49ebe8]={'$like':'%'+_0x2f3fd2[_0x4632('0x34')][_0x4632('0x3c')]+'%'};return _0x219a62;})});}_0x35b01a=_['merge']({},_0x35b01a,_0x2f3fd2[_0x4632('0x3f')]);return db[_0x4632('0x5c')][_0x4632('0x1f')]({'where':_0x35b01a[_0x4632('0x3b')]})['then'](function(_0x43386b){_0x56a39b[_0x4632('0x1f')]=_0x43386b;if(_0x2f3fd2[_0x4632('0x34')][_0x4632('0x47')]){_0x35b01a['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x4632('0x41')](_0x35b01a);})[_0x4632('0x26')](function(_0x248220){_0x56a39b[_0x4632('0x5e')]=_0x248220;return _0x56a39b;});}})[_0x4632('0x26')](respondWithFilteredResult(_0x1440ee,_0x35b01a))[_0x4632('0x42')](handleError(_0x1440ee,null));};exports[_0x4632('0x5f')]=function(_0x5aa17f,_0x3ccd89,_0x33b497){var _0x505664={'raw':!![],'where':{}};var _0x51df53={};var _0x1aaaca={'count':0x0,'rows':[]};return db[_0x4632('0x30')][_0x4632('0x57')]({'where':{'id':_0x5aa17f[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x3ccd89,null))[_0x4632('0x26')](function(_0x2a2b1b){if(_0x2a2b1b){_0x51df53[_0x4632('0x37')]=_[_0x4632('0x33')](db[_0x4632('0x60')]['rawAttributes']);_0x51df53[_0x4632('0x34')]=_[_0x4632('0x33')](_0x5aa17f[_0x4632('0x34')]);_0x51df53[_0x4632('0x35')]=_[_0x4632('0x36')](_0x51df53[_0x4632('0x37')],_0x51df53[_0x4632('0x34')]);_0x505664[_0x4632('0x38')]=_[_0x4632('0x36')](_0x51df53['model'],qs[_0x4632('0x45')](_0x5aa17f['query'][_0x4632('0x45')]));_0x505664['attributes']=_0x505664[_0x4632('0x38')]['length']?_0x505664[_0x4632('0x38')]:_0x51df53[_0x4632('0x37')];if(!_0x5aa17f[_0x4632('0x34')]['hasOwnProperty']('nolimit')){_0x505664[_0x4632('0x1e')]=qs[_0x4632('0x1e')](_0x5aa17f[_0x4632('0x34')][_0x4632('0x1e')]);_0x505664[_0x4632('0x1c')]=qs[_0x4632('0x1c')](_0x5aa17f[_0x4632('0x34')][_0x4632('0x1c')]);}_0x505664['order']=qs[_0x4632('0x5a')](_0x5aa17f[_0x4632('0x34')][_0x4632('0x5a')]);_0x505664[_0x4632('0x3b')]=qs[_0x4632('0x35')](_[_0x4632('0x61')](_0x5aa17f[_0x4632('0x34')],_0x51df53[_0x4632('0x35')]));_0x505664[_0x4632('0x3b')][_0x4632('0x5d')]=_0x2a2b1b['id'];if(_0x5aa17f['query'][_0x4632('0x3c')]){_0x505664[_0x4632('0x3b')]=_[_0x4632('0x3d')](_0x505664['where'],{'$or':_[_0x4632('0x2f')](_0x505664[_0x4632('0x38')],function(_0x27e56d){var _0x77891b={};_0x77891b[_0x27e56d]={'$like':'%'+_0x5aa17f[_0x4632('0x34')][_0x4632('0x3c')]+'%'};return _0x77891b;})});}_0x505664=_[_0x4632('0x3d')]({},_0x505664,_0x5aa17f[_0x4632('0x3f')]);return db[_0x4632('0x60')][_0x4632('0x1f')]({'where':_0x505664[_0x4632('0x3b')]})['then'](function(_0x3a86d9){_0x1aaaca['count']=_0x3a86d9;if(_0x5aa17f[_0x4632('0x34')][_0x4632('0x47')]){_0x505664['include']=[{'all':!![]}];}return db[_0x4632('0x60')][_0x4632('0x41')](_0x505664);})[_0x4632('0x26')](function(_0x537711){_0x1aaaca[_0x4632('0x5e')]=_0x537711;return _0x1aaaca;});}})[_0x4632('0x26')](respondWithFilteredResult(_0x3ccd89,_0x505664))['catch'](handleError(_0x3ccd89,null));};exports['getHopperBlacks']=function(_0x27f0d4,_0x2addad,_0x225318){var _0x3380ae={'raw':!![],'where':{}};var _0x134488={};var _0x2feec1={'count':0x0,'rows':[]};return db[_0x4632('0x30')][_0x4632('0x57')]({'where':{'id':_0x27f0d4[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x2addad,null))[_0x4632('0x26')](function(_0xd86291){if(_0xd86291){_0x134488[_0x4632('0x37')]=_[_0x4632('0x33')](db['CmHopperBlack'][_0x4632('0x52')]);_0x134488[_0x4632('0x34')]=_[_0x4632('0x33')](_0x27f0d4['query']);_0x134488[_0x4632('0x35')]=_[_0x4632('0x36')](_0x134488[_0x4632('0x37')],_0x134488[_0x4632('0x34')]);_0x3380ae[_0x4632('0x38')]=_[_0x4632('0x36')](_0x134488[_0x4632('0x37')],qs[_0x4632('0x45')](_0x27f0d4[_0x4632('0x34')]['fields']));_0x3380ae[_0x4632('0x38')]=_0x3380ae[_0x4632('0x38')][_0x4632('0x46')]?_0x3380ae[_0x4632('0x38')]:_0x134488[_0x4632('0x37')];if(!_0x27f0d4[_0x4632('0x34')]['hasOwnProperty'](_0x4632('0x39'))){_0x3380ae[_0x4632('0x1e')]=qs[_0x4632('0x1e')](_0x27f0d4['query']['limit']);_0x3380ae['offset']=qs[_0x4632('0x1c')](_0x27f0d4['query'][_0x4632('0x1c')]);}_0x3380ae[_0x4632('0x3a')]=qs[_0x4632('0x5a')](_0x27f0d4[_0x4632('0x34')][_0x4632('0x5a')]);_0x3380ae[_0x4632('0x3b')]=qs[_0x4632('0x35')](_[_0x4632('0x61')](_0x27f0d4[_0x4632('0x34')],_0x134488[_0x4632('0x35')]));_0x3380ae[_0x4632('0x3b')][_0x4632('0x5d')]=_0xd86291['id'];if(_0x27f0d4[_0x4632('0x34')][_0x4632('0x3c')]){_0x3380ae[_0x4632('0x3b')]=_[_0x4632('0x3d')](_0x3380ae['where'],{'$or':_[_0x4632('0x2f')](_0x3380ae[_0x4632('0x38')],function(_0x41cae7){var _0x5e17f3={};_0x5e17f3[_0x41cae7]={'$like':'%'+_0x27f0d4[_0x4632('0x34')][_0x4632('0x3c')]+'%'};return _0x5e17f3;})});}_0x3380ae=_[_0x4632('0x3d')]({},_0x3380ae,_0x27f0d4[_0x4632('0x3f')]);return db[_0x4632('0x62')][_0x4632('0x1f')]({'where':_0x3380ae[_0x4632('0x3b')]})['then'](function(_0x310e64){_0x2feec1['count']=_0x310e64;if(_0x27f0d4['query']['includeAll']){_0x3380ae['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x4632('0x41')](_0x3380ae);})[_0x4632('0x26')](function(_0x29d271){_0x2feec1[_0x4632('0x5e')]=_0x29d271;return _0x2feec1;});}})[_0x4632('0x26')](respondWithFilteredResult(_0x2addad,_0x3380ae))['catch'](handleError(_0x2addad,null));};exports['getLists']=function(_0x1687e2,_0x29b08a,_0x1b005f){var _0x125db7={};var _0x1135e6={};var _0x29ec86;var _0x5cbd30;return db['Campaign'][_0x4632('0x57')]({'where':{'id':_0x1687e2[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x29b08a,null))[_0x4632('0x26')](function(_0x1aef6b){if(_0x1aef6b){_0x29ec86=_0x1aef6b;_0x1135e6['model']=_[_0x4632('0x33')](db[_0x4632('0x63')][_0x4632('0x52')]);_0x1135e6[_0x4632('0x34')]=_[_0x4632('0x33')](_0x1687e2['query']);_0x1135e6[_0x4632('0x35')]=_[_0x4632('0x36')](_0x1135e6['model'],_0x1135e6['query']);_0x125db7[_0x4632('0x38')]=_[_0x4632('0x36')](_0x1135e6[_0x4632('0x37')],qs['fields'](_0x1687e2['query'][_0x4632('0x45')]));_0x125db7[_0x4632('0x38')]=_0x125db7[_0x4632('0x38')][_0x4632('0x46')]?_0x125db7[_0x4632('0x38')]:_0x1135e6['model'];_0x125db7[_0x4632('0x3a')]=qs['sort'](_0x1687e2[_0x4632('0x34')]['sort']);_0x125db7['where']=qs[_0x4632('0x35')](_['pick'](_0x1687e2[_0x4632('0x34')],_0x1135e6[_0x4632('0x35')]));if(_0x1687e2[_0x4632('0x34')]['filter']){_0x125db7[_0x4632('0x3b')]=_[_0x4632('0x3d')](_0x125db7['where'],{'$or':_['map'](_0x125db7[_0x4632('0x38')],function(_0x527a5c){var _0x80a451={};_0x80a451[_0x527a5c]={'$like':'%'+_0x1687e2[_0x4632('0x34')][_0x4632('0x3c')]+'%'};return _0x80a451;})});}_0x125db7=_[_0x4632('0x3d')]({},_0x125db7,_0x1687e2['options']);return _0x29ec86['getLists'](_0x125db7);}})['then'](function(_0x5dd45b){if(_0x5dd45b){_0x5cbd30=_0x5dd45b[_0x4632('0x46')];if(!_0x1687e2[_0x4632('0x34')][_0x4632('0x59')](_0x4632('0x39'))){_0x125db7[_0x4632('0x1e')]=qs[_0x4632('0x1e')](_0x1687e2[_0x4632('0x34')][_0x4632('0x1e')]);_0x125db7[_0x4632('0x1c')]=qs[_0x4632('0x1c')](_0x1687e2['query'][_0x4632('0x1c')]);}return _0x29ec86['getLists'](_0x125db7);}})[_0x4632('0x26')](function(_0x1210fd){if(_0x1210fd){return _0x1210fd?{'count':_0x5cbd30,'rows':_0x1210fd}:null;}})[_0x4632('0x26')](respondWithResult(_0x29b08a,null))[_0x4632('0x42')](handleError(_0x29b08a,null));};exports[_0x4632('0x64')]=function(_0x5f3f6b,_0x2b9a28,_0x279456){var _0x4c3399,_0x199546;var _0x28f727=[];var _0x47d2cc=moment()[_0x4632('0x65')](_0x4632('0x66'));return db[_0x4632('0x30')][_0x4632('0x48')]({'where':{'id':_0x5f3f6b[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x2b9a28,null))[_0x4632('0x26')](function(_0x9b14e4){if(_0x9b14e4){_0x199546=_0x9b14e4;return _0x9b14e4['addLists'](_0x5f3f6b[_0x4632('0x55')][_0x4632('0x67')],_[_0x4632('0x53')](_0x5f3f6b[_0x4632('0x55')],[_0x4632('0x67'),'id'])||{});}return null;})[_0x4632('0x68')](function(_0x27efa3){var _0x5d0c25;var _0x20ea25;_0x4c3399=_0x27efa3||[];var _0x22d667=[];if(_0x27efa3){for(var _0x2f09c4=0x0;_0x2f09c4<_0x27efa3[_0x4632('0x46')];_0x2f09c4+=0x1){var _0x2172a2=_0x27efa3[_0x2f09c4]['get']({'plain':!![]});_0x199546['dialCheckDuplicateType']=_0x5f3f6b['body'][_0x4632('0x69')]?_0x5f3f6b[_0x4632('0x55')][_0x4632('0x69')]:_0x199546[_0x4632('0x69')];switch(_0x199546[_0x4632('0x69')]){case _0x4632('0x6a'):_0x5d0c25=squel['insert']()['into'](_0x4632('0x6b'))['fromQuery'](['phone',_0x4632('0x6c'),_0x4632('0x6d'),_0x4632('0x6e'),_0x4632('0x5d'),_0x4632('0x6f'),_0x4632('0x54')],squel[_0x4632('0x70')]()[_0x4632('0x71')](_0x4632('0x72'),_0x4632('0x72'))[_0x4632('0x71')](_0x4632('0x73'),_0x4632('0x6c'))[_0x4632('0x71')]('id',_0x4632('0x6d'))[_0x4632('0x71')](_0x2172a2[_0x4632('0x74')][_0x4632('0x75')](),_0x4632('0x6e'))[_0x4632('0x71')](_0x5f3f6b[_0x4632('0x44')]['id'][_0x4632('0x75')](),_0x4632('0x5d'))['field']('\x27'+_0x47d2cc+'\x27',_0x4632('0x6f'))['field']('\x27'+_0x47d2cc+'\x27','updatedAt')[_0x4632('0x76')](_0x4632('0x77'))['where'](_0x4632('0x78'))['where']('ListId\x20=\x20?',_0x2172a2[_0x4632('0x74')]['toString']())['where'](_0x4632('0x79'))[_0x4632('0x3b')](_0x4632('0x7a'),squel[_0x4632('0x70')]()[_0x4632('0x71')](_0x4632('0x7b'))['from'](_0x4632('0x7c'))[_0x4632('0x3b')](_0x4632('0x7d'),_0x5f3f6b['params']['id'][_0x4632('0x75')]()))['where'](_0x4632('0x7a'),squel['select']()['field'](_0x4632('0x7e'))[_0x4632('0x76')](_0x4632('0x6b'))[_0x4632('0x3b')](_0x4632('0x7d'),_0x5f3f6b['params']['id'][_0x4632('0x75')]())))[_0x4632('0x75')]();break;case _0x4632('0x7f'):_0x5d0c25=squel[_0x4632('0x80')]()[_0x4632('0x81')](_0x4632('0x6b'))[_0x4632('0x82')]([_0x4632('0x72'),'scheduledAt',_0x4632('0x6d'),_0x4632('0x6e'),_0x4632('0x5d'),'createdAt',_0x4632('0x54')],squel[_0x4632('0x70')]()[_0x4632('0x71')](_0x4632('0x72'),_0x4632('0x72'))[_0x4632('0x71')](_0x4632('0x73'),'scheduledAt')[_0x4632('0x71')]('id','ContactId')['field'](_0x2172a2[_0x4632('0x74')][_0x4632('0x75')](),_0x4632('0x6e'))[_0x4632('0x71')](_0x5f3f6b[_0x4632('0x44')]['id']['toString'](),'CampaignId')['field']('\x27'+_0x47d2cc+'\x27',_0x4632('0x6f'))['field']('\x27'+_0x47d2cc+'\x27','updatedAt')[_0x4632('0x76')](_0x4632('0x77'))[_0x4632('0x3b')](_0x4632('0x78'))[_0x4632('0x3b')](_0x4632('0x83'),_0x2172a2[_0x4632('0x74')]['toString']())[_0x4632('0x3b')](_0x4632('0x79'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x4632('0x70')]()[_0x4632('0x71')](_0x4632('0x7e'))[_0x4632('0x76')](_0x4632('0x6b'))[_0x4632('0x3b')](_0x4632('0x7d'),_0x5f3f6b[_0x4632('0x44')]['id']['toString']())))['toString']();break;default:_0x5d0c25=squel[_0x4632('0x80')]()['into'](_0x4632('0x6b'))[_0x4632('0x82')]([_0x4632('0x72'),_0x4632('0x6c'),'ContactId',_0x4632('0x6e'),_0x4632('0x5d'),'createdAt',_0x4632('0x54')],squel['select']()[_0x4632('0x71')](_0x4632('0x72'),_0x4632('0x72'))[_0x4632('0x71')](_0x4632('0x73'),_0x4632('0x6c'))[_0x4632('0x71')]('id',_0x4632('0x6d'))[_0x4632('0x71')](_0x2172a2[_0x4632('0x74')][_0x4632('0x75')](),_0x4632('0x6e'))[_0x4632('0x71')](_0x5f3f6b[_0x4632('0x44')]['id'][_0x4632('0x75')](),_0x4632('0x5d'))[_0x4632('0x71')]('\x27'+_0x47d2cc+'\x27','createdAt')[_0x4632('0x71')]('\x27'+_0x47d2cc+'\x27',_0x4632('0x54'))[_0x4632('0x76')](_0x4632('0x77'))[_0x4632('0x3b')](_0x4632('0x78'))[_0x4632('0x3b')]('ListId\x20=\x20?',_0x2172a2[_0x4632('0x74')][_0x4632('0x75')]())[_0x4632('0x3b')](_0x4632('0x79')))[_0x4632('0x75')]();}_0x20ea25=squel[_0x4632('0x80')]()[_0x4632('0x81')](_0x4632('0x84'))[_0x4632('0x82')]([_0x4632('0x85'),_0x4632('0x6c'),_0x4632('0x72'),_0x4632('0x86'),'createdAt',_0x4632('0x54')],squel[_0x4632('0x70')]()[_0x4632('0x71')](_0x4632('0x87'),'id')[_0x4632('0x71')](_0x4632('0x73'),_0x4632('0x6c'))[_0x4632('0x71')](_0x4632('0x88'),'phone')['field'](_0x4632('0x89'),_0x4632('0x86'))[_0x4632('0x71')]('\x27'+_0x47d2cc+'\x27',_0x4632('0x6f'))[_0x4632('0x71')]('\x27'+_0x47d2cc+'\x27',_0x4632('0x54'))['from'](_0x4632('0x8a'),'ci')[_0x4632('0x8b')]('cm_hopper','h',_0x4632('0x8c'))[_0x4632('0x3b')]('h.ListId\x20=\x20?',_0x2172a2['CmListId'][_0x4632('0x75')]())[_0x4632('0x3b')]('h.CampaignId=?',_0x5f3f6b['params']['id'][_0x4632('0x75')]())[_0x4632('0x3b')](_0x4632('0x8d'),_0x47d2cc))[_0x4632('0x75')]();_0x22d667[_0x4632('0x8e')](db[_0x4632('0x8f')][_0x4632('0x34')](_0x5d0c25));_0x28f727['push'](db[_0x4632('0x8f')][_0x4632('0x34')](_0x20ea25));}return BPromise[_0x4632('0x90')](_0x22d667);}})[_0x4632('0x26')](function(){return BPromise[_0x4632('0x90')](_0x28f727);})['then'](function(){return _0x4c3399;})['then'](respondWithResult(_0x2b9a28,null))[_0x4632('0x42')](handleError(_0x2b9a28,null));};exports['removeLists']=function(_0x18b3b7,_0xdd065f,_0x32ee2c){return db[_0x4632('0x30')][_0x4632('0x48')]({'where':{'id':_0x18b3b7[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0xdd065f,null))[_0x4632('0x26')](function(_0xbe285c){if(_0xbe285c){return _0xbe285c['removeLists'](_0x18b3b7['query']['ids']);}})[_0x4632('0x26')](function(_0x2d8d83){if(_0x2d8d83){return db[_0x4632('0x58')]['destroy']({'where':{'ListId':_0x18b3b7[_0x4632('0x34')][_0x4632('0x67')],'CampaignId':_0x18b3b7[_0x4632('0x44')]['id']}})[_0x4632('0x26')](function(){return _0x2d8d83;});}})[_0x4632('0x26')](respondWithStatusCode(_0xdd065f,null))['catch'](handleError(_0xdd065f,null));};exports[_0x4632('0x91')]=function(_0x2586ca,_0x9a5191,_0x350691){var _0x33336a={};var _0x287d7b={};var _0x1eaf71;var _0xbadb5e;return db[_0x4632('0x30')][_0x4632('0x57')]({'where':{'id':_0x2586ca['params']['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x9a5191,null))[_0x4632('0x26')](function(_0x40e1a0){if(_0x40e1a0){_0x1eaf71=_0x40e1a0;_0x287d7b[_0x4632('0x37')]=_[_0x4632('0x33')](db[_0x4632('0x63')][_0x4632('0x52')]);_0x287d7b[_0x4632('0x34')]=_[_0x4632('0x33')](_0x2586ca[_0x4632('0x34')]);_0x287d7b[_0x4632('0x35')]=_[_0x4632('0x36')](_0x287d7b[_0x4632('0x37')],_0x287d7b[_0x4632('0x34')]);_0x33336a['attributes']=_[_0x4632('0x36')](_0x287d7b[_0x4632('0x37')],qs[_0x4632('0x45')](_0x2586ca[_0x4632('0x34')][_0x4632('0x45')]));_0x33336a[_0x4632('0x38')]=_0x33336a[_0x4632('0x38')][_0x4632('0x46')]?_0x33336a[_0x4632('0x38')]:_0x287d7b['model'];_0x33336a['order']=qs[_0x4632('0x5a')](_0x2586ca['query'][_0x4632('0x5a')]);_0x33336a['where']=qs[_0x4632('0x35')](_[_0x4632('0x61')](_0x2586ca[_0x4632('0x34')],_0x287d7b[_0x4632('0x35')]));if(_0x2586ca['query'][_0x4632('0x3c')]){_0x33336a[_0x4632('0x3b')]=_['merge'](_0x33336a['where'],{'$or':_[_0x4632('0x2f')](_0x33336a[_0x4632('0x38')],function(_0x1a5d60){var _0x4c3619={};_0x4c3619[_0x1a5d60]={'$like':'%'+_0x2586ca['query'][_0x4632('0x3c')]+'%'};return _0x4c3619;})});}_0x33336a=_['merge']({},_0x33336a,_0x2586ca[_0x4632('0x3f')]);return _0x1eaf71[_0x4632('0x91')](_0x33336a);}})['then'](function(_0x594957){if(_0x594957){_0xbadb5e=_0x594957[_0x4632('0x46')];if(!_0x2586ca[_0x4632('0x34')][_0x4632('0x59')]('nolimit')){_0x33336a[_0x4632('0x1e')]=qs['limit'](_0x2586ca['query'][_0x4632('0x1e')]);_0x33336a[_0x4632('0x1c')]=qs[_0x4632('0x1c')](_0x2586ca[_0x4632('0x34')][_0x4632('0x1c')]);}return _0x1eaf71[_0x4632('0x91')](_0x33336a);}})[_0x4632('0x26')](function(_0x652a18){if(_0x652a18){return _0x652a18?{'count':_0xbadb5e,'rows':_0x652a18}:null;}})[_0x4632('0x26')](respondWithResult(_0x9a5191,null))[_0x4632('0x42')](handleError(_0x9a5191,null));};exports[_0x4632('0x92')]=function(_0x2324b1,_0x32e515,_0x27f514){var _0x56e812,_0x2374e6;var _0xa7816c=[];var _0x5a1eb7=moment()[_0x4632('0x65')](_0x4632('0x66'));return db[_0x4632('0x30')][_0x4632('0x48')]({'where':{'id':_0x2324b1['params']['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x32e515,null))['then'](function(_0x7622fe){if(_0x7622fe){_0x2374e6=_0x7622fe;return _0x7622fe[_0x4632('0x92')](_0x2324b1[_0x4632('0x55')][_0x4632('0x67')],_[_0x4632('0x53')](_0x2324b1[_0x4632('0x55')],[_0x4632('0x67'),'id'])||{});}return null;})[_0x4632('0x68')](function(_0x68216b){var _0x5a19a5;var _0x1e8f57;_0x56e812=_0x68216b||[];var _0xdb8048=[];if(_0x68216b){for(var _0x1e824f=0x0;_0x1e824f<_0x68216b[_0x4632('0x46')];_0x1e824f+=0x1){var _0x55c04f=_0x68216b[_0x1e824f][_0x4632('0x28')]({'plain':!![]});_0x5a19a5=squel[_0x4632('0x80')]()[_0x4632('0x81')](_0x4632('0x93'))['fromQuery'](['phone',_0x4632('0x6d'),_0x4632('0x6e'),_0x4632('0x5d'),'createdAt',_0x4632('0x54')],squel['select']()[_0x4632('0x71')](_0x4632('0x72'),_0x4632('0x72'))[_0x4632('0x71')]('id',_0x4632('0x6d'))[_0x4632('0x71')](_0x55c04f['CmListId'][_0x4632('0x75')](),_0x4632('0x6e'))['field'](_0x2324b1[_0x4632('0x44')]['id'][_0x4632('0x75')](),_0x4632('0x5d'))[_0x4632('0x71')]('NOW()',_0x4632('0x6f'))[_0x4632('0x71')](_0x4632('0x73'),'updatedAt')[_0x4632('0x76')](_0x4632('0x77'))[_0x4632('0x3b')](_0x4632('0x78'))['where'](_0x4632('0x83'),_0x55c04f[_0x4632('0x74')]['toString']())[_0x4632('0x3b')](_0x4632('0x79')))[_0x4632('0x75')]();_0xdb8048[_0x4632('0x8e')](db[_0x4632('0x8f')]['query'](_0x5a19a5));}return BPromise[_0x4632('0x90')](_0xdb8048);}})['then'](function(){return _0x56e812;})[_0x4632('0x26')](respondWithResult(_0x32e515,null))['catch'](handleError(_0x32e515,null));};exports[_0x4632('0x94')]=function(_0x3caed3,_0x504de7,_0xeb4cc8){return db[_0x4632('0x30')][_0x4632('0x48')]({'where':{'id':_0x3caed3[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x504de7,null))['then'](function(_0x1bc678){if(_0x1bc678){return _0x1bc678['removeBlackLists'](_0x3caed3[_0x4632('0x34')][_0x4632('0x67')]);}})[_0x4632('0x26')](function(_0x22f0cd){if(_0x22f0cd){return db[_0x4632('0x62')][_0x4632('0x27')]({'where':{'ListId':_0x3caed3['query'][_0x4632('0x67')],'CampaignId':_0x3caed3[_0x4632('0x44')]['id']}})[_0x4632('0x26')](function(){return _0x22f0cd;});}})[_0x4632('0x26')](respondWithStatusCode(_0x504de7,null))['catch'](handleError(_0x504de7,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index e702ecf..9ffb62d 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(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x4597a7,_0x5da925){var _0x52cd16=function(_0x58a526){while(--_0x58a526){_0x4597a7['push'](_0x4597a7['shift']());}};_0x52cd16(++_0x5da925);}(_0x7a54,0x106));var _0x47a5=function(_0x34fca5,_0x103f92){_0x34fca5=_0x34fca5-0x0;var _0x2b94bf=_0x7a54[_0x34fca5];return _0x2b94bf;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index de40592..a1d37cb 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 _0xff98=['../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','Campaign','findAll','options','raw','attributes','limit','include','map','model','then','GetCampaign','stringify','util','moment','bluebird','randomstring'];(function(_0x370f1e,_0x19f962){var _0x303232=function(_0x2c36bf){while(--_0x2c36bf){_0x370f1e['push'](_0x370f1e['shift']());}};_0x303232(++_0x19f962);}(_0xff98,0x9c));var _0x8ff9=function(_0x199367,_0x1c1065){_0x199367=_0x199367-0x0;var _0x4e1d68=_0xff98[_0x199367];return _0x4e1d68;};'use strict';var _=require('lodash');var util=require(_0x8ff9('0x0'));var moment=require(_0x8ff9('0x1'));var BPromise=require(_0x8ff9('0x2'));var rs=require(_0x8ff9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ff9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8ff9('0x5'))('rpc');var config=require(_0x8ff9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8ff9('0x7')][_0x8ff9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4122b2,_0x3e6002,_0x280acf){return new BPromise(function(_0x428b0f,_0x32d672){return client[_0x8ff9('0x9')](_0x4122b2,_0x280acf)['then'](function(_0x36de34){logger[_0x8ff9('0xa')](_0x8ff9('0xb'),_0x3e6002,_0x8ff9('0xc'));logger[_0x8ff9('0xd')](_0x8ff9('0xe'),_0x3e6002,_0x8ff9('0xc'),JSON['stringify'](_0x36de34));if(_0x36de34['error']){if(_0x36de34['error'][_0x8ff9('0xf')]===0x1f4){logger[_0x8ff9('0x10')](_0x8ff9('0xb'),_0x3e6002,_0x36de34['error'][_0x8ff9('0x11')]);return _0x32d672(_0x36de34[_0x8ff9('0x10')][_0x8ff9('0x11')]);}logger[_0x8ff9('0x10')](_0x8ff9('0xb'),_0x3e6002,_0x36de34[_0x8ff9('0x10')][_0x8ff9('0x11')]);return _0x428b0f(_0x36de34['error'][_0x8ff9('0x11')]);}else{logger[_0x8ff9('0xa')](_0x8ff9('0xb'),_0x3e6002,'request\x20sent');_0x428b0f(_0x36de34[_0x8ff9('0x12')]['message']);}})[_0x8ff9('0x13')](function(_0x578fe3){logger['error']('Campaign,\x20%s,\x20%s',_0x3e6002,_0x578fe3);_0x32d672(_0x578fe3);});});}exports['GetCampaign']=function(_0x20d149){var _0x2dedbc=this;return new Promise(function(_0xad903b,_0x406bc8){return db[_0x8ff9('0x14')][_0x8ff9('0x15')]({'raw':_0x20d149[_0x8ff9('0x16')]?_0x20d149['options'][_0x8ff9('0x17')]===undefined?!![]:![]:!![],'where':_0x20d149[_0x8ff9('0x16')]?_0x20d149[_0x8ff9('0x16')]['where']||null:null,'attributes':_0x20d149[_0x8ff9('0x16')]?_0x20d149[_0x8ff9('0x16')][_0x8ff9('0x18')]||null:null,'limit':_0x20d149[_0x8ff9('0x16')]?_0x20d149[_0x8ff9('0x16')][_0x8ff9('0x19')]||null:null,'include':_0x20d149[_0x8ff9('0x16')]?_0x20d149[_0x8ff9('0x16')][_0x8ff9('0x1a')]?_[_0x8ff9('0x1b')](_0x20d149[_0x8ff9('0x16')][_0x8ff9('0x1a')],function(_0x3aff05){return{'model':db[_0x3aff05['model']],'as':_0x3aff05['as'],'attributes':_0x3aff05['attributes'],'include':_0x3aff05[_0x8ff9('0x1a')]?_['map'](_0x3aff05[_0x8ff9('0x1a')],function(_0x5a1116){return{'model':db[_0x5a1116[_0x8ff9('0x1c')]],'as':_0x5a1116['as'],'attributes':_0x5a1116[_0x8ff9('0x18')],'include':_0x5a1116[_0x8ff9('0x1a')]?_[_0x8ff9('0x1b')](_0x5a1116[_0x8ff9('0x1a')],function(_0xcdd5d8){return{'model':db[_0xcdd5d8[_0x8ff9('0x1c')]],'as':_0xcdd5d8['as'],'attributes':_0xcdd5d8[_0x8ff9('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8ff9('0x1d')](function(_0x1207b2){logger['info'](_0x8ff9('0x1e'),_0x20d149);logger[_0x8ff9('0xd')](_0x8ff9('0x1e'),_0x20d149,JSON[_0x8ff9('0x1f')](_0x1207b2));_0xad903b(_0x1207b2);})[_0x8ff9('0x13')](function(_0x5c2a7a){logger[_0x8ff9('0x10')]('GetCampaign',_0x5c2a7a[_0x8ff9('0x11')],_0x20d149);_0x406bc8(_0x2dedbc[_0x8ff9('0x10')](0x1f4,_0x5c2a7a[_0x8ff9('0x11')]));});});}; \ No newline at end of file +var _0xaa88=['../../config/environment','http','then','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','Campaign,\x20%s,\x20%s','message','result','catch','findAll','options','raw','where','attributes','limit','map','include','model','GetCampaign','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x457b0e,_0x5f5b0b){var _0x6e91af=function(_0x36fdfc){while(--_0x36fdfc){_0x457b0e['push'](_0x457b0e['shift']());}};_0x6e91af(++_0x5f5b0b);}(_0xaa88,0x137));var _0x8aa8=function(_0x434783,_0xff395d){_0x434783=_0x434783-0x0;var _0x13efcf=_0xaa88[_0x434783];return _0x13efcf;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('Campaign,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('Campaign,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('Campaign,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});}exports['GetCampaign']=function(_0x2c1b9a){var _0x49d80d=this;return new Promise(function(_0x557adc,_0xab7af5){return db['Campaign'][_0x8aa8('0x15')]({'raw':_0x2c1b9a[_0x8aa8('0x16')]?_0x2c1b9a[_0x8aa8('0x16')][_0x8aa8('0x17')]===undefined?!![]:![]:!![],'where':_0x2c1b9a['options']?_0x2c1b9a[_0x8aa8('0x16')][_0x8aa8('0x18')]||null:null,'attributes':_0x2c1b9a[_0x8aa8('0x16')]?_0x2c1b9a[_0x8aa8('0x16')][_0x8aa8('0x19')]||null:null,'limit':_0x2c1b9a[_0x8aa8('0x16')]?_0x2c1b9a['options'][_0x8aa8('0x1a')]||null:null,'include':_0x2c1b9a['options']?_0x2c1b9a[_0x8aa8('0x16')]['include']?_[_0x8aa8('0x1b')](_0x2c1b9a['options'][_0x8aa8('0x1c')],function(_0x40adb5){return{'model':db[_0x40adb5[_0x8aa8('0x1d')]],'as':_0x40adb5['as'],'attributes':_0x40adb5['attributes'],'include':_0x40adb5[_0x8aa8('0x1c')]?_[_0x8aa8('0x1b')](_0x40adb5[_0x8aa8('0x1c')],function(_0x547a7b){return{'model':db[_0x547a7b['model']],'as':_0x547a7b['as'],'attributes':_0x547a7b[_0x8aa8('0x19')],'include':_0x547a7b[_0x8aa8('0x1c')]?_[_0x8aa8('0x1b')](_0x547a7b[_0x8aa8('0x1c')],function(_0x24143e){return{'model':db[_0x24143e['model']],'as':_0x24143e['as'],'attributes':_0x24143e[_0x8aa8('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a0ff2){logger[_0x8aa8('0xc')](_0x8aa8('0x1e'),_0x2c1b9a);logger['debug']('GetCampaign',_0x2c1b9a,JSON[_0x8aa8('0x1f')](_0x2a0ff2));_0x557adc(_0x2a0ff2);})['catch'](function(_0x385208){logger[_0x8aa8('0x10')](_0x8aa8('0x1e'),_0x385208[_0x8aa8('0x12')],_0x2c1b9a);_0xab7af5(_0x49d80d[_0x8aa8('0x10')](0x1f4,_0x385208['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 46a8018..e8a6142 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 _0x02a4=['/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addBlackLists','put','update','delete','removeLists','removeBlackLists','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/hoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists'];(function(_0x12939d,_0x24971d){var _0x38f9ab=function(_0x23a8d5){while(--_0x23a8d5){_0x12939d['push'](_0x12939d['shift']());}};_0x38f9ab(++_0x24971d);}(_0x02a4,0x1c0));var _0x402a=function(_0x33c5c8,_0x3455ef){_0x33c5c8=_0x33c5c8-0x0;var _0x27f778=_0x02a4[_0x33c5c8];return _0x27f778;};'use strict';var multer=require(_0x402a('0x0'));var util=require(_0x402a('0x1'));var path=require(_0x402a('0x2'));var timeout=require('connect-timeout');var express=require(_0x402a('0x3'));var router=express['Router']();var fs_extra=require(_0x402a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x402a('0x5'));var config=require(_0x402a('0x6'));var controller=require('./campaign.controller');router[_0x402a('0x7')]('/',auth[_0x402a('0x8')](),controller['index']);router[_0x402a('0x7')](_0x402a('0x9'),auth[_0x402a('0x8')](),controller['show']);router[_0x402a('0x7')](_0x402a('0xa'),auth['isAuthenticated'](),controller['getHoppers']);router['get'](_0x402a('0xb'),auth[_0x402a('0x8')](),controller['getHopperHistories']);router['get'](_0x402a('0xc'),auth[_0x402a('0x8')](),controller[_0x402a('0xd')]);router[_0x402a('0x7')]('/:id/hopper_black',auth[_0x402a('0x8')](),controller[_0x402a('0xe')]);router['get'](_0x402a('0xf'),auth['isAuthenticated'](),controller['getLists']);router['get'](_0x402a('0x10'),auth[_0x402a('0x8')](),controller[_0x402a('0x11')]);router['post']('/',auth[_0x402a('0x8')](),controller[_0x402a('0x12')]);router[_0x402a('0x13')](_0x402a('0x14'),auth['isAuthenticated'](),controller[_0x402a('0x15')]);router[_0x402a('0x13')](_0x402a('0xf'),auth[_0x402a('0x8')](),controller['addLists']);router[_0x402a('0x13')]('/:id/blacklists',auth[_0x402a('0x8')](),controller[_0x402a('0x16')]);router[_0x402a('0x17')](_0x402a('0x9'),auth['isAuthenticated'](),controller[_0x402a('0x18')]);router[_0x402a('0x19')](_0x402a('0x9'),auth['isAuthenticated'](),controller['destroy']);router[_0x402a('0x19')](_0x402a('0xf'),auth[_0x402a('0x8')](),controller[_0x402a('0x1a')]);router[_0x402a('0x19')](_0x402a('0x10'),auth['isAuthenticated'](),controller[_0x402a('0x1b')]);module[_0x402a('0x1c')]=router; \ No newline at end of file +var _0x08db=['/:id/hopper_black','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','/:id/lists','addLists','addBlackLists','/:id','update','delete','removeLists','removeBlackLists','multer','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals'];(function(_0x29f50d,_0x580fae){var _0x4eeeae=function(_0x267422){while(--_0x267422){_0x29f50d['push'](_0x29f50d['shift']());}};_0x4eeeae(++_0x580fae);}(_0x08db,0x14e));var _0xb08d=function(_0x473680,_0x412316){_0x473680=_0x473680-0x0;var _0x2e2bd3=_0x08db[_0x473680];return _0x2e2bd3;};'use strict';var multer=require(_0xb08d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb08d('0x1'));var express=require('express');var router=express[_0xb08d('0x2')]();var fs_extra=require(_0xb08d('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb08d('0x4'));var config=require(_0xb08d('0x5'));var controller=require(_0xb08d('0x6'));router[_0xb08d('0x7')]('/',auth[_0xb08d('0x8')](),controller['index']);router[_0xb08d('0x7')]('/:id',auth[_0xb08d('0x8')](),controller['show']);router['get'](_0xb08d('0x9'),auth[_0xb08d('0x8')](),controller[_0xb08d('0xa')]);router[_0xb08d('0x7')]('/:id/hopper_histories',auth[_0xb08d('0x8')](),controller[_0xb08d('0xb')]);router[_0xb08d('0x7')](_0xb08d('0xc'),auth[_0xb08d('0x8')](),controller[_0xb08d('0xd')]);router[_0xb08d('0x7')](_0xb08d('0xe'),auth[_0xb08d('0x8')](),controller['getHopperBlacks']);router[_0xb08d('0x7')]('/:id/lists',auth['isAuthenticated'](),controller['getLists']);router[_0xb08d('0x7')](_0xb08d('0xf'),auth[_0xb08d('0x8')](),controller[_0xb08d('0x10')]);router['post']('/',auth[_0xb08d('0x8')](),controller[_0xb08d('0x11')]);router[_0xb08d('0x12')](_0xb08d('0x13'),auth[_0xb08d('0x8')](),controller[_0xb08d('0x14')]);router['post'](_0xb08d('0x15'),auth[_0xb08d('0x8')](),controller[_0xb08d('0x16')]);router[_0xb08d('0x12')](_0xb08d('0xf'),auth[_0xb08d('0x8')](),controller[_0xb08d('0x17')]);router['put'](_0xb08d('0x18'),auth[_0xb08d('0x8')](),controller[_0xb08d('0x19')]);router['delete'](_0xb08d('0x18'),auth[_0xb08d('0x8')](),controller['destroy']);router[_0xb08d('0x1a')](_0xb08d('0x15'),auth['isAuthenticated'](),controller[_0xb08d('0x1b')]);router[_0xb08d('0x1a')](_0xb08d('0xf'),auth[_0xb08d('0x8')](),controller[_0xb08d('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index c5cc126..e0dbadb 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 _0x58c6=['STRING','TEXT','key','exports'];(function(_0x559587,_0x53504b){var _0x21f2b0=function(_0x1fc7ea){while(--_0x1fc7ea){_0x559587['push'](_0x559587['shift']());}};_0x21f2b0(++_0x53504b);}(_0x58c6,0x1e3));var _0x658c=function(_0x16337a,_0x4789a1){_0x16337a=_0x16337a-0x0;var _0x422365=_0x58c6[_0x16337a];return _0x422365;};'use strict';var Sequelize=require('sequelize');module[_0x658c('0x0')]={'key':{'type':Sequelize[_0x658c('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x658c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x658c('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x658c('0x3'));}}}; \ No newline at end of file +var _0x5e29=['STRING','VIRTUAL','getDataValue','key','sequelize','exports'];(function(_0x349a9e,_0x473cb8){var _0x24c207=function(_0x22f148){while(--_0x22f148){_0x349a9e['push'](_0x349a9e['shift']());}};_0x24c207(++_0x473cb8);}(_0x5e29,0xd6));var _0x95e2=function(_0xd5246e,_0x90d9d2){_0xd5246e=_0xd5246e-0x0;var _0x57397d=_0x5e29[_0xd5246e];return _0x57397d;};'use strict';var Sequelize=require(_0x95e2('0x0'));module[_0x95e2('0x1')]={'key':{'type':Sequelize[_0x95e2('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x95e2('0x2')]},'name':{'type':Sequelize[_0x95e2('0x3')],'get':function(){return this[_0x95e2('0x4')](_0x95e2('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 21509a2..843e500 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 _0x2134=['squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','CannedAnswers','UserProfileResource','error','stack','name','send','map','CannedAnswer','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','keys','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash'];(function(_0x1f9a8a,_0x459ee0){var _0x5c4f65=function(_0x2106a4){while(--_0x2106a4){_0x1f9a8a['push'](_0x1f9a8a['shift']());}};_0x5c4f65(++_0x459ee0);}(_0x2134,0xa8));var _0x4213=function(_0x67bd80,_0xe69500){_0x67bd80=_0x67bd80-0x0;var _0x337684=_0x2134[_0x67bd80];return _0x337684;};'use strict';var emlformat=require(_0x4213('0x0'));var rimraf=require(_0x4213('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4213('0x2'));var rp=require(_0x4213('0x3'));var moment=require(_0x4213('0x4'));var BPromise=require(_0x4213('0x5'));var Mustache=require(_0x4213('0x6'));var util=require(_0x4213('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4213('0x8'));var ejs=require(_0x4213('0x9'));var fs=require('fs');var fs_extra=require(_0x4213('0xa'));var _=require(_0x4213('0xb'));var squel=require(_0x4213('0xc'));var crypto=require('crypto');var jsforce=require(_0x4213('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4213('0x8'));var querystring=require(_0x4213('0xe'));var Papa=require(_0x4213('0xf'));var Redis=require(_0x4213('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4213('0x11'));var as=require(_0x4213('0x12'));var hardwareService=require(_0x4213('0x13'));var logger=require('../../config/logger')(_0x4213('0x14'));var utils=require('../../config/utils');var config=require(_0x4213('0x15'));var licenseUtil=require(_0x4213('0x16'));var db=require(_0x4213('0x17'))['db'];function respondWithStatusCode(_0xb7bf94,_0x7cfcb6){_0x7cfcb6=_0x7cfcb6||0xcc;return function(_0x4157bd){if(_0x4157bd){return _0xb7bf94[_0x4213('0x18')](_0x7cfcb6);}return _0xb7bf94[_0x4213('0x19')](_0x7cfcb6)[_0x4213('0x1a')]();};}function respondWithResult(_0x1da980,_0x221f9f){_0x221f9f=_0x221f9f||0xc8;return function(_0x43e283){if(_0x43e283){return _0x1da980[_0x4213('0x19')](_0x221f9f)[_0x4213('0x1b')](_0x43e283);}};}function respondWithFilteredResult(_0x47cea6,_0x5b5d4c){return function(_0x50da57){if(_0x50da57){var _0x148719=typeof _0x5b5d4c[_0x4213('0x1c')]==='undefined'&&typeof _0x5b5d4c[_0x4213('0x1d')]==='undefined';var _0x17e9be=_0x50da57['count'];var _0x426981=_0x148719?0x0:_0x5b5d4c[_0x4213('0x1c')];var _0x371df1=_0x148719?_0x50da57[_0x4213('0x1e')]:_0x5b5d4c['offset']+_0x5b5d4c['limit'];var _0x44817d;if(_0x371df1>=_0x17e9be){_0x371df1=_0x17e9be;_0x44817d=0xc8;}else{_0x44817d=0xce;}_0x47cea6[_0x4213('0x19')](_0x44817d);return _0x47cea6[_0x4213('0x1f')](_0x4213('0x20'),_0x426981+'-'+_0x371df1+'/'+_0x17e9be)[_0x4213('0x1b')](_0x50da57);}return null;};}function patchUpdates(_0x380d86){return function(_0x14a446){try{jsonpatch[_0x4213('0x21')](_0x14a446,_0x380d86,!![]);}catch(_0x336cdd){return BPromise[_0x4213('0x22')](_0x336cdd);}return _0x14a446[_0x4213('0x23')]();};}function saveUpdates(_0x3fc1cb,_0x899b65){return function(_0x1d4b2b){if(_0x1d4b2b){return _0x1d4b2b[_0x4213('0x24')](_0x3fc1cb)['then'](function(_0x5e9413){return _0x5e9413;});}return null;};}function removeEntity(_0x193603,_0x249fc9){return function(_0x9ced25){if(_0x9ced25){return _0x9ced25[_0x4213('0x25')]()[_0x4213('0x26')](function(){var _0x31e067=_0x9ced25[_0x4213('0x27')]({'plain':!![]});var _0x25e356=_0x4213('0x28');return db[_0x4213('0x29')][_0x4213('0x25')]({'where':{'type':_0x25e356,'resourceId':_0x31e067['id']}})[_0x4213('0x26')](function(){return _0x9ced25;});})[_0x4213('0x26')](function(){_0x193603[_0x4213('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c56a8,_0x42b0dd){return function(_0x3be836){if(!_0x3be836){_0x4c56a8[_0x4213('0x18')](0x194);}return _0x3be836;};}function handleError(_0x1ee964,_0x218790){_0x218790=_0x218790||0x1f4;return function(_0x1deefa){logger[_0x4213('0x2a')](_0x1deefa[_0x4213('0x2b')]);if(_0x1deefa[_0x4213('0x2c')]){delete _0x1deefa[_0x4213('0x2c')];}_0x1ee964[_0x4213('0x19')](_0x218790)[_0x4213('0x2d')](_0x1deefa);};}exports['index']=function(_0x203587,_0x597107){var _0x1096c1={},_0x2aa541={},_0x491a8e={'count':0x0,'rows':[]};var _0x45e06a=_[_0x4213('0x2e')](db[_0x4213('0x2f')][_0x4213('0x30')],function(_0x289819){return{'name':_0x289819[_0x4213('0x31')],'type':_0x289819[_0x4213('0x32')][_0x4213('0x33')]};});_0x2aa541['model']=_['map'](_0x45e06a,_0x4213('0x2c'));_0x2aa541[_0x4213('0x34')]=_['keys'](_0x203587['query']);_0x2aa541[_0x4213('0x35')]=_['intersection'](_0x2aa541[_0x4213('0x36')],_0x2aa541[_0x4213('0x34')]);_0x1096c1['attributes']=_[_0x4213('0x37')](_0x2aa541['model'],qs['fields'](_0x203587['query'][_0x4213('0x38')]));_0x1096c1[_0x4213('0x39')]=_0x1096c1[_0x4213('0x39')][_0x4213('0x3a')]?_0x1096c1['attributes']:_0x2aa541[_0x4213('0x36')];if(!_0x203587[_0x4213('0x34')][_0x4213('0x3b')](_0x4213('0x3c'))){_0x1096c1[_0x4213('0x1d')]=qs[_0x4213('0x1d')](_0x203587['query'][_0x4213('0x1d')]);_0x1096c1[_0x4213('0x1c')]=qs[_0x4213('0x1c')](_0x203587[_0x4213('0x34')][_0x4213('0x1c')]);}_0x1096c1[_0x4213('0x3d')]=qs[_0x4213('0x3e')](_0x203587['query'][_0x4213('0x3e')]);_0x1096c1[_0x4213('0x3f')]=qs[_0x4213('0x35')](_[_0x4213('0x40')](_0x203587['query'],_0x2aa541['filters']),_0x45e06a);if(_0x203587[_0x4213('0x34')][_0x4213('0x41')]){_0x1096c1['where']=_['merge'](_0x1096c1['where'],{'$or':[{'key':{'$like':'%'+_0x203587[_0x4213('0x34')]['filter']+'%'}},{'value':{'$like':'%'+_0x203587[_0x4213('0x34')]['filter']+'%'}}]});}_0x1096c1=_[_0x4213('0x42')]({},_0x1096c1,_0x203587[_0x4213('0x43')]);var _0x4e44a4={'where':_0x1096c1[_0x4213('0x3f')]};return db[_0x4213('0x2f')][_0x4213('0x1e')](_0x4e44a4)[_0x4213('0x26')](function(_0x46204f){_0x491a8e[_0x4213('0x1e')]=_0x46204f;if(_0x203587[_0x4213('0x34')][_0x4213('0x44')]){_0x1096c1[_0x4213('0x45')]=[{'all':!![]}];}return db[_0x4213('0x2f')][_0x4213('0x46')](_0x1096c1);})[_0x4213('0x26')](function(_0x8b179f){_0x491a8e[_0x4213('0x47')]=_0x8b179f;return _0x491a8e;})[_0x4213('0x26')](respondWithFilteredResult(_0x597107,_0x1096c1))['catch'](handleError(_0x597107,null));};exports['show']=function(_0x488e61,_0x272114){var _0x5a330b={'raw':!![],'where':{'id':_0x488e61[_0x4213('0x48')]['id']}},_0xf43daf={};_0xf43daf['model']=_['keys'](db['CannedAnswer']['rawAttributes']);_0xf43daf[_0x4213('0x34')]=_[_0x4213('0x49')](_0x488e61[_0x4213('0x34')]);_0xf43daf[_0x4213('0x35')]=_[_0x4213('0x37')](_0xf43daf['model'],_0xf43daf[_0x4213('0x34')]);_0x5a330b[_0x4213('0x39')]=_[_0x4213('0x37')](_0xf43daf['model'],qs['fields'](_0x488e61[_0x4213('0x34')]['fields']));_0x5a330b[_0x4213('0x39')]=_0x5a330b[_0x4213('0x39')][_0x4213('0x3a')]?_0x5a330b[_0x4213('0x39')]:_0xf43daf[_0x4213('0x36')];if(_0x488e61['query'][_0x4213('0x44')]){_0x5a330b['include']=[{'all':!![]}];}_0x5a330b=_['merge']({},_0x5a330b,_0x488e61[_0x4213('0x43')]);return db[_0x4213('0x2f')][_0x4213('0x4a')](_0x5a330b)[_0x4213('0x26')](handleEntityNotFound(_0x272114,null))[_0x4213('0x26')](respondWithResult(_0x272114,null))['catch'](handleError(_0x272114,null));};exports[_0x4213('0x24')]=function(_0xaa35ae,_0xf0eae3){if(_0xaa35ae[_0x4213('0x4b')]['id']){delete _0xaa35ae[_0x4213('0x4b')]['id'];}return db[_0x4213('0x2f')][_0x4213('0x4a')]({'where':{'id':_0xaa35ae['params']['id']}})[_0x4213('0x26')](handleEntityNotFound(_0xf0eae3,null))[_0x4213('0x26')](saveUpdates(_0xaa35ae[_0x4213('0x4b')],null))[_0x4213('0x26')](respondWithResult(_0xf0eae3,null))['catch'](handleError(_0xf0eae3,null));};exports['destroy']=function(_0x1f2dfb,_0x3db46b){return db[_0x4213('0x2f')]['find']({'where':{'id':_0x1f2dfb[_0x4213('0x48')]['id']}})['then'](handleEntityNotFound(_0x3db46b,null))[_0x4213('0x26')](removeEntity(_0x3db46b,null))['catch'](handleError(_0x3db46b,null));};exports[_0x4213('0x4c')]=function(_0x4335ac,_0x2d6841){var _0x120a84={'key':_0x4335ac['body'][_0x4213('0x33')]};if(_0x4335ac[_0x4213('0x4b')][_0x4213('0x4d')]){_0x120a84[_0x4213('0x4d')]=_0x4335ac[_0x4213('0x4b')]['MailAccountId'];}else if(_0x4335ac[_0x4213('0x4b')][_0x4213('0x4e')]){_0x120a84[_0x4213('0x4e')]=_0x4335ac['body'][_0x4213('0x4e')];}else if(_0x4335ac[_0x4213('0x4b')][_0x4213('0x4f')]){_0x120a84[_0x4213('0x4f')]=_0x4335ac['body'][_0x4213('0x4f')];}else if(_0x4335ac[_0x4213('0x4b')][_0x4213('0x50')]){_0x120a84[_0x4213('0x50')]=_0x4335ac[_0x4213('0x4b')][_0x4213('0x50')];}return db[_0x4213('0x2f')]['find']({'where':_0x120a84})[_0x4213('0x26')](function(_0x1b7032){if(_0x1b7032){throw new db[(_0x4213('0x51'))]['ValidationError'](_0x4213('0x52'));}return db[_0x4213('0x2f')][_0x4213('0x4c')](_0x4335ac[_0x4213('0x4b')]);})[_0x4213('0x26')](function(_0x4b4583){var _0x3a2e43=_0x4335ac['user'][_0x4213('0x27')]({'plain':!![]});if(!_0x3a2e43)throw new Error(_0x4213('0x53'));if(_0x3a2e43[_0x4213('0x54')]===_0x4213('0x55')){var _0x5ea0ec=_0x4b4583['get']({'plain':!![]});return db['UserProfileSection'][_0x4213('0x4a')]({'where':{'name':_0x4213('0x28'),'userProfileId':_0x3a2e43[_0x4213('0x56')]},'raw':!![]})[_0x4213('0x26')](function(_0x271762){if(_0x271762&&_0x271762[_0x4213('0x57')]===0x0){return db[_0x4213('0x29')][_0x4213('0x4c')]({'name':_0x5ea0ec[_0x4213('0x2c')],'resourceId':_0x5ea0ec['id'],'type':_0x271762['name'],'sectionId':_0x271762['id']},{})[_0x4213('0x26')](function(){return _0x4b4583;});}else{return _0x4b4583;}})[_0x4213('0x58')](function(_0xc64dbf){logger[_0x4213('0x2a')](_0x4213('0x59'),_0xc64dbf);throw _0xc64dbf;});}return _0x4b4583;})[_0x4213('0x26')](respondWithResult(_0x2d6841,0xc9))[_0x4213('0x58')](handleError(_0x2d6841,null));}; \ No newline at end of file +var _0xf6cd=['includeAll','include','options','find','body','catch','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','get','CannedAnswers','destroy','end','sendStatus','error','stack','name','send','index','CannedAnswer','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','where','filter','merge','findAll','rows','params','rawAttributes','length'];(function(_0x31d8bb,_0x259e4){var _0x4bf266=function(_0x20c68e){while(--_0x20c68e){_0x31d8bb['push'](_0x31d8bb['shift']());}};_0x4bf266(++_0x259e4);}(_0xf6cd,0x185));var _0xdf6c=function(_0x6823e,_0xc66f0e){_0x6823e=_0x6823e-0x0;var _0x5a2be8=_0xf6cd[_0x6823e];return _0x5a2be8;};'use strict';var emlformat=require(_0xdf6c('0x0'));var rimraf=require(_0xdf6c('0x1'));var zipdir=require(_0xdf6c('0x2'));var jsonpatch=require(_0xdf6c('0x3'));var rp=require(_0xdf6c('0x4'));var moment=require(_0xdf6c('0x5'));var BPromise=require(_0xdf6c('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdf6c('0x7'));var sox=require(_0xdf6c('0x8'));var csv=require(_0xdf6c('0x9'));var ejs=require(_0xdf6c('0xa'));var fs=require('fs');var fs_extra=require(_0xdf6c('0xb'));var _=require(_0xdf6c('0xc'));var squel=require(_0xdf6c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdf6c('0xe'));var toCsv=require(_0xdf6c('0x9'));var querystring=require(_0xdf6c('0xf'));var Papa=require(_0xdf6c('0x10'));var Redis=require(_0xdf6c('0x11'));var authService=require(_0xdf6c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdf6c('0x13'));var hardwareService=require(_0xdf6c('0x14'));var logger=require(_0xdf6c('0x15'))(_0xdf6c('0x16'));var utils=require(_0xdf6c('0x17'));var config=require(_0xdf6c('0x18'));var licenseUtil=require(_0xdf6c('0x19'));var db=require(_0xdf6c('0x1a'))['db'];function respondWithStatusCode(_0x4943ff,_0x11ad4e){_0x11ad4e=_0x11ad4e||0xcc;return function(_0x4cb72c){if(_0x4cb72c){return _0x4943ff['sendStatus'](_0x11ad4e);}return _0x4943ff['status'](_0x11ad4e)['end']();};}function respondWithResult(_0x59bdf8,_0xe804c2){_0xe804c2=_0xe804c2||0xc8;return function(_0x38485f){if(_0x38485f){return _0x59bdf8[_0xdf6c('0x1b')](_0xe804c2)[_0xdf6c('0x1c')](_0x38485f);}};}function respondWithFilteredResult(_0x2c89f2,_0x3e0745){return function(_0x49da8f){if(_0x49da8f){var _0x266ad5=typeof _0x3e0745[_0xdf6c('0x1d')]===_0xdf6c('0x1e')&&typeof _0x3e0745['limit']==='undefined';var _0x211b6e=_0x49da8f[_0xdf6c('0x1f')];var _0x1f0c0b=_0x266ad5?0x0:_0x3e0745['offset'];var _0x5d7062=_0x266ad5?_0x49da8f[_0xdf6c('0x1f')]:_0x3e0745['offset']+_0x3e0745['limit'];var _0x29f663;if(_0x5d7062>=_0x211b6e){_0x5d7062=_0x211b6e;_0x29f663=0xc8;}else{_0x29f663=0xce;}_0x2c89f2[_0xdf6c('0x1b')](_0x29f663);return _0x2c89f2[_0xdf6c('0x20')](_0xdf6c('0x21'),_0x1f0c0b+'-'+_0x5d7062+'/'+_0x211b6e)[_0xdf6c('0x1c')](_0x49da8f);}return null;};}function patchUpdates(_0x377487){return function(_0x271f90){try{jsonpatch[_0xdf6c('0x22')](_0x271f90,_0x377487,!![]);}catch(_0x20edb2){return BPromise[_0xdf6c('0x23')](_0x20edb2);}return _0x271f90[_0xdf6c('0x24')]();};}function saveUpdates(_0x203c96,_0x2d0f4a){return function(_0x4a8c77){if(_0x4a8c77){return _0x4a8c77['update'](_0x203c96)[_0xdf6c('0x25')](function(_0xb86613){return _0xb86613;});}return null;};}function removeEntity(_0x2486dc,_0x16d94c){return function(_0x469ae4){if(_0x469ae4){return _0x469ae4['destroy']()[_0xdf6c('0x25')](function(){var _0x14560b=_0x469ae4[_0xdf6c('0x26')]({'plain':!![]});var _0x176734=_0xdf6c('0x27');return db['UserProfileResource'][_0xdf6c('0x28')]({'where':{'type':_0x176734,'resourceId':_0x14560b['id']}})['then'](function(){return _0x469ae4;});})[_0xdf6c('0x25')](function(){_0x2486dc['status'](0xcc)[_0xdf6c('0x29')]();});}};}function handleEntityNotFound(_0x1efcb0,_0x442885){return function(_0x12ff92){if(!_0x12ff92){_0x1efcb0[_0xdf6c('0x2a')](0x194);}return _0x12ff92;};}function handleError(_0x4801a7,_0x46737e){_0x46737e=_0x46737e||0x1f4;return function(_0x3cd35d){logger[_0xdf6c('0x2b')](_0x3cd35d[_0xdf6c('0x2c')]);if(_0x3cd35d['name']){delete _0x3cd35d[_0xdf6c('0x2d')];}_0x4801a7[_0xdf6c('0x1b')](_0x46737e)[_0xdf6c('0x2e')](_0x3cd35d);};}exports[_0xdf6c('0x2f')]=function(_0x597c53,_0x3fc453){var _0x53c41a={},_0x8e970a={},_0x3e2df3={'count':0x0,'rows':[]};var _0x52b1ff=_['map'](db[_0xdf6c('0x30')]['rawAttributes'],function(_0x3aa7d1){return{'name':_0x3aa7d1[_0xdf6c('0x31')],'type':_0x3aa7d1[_0xdf6c('0x32')][_0xdf6c('0x33')]};});_0x8e970a[_0xdf6c('0x34')]=_['map'](_0x52b1ff,'name');_0x8e970a['query']=_[_0xdf6c('0x35')](_0x597c53[_0xdf6c('0x36')]);_0x8e970a[_0xdf6c('0x37')]=_['intersection'](_0x8e970a['model'],_0x8e970a['query']);_0x53c41a[_0xdf6c('0x38')]=_[_0xdf6c('0x39')](_0x8e970a[_0xdf6c('0x34')],qs[_0xdf6c('0x3a')](_0x597c53[_0xdf6c('0x36')][_0xdf6c('0x3a')]));_0x53c41a['attributes']=_0x53c41a[_0xdf6c('0x38')]['length']?_0x53c41a[_0xdf6c('0x38')]:_0x8e970a['model'];if(!_0x597c53['query'][_0xdf6c('0x3b')](_0xdf6c('0x3c'))){_0x53c41a['limit']=qs[_0xdf6c('0x3d')](_0x597c53[_0xdf6c('0x36')][_0xdf6c('0x3d')]);_0x53c41a[_0xdf6c('0x1d')]=qs[_0xdf6c('0x1d')](_0x597c53[_0xdf6c('0x36')][_0xdf6c('0x1d')]);}_0x53c41a['order']=qs[_0xdf6c('0x3e')](_0x597c53[_0xdf6c('0x36')][_0xdf6c('0x3e')]);_0x53c41a[_0xdf6c('0x3f')]=qs[_0xdf6c('0x37')](_['pick'](_0x597c53['query'],_0x8e970a[_0xdf6c('0x37')]),_0x52b1ff);if(_0x597c53[_0xdf6c('0x36')][_0xdf6c('0x40')]){_0x53c41a[_0xdf6c('0x3f')]=_[_0xdf6c('0x41')](_0x53c41a[_0xdf6c('0x3f')],{'$or':[{'key':{'$like':'%'+_0x597c53[_0xdf6c('0x36')]['filter']+'%'}},{'value':{'$like':'%'+_0x597c53['query'][_0xdf6c('0x40')]+'%'}}]});}_0x53c41a=_[_0xdf6c('0x41')]({},_0x53c41a,_0x597c53['options']);var _0x42d2c6={'where':_0x53c41a[_0xdf6c('0x3f')]};return db[_0xdf6c('0x30')][_0xdf6c('0x1f')](_0x42d2c6)[_0xdf6c('0x25')](function(_0x276cce){_0x3e2df3[_0xdf6c('0x1f')]=_0x276cce;if(_0x597c53[_0xdf6c('0x36')]['includeAll']){_0x53c41a['include']=[{'all':!![]}];}return db[_0xdf6c('0x30')][_0xdf6c('0x42')](_0x53c41a);})[_0xdf6c('0x25')](function(_0x3c92bd){_0x3e2df3[_0xdf6c('0x43')]=_0x3c92bd;return _0x3e2df3;})[_0xdf6c('0x25')](respondWithFilteredResult(_0x3fc453,_0x53c41a))['catch'](handleError(_0x3fc453,null));};exports['show']=function(_0x3cb6af,_0x415280){var _0x4c2eec={'raw':!![],'where':{'id':_0x3cb6af[_0xdf6c('0x44')]['id']}},_0x23d580={};_0x23d580[_0xdf6c('0x34')]=_[_0xdf6c('0x35')](db['CannedAnswer'][_0xdf6c('0x45')]);_0x23d580[_0xdf6c('0x36')]=_['keys'](_0x3cb6af[_0xdf6c('0x36')]);_0x23d580[_0xdf6c('0x37')]=_['intersection'](_0x23d580[_0xdf6c('0x34')],_0x23d580[_0xdf6c('0x36')]);_0x4c2eec[_0xdf6c('0x38')]=_[_0xdf6c('0x39')](_0x23d580[_0xdf6c('0x34')],qs[_0xdf6c('0x3a')](_0x3cb6af[_0xdf6c('0x36')][_0xdf6c('0x3a')]));_0x4c2eec[_0xdf6c('0x38')]=_0x4c2eec['attributes'][_0xdf6c('0x46')]?_0x4c2eec[_0xdf6c('0x38')]:_0x23d580[_0xdf6c('0x34')];if(_0x3cb6af[_0xdf6c('0x36')][_0xdf6c('0x47')]){_0x4c2eec[_0xdf6c('0x48')]=[{'all':!![]}];}_0x4c2eec=_[_0xdf6c('0x41')]({},_0x4c2eec,_0x3cb6af[_0xdf6c('0x49')]);return db[_0xdf6c('0x30')][_0xdf6c('0x4a')](_0x4c2eec)[_0xdf6c('0x25')](handleEntityNotFound(_0x415280,null))[_0xdf6c('0x25')](respondWithResult(_0x415280,null))['catch'](handleError(_0x415280,null));};exports['update']=function(_0x186ba3,_0x559a25){if(_0x186ba3[_0xdf6c('0x4b')]['id']){delete _0x186ba3[_0xdf6c('0x4b')]['id'];}return db[_0xdf6c('0x30')][_0xdf6c('0x4a')]({'where':{'id':_0x186ba3['params']['id']}})[_0xdf6c('0x25')](handleEntityNotFound(_0x559a25,null))['then'](saveUpdates(_0x186ba3[_0xdf6c('0x4b')],null))[_0xdf6c('0x25')](respondWithResult(_0x559a25,null))[_0xdf6c('0x4c')](handleError(_0x559a25,null));};exports[_0xdf6c('0x28')]=function(_0x2b5d22,_0x36ea4f){return db[_0xdf6c('0x30')][_0xdf6c('0x4a')]({'where':{'id':_0x2b5d22[_0xdf6c('0x44')]['id']}})['then'](handleEntityNotFound(_0x36ea4f,null))[_0xdf6c('0x25')](removeEntity(_0x36ea4f,null))[_0xdf6c('0x4c')](handleError(_0x36ea4f,null));};exports[_0xdf6c('0x4d')]=function(_0x5771af,_0x1722dc){var _0xc51c66={'key':_0x5771af[_0xdf6c('0x4b')][_0xdf6c('0x33')]};if(_0x5771af[_0xdf6c('0x4b')][_0xdf6c('0x4e')]){_0xc51c66[_0xdf6c('0x4e')]=_0x5771af[_0xdf6c('0x4b')]['MailAccountId'];}else if(_0x5771af[_0xdf6c('0x4b')][_0xdf6c('0x4f')]){_0xc51c66[_0xdf6c('0x4f')]=_0x5771af[_0xdf6c('0x4b')][_0xdf6c('0x4f')];}else if(_0x5771af[_0xdf6c('0x4b')][_0xdf6c('0x50')]){_0xc51c66[_0xdf6c('0x50')]=_0x5771af[_0xdf6c('0x4b')][_0xdf6c('0x50')];}else if(_0x5771af[_0xdf6c('0x4b')]['ChatWebsiteId']){_0xc51c66[_0xdf6c('0x51')]=_0x5771af[_0xdf6c('0x4b')][_0xdf6c('0x51')];}return db['CannedAnswer']['find']({'where':_0xc51c66})[_0xdf6c('0x25')](function(_0x31fd5e){if(_0x31fd5e){throw new db[(_0xdf6c('0x52'))][(_0xdf6c('0x53'))](_0xdf6c('0x54'));}return db[_0xdf6c('0x30')][_0xdf6c('0x4d')](_0x5771af[_0xdf6c('0x4b')]);})[_0xdf6c('0x25')](function(_0x38a277){var _0x240aaf=_0x5771af['user'][_0xdf6c('0x26')]({'plain':!![]});if(!_0x240aaf)throw new Error(_0xdf6c('0x55'));if(_0x240aaf[_0xdf6c('0x56')]==='user'){var _0x545f50=_0x38a277[_0xdf6c('0x26')]({'plain':!![]});return db[_0xdf6c('0x57')][_0xdf6c('0x4a')]({'where':{'name':_0xdf6c('0x27'),'userProfileId':_0x240aaf[_0xdf6c('0x58')]},'raw':!![]})[_0xdf6c('0x25')](function(_0x24a285){if(_0x24a285&&_0x24a285[_0xdf6c('0x59')]===0x0){return db[_0xdf6c('0x5a')]['create']({'name':_0x545f50['name'],'resourceId':_0x545f50['id'],'type':_0x24a285[_0xdf6c('0x2d')],'sectionId':_0x24a285['id']},{})[_0xdf6c('0x25')](function(){return _0x38a277;});}else{return _0x38a277;}})[_0xdf6c('0x4c')](function(_0x4e6acf){logger[_0xdf6c('0x2b')](_0xdf6c('0x5b'),_0x4e6acf);throw _0x4e6acf;});}return _0x38a277;})['then'](respondWithResult(_0x1722dc,0xc9))[_0xdf6c('0x4c')](handleError(_0x1722dc,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 4ed27ec..7084060 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 _0xe376=['define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes'];(function(_0x584641,_0x72fa72){var _0x40ed9e=function(_0xc95a67){while(--_0xc95a67){_0x584641['push'](_0x584641['shift']());}};_0x40ed9e(++_0x72fa72);}(_0xe376,0x115));var _0x6e37=function(_0x57fd40,_0x9de24f){_0x57fd40=_0x57fd40-0x0;var _0x52bb76=_0xe376[_0x57fd40];return _0x52bb76;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6e37('0x0'))(_0x6e37('0x1'));var moment=require(_0x6e37('0x2'));var BPromise=require(_0x6e37('0x3'));var rp=require(_0x6e37('0x4'));var fs=require('fs');var path=require(_0x6e37('0x5'));var rimraf=require(_0x6e37('0x6'));var config=require(_0x6e37('0x7'));var attributes=require(_0x6e37('0x8'));module['exports']=function(_0x18c1fa,_0x27869c){return _0x18c1fa[_0x6e37('0x9')]('CannedAnswer',attributes,{'tableName':_0x6e37('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6e37('0xb'),'collate':_0x6e37('0xc')});}; \ No newline at end of file +var _0x2bc2=['./cannedAnswer.attributes','define','CannedAnswer','utf8mb4_unicode_ci','lodash','api','request-promise','rimraf'];(function(_0x593487,_0x40c39b){var _0x4d3f61=function(_0x4079c1){while(--_0x4079c1){_0x593487['push'](_0x593487['shift']());}};_0x4d3f61(++_0x40c39b);}(_0x2bc2,0x1ac));var _0x22bc=function(_0x586998,_0xc9fd34){_0x586998=_0x586998-0x0;var _0x1c882d=_0x2bc2[_0x586998];return _0x1c882d;};'use strict';var _=require(_0x22bc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x22bc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x22bc('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22bc('0x3'));var config=require('../../config/environment');var attributes=require(_0x22bc('0x4'));module['exports']=function(_0x12232a,_0x130212){return _0x12232a[_0x22bc('0x5')](_0x22bc('0x6'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x22bc('0x7')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 84ef120..47a3218 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(_0x528db4,_0xd0288c){var _0x27f6fe=function(_0x37f34b){while(--_0x37f34b){_0x528db4['push'](_0x528db4['shift']());}};_0x27f6fe(++_0xd0288c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0x217f74,_0x14dd9b){var _0x3ab223=function(_0x17a123){while(--_0x17a123){_0x217f74['push'](_0x217f74['shift']());}};_0x3ab223(++_0x14dd9b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 0442fcf..9971e41 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 _0xc624=['./cannedAnswer.controller','get','isAuthenticated','index','/:id','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc624,0x87));var _0x4c62=function(_0x5abc1e,_0x8715e7){_0x5abc1e=_0x5abc1e-0x0;var _0x3423d1=_0xc624[_0x5abc1e];return _0x3423d1;};'use strict';var multer=require(_0x4c62('0x0'));var util=require(_0x4c62('0x1'));var path=require(_0x4c62('0x2'));var timeout=require(_0x4c62('0x3'));var express=require(_0x4c62('0x4'));var router=express[_0x4c62('0x5')]();var fs_extra=require(_0x4c62('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4c62('0x7'));var config=require(_0x4c62('0x8'));var controller=require(_0x4c62('0x9'));router[_0x4c62('0xa')]('/',auth[_0x4c62('0xb')](),controller[_0x4c62('0xc')]);router[_0x4c62('0xa')](_0x4c62('0xd'),auth[_0x4c62('0xb')](),controller['show']);router['post']('/',auth[_0x4c62('0xb')](),controller['create']);router[_0x4c62('0xe')](_0x4c62('0xd'),auth[_0x4c62('0xb')](),controller[_0x4c62('0xf')]);router[_0x4c62('0x10')](_0x4c62('0xd'),auth['isAuthenticated'](),controller[_0x4c62('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc5d0=['exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy'];(function(_0x4b86bc,_0x13ccf7){var _0x561b60=function(_0x42a3d8){while(--_0x42a3d8){_0x4b86bc['push'](_0x4b86bc['shift']());}};_0x561b60(++_0x13ccf7);}(_0xc5d0,0xbc));var _0x0c5d=function(_0xbcd604,_0x5c6862){_0xbcd604=_0xbcd604-0x0;var _0x16a71e=_0xc5d0[_0xbcd604];return _0x16a71e;};'use strict';var multer=require(_0x0c5d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0c5d('0x1'));var router=express[_0x0c5d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0c5d('0x3'));var interaction=require(_0x0c5d('0x4'));var config=require(_0x0c5d('0x5'));var controller=require('./cannedAnswer.controller');router[_0x0c5d('0x6')]('/',auth[_0x0c5d('0x7')](),controller[_0x0c5d('0x8')]);router[_0x0c5d('0x6')](_0x0c5d('0x9'),auth['isAuthenticated'](),controller[_0x0c5d('0xa')]);router[_0x0c5d('0xb')]('/',auth[_0x0c5d('0x7')](),controller[_0x0c5d('0xc')]);router['put']('/:id',auth[_0x0c5d('0x7')](),controller[_0x0c5d('0xd')]);router[_0x0c5d('0xe')](_0x0c5d('0x9'),auth[_0x0c5d('0x7')](),controller[_0x0c5d('0xf')]);module[_0x0c5d('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index b0e851a..912d395 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 _0xbdb7=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x1c510a,_0x1413a9){var _0x23cedd=function(_0x3f3e43){while(--_0x3f3e43){_0x1c510a['push'](_0x1c510a['shift']());}};_0x23cedd(++_0x1413a9);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5285a2,_0x1949c0){_0x5285a2=_0x5285a2-0x0;var _0x4222dc=_0xbdb7[_0x5285a2];return _0x4222dc;};'use strict';var Sequelize=require(_0x7bdb('0x0'));module[_0x7bdb('0x1')]={'calldate':{'type':Sequelize[_0x7bdb('0x2')],'allowNull':![],'defaultValue':_0x7bdb('0x3')},'clid':{'type':Sequelize[_0x7bdb('0x4')]},'src':{'type':Sequelize[_0x7bdb('0x4')]},'dst':{'type':Sequelize[_0x7bdb('0x4')]},'dcontext':{'type':Sequelize[_0x7bdb('0x4')]},'channel':{'type':Sequelize[_0x7bdb('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x7bdb('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x7bdb('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7bdb('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x7bdb('0x4')]},'uniqueid':{'type':Sequelize[_0x7bdb('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x7bdb('0x4')]},'type':{'type':Sequelize[_0x7bdb('0x4')]},'tag':{'type':Sequelize[_0x7bdb('0x4')]}}; \ No newline at end of file +var _0xd770=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x52deb5,_0x4c7748){var _0x476601=function(_0x19c7f2){while(--_0x19c7f2){_0x52deb5['push'](_0x52deb5['shift']());}};_0x476601(++_0x4c7748);}(_0xd770,0x1e5));var _0x0d77=function(_0x24dda9,_0x59f3a5){_0x24dda9=_0x24dda9-0x0;var _0x416acb=_0xd770[_0x24dda9];return _0x416acb;};'use strict';var Sequelize=require('sequelize');module[_0x0d77('0x0')]={'calldate':{'type':Sequelize[_0x0d77('0x1')],'allowNull':![],'defaultValue':_0x0d77('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x0d77('0x3')]},'dst':{'type':Sequelize[_0x0d77('0x3')]},'dcontext':{'type':Sequelize[_0x0d77('0x3')]},'channel':{'type':Sequelize[_0x0d77('0x3')]},'dstchannel':{'type':Sequelize[_0x0d77('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x0d77('0x3')]},'duration':{'type':Sequelize[_0x0d77('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x0d77('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x0d77('0x3')]},'userfield':{'type':Sequelize[_0x0d77('0x3')]},'uniqueid':{'type':Sequelize[_0x0d77('0x3')]},'linkedid':{'type':Sequelize[_0x0d77('0x3')]},'sequence':{'type':Sequelize[_0x0d77('0x3')]},'peeraccount':{'type':Sequelize[_0x0d77('0x3')]},'type':{'type':Sequelize[_0x0d77('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 570cb24..e07ef61 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 _0x1cb9=['rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','length','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','Cdr'];(function(_0xdc8716,_0x287b94){var _0xb6b1c3=function(_0xb2a92b){while(--_0xb2a92b){_0xdc8716['push'](_0xdc8716['shift']());}};_0xb6b1c3(++_0x287b94);}(_0x1cb9,0x14e));var _0x91cb=function(_0x115d00,_0x5fc386){_0x115d00=_0x115d00-0x0;var _0xe78932=_0x1cb9[_0x115d00];return _0xe78932;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x423c4f,_0x264e9b){return function(_0x4c8438){if(!_0x4c8438){_0x423c4f['sendStatus'](0x194);}return _0x4c8438;};}function handleError(_0x234eb1,_0x554350){_0x554350=_0x554350||0x1f4;return function(_0x1c67d2){logger[_0x91cb('0x27')](_0x1c67d2[_0x91cb('0x28')]);if(_0x1c67d2['name']){delete _0x1c67d2[_0x91cb('0x29')];}_0x234eb1['status'](_0x554350)[_0x91cb('0x2a')](_0x1c67d2);};}exports[_0x91cb('0x2b')]=function(_0x3b3ee6,_0x2fb473){var _0x468908={},_0x504275={},_0x2f04a3={'count':0x0,'rows':[]};var _0x52670a=_[_0x91cb('0x2c')](db[_0x91cb('0x2d')][_0x91cb('0x2e')],function(_0x4944bd){return{'name':_0x4944bd[_0x91cb('0x2f')],'type':_0x4944bd[_0x91cb('0x30')][_0x91cb('0x31')]};});_0x504275[_0x91cb('0x32')]=_[_0x91cb('0x2c')](_0x52670a,_0x91cb('0x29'));_0x504275[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0x3b3ee6[_0x91cb('0x33')]);_0x504275['filters']=_[_0x91cb('0x35')](_0x504275[_0x91cb('0x32')],_0x504275[_0x91cb('0x33')]);_0x468908[_0x91cb('0x36')]=_[_0x91cb('0x35')](_0x504275['model'],qs[_0x91cb('0x37')](_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x37')]));_0x468908[_0x91cb('0x36')]=_0x468908[_0x91cb('0x36')]['length']?_0x468908[_0x91cb('0x36')]:_0x504275['model'];if(!_0x3b3ee6['query']['hasOwnProperty'](_0x91cb('0x38'))){_0x468908['limit']=qs[_0x91cb('0x1d')](_0x3b3ee6['query']['limit']);_0x468908[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x1f')]);}_0x468908[_0x91cb('0x39')]=qs['sort'](_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x3a')]);_0x468908[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_['pick'](_0x3b3ee6['query'],_0x504275[_0x91cb('0x3c')]),_0x52670a);if(_0x3b3ee6[_0x91cb('0x33')]['filter']){_0x468908[_0x91cb('0x3b')]=_[_0x91cb('0x3d')](_0x468908['where'],{'$or':_[_0x91cb('0x2c')](_0x52670a,function(_0xddc409){if(_0xddc409['type']!==_0x91cb('0x3e')){var _0x545687={};_0x545687[_0xddc409[_0x91cb('0x29')]]={'$like':'%'+_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x3f')]+'%'};return _0x545687;}})});}_0x468908=_[_0x91cb('0x3d')]({},_0x468908,_0x3b3ee6[_0x91cb('0x40')]);var _0x20bf50={'where':_0x468908['where']};return db[_0x91cb('0x2d')][_0x91cb('0x1e')](_0x20bf50)['then'](function(_0x312581){_0x2f04a3['count']=_0x312581;if(_0x3b3ee6[_0x91cb('0x33')][_0x91cb('0x41')]){_0x468908[_0x91cb('0x42')]=[{'all':!![]}];}return db[_0x91cb('0x2d')]['findAll'](_0x468908);})[_0x91cb('0x25')](function(_0x5af0e6){_0x2f04a3[_0x91cb('0x43')]=_0x5af0e6;return _0x2f04a3;})[_0x91cb('0x25')](respondWithFilteredResult(_0x2fb473,_0x468908))[_0x91cb('0x44')](handleError(_0x2fb473,null));};exports[_0x91cb('0x45')]=function(_0x451463,_0x111cc0){var _0x325dca={'raw':!![],'where':{'id':_0x451463['params']['id']}},_0x3cc4c1={};_0x3cc4c1[_0x91cb('0x32')]=_['keys'](db[_0x91cb('0x2d')]['rawAttributes']);_0x3cc4c1[_0x91cb('0x33')]=_['keys'](_0x451463[_0x91cb('0x33')]);_0x3cc4c1[_0x91cb('0x3c')]=_[_0x91cb('0x35')](_0x3cc4c1[_0x91cb('0x32')],_0x3cc4c1['query']);_0x325dca[_0x91cb('0x36')]=_[_0x91cb('0x35')](_0x3cc4c1['model'],qs[_0x91cb('0x37')](_0x451463[_0x91cb('0x33')][_0x91cb('0x37')]));_0x325dca[_0x91cb('0x36')]=_0x325dca[_0x91cb('0x36')][_0x91cb('0x46')]?_0x325dca[_0x91cb('0x36')]:_0x3cc4c1[_0x91cb('0x32')];if(_0x451463[_0x91cb('0x33')]['includeAll']){_0x325dca[_0x91cb('0x42')]=[{'all':!![]}];}_0x325dca=_[_0x91cb('0x3d')]({},_0x325dca,_0x451463[_0x91cb('0x40')]);return db[_0x91cb('0x2d')][_0x91cb('0x47')](_0x325dca)[_0x91cb('0x25')](handleEntityNotFound(_0x111cc0,null))[_0x91cb('0x25')](respondWithResult(_0x111cc0,null))[_0x91cb('0x44')](handleError(_0x111cc0,null));};exports['create']=function(_0x348d78,_0x46caf1){return db[_0x91cb('0x2d')][_0x91cb('0x48')](_0x348d78['body'],{})[_0x91cb('0x25')](respondWithResult(_0x46caf1,0xc9))[_0x91cb('0x44')](handleError(_0x46caf1,null));};exports['update']=function(_0x212473,_0x47cdb7){if(_0x212473[_0x91cb('0x49')]['id']){delete _0x212473['body']['id'];}return db['Cdr']['find']({'where':{'id':_0x212473[_0x91cb('0x4a')]['id']}})[_0x91cb('0x25')](handleEntityNotFound(_0x47cdb7,null))[_0x91cb('0x25')](saveUpdates(_0x212473[_0x91cb('0x49')],null))[_0x91cb('0x25')](respondWithResult(_0x47cdb7,null))['catch'](handleError(_0x47cdb7,null));};exports['destroy']=function(_0x1d26b8,_0xfe6692){return db[_0x91cb('0x2d')][_0x91cb('0x47')]({'where':{'id':_0x1d26b8['params']['id']}})['then'](handleEntityNotFound(_0xfe6692,null))['then'](removeEntity(_0xfe6692,null))[_0x91cb('0x44')](handleError(_0xfe6692,null));};exports['describe']=function(_0x3f22a1,_0x4aa670){return db[_0x91cb('0x2d')][_0x91cb('0x4b')]()[_0x91cb('0x25')](respondWithResult(_0x4aa670,null))[_0x91cb('0x44')](handleError(_0x4aa670,null));}; \ No newline at end of file +var _0xa9b1=['where','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','Cdr','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter'];(function(_0x2ba1b2,_0x1d4370){var _0x23345e=function(_0x397142){while(--_0x397142){_0x2ba1b2['push'](_0x2ba1b2['shift']());}};_0x23345e(++_0x1d4370);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1a9b('0x0'));var jsonpatch=require(_0x1a9b('0x1'));var rp=require(_0x1a9b('0x2'));var moment=require(_0x1a9b('0x3'));var BPromise=require(_0x1a9b('0x4'));var Mustache=require(_0x1a9b('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1a9b('0x6'));var ejs=require(_0x1a9b('0x7'));var fs=require('fs');var fs_extra=require(_0x1a9b('0x8'));var _=require(_0x1a9b('0x9'));var squel=require(_0x1a9b('0xa'));var crypto=require(_0x1a9b('0xb'));var jsforce=require(_0x1a9b('0xc'));var deskjs=require(_0x1a9b('0xd'));var toCsv=require(_0x1a9b('0x6'));var querystring=require(_0x1a9b('0xe'));var Papa=require(_0x1a9b('0xf'));var Redis=require(_0x1a9b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1a9b('0x11'));var hardwareService=require(_0x1a9b('0x12'));var logger=require(_0x1a9b('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1a9b('0x14'));var db=require(_0x1a9b('0x15'))['db'];function respondWithStatusCode(_0x2c75cf,_0x11bf7e){_0x11bf7e=_0x11bf7e||0xcc;return function(_0x2c3170){if(_0x2c3170){return _0x2c75cf[_0x1a9b('0x16')](_0x11bf7e);}return _0x2c75cf['status'](_0x11bf7e)[_0x1a9b('0x17')]();};}function respondWithResult(_0x34f082,_0x245883){_0x245883=_0x245883||0xc8;return function(_0x53c725){if(_0x53c725){return _0x34f082[_0x1a9b('0x18')](_0x245883)[_0x1a9b('0x19')](_0x53c725);}};}function respondWithFilteredResult(_0x55a00d,_0x2a7d72){return function(_0x57ca87){if(_0x57ca87){var _0x439acd=typeof _0x2a7d72[_0x1a9b('0x1a')]===_0x1a9b('0x1b')&&typeof _0x2a7d72[_0x1a9b('0x1c')]===_0x1a9b('0x1b');var _0x20b8dc=_0x57ca87[_0x1a9b('0x1d')];var _0x205a0d=_0x439acd?0x0:_0x2a7d72[_0x1a9b('0x1a')];var _0x1281c2=_0x439acd?_0x57ca87['count']:_0x2a7d72[_0x1a9b('0x1a')]+_0x2a7d72[_0x1a9b('0x1c')];var _0x3df7d2;if(_0x1281c2>=_0x20b8dc){_0x1281c2=_0x20b8dc;_0x3df7d2=0xc8;}else{_0x3df7d2=0xce;}_0x55a00d[_0x1a9b('0x18')](_0x3df7d2);return _0x55a00d['set'](_0x1a9b('0x1e'),_0x205a0d+'-'+_0x1281c2+'/'+_0x20b8dc)[_0x1a9b('0x19')](_0x57ca87);}return null;};}function patchUpdates(_0x4b3cd3){return function(_0x23e327){try{jsonpatch[_0x1a9b('0x1f')](_0x23e327,_0x4b3cd3,!![]);}catch(_0x44cebf){return BPromise[_0x1a9b('0x20')](_0x44cebf);}return _0x23e327[_0x1a9b('0x21')]();};}function saveUpdates(_0x590568,_0x189e78){return function(_0x17b1dd){if(_0x17b1dd){return _0x17b1dd[_0x1a9b('0x22')](_0x590568)[_0x1a9b('0x23')](function(_0x36391a){return _0x36391a;});}return null;};}function removeEntity(_0x2e42f1,_0x28f937){return function(_0x488a33){if(_0x488a33){return _0x488a33[_0x1a9b('0x24')]()['then'](function(){_0x2e42f1[_0x1a9b('0x18')](0xcc)[_0x1a9b('0x17')]();});}};}function handleEntityNotFound(_0xad6541,_0x4e7234){return function(_0x213841){if(!_0x213841){_0xad6541[_0x1a9b('0x16')](0x194);}return _0x213841;};}function handleError(_0x1521f4,_0x181331){_0x181331=_0x181331||0x1f4;return function(_0x18c9dd){logger[_0x1a9b('0x25')](_0x18c9dd['stack']);if(_0x18c9dd[_0x1a9b('0x26')]){delete _0x18c9dd[_0x1a9b('0x26')];}_0x1521f4['status'](_0x181331)[_0x1a9b('0x27')](_0x18c9dd);};}exports[_0x1a9b('0x28')]=function(_0x5d70dc,_0x5d7e8c){var _0x3f8e98={},_0x1d981e={},_0x5362b8={'count':0x0,'rows':[]};var _0x30278b=_[_0x1a9b('0x29')](db[_0x1a9b('0x2a')][_0x1a9b('0x2b')],function(_0x1a5085){return{'name':_0x1a5085[_0x1a9b('0x2c')],'type':_0x1a5085[_0x1a9b('0x2d')]['key']};});_0x1d981e[_0x1a9b('0x2e')]=_[_0x1a9b('0x29')](_0x30278b,_0x1a9b('0x26'));_0x1d981e[_0x1a9b('0x2f')]=_[_0x1a9b('0x30')](_0x5d70dc[_0x1a9b('0x2f')]);_0x1d981e[_0x1a9b('0x31')]=_[_0x1a9b('0x32')](_0x1d981e[_0x1a9b('0x2e')],_0x1d981e[_0x1a9b('0x2f')]);_0x3f8e98[_0x1a9b('0x33')]=_['intersection'](_0x1d981e['model'],qs[_0x1a9b('0x34')](_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x34')]));_0x3f8e98['attributes']=_0x3f8e98[_0x1a9b('0x33')]['length']?_0x3f8e98[_0x1a9b('0x33')]:_0x1d981e['model'];if(!_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x35')]('nolimit')){_0x3f8e98[_0x1a9b('0x1c')]=qs['limit'](_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x1c')]);_0x3f8e98[_0x1a9b('0x1a')]=qs[_0x1a9b('0x1a')](_0x5d70dc['query'][_0x1a9b('0x1a')]);}_0x3f8e98[_0x1a9b('0x36')]=qs[_0x1a9b('0x37')](_0x5d70dc['query'][_0x1a9b('0x37')]);_0x3f8e98['where']=qs['filters'](_[_0x1a9b('0x38')](_0x5d70dc[_0x1a9b('0x2f')],_0x1d981e[_0x1a9b('0x31')]),_0x30278b);if(_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x39')]){_0x3f8e98[_0x1a9b('0x3a')]=_[_0x1a9b('0x3b')](_0x3f8e98['where'],{'$or':_[_0x1a9b('0x29')](_0x30278b,function(_0x230fc6){if(_0x230fc6[_0x1a9b('0x2d')]!=='VIRTUAL'){var _0x466827={};_0x466827[_0x230fc6[_0x1a9b('0x26')]]={'$like':'%'+_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x39')]+'%'};return _0x466827;}})});}_0x3f8e98=_['merge']({},_0x3f8e98,_0x5d70dc['options']);var _0x10e80f={'where':_0x3f8e98[_0x1a9b('0x3a')]};return db[_0x1a9b('0x2a')]['count'](_0x10e80f)['then'](function(_0x2b9bcf){_0x5362b8[_0x1a9b('0x1d')]=_0x2b9bcf;if(_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x3c')]){_0x3f8e98[_0x1a9b('0x3d')]=[{'all':!![]}];}return db[_0x1a9b('0x2a')][_0x1a9b('0x3e')](_0x3f8e98);})['then'](function(_0x313921){_0x5362b8[_0x1a9b('0x3f')]=_0x313921;return _0x5362b8;})[_0x1a9b('0x23')](respondWithFilteredResult(_0x5d7e8c,_0x3f8e98))[_0x1a9b('0x40')](handleError(_0x5d7e8c,null));};exports[_0x1a9b('0x41')]=function(_0x1decb8,_0xb4cbf4){var _0x398db3={'raw':!![],'where':{'id':_0x1decb8[_0x1a9b('0x42')]['id']}},_0x35f6d8={};_0x35f6d8[_0x1a9b('0x2e')]=_[_0x1a9b('0x30')](db[_0x1a9b('0x2a')][_0x1a9b('0x2b')]);_0x35f6d8[_0x1a9b('0x2f')]=_[_0x1a9b('0x30')](_0x1decb8['query']);_0x35f6d8[_0x1a9b('0x31')]=_[_0x1a9b('0x32')](_0x35f6d8['model'],_0x35f6d8[_0x1a9b('0x2f')]);_0x398db3['attributes']=_['intersection'](_0x35f6d8[_0x1a9b('0x2e')],qs[_0x1a9b('0x34')](_0x1decb8[_0x1a9b('0x2f')][_0x1a9b('0x34')]));_0x398db3[_0x1a9b('0x33')]=_0x398db3[_0x1a9b('0x33')][_0x1a9b('0x43')]?_0x398db3['attributes']:_0x35f6d8[_0x1a9b('0x2e')];if(_0x1decb8[_0x1a9b('0x2f')][_0x1a9b('0x3c')]){_0x398db3[_0x1a9b('0x3d')]=[{'all':!![]}];}_0x398db3=_['merge']({},_0x398db3,_0x1decb8[_0x1a9b('0x44')]);return db[_0x1a9b('0x2a')][_0x1a9b('0x45')](_0x398db3)[_0x1a9b('0x23')](handleEntityNotFound(_0xb4cbf4,null))['then'](respondWithResult(_0xb4cbf4,null))[_0x1a9b('0x40')](handleError(_0xb4cbf4,null));};exports[_0x1a9b('0x46')]=function(_0x41e9fc,_0x1e93df){return db[_0x1a9b('0x2a')]['create'](_0x41e9fc['body'],{})[_0x1a9b('0x23')](respondWithResult(_0x1e93df,0xc9))[_0x1a9b('0x40')](handleError(_0x1e93df,null));};exports['update']=function(_0x52b06e,_0x252140){if(_0x52b06e[_0x1a9b('0x47')]['id']){delete _0x52b06e[_0x1a9b('0x47')]['id'];}return db['Cdr'][_0x1a9b('0x45')]({'where':{'id':_0x52b06e[_0x1a9b('0x42')]['id']}})[_0x1a9b('0x23')](handleEntityNotFound(_0x252140,null))[_0x1a9b('0x23')](saveUpdates(_0x52b06e[_0x1a9b('0x47')],null))[_0x1a9b('0x23')](respondWithResult(_0x252140,null))[_0x1a9b('0x40')](handleError(_0x252140,null));};exports['destroy']=function(_0x54b9ac,_0x5465d0){return db[_0x1a9b('0x2a')][_0x1a9b('0x45')]({'where':{'id':_0x54b9ac[_0x1a9b('0x42')]['id']}})[_0x1a9b('0x23')](handleEntityNotFound(_0x5465d0,null))[_0x1a9b('0x23')](removeEntity(_0x5465d0,null))['catch'](handleError(_0x5465d0,null));};exports[_0x1a9b('0x48')]=function(_0x222bba,_0x3b1fdf){return db[_0x1a9b('0x2a')][_0x1a9b('0x48')]()[_0x1a9b('0x23')](respondWithResult(_0x3b1fdf,null))[_0x1a9b('0x40')](handleError(_0x3b1fdf,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index b47e7cd..2d94f07 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(_0x3afd09,_0x496caa){var _0x5c6d35=function(_0x4682a2){while(--_0x4682a2){_0x3afd09['push'](_0x3afd09['shift']());}};_0x5c6d35(++_0x496caa);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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(_0x30d065,_0x538346){var _0x52bd72=function(_0x4a25b0){while(--_0x4a25b0){_0x30d065['push'](_0x30d065['shift']());}};_0x52bd72(++_0x538346);}(_0x7a54,0x106));var _0x47a5=function(_0x2efb08,_0x2f0164){_0x2efb08=_0x2efb08-0x0;var _0x5eae74=_0x7a54[_0x2efb08];return _0x5eae74;};'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 7f5a796..e32cc69 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 _0xf75f=['catch','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','Cdr,\x20%s,\x20%s','message','result'];(function(_0x24b80a,_0x3dcb82){var _0xdd92a4=function(_0x2e6ecf){while(--_0x2e6ecf){_0x24b80a['push'](_0x24b80a['shift']());}};_0xdd92a4(++_0x3dcb82);}(_0xf75f,0xe8));var _0xff75=function(_0x446436,_0x50191c){_0x446436=_0x446436-0x0;var _0x561f5d=_0xf75f[_0x446436];return _0x561f5d;};'use strict';var _=require('lodash');var util=require(_0xff75('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff75('0x1'));var db=require(_0xff75('0x2'))['db'];var utils=require(_0xff75('0x3'));var logger=require(_0xff75('0x4'))(_0xff75('0x5'));var config=require('../../config/environment');var jayson=require(_0xff75('0x6'));var client=jayson[_0xff75('0x7')][_0xff75('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x35ef31,_0x4b6e1d,_0x536f2b){return new BPromise(function(_0x22059c,_0x382406){return client[_0xff75('0x9')](_0x35ef31,_0x536f2b)[_0xff75('0xa')](function(_0x2bc89b){logger[_0xff75('0xb')]('Cdr,\x20%s,\x20%s',_0x4b6e1d,_0xff75('0xc'));logger[_0xff75('0xd')](_0xff75('0xe'),_0x4b6e1d,'request\x20sent',JSON['stringify'](_0x2bc89b));if(_0x2bc89b[_0xff75('0xf')]){if(_0x2bc89b[_0xff75('0xf')][_0xff75('0x10')]===0x1f4){logger[_0xff75('0xf')](_0xff75('0x11'),_0x4b6e1d,_0x2bc89b[_0xff75('0xf')][_0xff75('0x12')]);return _0x382406(_0x2bc89b['error'][_0xff75('0x12')]);}logger[_0xff75('0xf')](_0xff75('0x11'),_0x4b6e1d,_0x2bc89b['error'][_0xff75('0x12')]);return _0x22059c(_0x2bc89b[_0xff75('0xf')][_0xff75('0x12')]);}else{logger[_0xff75('0xb')](_0xff75('0x11'),_0x4b6e1d,_0xff75('0xc'));_0x22059c(_0x2bc89b[_0xff75('0x13')][_0xff75('0x12')]);}})[_0xff75('0x14')](function(_0x2d9324){logger[_0xff75('0xf')](_0xff75('0x11'),_0x4b6e1d,_0x2d9324);_0x382406(_0x2d9324);});});} \ No newline at end of file +var _0xa388=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa388,0x1d0));var _0x8a38=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa388[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8a38('0x0'));var util=require(_0x8a38('0x1'));var moment=require('moment');var BPromise=require(_0x8a38('0x2'));var rs=require(_0x8a38('0x3'));var fs=require('fs');var Redis=require(_0x8a38('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a38('0x5'));var logger=require(_0x8a38('0x6'))('rpc');var config=require(_0x8a38('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8a38('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x188f85,_0x1161bf,_0x3065d7){return new BPromise(function(_0xda76e7,_0x432a47){return client[_0x8a38('0x9')](_0x188f85,_0x3065d7)[_0x8a38('0xa')](function(_0x12f07f){logger[_0x8a38('0xb')](_0x8a38('0xc'),_0x1161bf,_0x8a38('0xd'));logger[_0x8a38('0xe')](_0x8a38('0xf'),_0x1161bf,_0x8a38('0xd'),JSON['stringify'](_0x12f07f));if(_0x12f07f[_0x8a38('0x10')]){if(_0x12f07f[_0x8a38('0x10')][_0x8a38('0x11')]===0x1f4){logger[_0x8a38('0x10')](_0x8a38('0xc'),_0x1161bf,_0x12f07f[_0x8a38('0x10')][_0x8a38('0x12')]);return _0x432a47(_0x12f07f[_0x8a38('0x10')][_0x8a38('0x12')]);}logger[_0x8a38('0x10')](_0x8a38('0xc'),_0x1161bf,_0x12f07f[_0x8a38('0x10')][_0x8a38('0x12')]);return _0xda76e7(_0x12f07f['error'][_0x8a38('0x12')]);}else{logger[_0x8a38('0xb')](_0x8a38('0xc'),_0x1161bf,_0x8a38('0xd'));_0xda76e7(_0x12f07f[_0x8a38('0x13')][_0x8a38('0x12')]);}})[_0x8a38('0x14')](function(_0x338444){logger[_0x8a38('0x10')](_0x8a38('0xc'),_0x1161bf,_0x338444);_0x432a47(_0x338444);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 25f8dbe..9311fde 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(_0x113a6c,_0x10df30){var _0x1ac632=function(_0xbd4fb9){while(--_0xbd4fb9){_0x113a6c['push'](_0x113a6c['shift']());}};_0x1ac632(++_0x10df30);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +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(_0x42e98c,_0x1c6bb9){var _0x59803e=function(_0x3a587e){while(--_0x3a587e){_0x42e98c['push'](_0x42e98c['shift']());}};_0x59803e(++_0x1c6bb9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 13e3816..fbeb1e0 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 _0xf862=['*,*,*,*','exports','INTEGER','STRING','TEXT'];(function(_0x286284,_0xcb32c1){var _0x49157c=function(_0x27d92d){while(--_0x27d92d){_0x286284['push'](_0x286284['shift']());}};_0x49157c(++_0xcb32c1);}(_0xf862,0x119));var _0x2f86=function(_0x2a0738,_0x3c0bc5){_0x2a0738=_0x2a0738-0x0;var _0x159679=_0xf862[_0x2a0738];return _0x159679;};'use strict';var Sequelize=require('sequelize');module[_0x2f86('0x0')]={'priority':{'type':Sequelize[_0x2f86('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x2f86('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2f86('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2f86('0x2')],'defaultValue':_0x2f86('0x4')}}; \ No newline at end of file +var _0x76ca=['sequelize','exports','STRING','noop','TEXT'];(function(_0x2ade6f,_0x18d576){var _0x28fa0f=function(_0x4ad67c){while(--_0x4ad67c){_0x2ade6f['push'](_0x2ade6f['shift']());}};_0x28fa0f(++_0x18d576);}(_0x76ca,0xcd));var _0xa76c=function(_0x3c9be5,_0x3b5e36){_0x3c9be5=_0x3c9be5-0x0;var _0x467cca=_0x76ca[_0x3c9be5];return _0x467cca;};'use strict';var Sequelize=require(_0xa76c('0x0'));module[_0xa76c('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa76c('0x2')],'allowNull':![],'defaultValue':_0xa76c('0x3')},'appdata':{'type':Sequelize[_0xa76c('0x4')]()},'description':{'type':Sequelize[_0xa76c('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 2f222ae..fbc320e 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 _0x97f5=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','stack','name','send','show','model','keys','ChatApplication','rawAttributes','query','attributes','intersection','fields','length','include','merge','options','then','catch','update','body','find','params','destroy','eml-format','rimraf','zip-dir','moment'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x97f5,0x72));var _0x597f=function(_0x111113,_0x1d2adb){_0x111113=_0x111113-0x0;var _0x4bc336=_0x97f5[_0x111113];return _0x4bc336;};'use strict';var emlformat=require(_0x597f('0x0'));var rimraf=require(_0x597f('0x1'));var zipdir=require(_0x597f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x597f('0x3'));var BPromise=require(_0x597f('0x4'));var Mustache=require(_0x597f('0x5'));var util=require(_0x597f('0x6'));var path=require(_0x597f('0x7'));var sox=require(_0x597f('0x8'));var csv=require(_0x597f('0x9'));var ejs=require(_0x597f('0xa'));var fs=require('fs');var fs_extra=require(_0x597f('0xb'));var _=require('lodash');var squel=require(_0x597f('0xc'));var crypto=require(_0x597f('0xd'));var jsforce=require(_0x597f('0xe'));var deskjs=require(_0x597f('0xf'));var toCsv=require(_0x597f('0x9'));var querystring=require(_0x597f('0x10'));var Papa=require('papaparse');var Redis=require(_0x597f('0x11'));var authService=require(_0x597f('0x12'));var qs=require(_0x597f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x597f('0x14'))('api');var utils=require(_0x597f('0x15'));var config=require(_0x597f('0x16'));var licenseUtil=require(_0x597f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10ef8d,_0xaf24ec){_0xaf24ec=_0xaf24ec||0xcc;return function(_0x64c12c){if(_0x64c12c){return _0x10ef8d[_0x597f('0x18')](_0xaf24ec);}return _0x10ef8d[_0x597f('0x19')](_0xaf24ec)[_0x597f('0x1a')]();};}function respondWithResult(_0x357efa,_0x22adab){_0x22adab=_0x22adab||0xc8;return function(_0x11ef60){if(_0x11ef60){return _0x357efa[_0x597f('0x19')](_0x22adab)[_0x597f('0x1b')](_0x11ef60);}};}function respondWithFilteredResult(_0xe0f331,_0xf1eed0){return function(_0x5b6349){if(_0x5b6349){var _0x44d2f2=typeof _0xf1eed0[_0x597f('0x1c')]===_0x597f('0x1d')&&typeof _0xf1eed0['limit']===_0x597f('0x1d');var _0x5d64f9=_0x5b6349['count'];var _0x507552=_0x44d2f2?0x0:_0xf1eed0['offset'];var _0x49f12b=_0x44d2f2?_0x5b6349['count']:_0xf1eed0[_0x597f('0x1c')]+_0xf1eed0[_0x597f('0x1e')];var _0x5a39bf;if(_0x49f12b>=_0x5d64f9){_0x49f12b=_0x5d64f9;_0x5a39bf=0xc8;}else{_0x5a39bf=0xce;}_0xe0f331[_0x597f('0x19')](_0x5a39bf);return _0xe0f331[_0x597f('0x1f')](_0x597f('0x20'),_0x507552+'-'+_0x49f12b+'/'+_0x5d64f9)[_0x597f('0x1b')](_0x5b6349);}return null;};}function patchUpdates(_0x53b85e){return function(_0x48fffd){try{jsonpatch[_0x597f('0x21')](_0x48fffd,_0x53b85e,!![]);}catch(_0x244ca5){return BPromise[_0x597f('0x22')](_0x244ca5);}return _0x48fffd[_0x597f('0x23')]();};}function saveUpdates(_0x599bed,_0x4c13ab){return function(_0x376b5f){if(_0x376b5f){return _0x376b5f['update'](_0x599bed)['then'](function(_0x4502fb){return _0x4502fb;});}return null;};}function removeEntity(_0x22f4fd,_0x20776d){return function(_0x4c44a7){if(_0x4c44a7){return _0x4c44a7['destroy']()['then'](function(){_0x22f4fd[_0x597f('0x19')](0xcc)[_0x597f('0x1a')]();});}};}function handleEntityNotFound(_0x4afc3a,_0x1edab6){return function(_0x7bf4fe){if(!_0x7bf4fe){_0x4afc3a[_0x597f('0x18')](0x194);}return _0x7bf4fe;};}function handleError(_0x55d7ec,_0x519abc){_0x519abc=_0x519abc||0x1f4;return function(_0xa48f45){logger['error'](_0xa48f45[_0x597f('0x24')]);if(_0xa48f45[_0x597f('0x25')]){delete _0xa48f45[_0x597f('0x25')];}_0x55d7ec[_0x597f('0x19')](_0x519abc)[_0x597f('0x26')](_0xa48f45);};}exports[_0x597f('0x27')]=function(_0x1c5300,_0x5b4832){var _0x5cfe3a={'raw':!![],'where':{'id':_0x1c5300['params']['id']}},_0xea7872={};_0xea7872[_0x597f('0x28')]=_[_0x597f('0x29')](db[_0x597f('0x2a')][_0x597f('0x2b')]);_0xea7872[_0x597f('0x2c')]=_[_0x597f('0x29')](_0x1c5300[_0x597f('0x2c')]);_0xea7872['filters']=_['intersection'](_0xea7872[_0x597f('0x28')],_0xea7872['query']);_0x5cfe3a[_0x597f('0x2d')]=_[_0x597f('0x2e')](_0xea7872[_0x597f('0x28')],qs[_0x597f('0x2f')](_0x1c5300['query'][_0x597f('0x2f')]));_0x5cfe3a[_0x597f('0x2d')]=_0x5cfe3a['attributes'][_0x597f('0x30')]?_0x5cfe3a[_0x597f('0x2d')]:_0xea7872[_0x597f('0x28')];if(_0x1c5300['query']['includeAll']){_0x5cfe3a[_0x597f('0x31')]=[{'all':!![]}];}_0x5cfe3a=_[_0x597f('0x32')]({},_0x5cfe3a,_0x1c5300[_0x597f('0x33')]);return db['ChatApplication']['find'](_0x5cfe3a)[_0x597f('0x34')](handleEntityNotFound(_0x5b4832,null))[_0x597f('0x34')](respondWithResult(_0x5b4832,null))[_0x597f('0x35')](handleError(_0x5b4832,null));};exports[_0x597f('0x36')]=function(_0x16e007,_0x56e8fc){if(_0x16e007[_0x597f('0x37')]['id']){delete _0x16e007[_0x597f('0x37')]['id'];}return db[_0x597f('0x2a')][_0x597f('0x38')]({'where':{'id':_0x16e007[_0x597f('0x39')]['id']}})[_0x597f('0x34')](handleEntityNotFound(_0x56e8fc,null))[_0x597f('0x34')](saveUpdates(_0x16e007['body'],null))[_0x597f('0x34')](respondWithResult(_0x56e8fc,null))['catch'](handleError(_0x56e8fc,null));};exports[_0x597f('0x3a')]=function(_0x4239cf,_0x3e3505){return db['ChatApplication'][_0x597f('0x38')]({'where':{'id':_0x4239cf['params']['id']}})[_0x597f('0x34')](handleEntityNotFound(_0x3e3505,null))[_0x597f('0x34')](removeEntity(_0x3e3505,null))[_0x597f('0x35')](handleError(_0x3e3505,null));}; \ No newline at end of file +var _0xe3ed=['Content-Range','apply','reject','save','then','destroy','error','stack','name','params','model','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','ChatApplication','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','set'];(function(_0x2b98cc,_0x512e0e){var _0x97b31f=function(_0x1af0d2){while(--_0x1af0d2){_0x2b98cc['push'](_0x2b98cc['shift']());}};_0x97b31f(++_0x512e0e);}(_0xe3ed,0x8d));var _0xde3e=function(_0x20eeb5,_0x5dbaaa){_0x20eeb5=_0x20eeb5-0x0;var _0x1e3e86=_0xe3ed[_0x20eeb5];return _0x1e3e86;};'use strict';var emlformat=require(_0xde3e('0x0'));var rimraf=require(_0xde3e('0x1'));var zipdir=require(_0xde3e('0x2'));var jsonpatch=require(_0xde3e('0x3'));var rp=require(_0xde3e('0x4'));var moment=require(_0xde3e('0x5'));var BPromise=require(_0xde3e('0x6'));var Mustache=require(_0xde3e('0x7'));var util=require('util');var path=require(_0xde3e('0x8'));var sox=require(_0xde3e('0x9'));var csv=require('to-csv');var ejs=require(_0xde3e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xde3e('0xb'));var squel=require(_0xde3e('0xc'));var crypto=require('crypto');var jsforce=require(_0xde3e('0xd'));var deskjs=require(_0xde3e('0xe'));var toCsv=require(_0xde3e('0xf'));var querystring=require(_0xde3e('0x10'));var Papa=require(_0xde3e('0x11'));var Redis=require('ioredis');var authService=require(_0xde3e('0x12'));var qs=require(_0xde3e('0x13'));var as=require(_0xde3e('0x14'));var hardwareService=require(_0xde3e('0x15'));var logger=require('../../config/logger')(_0xde3e('0x16'));var utils=require(_0xde3e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xde3e('0x18'));var db=require(_0xde3e('0x19'))['db'];function respondWithStatusCode(_0x5d0240,_0x22ffc2){_0x22ffc2=_0x22ffc2||0xcc;return function(_0x4e0f23){if(_0x4e0f23){return _0x5d0240[_0xde3e('0x1a')](_0x22ffc2);}return _0x5d0240[_0xde3e('0x1b')](_0x22ffc2)[_0xde3e('0x1c')]();};}function respondWithResult(_0x4fe882,_0x167fa7){_0x167fa7=_0x167fa7||0xc8;return function(_0x1fee7b){if(_0x1fee7b){return _0x4fe882['status'](_0x167fa7)['json'](_0x1fee7b);}};}function respondWithFilteredResult(_0x120077,_0x11db96){return function(_0x6543f7){if(_0x6543f7){var _0x552fc4=typeof _0x11db96['offset']===_0xde3e('0x1d')&&typeof _0x11db96['limit']==='undefined';var _0xc3ee05=_0x6543f7[_0xde3e('0x1e')];var _0x4aa02c=_0x552fc4?0x0:_0x11db96[_0xde3e('0x1f')];var _0x276e83=_0x552fc4?_0x6543f7[_0xde3e('0x1e')]:_0x11db96['offset']+_0x11db96['limit'];var _0x4fa0d2;if(_0x276e83>=_0xc3ee05){_0x276e83=_0xc3ee05;_0x4fa0d2=0xc8;}else{_0x4fa0d2=0xce;}_0x120077[_0xde3e('0x1b')](_0x4fa0d2);return _0x120077[_0xde3e('0x20')](_0xde3e('0x21'),_0x4aa02c+'-'+_0x276e83+'/'+_0xc3ee05)['json'](_0x6543f7);}return null;};}function patchUpdates(_0x2ceb3e){return function(_0x11dd22){try{jsonpatch[_0xde3e('0x22')](_0x11dd22,_0x2ceb3e,!![]);}catch(_0x8c8ace){return BPromise[_0xde3e('0x23')](_0x8c8ace);}return _0x11dd22[_0xde3e('0x24')]();};}function saveUpdates(_0x26c5ca,_0x1eda88){return function(_0x443e8d){if(_0x443e8d){return _0x443e8d['update'](_0x26c5ca)[_0xde3e('0x25')](function(_0x334093){return _0x334093;});}return null;};}function removeEntity(_0x37615f,_0x57df9e){return function(_0x361511){if(_0x361511){return _0x361511[_0xde3e('0x26')]()[_0xde3e('0x25')](function(){_0x37615f['status'](0xcc)[_0xde3e('0x1c')]();});}};}function handleEntityNotFound(_0x78647,_0x1d9432){return function(_0xd795ac){if(!_0xd795ac){_0x78647[_0xde3e('0x1a')](0x194);}return _0xd795ac;};}function handleError(_0x5ec4b6,_0x5313cb){_0x5313cb=_0x5313cb||0x1f4;return function(_0x6c0db0){logger[_0xde3e('0x27')](_0x6c0db0[_0xde3e('0x28')]);if(_0x6c0db0['name']){delete _0x6c0db0[_0xde3e('0x29')];}_0x5ec4b6[_0xde3e('0x1b')](_0x5313cb)['send'](_0x6c0db0);};}exports['show']=function(_0x245fbc,_0x3c83c8){var _0x582c8d={'raw':!![],'where':{'id':_0x245fbc[_0xde3e('0x2a')]['id']}},_0x2e4c62={};_0x2e4c62[_0xde3e('0x2b')]=_['keys'](db['ChatApplication'][_0xde3e('0x2c')]);_0x2e4c62['query']=_['keys'](_0x245fbc[_0xde3e('0x2d')]);_0x2e4c62[_0xde3e('0x2e')]=_[_0xde3e('0x2f')](_0x2e4c62[_0xde3e('0x2b')],_0x2e4c62[_0xde3e('0x2d')]);_0x582c8d[_0xde3e('0x30')]=_[_0xde3e('0x2f')](_0x2e4c62[_0xde3e('0x2b')],qs[_0xde3e('0x31')](_0x245fbc[_0xde3e('0x2d')][_0xde3e('0x31')]));_0x582c8d[_0xde3e('0x30')]=_0x582c8d[_0xde3e('0x30')][_0xde3e('0x32')]?_0x582c8d[_0xde3e('0x30')]:_0x2e4c62[_0xde3e('0x2b')];if(_0x245fbc[_0xde3e('0x2d')]['includeAll']){_0x582c8d[_0xde3e('0x33')]=[{'all':!![]}];}_0x582c8d=_[_0xde3e('0x34')]({},_0x582c8d,_0x245fbc[_0xde3e('0x35')]);return db[_0xde3e('0x36')][_0xde3e('0x37')](_0x582c8d)[_0xde3e('0x25')](handleEntityNotFound(_0x3c83c8,null))[_0xde3e('0x25')](respondWithResult(_0x3c83c8,null))[_0xde3e('0x38')](handleError(_0x3c83c8,null));};exports['update']=function(_0x50f1e3,_0x47793d){if(_0x50f1e3['body']['id']){delete _0x50f1e3['body']['id'];}return db[_0xde3e('0x36')][_0xde3e('0x37')]({'where':{'id':_0x50f1e3[_0xde3e('0x2a')]['id']}})[_0xde3e('0x25')](handleEntityNotFound(_0x47793d,null))[_0xde3e('0x25')](saveUpdates(_0x50f1e3[_0xde3e('0x39')],null))['then'](respondWithResult(_0x47793d,null))['catch'](handleError(_0x47793d,null));};exports[_0xde3e('0x26')]=function(_0x24adee,_0x1ade0c){return db[_0xde3e('0x36')][_0xde3e('0x37')]({'where':{'id':_0x24adee[_0xde3e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1ade0c,null))[_0xde3e('0x25')](removeEntity(_0x1ade0c,null))['catch'](handleError(_0x1ade0c,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index dfb0bbe..c2bc56c 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 _0xb549=['ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define'];(function(_0xe3ad4b,_0x25f674){var _0x2bef69=function(_0x3e2098){while(--_0x3e2098){_0xe3ad4b['push'](_0xe3ad4b['shift']());}};_0x2bef69(++_0x25f674);}(_0xb549,0x164));var _0x9b54=function(_0xd8271d,_0x53cc5d){_0xd8271d=_0xd8271d-0x0;var _0x567a5c=_0xb549[_0xd8271d];return _0x567a5c;};'use strict';var _=require(_0x9b54('0x0'));var util=require(_0x9b54('0x1'));var logger=require(_0x9b54('0x2'))(_0x9b54('0x3'));var moment=require(_0x9b54('0x4'));var BPromise=require(_0x9b54('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b54('0x6'));var rimraf=require(_0x9b54('0x7'));var config=require(_0x9b54('0x8'));var attributes=require(_0x9b54('0x9'));module[_0x9b54('0xa')]=function(_0x1d6777,_0x7ba1e2){return _0x1d6777[_0x9b54('0xb')](_0x9b54('0xc'),attributes,{'tableName':_0x9b54('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9b54('0xe'),'collate':_0x9b54('0xf')});}; \ No newline at end of file +var _0xb38e=['api','bluebird','request-promise','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4_unicode_ci','util'];(function(_0x24a46c,_0x2f195d){var _0x1c7990=function(_0x1723ef){while(--_0x1723ef){_0x24a46c['push'](_0x24a46c['shift']());}};_0x1c7990(++_0x2f195d);}(_0xb38e,0x1d8));var _0xeb38=function(_0x3343c8,_0x39eaa9){_0x3343c8=_0x3343c8-0x0;var _0x2374db=_0xb38e[_0x3343c8];return _0x2374db;};'use strict';var _=require('lodash');var util=require(_0xeb38('0x0'));var logger=require('../../config/logger')(_0xeb38('0x1'));var moment=require('moment');var BPromise=require(_0xeb38('0x2'));var rp=require(_0xeb38('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb38('0x4'));var config=require(_0xeb38('0x5'));var attributes=require(_0xeb38('0x6'));module[_0xeb38('0x7')]=function(_0x5238d1,_0x40f090){return _0x5238d1[_0xeb38('0x8')](_0xeb38('0x9'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xeb38('0xa')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index b1f88fe..333c65b 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 _0xf695=['result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','http','request','then','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','info'];(function(_0x37c07d,_0xdbdb5f){var _0x10dadc=function(_0x2bafb7){while(--_0x2bafb7){_0x37c07d['push'](_0x37c07d['shift']());}};_0x10dadc(++_0xdbdb5f);}(_0xf695,0x11f));var _0x5f69=function(_0x3839cb,_0x2427c0){_0x3839cb=_0x3839cb-0x0;var _0xf00f29=_0xf695[_0x3839cb];return _0xf00f29;};'use strict';var _=require(_0x5f69('0x0'));var util=require(_0x5f69('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5f69('0x2'));var fs=require('fs');var Redis=require(_0x5f69('0x3'));var db=require(_0x5f69('0x4'))['db'];var utils=require(_0x5f69('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5f69('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x316959,_0x44b4ca,_0x13d17b){return new BPromise(function(_0x3fc69b,_0x2b9557){return client[_0x5f69('0x7')](_0x316959,_0x13d17b)[_0x5f69('0x8')](function(_0x109eda){logger['info']('ChatApplication,\x20%s,\x20%s',_0x44b4ca,'request\x20sent');logger['debug'](_0x5f69('0x9'),_0x44b4ca,_0x5f69('0xa'),JSON[_0x5f69('0xb')](_0x109eda));if(_0x109eda['error']){if(_0x109eda[_0x5f69('0xc')][_0x5f69('0xd')]===0x1f4){logger['error'](_0x5f69('0xe'),_0x44b4ca,_0x109eda[_0x5f69('0xc')]['message']);return _0x2b9557(_0x109eda[_0x5f69('0xc')][_0x5f69('0xf')]);}logger[_0x5f69('0xc')](_0x5f69('0xe'),_0x44b4ca,_0x109eda[_0x5f69('0xc')][_0x5f69('0xf')]);return _0x3fc69b(_0x109eda[_0x5f69('0xc')][_0x5f69('0xf')]);}else{logger[_0x5f69('0x10')](_0x5f69('0xe'),_0x44b4ca,'request\x20sent');_0x3fc69b(_0x109eda[_0x5f69('0x11')][_0x5f69('0xf')]);}})[_0x5f69('0x12')](function(_0x13e0bc){logger['error'](_0x5f69('0xe'),_0x44b4ca,_0x13e0bc);_0x2b9557(_0x13e0bc);});});} \ No newline at end of file +var _0x8e34=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x7874e7,_0x2c4b42){var _0x29db49=function(_0x493b72){while(--_0x493b72){_0x7874e7['push'](_0x7874e7['shift']());}};_0x29db49(++_0x2c4b42);}(_0x8e34,0x73));var _0x48e3=function(_0x12322a,_0x5f99ae){_0x12322a=_0x12322a-0x0;var _0x25bc57=_0x8e34[_0x12322a];return _0x25bc57;};'use strict';var _=require(_0x48e3('0x0'));var util=require(_0x48e3('0x1'));var moment=require(_0x48e3('0x2'));var BPromise=require(_0x48e3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x48e3('0x4'));var db=require(_0x48e3('0x5'))['db'];var utils=require(_0x48e3('0x6'));var logger=require(_0x48e3('0x7'))(_0x48e3('0x8'));var config=require(_0x48e3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x48e3('0xa')][_0x48e3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe78a,_0x152a16,_0x5cd6af){return new BPromise(function(_0x149111,_0x49f7e5){return client[_0x48e3('0xc')](_0xe78a,_0x5cd6af)['then'](function(_0x598a24){logger[_0x48e3('0xd')](_0x48e3('0xe'),_0x152a16,_0x48e3('0xf'));logger[_0x48e3('0x10')](_0x48e3('0x11'),_0x152a16,_0x48e3('0xf'),JSON[_0x48e3('0x12')](_0x598a24));if(_0x598a24[_0x48e3('0x13')]){if(_0x598a24['error']['code']===0x1f4){logger[_0x48e3('0x13')](_0x48e3('0xe'),_0x152a16,_0x598a24[_0x48e3('0x13')][_0x48e3('0x14')]);return _0x49f7e5(_0x598a24[_0x48e3('0x13')][_0x48e3('0x14')]);}logger[_0x48e3('0x13')](_0x48e3('0xe'),_0x152a16,_0x598a24[_0x48e3('0x13')]['message']);return _0x149111(_0x598a24[_0x48e3('0x13')][_0x48e3('0x14')]);}else{logger[_0x48e3('0xd')]('ChatApplication,\x20%s,\x20%s',_0x152a16,_0x48e3('0xf'));_0x149111(_0x598a24[_0x48e3('0x15')][_0x48e3('0x14')]);}})[_0x48e3('0x16')](function(_0x5a8dc5){logger[_0x48e3('0x13')](_0x48e3('0xe'),_0x152a16,_0x5a8dc5);_0x49f7e5(_0x5a8dc5);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 1948c91..c649af2 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 _0x77d0=['get','/:id','isAuthenticated','update','delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./chatApplication.controller'];(function(_0xb5747,_0x375e70){var _0x458e06=function(_0x23d6d5){while(--_0x23d6d5){_0xb5747['push'](_0xb5747['shift']());}};_0x458e06(++_0x375e70);}(_0x77d0,0xe7));var _0x077d=function(_0x3594a8,_0x2b534f){_0x3594a8=_0x3594a8-0x0;var _0x31f181=_0x77d0[_0x3594a8];return _0x31f181;};'use strict';var multer=require(_0x077d('0x0'));var util=require('util');var path=require(_0x077d('0x1'));var timeout=require('connect-timeout');var express=require(_0x077d('0x2'));var router=express[_0x077d('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x077d('0x4'));var config=require(_0x077d('0x5'));var controller=require(_0x077d('0x6'));router[_0x077d('0x7')](_0x077d('0x8'),auth[_0x077d('0x9')](),controller['show']);router['put'](_0x077d('0x8'),auth[_0x077d('0x9')](),controller[_0x077d('0xa')]);router[_0x077d('0xb')](_0x077d('0x8'),auth[_0x077d('0x9')](),controller[_0x077d('0xc')]);module[_0x077d('0xd')]=router; \ No newline at end of file +var _0x96f4=['./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1c72b8,_0x104b7e){var _0x191114=function(_0x5d76da){while(--_0x5d76da){_0x1c72b8['push'](_0x1c72b8['shift']());}};_0x191114(++_0x104b7e);}(_0x96f4,0x15e));var _0x496f=function(_0x57cc22,_0x2d351f){_0x57cc22=_0x57cc22-0x0;var _0x6f7bdc=_0x96f4[_0x57cc22];return _0x6f7bdc;};'use strict';var multer=require('multer');var util=require(_0x496f('0x0'));var path=require(_0x496f('0x1'));var timeout=require(_0x496f('0x2'));var express=require('express');var router=express[_0x496f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x496f('0x4'));var interaction=require(_0x496f('0x5'));var config=require(_0x496f('0x6'));var controller=require(_0x496f('0x7'));router[_0x496f('0x8')](_0x496f('0x9'),auth[_0x496f('0xa')](),controller[_0x496f('0xb')]);router[_0x496f('0xc')](_0x496f('0x9'),auth[_0x496f('0xa')](),controller[_0x496f('0xd')]);router[_0x496f('0xe')]('/:id',auth[_0x496f('0xa')](),controller[_0x496f('0xf')]);module[_0x496f('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 8e57fca..bf58860 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 _0x9916=['sequelize','exports','STRING','BOOLEAN'];(function(_0xe72a37,_0x5a9528){var _0x5b1b72=function(_0x1a82eb){while(--_0x1a82eb){_0xe72a37['push'](_0xe72a37['shift']());}};_0x5b1b72(++_0x5a9528);}(_0x9916,0x15c));var _0x6991=function(_0x1c8b43,_0x5109ac){_0x1c8b43=_0x1c8b43-0x0;var _0x4555a8=_0x9916[_0x1c8b43];return _0x4555a8;};'use strict';var Sequelize=require(_0x6991('0x0'));module[_0x6991('0x1')]={'name':{'type':Sequelize[_0x6991('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6991('0x2')]},'write':{'type':Sequelize[_0x6991('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf494=['STRING','BOOLEAN','sequelize','exports'];(function(_0x8d9185,_0xbc4093){var _0x40c6f5=function(_0x6519a8){while(--_0x6519a8){_0x8d9185['push'](_0x8d9185['shift']());}};_0x40c6f5(++_0xbc4093);}(_0xf494,0x1c6));var _0x4f49=function(_0x54dc07,_0x1c0445){_0x54dc07=_0x54dc07-0x0;var _0x3bbd21=_0xf494[_0x54dc07];return _0x3bbd21;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'name':{'type':Sequelize[_0x4f49('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x4f49('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 71fae57..ae061f3 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 _0x94e1=['removeMembers','addMessage','ChatInternalMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','apply','destroy','then','end','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','sort','where','filters','pick','filter','merge','options','ChatGroup','includeAll','include','rows','catch','params','length','find','create','body','update','describe','getUnread','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','nolimit'];(function(_0x18b1b4,_0x32a0e7){var _0x36ad2c=function(_0x337f71){while(--_0x337f71){_0x18b1b4['push'](_0x18b1b4['shift']());}};_0x36ad2c(++_0x32a0e7);}(_0x94e1,0x67));var _0x194e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x94e1[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x194e('0x0'));var jsonpatch=require(_0x194e('0x1'));var rp=require(_0x194e('0x2'));var moment=require(_0x194e('0x3'));var BPromise=require(_0x194e('0x4'));var Mustache=require(_0x194e('0x5'));var util=require(_0x194e('0x6'));var path=require(_0x194e('0x7'));var sox=require(_0x194e('0x8'));var csv=require(_0x194e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x194e('0xa'));var _=require(_0x194e('0xb'));var squel=require(_0x194e('0xc'));var crypto=require(_0x194e('0xd'));var jsforce=require(_0x194e('0xe'));var deskjs=require(_0x194e('0xf'));var toCsv=require(_0x194e('0x9'));var querystring=require(_0x194e('0x10'));var Papa=require(_0x194e('0x11'));var Redis=require(_0x194e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x194e('0x13'));var as=require(_0x194e('0x14'));var hardwareService=require(_0x194e('0x15'));var logger=require(_0x194e('0x16'))('api');var utils=require(_0x194e('0x17'));var config=require(_0x194e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x194e('0x19'))['db'];config[_0x194e('0x1a')]=_[_0x194e('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x194e('0x1c'))(new Redis(config[_0x194e('0x1a')]));require(_0x194e('0x1d'))[_0x194e('0x1e')](socket);function respondWithStatusCode(_0x58ef91,_0x6d3545){_0x6d3545=_0x6d3545||0xcc;return function(_0x234967){if(_0x234967){return _0x58ef91[_0x194e('0x1f')](_0x6d3545);}return _0x58ef91['status'](_0x6d3545)['end']();};}function respondWithResult(_0x5a2c49,_0x35140d){_0x35140d=_0x35140d||0xc8;return function(_0x182665){if(_0x182665){return _0x5a2c49[_0x194e('0x20')](_0x35140d)[_0x194e('0x21')](_0x182665);}};}function respondWithFilteredResult(_0x494c17,_0x46a49b){return function(_0x2bfbf7){if(_0x2bfbf7){var _0x4c6846=typeof _0x46a49b['offset']===_0x194e('0x22')&&typeof _0x46a49b[_0x194e('0x23')]===_0x194e('0x22');var _0x3f07c1=_0x2bfbf7[_0x194e('0x24')];var _0x36bc6b=_0x4c6846?0x0:_0x46a49b['offset'];var _0x23ba4d=_0x4c6846?_0x2bfbf7[_0x194e('0x24')]:_0x46a49b[_0x194e('0x25')]+_0x46a49b[_0x194e('0x23')];var _0x17c50f;if(_0x23ba4d>=_0x3f07c1){_0x23ba4d=_0x3f07c1;_0x17c50f=0xc8;}else{_0x17c50f=0xce;}_0x494c17[_0x194e('0x20')](_0x17c50f);return _0x494c17[_0x194e('0x26')]('Content-Range',_0x36bc6b+'-'+_0x23ba4d+'/'+_0x3f07c1)['json'](_0x2bfbf7);}return null;};}function patchUpdates(_0x2defdc){return function(_0x426cbf){try{jsonpatch[_0x194e('0x27')](_0x426cbf,_0x2defdc,!![]);}catch(_0x2cabcc){return BPromise['reject'](_0x2cabcc);}return _0x426cbf['save']();};}function saveUpdates(_0x3e1bce,_0x7eec4e){return function(_0x4e0d3b){if(_0x4e0d3b){return _0x4e0d3b['update'](_0x3e1bce)['then'](function(_0xc00e88){return _0xc00e88;});}return null;};}function removeEntity(_0x2604cf,_0x41d22b){return function(_0x1640cb){if(_0x1640cb){return _0x1640cb[_0x194e('0x28')]()[_0x194e('0x29')](function(){_0x2604cf[_0x194e('0x20')](0xcc)[_0x194e('0x2a')]();});}};}function handleEntityNotFound(_0x2aa6f2,_0x385131){return function(_0x5c60b5){if(!_0x5c60b5){_0x2aa6f2[_0x194e('0x1f')](0x194);}return _0x5c60b5;};}function handleError(_0x5003af,_0x2a34a4){_0x2a34a4=_0x2a34a4||0x1f4;return function(_0x3f9bf3){logger[_0x194e('0x2b')](_0x3f9bf3['stack']);if(_0x3f9bf3[_0x194e('0x2c')]){delete _0x3f9bf3[_0x194e('0x2c')];}_0x5003af[_0x194e('0x20')](_0x2a34a4)['send'](_0x3f9bf3);};}exports[_0x194e('0x2d')]=function(_0x54948b,_0x3bc828){var _0x1d9b73={},_0x20998f={},_0x5c8811={'count':0x0,'rows':[]};var _0xc9a565=_[_0x194e('0x2e')](db['ChatGroup'][_0x194e('0x2f')],function(_0xc0a1d8){return{'name':_0xc0a1d8[_0x194e('0x30')],'type':_0xc0a1d8[_0x194e('0x31')][_0x194e('0x32')]};});_0x20998f[_0x194e('0x33')]=_[_0x194e('0x2e')](_0xc9a565,_0x194e('0x2c'));_0x20998f[_0x194e('0x34')]=_[_0x194e('0x35')](_0x54948b[_0x194e('0x34')]);_0x20998f['filters']=_[_0x194e('0x36')](_0x20998f[_0x194e('0x33')],_0x20998f[_0x194e('0x34')]);_0x1d9b73['attributes']=_[_0x194e('0x36')](_0x20998f[_0x194e('0x33')],qs[_0x194e('0x37')](_0x54948b[_0x194e('0x34')][_0x194e('0x37')]));_0x1d9b73[_0x194e('0x38')]=_0x1d9b73[_0x194e('0x38')]['length']?_0x1d9b73[_0x194e('0x38')]:_0x20998f[_0x194e('0x33')];if(!_0x54948b['query'][_0x194e('0x39')]('nolimit')){_0x1d9b73[_0x194e('0x23')]=qs[_0x194e('0x23')](_0x54948b[_0x194e('0x34')][_0x194e('0x23')]);_0x1d9b73[_0x194e('0x25')]=qs[_0x194e('0x25')](_0x54948b[_0x194e('0x34')]['offset']);}_0x1d9b73['order']=qs[_0x194e('0x3a')](_0x54948b[_0x194e('0x34')][_0x194e('0x3a')]);_0x1d9b73[_0x194e('0x3b')]=qs[_0x194e('0x3c')](_[_0x194e('0x3d')](_0x54948b[_0x194e('0x34')],_0x20998f[_0x194e('0x3c')]),_0xc9a565);if(_0x54948b[_0x194e('0x34')][_0x194e('0x3e')]){_0x1d9b73['where']=_[_0x194e('0x3f')](_0x1d9b73[_0x194e('0x3b')],{'$or':_[_0x194e('0x2e')](_0xc9a565,function(_0x9f831b){if(_0x9f831b[_0x194e('0x31')]!=='VIRTUAL'){var _0x364e61={};_0x364e61[_0x9f831b[_0x194e('0x2c')]]={'$like':'%'+_0x54948b[_0x194e('0x34')][_0x194e('0x3e')]+'%'};return _0x364e61;}})});}_0x1d9b73=_[_0x194e('0x3f')]({},_0x1d9b73,_0x54948b[_0x194e('0x40')]);var _0x4e6f06={'where':_0x1d9b73['where']};return db[_0x194e('0x41')][_0x194e('0x24')](_0x4e6f06)[_0x194e('0x29')](function(_0x17a1c7){_0x5c8811[_0x194e('0x24')]=_0x17a1c7;if(_0x54948b[_0x194e('0x34')][_0x194e('0x42')]){_0x1d9b73[_0x194e('0x43')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x1d9b73);})[_0x194e('0x29')](function(_0xb148bd){_0x5c8811[_0x194e('0x44')]=_0xb148bd;return _0x5c8811;})[_0x194e('0x29')](respondWithFilteredResult(_0x3bc828,_0x1d9b73))[_0x194e('0x45')](handleError(_0x3bc828,null));};exports['show']=function(_0x24e5e3,_0x33a215){var _0x3ea62a={'raw':!![],'where':{'id':_0x24e5e3[_0x194e('0x46')]['id']}},_0x71b0ab={};_0x71b0ab[_0x194e('0x33')]=_['keys'](db['ChatGroup'][_0x194e('0x2f')]);_0x71b0ab[_0x194e('0x34')]=_[_0x194e('0x35')](_0x24e5e3[_0x194e('0x34')]);_0x71b0ab[_0x194e('0x3c')]=_[_0x194e('0x36')](_0x71b0ab[_0x194e('0x33')],_0x71b0ab['query']);_0x3ea62a[_0x194e('0x38')]=_[_0x194e('0x36')](_0x71b0ab[_0x194e('0x33')],qs[_0x194e('0x37')](_0x24e5e3[_0x194e('0x34')][_0x194e('0x37')]));_0x3ea62a[_0x194e('0x38')]=_0x3ea62a['attributes'][_0x194e('0x47')]?_0x3ea62a['attributes']:_0x71b0ab['model'];if(_0x24e5e3['query'][_0x194e('0x42')]){_0x3ea62a[_0x194e('0x43')]=[{'all':!![]}];}_0x3ea62a=_['merge']({},_0x3ea62a,_0x24e5e3['options']);return db[_0x194e('0x41')][_0x194e('0x48')](_0x3ea62a)[_0x194e('0x29')](handleEntityNotFound(_0x33a215,null))['then'](respondWithResult(_0x33a215,null))[_0x194e('0x45')](handleError(_0x33a215,null));};exports[_0x194e('0x49')]=function(_0x4e5920,_0x167bfe){return db[_0x194e('0x41')][_0x194e('0x49')](_0x4e5920[_0x194e('0x4a')],{})[_0x194e('0x29')](respondWithResult(_0x167bfe,0xc9))[_0x194e('0x45')](handleError(_0x167bfe,null));};exports[_0x194e('0x4b')]=function(_0x4a9cf1,_0x4d2425){if(_0x4a9cf1[_0x194e('0x4a')]['id']){delete _0x4a9cf1[_0x194e('0x4a')]['id'];}return db[_0x194e('0x41')][_0x194e('0x48')]({'where':{'id':_0x4a9cf1[_0x194e('0x46')]['id']}})[_0x194e('0x29')](handleEntityNotFound(_0x4d2425,null))[_0x194e('0x29')](saveUpdates(_0x4a9cf1['body'],null))['then'](respondWithResult(_0x4d2425,null))[_0x194e('0x45')](handleError(_0x4d2425,null));};exports[_0x194e('0x28')]=function(_0x1115b8,_0x4e2fc4){return db[_0x194e('0x41')][_0x194e('0x48')]({'where':{'id':_0x1115b8['params']['id']}})[_0x194e('0x29')](handleEntityNotFound(_0x4e2fc4,null))[_0x194e('0x29')](removeEntity(_0x4e2fc4,null))[_0x194e('0x45')](handleError(_0x4e2fc4,null));};exports[_0x194e('0x4c')]=function(_0x4b5b45,_0x6aef97){return db[_0x194e('0x41')][_0x194e('0x4c')]()[_0x194e('0x29')](respondWithResult(_0x6aef97,null))['catch'](handleError(_0x6aef97,null));};exports[_0x194e('0x4d')]=function(_0x4898c0,_0x57b850,_0x47e8dc){return db['ChatInternalMessage'][_0x194e('0x24')]({'where':{'ChatGroupId':_0x4898c0[_0x194e('0x46')]['id'],'ToId':_0x4898c0[_0x194e('0x4e')]['id'],'read':![]}})[_0x194e('0x29')](function(_0x5df107){return{'id':_[_0x194e('0x4f')](_0x4898c0[_0x194e('0x46')]['id']),'count':_0x5df107};})[_0x194e('0x29')](respondWithResult(_0x57b850,null))['catch'](handleError(_0x57b850,null));};exports[_0x194e('0x50')]=function(_0x480f77,_0x4f016e,_0x13a63f){return db[_0x194e('0x41')][_0x194e('0x48')]({'where':{'id':_0x480f77['params']['id']}})[_0x194e('0x29')](handleEntityNotFound(_0x4f016e,null))[_0x194e('0x29')](function(_0x5db2a4){if(_0x5db2a4){return _0x5db2a4[_0x194e('0x50')](_0x480f77[_0x194e('0x4a')][_0x194e('0x51')],_[_0x194e('0x52')](_0x480f77['body'],['ids','id'])||{});}})[_0x194e('0x29')](respondWithResult(_0x4f016e,null))[_0x194e('0x45')](handleError(_0x4f016e,null));};exports[_0x194e('0x53')]=function(_0x4ea633,_0x55a22c,_0xc19c0f){var _0x297bb4={};var _0x5e8aad={};var _0x54920e;var _0xc103b4;return db[_0x194e('0x41')][_0x194e('0x54')]({'where':{'id':_0x4ea633[_0x194e('0x46')]['id']}})[_0x194e('0x29')](handleEntityNotFound(_0x55a22c,null))[_0x194e('0x29')](function(_0x84fb7b){if(_0x84fb7b){_0x54920e=_0x84fb7b;_0x5e8aad[_0x194e('0x33')]=_[_0x194e('0x35')](db[_0x194e('0x55')][_0x194e('0x2f')]);_0x5e8aad[_0x194e('0x34')]=_['keys'](_0x4ea633[_0x194e('0x34')]);_0x5e8aad['filters']=_[_0x194e('0x36')](_0x5e8aad[_0x194e('0x33')],_0x5e8aad[_0x194e('0x34')]);_0x297bb4['attributes']=_[_0x194e('0x36')](_0x5e8aad[_0x194e('0x33')],qs[_0x194e('0x37')](_0x4ea633[_0x194e('0x34')]['fields']));_0x297bb4[_0x194e('0x38')]=_0x297bb4[_0x194e('0x38')][_0x194e('0x47')]?_0x297bb4[_0x194e('0x38')]:_0x5e8aad[_0x194e('0x33')];_0x297bb4['order']=qs[_0x194e('0x3a')](_0x4ea633['query'][_0x194e('0x3a')]);_0x297bb4[_0x194e('0x3b')]=qs['filters'](_[_0x194e('0x3d')](_0x4ea633[_0x194e('0x34')],_0x5e8aad[_0x194e('0x3c')]));if(_0x4ea633[_0x194e('0x34')][_0x194e('0x3e')]){_0x297bb4[_0x194e('0x3b')]=_[_0x194e('0x3f')](_0x297bb4[_0x194e('0x3b')],{'$or':_[_0x194e('0x2e')](_0x297bb4[_0x194e('0x38')],function(_0x46bbc0){var _0x9e8cf0={};_0x9e8cf0[_0x46bbc0]={'$like':'%'+_0x4ea633[_0x194e('0x34')][_0x194e('0x3e')]+'%'};return _0x9e8cf0;})});}_0x297bb4=_['merge']({},_0x297bb4,_0x4ea633[_0x194e('0x40')]);return _0x54920e[_0x194e('0x53')](_0x297bb4);}})['then'](function(_0x147fd5){if(_0x147fd5){_0xc103b4=_0x147fd5[_0x194e('0x47')];if(!_0x4ea633[_0x194e('0x34')][_0x194e('0x39')](_0x194e('0x56'))){_0x297bb4[_0x194e('0x23')]=qs[_0x194e('0x23')](_0x4ea633[_0x194e('0x34')][_0x194e('0x23')]);_0x297bb4[_0x194e('0x25')]=qs[_0x194e('0x25')](_0x4ea633[_0x194e('0x34')][_0x194e('0x25')]);}return _0x54920e['getMembers'](_0x297bb4);}})[_0x194e('0x29')](function(_0x2949e2){if(_0x2949e2){return _0x2949e2?{'count':_0xc103b4,'rows':_0x2949e2}:null;}})[_0x194e('0x29')](respondWithResult(_0x55a22c,null))[_0x194e('0x45')](handleError(_0x55a22c,null));};exports[_0x194e('0x57')]=function(_0x56a005,_0x2f49cb,_0x1e6175){return db[_0x194e('0x41')][_0x194e('0x48')]({'where':{'id':_0x56a005[_0x194e('0x46')]['id']}})['then'](handleEntityNotFound(_0x2f49cb,null))[_0x194e('0x29')](function(_0x50f7ce){if(_0x50f7ce){return _0x50f7ce[_0x194e('0x57')](_0x56a005[_0x194e('0x34')][_0x194e('0x51')]);}})[_0x194e('0x29')](respondWithStatusCode(_0x2f49cb,null))[_0x194e('0x45')](handleError(_0x2f49cb,null));};exports[_0x194e('0x58')]=function(_0x37e1c9,_0x51b984,_0x1bdaac){if(_0x37e1c9[_0x194e('0x4a')]['id']){delete _0x37e1c9[_0x194e('0x4a')]['id'];}return db['ChatGroup'][_0x194e('0x48')]({'where':{'id':_0x37e1c9[_0x194e('0x46')]['id']}})[_0x194e('0x29')](handleEntityNotFound(_0x51b984,null))['then'](function(_0x3b0327){if(_0x3b0327){_0x37e1c9[_0x194e('0x4a')]['ChatGroupId']=_0x3b0327['id'];return db[_0x194e('0x59')][_0x194e('0x49')](_0x37e1c9[_0x194e('0x4a')]);}})[_0x194e('0x29')](respondWithResult(_0x51b984,null))['catch'](handleError(_0x51b984,null));};exports[_0x194e('0x5a')]=function(_0x39e7af,_0x4b8e0f,_0x1eeccf){var _0x57e24e={};var _0x4c9b28={};var _0x5d0c1d;var _0xbbef9f;return db[_0x194e('0x41')]['findOne']({'where':{'id':_0x39e7af[_0x194e('0x46')]['id']}})[_0x194e('0x29')](handleEntityNotFound(_0x4b8e0f,null))['then'](function(_0x5b69a3){if(_0x5b69a3){_0x5d0c1d=_0x5b69a3;_0x4c9b28['model']=_['keys'](db['ChatInternalMessage']['rawAttributes']);_0x4c9b28[_0x194e('0x34')]=_[_0x194e('0x35')](_0x39e7af[_0x194e('0x34')]);_0x4c9b28[_0x194e('0x3c')]=_[_0x194e('0x36')](_0x4c9b28['model'],_0x4c9b28[_0x194e('0x34')]);_0x57e24e['attributes']=_[_0x194e('0x36')](_0x4c9b28[_0x194e('0x33')],qs['fields'](_0x39e7af[_0x194e('0x34')]['fields']));_0x57e24e[_0x194e('0x38')]=_0x57e24e[_0x194e('0x38')]['length']?_0x57e24e[_0x194e('0x38')]:_0x4c9b28[_0x194e('0x33')];_0x57e24e['order']=qs['sort'](_0x39e7af[_0x194e('0x34')][_0x194e('0x3a')]);_0x57e24e[_0x194e('0x3b')]=qs[_0x194e('0x3c')](_['pick'](_0x39e7af[_0x194e('0x34')],_0x4c9b28[_0x194e('0x3c')]));if(_0x39e7af[_0x194e('0x34')][_0x194e('0x3e')]){_0x57e24e[_0x194e('0x3b')]=_[_0x194e('0x3f')](_0x57e24e[_0x194e('0x3b')],{'$or':_[_0x194e('0x2e')](_0x57e24e[_0x194e('0x38')],function(_0x521321){var _0xbfff6a={};_0xbfff6a[_0x521321]={'$like':'%'+_0x39e7af[_0x194e('0x34')][_0x194e('0x3e')]+'%'};return _0xbfff6a;})});}if(_0x39e7af[_0x194e('0x34')]['$gte']){var _0x17347f=_0x39e7af[_0x194e('0x34')][_0x194e('0x5b')][_0x194e('0x5c')](',');var _0xa9d0b7={};_0xa9d0b7[_0x17347f[0x0]]={'$gte':moment(_0x17347f[0x1])[_0x194e('0x5d')](_0x194e('0x5e'))};_0x57e24e['where']=_['merge'](_0x57e24e[_0x194e('0x3b')],_0xa9d0b7);}_0x57e24e=_['merge']({},_0x57e24e,_0x39e7af['options']);return _0x5d0c1d[_0x194e('0x5a')](_0x57e24e);}})[_0x194e('0x29')](function(_0x494963){if(_0x494963){_0xbbef9f=_0x494963[_0x194e('0x47')];if(!_0x39e7af[_0x194e('0x34')][_0x194e('0x39')](_0x194e('0x56'))){_0x57e24e['limit']=qs[_0x194e('0x23')](_0x39e7af[_0x194e('0x34')][_0x194e('0x23')]);_0x57e24e['offset']=qs['offset'](_0x39e7af[_0x194e('0x34')]['offset']);}return _0x5d0c1d[_0x194e('0x5a')](_0x57e24e);}})[_0x194e('0x29')](function(_0x279d86){if(_0x279d86){return _0x279d86?{'count':_0xbbef9f,'rows':_0x279d86}:null;}})[_0x194e('0x29')](respondWithResult(_0x4b8e0f,null))[_0x194e('0x45')](handleError(_0x4b8e0f,null));}; \ No newline at end of file +var _0x7169=['ChatGroup','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send'];(function(_0x4d93cd,_0x3dcf49){var _0x71b7f8=function(_0x4da677){while(--_0x4da677){_0x4d93cd['push'](_0x4d93cd['shift']());}};_0x71b7f8(++_0x3dcf49);}(_0x7169,0x92));var _0x9716=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x7169[_0x58afd5];return _0x3e503b;};'use strict';var emlformat=require(_0x9716('0x0'));var rimraf=require(_0x9716('0x1'));var zipdir=require(_0x9716('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9716('0x3'));var moment=require(_0x9716('0x4'));var BPromise=require(_0x9716('0x5'));var Mustache=require(_0x9716('0x6'));var util=require('util');var path=require(_0x9716('0x7'));var sox=require('sox');var csv=require(_0x9716('0x8'));var ejs=require(_0x9716('0x9'));var fs=require('fs');var fs_extra=require(_0x9716('0xa'));var _=require(_0x9716('0xb'));var squel=require(_0x9716('0xc'));var crypto=require(_0x9716('0xd'));var jsforce=require(_0x9716('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9716('0x8'));var querystring=require(_0x9716('0xf'));var Papa=require('papaparse');var Redis=require(_0x9716('0x10'));var authService=require(_0x9716('0x11'));var qs=require(_0x9716('0x12'));var as=require(_0x9716('0x13'));var hardwareService=require(_0x9716('0x14'));var logger=require('../../config/logger')(_0x9716('0x15'));var utils=require(_0x9716('0x16'));var config=require(_0x9716('0x17'));var licenseUtil=require(_0x9716('0x18'));var db=require(_0x9716('0x19'))['db'];config[_0x9716('0x1a')]=_['defaults'](config['redis'],{'host':_0x9716('0x1b'),'port':0x18eb});var socket=require(_0x9716('0x1c'))(new Redis(config[_0x9716('0x1a')]));require('./chatGroup.socket')['register'](socket);function respondWithStatusCode(_0x3237cb,_0x4618dc){_0x4618dc=_0x4618dc||0xcc;return function(_0x21b2f5){if(_0x21b2f5){return _0x3237cb['sendStatus'](_0x4618dc);}return _0x3237cb['status'](_0x4618dc)[_0x9716('0x1d')]();};}function respondWithResult(_0x1639af,_0x11f94c){_0x11f94c=_0x11f94c||0xc8;return function(_0x514abb){if(_0x514abb){return _0x1639af[_0x9716('0x1e')](_0x11f94c)[_0x9716('0x1f')](_0x514abb);}};}function respondWithFilteredResult(_0x4c0585,_0x35fd0a){return function(_0x4d9b68){if(_0x4d9b68){var _0x47cf32=typeof _0x35fd0a[_0x9716('0x20')]===_0x9716('0x21')&&typeof _0x35fd0a[_0x9716('0x22')]==='undefined';var _0x243ebd=_0x4d9b68[_0x9716('0x23')];var _0x31fed7=_0x47cf32?0x0:_0x35fd0a[_0x9716('0x20')];var _0x30c3f1=_0x47cf32?_0x4d9b68[_0x9716('0x23')]:_0x35fd0a[_0x9716('0x20')]+_0x35fd0a[_0x9716('0x22')];var _0x39e8ee;if(_0x30c3f1>=_0x243ebd){_0x30c3f1=_0x243ebd;_0x39e8ee=0xc8;}else{_0x39e8ee=0xce;}_0x4c0585[_0x9716('0x1e')](_0x39e8ee);return _0x4c0585[_0x9716('0x24')](_0x9716('0x25'),_0x31fed7+'-'+_0x30c3f1+'/'+_0x243ebd)[_0x9716('0x1f')](_0x4d9b68);}return null;};}function patchUpdates(_0x26e853){return function(_0x24a0a7){try{jsonpatch[_0x9716('0x26')](_0x24a0a7,_0x26e853,!![]);}catch(_0x5bb22b){return BPromise[_0x9716('0x27')](_0x5bb22b);}return _0x24a0a7[_0x9716('0x28')]();};}function saveUpdates(_0x407e56,_0x55568f){return function(_0x19fcc1){if(_0x19fcc1){return _0x19fcc1[_0x9716('0x29')](_0x407e56)['then'](function(_0x53acc2){return _0x53acc2;});}return null;};}function removeEntity(_0x2b36a6,_0x3280d0){return function(_0x3f8fcb){if(_0x3f8fcb){return _0x3f8fcb['destroy']()[_0x9716('0x2a')](function(){_0x2b36a6[_0x9716('0x1e')](0xcc)[_0x9716('0x1d')]();});}};}function handleEntityNotFound(_0x4507f0,_0x5cbe52){return function(_0x3768bc){if(!_0x3768bc){_0x4507f0[_0x9716('0x2b')](0x194);}return _0x3768bc;};}function handleError(_0x3295ae,_0x10bc33){_0x10bc33=_0x10bc33||0x1f4;return function(_0x3e2760){logger[_0x9716('0x2c')](_0x3e2760[_0x9716('0x2d')]);if(_0x3e2760[_0x9716('0x2e')]){delete _0x3e2760[_0x9716('0x2e')];}_0x3295ae[_0x9716('0x1e')](_0x10bc33)[_0x9716('0x2f')](_0x3e2760);};}exports['index']=function(_0x528e3e,_0x4a9196){var _0x13d1e2={},_0x397ba2={},_0x98d4b1={'count':0x0,'rows':[]};var _0x5ae329=_['map'](db[_0x9716('0x30')][_0x9716('0x31')],function(_0x921e04){return{'name':_0x921e04['fieldName'],'type':_0x921e04[_0x9716('0x32')][_0x9716('0x33')]};});_0x397ba2[_0x9716('0x34')]=_[_0x9716('0x35')](_0x5ae329,_0x9716('0x2e'));_0x397ba2[_0x9716('0x36')]=_[_0x9716('0x37')](_0x528e3e['query']);_0x397ba2[_0x9716('0x38')]=_[_0x9716('0x39')](_0x397ba2[_0x9716('0x34')],_0x397ba2[_0x9716('0x36')]);_0x13d1e2[_0x9716('0x3a')]=_[_0x9716('0x39')](_0x397ba2[_0x9716('0x34')],qs[_0x9716('0x3b')](_0x528e3e[_0x9716('0x36')][_0x9716('0x3b')]));_0x13d1e2['attributes']=_0x13d1e2['attributes'][_0x9716('0x3c')]?_0x13d1e2['attributes']:_0x397ba2[_0x9716('0x34')];if(!_0x528e3e[_0x9716('0x36')][_0x9716('0x3d')](_0x9716('0x3e'))){_0x13d1e2[_0x9716('0x22')]=qs[_0x9716('0x22')](_0x528e3e[_0x9716('0x36')][_0x9716('0x22')]);_0x13d1e2[_0x9716('0x20')]=qs[_0x9716('0x20')](_0x528e3e[_0x9716('0x36')][_0x9716('0x20')]);}_0x13d1e2[_0x9716('0x3f')]=qs['sort'](_0x528e3e[_0x9716('0x36')][_0x9716('0x40')]);_0x13d1e2[_0x9716('0x41')]=qs[_0x9716('0x38')](_[_0x9716('0x42')](_0x528e3e[_0x9716('0x36')],_0x397ba2[_0x9716('0x38')]),_0x5ae329);if(_0x528e3e[_0x9716('0x36')][_0x9716('0x43')]){_0x13d1e2['where']=_[_0x9716('0x44')](_0x13d1e2[_0x9716('0x41')],{'$or':_[_0x9716('0x35')](_0x5ae329,function(_0xd5a7b6){if(_0xd5a7b6[_0x9716('0x32')]!==_0x9716('0x45')){var _0x4670df={};_0x4670df[_0xd5a7b6['name']]={'$like':'%'+_0x528e3e[_0x9716('0x36')][_0x9716('0x43')]+'%'};return _0x4670df;}})});}_0x13d1e2=_[_0x9716('0x44')]({},_0x13d1e2,_0x528e3e[_0x9716('0x46')]);var _0x2278a3={'where':_0x13d1e2[_0x9716('0x41')]};return db[_0x9716('0x30')][_0x9716('0x23')](_0x2278a3)['then'](function(_0x45343d){_0x98d4b1[_0x9716('0x23')]=_0x45343d;if(_0x528e3e[_0x9716('0x36')]['includeAll']){_0x13d1e2[_0x9716('0x47')]=[{'all':!![]}];}return db['ChatGroup'][_0x9716('0x48')](_0x13d1e2);})[_0x9716('0x2a')](function(_0x4999cf){_0x98d4b1[_0x9716('0x49')]=_0x4999cf;return _0x98d4b1;})[_0x9716('0x2a')](respondWithFilteredResult(_0x4a9196,_0x13d1e2))[_0x9716('0x4a')](handleError(_0x4a9196,null));};exports['show']=function(_0x480de8,_0xc2edf7){var _0x253d3e={'raw':!![],'where':{'id':_0x480de8[_0x9716('0x4b')]['id']}},_0x140f1a={};_0x140f1a[_0x9716('0x34')]=_['keys'](db[_0x9716('0x30')][_0x9716('0x31')]);_0x140f1a['query']=_[_0x9716('0x37')](_0x480de8[_0x9716('0x36')]);_0x140f1a[_0x9716('0x38')]=_[_0x9716('0x39')](_0x140f1a['model'],_0x140f1a[_0x9716('0x36')]);_0x253d3e[_0x9716('0x3a')]=_['intersection'](_0x140f1a[_0x9716('0x34')],qs[_0x9716('0x3b')](_0x480de8['query']['fields']));_0x253d3e[_0x9716('0x3a')]=_0x253d3e[_0x9716('0x3a')][_0x9716('0x3c')]?_0x253d3e[_0x9716('0x3a')]:_0x140f1a[_0x9716('0x34')];if(_0x480de8[_0x9716('0x36')][_0x9716('0x4c')]){_0x253d3e[_0x9716('0x47')]=[{'all':!![]}];}_0x253d3e=_[_0x9716('0x44')]({},_0x253d3e,_0x480de8[_0x9716('0x46')]);return db[_0x9716('0x30')][_0x9716('0x4d')](_0x253d3e)['then'](handleEntityNotFound(_0xc2edf7,null))[_0x9716('0x2a')](respondWithResult(_0xc2edf7,null))[_0x9716('0x4a')](handleError(_0xc2edf7,null));};exports['create']=function(_0x3b458a,_0x24a59a){return db[_0x9716('0x30')][_0x9716('0x4e')](_0x3b458a[_0x9716('0x4f')],{})[_0x9716('0x2a')](respondWithResult(_0x24a59a,0xc9))['catch'](handleError(_0x24a59a,null));};exports[_0x9716('0x29')]=function(_0x111922,_0x58be10){if(_0x111922[_0x9716('0x4f')]['id']){delete _0x111922[_0x9716('0x4f')]['id'];}return db[_0x9716('0x30')][_0x9716('0x4d')]({'where':{'id':_0x111922[_0x9716('0x4b')]['id']}})['then'](handleEntityNotFound(_0x58be10,null))[_0x9716('0x2a')](saveUpdates(_0x111922[_0x9716('0x4f')],null))['then'](respondWithResult(_0x58be10,null))[_0x9716('0x4a')](handleError(_0x58be10,null));};exports['destroy']=function(_0x26b18b,_0x2353e3){return db[_0x9716('0x30')]['find']({'where':{'id':_0x26b18b[_0x9716('0x4b')]['id']}})[_0x9716('0x2a')](handleEntityNotFound(_0x2353e3,null))[_0x9716('0x2a')](removeEntity(_0x2353e3,null))[_0x9716('0x4a')](handleError(_0x2353e3,null));};exports[_0x9716('0x50')]=function(_0x3a12af,_0xf218f6){return db[_0x9716('0x30')][_0x9716('0x50')]()[_0x9716('0x2a')](respondWithResult(_0xf218f6,null))['catch'](handleError(_0xf218f6,null));};exports[_0x9716('0x51')]=function(_0x3a55ab,_0x57b258,_0x1da6e8){return db[_0x9716('0x52')]['count']({'where':{'ChatGroupId':_0x3a55ab[_0x9716('0x4b')]['id'],'ToId':_0x3a55ab['user']['id'],'read':![]}})[_0x9716('0x2a')](function(_0x52e2b7){return{'id':_[_0x9716('0x53')](_0x3a55ab[_0x9716('0x4b')]['id']),'count':_0x52e2b7};})[_0x9716('0x2a')](respondWithResult(_0x57b258,null))[_0x9716('0x4a')](handleError(_0x57b258,null));};exports[_0x9716('0x54')]=function(_0x28ee27,_0x5029d4,_0xcb82b4){return db[_0x9716('0x30')][_0x9716('0x4d')]({'where':{'id':_0x28ee27[_0x9716('0x4b')]['id']}})[_0x9716('0x2a')](handleEntityNotFound(_0x5029d4,null))['then'](function(_0x280a55){if(_0x280a55){return _0x280a55[_0x9716('0x54')](_0x28ee27['body'][_0x9716('0x55')],_['omit'](_0x28ee27[_0x9716('0x4f')],[_0x9716('0x55'),'id'])||{});}})[_0x9716('0x2a')](respondWithResult(_0x5029d4,null))[_0x9716('0x4a')](handleError(_0x5029d4,null));};exports[_0x9716('0x56')]=function(_0x48b982,_0x5dc396,_0x2bbd10){var _0x1a8706={};var _0x33df3f={};var _0x2837a5;var _0x379e97;return db[_0x9716('0x30')][_0x9716('0x57')]({'where':{'id':_0x48b982[_0x9716('0x4b')]['id']}})[_0x9716('0x2a')](handleEntityNotFound(_0x5dc396,null))[_0x9716('0x2a')](function(_0x3c8871){if(_0x3c8871){_0x2837a5=_0x3c8871;_0x33df3f[_0x9716('0x34')]=_[_0x9716('0x37')](db[_0x9716('0x58')][_0x9716('0x31')]);_0x33df3f['query']=_[_0x9716('0x37')](_0x48b982[_0x9716('0x36')]);_0x33df3f['filters']=_['intersection'](_0x33df3f[_0x9716('0x34')],_0x33df3f['query']);_0x1a8706[_0x9716('0x3a')]=_[_0x9716('0x39')](_0x33df3f[_0x9716('0x34')],qs[_0x9716('0x3b')](_0x48b982[_0x9716('0x36')][_0x9716('0x3b')]));_0x1a8706[_0x9716('0x3a')]=_0x1a8706[_0x9716('0x3a')][_0x9716('0x3c')]?_0x1a8706[_0x9716('0x3a')]:_0x33df3f[_0x9716('0x34')];_0x1a8706[_0x9716('0x3f')]=qs[_0x9716('0x40')](_0x48b982[_0x9716('0x36')][_0x9716('0x40')]);_0x1a8706[_0x9716('0x41')]=qs[_0x9716('0x38')](_['pick'](_0x48b982[_0x9716('0x36')],_0x33df3f['filters']));if(_0x48b982[_0x9716('0x36')]['filter']){_0x1a8706['where']=_[_0x9716('0x44')](_0x1a8706[_0x9716('0x41')],{'$or':_[_0x9716('0x35')](_0x1a8706[_0x9716('0x3a')],function(_0x120d3a){var _0x1765a9={};_0x1765a9[_0x120d3a]={'$like':'%'+_0x48b982['query'][_0x9716('0x43')]+'%'};return _0x1765a9;})});}_0x1a8706=_['merge']({},_0x1a8706,_0x48b982['options']);return _0x2837a5[_0x9716('0x56')](_0x1a8706);}})[_0x9716('0x2a')](function(_0x285068){if(_0x285068){_0x379e97=_0x285068[_0x9716('0x3c')];if(!_0x48b982[_0x9716('0x36')][_0x9716('0x3d')](_0x9716('0x3e'))){_0x1a8706['limit']=qs[_0x9716('0x22')](_0x48b982[_0x9716('0x36')][_0x9716('0x22')]);_0x1a8706[_0x9716('0x20')]=qs['offset'](_0x48b982[_0x9716('0x36')][_0x9716('0x20')]);}return _0x2837a5[_0x9716('0x56')](_0x1a8706);}})[_0x9716('0x2a')](function(_0x4042b0){if(_0x4042b0){return _0x4042b0?{'count':_0x379e97,'rows':_0x4042b0}:null;}})[_0x9716('0x2a')](respondWithResult(_0x5dc396,null))['catch'](handleError(_0x5dc396,null));};exports[_0x9716('0x59')]=function(_0x4e0a2c,_0x10a430,_0x4a89ea){return db[_0x9716('0x30')]['find']({'where':{'id':_0x4e0a2c[_0x9716('0x4b')]['id']}})['then'](handleEntityNotFound(_0x10a430,null))['then'](function(_0x34182c){if(_0x34182c){return _0x34182c[_0x9716('0x59')](_0x4e0a2c[_0x9716('0x36')][_0x9716('0x55')]);}})[_0x9716('0x2a')](respondWithStatusCode(_0x10a430,null))['catch'](handleError(_0x10a430,null));};exports[_0x9716('0x5a')]=function(_0x4bccf7,_0x24507f,_0x38d5ed){if(_0x4bccf7[_0x9716('0x4f')]['id']){delete _0x4bccf7[_0x9716('0x4f')]['id'];}return db['ChatGroup'][_0x9716('0x4d')]({'where':{'id':_0x4bccf7[_0x9716('0x4b')]['id']}})[_0x9716('0x2a')](handleEntityNotFound(_0x24507f,null))['then'](function(_0x34d2f1){if(_0x34d2f1){_0x4bccf7['body'][_0x9716('0x5b')]=_0x34d2f1['id'];return db[_0x9716('0x52')][_0x9716('0x4e')](_0x4bccf7[_0x9716('0x4f')]);}})[_0x9716('0x2a')](respondWithResult(_0x24507f,null))[_0x9716('0x4a')](handleError(_0x24507f,null));};exports[_0x9716('0x5c')]=function(_0x3c38aa,_0x52e50c,_0x55f544){var _0x5133fc={};var _0x568bf3={};var _0x392b5c;var _0x5e8c59;return db[_0x9716('0x30')][_0x9716('0x57')]({'where':{'id':_0x3c38aa['params']['id']}})['then'](handleEntityNotFound(_0x52e50c,null))[_0x9716('0x2a')](function(_0x32d56e){if(_0x32d56e){_0x392b5c=_0x32d56e;_0x568bf3[_0x9716('0x34')]=_[_0x9716('0x37')](db[_0x9716('0x52')][_0x9716('0x31')]);_0x568bf3['query']=_[_0x9716('0x37')](_0x3c38aa[_0x9716('0x36')]);_0x568bf3[_0x9716('0x38')]=_[_0x9716('0x39')](_0x568bf3[_0x9716('0x34')],_0x568bf3['query']);_0x5133fc[_0x9716('0x3a')]=_['intersection'](_0x568bf3[_0x9716('0x34')],qs[_0x9716('0x3b')](_0x3c38aa['query'][_0x9716('0x3b')]));_0x5133fc[_0x9716('0x3a')]=_0x5133fc[_0x9716('0x3a')]['length']?_0x5133fc[_0x9716('0x3a')]:_0x568bf3[_0x9716('0x34')];_0x5133fc[_0x9716('0x3f')]=qs[_0x9716('0x40')](_0x3c38aa['query']['sort']);_0x5133fc[_0x9716('0x41')]=qs[_0x9716('0x38')](_['pick'](_0x3c38aa['query'],_0x568bf3['filters']));if(_0x3c38aa['query'][_0x9716('0x43')]){_0x5133fc['where']=_[_0x9716('0x44')](_0x5133fc['where'],{'$or':_[_0x9716('0x35')](_0x5133fc[_0x9716('0x3a')],function(_0x5f19bd){var _0x48040a={};_0x48040a[_0x5f19bd]={'$like':'%'+_0x3c38aa[_0x9716('0x36')][_0x9716('0x43')]+'%'};return _0x48040a;})});}if(_0x3c38aa[_0x9716('0x36')][_0x9716('0x5d')]){var _0x50a170=_0x3c38aa[_0x9716('0x36')][_0x9716('0x5d')][_0x9716('0x5e')](',');var _0x773200={};_0x773200[_0x50a170[0x0]]={'$gte':moment(_0x50a170[0x1])[_0x9716('0x5f')](_0x9716('0x60'))};_0x5133fc['where']=_[_0x9716('0x44')](_0x5133fc[_0x9716('0x41')],_0x773200);}_0x5133fc=_[_0x9716('0x44')]({},_0x5133fc,_0x3c38aa[_0x9716('0x46')]);return _0x392b5c[_0x9716('0x5c')](_0x5133fc);}})[_0x9716('0x2a')](function(_0x2158fe){if(_0x2158fe){_0x5e8c59=_0x2158fe[_0x9716('0x3c')];if(!_0x3c38aa['query'][_0x9716('0x3d')](_0x9716('0x3e'))){_0x5133fc['limit']=qs['limit'](_0x3c38aa['query'][_0x9716('0x22')]);_0x5133fc[_0x9716('0x20')]=qs[_0x9716('0x20')](_0x3c38aa[_0x9716('0x36')][_0x9716('0x20')]);}return _0x392b5c[_0x9716('0x5c')](_0x5133fc);}})[_0x9716('0x2a')](function(_0x34a2d1){if(_0x34a2d1){return _0x34a2d1?{'count':_0x5e8c59,'rows':_0x34a2d1}:null;}})[_0x9716('0x2a')](respondWithResult(_0x52e50c,null))[_0x9716('0x4a')](handleError(_0x52e50c,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index e7b731b..356112f 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 _0xa8f3=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save'];(function(_0x3ad497,_0x1285d3){var _0x39a541=function(_0x3dff59){while(--_0x3dff59){_0x3ad497['push'](_0x3ad497['shift']());}};_0x39a541(++_0x1285d3);}(_0xa8f3,0xc1));var _0x3a8f=function(_0x50a2ec,_0x4c974b){_0x50a2ec=_0x50a2ec-0x0;var _0x238105=_0xa8f3[_0x50a2ec];return _0x238105;};'use strict';var EventEmitter=require(_0x3a8f('0x0'));var ChatGroup=require(_0x3a8f('0x1'))['db'][_0x3a8f('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x3a8f('0x3')](0x0);var events={'afterCreate':_0x3a8f('0x4'),'afterUpdate':_0x3a8f('0x5'),'afterDestroy':_0x3a8f('0x6')};function emitEvent(_0x16c044){return function(_0x14bd62,_0x341a8f,_0x714540){ChatGroupEvents[_0x3a8f('0x7')](_0x16c044+':'+_0x14bd62['id'],_0x14bd62);ChatGroupEvents[_0x3a8f('0x7')](_0x16c044,_0x14bd62);_0x714540(null);};}for(var e in events){if(events[_0x3a8f('0x8')](e)){var event=events[e];ChatGroup[_0x3a8f('0x9')](e,emitEvent(event));}}module[_0x3a8f('0xa')]=ChatGroupEvents; \ No newline at end of file +var _0xa46e=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0xa713ca,_0x35c118){var _0x23a3be=function(_0x531774){while(--_0x531774){_0xa713ca['push'](_0xa713ca['shift']());}};_0x23a3be(++_0x35c118);}(_0xa46e,0x8a));var _0xea46=function(_0x199c03,_0x3254aa){_0x199c03=_0x199c03-0x0;var _0x11a7d4=_0xa46e[_0x199c03];return _0x11a7d4;};'use strict';var EventEmitter=require(_0xea46('0x0'));var ChatGroup=require(_0xea46('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xea46('0x2')](0x0);var events={'afterCreate':_0xea46('0x3'),'afterUpdate':_0xea46('0x4'),'afterDestroy':'remove'};function emitEvent(_0x19f135){return function(_0x4b6e4a,_0x3a2209,_0x47d633){ChatGroupEvents[_0xea46('0x5')](_0x19f135+':'+_0x4b6e4a['id'],_0x4b6e4a);ChatGroupEvents['emit'](_0x19f135,_0x4b6e4a);_0x47d633(null);};}for(var e in events){if(events[_0xea46('0x6')](e)){var event=events[e];ChatGroup[_0xea46('0x7')](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 a23d8d1..05c5c35 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 _0x4670=['bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','lodash','util','../../config/logger','api','moment'];(function(_0xefd3e6,_0x10d71e){var _0x52a204=function(_0x14222e){while(--_0x14222e){_0xefd3e6['push'](_0xefd3e6['shift']());}};_0x52a204(++_0x10d71e);}(_0x4670,0x175));var _0x0467=function(_0x480a69,_0x1c8139){_0x480a69=_0x480a69-0x0;var _0x1efe2c=_0x4670[_0x480a69];return _0x1efe2c;};'use strict';var _=require(_0x0467('0x0'));var util=require(_0x0467('0x1'));var logger=require(_0x0467('0x2'))(_0x0467('0x3'));var moment=require(_0x0467('0x4'));var BPromise=require(_0x0467('0x5'));var rp=require(_0x0467('0x6'));var fs=require('fs');var path=require(_0x0467('0x7'));var rimraf=require(_0x0467('0x8'));var config=require(_0x0467('0x9'));var attributes=require(_0x0467('0xa'));module[_0x0467('0xb')]=function(_0x4d205c,_0x5397f7){return _0x4d205c[_0x0467('0xc')](_0x0467('0xd'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6957=['./chatGroup.attributes','exports','define','chat_groups','lodash','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd3bc,_0x332f04){var _0x28d039=function(_0x10b604){while(--_0x10b604){_0x3dd3bc['push'](_0x3dd3bc['shift']());}};_0x28d039(++_0x332f04);}(_0x6957,0x176));var _0x7695=function(_0x4596a9,_0x44655a){_0x4596a9=_0x4596a9-0x0;var _0x3ea3d0=_0x6957[_0x4596a9];return _0x3ea3d0;};'use strict';var _=require(_0x7695('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7695('0x1'));var BPromise=require('bluebird');var rp=require(_0x7695('0x2'));var fs=require('fs');var path=require(_0x7695('0x3'));var rimraf=require(_0x7695('0x4'));var config=require(_0x7695('0x5'));var attributes=require(_0x7695('0x6'));module[_0x7695('0x7')]=function(_0x313ced,_0x56a4cd){return _0x313ced[_0x7695('0x8')]('ChatGroup',attributes,{'tableName':_0x7695('0x9'),'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 585ba4e..b4f4ac1 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 _0x67a2=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x413aac,_0x5e2430){var _0x569b11=function(_0x52e060){while(--_0x52e060){_0x413aac['push'](_0x413aac['shift']());}};_0x569b11(++_0x5e2430);}(_0x67a2,0xd3));var _0x267a=function(_0x566b3a,_0x168b1b){_0x566b3a=_0x566b3a-0x0;var _0x3a812a=_0x67a2[_0x566b3a];return _0x3a812a;};'use strict';var _=require(_0x267a('0x0'));var util=require(_0x267a('0x1'));var moment=require('moment');var BPromise=require(_0x267a('0x2'));var rs=require(_0x267a('0x3'));var fs=require('fs');var Redis=require(_0x267a('0x4'));var db=require(_0x267a('0x5'))['db'];var utils=require(_0x267a('0x6'));var logger=require(_0x267a('0x7'))(_0x267a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x267a('0x9')][_0x267a('0xa')]({'port':0x232a});config[_0x267a('0xb')]=_['defaults'](config[_0x267a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x267a('0xc'))(new Redis(config[_0x267a('0xb')]));require(_0x267a('0xd'))[_0x267a('0xe')](socket);function respondWithRpcPromise(_0x207db5,_0x42e210,_0xaaf056){return new BPromise(function(_0x52bb27,_0x25416b){return client[_0x267a('0xf')](_0x207db5,_0xaaf056)[_0x267a('0x10')](function(_0xd8d52){logger[_0x267a('0x11')](_0x267a('0x12'),_0x42e210,_0x267a('0x13'));logger[_0x267a('0x14')](_0x267a('0x15'),_0x42e210,_0x267a('0x13'),JSON[_0x267a('0x16')](_0xd8d52));if(_0xd8d52['error']){if(_0xd8d52[_0x267a('0x17')]['code']===0x1f4){logger[_0x267a('0x17')](_0x267a('0x12'),_0x42e210,_0xd8d52[_0x267a('0x17')]['message']);return _0x25416b(_0xd8d52['error'][_0x267a('0x18')]);}logger[_0x267a('0x17')](_0x267a('0x12'),_0x42e210,_0xd8d52['error'][_0x267a('0x18')]);return _0x52bb27(_0xd8d52[_0x267a('0x17')][_0x267a('0x18')]);}else{logger[_0x267a('0x11')](_0x267a('0x12'),_0x42e210,'request\x20sent');_0x52bb27(_0xd8d52[_0x267a('0x19')]['message']);}})[_0x267a('0x1a')](function(_0x289cb1){logger['error'](_0x267a('0x12'),_0x42e210,_0x289cb1);_0x25416b(_0x289cb1);});});} \ No newline at end of file +var _0x0738=['http','redis','defaults','localhost','./chatGroup.socket','register','then','info','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2ffee8,_0x126cdd){var _0x432ebf=function(_0x521355){while(--_0x521355){_0x2ffee8['push'](_0x2ffee8['shift']());}};_0x432ebf(++_0x126cdd);}(_0x0738,0xb9));var _0x8073=function(_0x4920f2,_0xa4bfbf){_0x4920f2=_0x4920f2-0x0;var _0x1f27cf=_0x0738[_0x4920f2];return _0x1f27cf;};'use strict';var _=require(_0x8073('0x0'));var util=require(_0x8073('0x1'));var moment=require(_0x8073('0x2'));var BPromise=require(_0x8073('0x3'));var rs=require(_0x8073('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8073('0x5'));var logger=require(_0x8073('0x6'))(_0x8073('0x7'));var config=require(_0x8073('0x8'));var jayson=require(_0x8073('0x9'));var client=jayson[_0x8073('0xa')][_0x8073('0xb')]({'port':0x232a});config[_0x8073('0xc')]=_[_0x8073('0xd')](config[_0x8073('0xc')],{'host':_0x8073('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8073('0xf'))[_0x8073('0x10')](socket);function respondWithRpcPromise(_0x5d0760,_0x2d3df4,_0x33674f){return new BPromise(function(_0x28031e,_0x3f2c1c){return client['request'](_0x5d0760,_0x33674f)[_0x8073('0x11')](function(_0x5d0356){logger[_0x8073('0x12')]('ChatGroup,\x20%s,\x20%s',_0x2d3df4,'request\x20sent');logger[_0x8073('0x13')](_0x8073('0x14'),_0x2d3df4,'request\x20sent',JSON[_0x8073('0x15')](_0x5d0356));if(_0x5d0356[_0x8073('0x16')]){if(_0x5d0356['error'][_0x8073('0x17')]===0x1f4){logger[_0x8073('0x16')](_0x8073('0x18'),_0x2d3df4,_0x5d0356[_0x8073('0x16')]['message']);return _0x3f2c1c(_0x5d0356[_0x8073('0x16')][_0x8073('0x19')]);}logger[_0x8073('0x16')](_0x8073('0x18'),_0x2d3df4,_0x5d0356[_0x8073('0x16')][_0x8073('0x19')]);return _0x28031e(_0x5d0356['error'][_0x8073('0x19')]);}else{logger['info'](_0x8073('0x18'),_0x2d3df4,_0x8073('0x1a'));_0x28031e(_0x5d0356['result'][_0x8073('0x19')]);}})[_0x8073('0x1b')](function(_0xdb5ddf){logger[_0x8073('0x16')](_0x8073('0x18'),_0x2d3df4,_0xdb5ddf);_0x3f2c1c(_0xdb5ddf);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index e969388..140f08e 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 _0xa31b=['save','remove','update','emit','removeListener','register','length','chatGroup:','./chatGroup.events'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xa31b,0x155));var _0xba31=function(_0xd7e690,_0x2c6d4f){_0xd7e690=_0xd7e690-0x0;var _0x587c9b=_0xa31b[_0xd7e690];return _0x587c9b;};'use strict';var ChatGroupEvents=require(_0xba31('0x0'));var events=[_0xba31('0x1'),_0xba31('0x2'),_0xba31('0x3')];function createListener(_0x3e0732,_0x704d7d){return function(_0x439bee){_0x704d7d[_0xba31('0x4')](_0x3e0732,_0x439bee);};}function removeListener(_0x13182b,_0x5bc9ef){return function(){ChatGroupEvents[_0xba31('0x5')](_0x13182b,_0x5bc9ef);};}exports[_0xba31('0x6')]=function(_0x49239d){for(var _0x257ce3=0x0,_0x2108a5=events[_0xba31('0x7')];_0x257ce3<_0x2108a5;_0x257ce3++){var _0x34870e=events[_0x257ce3];var _0x5952=createListener(_0xba31('0x8')+_0x34870e,_0x49239d);ChatGroupEvents['on'](_0x34870e,_0x5952);}}; \ No newline at end of file +var _0x1f0f=['emit','removeListener','register','chatGroup:','save','remove','update'];(function(_0x2aa48b,_0x5a4446){var _0x48caf8=function(_0x13230c){while(--_0x13230c){_0x2aa48b['push'](_0x2aa48b['shift']());}};_0x48caf8(++_0x5a4446);}(_0x1f0f,0x1ee));var _0xf1f0=function(_0xbcd28d,_0x5eaa62){_0xbcd28d=_0xbcd28d-0x0;var _0x1b86da=_0x1f0f[_0xbcd28d];return _0x1b86da;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xf1f0('0x0'),_0xf1f0('0x1'),_0xf1f0('0x2')];function createListener(_0x5961ca,_0xbc4e59){return function(_0xb9a323){_0xbc4e59[_0xf1f0('0x3')](_0x5961ca,_0xb9a323);};}function removeListener(_0x4dc8ce,_0x48d8e3){return function(){ChatGroupEvents[_0xf1f0('0x4')](_0x4dc8ce,_0x48d8e3);};}exports[_0xf1f0('0x5')]=function(_0x56383b){for(var _0x2084d7=0x0,_0x4149b0=events['length'];_0x2084d7<_0x4149b0;_0x2084d7++){var _0x49e289=events[_0x2084d7];var _0x1c2373=createListener(_0xf1f0('0x6')+_0x49e289,_0x56383b);ChatGroupEvents['on'](_0x49e289,_0x1c2373);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 4d9bda1..87432f9 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 _0x765f=['delete','removeMembers','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','/:id/members','/:id/messages','getMessages','create','post','addMembers','addMessage','put','update'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0x765f,0x77));var _0xf765=function(_0x177cbc,_0x2ea94a){_0x177cbc=_0x177cbc-0x0;var _0x508130=_0x765f[_0x177cbc];return _0x508130;};'use strict';var multer=require(_0xf765('0x0'));var util=require('util');var path=require(_0xf765('0x1'));var timeout=require(_0xf765('0x2'));var express=require(_0xf765('0x3'));var router=express[_0xf765('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf765('0x5'));var interaction=require(_0xf765('0x6'));var config=require(_0xf765('0x7'));var controller=require(_0xf765('0x8'));router[_0xf765('0x9')]('/',auth[_0xf765('0xa')](),controller[_0xf765('0xb')]);router['get'](_0xf765('0xc'),auth[_0xf765('0xa')](),controller[_0xf765('0xd')]);router['get'](_0xf765('0xe'),auth[_0xf765('0xa')](),controller[_0xf765('0xf')]);router[_0xf765('0x9')](_0xf765('0x10'),auth[_0xf765('0xa')](),controller['getUnread']);router[_0xf765('0x9')](_0xf765('0x11'),auth[_0xf765('0xa')](),controller['getMembers']);router[_0xf765('0x9')](_0xf765('0x12'),auth['isAuthenticated'](),controller[_0xf765('0x13')]);router['post']('/',auth[_0xf765('0xa')](),controller[_0xf765('0x14')]);router[_0xf765('0x15')](_0xf765('0x11'),auth['isAuthenticated'](),controller[_0xf765('0x16')]);router[_0xf765('0x15')](_0xf765('0x12'),auth[_0xf765('0xa')](),controller[_0xf765('0x17')]);router[_0xf765('0x18')](_0xf765('0xe'),auth[_0xf765('0xa')](),controller[_0xf765('0x19')]);router[_0xf765('0x1a')](_0xf765('0xe'),auth[_0xf765('0xa')](),controller['destroy']);router[_0xf765('0x1a')](_0xf765('0x11'),auth[_0xf765('0xa')](),controller[_0xf765('0x1b')]);module[_0xf765('0x1c')]=router; \ No newline at end of file +var _0xb80c=['addMessage','put','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatGroup.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','getMessages','post','addMembers'];(function(_0x31c4cc,_0x150943){var _0x3099ee=function(_0xe3f487){while(--_0xe3f487){_0x31c4cc['push'](_0x31c4cc['shift']());}};_0x3099ee(++_0x150943);}(_0xb80c,0x1f2));var _0xcb80=function(_0x3cfa2c,_0x30b6cb){_0x3cfa2c=_0x3cfa2c-0x0;var _0x35740c=_0xb80c[_0x3cfa2c];return _0x35740c;};'use strict';var multer=require(_0xcb80('0x0'));var util=require(_0xcb80('0x1'));var path=require('path');var timeout=require(_0xcb80('0x2'));var express=require(_0xcb80('0x3'));var router=express[_0xcb80('0x4')]();var fs_extra=require(_0xcb80('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcb80('0x6'));var config=require('../../config/environment');var controller=require(_0xcb80('0x7'));router[_0xcb80('0x8')]('/',auth['isAuthenticated'](),controller[_0xcb80('0x9')]);router['get'](_0xcb80('0xa'),auth[_0xcb80('0xb')](),controller[_0xcb80('0xc')]);router[_0xcb80('0x8')](_0xcb80('0xd'),auth[_0xcb80('0xb')](),controller[_0xcb80('0xe')]);router[_0xcb80('0x8')](_0xcb80('0xf'),auth[_0xcb80('0xb')](),controller[_0xcb80('0x10')]);router[_0xcb80('0x8')](_0xcb80('0x11'),auth['isAuthenticated'](),controller[_0xcb80('0x12')]);router[_0xcb80('0x8')]('/:id/messages',auth[_0xcb80('0xb')](),controller[_0xcb80('0x13')]);router[_0xcb80('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcb80('0x14')]('/:id/members',auth['isAuthenticated'](),controller[_0xcb80('0x15')]);router[_0xcb80('0x14')]('/:id/messages',auth['isAuthenticated'](),controller[_0xcb80('0x16')]);router[_0xcb80('0x17')](_0xcb80('0xd'),auth[_0xcb80('0xb')](),controller['update']);router[_0xcb80('0x18')](_0xcb80('0xd'),auth[_0xcb80('0xb')](),controller[_0xcb80('0x19')]);router['delete']('/:id/members',auth[_0xcb80('0xb')](),controller['removeMembers']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index b8ddd8c..5a0f50a 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 _0x4a1d=['exports','BOOLEAN','INTEGER','ENUM','thumb','star','TEXT','STRING','DATE','sequelize'];(function(_0x3e14c5,_0x38ca39){var _0x912ff2=function(_0x1310fb){while(--_0x1310fb){_0x3e14c5['push'](_0x3e14c5['shift']());}};_0x912ff2(++_0x38ca39);}(_0x4a1d,0x77));var _0xd4a1=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x4a1d[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0xd4a1('0x0'));module[_0xd4a1('0x1')]={'closed':{'type':Sequelize[_0xd4a1('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xd4a1('0x3')]},'ratingType':{'type':Sequelize[_0xd4a1('0x4')]('star',_0xd4a1('0x5')),'defaultValue':_0xd4a1('0x6')},'ratingMessage':{'type':Sequelize[_0xd4a1('0x7')]},'pathTranscript':{'type':Sequelize[_0xd4a1('0x7')]},'mailTranscript':{'type':Sequelize[_0xd4a1('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xd4a1('0x9')]},'disposition':{'type':Sequelize[_0xd4a1('0x8')]},'secondDisposition':{'type':Sequelize[_0xd4a1('0x8')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd4a1('0x8')]},'browserName':{'type':Sequelize[_0xd4a1('0x8')]},'browserVersion':{'type':Sequelize[_0xd4a1('0x8')]},'osName':{'type':Sequelize[_0xd4a1('0x8')]},'osVersion':{'type':Sequelize[_0xd4a1('0x8')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xd4a1('0x8')]},'referer':{'type':Sequelize[_0xd4a1('0x7')]},'customerIp':{'type':Sequelize[_0xd4a1('0x8')]},'formData':{'type':Sequelize[_0xd4a1('0x7')]('long')},'read1stAt':{'type':Sequelize[_0xd4a1('0x9')]},'lastMsgAt':{'type':Sequelize[_0xd4a1('0x9')]},'lastMsgDirection':{'type':Sequelize[_0xd4a1('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xd4a1('0x8')]},'customerPort':{'type':Sequelize[_0xd4a1('0x8')]},'vidaooSessionId':{'type':Sequelize[_0xd4a1('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0xd4a1('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xb677=['DATE','STRING','sequelize','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb677,0x119));var _0x7b67=function(_0x573654,_0x4b3f64){_0x573654=_0x573654-0x0;var _0x274d3b=_0xb677[_0x573654];return _0x274d3b;};'use strict';var Sequelize=require(_0x7b67('0x0'));module['exports']={'closed':{'type':Sequelize[_0x7b67('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7b67('0x2')]},'ratingType':{'type':Sequelize[_0x7b67('0x3')](_0x7b67('0x4'),_0x7b67('0x5')),'defaultValue':_0x7b67('0x4')},'ratingMessage':{'type':Sequelize[_0x7b67('0x6')]},'pathTranscript':{'type':Sequelize[_0x7b67('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7b67('0x7')]},'disposition':{'type':Sequelize[_0x7b67('0x8')]},'secondDisposition':{'type':Sequelize[_0x7b67('0x8')]},'thirdDisposition':{'type':Sequelize[_0x7b67('0x8')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x7b67('0x8')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x7b67('0x8')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x7b67('0x8')]},'referer':{'type':Sequelize[_0x7b67('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x7b67('0x6')]('long')},'read1stAt':{'type':Sequelize[_0x7b67('0x7')]},'lastMsgAt':{'type':Sequelize[_0x7b67('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x7b67('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x7b67('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x7b67('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 72c54fb..eb32337 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 _0xbdee=['defaults','socket.io-emitter','register','jayson/promise','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','json','offset','undefined','count','status','Content-Range','destroy','name','send','render','merge','body','contact','agent','interaction','index','map','ChatInteraction','fieldName','type','key','findAll','query','user','params','model','rawAttributes','keys','filters','intersection','fields','attributes','length','includeAll','find','create','update','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','account','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','originalname','basename','filename','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','User','ContactId','%s%d','agentAlias','customer','Visitor','website_alias','System','agent_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','$gte','split','options','include','rows','getMyMessages','ChatInteractionId','secret','push','addTags','setTags','Tag','emit','chatInteractionTags:save','removeTags','unix','toString','server','tmp','files','attachments','transcript-%d-%s.zip','firstName','lastName','read','ChatWebsite','Account','Owner','get','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','browserName','osName','referer','customerIp','tail','existsSync','createReadStream','pipe','Contact','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbdee,0xbe));var _0xebde=function(_0x5eaf1f,_0x7e7dac){_0x5eaf1f=_0x5eaf1f-0x0;var _0x176664=_0xbdee[_0x5eaf1f];return _0x176664;};'use strict';var rimraf=require(_0xebde('0x0'));var zipdir=require(_0xebde('0x1'));var rp=require(_0xebde('0x2'));var moment=require(_0xebde('0x3'));var BPromise=require(_0xebde('0x4'));var Mustache=require(_0xebde('0x5'));var util=require(_0xebde('0x6'));var path=require('path');var ejs=require(_0xebde('0x7'));var fs=require('fs');var _=require(_0xebde('0x8'));var Redis=require(_0xebde('0x9'));var interaction=require('../../components/interaction/service');var qs=require(_0xebde('0xa'));var pdf=require(_0xebde('0xb'));var logger=require('../../config/logger')(_0xebde('0xc'));var config=require(_0xebde('0xd'));var db=require('../../mysqldb')['db'];config[_0xebde('0xe')]=_[_0xebde('0xf')](config[_0xebde('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xebde('0x10'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0xebde('0x11')](socket);var jayson=require(_0xebde('0x12'));var client=jayson['client'][_0xebde('0x13')]({'port':0x232b});var client9004=jayson['client'][_0xebde('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x39f7f5,_0x1c919d,_0x5428b9,_0x7e18bc){return new BPromise(function(_0xfe4741,_0x5d0ca3){var _0x13f84d=_0x7e18bc||client;return _0x13f84d['request'](_0x39f7f5,_0x5428b9)[_0xebde('0x14')](function(_0x5ff7a8){logger[_0xebde('0x15')](_0xebde('0x16'),_0x1c919d,_0xebde('0x17'));logger['debug'](_0xebde('0x18'),_0x1c919d,_0xebde('0x17'),JSON[_0xebde('0x19')](_0x5ff7a8));if(_0x5ff7a8[_0xebde('0x1a')]){if(_0x5ff7a8[_0xebde('0x1a')]['code']===0x1f4){logger[_0xebde('0x1a')](_0xebde('0x16'),_0x1c919d,_0x5ff7a8[_0xebde('0x1a')][_0xebde('0x1b')]);return _0x5d0ca3(_0x5ff7a8[_0xebde('0x1a')][_0xebde('0x1b')]);}logger[_0xebde('0x1a')](_0xebde('0x16'),_0x1c919d,_0x5ff7a8[_0xebde('0x1a')][_0xebde('0x1b')]);return _0xfe4741(_0x5ff7a8[_0xebde('0x1a')][_0xebde('0x1b')]);}else{logger[_0xebde('0x15')](_0xebde('0x16'),_0x1c919d,_0xebde('0x17'));_0xfe4741(_0x5ff7a8['result'][_0xebde('0x1b')]);}})[_0xebde('0x1c')](function(_0x59fdf2){logger[_0xebde('0x1a')](_0xebde('0x16'),_0x1c919d,_0x59fdf2);_0x5d0ca3(_0x59fdf2);});});}function respondWithStatusCode(_0x3a7650,_0x17742c){_0x17742c=_0x17742c||0xcc;return function(_0x407e1d){if(_0x407e1d){return _0x3a7650[_0xebde('0x1d')](_0x17742c);}return _0x3a7650['status'](_0x17742c)[_0xebde('0x1e')]();};}function respondWithResult(_0x168859,_0x464129){_0x464129=_0x464129||0xc8;return function(_0x4e07cd){if(_0x4e07cd){return _0x168859['status'](_0x464129)[_0xebde('0x1f')](_0x4e07cd);}};}function respondWithFilteredResult(_0x348738,_0x1ae5cd){return function(_0x3c7e0a){if(_0x3c7e0a){var _0x571c6a=typeof _0x1ae5cd[_0xebde('0x20')]==='undefined'&&typeof _0x1ae5cd['limit']===_0xebde('0x21');var _0x2657c3=_0x3c7e0a[_0xebde('0x22')];var _0x152374=_0x571c6a?0x0:_0x1ae5cd[_0xebde('0x20')];var _0x2a1516=_0x571c6a?_0x3c7e0a['count']:_0x1ae5cd[_0xebde('0x20')]+_0x1ae5cd['limit'];var _0x15252e;if(_0x2a1516>=_0x2657c3){_0x2a1516=_0x2657c3;_0x15252e=0xc8;}else{_0x15252e=0xce;}_0x348738[_0xebde('0x23')](_0x15252e);return _0x348738['set'](_0xebde('0x24'),_0x152374+'-'+_0x2a1516+'/'+_0x2657c3)[_0xebde('0x1f')](_0x3c7e0a);}return null;};}function saveUpdates(_0x5a0f78){return function(_0x495423){if(_0x495423){return _0x495423['update'](_0x5a0f78)[_0xebde('0x14')](function(_0x42952a){return _0x42952a;});}return null;};}function removeEntity(_0x34bf32){return function(_0x28cba1){if(_0x28cba1){return _0x28cba1[_0xebde('0x25')]()[_0xebde('0x14')](function(){_0x34bf32['status'](0xcc)[_0xebde('0x1e')]();});}};}function handleEntityNotFound(_0x3d72f3){return function(_0x2a4f97){if(!_0x2a4f97){_0x3d72f3['sendStatus'](0x194);}return _0x2a4f97;};}function handleError(_0x3febba,_0x5a24c6){_0x5a24c6=_0x5a24c6||0x1f4;return function(_0x378c3b){logger[_0xebde('0x1a')](_0x378c3b['stack']);if(_0x378c3b['name']){delete _0x378c3b[_0xebde('0x26')];}_0x3febba[_0xebde('0x23')](_0x5a24c6)[_0xebde('0x27')](_0x378c3b);};}function getMustacheRender(_0x50f262,_0x353f0a){return Mustache[_0xebde('0x28')](_0x50f262,_[_0xebde('0x29')](_0x353f0a[_0xebde('0x2a')],{'contact':_0x353f0a[_0xebde('0x2b')],'message':_0x353f0a[_0xebde('0x1b')],'agent':_0x353f0a[_0xebde('0x2c')],'interaction':_0x353f0a[_0xebde('0x2d')],'account':_0x353f0a['account']}))||'';}exports[_0xebde('0x2e')]=function(_0x367698,_0x4e2007){var _0x3a044b={};var _0x504432=_[_0xebde('0x2f')](db[_0xebde('0x30')]['rawAttributes'],function(_0x35f17b){return{'name':_0x35f17b[_0xebde('0x31')],'type':_0x35f17b[_0xebde('0x32')][_0xebde('0x33')]};});_0x3a044b=qs['getOptions'](_0x504432,_0x367698);return interaction[_0xebde('0x34')]('chat',_0x367698[_0xebde('0x35')],_0x367698[_0xebde('0x36')],_0x3a044b,_0x504432)[_0xebde('0x14')](respondWithFilteredResult(_0x4e2007,_0x3a044b))[_0xebde('0x1c')](handleError(_0x4e2007,null));};exports['show']=function(_0x5882ca,_0x510460){var _0x520e07={'raw':![],'where':{'id':_0x5882ca[_0xebde('0x37')]['id']}},_0x3a95ee={};_0x3a95ee[_0xebde('0x38')]=_['keys'](db[_0xebde('0x30')][_0xebde('0x39')]);_0x3a95ee[_0xebde('0x35')]=_[_0xebde('0x3a')](_0x5882ca[_0xebde('0x35')]);_0x3a95ee[_0xebde('0x3b')]=_['intersection'](_0x3a95ee[_0xebde('0x38')],_0x3a95ee['query']);_0x520e07['attributes']=_[_0xebde('0x3c')](_0x3a95ee[_0xebde('0x38')],qs[_0xebde('0x3d')](_0x5882ca['query'][_0xebde('0x3d')]));_0x520e07['attributes']=_0x520e07[_0xebde('0x3e')][_0xebde('0x3f')]?_0x520e07[_0xebde('0x3e')]:_0x3a95ee['model'];if(_0x5882ca[_0xebde('0x35')][_0xebde('0x40')]){_0x520e07['include']=[{'all':!![]}];}_0x520e07=_['merge']({},_0x520e07,_0x5882ca['options']);return db[_0xebde('0x30')][_0xebde('0x41')](_0x520e07)[_0xebde('0x14')](handleEntityNotFound(_0x510460,null))[_0xebde('0x14')](respondWithResult(_0x510460,null))['catch'](handleError(_0x510460,null));};exports[_0xebde('0x42')]=function(_0x4b0ad9,_0x2a9339){return db[_0xebde('0x30')][_0xebde('0x42')](_0x4b0ad9[_0xebde('0x2a')],{})[_0xebde('0x14')](respondWithResult(_0x2a9339,0xc9))[_0xebde('0x1c')](handleError(_0x2a9339,null));};exports[_0xebde('0x43')]=function(_0x5dc431,_0x2eb435){if(_0x5dc431[_0xebde('0x2a')]['id']){delete _0x5dc431[_0xebde('0x2a')]['id'];}return db[_0xebde('0x30')][_0xebde('0x41')]({'where':{'id':_0x5dc431['params']['id']}})[_0xebde('0x14')](handleEntityNotFound(_0x2eb435,null))[_0xebde('0x14')](saveUpdates(_0x5dc431[_0xebde('0x2a')],null))['then'](respondWithResult(_0x2eb435,null))[_0xebde('0x1c')](handleError(_0x2eb435,null));};exports[_0xebde('0x25')]=function(_0x10052e,_0x1cdfbc){return db[_0xebde('0x30')][_0xebde('0x41')]({'where':{'id':_0x10052e[_0xebde('0x37')]['id']}})['then'](handleEntityNotFound(_0x1cdfbc,null))[_0xebde('0x14')](removeEntity(_0x1cdfbc,null))[_0xebde('0x1c')](handleError(_0x1cdfbc,null));};exports[_0xebde('0x44')]=function(_0x36f405,_0x34f507){return db[_0xebde('0x30')][_0xebde('0x44')]()[_0xebde('0x14')](respondWithResult(_0x34f507,null))[_0xebde('0x1c')](handleError(_0x34f507,null));};exports[_0xebde('0x45')]=function(_0x3fc540,_0x2dce2e){var _0x52390d=_0x3fc540[_0xebde('0x37')]['id'];var _0x5a0af7;var _0x3b5957;var _0x4eee62;return db[_0xebde('0x30')][_0xebde('0x46')]({'where':{'id':_0x52390d}})[_0xebde('0x14')](function(_0x41c35d){_0x5a0af7=_0x41c35d;return db['ChatWebsite'][_0xebde('0x46')]({'where':{'id':_0x41c35d[_0xebde('0x47')]},'attributes':['id',_0xebde('0x48'),_0xebde('0x49'),_0xebde('0x4a'),_0xebde('0x4b'),_0xebde('0x4c')],'raw':!![]});})[_0xebde('0x14')](function(_0x548de7){if(_0x548de7&&_0x548de7['vidaooApiKey']&&_0x548de7[_0xebde('0x49')]){_0x3b5957=_0x548de7;var _0x5718d0={'interaction':{'id':_0x52390d},'agent':{'id':_0x3fc540[_0xebde('0x36')]['id'],'name':_0x3fc540[_0xebde('0x36')][_0xebde('0x26')],'fullname':_0x3fc540[_0xebde('0x36')]['fullname'],'email':_0x3fc540[_0xebde('0x36')][_0xebde('0x4d')]},'contact':_0x3fc540[_0xebde('0x2a')][_0xebde('0x2b')],'account':_0x3fc540[_0xebde('0x2a')][_0xebde('0x4e')]};var _0x4b8ef8={'rejectUnauthorized':![],'method':'POST','url':_0xebde('0x4f'),'headers':{'X-APIKEY':_0x548de7[_0xebde('0x48')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3fc540['user'][_0xebde('0x4d')]],'buttons':null,'topic':_0x3b5957[_0xebde('0x4a')],'note':_[_0xebde('0x50')](_0x3b5957[_0xebde('0x4b')])?null:getMustacheRender(_0x3b5957[_0xebde('0x4b')],_0x5718d0),'metadata':null},'redirect':_0xebde('0x51'),'json':!![]};try{if(!_[_0xebde('0x50')](_0x3b5957[_0xebde('0x4c')])){var _0x45ca13=getMustacheRender(_0x3b5957['vidaooMetadata'],_0x5718d0);var _0x17b6c2=JSON[_0xebde('0x52')](_0x45ca13);_0x4b8ef8['body']['metadata']=_0x17b6c2;}}catch(_0x4592a6){throw new db[(_0xebde('0x53'))][(_0xebde('0x54'))](_0xebde('0x55'));}return rp(_0x4b8ef8);}else{throw new db[(_0xebde('0x53'))][(_0xebde('0x54'))]('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x5cf43f){_0x4eee62=_0x5cf43f;if(_0x4eee62['id']){var _0x1c4476={'body':_0x4eee62['join_url'],'ChatWebsiteId':_0x3b5957['id'],'ChatInteractionId':_0x5a0af7['id'],'direction':_0xebde('0x56'),'UserId':_0x3fc540[_0xebde('0x36')]['id']};return db[_0xebde('0x57')][_0xebde('0x42')](_0x1c4476,{});}else{throw new db[(_0xebde('0x53'))][(_0xebde('0x54'))](_0xebde('0x58'));}})[_0xebde('0x14')](function(){return _0x5a0af7['updateAttributes']({'vidaooSessionId':_0x4eee62['id']});})[_0xebde('0x14')](respondWithResult(_0x2dce2e,null))['catch'](handleError(_0x2dce2e,null));};exports[_0xebde('0x59')]=function(_0x12328c,_0x8cab72){if(_0x12328c['body']['id']){delete _0x12328c[_0xebde('0x2a')]['id'];}return db[_0xebde('0x30')]['find']({'where':{'id':_0x12328c['params']['id']},'include':[{'model':db[_0xebde('0x5a')],'as':'Contact'}]})[_0xebde('0x14')](handleEntityNotFound(_0x8cab72,null))[_0xebde('0x14')](saveUpdates(_0x12328c['body'],null))['then'](respondWithResult(_0x8cab72,null))['catch'](handleError(_0x8cab72,null));};exports[_0xebde('0x5b')]=function(_0x165aa6,_0x2d5f9c){if(_0x165aa6['body']['id']){delete _0x165aa6[_0xebde('0x2a')]['id'];}return db[_0xebde('0x30')][_0xebde('0x41')]({'where':{'id':_0x165aa6[_0xebde('0x37')]['id']}})[_0xebde('0x14')](function(_0x445dff){if(!_0x445dff){logger['error'](_0xebde('0x5c'),_0xebde('0x5b'),0x194,_0xebde('0x5d'));_0x2d5f9c[_0xebde('0x1d')](0x194);}else{if(_0x445dff[_0xebde('0x5e')]){throw new db[(_0xebde('0x53'))]['ValidationError'](_0xebde('0x5f'));}}return _0x445dff;})[_0xebde('0x14')](function(_0x128af3){if(_0x128af3){return _0x128af3[_0xebde('0x43')]({'closed':_0x165aa6[_0xebde('0x2a')][_0xebde('0x60')],'disposition':_0x165aa6[_0xebde('0x2a')][_0xebde('0x61')]})['then'](function(_0x53c20f){return _0x53c20f;});}})[_0xebde('0x14')](function(){return respondWithRpcPromise(_0xebde('0x62'),_0xebde('0x5b'),_0x165aa6[_0xebde('0x2a')],client9004);})['then'](respondWithResult(_0x2d5f9c,null))[_0xebde('0x1c')](handleError(_0x2d5f9c,null));};exports['attachmentUpload']=function(_0x3b30d4,_0x305fcb){_0x3b30d4[_0xebde('0x2a')][_0xebde('0x26')]=_0x3b30d4['file'][_0xebde('0x63')];_0x3b30d4[_0xebde('0x2a')][_0xebde('0x64')]=_0x3b30d4['file'][_0xebde('0x65')];_0x3b30d4[_0xebde('0x2a')]['type']=_0x3b30d4['file']['mimetype'];return db[_0xebde('0x66')][_0xebde('0x42')](_0x3b30d4['body'])[_0xebde('0x14')](respondWithResult(_0x305fcb,0xc9))['catch'](handleError(_0x305fcb,null));};exports[_0xebde('0x67')]=function(_0x4a7d03,_0xd1ca69){return db['ChatInteraction'][_0xebde('0x46')]({'where':{'id':_0x4a7d03[_0xebde('0x37')]['id']},'raw':!![]})[_0xebde('0x14')](handleEntityNotFound(_0xd1ca69,null))[_0xebde('0x14')](function(_0x1ca08d){if(_0x1ca08d){if(_0x1ca08d['closed']){return _0xd1ca69['status'](0x193)[_0xebde('0x1f')]({'status':0x193,'message':_0xebde('0x68')});}return db[_0xebde('0x66')][_0xebde('0x46')]({'where':{'id':_0x4a7d03[_0xebde('0x35')][_0xebde('0x69')]},'raw':!![]})['then'](handleEntityNotFound(_0xd1ca69,null));}})['then'](function(_0x3d3a97){if(_0x3d3a97){var _0x246fdd=_0x3d3a97[_0xebde('0x6a')]!==null;var _0x569ec4=path[_0xebde('0x6b')](config[_0xebde('0x6c')],_0xebde('0x6d'));if(_0x246fdd){_0x569ec4=path[_0xebde('0x6b')](_0x569ec4,_0xebde('0x6e'));}var _0x2b4892=path['join'](_0x569ec4,_0x3d3a97[_0xebde('0x64')]);return _0xd1ca69[_0xebde('0x6f')](_0x2b4892);}})['catch'](handleError(_0xd1ca69,null));};exports[_0xebde('0x70')]=function(_0x3dea48,_0x17bfa6){var _0x3d6eaf=null;var _0x28fb67=null;var _0x3ac6ec=null;if(_0x3dea48[_0xebde('0x2a')]['id']){delete _0x3dea48[_0xebde('0x2a')]['id'];}if(_0x3dea48[_0xebde('0x2a')][_0xebde('0x71')]){_0x3ac6ec=path[_0xebde('0x6b')](config[_0xebde('0x6c')],_0xebde('0x72'),util[_0xebde('0x73')](_0xebde('0x74'),Date['now']()));_0x3dea48[_0xebde('0x2a')][_0xebde('0x75')]=_0x3ac6ec;}return db[_0xebde('0x30')][_0xebde('0x41')]({'where':{'id':_0x3dea48['params']['id']},'include':[{'model':db[_0xebde('0x57')],'as':_0xebde('0x76'),'include':[{'model':db[_0xebde('0x77')],'as':_0xebde('0x77')}]}]})[_0xebde('0x14')](handleEntityNotFound(_0x17bfa6,null))[_0xebde('0x14')](saveUpdates(_0x3dea48['body'],null))[_0xebde('0x14')](function(_0x503f7e){if(_0x503f7e){_0x3d6eaf=_0x503f7e;return db['ChatWebsite'][_0xebde('0x41')]({'where':{'id':_0x3d6eaf['ChatWebsiteId']}});}})['then'](function(_0x383e12){if(_0x383e12){_0x28fb67=_0x383e12;return db['CmContact'][_0xebde('0x41')]({'where':{'id':_0x3d6eaf[_0xebde('0x78')]}});}})['then'](function(_0x4394ce){if(_0x4394ce){if(_0x3ac6ec){var _0x15babf=null;for(var _0x5aabb8=0x1;_0x5aabb8<_0x3d6eaf[_0xebde('0x76')][_0xebde('0x3f')];++_0x5aabb8){_0x15babf=_0x3d6eaf[_0xebde('0x76')][_0x5aabb8];var _0x50083f=_0x15babf[_0xebde('0x5e')]?util['format'](_0xebde('0x79'),_0x28fb67[_0xebde('0x7a')],_0x15babf[_0xebde('0x5e')]):'System';var _0x44ad2d=_0x3dea48['body'][_0xebde('0x7b')]||util[_0xebde('0x73')]('%s%d',_0xebde('0x7c'),_0x15babf[_0xebde('0x78')]);switch(_0x28fb67['agentIdentifier']){case _0xebde('0x7d'):_0x50083f=_0x15babf[_0xebde('0x5e')]?util[_0xebde('0x73')](_0xebde('0x79'),_0x28fb67[_0xebde('0x7a')],_0x15babf[_0xebde('0x5e')]):_0xebde('0x7e');break;case _0xebde('0x7f'):_0x50083f=_0x15babf['UserId']?_0x15babf[_0xebde('0x77')][_0xebde('0x80')]||_0x15babf['User'][_0xebde('0x81')]:_0xebde('0x7e');break;case _0xebde('0x82'):_0x50083f=_0x15babf[_0xebde('0x5e')]?_0x15babf[_0xebde('0x77')]['fullname']:_0xebde('0x7e');break;default:_0x50083f=_0x15babf[_0xebde('0x5e')]?util['format'](_0xebde('0x79'),_0x28fb67[_0xebde('0x7a')],_0x15babf[_0xebde('0x5e')]):_0xebde('0x7e');}var _0x3b6bb7=util['format'](_0xebde('0x83'),moment(_0x15babf[_0xebde('0x84')])[_0xebde('0x73')](_0xebde('0x85')),_0x15babf[_0xebde('0x86')]==='in'?_0x44ad2d:_0x50083f,_0x15babf[_0xebde('0x2a')]);if(!_0x15babf['secret']){fs[_0xebde('0x87')](_0x3ac6ec,_0x3b6bb7);}}return db[_0xebde('0x88')][_0xebde('0x46')]({'where':{'service':!![]},'include':[{'model':db[_0xebde('0x89')],'as':_0xebde('0x8a'),'raw':!![],'include':[{'model':db[_0xebde('0x8b')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0xebde('0x14')](function(_0x276b55){if(!_0x276b55||!_0x276b55['Smtp']||!_0x3dea48[_0xebde('0x2a')])return _0x3d6eaf;var _0x3d9222=_0x276b55[_0xebde('0x8c')]();return respondWithRpcPromise(_0xebde('0x8d'),'sendMail',{'account':_0x3d9222,'message':{'from':util[_0xebde('0x73')](_0xebde('0x8e'),_0x276b55[_0xebde('0x26')],_0x276b55[_0xebde('0x4d')]||_0x276b55['Smtp'][_0xebde('0x36')]),'to':_0x3dea48[_0xebde('0x2a')][_0xebde('0x71')],'subject':_0xebde('0x8f'),'text':util[_0xebde('0x73')](_0xebde('0x90'),_0x3dea48['body'][_0xebde('0x71')]),'attachments':[{'path':_0x3ac6ec}]}})[_0xebde('0x14')](function(){return _0x3d6eaf;})[_0xebde('0x1c')](function(_0x3ada0a){logger['error'](_0x3ada0a);});})[_0xebde('0x14')](respondWithStatusCode(_0x17bfa6,0xc8))[_0xebde('0x1c')](handleError(_0x17bfa6,null));};exports[_0xebde('0x91')]=function(_0x4c13ed,_0x1d30ea){return db[_0xebde('0x57')][_0xebde('0x41')]({'where':{'id':_0x4c13ed['params']['id']}})[_0xebde('0x14')](handleEntityNotFound(_0x1d30ea,null))[_0xebde('0x14')](function(_0x142c82){if(_0x142c82){return _0x142c82['addMessage'](_0x4c13ed[_0xebde('0x2a')][_0xebde('0x92')],_[_0xebde('0x93')](_0x4c13ed['body'],[_0xebde('0x92'),'id'])||{});}})[_0xebde('0x14')](respondWithResult(_0x1d30ea,null))['catch'](handleError(_0x1d30ea,null));};exports[_0xebde('0x94')]=function(_0x35b64a,_0x48155a){var _0x1d1de1={'raw':![],'where':{}};var _0x5617bb={};var _0x2b3cb5={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xebde('0x46')]({'where':{'id':_0x35b64a['params']['id']}})[_0xebde('0x14')](handleEntityNotFound(_0x48155a,null))[_0xebde('0x14')](function(_0xad090a){if(_0xad090a){_0x5617bb[_0xebde('0x38')]=_[_0xebde('0x3a')](db[_0xebde('0x57')][_0xebde('0x39')]);_0x5617bb['query']=_[_0xebde('0x3a')](_0x35b64a['query']);_0x5617bb['filters']=_[_0xebde('0x3c')](_0x5617bb[_0xebde('0x38')],_0x5617bb[_0xebde('0x35')]);_0x1d1de1[_0xebde('0x3e')]=_[_0xebde('0x3c')](_0x5617bb['model'],qs[_0xebde('0x3d')](_0x35b64a[_0xebde('0x35')][_0xebde('0x3d')]));_0x1d1de1[_0xebde('0x3e')]=_0x1d1de1[_0xebde('0x3e')]['length']?_0x1d1de1[_0xebde('0x3e')]:_0x5617bb[_0xebde('0x38')];if(!_0x35b64a[_0xebde('0x35')][_0xebde('0x95')](_0xebde('0x96'))){_0x1d1de1['limit']=qs['limit'](_0x35b64a[_0xebde('0x35')][_0xebde('0x97')]);_0x1d1de1[_0xebde('0x20')]=qs['offset'](_0x35b64a[_0xebde('0x35')][_0xebde('0x20')]);}_0x1d1de1[_0xebde('0x98')]=qs['sort'](_0x35b64a[_0xebde('0x35')][_0xebde('0x99')]);_0x1d1de1[_0xebde('0x9a')]=qs[_0xebde('0x3b')](_[_0xebde('0x9b')](_0x35b64a[_0xebde('0x35')],_0x5617bb[_0xebde('0x3b')]));_0x1d1de1[_0xebde('0x9a')]['ChatInteractionId']=_0xad090a['id'];if(_0x35b64a[_0xebde('0x35')][_0xebde('0x9c')]){_0x1d1de1['where']=_[_0xebde('0x29')](_0x1d1de1[_0xebde('0x9a')],{'$or':_[_0xebde('0x2f')](_0x1d1de1['attributes'],function(_0x294395){var _0x5be77d={};_0x5be77d[_0x294395]={'$like':'%'+_0x35b64a[_0xebde('0x35')][_0xebde('0x9c')]+'%'};return _0x5be77d;})});}if(_0x35b64a['query'][_0xebde('0x9d')]){var _0x4d2ee8=_0x35b64a[_0xebde('0x35')][_0xebde('0x9d')][_0xebde('0x9e')](',');var _0x1b71bf={};_0x1b71bf[_0x4d2ee8[0x0]]={'$gte':moment(_0x4d2ee8[0x1])[_0xebde('0x73')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1d1de1[_0xebde('0x9a')]=_['merge'](_0x1d1de1[_0xebde('0x9a')],_0x1b71bf);}_0x1d1de1=_[_0xebde('0x29')]({},_0x1d1de1,_0x35b64a[_0xebde('0x9f')]);return db[_0xebde('0x57')][_0xebde('0x22')]({'where':_0x1d1de1['where']})[_0xebde('0x14')](function(_0x3418eb){_0x2b3cb5['count']=_0x3418eb;if(_0x35b64a[_0xebde('0x35')][_0xebde('0x40')]){_0x1d1de1[_0xebde('0xa0')]=[{'all':!![]}];}return db[_0xebde('0x57')][_0xebde('0x34')](_0x1d1de1);})[_0xebde('0x14')](function(_0x48bbf6){_0x2b3cb5[_0xebde('0xa1')]=_0x48bbf6;return _0x2b3cb5;});}})[_0xebde('0x14')](respondWithFilteredResult(_0x48155a,_0x1d1de1))[_0xebde('0x1c')](handleError(_0x48155a,null));};exports[_0xebde('0xa2')]=function(_0x59def3,_0x5dbd8a){var _0x10f655={'where':{}},_0x33d1cc={},_0x73d9b1={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xebde('0x46')]({'where':{'id':_0x59def3[_0xebde('0x37')]['id']}})[_0xebde('0x14')](handleEntityNotFound(_0x5dbd8a,null))[_0xebde('0x14')](function(_0xce6c7b){if(_0xce6c7b){_0x33d1cc[_0xebde('0x38')]=_[_0xebde('0x3a')](db[_0xebde('0x57')][_0xebde('0x39')]);_0x33d1cc[_0xebde('0x35')]=_[_0xebde('0x3a')](_0x59def3[_0xebde('0x35')]);_0x33d1cc[_0xebde('0x3b')]=_['intersection'](_0x33d1cc[_0xebde('0x38')],_0x33d1cc[_0xebde('0x35')]);_0x10f655[_0xebde('0x3e')]=_[_0xebde('0x3c')](_0x33d1cc[_0xebde('0x38')],qs[_0xebde('0x3d')](_0x59def3['query']['fields']));_0x10f655['attributes']=_0x10f655[_0xebde('0x3e')]['length']?_0x10f655[_0xebde('0x3e')]:_0x33d1cc[_0xebde('0x38')];if(!_0x59def3[_0xebde('0x35')]['hasOwnProperty'](_0xebde('0x96'))){_0x10f655[_0xebde('0x97')]=qs[_0xebde('0x97')](_0x59def3['query']['limit']);_0x10f655[_0xebde('0x20')]=qs[_0xebde('0x20')](_0x59def3[_0xebde('0x35')][_0xebde('0x20')]);}_0x10f655['order']=qs['sort'](_0x59def3[_0xebde('0x35')][_0xebde('0x99')]);_0x10f655[_0xebde('0x9a')]=qs['filters'](_[_0xebde('0x9b')](_0x59def3[_0xebde('0x35')],_0x33d1cc['filters']));_0x10f655['where'][_0xebde('0xa3')]=_0xce6c7b['id'];if(_0x59def3['query'][_0xebde('0x9c')]){_0x10f655[_0xebde('0x9a')]=_[_0xebde('0x29')](_0x10f655[_0xebde('0x9a')],{'$or':_['map'](_0x10f655['attributes'],function(_0x5f5323){var _0x168e31={};_0x168e31[_0x5f5323]={'$like':'%'+_0x59def3[_0xebde('0x35')][_0xebde('0x9c')]+'%'};return _0x168e31;})});}_0x10f655[_0xebde('0x9a')][_0xebde('0xa4')]=![];if(_0x59def3[_0xebde('0x35')]['id']){_0x10f655['where']['id']={'$gt':_0x59def3['query']['id']};}_0x10f655=_['merge']({},_0x10f655,_0x59def3['options']);return db['ChatMessage'][_0xebde('0x22')]({'where':_0x10f655[_0xebde('0x9a')]})[_0xebde('0x14')](function(_0x1d6d3b){_0x73d9b1[_0xebde('0x22')]=_0x1d6d3b;_0x10f655[_0xebde('0xa0')]=[];if(_0x59def3[_0xebde('0x35')]['includeAgent']){_0x10f655['include'][_0xebde('0xa5')]({'model':db[_0xebde('0x77')],'as':_0xebde('0x77'),'attributes':['id',_0xebde('0x81'),'alias']});}if(_0x59def3[_0xebde('0x35')]['includeAll']){_0x10f655[_0xebde('0xa0')]=[{'all':!![]}];}return db['ChatMessage'][_0xebde('0x34')](_0x10f655);})[_0xebde('0x14')](function(_0x305bfc){_0x73d9b1[_0xebde('0xa1')]=_0x305bfc;return _0x73d9b1;});}})['then'](respondWithFilteredResult(_0x5dbd8a,_0x10f655))[_0xebde('0x1c')](handleError(_0x5dbd8a,null));};exports[_0xebde('0xa6')]=function(_0x14251d,_0x1f6eb8){return db[_0xebde('0x30')]['find']({'where':{'id':_0x14251d[_0xebde('0x37')]['id']}})['then'](handleEntityNotFound(_0x1f6eb8,null))[_0xebde('0x14')](function(_0x2da7b4){if(_0x2da7b4){return _0x2da7b4[_0xebde('0xa7')](_0x14251d[_0xebde('0x2a')][_0xebde('0x92')],_[_0xebde('0x93')](_0x14251d['body'],['ids','id'])||{})['spread'](function(){return db[_0xebde('0xa8')][_0xebde('0x34')]({'attributes':['id',_0xebde('0x26'),'color'],'where':{'id':_0x14251d['body']['ids']}});})[_0xebde('0x14')](function(_0x22e0ce){socket[_0xebde('0xa9')](_0xebde('0xaa'),{'id':Number(_0x14251d[_0xebde('0x37')]['id']),'tags':_0x22e0ce||[]});return{'id':Number(_0x14251d['params']['id']),'tags':_0x22e0ce||[]};});}})[_0xebde('0x14')](respondWithResult(_0x1f6eb8,null))[_0xebde('0x1c')](handleError(_0x1f6eb8,null));};exports[_0xebde('0xab')]=function(_0x266b99,_0x539a57){return db[_0xebde('0x30')][_0xebde('0x41')]({'where':{'id':_0x266b99[_0xebde('0x37')]['id']}})[_0xebde('0x14')](handleEntityNotFound(_0x539a57,null))[_0xebde('0x14')](function(_0x181867){if(_0x181867){return _0x181867['removeTags'](_0x266b99[_0xebde('0x35')]['ids']);}})['then'](respondWithStatusCode(_0x539a57,null))[_0xebde('0x1c')](handleError(_0x539a57,null));};exports[_0xebde('0x6f')]=function(_0x469170,_0x5cbe36){var _0x5ef4c2=moment()[_0xebde('0xac')]()[_0xebde('0xad')]();var _0x39d48f=path[_0xebde('0x6b')](config[_0xebde('0x6c')],_0xebde('0xae'),'files',_0xebde('0xaf'));var _0x45ccb3=path[_0xebde('0x6b')](config['root'],_0xebde('0xae'),_0xebde('0xb0'),_0xebde('0xb1'));var _0x35491b=path['join'](_0x39d48f,_0x5ef4c2);var _0x1379bf=util[_0xebde('0x73')](_0xebde('0xb2'),_0x469170[_0xebde('0x37')]['id'],_0x5ef4c2);var _0x1fa9e8=path[_0xebde('0x6b')](_0x39d48f,_0x1379bf);var _0x15b80f=[];_0x15b80f['push']({'model':db['User'],'as':'User','attributes':['id',_0xebde('0x81')],'raw':!![]});_0x15b80f[_0xebde('0xa5')]({'model':db[_0xebde('0x5a')],'as':'Contact','attributes':['id',_0xebde('0xb3'),_0xebde('0xb4')],'raw':!![]});if(_0x469170[_0xebde('0x35')]['attachments']){_0x15b80f[_0xebde('0xa5')]({'model':db[_0xebde('0x66')],'as':_0xebde('0x66'),'raw':!![]});}var _0x11d495=[{'model':db['ChatMessage'],'as':'Messages','attributes':['id',_0xebde('0x2a'),_0xebde('0x84'),_0xebde('0x86'),_0xebde('0xa4'),_0xebde('0xb5')],'include':_0x15b80f}];_0x11d495['push']({'model':db[_0xebde('0xb6')],'as':_0xebde('0xb7'),'attributes':['id','name']});_0x11d495[_0xebde('0xa5')]({'model':db[_0xebde('0x77')],'as':_0xebde('0xb8'),'attributes':['id',_0xebde('0x81')]});return db['ChatInteraction'][_0xebde('0x41')]({'where':{'id':_0x469170[_0xebde('0x37')]['id']},'include':_0x11d495})['then'](handleEntityNotFound(_0x5cbe36,null))[_0xebde('0x14')](function(_0x340b58){if(_0x340b58){var _0x3701fc=_0x340b58[_0xebde('0xb9')]({'plain':!![]});fs[_0xebde('0xba')](_0x35491b);var _0x35cc5={'channel':_0xebde('0xbb'),'account':_0x3701fc['Account']['name'],'agent':_0x3701fc['Owner']?_0x3701fc['Owner'][_0xebde('0x81')]:_0xebde('0xbc'),'createdAt':moment(_0x3701fc['createdAt'])[_0xebde('0x73')]('YYYY-MM-DD\x20HH:mm:ss')[_0xebde('0xad')](),'closedAt':_0x3701fc['closed']?moment(_0x3701fc['closedAt'])[_0xebde('0x73')](_0xebde('0xbd'))[_0xebde('0xad')]():'','disposition':_0x3701fc[_0xebde('0x61')],'chatInfo':{'browser':_0x3701fc[_0xebde('0xbe')],'os':_0x3701fc[_0xebde('0xbf')],'referer':_0x3701fc[_0xebde('0xc0')],'customerIp':_0x3701fc[_0xebde('0xc1')],'customerPort':_0x3701fc['customerPort']?_0x3701fc['customerPort']:_0xebde('0xbc')},'messages':_(_0x3701fc[_0xebde('0x76')])[_0xebde('0xc2')]()[_0xebde('0x9c')]({'secret':![]})['map'](function(_0x3f4f42){if(_0x3f4f42[_0xebde('0x66')]){var _0x182c64=path[_0xebde('0x6b')](_0x45ccb3,_0x3f4f42[_0xebde('0x66')][_0xebde('0x64')]);if(fs[_0xebde('0xc3')](_0x182c64)){fs[_0xebde('0xc4')](_0x182c64)[_0xebde('0xc5')](fs['createWriteStream'](path[_0xebde('0x6b')](_0x35491b,_0x3f4f42[_0xebde('0x66')][_0xebde('0x64')])));}}return{'date':moment(_0x3f4f42[_0xebde('0x84')])[_0xebde('0x73')](_0xebde('0xbd'))[_0xebde('0xad')](),'sender':_0x3f4f42[_0xebde('0x86')]===_0xebde('0x56')?_0x3f4f42['User']?_0x3f4f42[_0xebde('0x77')]['fullname']:_0xebde('0x7e'):_0x3f4f42['Contact'][_0xebde('0xb3')]+(_0x3f4f42[_0xebde('0xc6')]['lastName']?'\x20'+_0x3f4f42[_0xebde('0xc6')]['lastName']:''),'body':_0x3f4f42[_0xebde('0x66')]?_0x3f4f42[_0xebde('0x66')][_0xebde('0x64')]:_0x3f4f42[_0xebde('0x2a')],'direction':_0x3f4f42[_0xebde('0x86')]===_0xebde('0x56')?'A':'C','secret':_0x3f4f42[_0xebde('0xa4')],'read':_0x3f4f42[_0xebde('0xb5')],'attachment':_0x3f4f42[_0xebde('0x66')]};})['value']()};return ejs[_0xebde('0xc7')](path[_0xebde('0x6b')](config['root'],_0xebde('0xae'),_0xebde('0xc8'),_0xebde('0xc9')),{'interaction':_0x35cc5})['then'](function(_0x477330){var _0x417f60=path[_0xebde('0x6b')](_0x35491b,_0xebde('0xca')+_0x3701fc['id']+'-'+_0x5ef4c2+_0xebde('0xcb'));var _0x359957={'path':_0x417f60,'channel':'Chat','interactionId':_0x3701fc['id']};return pdf[_0xebde('0xcc')](_0x477330,_0x359957);})['then'](function(){return new Promise(function(_0x4515d4,_0x4497df){zipdir(_0x35491b,{'saveTo':_0x1fa9e8},function(_0xfe5c4b,_0x2ccdab){if(_0xfe5c4b)return _0x4497df(_0xfe5c4b);return _0x4515d4(_0x2ccdab);});})['then'](function(){return new BPromise(function(_0x13a3d0,_0x3d8e4f){rimraf(_0x35491b,function(_0x440274){if(_0x440274)_0x3d8e4f(_0x440274);return _0x13a3d0();});});})['then'](function(){return _0x5cbe36[_0xebde('0x6f')](_0x1fa9e8,_0x1379bf,function(_0x31c1d7){if(_0x31c1d7){logger[_0xebde('0x1a')]('err',_0x31c1d7);}else{fs['unlinkSync'](_0x1fa9e8);}});});});}else{return _0x5cbe36['sendStatus'](0xc8);}})[_0xebde('0x1c')](handleError(_0x5cbe36,null));}; \ No newline at end of file +var _0x63b5=['ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','originalname','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','basename','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','User','ChatWebsiteId','ContactId','length','UserId','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','CloudProvider','Smtp','SendMail','sendMail','Mail\x20Transcript','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','rows','getMyMessages','includeAgent','push','includeAll','setTags','Tag','color','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','firstName','lastName','Owner','get','mkdirSync','Account','N.A.','toString','closedAt','browserName','osName','customerPort','tail','createReadStream','read','value','renderFile','views','.pdf','Chat','createPdfFromHTML','err','unlinkSync','zip-dir','request-promise','mustache','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','request','then','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','update','destroy','name','render','body','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','user','params','model','keys','filters','intersection','attributes','fields','include','merge','create','find','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','POST','isNull','parse','metadata','Sequelize'];(function(_0xa94fd,_0x21edfe){var _0x315fea=function(_0x488acd){while(--_0x488acd){_0xa94fd['push'](_0xa94fd['shift']());}};_0x315fea(++_0x21edfe);}(_0x63b5,0x142));var _0x563b=function(_0xdd2074,_0x59bb75){_0xdd2074=_0xdd2074-0x0;var _0x4d08f9=_0x63b5[_0xdd2074];return _0x4d08f9;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x563b('0x0'));var rp=require(_0x563b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x563b('0x2'));var util=require(_0x563b('0x3'));var path=require(_0x563b('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x563b('0x5'));var Redis=require(_0x563b('0x6'));var interaction=require(_0x563b('0x7'));var qs=require(_0x563b('0x8'));var pdf=require(_0x563b('0x9'));var logger=require(_0x563b('0xa'))(_0x563b('0xb'));var config=require(_0x563b('0xc'));var db=require(_0x563b('0xd'))['db'];config[_0x563b('0xe')]=_[_0x563b('0xf')](config[_0x563b('0xe')],{'host':_0x563b('0x10'),'port':0x18eb});var socket=require(_0x563b('0x11'))(new Redis(config['redis']));require(_0x563b('0x12'))[_0x563b('0x13')](socket);var jayson=require('jayson/promise');var client=jayson[_0x563b('0x14')][_0x563b('0x15')]({'port':0x232b});var client9004=jayson[_0x563b('0x14')][_0x563b('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x39a3d9,_0x2a4e13,_0x52d12e,_0x1c2333){return new BPromise(function(_0x4b5c2d,_0x1cfdbd){var _0x184dc8=_0x1c2333||client;return _0x184dc8[_0x563b('0x16')](_0x39a3d9,_0x52d12e)[_0x563b('0x17')](function(_0x3b697b){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x2a4e13,_0x563b('0x18'));logger['debug'](_0x563b('0x19'),_0x2a4e13,'request\x20sent',JSON['stringify'](_0x3b697b));if(_0x3b697b[_0x563b('0x1a')]){if(_0x3b697b[_0x563b('0x1a')][_0x563b('0x1b')]===0x1f4){logger[_0x563b('0x1a')](_0x563b('0x1c'),_0x2a4e13,_0x3b697b['error'][_0x563b('0x1d')]);return _0x1cfdbd(_0x3b697b[_0x563b('0x1a')][_0x563b('0x1d')]);}logger[_0x563b('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x2a4e13,_0x3b697b[_0x563b('0x1a')][_0x563b('0x1d')]);return _0x4b5c2d(_0x3b697b[_0x563b('0x1a')][_0x563b('0x1d')]);}else{logger['info'](_0x563b('0x1c'),_0x2a4e13,_0x563b('0x18'));_0x4b5c2d(_0x3b697b[_0x563b('0x1e')][_0x563b('0x1d')]);}})[_0x563b('0x1f')](function(_0x1889b0){logger[_0x563b('0x1a')](_0x563b('0x1c'),_0x2a4e13,_0x1889b0);_0x1cfdbd(_0x1889b0);});});}function respondWithStatusCode(_0x56cce8,_0x6ed85c){_0x6ed85c=_0x6ed85c||0xcc;return function(_0x9bf9c){if(_0x9bf9c){return _0x56cce8[_0x563b('0x20')](_0x6ed85c);}return _0x56cce8[_0x563b('0x21')](_0x6ed85c)[_0x563b('0x22')]();};}function respondWithResult(_0x41cbd4,_0x44b8cf){_0x44b8cf=_0x44b8cf||0xc8;return function(_0x56e18e){if(_0x56e18e){return _0x41cbd4['status'](_0x44b8cf)[_0x563b('0x23')](_0x56e18e);}};}function respondWithFilteredResult(_0x29c718,_0x182527){return function(_0x1e86ca){if(_0x1e86ca){var _0x1622ef=typeof _0x182527['offset']===_0x563b('0x24')&&typeof _0x182527[_0x563b('0x25')]===_0x563b('0x24');var _0x4dee69=_0x1e86ca[_0x563b('0x26')];var _0xee4b89=_0x1622ef?0x0:_0x182527[_0x563b('0x27')];var _0x36fb03=_0x1622ef?_0x1e86ca[_0x563b('0x26')]:_0x182527[_0x563b('0x27')]+_0x182527[_0x563b('0x25')];var _0x1ec25f;if(_0x36fb03>=_0x4dee69){_0x36fb03=_0x4dee69;_0x1ec25f=0xc8;}else{_0x1ec25f=0xce;}_0x29c718[_0x563b('0x21')](_0x1ec25f);return _0x29c718[_0x563b('0x28')]('Content-Range',_0xee4b89+'-'+_0x36fb03+'/'+_0x4dee69)['json'](_0x1e86ca);}return null;};}function saveUpdates(_0x112d97){return function(_0x2a4341){if(_0x2a4341){return _0x2a4341[_0x563b('0x29')](_0x112d97)[_0x563b('0x17')](function(_0x3d6a3f){return _0x3d6a3f;});}return null;};}function removeEntity(_0x1fb8e6){return function(_0x47e87a){if(_0x47e87a){return _0x47e87a[_0x563b('0x2a')]()[_0x563b('0x17')](function(){_0x1fb8e6[_0x563b('0x21')](0xcc)[_0x563b('0x22')]();});}};}function handleEntityNotFound(_0xbb5eb6){return function(_0x11b97f){if(!_0x11b97f){_0xbb5eb6['sendStatus'](0x194);}return _0x11b97f;};}function handleError(_0x3418b7,_0x47fc6f){_0x47fc6f=_0x47fc6f||0x1f4;return function(_0x4c2e3b){logger[_0x563b('0x1a')](_0x4c2e3b['stack']);if(_0x4c2e3b['name']){delete _0x4c2e3b[_0x563b('0x2b')];}_0x3418b7[_0x563b('0x21')](_0x47fc6f)['send'](_0x4c2e3b);};}function getMustacheRender(_0x2a60ca,_0x547f51){return Mustache[_0x563b('0x2c')](_0x2a60ca,_['merge'](_0x547f51[_0x563b('0x2d')],{'contact':_0x547f51['contact'],'message':_0x547f51[_0x563b('0x1d')],'agent':_0x547f51['agent'],'interaction':_0x547f51[_0x563b('0x2e')],'account':_0x547f51[_0x563b('0x2f')]}))||'';}exports[_0x563b('0x30')]=function(_0x4719d4,_0xe49f81){var _0x5ad0c0={};var _0x537357=_[_0x563b('0x31')](db[_0x563b('0x32')][_0x563b('0x33')],function(_0xec5431){return{'name':_0xec5431[_0x563b('0x34')],'type':_0xec5431[_0x563b('0x35')][_0x563b('0x36')]};});_0x5ad0c0=qs[_0x563b('0x37')](_0x537357,_0x4719d4);return interaction[_0x563b('0x38')](_0x563b('0x39'),_0x4719d4[_0x563b('0x3a')],_0x4719d4[_0x563b('0x3b')],_0x5ad0c0,_0x537357)[_0x563b('0x17')](respondWithFilteredResult(_0xe49f81,_0x5ad0c0))[_0x563b('0x1f')](handleError(_0xe49f81,null));};exports['show']=function(_0x8f025,_0x5ea37f){var _0x2a2737={'raw':![],'where':{'id':_0x8f025[_0x563b('0x3c')]['id']}},_0x9e6ab3={};_0x9e6ab3[_0x563b('0x3d')]=_['keys'](db['ChatInteraction'][_0x563b('0x33')]);_0x9e6ab3[_0x563b('0x3a')]=_[_0x563b('0x3e')](_0x8f025[_0x563b('0x3a')]);_0x9e6ab3[_0x563b('0x3f')]=_[_0x563b('0x40')](_0x9e6ab3[_0x563b('0x3d')],_0x9e6ab3[_0x563b('0x3a')]);_0x2a2737[_0x563b('0x41')]=_[_0x563b('0x40')](_0x9e6ab3[_0x563b('0x3d')],qs[_0x563b('0x42')](_0x8f025[_0x563b('0x3a')][_0x563b('0x42')]));_0x2a2737['attributes']=_0x2a2737[_0x563b('0x41')]['length']?_0x2a2737[_0x563b('0x41')]:_0x9e6ab3[_0x563b('0x3d')];if(_0x8f025[_0x563b('0x3a')]['includeAll']){_0x2a2737[_0x563b('0x43')]=[{'all':!![]}];}_0x2a2737=_[_0x563b('0x44')]({},_0x2a2737,_0x8f025['options']);return db[_0x563b('0x32')]['find'](_0x2a2737)[_0x563b('0x17')](handleEntityNotFound(_0x5ea37f,null))[_0x563b('0x17')](respondWithResult(_0x5ea37f,null))['catch'](handleError(_0x5ea37f,null));};exports[_0x563b('0x45')]=function(_0x1fffda,_0x16a267){return db[_0x563b('0x32')][_0x563b('0x45')](_0x1fffda['body'],{})['then'](respondWithResult(_0x16a267,0xc9))[_0x563b('0x1f')](handleError(_0x16a267,null));};exports[_0x563b('0x29')]=function(_0x1a0856,_0x58f765){if(_0x1a0856[_0x563b('0x2d')]['id']){delete _0x1a0856['body']['id'];}return db[_0x563b('0x32')][_0x563b('0x46')]({'where':{'id':_0x1a0856[_0x563b('0x3c')]['id']}})[_0x563b('0x17')](handleEntityNotFound(_0x58f765,null))[_0x563b('0x17')](saveUpdates(_0x1a0856['body'],null))[_0x563b('0x17')](respondWithResult(_0x58f765,null))[_0x563b('0x1f')](handleError(_0x58f765,null));};exports['destroy']=function(_0x48742,_0x67a5ea){return db[_0x563b('0x32')]['find']({'where':{'id':_0x48742['params']['id']}})['then'](handleEntityNotFound(_0x67a5ea,null))[_0x563b('0x17')](removeEntity(_0x67a5ea,null))[_0x563b('0x1f')](handleError(_0x67a5ea,null));};exports[_0x563b('0x47')]=function(_0x12ba44,_0x5c61f7){return db[_0x563b('0x32')]['describe']()[_0x563b('0x17')](respondWithResult(_0x5c61f7,null))[_0x563b('0x1f')](handleError(_0x5c61f7,null));};exports[_0x563b('0x48')]=function(_0x49ef91,_0xbfecbe){var _0x37f1b6=_0x49ef91[_0x563b('0x3c')]['id'];var _0x4f870b;var _0x28f1f4;var _0x122d94;return db[_0x563b('0x32')][_0x563b('0x49')]({'where':{'id':_0x37f1b6}})[_0x563b('0x17')](function(_0x533061){_0x4f870b=_0x533061;return db[_0x563b('0x4a')]['findOne']({'where':{'id':_0x533061['ChatWebsiteId']},'attributes':['id',_0x563b('0x4b'),_0x563b('0x4c'),_0x563b('0x4d'),_0x563b('0x4e'),_0x563b('0x4f')],'raw':!![]});})[_0x563b('0x17')](function(_0x20e570){if(_0x20e570&&_0x20e570[_0x563b('0x4b')]&&_0x20e570['vidaooEscalation']){_0x28f1f4=_0x20e570;var _0x2f9954={'interaction':{'id':_0x37f1b6},'agent':{'id':_0x49ef91[_0x563b('0x3b')]['id'],'name':_0x49ef91[_0x563b('0x3b')][_0x563b('0x2b')],'fullname':_0x49ef91[_0x563b('0x3b')]['fullname'],'email':_0x49ef91[_0x563b('0x3b')][_0x563b('0x50')]},'contact':_0x49ef91['body']['contact'],'account':_0x49ef91[_0x563b('0x2d')]['account']};var _0x5ce761={'rejectUnauthorized':![],'method':_0x563b('0x51'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x20e570[_0x563b('0x4b')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x49ef91[_0x563b('0x3b')][_0x563b('0x50')]],'buttons':null,'topic':_0x28f1f4['vidaooTopic'],'note':_[_0x563b('0x52')](_0x28f1f4[_0x563b('0x4e')])?null:getMustacheRender(_0x28f1f4[_0x563b('0x4e')],_0x2f9954),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x563b('0x52')](_0x28f1f4[_0x563b('0x4f')])){var _0x26b378=getMustacheRender(_0x28f1f4['vidaooMetadata'],_0x2f9954);var _0x512282=JSON[_0x563b('0x53')](_0x26b378);_0x5ce761[_0x563b('0x2d')][_0x563b('0x54')]=_0x512282;}}catch(_0x44e222){throw new db[(_0x563b('0x55'))][(_0x563b('0x56'))](_0x563b('0x57'));}return rp(_0x5ce761);}else{throw new db[(_0x563b('0x55'))][(_0x563b('0x56'))](_0x563b('0x58'));}})['then'](function(_0x21655b){_0x122d94=_0x21655b;if(_0x122d94['id']){var _0x1c9931={'body':_0x122d94['join_url'],'ChatWebsiteId':_0x28f1f4['id'],'ChatInteractionId':_0x4f870b['id'],'direction':_0x563b('0x59'),'UserId':_0x49ef91['user']['id']};return db[_0x563b('0x5a')][_0x563b('0x45')](_0x1c9931,{});}else{throw new db[(_0x563b('0x55'))][(_0x563b('0x56'))](_0x563b('0x5b'));}})[_0x563b('0x17')](function(){return _0x4f870b['updateAttributes']({'vidaooSessionId':_0x122d94['id']});})[_0x563b('0x17')](respondWithResult(_0xbfecbe,null))['catch'](handleError(_0xbfecbe,null));};exports[_0x563b('0x5c')]=function(_0xd9bab1,_0x1dcfea){if(_0xd9bab1['body']['id']){delete _0xd9bab1[_0x563b('0x2d')]['id'];}return db[_0x563b('0x32')][_0x563b('0x46')]({'where':{'id':_0xd9bab1[_0x563b('0x3c')]['id']},'include':[{'model':db[_0x563b('0x5d')],'as':_0x563b('0x5e')}]})['then'](handleEntityNotFound(_0x1dcfea,null))[_0x563b('0x17')](saveUpdates(_0xd9bab1[_0x563b('0x2d')],null))[_0x563b('0x17')](respondWithResult(_0x1dcfea,null))[_0x563b('0x1f')](handleError(_0x1dcfea,null));};exports['abandon']=function(_0x14ae4d,_0x2ff09e){if(_0x14ae4d[_0x563b('0x2d')]['id']){delete _0x14ae4d[_0x563b('0x2d')]['id'];}return db[_0x563b('0x32')][_0x563b('0x46')]({'where':{'id':_0x14ae4d['params']['id']}})['then'](function(_0x3d150f){if(!_0x3d150f){logger['error'](_0x563b('0x5f'),'abandon',0x194,_0x563b('0x60'));_0x2ff09e[_0x563b('0x20')](0x194);}else{if(_0x3d150f['UserId']){throw new db['Sequelize'][(_0x563b('0x56'))](_0x563b('0x61'));}}return _0x3d150f;})[_0x563b('0x17')](function(_0x16cd46){if(_0x16cd46){return _0x16cd46[_0x563b('0x29')]({'closed':_0x14ae4d[_0x563b('0x2d')][_0x563b('0x62')],'disposition':_0x14ae4d[_0x563b('0x2d')][_0x563b('0x63')]})['then'](function(_0x564d32){return _0x564d32;});}})[_0x563b('0x17')](function(){return respondWithRpcPromise(_0x563b('0x64'),'abandon',_0x14ae4d[_0x563b('0x2d')],client9004);})['then'](respondWithResult(_0x2ff09e,null))[_0x563b('0x1f')](handleError(_0x2ff09e,null));};exports['attachmentUpload']=function(_0x395703,_0x4ca441){_0x395703[_0x563b('0x2d')][_0x563b('0x2b')]=_0x395703[_0x563b('0x65')][_0x563b('0x66')];_0x395703[_0x563b('0x2d')]['basename']=_0x395703[_0x563b('0x65')][_0x563b('0x67')];_0x395703['body'][_0x563b('0x35')]=_0x395703['file'][_0x563b('0x68')];return db[_0x563b('0x69')]['create'](_0x395703['body'])[_0x563b('0x17')](respondWithResult(_0x4ca441,0xc9))[_0x563b('0x1f')](handleError(_0x4ca441,null));};exports[_0x563b('0x6a')]=function(_0x13f7a0,_0x4cdb51){return db[_0x563b('0x32')][_0x563b('0x49')]({'where':{'id':_0x13f7a0['params']['id']},'raw':!![]})[_0x563b('0x17')](handleEntityNotFound(_0x4cdb51,null))[_0x563b('0x17')](function(_0x1bb925){if(_0x1bb925){if(_0x1bb925['closed']){return _0x4cdb51[_0x563b('0x21')](0x193)[_0x563b('0x23')]({'status':0x193,'message':_0x563b('0x6b')});}return db[_0x563b('0x69')][_0x563b('0x49')]({'where':{'id':_0x13f7a0[_0x563b('0x3a')][_0x563b('0x6c')]},'raw':!![]})[_0x563b('0x17')](handleEntityNotFound(_0x4cdb51,null));}})[_0x563b('0x17')](function(_0x4b5411){if(_0x4b5411){var _0x59d329=_0x4b5411[_0x563b('0x6d')]!==null;var _0xe6df85=path[_0x563b('0x6e')](config[_0x563b('0x6f')],_0x563b('0x70'));if(_0x59d329){_0xe6df85=path[_0x563b('0x6e')](_0xe6df85,'offline-chat/');}var _0x1c99cc=path['join'](_0xe6df85,_0x4b5411[_0x563b('0x71')]);return _0x4cdb51[_0x563b('0x72')](_0x1c99cc);}})['catch'](handleError(_0x4cdb51,null));};exports[_0x563b('0x73')]=function(_0x5de8ee,_0x12efea){var _0x2c9a0f=null;var _0x5e29a3=null;var _0x182317=null;if(_0x5de8ee[_0x563b('0x2d')]['id']){delete _0x5de8ee[_0x563b('0x2d')]['id'];}if(_0x5de8ee['body'][_0x563b('0x74')]){_0x182317=path[_0x563b('0x6e')](config[_0x563b('0x6f')],_0x563b('0x75'),util[_0x563b('0x76')](_0x563b('0x77'),Date['now']()));_0x5de8ee[_0x563b('0x2d')][_0x563b('0x78')]=_0x182317;}return db[_0x563b('0x32')][_0x563b('0x46')]({'where':{'id':_0x5de8ee[_0x563b('0x3c')]['id']},'include':[{'model':db[_0x563b('0x5a')],'as':_0x563b('0x79'),'include':[{'model':db[_0x563b('0x7a')],'as':_0x563b('0x7a')}]}]})[_0x563b('0x17')](handleEntityNotFound(_0x12efea,null))[_0x563b('0x17')](saveUpdates(_0x5de8ee[_0x563b('0x2d')],null))[_0x563b('0x17')](function(_0x322c5b){if(_0x322c5b){_0x2c9a0f=_0x322c5b;return db[_0x563b('0x4a')][_0x563b('0x46')]({'where':{'id':_0x2c9a0f[_0x563b('0x7b')]}});}})[_0x563b('0x17')](function(_0x3a5839){if(_0x3a5839){_0x5e29a3=_0x3a5839;return db[_0x563b('0x5d')]['find']({'where':{'id':_0x2c9a0f[_0x563b('0x7c')]}});}})[_0x563b('0x17')](function(_0x51d742){if(_0x51d742){if(_0x182317){var _0x970855=null;for(var _0xafbc42=0x1;_0xafbc42<_0x2c9a0f[_0x563b('0x79')][_0x563b('0x7d')];++_0xafbc42){_0x970855=_0x2c9a0f[_0x563b('0x79')][_0xafbc42];var _0xa33618=_0x970855[_0x563b('0x7e')]?util[_0x563b('0x76')](_0x563b('0x7f'),_0x5e29a3[_0x563b('0x80')],_0x970855[_0x563b('0x7e')]):_0x563b('0x81');var _0x58e2ba=_0x5de8ee[_0x563b('0x2d')][_0x563b('0x82')]||util[_0x563b('0x76')](_0x563b('0x7f'),_0x563b('0x83'),_0x970855['ContactId']);switch(_0x5e29a3[_0x563b('0x84')]){case _0x563b('0x85'):_0xa33618=_0x970855[_0x563b('0x7e')]?util[_0x563b('0x76')]('%s%d',_0x5e29a3[_0x563b('0x80')],_0x970855[_0x563b('0x7e')]):_0x563b('0x81');break;case _0x563b('0x86'):_0xa33618=_0x970855[_0x563b('0x7e')]?_0x970855['User'][_0x563b('0x87')]||_0x970855[_0x563b('0x7a')][_0x563b('0x88')]:_0x563b('0x81');break;case _0x563b('0x89'):_0xa33618=_0x970855[_0x563b('0x7e')]?_0x970855[_0x563b('0x7a')]['fullname']:_0x563b('0x81');break;default:_0xa33618=_0x970855['UserId']?util[_0x563b('0x76')]('%s%d',_0x5e29a3['agentAlias'],_0x970855[_0x563b('0x7e')]):'System';}var _0x4dfc2b=util[_0x563b('0x76')](_0x563b('0x8a'),moment(_0x970855[_0x563b('0x8b')])[_0x563b('0x76')](_0x563b('0x8c')),_0x970855[_0x563b('0x8d')]==='in'?_0x58e2ba:_0xa33618,_0x970855[_0x563b('0x2d')]);if(!_0x970855[_0x563b('0x8e')]){fs[_0x563b('0x8f')](_0x182317,_0x4dfc2b);}}return db['MailAccount'][_0x563b('0x49')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x563b('0x90')],'as':_0x563b('0x90'),'raw':!![]}]}]});}}})[_0x563b('0x17')](function(_0x2d5dcf){if(!_0x2d5dcf||!_0x2d5dcf[_0x563b('0x91')]||!_0x5de8ee[_0x563b('0x2d')])return _0x2c9a0f;var _0x58c210=_0x2d5dcf['getSmtpOptions']();return respondWithRpcPromise(_0x563b('0x92'),_0x563b('0x93'),{'account':_0x58c210,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x2d5dcf['name'],_0x2d5dcf['email']||_0x2d5dcf[_0x563b('0x91')]['user']),'to':_0x5de8ee['body']['mailTranscript'],'subject':_0x563b('0x94'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x5de8ee['body'][_0x563b('0x74')]),'attachments':[{'path':_0x182317}]}})[_0x563b('0x17')](function(){return _0x2c9a0f;})[_0x563b('0x1f')](function(_0x4ecf85){logger['error'](_0x4ecf85);});})[_0x563b('0x17')](respondWithStatusCode(_0x12efea,0xc8))[_0x563b('0x1f')](handleError(_0x12efea,null));};exports['addMessage']=function(_0x598cc3,_0x31f6bb){return db[_0x563b('0x5a')][_0x563b('0x46')]({'where':{'id':_0x598cc3[_0x563b('0x3c')]['id']}})['then'](handleEntityNotFound(_0x31f6bb,null))[_0x563b('0x17')](function(_0x4281cd){if(_0x4281cd){return _0x4281cd[_0x563b('0x95')](_0x598cc3[_0x563b('0x2d')][_0x563b('0x96')],_[_0x563b('0x97')](_0x598cc3[_0x563b('0x2d')],[_0x563b('0x96'),'id'])||{});}})['then'](respondWithResult(_0x31f6bb,null))[_0x563b('0x1f')](handleError(_0x31f6bb,null));};exports[_0x563b('0x98')]=function(_0x44a55e,_0x4ee59f){var _0x42c8f3={'raw':![],'where':{}};var _0x19802d={};var _0x511f11={'count':0x0,'rows':[]};return db[_0x563b('0x32')][_0x563b('0x49')]({'where':{'id':_0x44a55e['params']['id']}})[_0x563b('0x17')](handleEntityNotFound(_0x4ee59f,null))[_0x563b('0x17')](function(_0xe849ab){if(_0xe849ab){_0x19802d[_0x563b('0x3d')]=_[_0x563b('0x3e')](db['ChatMessage']['rawAttributes']);_0x19802d[_0x563b('0x3a')]=_['keys'](_0x44a55e[_0x563b('0x3a')]);_0x19802d[_0x563b('0x3f')]=_[_0x563b('0x40')](_0x19802d[_0x563b('0x3d')],_0x19802d[_0x563b('0x3a')]);_0x42c8f3['attributes']=_[_0x563b('0x40')](_0x19802d[_0x563b('0x3d')],qs['fields'](_0x44a55e[_0x563b('0x3a')][_0x563b('0x42')]));_0x42c8f3[_0x563b('0x41')]=_0x42c8f3[_0x563b('0x41')][_0x563b('0x7d')]?_0x42c8f3[_0x563b('0x41')]:_0x19802d['model'];if(!_0x44a55e[_0x563b('0x3a')][_0x563b('0x99')](_0x563b('0x9a'))){_0x42c8f3[_0x563b('0x25')]=qs['limit'](_0x44a55e[_0x563b('0x3a')][_0x563b('0x25')]);_0x42c8f3[_0x563b('0x27')]=qs[_0x563b('0x27')](_0x44a55e[_0x563b('0x3a')][_0x563b('0x27')]);}_0x42c8f3[_0x563b('0x9b')]=qs[_0x563b('0x9c')](_0x44a55e[_0x563b('0x3a')][_0x563b('0x9c')]);_0x42c8f3[_0x563b('0x9d')]=qs[_0x563b('0x3f')](_[_0x563b('0x9e')](_0x44a55e['query'],_0x19802d[_0x563b('0x3f')]));_0x42c8f3['where'][_0x563b('0x9f')]=_0xe849ab['id'];if(_0x44a55e[_0x563b('0x3a')][_0x563b('0xa0')]){_0x42c8f3[_0x563b('0x9d')]=_[_0x563b('0x44')](_0x42c8f3[_0x563b('0x9d')],{'$or':_[_0x563b('0x31')](_0x42c8f3[_0x563b('0x41')],function(_0x6d7899){var _0x40f06a={};_0x40f06a[_0x6d7899]={'$like':'%'+_0x44a55e[_0x563b('0x3a')]['filter']+'%'};return _0x40f06a;})});}if(_0x44a55e[_0x563b('0x3a')][_0x563b('0xa1')]){var _0x18c95b=_0x44a55e['query'][_0x563b('0xa1')][_0x563b('0xa2')](',');var _0x50a20c={};_0x50a20c[_0x18c95b[0x0]]={'$gte':moment(_0x18c95b[0x1])[_0x563b('0x76')](_0x563b('0xa3'))};_0x42c8f3[_0x563b('0x9d')]=_[_0x563b('0x44')](_0x42c8f3['where'],_0x50a20c);}_0x42c8f3=_[_0x563b('0x44')]({},_0x42c8f3,_0x44a55e[_0x563b('0xa4')]);return db[_0x563b('0x5a')][_0x563b('0x26')]({'where':_0x42c8f3[_0x563b('0x9d')]})[_0x563b('0x17')](function(_0x593feb){_0x511f11[_0x563b('0x26')]=_0x593feb;if(_0x44a55e[_0x563b('0x3a')]['includeAll']){_0x42c8f3[_0x563b('0x43')]=[{'all':!![]}];}return db[_0x563b('0x5a')]['findAll'](_0x42c8f3);})[_0x563b('0x17')](function(_0x15cedc){_0x511f11[_0x563b('0xa5')]=_0x15cedc;return _0x511f11;});}})[_0x563b('0x17')](respondWithFilteredResult(_0x4ee59f,_0x42c8f3))[_0x563b('0x1f')](handleError(_0x4ee59f,null));};exports[_0x563b('0xa6')]=function(_0xe44077,_0x2d4e28){var _0x417b1d={'where':{}},_0x5142d0={},_0x1069e1={'count':0x0,'rows':[]};return db[_0x563b('0x32')][_0x563b('0x49')]({'where':{'id':_0xe44077[_0x563b('0x3c')]['id']}})[_0x563b('0x17')](handleEntityNotFound(_0x2d4e28,null))[_0x563b('0x17')](function(_0x641552){if(_0x641552){_0x5142d0[_0x563b('0x3d')]=_[_0x563b('0x3e')](db[_0x563b('0x5a')][_0x563b('0x33')]);_0x5142d0[_0x563b('0x3a')]=_['keys'](_0xe44077['query']);_0x5142d0[_0x563b('0x3f')]=_[_0x563b('0x40')](_0x5142d0['model'],_0x5142d0[_0x563b('0x3a')]);_0x417b1d['attributes']=_[_0x563b('0x40')](_0x5142d0[_0x563b('0x3d')],qs[_0x563b('0x42')](_0xe44077[_0x563b('0x3a')][_0x563b('0x42')]));_0x417b1d[_0x563b('0x41')]=_0x417b1d['attributes'][_0x563b('0x7d')]?_0x417b1d[_0x563b('0x41')]:_0x5142d0[_0x563b('0x3d')];if(!_0xe44077['query'][_0x563b('0x99')](_0x563b('0x9a'))){_0x417b1d[_0x563b('0x25')]=qs[_0x563b('0x25')](_0xe44077[_0x563b('0x3a')]['limit']);_0x417b1d['offset']=qs[_0x563b('0x27')](_0xe44077[_0x563b('0x3a')][_0x563b('0x27')]);}_0x417b1d[_0x563b('0x9b')]=qs[_0x563b('0x9c')](_0xe44077['query']['sort']);_0x417b1d[_0x563b('0x9d')]=qs[_0x563b('0x3f')](_['pick'](_0xe44077[_0x563b('0x3a')],_0x5142d0[_0x563b('0x3f')]));_0x417b1d['where'][_0x563b('0x9f')]=_0x641552['id'];if(_0xe44077[_0x563b('0x3a')][_0x563b('0xa0')]){_0x417b1d['where']=_[_0x563b('0x44')](_0x417b1d[_0x563b('0x9d')],{'$or':_[_0x563b('0x31')](_0x417b1d[_0x563b('0x41')],function(_0x3562aa){var _0x500b40={};_0x500b40[_0x3562aa]={'$like':'%'+_0xe44077['query'][_0x563b('0xa0')]+'%'};return _0x500b40;})});}_0x417b1d[_0x563b('0x9d')][_0x563b('0x8e')]=![];if(_0xe44077[_0x563b('0x3a')]['id']){_0x417b1d[_0x563b('0x9d')]['id']={'$gt':_0xe44077[_0x563b('0x3a')]['id']};}_0x417b1d=_[_0x563b('0x44')]({},_0x417b1d,_0xe44077[_0x563b('0xa4')]);return db[_0x563b('0x5a')][_0x563b('0x26')]({'where':_0x417b1d[_0x563b('0x9d')]})[_0x563b('0x17')](function(_0x28e1a4){_0x1069e1[_0x563b('0x26')]=_0x28e1a4;_0x417b1d['include']=[];if(_0xe44077[_0x563b('0x3a')][_0x563b('0xa7')]){_0x417b1d[_0x563b('0x43')][_0x563b('0xa8')]({'model':db[_0x563b('0x7a')],'as':_0x563b('0x7a'),'attributes':['id',_0x563b('0x88'),_0x563b('0x87')]});}if(_0xe44077[_0x563b('0x3a')][_0x563b('0xa9')]){_0x417b1d[_0x563b('0x43')]=[{'all':!![]}];}return db[_0x563b('0x5a')][_0x563b('0x38')](_0x417b1d);})[_0x563b('0x17')](function(_0x38cae7){_0x1069e1['rows']=_0x38cae7;return _0x1069e1;});}})[_0x563b('0x17')](respondWithFilteredResult(_0x2d4e28,_0x417b1d))[_0x563b('0x1f')](handleError(_0x2d4e28,null));};exports['addTags']=function(_0x436b52,_0x35075f){return db[_0x563b('0x32')][_0x563b('0x46')]({'where':{'id':_0x436b52['params']['id']}})[_0x563b('0x17')](handleEntityNotFound(_0x35075f,null))['then'](function(_0x4c2072){if(_0x4c2072){return _0x4c2072[_0x563b('0xaa')](_0x436b52[_0x563b('0x2d')]['ids'],_[_0x563b('0x97')](_0x436b52['body'],[_0x563b('0x96'),'id'])||{})['spread'](function(){return db[_0x563b('0xab')]['findAll']({'attributes':['id',_0x563b('0x2b'),_0x563b('0xac')],'where':{'id':_0x436b52[_0x563b('0x2d')][_0x563b('0x96')]}});})[_0x563b('0x17')](function(_0x566399){socket[_0x563b('0xad')](_0x563b('0xae'),{'id':Number(_0x436b52[_0x563b('0x3c')]['id']),'tags':_0x566399||[]});return{'id':Number(_0x436b52[_0x563b('0x3c')]['id']),'tags':_0x566399||[]};});}})['then'](respondWithResult(_0x35075f,null))[_0x563b('0x1f')](handleError(_0x35075f,null));};exports[_0x563b('0xaf')]=function(_0x7e3bc1,_0x401571){return db['ChatInteraction'][_0x563b('0x46')]({'where':{'id':_0x7e3bc1[_0x563b('0x3c')]['id']}})['then'](handleEntityNotFound(_0x401571,null))[_0x563b('0x17')](function(_0x41b5d0){if(_0x41b5d0){return _0x41b5d0['removeTags'](_0x7e3bc1[_0x563b('0x3a')]['ids']);}})['then'](respondWithStatusCode(_0x401571,null))[_0x563b('0x1f')](handleError(_0x401571,null));};exports['download']=function(_0x441855,_0x6f0e21){var _0x49748a=moment()[_0x563b('0xb0')]()['toString']();var _0x5a96cc=path[_0x563b('0x6e')](config[_0x563b('0x6f')],_0x563b('0xb1'),_0x563b('0xb2'),_0x563b('0xb3'));var _0x3ab220=path[_0x563b('0x6e')](config[_0x563b('0x6f')],_0x563b('0xb1'),_0x563b('0xb2'),_0x563b('0xb4'));var _0x3bb5bb=path[_0x563b('0x6e')](_0x5a96cc,_0x49748a);var _0x1c0497=util[_0x563b('0x76')]('transcript-%d-%s.zip',_0x441855['params']['id'],_0x49748a);var _0x4dc176=path[_0x563b('0x6e')](_0x5a96cc,_0x1c0497);var _0x144548=[];_0x144548[_0x563b('0xa8')]({'model':db[_0x563b('0x7a')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x144548['push']({'model':db[_0x563b('0x5d')],'as':_0x563b('0x5e'),'attributes':['id',_0x563b('0xb5'),_0x563b('0xb6')],'raw':!![]});if(_0x441855[_0x563b('0x3a')][_0x563b('0xb4')]){_0x144548[_0x563b('0xa8')]({'model':db[_0x563b('0x69')],'as':_0x563b('0x69'),'raw':!![]});}var _0x5bfd02=[{'model':db[_0x563b('0x5a')],'as':'Messages','attributes':['id',_0x563b('0x2d'),_0x563b('0x8b'),_0x563b('0x8d'),_0x563b('0x8e'),'read'],'include':_0x144548}];_0x5bfd02[_0x563b('0xa8')]({'model':db[_0x563b('0x4a')],'as':'Account','attributes':['id','name']});_0x5bfd02[_0x563b('0xa8')]({'model':db[_0x563b('0x7a')],'as':_0x563b('0xb7'),'attributes':['id',_0x563b('0x88')]});return db[_0x563b('0x32')][_0x563b('0x46')]({'where':{'id':_0x441855['params']['id']},'include':_0x5bfd02})[_0x563b('0x17')](handleEntityNotFound(_0x6f0e21,null))['then'](function(_0x61a141){if(_0x61a141){var _0x4700ed=_0x61a141[_0x563b('0xb8')]({'plain':!![]});fs[_0x563b('0xb9')](_0x3bb5bb);var _0x4dcf4f={'channel':'Chat','account':_0x4700ed[_0x563b('0xba')][_0x563b('0x2b')],'agent':_0x4700ed[_0x563b('0xb7')]?_0x4700ed[_0x563b('0xb7')][_0x563b('0x88')]:_0x563b('0xbb'),'createdAt':moment(_0x4700ed['createdAt'])[_0x563b('0x76')]('YYYY-MM-DD\x20HH:mm:ss')[_0x563b('0xbc')](),'closedAt':_0x4700ed[_0x563b('0x62')]?moment(_0x4700ed[_0x563b('0xbd')])[_0x563b('0x76')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x4700ed['disposition'],'chatInfo':{'browser':_0x4700ed[_0x563b('0xbe')],'os':_0x4700ed[_0x563b('0xbf')],'referer':_0x4700ed['referer'],'customerIp':_0x4700ed['customerIp'],'customerPort':_0x4700ed[_0x563b('0xc0')]?_0x4700ed[_0x563b('0xc0')]:_0x563b('0xbb')},'messages':_(_0x4700ed[_0x563b('0x79')])[_0x563b('0xc1')]()[_0x563b('0xa0')]({'secret':![]})[_0x563b('0x31')](function(_0x334f7f){if(_0x334f7f['Attachment']){var _0x53816e=path[_0x563b('0x6e')](_0x3ab220,_0x334f7f['Attachment'][_0x563b('0x71')]);if(fs['existsSync'](_0x53816e)){fs[_0x563b('0xc2')](_0x53816e)['pipe'](fs['createWriteStream'](path[_0x563b('0x6e')](_0x3bb5bb,_0x334f7f[_0x563b('0x69')][_0x563b('0x71')])));}}return{'date':moment(_0x334f7f[_0x563b('0x8b')])[_0x563b('0x76')](_0x563b('0xa3'))['toString'](),'sender':_0x334f7f[_0x563b('0x8d')]===_0x563b('0x59')?_0x334f7f[_0x563b('0x7a')]?_0x334f7f['User'][_0x563b('0x88')]:'System':_0x334f7f[_0x563b('0x5e')][_0x563b('0xb5')]+(_0x334f7f[_0x563b('0x5e')][_0x563b('0xb6')]?'\x20'+_0x334f7f[_0x563b('0x5e')][_0x563b('0xb6')]:''),'body':_0x334f7f[_0x563b('0x69')]?_0x334f7f['Attachment'][_0x563b('0x71')]:_0x334f7f[_0x563b('0x2d')],'direction':_0x334f7f[_0x563b('0x8d')]==='out'?'A':'C','secret':_0x334f7f[_0x563b('0x8e')],'read':_0x334f7f[_0x563b('0xc3')],'attachment':_0x334f7f[_0x563b('0x69')]};})[_0x563b('0xc4')]()};return ejs[_0x563b('0xc5')](path['join'](config[_0x563b('0x6f')],_0x563b('0xb1'),_0x563b('0xc6'),'downloadInteraction.ejs'),{'interaction':_0x4dcf4f})['then'](function(_0x3d9bc2){var _0x4cf79d=path[_0x563b('0x6e')](_0x3bb5bb,'transcript-'+_0x4700ed['id']+'-'+_0x49748a+_0x563b('0xc7'));var _0xe896da={'path':_0x4cf79d,'channel':_0x563b('0xc8'),'interactionId':_0x4700ed['id']};return pdf[_0x563b('0xc9')](_0x3d9bc2,_0xe896da);})['then'](function(){return new Promise(function(_0x3dab2d,_0x23ce9a){zipdir(_0x3bb5bb,{'saveTo':_0x4dc176},function(_0x4efeb3,_0x334156){if(_0x4efeb3)return _0x23ce9a(_0x4efeb3);return _0x3dab2d(_0x334156);});})[_0x563b('0x17')](function(){return new BPromise(function(_0x5a4010,_0x3e3416){rimraf(_0x3bb5bb,function(_0x37233b){if(_0x37233b)_0x3e3416(_0x37233b);return _0x5a4010();});});})[_0x563b('0x17')](function(){return _0x6f0e21[_0x563b('0x72')](_0x4dc176,_0x1c0497,function(_0x5b51ec){if(_0x5b51ec){logger[_0x563b('0x1a')](_0x563b('0xca'),_0x5b51ec);}else{fs[_0x563b('0xcb')](_0x4dc176);}});});});}else{return _0x6f0e21[_0x563b('0x20')](0xc8);}})[_0x563b('0x1f')](handleError(_0x6f0e21,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index cab2d96..5b08757 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 _0x8042=['../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','events'];(function(_0x5b73ff,_0x1cba4d){var _0x1c4ba4=function(_0x319db1){while(--_0x319db1){_0x5b73ff['push'](_0x5b73ff['shift']());}};_0x1c4ba4(++_0x1cba4d);}(_0x8042,0x109));var _0x2804=function(_0x33337f,_0x5d7319){_0x33337f=_0x33337f-0x0;var _0x3d9d50=_0x8042[_0x33337f];return _0x3d9d50;};'use strict';var EventEmitter=require(_0x2804('0x0'));var ChatInteraction=require(_0x2804('0x1'))['db'][_0x2804('0x2')];var ChatMessage=require(_0x2804('0x1'))['db'][_0x2804('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x2804('0x4')](0x0);var events={'afterCreate':_0x2804('0x5'),'afterUpdate':_0x2804('0x6'),'afterDestroy':_0x2804('0x7')};function emitEvent(_0x4e5e9a){return function(_0xa25ce0,_0x371bf3,_0x293818){_0xa25ce0[_0x2804('0x8')]({'attributes':['id'],'raw':!![]})[_0x2804('0x9')](function(_0x5df58f){_0xa25ce0[_0x2804('0xa')](_0x2804('0xb'),_0x5df58f[_0x2804('0xc')](function(_0x594195){return{'id':_0x594195['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0xa25ce0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2804('0x9')](function(_0x294f3a){_0xa25ce0[_0x2804('0xa')](_0x2804('0xd'),_0x294f3a[_0x2804('0xe')]);ChatInteractionEvents['emit'](_0x4e5e9a+':'+_0xa25ce0['id'],_0xa25ce0);ChatInteractionEvents[_0x2804('0xf')](_0x4e5e9a,_0xa25ce0);_0x293818(null);})[_0x2804('0x10')](_0x293818(null));};}for(var e in events){if(events[_0x2804('0x11')](e)){var event=events[e];ChatInteraction[_0x2804('0x12')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x5428=['ChatInteraction','ChatMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x35f5a5,_0x3f8a65){var _0x143dce=function(_0x5c3197){while(--_0x5c3197){_0x35f5a5['push'](_0x35f5a5['shift']());}};_0x143dce(++_0x3f8a65);}(_0x5428,0x1eb));var _0x8542=function(_0x47eed5,_0x91ec98){_0x47eed5=_0x47eed5-0x0;var _0x59fb5f=_0x5428[_0x47eed5];return _0x59fb5f;};'use strict';var EventEmitter=require(_0x8542('0x0'));var ChatInteraction=require(_0x8542('0x1'))['db'][_0x8542('0x2')];var ChatMessage=require(_0x8542('0x1'))['db'][_0x8542('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x8542('0x4')](0x0);var events={'afterCreate':_0x8542('0x5'),'afterUpdate':'update','afterDestroy':_0x8542('0x6')};function emitEvent(_0xb3ab65){return function(_0x415ef0,_0x200d42,_0x7efcba){_0x415ef0[_0x8542('0x7')]({'attributes':['id'],'raw':!![]})[_0x8542('0x8')](function(_0x407275){_0x415ef0[_0x8542('0x9')]('Users',_0x407275[_0x8542('0xa')](function(_0x3aaf2c){return{'id':_0x3aaf2c['id']};}));return ChatMessage[_0x8542('0xb')]({'where':{'ChatInteractionId':_0x415ef0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8542('0x8')](function(_0x4696cc){_0x415ef0['setDataValue'](_0x8542('0xc'),_0x4696cc['length']);ChatInteractionEvents[_0x8542('0xd')](_0xb3ab65+':'+_0x415ef0['id'],_0x415ef0);ChatInteractionEvents[_0x8542('0xd')](_0xb3ab65,_0x415ef0);_0x7efcba(null);})[_0x8542('0xe')](_0x7efcba(null));};}for(var e in events){if(events[_0x8542('0xf')](e)){var event=events[e];ChatInteraction[_0x8542('0x10')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index cb797c1..986d8cf 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 _0xcaab=['utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xcaab,0x1d6));var _0xbcaa=function(_0x59c220,_0x5cd466){_0x59c220=_0x59c220-0x0;var _0x35c0a4=_0xcaab[_0x59c220];return _0x35c0a4;};'use strict';var _=require('lodash');var util=require(_0xbcaa('0x0'));var logger=require('../../config/logger')(_0xbcaa('0x1'));var moment=require(_0xbcaa('0x2'));var BPromise=require(_0xbcaa('0x3'));var rp=require(_0xbcaa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbcaa('0x5'));var config=require(_0xbcaa('0x6'));var attributes=require('./chatInteraction.attributes');module[_0xbcaa('0x7')]=function(_0x4cbb06,_0x3c9a63){return _0x4cbb06[_0xbcaa('0x8')](_0xbcaa('0x9'),attributes,{'tableName':_0xbcaa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e00c4,_0x1142ba,_0x4020bb){if(_0x2e00c4[_0xbcaa('0xb')](_0xbcaa('0xc'))){_0x2e00c4[_0xbcaa('0xd')]=moment()[_0xbcaa('0xe')](_0xbcaa('0xf'));}_0x4020bb(null,_0x2e00c4);}},'charset':_0xbcaa('0x10'),'collate':_0xbcaa('0x11')});}; \ No newline at end of file +var _0x7606=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7606,0x8d));var _0x6760=function(_0x42d041,_0x4a3448){_0x42d041=_0x42d041-0x0;var _0x14b609=_0x7606[_0x42d041];return _0x14b609;};'use strict';var _=require(_0x6760('0x0'));var util=require(_0x6760('0x1'));var logger=require(_0x6760('0x2'))(_0x6760('0x3'));var moment=require(_0x6760('0x4'));var BPromise=require(_0x6760('0x5'));var rp=require(_0x6760('0x6'));var fs=require('fs');var path=require(_0x6760('0x7'));var rimraf=require(_0x6760('0x8'));var config=require(_0x6760('0x9'));var attributes=require(_0x6760('0xa'));module[_0x6760('0xb')]=function(_0xb07b5,_0xb57fc6){return _0xb07b5[_0x6760('0xc')](_0x6760('0xd'),attributes,{'tableName':_0x6760('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ca3cf,_0x2a7853,_0x4ae7cb){if(_0x3ca3cf[_0x6760('0xf')]('closed')){_0x3ca3cf[_0x6760('0x10')]=moment()[_0x6760('0x11')](_0x6760('0x12'));}_0x4ae7cb(null,_0x3ca3cf);}},'charset':'utf8mb4','collate':_0x6760('0x13')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 875f9b4..785015b 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 _0xccca=['ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','stringify','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','then'];(function(_0xe845f0,_0x29ce48){var _0x236cf9=function(_0x2fe93){while(--_0x2fe93){_0xe845f0['push'](_0xe845f0['shift']());}};_0x236cf9(++_0x29ce48);}(_0xccca,0x1db));var _0xaccc=function(_0x4e50af,_0x4300ca){_0x4e50af=_0x4e50af-0x0;var _0x340b78=_0xccca[_0x4e50af];return _0x340b78;};'use strict';var _=require(_0xaccc('0x0'));var util=require(_0xaccc('0x1'));var moment=require(_0xaccc('0x2'));var BPromise=require(_0xaccc('0x3'));var rs=require(_0xaccc('0x4'));var fs=require('fs');var Redis=require(_0xaccc('0x5'));var db=require(_0xaccc('0x6'))['db'];var utils=require(_0xaccc('0x7'));var logger=require('../../config/logger')(_0xaccc('0x8'));var config=require(_0xaccc('0x9'));var jayson=require(_0xaccc('0xa'));var client=jayson[_0xaccc('0xb')][_0xaccc('0xc')]({'port':0x232a});config[_0xaccc('0xd')]=_[_0xaccc('0xe')](config[_0xaccc('0xd')],{'host':_0xaccc('0xf'),'port':0x18eb});var socket=require(_0xaccc('0x10'))(new Redis(config['redis']));require(_0xaccc('0x11'))[_0xaccc('0x12')](socket);function respondWithRpcPromise(_0x311cc5,_0x162d5a,_0x4ab231){return new BPromise(function(_0x3d62ef,_0x3a89c0){return client['request'](_0x311cc5,_0x4ab231)[_0xaccc('0x13')](function(_0x13e3fd){logger['info'](_0xaccc('0x14'),_0x162d5a,'request\x20sent');logger[_0xaccc('0x15')](_0xaccc('0x16'),_0x162d5a,_0xaccc('0x17'),JSON['stringify'](_0x13e3fd));if(_0x13e3fd[_0xaccc('0x18')]){if(_0x13e3fd[_0xaccc('0x18')]['code']===0x1f4){logger[_0xaccc('0x18')](_0xaccc('0x14'),_0x162d5a,_0x13e3fd[_0xaccc('0x18')]['message']);return _0x3a89c0(_0x13e3fd[_0xaccc('0x18')][_0xaccc('0x19')]);}logger['error'](_0xaccc('0x14'),_0x162d5a,_0x13e3fd[_0xaccc('0x18')]['message']);return _0x3d62ef(_0x13e3fd[_0xaccc('0x18')][_0xaccc('0x19')]);}else{logger[_0xaccc('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x162d5a,'request\x20sent');_0x3d62ef(_0x13e3fd[_0xaccc('0x1b')][_0xaccc('0x19')]);}})['catch'](function(_0x2aee32){logger[_0xaccc('0x18')](_0xaccc('0x14'),_0x162d5a,_0x2aee32);_0x3a89c0(_0x2aee32);});});}exports[_0xaccc('0x1c')]=function(_0x527202){var _0x35b214=this;return new Promise(function(_0xf98fed,_0x599e9e){return db[_0xaccc('0x1d')][_0xaccc('0x1e')](_0x527202[_0xaccc('0x1f')],{'raw':_0x527202[_0xaccc('0x20')]?_0x527202[_0xaccc('0x20')][_0xaccc('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x527202[_0xaccc('0x20')]?_0x527202[_0xaccc('0x20')][_0xaccc('0x22')]||null:null,'attributes':_0x527202[_0xaccc('0x20')]?_0x527202[_0xaccc('0x20')][_0xaccc('0x23')]||null:null,'limit':_0x527202[_0xaccc('0x20')]?_0x527202['options']['limit']||null:null})[_0xaccc('0x13')](function(_0x390228){logger['info']('UpdateChatInteraction',_0x527202);logger[_0xaccc('0x15')]('UpdateChatInteraction',_0x527202,JSON[_0xaccc('0x24')](_0x390228));_0xf98fed(_0x390228);})['catch'](function(_0x13fb9e){logger[_0xaccc('0x18')]('UpdateChatInteraction',_0x13fb9e[_0xaccc('0x19')],_0x527202);_0x599e9e(_0x35b214[_0xaccc('0x18')](0x1f4,_0x13fb9e[_0xaccc('0x19')]));});});};exports[_0xaccc('0x25')]=function(_0x5924ba){return new Promise(function(_0x3fa3b5,_0x23503a){return db['ChatInteraction'][_0xaccc('0x26')]({'where':_0x5924ba[_0xaccc('0x20')]?_0x5924ba['options']['where']||null:null})[_0xaccc('0x13')](function(_0x5de58e){if(_0x5de58e){return _0x5de58e[_0xaccc('0x27')](_0x5924ba['body'][_0xaccc('0x28')],_[_0xaccc('0x29')](_0x5924ba[_0xaccc('0x1f')],['ids','id'])||{});}})[_0xaccc('0x2a')](function(_0x48424c){logger[_0xaccc('0x1a')](_0xaccc('0x2b'),_0x5924ba);logger[_0xaccc('0x15')]('AddTags',_0x5924ba,JSON[_0xaccc('0x24')](_0x48424c));_0x3fa3b5(_0x48424c);})[_0xaccc('0x2c')](function(_0x5da45f){logger[_0xaccc('0x18')](_0xaccc('0x2b'),_0x5da45f[_0xaccc('0x19')],_0x5924ba);_0x23503a(_this[_0xaccc('0x18')](0x1f4,_0x5da45f[_0xaccc('0x19')]));});});}; \ No newline at end of file +var _0xb1f6=['debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','ChatInteraction','body','options','where','attributes','limit','then','UpdateChatInteraction','stringify','catch','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','./chatInteraction.socket','register','request','ChatInteraction,\x20%s,\x20%s'];(function(_0x89eef8,_0x2896dd){var _0xe260aa=function(_0x1bf035){while(--_0x1bf035){_0x89eef8['push'](_0x89eef8['shift']());}};_0xe260aa(++_0x2896dd);}(_0xb1f6,0x187));var _0x6b1f=function(_0x3d7159,_0x4bf336){_0x3d7159=_0x3d7159-0x0;var _0x7e9b2f=_0xb1f6[_0x3d7159];return _0x7e9b2f;};'use strict';var _=require(_0x6b1f('0x0'));var util=require(_0x6b1f('0x1'));var moment=require(_0x6b1f('0x2'));var BPromise=require(_0x6b1f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b1f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6b1f('0x5'))(_0x6b1f('0x6'));var config=require(_0x6b1f('0x7'));var jayson=require(_0x6b1f('0x8'));var client=jayson[_0x6b1f('0x9')]['http']({'port':0x232a});config[_0x6b1f('0xa')]=_[_0x6b1f('0xb')](config[_0x6b1f('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b1f('0xa')]));require(_0x6b1f('0xc'))[_0x6b1f('0xd')](socket);function respondWithRpcPromise(_0x53a680,_0x19b0c6,_0xdefc30){return new BPromise(function(_0x3fe938,_0x4934b9){return client[_0x6b1f('0xe')](_0x53a680,_0xdefc30)['then'](function(_0x17358a){logger['info'](_0x6b1f('0xf'),_0x19b0c6,'request\x20sent');logger[_0x6b1f('0x10')](_0x6b1f('0x11'),_0x19b0c6,_0x6b1f('0x12'),JSON['stringify'](_0x17358a));if(_0x17358a[_0x6b1f('0x13')]){if(_0x17358a['error']['code']===0x1f4){logger[_0x6b1f('0x13')](_0x6b1f('0xf'),_0x19b0c6,_0x17358a['error']['message']);return _0x4934b9(_0x17358a[_0x6b1f('0x13')]['message']);}logger[_0x6b1f('0x13')](_0x6b1f('0xf'),_0x19b0c6,_0x17358a[_0x6b1f('0x13')][_0x6b1f('0x14')]);return _0x3fe938(_0x17358a['error'][_0x6b1f('0x14')]);}else{logger[_0x6b1f('0x15')](_0x6b1f('0xf'),_0x19b0c6,_0x6b1f('0x12'));_0x3fe938(_0x17358a['result']['message']);}})['catch'](function(_0x3814c4){logger['error'](_0x6b1f('0xf'),_0x19b0c6,_0x3814c4);_0x4934b9(_0x3814c4);});});}exports['UpdateChatInteraction']=function(_0x576d38){var _0x250743=this;return new Promise(function(_0x267649,_0x3e6adc){return db[_0x6b1f('0x16')]['update'](_0x576d38[_0x6b1f('0x17')],{'raw':_0x576d38[_0x6b1f('0x18')]?_0x576d38[_0x6b1f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x576d38['options']?_0x576d38['options'][_0x6b1f('0x19')]||null:null,'attributes':_0x576d38[_0x6b1f('0x18')]?_0x576d38[_0x6b1f('0x18')][_0x6b1f('0x1a')]||null:null,'limit':_0x576d38[_0x6b1f('0x18')]?_0x576d38[_0x6b1f('0x18')][_0x6b1f('0x1b')]||null:null})[_0x6b1f('0x1c')](function(_0x3fd841){logger['info'](_0x6b1f('0x1d'),_0x576d38);logger[_0x6b1f('0x10')](_0x6b1f('0x1d'),_0x576d38,JSON[_0x6b1f('0x1e')](_0x3fd841));_0x267649(_0x3fd841);})[_0x6b1f('0x1f')](function(_0x15c23d){logger[_0x6b1f('0x13')](_0x6b1f('0x1d'),_0x15c23d['message'],_0x576d38);_0x3e6adc(_0x250743[_0x6b1f('0x13')](0x1f4,_0x15c23d[_0x6b1f('0x14')]));});});};exports['AddTagsToChatInteraction']=function(_0x3623b9){return new Promise(function(_0x51b323,_0x116ca5){return db[_0x6b1f('0x16')][_0x6b1f('0x20')]({'where':_0x3623b9[_0x6b1f('0x18')]?_0x3623b9['options'][_0x6b1f('0x19')]||null:null})[_0x6b1f('0x1c')](function(_0x4e2fd3){if(_0x4e2fd3){return _0x4e2fd3['addTags'](_0x3623b9['body'][_0x6b1f('0x21')],_[_0x6b1f('0x22')](_0x3623b9['body'],['ids','id'])||{});}})[_0x6b1f('0x23')](function(_0x6e6f1e){logger[_0x6b1f('0x15')](_0x6b1f('0x24'),_0x3623b9);logger['debug'](_0x6b1f('0x24'),_0x3623b9,JSON[_0x6b1f('0x1e')](_0x6e6f1e));_0x51b323(_0x6e6f1e);})[_0x6b1f('0x1f')](function(_0x4b45ce){logger['error'](_0x6b1f('0x24'),_0x4b45ce[_0x6b1f('0x14')],_0x3623b9);_0x116ca5(_this[_0x6b1f('0x13')](0x1f4,_0x4b45ce[_0x6b1f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index eef402b..07a707f 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 _0xa4b0=['update','removeListener','register','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa4b0,0x15d));var _0x0a4b=function(_0x772df,_0x35e763){_0x772df=_0x772df-0x0;var _0x4d79d4=_0xa4b0[_0x772df];return _0x4d79d4;};'use strict';var ChatInteractionEvents=require(_0x0a4b('0x0'));var events=[_0x0a4b('0x1'),_0x0a4b('0x2'),_0x0a4b('0x3')];function createListener(_0x55cac3,_0xd12a8c){return function(_0x5cd9d4){_0xd12a8c['emit'](_0x55cac3,_0x5cd9d4);};}function removeListener(_0x319277,_0x4b386b){return function(){ChatInteractionEvents[_0x0a4b('0x4')](_0x319277,_0x4b386b);};}exports[_0x0a4b('0x5')]=function(_0x5d24ad){for(var _0x16e82d=0x0,_0x15ff0f=events[_0x0a4b('0x6')];_0x16e82d<_0x15ff0f;_0x16e82d++){var _0x37ab40=events[_0x16e82d];var _0x690a14=createListener(_0x0a4b('0x7')+_0x37ab40,_0x5d24ad);ChatInteractionEvents['on'](_0x37ab40,_0x690a14);}}; \ No newline at end of file +var _0x9daa=['remove','update','emit','removeListener','register','chatInteraction:','./chatInteraction.events','save'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9daa,0x146));var _0xa9da=function(_0x1dba8d,_0x34b988){_0x1dba8d=_0x1dba8d-0x0;var _0x202828=_0x9daa[_0x1dba8d];return _0x202828;};'use strict';var ChatInteractionEvents=require(_0xa9da('0x0'));var events=[_0xa9da('0x1'),_0xa9da('0x2'),_0xa9da('0x3')];function createListener(_0x54105a,_0xa817d9){return function(_0x112851){_0xa817d9[_0xa9da('0x4')](_0x54105a,_0x112851);};}function removeListener(_0xee9072,_0x347ed7){return function(){ChatInteractionEvents[_0xa9da('0x5')](_0xee9072,_0x347ed7);};}exports[_0xa9da('0x6')]=function(_0x56a8fc){for(var _0x4dbf12=0x0,_0x4ef8e6=events['length'];_0x4dbf12<_0x4ef8e6;_0x4dbf12++){var _0x2840df=events[_0x4dbf12];var _0x5e588c=createListener(_0xa9da('0x7')+_0x2840df,_0x56a8fc);ChatInteractionEvents['on'](_0x2840df,_0x5e588c);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index c955bbd..cfb76a3 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 _0xb50b=['chatinteraction:addtags','addTags','put','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chat','chatinteraction:destroy','removeTags','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','index','get','isAuthenticated','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/download','download','post','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','%s-%s','now','originalname','replace','single','file','attachmentUpload','addMessage','/:id/tags','tracked'];(function(_0x50c43d,_0x1c8ba8){var _0x4de2bc=function(_0xf92014){while(--_0xf92014){_0x50c43d['push'](_0x50c43d['shift']());}};_0x4de2bc(++_0x1c8ba8);}(_0xb50b,0x134));var _0xbb50=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0xb50b[_0x5ac84c];return _0x3c53d2;};'use strict';var multer=require(_0xbb50('0x0'));var util=require(_0xbb50('0x1'));var path=require(_0xbb50('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbb50('0x3')]();var fs_extra=require(_0xbb50('0x4'));var auth=require(_0xbb50('0x5'));var interaction=require(_0xbb50('0x6'));var config=require(_0xbb50('0x7'));var controller=require(_0xbb50('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbb50('0x9')]);router[_0xbb50('0xa')]('/describe',auth[_0xbb50('0xb')](),controller[_0xbb50('0xc')]);router[_0xbb50('0xa')](_0xbb50('0xd'),auth[_0xbb50('0xe')](),controller['show']);router[_0xbb50('0xa')](_0xbb50('0xf'),auth[_0xbb50('0xe')](),controller[_0xbb50('0x10')]);router[_0xbb50('0xa')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0xbb50('0xa')]('/:id/my_messages',auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router['get'](_0xbb50('0x11'),auth[_0xbb50('0xb')](),controller[_0xbb50('0x12')]);router[_0xbb50('0x13')]('/',auth[_0xbb50('0xb')](),controller['create']);router[_0xbb50('0x13')](_0xbb50('0x14'),auth[_0xbb50('0xb')](),controller[_0xbb50('0x15')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2fc6e1,_0x5aef82,_0x4fd173){_0x4fd173(null,path[_0xbb50('0x16')](config[_0xbb50('0x17')],_0xbb50('0x18')));},'filename':function(_0x5e7c86,_0x325869,_0x1c16fb){_0x1c16fb(null,util['format'](_0xbb50('0x19'),Date[_0xbb50('0x1a')](),_0x325869[_0xbb50('0x1b')][_0xbb50('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb50('0x13')]('/:id/attachment_upload',upload[_0xbb50('0x1d')](_0xbb50('0x1e')),controller[_0xbb50('0x1f')]);router[_0xbb50('0x13')]('/:id/messages',auth[_0xbb50('0xe')](),controller[_0xbb50('0x20')]);router[_0xbb50('0x13')](_0xbb50('0x21'),auth[_0xbb50('0xb')](),interaction[_0xbb50('0x22')]('chat',_0xbb50('0x23')),controller[_0xbb50('0x24')]);router[_0xbb50('0x25')](_0xbb50('0xd'),auth[_0xbb50('0xb')](),interaction[_0xbb50('0x22')]('chat',_0xbb50('0x26')),controller[_0xbb50('0x27')]);router['put']('/:id/custom_update',controller[_0xbb50('0x28')]);router['put'](_0xbb50('0x29'),auth['isChatInteractionAuthorized'](),controller[_0xbb50('0x2a')]);router[_0xbb50('0x25')](_0xbb50('0x2b'),controller['close']);router[_0xbb50('0x2c')]('/:id',auth[_0xbb50('0xb')](),interaction[_0xbb50('0x22')](_0xbb50('0x2d'),_0xbb50('0x2e')),controller['destroy']);router['delete'](_0xbb50('0x21'),auth[_0xbb50('0xb')](),controller[_0xbb50('0x2f')]);module[_0xbb50('0x30')]=router; \ No newline at end of file +var _0xc34d=['chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','root','%s-%s','now','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put'];(function(_0x81a95,_0x49ec86){var _0x41518c=function(_0x4180c3){while(--_0x4180c3){_0x81a95['push'](_0x81a95['shift']());}};_0x41518c(++_0x49ec86);}(_0xc34d,0x1e9));var _0xdc34=function(_0x4bfd4a,_0x444995){_0x4bfd4a=_0x4bfd4a-0x0;var _0x4cd8a8=_0xc34d[_0x4bfd4a];return _0x4cd8a8;};'use strict';var multer=require('multer');var util=require(_0xdc34('0x0'));var path=require(_0xdc34('0x1'));var timeout=require('connect-timeout');var express=require(_0xdc34('0x2'));var router=express[_0xdc34('0x3')]();var fs_extra=require(_0xdc34('0x4'));var auth=require(_0xdc34('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdc34('0x6'));var controller=require(_0xdc34('0x7'));router['get']('/',auth[_0xdc34('0x8')](),controller[_0xdc34('0x9')]);router[_0xdc34('0xa')](_0xdc34('0xb'),auth[_0xdc34('0x8')](),controller[_0xdc34('0xc')]);router[_0xdc34('0xa')](_0xdc34('0xd'),auth['isChatInteractionAuthorized'](),controller[_0xdc34('0xe')]);router['get']('/:id/attachment_download',auth[_0xdc34('0xf')](),controller[_0xdc34('0x10')]);router[_0xdc34('0xa')](_0xdc34('0x11'),auth[_0xdc34('0x8')](),controller[_0xdc34('0x12')]);router[_0xdc34('0xa')](_0xdc34('0x13'),auth[_0xdc34('0xf')](),controller[_0xdc34('0x14')]);router[_0xdc34('0xa')](_0xdc34('0x15'),auth[_0xdc34('0x8')](),controller[_0xdc34('0x16')]);router['post']('/',auth[_0xdc34('0x8')](),controller[_0xdc34('0x17')]);router[_0xdc34('0x18')](_0xdc34('0x19'),auth[_0xdc34('0x8')](),controller[_0xdc34('0x1a')]);var upload=multer({'storage':multer[_0xdc34('0x1b')]({'destination':function(_0x45b6eb,_0xfbadfc,_0x5f2ba9){_0x5f2ba9(null,path['join'](config[_0xdc34('0x1c')],'server/files/attachments/'));},'filename':function(_0xa3e0f5,_0x4aec9e,_0x54abef){_0x54abef(null,util['format'](_0xdc34('0x1d'),Date[_0xdc34('0x1e')](),_0x4aec9e['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xdc34('0x18')](_0xdc34('0x1f'),upload[_0xdc34('0x20')](_0xdc34('0x21')),controller[_0xdc34('0x22')]);router['post']('/:id/messages',auth[_0xdc34('0xf')](),controller[_0xdc34('0x23')]);router[_0xdc34('0x18')](_0xdc34('0x24'),auth[_0xdc34('0x8')](),interaction[_0xdc34('0x25')](_0xdc34('0x26'),_0xdc34('0x27')),controller['addTags']);router[_0xdc34('0x28')](_0xdc34('0xd'),auth[_0xdc34('0x8')](),interaction[_0xdc34('0x25')](_0xdc34('0x26'),_0xdc34('0x29')),controller[_0xdc34('0x2a')]);router[_0xdc34('0x28')](_0xdc34('0x2b'),controller[_0xdc34('0x2c')]);router[_0xdc34('0x28')](_0xdc34('0x2d'),auth[_0xdc34('0xf')](),controller[_0xdc34('0x2e')]);router[_0xdc34('0x28')](_0xdc34('0x2f'),controller[_0xdc34('0x30')]);router[_0xdc34('0x31')](_0xdc34('0xd'),auth[_0xdc34('0x8')](),interaction[_0xdc34('0x25')](_0xdc34('0x26'),_0xdc34('0x32')),controller[_0xdc34('0x33')]);router[_0xdc34('0x31')](_0xdc34('0x24'),auth[_0xdc34('0x8')](),controller[_0xdc34('0x34')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index fd0f930..59b0fb2 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 _0xdd9f=['medium','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdd9f,0x1d9));var _0xfdd9=function(_0x5de532,_0x2941c4){_0x5de532=_0x5de532-0x0;var _0x4e9192=_0xdd9f[_0x5de532];return _0x4e9192;};'use strict';var Sequelize=require(_0xfdd9('0x0'));module[_0xfdd9('0x1')]={'body':{'type':Sequelize['TEXT'](_0xfdd9('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xfdd9('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xfdd9('0x4')]}}; \ No newline at end of file +var _0x6d83=['BOOLEAN','INTEGER','sequelize','exports','TEXT','medium'];(function(_0x33f34e,_0x4fde5b){var _0x58dc01=function(_0x36e155){while(--_0x36e155){_0x33f34e['push'](_0x33f34e['shift']());}};_0x58dc01(++_0x4fde5b);}(_0x6d83,0x80));var _0x36d8=function(_0x23449d,_0x5395f4){_0x23449d=_0x23449d-0x0;var _0x1b78bb=_0x6d83[_0x23449d];return _0x1b78bb;};'use strict';var Sequelize=require(_0x36d8('0x0'));module[_0x36d8('0x1')]={'body':{'type':Sequelize[_0x36d8('0x2')](_0x36d8('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x36d8('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x36d8('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index abbe9c2..e223712 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 _0x8fed=['fields','length','limit','order','sort','filters','where','VIRTUAL','merge','options','ChatInternalMessage','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','describe','messages','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','admin','fullname','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','filter','agent','resourceId','push','createdAt','FromId','ToId','read','-createdAt','all','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','undefined','count','offset','json','save','then','destroy','error','stack','name','send','index','rawAttributes','type','key','model','map','query','intersection','attributes'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x8fed,0x115));var _0xd8fe=function(_0x3ebcbb,_0x426b20){_0x3ebcbb=_0x3ebcbb-0x0;var _0x21fa56=_0x8fed[_0x3ebcbb];return _0x21fa56;};'use strict';var emlformat=require(_0xd8fe('0x0'));var rimraf=require(_0xd8fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd8fe('0x2'));var rp=require('request-promise');var moment=require(_0xd8fe('0x3'));var BPromise=require(_0xd8fe('0x4'));var Mustache=require(_0xd8fe('0x5'));var util=require(_0xd8fe('0x6'));var path=require(_0xd8fe('0x7'));var sox=require(_0xd8fe('0x8'));var csv=require('to-csv');var ejs=require(_0xd8fe('0x9'));var fs=require('fs');var fs_extra=require(_0xd8fe('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd8fe('0xb'));var jsforce=require(_0xd8fe('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd8fe('0xd'));var Papa=require('papaparse');var Redis=require(_0xd8fe('0xe'));var authService=require(_0xd8fe('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd8fe('0x10'));var hardwareService=require(_0xd8fe('0x11'));var logger=require(_0xd8fe('0x12'))('api');var utils=require(_0xd8fe('0x13'));var config=require(_0xd8fe('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8fe('0x15'))['db'];config[_0xd8fe('0x16')]=_[_0xd8fe('0x17')](config['redis'],{'host':_0xd8fe('0x18'),'port':0x18eb});var socket=require(_0xd8fe('0x19'))(new Redis(config[_0xd8fe('0x16')]));require(_0xd8fe('0x1a'))['register'](socket);function respondWithStatusCode(_0x3d6e67,_0x40fca4){_0x40fca4=_0x40fca4||0xcc;return function(_0x3a3dfb){if(_0x3a3dfb){return _0x3d6e67[_0xd8fe('0x1b')](_0x40fca4);}return _0x3d6e67[_0xd8fe('0x1c')](_0x40fca4)[_0xd8fe('0x1d')]();};}function respondWithResult(_0x33a962,_0x50091a){_0x50091a=_0x50091a||0xc8;return function(_0x14133f){if(_0x14133f){return _0x33a962[_0xd8fe('0x1c')](_0x50091a)['json'](_0x14133f);}};}function respondWithFilteredResult(_0x2c7ac9,_0x3ee3e9){return function(_0x184af5){if(_0x184af5){var _0x3660a0=typeof _0x3ee3e9['offset']===_0xd8fe('0x1e')&&typeof _0x3ee3e9['limit']===_0xd8fe('0x1e');var _0x238e95=_0x184af5[_0xd8fe('0x1f')];var _0x10acd0=_0x3660a0?0x0:_0x3ee3e9['offset'];var _0x5f1e07=_0x3660a0?_0x184af5[_0xd8fe('0x1f')]:_0x3ee3e9[_0xd8fe('0x20')]+_0x3ee3e9['limit'];var _0x306fa3;if(_0x5f1e07>=_0x238e95){_0x5f1e07=_0x238e95;_0x306fa3=0xc8;}else{_0x306fa3=0xce;}_0x2c7ac9[_0xd8fe('0x1c')](_0x306fa3);return _0x2c7ac9['set']('Content-Range',_0x10acd0+'-'+_0x5f1e07+'/'+_0x238e95)[_0xd8fe('0x21')](_0x184af5);}return null;};}function patchUpdates(_0x26b7cb){return function(_0x26faa5){try{jsonpatch['apply'](_0x26faa5,_0x26b7cb,!![]);}catch(_0x2ea615){return BPromise['reject'](_0x2ea615);}return _0x26faa5[_0xd8fe('0x22')]();};}function saveUpdates(_0x581fc2,_0x90ca7a){return function(_0x3afef0){if(_0x3afef0){return _0x3afef0['update'](_0x581fc2)[_0xd8fe('0x23')](function(_0x5098e5){return _0x5098e5;});}return null;};}function removeEntity(_0xbf63e4,_0x3b36c2){return function(_0x24067d){if(_0x24067d){return _0x24067d[_0xd8fe('0x24')]()['then'](function(){_0xbf63e4[_0xd8fe('0x1c')](0xcc)[_0xd8fe('0x1d')]();});}};}function handleEntityNotFound(_0x15f9bd,_0x2b8cd6){return function(_0x5a8d63){if(!_0x5a8d63){_0x15f9bd[_0xd8fe('0x1b')](0x194);}return _0x5a8d63;};}function handleError(_0x16a8b6,_0x487006){_0x487006=_0x487006||0x1f4;return function(_0x15096c){logger[_0xd8fe('0x25')](_0x15096c[_0xd8fe('0x26')]);if(_0x15096c[_0xd8fe('0x27')]){delete _0x15096c[_0xd8fe('0x27')];}_0x16a8b6[_0xd8fe('0x1c')](_0x487006)[_0xd8fe('0x28')](_0x15096c);};}exports[_0xd8fe('0x29')]=function(_0x34876f,_0x44d518){var _0x1dc33d={},_0x3941bd={},_0x4e0b38={'count':0x0,'rows':[]};var _0x47fd52=_['map'](db['ChatInternalMessage'][_0xd8fe('0x2a')],function(_0x27c33f){return{'name':_0x27c33f['fieldName'],'type':_0x27c33f[_0xd8fe('0x2b')][_0xd8fe('0x2c')]};});_0x3941bd[_0xd8fe('0x2d')]=_[_0xd8fe('0x2e')](_0x47fd52,_0xd8fe('0x27'));_0x3941bd[_0xd8fe('0x2f')]=_['keys'](_0x34876f['query']);_0x3941bd['filters']=_[_0xd8fe('0x30')](_0x3941bd[_0xd8fe('0x2d')],_0x3941bd[_0xd8fe('0x2f')]);_0x1dc33d[_0xd8fe('0x31')]=_[_0xd8fe('0x30')](_0x3941bd['model'],qs[_0xd8fe('0x32')](_0x34876f[_0xd8fe('0x2f')][_0xd8fe('0x32')]));_0x1dc33d[_0xd8fe('0x31')]=_0x1dc33d[_0xd8fe('0x31')][_0xd8fe('0x33')]?_0x1dc33d['attributes']:_0x3941bd['model'];if(!_0x34876f[_0xd8fe('0x2f')]['hasOwnProperty']('nolimit')){_0x1dc33d[_0xd8fe('0x34')]=qs[_0xd8fe('0x34')](_0x34876f[_0xd8fe('0x2f')]['limit']);_0x1dc33d[_0xd8fe('0x20')]=qs[_0xd8fe('0x20')](_0x34876f[_0xd8fe('0x2f')][_0xd8fe('0x20')]);}_0x1dc33d[_0xd8fe('0x35')]=qs['sort'](_0x34876f[_0xd8fe('0x2f')][_0xd8fe('0x36')]);_0x1dc33d['where']=qs[_0xd8fe('0x37')](_['pick'](_0x34876f['query'],_0x3941bd[_0xd8fe('0x37')]),_0x47fd52);if(_0x34876f[_0xd8fe('0x2f')]['filter']){_0x1dc33d[_0xd8fe('0x38')]=_['merge'](_0x1dc33d[_0xd8fe('0x38')],{'$or':_['map'](_0x47fd52,function(_0x2245f3){if(_0x2245f3[_0xd8fe('0x2b')]!==_0xd8fe('0x39')){var _0x17aeb6={};_0x17aeb6[_0x2245f3[_0xd8fe('0x27')]]={'$like':'%'+_0x34876f[_0xd8fe('0x2f')]['filter']+'%'};return _0x17aeb6;}})});}_0x1dc33d=_[_0xd8fe('0x3a')]({},_0x1dc33d,_0x34876f[_0xd8fe('0x3b')]);var _0xc1f9aa={'where':_0x1dc33d[_0xd8fe('0x38')]};return db[_0xd8fe('0x3c')][_0xd8fe('0x1f')](_0xc1f9aa)[_0xd8fe('0x23')](function(_0xc3c019){_0x4e0b38[_0xd8fe('0x1f')]=_0xc3c019;if(_0x34876f[_0xd8fe('0x2f')][_0xd8fe('0x3d')]){_0x1dc33d[_0xd8fe('0x3e')]=[{'all':!![]}];}return db[_0xd8fe('0x3c')][_0xd8fe('0x3f')](_0x1dc33d);})['then'](function(_0x412b3a){_0x4e0b38[_0xd8fe('0x40')]=_0x412b3a;return _0x4e0b38;})[_0xd8fe('0x23')](respondWithFilteredResult(_0x44d518,_0x1dc33d))[_0xd8fe('0x41')](handleError(_0x44d518,null));};exports[_0xd8fe('0x42')]=function(_0x3eaf03,_0x4a8b3f){var _0x416182={'raw':!![],'where':{'id':_0x3eaf03['params']['id']}},_0x51fedc={};_0x51fedc[_0xd8fe('0x2d')]=_[_0xd8fe('0x43')](db[_0xd8fe('0x3c')][_0xd8fe('0x2a')]);_0x51fedc['query']=_['keys'](_0x3eaf03[_0xd8fe('0x2f')]);_0x51fedc[_0xd8fe('0x37')]=_[_0xd8fe('0x30')](_0x51fedc[_0xd8fe('0x2d')],_0x51fedc[_0xd8fe('0x2f')]);_0x416182[_0xd8fe('0x31')]=_[_0xd8fe('0x30')](_0x51fedc[_0xd8fe('0x2d')],qs[_0xd8fe('0x32')](_0x3eaf03[_0xd8fe('0x2f')][_0xd8fe('0x32')]));_0x416182[_0xd8fe('0x31')]=_0x416182[_0xd8fe('0x31')]['length']?_0x416182[_0xd8fe('0x31')]:_0x51fedc[_0xd8fe('0x2d')];if(_0x3eaf03[_0xd8fe('0x2f')][_0xd8fe('0x3d')]){_0x416182[_0xd8fe('0x3e')]=[{'all':!![]}];}_0x416182=_['merge']({},_0x416182,_0x3eaf03[_0xd8fe('0x3b')]);return db[_0xd8fe('0x3c')][_0xd8fe('0x44')](_0x416182)[_0xd8fe('0x23')](handleEntityNotFound(_0x4a8b3f,null))[_0xd8fe('0x23')](respondWithResult(_0x4a8b3f,null))['catch'](handleError(_0x4a8b3f,null));};exports['create']=function(_0x25ac80,_0x15008a){return db[_0xd8fe('0x3c')][_0xd8fe('0x45')](_0x25ac80[_0xd8fe('0x46')],{})[_0xd8fe('0x23')](respondWithResult(_0x15008a,0xc9))[_0xd8fe('0x41')](handleError(_0x15008a,null));};exports['update']=function(_0x141f5e,_0x2ff17b){if(_0x141f5e[_0xd8fe('0x46')]['id']){delete _0x141f5e[_0xd8fe('0x46')]['id'];}return db[_0xd8fe('0x3c')]['find']({'where':{'id':_0x141f5e[_0xd8fe('0x47')]['id']}})[_0xd8fe('0x23')](handleEntityNotFound(_0x2ff17b,null))['then'](saveUpdates(_0x141f5e[_0xd8fe('0x46')],null))[_0xd8fe('0x23')](respondWithResult(_0x2ff17b,null))['catch'](handleError(_0x2ff17b,null));};exports[_0xd8fe('0x24')]=function(_0x4828a5,_0x70fe12){return db[_0xd8fe('0x3c')][_0xd8fe('0x44')]({'where':{'id':_0x4828a5[_0xd8fe('0x47')]['id']}})[_0xd8fe('0x23')](handleEntityNotFound(_0x70fe12,null))[_0xd8fe('0x23')](removeEntity(_0x70fe12,null))['catch'](handleError(_0x70fe12,null));};exports['describe']=function(_0x1168df,_0xaceb4a){return db[_0xd8fe('0x3c')][_0xd8fe('0x48')]()['then'](respondWithResult(_0xaceb4a,null))[_0xd8fe('0x41')](handleError(_0xaceb4a,null));};function wrapUser(_0x563dee){return function(_0x3ba487){var _0x3940df=_0x563dee['get']({'plain':!![]});_0x3940df[_0xd8fe('0x49')]=[];if(_0x3ba487){_0x3940df['lastMessageAt']=_0x3ba487['createdAt'];_0x3940df['lastMessage']=_0x3ba487;}else{_0x3940df[_0xd8fe('0x4a')]=moment(0x0)[_0xd8fe('0x4b')](_0xd8fe('0x4c'));_0x3940df[_0xd8fe('0x4d')]={};}return _0x3940df;};}exports[_0xd8fe('0x4e')]=function(_0x2b1260,_0x38d993,_0x54cc53){var _0x168fbe=[];return db['User'][_0xd8fe('0x3f')]({'where':{'role':['agent',_0xd8fe('0x4f'),'user']},'attributes':['id',_0xd8fe('0x50'),'name','role','userpic',_0xd8fe('0x51'),_0xd8fe('0x52'),_0xd8fe('0x53'),_0xd8fe('0x54'),_0xd8fe('0x55')],'order':qs[_0xd8fe('0x36')](_0xd8fe('0x56')),'include':[{'model':db[_0xd8fe('0x57')],'as':_0xd8fe('0x58'),'attributes':['id',_0xd8fe('0x27'),_0xd8fe('0x2b')],'through':{'attributes':[]}}]})['then'](function(_0x222f53){if(_0x222f53){var _0x353358=_0x2b1260['user'][_0xd8fe('0x59')]({'plain':!![]});if(!_0x353358)throw new Error(_0xd8fe('0x5a'));if(_0x353358[_0xd8fe('0x5b')]===_0xd8fe('0x5c')){return db[_0xd8fe('0x5d')][_0xd8fe('0x44')]({'where':{'name':_0xd8fe('0x5e'),'userProfileId':_0x353358[_0xd8fe('0x5f')]},'raw':!![]})[_0xd8fe('0x23')](function(_0x1ba501){if(_0x1ba501){if(_0x1ba501[_0xd8fe('0x60')]===0x0){return db[_0xd8fe('0x61')][_0xd8fe('0x3f')]({'where':{'sectionId':_0x1ba501['id']},'raw':!![]})[_0xd8fe('0x23')](function(_0xb8df2f){var _0x1d32d9=[];if(_[_0xd8fe('0x62')](_0xb8df2f)){_0x1d32d9=_[_0xd8fe('0x63')](_0x222f53,function(_0x2715c8){if(_0x2715c8['role']!==_0xd8fe('0x64')){return _0x2715c8;}});return _0x1d32d9;}else{for(var _0x597e59=0x0;_0x597e59<_0x222f53[_0xd8fe('0x33')];_0x597e59++){var _0x173497=_0x222f53[_0x597e59];if(_0x173497[_0xd8fe('0x5b')]===_0xd8fe('0x64')){var _0x11c442=_[_0xd8fe('0x44')](_0xb8df2f,function(_0x1010ac){return _0x1010ac[_0xd8fe('0x65')]===_0x173497['id'];});if(_0x11c442)_0x1d32d9[_0xd8fe('0x66')](_0x173497);}else{_0x1d32d9[_0xd8fe('0x66')](_0x173497);}}return _0x1d32d9;}});}else{return _0x222f53;}}else{var _0x2c8abb=_[_0xd8fe('0x63')](_0x222f53,function(_0x5c8cd9){if(_0x5c8cd9[_0xd8fe('0x5b')]!==_0xd8fe('0x64')){return _0x5c8cd9;}});return _0x2c8abb;}});}else{return _0x222f53;}}})['then'](function(_0xd1a028){var _0x2eea77=[];if(_0xd1a028){_0x168fbe=_0xd1a028;for(var _0x32215d=0x0;_0x32215d<_0xd1a028[_0xd8fe('0x33')];_0x32215d+=0x1){_0x168fbe[_0x32215d][_0xd8fe('0x49')]=[];_0x2eea77[_0xd8fe('0x66')](db['ChatInternalMessage'][_0xd8fe('0x44')]({'where':{'FromId':[_0x2b1260['user']['id'],_0xd1a028[_0x32215d]['id']],'ToId':[_0x2b1260[_0xd8fe('0x5c')]['id'],_0xd1a028[_0x32215d]['id']],'ChatGroupId':null},'attributes':['id',_0xd8fe('0x67'),_0xd8fe('0x68'),_0xd8fe('0x69'),_0xd8fe('0x6a'),_0xd8fe('0x46')],'order':qs['sort'](_0xd8fe('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xd8fe('0x23')](wrapUser(_0xd1a028[_0x32215d])));}return BPromise[_0xd8fe('0x6c')](_0x2eea77);}return[];})[_0xd8fe('0x23')](function(_0x119279){return{'rows':_0x119279,'count':_0x119279[_0xd8fe('0x33')]};})['then'](respondWithResult(_0x38d993,null))[_0xd8fe('0x41')](handleError(_0x38d993,null));}; \ No newline at end of file +var _0xa1d1=['role','userpic','allowmessenger','showWebBar','sort','-online','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','resourceId','push','FromId','ToId','read','all','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./chatInternalMessage.socket','sendStatus','end','status','json','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','name','ChatInternalMessage','rawAttributes','fieldName','map','query','filters','model','attributes','intersection','fields','hasOwnProperty','order','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','length','create','body','params','find','describe','messages','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user'];(function(_0x274600,_0x100ccf){var _0xef0f9c=function(_0x2961a0){while(--_0x2961a0){_0x274600['push'](_0x274600['shift']());}};_0xef0f9c(++_0x100ccf);}(_0xa1d1,0x71));var _0x1a1d=function(_0x20ae2f,_0x455457){_0x20ae2f=_0x20ae2f-0x0;var _0x47adce=_0xa1d1[_0x20ae2f];return _0x47adce;};'use strict';var emlformat=require(_0x1a1d('0x0'));var rimraf=require(_0x1a1d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1a1d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1a1d('0x3'));var util=require(_0x1a1d('0x4'));var path=require(_0x1a1d('0x5'));var sox=require(_0x1a1d('0x6'));var csv=require(_0x1a1d('0x7'));var ejs=require(_0x1a1d('0x8'));var fs=require('fs');var fs_extra=require(_0x1a1d('0x9'));var _=require('lodash');var squel=require(_0x1a1d('0xa'));var crypto=require(_0x1a1d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1a1d('0xc'));var toCsv=require(_0x1a1d('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1a1d('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x1a1d('0xe'));var hardwareService=require(_0x1a1d('0xf'));var logger=require(_0x1a1d('0x10'))(_0x1a1d('0x11'));var utils=require('../../config/utils');var config=require(_0x1a1d('0x12'));var licenseUtil=require(_0x1a1d('0x13'));var db=require(_0x1a1d('0x14'))['db'];config[_0x1a1d('0x15')]=_['defaults'](config[_0x1a1d('0x15')],{'host':_0x1a1d('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a1d('0x15')]));require(_0x1a1d('0x17'))['register'](socket);function respondWithStatusCode(_0xe96cb9,_0x44981f){_0x44981f=_0x44981f||0xcc;return function(_0x59b0a4){if(_0x59b0a4){return _0xe96cb9[_0x1a1d('0x18')](_0x44981f);}return _0xe96cb9['status'](_0x44981f)[_0x1a1d('0x19')]();};}function respondWithResult(_0x183a7e,_0x55cb4b){_0x55cb4b=_0x55cb4b||0xc8;return function(_0x38f429){if(_0x38f429){return _0x183a7e[_0x1a1d('0x1a')](_0x55cb4b)[_0x1a1d('0x1b')](_0x38f429);}};}function respondWithFilteredResult(_0x47ef30,_0x116684){return function(_0x54cb9d){if(_0x54cb9d){var _0xecbd9d=typeof _0x116684['offset']==='undefined'&&typeof _0x116684[_0x1a1d('0x1c')]==='undefined';var _0x30db76=_0x54cb9d[_0x1a1d('0x1d')];var _0x11521c=_0xecbd9d?0x0:_0x116684[_0x1a1d('0x1e')];var _0x523873=_0xecbd9d?_0x54cb9d['count']:_0x116684[_0x1a1d('0x1e')]+_0x116684[_0x1a1d('0x1c')];var _0x47e577;if(_0x523873>=_0x30db76){_0x523873=_0x30db76;_0x47e577=0xc8;}else{_0x47e577=0xce;}_0x47ef30[_0x1a1d('0x1a')](_0x47e577);return _0x47ef30[_0x1a1d('0x1f')](_0x1a1d('0x20'),_0x11521c+'-'+_0x523873+'/'+_0x30db76)[_0x1a1d('0x1b')](_0x54cb9d);}return null;};}function patchUpdates(_0xf4679e){return function(_0x57e7f2){try{jsonpatch[_0x1a1d('0x21')](_0x57e7f2,_0xf4679e,!![]);}catch(_0x19c6e1){return BPromise['reject'](_0x19c6e1);}return _0x57e7f2[_0x1a1d('0x22')]();};}function saveUpdates(_0x1a83b5,_0x29bf02){return function(_0xb27b72){if(_0xb27b72){return _0xb27b72[_0x1a1d('0x23')](_0x1a83b5)[_0x1a1d('0x24')](function(_0x581f35){return _0x581f35;});}return null;};}function removeEntity(_0x414547,_0x2af664){return function(_0x48eee1){if(_0x48eee1){return _0x48eee1[_0x1a1d('0x25')]()[_0x1a1d('0x24')](function(){_0x414547[_0x1a1d('0x1a')](0xcc)[_0x1a1d('0x19')]();});}};}function handleEntityNotFound(_0x1c8712,_0x39536f){return function(_0x348f9f){if(!_0x348f9f){_0x1c8712[_0x1a1d('0x18')](0x194);}return _0x348f9f;};}function handleError(_0x3013ad,_0x2ada71){_0x2ada71=_0x2ada71||0x1f4;return function(_0x33c6f2){logger['error'](_0x33c6f2['stack']);if(_0x33c6f2['name']){delete _0x33c6f2[_0x1a1d('0x26')];}_0x3013ad[_0x1a1d('0x1a')](_0x2ada71)['send'](_0x33c6f2);};}exports['index']=function(_0x1ddf0f,_0x531cc7){var _0x2e14a1={},_0x36cd17={},_0xe2150a={'count':0x0,'rows':[]};var _0x389dce=_['map'](db[_0x1a1d('0x27')][_0x1a1d('0x28')],function(_0x43e92d){return{'name':_0x43e92d[_0x1a1d('0x29')],'type':_0x43e92d['type']['key']};});_0x36cd17['model']=_[_0x1a1d('0x2a')](_0x389dce,'name');_0x36cd17[_0x1a1d('0x2b')]=_['keys'](_0x1ddf0f['query']);_0x36cd17[_0x1a1d('0x2c')]=_['intersection'](_0x36cd17[_0x1a1d('0x2d')],_0x36cd17[_0x1a1d('0x2b')]);_0x2e14a1[_0x1a1d('0x2e')]=_[_0x1a1d('0x2f')](_0x36cd17[_0x1a1d('0x2d')],qs['fields'](_0x1ddf0f[_0x1a1d('0x2b')][_0x1a1d('0x30')]));_0x2e14a1['attributes']=_0x2e14a1['attributes']['length']?_0x2e14a1[_0x1a1d('0x2e')]:_0x36cd17[_0x1a1d('0x2d')];if(!_0x1ddf0f[_0x1a1d('0x2b')][_0x1a1d('0x31')]('nolimit')){_0x2e14a1[_0x1a1d('0x1c')]=qs[_0x1a1d('0x1c')](_0x1ddf0f['query'][_0x1a1d('0x1c')]);_0x2e14a1[_0x1a1d('0x1e')]=qs[_0x1a1d('0x1e')](_0x1ddf0f['query']['offset']);}_0x2e14a1[_0x1a1d('0x32')]=qs['sort'](_0x1ddf0f[_0x1a1d('0x2b')]['sort']);_0x2e14a1[_0x1a1d('0x33')]=qs[_0x1a1d('0x2c')](_[_0x1a1d('0x34')](_0x1ddf0f[_0x1a1d('0x2b')],_0x36cd17[_0x1a1d('0x2c')]),_0x389dce);if(_0x1ddf0f['query']['filter']){_0x2e14a1[_0x1a1d('0x33')]=_['merge'](_0x2e14a1[_0x1a1d('0x33')],{'$or':_[_0x1a1d('0x2a')](_0x389dce,function(_0x457f05){if(_0x457f05[_0x1a1d('0x35')]!==_0x1a1d('0x36')){var _0x218da5={};_0x218da5[_0x457f05[_0x1a1d('0x26')]]={'$like':'%'+_0x1ddf0f[_0x1a1d('0x2b')][_0x1a1d('0x37')]+'%'};return _0x218da5;}})});}_0x2e14a1=_[_0x1a1d('0x38')]({},_0x2e14a1,_0x1ddf0f[_0x1a1d('0x39')]);var _0x60194d={'where':_0x2e14a1['where']};return db[_0x1a1d('0x27')]['count'](_0x60194d)[_0x1a1d('0x24')](function(_0x44e137){_0xe2150a[_0x1a1d('0x1d')]=_0x44e137;if(_0x1ddf0f[_0x1a1d('0x2b')][_0x1a1d('0x3a')]){_0x2e14a1[_0x1a1d('0x3b')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x1a1d('0x3c')](_0x2e14a1);})[_0x1a1d('0x24')](function(_0x2d7def){_0xe2150a[_0x1a1d('0x3d')]=_0x2d7def;return _0xe2150a;})['then'](respondWithFilteredResult(_0x531cc7,_0x2e14a1))[_0x1a1d('0x3e')](handleError(_0x531cc7,null));};exports[_0x1a1d('0x3f')]=function(_0x597848,_0x425c86){var _0x56c771={'raw':!![],'where':{'id':_0x597848['params']['id']}},_0x24ac59={};_0x24ac59[_0x1a1d('0x2d')]=_[_0x1a1d('0x40')](db[_0x1a1d('0x27')][_0x1a1d('0x28')]);_0x24ac59[_0x1a1d('0x2b')]=_['keys'](_0x597848[_0x1a1d('0x2b')]);_0x24ac59[_0x1a1d('0x2c')]=_[_0x1a1d('0x2f')](_0x24ac59[_0x1a1d('0x2d')],_0x24ac59[_0x1a1d('0x2b')]);_0x56c771[_0x1a1d('0x2e')]=_[_0x1a1d('0x2f')](_0x24ac59['model'],qs[_0x1a1d('0x30')](_0x597848['query'][_0x1a1d('0x30')]));_0x56c771[_0x1a1d('0x2e')]=_0x56c771[_0x1a1d('0x2e')][_0x1a1d('0x41')]?_0x56c771[_0x1a1d('0x2e')]:_0x24ac59['model'];if(_0x597848[_0x1a1d('0x2b')]['includeAll']){_0x56c771[_0x1a1d('0x3b')]=[{'all':!![]}];}_0x56c771=_[_0x1a1d('0x38')]({},_0x56c771,_0x597848[_0x1a1d('0x39')]);return db[_0x1a1d('0x27')]['find'](_0x56c771)[_0x1a1d('0x24')](handleEntityNotFound(_0x425c86,null))[_0x1a1d('0x24')](respondWithResult(_0x425c86,null))[_0x1a1d('0x3e')](handleError(_0x425c86,null));};exports[_0x1a1d('0x42')]=function(_0x523997,_0x2ee4ec){return db[_0x1a1d('0x27')][_0x1a1d('0x42')](_0x523997[_0x1a1d('0x43')],{})[_0x1a1d('0x24')](respondWithResult(_0x2ee4ec,0xc9))[_0x1a1d('0x3e')](handleError(_0x2ee4ec,null));};exports[_0x1a1d('0x23')]=function(_0x261391,_0x2eed4d){if(_0x261391[_0x1a1d('0x43')]['id']){delete _0x261391[_0x1a1d('0x43')]['id'];}return db[_0x1a1d('0x27')]['find']({'where':{'id':_0x261391[_0x1a1d('0x44')]['id']}})[_0x1a1d('0x24')](handleEntityNotFound(_0x2eed4d,null))[_0x1a1d('0x24')](saveUpdates(_0x261391['body'],null))['then'](respondWithResult(_0x2eed4d,null))[_0x1a1d('0x3e')](handleError(_0x2eed4d,null));};exports[_0x1a1d('0x25')]=function(_0x5664c8,_0x5ab965){return db[_0x1a1d('0x27')][_0x1a1d('0x45')]({'where':{'id':_0x5664c8['params']['id']}})[_0x1a1d('0x24')](handleEntityNotFound(_0x5ab965,null))[_0x1a1d('0x24')](removeEntity(_0x5ab965,null))[_0x1a1d('0x3e')](handleError(_0x5ab965,null));};exports['describe']=function(_0x19debe,_0x4ab450){return db[_0x1a1d('0x27')][_0x1a1d('0x46')]()[_0x1a1d('0x24')](respondWithResult(_0x4ab450,null))['catch'](handleError(_0x4ab450,null));};function wrapUser(_0x48a62a){return function(_0x5a42f7){var _0x4c3e8d=_0x48a62a['get']({'plain':!![]});_0x4c3e8d[_0x1a1d('0x47')]=[];if(_0x5a42f7){_0x4c3e8d[_0x1a1d('0x48')]=_0x5a42f7[_0x1a1d('0x49')];_0x4c3e8d[_0x1a1d('0x4a')]=_0x5a42f7;}else{_0x4c3e8d[_0x1a1d('0x48')]=moment(0x0)['format'](_0x1a1d('0x4b'));_0x4c3e8d[_0x1a1d('0x4a')]={};}return _0x4c3e8d;};}exports[_0x1a1d('0x4c')]=function(_0x135878,_0x75856c,_0x93b716){var _0x1bd661=[];return db[_0x1a1d('0x4d')][_0x1a1d('0x3c')]({'where':{'role':[_0x1a1d('0x4e'),_0x1a1d('0x4f'),_0x1a1d('0x50')]},'attributes':['id','fullname','name',_0x1a1d('0x51'),_0x1a1d('0x52'),'internal','online','lastLoginAt',_0x1a1d('0x53'),_0x1a1d('0x54')],'order':qs[_0x1a1d('0x55')](_0x1a1d('0x56')),'include':[{'model':db[_0x1a1d('0x57')],'as':'VoiceQueues','attributes':['id',_0x1a1d('0x26'),_0x1a1d('0x35')],'through':{'attributes':[]}}]})[_0x1a1d('0x24')](function(_0x2decd9){if(_0x2decd9){var _0xc8eca7=_0x135878[_0x1a1d('0x50')]['get']({'plain':!![]});if(!_0xc8eca7)throw new Error(_0x1a1d('0x58'));if(_0xc8eca7[_0x1a1d('0x51')]===_0x1a1d('0x50')){return db[_0x1a1d('0x59')][_0x1a1d('0x45')]({'where':{'name':_0x1a1d('0x5a'),'userProfileId':_0xc8eca7['userProfileId']},'raw':!![]})[_0x1a1d('0x24')](function(_0x5c9171){if(_0x5c9171){if(_0x5c9171['autoAssociation']===0x0){return db['UserProfileResource'][_0x1a1d('0x3c')]({'where':{'sectionId':_0x5c9171['id']},'raw':!![]})[_0x1a1d('0x24')](function(_0x1aa751){var _0xc2913a=[];if(_['isEmpty'](_0x1aa751)){_0xc2913a=_[_0x1a1d('0x37')](_0x2decd9,function(_0x404b0a){if(_0x404b0a[_0x1a1d('0x51')]!==_0x1a1d('0x4e')){return _0x404b0a;}});return _0xc2913a;}else{for(var _0x1db02e=0x0;_0x1db02e<_0x2decd9[_0x1a1d('0x41')];_0x1db02e++){var _0x8c010b=_0x2decd9[_0x1db02e];if(_0x8c010b[_0x1a1d('0x51')]==='agent'){var _0x14a6af=_['find'](_0x1aa751,function(_0x1fb6f5){return _0x1fb6f5[_0x1a1d('0x5b')]===_0x8c010b['id'];});if(_0x14a6af)_0xc2913a['push'](_0x8c010b);}else{_0xc2913a['push'](_0x8c010b);}}return _0xc2913a;}});}else{return _0x2decd9;}}else{var _0x1cb573=_[_0x1a1d('0x37')](_0x2decd9,function(_0x397dfe){if(_0x397dfe['role']!==_0x1a1d('0x4e')){return _0x397dfe;}});return _0x1cb573;}});}else{return _0x2decd9;}}})['then'](function(_0x518f8b){var _0x56d426=[];if(_0x518f8b){_0x1bd661=_0x518f8b;for(var _0x53a9fd=0x0;_0x53a9fd<_0x518f8b[_0x1a1d('0x41')];_0x53a9fd+=0x1){_0x1bd661[_0x53a9fd]['messages']=[];_0x56d426[_0x1a1d('0x5c')](db[_0x1a1d('0x27')][_0x1a1d('0x45')]({'where':{'FromId':[_0x135878[_0x1a1d('0x50')]['id'],_0x518f8b[_0x53a9fd]['id']],'ToId':[_0x135878['user']['id'],_0x518f8b[_0x53a9fd]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x1a1d('0x5d'),_0x1a1d('0x5e'),_0x1a1d('0x5f'),_0x1a1d('0x43')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x1a1d('0x24')](wrapUser(_0x518f8b[_0x53a9fd])));}return BPromise[_0x1a1d('0x60')](_0x56d426);}return[];})['then'](function(_0x5cdf6a){return{'rows':_0x5cdf6a,'count':_0x5cdf6a[_0x1a1d('0x41')]};})['then'](respondWithResult(_0x75856c,null))['catch'](handleError(_0x75856c,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 8b3e7f7..2c60a49 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 _0xa937=['save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x1c54d6,_0x522eb4){var _0x499ded=function(_0x59bf5b){while(--_0x59bf5b){_0x1c54d6['push'](_0x1c54d6['shift']());}};_0x499ded(++_0x522eb4);}(_0xa937,0xde));var _0x7a93=function(_0x5bf226,_0x46c873){_0x5bf226=_0x5bf226-0x0;var _0x13ab25=_0xa937[_0x5bf226];return _0x13ab25;};'use strict';var EventEmitter=require(_0x7a93('0x0'));var ChatInternalMessage=require(_0x7a93('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7a93('0x2'),'afterUpdate':_0x7a93('0x3'),'afterDestroy':_0x7a93('0x4')};function emitEvent(_0xdfd8c4){return function(_0x4c08be,_0x217b3c,_0x32cda5){ChatInternalMessageEvents[_0x7a93('0x5')](_0xdfd8c4+':'+_0x4c08be['id'],_0x4c08be);ChatInternalMessageEvents[_0x7a93('0x5')](_0xdfd8c4,_0x4c08be);_0x32cda5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x7a93('0x6')](e,emitEvent(event));}}module[_0x7a93('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x3b48=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove'];(function(_0x186bfa,_0xae755f){var _0x458af4=function(_0x1f572d){while(--_0x1f572d){_0x186bfa['push'](_0x186bfa['shift']());}};_0x458af4(++_0xae755f);}(_0x3b48,0x1b1));var _0x83b4=function(_0x240315,_0x5888c8){_0x240315=_0x240315-0x0;var _0x1f0a1d=_0x3b48[_0x240315];return _0x1f0a1d;};'use strict';var EventEmitter=require(_0x83b4('0x0'));var ChatInternalMessage=require(_0x83b4('0x1'))['db'][_0x83b4('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x83b4('0x3')](0x0);var events={'afterCreate':_0x83b4('0x4'),'afterUpdate':_0x83b4('0x5'),'afterDestroy':_0x83b4('0x6')};function emitEvent(_0x559fc7){return function(_0x516c2a,_0x48a0f8,_0x2b7ca3){ChatInternalMessageEvents[_0x83b4('0x7')](_0x559fc7+':'+_0x516c2a['id'],_0x516c2a);ChatInternalMessageEvents[_0x83b4('0x7')](_0x559fc7,_0x516c2a);_0x2b7ca3(null);};}for(var e in events){if(events[_0x83b4('0x8')](e)){var event=events[e];ChatInternalMessage[_0x83b4('0x9')](e,emitEvent(event));}}module[_0x83b4('0xa')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index b5454f1..8b5c8d6 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 _0x772c=['ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0xaf2024,_0x452360){var _0x2e301c=function(_0x122c48){while(--_0x122c48){_0xaf2024['push'](_0xaf2024['shift']());}};_0x2e301c(++_0x452360);}(_0x772c,0x153));var _0xc772=function(_0x33ed53,_0x1c269d){_0x33ed53=_0x33ed53-0x0;var _0x1bdee7=_0x772c[_0x33ed53];return _0x1bdee7;};'use strict';var _=require(_0xc772('0x0'));var util=require(_0xc772('0x1'));var logger=require(_0xc772('0x2'))(_0xc772('0x3'));var moment=require(_0xc772('0x4'));var BPromise=require(_0xc772('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc772('0x6'));var rimraf=require(_0xc772('0x7'));var config=require(_0xc772('0x8'));var attributes=require(_0xc772('0x9'));module[_0xc772('0xa')]=function(_0x4d9f45,_0x26b30d){return _0x4d9f45['define'](_0xc772('0xb'),attributes,{'tableName':_0xc772('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc772('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7b50=['../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x4322de,_0x4c21d3){var _0x3230f8=function(_0x337676){while(--_0x337676){_0x4322de['push'](_0x4322de['shift']());}};_0x3230f8(++_0x4c21d3);}(_0x7b50,0x1df));var _0x07b5=function(_0x4aaa22,_0x18bd75){_0x4aaa22=_0x4aaa22-0x0;var _0x40be29=_0x7b50[_0x4aaa22];return _0x40be29;};'use strict';var _=require(_0x07b5('0x0'));var util=require('util');var logger=require(_0x07b5('0x1'))(_0x07b5('0x2'));var moment=require(_0x07b5('0x3'));var BPromise=require(_0x07b5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x07b5('0x5'));var rimraf=require('rimraf');var config=require(_0x07b5('0x6'));var attributes=require('./chatInternalMessage.attributes');module[_0x07b5('0x7')]=function(_0x24d12d,_0x1929ad){return _0x24d12d[_0x07b5('0x8')]('ChatInternalMessage',attributes,{'tableName':_0x07b5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x07b5('0xa'),'collate':_0x07b5('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 49add1e..ab58ea6 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 _0xc090=['localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','request\x20sent','error','code','ChatInternalMessage,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis'];(function(_0x91d019,_0x5223c4){var _0x19de1f=function(_0x3e1311){while(--_0x3e1311){_0x91d019['push'](_0x91d019['shift']());}};_0x19de1f(++_0x5223c4);}(_0xc090,0x112));var _0x0c09=function(_0x2478d7,_0x5c9476){_0x2478d7=_0x2478d7-0x0;var _0x26ed0b=_0xc090[_0x2478d7];return _0x26ed0b;};'use strict';var _=require(_0x0c09('0x0'));var util=require(_0x0c09('0x1'));var moment=require(_0x0c09('0x2'));var BPromise=require(_0x0c09('0x3'));var rs=require(_0x0c09('0x4'));var fs=require('fs');var Redis=require(_0x0c09('0x5'));var db=require(_0x0c09('0x6'))['db'];var utils=require(_0x0c09('0x7'));var logger=require(_0x0c09('0x8'))('rpc');var config=require(_0x0c09('0x9'));var jayson=require(_0x0c09('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x0c09('0xb')]=_['defaults'](config[_0x0c09('0xb')],{'host':_0x0c09('0xc'),'port':0x18eb});var socket=require(_0x0c09('0xd'))(new Redis(config['redis']));require(_0x0c09('0xe'))[_0x0c09('0xf')](socket);function respondWithRpcPromise(_0x5672e6,_0x86df5,_0x58eeec){return new BPromise(function(_0x3bc648,_0xddcc89){return client[_0x0c09('0x10')](_0x5672e6,_0x58eeec)[_0x0c09('0x11')](function(_0x5ac552){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x86df5,_0x0c09('0x12'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x86df5,_0x0c09('0x12'),JSON['stringify'](_0x5ac552));if(_0x5ac552[_0x0c09('0x13')]){if(_0x5ac552[_0x0c09('0x13')][_0x0c09('0x14')]===0x1f4){logger[_0x0c09('0x13')](_0x0c09('0x15'),_0x86df5,_0x5ac552[_0x0c09('0x13')][_0x0c09('0x16')]);return _0xddcc89(_0x5ac552[_0x0c09('0x13')][_0x0c09('0x16')]);}logger[_0x0c09('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x86df5,_0x5ac552[_0x0c09('0x13')][_0x0c09('0x16')]);return _0x3bc648(_0x5ac552[_0x0c09('0x13')][_0x0c09('0x16')]);}else{logger[_0x0c09('0x17')](_0x0c09('0x15'),_0x86df5,_0x0c09('0x12'));_0x3bc648(_0x5ac552[_0x0c09('0x18')][_0x0c09('0x16')]);}})[_0x0c09('0x19')](function(_0x1ad3db){logger[_0x0c09('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x86df5,_0x1ad3db);_0xddcc89(_0x1ad3db);});});} \ No newline at end of file +var _0x5889=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','then','ChatInternalMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/logger'];(function(_0x556e0b,_0x413257){var _0x2e49ff=function(_0x44a9c2){while(--_0x44a9c2){_0x556e0b['push'](_0x556e0b['shift']());}};_0x2e49ff(++_0x413257);}(_0x5889,0x95));var _0x9588=function(_0x4ae292,_0x51bc7a){_0x4ae292=_0x4ae292-0x0;var _0x174d0c=_0x5889[_0x4ae292];return _0x174d0c;};'use strict';var _=require('lodash');var util=require(_0x9588('0x0'));var moment=require(_0x9588('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9588('0x2'));var db=require(_0x9588('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9588('0x4'))(_0x9588('0x5'));var config=require(_0x9588('0x6'));var jayson=require(_0x9588('0x7'));var client=jayson[_0x9588('0x8')][_0x9588('0x9')]({'port':0x232a});config[_0x9588('0xa')]=_[_0x9588('0xb')](config['redis'],{'host':_0x9588('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9588('0xa')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4d82a1,_0x1289ee,_0x3996ce){return new BPromise(function(_0x1d23a8,_0x4f76fa){return client['request'](_0x4d82a1,_0x3996ce)[_0x9588('0xd')](function(_0x5752cf){logger['info'](_0x9588('0xe'),_0x1289ee,'request\x20sent');logger[_0x9588('0xf')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x1289ee,_0x9588('0x10'),JSON[_0x9588('0x11')](_0x5752cf));if(_0x5752cf[_0x9588('0x12')]){if(_0x5752cf[_0x9588('0x12')]['code']===0x1f4){logger[_0x9588('0x12')](_0x9588('0xe'),_0x1289ee,_0x5752cf[_0x9588('0x12')][_0x9588('0x13')]);return _0x4f76fa(_0x5752cf[_0x9588('0x12')][_0x9588('0x13')]);}logger[_0x9588('0x12')](_0x9588('0xe'),_0x1289ee,_0x5752cf[_0x9588('0x12')]['message']);return _0x1d23a8(_0x5752cf[_0x9588('0x12')][_0x9588('0x13')]);}else{logger['info'](_0x9588('0xe'),_0x1289ee,_0x9588('0x10'));_0x1d23a8(_0x5752cf[_0x9588('0x14')][_0x9588('0x13')]);}})[_0x9588('0x15')](function(_0x5703ce){logger[_0x9588('0x12')](_0x9588('0xe'),_0x1289ee,_0x5703ce);_0x4f76fa(_0x5703ce);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index c8ba1e2..0c1716e 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 _0x4078=['emit','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update'];(function(_0x47bc5e,_0x6fc500){var _0x323a59=function(_0x32df89){while(--_0x32df89){_0x47bc5e['push'](_0x47bc5e['shift']());}};_0x323a59(++_0x6fc500);}(_0x4078,0x8c));var _0x8407=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0x4078[_0x256d6a];return _0x460058;};'use strict';var ChatInternalMessageEvents=require(_0x8407('0x0'));var events=[_0x8407('0x1'),_0x8407('0x2'),_0x8407('0x3')];function createListener(_0x43ecd6,_0x2ef1e3){return function(_0x5d79f9){_0x2ef1e3[_0x8407('0x4')](_0x43ecd6,_0x5d79f9);};}function removeListener(_0x2284e7,_0x591266){return function(){ChatInternalMessageEvents['removeListener'](_0x2284e7,_0x591266);};}exports[_0x8407('0x5')]=function(_0x1ee917){for(var _0x5ec35a=0x0,_0x1ec356=events[_0x8407('0x6')];_0x5ec35a<_0x1ec356;_0x5ec35a++){var _0x2439ca=events[_0x5ec35a];var _0x3cd325=createListener(_0x8407('0x7')+_0x2439ca,_0x1ee917);ChatInternalMessageEvents['on'](_0x2439ca,_0x3cd325);}}; \ No newline at end of file +var _0xa798=['save','remove','update','emit','removeListener','register','chatInternalMessage:'];(function(_0x1a5243,_0x2755ec){var _0x575645=function(_0x54ee7c){while(--_0x54ee7c){_0x1a5243['push'](_0x1a5243['shift']());}};_0x575645(++_0x2755ec);}(_0xa798,0x17a));var _0x8a79=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa798[_0x25bea7];return _0x175952;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x8a79('0x0'),_0x8a79('0x1'),_0x8a79('0x2')];function createListener(_0x510ea1,_0x1d1b5f){return function(_0x53ec74){_0x1d1b5f[_0x8a79('0x3')](_0x510ea1,_0x53ec74);};}function removeListener(_0x52f725,_0x31db43){return function(){ChatInternalMessageEvents[_0x8a79('0x4')](_0x52f725,_0x31db43);};}exports[_0x8a79('0x5')]=function(_0x3fe06c){for(var _0x68553=0x0,_0x406015=events['length'];_0x68553<_0x406015;_0x68553++){var _0x552f20=events[_0x68553];var _0x31f9f3=createListener(_0x8a79('0x6')+_0x552f20,_0x3fe06c);ChatInternalMessageEvents['on'](_0x552f20,_0x31f9f3);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 9d2b0bd..075a98a 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 _0x1c56=['../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','get','/describe','getUsers','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3fcd67,_0x4d624e){var _0x22ced0=function(_0x413627){while(--_0x413627){_0x3fcd67['push'](_0x3fcd67['shift']());}};_0x22ced0(++_0x4d624e);}(_0x1c56,0x19d));var _0x61c5=function(_0x389832,_0x10a4a9){_0x389832=_0x389832-0x0;var _0x59429e=_0x1c56[_0x389832];return _0x59429e;};'use strict';var multer=require(_0x61c5('0x0'));var util=require(_0x61c5('0x1'));var path=require(_0x61c5('0x2'));var timeout=require(_0x61c5('0x3'));var express=require('express');var router=express[_0x61c5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x61c5('0x5'));var interaction=require(_0x61c5('0x6'));var config=require(_0x61c5('0x7'));var controller=require(_0x61c5('0x8'));router['get']('/',auth[_0x61c5('0x9')](),controller[_0x61c5('0xa')]);router[_0x61c5('0xb')](_0x61c5('0xc'),auth[_0x61c5('0x9')](),controller['describe']);router[_0x61c5('0xb')]('/users',auth['isAuthenticated'](),controller[_0x61c5('0xd')]);router['get'](_0x61c5('0xe'),auth['isAuthenticated'](),controller[_0x61c5('0xf')]);router[_0x61c5('0x10')]('/',auth[_0x61c5('0x9')](),controller[_0x61c5('0x11')]);router['put'](_0x61c5('0xe'),controller['update']);router[_0x61c5('0x12')](_0x61c5('0xe'),auth[_0x61c5('0x9')](),controller[_0x61c5('0x13')]);module[_0x61c5('0x14')]=router; \ No newline at end of file +var _0x2e82=['./chatInternalMessage.controller','get','index','isAuthenticated','describe','/users','getUsers','show','post','/:id','update','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x633a64,_0x546fe2){var _0x3f60e7=function(_0x3401a8){while(--_0x3401a8){_0x633a64['push'](_0x633a64['shift']());}};_0x3f60e7(++_0x546fe2);}(_0x2e82,0x1e8));var _0x22e8=function(_0x330875,_0x35b36e){_0x330875=_0x330875-0x0;var _0xd4813c=_0x2e82[_0x330875];return _0xd4813c;};'use strict';var multer=require('multer');var util=require(_0x22e8('0x0'));var path=require(_0x22e8('0x1'));var timeout=require('connect-timeout');var express=require(_0x22e8('0x2'));var router=express[_0x22e8('0x3')]();var fs_extra=require(_0x22e8('0x4'));var auth=require(_0x22e8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x22e8('0x6'));router[_0x22e8('0x7')]('/',auth['isAuthenticated'](),controller[_0x22e8('0x8')]);router['get']('/describe',auth[_0x22e8('0x9')](),controller[_0x22e8('0xa')]);router[_0x22e8('0x7')](_0x22e8('0xb'),auth[_0x22e8('0x9')](),controller[_0x22e8('0xc')]);router[_0x22e8('0x7')]('/:id',auth[_0x22e8('0x9')](),controller[_0x22e8('0xd')]);router[_0x22e8('0xe')]('/',auth[_0x22e8('0x9')](),controller['create']);router['put'](_0x22e8('0xf'),controller[_0x22e8('0x10')]);router[_0x22e8('0x11')](_0x22e8('0xf'),auth[_0x22e8('0x9')](),controller[_0x22e8('0x12')]);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 6d9c060..82ab2a0 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 _0x0b70=['ENUM','out','STRING','exports','medium','BOOLEAN'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x0b70,0x159));var _0x00b7=function(_0x4fae85,_0x370e6a){_0x4fae85=_0x4fae85-0x0;var _0x121bab=_0x0b70[_0x4fae85];return _0x121bab;};'use strict';var Sequelize=require('sequelize');module[_0x00b7('0x0')]={'body':{'type':Sequelize['TEXT'](_0x00b7('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x00b7('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x00b7('0x3')]('in',_0x00b7('0x4')),'defaultValue':_0x00b7('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x00b7('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb846=['STRING','TEXT','sequelize','medium','BOOLEAN','ENUM','DATE'];(function(_0x219fa0,_0x18b239){var _0xc603fb=function(_0x3371ad){while(--_0x3371ad){_0x219fa0['push'](_0x219fa0['shift']());}};_0xc603fb(++_0x18b239);}(_0xb846,0x1d0));var _0x6b84=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xb846[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require(_0x6b84('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x6b84('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x6b84('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x6b84('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6b84('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x6b84('0x4')]},'providerName':{'type':Sequelize[_0x6b84('0x5')]},'providerResponse':{'type':Sequelize[_0x6b84('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 9ee1e16..854538e 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 _0xf91c=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','ChatMessage','fieldName','model','keys','query','intersection','fields','attributes','nolimit','sort','where','pick','filters','filter','type','VIRTUAL','merge','options','include','findAll','rows','show','rawAttributes','length','find','create','body','params','describe','../../config/logger','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','chat-interactions','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','User','rejectmessage','formData','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse'];(function(_0x4a5760,_0x134c15){var _0x2994b=function(_0x9c3df8){while(--_0x9c3df8){_0x4a5760['push'](_0x4a5760['shift']());}};_0x2994b(++_0x134c15);}(_0xf91c,0x18d));var _0xcf91=function(_0x9be3f0,_0x628568){_0x9be3f0=_0x9be3f0-0x0;var _0x96930b=_0xf91c[_0x9be3f0];return _0x96930b;};'use strict';var emlformat=require(_0xcf91('0x0'));var rimraf=require(_0xcf91('0x1'));var zipdir=require(_0xcf91('0x2'));var jsonpatch=require(_0xcf91('0x3'));var rp=require('request-promise');var moment=require(_0xcf91('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcf91('0x5'));var util=require(_0xcf91('0x6'));var path=require(_0xcf91('0x7'));var sox=require(_0xcf91('0x8'));var csv=require(_0xcf91('0x9'));var ejs=require(_0xcf91('0xa'));var fs=require('fs');var fs_extra=require(_0xcf91('0xb'));var _=require('lodash');var squel=require(_0xcf91('0xc'));var crypto=require(_0xcf91('0xd'));var jsforce=require(_0xcf91('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcf91('0x9'));var querystring=require(_0xcf91('0xf'));var Papa=require(_0xcf91('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcf91('0x11'));var as=require(_0xcf91('0x12'));var hardwareService=require(_0xcf91('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xcf91('0x14'));var config=require(_0xcf91('0x15'));var licenseUtil=require(_0xcf91('0x16'));var db=require('../../mysqldb')['db'];config[_0xcf91('0x17')]=_[_0xcf91('0x18')](config[_0xcf91('0x17')],{'host':_0xcf91('0x19'),'port':0x18eb});var socket=require(_0xcf91('0x1a'))(new Redis(config[_0xcf91('0x17')]));require(_0xcf91('0x1b'))[_0xcf91('0x1c')](socket);var jayson=require(_0xcf91('0x1d'));var client=jayson[_0xcf91('0x1e')][_0xcf91('0x1f')]({'port':0x232c});var client9002=jayson[_0xcf91('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c41f2,_0x2a2746,_0x375924,_0x3bf9c1){return new BPromise(function(_0x27000b,_0x177f53){var _0x453cdd=_0x3bf9c1||client;return _0x453cdd[_0xcf91('0x20')](_0x2c41f2,_0x375924)[_0xcf91('0x21')](function(_0x293c26){logger[_0xcf91('0x22')](_0xcf91('0x23'),_0x2a2746,_0xcf91('0x24'));logger[_0xcf91('0x25')](_0xcf91('0x26'),_0x2a2746,_0xcf91('0x24'),JSON[_0xcf91('0x27')](_0x293c26));if(_0x293c26['error']){if(_0x293c26[_0xcf91('0x28')][_0xcf91('0x29')]===0x1f4){logger[_0xcf91('0x28')](_0xcf91('0x23'),_0x2a2746,_0x293c26[_0xcf91('0x28')][_0xcf91('0x2a')]);return _0x177f53(_0x293c26[_0xcf91('0x28')]['message']);}logger[_0xcf91('0x28')](_0xcf91('0x23'),_0x2a2746,_0x293c26[_0xcf91('0x28')][_0xcf91('0x2a')]);return _0x27000b(_0x293c26[_0xcf91('0x28')]['message']);}else{logger[_0xcf91('0x22')](_0xcf91('0x23'),_0x2a2746,_0xcf91('0x24'));_0x27000b(_0x293c26[_0xcf91('0x2b')][_0xcf91('0x2a')]);}})[_0xcf91('0x2c')](function(_0x1b25fb){logger[_0xcf91('0x28')]('ChatMessage,\x20%s,\x20%s',_0x2a2746,_0x1b25fb);_0x177f53(_0x1b25fb);});});}function respondWithStatusCode(_0xe871c2,_0x54c024){_0x54c024=_0x54c024||0xcc;return function(_0x3357ae){if(_0x3357ae){return _0xe871c2['sendStatus'](_0x54c024);}return _0xe871c2[_0xcf91('0x2d')](_0x54c024)[_0xcf91('0x2e')]();};}function respondWithResult(_0x4249ac,_0x4a1e61){_0x4a1e61=_0x4a1e61||0xc8;return function(_0x4aecd2){if(_0x4aecd2){return _0x4249ac['status'](_0x4a1e61)[_0xcf91('0x2f')](_0x4aecd2);}};}function respondWithFilteredResult(_0x42d3b8,_0xfaf4dc){return function(_0x512b88){if(_0x512b88){var _0x2629d1=typeof _0xfaf4dc[_0xcf91('0x30')]===_0xcf91('0x31')&&typeof _0xfaf4dc['limit']===_0xcf91('0x31');var _0x443d9d=_0x512b88[_0xcf91('0x32')];var _0x27a46f=_0x2629d1?0x0:_0xfaf4dc[_0xcf91('0x30')];var _0x5987c2=_0x2629d1?_0x512b88[_0xcf91('0x32')]:_0xfaf4dc[_0xcf91('0x30')]+_0xfaf4dc[_0xcf91('0x33')];var _0x2e199b;if(_0x5987c2>=_0x443d9d){_0x5987c2=_0x443d9d;_0x2e199b=0xc8;}else{_0x2e199b=0xce;}_0x42d3b8['status'](_0x2e199b);return _0x42d3b8[_0xcf91('0x34')](_0xcf91('0x35'),_0x27a46f+'-'+_0x5987c2+'/'+_0x443d9d)['json'](_0x512b88);}return null;};}function patchUpdates(_0x2b993b){return function(_0x241e0d){try{jsonpatch[_0xcf91('0x36')](_0x241e0d,_0x2b993b,!![]);}catch(_0x1ef023){return BPromise[_0xcf91('0x37')](_0x1ef023);}return _0x241e0d[_0xcf91('0x38')]();};}function saveUpdates(_0x1af79c,_0x430e35){return function(_0x375715){if(_0x375715){return _0x375715[_0xcf91('0x39')](_0x1af79c)['then'](function(_0x32babe){return _0x32babe;});}return null;};}function removeEntity(_0x22919e,_0xcd08f9){return function(_0x3ab546){if(_0x3ab546){return _0x3ab546[_0xcf91('0x3a')]()[_0xcf91('0x21')](function(){_0x22919e[_0xcf91('0x2d')](0xcc)[_0xcf91('0x2e')]();});}};}function handleEntityNotFound(_0xf64e95,_0x273e7a){return function(_0x5393cc){if(!_0x5393cc){_0xf64e95[_0xcf91('0x3b')](0x194);}return _0x5393cc;};}function handleError(_0x1b4bde,_0x3f6bf7){_0x3f6bf7=_0x3f6bf7||0x1f4;return function(_0x3b5154){logger['error'](_0x3b5154[_0xcf91('0x3c')]);if(_0x3b5154['name']){delete _0x3b5154[_0xcf91('0x3d')];}_0x1b4bde[_0xcf91('0x2d')](_0x3f6bf7)[_0xcf91('0x3e')](_0x3b5154);};}exports[_0xcf91('0x3f')]=function(_0x2f8a6c,_0x290bbc){var _0x1ba2d8={},_0x1a169a={},_0x3a4c4d={'count':0x0,'rows':[]};var _0x482dcb=_[_0xcf91('0x40')](db[_0xcf91('0x41')]['rawAttributes'],function(_0x599d52){return{'name':_0x599d52[_0xcf91('0x42')],'type':_0x599d52['type']['key']};});_0x1a169a[_0xcf91('0x43')]=_[_0xcf91('0x40')](_0x482dcb,_0xcf91('0x3d'));_0x1a169a['query']=_[_0xcf91('0x44')](_0x2f8a6c[_0xcf91('0x45')]);_0x1a169a['filters']=_[_0xcf91('0x46')](_0x1a169a[_0xcf91('0x43')],_0x1a169a[_0xcf91('0x45')]);_0x1ba2d8['attributes']=_['intersection'](_0x1a169a[_0xcf91('0x43')],qs[_0xcf91('0x47')](_0x2f8a6c['query'][_0xcf91('0x47')]));_0x1ba2d8['attributes']=_0x1ba2d8['attributes']['length']?_0x1ba2d8[_0xcf91('0x48')]:_0x1a169a[_0xcf91('0x43')];if(!_0x2f8a6c[_0xcf91('0x45')]['hasOwnProperty'](_0xcf91('0x49'))){_0x1ba2d8[_0xcf91('0x33')]=qs[_0xcf91('0x33')](_0x2f8a6c[_0xcf91('0x45')][_0xcf91('0x33')]);_0x1ba2d8[_0xcf91('0x30')]=qs[_0xcf91('0x30')](_0x2f8a6c[_0xcf91('0x45')][_0xcf91('0x30')]);}_0x1ba2d8['order']=qs[_0xcf91('0x4a')](_0x2f8a6c[_0xcf91('0x45')][_0xcf91('0x4a')]);_0x1ba2d8[_0xcf91('0x4b')]=qs['filters'](_[_0xcf91('0x4c')](_0x2f8a6c['query'],_0x1a169a[_0xcf91('0x4d')]),_0x482dcb);if(_0x2f8a6c[_0xcf91('0x45')][_0xcf91('0x4e')]){_0x1ba2d8[_0xcf91('0x4b')]=_['merge'](_0x1ba2d8[_0xcf91('0x4b')],{'$or':_[_0xcf91('0x40')](_0x482dcb,function(_0x4adacd){if(_0x4adacd[_0xcf91('0x4f')]!==_0xcf91('0x50')){var _0x1519ee={};_0x1519ee[_0x4adacd[_0xcf91('0x3d')]]={'$like':'%'+_0x2f8a6c[_0xcf91('0x45')][_0xcf91('0x4e')]+'%'};return _0x1519ee;}})});}_0x1ba2d8=_[_0xcf91('0x51')]({},_0x1ba2d8,_0x2f8a6c[_0xcf91('0x52')]);var _0x3d608e={'where':_0x1ba2d8[_0xcf91('0x4b')]};return db[_0xcf91('0x41')][_0xcf91('0x32')](_0x3d608e)[_0xcf91('0x21')](function(_0x5b964e){_0x3a4c4d[_0xcf91('0x32')]=_0x5b964e;if(_0x2f8a6c[_0xcf91('0x45')]['includeAll']){_0x1ba2d8[_0xcf91('0x53')]=[{'all':!![]}];}return db['ChatMessage'][_0xcf91('0x54')](_0x1ba2d8);})[_0xcf91('0x21')](function(_0x8360a2){_0x3a4c4d[_0xcf91('0x55')]=_0x8360a2;return _0x3a4c4d;})[_0xcf91('0x21')](respondWithFilteredResult(_0x290bbc,_0x1ba2d8))['catch'](handleError(_0x290bbc,null));};exports[_0xcf91('0x56')]=function(_0x412ac4,_0x16cdaa){var _0x26c4c3={'raw':!![],'where':{'id':_0x412ac4['params']['id']}},_0x4d8ce8={};_0x4d8ce8[_0xcf91('0x43')]=_[_0xcf91('0x44')](db['ChatMessage'][_0xcf91('0x57')]);_0x4d8ce8[_0xcf91('0x45')]=_['keys'](_0x412ac4['query']);_0x4d8ce8[_0xcf91('0x4d')]=_['intersection'](_0x4d8ce8[_0xcf91('0x43')],_0x4d8ce8[_0xcf91('0x45')]);_0x26c4c3[_0xcf91('0x48')]=_[_0xcf91('0x46')](_0x4d8ce8[_0xcf91('0x43')],qs[_0xcf91('0x47')](_0x412ac4[_0xcf91('0x45')][_0xcf91('0x47')]));_0x26c4c3[_0xcf91('0x48')]=_0x26c4c3[_0xcf91('0x48')][_0xcf91('0x58')]?_0x26c4c3[_0xcf91('0x48')]:_0x4d8ce8[_0xcf91('0x43')];if(_0x412ac4['query']['includeAll']){_0x26c4c3[_0xcf91('0x53')]=[{'all':!![]}];}_0x26c4c3=_[_0xcf91('0x51')]({},_0x26c4c3,_0x412ac4[_0xcf91('0x52')]);return db[_0xcf91('0x41')][_0xcf91('0x59')](_0x26c4c3)[_0xcf91('0x21')](handleEntityNotFound(_0x16cdaa,null))['then'](respondWithResult(_0x16cdaa,null))['catch'](handleError(_0x16cdaa,null));};exports[_0xcf91('0x5a')]=function(_0x577616,_0xf938ef){return db[_0xcf91('0x41')][_0xcf91('0x5a')](_0x577616[_0xcf91('0x5b')],{})[_0xcf91('0x21')](respondWithResult(_0xf938ef,0xc9))[_0xcf91('0x2c')](handleError(_0xf938ef,null));};exports[_0xcf91('0x39')]=function(_0x372356,_0x37d1dd){if(_0x372356[_0xcf91('0x5b')]['id']){delete _0x372356[_0xcf91('0x5b')]['id'];}return db[_0xcf91('0x41')][_0xcf91('0x59')]({'where':{'id':_0x372356[_0xcf91('0x5c')]['id']}})[_0xcf91('0x21')](handleEntityNotFound(_0x37d1dd,null))['then'](saveUpdates(_0x372356[_0xcf91('0x5b')],null))[_0xcf91('0x21')](respondWithResult(_0x37d1dd,null))[_0xcf91('0x2c')](handleError(_0x37d1dd,null));};exports[_0xcf91('0x3a')]=function(_0x48210c,_0xff2865){return db[_0xcf91('0x41')][_0xcf91('0x59')]({'where':{'id':_0x48210c[_0xcf91('0x5c')]['id']}})[_0xcf91('0x21')](handleEntityNotFound(_0xff2865,null))['then'](removeEntity(_0xff2865,null))[_0xcf91('0x2c')](handleError(_0xff2865,null));};exports['describe']=function(_0xa66f8c,_0x1e5851){return db['ChatMessage'][_0xcf91('0x5d')]()[_0xcf91('0x21')](respondWithResult(_0x1e5851,null))[_0xcf91('0x2c')](handleError(_0x1e5851,null));};var interaction_log=require(_0xcf91('0x5e'))('chat-interactions');exports[_0xcf91('0x5f')]=function(_0x57796a,_0x2c3dee,_0x289fe8){var _0x1def09={'agent':{},'channel':'chat'};if(_0x57796a[_0xcf91('0x5b')]['id']){delete _0x57796a[_0xcf91('0x5b')]['id'];}_0x57796a[_0xcf91('0x5b')][_0xcf91('0x60')]=!![];_0x57796a[_0xcf91('0x5b')]['readAt']=moment()[_0xcf91('0x61')](_0xcf91('0x62'));_0x57796a[_0xcf91('0x5b')]['UserId']=_0x57796a[_0xcf91('0x5b')][_0xcf91('0x63')]||_0x57796a[_0xcf91('0x64')]['id'];_0x1def09[_0xcf91('0x65')]['id']=_0x57796a['body'][_0xcf91('0x63')];return db[_0xcf91('0x41')][_0xcf91('0x59')]({'where':{'id':_0x57796a[_0xcf91('0x5c')]['id'],'UserId':null}})[_0xcf91('0x21')](handleEntityNotFound(_0x2c3dee,null))['then'](saveUpdates(_0x57796a[_0xcf91('0x5b')],null))['then'](function(_0x5bb542){if(_0x5bb542){_0x1def09[_0xcf91('0x2a')]=_0x5bb542[_0xcf91('0x66')]({'plain':!![]});return db[_0xcf91('0x67')]['find']({'where':{'id':_0x5bb542[_0xcf91('0x68')]}});}return null;})[_0xcf91('0x21')](handleEntityNotFound(_0x2c3dee,null))['then'](function(_0x1a39a2){if(_0x1a39a2){return _0x1a39a2[_0xcf91('0x39')]({'UserId':_0x57796a[_0xcf91('0x5b')]['UserId'],'read1stAt':_[_0xcf91('0x69')](_0x1a39a2[_0xcf91('0x6a')])?moment()[_0xcf91('0x61')](_0xcf91('0x62')):undefined});}return null;})[_0xcf91('0x21')](function(_0x58b321){if(_0x58b321){_0x1def09[_0xcf91('0x6b')]=_0x58b321[_0xcf91('0x66')]({'plain':!![]});interaction_log[_0xcf91('0x22')](_0xcf91('0x6c'),_0x57796a[_0xcf91('0x64')]['id'],_0x57796a[_0xcf91('0x64')][_0xcf91('0x3d')],_0x57796a[_0xcf91('0x64')][_0xcf91('0x6d')],_0x1def09[_0xcf91('0x6b')]['id'],_0x57796a[_0xcf91('0x5b')]?JSON['stringify'](_0x57796a[_0xcf91('0x5b')]):_0xcf91('0x6e'));return respondWithRpcPromise(_0xcf91('0x6f'),'acceptMessage',_0x1def09);}return null;})[_0xcf91('0x21')](function(_0x2279ea){var _0x4024ef=_0xcf91('0x70')+_0x2279ea[_0xcf91('0x2a')][_0xcf91('0x71')];return db[_0xcf91('0x72')]['query'](_0x4024ef,{'type':db['Sequelize'][_0xcf91('0x73')][_0xcf91('0x74')],'raw':!![]})[_0xcf91('0x21')](function(_0x55dc47){return _0x55dc47;});})[_0xcf91('0x21')](function(_0x69385a){if(_0x69385a){_0x1def09[_0xcf91('0x2a')]['contact']=_0x69385a[0x0];if(!_0x57796a[_0xcf91('0x5b')]['UserId'])return;return db['User'][_0xcf91('0x59')]({'where':{'id':_0x57796a['body']['UserId'],'role':_0xcf91('0x65')},'attributes':['id',_0xcf91('0x3d'),_0xcf91('0x75'),_0xcf91('0x76'),_0xcf91('0x77')],'raw':!![]});}return null;})['then'](function(_0x2dcd88){if(!_0x2dcd88)return null;_0x1def09[_0xcf91('0x2a')][_0xcf91('0x65')]=_0x2dcd88;return _0x1def09;})['then'](function(_0x52e048){if(_0x52e048){if(_0x57796a[_0xcf91('0x5b')][_0xcf91('0x78')]){_0x1def09[_0xcf91('0x2a')][_0xcf91('0x79')]=util['format'](_0xcf91('0x7a'),_0x57796a[_0xcf91('0x64')][_0xcf91('0x3d')]);_0x1def09['message'][_0xcf91('0x7b')]=_0x1def09['channel'];_0x1def09[_0xcf91('0x2a')][_0xcf91('0x7c')]=_0x1def09[_0xcf91('0x7b')];_0x1def09[_0xcf91('0x2a')][_0xcf91('0x7d')]=_0xcf91('0x5f');return respondWithRpcPromise(_0xcf91('0x7e'),_0xcf91('0x7e'),{'event':_0xcf91('0x7f'),'message':_[_0xcf91('0x51')](_0x1def09[_0xcf91('0x2a')],JSON[_0xcf91('0x80')](_0x1def09[_0xcf91('0x6b')]['formData']))},client9002)[_0xcf91('0x21')](function(){return _0x1def09;});}return _0x1def09;}return null;})[_0xcf91('0x21')](respondWithResult(_0x2c3dee,null))[_0xcf91('0x2c')](handleError(_0x2c3dee,null));};var interaction_log=require(_0xcf91('0x5e'))(_0xcf91('0x81'));exports[_0xcf91('0x37')]=function(_0x41fd55,_0x39e96e,_0x5c514e){var _0x3872dc={'agent':{},'channel':_0xcf91('0x82')};if(_0x41fd55[_0xcf91('0x5b')]['id']){delete _0x41fd55[_0xcf91('0x5b')]['id'];}_0x41fd55[_0xcf91('0x5b')][_0xcf91('0x63')]=_0x41fd55[_0xcf91('0x5b')][_0xcf91('0x63')]||_0x41fd55[_0xcf91('0x64')]['id'];_0x3872dc[_0xcf91('0x65')]['id']=_0x41fd55[_0xcf91('0x5b')]['UserId'];return db[_0xcf91('0x41')][_0xcf91('0x59')]({'where':{'id':_0x41fd55[_0xcf91('0x5c')]['id'],'UserId':null}})[_0xcf91('0x21')](handleEntityNotFound(_0x39e96e,null))[_0xcf91('0x21')](function(_0x145eea){if(_0x145eea){_0x3872dc[_0xcf91('0x2a')]=_0x145eea[_0xcf91('0x66')]({'plain':!![]});return db[_0xcf91('0x67')][_0xcf91('0x59')]({'where':{'id':_0x145eea[_0xcf91('0x68')]}});}return null;})[_0xcf91('0x21')](handleEntityNotFound(_0x39e96e,null))[_0xcf91('0x21')](function(_0x386f2b){if(_0x386f2b){_0x3872dc['interaction']=_0x386f2b[_0xcf91('0x66')]({'plain':!![]});interaction_log['info'](_0xcf91('0x83'),_0x41fd55[_0xcf91('0x64')]['id'],_0x41fd55['user']['name'],_0x41fd55[_0xcf91('0x64')][_0xcf91('0x6d')],_0x3872dc[_0xcf91('0x6b')]['id'],_0x41fd55[_0xcf91('0x5b')]?JSON[_0xcf91('0x27')](_0x41fd55[_0xcf91('0x5b')]):_0xcf91('0x6e'));return respondWithRpcPromise(_0xcf91('0x84'),_0xcf91('0x85'),_0x3872dc);}return null;})['then'](function(_0x303c69){var _0x5d9000=_0xcf91('0x70')+_0x303c69['message'][_0xcf91('0x71')];return db[_0xcf91('0x72')][_0xcf91('0x45')](_0x5d9000,{'type':db['Sequelize']['QueryTypes'][_0xcf91('0x74')],'raw':!![]})[_0xcf91('0x21')](function(_0x1eedc5){return _0x1eedc5;});})[_0xcf91('0x21')](function(_0x4ca4e8){if(_0x4ca4e8){_0x3872dc[_0xcf91('0x2a')][_0xcf91('0x86')]=_0x4ca4e8[0x0];if(!_0x41fd55[_0xcf91('0x5b')][_0xcf91('0x63')])return;return db[_0xcf91('0x87')]['find']({'where':{'id':_0x41fd55[_0xcf91('0x5b')][_0xcf91('0x63')],'role':_0xcf91('0x65')},'attributes':['id',_0xcf91('0x3d'),_0xcf91('0x75'),'email',_0xcf91('0x77')],'raw':!![]});}return null;})['then'](function(_0x303a96){if(!_0x303a96)return null;_0x3872dc[_0xcf91('0x2a')][_0xcf91('0x65')]=_0x303a96;return _0x3872dc;})[_0xcf91('0x21')](function(_0x2d9b89){if(_0x2d9b89){_0x2d9b89[_0xcf91('0x2a')]['interface']=util['format']('SIP/%s',_0x41fd55[_0xcf91('0x64')][_0xcf91('0x3d')]);_0x2d9b89[_0xcf91('0x2a')][_0xcf91('0x7b')]=_0x3872dc[_0xcf91('0x7b')];_0x2d9b89[_0xcf91('0x2a')][_0xcf91('0x7c')]=_0x3872dc[_0xcf91('0x7b')];_0x2d9b89['message'][_0xcf91('0x7d')]=_0xcf91('0x37');respondWithRpcPromise('EventManager',_0xcf91('0x7e'),{'event':_0xcf91('0x88'),'message':_[_0xcf91('0x51')](_0x3872dc[_0xcf91('0x2a')],JSON[_0xcf91('0x80')](_0x3872dc[_0xcf91('0x6b')][_0xcf91('0x89')]))},client9002);return _0x3872dc;}return null;})[_0xcf91('0x21')](respondWithResult(_0x39e96e,null))[_0xcf91('0x2c')](handleError(_0x39e96e,null));}; \ No newline at end of file +var _0x9d60=['localhost','socket.io-emitter','./chatMessage.socket','register','http','client','request','then','info','request\x20sent','debug','stringify','error','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','where','filter','merge','VIRTUAL','ChatMessage','includeAll','include','findAll','rows','show','params','length','find','create','update','body','describe','chat-interactions','accept','chat','read','readAt','UserId','user','agent','ChatInteraction','ChatInteractionId','read1stAt','interaction','get','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','internal','manual','interface','format','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','ContactId','fullname','email','rejectmessage','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','redis','defaults'];(function(_0xb84935,_0xcfc95c){var _0x3579fc=function(_0x52af36){while(--_0x52af36){_0xb84935['push'](_0xb84935['shift']());}};_0x3579fc(++_0xcfc95c);}(_0x9d60,0x1e6));var _0x09d6=function(_0x41b0a8,_0x1b05cc){_0x41b0a8=_0x41b0a8-0x0;var _0x3a83d4=_0x9d60[_0x41b0a8];return _0x3a83d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x09d6('0x0'));var zipdir=require(_0x09d6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x09d6('0x2'));var moment=require(_0x09d6('0x3'));var BPromise=require(_0x09d6('0x4'));var Mustache=require(_0x09d6('0x5'));var util=require(_0x09d6('0x6'));var path=require(_0x09d6('0x7'));var sox=require(_0x09d6('0x8'));var csv=require(_0x09d6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x09d6('0xa'));var _=require('lodash');var squel=require(_0x09d6('0xb'));var crypto=require(_0x09d6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x09d6('0xd'));var toCsv=require(_0x09d6('0x9'));var querystring=require(_0x09d6('0xe'));var Papa=require('papaparse');var Redis=require(_0x09d6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x09d6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x09d6('0x11'));var logger=require(_0x09d6('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x09d6('0x13'))['db'];config[_0x09d6('0x14')]=_[_0x09d6('0x15')](config['redis'],{'host':_0x09d6('0x16'),'port':0x18eb});var socket=require(_0x09d6('0x17'))(new Redis(config['redis']));require(_0x09d6('0x18'))[_0x09d6('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x09d6('0x1a')]({'port':0x232c});var client9002=jayson[_0x09d6('0x1b')][_0x09d6('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x362700,_0x5e3783,_0x4493ad,_0x40f6aa){return new BPromise(function(_0x22fa85,_0x3b9e66){var _0x1e9dc6=_0x40f6aa||client;return _0x1e9dc6[_0x09d6('0x1c')](_0x362700,_0x4493ad)[_0x09d6('0x1d')](function(_0x39ca3f){logger[_0x09d6('0x1e')]('ChatMessage,\x20%s,\x20%s',_0x5e3783,_0x09d6('0x1f'));logger[_0x09d6('0x20')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x5e3783,'request\x20sent',JSON[_0x09d6('0x21')](_0x39ca3f));if(_0x39ca3f['error']){if(_0x39ca3f['error']['code']===0x1f4){logger[_0x09d6('0x22')](_0x09d6('0x23'),_0x5e3783,_0x39ca3f[_0x09d6('0x22')][_0x09d6('0x24')]);return _0x3b9e66(_0x39ca3f[_0x09d6('0x22')][_0x09d6('0x24')]);}logger[_0x09d6('0x22')](_0x09d6('0x23'),_0x5e3783,_0x39ca3f[_0x09d6('0x22')][_0x09d6('0x24')]);return _0x22fa85(_0x39ca3f[_0x09d6('0x22')][_0x09d6('0x24')]);}else{logger['info'](_0x09d6('0x23'),_0x5e3783,_0x09d6('0x1f'));_0x22fa85(_0x39ca3f[_0x09d6('0x25')]['message']);}})[_0x09d6('0x26')](function(_0x5bedf8){logger[_0x09d6('0x22')]('ChatMessage,\x20%s,\x20%s',_0x5e3783,_0x5bedf8);_0x3b9e66(_0x5bedf8);});});}function respondWithStatusCode(_0x54ae56,_0x25dcd0){_0x25dcd0=_0x25dcd0||0xcc;return function(_0x2217de){if(_0x2217de){return _0x54ae56[_0x09d6('0x27')](_0x25dcd0);}return _0x54ae56[_0x09d6('0x28')](_0x25dcd0)[_0x09d6('0x29')]();};}function respondWithResult(_0x58d8d3,_0x3ea534){_0x3ea534=_0x3ea534||0xc8;return function(_0x44ef81){if(_0x44ef81){return _0x58d8d3[_0x09d6('0x28')](_0x3ea534)[_0x09d6('0x2a')](_0x44ef81);}};}function respondWithFilteredResult(_0x1ebd88,_0x5d230b){return function(_0x3a75f5){if(_0x3a75f5){var _0x243432=typeof _0x5d230b[_0x09d6('0x2b')]===_0x09d6('0x2c')&&typeof _0x5d230b['limit']===_0x09d6('0x2c');var _0x4ad4bb=_0x3a75f5[_0x09d6('0x2d')];var _0x2bb16c=_0x243432?0x0:_0x5d230b[_0x09d6('0x2b')];var _0x368f25=_0x243432?_0x3a75f5[_0x09d6('0x2d')]:_0x5d230b[_0x09d6('0x2b')]+_0x5d230b[_0x09d6('0x2e')];var _0x1b89c4;if(_0x368f25>=_0x4ad4bb){_0x368f25=_0x4ad4bb;_0x1b89c4=0xc8;}else{_0x1b89c4=0xce;}_0x1ebd88[_0x09d6('0x28')](_0x1b89c4);return _0x1ebd88['set'](_0x09d6('0x2f'),_0x2bb16c+'-'+_0x368f25+'/'+_0x4ad4bb)[_0x09d6('0x2a')](_0x3a75f5);}return null;};}function patchUpdates(_0x3d9d69){return function(_0x1f8775){try{jsonpatch[_0x09d6('0x30')](_0x1f8775,_0x3d9d69,!![]);}catch(_0x25444d){return BPromise[_0x09d6('0x31')](_0x25444d);}return _0x1f8775[_0x09d6('0x32')]();};}function saveUpdates(_0x1b96db,_0x38156e){return function(_0x4dfcd7){if(_0x4dfcd7){return _0x4dfcd7['update'](_0x1b96db)[_0x09d6('0x1d')](function(_0x1327a7){return _0x1327a7;});}return null;};}function removeEntity(_0x1688e0,_0x157ff8){return function(_0x5aa17e){if(_0x5aa17e){return _0x5aa17e[_0x09d6('0x33')]()[_0x09d6('0x1d')](function(){_0x1688e0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12fd4c,_0x253b7a){return function(_0x1933f3){if(!_0x1933f3){_0x12fd4c[_0x09d6('0x27')](0x194);}return _0x1933f3;};}function handleError(_0x57327b,_0x19c48c){_0x19c48c=_0x19c48c||0x1f4;return function(_0x46e302){logger[_0x09d6('0x22')](_0x46e302[_0x09d6('0x34')]);if(_0x46e302[_0x09d6('0x35')]){delete _0x46e302['name'];}_0x57327b['status'](_0x19c48c)[_0x09d6('0x36')](_0x46e302);};}exports[_0x09d6('0x37')]=function(_0x5013d9,_0xb667b2){var _0x498549={},_0x5d54d8={},_0x57e8ce={'count':0x0,'rows':[]};var _0x31b77d=_[_0x09d6('0x38')](db['ChatMessage'][_0x09d6('0x39')],function(_0x59a660){return{'name':_0x59a660[_0x09d6('0x3a')],'type':_0x59a660['type'][_0x09d6('0x3b')]};});_0x5d54d8[_0x09d6('0x3c')]=_[_0x09d6('0x38')](_0x31b77d,_0x09d6('0x35'));_0x5d54d8[_0x09d6('0x3d')]=_[_0x09d6('0x3e')](_0x5013d9[_0x09d6('0x3d')]);_0x5d54d8[_0x09d6('0x3f')]=_['intersection'](_0x5d54d8[_0x09d6('0x3c')],_0x5d54d8[_0x09d6('0x3d')]);_0x498549[_0x09d6('0x40')]=_[_0x09d6('0x41')](_0x5d54d8[_0x09d6('0x3c')],qs[_0x09d6('0x42')](_0x5013d9[_0x09d6('0x3d')]['fields']));_0x498549[_0x09d6('0x40')]=_0x498549['attributes']['length']?_0x498549[_0x09d6('0x40')]:_0x5d54d8[_0x09d6('0x3c')];if(!_0x5013d9[_0x09d6('0x3d')]['hasOwnProperty'](_0x09d6('0x43'))){_0x498549[_0x09d6('0x2e')]=qs[_0x09d6('0x2e')](_0x5013d9[_0x09d6('0x3d')]['limit']);_0x498549[_0x09d6('0x2b')]=qs[_0x09d6('0x2b')](_0x5013d9[_0x09d6('0x3d')][_0x09d6('0x2b')]);}_0x498549[_0x09d6('0x44')]=qs['sort'](_0x5013d9[_0x09d6('0x3d')]['sort']);_0x498549[_0x09d6('0x45')]=qs[_0x09d6('0x3f')](_['pick'](_0x5013d9[_0x09d6('0x3d')],_0x5d54d8[_0x09d6('0x3f')]),_0x31b77d);if(_0x5013d9[_0x09d6('0x3d')][_0x09d6('0x46')]){_0x498549[_0x09d6('0x45')]=_[_0x09d6('0x47')](_0x498549[_0x09d6('0x45')],{'$or':_[_0x09d6('0x38')](_0x31b77d,function(_0x92a687){if(_0x92a687['type']!==_0x09d6('0x48')){var _0x522d9b={};_0x522d9b[_0x92a687[_0x09d6('0x35')]]={'$like':'%'+_0x5013d9[_0x09d6('0x3d')][_0x09d6('0x46')]+'%'};return _0x522d9b;}})});}_0x498549=_['merge']({},_0x498549,_0x5013d9['options']);var _0x5c24e5={'where':_0x498549[_0x09d6('0x45')]};return db[_0x09d6('0x49')][_0x09d6('0x2d')](_0x5c24e5)[_0x09d6('0x1d')](function(_0x1a0a21){_0x57e8ce[_0x09d6('0x2d')]=_0x1a0a21;if(_0x5013d9[_0x09d6('0x3d')][_0x09d6('0x4a')]){_0x498549[_0x09d6('0x4b')]=[{'all':!![]}];}return db[_0x09d6('0x49')][_0x09d6('0x4c')](_0x498549);})[_0x09d6('0x1d')](function(_0x24f9f9){_0x57e8ce[_0x09d6('0x4d')]=_0x24f9f9;return _0x57e8ce;})['then'](respondWithFilteredResult(_0xb667b2,_0x498549))[_0x09d6('0x26')](handleError(_0xb667b2,null));};exports[_0x09d6('0x4e')]=function(_0x2e2051,_0x5774c8){var _0x27bff2={'raw':!![],'where':{'id':_0x2e2051[_0x09d6('0x4f')]['id']}},_0x389d7f={};_0x389d7f[_0x09d6('0x3c')]=_[_0x09d6('0x3e')](db[_0x09d6('0x49')][_0x09d6('0x39')]);_0x389d7f[_0x09d6('0x3d')]=_['keys'](_0x2e2051[_0x09d6('0x3d')]);_0x389d7f[_0x09d6('0x3f')]=_[_0x09d6('0x41')](_0x389d7f['model'],_0x389d7f[_0x09d6('0x3d')]);_0x27bff2['attributes']=_['intersection'](_0x389d7f[_0x09d6('0x3c')],qs[_0x09d6('0x42')](_0x2e2051[_0x09d6('0x3d')][_0x09d6('0x42')]));_0x27bff2[_0x09d6('0x40')]=_0x27bff2[_0x09d6('0x40')][_0x09d6('0x50')]?_0x27bff2['attributes']:_0x389d7f[_0x09d6('0x3c')];if(_0x2e2051[_0x09d6('0x3d')][_0x09d6('0x4a')]){_0x27bff2[_0x09d6('0x4b')]=[{'all':!![]}];}_0x27bff2=_['merge']({},_0x27bff2,_0x2e2051['options']);return db[_0x09d6('0x49')][_0x09d6('0x51')](_0x27bff2)[_0x09d6('0x1d')](handleEntityNotFound(_0x5774c8,null))['then'](respondWithResult(_0x5774c8,null))[_0x09d6('0x26')](handleError(_0x5774c8,null));};exports[_0x09d6('0x52')]=function(_0x2a0140,_0x5071b8){return db[_0x09d6('0x49')][_0x09d6('0x52')](_0x2a0140['body'],{})['then'](respondWithResult(_0x5071b8,0xc9))['catch'](handleError(_0x5071b8,null));};exports[_0x09d6('0x53')]=function(_0x9afb7b,_0x4b3447){if(_0x9afb7b[_0x09d6('0x54')]['id']){delete _0x9afb7b[_0x09d6('0x54')]['id'];}return db[_0x09d6('0x49')][_0x09d6('0x51')]({'where':{'id':_0x9afb7b[_0x09d6('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4b3447,null))[_0x09d6('0x1d')](saveUpdates(_0x9afb7b[_0x09d6('0x54')],null))['then'](respondWithResult(_0x4b3447,null))['catch'](handleError(_0x4b3447,null));};exports[_0x09d6('0x33')]=function(_0x16265b,_0x4b1a8b){return db[_0x09d6('0x49')][_0x09d6('0x51')]({'where':{'id':_0x16265b[_0x09d6('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4b1a8b,null))['then'](removeEntity(_0x4b1a8b,null))[_0x09d6('0x26')](handleError(_0x4b1a8b,null));};exports['describe']=function(_0xa19279,_0x409ecb){return db['ChatMessage'][_0x09d6('0x55')]()[_0x09d6('0x1d')](respondWithResult(_0x409ecb,null))[_0x09d6('0x26')](handleError(_0x409ecb,null));};var interaction_log=require(_0x09d6('0x12'))(_0x09d6('0x56'));exports[_0x09d6('0x57')]=function(_0x1d023d,_0x190657,_0x4d7fd6){var _0x4659cf={'agent':{},'channel':_0x09d6('0x58')};if(_0x1d023d[_0x09d6('0x54')]['id']){delete _0x1d023d['body']['id'];}_0x1d023d[_0x09d6('0x54')][_0x09d6('0x59')]=!![];_0x1d023d[_0x09d6('0x54')][_0x09d6('0x5a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1d023d[_0x09d6('0x54')][_0x09d6('0x5b')]=_0x1d023d[_0x09d6('0x54')][_0x09d6('0x5b')]||_0x1d023d[_0x09d6('0x5c')]['id'];_0x4659cf[_0x09d6('0x5d')]['id']=_0x1d023d[_0x09d6('0x54')][_0x09d6('0x5b')];return db[_0x09d6('0x49')][_0x09d6('0x51')]({'where':{'id':_0x1d023d[_0x09d6('0x4f')]['id'],'UserId':null}})[_0x09d6('0x1d')](handleEntityNotFound(_0x190657,null))[_0x09d6('0x1d')](saveUpdates(_0x1d023d[_0x09d6('0x54')],null))[_0x09d6('0x1d')](function(_0xfdcd19){if(_0xfdcd19){_0x4659cf[_0x09d6('0x24')]=_0xfdcd19['get']({'plain':!![]});return db[_0x09d6('0x5e')][_0x09d6('0x51')]({'where':{'id':_0xfdcd19[_0x09d6('0x5f')]}});}return null;})[_0x09d6('0x1d')](handleEntityNotFound(_0x190657,null))[_0x09d6('0x1d')](function(_0x1bbb6f){if(_0x1bbb6f){return _0x1bbb6f['update']({'UserId':_0x1d023d[_0x09d6('0x54')][_0x09d6('0x5b')],'read1stAt':_['isNil'](_0x1bbb6f[_0x09d6('0x60')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x09d6('0x1d')](function(_0x1eb166){if(_0x1eb166){_0x4659cf[_0x09d6('0x61')]=_0x1eb166[_0x09d6('0x62')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1d023d[_0x09d6('0x5c')]['id'],_0x1d023d[_0x09d6('0x5c')][_0x09d6('0x35')],_0x1d023d[_0x09d6('0x5c')][_0x09d6('0x63')],_0x4659cf['interaction']['id'],_0x1d023d[_0x09d6('0x54')]?JSON['stringify'](_0x1d023d[_0x09d6('0x54')]):'null');return respondWithRpcPromise(_0x09d6('0x64'),_0x09d6('0x65'),_0x4659cf);}return null;})[_0x09d6('0x1d')](function(_0x4aec30){var _0x192432=_0x09d6('0x66')+_0x4aec30[_0x09d6('0x24')]['ContactId'];return db[_0x09d6('0x67')][_0x09d6('0x3d')](_0x192432,{'type':db['Sequelize'][_0x09d6('0x68')][_0x09d6('0x69')],'raw':!![]})[_0x09d6('0x1d')](function(_0x2c00bc){return _0x2c00bc;});})['then'](function(_0x28bd8a){if(_0x28bd8a){_0x4659cf[_0x09d6('0x24')][_0x09d6('0x6a')]=_0x28bd8a[0x0];if(!_0x1d023d['body'][_0x09d6('0x5b')])return;return db[_0x09d6('0x6b')][_0x09d6('0x51')]({'where':{'id':_0x1d023d['body'][_0x09d6('0x5b')],'role':_0x09d6('0x5d')},'attributes':['id',_0x09d6('0x35'),'fullname','email',_0x09d6('0x6c')],'raw':!![]});}return null;})[_0x09d6('0x1d')](function(_0x3446df){if(!_0x3446df)return null;_0x4659cf[_0x09d6('0x24')]['agent']=_0x3446df;return _0x4659cf;})[_0x09d6('0x1d')](function(_0x4e6e7f){if(_0x4e6e7f){if(_0x1d023d['body'][_0x09d6('0x6d')]){_0x4659cf[_0x09d6('0x24')][_0x09d6('0x6e')]=util[_0x09d6('0x6f')](_0x09d6('0x70'),_0x1d023d[_0x09d6('0x5c')][_0x09d6('0x35')]);_0x4659cf[_0x09d6('0x24')][_0x09d6('0x71')]=_0x4659cf[_0x09d6('0x71')];_0x4659cf[_0x09d6('0x24')][_0x09d6('0x72')]=_0x4659cf['channel'];_0x4659cf[_0x09d6('0x24')][_0x09d6('0x73')]=_0x09d6('0x57');return respondWithRpcPromise(_0x09d6('0x74'),_0x09d6('0x74'),{'event':_0x09d6('0x75'),'message':_['merge'](_0x4659cf[_0x09d6('0x24')],JSON[_0x09d6('0x76')](_0x4659cf['interaction'][_0x09d6('0x77')]))},client9002)[_0x09d6('0x1d')](function(){return _0x4659cf;});}return _0x4659cf;}return null;})['then'](respondWithResult(_0x190657,null))[_0x09d6('0x26')](handleError(_0x190657,null));};var interaction_log=require('../../config/logger')(_0x09d6('0x56'));exports[_0x09d6('0x31')]=function(_0x5743ce,_0x4f8f7e,_0x463db9){var _0x46de92={'agent':{},'channel':'chat'};if(_0x5743ce[_0x09d6('0x54')]['id']){delete _0x5743ce['body']['id'];}_0x5743ce[_0x09d6('0x54')][_0x09d6('0x5b')]=_0x5743ce['body'][_0x09d6('0x5b')]||_0x5743ce[_0x09d6('0x5c')]['id'];_0x46de92[_0x09d6('0x5d')]['id']=_0x5743ce[_0x09d6('0x54')][_0x09d6('0x5b')];return db[_0x09d6('0x49')][_0x09d6('0x51')]({'where':{'id':_0x5743ce[_0x09d6('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4f8f7e,null))[_0x09d6('0x1d')](function(_0x759e22){if(_0x759e22){_0x46de92[_0x09d6('0x24')]=_0x759e22[_0x09d6('0x62')]({'plain':!![]});return db[_0x09d6('0x5e')]['find']({'where':{'id':_0x759e22['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4f8f7e,null))[_0x09d6('0x1d')](function(_0x18680c){if(_0x18680c){_0x46de92[_0x09d6('0x61')]=_0x18680c[_0x09d6('0x62')]({'plain':!![]});interaction_log[_0x09d6('0x1e')](_0x09d6('0x78'),_0x5743ce['user']['id'],_0x5743ce['user'][_0x09d6('0x35')],_0x5743ce['user'][_0x09d6('0x63')],_0x46de92[_0x09d6('0x61')]['id'],_0x5743ce['body']?JSON['stringify'](_0x5743ce[_0x09d6('0x54')]):_0x09d6('0x79'));return respondWithRpcPromise(_0x09d6('0x7a'),'rejectMessage',_0x46de92);}return null;})[_0x09d6('0x1d')](function(_0x54c1b5){var _0x18944a=_0x09d6('0x66')+_0x54c1b5[_0x09d6('0x24')][_0x09d6('0x7b')];return db[_0x09d6('0x67')]['query'](_0x18944a,{'type':db['Sequelize']['QueryTypes'][_0x09d6('0x69')],'raw':!![]})[_0x09d6('0x1d')](function(_0x43346f){return _0x43346f;});})['then'](function(_0xed52af){if(_0xed52af){_0x46de92['message'][_0x09d6('0x6a')]=_0xed52af[0x0];if(!_0x5743ce[_0x09d6('0x54')][_0x09d6('0x5b')])return;return db['User']['find']({'where':{'id':_0x5743ce[_0x09d6('0x54')][_0x09d6('0x5b')],'role':_0x09d6('0x5d')},'attributes':['id',_0x09d6('0x35'),_0x09d6('0x7c'),_0x09d6('0x7d'),_0x09d6('0x6c')],'raw':!![]});}return null;})[_0x09d6('0x1d')](function(_0x17702f){if(!_0x17702f)return null;_0x46de92[_0x09d6('0x24')][_0x09d6('0x5d')]=_0x17702f;return _0x46de92;})[_0x09d6('0x1d')](function(_0x13c77a){if(_0x13c77a){_0x13c77a[_0x09d6('0x24')]['interface']=util[_0x09d6('0x6f')](_0x09d6('0x70'),_0x5743ce[_0x09d6('0x5c')][_0x09d6('0x35')]);_0x13c77a[_0x09d6('0x24')][_0x09d6('0x71')]=_0x46de92[_0x09d6('0x71')];_0x13c77a[_0x09d6('0x24')][_0x09d6('0x72')]=_0x46de92['channel'];_0x13c77a['message'][_0x09d6('0x73')]=_0x09d6('0x31');respondWithRpcPromise(_0x09d6('0x74'),_0x09d6('0x74'),{'event':_0x09d6('0x7e'),'message':_[_0x09d6('0x47')](_0x46de92[_0x09d6('0x24')],JSON[_0x09d6('0x76')](_0x46de92['interaction'][_0x09d6('0x77')]))},client9002);return _0x46de92;}return null;})[_0x09d6('0x1d')](respondWithResult(_0x4f8f7e,null))[_0x09d6('0x26')](handleError(_0x4f8f7e,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index b449539..b7c629b 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 _0x41a7=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x41c673,_0x46c3bf){var _0x596a48=function(_0x1cd941){while(--_0x1cd941){_0x41c673['push'](_0x41c673['shift']());}};_0x596a48(++_0x46c3bf);}(_0x41a7,0x16b));var _0x741a=function(_0x57e44b,_0x33f8e1){_0x57e44b=_0x57e44b-0x0;var _0x586ec1=_0x41a7[_0x57e44b];return _0x586ec1;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x741a('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x741a('0x1')](0x0);var events={'afterCreate':_0x741a('0x2'),'afterUpdate':_0x741a('0x3'),'afterDestroy':_0x741a('0x4')};function emitEvent(_0x598108){return function(_0x6634ad,_0x2b3077,_0x2cbcca){ChatMessageEvents[_0x741a('0x5')](_0x598108+':'+_0x6634ad['id'],_0x6634ad);ChatMessageEvents['emit'](_0x598108,_0x6634ad);_0x2cbcca(null);};}for(var e in events){if(events[_0x741a('0x6')](e)){var event=events[e];ChatMessage[_0x741a('0x7')](e,emitEvent(event));}}module[_0x741a('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x199d=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x8f71a0,_0x282eec){var _0x1c71c4=function(_0x2ebb2c){while(--_0x2ebb2c){_0x8f71a0['push'](_0x8f71a0['shift']());}};_0x1c71c4(++_0x282eec);}(_0x199d,0xde));var _0xd199=function(_0x1c156e,_0x3263a6){_0x1c156e=_0x1c156e-0x0;var _0x58fc22=_0x199d[_0x1c156e];return _0x58fc22;};'use strict';var EventEmitter=require(_0xd199('0x0'));var ChatMessage=require(_0xd199('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xd199('0x2')](0x0);var events={'afterCreate':_0xd199('0x3'),'afterUpdate':_0xd199('0x4'),'afterDestroy':_0xd199('0x5')};function emitEvent(_0x56a256){return function(_0x2235aa,_0x4ea751,_0xcc720f){ChatMessageEvents[_0xd199('0x6')](_0x56a256+':'+_0x2235aa['id'],_0x2235aa);ChatMessageEvents[_0xd199('0x6')](_0x56a256,_0x2235aa);_0xcc720f(null);};}for(var e in events){if(events[_0xd199('0x7')](e)){var event=events[e];ChatMessage[_0xd199('0x8')](e,emitEvent(event));}}module[_0xd199('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 7981745..9880c51 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 _0xcfa6=['request-promise','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xcfa6,0x168));var _0x6cfa=function(_0x38dcac,_0x41de7a){_0x38dcac=_0x38dcac-0x0;var _0x398325=_0xcfa6[_0x38dcac];return _0x398325;};'use strict';var _=require(_0x6cfa('0x0'));var util=require('util');var logger=require(_0x6cfa('0x1'))('api');var moment=require(_0x6cfa('0x2'));var BPromise=require(_0x6cfa('0x3'));var rp=require(_0x6cfa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6cfa('0x5'));var config=require(_0x6cfa('0x6'));var attributes=require(_0x6cfa('0x7'));module['exports']=function(_0x3cf816,_0x5dd2b4){return _0x3cf816[_0x6cfa('0x8')](_0x6cfa('0x9'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x6cfa('0xa'),'fields':[_0x6cfa('0xb')],'type':_0x6cfa('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x288cd2,_0x1f8f14,_0x5abfd4){var _0x36bb8a=_0x3cf816['models'];var _0x1ca5f1=_0x288cd2[_0x6cfa('0xd')]({'plain':!![]});if(_0x1ca5f1[_0x6cfa('0xe')][_0x6cfa('0xf')]()==='in'||_0x1ca5f1[_0x6cfa('0xe')][_0x6cfa('0xf')]()===_0x6cfa('0x10')&&!_0x1ca5f1['secret']&&!_[_0x6cfa('0x11')](_0x1ca5f1[_0x6cfa('0x12')])){_0x36bb8a[_0x6cfa('0x13')][_0x6cfa('0x14')]({'where':{'id':_0x1ca5f1['ChatInteractionId']}})[_0x6cfa('0x15')](function(_0x3db435){if(_0x3db435){_0x3db435[_0x6cfa('0x16')]({'lastMsgAt':_0x1ca5f1[_0x6cfa('0x17')],'lastMsgDirection':_0x1ca5f1[_0x6cfa('0xe')][_0x6cfa('0xf')]()});}})[_0x6cfa('0x18')](function(_0x5feb9f){console[_0x6cfa('0x19')](_0x5feb9f);});}_0x5abfd4();}},'charset':_0x6cfa('0x1a'),'collate':_0x6cfa('0x1b')});}; \ No newline at end of file +var _0x49c2=['api','bluebird','request-promise','rimraf','../../config/environment','exports','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x1a8132,_0x1d4978){var _0x5b9329=function(_0x1f1447){while(--_0x1f1447){_0x1a8132['push'](_0x1a8132['shift']());}};_0x5b9329(++_0x1d4978);}(_0x49c2,0x176));var _0x249c=function(_0x91384,_0x545eef){_0x91384=_0x91384-0x0;var _0x44daa0=_0x49c2[_0x91384];return _0x44daa0;};'use strict';var _=require(_0x249c('0x0'));var util=require(_0x249c('0x1'));var logger=require(_0x249c('0x2'))(_0x249c('0x3'));var moment=require('moment');var BPromise=require(_0x249c('0x4'));var rp=require(_0x249c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x249c('0x6'));var config=require(_0x249c('0x7'));var attributes=require('./chatMessage.attributes');module[_0x249c('0x8')]=function(_0x4c0c15,_0x5c5f30){return _0x4c0c15['define']('ChatMessage',attributes,{'tableName':_0x249c('0x9'),'paranoid':![],'indexes':[{'name':_0x249c('0xa'),'fields':[_0x249c('0xb')],'type':_0x249c('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b7ed1,_0x3d61a2,_0x2216eb){var _0x35a42b=_0x4c0c15[_0x249c('0xd')];var _0x422d7b=_0x2b7ed1['get']({'plain':!![]});if(_0x422d7b[_0x249c('0xe')][_0x249c('0xf')]()==='in'||_0x422d7b['direction']['toLowerCase']()===_0x249c('0x10')&&!_0x422d7b[_0x249c('0x11')]&&!_[_0x249c('0x12')](_0x422d7b[_0x249c('0x13')])){_0x35a42b[_0x249c('0x14')][_0x249c('0x15')]({'where':{'id':_0x422d7b[_0x249c('0x16')]}})[_0x249c('0x17')](function(_0x4fdede){if(_0x4fdede){_0x4fdede[_0x249c('0x18')]({'lastMsgAt':_0x422d7b[_0x249c('0x19')],'lastMsgDirection':_0x422d7b[_0x249c('0xe')][_0x249c('0xf')]()});}})['catch'](function(_0x56cf21){console[_0x249c('0x1a')](_0x56cf21);});}_0x2216eb();}},'charset':_0x249c('0x1b'),'collate':_0x249c('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index d664dc3..4cd0a40 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 _0x00cd=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','then','info','ChatMessage,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','CreateChatMessage','ChatMessage','create','options','raw','debug','lodash','util'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x00cd,0xee));var _0xd00c=function(_0x2f3ecd,_0x57976b){_0x2f3ecd=_0x2f3ecd-0x0;var _0xffdc44=_0x00cd[_0x2f3ecd];return _0xffdc44;};'use strict';var _=require(_0xd00c('0x0'));var util=require(_0xd00c('0x1'));var moment=require(_0xd00c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd00c('0x3'));var db=require(_0xd00c('0x4'))['db'];var utils=require(_0xd00c('0x5'));var logger=require(_0xd00c('0x6'))(_0xd00c('0x7'));var config=require('../../config/environment');var jayson=require(_0xd00c('0x8'));var client=jayson[_0xd00c('0x9')][_0xd00c('0xa')]({'port':0x232a});config[_0xd00c('0xb')]=_[_0xd00c('0xc')](config[_0xd00c('0xb')],{'host':_0xd00c('0xd'),'port':0x18eb});var socket=require(_0xd00c('0xe'))(new Redis(config[_0xd00c('0xb')]));require(_0xd00c('0xf'))['register'](socket);function respondWithRpcPromise(_0x5b6955,_0x462615,_0x267343){return new BPromise(function(_0x3c7e4f,_0x1dee65){return client['request'](_0x5b6955,_0x267343)[_0xd00c('0x10')](function(_0x532556){logger[_0xd00c('0x11')](_0xd00c('0x12'),_0x462615,'request\x20sent');logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x462615,'request\x20sent',JSON[_0xd00c('0x13')](_0x532556));if(_0x532556[_0xd00c('0x14')]){if(_0x532556[_0xd00c('0x14')]['code']===0x1f4){logger[_0xd00c('0x14')]('ChatMessage,\x20%s,\x20%s',_0x462615,_0x532556[_0xd00c('0x14')][_0xd00c('0x15')]);return _0x1dee65(_0x532556[_0xd00c('0x14')]['message']);}logger['error'](_0xd00c('0x12'),_0x462615,_0x532556[_0xd00c('0x14')][_0xd00c('0x15')]);return _0x3c7e4f(_0x532556[_0xd00c('0x14')][_0xd00c('0x15')]);}else{logger[_0xd00c('0x11')](_0xd00c('0x12'),_0x462615,_0xd00c('0x16'));_0x3c7e4f(_0x532556['result'][_0xd00c('0x15')]);}})[_0xd00c('0x17')](function(_0x110464){logger['error']('ChatMessage,\x20%s,\x20%s',_0x462615,_0x110464);_0x1dee65(_0x110464);});});}exports[_0xd00c('0x18')]=function(_0x271543){var _0x42b1b9=this;return new Promise(function(_0x29a748,_0xbced81){return db[_0xd00c('0x19')][_0xd00c('0x1a')](_0x271543['body'],{'raw':_0x271543[_0xd00c('0x1b')]?_0x271543[_0xd00c('0x1b')][_0xd00c('0x1c')]===undefined?!![]:![]:!![]})[_0xd00c('0x10')](function(_0x10d08d){logger['info']('CreateChatMessage',_0x271543);logger[_0xd00c('0x1d')](_0xd00c('0x18'),_0x271543,JSON['stringify'](_0x10d08d));_0x29a748(_0x10d08d);})['catch'](function(_0x4cf5e5){logger[_0xd00c('0x14')]('CreateChatMessage',_0x4cf5e5[_0xd00c('0x15')],_0x271543);_0xbced81(_0x42b1b9['error'](0x1f4,_0x4cf5e5[_0xd00c('0x15')]));});});}; \ No newline at end of file +var _0x978a=['rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','then','ChatMessage,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','CreateChatMessage','ChatMessage','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x59f97a,_0x511696){var _0x411b33=function(_0x4f801e){while(--_0x4f801e){_0x59f97a['push'](_0x59f97a['shift']());}};_0x411b33(++_0x511696);}(_0x978a,0x93));var _0xa978=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x978a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa978('0x0'));var util=require(_0xa978('0x1'));var moment=require(_0xa978('0x2'));var BPromise=require(_0xa978('0x3'));var rs=require(_0xa978('0x4'));var fs=require('fs');var Redis=require(_0xa978('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa978('0x6'));var logger=require(_0xa978('0x7'))(_0xa978('0x8'));var config=require(_0xa978('0x9'));var jayson=require(_0xa978('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xa978('0xb')]=_[_0xa978('0xc')](config[_0xa978('0xb')],{'host':_0xa978('0xd'),'port':0x18eb});var socket=require(_0xa978('0xe'))(new Redis(config[_0xa978('0xb')]));require(_0xa978('0xf'))[_0xa978('0x10')](socket);function respondWithRpcPromise(_0x5c7af3,_0x460c3e,_0x21ae97){return new BPromise(function(_0x3520b0,_0xdd7815){return client['request'](_0x5c7af3,_0x21ae97)[_0xa978('0x11')](function(_0x26a0b9){logger['info'](_0xa978('0x12'),_0x460c3e,_0xa978('0x13'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x460c3e,_0xa978('0x13'),JSON['stringify'](_0x26a0b9));if(_0x26a0b9[_0xa978('0x14')]){if(_0x26a0b9[_0xa978('0x14')][_0xa978('0x15')]===0x1f4){logger[_0xa978('0x14')](_0xa978('0x12'),_0x460c3e,_0x26a0b9[_0xa978('0x14')][_0xa978('0x16')]);return _0xdd7815(_0x26a0b9[_0xa978('0x14')][_0xa978('0x16')]);}logger[_0xa978('0x14')]('ChatMessage,\x20%s,\x20%s',_0x460c3e,_0x26a0b9['error'][_0xa978('0x16')]);return _0x3520b0(_0x26a0b9[_0xa978('0x14')][_0xa978('0x16')]);}else{logger[_0xa978('0x17')](_0xa978('0x12'),_0x460c3e,_0xa978('0x13'));_0x3520b0(_0x26a0b9[_0xa978('0x18')][_0xa978('0x16')]);}})['catch'](function(_0x11b36b){logger['error'](_0xa978('0x12'),_0x460c3e,_0x11b36b);_0xdd7815(_0x11b36b);});});}exports[_0xa978('0x19')]=function(_0x6dbb7f){var _0x4f4f31=this;return new Promise(function(_0x2a20d8,_0x5d6137){return db[_0xa978('0x1a')]['create'](_0x6dbb7f[_0xa978('0x1b')],{'raw':_0x6dbb7f[_0xa978('0x1c')]?_0x6dbb7f['options'][_0xa978('0x1d')]===undefined?!![]:![]:!![]})[_0xa978('0x11')](function(_0x547fe){logger[_0xa978('0x17')]('CreateChatMessage',_0x6dbb7f);logger['debug'](_0xa978('0x19'),_0x6dbb7f,JSON[_0xa978('0x1e')](_0x547fe));_0x2a20d8(_0x547fe);})['catch'](function(_0x4beb97){logger[_0xa978('0x14')](_0xa978('0x19'),_0x4beb97[_0xa978('0x16')],_0x6dbb7f);_0x5d6137(_0x4f4f31[_0xa978('0x14')](0x1f4,_0x4beb97[_0xa978('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 44b29ab..342b682 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 _0x1224=['update','emit','register','length','chatMessage:','./chatMessage.events','save','remove'];(function(_0x3faa55,_0xde3411){var _0x124d89=function(_0x591f91){while(--_0x591f91){_0x3faa55['push'](_0x3faa55['shift']());}};_0x124d89(++_0xde3411);}(_0x1224,0x10d));var _0x4122=function(_0x4cb58a,_0x2a62e0){_0x4cb58a=_0x4cb58a-0x0;var _0x592f29=_0x1224[_0x4cb58a];return _0x592f29;};'use strict';var ChatMessageEvents=require(_0x4122('0x0'));var events=[_0x4122('0x1'),_0x4122('0x2'),_0x4122('0x3')];function createListener(_0x488f55,_0x3d42a9){return function(_0x51632b){_0x3d42a9[_0x4122('0x4')](_0x488f55,_0x51632b);};}function removeListener(_0x1f1533,_0x2f506b){return function(){ChatMessageEvents['removeListener'](_0x1f1533,_0x2f506b);};}exports[_0x4122('0x5')]=function(_0x76278c){for(var _0xc6dfaf=0x0,_0x40b5e4=events[_0x4122('0x6')];_0xc6dfaf<_0x40b5e4;_0xc6dfaf++){var _0x431470=events[_0xc6dfaf];var _0x2444a3=createListener(_0x4122('0x7')+_0x431470,_0x76278c);ChatMessageEvents['on'](_0x431470,_0x2444a3);}}; \ No newline at end of file +var _0x383d=['register','length','remove','update','emit','removeListener'];(function(_0x4f9e12,_0xec557f){var _0x146653=function(_0x2975e9){while(--_0x2975e9){_0x4f9e12['push'](_0x4f9e12['shift']());}};_0x146653(++_0xec557f);}(_0x383d,0x86));var _0xd383=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x383d[_0x20a584];return _0x4b41a8;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0xd383('0x0'),_0xd383('0x1')];function createListener(_0x35486e,_0x559dd3){return function(_0x7554ef){_0x559dd3[_0xd383('0x2')](_0x35486e,_0x7554ef);};}function removeListener(_0x319f67,_0x3439dd){return function(){ChatMessageEvents[_0xd383('0x3')](_0x319f67,_0x3439dd);};}exports[_0xd383('0x4')]=function(_0x5a0b1d){for(var _0xc64e9b=0x0,_0x30ba82=events[_0xd383('0x5')];_0xc64e9b<_0x30ba82;_0xc64e9b++){var _0x470d8d=events[_0xc64e9b];var _0xffa778=createListener('chatMessage:'+_0x470d8d,_0x5a0b1d);ChatMessageEvents['on'](_0x470d8d,_0xffa778);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 24809f2..aa2f945 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 _0x7c7a=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','post','chat','chatmessage:create','create','put','/:id/accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7c7a,0x1ee));var _0xa7c7=function(_0x18c281,_0x454138){_0x18c281=_0x18c281-0x0;var _0x21eeca=_0x7c7a[_0x18c281];return _0x21eeca;};'use strict';var multer=require(_0xa7c7('0x0'));var util=require(_0xa7c7('0x1'));var path=require(_0xa7c7('0x2'));var timeout=require(_0xa7c7('0x3'));var express=require(_0xa7c7('0x4'));var router=express[_0xa7c7('0x5')]();var fs_extra=require(_0xa7c7('0x6'));var auth=require(_0xa7c7('0x7'));var interaction=require(_0xa7c7('0x8'));var config=require('../../config/environment');var controller=require('./chatMessage.controller');router[_0xa7c7('0x9')]('/',auth[_0xa7c7('0xa')](),controller[_0xa7c7('0xb')]);router[_0xa7c7('0x9')](_0xa7c7('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xa7c7('0x9')](_0xa7c7('0xd'),auth[_0xa7c7('0xa')](),controller[_0xa7c7('0xe')]);router[_0xa7c7('0xf')]('/',auth[_0xa7c7('0xa')](),interaction['tracked'](_0xa7c7('0x10'),_0xa7c7('0x11')),controller[_0xa7c7('0x12')]);router[_0xa7c7('0x13')](_0xa7c7('0xd'),controller['update']);router[_0xa7c7('0x13')](_0xa7c7('0x14'),auth['isAuthenticated'](),controller['accept']);router[_0xa7c7('0x13')](_0xa7c7('0x15'),auth['isAuthenticated'](),controller[_0xa7c7('0x16')]);router[_0xa7c7('0x17')](_0xa7c7('0xd'),auth[_0xa7c7('0xa')](),controller[_0xa7c7('0x18')]);module[_0xa7c7('0x19')]=router; \ No newline at end of file +var _0x2611=['create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','show','post','tracked','chat'];(function(_0x58dd9e,_0x283816){var _0xbcc1d1=function(_0x2d2ff4){while(--_0x2d2ff4){_0x58dd9e['push'](_0x58dd9e['shift']());}};_0xbcc1d1(++_0x283816);}(_0x2611,0x1af));var _0x1261=function(_0x1ffcad,_0x9afad3){_0x1ffcad=_0x1ffcad-0x0;var _0x63720e=_0x2611[_0x1ffcad];return _0x63720e;};'use strict';var multer=require('multer');var util=require(_0x1261('0x0'));var path=require(_0x1261('0x1'));var timeout=require(_0x1261('0x2'));var express=require(_0x1261('0x3'));var router=express[_0x1261('0x4')]();var fs_extra=require(_0x1261('0x5'));var auth=require(_0x1261('0x6'));var interaction=require(_0x1261('0x7'));var config=require(_0x1261('0x8'));var controller=require('./chatMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1261('0x9')]);router[_0x1261('0xa')](_0x1261('0xb'),auth[_0x1261('0xc')](),controller['describe']);router['get']('/:id',auth[_0x1261('0xc')](),controller[_0x1261('0xd')]);router[_0x1261('0xe')]('/',auth[_0x1261('0xc')](),interaction[_0x1261('0xf')](_0x1261('0x10'),'chatmessage:create'),controller[_0x1261('0x11')]);router[_0x1261('0x12')](_0x1261('0x13'),controller[_0x1261('0x14')]);router[_0x1261('0x12')](_0x1261('0x15'),auth['isAuthenticated'](),controller[_0x1261('0x16')]);router[_0x1261('0x12')](_0x1261('0x17'),auth[_0x1261('0xc')](),controller[_0x1261('0x18')]);router[_0x1261('0x19')]('/:id',auth[_0x1261('0xc')](),controller[_0x1261('0x1a')]);module[_0x1261('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 26eea8b..c606235 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['medium','TEXT','exports'];(function(_0x943683,_0x1c5201){var _0x11092f=function(_0x4bdda1){while(--_0x4bdda1){_0x943683['push'](_0x943683['shift']());}};_0x11092f(++_0x1c5201);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0xb10b=['medium','sequelize','TEXT'];(function(_0x51ec16,_0x489add){var _0x17f80d=function(_0x3934f9){while(--_0x3934f9){_0x51ec16['push'](_0x51ec16['shift']());}};_0x17f80d(++_0x489add);}(_0xb10b,0x12a));var _0xbb10=function(_0x888a02,_0x5df389){_0x888a02=_0x888a02-0x0;var _0xedd786=_0xb10b[_0x888a02];return _0xedd786;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 43662d4..fef39ca 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(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x7a54,0x106));var _0x47a5=function(_0x2a8c1a,_0x2b3889){_0x2a8c1a=_0x2a8c1a-0x0;var _0x4b3b3f=_0x7a54[_0x2a8c1a];return _0x4b3b3f;};'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 _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x34568e,_0x3c2e0e){var _0x4629a6=function(_0x27bb06){while(--_0x27bb06){_0x34568e['push'](_0x34568e['shift']());}};_0x4629a6(++_0x3c2e0e);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 48ea044..6f98c50 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 _0x40cb=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','update','remove'];(function(_0x1bfae2,_0x7245fd){var _0x3fb932=function(_0x2160de){while(--_0x2160de){_0x1bfae2['push'](_0x1bfae2['shift']());}};_0x3fb932(++_0x7245fd);}(_0x40cb,0x108));var _0xb40c=function(_0x400aba,_0x313457){_0x400aba=_0x400aba-0x0;var _0x482a8c=_0x40cb[_0x400aba];return _0x482a8c;};'use strict';var EventEmitter=require(_0xb40c('0x0'));var ChatOfflineMessage=require(_0xb40c('0x1'))['db'][_0xb40c('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xb40c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb40c('0x4'),'afterDestroy':_0xb40c('0x5')};function emitEvent(_0x3d72ac){return function(_0x1b7dbf,_0x52aacd,_0x712159){ChatOfflineMessageEvents[_0xb40c('0x6')](_0x3d72ac+':'+_0x1b7dbf['id'],_0x1b7dbf);ChatOfflineMessageEvents['emit'](_0x3d72ac,_0x1b7dbf);_0x712159(null);};}for(var e in events){if(events[_0xb40c('0x7')](e)){var event=events[e];ChatOfflineMessage[_0xb40c('0x8')](e,emitEvent(event));}}module[_0xb40c('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x43a2=['setMaxListeners','update','emit','../../mysqldb','ChatOfflineMessage'];(function(_0x133e05,_0x28eb8d){var _0x30d761=function(_0x487c64){while(--_0x487c64){_0x133e05['push'](_0x133e05['shift']());}};_0x30d761(++_0x28eb8d);}(_0x43a2,0xd0));var _0x243a=function(_0x4e95e9,_0x4c1fad){_0x4e95e9=_0x4e95e9-0x0;var _0x53a4d8=_0x43a2[_0x4e95e9];return _0x53a4d8;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x243a('0x0'))['db'][_0x243a('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x243a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x243a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x37dba9){return function(_0x29fb13,_0x3da3b5,_0xff53f9){ChatOfflineMessageEvents['emit'](_0x37dba9+':'+_0x29fb13['id'],_0x29fb13);ChatOfflineMessageEvents[_0x243a('0x4')](_0x37dba9,_0x29fb13);_0xff53f9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index be7e083..2d73629 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 _0x831e=['ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x831e,0x111));var _0xe831=function(_0x36b9ce,_0x292f57){_0x36b9ce=_0x36b9ce-0x0;var _0x478f0b=_0x831e[_0x36b9ce];return _0x478f0b;};'use strict';var attributes=require(_0xe831('0x0'));module[_0xe831('0x1')]=function(_0x4b6878){return _0x4b6878[_0xe831('0x2')](_0xe831('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe831('0x4'),'collate':_0xe831('0x5')});}; \ No newline at end of file +var _0x2a63=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a63,0xfb));var _0x32a6=function(_0x7efe31,_0x1b42d3){_0x7efe31=_0x7efe31-0x0;var _0x59ea5a=_0x2a63[_0x7efe31];return _0x59ea5a;};'use strict';var attributes=require(_0x32a6('0x0'));module['exports']=function(_0xd71529){return _0xd71529[_0x32a6('0x1')](_0x32a6('0x2'),attributes,{'tableName':_0x32a6('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x32a6('0x4'),'collate':_0x32a6('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index e0a97a8..1e2fbe9 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 _0x03ac=['../../config/environment','client','http','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x740ca1,_0x574fc6){var _0x24b4fe=function(_0x2491da){while(--_0x2491da){_0x740ca1['push'](_0x740ca1['shift']());}};_0x24b4fe(++_0x574fc6);}(_0x03ac,0x1db));var _0xc03a=function(_0x10018e,_0x8393c4){_0x10018e=_0x10018e-0x0;var _0x543bc5=_0x03ac[_0x10018e];return _0x543bc5;};'use strict';var _=require(_0xc03a('0x0'));var util=require(_0xc03a('0x1'));var moment=require('moment');var BPromise=require(_0xc03a('0x2'));var rs=require(_0xc03a('0x3'));var fs=require('fs');var Redis=require(_0xc03a('0x4'));var db=require(_0xc03a('0x5'))['db'];var utils=require(_0xc03a('0x6'));var logger=require(_0xc03a('0x7'))(_0xc03a('0x8'));var config=require(_0xc03a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc03a('0xa')][_0xc03a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x479a1b,_0x34ae21,_0x11e6db){return new BPromise(function(_0x129078,_0xbd78d0){return client[_0xc03a('0xc')](_0x479a1b,_0x11e6db)['then'](function(_0x3c0c03){logger['info'](_0xc03a('0xd'),_0x34ae21,_0xc03a('0xe'));logger['debug'](_0xc03a('0xf'),_0x34ae21,_0xc03a('0xe'),JSON[_0xc03a('0x10')](_0x3c0c03));if(_0x3c0c03[_0xc03a('0x11')]){if(_0x3c0c03[_0xc03a('0x11')]['code']===0x1f4){logger['error'](_0xc03a('0xd'),_0x34ae21,_0x3c0c03[_0xc03a('0x11')][_0xc03a('0x12')]);return _0xbd78d0(_0x3c0c03[_0xc03a('0x11')][_0xc03a('0x12')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x34ae21,_0x3c0c03[_0xc03a('0x11')][_0xc03a('0x12')]);return _0x129078(_0x3c0c03['error'][_0xc03a('0x12')]);}else{logger[_0xc03a('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x34ae21,_0xc03a('0xe'));_0x129078(_0x3c0c03[_0xc03a('0x14')]['message']);}})[_0xc03a('0x15')](function(_0x24be6b){logger[_0xc03a('0x11')](_0xc03a('0xd'),_0x34ae21,_0x24be6b);_0xbd78d0(_0x24be6b);});});} \ No newline at end of file +var _0x91e6=['../../config/logger','../../config/environment','jayson/promise','client','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x264a58,_0x31d451){var _0x137f2a=function(_0x15bfc5){while(--_0x15bfc5){_0x264a58['push'](_0x264a58['shift']());}};_0x137f2a(++_0x31d451);}(_0x91e6,0x123));var _0x691e=function(_0x3798c3,_0x4d6f41){_0x3798c3=_0x3798c3-0x0;var _0x339eec=_0x91e6[_0x3798c3];return _0x339eec;};'use strict';var _=require(_0x691e('0x0'));var util=require(_0x691e('0x1'));var moment=require(_0x691e('0x2'));var BPromise=require(_0x691e('0x3'));var rs=require(_0x691e('0x4'));var fs=require('fs');var Redis=require(_0x691e('0x5'));var db=require(_0x691e('0x6'))['db'];var utils=require(_0x691e('0x7'));var logger=require(_0x691e('0x8'))('rpc');var config=require(_0x691e('0x9'));var jayson=require(_0x691e('0xa'));var client=jayson[_0x691e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcd6a95,_0xb45a02,_0x532e63){return new BPromise(function(_0x5cdb4b,_0x476309){return client['request'](_0xcd6a95,_0x532e63)[_0x691e('0xc')](function(_0xd93e00){logger[_0x691e('0xd')](_0x691e('0xe'),_0xb45a02,'request\x20sent');logger[_0x691e('0xf')](_0x691e('0x10'),_0xb45a02,_0x691e('0x11'),JSON[_0x691e('0x12')](_0xd93e00));if(_0xd93e00[_0x691e('0x13')]){if(_0xd93e00['error'][_0x691e('0x14')]===0x1f4){logger['error'](_0x691e('0xe'),_0xb45a02,_0xd93e00[_0x691e('0x13')][_0x691e('0x15')]);return _0x476309(_0xd93e00['error'][_0x691e('0x15')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0xb45a02,_0xd93e00[_0x691e('0x13')][_0x691e('0x15')]);return _0x5cdb4b(_0xd93e00['error']['message']);}else{logger[_0x691e('0xd')](_0x691e('0xe'),_0xb45a02,_0x691e('0x11'));_0x5cdb4b(_0xd93e00['result']['message']);}})[_0x691e('0x16')](function(_0x55043b){logger['error'](_0x691e('0xe'),_0xb45a02,_0x55043b);_0x476309(_0x55043b);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 71f80fb..6ee431e 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 _0x5f07=['exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy'];(function(_0x53056c,_0x1d56a9){var _0x5cec88=function(_0x2ad06b){while(--_0x2ad06b){_0x53056c['push'](_0x53056c['shift']());}};_0x5cec88(++_0x1d56a9);}(_0x5f07,0x190));var _0x75f0=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f07[_0x297fd3];return _0x2af381;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x75f0('0x0'));var timeout=require(_0x75f0('0x1'));var express=require('express');var router=express[_0x75f0('0x2')]();var fs_extra=require(_0x75f0('0x3'));var auth=require(_0x75f0('0x4'));var interaction=require(_0x75f0('0x5'));var config=require(_0x75f0('0x6'));var controller=require('./chatOfflineMessage.controller');router[_0x75f0('0x7')]('/',auth[_0x75f0('0x8')](),controller[_0x75f0('0x9')]);router[_0x75f0('0x7')](_0x75f0('0xa'),auth[_0x75f0('0x8')](),controller['describe']);router[_0x75f0('0x7')](_0x75f0('0xb'),auth[_0x75f0('0x8')](),controller[_0x75f0('0xc')]);router[_0x75f0('0xd')]('/',auth[_0x75f0('0x8')](),controller[_0x75f0('0xe')]);router[_0x75f0('0xf')](_0x75f0('0xb'),auth[_0x75f0('0x8')](),controller[_0x75f0('0x10')]);router['delete']('/:id',auth[_0x75f0('0x8')](),controller[_0x75f0('0x11')]);module[_0x75f0('0x12')]=router; \ No newline at end of file +var _0x903d=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer'];(function(_0x4fcdb7,_0x39f7fa){var _0x3264cb=function(_0x5ee371){while(--_0x5ee371){_0x4fcdb7['push'](_0x4fcdb7['shift']());}};_0x3264cb(++_0x39f7fa);}(_0x903d,0x15f));var _0xd903=function(_0x1a5bec,_0x126efd){_0x1a5bec=_0x1a5bec-0x0;var _0x19d79=_0x903d[_0x1a5bec];return _0x19d79;};'use strict';var multer=require(_0xd903('0x0'));var util=require('util');var path=require(_0xd903('0x1'));var timeout=require(_0xd903('0x2'));var express=require(_0xd903('0x3'));var router=express['Router']();var fs_extra=require(_0xd903('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd903('0x5'));var config=require(_0xd903('0x6'));var controller=require(_0xd903('0x7'));router[_0xd903('0x8')]('/',auth['isAuthenticated'](),controller[_0xd903('0x9')]);router[_0xd903('0x8')](_0xd903('0xa'),auth[_0xd903('0xb')](),controller[_0xd903('0xc')]);router[_0xd903('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd903('0xd')]);router[_0xd903('0xe')]('/',auth[_0xd903('0xb')](),controller[_0xd903('0xf')]);router[_0xd903('0x10')]('/:id',auth[_0xd903('0xb')](),controller[_0xd903('0x11')]);router[_0xd903('0x12')](_0xd903('0x13'),auth['isAuthenticated'](),controller[_0xd903('0x14')]);module[_0xd903('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index ca47621..6ae1809 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 _0x66b2=['mouseOver','timeout','sequelize','exports','ENUM'];(function(_0x1fcbb7,_0x21ff69){var _0x1a5046=function(_0xe0768){while(--_0xe0768){_0x1fcbb7['push'](_0x1fcbb7['shift']());}};_0x1a5046(++_0x21ff69);}(_0x66b2,0xfc));var _0x266b=function(_0x42be36,_0x425079){_0x42be36=_0x42be36-0x0;var _0x3473d4=_0x66b2[_0x42be36];return _0x3473d4;};'use strict';var Sequelize=require(_0x266b('0x0'));module[_0x266b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x266b('0x2')](_0x266b('0x3'),_0x266b('0x4')),'defaultValue':_0x266b('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x146f=['STRING','mouseOver','INTEGER','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x146f,0xff));var _0xf146=function(_0x42820f,_0x5b397b){_0x42820f=_0x42820f-0x0;var _0x2a1c48=_0x146f[_0x42820f];return _0x2a1c48;};'use strict';var Sequelize=require(_0xf146('0x0'));module['exports']={'name':{'type':Sequelize[_0xf146('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf146('0x2'),'timeout'),'defaultValue':_0xf146('0x2')},'selector':{'type':Sequelize[_0xf146('0x1')]},'timeout':{'type':Sequelize[_0xf146('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index ad6bce9..3c1bf7e 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 _0xa630=['error','stack','name','send','params','model','keys','ChatProactiveAction','query','filters','intersection','fields','attributes','include','merge','find','catch','create','body','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xa630,0xbe));var _0x0a63=function(_0x7d3d3d,_0x268241){_0x7d3d3d=_0x7d3d3d-0x0;var _0x469da8=_0xa630[_0x7d3d3d];return _0x469da8;};'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['show']=function(_0x34239b,_0xcf409){var _0x1b7bdb={'raw':!![],'where':{'id':_0x34239b[_0x0a63('0x2a')]['id']}},_0x145090={};_0x145090[_0x0a63('0x2b')]=_[_0x0a63('0x2c')](db[_0x0a63('0x2d')]['rawAttributes']);_0x145090[_0x0a63('0x2e')]=_['keys'](_0x34239b[_0x0a63('0x2e')]);_0x145090[_0x0a63('0x2f')]=_[_0x0a63('0x30')](_0x145090[_0x0a63('0x2b')],_0x145090[_0x0a63('0x2e')]);_0x1b7bdb['attributes']=_[_0x0a63('0x30')](_0x145090[_0x0a63('0x2b')],qs[_0x0a63('0x31')](_0x34239b[_0x0a63('0x2e')]['fields']));_0x1b7bdb[_0x0a63('0x32')]=_0x1b7bdb[_0x0a63('0x32')]['length']?_0x1b7bdb['attributes']:_0x145090[_0x0a63('0x2b')];if(_0x34239b['query']['includeAll']){_0x1b7bdb[_0x0a63('0x33')]=[{'all':!![]}];}_0x1b7bdb=_[_0x0a63('0x34')]({},_0x1b7bdb,_0x34239b['options']);return db[_0x0a63('0x2d')][_0x0a63('0x35')](_0x1b7bdb)[_0x0a63('0x24')](handleEntityNotFound(_0xcf409,null))[_0x0a63('0x24')](respondWithResult(_0xcf409,null))[_0x0a63('0x36')](handleError(_0xcf409,null));};exports['create']=function(_0x5c7b56,_0x22993d){return db[_0x0a63('0x2d')][_0x0a63('0x37')](_0x5c7b56[_0x0a63('0x38')],{})[_0x0a63('0x24')](respondWithResult(_0x22993d,0xc9))[_0x0a63('0x36')](handleError(_0x22993d,null));};exports['update']=function(_0x307fe2,_0x276156){if(_0x307fe2['body']['id']){delete _0x307fe2[_0x0a63('0x38')]['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x307fe2[_0x0a63('0x2a')]['id']}})[_0x0a63('0x24')](handleEntityNotFound(_0x276156,null))[_0x0a63('0x24')](saveUpdates(_0x307fe2['body'],null))[_0x0a63('0x24')](respondWithResult(_0x276156,null))[_0x0a63('0x36')](handleError(_0x276156,null));};exports[_0x0a63('0x25')]=function(_0x369e68,_0x3f88a1){return db[_0x0a63('0x2d')][_0x0a63('0x35')]({'where':{'id':_0x369e68['params']['id']}})[_0x0a63('0x24')](handleEntityNotFound(_0x3f88a1,null))[_0x0a63('0x24')](removeEntity(_0x3f88a1,null))[_0x0a63('0x36')](handleError(_0x3f88a1,null));}; \ No newline at end of file +var _0xe6c1=['apply','reject','then','destroy','error','stack','name','send','show','model','keys','ChatProactiveAction','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','create','body','catch','update','params','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x2e8349,_0x84c5ac){var _0x9c2cd5=function(_0x11e01f){while(--_0x11e01f){_0x2e8349['push'](_0x2e8349['shift']());}};_0x9c2cd5(++_0x84c5ac);}(_0xe6c1,0xd8));var _0x1e6c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe6c1[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1e6c('0x0'));var zipdir=require(_0x1e6c('0x1'));var jsonpatch=require(_0x1e6c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1e6c('0x3'));var Mustache=require(_0x1e6c('0x4'));var util=require(_0x1e6c('0x5'));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(_0x1e6c('0x6'));var _=require(_0x1e6c('0x7'));var squel=require(_0x1e6c('0x8'));var crypto=require(_0x1e6c('0x9'));var jsforce=require(_0x1e6c('0xa'));var deskjs=require(_0x1e6c('0xb'));var toCsv=require(_0x1e6c('0xc'));var querystring=require(_0x1e6c('0xd'));var Papa=require(_0x1e6c('0xe'));var Redis=require(_0x1e6c('0xf'));var authService=require(_0x1e6c('0x10'));var qs=require(_0x1e6c('0x11'));var as=require(_0x1e6c('0x12'));var hardwareService=require(_0x1e6c('0x13'));var logger=require(_0x1e6c('0x14'))(_0x1e6c('0x15'));var utils=require(_0x1e6c('0x16'));var config=require(_0x1e6c('0x17'));var licenseUtil=require(_0x1e6c('0x18'));var db=require(_0x1e6c('0x19'))['db'];function respondWithStatusCode(_0x24c4cf,_0x4a76aa){_0x4a76aa=_0x4a76aa||0xcc;return function(_0x1bff58){if(_0x1bff58){return _0x24c4cf[_0x1e6c('0x1a')](_0x4a76aa);}return _0x24c4cf['status'](_0x4a76aa)[_0x1e6c('0x1b')]();};}function respondWithResult(_0x293712,_0x121326){_0x121326=_0x121326||0xc8;return function(_0x51489b){if(_0x51489b){return _0x293712[_0x1e6c('0x1c')](_0x121326)[_0x1e6c('0x1d')](_0x51489b);}};}function respondWithFilteredResult(_0x3ef544,_0x556244){return function(_0x1e8769){if(_0x1e8769){var _0x30cff0=typeof _0x556244[_0x1e6c('0x1e')]===_0x1e6c('0x1f')&&typeof _0x556244[_0x1e6c('0x20')]==='undefined';var _0x42a511=_0x1e8769[_0x1e6c('0x21')];var _0xe3ec5d=_0x30cff0?0x0:_0x556244[_0x1e6c('0x1e')];var _0x4dc9d3=_0x30cff0?_0x1e8769[_0x1e6c('0x21')]:_0x556244[_0x1e6c('0x1e')]+_0x556244['limit'];var _0x576fac;if(_0x4dc9d3>=_0x42a511){_0x4dc9d3=_0x42a511;_0x576fac=0xc8;}else{_0x576fac=0xce;}_0x3ef544[_0x1e6c('0x1c')](_0x576fac);return _0x3ef544[_0x1e6c('0x22')](_0x1e6c('0x23'),_0xe3ec5d+'-'+_0x4dc9d3+'/'+_0x42a511)[_0x1e6c('0x1d')](_0x1e8769);}return null;};}function patchUpdates(_0x3fa599){return function(_0x52eb0c){try{jsonpatch[_0x1e6c('0x24')](_0x52eb0c,_0x3fa599,!![]);}catch(_0x444784){return BPromise[_0x1e6c('0x25')](_0x444784);}return _0x52eb0c['save']();};}function saveUpdates(_0x4b9484,_0x8dd01e){return function(_0x356df1){if(_0x356df1){return _0x356df1['update'](_0x4b9484)[_0x1e6c('0x26')](function(_0x5efe57){return _0x5efe57;});}return null;};}function removeEntity(_0x4b5592,_0x2e92d5){return function(_0x2494b4){if(_0x2494b4){return _0x2494b4[_0x1e6c('0x27')]()[_0x1e6c('0x26')](function(){_0x4b5592[_0x1e6c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bdd9e,_0x3fa4d7){return function(_0x530fff){if(!_0x530fff){_0x2bdd9e[_0x1e6c('0x1a')](0x194);}return _0x530fff;};}function handleError(_0x37df4b,_0x586cad){_0x586cad=_0x586cad||0x1f4;return function(_0x513338){logger[_0x1e6c('0x28')](_0x513338[_0x1e6c('0x29')]);if(_0x513338[_0x1e6c('0x2a')]){delete _0x513338[_0x1e6c('0x2a')];}_0x37df4b['status'](_0x586cad)[_0x1e6c('0x2b')](_0x513338);};}exports[_0x1e6c('0x2c')]=function(_0x1f8d2b,_0x9e2f3c){var _0x247a57={'raw':!![],'where':{'id':_0x1f8d2b['params']['id']}},_0x485620={};_0x485620[_0x1e6c('0x2d')]=_[_0x1e6c('0x2e')](db[_0x1e6c('0x2f')]['rawAttributes']);_0x485620[_0x1e6c('0x30')]=_[_0x1e6c('0x2e')](_0x1f8d2b[_0x1e6c('0x30')]);_0x485620[_0x1e6c('0x31')]=_[_0x1e6c('0x32')](_0x485620[_0x1e6c('0x2d')],_0x485620['query']);_0x247a57[_0x1e6c('0x33')]=_['intersection'](_0x485620[_0x1e6c('0x2d')],qs[_0x1e6c('0x34')](_0x1f8d2b['query'][_0x1e6c('0x34')]));_0x247a57[_0x1e6c('0x33')]=_0x247a57[_0x1e6c('0x33')][_0x1e6c('0x35')]?_0x247a57['attributes']:_0x485620[_0x1e6c('0x2d')];if(_0x1f8d2b[_0x1e6c('0x30')][_0x1e6c('0x36')]){_0x247a57[_0x1e6c('0x37')]=[{'all':!![]}];}_0x247a57=_[_0x1e6c('0x38')]({},_0x247a57,_0x1f8d2b['options']);return db[_0x1e6c('0x2f')][_0x1e6c('0x39')](_0x247a57)[_0x1e6c('0x26')](handleEntityNotFound(_0x9e2f3c,null))[_0x1e6c('0x26')](respondWithResult(_0x9e2f3c,null))['catch'](handleError(_0x9e2f3c,null));};exports[_0x1e6c('0x3a')]=function(_0x4153d6,_0xfc87ac){return db[_0x1e6c('0x2f')]['create'](_0x4153d6[_0x1e6c('0x3b')],{})['then'](respondWithResult(_0xfc87ac,0xc9))[_0x1e6c('0x3c')](handleError(_0xfc87ac,null));};exports[_0x1e6c('0x3d')]=function(_0x35539e,_0x28421b){if(_0x35539e['body']['id']){delete _0x35539e[_0x1e6c('0x3b')]['id'];}return db[_0x1e6c('0x2f')][_0x1e6c('0x39')]({'where':{'id':_0x35539e[_0x1e6c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x28421b,null))[_0x1e6c('0x26')](saveUpdates(_0x35539e[_0x1e6c('0x3b')],null))['then'](respondWithResult(_0x28421b,null))[_0x1e6c('0x3c')](handleError(_0x28421b,null));};exports[_0x1e6c('0x27')]=function(_0x33ede4,_0x174f85){return db['ChatProactiveAction']['find']({'where':{'id':_0x33ede4[_0x1e6c('0x3e')]['id']}})[_0x1e6c('0x26')](handleEntityNotFound(_0x174f85,null))['then'](removeEntity(_0x174f85,null))[_0x1e6c('0x3c')](handleError(_0x174f85,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 62bee5d..aeba2f6 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 _0xfdce=['moment','request-promise','path','rimraf','../../config/environment','exports','define','ChatProactiveAction','lodash','../../config/logger','api'];(function(_0x339f3c,_0xd382c6){var _0x4d7527=function(_0x3a5c6d){while(--_0x3a5c6d){_0x339f3c['push'](_0x339f3c['shift']());}};_0x4d7527(++_0xd382c6);}(_0xfdce,0x126));var _0xefdc=function(_0x200353,_0x56fdf4){_0x200353=_0x200353-0x0;var _0x5ad3f2=_0xfdce[_0x200353];return _0x5ad3f2;};'use strict';var _=require(_0xefdc('0x0'));var util=require('util');var logger=require(_0xefdc('0x1'))(_0xefdc('0x2'));var moment=require(_0xefdc('0x3'));var BPromise=require('bluebird');var rp=require(_0xefdc('0x4'));var fs=require('fs');var path=require(_0xefdc('0x5'));var rimraf=require(_0xefdc('0x6'));var config=require(_0xefdc('0x7'));var attributes=require('./chatProactiveAction.attributes');module[_0xefdc('0x8')]=function(_0x51459b,_0x3b5f92){return _0x51459b[_0xefdc('0x9')](_0xefdc('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x999a=['rimraf','./chatProactiveAction.attributes','exports','define','chat_proactive_actions','util','../../config/logger','api','bluebird','request-promise'];(function(_0x29e19a,_0xc6bf2){var _0x19609f=function(_0x5e7078){while(--_0x5e7078){_0x29e19a['push'](_0x29e19a['shift']());}};_0x19609f(++_0xc6bf2);}(_0x999a,0x16d));var _0xa999=function(_0x4a78af,_0x268061){_0x4a78af=_0x4a78af-0x0;var _0x525ff8=_0x999a[_0x4a78af];return _0x525ff8;};'use strict';var _=require('lodash');var util=require(_0xa999('0x0'));var logger=require(_0xa999('0x1'))(_0xa999('0x2'));var moment=require('moment');var BPromise=require(_0xa999('0x3'));var rp=require(_0xa999('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa999('0x5'));var config=require('../../config/environment');var attributes=require(_0xa999('0x6'));module[_0xa999('0x7')]=function(_0x36d9c7,_0x6baba0){return _0x36d9c7[_0xa999('0x8')]('ChatProactiveAction',attributes,{'tableName':_0xa999('0x9'),'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 e47503a..eb6ffb8 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 _0xa4e9=['stringify','error','message','result','lodash','util','randomstring','../../mysqldb','rpc','../../config/environment','request','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4ebbff,_0x26c80e){var _0x2ed826=function(_0x7aeead){while(--_0x7aeead){_0x4ebbff['push'](_0x4ebbff['shift']());}};_0x2ed826(++_0x26c80e);}(_0xa4e9,0x1c6));var _0x9a4e=function(_0x21e034,_0x59fc14){_0x21e034=_0x21e034-0x0;var _0x1faab3=_0xa4e9[_0x21e034];return _0x1faab3;};'use strict';var _=require(_0x9a4e('0x0'));var util=require(_0x9a4e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9a4e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a4e('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9a4e('0x4'));var config=require(_0x9a4e('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5543f2,_0x13c820,_0x47dc40){return new BPromise(function(_0x2c4483,_0x231eff){return client[_0x9a4e('0x6')](_0x5543f2,_0x47dc40)['then'](function(_0xfec7bb){logger['info'](_0x9a4e('0x7'),_0x13c820,'request\x20sent');logger[_0x9a4e('0x8')](_0x9a4e('0x9'),_0x13c820,_0x9a4e('0xa'),JSON[_0x9a4e('0xb')](_0xfec7bb));if(_0xfec7bb[_0x9a4e('0xc')]){if(_0xfec7bb[_0x9a4e('0xc')]['code']===0x1f4){logger['error'](_0x9a4e('0x7'),_0x13c820,_0xfec7bb[_0x9a4e('0xc')][_0x9a4e('0xd')]);return _0x231eff(_0xfec7bb['error']['message']);}logger[_0x9a4e('0xc')](_0x9a4e('0x7'),_0x13c820,_0xfec7bb[_0x9a4e('0xc')]['message']);return _0x2c4483(_0xfec7bb['error'][_0x9a4e('0xd')]);}else{logger['info'](_0x9a4e('0x7'),_0x13c820,'request\x20sent');_0x2c4483(_0xfec7bb[_0x9a4e('0xe')]['message']);}})['catch'](function(_0x828965){logger['error'](_0x9a4e('0x7'),_0x13c820,_0x828965);_0x231eff(_0x828965);});});} \ No newline at end of file +var _0x7633=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7633,0xbc));var _0x3763=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x7633[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x3763('0x0'));var util=require(_0x3763('0x1'));var moment=require(_0x3763('0x2'));var BPromise=require(_0x3763('0x3'));var rs=require(_0x3763('0x4'));var fs=require('fs');var Redis=require(_0x3763('0x5'));var db=require(_0x3763('0x6'))['db'];var utils=require(_0x3763('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3763('0x8'));var client=jayson['client'][_0x3763('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27d1e5,_0x187190,_0x3161c5){return new BPromise(function(_0xcfc8b1,_0x2dd9ad){return client[_0x3763('0xa')](_0x27d1e5,_0x3161c5)[_0x3763('0xb')](function(_0x3c0226){logger[_0x3763('0xc')](_0x3763('0xd'),_0x187190,_0x3763('0xe'));logger['debug'](_0x3763('0xf'),_0x187190,_0x3763('0xe'),JSON[_0x3763('0x10')](_0x3c0226));if(_0x3c0226[_0x3763('0x11')]){if(_0x3c0226['error']['code']===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x187190,_0x3c0226[_0x3763('0x11')][_0x3763('0x12')]);return _0x2dd9ad(_0x3c0226['error'][_0x3763('0x12')]);}logger[_0x3763('0x11')](_0x3763('0xd'),_0x187190,_0x3c0226['error'][_0x3763('0x12')]);return _0xcfc8b1(_0x3c0226[_0x3763('0x11')]['message']);}else{logger['info'](_0x3763('0xd'),_0x187190,_0x3763('0xe'));_0xcfc8b1(_0x3c0226[_0x3763('0x13')][_0x3763('0x12')]);}})[_0x3763('0x14')](function(_0x1d3251){logger[_0x3763('0x11')](_0x3763('0xd'),_0x187190,_0x1d3251);_0x2dd9ad(_0x1d3251);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index ae7779e..202ba9e 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 _0x7217=['Router','fs-extra','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x39b3d8,_0x5548f5){var _0x5dfed7=function(_0x413337){while(--_0x413337){_0x39b3d8['push'](_0x39b3d8['shift']());}};_0x5dfed7(++_0x5548f5);}(_0x7217,0x19e));var _0x7721=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x7217[_0x12d033];return _0x3b4e80;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')](_0x7721('0x9'),auth[_0x7721('0xa')](),controller[_0x7721('0xb')]);router[_0x7721('0xc')]('/',auth[_0x7721('0xa')](),controller[_0x7721('0xd')]);router[_0x7721('0xe')](_0x7721('0x9'),auth[_0x7721('0xa')](),controller[_0x7721('0xf')]);router[_0x7721('0x10')](_0x7721('0x9'),auth['isAuthenticated'](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +var _0x24ca=['../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x517c37,_0xbc219d){var _0x4b157b=function(_0x3f50f2){while(--_0x3f50f2){_0x517c37['push'](_0x517c37['shift']());}};_0x4b157b(++_0xbc219d);}(_0x24ca,0x1bc));var _0xa24c=function(_0x3b4b1d,_0x15029e){_0x3b4b1d=_0x3b4b1d-0x0;var _0x488c36=_0x24ca[_0x3b4b1d];return _0x488c36;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var fs_extra=require(_0xa24c('0x4'));var auth=require(_0xa24c('0x5'));var interaction=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var controller=require(_0xa24c('0x8'));router[_0xa24c('0x9')](_0xa24c('0xa'),auth[_0xa24c('0xb')](),controller[_0xa24c('0xc')]);router[_0xa24c('0xd')]('/',auth[_0xa24c('0xb')](),controller['create']);router[_0xa24c('0xe')](_0xa24c('0xa'),auth[_0xa24c('0xb')](),controller['update']);router[_0xa24c('0xf')](_0xa24c('0xa'),auth[_0xa24c('0xb')](),controller[_0xa24c('0x10')]);module[_0xa24c('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 2ebe0ba..d076731 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 _0x51b9=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x160393,_0x4e2ea7){var _0x39865d=function(_0x14362b){while(--_0x14362b){_0x160393['push'](_0x160393['shift']());}};_0x39865d(++_0x4e2ea7);}(_0x51b9,0x154));var _0x951b=function(_0x209ad0,_0x178ba3){_0x209ad0=_0x209ad0-0x0;var _0x1859dd=_0x51b9[_0x209ad0];return _0x1859dd;};'use strict';var Sequelize=require(_0x951b('0x0'));module[_0x951b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x951b('0x2')]},'timeout':{'type':Sequelize[_0x951b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x951b('0x4')](_0x951b('0x5'),'beepall',_0x951b('0x6'))}}; \ No newline at end of file +var _0xe2ca=['name','INTEGER','ENUM','beepall','STRING'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0xe2ca,0xfe));var _0xae2c=function(_0x9bdecf,_0x5a030f){_0x9bdecf=_0x9bdecf-0x0;var _0x493fa5=_0xe2ca[_0x9bdecf];return _0x493fa5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xae2c('0x0')],'unique':_0xae2c('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xae2c('0x0')]},'timeout':{'type':Sequelize[_0xae2c('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xae2c('0x3')]('rrmemory',_0xae2c('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 7e6279e..4923e88 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 _0x3107=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','map','ChatQueue','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','rawAttributes','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','findAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','ids','Team','Agents','voicePause','interface','flatMap','sequelize','addTeams','each','forEach','emit','userChatQueue:save','removeTeams','User','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','toString','QueryTypes','TeamId','union','compact','value','transaction','userChatQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x301f07,_0x25741a){var _0x22c610=function(_0x5a9489){while(--_0x5a9489){_0x301f07['push'](_0x301f07['shift']());}};_0x22c610(++_0x25741a);}(_0x3107,0x115));var _0x7310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3107[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7310('0x0'));var jsonpatch=require(_0x7310('0x1'));var rp=require(_0x7310('0x2'));var moment=require('moment');var BPromise=require(_0x7310('0x3'));var Mustache=require(_0x7310('0x4'));var util=require(_0x7310('0x5'));var path=require(_0x7310('0x6'));var sox=require(_0x7310('0x7'));var csv=require(_0x7310('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7310('0x9'));var _=require(_0x7310('0xa'));var squel=require('squel');var crypto=require(_0x7310('0xb'));var jsforce=require(_0x7310('0xc'));var deskjs=require(_0x7310('0xd'));var toCsv=require(_0x7310('0x8'));var querystring=require('querystring');var Papa=require(_0x7310('0xe'));var Redis=require(_0x7310('0xf'));var authService=require(_0x7310('0x10'));var qs=require(_0x7310('0x11'));var as=require(_0x7310('0x12'));var hardwareService=require(_0x7310('0x13'));var logger=require('../../config/logger')(_0x7310('0x14'));var utils=require(_0x7310('0x15'));var config=require(_0x7310('0x16'));var licenseUtil=require(_0x7310('0x17'));var db=require(_0x7310('0x18'))['db'];config[_0x7310('0x19')]=_[_0x7310('0x1a')](config[_0x7310('0x19')],{'host':_0x7310('0x1b'),'port':0x18eb});var socket=require(_0x7310('0x1c'))(new Redis(config['redis']));require(_0x7310('0x1d'))[_0x7310('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7310('0x1f')][_0x7310('0x20')]({'port':0x232a});function respondWithRpcPromise(_0xf4018f,_0xf05ea3,_0x55c2bc,_0x1090d1){return new BPromise(function(_0x25f0c7,_0x48c619){var _0x1b3c12=_0x1090d1||client;return _0x1b3c12[_0x7310('0x21')](_0xf4018f,_0x55c2bc)[_0x7310('0x22')](function(_0x2900cb){logger[_0x7310('0x23')](_0x7310('0x24'),_0xf05ea3,'request\x20sent');logger['debug'](_0x7310('0x25'),_0xf05ea3,'request\x20sent',JSON[_0x7310('0x26')](_0x2900cb));if(_0x2900cb['error']){if(_0x2900cb[_0x7310('0x27')][_0x7310('0x28')]===0x1f4){logger[_0x7310('0x27')](_0x7310('0x24'),_0xf05ea3,_0x2900cb[_0x7310('0x27')][_0x7310('0x29')]);return _0x48c619(_0x2900cb[_0x7310('0x27')][_0x7310('0x29')]);}logger[_0x7310('0x27')]('ChatQueue,\x20%s,\x20%s',_0xf05ea3,_0x2900cb['error'][_0x7310('0x29')]);return _0x25f0c7(_0x2900cb[_0x7310('0x27')][_0x7310('0x29')]);}else{logger[_0x7310('0x23')](_0x7310('0x24'),_0xf05ea3,'request\x20sent');_0x25f0c7(_0x2900cb[_0x7310('0x2a')][_0x7310('0x29')]);}})[_0x7310('0x2b')](function(_0x4aced2){logger['error'](_0x7310('0x24'),_0xf05ea3,_0x4aced2);_0x48c619(_0x4aced2);});});}function respondWithStatusCode(_0x1a6d6e,_0x4b683a){_0x4b683a=_0x4b683a||0xcc;return function(_0x300497){if(_0x300497){return _0x1a6d6e[_0x7310('0x2c')](_0x4b683a);}return _0x1a6d6e[_0x7310('0x2d')](_0x4b683a)[_0x7310('0x2e')]();};}function respondWithResult(_0x5fdbe2,_0x2d7d78){_0x2d7d78=_0x2d7d78||0xc8;return function(_0x277c94){if(_0x277c94){return _0x5fdbe2[_0x7310('0x2d')](_0x2d7d78)[_0x7310('0x2f')](_0x277c94);}};}function respondWithFilteredResult(_0x73e353,_0x467ab5){return function(_0x946b20){if(_0x946b20){var _0xeeb4ce=typeof _0x467ab5['offset']===_0x7310('0x30')&&typeof _0x467ab5[_0x7310('0x31')]===_0x7310('0x30');var _0x3d9cd2=_0x946b20[_0x7310('0x32')];var _0x4a6bf0=_0xeeb4ce?0x0:_0x467ab5[_0x7310('0x33')];var _0x44349d=_0xeeb4ce?_0x946b20['count']:_0x467ab5[_0x7310('0x33')]+_0x467ab5[_0x7310('0x31')];var _0x4f68d8;if(_0x44349d>=_0x3d9cd2){_0x44349d=_0x3d9cd2;_0x4f68d8=0xc8;}else{_0x4f68d8=0xce;}_0x73e353[_0x7310('0x2d')](_0x4f68d8);return _0x73e353['set'](_0x7310('0x34'),_0x4a6bf0+'-'+_0x44349d+'/'+_0x3d9cd2)[_0x7310('0x2f')](_0x946b20);}return null;};}function patchUpdates(_0x284a2c){return function(_0x3292ce){try{jsonpatch[_0x7310('0x35')](_0x3292ce,_0x284a2c,!![]);}catch(_0x1776da){return BPromise['reject'](_0x1776da);}return _0x3292ce[_0x7310('0x36')]();};}function saveUpdates(_0x9a2054,_0x471975){return function(_0x5741d1){if(_0x5741d1){return _0x5741d1[_0x7310('0x37')](_0x9a2054)[_0x7310('0x22')](function(_0x5d5286){return _0x5d5286;});}return null;};}function removeEntity(_0x24a4cd,_0x373e8d){return function(_0x56414b){if(_0x56414b){return _0x56414b[_0x7310('0x38')]()[_0x7310('0x22')](function(){var _0x1e4381=_0x56414b[_0x7310('0x39')]({'plain':!![]});var _0x5ee921=_0x7310('0x3a');return db[_0x7310('0x3b')][_0x7310('0x38')]({'where':{'type':_0x5ee921,'resourceId':_0x1e4381['id']}})[_0x7310('0x22')](function(){return _0x56414b;});})['then'](function(){_0x24a4cd[_0x7310('0x2d')](0xcc)[_0x7310('0x2e')]();});}};}function handleEntityNotFound(_0x8faf04,_0x51a5e4){return function(_0xf1a599){if(!_0xf1a599){_0x8faf04[_0x7310('0x2c')](0x194);}return _0xf1a599;};}function handleError(_0x5437ec,_0x5093d1){_0x5093d1=_0x5093d1||0x1f4;return function(_0x214daf){logger['error'](_0x214daf[_0x7310('0x3c')]);if(_0x214daf['name']){delete _0x214daf[_0x7310('0x3d')];}_0x5437ec[_0x7310('0x2d')](_0x5093d1)['send'](_0x214daf);};}exports['index']=function(_0x1ef09f,_0x21f41d){var _0x3e5af6={},_0xf9bb73={},_0x21ed3b={'count':0x0,'rows':[]};var _0x35885f=_[_0x7310('0x3e')](db[_0x7310('0x3f')]['rawAttributes'],function(_0x3d7614){return{'name':_0x3d7614['fieldName'],'type':_0x3d7614[_0x7310('0x40')][_0x7310('0x41')]};});_0xf9bb73[_0x7310('0x42')]=_['map'](_0x35885f,_0x7310('0x3d'));_0xf9bb73[_0x7310('0x43')]=_[_0x7310('0x44')](_0x1ef09f[_0x7310('0x43')]);_0xf9bb73[_0x7310('0x45')]=_['intersection'](_0xf9bb73[_0x7310('0x42')],_0xf9bb73['query']);_0x3e5af6['attributes']=_[_0x7310('0x46')](_0xf9bb73[_0x7310('0x42')],qs[_0x7310('0x47')](_0x1ef09f[_0x7310('0x43')][_0x7310('0x47')]));_0x3e5af6[_0x7310('0x48')]=_0x3e5af6[_0x7310('0x48')][_0x7310('0x49')]?_0x3e5af6[_0x7310('0x48')]:_0xf9bb73[_0x7310('0x42')];if(!_0x1ef09f['query']['hasOwnProperty'](_0x7310('0x4a'))){_0x3e5af6[_0x7310('0x31')]=qs[_0x7310('0x31')](_0x1ef09f[_0x7310('0x43')][_0x7310('0x31')]);_0x3e5af6['offset']=qs[_0x7310('0x33')](_0x1ef09f['query'][_0x7310('0x33')]);}_0x3e5af6[_0x7310('0x4b')]=qs[_0x7310('0x4c')](_0x1ef09f[_0x7310('0x43')][_0x7310('0x4c')]);_0x3e5af6[_0x7310('0x4d')]=qs[_0x7310('0x45')](_[_0x7310('0x4e')](_0x1ef09f['query'],_0xf9bb73[_0x7310('0x45')]),_0x35885f);if(_0x1ef09f[_0x7310('0x43')][_0x7310('0x4f')]){_0x3e5af6['where']=_[_0x7310('0x50')](_0x3e5af6[_0x7310('0x4d')],{'$or':_[_0x7310('0x3e')](_0x35885f,function(_0x4666ca){if(_0x4666ca[_0x7310('0x40')]!==_0x7310('0x51')){var _0x506823={};_0x506823[_0x4666ca[_0x7310('0x3d')]]={'$like':'%'+_0x1ef09f[_0x7310('0x43')][_0x7310('0x4f')]+'%'};return _0x506823;}})});}_0x3e5af6=_[_0x7310('0x50')]({},_0x3e5af6,_0x1ef09f[_0x7310('0x52')]);var _0x442b69={'where':_0x3e5af6[_0x7310('0x4d')]};return db[_0x7310('0x3f')]['count'](_0x442b69)[_0x7310('0x22')](function(_0x54db0e){_0x21ed3b['count']=_0x54db0e;if(_0x1ef09f[_0x7310('0x43')][_0x7310('0x53')]){_0x3e5af6['include']=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x3e5af6);})[_0x7310('0x22')](function(_0xe54ec8){_0x21ed3b[_0x7310('0x54')]=_0xe54ec8;return _0x21ed3b;})[_0x7310('0x22')](respondWithFilteredResult(_0x21f41d,_0x3e5af6))[_0x7310('0x2b')](handleError(_0x21f41d,null));};exports[_0x7310('0x55')]=function(_0xfdf6b2,_0x236412){var _0x4b0dc7={'raw':!![],'where':{'id':_0xfdf6b2[_0x7310('0x56')]['id']}},_0x6561c1={};_0x6561c1[_0x7310('0x42')]=_[_0x7310('0x44')](db[_0x7310('0x3f')][_0x7310('0x57')]);_0x6561c1[_0x7310('0x43')]=_[_0x7310('0x44')](_0xfdf6b2[_0x7310('0x43')]);_0x6561c1[_0x7310('0x45')]=_[_0x7310('0x46')](_0x6561c1[_0x7310('0x42')],_0x6561c1['query']);_0x4b0dc7[_0x7310('0x48')]=_[_0x7310('0x46')](_0x6561c1[_0x7310('0x42')],qs[_0x7310('0x47')](_0xfdf6b2[_0x7310('0x43')]['fields']));_0x4b0dc7[_0x7310('0x48')]=_0x4b0dc7[_0x7310('0x48')][_0x7310('0x49')]?_0x4b0dc7['attributes']:_0x6561c1[_0x7310('0x42')];if(_0xfdf6b2[_0x7310('0x43')][_0x7310('0x53')]){_0x4b0dc7[_0x7310('0x58')]=[{'all':!![]}];}_0x4b0dc7=_[_0x7310('0x50')]({},_0x4b0dc7,_0xfdf6b2['options']);return db[_0x7310('0x3f')]['find'](_0x4b0dc7)[_0x7310('0x22')](handleEntityNotFound(_0x236412,null))[_0x7310('0x22')](respondWithResult(_0x236412,null))[_0x7310('0x2b')](handleError(_0x236412,null));};exports[_0x7310('0x59')]=function(_0x2f1b50,_0x1ac034){return db[_0x7310('0x3f')][_0x7310('0x59')](_0x2f1b50[_0x7310('0x5a')],{})[_0x7310('0x22')](function(_0x3305a9){var _0x5dc91b=_0x2f1b50['user']['get']({'plain':!![]});if(!_0x5dc91b)throw new Error(_0x7310('0x5b'));if(_0x5dc91b[_0x7310('0x5c')]===_0x7310('0x5d')){var _0x497443=_0x3305a9[_0x7310('0x39')]({'plain':!![]});var _0x2ae7b5=_0x7310('0x3a');return db[_0x7310('0x5e')][_0x7310('0x5f')]({'where':{'name':_0x2ae7b5,'userProfileId':_0x5dc91b['userProfileId']},'raw':!![]})[_0x7310('0x22')](function(_0x3ef7e6){if(_0x3ef7e6&&_0x3ef7e6[_0x7310('0x60')]===0x0){return db['UserProfileResource'][_0x7310('0x59')]({'name':_0x497443[_0x7310('0x3d')],'resourceId':_0x497443['id'],'type':_0x3ef7e6['name'],'sectionId':_0x3ef7e6['id']},{})[_0x7310('0x22')](function(){return _0x3305a9;});}else{return _0x3305a9;}})[_0x7310('0x2b')](function(_0x1d661e){logger[_0x7310('0x27')](_0x7310('0x61'),_0x1d661e);throw _0x1d661e;});}return _0x3305a9;})[_0x7310('0x22')](respondWithResult(_0x1ac034,0xc9))[_0x7310('0x2b')](handleError(_0x1ac034,null));};exports[_0x7310('0x37')]=function(_0xfcf593,_0x10ff64){if(_0xfcf593['body']['id']){delete _0xfcf593['body']['id'];}return db['ChatQueue'][_0x7310('0x5f')]({'where':{'id':_0xfcf593[_0x7310('0x56')]['id']}})[_0x7310('0x22')](handleEntityNotFound(_0x10ff64,null))['then'](saveUpdates(_0xfcf593[_0x7310('0x5a')],null))[_0x7310('0x22')](respondWithResult(_0x10ff64,null))[_0x7310('0x2b')](handleError(_0x10ff64,null));};exports[_0x7310('0x38')]=function(_0x5e6d8e,_0x3753e2){return db[_0x7310('0x3f')][_0x7310('0x5f')]({'where':{'id':_0x5e6d8e[_0x7310('0x56')]['id']}})[_0x7310('0x22')](handleEntityNotFound(_0x3753e2,null))[_0x7310('0x22')](removeEntity(_0x3753e2,null))[_0x7310('0x2b')](handleError(_0x3753e2,null));};exports['describe']=function(_0x4a4610,_0x397429){return db['ChatQueue'][_0x7310('0x62')]()['then'](respondWithResult(_0x397429,null))['catch'](handleError(_0x397429,null));};exports[_0x7310('0x63')]=function(_0x47b9f4,_0x4fdd93,_0x3ee42a){var _0x2f7a0b={'raw':!![],'where':{}},_0x114aa6={},_0x5e5e3b;return db['ChatQueue'][_0x7310('0x64')]({'where':{'id':_0x47b9f4[_0x7310('0x56')]['id']}})[_0x7310('0x22')](handleEntityNotFound(_0x4fdd93,null))[_0x7310('0x22')](function(_0x582546){if(_0x582546){_0x5e5e3b=_0x582546['get']({'plain':!![]});_0x114aa6['model']=_[_0x7310('0x44')](db[_0x7310('0x65')][_0x7310('0x57')]);_0x114aa6[_0x7310('0x43')]=_[_0x7310('0x44')](_0x47b9f4[_0x7310('0x43')]);_0x114aa6[_0x7310('0x45')]=_['intersection'](_0x114aa6[_0x7310('0x42')],_0x114aa6[_0x7310('0x43')]);_0x2f7a0b[_0x7310('0x48')]=_['intersection'](_0x114aa6['model'],qs[_0x7310('0x47')](_0x47b9f4['query'][_0x7310('0x47')]));_0x2f7a0b[_0x7310('0x48')]=_0x2f7a0b[_0x7310('0x48')][_0x7310('0x49')]?_0x2f7a0b[_0x7310('0x48')]:_0x114aa6[_0x7310('0x42')];if(!_0x47b9f4['query'][_0x7310('0x66')](_0x7310('0x4a'))){_0x2f7a0b[_0x7310('0x31')]=qs['limit'](_0x47b9f4[_0x7310('0x43')][_0x7310('0x31')]);_0x2f7a0b[_0x7310('0x33')]=qs['offset'](_0x47b9f4[_0x7310('0x43')][_0x7310('0x33')]);}_0x2f7a0b[_0x7310('0x4b')]=qs[_0x7310('0x4c')](_0x47b9f4[_0x7310('0x43')][_0x7310('0x4c')]);_0x2f7a0b['where']=qs[_0x7310('0x45')](_['pick'](_0x47b9f4[_0x7310('0x43')],_0x114aa6['filters']));_0x2f7a0b[_0x7310('0x4d')]['ChatQueueId']=_0x582546['id'];if(_0x47b9f4[_0x7310('0x43')][_0x7310('0x4f')]){_0x2f7a0b['where']=_[_0x7310('0x50')](_0x2f7a0b['where'],{'$or':_[_0x7310('0x3e')](_0x2f7a0b['attributes'],function(_0x7a4924){var _0x3656dd={};_0x3656dd[_0x7a4924]={'$like':'%'+_0x47b9f4[_0x7310('0x43')]['filter']+'%'};return _0x3656dd;})});}_0x2f7a0b=_[_0x7310('0x50')]({},_0x2f7a0b,_0x47b9f4[_0x7310('0x52')]);return db['UserChatQueue'][_0x7310('0x67')](_0x2f7a0b);}})[_0x7310('0x22')](function(_0x15d9fe){if(_0x15d9fe){return db['User']['findAndCountAll']({'where':{'id':_[_0x7310('0x3e')](_0x15d9fe,_0x7310('0x68')),'role':_0x7310('0x69')},'attributes':['id',_0x7310('0x3d'),_0x7310('0x6a'),_0x7310('0x6b'),_0x7310('0x6c')]});}})['then'](function(_0x3c3226){if(_0x3c3226){return{'count':_0x3c3226[_0x7310('0x32')],'rows':_[_0x7310('0x3e')](_0x3c3226[_0x7310('0x54')],function(_0x2b700e){return{'membername':_0x2b700e['name'],'UserId':_0x2b700e['id'],'queue_name':_0x5e5e3b['name'],'ChatQueueId':_0x5e5e3b['id'],'interface':util[_0x7310('0x6d')](_0x7310('0x6e'),_0x7310('0x6f'),_0x2b700e['name']),'penalty':0x0,'paused':_0x2b700e[_0x7310('0x6a')],'createdAt':_0x2b700e[_0x7310('0x6c')],'updatedAt':_0x2b700e[_0x7310('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7310('0x22')](respondWithFilteredResult(_0x4fdd93,_0x2f7a0b))['catch'](handleError(_0x4fdd93,null));};exports['getTeams']=function(_0x45831b,_0x5bdc48,_0x42b338){var _0x445683={};var _0x32c24f={};var _0xbbec28;var _0xdab0d2;return db[_0x7310('0x3f')][_0x7310('0x64')]({'where':{'id':_0x45831b[_0x7310('0x56')]['id']}})[_0x7310('0x22')](handleEntityNotFound(_0x5bdc48,null))['then'](function(_0x24c7be){if(_0x24c7be){_0xbbec28=_0x24c7be;_0x32c24f[_0x7310('0x42')]=_[_0x7310('0x44')](db['Team'][_0x7310('0x57')]);_0x32c24f['query']=_[_0x7310('0x44')](_0x45831b[_0x7310('0x43')]);_0x32c24f[_0x7310('0x45')]=_[_0x7310('0x46')](_0x32c24f[_0x7310('0x42')],_0x32c24f[_0x7310('0x43')]);_0x445683['attributes']=_[_0x7310('0x46')](_0x32c24f[_0x7310('0x42')],qs[_0x7310('0x47')](_0x45831b[_0x7310('0x43')][_0x7310('0x47')]));_0x445683[_0x7310('0x48')]=_0x445683[_0x7310('0x48')]['length']?_0x445683['attributes']:_0x32c24f[_0x7310('0x42')];_0x445683['order']=qs[_0x7310('0x4c')](_0x45831b[_0x7310('0x43')][_0x7310('0x4c')]);_0x445683['where']=qs['filters'](_[_0x7310('0x4e')](_0x45831b[_0x7310('0x43')],_0x32c24f['filters']));if(_0x45831b['query'][_0x7310('0x4f')]){_0x445683[_0x7310('0x4d')]=_[_0x7310('0x50')](_0x445683['where'],{'$or':_[_0x7310('0x3e')](_0x445683['attributes'],function(_0x4b627f){var _0x2f5240={};_0x2f5240[_0x4b627f]={'$like':'%'+_0x45831b[_0x7310('0x43')][_0x7310('0x4f')]+'%'};return _0x2f5240;})});}_0x445683=_[_0x7310('0x50')]({},_0x445683,_0x45831b[_0x7310('0x52')]);return _0xbbec28[_0x7310('0x70')](_0x445683);}})['then'](function(_0x56525f){if(_0x56525f){_0xdab0d2=_0x56525f[_0x7310('0x49')];if(!_0x45831b['query'][_0x7310('0x66')](_0x7310('0x4a'))){_0x445683['limit']=qs[_0x7310('0x31')](_0x45831b[_0x7310('0x43')][_0x7310('0x31')]);_0x445683[_0x7310('0x33')]=qs[_0x7310('0x33')](_0x45831b['query']['offset']);}return _0xbbec28['getTeams'](_0x445683);}})[_0x7310('0x22')](function(_0x2e84b3){if(_0x2e84b3){return _0x2e84b3?{'count':_0xdab0d2,'rows':_0x2e84b3}:null;}})[_0x7310('0x22')](respondWithResult(_0x5bdc48,null))[_0x7310('0x2b')](handleError(_0x5bdc48,null));};exports['addTeams']=function(_0xb71d84,_0x300842,_0x4dc351){var _0x1b8eb1=_0xb71d84[_0x7310('0x5a')][_0x7310('0x71')];return db[_0x7310('0x72')][_0x7310('0x67')]({'where':{'id':_0x1b8eb1},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7310('0x73'),'attributes':['id','name','online',_0x7310('0x74'),_0x7310('0x75')],'raw':!![]}]})[_0x7310('0x22')](function(_0x1a7176){if(_0x1a7176){var _0x440dd5=_[_0x7310('0x76')](_0x1a7176,function(_0x40faca){var _0x231dde=_0x40faca[_0x7310('0x39')]({'plain':!![]});return _0x231dde[_0x7310('0x73')];});return db['ChatQueue'][_0x7310('0x5f')]({'where':{'id':_0xb71d84['params']['id']}})[_0x7310('0x22')](function(_0x356c52){return db[_0x7310('0x77')]['transaction'](function(_0x2fc967){return _0x356c52[_0x7310('0x78')](_0x1b8eb1,{'transaction':_0x2fc967})['then'](function(){return BPromise[_0x7310('0x79')](_0x440dd5,function(_0x812bec){return db[_0x7310('0x65')]['findOrCreate']({'where':{'UserId':_0x812bec['id'],'ChatQueueId':_0xb71d84['params']['id']},'transaction':_0x2fc967});});})[_0x7310('0x22')](function(){_0x440dd5[_0x7310('0x7a')](function(_0x18fb73){socket[_0x7310('0x7b')](_0x7310('0x7c'),{'UserId':_0x18fb73['id'],'ChatQueueId':_0x356c52['id']});});});});});}})[_0x7310('0x22')](respondWithStatusCode(_0x300842,null))[_0x7310('0x2b')](handleError(_0x300842,null));};exports[_0x7310('0x7d')]=function(_0x4cd3c4,_0x20a91e,_0xee9e6c){return db[_0x7310('0x72')][_0x7310('0x67')]({'where':{'id':_0x4cd3c4[_0x7310('0x43')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7310('0x7e')],'as':_0x7310('0x73'),'attributes':['id'],'raw':!![]}]})[_0x7310('0x22')](handleEntityNotFound(_0x20a91e,null))['then'](function(_0x4e91cc){var _0x5d0732=_['map'](_0x4e91cc,'id');var _0x39239b=[];var _0x2e56e0=[];var _0xd5a063=squel['select']();_0xd5a063[_0x7310('0x7f')](_0x7310('0x80'))[_0x7310('0x81')](_0x7310('0x82'),'tq')[_0x7310('0x83')](_0x7310('0x84'),'ut',_0x7310('0x85'))[_0x7310('0x4d')]('ChatQueueId\x20=\x20?',_0x4cd3c4['params']['id']);for(var _0x4ba068=0x0;_0x4ba068<_0x4e91cc[_0x7310('0x49')];_0x4ba068+=0x1){let _0x5953e6=_0x4e91cc[_0x4ba068];for(var _0x498c9a=0x0;_0x498c9a<_0x5953e6['Agents']['length'];_0x498c9a+=0x1){let _0x3171ea=_0x5953e6[_0x7310('0x73')][_0x498c9a];var _0x8f9059=_0xd5a063['clone']();_0x8f9059[_0x7310('0x4d')]('ut.UserId\x20=\x20?',_0x3171ea['id']);_0x2e56e0['push'](db[_0x7310('0x77')][_0x7310('0x43')](_0x8f9059[_0x7310('0x86')](),{'type':db['sequelize'][_0x7310('0x87')]['SELECT']})['then'](function(_0x56a33c){if(_0x56a33c[_0x7310('0x49')]===0x1){return _0x3171ea['id'];}else{var _0x513518=_['every'](_[_0x7310('0x3e')](_0x56a33c,_0x7310('0x88')),function(_0x3d1184){return _['includes'](_0x5d0732,_0x3d1184);});if(_0x513518){return _0x3171ea['id'];}}}));}}return BPromise['all'](_0x2e56e0)['then'](function(_0x57d2ec){_0x39239b=_(_0x39239b)[_0x7310('0x89')](_0x57d2ec)[_0x7310('0x8a')]()[_0x7310('0x8b')]();return db[_0x7310('0x3f')][_0x7310('0x5f')]({'where':{'id':_0x4cd3c4[_0x7310('0x56')]['id']}})['then'](function(_0xcf3d2b){return db[_0x7310('0x77')][_0x7310('0x8c')](function(_0x5f1316){return _0xcf3d2b[_0x7310('0x7d')](_0x4cd3c4[_0x7310('0x43')][_0x7310('0x71')],{'transaction':_0x5f1316})['then'](function(){if(!_['isEmpty'](_0x39239b)){return _0xcf3d2b['removeAgents'](_0x39239b,{'transaction':_0x5f1316});}})[_0x7310('0x22')](function(){_0x39239b[_0x7310('0x7a')](function(_0x14cbda){socket[_0x7310('0x7b')](_0x7310('0x8d'),{'UserId':_0x14cbda,'ChatQueueId':_0xcf3d2b['id']});});});});});});})['then'](respondWithStatusCode(_0x20a91e,null))[_0x7310('0x2b')](handleError(_0x20a91e,null));};exports[_0x7310('0x8e')]=function(_0x418b40,_0x5d3a57,_0x1ccebb){return db[_0x7310('0x3f')]['find']({'where':{'id':_0x418b40['params']['id']}})[_0x7310('0x22')](handleEntityNotFound(_0x5d3a57,null))[_0x7310('0x22')](function(_0x17c8f6){if(_0x17c8f6){return _0x17c8f6[_0x7310('0x8e')](_0x418b40[_0x7310('0x5a')][_0x7310('0x71')],_[_0x7310('0x8f')](_0x418b40[_0x7310('0x5a')],[_0x7310('0x71'),'id'])||{})['spread'](function(_0x121042){for(var _0x565fec=0x0;_0x565fec<_0x418b40[_0x7310('0x5a')][_0x7310('0x71')][_0x7310('0x49')];_0x565fec+=0x1){socket[_0x7310('0x7b')]('userChatQueue:save',{'UserId':Number(_0x418b40['body'][_0x7310('0x71')][_0x565fec]),'ChatQueueId':Number(_0x418b40[_0x7310('0x56')]['id'])});}return _0x121042;});}})[_0x7310('0x22')](respondWithResult(_0x5d3a57,null))[_0x7310('0x2b')](handleError(_0x5d3a57,null));};exports[_0x7310('0x90')]=function(_0x262878,_0x5172d4,_0x27e651){return db['ChatQueue'][_0x7310('0x5f')]({'where':{'id':_0x262878[_0x7310('0x56')]['id']}})[_0x7310('0x22')](handleEntityNotFound(_0x5172d4,null))[_0x7310('0x22')](function(_0x15aa0d){if(_0x15aa0d){return _0x15aa0d[_0x7310('0x90')](_0x262878[_0x7310('0x43')]['ids'])[_0x7310('0x22')](function(){if(_[_0x7310('0x91')](_0x262878[_0x7310('0x43')][_0x7310('0x71')])){for(var _0x3bdc2a=0x0;_0x3bdc2a<_0x262878['query'][_0x7310('0x71')]['length'];_0x3bdc2a+=0x1){socket[_0x7310('0x7b')]('userChatQueue:remove',{'UserId':Number(_0x262878['query'][_0x7310('0x71')][_0x3bdc2a]),'ChatQueueId':Number(_0x262878[_0x7310('0x56')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x262878[_0x7310('0x43')][_0x7310('0x71')]),'ChatQueueId':Number(_0x262878[_0x7310('0x56')]['id'])});}});}})[_0x7310('0x22')](respondWithStatusCode(_0x5172d4,null))[_0x7310('0x2b')](handleError(_0x5172d4,null));};exports[_0x7310('0x92')]=function(_0x4d1949,_0x17a2ca,_0x1d0751){var _0x50a8bf={};var _0xe1df09={};var _0xe8fc1c;var _0x145513;return db[_0x7310('0x3f')][_0x7310('0x64')]({'where':{'id':_0x4d1949[_0x7310('0x56')]['id']}})[_0x7310('0x22')](handleEntityNotFound(_0x17a2ca,null))['then'](function(_0x320a29){if(_0x320a29){_0xe8fc1c=_0x320a29;_0xe1df09[_0x7310('0x42')]=_['keys'](db[_0x7310('0x7e')][_0x7310('0x57')]);_0xe1df09[_0x7310('0x43')]=_[_0x7310('0x44')](_0x4d1949[_0x7310('0x43')]);_0xe1df09[_0x7310('0x45')]=_[_0x7310('0x46')](_0xe1df09['model'],_0xe1df09[_0x7310('0x43')]);_0x50a8bf['attributes']=_[_0x7310('0x46')](_0xe1df09[_0x7310('0x42')],qs[_0x7310('0x47')](_0x4d1949['query'][_0x7310('0x47')]));_0x50a8bf[_0x7310('0x48')]=_0x50a8bf['attributes'][_0x7310('0x49')]?_0x50a8bf['attributes']:_0xe1df09[_0x7310('0x42')];_0x50a8bf[_0x7310('0x4b')]=qs['sort'](_0x4d1949[_0x7310('0x43')]['sort']);_0x50a8bf[_0x7310('0x4d')]=qs[_0x7310('0x45')](_[_0x7310('0x4e')](_0x4d1949[_0x7310('0x43')],_0xe1df09[_0x7310('0x45')]));if(_0x4d1949[_0x7310('0x43')]['filter']){_0x50a8bf[_0x7310('0x4d')]=_[_0x7310('0x50')](_0x50a8bf[_0x7310('0x4d')],{'$or':_[_0x7310('0x3e')](_0x50a8bf[_0x7310('0x48')],function(_0x55a82b){var _0x1a6f63={};_0x1a6f63[_0x55a82b]={'$like':'%'+_0x4d1949[_0x7310('0x43')]['filter']+'%'};return _0x1a6f63;})});}_0x50a8bf=_[_0x7310('0x50')]({},_0x50a8bf,_0x4d1949[_0x7310('0x52')]);return _0xe8fc1c[_0x7310('0x92')](_0x50a8bf);}})[_0x7310('0x22')](function(_0x462cf8){if(_0x462cf8){_0x145513=_0x462cf8[_0x7310('0x49')];if(!_0x4d1949['query']['hasOwnProperty'](_0x7310('0x4a'))){_0x50a8bf[_0x7310('0x31')]=qs[_0x7310('0x31')](_0x4d1949[_0x7310('0x43')]['limit']);_0x50a8bf[_0x7310('0x33')]=qs[_0x7310('0x33')](_0x4d1949[_0x7310('0x43')][_0x7310('0x33')]);}return _0xe8fc1c[_0x7310('0x92')](_0x50a8bf);}})[_0x7310('0x22')](function(_0x2dcc1e){if(_0x2dcc1e){return _0x2dcc1e?{'count':_0x145513,'rows':_0x2dcc1e}:null;}})[_0x7310('0x22')](respondWithResult(_0x17a2ca,null))[_0x7310('0x2b')](handleError(_0x17a2ca,null));}; \ No newline at end of file +var _0x9f89=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','ChatQueues','UserProfileResource','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','ChatQueueId','UserChatQueue','UserId','agent','chatPause','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','userChatQueue:save','removeTeams','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','isEmpty','removeAgents','addAgents','emit','isArray','userChatQueue:remove','getAgents','rimraf'];(function(_0x3ecf38,_0x2426af){var _0x2be6f0=function(_0x1b4727){while(--_0x1b4727){_0x3ecf38['push'](_0x3ecf38['shift']());}};_0x2be6f0(++_0x2426af);}(_0x9f89,0x13d));var _0x99f8=function(_0x5c525c,_0xc1d8a6){_0x5c525c=_0x5c525c-0x0;var _0x54413c=_0x9f89[_0x5c525c];return _0x54413c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99f8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x99f8('0x1'));var rp=require(_0x99f8('0x2'));var moment=require(_0x99f8('0x3'));var BPromise=require(_0x99f8('0x4'));var Mustache=require(_0x99f8('0x5'));var util=require('util');var path=require(_0x99f8('0x6'));var sox=require(_0x99f8('0x7'));var csv=require(_0x99f8('0x8'));var ejs=require(_0x99f8('0x9'));var fs=require('fs');var fs_extra=require(_0x99f8('0xa'));var _=require(_0x99f8('0xb'));var squel=require(_0x99f8('0xc'));var crypto=require('crypto');var jsforce=require(_0x99f8('0xd'));var deskjs=require(_0x99f8('0xe'));var toCsv=require(_0x99f8('0x8'));var querystring=require(_0x99f8('0xf'));var Papa=require('papaparse');var Redis=require(_0x99f8('0x10'));var authService=require(_0x99f8('0x11'));var qs=require(_0x99f8('0x12'));var as=require(_0x99f8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x99f8('0x14'))(_0x99f8('0x15'));var utils=require(_0x99f8('0x16'));var config=require(_0x99f8('0x17'));var licenseUtil=require(_0x99f8('0x18'));var db=require(_0x99f8('0x19'))['db'];config[_0x99f8('0x1a')]=_[_0x99f8('0x1b')](config[_0x99f8('0x1a')],{'host':_0x99f8('0x1c'),'port':0x18eb});var socket=require(_0x99f8('0x1d'))(new Redis(config['redis']));require(_0x99f8('0x1e'))[_0x99f8('0x1f')](socket);var jayson=require(_0x99f8('0x20'));var client=jayson[_0x99f8('0x21')][_0x99f8('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x2430c1,_0x237558,_0x25a8a4,_0x29750c){return new BPromise(function(_0x1efc83,_0x3b1579){var _0x4841cc=_0x29750c||client;return _0x4841cc[_0x99f8('0x23')](_0x2430c1,_0x25a8a4)[_0x99f8('0x24')](function(_0x4937cd){logger[_0x99f8('0x25')](_0x99f8('0x26'),_0x237558,'request\x20sent');logger['debug'](_0x99f8('0x27'),_0x237558,_0x99f8('0x28'),JSON['stringify'](_0x4937cd));if(_0x4937cd[_0x99f8('0x29')]){if(_0x4937cd[_0x99f8('0x29')][_0x99f8('0x2a')]===0x1f4){logger[_0x99f8('0x29')]('ChatQueue,\x20%s,\x20%s',_0x237558,_0x4937cd[_0x99f8('0x29')][_0x99f8('0x2b')]);return _0x3b1579(_0x4937cd['error'][_0x99f8('0x2b')]);}logger[_0x99f8('0x29')](_0x99f8('0x26'),_0x237558,_0x4937cd[_0x99f8('0x29')][_0x99f8('0x2b')]);return _0x1efc83(_0x4937cd[_0x99f8('0x29')][_0x99f8('0x2b')]);}else{logger[_0x99f8('0x25')](_0x99f8('0x26'),_0x237558,_0x99f8('0x28'));_0x1efc83(_0x4937cd['result'][_0x99f8('0x2b')]);}})[_0x99f8('0x2c')](function(_0x2ed3e4){logger[_0x99f8('0x29')]('ChatQueue,\x20%s,\x20%s',_0x237558,_0x2ed3e4);_0x3b1579(_0x2ed3e4);});});}function respondWithStatusCode(_0x40f210,_0xde7280){_0xde7280=_0xde7280||0xcc;return function(_0x151e04){if(_0x151e04){return _0x40f210[_0x99f8('0x2d')](_0xde7280);}return _0x40f210[_0x99f8('0x2e')](_0xde7280)[_0x99f8('0x2f')]();};}function respondWithResult(_0x5cf6ba,_0xa6728e){_0xa6728e=_0xa6728e||0xc8;return function(_0x45509e){if(_0x45509e){return _0x5cf6ba['status'](_0xa6728e)['json'](_0x45509e);}};}function respondWithFilteredResult(_0x5dff29,_0x4ebfe5){return function(_0x55343e){if(_0x55343e){var _0x3599e5=typeof _0x4ebfe5[_0x99f8('0x30')]===_0x99f8('0x31')&&typeof _0x4ebfe5['limit']==='undefined';var _0x55ecb7=_0x55343e[_0x99f8('0x32')];var _0x16b350=_0x3599e5?0x0:_0x4ebfe5[_0x99f8('0x30')];var _0x3668e2=_0x3599e5?_0x55343e[_0x99f8('0x32')]:_0x4ebfe5[_0x99f8('0x30')]+_0x4ebfe5[_0x99f8('0x33')];var _0x3059d6;if(_0x3668e2>=_0x55ecb7){_0x3668e2=_0x55ecb7;_0x3059d6=0xc8;}else{_0x3059d6=0xce;}_0x5dff29[_0x99f8('0x2e')](_0x3059d6);return _0x5dff29[_0x99f8('0x34')](_0x99f8('0x35'),_0x16b350+'-'+_0x3668e2+'/'+_0x55ecb7)['json'](_0x55343e);}return null;};}function patchUpdates(_0x3159a4){return function(_0x519657){try{jsonpatch[_0x99f8('0x36')](_0x519657,_0x3159a4,!![]);}catch(_0x4e0f7f){return BPromise[_0x99f8('0x37')](_0x4e0f7f);}return _0x519657[_0x99f8('0x38')]();};}function saveUpdates(_0x18c209,_0x421ace){return function(_0x121930){if(_0x121930){return _0x121930[_0x99f8('0x39')](_0x18c209)[_0x99f8('0x24')](function(_0x4cb6cd){return _0x4cb6cd;});}return null;};}function removeEntity(_0x22a5f8,_0x9ba832){return function(_0x40060f){if(_0x40060f){return _0x40060f[_0x99f8('0x3a')]()[_0x99f8('0x24')](function(){var _0x1e36e8=_0x40060f['get']({'plain':!![]});var _0x5177d1=_0x99f8('0x3b');return db[_0x99f8('0x3c')][_0x99f8('0x3a')]({'where':{'type':_0x5177d1,'resourceId':_0x1e36e8['id']}})['then'](function(){return _0x40060f;});})[_0x99f8('0x24')](function(){_0x22a5f8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x421c0c,_0x43f83c){return function(_0xdcb72d){if(!_0xdcb72d){_0x421c0c['sendStatus'](0x194);}return _0xdcb72d;};}function handleError(_0x1126b6,_0x569959){_0x569959=_0x569959||0x1f4;return function(_0x5c6a3e){logger['error'](_0x5c6a3e[_0x99f8('0x3d')]);if(_0x5c6a3e['name']){delete _0x5c6a3e[_0x99f8('0x3e')];}_0x1126b6[_0x99f8('0x2e')](_0x569959)[_0x99f8('0x3f')](_0x5c6a3e);};}exports[_0x99f8('0x40')]=function(_0x25f233,_0x4879ef){var _0x32f246={},_0x2a10e0={},_0x320738={'count':0x0,'rows':[]};var _0x35a37c=_[_0x99f8('0x41')](db[_0x99f8('0x42')][_0x99f8('0x43')],function(_0x3f81e6){return{'name':_0x3f81e6[_0x99f8('0x44')],'type':_0x3f81e6['type'][_0x99f8('0x45')]};});_0x2a10e0[_0x99f8('0x46')]=_[_0x99f8('0x41')](_0x35a37c,'name');_0x2a10e0[_0x99f8('0x47')]=_[_0x99f8('0x48')](_0x25f233['query']);_0x2a10e0['filters']=_[_0x99f8('0x49')](_0x2a10e0[_0x99f8('0x46')],_0x2a10e0[_0x99f8('0x47')]);_0x32f246['attributes']=_['intersection'](_0x2a10e0['model'],qs[_0x99f8('0x4a')](_0x25f233[_0x99f8('0x47')]['fields']));_0x32f246[_0x99f8('0x4b')]=_0x32f246[_0x99f8('0x4b')][_0x99f8('0x4c')]?_0x32f246['attributes']:_0x2a10e0['model'];if(!_0x25f233[_0x99f8('0x47')][_0x99f8('0x4d')](_0x99f8('0x4e'))){_0x32f246[_0x99f8('0x33')]=qs['limit'](_0x25f233['query'][_0x99f8('0x33')]);_0x32f246['offset']=qs[_0x99f8('0x30')](_0x25f233[_0x99f8('0x47')][_0x99f8('0x30')]);}_0x32f246[_0x99f8('0x4f')]=qs[_0x99f8('0x50')](_0x25f233['query'][_0x99f8('0x50')]);_0x32f246[_0x99f8('0x51')]=qs[_0x99f8('0x52')](_[_0x99f8('0x53')](_0x25f233[_0x99f8('0x47')],_0x2a10e0[_0x99f8('0x52')]),_0x35a37c);if(_0x25f233[_0x99f8('0x47')][_0x99f8('0x54')]){_0x32f246[_0x99f8('0x51')]=_[_0x99f8('0x55')](_0x32f246[_0x99f8('0x51')],{'$or':_['map'](_0x35a37c,function(_0x406086){if(_0x406086[_0x99f8('0x56')]!==_0x99f8('0x57')){var _0x17ff4f={};_0x17ff4f[_0x406086['name']]={'$like':'%'+_0x25f233['query'][_0x99f8('0x54')]+'%'};return _0x17ff4f;}})});}_0x32f246=_[_0x99f8('0x55')]({},_0x32f246,_0x25f233[_0x99f8('0x58')]);var _0x504739={'where':_0x32f246[_0x99f8('0x51')]};return db[_0x99f8('0x42')][_0x99f8('0x32')](_0x504739)[_0x99f8('0x24')](function(_0x4ac437){_0x320738[_0x99f8('0x32')]=_0x4ac437;if(_0x25f233[_0x99f8('0x47')][_0x99f8('0x59')]){_0x32f246[_0x99f8('0x5a')]=[{'all':!![]}];}return db[_0x99f8('0x42')][_0x99f8('0x5b')](_0x32f246);})[_0x99f8('0x24')](function(_0x184e1f){_0x320738[_0x99f8('0x5c')]=_0x184e1f;return _0x320738;})['then'](respondWithFilteredResult(_0x4879ef,_0x32f246))[_0x99f8('0x2c')](handleError(_0x4879ef,null));};exports[_0x99f8('0x5d')]=function(_0x112b08,_0x242113){var _0x2ee90e={'raw':!![],'where':{'id':_0x112b08[_0x99f8('0x5e')]['id']}},_0x27941a={};_0x27941a['model']=_[_0x99f8('0x48')](db[_0x99f8('0x42')][_0x99f8('0x43')]);_0x27941a[_0x99f8('0x47')]=_[_0x99f8('0x48')](_0x112b08[_0x99f8('0x47')]);_0x27941a[_0x99f8('0x52')]=_[_0x99f8('0x49')](_0x27941a[_0x99f8('0x46')],_0x27941a[_0x99f8('0x47')]);_0x2ee90e[_0x99f8('0x4b')]=_[_0x99f8('0x49')](_0x27941a[_0x99f8('0x46')],qs[_0x99f8('0x4a')](_0x112b08['query'][_0x99f8('0x4a')]));_0x2ee90e['attributes']=_0x2ee90e[_0x99f8('0x4b')][_0x99f8('0x4c')]?_0x2ee90e[_0x99f8('0x4b')]:_0x27941a[_0x99f8('0x46')];if(_0x112b08[_0x99f8('0x47')][_0x99f8('0x59')]){_0x2ee90e[_0x99f8('0x5a')]=[{'all':!![]}];}_0x2ee90e=_[_0x99f8('0x55')]({},_0x2ee90e,_0x112b08[_0x99f8('0x58')]);return db['ChatQueue'][_0x99f8('0x5f')](_0x2ee90e)[_0x99f8('0x24')](handleEntityNotFound(_0x242113,null))['then'](respondWithResult(_0x242113,null))[_0x99f8('0x2c')](handleError(_0x242113,null));};exports['create']=function(_0x3ef979,_0x9bbd46){return db[_0x99f8('0x42')][_0x99f8('0x60')](_0x3ef979['body'],{})[_0x99f8('0x24')](function(_0x59d558){var _0x5b02fe=_0x3ef979[_0x99f8('0x61')]['get']({'plain':!![]});if(!_0x5b02fe)throw new Error(_0x99f8('0x62'));if(_0x5b02fe[_0x99f8('0x63')]===_0x99f8('0x61')){var _0x2dde06=_0x59d558[_0x99f8('0x64')]({'plain':!![]});var _0x2558f0='ChatQueues';return db[_0x99f8('0x65')][_0x99f8('0x5f')]({'where':{'name':_0x2558f0,'userProfileId':_0x5b02fe[_0x99f8('0x66')]},'raw':!![]})[_0x99f8('0x24')](function(_0x233713){if(_0x233713&&_0x233713[_0x99f8('0x67')]===0x0){return db['UserProfileResource'][_0x99f8('0x60')]({'name':_0x2dde06[_0x99f8('0x3e')],'resourceId':_0x2dde06['id'],'type':_0x233713[_0x99f8('0x3e')],'sectionId':_0x233713['id']},{})[_0x99f8('0x24')](function(){return _0x59d558;});}else{return _0x59d558;}})[_0x99f8('0x2c')](function(_0x275ed6){logger['error'](_0x99f8('0x68'),_0x275ed6);throw _0x275ed6;});}return _0x59d558;})[_0x99f8('0x24')](respondWithResult(_0x9bbd46,0xc9))['catch'](handleError(_0x9bbd46,null));};exports[_0x99f8('0x39')]=function(_0x362628,_0x51f9e0){if(_0x362628[_0x99f8('0x69')]['id']){delete _0x362628[_0x99f8('0x69')]['id'];}return db[_0x99f8('0x42')][_0x99f8('0x5f')]({'where':{'id':_0x362628[_0x99f8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x51f9e0,null))['then'](saveUpdates(_0x362628['body'],null))['then'](respondWithResult(_0x51f9e0,null))['catch'](handleError(_0x51f9e0,null));};exports[_0x99f8('0x3a')]=function(_0x5d1b54,_0x1e2d52){return db[_0x99f8('0x42')][_0x99f8('0x5f')]({'where':{'id':_0x5d1b54['params']['id']}})[_0x99f8('0x24')](handleEntityNotFound(_0x1e2d52,null))[_0x99f8('0x24')](removeEntity(_0x1e2d52,null))['catch'](handleError(_0x1e2d52,null));};exports[_0x99f8('0x6a')]=function(_0x1a797e,_0x13e5d4){return db[_0x99f8('0x42')][_0x99f8('0x6a')]()['then'](respondWithResult(_0x13e5d4,null))[_0x99f8('0x2c')](handleError(_0x13e5d4,null));};exports[_0x99f8('0x6b')]=function(_0xb48f2b,_0x1768fc,_0x205cce){var _0x4daa88={'raw':!![],'where':{}},_0x2b75a1={},_0x2b09ab;return db[_0x99f8('0x42')][_0x99f8('0x6c')]({'where':{'id':_0xb48f2b[_0x99f8('0x5e')]['id']}})[_0x99f8('0x24')](handleEntityNotFound(_0x1768fc,null))[_0x99f8('0x24')](function(_0x2d9c62){if(_0x2d9c62){_0x2b09ab=_0x2d9c62[_0x99f8('0x64')]({'plain':!![]});_0x2b75a1[_0x99f8('0x46')]=_['keys'](db['UserChatQueue']['rawAttributes']);_0x2b75a1['query']=_['keys'](_0xb48f2b[_0x99f8('0x47')]);_0x2b75a1[_0x99f8('0x52')]=_['intersection'](_0x2b75a1[_0x99f8('0x46')],_0x2b75a1[_0x99f8('0x47')]);_0x4daa88['attributes']=_[_0x99f8('0x49')](_0x2b75a1['model'],qs[_0x99f8('0x4a')](_0xb48f2b[_0x99f8('0x47')]['fields']));_0x4daa88[_0x99f8('0x4b')]=_0x4daa88[_0x99f8('0x4b')]['length']?_0x4daa88[_0x99f8('0x4b')]:_0x2b75a1[_0x99f8('0x46')];if(!_0xb48f2b['query'][_0x99f8('0x4d')]('nolimit')){_0x4daa88[_0x99f8('0x33')]=qs['limit'](_0xb48f2b[_0x99f8('0x47')][_0x99f8('0x33')]);_0x4daa88['offset']=qs['offset'](_0xb48f2b[_0x99f8('0x47')][_0x99f8('0x30')]);}_0x4daa88[_0x99f8('0x4f')]=qs[_0x99f8('0x50')](_0xb48f2b[_0x99f8('0x47')][_0x99f8('0x50')]);_0x4daa88['where']=qs[_0x99f8('0x52')](_['pick'](_0xb48f2b[_0x99f8('0x47')],_0x2b75a1[_0x99f8('0x52')]));_0x4daa88[_0x99f8('0x51')][_0x99f8('0x6d')]=_0x2d9c62['id'];if(_0xb48f2b[_0x99f8('0x47')][_0x99f8('0x54')]){_0x4daa88[_0x99f8('0x51')]=_[_0x99f8('0x55')](_0x4daa88[_0x99f8('0x51')],{'$or':_['map'](_0x4daa88['attributes'],function(_0x29a40b){var _0x19d585={};_0x19d585[_0x29a40b]={'$like':'%'+_0xb48f2b[_0x99f8('0x47')][_0x99f8('0x54')]+'%'};return _0x19d585;})});}_0x4daa88=_['merge']({},_0x4daa88,_0xb48f2b['options']);return db[_0x99f8('0x6e')][_0x99f8('0x5b')](_0x4daa88);}})[_0x99f8('0x24')](function(_0x4072cc){if(_0x4072cc){return db['User']['findAndCountAll']({'where':{'id':_[_0x99f8('0x41')](_0x4072cc,_0x99f8('0x6f')),'role':_0x99f8('0x70')},'attributes':['id',_0x99f8('0x3e'),_0x99f8('0x71'),'updatedAt',_0x99f8('0x72')]});}})[_0x99f8('0x24')](function(_0x1794be){if(_0x1794be){return{'count':_0x1794be['count'],'rows':_[_0x99f8('0x41')](_0x1794be[_0x99f8('0x5c')],function(_0x5e244e){return{'membername':_0x5e244e[_0x99f8('0x3e')],'UserId':_0x5e244e['id'],'queue_name':_0x2b09ab[_0x99f8('0x3e')],'ChatQueueId':_0x2b09ab['id'],'interface':util[_0x99f8('0x73')](_0x99f8('0x74'),_0x99f8('0x75'),_0x5e244e[_0x99f8('0x3e')]),'penalty':0x0,'paused':_0x5e244e[_0x99f8('0x71')],'createdAt':_0x5e244e[_0x99f8('0x72')],'updatedAt':_0x5e244e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x99f8('0x24')](respondWithFilteredResult(_0x1768fc,_0x4daa88))[_0x99f8('0x2c')](handleError(_0x1768fc,null));};exports[_0x99f8('0x76')]=function(_0x255088,_0x3a691,_0x1041e3){var _0x293dd6={};var _0x148ea1={};var _0x35156d;var _0x3cb606;return db[_0x99f8('0x42')][_0x99f8('0x6c')]({'where':{'id':_0x255088['params']['id']}})[_0x99f8('0x24')](handleEntityNotFound(_0x3a691,null))[_0x99f8('0x24')](function(_0x6bf41c){if(_0x6bf41c){_0x35156d=_0x6bf41c;_0x148ea1[_0x99f8('0x46')]=_['keys'](db[_0x99f8('0x77')][_0x99f8('0x43')]);_0x148ea1['query']=_['keys'](_0x255088[_0x99f8('0x47')]);_0x148ea1[_0x99f8('0x52')]=_[_0x99f8('0x49')](_0x148ea1[_0x99f8('0x46')],_0x148ea1[_0x99f8('0x47')]);_0x293dd6['attributes']=_[_0x99f8('0x49')](_0x148ea1[_0x99f8('0x46')],qs[_0x99f8('0x4a')](_0x255088[_0x99f8('0x47')][_0x99f8('0x4a')]));_0x293dd6['attributes']=_0x293dd6[_0x99f8('0x4b')][_0x99f8('0x4c')]?_0x293dd6['attributes']:_0x148ea1[_0x99f8('0x46')];_0x293dd6['order']=qs[_0x99f8('0x50')](_0x255088[_0x99f8('0x47')][_0x99f8('0x50')]);_0x293dd6[_0x99f8('0x51')]=qs[_0x99f8('0x52')](_[_0x99f8('0x53')](_0x255088[_0x99f8('0x47')],_0x148ea1[_0x99f8('0x52')]));if(_0x255088[_0x99f8('0x47')]['filter']){_0x293dd6[_0x99f8('0x51')]=_[_0x99f8('0x55')](_0x293dd6[_0x99f8('0x51')],{'$or':_[_0x99f8('0x41')](_0x293dd6['attributes'],function(_0x4a1f22){var _0x47c653={};_0x47c653[_0x4a1f22]={'$like':'%'+_0x255088[_0x99f8('0x47')][_0x99f8('0x54')]+'%'};return _0x47c653;})});}_0x293dd6=_['merge']({},_0x293dd6,_0x255088[_0x99f8('0x58')]);return _0x35156d[_0x99f8('0x76')](_0x293dd6);}})['then'](function(_0x3e6628){if(_0x3e6628){_0x3cb606=_0x3e6628[_0x99f8('0x4c')];if(!_0x255088[_0x99f8('0x47')][_0x99f8('0x4d')](_0x99f8('0x4e'))){_0x293dd6['limit']=qs[_0x99f8('0x33')](_0x255088[_0x99f8('0x47')][_0x99f8('0x33')]);_0x293dd6[_0x99f8('0x30')]=qs['offset'](_0x255088['query'][_0x99f8('0x30')]);}return _0x35156d[_0x99f8('0x76')](_0x293dd6);}})['then'](function(_0x7b314d){if(_0x7b314d){return _0x7b314d?{'count':_0x3cb606,'rows':_0x7b314d}:null;}})[_0x99f8('0x24')](respondWithResult(_0x3a691,null))['catch'](handleError(_0x3a691,null));};exports[_0x99f8('0x78')]=function(_0x2f38f3,_0x1edecf,_0x340fe7){var _0x375ef9=_0x2f38f3[_0x99f8('0x69')][_0x99f8('0x79')];return db[_0x99f8('0x77')][_0x99f8('0x5b')]({'where':{'id':_0x375ef9},'attributes':['id'],'include':[{'model':db[_0x99f8('0x7a')],'as':_0x99f8('0x7b'),'attributes':['id',_0x99f8('0x3e'),_0x99f8('0x7c'),_0x99f8('0x7d'),_0x99f8('0x7e')],'raw':!![]}]})[_0x99f8('0x24')](function(_0x3580e3){if(_0x3580e3){var _0x27c8bc=_[_0x99f8('0x7f')](_0x3580e3,function(_0x2a2390){var _0x42b7a7=_0x2a2390['get']({'plain':!![]});return _0x42b7a7[_0x99f8('0x7b')];});return db[_0x99f8('0x42')][_0x99f8('0x5f')]({'where':{'id':_0x2f38f3[_0x99f8('0x5e')]['id']}})[_0x99f8('0x24')](function(_0x4a9f34){return db[_0x99f8('0x80')][_0x99f8('0x81')](function(_0x17ef51){return _0x4a9f34['addTeams'](_0x375ef9,{'transaction':_0x17ef51})[_0x99f8('0x24')](function(){return BPromise['each'](_0x27c8bc,function(_0x2d0398){return db[_0x99f8('0x6e')][_0x99f8('0x82')]({'where':{'UserId':_0x2d0398['id'],'ChatQueueId':_0x2f38f3[_0x99f8('0x5e')]['id']},'transaction':_0x17ef51});});})[_0x99f8('0x24')](function(){_0x27c8bc[_0x99f8('0x83')](function(_0x2f3e83){socket['emit'](_0x99f8('0x84'),{'UserId':_0x2f3e83['id'],'ChatQueueId':_0x4a9f34['id']});});});});});}})[_0x99f8('0x24')](respondWithStatusCode(_0x1edecf,null))['catch'](handleError(_0x1edecf,null));};exports[_0x99f8('0x85')]=function(_0x443149,_0x146f2b,_0x9c8045){return db[_0x99f8('0x77')][_0x99f8('0x5b')]({'where':{'id':_0x443149[_0x99f8('0x47')]['ids']},'attributes':['id'],'include':[{'model':db[_0x99f8('0x7a')],'as':_0x99f8('0x7b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x146f2b,null))[_0x99f8('0x24')](function(_0x573992){var _0x4d9d48=_[_0x99f8('0x41')](_0x573992,'id');var _0xba170=[];var _0x5ce0c0=[];var _0x263b34=squel[_0x99f8('0x86')]();_0x263b34[_0x99f8('0x87')](_0x99f8('0x88'))['from'](_0x99f8('0x89'),'tq')[_0x99f8('0x8a')](_0x99f8('0x8b'),'ut',_0x99f8('0x8c'))[_0x99f8('0x51')](_0x99f8('0x8d'),_0x443149[_0x99f8('0x5e')]['id']);for(var _0x14a71c=0x0;_0x14a71c<_0x573992['length'];_0x14a71c+=0x1){let _0x7d43cd=_0x573992[_0x14a71c];for(var _0xf091e3=0x0;_0xf091e3<_0x7d43cd[_0x99f8('0x7b')]['length'];_0xf091e3+=0x1){let _0x3048fe=_0x7d43cd[_0x99f8('0x7b')][_0xf091e3];var _0x3e85ea=_0x263b34['clone']();_0x3e85ea[_0x99f8('0x51')](_0x99f8('0x8e'),_0x3048fe['id']);_0x5ce0c0[_0x99f8('0x8f')](db[_0x99f8('0x80')][_0x99f8('0x47')](_0x3e85ea[_0x99f8('0x90')](),{'type':db['sequelize'][_0x99f8('0x91')][_0x99f8('0x92')]})[_0x99f8('0x24')](function(_0x46301c){if(_0x46301c['length']===0x1){return _0x3048fe['id'];}else{var _0x5d2be7=_['every'](_[_0x99f8('0x41')](_0x46301c,_0x99f8('0x93')),function(_0x16ff56){return _[_0x99f8('0x94')](_0x4d9d48,_0x16ff56);});if(_0x5d2be7){return _0x3048fe['id'];}}}));}}return BPromise['all'](_0x5ce0c0)[_0x99f8('0x24')](function(_0x50c001){_0xba170=_(_0xba170)[_0x99f8('0x95')](_0x50c001)[_0x99f8('0x96')]()[_0x99f8('0x97')]();return db[_0x99f8('0x42')][_0x99f8('0x5f')]({'where':{'id':_0x443149[_0x99f8('0x5e')]['id']}})[_0x99f8('0x24')](function(_0x8e3b1a){return db[_0x99f8('0x80')]['transaction'](function(_0xa2206b){return _0x8e3b1a[_0x99f8('0x85')](_0x443149[_0x99f8('0x47')]['ids'],{'transaction':_0xa2206b})['then'](function(){if(!_[_0x99f8('0x98')](_0xba170)){return _0x8e3b1a[_0x99f8('0x99')](_0xba170,{'transaction':_0xa2206b});}})[_0x99f8('0x24')](function(){_0xba170[_0x99f8('0x83')](function(_0x3a6d30){socket['emit']('userChatQueue:remove',{'UserId':_0x3a6d30,'ChatQueueId':_0x8e3b1a['id']});});});});});});})[_0x99f8('0x24')](respondWithStatusCode(_0x146f2b,null))[_0x99f8('0x2c')](handleError(_0x146f2b,null));};exports[_0x99f8('0x9a')]=function(_0x91156,_0x4fa2cd,_0x186c63){return db[_0x99f8('0x42')]['find']({'where':{'id':_0x91156['params']['id']}})['then'](handleEntityNotFound(_0x4fa2cd,null))[_0x99f8('0x24')](function(_0x498848){if(_0x498848){return _0x498848[_0x99f8('0x9a')](_0x91156['body'][_0x99f8('0x79')],_['omit'](_0x91156[_0x99f8('0x69')],[_0x99f8('0x79'),'id'])||{})['spread'](function(_0x4edb8d){for(var _0x4a1332=0x0;_0x4a1332<_0x91156[_0x99f8('0x69')][_0x99f8('0x79')]['length'];_0x4a1332+=0x1){socket[_0x99f8('0x9b')]('userChatQueue:save',{'UserId':Number(_0x91156[_0x99f8('0x69')]['ids'][_0x4a1332]),'ChatQueueId':Number(_0x91156[_0x99f8('0x5e')]['id'])});}return _0x4edb8d;});}})[_0x99f8('0x24')](respondWithResult(_0x4fa2cd,null))['catch'](handleError(_0x4fa2cd,null));};exports[_0x99f8('0x99')]=function(_0x28d742,_0x4a0168,_0x86bd7b){return db[_0x99f8('0x42')][_0x99f8('0x5f')]({'where':{'id':_0x28d742[_0x99f8('0x5e')]['id']}})[_0x99f8('0x24')](handleEntityNotFound(_0x4a0168,null))['then'](function(_0x18a653){if(_0x18a653){return _0x18a653[_0x99f8('0x99')](_0x28d742['query'][_0x99f8('0x79')])[_0x99f8('0x24')](function(){if(_[_0x99f8('0x9c')](_0x28d742[_0x99f8('0x47')]['ids'])){for(var _0x3cdfc6=0x0;_0x3cdfc6<_0x28d742[_0x99f8('0x47')][_0x99f8('0x79')][_0x99f8('0x4c')];_0x3cdfc6+=0x1){socket[_0x99f8('0x9b')](_0x99f8('0x9d'),{'UserId':Number(_0x28d742[_0x99f8('0x47')][_0x99f8('0x79')][_0x3cdfc6]),'ChatQueueId':Number(_0x28d742[_0x99f8('0x5e')]['id'])});}}else{socket['emit'](_0x99f8('0x9d'),{'UserId':Number(_0x28d742[_0x99f8('0x47')][_0x99f8('0x79')]),'ChatQueueId':Number(_0x28d742['params']['id'])});}});}})[_0x99f8('0x24')](respondWithStatusCode(_0x4a0168,null))[_0x99f8('0x2c')](handleError(_0x4a0168,null));};exports['getAgents']=function(_0x1a1545,_0x1ef102,_0x362843){var _0x1e3ecb={};var _0x34e71a={};var _0x5b1a66;var _0x47c535;return db[_0x99f8('0x42')]['findOne']({'where':{'id':_0x1a1545[_0x99f8('0x5e')]['id']}})[_0x99f8('0x24')](handleEntityNotFound(_0x1ef102,null))['then'](function(_0x6e46bb){if(_0x6e46bb){_0x5b1a66=_0x6e46bb;_0x34e71a[_0x99f8('0x46')]=_['keys'](db[_0x99f8('0x7a')][_0x99f8('0x43')]);_0x34e71a[_0x99f8('0x47')]=_[_0x99f8('0x48')](_0x1a1545['query']);_0x34e71a[_0x99f8('0x52')]=_[_0x99f8('0x49')](_0x34e71a['model'],_0x34e71a[_0x99f8('0x47')]);_0x1e3ecb[_0x99f8('0x4b')]=_[_0x99f8('0x49')](_0x34e71a[_0x99f8('0x46')],qs[_0x99f8('0x4a')](_0x1a1545['query'][_0x99f8('0x4a')]));_0x1e3ecb['attributes']=_0x1e3ecb[_0x99f8('0x4b')]['length']?_0x1e3ecb[_0x99f8('0x4b')]:_0x34e71a['model'];_0x1e3ecb[_0x99f8('0x4f')]=qs[_0x99f8('0x50')](_0x1a1545[_0x99f8('0x47')][_0x99f8('0x50')]);_0x1e3ecb[_0x99f8('0x51')]=qs[_0x99f8('0x52')](_[_0x99f8('0x53')](_0x1a1545[_0x99f8('0x47')],_0x34e71a['filters']));if(_0x1a1545['query']['filter']){_0x1e3ecb[_0x99f8('0x51')]=_[_0x99f8('0x55')](_0x1e3ecb[_0x99f8('0x51')],{'$or':_['map'](_0x1e3ecb[_0x99f8('0x4b')],function(_0x3eef27){var _0x2076a5={};_0x2076a5[_0x3eef27]={'$like':'%'+_0x1a1545[_0x99f8('0x47')][_0x99f8('0x54')]+'%'};return _0x2076a5;})});}_0x1e3ecb=_[_0x99f8('0x55')]({},_0x1e3ecb,_0x1a1545[_0x99f8('0x58')]);return _0x5b1a66[_0x99f8('0x9e')](_0x1e3ecb);}})[_0x99f8('0x24')](function(_0x10fd09){if(_0x10fd09){_0x47c535=_0x10fd09[_0x99f8('0x4c')];if(!_0x1a1545[_0x99f8('0x47')][_0x99f8('0x4d')]('nolimit')){_0x1e3ecb['limit']=qs[_0x99f8('0x33')](_0x1a1545[_0x99f8('0x47')][_0x99f8('0x33')]);_0x1e3ecb[_0x99f8('0x30')]=qs[_0x99f8('0x30')](_0x1a1545[_0x99f8('0x47')][_0x99f8('0x30')]);}return _0x5b1a66[_0x99f8('0x9e')](_0x1e3ecb);}})[_0x99f8('0x24')](function(_0x17e37d){if(_0x17e37d){return _0x17e37d?{'count':_0x47c535,'rows':_0x17e37d}:null;}})['then'](respondWithResult(_0x1ef102,null))[_0x99f8('0x2c')](handleError(_0x1ef102,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 335bc21..f90c89f 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 _0x24ab=['exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x972085,_0x326033){var _0x298ece=function(_0x280e7e){while(--_0x280e7e){_0x972085['push'](_0x972085['shift']());}};_0x298ece(++_0x326033);}(_0x24ab,0x1c4));var _0xb24a=function(_0x265908,_0xae1a6f){_0x265908=_0x265908-0x0;var _0x3b4f62=_0x24ab[_0x265908];return _0x3b4f62;};'use strict';var EventEmitter=require(_0xb24a('0x0'));var ChatQueue=require(_0xb24a('0x1'))['db'][_0xb24a('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xb24a('0x3')](0x0);var events={'afterCreate':_0xb24a('0x4'),'afterUpdate':_0xb24a('0x5'),'afterDestroy':_0xb24a('0x6')};function emitEvent(_0x20aca1){return function(_0x494109,_0x1d309e,_0x1b267d){ChatQueueEvents[_0xb24a('0x7')](_0x20aca1+':'+_0x494109['id'],_0x494109);ChatQueueEvents[_0xb24a('0x7')](_0x20aca1,_0x494109);_0x1b267d(null);};}for(var e in events){if(events[_0xb24a('0x8')](e)){var event=events[e];ChatQueue[_0xb24a('0x9')](e,emitEvent(event));}}module[_0xb24a('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0xc434=['../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x327c57,_0x129c09){var _0x322063=function(_0x2cc1c7){while(--_0x2cc1c7){_0x327c57['push'](_0x327c57['shift']());}};_0x322063(++_0x129c09);}(_0xc434,0x17a));var _0x4c43=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xc434[_0x243b59];return _0x3e1676;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x4c43('0x0'))['db'][_0x4c43('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4c43('0x2')](0x0);var events={'afterCreate':_0x4c43('0x3'),'afterUpdate':_0x4c43('0x4'),'afterDestroy':_0x4c43('0x5')};function emitEvent(_0x7d564a){return function(_0x29f080,_0x221fc0,_0x5d7a56){ChatQueueEvents[_0x4c43('0x6')](_0x7d564a+':'+_0x29f080['id'],_0x29f080);ChatQueueEvents[_0x4c43('0x6')](_0x7d564a,_0x29f080);_0x5d7a56(null);};}for(var e in events){if(events[_0x4c43('0x7')](e)){var event=events[e];ChatQueue[_0x4c43('0x8')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 96892e9..c78f73d 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 _0x8ce2=['chat_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue'];(function(_0x556b1d,_0xa0f67e){var _0x346381=function(_0x31a455){while(--_0x31a455){_0x556b1d['push'](_0x556b1d['shift']());}};_0x346381(++_0xa0f67e);}(_0x8ce2,0xc5));var _0x28ce=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x8ce2[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x28ce('0x0'));var util=require(_0x28ce('0x1'));var logger=require('../../config/logger')(_0x28ce('0x2'));var moment=require(_0x28ce('0x3'));var BPromise=require(_0x28ce('0x4'));var rp=require(_0x28ce('0x5'));var fs=require('fs');var path=require(_0x28ce('0x6'));var rimraf=require(_0x28ce('0x7'));var config=require(_0x28ce('0x8'));var attributes=require(_0x28ce('0x9'));module[_0x28ce('0xa')]=function(_0x2b3502,_0x8ab0a1){return _0x2b3502[_0x28ce('0xb')](_0x28ce('0xc'),attributes,{'tableName':_0x28ce('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x797a=['path','rimraf','../../config/environment','./chatQueue.attributes','define','ChatQueue','chat_queues','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x797a,0x10f));var _0xa797=function(_0x55fb4a,_0x84c93b){_0x55fb4a=_0x55fb4a-0x0;var _0x564fd5=_0x797a[_0x55fb4a];return _0x564fd5;};'use strict';var _=require('lodash');var util=require(_0xa797('0x0'));var logger=require(_0xa797('0x1'))('api');var moment=require(_0xa797('0x2'));var BPromise=require(_0xa797('0x3'));var rp=require(_0xa797('0x4'));var fs=require('fs');var path=require(_0xa797('0x5'));var rimraf=require(_0xa797('0x6'));var config=require(_0xa797('0x7'));var attributes=require(_0xa797('0x8'));module['exports']=function(_0x3e935e,_0xffd593){return _0x3e935e[_0xa797('0x9')](_0xa797('0xa'),attributes,{'tableName':_0xa797('0xb'),'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 d7bdc99..320437d 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 _0x215d=['GetChatQueue','ChatQueue','options','raw','where','attributes','include','map','model','stringify','ShowChatQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','catch'];(function(_0x5ee833,_0x255b00){var _0x174173=function(_0x32cc51){while(--_0x32cc51){_0x5ee833['push'](_0x5ee833['shift']());}};_0x174173(++_0x255b00);}(_0x215d,0x187));var _0xd215=function(_0x33b6d7,_0x53231f){_0x33b6d7=_0x33b6d7-0x0;var _0x4c4a7e=_0x215d[_0x33b6d7];return _0x4c4a7e;};'use strict';var _=require(_0xd215('0x0'));var util=require('util');var moment=require(_0xd215('0x1'));var BPromise=require(_0xd215('0x2'));var rs=require(_0xd215('0x3'));var fs=require('fs');var Redis=require(_0xd215('0x4'));var db=require(_0xd215('0x5'))['db'];var utils=require(_0xd215('0x6'));var logger=require('../../config/logger')(_0xd215('0x7'));var config=require('../../config/environment');var jayson=require(_0xd215('0x8'));var client=jayson[_0xd215('0x9')][_0xd215('0xa')]({'port':0x232a});config['redis']=_[_0xd215('0xb')](config['redis'],{'host':_0xd215('0xc'),'port':0x18eb});var socket=require(_0xd215('0xd'))(new Redis(config[_0xd215('0xe')]));require('./chatQueue.socket')[_0xd215('0xf')](socket);function respondWithRpcPromise(_0x4430f6,_0x14ec23,_0x15046b){return new BPromise(function(_0x7da315,_0x573eb6){return client[_0xd215('0x10')](_0x4430f6,_0x15046b)[_0xd215('0x11')](function(_0x286e85){logger['info'](_0xd215('0x12'),_0x14ec23,_0xd215('0x13'));logger[_0xd215('0x14')](_0xd215('0x15'),_0x14ec23,_0xd215('0x13'),JSON['stringify'](_0x286e85));if(_0x286e85[_0xd215('0x16')]){if(_0x286e85[_0xd215('0x16')][_0xd215('0x17')]===0x1f4){logger[_0xd215('0x16')](_0xd215('0x12'),_0x14ec23,_0x286e85[_0xd215('0x16')][_0xd215('0x18')]);return _0x573eb6(_0x286e85[_0xd215('0x16')]['message']);}logger[_0xd215('0x16')](_0xd215('0x12'),_0x14ec23,_0x286e85[_0xd215('0x16')][_0xd215('0x18')]);return _0x7da315(_0x286e85[_0xd215('0x16')][_0xd215('0x18')]);}else{logger[_0xd215('0x19')](_0xd215('0x12'),_0x14ec23,_0xd215('0x13'));_0x7da315(_0x286e85['result'][_0xd215('0x18')]);}})[_0xd215('0x1a')](function(_0x33a6f7){logger[_0xd215('0x16')](_0xd215('0x12'),_0x14ec23,_0x33a6f7);_0x573eb6(_0x33a6f7);});});}exports[_0xd215('0x1b')]=function(_0x1de474){var _0x53ccec=this;return new Promise(function(_0xe7cbc8,_0x1d3afa){return db[_0xd215('0x1c')]['findAll']({'raw':_0x1de474[_0xd215('0x1d')]?_0x1de474[_0xd215('0x1d')][_0xd215('0x1e')]===undefined?!![]:![]:!![],'where':_0x1de474[_0xd215('0x1d')]?_0x1de474['options'][_0xd215('0x1f')]||null:null,'attributes':_0x1de474[_0xd215('0x1d')]?_0x1de474[_0xd215('0x1d')][_0xd215('0x20')]||null:null,'limit':_0x1de474['options']?_0x1de474['options']['limit']||null:null,'include':_0x1de474[_0xd215('0x1d')]?_0x1de474[_0xd215('0x1d')][_0xd215('0x21')]?_[_0xd215('0x22')](_0x1de474['options'][_0xd215('0x21')],function(_0x4ddbdf){return{'model':db[_0x4ddbdf['model']],'as':_0x4ddbdf['as'],'attributes':_0x4ddbdf[_0xd215('0x20')],'include':_0x4ddbdf[_0xd215('0x21')]?_[_0xd215('0x22')](_0x4ddbdf[_0xd215('0x21')],function(_0x638b93){return{'model':db[_0x638b93[_0xd215('0x23')]],'as':_0x638b93['as'],'attributes':_0x638b93['attributes'],'include':_0x638b93[_0xd215('0x21')]?_[_0xd215('0x22')](_0x638b93[_0xd215('0x21')],function(_0x3ca288){return{'model':db[_0x3ca288[_0xd215('0x23')]],'as':_0x3ca288['as'],'attributes':_0x3ca288[_0xd215('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd215('0x11')](function(_0x25d6e9){logger[_0xd215('0x19')](_0xd215('0x1b'),_0x1de474);logger[_0xd215('0x14')](_0xd215('0x1b'),_0x1de474,JSON[_0xd215('0x24')](_0x25d6e9));_0xe7cbc8(_0x25d6e9);})['catch'](function(_0x507e44){logger[_0xd215('0x16')]('GetChatQueue',_0x507e44[_0xd215('0x18')],_0x1de474);_0x1d3afa(_0x53ccec['error'](0x1f4,_0x507e44[_0xd215('0x18')]));});});};exports[_0xd215('0x25')]=function(_0x32bc25){var _0x357fdb=this;return new Promise(function(_0x5c2cc9,_0x4c8e9b){return db[_0xd215('0x1c')]['find']({'raw':_0x32bc25[_0xd215('0x1d')]?_0x32bc25[_0xd215('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x32bc25[_0xd215('0x1d')]?_0x32bc25[_0xd215('0x1d')]['where']||null:null,'attributes':_0x32bc25['options']?_0x32bc25['options'][_0xd215('0x20')]||null:null,'include':_0x32bc25[_0xd215('0x1d')]?_0x32bc25[_0xd215('0x1d')][_0xd215('0x21')]?_[_0xd215('0x22')](_0x32bc25[_0xd215('0x1d')][_0xd215('0x21')],function(_0x17580f){return{'model':db[_0x17580f[_0xd215('0x23')]],'as':_0x17580f['as'],'attributes':_0x17580f[_0xd215('0x20')],'include':_0x17580f[_0xd215('0x21')]?_[_0xd215('0x22')](_0x17580f[_0xd215('0x21')],function(_0x3d11d8){return{'model':db[_0x3d11d8[_0xd215('0x23')]],'as':_0x3d11d8['as'],'attributes':_0x3d11d8[_0xd215('0x20')],'include':_0x3d11d8['include']?_['map'](_0x3d11d8[_0xd215('0x21')],function(_0x1477e7){return{'model':db[_0x1477e7[_0xd215('0x23')]],'as':_0x1477e7['as'],'attributes':_0x1477e7[_0xd215('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f9f5f){logger[_0xd215('0x19')](_0xd215('0x25'),_0x32bc25);logger[_0xd215('0x14')](_0xd215('0x25'),_0x32bc25,JSON[_0xd215('0x24')](_0x1f9f5f));_0x5c2cc9(_0x1f9f5f);})['catch'](function(_0xf0aa4f){logger['error'](_0xd215('0x25'),_0xf0aa4f[_0xd215('0x18')],_0x32bc25);_0x4c8e9b(_0x357fdb[_0xd215('0x16')](0x1f4,_0xf0aa4f[_0xd215('0x18')]));});});}; \ No newline at end of file +var _0xa5fa=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetChatQueue','ChatQueue','findAll','options','raw','include','map','model','attributes','catch','ShowChatQueue','find','where','util','moment','bluebird','randomstring'];(function(_0x4dc38c,_0x23daf9){var _0x3d939a=function(_0x348f0f){while(--_0x348f0f){_0x4dc38c['push'](_0x4dc38c['shift']());}};_0x3d939a(++_0x23daf9);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x53a9cb,_0x1d7a73){_0x53a9cb=_0x53a9cb-0x0;var _0x4fc163=_0xa5fa[_0x53a9cb];return _0x4fc163;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var rs=require(_0xaa5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa5f('0x4'))['db'];var utils=require(_0xaa5f('0x5'));var logger=require('../../config/logger')(_0xaa5f('0x6'));var config=require(_0xaa5f('0x7'));var jayson=require(_0xaa5f('0x8'));var client=jayson[_0xaa5f('0x9')][_0xaa5f('0xa')]({'port':0x232a});config[_0xaa5f('0xb')]=_[_0xaa5f('0xc')](config[_0xaa5f('0xb')],{'host':_0xaa5f('0xd'),'port':0x18eb});var socket=require(_0xaa5f('0xe'))(new Redis(config[_0xaa5f('0xb')]));require('./chatQueue.socket')[_0xaa5f('0xf')](socket);function respondWithRpcPromise(_0x227ebb,_0x4d3d16,_0x538865){return new BPromise(function(_0x3fa93f,_0x4bb69d){return client['request'](_0x227ebb,_0x538865)[_0xaa5f('0x10')](function(_0x4d24d2){logger[_0xaa5f('0x11')](_0xaa5f('0x12'),_0x4d3d16,_0xaa5f('0x13'));logger[_0xaa5f('0x14')](_0xaa5f('0x15'),_0x4d3d16,'request\x20sent',JSON[_0xaa5f('0x16')](_0x4d24d2));if(_0x4d24d2['error']){if(_0x4d24d2[_0xaa5f('0x17')][_0xaa5f('0x18')]===0x1f4){logger[_0xaa5f('0x17')](_0xaa5f('0x12'),_0x4d3d16,_0x4d24d2[_0xaa5f('0x17')]['message']);return _0x4bb69d(_0x4d24d2['error'][_0xaa5f('0x19')]);}logger[_0xaa5f('0x17')](_0xaa5f('0x12'),_0x4d3d16,_0x4d24d2[_0xaa5f('0x17')][_0xaa5f('0x19')]);return _0x3fa93f(_0x4d24d2[_0xaa5f('0x17')][_0xaa5f('0x19')]);}else{logger[_0xaa5f('0x11')](_0xaa5f('0x12'),_0x4d3d16,_0xaa5f('0x13'));_0x3fa93f(_0x4d24d2[_0xaa5f('0x1a')][_0xaa5f('0x19')]);}})['catch'](function(_0x1c072){logger[_0xaa5f('0x17')](_0xaa5f('0x12'),_0x4d3d16,_0x1c072);_0x4bb69d(_0x1c072);});});}exports[_0xaa5f('0x1b')]=function(_0xc07d99){var _0xc57fd5=this;return new Promise(function(_0x21cd23,_0x194691){return db[_0xaa5f('0x1c')][_0xaa5f('0x1d')]({'raw':_0xc07d99[_0xaa5f('0x1e')]?_0xc07d99[_0xaa5f('0x1e')][_0xaa5f('0x1f')]===undefined?!![]:![]:!![],'where':_0xc07d99['options']?_0xc07d99[_0xaa5f('0x1e')]['where']||null:null,'attributes':_0xc07d99[_0xaa5f('0x1e')]?_0xc07d99[_0xaa5f('0x1e')]['attributes']||null:null,'limit':_0xc07d99[_0xaa5f('0x1e')]?_0xc07d99[_0xaa5f('0x1e')]['limit']||null:null,'include':_0xc07d99[_0xaa5f('0x1e')]?_0xc07d99[_0xaa5f('0x1e')][_0xaa5f('0x20')]?_[_0xaa5f('0x21')](_0xc07d99[_0xaa5f('0x1e')][_0xaa5f('0x20')],function(_0x3d7bca){return{'model':db[_0x3d7bca[_0xaa5f('0x22')]],'as':_0x3d7bca['as'],'attributes':_0x3d7bca['attributes'],'include':_0x3d7bca[_0xaa5f('0x20')]?_[_0xaa5f('0x21')](_0x3d7bca[_0xaa5f('0x20')],function(_0x5a7cf1){return{'model':db[_0x5a7cf1[_0xaa5f('0x22')]],'as':_0x5a7cf1['as'],'attributes':_0x5a7cf1[_0xaa5f('0x23')],'include':_0x5a7cf1[_0xaa5f('0x20')]?_['map'](_0x5a7cf1[_0xaa5f('0x20')],function(_0x479f29){return{'model':db[_0x479f29['model']],'as':_0x479f29['as'],'attributes':_0x479f29[_0xaa5f('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bffec){logger['info']('GetChatQueue',_0xc07d99);logger['debug'](_0xaa5f('0x1b'),_0xc07d99,JSON['stringify'](_0x1bffec));_0x21cd23(_0x1bffec);})[_0xaa5f('0x24')](function(_0xc0bb03){logger['error']('GetChatQueue',_0xc0bb03[_0xaa5f('0x19')],_0xc07d99);_0x194691(_0xc57fd5['error'](0x1f4,_0xc0bb03[_0xaa5f('0x19')]));});});};exports[_0xaa5f('0x25')]=function(_0x52132c){var _0xda1742=this;return new Promise(function(_0x1610b8,_0x9c733b){return db['ChatQueue'][_0xaa5f('0x26')]({'raw':_0x52132c[_0xaa5f('0x1e')]?_0x52132c['options']['raw']===undefined?!![]:![]:!![],'where':_0x52132c['options']?_0x52132c['options'][_0xaa5f('0x27')]||null:null,'attributes':_0x52132c[_0xaa5f('0x1e')]?_0x52132c[_0xaa5f('0x1e')][_0xaa5f('0x23')]||null:null,'include':_0x52132c[_0xaa5f('0x1e')]?_0x52132c[_0xaa5f('0x1e')][_0xaa5f('0x20')]?_['map'](_0x52132c[_0xaa5f('0x1e')][_0xaa5f('0x20')],function(_0x440845){return{'model':db[_0x440845[_0xaa5f('0x22')]],'as':_0x440845['as'],'attributes':_0x440845[_0xaa5f('0x23')],'include':_0x440845[_0xaa5f('0x20')]?_['map'](_0x440845[_0xaa5f('0x20')],function(_0x3131c2){return{'model':db[_0x3131c2[_0xaa5f('0x22')]],'as':_0x3131c2['as'],'attributes':_0x3131c2[_0xaa5f('0x23')],'include':_0x3131c2[_0xaa5f('0x20')]?_['map'](_0x3131c2['include'],function(_0x43126e){return{'model':db[_0x43126e[_0xaa5f('0x22')]],'as':_0x43126e['as'],'attributes':_0x43126e[_0xaa5f('0x23')]};}):[]};}):[]};}):[]:[]})[_0xaa5f('0x10')](function(_0x56826c){logger[_0xaa5f('0x11')](_0xaa5f('0x25'),_0x52132c);logger[_0xaa5f('0x14')](_0xaa5f('0x25'),_0x52132c,JSON[_0xaa5f('0x16')](_0x56826c));_0x1610b8(_0x56826c);})[_0xaa5f('0x24')](function(_0xc4735b){logger[_0xaa5f('0x17')](_0xaa5f('0x25'),_0xc4735b[_0xaa5f('0x19')],_0x52132c);_0x9c733b(_0xda1742[_0xaa5f('0x17')](0x1f4,_0xc4735b['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index bcc80a2..72b3b05 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 _0x5c12=['removeListener','chatQueue:','save','remove','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5c12,0x188));var _0x25c1=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0x5c12[_0x487496];return _0x539dc8;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x25c1('0x0'),_0x25c1('0x1'),'update'];function createListener(_0x44bc2e,_0x1991e5){return function(_0x4042fe){_0x1991e5[_0x25c1('0x2')](_0x44bc2e,_0x4042fe);};}function removeListener(_0x2c5df0,_0x21ec20){return function(){ChatQueueEvents[_0x25c1('0x3')](_0x2c5df0,_0x21ec20);};}exports['register']=function(_0x204287){for(var _0x42ac16=0x0,_0x382922=events['length'];_0x42ac16<_0x382922;_0x42ac16++){var _0x5c69b1=events[_0x42ac16];var _0x24981c=createListener(_0x25c1('0x4')+_0x5c69b1,_0x204287);ChatQueueEvents['on'](_0x5c69b1,_0x24981c);}}; \ No newline at end of file +var _0x5089=['length','chatQueue:','./chatQueue.events','save','update','emit','register'];(function(_0x4edde2,_0x59b3fe){var _0x544bde=function(_0x2abef1){while(--_0x2abef1){_0x4edde2['push'](_0x4edde2['shift']());}};_0x544bde(++_0x59b3fe);}(_0x5089,0x1bb));var _0x9508=function(_0xbf1875,_0x34b144){_0xbf1875=_0xbf1875-0x0;var _0x2e598b=_0x5089[_0xbf1875];return _0x2e598b;};'use strict';var ChatQueueEvents=require(_0x9508('0x0'));var events=[_0x9508('0x1'),'remove',_0x9508('0x2')];function createListener(_0x35878a,_0x7dd13d){return function(_0x100d7e){_0x7dd13d[_0x9508('0x3')](_0x35878a,_0x100d7e);};}function removeListener(_0x59d3ee,_0x86540d){return function(){ChatQueueEvents['removeListener'](_0x59d3ee,_0x86540d);};}exports[_0x9508('0x4')]=function(_0x4538dd){for(var _0x257318=0x0,_0x4ab3c6=events[_0x9508('0x5')];_0x257318<_0x4ab3c6;_0x257318++){var _0x42d13a=events[_0x257318];var _0x55a5de=createListener(_0x9508('0x6')+_0x42d13a,_0x4538dd);ChatQueueEvents['on'](_0x42d13a,_0x55a5de);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 71b0650..0215a8c 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3b594b,_0x5835c3){_0x3b594b=_0x3b594b-0x0;var _0x1ea5f8=_0x5fc3[_0x3b594b];return _0x1ea5f8;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file +var _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x1e4b24,_0x376c4d){var _0x14534f=function(_0x124698){while(--_0x124698){_0x1e4b24['push'](_0x1e4b24['shift']());}};_0x14534f(++_0x376c4d);}(_0x814b,0x1a2));var _0xb814=function(_0x5bd626,_0xdbf46d){_0x5bd626=_0x5bd626-0x0;var _0x2661ca=_0x814b[_0x5bd626];return _0x2661ca;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 0612de8..062a22b 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 _0x12cb=['moment','sequelize','exports','STRING','DATE'];(function(_0x2af2fc,_0x662ce2){var _0x44fdce=function(_0x2fad36){while(--_0x2fad36){_0x2af2fc['push'](_0x2af2fc['shift']());}};_0x44fdce(++_0x662ce2);}(_0x12cb,0xb9));var _0xb12c=function(_0x10b18a,_0x402766){_0x10b18a=_0x10b18a-0x0;var _0x4bf282=_0x12cb[_0x10b18a];return _0x4bf282;};'use strict';var moment=require(_0xb12c('0x0'));var Sequelize=require(_0xb12c('0x1'));module[_0xb12c('0x2')]={'uniqueid':{'type':Sequelize[_0xb12c('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xb12c('0x3')]},'joinAt':{'type':Sequelize[_0xb12c('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb12c('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xb12c('0x3')]}}; \ No newline at end of file +var _0x4082=['moment','sequelize','exports','STRING','DATE'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0x4082,0x118));var _0x2408=function(_0x5c4f6b,_0x2cdfce){_0x5c4f6b=_0x5c4f6b-0x0;var _0x104c4e=_0x4082[_0x5c4f6b];return _0x104c4e;};'use strict';var moment=require(_0x2408('0x0'));var Sequelize=require(_0x2408('0x1'));module[_0x2408('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x2408('0x3')]},'joinAt':{'type':Sequelize[_0x2408('0x4')]},'leaveAt':{'type':Sequelize[_0x2408('0x4')]},'acceptAt':{'type':Sequelize[_0x2408('0x4')]},'exitAt':{'type':Sequelize[_0x2408('0x4')]},'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 39d7a80..c8f25b3 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 _0x8110=['name','send','index','map','ChatQueueReport','rawAttributes','fieldName','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','update','find','describe','rimraf','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x8110,0x185));var _0x0811=function(_0x3abe2a,_0x2c6922){_0x3abe2a=_0x3abe2a-0x0;var _0xe1d715=_0x8110[_0x3abe2a];return _0xe1d715;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0811('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0811('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x0811('0x2'));var util=require(_0x0811('0x3'));var path=require(_0x0811('0x4'));var sox=require(_0x0811('0x5'));var csv=require(_0x0811('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0811('0x7'));var _=require('lodash');var squel=require(_0x0811('0x8'));var crypto=require(_0x0811('0x9'));var jsforce=require(_0x0811('0xa'));var deskjs=require(_0x0811('0xb'));var toCsv=require(_0x0811('0x6'));var querystring=require(_0x0811('0xc'));var Papa=require(_0x0811('0xd'));var Redis=require(_0x0811('0xe'));var authService=require(_0x0811('0xf'));var qs=require(_0x0811('0x10'));var as=require(_0x0811('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0811('0x12'));var utils=require(_0x0811('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0811('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x220ec1,_0x20e525){_0x20e525=_0x20e525||0xcc;return function(_0x3e6050){if(_0x3e6050){return _0x220ec1[_0x0811('0x15')](_0x20e525);}return _0x220ec1[_0x0811('0x16')](_0x20e525)['end']();};}function respondWithResult(_0x535d3e,_0x203cca){_0x203cca=_0x203cca||0xc8;return function(_0x553502){if(_0x553502){return _0x535d3e['status'](_0x203cca)[_0x0811('0x17')](_0x553502);}};}function respondWithFilteredResult(_0x4ca03c,_0x4c0add){return function(_0x5c5e84){if(_0x5c5e84){var _0x3c06ec=typeof _0x4c0add[_0x0811('0x18')]===_0x0811('0x19')&&typeof _0x4c0add[_0x0811('0x1a')]===_0x0811('0x19');var _0x5baffe=_0x5c5e84[_0x0811('0x1b')];var _0x3c1856=_0x3c06ec?0x0:_0x4c0add[_0x0811('0x18')];var _0x1367c7=_0x3c06ec?_0x5c5e84['count']:_0x4c0add['offset']+_0x4c0add[_0x0811('0x1a')];var _0x414c49;if(_0x1367c7>=_0x5baffe){_0x1367c7=_0x5baffe;_0x414c49=0xc8;}else{_0x414c49=0xce;}_0x4ca03c['status'](_0x414c49);return _0x4ca03c[_0x0811('0x1c')](_0x0811('0x1d'),_0x3c1856+'-'+_0x1367c7+'/'+_0x5baffe)[_0x0811('0x17')](_0x5c5e84);}return null;};}function patchUpdates(_0x2b9aa3){return function(_0x47dd14){try{jsonpatch[_0x0811('0x1e')](_0x47dd14,_0x2b9aa3,!![]);}catch(_0x43102f){return BPromise[_0x0811('0x1f')](_0x43102f);}return _0x47dd14[_0x0811('0x20')]();};}function saveUpdates(_0x24bec4,_0x43c1a4){return function(_0x19e222){if(_0x19e222){return _0x19e222['update'](_0x24bec4)[_0x0811('0x21')](function(_0x3e5c14){return _0x3e5c14;});}return null;};}function removeEntity(_0x4e7e96,_0xc4b95c){return function(_0x46303e){if(_0x46303e){return _0x46303e[_0x0811('0x22')]()[_0x0811('0x21')](function(){_0x4e7e96['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6d74ac,_0x5cce2e){return function(_0x3fe842){if(!_0x3fe842){_0x6d74ac['sendStatus'](0x194);}return _0x3fe842;};}function handleError(_0x33844b,_0x2957da){_0x2957da=_0x2957da||0x1f4;return function(_0x45170e){logger[_0x0811('0x23')](_0x45170e[_0x0811('0x24')]);if(_0x45170e[_0x0811('0x25')]){delete _0x45170e[_0x0811('0x25')];}_0x33844b['status'](_0x2957da)[_0x0811('0x26')](_0x45170e);};}exports[_0x0811('0x27')]=function(_0x3a190c,_0x1f9f1e){var _0x39af29={},_0x36c96a={},_0x58ef46={'count':0x0,'rows':[]};var _0x59c623=_[_0x0811('0x28')](db[_0x0811('0x29')][_0x0811('0x2a')],function(_0x5a9e10){return{'name':_0x5a9e10[_0x0811('0x2b')],'type':_0x5a9e10['type']['key']};});_0x36c96a['model']=_[_0x0811('0x28')](_0x59c623,_0x0811('0x25'));_0x36c96a['query']=_['keys'](_0x3a190c[_0x0811('0x2c')]);_0x36c96a['filters']=_[_0x0811('0x2d')](_0x36c96a[_0x0811('0x2e')],_0x36c96a['query']);_0x39af29[_0x0811('0x2f')]=_[_0x0811('0x2d')](_0x36c96a[_0x0811('0x2e')],qs['fields'](_0x3a190c[_0x0811('0x2c')][_0x0811('0x30')]));_0x39af29[_0x0811('0x2f')]=_0x39af29[_0x0811('0x2f')][_0x0811('0x31')]?_0x39af29[_0x0811('0x2f')]:_0x36c96a[_0x0811('0x2e')];if(!_0x3a190c[_0x0811('0x2c')][_0x0811('0x32')]('nolimit')){_0x39af29[_0x0811('0x1a')]=qs[_0x0811('0x1a')](_0x3a190c[_0x0811('0x2c')]['limit']);_0x39af29['offset']=qs[_0x0811('0x18')](_0x3a190c[_0x0811('0x2c')][_0x0811('0x18')]);}_0x39af29[_0x0811('0x33')]=qs[_0x0811('0x34')](_0x3a190c[_0x0811('0x2c')][_0x0811('0x34')]);_0x39af29[_0x0811('0x35')]=qs[_0x0811('0x36')](_[_0x0811('0x37')](_0x3a190c[_0x0811('0x2c')],_0x36c96a['filters']),_0x59c623);if(_0x3a190c[_0x0811('0x2c')]['filter']){_0x39af29[_0x0811('0x35')]=_[_0x0811('0x38')](_0x39af29[_0x0811('0x35')],{'$or':_['map'](_0x59c623,function(_0x2c50f6){if(_0x2c50f6[_0x0811('0x39')]!==_0x0811('0x3a')){var _0x3b155b={};_0x3b155b[_0x2c50f6[_0x0811('0x25')]]={'$like':'%'+_0x3a190c[_0x0811('0x2c')]['filter']+'%'};return _0x3b155b;}})});}_0x39af29=_['merge']({},_0x39af29,_0x3a190c[_0x0811('0x3b')]);var _0x17062b={'where':_0x39af29[_0x0811('0x35')]};return db[_0x0811('0x29')][_0x0811('0x1b')](_0x17062b)[_0x0811('0x21')](function(_0x220c8a){_0x58ef46[_0x0811('0x1b')]=_0x220c8a;if(_0x3a190c[_0x0811('0x2c')][_0x0811('0x3c')]){_0x39af29[_0x0811('0x3d')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x0811('0x3e')](_0x39af29);})['then'](function(_0x1ea7c5){_0x58ef46[_0x0811('0x3f')]=_0x1ea7c5;return _0x58ef46;})[_0x0811('0x21')](respondWithFilteredResult(_0x1f9f1e,_0x39af29))[_0x0811('0x40')](handleError(_0x1f9f1e,null));};exports['show']=function(_0x232757,_0x1b7954){var _0x20d34a={'raw':!![],'where':{'id':_0x232757[_0x0811('0x41')]['id']}},_0xccdd8b={};_0xccdd8b['model']=_['keys'](db['ChatQueueReport']['rawAttributes']);_0xccdd8b[_0x0811('0x2c')]=_['keys'](_0x232757['query']);_0xccdd8b['filters']=_[_0x0811('0x2d')](_0xccdd8b['model'],_0xccdd8b[_0x0811('0x2c')]);_0x20d34a['attributes']=_[_0x0811('0x2d')](_0xccdd8b[_0x0811('0x2e')],qs[_0x0811('0x30')](_0x232757[_0x0811('0x2c')][_0x0811('0x30')]));_0x20d34a['attributes']=_0x20d34a[_0x0811('0x2f')][_0x0811('0x31')]?_0x20d34a[_0x0811('0x2f')]:_0xccdd8b[_0x0811('0x2e')];if(_0x232757[_0x0811('0x2c')]['includeAll']){_0x20d34a[_0x0811('0x3d')]=[{'all':!![]}];}_0x20d34a=_[_0x0811('0x38')]({},_0x20d34a,_0x232757[_0x0811('0x3b')]);return db['ChatQueueReport']['find'](_0x20d34a)[_0x0811('0x21')](handleEntityNotFound(_0x1b7954,null))[_0x0811('0x21')](respondWithResult(_0x1b7954,null))[_0x0811('0x40')](handleError(_0x1b7954,null));};exports['create']=function(_0x4701c7,_0x39be7d){return db[_0x0811('0x29')][_0x0811('0x42')](_0x4701c7[_0x0811('0x43')],{})[_0x0811('0x21')](respondWithResult(_0x39be7d,0xc9))['catch'](handleError(_0x39be7d,null));};exports[_0x0811('0x44')]=function(_0x2b578c,_0x54c088){if(_0x2b578c['body']['id']){delete _0x2b578c[_0x0811('0x43')]['id'];}return db['ChatQueueReport'][_0x0811('0x45')]({'where':{'id':_0x2b578c[_0x0811('0x41')]['id']}})['then'](handleEntityNotFound(_0x54c088,null))['then'](saveUpdates(_0x2b578c[_0x0811('0x43')],null))['then'](respondWithResult(_0x54c088,null))[_0x0811('0x40')](handleError(_0x54c088,null));};exports[_0x0811('0x22')]=function(_0x52d23a,_0x39fad3){return db[_0x0811('0x29')][_0x0811('0x45')]({'where':{'id':_0x52d23a[_0x0811('0x41')]['id']}})[_0x0811('0x21')](handleEntityNotFound(_0x39fad3,null))['then'](removeEntity(_0x39fad3,null))[_0x0811('0x40')](handleError(_0x39fad3,null));};exports[_0x0811('0x46')]=function(_0x26d6b1,_0x5b0e18){return db[_0x0811('0x29')][_0x0811('0x46')]()[_0x0811('0x21')](respondWithResult(_0x5b0e18,null))[_0x0811('0x40')](handleError(_0x5b0e18,null));}; \ No newline at end of file +var _0xf470=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','sendStatus','stack','name','send','index','ChatQueueReport','rawAttributes','fieldName','type','model','map','keys','query'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0xf470,0xfd));var _0x0f47=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xf470[_0x231e16];return _0x570a7c;};'use strict';var emlformat=require(_0x0f47('0x0'));var rimraf=require(_0x0f47('0x1'));var zipdir=require(_0x0f47('0x2'));var jsonpatch=require(_0x0f47('0x3'));var rp=require(_0x0f47('0x4'));var moment=require(_0x0f47('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0f47('0x6'));var util=require(_0x0f47('0x7'));var path=require('path');var sox=require(_0x0f47('0x8'));var csv=require(_0x0f47('0x9'));var ejs=require(_0x0f47('0xa'));var fs=require('fs');var fs_extra=require(_0x0f47('0xb'));var _=require(_0x0f47('0xc'));var squel=require(_0x0f47('0xd'));var crypto=require(_0x0f47('0xe'));var jsforce=require(_0x0f47('0xf'));var deskjs=require(_0x0f47('0x10'));var toCsv=require(_0x0f47('0x9'));var querystring=require(_0x0f47('0x11'));var Papa=require(_0x0f47('0x12'));var Redis=require(_0x0f47('0x13'));var authService=require(_0x0f47('0x14'));var qs=require(_0x0f47('0x15'));var as=require(_0x0f47('0x16'));var hardwareService=require(_0x0f47('0x17'));var logger=require(_0x0f47('0x18'))(_0x0f47('0x19'));var utils=require('../../config/utils');var config=require(_0x0f47('0x1a'));var licenseUtil=require(_0x0f47('0x1b'));var db=require(_0x0f47('0x1c'))['db'];function respondWithStatusCode(_0x26095f,_0x128b8c){_0x128b8c=_0x128b8c||0xcc;return function(_0x4ce7e6){if(_0x4ce7e6){return _0x26095f['sendStatus'](_0x128b8c);}return _0x26095f[_0x0f47('0x1d')](_0x128b8c)[_0x0f47('0x1e')]();};}function respondWithResult(_0x42ace5,_0x327f2f){_0x327f2f=_0x327f2f||0xc8;return function(_0x7579d1){if(_0x7579d1){return _0x42ace5['status'](_0x327f2f)[_0x0f47('0x1f')](_0x7579d1);}};}function respondWithFilteredResult(_0x553f66,_0x4e5c11){return function(_0x1e08f6){if(_0x1e08f6){var _0x2c2ba8=typeof _0x4e5c11[_0x0f47('0x20')]===_0x0f47('0x21')&&typeof _0x4e5c11[_0x0f47('0x22')]===_0x0f47('0x21');var _0x25e2e9=_0x1e08f6['count'];var _0x1d8fe5=_0x2c2ba8?0x0:_0x4e5c11[_0x0f47('0x20')];var _0x524868=_0x2c2ba8?_0x1e08f6[_0x0f47('0x23')]:_0x4e5c11[_0x0f47('0x20')]+_0x4e5c11[_0x0f47('0x22')];var _0x87f9da;if(_0x524868>=_0x25e2e9){_0x524868=_0x25e2e9;_0x87f9da=0xc8;}else{_0x87f9da=0xce;}_0x553f66[_0x0f47('0x1d')](_0x87f9da);return _0x553f66[_0x0f47('0x24')](_0x0f47('0x25'),_0x1d8fe5+'-'+_0x524868+'/'+_0x25e2e9)[_0x0f47('0x1f')](_0x1e08f6);}return null;};}function patchUpdates(_0xb34491){return function(_0x40fff8){try{jsonpatch[_0x0f47('0x26')](_0x40fff8,_0xb34491,!![]);}catch(_0x55a0ef){return BPromise['reject'](_0x55a0ef);}return _0x40fff8['save']();};}function saveUpdates(_0x1fe6ea,_0x5a0c8c){return function(_0x5f1830){if(_0x5f1830){return _0x5f1830[_0x0f47('0x27')](_0x1fe6ea)[_0x0f47('0x28')](function(_0x456611){return _0x456611;});}return null;};}function removeEntity(_0x19a68c,_0x28edc5){return function(_0x46c30f){if(_0x46c30f){return _0x46c30f[_0x0f47('0x29')]()['then'](function(){_0x19a68c['status'](0xcc)[_0x0f47('0x1e')]();});}};}function handleEntityNotFound(_0x48c86,_0x3c0ae0){return function(_0x49f2ff){if(!_0x49f2ff){_0x48c86[_0x0f47('0x2a')](0x194);}return _0x49f2ff;};}function handleError(_0x41a31e,_0x3e1fb0){_0x3e1fb0=_0x3e1fb0||0x1f4;return function(_0x17c7cf){logger['error'](_0x17c7cf[_0x0f47('0x2b')]);if(_0x17c7cf[_0x0f47('0x2c')]){delete _0x17c7cf[_0x0f47('0x2c')];}_0x41a31e[_0x0f47('0x1d')](_0x3e1fb0)[_0x0f47('0x2d')](_0x17c7cf);};}exports[_0x0f47('0x2e')]=function(_0x1142cd,_0xd47c98){var _0x2b902e={},_0x2648f1={},_0x8e5d1f={'count':0x0,'rows':[]};var _0x3a3687=_['map'](db[_0x0f47('0x2f')][_0x0f47('0x30')],function(_0xd503e4){return{'name':_0xd503e4[_0x0f47('0x31')],'type':_0xd503e4[_0x0f47('0x32')]['key']};});_0x2648f1[_0x0f47('0x33')]=_[_0x0f47('0x34')](_0x3a3687,_0x0f47('0x2c'));_0x2648f1['query']=_[_0x0f47('0x35')](_0x1142cd[_0x0f47('0x36')]);_0x2648f1[_0x0f47('0x37')]=_[_0x0f47('0x38')](_0x2648f1[_0x0f47('0x33')],_0x2648f1[_0x0f47('0x36')]);_0x2b902e['attributes']=_['intersection'](_0x2648f1['model'],qs[_0x0f47('0x39')](_0x1142cd['query'][_0x0f47('0x39')]));_0x2b902e['attributes']=_0x2b902e[_0x0f47('0x3a')][_0x0f47('0x3b')]?_0x2b902e[_0x0f47('0x3a')]:_0x2648f1[_0x0f47('0x33')];if(!_0x1142cd['query'][_0x0f47('0x3c')](_0x0f47('0x3d'))){_0x2b902e[_0x0f47('0x22')]=qs[_0x0f47('0x22')](_0x1142cd[_0x0f47('0x36')]['limit']);_0x2b902e[_0x0f47('0x20')]=qs[_0x0f47('0x20')](_0x1142cd[_0x0f47('0x36')][_0x0f47('0x20')]);}_0x2b902e[_0x0f47('0x3e')]=qs['sort'](_0x1142cd['query']['sort']);_0x2b902e[_0x0f47('0x3f')]=qs[_0x0f47('0x37')](_[_0x0f47('0x40')](_0x1142cd['query'],_0x2648f1[_0x0f47('0x37')]),_0x3a3687);if(_0x1142cd[_0x0f47('0x36')]['filter']){_0x2b902e['where']=_['merge'](_0x2b902e[_0x0f47('0x3f')],{'$or':_['map'](_0x3a3687,function(_0x1a812b){if(_0x1a812b[_0x0f47('0x32')]!=='VIRTUAL'){var _0x477c59={};_0x477c59[_0x1a812b[_0x0f47('0x2c')]]={'$like':'%'+_0x1142cd[_0x0f47('0x36')][_0x0f47('0x41')]+'%'};return _0x477c59;}})});}_0x2b902e=_[_0x0f47('0x42')]({},_0x2b902e,_0x1142cd[_0x0f47('0x43')]);var _0x331c8c={'where':_0x2b902e[_0x0f47('0x3f')]};return db['ChatQueueReport'][_0x0f47('0x23')](_0x331c8c)[_0x0f47('0x28')](function(_0x30bcdc){_0x8e5d1f[_0x0f47('0x23')]=_0x30bcdc;if(_0x1142cd[_0x0f47('0x36')][_0x0f47('0x44')]){_0x2b902e['include']=[{'all':!![]}];}return db[_0x0f47('0x2f')]['findAll'](_0x2b902e);})[_0x0f47('0x28')](function(_0x1753be){_0x8e5d1f['rows']=_0x1753be;return _0x8e5d1f;})[_0x0f47('0x28')](respondWithFilteredResult(_0xd47c98,_0x2b902e))[_0x0f47('0x45')](handleError(_0xd47c98,null));};exports[_0x0f47('0x46')]=function(_0x2d6c86,_0x46f86b){var _0x48dfee={'raw':!![],'where':{'id':_0x2d6c86[_0x0f47('0x47')]['id']}},_0x4a2305={};_0x4a2305[_0x0f47('0x33')]=_[_0x0f47('0x35')](db[_0x0f47('0x2f')][_0x0f47('0x30')]);_0x4a2305[_0x0f47('0x36')]=_[_0x0f47('0x35')](_0x2d6c86['query']);_0x4a2305['filters']=_[_0x0f47('0x38')](_0x4a2305[_0x0f47('0x33')],_0x4a2305[_0x0f47('0x36')]);_0x48dfee['attributes']=_[_0x0f47('0x38')](_0x4a2305[_0x0f47('0x33')],qs[_0x0f47('0x39')](_0x2d6c86[_0x0f47('0x36')][_0x0f47('0x39')]));_0x48dfee[_0x0f47('0x3a')]=_0x48dfee[_0x0f47('0x3a')][_0x0f47('0x3b')]?_0x48dfee[_0x0f47('0x3a')]:_0x4a2305['model'];if(_0x2d6c86[_0x0f47('0x36')][_0x0f47('0x44')]){_0x48dfee[_0x0f47('0x48')]=[{'all':!![]}];}_0x48dfee=_[_0x0f47('0x42')]({},_0x48dfee,_0x2d6c86[_0x0f47('0x43')]);return db[_0x0f47('0x2f')][_0x0f47('0x49')](_0x48dfee)[_0x0f47('0x28')](handleEntityNotFound(_0x46f86b,null))[_0x0f47('0x28')](respondWithResult(_0x46f86b,null))['catch'](handleError(_0x46f86b,null));};exports['create']=function(_0x16a4b2,_0x341aeb){return db[_0x0f47('0x2f')][_0x0f47('0x4a')](_0x16a4b2[_0x0f47('0x4b')],{})[_0x0f47('0x28')](respondWithResult(_0x341aeb,0xc9))[_0x0f47('0x45')](handleError(_0x341aeb,null));};exports['update']=function(_0x358c09,_0x143667){if(_0x358c09[_0x0f47('0x4b')]['id']){delete _0x358c09[_0x0f47('0x4b')]['id'];}return db[_0x0f47('0x2f')][_0x0f47('0x49')]({'where':{'id':_0x358c09[_0x0f47('0x47')]['id']}})['then'](handleEntityNotFound(_0x143667,null))[_0x0f47('0x28')](saveUpdates(_0x358c09[_0x0f47('0x4b')],null))[_0x0f47('0x28')](respondWithResult(_0x143667,null))[_0x0f47('0x45')](handleError(_0x143667,null));};exports['destroy']=function(_0x1a1fb4,_0x3f8bb9){return db[_0x0f47('0x2f')][_0x0f47('0x49')]({'where':{'id':_0x1a1fb4[_0x0f47('0x47')]['id']}})[_0x0f47('0x28')](handleEntityNotFound(_0x3f8bb9,null))[_0x0f47('0x28')](removeEntity(_0x3f8bb9,null))[_0x0f47('0x45')](handleError(_0x3f8bb9,null));};exports[_0x0f47('0x4c')]=function(_0x58927d,_0x120a02){return db[_0x0f47('0x2f')][_0x0f47('0x4c')]()[_0x0f47('0x28')](respondWithResult(_0x120a02,null))[_0x0f47('0x45')](handleError(_0x120a02,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index d77f314..6dd58d5 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 _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x4a341d,_0x42f3ec){var _0xc21de6=function(_0x2a0467){while(--_0x2a0467){_0x4a341d['push'](_0x4a341d['shift']());}};_0xc21de6(++_0x42f3ec);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x51486b,_0x320879){var _0x3fe26b=function(_0x30abc9){while(--_0x30abc9){_0x51486b['push'](_0x51486b['shift']());}};_0x3fe26b(++_0x320879);}(_0xb7e7,0x121));var _0x7b7e=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xb7e7[_0x13d07a];return _0x5ee0ee;};'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 9f5225b..295d398 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 _0x9039=['client','request','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','then','UpdateChatQueueReport','update','where','attributes','limit','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x82f06d,_0x5f4955){var _0x317d58=function(_0x316f5e){while(--_0x316f5e){_0x82f06d['push'](_0x82f06d['shift']());}};_0x317d58(++_0x5f4955);}(_0x9039,0x1ab));var _0x9903=function(_0x3ee0ca,_0x6c9851){_0x3ee0ca=_0x3ee0ca-0x0;var _0x65fd58=_0x9039[_0x3ee0ca];return _0x65fd58;};'use strict';var _=require('lodash');var util=require(_0x9903('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9903('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9903('0x2'))['db'];var utils=require(_0x9903('0x3'));var logger=require('../../config/logger')(_0x9903('0x4'));var config=require(_0x9903('0x5'));var jayson=require(_0x9903('0x6'));var client=jayson[_0x9903('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0ff9,_0x3bf5e8,_0x239ed){return new BPromise(function(_0x2a2f6a,_0x1a4d72){return client[_0x9903('0x8')](_0x3b0ff9,_0x239ed)['then'](function(_0x32e20c){logger[_0x9903('0x9')](_0x9903('0xa'),_0x3bf5e8,'request\x20sent');logger[_0x9903('0xb')](_0x9903('0xc'),_0x3bf5e8,_0x9903('0xd'),JSON[_0x9903('0xe')](_0x32e20c));if(_0x32e20c[_0x9903('0xf')]){if(_0x32e20c[_0x9903('0xf')]['code']===0x1f4){logger[_0x9903('0xf')](_0x9903('0xa'),_0x3bf5e8,_0x32e20c[_0x9903('0xf')][_0x9903('0x10')]);return _0x1a4d72(_0x32e20c['error'][_0x9903('0x10')]);}logger[_0x9903('0xf')](_0x9903('0xa'),_0x3bf5e8,_0x32e20c[_0x9903('0xf')][_0x9903('0x10')]);return _0x2a2f6a(_0x32e20c[_0x9903('0xf')][_0x9903('0x10')]);}else{logger[_0x9903('0x9')](_0x9903('0xa'),_0x3bf5e8,'request\x20sent');_0x2a2f6a(_0x32e20c[_0x9903('0x11')][_0x9903('0x10')]);}})[_0x9903('0x12')](function(_0x20d757){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x3bf5e8,_0x20d757);_0x1a4d72(_0x20d757);});});}exports[_0x9903('0x13')]=function(_0x4c72b3){var _0x4eda83=this;return new Promise(function(_0xc327b8,_0x4f9b13){return db[_0x9903('0x14')][_0x9903('0x15')](_0x4c72b3[_0x9903('0x16')],{'raw':_0x4c72b3[_0x9903('0x17')]?_0x4c72b3[_0x9903('0x17')][_0x9903('0x18')]===undefined?!![]:![]:!![]})[_0x9903('0x19')](function(_0xe22be5){logger[_0x9903('0x9')](_0x9903('0x13'),_0x4c72b3);logger[_0x9903('0xb')](_0x9903('0x13'),_0x4c72b3,JSON[_0x9903('0xe')](_0xe22be5));_0xc327b8(_0xe22be5);})[_0x9903('0x12')](function(_0x5817bd){logger[_0x9903('0xf')]('CreateChatQueueReport',_0x5817bd['message'],_0x4c72b3);_0x4f9b13(_0x4eda83[_0x9903('0xf')](0x1f4,_0x5817bd[_0x9903('0x10')]));});});};exports[_0x9903('0x1a')]=function(_0x310055){var _0x3676ef=this;return new Promise(function(_0x49bc70,_0x424070){return db['ChatQueueReport'][_0x9903('0x1b')](_0x310055[_0x9903('0x16')],{'raw':_0x310055[_0x9903('0x17')]?_0x310055[_0x9903('0x17')][_0x9903('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x310055[_0x9903('0x17')]?_0x310055[_0x9903('0x17')][_0x9903('0x1c')]||null:null,'attributes':_0x310055[_0x9903('0x17')]?_0x310055[_0x9903('0x17')][_0x9903('0x1d')]||null:null,'limit':_0x310055['options']?_0x310055['options'][_0x9903('0x1e')]||null:null})['then'](function(_0x567841){logger[_0x9903('0x9')](_0x9903('0x1a'),_0x310055);logger[_0x9903('0xb')](_0x9903('0x1a'),_0x310055,JSON[_0x9903('0xe')](_0x567841));_0x49bc70(_0x567841);})[_0x9903('0x12')](function(_0x4bea29){logger[_0x9903('0xf')](_0x9903('0x1a'),_0x4bea29['message'],_0x310055);_0x424070(_0x3676ef[_0x9903('0xf')](0x1f4,_0x4bea29[_0x9903('0x10')]));});});}; \ No newline at end of file +var _0x5d75=['debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateChatQueueReport','options','ChatQueueReport','update','body','raw','attributes','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2893cd,_0xca8511){var _0x401396=function(_0xf59843){while(--_0xf59843){_0x2893cd['push'](_0x2893cd['shift']());}};_0x401396(++_0xca8511);}(_0x5d75,0x19e));var _0x55d7=function(_0x3090e7,_0x11c7d6){_0x3090e7=_0x3090e7-0x0;var _0x39d4fa=_0x5d75[_0x3090e7];return _0x39d4fa;};'use strict';var _=require(_0x55d7('0x0'));var util=require(_0x55d7('0x1'));var moment=require(_0x55d7('0x2'));var BPromise=require(_0x55d7('0x3'));var rs=require(_0x55d7('0x4'));var fs=require('fs');var Redis=require(_0x55d7('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x55d7('0x6'))(_0x55d7('0x7'));var config=require(_0x55d7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x55d7('0x9')][_0x55d7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ae1fc,_0x1290fc,_0x309105){return new BPromise(function(_0x35a538,_0x2ce6fa){return client[_0x55d7('0xb')](_0x4ae1fc,_0x309105)[_0x55d7('0xc')](function(_0x12ebf7){logger['info'](_0x55d7('0xd'),_0x1290fc,_0x55d7('0xe'));logger[_0x55d7('0xf')](_0x55d7('0x10'),_0x1290fc,'request\x20sent',JSON[_0x55d7('0x11')](_0x12ebf7));if(_0x12ebf7[_0x55d7('0x12')]){if(_0x12ebf7['error'][_0x55d7('0x13')]===0x1f4){logger[_0x55d7('0x12')](_0x55d7('0xd'),_0x1290fc,_0x12ebf7[_0x55d7('0x12')][_0x55d7('0x14')]);return _0x2ce6fa(_0x12ebf7[_0x55d7('0x12')][_0x55d7('0x14')]);}logger[_0x55d7('0x12')](_0x55d7('0xd'),_0x1290fc,_0x12ebf7[_0x55d7('0x12')][_0x55d7('0x14')]);return _0x35a538(_0x12ebf7[_0x55d7('0x12')][_0x55d7('0x14')]);}else{logger[_0x55d7('0x15')](_0x55d7('0xd'),_0x1290fc,'request\x20sent');_0x35a538(_0x12ebf7[_0x55d7('0x16')][_0x55d7('0x14')]);}})[_0x55d7('0x17')](function(_0x2d0508){logger[_0x55d7('0x12')](_0x55d7('0xd'),_0x1290fc,_0x2d0508);_0x2ce6fa(_0x2d0508);});});}exports[_0x55d7('0x18')]=function(_0x115667){var _0x1285b8=this;return new Promise(function(_0x5df966,_0x15a470){return db['ChatQueueReport']['create'](_0x115667['body'],{'raw':_0x115667[_0x55d7('0x19')]?_0x115667[_0x55d7('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x55d7('0xc')](function(_0x4613b6){logger['info']('CreateChatQueueReport',_0x115667);logger[_0x55d7('0xf')](_0x55d7('0x18'),_0x115667,JSON['stringify'](_0x4613b6));_0x5df966(_0x4613b6);})[_0x55d7('0x17')](function(_0x8f5e35){logger[_0x55d7('0x12')](_0x55d7('0x18'),_0x8f5e35['message'],_0x115667);_0x15a470(_0x1285b8[_0x55d7('0x12')](0x1f4,_0x8f5e35[_0x55d7('0x14')]));});});};exports['UpdateChatQueueReport']=function(_0x45d832){var _0x25bb1b=this;return new Promise(function(_0x25fd7b,_0x14ddb7){return db[_0x55d7('0x1a')][_0x55d7('0x1b')](_0x45d832[_0x55d7('0x1c')],{'raw':_0x45d832[_0x55d7('0x19')]?_0x45d832[_0x55d7('0x19')][_0x55d7('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45d832[_0x55d7('0x19')]?_0x45d832[_0x55d7('0x19')]['where']||null:null,'attributes':_0x45d832[_0x55d7('0x19')]?_0x45d832['options'][_0x55d7('0x1e')]||null:null,'limit':_0x45d832[_0x55d7('0x19')]?_0x45d832['options'][_0x55d7('0x1f')]||null:null})['then'](function(_0x3f384a){logger[_0x55d7('0x15')](_0x55d7('0x20'),_0x45d832);logger[_0x55d7('0xf')](_0x55d7('0x20'),_0x45d832,JSON[_0x55d7('0x11')](_0x3f384a));_0x25fd7b(_0x3f384a);})[_0x55d7('0x17')](function(_0x17dc78){logger[_0x55d7('0x12')](_0x55d7('0x20'),_0x17dc78[_0x55d7('0x14')],_0x45d832);_0x14ddb7(_0x25bb1b[_0x55d7('0x12')](0x1f4,_0x17dc78[_0x55d7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 2ed5027..ca1a142 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 _0x6916=['destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','get','/describe','describe','post','create','put','update'];(function(_0x502fc1,_0x519c51){var _0x4fcec8=function(_0x24aabc){while(--_0x24aabc){_0x502fc1['push'](_0x502fc1['shift']());}};_0x4fcec8(++_0x519c51);}(_0x6916,0x9a));var _0x6691=function(_0x3ed3dc,_0x4be90f){_0x3ed3dc=_0x3ed3dc-0x0;var _0x598d5b=_0x6916[_0x3ed3dc];return _0x598d5b;};'use strict';var multer=require(_0x6691('0x0'));var util=require('util');var path=require(_0x6691('0x1'));var timeout=require(_0x6691('0x2'));var express=require(_0x6691('0x3'));var router=express['Router']();var fs_extra=require(_0x6691('0x4'));var auth=require(_0x6691('0x5'));var interaction=require(_0x6691('0x6'));var config=require(_0x6691('0x7'));var controller=require(_0x6691('0x8'));router['get']('/',auth[_0x6691('0x9')](),controller['index']);router[_0x6691('0xa')](_0x6691('0xb'),auth[_0x6691('0x9')](),controller[_0x6691('0xc')]);router[_0x6691('0xa')]('/:id',auth[_0x6691('0x9')](),controller['show']);router[_0x6691('0xd')]('/',auth[_0x6691('0x9')](),controller[_0x6691('0xe')]);router[_0x6691('0xf')]('/:id',auth[_0x6691('0x9')](),controller[_0x6691('0x10')]);router['delete']('/:id',auth[_0x6691('0x9')](),controller[_0x6691('0x11')]);module[_0x6691('0x12')]=router; \ No newline at end of file +var _0x8ea5=['express','Router','fs-extra','../../config/environment','./chatQueueReport.controller','get','/describe','describe','isAuthenticated','show','create','put','/:id','destroy','exports','util','connect-timeout'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8ea5,0x1b8));var _0x58ea=function(_0x13426b,_0x19417c){_0x13426b=_0x13426b-0x0;var _0x31d7a6=_0x8ea5[_0x13426b];return _0x31d7a6;};'use strict';var multer=require('multer');var util=require(_0x58ea('0x0'));var path=require('path');var timeout=require(_0x58ea('0x1'));var express=require(_0x58ea('0x2'));var router=express[_0x58ea('0x3')]();var fs_extra=require(_0x58ea('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x58ea('0x5'));var controller=require(_0x58ea('0x6'));router[_0x58ea('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x58ea('0x7')](_0x58ea('0x8'),auth['isAuthenticated'](),controller[_0x58ea('0x9')]);router[_0x58ea('0x7')]('/:id',auth[_0x58ea('0xa')](),controller[_0x58ea('0xb')]);router['post']('/',auth[_0x58ea('0xa')](),controller[_0x58ea('0xc')]);router[_0x58ea('0xd')](_0x58ea('0xe'),auth[_0x58ea('0xa')](),controller['update']);router['delete'](_0x58ea('0xe'),auth[_0x58ea('0xa')](),controller[_0x58ea('0xf')]);module[_0x58ea('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 6f685d7..dfd255d 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x54464c,_0xef4d7c){var _0x2d134c=function(_0x587122){while(--_0x587122){_0x54464c['push'](_0x54464c['shift']());}};_0x2d134c(++_0xef4d7c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x533528,_0x409d05){_0x533528=_0x533528-0x0;var _0x3189f1=_0xcb91[_0x533528];return _0x3189f1;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x534e4e,_0x1c8361){var _0x36b363=function(_0x32fa5c){while(--_0x32fa5c){_0x534e4e['push'](_0x534e4e['shift']());}};_0x36b363(++_0x1c8361);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0xcb91[_0x2ae2ad];return _0x26dbd7;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 1692669..9fe3726 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 _0x1760=['Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','ChatTransferReport','fieldName','type','key','query','keys','filters','intersection','attributes','model','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','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','count','offset','limit'];(function(_0x1f111d,_0x38e715){var _0x4ddf4a=function(_0x29964d){while(--_0x29964d){_0x1f111d['push'](_0x1f111d['shift']());}};_0x4ddf4a(++_0x38e715);}(_0x1760,0x16b));var _0x0176=function(_0x38edb5,_0x181a88){_0x38edb5=_0x38edb5-0x0;var _0x581967=_0x1760[_0x38edb5];return _0x581967;};'use strict';var emlformat=require(_0x0176('0x0'));var rimraf=require(_0x0176('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0176('0x2'));var rp=require(_0x0176('0x3'));var moment=require(_0x0176('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0176('0x5'));var util=require(_0x0176('0x6'));var path=require(_0x0176('0x7'));var sox=require(_0x0176('0x8'));var csv=require(_0x0176('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0176('0xa'));var crypto=require(_0x0176('0xb'));var jsforce=require(_0x0176('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0176('0xd'));var Papa=require(_0x0176('0xe'));var Redis=require(_0x0176('0xf'));var authService=require(_0x0176('0x10'));var qs=require(_0x0176('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0176('0x12'));var logger=require(_0x0176('0x13'))(_0x0176('0x14'));var utils=require(_0x0176('0x15'));var config=require(_0x0176('0x16'));var licenseUtil=require(_0x0176('0x17'));var db=require(_0x0176('0x18'))['db'];function respondWithStatusCode(_0x3b73f7,_0x3b8a26){_0x3b8a26=_0x3b8a26||0xcc;return function(_0x1e3e38){if(_0x1e3e38){return _0x3b73f7[_0x0176('0x19')](_0x3b8a26);}return _0x3b73f7[_0x0176('0x1a')](_0x3b8a26)['end']();};}function respondWithResult(_0x37af45,_0x584035){_0x584035=_0x584035||0xc8;return function(_0x245c86){if(_0x245c86){return _0x37af45['status'](_0x584035)[_0x0176('0x1b')](_0x245c86);}};}function respondWithFilteredResult(_0x3bcc9e,_0x3f20ae){return function(_0x2ecf3b){if(_0x2ecf3b){var _0x16adbf=typeof _0x3f20ae['offset']===_0x0176('0x1c')&&typeof _0x3f20ae['limit']===_0x0176('0x1c');var _0x3409e4=_0x2ecf3b[_0x0176('0x1d')];var _0xc45b21=_0x16adbf?0x0:_0x3f20ae[_0x0176('0x1e')];var _0x142899=_0x16adbf?_0x2ecf3b[_0x0176('0x1d')]:_0x3f20ae[_0x0176('0x1e')]+_0x3f20ae[_0x0176('0x1f')];var _0x39d74f;if(_0x142899>=_0x3409e4){_0x142899=_0x3409e4;_0x39d74f=0xc8;}else{_0x39d74f=0xce;}_0x3bcc9e['status'](_0x39d74f);return _0x3bcc9e['set'](_0x0176('0x20'),_0xc45b21+'-'+_0x142899+'/'+_0x3409e4)[_0x0176('0x1b')](_0x2ecf3b);}return null;};}function patchUpdates(_0x851c51){return function(_0x5beb45){try{jsonpatch[_0x0176('0x21')](_0x5beb45,_0x851c51,!![]);}catch(_0x4593ef){return BPromise[_0x0176('0x22')](_0x4593ef);}return _0x5beb45[_0x0176('0x23')]();};}function saveUpdates(_0x49700d,_0x178e97){return function(_0x1bed1a){if(_0x1bed1a){return _0x1bed1a[_0x0176('0x24')](_0x49700d)[_0x0176('0x25')](function(_0x546c4f){return _0x546c4f;});}return null;};}function removeEntity(_0x1a2dfb,_0xd54ad4){return function(_0x3d2bd8){if(_0x3d2bd8){return _0x3d2bd8['destroy']()[_0x0176('0x25')](function(){_0x1a2dfb[_0x0176('0x1a')](0xcc)[_0x0176('0x26')]();});}};}function handleEntityNotFound(_0x8da6d6,_0x4857c3){return function(_0x3af589){if(!_0x3af589){_0x8da6d6[_0x0176('0x19')](0x194);}return _0x3af589;};}function handleError(_0x414521,_0x215e4d){_0x215e4d=_0x215e4d||0x1f4;return function(_0x170744){logger[_0x0176('0x27')](_0x170744[_0x0176('0x28')]);if(_0x170744[_0x0176('0x29')]){delete _0x170744[_0x0176('0x29')];}_0x414521[_0x0176('0x1a')](_0x215e4d)[_0x0176('0x2a')](_0x170744);};}exports[_0x0176('0x2b')]=function(_0x454438,_0x56b152){var _0x3bb4e7={},_0x20b596={},_0x531f06={'count':0x0,'rows':[]};var _0x5e86df=_[_0x0176('0x2c')](db[_0x0176('0x2d')]['rawAttributes'],function(_0x374225){return{'name':_0x374225[_0x0176('0x2e')],'type':_0x374225[_0x0176('0x2f')][_0x0176('0x30')]};});_0x20b596['model']=_[_0x0176('0x2c')](_0x5e86df,_0x0176('0x29'));_0x20b596[_0x0176('0x31')]=_[_0x0176('0x32')](_0x454438[_0x0176('0x31')]);_0x20b596[_0x0176('0x33')]=_[_0x0176('0x34')](_0x20b596['model'],_0x20b596[_0x0176('0x31')]);_0x3bb4e7[_0x0176('0x35')]=_['intersection'](_0x20b596[_0x0176('0x36')],qs['fields'](_0x454438[_0x0176('0x31')]['fields']));_0x3bb4e7[_0x0176('0x35')]=_0x3bb4e7[_0x0176('0x35')][_0x0176('0x37')]?_0x3bb4e7[_0x0176('0x35')]:_0x20b596[_0x0176('0x36')];if(!_0x454438['query'][_0x0176('0x38')](_0x0176('0x39'))){_0x3bb4e7['limit']=qs[_0x0176('0x1f')](_0x454438[_0x0176('0x31')][_0x0176('0x1f')]);_0x3bb4e7['offset']=qs['offset'](_0x454438[_0x0176('0x31')][_0x0176('0x1e')]);}_0x3bb4e7[_0x0176('0x3a')]=qs['sort'](_0x454438[_0x0176('0x31')][_0x0176('0x3b')]);_0x3bb4e7[_0x0176('0x3c')]=qs[_0x0176('0x33')](_[_0x0176('0x3d')](_0x454438['query'],_0x20b596[_0x0176('0x33')]),_0x5e86df);if(_0x454438['query'][_0x0176('0x3e')]){_0x3bb4e7[_0x0176('0x3c')]=_[_0x0176('0x3f')](_0x3bb4e7[_0x0176('0x3c')],{'$or':_[_0x0176('0x2c')](_0x5e86df,function(_0xe2edb){if(_0xe2edb[_0x0176('0x2f')]!==_0x0176('0x40')){var _0x3001a8={};_0x3001a8[_0xe2edb[_0x0176('0x29')]]={'$like':'%'+_0x454438[_0x0176('0x31')][_0x0176('0x3e')]+'%'};return _0x3001a8;}})});}_0x3bb4e7=_[_0x0176('0x3f')]({},_0x3bb4e7,_0x454438[_0x0176('0x41')]);var _0x4aec5f={'where':_0x3bb4e7['where']};return db[_0x0176('0x2d')][_0x0176('0x1d')](_0x4aec5f)['then'](function(_0x9152f6){_0x531f06['count']=_0x9152f6;if(_0x454438[_0x0176('0x31')][_0x0176('0x42')]){_0x3bb4e7[_0x0176('0x43')]=[{'all':!![]}];}return db[_0x0176('0x2d')][_0x0176('0x44')](_0x3bb4e7);})['then'](function(_0x1e667f){_0x531f06[_0x0176('0x45')]=_0x1e667f;return _0x531f06;})[_0x0176('0x25')](respondWithFilteredResult(_0x56b152,_0x3bb4e7))[_0x0176('0x46')](handleError(_0x56b152,null));};exports[_0x0176('0x47')]=function(_0x221782,_0x307df4){var _0x5ee283={'raw':!![],'where':{'id':_0x221782[_0x0176('0x48')]['id']}},_0x1d7ef7={};_0x1d7ef7['model']=_['keys'](db[_0x0176('0x2d')][_0x0176('0x49')]);_0x1d7ef7[_0x0176('0x31')]=_[_0x0176('0x32')](_0x221782[_0x0176('0x31')]);_0x1d7ef7[_0x0176('0x33')]=_[_0x0176('0x34')](_0x1d7ef7[_0x0176('0x36')],_0x1d7ef7[_0x0176('0x31')]);_0x5ee283[_0x0176('0x35')]=_['intersection'](_0x1d7ef7[_0x0176('0x36')],qs['fields'](_0x221782['query'][_0x0176('0x4a')]));_0x5ee283[_0x0176('0x35')]=_0x5ee283[_0x0176('0x35')][_0x0176('0x37')]?_0x5ee283[_0x0176('0x35')]:_0x1d7ef7[_0x0176('0x36')];if(_0x221782[_0x0176('0x31')]['includeAll']){_0x5ee283['include']=[{'all':!![]}];}_0x5ee283=_['merge']({},_0x5ee283,_0x221782[_0x0176('0x41')]);return db['ChatTransferReport']['find'](_0x5ee283)['then'](handleEntityNotFound(_0x307df4,null))[_0x0176('0x25')](respondWithResult(_0x307df4,null))['catch'](handleError(_0x307df4,null));};exports[_0x0176('0x4b')]=function(_0x599d1c,_0x1cfedf){return db[_0x0176('0x2d')][_0x0176('0x4b')](_0x599d1c['body'],{})['then'](respondWithResult(_0x1cfedf,0xc9))[_0x0176('0x46')](handleError(_0x1cfedf,null));};exports['update']=function(_0x3d56bd,_0x12053a){if(_0x3d56bd['body']['id']){delete _0x3d56bd[_0x0176('0x4c')]['id'];}return db[_0x0176('0x2d')][_0x0176('0x4d')]({'where':{'id':_0x3d56bd[_0x0176('0x48')]['id']}})['then'](handleEntityNotFound(_0x12053a,null))[_0x0176('0x25')](saveUpdates(_0x3d56bd['body'],null))[_0x0176('0x25')](respondWithResult(_0x12053a,null))[_0x0176('0x46')](handleError(_0x12053a,null));};exports['destroy']=function(_0x274b63,_0x950eed){return db['ChatTransferReport'][_0x0176('0x4d')]({'where':{'id':_0x274b63[_0x0176('0x48')]['id']}})['then'](handleEntityNotFound(_0x950eed,null))[_0x0176('0x25')](removeEntity(_0x950eed,null))[_0x0176('0x46')](handleError(_0x950eed,null));};exports[_0x0176('0x4e')]=function(_0x1a5da4,_0x128b7d){return db[_0x0176('0x2d')][_0x0176('0x4e')]()[_0x0176('0x25')](respondWithResult(_0x128b7d,null))[_0x0176('0x46')](handleError(_0x128b7d,null));}; \ No newline at end of file +var _0x2e01=['type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','options','include','findAll','catch','show','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','ChatTransferReport','rawAttributes'];(function(_0x39faf6,_0x5b0b13){var _0x4117ba=function(_0x44e4bc){while(--_0x44e4bc){_0x39faf6['push'](_0x39faf6['shift']());}};_0x4117ba(++_0x5b0b13);}(_0x2e01,0x135));var _0x12e0=function(_0x59514b,_0x31770c){_0x59514b=_0x59514b-0x0;var _0x446f4d=_0x2e01[_0x59514b];return _0x446f4d;};'use strict';var emlformat=require(_0x12e0('0x0'));var rimraf=require(_0x12e0('0x1'));var zipdir=require(_0x12e0('0x2'));var jsonpatch=require(_0x12e0('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x12e0('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x12e0('0x5'));var csv=require(_0x12e0('0x6'));var ejs=require(_0x12e0('0x7'));var fs=require('fs');var fs_extra=require(_0x12e0('0x8'));var _=require('lodash');var squel=require(_0x12e0('0x9'));var crypto=require(_0x12e0('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x12e0('0xb'));var toCsv=require(_0x12e0('0x6'));var querystring=require(_0x12e0('0xc'));var Papa=require(_0x12e0('0xd'));var Redis=require('ioredis');var authService=require(_0x12e0('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x12e0('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x12e0('0x10'));var config=require(_0x12e0('0x11'));var licenseUtil=require(_0x12e0('0x12'));var db=require(_0x12e0('0x13'))['db'];function respondWithStatusCode(_0xba357e,_0x2433a1){_0x2433a1=_0x2433a1||0xcc;return function(_0x6309ca){if(_0x6309ca){return _0xba357e['sendStatus'](_0x2433a1);}return _0xba357e[_0x12e0('0x14')](_0x2433a1)['end']();};}function respondWithResult(_0x94a58e,_0x27bde7){_0x27bde7=_0x27bde7||0xc8;return function(_0x4d51e7){if(_0x4d51e7){return _0x94a58e[_0x12e0('0x14')](_0x27bde7)[_0x12e0('0x15')](_0x4d51e7);}};}function respondWithFilteredResult(_0x490e21,_0x40e3dc){return function(_0x3a6dd8){if(_0x3a6dd8){var _0x42469f=typeof _0x40e3dc[_0x12e0('0x16')]===_0x12e0('0x17')&&typeof _0x40e3dc['limit']===_0x12e0('0x17');var _0x4b5c32=_0x3a6dd8[_0x12e0('0x18')];var _0x42308e=_0x42469f?0x0:_0x40e3dc[_0x12e0('0x16')];var _0x421455=_0x42469f?_0x3a6dd8[_0x12e0('0x18')]:_0x40e3dc[_0x12e0('0x16')]+_0x40e3dc[_0x12e0('0x19')];var _0xe90f76;if(_0x421455>=_0x4b5c32){_0x421455=_0x4b5c32;_0xe90f76=0xc8;}else{_0xe90f76=0xce;}_0x490e21['status'](_0xe90f76);return _0x490e21[_0x12e0('0x1a')](_0x12e0('0x1b'),_0x42308e+'-'+_0x421455+'/'+_0x4b5c32)['json'](_0x3a6dd8);}return null;};}function patchUpdates(_0x31ea9d){return function(_0x1817b7){try{jsonpatch[_0x12e0('0x1c')](_0x1817b7,_0x31ea9d,!![]);}catch(_0x18dc58){return BPromise[_0x12e0('0x1d')](_0x18dc58);}return _0x1817b7[_0x12e0('0x1e')]();};}function saveUpdates(_0xc31c74,_0x328df4){return function(_0x3a3253){if(_0x3a3253){return _0x3a3253[_0x12e0('0x1f')](_0xc31c74)[_0x12e0('0x20')](function(_0x4fd3c8){return _0x4fd3c8;});}return null;};}function removeEntity(_0x21ca0d,_0xafa586){return function(_0x4ad130){if(_0x4ad130){return _0x4ad130[_0x12e0('0x21')]()['then'](function(){_0x21ca0d[_0x12e0('0x14')](0xcc)[_0x12e0('0x22')]();});}};}function handleEntityNotFound(_0x50fce0,_0x30e1e8){return function(_0x59a698){if(!_0x59a698){_0x50fce0['sendStatus'](0x194);}return _0x59a698;};}function handleError(_0x1e8fcf,_0x3643d6){_0x3643d6=_0x3643d6||0x1f4;return function(_0x19413c){logger[_0x12e0('0x23')](_0x19413c[_0x12e0('0x24')]);if(_0x19413c[_0x12e0('0x25')]){delete _0x19413c[_0x12e0('0x25')];}_0x1e8fcf[_0x12e0('0x14')](_0x3643d6)['send'](_0x19413c);};}exports[_0x12e0('0x26')]=function(_0x221de4,_0x1f780e){var _0x2f33dc={},_0x439ccd={},_0x1c11d9={'count':0x0,'rows':[]};var _0x4ba7e8=_['map'](db[_0x12e0('0x27')][_0x12e0('0x28')],function(_0xdac09d){return{'name':_0xdac09d['fieldName'],'type':_0xdac09d[_0x12e0('0x29')][_0x12e0('0x2a')]};});_0x439ccd[_0x12e0('0x2b')]=_['map'](_0x4ba7e8,_0x12e0('0x25'));_0x439ccd[_0x12e0('0x2c')]=_[_0x12e0('0x2d')](_0x221de4[_0x12e0('0x2c')]);_0x439ccd['filters']=_[_0x12e0('0x2e')](_0x439ccd['model'],_0x439ccd[_0x12e0('0x2c')]);_0x2f33dc[_0x12e0('0x2f')]=_[_0x12e0('0x2e')](_0x439ccd[_0x12e0('0x2b')],qs['fields'](_0x221de4[_0x12e0('0x2c')][_0x12e0('0x30')]));_0x2f33dc[_0x12e0('0x2f')]=_0x2f33dc['attributes'][_0x12e0('0x31')]?_0x2f33dc[_0x12e0('0x2f')]:_0x439ccd[_0x12e0('0x2b')];if(!_0x221de4[_0x12e0('0x2c')][_0x12e0('0x32')](_0x12e0('0x33'))){_0x2f33dc['limit']=qs[_0x12e0('0x19')](_0x221de4['query'][_0x12e0('0x19')]);_0x2f33dc['offset']=qs[_0x12e0('0x16')](_0x221de4[_0x12e0('0x2c')][_0x12e0('0x16')]);}_0x2f33dc[_0x12e0('0x34')]=qs['sort'](_0x221de4[_0x12e0('0x2c')][_0x12e0('0x35')]);_0x2f33dc['where']=qs['filters'](_[_0x12e0('0x36')](_0x221de4['query'],_0x439ccd[_0x12e0('0x37')]),_0x4ba7e8);if(_0x221de4['query'][_0x12e0('0x38')]){_0x2f33dc[_0x12e0('0x39')]=_[_0x12e0('0x3a')](_0x2f33dc['where'],{'$or':_['map'](_0x4ba7e8,function(_0x5df904){if(_0x5df904[_0x12e0('0x29')]!=='VIRTUAL'){var _0x11909d={};_0x11909d[_0x5df904[_0x12e0('0x25')]]={'$like':'%'+_0x221de4[_0x12e0('0x2c')][_0x12e0('0x38')]+'%'};return _0x11909d;}})});}_0x2f33dc=_['merge']({},_0x2f33dc,_0x221de4[_0x12e0('0x3b')]);var _0x4a749d={'where':_0x2f33dc[_0x12e0('0x39')]};return db[_0x12e0('0x27')][_0x12e0('0x18')](_0x4a749d)[_0x12e0('0x20')](function(_0x2896af){_0x1c11d9[_0x12e0('0x18')]=_0x2896af;if(_0x221de4['query']['includeAll']){_0x2f33dc[_0x12e0('0x3c')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x12e0('0x3d')](_0x2f33dc);})[_0x12e0('0x20')](function(_0x1b5a1e){_0x1c11d9['rows']=_0x1b5a1e;return _0x1c11d9;})[_0x12e0('0x20')](respondWithFilteredResult(_0x1f780e,_0x2f33dc))[_0x12e0('0x3e')](handleError(_0x1f780e,null));};exports[_0x12e0('0x3f')]=function(_0x15f7cc,_0xe3708a){var _0x60cf45={'raw':!![],'where':{'id':_0x15f7cc['params']['id']}},_0x269eb2={};_0x269eb2[_0x12e0('0x2b')]=_[_0x12e0('0x2d')](db[_0x12e0('0x27')][_0x12e0('0x28')]);_0x269eb2['query']=_['keys'](_0x15f7cc[_0x12e0('0x2c')]);_0x269eb2['filters']=_['intersection'](_0x269eb2[_0x12e0('0x2b')],_0x269eb2[_0x12e0('0x2c')]);_0x60cf45[_0x12e0('0x2f')]=_[_0x12e0('0x2e')](_0x269eb2[_0x12e0('0x2b')],qs[_0x12e0('0x30')](_0x15f7cc[_0x12e0('0x2c')][_0x12e0('0x30')]));_0x60cf45[_0x12e0('0x2f')]=_0x60cf45[_0x12e0('0x2f')][_0x12e0('0x31')]?_0x60cf45[_0x12e0('0x2f')]:_0x269eb2['model'];if(_0x15f7cc[_0x12e0('0x2c')][_0x12e0('0x40')]){_0x60cf45[_0x12e0('0x3c')]=[{'all':!![]}];}_0x60cf45=_['merge']({},_0x60cf45,_0x15f7cc[_0x12e0('0x3b')]);return db['ChatTransferReport'][_0x12e0('0x41')](_0x60cf45)[_0x12e0('0x20')](handleEntityNotFound(_0xe3708a,null))['then'](respondWithResult(_0xe3708a,null))[_0x12e0('0x3e')](handleError(_0xe3708a,null));};exports[_0x12e0('0x42')]=function(_0x1427f7,_0x2b9456){return db[_0x12e0('0x27')][_0x12e0('0x42')](_0x1427f7[_0x12e0('0x43')],{})['then'](respondWithResult(_0x2b9456,0xc9))['catch'](handleError(_0x2b9456,null));};exports['update']=function(_0x546db6,_0x2ccada){if(_0x546db6[_0x12e0('0x43')]['id']){delete _0x546db6[_0x12e0('0x43')]['id'];}return db[_0x12e0('0x27')][_0x12e0('0x41')]({'where':{'id':_0x546db6[_0x12e0('0x44')]['id']}})['then'](handleEntityNotFound(_0x2ccada,null))[_0x12e0('0x20')](saveUpdates(_0x546db6[_0x12e0('0x43')],null))[_0x12e0('0x20')](respondWithResult(_0x2ccada,null))[_0x12e0('0x3e')](handleError(_0x2ccada,null));};exports['destroy']=function(_0xa308c6,_0x18998f){return db['ChatTransferReport'][_0x12e0('0x41')]({'where':{'id':_0xa308c6[_0x12e0('0x44')]['id']}})[_0x12e0('0x20')](handleEntityNotFound(_0x18998f,null))[_0x12e0('0x20')](removeEntity(_0x18998f,null))[_0x12e0('0x3e')](handleError(_0x18998f,null));};exports['describe']=function(_0x52f856,_0x43cf23){return db[_0x12e0('0x27')][_0x12e0('0x45')]()['then'](respondWithResult(_0x43cf23,null))['catch'](handleError(_0x43cf23,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index ab2beac..c022916 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 _0xc7b9=['../../config/environment','./chatTransferReport.attributes','report_chat_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1ba972,_0x2d0111){var _0x5065b3=function(_0x1140de){while(--_0x1140de){_0x1ba972['push'](_0x1ba972['shift']());}};_0x5065b3(++_0x2d0111);}(_0xc7b9,0xc4));var _0x9c7b=function(_0x29a87a,_0x4ebe6d){_0x29a87a=_0x29a87a-0x0;var _0x1cf6b6=_0xc7b9[_0x29a87a];return _0x1cf6b6;};'use strict';var _=require(_0x9c7b('0x0'));var util=require(_0x9c7b('0x1'));var logger=require('../../config/logger')(_0x9c7b('0x2'));var moment=require(_0x9c7b('0x3'));var BPromise=require(_0x9c7b('0x4'));var rp=require(_0x9c7b('0x5'));var fs=require('fs');var path=require(_0x9c7b('0x6'));var rimraf=require(_0x9c7b('0x7'));var config=require(_0x9c7b('0x8'));var attributes=require(_0x9c7b('0x9'));module['exports']=function(_0x5ef9b7,_0x52d4d2){return _0x5ef9b7['define']('ChatTransferReport',attributes,{'tableName':_0x9c7b('0xa'),'paranoid':![],'indexes':[{'name':_0x9c7b('0xb'),'fields':[_0x9c7b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8501=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_chat_transfer'];(function(_0x4416c0,_0x53b522){var _0x35546d=function(_0x7354eb){while(--_0x7354eb){_0x4416c0['push'](_0x4416c0['shift']());}};_0x35546d(++_0x53b522);}(_0x8501,0x139));var _0x1850=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x8501[_0x28611e];return _0x530f69;};'use strict';var _=require(_0x1850('0x0'));var util=require(_0x1850('0x1'));var logger=require(_0x1850('0x2'))('api');var moment=require(_0x1850('0x3'));var BPromise=require(_0x1850('0x4'));var rp=require(_0x1850('0x5'));var fs=require('fs');var path=require(_0x1850('0x6'));var rimraf=require(_0x1850('0x7'));var config=require(_0x1850('0x8'));var attributes=require('./chatTransferReport.attributes');module[_0x1850('0x9')]=function(_0x2574e2,_0x146b49){return _0x2574e2[_0x1850('0xa')]('ChatTransferReport',attributes,{'tableName':_0x1850('0xb'),'paranoid':![],'indexes':[{'name':_0x1850('0xc'),'fields':[_0x1850('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 bd6429a..f677d6d 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 _0xe830=['http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/environment'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xe830,0x91));var _0x0e83=function(_0x758baa,_0x33fc3c){_0x758baa=_0x758baa-0x0;var _0x3b8bbd=_0xe830[_0x758baa];return _0x3b8bbd;};'use strict';var _=require(_0x0e83('0x0'));var util=require(_0x0e83('0x1'));var moment=require(_0x0e83('0x2'));var BPromise=require(_0x0e83('0x3'));var rs=require(_0x0e83('0x4'));var fs=require('fs');var Redis=require(_0x0e83('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0e83('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0e83('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x337f94,_0x2eada2,_0x3145a2){return new BPromise(function(_0x54d283,_0xc1b7a5){return client[_0x0e83('0x8')](_0x337f94,_0x3145a2)[_0x0e83('0x9')](function(_0x2b2df9){logger[_0x0e83('0xa')](_0x0e83('0xb'),_0x2eada2,_0x0e83('0xc'));logger[_0x0e83('0xd')](_0x0e83('0xe'),_0x2eada2,_0x0e83('0xc'),JSON[_0x0e83('0xf')](_0x2b2df9));if(_0x2b2df9['error']){if(_0x2b2df9[_0x0e83('0x10')][_0x0e83('0x11')]===0x1f4){logger[_0x0e83('0x10')](_0x0e83('0xb'),_0x2eada2,_0x2b2df9['error']['message']);return _0xc1b7a5(_0x2b2df9[_0x0e83('0x10')][_0x0e83('0x12')]);}logger[_0x0e83('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x2eada2,_0x2b2df9[_0x0e83('0x10')][_0x0e83('0x12')]);return _0x54d283(_0x2b2df9[_0x0e83('0x10')][_0x0e83('0x12')]);}else{logger[_0x0e83('0xa')]('ChatTransferReport,\x20%s,\x20%s',_0x2eada2,'request\x20sent');_0x54d283(_0x2b2df9['result']['message']);}})['catch'](function(_0x385420){logger[_0x0e83('0x10')](_0x0e83('0xb'),_0x2eada2,_0x385420);_0xc1b7a5(_0x385420);});});} \ No newline at end of file +var _0xc891=['client','http','request','info','ChatTransferReport,\x20%s,\x20%s','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3d209a,_0x5441f4){var _0x23fe42=function(_0x39651e){while(--_0x39651e){_0x3d209a['push'](_0x3d209a['shift']());}};_0x23fe42(++_0x5441f4);}(_0xc891,0xc0));var _0x1c89=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xc891[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1c89('0x0'));var BPromise=require(_0x1c89('0x1'));var rs=require(_0x1c89('0x2'));var fs=require('fs');var Redis=require(_0x1c89('0x3'));var db=require(_0x1c89('0x4'))['db'];var utils=require(_0x1c89('0x5'));var logger=require('../../config/logger')(_0x1c89('0x6'));var config=require(_0x1c89('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1c89('0x8')][_0x1c89('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4918e4,_0x184d5c,_0x37303d){return new BPromise(function(_0x5d936d,_0x2e1833){return client[_0x1c89('0xa')](_0x4918e4,_0x37303d)['then'](function(_0x530f56){logger[_0x1c89('0xb')](_0x1c89('0xc'),_0x184d5c,'request\x20sent');logger['debug'](_0x1c89('0xd'),_0x184d5c,_0x1c89('0xe'),JSON[_0x1c89('0xf')](_0x530f56));if(_0x530f56[_0x1c89('0x10')]){if(_0x530f56['error']['code']===0x1f4){logger[_0x1c89('0x10')](_0x1c89('0xc'),_0x184d5c,_0x530f56['error'][_0x1c89('0x11')]);return _0x2e1833(_0x530f56[_0x1c89('0x10')][_0x1c89('0x11')]);}logger['error'](_0x1c89('0xc'),_0x184d5c,_0x530f56[_0x1c89('0x10')][_0x1c89('0x11')]);return _0x5d936d(_0x530f56[_0x1c89('0x10')][_0x1c89('0x11')]);}else{logger['info'](_0x1c89('0xc'),_0x184d5c,_0x1c89('0xe'));_0x5d936d(_0x530f56[_0x1c89('0x12')]['message']);}})[_0x1c89('0x13')](function(_0x14e683){logger[_0x1c89('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x184d5c,_0x14e683);_0x2e1833(_0x14e683);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 1011c0d..b75440b 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 _0x24fc=['delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update'];(function(_0x470ef5,_0x3296b8){var _0x27cc72=function(_0x581cea){while(--_0x581cea){_0x470ef5['push'](_0x470ef5['shift']());}};_0x27cc72(++_0x3296b8);}(_0x24fc,0xb7));var _0xc24f=function(_0x15626b,_0x4af694){_0x15626b=_0x15626b-0x0;var _0x53bf85=_0x24fc[_0x15626b];return _0x53bf85;};'use strict';var multer=require(_0xc24f('0x0'));var util=require(_0xc24f('0x1'));var path=require(_0xc24f('0x2'));var timeout=require('connect-timeout');var express=require(_0xc24f('0x3'));var router=express['Router']();var fs_extra=require(_0xc24f('0x4'));var auth=require(_0xc24f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc24f('0x6'));router[_0xc24f('0x7')]('/',auth[_0xc24f('0x8')](),controller[_0xc24f('0x9')]);router[_0xc24f('0x7')](_0xc24f('0xa'),auth['isAuthenticated'](),controller[_0xc24f('0xb')]);router[_0xc24f('0x7')](_0xc24f('0xc'),auth[_0xc24f('0x8')](),controller[_0xc24f('0xd')]);router[_0xc24f('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc24f('0xf')](_0xc24f('0xc'),auth[_0xc24f('0x8')](),controller[_0xc24f('0x10')]);router[_0xc24f('0x11')](_0xc24f('0xc'),auth[_0xc24f('0x8')](),controller[_0xc24f('0x12')]);module[_0xc24f('0x13')]=router; \ No newline at end of file +var _0x7651=['/describe','show','create','put','/:id','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index'];(function(_0xbcc213,_0xefb217){var _0xf1a438=function(_0x3f8f04){while(--_0x3f8f04){_0xbcc213['push'](_0xbcc213['shift']());}};_0xf1a438(++_0xefb217);}(_0x7651,0x6c));var _0x1765=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7651[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1765('0x0'));var util=require(_0x1765('0x1'));var path=require(_0x1765('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1765('0x3')]();var fs_extra=require(_0x1765('0x4'));var auth=require(_0x1765('0x5'));var interaction=require(_0x1765('0x6'));var config=require(_0x1765('0x7'));var controller=require(_0x1765('0x8'));router[_0x1765('0x9')]('/',auth[_0x1765('0xa')](),controller[_0x1765('0xb')]);router[_0x1765('0x9')](_0x1765('0xc'),auth[_0x1765('0xa')](),controller['describe']);router[_0x1765('0x9')]('/:id',auth[_0x1765('0xa')](),controller[_0x1765('0xd')]);router['post']('/',auth[_0x1765('0xa')](),controller[_0x1765('0xe')]);router[_0x1765('0xf')](_0x1765('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x1765('0x11')](_0x1765('0x10'),auth['isAuthenticated'](),controller[_0x1765('0x12')]);module[_0x1765('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 80d6149..1632285 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 _0x9c44=['input','parse','getDataValue','setDataValue','onlineForm','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Feedback','ENUM','star','thumb','name'];(function(_0x419550,_0x15cdf1){var _0x55f9ef=function(_0x44f707){while(--_0x44f707){_0x419550['push'](_0x419550['shift']());}};_0x55f9ef(++_0x15cdf1);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x49c4('0x0')]={'name':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![],'unique':_0x49c4('0x2')},'description':{'type':Sequelize[_0x49c4('0x1')]},'mapKey':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0x3')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x4')},'customerAlias':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![],'defaultValue':_0x49c4('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x49c4('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![],'defaultValue':_0x49c4('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x49c4('0x1')]},'animation':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x49c4('0x8'),_0x49c4('0x9')),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0xa')},'start_chat_button':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0xb')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0xc')},'download_transcript':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x49c4('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x49c4('0xf')]},'closingQuestion':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x11')},'noteTitle':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x12')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0xb')},'skipMessageButton':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x13')},'ratingType':{'type':Sequelize[_0x49c4('0x14')](_0x49c4('0x15'),_0x49c4('0x16')),'defaultValue':_0x49c4('0x15')},'ratingStarsNumber':{'type':Sequelize[_0x49c4('0xd')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x49c4('0x17'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x49c4('0x18'),'props':{'title':_0x49c4('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x49c4('0x3'),'type':_0x49c4('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0x49c4('0x19')](this[_0x49c4('0x1a')]('onlineForm')):{};},'set':function(_0x207358){return this[_0x49c4('0x1b')](_0x49c4('0x1c'),JSON[_0x49c4('0x1d')](_0x207358));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x49c4('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x49c4('0x3'),'type':_0x49c4('0x3')},'variable':null},{'type':_0x49c4('0x1e'),'config':{'placeholder':_0x49c4('0x1f')},'props':{'title':'Comments','helpText':_0x49c4('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x49c4('0x1a')](_0x49c4('0x21'))?JSON[_0x49c4('0x19')](this[_0x49c4('0x1a')](_0x49c4('0x21'))):{};},'set':function(_0x26ba17){return this[_0x49c4('0x1b')](_0x49c4('0x21'),JSON[_0x49c4('0x1d')](_0x26ba17));}},'token':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x49c4('0x1')]},'forwardOffline':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x49c4('0x1')]},'waitingTitle':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x22')},'offlineMessageSubject':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x23')},'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[_0x49c4('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x24')},'skipUnmanaged':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x25')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x49c4('0x1')]},'notificationTemplate':{'type':Sequelize[_0x49c4('0xf')],'defaultValue':function(){return _0x49c4('0x26');}},'notificationSound':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x49c4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0x28')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x29')},'messagesAlignment':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x2a')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x49c4('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x49c4('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x49c4('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x49c4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x49c4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':_0x49c4('0x2c')},'systemAvatar':{'type':Sequelize[_0x49c4('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x49c4('0xd')],'comment':_0x49c4('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2d2510){if(!_0x2d2510)this[_0x49c4('0x1b')](_0x49c4('0x2e'),null);this[_0x49c4('0x1b')](_0x49c4('0x2f'),_0x2d2510);}},'vidaooEscalation':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x49c4('0x1')]},'vidaooTopic':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![],'defaultValue':_0x49c4('0x30')},'vidaooNote':{'type':Sequelize[_0x49c4('0x1')],'defaultValue':function(){return _0x49c4('0x31');}},'vidaooMetadata':{'type':Sequelize[_0x49c4('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x49c4('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x55e0=['CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','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!','Feedback','star','thumb','stringify','name','text','input','getDataValue','onlineForm','parse','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right'];(function(_0x4e5564,_0x8c8c66){var _0x5ed04b=function(_0x3b6e6b){while(--_0x3b6e6b){_0x4e5564['push'](_0x4e5564['shift']());}};_0x5ed04b(++_0x8c8c66);}(_0x55e0,0xdc));var _0x055e=function(_0x130d1f,_0x19dd78){_0x130d1f=_0x130d1f-0x0;var _0x577e83=_0x55e0[_0x130d1f];return _0x577e83;};'use strict';var Sequelize=require(_0x055e('0x0'));var rs=require(_0x055e('0x1'));module[_0x055e('0x2')]={'name':{'type':Sequelize[_0x055e('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x055e('0x3')]},'mapKey':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x4')},'mapKeyOffline':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x4')},'key':{'type':Sequelize[_0x055e('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x055e('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x055e('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x055e('0x3')],'allowNull':![],'defaultValue':_0x055e('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x055e('0x3')],'allowNull':![],'defaultValue':_0x055e('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x055e('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x055e('0x3')]},'animation':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x055e('0x9')]('rounded','squared'),'defaultValue':_0x055e('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0xb')},'start_chat_button':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xc')},'offline_chat_button':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xd')},'header_offline':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x055e('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x13')},'noteTitle':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x14')},'placeholderMessage':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x16')},'closingMessageButton':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xd')},'skipMessageButton':{'type':Sequelize[_0x055e('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x17')},'ratingType':{'type':Sequelize[_0x055e('0x9')](_0x055e('0x18'),_0x055e('0x19')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x055e('0x10')],'defaultValue':function(){return JSON[_0x055e('0x1a')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x055e('0x1b'),'type':_0x055e('0x1c'),'required':!![]},'props':{'title':_0x055e('0x1b'),'helpText':''}},{'type':_0x055e('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x055e('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x055e('0x1e')](_0x055e('0x1f'))?JSON[_0x055e('0x20')](this[_0x055e('0x1e')](_0x055e('0x1f'))):{};},'set':function(_0x4c653c){return this['setDataValue'](_0x055e('0x1f'),JSON[_0x055e('0x1a')](_0x4c653c));}},'offlineForm':{'type':Sequelize[_0x055e('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x055e('0x1d'),'props':{'title':_0x055e('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x055e('0x4'),'type':_0x055e('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x055e('0x21')},'props':{'title':'Comments','helpText':_0x055e('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x055e('0x1e')](_0x055e('0x23'))?JSON[_0x055e('0x20')](this[_0x055e('0x1e')]('offlineForm')):{};},'set':function(_0x99a372){return this[_0x055e('0x24')](_0x055e('0x23'),JSON[_0x055e('0x1a')](_0x99a372));}},'token':{'type':Sequelize[_0x055e('0x3')],'defaultValue':function(){return rs[_0x055e('0x25')]();}},'autoclose':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x055e('0x3')]},'forwardOffline':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x26')},'waitingMessage':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('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[_0x055e('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x29')},'sendUnmanaged':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x055e('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x055e('0x3')]},'notificationTemplate':{'type':Sequelize[_0x055e('0x10')],'defaultValue':function(){return _0x055e('0x2a');}},'notificationSound':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x055e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x2c')},'verticalAlignment':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x2d')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x2e')},'defaultTitle':{'type':Sequelize[_0x055e('0x3')]},'customerAvatar':{'type':Sequelize[_0x055e('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x055e('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x055e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x30')},'systemAvatar':{'type':Sequelize[_0x055e('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x055e('0x31')},'mandatoryDisposition':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1012a4){if(!_0x1012a4)this[_0x055e('0x24')](_0x055e('0x32'),null);this['setDataValue'](_0x055e('0x33'),_0x1012a4);}},'vidaooEscalation':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x055e('0x3')],'allowNull':![],'defaultValue':_0x055e('0x34')},'vidaooNote':{'type':Sequelize[_0x055e('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x055e('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x055e('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 1bd4b04..b8454fc 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 _0x4deb=['ChatWebsite','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','include','rows','show','params','mandatoryDispositionPause','keys','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','ChatWebsiteId','getDispositions','findOne','Disposition','nolimit','removeDispositions','ids','getAnswers','CannedAnswer','findAll','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','addCustomerAvatar','file','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','existsSync','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','Applications','List','account','applications','list','priority','contact','customerIp','cf-connecting-ip','headers','x-forwarded-for','first','firstName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','User','UserId','forcedOwnership','Start','startRouting','EventManager','notify','describe','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','utf8','render','offlineMessageBody','fromString','originalname','server','files','attachments','offline-chat','basename','sequelize','transaction','bulkCreate','MailServerOut','CloudProvider','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','openNewInteraction','MailAccountId','mimetype','toPairsIn','mapValues','lastName','Chat','NotifyMailAccount','notifyMail','remove','addInteraction','omit','getInteractions','Contact','Owner','internal','Tags','color','tag','Command','timezone','interval','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','No\x20timezone','inspect','getSnippet','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','License','increment','all','some','readFileSync','URL','address','3.1.0','remote','x-real-ip','connection','replace','alignment','verticalAlignment','color_button','hideWhenOffline','addApplications','Transaction','READ_COMMITTED','ChatApplication','findAndCountAll','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','online','false','offlineForm','onlineForm','items','fromKey','ChatOfflineMessage','Attachment','Attachments','addAgents','isArray','emit','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','url','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','update','ChatWebsites','UserProfileResource','destroy','status','stack','name','send','Pause','map'];(function(_0x2c984d,_0x5caefe){var _0x36a518=function(_0x5e2828){while(--_0x5e2828){_0x2c984d['push'](_0x2c984d['shift']());}};_0x36a518(++_0x5caefe);}(_0x4deb,0xee));var _0xb4de=function(_0x6dd5c,_0x4bfc19){_0x6dd5c=_0x6dd5c-0x0;var _0x5a87fa=_0x4deb[_0x6dd5c];return _0x5a87fa;};'use strict';var BPromise=require(_0xb4de('0x0'));var Mustache=require(_0xb4de('0x1'));var util=require(_0xb4de('0x2'));var path=require(_0xb4de('0x3'));var ejs=require(_0xb4de('0x4'));var fs=require('fs');var fs_extra=require(_0xb4de('0x5'));var _=require('lodash');var querystring=require(_0xb4de('0x6'));var Redis=require(_0xb4de('0x7'));var qs=require(_0xb4de('0x8'));var logger=require(_0xb4de('0x9'))(_0xb4de('0xa'));var config=require(_0xb4de('0xb'));var url=require(_0xb4de('0xc'));var db=require(_0xb4de('0xd'))['db'];config[_0xb4de('0xe')]=_[_0xb4de('0xf')](config[_0xb4de('0xe')],{'host':_0xb4de('0x10'),'port':0x18eb});var socket=require(_0xb4de('0x11'))(new Redis(config[_0xb4de('0xe')]));require(_0xb4de('0x12'))[_0xb4de('0x13')](socket);var htmlToText=require(_0xb4de('0x14'));var jayson=require(_0xb4de('0x15'));var client=jayson[_0xb4de('0x16')][_0xb4de('0x17')]({'port':0x232c});var client9002=jayson[_0xb4de('0x16')][_0xb4de('0x17')]({'port':0x232a});var client9003=jayson[_0xb4de('0x16')][_0xb4de('0x17')]({'port':0x232b});var client9001=jayson[_0xb4de('0x16')]['http']({'port':0x2329});function respondWithRpcPromise(_0x1192ed,_0x62470d,_0x4eecf7,_0x2d16b4){return new BPromise(function(_0xbfa13b,_0x562328){var _0x45c0ca=_0x2d16b4||client;return _0x45c0ca[_0xb4de('0x18')](_0x1192ed,_0x4eecf7)[_0xb4de('0x19')](function(_0x121116){logger[_0xb4de('0x1a')](_0xb4de('0x1b'),_0x62470d,'request\x20sent');logger[_0xb4de('0x1c')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x62470d,'request\x20sent',JSON[_0xb4de('0x1d')](_0x121116));if(_0x121116[_0xb4de('0x1e')]){if(_0x121116[_0xb4de('0x1e')]['code']===0x1f4){logger['error'](_0xb4de('0x1b'),_0x62470d,_0x121116[_0xb4de('0x1e')][_0xb4de('0x1f')]);return _0x562328(_0x121116[_0xb4de('0x1e')]['message']);}logger['error'](_0xb4de('0x1b'),_0x62470d,_0x121116[_0xb4de('0x1e')][_0xb4de('0x1f')]);return _0xbfa13b(_0x121116[_0xb4de('0x1e')][_0xb4de('0x1f')]);}else{logger['info'](_0xb4de('0x1b'),_0x62470d,_0xb4de('0x20'));_0xbfa13b(_0x121116[_0xb4de('0x21')][_0xb4de('0x1f')]);}})[_0xb4de('0x22')](function(_0x5adfe0){logger['error'](_0xb4de('0x1b'),_0x62470d,_0x5adfe0);_0x562328(_0x5adfe0);});});}function respondWithStatusCode(_0x1e5b14,_0x42eb61){_0x42eb61=_0x42eb61||0xcc;return function(_0x48d9dd){if(_0x48d9dd){return _0x1e5b14[_0xb4de('0x23')](_0x42eb61);}return _0x1e5b14['status'](_0x42eb61)[_0xb4de('0x24')]();};}function respondWithResult(_0x25cfc5,_0x3c19be){_0x3c19be=_0x3c19be||0xc8;return function(_0x57b86b){if(_0x57b86b){return _0x25cfc5['status'](_0x3c19be)[_0xb4de('0x25')](_0x57b86b);}};}function respondWithFilteredResult(_0x27182c,_0x1b81fb){return function(_0xca116a){if(_0xca116a){var _0x20dd1e=typeof _0x1b81fb[_0xb4de('0x26')]===_0xb4de('0x27')&&typeof _0x1b81fb[_0xb4de('0x28')]===_0xb4de('0x27');var _0x506e29=_0xca116a[_0xb4de('0x29')];var _0x4330ee=_0x20dd1e?0x0:_0x1b81fb[_0xb4de('0x26')];var _0x597eff=_0x20dd1e?_0xca116a[_0xb4de('0x29')]:_0x1b81fb[_0xb4de('0x26')]+_0x1b81fb[_0xb4de('0x28')];var _0x5c9259;if(_0x597eff>=_0x506e29){_0x597eff=_0x506e29;_0x5c9259=0xc8;}else{_0x5c9259=0xce;}_0x27182c['status'](_0x5c9259);return _0x27182c[_0xb4de('0x2a')](_0xb4de('0x2b'),_0x4330ee+'-'+_0x597eff+'/'+_0x506e29)[_0xb4de('0x25')](_0xca116a);}return null;};}function saveUpdates(_0x4649ad){return function(_0x4cfef5){if(_0x4cfef5){return _0x4cfef5[_0xb4de('0x2c')](_0x4649ad)[_0xb4de('0x19')](function(_0x4e79ac){return _0x4e79ac;});}return null;};}function removeEntity(_0x1c54f2){return function(_0x2fe897){if(_0x2fe897){return _0x2fe897['destroy']()[_0xb4de('0x19')](function(){var _0x164762=_0x2fe897['get']({'plain':!![]});var _0x1a9c95=_0xb4de('0x2d');return db[_0xb4de('0x2e')][_0xb4de('0x2f')]({'where':{'type':_0x1a9c95,'resourceId':_0x164762['id']}})[_0xb4de('0x19')](function(){return _0x2fe897;});})[_0xb4de('0x19')](function(){_0x1c54f2[_0xb4de('0x30')](0xcc)[_0xb4de('0x24')]();});}};}function handleEntityNotFound(_0xcb525){return function(_0xf29c90){if(!_0xf29c90){_0xcb525[_0xb4de('0x23')](0x194);}return _0xf29c90;};}function handleError(_0x126563,_0x38a3bd){_0x38a3bd=_0x38a3bd||0x1f4;return function(_0x27095b){logger['error'](_0x27095b[_0xb4de('0x31')]);if(_0x27095b['name']){delete _0x27095b[_0xb4de('0x32')];}_0x126563[_0xb4de('0x30')](_0x38a3bd)[_0xb4de('0x33')](_0x27095b);};}exports['index']=function(_0xa7f843,_0xca4ed3){var _0x30217c={'include':[{'model':db[_0xb4de('0x34')],'as':'mandatoryDispositionPause'}]},_0x122e3d={},_0x38cca8={'count':0x0,'rows':[]};var _0x4d9e43=_[_0xb4de('0x35')](db[_0xb4de('0x36')][_0xb4de('0x37')],function(_0x458fed){return{'name':_0x458fed[_0xb4de('0x38')],'type':_0x458fed['type'][_0xb4de('0x39')]};});_0x122e3d[_0xb4de('0x3a')]=_[_0xb4de('0x35')](_0x4d9e43,'name');_0x122e3d[_0xb4de('0x3b')]=_['keys'](_0xa7f843[_0xb4de('0x3b')]);_0x122e3d[_0xb4de('0x3c')]=_[_0xb4de('0x3d')](_0x122e3d[_0xb4de('0x3a')],_0x122e3d[_0xb4de('0x3b')]);_0x30217c[_0xb4de('0x3e')]=_[_0xb4de('0x3d')](_0x122e3d['model'],qs[_0xb4de('0x3f')](_0xa7f843['query'][_0xb4de('0x3f')]));_0x30217c['attributes']=_0x30217c['attributes'][_0xb4de('0x40')]?_0x30217c['attributes']:_0x122e3d[_0xb4de('0x3a')];if(!_0xa7f843['query'][_0xb4de('0x41')]('nolimit')){_0x30217c[_0xb4de('0x28')]=qs[_0xb4de('0x28')](_0xa7f843['query'][_0xb4de('0x28')]);_0x30217c[_0xb4de('0x26')]=qs[_0xb4de('0x26')](_0xa7f843['query'][_0xb4de('0x26')]);}_0x30217c[_0xb4de('0x42')]=qs[_0xb4de('0x43')](_0xa7f843[_0xb4de('0x3b')][_0xb4de('0x43')]);_0x30217c[_0xb4de('0x44')]=qs[_0xb4de('0x3c')](_[_0xb4de('0x45')](_0xa7f843[_0xb4de('0x3b')],_0x122e3d[_0xb4de('0x3c')]),_0x4d9e43);if(_0xa7f843[_0xb4de('0x3b')][_0xb4de('0x46')]){_0x30217c[_0xb4de('0x44')]=_[_0xb4de('0x47')](_0x30217c[_0xb4de('0x44')],{'$or':_[_0xb4de('0x35')](_0x4d9e43,function(_0x339c61){if(_0x339c61[_0xb4de('0x48')]!=='VIRTUAL'){var _0x4fe074={};_0x4fe074[_0x339c61[_0xb4de('0x32')]]={'$like':'%'+_0xa7f843[_0xb4de('0x3b')][_0xb4de('0x46')]+'%'};return _0x4fe074;}})});}_0x30217c=_['merge']({},_0x30217c,_0xa7f843['options']);var _0x537593={'where':_0x30217c['where']};return db[_0xb4de('0x36')][_0xb4de('0x29')](_0x537593)['then'](function(_0x308904){_0x38cca8[_0xb4de('0x29')]=_0x308904;if(_0xa7f843[_0xb4de('0x3b')]['includeAll']){_0x30217c[_0xb4de('0x49')]=[{'all':!![]}];}return db[_0xb4de('0x36')]['findAll'](_0x30217c);})['then'](function(_0x15d2fe){_0x38cca8[_0xb4de('0x4a')]=_0x15d2fe;return _0x38cca8;})[_0xb4de('0x19')](respondWithFilteredResult(_0xca4ed3,_0x30217c))[_0xb4de('0x22')](handleError(_0xca4ed3,null));};exports[_0xb4de('0x4b')]=function(_0x1fee65,_0x239ae4){var _0x4e604e={'raw':![],'where':{'id':_0x1fee65[_0xb4de('0x4c')]['id']},'include':[{'model':db['Pause'],'as':_0xb4de('0x4d')}]},_0x20a3bd={};_0x20a3bd[_0xb4de('0x3a')]=_[_0xb4de('0x4e')](db[_0xb4de('0x36')]['rawAttributes']);_0x20a3bd[_0xb4de('0x3b')]=_[_0xb4de('0x4e')](_0x1fee65[_0xb4de('0x3b')]);_0x20a3bd[_0xb4de('0x3c')]=_[_0xb4de('0x3d')](_0x20a3bd[_0xb4de('0x3a')],_0x20a3bd[_0xb4de('0x3b')]);_0x4e604e['attributes']=_['intersection'](_0x20a3bd[_0xb4de('0x3a')],qs['fields'](_0x1fee65[_0xb4de('0x3b')][_0xb4de('0x3f')]));_0x4e604e['attributes']=_0x4e604e[_0xb4de('0x3e')][_0xb4de('0x40')]?_0x4e604e['attributes']:_0x20a3bd[_0xb4de('0x3a')];if(_0x1fee65[_0xb4de('0x3b')][_0xb4de('0x4f')]){_0x4e604e[_0xb4de('0x49')]=[{'all':!![]}];}_0x4e604e=_[_0xb4de('0x47')]({},_0x4e604e,_0x1fee65[_0xb4de('0x50')]);return db['ChatWebsite']['find'](_0x4e604e)[_0xb4de('0x19')](handleEntityNotFound(_0x239ae4,null))['then'](respondWithResult(_0x239ae4,null))[_0xb4de('0x22')](handleError(_0x239ae4,null));};exports[_0xb4de('0x51')]=function(_0x8d4f52,_0x1e9472){return db[_0xb4de('0x36')]['create'](_0x8d4f52[_0xb4de('0x52')],{})[_0xb4de('0x19')](function(_0x37730d){var _0x220f89=_0x8d4f52[_0xb4de('0x53')]['get']({'plain':!![]});if(!_0x220f89)throw new Error(_0xb4de('0x54'));if(_0x220f89[_0xb4de('0x55')]===_0xb4de('0x53')){var _0x1af0fe=_0x37730d[_0xb4de('0x56')]({'plain':!![]});var _0x4f9da6='ChatWebsites';return db[_0xb4de('0x57')][_0xb4de('0x58')]({'where':{'name':_0x4f9da6,'userProfileId':_0x220f89[_0xb4de('0x59')]},'raw':!![]})['then'](function(_0x2a1a37){if(_0x2a1a37&&_0x2a1a37[_0xb4de('0x5a')]===0x0){return db[_0xb4de('0x2e')]['create']({'name':_0x1af0fe[_0xb4de('0x32')],'resourceId':_0x1af0fe['id'],'type':_0x2a1a37[_0xb4de('0x32')],'sectionId':_0x2a1a37['id']},{})[_0xb4de('0x19')](function(){return _0x37730d;});}else{return _0x37730d;}})[_0xb4de('0x22')](function(_0x194eb1){logger[_0xb4de('0x1e')](_0xb4de('0x5b'),_0x194eb1);throw _0x194eb1;});}return _0x37730d;})[_0xb4de('0x19')](respondWithResult(_0x1e9472,0xc9))[_0xb4de('0x22')](handleError(_0x1e9472,null));};exports[_0xb4de('0x2c')]=function(_0x3dc132,_0x268c79){if(_0x3dc132[_0xb4de('0x52')]['id']){delete _0x3dc132[_0xb4de('0x52')]['id'];}return db[_0xb4de('0x36')][_0xb4de('0x58')]({'where':{'id':_0x3dc132[_0xb4de('0x4c')]['id']},'include':[{'model':db[_0xb4de('0x34')],'as':_0xb4de('0x4d')}]})[_0xb4de('0x19')](handleEntityNotFound(_0x268c79,null))['then'](saveUpdates(_0x3dc132[_0xb4de('0x52')],null))[_0xb4de('0x19')](respondWithResult(_0x268c79,null))[_0xb4de('0x22')](handleError(_0x268c79,null));};exports['destroy']=function(_0x4f61bb,_0x40e79f){return db['ChatWebsite']['find']({'where':{'id':_0x4f61bb[_0xb4de('0x4c')]['id']}})[_0xb4de('0x19')](handleEntityNotFound(_0x40e79f,null))[_0xb4de('0x19')](removeEntity(_0x40e79f,null))[_0xb4de('0x22')](handleError(_0x40e79f,null));};exports['describe']=function(_0x31f5d9,_0x278114){return db[_0xb4de('0x36')]['describe']()[_0xb4de('0x19')](respondWithResult(_0x278114,null))['catch'](handleError(_0x278114,null));};exports['addDisposition']=function(_0x223ca0,_0x434902){if(_0x223ca0['body']['id']){delete _0x223ca0[_0xb4de('0x52')]['id'];}return db[_0xb4de('0x36')]['find']({'where':{'id':_0x223ca0[_0xb4de('0x4c')]['id']}})[_0xb4de('0x19')](handleEntityNotFound(_0x434902,null))[_0xb4de('0x19')](function(_0x14dac2){if(_0x14dac2){_0x223ca0['body'][_0xb4de('0x5c')]=_0x14dac2['id'];return db['Disposition']['create'](_0x223ca0[_0xb4de('0x52')]);}})[_0xb4de('0x19')](respondWithResult(_0x434902,null))['catch'](handleError(_0x434902,null));};exports[_0xb4de('0x5d')]=function(_0x13a444,_0x4efb9a){var _0x554b29={'raw':![],'where':{}};var _0x5a1583={};var _0x408a51={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xb4de('0x5e')]({'where':{'id':_0x13a444[_0xb4de('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4efb9a,null))['then'](function(_0x140411){if(_0x140411){_0x5a1583[_0xb4de('0x3a')]=_[_0xb4de('0x4e')](db[_0xb4de('0x5f')][_0xb4de('0x37')]);_0x5a1583[_0xb4de('0x3b')]=_[_0xb4de('0x4e')](_0x13a444[_0xb4de('0x3b')]);_0x5a1583[_0xb4de('0x3c')]=_[_0xb4de('0x3d')](_0x5a1583[_0xb4de('0x3a')],_0x5a1583[_0xb4de('0x3b')]);_0x554b29[_0xb4de('0x3e')]=_['intersection'](_0x5a1583['model'],qs[_0xb4de('0x3f')](_0x13a444[_0xb4de('0x3b')][_0xb4de('0x3f')]));_0x554b29[_0xb4de('0x3e')]=_0x554b29[_0xb4de('0x3e')][_0xb4de('0x40')]?_0x554b29[_0xb4de('0x3e')]:_0x5a1583['model'];if(!_0x13a444['query']['hasOwnProperty'](_0xb4de('0x60'))){_0x554b29[_0xb4de('0x28')]=qs[_0xb4de('0x28')](_0x13a444['query']['limit']);_0x554b29[_0xb4de('0x26')]=qs[_0xb4de('0x26')](_0x13a444[_0xb4de('0x3b')][_0xb4de('0x26')]);}_0x554b29[_0xb4de('0x42')]=qs[_0xb4de('0x43')](_0x13a444[_0xb4de('0x3b')]['sort']);_0x554b29['where']=qs[_0xb4de('0x3c')](_['pick'](_0x13a444[_0xb4de('0x3b')],_0x5a1583['filters']));_0x554b29['where']['ChatWebsiteId']=_0x140411['id'];if(_0x13a444[_0xb4de('0x3b')]['filter']){_0x554b29[_0xb4de('0x44')]=_[_0xb4de('0x47')](_0x554b29['where'],{'$or':_[_0xb4de('0x35')](_0x554b29[_0xb4de('0x3e')],function(_0x460ba1){var _0x3b6540={};_0x3b6540[_0x460ba1]={'$like':'%'+_0x13a444[_0xb4de('0x3b')][_0xb4de('0x46')]+'%'};return _0x3b6540;})});}_0x554b29=_[_0xb4de('0x47')]({},_0x554b29,_0x13a444[_0xb4de('0x50')]);return db[_0xb4de('0x5f')]['count']({'where':_0x554b29[_0xb4de('0x44')]})[_0xb4de('0x19')](function(_0x593b63){_0x408a51[_0xb4de('0x29')]=_0x593b63;if(_0x13a444[_0xb4de('0x3b')][_0xb4de('0x4f')]){_0x554b29[_0xb4de('0x49')]=[{'all':!![]}];}return db[_0xb4de('0x5f')]['findAll'](_0x554b29);})['then'](function(_0x1d779d){_0x408a51[_0xb4de('0x4a')]=_0x1d779d;return _0x408a51;});}})['then'](respondWithFilteredResult(_0x4efb9a,_0x554b29))[_0xb4de('0x22')](handleError(_0x4efb9a,null));};exports['removeDispositions']=function(_0x196df4,_0x4b8322){return db[_0xb4de('0x36')][_0xb4de('0x58')]({'where':{'id':_0x196df4[_0xb4de('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4b8322,null))['then'](function(_0x4050fd){if(_0x4050fd){return _0x4050fd[_0xb4de('0x61')](_0x196df4[_0xb4de('0x3b')][_0xb4de('0x62')]);}})[_0xb4de('0x19')](respondWithStatusCode(_0x4b8322,null))[_0xb4de('0x22')](handleError(_0x4b8322,null));};exports['addAnswer']=function(_0x29375b,_0x5ceefa){if(_0x29375b[_0xb4de('0x52')]['id']){delete _0x29375b[_0xb4de('0x52')]['id'];}return db[_0xb4de('0x36')][_0xb4de('0x58')]({'where':{'id':_0x29375b[_0xb4de('0x4c')]['id']}})[_0xb4de('0x19')](handleEntityNotFound(_0x5ceefa,null))[_0xb4de('0x19')](function(_0x2f400b){if(_0x2f400b){_0x29375b[_0xb4de('0x52')]['ChatWebsiteId']=_0x2f400b['id'];return db['CannedAnswer'][_0xb4de('0x51')](_0x29375b[_0xb4de('0x52')]);}})['then'](respondWithResult(_0x5ceefa,null))[_0xb4de('0x22')](handleError(_0x5ceefa,null));};exports[_0xb4de('0x63')]=function(_0x201530,_0x343f2d){var _0x15309d={'raw':![],'where':{}};var _0x534939={};var _0x54bf31={'count':0x0,'rows':[]};return db[_0xb4de('0x36')][_0xb4de('0x5e')]({'where':{'id':_0x201530[_0xb4de('0x4c')]['id']}})['then'](handleEntityNotFound(_0x343f2d,null))['then'](function(_0x2fc516){if(_0x2fc516){_0x534939['model']=_[_0xb4de('0x4e')](db[_0xb4de('0x64')]['rawAttributes']);_0x534939['query']=_[_0xb4de('0x4e')](_0x201530[_0xb4de('0x3b')]);_0x534939['filters']=_['intersection'](_0x534939[_0xb4de('0x3a')],_0x534939[_0xb4de('0x3b')]);_0x15309d[_0xb4de('0x3e')]=_[_0xb4de('0x3d')](_0x534939['model'],qs[_0xb4de('0x3f')](_0x201530[_0xb4de('0x3b')][_0xb4de('0x3f')]));_0x15309d[_0xb4de('0x3e')]=_0x15309d[_0xb4de('0x3e')][_0xb4de('0x40')]?_0x15309d['attributes']:_0x534939[_0xb4de('0x3a')];if(!_0x201530[_0xb4de('0x3b')][_0xb4de('0x41')]('nolimit')){_0x15309d[_0xb4de('0x28')]=qs[_0xb4de('0x28')](_0x201530[_0xb4de('0x3b')][_0xb4de('0x28')]);_0x15309d[_0xb4de('0x26')]=qs[_0xb4de('0x26')](_0x201530[_0xb4de('0x3b')][_0xb4de('0x26')]);}_0x15309d[_0xb4de('0x42')]=qs[_0xb4de('0x43')](_0x201530[_0xb4de('0x3b')]['sort']);_0x15309d[_0xb4de('0x44')]=qs[_0xb4de('0x3c')](_['pick'](_0x201530[_0xb4de('0x3b')],_0x534939['filters']));_0x15309d[_0xb4de('0x44')]['ChatWebsiteId']=_0x2fc516['id'];if(_0x201530[_0xb4de('0x3b')][_0xb4de('0x46')]){_0x15309d[_0xb4de('0x44')]=_[_0xb4de('0x47')](_0x15309d['where'],{'$or':_[_0xb4de('0x35')](_0x15309d[_0xb4de('0x3e')],function(_0x3480f5){var _0x53d339={};_0x53d339[_0x3480f5]={'$like':'%'+_0x201530[_0xb4de('0x3b')][_0xb4de('0x46')]+'%'};return _0x53d339;})});}_0x15309d=_[_0xb4de('0x47')]({},_0x15309d,_0x201530[_0xb4de('0x50')]);return db[_0xb4de('0x64')][_0xb4de('0x29')]({'where':_0x15309d[_0xb4de('0x44')]})[_0xb4de('0x19')](function(_0x533ab9){_0x54bf31[_0xb4de('0x29')]=_0x533ab9;if(_0x201530[_0xb4de('0x3b')][_0xb4de('0x4f')]){_0x15309d[_0xb4de('0x49')]=[{'all':!![]}];}return db['CannedAnswer'][_0xb4de('0x65')](_0x15309d);})[_0xb4de('0x19')](function(_0x417122){_0x54bf31[_0xb4de('0x4a')]=_0x417122;return _0x54bf31;});}})[_0xb4de('0x19')](respondWithFilteredResult(_0x343f2d,_0x15309d))[_0xb4de('0x22')](handleError(_0x343f2d,null));};exports[_0xb4de('0x66')]=function(_0x474be5,_0x2a6a0f){return db[_0xb4de('0x36')][_0xb4de('0x58')]({'where':{'id':_0x474be5[_0xb4de('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2a6a0f,null))[_0xb4de('0x19')](function(_0x1d4e0c){if(_0x1d4e0c){return _0x1d4e0c['removeAnswers'](_0x474be5[_0xb4de('0x3b')][_0xb4de('0x62')]);}})[_0xb4de('0x19')](respondWithStatusCode(_0x2a6a0f,null))[_0xb4de('0x22')](handleError(_0x2a6a0f,null));};exports[_0xb4de('0x67')]=function(_0x1a481e,_0x4eb525){_0x1a481e[_0xb4de('0x52')][_0xb4de('0x68')]=_0x1a481e['file'][_0xb4de('0x69')];return db[_0xb4de('0x36')][_0xb4de('0x58')]({'where':{'id':_0x1a481e[_0xb4de('0x4c')]['id']}})[_0xb4de('0x19')](handleEntityNotFound(_0x4eb525,null))[_0xb4de('0x19')](saveUpdates(_0x1a481e[_0xb4de('0x52')],null))['then'](respondWithResult(_0x4eb525,null))[_0xb4de('0x22')](handleError(_0x4eb525,null));};exports[_0xb4de('0x6a')]=function(_0x421074,_0x2006ad){_0x421074['body'][_0xb4de('0x6b')]=_0x421074['file']['filename'];return db[_0xb4de('0x36')]['find']({'where':{'id':_0x421074['params']['id']}})[_0xb4de('0x19')](handleEntityNotFound(_0x2006ad,null))[_0xb4de('0x19')](saveUpdates(_0x421074[_0xb4de('0x52')],null))[_0xb4de('0x19')](respondWithResult(_0x2006ad,null))[_0xb4de('0x22')](handleError(_0x2006ad,null));};exports[_0xb4de('0x6c')]=function(_0x209606,_0x40631a){_0x209606['body']['customerAvatar']=_0x209606[_0xb4de('0x6d')][_0xb4de('0x69')];return db[_0xb4de('0x36')][_0xb4de('0x58')]({'where':{'id':_0x209606['params']['id']}})[_0xb4de('0x19')](handleEntityNotFound(_0x40631a,null))['then'](saveUpdates(_0x209606[_0xb4de('0x52')],null))[_0xb4de('0x19')](respondWithResult(_0x40631a,null))['catch'](handleError(_0x40631a,null));};exports['addSystemAvatar']=function(_0x4bff58,_0x128b0b){_0x4bff58[_0xb4de('0x52')][_0xb4de('0x6e')]=_0x4bff58[_0xb4de('0x6d')][_0xb4de('0x69')];return db[_0xb4de('0x36')]['find']({'where':{'id':_0x4bff58[_0xb4de('0x4c')]['id']}})['then'](handleEntityNotFound(_0x128b0b,null))[_0xb4de('0x19')](saveUpdates(_0x4bff58[_0xb4de('0x52')],null))[_0xb4de('0x19')](respondWithResult(_0x128b0b,null))['catch'](handleError(_0x128b0b,null));};exports[_0xb4de('0x6f')]=function(_0x31dd47,_0x2d0049){var _0x41e9d0=path[_0xb4de('0x70')](config[_0xb4de('0x71')],_0xb4de('0x72'));var _0x64a029={'where':{'id':_0x31dd47[_0xb4de('0x4c')]['id']},'attributes':['id',_0xb4de('0x68')],'raw':!![]};var _0x221976=![];return require('../../config/license/util')[_0xb4de('0x73')]()[_0xb4de('0x19')](function(_0x32f07b){if(_0x32f07b){_0x221976=_0x32f07b[_0xb4de('0x74')];}})[_0xb4de('0x19')](function(){return db['ChatWebsite'][_0xb4de('0x58')](_0x64a029);})[_0xb4de('0x19')](handleEntityNotFound(_0x2d0049,null))[_0xb4de('0x19')](function(_0x4026ea){if(_0x4026ea){if(!_['isNil'](_0x4026ea[_0xb4de('0x68')])){if(fs['existsSync'](path[_0xb4de('0x70')](config[_0xb4de('0x71')],_0xb4de('0x75'),_0x4026ea[_0xb4de('0x68')]))&&_0x221976){_0x41e9d0=path[_0xb4de('0x70')](config[_0xb4de('0x71')],_0xb4de('0x75'),_0x4026ea[_0xb4de('0x68')]);}}return _0x2d0049[_0xb4de('0x76')](_0x41e9d0);}})[_0xb4de('0x22')](handleError(_0x2d0049,null));};exports[_0xb4de('0x77')]=function(_0x41e1ee,_0xa33eb4){var _0x3ef0f1=path[_0xb4de('0x70')](config[_0xb4de('0x71')],_0xb4de('0x78'));var _0x440150={'where':{'id':_0x41e1ee['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite'][_0xb4de('0x58')](_0x440150)[_0xb4de('0x19')](handleEntityNotFound(_0xa33eb4,null))[_0xb4de('0x19')](function(_0x22e776){if(_0x22e776){if(!_[_0xb4de('0x79')](_0x22e776[_0xb4de('0x6b')])){if(fs[_0xb4de('0x7a')](path[_0xb4de('0x70')](config[_0xb4de('0x71')],'server/files/images/avatars/',_0x22e776['agentAvatar']))){_0x3ef0f1=path['join'](config[_0xb4de('0x71')],_0xb4de('0x7b'),_0x22e776['agentAvatar']);}}return _0xa33eb4[_0xb4de('0x76')](_0x3ef0f1);}})['catch'](handleError(_0xa33eb4,null));};exports['getCustomerAvatar']=function(_0x82f655,_0x1517c0){var _0x57205c=path[_0xb4de('0x70')](config[_0xb4de('0x71')],_0xb4de('0x7c'));var _0x563fed={'where':{'id':_0x82f655['params']['id']},'attributes':['id',_0xb4de('0x7d'),_0xb4de('0x7e')],'raw':!![]};return db[_0xb4de('0x36')][_0xb4de('0x58')](_0x563fed)[_0xb4de('0x19')](handleEntityNotFound(_0x1517c0,null))[_0xb4de('0x19')](function(_0x1d4577){if(_0x1d4577){if(!_[_0xb4de('0x79')](_0x1d4577[_0xb4de('0x7d')])){if(fs['existsSync'](path[_0xb4de('0x70')](config[_0xb4de('0x71')],_0xb4de('0x7b'),_0x1d4577[_0xb4de('0x7d')]))&&_0x1d4577[_0xb4de('0x7e')]){_0x57205c=path[_0xb4de('0x70')](config[_0xb4de('0x71')],'server/files/images/avatars/',_0x1d4577[_0xb4de('0x7d')]);}}return _0x1517c0[_0xb4de('0x76')](_0x57205c);}})['catch'](handleError(_0x1517c0,null));};exports[_0xb4de('0x7f')]=function(_0x48c93c,_0x4ea5c9){var _0x1207b8=path[_0xb4de('0x70')](config[_0xb4de('0x71')],_0xb4de('0x80'));var _0xe40472={'where':{'id':_0x48c93c['params']['id']},'attributes':['id',_0xb4de('0x6e')],'raw':!![]};return db[_0xb4de('0x36')][_0xb4de('0x58')](_0xe40472)[_0xb4de('0x19')](handleEntityNotFound(_0x4ea5c9,null))[_0xb4de('0x19')](function(_0x27fb06){if(_0x27fb06){if(!_['isNil'](_0x27fb06['systemAvatar'])){if(fs[_0xb4de('0x7a')](path['join'](config['root'],_0xb4de('0x7b'),_0x27fb06['systemAvatar']))){_0x1207b8=path[_0xb4de('0x70')](config['root'],_0xb4de('0x7b'),_0x27fb06['systemAvatar']);}}return _0x4ea5c9[_0xb4de('0x76')](_0x1207b8);}})[_0xb4de('0x22')](handleError(_0x4ea5c9,null));};exports['notify']=function(_0x2b6a2b,_0x30ae35){var _0x52db3d=require('user-agent-parser');var _0x33400a=new _0x52db3d();var _0x331ada=_0x33400a['setUA'](_0x2b6a2b['headers'][_0xb4de('0x81')])[_0xb4de('0x82')]();var _0x31c4f7={'body':_0x2b6a2b[_0xb4de('0x52')],'channel':'chat'};var _0x35b145=[];var _0x7d954a=[];var _0x215586={};var _0x2002b6=![];return db[_0xb4de('0x83')]['describe']()['then'](function(_0x82138){if(!_0x82138){throw new db[(_0xb4de('0x84'))][(_0xb4de('0x85'))](_0xb4de('0x86'));}_0x35b145=_[_0xb4de('0x87')](_[_0xb4de('0x4e')](_0x82138),[_0xb4de('0x88'),'updatedAt']);_0x7d954a=_['difference'](_[_0xb4de('0x4e')](_0x82138),[_0xb4de('0x88'),_0xb4de('0x89'),_0xb4de('0x8a'),_0xb4de('0x8b')]);if(_0x2b6a2b['body']['id']){delete _0x2b6a2b[_0xb4de('0x52')]['id'];}if(_[_0xb4de('0x79')](_0x2b6a2b['body'][_0xb4de('0x8c')])){throw new db[(_0xb4de('0x84'))][(_0xb4de('0x85'))](_0xb4de('0x8d'));}if(_[_0xb4de('0x79')](_0x2b6a2b[_0xb4de('0x52')][_0xb4de('0x52')])||_0x2b6a2b[_0xb4de('0x52')][_0xb4de('0x52')]===''){throw new db[(_0xb4de('0x84'))][(_0xb4de('0x85'))](_0xb4de('0x8e'));}if(_[_0xb4de('0x79')](_0x2b6a2b[_0xb4de('0x52')][_0xb4de('0x8f')])){throw new db[(_0xb4de('0x84'))][(_0xb4de('0x85'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x7d954a);}if(!_[_0xb4de('0x90')](_0x7d954a,_0x2b6a2b[_0xb4de('0x52')]['mapKey'])){throw new db['Sequelize'][(_0xb4de('0x85'))](_0xb4de('0x91')+_0x7d954a);}_0x215586[_0x2b6a2b[_0xb4de('0x52')][_0xb4de('0x8f')]]=_0x2b6a2b[_0xb4de('0x52')][_0xb4de('0x8c')];})[_0xb4de('0x19')](function(){return db[_0xb4de('0x36')]['find']({'where':{'id':_0x2b6a2b[_0xb4de('0x4c')]['id']},'include':[{'model':db[_0xb4de('0x92')],'as':'List','include':[{'model':db[_0xb4de('0x83')],'as':_0xb4de('0x93'),'where':_0x215586,'limit':0x1,'order':[[_0xb4de('0x89'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0xb4de('0x94')}]});})['then'](handleEntityNotFound(_0x30ae35,null))[_0xb4de('0x19')](function(_0x30fa86){if(_0x30fa86&&_0x30fa86[_0xb4de('0x95')]){_0x31c4f7[_0xb4de('0x96')]=_0x30fa86;_0x31c4f7[_0xb4de('0x97')]=_0x30fa86['Applications'];_0x31c4f7[_0xb4de('0x98')]=_0x30fa86[_0xb4de('0x95')];_0x31c4f7[_0xb4de('0x97')]=_['orderBy'](_0x31c4f7[_0xb4de('0x97')],[_0xb4de('0x99')],['asc']);if(_0x31c4f7['account'][_0xb4de('0x94')]){delete _0x31c4f7[_0xb4de('0x96')][_0xb4de('0x94')];}if(_0x31c4f7['account']['List']&&_0x31c4f7[_0xb4de('0x96')]['List'][_0xb4de('0x93')][_0xb4de('0x40')]){return _0x31c4f7[_0xb4de('0x96')][_0xb4de('0x95')][_0xb4de('0x93')][0x0];}var _0x5a2cf0=_['defaults'](_0x2b6a2b[_0xb4de('0x52')],{'firstName':_0x2b6a2b[_0xb4de('0x52')][_0xb4de('0x8c')],'ListId':_0x30fa86[_0xb4de('0x8b')]});_0x5a2cf0[_0x2b6a2b[_0xb4de('0x52')][_0xb4de('0x8f')]]=_0x2b6a2b[_0xb4de('0x52')]['from'];return db['CmContact'][_0xb4de('0x51')](_0x5a2cf0,{'fields':_0x35b145,'raw':!![]});}})[_0xb4de('0x19')](handleEntityNotFound(_0x30ae35,null))[_0xb4de('0x19')](function(_0x3349ea){_0x31c4f7[_0xb4de('0x9a')]=_0x3349ea;var _0x4fd1c8=_0x2b6a2b[_0xb4de('0x52')][_0xb4de('0x9b')];if(_0x2b6a2b['headers'][_0xb4de('0x9c')]){_0x4fd1c8=_0x2b6a2b[_0xb4de('0x9d')][_0xb4de('0x9c')];}else if(_0x2b6a2b[_0xb4de('0x9d')][_0xb4de('0x9e')]){_0x4fd1c8=_[_0xb4de('0x9f')](_0x2b6a2b['headers'][_0xb4de('0x9e')]['split'](','));}if(_0x3349ea){var _0x6cd38b={'ContactId':_0x3349ea['id'],'ChatWebsiteId':_0x2b6a2b[_0xb4de('0x4c')]['id'],'from':(_0x3349ea[_0xb4de('0xa0')]||'')+'\x20'+(_0x3349ea['lastName']||''),'customerIp':_0x4fd1c8,'customerPort':_0x2b6a2b['headers'][_0xb4de('0xa1')]?_0x2b6a2b[_0xb4de('0x9d')]['x-real-port']:null,'referer':_0x2b6a2b[_0xb4de('0x52')][_0xb4de('0xa2')],'browserName':_0x331ada[_0xb4de('0xa3')][_0xb4de('0x32')]&&_0x331ada['browser']['version']?util[_0xb4de('0xa4')](_0xb4de('0xa5'),_0x331ada[_0xb4de('0xa3')][_0xb4de('0x32')],_0x331ada[_0xb4de('0xa3')][_0xb4de('0xa6')]):_0xb4de('0xa7'),'browserVersion':_0x331ada[_0xb4de('0xa3')][_0xb4de('0xa6')]||_0xb4de('0xa7'),'osName':util['format'](_0xb4de('0xa5'),_0x331ada['os'][_0xb4de('0x32')],_0x331ada['os'][_0xb4de('0xa6')]),'osVersion':_0x331ada['os'][_0xb4de('0xa6')],'deviceModel':_0x331ada[_0xb4de('0xa8')][_0xb4de('0x3a')]&&_0x331ada[_0xb4de('0xa8')][_0xb4de('0xa9')]?util[_0xb4de('0xa4')](_0xb4de('0xaa'),_0x331ada[_0xb4de('0xa8')][_0xb4de('0x3a')],_0x331ada['device'][_0xb4de('0xa9')],_0x331ada[_0xb4de('0xa8')]['type']):null,'deviceVendor':_0x331ada[_0xb4de('0xa8')][_0xb4de('0xa9')],'deviceType':_0x331ada[_0xb4de('0xa8')]['type'],'formData':JSON[_0xb4de('0x1d')](_0x2b6a2b[_0xb4de('0x52')])};var _0x21430b={'ChatWebsiteId':_0x2b6a2b['params']['id'],'closed':![]};if(_0x2b6a2b[_0xb4de('0x52')]['threadId']){_0x21430b['threadId']=_0x2b6a2b[_0xb4de('0x52')][_0xb4de('0xab')];return db[_0xb4de('0xac')][_0xb4de('0x58')]({'where':_0x21430b})[_0xb4de('0x19')](function(_0x3da766){if(_0x3da766){return[_0x3da766,![]];}_0x6cd38b['threadId']=_0x2b6a2b['body'][_0xb4de('0xab')];_0x6cd38b[_0xb4de('0xad')]=_0x2b6a2b[_0xb4de('0x52')][_0xb4de('0xad')];return db['ChatInteraction'][_0xb4de('0x51')](_0x6cd38b)[_0xb4de('0x19')](function(_0x5ac2bf){return[_0x5ac2bf,!![]];});});}_0x21430b[_0xb4de('0xae')]=_0x3349ea['id'];if(_0x2b6a2b['body'][_0xb4de('0xaf')]&&_0x2b6a2b['body'][_0xb4de('0xaf')]['id']){_0x21430b['id']=_0x2b6a2b[_0xb4de('0x52')][_0xb4de('0xaf')]['id'];return db[_0xb4de('0xac')][_0xb4de('0x58')]({'where':_0x21430b})[_0xb4de('0x19')](function(_0x39903a){if(_0x39903a){return[_0x39903a,![]];}return db[_0xb4de('0xac')][_0xb4de('0x51')](_0x6cd38b)['then'](function(_0x2265a5){return[_0x2265a5,!![]];});});}return db[_0xb4de('0xac')][_0xb4de('0x51')](_0x6cd38b)[_0xb4de('0x19')](function(_0xcfedfd){return[_0xcfedfd,!![]];});}})[_0xb4de('0xb0')](function(_0x31eac7,_0x476777){if(_0x31eac7){_0x2002b6=_0x476777;if(!_0x476777){var _0x34b1aa={'from':(_0x31c4f7['contact'][_0xb4de('0xa0')]||'')+'\x20'+(_0x31c4f7[_0xb4de('0x9a')]['lastName']||'')};if(_0x2b6a2b[_0xb4de('0x52')]['threadId']&&_0x2b6a2b[_0xb4de('0x52')]['messageId']&&_0x2b6a2b[_0xb4de('0x52')][_0xb4de('0xab')]!=_0x2b6a2b[_0xb4de('0x52')][_0xb4de('0xb1')]){_0x34b1aa['threadId']=_0x2b6a2b['body'][_0xb4de('0xb1')];}return _0x31eac7['update'](_0x34b1aa);}else{return _0x31eac7;}}})['then'](function(_0x39bbde){_0x31c4f7[_0xb4de('0xaf')]=_0x39bbde[_0xb4de('0x56')]({'plain':!![]});_0x31c4f7['interaction'][_0xb4de('0xb2')]=_0x2002b6;if(_0x31c4f7[_0xb4de('0xaf')]['created']){if(_0x31c4f7[_0xb4de('0x96')][_0xb4de('0xb3')]){_0x31c4f7[_0xb4de('0x97')][_0xb4de('0xb4')]({'id':0x0,'priority':_0x31c4f7[_0xb4de('0x97')][_0xb4de('0x40')]+0x1,'app':_0xb4de('0xb5'),'appdata':_0xb4de('0xb6'),'interval':_0xb4de('0xb7')});}}return db[_0xb4de('0xb8')][_0xb4de('0x51')]({'body':_0x2b6a2b[_0xb4de('0x52')][_0xb4de('0x52')],'ChatWebsiteId':_0x2b6a2b['params']['id'],'ChatInteractionId':_0x39bbde['id'],'direction':'in','ContactId':_0x31c4f7[_0xb4de('0x9a')]['id'],'AttachmentId':_0x2b6a2b[_0xb4de('0x52')]['AttachmentId']});})[_0xb4de('0x19')](function(_0x22c3f1){_0x31c4f7['message']=_0x22c3f1;if(_0x31c4f7['interaction']['UserId']){return db[_0xb4de('0xb9')][_0xb4de('0x58')]({'attributes':['id',_0xb4de('0x32')],'where':{'id':_0x31c4f7[_0xb4de('0xaf')][_0xb4de('0xba')]}})[_0xb4de('0x19')](function(_0x3badd5){if(_0x3badd5){_0x31c4f7[_0xb4de('0x97')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3badd5[_0xb4de('0x32')]+','+(_0x31c4f7[_0xb4de('0x96')]['waitForTheAssignedAgent']||0xa),'interval':_0xb4de('0xb7')});_0x31c4f7[_0xb4de('0xbb')]=!![];}return respondWithRpcPromise(_0xb4de('0xbc'),_0xb4de('0xbd'),_0x31c4f7);});}return respondWithRpcPromise(_0xb4de('0xbc'),_0xb4de('0xbd'),_0x31c4f7);})['then'](function(_0x2e2df9){respondWithRpcPromise(_0xb4de('0xbe'),_0xb4de('0xbe'),{'event':_0xb4de('0xbf'),'message':_0x2e2df9},client9002);return _0x2e2df9;})['then'](respondWithResult(_0x30ae35,null))[_0xb4de('0x22')](handleError(_0x30ae35,null));};exports['offline']=function(_0x3b0766,_0xd2a88c){var _0x5eb884,_0x1440ba,_0x5a27ec;var _0x3cfa08=[];var _0x19a1bc={};var _0x176e79=_0x3b0766['files']||[];var _0x17726b=[];var _0x118b34;return db['CmContact'][_0xb4de('0xc0')]()['then'](function(_0x172338){if(!_0x172338){throw new db['Sequelize']['ValidationError'](_0xb4de('0x86'));}_0x3cfa08=_[_0xb4de('0x87')](_[_0xb4de('0x4e')](_0x172338),['createdAt',_0xb4de('0x89'),_0xb4de('0x8a'),'ListId']);if(_0x3b0766[_0xb4de('0x52')]['id']){delete _0x3b0766[_0xb4de('0x52')]['id'];}if(_[_0xb4de('0x79')](_0x3b0766['body'][_0xb4de('0x8c')])){throw _0xd2a88c[_0xb4de('0x30')](0x1f4)['send'](new db[(_0xb4de('0x84'))][(_0xb4de('0x85'))](_0xb4de('0x8d')));}if(_[_0xb4de('0x79')](_0x3b0766[_0xb4de('0x52')]['body'])||_0x3b0766[_0xb4de('0x52')][_0xb4de('0x52')]===''){throw _0xd2a88c[_0xb4de('0x30')](0x1f4)[_0xb4de('0x33')](new db[(_0xb4de('0x84'))][(_0xb4de('0x85'))](_0xb4de('0x8e')));}if(_['isNil'](_0x3b0766[_0xb4de('0x52')]['mapKeyOffline'])){throw _0xd2a88c[_0xb4de('0x30')](0x1f4)[_0xb4de('0x33')](new db['Sequelize'][(_0xb4de('0x85'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3cfa08));}if(!_[_0xb4de('0x90')](_0x3cfa08,_0x3b0766[_0xb4de('0x52')][_0xb4de('0xc1')])){throw _0xd2a88c[_0xb4de('0x30')](0x1f4)[_0xb4de('0x33')](new db[(_0xb4de('0x84'))]['ValidationError'](_0xb4de('0xc2')+_0x3cfa08));}_0x19a1bc[_0x3b0766['body'][_0xb4de('0xc1')]]=_0x3b0766[_0xb4de('0x52')]['from'];})[_0xb4de('0x19')](function(){return db[_0xb4de('0x36')][_0xb4de('0x58')]({'where':{'id':_0x3b0766['params']['id']},'include':[{'model':db['CmList'],'as':_0xb4de('0x95')},{'model':db[_0xb4de('0xc3')],'as':_0xb4de('0xc3')}]});})['then'](handleEntityNotFound(_0xd2a88c,null))['then'](function(_0x5ce511){if(_0x5ce511&&_0x5ce511['List']){_0x1440ba=_0x5ce511;var _0x5ef4fa=_[_0xb4de('0xf')](_0x3b0766['body'],{'firstName':_0x3b0766[_0xb4de('0x52')][_0xb4de('0x8c')],'phone':_0x3b0766[_0xb4de('0x52')][_0xb4de('0x8c')],'ListId':_0x5ce511[_0xb4de('0x8b')]});_0x5ef4fa[_0x3b0766[_0xb4de('0x52')][_0xb4de('0xc1')]]=_0x3b0766[_0xb4de('0x52')][_0xb4de('0x8c')];return db[_0xb4de('0x83')][_0xb4de('0xc4')]({'where':_0x19a1bc,'defaults':_0x5ef4fa});}})['spread'](function(_0x1f11dc){if(_0x1f11dc){_0x5a27ec=_0x1f11dc;var _0x14e1f2=fs['readFileSync'](path[_0xb4de('0x70')](config[_0xb4de('0x71')],'server/files/templates/chatOfflineMessage.ejs'),_0xb4de('0xc5'));var _0x4fa15c=ejs[_0xb4de('0xc6')](_0x14e1f2,{'body':_['toPairs'](_0x3b0766[_0xb4de('0x52')][_0xb4de('0x52')]),'bodyTitle':_0x1440ba[_0xb4de('0xc7')]});return db['ChatOfflineMessage']['create']({'body':_0x4fa15c,'plainBody':htmlToText[_0xb4de('0xc8')](_0x4fa15c),'ContactId':_0x1f11dc['id'],'ChatWebsiteId':_0x1440ba['id']});}})['then'](function(_0x3776c7){_0x118b34=_0x3776c7;if(_0x176e79[_0xb4de('0x40')]){var _0x3e0657=_0x176e79['map'](function(_0x58a058){return{'name':_0x58a058[_0xb4de('0xc9')],'basename':_0x58a058[_0xb4de('0x69')],'type':_0x58a058['mimetype'],'ChatOfflineMessageId':_0x3776c7['id']};});_0x17726b=_0x3e0657[_0xb4de('0x35')](_0x47632a=>{var _0x3954a3={'filename':_0x47632a['name'],'path':path[_0xb4de('0x70')](config[_0xb4de('0x71')],_0xb4de('0xca'),_0xb4de('0xcb'),_0xb4de('0xcc'),_0xb4de('0xcd'),_0x47632a[_0xb4de('0xce')])};return _0x3954a3;});if(!_0x1440ba['openNewInteraction']){return db[_0xb4de('0xcf')][_0xb4de('0xd0')](function(_0x3c7f23){return db['Attachment'][_0xb4de('0xd1')](_0x3e0657,{'transaction':_0x3c7f23});});}}})['then'](function(){if(_0x118b34){_0x5eb884=_0x118b34;return db[_0xb4de('0xc3')][_0xb4de('0x5e')]({'where':{'service':!![]},'include':[{'model':db[_0xb4de('0xd2')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xb4de('0xd3')],'as':_0xb4de('0xd3'),'raw':!![]}]}]});}})[_0xb4de('0x19')](function(_0x536de6){if(_0x536de6&&_0x536de6[_0xb4de('0xd4')]&&_0x1440ba[_0xb4de('0xd5')]&&_0x1440ba[_0xb4de('0xd6')]){var _0x51e038=_0x536de6[_0xb4de('0xd7')]();return respondWithRpcPromise(_0xb4de('0xd8'),_0xb4de('0xd9'),{'account':_0x51e038,'message':{'from':util[_0xb4de('0xa4')](_0xb4de('0xda'),_0x536de6['name'],_0x536de6[_0xb4de('0xdb')]||_0x536de6[_0xb4de('0xd4')][_0xb4de('0x53')]),'to':_0x1440ba[_0xb4de('0xd6')],'subject':_0x1440ba[_0xb4de('0xdc')],'html':_0x5eb884['body'],'attachments':_0x17726b}},client9003)[_0xb4de('0x19')](function(){return _0x5eb884;})['catch'](function(_0x2def6c){logger['error'](_0x2def6c);});}})[_0xb4de('0x19')](function(){if(_0x1440ba&&_0x1440ba[_0xb4de('0xdd')]&&_0x1440ba[_0xb4de('0xde')]){var _0xe8865=[];if(_0x176e79['length']){_0xe8865=_0x176e79['map'](function(_0x389b5b){return{'name':_0x389b5b['originalname'],'basename':_0x389b5b[_0xb4de('0x69')],'type':_0x389b5b[_0xb4de('0xdf')],'ChatOfflineMessageId':_0x118b34['id']};});}var _0x1d04ac;if(!_[_0xb4de('0x79')](_0x1440ba['subjectOffline'])){var _0x14df2a=_[_0xb4de('0x35')](_0x3b0766[_0xb4de('0x52')],function(_0x428d28){return _0x428d28;});var _0x328b22=_[_0xb4de('0xe0')](_0x14df2a)[0x0];var _0x3440ba=_[_0xb4de('0xe1')](_0x328b22,function(_0x1bf889){return _0x1bf889;});_0x1d04ac=_0x3440ba[0x1][_0x1440ba['subjectOffline']];}var _0x2607de={'from':_0x5a27ec[_0xb4de('0xdb')],'firstName':_0x5a27ec[_0xb4de('0xa0')],'lastName':_0x5a27ec[_0xb4de('0xe2')],'mapKey':_0xb4de('0xdb'),'message':{'from':_0x5a27ec[_0xb4de('0xdb')],'to':_0x1440ba[_0xb4de('0xc3')][_0xb4de('0xdb')],'cc':'','subject':_[_0xb4de('0x79')](_0x1d04ac)?_0x1440ba[_0xb4de('0xdc')]:_0x1d04ac,'messageId':'','sentAt':new Date(),'attach':_0xe8865[_0xb4de('0x40')],'attachments':_0xe8865,'originChannel':_0xb4de('0xe3'),'ChatWebsiteId':_0x1440ba['id'],'ChatOfflineMessageId':_0x5eb884['id'],'originTo':_0x1440ba['MailAccount'][_0xb4de('0xdb')]},'body':_0x5eb884[_0xb4de('0x52')]};var _0x2a37dc={'account':{'id':_0x1440ba[_0xb4de('0xde')]},'body':_0x2607de,'log':_0xb4de('0xe4')};return respondWithRpcPromise(_0xb4de('0xe4'),_0xb4de('0xe5'),_0x2a37dc,client9001)[_0xb4de('0x19')](function(){return _0x5eb884;})[_0xb4de('0x22')](function(_0x2dcbe2){logger[_0xb4de('0x1e')](_0x2dcbe2);});}return;})[_0xb4de('0x19')](function(){if(_0x5eb884){return _0x5eb884;}})[_0xb4de('0x19')](respondWithResult(_0xd2a88c,null))['catch'](function(_0x421fcb){logger[_0xb4de('0x1e')](_0xb4de('0x22'),_0x421fcb);for(var _0x334c14 of _0x176e79){var _0x4ab5a0=path['join'](config[_0xb4de('0x71')],'server',_0xb4de('0xcb'),_0xb4de('0xcc'),_0xb4de('0xcd'),_0x334c14[_0xb4de('0x69')]);fs_extra[_0xb4de('0xe6')](_0x4ab5a0)[_0xb4de('0x22')](function(_0x37f4d2){logger['error']('Could\x20not\x20remove\x20attachment\x20file',_0x4ab5a0,_0x37f4d2);});}});};exports[_0xb4de('0xe7')]=function(_0x109c27,_0x213230){return db[_0xb4de('0xac')][_0xb4de('0x58')]({'where':{'id':_0x109c27[_0xb4de('0x4c')]['id']}})[_0xb4de('0x19')](handleEntityNotFound(_0x213230,null))[_0xb4de('0x19')](function(_0x21b616){if(_0x21b616){return _0x21b616[_0xb4de('0xe7')](_0x109c27[_0xb4de('0x52')][_0xb4de('0x62')],_[_0xb4de('0xe8')](_0x109c27[_0xb4de('0x52')],[_0xb4de('0x62'),'id'])||{});}})[_0xb4de('0x19')](respondWithResult(_0x213230,null))[_0xb4de('0x22')](handleError(_0x213230,null));};exports[_0xb4de('0xe9')]=function(_0x417cdf,_0xca7454){var _0x4259a4={'raw':![],'where':{}};var _0x110cc6={};var _0x291a15={'count':0x0,'rows':[]};return db[_0xb4de('0x36')]['findOne']({'where':{'id':_0x417cdf[_0xb4de('0x4c')]['id']}})[_0xb4de('0x19')](handleEntityNotFound(_0xca7454,null))['then'](function(_0x4239fa){if(_0x4239fa){_0x110cc6[_0xb4de('0x3a')]=_[_0xb4de('0x4e')](db[_0xb4de('0xac')][_0xb4de('0x37')]);_0x110cc6['query']=_[_0xb4de('0x4e')](_0x417cdf[_0xb4de('0x3b')]);_0x110cc6['filters']=_[_0xb4de('0x3d')](_0x110cc6[_0xb4de('0x3a')],_0x110cc6[_0xb4de('0x3b')]);_0x4259a4[_0xb4de('0x3e')]=_[_0xb4de('0x3d')](_0x110cc6[_0xb4de('0x3a')],qs['fields'](_0x417cdf[_0xb4de('0x3b')]['fields']));_0x4259a4[_0xb4de('0x3e')]=_0x4259a4[_0xb4de('0x3e')][_0xb4de('0x40')]?_0x4259a4[_0xb4de('0x3e')]:_0x110cc6[_0xb4de('0x3a')];if(!_0x417cdf[_0xb4de('0x3b')][_0xb4de('0x41')](_0xb4de('0x60'))){_0x4259a4[_0xb4de('0x28')]=qs[_0xb4de('0x28')](_0x417cdf[_0xb4de('0x3b')][_0xb4de('0x28')]);_0x4259a4[_0xb4de('0x26')]=qs[_0xb4de('0x26')](_0x417cdf[_0xb4de('0x3b')][_0xb4de('0x26')]);}_0x4259a4[_0xb4de('0x42')]=qs[_0xb4de('0x43')](_0x417cdf[_0xb4de('0x3b')][_0xb4de('0x43')]);_0x4259a4[_0xb4de('0x44')]=qs['filters'](_[_0xb4de('0x45')](_0x417cdf['query'],_0x110cc6[_0xb4de('0x3c')]));_0x4259a4[_0xb4de('0x44')]['ChatWebsiteId']=_0x4239fa['id'];if(_0x417cdf[_0xb4de('0x3b')][_0xb4de('0x46')]){_0x4259a4['where']=_[_0xb4de('0x47')](_0x4259a4[_0xb4de('0x44')],{'$or':_[_0xb4de('0x35')](_0x4259a4[_0xb4de('0x3e')],function(_0x6bd608){var _0x4d8a6e={};_0x4d8a6e[_0x6bd608]={'$like':'%'+_0x417cdf['query']['filter']+'%'};return _0x4d8a6e;})});}_0x4259a4=_['merge']({},_0x4259a4,_0x417cdf['options']);return db['ChatInteraction'][_0xb4de('0x29')]({'where':_0x4259a4[_0xb4de('0x44')]})['then'](function(_0x5dcda6){_0x291a15[_0xb4de('0x29')]=_0x5dcda6;if(_0x417cdf[_0xb4de('0x3b')]['includeAll']){_0x4259a4['include']=[{'model':db[_0xb4de('0x83')],'as':_0xb4de('0xea'),'required':![]},{'model':db[_0xb4de('0xb9')],'as':_0xb4de('0xeb'),'attributes':[_0xb4de('0x32'),'fullname',_0xb4de('0xec')],'required':![]},{'model':db['Tag'],'as':_0xb4de('0xed'),'attributes':['id','name',_0xb4de('0xee')],'where':_0x417cdf[_0xb4de('0x3b')][_0xb4de('0xef')]?{'id':_0x417cdf[_0xb4de('0x3b')]['tag']}:undefined,'required':_0x417cdf[_0xb4de('0x3b')][_0xb4de('0xef')]?!![]:![]}];}return db[_0xb4de('0xac')][_0xb4de('0x65')](_0x4259a4);})[_0xb4de('0x19')](function(_0x1d0ae8){_0x291a15[_0xb4de('0x4a')]=_0x1d0ae8;return _0x291a15;});}})[_0xb4de('0x19')](respondWithFilteredResult(_0xca7454,_0x4259a4))[_0xb4de('0x22')](handleError(_0xca7454,null));};function iftimePromise(_0x3edd50,_0x19d04a){return respondWithRpcPromise(_0xb4de('0xf0'),'getSnippet',{'command':_0x19d04a[_0xb4de('0xf1')]?util[_0xb4de('0xa4')]('iftime\x20%s,%s',_0x3edd50[_0xb4de('0xf2')],_0x19d04a['timezone']):util[_0xb4de('0xa4')]('iftime\x20%s',_0x3edd50[_0xb4de('0xf2')])},client9002)[_0xb4de('0x19')](function(_0x2f7e5b){var _0x317234=_0x2f7e5b&&_0x2f7e5b['indexOf'](_0xb4de('0xf3'))>=0x0?!![]:![];logger[_0xb4de('0x1a')](_0xb4de('0xf4'),_0x19d04a['id'],_0x3edd50['id'],_0x3edd50['interval'],_0x317234?'ONLINE':'OFFLINE',_0x19d04a[_0xb4de('0xf1')]?_0x19d04a[_0xb4de('0xf1')]:_0xb4de('0xf5'));return _0x317234;})[_0xb4de('0x22')](function(_0x36dad3){logger[_0xb4de('0x1e')](_0xb4de('0xf4'),_0x19d04a['id'],_0x3edd50['id'],_0x3edd50['interval'],util[_0xb4de('0xf6')](_0x36dad3,{'showHidden':![],'depth':null}),_0x19d04a[_0xb4de('0xf1')]?_0x19d04a[_0xb4de('0xf1')]:_0xb4de('0xf5'));return![];});}exports[_0xb4de('0xf7')]=function(_0x24fea5,_0x17922d){var _0x34e82b=0x0;var _0x35f36b=0x0;var _0x378ea7=![];var _0x2bd103;var _0x57b7bd;return db[_0xb4de('0x36')][_0xb4de('0x58')]({'where':{'id':_0x24fea5[_0xb4de('0x4c')]['id']},'include':[{'model':db[_0xb4de('0xf8')],'as':_0xb4de('0xf8'),'include':[{'model':db[_0xb4de('0xf8')],'as':_0xb4de('0xf9'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x17922d,null))[_0xb4de('0x19')](function(_0x258a0e){if(_0x258a0e){_0x2bd103=_0x258a0e;return _0x258a0e[_0xb4de('0xfa')]({'raw':!![]});}})[_0xb4de('0x19')](function(_0x194229){if(_0x2bd103){if(_0x194229){_0x57b7bd=_0x194229;}}return require(_0xb4de('0xfb'))['getLicense']();})[_0xb4de('0x19')](function(_0xd362f6){if(_0xd362f6){_0x35f36b=_0xd362f6[_0xb4de('0xfc')];_0x378ea7=_0xd362f6['custom'];}})[_0xb4de('0x19')](function(){return db[_0xb4de('0xac')]['count']({'where':{'closed':![]}});})[_0xb4de('0x19')](function(_0x1e4454){_0x34e82b=_0x1e4454;if(_0x35f36b&&_0x1e4454>_0x35f36b){return db[_0xb4de('0xfd')]['findOne']({'where':{'id':0x1}})[_0xb4de('0x19')](function(_0x2ce33d){if(_0x2ce33d){_0x2ce33d[_0xb4de('0xfe')]('chatLicenseExceeded');}});}})[_0xb4de('0x19')](function(){if(_0x2bd103[_0xb4de('0xf8')]&&_0x2bd103[_0xb4de('0xf8')][_0xb4de('0xf9')]){var _0x58cb7c=[];for(var _0x42ef0a=0x0;_0x42ef0a<_0x2bd103[_0xb4de('0xf8')][_0xb4de('0xf9')][_0xb4de('0x40')];_0x42ef0a++){var _0x23a603=_0x2bd103[_0xb4de('0xf8')][_0xb4de('0xf9')][_0x42ef0a][_0xb4de('0x56')]({'plain':!![]});_0x58cb7c['push'](iftimePromise(_0x23a603,_0x2bd103));}return BPromise[_0xb4de('0xff')](_0x58cb7c)[_0xb4de('0x19')](function(_0x4a433e){return _[_0xb4de('0x100')](_0x4a433e);});}else{return!![];}})['then'](function(_0x49e747){var _0x28e9ae=fs[_0xb4de('0x101')](path[_0xb4de('0x70')](config[_0xb4de('0x71')],'server/files/chat/iframe.ejs'),_0xb4de('0xc5'));var _0xceba40=new url[(_0xb4de('0x102'))](_0x2bd103[_0xb4de('0x103')])['origin'];var _0x523a68=_0xb4de('0x104');var _0x2ec1e1=![];var _0x16489e={'chatVersion':_0x523a68,'chatWebsiteAddressOrigin':_0xceba40,'remote':_0x2bd103[_0xb4de('0x105')],'query':querystring[_0xb4de('0x1d')](_[_0xb4de('0x47')](_0x2bd103[_0xb4de('0x56')]({'plain':!![]}),{'customerIp':_0x24fea5[_0xb4de('0x9d')][_0xb4de('0x9e')]||_0x24fea5[_0xb4de('0x9d')][_0xb4de('0x106')]||_0x24fea5[_0xb4de('0x107')]['remoteAddress']||_0x24fea5['ip'],'referer':_0x24fea5['headers'][_0xb4de('0xa2')],'openedInteractions':_0x34e82b,'maxInteractions':_0x35f36b,'virtual':_0x378ea7[_0xb4de('0xfc')],'online':_0x49e747,'custom':_0x378ea7}))[_0xb4de('0x108')](/'/g,'\x5c\x27')};_0x17922d[_0xb4de('0x33')](ejs[_0xb4de('0xc6')](Mustache[_0xb4de('0xc6')](_0x28e9ae,_0x16489e),{'proactiveActions':_0x57b7bd,'alignment':_0x2bd103[_0xb4de('0x109')],'verticalAlignment':_0x2bd103[_0xb4de('0x10a')],'div_color':_0x2bd103[_0xb4de('0xee')],'labelText':_0x2bd103['labelText'],'text_color':_0x2bd103['textColor'],'text_button_color':_0x2bd103['textButtonColor'],'button_color':_0x2bd103[_0xb4de('0x10b')],'background_color':_0x2bd103['backgroundColor'],'hideWhenOffline':_0x2bd103[_0xb4de('0x10c')],'intervalId':_0x2bd103['IntervalId'],'isDevelopment':_0x2ec1e1,'chatVersion':_0x523a68}));})[_0xb4de('0x22')](handleError(_0x17922d,null));};exports[_0xb4de('0x10d')]=function(_0xdead1c,_0x73c65c){var _0x6bc923=_0xdead1c['params']['id'];var _0x2c2313=_0xdead1c[_0xb4de('0x52')];var _0x269831=0xc8;var _0x24f4cc=null;return db[_0xb4de('0xcf')][_0xb4de('0xd0')]({'isolationLevel':db['sequelize'][_0xb4de('0x10e')]['ISOLATION_LEVELS'][_0xb4de('0x10f')]},function(_0x325b94){return db['ChatWebsite'][_0xb4de('0x5e')]({'where':{'id':_0x6bc923},'transaction':_0x325b94})[_0xb4de('0x19')](function(_0x20aee8){if(_0x20aee8){return db['ChatApplication'][_0xb4de('0x2f')]({'where':{'ChatWebsiteId':_0x6bc923},'transaction':_0x325b94})['then'](function(){var _0x1fe6de=_[_0xb4de('0x35')](_0x2c2313,function(_0x53336a){_0x53336a[_0xb4de('0x5c')]=_0x6bc923;return _0x53336a;});return db[_0xb4de('0x110')]['bulkCreate'](_0x1fe6de,{'transaction':_0x325b94});});}else{_0x269831=0x194;_0x24f4cc=[];}});})[_0xb4de('0x19')](function(){if(_0x269831!==0x194){return db[_0xb4de('0x110')][_0xb4de('0x111')]({'where':{'ChatWebsiteId':_0x6bc923},'order':_0xb4de('0x99')})[_0xb4de('0x19')](function(_0x505848){_0x24f4cc=_0x505848;});}})[_0xb4de('0x22')](function(_0x5b51b9){_0x269831=0x1f4;logger[_0xb4de('0x1e')](_0x5b51b9[_0xb4de('0x31')]);if(_0x5b51b9[_0xb4de('0x32')]){delete _0x5b51b9['name'];}_0x24f4cc=_0x5b51b9;})['finally'](function(){if(_0x24f4cc===null){_0x73c65c['sendStatus'](_0x269831);}else{if(_0x269831===0x1f4){_0x73c65c[_0xb4de('0x30')](_0x269831)[_0xb4de('0x33')](_0x24f4cc);}else{_0x73c65c[_0xb4de('0x30')](_0x269831)[_0xb4de('0x25')](_0x24f4cc);}}});};exports['getApplications']=function(_0x5bba28,_0x2019dd){var _0xd45d5d={};var _0x44bb59={};var _0x46f8c1;var _0x589f06;return db[_0xb4de('0x36')][_0xb4de('0x5e')]({'where':{'id':_0x5bba28[_0xb4de('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2019dd,null))[_0xb4de('0x19')](function(_0x56367a){if(_0x56367a){_0x46f8c1=_0x56367a;_0x44bb59['model']=_[_0xb4de('0x4e')](db[_0xb4de('0x110')][_0xb4de('0x37')]);_0x44bb59['query']=_[_0xb4de('0x4e')](_0x5bba28[_0xb4de('0x3b')]);_0x44bb59[_0xb4de('0x3c')]=_[_0xb4de('0x3d')](_0x44bb59[_0xb4de('0x3a')],_0x44bb59[_0xb4de('0x3b')]);_0xd45d5d['attributes']=_[_0xb4de('0x3d')](_0x44bb59[_0xb4de('0x3a')],qs[_0xb4de('0x3f')](_0x5bba28[_0xb4de('0x3b')][_0xb4de('0x3f')]));_0xd45d5d[_0xb4de('0x3e')]=_0xd45d5d[_0xb4de('0x3e')][_0xb4de('0x40')]?_0xd45d5d[_0xb4de('0x3e')]:_0x44bb59['model'];_0xd45d5d['order']=qs[_0xb4de('0x43')](_0x5bba28[_0xb4de('0x3b')]['sort']);_0xd45d5d[_0xb4de('0x44')]=qs[_0xb4de('0x3c')](_[_0xb4de('0x45')](_0x5bba28[_0xb4de('0x3b')],_0x44bb59[_0xb4de('0x3c')]));if(_0x5bba28[_0xb4de('0x3b')]['filter']){_0xd45d5d[_0xb4de('0x44')]=_[_0xb4de('0x47')](_0xd45d5d[_0xb4de('0x44')],{'$or':_[_0xb4de('0x35')](_0xd45d5d[_0xb4de('0x3e')],function(_0x3aa7bc){var _0x2f2612={};_0x2f2612[_0x3aa7bc]={'$like':'%'+_0x5bba28[_0xb4de('0x3b')][_0xb4de('0x46')]+'%'};return _0x2f2612;})});}_0xd45d5d=_[_0xb4de('0x47')]({},_0xd45d5d,_0x5bba28[_0xb4de('0x50')]);return _0x46f8c1['getApplications'](_0xd45d5d);}})['then'](function(_0x3fc15f){if(_0x3fc15f){_0x589f06=_0x3fc15f[_0xb4de('0x40')];if(!_0x5bba28[_0xb4de('0x3b')][_0xb4de('0x41')](_0xb4de('0x60'))){_0xd45d5d['limit']=qs['limit'](_0x5bba28[_0xb4de('0x3b')][_0xb4de('0x28')]);_0xd45d5d['offset']=qs[_0xb4de('0x26')](_0x5bba28['query']['offset']);}return _0x46f8c1[_0xb4de('0x112')](_0xd45d5d);}})[_0xb4de('0x19')](function(_0x355d47){if(_0x355d47){return _0x355d47?{'count':_0x589f06,'rows':_0x355d47}:null;}})[_0xb4de('0x19')](respondWithResult(_0x2019dd,null))[_0xb4de('0x22')](handleError(_0x2019dd,null));};exports['addProactiveActions']=function(_0x796561,_0x507420){return db[_0xb4de('0x113')]['find']({'where':{'id':_0x796561[_0xb4de('0x4c')]['id']}})[_0xb4de('0x19')](handleEntityNotFound(_0x507420,null))[_0xb4de('0x19')](function(_0x3eeae4){if(_0x3eeae4){return _0x3eeae4[_0xb4de('0x114')](_0x796561[_0xb4de('0x52')][_0xb4de('0x62')],_[_0xb4de('0xe8')](_0x796561['body'],[_0xb4de('0x62'),'id'])||{});}})[_0xb4de('0x19')](respondWithResult(_0x507420,null))[_0xb4de('0x22')](handleError(_0x507420,null));};exports[_0xb4de('0xfa')]=function(_0x198107,_0x287eea){var _0x29b6d5={};var _0xaa5c96={};var _0x1f85f8;var _0x5e0c2b;return db['ChatWebsite'][_0xb4de('0x5e')]({'where':{'id':_0x198107['params']['id']}})[_0xb4de('0x19')](handleEntityNotFound(_0x287eea,null))[_0xb4de('0x19')](function(_0x385974){if(_0x385974){_0x1f85f8=_0x385974;_0xaa5c96[_0xb4de('0x3a')]=_['keys'](db[_0xb4de('0x115')][_0xb4de('0x37')]);_0xaa5c96[_0xb4de('0x3b')]=_[_0xb4de('0x4e')](_0x198107[_0xb4de('0x3b')]);_0xaa5c96['filters']=_['intersection'](_0xaa5c96[_0xb4de('0x3a')],_0xaa5c96[_0xb4de('0x3b')]);_0x29b6d5['attributes']=_['intersection'](_0xaa5c96[_0xb4de('0x3a')],qs[_0xb4de('0x3f')](_0x198107[_0xb4de('0x3b')][_0xb4de('0x3f')]));_0x29b6d5[_0xb4de('0x3e')]=_0x29b6d5[_0xb4de('0x3e')][_0xb4de('0x40')]?_0x29b6d5['attributes']:_0xaa5c96['model'];_0x29b6d5[_0xb4de('0x42')]=qs[_0xb4de('0x43')](_0x198107[_0xb4de('0x3b')][_0xb4de('0x43')]);_0x29b6d5[_0xb4de('0x44')]=qs['filters'](_['pick'](_0x198107[_0xb4de('0x3b')],_0xaa5c96[_0xb4de('0x3c')]));if(_0x198107['query'][_0xb4de('0x46')]){_0x29b6d5[_0xb4de('0x44')]=_[_0xb4de('0x47')](_0x29b6d5[_0xb4de('0x44')],{'$or':_[_0xb4de('0x35')](_0x29b6d5['attributes'],function(_0x497861){var _0x2f88b0={};_0x2f88b0[_0x497861]={'$like':'%'+_0x198107[_0xb4de('0x3b')][_0xb4de('0x46')]+'%'};return _0x2f88b0;})});}_0x29b6d5=_[_0xb4de('0x47')]({},_0x29b6d5,_0x198107[_0xb4de('0x50')]);return _0x1f85f8[_0xb4de('0xfa')](_0x29b6d5);}})['then'](function(_0x2c0df5){if(_0x2c0df5){_0x5e0c2b=_0x2c0df5[_0xb4de('0x40')];if(!_0x198107[_0xb4de('0x3b')][_0xb4de('0x41')](_0xb4de('0x60'))){_0x29b6d5[_0xb4de('0x28')]=qs[_0xb4de('0x28')](_0x198107[_0xb4de('0x3b')][_0xb4de('0x28')]);_0x29b6d5[_0xb4de('0x26')]=qs[_0xb4de('0x26')](_0x198107[_0xb4de('0x3b')][_0xb4de('0x26')]);}return _0x1f85f8['getProactiveActions'](_0x29b6d5);}})[_0xb4de('0x19')](function(_0x58bc3b){if(_0x58bc3b){return _0x58bc3b?{'count':_0x5e0c2b,'rows':_0x58bc3b}:null;}})[_0xb4de('0x19')](respondWithResult(_0x287eea,null))[_0xb4de('0x22')](handleError(_0x287eea,null));};exports['getFields']=function(_0x76666c,_0x10d4a7){var _0x96c7de=_0x76666c['query'][_0xb4de('0x116')]===_0xb4de('0x117')?_0xb4de('0x118'):_0xb4de('0x119');return db[_0xb4de('0x36')][_0xb4de('0x58')]({'attributes':['id',_0x96c7de],'where':{'id':_0x76666c[_0xb4de('0x4c')]['id']}})['then'](handleEntityNotFound(_0x10d4a7,null))['then'](function(_0x43def8){if(_0x43def8){var _0x20b2b7=_0x43def8[_0x96c7de];var _0x2f0f73=_0x20b2b7&&_0x20b2b7[_0xb4de('0x11a')]?_0x20b2b7[_0xb4de('0x11a')]:[];_0x10d4a7[_0xb4de('0x33')]({'fromKey':_[_0xb4de('0x79')](_0x20b2b7[_0xb4de('0x11b')])?undefined:_0x20b2b7['fromKey'],'count':_0x2f0f73[_0xb4de('0x40')],'rows':_0x2f0f73});}})['catch'](handleError(_0x10d4a7,null));};exports['getOfflineMessages']=function(_0x3179d1,_0x2b6a24){var _0x3d82dc={'raw':![],'where':{}};var _0x203cb5={};var _0x4566d2={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xb4de('0x5e')]({'where':{'id':_0x3179d1['params']['id']}})[_0xb4de('0x19')](handleEntityNotFound(_0x2b6a24,null))['then'](function(_0x49bc32){if(_0x49bc32){_0x203cb5['model']=_[_0xb4de('0x4e')](db[_0xb4de('0x11c')][_0xb4de('0x37')]);_0x203cb5[_0xb4de('0x3b')]=_[_0xb4de('0x4e')](_0x3179d1[_0xb4de('0x3b')]);_0x203cb5[_0xb4de('0x3c')]=_['intersection'](_0x203cb5[_0xb4de('0x3a')],_0x203cb5['query']);_0x3d82dc[_0xb4de('0x3e')]=_[_0xb4de('0x3d')](_0x203cb5[_0xb4de('0x3a')],qs['fields'](_0x3179d1['query'][_0xb4de('0x3f')]));_0x3d82dc[_0xb4de('0x3e')]=_0x3d82dc[_0xb4de('0x3e')][_0xb4de('0x40')]?_0x3d82dc[_0xb4de('0x3e')]:_0x203cb5['model'];if(!_0x3179d1[_0xb4de('0x3b')]['hasOwnProperty'](_0xb4de('0x60'))){_0x3d82dc['limit']=qs[_0xb4de('0x28')](_0x3179d1[_0xb4de('0x3b')][_0xb4de('0x28')]);_0x3d82dc[_0xb4de('0x26')]=qs[_0xb4de('0x26')](_0x3179d1[_0xb4de('0x3b')][_0xb4de('0x26')]);}_0x3d82dc[_0xb4de('0x42')]=qs[_0xb4de('0x43')](_0x3179d1['query'][_0xb4de('0x43')]);_0x3d82dc[_0xb4de('0x44')]=qs[_0xb4de('0x3c')](_[_0xb4de('0x45')](_0x3179d1[_0xb4de('0x3b')],_0x203cb5[_0xb4de('0x3c')]));_0x3d82dc['where'][_0xb4de('0x5c')]=_0x49bc32['id'];if(_0x3179d1[_0xb4de('0x3b')][_0xb4de('0x46')]){_0x3d82dc['where']=_['merge'](_0x3d82dc[_0xb4de('0x44')],{'$or':_['map'](_0x3d82dc[_0xb4de('0x3e')],function(_0x37930e){var _0x11101a={};_0x11101a[_0x37930e]={'$like':'%'+_0x3179d1[_0xb4de('0x3b')][_0xb4de('0x46')]+'%'};return _0x11101a;})});}_0x3d82dc=_[_0xb4de('0x47')]({},_0x3d82dc,_0x3179d1[_0xb4de('0x50')]);return db[_0xb4de('0x11c')][_0xb4de('0x29')]({'where':_0x3d82dc[_0xb4de('0x44')]})[_0xb4de('0x19')](function(_0x200112){_0x4566d2[_0xb4de('0x29')]=_0x200112;if(_0x3179d1[_0xb4de('0x3b')]['includeAll']){_0x3d82dc[_0xb4de('0x49')]=[{'all':!![]}];}else{_0x3d82dc[_0xb4de('0x49')]=[{'model':db[_0xb4de('0x83')],'as':_0xb4de('0xea'),'required':![]},{'model':db[_0xb4de('0x11d')],'as':_0xb4de('0x11e'),'required':![]}];}return db[_0xb4de('0x11c')][_0xb4de('0x65')](_0x3d82dc);})[_0xb4de('0x19')](function(_0x5a2e1f){_0x4566d2[_0xb4de('0x4a')]=_0x5a2e1f;return _0x4566d2;});}})['then'](respondWithFilteredResult(_0x2b6a24,_0x3d82dc))[_0xb4de('0x22')](handleError(_0x2b6a24,null));};exports[_0xb4de('0x11f')]=function(_0x1b784b,_0xae0038){return db[_0xb4de('0x36')][_0xb4de('0x58')]({'where':{'id':_0x1b784b[_0xb4de('0x4c')]['id']}})[_0xb4de('0x19')](handleEntityNotFound(_0xae0038,null))[_0xb4de('0x19')](function(_0x4c05bd){if(_0x4c05bd){return _0x4c05bd['addAgents'](_0x1b784b[_0xb4de('0x52')][_0xb4de('0x62')],_[_0xb4de('0xe8')](_0x1b784b[_0xb4de('0x52')],[_0xb4de('0x62'),'id'])||{})[_0xb4de('0xb0')](function(_0x67e04c){for(var _0x7269f9=0x0;_0x7269f9<_0x1b784b[_0xb4de('0x52')][_0xb4de('0x62')][_0xb4de('0x40')];_0x7269f9+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x1b784b[_0xb4de('0x52')][_0xb4de('0x62')][_0x7269f9]),'ChatWebsiteId':Number(_0x1b784b['params']['id'])});}return _0x67e04c;});}})[_0xb4de('0x19')](respondWithResult(_0xae0038,null))['catch'](handleError(_0xae0038,null));};exports['removeAgents']=function(_0x1762e8,_0x21bb1e){return db[_0xb4de('0x36')]['find']({'where':{'id':_0x1762e8['params']['id']}})[_0xb4de('0x19')](handleEntityNotFound(_0x21bb1e,null))['then'](function(_0x3d44f2){if(_0x3d44f2){return _0x3d44f2['removeAgents'](_0x1762e8[_0xb4de('0x3b')][_0xb4de('0x62')])[_0xb4de('0x19')](function(){if(_[_0xb4de('0x120')](_0x1762e8['query'][_0xb4de('0x62')])){for(var _0x28e0bd=0x0;_0x28e0bd<_0x1762e8[_0xb4de('0x3b')][_0xb4de('0x62')][_0xb4de('0x40')];_0x28e0bd+=0x1){socket[_0xb4de('0x121')]('userChatWebsite:remove',{'UserId':Number(_0x1762e8['query'][_0xb4de('0x62')][_0x28e0bd]),'ChatWebsiteId':Number(_0x1762e8['params']['id'])});}}else{socket[_0xb4de('0x121')](_0xb4de('0x122'),{'UserId':Number(_0x1762e8[_0xb4de('0x3b')][_0xb4de('0x62')]),'ChatWebsiteId':Number(_0x1762e8[_0xb4de('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x21bb1e,null))[_0xb4de('0x22')](handleError(_0x21bb1e,null));};exports['getAgents']=function(_0x5b1e77,_0x2e04dc){var _0x3eca86={};var _0x46bebe={};var _0x265d04;var _0x26c608;return db[_0xb4de('0x36')][_0xb4de('0x5e')]({'where':{'id':_0x5b1e77[_0xb4de('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2e04dc,null))[_0xb4de('0x19')](function(_0x3cde0a){if(_0x3cde0a){_0x265d04=_0x3cde0a;_0x46bebe['model']=_[_0xb4de('0x4e')](db[_0xb4de('0xb9')][_0xb4de('0x37')]);_0x46bebe[_0xb4de('0x3b')]=_[_0xb4de('0x4e')](_0x5b1e77[_0xb4de('0x3b')]);_0x46bebe[_0xb4de('0x3c')]=_['intersection'](_0x46bebe[_0xb4de('0x3a')],_0x46bebe[_0xb4de('0x3b')]);_0x3eca86[_0xb4de('0x3e')]=_[_0xb4de('0x3d')](_0x46bebe[_0xb4de('0x3a')],qs['fields'](_0x5b1e77['query'][_0xb4de('0x3f')]));_0x3eca86[_0xb4de('0x3e')]=_0x3eca86[_0xb4de('0x3e')][_0xb4de('0x40')]?_0x3eca86[_0xb4de('0x3e')]:_0x46bebe['model'];_0x3eca86[_0xb4de('0x42')]=qs['sort'](_0x5b1e77[_0xb4de('0x3b')][_0xb4de('0x43')]);_0x3eca86['where']=qs[_0xb4de('0x3c')](_[_0xb4de('0x45')](_0x5b1e77[_0xb4de('0x3b')],_0x46bebe[_0xb4de('0x3c')]));if(_0x5b1e77[_0xb4de('0x3b')][_0xb4de('0x46')]){_0x3eca86[_0xb4de('0x44')]=_[_0xb4de('0x47')](_0x3eca86['where'],{'$or':_[_0xb4de('0x35')](_0x3eca86[_0xb4de('0x3e')],function(_0x1b5c2f){var _0x1e6df3={};_0x1e6df3[_0x1b5c2f]={'$like':'%'+_0x5b1e77[_0xb4de('0x3b')][_0xb4de('0x46')]+'%'};return _0x1e6df3;})});}_0x3eca86=_[_0xb4de('0x47')]({},_0x3eca86,_0x5b1e77[_0xb4de('0x50')]);return _0x265d04['getAgents'](_0x3eca86);}})['then'](function(_0x28f1db){if(_0x28f1db){_0x26c608=_0x28f1db[_0xb4de('0x40')];if(!_0x5b1e77[_0xb4de('0x3b')]['hasOwnProperty'](_0xb4de('0x60'))){_0x3eca86[_0xb4de('0x28')]=qs['limit'](_0x5b1e77['query'][_0xb4de('0x28')]);_0x3eca86['offset']=qs['offset'](_0x5b1e77[_0xb4de('0x3b')]['offset']);}return _0x265d04[_0xb4de('0x123')](_0x3eca86);}})[_0xb4de('0x19')](function(_0x467642){if(_0x467642){return _0x467642?{'count':_0x26c608,'rows':_0x467642}:null;}})['then'](respondWithResult(_0x2e04dc,null))['catch'](handleError(_0x2e04dc,null));}; \ No newline at end of file +var _0x56fa=['removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','ejs','fs-extra','lodash','ioredis','../../config/logger','api','url','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','html-to-text','client','http','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','then','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','ChatWebsite','rawAttributes','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','mandatoryDispositionPause','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','rows','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','user-agent','getResult','chat','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','Applications','account','applications','list','asc','contact','cf-connecting-ip','headers','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','device','vendor','type','threadId','ChatInteraction','externalUrl','ContactId','interaction','lastName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','MailAccount','findOrCreate','readFileSync','utf8','render','offlineMessageBody','ChatOfflineMessage','originalname','server','attachments','offline-chat','basename','openNewInteraction','transaction','bulkCreate','CloudProvider','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','toPairsIn','Chat','remove','addInteraction','omit','getInteractions','Owner','fullname','Tag','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','getProactiveActions','virtual','custom','increment','chatLicenseExceeded','Intervals','some','server/files/chat/iframe.ejs','address','remote','x-real-ip','connection','replace','alignment','verticalAlignment','textColor','textButtonColor','color_button','hideWhenOffline','IntervalId','sequelize','Transaction','ISOLATION_LEVELS','ChatApplication','priority','finally','getApplications','chatProactiveAction','addProactiveActions','getFields','online','false','offlineForm','onlineForm','fromKey','getOfflineMessages','Contact','Attachments','addAgents','spread','emit','userChatWebsite:save'];(function(_0x177846,_0x12b670){var _0x242022=function(_0x54a4b4){while(--_0x54a4b4){_0x177846['push'](_0x177846['shift']());}};_0x242022(++_0x12b670);}(_0x56fa,0x12c));var _0xa56f=function(_0x154f92,_0x169556){_0x154f92=_0x154f92-0x0;var _0x4c6cd6=_0x56fa[_0x154f92];return _0x4c6cd6;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0xa56f('0x0'));var util=require('util');var path=require('path');var ejs=require(_0xa56f('0x1'));var fs=require('fs');var fs_extra=require(_0xa56f('0x2'));var _=require(_0xa56f('0x3'));var querystring=require('querystring');var Redis=require(_0xa56f('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0xa56f('0x5'))(_0xa56f('0x6'));var config=require('../../config/environment');var url=require(_0xa56f('0x7'));var db=require(_0xa56f('0x8'))['db'];config[_0xa56f('0x9')]=_[_0xa56f('0xa')](config['redis'],{'host':_0xa56f('0xb'),'port':0x18eb});var socket=require(_0xa56f('0xc'))(new Redis(config[_0xa56f('0x9')]));require(_0xa56f('0xd'))['register'](socket);var htmlToText=require(_0xa56f('0xe'));var jayson=require('jayson/promise');var client=jayson[_0xa56f('0xf')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson[_0xa56f('0xf')][_0xa56f('0x10')]({'port':0x232b});var client9001=jayson[_0xa56f('0xf')][_0xa56f('0x10')]({'port':0x2329});function respondWithRpcPromise(_0xe10459,_0x1e4a6a,_0x4ecdf0,_0x468b3e){return new BPromise(function(_0x28555d,_0x2828fc){var _0x145daf=_0x468b3e||client;return _0x145daf['request'](_0xe10459,_0x4ecdf0)['then'](function(_0x178ec6){logger[_0xa56f('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x1e4a6a,_0xa56f('0x12'));logger[_0xa56f('0x13')](_0xa56f('0x14'),_0x1e4a6a,'request\x20sent',JSON[_0xa56f('0x15')](_0x178ec6));if(_0x178ec6['error']){if(_0x178ec6[_0xa56f('0x16')][_0xa56f('0x17')]===0x1f4){logger['error'](_0xa56f('0x18'),_0x1e4a6a,_0x178ec6[_0xa56f('0x16')][_0xa56f('0x19')]);return _0x2828fc(_0x178ec6[_0xa56f('0x16')]['message']);}logger[_0xa56f('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x1e4a6a,_0x178ec6[_0xa56f('0x16')][_0xa56f('0x19')]);return _0x28555d(_0x178ec6['error']['message']);}else{logger[_0xa56f('0x11')](_0xa56f('0x18'),_0x1e4a6a,_0xa56f('0x12'));_0x28555d(_0x178ec6[_0xa56f('0x1a')]['message']);}})['catch'](function(_0x28db2a){logger['error'](_0xa56f('0x18'),_0x1e4a6a,_0x28db2a);_0x2828fc(_0x28db2a);});});}function respondWithStatusCode(_0x26d447,_0xfb9039){_0xfb9039=_0xfb9039||0xcc;return function(_0x4fb7cc){if(_0x4fb7cc){return _0x26d447[_0xa56f('0x1b')](_0xfb9039);}return _0x26d447[_0xa56f('0x1c')](_0xfb9039)[_0xa56f('0x1d')]();};}function respondWithResult(_0x1bf989,_0x3cba93){_0x3cba93=_0x3cba93||0xc8;return function(_0x5596ad){if(_0x5596ad){return _0x1bf989[_0xa56f('0x1c')](_0x3cba93)[_0xa56f('0x1e')](_0x5596ad);}};}function respondWithFilteredResult(_0x4c319b,_0x1c7043){return function(_0x516c33){if(_0x516c33){var _0x6681c3=typeof _0x1c7043[_0xa56f('0x1f')]===_0xa56f('0x20')&&typeof _0x1c7043['limit']===_0xa56f('0x20');var _0x3ead12=_0x516c33[_0xa56f('0x21')];var _0x446742=_0x6681c3?0x0:_0x1c7043['offset'];var _0xed74f1=_0x6681c3?_0x516c33[_0xa56f('0x21')]:_0x1c7043[_0xa56f('0x1f')]+_0x1c7043[_0xa56f('0x22')];var _0xf02475;if(_0xed74f1>=_0x3ead12){_0xed74f1=_0x3ead12;_0xf02475=0xc8;}else{_0xf02475=0xce;}_0x4c319b['status'](_0xf02475);return _0x4c319b[_0xa56f('0x23')](_0xa56f('0x24'),_0x446742+'-'+_0xed74f1+'/'+_0x3ead12)[_0xa56f('0x1e')](_0x516c33);}return null;};}function saveUpdates(_0xc3f8e2){return function(_0x261fbb){if(_0x261fbb){return _0x261fbb[_0xa56f('0x25')](_0xc3f8e2)['then'](function(_0x265cd2){return _0x265cd2;});}return null;};}function removeEntity(_0x36d83b){return function(_0x2da3b1){if(_0x2da3b1){return _0x2da3b1[_0xa56f('0x26')]()[_0xa56f('0x27')](function(){var _0x4ef7a5=_0x2da3b1[_0xa56f('0x28')]({'plain':!![]});var _0x3154bf=_0xa56f('0x29');return db[_0xa56f('0x2a')][_0xa56f('0x26')]({'where':{'type':_0x3154bf,'resourceId':_0x4ef7a5['id']}})[_0xa56f('0x27')](function(){return _0x2da3b1;});})[_0xa56f('0x27')](function(){_0x36d83b[_0xa56f('0x1c')](0xcc)[_0xa56f('0x1d')]();});}};}function handleEntityNotFound(_0x1efe36){return function(_0x404822){if(!_0x404822){_0x1efe36[_0xa56f('0x1b')](0x194);}return _0x404822;};}function handleError(_0x25b064,_0x58ca30){_0x58ca30=_0x58ca30||0x1f4;return function(_0x255e48){logger[_0xa56f('0x16')](_0x255e48[_0xa56f('0x2b')]);if(_0x255e48[_0xa56f('0x2c')]){delete _0x255e48['name'];}_0x25b064['status'](_0x58ca30)[_0xa56f('0x2d')](_0x255e48);};}exports[_0xa56f('0x2e')]=function(_0x49e84e,_0x1f7490){var _0x33957e={'include':[{'model':db[_0xa56f('0x2f')],'as':'mandatoryDispositionPause'}]},_0x1ecb41={},_0x2d185b={'count':0x0,'rows':[]};var _0x1ae361=_['map'](db[_0xa56f('0x30')][_0xa56f('0x31')],function(_0x4065b6){return{'name':_0x4065b6['fieldName'],'type':_0x4065b6['type'][_0xa56f('0x32')]};});_0x1ecb41[_0xa56f('0x33')]=_[_0xa56f('0x34')](_0x1ae361,_0xa56f('0x2c'));_0x1ecb41[_0xa56f('0x35')]=_[_0xa56f('0x36')](_0x49e84e[_0xa56f('0x35')]);_0x1ecb41['filters']=_[_0xa56f('0x37')](_0x1ecb41[_0xa56f('0x33')],_0x1ecb41['query']);_0x33957e[_0xa56f('0x38')]=_[_0xa56f('0x37')](_0x1ecb41['model'],qs['fields'](_0x49e84e[_0xa56f('0x35')][_0xa56f('0x39')]));_0x33957e[_0xa56f('0x38')]=_0x33957e['attributes'][_0xa56f('0x3a')]?_0x33957e['attributes']:_0x1ecb41[_0xa56f('0x33')];if(!_0x49e84e[_0xa56f('0x35')][_0xa56f('0x3b')](_0xa56f('0x3c'))){_0x33957e[_0xa56f('0x22')]=qs['limit'](_0x49e84e[_0xa56f('0x35')][_0xa56f('0x22')]);_0x33957e['offset']=qs['offset'](_0x49e84e[_0xa56f('0x35')]['offset']);}_0x33957e[_0xa56f('0x3d')]=qs[_0xa56f('0x3e')](_0x49e84e[_0xa56f('0x35')][_0xa56f('0x3e')]);_0x33957e[_0xa56f('0x3f')]=qs[_0xa56f('0x40')](_[_0xa56f('0x41')](_0x49e84e[_0xa56f('0x35')],_0x1ecb41[_0xa56f('0x40')]),_0x1ae361);if(_0x49e84e[_0xa56f('0x35')][_0xa56f('0x42')]){_0x33957e[_0xa56f('0x3f')]=_['merge'](_0x33957e['where'],{'$or':_[_0xa56f('0x34')](_0x1ae361,function(_0xaa635f){if(_0xaa635f['type']!==_0xa56f('0x43')){var _0x369d9d={};_0x369d9d[_0xaa635f[_0xa56f('0x2c')]]={'$like':'%'+_0x49e84e['query'][_0xa56f('0x42')]+'%'};return _0x369d9d;}})});}_0x33957e=_[_0xa56f('0x44')]({},_0x33957e,_0x49e84e[_0xa56f('0x45')]);var _0x315545={'where':_0x33957e['where']};return db[_0xa56f('0x30')][_0xa56f('0x21')](_0x315545)[_0xa56f('0x27')](function(_0x2f3a44){_0x2d185b['count']=_0x2f3a44;if(_0x49e84e[_0xa56f('0x35')][_0xa56f('0x46')]){_0x33957e[_0xa56f('0x47')]=[{'all':!![]}];}return db[_0xa56f('0x30')][_0xa56f('0x48')](_0x33957e);})[_0xa56f('0x27')](function(_0x692ed1){_0x2d185b['rows']=_0x692ed1;return _0x2d185b;})[_0xa56f('0x27')](respondWithFilteredResult(_0x1f7490,_0x33957e))['catch'](handleError(_0x1f7490,null));};exports[_0xa56f('0x49')]=function(_0xae9670,_0xa1d4f7){var _0x2e0594={'raw':![],'where':{'id':_0xae9670[_0xa56f('0x4a')]['id']},'include':[{'model':db[_0xa56f('0x2f')],'as':_0xa56f('0x4b')}]},_0x5a6881={};_0x5a6881[_0xa56f('0x33')]=_[_0xa56f('0x36')](db[_0xa56f('0x30')][_0xa56f('0x31')]);_0x5a6881[_0xa56f('0x35')]=_['keys'](_0xae9670[_0xa56f('0x35')]);_0x5a6881['filters']=_[_0xa56f('0x37')](_0x5a6881[_0xa56f('0x33')],_0x5a6881[_0xa56f('0x35')]);_0x2e0594[_0xa56f('0x38')]=_[_0xa56f('0x37')](_0x5a6881[_0xa56f('0x33')],qs[_0xa56f('0x39')](_0xae9670[_0xa56f('0x35')][_0xa56f('0x39')]));_0x2e0594[_0xa56f('0x38')]=_0x2e0594[_0xa56f('0x38')][_0xa56f('0x3a')]?_0x2e0594[_0xa56f('0x38')]:_0x5a6881[_0xa56f('0x33')];if(_0xae9670['query'][_0xa56f('0x46')]){_0x2e0594[_0xa56f('0x47')]=[{'all':!![]}];}_0x2e0594=_[_0xa56f('0x44')]({},_0x2e0594,_0xae9670[_0xa56f('0x45')]);return db[_0xa56f('0x30')]['find'](_0x2e0594)['then'](handleEntityNotFound(_0xa1d4f7,null))[_0xa56f('0x27')](respondWithResult(_0xa1d4f7,null))[_0xa56f('0x4c')](handleError(_0xa1d4f7,null));};exports[_0xa56f('0x4d')]=function(_0x588754,_0x30943e){return db[_0xa56f('0x30')][_0xa56f('0x4d')](_0x588754[_0xa56f('0x4e')],{})['then'](function(_0x1e2d9c){var _0x17cc44=_0x588754[_0xa56f('0x4f')]['get']({'plain':!![]});if(!_0x17cc44)throw new Error(_0xa56f('0x50'));if(_0x17cc44['role']==='user'){var _0x7c7fef=_0x1e2d9c[_0xa56f('0x28')]({'plain':!![]});var _0x49603c=_0xa56f('0x29');return db[_0xa56f('0x51')][_0xa56f('0x52')]({'where':{'name':_0x49603c,'userProfileId':_0x17cc44[_0xa56f('0x53')]},'raw':!![]})['then'](function(_0x3fc2ae){if(_0x3fc2ae&&_0x3fc2ae['autoAssociation']===0x0){return db[_0xa56f('0x2a')]['create']({'name':_0x7c7fef[_0xa56f('0x2c')],'resourceId':_0x7c7fef['id'],'type':_0x3fc2ae[_0xa56f('0x2c')],'sectionId':_0x3fc2ae['id']},{})['then'](function(){return _0x1e2d9c;});}else{return _0x1e2d9c;}})[_0xa56f('0x4c')](function(_0x43542e){logger['error'](_0xa56f('0x54'),_0x43542e);throw _0x43542e;});}return _0x1e2d9c;})[_0xa56f('0x27')](respondWithResult(_0x30943e,0xc9))[_0xa56f('0x4c')](handleError(_0x30943e,null));};exports['update']=function(_0xdc840c,_0x33c9e4){if(_0xdc840c[_0xa56f('0x4e')]['id']){delete _0xdc840c['body']['id'];}return db[_0xa56f('0x30')][_0xa56f('0x52')]({'where':{'id':_0xdc840c['params']['id']},'include':[{'model':db[_0xa56f('0x2f')],'as':_0xa56f('0x4b')}]})[_0xa56f('0x27')](handleEntityNotFound(_0x33c9e4,null))[_0xa56f('0x27')](saveUpdates(_0xdc840c['body'],null))['then'](respondWithResult(_0x33c9e4,null))[_0xa56f('0x4c')](handleError(_0x33c9e4,null));};exports[_0xa56f('0x26')]=function(_0x34c359,_0x234d3b){return db[_0xa56f('0x30')]['find']({'where':{'id':_0x34c359[_0xa56f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x234d3b,null))[_0xa56f('0x27')](removeEntity(_0x234d3b,null))[_0xa56f('0x4c')](handleError(_0x234d3b,null));};exports[_0xa56f('0x55')]=function(_0x12723c,_0x4fa285){return db['ChatWebsite'][_0xa56f('0x55')]()[_0xa56f('0x27')](respondWithResult(_0x4fa285,null))[_0xa56f('0x4c')](handleError(_0x4fa285,null));};exports[_0xa56f('0x56')]=function(_0x4c8d05,_0x4dce6d){if(_0x4c8d05[_0xa56f('0x4e')]['id']){delete _0x4c8d05[_0xa56f('0x4e')]['id'];}return db[_0xa56f('0x30')][_0xa56f('0x52')]({'where':{'id':_0x4c8d05[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x4dce6d,null))[_0xa56f('0x27')](function(_0x4f2c41){if(_0x4f2c41){_0x4c8d05[_0xa56f('0x4e')][_0xa56f('0x57')]=_0x4f2c41['id'];return db[_0xa56f('0x58')][_0xa56f('0x4d')](_0x4c8d05[_0xa56f('0x4e')]);}})[_0xa56f('0x27')](respondWithResult(_0x4dce6d,null))[_0xa56f('0x4c')](handleError(_0x4dce6d,null));};exports[_0xa56f('0x59')]=function(_0x48a074,_0x5ddcb6){var _0x5647c0={'raw':![],'where':{}};var _0x37dd69={};var _0x34b2a2={'count':0x0,'rows':[]};return db[_0xa56f('0x30')]['findOne']({'where':{'id':_0x48a074[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x5ddcb6,null))['then'](function(_0x4cc990){if(_0x4cc990){_0x37dd69['model']=_['keys'](db[_0xa56f('0x58')][_0xa56f('0x31')]);_0x37dd69['query']=_[_0xa56f('0x36')](_0x48a074[_0xa56f('0x35')]);_0x37dd69[_0xa56f('0x40')]=_['intersection'](_0x37dd69[_0xa56f('0x33')],_0x37dd69[_0xa56f('0x35')]);_0x5647c0[_0xa56f('0x38')]=_[_0xa56f('0x37')](_0x37dd69[_0xa56f('0x33')],qs[_0xa56f('0x39')](_0x48a074[_0xa56f('0x35')][_0xa56f('0x39')]));_0x5647c0['attributes']=_0x5647c0['attributes'][_0xa56f('0x3a')]?_0x5647c0[_0xa56f('0x38')]:_0x37dd69[_0xa56f('0x33')];if(!_0x48a074['query'][_0xa56f('0x3b')](_0xa56f('0x3c'))){_0x5647c0[_0xa56f('0x22')]=qs[_0xa56f('0x22')](_0x48a074[_0xa56f('0x35')][_0xa56f('0x22')]);_0x5647c0[_0xa56f('0x1f')]=qs[_0xa56f('0x1f')](_0x48a074[_0xa56f('0x35')][_0xa56f('0x1f')]);}_0x5647c0[_0xa56f('0x3d')]=qs[_0xa56f('0x3e')](_0x48a074['query'][_0xa56f('0x3e')]);_0x5647c0[_0xa56f('0x3f')]=qs['filters'](_['pick'](_0x48a074[_0xa56f('0x35')],_0x37dd69[_0xa56f('0x40')]));_0x5647c0[_0xa56f('0x3f')]['ChatWebsiteId']=_0x4cc990['id'];if(_0x48a074['query'][_0xa56f('0x42')]){_0x5647c0[_0xa56f('0x3f')]=_['merge'](_0x5647c0[_0xa56f('0x3f')],{'$or':_[_0xa56f('0x34')](_0x5647c0[_0xa56f('0x38')],function(_0x59330c){var _0xeed3f={};_0xeed3f[_0x59330c]={'$like':'%'+_0x48a074['query'][_0xa56f('0x42')]+'%'};return _0xeed3f;})});}_0x5647c0=_[_0xa56f('0x44')]({},_0x5647c0,_0x48a074[_0xa56f('0x45')]);return db[_0xa56f('0x58')][_0xa56f('0x21')]({'where':_0x5647c0[_0xa56f('0x3f')]})['then'](function(_0x3a89e3){_0x34b2a2[_0xa56f('0x21')]=_0x3a89e3;if(_0x48a074[_0xa56f('0x35')][_0xa56f('0x46')]){_0x5647c0['include']=[{'all':!![]}];}return db[_0xa56f('0x58')][_0xa56f('0x48')](_0x5647c0);})[_0xa56f('0x27')](function(_0x1404d1){_0x34b2a2['rows']=_0x1404d1;return _0x34b2a2;});}})['then'](respondWithFilteredResult(_0x5ddcb6,_0x5647c0))[_0xa56f('0x4c')](handleError(_0x5ddcb6,null));};exports[_0xa56f('0x5a')]=function(_0x55ee68,_0x358aa5){return db[_0xa56f('0x30')]['find']({'where':{'id':_0x55ee68[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x358aa5,null))[_0xa56f('0x27')](function(_0x5343ef){if(_0x5343ef){return _0x5343ef[_0xa56f('0x5a')](_0x55ee68[_0xa56f('0x35')][_0xa56f('0x5b')]);}})['then'](respondWithStatusCode(_0x358aa5,null))[_0xa56f('0x4c')](handleError(_0x358aa5,null));};exports[_0xa56f('0x5c')]=function(_0x46ef1a,_0x1ba03e){if(_0x46ef1a[_0xa56f('0x4e')]['id']){delete _0x46ef1a[_0xa56f('0x4e')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x46ef1a[_0xa56f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1ba03e,null))[_0xa56f('0x27')](function(_0x27fed8){if(_0x27fed8){_0x46ef1a[_0xa56f('0x4e')][_0xa56f('0x57')]=_0x27fed8['id'];return db[_0xa56f('0x5d')][_0xa56f('0x4d')](_0x46ef1a[_0xa56f('0x4e')]);}})[_0xa56f('0x27')](respondWithResult(_0x1ba03e,null))['catch'](handleError(_0x1ba03e,null));};exports[_0xa56f('0x5e')]=function(_0x270c11,_0x508b05){var _0x57362d={'raw':![],'where':{}};var _0x5b9072={};var _0xa9872d={'count':0x0,'rows':[]};return db[_0xa56f('0x30')][_0xa56f('0x5f')]({'where':{'id':_0x270c11[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x508b05,null))['then'](function(_0x273c66){if(_0x273c66){_0x5b9072[_0xa56f('0x33')]=_[_0xa56f('0x36')](db['CannedAnswer']['rawAttributes']);_0x5b9072['query']=_[_0xa56f('0x36')](_0x270c11[_0xa56f('0x35')]);_0x5b9072[_0xa56f('0x40')]=_[_0xa56f('0x37')](_0x5b9072[_0xa56f('0x33')],_0x5b9072[_0xa56f('0x35')]);_0x57362d['attributes']=_[_0xa56f('0x37')](_0x5b9072['model'],qs[_0xa56f('0x39')](_0x270c11[_0xa56f('0x35')][_0xa56f('0x39')]));_0x57362d['attributes']=_0x57362d[_0xa56f('0x38')]['length']?_0x57362d[_0xa56f('0x38')]:_0x5b9072[_0xa56f('0x33')];if(!_0x270c11[_0xa56f('0x35')][_0xa56f('0x3b')](_0xa56f('0x3c'))){_0x57362d[_0xa56f('0x22')]=qs[_0xa56f('0x22')](_0x270c11[_0xa56f('0x35')]['limit']);_0x57362d[_0xa56f('0x1f')]=qs[_0xa56f('0x1f')](_0x270c11[_0xa56f('0x35')][_0xa56f('0x1f')]);}_0x57362d[_0xa56f('0x3d')]=qs[_0xa56f('0x3e')](_0x270c11['query'][_0xa56f('0x3e')]);_0x57362d[_0xa56f('0x3f')]=qs[_0xa56f('0x40')](_['pick'](_0x270c11[_0xa56f('0x35')],_0x5b9072[_0xa56f('0x40')]));_0x57362d['where']['ChatWebsiteId']=_0x273c66['id'];if(_0x270c11[_0xa56f('0x35')][_0xa56f('0x42')]){_0x57362d[_0xa56f('0x3f')]=_['merge'](_0x57362d[_0xa56f('0x3f')],{'$or':_[_0xa56f('0x34')](_0x57362d['attributes'],function(_0x2f164d){var _0x2c826e={};_0x2c826e[_0x2f164d]={'$like':'%'+_0x270c11[_0xa56f('0x35')]['filter']+'%'};return _0x2c826e;})});}_0x57362d=_[_0xa56f('0x44')]({},_0x57362d,_0x270c11['options']);return db[_0xa56f('0x5d')]['count']({'where':_0x57362d['where']})['then'](function(_0x2411a5){_0xa9872d[_0xa56f('0x21')]=_0x2411a5;if(_0x270c11['query']['includeAll']){_0x57362d[_0xa56f('0x47')]=[{'all':!![]}];}return db['CannedAnswer'][_0xa56f('0x48')](_0x57362d);})[_0xa56f('0x27')](function(_0x1e7027){_0xa9872d[_0xa56f('0x60')]=_0x1e7027;return _0xa9872d;});}})[_0xa56f('0x27')](respondWithFilteredResult(_0x508b05,_0x57362d))['catch'](handleError(_0x508b05,null));};exports[_0xa56f('0x61')]=function(_0x59df31,_0x500b2f){return db[_0xa56f('0x30')][_0xa56f('0x52')]({'where':{'id':_0x59df31[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x500b2f,null))[_0xa56f('0x27')](function(_0x44618d){if(_0x44618d){return _0x44618d['removeAnswers'](_0x59df31['query']['ids']);}})[_0xa56f('0x27')](respondWithStatusCode(_0x500b2f,null))[_0xa56f('0x4c')](handleError(_0x500b2f,null));};exports[_0xa56f('0x62')]=function(_0x505fb8,_0x96da69){_0x505fb8[_0xa56f('0x4e')][_0xa56f('0x63')]=_0x505fb8[_0xa56f('0x64')][_0xa56f('0x65')];return db[_0xa56f('0x30')]['find']({'where':{'id':_0x505fb8[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x96da69,null))[_0xa56f('0x27')](saveUpdates(_0x505fb8['body'],null))[_0xa56f('0x27')](respondWithResult(_0x96da69,null))[_0xa56f('0x4c')](handleError(_0x96da69,null));};exports[_0xa56f('0x66')]=function(_0x420f73,_0x1d484d){_0x420f73[_0xa56f('0x4e')][_0xa56f('0x67')]=_0x420f73['file'][_0xa56f('0x65')];return db[_0xa56f('0x30')]['find']({'where':{'id':_0x420f73[_0xa56f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1d484d,null))[_0xa56f('0x27')](saveUpdates(_0x420f73[_0xa56f('0x4e')],null))['then'](respondWithResult(_0x1d484d,null))['catch'](handleError(_0x1d484d,null));};exports['addCustomerAvatar']=function(_0x1f35db,_0x104a75){_0x1f35db[_0xa56f('0x4e')][_0xa56f('0x68')]=_0x1f35db[_0xa56f('0x64')][_0xa56f('0x65')];return db[_0xa56f('0x30')]['find']({'where':{'id':_0x1f35db[_0xa56f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x104a75,null))['then'](saveUpdates(_0x1f35db['body'],null))[_0xa56f('0x27')](respondWithResult(_0x104a75,null))[_0xa56f('0x4c')](handleError(_0x104a75,null));};exports[_0xa56f('0x69')]=function(_0x481453,_0x3c31d6){_0x481453[_0xa56f('0x4e')][_0xa56f('0x6a')]=_0x481453['file'][_0xa56f('0x65')];return db[_0xa56f('0x30')][_0xa56f('0x52')]({'where':{'id':_0x481453[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x3c31d6,null))[_0xa56f('0x27')](saveUpdates(_0x481453[_0xa56f('0x4e')],null))[_0xa56f('0x27')](respondWithResult(_0x3c31d6,null))['catch'](handleError(_0x3c31d6,null));};exports[_0xa56f('0x6b')]=function(_0x2792f9,_0x3dbf82){var _0x1974f1=path[_0xa56f('0x6c')](config[_0xa56f('0x6d')],_0xa56f('0x6e'));var _0x531468={'where':{'id':_0x2792f9[_0xa56f('0x4a')]['id']},'attributes':['id',_0xa56f('0x63')],'raw':!![]};var _0x36215c=![];return require(_0xa56f('0x6f'))[_0xa56f('0x70')]()[_0xa56f('0x27')](function(_0x426e53){if(_0x426e53){_0x36215c=_0x426e53['custom'];}})[_0xa56f('0x27')](function(){return db[_0xa56f('0x30')]['find'](_0x531468);})['then'](handleEntityNotFound(_0x3dbf82,null))[_0xa56f('0x27')](function(_0x944838){if(_0x944838){if(!_['isNil'](_0x944838[_0xa56f('0x63')])){if(fs[_0xa56f('0x71')](path['join'](config[_0xa56f('0x6d')],_0xa56f('0x72'),_0x944838[_0xa56f('0x63')]))&&_0x36215c){_0x1974f1=path[_0xa56f('0x6c')](config[_0xa56f('0x6d')],'server/files/images/logos/',_0x944838[_0xa56f('0x63')]);}}return _0x3dbf82[_0xa56f('0x73')](_0x1974f1);}})[_0xa56f('0x4c')](handleError(_0x3dbf82,null));};exports[_0xa56f('0x74')]=function(_0x283b3a,_0x516689){var _0x937b09=path[_0xa56f('0x6c')](config[_0xa56f('0x6d')],_0xa56f('0x75'));var _0x2a122b={'where':{'id':_0x283b3a['params']['id']},'attributes':['id',_0xa56f('0x67')],'raw':!![]};return db[_0xa56f('0x30')][_0xa56f('0x52')](_0x2a122b)[_0xa56f('0x27')](handleEntityNotFound(_0x516689,null))[_0xa56f('0x27')](function(_0x4e00d4){if(_0x4e00d4){if(!_[_0xa56f('0x76')](_0x4e00d4[_0xa56f('0x67')])){if(fs['existsSync'](path[_0xa56f('0x6c')](config[_0xa56f('0x6d')],_0xa56f('0x77'),_0x4e00d4[_0xa56f('0x67')]))){_0x937b09=path[_0xa56f('0x6c')](config[_0xa56f('0x6d')],'server/files/images/avatars/',_0x4e00d4[_0xa56f('0x67')]);}}return _0x516689[_0xa56f('0x73')](_0x937b09);}})[_0xa56f('0x4c')](handleError(_0x516689,null));};exports[_0xa56f('0x78')]=function(_0xb0699f,_0x2cb7b5){var _0x360a12=path[_0xa56f('0x6c')](config['root'],_0xa56f('0x79'));var _0x1ebfd6={'where':{'id':_0xb0699f['params']['id']},'attributes':['id',_0xa56f('0x68'),_0xa56f('0x7a')],'raw':!![]};return db['ChatWebsite']['find'](_0x1ebfd6)[_0xa56f('0x27')](handleEntityNotFound(_0x2cb7b5,null))['then'](function(_0x5ad89b){if(_0x5ad89b){if(!_['isNil'](_0x5ad89b[_0xa56f('0x68')])){if(fs[_0xa56f('0x71')](path['join'](config['root'],_0xa56f('0x77'),_0x5ad89b[_0xa56f('0x68')]))&&_0x5ad89b['showCustomerAvatar']){_0x360a12=path[_0xa56f('0x6c')](config[_0xa56f('0x6d')],_0xa56f('0x77'),_0x5ad89b[_0xa56f('0x68')]);}}return _0x2cb7b5[_0xa56f('0x73')](_0x360a12);}})[_0xa56f('0x4c')](handleError(_0x2cb7b5,null));};exports[_0xa56f('0x7b')]=function(_0x4f896f,_0x58dccb){var _0x18d3ae=path['join'](config[_0xa56f('0x6d')],_0xa56f('0x7c'));var _0x21056e={'where':{'id':_0x4f896f[_0xa56f('0x4a')]['id']},'attributes':['id',_0xa56f('0x6a')],'raw':!![]};return db['ChatWebsite']['find'](_0x21056e)[_0xa56f('0x27')](handleEntityNotFound(_0x58dccb,null))[_0xa56f('0x27')](function(_0x31b230){if(_0x31b230){if(!_['isNil'](_0x31b230[_0xa56f('0x6a')])){if(fs['existsSync'](path[_0xa56f('0x6c')](config[_0xa56f('0x6d')],'server/files/images/avatars/',_0x31b230[_0xa56f('0x6a')]))){_0x18d3ae=path['join'](config[_0xa56f('0x6d')],_0xa56f('0x77'),_0x31b230['systemAvatar']);}}return _0x58dccb[_0xa56f('0x73')](_0x18d3ae);}})[_0xa56f('0x4c')](handleError(_0x58dccb,null));};exports[_0xa56f('0x7d')]=function(_0x502609,_0x543cd9){var _0x5db351=require(_0xa56f('0x7e'));var _0x57103d=new _0x5db351();var _0x2b2fdd=_0x57103d[_0xa56f('0x7f')](_0x502609['headers'][_0xa56f('0x80')])[_0xa56f('0x81')]();var _0x180a8f={'body':_0x502609[_0xa56f('0x4e')],'channel':_0xa56f('0x82')};var _0x235ed1=[];var _0x1e0a7=[];var _0x5e4efd={};var _0x5068ca=![];return db['CmContact'][_0xa56f('0x55')]()[_0xa56f('0x27')](function(_0x2dcf08){if(!_0x2dcf08){throw new db[(_0xa56f('0x83'))][(_0xa56f('0x84'))](_0xa56f('0x85'));}_0x235ed1=_[_0xa56f('0x86')](_[_0xa56f('0x36')](_0x2dcf08),['createdAt',_0xa56f('0x87')]);_0x1e0a7=_[_0xa56f('0x86')](_[_0xa56f('0x36')](_0x2dcf08),[_0xa56f('0x88'),_0xa56f('0x87'),_0xa56f('0x89'),_0xa56f('0x8a')]);if(_0x502609[_0xa56f('0x4e')]['id']){delete _0x502609['body']['id'];}if(_[_0xa56f('0x76')](_0x502609[_0xa56f('0x4e')][_0xa56f('0x8b')])){throw new db['Sequelize']['ValidationError'](_0xa56f('0x8c'));}if(_[_0xa56f('0x76')](_0x502609[_0xa56f('0x4e')][_0xa56f('0x4e')])||_0x502609[_0xa56f('0x4e')][_0xa56f('0x4e')]===''){throw new db[(_0xa56f('0x83'))][(_0xa56f('0x84'))](_0xa56f('0x8d'));}if(_[_0xa56f('0x76')](_0x502609[_0xa56f('0x4e')][_0xa56f('0x8e')])){throw new db[(_0xa56f('0x83'))]['ValidationError'](_0xa56f('0x8f')+_0x1e0a7);}if(!_['includes'](_0x1e0a7,_0x502609['body'][_0xa56f('0x8e')])){throw new db[(_0xa56f('0x83'))][(_0xa56f('0x84'))](_0xa56f('0x90')+_0x1e0a7);}_0x5e4efd[_0x502609['body'][_0xa56f('0x8e')]]=_0x502609['body'][_0xa56f('0x8b')];})['then'](function(){return db[_0xa56f('0x30')][_0xa56f('0x52')]({'where':{'id':_0x502609[_0xa56f('0x4a')]['id']},'include':[{'model':db[_0xa56f('0x91')],'as':_0xa56f('0x92'),'include':[{'model':db[_0xa56f('0x93')],'as':_0xa56f('0x94'),'where':_0x5e4efd,'limit':0x1,'order':[[_0xa56f('0x87'),_0xa56f('0x95')]]}]},{'model':db['ChatApplication'],'as':_0xa56f('0x96')}]});})[_0xa56f('0x27')](handleEntityNotFound(_0x543cd9,null))['then'](function(_0x11e7b2){if(_0x11e7b2&&_0x11e7b2[_0xa56f('0x92')]){_0x180a8f[_0xa56f('0x97')]=_0x11e7b2;_0x180a8f[_0xa56f('0x98')]=_0x11e7b2[_0xa56f('0x96')];_0x180a8f[_0xa56f('0x99')]=_0x11e7b2[_0xa56f('0x92')];_0x180a8f[_0xa56f('0x98')]=_['orderBy'](_0x180a8f['applications'],['priority'],[_0xa56f('0x9a')]);if(_0x180a8f['account'][_0xa56f('0x96')]){delete _0x180a8f[_0xa56f('0x97')][_0xa56f('0x96')];}if(_0x180a8f[_0xa56f('0x97')][_0xa56f('0x92')]&&_0x180a8f[_0xa56f('0x97')]['List'][_0xa56f('0x94')][_0xa56f('0x3a')]){return _0x180a8f[_0xa56f('0x97')][_0xa56f('0x92')][_0xa56f('0x94')][0x0];}var _0x57db7d=_[_0xa56f('0xa')](_0x502609['body'],{'firstName':_0x502609[_0xa56f('0x4e')][_0xa56f('0x8b')],'ListId':_0x11e7b2[_0xa56f('0x8a')]});_0x57db7d[_0x502609[_0xa56f('0x4e')]['mapKey']]=_0x502609[_0xa56f('0x4e')]['from'];return db[_0xa56f('0x93')][_0xa56f('0x4d')](_0x57db7d,{'fields':_0x235ed1,'raw':!![]});}})[_0xa56f('0x27')](handleEntityNotFound(_0x543cd9,null))[_0xa56f('0x27')](function(_0x2bc455){_0x180a8f[_0xa56f('0x9b')]=_0x2bc455;var _0x5c2e77=_0x502609[_0xa56f('0x4e')]['customerIp'];if(_0x502609['headers'][_0xa56f('0x9c')]){_0x5c2e77=_0x502609[_0xa56f('0x9d')][_0xa56f('0x9c')];}else if(_0x502609[_0xa56f('0x9d')][_0xa56f('0x9e')]){_0x5c2e77=_[_0xa56f('0x9f')](_0x502609[_0xa56f('0x9d')]['x-forwarded-for'][_0xa56f('0xa0')](','));}if(_0x2bc455){var _0x201c4d={'ContactId':_0x2bc455['id'],'ChatWebsiteId':_0x502609[_0xa56f('0x4a')]['id'],'from':(_0x2bc455[_0xa56f('0xa1')]||'')+'\x20'+(_0x2bc455['lastName']||''),'customerIp':_0x5c2e77,'customerPort':_0x502609[_0xa56f('0x9d')][_0xa56f('0xa2')]?_0x502609[_0xa56f('0x9d')][_0xa56f('0xa2')]:null,'referer':_0x502609[_0xa56f('0x4e')][_0xa56f('0xa3')],'browserName':_0x2b2fdd[_0xa56f('0xa4')][_0xa56f('0x2c')]&&_0x2b2fdd[_0xa56f('0xa4')][_0xa56f('0xa5')]?util[_0xa56f('0xa6')](_0xa56f('0xa7'),_0x2b2fdd[_0xa56f('0xa4')][_0xa56f('0x2c')],_0x2b2fdd[_0xa56f('0xa4')][_0xa56f('0xa5')]):'unknown','browserVersion':_0x2b2fdd[_0xa56f('0xa4')][_0xa56f('0xa5')]||'unknown','osName':util['format'](_0xa56f('0xa7'),_0x2b2fdd['os'][_0xa56f('0x2c')],_0x2b2fdd['os']['version']),'osVersion':_0x2b2fdd['os'][_0xa56f('0xa5')],'deviceModel':_0x2b2fdd[_0xa56f('0xa8')]['model']&&_0x2b2fdd[_0xa56f('0xa8')][_0xa56f('0xa9')]?util[_0xa56f('0xa6')]('%s\x20%s\x20%s',_0x2b2fdd[_0xa56f('0xa8')][_0xa56f('0x33')],_0x2b2fdd[_0xa56f('0xa8')][_0xa56f('0xa9')],_0x2b2fdd[_0xa56f('0xa8')][_0xa56f('0xaa')]):null,'deviceVendor':_0x2b2fdd[_0xa56f('0xa8')]['vendor'],'deviceType':_0x2b2fdd['device'][_0xa56f('0xaa')],'formData':JSON[_0xa56f('0x15')](_0x502609[_0xa56f('0x4e')])};var _0x1c0ea4={'ChatWebsiteId':_0x502609[_0xa56f('0x4a')]['id'],'closed':![]};if(_0x502609[_0xa56f('0x4e')][_0xa56f('0xab')]){_0x1c0ea4[_0xa56f('0xab')]=_0x502609['body'][_0xa56f('0xab')];return db[_0xa56f('0xac')][_0xa56f('0x52')]({'where':_0x1c0ea4})[_0xa56f('0x27')](function(_0x812c9c){if(_0x812c9c){return[_0x812c9c,![]];}_0x201c4d[_0xa56f('0xab')]=_0x502609[_0xa56f('0x4e')]['threadId'];_0x201c4d[_0xa56f('0xad')]=_0x502609[_0xa56f('0x4e')][_0xa56f('0xad')];return db[_0xa56f('0xac')][_0xa56f('0x4d')](_0x201c4d)['then'](function(_0x59e617){return[_0x59e617,!![]];});});}_0x1c0ea4[_0xa56f('0xae')]=_0x2bc455['id'];if(_0x502609['body'][_0xa56f('0xaf')]&&_0x502609[_0xa56f('0x4e')][_0xa56f('0xaf')]['id']){_0x1c0ea4['id']=_0x502609[_0xa56f('0x4e')][_0xa56f('0xaf')]['id'];return db['ChatInteraction']['find']({'where':_0x1c0ea4})[_0xa56f('0x27')](function(_0x5ba082){if(_0x5ba082){return[_0x5ba082,![]];}return db[_0xa56f('0xac')][_0xa56f('0x4d')](_0x201c4d)[_0xa56f('0x27')](function(_0x77ae9f){return[_0x77ae9f,!![]];});});}return db[_0xa56f('0xac')][_0xa56f('0x4d')](_0x201c4d)[_0xa56f('0x27')](function(_0x3cc61c){return[_0x3cc61c,!![]];});}})['spread'](function(_0xa20249,_0x1ef907){if(_0xa20249){_0x5068ca=_0x1ef907;if(!_0x1ef907){var _0x45bf0b={'from':(_0x180a8f[_0xa56f('0x9b')]['firstName']||'')+'\x20'+(_0x180a8f['contact'][_0xa56f('0xb0')]||'')};if(_0x502609[_0xa56f('0x4e')][_0xa56f('0xab')]&&_0x502609[_0xa56f('0x4e')]['messageId']&&_0x502609[_0xa56f('0x4e')][_0xa56f('0xab')]!=_0x502609[_0xa56f('0x4e')][_0xa56f('0xb1')]){_0x45bf0b[_0xa56f('0xab')]=_0x502609[_0xa56f('0x4e')][_0xa56f('0xb1')];}return _0xa20249[_0xa56f('0x25')](_0x45bf0b);}else{return _0xa20249;}}})[_0xa56f('0x27')](function(_0x4b5876){_0x180a8f['interaction']=_0x4b5876['get']({'plain':!![]});_0x180a8f[_0xa56f('0xaf')][_0xa56f('0xb2')]=_0x5068ca;if(_0x180a8f['interaction'][_0xa56f('0xb2')]){if(_0x180a8f[_0xa56f('0x97')][_0xa56f('0xb3')]){_0x180a8f['applications'][_0xa56f('0xb4')]({'id':0x0,'priority':_0x180a8f[_0xa56f('0x98')][_0xa56f('0x3a')]+0x1,'app':_0xa56f('0xb5'),'appdata':_0xa56f('0xb6'),'interval':_0xa56f('0xb7')});}}return db['ChatMessage'][_0xa56f('0x4d')]({'body':_0x502609['body']['body'],'ChatWebsiteId':_0x502609[_0xa56f('0x4a')]['id'],'ChatInteractionId':_0x4b5876['id'],'direction':'in','ContactId':_0x180a8f[_0xa56f('0x9b')]['id'],'AttachmentId':_0x502609[_0xa56f('0x4e')][_0xa56f('0xb8')]});})['then'](function(_0x255869){_0x180a8f[_0xa56f('0x19')]=_0x255869;if(_0x180a8f[_0xa56f('0xaf')]['UserId']){return db[_0xa56f('0xb9')][_0xa56f('0x52')]({'attributes':['id',_0xa56f('0x2c')],'where':{'id':_0x180a8f[_0xa56f('0xaf')][_0xa56f('0xba')]}})['then'](function(_0x33537d){if(_0x33537d){_0x180a8f[_0xa56f('0x98')][_0xa56f('0xbb')]({'id':0x0,'priority':0x0,'app':_0xa56f('0xbc'),'appdata':_0x33537d['name']+','+(_0x180a8f[_0xa56f('0x97')][_0xa56f('0xbd')]||0xa),'interval':_0xa56f('0xb7')});_0x180a8f[_0xa56f('0xbe')]=!![];}return respondWithRpcPromise(_0xa56f('0xbf'),_0xa56f('0xc0'),_0x180a8f);});}return respondWithRpcPromise('Start',_0xa56f('0xc0'),_0x180a8f);})[_0xa56f('0x27')](function(_0x5ea871){respondWithRpcPromise(_0xa56f('0xc1'),_0xa56f('0xc1'),{'event':'notify','message':_0x5ea871},client9002);return _0x5ea871;})[_0xa56f('0x27')](respondWithResult(_0x543cd9,null))['catch'](handleError(_0x543cd9,null));};exports[_0xa56f('0xc2')]=function(_0x9bbe3c,_0x1b8607){var _0x552378,_0x5ecb45,_0x157ef5;var _0x20cf75=[];var _0x1fa3e8={};var _0x1c005b=_0x9bbe3c[_0xa56f('0xc3')]||[];var _0x2157eb=[];var _0x4cca20;return db['CmContact'][_0xa56f('0x55')]()[_0xa56f('0x27')](function(_0x5368a0){if(!_0x5368a0){throw new db['Sequelize']['ValidationError'](_0xa56f('0x85'));}_0x20cf75=_[_0xa56f('0x86')](_['keys'](_0x5368a0),[_0xa56f('0x88'),'updatedAt','CompanyId','ListId']);if(_0x9bbe3c['body']['id']){delete _0x9bbe3c[_0xa56f('0x4e')]['id'];}if(_[_0xa56f('0x76')](_0x9bbe3c[_0xa56f('0x4e')][_0xa56f('0x8b')])){throw _0x1b8607[_0xa56f('0x1c')](0x1f4)[_0xa56f('0x2d')](new db[(_0xa56f('0x83'))][(_0xa56f('0x84'))](_0xa56f('0x8c')));}if(_['isNil'](_0x9bbe3c[_0xa56f('0x4e')]['body'])||_0x9bbe3c[_0xa56f('0x4e')][_0xa56f('0x4e')]===''){throw _0x1b8607[_0xa56f('0x1c')](0x1f4)[_0xa56f('0x2d')](new db['Sequelize']['ValidationError'](_0xa56f('0x8d')));}if(_[_0xa56f('0x76')](_0x9bbe3c[_0xa56f('0x4e')][_0xa56f('0xc4')])){throw _0x1b8607[_0xa56f('0x1c')](0x1f4)['send'](new db[(_0xa56f('0x83'))][(_0xa56f('0x84'))](_0xa56f('0xc5')+_0x20cf75));}if(!_[_0xa56f('0xc6')](_0x20cf75,_0x9bbe3c[_0xa56f('0x4e')][_0xa56f('0xc4')])){throw _0x1b8607['status'](0x1f4)['send'](new db[(_0xa56f('0x83'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x20cf75));}_0x1fa3e8[_0x9bbe3c[_0xa56f('0x4e')][_0xa56f('0xc4')]]=_0x9bbe3c[_0xa56f('0x4e')][_0xa56f('0x8b')];})[_0xa56f('0x27')](function(){return db['ChatWebsite'][_0xa56f('0x52')]({'where':{'id':_0x9bbe3c[_0xa56f('0x4a')]['id']},'include':[{'model':db[_0xa56f('0x91')],'as':_0xa56f('0x92')},{'model':db[_0xa56f('0xc7')],'as':_0xa56f('0xc7')}]});})[_0xa56f('0x27')](handleEntityNotFound(_0x1b8607,null))[_0xa56f('0x27')](function(_0x1a618a){if(_0x1a618a&&_0x1a618a[_0xa56f('0x92')]){_0x5ecb45=_0x1a618a;var _0xd6737c=_[_0xa56f('0xa')](_0x9bbe3c[_0xa56f('0x4e')],{'firstName':_0x9bbe3c['body'][_0xa56f('0x8b')],'phone':_0x9bbe3c[_0xa56f('0x4e')]['from'],'ListId':_0x1a618a['ListId']});_0xd6737c[_0x9bbe3c[_0xa56f('0x4e')][_0xa56f('0xc4')]]=_0x9bbe3c['body']['from'];return db['CmContact'][_0xa56f('0xc8')]({'where':_0x1fa3e8,'defaults':_0xd6737c});}})['spread'](function(_0x2e8db8){if(_0x2e8db8){_0x157ef5=_0x2e8db8;var _0x42885a=fs[_0xa56f('0xc9')](path['join'](config[_0xa56f('0x6d')],'server/files/templates/chatOfflineMessage.ejs'),_0xa56f('0xca'));var _0x1f93a2=ejs[_0xa56f('0xcb')](_0x42885a,{'body':_['toPairs'](_0x9bbe3c[_0xa56f('0x4e')]['body']),'bodyTitle':_0x5ecb45[_0xa56f('0xcc')]});return db[_0xa56f('0xcd')][_0xa56f('0x4d')]({'body':_0x1f93a2,'plainBody':htmlToText['fromString'](_0x1f93a2),'ContactId':_0x2e8db8['id'],'ChatWebsiteId':_0x5ecb45['id']});}})['then'](function(_0x2388fe){_0x4cca20=_0x2388fe;if(_0x1c005b[_0xa56f('0x3a')]){var _0x23e732=_0x1c005b['map'](function(_0x38c602){return{'name':_0x38c602[_0xa56f('0xce')],'basename':_0x38c602[_0xa56f('0x65')],'type':_0x38c602['mimetype'],'ChatOfflineMessageId':_0x2388fe['id']};});_0x2157eb=_0x23e732[_0xa56f('0x34')](_0x301360=>{var _0xa69d5f={'filename':_0x301360[_0xa56f('0x2c')],'path':path[_0xa56f('0x6c')](config[_0xa56f('0x6d')],_0xa56f('0xcf'),_0xa56f('0xc3'),_0xa56f('0xd0'),_0xa56f('0xd1'),_0x301360[_0xa56f('0xd2')])};return _0xa69d5f;});if(!_0x5ecb45[_0xa56f('0xd3')]){return db['sequelize'][_0xa56f('0xd4')](function(_0x42412d){return db['Attachment'][_0xa56f('0xd5')](_0x23e732,{'transaction':_0x42412d});});}}})['then'](function(){if(_0x4cca20){_0x552378=_0x4cca20;return db[_0xa56f('0xc7')][_0xa56f('0x5f')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xa56f('0xd6')],'as':_0xa56f('0xd6'),'raw':!![]}]}]});}})['then'](function(_0x100411){if(_0x100411&&_0x100411[_0xa56f('0xd7')]&&_0x5ecb45[_0xa56f('0xd8')]&&_0x5ecb45[_0xa56f('0xd9')]){var _0x3364e8=_0x100411[_0xa56f('0xda')]();return respondWithRpcPromise(_0xa56f('0xdb'),'sendMail',{'account':_0x3364e8,'message':{'from':util['format'](_0xa56f('0xdc'),_0x100411['name'],_0x100411[_0xa56f('0xdd')]||_0x100411[_0xa56f('0xd7')][_0xa56f('0x4f')]),'to':_0x5ecb45[_0xa56f('0xd9')],'subject':_0x5ecb45[_0xa56f('0xde')],'html':_0x552378[_0xa56f('0x4e')],'attachments':_0x2157eb}},client9003)[_0xa56f('0x27')](function(){return _0x552378;})['catch'](function(_0x3696c5){logger['error'](_0x3696c5);});}})[_0xa56f('0x27')](function(){if(_0x5ecb45&&_0x5ecb45[_0xa56f('0xd3')]&&_0x5ecb45[_0xa56f('0xdf')]){var _0x276eb9=[];if(_0x1c005b[_0xa56f('0x3a')]){_0x276eb9=_0x1c005b[_0xa56f('0x34')](function(_0xa9fcf7){return{'name':_0xa9fcf7[_0xa56f('0xce')],'basename':_0xa9fcf7[_0xa56f('0x65')],'type':_0xa9fcf7[_0xa56f('0xe0')],'ChatOfflineMessageId':_0x4cca20['id']};});}var _0x269d4d;if(!_[_0xa56f('0x76')](_0x5ecb45[_0xa56f('0xe1')])){var _0x25c8e2=_[_0xa56f('0x34')](_0x9bbe3c[_0xa56f('0x4e')],function(_0x4b5798){return _0x4b5798;});var _0x531539=_[_0xa56f('0xe2')](_0x25c8e2)[0x0];var _0x630cf8=_['mapValues'](_0x531539,function(_0x8dd234){return _0x8dd234;});_0x269d4d=_0x630cf8[0x1][_0x5ecb45[_0xa56f('0xe1')]];}var _0x48365e={'from':_0x157ef5[_0xa56f('0xdd')],'firstName':_0x157ef5[_0xa56f('0xa1')],'lastName':_0x157ef5['lastName'],'mapKey':_0xa56f('0xdd'),'message':{'from':_0x157ef5[_0xa56f('0xdd')],'to':_0x5ecb45[_0xa56f('0xc7')][_0xa56f('0xdd')],'cc':'','subject':_[_0xa56f('0x76')](_0x269d4d)?_0x5ecb45[_0xa56f('0xde')]:_0x269d4d,'messageId':'','sentAt':new Date(),'attach':_0x276eb9['length'],'attachments':_0x276eb9,'originChannel':_0xa56f('0xe3'),'ChatWebsiteId':_0x5ecb45['id'],'ChatOfflineMessageId':_0x552378['id'],'originTo':_0x5ecb45[_0xa56f('0xc7')][_0xa56f('0xdd')]},'body':_0x552378['body']};var _0x4c931c={'account':{'id':_0x5ecb45[_0xa56f('0xdf')]},'body':_0x48365e,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x4c931c,client9001)[_0xa56f('0x27')](function(){return _0x552378;})[_0xa56f('0x4c')](function(_0x2f7b2e){logger[_0xa56f('0x16')](_0x2f7b2e);});}return;})['then'](function(){if(_0x552378){return _0x552378;}})[_0xa56f('0x27')](respondWithResult(_0x1b8607,null))[_0xa56f('0x4c')](function(_0x3bf0ec){logger[_0xa56f('0x16')]('catch',_0x3bf0ec);for(var _0x42ef44 of _0x1c005b){var _0x4d5d92=path[_0xa56f('0x6c')](config[_0xa56f('0x6d')],'server',_0xa56f('0xc3'),'attachments',_0xa56f('0xd1'),_0x42ef44['filename']);fs_extra[_0xa56f('0xe4')](_0x4d5d92)['catch'](function(_0x367d4b){logger[_0xa56f('0x16')]('Could\x20not\x20remove\x20attachment\x20file',_0x4d5d92,_0x367d4b);});}});};exports[_0xa56f('0xe5')]=function(_0x88e0f0,_0x5bae0d){return db[_0xa56f('0xac')][_0xa56f('0x52')]({'where':{'id':_0x88e0f0[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x5bae0d,null))[_0xa56f('0x27')](function(_0x58012f){if(_0x58012f){return _0x58012f[_0xa56f('0xe5')](_0x88e0f0[_0xa56f('0x4e')][_0xa56f('0x5b')],_[_0xa56f('0xe6')](_0x88e0f0[_0xa56f('0x4e')],['ids','id'])||{});}})[_0xa56f('0x27')](respondWithResult(_0x5bae0d,null))['catch'](handleError(_0x5bae0d,null));};exports[_0xa56f('0xe7')]=function(_0x28a064,_0x2cdaa8){var _0x4a374b={'raw':![],'where':{}};var _0x4e93c3={};var _0x5cc501={'count':0x0,'rows':[]};return db[_0xa56f('0x30')][_0xa56f('0x5f')]({'where':{'id':_0x28a064[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x2cdaa8,null))[_0xa56f('0x27')](function(_0x27c5d5){if(_0x27c5d5){_0x4e93c3[_0xa56f('0x33')]=_[_0xa56f('0x36')](db['ChatInteraction'][_0xa56f('0x31')]);_0x4e93c3['query']=_[_0xa56f('0x36')](_0x28a064[_0xa56f('0x35')]);_0x4e93c3[_0xa56f('0x40')]=_['intersection'](_0x4e93c3['model'],_0x4e93c3[_0xa56f('0x35')]);_0x4a374b['attributes']=_[_0xa56f('0x37')](_0x4e93c3[_0xa56f('0x33')],qs['fields'](_0x28a064[_0xa56f('0x35')][_0xa56f('0x39')]));_0x4a374b[_0xa56f('0x38')]=_0x4a374b['attributes'][_0xa56f('0x3a')]?_0x4a374b['attributes']:_0x4e93c3['model'];if(!_0x28a064[_0xa56f('0x35')][_0xa56f('0x3b')](_0xa56f('0x3c'))){_0x4a374b[_0xa56f('0x22')]=qs[_0xa56f('0x22')](_0x28a064[_0xa56f('0x35')]['limit']);_0x4a374b['offset']=qs[_0xa56f('0x1f')](_0x28a064['query']['offset']);}_0x4a374b['order']=qs['sort'](_0x28a064[_0xa56f('0x35')][_0xa56f('0x3e')]);_0x4a374b[_0xa56f('0x3f')]=qs[_0xa56f('0x40')](_['pick'](_0x28a064[_0xa56f('0x35')],_0x4e93c3['filters']));_0x4a374b[_0xa56f('0x3f')]['ChatWebsiteId']=_0x27c5d5['id'];if(_0x28a064[_0xa56f('0x35')][_0xa56f('0x42')]){_0x4a374b[_0xa56f('0x3f')]=_[_0xa56f('0x44')](_0x4a374b[_0xa56f('0x3f')],{'$or':_[_0xa56f('0x34')](_0x4a374b['attributes'],function(_0x43b0c4){var _0x322678={};_0x322678[_0x43b0c4]={'$like':'%'+_0x28a064[_0xa56f('0x35')][_0xa56f('0x42')]+'%'};return _0x322678;})});}_0x4a374b=_[_0xa56f('0x44')]({},_0x4a374b,_0x28a064['options']);return db['ChatInteraction'][_0xa56f('0x21')]({'where':_0x4a374b[_0xa56f('0x3f')]})['then'](function(_0x1617d0){_0x5cc501[_0xa56f('0x21')]=_0x1617d0;if(_0x28a064[_0xa56f('0x35')][_0xa56f('0x46')]){_0x4a374b['include']=[{'model':db[_0xa56f('0x93')],'as':'Contact','required':![]},{'model':db[_0xa56f('0xb9')],'as':_0xa56f('0xe8'),'attributes':['name',_0xa56f('0xe9'),'internal'],'required':![]},{'model':db[_0xa56f('0xea')],'as':'Tags','attributes':['id',_0xa56f('0x2c'),_0xa56f('0xeb')],'where':_0x28a064[_0xa56f('0x35')][_0xa56f('0xec')]?{'id':_0x28a064[_0xa56f('0x35')][_0xa56f('0xec')]}:undefined,'required':_0x28a064[_0xa56f('0x35')][_0xa56f('0xec')]?!![]:![]}];}return db[_0xa56f('0xac')][_0xa56f('0x48')](_0x4a374b);})[_0xa56f('0x27')](function(_0x475f9e){_0x5cc501[_0xa56f('0x60')]=_0x475f9e;return _0x5cc501;});}})[_0xa56f('0x27')](respondWithFilteredResult(_0x2cdaa8,_0x4a374b))[_0xa56f('0x4c')](handleError(_0x2cdaa8,null));};function iftimePromise(_0x336fb0,_0x13fc97){return respondWithRpcPromise('Command',_0xa56f('0xed'),{'command':_0x13fc97[_0xa56f('0xee')]?util['format'](_0xa56f('0xef'),_0x336fb0[_0xa56f('0xf0')],_0x13fc97['timezone']):util[_0xa56f('0xa6')](_0xa56f('0xf1'),_0x336fb0[_0xa56f('0xf0')])},client9002)[_0xa56f('0x27')](function(_0x14e42c){var _0x2ce301=_0x14e42c&&_0x14e42c[_0xa56f('0xf2')](_0xa56f('0xf3'))>=0x0?!![]:![];logger['info'](_0xa56f('0xf4'),_0x13fc97['id'],_0x336fb0['id'],_0x336fb0[_0xa56f('0xf0')],_0x2ce301?_0xa56f('0xf5'):_0xa56f('0xf6'),_0x13fc97[_0xa56f('0xee')]?_0x13fc97[_0xa56f('0xee')]:_0xa56f('0xf7'));return _0x2ce301;})[_0xa56f('0x4c')](function(_0x3dc670){logger[_0xa56f('0x16')](_0xa56f('0xf4'),_0x13fc97['id'],_0x336fb0['id'],_0x336fb0['interval'],util[_0xa56f('0xf8')](_0x3dc670,{'showHidden':![],'depth':null}),_0x13fc97['timezone']?_0x13fc97[_0xa56f('0xee')]:'No\x20timezone');return![];});}exports[_0xa56f('0xed')]=function(_0x2654a5,_0x3ee2f9){var _0x2ada27=0x0;var _0x4399e5=0x0;var _0x383403=![];var _0x4d87f2;var _0x4a08b5;return db[_0xa56f('0x30')][_0xa56f('0x52')]({'where':{'id':_0x2654a5[_0xa56f('0x4a')]['id']},'include':[{'model':db[_0xa56f('0xf9')],'as':_0xa56f('0xf9'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0xa56f('0xf0')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3ee2f9,null))[_0xa56f('0x27')](function(_0x546347){if(_0x546347){_0x4d87f2=_0x546347;return _0x546347[_0xa56f('0xfa')]({'raw':!![]});}})['then'](function(_0x1f6cc0){if(_0x4d87f2){if(_0x1f6cc0){_0x4a08b5=_0x1f6cc0;}}return require(_0xa56f('0x6f'))[_0xa56f('0x70')]();})[_0xa56f('0x27')](function(_0x286fb6){if(_0x286fb6){_0x4399e5=_0x286fb6[_0xa56f('0xfb')];_0x383403=_0x286fb6[_0xa56f('0xfc')];}})[_0xa56f('0x27')](function(){return db[_0xa56f('0xac')]['count']({'where':{'closed':![]}});})[_0xa56f('0x27')](function(_0x255151){_0x2ada27=_0x255151;if(_0x4399e5&&_0x255151>_0x4399e5){return db['License'][_0xa56f('0x5f')]({'where':{'id':0x1}})['then'](function(_0x1e1e66){if(_0x1e1e66){_0x1e1e66[_0xa56f('0xfd')](_0xa56f('0xfe'));}});}})['then'](function(){if(_0x4d87f2[_0xa56f('0xf9')]&&_0x4d87f2[_0xa56f('0xf9')]['Intervals']){var _0x355ea1=[];for(var _0x281610=0x0;_0x281610<_0x4d87f2[_0xa56f('0xf9')][_0xa56f('0xff')]['length'];_0x281610++){var _0x6e8b23=_0x4d87f2['Interval'][_0xa56f('0xff')][_0x281610][_0xa56f('0x28')]({'plain':!![]});_0x355ea1[_0xa56f('0xb4')](iftimePromise(_0x6e8b23,_0x4d87f2));}return BPromise['all'](_0x355ea1)[_0xa56f('0x27')](function(_0x259874){return _[_0xa56f('0x100')](_0x259874);});}else{return!![];}})['then'](function(_0x471a4e){var _0x370a6f=fs[_0xa56f('0xc9')](path['join'](config[_0xa56f('0x6d')],_0xa56f('0x101')),_0xa56f('0xca'));var _0x56d640=new url['URL'](_0x4d87f2[_0xa56f('0x102')])['origin'];var _0x3049f3='3.1.0';var _0x4e9b33=![];var _0xc19457={'chatVersion':_0x3049f3,'chatWebsiteAddressOrigin':_0x56d640,'remote':_0x4d87f2[_0xa56f('0x103')],'query':querystring['stringify'](_['merge'](_0x4d87f2[_0xa56f('0x28')]({'plain':!![]}),{'customerIp':_0x2654a5['headers']['x-forwarded-for']||_0x2654a5['headers'][_0xa56f('0x104')]||_0x2654a5[_0xa56f('0x105')]['remoteAddress']||_0x2654a5['ip'],'referer':_0x2654a5['headers'][_0xa56f('0xa3')],'openedInteractions':_0x2ada27,'maxInteractions':_0x4399e5,'virtual':_0x383403[_0xa56f('0xfb')],'online':_0x471a4e,'custom':_0x383403}))[_0xa56f('0x106')](/'/g,'\x5c\x27')};_0x3ee2f9[_0xa56f('0x2d')](ejs[_0xa56f('0xcb')](Mustache[_0xa56f('0xcb')](_0x370a6f,_0xc19457),{'proactiveActions':_0x4a08b5,'alignment':_0x4d87f2[_0xa56f('0x107')],'verticalAlignment':_0x4d87f2[_0xa56f('0x108')],'div_color':_0x4d87f2[_0xa56f('0xeb')],'labelText':_0x4d87f2['labelText'],'text_color':_0x4d87f2[_0xa56f('0x109')],'text_button_color':_0x4d87f2[_0xa56f('0x10a')],'button_color':_0x4d87f2[_0xa56f('0x10b')],'background_color':_0x4d87f2['backgroundColor'],'hideWhenOffline':_0x4d87f2[_0xa56f('0x10c')],'intervalId':_0x4d87f2[_0xa56f('0x10d')],'isDevelopment':_0x4e9b33,'chatVersion':_0x3049f3}));})[_0xa56f('0x4c')](handleError(_0x3ee2f9,null));};exports['addApplications']=function(_0x53c41f,_0x2cbe41){var _0x1368e8=_0x53c41f[_0xa56f('0x4a')]['id'];var _0xee08dd=_0x53c41f['body'];var _0x1d4ff6=0xc8;var _0x941444=null;return db[_0xa56f('0x10e')][_0xa56f('0xd4')]({'isolationLevel':db[_0xa56f('0x10e')][_0xa56f('0x10f')][_0xa56f('0x110')]['READ_COMMITTED']},function(_0x14570b){return db[_0xa56f('0x30')][_0xa56f('0x5f')]({'where':{'id':_0x1368e8},'transaction':_0x14570b})[_0xa56f('0x27')](function(_0x1f1e1c){if(_0x1f1e1c){return db['ChatApplication'][_0xa56f('0x26')]({'where':{'ChatWebsiteId':_0x1368e8},'transaction':_0x14570b})[_0xa56f('0x27')](function(){var _0x3a7b38=_[_0xa56f('0x34')](_0xee08dd,function(_0x1566a1){_0x1566a1['ChatWebsiteId']=_0x1368e8;return _0x1566a1;});return db[_0xa56f('0x111')]['bulkCreate'](_0x3a7b38,{'transaction':_0x14570b});});}else{_0x1d4ff6=0x194;_0x941444=[];}});})['then'](function(){if(_0x1d4ff6!==0x194){return db[_0xa56f('0x111')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x1368e8},'order':_0xa56f('0x112')})[_0xa56f('0x27')](function(_0x161bb2){_0x941444=_0x161bb2;});}})[_0xa56f('0x4c')](function(_0x449e3f){_0x1d4ff6=0x1f4;logger['error'](_0x449e3f[_0xa56f('0x2b')]);if(_0x449e3f[_0xa56f('0x2c')]){delete _0x449e3f[_0xa56f('0x2c')];}_0x941444=_0x449e3f;})[_0xa56f('0x113')](function(){if(_0x941444===null){_0x2cbe41['sendStatus'](_0x1d4ff6);}else{if(_0x1d4ff6===0x1f4){_0x2cbe41['status'](_0x1d4ff6)[_0xa56f('0x2d')](_0x941444);}else{_0x2cbe41['status'](_0x1d4ff6)[_0xa56f('0x1e')](_0x941444);}}});};exports[_0xa56f('0x114')]=function(_0x9d749f,_0x1aad8a){var _0x42bc42={};var _0x15f7c5={};var _0x2cc073;var _0x177b02;return db['ChatWebsite']['findOne']({'where':{'id':_0x9d749f[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x1aad8a,null))[_0xa56f('0x27')](function(_0x5df434){if(_0x5df434){_0x2cc073=_0x5df434;_0x15f7c5['model']=_[_0xa56f('0x36')](db[_0xa56f('0x111')][_0xa56f('0x31')]);_0x15f7c5['query']=_[_0xa56f('0x36')](_0x9d749f[_0xa56f('0x35')]);_0x15f7c5[_0xa56f('0x40')]=_[_0xa56f('0x37')](_0x15f7c5[_0xa56f('0x33')],_0x15f7c5['query']);_0x42bc42[_0xa56f('0x38')]=_[_0xa56f('0x37')](_0x15f7c5['model'],qs['fields'](_0x9d749f[_0xa56f('0x35')][_0xa56f('0x39')]));_0x42bc42[_0xa56f('0x38')]=_0x42bc42['attributes'][_0xa56f('0x3a')]?_0x42bc42[_0xa56f('0x38')]:_0x15f7c5[_0xa56f('0x33')];_0x42bc42[_0xa56f('0x3d')]=qs[_0xa56f('0x3e')](_0x9d749f[_0xa56f('0x35')][_0xa56f('0x3e')]);_0x42bc42[_0xa56f('0x3f')]=qs[_0xa56f('0x40')](_['pick'](_0x9d749f[_0xa56f('0x35')],_0x15f7c5[_0xa56f('0x40')]));if(_0x9d749f[_0xa56f('0x35')][_0xa56f('0x42')]){_0x42bc42['where']=_[_0xa56f('0x44')](_0x42bc42[_0xa56f('0x3f')],{'$or':_[_0xa56f('0x34')](_0x42bc42[_0xa56f('0x38')],function(_0x1ce365){var _0x30cecd={};_0x30cecd[_0x1ce365]={'$like':'%'+_0x9d749f[_0xa56f('0x35')][_0xa56f('0x42')]+'%'};return _0x30cecd;})});}_0x42bc42=_[_0xa56f('0x44')]({},_0x42bc42,_0x9d749f[_0xa56f('0x45')]);return _0x2cc073[_0xa56f('0x114')](_0x42bc42);}})['then'](function(_0x17f212){if(_0x17f212){_0x177b02=_0x17f212[_0xa56f('0x3a')];if(!_0x9d749f[_0xa56f('0x35')][_0xa56f('0x3b')]('nolimit')){_0x42bc42['limit']=qs[_0xa56f('0x22')](_0x9d749f[_0xa56f('0x35')][_0xa56f('0x22')]);_0x42bc42['offset']=qs['offset'](_0x9d749f[_0xa56f('0x35')]['offset']);}return _0x2cc073[_0xa56f('0x114')](_0x42bc42);}})[_0xa56f('0x27')](function(_0x28c495){if(_0x28c495){return _0x28c495?{'count':_0x177b02,'rows':_0x28c495}:null;}})[_0xa56f('0x27')](respondWithResult(_0x1aad8a,null))[_0xa56f('0x4c')](handleError(_0x1aad8a,null));};exports['addProactiveActions']=function(_0x2b62fd,_0x210ee2){return db[_0xa56f('0x115')][_0xa56f('0x52')]({'where':{'id':_0x2b62fd[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x210ee2,null))[_0xa56f('0x27')](function(_0x3c5348){if(_0x3c5348){return _0x3c5348[_0xa56f('0x116')](_0x2b62fd[_0xa56f('0x4e')]['ids'],_[_0xa56f('0xe6')](_0x2b62fd[_0xa56f('0x4e')],['ids','id'])||{});}})[_0xa56f('0x27')](respondWithResult(_0x210ee2,null))[_0xa56f('0x4c')](handleError(_0x210ee2,null));};exports[_0xa56f('0xfa')]=function(_0x37d183,_0x20e5c5){var _0x548d70={};var _0x2d2aa1={};var _0x72aacf;var _0x5ee7c3;return db[_0xa56f('0x30')]['findOne']({'where':{'id':_0x37d183['params']['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x20e5c5,null))[_0xa56f('0x27')](function(_0x13ab67){if(_0x13ab67){_0x72aacf=_0x13ab67;_0x2d2aa1[_0xa56f('0x33')]=_[_0xa56f('0x36')](db['ChatProactiveAction'][_0xa56f('0x31')]);_0x2d2aa1[_0xa56f('0x35')]=_[_0xa56f('0x36')](_0x37d183[_0xa56f('0x35')]);_0x2d2aa1[_0xa56f('0x40')]=_[_0xa56f('0x37')](_0x2d2aa1[_0xa56f('0x33')],_0x2d2aa1[_0xa56f('0x35')]);_0x548d70[_0xa56f('0x38')]=_[_0xa56f('0x37')](_0x2d2aa1[_0xa56f('0x33')],qs[_0xa56f('0x39')](_0x37d183[_0xa56f('0x35')][_0xa56f('0x39')]));_0x548d70['attributes']=_0x548d70[_0xa56f('0x38')]['length']?_0x548d70['attributes']:_0x2d2aa1['model'];_0x548d70['order']=qs[_0xa56f('0x3e')](_0x37d183[_0xa56f('0x35')][_0xa56f('0x3e')]);_0x548d70[_0xa56f('0x3f')]=qs[_0xa56f('0x40')](_['pick'](_0x37d183[_0xa56f('0x35')],_0x2d2aa1[_0xa56f('0x40')]));if(_0x37d183[_0xa56f('0x35')][_0xa56f('0x42')]){_0x548d70[_0xa56f('0x3f')]=_[_0xa56f('0x44')](_0x548d70['where'],{'$or':_['map'](_0x548d70[_0xa56f('0x38')],function(_0x5593f2){var _0x433805={};_0x433805[_0x5593f2]={'$like':'%'+_0x37d183[_0xa56f('0x35')][_0xa56f('0x42')]+'%'};return _0x433805;})});}_0x548d70=_[_0xa56f('0x44')]({},_0x548d70,_0x37d183['options']);return _0x72aacf[_0xa56f('0xfa')](_0x548d70);}})['then'](function(_0x25ecbe){if(_0x25ecbe){_0x5ee7c3=_0x25ecbe['length'];if(!_0x37d183[_0xa56f('0x35')][_0xa56f('0x3b')]('nolimit')){_0x548d70[_0xa56f('0x22')]=qs['limit'](_0x37d183[_0xa56f('0x35')][_0xa56f('0x22')]);_0x548d70[_0xa56f('0x1f')]=qs[_0xa56f('0x1f')](_0x37d183[_0xa56f('0x35')][_0xa56f('0x1f')]);}return _0x72aacf['getProactiveActions'](_0x548d70);}})[_0xa56f('0x27')](function(_0x1db8ee){if(_0x1db8ee){return _0x1db8ee?{'count':_0x5ee7c3,'rows':_0x1db8ee}:null;}})[_0xa56f('0x27')](respondWithResult(_0x20e5c5,null))[_0xa56f('0x4c')](handleError(_0x20e5c5,null));};exports[_0xa56f('0x117')]=function(_0x4a0c5c,_0x8f2773){var _0x333494=_0x4a0c5c[_0xa56f('0x35')][_0xa56f('0x118')]===_0xa56f('0x119')?_0xa56f('0x11a'):_0xa56f('0x11b');return db[_0xa56f('0x30')][_0xa56f('0x52')]({'attributes':['id',_0x333494],'where':{'id':_0x4a0c5c[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x8f2773,null))[_0xa56f('0x27')](function(_0x46d4f4){if(_0x46d4f4){var _0xc2b3e7=_0x46d4f4[_0x333494];var _0x2867a8=_0xc2b3e7&&_0xc2b3e7['items']?_0xc2b3e7['items']:[];_0x8f2773[_0xa56f('0x2d')]({'fromKey':_[_0xa56f('0x76')](_0xc2b3e7[_0xa56f('0x11c')])?undefined:_0xc2b3e7[_0xa56f('0x11c')],'count':_0x2867a8['length'],'rows':_0x2867a8});}})[_0xa56f('0x4c')](handleError(_0x8f2773,null));};exports[_0xa56f('0x11d')]=function(_0x2e3ed9,_0x14106f){var _0x58aa21={'raw':![],'where':{}};var _0x1fd12b={};var _0x5ae04b={'count':0x0,'rows':[]};return db[_0xa56f('0x30')][_0xa56f('0x5f')]({'where':{'id':_0x2e3ed9[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x14106f,null))['then'](function(_0x3e7e0b){if(_0x3e7e0b){_0x1fd12b[_0xa56f('0x33')]=_['keys'](db[_0xa56f('0xcd')][_0xa56f('0x31')]);_0x1fd12b[_0xa56f('0x35')]=_['keys'](_0x2e3ed9['query']);_0x1fd12b['filters']=_['intersection'](_0x1fd12b[_0xa56f('0x33')],_0x1fd12b[_0xa56f('0x35')]);_0x58aa21[_0xa56f('0x38')]=_[_0xa56f('0x37')](_0x1fd12b[_0xa56f('0x33')],qs[_0xa56f('0x39')](_0x2e3ed9[_0xa56f('0x35')]['fields']));_0x58aa21[_0xa56f('0x38')]=_0x58aa21['attributes']['length']?_0x58aa21[_0xa56f('0x38')]:_0x1fd12b[_0xa56f('0x33')];if(!_0x2e3ed9[_0xa56f('0x35')]['hasOwnProperty'](_0xa56f('0x3c'))){_0x58aa21[_0xa56f('0x22')]=qs[_0xa56f('0x22')](_0x2e3ed9[_0xa56f('0x35')][_0xa56f('0x22')]);_0x58aa21[_0xa56f('0x1f')]=qs[_0xa56f('0x1f')](_0x2e3ed9['query'][_0xa56f('0x1f')]);}_0x58aa21['order']=qs[_0xa56f('0x3e')](_0x2e3ed9[_0xa56f('0x35')]['sort']);_0x58aa21[_0xa56f('0x3f')]=qs[_0xa56f('0x40')](_[_0xa56f('0x41')](_0x2e3ed9['query'],_0x1fd12b[_0xa56f('0x40')]));_0x58aa21[_0xa56f('0x3f')][_0xa56f('0x57')]=_0x3e7e0b['id'];if(_0x2e3ed9[_0xa56f('0x35')][_0xa56f('0x42')]){_0x58aa21['where']=_[_0xa56f('0x44')](_0x58aa21['where'],{'$or':_['map'](_0x58aa21['attributes'],function(_0x646827){var _0x30710c={};_0x30710c[_0x646827]={'$like':'%'+_0x2e3ed9[_0xa56f('0x35')][_0xa56f('0x42')]+'%'};return _0x30710c;})});}_0x58aa21=_[_0xa56f('0x44')]({},_0x58aa21,_0x2e3ed9[_0xa56f('0x45')]);return db[_0xa56f('0xcd')][_0xa56f('0x21')]({'where':_0x58aa21['where']})['then'](function(_0x4c667b){_0x5ae04b[_0xa56f('0x21')]=_0x4c667b;if(_0x2e3ed9[_0xa56f('0x35')][_0xa56f('0x46')]){_0x58aa21['include']=[{'all':!![]}];}else{_0x58aa21[_0xa56f('0x47')]=[{'model':db[_0xa56f('0x93')],'as':_0xa56f('0x11e'),'required':![]},{'model':db['Attachment'],'as':_0xa56f('0x11f'),'required':![]}];}return db[_0xa56f('0xcd')]['findAll'](_0x58aa21);})[_0xa56f('0x27')](function(_0x140946){_0x5ae04b[_0xa56f('0x60')]=_0x140946;return _0x5ae04b;});}})[_0xa56f('0x27')](respondWithFilteredResult(_0x14106f,_0x58aa21))[_0xa56f('0x4c')](handleError(_0x14106f,null));};exports[_0xa56f('0x120')]=function(_0x139ec7,_0x5582d3){return db['ChatWebsite'][_0xa56f('0x52')]({'where':{'id':_0x139ec7[_0xa56f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5582d3,null))[_0xa56f('0x27')](function(_0xde85dd){if(_0xde85dd){return _0xde85dd['addAgents'](_0x139ec7[_0xa56f('0x4e')]['ids'],_[_0xa56f('0xe6')](_0x139ec7[_0xa56f('0x4e')],['ids','id'])||{})[_0xa56f('0x121')](function(_0x3cb5f4){for(var _0x13a6a7=0x0;_0x13a6a7<_0x139ec7[_0xa56f('0x4e')][_0xa56f('0x5b')][_0xa56f('0x3a')];_0x13a6a7+=0x1){socket[_0xa56f('0x122')](_0xa56f('0x123'),{'UserId':Number(_0x139ec7['body'][_0xa56f('0x5b')][_0x13a6a7]),'ChatWebsiteId':Number(_0x139ec7['params']['id'])});}return _0x3cb5f4;});}})[_0xa56f('0x27')](respondWithResult(_0x5582d3,null))[_0xa56f('0x4c')](handleError(_0x5582d3,null));};exports[_0xa56f('0x124')]=function(_0x509082,_0x1d7750){return db[_0xa56f('0x30')][_0xa56f('0x52')]({'where':{'id':_0x509082[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x1d7750,null))[_0xa56f('0x27')](function(_0x3b47e3){if(_0x3b47e3){return _0x3b47e3['removeAgents'](_0x509082['query']['ids'])['then'](function(){if(_[_0xa56f('0x125')](_0x509082[_0xa56f('0x35')]['ids'])){for(var _0x2bb697=0x0;_0x2bb697<_0x509082[_0xa56f('0x35')][_0xa56f('0x5b')][_0xa56f('0x3a')];_0x2bb697+=0x1){socket[_0xa56f('0x122')]('userChatWebsite:remove',{'UserId':Number(_0x509082[_0xa56f('0x35')][_0xa56f('0x5b')][_0x2bb697]),'ChatWebsiteId':Number(_0x509082[_0xa56f('0x4a')]['id'])});}}else{socket[_0xa56f('0x122')](_0xa56f('0x126'),{'UserId':Number(_0x509082[_0xa56f('0x35')][_0xa56f('0x5b')]),'ChatWebsiteId':Number(_0x509082[_0xa56f('0x4a')]['id'])});}});}})[_0xa56f('0x27')](respondWithStatusCode(_0x1d7750,null))['catch'](handleError(_0x1d7750,null));};exports[_0xa56f('0x127')]=function(_0x528246,_0x172281){var _0x497fe6={};var _0x221cfe={};var _0x4a1541;var _0xb8dc83;return db['ChatWebsite'][_0xa56f('0x5f')]({'where':{'id':_0x528246['params']['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x172281,null))[_0xa56f('0x27')](function(_0x18a23d){if(_0x18a23d){_0x4a1541=_0x18a23d;_0x221cfe[_0xa56f('0x33')]=_[_0xa56f('0x36')](db[_0xa56f('0xb9')][_0xa56f('0x31')]);_0x221cfe['query']=_[_0xa56f('0x36')](_0x528246['query']);_0x221cfe[_0xa56f('0x40')]=_[_0xa56f('0x37')](_0x221cfe[_0xa56f('0x33')],_0x221cfe[_0xa56f('0x35')]);_0x497fe6['attributes']=_[_0xa56f('0x37')](_0x221cfe[_0xa56f('0x33')],qs[_0xa56f('0x39')](_0x528246[_0xa56f('0x35')][_0xa56f('0x39')]));_0x497fe6[_0xa56f('0x38')]=_0x497fe6[_0xa56f('0x38')]['length']?_0x497fe6[_0xa56f('0x38')]:_0x221cfe[_0xa56f('0x33')];_0x497fe6[_0xa56f('0x3d')]=qs[_0xa56f('0x3e')](_0x528246[_0xa56f('0x35')][_0xa56f('0x3e')]);_0x497fe6['where']=qs[_0xa56f('0x40')](_[_0xa56f('0x41')](_0x528246[_0xa56f('0x35')],_0x221cfe[_0xa56f('0x40')]));if(_0x528246[_0xa56f('0x35')]['filter']){_0x497fe6[_0xa56f('0x3f')]=_[_0xa56f('0x44')](_0x497fe6[_0xa56f('0x3f')],{'$or':_['map'](_0x497fe6[_0xa56f('0x38')],function(_0x309364){var _0x189a84={};_0x189a84[_0x309364]={'$like':'%'+_0x528246[_0xa56f('0x35')][_0xa56f('0x42')]+'%'};return _0x189a84;})});}_0x497fe6=_[_0xa56f('0x44')]({},_0x497fe6,_0x528246['options']);return _0x4a1541[_0xa56f('0x127')](_0x497fe6);}})[_0xa56f('0x27')](function(_0x298194){if(_0x298194){_0xb8dc83=_0x298194[_0xa56f('0x3a')];if(!_0x528246['query'][_0xa56f('0x3b')](_0xa56f('0x3c'))){_0x497fe6[_0xa56f('0x22')]=qs[_0xa56f('0x22')](_0x528246[_0xa56f('0x35')]['limit']);_0x497fe6[_0xa56f('0x1f')]=qs[_0xa56f('0x1f')](_0x528246[_0xa56f('0x35')][_0xa56f('0x1f')]);}return _0x4a1541[_0xa56f('0x127')](_0x497fe6);}})['then'](function(_0x2f3340){if(_0x2f3340){return _0x2f3340?{'count':_0xb8dc83,'rows':_0x2f3340}:null;}})['then'](respondWithResult(_0x172281,null))['catch'](handleError(_0x172281,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 93d789f..2e560c6 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 _0x5a01=['../../mysqldb','ChatWebsite','update','remove','hasOwnProperty','hook','exports','events'];(function(_0x54d13c,_0x1e97c1){var _0xe751dc=function(_0x259406){while(--_0x259406){_0x54d13c['push'](_0x54d13c['shift']());}};_0xe751dc(++_0x1e97c1);}(_0x5a01,0x1af));var _0x15a0=function(_0x28c4db,_0x2ccd05){_0x28c4db=_0x28c4db-0x0;var _0x5907ed=_0x5a01[_0x28c4db];return _0x5907ed;};'use strict';var EventEmitter=require(_0x15a0('0x0'));var ChatWebsite=require(_0x15a0('0x1'))['db'][_0x15a0('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x15a0('0x3'),'afterDestroy':_0x15a0('0x4')};function emitEvent(_0x4c7c75){return function(_0x1c83a1,_0x12ae6b,_0x1751ed){ChatWebsiteEvents['emit'](_0x4c7c75+':'+_0x1c83a1['id'],_0x1c83a1);ChatWebsiteEvents['emit'](_0x4c7c75,_0x1c83a1);_0x1751ed(null);};}for(var e in events){if(events[_0x15a0('0x5')](e)){var event=events[e];ChatWebsite[_0x15a0('0x6')](e,emitEvent(event));}}module[_0x15a0('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0xe35c=['hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','emit'];(function(_0x3667eb,_0x1bd874){var _0x44cf07=function(_0x260898){while(--_0x260898){_0x3667eb['push'](_0x3667eb['shift']());}};_0x44cf07(++_0x1bd874);}(_0xe35c,0x146));var _0xce35=function(_0x284bde,_0x3a2ab2){_0x284bde=_0x284bde-0x0;var _0x455f4b=_0xe35c[_0x284bde];return _0x455f4b;};'use strict';var EventEmitter=require(_0xce35('0x0'));var ChatWebsite=require(_0xce35('0x1'))['db'][_0xce35('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xce35('0x3')](0x0);var events={'afterCreate':_0xce35('0x4'),'afterUpdate':_0xce35('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5b2135){return function(_0x17648a,_0x4a005b,_0x3e370f){ChatWebsiteEvents[_0xce35('0x6')](_0x5b2135+':'+_0x17648a['id'],_0x17648a);ChatWebsiteEvents[_0xce35('0x6')](_0x5b2135,_0x17648a);_0x3e370f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xce35('0x7')](e,emitEvent(event));}}module[_0xce35('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 098fb0b..27fa8e0 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 _0x96e9=['rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x35fb7a,_0x8cc39b){var _0x1f79ef=function(_0x48addd){while(--_0x48addd){_0x35fb7a['push'](_0x35fb7a['shift']());}};_0x1f79ef(++_0x8cc39b);}(_0x96e9,0x18f));var _0x996e=function(_0x62261e,_0x15d072){_0x62261e=_0x62261e-0x0;var _0x592ba4=_0x96e9[_0x62261e];return _0x592ba4;};'use strict';var _=require(_0x996e('0x0'));var util=require('util');var logger=require(_0x996e('0x1'))(_0x996e('0x2'));var moment=require(_0x996e('0x3'));var BPromise=require(_0x996e('0x4'));var rp=require(_0x996e('0x5'));var fs=require('fs');var path=require(_0x996e('0x6'));var rimraf=require(_0x996e('0x7'));var config=require(_0x996e('0x8'));var attributes=require(_0x996e('0x9'));module[_0x996e('0xa')]=function(_0x678991,_0xaf0566){return _0x678991[_0x996e('0xb')](_0x996e('0xc'),attributes,{'tableName':_0x996e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58f4=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./chatWebsite.attributes','exports','define','ChatWebsite'];(function(_0x41ffa9,_0x3297fd){var _0x2b54f1=function(_0x54a92d){while(--_0x54a92d){_0x41ffa9['push'](_0x41ffa9['shift']());}};_0x2b54f1(++_0x3297fd);}(_0x58f4,0xc6));var _0x458f=function(_0x455d24,_0x5d6798){_0x455d24=_0x455d24-0x0;var _0x329c60=_0x58f4[_0x455d24];return _0x329c60;};'use strict';var _=require('lodash');var util=require(_0x458f('0x0'));var logger=require(_0x458f('0x1'))(_0x458f('0x2'));var moment=require('moment');var BPromise=require(_0x458f('0x3'));var rp=require(_0x458f('0x4'));var fs=require('fs');var path=require(_0x458f('0x5'));var rimraf=require(_0x458f('0x6'));var config=require('../../config/environment');var attributes=require(_0x458f('0x7'));module[_0x458f('0x8')]=function(_0x29a575,_0x4dfc4d){return _0x29a575[_0x458f('0x9')](_0x458f('0xa'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index fdb6fce..3904ff0 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 _0xe893=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','moment','bluebird','randomstring'];(function(_0x2888ab,_0x4f8bd1){var _0x311ee5=function(_0x539e1e){while(--_0x539e1e){_0x2888ab['push'](_0x2888ab['shift']());}};_0x311ee5(++_0x4f8bd1);}(_0xe893,0x1df));var _0x3e89=function(_0x37357f,_0x3b23bb){_0x37357f=_0x37357f-0x0;var _0x505ef9=_0xe893[_0x37357f];return _0x505ef9;};'use strict';var _=require(_0x3e89('0x0'));var util=require('util');var moment=require(_0x3e89('0x1'));var BPromise=require(_0x3e89('0x2'));var rs=require(_0x3e89('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e89('0x4'))['db'];var utils=require(_0x3e89('0x5'));var logger=require(_0x3e89('0x6'))('rpc');var config=require(_0x3e89('0x7'));var jayson=require(_0x3e89('0x8'));var client=jayson[_0x3e89('0x9')][_0x3e89('0xa')]({'port':0x232a});config[_0x3e89('0xb')]=_['defaults'](config[_0x3e89('0xb')],{'host':_0x3e89('0xc'),'port':0x18eb});var socket=require(_0x3e89('0xd'))(new Redis(config[_0x3e89('0xb')]));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0x5c0389,_0x4fe2db,_0x308f8f){return new BPromise(function(_0x351507,_0xffc2b){return client['request'](_0x5c0389,_0x308f8f)['then'](function(_0x3334e4){logger['info'](_0x3e89('0xe'),_0x4fe2db,_0x3e89('0xf'));logger[_0x3e89('0x10')](_0x3e89('0x11'),_0x4fe2db,_0x3e89('0xf'),JSON[_0x3e89('0x12')](_0x3334e4));if(_0x3334e4[_0x3e89('0x13')]){if(_0x3334e4['error']['code']===0x1f4){logger[_0x3e89('0x13')](_0x3e89('0xe'),_0x4fe2db,_0x3334e4[_0x3e89('0x13')]['message']);return _0xffc2b(_0x3334e4[_0x3e89('0x13')][_0x3e89('0x14')]);}logger[_0x3e89('0x13')](_0x3e89('0xe'),_0x4fe2db,_0x3334e4[_0x3e89('0x13')][_0x3e89('0x14')]);return _0x351507(_0x3334e4[_0x3e89('0x13')][_0x3e89('0x14')]);}else{logger[_0x3e89('0x15')](_0x3e89('0xe'),_0x4fe2db,_0x3e89('0xf'));_0x351507(_0x3334e4['result']['message']);}})[_0x3e89('0x16')](function(_0x431032){logger[_0x3e89('0x13')](_0x3e89('0xe'),_0x4fe2db,_0x431032);_0xffc2b(_0x431032);});});} \ No newline at end of file +var _0xf310=['code','message','request\x20sent','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','ChatWebsite,\x20%s,\x20%s','debug','stringify','error'];(function(_0x4ab6a1,_0x4d64d5){var _0x2a24cc=function(_0x2625a0){while(--_0x2625a0){_0x4ab6a1['push'](_0x4ab6a1['shift']());}};_0x2a24cc(++_0x4d64d5);}(_0xf310,0x1ae));var _0x0f31=function(_0x2ef041,_0x34e819){_0x2ef041=_0x2ef041-0x0;var _0x4babf1=_0xf310[_0x2ef041];return _0x4babf1;};'use strict';var _=require('lodash');var util=require(_0x0f31('0x0'));var moment=require(_0x0f31('0x1'));var BPromise=require(_0x0f31('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f31('0x3'));var db=require(_0x0f31('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f31('0x5'))('rpc');var config=require(_0x0f31('0x6'));var jayson=require(_0x0f31('0x7'));var client=jayson['client'][_0x0f31('0x8')]({'port':0x232a});config['redis']=_[_0x0f31('0x9')](config[_0x0f31('0xa')],{'host':_0x0f31('0xb'),'port':0x18eb});var socket=require(_0x0f31('0xc'))(new Redis(config[_0x0f31('0xa')]));require(_0x0f31('0xd'))[_0x0f31('0xe')](socket);function respondWithRpcPromise(_0x5b85bd,_0x21158f,_0x46f536){return new BPromise(function(_0x5a1801,_0x1bf217){return client[_0x0f31('0xf')](_0x5b85bd,_0x46f536)['then'](function(_0x3c8cd2){logger['info'](_0x0f31('0x10'),_0x21158f,'request\x20sent');logger[_0x0f31('0x11')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x21158f,'request\x20sent',JSON[_0x0f31('0x12')](_0x3c8cd2));if(_0x3c8cd2[_0x0f31('0x13')]){if(_0x3c8cd2[_0x0f31('0x13')][_0x0f31('0x14')]===0x1f4){logger['error'](_0x0f31('0x10'),_0x21158f,_0x3c8cd2[_0x0f31('0x13')]['message']);return _0x1bf217(_0x3c8cd2[_0x0f31('0x13')][_0x0f31('0x15')]);}logger[_0x0f31('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x21158f,_0x3c8cd2[_0x0f31('0x13')][_0x0f31('0x15')]);return _0x5a1801(_0x3c8cd2[_0x0f31('0x13')][_0x0f31('0x15')]);}else{logger['info'](_0x0f31('0x10'),_0x21158f,_0x0f31('0x16'));_0x5a1801(_0x3c8cd2[_0x0f31('0x17')][_0x0f31('0x15')]);}})[_0x0f31('0x18')](function(_0x1467ae){logger['error'](_0x0f31('0x10'),_0x21158f,_0x1467ae);_0x1bf217(_0x1467ae);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index c53ad66..88a6e5c 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 _0xa851=['update','emit','removeListener','register','length','./chatWebsite.events','save','remove'];(function(_0x351134,_0x392b05){var _0x5a5278=function(_0x5a4a7f){while(--_0x5a4a7f){_0x351134['push'](_0x351134['shift']());}};_0x5a5278(++_0x392b05);}(_0xa851,0x1dd));var _0x1a85=function(_0x38b255,_0x3fd343){_0x38b255=_0x38b255-0x0;var _0x26f9bb=_0xa851[_0x38b255];return _0x26f9bb;};'use strict';var ChatWebsiteEvents=require(_0x1a85('0x0'));var events=[_0x1a85('0x1'),_0x1a85('0x2'),_0x1a85('0x3')];function createListener(_0x28785e,_0x108c97){return function(_0x4b5660){_0x108c97[_0x1a85('0x4')](_0x28785e,_0x4b5660);};}function removeListener(_0x58180d,_0x3cc4cc){return function(){ChatWebsiteEvents[_0x1a85('0x5')](_0x58180d,_0x3cc4cc);};}exports[_0x1a85('0x6')]=function(_0x104320){for(var _0x394838=0x0,_0x143095=events[_0x1a85('0x7')];_0x394838<_0x143095;_0x394838++){var _0x3dc4be=events[_0x394838];var _0x42bdec=createListener('chatWebsite:'+_0x3dc4be,_0x104320);ChatWebsiteEvents['on'](_0x3dc4be,_0x42bdec);}}; \ No newline at end of file +var _0xf154=['emit','removeListener','register','length','save','remove','update'];(function(_0x90c434,_0x42072a){var _0x10e99a=function(_0x5f39ca){while(--_0x5f39ca){_0x90c434['push'](_0x90c434['shift']());}};_0x10e99a(++_0x42072a);}(_0xf154,0x74));var _0x4f15=function(_0x4b71b4,_0x26595a){_0x4b71b4=_0x4b71b4-0x0;var _0xb99700=_0xf154[_0x4b71b4];return _0xb99700;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x4f15('0x0'),_0x4f15('0x1'),_0x4f15('0x2')];function createListener(_0x1bbf19,_0x5d74ba){return function(_0xdf5aca){_0x5d74ba[_0x4f15('0x3')](_0x1bbf19,_0xdf5aca);};}function removeListener(_0x1092c7,_0x5d2e73){return function(){ChatWebsiteEvents[_0x4f15('0x4')](_0x1092c7,_0x5d2e73);};}exports[_0x4f15('0x5')]=function(_0x34d983){for(var _0x15bc9e=0x0,_0x500f86=events[_0x4f15('0x6')];_0x15bc9e<_0x500f86;_0x15bc9e++){var _0x222a1e=events[_0x15bc9e];var _0x116110=createListener('chatWebsite:'+_0x222a1e,_0x34d983);ChatWebsiteEvents['on'](_0x222a1e,_0x116110);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 211fc26..b0ad423 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 _0x5b5b=['fs-extra','../../components/interaction/service','./chatWebsite.controller','isAuthenticated','index','describe','get','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getLogo','getAvatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','format','%s-%s','now','/:id/logo','single','addLogo','originalname','file','addAvatar','server/files/images/avatars/','/:id/customer_avatar','addCustomerAvatar','/:id/notify','notify','attachments','ensureDir','replace','extname','offline','addInteraction','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5b5b,0xca));var _0xb5b5=function(_0x2b737c,_0x274adf){_0x2b737c=_0x2b737c-0x0;var _0x466ed5=_0x5b5b[_0x2b737c];return _0x466ed5;};'use strict';var multer=require('multer');var util=require(_0xb5b5('0x0'));var path=require(_0xb5b5('0x1'));var timeout=require(_0xb5b5('0x2'));var express=require(_0xb5b5('0x3'));var router=express[_0xb5b5('0x4')]();var fs_extra=require(_0xb5b5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb5b5('0x6'));var config=require('../../config/environment');var controller=require(_0xb5b5('0x7'));router['get']('/',auth[_0xb5b5('0x8')](),controller[_0xb5b5('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xb5b5('0xa')]);router[_0xb5b5('0xb')](_0xb5b5('0xc'),auth[_0xb5b5('0x8')](),controller[_0xb5b5('0xd')]);router[_0xb5b5('0xb')](_0xb5b5('0xe'),auth[_0xb5b5('0x8')](),controller['getDispositions']);router[_0xb5b5('0xb')](_0xb5b5('0xf'),auth[_0xb5b5('0x8')](),controller[_0xb5b5('0x10')]);router[_0xb5b5('0xb')]('/:id/logo',controller[_0xb5b5('0x11')]);router[_0xb5b5('0xb')]('/:id/avatar',controller[_0xb5b5('0x12')]);router[_0xb5b5('0xb')]('/:id/customer_avatar',controller[_0xb5b5('0x13')]);router[_0xb5b5('0xb')](_0xb5b5('0x14'),controller['getSystemAvatar']);router[_0xb5b5('0xb')](_0xb5b5('0x15'),auth[_0xb5b5('0x8')](),controller[_0xb5b5('0x16')]);router[_0xb5b5('0xb')](_0xb5b5('0x17'),controller[_0xb5b5('0x18')]);router[_0xb5b5('0xb')](_0xb5b5('0x19'),auth[_0xb5b5('0x8')](),controller[_0xb5b5('0x1a')]);router[_0xb5b5('0xb')](_0xb5b5('0x1b'),auth[_0xb5b5('0x8')](),controller['getProactiveActions']);router['get'](_0xb5b5('0x1c'),controller[_0xb5b5('0x1d')]);router[_0xb5b5('0xb')](_0xb5b5('0x1e'),auth[_0xb5b5('0x8')](),controller[_0xb5b5('0x1f')]);router['get'](_0xb5b5('0x20'),auth[_0xb5b5('0x8')](),controller[_0xb5b5('0x21')]);router[_0xb5b5('0x22')]('/',auth[_0xb5b5('0x8')](),controller[_0xb5b5('0x23')]);router[_0xb5b5('0x22')](_0xb5b5('0xe'),auth[_0xb5b5('0x8')](),controller[_0xb5b5('0x24')]);router[_0xb5b5('0x22')](_0xb5b5('0xf'),auth['isAuthenticated'](),controller[_0xb5b5('0x25')]);var upload=multer({'storage':multer[_0xb5b5('0x26')]({'destination':function(_0xfa67d4,_0xe9d2c,_0x44742b){_0x44742b(null,path[_0xb5b5('0x27')](config[_0xb5b5('0x28')],'server/files/images/logos/'));},'filename':function(_0x5848e4,_0x17c096,_0x20d63c){_0x20d63c(null,util[_0xb5b5('0x29')](_0xb5b5('0x2a'),Date[_0xb5b5('0x2b')](),_0x17c096['originalname']));}})});router[_0xb5b5('0x22')](_0xb5b5('0x2c'),upload[_0xb5b5('0x2d')]('file'),controller[_0xb5b5('0x2e')]);var upload=multer({'storage':multer[_0xb5b5('0x26')]({'destination':function(_0xdeeb9b,_0x36e8be,_0x5ece4d){_0x5ece4d(null,path[_0xb5b5('0x27')](config[_0xb5b5('0x28')],'server/files/images/avatars/'));},'filename':function(_0x623cce,_0x234817,_0x48cf38){_0x48cf38(null,util[_0xb5b5('0x29')](_0xb5b5('0x2a'),Date[_0xb5b5('0x2b')](),_0x234817[_0xb5b5('0x2f')]));}})});router['post']('/:id/avatar',upload[_0xb5b5('0x2d')](_0xb5b5('0x30')),controller[_0xb5b5('0x31')]);var upload=multer({'storage':multer[_0xb5b5('0x26')]({'destination':function(_0x5f0480,_0x506fe5,_0x555aae){_0x555aae(null,path['join'](config[_0xb5b5('0x28')],_0xb5b5('0x32')));},'filename':function(_0x4dff34,_0x54b786,_0x47d0e4){_0x47d0e4(null,util[_0xb5b5('0x29')](_0xb5b5('0x2a'),Date['now'](),_0x54b786[_0xb5b5('0x2f')]));}})});router['post'](_0xb5b5('0x33'),upload[_0xb5b5('0x2d')](_0xb5b5('0x30')),controller[_0xb5b5('0x34')]);var upload=multer({'storage':multer[_0xb5b5('0x26')]({'destination':function(_0x4e6ae7,_0x39979a,_0x5b48b5){_0x5b48b5(null,path[_0xb5b5('0x27')](config[_0xb5b5('0x28')],'server/files/images/avatars/'));},'filename':function(_0x9c5eeb,_0x3a4ab8,_0x21d8b9){_0x21d8b9(null,util[_0xb5b5('0x29')]('%s-%s',Date['now'](),_0x3a4ab8[_0xb5b5('0x2f')]));}})});router[_0xb5b5('0x22')]('/:id/system_avatar',upload['single'](_0xb5b5('0x30')),controller['addSystemAvatar']);router[_0xb5b5('0x22')](_0xb5b5('0x35'),controller[_0xb5b5('0x36')]);const offlineUploadMulter=multer({'storage':multer[_0xb5b5('0x26')]({'destination':function(_0x3209e6,_0x4c8cbe,_0x3a976f){const _0x2bb3ce=path[_0xb5b5('0x27')](config[_0xb5b5('0x28')],'server/files',_0xb5b5('0x37'),'offline-chat');fs_extra[_0xb5b5('0x38')](_0x2bb3ce,function(){_0x3a976f(null,_0x2bb3ce);});},'filename':function(_0x5d3639,_0x1773f5,_0x43c555){const _0x57cd1a=_0x1773f5[_0xb5b5('0x2f')][_0xb5b5('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x35d3ca=path[_0xb5b5('0x3a')](_0x57cd1a);const _0x468715=Date['now']()+'-'+_0x57cd1a[_0xb5b5('0x39')](_0x35d3ca,'')+_0x35d3ca;_0x43c555(null,_0x468715);}})});router[_0xb5b5('0x22')]('/:id/offline',offlineUploadMulter['any'](),controller[_0xb5b5('0x3b')]);router[_0xb5b5('0x22')]('/:id/interactions',auth[_0xb5b5('0x8')](),controller[_0xb5b5('0x3c')]);router['post'](_0xb5b5('0x19'),auth[_0xb5b5('0x8')](),controller['addApplications']);router[_0xb5b5('0x22')](_0xb5b5('0x1b'),auth[_0xb5b5('0x8')](),controller['addProactiveActions']);router[_0xb5b5('0x22')]('/:id/users',auth[_0xb5b5('0x8')](),controller[_0xb5b5('0x3d')]);router['put'](_0xb5b5('0xc'),auth['isAuthenticated'](),controller[_0xb5b5('0x3e')]);router[_0xb5b5('0x3f')](_0xb5b5('0xc'),auth[_0xb5b5('0x8')](),controller[_0xb5b5('0x40')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xb5b5('0x41')]);router[_0xb5b5('0x3f')](_0xb5b5('0xf'),auth[_0xb5b5('0x8')](),controller[_0xb5b5('0x42')]);router[_0xb5b5('0x3f')](_0xb5b5('0x20'),auth['isAuthenticated'](),controller[_0xb5b5('0x43')]);module[_0xb5b5('0x44')]=router; \ No newline at end of file +var _0xfc7a=['server/files','attachments','replace','extname','/:id/offline','any','offline','/:id/interactions','/:id/applications','/:id/proactive_actions','addProactiveActions','put','/:id','update','delete','destroy','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatWebsite.controller','index','get','/describe','isAuthenticated','getDispositions','/:id/canned_answers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getApplications','/:id/fields','getFields','/:id/users','getAgents','post','create','addDisposition','diskStorage','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','single','file','addLogo','join','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','notify'];(function(_0x45b3c1,_0x2d161b){var _0x6d0616=function(_0x4980ee){while(--_0x4980ee){_0x45b3c1['push'](_0x45b3c1['shift']());}};_0x6d0616(++_0x2d161b);}(_0xfc7a,0x12d));var _0xafc7=function(_0xce3a0b,_0x5b271b){_0xce3a0b=_0xce3a0b-0x0;var _0x1ca1b9=_0xfc7a[_0xce3a0b];return _0x1ca1b9;};'use strict';var multer=require(_0xafc7('0x0'));var util=require(_0xafc7('0x1'));var path=require(_0xafc7('0x2'));var timeout=require(_0xafc7('0x3'));var express=require(_0xafc7('0x4'));var router=express[_0xafc7('0x5')]();var fs_extra=require(_0xafc7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xafc7('0x7'));var config=require('../../config/environment');var controller=require(_0xafc7('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xafc7('0x9')]);router[_0xafc7('0xa')](_0xafc7('0xb'),auth[_0xafc7('0xc')](),controller['describe']);router[_0xafc7('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xafc7('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xafc7('0xd')]);router['get'](_0xafc7('0xe'),auth[_0xafc7('0xc')](),controller['getAnswers']);router[_0xafc7('0xa')]('/:id/logo',controller[_0xafc7('0xf')]);router[_0xafc7('0xa')](_0xafc7('0x10'),controller[_0xafc7('0x11')]);router[_0xafc7('0xa')](_0xafc7('0x12'),controller[_0xafc7('0x13')]);router[_0xafc7('0xa')](_0xafc7('0x14'),controller[_0xafc7('0x15')]);router['get']('/:id/interactions',auth[_0xafc7('0xc')](),controller[_0xafc7('0x16')]);router[_0xafc7('0xa')](_0xafc7('0x17'),controller['getSnippet']);router[_0xafc7('0xa')]('/:id/applications',auth[_0xafc7('0xc')](),controller[_0xafc7('0x18')]);router[_0xafc7('0xa')]('/:id/proactive_actions',auth['isAuthenticated'](),controller['getProactiveActions']);router[_0xafc7('0xa')](_0xafc7('0x19'),controller[_0xafc7('0x1a')]);router[_0xafc7('0xa')]('/:id/offline_messages',auth[_0xafc7('0xc')](),controller['getOfflineMessages']);router['get'](_0xafc7('0x1b'),auth[_0xafc7('0xc')](),controller[_0xafc7('0x1c')]);router[_0xafc7('0x1d')]('/',auth[_0xafc7('0xc')](),controller[_0xafc7('0x1e')]);router[_0xafc7('0x1d')]('/:id/dispositions',auth[_0xafc7('0xc')](),controller[_0xafc7('0x1f')]);router[_0xafc7('0x1d')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);var upload=multer({'storage':multer[_0xafc7('0x20')]({'destination':function(_0x5484ea,_0x5aab5c,_0x3d0522){_0x3d0522(null,path['join'](config[_0xafc7('0x21')],_0xafc7('0x22')));},'filename':function(_0x331908,_0xa562de,_0xca6a85){_0xca6a85(null,util[_0xafc7('0x23')](_0xafc7('0x24'),Date[_0xafc7('0x25')](),_0xa562de[_0xafc7('0x26')]));}})});router[_0xafc7('0x1d')](_0xafc7('0x27'),upload[_0xafc7('0x28')](_0xafc7('0x29')),controller[_0xafc7('0x2a')]);var upload=multer({'storage':multer[_0xafc7('0x20')]({'destination':function(_0x291b3f,_0x566d33,_0xcb5f5a){_0xcb5f5a(null,path[_0xafc7('0x2b')](config['root'],_0xafc7('0x2c')));},'filename':function(_0x45fecc,_0x2dad3e,_0x1e0d28){_0x1e0d28(null,util[_0xafc7('0x23')]('%s-%s',Date['now'](),_0x2dad3e[_0xafc7('0x26')]));}})});router['post'](_0xafc7('0x10'),upload[_0xafc7('0x28')](_0xafc7('0x29')),controller['addAvatar']);var upload=multer({'storage':multer[_0xafc7('0x20')]({'destination':function(_0x2e96ba,_0x5a36a5,_0x2ce66b){_0x2ce66b(null,path[_0xafc7('0x2b')](config[_0xafc7('0x21')],_0xafc7('0x2c')));},'filename':function(_0x5b4ecd,_0x4a7021,_0x682883){_0x682883(null,util[_0xafc7('0x23')](_0xafc7('0x24'),Date[_0xafc7('0x25')](),_0x4a7021[_0xafc7('0x26')]));}})});router['post'](_0xafc7('0x12'),upload[_0xafc7('0x28')](_0xafc7('0x29')),controller[_0xafc7('0x2d')]);var upload=multer({'storage':multer[_0xafc7('0x20')]({'destination':function(_0x8d40bf,_0x2994bd,_0x51b40e){_0x51b40e(null,path[_0xafc7('0x2b')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x2a2cea,_0x2b8ee1,_0x2c76fe){_0x2c76fe(null,util[_0xafc7('0x23')](_0xafc7('0x24'),Date[_0xafc7('0x25')](),_0x2b8ee1[_0xafc7('0x26')]));}})});router[_0xafc7('0x1d')](_0xafc7('0x14'),upload['single'](_0xafc7('0x29')),controller[_0xafc7('0x2e')]);router[_0xafc7('0x1d')](_0xafc7('0x2f'),controller[_0xafc7('0x30')]);const offlineUploadMulter=multer({'storage':multer[_0xafc7('0x20')]({'destination':function(_0xc96477,_0x409a7b,_0x3450ba){const _0x2b2289=path['join'](config[_0xafc7('0x21')],_0xafc7('0x31'),_0xafc7('0x32'),'offline-chat');fs_extra['ensureDir'](_0x2b2289,function(){_0x3450ba(null,_0x2b2289);});},'filename':function(_0x5b35eb,_0x2c2b86,_0xcde905){const _0x1c4179=_0x2c2b86[_0xafc7('0x26')][_0xafc7('0x33')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x85ef7=path[_0xafc7('0x34')](_0x1c4179);const _0x21a891=Date[_0xafc7('0x25')]()+'-'+_0x1c4179['replace'](_0x85ef7,'')+_0x85ef7;_0xcde905(null,_0x21a891);}})});router[_0xafc7('0x1d')](_0xafc7('0x35'),offlineUploadMulter[_0xafc7('0x36')](),controller[_0xafc7('0x37')]);router[_0xafc7('0x1d')](_0xafc7('0x38'),auth[_0xafc7('0xc')](),controller['addInteraction']);router[_0xafc7('0x1d')](_0xafc7('0x39'),auth[_0xafc7('0xc')](),controller['addApplications']);router[_0xafc7('0x1d')](_0xafc7('0x3a'),auth[_0xafc7('0xc')](),controller[_0xafc7('0x3b')]);router[_0xafc7('0x1d')](_0xafc7('0x1b'),auth[_0xafc7('0xc')](),controller['addAgents']);router[_0xafc7('0x3c')](_0xafc7('0x3d'),auth[_0xafc7('0xc')](),controller[_0xafc7('0x3e')]);router[_0xafc7('0x3f')]('/:id',auth['isAuthenticated'](),controller[_0xafc7('0x40')]);router['delete'](_0xafc7('0x41'),auth[_0xafc7('0xc')](),controller[_0xafc7('0x42')]);router[_0xafc7('0x3f')](_0xafc7('0xe'),auth[_0xafc7('0xc')](),controller[_0xafc7('0x43')]);router[_0xafc7('0x3f')](_0xafc7('0x1b'),auth['isAuthenticated'](),controller[_0xafc7('0x44')]);module[_0xafc7('0x45')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 90bf80a..c3ea2c1 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 _0x3292=['client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','express','../components/auth/service','../config/environment','Router','app','get'];(function(_0x2caf19,_0x11098d){var _0x3e0fe9=function(_0x47d112){while(--_0x47d112){_0x2caf19['push'](_0x2caf19['shift']());}};_0x3e0fe9(++_0x11098d);}(_0x3292,0xfe));var _0x2329=function(_0x1928ff,_0x4eefd9){_0x1928ff=_0x1928ff-0x0;var _0x1e921f=_0x3292[_0x1928ff];return _0x1e921f;};var beaverLogger=require('beaver-logger/server');var express=require(_0x2329('0x0'));var auth=require(_0x2329('0x1'));var config=require(_0x2329('0x2'));var router=express[_0x2329('0x3')]();var isProduction=config['env']==='production'||![];function clientSideLogs(_0x808b27,_0x11411e,_0x297e21){var _0x4b01bf=_0x808b27[_0x2329('0x4')][_0x2329('0x5')](_0x2329('0x6'));if(!_0x4b01bf){throw new Error(_0x2329('0x7'));}return beaverLogger[_0x2329('0x8')]({'uri':_0x2329('0x9'),'logger':_0x4b01bf,'enableCors':!isProduction})(_0x808b27,_0x11411e,_0x297e21);}router[_0x2329('0xa')](auth[_0x2329('0xb')](),clientSideLogs);module[_0x2329('0xc')]=router; \ No newline at end of file +var _0x3003=['get','/client-logs','isAuthenticated','exports','beaver-logger/server','express','../config/environment','env','production','app'];(function(_0x38deb6,_0x587445){var _0x3cf12e=function(_0x4d178b){while(--_0x4d178b){_0x38deb6['push'](_0x38deb6['shift']());}};_0x3cf12e(++_0x587445);}(_0x3003,0x18a));var _0x3300=function(_0x2f6e0d,_0x19687d){_0x2f6e0d=_0x2f6e0d-0x0;var _0x4c0d36=_0x3003[_0x2f6e0d];return _0x4c0d36;};var beaverLogger=require(_0x3300('0x0'));var express=require(_0x3300('0x1'));var auth=require('../components/auth/service');var config=require(_0x3300('0x2'));var router=express['Router']();var isProduction=config[_0x3300('0x3')]===_0x3300('0x4')||![];function clientSideLogs(_0xb004e6,_0x424af5,_0x2a2e91){var _0x23f146=_0xb004e6[_0x3300('0x5')][_0x3300('0x6')]('client-side-logger');if(!_0x23f146){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger['expressEndpoint']({'uri':_0x3300('0x7'),'logger':_0x23f146,'enableCors':!isProduction})(_0xb004e6,_0x424af5,_0x2a2e91);}router['use'](auth[_0x3300('0x8')](),clientSideLogs);module[_0x3300('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 a58f97a..29fa9a1 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 _0xbb13=['MicrosoftAzure','ENUM','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING'];(function(_0x40d80f,_0x1dd7ff){var _0x5478be=function(_0x4b4540){while(--_0x4b4540){_0x40d80f['push'](_0x40d80f['shift']());}};_0x5478be(++_0x1dd7ff);}(_0xbb13,0xf9));var _0x3bb1=function(_0x4b627f,_0x139bd4){_0x4b627f=_0x4b627f-0x0;var _0x2951c2=_0xbb13[_0x4b627f];return _0x2951c2;};'use strict';var Sequelize=require(_0x3bb1('0x0'));module[_0x3bb1('0x1')]={'name':{'type':Sequelize[_0x3bb1('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS','Google',_0x3bb1('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x3bb1('0x4')](_0x3bb1('0x5'),_0x3bb1('0x6'))},'data1':{'type':Sequelize[_0x3bb1('0x2')],'comment':_0x3bb1('0x7')},'data2':{'type':Sequelize[_0x3bb1('0x2')],'comment':_0x3bb1('0x8')},'data3':{'type':Sequelize[_0x3bb1('0x2')],'comment':_0x3bb1('0x9')},'data4':{'type':Sequelize[_0x3bb1('0x2')],'comment':_0x3bb1('0xa')},'data5':{'type':Sequelize['TEXT'],'comment':_0x3bb1('0xb')},'data6':{'type':Sequelize[_0x3bb1('0xc')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x3bb1('0xc')],'comment':_0x3bb1('0xd')}}; \ No newline at end of file +var _0xbd39=['MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','STRING','MicrosoftAzure\x20=>\x20client_id'];(function(_0x25b9c5,_0x31a38e){var _0x1a50d5=function(_0x33aaac){while(--_0x33aaac){_0x25b9c5['push'](_0x25b9c5['shift']());}};_0x1a50d5(++_0x31a38e);}(_0xbd39,0x102));var _0x9bd3=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xbd39[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require('sequelize');module[_0x9bd3('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x9bd3('0x1')](_0x9bd3('0x2'),_0x9bd3('0x3'),_0x9bd3('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x9bd3('0x5'),'Dynamics365')},'data1':{'type':Sequelize[_0x9bd3('0x6')],'comment':_0x9bd3('0x7')},'data2':{'type':Sequelize[_0x9bd3('0x6')],'comment':_0x9bd3('0x8')},'data3':{'type':Sequelize[_0x9bd3('0x6')],'comment':_0x9bd3('0x9')},'data4':{'type':Sequelize[_0x9bd3('0x6')],'comment':_0x9bd3('0xa')},'data5':{'type':Sequelize[_0x9bd3('0xb')],'comment':_0x9bd3('0xc')},'data6':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x9bd3('0xb')],'comment':_0x9bd3('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 399b11d..8e157a2 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 _0xf2fc=['set','Content-Range','then','destroy','error','send','padEnd','index','CloudProvider','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','merge','filter','options','include','decryptString','data3','catch','show','find','service','MicrosoftAzure','create','body','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','update','params','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','toString','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','startRefreshInterval','microsoftAuthorization:success','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0xa144e7,_0x30ff6f){var _0x527237=function(_0x3c8e86){while(--_0x3c8e86){_0xa144e7['push'](_0xa144e7['shift']());}};_0x527237(++_0x30ff6f);}(_0xf2fc,0x1bd));var _0xcf2f=function(_0x5c18ba,_0x12f408){_0x5c18ba=_0x5c18ba-0x0;var _0x54422d=_0xf2fc[_0x5c18ba];return _0x54422d;};'use strict';var _=require(_0xcf2f('0x0'));var Redis=require(_0xcf2f('0x1'));var qs=require(_0xcf2f('0x2'));var encryptor=require(_0xcf2f('0x3'));var config=require(_0xcf2f('0x4'));var logger=require(_0xcf2f('0x5'))(_0xcf2f('0x6'));var db=require('../../mysqldb')['db'];var oauth=require(_0xcf2f('0x7'));config[_0xcf2f('0x8')]=_[_0xcf2f('0x9')](config[_0xcf2f('0x8')],{'host':_0xcf2f('0xa'),'port':0x18eb});var socket=require(_0xcf2f('0xb'))(new Redis(config[_0xcf2f('0x8')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x130a61,_0x5a8776){_0x5a8776=_0x5a8776||0xcc;return function(_0x3aa782){if(_0x3aa782){return _0x130a61[_0xcf2f('0xc')](_0x5a8776);}return _0x130a61[_0xcf2f('0xd')](_0x5a8776)[_0xcf2f('0xe')]();};}function respondWithResult(_0x31310a,_0x47972e){_0x47972e=_0x47972e||0xc8;return function(_0x472655){if(_0x472655){return _0x31310a[_0xcf2f('0xd')](_0x47972e)[_0xcf2f('0xf')](_0x472655);}};}function respondWithFilteredResult(_0xb677f8,_0x52057a){return function(_0x4c073a){if(_0x4c073a){var _0x46e023=typeof _0x52057a[_0xcf2f('0x10')]===_0xcf2f('0x11')&&typeof _0x52057a[_0xcf2f('0x12')]===_0xcf2f('0x11');var _0x30b7fe=_0x4c073a[_0xcf2f('0x13')];var _0x48ee3e=_0x46e023?0x0:_0x52057a[_0xcf2f('0x10')];var _0x25de4e=_0x46e023?_0x4c073a[_0xcf2f('0x13')]:_0x52057a[_0xcf2f('0x10')]+_0x52057a[_0xcf2f('0x12')];var _0x51f73a;if(_0x25de4e>=_0x30b7fe){_0x25de4e=_0x30b7fe;_0x51f73a=0xc8;}else{_0x51f73a=0xce;}_0xb677f8[_0xcf2f('0xd')](_0x51f73a);return _0xb677f8[_0xcf2f('0x14')](_0xcf2f('0x15'),_0x48ee3e+'-'+_0x25de4e+'/'+_0x30b7fe)['json'](_0x4c073a);}return null;};}function saveUpdates(_0x15b28a){return function(_0x149fd0){if(_0x149fd0){return _0x149fd0['update'](_0x15b28a)[_0xcf2f('0x16')](function(_0x170515){return _0x170515;});}return null;};}function removeEntity(_0x246c5c){return function(_0x3a723d){if(_0x3a723d){return _0x3a723d[_0xcf2f('0x17')]()[_0xcf2f('0x16')](function(){_0x246c5c[_0xcf2f('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e1e38){return function(_0x37360d){if(!_0x37360d){_0x3e1e38[_0xcf2f('0xc')](0x194);}return _0x37360d;};}function handleError(_0x376795,_0x5e4a5a){_0x5e4a5a=_0x5e4a5a||0x1f4;return function(_0x5cc9d7){logger[_0xcf2f('0x18')](_0x5cc9d7['stack']);if(_0x5cc9d7['name']){delete _0x5cc9d7['name'];}_0x376795[_0xcf2f('0xd')](_0x5e4a5a)[_0xcf2f('0x19')](_0x5cc9d7);};}function maskClientSecret(_0x26aa5b){return _[_0xcf2f('0x1a')](_0x26aa5b['slice'](0x0,0x3),0x14,'*');}exports[_0xcf2f('0x1b')]=function(_0x10e200,_0x461710){var _0x32d9c7={},_0x481cdd={},_0x520aaa={'count':0x0,'rows':[]};var _0x44f01e=_['map'](db[_0xcf2f('0x1c')][_0xcf2f('0x1d')],function(_0x3539dc){return{'name':_0x3539dc[_0xcf2f('0x1e')],'type':_0x3539dc[_0xcf2f('0x1f')][_0xcf2f('0x20')]};});_0x481cdd[_0xcf2f('0x21')]=_[_0xcf2f('0x22')](_0x44f01e,_0xcf2f('0x23'));_0x481cdd[_0xcf2f('0x24')]=_[_0xcf2f('0x25')](_0x10e200[_0xcf2f('0x24')]);_0x481cdd[_0xcf2f('0x26')]=_['intersection'](_0x481cdd['model'],_0x481cdd[_0xcf2f('0x24')]);_0x32d9c7[_0xcf2f('0x27')]=_[_0xcf2f('0x28')](_0x481cdd[_0xcf2f('0x21')],qs[_0xcf2f('0x29')](_0x10e200['query'][_0xcf2f('0x29')]));_0x32d9c7['attributes']=_0x32d9c7[_0xcf2f('0x27')][_0xcf2f('0x2a')]?_0x32d9c7['attributes']:_0x481cdd['model'];if(!_0x10e200[_0xcf2f('0x24')][_0xcf2f('0x2b')]('nolimit')){_0x32d9c7[_0xcf2f('0x12')]=qs['limit'](_0x10e200[_0xcf2f('0x24')][_0xcf2f('0x12')]);_0x32d9c7[_0xcf2f('0x10')]=qs['offset'](_0x10e200[_0xcf2f('0x24')][_0xcf2f('0x10')]);}_0x32d9c7['order']=qs[_0xcf2f('0x2c')](_0x10e200[_0xcf2f('0x24')][_0xcf2f('0x2c')]);_0x32d9c7[_0xcf2f('0x2d')]=qs['filters'](_[_0xcf2f('0x2e')](_0x10e200[_0xcf2f('0x24')],_0x481cdd[_0xcf2f('0x26')]),_0x44f01e);if(_0x10e200['query']['filter']){_0x32d9c7[_0xcf2f('0x2d')]=_[_0xcf2f('0x2f')](_0x32d9c7[_0xcf2f('0x2d')],{'$or':_[_0xcf2f('0x22')](_0x44f01e,function(_0x1c9b8e){if(_0x1c9b8e[_0xcf2f('0x1f')]!=='VIRTUAL'){var _0x763df2={};_0x763df2[_0x1c9b8e['name']]={'$like':'%'+_0x10e200[_0xcf2f('0x24')][_0xcf2f('0x30')]+'%'};return _0x763df2;}})});}_0x32d9c7=_['merge']({},_0x32d9c7,_0x10e200[_0xcf2f('0x31')]);var _0xf52643={'where':_0x32d9c7[_0xcf2f('0x2d')]};return db['CloudProvider'][_0xcf2f('0x13')](_0xf52643)[_0xcf2f('0x16')](function(_0x489555){_0x520aaa[_0xcf2f('0x13')]=_0x489555;if(_0x10e200[_0xcf2f('0x24')]['includeAll']){_0x32d9c7[_0xcf2f('0x32')]=[{'all':!![]}];}return db[_0xcf2f('0x1c')]['findAll'](_0x32d9c7);})[_0xcf2f('0x16')](function(_0x4b49df){_0x520aaa['rows']=_['map'](_0x4b49df,function(_0x2cfc85){if(_0x2cfc85['service']==='MicrosoftAzure'){var _0x1b1d24=encryptor[_0xcf2f('0x33')](_0x2cfc85[_0xcf2f('0x34')]);_0x2cfc85[_0xcf2f('0x34')]=maskClientSecret(_0x1b1d24);}return _0x2cfc85;});return _0x520aaa;})[_0xcf2f('0x16')](respondWithFilteredResult(_0x461710,_0x32d9c7))[_0xcf2f('0x35')](handleError(_0x461710,null));};exports[_0xcf2f('0x36')]=function(_0x1f2d6a,_0x5276a3){var _0x5b0f2e={'raw':!![],'where':{'id':_0x1f2d6a['params']['id']}},_0x3d15b8={};_0x3d15b8[_0xcf2f('0x21')]=_['keys'](db[_0xcf2f('0x1c')][_0xcf2f('0x1d')]);_0x3d15b8[_0xcf2f('0x24')]=_[_0xcf2f('0x25')](_0x1f2d6a[_0xcf2f('0x24')]);_0x3d15b8[_0xcf2f('0x26')]=_[_0xcf2f('0x28')](_0x3d15b8[_0xcf2f('0x21')],_0x3d15b8[_0xcf2f('0x24')]);_0x5b0f2e[_0xcf2f('0x27')]=_[_0xcf2f('0x28')](_0x3d15b8[_0xcf2f('0x21')],qs[_0xcf2f('0x29')](_0x1f2d6a['query'][_0xcf2f('0x29')]));_0x5b0f2e[_0xcf2f('0x27')]=_0x5b0f2e['attributes'][_0xcf2f('0x2a')]?_0x5b0f2e[_0xcf2f('0x27')]:_0x3d15b8[_0xcf2f('0x21')];if(_0x1f2d6a['query']['includeAll']){_0x5b0f2e['include']=[{'all':!![]}];}_0x5b0f2e=_[_0xcf2f('0x2f')]({},_0x5b0f2e,_0x1f2d6a[_0xcf2f('0x31')]);return db[_0xcf2f('0x1c')][_0xcf2f('0x37')](_0x5b0f2e)[_0xcf2f('0x16')](handleEntityNotFound(_0x5276a3,null))[_0xcf2f('0x16')](function(_0x451927){if(_0x451927[_0xcf2f('0x38')]===_0xcf2f('0x39')){var _0x1a4c92=encryptor['decryptString'](_0x451927[_0xcf2f('0x34')]);_0x451927[_0xcf2f('0x34')]=maskClientSecret(_0x1a4c92);}return _0x451927;})['then'](respondWithResult(_0x5276a3,null))[_0xcf2f('0x35')](handleError(_0x5276a3,null));};exports[_0xcf2f('0x3a')]=function(_0x36a5ea,_0xd48aba){if(!_0x36a5ea['body'][_0xcf2f('0x23')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x36a5ea[_0xcf2f('0x3b')][_0xcf2f('0x38')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x5b95af=db[_0xcf2f('0x1c')][_0xcf2f('0x1d')]['service'][_0xcf2f('0x3c')];if(!_0x5b95af[_0xcf2f('0x3d')](_0x36a5ea[_0xcf2f('0x3b')][_0xcf2f('0x38')]))throw new Error(_0xcf2f('0x3e')+_0x5b95af[_0xcf2f('0x3f')](',\x20'));if(_0x36a5ea[_0xcf2f('0x3b')]['service']===_0xcf2f('0x39')&&_0x36a5ea[_0xcf2f('0x3b')][_0xcf2f('0x34')]){_0x36a5ea[_0xcf2f('0x3b')][_0xcf2f('0x34')]=encryptor[_0xcf2f('0x40')](_0x36a5ea[_0xcf2f('0x3b')][_0xcf2f('0x34')]);}return db[_0xcf2f('0x1c')]['create'](_0x36a5ea['body'],{})[_0xcf2f('0x16')](respondWithResult(_0xd48aba,0xc9))[_0xcf2f('0x35')](handleError(_0xd48aba,null));};exports[_0xcf2f('0x41')]=function(_0x4239f8,_0x5d2898){if(_0x4239f8['body']['id']){delete _0x4239f8['body']['id'];}return db[_0xcf2f('0x1c')][_0xcf2f('0x37')]({'where':{'id':_0x4239f8[_0xcf2f('0x42')]['id']}})[_0xcf2f('0x16')](handleEntityNotFound(_0x5d2898,null))['then'](function(_0x1fc094){if(_0x1fc094['service']===_0xcf2f('0x39')&&_0x4239f8[_0xcf2f('0x3b')][_0xcf2f('0x34')]){_0x4239f8['body'][_0xcf2f('0x34')]=encryptor[_0xcf2f('0x40')](_0x4239f8[_0xcf2f('0x3b')][_0xcf2f('0x34')]);}return _0x1fc094;})[_0xcf2f('0x16')](saveUpdates(_0x4239f8[_0xcf2f('0x3b')],null))[_0xcf2f('0x16')](respondWithResult(_0x5d2898,null))[_0xcf2f('0x35')](handleError(_0x5d2898,null));};exports[_0xcf2f('0x17')]=function(_0x3a5373,_0x2d6b20){return db[_0xcf2f('0x1c')][_0xcf2f('0x37')]({'where':{'id':_0x3a5373[_0xcf2f('0x42')]['id']}})[_0xcf2f('0x16')](handleEntityNotFound(_0x2d6b20,null))[_0xcf2f('0x16')](removeEntity(_0x2d6b20,null))[_0xcf2f('0x35')](handleError(_0x2d6b20,null));};exports['oauth2MicrosoftAuthorize']=function(_0x3b7851,_0x4fa733){return db[_0xcf2f('0x1c')][_0xcf2f('0x43')]({'where':{'id':_0x3b7851[_0xcf2f('0x42')]['id']},'raw':!![]})['then'](function(_0x2038c3){if(!_0x2038c3)return _0x4fa733['sendStatus'](0x194);return{'url':oauth[_0xcf2f('0x44')](_0x2038c3,_0x3b7851['user']['id'])};})[_0xcf2f('0x16')](respondWithResult(_0x4fa733,null))[_0xcf2f('0x35')](handleError(_0x4fa733,null));};exports[_0xcf2f('0x45')]=function(_0x34d2cf,_0x3851cd){var _0x502242=_0x34d2cf['body'];var _0x274f50;var _0x8b1369;if(_0x502242['error'])throw _0x502242;redis[_0xcf2f('0x46')](_0x502242[_0xcf2f('0x47')])['then'](function(_0x424a14){if(!_0x424a14)throw new Error(_0xcf2f('0x48'));_0x274f50=JSON[_0xcf2f('0x49')](_0x424a14);var _0x34e562=Buffer[_0xcf2f('0x4a')](_0x502242[_0xcf2f('0x47')],'base64')[_0xcf2f('0x4b')]('ascii');_0x8b1369=JSON[_0xcf2f('0x49')](_0x34e562);if(!oauth[_0xcf2f('0x4c')](_0x502242['id_token'],_0x274f50[_0xcf2f('0x4d')]))throw new Error(_0xcf2f('0x4e'));redis[_0xcf2f('0x4f')](_0x502242[_0xcf2f('0x47')]);return oauth[_0xcf2f('0x50')](_0x502242[_0xcf2f('0x51')],_0x274f50);})[_0xcf2f('0x16')](function(_0x3bb11a){_0x274f50[_0xcf2f('0x52')]=_0x3bb11a[_0xcf2f('0x53')];_0x274f50['data6']=_0x3bb11a['refresh_token'];return db[_0xcf2f('0x1c')]['update']({'data5':_0x274f50[_0xcf2f('0x52')],'data6':_0x274f50[_0xcf2f('0x54')]},{'where':{'id':_0x274f50['id']}});})[_0xcf2f('0x16')](function(){oauth[_0xcf2f('0x55')](_0x274f50);socket['emit'](_0xcf2f('0x56'),{'id':_0x8b1369['id']});return;})[_0xcf2f('0x16')](respondWithStatusCode(_0x3851cd,null))[_0xcf2f('0x35')](function(_0x56d084){if(_0x8b1369){socket[_0xcf2f('0x57')](_0xcf2f('0x58'),{'id':_0x8b1369['id']});}if(!_0x274f50){logger[_0xcf2f('0x18')](_0xcf2f('0x59'),_0x56d084);return _0x3851cd[_0xcf2f('0xd')](0x1f4)[_0xcf2f('0x19')](_0x56d084[_0xcf2f('0x5a')]);}logger[_0xcf2f('0x18')](_0xcf2f('0x5b'),_0x274f50['id'],JSON[_0xcf2f('0x5c')](_0x56d084));});}; \ No newline at end of file +var _0x2a14=['options','CloudProvider','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','includeAll','include','create','body','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','find','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','base64','ascii','isValidIdToken','oauth2Claims','del','code','data5','access_token','refresh_token','data6','startRefreshInterval','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','padEnd','slice','index','map','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','pick','filter','where','merge','VIRTUAL'];(function(_0x443e88,_0x4b9d1e){var _0x50f7b1=function(_0x348e68){while(--_0x348e68){_0x443e88['push'](_0x443e88['shift']());}};_0x50f7b1(++_0x4b9d1e);}(_0x2a14,0x1ee));var _0x42a1=function(_0x297b47,_0x305c9d){_0x297b47=_0x297b47-0x0;var _0xc87900=_0x2a14[_0x297b47];return _0xc87900;};'use strict';var _=require(_0x42a1('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require(_0x42a1('0x1'));var config=require(_0x42a1('0x2'));var logger=require(_0x42a1('0x3'))('api');var db=require(_0x42a1('0x4'))['db'];var oauth=require(_0x42a1('0x5'));config[_0x42a1('0x6')]=_[_0x42a1('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x42a1('0x8'))(new Redis(config[_0x42a1('0x6')]));var redis=new Redis(config[_0x42a1('0x6')]);function respondWithStatusCode(_0x28189b,_0x26ef14){_0x26ef14=_0x26ef14||0xcc;return function(_0x557a5d){if(_0x557a5d){return _0x28189b[_0x42a1('0x9')](_0x26ef14);}return _0x28189b[_0x42a1('0xa')](_0x26ef14)[_0x42a1('0xb')]();};}function respondWithResult(_0x5a2afe,_0x1521bc){_0x1521bc=_0x1521bc||0xc8;return function(_0x1ef271){if(_0x1ef271){return _0x5a2afe[_0x42a1('0xa')](_0x1521bc)[_0x42a1('0xc')](_0x1ef271);}};}function respondWithFilteredResult(_0x74c62b,_0x461239){return function(_0x3ae597){if(_0x3ae597){var _0x58f748=typeof _0x461239[_0x42a1('0xd')]===_0x42a1('0xe')&&typeof _0x461239[_0x42a1('0xf')]===_0x42a1('0xe');var _0xb00c84=_0x3ae597[_0x42a1('0x10')];var _0x5b82b5=_0x58f748?0x0:_0x461239['offset'];var _0x5cbed0=_0x58f748?_0x3ae597['count']:_0x461239['offset']+_0x461239['limit'];var _0x366292;if(_0x5cbed0>=_0xb00c84){_0x5cbed0=_0xb00c84;_0x366292=0xc8;}else{_0x366292=0xce;}_0x74c62b['status'](_0x366292);return _0x74c62b['set'](_0x42a1('0x11'),_0x5b82b5+'-'+_0x5cbed0+'/'+_0xb00c84)[_0x42a1('0xc')](_0x3ae597);}return null;};}function saveUpdates(_0x508725){return function(_0x39cfde){if(_0x39cfde){return _0x39cfde[_0x42a1('0x12')](_0x508725)[_0x42a1('0x13')](function(_0x163f6e){return _0x163f6e;});}return null;};}function removeEntity(_0x2cb17d){return function(_0x4c4ae8){if(_0x4c4ae8){return _0x4c4ae8[_0x42a1('0x14')]()[_0x42a1('0x13')](function(){_0x2cb17d[_0x42a1('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17a531){return function(_0x48eef7){if(!_0x48eef7){_0x17a531['sendStatus'](0x194);}return _0x48eef7;};}function handleError(_0x38233f,_0x92f6e9){_0x92f6e9=_0x92f6e9||0x1f4;return function(_0x2bd83b){logger[_0x42a1('0x15')](_0x2bd83b[_0x42a1('0x16')]);if(_0x2bd83b['name']){delete _0x2bd83b['name'];}_0x38233f['status'](_0x92f6e9)['send'](_0x2bd83b);};}function maskClientSecret(_0x32e08c){return _[_0x42a1('0x17')](_0x32e08c[_0x42a1('0x18')](0x0,0x3),0x14,'*');}exports[_0x42a1('0x19')]=function(_0x5e9495,_0x3c5fa2){var _0x55fb51={},_0x22cb21={},_0x31a9e8={'count':0x0,'rows':[]};var _0x168cf7=_[_0x42a1('0x1a')](db['CloudProvider'][_0x42a1('0x1b')],function(_0x364661){return{'name':_0x364661[_0x42a1('0x1c')],'type':_0x364661[_0x42a1('0x1d')][_0x42a1('0x1e')]};});_0x22cb21[_0x42a1('0x1f')]=_[_0x42a1('0x1a')](_0x168cf7,_0x42a1('0x20'));_0x22cb21['query']=_['keys'](_0x5e9495[_0x42a1('0x21')]);_0x22cb21[_0x42a1('0x22')]=_[_0x42a1('0x23')](_0x22cb21[_0x42a1('0x1f')],_0x22cb21[_0x42a1('0x21')]);_0x55fb51[_0x42a1('0x24')]=_['intersection'](_0x22cb21[_0x42a1('0x1f')],qs[_0x42a1('0x25')](_0x5e9495[_0x42a1('0x21')][_0x42a1('0x25')]));_0x55fb51[_0x42a1('0x24')]=_0x55fb51[_0x42a1('0x24')][_0x42a1('0x26')]?_0x55fb51[_0x42a1('0x24')]:_0x22cb21[_0x42a1('0x1f')];if(!_0x5e9495['query'][_0x42a1('0x27')]('nolimit')){_0x55fb51['limit']=qs[_0x42a1('0xf')](_0x5e9495[_0x42a1('0x21')][_0x42a1('0xf')]);_0x55fb51[_0x42a1('0xd')]=qs[_0x42a1('0xd')](_0x5e9495[_0x42a1('0x21')][_0x42a1('0xd')]);}_0x55fb51[_0x42a1('0x28')]=qs['sort'](_0x5e9495['query']['sort']);_0x55fb51['where']=qs[_0x42a1('0x22')](_[_0x42a1('0x29')](_0x5e9495[_0x42a1('0x21')],_0x22cb21[_0x42a1('0x22')]),_0x168cf7);if(_0x5e9495['query'][_0x42a1('0x2a')]){_0x55fb51[_0x42a1('0x2b')]=_[_0x42a1('0x2c')](_0x55fb51[_0x42a1('0x2b')],{'$or':_[_0x42a1('0x1a')](_0x168cf7,function(_0xfcea73){if(_0xfcea73[_0x42a1('0x1d')]!==_0x42a1('0x2d')){var _0x1f4f3a={};_0x1f4f3a[_0xfcea73[_0x42a1('0x20')]]={'$like':'%'+_0x5e9495[_0x42a1('0x21')][_0x42a1('0x2a')]+'%'};return _0x1f4f3a;}})});}_0x55fb51=_[_0x42a1('0x2c')]({},_0x55fb51,_0x5e9495[_0x42a1('0x2e')]);var _0x8cdb76={'where':_0x55fb51[_0x42a1('0x2b')]};return db[_0x42a1('0x2f')][_0x42a1('0x10')](_0x8cdb76)[_0x42a1('0x13')](function(_0x48e9b9){_0x31a9e8[_0x42a1('0x10')]=_0x48e9b9;if(_0x5e9495[_0x42a1('0x21')]['includeAll']){_0x55fb51['include']=[{'all':!![]}];}return db[_0x42a1('0x2f')][_0x42a1('0x30')](_0x55fb51);})['then'](function(_0x265651){_0x31a9e8[_0x42a1('0x31')]=_[_0x42a1('0x1a')](_0x265651,function(_0x39bfe1){if(_0x39bfe1[_0x42a1('0x32')]===_0x42a1('0x33')){var _0x8888ce=encryptor[_0x42a1('0x34')](_0x39bfe1[_0x42a1('0x35')]);_0x39bfe1[_0x42a1('0x35')]=maskClientSecret(_0x8888ce);}return _0x39bfe1;});return _0x31a9e8;})['then'](respondWithFilteredResult(_0x3c5fa2,_0x55fb51))[_0x42a1('0x36')](handleError(_0x3c5fa2,null));};exports[_0x42a1('0x37')]=function(_0x4cce7c,_0x4bc9ff){var _0x16b93e={'raw':!![],'where':{'id':_0x4cce7c[_0x42a1('0x38')]['id']}},_0x38b17c={};_0x38b17c['model']=_['keys'](db[_0x42a1('0x2f')][_0x42a1('0x1b')]);_0x38b17c[_0x42a1('0x21')]=_['keys'](_0x4cce7c[_0x42a1('0x21')]);_0x38b17c[_0x42a1('0x22')]=_[_0x42a1('0x23')](_0x38b17c['model'],_0x38b17c[_0x42a1('0x21')]);_0x16b93e['attributes']=_[_0x42a1('0x23')](_0x38b17c[_0x42a1('0x1f')],qs[_0x42a1('0x25')](_0x4cce7c['query'][_0x42a1('0x25')]));_0x16b93e['attributes']=_0x16b93e[_0x42a1('0x24')][_0x42a1('0x26')]?_0x16b93e[_0x42a1('0x24')]:_0x38b17c[_0x42a1('0x1f')];if(_0x4cce7c[_0x42a1('0x21')][_0x42a1('0x39')]){_0x16b93e[_0x42a1('0x3a')]=[{'all':!![]}];}_0x16b93e=_['merge']({},_0x16b93e,_0x4cce7c[_0x42a1('0x2e')]);return db[_0x42a1('0x2f')]['find'](_0x16b93e)[_0x42a1('0x13')](handleEntityNotFound(_0x4bc9ff,null))[_0x42a1('0x13')](function(_0x40b97b){if(_0x40b97b[_0x42a1('0x32')]===_0x42a1('0x33')){var _0x3e76d2=encryptor[_0x42a1('0x34')](_0x40b97b['data3']);_0x40b97b[_0x42a1('0x35')]=maskClientSecret(_0x3e76d2);}return _0x40b97b;})['then'](respondWithResult(_0x4bc9ff,null))[_0x42a1('0x36')](handleError(_0x4bc9ff,null));};exports[_0x42a1('0x3b')]=function(_0x1ac5a7,_0x271c08){if(!_0x1ac5a7[_0x42a1('0x3c')][_0x42a1('0x20')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x1ac5a7[_0x42a1('0x3c')][_0x42a1('0x32')])throw new Error(_0x42a1('0x3d'));var _0x3f725c=db[_0x42a1('0x2f')]['rawAttributes'][_0x42a1('0x32')]['values'];if(!_0x3f725c[_0x42a1('0x3e')](_0x1ac5a7[_0x42a1('0x3c')][_0x42a1('0x32')]))throw new Error(_0x42a1('0x3f')+_0x3f725c['join'](',\x20'));if(_0x1ac5a7[_0x42a1('0x3c')][_0x42a1('0x32')]==='MicrosoftAzure'&&_0x1ac5a7[_0x42a1('0x3c')][_0x42a1('0x35')]){_0x1ac5a7[_0x42a1('0x3c')]['data3']=encryptor[_0x42a1('0x40')](_0x1ac5a7['body'][_0x42a1('0x35')]);}return db['CloudProvider']['create'](_0x1ac5a7['body'],{})['then'](respondWithResult(_0x271c08,0xc9))[_0x42a1('0x36')](handleError(_0x271c08,null));};exports[_0x42a1('0x12')]=function(_0x7905cf,_0x2285c4){if(_0x7905cf[_0x42a1('0x3c')]['id']){delete _0x7905cf[_0x42a1('0x3c')]['id'];}return db[_0x42a1('0x2f')][_0x42a1('0x41')]({'where':{'id':_0x7905cf[_0x42a1('0x38')]['id']}})['then'](handleEntityNotFound(_0x2285c4,null))[_0x42a1('0x13')](function(_0x5c616d){if(_0x5c616d[_0x42a1('0x32')]==='MicrosoftAzure'&&_0x7905cf[_0x42a1('0x3c')][_0x42a1('0x35')]){_0x7905cf[_0x42a1('0x3c')][_0x42a1('0x35')]=encryptor[_0x42a1('0x40')](_0x7905cf['body'][_0x42a1('0x35')]);}return _0x5c616d;})[_0x42a1('0x13')](saveUpdates(_0x7905cf['body'],null))[_0x42a1('0x13')](respondWithResult(_0x2285c4,null))[_0x42a1('0x36')](handleError(_0x2285c4,null));};exports[_0x42a1('0x14')]=function(_0x7df153,_0x35d284){return db['CloudProvider']['find']({'where':{'id':_0x7df153[_0x42a1('0x38')]['id']}})[_0x42a1('0x13')](handleEntityNotFound(_0x35d284,null))['then'](removeEntity(_0x35d284,null))[_0x42a1('0x36')](handleError(_0x35d284,null));};exports['oauth2MicrosoftAuthorize']=function(_0xa05679,_0x14f5da){return db[_0x42a1('0x2f')]['findOne']({'where':{'id':_0xa05679[_0x42a1('0x38')]['id']},'raw':!![]})[_0x42a1('0x13')](function(_0x3d45a3){if(!_0x3d45a3)return _0x14f5da['sendStatus'](0x194);return{'url':oauth[_0x42a1('0x42')](_0x3d45a3,_0xa05679[_0x42a1('0x43')]['id'])};})[_0x42a1('0x13')](respondWithResult(_0x14f5da,null))['catch'](handleError(_0x14f5da,null));};exports[_0x42a1('0x44')]=function(_0x79dfc0,_0x4c7927){var _0x10d711=_0x79dfc0[_0x42a1('0x3c')];var _0x1f7a33;var _0x3c36ae;if(_0x10d711[_0x42a1('0x15')])throw _0x10d711;redis[_0x42a1('0x45')](_0x10d711[_0x42a1('0x46')])[_0x42a1('0x13')](function(_0x549782){if(!_0x549782)throw new Error(_0x42a1('0x47'));_0x1f7a33=JSON[_0x42a1('0x48')](_0x549782);var _0x1b5115=Buffer['from'](_0x10d711[_0x42a1('0x46')],_0x42a1('0x49'))['toString'](_0x42a1('0x4a'));_0x3c36ae=JSON['parse'](_0x1b5115);if(!oauth[_0x42a1('0x4b')](_0x10d711['id_token'],_0x1f7a33[_0x42a1('0x4c')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x42a1('0x4d')](_0x10d711['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x10d711[_0x42a1('0x4e')],_0x1f7a33);})[_0x42a1('0x13')](function(_0x4aa303){_0x1f7a33[_0x42a1('0x4f')]=_0x4aa303[_0x42a1('0x50')];_0x1f7a33['data6']=_0x4aa303[_0x42a1('0x51')];return db[_0x42a1('0x2f')][_0x42a1('0x12')]({'data5':_0x1f7a33['data5'],'data6':_0x1f7a33[_0x42a1('0x52')]},{'where':{'id':_0x1f7a33['id']}});})[_0x42a1('0x13')](function(){oauth[_0x42a1('0x53')](_0x1f7a33);socket['emit'](_0x42a1('0x54'),{'id':_0x3c36ae['id']});return;})['then'](respondWithStatusCode(_0x4c7927,null))[_0x42a1('0x36')](function(_0x127f8d){if(_0x3c36ae){socket['emit']('microsoftAuthorization:error',{'id':_0x3c36ae['id']});}if(!_0x1f7a33){logger[_0x42a1('0x15')](_0x42a1('0x55'),_0x127f8d);return _0x4c7927[_0x42a1('0xa')](0x1f4)[_0x42a1('0x56')](_0x127f8d[_0x42a1('0x57')]);}logger['error'](_0x42a1('0x58'),_0x1f7a33['id'],JSON[_0x42a1('0x59')](_0x127f8d));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 6611d71..bb18574 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 _0x5e74=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CloudProvider','cloud_providers','lodash','util'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x5e74,0x1da));var _0x45e7=function(_0x268256,_0x10afb0){_0x268256=_0x268256-0x0;var _0x415642=_0x5e74[_0x268256];return _0x415642;};'use strict';var _=require(_0x45e7('0x0'));var util=require(_0x45e7('0x1'));var logger=require(_0x45e7('0x2'))(_0x45e7('0x3'));var moment=require(_0x45e7('0x4'));var BPromise=require(_0x45e7('0x5'));var rp=require(_0x45e7('0x6'));var fs=require('fs');var path=require(_0x45e7('0x7'));var rimraf=require(_0x45e7('0x8'));var config=require(_0x45e7('0x9'));var attributes=require('./cloudProvider.attributes');module[_0x45e7('0xa')]=function(_0x374a57,_0xcb34eb){return _0x374a57[_0x45e7('0xb')](_0x45e7('0xc'),attributes,{'tableName':_0x45e7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1c1=['../../config/logger','api','bluebird','request-promise','path','rimraf','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash'];(function(_0x39d39d,_0x5586bd){var _0x577ac3=function(_0x12f9f2){while(--_0x12f9f2){_0x39d39d['push'](_0x39d39d['shift']());}};_0x577ac3(++_0x5586bd);}(_0xd1c1,0x1af));var _0x1d1c=function(_0x25a0b9,_0x86e28f){_0x25a0b9=_0x25a0b9-0x0;var _0x30b9ab=_0xd1c1[_0x25a0b9];return _0x30b9ab;};'use strict';var _=require(_0x1d1c('0x0'));var util=require('util');var logger=require(_0x1d1c('0x1'))(_0x1d1c('0x2'));var moment=require('moment');var BPromise=require(_0x1d1c('0x3'));var rp=require(_0x1d1c('0x4'));var fs=require('fs');var path=require(_0x1d1c('0x5'));var rimraf=require(_0x1d1c('0x6'));var config=require('../../config/environment');var attributes=require(_0x1d1c('0x7'));module[_0x1d1c('0x8')]=function(_0x20bc1f,_0x48da36){return _0x20bc1f[_0x1d1c('0x9')](_0x1d1c('0xa'),attributes,{'tableName':_0x1d1c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 30228f3..88648da 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 _0x79fb=['CloudProvider','findOne','refresh_token','data6','POST','data2','data5','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','type','push','data7','join','/.default','replace','{TENANT_ID}','code','id_token','from','toString','base64','randomBytes','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','prompt','login','map','oauth2Claims','oauth2/','set','decode','payload','iss','issuer','aud','nonce','isAfter','unix','exp','resolve','then','data3'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x79fb,0x1a7));var _0xb79f=function(_0x495447,_0x4369c8){_0x495447=_0x495447-0x0;var _0x5b2a78=_0x79fb[_0x495447];return _0x5b2a78;};'use strict';var _=require('lodash');var crypto=require(_0xb79f('0x0'));var jwt=require(_0xb79f('0x1'));var moment=require(_0xb79f('0x2'));var Redis=require(_0xb79f('0x3'));var rp=require(_0xb79f('0x4'));var util=require(_0xb79f('0x5'));var encryptor=require(_0xb79f('0x6'));var config=require(_0xb79f('0x7'));var logger=require(_0xb79f('0x8'))(_0xb79f('0x9'));var schedule=require(_0xb79f('0xa'));var db=require(_0xb79f('0xb'))['db'];config[_0xb79f('0xc')]=_[_0xb79f('0xd')](config[_0xb79f('0xc')],{'host':_0xb79f('0xe'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0xb79f('0xf');var AZURE_AUTH_SCOPES={'Outlook365':[_0xb79f('0x10'),_0xb79f('0x11'),_0xb79f('0x12'),_0xb79f('0x13'),_0xb79f('0x14'),_0xb79f('0x15'),_0xb79f('0x16')],'Dynamics365':[_0xb79f('0x10'),_0xb79f('0x13')]};var MICROSOFT_AUTH_ENDPOINT=_0xb79f('0x17');var MICROSOFT_TOKEN_ENDPOINT=_0xb79f('0x18');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4ffee0){var _0x1952d1=_['map'](AZURE_AUTH_SCOPES[_0x4ffee0[_0xb79f('0x19')]]);if(_0x4ffee0['type']==='Dynamics365')_0x1952d1[_0xb79f('0x1a')](_0x4ffee0[_0xb79f('0x1b')]+'/.default');return _0x1952d1[_0xb79f('0x1c')]('\x20');}function getAccessTokenScope(_0x7f9b71){if(_0x7f9b71['type']==='Outlook365')return _0xb79f('0x14');if(_0x7f9b71[_0xb79f('0x19')]==='Dynamics365')return _0x7f9b71[_0xb79f('0x1b')]+_0xb79f('0x1d');}function generateMicrosoftAuthorizationUrl(_0x315e40,_0x4a51f4){var _0x2c1d18=MICROSOFT_AUTH_URL[_0xb79f('0x1e')](_0xb79f('0x1f'),_0x315e40['data2']);var _0x45334a=[_0xb79f('0x20'),_0xb79f('0x21')];var _0x113910=Buffer[_0xb79f('0x22')](JSON['stringify']({'id':_0x4a51f4}))[_0xb79f('0x23')](_0xb79f('0x24'));var _0x2b86de=crypto[_0xb79f('0x25')](0x10)[_0xb79f('0x23')](_0xb79f('0x26'));var _0x219536=getAuthorizationScopes(_0x315e40);var _0x26b020=[{'key':_0xb79f('0x27'),'value':_0x315e40[_0xb79f('0x28')]},{'key':_0xb79f('0x29'),'value':encodeURIComponent(_0x45334a['join']('\x20'))},{'key':_0xb79f('0x2a'),'value':_0x315e40[_0xb79f('0x2b')]},{'key':_0xb79f('0x2c'),'value':'form_post'},{'key':'scope','value':encodeURIComponent(_0x219536)},{'key':'state','value':_0x113910},{'key':'nonce','value':_0x2b86de},{'key':_0xb79f('0x2d'),'value':_0xb79f('0x2e')}];var _0x49296f=_0x2c1d18+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xb79f('0x2f')](_0x26b020,function(_0x44bf8c){return _0x44bf8c['key']+'='+_0x44bf8c['value'];})[_0xb79f('0x1c')]('&');_0x315e40[_0xb79f('0x30')]={'issuer':_0x2c1d18['replace'](_0xb79f('0x31'),''),'audience':_0x315e40[_0xb79f('0x28')],'state':_0x113910,'nonce':_0x2b86de};redis[_0xb79f('0x32')](_0x113910,JSON['stringify'](_0x315e40));return _0x49296f;}function isValidIdToken(_0x105002,_0x28019c){try{var _0x187512=jwt[_0xb79f('0x33')](_0x105002,{'complete':!![]});var _0x4f5c5a=_0x187512[_0xb79f('0x34')];if(_0x4f5c5a[_0xb79f('0x35')]!==_0x28019c[_0xb79f('0x36')])return![];if(_0x4f5c5a[_0xb79f('0x37')]!==_0x28019c['audience'])return![];if(_0x4f5c5a[_0xb79f('0x38')]!==_0x28019c[_0xb79f('0x38')])return![];if(moment()[_0xb79f('0x39')](moment[_0xb79f('0x3a')](_0x4f5c5a[_0xb79f('0x3b')])))return![];return!![];}catch(_0x319098){throw _0x319098;}}function refreshOauth2MicrosoftAccessToken(_0x2c13a6){return Promise[_0xb79f('0x3c')]()[_0xb79f('0x3d')](function(){if(_0x2c13a6[_0xb79f('0x3e')])return _0x2c13a6;return db[_0xb79f('0x3f')][_0xb79f('0x40')]({'where':{'id':_0x2c13a6['id']},'raw':!![]});})[_0xb79f('0x3d')](function(_0x914d13){var _0x278ef4={'grant_type':_0xb79f('0x41'),'refresh_token':_0x914d13[_0xb79f('0x42')],'scope':getAccessTokenScope(_0x914d13),'redirect_uri':_0x914d13[_0xb79f('0x2b')],'client_id':_0x914d13[_0xb79f('0x28')],'client_secret':encryptor['decryptString'](_0x914d13[_0xb79f('0x3e')])};var _0x72fefe={'method':_0xb79f('0x43'),'uri':MICROSOFT_AUTH_URL[_0xb79f('0x1e')](_0xb79f('0x1f'),_0x914d13[_0xb79f('0x44')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x278ef4,'json':!![]};return rp(_0x72fefe);})[_0xb79f('0x3d')](function(_0x468e9c){_0x2c13a6[_0xb79f('0x45')]=_0x468e9c[_0xb79f('0x46')];_0x2c13a6[_0xb79f('0x42')]=_0x468e9c[_0xb79f('0x41')];return db['CloudProvider'][_0xb79f('0x47')]({'data5':_0x2c13a6[_0xb79f('0x45')],'data6':_0x2c13a6['data6']},{'where':{'id':_0x2c13a6['id']}});})[_0xb79f('0x3d')](function(){return _0x2c13a6;})[_0xb79f('0x48')](function(_0xa11d9f){logger[_0xb79f('0x49')](_0xb79f('0x4a'),_0x2c13a6['id'],_0xa11d9f);});}function getOauth2MicrosoftAccessToken(_0x231b40,_0x26b633){var _0x36cfda={'grant_type':_0xb79f('0x4b'),'code':_0x231b40,'scope':getAccessTokenScope(_0x26b633),'redirect_uri':_0x26b633[_0xb79f('0x2b')],'client_id':_0x26b633[_0xb79f('0x28')],'client_secret':encryptor['decryptString'](_0x26b633['data3'])};var _0x6eec96={'method':_0xb79f('0x43'),'uri':MICROSOFT_AUTH_URL[_0xb79f('0x1e')](_0xb79f('0x1f'),_0x26b633[_0xb79f('0x44')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x36cfda,'json':!![]};return rp(_0x6eec96);}function startRefreshInterval(_0x325a5a){var _0x179481=schedule[_0xb79f('0x4c')];if(_0x179481[_0x325a5a['id']])clearInterval(_0x179481[_0x325a5a['id']]);_0x179481[_0x325a5a['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x325a5a['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xb79f('0x4c')]=_0x179481;}function startAllRefreshIntervals(){return db[_0xb79f('0x3f')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xb79f('0x3d')](function(_0x343fd7){var _0x4ab819=_0x343fd7[_0xb79f('0x2f')](function(_0x3a63f4){return refreshOauth2MicrosoftAccessToken(_0x3a63f4)[_0xb79f('0x3d')](function(_0x5f1f12){startRefreshInterval(_0x5f1f12);});});return Promise[_0xb79f('0x4d')](_0x4ab819);})['catch'](function(_0x1611a4){var _0xa6eea3=_0x1611a4?util[_0xb79f('0x4e')](_0x1611a4,{'showHidden':![],'depth':null}):'';logger['error'](_0xb79f('0x4f'),_0xa6eea3);});}module[_0xb79f('0x50')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xb6b7=['map','key','value','oauth2Claims','oauth2/','data1','decode','payload','iss','issuer','aud','audience','isAfter','unix','exp','resolve','then','data3','findOne','refresh_token','data6','data4','POST','data5','access_token','update','catch','error','authorization_code','intervals','bind','CloudProvider','findAll','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','../../components/encryptor','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','type','Dynamics365','push','data7','Outlook365','replace','{TENANT_ID}','data2','code','id_token','from','stringify','randomBytes','toString','client_id','response_type','join','redirect_uri','response_mode','state','nonce','prompt','login'];(function(_0x3f2605,_0x262173){var _0x15169a=function(_0x1438d0){while(--_0x1438d0){_0x3f2605['push'](_0x3f2605['shift']());}};_0x15169a(++_0x262173);}(_0xb6b7,0xc6));var _0x7b6b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb6b7[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7b6b('0x0'));var crypto=require(_0x7b6b('0x1'));var jwt=require(_0x7b6b('0x2'));var moment=require(_0x7b6b('0x3'));var Redis=require(_0x7b6b('0x4'));var rp=require(_0x7b6b('0x5'));var util=require('util');var encryptor=require(_0x7b6b('0x6'));var config=require('../../config/environment');var logger=require(_0x7b6b('0x7'))(_0x7b6b('0x8'));var schedule=require(_0x7b6b('0x9'));var db=require(_0x7b6b('0xa'))['db'];config[_0x7b6b('0xb')]=_[_0x7b6b('0xc')](config['redis'],{'host':_0x7b6b('0xd'),'port':0x18eb});var redis=new Redis(config[_0x7b6b('0xb')]);var MICROSOFT_AUTH_URL=_0x7b6b('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0x7b6b('0xf'),'profile',_0x7b6b('0x10'),_0x7b6b('0x11'),_0x7b6b('0x12'),'https://outlook.office.com/POP.AccessAsUser.All',_0x7b6b('0x13')],'Dynamics365':[_0x7b6b('0xf'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x7b6b('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0x7b6b('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x37f696){var _0x54160e=_['map'](AZURE_AUTH_SCOPES[_0x37f696[_0x7b6b('0x16')]]);if(_0x37f696['type']===_0x7b6b('0x17'))_0x54160e[_0x7b6b('0x18')](_0x37f696[_0x7b6b('0x19')]+'/.default');return _0x54160e['join']('\x20');}function getAccessTokenScope(_0x33296a){if(_0x33296a[_0x7b6b('0x16')]===_0x7b6b('0x1a'))return _0x7b6b('0x12');if(_0x33296a['type']===_0x7b6b('0x17'))return _0x33296a[_0x7b6b('0x19')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x411761,_0x1c9175){var _0x35a98f=MICROSOFT_AUTH_URL[_0x7b6b('0x1b')](_0x7b6b('0x1c'),_0x411761[_0x7b6b('0x1d')]);var _0x38b8e8=[_0x7b6b('0x1e'),_0x7b6b('0x1f')];var _0x16a82e=Buffer[_0x7b6b('0x20')](JSON[_0x7b6b('0x21')]({'id':_0x1c9175}))['toString']('base64');var _0x2cac88=crypto[_0x7b6b('0x22')](0x10)[_0x7b6b('0x23')]('hex');var _0x56d214=getAuthorizationScopes(_0x411761);var _0x9d54ad=[{'key':_0x7b6b('0x24'),'value':_0x411761['data1']},{'key':_0x7b6b('0x25'),'value':encodeURIComponent(_0x38b8e8[_0x7b6b('0x26')]('\x20'))},{'key':_0x7b6b('0x27'),'value':_0x411761['data4']},{'key':_0x7b6b('0x28'),'value':'form_post'},{'key':'scope','value':encodeURIComponent(_0x56d214)},{'key':_0x7b6b('0x29'),'value':_0x16a82e},{'key':_0x7b6b('0x2a'),'value':_0x2cac88},{'key':_0x7b6b('0x2b'),'value':_0x7b6b('0x2c')}];var _0xa04fc9=_0x35a98f+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x7b6b('0x2d')](_0x9d54ad,function(_0x3926ef){return _0x3926ef[_0x7b6b('0x2e')]+'='+_0x3926ef[_0x7b6b('0x2f')];})[_0x7b6b('0x26')]('&');_0x411761[_0x7b6b('0x30')]={'issuer':_0x35a98f[_0x7b6b('0x1b')](_0x7b6b('0x31'),''),'audience':_0x411761[_0x7b6b('0x32')],'state':_0x16a82e,'nonce':_0x2cac88};redis['set'](_0x16a82e,JSON[_0x7b6b('0x21')](_0x411761));return _0xa04fc9;}function isValidIdToken(_0xb2ad45,_0x306490){try{var _0x3cfa43=jwt[_0x7b6b('0x33')](_0xb2ad45,{'complete':!![]});var _0x1e3076=_0x3cfa43[_0x7b6b('0x34')];if(_0x1e3076[_0x7b6b('0x35')]!==_0x306490[_0x7b6b('0x36')])return![];if(_0x1e3076[_0x7b6b('0x37')]!==_0x306490[_0x7b6b('0x38')])return![];if(_0x1e3076[_0x7b6b('0x2a')]!==_0x306490[_0x7b6b('0x2a')])return![];if(moment()[_0x7b6b('0x39')](moment[_0x7b6b('0x3a')](_0x1e3076[_0x7b6b('0x3b')])))return![];return!![];}catch(_0x255171){throw _0x255171;}}function refreshOauth2MicrosoftAccessToken(_0x16a36f){return Promise[_0x7b6b('0x3c')]()[_0x7b6b('0x3d')](function(){if(_0x16a36f[_0x7b6b('0x3e')])return _0x16a36f;return db['CloudProvider'][_0x7b6b('0x3f')]({'where':{'id':_0x16a36f['id']},'raw':!![]});})[_0x7b6b('0x3d')](function(_0x4df009){var _0x38852e={'grant_type':_0x7b6b('0x40'),'refresh_token':_0x4df009[_0x7b6b('0x41')],'scope':getAccessTokenScope(_0x4df009),'redirect_uri':_0x4df009[_0x7b6b('0x42')],'client_id':_0x4df009[_0x7b6b('0x32')],'client_secret':encryptor['decryptString'](_0x4df009[_0x7b6b('0x3e')])};var _0x454a0d={'method':_0x7b6b('0x43'),'uri':MICROSOFT_AUTH_URL[_0x7b6b('0x1b')](_0x7b6b('0x1c'),_0x4df009[_0x7b6b('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x38852e,'json':!![]};return rp(_0x454a0d);})[_0x7b6b('0x3d')](function(_0xde4bab){_0x16a36f[_0x7b6b('0x44')]=_0xde4bab[_0x7b6b('0x45')];_0x16a36f[_0x7b6b('0x41')]=_0xde4bab[_0x7b6b('0x40')];return db['CloudProvider'][_0x7b6b('0x46')]({'data5':_0x16a36f[_0x7b6b('0x44')],'data6':_0x16a36f['data6']},{'where':{'id':_0x16a36f['id']}});})[_0x7b6b('0x3d')](function(){return _0x16a36f;})[_0x7b6b('0x47')](function(_0x460bc7){logger[_0x7b6b('0x48')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x16a36f['id'],_0x460bc7);});}function getOauth2MicrosoftAccessToken(_0x2722e7,_0x220d5b){var _0x10a636={'grant_type':_0x7b6b('0x49'),'code':_0x2722e7,'scope':getAccessTokenScope(_0x220d5b),'redirect_uri':_0x220d5b['data4'],'client_id':_0x220d5b['data1'],'client_secret':encryptor['decryptString'](_0x220d5b[_0x7b6b('0x3e')])};var _0x10e743={'method':_0x7b6b('0x43'),'uri':MICROSOFT_AUTH_URL['replace'](_0x7b6b('0x1c'),_0x220d5b[_0x7b6b('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x10a636,'json':!![]};return rp(_0x10e743);}function startRefreshInterval(_0x22aeef){var _0x38f4ad=schedule[_0x7b6b('0x4a')];if(_0x38f4ad[_0x22aeef['id']])clearInterval(_0x38f4ad[_0x22aeef['id']]);_0x38f4ad[_0x22aeef['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x7b6b('0x4b')](this,{'id':_0x22aeef['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x7b6b('0x4a')]=_0x38f4ad;}function startAllRefreshIntervals(){return db[_0x7b6b('0x4c')][_0x7b6b('0x4d')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x7b6b('0x3d')](function(_0x1d3672){var _0x4c7351=_0x1d3672[_0x7b6b('0x2d')](function(_0x57c064){return refreshOauth2MicrosoftAccessToken(_0x57c064)[_0x7b6b('0x3d')](function(_0x485260){startRefreshInterval(_0x485260);});});return Promise['all'](_0x4c7351);})[_0x7b6b('0x47')](function(_0x53e3bf){var _0x4142dd=_0x53e3bf?util[_0x7b6b('0x4e')](_0x53e3bf,{'showHidden':![],'depth':null}):'';logger[_0x7b6b('0x48')](_0x7b6b('0x4f'),_0x4142dd);});}module[_0x7b6b('0x50')]={'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 9bcf1c8..0d412f1 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 _0xa958=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','error','message','lodash','moment','bluebird','randomstring'];(function(_0x536b30,_0x139b25){var _0x1068a7=function(_0x16938){while(--_0x16938){_0x536b30['push'](_0x536b30['shift']());}};_0x1068a7(++_0x139b25);}(_0xa958,0x94));var _0x8a95=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xa958[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x8a95('0x0'));var util=require('util');var moment=require(_0x8a95('0x1'));var BPromise=require(_0x8a95('0x2'));var rs=require(_0x8a95('0x3'));var fs=require('fs');var Redis=require(_0x8a95('0x4'));var db=require(_0x8a95('0x5'))['db'];var utils=require(_0x8a95('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8a95('0x7'));var jayson=require(_0x8a95('0x8'));var client=jayson[_0x8a95('0x9')][_0x8a95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x387db4,_0xdd54e1,_0x161f00){return new BPromise(function(_0x49287d,_0xe03b31){return client[_0x8a95('0xb')](_0x387db4,_0x161f00)[_0x8a95('0xc')](function(_0x240b22){logger[_0x8a95('0xd')](_0x8a95('0xe'),_0xdd54e1,_0x8a95('0xf'));logger['debug'](_0x8a95('0x10'),_0xdd54e1,_0x8a95('0xf'),JSON['stringify'](_0x240b22));if(_0x240b22[_0x8a95('0x11')]){if(_0x240b22['error']['code']===0x1f4){logger[_0x8a95('0x11')]('CloudProvider,\x20%s,\x20%s',_0xdd54e1,_0x240b22[_0x8a95('0x11')][_0x8a95('0x12')]);return _0xe03b31(_0x240b22['error'][_0x8a95('0x12')]);}logger[_0x8a95('0x11')]('CloudProvider,\x20%s,\x20%s',_0xdd54e1,_0x240b22[_0x8a95('0x11')][_0x8a95('0x12')]);return _0x49287d(_0x240b22[_0x8a95('0x11')][_0x8a95('0x12')]);}else{logger[_0x8a95('0xd')](_0x8a95('0xe'),_0xdd54e1,_0x8a95('0xf'));_0x49287d(_0x240b22['result'][_0x8a95('0x12')]);}})['catch'](function(_0x334b18){logger['error'](_0x8a95('0xe'),_0xdd54e1,_0x334b18);_0xe03b31(_0x334b18);});});} \ No newline at end of file +var _0xa0a3=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','util','moment','randomstring','ioredis'];(function(_0x3abc2b,_0x239fe6){var _0x1eb069=function(_0x37c100){while(--_0x37c100){_0x3abc2b['push'](_0x3abc2b['shift']());}};_0x1eb069(++_0x239fe6);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0xd3da2a,_0x22241c){_0xd3da2a=_0xd3da2a-0x0;var _0x10ab61=_0xa0a3[_0xd3da2a];return _0x10ab61;};'use strict';var _=require('lodash');var util=require(_0x3a0a('0x0'));var moment=require(_0x3a0a('0x1'));var BPromise=require('bluebird');var rs=require(_0x3a0a('0x2'));var fs=require('fs');var Redis=require(_0x3a0a('0x3'));var db=require(_0x3a0a('0x4'))['db'];var utils=require(_0x3a0a('0x5'));var logger=require(_0x3a0a('0x6'))(_0x3a0a('0x7'));var config=require(_0x3a0a('0x8'));var jayson=require(_0x3a0a('0x9'));var client=jayson[_0x3a0a('0xa')][_0x3a0a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4719d,_0x451873,_0x1766c1){return new BPromise(function(_0x5d98d3,_0x56ee1b){return client[_0x3a0a('0xc')](_0x4719d,_0x1766c1)[_0x3a0a('0xd')](function(_0x29207e){logger[_0x3a0a('0xe')](_0x3a0a('0xf'),_0x451873,_0x3a0a('0x10'));logger[_0x3a0a('0x11')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x451873,'request\x20sent',JSON[_0x3a0a('0x12')](_0x29207e));if(_0x29207e[_0x3a0a('0x13')]){if(_0x29207e['error']['code']===0x1f4){logger[_0x3a0a('0x13')](_0x3a0a('0xf'),_0x451873,_0x29207e['error'][_0x3a0a('0x14')]);return _0x56ee1b(_0x29207e[_0x3a0a('0x13')][_0x3a0a('0x14')]);}logger[_0x3a0a('0x13')](_0x3a0a('0xf'),_0x451873,_0x29207e[_0x3a0a('0x13')][_0x3a0a('0x14')]);return _0x5d98d3(_0x29207e[_0x3a0a('0x13')][_0x3a0a('0x14')]);}else{logger[_0x3a0a('0xe')](_0x3a0a('0xf'),_0x451873,_0x3a0a('0x10'));_0x5d98d3(_0x29207e[_0x3a0a('0x15')][_0x3a0a('0x14')]);}})['catch'](function(_0x41a6b0){logger['error'](_0x3a0a('0xf'),_0x451873,_0x41a6b0);_0x56ee1b(_0x41a6b0);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 1a94d33..238a52a 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0x1261,0x144));var _0x1126=function(_0x3dc587,_0x2ebc6c){_0x3dc587=_0x3dc587-0x0;var _0x29f93a=_0x1261[_0x3dc587];return _0x29f93a;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x59145a,_0x1f60f1){var _0xf04d7=function(_0x247581){while(--_0x247581){_0x59145a['push'](_0x59145a['shift']());}};_0xf04d7(++_0x1f60f1);}(_0x1261,0x144));var _0x1126=function(_0x32b79a,_0xd2538a){_0x32b79a=_0x32b79a-0x0;var _0x483450=_0x1261[_0x32b79a];return _0x483450;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index f76820e..37deb5f 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 _0xcddf=['exports','STRING'];(function(_0x64097d,_0x197979){var _0x1aa48d=function(_0xc9f87e){while(--_0xc9f87e){_0x64097d['push'](_0x64097d['shift']());}};_0x1aa48d(++_0x197979);}(_0xcddf,0x108));var _0xfcdd=function(_0x47aa69,_0x4f3b04){_0x47aa69=_0x47aa69-0x0;var _0xfca80d=_0xcddf[_0x47aa69];return _0xfca80d;};'use strict';var Sequelize=require('sequelize');module[_0xfcdd('0x0')]={'name':{'type':Sequelize[_0xfcdd('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xfcdd('0x1')]},'companyId':{'type':Sequelize[_0xfcdd('0x1')]},'website':{'type':Sequelize[_0xfcdd('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xfcdd('0x1')]},'type':{'type':Sequelize[_0xfcdd('0x1')]},'street':{'type':Sequelize[_0xfcdd('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xfcdd('0x1')]},'country':{'type':Sequelize[_0xfcdd('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xfcdd('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xfcdd('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfcdd('0x1')]}}; \ No newline at end of file +var _0x913c=['name','STRING','exports'];(function(_0x35cf09,_0x5e86eb){var _0x3063f8=function(_0x55187a){while(--_0x55187a){_0x35cf09['push'](_0x35cf09['shift']());}};_0x3063f8(++_0x5e86eb);}(_0x913c,0x1a0));var _0xc913=function(_0x4c1cbc,_0x2219c5){_0x4c1cbc=_0x4c1cbc-0x0;var _0x27dc70=_0x913c[_0x4c1cbc];return _0x27dc70;};'use strict';var Sequelize=require('sequelize');module[_0xc913('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xc913('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xc913('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xc913('0x2')]},'phone':{'type':Sequelize[_0xc913('0x2')]},'fax':{'type':Sequelize[_0xc913('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xc913('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xc913('0x2')]},'country':{'type':Sequelize[_0xc913('0x2')]},'email':{'type':Sequelize[_0xc913('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xc913('0x2')]},'sStreet':{'type':Sequelize[_0xc913('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xc913('0x2')]},'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 604c92f..9832d1a 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 _0x3306=['../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','end','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','where','map','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','omit','getContacts','findOne','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api'];(function(_0x4c451a,_0x42e126){var _0x2776cd=function(_0x276bda){while(--_0x276bda){_0x4c451a['push'](_0x4c451a['shift']());}};_0x2776cd(++_0x42e126);}(_0x3306,0x1e4));var _0x6330=function(_0xfb731d,_0x520080){_0xfb731d=_0xfb731d-0x0;var _0x2d8de5=_0x3306[_0xfb731d];return _0x2d8de5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6330('0x0'));var zipdir=require(_0x6330('0x1'));var jsonpatch=require(_0x6330('0x2'));var rp=require(_0x6330('0x3'));var moment=require(_0x6330('0x4'));var BPromise=require(_0x6330('0x5'));var Mustache=require(_0x6330('0x6'));var util=require(_0x6330('0x7'));var path=require('path');var sox=require(_0x6330('0x8'));var csv=require(_0x6330('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6330('0xa'));var _=require(_0x6330('0xb'));var squel=require(_0x6330('0xc'));var crypto=require('crypto');var jsforce=require(_0x6330('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6330('0x9'));var querystring=require(_0x6330('0xe'));var Papa=require('papaparse');var Redis=require(_0x6330('0xf'));var authService=require(_0x6330('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6330('0x11'));var logger=require(_0x6330('0x12'))(_0x6330('0x13'));var utils=require(_0x6330('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6330('0x15'))['db'];function respondWithStatusCode(_0x125c76,_0x4e83b6){_0x4e83b6=_0x4e83b6||0xcc;return function(_0x435fa1){if(_0x435fa1){return _0x125c76[_0x6330('0x16')](_0x4e83b6);}return _0x125c76['status'](_0x4e83b6)['end']();};}function respondWithResult(_0x3cf10f,_0x4a28e9){_0x4a28e9=_0x4a28e9||0xc8;return function(_0x56f52a){if(_0x56f52a){return _0x3cf10f[_0x6330('0x17')](_0x4a28e9)[_0x6330('0x18')](_0x56f52a);}};}function respondWithFilteredResult(_0x3e6672,_0x1b2c66){return function(_0x4abd9c){if(_0x4abd9c){var _0xe47172=typeof _0x1b2c66[_0x6330('0x19')]===_0x6330('0x1a')&&typeof _0x1b2c66[_0x6330('0x1b')]===_0x6330('0x1a');var _0x4ec1a4=_0x4abd9c[_0x6330('0x1c')];var _0x574dc1=_0xe47172?0x0:_0x1b2c66[_0x6330('0x19')];var _0x72fc7a=_0xe47172?_0x4abd9c['count']:_0x1b2c66[_0x6330('0x19')]+_0x1b2c66['limit'];var _0x2bc188;if(_0x72fc7a>=_0x4ec1a4){_0x72fc7a=_0x4ec1a4;_0x2bc188=0xc8;}else{_0x2bc188=0xce;}_0x3e6672[_0x6330('0x17')](_0x2bc188);return _0x3e6672['set'](_0x6330('0x1d'),_0x574dc1+'-'+_0x72fc7a+'/'+_0x4ec1a4)['json'](_0x4abd9c);}return null;};}function patchUpdates(_0x49dedc){return function(_0x2e95af){try{jsonpatch[_0x6330('0x1e')](_0x2e95af,_0x49dedc,!![]);}catch(_0x4ee798){return BPromise[_0x6330('0x1f')](_0x4ee798);}return _0x2e95af[_0x6330('0x20')]();};}function saveUpdates(_0x7b1613,_0x577c62){return function(_0x115e2b){if(_0x115e2b){return _0x115e2b[_0x6330('0x21')](_0x7b1613)[_0x6330('0x22')](function(_0xd99872){return _0xd99872;});}return null;};}function removeEntity(_0x5ea700,_0x38aade){return function(_0xc2f501){if(_0xc2f501){return _0xc2f501[_0x6330('0x23')]()[_0x6330('0x22')](function(){var _0x15e552=_0xc2f501[_0x6330('0x24')]({'plain':!![]});var _0x430a7b=_0x6330('0x25');return db[_0x6330('0x26')][_0x6330('0x23')]({'where':{'type':_0x430a7b,'resourceId':_0x15e552['id']}})[_0x6330('0x22')](function(){return _0xc2f501;});})[_0x6330('0x22')](function(){_0x5ea700[_0x6330('0x17')](0xcc)[_0x6330('0x27')]();});}};}function handleEntityNotFound(_0x1dda8a,_0x19b4cc){return function(_0x61833e){if(!_0x61833e){_0x1dda8a[_0x6330('0x16')](0x194);}return _0x61833e;};}function handleError(_0xc9e526,_0x39beac){_0x39beac=_0x39beac||0x1f4;return function(_0x207937){logger[_0x6330('0x28')](_0x207937[_0x6330('0x29')]);if(_0x207937[_0x6330('0x2a')]){delete _0x207937['name'];}_0xc9e526[_0x6330('0x17')](_0x39beac)[_0x6330('0x2b')](_0x207937);};}exports[_0x6330('0x2c')]=function(_0x31625c,_0x344737){var _0x279cff={},_0x1b118b={},_0x4044d9={'count':0x0,'rows':[]};return db[_0x6330('0x2d')][_0x6330('0x2e')]()[_0x6330('0x22')](function(_0x3c8706){_0x1b118b[_0x6330('0x2f')]=_[_0x6330('0x30')](_0x3c8706);_0x1b118b[_0x6330('0x31')]=_[_0x6330('0x30')](_0x31625c['query']);_0x1b118b[_0x6330('0x32')]=_['intersection'](_0x1b118b[_0x6330('0x2f')],_0x1b118b[_0x6330('0x31')]);_0x279cff[_0x6330('0x33')]=_[_0x6330('0x34')](_0x1b118b['model'],qs[_0x6330('0x35')](_0x31625c['query']['fields']));_0x279cff[_0x6330('0x33')]=_0x279cff[_0x6330('0x33')][_0x6330('0x36')]?_0x279cff['attributes']:_0x1b118b[_0x6330('0x2f')];if(!_0x31625c['query'][_0x6330('0x37')]('nolimit')){_0x279cff[_0x6330('0x1b')]=qs[_0x6330('0x1b')](_0x31625c[_0x6330('0x31')][_0x6330('0x1b')]);_0x279cff[_0x6330('0x19')]=qs[_0x6330('0x19')](_0x31625c[_0x6330('0x31')][_0x6330('0x19')]);}_0x279cff[_0x6330('0x38')]=qs[_0x6330('0x39')](_0x31625c['query'][_0x6330('0x39')]);_0x279cff['where']=qs[_0x6330('0x32')](_['pick'](_0x31625c[_0x6330('0x31')],_0x1b118b[_0x6330('0x32')]),_0x3c8706);if(_0x31625c[_0x6330('0x31')][_0x6330('0x3a')]){_0x279cff[_0x6330('0x3b')]=_['merge'](_0x279cff['where'],{'$or':_[_0x6330('0x3c')](_0x279cff[_0x6330('0x33')],function(_0x746b49){var _0x340490={};_0x340490[_0x746b49]={'$like':'%'+_0x31625c[_0x6330('0x31')][_0x6330('0x3a')]+'%'};return _0x340490;})});}_0x279cff=_[_0x6330('0x3d')]({},_0x279cff,_0x31625c[_0x6330('0x3e')]);var _0x438611={'where':_0x279cff[_0x6330('0x3b')]};return db['CmCompany'][_0x6330('0x1c')](_0x438611)[_0x6330('0x22')](function(_0x1c708c){_0x4044d9[_0x6330('0x1c')]=_0x1c708c;if(_0x31625c[_0x6330('0x31')]['includeAll']){_0x279cff[_0x6330('0x3f')]=[{'all':!![]}];}return db[_0x6330('0x2d')][_0x6330('0x40')](_0x279cff);})[_0x6330('0x22')](function(_0x2f392a){_0x4044d9[_0x6330('0x41')]=_0x2f392a;return _0x4044d9;})['then'](respondWithFilteredResult(_0x344737,_0x279cff))['catch'](handleError(_0x344737,null));})[_0x6330('0x42')](handleError(_0x344737,null));};exports[_0x6330('0x43')]=function(_0x261e22,_0x2f3726){var _0x910e87={'raw':![],'where':{'id':_0x261e22[_0x6330('0x44')]['id']}},_0x366622={};_0x366622[_0x6330('0x2f')]=_[_0x6330('0x30')](db['CmCompany'][_0x6330('0x45')]);_0x366622[_0x6330('0x31')]=_[_0x6330('0x30')](_0x261e22['query']);_0x366622[_0x6330('0x32')]=_[_0x6330('0x34')](_0x366622[_0x6330('0x2f')],_0x366622[_0x6330('0x31')]);_0x910e87[_0x6330('0x33')]=_[_0x6330('0x34')](_0x366622[_0x6330('0x2f')],qs[_0x6330('0x35')](_0x261e22[_0x6330('0x31')][_0x6330('0x35')]));_0x910e87[_0x6330('0x33')]=_0x910e87[_0x6330('0x33')][_0x6330('0x36')]?_0x910e87[_0x6330('0x33')]:_0x366622[_0x6330('0x2f')];if(_0x261e22[_0x6330('0x31')][_0x6330('0x46')]){_0x910e87[_0x6330('0x3f')]=[{'all':!![]}];}_0x910e87=_['merge']({},_0x910e87,_0x261e22['options']);return db[_0x6330('0x2d')][_0x6330('0x47')](_0x910e87)[_0x6330('0x22')](handleEntityNotFound(_0x2f3726,null))['then'](respondWithResult(_0x2f3726,null))[_0x6330('0x42')](handleError(_0x2f3726,null));};exports['create']=function(_0x2ce8ff,_0x4b0dd6){return db[_0x6330('0x2d')][_0x6330('0x48')](_0x2ce8ff[_0x6330('0x49')],{})[_0x6330('0x22')](function(_0x15c0f4){var _0x441559=_0x2ce8ff[_0x6330('0x4a')][_0x6330('0x24')]({'plain':!![]});if(!_0x441559)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x441559['role']===_0x6330('0x4a')){var _0x484b66=_0x15c0f4[_0x6330('0x24')]({'plain':!![]});var _0x53754d=_0x6330('0x25');return db[_0x6330('0x4b')][_0x6330('0x47')]({'where':{'name':_0x53754d,'userProfileId':_0x441559['userProfileId']},'raw':!![]})[_0x6330('0x22')](function(_0x2d62a2){if(_0x2d62a2&&_0x2d62a2[_0x6330('0x4c')]===0x0){return db[_0x6330('0x26')][_0x6330('0x48')]({'name':_0x484b66[_0x6330('0x2a')],'resourceId':_0x484b66['id'],'type':_0x2d62a2[_0x6330('0x2a')],'sectionId':_0x2d62a2['id']},{})[_0x6330('0x22')](function(){return _0x15c0f4;});}else{return _0x15c0f4;}})[_0x6330('0x42')](function(_0x4a6bc1){logger[_0x6330('0x28')](_0x6330('0x4d'),_0x4a6bc1);throw _0x4a6bc1;});}return _0x15c0f4;})['then'](respondWithResult(_0x4b0dd6,0xc9))[_0x6330('0x42')](handleError(_0x4b0dd6,null));};exports['update']=function(_0x1cb0fa,_0x3db6df){if(_0x1cb0fa[_0x6330('0x49')]['id']){delete _0x1cb0fa['body']['id'];}return db[_0x6330('0x2d')]['find']({'where':{'id':_0x1cb0fa['params']['id']}})[_0x6330('0x22')](handleEntityNotFound(_0x3db6df,null))[_0x6330('0x22')](saveUpdates(_0x1cb0fa[_0x6330('0x49')],null))['then'](respondWithResult(_0x3db6df,null))['catch'](handleError(_0x3db6df,null));};exports[_0x6330('0x23')]=function(_0x121ace,_0x2d5b4a){return db[_0x6330('0x2d')][_0x6330('0x47')]({'where':{'id':_0x121ace[_0x6330('0x44')]['id']}})['then'](handleEntityNotFound(_0x2d5b4a,null))[_0x6330('0x22')](removeEntity(_0x2d5b4a,null))[_0x6330('0x42')](handleError(_0x2d5b4a,null));};exports[_0x6330('0x2e')]=function(_0x5dc3b2,_0x5185b7){return db[_0x6330('0x2d')]['describe']()['then'](respondWithResult(_0x5185b7,null))[_0x6330('0x42')](handleError(_0x5185b7,null));};exports[_0x6330('0x4e')]=function(_0x76302a,_0x398198,_0x34cbe0){return db[_0x6330('0x4f')][_0x6330('0x47')]({'where':{'id':_0x76302a['params']['id']}})[_0x6330('0x22')](handleEntityNotFound(_0x398198,null))[_0x6330('0x22')](function(_0x1363f6){if(_0x1363f6){return _0x1363f6[_0x6330('0x4e')](_0x76302a[_0x6330('0x49')]['ids'],_[_0x6330('0x50')](_0x76302a[_0x6330('0x49')],['ids','id'])||{});}})['then'](respondWithResult(_0x398198,null))[_0x6330('0x42')](handleError(_0x398198,null));};exports[_0x6330('0x51')]=function(_0x168fd2,_0x3d0e2b,_0x314924){var _0xcfb644={};var _0x526a18={};var _0x1b8135;var _0x4c9e8e;return db['CmCompany'][_0x6330('0x52')]({'where':{'id':_0x168fd2[_0x6330('0x44')]['id']}})[_0x6330('0x22')](handleEntityNotFound(_0x3d0e2b,null))['then'](function(_0x2f92af){if(_0x2f92af){_0x1b8135=_0x2f92af;_0x526a18[_0x6330('0x2f')]=_['keys'](db[_0x6330('0x4f')][_0x6330('0x45')]);_0x526a18[_0x6330('0x31')]=_[_0x6330('0x30')](_0x168fd2['query']);_0x526a18[_0x6330('0x32')]=_[_0x6330('0x34')](_0x526a18[_0x6330('0x2f')],_0x526a18[_0x6330('0x31')]);_0xcfb644[_0x6330('0x33')]=_[_0x6330('0x34')](_0x526a18['model'],qs[_0x6330('0x35')](_0x168fd2[_0x6330('0x31')]['fields']));_0xcfb644['attributes']=_0xcfb644[_0x6330('0x33')][_0x6330('0x36')]?_0xcfb644['attributes']:_0x526a18[_0x6330('0x2f')];_0xcfb644[_0x6330('0x38')]=qs[_0x6330('0x39')](_0x168fd2[_0x6330('0x31')][_0x6330('0x39')]);_0xcfb644['where']=qs[_0x6330('0x32')](_['pick'](_0x168fd2[_0x6330('0x31')],_0x526a18[_0x6330('0x32')]));if(_0x168fd2[_0x6330('0x31')]['filter']){_0xcfb644[_0x6330('0x3b')]=_['merge'](_0xcfb644[_0x6330('0x3b')],{'$or':_['map'](_0xcfb644[_0x6330('0x33')],function(_0xf03952){var _0x499348={};_0x499348[_0xf03952]={'$like':'%'+_0x168fd2['query'][_0x6330('0x3a')]+'%'};return _0x499348;})});}_0xcfb644=_['merge']({},_0xcfb644,_0x168fd2['options']);return _0x1b8135[_0x6330('0x51')](_0xcfb644);}})['then'](function(_0x3b77b8){if(_0x3b77b8){_0x4c9e8e=_0x3b77b8[_0x6330('0x36')];if(!_0x168fd2[_0x6330('0x31')][_0x6330('0x37')](_0x6330('0x53'))){_0xcfb644[_0x6330('0x1b')]=qs['limit'](_0x168fd2[_0x6330('0x31')][_0x6330('0x1b')]);_0xcfb644[_0x6330('0x19')]=qs['offset'](_0x168fd2[_0x6330('0x31')][_0x6330('0x19')]);}return _0x1b8135[_0x6330('0x51')](_0xcfb644);}})['then'](function(_0x515ec6){if(_0x515ec6){return _0x515ec6?{'count':_0x4c9e8e,'rows':_0x515ec6}:null;}})[_0x6330('0x22')](respondWithResult(_0x3d0e2b,null))[_0x6330('0x42')](handleError(_0x3d0e2b,null));}; \ No newline at end of file +var _0xccb9=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','Companies','UserProfileResource','end','error','name','send','index','CmCompany','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','findAll','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x2e6dc4,_0x502af5){var _0x3889cb=function(_0x5926cf){while(--_0x5926cf){_0x2e6dc4['push'](_0x2e6dc4['shift']());}};_0x3889cb(++_0x502af5);}(_0xccb9,0x1f0));var _0x9ccb=function(_0x5e6cb8,_0x16cf56){_0x5e6cb8=_0x5e6cb8-0x0;var _0x3faeb3=_0xccb9[_0x5e6cb8];return _0x3faeb3;};'use strict';var emlformat=require(_0x9ccb('0x0'));var rimraf=require(_0x9ccb('0x1'));var zipdir=require(_0x9ccb('0x2'));var jsonpatch=require(_0x9ccb('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9ccb('0x4'));var Mustache=require(_0x9ccb('0x5'));var util=require(_0x9ccb('0x6'));var path=require(_0x9ccb('0x7'));var sox=require(_0x9ccb('0x8'));var csv=require('to-csv');var ejs=require(_0x9ccb('0x9'));var fs=require('fs');var fs_extra=require(_0x9ccb('0xa'));var _=require(_0x9ccb('0xb'));var squel=require(_0x9ccb('0xc'));var crypto=require(_0x9ccb('0xd'));var jsforce=require(_0x9ccb('0xe'));var deskjs=require(_0x9ccb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9ccb('0x10'));var Papa=require(_0x9ccb('0x11'));var Redis=require(_0x9ccb('0x12'));var authService=require(_0x9ccb('0x13'));var qs=require(_0x9ccb('0x14'));var as=require(_0x9ccb('0x15'));var hardwareService=require(_0x9ccb('0x16'));var logger=require('../../config/logger')(_0x9ccb('0x17'));var utils=require('../../config/utils');var config=require(_0x9ccb('0x18'));var licenseUtil=require(_0x9ccb('0x19'));var db=require(_0x9ccb('0x1a'))['db'];function respondWithStatusCode(_0x3110ed,_0x1ddef9){_0x1ddef9=_0x1ddef9||0xcc;return function(_0x206a01){if(_0x206a01){return _0x3110ed[_0x9ccb('0x1b')](_0x1ddef9);}return _0x3110ed[_0x9ccb('0x1c')](_0x1ddef9)['end']();};}function respondWithResult(_0x585751,_0x3317dd){_0x3317dd=_0x3317dd||0xc8;return function(_0x2e73cb){if(_0x2e73cb){return _0x585751[_0x9ccb('0x1c')](_0x3317dd)['json'](_0x2e73cb);}};}function respondWithFilteredResult(_0x5aa0f5,_0x218acc){return function(_0x4d03e4){if(_0x4d03e4){var _0xc39172=typeof _0x218acc[_0x9ccb('0x1d')]===_0x9ccb('0x1e')&&typeof _0x218acc[_0x9ccb('0x1f')]===_0x9ccb('0x1e');var _0x8c55b0=_0x4d03e4['count'];var _0x1f65e0=_0xc39172?0x0:_0x218acc[_0x9ccb('0x1d')];var _0x7d49c7=_0xc39172?_0x4d03e4[_0x9ccb('0x20')]:_0x218acc[_0x9ccb('0x1d')]+_0x218acc[_0x9ccb('0x1f')];var _0x577bc2;if(_0x7d49c7>=_0x8c55b0){_0x7d49c7=_0x8c55b0;_0x577bc2=0xc8;}else{_0x577bc2=0xce;}_0x5aa0f5[_0x9ccb('0x1c')](_0x577bc2);return _0x5aa0f5[_0x9ccb('0x21')]('Content-Range',_0x1f65e0+'-'+_0x7d49c7+'/'+_0x8c55b0)['json'](_0x4d03e4);}return null;};}function patchUpdates(_0x579d58){return function(_0x25bfda){try{jsonpatch[_0x9ccb('0x22')](_0x25bfda,_0x579d58,!![]);}catch(_0x1468c8){return BPromise['reject'](_0x1468c8);}return _0x25bfda[_0x9ccb('0x23')]();};}function saveUpdates(_0xdee7f6,_0x278579){return function(_0x5cd3b1){if(_0x5cd3b1){return _0x5cd3b1[_0x9ccb('0x24')](_0xdee7f6)[_0x9ccb('0x25')](function(_0x11db26){return _0x11db26;});}return null;};}function removeEntity(_0x31bbc6,_0x51d89a){return function(_0x46929e){if(_0x46929e){return _0x46929e[_0x9ccb('0x26')]()['then'](function(){var _0x47ae1a=_0x46929e[_0x9ccb('0x27')]({'plain':!![]});var _0x4146c3=_0x9ccb('0x28');return db[_0x9ccb('0x29')][_0x9ccb('0x26')]({'where':{'type':_0x4146c3,'resourceId':_0x47ae1a['id']}})['then'](function(){return _0x46929e;});})[_0x9ccb('0x25')](function(){_0x31bbc6[_0x9ccb('0x1c')](0xcc)[_0x9ccb('0x2a')]();});}};}function handleEntityNotFound(_0x164858,_0x374e64){return function(_0x444580){if(!_0x444580){_0x164858[_0x9ccb('0x1b')](0x194);}return _0x444580;};}function handleError(_0x1311c7,_0x1adc61){_0x1adc61=_0x1adc61||0x1f4;return function(_0x6e8d7d){logger[_0x9ccb('0x2b')](_0x6e8d7d['stack']);if(_0x6e8d7d[_0x9ccb('0x2c')]){delete _0x6e8d7d[_0x9ccb('0x2c')];}_0x1311c7[_0x9ccb('0x1c')](_0x1adc61)[_0x9ccb('0x2d')](_0x6e8d7d);};}exports[_0x9ccb('0x2e')]=function(_0x18fa5b,_0x46bcf4){var _0x1040d7={},_0x2b9ac9={},_0x26a9c5={'count':0x0,'rows':[]};return db[_0x9ccb('0x2f')]['describe']()[_0x9ccb('0x25')](function(_0x30494a){_0x2b9ac9[_0x9ccb('0x30')]=_[_0x9ccb('0x31')](_0x30494a);_0x2b9ac9[_0x9ccb('0x32')]=_['keys'](_0x18fa5b[_0x9ccb('0x32')]);_0x2b9ac9[_0x9ccb('0x33')]=_['intersection'](_0x2b9ac9[_0x9ccb('0x30')],_0x2b9ac9['query']);_0x1040d7['attributes']=_[_0x9ccb('0x34')](_0x2b9ac9[_0x9ccb('0x30')],qs['fields'](_0x18fa5b['query'][_0x9ccb('0x35')]));_0x1040d7[_0x9ccb('0x36')]=_0x1040d7[_0x9ccb('0x36')][_0x9ccb('0x37')]?_0x1040d7[_0x9ccb('0x36')]:_0x2b9ac9['model'];if(!_0x18fa5b[_0x9ccb('0x32')][_0x9ccb('0x38')](_0x9ccb('0x39'))){_0x1040d7[_0x9ccb('0x1f')]=qs[_0x9ccb('0x1f')](_0x18fa5b['query']['limit']);_0x1040d7[_0x9ccb('0x1d')]=qs['offset'](_0x18fa5b['query'][_0x9ccb('0x1d')]);}_0x1040d7[_0x9ccb('0x3a')]=qs[_0x9ccb('0x3b')](_0x18fa5b[_0x9ccb('0x32')][_0x9ccb('0x3b')]);_0x1040d7[_0x9ccb('0x3c')]=qs[_0x9ccb('0x33')](_[_0x9ccb('0x3d')](_0x18fa5b[_0x9ccb('0x32')],_0x2b9ac9[_0x9ccb('0x33')]),_0x30494a);if(_0x18fa5b[_0x9ccb('0x32')][_0x9ccb('0x3e')]){_0x1040d7['where']=_[_0x9ccb('0x3f')](_0x1040d7[_0x9ccb('0x3c')],{'$or':_[_0x9ccb('0x40')](_0x1040d7[_0x9ccb('0x36')],function(_0x494b5b){var _0xcfe3cf={};_0xcfe3cf[_0x494b5b]={'$like':'%'+_0x18fa5b[_0x9ccb('0x32')][_0x9ccb('0x3e')]+'%'};return _0xcfe3cf;})});}_0x1040d7=_[_0x9ccb('0x3f')]({},_0x1040d7,_0x18fa5b[_0x9ccb('0x41')]);var _0x1c538a={'where':_0x1040d7[_0x9ccb('0x3c')]};return db[_0x9ccb('0x2f')][_0x9ccb('0x20')](_0x1c538a)[_0x9ccb('0x25')](function(_0x2f3979){_0x26a9c5[_0x9ccb('0x20')]=_0x2f3979;if(_0x18fa5b['query'][_0x9ccb('0x42')]){_0x1040d7['include']=[{'all':!![]}];}return db[_0x9ccb('0x2f')][_0x9ccb('0x43')](_0x1040d7);})['then'](function(_0x49a5eb){_0x26a9c5['rows']=_0x49a5eb;return _0x26a9c5;})[_0x9ccb('0x25')](respondWithFilteredResult(_0x46bcf4,_0x1040d7))[_0x9ccb('0x44')](handleError(_0x46bcf4,null));})[_0x9ccb('0x44')](handleError(_0x46bcf4,null));};exports[_0x9ccb('0x45')]=function(_0x1beb59,_0x441a7b){var _0x24ce66={'raw':![],'where':{'id':_0x1beb59[_0x9ccb('0x46')]['id']}},_0x5e4fbb={};_0x5e4fbb['model']=_[_0x9ccb('0x31')](db[_0x9ccb('0x2f')][_0x9ccb('0x47')]);_0x5e4fbb[_0x9ccb('0x32')]=_[_0x9ccb('0x31')](_0x1beb59[_0x9ccb('0x32')]);_0x5e4fbb[_0x9ccb('0x33')]=_[_0x9ccb('0x34')](_0x5e4fbb[_0x9ccb('0x30')],_0x5e4fbb[_0x9ccb('0x32')]);_0x24ce66['attributes']=_[_0x9ccb('0x34')](_0x5e4fbb[_0x9ccb('0x30')],qs['fields'](_0x1beb59[_0x9ccb('0x32')][_0x9ccb('0x35')]));_0x24ce66[_0x9ccb('0x36')]=_0x24ce66[_0x9ccb('0x36')][_0x9ccb('0x37')]?_0x24ce66['attributes']:_0x5e4fbb[_0x9ccb('0x30')];if(_0x1beb59[_0x9ccb('0x32')][_0x9ccb('0x42')]){_0x24ce66['include']=[{'all':!![]}];}_0x24ce66=_['merge']({},_0x24ce66,_0x1beb59['options']);return db[_0x9ccb('0x2f')][_0x9ccb('0x48')](_0x24ce66)[_0x9ccb('0x25')](handleEntityNotFound(_0x441a7b,null))['then'](respondWithResult(_0x441a7b,null))[_0x9ccb('0x44')](handleError(_0x441a7b,null));};exports[_0x9ccb('0x49')]=function(_0x37438a,_0x402358){return db['CmCompany']['create'](_0x37438a[_0x9ccb('0x4a')],{})['then'](function(_0x5537bc){var _0x244b6a=_0x37438a[_0x9ccb('0x4b')][_0x9ccb('0x27')]({'plain':!![]});if(!_0x244b6a)throw new Error(_0x9ccb('0x4c'));if(_0x244b6a[_0x9ccb('0x4d')]===_0x9ccb('0x4b')){var _0x5e1e22=_0x5537bc[_0x9ccb('0x27')]({'plain':!![]});var _0x117475=_0x9ccb('0x28');return db[_0x9ccb('0x4e')][_0x9ccb('0x48')]({'where':{'name':_0x117475,'userProfileId':_0x244b6a[_0x9ccb('0x4f')]},'raw':!![]})['then'](function(_0x24e0ce){if(_0x24e0ce&&_0x24e0ce['autoAssociation']===0x0){return db[_0x9ccb('0x29')][_0x9ccb('0x49')]({'name':_0x5e1e22[_0x9ccb('0x2c')],'resourceId':_0x5e1e22['id'],'type':_0x24e0ce[_0x9ccb('0x2c')],'sectionId':_0x24e0ce['id']},{})[_0x9ccb('0x25')](function(){return _0x5537bc;});}else{return _0x5537bc;}})[_0x9ccb('0x44')](function(_0x442041){logger['error'](_0x9ccb('0x50'),_0x442041);throw _0x442041;});}return _0x5537bc;})[_0x9ccb('0x25')](respondWithResult(_0x402358,0xc9))['catch'](handleError(_0x402358,null));};exports['update']=function(_0x2be60d,_0x3a6348){if(_0x2be60d[_0x9ccb('0x4a')]['id']){delete _0x2be60d[_0x9ccb('0x4a')]['id'];}return db[_0x9ccb('0x2f')][_0x9ccb('0x48')]({'where':{'id':_0x2be60d[_0x9ccb('0x46')]['id']}})[_0x9ccb('0x25')](handleEntityNotFound(_0x3a6348,null))['then'](saveUpdates(_0x2be60d[_0x9ccb('0x4a')],null))[_0x9ccb('0x25')](respondWithResult(_0x3a6348,null))[_0x9ccb('0x44')](handleError(_0x3a6348,null));};exports[_0x9ccb('0x26')]=function(_0x2d09ef,_0x5032c0){return db[_0x9ccb('0x2f')]['find']({'where':{'id':_0x2d09ef['params']['id']}})['then'](handleEntityNotFound(_0x5032c0,null))[_0x9ccb('0x25')](removeEntity(_0x5032c0,null))['catch'](handleError(_0x5032c0,null));};exports['describe']=function(_0x2719ed,_0x132b28){return db[_0x9ccb('0x2f')]['describe']()[_0x9ccb('0x25')](respondWithResult(_0x132b28,null))[_0x9ccb('0x44')](handleError(_0x132b28,null));};exports[_0x9ccb('0x51')]=function(_0x186ad5,_0x394965,_0x2d69bc){return db[_0x9ccb('0x52')]['find']({'where':{'id':_0x186ad5['params']['id']}})['then'](handleEntityNotFound(_0x394965,null))[_0x9ccb('0x25')](function(_0x1b1a28){if(_0x1b1a28){return _0x1b1a28[_0x9ccb('0x51')](_0x186ad5[_0x9ccb('0x4a')][_0x9ccb('0x53')],_[_0x9ccb('0x54')](_0x186ad5[_0x9ccb('0x4a')],['ids','id'])||{});}})[_0x9ccb('0x25')](respondWithResult(_0x394965,null))[_0x9ccb('0x44')](handleError(_0x394965,null));};exports['getContacts']=function(_0x4cfe75,_0x32d0b3,_0x2d30f6){var _0x7a5c53={};var _0x5619a4={};var _0x427b8c;var _0x1dfe1a;return db[_0x9ccb('0x2f')]['findOne']({'where':{'id':_0x4cfe75[_0x9ccb('0x46')]['id']}})[_0x9ccb('0x25')](handleEntityNotFound(_0x32d0b3,null))[_0x9ccb('0x25')](function(_0x27df7d){if(_0x27df7d){_0x427b8c=_0x27df7d;_0x5619a4['model']=_[_0x9ccb('0x31')](db[_0x9ccb('0x52')][_0x9ccb('0x47')]);_0x5619a4['query']=_[_0x9ccb('0x31')](_0x4cfe75['query']);_0x5619a4['filters']=_[_0x9ccb('0x34')](_0x5619a4[_0x9ccb('0x30')],_0x5619a4[_0x9ccb('0x32')]);_0x7a5c53[_0x9ccb('0x36')]=_[_0x9ccb('0x34')](_0x5619a4[_0x9ccb('0x30')],qs['fields'](_0x4cfe75['query'][_0x9ccb('0x35')]));_0x7a5c53['attributes']=_0x7a5c53[_0x9ccb('0x36')][_0x9ccb('0x37')]?_0x7a5c53[_0x9ccb('0x36')]:_0x5619a4[_0x9ccb('0x30')];_0x7a5c53[_0x9ccb('0x3a')]=qs[_0x9ccb('0x3b')](_0x4cfe75[_0x9ccb('0x32')][_0x9ccb('0x3b')]);_0x7a5c53['where']=qs['filters'](_['pick'](_0x4cfe75[_0x9ccb('0x32')],_0x5619a4[_0x9ccb('0x33')]));if(_0x4cfe75[_0x9ccb('0x32')][_0x9ccb('0x3e')]){_0x7a5c53[_0x9ccb('0x3c')]=_[_0x9ccb('0x3f')](_0x7a5c53[_0x9ccb('0x3c')],{'$or':_[_0x9ccb('0x40')](_0x7a5c53['attributes'],function(_0x260c3e){var _0x46969b={};_0x46969b[_0x260c3e]={'$like':'%'+_0x4cfe75[_0x9ccb('0x32')][_0x9ccb('0x3e')]+'%'};return _0x46969b;})});}_0x7a5c53=_[_0x9ccb('0x3f')]({},_0x7a5c53,_0x4cfe75[_0x9ccb('0x41')]);return _0x427b8c[_0x9ccb('0x55')](_0x7a5c53);}})[_0x9ccb('0x25')](function(_0x1be4f1){if(_0x1be4f1){_0x1dfe1a=_0x1be4f1['length'];if(!_0x4cfe75[_0x9ccb('0x32')][_0x9ccb('0x38')]('nolimit')){_0x7a5c53[_0x9ccb('0x1f')]=qs['limit'](_0x4cfe75[_0x9ccb('0x32')]['limit']);_0x7a5c53['offset']=qs['offset'](_0x4cfe75[_0x9ccb('0x32')]['offset']);}return _0x427b8c[_0x9ccb('0x55')](_0x7a5c53);}})[_0x9ccb('0x25')](function(_0x3cee1d){if(_0x3cee1d){return _0x3cee1d?{'count':_0x1dfe1a,'rows':_0x3cee1d}:null;}})['then'](respondWithResult(_0x32d0b3,null))[_0x9ccb('0x44')](handleError(_0x32d0b3,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index c0d4b7d..dc22c22 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 _0x1d40=['../../config/environment','exports','cm_companies','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x33ecd3,_0x2e038e){var _0x201c3f=function(_0x18f06d){while(--_0x18f06d){_0x33ecd3['push'](_0x33ecd3['shift']());}};_0x201c3f(++_0x2e038e);}(_0x1d40,0x1e0));var _0x01d4=function(_0x28214d,_0x52a84c){_0x28214d=_0x28214d-0x0;var _0xd38211=_0x1d40[_0x28214d];return _0xd38211;};'use strict';var _=require('lodash');var util=require(_0x01d4('0x0'));var logger=require(_0x01d4('0x1'))('api');var moment=require(_0x01d4('0x2'));var BPromise=require('bluebird');var rp=require(_0x01d4('0x3'));var fs=require('fs');var path=require(_0x01d4('0x4'));var rimraf=require(_0x01d4('0x5'));var config=require(_0x01d4('0x6'));var attributes=require('./cmCompany.attributes');module[_0x01d4('0x7')]=function(_0x1b80b8,_0x59f139){return _0x1b80b8['define']('CmCompany',attributes,{'tableName':_0x01d4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf769=['exports','define','CmCompany','util','api','bluebird','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x10f5e9,_0x68f062){var _0x552cc1=function(_0x35da1e){while(--_0x35da1e){_0x10f5e9['push'](_0x10f5e9['shift']());}};_0x552cc1(++_0x68f062);}(_0xf769,0x147));var _0x9f76=function(_0xe0b81f,_0x1fb734){_0xe0b81f=_0xe0b81f-0x0;var _0x290e5e=_0xf769[_0xe0b81f];return _0x290e5e;};'use strict';var _=require('lodash');var util=require(_0x9f76('0x0'));var logger=require('../../config/logger')(_0x9f76('0x1'));var moment=require('moment');var BPromise=require(_0x9f76('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9f76('0x3'));var config=require(_0x9f76('0x4'));var attributes=require(_0x9f76('0x5'));module[_0x9f76('0x6')]=function(_0x3c3e8f,_0x38f8c6){return _0x3c3e8f[_0x9f76('0x7')](_0x9f76('0x8'),attributes,{'tableName':'cm_companies','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 13284f4..d1bc846 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 _0x4580=['request\x20sent','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','CmCompany,\x20%s,\x20%s','message'];(function(_0x12b8ec,_0x1655be){var _0x21af77=function(_0xe59f){while(--_0xe59f){_0x12b8ec['push'](_0x12b8ec['shift']());}};_0x21af77(++_0x1655be);}(_0x4580,0x136));var _0x0458=function(_0x8b6b09,_0x3f17e0){_0x8b6b09=_0x8b6b09-0x0;var _0x27d8c8=_0x4580[_0x8b6b09];return _0x27d8c8;};'use strict';var _=require(_0x0458('0x0'));var util=require(_0x0458('0x1'));var moment=require(_0x0458('0x2'));var BPromise=require('bluebird');var rs=require(_0x0458('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0458('0x4'))['db'];var utils=require(_0x0458('0x5'));var logger=require(_0x0458('0x6'))(_0x0458('0x7'));var config=require(_0x0458('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0458('0x9')][_0x0458('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a0a93,_0xba8d06,_0x369e74){return new BPromise(function(_0x116d0f,_0x4c2b7b){return client[_0x0458('0xb')](_0x5a0a93,_0x369e74)[_0x0458('0xc')](function(_0x315e01){logger[_0x0458('0xd')]('CmCompany,\x20%s,\x20%s',_0xba8d06,'request\x20sent');logger[_0x0458('0xe')](_0x0458('0xf'),_0xba8d06,'request\x20sent',JSON[_0x0458('0x10')](_0x315e01));if(_0x315e01[_0x0458('0x11')]){if(_0x315e01['error']['code']===0x1f4){logger[_0x0458('0x11')](_0x0458('0x12'),_0xba8d06,_0x315e01[_0x0458('0x11')][_0x0458('0x13')]);return _0x4c2b7b(_0x315e01[_0x0458('0x11')][_0x0458('0x13')]);}logger[_0x0458('0x11')](_0x0458('0x12'),_0xba8d06,_0x315e01['error'][_0x0458('0x13')]);return _0x116d0f(_0x315e01['error'][_0x0458('0x13')]);}else{logger[_0x0458('0xd')](_0x0458('0x12'),_0xba8d06,_0x0458('0x14'));_0x116d0f(_0x315e01[_0x0458('0x15')]['message']);}})['catch'](function(_0xc4706c){logger[_0x0458('0x11')](_0x0458('0x12'),_0xba8d06,_0xc4706c);_0x4c2b7b(_0xc4706c);});});} \ No newline at end of file +var _0xcd31=['stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s'];(function(_0x562c98,_0x59211c){var _0x43f4c6=function(_0xc27258){while(--_0xc27258){_0x562c98['push'](_0x562c98['shift']());}};_0x43f4c6(++_0x59211c);}(_0xcd31,0x119));var _0x1cd3=function(_0x4e1a60,_0x233ed1){_0x4e1a60=_0x4e1a60-0x0;var _0x19277a=_0xcd31[_0x4e1a60];return _0x19277a;};'use strict';var _=require('lodash');var util=require(_0x1cd3('0x0'));var moment=require(_0x1cd3('0x1'));var BPromise=require(_0x1cd3('0x2'));var rs=require(_0x1cd3('0x3'));var fs=require('fs');var Redis=require(_0x1cd3('0x4'));var db=require(_0x1cd3('0x5'))['db'];var utils=require(_0x1cd3('0x6'));var logger=require(_0x1cd3('0x7'))(_0x1cd3('0x8'));var config=require('../../config/environment');var jayson=require(_0x1cd3('0x9'));var client=jayson[_0x1cd3('0xa')][_0x1cd3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2035d1,_0x59a5ae,_0x5e12bb){return new BPromise(function(_0xb40452,_0x2ee4a7){return client[_0x1cd3('0xc')](_0x2035d1,_0x5e12bb)['then'](function(_0x3f993c){logger[_0x1cd3('0xd')](_0x1cd3('0xe'),_0x59a5ae,_0x1cd3('0xf'));logger[_0x1cd3('0x10')](_0x1cd3('0x11'),_0x59a5ae,'request\x20sent',JSON[_0x1cd3('0x12')](_0x3f993c));if(_0x3f993c[_0x1cd3('0x13')]){if(_0x3f993c[_0x1cd3('0x13')][_0x1cd3('0x14')]===0x1f4){logger[_0x1cd3('0x13')]('CmCompany,\x20%s,\x20%s',_0x59a5ae,_0x3f993c['error']['message']);return _0x2ee4a7(_0x3f993c[_0x1cd3('0x13')][_0x1cd3('0x15')]);}logger[_0x1cd3('0x13')](_0x1cd3('0xe'),_0x59a5ae,_0x3f993c[_0x1cd3('0x13')][_0x1cd3('0x15')]);return _0xb40452(_0x3f993c['error'][_0x1cd3('0x15')]);}else{logger[_0x1cd3('0xd')](_0x1cd3('0xe'),_0x59a5ae,_0x1cd3('0xf'));_0xb40452(_0x3f993c[_0x1cd3('0x16')][_0x1cd3('0x15')]);}})['catch'](function(_0x5d0a37){logger[_0x1cd3('0x13')](_0x1cd3('0xe'),_0x59a5ae,_0x5d0a37);_0x2ee4a7(_0x5d0a37);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 1d9eafe..4220072 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 _0xdfbe=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/describe','isAuthenticated','describe','show','getContacts','post','addContacts','/:id','delete','destroy','exports'];(function(_0x388493,_0x23301e){var _0x5300a1=function(_0x1d9c91){while(--_0x1d9c91){_0x388493['push'](_0x388493['shift']());}};_0x5300a1(++_0x23301e);}(_0xdfbe,0xb0));var _0xedfb=function(_0x14f552,_0x385ce3){_0x14f552=_0x14f552-0x0;var _0x549e86=_0xdfbe[_0x14f552];return _0x549e86;};'use strict';var multer=require(_0xedfb('0x0'));var util=require(_0xedfb('0x1'));var path=require(_0xedfb('0x2'));var timeout=require(_0xedfb('0x3'));var express=require('express');var router=express[_0xedfb('0x4')]();var fs_extra=require(_0xedfb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xedfb('0x6'));var config=require(_0xedfb('0x7'));var controller=require(_0xedfb('0x8'));router[_0xedfb('0x9')]('/',auth['isAuthenticated'](),controller[_0xedfb('0xa')]);router['get'](_0xedfb('0xb'),auth[_0xedfb('0xc')](),controller[_0xedfb('0xd')]);router[_0xedfb('0x9')]('/:id',auth[_0xedfb('0xc')](),controller[_0xedfb('0xe')]);router[_0xedfb('0x9')]('/:id/contacts',auth[_0xedfb('0xc')](),controller[_0xedfb('0xf')]);router['post']('/',auth[_0xedfb('0xc')](),controller['create']);router[_0xedfb('0x10')]('/:id/contacts',auth[_0xedfb('0xc')](),controller[_0xedfb('0x11')]);router['put'](_0xedfb('0x12'),auth[_0xedfb('0xc')](),controller['update']);router[_0xedfb('0x13')](_0xedfb('0x12'),auth[_0xedfb('0xc')](),controller[_0xedfb('0x14')]);module[_0xedfb('0x15')]=router; \ No newline at end of file +var _0xd38e=['getContacts','post','create','put','update','delete','/:id','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','get','describe','show','/:id/contacts'];(function(_0x2ba701,_0x7da377){var _0x5a4dd1=function(_0x1457ca){while(--_0x1457ca){_0x2ba701['push'](_0x2ba701['shift']());}};_0x5a4dd1(++_0x7da377);}(_0xd38e,0x17d));var _0xed38=function(_0x4ae1fe,_0x54d08e){_0x4ae1fe=_0x4ae1fe-0x0;var _0x2a45e9=_0xd38e[_0x4ae1fe];return _0x2a45e9;};'use strict';var multer=require(_0xed38('0x0'));var util=require('util');var path=require(_0xed38('0x1'));var timeout=require(_0xed38('0x2'));var express=require(_0xed38('0x3'));var router=express[_0xed38('0x4')]();var fs_extra=require(_0xed38('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xed38('0x6'));var config=require(_0xed38('0x7'));var controller=require(_0xed38('0x8'));router['get']('/',auth[_0xed38('0x9')](),controller[_0xed38('0xa')]);router[_0xed38('0xb')]('/describe',auth[_0xed38('0x9')](),controller[_0xed38('0xc')]);router[_0xed38('0xb')]('/:id',auth[_0xed38('0x9')](),controller[_0xed38('0xd')]);router[_0xed38('0xb')](_0xed38('0xe'),auth['isAuthenticated'](),controller[_0xed38('0xf')]);router[_0xed38('0x10')]('/',auth[_0xed38('0x9')](),controller[_0xed38('0x11')]);router[_0xed38('0x10')](_0xed38('0xe'),auth['isAuthenticated'](),controller['addContacts']);router[_0xed38('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xed38('0x13')]);router[_0xed38('0x14')](_0xed38('0x15'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 1b35492..4f9ffb8 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 _0x54ef=['TEXT','INTEGER','UNSIGNED','DATE','NOW','exports','STRING'];(function(_0x24ca4d,_0x4b72da){var _0x5ef041=function(_0x2d535c){while(--_0x2d535c){_0x24ca4d['push'](_0x24ca4d['shift']());}};_0x5ef041(++_0x4b72da);}(_0x54ef,0x140));var _0xf54e=function(_0x2c257f,_0x317e07){_0x2c257f=_0x2c257f-0x0;var _0x1be87d=_0x54ef[_0x2c257f];return _0x1be87d;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0xf54e('0x0')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xf54e('0x1')]},'street':{'type':Sequelize[_0xf54e('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xf54e('0x1')]},'country':{'type':Sequelize[_0xf54e('0x1')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf54e('0x2')]},'phone':{'type':Sequelize[_0xf54e('0x1')]},'mobile':{'type':Sequelize[_0xf54e('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xf54e('0x1')]},'url':{'type':Sequelize[_0xf54e('0x1')]},'facebook':{'type':Sequelize[_0xf54e('0x1')]},'fb_data':{'type':Sequelize[_0xf54e('0x1')]},'twitter':{'type':Sequelize[_0xf54e('0x1')]},'skype':{'type':Sequelize[_0xf54e('0x1')]},'teams':{'type':Sequelize[_0xf54e('0x1')]},'viber':{'type':Sequelize[_0xf54e('0x1')]},'line':{'type':Sequelize[_0xf54e('0x1')]},'wechat':{'type':Sequelize[_0xf54e('0x1')]},'telegram':{'type':Sequelize[_0xf54e('0x1')]},'UserId':{'type':Sequelize[_0xf54e('0x3')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xf54e('0x3')](0x2)[_0xf54e('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xf54e('0x5')],'defaultValue':Sequelize[_0xf54e('0x6')]},'dialTimezone':{'type':Sequelize[_0xf54e('0x1')]},'utcOffset':{'type':Sequelize[_0xf54e('0x3')]}}; \ No newline at end of file +var _0xb5d5=['STRING','INTEGER','UNSIGNED','NOW','sequelize','exports'];(function(_0x3f67b4,_0xb0c4eb){var _0x4b10b4=function(_0x983ac5){while(--_0x983ac5){_0x3f67b4['push'](_0x3f67b4['shift']());}};_0x4b10b4(++_0xb0c4eb);}(_0xb5d5,0xd6));var _0x5b5d=function(_0x4ad38b,_0x2a7e44){_0x4ad38b=_0x4ad38b-0x0;var _0x53090e=_0xb5d5[_0x4ad38b];return _0x53090e;};'use strict';var _=require('lodash');var Sequelize=require(_0x5b5d('0x0'));module[_0x5b5d('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x5b5d('0x2')]},'street':{'type':Sequelize[_0x5b5d('0x2')]},'postalCode':{'type':Sequelize[_0x5b5d('0x2')]},'city':{'type':Sequelize[_0x5b5d('0x2')]},'country':{'type':Sequelize[_0x5b5d('0x2')]},'dateOfBirth':{'type':Sequelize[_0x5b5d('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x5b5d('0x2')]},'mobile':{'type':Sequelize[_0x5b5d('0x2')]},'fax':{'type':Sequelize[_0x5b5d('0x2')]},'email':{'type':Sequelize[_0x5b5d('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x5b5d('0x2')]},'fb_data':{'type':Sequelize[_0x5b5d('0x2')]},'twitter':{'type':Sequelize[_0x5b5d('0x2')]},'skype':{'type':Sequelize[_0x5b5d('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x5b5d('0x2')]},'telegram':{'type':Sequelize[_0x5b5d('0x2')]},'UserId':{'type':Sequelize[_0x5b5d('0x3')]},'AdditionalPhones':{'type':Sequelize[_0x5b5d('0x2')]},'priority':{'type':Sequelize[_0x5b5d('0x3')](0x2)[_0x5b5d('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x5b5d('0x5')]},'dialTimezone':{'type':Sequelize[_0x5b5d('0x2')]},'utcOffset':{'type':Sequelize[_0x5b5d('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 39a6b09..89d5e05 100644 --- a/server/api/cmContact/cmContact.controller.js +++ b/server/api/cmContact/cmContact.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 614c6e4..a8eb912 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 _0x1768=['remove','emit','exports','events','save','update'];(function(_0x246380,_0x4b2a12){var _0x10fef8=function(_0x1a051c){while(--_0x1a051c){_0x246380['push'](_0x246380['shift']());}};_0x10fef8(++_0x4b2a12);}(_0x1768,0xb1));var _0x8176=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x1768[_0x2c7618];return _0x5ce3f0;};'use strict';var EventEmitter=require(_0x8176('0x0'));var CmContact=require('../../mysqldb')['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8176('0x1'),'afterUpdate':_0x8176('0x2'),'afterDestroy':_0x8176('0x3')};function emitEvent(_0x5f513f){return function(_0x3762f2,_0x1a588a,_0x5a11d8){CmContactEvents[_0x8176('0x4')](_0x5f513f+':'+_0x3762f2['id'],_0x3762f2);CmContactEvents[_0x8176('0x4')](_0x5f513f,_0x3762f2);_0x5a11d8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x8176('0x5')]=CmContactEvents; \ No newline at end of file +var _0x06ed=['exports','events','../../mysqldb','CmContact','setMaxListeners','save','update','emit','hook'];(function(_0x37852c,_0x4e8d52){var _0x285236=function(_0x4c0387){while(--_0x4c0387){_0x37852c['push'](_0x37852c['shift']());}};_0x285236(++_0x4e8d52);}(_0x06ed,0x7f));var _0xd06e=function(_0x1464de,_0x2f58c4){_0x1464de=_0x1464de-0x0;var _0x595929=_0x06ed[_0x1464de];return _0x595929;};'use strict';var EventEmitter=require(_0xd06e('0x0'));var CmContact=require(_0xd06e('0x1'))['db'][_0xd06e('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xd06e('0x3')](0x0);var events={'afterCreate':_0xd06e('0x4'),'afterUpdate':_0xd06e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x42573a){return function(_0x492ca5,_0x5dd1ba,_0x335bd4){CmContactEvents[_0xd06e('0x6')](_0x42573a+':'+_0x492ca5['id'],_0x492ca5);CmContactEvents[_0xd06e('0x6')](_0x42573a,_0x492ca5);_0x335bd4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xd06e('0x7')](e,emitEvent(event));}}module[_0xd06e('0x8')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index b77dfa6..8afee68 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 _0x209c=['onlyIfOpen','BlackLists','CmHopperBlack','Campaign','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','models','destroy','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','CmContact','phone','fti_cm_contacts','firstName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','utcOffset','add','minutes','ret','CmHopper','cmContact,\x20afterCreate\x20','\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','timezones','create','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','always'];(function(_0x27466f,_0x40f4ad){var _0x3a4122=function(_0x1592f5){while(--_0x1592f5){_0x27466f['push'](_0x27466f['shift']());}};_0x3a4122(++_0x40f4ad);}(_0x209c,0x138));var _0xc209=function(_0x2bc9c9,_0x274ba7){_0x2bc9c9=_0x2bc9c9-0x0;var _0x4c2952=_0x209c[_0x2bc9c9];return _0x4c2952;};'use strict';var _=require(_0xc209('0x0'));var util=require(_0xc209('0x1'));var logger=require(_0xc209('0x2'))('api');var moment=require(_0xc209('0x3'));var BPromise=require('bluebird');var rp=require(_0xc209('0x4'));var fs=require('fs');var path=require(_0xc209('0x5'));var rimraf=require(_0xc209('0x6'));var config=require(_0xc209('0x7'));var shared=require(_0xc209('0x8'));var attributes=require(_0xc209('0x9'));module[_0xc209('0xa')]=function(_0x3a3bee,_0x3aa4e5){return _0x3a3bee['define'](_0xc209('0xb'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':'phone','fields':[_0xc209('0xc')]},{'name':_0xc209('0xd'),'fields':[_0xc209('0xe'),'lastName',_0xc209('0xc'),_0xc209('0xf'),_0xc209('0x10'),_0xc209('0x11')],'type':_0xc209('0x12')}],'timestamps':!![],'charset':_0xc209('0x13'),'collate':_0xc209('0x14'),'hooks':{'afterCreate':function(_0x3db190,_0x5f12ad,_0x2cc54b){var _0x257f12=_0x3a3bee['models'];var _0x2c5d8a=_0x3db190[_0xc209('0x15')]({'plain':!![]});function _0x2ebf8c(){return function(_0x72f515){logger[_0xc209('0x16')](_0xc209('0x17'),_0xc209('0x18'),util[_0xc209('0x19')](_0x72f515,{'showHidden':![],'depth':null}));};}function _0x57e194(_0x1e9448,_0x1a9e58){var _0x59845d=_0x1a9e58[_0xc209('0x1a')]?_0x1a9e58[_0xc209('0x1a')]:moment()[_0xc209('0x1b')](_0xc209('0x1c'));return new BPromise(function(_0x29a907,_0xf1fa43){if(_[_0xc209('0x1d')](_0x1a9e58[_0xc209('0x1e')])){_0x29a907({'ret':_0x59845d});}else{_0x257f12[_0xc209('0x1f')][_0xc209('0x20')]({'where':{'id':_0x1e9448['id']}})[_0xc209('0x21')](function(_0x3fffe1){if(!_[_0xc209('0x1d')](_0x3fffe1)){var _0x914be2=_0x3fffe1['dialTimezone'];if(!_[_0xc209('0x1d')](_0x914be2)){var _0x54ad37=shared['timezones'];var _0x40d27b=_0x54ad37[_0x914be2];var _0x234b02=_0x54ad37[_0x1a9e58[_0xc209('0x1e')]];if(!_[_0xc209('0x1d')](_0x40d27b)&&!_['isNil'](_0x234b02)){var _0x31df9c=_0x40d27b[_0xc209('0x22')]-_0x234b02['utcOffset'];_0x59845d=_0x1a9e58['scheduledat']?_0x1a9e58[_0xc209('0x1a')]:moment();var _0x194a4f=moment(_0x59845d)[_0xc209('0x23')](_0x31df9c,_0xc209('0x24'));_0x29a907({'ret':_0x194a4f[_0xc209('0x1b')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x29a907({'ret':_0x59845d});}else _0x29a907({'ret':_0x59845d});}else{_0x29a907({'ret':_0x59845d});}});}});return 0xa;}var _0x1c177d=function(_0x355a44){return new BPromise(function(_0x3efce9,_0x208214){_0x57e194(_0x355a44,_0x2c5d8a)[_0xc209('0x21')](function(_0x1b0fe3){_0x2c5d8a['scheduledat']=_0x1b0fe3[_0xc209('0x25')];_0x257f12[_0xc209('0x26')]['findOne']({'where':{'phone':_0x2c5d8a['phone'],'VoiceQueueId':_0x355a44['id']}})[_0xc209('0x21')](function(_0x4d90e0){if(!_['isNil'](_0x4d90e0)){throw new Error(_0xc209('0x27')+_0x2c5d8a[_0xc209('0xc')]+_0xc209('0x28')+_0x355a44['id']);}return _0x257f12[_0xc209('0x26')]['create']({'phone':_0x2c5d8a[_0xc209('0xc')],'ContactId':_0x2c5d8a['id'],'ListId':_0x2c5d8a[_0xc209('0x29')],'priority':_0x2c5d8a[_0xc209('0x2a')]?_0x2c5d8a['priority']:0x2,'scheduledat':_0x2c5d8a['scheduledat']?_0x2c5d8a[_0xc209('0x1a')]:moment()[_0xc209('0x1b')](_0xc209('0x1c')),'callback':_0x2c5d8a['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2c5d8a[_0xc209('0x2b')]?_0x2c5d8a[_0xc209('0x2b')]:undefined,'callbackat':_0x2c5d8a['callbackUniqueid']?moment()[_0xc209('0x1b')](_0xc209('0x1c')):undefined,'VoiceQueueId':_0x355a44['id']});})[_0xc209('0x2c')](function(_0x8c2b9b){_0x208214(_0x8c2b9b);});});});};var _0x5623d3=function(_0x22157a){return new BPromise(function(_0x4d5f1,_0x3c189e){_0x57e194(_0x22157a,_0x2c5d8a)[_0xc209('0x21')](function(_0x249c91){_0x2c5d8a[_0xc209('0x1a')]=_0x249c91[_0xc209('0x25')];_0x257f12[_0xc209('0x26')][_0xc209('0x20')]({'where':{'phone':_0x2c5d8a[_0xc209('0xc')],'VoiceQueueId':_0x22157a['id']}})['then'](function(_0x3d8f71){if(!_[_0xc209('0x1d')](_0x3d8f71)){throw new Error(_0xc209('0x27')+_0x2c5d8a[_0xc209('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x22157a['id']);}return _0x257f12[_0xc209('0x2d')][_0xc209('0x20')]({'where':{'calleridnum':_0x2c5d8a[_0xc209('0xc')],'VoiceQueueId':_0x22157a['id']}});})[_0xc209('0x21')](function(_0x3fd8a2){if(!_[_0xc209('0x1d')](_0x3fd8a2)){throw new Error(_0xc209('0x2e')+_0x2c5d8a['phone']+_0xc209('0x2f')+_0x22157a['id']);}return _0x257f12['CmHopper']['create']({'phone':_0x2c5d8a[_0xc209('0xc')],'ContactId':_0x2c5d8a['id'],'ListId':_0x2c5d8a[_0xc209('0x29')],'priority':_0x2c5d8a[_0xc209('0x2a')]?_0x2c5d8a['priority']:0x2,'scheduledat':_0x2c5d8a[_0xc209('0x1a')]?_0x2c5d8a['scheduledat']:moment()[_0xc209('0x1b')](_0xc209('0x1c')),'callback':_0x2c5d8a[_0xc209('0x2b')]?!![]:![],'callbackuniqueid':_0x2c5d8a[_0xc209('0x2b')]?_0x2c5d8a[_0xc209('0x2b')]:undefined,'callbackat':_0x2c5d8a['callbackUniqueid']?moment()[_0xc209('0x1b')](_0xc209('0x1c')):undefined,'VoiceQueueId':_0x22157a['id']});})[_0xc209('0x2c')](function(_0x20883a){_0x3c189e(_0x20883a);});});});};function _0x2e99b1(){return function(_0x4ead53){logger[_0xc209('0x16')](_0xc209('0x17'),_0xc209('0x18'),util[_0xc209('0x19')](_0x4ead53,{'showHidden':![],'depth':null}));};}function _0x1cc9ea(_0x19a9d2,_0x2fb791){var _0x45d45e=_0x2fb791[_0xc209('0x1a')]?_0x2fb791['scheduledat']:moment()[_0xc209('0x1b')](_0xc209('0x1c'));return new BPromise(function(_0x1a1813,_0x561247){if(_['isNil'](_0x2fb791[_0xc209('0x1e')])){_0x1a1813({'ret':_0x45d45e});}else{_0x257f12['Campaign']['findOne']({'where':{'id':_0x19a9d2['id']}})[_0xc209('0x21')](function(_0x4bd7b4){if(!_[_0xc209('0x1d')](_0x4bd7b4)){var _0x4c8a1b=_0x4bd7b4[_0xc209('0x1e')];if(!_[_0xc209('0x1d')](_0x4c8a1b)){var _0x4edaeb=shared[_0xc209('0x30')];var _0x23796b=_0x4edaeb[_0x4c8a1b];var _0x22a0eb=_0x4edaeb[_0x2fb791[_0xc209('0x1e')]];if(!_[_0xc209('0x1d')](_0x23796b)&&!_[_0xc209('0x1d')](_0x22a0eb)){var _0x544e44=_0x23796b[_0xc209('0x22')]-_0x22a0eb[_0xc209('0x22')];_0x45d45e=_0x2fb791[_0xc209('0x1a')]?_0x2fb791['scheduledat']:moment();var _0x2ce993=moment(_0x45d45e)['add'](_0x544e44,'minutes');_0x1a1813({'ret':_0x2ce993[_0xc209('0x1b')](_0xc209('0x1c'))});}else _0x1a1813({'ret':_0x45d45e});}else _0x1a1813({'ret':_0x45d45e});}else{_0x1a1813({'ret':_0x45d45e});}});}});return 0xa;}var _0x3030bc=function(_0x210c62){return new BPromise(function(_0x538ade,_0x2a5793){_0x1cc9ea(_0x210c62,_0x2c5d8a)[_0xc209('0x21')](function(_0x5edbfd){_0x2c5d8a[_0xc209('0x1a')]=_0x5edbfd[_0xc209('0x25')];_0x257f12['CmHopper'][_0xc209('0x20')]({'where':{'phone':_0x2c5d8a['phone'],'CampaignId':_0x210c62['id']}})['then'](function(_0x5dc6a9){if(!_[_0xc209('0x1d')](_0x5dc6a9)){throw new Error('cmContact,\x20afterCreate\x20'+_0x2c5d8a[_0xc209('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x210c62['id']);}return _0x257f12[_0xc209('0x26')][_0xc209('0x31')]({'phone':_0x2c5d8a[_0xc209('0xc')],'ContactId':_0x2c5d8a['id'],'ListId':_0x2c5d8a[_0xc209('0x29')],'priority':_0x2c5d8a[_0xc209('0x2a')]?_0x2c5d8a['priority']:0x2,'scheduledat':_0x2c5d8a[_0xc209('0x1a')]?_0x2c5d8a['scheduledat']:moment()[_0xc209('0x1b')](_0xc209('0x1c')),'callback':_0x2c5d8a[_0xc209('0x2b')]?!![]:![],'callbackuniqueid':_0x2c5d8a[_0xc209('0x2b')]?_0x2c5d8a['callbackUniqueid']:undefined,'callbackat':_0x2c5d8a[_0xc209('0x2b')]?moment()[_0xc209('0x1b')](_0xc209('0x1c')):undefined,'CampaignId':_0x210c62['id']});})[_0xc209('0x2c')](function(_0x5ee749){_0x2a5793(_0x5ee749);});});});};var _0x30efd3=function(_0x1bf54f){return new BPromise(function(_0x39088f,_0x18ce9a){_0x1cc9ea(_0x1bf54f,_0x2c5d8a)[_0xc209('0x21')](function(_0x160e9c){_0x2c5d8a['scheduledat']=_0x160e9c[_0xc209('0x25')];_0x257f12[_0xc209('0x26')][_0xc209('0x20')]({'where':{'phone':_0x2c5d8a[_0xc209('0xc')],'CampaignId':_0x1bf54f['id']}})[_0xc209('0x21')](function(_0x5b05ce){if(!_[_0xc209('0x1d')](_0x5b05ce)){throw new Error(_0xc209('0x27')+_0x2c5d8a[_0xc209('0xc')]+_0xc209('0x32')+_0x1bf54f['id']);}return _0x257f12[_0xc209('0x2d')][_0xc209('0x20')]({'where':{'calleridnum':_0x2c5d8a[_0xc209('0xc')],'CampaignId':_0x1bf54f['id']}});})[_0xc209('0x21')](function(_0x4754fd){if(!_[_0xc209('0x1d')](_0x4754fd)){throw new Error(_0xc209('0x2e')+_0x2c5d8a[_0xc209('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x1bf54f['id']);}return _0x257f12[_0xc209('0x26')][_0xc209('0x31')]({'phone':_0x2c5d8a['phone'],'ContactId':_0x2c5d8a['id'],'ListId':_0x2c5d8a['ListId'],'priority':_0x2c5d8a[_0xc209('0x2a')]?_0x2c5d8a[_0xc209('0x2a')]:0x2,'scheduledat':_0x2c5d8a['scheduledat']?_0x2c5d8a['scheduledat']:moment()[_0xc209('0x1b')](_0xc209('0x1c')),'callback':_0x2c5d8a[_0xc209('0x2b')]?!![]:![],'callbackuniqueid':_0x2c5d8a[_0xc209('0x2b')]?_0x2c5d8a[_0xc209('0x2b')]:undefined,'callbackat':_0x2c5d8a[_0xc209('0x2b')]?moment()[_0xc209('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x1bf54f['id']});})[_0xc209('0x2c')](function(_0x2fa058){_0x18ce9a(_0x2fa058);});});});};if(_0x2c5d8a[_0xc209('0x29')]){_0x257f12['VoiceQueue'][_0xc209('0x33')]({'where':{'type':_0xc209('0x34')},'attributes':['id',_0xc209('0x35'),'dialTimezone'],'include':[{'model':_0x257f12[_0xc209('0x36')],'as':_0xc209('0x37'),'where':{'id':_0x2c5d8a[_0xc209('0x29')]}}]})[_0xc209('0x21')](function(_0x2124a8){if(_0x2124a8){var _0x150c7a=[];for(var _0x5077bd=0x0,_0x577c26;_0x5077bd<_0x2124a8[_0xc209('0x38')];_0x5077bd+=0x1){_0x577c26=_0x2124a8[_0x5077bd][_0xc209('0x15')]({'plain':!![]});switch(_0x577c26[_0xc209('0x35')]){case _0xc209('0x39'):_0x5623d3(_0x577c26)['catch'](_0x2ebf8c());break;case _0xc209('0x3a'):_0x1c177d(_0x577c26)['catch'](_0x2ebf8c());break;default:_0x1cc9ea(_0x577c26,_0x2c5d8a)[_0xc209('0x21')](function(_0x50761e){_0x2c5d8a[_0xc209('0x1a')]=_0x50761e[_0xc209('0x25')];_0x257f12[_0xc209('0x26')][_0xc209('0x31')]({'phone':_0x2c5d8a[_0xc209('0xc')],'ContactId':_0x2c5d8a['id'],'ListId':_0x2c5d8a[_0xc209('0x29')],'scheduledat':_0x2c5d8a[_0xc209('0x1a')]?_0x2c5d8a['scheduledat']:moment()[_0xc209('0x1b')](_0xc209('0x1c')),'priority':_0x2c5d8a[_0xc209('0x2a')]?_0x2c5d8a['priority']:0x2,'callback':_0x2c5d8a['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2c5d8a[_0xc209('0x2b')]?_0x2c5d8a[_0xc209('0x2b')]:undefined,'callbackat':_0x2c5d8a[_0xc209('0x2b')]?moment()[_0xc209('0x1b')](_0xc209('0x1c')):undefined,'VoiceQueueId':_0x577c26['id']})['catch'](_0x2ebf8c());});}}}})[_0xc209('0x21')](function(){return _0x257f12[_0xc209('0x1f')][_0xc209('0x33')]({'where':{'type':_0xc209('0x34')},'attributes':['id'],'include':[{'model':_0x257f12[_0xc209('0x36')],'as':_0xc209('0x3b'),'where':{'id':_0x2c5d8a[_0xc209('0x29')]}}]})['then'](function(_0x1315ef){if(_0x1315ef){var _0x38657a=[];for(var _0x1ce1a1=0x0,_0x5f257c;_0x1ce1a1<_0x1315ef['length'];_0x1ce1a1+=0x1){_0x5f257c=_0x1315ef[_0x1ce1a1][_0xc209('0x15')]({'plain':!![]});_0x257f12[_0xc209('0x3c')]['create']({'phone':_0x2c5d8a[_0xc209('0xc')],'ContactId':_0x2c5d8a['id'],'ListId':_0x2c5d8a['ListId'],'VoiceQueueId':_0x5f257c['id']})[_0xc209('0x2c')](function(_0x49c49a){logger['error']('cmContact,\x20%s,\x20%s',_0xc209('0x18'),_0x49c49a['message']);});}}});})[_0xc209('0x21')](function(){return _0x257f12[_0xc209('0x3d')][_0xc209('0x33')]({'attributes':['id',_0xc209('0x35'),_0xc209('0x1e')],'include':[{'model':_0x257f12[_0xc209('0x36')],'as':_0xc209('0x37'),'where':{'id':_0x2c5d8a['ListId']}}]})['then'](function(_0x2f2cac){if(_0x2f2cac){var _0x39dd36=[];for(var _0x14860d=0x0,_0x573f75;_0x14860d<_0x2f2cac[_0xc209('0x38')];_0x14860d+=0x1){_0x573f75=_0x2f2cac[_0x14860d][_0xc209('0x15')]({'plain':!![]});switch(_0x573f75[_0xc209('0x35')]){case _0xc209('0x39'):_0x30efd3(_0x573f75)['catch'](_0x2e99b1());break;case _0xc209('0x3a'):_0x3030bc(_0x573f75)[_0xc209('0x2c')](_0x2e99b1());break;default:_0x257f12['CmHopper'][_0xc209('0x31')]({'phone':_0x2c5d8a[_0xc209('0xc')],'ContactId':_0x2c5d8a['id'],'ListId':_0x2c5d8a[_0xc209('0x29')],'scheduledat':_0x2c5d8a[_0xc209('0x1a')]?_0x2c5d8a[_0xc209('0x1a')]:moment()[_0xc209('0x1b')](_0xc209('0x1c')),'priority':_0x2c5d8a['priority']?_0x2c5d8a['priority']:0x2,'callback':_0x2c5d8a[_0xc209('0x2b')]?!![]:![],'callbackuniqueid':_0x2c5d8a[_0xc209('0x2b')]?_0x2c5d8a[_0xc209('0x2b')]:undefined,'callbackat':_0x2c5d8a[_0xc209('0x2b')]?moment()[_0xc209('0x1b')](_0xc209('0x1c')):undefined,'CampaignId':_0x573f75['id']})[_0xc209('0x2c')](_0x2e99b1());}}}});})[_0xc209('0x21')](function(){return _0x257f12[_0xc209('0x3d')][_0xc209('0x33')]({'attributes':['id'],'include':[{'model':_0x257f12[_0xc209('0x36')],'as':_0xc209('0x3b'),'where':{'id':_0x2c5d8a[_0xc209('0x29')]}}]})[_0xc209('0x21')](function(_0x4b9715){if(_0x4b9715){var _0x446396=[];for(var _0xad14a=0x0,_0x393f96;_0xad14a<_0x4b9715[_0xc209('0x38')];_0xad14a+=0x1){_0x393f96=_0x4b9715[_0xad14a]['get']({'plain':!![]});_0x257f12[_0xc209('0x3c')][_0xc209('0x31')]({'phone':_0x2c5d8a[_0xc209('0xc')],'ContactId':_0x2c5d8a['id'],'ListId':_0x2c5d8a[_0xc209('0x29')],'CampaignId':_0x393f96['id']})[_0xc209('0x2c')](function(_0x15e5f9){logger[_0xc209('0x16')](_0xc209('0x3e'),_0xc209('0x18'),_0x15e5f9[_0xc209('0x3f')]);});}}});})[_0xc209('0x21')](function(){_0x2cc54b();})[_0xc209('0x2c')](function(_0xeefd9e){logger['error'](_0xc209('0x3e'),_0xc209('0x18'),_0xeefd9e[_0xc209('0x3f')]);_0x2cc54b(_0xeefd9e);});}else{_0x2cc54b(new Error(_0xc209('0x40')));}},'afterDestroy':function(_0x2a06e1,_0x5837d7,_0x2d3f87){var _0x238ea6=_0x3a3bee[_0xc209('0x41')];var _0x1ef8a4=_0x2a06e1[_0xc209('0x15')]({'plain':!![]});return _0x238ea6[_0xc209('0x26')]['findAll']({'raw':!![],'where':{'ListId':_0x1ef8a4[_0xc209('0x29')],'ContactId':_0x1ef8a4['id']}})[_0xc209('0x21')](function(_0xb0cfb3){if(!_['isEmpty'](_0xb0cfb3)){var _0x1004f0=[];for(var _0x2a128a=0x0;_0x2a128a<_0xb0cfb3['length'];_0x2a128a+=0x1){var _0xc0ad88=_0x238ea6[_0xc209('0x26')][_0xc209('0x42')]({'where':{'ListId':_0xb0cfb3[_0x2a128a][_0xc209('0x29')],'ContactId':_0xb0cfb3[_0x2a128a]['ContactId'],'VoiceQueueId':_0xb0cfb3[_0x2a128a][_0xc209('0x43')],'CampaignId':_0xb0cfb3[_0x2a128a][_0xc209('0x44')]}});_0x1004f0[_0xc209('0x45')](_0xc0ad88);}return BPromise[_0xc209('0x46')](_0x1004f0);}})['then'](function(_0x50bdc7){logger[_0xc209('0x47')](_0xc209('0x48'),util[_0xc209('0x19')](_0x50bdc7,{'showHidden':![],'depth':null}));_0x2d3f87();})[_0xc209('0x2c')](function(_0x38a060){logger['error'](_0xc209('0x49'),util[_0xc209('0x19')](_0x38a060,{'showHidden':![],'depth':null}));_0x2d3f87(_0x38a060);});}}});}; \ No newline at end of file +var _0x025f=['utcOffset','add','minutes','then','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','findOne','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','cmContact','afterCreate','inspect','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','onlyIfOpen','BlackLists','length','CmHopperBlack','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','lastName','mobile','fax','FULLTEXT','utf8mb4','models','get','error','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','timezones'];(function(_0x4209e0,_0x4d97a5){var _0x431f53=function(_0x2d21e0){while(--_0x2d21e0){_0x4209e0['push'](_0x4209e0['shift']());}};_0x431f53(++_0x4d97a5);}(_0x025f,0x107));var _0xf025=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x025f[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf025('0x0'));var util=require(_0xf025('0x1'));var logger=require(_0xf025('0x2'))('api');var moment=require(_0xf025('0x3'));var BPromise=require(_0xf025('0x4'));var rp=require(_0xf025('0x5'));var fs=require('fs');var path=require(_0xf025('0x6'));var rimraf=require(_0xf025('0x7'));var config=require('../../config/environment');var shared=require(_0xf025('0x8'));var attributes=require(_0xf025('0x9'));module[_0xf025('0xa')]=function(_0x83c12e,_0x56450c){return _0x83c12e[_0xf025('0xb')](_0xf025('0xc'),attributes,{'tableName':_0xf025('0xd'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0xf025('0xe')]},{'name':'fti_cm_contacts','fields':['firstName',_0xf025('0xf'),_0xf025('0xe'),_0xf025('0x10'),_0xf025('0x11'),'email'],'type':_0xf025('0x12')}],'timestamps':!![],'charset':_0xf025('0x13'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0xbe24,_0x4eca36,_0x271397){var _0x127c43=_0x83c12e[_0xf025('0x14')];var _0x51025f=_0xbe24[_0xf025('0x15')]({'plain':!![]});function _0x443010(){return function(_0x1c031c){logger[_0xf025('0x16')]('cmContact','afterCreate',util['inspect'](_0x1c031c,{'showHidden':![],'depth':null}));};}function _0x1d0445(_0x446f87,_0x15b367){var _0x2d5d5f=_0x15b367[_0xf025('0x17')]?_0x15b367['scheduledat']:moment()[_0xf025('0x18')](_0xf025('0x19'));return new BPromise(function(_0x21eada,_0x48a1fe){if(_[_0xf025('0x1a')](_0x15b367[_0xf025('0x1b')])){_0x21eada({'ret':_0x2d5d5f});}else{_0x127c43['VoiceQueue']['findOne']({'where':{'id':_0x446f87['id']}})['then'](function(_0x2cd646){if(!_[_0xf025('0x1a')](_0x2cd646)){var _0x5aebc4=_0x2cd646['dialTimezone'];if(!_[_0xf025('0x1a')](_0x5aebc4)){var _0x4af80e=shared[_0xf025('0x1c')];var _0xf54592=_0x4af80e[_0x5aebc4];var _0x4d7368=_0x4af80e[_0x15b367['dialTimezone']];if(!_[_0xf025('0x1a')](_0xf54592)&&!_[_0xf025('0x1a')](_0x4d7368)){var _0x63d33b=_0xf54592[_0xf025('0x1d')]-_0x4d7368[_0xf025('0x1d')];_0x2d5d5f=_0x15b367[_0xf025('0x17')]?_0x15b367[_0xf025('0x17')]:moment();var _0x2baeb8=moment(_0x2d5d5f)[_0xf025('0x1e')](_0x63d33b,_0xf025('0x1f'));_0x21eada({'ret':_0x2baeb8[_0xf025('0x18')](_0xf025('0x19'))});}else _0x21eada({'ret':_0x2d5d5f});}else _0x21eada({'ret':_0x2d5d5f});}else{_0x21eada({'ret':_0x2d5d5f});}});}});return 0xa;}var _0x22873d=function(_0x532097){return new BPromise(function(_0x5cc5cb,_0x29cf5e){_0x1d0445(_0x532097,_0x51025f)[_0xf025('0x20')](function(_0x36b330){_0x51025f[_0xf025('0x17')]=_0x36b330[_0xf025('0x21')];_0x127c43[_0xf025('0x22')]['findOne']({'where':{'phone':_0x51025f[_0xf025('0xe')],'VoiceQueueId':_0x532097['id']}})[_0xf025('0x20')](function(_0xe3d705){if(!_[_0xf025('0x1a')](_0xe3d705)){throw new Error(_0xf025('0x23')+_0x51025f[_0xf025('0xe')]+_0xf025('0x24')+_0x532097['id']);}return _0x127c43[_0xf025('0x22')][_0xf025('0x25')]({'phone':_0x51025f[_0xf025('0xe')],'ContactId':_0x51025f['id'],'ListId':_0x51025f[_0xf025('0x26')],'priority':_0x51025f[_0xf025('0x27')]?_0x51025f[_0xf025('0x27')]:0x2,'scheduledat':_0x51025f['scheduledat']?_0x51025f['scheduledat']:moment()[_0xf025('0x18')](_0xf025('0x19')),'callback':_0x51025f[_0xf025('0x28')]?!![]:![],'callbackuniqueid':_0x51025f[_0xf025('0x28')]?_0x51025f[_0xf025('0x28')]:undefined,'callbackat':_0x51025f['callbackUniqueid']?moment()['format'](_0xf025('0x19')):undefined,'VoiceQueueId':_0x532097['id']});})[_0xf025('0x29')](function(_0x4822c9){_0x29cf5e(_0x4822c9);});});});};var _0x16ac1f=function(_0x2f313c){return new BPromise(function(_0x81add2,_0x12a936){_0x1d0445(_0x2f313c,_0x51025f)[_0xf025('0x20')](function(_0x44596f){_0x51025f[_0xf025('0x17')]=_0x44596f[_0xf025('0x21')];_0x127c43[_0xf025('0x22')][_0xf025('0x2a')]({'where':{'phone':_0x51025f[_0xf025('0xe')],'VoiceQueueId':_0x2f313c['id']}})[_0xf025('0x20')](function(_0x54ddbd){if(!_[_0xf025('0x1a')](_0x54ddbd)){throw new Error(_0xf025('0x23')+_0x51025f[_0xf025('0xe')]+_0xf025('0x2b')+_0x2f313c['id']);}return _0x127c43['CmHopperFinal'][_0xf025('0x2a')]({'where':{'calleridnum':_0x51025f['phone'],'VoiceQueueId':_0x2f313c['id']}});})['then'](function(_0x53ed9f){if(!_['isNil'](_0x53ed9f)){throw new Error(_0xf025('0x2c')+_0x51025f['phone']+_0xf025('0x2d')+_0x2f313c['id']);}return _0x127c43[_0xf025('0x22')]['create']({'phone':_0x51025f[_0xf025('0xe')],'ContactId':_0x51025f['id'],'ListId':_0x51025f[_0xf025('0x26')],'priority':_0x51025f[_0xf025('0x27')]?_0x51025f[_0xf025('0x27')]:0x2,'scheduledat':_0x51025f[_0xf025('0x17')]?_0x51025f[_0xf025('0x17')]:moment()[_0xf025('0x18')](_0xf025('0x19')),'callback':_0x51025f['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x51025f[_0xf025('0x28')]?_0x51025f['callbackUniqueid']:undefined,'callbackat':_0x51025f[_0xf025('0x28')]?moment()['format'](_0xf025('0x19')):undefined,'VoiceQueueId':_0x2f313c['id']});})[_0xf025('0x29')](function(_0x46bd8a){_0x12a936(_0x46bd8a);});});});};function _0x5c779a(){return function(_0x21aca0){logger['error'](_0xf025('0x2e'),_0xf025('0x2f'),util[_0xf025('0x30')](_0x21aca0,{'showHidden':![],'depth':null}));};}function _0x100008(_0x4c180c,_0x458be9){var _0x39a3fd=_0x458be9[_0xf025('0x17')]?_0x458be9[_0xf025('0x17')]:moment()[_0xf025('0x18')](_0xf025('0x19'));return new BPromise(function(_0x5ad884,_0x265c8a){if(_[_0xf025('0x1a')](_0x458be9[_0xf025('0x1b')])){_0x5ad884({'ret':_0x39a3fd});}else{_0x127c43[_0xf025('0x31')][_0xf025('0x2a')]({'where':{'id':_0x4c180c['id']}})[_0xf025('0x20')](function(_0x1cd6ab){if(!_['isNil'](_0x1cd6ab)){var _0x38f4bd=_0x1cd6ab[_0xf025('0x1b')];if(!_['isNil'](_0x38f4bd)){var _0x43f17f=shared[_0xf025('0x1c')];var _0x40ee1a=_0x43f17f[_0x38f4bd];var _0x2eafb4=_0x43f17f[_0x458be9['dialTimezone']];if(!_[_0xf025('0x1a')](_0x40ee1a)&&!_[_0xf025('0x1a')](_0x2eafb4)){var _0x1cbed6=_0x40ee1a[_0xf025('0x1d')]-_0x2eafb4[_0xf025('0x1d')];_0x39a3fd=_0x458be9[_0xf025('0x17')]?_0x458be9[_0xf025('0x17')]:moment();var _0xaf8533=moment(_0x39a3fd)[_0xf025('0x1e')](_0x1cbed6,_0xf025('0x1f'));_0x5ad884({'ret':_0xaf8533[_0xf025('0x18')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x5ad884({'ret':_0x39a3fd});}else _0x5ad884({'ret':_0x39a3fd});}else{_0x5ad884({'ret':_0x39a3fd});}});}});return 0xa;}var _0x3974da=function(_0x391a7a){return new BPromise(function(_0x31f139,_0x35b901){_0x100008(_0x391a7a,_0x51025f)[_0xf025('0x20')](function(_0x9ca6ad){_0x51025f[_0xf025('0x17')]=_0x9ca6ad[_0xf025('0x21')];_0x127c43[_0xf025('0x22')][_0xf025('0x2a')]({'where':{'phone':_0x51025f[_0xf025('0xe')],'CampaignId':_0x391a7a['id']}})[_0xf025('0x20')](function(_0x41e40c){if(!_[_0xf025('0x1a')](_0x41e40c)){throw new Error('cmContact,\x20afterCreate\x20'+_0x51025f[_0xf025('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x391a7a['id']);}return _0x127c43['CmHopper'][_0xf025('0x25')]({'phone':_0x51025f[_0xf025('0xe')],'ContactId':_0x51025f['id'],'ListId':_0x51025f['ListId'],'priority':_0x51025f[_0xf025('0x27')]?_0x51025f[_0xf025('0x27')]:0x2,'scheduledat':_0x51025f[_0xf025('0x17')]?_0x51025f[_0xf025('0x17')]:moment()[_0xf025('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x51025f[_0xf025('0x28')]?!![]:![],'callbackuniqueid':_0x51025f[_0xf025('0x28')]?_0x51025f['callbackUniqueid']:undefined,'callbackat':_0x51025f[_0xf025('0x28')]?moment()[_0xf025('0x18')](_0xf025('0x19')):undefined,'CampaignId':_0x391a7a['id']});})[_0xf025('0x29')](function(_0xbe79e3){_0x35b901(_0xbe79e3);});});});};var _0x504f0c=function(_0x11df99){return new BPromise(function(_0x25ba9c,_0x3234bc){_0x100008(_0x11df99,_0x51025f)[_0xf025('0x20')](function(_0x2f7f38){_0x51025f[_0xf025('0x17')]=_0x2f7f38['ret'];_0x127c43['CmHopper'][_0xf025('0x2a')]({'where':{'phone':_0x51025f['phone'],'CampaignId':_0x11df99['id']}})[_0xf025('0x20')](function(_0x5ec581){if(!_[_0xf025('0x1a')](_0x5ec581)){throw new Error(_0xf025('0x23')+_0x51025f[_0xf025('0xe')]+_0xf025('0x32')+_0x11df99['id']);}return _0x127c43['CmHopperFinal'][_0xf025('0x2a')]({'where':{'calleridnum':_0x51025f['phone'],'CampaignId':_0x11df99['id']}});})[_0xf025('0x20')](function(_0x53cd62){if(!_['isNil'](_0x53cd62)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x51025f['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x11df99['id']);}return _0x127c43[_0xf025('0x22')]['create']({'phone':_0x51025f[_0xf025('0xe')],'ContactId':_0x51025f['id'],'ListId':_0x51025f['ListId'],'priority':_0x51025f[_0xf025('0x27')]?_0x51025f[_0xf025('0x27')]:0x2,'scheduledat':_0x51025f[_0xf025('0x17')]?_0x51025f[_0xf025('0x17')]:moment()[_0xf025('0x18')](_0xf025('0x19')),'callback':_0x51025f[_0xf025('0x28')]?!![]:![],'callbackuniqueid':_0x51025f[_0xf025('0x28')]?_0x51025f[_0xf025('0x28')]:undefined,'callbackat':_0x51025f[_0xf025('0x28')]?moment()[_0xf025('0x18')](_0xf025('0x19')):undefined,'CampaignId':_0x11df99['id']});})[_0xf025('0x29')](function(_0x28a717){_0x3234bc(_0x28a717);});});});};if(_0x51025f[_0xf025('0x26')]){_0x127c43[_0xf025('0x33')][_0xf025('0x34')]({'where':{'type':_0xf025('0x35')},'attributes':['id',_0xf025('0x36'),_0xf025('0x1b')],'include':[{'model':_0x127c43[_0xf025('0x37')],'as':_0xf025('0x38'),'where':{'id':_0x51025f[_0xf025('0x26')]}}]})['then'](function(_0xe671fe){if(_0xe671fe){var _0x5b4314=[];for(var _0x478dbf=0x0,_0x238ddd;_0x478dbf<_0xe671fe['length'];_0x478dbf+=0x1){_0x238ddd=_0xe671fe[_0x478dbf][_0xf025('0x15')]({'plain':!![]});switch(_0x238ddd[_0xf025('0x36')]){case _0xf025('0x39'):_0x16ac1f(_0x238ddd)[_0xf025('0x29')](_0x443010());break;case _0xf025('0x3a'):_0x22873d(_0x238ddd)[_0xf025('0x29')](_0x443010());break;default:_0x100008(_0x238ddd,_0x51025f)[_0xf025('0x20')](function(_0x271db5){_0x51025f[_0xf025('0x17')]=_0x271db5['ret'];_0x127c43[_0xf025('0x22')][_0xf025('0x25')]({'phone':_0x51025f[_0xf025('0xe')],'ContactId':_0x51025f['id'],'ListId':_0x51025f[_0xf025('0x26')],'scheduledat':_0x51025f[_0xf025('0x17')]?_0x51025f[_0xf025('0x17')]:moment()['format'](_0xf025('0x19')),'priority':_0x51025f[_0xf025('0x27')]?_0x51025f[_0xf025('0x27')]:0x2,'callback':_0x51025f['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x51025f[_0xf025('0x28')]?_0x51025f[_0xf025('0x28')]:undefined,'callbackat':_0x51025f['callbackUniqueid']?moment()[_0xf025('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x238ddd['id']})[_0xf025('0x29')](_0x443010());});}}}})[_0xf025('0x20')](function(){return _0x127c43['VoiceQueue']['findAll']({'where':{'type':_0xf025('0x35')},'attributes':['id'],'include':[{'model':_0x127c43[_0xf025('0x37')],'as':_0xf025('0x3b'),'where':{'id':_0x51025f[_0xf025('0x26')]}}]})['then'](function(_0xd9c2d5){if(_0xd9c2d5){var _0x1e56bf=[];for(var _0x4076a8=0x0,_0x38c289;_0x4076a8<_0xd9c2d5[_0xf025('0x3c')];_0x4076a8+=0x1){_0x38c289=_0xd9c2d5[_0x4076a8][_0xf025('0x15')]({'plain':!![]});_0x127c43[_0xf025('0x3d')]['create']({'phone':_0x51025f[_0xf025('0xe')],'ContactId':_0x51025f['id'],'ListId':_0x51025f[_0xf025('0x26')],'VoiceQueueId':_0x38c289['id']})['catch'](function(_0x5d3cee){logger[_0xf025('0x16')](_0xf025('0x3e'),'afterCreate',_0x5d3cee[_0xf025('0x3f')]);});}}});})[_0xf025('0x20')](function(){return _0x127c43['Campaign']['findAll']({'attributes':['id',_0xf025('0x36'),_0xf025('0x1b')],'include':[{'model':_0x127c43[_0xf025('0x37')],'as':_0xf025('0x38'),'where':{'id':_0x51025f[_0xf025('0x26')]}}]})[_0xf025('0x20')](function(_0x1e4aa3){if(_0x1e4aa3){var _0x15f5f5=[];for(var _0x2433ca=0x0,_0xcbabc7;_0x2433ca<_0x1e4aa3[_0xf025('0x3c')];_0x2433ca+=0x1){_0xcbabc7=_0x1e4aa3[_0x2433ca][_0xf025('0x15')]({'plain':!![]});switch(_0xcbabc7['dialCheckDuplicateType']){case'always':_0x504f0c(_0xcbabc7)['catch'](_0x5c779a());break;case _0xf025('0x3a'):_0x3974da(_0xcbabc7)[_0xf025('0x29')](_0x5c779a());break;default:_0x127c43[_0xf025('0x22')][_0xf025('0x25')]({'phone':_0x51025f[_0xf025('0xe')],'ContactId':_0x51025f['id'],'ListId':_0x51025f[_0xf025('0x26')],'scheduledat':_0x51025f[_0xf025('0x17')]?_0x51025f[_0xf025('0x17')]:moment()[_0xf025('0x18')](_0xf025('0x19')),'priority':_0x51025f[_0xf025('0x27')]?_0x51025f[_0xf025('0x27')]:0x2,'callback':_0x51025f['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x51025f['callbackUniqueid']?_0x51025f[_0xf025('0x28')]:undefined,'callbackat':_0x51025f[_0xf025('0x28')]?moment()[_0xf025('0x18')](_0xf025('0x19')):undefined,'CampaignId':_0xcbabc7['id']})['catch'](_0x5c779a());}}}});})['then'](function(){return _0x127c43[_0xf025('0x31')][_0xf025('0x34')]({'attributes':['id'],'include':[{'model':_0x127c43[_0xf025('0x37')],'as':'BlackLists','where':{'id':_0x51025f[_0xf025('0x26')]}}]})[_0xf025('0x20')](function(_0x5168c2){if(_0x5168c2){var _0x8e7698=[];for(var _0x5db355=0x0,_0x32a231;_0x5db355<_0x5168c2[_0xf025('0x3c')];_0x5db355+=0x1){_0x32a231=_0x5168c2[_0x5db355][_0xf025('0x15')]({'plain':!![]});_0x127c43[_0xf025('0x3d')][_0xf025('0x25')]({'phone':_0x51025f[_0xf025('0xe')],'ContactId':_0x51025f['id'],'ListId':_0x51025f[_0xf025('0x26')],'CampaignId':_0x32a231['id']})[_0xf025('0x29')](function(_0x9f6202){logger[_0xf025('0x16')](_0xf025('0x3e'),_0xf025('0x2f'),_0x9f6202[_0xf025('0x3f')]);});}}});})[_0xf025('0x20')](function(){_0x271397();})['catch'](function(_0x1823ea){logger[_0xf025('0x16')](_0xf025('0x3e'),'afterCreate',_0x1823ea[_0xf025('0x3f')]);_0x271397(_0x1823ea);});}else{_0x271397(new Error(_0xf025('0x40')));}},'afterDestroy':function(_0x463ba4,_0x107af9,_0x4c63c9){var _0x145b0a=_0x83c12e[_0xf025('0x14')];var _0x2ab1d1=_0x463ba4[_0xf025('0x15')]({'plain':!![]});return _0x145b0a[_0xf025('0x22')][_0xf025('0x34')]({'raw':!![],'where':{'ListId':_0x2ab1d1[_0xf025('0x26')],'ContactId':_0x2ab1d1['id']}})[_0xf025('0x20')](function(_0x2a5d81){if(!_[_0xf025('0x41')](_0x2a5d81)){var _0x2cc4e2=[];for(var _0x49bab5=0x0;_0x49bab5<_0x2a5d81['length'];_0x49bab5+=0x1){var _0x18fe1c=_0x145b0a['CmHopper'][_0xf025('0x42')]({'where':{'ListId':_0x2a5d81[_0x49bab5]['ListId'],'ContactId':_0x2a5d81[_0x49bab5][_0xf025('0x43')],'VoiceQueueId':_0x2a5d81[_0x49bab5][_0xf025('0x44')],'CampaignId':_0x2a5d81[_0x49bab5][_0xf025('0x45')]}});_0x2cc4e2[_0xf025('0x46')](_0x18fe1c);}return BPromise[_0xf025('0x47')](_0x2cc4e2);}})[_0xf025('0x20')](function(_0x44e2d1){logger['info']('[CmContact][afterDestroy][Succesfull]',util[_0xf025('0x30')](_0x44e2d1,{'showHidden':![],'depth':null}));_0x4c63c9();})[_0xf025('0x29')](function(_0x1a4fc7){logger[_0xf025('0x16')](_0xf025('0x48'),util['inspect'](_0x1a4fc7,{'showHidden':![],'depth':null}));_0x4c63c9(_0x1a4fc7);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 10d94a1..39b4305 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x45cb7f,_0x5caddd){var _0xb6ad06=function(_0x151362){while(--_0x151362){_0x45cb7f['push'](_0x45cb7f['shift']());}};_0xb6ad06(++_0x5caddd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 f701f50..791970a 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 _0xd691=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0x5d1044,_0x18f656){var _0x3cd90e=function(_0x3c40be){while(--_0x3c40be){_0x5d1044['push'](_0x5d1044['shift']());}};_0x3cd90e(++_0x18f656);}(_0xd691,0xe6));var _0x1d69=function(_0x31ce94,_0x246777){_0x31ce94=_0x31ce94-0x0;var _0x16ca31=_0xd691[_0x31ce94];return _0x16ca31;};'use strict';var Sequelize=require(_0x1d69('0x0'));module[_0x1d69('0x1')]={'CmContactId':{'type':Sequelize[_0x1d69('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x1d69('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x1d69('0x3')],'defaultValue':_0x1d69('0x4')},'OrderBy':{'type':Sequelize[_0x1d69('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x1d69('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x4f88=['exports','STRING','INTEGER','sequelize'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x4f88,0xf3));var _0x84f8=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0x4f88[_0x1daaa9];return _0x1dd221;};'use strict';var Sequelize=require(_0x84f8('0x0'));module[_0x84f8('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x84f8('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x84f8('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x84f8('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x84f8('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index c601125..bb54288 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 _0xb0eb=['apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','name','send','index','map','rawAttributes','type','key','keys','query','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','rows','params','CmContactHasItem','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmContactHasItems','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','offset','undefined','limit','count','status','Content-Range','json'];(function(_0x45671c,_0x2d5a15){var _0x8690ab=function(_0x44598f){while(--_0x44598f){_0x45671c['push'](_0x45671c['shift']());}};_0x8690ab(++_0x2d5a15);}(_0xb0eb,0x1b1));var _0xbb0e=function(_0x54490d,_0x389a49){_0x54490d=_0x54490d-0x0;var _0x158dc6=_0xb0eb[_0x54490d];return _0x158dc6;};'use strict';var emlformat=require(_0xbb0e('0x0'));var rimraf=require(_0xbb0e('0x1'));var zipdir=require(_0xbb0e('0x2'));var jsonpatch=require(_0xbb0e('0x3'));var rp=require(_0xbb0e('0x4'));var moment=require(_0xbb0e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbb0e('0x6'));var util=require(_0xbb0e('0x7'));var path=require(_0xbb0e('0x8'));var sox=require('sox');var csv=require(_0xbb0e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb0e('0xa'));var _=require(_0xbb0e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbb0e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbb0e('0x9'));var querystring=require(_0xbb0e('0xd'));var Papa=require('papaparse');var Redis=require(_0xbb0e('0xe'));var authService=require(_0xbb0e('0xf'));var qs=require(_0xbb0e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbb0e('0x11'))(_0xbb0e('0x12'));var utils=require(_0xbb0e('0x13'));var config=require(_0xbb0e('0x14'));var licenseUtil=require(_0xbb0e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x162e2d,_0x2a7bcb){_0x2a7bcb=_0x2a7bcb||0xcc;return function(_0x2375fc){if(_0x2375fc){return _0x162e2d['sendStatus'](_0x2a7bcb);}return _0x162e2d['status'](_0x2a7bcb)['end']();};}function respondWithResult(_0x3baf16,_0x4a0ca2){_0x4a0ca2=_0x4a0ca2||0xc8;return function(_0x1f2718){if(_0x1f2718){return _0x3baf16['status'](_0x4a0ca2)['json'](_0x1f2718);}};}function respondWithFilteredResult(_0x4e1a27,_0x1abd97){return function(_0x40eea6){if(_0x40eea6){var _0x5e05c8=typeof _0x1abd97[_0xbb0e('0x16')]===_0xbb0e('0x17')&&typeof _0x1abd97[_0xbb0e('0x18')]===_0xbb0e('0x17');var _0x2b6fc4=_0x40eea6[_0xbb0e('0x19')];var _0x11fb11=_0x5e05c8?0x0:_0x1abd97[_0xbb0e('0x16')];var _0x479750=_0x5e05c8?_0x40eea6[_0xbb0e('0x19')]:_0x1abd97[_0xbb0e('0x16')]+_0x1abd97[_0xbb0e('0x18')];var _0x78f997;if(_0x479750>=_0x2b6fc4){_0x479750=_0x2b6fc4;_0x78f997=0xc8;}else{_0x78f997=0xce;}_0x4e1a27[_0xbb0e('0x1a')](_0x78f997);return _0x4e1a27['set'](_0xbb0e('0x1b'),_0x11fb11+'-'+_0x479750+'/'+_0x2b6fc4)[_0xbb0e('0x1c')](_0x40eea6);}return null;};}function patchUpdates(_0x8e1d3c){return function(_0x75db7b){try{jsonpatch[_0xbb0e('0x1d')](_0x75db7b,_0x8e1d3c,!![]);}catch(_0xc6f138){return BPromise[_0xbb0e('0x1e')](_0xc6f138);}return _0x75db7b[_0xbb0e('0x1f')]();};}function saveUpdates(_0x4884b8,_0x5f147a){return function(_0x4296bf){if(_0x4296bf){return _0x4296bf[_0xbb0e('0x20')](_0x4884b8)[_0xbb0e('0x21')](function(_0x11898c){return _0x11898c;});}return null;};}function removeEntity(_0x35968b,_0x13c6fa){return function(_0x1e30e8){if(_0x1e30e8){return _0x1e30e8[_0xbb0e('0x22')]()[_0xbb0e('0x21')](function(){var _0x32f0d7=_0x1e30e8[_0xbb0e('0x23')]({'plain':!![]});var _0x1fa41c='CmContactHasItems';return db[_0xbb0e('0x24')][_0xbb0e('0x22')]({'where':{'type':_0x1fa41c,'resourceId':_0x32f0d7['id']}})[_0xbb0e('0x21')](function(){return _0x1e30e8;});})['then'](function(){_0x35968b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44fc81,_0x54d986){return function(_0x1b535c){if(!_0x1b535c){_0x44fc81[_0xbb0e('0x25')](0x194);}return _0x1b535c;};}function handleError(_0x1c1f0a,_0x2d402c){_0x2d402c=_0x2d402c||0x1f4;return function(_0x1d544b){logger[_0xbb0e('0x26')](_0x1d544b['stack']);if(_0x1d544b[_0xbb0e('0x27')]){delete _0x1d544b[_0xbb0e('0x27')];}_0x1c1f0a[_0xbb0e('0x1a')](_0x2d402c)[_0xbb0e('0x28')](_0x1d544b);};}exports[_0xbb0e('0x29')]=function(_0x1f8db7,_0x25e7b5){var _0x2d2a7a={},_0x4f816f={},_0x5d00ea={'count':0x0,'rows':[]};var _0x40ab37=_[_0xbb0e('0x2a')](db['CmContactHasItem'][_0xbb0e('0x2b')],function(_0x1e074d){return{'name':_0x1e074d['fieldName'],'type':_0x1e074d[_0xbb0e('0x2c')][_0xbb0e('0x2d')]};});_0x4f816f['model']=_[_0xbb0e('0x2a')](_0x40ab37,_0xbb0e('0x27'));_0x4f816f['query']=_[_0xbb0e('0x2e')](_0x1f8db7[_0xbb0e('0x2f')]);_0x4f816f[_0xbb0e('0x30')]=_[_0xbb0e('0x31')](_0x4f816f['model'],_0x4f816f['query']);_0x2d2a7a['attributes']=_['intersection'](_0x4f816f[_0xbb0e('0x32')],qs[_0xbb0e('0x33')](_0x1f8db7[_0xbb0e('0x2f')][_0xbb0e('0x33')]));_0x2d2a7a['attributes']=_0x2d2a7a['attributes']['length']?_0x2d2a7a[_0xbb0e('0x34')]:_0x4f816f['model'];if(!_0x1f8db7[_0xbb0e('0x2f')]['hasOwnProperty'](_0xbb0e('0x35'))){_0x2d2a7a[_0xbb0e('0x18')]=qs[_0xbb0e('0x18')](_0x1f8db7[_0xbb0e('0x2f')][_0xbb0e('0x18')]);_0x2d2a7a[_0xbb0e('0x16')]=qs[_0xbb0e('0x16')](_0x1f8db7[_0xbb0e('0x2f')][_0xbb0e('0x16')]);}_0x2d2a7a[_0xbb0e('0x36')]=qs[_0xbb0e('0x37')](_0x1f8db7[_0xbb0e('0x2f')][_0xbb0e('0x37')]);_0x2d2a7a[_0xbb0e('0x38')]=qs[_0xbb0e('0x30')](_[_0xbb0e('0x39')](_0x1f8db7[_0xbb0e('0x2f')],_0x4f816f[_0xbb0e('0x30')]),_0x40ab37);if(_0x1f8db7['query']['filter']){_0x2d2a7a[_0xbb0e('0x38')]=_['merge'](_0x2d2a7a[_0xbb0e('0x38')],{'$or':_[_0xbb0e('0x2a')](_0x40ab37,function(_0x21fc11){if(_0x21fc11['type']!==_0xbb0e('0x3a')){var _0x1683d7={};_0x1683d7[_0x21fc11[_0xbb0e('0x27')]]={'$like':'%'+_0x1f8db7[_0xbb0e('0x2f')]['filter']+'%'};return _0x1683d7;}})});}_0x2d2a7a=_[_0xbb0e('0x3b')]({},_0x2d2a7a,_0x1f8db7[_0xbb0e('0x3c')]);var _0x309975={'where':_0x2d2a7a['where']};return db['CmContactHasItem'][_0xbb0e('0x19')](_0x309975)[_0xbb0e('0x21')](function(_0x1a66d5){_0x5d00ea[_0xbb0e('0x19')]=_0x1a66d5;if(_0x1f8db7[_0xbb0e('0x2f')][_0xbb0e('0x3d')]){_0x2d2a7a[_0xbb0e('0x3e')]=[{'all':!![]}];}return db['CmContactHasItem']['findAll'](_0x2d2a7a);})[_0xbb0e('0x21')](function(_0x512f3c){_0x5d00ea[_0xbb0e('0x3f')]=_0x512f3c;return _0x5d00ea;})['then'](respondWithFilteredResult(_0x25e7b5,_0x2d2a7a))['catch'](handleError(_0x25e7b5,null));};exports['show']=function(_0x5e3765,_0x9c30a6){var _0x3bd49c={'raw':!![],'where':{'id':_0x5e3765[_0xbb0e('0x40')]['id']}},_0x26b2fd={};_0x26b2fd[_0xbb0e('0x32')]=_[_0xbb0e('0x2e')](db[_0xbb0e('0x41')][_0xbb0e('0x2b')]);_0x26b2fd[_0xbb0e('0x2f')]=_[_0xbb0e('0x2e')](_0x5e3765[_0xbb0e('0x2f')]);_0x26b2fd[_0xbb0e('0x30')]=_[_0xbb0e('0x31')](_0x26b2fd['model'],_0x26b2fd['query']);_0x3bd49c[_0xbb0e('0x34')]=_['intersection'](_0x26b2fd[_0xbb0e('0x32')],qs['fields'](_0x5e3765[_0xbb0e('0x2f')][_0xbb0e('0x33')]));_0x3bd49c[_0xbb0e('0x34')]=_0x3bd49c['attributes'][_0xbb0e('0x42')]?_0x3bd49c[_0xbb0e('0x34')]:_0x26b2fd['model'];if(_0x5e3765[_0xbb0e('0x2f')][_0xbb0e('0x3d')]){_0x3bd49c[_0xbb0e('0x3e')]=[{'all':!![]}];}_0x3bd49c=_['merge']({},_0x3bd49c,_0x5e3765[_0xbb0e('0x3c')]);return db['CmContactHasItem'][_0xbb0e('0x43')](_0x3bd49c)[_0xbb0e('0x21')](handleEntityNotFound(_0x9c30a6,null))[_0xbb0e('0x21')](respondWithResult(_0x9c30a6,null))[_0xbb0e('0x44')](handleError(_0x9c30a6,null));};exports[_0xbb0e('0x45')]=function(_0x137294,_0x43a74b){return db[_0xbb0e('0x41')][_0xbb0e('0x45')](_0x137294[_0xbb0e('0x46')],{})['then'](function(_0x1b42ec){var _0x4a4f63=_0x137294[_0xbb0e('0x47')][_0xbb0e('0x23')]({'plain':!![]});if(!_0x4a4f63)throw new Error(_0xbb0e('0x48'));if(_0x4a4f63['role']==='user'){var _0x26179e=_0x1b42ec[_0xbb0e('0x23')]({'plain':!![]});var _0xdca026=_0xbb0e('0x49');return db['UserProfileSection'][_0xbb0e('0x43')]({'where':{'name':_0xdca026,'userProfileId':_0x4a4f63[_0xbb0e('0x4a')]},'raw':!![]})['then'](function(_0x1f3618){if(_0x1f3618&&_0x1f3618[_0xbb0e('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x26179e[_0xbb0e('0x27')],'resourceId':_0x26179e['id'],'type':_0x1f3618['name'],'sectionId':_0x1f3618['id']},{})[_0xbb0e('0x21')](function(){return _0x1b42ec;});}else{return _0x1b42ec;}})[_0xbb0e('0x44')](function(_0x365a18){logger[_0xbb0e('0x26')](_0xbb0e('0x4c'),_0x365a18);throw _0x365a18;});}return _0x1b42ec;})[_0xbb0e('0x21')](respondWithResult(_0x43a74b,0xc9))['catch'](handleError(_0x43a74b,null));};exports['update']=function(_0x500610,_0x381d09){if(_0x500610[_0xbb0e('0x46')]['id']){delete _0x500610[_0xbb0e('0x46')]['id'];}return db['CmContactHasItem'][_0xbb0e('0x43')]({'where':{'id':_0x500610['params']['id']}})[_0xbb0e('0x21')](handleEntityNotFound(_0x381d09,null))[_0xbb0e('0x21')](saveUpdates(_0x500610['body'],null))[_0xbb0e('0x21')](respondWithResult(_0x381d09,null))[_0xbb0e('0x44')](handleError(_0x381d09,null));};exports['destroy']=function(_0x4c9f5e,_0x2007de){return db[_0xbb0e('0x41')][_0xbb0e('0x43')]({'where':{'id':_0x4c9f5e[_0xbb0e('0x40')]['id']}})[_0xbb0e('0x21')](handleEntityNotFound(_0x2007de,null))[_0xbb0e('0x21')](removeEntity(_0x2007de,null))['catch'](handleError(_0x2007de,null));}; \ No newline at end of file +var _0x3516=['catch','params','includeAll','include','options','find','create','body','user','role','UserProfileSection','autoAssociation','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','sendStatus','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','CmContactHasItem'];(function(_0x503a67,_0x1ea47d){var _0x321154=function(_0x472777){while(--_0x472777){_0x503a67['push'](_0x503a67['shift']());}};_0x321154(++_0x1ea47d);}(_0x3516,0xad));var _0x6351=function(_0x4d32c9,_0xa9aa9d){_0x4d32c9=_0x4d32c9-0x0;var _0x16cbbf=_0x3516[_0x4d32c9];return _0x16cbbf;};'use strict';var emlformat=require(_0x6351('0x0'));var rimraf=require(_0x6351('0x1'));var zipdir=require(_0x6351('0x2'));var jsonpatch=require(_0x6351('0x3'));var rp=require(_0x6351('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6351('0x5'));var util=require(_0x6351('0x6'));var path=require(_0x6351('0x7'));var sox=require(_0x6351('0x8'));var csv=require(_0x6351('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6351('0xa'));var _=require(_0x6351('0xb'));var squel=require(_0x6351('0xc'));var crypto=require(_0x6351('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6351('0xe'));var toCsv=require(_0x6351('0x9'));var querystring=require(_0x6351('0xf'));var Papa=require(_0x6351('0x10'));var Redis=require(_0x6351('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6351('0x12'));var as=require(_0x6351('0x13'));var hardwareService=require(_0x6351('0x14'));var logger=require(_0x6351('0x15'))('api');var utils=require(_0x6351('0x16'));var config=require(_0x6351('0x17'));var licenseUtil=require(_0x6351('0x18'));var db=require(_0x6351('0x19'))['db'];function respondWithStatusCode(_0x4f9916,_0x215b98){_0x215b98=_0x215b98||0xcc;return function(_0xeb0b26){if(_0xeb0b26){return _0x4f9916['sendStatus'](_0x215b98);}return _0x4f9916[_0x6351('0x1a')](_0x215b98)['end']();};}function respondWithResult(_0x2de158,_0x50133e){_0x50133e=_0x50133e||0xc8;return function(_0x3e9f5a){if(_0x3e9f5a){return _0x2de158[_0x6351('0x1a')](_0x50133e)['json'](_0x3e9f5a);}};}function respondWithFilteredResult(_0x5d51a4,_0x565925){return function(_0x19cf8e){if(_0x19cf8e){var _0x34c164=typeof _0x565925[_0x6351('0x1b')]===_0x6351('0x1c')&&typeof _0x565925['limit']===_0x6351('0x1c');var _0x26c368=_0x19cf8e[_0x6351('0x1d')];var _0x59ce5d=_0x34c164?0x0:_0x565925[_0x6351('0x1b')];var _0x5597bd=_0x34c164?_0x19cf8e[_0x6351('0x1d')]:_0x565925['offset']+_0x565925[_0x6351('0x1e')];var _0x10002c;if(_0x5597bd>=_0x26c368){_0x5597bd=_0x26c368;_0x10002c=0xc8;}else{_0x10002c=0xce;}_0x5d51a4[_0x6351('0x1a')](_0x10002c);return _0x5d51a4[_0x6351('0x1f')](_0x6351('0x20'),_0x59ce5d+'-'+_0x5597bd+'/'+_0x26c368)[_0x6351('0x21')](_0x19cf8e);}return null;};}function patchUpdates(_0x38fc02){return function(_0x44cdcb){try{jsonpatch[_0x6351('0x22')](_0x44cdcb,_0x38fc02,!![]);}catch(_0x3c0986){return BPromise['reject'](_0x3c0986);}return _0x44cdcb[_0x6351('0x23')]();};}function saveUpdates(_0x3113ab,_0x5d373d){return function(_0x28de1d){if(_0x28de1d){return _0x28de1d[_0x6351('0x24')](_0x3113ab)[_0x6351('0x25')](function(_0x4f01c9){return _0x4f01c9;});}return null;};}function removeEntity(_0x4d813d,_0x4f1f7a){return function(_0xf200fe){if(_0xf200fe){return _0xf200fe[_0x6351('0x26')]()['then'](function(){var _0x2addb3=_0xf200fe[_0x6351('0x27')]({'plain':!![]});var _0x501674=_0x6351('0x28');return db[_0x6351('0x29')][_0x6351('0x26')]({'where':{'type':_0x501674,'resourceId':_0x2addb3['id']}})[_0x6351('0x25')](function(){return _0xf200fe;});})[_0x6351('0x25')](function(){_0x4d813d[_0x6351('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x336405,_0x16880e){return function(_0x2a36d4){if(!_0x2a36d4){_0x336405[_0x6351('0x2a')](0x194);}return _0x2a36d4;};}function handleError(_0x15d9d4,_0x6c862a){_0x6c862a=_0x6c862a||0x1f4;return function(_0x50ed1e){logger['error'](_0x50ed1e[_0x6351('0x2b')]);if(_0x50ed1e[_0x6351('0x2c')]){delete _0x50ed1e[_0x6351('0x2c')];}_0x15d9d4['status'](_0x6c862a)[_0x6351('0x2d')](_0x50ed1e);};}exports['index']=function(_0x3fd85e,_0x2f5471){var _0x4f19db={},_0x4a39da={},_0x8636b2={'count':0x0,'rows':[]};var _0x5e86aa=_[_0x6351('0x2e')](db['CmContactHasItem'][_0x6351('0x2f')],function(_0x468f1c){return{'name':_0x468f1c['fieldName'],'type':_0x468f1c[_0x6351('0x30')][_0x6351('0x31')]};});_0x4a39da[_0x6351('0x32')]=_['map'](_0x5e86aa,'name');_0x4a39da[_0x6351('0x33')]=_[_0x6351('0x34')](_0x3fd85e[_0x6351('0x33')]);_0x4a39da[_0x6351('0x35')]=_[_0x6351('0x36')](_0x4a39da[_0x6351('0x32')],_0x4a39da[_0x6351('0x33')]);_0x4f19db['attributes']=_[_0x6351('0x36')](_0x4a39da[_0x6351('0x32')],qs[_0x6351('0x37')](_0x3fd85e['query'][_0x6351('0x37')]));_0x4f19db[_0x6351('0x38')]=_0x4f19db[_0x6351('0x38')][_0x6351('0x39')]?_0x4f19db[_0x6351('0x38')]:_0x4a39da[_0x6351('0x32')];if(!_0x3fd85e['query']['hasOwnProperty'](_0x6351('0x3a'))){_0x4f19db[_0x6351('0x1e')]=qs[_0x6351('0x1e')](_0x3fd85e[_0x6351('0x33')][_0x6351('0x1e')]);_0x4f19db[_0x6351('0x1b')]=qs[_0x6351('0x1b')](_0x3fd85e[_0x6351('0x33')]['offset']);}_0x4f19db[_0x6351('0x3b')]=qs['sort'](_0x3fd85e['query'][_0x6351('0x3c')]);_0x4f19db[_0x6351('0x3d')]=qs[_0x6351('0x35')](_[_0x6351('0x3e')](_0x3fd85e[_0x6351('0x33')],_0x4a39da['filters']),_0x5e86aa);if(_0x3fd85e[_0x6351('0x33')][_0x6351('0x3f')]){_0x4f19db[_0x6351('0x3d')]=_[_0x6351('0x40')](_0x4f19db[_0x6351('0x3d')],{'$or':_[_0x6351('0x2e')](_0x5e86aa,function(_0x307860){if(_0x307860[_0x6351('0x30')]!==_0x6351('0x41')){var _0x444799={};_0x444799[_0x307860['name']]={'$like':'%'+_0x3fd85e['query'][_0x6351('0x3f')]+'%'};return _0x444799;}})});}_0x4f19db=_[_0x6351('0x40')]({},_0x4f19db,_0x3fd85e['options']);var _0x10b5ff={'where':_0x4f19db[_0x6351('0x3d')]};return db['CmContactHasItem'][_0x6351('0x1d')](_0x10b5ff)['then'](function(_0x46cb85){_0x8636b2[_0x6351('0x1d')]=_0x46cb85;if(_0x3fd85e[_0x6351('0x33')]['includeAll']){_0x4f19db['include']=[{'all':!![]}];}return db[_0x6351('0x42')]['findAll'](_0x4f19db);})[_0x6351('0x25')](function(_0x30621b){_0x8636b2['rows']=_0x30621b;return _0x8636b2;})[_0x6351('0x25')](respondWithFilteredResult(_0x2f5471,_0x4f19db))[_0x6351('0x43')](handleError(_0x2f5471,null));};exports['show']=function(_0x5bee84,_0x5e0c4a){var _0x67e19={'raw':!![],'where':{'id':_0x5bee84[_0x6351('0x44')]['id']}},_0x38a5b0={};_0x38a5b0[_0x6351('0x32')]=_[_0x6351('0x34')](db[_0x6351('0x42')][_0x6351('0x2f')]);_0x38a5b0[_0x6351('0x33')]=_['keys'](_0x5bee84[_0x6351('0x33')]);_0x38a5b0[_0x6351('0x35')]=_[_0x6351('0x36')](_0x38a5b0[_0x6351('0x32')],_0x38a5b0[_0x6351('0x33')]);_0x67e19[_0x6351('0x38')]=_[_0x6351('0x36')](_0x38a5b0['model'],qs[_0x6351('0x37')](_0x5bee84[_0x6351('0x33')][_0x6351('0x37')]));_0x67e19[_0x6351('0x38')]=_0x67e19[_0x6351('0x38')][_0x6351('0x39')]?_0x67e19[_0x6351('0x38')]:_0x38a5b0[_0x6351('0x32')];if(_0x5bee84[_0x6351('0x33')][_0x6351('0x45')]){_0x67e19[_0x6351('0x46')]=[{'all':!![]}];}_0x67e19=_[_0x6351('0x40')]({},_0x67e19,_0x5bee84[_0x6351('0x47')]);return db['CmContactHasItem'][_0x6351('0x48')](_0x67e19)['then'](handleEntityNotFound(_0x5e0c4a,null))[_0x6351('0x25')](respondWithResult(_0x5e0c4a,null))[_0x6351('0x43')](handleError(_0x5e0c4a,null));};exports[_0x6351('0x49')]=function(_0x396eb4,_0x46f391){return db[_0x6351('0x42')][_0x6351('0x49')](_0x396eb4[_0x6351('0x4a')],{})[_0x6351('0x25')](function(_0x7361f6){var _0x5e82dd=_0x396eb4[_0x6351('0x4b')]['get']({'plain':!![]});if(!_0x5e82dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e82dd[_0x6351('0x4c')]==='user'){var _0x494229=_0x7361f6[_0x6351('0x27')]({'plain':!![]});var _0x37356f=_0x6351('0x28');return db[_0x6351('0x4d')][_0x6351('0x48')]({'where':{'name':_0x37356f,'userProfileId':_0x5e82dd['userProfileId']},'raw':!![]})[_0x6351('0x25')](function(_0x1c1bab){if(_0x1c1bab&&_0x1c1bab[_0x6351('0x4e')]===0x0){return db[_0x6351('0x29')][_0x6351('0x49')]({'name':_0x494229[_0x6351('0x2c')],'resourceId':_0x494229['id'],'type':_0x1c1bab['name'],'sectionId':_0x1c1bab['id']},{})[_0x6351('0x25')](function(){return _0x7361f6;});}else{return _0x7361f6;}})[_0x6351('0x43')](function(_0x4f8f08){logger[_0x6351('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f8f08);throw _0x4f8f08;});}return _0x7361f6;})[_0x6351('0x25')](respondWithResult(_0x46f391,0xc9))[_0x6351('0x43')](handleError(_0x46f391,null));};exports[_0x6351('0x24')]=function(_0x200895,_0x61f94d){if(_0x200895[_0x6351('0x4a')]['id']){delete _0x200895[_0x6351('0x4a')]['id'];}return db['CmContactHasItem'][_0x6351('0x48')]({'where':{'id':_0x200895[_0x6351('0x44')]['id']}})[_0x6351('0x25')](handleEntityNotFound(_0x61f94d,null))[_0x6351('0x25')](saveUpdates(_0x200895['body'],null))[_0x6351('0x25')](respondWithResult(_0x61f94d,null))[_0x6351('0x43')](handleError(_0x61f94d,null));};exports[_0x6351('0x26')]=function(_0x3072df,_0x4212e7){return db[_0x6351('0x42')]['find']({'where':{'id':_0x3072df[_0x6351('0x44')]['id']}})['then'](handleEntityNotFound(_0x4212e7,null))['then'](removeEntity(_0x4212e7,null))[_0x6351('0x43')](handleError(_0x4212e7,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 356c61c..df5499f 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 _0xc139=['api','moment','bluebird','request-promise','path','./cmContactHasItem.attributes','define','CmContactHasItem','cm_contact_has_items','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc139,0x10d));var _0x9c13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc139[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9c13('0x0'))(_0x9c13('0x1'));var moment=require(_0x9c13('0x2'));var BPromise=require(_0x9c13('0x3'));var rp=require(_0x9c13('0x4'));var fs=require('fs');var path=require(_0x9c13('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9c13('0x6'));module['exports']=function(_0x4fb076,_0x6b12d6){return _0x4fb076[_0x9c13('0x7')](_0x9c13('0x8'),attributes,{'tableName':_0x9c13('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13f1=['define','CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x13f1,0xb3));var _0x113f=function(_0x4a31eb,_0x8a45a5){_0x4a31eb=_0x4a31eb-0x0;var _0x35e1c1=_0x13f1[_0x4a31eb];return _0x35e1c1;};'use strict';var _=require(_0x113f('0x0'));var util=require('util');var logger=require(_0x113f('0x1'))(_0x113f('0x2'));var moment=require('moment');var BPromise=require(_0x113f('0x3'));var rp=require(_0x113f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x113f('0x5'));var config=require(_0x113f('0x6'));var attributes=require('./cmContactHasItem.attributes');module[_0x113f('0x7')]=function(_0x508e2a,_0x2961e4){return _0x508e2a[_0x113f('0x8')](_0x113f('0x9'),attributes,{'tableName':_0x113f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 1b42630..ca48b18 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 _0xc799=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s'];(function(_0x11d512,_0x582dde){var _0x51eb6a=function(_0x4befbd){while(--_0x4befbd){_0x11d512['push'](_0x11d512['shift']());}};_0x51eb6a(++_0x582dde);}(_0xc799,0x90));var _0x9c79=function(_0x317f71,_0x281dbc){_0x317f71=_0x317f71-0x0;var _0x309d01=_0xc799[_0x317f71];return _0x309d01;};'use strict';var _=require(_0x9c79('0x0'));var util=require(_0x9c79('0x1'));var moment=require(_0x9c79('0x2'));var BPromise=require('bluebird');var rs=require(_0x9c79('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c79('0x4'))['db'];var utils=require(_0x9c79('0x5'));var logger=require(_0x9c79('0x6'))(_0x9c79('0x7'));var config=require(_0x9c79('0x8'));var jayson=require(_0x9c79('0x9'));var client=jayson[_0x9c79('0xa')][_0x9c79('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24495f,_0x35e385,_0x188089){return new BPromise(function(_0x29dcc9,_0x237d84){return client['request'](_0x24495f,_0x188089)[_0x9c79('0xc')](function(_0x4e0cad){logger['info'](_0x9c79('0xd'),_0x35e385,_0x9c79('0xe'));logger[_0x9c79('0xf')](_0x9c79('0x10'),_0x35e385,_0x9c79('0xe'),JSON[_0x9c79('0x11')](_0x4e0cad));if(_0x4e0cad[_0x9c79('0x12')]){if(_0x4e0cad['error'][_0x9c79('0x13')]===0x1f4){logger[_0x9c79('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x35e385,_0x4e0cad[_0x9c79('0x12')][_0x9c79('0x14')]);return _0x237d84(_0x4e0cad['error'][_0x9c79('0x14')]);}logger[_0x9c79('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x35e385,_0x4e0cad[_0x9c79('0x12')][_0x9c79('0x14')]);return _0x29dcc9(_0x4e0cad[_0x9c79('0x12')][_0x9c79('0x14')]);}else{logger['info'](_0x9c79('0xd'),_0x35e385,_0x9c79('0xe'));_0x29dcc9(_0x4e0cad[_0x9c79('0x15')][_0x9c79('0x14')]);}})[_0x9c79('0x16')](function(_0x2e5d4f){logger[_0x9c79('0x12')](_0x9c79('0xd'),_0x35e385,_0x2e5d4f);_0x237d84(_0x2e5d4f);});});} \ No newline at end of file +var _0x2bd7=['code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0xf8f6f1,_0x551483){var _0x51db61=function(_0x31f8af){while(--_0x31f8af){_0xf8f6f1['push'](_0xf8f6f1['shift']());}};_0x51db61(++_0x551483);}(_0x2bd7,0x192));var _0x72bd=function(_0x18179e,_0x25a7ef){_0x18179e=_0x18179e-0x0;var _0x1b862a=_0x2bd7[_0x18179e];return _0x1b862a;};'use strict';var _=require(_0x72bd('0x0'));var util=require(_0x72bd('0x1'));var moment=require(_0x72bd('0x2'));var BPromise=require(_0x72bd('0x3'));var rs=require(_0x72bd('0x4'));var fs=require('fs');var Redis=require(_0x72bd('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x72bd('0x6'))(_0x72bd('0x7'));var config=require(_0x72bd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x72bd('0x9')][_0x72bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ca6c8,_0x12291a,_0x2e9667){return new BPromise(function(_0x175f13,_0xbe53d9){return client['request'](_0x5ca6c8,_0x2e9667)[_0x72bd('0xb')](function(_0x6c2de8){logger[_0x72bd('0xc')](_0x72bd('0xd'),_0x12291a,'request\x20sent');logger[_0x72bd('0xe')](_0x72bd('0xf'),_0x12291a,_0x72bd('0x10'),JSON['stringify'](_0x6c2de8));if(_0x6c2de8[_0x72bd('0x11')]){if(_0x6c2de8[_0x72bd('0x11')][_0x72bd('0x12')]===0x1f4){logger['error'](_0x72bd('0xd'),_0x12291a,_0x6c2de8[_0x72bd('0x11')][_0x72bd('0x13')]);return _0xbe53d9(_0x6c2de8['error']['message']);}logger[_0x72bd('0x11')](_0x72bd('0xd'),_0x12291a,_0x6c2de8[_0x72bd('0x11')][_0x72bd('0x13')]);return _0x175f13(_0x6c2de8['error']['message']);}else{logger[_0x72bd('0xc')](_0x72bd('0xd'),_0x12291a,_0x72bd('0x10'));_0x175f13(_0x6c2de8['result'][_0x72bd('0x13')]);}})['catch'](function(_0x2d2282){logger['error'](_0x72bd('0xd'),_0x12291a,_0x2d2282);_0xbe53d9(_0x2d2282);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 2fdd59d..ac5ffd7 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 _0xace6=['./cmContactHasItem.controller','get','isAuthenticated','show','post','create','put','/:id','delete','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x21a8b9,_0x590b43){var _0x22068e=function(_0x494e48){while(--_0x494e48){_0x21a8b9['push'](_0x21a8b9['shift']());}};_0x22068e(++_0x590b43);}(_0xace6,0xd5));var _0x6ace=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xace6[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x6ace('0x0'));var util=require(_0x6ace('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6ace('0x2'));var router=express[_0x6ace('0x3')]();var fs_extra=require(_0x6ace('0x4'));var auth=require(_0x6ace('0x5'));var interaction=require(_0x6ace('0x6'));var config=require(_0x6ace('0x7'));var controller=require(_0x6ace('0x8'));router[_0x6ace('0x9')]('/',auth[_0x6ace('0xa')](),controller['index']);router[_0x6ace('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6ace('0xb')]);router[_0x6ace('0xc')]('/',auth[_0x6ace('0xa')](),controller[_0x6ace('0xd')]);router[_0x6ace('0xe')](_0x6ace('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x6ace('0x10')](_0x6ace('0xf'),auth[_0x6ace('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x316b=['destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x316b,0x17e));var _0xb316=function(_0x369289,_0xb779d8){_0x369289=_0x369289-0x0;var _0x1c8ba4=_0x316b[_0x369289];return _0x1c8ba4;};'use strict';var multer=require(_0xb316('0x0'));var util=require('util');var path=require(_0xb316('0x1'));var timeout=require('connect-timeout');var express=require(_0xb316('0x2'));var router=express[_0xb316('0x3')]();var fs_extra=require(_0xb316('0x4'));var auth=require(_0xb316('0x5'));var interaction=require(_0xb316('0x6'));var config=require(_0xb316('0x7'));var controller=require(_0xb316('0x8'));router['get']('/',auth[_0xb316('0x9')](),controller[_0xb316('0xa')]);router[_0xb316('0xb')](_0xb316('0xc'),auth['isAuthenticated'](),controller[_0xb316('0xd')]);router[_0xb316('0xe')]('/',auth['isAuthenticated'](),controller[_0xb316('0xf')]);router[_0xb316('0x10')](_0xb316('0xc'),auth[_0xb316('0x9')](),controller['update']);router[_0xb316('0x11')](_0xb316('0xc'),auth[_0xb316('0x9')](),controller[_0xb316('0x12')]);module[_0xb316('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 51d44c4..9f9703f 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 _0x6ec8=['setDataValue','name','TEXT','long','type','parse','values','stringify','BOOLEAN','ENUM','voice','sequelize','VIRTUAL','getDataValue','alias','STRING'];(function(_0x269059,_0x412dd1){var _0x5ed42c=function(_0x5a2269){while(--_0x5a2269){_0x269059['push'](_0x269059['shift']());}};_0x5ed42c(++_0x412dd1);}(_0x6ec8,0x12b));var _0x86ec=function(_0x33f5de,_0x5e4f9e){_0x33f5de=_0x33f5de-0x0;var _0x1add2f=_0x6ec8[_0x33f5de];return _0x1add2f;};'use strict';var Sequelize=require(_0x86ec('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x86ec('0x1')],'get':function(_0x432c42){return this[_0x86ec('0x2')](_0x86ec('0x3'));}},'alias':{'type':Sequelize[_0x86ec('0x4')],'allowNull':![],'set':function(_0x32d0f2){this[_0x86ec('0x5')]('alias',_0x32d0f2?_0x32d0f2:this[_0x86ec('0x2')](_0x86ec('0x6')));}},'type':{'type':Sequelize[_0x86ec('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x86ec('0x7')](_0x86ec('0x8')),'get':function(){if(this[_0x86ec('0x2')](_0x86ec('0x9'))==='select'){return JSON[_0x86ec('0xa')](this[_0x86ec('0x2')](_0x86ec('0xb')));}else{return this[_0x86ec('0x2')](_0x86ec('0xb'));}},'set':function(_0x3a60e7){if(Array['isArray'](_0x3a60e7)){this[_0x86ec('0x5')](_0x86ec('0xb'),JSON[_0x86ec('0xc')](_0x3a60e7));}else{this[_0x86ec('0x5')]('values',_0x3a60e7);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x86ec('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x86ec('0xe')](_0x86ec('0xf'))}}; \ No newline at end of file +var _0x7c9c=['TEXT','long','parse','values','isArray','BOOLEAN','ENUM','voice','sequelize','lodash','VIRTUAL','getDataValue','alias','STRING','setDataValue','name'];(function(_0x393ab1,_0x6491b4){var _0x418b71=function(_0x23d013){while(--_0x23d013){_0x393ab1['push'](_0x393ab1['shift']());}};_0x418b71(++_0x6491b4);}(_0x7c9c,0x98));var _0xc7c9=function(_0x4f51cb,_0x3d7bd4){_0x4f51cb=_0x4f51cb-0x0;var _0x4b34b1=_0x7c9c[_0x4f51cb];return _0x4b34b1;};'use strict';var Sequelize=require(_0xc7c9('0x0'));var _=require(_0xc7c9('0x1'));module['exports']={'name':{'type':Sequelize[_0xc7c9('0x2')],'get':function(_0x168e1d){return this[_0xc7c9('0x3')](_0xc7c9('0x4'));}},'alias':{'type':Sequelize[_0xc7c9('0x5')],'allowNull':![],'set':function(_0x459cc0){this[_0xc7c9('0x6')](_0xc7c9('0x4'),_0x459cc0?_0x459cc0:this['getDataValue'](_0xc7c9('0x7')));}},'type':{'type':Sequelize[_0xc7c9('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xc7c9('0x8')](_0xc7c9('0x9')),'get':function(){if(this['getDataValue']('type')==='select'){return JSON[_0xc7c9('0xa')](this[_0xc7c9('0x3')](_0xc7c9('0xb')));}else{return this[_0xc7c9('0x3')](_0xc7c9('0xb'));}},'set':function(_0x224cd0){if(Array[_0xc7c9('0xc')](_0x224cd0)){this['setDataValue'](_0xc7c9('0xb'),JSON['stringify'](_0x224cd0));}else{this['setDataValue'](_0xc7c9('0xb'),_0x224cd0);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xc7c9('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xc7c9('0xe')](_0xc7c9('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index ff4a4e8..4708c05 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 _0x7bd7=['cf_%d','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','keys','options','find','catch','body','sequelize','transaction','create','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','format'];(function(_0x213dee,_0x4acf64){var _0x4501ac=function(_0x185531){while(--_0x185531){_0x213dee['push'](_0x213dee['shift']());}};_0x4501ac(++_0x4acf64);}(_0x7bd7,0xfd));var _0x77bd=function(_0x326406,_0x2db752){_0x326406=_0x326406-0x0;var _0x1a733c=_0x7bd7[_0x326406];return _0x1a733c;};'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(_0x77bd('0x0'));var moment=require(_0x77bd('0x1'));var BPromise=require(_0x77bd('0x2'));var Mustache=require(_0x77bd('0x3'));var util=require('util');var path=require('path');var sox=require(_0x77bd('0x4'));var csv=require(_0x77bd('0x5'));var ejs=require(_0x77bd('0x6'));var fs=require('fs');var fs_extra=require(_0x77bd('0x7'));var _=require(_0x77bd('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x77bd('0x9'));var toCsv=require(_0x77bd('0x5'));var querystring=require(_0x77bd('0xa'));var Papa=require(_0x77bd('0xb'));var Redis=require(_0x77bd('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x77bd('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x77bd('0xe'))(_0x77bd('0xf'));var utils=require('../../config/utils');var config=require(_0x77bd('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x77bd('0x11'))['db'];function respondWithStatusCode(_0x500bca,_0x4be9ac){_0x4be9ac=_0x4be9ac||0xcc;return function(_0x5d54d0){if(_0x5d54d0){return _0x500bca[_0x77bd('0x12')](_0x4be9ac);}return _0x500bca[_0x77bd('0x13')](_0x4be9ac)[_0x77bd('0x14')]();};}function respondWithResult(_0x5d810a,_0x44c06d){_0x44c06d=_0x44c06d||0xc8;return function(_0x42f749){if(_0x42f749){return _0x5d810a['status'](_0x44c06d)[_0x77bd('0x15')](_0x42f749);}};}function respondWithFilteredResult(_0x4a9a24,_0x2c05ae){return function(_0x329a6a){if(_0x329a6a){var _0x3a3dea=typeof _0x2c05ae['offset']===_0x77bd('0x16')&&typeof _0x2c05ae[_0x77bd('0x17')]===_0x77bd('0x16');var _0x4c43f8=_0x329a6a['count'];var _0x3ad631=_0x3a3dea?0x0:_0x2c05ae['offset'];var _0x10da7a=_0x3a3dea?_0x329a6a[_0x77bd('0x18')]:_0x2c05ae['offset']+_0x2c05ae[_0x77bd('0x17')];var _0x462bc0;if(_0x10da7a>=_0x4c43f8){_0x10da7a=_0x4c43f8;_0x462bc0=0xc8;}else{_0x462bc0=0xce;}_0x4a9a24[_0x77bd('0x13')](_0x462bc0);return _0x4a9a24['set']('Content-Range',_0x3ad631+'-'+_0x10da7a+'/'+_0x4c43f8)['json'](_0x329a6a);}return null;};}function patchUpdates(_0x439b7e){return function(_0x54a4df){try{jsonpatch[_0x77bd('0x19')](_0x54a4df,_0x439b7e,!![]);}catch(_0x9c620d){return BPromise[_0x77bd('0x1a')](_0x9c620d);}return _0x54a4df[_0x77bd('0x1b')]();};}function saveUpdates(_0x3e04c,_0x512bb7){return function(_0x522a39){if(_0x522a39){return _0x522a39[_0x77bd('0x1c')](_0x3e04c)[_0x77bd('0x1d')](function(_0x1ce4b2){return _0x1ce4b2;});}return null;};}function removeEntity(_0x54b152,_0x1ee679){return function(_0x415f42){if(_0x415f42){return _0x415f42[_0x77bd('0x1e')]()[_0x77bd('0x1d')](function(){_0x54b152[_0x77bd('0x13')](0xcc)[_0x77bd('0x14')]();});}};}function handleEntityNotFound(_0x3536da,_0x50e7db){return function(_0x2a5f80){if(!_0x2a5f80){_0x3536da['sendStatus'](0x194);}return _0x2a5f80;};}function handleError(_0x3db0bd,_0x3b612a){_0x3b612a=_0x3b612a||0x1f4;return function(_0x1778d8){logger[_0x77bd('0x1f')](_0x1778d8[_0x77bd('0x20')]);if(_0x1778d8[_0x77bd('0x21')]){delete _0x1778d8[_0x77bd('0x21')];}_0x3db0bd[_0x77bd('0x13')](_0x3b612a)[_0x77bd('0x22')](_0x1778d8);};}exports[_0x77bd('0x23')]=function(_0x3e7071,_0x2fc36d){var _0x5f081d={},_0x4799b5={},_0x43d2e0={'count':0x0,'rows':[]};var _0x1689d9=_[_0x77bd('0x24')](db[_0x77bd('0x25')][_0x77bd('0x26')],function(_0x28fd05){return{'name':_0x28fd05[_0x77bd('0x27')],'type':_0x28fd05[_0x77bd('0x28')]['key']};});_0x4799b5[_0x77bd('0x29')]=_[_0x77bd('0x2a')](_[_0x77bd('0x24')](_0x1689d9,'name'),[_0x77bd('0x21')]);_0x4799b5['query']=_['keys'](_0x3e7071[_0x77bd('0x2b')]);_0x4799b5[_0x77bd('0x2c')]=_[_0x77bd('0x2d')](_0x4799b5[_0x77bd('0x29')],_0x4799b5['query']);_0x5f081d[_0x77bd('0x2e')]=_[_0x77bd('0x2d')](_0x4799b5[_0x77bd('0x29')],qs[_0x77bd('0x2f')](_0x3e7071[_0x77bd('0x2b')][_0x77bd('0x2f')]));_0x5f081d[_0x77bd('0x2e')]=_0x5f081d[_0x77bd('0x2e')][_0x77bd('0x30')]?_0x5f081d[_0x77bd('0x2e')]:_0x4799b5[_0x77bd('0x29')];if(!_0x3e7071[_0x77bd('0x2b')][_0x77bd('0x31')](_0x77bd('0x32'))){_0x5f081d[_0x77bd('0x17')]=qs['limit'](_0x3e7071['query'][_0x77bd('0x17')]);_0x5f081d['offset']=qs['offset'](_0x3e7071['query'][_0x77bd('0x33')]);}_0x5f081d[_0x77bd('0x34')]=qs[_0x77bd('0x35')](_0x3e7071[_0x77bd('0x2b')][_0x77bd('0x35')]);_0x5f081d[_0x77bd('0x36')]=qs[_0x77bd('0x2c')](_[_0x77bd('0x37')](_0x3e7071['query'],_0x4799b5[_0x77bd('0x2c')]),_0x1689d9);if(_0x3e7071[_0x77bd('0x2b')][_0x77bd('0x38')]){_0x5f081d['where']=_[_0x77bd('0x39')](_0x5f081d['where'],{'$or':_[_0x77bd('0x24')](_0x1689d9,function(_0x581fd1){if(_0x581fd1[_0x77bd('0x28')]!==_0x77bd('0x3a')){var _0x3dc6bc={};_0x3dc6bc[_0x581fd1[_0x77bd('0x21')]]={'$like':'%'+_0x3e7071[_0x77bd('0x2b')][_0x77bd('0x38')]+'%'};return _0x3dc6bc;}})});}_0x5f081d=_[_0x77bd('0x39')]({},_0x5f081d,_0x3e7071['options']);var _0x4092ee={'where':_0x5f081d['where']};return db[_0x77bd('0x25')]['count'](_0x4092ee)[_0x77bd('0x1d')](function(_0x1c68f4){_0x43d2e0[_0x77bd('0x18')]=_0x1c68f4;if(_0x3e7071[_0x77bd('0x2b')][_0x77bd('0x3b')]){_0x5f081d[_0x77bd('0x3c')]=[{'all':!![]}];}return db[_0x77bd('0x25')][_0x77bd('0x3d')](_0x5f081d);})['then'](function(_0x507018){_0x43d2e0[_0x77bd('0x3e')]=_0x507018;return _0x43d2e0;})[_0x77bd('0x1d')](respondWithFilteredResult(_0x2fc36d,_0x5f081d))['catch'](handleError(_0x2fc36d,null));};exports['show']=function(_0x332cb6,_0x5d0370){var _0x5c470f={'raw':!![],'where':{'id':_0x332cb6[_0x77bd('0x3f')]['id']}},_0x2e3bb3={};_0x2e3bb3[_0x77bd('0x29')]=_[_0x77bd('0x40')](db['CmCustomField']['rawAttributes']);_0x2e3bb3['query']=_[_0x77bd('0x40')](_0x332cb6[_0x77bd('0x2b')]);_0x2e3bb3[_0x77bd('0x2c')]=_[_0x77bd('0x2d')](_0x2e3bb3[_0x77bd('0x29')],_0x2e3bb3[_0x77bd('0x2b')]);_0x5c470f[_0x77bd('0x2e')]=_[_0x77bd('0x2d')](_0x2e3bb3[_0x77bd('0x29')],qs[_0x77bd('0x2f')](_0x332cb6[_0x77bd('0x2b')][_0x77bd('0x2f')]));_0x5c470f['attributes']=_0x5c470f[_0x77bd('0x2e')][_0x77bd('0x30')]?_0x5c470f['attributes']:_0x2e3bb3['model'];if(_0x332cb6['query']['includeAll']){_0x5c470f[_0x77bd('0x3c')]=[{'all':!![]}];}_0x5c470f=_['merge']({},_0x5c470f,_0x332cb6[_0x77bd('0x41')]);return db[_0x77bd('0x25')][_0x77bd('0x42')](_0x5c470f)['then'](handleEntityNotFound(_0x5d0370,null))[_0x77bd('0x1d')](respondWithResult(_0x5d0370,null))[_0x77bd('0x43')](handleError(_0x5d0370,null));};exports[_0x77bd('0x1c')]=function(_0x1bf789,_0x208de8){if(_0x1bf789[_0x77bd('0x44')]['id']){delete _0x1bf789['body']['id'];}return db[_0x77bd('0x25')][_0x77bd('0x42')]({'where':{'id':_0x1bf789[_0x77bd('0x3f')]['id']}})['then'](handleEntityNotFound(_0x208de8,null))['then'](saveUpdates(_0x1bf789[_0x77bd('0x44')],null))['then'](respondWithResult(_0x208de8,null))['catch'](handleError(_0x208de8,null));};exports[_0x77bd('0x1e')]=function(_0x1369c5,_0x23a61d){return db['CmCustomField'][_0x77bd('0x42')]({'where':{'id':_0x1369c5[_0x77bd('0x3f')]['id']}})[_0x77bd('0x1d')](handleEntityNotFound(_0x23a61d,null))[_0x77bd('0x1d')](removeEntity(_0x23a61d,null))['catch'](handleError(_0x23a61d,null));};exports['create']=function(_0x24d0eb,_0x5b6fac){var _0x447989;return db[_0x77bd('0x45')][_0x77bd('0x46')](function(_0x2ac06f){return db[_0x77bd('0x25')][_0x77bd('0x47')](_0x24d0eb['body'],{'transaction':_0x2ac06f})[_0x77bd('0x1d')](function(_0x30fbf3){_0x447989=_0x30fbf3;var _0x4ae3dc={'type':db[_0x77bd('0x48')][_0x77bd('0x49')],'transaction':_0x2ac06f};switch(_0x24d0eb[_0x77bd('0x44')]['type']){case _0x77bd('0x4a'):_0x4ae3dc[_0x77bd('0x28')]=db[_0x77bd('0x48')][_0x77bd('0x49')];break;case _0x77bd('0x4b'):_0x4ae3dc[_0x77bd('0x28')]=db[_0x77bd('0x48')][_0x77bd('0x4c')];break;case _0x77bd('0x4d'):_0x4ae3dc['type']=db[_0x77bd('0x48')]['BOOLEAN'];_0x4ae3dc[_0x77bd('0x4e')]=![];break;default:}return db[_0x77bd('0x45')][_0x77bd('0x4f')][_0x77bd('0x50')](_0x77bd('0x51'),util[_0x77bd('0x52')](_0x77bd('0x53'),_0x447989['id']),_0x4ae3dc);})['then'](function(){return _0x447989;});})['then'](respondWithResult(_0x5b6fac,0xc9))['catch'](handleError(_0x5b6fac,null));}; \ No newline at end of file +var _0x4680=['Content-Range','apply','reject','destroy','then','error','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','keys','query','filters','intersection','attributes','nolimit','limit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','fields','length','find','sequelize','create','body','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','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','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','set'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x4680,0x1d9));var _0x0468=function(_0x138151,_0x4c8480){_0x138151=_0x138151-0x0;var _0x31717e=_0x4680[_0x138151];return _0x31717e;};'use strict';var emlformat=require(_0x0468('0x0'));var rimraf=require(_0x0468('0x1'));var zipdir=require(_0x0468('0x2'));var jsonpatch=require(_0x0468('0x3'));var rp=require('request-promise');var moment=require(_0x0468('0x4'));var BPromise=require(_0x0468('0x5'));var Mustache=require('mustache');var util=require(_0x0468('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0468('0x7'));var ejs=require(_0x0468('0x8'));var fs=require('fs');var fs_extra=require(_0x0468('0x9'));var _=require(_0x0468('0xa'));var squel=require(_0x0468('0xb'));var crypto=require(_0x0468('0xc'));var jsforce=require(_0x0468('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0468('0x7'));var querystring=require(_0x0468('0xe'));var Papa=require(_0x0468('0xf'));var Redis=require(_0x0468('0x10'));var authService=require(_0x0468('0x11'));var qs=require(_0x0468('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0468('0x13'));var logger=require(_0x0468('0x14'))('api');var utils=require(_0x0468('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0468('0x16'))['db'];function respondWithStatusCode(_0x3b36d5,_0x19bc34){_0x19bc34=_0x19bc34||0xcc;return function(_0x58a0c8){if(_0x58a0c8){return _0x3b36d5[_0x0468('0x17')](_0x19bc34);}return _0x3b36d5['status'](_0x19bc34)[_0x0468('0x18')]();};}function respondWithResult(_0x3aeffa,_0xab9fad){_0xab9fad=_0xab9fad||0xc8;return function(_0x4bfb13){if(_0x4bfb13){return _0x3aeffa['status'](_0xab9fad)[_0x0468('0x19')](_0x4bfb13);}};}function respondWithFilteredResult(_0x56d59b,_0x2bc69f){return function(_0x651423){if(_0x651423){var _0x5051a8=typeof _0x2bc69f[_0x0468('0x1a')]===_0x0468('0x1b')&&typeof _0x2bc69f['limit']==='undefined';var _0x34b7b1=_0x651423[_0x0468('0x1c')];var _0x918bf5=_0x5051a8?0x0:_0x2bc69f[_0x0468('0x1a')];var _0x2756dc=_0x5051a8?_0x651423[_0x0468('0x1c')]:_0x2bc69f[_0x0468('0x1a')]+_0x2bc69f['limit'];var _0xf8c1ed;if(_0x2756dc>=_0x34b7b1){_0x2756dc=_0x34b7b1;_0xf8c1ed=0xc8;}else{_0xf8c1ed=0xce;}_0x56d59b[_0x0468('0x1d')](_0xf8c1ed);return _0x56d59b[_0x0468('0x1e')](_0x0468('0x1f'),_0x918bf5+'-'+_0x2756dc+'/'+_0x34b7b1)[_0x0468('0x19')](_0x651423);}return null;};}function patchUpdates(_0x12a264){return function(_0x56019d){try{jsonpatch[_0x0468('0x20')](_0x56019d,_0x12a264,!![]);}catch(_0x4de9c6){return BPromise[_0x0468('0x21')](_0x4de9c6);}return _0x56019d['save']();};}function saveUpdates(_0x1e76d9,_0x58a3e7){return function(_0x53e4c5){if(_0x53e4c5){return _0x53e4c5['update'](_0x1e76d9)['then'](function(_0x18502e){return _0x18502e;});}return null;};}function removeEntity(_0x1d471a,_0x4cf96b){return function(_0x516f50){if(_0x516f50){return _0x516f50[_0x0468('0x22')]()[_0x0468('0x23')](function(){_0x1d471a['status'](0xcc)[_0x0468('0x18')]();});}};}function handleEntityNotFound(_0x44f103,_0x585030){return function(_0x1efbd7){if(!_0x1efbd7){_0x44f103['sendStatus'](0x194);}return _0x1efbd7;};}function handleError(_0x2e4c7c,_0x2cb3ba){_0x2cb3ba=_0x2cb3ba||0x1f4;return function(_0x3e1650){logger[_0x0468('0x24')](_0x3e1650['stack']);if(_0x3e1650[_0x0468('0x25')]){delete _0x3e1650[_0x0468('0x25')];}_0x2e4c7c[_0x0468('0x1d')](_0x2cb3ba)[_0x0468('0x26')](_0x3e1650);};}exports[_0x0468('0x27')]=function(_0x17e990,_0x4ffa95){var _0x1a876a={},_0x39ff4d={},_0x953a86={'count':0x0,'rows':[]};var _0x528637=_[_0x0468('0x28')](db[_0x0468('0x29')][_0x0468('0x2a')],function(_0x38755d){return{'name':_0x38755d[_0x0468('0x2b')],'type':_0x38755d[_0x0468('0x2c')][_0x0468('0x2d')]};});_0x39ff4d[_0x0468('0x2e')]=_[_0x0468('0x2f')](_[_0x0468('0x28')](_0x528637,'name'),[_0x0468('0x25')]);_0x39ff4d['query']=_[_0x0468('0x30')](_0x17e990[_0x0468('0x31')]);_0x39ff4d[_0x0468('0x32')]=_[_0x0468('0x33')](_0x39ff4d[_0x0468('0x2e')],_0x39ff4d[_0x0468('0x31')]);_0x1a876a['attributes']=_['intersection'](_0x39ff4d[_0x0468('0x2e')],qs['fields'](_0x17e990[_0x0468('0x31')]['fields']));_0x1a876a[_0x0468('0x34')]=_0x1a876a[_0x0468('0x34')]['length']?_0x1a876a[_0x0468('0x34')]:_0x39ff4d['model'];if(!_0x17e990[_0x0468('0x31')]['hasOwnProperty'](_0x0468('0x35'))){_0x1a876a[_0x0468('0x36')]=qs[_0x0468('0x36')](_0x17e990['query'][_0x0468('0x36')]);_0x1a876a[_0x0468('0x1a')]=qs[_0x0468('0x1a')](_0x17e990[_0x0468('0x31')][_0x0468('0x1a')]);}_0x1a876a[_0x0468('0x37')]=qs[_0x0468('0x38')](_0x17e990['query'][_0x0468('0x38')]);_0x1a876a[_0x0468('0x39')]=qs['filters'](_['pick'](_0x17e990[_0x0468('0x31')],_0x39ff4d[_0x0468('0x32')]),_0x528637);if(_0x17e990['query'][_0x0468('0x3a')]){_0x1a876a['where']=_[_0x0468('0x3b')](_0x1a876a['where'],{'$or':_[_0x0468('0x28')](_0x528637,function(_0xef6b22){if(_0xef6b22['type']!=='VIRTUAL'){var _0x31da38={};_0x31da38[_0xef6b22[_0x0468('0x25')]]={'$like':'%'+_0x17e990[_0x0468('0x31')]['filter']+'%'};return _0x31da38;}})});}_0x1a876a=_[_0x0468('0x3b')]({},_0x1a876a,_0x17e990[_0x0468('0x3c')]);var _0x4cd6f8={'where':_0x1a876a[_0x0468('0x39')]};return db['CmCustomField'][_0x0468('0x1c')](_0x4cd6f8)[_0x0468('0x23')](function(_0x343cd3){_0x953a86[_0x0468('0x1c')]=_0x343cd3;if(_0x17e990['query'][_0x0468('0x3d')]){_0x1a876a[_0x0468('0x3e')]=[{'all':!![]}];}return db[_0x0468('0x29')]['findAll'](_0x1a876a);})[_0x0468('0x23')](function(_0x450311){_0x953a86[_0x0468('0x3f')]=_0x450311;return _0x953a86;})[_0x0468('0x23')](respondWithFilteredResult(_0x4ffa95,_0x1a876a))[_0x0468('0x40')](handleError(_0x4ffa95,null));};exports[_0x0468('0x41')]=function(_0x40af25,_0x34c6ea){var _0x499195={'raw':!![],'where':{'id':_0x40af25[_0x0468('0x42')]['id']}},_0x488eb8={};_0x488eb8[_0x0468('0x2e')]=_['keys'](db['CmCustomField'][_0x0468('0x2a')]);_0x488eb8[_0x0468('0x31')]=_[_0x0468('0x30')](_0x40af25[_0x0468('0x31')]);_0x488eb8[_0x0468('0x32')]=_[_0x0468('0x33')](_0x488eb8[_0x0468('0x2e')],_0x488eb8[_0x0468('0x31')]);_0x499195['attributes']=_[_0x0468('0x33')](_0x488eb8[_0x0468('0x2e')],qs['fields'](_0x40af25['query'][_0x0468('0x43')]));_0x499195[_0x0468('0x34')]=_0x499195[_0x0468('0x34')][_0x0468('0x44')]?_0x499195[_0x0468('0x34')]:_0x488eb8[_0x0468('0x2e')];if(_0x40af25['query'][_0x0468('0x3d')]){_0x499195[_0x0468('0x3e')]=[{'all':!![]}];}_0x499195=_['merge']({},_0x499195,_0x40af25[_0x0468('0x3c')]);return db[_0x0468('0x29')][_0x0468('0x45')](_0x499195)[_0x0468('0x23')](handleEntityNotFound(_0x34c6ea,null))['then'](respondWithResult(_0x34c6ea,null))['catch'](handleError(_0x34c6ea,null));};exports['update']=function(_0x3240ac,_0x22aa78){if(_0x3240ac['body']['id']){delete _0x3240ac['body']['id'];}return db['CmCustomField'][_0x0468('0x45')]({'where':{'id':_0x3240ac[_0x0468('0x42')]['id']}})[_0x0468('0x23')](handleEntityNotFound(_0x22aa78,null))[_0x0468('0x23')](saveUpdates(_0x3240ac['body'],null))[_0x0468('0x23')](respondWithResult(_0x22aa78,null))[_0x0468('0x40')](handleError(_0x22aa78,null));};exports[_0x0468('0x22')]=function(_0x10c17d,_0x10c6c7){return db[_0x0468('0x29')][_0x0468('0x45')]({'where':{'id':_0x10c17d[_0x0468('0x42')]['id']}})[_0x0468('0x23')](handleEntityNotFound(_0x10c6c7,null))[_0x0468('0x23')](removeEntity(_0x10c6c7,null))[_0x0468('0x40')](handleError(_0x10c6c7,null));};exports['create']=function(_0x104567,_0x5c9969){var _0x1daa1e;return db[_0x0468('0x46')]['transaction'](function(_0x31b845){return db['CmCustomField'][_0x0468('0x47')](_0x104567[_0x0468('0x48')],{'transaction':_0x31b845})[_0x0468('0x23')](function(_0xc867){_0x1daa1e=_0xc867;var _0x2ea7f2={'type':db[_0x0468('0x49')][_0x0468('0x4a')],'transaction':_0x31b845};switch(_0x104567[_0x0468('0x48')][_0x0468('0x2c')]){case _0x0468('0x4b'):_0x2ea7f2[_0x0468('0x2c')]=db['Sequelize'][_0x0468('0x4a')];break;case'number':_0x2ea7f2['type']=db[_0x0468('0x49')][_0x0468('0x4c')];break;case _0x0468('0x4d'):_0x2ea7f2[_0x0468('0x2c')]=db[_0x0468('0x49')][_0x0468('0x4e')];_0x2ea7f2[_0x0468('0x4f')]=![];break;default:}return db[_0x0468('0x46')]['queryInterface'][_0x0468('0x50')](_0x0468('0x51'),util[_0x0468('0x52')](_0x0468('0x53'),_0x1daa1e['id']),_0x2ea7f2);})[_0x0468('0x23')](function(){return _0x1daa1e;});})[_0x0468('0x23')](respondWithResult(_0x5c9969,0xc9))['catch'](handleError(_0x5c9969,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index b4e281c..f68d62b 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 _0x6de5=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x6de5,0x110));var _0x56de=function(_0x56ff9d,_0x49c65f){_0x56ff9d=_0x56ff9d-0x0;var _0xb56b04=_0x6de5[_0x56ff9d];return _0xb56b04;};'use strict';var _=require(_0x56de('0x0'));var util=require(_0x56de('0x1'));var logger=require(_0x56de('0x2'))(_0x56de('0x3'));var moment=require(_0x56de('0x4'));var BPromise=require('bluebird');var rp=require(_0x56de('0x5'));var fs=require('fs');var path=require(_0x56de('0x6'));var rimraf=require('rimraf');var config=require(_0x56de('0x7'));var attributes=require(_0x56de('0x8'));module[_0x56de('0x9')]=function(_0x342976,_0x1de345){return _0x342976[_0x56de('0xa')](_0x56de('0xb'),attributes,{'tableName':_0x56de('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4647=['define','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmCustomField.attributes'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x4647,0x1be));var _0x7464=function(_0x21ec1f,_0x39bb8a){_0x21ec1f=_0x21ec1f-0x0;var _0x5c7b62=_0x4647[_0x21ec1f];return _0x5c7b62;};'use strict';var _=require(_0x7464('0x0'));var util=require(_0x7464('0x1'));var logger=require(_0x7464('0x2'))(_0x7464('0x3'));var moment=require(_0x7464('0x4'));var BPromise=require(_0x7464('0x5'));var rp=require(_0x7464('0x6'));var fs=require('fs');var path=require(_0x7464('0x7'));var rimraf=require(_0x7464('0x8'));var config=require('../../config/environment');var attributes=require(_0x7464('0x9'));module['exports']=function(_0x284933,_0xaacf83){return _0x284933[_0x7464('0xa')]('CmCustomField',attributes,{'tableName':_0x7464('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 644cd3f..6a80ec5 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 _0x035c=['CmCustomField,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x12270b,_0x6f9487){var _0x563370=function(_0x39f2a2){while(--_0x39f2a2){_0x12270b['push'](_0x12270b['shift']());}};_0x563370(++_0x6f9487);}(_0x035c,0x7c));var _0xc035=function(_0xa5d0c7,_0x4b3095){_0xa5d0c7=_0xa5d0c7-0x0;var _0x4e74a5=_0x035c[_0xa5d0c7];return _0x4e74a5;};'use strict';var _=require(_0xc035('0x0'));var util=require('util');var moment=require(_0xc035('0x1'));var BPromise=require(_0xc035('0x2'));var rs=require(_0xc035('0x3'));var fs=require('fs');var Redis=require(_0xc035('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc035('0x5'));var logger=require(_0xc035('0x6'))('rpc');var config=require(_0xc035('0x7'));var jayson=require(_0xc035('0x8'));var client=jayson[_0xc035('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41b540,_0x37138a,_0x4d0555){return new BPromise(function(_0x33c201,_0x47f60f){return client[_0xc035('0xa')](_0x41b540,_0x4d0555)['then'](function(_0xe5cf6d){logger['info']('CmCustomField,\x20%s,\x20%s',_0x37138a,_0xc035('0xb'));logger[_0xc035('0xc')](_0xc035('0xd'),_0x37138a,'request\x20sent',JSON['stringify'](_0xe5cf6d));if(_0xe5cf6d[_0xc035('0xe')]){if(_0xe5cf6d['error'][_0xc035('0xf')]===0x1f4){logger[_0xc035('0xe')](_0xc035('0x10'),_0x37138a,_0xe5cf6d[_0xc035('0xe')][_0xc035('0x11')]);return _0x47f60f(_0xe5cf6d[_0xc035('0xe')][_0xc035('0x11')]);}logger['error'](_0xc035('0x10'),_0x37138a,_0xe5cf6d[_0xc035('0xe')]['message']);return _0x33c201(_0xe5cf6d[_0xc035('0xe')]['message']);}else{logger[_0xc035('0x12')](_0xc035('0x10'),_0x37138a,'request\x20sent');_0x33c201(_0xe5cf6d['result'][_0xc035('0x11')]);}})[_0xc035('0x13')](function(_0x4a39e7){logger[_0xc035('0xe')](_0xc035('0x10'),_0x37138a,_0x4a39e7);_0x47f60f(_0x4a39e7);});});} \ No newline at end of file +var _0xc88c=['CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc88c,0xb4));var _0xcc88=function(_0x120c0f,_0x328637){_0x120c0f=_0x120c0f-0x0;var _0x591f2f=_0xc88c[_0x120c0f];return _0x591f2f;};'use strict';var _=require('lodash');var util=require(_0xcc88('0x0'));var moment=require(_0xcc88('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc88('0x2'));var db=require(_0xcc88('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc88('0x4'))(_0xcc88('0x5'));var config=require(_0xcc88('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcc88('0x7')][_0xcc88('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x525802,_0x33a28a,_0x4a68b5){return new BPromise(function(_0x1814dd,_0x364034){return client['request'](_0x525802,_0x4a68b5)[_0xcc88('0x9')](function(_0x4c6804){logger['info'](_0xcc88('0xa'),_0x33a28a,_0xcc88('0xb'));logger[_0xcc88('0xc')](_0xcc88('0xd'),_0x33a28a,_0xcc88('0xb'),JSON[_0xcc88('0xe')](_0x4c6804));if(_0x4c6804['error']){if(_0x4c6804[_0xcc88('0xf')]['code']===0x1f4){logger[_0xcc88('0xf')](_0xcc88('0xa'),_0x33a28a,_0x4c6804['error'][_0xcc88('0x10')]);return _0x364034(_0x4c6804['error'][_0xcc88('0x10')]);}logger[_0xcc88('0xf')]('CmCustomField,\x20%s,\x20%s',_0x33a28a,_0x4c6804[_0xcc88('0xf')]['message']);return _0x1814dd(_0x4c6804[_0xcc88('0xf')][_0xcc88('0x10')]);}else{logger['info'](_0xcc88('0xa'),_0x33a28a,_0xcc88('0xb'));_0x1814dd(_0x4c6804[_0xcc88('0x11')][_0xcc88('0x10')]);}})[_0xcc88('0x12')](function(_0x29d048){logger[_0xcc88('0xf')]('CmCustomField,\x20%s,\x20%s',_0x33a28a,_0x29d048);_0x364034(_0x29d048);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index c4fb04e..bd303ae 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 _0x3677=['put','update','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','/:id','isAuthenticated','show','post','create'];(function(_0x1c01d8,_0x2ff6d3){var _0x1a368d=function(_0x4be7de){while(--_0x4be7de){_0x1c01d8['push'](_0x1c01d8['shift']());}};_0x1a368d(++_0x2ff6d3);}(_0x3677,0x1e9));var _0x7367=function(_0x10f154,_0x12cf31){_0x10f154=_0x10f154-0x0;var _0xa58978=_0x3677[_0x10f154];return _0xa58978;};'use strict';var multer=require(_0x7367('0x0'));var util=require(_0x7367('0x1'));var path=require(_0x7367('0x2'));var timeout=require(_0x7367('0x3'));var express=require('express');var router=express[_0x7367('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7367('0x5'));var interaction=require(_0x7367('0x6'));var config=require(_0x7367('0x7'));var controller=require(_0x7367('0x8'));router[_0x7367('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7367('0xa'),auth[_0x7367('0xb')](),controller[_0x7367('0xc')]);router[_0x7367('0xd')]('/',auth['isAuthenticated'](),controller[_0x7367('0xe')]);router[_0x7367('0xf')](_0x7367('0xa'),auth['isAuthenticated'](),controller[_0x7367('0x10')]);router['delete']('/:id',auth[_0x7367('0xb')](),controller[_0x7367('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0389=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','show','post','put','update','delete','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0389,0x175));var _0x9038=function(_0x3c504b,_0x437693){_0x3c504b=_0x3c504b-0x0;var _0x2e5354=_0x0389[_0x3c504b];return _0x2e5354;};'use strict';var multer=require(_0x9038('0x0'));var util=require('util');var path=require(_0x9038('0x1'));var timeout=require(_0x9038('0x2'));var express=require(_0x9038('0x3'));var router=express[_0x9038('0x4')]();var fs_extra=require(_0x9038('0x5'));var auth=require(_0x9038('0x6'));var interaction=require(_0x9038('0x7'));var config=require('../../config/environment');var controller=require(_0x9038('0x8'));router[_0x9038('0x9')]('/',auth[_0x9038('0xa')](),controller['index']);router['get']('/:id',auth[_0x9038('0xa')](),controller[_0x9038('0xb')]);router[_0x9038('0xc')]('/',auth[_0x9038('0xa')](),controller['create']);router[_0x9038('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x9038('0xe')]);router[_0x9038('0xf')]('/:id',auth[_0x9038('0xa')](),controller['destroy']);module[_0x9038('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index f6ab742..c905f34 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 _0xc0f1=['DATE','format','INTEGER','UNSIGNED','contactListQueue','moment','exports','STRING','BOOLEAN'];(function(_0x5af5c6,_0x55e008){var _0x3fc9c8=function(_0x49d959){while(--_0x49d959){_0x5af5c6['push'](_0x5af5c6['shift']());}};_0x3fc9c8(++_0x55e008);}(_0xc0f1,0x1eb));var _0x1c0f=function(_0x273f77,_0xe5b0cb){_0x273f77=_0x273f77-0x0;var _0x71e147=_0xc0f1[_0x273f77];return _0x71e147;};'use strict';var moment=require(_0x1c0f('0x0'));var Sequelize=require('sequelize');module[_0x1c0f('0x1')]={'phone':{'type':Sequelize[_0x1c0f('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x1c0f('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x1c0f('0x4')],'defaultValue':moment()[_0x1c0f('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x1c0f('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1c0f('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x1c0f('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1c0f('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1c0f('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x1c0f('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x1c0f('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x1c0f('0x6')],'unique':_0x1c0f('0x8')},'ListId':{'type':Sequelize[_0x1c0f('0x6')],'unique':_0x1c0f('0x8')},'UserId':{'type':Sequelize[_0x1c0f('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x1c0f('0x6')],'unique':_0x1c0f('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x1c0f('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1c0f('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1c0f('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x1c0f('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1c0f('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x1c0f('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x3c37=['STRING','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','DATE','UNSIGNED','contactListQueue','moment','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c37,0x14b));var _0x73c3=function(_0x16e8ba,_0x2afffc){_0x16e8ba=_0x16e8ba-0x0;var _0x39493f=_0x3c37[_0x16e8ba];return _0x39493f;};'use strict';var moment=require(_0x73c3('0x0'));var Sequelize=require(_0x73c3('0x1'));module['exports']={'phone':{'type':Sequelize[_0x73c3('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0x73c3('0x3'))},'countbusyretry':{'type':Sequelize[_0x73c3('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x73c3('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x73c3('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x73c3('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x73c3('0x6')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x73c3('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x73c3('0x5')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x73c3('0x4')],'unique':_0x73c3('0x8')},'ListId':{'type':Sequelize[_0x73c3('0x4')],'unique':_0x73c3('0x8')},'UserId':{'type':Sequelize[_0x73c3('0x4')]},'VoiceQueueId':{'type':Sequelize[_0x73c3('0x4')],'unique':_0x73c3('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x73c3('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x73c3('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x73c3('0x2')]},'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 eba28d4..e4fb0e2 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 _0xc818=['body','find','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','dataValues','createdAt','updatedAt','state','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','filter','value','direction','prev','hopperIds','ASC','scheduledAt','DESC','sequelize','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','Contact','CmCompany','Company','CmList','List','getPreviewRecall','recallme','UPDATE','Queue','dialActive','getVoiceQueues','outbound','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','timezones','push','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','keys','query','model','filters','$and','$or','$gt','$gte','$lt','$lte','$ne','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','findAll','catch','show','params','includeAll','include','create'];(function(_0x13f899,_0x3ebbfe){var _0x3709c0=function(_0x8636fa){while(--_0x8636fa){_0x13f899['push'](_0x13f899['shift']());}};_0x3709c0(++_0x3ebbfe);}(_0xc818,0x1e3));var _0x8c81=function(_0x55754e,_0x3fe0ed){_0x55754e=_0x55754e-0x0;var _0x1497ee=_0xc818[_0x55754e];return _0x1497ee;};'use strict';var moment=require(_0x8c81('0x0'));var _=require(_0x8c81('0x1'));var qs=require(_0x8c81('0x2'));var logger=require(_0x8c81('0x3'))('api');var shared=require(_0x8c81('0x4'));var db=require(_0x8c81('0x5'))['db'];function respondWithResult(_0x40b19e,_0x7e329f){_0x7e329f=_0x7e329f||0xc8;return function(_0x1a61ab){if(_0x1a61ab){return _0x40b19e[_0x8c81('0x6')](_0x7e329f)[_0x8c81('0x7')](_0x1a61ab);}};}function respondWithFilteredResult(_0x4a6e65,_0x2c5966){return function(_0x3d663e){if(_0x3d663e){var _0x32cf31=typeof _0x2c5966[_0x8c81('0x8')]==='undefined'&&typeof _0x2c5966[_0x8c81('0x9')]===_0x8c81('0xa');var _0x186783=_0x3d663e[_0x8c81('0xb')];var _0x1b4523=_0x32cf31?0x0:_0x2c5966[_0x8c81('0x8')];var _0x64a425=_0x32cf31?_0x3d663e['count']:_0x2c5966[_0x8c81('0x8')]+_0x2c5966[_0x8c81('0x9')];var _0x639c8f;if(_0x64a425>=_0x186783){_0x64a425=_0x186783;_0x639c8f=0xc8;}else{_0x639c8f=0xce;}_0x4a6e65[_0x8c81('0x6')](_0x639c8f);return _0x4a6e65['set'](_0x8c81('0xc'),_0x1b4523+'-'+_0x64a425+'/'+_0x186783)[_0x8c81('0x7')](_0x3d663e);}return null;};}function saveUpdates(_0x63f11f,_0x31ff3f){return function(_0x2a945d){if(_0x2a945d){return _0x2a945d[_0x8c81('0xd')](_0x63f11f)[_0x8c81('0xe')](function(_0xd04a1){return _0xd04a1;});}return null;};}function handleEntityNotFound(_0x1500cc,_0x5a6e72){return function(_0x4bb8ee){if(!_0x4bb8ee){_0x1500cc[_0x8c81('0xf')](0x194);}return _0x4bb8ee;};}function handleError(_0x1df3ac,_0x238ce5){_0x238ce5=_0x238ce5||0x1f4;return function(_0x4fa5){logger[_0x8c81('0x10')](_0x4fa5[_0x8c81('0x11')]);if(_0x4fa5['name']){delete _0x4fa5[_0x8c81('0x12')];}_0x1df3ac[_0x8c81('0x6')](_0x238ce5)[_0x8c81('0x13')](_0x4fa5);};}exports[_0x8c81('0x14')]=function(_0x17564e,_0x5c09f3){var _0x31069a={},_0x4d0b75={},_0x492d24={'count':0x0,'rows':[]};var _0x49b51b=_[_0x8c81('0x15')](db[_0x8c81('0x16')][_0x8c81('0x17')],function(_0x4f4014){return{'name':_0x4f4014[_0x8c81('0x18')],'type':_0x4f4014[_0x8c81('0x19')][_0x8c81('0x1a')]};});_0x4d0b75['model']=_[_0x8c81('0x15')](_0x49b51b,_0x8c81('0x12'));_0x4d0b75['query']=_[_0x8c81('0x1b')](_0x17564e[_0x8c81('0x1c')]);_0x4d0b75['filters']=_['intersection'](_0x4d0b75[_0x8c81('0x1d')],_0x4d0b75[_0x8c81('0x1c')]);_0x4d0b75[_0x8c81('0x1e')]=_['concat'](_0x4d0b75[_0x8c81('0x1e')],[_0x8c81('0x1f'),_0x8c81('0x20'),_0x8c81('0x21'),_0x8c81('0x22'),_0x8c81('0x23'),_0x8c81('0x24'),_0x8c81('0x25'),'$eq','$not',_0x8c81('0x26'),_0x8c81('0x27'),_0x8c81('0x28'),_0x8c81('0x29'),_0x8c81('0x2a'),_0x8c81('0x2b'),_0x8c81('0x2c'),_0x8c81('0x2d'),_0x8c81('0x2a'),_0x8c81('0x2e'),_0x8c81('0x2f'),_0x8c81('0x30'),_0x8c81('0x31')]);_0x31069a['attributes']=_[_0x8c81('0x32')](_0x4d0b75[_0x8c81('0x1d')],qs[_0x8c81('0x33')](_0x17564e[_0x8c81('0x1c')][_0x8c81('0x33')]));_0x31069a[_0x8c81('0x34')]=_0x31069a[_0x8c81('0x34')][_0x8c81('0x35')]?_0x31069a[_0x8c81('0x34')]:_0x4d0b75['model'];if(!_0x17564e[_0x8c81('0x1c')][_0x8c81('0x36')](_0x8c81('0x37'))){_0x31069a[_0x8c81('0x9')]=qs[_0x8c81('0x9')](_0x17564e['query'][_0x8c81('0x9')]);_0x31069a[_0x8c81('0x8')]=qs[_0x8c81('0x8')](_0x17564e[_0x8c81('0x1c')][_0x8c81('0x8')]);}_0x31069a['order']=qs['sort'](_0x17564e[_0x8c81('0x1c')][_0x8c81('0x38')]);_0x31069a[_0x8c81('0x39')]=qs['filters'](_[_0x8c81('0x3a')](_0x17564e[_0x8c81('0x1c')],_0x4d0b75[_0x8c81('0x1e')]),_0x49b51b);if(_0x17564e[_0x8c81('0x1c')]['filter']){_0x31069a[_0x8c81('0x39')]=_[_0x8c81('0x3b')](_0x31069a['where'],{'$or':_[_0x8c81('0x15')](_0x49b51b,function(_0x554b9a){if(_0x554b9a['type']!==_0x8c81('0x3c')){var _0x3f8dde={};_0x3f8dde[_0x554b9a[_0x8c81('0x12')]]={'$like':'%'+_0x17564e[_0x8c81('0x1c')]['filter']+'%'};return _0x3f8dde;}})});}_0x31069a=_[_0x8c81('0x3b')]({},_0x31069a,_0x17564e[_0x8c81('0x3d')]);var _0x3f14db={'where':_0x31069a['where']};return db['CmHopper'][_0x8c81('0xb')](_0x3f14db)[_0x8c81('0xe')](function(_0x4373ce){_0x492d24['count']=_0x4373ce;if(_0x17564e[_0x8c81('0x1c')]['includeAll']){_0x31069a['include']=[{'all':!![]}];}return db['CmHopper'][_0x8c81('0x3e')](_0x31069a);})['then'](function(_0x1d9035){_0x492d24['rows']=_0x1d9035;return _0x492d24;})['then'](respondWithFilteredResult(_0x5c09f3,_0x31069a))[_0x8c81('0x3f')](handleError(_0x5c09f3,null));};exports[_0x8c81('0x40')]=function(_0x23f68d,_0x11e1e4){var _0x1e070d={'raw':!![],'where':{'id':_0x23f68d[_0x8c81('0x41')]['id']}},_0x232ba7={};_0x232ba7['model']=_[_0x8c81('0x1b')](db[_0x8c81('0x16')][_0x8c81('0x17')]);_0x232ba7[_0x8c81('0x1c')]=_[_0x8c81('0x1b')](_0x23f68d['query']);_0x232ba7[_0x8c81('0x1e')]=_[_0x8c81('0x32')](_0x232ba7[_0x8c81('0x1d')],_0x232ba7[_0x8c81('0x1c')]);_0x1e070d[_0x8c81('0x34')]=_[_0x8c81('0x32')](_0x232ba7[_0x8c81('0x1d')],qs[_0x8c81('0x33')](_0x23f68d[_0x8c81('0x1c')][_0x8c81('0x33')]));_0x1e070d[_0x8c81('0x34')]=_0x1e070d[_0x8c81('0x34')]['length']?_0x1e070d['attributes']:_0x232ba7[_0x8c81('0x1d')];if(_0x23f68d[_0x8c81('0x1c')][_0x8c81('0x42')]){_0x1e070d[_0x8c81('0x43')]=[{'all':!![]}];}_0x1e070d=_[_0x8c81('0x3b')]({},_0x1e070d,_0x23f68d[_0x8c81('0x3d')]);return db[_0x8c81('0x16')]['find'](_0x1e070d)['then'](handleEntityNotFound(_0x11e1e4,null))[_0x8c81('0xe')](respondWithResult(_0x11e1e4,null))[_0x8c81('0x3f')](handleError(_0x11e1e4,null));};exports[_0x8c81('0x44')]=function(_0x21891f,_0x3ae471){return db[_0x8c81('0x16')][_0x8c81('0x44')](_0x21891f['body'],{})[_0x8c81('0xe')](respondWithResult(_0x3ae471,0xc9))[_0x8c81('0x3f')](handleError(_0x3ae471,null));};exports[_0x8c81('0xd')]=function(_0x331c74,_0x4d0093){if(_0x331c74['body']['id']){delete _0x331c74[_0x8c81('0x45')]['id'];}return db[_0x8c81('0x16')][_0x8c81('0x46')]({'where':{'id':_0x331c74[_0x8c81('0x41')]['id']}})[_0x8c81('0xe')](handleEntityNotFound(_0x4d0093,null))[_0x8c81('0xe')](saveUpdates(_0x331c74[_0x8c81('0x45')],null))[_0x8c81('0xe')](respondWithResult(_0x4d0093,null))[_0x8c81('0x3f')](handleError(_0x4d0093,null));};exports[_0x8c81('0x47')]=function(_0x9a46e5,_0x276713){return db[_0x8c81('0x16')][_0x8c81('0x47')]()[_0x8c81('0xe')](respondWithResult(_0x276713,null))[_0x8c81('0x3f')](handleError(_0x276713,null));};exports[_0x8c81('0x48')]=function(_0x25b569,_0x39dbc8){var _0x11ce68;var _0x16e822=_0x25b569['params']['id'];return db[_0x8c81('0x16')][_0x8c81('0x46')]({'where':{'id':_0x25b569['params']['id']}})[_0x8c81('0xe')](handleEntityNotFound(_0x39dbc8,null))[_0x8c81('0xe')](function(_0x38bb79){if(_0x38bb79){return _0x38bb79['destroy']()[_0x8c81('0xe')](function(_0x25b5f9){return _0x25b5f9;});}})[_0x8c81('0xe')](function(_0x510fa5){_0x11ce68=_0x510fa5;if(_0x510fa5){if(_0x510fa5['VoiceQueueId']||_0x510fa5[_0x8c81('0x49')]){return db[_0x510fa5[_0x8c81('0x4a')]?_0x8c81('0x4b'):'Campaign'][_0x8c81('0x46')]({'where':{'id':_0x510fa5[_0x8c81('0x4a')]?_0x510fa5[_0x8c81('0x4a')]:_0x510fa5[_0x8c81('0x49')]},'attributes':['id',_0x8c81('0x12')],'raw':!![]});}}})[_0x8c81('0xe')](function(_0x93e68e){var _0xda9fa4={};if(_0x93e68e){_['merge'](_0xda9fa4,_['omit'](_0x11ce68[_0x8c81('0x4c')],[_0x8c81('0x4d'),_0x8c81('0x4e'),'id']));_0xda9fa4[_0x8c81('0x4f')]=0x15;_0xda9fa4['statedesc']=_0x8c81('0x50');_0xda9fa4[_0x8c81('0x51')]=_0x93e68e[_0x8c81('0x12')];_0xda9fa4[_0x8c81('0x52')]=_0x25b569[_0x8c81('0x53')][_0x8c81('0x12')];_0xda9fa4['UserId']=_0x25b569[_0x8c81('0x53')]['id'];_0xda9fa4['deleted']=!![];_0xda9fa4[_0x8c81('0x54')]=moment()[_0x8c81('0x55')](_0x8c81('0x56'));_0xda9fa4['calleridnum']=_0x11ce68['phone'];_0xda9fa4[_0x8c81('0x57')]=_0x11ce68[_0x8c81('0x4a')]?_0x8c81('0x58'):_0x8c81('0x59');return db[_0x8c81('0x5a')][_0x8c81('0x46')]({'where':{'id':_0xda9fa4[_0x8c81('0x5b')]},'attributes':[_0x8c81('0x5c'),_0x8c81('0x5d')]})[_0x8c81('0xe')](function(_0x3ee093){if(!_[_0x8c81('0x5e')](_0x39dbc8)&&!_[_0x8c81('0x5e')](_0x3ee093['firstName'])){_0xda9fa4[_0x8c81('0x5f')]=_0x3ee093[_0x8c81('0x5c')];if(!_[_0x8c81('0x5e')](_0x3ee093[_0x8c81('0x5d')])){_0xda9fa4[_0x8c81('0x5f')]+='\x20'+_0x3ee093['lastName'];}}})[_0x8c81('0x60')](function(){return db[_0x8c81('0x61')][_0x8c81('0x44')](_0xda9fa4);});}})[_0x8c81('0xe')](function(_0x117517){return db[_0x8c81('0x62')][_0x8c81('0x48')]({'where':{'CmHopperId':_0x16e822}});})[_0x8c81('0xe')](function(){return _0x39dbc8['status'](0xcc)[_0x8c81('0x63')]();})[_0x8c81('0x3f')](handleError(_0x39dbc8,null));};exports[_0x8c81('0x64')]=function(_0x4d90e5,_0x5b53f3){var _0x4e7bb6=[];return db[_0x8c81('0x5a')][_0x8c81('0x47')]()['then'](function(_0x7dfe1a){_0x4e7bb6=_[_0x8c81('0x1b')](_0x7dfe1a);return _0x4d90e5[_0x8c81('0x53')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x8c81('0x65')},'attributes':['id',_0x8c81('0x66'),_0x8c81('0x67')],'raw':!![]});})[_0x8c81('0xe')](function(_0x50a46b){if(_0x50a46b&&_0x50a46b[_0x8c81('0x35')]){return db['sequelize'][_0x8c81('0x68')](function(_0x3deb72){var _0xc9a3b6={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8c81('0x55')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x8c81('0x15')](_0x50a46b,'id')},'$or':[{'UserId':null},{'UserId':_0x4d90e5[_0x8c81('0x53')]['id']}]};var _0x35a042={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x50a46b)[_0x8c81('0x69')]([_0x8c81('0x67'),0x0])[_0x8c81('0x15')]('id')[_0x8c81('0x6a')]()},'$or':[{'UserId':null},{'UserId':_0x4d90e5['user']['id']}]};var _0x14c30d={'$or':[_0xc9a3b6,_0x35a042]};var _0x2bce9e=[];if(_0x4d90e5[_0x8c81('0x45')][_0x8c81('0x6b')]&&_0x4d90e5[_0x8c81('0x45')][_0x8c81('0x6b')]===_0x8c81('0x6c')){if(!_['isEmpty'](_0x4d90e5['body'][_0x8c81('0x6d')])){_0x14c30d['id']={'$in':_0x4d90e5[_0x8c81('0x45')][_0x8c81('0x6d')]};}_0x2bce9e=[['priority',_0x8c81('0x6e')],[_0x8c81('0x6f'),_0x50a46b[0x0][_0x8c81('0x66')]===_0x8c81('0x6e')?_0x8c81('0x70'):_0x8c81('0x6e')],db[_0x8c81('0x71')]['literal'](_0x8c81('0x72')),['id',_0x8c81('0x70')]];}else{if(!_['isEmpty'](_0x4d90e5[_0x8c81('0x45')]['hopperIds'])){_0x14c30d['id']={'$notIn':_0x4d90e5[_0x8c81('0x45')][_0x8c81('0x6d')]};}_0x2bce9e=[['priority',_0x8c81('0x70')],[_0x8c81('0x6f'),_0x50a46b[0x0][_0x8c81('0x66')]],db['sequelize'][_0x8c81('0x73')](_0x8c81('0x74')),['id',_0x8c81('0x6e')]];}return db[_0x8c81('0x16')][_0x8c81('0x75')]({'attributes':['id',_0x8c81('0x76'),'phone','recallme'],'where':_0x14c30d,'order':_0x2bce9e,'transaction':_0x3deb72,'lock':_0x3deb72[_0x8c81('0x77')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x8c81('0x78'),'attributes':_0x4e7bb6,'include':[{'model':db[_0x8c81('0x79')],'as':_0x8c81('0x7a'),'attributes':['id',_0x8c81('0x12')]}]},{'model':db[_0x8c81('0x7b')],'as':_0x8c81('0x7c'),'attributes':['id',_0x8c81('0x12')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0x8c81('0x12'),'dialActive']}]})['then'](function(_0x304137){if(_0x304137){return _0x304137[_0x8c81('0xd')]({'UserId':_0x4d90e5[_0x8c81('0x53')]['id']},{'transaction':_0x3deb72});}});});}})[_0x8c81('0xe')](handleEntityNotFound(_0x5b53f3,null))[_0x8c81('0xe')](respondWithResult(_0x5b53f3,null))['catch'](handleError(_0x5b53f3,null));};exports[_0x8c81('0x7d')]=function(_0x58a7e1,_0x34e82f,_0x22a4aa){var _0x198c48=[];var _0x2e1962=_0x58a7e1[_0x8c81('0x41')]['id'];var _0x4f62fc=_0x58a7e1[_0x8c81('0x53')]['id'];return db[_0x8c81('0x5a')][_0x8c81('0x47')]()[_0x8c81('0xe')](function(_0x1dab68){_0x198c48=_[_0x8c81('0x1b')](_0x1dab68);return db['sequelize'][_0x8c81('0x68')](function(_0x29adbf){const _0x1a7d79={'id':_0x2e1962};return db[_0x8c81('0x16')][_0x8c81('0x75')]({'attributes':['id',_0x8c81('0x76'),_0x8c81('0x7e')],'where':_0x1a7d79,'transaction':_0x29adbf,'lock':_0x29adbf[_0x8c81('0x77')][_0x8c81('0x7f')],'include':[{'model':db[_0x8c81('0x5a')],'as':_0x8c81('0x78'),'attributes':_0x198c48,'include':[{'model':db[_0x8c81('0x79')],'as':_0x8c81('0x7a'),'attributes':['id',_0x8c81('0x12')]}]},{'model':db[_0x8c81('0x7b')],'as':'List','attributes':['id',_0x8c81('0x12')]},{'model':db[_0x8c81('0x4b')],'as':_0x8c81('0x80'),'attributes':['id',_0x8c81('0x12'),_0x8c81('0x81')]}]})[_0x8c81('0xe')](function(_0x5b5a46){if(_0x5b5a46){return _0x5b5a46[_0x8c81('0xd')]({'UserId':_0x4f62fc},{'transaction':_0x29adbf});}});});})[_0x8c81('0xe')](handleEntityNotFound(_0x34e82f,null))['then'](respondWithResult(_0x34e82f,null))[_0x8c81('0x3f')](handleError(_0x34e82f,null));};exports['getOpenContacts']=function(_0x4522e0,_0x67fcdd){return _0x4522e0['user'][_0x8c81('0x82')]({'where':{'type':_0x8c81('0x83'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x9ba52e){if(_0x9ba52e&&_0x9ba52e['length']){return db[_0x8c81('0x16')][_0x8c81('0xb')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8c81('0x55')](_0x8c81('0x56'))},'VoiceQueueId':{'$in':_[_0x8c81('0x15')](_0x9ba52e,'id')},'$or':[{'UserId':null},{'UserId':_0x4522e0['user']['id']}]}});}return 0x0;})['then'](function(_0x20d244){if(!_[_0x8c81('0x5e')](_0x20d244)&&_['isNumber'](_0x20d244)){return _0x67fcdd['status'](0xc8)[_0x8c81('0x7')]({'contacts':_0x20d244});}else{logger['error'](_0x8c81('0x84'),_0x8c81('0x85'),0x194,_0x8c81('0x86'));_0x67fcdd[_0x8c81('0xf')](0x194);}})['catch'](handleError(_0x67fcdd,null));};exports['getTimezones']=function(_0x539889,_0xd39626){var _0xc2828f=shared[_0x8c81('0x87')];var _0x3314d7=[];_[_0x8c81('0x15')](_0xc2828f,function(_0xc51424){_0x3314d7[_0x8c81('0x88')]({'id':_0xc51424['name'],'name':_0xc51424[_0x8c81('0x12')],'utcOffset':_0xc51424['utcOffset']});});return _0xd39626['status'](0xc8)[_0x8c81('0x7')]({'tz':_0x3314d7});};exports[_0x8c81('0x89')]=function(_0x298490,_0xa0c66e){var _0x102d54=shared['timezones'];var _0x542875={};if(!_[_0x8c81('0x5e')](_0x102d54[_0x298490[_0x8c81('0x45')]['id']]))_0x542875=_0x102d54[_0x298490[_0x8c81('0x45')]['id']];return _0xa0c66e[_0x8c81('0x6')](0xc8)['json'](_0x542875);}; \ No newline at end of file +var _0xf2cb=['transaction','YYYY-MM-DD\x20HH:mm:ss','value','direction','hopperIds','priority','ASC','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','DESC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','phone','recallme','LOCK','UPDATE','Contact','Company','CmList','List','Queue','dialActive','getPreviewRecall','CmCompany','getOpenContacts','format','isNil','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','lodash','../../config/logger','../../config/environment','json','offset','limit','count','status','set','Content-Range','update','then','sendStatus','error','stack','name','send','map','CmHopper','rawAttributes','fieldName','type','key','query','keys','filters','intersection','concat','$or','$gt','$gte','$lt','$lte','$ne','$eq','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','statedesc','deleted','campaign','user','deletedat','campaigntype','queue','ivr','CmContact','ContactId','firstName','calleridname','lastName','finally','CmHopperAdditionalPhone','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2cb,0x130));var _0xbf2c=function(_0x38969c,_0x16de69){_0x38969c=_0x38969c-0x0;var _0x5cc887=_0xf2cb[_0x38969c];return _0x5cc887;};'use strict';var moment=require('moment');var _=require(_0xbf2c('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0xbf2c('0x1'))('api');var shared=require(_0xbf2c('0x2'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x1ecb79,_0x41c649){_0x41c649=_0x41c649||0xc8;return function(_0x5abeb3){if(_0x5abeb3){return _0x1ecb79['status'](_0x41c649)[_0xbf2c('0x3')](_0x5abeb3);}};}function respondWithFilteredResult(_0x46d282,_0x1fc371){return function(_0xaacd25){if(_0xaacd25){var _0x516715=typeof _0x1fc371[_0xbf2c('0x4')]==='undefined'&&typeof _0x1fc371[_0xbf2c('0x5')]==='undefined';var _0x5f25ea=_0xaacd25[_0xbf2c('0x6')];var _0x16c303=_0x516715?0x0:_0x1fc371[_0xbf2c('0x4')];var _0x5e10f4=_0x516715?_0xaacd25[_0xbf2c('0x6')]:_0x1fc371[_0xbf2c('0x4')]+_0x1fc371[_0xbf2c('0x5')];var _0x27be1c;if(_0x5e10f4>=_0x5f25ea){_0x5e10f4=_0x5f25ea;_0x27be1c=0xc8;}else{_0x27be1c=0xce;}_0x46d282[_0xbf2c('0x7')](_0x27be1c);return _0x46d282[_0xbf2c('0x8')](_0xbf2c('0x9'),_0x16c303+'-'+_0x5e10f4+'/'+_0x5f25ea)[_0xbf2c('0x3')](_0xaacd25);}return null;};}function saveUpdates(_0x52983d,_0x149235){return function(_0x294d0d){if(_0x294d0d){return _0x294d0d[_0xbf2c('0xa')](_0x52983d)[_0xbf2c('0xb')](function(_0x5220e2){return _0x5220e2;});}return null;};}function handleEntityNotFound(_0x7665b1,_0x5a160b){return function(_0x557740){if(!_0x557740){_0x7665b1[_0xbf2c('0xc')](0x194);}return _0x557740;};}function handleError(_0x4f58c7,_0x47df49){_0x47df49=_0x47df49||0x1f4;return function(_0x3ed1c3){logger[_0xbf2c('0xd')](_0x3ed1c3[_0xbf2c('0xe')]);if(_0x3ed1c3[_0xbf2c('0xf')]){delete _0x3ed1c3[_0xbf2c('0xf')];}_0x4f58c7['status'](_0x47df49)[_0xbf2c('0x10')](_0x3ed1c3);};}exports['index']=function(_0x4ced7f,_0x1df2ab){var _0x298329={},_0x32a44d={},_0x266035={'count':0x0,'rows':[]};var _0x57e01a=_[_0xbf2c('0x11')](db[_0xbf2c('0x12')][_0xbf2c('0x13')],function(_0x5353e7){return{'name':_0x5353e7[_0xbf2c('0x14')],'type':_0x5353e7[_0xbf2c('0x15')][_0xbf2c('0x16')]};});_0x32a44d['model']=_[_0xbf2c('0x11')](_0x57e01a,_0xbf2c('0xf'));_0x32a44d[_0xbf2c('0x17')]=_[_0xbf2c('0x18')](_0x4ced7f['query']);_0x32a44d[_0xbf2c('0x19')]=_[_0xbf2c('0x1a')](_0x32a44d['model'],_0x32a44d[_0xbf2c('0x17')]);_0x32a44d[_0xbf2c('0x19')]=_[_0xbf2c('0x1b')](_0x32a44d['filters'],['$and',_0xbf2c('0x1c'),_0xbf2c('0x1d'),_0xbf2c('0x1e'),_0xbf2c('0x1f'),_0xbf2c('0x20'),_0xbf2c('0x21'),_0xbf2c('0x22'),'$not','$between',_0xbf2c('0x23'),_0xbf2c('0x24'),_0xbf2c('0x25'),_0xbf2c('0x26'),_0xbf2c('0x27'),_0xbf2c('0x28'),_0xbf2c('0x29'),_0xbf2c('0x26'),_0xbf2c('0x2a'),'$contains',_0xbf2c('0x2b'),'$any']);_0x298329[_0xbf2c('0x2c')]=_[_0xbf2c('0x1a')](_0x32a44d[_0xbf2c('0x2d')],qs[_0xbf2c('0x2e')](_0x4ced7f[_0xbf2c('0x17')]['fields']));_0x298329[_0xbf2c('0x2c')]=_0x298329[_0xbf2c('0x2c')][_0xbf2c('0x2f')]?_0x298329[_0xbf2c('0x2c')]:_0x32a44d[_0xbf2c('0x2d')];if(!_0x4ced7f[_0xbf2c('0x17')][_0xbf2c('0x30')](_0xbf2c('0x31'))){_0x298329['limit']=qs[_0xbf2c('0x5')](_0x4ced7f[_0xbf2c('0x17')][_0xbf2c('0x5')]);_0x298329['offset']=qs['offset'](_0x4ced7f[_0xbf2c('0x17')][_0xbf2c('0x4')]);}_0x298329[_0xbf2c('0x32')]=qs[_0xbf2c('0x33')](_0x4ced7f[_0xbf2c('0x17')][_0xbf2c('0x33')]);_0x298329[_0xbf2c('0x34')]=qs[_0xbf2c('0x19')](_[_0xbf2c('0x35')](_0x4ced7f['query'],_0x32a44d[_0xbf2c('0x19')]),_0x57e01a);if(_0x4ced7f[_0xbf2c('0x17')][_0xbf2c('0x36')]){_0x298329[_0xbf2c('0x34')]=_[_0xbf2c('0x37')](_0x298329[_0xbf2c('0x34')],{'$or':_[_0xbf2c('0x11')](_0x57e01a,function(_0x4722b3){if(_0x4722b3['type']!==_0xbf2c('0x38')){var _0x475594={};_0x475594[_0x4722b3[_0xbf2c('0xf')]]={'$like':'%'+_0x4ced7f['query'][_0xbf2c('0x36')]+'%'};return _0x475594;}})});}_0x298329=_[_0xbf2c('0x37')]({},_0x298329,_0x4ced7f[_0xbf2c('0x39')]);var _0x5402ff={'where':_0x298329[_0xbf2c('0x34')]};return db[_0xbf2c('0x12')]['count'](_0x5402ff)['then'](function(_0x47ab9a){_0x266035['count']=_0x47ab9a;if(_0x4ced7f['query'][_0xbf2c('0x3a')]){_0x298329[_0xbf2c('0x3b')]=[{'all':!![]}];}return db[_0xbf2c('0x12')][_0xbf2c('0x3c')](_0x298329);})[_0xbf2c('0xb')](function(_0x16fbd5){_0x266035[_0xbf2c('0x3d')]=_0x16fbd5;return _0x266035;})[_0xbf2c('0xb')](respondWithFilteredResult(_0x1df2ab,_0x298329))[_0xbf2c('0x3e')](handleError(_0x1df2ab,null));};exports[_0xbf2c('0x3f')]=function(_0x245eaf,_0x99abc8){var _0x3fbf90={'raw':!![],'where':{'id':_0x245eaf[_0xbf2c('0x40')]['id']}},_0x1eac50={};_0x1eac50[_0xbf2c('0x2d')]=_['keys'](db[_0xbf2c('0x12')][_0xbf2c('0x13')]);_0x1eac50[_0xbf2c('0x17')]=_[_0xbf2c('0x18')](_0x245eaf[_0xbf2c('0x17')]);_0x1eac50[_0xbf2c('0x19')]=_[_0xbf2c('0x1a')](_0x1eac50[_0xbf2c('0x2d')],_0x1eac50['query']);_0x3fbf90[_0xbf2c('0x2c')]=_[_0xbf2c('0x1a')](_0x1eac50[_0xbf2c('0x2d')],qs[_0xbf2c('0x2e')](_0x245eaf['query'][_0xbf2c('0x2e')]));_0x3fbf90['attributes']=_0x3fbf90[_0xbf2c('0x2c')][_0xbf2c('0x2f')]?_0x3fbf90[_0xbf2c('0x2c')]:_0x1eac50[_0xbf2c('0x2d')];if(_0x245eaf[_0xbf2c('0x17')][_0xbf2c('0x3a')]){_0x3fbf90['include']=[{'all':!![]}];}_0x3fbf90=_[_0xbf2c('0x37')]({},_0x3fbf90,_0x245eaf['options']);return db['CmHopper'][_0xbf2c('0x41')](_0x3fbf90)['then'](handleEntityNotFound(_0x99abc8,null))['then'](respondWithResult(_0x99abc8,null))[_0xbf2c('0x3e')](handleError(_0x99abc8,null));};exports[_0xbf2c('0x42')]=function(_0x56fc01,_0x403568){return db['CmHopper'][_0xbf2c('0x42')](_0x56fc01['body'],{})[_0xbf2c('0xb')](respondWithResult(_0x403568,0xc9))[_0xbf2c('0x3e')](handleError(_0x403568,null));};exports[_0xbf2c('0xa')]=function(_0x343255,_0x222721){if(_0x343255[_0xbf2c('0x43')]['id']){delete _0x343255['body']['id'];}return db[_0xbf2c('0x12')][_0xbf2c('0x41')]({'where':{'id':_0x343255[_0xbf2c('0x40')]['id']}})[_0xbf2c('0xb')](handleEntityNotFound(_0x222721,null))[_0xbf2c('0xb')](saveUpdates(_0x343255['body'],null))['then'](respondWithResult(_0x222721,null))[_0xbf2c('0x3e')](handleError(_0x222721,null));};exports['describe']=function(_0xa08482,_0x1c64e0){return db[_0xbf2c('0x12')][_0xbf2c('0x44')]()[_0xbf2c('0xb')](respondWithResult(_0x1c64e0,null))[_0xbf2c('0x3e')](handleError(_0x1c64e0,null));};exports[_0xbf2c('0x45')]=function(_0x1c3b78,_0x128e97){var _0x23912d;var _0x31791b=_0x1c3b78['params']['id'];return db[_0xbf2c('0x12')][_0xbf2c('0x41')]({'where':{'id':_0x1c3b78[_0xbf2c('0x40')]['id']}})[_0xbf2c('0xb')](handleEntityNotFound(_0x128e97,null))['then'](function(_0x4edca4){if(_0x4edca4){return _0x4edca4['destroy']()[_0xbf2c('0xb')](function(_0x2451ba){return _0x2451ba;});}})['then'](function(_0x5a0c37){_0x23912d=_0x5a0c37;if(_0x5a0c37){if(_0x5a0c37['VoiceQueueId']||_0x5a0c37[_0xbf2c('0x46')]){return db[_0x5a0c37[_0xbf2c('0x47')]?_0xbf2c('0x48'):_0xbf2c('0x49')][_0xbf2c('0x41')]({'where':{'id':_0x5a0c37[_0xbf2c('0x47')]?_0x5a0c37['VoiceQueueId']:_0x5a0c37[_0xbf2c('0x46')]},'attributes':['id',_0xbf2c('0xf')],'raw':!![]});}}})[_0xbf2c('0xb')](function(_0x3fa07e){var _0x36d1ec={};if(_0x3fa07e){_[_0xbf2c('0x37')](_0x36d1ec,_[_0xbf2c('0x4a')](_0x23912d[_0xbf2c('0x4b')],['createdAt','updatedAt','id']));_0x36d1ec['state']=0x15;_0x36d1ec[_0xbf2c('0x4c')]=_0xbf2c('0x4d');_0x36d1ec[_0xbf2c('0x4e')]=_0x3fa07e[_0xbf2c('0xf')];_0x36d1ec['membername']=_0x1c3b78[_0xbf2c('0x4f')][_0xbf2c('0xf')];_0x36d1ec['UserId']=_0x1c3b78[_0xbf2c('0x4f')]['id'];_0x36d1ec[_0xbf2c('0x4d')]=!![];_0x36d1ec[_0xbf2c('0x50')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x36d1ec['calleridnum']=_0x23912d['phone'];_0x36d1ec[_0xbf2c('0x51')]=_0x23912d[_0xbf2c('0x47')]?_0xbf2c('0x52'):_0xbf2c('0x53');return db[_0xbf2c('0x54')]['find']({'where':{'id':_0x36d1ec[_0xbf2c('0x55')]},'attributes':[_0xbf2c('0x56'),'lastName']})[_0xbf2c('0xb')](function(_0x3f0129){if(!_['isNil'](_0x128e97)&&!_['isNil'](_0x3f0129['firstName'])){_0x36d1ec[_0xbf2c('0x57')]=_0x3f0129['firstName'];if(!_['isNil'](_0x3f0129[_0xbf2c('0x58')])){_0x36d1ec[_0xbf2c('0x57')]+='\x20'+_0x3f0129[_0xbf2c('0x58')];}}})[_0xbf2c('0x59')](function(){return db['CmHopperFinal']['create'](_0x36d1ec);});}})[_0xbf2c('0xb')](function(_0xc0b6ff){return db[_0xbf2c('0x5a')][_0xbf2c('0x45')]({'where':{'CmHopperId':_0x31791b}});})[_0xbf2c('0xb')](function(){return _0x128e97['status'](0xcc)['end']();})[_0xbf2c('0x3e')](handleError(_0x128e97,null));};exports[_0xbf2c('0x5b')]=function(_0x40f93e,_0x45b91c){var _0x1f984e=[];return db[_0xbf2c('0x54')]['describe']()['then'](function(_0x47b287){_0x1f984e=_[_0xbf2c('0x18')](_0x47b287);return _0x40f93e[_0xbf2c('0x4f')][_0xbf2c('0x5c')]({'where':{'type':_0xbf2c('0x5d'),'dialActive':!![],'dialMethod':_0xbf2c('0x5e')},'attributes':['id',_0xbf2c('0x5f'),_0xbf2c('0x60')],'raw':!![]});})[_0xbf2c('0xb')](function(_0x50d44d){if(_0x50d44d&&_0x50d44d['length']){return db[_0xbf2c('0x61')][_0xbf2c('0x62')](function(_0x38ce66){var _0x42f789={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xbf2c('0x63'))},'VoiceQueueId':{'$in':_[_0xbf2c('0x11')](_0x50d44d,'id')},'$or':[{'UserId':null},{'UserId':_0x40f93e[_0xbf2c('0x4f')]['id']}]};var _0x4ed155={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x50d44d)[_0xbf2c('0x36')]([_0xbf2c('0x60'),0x0])[_0xbf2c('0x11')]('id')[_0xbf2c('0x64')]()},'$or':[{'UserId':null},{'UserId':_0x40f93e['user']['id']}]};var _0x3e9448={'$or':[_0x42f789,_0x4ed155]};var _0x12bee7=[];if(_0x40f93e[_0xbf2c('0x43')]['direction']&&_0x40f93e['body'][_0xbf2c('0x65')]==='prev'){if(!_['isEmpty'](_0x40f93e[_0xbf2c('0x43')][_0xbf2c('0x66')])){_0x3e9448['id']={'$in':_0x40f93e[_0xbf2c('0x43')][_0xbf2c('0x66')]};}_0x12bee7=[[_0xbf2c('0x67'),'ASC'],['scheduledAt',_0x50d44d[0x0][_0xbf2c('0x5f')]===_0xbf2c('0x68')?'DESC':_0xbf2c('0x68')],db[_0xbf2c('0x61')]['literal'](_0xbf2c('0x69')),['id','DESC']];}else{if(!_[_0xbf2c('0x6a')](_0x40f93e[_0xbf2c('0x43')][_0xbf2c('0x66')])){_0x3e9448['id']={'$notIn':_0x40f93e['body'][_0xbf2c('0x66')]};}_0x12bee7=[[_0xbf2c('0x67'),_0xbf2c('0x6b')],[_0xbf2c('0x6c'),_0x50d44d[0x0][_0xbf2c('0x5f')]],db[_0xbf2c('0x61')][_0xbf2c('0x6d')](_0xbf2c('0x6e')),['id',_0xbf2c('0x68')]];}return db['CmHopper']['findOne']({'attributes':['id',_0xbf2c('0x6f'),_0xbf2c('0x70'),_0xbf2c('0x71')],'where':_0x3e9448,'order':_0x12bee7,'transaction':_0x38ce66,'lock':_0x38ce66[_0xbf2c('0x72')][_0xbf2c('0x73')],'include':[{'model':db[_0xbf2c('0x54')],'as':_0xbf2c('0x74'),'attributes':_0x1f984e,'include':[{'model':db['CmCompany'],'as':_0xbf2c('0x75'),'attributes':['id',_0xbf2c('0xf')]}]},{'model':db[_0xbf2c('0x76')],'as':_0xbf2c('0x77'),'attributes':['id',_0xbf2c('0xf')]},{'model':db['VoiceQueue'],'as':_0xbf2c('0x78'),'attributes':['id',_0xbf2c('0xf'),_0xbf2c('0x79')]}]})[_0xbf2c('0xb')](function(_0x4e7b32){if(_0x4e7b32){return _0x4e7b32[_0xbf2c('0xa')]({'UserId':_0x40f93e[_0xbf2c('0x4f')]['id']},{'transaction':_0x38ce66});}});});}})[_0xbf2c('0xb')](handleEntityNotFound(_0x45b91c,null))[_0xbf2c('0xb')](respondWithResult(_0x45b91c,null))[_0xbf2c('0x3e')](handleError(_0x45b91c,null));};exports[_0xbf2c('0x7a')]=function(_0x2029f7,_0x290f8c,_0x51617d){var _0x79cc7=[];var _0x5440a8=_0x2029f7[_0xbf2c('0x40')]['id'];var _0x12b821=_0x2029f7[_0xbf2c('0x4f')]['id'];return db['CmContact'][_0xbf2c('0x44')]()[_0xbf2c('0xb')](function(_0x4ff5c3){_0x79cc7=_[_0xbf2c('0x18')](_0x4ff5c3);return db['sequelize'][_0xbf2c('0x62')](function(_0x357989){const _0x307e46={'id':_0x5440a8};return db[_0xbf2c('0x12')]['findOne']({'attributes':['id','scheduledat',_0xbf2c('0x71')],'where':_0x307e46,'transaction':_0x357989,'lock':_0x357989[_0xbf2c('0x72')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xbf2c('0x74'),'attributes':_0x79cc7,'include':[{'model':db[_0xbf2c('0x7b')],'as':_0xbf2c('0x75'),'attributes':['id',_0xbf2c('0xf')]}]},{'model':db[_0xbf2c('0x76')],'as':'List','attributes':['id',_0xbf2c('0xf')]},{'model':db[_0xbf2c('0x48')],'as':_0xbf2c('0x78'),'attributes':['id',_0xbf2c('0xf'),_0xbf2c('0x79')]}]})[_0xbf2c('0xb')](function(_0x26fdee){if(_0x26fdee){return _0x26fdee[_0xbf2c('0xa')]({'UserId':_0x12b821},{'transaction':_0x357989});}});});})[_0xbf2c('0xb')](handleEntityNotFound(_0x290f8c,null))[_0xbf2c('0xb')](respondWithResult(_0x290f8c,null))[_0xbf2c('0x3e')](handleError(_0x290f8c,null));};exports[_0xbf2c('0x7c')]=function(_0x5ecd37,_0x3ab5ac){return _0x5ecd37[_0xbf2c('0x4f')][_0xbf2c('0x5c')]({'where':{'type':_0xbf2c('0x5d'),'dialActive':!![],'dialMethod':_0xbf2c('0x5e')},'attributes':['id'],'raw':!![]})[_0xbf2c('0xb')](function(_0x545447){if(_0x545447&&_0x545447[_0xbf2c('0x2f')]){return db[_0xbf2c('0x12')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xbf2c('0x7d')](_0xbf2c('0x63'))},'VoiceQueueId':{'$in':_[_0xbf2c('0x11')](_0x545447,'id')},'$or':[{'UserId':null},{'UserId':_0x5ecd37[_0xbf2c('0x4f')]['id']}]}});}return 0x0;})['then'](function(_0x2c7cf7){if(!_[_0xbf2c('0x7e')](_0x2c7cf7)&&_['isNumber'](_0x2c7cf7)){return _0x3ab5ac[_0xbf2c('0x7')](0xc8)[_0xbf2c('0x3')]({'contacts':_0x2c7cf7});}else{logger[_0xbf2c('0xd')](_0xbf2c('0x7f'),_0xbf2c('0x7c'),0x194,_0xbf2c('0x80'));_0x3ab5ac['sendStatus'](0x194);}})[_0xbf2c('0x3e')](handleError(_0x3ab5ac,null));};exports[_0xbf2c('0x81')]=function(_0x1377c1,_0x4fa011){var _0x2aa3c3=shared[_0xbf2c('0x82')];var _0x40681f=[];_[_0xbf2c('0x11')](_0x2aa3c3,function(_0x5f4f90){_0x40681f[_0xbf2c('0x83')]({'id':_0x5f4f90[_0xbf2c('0xf')],'name':_0x5f4f90[_0xbf2c('0xf')],'utcOffset':_0x5f4f90[_0xbf2c('0x84')]});});return _0x4fa011[_0xbf2c('0x7')](0xc8)[_0xbf2c('0x3')]({'tz':_0x40681f});};exports[_0xbf2c('0x85')]=function(_0x31d6f,_0x2fcb0a){var _0x391208=shared[_0xbf2c('0x82')];var _0x560da4={};if(!_[_0xbf2c('0x7e')](_0x391208[_0x31d6f['body']['id']]))_0x560da4=_0x391208[_0x31d6f[_0xbf2c('0x43')]['id']];return _0x2fcb0a[_0xbf2c('0x7')](0xc8)['json'](_0x560da4);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 250dc98..64e04e0 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 _0x2bd8=['CmHopper','cm_hopper','scheduledat','phone','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports','define'];(function(_0x825659,_0x4173e9){var _0x278309=function(_0x400940){while(--_0x400940){_0x825659['push'](_0x825659['shift']());}};_0x278309(++_0x4173e9);}(_0x2bd8,0x130));var _0x82bd=function(_0x501783,_0x592f56){_0x501783=_0x501783-0x0;var _0x700395=_0x2bd8[_0x501783];return _0x700395;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var logger=require(_0x82bd('0x1'))(_0x82bd('0x2'));var moment=require(_0x82bd('0x3'));var BPromise=require(_0x82bd('0x4'));var rp=require(_0x82bd('0x5'));var fs=require('fs');var path=require(_0x82bd('0x6'));var rimraf=require(_0x82bd('0x7'));var config=require('../../config/environment');var attributes=require(_0x82bd('0x8'));module[_0x82bd('0x9')]=function(_0x3bf810,_0x5ceb60){return _0x3bf810[_0x82bd('0xa')](_0x82bd('0xb'),attributes,{'tableName':_0x82bd('0xc'),'paranoid':![],'indexes':[{'name':_0x82bd('0xd'),'fields':['scheduledat']},{'name':_0x82bd('0xe'),'fields':['phone']},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x187d=['moment','bluebird','request-promise','path','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api'];(function(_0x53f402,_0x326920){var _0x45a76d=function(_0x51f590){while(--_0x51f590){_0x53f402['push'](_0x53f402['shift']());}};_0x45a76d(++_0x326920);}(_0x187d,0x93));var _0xd187=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x187d[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));module['exports']=function(_0x1d2533,_0x58ee7){return _0x1d2533[_0xd187('0x9')](_0xd187('0xa'),attributes,{'tableName':_0xd187('0xb'),'paranoid':![],'indexes':[{'name':_0xd187('0xc'),'fields':[_0xd187('0xc')]},{'name':_0xd187('0xd'),'fields':['phone']},{'name':_0xd187('0xe'),'fields':[_0xd187('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 105d914..ec24e82 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 _0xd21d=['CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','CmList','List','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','options','raw','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','ShowCmHopper','find','create','body','CreateCmHopper','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','describe','transaction','order','UPDATE','CmContact','name','voicePause','length','UserId','push','includes','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','sequelize','CmHopperFinal','CountReScheduled','findAll','COUNT','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','all','GetCmHopperPreview','Contact','keys','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls'];(function(_0x156eab,_0x2c6388){var _0x397845=function(_0x3ca209){while(--_0x3ca209){_0x156eab['push'](_0x156eab['shift']());}};_0x397845(++_0x2c6388);}(_0xd21d,0x14e));var _0xdd21=function(_0x423e15,_0x12b2b2){_0x423e15=_0x423e15-0x0;var _0x184279=_0xd21d[_0x423e15];return _0x184279;};'use strict';var _=require('lodash');var util=require(_0xdd21('0x0'));var moment=require(_0xdd21('0x1'));var BPromise=require(_0xdd21('0x2'));var db=require(_0xdd21('0x3'))['db'];var logger=require(_0xdd21('0x4'))(_0xdd21('0x5'));exports[_0xdd21('0x6')]=function(_0x2bf954){var _0x1b27ca=this;return new Promise(function(_0x100b71,_0x429912){return db[_0xdd21('0x7')]['findAll']({'raw':_0x2bf954[_0xdd21('0x8')]?_0x2bf954[_0xdd21('0x8')][_0xdd21('0x9')]===undefined?!![]:![]:!![],'where':_0x2bf954['options']?_0x2bf954[_0xdd21('0x8')][_0xdd21('0xa')]||null:null,'attributes':_0x2bf954[_0xdd21('0x8')]?_0x2bf954[_0xdd21('0x8')][_0xdd21('0xb')]||null:null,'limit':_0x2bf954[_0xdd21('0x8')]?_0x2bf954[_0xdd21('0x8')][_0xdd21('0xc')]||null:null,'include':_0x2bf954[_0xdd21('0x8')]?_0x2bf954[_0xdd21('0x8')][_0xdd21('0xd')]?_[_0xdd21('0xe')](_0x2bf954['options'][_0xdd21('0xd')],function(_0x5d52a1){return{'model':db[_0x5d52a1[_0xdd21('0xf')]],'as':_0x5d52a1['as'],'attributes':_0x5d52a1[_0xdd21('0xb')],'include':_0x5d52a1[_0xdd21('0xd')]?_[_0xdd21('0xe')](_0x5d52a1[_0xdd21('0xd')],function(_0x379a95){return{'model':db[_0x379a95['model']],'as':_0x379a95['as'],'attributes':_0x379a95[_0xdd21('0xb')],'include':_0x379a95[_0xdd21('0xd')]?_[_0xdd21('0xe')](_0x379a95['include'],function(_0x5814a6){return{'model':db[_0x5814a6[_0xdd21('0xf')]],'as':_0x5814a6['as'],'attributes':_0x5814a6[_0xdd21('0xb')]};}):[]};}):[]};}):[]:[]})[_0xdd21('0x10')](function(_0x441cb0){logger[_0xdd21('0x11')](_0xdd21('0x6'),_0x2bf954);logger[_0xdd21('0x12')](_0xdd21('0x6'),_0x2bf954,JSON[_0xdd21('0x13')](_0x441cb0));_0x100b71(_0x441cb0);})[_0xdd21('0x14')](function(_0x30014d){logger[_0xdd21('0x15')](_0xdd21('0x6'),_0x30014d[_0xdd21('0x16')],_0x2bf954);_0x429912(_0x1b27ca[_0xdd21('0x15')](0x1f4,_0x30014d[_0xdd21('0x16')]));});});};exports[_0xdd21('0x17')]=function(_0x29d1a9){var _0x5efd89=this;return new Promise(function(_0x30b7ee,_0x253840){return db['CmHopper'][_0xdd21('0x18')]({'raw':_0x29d1a9[_0xdd21('0x8')]?_0x29d1a9[_0xdd21('0x8')][_0xdd21('0x9')]===undefined?!![]:![]:!![],'where':_0x29d1a9[_0xdd21('0x8')]?_0x29d1a9[_0xdd21('0x8')][_0xdd21('0xa')]||null:null,'attributes':_0x29d1a9[_0xdd21('0x8')]?_0x29d1a9['options'][_0xdd21('0xb')]||null:null,'include':_0x29d1a9['options']?_0x29d1a9[_0xdd21('0x8')][_0xdd21('0xd')]?_[_0xdd21('0xe')](_0x29d1a9['options'][_0xdd21('0xd')],function(_0x1534c2){return{'model':db[_0x1534c2[_0xdd21('0xf')]],'as':_0x1534c2['as'],'attributes':_0x1534c2[_0xdd21('0xb')],'include':_0x1534c2[_0xdd21('0xd')]?_[_0xdd21('0xe')](_0x1534c2[_0xdd21('0xd')],function(_0x591075){return{'model':db[_0x591075['model']],'as':_0x591075['as'],'attributes':_0x591075[_0xdd21('0xb')],'include':_0x591075[_0xdd21('0xd')]?_[_0xdd21('0xe')](_0x591075[_0xdd21('0xd')],function(_0x1f4ca1){return{'model':db[_0x1f4ca1[_0xdd21('0xf')]],'as':_0x1f4ca1['as'],'attributes':_0x1f4ca1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dfec1){logger['info'](_0xdd21('0x17'),_0x29d1a9);logger[_0xdd21('0x12')]('ShowCmHopper',_0x29d1a9,JSON[_0xdd21('0x13')](_0x3dfec1));_0x30b7ee(_0x3dfec1);})[_0xdd21('0x14')](function(_0x2ea39b){logger['error'](_0xdd21('0x17'),_0x2ea39b[_0xdd21('0x16')],_0x29d1a9);_0x253840(_0x5efd89[_0xdd21('0x15')](0x1f4,_0x2ea39b[_0xdd21('0x16')]));});});};exports['CreateCmHopper']=function(_0x6a4346){var _0x230f35=this;return new Promise(function(_0x49569e,_0x119928){return db['CmHopper'][_0xdd21('0x19')](_0x6a4346[_0xdd21('0x1a')],{'raw':_0x6a4346[_0xdd21('0x8')]?_0x6a4346[_0xdd21('0x8')][_0xdd21('0x9')]===undefined?!![]:![]:!![]})[_0xdd21('0x10')](function(_0x30b5c9){logger[_0xdd21('0x11')]('CreateCmHopper',_0x6a4346);logger['debug'](_0xdd21('0x1b'),_0x6a4346,JSON[_0xdd21('0x13')](_0x30b5c9));_0x49569e(_0x30b5c9);})[_0xdd21('0x14')](function(_0x2f3d12){logger[_0xdd21('0x15')]('CreateCmHopper',_0x2f3d12[_0xdd21('0x16')],_0x6a4346);_0x119928(_0x230f35[_0xdd21('0x15')](0x1f4,_0x2f3d12[_0xdd21('0x16')]));});});};exports[_0xdd21('0x1c')]=function(_0x144515){var _0x23e39d=this;return new Promise(function(_0x429a2b,_0x125f82){return db['CmHopper'][_0xdd21('0x1d')](_0x144515[_0xdd21('0x1a')],{'raw':_0x144515[_0xdd21('0x8')]?_0x144515['options'][_0xdd21('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x144515['options']?_0x144515[_0xdd21('0x8')][_0xdd21('0xa')]||null:null,'attributes':_0x144515[_0xdd21('0x8')]?_0x144515[_0xdd21('0x8')][_0xdd21('0xb')]||null:null,'limit':_0x144515['options']?_0x144515[_0xdd21('0x8')][_0xdd21('0xc')]||null:null})[_0xdd21('0x10')](function(_0x1fb410){logger[_0xdd21('0x11')](_0xdd21('0x1c'),_0x144515);logger[_0xdd21('0x11')](_0xdd21('0x1e'),JSON[_0xdd21('0x13')](_0x144515['options'][_0xdd21('0xa')]),_0x144515[_0xdd21('0x1a')][_0xdd21('0x1f')]);logger[_0xdd21('0x12')](_0xdd21('0x1c'),_0x144515,JSON[_0xdd21('0x13')](_0x1fb410));_0x429a2b(_0x1fb410);})['catch'](function(_0xa36bba){logger[_0xdd21('0x15')](_0xdd21('0x1c'),_0xa36bba[_0xdd21('0x16')],_0x144515);_0x125f82(_0x23e39d[_0xdd21('0x15')](0x1f4,_0xa36bba[_0xdd21('0x16')]));});});};exports[_0xdd21('0x20')]=function(_0x5b64d4){var _0x59105e=this;return new Promise(function(_0x19dc41,_0x49b1ce){return db[_0xdd21('0x7')][_0xdd21('0x21')]({'where':_0x5b64d4['options']?_0x5b64d4['options'][_0xdd21('0xa')]||null:null})[_0xdd21('0x10')](function(_0x24e1a1){logger[_0xdd21('0x11')]('DestroyCmHopper',_0x5b64d4);logger[_0xdd21('0x12')](_0xdd21('0x20'),_0x5b64d4,JSON[_0xdd21('0x13')](_0x24e1a1));_0x19dc41(_0x24e1a1);})[_0xdd21('0x14')](function(_0x2769ab){logger[_0xdd21('0x15')](_0xdd21('0x20'),_0x2769ab[_0xdd21('0x16')],_0x5b64d4);_0x49b1ce(_0x59105e[_0xdd21('0x15')](0x1f4,_0x2769ab[_0xdd21('0x16')]));});});};exports['GetContactDialer']=function(_0x190e27){var _0x570985=this;return new Promise(function(_0x4ceb25,_0x3134b4){return db['CmContact'][_0xdd21('0x22')]()[_0xdd21('0x10')](function(_0x305608){return db['sequelize'][_0xdd21('0x23')](function(_0xeeee2a){return db['CmHopper']['findAll']({'where':_0x190e27[_0xdd21('0x8')]?_0x190e27[_0xdd21('0x8')][_0xdd21('0xa')]||null:null,'attributes':_0x190e27['options']?_0x190e27[_0xdd21('0x8')][_0xdd21('0xb')]||null:null,'limit':_0x190e27[_0xdd21('0x8')]?_0x190e27['options']['limit']||null:null,'order':_0x190e27['options']?_0x190e27[_0xdd21('0x8')][_0xdd21('0x24')]||null:null,'transaction':_0xeeee2a,'lock':_0xeeee2a['LOCK'][_0xdd21('0x25')],'include':[{'model':db[_0xdd21('0x26')],'as':'Contact','attributes':_['keys'](_0x305608)},{'model':db['User'],'as':'Agent','attributes':['id',_0xdd21('0x27'),_0xdd21('0x28')]}]})[_0xdd21('0x10')](function(_0x5b24cf){var _0x4a8fae=[];var _0x58281a=[];for(var _0x203e49=0x0;_0x203e49<_0x5b24cf[_0xdd21('0x29')];_0x203e49+=0x1){var _0x10e15d=_0x5b24cf[_0x203e49][_0xdd21('0x2a')];if(_0x10e15d===null){_0x4a8fae[_0xdd21('0x2b')](_0x5b24cf[_0x203e49][_0xdd21('0x1d')](_0x190e27[_0xdd21('0x1a')],{'transaction':_0xeeee2a}));}else if(!_0x58281a[_0xdd21('0x2c')](_0x10e15d)){_0x58281a['push'](_0x10e15d);_0x4a8fae[_0xdd21('0x2b')](_0x5b24cf[_0x203e49][_0xdd21('0x1d')](_0x190e27[_0xdd21('0x1a')],{'transaction':_0xeeee2a}));}}return BPromise['all'](_0x4a8fae);});})['then'](function(_0x2e08ac){logger[_0xdd21('0x11')](_0xdd21('0x2d'),_0x190e27);if(_0x2e08ac[_0xdd21('0x29')]>0x0){logger['info'](_0xdd21('0x2e'),_0x2e08ac[0x0][_0xdd21('0x2f')]['id'],_0x2e08ac[0x0][_0xdd21('0x2f')][_0xdd21('0x30')],_0x2e08ac[0x0]['dataValues'][_0xdd21('0x1f')]);}logger['debug'](_0xdd21('0x2d'),_0x190e27,JSON[_0xdd21('0x13')](_0x2e08ac));_0x4ceb25(_0x2e08ac);})[_0xdd21('0x14')](function(_0x5a2c3d){logger[_0xdd21('0x15')](_0xdd21('0x2d'),_0x5a2c3d[_0xdd21('0x16')],_0x190e27);_0x3134b4(_0x570985[_0xdd21('0x15')](0x1f4,_0x5a2c3d['message']));});});});};exports[_0xdd21('0x31')]=function(_0x557f76){var _0x4b4cd3=this;return new Promise(function(_0x29069e,_0x2c8da4){return db[_0xdd21('0x32')][_0xdd21('0x23')](function(_0x557aa9){return db[_0xdd21('0x33')][_0xdd21('0x19')](_0x557f76[_0xdd21('0x1a')],{'raw':_0x557f76['options']?_0x557f76[_0xdd21('0x8')][_0xdd21('0x9')]===undefined?!![]:![]:!![],'transaction':_0x557aa9})[_0xdd21('0x10')](function(){logger[_0xdd21('0x11')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xdd21('0x13')](_0x557f76[_0xdd21('0x8')]['where']),_0x557f76['options'][_0xdd21('0xa')][_0xdd21('0x1f')]);return db[_0xdd21('0x7')][_0xdd21('0x21')]({'where':_0x557f76['options']?_0x557f76[_0xdd21('0x8')][_0xdd21('0xa')]||null:null,'transaction':_0x557aa9});});})[_0xdd21('0x10')](function(_0x335dc7){logger[_0xdd21('0x11')](_0xdd21('0x31'),_0x557f76);logger[_0xdd21('0x12')](_0xdd21('0x31'),_0x557f76,JSON[_0xdd21('0x13')](_0x335dc7));_0x29069e(_0x335dc7);})[_0xdd21('0x14')](function(_0xe573c9){logger['error'](_0xdd21('0x31'),_0xe573c9[_0xdd21('0x16')],_0x557f76);_0x2c8da4(_0x4b4cd3['error'](0x1f4,_0xe573c9['message']));});});};exports[_0xdd21('0x34')]=function(_0x97daf7){var _0x19f156=this;return new Promise(function(_0x225173,_0x4a9489){return db['CmHopper'][_0xdd21('0x35')]({'raw':_0x97daf7[_0xdd21('0x8')]?_0x97daf7['options'][_0xdd21('0x9')]===undefined?!![]:![]:!![],'where':_0x97daf7[_0xdd21('0x8')]?_0x97daf7[_0xdd21('0x8')][_0xdd21('0xa')]||null:null,'attributes':[[db[_0xdd21('0x32')]['fn'](_0xdd21('0x36'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`scheduledat`\x20>=\x20'+util[_0xdd21('0x37')](_0xdd21('0x38'),moment()[_0xdd21('0x37')](_0xdd21('0x39')))+_0xdd21('0x3a')))),'contactsRescheduled']]})[_0xdd21('0x10')](function(_0x6b9fbc){logger[_0xdd21('0x11')](_0xdd21('0x34'),_0x97daf7);logger[_0xdd21('0x12')]('CountReScheduled',_0x97daf7,JSON[_0xdd21('0x13')](_0x6b9fbc));_0x225173(_0x6b9fbc);})[_0xdd21('0x14')](function(_0x29155b){logger['error']('CountReScheduled',_0x29155b[_0xdd21('0x16')],_0x97daf7);_0x4a9489(_0x19f156['error'](0x1f4,_0x29155b['message']));});});};exports[_0xdd21('0x3b')]=function(_0x38c023){var _0x460f6b=this;return new Promise(function(_0x416830,_0x56c483){return db['CmContact'][_0xdd21('0x22')]()[_0xdd21('0x10')](function(){return db[_0xdd21('0x32')][_0xdd21('0x23')](function(_0x2b1985){return db[_0xdd21('0x7')][_0xdd21('0x35')]({'where':_0x38c023[_0xdd21('0x8')]?_0x38c023[_0xdd21('0x8')][_0xdd21('0xa')]||null:null,'attributes':_0x38c023[_0xdd21('0x8')]?_0x38c023[_0xdd21('0x8')]['attributes']||null:null,'limit':0x1,'order':_0x38c023[_0xdd21('0x8')]?_0x38c023[_0xdd21('0x8')][_0xdd21('0x24')]||null:null,'group':db[_0xdd21('0x7')]['UserId'],'transaction':_0x2b1985,'lock':_0x2b1985['LOCK'][_0xdd21('0x25')],'include':_0x38c023[_0xdd21('0x8')]?_0x38c023[_0xdd21('0x8')][_0xdd21('0xd')]?_[_0xdd21('0xe')](_0x38c023['options']['include'],function(_0x4b281e){return{'model':db[_0x4b281e[_0xdd21('0xf')]],'as':_0x4b281e['as'],'attributes':_0x4b281e[_0xdd21('0xb')],'include':_0x4b281e['include']?_[_0xdd21('0xe')](_0x4b281e[_0xdd21('0xd')],function(_0x59e9ba){return{'model':db[_0x59e9ba[_0xdd21('0xf')]],'as':_0x59e9ba['as'],'attributes':_0x59e9ba[_0xdd21('0xb')],'include':_0x59e9ba[_0xdd21('0xd')]?_[_0xdd21('0xe')](_0x59e9ba[_0xdd21('0xd')],function(_0x5bb85b){return{'model':db[_0x5bb85b['model']],'as':_0x5bb85b['as'],'attributes':_0x5bb85b['attributes']};}):[]};}):[]};}):[]:[]})[_0xdd21('0x10')](function(_0xd60d12){var _0x345afd=[];for(var _0x597363=0x0;_0x597363<_0xd60d12[_0xdd21('0x29')];_0x597363+=0x1){_0x345afd['push'](_0xd60d12[_0x597363][_0xdd21('0x1d')](_0x38c023[_0xdd21('0x1a')],{'transaction':_0x2b1985}));}return BPromise[_0xdd21('0x3c')](_0x345afd);});})[_0xdd21('0x10')](function(_0x5bad02){logger['info'](_0xdd21('0x3b'),_0x38c023);logger['debug'](_0xdd21('0x3b'),_0x38c023,JSON[_0xdd21('0x13')](_0x5bad02));_0x416830(_0x5bad02);})['catch'](function(_0x170841){logger['error'](_0xdd21('0x3b'),_0x170841[_0xdd21('0x16')],_0x38c023);_0x56c483(_0x460f6b[_0xdd21('0x15')](0x1f4,_0x170841['message']));});});});};exports[_0xdd21('0x3d')]=function(_0x6f3811){var _0x40058d=this;return new Promise(function(_0xd61060,_0x2af28b){db[_0xdd21('0x26')]['describe']()[_0xdd21('0x10')](function(_0x2c6742){return db['CmHopper']['findAll']({'raw':_0x6f3811[_0xdd21('0x8')]?_0x6f3811['options'][_0xdd21('0x9')]===undefined?!![]:![]:!![],'where':_0x6f3811[_0xdd21('0x8')]?_0x6f3811[_0xdd21('0x8')]['where']||null:null,'attributes':_0x6f3811['options']?_0x6f3811[_0xdd21('0x8')][_0xdd21('0xb')]||null:null,'limit':_0x6f3811['options']?_0x6f3811[_0xdd21('0x8')][_0xdd21('0xc')]||null:null,'include':_0x6f3811[_0xdd21('0x8')]?_0x6f3811[_0xdd21('0x8')][_0xdd21('0xd')]?_[_0xdd21('0xe')](_0x6f3811['options'][_0xdd21('0xd')],function(_0x21d7c6){return{'model':db[_0x21d7c6[_0xdd21('0xf')]],'as':_0x21d7c6['as'],'attributes':_0x21d7c6['as']===_0xdd21('0x3e')?_[_0xdd21('0x3f')](_0x2c6742):_0x21d7c6[_0xdd21('0xb')],'include':_0x21d7c6[_0xdd21('0xd')]?_['map'](_0x21d7c6[_0xdd21('0xd')],function(_0x384e66){return{'model':db[_0x384e66[_0xdd21('0xf')]],'as':_0x384e66['as'],'attributes':_0x384e66[_0xdd21('0xb')],'include':_0x384e66['include']?_['map'](_0x384e66['include'],function(_0x34743f){return{'model':db[_0x34743f[_0xdd21('0xf')]],'as':_0x34743f['as'],'attributes':_0x34743f[_0xdd21('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa730ba){logger['info'](_0xdd21('0x6'),_0x6f3811);logger[_0xdd21('0x12')](_0xdd21('0x6'),_0x6f3811,JSON[_0xdd21('0x13')](_0xa730ba));_0xd61060(_0xa730ba);})[_0xdd21('0x14')](function(_0x395c44){logger[_0xdd21('0x15')](_0xdd21('0x6'),_0x395c44[_0xdd21('0x16')],_0x6f3811);_0x2af28b(_0x40058d['error'](0x1f4,_0x395c44[_0xdd21('0x16')]));});});});};exports[_0xdd21('0x40')]=function(_0x53b8f5){var _0x550343=this;return new Promise(function(_0x297138,_0x46d4f3){return db[_0xdd21('0x26')][_0xdd21('0x41')]({'raw':!![],'where':{'phone':_0x53b8f5['options'][_0xdd21('0xa')][_0xdd21('0x42')]},'attributes':['id',_0xdd21('0x43')],'order':[['id',_0xdd21('0x44')]]})[_0xdd21('0x10')](function(_0x4fbd22){logger[_0xdd21('0x11')](_0xdd21('0x45'),_0x53b8f5);logger[_0xdd21('0x12')](_0xdd21('0x45'),_0x53b8f5,JSON[_0xdd21('0x13')](_0x4fbd22));_0x297138(_0x4fbd22);})[_0xdd21('0x14')](function(_0x1b90e1){logger[_0xdd21('0x15')]('getContactByPhone',_0x1b90e1[_0xdd21('0x16')],_0x53b8f5);_0x46d4f3(_0x550343[_0xdd21('0x15')](0x1f4,_0x1b90e1[_0xdd21('0x16')]));});});};exports[_0xdd21('0x46')]=function(_0x310445){var _0x2556e2=this;return new Promise(function(_0x27c8af,_0xf7b66f){return db['sequelize'][_0xdd21('0x23')](function(_0x2af293){var _0x34f4ce=_0x310445[_0xdd21('0x8')]&&_0x310445[_0xdd21('0x8')][_0xdd21('0xa')]?_0x310445[_0xdd21('0x8')][_0xdd21('0xa')]:{};return db['CmHopper'][_0xdd21('0x1d')](_0x310445[_0xdd21('0x1a')],{'where':_0x34f4ce,'transaction':_0x2af293})[_0xdd21('0x10')](function(_0x40216d){logger[_0xdd21('0x11')]('ResetActiveCalls',_0x310445);logger[_0xdd21('0x12')]('ResetActiveCalls',_0x310445,JSON[_0xdd21('0x13')](_0x40216d));_0x27c8af(_0x40216d);})[_0xdd21('0x14')](function(_0x438bfe){logger[_0xdd21('0x15')](_0xdd21('0x46'),_0x438bfe[_0xdd21('0x16')],_0x310445);_0xf7b66f(_0x2556e2[_0xdd21('0x15')](0x1f4,_0x438bfe['message']));});});});};exports[_0xdd21('0x47')]=function(_0xe12ea6){var _0x1d7291=this;var _0x1dde4c=_0xe12ea6['body'][_0xdd21('0xa')][_0xdd21('0x48')];var _0x1f9fc7=_0xe12ea6[_0xdd21('0x1a')]['where'][_0xdd21('0x49')];var _0x3472fb=_0xe12ea6[_0xdd21('0x1a')]['where']['availableAgentsIds'];return new Promise(function(_0x18b716,_0x18e8ba){return db[_0xdd21('0x7')][_0xdd21('0x35')]({'where':{'voiceQueueId':{'$in':_0x1dde4c},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xdd21('0x32')][_0xdd21('0x4a')](_0xdd21('0x4b')+_0x1f9fc7+_0xdd21('0x4c')),'$gt':db['sequelize'][_0xdd21('0x4a')](_0xdd21('0x4d'))}},'UserId':{'$in':_0x3472fb}},'include':[{'model':db[_0xdd21('0x26')],'as':_0xdd21('0x3e')},{'model':db[_0xdd21('0x4e')],'as':'Agent','attributes':['id',_0xdd21('0x27'),_0xdd21('0x28')]},{'model':db[_0xdd21('0x4f')],'as':_0xdd21('0x50')}]})[_0xdd21('0x10')](function(_0x2468ff){if(_0x2468ff['length']>0x0){return db[_0xdd21('0x32')]['transaction'](function(_0x21fd73){return db[_0xdd21('0x7')][_0xdd21('0x1d')]({'recallmeNotifiedDate':db[_0xdd21('0x32')][_0xdd21('0x4a')](_0xdd21('0x4d'))},{'where':{'id':{'$in':_['map'](_0x2468ff,'id')}},'transaction':_0x21fd73})[_0xdd21('0x10')](function(){_0x18b716(_0x2468ff);})['catch'](function(_0x5bd8c3){logger['error'](_0xdd21('0x47'),_0x5bd8c3[_0xdd21('0x16')],_0xe12ea6);_0x18e8ba(_0x1d7291[_0xdd21('0x15')](0x1f4,_0x5bd8c3[_0xdd21('0x16')]));});})[_0xdd21('0x14')](function(_0x162b72){logger['error'](_0xdd21('0x47'),_0x162b72[_0xdd21('0x16')],_0xe12ea6);_0x18e8ba(_0x1d7291[_0xdd21('0x15')](0x1f4,_0x162b72[_0xdd21('0x16')]));});}else{_0x18b716(_0x2468ff);}});});}; \ No newline at end of file +var _0xe423=['User','Agent','name','UserId','includes','push','GetContactDialer','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','sequelize','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','findAll','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','voicePause','List','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','CmHopper','options','where','attributes','include','model','map','info','GetCmHopper','stringify','catch','message','error','ShowCmHopper','find','raw','then','debug','CreateCmHopper','create','update','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy','DestroyCmHopper','CmContact','describe','transaction','limit','order','LOCK','UPDATE','Contact','keys'];(function(_0xd1b4d7,_0x28b2c1){var _0x3002ec=function(_0x3d95ce){while(--_0x3d95ce){_0xd1b4d7['push'](_0xd1b4d7['shift']());}};_0x3002ec(++_0x28b2c1);}(_0xe423,0x125));var _0x3e42=function(_0x75979f,_0x2540a0){_0x75979f=_0x75979f-0x0;var _0x253db5=_0xe423[_0x75979f];return _0x253db5;};'use strict';var _=require(_0x3e42('0x0'));var util=require(_0x3e42('0x1'));var moment=require(_0x3e42('0x2'));var BPromise=require(_0x3e42('0x3'));var db=require(_0x3e42('0x4'))['db'];var logger=require(_0x3e42('0x5'))(_0x3e42('0x6'));exports['GetCmHopper']=function(_0x2d2f27){var _0x38d21d=this;return new Promise(function(_0x109b42,_0x5229c3){return db[_0x3e42('0x7')]['findAll']({'raw':_0x2d2f27['options']?_0x2d2f27[_0x3e42('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x2d2f27[_0x3e42('0x8')]?_0x2d2f27['options'][_0x3e42('0x9')]||null:null,'attributes':_0x2d2f27[_0x3e42('0x8')]?_0x2d2f27['options'][_0x3e42('0xa')]||null:null,'limit':_0x2d2f27[_0x3e42('0x8')]?_0x2d2f27[_0x3e42('0x8')]['limit']||null:null,'include':_0x2d2f27[_0x3e42('0x8')]?_0x2d2f27[_0x3e42('0x8')][_0x3e42('0xb')]?_['map'](_0x2d2f27['options'][_0x3e42('0xb')],function(_0x42e159){return{'model':db[_0x42e159[_0x3e42('0xc')]],'as':_0x42e159['as'],'attributes':_0x42e159[_0x3e42('0xa')],'include':_0x42e159[_0x3e42('0xb')]?_[_0x3e42('0xd')](_0x42e159['include'],function(_0x2a5d47){return{'model':db[_0x2a5d47[_0x3e42('0xc')]],'as':_0x2a5d47['as'],'attributes':_0x2a5d47[_0x3e42('0xa')],'include':_0x2a5d47['include']?_[_0x3e42('0xd')](_0x2a5d47[_0x3e42('0xb')],function(_0x3e9750){return{'model':db[_0x3e9750[_0x3e42('0xc')]],'as':_0x3e9750['as'],'attributes':_0x3e9750[_0x3e42('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x55c271){logger[_0x3e42('0xe')](_0x3e42('0xf'),_0x2d2f27);logger['debug'](_0x3e42('0xf'),_0x2d2f27,JSON[_0x3e42('0x10')](_0x55c271));_0x109b42(_0x55c271);})[_0x3e42('0x11')](function(_0x4e0701){logger['error'](_0x3e42('0xf'),_0x4e0701[_0x3e42('0x12')],_0x2d2f27);_0x5229c3(_0x38d21d[_0x3e42('0x13')](0x1f4,_0x4e0701[_0x3e42('0x12')]));});});};exports[_0x3e42('0x14')]=function(_0x119fa8){var _0xacf14c=this;return new Promise(function(_0x4f5145,_0x5521db){return db[_0x3e42('0x7')][_0x3e42('0x15')]({'raw':_0x119fa8[_0x3e42('0x8')]?_0x119fa8['options'][_0x3e42('0x16')]===undefined?!![]:![]:!![],'where':_0x119fa8[_0x3e42('0x8')]?_0x119fa8['options'][_0x3e42('0x9')]||null:null,'attributes':_0x119fa8[_0x3e42('0x8')]?_0x119fa8[_0x3e42('0x8')][_0x3e42('0xa')]||null:null,'include':_0x119fa8['options']?_0x119fa8['options'][_0x3e42('0xb')]?_[_0x3e42('0xd')](_0x119fa8[_0x3e42('0x8')][_0x3e42('0xb')],function(_0x316a7c){return{'model':db[_0x316a7c['model']],'as':_0x316a7c['as'],'attributes':_0x316a7c[_0x3e42('0xa')],'include':_0x316a7c[_0x3e42('0xb')]?_['map'](_0x316a7c['include'],function(_0x4488c6){return{'model':db[_0x4488c6[_0x3e42('0xc')]],'as':_0x4488c6['as'],'attributes':_0x4488c6[_0x3e42('0xa')],'include':_0x4488c6[_0x3e42('0xb')]?_['map'](_0x4488c6[_0x3e42('0xb')],function(_0x3fceb6){return{'model':db[_0x3fceb6[_0x3e42('0xc')]],'as':_0x3fceb6['as'],'attributes':_0x3fceb6[_0x3e42('0xa')]};}):[]};}):[]};}):[]:[]})[_0x3e42('0x17')](function(_0x425d92){logger[_0x3e42('0xe')](_0x3e42('0x14'),_0x119fa8);logger[_0x3e42('0x18')]('ShowCmHopper',_0x119fa8,JSON[_0x3e42('0x10')](_0x425d92));_0x4f5145(_0x425d92);})[_0x3e42('0x11')](function(_0x82556){logger['error'](_0x3e42('0x14'),_0x82556[_0x3e42('0x12')],_0x119fa8);_0x5521db(_0xacf14c[_0x3e42('0x13')](0x1f4,_0x82556[_0x3e42('0x12')]));});});};exports[_0x3e42('0x19')]=function(_0x2822d2){var _0x39c117=this;return new Promise(function(_0x46a2f0,_0x432768){return db[_0x3e42('0x7')][_0x3e42('0x1a')](_0x2822d2['body'],{'raw':_0x2822d2['options']?_0x2822d2['options'][_0x3e42('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x10c73c){logger[_0x3e42('0xe')](_0x3e42('0x19'),_0x2822d2);logger['debug'](_0x3e42('0x19'),_0x2822d2,JSON[_0x3e42('0x10')](_0x10c73c));_0x46a2f0(_0x10c73c);})[_0x3e42('0x11')](function(_0x110cf5){logger['error']('CreateCmHopper',_0x110cf5[_0x3e42('0x12')],_0x2822d2);_0x432768(_0x39c117[_0x3e42('0x13')](0x1f4,_0x110cf5[_0x3e42('0x12')]));});});};exports['UpdateCmHopper']=function(_0x37d379){var _0x237393=this;return new Promise(function(_0x5a6696,_0x3547f5){return db[_0x3e42('0x7')][_0x3e42('0x1b')](_0x37d379[_0x3e42('0x1c')],{'raw':_0x37d379['options']?_0x37d379['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37d379[_0x3e42('0x8')]?_0x37d379['options']['where']||null:null,'attributes':_0x37d379[_0x3e42('0x8')]?_0x37d379[_0x3e42('0x8')]['attributes']||null:null,'limit':_0x37d379[_0x3e42('0x8')]?_0x37d379[_0x3e42('0x8')]['limit']||null:null})['then'](function(_0x51cd1b){logger[_0x3e42('0xe')](_0x3e42('0x1d'),_0x37d379);logger[_0x3e42('0xe')](_0x3e42('0x1e'),JSON[_0x3e42('0x10')](_0x37d379[_0x3e42('0x8')][_0x3e42('0x9')]),_0x37d379[_0x3e42('0x1c')][_0x3e42('0x1f')]);logger[_0x3e42('0x18')](_0x3e42('0x1d'),_0x37d379,JSON[_0x3e42('0x10')](_0x51cd1b));_0x5a6696(_0x51cd1b);})['catch'](function(_0x33be06){logger[_0x3e42('0x13')](_0x3e42('0x1d'),_0x33be06[_0x3e42('0x12')],_0x37d379);_0x3547f5(_0x237393[_0x3e42('0x13')](0x1f4,_0x33be06[_0x3e42('0x12')]));});});};exports['DestroyCmHopper']=function(_0x294853){var _0xb13a8d=this;return new Promise(function(_0x595313,_0x11fd15){return db[_0x3e42('0x7')][_0x3e42('0x20')]({'where':_0x294853['options']?_0x294853['options'][_0x3e42('0x9')]||null:null})[_0x3e42('0x17')](function(_0x408104){logger[_0x3e42('0xe')](_0x3e42('0x21'),_0x294853);logger[_0x3e42('0x18')]('DestroyCmHopper',_0x294853,JSON['stringify'](_0x408104));_0x595313(_0x408104);})[_0x3e42('0x11')](function(_0x1afb43){logger[_0x3e42('0x13')](_0x3e42('0x21'),_0x1afb43['message'],_0x294853);_0x11fd15(_0xb13a8d[_0x3e42('0x13')](0x1f4,_0x1afb43['message']));});});};exports['GetContactDialer']=function(_0x4125a7){var _0x1d52a7=this;return new Promise(function(_0x1c2790,_0x1277ec){return db[_0x3e42('0x22')][_0x3e42('0x23')]()[_0x3e42('0x17')](function(_0x16c58a){return db['sequelize'][_0x3e42('0x24')](function(_0x2b8773){return db[_0x3e42('0x7')]['findAll']({'where':_0x4125a7[_0x3e42('0x8')]?_0x4125a7['options'][_0x3e42('0x9')]||null:null,'attributes':_0x4125a7['options']?_0x4125a7[_0x3e42('0x8')][_0x3e42('0xa')]||null:null,'limit':_0x4125a7[_0x3e42('0x8')]?_0x4125a7[_0x3e42('0x8')][_0x3e42('0x25')]||null:null,'order':_0x4125a7[_0x3e42('0x8')]?_0x4125a7[_0x3e42('0x8')][_0x3e42('0x26')]||null:null,'transaction':_0x2b8773,'lock':_0x2b8773[_0x3e42('0x27')][_0x3e42('0x28')],'include':[{'model':db[_0x3e42('0x22')],'as':_0x3e42('0x29'),'attributes':_[_0x3e42('0x2a')](_0x16c58a)},{'model':db[_0x3e42('0x2b')],'as':_0x3e42('0x2c'),'attributes':['id',_0x3e42('0x2d'),'voicePause']}]})['then'](function(_0x51457b){var _0x3ccefa=[];var _0x487ddb=[];for(var _0x190186=0x0;_0x190186<_0x51457b['length'];_0x190186+=0x1){var _0x1d6f48=_0x51457b[_0x190186][_0x3e42('0x2e')];if(_0x1d6f48===null){_0x3ccefa['push'](_0x51457b[_0x190186][_0x3e42('0x1b')](_0x4125a7['body'],{'transaction':_0x2b8773}));}else if(!_0x487ddb[_0x3e42('0x2f')](_0x1d6f48)){_0x487ddb[_0x3e42('0x30')](_0x1d6f48);_0x3ccefa[_0x3e42('0x30')](_0x51457b[_0x190186][_0x3e42('0x1b')](_0x4125a7[_0x3e42('0x1c')],{'transaction':_0x2b8773}));}}return BPromise['all'](_0x3ccefa);});})[_0x3e42('0x17')](function(_0x217833){logger[_0x3e42('0xe')](_0x3e42('0x31'),_0x4125a7);if(_0x217833[_0x3e42('0x32')]>0x0){logger[_0x3e42('0xe')](_0x3e42('0x33'),_0x217833[0x0][_0x3e42('0x34')]['id'],_0x217833[0x0][_0x3e42('0x34')][_0x3e42('0x35')],_0x217833[0x0][_0x3e42('0x34')][_0x3e42('0x1f')]);}logger[_0x3e42('0x18')]('GetContactDialer',_0x4125a7,JSON[_0x3e42('0x10')](_0x217833));_0x1c2790(_0x217833);})[_0x3e42('0x11')](function(_0x132f33){logger[_0x3e42('0x13')](_0x3e42('0x31'),_0x132f33[_0x3e42('0x12')],_0x4125a7);_0x1277ec(_0x1d52a7[_0x3e42('0x13')](0x1f4,_0x132f33[_0x3e42('0x12')]));});});});};exports['MoveContactManagedDialer']=function(_0x4a5f56){var _0x50f3d4=this;return new Promise(function(_0x2f53c8,_0x3b4ab7){return db[_0x3e42('0x36')][_0x3e42('0x24')](function(_0x2d9adc){return db[_0x3e42('0x37')][_0x3e42('0x1a')](_0x4a5f56['body'],{'raw':_0x4a5f56[_0x3e42('0x8')]?_0x4a5f56[_0x3e42('0x8')][_0x3e42('0x16')]===undefined?!![]:![]:!![],'transaction':_0x2d9adc})[_0x3e42('0x17')](function(){logger[_0x3e42('0xe')](_0x3e42('0x38'),JSON['stringify'](_0x4a5f56[_0x3e42('0x8')][_0x3e42('0x9')]),_0x4a5f56[_0x3e42('0x8')]['where'][_0x3e42('0x1f')]);return db[_0x3e42('0x7')]['destroy']({'where':_0x4a5f56['options']?_0x4a5f56[_0x3e42('0x8')][_0x3e42('0x9')]||null:null,'transaction':_0x2d9adc});});})[_0x3e42('0x17')](function(_0x49253a){logger[_0x3e42('0xe')]('MoveContactManagedDialer',_0x4a5f56);logger[_0x3e42('0x18')](_0x3e42('0x39'),_0x4a5f56,JSON[_0x3e42('0x10')](_0x49253a));_0x2f53c8(_0x49253a);})['catch'](function(_0x55a666){logger[_0x3e42('0x13')]('MoveContactManagedDialer',_0x55a666[_0x3e42('0x12')],_0x4a5f56);_0x3b4ab7(_0x50f3d4[_0x3e42('0x13')](0x1f4,_0x55a666[_0x3e42('0x12')]));});});};exports[_0x3e42('0x3a')]=function(_0xb118b6){var _0x14124a=this;return new Promise(function(_0x4a6f41,_0x28138c){return db[_0x3e42('0x7')][_0x3e42('0x3b')]({'raw':_0xb118b6[_0x3e42('0x8')]?_0xb118b6[_0x3e42('0x8')][_0x3e42('0x16')]===undefined?!![]:![]:!![],'where':_0xb118b6[_0x3e42('0x8')]?_0xb118b6[_0x3e42('0x8')]['where']||null:null,'attributes':[[db[_0x3e42('0x36')]['fn'](_0x3e42('0x3c'),db[_0x3e42('0x36')]['fn']('IF',db[_0x3e42('0x36')][_0x3e42('0x3d')](_0x3e42('0x3e')+util[_0x3e42('0x3f')](_0x3e42('0x40'),moment()['format'](_0x3e42('0x41')))+_0x3e42('0x42')))),_0x3e42('0x43')]]})['then'](function(_0x3d478d){logger['info'](_0x3e42('0x3a'),_0xb118b6);logger[_0x3e42('0x18')]('CountReScheduled',_0xb118b6,JSON['stringify'](_0x3d478d));_0x4a6f41(_0x3d478d);})[_0x3e42('0x11')](function(_0x5c2b76){logger[_0x3e42('0x13')]('CountReScheduled',_0x5c2b76[_0x3e42('0x12')],_0xb118b6);_0x28138c(_0x14124a[_0x3e42('0x13')](0x1f4,_0x5c2b76[_0x3e42('0x12')]));});});};exports['GetContactRecallMe']=function(_0x4eda1f){var _0x592629=this;return new Promise(function(_0x3a10d6,_0x13bfb6){return db[_0x3e42('0x22')]['describe']()[_0x3e42('0x17')](function(){return db[_0x3e42('0x36')][_0x3e42('0x24')](function(_0x2633a5){return db['CmHopper'][_0x3e42('0x3b')]({'where':_0x4eda1f[_0x3e42('0x8')]?_0x4eda1f[_0x3e42('0x8')]['where']||null:null,'attributes':_0x4eda1f[_0x3e42('0x8')]?_0x4eda1f[_0x3e42('0x8')][_0x3e42('0xa')]||null:null,'limit':0x1,'order':_0x4eda1f[_0x3e42('0x8')]?_0x4eda1f['options'][_0x3e42('0x26')]||null:null,'group':db[_0x3e42('0x7')]['UserId'],'transaction':_0x2633a5,'lock':_0x2633a5['LOCK'][_0x3e42('0x28')],'include':_0x4eda1f[_0x3e42('0x8')]?_0x4eda1f[_0x3e42('0x8')]['include']?_[_0x3e42('0xd')](_0x4eda1f[_0x3e42('0x8')][_0x3e42('0xb')],function(_0x49aaa3){return{'model':db[_0x49aaa3[_0x3e42('0xc')]],'as':_0x49aaa3['as'],'attributes':_0x49aaa3[_0x3e42('0xa')],'include':_0x49aaa3[_0x3e42('0xb')]?_[_0x3e42('0xd')](_0x49aaa3[_0x3e42('0xb')],function(_0x40c28a){return{'model':db[_0x40c28a[_0x3e42('0xc')]],'as':_0x40c28a['as'],'attributes':_0x40c28a[_0x3e42('0xa')],'include':_0x40c28a['include']?_[_0x3e42('0xd')](_0x40c28a[_0x3e42('0xb')],function(_0x77f65f){return{'model':db[_0x77f65f['model']],'as':_0x77f65f['as'],'attributes':_0x77f65f['attributes']};}):[]};}):[]};}):[]:[]})[_0x3e42('0x17')](function(_0x304889){var _0x1479ce=[];for(var _0x3daac5=0x0;_0x3daac5<_0x304889[_0x3e42('0x32')];_0x3daac5+=0x1){_0x1479ce[_0x3e42('0x30')](_0x304889[_0x3daac5][_0x3e42('0x1b')](_0x4eda1f[_0x3e42('0x1c')],{'transaction':_0x2633a5}));}return BPromise['all'](_0x1479ce);});})['then'](function(_0x20831d){logger[_0x3e42('0xe')]('GetContactRecallMe',_0x4eda1f);logger[_0x3e42('0x18')](_0x3e42('0x44'),_0x4eda1f,JSON[_0x3e42('0x10')](_0x20831d));_0x3a10d6(_0x20831d);})[_0x3e42('0x11')](function(_0x2ceea5){logger[_0x3e42('0x13')](_0x3e42('0x44'),_0x2ceea5[_0x3e42('0x12')],_0x4eda1f);_0x13bfb6(_0x592629[_0x3e42('0x13')](0x1f4,_0x2ceea5[_0x3e42('0x12')]));});});});};exports['GetCmHopperPreview']=function(_0x4f3947){var _0x1ae390=this;return new Promise(function(_0x56a558,_0x4dde14){db[_0x3e42('0x22')][_0x3e42('0x23')]()[_0x3e42('0x17')](function(_0x404a29){return db[_0x3e42('0x7')][_0x3e42('0x3b')]({'raw':_0x4f3947[_0x3e42('0x8')]?_0x4f3947[_0x3e42('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x4f3947['options']?_0x4f3947[_0x3e42('0x8')][_0x3e42('0x9')]||null:null,'attributes':_0x4f3947['options']?_0x4f3947[_0x3e42('0x8')][_0x3e42('0xa')]||null:null,'limit':_0x4f3947[_0x3e42('0x8')]?_0x4f3947[_0x3e42('0x8')]['limit']||null:null,'include':_0x4f3947[_0x3e42('0x8')]?_0x4f3947[_0x3e42('0x8')][_0x3e42('0xb')]?_[_0x3e42('0xd')](_0x4f3947[_0x3e42('0x8')][_0x3e42('0xb')],function(_0x5d3b33){return{'model':db[_0x5d3b33[_0x3e42('0xc')]],'as':_0x5d3b33['as'],'attributes':_0x5d3b33['as']===_0x3e42('0x29')?_['keys'](_0x404a29):_0x5d3b33[_0x3e42('0xa')],'include':_0x5d3b33[_0x3e42('0xb')]?_[_0x3e42('0xd')](_0x5d3b33[_0x3e42('0xb')],function(_0x9134e){return{'model':db[_0x9134e[_0x3e42('0xc')]],'as':_0x9134e['as'],'attributes':_0x9134e[_0x3e42('0xa')],'include':_0x9134e[_0x3e42('0xb')]?_[_0x3e42('0xd')](_0x9134e[_0x3e42('0xb')],function(_0x31f737){return{'model':db[_0x31f737[_0x3e42('0xc')]],'as':_0x31f737['as'],'attributes':_0x31f737[_0x3e42('0xa')]};}):[]};}):[]};}):[]:[]})[_0x3e42('0x17')](function(_0x36343c){logger[_0x3e42('0xe')](_0x3e42('0xf'),_0x4f3947);logger[_0x3e42('0x18')]('GetCmHopper',_0x4f3947,JSON[_0x3e42('0x10')](_0x36343c));_0x56a558(_0x36343c);})[_0x3e42('0x11')](function(_0x33530d){logger['error'](_0x3e42('0xf'),_0x33530d[_0x3e42('0x12')],_0x4f3947);_0x4dde14(_0x1ae390['error'](0x1f4,_0x33530d['message']));});});});};exports[_0x3e42('0x45')]=function(_0x523965){var _0x326e37=this;return new Promise(function(_0x2e29e5,_0x41c9d5){return db[_0x3e42('0x22')][_0x3e42('0x46')]({'raw':!![],'where':{'phone':_0x523965[_0x3e42('0x8')][_0x3e42('0x9')]['phone']},'attributes':['id',_0x3e42('0x47')],'order':[['id',_0x3e42('0x48')]]})[_0x3e42('0x17')](function(_0x1cf251){logger[_0x3e42('0xe')](_0x3e42('0x49'),_0x523965);logger[_0x3e42('0x18')](_0x3e42('0x49'),_0x523965,JSON[_0x3e42('0x10')](_0x1cf251));_0x2e29e5(_0x1cf251);})[_0x3e42('0x11')](function(_0x428b6a){logger['error'](_0x3e42('0x49'),_0x428b6a[_0x3e42('0x12')],_0x523965);_0x41c9d5(_0x326e37[_0x3e42('0x13')](0x1f4,_0x428b6a['message']));});});};exports[_0x3e42('0x4a')]=function(_0x38a166){var _0x59460b=this;return new Promise(function(_0x5ea0b1,_0x4dc90e){return db['sequelize'][_0x3e42('0x24')](function(_0x4f9346){var _0x50e949=_0x38a166[_0x3e42('0x8')]&&_0x38a166[_0x3e42('0x8')][_0x3e42('0x9')]?_0x38a166['options'][_0x3e42('0x9')]:{};return db[_0x3e42('0x7')][_0x3e42('0x1b')](_0x38a166['body'],{'where':_0x50e949,'transaction':_0x4f9346})[_0x3e42('0x17')](function(_0x4650f3){logger[_0x3e42('0xe')](_0x3e42('0x4a'),_0x38a166);logger[_0x3e42('0x18')](_0x3e42('0x4a'),_0x38a166,JSON[_0x3e42('0x10')](_0x4650f3));_0x5ea0b1(_0x4650f3);})[_0x3e42('0x11')](function(_0x1f4d9d){logger[_0x3e42('0x13')]('ResetActiveCalls',_0x1f4d9d[_0x3e42('0x12')],_0x38a166);_0x4dc90e(_0x59460b[_0x3e42('0x13')](0x1f4,_0x1f4d9d[_0x3e42('0x12')]));});});});};exports[_0x3e42('0x4b')]=function(_0x3c218b){var _0x2ad9d3=this;var _0x33b9d9=_0x3c218b[_0x3e42('0x1c')][_0x3e42('0x9')][_0x3e42('0x4c')];var _0x1befc2=_0x3c218b[_0x3e42('0x1c')][_0x3e42('0x9')][_0x3e42('0x4d')];var _0x50b70a=_0x3c218b['body']['where'][_0x3e42('0x4e')];return new Promise(function(_0x334550,_0x52e4d8){return db[_0x3e42('0x7')]['findAll']({'where':{'voiceQueueId':{'$in':_0x33b9d9},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x3e42('0x36')][_0x3e42('0x3d')](_0x3e42('0x4f')+_0x1befc2+_0x3e42('0x50')),'$gt':db[_0x3e42('0x36')][_0x3e42('0x3d')](_0x3e42('0x51'))}},'UserId':{'$in':_0x50b70a}},'include':[{'model':db['CmContact'],'as':_0x3e42('0x29')},{'model':db['User'],'as':'Agent','attributes':['id','name',_0x3e42('0x52')]},{'model':db['CmList'],'as':_0x3e42('0x53')}]})[_0x3e42('0x17')](function(_0x5432c){if(_0x5432c[_0x3e42('0x32')]>0x0){return db[_0x3e42('0x36')][_0x3e42('0x24')](function(_0x3e4400){return db[_0x3e42('0x7')][_0x3e42('0x1b')]({'recallmeNotifiedDate':db[_0x3e42('0x36')]['literal'](_0x3e42('0x51'))},{'where':{'id':{'$in':_[_0x3e42('0xd')](_0x5432c,'id')}},'transaction':_0x3e4400})[_0x3e42('0x17')](function(){_0x334550(_0x5432c);})[_0x3e42('0x11')](function(_0x154ec6){logger['error'](_0x3e42('0x4b'),_0x154ec6['message'],_0x3c218b);_0x52e4d8(_0x2ad9d3[_0x3e42('0x13')](0x1f4,_0x154ec6[_0x3e42('0x12')]));});})[_0x3e42('0x11')](function(_0x4b0fc8){logger[_0x3e42('0x13')]('CmHopperHandlePreviewRecallNotifications',_0x4b0fc8[_0x3e42('0x12')],_0x3c218b);_0x52e4d8(_0x2ad9d3['error'](0x1f4,_0x4b0fc8[_0x3e42('0x12')]));});}else{_0x334550(_0x5432c);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 0ee11fc..9f85fc2 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 _0x9960=['isAuthenticated','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','show','post','create','getPreview','/timezone','getTimezone','put','/:id','update','destroy','exports','express','Router','../../components/auth/service','get','index','/describe'];(function(_0x211418,_0x588fed){var _0x47ce50=function(_0x2fee07){while(--_0x2fee07){_0x211418['push'](_0x211418['shift']());}};_0x47ce50(++_0x588fed);}(_0x9960,0x84));var _0x0996=function(_0x704999,_0x201c30){_0x704999=_0x704999-0x0;var _0x106644=_0x9960[_0x704999];return _0x106644;};'use strict';var express=require(_0x0996('0x0'));var router=express[_0x0996('0x1')]();var auth=require(_0x0996('0x2'));var controller=require('./cmHopper.controller');router[_0x0996('0x3')]('/',auth['isAuthenticated'](),controller[_0x0996('0x4')]);router[_0x0996('0x3')](_0x0996('0x5'),auth[_0x0996('0x6')](),controller[_0x0996('0x7')]);router[_0x0996('0x3')](_0x0996('0x8'),auth[_0x0996('0x6')](),controller[_0x0996('0x9')]);router['get'](_0x0996('0xa'),auth['isAuthenticated'](),controller[_0x0996('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x0996('0xc')]);router[_0x0996('0x3')]('/:id/previewrecall',auth[_0x0996('0x6')](),controller['getPreviewRecall']);router[_0x0996('0xd')]('/',auth[_0x0996('0x6')](),controller[_0x0996('0xe')]);router[_0x0996('0xd')]('/preview',auth[_0x0996('0x6')](),controller[_0x0996('0xf')]);router['post'](_0x0996('0x10'),auth[_0x0996('0x6')](),controller[_0x0996('0x11')]);router[_0x0996('0x12')](_0x0996('0x13'),auth['isAuthenticated'](),controller[_0x0996('0x14')]);router['delete'](_0x0996('0x13'),auth[_0x0996('0x6')](),controller[_0x0996('0x15')]);module[_0x0996('0x16')]=router; \ No newline at end of file +var _0x8d77=['/opencontacts','isAuthenticated','getOpenContacts','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','/preview','getPreview','/timezone','getTimezone','put','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','index','/describe','describe'];(function(_0x239302,_0x35cd5d){var _0x2bf5f7=function(_0xbff060){while(--_0xbff060){_0x239302['push'](_0x239302['shift']());}};_0x2bf5f7(++_0x35cd5d);}(_0x8d77,0xc8));var _0x78d7=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x8d77[_0x220dbb];return _0x2b77de;};'use strict';var express=require(_0x78d7('0x0'));var router=express[_0x78d7('0x1')]();var auth=require(_0x78d7('0x2'));var controller=require(_0x78d7('0x3'));router[_0x78d7('0x4')]('/',auth['isAuthenticated'](),controller[_0x78d7('0x5')]);router[_0x78d7('0x4')](_0x78d7('0x6'),auth['isAuthenticated'](),controller[_0x78d7('0x7')]);router[_0x78d7('0x4')](_0x78d7('0x8'),auth[_0x78d7('0x9')](),controller[_0x78d7('0xa')]);router[_0x78d7('0x4')]('/timezones',auth[_0x78d7('0x9')](),controller[_0x78d7('0xb')]);router['get'](_0x78d7('0xc'),auth['isAuthenticated'](),controller[_0x78d7('0xd')]);router[_0x78d7('0x4')](_0x78d7('0xe'),auth[_0x78d7('0x9')](),controller[_0x78d7('0xf')]);router[_0x78d7('0x10')]('/',auth[_0x78d7('0x9')](),controller['create']);router[_0x78d7('0x10')](_0x78d7('0x11'),auth[_0x78d7('0x9')](),controller[_0x78d7('0x12')]);router[_0x78d7('0x10')](_0x78d7('0x13'),auth[_0x78d7('0x9')](),controller[_0x78d7('0x14')]);router[_0x78d7('0x15')](_0x78d7('0xc'),auth['isAuthenticated'](),controller[_0x78d7('0x16')]);router[_0x78d7('0x17')](_0x78d7('0xc'),auth[_0x78d7('0x9')](),controller[_0x78d7('0x18')]);module[_0x78d7('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 81dd46b..077973a 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 _0x8323=['YYYY-MM-DD\x20HH:mm:ss','moment','exports','INTEGER','STRING','DATE'];(function(_0x175e89,_0x20835f){var _0x2ed996=function(_0x56239f){while(--_0x56239f){_0x175e89['push'](_0x175e89['shift']());}};_0x2ed996(++_0x20835f);}(_0x8323,0xc7));var _0x3832=function(_0xb92ae,_0x116c99){_0xb92ae=_0xb92ae-0x0;var _0x22473e=_0x8323[_0xb92ae];return _0x22473e;};'use strict';var moment=require(_0x3832('0x0'));var Sequelize=require('sequelize');module[_0x3832('0x1')]={'CmHopperId':{'type':Sequelize[_0x3832('0x2')]},'phone':{'type':Sequelize[_0x3832('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x3832('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x3832('0x4')],'defaultValue':moment()['format'](_0x3832('0x5'))},'countbusyretry':{'type':Sequelize[_0x3832('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3832('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3832('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3832('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3832('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3832('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc549=['INTEGER','DATE','format','exports'];(function(_0x4d331c,_0x39ae7e){var _0x48f738=function(_0x5e1d90){while(--_0x5e1d90){_0x4d331c['push'](_0x4d331c['shift']());}};_0x48f738(++_0x39ae7e);}(_0xc549,0xd3));var _0x9c54=function(_0x473106,_0x4d1abe){_0x473106=_0x473106-0x0;var _0x1415bc=_0xc549[_0x473106];return _0x1415bc;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x9c54('0x0')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x9c54('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x9c54('0x2')],'defaultValue':moment()[_0x9c54('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x9c54('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9c54('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x9c54('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9c54('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9c54('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9c54('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index ce82935..3631ce6 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 _0x96ba=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','get','CmHopperAdditionalPhones','sendStatus','name','index','map','rawAttributes','fieldName','type','key','model','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','filter','options','includeAll','CmHopperAdditionalPhone','findAll','rows','catch','show','params','intersection','length','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','error'];(function(_0x493f57,_0x35f07b){var _0x14f705=function(_0x585c76){while(--_0x585c76){_0x493f57['push'](_0x493f57['shift']());}};_0x14f705(++_0x35f07b);}(_0x96ba,0xa1));var _0xa96b=function(_0x3b3466,_0x228276){_0x3b3466=_0x3b3466-0x0;var _0x16157f=_0x96ba[_0x3b3466];return _0x16157f;};'use strict';var emlformat=require(_0xa96b('0x0'));var rimraf=require(_0xa96b('0x1'));var zipdir=require(_0xa96b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa96b('0x3'));var BPromise=require(_0xa96b('0x4'));var Mustache=require('mustache');var util=require(_0xa96b('0x5'));var path=require(_0xa96b('0x6'));var sox=require(_0xa96b('0x7'));var csv=require('to-csv');var ejs=require(_0xa96b('0x8'));var fs=require('fs');var fs_extra=require(_0xa96b('0x9'));var _=require(_0xa96b('0xa'));var squel=require(_0xa96b('0xb'));var crypto=require(_0xa96b('0xc'));var jsforce=require(_0xa96b('0xd'));var deskjs=require(_0xa96b('0xe'));var toCsv=require(_0xa96b('0xf'));var querystring=require('querystring');var Papa=require(_0xa96b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa96b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa96b('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xa96b('0x13'));var licenseUtil=require(_0xa96b('0x14'));var db=require(_0xa96b('0x15'))['db'];function respondWithStatusCode(_0x5df14b,_0x235ea4){_0x235ea4=_0x235ea4||0xcc;return function(_0x3cf744){if(_0x3cf744){return _0x5df14b['sendStatus'](_0x235ea4);}return _0x5df14b['status'](_0x235ea4)[_0xa96b('0x16')]();};}function respondWithResult(_0x1edfdf,_0x8c4ccb){_0x8c4ccb=_0x8c4ccb||0xc8;return function(_0x1ffd61){if(_0x1ffd61){return _0x1edfdf[_0xa96b('0x17')](_0x8c4ccb)[_0xa96b('0x18')](_0x1ffd61);}};}function respondWithFilteredResult(_0x5cec37,_0x1b2fb2){return function(_0x7c7f62){if(_0x7c7f62){var _0x5098e4=typeof _0x1b2fb2[_0xa96b('0x19')]===_0xa96b('0x1a')&&typeof _0x1b2fb2[_0xa96b('0x1b')]===_0xa96b('0x1a');var _0xb59dd=_0x7c7f62[_0xa96b('0x1c')];var _0x105ecb=_0x5098e4?0x0:_0x1b2fb2[_0xa96b('0x19')];var _0x23db10=_0x5098e4?_0x7c7f62[_0xa96b('0x1c')]:_0x1b2fb2[_0xa96b('0x19')]+_0x1b2fb2[_0xa96b('0x1b')];var _0x19ce46;if(_0x23db10>=_0xb59dd){_0x23db10=_0xb59dd;_0x19ce46=0xc8;}else{_0x19ce46=0xce;}_0x5cec37[_0xa96b('0x17')](_0x19ce46);return _0x5cec37[_0xa96b('0x1d')]('Content-Range',_0x105ecb+'-'+_0x23db10+'/'+_0xb59dd)[_0xa96b('0x18')](_0x7c7f62);}return null;};}function patchUpdates(_0x22d8e5){return function(_0x53d722){try{jsonpatch[_0xa96b('0x1e')](_0x53d722,_0x22d8e5,!![]);}catch(_0x19dcb8){return BPromise[_0xa96b('0x1f')](_0x19dcb8);}return _0x53d722[_0xa96b('0x20')]();};}function saveUpdates(_0xbab017,_0x4770ab){return function(_0x203425){if(_0x203425){return _0x203425[_0xa96b('0x21')](_0xbab017)['then'](function(_0x372e29){return _0x372e29;});}return null;};}function removeEntity(_0x3dcf52,_0x41718e){return function(_0x2aae48){if(_0x2aae48){return _0x2aae48[_0xa96b('0x22')]()[_0xa96b('0x23')](function(){var _0x26062d=_0x2aae48[_0xa96b('0x24')]({'plain':!![]});var _0x4011b4=_0xa96b('0x25');return db['UserProfileResource'][_0xa96b('0x22')]({'where':{'type':_0x4011b4,'resourceId':_0x26062d['id']}})[_0xa96b('0x23')](function(){return _0x2aae48;});})[_0xa96b('0x23')](function(){_0x3dcf52['status'](0xcc)[_0xa96b('0x16')]();});}};}function handleEntityNotFound(_0x2cdce3,_0x50d72c){return function(_0x52ca1c){if(!_0x52ca1c){_0x2cdce3[_0xa96b('0x26')](0x194);}return _0x52ca1c;};}function handleError(_0x50d2f9,_0x8242b4){_0x8242b4=_0x8242b4||0x1f4;return function(_0x2e177a){logger['error'](_0x2e177a['stack']);if(_0x2e177a[_0xa96b('0x27')]){delete _0x2e177a[_0xa96b('0x27')];}_0x50d2f9[_0xa96b('0x17')](_0x8242b4)['send'](_0x2e177a);};}exports[_0xa96b('0x28')]=function(_0x2300df,_0xf7ff08){var _0x7cbd9f={},_0x2c1854={},_0x563286={'count':0x0,'rows':[]};var _0x3e8a7c=_[_0xa96b('0x29')](db['CmHopperAdditionalPhone'][_0xa96b('0x2a')],function(_0x2398d2){return{'name':_0x2398d2[_0xa96b('0x2b')],'type':_0x2398d2[_0xa96b('0x2c')][_0xa96b('0x2d')]};});_0x2c1854['model']=_[_0xa96b('0x29')](_0x3e8a7c,_0xa96b('0x27'));_0x2c1854['query']=_['keys'](_0x2300df['query']);_0x2c1854['filters']=_['intersection'](_0x2c1854[_0xa96b('0x2e')],_0x2c1854[_0xa96b('0x2f')]);_0x7cbd9f['attributes']=_['intersection'](_0x2c1854['model'],qs['fields'](_0x2300df[_0xa96b('0x2f')][_0xa96b('0x30')]));_0x7cbd9f[_0xa96b('0x31')]=_0x7cbd9f[_0xa96b('0x31')]['length']?_0x7cbd9f[_0xa96b('0x31')]:_0x2c1854['model'];if(!_0x2300df[_0xa96b('0x2f')][_0xa96b('0x32')](_0xa96b('0x33'))){_0x7cbd9f[_0xa96b('0x1b')]=qs[_0xa96b('0x1b')](_0x2300df['query'][_0xa96b('0x1b')]);_0x7cbd9f[_0xa96b('0x19')]=qs['offset'](_0x2300df[_0xa96b('0x2f')]['offset']);}_0x7cbd9f[_0xa96b('0x34')]=qs[_0xa96b('0x35')](_0x2300df[_0xa96b('0x2f')][_0xa96b('0x35')]);_0x7cbd9f[_0xa96b('0x36')]=qs['filters'](_[_0xa96b('0x37')](_0x2300df[_0xa96b('0x2f')],_0x2c1854[_0xa96b('0x38')]),_0x3e8a7c);if(_0x2300df['query']['filter']){_0x7cbd9f[_0xa96b('0x36')]=_[_0xa96b('0x39')](_0x7cbd9f[_0xa96b('0x36')],{'$or':_[_0xa96b('0x29')](_0x3e8a7c,function(_0x42158c){if(_0x42158c[_0xa96b('0x2c')]!=='VIRTUAL'){var _0x1990f7={};_0x1990f7[_0x42158c['name']]={'$like':'%'+_0x2300df['query'][_0xa96b('0x3a')]+'%'};return _0x1990f7;}})});}_0x7cbd9f=_[_0xa96b('0x39')]({},_0x7cbd9f,_0x2300df[_0xa96b('0x3b')]);var _0xb906b3={'where':_0x7cbd9f[_0xa96b('0x36')]};return db['CmHopperAdditionalPhone']['count'](_0xb906b3)[_0xa96b('0x23')](function(_0x2c47ef){_0x563286[_0xa96b('0x1c')]=_0x2c47ef;if(_0x2300df['query'][_0xa96b('0x3c')]){_0x7cbd9f['include']=[{'all':!![]}];}return db[_0xa96b('0x3d')][_0xa96b('0x3e')](_0x7cbd9f);})['then'](function(_0x3d0721){_0x563286[_0xa96b('0x3f')]=_0x3d0721;return _0x563286;})['then'](respondWithFilteredResult(_0xf7ff08,_0x7cbd9f))[_0xa96b('0x40')](handleError(_0xf7ff08,null));};exports[_0xa96b('0x41')]=function(_0x4edc6f,_0x2544c9){var _0x58bb21={'raw':!![],'where':{'id':_0x4edc6f[_0xa96b('0x42')]['id']}},_0x106cf6={};_0x106cf6[_0xa96b('0x2e')]=_['keys'](db['CmHopperAdditionalPhone'][_0xa96b('0x2a')]);_0x106cf6[_0xa96b('0x2f')]=_['keys'](_0x4edc6f['query']);_0x106cf6[_0xa96b('0x38')]=_[_0xa96b('0x43')](_0x106cf6[_0xa96b('0x2e')],_0x106cf6['query']);_0x58bb21['attributes']=_[_0xa96b('0x43')](_0x106cf6['model'],qs[_0xa96b('0x30')](_0x4edc6f['query'][_0xa96b('0x30')]));_0x58bb21['attributes']=_0x58bb21[_0xa96b('0x31')][_0xa96b('0x44')]?_0x58bb21[_0xa96b('0x31')]:_0x106cf6[_0xa96b('0x2e')];if(_0x4edc6f['query'][_0xa96b('0x3c')]){_0x58bb21[_0xa96b('0x45')]=[{'all':!![]}];}_0x58bb21=_[_0xa96b('0x39')]({},_0x58bb21,_0x4edc6f[_0xa96b('0x3b')]);return db[_0xa96b('0x3d')]['find'](_0x58bb21)[_0xa96b('0x23')](handleEntityNotFound(_0x2544c9,null))['then'](respondWithResult(_0x2544c9,null))[_0xa96b('0x40')](handleError(_0x2544c9,null));};exports[_0xa96b('0x46')]=function(_0x53bc65,_0x47acad){return db['CmHopperAdditionalPhone'][_0xa96b('0x46')](_0x53bc65[_0xa96b('0x47')],{})['then'](function(_0xf21f9d){var _0x1d2f56=_0x53bc65[_0xa96b('0x48')][_0xa96b('0x24')]({'plain':!![]});if(!_0x1d2f56)throw new Error(_0xa96b('0x49'));if(_0x1d2f56[_0xa96b('0x4a')]===_0xa96b('0x48')){var _0x4fea91=_0xf21f9d['get']({'plain':!![]});var _0x2de14d=_0xa96b('0x25');return db['UserProfileSection'][_0xa96b('0x4b')]({'where':{'name':_0x2de14d,'userProfileId':_0x1d2f56[_0xa96b('0x4c')]},'raw':!![]})[_0xa96b('0x23')](function(_0x1fe444){if(_0x1fe444&&_0x1fe444[_0xa96b('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x4fea91[_0xa96b('0x27')],'resourceId':_0x4fea91['id'],'type':_0x1fe444[_0xa96b('0x27')],'sectionId':_0x1fe444['id']},{})[_0xa96b('0x23')](function(){return _0xf21f9d;});}else{return _0xf21f9d;}})[_0xa96b('0x40')](function(_0x997239){logger[_0xa96b('0x4e')](_0xa96b('0x4f'),_0x997239);throw _0x997239;});}return _0xf21f9d;})[_0xa96b('0x23')](respondWithResult(_0x47acad,0xc9))[_0xa96b('0x40')](handleError(_0x47acad,null));};exports['update']=function(_0x28afcd,_0x5bf83e){if(_0x28afcd[_0xa96b('0x47')]['id']){delete _0x28afcd['body']['id'];}return db[_0xa96b('0x3d')]['find']({'where':{'id':_0x28afcd[_0xa96b('0x42')]['id']}})[_0xa96b('0x23')](handleEntityNotFound(_0x5bf83e,null))[_0xa96b('0x23')](saveUpdates(_0x28afcd[_0xa96b('0x47')],null))['then'](respondWithResult(_0x5bf83e,null))[_0xa96b('0x40')](handleError(_0x5bf83e,null));};exports[_0xa96b('0x22')]=function(_0x25871c,_0x372769){return db[_0xa96b('0x3d')][_0xa96b('0x4b')]({'where':{'id':_0x25871c['params']['id']}})[_0xa96b('0x23')](handleEntityNotFound(_0x372769,null))['then'](removeEntity(_0x372769,null))['catch'](handleError(_0x372769,null));}; \ No newline at end of file +var _0x2c9a=['bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','filter','VIRTUAL','merge','options','where','includeAll','findAll','rows','catch','show','params','find','create','body','user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x40067b,_0x5a4653){var _0x1d9959=function(_0x32080e){while(--_0x32080e){_0x40067b['push'](_0x40067b['shift']());}};_0x1d9959(++_0x5a4653);}(_0x2c9a,0xfd));var _0xa2c9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2c9a[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xa2c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa2c9('0x1'));var jsonpatch=require(_0xa2c9('0x2'));var rp=require(_0xa2c9('0x3'));var moment=require(_0xa2c9('0x4'));var BPromise=require(_0xa2c9('0x5'));var Mustache=require(_0xa2c9('0x6'));var util=require(_0xa2c9('0x7'));var path=require(_0xa2c9('0x8'));var sox=require(_0xa2c9('0x9'));var csv=require(_0xa2c9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa2c9('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa2c9('0xc'));var jsforce=require(_0xa2c9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa2c9('0xa'));var querystring=require(_0xa2c9('0xe'));var Papa=require(_0xa2c9('0xf'));var Redis=require(_0xa2c9('0x10'));var authService=require(_0xa2c9('0x11'));var qs=require(_0xa2c9('0x12'));var as=require(_0xa2c9('0x13'));var hardwareService=require(_0xa2c9('0x14'));var logger=require(_0xa2c9('0x15'))(_0xa2c9('0x16'));var utils=require(_0xa2c9('0x17'));var config=require(_0xa2c9('0x18'));var licenseUtil=require(_0xa2c9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ec448,_0xd76159){_0xd76159=_0xd76159||0xcc;return function(_0x134a63){if(_0x134a63){return _0x3ec448[_0xa2c9('0x1a')](_0xd76159);}return _0x3ec448['status'](_0xd76159)['end']();};}function respondWithResult(_0xaae578,_0x8f8e6f){_0x8f8e6f=_0x8f8e6f||0xc8;return function(_0x45dc2e){if(_0x45dc2e){return _0xaae578[_0xa2c9('0x1b')](_0x8f8e6f)[_0xa2c9('0x1c')](_0x45dc2e);}};}function respondWithFilteredResult(_0x52f1ac,_0xa8b397){return function(_0x408760){if(_0x408760){var _0x4aded0=typeof _0xa8b397[_0xa2c9('0x1d')]===_0xa2c9('0x1e')&&typeof _0xa8b397[_0xa2c9('0x1f')]===_0xa2c9('0x1e');var _0x3d8b5a=_0x408760[_0xa2c9('0x20')];var _0x555bbf=_0x4aded0?0x0:_0xa8b397[_0xa2c9('0x1d')];var _0x21869a=_0x4aded0?_0x408760[_0xa2c9('0x20')]:_0xa8b397['offset']+_0xa8b397[_0xa2c9('0x1f')];var _0x1010a1;if(_0x21869a>=_0x3d8b5a){_0x21869a=_0x3d8b5a;_0x1010a1=0xc8;}else{_0x1010a1=0xce;}_0x52f1ac[_0xa2c9('0x1b')](_0x1010a1);return _0x52f1ac[_0xa2c9('0x21')](_0xa2c9('0x22'),_0x555bbf+'-'+_0x21869a+'/'+_0x3d8b5a)['json'](_0x408760);}return null;};}function patchUpdates(_0x3e7d82){return function(_0x1f60a3){try{jsonpatch[_0xa2c9('0x23')](_0x1f60a3,_0x3e7d82,!![]);}catch(_0x313509){return BPromise[_0xa2c9('0x24')](_0x313509);}return _0x1f60a3[_0xa2c9('0x25')]();};}function saveUpdates(_0x17fce5,_0x550466){return function(_0x22fa2f){if(_0x22fa2f){return _0x22fa2f[_0xa2c9('0x26')](_0x17fce5)['then'](function(_0x32613f){return _0x32613f;});}return null;};}function removeEntity(_0x1f7fdc,_0x4e2243){return function(_0x3ddd9f){if(_0x3ddd9f){return _0x3ddd9f[_0xa2c9('0x27')]()[_0xa2c9('0x28')](function(){var _0x55c44f=_0x3ddd9f['get']({'plain':!![]});var _0x4dac76=_0xa2c9('0x29');return db[_0xa2c9('0x2a')][_0xa2c9('0x27')]({'where':{'type':_0x4dac76,'resourceId':_0x55c44f['id']}})[_0xa2c9('0x28')](function(){return _0x3ddd9f;});})[_0xa2c9('0x28')](function(){_0x1f7fdc[_0xa2c9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11e52f,_0xb1831f){return function(_0x2b6e0e){if(!_0x2b6e0e){_0x11e52f[_0xa2c9('0x1a')](0x194);}return _0x2b6e0e;};}function handleError(_0x4a842b,_0x198cda){_0x198cda=_0x198cda||0x1f4;return function(_0x293e56){logger[_0xa2c9('0x2b')](_0x293e56[_0xa2c9('0x2c')]);if(_0x293e56[_0xa2c9('0x2d')]){delete _0x293e56[_0xa2c9('0x2d')];}_0x4a842b[_0xa2c9('0x1b')](_0x198cda)[_0xa2c9('0x2e')](_0x293e56);};}exports[_0xa2c9('0x2f')]=function(_0x2934ee,_0x8d5e86){var _0x2776e5={},_0x4b6a00={},_0xe18ebb={'count':0x0,'rows':[]};var _0x17f2cb=_[_0xa2c9('0x30')](db[_0xa2c9('0x31')][_0xa2c9('0x32')],function(_0x59958a){return{'name':_0x59958a[_0xa2c9('0x33')],'type':_0x59958a[_0xa2c9('0x34')][_0xa2c9('0x35')]};});_0x4b6a00[_0xa2c9('0x36')]=_['map'](_0x17f2cb,_0xa2c9('0x2d'));_0x4b6a00['query']=_[_0xa2c9('0x37')](_0x2934ee['query']);_0x4b6a00[_0xa2c9('0x38')]=_[_0xa2c9('0x39')](_0x4b6a00[_0xa2c9('0x36')],_0x4b6a00[_0xa2c9('0x3a')]);_0x2776e5['attributes']=_[_0xa2c9('0x39')](_0x4b6a00[_0xa2c9('0x36')],qs[_0xa2c9('0x3b')](_0x2934ee[_0xa2c9('0x3a')][_0xa2c9('0x3b')]));_0x2776e5[_0xa2c9('0x3c')]=_0x2776e5[_0xa2c9('0x3c')][_0xa2c9('0x3d')]?_0x2776e5['attributes']:_0x4b6a00['model'];if(!_0x2934ee[_0xa2c9('0x3a')][_0xa2c9('0x3e')]('nolimit')){_0x2776e5[_0xa2c9('0x1f')]=qs['limit'](_0x2934ee['query'][_0xa2c9('0x1f')]);_0x2776e5[_0xa2c9('0x1d')]=qs[_0xa2c9('0x1d')](_0x2934ee[_0xa2c9('0x3a')][_0xa2c9('0x1d')]);}_0x2776e5[_0xa2c9('0x3f')]=qs[_0xa2c9('0x40')](_0x2934ee[_0xa2c9('0x3a')]['sort']);_0x2776e5['where']=qs[_0xa2c9('0x38')](_['pick'](_0x2934ee[_0xa2c9('0x3a')],_0x4b6a00[_0xa2c9('0x38')]),_0x17f2cb);if(_0x2934ee[_0xa2c9('0x3a')][_0xa2c9('0x41')]){_0x2776e5['where']=_['merge'](_0x2776e5['where'],{'$or':_['map'](_0x17f2cb,function(_0xcb5b01){if(_0xcb5b01[_0xa2c9('0x34')]!==_0xa2c9('0x42')){var _0x34527b={};_0x34527b[_0xcb5b01[_0xa2c9('0x2d')]]={'$like':'%'+_0x2934ee['query'][_0xa2c9('0x41')]+'%'};return _0x34527b;}})});}_0x2776e5=_[_0xa2c9('0x43')]({},_0x2776e5,_0x2934ee[_0xa2c9('0x44')]);var _0x3ed97a={'where':_0x2776e5[_0xa2c9('0x45')]};return db['CmHopperAdditionalPhone'][_0xa2c9('0x20')](_0x3ed97a)[_0xa2c9('0x28')](function(_0x17fe10){_0xe18ebb[_0xa2c9('0x20')]=_0x17fe10;if(_0x2934ee['query'][_0xa2c9('0x46')]){_0x2776e5['include']=[{'all':!![]}];}return db[_0xa2c9('0x31')][_0xa2c9('0x47')](_0x2776e5);})['then'](function(_0xb120b4){_0xe18ebb[_0xa2c9('0x48')]=_0xb120b4;return _0xe18ebb;})[_0xa2c9('0x28')](respondWithFilteredResult(_0x8d5e86,_0x2776e5))[_0xa2c9('0x49')](handleError(_0x8d5e86,null));};exports[_0xa2c9('0x4a')]=function(_0x438767,_0x199ae8){var _0x12c7fb={'raw':!![],'where':{'id':_0x438767[_0xa2c9('0x4b')]['id']}},_0x5a539e={};_0x5a539e[_0xa2c9('0x36')]=_['keys'](db[_0xa2c9('0x31')]['rawAttributes']);_0x5a539e['query']=_['keys'](_0x438767[_0xa2c9('0x3a')]);_0x5a539e[_0xa2c9('0x38')]=_[_0xa2c9('0x39')](_0x5a539e['model'],_0x5a539e[_0xa2c9('0x3a')]);_0x12c7fb[_0xa2c9('0x3c')]=_['intersection'](_0x5a539e[_0xa2c9('0x36')],qs[_0xa2c9('0x3b')](_0x438767[_0xa2c9('0x3a')][_0xa2c9('0x3b')]));_0x12c7fb[_0xa2c9('0x3c')]=_0x12c7fb['attributes'][_0xa2c9('0x3d')]?_0x12c7fb[_0xa2c9('0x3c')]:_0x5a539e[_0xa2c9('0x36')];if(_0x438767[_0xa2c9('0x3a')][_0xa2c9('0x46')]){_0x12c7fb['include']=[{'all':!![]}];}_0x12c7fb=_[_0xa2c9('0x43')]({},_0x12c7fb,_0x438767[_0xa2c9('0x44')]);return db[_0xa2c9('0x31')][_0xa2c9('0x4c')](_0x12c7fb)[_0xa2c9('0x28')](handleEntityNotFound(_0x199ae8,null))[_0xa2c9('0x28')](respondWithResult(_0x199ae8,null))['catch'](handleError(_0x199ae8,null));};exports[_0xa2c9('0x4d')]=function(_0x2d0cd3,_0x4bb05a){return db[_0xa2c9('0x31')][_0xa2c9('0x4d')](_0x2d0cd3[_0xa2c9('0x4e')],{})[_0xa2c9('0x28')](function(_0x40f9c6){var _0x1f5c22=_0x2d0cd3[_0xa2c9('0x4f')]['get']({'plain':!![]});if(!_0x1f5c22)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f5c22[_0xa2c9('0x50')]===_0xa2c9('0x4f')){var _0xb10c0c=_0x40f9c6[_0xa2c9('0x51')]({'plain':!![]});var _0x2443ce=_0xa2c9('0x29');return db[_0xa2c9('0x52')][_0xa2c9('0x4c')]({'where':{'name':_0x2443ce,'userProfileId':_0x1f5c22[_0xa2c9('0x53')]},'raw':!![]})[_0xa2c9('0x28')](function(_0x27f9a6){if(_0x27f9a6&&_0x27f9a6[_0xa2c9('0x54')]===0x0){return db[_0xa2c9('0x2a')]['create']({'name':_0xb10c0c[_0xa2c9('0x2d')],'resourceId':_0xb10c0c['id'],'type':_0x27f9a6[_0xa2c9('0x2d')],'sectionId':_0x27f9a6['id']},{})[_0xa2c9('0x28')](function(){return _0x40f9c6;});}else{return _0x40f9c6;}})['catch'](function(_0x2c929c){logger[_0xa2c9('0x2b')](_0xa2c9('0x55'),_0x2c929c);throw _0x2c929c;});}return _0x40f9c6;})[_0xa2c9('0x28')](respondWithResult(_0x4bb05a,0xc9))[_0xa2c9('0x49')](handleError(_0x4bb05a,null));};exports[_0xa2c9('0x26')]=function(_0x3e5d01,_0x36e2af){if(_0x3e5d01[_0xa2c9('0x4e')]['id']){delete _0x3e5d01['body']['id'];}return db[_0xa2c9('0x31')][_0xa2c9('0x4c')]({'where':{'id':_0x3e5d01[_0xa2c9('0x4b')]['id']}})[_0xa2c9('0x28')](handleEntityNotFound(_0x36e2af,null))[_0xa2c9('0x28')](saveUpdates(_0x3e5d01[_0xa2c9('0x4e')],null))['then'](respondWithResult(_0x36e2af,null))['catch'](handleError(_0x36e2af,null));};exports[_0xa2c9('0x27')]=function(_0x10442c,_0x4521b6){return db[_0xa2c9('0x31')][_0xa2c9('0x4c')]({'where':{'id':_0x10442c[_0xa2c9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4521b6,null))[_0xa2c9('0x28')](removeEntity(_0x4521b6,null))['catch'](handleError(_0x4521b6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 24cc148..721688a 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 _0xd913=['moment','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','cm_hopper_additional_phones','lodash','util','../../config/logger','api'];(function(_0x266235,_0x239c2a){var _0x413599=function(_0x2e63ec){while(--_0x2e63ec){_0x266235['push'](_0x266235['shift']());}};_0x413599(++_0x239c2a);}(_0xd913,0xee));var _0x3d91=function(_0x2de482,_0x54cc18){_0x2de482=_0x2de482-0x0;var _0xddcce6=_0xd913[_0x2de482];return _0xddcce6;};'use strict';var _=require(_0x3d91('0x0'));var util=require(_0x3d91('0x1'));var logger=require(_0x3d91('0x2'))(_0x3d91('0x3'));var moment=require(_0x3d91('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d91('0x5'));var rimraf=require(_0x3d91('0x6'));var config=require(_0x3d91('0x7'));var attributes=require(_0x3d91('0x8'));module[_0x3d91('0x9')]=function(_0xea7afa,_0xb41ac5){return _0xea7afa['define']('CmHopperAdditionalPhone',attributes,{'tableName':_0x3d91('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5251=['cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','CmHopperAdditionalPhone'];(function(_0x48bc0d,_0x30becd){var _0x35f641=function(_0x136926){while(--_0x136926){_0x48bc0d['push'](_0x48bc0d['shift']());}};_0x35f641(++_0x30becd);}(_0x5251,0x1c9));var _0x1525=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5251[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1525('0x0'));var util=require(_0x1525('0x1'));var logger=require(_0x1525('0x2'))(_0x1525('0x3'));var moment=require(_0x1525('0x4'));var BPromise=require(_0x1525('0x5'));var rp=require(_0x1525('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1525('0x7'));var config=require(_0x1525('0x8'));var attributes=require(_0x1525('0x9'));module['exports']=function(_0x354664,_0x386b9f){return _0x354664['define'](_0x1525('0xa'),attributes,{'tableName':_0x1525('0xb'),'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 fead989..9cd1413 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 _0x4b68=['ListId','body','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countbusyretry','countnosuchnumberretry','countabandonedretry','entity','dialGlobalMaxRetry','countcongestionretry','countdropretry','countmachineretry','countagentrejectretry','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','createdAt','updatedAt','countnoanswerretry','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','CmHopperAdditionalPhone,\x20%s,\x20%s','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','ContactId'];(function(_0x564668,_0x51da1b){var _0x50432c=function(_0x4438ff){while(--_0x4438ff){_0x564668['push'](_0x564668['shift']());}};_0x50432c(++_0x51da1b);}(_0x4b68,0x8c));var _0x84b6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4b68[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x84b6('0x0'));var moment=require('moment');var BPromise=require(_0x84b6('0x1'));var rs=require(_0x84b6('0x2'));var fs=require('fs');var Redis=require(_0x84b6('0x3'));var db=require(_0x84b6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x84b6('0x5'))(_0x84b6('0x6'));var config=require(_0x84b6('0x7'));var jayson=require(_0x84b6('0x8'));var client=jayson[_0x84b6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x149502,_0x3399a8,_0x1c8639){return new BPromise(function(_0x456dbe,_0x21d143){return client['request'](_0x149502,_0x1c8639)['then'](function(_0x814508){logger[_0x84b6('0xa')](_0x84b6('0xb'),_0x3399a8,'request\x20sent');logger['debug'](_0x84b6('0xc'),_0x3399a8,_0x84b6('0xd'),JSON['stringify'](_0x814508));if(_0x814508['error']){if(_0x814508[_0x84b6('0xe')][_0x84b6('0xf')]===0x1f4){logger[_0x84b6('0xe')](_0x84b6('0xb'),_0x3399a8,_0x814508['error'][_0x84b6('0x10')]);return _0x21d143(_0x814508['error'][_0x84b6('0x10')]);}logger[_0x84b6('0xe')](_0x84b6('0xb'),_0x3399a8,_0x814508[_0x84b6('0xe')]['message']);return _0x456dbe(_0x814508['error'][_0x84b6('0x10')]);}else{logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3399a8,_0x84b6('0xd'));_0x456dbe(_0x814508[_0x84b6('0x11')][_0x84b6('0x10')]);}})[_0x84b6('0x12')](function(_0x5ef759){logger['error'](_0x84b6('0xb'),_0x3399a8,_0x5ef759);_0x21d143(_0x5ef759);});});}exports[_0x84b6('0x13')]=function(_0x5a2064){var _0x412944=this;return new Promise(function(_0x6c3db3,_0x2d73f4){return db[_0x84b6('0x14')]['findOne']({'raw':!![],'where':{'ContactId':_0x5a2064['body'][_0x84b6('0x15')],'ListId':_0x5a2064['body'][_0x84b6('0x16')],'VoiceQueueId':_0x5a2064[_0x84b6('0x17')][_0x84b6('0x18')]===undefined?null:_0x5a2064[_0x84b6('0x17')][_0x84b6('0x18')],'CampaignId':_0x5a2064[_0x84b6('0x17')]['CampaignId']===undefined?null:_0x5a2064['body'][_0x84b6('0x19')]}})[_0x84b6('0x1a')](function(_0x4494b1){if(_0x4494b1!=null){return db[_0x84b6('0x1b')][_0x84b6('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x4494b1['id'],'OrderBy':{'$gt':_0x4494b1[_0x84b6('0x1d')]}},'order':[['OrderBy',_0x84b6('0x1e')]]})[_0x84b6('0x1a')](function(_0x3792cf){var _0x52593e=0x0;if(_0x3792cf){if(_0x3792cf[_0x84b6('0x1f')]+_0x3792cf['countcongestionretry']+_0x3792cf['countnoanswerretry']+_0x3792cf[_0x84b6('0x20')]+_0x3792cf['countdropretry']+_0x3792cf[_0x84b6('0x21')]+_0x3792cf['countmachineretry']+_0x3792cf['countagentrejectretry']<_0x5a2064[_0x84b6('0x22')][_0x84b6('0x23')])_0x52593e=0x1;_0x6c3db3({'additional':_0x52593e});}else{return db[_0x84b6('0x1b')][_0x84b6('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x4494b1['id']},'order':[[_0x84b6('0x1d'),_0x84b6('0x1e')]]})['then'](function(_0x2af4ee){var _0x16f2fb=0x0;if(_0x2af4ee){if(_0x2af4ee[_0x84b6('0x1f')]+_0x2af4ee[_0x84b6('0x24')]+_0x2af4ee['countnoanswerretry']+_0x2af4ee[_0x84b6('0x20')]+_0x2af4ee[_0x84b6('0x25')]+_0x2af4ee[_0x84b6('0x21')]+_0x2af4ee[_0x84b6('0x26')]+_0x2af4ee[_0x84b6('0x27')]<_0x5a2064[_0x84b6('0x22')][_0x84b6('0x23')])_0x16f2fb=0x1;_0x6c3db3({'additional':_0x16f2fb});}else{_0x6c3db3({'additional':0x0});}})[_0x84b6('0x12')](function(_0x5f12f6){logger['error'](_0x84b6('0x13'),_0x5f12f6[_0x84b6('0x10')]);_0x2d73f4(_0x412944[_0x84b6('0xe')](0x1f4,_0x5f12f6[_0x84b6('0x10')]));});}})[_0x84b6('0x12')](function(_0x1ce7a9){logger[_0x84b6('0xe')](_0x84b6('0x13'),_0x1ce7a9['message']);_0x2d73f4(_0x412944[_0x84b6('0xe')](0x1f4,_0x1ce7a9[_0x84b6('0x10')]));});}else _0x6c3db3({'additional':0x0});});});};exports[_0x84b6('0x28')]=function(_0x3a348d){var _0x38ec7d=this;return new Promise(function(_0x414f11,_0x219ac6){return db[_0x84b6('0x14')][_0x84b6('0x1c')]({'raw':!![],'where':{'ContactId':_0x3a348d[_0x84b6('0x17')][_0x84b6('0x15')],'ListId':_0x3a348d[_0x84b6('0x17')][_0x84b6('0x16')],'VoiceQueueId':_0x3a348d['body'][_0x84b6('0x18')]===undefined?null:_0x3a348d[_0x84b6('0x17')][_0x84b6('0x18')],'CampaignId':_0x3a348d[_0x84b6('0x17')][_0x84b6('0x19')]===undefined?null:_0x3a348d[_0x84b6('0x17')]['CampaignId']}})[_0x84b6('0x1a')](function(_0x1a772d){if(_0x1a772d!=null){return db[_0x84b6('0x1b')][_0x84b6('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x1a772d['id'],'OrderBy':{'$gte':_0x1a772d[_0x84b6('0x1d')]}},'order':[[_0x84b6('0x1d'),_0x84b6('0x1e')]]})[_0x84b6('0x1a')](function(_0x498383){if(_0x498383)return activateAdditionalPhone(_0x1a772d,_0x3a348d[_0x84b6('0x17')],_0x498383,_0x3a348d[_0x84b6('0x29')],_0x3a348d[_0x84b6('0x2a')])[_0x84b6('0x1a')](function(_0x213a91){_0x414f11(_0x213a91);});else{return db[_0x84b6('0x1b')][_0x84b6('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x1a772d['id']},'order':[['OrderBy',_0x84b6('0x1e')]]})[_0x84b6('0x1a')](function(_0x580ede){if(_0x580ede)return activateAdditionalPhone(_0x1a772d,_0x3a348d[_0x84b6('0x17')],_0x580ede,_0x3a348d[_0x84b6('0x29')],_0x3a348d[_0x84b6('0x2a')])[_0x84b6('0x1a')](function(_0x5d140d){_0x414f11(_0x5d140d);});else{_0x414f11({'id':_0x1a772d['id'],'phone':''});}})['catch'](function(_0x2e95ef){logger[_0x84b6('0xe')](_0x84b6('0x13'),_0x2e95ef['message']);_0x219ac6(_0x38ec7d[_0x84b6('0xe')](0x1f4,_0x2e95ef[_0x84b6('0x10')]));});}})[_0x84b6('0x12')](function(_0x413fe0){logger[_0x84b6('0xe')](_0x84b6('0x13'),_0x413fe0['message']);_0x219ac6(_0x38ec7d[_0x84b6('0xe')](0x1f4,_0x413fe0[_0x84b6('0x10')]));});}else _0x414f11(0x1);});});};function activateAdditionalPhone(_0x2c1a7d,_0x58d2ae,_0xe4ca13,_0x17bb1e,_0x4726e1){return new Promise(function(_0x3f9552,_0x64e034){var _0x5a1825;if(_[_0x84b6('0x2b')](_0xe4ca13[_0x84b6('0x2c')])){_0xe4ca13[_0x84b6('0x2c')]=moment();}if(moment()>moment(_0xe4ca13['scheduledat'])){_0x5a1825=moment()[_0x84b6('0x2d')](_0x4726e1||0x3,'minutes');}else{if(_0xe4ca13[_0x84b6('0x1d')]==0x0){_0x5a1825=moment(_0xe4ca13[_0x84b6('0x2c')]);}else{_0x5a1825=moment()[_0x84b6('0x2d')](_0x4726e1||0x3,'minutes');}}if(_['isNil'](_0x5a1825)){_0x5a1825=moment()['add'](_0x4726e1||0x3,_0x84b6('0x2e'));}var _0xbeb495={'phone':_0x2c1a7d['phone'],'active':0x0,'OrderBy':_[_0x84b6('0x2b')](_0x2c1a7d[_0x84b6('0x1d')])?0x0:_0x2c1a7d[_0x84b6('0x1d')],'scheduledat':moment()[_0x84b6('0x2d')](_0x17bb1e||0x1,_0x84b6('0x2e')),'countbusyretry':_0x58d2ae['countbusyretry'],'countcongestionretry':_0x58d2ae[_0x84b6('0x24')],'countnoanswerretry':_0x58d2ae['countnoanswerretry'],'countnosuchnumberretry':_0x58d2ae[_0x84b6('0x20')],'countdropretry':_0x58d2ae['countdropretry'],'countabandonedretry':_0x58d2ae[_0x84b6('0x21')],'countmachineretry':_0x58d2ae[_0x84b6('0x26')],'countagentrejectretry':_0x58d2ae[_0x84b6('0x27')],'createdAt':_0x58d2ae[_0x84b6('0x2f')],'updatedAt':_0x58d2ae[_0x84b6('0x30')]};var _0xb9b82={'CmHopperId':_0x2c1a7d['id'],'phone':_0xe4ca13['phone'],'active':0x0,'OrderBy':_['isNil'](_0xe4ca13[_0x84b6('0x1d')])?0x0:_0xe4ca13[_0x84b6('0x1d')],'scheduledat':_0x5a1825,'countbusyretry':_0xe4ca13[_0x84b6('0x1f')],'countcongestionretry':_0xe4ca13['countcongestionretry'],'countnoanswerretry':_0xe4ca13[_0x84b6('0x31')],'countnosuchnumberretry':_0xe4ca13[_0x84b6('0x20')],'countdropretry':_0xe4ca13['countdropretry'],'countabandonedretry':_0xe4ca13[_0x84b6('0x21')],'countmachineretry':_0xe4ca13[_0x84b6('0x26')],'countagentrejectretry':_0xe4ca13[_0x84b6('0x27')],'createdAt':_0xe4ca13[_0x84b6('0x2f')],'updatedAt':_0xe4ca13['updatedAt']};return db[_0x84b6('0x32')]['transaction'](function(_0xf90007){return db[_0x84b6('0x1b')][_0x84b6('0x33')](_0xbeb495,{'where':{'id':_0xe4ca13['id']}},{'transaction':_0xf90007})['then'](function(){return db['CmHopper'][_0x84b6('0x33')](_0xb9b82,{'where':{'id':_0x2c1a7d['id']}},{'transaction':_0xf90007});});})['then'](function(_0x4a1580){_0x3f9552({'id':_0x2c1a7d['id'],'phone':_0xe4ca13['phone']});})['catch'](function(_0x223166){logger[_0x84b6('0xe')](_0x84b6('0x34'),_0x223166[_0x84b6('0x10')]);_0x64e034({'error':_0x223166[_0x84b6('0x10')]});});});}exports[_0x84b6('0x35')]=function(_0x363ee6){var _0x4ec787=this;return new Promise(function(_0x332f4d,_0x479786){return db[_0x84b6('0x14')][_0x84b6('0x33')](_0x363ee6[_0x84b6('0x17')]['field'],{'where':{'id':_0x363ee6[_0x84b6('0x17')]['id']}})[_0x84b6('0x1a')](function(_0x6972aa){_0x332f4d(_0x6972aa);})[_0x84b6('0x12')](function(_0x5590e8){logger[_0x84b6('0xe')](_0x84b6('0x35'),_0x5590e8[_0x84b6('0x10')]);_0x479786(_0x4ec787[_0x84b6('0xe')](0x1f4,_0x5590e8[_0x84b6('0x10')]));});});}; \ No newline at end of file +var _0xa70e=['message','result','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','countbusyretry','countnosuchnumberretry','dialGlobalMaxRetry','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0xcfc44,_0x179bc1){var _0x307a25=function(_0x2b64de){while(--_0x2b64de){_0xcfc44['push'](_0xcfc44['shift']());}};_0x307a25(++_0x179bc1);}(_0xa70e,0x103));var _0xea70=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa70e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xea70('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea70('0x1'));var db=require(_0xea70('0x2'))['db'];var utils=require(_0xea70('0x3'));var logger=require(_0xea70('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xea70('0x5'));var client=jayson['client'][_0xea70('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x583cf9,_0x4b4826,_0x160d5b){return new BPromise(function(_0x2ab072,_0x140aa6){return client[_0xea70('0x7')](_0x583cf9,_0x160d5b)[_0xea70('0x8')](function(_0x4374ca){logger[_0xea70('0x9')](_0xea70('0xa'),_0x4b4826,'request\x20sent');logger[_0xea70('0xb')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x4b4826,_0xea70('0xc'),JSON[_0xea70('0xd')](_0x4374ca));if(_0x4374ca[_0xea70('0xe')]){if(_0x4374ca['error'][_0xea70('0xf')]===0x1f4){logger[_0xea70('0xe')](_0xea70('0xa'),_0x4b4826,_0x4374ca[_0xea70('0xe')][_0xea70('0x10')]);return _0x140aa6(_0x4374ca[_0xea70('0xe')]['message']);}logger[_0xea70('0xe')](_0xea70('0xa'),_0x4b4826,_0x4374ca[_0xea70('0xe')]['message']);return _0x2ab072(_0x4374ca[_0xea70('0xe')][_0xea70('0x10')]);}else{logger[_0xea70('0x9')](_0xea70('0xa'),_0x4b4826,_0xea70('0xc'));_0x2ab072(_0x4374ca[_0xea70('0x11')][_0xea70('0x10')]);}})[_0xea70('0x12')](function(_0x1aaa36){logger['error'](_0xea70('0xa'),_0x4b4826,_0x1aaa36);_0x140aa6(_0x1aaa36);});});}exports[_0xea70('0x13')]=function(_0x1d1f12){var _0x22ee08=this;return new Promise(function(_0x25739c,_0x59a5d6){return db[_0xea70('0x14')]['findOne']({'raw':!![],'where':{'ContactId':_0x1d1f12[_0xea70('0x15')][_0xea70('0x16')],'ListId':_0x1d1f12[_0xea70('0x15')][_0xea70('0x17')],'VoiceQueueId':_0x1d1f12[_0xea70('0x15')][_0xea70('0x18')]===undefined?null:_0x1d1f12[_0xea70('0x15')][_0xea70('0x18')],'CampaignId':_0x1d1f12[_0xea70('0x15')][_0xea70('0x19')]===undefined?null:_0x1d1f12[_0xea70('0x15')][_0xea70('0x19')]}})[_0xea70('0x8')](function(_0x5f0e0b){if(_0x5f0e0b!=null){return db[_0xea70('0x1a')][_0xea70('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x5f0e0b['id'],'OrderBy':{'$gt':_0x5f0e0b[_0xea70('0x1c')]}},'order':[[_0xea70('0x1c'),_0xea70('0x1d')]]})[_0xea70('0x8')](function(_0xc3e631){var _0x538763=0x0;if(_0xc3e631){if(_0xc3e631['countbusyretry']+_0xc3e631[_0xea70('0x1e')]+_0xc3e631[_0xea70('0x1f')]+_0xc3e631['countnosuchnumberretry']+_0xc3e631[_0xea70('0x20')]+_0xc3e631[_0xea70('0x21')]+_0xc3e631[_0xea70('0x22')]+_0xc3e631[_0xea70('0x23')]<_0x1d1f12[_0xea70('0x24')]['dialGlobalMaxRetry'])_0x538763=0x1;_0x25739c({'additional':_0x538763});}else{return db[_0xea70('0x1a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5f0e0b['id']},'order':[[_0xea70('0x1c'),_0xea70('0x1d')]]})[_0xea70('0x8')](function(_0x1be30c){var _0x24773a=0x0;if(_0x1be30c){if(_0x1be30c[_0xea70('0x25')]+_0x1be30c[_0xea70('0x1e')]+_0x1be30c[_0xea70('0x1f')]+_0x1be30c[_0xea70('0x26')]+_0x1be30c[_0xea70('0x20')]+_0x1be30c[_0xea70('0x21')]+_0x1be30c[_0xea70('0x22')]+_0x1be30c[_0xea70('0x23')]<_0x1d1f12[_0xea70('0x24')][_0xea70('0x27')])_0x24773a=0x1;_0x25739c({'additional':_0x24773a});}else{_0x25739c({'additional':0x0});}})[_0xea70('0x12')](function(_0x21ce11){logger['error'](_0xea70('0x13'),_0x21ce11[_0xea70('0x10')]);_0x59a5d6(_0x22ee08[_0xea70('0xe')](0x1f4,_0x21ce11[_0xea70('0x10')]));});}})[_0xea70('0x12')](function(_0x8881f){logger['error'](_0xea70('0x13'),_0x8881f[_0xea70('0x10')]);_0x59a5d6(_0x22ee08[_0xea70('0xe')](0x1f4,_0x8881f[_0xea70('0x10')]));});}else _0x25739c({'additional':0x0});});});};exports[_0xea70('0x28')]=function(_0x239b9c){var _0x638ea0=this;return new Promise(function(_0x3d673c,_0x7c89a7){return db[_0xea70('0x14')]['findOne']({'raw':!![],'where':{'ContactId':_0x239b9c[_0xea70('0x15')]['ContactId'],'ListId':_0x239b9c['body'][_0xea70('0x17')],'VoiceQueueId':_0x239b9c['body'][_0xea70('0x18')]===undefined?null:_0x239b9c[_0xea70('0x15')]['VoiceQueueId'],'CampaignId':_0x239b9c['body'][_0xea70('0x19')]===undefined?null:_0x239b9c[_0xea70('0x15')]['CampaignId']}})[_0xea70('0x8')](function(_0x3f81e0){if(_0x3f81e0!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x3f81e0['id'],'OrderBy':{'$gte':_0x3f81e0[_0xea70('0x1c')]}},'order':[[_0xea70('0x1c'),'ASC']]})[_0xea70('0x8')](function(_0x4c0e14){if(_0x4c0e14)return activateAdditionalPhone(_0x3f81e0,_0x239b9c[_0xea70('0x15')],_0x4c0e14,_0x239b9c[_0xea70('0x29')],_0x239b9c[_0xea70('0x2a')])[_0xea70('0x8')](function(_0x1fd4a7){_0x3d673c(_0x1fd4a7);});else{return db['CmHopperAdditionalPhone'][_0xea70('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x3f81e0['id']},'order':[[_0xea70('0x1c'),_0xea70('0x1d')]]})[_0xea70('0x8')](function(_0x895072){if(_0x895072)return activateAdditionalPhone(_0x3f81e0,_0x239b9c[_0xea70('0x15')],_0x895072,_0x239b9c['duration'],_0x239b9c[_0xea70('0x2a')])[_0xea70('0x8')](function(_0x30bf62){_0x3d673c(_0x30bf62);});else{_0x3d673c({'id':_0x3f81e0['id'],'phone':''});}})[_0xea70('0x12')](function(_0x422f46){logger[_0xea70('0xe')](_0xea70('0x13'),_0x422f46[_0xea70('0x10')]);_0x7c89a7(_0x638ea0['error'](0x1f4,_0x422f46[_0xea70('0x10')]));});}})[_0xea70('0x12')](function(_0x4461e2){logger[_0xea70('0xe')]('VerifyAdditionalPhones',_0x4461e2[_0xea70('0x10')]);_0x7c89a7(_0x638ea0[_0xea70('0xe')](0x1f4,_0x4461e2[_0xea70('0x10')]));});}else _0x3d673c(0x1);});});};function activateAdditionalPhone(_0x490cf2,_0x55f2bb,_0x19a196,_0x4f2159,_0x481197){return new Promise(function(_0x4b034a,_0x57564d){var _0x560a89;if(_[_0xea70('0x2b')](_0x19a196[_0xea70('0x2c')])){_0x19a196[_0xea70('0x2c')]=moment();}if(moment()>moment(_0x19a196['scheduledat'])){_0x560a89=moment()[_0xea70('0x2d')](_0x481197||0x3,_0xea70('0x2e'));}else{if(_0x19a196['OrderBy']==0x0){_0x560a89=moment(_0x19a196[_0xea70('0x2c')]);}else{_0x560a89=moment()['add'](_0x481197||0x3,_0xea70('0x2e'));}}if(_[_0xea70('0x2b')](_0x560a89)){_0x560a89=moment()[_0xea70('0x2d')](_0x481197||0x3,_0xea70('0x2e'));}var _0x2cb2db={'phone':_0x490cf2[_0xea70('0x2f')],'active':0x0,'OrderBy':_[_0xea70('0x2b')](_0x490cf2[_0xea70('0x1c')])?0x0:_0x490cf2[_0xea70('0x1c')],'scheduledat':moment()[_0xea70('0x2d')](_0x4f2159||0x1,_0xea70('0x2e')),'countbusyretry':_0x55f2bb['countbusyretry'],'countcongestionretry':_0x55f2bb[_0xea70('0x1e')],'countnoanswerretry':_0x55f2bb[_0xea70('0x1f')],'countnosuchnumberretry':_0x55f2bb[_0xea70('0x26')],'countdropretry':_0x55f2bb[_0xea70('0x20')],'countabandonedretry':_0x55f2bb[_0xea70('0x21')],'countmachineretry':_0x55f2bb[_0xea70('0x22')],'countagentrejectretry':_0x55f2bb[_0xea70('0x23')],'createdAt':_0x55f2bb[_0xea70('0x30')],'updatedAt':_0x55f2bb['updatedAt']};var _0x94e9ba={'CmHopperId':_0x490cf2['id'],'phone':_0x19a196['phone'],'active':0x0,'OrderBy':_[_0xea70('0x2b')](_0x19a196[_0xea70('0x1c')])?0x0:_0x19a196[_0xea70('0x1c')],'scheduledat':_0x560a89,'countbusyretry':_0x19a196[_0xea70('0x25')],'countcongestionretry':_0x19a196['countcongestionretry'],'countnoanswerretry':_0x19a196[_0xea70('0x1f')],'countnosuchnumberretry':_0x19a196[_0xea70('0x26')],'countdropretry':_0x19a196[_0xea70('0x20')],'countabandonedretry':_0x19a196['countabandonedretry'],'countmachineretry':_0x19a196[_0xea70('0x22')],'countagentrejectretry':_0x19a196[_0xea70('0x23')],'createdAt':_0x19a196[_0xea70('0x30')],'updatedAt':_0x19a196[_0xea70('0x31')]};return db[_0xea70('0x32')]['transaction'](function(_0x6a43d0){return db[_0xea70('0x1a')][_0xea70('0x33')](_0x2cb2db,{'where':{'id':_0x19a196['id']}},{'transaction':_0x6a43d0})[_0xea70('0x8')](function(){return db[_0xea70('0x14')][_0xea70('0x33')](_0x94e9ba,{'where':{'id':_0x490cf2['id']}},{'transaction':_0x6a43d0});});})['then'](function(_0x281f33){_0x4b034a({'id':_0x490cf2['id'],'phone':_0x19a196[_0xea70('0x2f')]});})[_0xea70('0x12')](function(_0x10cf4e){logger[_0xea70('0xe')](_0xea70('0x34'),_0x10cf4e[_0xea70('0x10')]);_0x57564d({'error':_0x10cf4e[_0xea70('0x10')]});});});}exports['IncrementPreviewCounters']=function(_0x4bfc1e){var _0x2932e7=this;return new Promise(function(_0x424ced,_0x4b49c7){return db[_0xea70('0x14')][_0xea70('0x33')](_0x4bfc1e[_0xea70('0x15')][_0xea70('0x35')],{'where':{'id':_0x4bfc1e[_0xea70('0x15')]['id']}})[_0xea70('0x8')](function(_0x5a4a6b){_0x424ced(_0x5a4a6b);})[_0xea70('0x12')](function(_0x1808c4){logger['error'](_0xea70('0x36'),_0x1808c4[_0xea70('0x10')]);_0x4b49c7(_0x2932e7[_0xea70('0xe')](0x1f4,_0x1808c4[_0xea70('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 984e4ba..1d39fc9 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 _0x662d=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','create','put','exports','multer'];(function(_0x7664f2,_0x4a256f){var _0x20a91f=function(_0x414445){while(--_0x414445){_0x7664f2['push'](_0x7664f2['shift']());}};_0x20a91f(++_0x4a256f);}(_0x662d,0x1af));var _0xd662=function(_0x242961,_0x4668fe){_0x242961=_0x242961-0x0;var _0x45977e=_0x662d[_0x242961];return _0x45977e;};'use strict';var multer=require(_0xd662('0x0'));var util=require(_0xd662('0x1'));var path=require('path');var timeout=require(_0xd662('0x2'));var express=require(_0xd662('0x3'));var router=express['Router']();var fs_extra=require(_0xd662('0x4'));var auth=require(_0xd662('0x5'));var interaction=require(_0xd662('0x6'));var config=require(_0xd662('0x7'));var controller=require(_0xd662('0x8'));router[_0xd662('0x9')]('/',auth[_0xd662('0xa')](),controller[_0xd662('0xb')]);router[_0xd662('0x9')](_0xd662('0xc'),auth[_0xd662('0xa')](),controller['show']);router['post']('/',auth[_0xd662('0xa')](),controller[_0xd662('0xd')]);router[_0xd662('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xd662('0xc'),auth[_0xd662('0xa')](),controller['destroy']);module[_0xd662('0xf')]=router; \ No newline at end of file +var _0x8b13=['path','express','Router','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','util'];(function(_0x25e1b6,_0x52ddaa){var _0x4d2915=function(_0x39b5a8){while(--_0x39b5a8){_0x25e1b6['push'](_0x25e1b6['shift']());}};_0x4d2915(++_0x52ddaa);}(_0x8b13,0x1ef));var _0x38b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b13[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x38b1('0x0'));var path=require(_0x38b1('0x1'));var timeout=require('connect-timeout');var express=require(_0x38b1('0x2'));var router=express[_0x38b1('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x38b1('0x4'));var config=require('../../config/environment');var controller=require(_0x38b1('0x5'));router[_0x38b1('0x6')]('/',auth[_0x38b1('0x7')](),controller['index']);router[_0x38b1('0x6')](_0x38b1('0x8'),auth[_0x38b1('0x7')](),controller[_0x38b1('0x9')]);router[_0x38b1('0xa')]('/',auth[_0x38b1('0x7')](),controller[_0x38b1('0xb')]);router[_0x38b1('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x38b1('0xd')]);router['delete'](_0x38b1('0x8'),auth[_0x38b1('0x7')](),controller[_0x38b1('0xe')]);module[_0x38b1('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index a27afd8..3b0deb4 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 _0xa897=['moment','exports','STRING','INTEGER'];(function(_0x3f94c0,_0x21c689){var _0x9e5521=function(_0x5bc221){while(--_0x5bc221){_0x3f94c0['push'](_0x3f94c0['shift']());}};_0x9e5521(++_0x21c689);}(_0xa897,0x17c));var _0x7a89=function(_0x3c2994,_0x16b730){_0x3c2994=_0x3c2994-0x0;var _0x4daf1a=_0xa897[_0x3c2994];return _0x4daf1a;};'use strict';var moment=require(_0x7a89('0x0'));var Sequelize=require('sequelize');module[_0x7a89('0x1')]={'phone':{'type':Sequelize[_0x7a89('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x7a89('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x7a89('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x7a89('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x8173=['moment','sequelize','STRING','INTEGER','contactListQueue'];(function(_0x48aabf,_0x4fe205){var _0x1969e7=function(_0x5eae32){while(--_0x5eae32){_0x48aabf['push'](_0x48aabf['shift']());}};_0x1969e7(++_0x4fe205);}(_0x8173,0x1db));var _0x3817=function(_0x492fd8,_0x46d682){_0x492fd8=_0x492fd8-0x0;var _0x3b9b51=_0x8173[_0x492fd8];return _0x3b9b51;};'use strict';var moment=require(_0x3817('0x0'));var Sequelize=require(_0x3817('0x1'));module['exports']={'phone':{'type':Sequelize[_0x3817('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3817('0x3')],'unique':_0x3817('0x4')},'ListId':{'type':Sequelize[_0x3817('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x3817('0x3')],'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 0a8302c..8b92957 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 _0xd2f3=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','options','findAll','catch','params','includeAll','include','body','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','type','key','model'];(function(_0x5b34d6,_0x138df5){var _0x5c1c77=function(_0xc8d7f9){while(--_0xc8d7f9){_0x5b34d6['push'](_0x5b34d6['shift']());}};_0x5c1c77(++_0x138df5);}(_0xd2f3,0x169));var _0x3d2f=function(_0x4d60a7,_0x256b51){_0x4d60a7=_0x4d60a7-0x0;var _0x33f147=_0xd2f3[_0x4d60a7];return _0x33f147;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3d2f('0x0'));var zipdir=require(_0x3d2f('0x1'));var jsonpatch=require(_0x3d2f('0x2'));var rp=require('request-promise');var moment=require(_0x3d2f('0x3'));var BPromise=require(_0x3d2f('0x4'));var Mustache=require(_0x3d2f('0x5'));var util=require(_0x3d2f('0x6'));var path=require('path');var sox=require(_0x3d2f('0x7'));var csv=require(_0x3d2f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3d2f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3d2f('0x8'));var querystring=require(_0x3d2f('0xa'));var Papa=require('papaparse');var Redis=require(_0x3d2f('0xb'));var authService=require(_0x3d2f('0xc'));var qs=require(_0x3d2f('0xd'));var as=require(_0x3d2f('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d2f('0xf'))(_0x3d2f('0x10'));var utils=require(_0x3d2f('0x11'));var config=require(_0x3d2f('0x12'));var licenseUtil=require(_0x3d2f('0x13'));var db=require(_0x3d2f('0x14'))['db'];function respondWithStatusCode(_0x4c284d,_0x220f37){_0x220f37=_0x220f37||0xcc;return function(_0x1ae241){if(_0x1ae241){return _0x4c284d['sendStatus'](_0x220f37);}return _0x4c284d[_0x3d2f('0x15')](_0x220f37)[_0x3d2f('0x16')]();};}function respondWithResult(_0x3372ba,_0x334dee){_0x334dee=_0x334dee||0xc8;return function(_0x35ac64){if(_0x35ac64){return _0x3372ba[_0x3d2f('0x15')](_0x334dee)[_0x3d2f('0x17')](_0x35ac64);}};}function respondWithFilteredResult(_0x4fb426,_0x541dfb){return function(_0x3cce6f){if(_0x3cce6f){var _0x3df64e=typeof _0x541dfb[_0x3d2f('0x18')]===_0x3d2f('0x19')&&typeof _0x541dfb[_0x3d2f('0x1a')]===_0x3d2f('0x19');var _0x62f63e=_0x3cce6f[_0x3d2f('0x1b')];var _0x3e8193=_0x3df64e?0x0:_0x541dfb['offset'];var _0x1feee9=_0x3df64e?_0x3cce6f['count']:_0x541dfb[_0x3d2f('0x18')]+_0x541dfb['limit'];var _0x30185c;if(_0x1feee9>=_0x62f63e){_0x1feee9=_0x62f63e;_0x30185c=0xc8;}else{_0x30185c=0xce;}_0x4fb426['status'](_0x30185c);return _0x4fb426[_0x3d2f('0x1c')](_0x3d2f('0x1d'),_0x3e8193+'-'+_0x1feee9+'/'+_0x62f63e)[_0x3d2f('0x17')](_0x3cce6f);}return null;};}function patchUpdates(_0x434cf2){return function(_0x2bf633){try{jsonpatch[_0x3d2f('0x1e')](_0x2bf633,_0x434cf2,!![]);}catch(_0x2fb332){return BPromise['reject'](_0x2fb332);}return _0x2bf633[_0x3d2f('0x1f')]();};}function saveUpdates(_0x5abf9c,_0x4a3f78){return function(_0x5d8282){if(_0x5d8282){return _0x5d8282[_0x3d2f('0x20')](_0x5abf9c)[_0x3d2f('0x21')](function(_0x54fefb){return _0x54fefb;});}return null;};}function removeEntity(_0x36c4af,_0x30214f){return function(_0x3c79e4){if(_0x3c79e4){return _0x3c79e4[_0x3d2f('0x22')]()[_0x3d2f('0x21')](function(){_0x36c4af[_0x3d2f('0x15')](0xcc)[_0x3d2f('0x16')]();});}};}function handleEntityNotFound(_0x480e72,_0x36b5d5){return function(_0x29de79){if(!_0x29de79){_0x480e72[_0x3d2f('0x23')](0x194);}return _0x29de79;};}function handleError(_0x95bc7a,_0x3bd1e2){_0x3bd1e2=_0x3bd1e2||0x1f4;return function(_0x31ba50){logger[_0x3d2f('0x24')](_0x31ba50[_0x3d2f('0x25')]);if(_0x31ba50[_0x3d2f('0x26')]){delete _0x31ba50['name'];}_0x95bc7a['status'](_0x3bd1e2)[_0x3d2f('0x27')](_0x31ba50);};}exports[_0x3d2f('0x28')]=function(_0x32379d,_0x33d170){var _0x5784a4={},_0x494e3a={},_0x5e8c0f={'count':0x0,'rows':[]};var _0x500689=_[_0x3d2f('0x29')](db[_0x3d2f('0x2a')][_0x3d2f('0x2b')],function(_0x4ad34f){return{'name':_0x4ad34f['fieldName'],'type':_0x4ad34f[_0x3d2f('0x2c')][_0x3d2f('0x2d')]};});_0x494e3a[_0x3d2f('0x2e')]=_[_0x3d2f('0x29')](_0x500689,'name');_0x494e3a[_0x3d2f('0x2f')]=_[_0x3d2f('0x30')](_0x32379d[_0x3d2f('0x2f')]);_0x494e3a[_0x3d2f('0x31')]=_[_0x3d2f('0x32')](_0x494e3a[_0x3d2f('0x2e')],_0x494e3a[_0x3d2f('0x2f')]);_0x5784a4[_0x3d2f('0x33')]=_[_0x3d2f('0x32')](_0x494e3a[_0x3d2f('0x2e')],qs[_0x3d2f('0x34')](_0x32379d[_0x3d2f('0x2f')][_0x3d2f('0x34')]));_0x5784a4['attributes']=_0x5784a4[_0x3d2f('0x33')][_0x3d2f('0x35')]?_0x5784a4[_0x3d2f('0x33')]:_0x494e3a[_0x3d2f('0x2e')];if(!_0x32379d[_0x3d2f('0x2f')][_0x3d2f('0x36')]('nolimit')){_0x5784a4[_0x3d2f('0x1a')]=qs['limit'](_0x32379d[_0x3d2f('0x2f')]['limit']);_0x5784a4[_0x3d2f('0x18')]=qs[_0x3d2f('0x18')](_0x32379d[_0x3d2f('0x2f')][_0x3d2f('0x18')]);}_0x5784a4[_0x3d2f('0x37')]=qs[_0x3d2f('0x38')](_0x32379d['query'][_0x3d2f('0x38')]);_0x5784a4[_0x3d2f('0x39')]=qs['filters'](_['pick'](_0x32379d['query'],_0x494e3a[_0x3d2f('0x31')]),_0x500689);if(_0x32379d[_0x3d2f('0x2f')]['filter']){_0x5784a4[_0x3d2f('0x39')]=_['merge'](_0x5784a4[_0x3d2f('0x39')],{'$or':_[_0x3d2f('0x29')](_0x500689,function(_0x11965a){if(_0x11965a[_0x3d2f('0x2c')]!=='VIRTUAL'){var _0x3d4c69={};_0x3d4c69[_0x11965a[_0x3d2f('0x26')]]={'$like':'%'+_0x32379d[_0x3d2f('0x2f')]['filter']+'%'};return _0x3d4c69;}})});}_0x5784a4=_[_0x3d2f('0x3a')]({},_0x5784a4,_0x32379d[_0x3d2f('0x3b')]);var _0x5e2aa0={'where':_0x5784a4[_0x3d2f('0x39')]};return db[_0x3d2f('0x2a')][_0x3d2f('0x1b')](_0x5e2aa0)[_0x3d2f('0x21')](function(_0x161f16){_0x5e8c0f[_0x3d2f('0x1b')]=_0x161f16;if(_0x32379d[_0x3d2f('0x2f')]['includeAll']){_0x5784a4['include']=[{'all':!![]}];}return db[_0x3d2f('0x2a')][_0x3d2f('0x3c')](_0x5784a4);})[_0x3d2f('0x21')](function(_0x31d921){_0x5e8c0f['rows']=_0x31d921;return _0x5e8c0f;})[_0x3d2f('0x21')](respondWithFilteredResult(_0x33d170,_0x5784a4))[_0x3d2f('0x3d')](handleError(_0x33d170,null));};exports['show']=function(_0x435a64,_0x47e1d9){var _0x2eb3b3={'raw':!![],'where':{'id':_0x435a64[_0x3d2f('0x3e')]['id']}},_0x62987b={};_0x62987b[_0x3d2f('0x2e')]=_[_0x3d2f('0x30')](db[_0x3d2f('0x2a')]['rawAttributes']);_0x62987b[_0x3d2f('0x2f')]=_[_0x3d2f('0x30')](_0x435a64[_0x3d2f('0x2f')]);_0x62987b['filters']=_[_0x3d2f('0x32')](_0x62987b[_0x3d2f('0x2e')],_0x62987b['query']);_0x2eb3b3['attributes']=_['intersection'](_0x62987b['model'],qs[_0x3d2f('0x34')](_0x435a64['query']['fields']));_0x2eb3b3['attributes']=_0x2eb3b3[_0x3d2f('0x33')][_0x3d2f('0x35')]?_0x2eb3b3['attributes']:_0x62987b['model'];if(_0x435a64['query'][_0x3d2f('0x3f')]){_0x2eb3b3[_0x3d2f('0x40')]=[{'all':!![]}];}_0x2eb3b3=_[_0x3d2f('0x3a')]({},_0x2eb3b3,_0x435a64[_0x3d2f('0x3b')]);return db[_0x3d2f('0x2a')]['find'](_0x2eb3b3)[_0x3d2f('0x21')](handleEntityNotFound(_0x47e1d9,null))['then'](respondWithResult(_0x47e1d9,null))['catch'](handleError(_0x47e1d9,null));};exports[_0x3d2f('0x20')]=function(_0x56e33f,_0x241fbe){if(_0x56e33f['body']['id']){delete _0x56e33f[_0x3d2f('0x41')]['id'];}return db[_0x3d2f('0x2a')][_0x3d2f('0x42')]({'where':{'id':_0x56e33f[_0x3d2f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x241fbe,null))[_0x3d2f('0x21')](saveUpdates(_0x56e33f[_0x3d2f('0x41')],null))[_0x3d2f('0x21')](respondWithResult(_0x241fbe,null))[_0x3d2f('0x3d')](handleError(_0x241fbe,null));};exports[_0x3d2f('0x22')]=function(_0x517202,_0x185331){return db[_0x3d2f('0x2a')][_0x3d2f('0x42')]({'where':{'id':_0x517202[_0x3d2f('0x3e')]['id']}})[_0x3d2f('0x21')](handleEntityNotFound(_0x185331,null))[_0x3d2f('0x21')](removeEntity(_0x185331,null))[_0x3d2f('0x3d')](handleError(_0x185331,null));};exports['describe']=function(_0x3520e1,_0x676455){return db['CmHopperBlack'][_0x3d2f('0x43')]()['then'](respondWithResult(_0x676455,null))[_0x3d2f('0x3d')](handleError(_0x676455,null));}; \ No newline at end of file +var _0xf751=['include','rows','catch','show','params','keys','options','find','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','stack','name','send','map','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','CmHopperBlack','includeAll'];(function(_0x42c579,_0x588c59){var _0x100d74=function(_0x31e272){while(--_0x31e272){_0x42c579['push'](_0x42c579['shift']());}};_0x100d74(++_0x588c59);}(_0xf751,0x132));var _0x1f75=function(_0x42936d,_0x37c54d){_0x42936d=_0x42936d-0x0;var _0x5f3d5e=_0xf751[_0x42936d];return _0x5f3d5e;};'use strict';var emlformat=require(_0x1f75('0x0'));var rimraf=require(_0x1f75('0x1'));var zipdir=require(_0x1f75('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f75('0x3'));var moment=require(_0x1f75('0x4'));var BPromise=require(_0x1f75('0x5'));var Mustache=require(_0x1f75('0x6'));var util=require('util');var path=require(_0x1f75('0x7'));var sox=require(_0x1f75('0x8'));var csv=require('to-csv');var ejs=require(_0x1f75('0x9'));var fs=require('fs');var fs_extra=require(_0x1f75('0xa'));var _=require(_0x1f75('0xb'));var squel=require(_0x1f75('0xc'));var crypto=require(_0x1f75('0xd'));var jsforce=require(_0x1f75('0xe'));var deskjs=require(_0x1f75('0xf'));var toCsv=require(_0x1f75('0x10'));var querystring=require(_0x1f75('0x11'));var Papa=require('papaparse');var Redis=require(_0x1f75('0x12'));var authService=require(_0x1f75('0x13'));var qs=require(_0x1f75('0x14'));var as=require(_0x1f75('0x15'));var hardwareService=require(_0x1f75('0x16'));var logger=require(_0x1f75('0x17'))(_0x1f75('0x18'));var utils=require(_0x1f75('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1f75('0x1a'));var db=require(_0x1f75('0x1b'))['db'];function respondWithStatusCode(_0xfc0ea9,_0x5582da){_0x5582da=_0x5582da||0xcc;return function(_0x325c19){if(_0x325c19){return _0xfc0ea9[_0x1f75('0x1c')](_0x5582da);}return _0xfc0ea9[_0x1f75('0x1d')](_0x5582da)['end']();};}function respondWithResult(_0x3b75b9,_0x586842){_0x586842=_0x586842||0xc8;return function(_0x46e8af){if(_0x46e8af){return _0x3b75b9[_0x1f75('0x1d')](_0x586842)[_0x1f75('0x1e')](_0x46e8af);}};}function respondWithFilteredResult(_0x4286f1,_0x52886f){return function(_0x4c8a20){if(_0x4c8a20){var _0x2db0d9=typeof _0x52886f[_0x1f75('0x1f')]===_0x1f75('0x20')&&typeof _0x52886f['limit']===_0x1f75('0x20');var _0x494522=_0x4c8a20[_0x1f75('0x21')];var _0x3b3c03=_0x2db0d9?0x0:_0x52886f['offset'];var _0x25f3a9=_0x2db0d9?_0x4c8a20['count']:_0x52886f[_0x1f75('0x1f')]+_0x52886f[_0x1f75('0x22')];var _0x4fc6dd;if(_0x25f3a9>=_0x494522){_0x25f3a9=_0x494522;_0x4fc6dd=0xc8;}else{_0x4fc6dd=0xce;}_0x4286f1[_0x1f75('0x1d')](_0x4fc6dd);return _0x4286f1[_0x1f75('0x23')]('Content-Range',_0x3b3c03+'-'+_0x25f3a9+'/'+_0x494522)[_0x1f75('0x1e')](_0x4c8a20);}return null;};}function patchUpdates(_0x5119ba){return function(_0x5d871d){try{jsonpatch[_0x1f75('0x24')](_0x5d871d,_0x5119ba,!![]);}catch(_0x2ccdf0){return BPromise['reject'](_0x2ccdf0);}return _0x5d871d[_0x1f75('0x25')]();};}function saveUpdates(_0x512645,_0x4e3892){return function(_0xa57176){if(_0xa57176){return _0xa57176[_0x1f75('0x26')](_0x512645)[_0x1f75('0x27')](function(_0x4bb299){return _0x4bb299;});}return null;};}function removeEntity(_0x355f1a,_0x46b746){return function(_0x55db55){if(_0x55db55){return _0x55db55[_0x1f75('0x28')]()[_0x1f75('0x27')](function(){_0x355f1a[_0x1f75('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44eda3,_0x22e5fb){return function(_0x1ed9ee){if(!_0x1ed9ee){_0x44eda3[_0x1f75('0x1c')](0x194);}return _0x1ed9ee;};}function handleError(_0x131290,_0x569102){_0x569102=_0x569102||0x1f4;return function(_0x541e7f){logger['error'](_0x541e7f[_0x1f75('0x29')]);if(_0x541e7f[_0x1f75('0x2a')]){delete _0x541e7f[_0x1f75('0x2a')];}_0x131290[_0x1f75('0x1d')](_0x569102)[_0x1f75('0x2b')](_0x541e7f);};}exports['index']=function(_0x3253cd,_0x4f1192){var _0x14011f={},_0x2dccdd={},_0x183d00={'count':0x0,'rows':[]};var _0x3e791b=_[_0x1f75('0x2c')](db['CmHopperBlack']['rawAttributes'],function(_0x596f8f){return{'name':_0x596f8f[_0x1f75('0x2d')],'type':_0x596f8f[_0x1f75('0x2e')]['key']};});_0x2dccdd['model']=_[_0x1f75('0x2c')](_0x3e791b,_0x1f75('0x2a'));_0x2dccdd[_0x1f75('0x2f')]=_['keys'](_0x3253cd[_0x1f75('0x2f')]);_0x2dccdd[_0x1f75('0x30')]=_[_0x1f75('0x31')](_0x2dccdd[_0x1f75('0x32')],_0x2dccdd[_0x1f75('0x2f')]);_0x14011f[_0x1f75('0x33')]=_[_0x1f75('0x31')](_0x2dccdd[_0x1f75('0x32')],qs[_0x1f75('0x34')](_0x3253cd['query'][_0x1f75('0x34')]));_0x14011f[_0x1f75('0x33')]=_0x14011f[_0x1f75('0x33')][_0x1f75('0x35')]?_0x14011f['attributes']:_0x2dccdd[_0x1f75('0x32')];if(!_0x3253cd[_0x1f75('0x2f')][_0x1f75('0x36')](_0x1f75('0x37'))){_0x14011f[_0x1f75('0x22')]=qs[_0x1f75('0x22')](_0x3253cd[_0x1f75('0x2f')][_0x1f75('0x22')]);_0x14011f[_0x1f75('0x1f')]=qs[_0x1f75('0x1f')](_0x3253cd[_0x1f75('0x2f')][_0x1f75('0x1f')]);}_0x14011f['order']=qs[_0x1f75('0x38')](_0x3253cd[_0x1f75('0x2f')]['sort']);_0x14011f[_0x1f75('0x39')]=qs['filters'](_[_0x1f75('0x3a')](_0x3253cd[_0x1f75('0x2f')],_0x2dccdd[_0x1f75('0x30')]),_0x3e791b);if(_0x3253cd['query'][_0x1f75('0x3b')]){_0x14011f[_0x1f75('0x39')]=_[_0x1f75('0x3c')](_0x14011f[_0x1f75('0x39')],{'$or':_[_0x1f75('0x2c')](_0x3e791b,function(_0x51f17f){if(_0x51f17f[_0x1f75('0x2e')]!==_0x1f75('0x3d')){var _0xd0e58a={};_0xd0e58a[_0x51f17f[_0x1f75('0x2a')]]={'$like':'%'+_0x3253cd[_0x1f75('0x2f')][_0x1f75('0x3b')]+'%'};return _0xd0e58a;}})});}_0x14011f=_['merge']({},_0x14011f,_0x3253cd['options']);var _0x5b1c52={'where':_0x14011f[_0x1f75('0x39')]};return db[_0x1f75('0x3e')][_0x1f75('0x21')](_0x5b1c52)[_0x1f75('0x27')](function(_0x42b3cd){_0x183d00['count']=_0x42b3cd;if(_0x3253cd[_0x1f75('0x2f')][_0x1f75('0x3f')]){_0x14011f[_0x1f75('0x40')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x14011f);})[_0x1f75('0x27')](function(_0x3ad868){_0x183d00[_0x1f75('0x41')]=_0x3ad868;return _0x183d00;})['then'](respondWithFilteredResult(_0x4f1192,_0x14011f))[_0x1f75('0x42')](handleError(_0x4f1192,null));};exports[_0x1f75('0x43')]=function(_0x3750a9,_0x14bfa0){var _0x3825af={'raw':!![],'where':{'id':_0x3750a9[_0x1f75('0x44')]['id']}},_0x4d9de8={};_0x4d9de8[_0x1f75('0x32')]=_[_0x1f75('0x45')](db[_0x1f75('0x3e')]['rawAttributes']);_0x4d9de8[_0x1f75('0x2f')]=_[_0x1f75('0x45')](_0x3750a9[_0x1f75('0x2f')]);_0x4d9de8[_0x1f75('0x30')]=_[_0x1f75('0x31')](_0x4d9de8[_0x1f75('0x32')],_0x4d9de8['query']);_0x3825af[_0x1f75('0x33')]=_[_0x1f75('0x31')](_0x4d9de8[_0x1f75('0x32')],qs[_0x1f75('0x34')](_0x3750a9[_0x1f75('0x2f')][_0x1f75('0x34')]));_0x3825af[_0x1f75('0x33')]=_0x3825af[_0x1f75('0x33')][_0x1f75('0x35')]?_0x3825af[_0x1f75('0x33')]:_0x4d9de8[_0x1f75('0x32')];if(_0x3750a9[_0x1f75('0x2f')]['includeAll']){_0x3825af[_0x1f75('0x40')]=[{'all':!![]}];}_0x3825af=_[_0x1f75('0x3c')]({},_0x3825af,_0x3750a9[_0x1f75('0x46')]);return db[_0x1f75('0x3e')][_0x1f75('0x47')](_0x3825af)[_0x1f75('0x27')](handleEntityNotFound(_0x14bfa0,null))[_0x1f75('0x27')](respondWithResult(_0x14bfa0,null))['catch'](handleError(_0x14bfa0,null));};exports['update']=function(_0x376b20,_0x511f2e){if(_0x376b20[_0x1f75('0x48')]['id']){delete _0x376b20[_0x1f75('0x48')]['id'];}return db[_0x1f75('0x3e')][_0x1f75('0x47')]({'where':{'id':_0x376b20[_0x1f75('0x44')]['id']}})['then'](handleEntityNotFound(_0x511f2e,null))[_0x1f75('0x27')](saveUpdates(_0x376b20[_0x1f75('0x48')],null))[_0x1f75('0x27')](respondWithResult(_0x511f2e,null))[_0x1f75('0x42')](handleError(_0x511f2e,null));};exports[_0x1f75('0x28')]=function(_0x1dcb68,_0x527339){return db['CmHopperBlack'][_0x1f75('0x47')]({'where':{'id':_0x1dcb68[_0x1f75('0x44')]['id']}})[_0x1f75('0x27')](handleEntityNotFound(_0x527339,null))[_0x1f75('0x27')](removeEntity(_0x527339,null))['catch'](handleError(_0x527339,null));};exports[_0x1f75('0x49')]=function(_0x5d4e75,_0x4e2d9c){return db[_0x1f75('0x3e')]['describe']()[_0x1f75('0x27')](respondWithResult(_0x4e2d9c,null))[_0x1f75('0x42')](handleError(_0x4e2d9c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 44af823..b70f6ac 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 _0x19b4=['exports','define','CmHopperBlack','cm_hopper_black','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes'];(function(_0x562b99,_0x1e5b52){var _0x2c8fb0=function(_0x7dd08a){while(--_0x7dd08a){_0x562b99['push'](_0x562b99['shift']());}};_0x2c8fb0(++_0x1e5b52);}(_0x19b4,0x74));var _0x419b=function(_0x7960f8,_0x458228){_0x7960f8=_0x7960f8-0x0;var _0x41a5cb=_0x19b4[_0x7960f8];return _0x41a5cb;};'use strict';var _=require('lodash');var util=require(_0x419b('0x0'));var logger=require(_0x419b('0x1'))(_0x419b('0x2'));var moment=require(_0x419b('0x3'));var BPromise=require(_0x419b('0x4'));var rp=require(_0x419b('0x5'));var fs=require('fs');var path=require(_0x419b('0x6'));var rimraf=require(_0x419b('0x7'));var config=require(_0x419b('0x8'));var attributes=require(_0x419b('0x9'));module[_0x419b('0xa')]=function(_0x4fbb6e,_0x2d5ee3){return _0x4fbb6e[_0x419b('0xb')](_0x419b('0xc'),attributes,{'tableName':_0x419b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50ae=['request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','api','moment','bluebird'];(function(_0x599287,_0x184377){var _0x5b4329=function(_0x4395a5){while(--_0x4395a5){_0x599287['push'](_0x599287['shift']());}};_0x5b4329(++_0x184377);}(_0x50ae,0x15a));var _0xe50a=function(_0x3ac3da,_0x4e467c){_0x3ac3da=_0x3ac3da-0x0;var _0x1a7525=_0x50ae[_0x3ac3da];return _0x1a7525;};'use strict';var _=require(_0xe50a('0x0'));var util=require(_0xe50a('0x1'));var logger=require('../../config/logger')(_0xe50a('0x2'));var moment=require(_0xe50a('0x3'));var BPromise=require(_0xe50a('0x4'));var rp=require(_0xe50a('0x5'));var fs=require('fs');var path=require(_0xe50a('0x6'));var rimraf=require('rimraf');var config=require(_0xe50a('0x7'));var attributes=require(_0xe50a('0x8'));module[_0xe50a('0x9')]=function(_0x2ac3be,_0xb21335){return _0x2ac3be[_0xe50a('0xa')](_0xe50a('0xb'),attributes,{'tableName':_0xe50a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 2d01115..be02504 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 _0xcb4f=['CmHopperBlack,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','attributes','include','map','model','debug','UpdateCmHopperBlack','update','raw','where','limit','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0xcb4f,0x192));var _0xfcb4=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xcb4f[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xfcb4('0x0'));var util=require(_0xfcb4('0x1'));var moment=require(_0xfcb4('0x2'));var BPromise=require(_0xfcb4('0x3'));var rs=require(_0xfcb4('0x4'));var fs=require('fs');var Redis=require(_0xfcb4('0x5'));var db=require(_0xfcb4('0x6'))['db'];var utils=require(_0xfcb4('0x7'));var logger=require(_0xfcb4('0x8'))(_0xfcb4('0x9'));var config=require(_0xfcb4('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xfcb4('0xb')][_0xfcb4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x25a546,_0x3f89f1,_0x18e610){return new BPromise(function(_0x5aac84,_0x3cad4e){return client[_0xfcb4('0xd')](_0x25a546,_0x18e610)[_0xfcb4('0xe')](function(_0x37b595){logger[_0xfcb4('0xf')](_0xfcb4('0x10'),_0x3f89f1,'request\x20sent');logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x3f89f1,_0xfcb4('0x11'),JSON[_0xfcb4('0x12')](_0x37b595));if(_0x37b595[_0xfcb4('0x13')]){if(_0x37b595['error'][_0xfcb4('0x14')]===0x1f4){logger[_0xfcb4('0x13')](_0xfcb4('0x10'),_0x3f89f1,_0x37b595[_0xfcb4('0x13')][_0xfcb4('0x15')]);return _0x3cad4e(_0x37b595[_0xfcb4('0x13')][_0xfcb4('0x15')]);}logger[_0xfcb4('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x3f89f1,_0x37b595[_0xfcb4('0x13')]['message']);return _0x5aac84(_0x37b595[_0xfcb4('0x13')]['message']);}else{logger[_0xfcb4('0xf')](_0xfcb4('0x10'),_0x3f89f1,'request\x20sent');_0x5aac84(_0x37b595['result'][_0xfcb4('0x15')]);}})[_0xfcb4('0x16')](function(_0x2d1329){logger[_0xfcb4('0x13')](_0xfcb4('0x10'),_0x3f89f1,_0x2d1329);_0x3cad4e(_0x2d1329);});});}exports[_0xfcb4('0x17')]=function(_0xc45139){var _0x172a54=this;return new Promise(function(_0x3b12df,_0x43f06){return db[_0xfcb4('0x18')][_0xfcb4('0x19')]({'raw':_0xc45139[_0xfcb4('0x1a')]?_0xc45139[_0xfcb4('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xc45139['options']?_0xc45139['options']['where']||null:null,'attributes':_0xc45139[_0xfcb4('0x1a')]?_0xc45139['options'][_0xfcb4('0x1b')]||null:null,'limit':_0xc45139[_0xfcb4('0x1a')]?_0xc45139[_0xfcb4('0x1a')]['limit']||null:null,'include':_0xc45139[_0xfcb4('0x1a')]?_0xc45139['options'][_0xfcb4('0x1c')]?_[_0xfcb4('0x1d')](_0xc45139[_0xfcb4('0x1a')]['include'],function(_0x42b0e6){return{'model':db[_0x42b0e6[_0xfcb4('0x1e')]],'as':_0x42b0e6['as'],'attributes':_0x42b0e6[_0xfcb4('0x1b')],'include':_0x42b0e6[_0xfcb4('0x1c')]?_[_0xfcb4('0x1d')](_0x42b0e6['include'],function(_0xa32b54){return{'model':db[_0xa32b54['model']],'as':_0xa32b54['as'],'attributes':_0xa32b54[_0xfcb4('0x1b')],'include':_0xa32b54[_0xfcb4('0x1c')]?_[_0xfcb4('0x1d')](_0xa32b54[_0xfcb4('0x1c')],function(_0x26a627){return{'model':db[_0x26a627[_0xfcb4('0x1e')]],'as':_0x26a627['as'],'attributes':_0x26a627[_0xfcb4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfcb4('0xe')](function(_0xedb250){logger[_0xfcb4('0xf')](_0xfcb4('0x17'),_0xc45139);logger[_0xfcb4('0x1f')](_0xfcb4('0x17'),_0xc45139,JSON[_0xfcb4('0x12')](_0xedb250));_0x3b12df(_0xedb250);})[_0xfcb4('0x16')](function(_0x3b2791){logger[_0xfcb4('0x13')](_0xfcb4('0x17'),_0x3b2791[_0xfcb4('0x15')],_0xc45139);_0x43f06(_0x172a54['error'](0x1f4,_0x3b2791['message']));});});};exports[_0xfcb4('0x20')]=function(_0x3891f3){var _0x1a36df=this;return new Promise(function(_0x76432,_0x4956d2){return db['CmHopperBlack'][_0xfcb4('0x21')](_0x3891f3['body'],{'raw':_0x3891f3[_0xfcb4('0x1a')]?_0x3891f3[_0xfcb4('0x1a')][_0xfcb4('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3891f3[_0xfcb4('0x1a')]?_0x3891f3[_0xfcb4('0x1a')][_0xfcb4('0x23')]||null:null,'attributes':_0x3891f3[_0xfcb4('0x1a')]?_0x3891f3['options'][_0xfcb4('0x1b')]||null:null,'limit':_0x3891f3['options']?_0x3891f3['options'][_0xfcb4('0x24')]||null:null})[_0xfcb4('0xe')](function(_0x30ad32){logger[_0xfcb4('0xf')]('UpdateCmHopperBlack',_0x3891f3);logger['debug'](_0xfcb4('0x20'),_0x3891f3,JSON[_0xfcb4('0x12')](_0x30ad32));_0x76432(_0x30ad32);})[_0xfcb4('0x16')](function(_0x110c89){logger[_0xfcb4('0x13')]('UpdateCmHopperBlack',_0x110c89[_0xfcb4('0x15')],_0x3891f3);_0x4956d2(_0x1a36df[_0xfcb4('0x13')](0x1f4,_0x110c89[_0xfcb4('0x15')]));});});};exports[_0xfcb4('0x25')]=function(_0x5c61fc){var _0x344dbe=this;return new Promise(function(_0x52f724,_0x270ae9){return db[_0xfcb4('0x18')]['destroy']({'where':_0x5c61fc[_0xfcb4('0x1a')]?_0x5c61fc['options']['where']||null:null})[_0xfcb4('0xe')](function(_0x4cc998){logger[_0xfcb4('0xf')]('DestroyCmHopperBlack',_0x5c61fc);logger['debug'](_0xfcb4('0x25'),_0x5c61fc,JSON[_0xfcb4('0x12')](_0x4cc998));_0x52f724(_0x4cc998);})[_0xfcb4('0x16')](function(_0x5654db){logger[_0xfcb4('0x13')]('DestroyCmHopperBlack',_0x5654db[_0xfcb4('0x15')],_0x5c61fc);_0x270ae9(_0x344dbe['error'](0x1f4,_0x5654db[_0xfcb4('0x15')]));});});}; \ No newline at end of file +var _0xf64b=['then','UpdateCmHopperBlack','DestroyCmHopperBlack','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','catch','CmHopperBlack','body'];(function(_0xbd52c2,_0x1f089b){var _0x24fda2=function(_0x394b54){while(--_0x394b54){_0xbd52c2['push'](_0xbd52c2['shift']());}};_0x24fda2(++_0x1f089b);}(_0xf64b,0x161));var _0xbf64=function(_0x18d631,_0x4376d2){_0x18d631=_0x18d631-0x0;var _0x50d708=_0xf64b[_0x18d631];return _0x50d708;};'use strict';var _=require(_0xbf64('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbf64('0x1'));var rs=require(_0xbf64('0x2'));var fs=require('fs');var Redis=require(_0xbf64('0x3'));var db=require(_0xbf64('0x4'))['db'];var utils=require(_0xbf64('0x5'));var logger=require('../../config/logger')(_0xbf64('0x6'));var config=require('../../config/environment');var jayson=require(_0xbf64('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e3e50,_0x47c880,_0x502fa1){return new BPromise(function(_0x4c0620,_0x51cc8d){return client[_0xbf64('0x8')](_0x3e3e50,_0x502fa1)['then'](function(_0x295e3c){logger[_0xbf64('0x9')](_0xbf64('0xa'),_0x47c880,_0xbf64('0xb'));logger[_0xbf64('0xc')](_0xbf64('0xd'),_0x47c880,_0xbf64('0xb'),JSON[_0xbf64('0xe')](_0x295e3c));if(_0x295e3c[_0xbf64('0xf')]){if(_0x295e3c[_0xbf64('0xf')][_0xbf64('0x10')]===0x1f4){logger[_0xbf64('0xf')](_0xbf64('0xa'),_0x47c880,_0x295e3c[_0xbf64('0xf')][_0xbf64('0x11')]);return _0x51cc8d(_0x295e3c['error']['message']);}logger[_0xbf64('0xf')](_0xbf64('0xa'),_0x47c880,_0x295e3c['error']['message']);return _0x4c0620(_0x295e3c[_0xbf64('0xf')][_0xbf64('0x11')]);}else{logger['info'](_0xbf64('0xa'),_0x47c880,_0xbf64('0xb'));_0x4c0620(_0x295e3c[_0xbf64('0x12')][_0xbf64('0x11')]);}})['catch'](function(_0x1841fb){logger['error'](_0xbf64('0xa'),_0x47c880,_0x1841fb);_0x51cc8d(_0x1841fb);});});}exports[_0xbf64('0x13')]=function(_0x5934a5){var _0x12f538=this;return new Promise(function(_0x301384,_0x4ef5b6){return db['CmHopperBlack'][_0xbf64('0x14')]({'raw':_0x5934a5[_0xbf64('0x15')]?_0x5934a5[_0xbf64('0x15')][_0xbf64('0x16')]===undefined?!![]:![]:!![],'where':_0x5934a5[_0xbf64('0x15')]?_0x5934a5[_0xbf64('0x15')][_0xbf64('0x17')]||null:null,'attributes':_0x5934a5[_0xbf64('0x15')]?_0x5934a5[_0xbf64('0x15')][_0xbf64('0x18')]||null:null,'limit':_0x5934a5[_0xbf64('0x15')]?_0x5934a5[_0xbf64('0x15')][_0xbf64('0x19')]||null:null,'include':_0x5934a5[_0xbf64('0x15')]?_0x5934a5[_0xbf64('0x15')][_0xbf64('0x1a')]?_['map'](_0x5934a5['options'][_0xbf64('0x1a')],function(_0x4c7c88){return{'model':db[_0x4c7c88['model']],'as':_0x4c7c88['as'],'attributes':_0x4c7c88['attributes'],'include':_0x4c7c88[_0xbf64('0x1a')]?_[_0xbf64('0x1b')](_0x4c7c88['include'],function(_0x3dbdd1){return{'model':db[_0x3dbdd1[_0xbf64('0x1c')]],'as':_0x3dbdd1['as'],'attributes':_0x3dbdd1[_0xbf64('0x18')],'include':_0x3dbdd1[_0xbf64('0x1a')]?_[_0xbf64('0x1b')](_0x3dbdd1[_0xbf64('0x1a')],function(_0x2e488b){return{'model':db[_0x2e488b[_0xbf64('0x1c')]],'as':_0x2e488b['as'],'attributes':_0x2e488b[_0xbf64('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x420054){logger[_0xbf64('0x9')](_0xbf64('0x13'),_0x5934a5);logger[_0xbf64('0xc')](_0xbf64('0x13'),_0x5934a5,JSON['stringify'](_0x420054));_0x301384(_0x420054);})[_0xbf64('0x1d')](function(_0x45b663){logger[_0xbf64('0xf')](_0xbf64('0x13'),_0x45b663[_0xbf64('0x11')],_0x5934a5);_0x4ef5b6(_0x12f538[_0xbf64('0xf')](0x1f4,_0x45b663[_0xbf64('0x11')]));});});};exports['UpdateCmHopperBlack']=function(_0x345a36){var _0x220aeb=this;return new Promise(function(_0x1af8ee,_0x3f1b0f){return db[_0xbf64('0x1e')]['update'](_0x345a36[_0xbf64('0x1f')],{'raw':_0x345a36[_0xbf64('0x15')]?_0x345a36['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x345a36[_0xbf64('0x15')]?_0x345a36[_0xbf64('0x15')][_0xbf64('0x17')]||null:null,'attributes':_0x345a36[_0xbf64('0x15')]?_0x345a36[_0xbf64('0x15')][_0xbf64('0x18')]||null:null,'limit':_0x345a36[_0xbf64('0x15')]?_0x345a36[_0xbf64('0x15')][_0xbf64('0x19')]||null:null})[_0xbf64('0x20')](function(_0x419118){logger['info'](_0xbf64('0x21'),_0x345a36);logger[_0xbf64('0xc')](_0xbf64('0x21'),_0x345a36,JSON[_0xbf64('0xe')](_0x419118));_0x1af8ee(_0x419118);})[_0xbf64('0x1d')](function(_0x1e9a8f){logger[_0xbf64('0xf')](_0xbf64('0x21'),_0x1e9a8f[_0xbf64('0x11')],_0x345a36);_0x3f1b0f(_0x220aeb[_0xbf64('0xf')](0x1f4,_0x1e9a8f[_0xbf64('0x11')]));});});};exports[_0xbf64('0x22')]=function(_0x566dd5){var _0x32b39a=this;return new Promise(function(_0x4e23ba,_0x365bde){return db['CmHopperBlack']['destroy']({'where':_0x566dd5[_0xbf64('0x15')]?_0x566dd5['options'][_0xbf64('0x17')]||null:null})[_0xbf64('0x20')](function(_0x6732f9){logger['info'](_0xbf64('0x22'),_0x566dd5);logger[_0xbf64('0xc')](_0xbf64('0x22'),_0x566dd5,JSON['stringify'](_0x6732f9));_0x4e23ba(_0x6732f9);})[_0xbf64('0x1d')](function(_0x20ae3a){logger[_0xbf64('0xf')](_0xbf64('0x22'),_0x20ae3a[_0xbf64('0x11')],_0x566dd5);_0x365bde(_0x32b39a[_0xbf64('0xf')](0x1f4,_0x20ae3a['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index c9498f7..d8287d4 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 _0x3831=['get','isAuthenticated','describe','/:id','show','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmHopperBlack.controller'];(function(_0x4ec643,_0x11ef45){var _0x33773a=function(_0x5b639c){while(--_0x5b639c){_0x4ec643['push'](_0x4ec643['shift']());}};_0x33773a(++_0x11ef45);}(_0x3831,0x14c));var _0x1383=function(_0x14d76a,_0x38c683){_0x14d76a=_0x14d76a-0x0;var _0x5baef8=_0x3831[_0x14d76a];return _0x5baef8;};'use strict';var multer=require(_0x1383('0x0'));var util=require('util');var path=require(_0x1383('0x1'));var timeout=require(_0x1383('0x2'));var express=require(_0x1383('0x3'));var router=express[_0x1383('0x4')]();var fs_extra=require(_0x1383('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1383('0x6'));var config=require('../../config/environment');var controller=require(_0x1383('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1383('0x8')]('/describe',auth[_0x1383('0x9')](),controller[_0x1383('0xa')]);router[_0x1383('0x8')](_0x1383('0xb'),auth[_0x1383('0x9')](),controller[_0x1383('0xc')]);router[_0x1383('0xd')](_0x1383('0xb'),auth['isAuthenticated'](),controller[_0x1383('0xe')]);router[_0x1383('0xf')](_0x1383('0xb'),auth[_0x1383('0x9')](),controller[_0x1383('0x10')]);module['exports']=router; \ No newline at end of file +var _0x323f=['../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','/:id','show','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4e322e,_0x1a3190){var _0x5ee728=function(_0x33e64a){while(--_0x33e64a){_0x4e322e['push'](_0x4e322e['shift']());}};_0x5ee728(++_0x1a3190);}(_0x323f,0x1ee));var _0xf323=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x323f[_0x110c3d];return _0x226d67;};'use strict';var multer=require('multer');var util=require(_0xf323('0x0'));var path=require('path');var timeout=require(_0xf323('0x1'));var express=require(_0xf323('0x2'));var router=express[_0xf323('0x3')]();var fs_extra=require(_0xf323('0x4'));var auth=require(_0xf323('0x5'));var interaction=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var controller=require(_0xf323('0x8'));router[_0xf323('0x9')]('/',auth[_0xf323('0xa')](),controller['index']);router[_0xf323('0x9')](_0xf323('0xb'),auth[_0xf323('0xa')](),controller[_0xf323('0xc')]);router[_0xf323('0x9')](_0xf323('0xd'),auth[_0xf323('0xa')](),controller[_0xf323('0xe')]);router[_0xf323('0xf')](_0xf323('0xd'),auth[_0xf323('0xa')](),controller[_0xf323('0x10')]);router[_0xf323('0x11')](_0xf323('0xd'),auth[_0xf323('0xa')](),controller[_0xf323('0x12')]);module[_0xf323('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index a7867c0..99f2249 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 _0x5bc2=['getDataValue','endtime','followuptime','seconds','BOOLEAN','moment','exports','INTEGER','STRING','DATE'];(function(_0x388469,_0x36a8b1){var _0x590252=function(_0x4319bb){while(--_0x4319bb){_0x388469['push'](_0x388469['shift']());}};_0x590252(++_0x36a8b1);}(_0x5bc2,0x19f));var _0x25bc=function(_0x3ceb54,_0x5bddfd){_0x3ceb54=_0x3ceb54-0x0;var _0x26d8a6=_0x5bc2[_0x3ceb54];return _0x26d8a6;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x25bc('0x0'));module[_0x25bc('0x1')]={'state':{'type':Sequelize[_0x25bc('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x25bc('0x3')]},'scheduledat':{'type':Sequelize[_0x25bc('0x4')]},'countbusyretry':{'type':Sequelize[_0x25bc('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x25bc('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x25bc('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x25bc('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x25bc('0x3')]},'originatecalleridname':{'type':Sequelize[_0x25bc('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x25bc('0x3')]},'starttime':{'type':Sequelize[_0x25bc('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x25bc('0x4')]},'endtime':{'type':Sequelize[_0x25bc('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x25bc('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x25bc('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x25bc('0x3')]},'campaign':{'type':Sequelize[_0x25bc('0x3')]},'campaigntype':{'type':Sequelize[_0x25bc('0x3')]},'membername':{'type':Sequelize[_0x25bc('0x3')]},'reason':{'type':Sequelize[_0x25bc('0x3')]},'disposition':{'type':Sequelize[_0x25bc('0x3')]},'secondDisposition':{'type':Sequelize[_0x25bc('0x3')]},'thirdDisposition':{'type':Sequelize[_0x25bc('0x3')]},'dispositionat':{'type':Sequelize[_0x25bc('0x4')],'set':function(_0x4568d1){var _0x58b0c0=this[_0x25bc('0x5')](_0x25bc('0x6'));if(_0x58b0c0&&_0x4568d1){this['setDataValue'](_0x25bc('0x7'),moment(_0x4568d1)['diff'](moment(_0x58b0c0),_0x25bc('0x8')));}}},'amd':{'type':Sequelize[_0x25bc('0x9')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x25bc('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x25bc('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x25bc('0x4')]},'callback':{'type':Sequelize[_0x25bc('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x25bc('0x4')]},'deleted':{'type':Sequelize[_0x25bc('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x25bc('0x4')]},'recallme':{'type':Sequelize[_0x25bc('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x25bc('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x25bc('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x25bc('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x25bc('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe242=['STRING','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','DATE'];(function(_0x129d42,_0x1864d5){var _0xeeb303=function(_0x15c9d0){while(--_0x15c9d0){_0x129d42['push'](_0x129d42['shift']());}};_0xeeb303(++_0x1864d5);}(_0xe242,0x18e));var _0x2e24=function(_0x3d400a,_0xd94376){_0x3d400a=_0x3d400a-0x0;var _0x3fd2d6=_0xe242[_0x3d400a];return _0x3fd2d6;};'use strict';var Sequelize=require(_0x2e24('0x0'));var moment=require(_0x2e24('0x1'));module[_0x2e24('0x2')]={'state':{'type':Sequelize[_0x2e24('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x2e24('0x4')]},'countbusyretry':{'type':Sequelize[_0x2e24('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2e24('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2e24('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2e24('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x2e24('0x5')]},'originatecalleridname':{'type':Sequelize[_0x2e24('0x5')]},'calleridnum':{'type':Sequelize[_0x2e24('0x5')]},'calleridname':{'type':Sequelize[_0x2e24('0x5')]},'starttime':{'type':Sequelize[_0x2e24('0x4')]},'responsetime':{'type':Sequelize[_0x2e24('0x4')]},'answertime':{'type':Sequelize[_0x2e24('0x4')]},'droptime':{'type':Sequelize[_0x2e24('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2e24('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2e24('0x5')]},'campaign':{'type':Sequelize[_0x2e24('0x5')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2e24('0x5')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x2e24('0x5')]},'secondDisposition':{'type':Sequelize[_0x2e24('0x5')]},'thirdDisposition':{'type':Sequelize[_0x2e24('0x5')]},'dispositionat':{'type':Sequelize[_0x2e24('0x4')],'set':function(_0x4a5538){var _0x247b79=this[_0x2e24('0x6')](_0x2e24('0x7'));if(_0x247b79&&_0x4a5538){this[_0x2e24('0x8')](_0x2e24('0x9'),moment(_0x4a5538)[_0x2e24('0xa')](moment(_0x247b79),_0x2e24('0xb')));}}},'amd':{'type':Sequelize[_0x2e24('0xc')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x2e24('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x2e24('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2e24('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x2e24('0x5')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x2e24('0x4')]},'recallme':{'type':Sequelize[_0x2e24('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x2e24('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 2d01a80..51a64bd 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 _0xc6ac=['key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','VoiceQueueId','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','CmHopperFinal','rawAttributes','fieldName','type'];(function(_0x136c35,_0x468ac2){var _0x2abd43=function(_0x5b9340){while(--_0x5b9340){_0x136c35['push'](_0x136c35['shift']());}};_0x2abd43(++_0x468ac2);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4136bf,_0x1c57df){_0x4136bf=_0x4136bf-0x0;var _0x7191d0=_0xc6ac[_0x4136bf];return _0x7191d0;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59ce6d,_0xf0f6d5){_0xf0f6d5=_0xf0f6d5||0xcc;return function(_0x211444){if(_0x211444){return _0x59ce6d[_0xcc6a('0x1b')](_0xf0f6d5);}return _0x59ce6d['status'](_0xf0f6d5)['end']();};}function respondWithResult(_0x369dc1,_0xcb9e2e){_0xcb9e2e=_0xcb9e2e||0xc8;return function(_0x43710d){if(_0x43710d){return _0x369dc1[_0xcc6a('0x1c')](_0xcb9e2e)[_0xcc6a('0x1d')](_0x43710d);}};}function respondWithFilteredResult(_0x337ec5,_0x4133fa){return function(_0x403b18){if(_0x403b18){var _0x56ffb0=typeof _0x4133fa['offset']==='undefined'&&typeof _0x4133fa[_0xcc6a('0x1e')]===_0xcc6a('0x1f');var _0x307f2a=_0x403b18[_0xcc6a('0x20')];var _0x33079c=_0x56ffb0?0x0:_0x4133fa[_0xcc6a('0x21')];var _0x2d9585=_0x56ffb0?_0x403b18[_0xcc6a('0x20')]:_0x4133fa[_0xcc6a('0x21')]+_0x4133fa[_0xcc6a('0x1e')];var _0x1d20a3;if(_0x2d9585>=_0x307f2a){_0x2d9585=_0x307f2a;_0x1d20a3=0xc8;}else{_0x1d20a3=0xce;}_0x337ec5['status'](_0x1d20a3);return _0x337ec5[_0xcc6a('0x22')](_0xcc6a('0x23'),_0x33079c+'-'+_0x2d9585+'/'+_0x307f2a)[_0xcc6a('0x1d')](_0x403b18);}return null;};}function patchUpdates(_0x368a6e){return function(_0x1495d8){try{jsonpatch[_0xcc6a('0x24')](_0x1495d8,_0x368a6e,!![]);}catch(_0x36c80f){return BPromise[_0xcc6a('0x25')](_0x36c80f);}return _0x1495d8[_0xcc6a('0x26')]();};}function saveUpdates(_0x19d32c,_0x329d17){return function(_0x845088){if(_0x845088){return _0x845088['update'](_0x19d32c)[_0xcc6a('0x27')](function(_0x3a081e){return _0x3a081e;});}return null;};}function removeEntity(_0x38f812,_0x581aae){return function(_0x10016a){if(_0x10016a){return _0x10016a[_0xcc6a('0x28')]()[_0xcc6a('0x27')](function(){_0x38f812[_0xcc6a('0x1c')](0xcc)[_0xcc6a('0x29')]();});}};}function handleEntityNotFound(_0x5fc697,_0x50abc1){return function(_0x26def8){if(!_0x26def8){_0x5fc697[_0xcc6a('0x1b')](0x194);}return _0x26def8;};}function handleError(_0x3514f3,_0x5f27e5){_0x5f27e5=_0x5f27e5||0x1f4;return function(_0x3afb3a){logger[_0xcc6a('0x2a')](_0x3afb3a['stack']);if(_0x3afb3a[_0xcc6a('0x2b')]){delete _0x3afb3a[_0xcc6a('0x2b')];}_0x3514f3[_0xcc6a('0x1c')](_0x5f27e5)[_0xcc6a('0x2c')](_0x3afb3a);};}exports['index']=function(_0x194aab,_0x3cf14c){var _0x2c6d88={},_0x4f176b={},_0x2590a2={'count':0x0,'rows':[]};var _0x5308d4=_['map'](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')],function(_0x3aa315){return{'name':_0x3aa315[_0xcc6a('0x2f')],'type':_0x3aa315[_0xcc6a('0x30')][_0xcc6a('0x31')]};});_0x4f176b['model']=_[_0xcc6a('0x32')](_0x5308d4,_0xcc6a('0x2b'));_0x4f176b[_0xcc6a('0x33')]=_[_0xcc6a('0x34')](_0x194aab[_0xcc6a('0x33')]);_0x4f176b[_0xcc6a('0x35')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],_0x4f176b['query']);_0x2c6d88[_0xcc6a('0x38')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x39')]));_0x2c6d88[_0xcc6a('0x38')]=_0x2c6d88['attributes'][_0xcc6a('0x3a')]?_0x2c6d88['attributes']:_0x4f176b['model'];if(!_0x194aab['query'][_0xcc6a('0x3b')](_0xcc6a('0x3c'))){_0x2c6d88[_0xcc6a('0x1e')]=qs[_0xcc6a('0x1e')](_0x194aab[_0xcc6a('0x33')]['limit']);_0x2c6d88['offset']=qs[_0xcc6a('0x21')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x21')]);}_0x2c6d88['order']=qs[_0xcc6a('0x3d')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x3d')]);_0x2c6d88[_0xcc6a('0x3e')]=qs[_0xcc6a('0x35')](_[_0xcc6a('0x3f')](_0x194aab[_0xcc6a('0x33')],_0x4f176b[_0xcc6a('0x35')]),_0x5308d4);if(_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x40')]){_0x2c6d88[_0xcc6a('0x3e')]=_[_0xcc6a('0x41')](_0x2c6d88[_0xcc6a('0x3e')],{'$or':_[_0xcc6a('0x32')](_0x5308d4,function(_0x262a1e){if(_0x262a1e[_0xcc6a('0x30')]!==_0xcc6a('0x42')){var _0x386cbc={};_0x386cbc[_0x262a1e['name']]={'$like':'%'+_0x194aab['query'][_0xcc6a('0x40')]+'%'};return _0x386cbc;}})});}_0x2c6d88=_[_0xcc6a('0x41')]({},_0x2c6d88,_0x194aab[_0xcc6a('0x43')]);var _0x1fd8e1={'where':_0x2c6d88[_0xcc6a('0x3e')]};return db[_0xcc6a('0x2d')][_0xcc6a('0x20')](_0x1fd8e1)[_0xcc6a('0x27')](function(_0x49b65c){_0x2590a2['count']=_0x49b65c;if(_0x194aab[_0xcc6a('0x33')]['includeAll']){_0x2c6d88['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xcc6a('0x44')](_0x2c6d88);})[_0xcc6a('0x27')](function(_0xb42897){_0x2590a2[_0xcc6a('0x45')]=_0xb42897;return _0x2590a2;})[_0xcc6a('0x27')](respondWithFilteredResult(_0x3cf14c,_0x2c6d88))['catch'](handleError(_0x3cf14c,null));};exports[_0xcc6a('0x46')]=function(_0xfbb079,_0x17e5a0){var _0x2f966f={'raw':!![],'where':{'id':_0xfbb079[_0xcc6a('0x47')]['id']}},_0x14ca90={};_0x14ca90['model']=_[_0xcc6a('0x34')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')]);_0x14ca90[_0xcc6a('0x33')]=_['keys'](_0xfbb079[_0xcc6a('0x33')]);_0x14ca90['filters']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],_0x14ca90[_0xcc6a('0x33')]);_0x2f966f['attributes']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0xfbb079['query']['fields']));_0x2f966f[_0xcc6a('0x38')]=_0x2f966f[_0xcc6a('0x38')][_0xcc6a('0x3a')]?_0x2f966f[_0xcc6a('0x38')]:_0x14ca90[_0xcc6a('0x37')];if(_0xfbb079['query'][_0xcc6a('0x48')]){_0x2f966f[_0xcc6a('0x49')]=[{'all':!![]}];}_0x2f966f=_['merge']({},_0x2f966f,_0xfbb079[_0xcc6a('0x43')]);return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')](_0x2f966f)[_0xcc6a('0x27')](handleEntityNotFound(_0x17e5a0,null))[_0xcc6a('0x27')](respondWithResult(_0x17e5a0,null))[_0xcc6a('0x4b')](handleError(_0x17e5a0,null));};exports['describe']=function(_0x4e1a0b,_0x47c999){return db[_0xcc6a('0x2d')][_0xcc6a('0x4c')]()[_0xcc6a('0x27')](respondWithResult(_0x47c999,null))[_0xcc6a('0x4b')](handleError(_0x47c999,null));};exports['update']=function(_0x1c3bb8,_0x5e7bab){if(_0x1c3bb8[_0xcc6a('0x4d')][_0xcc6a('0x4e')]){delete _0x1c3bb8[_0xcc6a('0x4d')][_0xcc6a('0x4e')];}return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'uniqueid':_0x1c3bb8['params']['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0x5e7bab,null))[_0xcc6a('0x27')](saveUpdates(_0x1c3bb8[_0xcc6a('0x4d')],null))[_0xcc6a('0x27')](respondWithResult(_0x5e7bab,null))[_0xcc6a('0x4b')](handleError(_0x5e7bab,null));};exports[_0xcc6a('0x4f')]=function(_0x431684,_0x392805,_0x31987f){return db[_0xcc6a('0x2d')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x431684[_0xcc6a('0x47')]['id']},'attributes':[[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x53')))),_0xcc6a('0x54')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x55')))),'busyContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x208,\x201,\x20null'))),_0xcc6a('0x56')],[db['sequelize']['fn'](_0xcc6a('0x51'),db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x57')))),_0xcc6a('0x58')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')]['literal'](_0xcc6a('0x59')))),'abandonedContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x2022,\x201,\x20null'))),_0xcc6a('0x5a')],[db['sequelize']['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x5b')))),_0xcc6a('0x5c')]]})[_0xcc6a('0x27')](handleEntityNotFound(_0x392805,null))[_0xcc6a('0x27')](respondWithResult(_0x392805,null))[_0xcc6a('0x4b')](handleError(_0x392805,null));};exports[_0xcc6a('0x5d')]=function(_0x3e76d7,_0x42bbc7,_0x2ad9a6){return db[_0xcc6a('0x2d')]['findAll']({'raw':![],'where':{'CampaignId':_0x3e76d7[_0xcc6a('0x47')]['id']},'attributes':[[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x5e')))),_0xcc6a('0x5f')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x53')))),_0xcc6a('0x54')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x55')))),'busyContacts'],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xcc6a('0x56')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x57')))),_0xcc6a('0x58')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x59')))),_0xcc6a('0x60')],[db[_0xcc6a('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x61')))),_0xcc6a('0x5a')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x5b')))),_0xcc6a('0x5c')]]})['then'](handleEntityNotFound(_0x42bbc7,null))[_0xcc6a('0x27')](respondWithResult(_0x42bbc7,null))[_0xcc6a('0x4b')](handleError(_0x42bbc7,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x72e53a,_0x5b61df,_0x3b4ce0){return db['VoiceQueue'][_0xcc6a('0x4a')]({'where':{'id':_0x72e53a[_0xcc6a('0x47')]['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0x5b61df,null))['then'](function(_0x3ce1eb){var _0x51390a;if(_0x3ce1eb){_0x51390a=squel[_0xcc6a('0x62')]()['into'](_0xcc6a('0x63'))[_0xcc6a('0x64')]([_0xcc6a('0x65'),_0xcc6a('0x66'),_0xcc6a('0x67'),_0xcc6a('0x68'),'VoiceQueueId',_0xcc6a('0x69'),_0xcc6a('0x6a')],squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x6d'),'phone')[_0xcc6a('0x6c')](_0xcc6a('0x6e'),'scheduledAt')['field'](_0xcc6a('0x6f'),_0xcc6a('0x67'))[_0xcc6a('0x6c')](_0xcc6a('0x70'),_0xcc6a('0x68'))[_0xcc6a('0x6c')]('ANY_VALUE(VoiceQueueId)',_0xcc6a('0x71'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x69'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),'updatedAt')['from'](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x75'),_0x72e53a['body'][_0xcc6a('0x76')][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x77'))[_0xcc6a('0x3e')](_0xcc6a('0x78'),squel['select']()[_0xcc6a('0x6c')](_0xcc6a('0x65'))[_0xcc6a('0x79')]('cm_hopper')[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]()))[_0xcc6a('0x3e')](_0xcc6a('0x78'),squel['select']()[_0xcc6a('0x6c')](_0xcc6a('0x7a'))['from'](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]())['where'](_0xcc6a('0x7b')))[_0xcc6a('0x7c')](_0xcc6a('0x67')))[_0xcc6a('0x74')]();return db[_0xcc6a('0x50')][_0xcc6a('0x33')](_0x51390a);}return[];})['then'](respondWithResult(_0x5b61df,null))['catch'](handleError(_0x5b61df,null));};exports[_0xcc6a('0x7d')]=function(_0x5be65b,_0xb42e9,_0x35a798){return db[_0xcc6a('0x7e')][_0xcc6a('0x4a')]({'where':{'id':_0x5be65b[_0xcc6a('0x47')]['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0xb42e9,null))[_0xcc6a('0x27')](function(_0x1746d8){var _0xc0d194;if(_0x1746d8){_0xc0d194=squel[_0xcc6a('0x62')]()[_0xcc6a('0x7f')](_0xcc6a('0x63'))['fromQuery']([_0xcc6a('0x65'),_0xcc6a('0x66'),_0xcc6a('0x67'),_0xcc6a('0x68'),'CampaignId',_0xcc6a('0x69'),'updatedAt'],squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x6d'),_0xcc6a('0x65'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x66'))['field'](_0xcc6a('0x6f'),_0xcc6a('0x67'))[_0xcc6a('0x6c')](_0xcc6a('0x70'),_0xcc6a('0x68'))[_0xcc6a('0x6c')]('ANY_VALUE(CampaignId)',_0xcc6a('0x80'))[_0xcc6a('0x6c')]('NOW()','createdAt')[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x6a'))[_0xcc6a('0x79')](_0xcc6a('0x72'))['where'](_0xcc6a('0x81'),_0x5be65b['params']['id'][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x75'),_0x5be65b[_0xcc6a('0x4d')][_0xcc6a('0x76')][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x77'))['where'](_0xcc6a('0x78'),squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')]('phone')[_0xcc6a('0x79')](_0xcc6a('0x63'))[_0xcc6a('0x3e')](_0xcc6a('0x81'),_0x5be65b[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]()))[_0xcc6a('0x3e')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x7a'))[_0xcc6a('0x79')](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x81'),_0x5be65b[_0xcc6a('0x47')]['id']['toString']())['where'](_0xcc6a('0x7b')))['group'](_0xcc6a('0x67')))[_0xcc6a('0x74')]();return db[_0xcc6a('0x50')][_0xcc6a('0x33')](_0xc0d194);}return[];})[_0xcc6a('0x27')](respondWithResult(_0xb42e9,null))[_0xcc6a('0x4b')](handleError(_0xb42e9,null));};exports[_0xcc6a('0x82')]=function(_0x48b6e3,_0x10d731,_0x537e2b){return db['CmHopper'][_0xcc6a('0x83')]({'where':{'VoiceQueueId':_0x48b6e3['body'][_0xcc6a('0x71')],'CampaignId':_0x48b6e3[_0xcc6a('0x4d')]['CampaignId'],'ContactId':_0x48b6e3['body'][_0xcc6a('0x67')]}})['then'](handleEntityNotFound(_0x10d731,null))[_0xcc6a('0x27')](function(_0x3df510){if(_0x3df510){return _0x3df510;}return null;})[_0xcc6a('0x27')](respondWithResult(_0x10d731,null))[_0xcc6a('0x4b')](handleError(_0x10d731,null));}; \ No newline at end of file +var _0x5d17=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','state\x20=\x204','moveContactsIvrCampaignHopperFinal','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','group','checkContactHopper','findOne','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','describe','update','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()'];(function(_0x5b3950,_0x4e5556){var _0x41e436=function(_0x139e30){while(--_0x139e30){_0x5b3950['push'](_0x5b3950['shift']());}};_0x41e436(++_0x4e5556);}(_0x5d17,0x114));var _0x75d1=function(_0x1123bb,_0x54472a){_0x1123bb=_0x1123bb-0x0;var _0xdeb602=_0x5d17[_0x1123bb];return _0xdeb602;};'use strict';var emlformat=require(_0x75d1('0x0'));var rimraf=require(_0x75d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75d1('0x2'));var moment=require(_0x75d1('0x3'));var BPromise=require(_0x75d1('0x4'));var Mustache=require('mustache');var util=require(_0x75d1('0x5'));var path=require(_0x75d1('0x6'));var sox=require(_0x75d1('0x7'));var csv=require(_0x75d1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d1('0x9'));var _=require(_0x75d1('0xa'));var squel=require(_0x75d1('0xb'));var crypto=require(_0x75d1('0xc'));var jsforce=require(_0x75d1('0xd'));var deskjs=require(_0x75d1('0xe'));var toCsv=require(_0x75d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d1('0x10'));var hardwareService=require(_0x75d1('0x11'));var logger=require('../../config/logger')(_0x75d1('0x12'));var utils=require(_0x75d1('0x13'));var config=require(_0x75d1('0x14'));var licenseUtil=require(_0x75d1('0x15'));var db=require(_0x75d1('0x16'))['db'];function respondWithStatusCode(_0xd089cf,_0x49667a){_0x49667a=_0x49667a||0xcc;return function(_0x19e825){if(_0x19e825){return _0xd089cf[_0x75d1('0x17')](_0x49667a);}return _0xd089cf[_0x75d1('0x18')](_0x49667a)[_0x75d1('0x19')]();};}function respondWithResult(_0x49d723,_0x553697){_0x553697=_0x553697||0xc8;return function(_0x55b8a0){if(_0x55b8a0){return _0x49d723[_0x75d1('0x18')](_0x553697)[_0x75d1('0x1a')](_0x55b8a0);}};}function respondWithFilteredResult(_0x2fd022,_0x52e649){return function(_0x1f9620){if(_0x1f9620){var _0x3fff9b=typeof _0x52e649[_0x75d1('0x1b')]===_0x75d1('0x1c')&&typeof _0x52e649[_0x75d1('0x1d')]===_0x75d1('0x1c');var _0x2845bc=_0x1f9620[_0x75d1('0x1e')];var _0x1bc5de=_0x3fff9b?0x0:_0x52e649[_0x75d1('0x1b')];var _0x2c2a6d=_0x3fff9b?_0x1f9620['count']:_0x52e649['offset']+_0x52e649[_0x75d1('0x1d')];var _0x42b7ac;if(_0x2c2a6d>=_0x2845bc){_0x2c2a6d=_0x2845bc;_0x42b7ac=0xc8;}else{_0x42b7ac=0xce;}_0x2fd022['status'](_0x42b7ac);return _0x2fd022[_0x75d1('0x1f')](_0x75d1('0x20'),_0x1bc5de+'-'+_0x2c2a6d+'/'+_0x2845bc)[_0x75d1('0x1a')](_0x1f9620);}return null;};}function patchUpdates(_0xf6cc70){return function(_0xa42dbe){try{jsonpatch[_0x75d1('0x21')](_0xa42dbe,_0xf6cc70,!![]);}catch(_0x51d3b0){return BPromise[_0x75d1('0x22')](_0x51d3b0);}return _0xa42dbe[_0x75d1('0x23')]();};}function saveUpdates(_0x501cc7,_0x1cb58c){return function(_0x641ea4){if(_0x641ea4){return _0x641ea4['update'](_0x501cc7)[_0x75d1('0x24')](function(_0x5e70ec){return _0x5e70ec;});}return null;};}function removeEntity(_0x3a85c0,_0xc256af){return function(_0x345cf5){if(_0x345cf5){return _0x345cf5['destroy']()['then'](function(){_0x3a85c0[_0x75d1('0x18')](0xcc)[_0x75d1('0x19')]();});}};}function handleEntityNotFound(_0x315ce5,_0x18184b){return function(_0x51d043){if(!_0x51d043){_0x315ce5[_0x75d1('0x17')](0x194);}return _0x51d043;};}function handleError(_0x2b5848,_0x367238){_0x367238=_0x367238||0x1f4;return function(_0x51138e){logger['error'](_0x51138e['stack']);if(_0x51138e[_0x75d1('0x25')]){delete _0x51138e[_0x75d1('0x25')];}_0x2b5848[_0x75d1('0x18')](_0x367238)[_0x75d1('0x26')](_0x51138e);};}exports[_0x75d1('0x27')]=function(_0x519ceb,_0x4d292e){var _0x410e16={},_0x197f52={},_0x4967b5={'count':0x0,'rows':[]};var _0x2408b6=_['map'](db[_0x75d1('0x28')][_0x75d1('0x29')],function(_0x91e7c9){return{'name':_0x91e7c9[_0x75d1('0x2a')],'type':_0x91e7c9[_0x75d1('0x2b')]['key']};});_0x197f52[_0x75d1('0x2c')]=_[_0x75d1('0x2d')](_0x2408b6,_0x75d1('0x25'));_0x197f52[_0x75d1('0x2e')]=_['keys'](_0x519ceb[_0x75d1('0x2e')]);_0x197f52['filters']=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],_0x197f52['query']);_0x410e16[_0x75d1('0x30')]=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x519ceb[_0x75d1('0x2e')]['fields']));_0x410e16[_0x75d1('0x30')]=_0x410e16[_0x75d1('0x30')][_0x75d1('0x32')]?_0x410e16[_0x75d1('0x30')]:_0x197f52['model'];if(!_0x519ceb['query']['hasOwnProperty'](_0x75d1('0x33'))){_0x410e16[_0x75d1('0x1d')]=qs[_0x75d1('0x1d')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1d')]);_0x410e16[_0x75d1('0x1b')]=qs[_0x75d1('0x1b')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1b')]);}_0x410e16['order']=qs[_0x75d1('0x34')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x34')]);_0x410e16[_0x75d1('0x35')]=qs[_0x75d1('0x36')](_['pick'](_0x519ceb['query'],_0x197f52['filters']),_0x2408b6);if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x37')]){_0x410e16[_0x75d1('0x35')]=_[_0x75d1('0x38')](_0x410e16[_0x75d1('0x35')],{'$or':_[_0x75d1('0x2d')](_0x2408b6,function(_0x48f9f3){if(_0x48f9f3['type']!=='VIRTUAL'){var _0x3f2569={};_0x3f2569[_0x48f9f3['name']]={'$like':'%'+_0x519ceb['query'][_0x75d1('0x37')]+'%'};return _0x3f2569;}})});}_0x410e16=_[_0x75d1('0x38')]({},_0x410e16,_0x519ceb[_0x75d1('0x39')]);var _0x46854c={'where':_0x410e16['where']};return db[_0x75d1('0x28')][_0x75d1('0x1e')](_0x46854c)[_0x75d1('0x24')](function(_0x3d4137){_0x4967b5[_0x75d1('0x1e')]=_0x3d4137;if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x410e16[_0x75d1('0x3b')]=[{'all':!![]}];}return db[_0x75d1('0x28')][_0x75d1('0x3c')](_0x410e16);})[_0x75d1('0x24')](function(_0x93922f){_0x4967b5[_0x75d1('0x3d')]=_0x93922f;return _0x4967b5;})[_0x75d1('0x24')](respondWithFilteredResult(_0x4d292e,_0x410e16))[_0x75d1('0x3e')](handleError(_0x4d292e,null));};exports[_0x75d1('0x3f')]=function(_0x25f689,_0x2ad3ef){var _0x42c18c={'raw':!![],'where':{'id':_0x25f689[_0x75d1('0x40')]['id']}},_0x2384aa={};_0x2384aa[_0x75d1('0x2c')]=_['keys'](db['CmHopperFinal'][_0x75d1('0x29')]);_0x2384aa[_0x75d1('0x2e')]=_[_0x75d1('0x41')](_0x25f689[_0x75d1('0x2e')]);_0x2384aa['filters']=_[_0x75d1('0x2f')](_0x2384aa[_0x75d1('0x2c')],_0x2384aa[_0x75d1('0x2e')]);_0x42c18c[_0x75d1('0x30')]=_['intersection'](_0x2384aa[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x25f689[_0x75d1('0x2e')][_0x75d1('0x31')]));_0x42c18c['attributes']=_0x42c18c[_0x75d1('0x30')]['length']?_0x42c18c[_0x75d1('0x30')]:_0x2384aa[_0x75d1('0x2c')];if(_0x25f689[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x42c18c[_0x75d1('0x3b')]=[{'all':!![]}];}_0x42c18c=_[_0x75d1('0x38')]({},_0x42c18c,_0x25f689['options']);return db[_0x75d1('0x28')]['find'](_0x42c18c)['then'](handleEntityNotFound(_0x2ad3ef,null))[_0x75d1('0x24')](respondWithResult(_0x2ad3ef,null))[_0x75d1('0x3e')](handleError(_0x2ad3ef,null));};exports[_0x75d1('0x42')]=function(_0x12bd67,_0x16f744){return db[_0x75d1('0x28')][_0x75d1('0x42')]()['then'](respondWithResult(_0x16f744,null))['catch'](handleError(_0x16f744,null));};exports[_0x75d1('0x43')]=function(_0x8ce3d2,_0x50def3){if(_0x8ce3d2[_0x75d1('0x44')][_0x75d1('0x45')]){delete _0x8ce3d2[_0x75d1('0x44')]['uniqueid'];}return db[_0x75d1('0x28')][_0x75d1('0x46')]({'where':{'uniqueid':_0x8ce3d2[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x50def3,null))[_0x75d1('0x24')](saveUpdates(_0x8ce3d2[_0x75d1('0x44')],null))[_0x75d1('0x24')](respondWithResult(_0x50def3,null))['catch'](handleError(_0x50def3,null));};exports[_0x75d1('0x47')]=function(_0x382195,_0x16b3c0,_0x395e0b){return db[_0x75d1('0x28')][_0x75d1('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x382195[_0x75d1('0x40')]['id']},'attributes':[[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x51')))),'congestionContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),_0x75d1('0x55')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),_0x75d1('0x57')],[db['sequelize']['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})['then'](handleEntityNotFound(_0x16b3c0,null))[_0x75d1('0x24')](respondWithResult(_0x16b3c0,null))[_0x75d1('0x3e')](handleError(_0x16b3c0,null));};exports[_0x75d1('0x59')]=function(_0x16cc70,_0x5d2219,_0x22ce12){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x16cc70[_0x75d1('0x40')]['id']},'attributes':[[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x51')))),_0x75d1('0x5a')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),'abandonedContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})[_0x75d1('0x24')](handleEntityNotFound(_0x5d2219,null))[_0x75d1('0x24')](respondWithResult(_0x5d2219,null))['catch'](handleError(_0x5d2219,null));};exports[_0x75d1('0x5b')]=function(_0x1f9ac2,_0x290587,_0x1baaca){return db[_0x75d1('0x5c')]['find']({'where':{'id':_0x1f9ac2['params']['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x290587,null))['then'](function(_0x3f15f3){var _0xf29a9f;if(_0x3f15f3){_0xf29a9f=squel[_0x75d1('0x5d')]()['into']('cm_hopper')[_0x75d1('0x5e')](['phone',_0x75d1('0x5f'),_0x75d1('0x60'),_0x75d1('0x61'),'VoiceQueueId',_0x75d1('0x62'),_0x75d1('0x63')],squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x66'),_0x75d1('0x67'))[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')](_0x75d1('0x69'),_0x75d1('0x60'))[_0x75d1('0x65')](_0x75d1('0x6a'),'ListId')['field'](_0x75d1('0x6b'),_0x75d1('0x6c'))['field'](_0x75d1('0x68'),'createdAt')['field']('NOW()',_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2['params']['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x1f9ac2[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()['field']('phone')['from'](_0x75d1('0x74'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2[_0x75d1('0x40')]['id'][_0x75d1('0x70')]()))[_0x75d1('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x75d1('0x64')]()[_0x75d1('0x65')]('calleridnum')[_0x75d1('0x6d')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x1f9ac2[_0x75d1('0x40')]['id']['toString']())['where'](_0x75d1('0x75')))['group'](_0x75d1('0x60')))[_0x75d1('0x70')]();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0xf29a9f);}return[];})[_0x75d1('0x24')](respondWithResult(_0x290587,null))[_0x75d1('0x3e')](handleError(_0x290587,null));};exports[_0x75d1('0x76')]=function(_0x217347,_0x51b682,_0x195a0a){return db['Campaign'][_0x75d1('0x46')]({'where':{'id':_0x217347[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x51b682,null))['then'](function(_0x10bc92){var _0x150735;if(_0x10bc92){_0x150735=squel[_0x75d1('0x5d')]()[_0x75d1('0x77')](_0x75d1('0x74'))[_0x75d1('0x5e')]([_0x75d1('0x67'),'scheduledAt',_0x75d1('0x60'),_0x75d1('0x61'),_0x75d1('0x78'),_0x75d1('0x62'),_0x75d1('0x63')],squel['select']()['field'](_0x75d1('0x66'),'phone')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')]('ANY_VALUE(ContactId)','ContactId')[_0x75d1('0x65')](_0x75d1('0x6a'),_0x75d1('0x61'))[_0x75d1('0x65')](_0x75d1('0x79'),'CampaignId')[_0x75d1('0x65')](_0x75d1('0x68'),'createdAt')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')]('CampaignId\x20=\x20?',_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x217347[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x67'))[_0x75d1('0x6d')]('cm_hopper')[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id']['toString']()))[_0x75d1('0x35')](_0x75d1('0x73'),squel['select']()[_0x75d1('0x65')](_0x75d1('0x7b'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')]('state\x20=\x204'))[_0x75d1('0x7c')](_0x75d1('0x60')))['toString']();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0x150735);}return[];})['then'](respondWithResult(_0x51b682,null))['catch'](handleError(_0x51b682,null));};exports[_0x75d1('0x7d')]=function(_0x44a017,_0x4d8e5d,_0x1f3a7e){return db['CmHopper'][_0x75d1('0x7e')]({'where':{'VoiceQueueId':_0x44a017['body'][_0x75d1('0x6c')],'CampaignId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x78')],'ContactId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x60')]}})[_0x75d1('0x24')](handleEntityNotFound(_0x4d8e5d,null))[_0x75d1('0x24')](function(_0x205e82){if(_0x205e82){return _0x205e82;}return null;})[_0x75d1('0x24')](respondWithResult(_0x4d8e5d,null))[_0x75d1('0x3e')](handleError(_0x4d8e5d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index e344d18..126253c 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 _0xf301=['uniqueid','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0x5cab28,_0x307622){var _0xa3554d=function(_0x330139){while(--_0x330139){_0x5cab28['push'](_0x5cab28['shift']());}};_0xa3554d(++_0x307622);}(_0xf301,0xde));var _0x1f30=function(_0x554f45,_0x808432){_0x554f45=_0x554f45-0x0;var _0x4f7715=_0xf301[_0x554f45];return _0x4f7715;};'use strict';var _=require(_0x1f30('0x0'));var util=require(_0x1f30('0x1'));var logger=require(_0x1f30('0x2'))(_0x1f30('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1f30('0x4'));var fs=require('fs');var path=require(_0x1f30('0x5'));var rimraf=require('rimraf');var config=require(_0x1f30('0x6'));var attributes=require(_0x1f30('0x7'));module['exports']=function(_0x588021,_0x21b6a3){return _0x588021[_0x1f30('0x8')](_0x1f30('0x9'),attributes,{'tableName':_0x1f30('0xa'),'paranoid':![],'indexes':[{'name':_0x1f30('0xb'),'fields':[_0x1f30('0xb')]},{'name':'uniqueid','fields':[_0x1f30('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd382=['bluebird','path','rimraf','../../config/environment','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x3a1c80,_0x541223){var _0x26091c=function(_0x2d5479){while(--_0x2d5479){_0x3a1c80['push'](_0x3a1c80['shift']());}};_0x26091c(++_0x541223);}(_0xd382,0x1f4));var _0x2d38=function(_0x3149ef,_0x5a3548){_0x3149ef=_0x3149ef-0x0;var _0x5cb3d6=_0xd382[_0x3149ef];return _0x5cb3d6;};'use strict';var _=require(_0x2d38('0x0'));var util=require(_0x2d38('0x1'));var logger=require(_0x2d38('0x2'))('api');var moment=require(_0x2d38('0x3'));var BPromise=require(_0x2d38('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d38('0x5'));var rimraf=require(_0x2d38('0x6'));var config=require(_0x2d38('0x7'));var attributes=require('./cmHopperFinal.attributes');module[_0x2d38('0x8')]=function(_0x40e328,_0x46dca8){return _0x40e328[_0x2d38('0x9')](_0x2d38('0xa'),attributes,{'tableName':_0x2d38('0xb'),'paranoid':![],'indexes':[{'name':_0x2d38('0xc'),'fields':[_0x2d38('0xc')]},{'name':_0x2d38('0xd'),'fields':[_0x2d38('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 9dade9c..369cec5 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4a16aa,_0x2d2216){var _0x5b9336=function(_0x1d01d3){while(--_0x1d01d3){_0x4a16aa['push'](_0x4a16aa['shift']());}};_0x5b9336(++_0x2d2216);}(_0x7a54,0x106));var _0x47a5=function(_0x426f4a,_0x3c350c){_0x426f4a=_0x426f4a-0x0;var _0x546e2c=_0x7a54[_0x426f4a];return _0x546e2c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x2686fc,_0x33dd73){var _0x59f3e4=function(_0x15b9c6){while(--_0x15b9c6){_0x2686fc['push'](_0x2686fc['shift']());}};_0x59f3e4(++_0x33dd73);}(_0xb10b,0x12a));var _0xbb10=function(_0xd8768,_0x3fedcb){_0xd8768=_0xd8768-0x0;var _0x46228f=_0xb10b[_0xd8768];return _0x46228f;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 8d171a8..65582fe 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 _0xd193=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','fs-extra'];(function(_0x5b9824,_0x3e94ba){var _0xea4ad0=function(_0x5ec56a){while(--_0x5ec56a){_0x5b9824['push'](_0x5b9824['shift']());}};_0xea4ad0(++_0x3e94ba);}(_0xd193,0x119));var _0x3d19=function(_0xcc66ba,_0x759290){_0xcc66ba=_0xcc66ba-0x0;var _0x50cf42=_0xd193[_0xcc66ba];return _0x50cf42;};'use strict';var multer=require(_0x3d19('0x0'));var util=require(_0x3d19('0x1'));var path=require(_0x3d19('0x2'));var timeout=require(_0x3d19('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3d19('0x4'));var auth=require(_0x3d19('0x5'));var interaction=require(_0x3d19('0x6'));var config=require(_0x3d19('0x7'));var controller=require('./cmHopperFinal.controller');router[_0x3d19('0x8')]('/',auth[_0x3d19('0x9')](),controller[_0x3d19('0xa')]);router[_0x3d19('0x8')](_0x3d19('0xb'),auth[_0x3d19('0x9')](),controller[_0x3d19('0xc')]);router[_0x3d19('0x8')](_0x3d19('0xd'),auth[_0x3d19('0x9')](),controller['show']);router[_0x3d19('0x8')]('/voice/queue/countAttributes/:id',auth[_0x3d19('0x9')](),controller[_0x3d19('0xe')]);router[_0x3d19('0x8')](_0x3d19('0xf'),auth[_0x3d19('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x3d19('0x10')](_0x3d19('0x11'),auth['isAuthenticated'](),controller[_0x3d19('0x12')]);router[_0x3d19('0x10')](_0x3d19('0x13'),auth[_0x3d19('0x9')](),controller[_0x3d19('0x14')]);router[_0x3d19('0x10')](_0x3d19('0x15'),auth[_0x3d19('0x9')](),controller[_0x3d19('0x16')]);router[_0x3d19('0x17')]('/:id',auth[_0x3d19('0x9')](),controller[_0x3d19('0x18')]);module[_0x3d19('0x19')]=router; \ No newline at end of file +var _0x5e11=['index','get','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated'];(function(_0x1a8e6d,_0x309736){var _0x5a58c1=function(_0x460d0a){while(--_0x460d0a){_0x1a8e6d['push'](_0x1a8e6d['shift']());}};_0x5a58c1(++_0x309736);}(_0x5e11,0x1a6));var _0x15e1=function(_0x2e78e9,_0x42957c){_0x2e78e9=_0x2e78e9-0x0;var _0x35aad4=_0x5e11[_0x2e78e9];return _0x35aad4;};'use strict';var multer=require(_0x15e1('0x0'));var util=require('util');var path=require(_0x15e1('0x1'));var timeout=require('connect-timeout');var express=require(_0x15e1('0x2'));var router=express[_0x15e1('0x3')]();var fs_extra=require(_0x15e1('0x4'));var auth=require(_0x15e1('0x5'));var interaction=require(_0x15e1('0x6'));var config=require(_0x15e1('0x7'));var controller=require(_0x15e1('0x8'));router['get']('/',auth[_0x15e1('0x9')](),controller[_0x15e1('0xa')]);router[_0x15e1('0xb')]('/describe',auth[_0x15e1('0x9')](),controller[_0x15e1('0xc')]);router[_0x15e1('0xb')](_0x15e1('0xd'),auth['isAuthenticated'](),controller[_0x15e1('0xe')]);router['get'](_0x15e1('0xf'),auth[_0x15e1('0x9')](),controller[_0x15e1('0x10')]);router['get'](_0x15e1('0x11'),auth[_0x15e1('0x9')](),controller[_0x15e1('0x12')]);router['post'](_0x15e1('0x13'),auth[_0x15e1('0x9')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x15e1('0x14')](_0x15e1('0x15'),auth[_0x15e1('0x9')](),controller[_0x15e1('0x16')]);router[_0x15e1('0x14')](_0x15e1('0x17'),auth[_0x15e1('0x9')](),controller[_0x15e1('0x18')]);router[_0x15e1('0x19')](_0x15e1('0xd'),auth[_0x15e1('0x9')](),controller['update']);module[_0x15e1('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 8e4cb97..21100d6 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 _0x7f43=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x57792f,_0x45dd6a){var _0x4fbf0e=function(_0x7ab8ae){while(--_0x7ab8ae){_0x57792f['push'](_0x57792f['shift']());}};_0x4fbf0e(++_0x45dd6a);}(_0x7f43,0x1a0));var _0x37f4=function(_0x883916,_0x2177fa){_0x883916=_0x883916-0x0;var _0x28fe20=_0x7f43[_0x883916];return _0x28fe20;};'use strict';var Sequelize=require(_0x37f4('0x0'));module[_0x37f4('0x1')]={'state':{'type':Sequelize[_0x37f4('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x37f4('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x37f4('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x37f4('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x37f4('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x37f4('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x37f4('0x3')]},'calleridname':{'type':Sequelize[_0x37f4('0x3')]},'starttime':{'type':Sequelize[_0x37f4('0x4')]},'responsetime':{'type':Sequelize[_0x37f4('0x4')]},'answertime':{'type':Sequelize[_0x37f4('0x4')]},'droptime':{'type':Sequelize[_0x37f4('0x4')]},'endtime':{'type':Sequelize[_0x37f4('0x4')]},'ringtime':{'type':Sequelize[_0x37f4('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x37f4('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x37f4('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x37f4('0x3')]},'campaign':{'type':Sequelize[_0x37f4('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x37f4('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x37f4('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x37f4('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x37f4('0x4')]},'recallme':{'type':Sequelize[_0x37f4('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x37f4('0x4')]},'edited':{'type':Sequelize[_0x37f4('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x37f4('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x37f4('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x37f4('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x37f4('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x37f4('0x3')]}}; \ No newline at end of file +var _0x7647=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x350afe,_0x3ef9ce){var _0x4a1496=function(_0x3b9987){while(--_0x3b9987){_0x350afe['push'](_0x350afe['shift']());}};_0x4a1496(++_0x3ef9ce);}(_0x7647,0x12d));var _0x7764=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x7647[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x7764('0x0'));module[_0x7764('0x1')]={'state':{'type':Sequelize[_0x7764('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x7764('0x3')]},'scheduledat':{'type':Sequelize[_0x7764('0x4')]},'countbusyretry':{'type':Sequelize[_0x7764('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7764('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7764('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7764('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7764('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x7764('0x3')]},'originatecalleridname':{'type':Sequelize[_0x7764('0x3')]},'calleridnum':{'type':Sequelize[_0x7764('0x3')]},'calleridname':{'type':Sequelize[_0x7764('0x3')]},'starttime':{'type':Sequelize[_0x7764('0x4')]},'responsetime':{'type':Sequelize[_0x7764('0x4')]},'answertime':{'type':Sequelize[_0x7764('0x4')]},'droptime':{'type':Sequelize[_0x7764('0x4')]},'endtime':{'type':Sequelize[_0x7764('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7764('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7764('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x7764('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7764('0x3')]},'campaign':{'type':Sequelize[_0x7764('0x3')]},'campaigntype':{'type':Sequelize[_0x7764('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x7764('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x7764('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7764('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x7764('0x4')]},'edited':{'type':Sequelize[_0x7764('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x7764('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7764('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7764('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x7764('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index c1e23e4..06372d1 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 _0x5f37=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','uniqueid','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','CmHopperHistory','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x5f37,0xa8));var _0x75f3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5f37[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x75f3('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x75f3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x75f3('0x2'));var util=require(_0x75f3('0x3'));var path=require(_0x75f3('0x4'));var sox=require(_0x75f3('0x5'));var csv=require(_0x75f3('0x6'));var ejs=require(_0x75f3('0x7'));var fs=require('fs');var fs_extra=require(_0x75f3('0x8'));var _=require(_0x75f3('0x9'));var squel=require(_0x75f3('0xa'));var crypto=require(_0x75f3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x75f3('0xc'));var toCsv=require(_0x75f3('0x6'));var querystring=require(_0x75f3('0xd'));var Papa=require(_0x75f3('0xe'));var Redis=require(_0x75f3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x75f3('0x10'));var as=require(_0x75f3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x75f3('0x12'));var utils=require(_0x75f3('0x13'));var config=require(_0x75f3('0x14'));var licenseUtil=require(_0x75f3('0x15'));var db=require(_0x75f3('0x16'))['db'];function respondWithStatusCode(_0xa30445,_0x1c2fe8){_0x1c2fe8=_0x1c2fe8||0xcc;return function(_0x4ffee7){if(_0x4ffee7){return _0xa30445[_0x75f3('0x17')](_0x1c2fe8);}return _0xa30445[_0x75f3('0x18')](_0x1c2fe8)[_0x75f3('0x19')]();};}function respondWithResult(_0x229500,_0x31273b){_0x31273b=_0x31273b||0xc8;return function(_0x29145f){if(_0x29145f){return _0x229500[_0x75f3('0x18')](_0x31273b)[_0x75f3('0x1a')](_0x29145f);}};}function respondWithFilteredResult(_0x17301d,_0x147c8b){return function(_0x5d3919){if(_0x5d3919){var _0x48b743=typeof _0x147c8b[_0x75f3('0x1b')]===_0x75f3('0x1c')&&typeof _0x147c8b[_0x75f3('0x1d')]===_0x75f3('0x1c');var _0x327ee9=_0x5d3919[_0x75f3('0x1e')];var _0x1a4570=_0x48b743?0x0:_0x147c8b[_0x75f3('0x1b')];var _0x5d7695=_0x48b743?_0x5d3919[_0x75f3('0x1e')]:_0x147c8b[_0x75f3('0x1b')]+_0x147c8b[_0x75f3('0x1d')];var _0x2e3553;if(_0x5d7695>=_0x327ee9){_0x5d7695=_0x327ee9;_0x2e3553=0xc8;}else{_0x2e3553=0xce;}_0x17301d[_0x75f3('0x18')](_0x2e3553);return _0x17301d[_0x75f3('0x1f')](_0x75f3('0x20'),_0x1a4570+'-'+_0x5d7695+'/'+_0x327ee9)[_0x75f3('0x1a')](_0x5d3919);}return null;};}function patchUpdates(_0x58bce5){return function(_0x8b32bd){try{jsonpatch[_0x75f3('0x21')](_0x8b32bd,_0x58bce5,!![]);}catch(_0xf7f5a4){return BPromise['reject'](_0xf7f5a4);}return _0x8b32bd[_0x75f3('0x22')]();};}function saveUpdates(_0x359f24,_0x29177f){return function(_0x556ceb){if(_0x556ceb){return _0x556ceb[_0x75f3('0x23')](_0x359f24)[_0x75f3('0x24')](function(_0x4227b9){return _0x4227b9;});}return null;};}function removeEntity(_0x3b6423,_0x184f2b){return function(_0x425a24){if(_0x425a24){return _0x425a24['destroy']()[_0x75f3('0x24')](function(){_0x3b6423[_0x75f3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f0392,_0x417d63){return function(_0x2a4b2a){if(!_0x2a4b2a){_0x4f0392['sendStatus'](0x194);}return _0x2a4b2a;};}function handleError(_0x21418e,_0x4976eb){_0x4976eb=_0x4976eb||0x1f4;return function(_0x3d41ff){logger[_0x75f3('0x25')](_0x3d41ff[_0x75f3('0x26')]);if(_0x3d41ff[_0x75f3('0x27')]){delete _0x3d41ff[_0x75f3('0x27')];}_0x21418e['status'](_0x4976eb)[_0x75f3('0x28')](_0x3d41ff);};}exports[_0x75f3('0x29')]=function(_0x53ca73,_0x28c38f){var _0x55b6f3={},_0x16ec8c={},_0x4aa38a={'count':0x0,'rows':[]};var _0xe64baa=_['map'](db[_0x75f3('0x2a')]['rawAttributes'],function(_0x20f893){return{'name':_0x20f893[_0x75f3('0x2b')],'type':_0x20f893[_0x75f3('0x2c')][_0x75f3('0x2d')]};});_0x16ec8c[_0x75f3('0x2e')]=_[_0x75f3('0x2f')](_0xe64baa,_0x75f3('0x27'));_0x16ec8c[_0x75f3('0x30')]=_['keys'](_0x53ca73['query']);_0x16ec8c[_0x75f3('0x31')]=_[_0x75f3('0x32')](_0x16ec8c[_0x75f3('0x2e')],_0x16ec8c[_0x75f3('0x30')]);_0x55b6f3[_0x75f3('0x33')]=_['intersection'](_0x16ec8c['model'],qs[_0x75f3('0x34')](_0x53ca73[_0x75f3('0x30')][_0x75f3('0x34')]));_0x55b6f3[_0x75f3('0x33')]=_0x55b6f3[_0x75f3('0x33')][_0x75f3('0x35')]?_0x55b6f3[_0x75f3('0x33')]:_0x16ec8c['model'];if(!_0x53ca73[_0x75f3('0x30')][_0x75f3('0x36')]('nolimit')){_0x55b6f3['limit']=qs[_0x75f3('0x1d')](_0x53ca73[_0x75f3('0x30')][_0x75f3('0x1d')]);_0x55b6f3[_0x75f3('0x1b')]=qs[_0x75f3('0x1b')](_0x53ca73[_0x75f3('0x30')][_0x75f3('0x1b')]);}_0x55b6f3[_0x75f3('0x37')]=qs[_0x75f3('0x38')](_0x53ca73[_0x75f3('0x30')]['sort']);_0x55b6f3[_0x75f3('0x39')]=qs[_0x75f3('0x31')](_[_0x75f3('0x3a')](_0x53ca73[_0x75f3('0x30')],_0x16ec8c[_0x75f3('0x31')]),_0xe64baa);if(_0x53ca73[_0x75f3('0x30')][_0x75f3('0x3b')]){_0x55b6f3['where']=_[_0x75f3('0x3c')](_0x55b6f3[_0x75f3('0x39')],{'$or':_[_0x75f3('0x2f')](_0xe64baa,function(_0x3596b8){if(_0x3596b8[_0x75f3('0x2c')]!==_0x75f3('0x3d')){var _0x34db9d={};_0x34db9d[_0x3596b8[_0x75f3('0x27')]]={'$like':'%'+_0x53ca73[_0x75f3('0x30')][_0x75f3('0x3b')]+'%'};return _0x34db9d;}})});}_0x55b6f3=_[_0x75f3('0x3c')]({},_0x55b6f3,_0x53ca73[_0x75f3('0x3e')]);var _0x5805c9={'where':_0x55b6f3[_0x75f3('0x39')]};return db[_0x75f3('0x2a')][_0x75f3('0x1e')](_0x5805c9)[_0x75f3('0x24')](function(_0x3efca0){_0x4aa38a[_0x75f3('0x1e')]=_0x3efca0;if(_0x53ca73[_0x75f3('0x30')][_0x75f3('0x3f')]){_0x55b6f3[_0x75f3('0x40')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x75f3('0x41')](_0x55b6f3);})['then'](function(_0x268431){_0x4aa38a[_0x75f3('0x42')]=_0x268431;return _0x4aa38a;})[_0x75f3('0x24')](respondWithFilteredResult(_0x28c38f,_0x55b6f3))[_0x75f3('0x43')](handleError(_0x28c38f,null));};exports[_0x75f3('0x44')]=function(_0x443b14,_0x2567f6){var _0x28ab4f={'raw':!![],'where':{'id':_0x443b14['params']['id']}},_0x48549e={};_0x48549e['model']=_[_0x75f3('0x45')](db['CmHopperHistory'][_0x75f3('0x46')]);_0x48549e[_0x75f3('0x30')]=_[_0x75f3('0x45')](_0x443b14[_0x75f3('0x30')]);_0x48549e[_0x75f3('0x31')]=_[_0x75f3('0x32')](_0x48549e[_0x75f3('0x2e')],_0x48549e['query']);_0x28ab4f[_0x75f3('0x33')]=_[_0x75f3('0x32')](_0x48549e[_0x75f3('0x2e')],qs[_0x75f3('0x34')](_0x443b14[_0x75f3('0x30')][_0x75f3('0x34')]));_0x28ab4f[_0x75f3('0x33')]=_0x28ab4f[_0x75f3('0x33')][_0x75f3('0x35')]?_0x28ab4f[_0x75f3('0x33')]:_0x48549e['model'];if(_0x443b14['query'][_0x75f3('0x3f')]){_0x28ab4f[_0x75f3('0x40')]=[{'all':!![]}];}_0x28ab4f=_['merge']({},_0x28ab4f,_0x443b14[_0x75f3('0x3e')]);return db[_0x75f3('0x2a')][_0x75f3('0x47')](_0x28ab4f)[_0x75f3('0x24')](handleEntityNotFound(_0x2567f6,null))['then'](respondWithResult(_0x2567f6,null))[_0x75f3('0x43')](handleError(_0x2567f6,null));};exports[_0x75f3('0x48')]=function(_0x4fa088,_0x424451){return db[_0x75f3('0x2a')][_0x75f3('0x48')](_0x4fa088['body'],{})[_0x75f3('0x24')](respondWithResult(_0x424451,0xc9))[_0x75f3('0x43')](handleError(_0x424451,null));};exports['describe']=function(_0x420350,_0x895c8f){return db[_0x75f3('0x2a')]['describe']()[_0x75f3('0x24')](respondWithResult(_0x895c8f,null))[_0x75f3('0x43')](handleError(_0x895c8f,null));};exports[_0x75f3('0x23')]=function(_0x3bb9a9,_0x261295){if(_0x3bb9a9[_0x75f3('0x49')][_0x75f3('0x4a')]){delete _0x3bb9a9[_0x75f3('0x49')]['uniqueid'];}return db['CmHopperHistory'][_0x75f3('0x47')]({'where':{'uniqueid':_0x3bb9a9['params']['id']}})[_0x75f3('0x24')](handleEntityNotFound(_0x261295,null))[_0x75f3('0x24')](saveUpdates(_0x3bb9a9[_0x75f3('0x49')],null))[_0x75f3('0x24')](respondWithResult(_0x261295,null))['catch'](handleError(_0x261295,null));}; \ No newline at end of file +var _0xc179=['find','catch','create','describe','body','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','CmHopperHistory','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','includeAll','include','findAll','show','params','rawAttributes','keys','fields','options'];(function(_0x509a36,_0x23f071){var _0x5c85d7=function(_0x5def7f){while(--_0x5def7f){_0x509a36['push'](_0x509a36['shift']());}};_0x5c85d7(++_0x23f071);}(_0xc179,0xa2));var _0x9c17=function(_0x1b8050,_0x4d12c6){_0x1b8050=_0x1b8050-0x0;var _0x1ec2b1=_0xc179[_0x1b8050];return _0x1ec2b1;};'use strict';var emlformat=require(_0x9c17('0x0'));var rimraf=require(_0x9c17('0x1'));var zipdir=require(_0x9c17('0x2'));var jsonpatch=require(_0x9c17('0x3'));var rp=require('request-promise');var moment=require(_0x9c17('0x4'));var BPromise=require(_0x9c17('0x5'));var Mustache=require(_0x9c17('0x6'));var util=require(_0x9c17('0x7'));var path=require(_0x9c17('0x8'));var sox=require(_0x9c17('0x9'));var csv=require(_0x9c17('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c17('0xb'));var _=require(_0x9c17('0xc'));var squel=require(_0x9c17('0xd'));var crypto=require(_0x9c17('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9c17('0xa'));var querystring=require(_0x9c17('0xf'));var Papa=require(_0x9c17('0x10'));var Redis=require('ioredis');var authService=require(_0x9c17('0x11'));var qs=require(_0x9c17('0x12'));var as=require(_0x9c17('0x13'));var hardwareService=require(_0x9c17('0x14'));var logger=require(_0x9c17('0x15'))(_0x9c17('0x16'));var utils=require(_0x9c17('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9c17('0x18'));var db=require(_0x9c17('0x19'))['db'];function respondWithStatusCode(_0x42c831,_0x585627){_0x585627=_0x585627||0xcc;return function(_0x19f5ad){if(_0x19f5ad){return _0x42c831[_0x9c17('0x1a')](_0x585627);}return _0x42c831[_0x9c17('0x1b')](_0x585627)['end']();};}function respondWithResult(_0x1b44f2,_0x94f11){_0x94f11=_0x94f11||0xc8;return function(_0x28c025){if(_0x28c025){return _0x1b44f2['status'](_0x94f11)[_0x9c17('0x1c')](_0x28c025);}};}function respondWithFilteredResult(_0x219732,_0xdcb808){return function(_0x2f2eaf){if(_0x2f2eaf){var _0x3e7264=typeof _0xdcb808[_0x9c17('0x1d')]===_0x9c17('0x1e')&&typeof _0xdcb808[_0x9c17('0x1f')]===_0x9c17('0x1e');var _0x279b92=_0x2f2eaf['count'];var _0x537aee=_0x3e7264?0x0:_0xdcb808[_0x9c17('0x1d')];var _0x300468=_0x3e7264?_0x2f2eaf[_0x9c17('0x20')]:_0xdcb808[_0x9c17('0x1d')]+_0xdcb808[_0x9c17('0x1f')];var _0x40faa4;if(_0x300468>=_0x279b92){_0x300468=_0x279b92;_0x40faa4=0xc8;}else{_0x40faa4=0xce;}_0x219732['status'](_0x40faa4);return _0x219732[_0x9c17('0x21')](_0x9c17('0x22'),_0x537aee+'-'+_0x300468+'/'+_0x279b92)[_0x9c17('0x1c')](_0x2f2eaf);}return null;};}function patchUpdates(_0x54b534){return function(_0x1aa10e){try{jsonpatch[_0x9c17('0x23')](_0x1aa10e,_0x54b534,!![]);}catch(_0x40eed4){return BPromise['reject'](_0x40eed4);}return _0x1aa10e[_0x9c17('0x24')]();};}function saveUpdates(_0x3150e1,_0x2ec580){return function(_0xe2b0b6){if(_0xe2b0b6){return _0xe2b0b6[_0x9c17('0x25')](_0x3150e1)[_0x9c17('0x26')](function(_0x52d25e){return _0x52d25e;});}return null;};}function removeEntity(_0x2b4e0b,_0x3e91ae){return function(_0x4c9f5e){if(_0x4c9f5e){return _0x4c9f5e['destroy']()['then'](function(){_0x2b4e0b[_0x9c17('0x1b')](0xcc)[_0x9c17('0x27')]();});}};}function handleEntityNotFound(_0xcaf561,_0x5a2e7a){return function(_0x28fb18){if(!_0x28fb18){_0xcaf561['sendStatus'](0x194);}return _0x28fb18;};}function handleError(_0x2d80fc,_0x4b5476){_0x4b5476=_0x4b5476||0x1f4;return function(_0x25f5bd){logger[_0x9c17('0x28')](_0x25f5bd[_0x9c17('0x29')]);if(_0x25f5bd[_0x9c17('0x2a')]){delete _0x25f5bd[_0x9c17('0x2a')];}_0x2d80fc[_0x9c17('0x1b')](_0x4b5476)[_0x9c17('0x2b')](_0x25f5bd);};}exports[_0x9c17('0x2c')]=function(_0x31858b,_0x2bd3e5){var _0x4cf024={},_0x3ff1b5={},_0x4d4dce={'count':0x0,'rows':[]};var _0x252fcc=_[_0x9c17('0x2d')](db[_0x9c17('0x2e')]['rawAttributes'],function(_0x5d9946){return{'name':_0x5d9946[_0x9c17('0x2f')],'type':_0x5d9946[_0x9c17('0x30')][_0x9c17('0x31')]};});_0x3ff1b5[_0x9c17('0x32')]=_[_0x9c17('0x2d')](_0x252fcc,_0x9c17('0x2a'));_0x3ff1b5[_0x9c17('0x33')]=_['keys'](_0x31858b[_0x9c17('0x33')]);_0x3ff1b5[_0x9c17('0x34')]=_[_0x9c17('0x35')](_0x3ff1b5[_0x9c17('0x32')],_0x3ff1b5[_0x9c17('0x33')]);_0x4cf024[_0x9c17('0x36')]=_[_0x9c17('0x35')](_0x3ff1b5[_0x9c17('0x32')],qs['fields'](_0x31858b['query']['fields']));_0x4cf024[_0x9c17('0x36')]=_0x4cf024[_0x9c17('0x36')][_0x9c17('0x37')]?_0x4cf024[_0x9c17('0x36')]:_0x3ff1b5[_0x9c17('0x32')];if(!_0x31858b[_0x9c17('0x33')][_0x9c17('0x38')](_0x9c17('0x39'))){_0x4cf024['limit']=qs[_0x9c17('0x1f')](_0x31858b[_0x9c17('0x33')]['limit']);_0x4cf024[_0x9c17('0x1d')]=qs['offset'](_0x31858b[_0x9c17('0x33')][_0x9c17('0x1d')]);}_0x4cf024[_0x9c17('0x3a')]=qs[_0x9c17('0x3b')](_0x31858b[_0x9c17('0x33')][_0x9c17('0x3b')]);_0x4cf024[_0x9c17('0x3c')]=qs[_0x9c17('0x34')](_['pick'](_0x31858b['query'],_0x3ff1b5[_0x9c17('0x34')]),_0x252fcc);if(_0x31858b['query'][_0x9c17('0x3d')]){_0x4cf024[_0x9c17('0x3c')]=_['merge'](_0x4cf024[_0x9c17('0x3c')],{'$or':_[_0x9c17('0x2d')](_0x252fcc,function(_0x234201){if(_0x234201[_0x9c17('0x30')]!==_0x9c17('0x3e')){var _0x464b95={};_0x464b95[_0x234201[_0x9c17('0x2a')]]={'$like':'%'+_0x31858b['query'][_0x9c17('0x3d')]+'%'};return _0x464b95;}})});}_0x4cf024=_['merge']({},_0x4cf024,_0x31858b['options']);var _0x43ab4f={'where':_0x4cf024[_0x9c17('0x3c')]};return db['CmHopperHistory'][_0x9c17('0x20')](_0x43ab4f)['then'](function(_0x505878){_0x4d4dce[_0x9c17('0x20')]=_0x505878;if(_0x31858b[_0x9c17('0x33')][_0x9c17('0x3f')]){_0x4cf024[_0x9c17('0x40')]=[{'all':!![]}];}return db[_0x9c17('0x2e')][_0x9c17('0x41')](_0x4cf024);})[_0x9c17('0x26')](function(_0x52b42f){_0x4d4dce['rows']=_0x52b42f;return _0x4d4dce;})[_0x9c17('0x26')](respondWithFilteredResult(_0x2bd3e5,_0x4cf024))['catch'](handleError(_0x2bd3e5,null));};exports[_0x9c17('0x42')]=function(_0x205de7,_0x286dc9){var _0x5d8ab={'raw':!![],'where':{'id':_0x205de7[_0x9c17('0x43')]['id']}},_0x5d9084={};_0x5d9084[_0x9c17('0x32')]=_['keys'](db['CmHopperHistory'][_0x9c17('0x44')]);_0x5d9084[_0x9c17('0x33')]=_[_0x9c17('0x45')](_0x205de7['query']);_0x5d9084['filters']=_[_0x9c17('0x35')](_0x5d9084['model'],_0x5d9084[_0x9c17('0x33')]);_0x5d8ab[_0x9c17('0x36')]=_[_0x9c17('0x35')](_0x5d9084[_0x9c17('0x32')],qs[_0x9c17('0x46')](_0x205de7[_0x9c17('0x33')]['fields']));_0x5d8ab[_0x9c17('0x36')]=_0x5d8ab[_0x9c17('0x36')][_0x9c17('0x37')]?_0x5d8ab['attributes']:_0x5d9084['model'];if(_0x205de7['query'][_0x9c17('0x3f')]){_0x5d8ab[_0x9c17('0x40')]=[{'all':!![]}];}_0x5d8ab=_['merge']({},_0x5d8ab,_0x205de7[_0x9c17('0x47')]);return db[_0x9c17('0x2e')][_0x9c17('0x48')](_0x5d8ab)['then'](handleEntityNotFound(_0x286dc9,null))[_0x9c17('0x26')](respondWithResult(_0x286dc9,null))[_0x9c17('0x49')](handleError(_0x286dc9,null));};exports[_0x9c17('0x4a')]=function(_0x45e8c6,_0x1eb867){return db['CmHopperHistory'][_0x9c17('0x4a')](_0x45e8c6['body'],{})['then'](respondWithResult(_0x1eb867,0xc9))[_0x9c17('0x49')](handleError(_0x1eb867,null));};exports[_0x9c17('0x4b')]=function(_0x40687c,_0xa7f41e){return db[_0x9c17('0x2e')][_0x9c17('0x4b')]()[_0x9c17('0x26')](respondWithResult(_0xa7f41e,null))[_0x9c17('0x49')](handleError(_0xa7f41e,null));};exports['update']=function(_0x59dd6c,_0xb7f52e){if(_0x59dd6c[_0x9c17('0x4c')][_0x9c17('0x4d')]){delete _0x59dd6c[_0x9c17('0x4c')][_0x9c17('0x4d')];}return db[_0x9c17('0x2e')][_0x9c17('0x48')]({'where':{'uniqueid':_0x59dd6c[_0x9c17('0x43')]['id']}})[_0x9c17('0x26')](handleEntityNotFound(_0xb7f52e,null))[_0x9c17('0x26')](saveUpdates(_0x59dd6c[_0x9c17('0x4c')],null))['then'](respondWithResult(_0xb7f52e,null))['catch'](handleError(_0xb7f52e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 498426e..cccc483 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 _0x77d4=['exports','define','endtime','uniqueid','util','api','bluebird','request-promise','../../config/environment','./cmHopperHistory.attributes'];(function(_0x35c1cf,_0x197400){var _0x56bc59=function(_0x7b52ad){while(--_0x7b52ad){_0x35c1cf['push'](_0x35c1cf['shift']());}};_0x56bc59(++_0x197400);}(_0x77d4,0x108));var _0x477d=function(_0x1a62bb,_0x157e87){_0x1a62bb=_0x1a62bb-0x0;var _0x4ade6f=_0x77d4[_0x1a62bb];return _0x4ade6f;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var logger=require('../../config/logger')(_0x477d('0x1'));var moment=require('moment');var BPromise=require(_0x477d('0x2'));var rp=require(_0x477d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x477d('0x4'));var attributes=require(_0x477d('0x5'));module[_0x477d('0x6')]=function(_0x471fca,_0x2545e5){return _0x471fca[_0x477d('0x7')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x477d('0x8'),'fields':['endtime']},{'name':'uniqueid','fields':[_0x477d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6333=['uniqueid','api','bluebird','request-promise','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history'];(function(_0x2aaa0a,_0x36f63a){var _0x326d4b=function(_0x4a4089){while(--_0x4a4089){_0x2aaa0a['push'](_0x2aaa0a['shift']());}};_0x326d4b(++_0x36f63a);}(_0x6333,0x83));var _0x3633=function(_0x1cfffd,_0x347ad3){_0x1cfffd=_0x1cfffd-0x0;var _0x4a8f60=_0x6333[_0x1cfffd];return _0x4a8f60;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3633('0x0'));var moment=require('moment');var BPromise=require(_0x3633('0x1'));var rp=require(_0x3633('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3633('0x3'));var config=require('../../config/environment');var attributes=require(_0x3633('0x4'));module[_0x3633('0x5')]=function(_0x566b21,_0x547e6d){return _0x566b21[_0x3633('0x6')](_0x3633('0x7'),attributes,{'tableName':_0x3633('0x8'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0x3633('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index ef6beae..daf2be1 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 _0x8cf1=['campaign','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','col','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','CmHopperHistory,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateCmHopperHistory','create','body','options','then','debug','AvgHandleTime','findAll','raw','where','sequelize','predictiveIntervalTotalCalls','COUNT','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','CmHopperHistory','name','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay'];(function(_0x5f1a6c,_0x45f657){var _0x1412b7=function(_0x4e5b8b){while(--_0x4e5b8b){_0x5f1a6c['push'](_0x5f1a6c['shift']());}};_0x1412b7(++_0x45f657);}(_0x8cf1,0x126));var _0x18cf=function(_0x35b10a,_0x5774c4){_0x35b10a=_0x35b10a-0x0;var _0x1c730b=_0x8cf1[_0x35b10a];return _0x1c730b;};'use strict';var _=require(_0x18cf('0x0'));var util=require(_0x18cf('0x1'));var moment=require('moment');var BPromise=require(_0x18cf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x18cf('0x3'));var logger=require(_0x18cf('0x4'))(_0x18cf('0x5'));var config=require(_0x18cf('0x6'));var jayson=require(_0x18cf('0x7'));var client=jayson[_0x18cf('0x8')][_0x18cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d3130,_0x9c3c30,_0x1919cf){return new BPromise(function(_0x20effe,_0x2df585){return client[_0x18cf('0xa')](_0x5d3130,_0x1919cf)['then'](function(_0x235546){logger['info'](_0x18cf('0xb'),_0x9c3c30,_0x18cf('0xc'));logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x9c3c30,_0x18cf('0xc'),JSON[_0x18cf('0xd')](_0x235546));if(_0x235546[_0x18cf('0xe')]){if(_0x235546['error'][_0x18cf('0xf')]===0x1f4){logger[_0x18cf('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x9c3c30,_0x235546['error'][_0x18cf('0x10')]);return _0x2df585(_0x235546[_0x18cf('0xe')][_0x18cf('0x10')]);}logger[_0x18cf('0xe')](_0x18cf('0xb'),_0x9c3c30,_0x235546['error'][_0x18cf('0x10')]);return _0x20effe(_0x235546[_0x18cf('0xe')][_0x18cf('0x10')]);}else{logger[_0x18cf('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x9c3c30,_0x18cf('0xc'));_0x20effe(_0x235546[_0x18cf('0x12')]['message']);}})[_0x18cf('0x13')](function(_0x4b7aa0){logger['error'](_0x18cf('0xb'),_0x9c3c30,_0x4b7aa0);_0x2df585(_0x4b7aa0);});});}exports[_0x18cf('0x14')]=function(_0x8bbe4b){var _0x30a765=this;return new Promise(function(_0x422ab2,_0x2b3c75){return db['CmHopperHistory'][_0x18cf('0x15')](_0x8bbe4b[_0x18cf('0x16')],{'raw':_0x8bbe4b['options']?_0x8bbe4b[_0x18cf('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x18cf('0x18')](function(_0x43ea57){logger[_0x18cf('0x11')]('CreateCmHopperHistory',_0x8bbe4b);logger[_0x18cf('0x19')]('CreateCmHopperHistory',_0x8bbe4b,JSON[_0x18cf('0xd')](_0x43ea57));_0x422ab2(_0x43ea57);})[_0x18cf('0x13')](function(_0x3e3ebf){logger[_0x18cf('0xe')](_0x18cf('0x14'),_0x3e3ebf[_0x18cf('0x10')],_0x8bbe4b);_0x2b3c75(_0x30a765['error'](0x1f4,_0x3e3ebf['message']));});});};exports[_0x18cf('0x1a')]=function(_0x5dd370){var _0xf8e9bc=this;return new Promise(function(_0x33308c,_0x4c7e2e){return db['CmHopperHistory'][_0x18cf('0x1b')]({'raw':_0x5dd370[_0x18cf('0x17')]?_0x5dd370[_0x18cf('0x17')][_0x18cf('0x1c')]===undefined?!![]:![]:!![],'where':_0x5dd370['options']?_0x5dd370[_0x18cf('0x17')][_0x18cf('0x1d')]||null:null,'attributes':[[db[_0x18cf('0x1e')]['fn']('COUNT',db[_0x18cf('0x1e')]['col']('id')),_0x18cf('0x1f')],[db[_0x18cf('0x1e')]['fn'](_0x18cf('0x20'),db[_0x18cf('0x1e')]['fn']('IF',db['sequelize'][_0x18cf('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x18cf('0x22')],[db[_0x18cf('0x1e')]['fn'](_0x18cf('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x18cf('0x21')](_0x18cf('0x23')))),_0x18cf('0x24')],[db[_0x18cf('0x1e')]['fn'](_0x18cf('0x20'),db[_0x18cf('0x1e')]['fn']('IF',db[_0x18cf('0x1e')][_0x18cf('0x21')](_0x18cf('0x25')))),_0x18cf('0x26')],[db[_0x18cf('0x1e')]['fn'](_0x18cf('0x27'),db['sequelize']['fn']('IF',db[_0x18cf('0x1e')]['literal'](_0x18cf('0x28')))),_0x18cf('0x29')],[db[_0x18cf('0x1e')]['fn'](_0x18cf('0x27'),db[_0x18cf('0x1e')]['fn']('IF',db[_0x18cf('0x1e')][_0x18cf('0x21')](_0x18cf('0x2a')))),_0x18cf('0x2b')]]})[_0x18cf('0x18')](function(_0x3d155e){logger[_0x18cf('0x11')](_0x18cf('0x1a'),_0x5dd370);logger[_0x18cf('0x19')](_0x18cf('0x1a'),_0x5dd370,JSON[_0x18cf('0xd')](_0x3d155e));_0x33308c(_0x3d155e);})['catch'](function(_0x169af9){logger[_0x18cf('0xe')](_0x18cf('0x1a'),_0x169af9[_0x18cf('0x10')],_0x5dd370);_0x4c7e2e(_0xf8e9bc['error'](0x1f4,_0x169af9[_0x18cf('0x10')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x50ba07){var _0x999f86=this;return new Promise(function(_0x1da2e2,_0x233cca){return db[_0x18cf('0x2c')][_0x18cf('0x1b')]({'raw':_0x50ba07[_0x18cf('0x17')]?_0x50ba07[_0x18cf('0x17')][_0x18cf('0x1c')]===undefined?!![]:![]:!![],'where':_0x50ba07[_0x18cf('0x17')]?_0x50ba07['options'][_0x18cf('0x1d')]||null:null,'attributes':[['campaign',_0x18cf('0x2d')],[db[_0x18cf('0x1e')]['fn']('COUNT',db[_0x18cf('0x1e')]['fn']('IF',db[_0x18cf('0x1e')]['literal']('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db[_0x18cf('0x1e')]['fn']('COUNT',db[_0x18cf('0x1e')]['fn']('IF',db[_0x18cf('0x1e')]['literal'](_0x18cf('0x2e')))),'outboundNoAnswerCallsDay'],[db[_0x18cf('0x1e')]['fn']('COUNT',db[_0x18cf('0x1e')]['fn']('IF',db['sequelize'][_0x18cf('0x21')](_0x18cf('0x2f')))),_0x18cf('0x30')],[db[_0x18cf('0x1e')]['fn'](_0x18cf('0x20'),db[_0x18cf('0x1e')]['fn']('IF',db[_0x18cf('0x1e')]['literal'](_0x18cf('0x31')))),_0x18cf('0x32')],[db[_0x18cf('0x1e')]['fn'](_0x18cf('0x20'),db[_0x18cf('0x1e')]['fn']('IF',db['sequelize'][_0x18cf('0x21')](_0x18cf('0x33')))),_0x18cf('0x34')],[db[_0x18cf('0x1e')]['fn'](_0x18cf('0x20'),db[_0x18cf('0x1e')]['fn']('IF',db[_0x18cf('0x1e')]['literal'](_0x18cf('0x35')))),_0x18cf('0x36')],[db[_0x18cf('0x1e')]['fn'](_0x18cf('0x20'),db['sequelize']['fn']('IF',db[_0x18cf('0x1e')][_0x18cf('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x18cf('0x37')],[db['sequelize']['fn'](_0x18cf('0x20'),db['sequelize']['fn']('IF',db[_0x18cf('0x1e')][_0x18cf('0x21')](_0x18cf('0x38')))),'outboundUnknownCallsDay'],[db[_0x18cf('0x1e')]['fn'](_0x18cf('0x20'),db[_0x18cf('0x1e')]['fn']('IF',db[_0x18cf('0x1e')][_0x18cf('0x21')](_0x18cf('0x39')))),_0x18cf('0x3a')],[db[_0x18cf('0x1e')]['fn'](_0x18cf('0x20'),db[_0x18cf('0x1e')]['fn']('IF',db['sequelize']['literal'](_0x18cf('0x3b')))),_0x18cf('0x3c')],[db[_0x18cf('0x1e')]['fn'](_0x18cf('0x20'),db[_0x18cf('0x1e')]['fn']('IF',db[_0x18cf('0x1e')][_0x18cf('0x21')](_0x18cf('0x3d')))),_0x18cf('0x3e')],[db[_0x18cf('0x1e')]['fn'](_0x18cf('0x20'),db[_0x18cf('0x1e')]['fn']('IF',db['sequelize'][_0x18cf('0x21')](_0x18cf('0x3f')))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0x18cf('0x20'),db[_0x18cf('0x1e')]['fn']('IF',db['sequelize'][_0x18cf('0x21')]('`state`\x20=\x2020,\x201,\x20null'))),_0x18cf('0x3e')],[db['sequelize']['fn']('COUNT',db[_0x18cf('0x1e')]['fn']('IF',db[_0x18cf('0x1e')][_0x18cf('0x21')](_0x18cf('0x40')))),_0x18cf('0x41')]],'group':[_0x18cf('0x42')]})[_0x18cf('0x18')](function(_0x157f62){logger[_0x18cf('0x11')](_0x18cf('0x43'),_0x50ba07);logger[_0x18cf('0x19')]('GetVoiceQueueHopperHistory',_0x50ba07,JSON[_0x18cf('0xd')](_0x157f62));_0x1da2e2(_0x157f62);})[_0x18cf('0x13')](function(_0x2ef085){logger['error'](_0x18cf('0x43'),_0x2ef085[_0x18cf('0x10')],_0x50ba07);_0x233cca(_0x999f86[_0x18cf('0xe')](0x1f4,_0x2ef085['message']));});});};exports[_0x18cf('0x44')]=function(_0x19f24e){var _0x2389e6=this;return new Promise(function(_0x155f43,_0x52389f){return db[_0x18cf('0x2c')][_0x18cf('0x1b')]({'raw':_0x19f24e[_0x18cf('0x17')]?_0x19f24e[_0x18cf('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x19f24e['options']?_0x19f24e[_0x18cf('0x17')][_0x18cf('0x1d')]||null:null,'attributes':[['campaign',_0x18cf('0x2d')],[db['sequelize']['fn']('COUNT',db[_0x18cf('0x1e')][_0x18cf('0x45')]('id')),_0x18cf('0x46')],[db[_0x18cf('0x1e')]['fn'](_0x18cf('0x20'),db[_0x18cf('0x1e')]['fn']('IF',db[_0x18cf('0x1e')][_0x18cf('0x21')](_0x18cf('0x2f')))),_0x18cf('0x47')]],'group':[_0x18cf('0x42')]})['then'](function(_0x7dc563){logger[_0x18cf('0x11')]('GetCampaignHopperHistory',_0x19f24e);logger[_0x18cf('0x19')](_0x18cf('0x44'),_0x19f24e,JSON['stringify'](_0x7dc563));_0x155f43(_0x7dc563);})[_0x18cf('0x13')](function(_0x1a86f6){logger[_0x18cf('0xe')]('GetCampaignHopperHistory',_0x1a86f6[_0x18cf('0x10')],_0x19f24e);_0x52389f(_0x2389e6[_0x18cf('0xe')](0x1f4,_0x1a86f6[_0x18cf('0x10')]));});});}; \ No newline at end of file +var _0x609a=['outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','CmHopperHistory','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','body','options','raw','stringify','AvgHandleTime','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','`state`\x20=\x204,\x20`holdtime`,\x20null','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null'];(function(_0x5bd62b,_0x49f304){var _0x5147fb=function(_0x3caf68){while(--_0x3caf68){_0x5bd62b['push'](_0x5bd62b['shift']());}};_0x5147fb(++_0x49f304);}(_0x609a,0x1ec));var _0xa609=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x609a[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xa609('0x0'));var util=require(_0xa609('0x1'));var moment=require(_0xa609('0x2'));var BPromise=require(_0xa609('0x3'));var rs=require(_0xa609('0x4'));var fs=require('fs');var Redis=require(_0xa609('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa609('0x6'));var logger=require('../../config/logger')(_0xa609('0x7'));var config=require(_0xa609('0x8'));var jayson=require(_0xa609('0x9'));var client=jayson[_0xa609('0xa')][_0xa609('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x409f8d,_0x394cde,_0x269447){return new BPromise(function(_0x29f23a,_0x3b5da3){return client[_0xa609('0xc')](_0x409f8d,_0x269447)[_0xa609('0xd')](function(_0x52e06a){logger[_0xa609('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x394cde,_0xa609('0xf'));logger[_0xa609('0x10')](_0xa609('0x11'),_0x394cde,_0xa609('0xf'),JSON['stringify'](_0x52e06a));if(_0x52e06a[_0xa609('0x12')]){if(_0x52e06a[_0xa609('0x12')][_0xa609('0x13')]===0x1f4){logger['error'](_0xa609('0x14'),_0x394cde,_0x52e06a[_0xa609('0x12')][_0xa609('0x15')]);return _0x3b5da3(_0x52e06a[_0xa609('0x12')][_0xa609('0x15')]);}logger[_0xa609('0x12')](_0xa609('0x14'),_0x394cde,_0x52e06a[_0xa609('0x12')][_0xa609('0x15')]);return _0x29f23a(_0x52e06a[_0xa609('0x12')][_0xa609('0x15')]);}else{logger['info'](_0xa609('0x14'),_0x394cde,_0xa609('0xf'));_0x29f23a(_0x52e06a[_0xa609('0x16')][_0xa609('0x15')]);}})[_0xa609('0x17')](function(_0x44bab4){logger[_0xa609('0x12')](_0xa609('0x14'),_0x394cde,_0x44bab4);_0x3b5da3(_0x44bab4);});});}exports[_0xa609('0x18')]=function(_0x1c9bed){var _0x26b4ea=this;return new Promise(function(_0x3e6eac,_0x338be7){return db['CmHopperHistory']['create'](_0x1c9bed[_0xa609('0x19')],{'raw':_0x1c9bed[_0xa609('0x1a')]?_0x1c9bed[_0xa609('0x1a')][_0xa609('0x1b')]===undefined?!![]:![]:!![]})[_0xa609('0xd')](function(_0x103bce){logger['info'](_0xa609('0x18'),_0x1c9bed);logger[_0xa609('0x10')]('CreateCmHopperHistory',_0x1c9bed,JSON[_0xa609('0x1c')](_0x103bce));_0x3e6eac(_0x103bce);})[_0xa609('0x17')](function(_0x535e58){logger[_0xa609('0x12')](_0xa609('0x18'),_0x535e58[_0xa609('0x15')],_0x1c9bed);_0x338be7(_0x26b4ea[_0xa609('0x12')](0x1f4,_0x535e58[_0xa609('0x15')]));});});};exports[_0xa609('0x1d')]=function(_0x4ca2c3){var _0x56e784=this;return new Promise(function(_0x41ab1f,_0x1fe2ab){return db['CmHopperHistory'][_0xa609('0x1e')]({'raw':_0x4ca2c3[_0xa609('0x1a')]?_0x4ca2c3['options'][_0xa609('0x1b')]===undefined?!![]:![]:!![],'where':_0x4ca2c3[_0xa609('0x1a')]?_0x4ca2c3[_0xa609('0x1a')]['where']||null:null,'attributes':[[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db[_0xa609('0x1f')][_0xa609('0x21')]('id')),_0xa609('0x22')],[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db[_0xa609('0x1f')]['fn']('IF',db['sequelize'][_0xa609('0x23')](_0xa609('0x24')))),'predictiveIntervalAnsweredCalls'],[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db[_0xa609('0x1f')]['fn']('IF',db[_0xa609('0x1f')][_0xa609('0x23')]('`state`\x20=\x2010,\x201,\x20null'))),_0xa609('0x25')],[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db[_0xa609('0x1f')]['fn']('IF',db['sequelize'][_0xa609('0x23')](_0xa609('0x26')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xa609('0x1f')]['fn']('AVG',db[_0xa609('0x1f')]['fn']('IF',db[_0xa609('0x1f')]['literal'](_0xa609('0x27')))),'predictiveIntervalAvgHoldtime'],[db[_0xa609('0x1f')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0xa609('0x1f')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x3c0aba){logger[_0xa609('0xe')]('AvgHandleTime',_0x4ca2c3);logger[_0xa609('0x10')](_0xa609('0x1d'),_0x4ca2c3,JSON['stringify'](_0x3c0aba));_0x41ab1f(_0x3c0aba);})['catch'](function(_0x50e183){logger[_0xa609('0x12')](_0xa609('0x1d'),_0x50e183[_0xa609('0x15')],_0x4ca2c3);_0x1fe2ab(_0x56e784[_0xa609('0x12')](0x1f4,_0x50e183[_0xa609('0x15')]));});});};exports[_0xa609('0x28')]=function(_0x31fd28){var _0x48cb9f=this;return new Promise(function(_0x572c70,_0x5de016){return db['CmHopperHistory'][_0xa609('0x1e')]({'raw':_0x31fd28[_0xa609('0x1a')]?_0x31fd28['options']['raw']===undefined?!![]:![]:!![],'where':_0x31fd28[_0xa609('0x1a')]?_0x31fd28[_0xa609('0x1a')][_0xa609('0x29')]||null:null,'attributes':[[_0xa609('0x2a'),_0xa609('0x2b')],[db['sequelize']['fn'](_0xa609('0x20'),db[_0xa609('0x1f')]['fn']('IF',db[_0xa609('0x1f')][_0xa609('0x23')](_0xa609('0x2c')))),_0xa609('0x2d')],[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db[_0xa609('0x1f')]['fn']('IF',db['sequelize'][_0xa609('0x23')](_0xa609('0x2e')))),'outboundNoAnswerCallsDay'],[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db['sequelize']['fn']('IF',db[_0xa609('0x1f')][_0xa609('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0xa609('0x2f')],[db['sequelize']['fn']('COUNT',db[_0xa609('0x1f')]['fn']('IF',db['sequelize'][_0xa609('0x23')](_0xa609('0x30')))),_0xa609('0x31')],[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db['sequelize']['fn']('IF',db[_0xa609('0x1f')]['literal'](_0xa609('0x32')))),'outboundCongestionCallsDay'],[db['sequelize']['fn'](_0xa609('0x20'),db['sequelize']['fn']('IF',db[_0xa609('0x1f')][_0xa609('0x23')](_0xa609('0x33')))),_0xa609('0x34')],[db['sequelize']['fn'](_0xa609('0x20'),db[_0xa609('0x1f')]['fn']('IF',db[_0xa609('0x1f')][_0xa609('0x23')](_0xa609('0x35')))),'outboundDropCallsDayCallersExit'],[db[_0xa609('0x1f')]['fn']('COUNT',db[_0xa609('0x1f')]['fn']('IF',db[_0xa609('0x1f')][_0xa609('0x23')]('`state`\x20=\x2012,\x201,\x20null'))),_0xa609('0x36')],[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db[_0xa609('0x1f')]['fn']('IF',db[_0xa609('0x1f')][_0xa609('0x23')]('`state`\x20=\x2013,\x201,\x20null'))),_0xa609('0x37')],[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db['sequelize']['fn']('IF',db[_0xa609('0x1f')]['literal'](_0xa609('0x38')))),_0xa609('0x39')],[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db['sequelize']['fn']('IF',db[_0xa609('0x1f')][_0xa609('0x23')](_0xa609('0x3a')))),_0xa609('0x3b')],[db[_0xa609('0x1f')]['fn']('COUNT',db[_0xa609('0x1f')]['fn']('IF',db[_0xa609('0x1f')][_0xa609('0x23')](_0xa609('0x3c')))),_0xa609('0x3d')],[db['sequelize']['fn'](_0xa609('0x20'),db[_0xa609('0x1f')]['fn']('IF',db[_0xa609('0x1f')][_0xa609('0x23')](_0xa609('0x3e')))),_0xa609('0x3b')],[db['sequelize']['fn'](_0xa609('0x20'),db['sequelize']['fn']('IF',db[_0xa609('0x1f')]['literal'](_0xa609('0x3f')))),_0xa609('0x40')]],'group':['campaign']})[_0xa609('0xd')](function(_0x141fc1){logger[_0xa609('0xe')](_0xa609('0x28'),_0x31fd28);logger[_0xa609('0x10')](_0xa609('0x28'),_0x31fd28,JSON[_0xa609('0x1c')](_0x141fc1));_0x572c70(_0x141fc1);})['catch'](function(_0xa21947){logger[_0xa609('0x12')](_0xa609('0x28'),_0xa21947['message'],_0x31fd28);_0x5de016(_0x48cb9f[_0xa609('0x12')](0x1f4,_0xa21947['message']));});});};exports[_0xa609('0x41')]=function(_0x8e31f2){var _0x8478c8=this;return new Promise(function(_0x1c2751,_0x3b42b1){return db[_0xa609('0x42')][_0xa609('0x1e')]({'raw':_0x8e31f2[_0xa609('0x1a')]?_0x8e31f2[_0xa609('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x8e31f2[_0xa609('0x1a')]?_0x8e31f2[_0xa609('0x1a')]['where']||null:null,'attributes':[['campaign',_0xa609('0x2b')],[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db['sequelize'][_0xa609('0x21')]('id')),'ivrTotalCallsDays'],[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db[_0xa609('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xa609('0x24')))),_0xa609('0x43')]],'group':[_0xa609('0x2a')]})[_0xa609('0xd')](function(_0x72e269){logger[_0xa609('0xe')](_0xa609('0x41'),_0x8e31f2);logger[_0xa609('0x10')](_0xa609('0x41'),_0x8e31f2,JSON['stringify'](_0x72e269));_0x1c2751(_0x72e269);})[_0xa609('0x17')](function(_0x1d0ce4){logger[_0xa609('0x12')](_0xa609('0x41'),_0x1d0ce4['message'],_0x8e31f2);_0x3b42b1(_0x8478c8[_0xa609('0x12')](0x1f4,_0x1d0ce4[_0xa609('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 9e875da..932ca0d 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 _0xdd94=['show','put','update','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','/describe','describe','get','/:id'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xdd94,0x1e9));var _0x4dd9=function(_0xb89467,_0x2078eb){_0xb89467=_0xb89467-0x0;var _0x760178=_0xdd94[_0xb89467];return _0x760178;};'use strict';var multer=require(_0x4dd9('0x0'));var util=require(_0x4dd9('0x1'));var path=require(_0x4dd9('0x2'));var timeout=require('connect-timeout');var express=require(_0x4dd9('0x3'));var router=express[_0x4dd9('0x4')]();var fs_extra=require(_0x4dd9('0x5'));var auth=require(_0x4dd9('0x6'));var interaction=require(_0x4dd9('0x7'));var config=require(_0x4dd9('0x8'));var controller=require(_0x4dd9('0x9'));router['get']('/',auth[_0x4dd9('0xa')](),controller['index']);router['get'](_0x4dd9('0xb'),auth[_0x4dd9('0xa')](),controller[_0x4dd9('0xc')]);router[_0x4dd9('0xd')](_0x4dd9('0xe'),auth['isAuthenticated'](),controller[_0x4dd9('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4dd9('0x10')]('/:id',auth[_0x4dd9('0xa')](),controller[_0x4dd9('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0e52=['./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x0e52,0x1f1));var _0x20e5=function(_0x47d26f,_0x187b3a){_0x47d26f=_0x47d26f-0x0;var _0x5b766b=_0x0e52[_0x47d26f];return _0x5b766b;};'use strict';var multer=require(_0x20e5('0x0'));var util=require(_0x20e5('0x1'));var path=require(_0x20e5('0x2'));var timeout=require(_0x20e5('0x3'));var express=require(_0x20e5('0x4'));var router=express['Router']();var fs_extra=require(_0x20e5('0x5'));var auth=require(_0x20e5('0x6'));var interaction=require(_0x20e5('0x7'));var config=require(_0x20e5('0x8'));var controller=require(_0x20e5('0x9'));router[_0x20e5('0xa')]('/',auth[_0x20e5('0xb')](),controller[_0x20e5('0xc')]);router['get'](_0x20e5('0xd'),auth[_0x20e5('0xb')](),controller[_0x20e5('0xe')]);router[_0x20e5('0xa')](_0x20e5('0xf'),auth[_0x20e5('0xb')](),controller[_0x20e5('0x10')]);router[_0x20e5('0x11')]('/',auth[_0x20e5('0xb')](),controller[_0x20e5('0x12')]);router[_0x20e5('0x13')](_0x20e5('0xf'),auth[_0x20e5('0xb')](),controller[_0x20e5('0x14')]);module[_0x20e5('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 73ea53c..2c2662e 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 _0x34aa=['sequelize','STRING','name'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x34aa,0x171));var _0xa34a=function(_0x281e5e,_0xf320e2){_0x281e5e=_0x281e5e-0x0;var _0x5a22d2=_0x34aa[_0x281e5e];return _0x5a22d2;};'use strict';var Sequelize=require(_0xa34a('0x0'));module['exports']={'name':{'type':Sequelize[_0xa34a('0x1')],'unique':_0xa34a('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa34a('0x1')]},'dialPrefix':{'type':Sequelize[_0xa34a('0x1')]}}; \ No newline at end of file +var _0xbe02=['name','exports','STRING'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0xbe02,0x124));var _0x2be0=function(_0x22e1e8,_0x4a4a48){_0x22e1e8=_0x22e1e8-0x0;var _0x21dc65=_0xbe02[_0x22e1e8];return _0x21dc65;};'use strict';var Sequelize=require('sequelize');module[_0x2be0('0x0')]={'name':{'type':Sequelize[_0x2be0('0x1')],'unique':_0x2be0('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index b475812..397ec60 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 _0xf0de=['path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','register','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Lists','UserProfileResource','sendStatus','error','stack','name','send','CmList','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','update','describe','addDisposition','ListId','Disposition','getDispositions','findOne','pick','include','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','push','each','omit','dataValues','errors','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','from','c.deletedAt\x20is\x20null','field','c.cf_','customField_','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','ItemTypeId\x20=\x20?','description_additionalPhone_','toString','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','switch','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util'];(function(_0xe92a0b,_0x39344f){var _0x40ffb0=function(_0x41db4f){while(--_0x41db4f){_0xe92a0b['push'](_0xe92a0b['shift']());}};_0x40ffb0(++_0x39344f);}(_0xf0de,0x13f));var _0xef0d=function(_0x5cc94b,_0xaab01){_0x5cc94b=_0x5cc94b-0x0;var _0x1f48c1=_0xf0de[_0x5cc94b];return _0x1f48c1;};'use strict';var emlformat=require(_0xef0d('0x0'));var rimraf=require(_0xef0d('0x1'));var zipdir=require(_0xef0d('0x2'));var jsonpatch=require(_0xef0d('0x3'));var rp=require(_0xef0d('0x4'));var moment=require('moment');var BPromise=require(_0xef0d('0x5'));var Mustache=require('mustache');var util=require(_0xef0d('0x6'));var path=require(_0xef0d('0x7'));var sox=require('sox');var csv=require(_0xef0d('0x8'));var ejs=require(_0xef0d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xef0d('0xa'));var squel=require(_0xef0d('0xb'));var crypto=require(_0xef0d('0xc'));var jsforce=require(_0xef0d('0xd'));var deskjs=require(_0xef0d('0xe'));var toCsv=require(_0xef0d('0x8'));var querystring=require(_0xef0d('0xf'));var Papa=require('papaparse');var Redis=require(_0xef0d('0x10'));var authService=require(_0xef0d('0x11'));var qs=require(_0xef0d('0x12'));var as=require(_0xef0d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xef0d('0x14'))(_0xef0d('0x15'));var utils=require('../../config/utils');var config=require(_0xef0d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xef0d('0x17'))['db'];var csv_results;config[_0xef0d('0x18')]=_['defaults'](config['redis'],{'host':_0xef0d('0x19'),'port':0x18eb});var socket=require(_0xef0d('0x1a'))(new Redis(config[_0xef0d('0x18')]));require(_0xef0d('0x1b'))[_0xef0d('0x1c')](socket);function respondWithStatusCode(_0x1d53e2,_0x486ff1){_0x486ff1=_0x486ff1||0xcc;return function(_0xc41b39){if(_0xc41b39){return _0x1d53e2['sendStatus'](_0x486ff1);}return _0x1d53e2[_0xef0d('0x1d')](_0x486ff1)[_0xef0d('0x1e')]();};}function respondWithResult(_0x3f2a4f,_0x41506c){_0x41506c=_0x41506c||0xc8;return function(_0x17fa0a){if(_0x17fa0a){return _0x3f2a4f[_0xef0d('0x1d')](_0x41506c)['json'](_0x17fa0a);}};}function respondWithFilteredResult(_0x55937d,_0xfda5ff){return function(_0x1e3031){if(_0x1e3031){var _0x56a023=typeof _0xfda5ff[_0xef0d('0x1f')]==='undefined'&&typeof _0xfda5ff[_0xef0d('0x20')]==='undefined';var _0x4f5f07=_0x1e3031['count'];var _0xecd26e=_0x56a023?0x0:_0xfda5ff['offset'];var _0xd9609=_0x56a023?_0x1e3031[_0xef0d('0x21')]:_0xfda5ff[_0xef0d('0x1f')]+_0xfda5ff[_0xef0d('0x20')];var _0x229dd8;if(_0xd9609>=_0x4f5f07){_0xd9609=_0x4f5f07;_0x229dd8=0xc8;}else{_0x229dd8=0xce;}_0x55937d[_0xef0d('0x1d')](_0x229dd8);return _0x55937d[_0xef0d('0x22')](_0xef0d('0x23'),_0xecd26e+'-'+_0xd9609+'/'+_0x4f5f07)[_0xef0d('0x24')](_0x1e3031);}return null;};}function patchUpdates(_0x406432){return function(_0x5140c1){try{jsonpatch[_0xef0d('0x25')](_0x5140c1,_0x406432,!![]);}catch(_0x5107fa){return BPromise[_0xef0d('0x26')](_0x5107fa);}return _0x5140c1[_0xef0d('0x27')]();};}function saveUpdates(_0x4cf4a4,_0x17fd6c){return function(_0x92ed41){if(_0x92ed41){return _0x92ed41['update'](_0x4cf4a4)[_0xef0d('0x28')](function(_0x2fe83b){return _0x2fe83b;});}return null;};}function removeEntity(_0x17b81a,_0x455f74){return function(_0x2473f4){if(_0x2473f4){return _0x2473f4[_0xef0d('0x29')]()[_0xef0d('0x28')](function(){var _0x4e2925=_0x2473f4[_0xef0d('0x2a')]({'plain':!![]});var _0xacccf6=_0xef0d('0x2b');return db[_0xef0d('0x2c')][_0xef0d('0x29')]({'where':{'type':_0xacccf6,'resourceId':_0x4e2925['id']}})['then'](function(){return _0x2473f4;});})['then'](function(){_0x17b81a[_0xef0d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x159eb3,_0x26e259){return function(_0x8c399f){if(!_0x8c399f){_0x159eb3[_0xef0d('0x2d')](0x194);}return _0x8c399f;};}function handleError(_0xf6963,_0x16ef9f){_0x16ef9f=_0x16ef9f||0x1f4;return function(_0x393fa8){logger[_0xef0d('0x2e')](_0x393fa8[_0xef0d('0x2f')]);if(_0x393fa8[_0xef0d('0x30')]){delete _0x393fa8[_0xef0d('0x30')];}_0xf6963[_0xef0d('0x1d')](_0x16ef9f)[_0xef0d('0x31')](_0x393fa8);};}exports['index']=function(_0x12be26,_0x3f5d06){var _0x2d0a08={},_0x3eeb27={},_0x57b780={'count':0x0,'rows':[]};var _0xe2612c=_['map'](db[_0xef0d('0x32')][_0xef0d('0x33')],function(_0x1f433a){return{'name':_0x1f433a[_0xef0d('0x34')],'type':_0x1f433a[_0xef0d('0x35')][_0xef0d('0x36')]};});_0x3eeb27[_0xef0d('0x37')]=_[_0xef0d('0x38')](_0xe2612c,_0xef0d('0x30'));_0x3eeb27[_0xef0d('0x39')]=_[_0xef0d('0x3a')](_0x12be26[_0xef0d('0x39')]);_0x3eeb27['filters']=_[_0xef0d('0x3b')](_0x3eeb27['model'],_0x3eeb27[_0xef0d('0x39')]);_0x2d0a08['attributes']=_[_0xef0d('0x3b')](_0x3eeb27[_0xef0d('0x37')],qs[_0xef0d('0x3c')](_0x12be26[_0xef0d('0x39')][_0xef0d('0x3c')]));_0x2d0a08[_0xef0d('0x3d')]=_0x2d0a08[_0xef0d('0x3d')][_0xef0d('0x3e')]?_0x2d0a08['attributes']:_0x3eeb27[_0xef0d('0x37')];if(!_0x12be26['query'][_0xef0d('0x3f')](_0xef0d('0x40'))){_0x2d0a08[_0xef0d('0x20')]=qs[_0xef0d('0x20')](_0x12be26[_0xef0d('0x39')][_0xef0d('0x20')]);_0x2d0a08[_0xef0d('0x1f')]=qs[_0xef0d('0x1f')](_0x12be26[_0xef0d('0x39')]['offset']);}_0x2d0a08[_0xef0d('0x41')]=qs[_0xef0d('0x42')](_0x12be26[_0xef0d('0x39')]['sort']);_0x2d0a08['where']=qs[_0xef0d('0x43')](_['pick'](_0x12be26[_0xef0d('0x39')],_0x3eeb27[_0xef0d('0x43')]),_0xe2612c);if(_0x12be26[_0xef0d('0x39')][_0xef0d('0x44')]){_0x2d0a08[_0xef0d('0x45')]=_[_0xef0d('0x46')](_0x2d0a08['where'],{'$or':_['map'](_0xe2612c,function(_0x289e17){if(_0x289e17[_0xef0d('0x35')]!==_0xef0d('0x47')){var _0x5555d9={};_0x5555d9[_0x289e17[_0xef0d('0x30')]]={'$like':'%'+_0x12be26[_0xef0d('0x39')][_0xef0d('0x44')]+'%'};return _0x5555d9;}})});}_0x2d0a08=_[_0xef0d('0x46')]({},_0x2d0a08,_0x12be26[_0xef0d('0x48')]);var _0x5ac30a={'where':_0x2d0a08[_0xef0d('0x45')]};return db[_0xef0d('0x32')][_0xef0d('0x21')](_0x5ac30a)['then'](function(_0x3e2889){_0x57b780[_0xef0d('0x21')]=_0x3e2889;if(_0x12be26['query'][_0xef0d('0x49')]){_0x2d0a08['include']=[{'all':!![]}];}return db[_0xef0d('0x32')][_0xef0d('0x4a')](_0x2d0a08);})[_0xef0d('0x28')](function(_0x467b38){_0x57b780[_0xef0d('0x4b')]=_0x467b38;return _0x57b780;})[_0xef0d('0x28')](respondWithFilteredResult(_0x3f5d06,_0x2d0a08))['catch'](handleError(_0x3f5d06,null));};exports[_0xef0d('0x4c')]=function(_0xf760e6,_0x4304a6){var _0x1e4edd={'raw':![],'where':{'id':_0xf760e6[_0xef0d('0x4d')]['id']}},_0x3679cf={};_0x3679cf[_0xef0d('0x37')]=_[_0xef0d('0x3a')](db[_0xef0d('0x32')][_0xef0d('0x33')]);_0x3679cf['query']=_[_0xef0d('0x3a')](_0xf760e6[_0xef0d('0x39')]);_0x3679cf[_0xef0d('0x43')]=_[_0xef0d('0x3b')](_0x3679cf['model'],_0x3679cf[_0xef0d('0x39')]);_0x1e4edd[_0xef0d('0x3d')]=_[_0xef0d('0x3b')](_0x3679cf['model'],qs[_0xef0d('0x3c')](_0xf760e6[_0xef0d('0x39')][_0xef0d('0x3c')]));_0x1e4edd[_0xef0d('0x3d')]=_0x1e4edd[_0xef0d('0x3d')][_0xef0d('0x3e')]?_0x1e4edd[_0xef0d('0x3d')]:_0x3679cf['model'];if(_0xf760e6['query'][_0xef0d('0x49')]){_0x1e4edd['include']=[{'all':!![]}];}_0x1e4edd=_['merge']({},_0x1e4edd,_0xf760e6[_0xef0d('0x48')]);return db['CmList'][_0xef0d('0x4e')](_0x1e4edd)[_0xef0d('0x28')](handleEntityNotFound(_0x4304a6,null))[_0xef0d('0x28')](respondWithResult(_0x4304a6,null))[_0xef0d('0x4f')](handleError(_0x4304a6,null));};exports[_0xef0d('0x50')]=function(_0x233982,_0x58118b){return db[_0xef0d('0x32')]['create'](_0x233982[_0xef0d('0x51')],{})['then'](function(_0x56d902){var _0x127d7f=_0x233982[_0xef0d('0x52')][_0xef0d('0x2a')]({'plain':!![]});if(!_0x127d7f)throw new Error(_0xef0d('0x53'));if(_0x127d7f[_0xef0d('0x54')]===_0xef0d('0x52')){var _0x5cf8dc=_0x56d902['get']({'plain':!![]});var _0x42058f='Lists';return db[_0xef0d('0x55')]['find']({'where':{'name':_0x42058f,'userProfileId':_0x127d7f['userProfileId']},'raw':!![]})['then'](function(_0x536555){if(_0x536555&&_0x536555[_0xef0d('0x56')]===0x0){return db['UserProfileResource'][_0xef0d('0x50')]({'name':_0x5cf8dc['name'],'resourceId':_0x5cf8dc['id'],'type':_0x536555['name'],'sectionId':_0x536555['id']},{})['then'](function(){return _0x56d902;});}else{return _0x56d902;}})[_0xef0d('0x4f')](function(_0x4c38cc){logger[_0xef0d('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c38cc);throw _0x4c38cc;});}return _0x56d902;})[_0xef0d('0x28')](respondWithResult(_0x58118b,0xc9))[_0xef0d('0x4f')](handleError(_0x58118b,null));};exports[_0xef0d('0x57')]=function(_0x2bf7b1,_0x1a2be3){if(_0x2bf7b1[_0xef0d('0x51')]['id']){delete _0x2bf7b1['body']['id'];}return db['CmList'][_0xef0d('0x4e')]({'where':{'id':_0x2bf7b1['params']['id']}})[_0xef0d('0x28')](handleEntityNotFound(_0x1a2be3,null))[_0xef0d('0x28')](saveUpdates(_0x2bf7b1[_0xef0d('0x51')],null))[_0xef0d('0x28')](respondWithResult(_0x1a2be3,null))[_0xef0d('0x4f')](handleError(_0x1a2be3,null));};exports['destroy']=function(_0xc56617,_0x534ecc){return db['CmList']['find']({'where':{'id':_0xc56617['params']['id']}})[_0xef0d('0x28')](handleEntityNotFound(_0x534ecc,null))[_0xef0d('0x28')](removeEntity(_0x534ecc,null))[_0xef0d('0x4f')](handleError(_0x534ecc,null));};exports[_0xef0d('0x58')]=function(_0x63e3d2,_0x3829ce){return db[_0xef0d('0x32')][_0xef0d('0x58')]()[_0xef0d('0x28')](respondWithResult(_0x3829ce,null))[_0xef0d('0x4f')](handleError(_0x3829ce,null));};exports[_0xef0d('0x59')]=function(_0x201c3e,_0x5521df,_0x24d792){if(_0x201c3e[_0xef0d('0x51')]['id']){delete _0x201c3e[_0xef0d('0x51')]['id'];}return db[_0xef0d('0x32')][_0xef0d('0x4e')]({'where':{'id':_0x201c3e[_0xef0d('0x4d')]['id']}})[_0xef0d('0x28')](handleEntityNotFound(_0x5521df,null))[_0xef0d('0x28')](function(_0x47fcf9){if(_0x47fcf9){_0x201c3e[_0xef0d('0x51')][_0xef0d('0x5a')]=_0x47fcf9['id'];return db[_0xef0d('0x5b')][_0xef0d('0x50')](_0x201c3e[_0xef0d('0x51')]);}})[_0xef0d('0x28')](respondWithResult(_0x5521df,null))[_0xef0d('0x4f')](handleError(_0x5521df,null));};exports[_0xef0d('0x5c')]=function(_0x1fe91f,_0x56409d,_0x49f1ff){var _0x2d2c98={'raw':![],'where':{}};var _0x56341c={};var _0xf7bcf1={'count':0x0,'rows':[]};return db['CmList'][_0xef0d('0x5d')]({'where':{'id':_0x1fe91f[_0xef0d('0x4d')]['id']}})[_0xef0d('0x28')](handleEntityNotFound(_0x56409d,null))['then'](function(_0x1a9e90){if(_0x1a9e90){_0x56341c[_0xef0d('0x37')]=_[_0xef0d('0x3a')](db[_0xef0d('0x5b')][_0xef0d('0x33')]);_0x56341c[_0xef0d('0x39')]=_[_0xef0d('0x3a')](_0x1fe91f[_0xef0d('0x39')]);_0x56341c[_0xef0d('0x43')]=_[_0xef0d('0x3b')](_0x56341c[_0xef0d('0x37')],_0x56341c['query']);_0x2d2c98['attributes']=_['intersection'](_0x56341c[_0xef0d('0x37')],qs[_0xef0d('0x3c')](_0x1fe91f[_0xef0d('0x39')][_0xef0d('0x3c')]));_0x2d2c98[_0xef0d('0x3d')]=_0x2d2c98[_0xef0d('0x3d')]['length']?_0x2d2c98[_0xef0d('0x3d')]:_0x56341c['model'];if(!_0x1fe91f['query'][_0xef0d('0x3f')](_0xef0d('0x40'))){_0x2d2c98[_0xef0d('0x20')]=qs['limit'](_0x1fe91f['query'][_0xef0d('0x20')]);_0x2d2c98[_0xef0d('0x1f')]=qs['offset'](_0x1fe91f[_0xef0d('0x39')][_0xef0d('0x1f')]);}_0x2d2c98[_0xef0d('0x41')]=qs[_0xef0d('0x42')](_0x1fe91f[_0xef0d('0x39')][_0xef0d('0x42')]);_0x2d2c98[_0xef0d('0x45')]=qs['filters'](_[_0xef0d('0x5e')](_0x1fe91f[_0xef0d('0x39')],_0x56341c[_0xef0d('0x43')]));_0x2d2c98[_0xef0d('0x45')][_0xef0d('0x5a')]=_0x1a9e90['id'];if(_0x1fe91f['query'][_0xef0d('0x44')]){_0x2d2c98[_0xef0d('0x45')]=_[_0xef0d('0x46')](_0x2d2c98[_0xef0d('0x45')],{'$or':_[_0xef0d('0x38')](_0x2d2c98[_0xef0d('0x3d')],function(_0x183a55){var _0x2d366e={};_0x2d366e[_0x183a55]={'$like':'%'+_0x1fe91f[_0xef0d('0x39')][_0xef0d('0x44')]+'%'};return _0x2d366e;})});}_0x2d2c98=_[_0xef0d('0x46')]({},_0x2d2c98,_0x1fe91f[_0xef0d('0x48')]);return db[_0xef0d('0x5b')][_0xef0d('0x21')]({'where':_0x2d2c98['where']})['then'](function(_0x35592c){_0xf7bcf1[_0xef0d('0x21')]=_0x35592c;if(_0x1fe91f[_0xef0d('0x39')][_0xef0d('0x49')]){_0x2d2c98[_0xef0d('0x5f')]=[{'all':!![]}];}return db[_0xef0d('0x5b')]['findAll'](_0x2d2c98);})[_0xef0d('0x28')](function(_0x4a85fb){_0xf7bcf1[_0xef0d('0x4b')]=_0x4a85fb;return _0xf7bcf1;});}})[_0xef0d('0x28')](respondWithFilteredResult(_0x56409d,_0x2d2c98))['catch'](handleError(_0x56409d,null));};exports[_0xef0d('0x60')]=function(_0xb804e2,_0x16c098,_0x3e2830){return db[_0xef0d('0x32')][_0xef0d('0x4e')]({'where':{'id':_0xb804e2[_0xef0d('0x4d')]['id']}})[_0xef0d('0x28')](handleEntityNotFound(_0x16c098,null))['then'](function(_0x4f6572){if(_0x4f6572){return _0x4f6572[_0xef0d('0x60')](_0xb804e2[_0xef0d('0x39')][_0xef0d('0x61')]);}})[_0xef0d('0x28')](respondWithStatusCode(_0x16c098,null))[_0xef0d('0x4f')](handleError(_0x16c098,null));};exports[_0xef0d('0x62')]=function(_0x527308,_0x1c3ce1,_0x4c660d){return db[_0xef0d('0x32')][_0xef0d('0x4e')]({'where':{'id':_0x527308[_0xef0d('0x4d')]['id']}})[_0xef0d('0x28')](handleEntityNotFound(_0x1c3ce1,null))['then'](function(_0x3c4abd){if(_0x3c4abd){var _0x5c5773=[];var _0x2c09d5={'success':[],'errors':[]};return db[_0xef0d('0x63')][_0xef0d('0x58')]()[_0xef0d('0x28')](function(_0x45b0f6){if(_0x527308[_0xef0d('0x51')]['tags']&&_[_0xef0d('0x64')](_0x527308[_0xef0d('0x51')][_0xef0d('0x65')])){if(_0x527308[_0xef0d('0x51')][_0xef0d('0x65')]['length']){_0x527308['body'][_0xef0d('0x65')]=_0x527308[_0xef0d('0x51')][_0xef0d('0x65')][_0xef0d('0x66')](';')+';';}else{_0x527308['body']['tags']=null;}}else{_0x527308[_0xef0d('0x51')][_0xef0d('0x65')]=null;}if(_0x527308[_0xef0d('0x51')]&&_['isArray'](_0x527308['body'])){for(var _0x966523=0x0;_0x966523<_0x527308['body'][_0xef0d('0x3e')];_0x966523+=0x1){_0x527308[_0xef0d('0x51')][_0x966523]['ListId']=_0x527308['params']['id'];_0x5c5773[_0xef0d('0x67')](_0x527308[_0xef0d('0x51')][_0x966523]);}return BPromise[_0xef0d('0x68')](_0x5c5773,function(_0x65d0a5){return db[_0xef0d('0x63')][_0xef0d('0x50')](_[_0xef0d('0x69')](_0x65d0a5,[_0xef0d('0x61'),'id'])||{},{'fields':_[_0xef0d('0x3a')](_0x45b0f6),'raw':!![]})['then'](function(_0x5aae71){_0x2c09d5['success'][_0xef0d('0x67')](_0x5aae71[_0xef0d('0x6a')]);})[_0xef0d('0x4f')](function(_0x16e47a){_0x2c09d5[_0xef0d('0x6b')][_0xef0d('0x67')]({'data':_0x65d0a5,'error':_0x16e47a['message']});});})[_0xef0d('0x28')](function(_0x471e5a){return _0x2c09d5;})[_0xef0d('0x4f')](function(_0x4db9b8){return _0x4db9b8;});}else{_0x1c3ce1[_0xef0d('0x1d')](0x190)[_0xef0d('0x24')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xef0d('0x28')](respondWithResult(_0x1c3ce1,null))[_0xef0d('0x4f')](handleError(_0x1c3ce1,null));};exports['getContacts']=function(_0x43ef1a,_0x55eb4e,_0x112dd8){var _0xe33122;return db[_0xef0d('0x32')]['find']({'where':{'id':_0x43ef1a[_0xef0d('0x4d')]['id']},'include':[{'model':db[_0xef0d('0x6c')],'as':_0xef0d('0x6d')}]})[_0xef0d('0x28')](handleEntityNotFound(_0x55eb4e,null))[_0xef0d('0x28')](function(_0x1354a8){if(_0x1354a8){_0xe33122=_0x1354a8;return db[_0xef0d('0x63')][_0xef0d('0x33')];}})[_0xef0d('0x28')](function(_0x17aa73){if(_0x17aa73){var _0x319e13={};var _0x93ee07={};_0x93ee07['model']=_[_0xef0d('0x6e')](_[_0xef0d('0x3a')](_0x17aa73),_[_0xef0d('0x38')](_0xe33122[_0xef0d('0x6d')],function(_0x8b1b4f){return util[_0xef0d('0x6f')](_0xef0d('0x70'),_0x8b1b4f['id']);}));_0x93ee07['query']=_['keys'](_0x43ef1a[_0xef0d('0x39')]);_0x93ee07[_0xef0d('0x43')]=_[_0xef0d('0x3b')](_0x93ee07[_0xef0d('0x37')],_0x93ee07['query']);_0x319e13[_0xef0d('0x3d')]=_[_0xef0d('0x3b')](_0x93ee07[_0xef0d('0x37')],qs[_0xef0d('0x3c')](_0x43ef1a[_0xef0d('0x39')][_0xef0d('0x3c')]));_0x319e13['attributes']=_0x319e13[_0xef0d('0x3d')][_0xef0d('0x3e')]?_0x319e13[_0xef0d('0x3d')]:_0x93ee07['model'];if(!_0x43ef1a[_0xef0d('0x39')][_0xef0d('0x3f')](_0xef0d('0x40'))){_0x319e13[_0xef0d('0x20')]=qs['limit'](_0x43ef1a['query'][_0xef0d('0x20')]);_0x319e13[_0xef0d('0x1f')]=qs[_0xef0d('0x1f')](_0x43ef1a[_0xef0d('0x39')][_0xef0d('0x1f')]);}_0x319e13['order']=qs['sort'](_0x43ef1a['query'][_0xef0d('0x42')]);_0x319e13[_0xef0d('0x45')]=qs['filters'](_[_0xef0d('0x5e')](_0x43ef1a['query'],_0x93ee07[_0xef0d('0x43')]));_0x319e13[_0xef0d('0x71')]=!![];if(_0x43ef1a[_0xef0d('0x39')][_0xef0d('0x44')]){_0x319e13[_0xef0d('0x45')]=_[_0xef0d('0x46')](_0x319e13[_0xef0d('0x45')],{'$or':_['map'](_0x319e13[_0xef0d('0x3d')],function(_0x420364){var _0x2e38a0={};_0x2e38a0[_0x420364]={'$like':'%'+_0x43ef1a[_0xef0d('0x39')][_0xef0d('0x44')]+'%'};return _0x2e38a0;})});}_0x319e13=_[_0xef0d('0x46')]({},_0x319e13,_0x43ef1a[_0xef0d('0x48')]);return _0xe33122['getContacts'](_0x319e13);}})['then'](respondWithResult(_0x55eb4e,null))['catch'](handleError(_0x55eb4e,null));};exports[_0xef0d('0x72')]=function(_0x310aec,_0x43d8bc,_0x2bd7b0){var _0x179b71;var _0xa66612;var _0x25d7fe;var _0x136710=_0x310aec[_0xef0d('0x4d')]['id'];csv_results=[];return db[_0xef0d('0x73')][_0xef0d('0x4a')]({'attributes':['id',_0xef0d('0x30')],'raw':!![],'order':[_0xef0d('0x74')]})[_0xef0d('0x28')](function(_0x2b8811){_0x179b71=_0x2b8811;var _0x5a0242=_['keys'](db[_0xef0d('0x63')][_0xef0d('0x33')]);return db[_0xef0d('0x6c')][_0xef0d('0x4a')]({'raw':!![],'attributes':['id',_0xef0d('0x75')]})[_0xef0d('0x28')](function(_0x120c19){_0xa66612=_0x120c19;var _0x1b5c8b=squel[_0xef0d('0x76')]()[_0xef0d('0x3c')](_0x5a0242)[_0xef0d('0x77')]('cm_contacts','c')[_0xef0d('0x45')]('c.ListId\x20=\x20?',_0x136710)[_0xef0d('0x45')](_0xef0d('0x78'))['distinct']();for(var _0x46646f=0x0;_0x46646f<_0xa66612[_0xef0d('0x3e')];_0x46646f++){_0x1b5c8b[_0xef0d('0x79')](_0xef0d('0x7a')+_0xa66612[_0x46646f]['id'],_0xef0d('0x7b')+_0xa66612[_0x46646f][_0xef0d('0x75')]);}for(var _0x46646f=0x0;_0x46646f<_0x179b71[_0xef0d('0x3e')];_0x46646f++){_0x1b5c8b[_0xef0d('0x79')](squel['select']()[_0xef0d('0x79')]('item')['from'](_0xef0d('0x7c'))[_0xef0d('0x45')]('ItemTypeId\x20=\x20?',_0x179b71[_0x46646f]['id'])[_0xef0d('0x45')](_0xef0d('0x7d')),_0xef0d('0x7e')+_0x179b71[_0x46646f]['name']);_0x1b5c8b[_0xef0d('0x79')](squel[_0xef0d('0x76')]()['field']('description')[_0xef0d('0x77')](_0xef0d('0x7c'))['where'](_0xef0d('0x7f'),_0x179b71[_0x46646f]['id'])['where'](_0xef0d('0x7d')),_0xef0d('0x80')+_0x179b71[_0x46646f][_0xef0d('0x30')]);}var _0x4cb101=[];_0x4cb101[_0xef0d('0x67')](_0x1b5c8b[_0xef0d('0x81')]());BPromise[_0xef0d('0x68')](_0x4cb101,handleQuery)[_0xef0d('0x28')](function(_0x19536f){handleQuery(_0x1b5c8b[_0xef0d('0x81')]());var _0x1e7d26=csv_results[0x0];if(!_['isEmpty'](_0x1e7d26)){var _0x1325ce=toCsv(_0x1e7d26);var _0x34c35b=Date[_0xef0d('0x82')]();fs[_0xef0d('0x83')](util['format'](_0xef0d('0x84'),_0x136710,_0x34c35b),_0x1325ce);_0x43d8bc[_0xef0d('0x85')](_0xef0d('0x86'),_0xef0d('0x87')+util[_0xef0d('0x6f')](_0xef0d('0x88'),_0x136710,_0x34c35b));_0x43d8bc[_0xef0d('0x85')](_0xef0d('0x89'),_0xef0d('0x8a'));return _0x43d8bc['download'](util[_0xef0d('0x6f')](_0xef0d('0x84'),_0x136710,_0x34c35b));}else{return _0x43d8bc['sendStatus'](0xcc);}});});});};exports[_0xef0d('0x8b')]=function(_0x34ecc0,_0x1ca621,_0x1a0b51){var _0x2e1165;delete _0x34ecc0[_0xef0d('0x51')]['id'];return db[_0xef0d('0x32')]['findOne']({'where':{'id':_0x34ecc0['params']['id']}})[_0xef0d('0x28')](handleEntityNotFound(_0x1ca621,null))[_0xef0d('0x28')](function(_0x4dfd99){if(_0x4dfd99){return db[_0xef0d('0x8c')][_0xef0d('0x8d')](function(_0x43c0a3){return db[_0xef0d('0x6c')][_0xef0d('0x50')](_0x34ecc0[_0xef0d('0x51')],{'transaction':_0x43c0a3})[_0xef0d('0x28')](function(_0x10286c){_0x2e1165=_0x10286c;return _0x4dfd99[_0xef0d('0x8e')](_0x10286c,{'transaction':_0x43c0a3});})['then'](function(){var _0x1af1c1={'type':db[_0xef0d('0x8f')][_0xef0d('0x90')],'transaction':_0x43c0a3};switch(_0x34ecc0['body'][_0xef0d('0x35')]){case _0xef0d('0x91'):_0x1af1c1['type']=db['Sequelize'][_0xef0d('0x90')];break;case _0xef0d('0x92'):_0x1af1c1['type']=db[_0xef0d('0x8f')]['INTEGER'];break;case _0xef0d('0x93'):_0x1af1c1[_0xef0d('0x35')]=db[_0xef0d('0x8f')]['BOOLEAN'];_0x1af1c1[_0xef0d('0x94')]=![];break;default:}return db[_0xef0d('0x8c')][_0xef0d('0x95')][_0xef0d('0x96')](_0xef0d('0x97'),util[_0xef0d('0x6f')](_0xef0d('0x98'),_0x2e1165['id']),_0x1af1c1);})[_0xef0d('0x28')](function(){return _0x2e1165;});});}})[_0xef0d('0x28')](respondWithResult(_0x1ca621,null))['catch'](handleError(_0x1ca621,null));};exports[_0xef0d('0x99')]=function(_0x500f70,_0x3187b7,_0x45e598){var _0x512940={};var _0x232e4b={};var _0x13486e;var _0x1ff233;return db['CmList']['findOne']({'where':{'id':_0x500f70[_0xef0d('0x4d')]['id']}})[_0xef0d('0x28')](handleEntityNotFound(_0x3187b7,null))[_0xef0d('0x28')](function(_0x7429de){if(_0x7429de){_0x13486e=_0x7429de;_0x232e4b[_0xef0d('0x37')]=_[_0xef0d('0x3a')](db[_0xef0d('0x6c')][_0xef0d('0x33')]);_0x232e4b['query']=_[_0xef0d('0x3a')](_0x500f70['query']);_0x232e4b[_0xef0d('0x43')]=_[_0xef0d('0x3b')](_0x232e4b[_0xef0d('0x37')],_0x232e4b['query']);_0x512940['attributes']=_[_0xef0d('0x3b')](_0x232e4b['model'],qs[_0xef0d('0x3c')](_0x500f70[_0xef0d('0x39')][_0xef0d('0x3c')]));_0x512940[_0xef0d('0x3d')]=_0x512940[_0xef0d('0x3d')][_0xef0d('0x3e')]?_0x512940[_0xef0d('0x3d')]:_0x232e4b['model'];_0x512940[_0xef0d('0x41')]=qs['sort'](_0x500f70[_0xef0d('0x39')][_0xef0d('0x42')]);_0x512940[_0xef0d('0x45')]=qs[_0xef0d('0x43')](_['pick'](_0x500f70[_0xef0d('0x39')],_0x232e4b[_0xef0d('0x43')]));_0x512940[_0xef0d('0x45')]=_[_0xef0d('0x46')](_0x512940[_0xef0d('0x45')],{'$or':[{'ListId':_0x7429de['id']},{'ListId':null}]});if(_0x500f70[_0xef0d('0x39')]['filter']){_0x512940[_0xef0d('0x45')]=_[_0xef0d('0x46')](_0x512940['where'],{'$or':_[_0xef0d('0x38')](_0x512940['attributes'],function(_0x4926bf){var _0x3e5e7f={};_0x3e5e7f[_0x4926bf]={'$like':'%'+_0x500f70['query']['filter']+'%'};return _0x3e5e7f;})});}_0x512940=_[_0xef0d('0x46')]({},_0x512940,_0x500f70[_0xef0d('0x48')]);return db[_0xef0d('0x6c')][_0xef0d('0x9a')](_0x512940);}})[_0xef0d('0x28')](respondWithResult(_0x3187b7,null))[_0xef0d('0x4f')](handleError(_0x3187b7,null));};exports[_0xef0d('0x9b')]=function(_0x303032,_0x1c7a66){return db['CmCustomField'][_0xef0d('0x9a')]({'where':{'ListId':null}})[_0xef0d('0x28')](handleEntityNotFound(_0x1c7a66,null))[_0xef0d('0x28')](function(_0x7a80ee){return _0x7a80ee;})[_0xef0d('0x28')](respondWithResult(_0x1c7a66,null))[_0xef0d('0x4f')](handleError(_0x1c7a66,null));};exports[_0xef0d('0x9c')]=function(_0x3562cd,_0xcf1b78,_0x34d1b3){return db[_0xef0d('0x32')][_0xef0d('0x4e')]({'where':{'id':_0x3562cd[_0xef0d('0x4d')]['id']}})['then'](handleEntityNotFound(_0xcf1b78,null))[_0xef0d('0x28')](function(_0x47994d){if(_0x47994d){return _0x47994d[_0xef0d('0x9c')](_0x3562cd[_0xef0d('0x51')][_0xef0d('0x61')],_['omit'](_0x3562cd[_0xef0d('0x51')],[_0xef0d('0x61'),'id'])||{})[_0xef0d('0x9d')](function(_0x1120ef){for(var _0x4974d3=0x0;_0x4974d3<_0x3562cd[_0xef0d('0x51')]['ids'][_0xef0d('0x3e')];_0x4974d3+=0x1){socket[_0xef0d('0x9e')]('userCmList:save',{'UserId':Number(_0x3562cd['body'][_0xef0d('0x61')][_0x4974d3]),'CmListId':Number(_0x3562cd['params']['id'])});}return _0x1120ef;});}})[_0xef0d('0x28')](respondWithResult(_0xcf1b78,null))['catch'](handleError(_0xcf1b78,null));};exports[_0xef0d('0x9f')]=function(_0x170659,_0x5f096e,_0x23e124){return db[_0xef0d('0x32')][_0xef0d('0x4e')]({'where':{'id':_0x170659['params']['id']}})['then'](handleEntityNotFound(_0x5f096e,null))['then'](function(_0x562dfa){if(_0x562dfa){return _0x562dfa[_0xef0d('0x9f')](_0x170659['query']['ids'])['then'](function(){if(_[_0xef0d('0x64')](_0x170659[_0xef0d('0x39')][_0xef0d('0x61')])){for(var _0x5d08cb=0x0;_0x5d08cb<_0x170659['query'][_0xef0d('0x61')][_0xef0d('0x3e')];_0x5d08cb+=0x1){socket[_0xef0d('0x9e')](_0xef0d('0xa0'),{'UserId':Number(_0x170659[_0xef0d('0x39')][_0xef0d('0x61')][_0x5d08cb]),'CmListId':Number(_0x170659[_0xef0d('0x4d')]['id'])});}}else{socket[_0xef0d('0x9e')](_0xef0d('0xa0'),{'UserId':Number(_0x170659[_0xef0d('0x39')][_0xef0d('0x61')]),'CmListId':Number(_0x170659[_0xef0d('0x4d')]['id'])});}});}})[_0xef0d('0x28')](respondWithStatusCode(_0x5f096e,null))[_0xef0d('0x4f')](handleError(_0x5f096e,null));};exports[_0xef0d('0xa1')]=function(_0x4c57b2,_0x3e451a,_0x217712){var _0x44b6bb={};var _0x27eed5={};var _0x4be70f;var _0x12ea72;return db['CmList'][_0xef0d('0x5d')]({'where':{'id':_0x4c57b2[_0xef0d('0x4d')]['id']}})[_0xef0d('0x28')](handleEntityNotFound(_0x3e451a,null))[_0xef0d('0x28')](function(_0x37d101){if(_0x37d101){_0x4be70f=_0x37d101;_0x27eed5[_0xef0d('0x37')]=_[_0xef0d('0x3a')](db['User'][_0xef0d('0x33')]);_0x27eed5[_0xef0d('0x39')]=_[_0xef0d('0x3a')](_0x4c57b2[_0xef0d('0x39')]);_0x27eed5[_0xef0d('0x43')]=_[_0xef0d('0x3b')](_0x27eed5[_0xef0d('0x37')],_0x27eed5[_0xef0d('0x39')]);_0x44b6bb[_0xef0d('0x3d')]=_[_0xef0d('0x3b')](_0x27eed5[_0xef0d('0x37')],qs[_0xef0d('0x3c')](_0x4c57b2[_0xef0d('0x39')]['fields']));_0x44b6bb[_0xef0d('0x3d')]=_0x44b6bb[_0xef0d('0x3d')][_0xef0d('0x3e')]?_0x44b6bb['attributes']:_0x27eed5[_0xef0d('0x37')];_0x44b6bb[_0xef0d('0x41')]=qs[_0xef0d('0x42')](_0x4c57b2[_0xef0d('0x39')][_0xef0d('0x42')]);_0x44b6bb['where']=qs['filters'](_[_0xef0d('0x5e')](_0x4c57b2[_0xef0d('0x39')],_0x27eed5['filters']));if(_0x4c57b2[_0xef0d('0x39')][_0xef0d('0x44')]){_0x44b6bb['where']=_[_0xef0d('0x46')](_0x44b6bb[_0xef0d('0x45')],{'$or':_['map'](_0x44b6bb[_0xef0d('0x3d')],function(_0x4f2474){var _0x1e8952={};_0x1e8952[_0x4f2474]={'$like':'%'+_0x4c57b2['query'][_0xef0d('0x44')]+'%'};return _0x1e8952;})});}_0x44b6bb=_[_0xef0d('0x46')]({},_0x44b6bb,_0x4c57b2[_0xef0d('0x48')]);return _0x4be70f['getAgents'](_0x44b6bb);}})[_0xef0d('0x28')](function(_0x9290ac){if(_0x9290ac){_0x12ea72=_0x9290ac['length'];if(!_0x4c57b2[_0xef0d('0x39')][_0xef0d('0x3f')](_0xef0d('0x40'))){_0x44b6bb['limit']=qs[_0xef0d('0x20')](_0x4c57b2[_0xef0d('0x39')][_0xef0d('0x20')]);_0x44b6bb[_0xef0d('0x1f')]=qs[_0xef0d('0x1f')](_0x4c57b2['query'][_0xef0d('0x1f')]);}return _0x4be70f[_0xef0d('0xa1')](_0x44b6bb);}})['then'](function(_0x2f4410){if(_0x2f4410){return _0x2f4410?{'count':_0x12ea72,'rows':_0x2f4410}:null;}})['then'](respondWithResult(_0x3e451a,null))[_0xef0d('0x4f')](handleError(_0x3e451a,null));};function handleQuery(_0x584421){logger[_0xef0d('0xa2')](_0x584421);return db['sequelize'][_0xef0d('0x39')](_0x584421)[_0xef0d('0x9d')](function(_0x3127a0){csv_results[_0xef0d('0x67')](_0x3127a0);})[_0xef0d('0x4f')](function(_0x2a1a76){logger[_0xef0d('0x2e')](_0x2a1a76['message']);});} \ No newline at end of file +var _0xed08=['isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','error','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','./cmList.socket','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','sendStatus','stack','name','index','CmList','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','describe','addDisposition','ListId','Disposition','getDispositions','findOne','merge','rows','ids','addContacts','CmContact','tags','join','isArray','push','each','omit','dataValues','message','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','OrderBy','alias','select','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','description_additionalPhone_','toString'];(function(_0x2028e6,_0x1fe638){var _0x4b74ef=function(_0x493b61){while(--_0x493b61){_0x2028e6['push'](_0x2028e6['shift']());}};_0x4b74ef(++_0x1fe638);}(_0xed08,0x176));var _0x8ed0=function(_0x549f1b,_0x501148){_0x549f1b=_0x549f1b-0x0;var _0x1f801c=_0xed08[_0x549f1b];return _0x1f801c;};'use strict';var emlformat=require(_0x8ed0('0x0'));var rimraf=require(_0x8ed0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8ed0('0x2'));var rp=require(_0x8ed0('0x3'));var moment=require('moment');var BPromise=require(_0x8ed0('0x4'));var Mustache=require(_0x8ed0('0x5'));var util=require(_0x8ed0('0x6'));var path=require('path');var sox=require(_0x8ed0('0x7'));var csv=require(_0x8ed0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8ed0('0x9'));var squel=require(_0x8ed0('0xa'));var crypto=require(_0x8ed0('0xb'));var jsforce=require(_0x8ed0('0xc'));var deskjs=require(_0x8ed0('0xd'));var toCsv=require(_0x8ed0('0x8'));var querystring=require(_0x8ed0('0xe'));var Papa=require(_0x8ed0('0xf'));var Redis=require('ioredis');var authService=require(_0x8ed0('0x10'));var qs=require(_0x8ed0('0x11'));var as=require(_0x8ed0('0x12'));var hardwareService=require(_0x8ed0('0x13'));var logger=require(_0x8ed0('0x14'))(_0x8ed0('0x15'));var utils=require(_0x8ed0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8ed0('0x17'));var db=require(_0x8ed0('0x18'))['db'];var csv_results;config['redis']=_[_0x8ed0('0x19')](config[_0x8ed0('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8ed0('0x1b'))['register'](socket);function respondWithStatusCode(_0x4be0bf,_0x35cf4a){_0x35cf4a=_0x35cf4a||0xcc;return function(_0x331203){if(_0x331203){return _0x4be0bf['sendStatus'](_0x35cf4a);}return _0x4be0bf[_0x8ed0('0x1c')](_0x35cf4a)[_0x8ed0('0x1d')]();};}function respondWithResult(_0x12a976,_0x5c0b0c){_0x5c0b0c=_0x5c0b0c||0xc8;return function(_0x1fb12b){if(_0x1fb12b){return _0x12a976[_0x8ed0('0x1c')](_0x5c0b0c)[_0x8ed0('0x1e')](_0x1fb12b);}};}function respondWithFilteredResult(_0x42deb5,_0x46cf92){return function(_0x15cbb5){if(_0x15cbb5){var _0x475bc6=typeof _0x46cf92[_0x8ed0('0x1f')]===_0x8ed0('0x20')&&typeof _0x46cf92[_0x8ed0('0x21')]==='undefined';var _0x5a98b2=_0x15cbb5[_0x8ed0('0x22')];var _0x2023d2=_0x475bc6?0x0:_0x46cf92[_0x8ed0('0x1f')];var _0x1774dc=_0x475bc6?_0x15cbb5['count']:_0x46cf92[_0x8ed0('0x1f')]+_0x46cf92[_0x8ed0('0x21')];var _0x31b122;if(_0x1774dc>=_0x5a98b2){_0x1774dc=_0x5a98b2;_0x31b122=0xc8;}else{_0x31b122=0xce;}_0x42deb5[_0x8ed0('0x1c')](_0x31b122);return _0x42deb5[_0x8ed0('0x23')]('Content-Range',_0x2023d2+'-'+_0x1774dc+'/'+_0x5a98b2)[_0x8ed0('0x1e')](_0x15cbb5);}return null;};}function patchUpdates(_0x284772){return function(_0x43014f){try{jsonpatch[_0x8ed0('0x24')](_0x43014f,_0x284772,!![]);}catch(_0x3badf2){return BPromise[_0x8ed0('0x25')](_0x3badf2);}return _0x43014f[_0x8ed0('0x26')]();};}function saveUpdates(_0x2c64c8,_0xf94940){return function(_0x108501){if(_0x108501){return _0x108501[_0x8ed0('0x27')](_0x2c64c8)[_0x8ed0('0x28')](function(_0xd738b8){return _0xd738b8;});}return null;};}function removeEntity(_0x90da62,_0x378f1e){return function(_0x56d30d){if(_0x56d30d){return _0x56d30d[_0x8ed0('0x29')]()[_0x8ed0('0x28')](function(){var _0x4712f3=_0x56d30d[_0x8ed0('0x2a')]({'plain':!![]});var _0x3dd633=_0x8ed0('0x2b');return db[_0x8ed0('0x2c')][_0x8ed0('0x29')]({'where':{'type':_0x3dd633,'resourceId':_0x4712f3['id']}})['then'](function(){return _0x56d30d;});})['then'](function(){_0x90da62[_0x8ed0('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27d9cc,_0x2b2020){return function(_0x1a7428){if(!_0x1a7428){_0x27d9cc[_0x8ed0('0x2d')](0x194);}return _0x1a7428;};}function handleError(_0x5c6198,_0x35d705){_0x35d705=_0x35d705||0x1f4;return function(_0x57fba0){logger['error'](_0x57fba0[_0x8ed0('0x2e')]);if(_0x57fba0[_0x8ed0('0x2f')]){delete _0x57fba0[_0x8ed0('0x2f')];}_0x5c6198[_0x8ed0('0x1c')](_0x35d705)['send'](_0x57fba0);};}exports[_0x8ed0('0x30')]=function(_0x208664,_0x261428){var _0x5bf1ca={},_0x21c685={},_0x47b149={'count':0x0,'rows':[]};var _0x1a3d0a=_['map'](db[_0x8ed0('0x31')][_0x8ed0('0x32')],function(_0xe07d7d){return{'name':_0xe07d7d[_0x8ed0('0x33')],'type':_0xe07d7d['type'][_0x8ed0('0x34')]};});_0x21c685['model']=_[_0x8ed0('0x35')](_0x1a3d0a,'name');_0x21c685[_0x8ed0('0x36')]=_[_0x8ed0('0x37')](_0x208664[_0x8ed0('0x36')]);_0x21c685[_0x8ed0('0x38')]=_[_0x8ed0('0x39')](_0x21c685[_0x8ed0('0x3a')],_0x21c685[_0x8ed0('0x36')]);_0x5bf1ca[_0x8ed0('0x3b')]=_[_0x8ed0('0x39')](_0x21c685[_0x8ed0('0x3a')],qs[_0x8ed0('0x3c')](_0x208664[_0x8ed0('0x36')]['fields']));_0x5bf1ca['attributes']=_0x5bf1ca['attributes'][_0x8ed0('0x3d')]?_0x5bf1ca[_0x8ed0('0x3b')]:_0x21c685[_0x8ed0('0x3a')];if(!_0x208664[_0x8ed0('0x36')][_0x8ed0('0x3e')](_0x8ed0('0x3f'))){_0x5bf1ca[_0x8ed0('0x21')]=qs['limit'](_0x208664[_0x8ed0('0x36')]['limit']);_0x5bf1ca[_0x8ed0('0x1f')]=qs[_0x8ed0('0x1f')](_0x208664[_0x8ed0('0x36')][_0x8ed0('0x1f')]);}_0x5bf1ca[_0x8ed0('0x40')]=qs[_0x8ed0('0x41')](_0x208664[_0x8ed0('0x36')][_0x8ed0('0x41')]);_0x5bf1ca[_0x8ed0('0x42')]=qs[_0x8ed0('0x38')](_[_0x8ed0('0x43')](_0x208664['query'],_0x21c685[_0x8ed0('0x38')]),_0x1a3d0a);if(_0x208664['query'][_0x8ed0('0x44')]){_0x5bf1ca[_0x8ed0('0x42')]=_['merge'](_0x5bf1ca['where'],{'$or':_[_0x8ed0('0x35')](_0x1a3d0a,function(_0x2e382b){if(_0x2e382b[_0x8ed0('0x45')]!==_0x8ed0('0x46')){var _0x2dccb1={};_0x2dccb1[_0x2e382b[_0x8ed0('0x2f')]]={'$like':'%'+_0x208664[_0x8ed0('0x36')][_0x8ed0('0x44')]+'%'};return _0x2dccb1;}})});}_0x5bf1ca=_['merge']({},_0x5bf1ca,_0x208664[_0x8ed0('0x47')]);var _0x5c4269={'where':_0x5bf1ca['where']};return db[_0x8ed0('0x31')][_0x8ed0('0x22')](_0x5c4269)[_0x8ed0('0x28')](function(_0x20a6fa){_0x47b149['count']=_0x20a6fa;if(_0x208664[_0x8ed0('0x36')][_0x8ed0('0x48')]){_0x5bf1ca['include']=[{'all':!![]}];}return db[_0x8ed0('0x31')][_0x8ed0('0x49')](_0x5bf1ca);})[_0x8ed0('0x28')](function(_0x2a18c0){_0x47b149['rows']=_0x2a18c0;return _0x47b149;})[_0x8ed0('0x28')](respondWithFilteredResult(_0x261428,_0x5bf1ca))[_0x8ed0('0x4a')](handleError(_0x261428,null));};exports[_0x8ed0('0x4b')]=function(_0x3aa56a,_0x1557d0){var _0x37ac73={'raw':![],'where':{'id':_0x3aa56a[_0x8ed0('0x4c')]['id']}},_0x548ac0={};_0x548ac0['model']=_[_0x8ed0('0x37')](db[_0x8ed0('0x31')][_0x8ed0('0x32')]);_0x548ac0['query']=_[_0x8ed0('0x37')](_0x3aa56a['query']);_0x548ac0[_0x8ed0('0x38')]=_['intersection'](_0x548ac0[_0x8ed0('0x3a')],_0x548ac0[_0x8ed0('0x36')]);_0x37ac73[_0x8ed0('0x3b')]=_[_0x8ed0('0x39')](_0x548ac0[_0x8ed0('0x3a')],qs[_0x8ed0('0x3c')](_0x3aa56a[_0x8ed0('0x36')][_0x8ed0('0x3c')]));_0x37ac73[_0x8ed0('0x3b')]=_0x37ac73[_0x8ed0('0x3b')]['length']?_0x37ac73[_0x8ed0('0x3b')]:_0x548ac0['model'];if(_0x3aa56a[_0x8ed0('0x36')][_0x8ed0('0x48')]){_0x37ac73[_0x8ed0('0x4d')]=[{'all':!![]}];}_0x37ac73=_['merge']({},_0x37ac73,_0x3aa56a['options']);return db[_0x8ed0('0x31')][_0x8ed0('0x4e')](_0x37ac73)[_0x8ed0('0x28')](handleEntityNotFound(_0x1557d0,null))[_0x8ed0('0x28')](respondWithResult(_0x1557d0,null))[_0x8ed0('0x4a')](handleError(_0x1557d0,null));};exports[_0x8ed0('0x4f')]=function(_0x1fae36,_0x3e9d28){return db[_0x8ed0('0x31')][_0x8ed0('0x4f')](_0x1fae36[_0x8ed0('0x50')],{})[_0x8ed0('0x28')](function(_0x1ed637){var _0x61bef0=_0x1fae36[_0x8ed0('0x51')][_0x8ed0('0x2a')]({'plain':!![]});if(!_0x61bef0)throw new Error(_0x8ed0('0x52'));if(_0x61bef0[_0x8ed0('0x53')]===_0x8ed0('0x51')){var _0x3e6a04=_0x1ed637[_0x8ed0('0x2a')]({'plain':!![]});var _0xa18e9e='Lists';return db[_0x8ed0('0x54')]['find']({'where':{'name':_0xa18e9e,'userProfileId':_0x61bef0[_0x8ed0('0x55')]},'raw':!![]})[_0x8ed0('0x28')](function(_0x4f4cd6){if(_0x4f4cd6&&_0x4f4cd6['autoAssociation']===0x0){return db[_0x8ed0('0x2c')][_0x8ed0('0x4f')]({'name':_0x3e6a04[_0x8ed0('0x2f')],'resourceId':_0x3e6a04['id'],'type':_0x4f4cd6[_0x8ed0('0x2f')],'sectionId':_0x4f4cd6['id']},{})[_0x8ed0('0x28')](function(){return _0x1ed637;});}else{return _0x1ed637;}})['catch'](function(_0x12ba14){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12ba14);throw _0x12ba14;});}return _0x1ed637;})[_0x8ed0('0x28')](respondWithResult(_0x3e9d28,0xc9))[_0x8ed0('0x4a')](handleError(_0x3e9d28,null));};exports['update']=function(_0x249b5f,_0x51d9cc){if(_0x249b5f[_0x8ed0('0x50')]['id']){delete _0x249b5f[_0x8ed0('0x50')]['id'];}return db[_0x8ed0('0x31')][_0x8ed0('0x4e')]({'where':{'id':_0x249b5f[_0x8ed0('0x4c')]['id']}})[_0x8ed0('0x28')](handleEntityNotFound(_0x51d9cc,null))['then'](saveUpdates(_0x249b5f['body'],null))['then'](respondWithResult(_0x51d9cc,null))[_0x8ed0('0x4a')](handleError(_0x51d9cc,null));};exports['destroy']=function(_0x2e6b3e,_0x30ceac){return db[_0x8ed0('0x31')]['find']({'where':{'id':_0x2e6b3e[_0x8ed0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x30ceac,null))[_0x8ed0('0x28')](removeEntity(_0x30ceac,null))['catch'](handleError(_0x30ceac,null));};exports[_0x8ed0('0x56')]=function(_0x13371c,_0x3249d9){return db[_0x8ed0('0x31')][_0x8ed0('0x56')]()[_0x8ed0('0x28')](respondWithResult(_0x3249d9,null))[_0x8ed0('0x4a')](handleError(_0x3249d9,null));};exports[_0x8ed0('0x57')]=function(_0xa48e04,_0x3862b7,_0x1e4caf){if(_0xa48e04[_0x8ed0('0x50')]['id']){delete _0xa48e04[_0x8ed0('0x50')]['id'];}return db['CmList'][_0x8ed0('0x4e')]({'where':{'id':_0xa48e04['params']['id']}})['then'](handleEntityNotFound(_0x3862b7,null))[_0x8ed0('0x28')](function(_0x9aef68){if(_0x9aef68){_0xa48e04[_0x8ed0('0x50')][_0x8ed0('0x58')]=_0x9aef68['id'];return db[_0x8ed0('0x59')]['create'](_0xa48e04[_0x8ed0('0x50')]);}})[_0x8ed0('0x28')](respondWithResult(_0x3862b7,null))[_0x8ed0('0x4a')](handleError(_0x3862b7,null));};exports[_0x8ed0('0x5a')]=function(_0x4d7a2d,_0x372a63,_0x5af2af){var _0x1d1557={'raw':![],'where':{}};var _0xa4cd88={};var _0x37d544={'count':0x0,'rows':[]};return db[_0x8ed0('0x31')][_0x8ed0('0x5b')]({'where':{'id':_0x4d7a2d[_0x8ed0('0x4c')]['id']}})[_0x8ed0('0x28')](handleEntityNotFound(_0x372a63,null))[_0x8ed0('0x28')](function(_0x4bd0f8){if(_0x4bd0f8){_0xa4cd88[_0x8ed0('0x3a')]=_['keys'](db[_0x8ed0('0x59')][_0x8ed0('0x32')]);_0xa4cd88[_0x8ed0('0x36')]=_[_0x8ed0('0x37')](_0x4d7a2d[_0x8ed0('0x36')]);_0xa4cd88[_0x8ed0('0x38')]=_[_0x8ed0('0x39')](_0xa4cd88[_0x8ed0('0x3a')],_0xa4cd88[_0x8ed0('0x36')]);_0x1d1557['attributes']=_[_0x8ed0('0x39')](_0xa4cd88['model'],qs[_0x8ed0('0x3c')](_0x4d7a2d[_0x8ed0('0x36')][_0x8ed0('0x3c')]));_0x1d1557['attributes']=_0x1d1557[_0x8ed0('0x3b')][_0x8ed0('0x3d')]?_0x1d1557[_0x8ed0('0x3b')]:_0xa4cd88['model'];if(!_0x4d7a2d[_0x8ed0('0x36')]['hasOwnProperty']('nolimit')){_0x1d1557[_0x8ed0('0x21')]=qs['limit'](_0x4d7a2d[_0x8ed0('0x36')]['limit']);_0x1d1557[_0x8ed0('0x1f')]=qs[_0x8ed0('0x1f')](_0x4d7a2d[_0x8ed0('0x36')][_0x8ed0('0x1f')]);}_0x1d1557['order']=qs[_0x8ed0('0x41')](_0x4d7a2d[_0x8ed0('0x36')]['sort']);_0x1d1557['where']=qs[_0x8ed0('0x38')](_[_0x8ed0('0x43')](_0x4d7a2d['query'],_0xa4cd88[_0x8ed0('0x38')]));_0x1d1557[_0x8ed0('0x42')][_0x8ed0('0x58')]=_0x4bd0f8['id'];if(_0x4d7a2d['query']['filter']){_0x1d1557[_0x8ed0('0x42')]=_[_0x8ed0('0x5c')](_0x1d1557[_0x8ed0('0x42')],{'$or':_[_0x8ed0('0x35')](_0x1d1557[_0x8ed0('0x3b')],function(_0x1c224a){var _0x509952={};_0x509952[_0x1c224a]={'$like':'%'+_0x4d7a2d[_0x8ed0('0x36')][_0x8ed0('0x44')]+'%'};return _0x509952;})});}_0x1d1557=_['merge']({},_0x1d1557,_0x4d7a2d[_0x8ed0('0x47')]);return db[_0x8ed0('0x59')][_0x8ed0('0x22')]({'where':_0x1d1557[_0x8ed0('0x42')]})[_0x8ed0('0x28')](function(_0x4f7cdd){_0x37d544['count']=_0x4f7cdd;if(_0x4d7a2d['query'][_0x8ed0('0x48')]){_0x1d1557[_0x8ed0('0x4d')]=[{'all':!![]}];}return db[_0x8ed0('0x59')][_0x8ed0('0x49')](_0x1d1557);})[_0x8ed0('0x28')](function(_0x287b4a){_0x37d544[_0x8ed0('0x5d')]=_0x287b4a;return _0x37d544;});}})[_0x8ed0('0x28')](respondWithFilteredResult(_0x372a63,_0x1d1557))['catch'](handleError(_0x372a63,null));};exports['removeDispositions']=function(_0x1ae1c1,_0xb4aacc,_0x2bd4b2){return db[_0x8ed0('0x31')][_0x8ed0('0x4e')]({'where':{'id':_0x1ae1c1[_0x8ed0('0x4c')]['id']}})['then'](handleEntityNotFound(_0xb4aacc,null))[_0x8ed0('0x28')](function(_0x31fe01){if(_0x31fe01){return _0x31fe01['removeDispositions'](_0x1ae1c1[_0x8ed0('0x36')][_0x8ed0('0x5e')]);}})[_0x8ed0('0x28')](respondWithStatusCode(_0xb4aacc,null))[_0x8ed0('0x4a')](handleError(_0xb4aacc,null));};exports[_0x8ed0('0x5f')]=function(_0x5c0bd7,_0x823b34,_0xc6c55d){return db[_0x8ed0('0x31')]['find']({'where':{'id':_0x5c0bd7['params']['id']}})[_0x8ed0('0x28')](handleEntityNotFound(_0x823b34,null))[_0x8ed0('0x28')](function(_0x587a84){if(_0x587a84){var _0x4f96ff=[];var _0x25f00d={'success':[],'errors':[]};return db[_0x8ed0('0x60')][_0x8ed0('0x56')]()[_0x8ed0('0x28')](function(_0x42d9dd){if(_0x5c0bd7[_0x8ed0('0x50')][_0x8ed0('0x61')]&&_['isArray'](_0x5c0bd7[_0x8ed0('0x50')][_0x8ed0('0x61')])){if(_0x5c0bd7['body'][_0x8ed0('0x61')][_0x8ed0('0x3d')]){_0x5c0bd7[_0x8ed0('0x50')][_0x8ed0('0x61')]=_0x5c0bd7[_0x8ed0('0x50')][_0x8ed0('0x61')][_0x8ed0('0x62')](';')+';';}else{_0x5c0bd7[_0x8ed0('0x50')][_0x8ed0('0x61')]=null;}}else{_0x5c0bd7[_0x8ed0('0x50')][_0x8ed0('0x61')]=null;}if(_0x5c0bd7[_0x8ed0('0x50')]&&_[_0x8ed0('0x63')](_0x5c0bd7[_0x8ed0('0x50')])){for(var _0x2e03ba=0x0;_0x2e03ba<_0x5c0bd7[_0x8ed0('0x50')][_0x8ed0('0x3d')];_0x2e03ba+=0x1){_0x5c0bd7[_0x8ed0('0x50')][_0x2e03ba][_0x8ed0('0x58')]=_0x5c0bd7[_0x8ed0('0x4c')]['id'];_0x4f96ff[_0x8ed0('0x64')](_0x5c0bd7[_0x8ed0('0x50')][_0x2e03ba]);}return BPromise[_0x8ed0('0x65')](_0x4f96ff,function(_0x3ccb2d){return db['CmContact']['create'](_[_0x8ed0('0x66')](_0x3ccb2d,['ids','id'])||{},{'fields':_[_0x8ed0('0x37')](_0x42d9dd),'raw':!![]})['then'](function(_0x1838af){_0x25f00d['success'][_0x8ed0('0x64')](_0x1838af[_0x8ed0('0x67')]);})[_0x8ed0('0x4a')](function(_0x3d7b7b){_0x25f00d['errors'][_0x8ed0('0x64')]({'data':_0x3ccb2d,'error':_0x3d7b7b[_0x8ed0('0x68')]});});})[_0x8ed0('0x28')](function(_0x434393){return _0x25f00d;})[_0x8ed0('0x4a')](function(_0x2f3f32){return _0x2f3f32;});}else{_0x823b34['status'](0x190)[_0x8ed0('0x1e')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x8ed0('0x28')](respondWithResult(_0x823b34,null))[_0x8ed0('0x4a')](handleError(_0x823b34,null));};exports[_0x8ed0('0x69')]=function(_0x40bab2,_0x230cfc,_0x421579){var _0x4acd9b;return db[_0x8ed0('0x31')][_0x8ed0('0x4e')]({'where':{'id':_0x40bab2[_0x8ed0('0x4c')]['id']},'include':[{'model':db[_0x8ed0('0x6a')],'as':_0x8ed0('0x6b')}]})[_0x8ed0('0x28')](handleEntityNotFound(_0x230cfc,null))[_0x8ed0('0x28')](function(_0x52ac83){if(_0x52ac83){_0x4acd9b=_0x52ac83;return db[_0x8ed0('0x60')][_0x8ed0('0x32')];}})[_0x8ed0('0x28')](function(_0x460006){if(_0x460006){var _0xdbea04={};var _0x104e20={};_0x104e20[_0x8ed0('0x3a')]=_[_0x8ed0('0x6c')](_[_0x8ed0('0x37')](_0x460006),_[_0x8ed0('0x35')](_0x4acd9b[_0x8ed0('0x6b')],function(_0x2b2450){return util[_0x8ed0('0x6d')](_0x8ed0('0x6e'),_0x2b2450['id']);}));_0x104e20['query']=_[_0x8ed0('0x37')](_0x40bab2[_0x8ed0('0x36')]);_0x104e20['filters']=_[_0x8ed0('0x39')](_0x104e20[_0x8ed0('0x3a')],_0x104e20[_0x8ed0('0x36')]);_0xdbea04[_0x8ed0('0x3b')]=_['intersection'](_0x104e20[_0x8ed0('0x3a')],qs[_0x8ed0('0x3c')](_0x40bab2[_0x8ed0('0x36')]['fields']));_0xdbea04[_0x8ed0('0x3b')]=_0xdbea04['attributes'][_0x8ed0('0x3d')]?_0xdbea04[_0x8ed0('0x3b')]:_0x104e20['model'];if(!_0x40bab2[_0x8ed0('0x36')][_0x8ed0('0x3e')](_0x8ed0('0x3f'))){_0xdbea04[_0x8ed0('0x21')]=qs['limit'](_0x40bab2[_0x8ed0('0x36')][_0x8ed0('0x21')]);_0xdbea04['offset']=qs[_0x8ed0('0x1f')](_0x40bab2['query'][_0x8ed0('0x1f')]);}_0xdbea04[_0x8ed0('0x40')]=qs[_0x8ed0('0x41')](_0x40bab2['query'][_0x8ed0('0x41')]);_0xdbea04[_0x8ed0('0x42')]=qs[_0x8ed0('0x38')](_['pick'](_0x40bab2[_0x8ed0('0x36')],_0x104e20[_0x8ed0('0x38')]));_0xdbea04[_0x8ed0('0x6f')]=!![];if(_0x40bab2[_0x8ed0('0x36')]['filter']){_0xdbea04[_0x8ed0('0x42')]=_[_0x8ed0('0x5c')](_0xdbea04[_0x8ed0('0x42')],{'$or':_[_0x8ed0('0x35')](_0xdbea04[_0x8ed0('0x3b')],function(_0x2bfcda){var _0x1341cc={};_0x1341cc[_0x2bfcda]={'$like':'%'+_0x40bab2[_0x8ed0('0x36')]['filter']+'%'};return _0x1341cc;})});}_0xdbea04=_['merge']({},_0xdbea04,_0x40bab2[_0x8ed0('0x47')]);return _0x4acd9b[_0x8ed0('0x69')](_0xdbea04);}})[_0x8ed0('0x28')](respondWithResult(_0x230cfc,null))[_0x8ed0('0x4a')](handleError(_0x230cfc,null));};exports['getContactsCsv']=function(_0x217e7a,_0x2c93f4,_0x1c0879){var _0xc04951;var _0x1e7d93;var _0x3bac45;var _0x4d7c7c=_0x217e7a['params']['id'];csv_results=[];return db['ContactItemType'][_0x8ed0('0x49')]({'attributes':['id',_0x8ed0('0x2f')],'raw':!![],'order':[_0x8ed0('0x70')]})['then'](function(_0x1b1406){_0xc04951=_0x1b1406;var _0x37a2d2=_[_0x8ed0('0x37')](db[_0x8ed0('0x60')][_0x8ed0('0x32')]);return db[_0x8ed0('0x6a')][_0x8ed0('0x49')]({'raw':!![],'attributes':['id',_0x8ed0('0x71')]})['then'](function(_0x3857c2){_0x1e7d93=_0x3857c2;var _0x58d1b2=squel[_0x8ed0('0x72')]()['fields'](_0x37a2d2)[_0x8ed0('0x73')]('cm_contacts','c')['where'](_0x8ed0('0x74'),_0x4d7c7c)[_0x8ed0('0x42')](_0x8ed0('0x75'))[_0x8ed0('0x76')]();for(var _0x19a46c=0x0;_0x19a46c<_0x1e7d93[_0x8ed0('0x3d')];_0x19a46c++){_0x58d1b2[_0x8ed0('0x77')](_0x8ed0('0x78')+_0x1e7d93[_0x19a46c]['id'],_0x8ed0('0x79')+_0x1e7d93[_0x19a46c][_0x8ed0('0x71')]);}for(var _0x19a46c=0x0;_0x19a46c<_0xc04951[_0x8ed0('0x3d')];_0x19a46c++){_0x58d1b2['field'](squel[_0x8ed0('0x72')]()['field'](_0x8ed0('0x7a'))[_0x8ed0('0x73')](_0x8ed0('0x7b'))[_0x8ed0('0x42')](_0x8ed0('0x7c'),_0xc04951[_0x19a46c]['id'])[_0x8ed0('0x42')]('CmContactId\x20=\x20c.id'),_0x8ed0('0x7d')+_0xc04951[_0x19a46c]['name']);_0x58d1b2[_0x8ed0('0x77')](squel[_0x8ed0('0x72')]()['field'](_0x8ed0('0x7e'))[_0x8ed0('0x73')](_0x8ed0('0x7b'))['where']('ItemTypeId\x20=\x20?',_0xc04951[_0x19a46c]['id'])[_0x8ed0('0x42')](_0x8ed0('0x7f')),_0x8ed0('0x80')+_0xc04951[_0x19a46c][_0x8ed0('0x2f')]);}var _0x36e0f7=[];_0x36e0f7[_0x8ed0('0x64')](_0x58d1b2[_0x8ed0('0x81')]());BPromise[_0x8ed0('0x65')](_0x36e0f7,handleQuery)[_0x8ed0('0x28')](function(_0x55fb93){handleQuery(_0x58d1b2[_0x8ed0('0x81')]());var _0x4a8229=csv_results[0x0];if(!_[_0x8ed0('0x82')](_0x4a8229)){var _0x573725=toCsv(_0x4a8229);var _0x2a18c7=Date[_0x8ed0('0x83')]();fs[_0x8ed0('0x84')](util[_0x8ed0('0x6d')](_0x8ed0('0x85'),_0x4d7c7c,_0x2a18c7),_0x573725);_0x2c93f4[_0x8ed0('0x86')](_0x8ed0('0x87'),_0x8ed0('0x88')+util['format'](_0x8ed0('0x89'),_0x4d7c7c,_0x2a18c7));_0x2c93f4['setHeader'](_0x8ed0('0x8a'),_0x8ed0('0x8b'));return _0x2c93f4['download'](util[_0x8ed0('0x6d')](_0x8ed0('0x85'),_0x4d7c7c,_0x2a18c7));}else{return _0x2c93f4['sendStatus'](0xcc);}});});});};exports[_0x8ed0('0x8c')]=function(_0x93fcc2,_0x33e23c,_0x20b3fe){var _0x404e5d;delete _0x93fcc2['body']['id'];return db['CmList'][_0x8ed0('0x5b')]({'where':{'id':_0x93fcc2[_0x8ed0('0x4c')]['id']}})[_0x8ed0('0x28')](handleEntityNotFound(_0x33e23c,null))[_0x8ed0('0x28')](function(_0x39a987){if(_0x39a987){return db[_0x8ed0('0x8d')][_0x8ed0('0x8e')](function(_0x523c62){return db['CmCustomField']['create'](_0x93fcc2['body'],{'transaction':_0x523c62})['then'](function(_0x58f2ae){_0x404e5d=_0x58f2ae;return _0x39a987[_0x8ed0('0x8f')](_0x58f2ae,{'transaction':_0x523c62});})[_0x8ed0('0x28')](function(){var _0x504c2e={'type':db[_0x8ed0('0x90')]['TEXT'],'transaction':_0x523c62};switch(_0x93fcc2[_0x8ed0('0x50')]['type']){case'text':_0x504c2e[_0x8ed0('0x45')]=db['Sequelize'][_0x8ed0('0x91')];break;case _0x8ed0('0x92'):_0x504c2e[_0x8ed0('0x45')]=db[_0x8ed0('0x90')][_0x8ed0('0x93')];break;case _0x8ed0('0x94'):_0x504c2e[_0x8ed0('0x45')]=db['Sequelize'][_0x8ed0('0x95')];_0x504c2e[_0x8ed0('0x96')]=![];break;default:}return db[_0x8ed0('0x8d')][_0x8ed0('0x97')][_0x8ed0('0x98')](_0x8ed0('0x99'),util['format'](_0x8ed0('0x9a'),_0x404e5d['id']),_0x504c2e);})[_0x8ed0('0x28')](function(){return _0x404e5d;});});}})[_0x8ed0('0x28')](respondWithResult(_0x33e23c,null))['catch'](handleError(_0x33e23c,null));};exports[_0x8ed0('0x9b')]=function(_0x3f7b1a,_0x74c893,_0x296822){var _0x56863a={};var _0x1a021c={};var _0x298960;var _0x31bab0;return db[_0x8ed0('0x31')][_0x8ed0('0x5b')]({'where':{'id':_0x3f7b1a[_0x8ed0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x74c893,null))[_0x8ed0('0x28')](function(_0x5e9ddb){if(_0x5e9ddb){_0x298960=_0x5e9ddb;_0x1a021c['model']=_[_0x8ed0('0x37')](db[_0x8ed0('0x6a')][_0x8ed0('0x32')]);_0x1a021c[_0x8ed0('0x36')]=_['keys'](_0x3f7b1a[_0x8ed0('0x36')]);_0x1a021c[_0x8ed0('0x38')]=_['intersection'](_0x1a021c[_0x8ed0('0x3a')],_0x1a021c['query']);_0x56863a['attributes']=_[_0x8ed0('0x39')](_0x1a021c[_0x8ed0('0x3a')],qs[_0x8ed0('0x3c')](_0x3f7b1a[_0x8ed0('0x36')][_0x8ed0('0x3c')]));_0x56863a[_0x8ed0('0x3b')]=_0x56863a[_0x8ed0('0x3b')][_0x8ed0('0x3d')]?_0x56863a['attributes']:_0x1a021c[_0x8ed0('0x3a')];_0x56863a[_0x8ed0('0x40')]=qs[_0x8ed0('0x41')](_0x3f7b1a[_0x8ed0('0x36')][_0x8ed0('0x41')]);_0x56863a[_0x8ed0('0x42')]=qs[_0x8ed0('0x38')](_[_0x8ed0('0x43')](_0x3f7b1a[_0x8ed0('0x36')],_0x1a021c[_0x8ed0('0x38')]));_0x56863a['where']=_[_0x8ed0('0x5c')](_0x56863a['where'],{'$or':[{'ListId':_0x5e9ddb['id']},{'ListId':null}]});if(_0x3f7b1a[_0x8ed0('0x36')]['filter']){_0x56863a[_0x8ed0('0x42')]=_['merge'](_0x56863a[_0x8ed0('0x42')],{'$or':_[_0x8ed0('0x35')](_0x56863a[_0x8ed0('0x3b')],function(_0x54f734){var _0x486353={};_0x486353[_0x54f734]={'$like':'%'+_0x3f7b1a[_0x8ed0('0x36')][_0x8ed0('0x44')]+'%'};return _0x486353;})});}_0x56863a=_[_0x8ed0('0x5c')]({},_0x56863a,_0x3f7b1a['options']);return db[_0x8ed0('0x6a')]['findAndCountAll'](_0x56863a);}})[_0x8ed0('0x28')](respondWithResult(_0x74c893,null))[_0x8ed0('0x4a')](handleError(_0x74c893,null));};exports[_0x8ed0('0x9c')]=function(_0x80c04a,_0x38df0d){return db['CmCustomField'][_0x8ed0('0x9d')]({'where':{'ListId':null}})[_0x8ed0('0x28')](handleEntityNotFound(_0x38df0d,null))[_0x8ed0('0x28')](function(_0x4fba9e){return _0x4fba9e;})[_0x8ed0('0x28')](respondWithResult(_0x38df0d,null))[_0x8ed0('0x4a')](handleError(_0x38df0d,null));};exports[_0x8ed0('0x9e')]=function(_0x33f4fc,_0x422ae9,_0x14a2ff){return db['CmList'][_0x8ed0('0x4e')]({'where':{'id':_0x33f4fc[_0x8ed0('0x4c')]['id']}})[_0x8ed0('0x28')](handleEntityNotFound(_0x422ae9,null))[_0x8ed0('0x28')](function(_0x2b99d2){if(_0x2b99d2){return _0x2b99d2['addAgents'](_0x33f4fc[_0x8ed0('0x50')][_0x8ed0('0x5e')],_['omit'](_0x33f4fc['body'],[_0x8ed0('0x5e'),'id'])||{})[_0x8ed0('0x9f')](function(_0x3aad4b){for(var _0x5d53b3=0x0;_0x5d53b3<_0x33f4fc[_0x8ed0('0x50')][_0x8ed0('0x5e')][_0x8ed0('0x3d')];_0x5d53b3+=0x1){socket[_0x8ed0('0xa0')](_0x8ed0('0xa1'),{'UserId':Number(_0x33f4fc[_0x8ed0('0x50')]['ids'][_0x5d53b3]),'CmListId':Number(_0x33f4fc[_0x8ed0('0x4c')]['id'])});}return _0x3aad4b;});}})[_0x8ed0('0x28')](respondWithResult(_0x422ae9,null))['catch'](handleError(_0x422ae9,null));};exports[_0x8ed0('0xa2')]=function(_0x2df73f,_0x491c05,_0x18591a){return db[_0x8ed0('0x31')]['find']({'where':{'id':_0x2df73f[_0x8ed0('0x4c')]['id']}})[_0x8ed0('0x28')](handleEntityNotFound(_0x491c05,null))[_0x8ed0('0x28')](function(_0x1d3ce0){if(_0x1d3ce0){return _0x1d3ce0['removeAgents'](_0x2df73f[_0x8ed0('0x36')][_0x8ed0('0x5e')])[_0x8ed0('0x28')](function(){if(_[_0x8ed0('0x63')](_0x2df73f[_0x8ed0('0x36')][_0x8ed0('0x5e')])){for(var _0x47922c=0x0;_0x47922c<_0x2df73f[_0x8ed0('0x36')][_0x8ed0('0x5e')]['length'];_0x47922c+=0x1){socket[_0x8ed0('0xa0')](_0x8ed0('0xa3'),{'UserId':Number(_0x2df73f['query'][_0x8ed0('0x5e')][_0x47922c]),'CmListId':Number(_0x2df73f['params']['id'])});}}else{socket[_0x8ed0('0xa0')](_0x8ed0('0xa3'),{'UserId':Number(_0x2df73f[_0x8ed0('0x36')]['ids']),'CmListId':Number(_0x2df73f[_0x8ed0('0x4c')]['id'])});}});}})[_0x8ed0('0x28')](respondWithStatusCode(_0x491c05,null))[_0x8ed0('0x4a')](handleError(_0x491c05,null));};exports[_0x8ed0('0xa4')]=function(_0x141ac0,_0x108249,_0xdbe533){var _0x28f229={};var _0x371172={};var _0x323d3b;var _0x11e1ed;return db[_0x8ed0('0x31')][_0x8ed0('0x5b')]({'where':{'id':_0x141ac0[_0x8ed0('0x4c')]['id']}})[_0x8ed0('0x28')](handleEntityNotFound(_0x108249,null))[_0x8ed0('0x28')](function(_0x1ba987){if(_0x1ba987){_0x323d3b=_0x1ba987;_0x371172[_0x8ed0('0x3a')]=_[_0x8ed0('0x37')](db[_0x8ed0('0xa5')][_0x8ed0('0x32')]);_0x371172[_0x8ed0('0x36')]=_[_0x8ed0('0x37')](_0x141ac0[_0x8ed0('0x36')]);_0x371172['filters']=_[_0x8ed0('0x39')](_0x371172['model'],_0x371172[_0x8ed0('0x36')]);_0x28f229[_0x8ed0('0x3b')]=_[_0x8ed0('0x39')](_0x371172['model'],qs[_0x8ed0('0x3c')](_0x141ac0['query'][_0x8ed0('0x3c')]));_0x28f229[_0x8ed0('0x3b')]=_0x28f229[_0x8ed0('0x3b')][_0x8ed0('0x3d')]?_0x28f229['attributes']:_0x371172[_0x8ed0('0x3a')];_0x28f229[_0x8ed0('0x40')]=qs[_0x8ed0('0x41')](_0x141ac0[_0x8ed0('0x36')][_0x8ed0('0x41')]);_0x28f229[_0x8ed0('0x42')]=qs[_0x8ed0('0x38')](_[_0x8ed0('0x43')](_0x141ac0[_0x8ed0('0x36')],_0x371172[_0x8ed0('0x38')]));if(_0x141ac0[_0x8ed0('0x36')][_0x8ed0('0x44')]){_0x28f229[_0x8ed0('0x42')]=_['merge'](_0x28f229['where'],{'$or':_[_0x8ed0('0x35')](_0x28f229['attributes'],function(_0x2f98be){var _0x406463={};_0x406463[_0x2f98be]={'$like':'%'+_0x141ac0[_0x8ed0('0x36')][_0x8ed0('0x44')]+'%'};return _0x406463;})});}_0x28f229=_['merge']({},_0x28f229,_0x141ac0[_0x8ed0('0x47')]);return _0x323d3b[_0x8ed0('0xa4')](_0x28f229);}})[_0x8ed0('0x28')](function(_0x21f274){if(_0x21f274){_0x11e1ed=_0x21f274[_0x8ed0('0x3d')];if(!_0x141ac0[_0x8ed0('0x36')][_0x8ed0('0x3e')](_0x8ed0('0x3f'))){_0x28f229['limit']=qs[_0x8ed0('0x21')](_0x141ac0[_0x8ed0('0x36')]['limit']);_0x28f229[_0x8ed0('0x1f')]=qs['offset'](_0x141ac0[_0x8ed0('0x36')][_0x8ed0('0x1f')]);}return _0x323d3b[_0x8ed0('0xa4')](_0x28f229);}})[_0x8ed0('0x28')](function(_0x46e4a4){if(_0x46e4a4){return _0x46e4a4?{'count':_0x11e1ed,'rows':_0x46e4a4}:null;}})[_0x8ed0('0x28')](respondWithResult(_0x108249,null))[_0x8ed0('0x4a')](handleError(_0x108249,null));};function handleQuery(_0x521378){logger[_0x8ed0('0xa6')](_0x521378);return db[_0x8ed0('0x8d')][_0x8ed0('0x36')](_0x521378)[_0x8ed0('0x9f')](function(_0x5cd4d7){csv_results[_0x8ed0('0x64')](_0x5cd4d7);})['catch'](function(_0x2b903b){logger[_0x8ed0('0xa7')](_0x2b903b['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index d918ca7..4def82d 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 _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x17acbe,_0x3fb4c7){_0x17acbe=_0x17acbe-0x0;var _0x1ce251=_0x3e74[_0x17acbe];return _0x1ce251;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0x5fc3,0xa8));var _0x35fc=function(_0xbc4560,_0x4020b8){_0xbc4560=_0xbc4560-0x0;var _0x298cfb=_0x5fc3[_0xbc4560];return _0x298cfb;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index f554c24..a8dd4ab 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 _0xec56=['define','CmList','cm_lists','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports'];(function(_0x2757db,_0x464403){var _0x38e694=function(_0x387ee3){while(--_0x387ee3){_0x2757db['push'](_0x2757db['shift']());}};_0x38e694(++_0x464403);}(_0xec56,0x1bd));var _0x6ec5=function(_0x1e8077,_0x253527){_0x1e8077=_0x1e8077-0x0;var _0x3355bc=_0xec56[_0x1e8077];return _0x3355bc;};'use strict';var _=require(_0x6ec5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ec5('0x1'));var moment=require(_0x6ec5('0x2'));var BPromise=require(_0x6ec5('0x3'));var rp=require(_0x6ec5('0x4'));var fs=require('fs');var path=require(_0x6ec5('0x5'));var rimraf=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var attributes=require(_0x6ec5('0x8'));module[_0x6ec5('0x9')]=function(_0x28b12b,_0x2d0a93){return _0x28b12b[_0x6ec5('0xa')](_0x6ec5('0xb'),attributes,{'tableName':_0x6ec5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec56=['define','CmList','cm_lists','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports'];(function(_0x14dbe6,_0x3b32fc){var _0x58bb00=function(_0x37a37b){while(--_0x37a37b){_0x14dbe6['push'](_0x14dbe6['shift']());}};_0x58bb00(++_0x3b32fc);}(_0xec56,0x1bd));var _0x6ec5=function(_0x3ed9fc,_0x347039){_0x3ed9fc=_0x3ed9fc-0x0;var _0x1a2337=_0xec56[_0x3ed9fc];return _0x1a2337;};'use strict';var _=require(_0x6ec5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ec5('0x1'));var moment=require(_0x6ec5('0x2'));var BPromise=require(_0x6ec5('0x3'));var rp=require(_0x6ec5('0x4'));var fs=require('fs');var path=require(_0x6ec5('0x5'));var rimraf=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var attributes=require(_0x6ec5('0x8'));module[_0x6ec5('0x9')]=function(_0x28b12b,_0x2d0a93){return _0x28b12b[_0x6ec5('0xa')](_0x6ec5('0xb'),attributes,{'tableName':_0x6ec5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 53e9f27..0370c2f 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 _0xa2ad=['randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x474eed,_0x504a08){var _0x3b06d5=function(_0x12e409){while(--_0x12e409){_0x474eed['push'](_0x474eed['shift']());}};_0x3b06d5(++_0x504a08);}(_0xa2ad,0x174));var _0xda2a=function(_0xf72786,_0x1a0ddd){_0xf72786=_0xf72786-0x0;var _0x113f3e=_0xa2ad[_0xf72786];return _0x113f3e;};'use strict';var _=require(_0xda2a('0x0'));var util=require(_0xda2a('0x1'));var moment=require(_0xda2a('0x2'));var BPromise=require('bluebird');var rs=require(_0xda2a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda2a('0x4'))['db'];var utils=require(_0xda2a('0x5'));var logger=require(_0xda2a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xda2a('0x7'));var client=jayson[_0xda2a('0x8')]['http']({'port':0x232a});config[_0xda2a('0x9')]=_[_0xda2a('0xa')](config[_0xda2a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xda2a('0xb'))(new Redis(config[_0xda2a('0x9')]));require(_0xda2a('0xc'))[_0xda2a('0xd')](socket);function respondWithRpcPromise(_0x2db583,_0x512191,_0x239e10){return new BPromise(function(_0x71cc86,_0x5b3403){return client['request'](_0x2db583,_0x239e10)[_0xda2a('0xe')](function(_0x20f755){logger[_0xda2a('0xf')](_0xda2a('0x10'),_0x512191,_0xda2a('0x11'));logger[_0xda2a('0x12')](_0xda2a('0x13'),_0x512191,'request\x20sent',JSON[_0xda2a('0x14')](_0x20f755));if(_0x20f755[_0xda2a('0x15')]){if(_0x20f755['error'][_0xda2a('0x16')]===0x1f4){logger[_0xda2a('0x15')](_0xda2a('0x10'),_0x512191,_0x20f755[_0xda2a('0x15')][_0xda2a('0x17')]);return _0x5b3403(_0x20f755[_0xda2a('0x15')][_0xda2a('0x17')]);}logger['error']('CmList,\x20%s,\x20%s',_0x512191,_0x20f755[_0xda2a('0x15')][_0xda2a('0x17')]);return _0x71cc86(_0x20f755[_0xda2a('0x15')][_0xda2a('0x17')]);}else{logger[_0xda2a('0xf')](_0xda2a('0x10'),_0x512191,_0xda2a('0x11'));_0x71cc86(_0x20f755['result'][_0xda2a('0x17')]);}})[_0xda2a('0x18')](function(_0x9c2786){logger[_0xda2a('0x15')](_0xda2a('0x10'),_0x512191,_0x9c2786);_0x5b3403(_0x9c2786);});});} \ No newline at end of file +var _0x62ea=['localhost','socket.io-emitter','register','request','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x202bc5,_0x509360){var _0x4fa2b9=function(_0x5c263c){while(--_0x5c263c){_0x202bc5['push'](_0x202bc5['shift']());}};_0x4fa2b9(++_0x509360);}(_0x62ea,0x79));var _0xa62e=function(_0x52e251,_0x3b6303){_0x52e251=_0x52e251-0x0;var _0x5eee63=_0x62ea[_0x52e251];return _0x5eee63;};'use strict';var _=require(_0xa62e('0x0'));var util=require(_0xa62e('0x1'));var moment=require(_0xa62e('0x2'));var BPromise=require(_0xa62e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa62e('0x4'));var db=require(_0xa62e('0x5'))['db'];var utils=require(_0xa62e('0x6'));var logger=require(_0xa62e('0x7'))(_0xa62e('0x8'));var config=require(_0xa62e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa62e('0xa')][_0xa62e('0xb')]({'port':0x232a});config[_0xa62e('0xc')]=_[_0xa62e('0xd')](config['redis'],{'host':_0xa62e('0xe'),'port':0x18eb});var socket=require(_0xa62e('0xf'))(new Redis(config['redis']));require('./cmList.socket')[_0xa62e('0x10')](socket);function respondWithRpcPromise(_0xed4721,_0x595c09,_0x441ec6){return new BPromise(function(_0x20bb96,_0x455235){return client[_0xa62e('0x11')](_0xed4721,_0x441ec6)['then'](function(_0x3101ed){logger[_0xa62e('0x12')](_0xa62e('0x13'),_0x595c09,'request\x20sent');logger[_0xa62e('0x14')](_0xa62e('0x15'),_0x595c09,'request\x20sent',JSON['stringify'](_0x3101ed));if(_0x3101ed[_0xa62e('0x16')]){if(_0x3101ed[_0xa62e('0x16')][_0xa62e('0x17')]===0x1f4){logger[_0xa62e('0x16')](_0xa62e('0x13'),_0x595c09,_0x3101ed[_0xa62e('0x16')][_0xa62e('0x18')]);return _0x455235(_0x3101ed['error'][_0xa62e('0x18')]);}logger[_0xa62e('0x16')](_0xa62e('0x13'),_0x595c09,_0x3101ed['error'][_0xa62e('0x18')]);return _0x20bb96(_0x3101ed[_0xa62e('0x16')][_0xa62e('0x18')]);}else{logger[_0xa62e('0x12')](_0xa62e('0x13'),_0x595c09,_0xa62e('0x19'));_0x20bb96(_0x3101ed['result']['message']);}})[_0xa62e('0x1a')](function(_0x3bf019){logger['error'](_0xa62e('0x13'),_0x595c09,_0x3bf019);_0x455235(_0x3bf019);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index cc2b1af..a19eb4e 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 _0xfc96=['save','emit','removeListener','register','cmList:','./cmList.events'];(function(_0x319dbe,_0x1053de){var _0x36cedc=function(_0x21f962){while(--_0x21f962){_0x319dbe['push'](_0x319dbe['shift']());}};_0x36cedc(++_0x1053de);}(_0xfc96,0x167));var _0x6fc9=function(_0x481a3a,_0x12d2f5){_0x481a3a=_0x481a3a-0x0;var _0x1e8c66=_0xfc96[_0x481a3a];return _0x1e8c66;};'use strict';var CmListEvents=require(_0x6fc9('0x0'));var events=[_0x6fc9('0x1'),'remove','update'];function createListener(_0x47d151,_0x13f88d){return function(_0x20817b){_0x13f88d[_0x6fc9('0x2')](_0x47d151,_0x20817b);};}function removeListener(_0xe5dfa2,_0x3242a1){return function(){CmListEvents[_0x6fc9('0x3')](_0xe5dfa2,_0x3242a1);};}exports[_0x6fc9('0x4')]=function(_0x52a39d){for(var _0x43f243=0x0,_0x6cfbdb=events['length'];_0x43f243<_0x6cfbdb;_0x43f243++){var _0x3b1a1a=events[_0x43f243];var _0x52372a=createListener(_0x6fc9('0x5')+_0x3b1a1a,_0x52a39d);CmListEvents['on'](_0x3b1a1a,_0x52372a);}}; \ No newline at end of file +var _0x439b=['emit','removeListener','register','length','cmList:','./cmList.events','remove','update'];(function(_0x7d0149,_0x1b6d23){var _0xaabd78=function(_0x3dfcef){while(--_0x3dfcef){_0x7d0149['push'](_0x7d0149['shift']());}};_0xaabd78(++_0x1b6d23);}(_0x439b,0x105));var _0xb439=function(_0x2a83b9,_0x3c2d30){_0x2a83b9=_0x2a83b9-0x0;var _0x11cd74=_0x439b[_0x2a83b9];return _0x11cd74;};'use strict';var CmListEvents=require(_0xb439('0x0'));var events=['save',_0xb439('0x1'),_0xb439('0x2')];function createListener(_0x1aa58d,_0x48aacc){return function(_0x388d50){_0x48aacc[_0xb439('0x3')](_0x1aa58d,_0x388d50);};}function removeListener(_0x1ae573,_0x1d8b20){return function(){CmListEvents[_0xb439('0x4')](_0x1ae573,_0x1d8b20);};}exports[_0xb439('0x5')]=function(_0x4a9822){for(var _0x3b1208=0x0,_0x350301=events[_0xb439('0x6')];_0x3b1208<_0x350301;_0x3b1208++){var _0x3f228f=events[_0x3b1208];var _0x2f1115=createListener(_0xb439('0x7')+_0x3f228f,_0x4a9822);CmListEvents['on'](_0x3f228f,_0x2f1115);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index f2fa244..e22000e 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 _0xaf80=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','/describe','describe','/global_fields','getGlobalCustomFields','/:id','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addAgents','update','delete','removeDispositions','removeAgents','exports'];(function(_0x360a2a,_0x1dc29e){var _0x4ea2d7=function(_0x2dad05){while(--_0x2dad05){_0x360a2a['push'](_0x360a2a['shift']());}};_0x4ea2d7(++_0x1dc29e);}(_0xaf80,0x1ef));var _0x0af8=function(_0xe33427,_0x26ca07){_0xe33427=_0xe33427-0x0;var _0x16ac4c=_0xaf80[_0xe33427];return _0x16ac4c;};'use strict';var multer=require(_0x0af8('0x0'));var util=require(_0x0af8('0x1'));var path=require(_0x0af8('0x2'));var timeout=require(_0x0af8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0af8('0x4'));var interaction=require(_0x0af8('0x5'));var config=require(_0x0af8('0x6'));var controller=require(_0x0af8('0x7'));router[_0x0af8('0x8')]('/',auth[_0x0af8('0x9')](),controller['index']);router['get'](_0x0af8('0xa'),auth['isAuthenticated'](),controller[_0x0af8('0xb')]);router[_0x0af8('0x8')](_0x0af8('0xc'),auth['isAuthenticated'](),controller[_0x0af8('0xd')]);router[_0x0af8('0x8')](_0x0af8('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x0af8('0x8')](_0x0af8('0xf'),auth[_0x0af8('0x9')](),controller[_0x0af8('0x10')]);router[_0x0af8('0x8')]('/:id/contacts',auth[_0x0af8('0x9')](),controller[_0x0af8('0x11')]);router[_0x0af8('0x8')](_0x0af8('0x12'),auth[_0x0af8('0x9')](),controller[_0x0af8('0x13')]);router[_0x0af8('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x0af8('0x14')]);router[_0x0af8('0x8')](_0x0af8('0x15'),auth[_0x0af8('0x9')](),controller[_0x0af8('0x16')]);router[_0x0af8('0x17')]('/',auth[_0x0af8('0x9')](),controller[_0x0af8('0x18')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x0af8('0x19')]);router[_0x0af8('0x17')]('/:id/contacts',auth[_0x0af8('0x9')](),controller[_0x0af8('0x1a')]);router[_0x0af8('0x17')]('/:id/fields',auth['isAuthenticated'](),controller['addCustomField']);router[_0x0af8('0x17')](_0x0af8('0x15'),auth['isAuthenticated'](),controller[_0x0af8('0x1b')]);router['put']('/:id',auth[_0x0af8('0x9')](),controller[_0x0af8('0x1c')]);router[_0x0af8('0x1d')](_0x0af8('0xe'),auth[_0x0af8('0x9')](),controller['destroy']);router['delete'](_0x0af8('0xf'),auth[_0x0af8('0x9')](),controller[_0x0af8('0x1e')]);router[_0x0af8('0x1d')](_0x0af8('0x15'),auth[_0x0af8('0x9')](),controller[_0x0af8('0x1f')]);module[_0x0af8('0x20')]=router; \ No newline at end of file +var _0x7f4b=['update','destroy','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents','create','post','addDisposition','addCustomField','addAgents'];(function(_0x4eafed,_0x26e2bc){var _0x159c85=function(_0x6f129f){while(--_0x6f129f){_0x4eafed['push'](_0x4eafed['shift']());}};_0x159c85(++_0x26e2bc);}(_0x7f4b,0x144));var _0xb7f4=function(_0x87dd0e,_0x390eec){_0x87dd0e=_0x87dd0e-0x0;var _0x3f6891=_0x7f4b[_0x87dd0e];return _0x3f6891;};'use strict';var multer=require(_0xb7f4('0x0'));var util=require(_0xb7f4('0x1'));var path=require('path');var timeout=require(_0xb7f4('0x2'));var express=require('express');var router=express[_0xb7f4('0x3')]();var fs_extra=require(_0xb7f4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb7f4('0x5'));var controller=require(_0xb7f4('0x6'));router[_0xb7f4('0x7')]('/',auth[_0xb7f4('0x8')](),controller[_0xb7f4('0x9')]);router[_0xb7f4('0x7')](_0xb7f4('0xa'),auth['isAuthenticated'](),controller[_0xb7f4('0xb')]);router[_0xb7f4('0x7')](_0xb7f4('0xc'),auth['isAuthenticated'](),controller['getGlobalCustomFields']);router['get'](_0xb7f4('0xd'),auth[_0xb7f4('0x8')](),controller['show']);router[_0xb7f4('0x7')](_0xb7f4('0xe'),auth['isAuthenticated'](),controller[_0xb7f4('0xf')]);router[_0xb7f4('0x7')](_0xb7f4('0x10'),auth[_0xb7f4('0x8')](),controller[_0xb7f4('0x11')]);router[_0xb7f4('0x7')](_0xb7f4('0x12'),auth['isAuthenticated'](),controller[_0xb7f4('0x13')]);router[_0xb7f4('0x7')](_0xb7f4('0x14'),auth['isAuthenticated'](),controller['getCustomFields']);router[_0xb7f4('0x7')](_0xb7f4('0x15'),auth[_0xb7f4('0x8')](),controller[_0xb7f4('0x16')]);router['post']('/',auth[_0xb7f4('0x8')](),controller[_0xb7f4('0x17')]);router[_0xb7f4('0x18')](_0xb7f4('0xe'),auth['isAuthenticated'](),controller[_0xb7f4('0x19')]);router[_0xb7f4('0x18')](_0xb7f4('0x10'),auth[_0xb7f4('0x8')](),controller['addContacts']);router[_0xb7f4('0x18')](_0xb7f4('0x14'),auth[_0xb7f4('0x8')](),controller[_0xb7f4('0x1a')]);router[_0xb7f4('0x18')](_0xb7f4('0x15'),auth[_0xb7f4('0x8')](),controller[_0xb7f4('0x1b')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb7f4('0x1c')]);router['delete'](_0xb7f4('0xd'),auth[_0xb7f4('0x8')](),controller[_0xb7f4('0x1d')]);router[_0xb7f4('0x1e')](_0xb7f4('0xe'),auth[_0xb7f4('0x8')](),controller['removeDispositions']);router[_0xb7f4('0x1e')](_0xb7f4('0x15'),auth[_0xb7f4('0x8')](),controller['removeAgents']);module[_0xb7f4('0x1f')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 256410e..673b08e 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 _0x4069=['exports','getDataValue','field','STRING','sequelize'];(function(_0x471fd4,_0x4ea503){var _0x412a2e=function(_0x4c4696){while(--_0x4c4696){_0x471fd4['push'](_0x471fd4['shift']());}};_0x412a2e(++_0x4ea503);}(_0x4069,0x176));var _0x9406=function(_0x8bcfe6,_0x21cc95){_0x8bcfe6=_0x8bcfe6-0x0;var _0x445f80=_0x4069[_0x8bcfe6];return _0x445f80;};'use strict';var Sequelize=require(_0x9406('0x0'));module[_0x9406('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x58043b){return this[_0x9406('0x2')](_0x9406('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x9406('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x4648=['STRING','VIRTUAL','field'];(function(_0x5cfe09,_0x24c91d){var _0x334848=function(_0x39f199){while(--_0x39f199){_0x5cfe09['push'](_0x5cfe09['shift']());}};_0x334848(++_0x24c91d);}(_0x4648,0x175));var _0x8464=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x4648[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8464('0x0')],'get':function(_0x1a17c7){return this['getDataValue'](_0x8464('0x1'));}},'field':{'type':Sequelize[_0x8464('0x2')],'allowNull':![]},'operator':{'type':Sequelize[_0x8464('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x8464('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 19f128b..145c3fe 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x46562a,_0x3d3448){var _0x1c534d=function(_0x27cef7){while(--_0x27cef7){_0x46562a['push'](_0x46562a['shift']());}};_0x1c534d(++_0x3d3448);}(_0x7a54,0x106));var _0x47a5=function(_0x313ac6,_0x2315d6){_0x313ac6=_0x313ac6-0x0;var _0x3cdf96=_0x7a54[_0x313ac6];return _0x3cdf96;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _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(_0x3a5adf,_0x39324d){var _0x227ffd=function(_0x1c42c4){while(--_0x1c42c4){_0x3a5adf['push'](_0x3a5adf['shift']());}};_0x227ffd(++_0x39324d);}(_0x7a54,0x106));var _0x47a5=function(_0x1c06ca,_0x2a9898){_0x1c06ca=_0x1c06ca-0x0;var _0x44fe8b=_0x7a54[_0x1c06ca];return _0x44fe8b;};'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 e7bc395..ed193ad 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 _0xb122=['exports','define','Condition','lodash','util','api','moment','request-promise','path','../../config/environment','./condition.attributes'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb122,0xc9));var _0x2b12=function(_0x4aeb44,_0x419730){_0x4aeb44=_0x4aeb44-0x0;var _0x1aa240=_0xb122[_0x4aeb44];return _0x1aa240;};'use strict';var _=require(_0x2b12('0x0'));var util=require(_0x2b12('0x1'));var logger=require('../../config/logger')(_0x2b12('0x2'));var moment=require(_0x2b12('0x3'));var BPromise=require('bluebird');var rp=require(_0x2b12('0x4'));var fs=require('fs');var path=require(_0x2b12('0x5'));var rimraf=require('rimraf');var config=require(_0x2b12('0x6'));var attributes=require(_0x2b12('0x7'));module[_0x2b12('0x8')]=function(_0x3f7f77,_0xe59908){return _0x3f7f77[_0x2b12('0x9')](_0x2b12('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7a0=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define','lodash'];(function(_0x21568a,_0x55d0fa){var _0x4ce987=function(_0x3458c7){while(--_0x3458c7){_0x21568a['push'](_0x21568a['shift']());}};_0x4ce987(++_0x55d0fa);}(_0xe7a0,0x178));var _0x0e7a=function(_0x3c018c,_0x329e42){_0x3c018c=_0x3c018c-0x0;var _0xe3e268=_0xe7a0[_0x3c018c];return _0xe3e268;};'use strict';var _=require(_0x0e7a('0x0'));var util=require(_0x0e7a('0x1'));var logger=require(_0x0e7a('0x2'))(_0x0e7a('0x3'));var moment=require(_0x0e7a('0x4'));var BPromise=require(_0x0e7a('0x5'));var rp=require(_0x0e7a('0x6'));var fs=require('fs');var path=require(_0x0e7a('0x7'));var rimraf=require(_0x0e7a('0x8'));var config=require(_0x0e7a('0x9'));var attributes=require(_0x0e7a('0xa'));module[_0x0e7a('0xb')]=function(_0x42be35,_0x4109ea){return _0x42be35[_0x0e7a('0xc')]('Condition',attributes,{'tableName':'tools_conditions','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 f37d1f9..6411928 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 _0x0269=['message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4b19b3,_0x59b162){var _0x2780e7=function(_0x5edd11){while(--_0x5edd11){_0x4b19b3['push'](_0x4b19b3['shift']());}};_0x2780e7(++_0x59b162);}(_0x0269,0xa9));var _0x9026=function(_0x716dfb,_0x37d935){_0x716dfb=_0x716dfb-0x0;var _0x322328=_0x0269[_0x716dfb];return _0x322328;};'use strict';var _=require(_0x9026('0x0'));var util=require(_0x9026('0x1'));var moment=require('moment');var BPromise=require(_0x9026('0x2'));var rs=require(_0x9026('0x3'));var fs=require('fs');var Redis=require(_0x9026('0x4'));var db=require(_0x9026('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9026('0x6'))('rpc');var config=require(_0x9026('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9026('0x8')][_0x9026('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f2f8a,_0x5ed2b9,_0x4f780b){return new BPromise(function(_0x4aaa32,_0x10124f){return client[_0x9026('0xa')](_0x2f2f8a,_0x4f780b)[_0x9026('0xb')](function(_0x522663){logger[_0x9026('0xc')](_0x9026('0xd'),_0x5ed2b9,_0x9026('0xe'));logger[_0x9026('0xf')](_0x9026('0x10'),_0x5ed2b9,_0x9026('0xe'),JSON[_0x9026('0x11')](_0x522663));if(_0x522663[_0x9026('0x12')]){if(_0x522663['error'][_0x9026('0x13')]===0x1f4){logger[_0x9026('0x12')]('Condition,\x20%s,\x20%s',_0x5ed2b9,_0x522663[_0x9026('0x12')]['message']);return _0x10124f(_0x522663[_0x9026('0x12')][_0x9026('0x14')]);}logger[_0x9026('0x12')](_0x9026('0xd'),_0x5ed2b9,_0x522663[_0x9026('0x12')][_0x9026('0x14')]);return _0x4aaa32(_0x522663['error']['message']);}else{logger[_0x9026('0xc')]('Condition,\x20%s,\x20%s',_0x5ed2b9,_0x9026('0xe'));_0x4aaa32(_0x522663['result'][_0x9026('0x14')]);}})['catch'](function(_0x5c7ac7){logger['error'](_0x9026('0xd'),_0x5ed2b9,_0x5c7ac7);_0x10124f(_0x5c7ac7);});});} \ No newline at end of file +var _0x9f19=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0xc9cd47,_0x35a546){var _0x26827e=function(_0x32d967){while(--_0x32d967){_0xc9cd47['push'](_0xc9cd47['shift']());}};_0x26827e(++_0x35a546);}(_0x9f19,0xb7));var _0x99f1=function(_0x1e39e5,_0x45fc68){_0x1e39e5=_0x1e39e5-0x0;var _0x1a1f5c=_0x9f19[_0x1e39e5];return _0x1a1f5c;};'use strict';var _=require(_0x99f1('0x0'));var util=require(_0x99f1('0x1'));var moment=require(_0x99f1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x99f1('0x3'));var db=require(_0x99f1('0x4'))['db'];var utils=require(_0x99f1('0x5'));var logger=require(_0x99f1('0x6'))(_0x99f1('0x7'));var config=require(_0x99f1('0x8'));var jayson=require(_0x99f1('0x9'));var client=jayson[_0x99f1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35534e,_0xf09e4,_0x46d0fa){return new BPromise(function(_0x5e1da8,_0x10b580){return client[_0x99f1('0xb')](_0x35534e,_0x46d0fa)['then'](function(_0x3a2c64){logger['info'](_0x99f1('0xc'),_0xf09e4,_0x99f1('0xd'));logger[_0x99f1('0xe')](_0x99f1('0xf'),_0xf09e4,_0x99f1('0xd'),JSON[_0x99f1('0x10')](_0x3a2c64));if(_0x3a2c64[_0x99f1('0x11')]){if(_0x3a2c64[_0x99f1('0x11')]['code']===0x1f4){logger[_0x99f1('0x11')]('Condition,\x20%s,\x20%s',_0xf09e4,_0x3a2c64[_0x99f1('0x11')][_0x99f1('0x12')]);return _0x10b580(_0x3a2c64[_0x99f1('0x11')][_0x99f1('0x12')]);}logger[_0x99f1('0x11')](_0x99f1('0xc'),_0xf09e4,_0x3a2c64['error']['message']);return _0x5e1da8(_0x3a2c64[_0x99f1('0x11')]['message']);}else{logger[_0x99f1('0x13')](_0x99f1('0xc'),_0xf09e4,_0x99f1('0xd'));_0x5e1da8(_0x3a2c64['result'][_0x99f1('0x12')]);}})[_0x99f1('0x14')](function(_0x30fe07){logger[_0x99f1('0x11')]('Condition,\x20%s,\x20%s',_0xf09e4,_0x30fe07);_0x10b580(_0x30fe07);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 12b1499..662e147 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 _0x6784=['../../components/interaction/service','../../config/environment','./condition.controller','/:id','isAuthenticated','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x294f62,_0x21a571){var _0xfb269d=function(_0x396524){while(--_0x396524){_0x294f62['push'](_0x294f62['shift']());}};_0xfb269d(++_0x21a571);}(_0x6784,0xf6));var _0x4678=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x6784[_0x4ae625];return _0x31accf;};'use strict';var multer=require(_0x4678('0x0'));var util=require(_0x4678('0x1'));var path=require('path');var timeout=require(_0x4678('0x2'));var express=require('express');var router=express[_0x4678('0x3')]();var fs_extra=require(_0x4678('0x4'));var auth=require(_0x4678('0x5'));var interaction=require(_0x4678('0x6'));var config=require(_0x4678('0x7'));var controller=require(_0x4678('0x8'));router['put'](_0x4678('0x9'),auth[_0x4678('0xa')](),controller[_0x4678('0xb')]);router['delete'](_0x4678('0x9'),auth[_0x4678('0xa')](),controller[_0x4678('0xc')]);module[_0x4678('0xd')]=router; \ No newline at end of file +var _0xb877=['../../components/interaction/service','./condition.controller','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4d2f00,_0x4e94d5){var _0x2d7b7f=function(_0x18fa08){while(--_0x18fa08){_0x4d2f00['push'](_0x4d2f00['shift']());}};_0x2d7b7f(++_0x4e94d5);}(_0xb877,0x17f));var _0x7b87=function(_0x25cbd6,_0x21853a){_0x25cbd6=_0x25cbd6-0x0;var _0x16052d=_0xb877[_0x25cbd6];return _0x16052d;};'use strict';var multer=require(_0x7b87('0x0'));var util=require(_0x7b87('0x1'));var path=require(_0x7b87('0x2'));var timeout=require('connect-timeout');var express=require(_0x7b87('0x3'));var router=express[_0x7b87('0x4')]();var fs_extra=require(_0x7b87('0x5'));var auth=require(_0x7b87('0x6'));var interaction=require(_0x7b87('0x7'));var config=require('../../config/environment');var controller=require(_0x7b87('0x8'));router['put'](_0x7b87('0x9'),auth[_0x7b87('0xa')](),controller[_0x7b87('0xb')]);router[_0x7b87('0xc')](_0x7b87('0x9'),auth[_0x7b87('0xa')](),controller[_0x7b87('0xd')]);module[_0x7b87('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 45bf496..55205bf 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 _0x9b15=['INTEGER','sequelize','exports','STRING'];(function(_0x44e16f,_0x22136c){var _0x4d76e7=function(_0x30740d){while(--_0x30740d){_0x44e16f['push'](_0x44e16f['shift']());}};_0x4d76e7(++_0x22136c);}(_0x9b15,0x191));var _0x59b1=function(_0xb3e073,_0x3f4116){_0xb3e073=_0xb3e073-0x0;var _0x1ddb4a=_0x9b15[_0xb3e073];return _0x1ddb4a;};'use strict';var Sequelize=require(_0x59b1('0x0'));module[_0x59b1('0x1')]={'name':{'type':Sequelize[_0x59b1('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x59b1('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x59b1('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xa468=['name','STRING'];(function(_0xa2b098,_0x461a08){var _0x29502e=function(_0x43291a){while(--_0x43291a){_0xa2b098['push'](_0xa2b098['shift']());}};_0x29502e(++_0x461a08);}(_0xa468,0x1e3));var _0x8a46=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa468[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8a46('0x0')],'allowNull':![],'unique':_0x8a46('0x1')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x8a46('0x0')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 31850fb..18a57d8 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 _0x781d=['find','CmContactHasItem','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','get','stack','name','send','index','ContactItemType','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','type','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x1a4fbc,_0x33f3ba){var _0x1772a2=function(_0x3c0e15){while(--_0x3c0e15){_0x1a4fbc['push'](_0x1a4fbc['shift']());}};_0x1772a2(++_0x33f3ba);}(_0x781d,0x14a));var _0xd781=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x781d[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){var _0x221f14=_0x31bf57[_0xd781('0x27')]({'plain':!![]});var _0x10940b='ContactItemTypes';return db['UserProfileResource'][_0xd781('0x25')]({'where':{'type':_0x10940b,'resourceId':_0x221f14['id']}})[_0xd781('0x26')](function(){return _0x31bf57;});})[_0xd781('0x26')](function(){_0x101480['status'](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x5a431b,_0x47c609){return function(_0x1e29c8){if(!_0x1e29c8){_0x5a431b['sendStatus'](0x194);}return _0x1e29c8;};}function handleError(_0x3e868,_0x123a6a){_0x123a6a=_0x123a6a||0x1f4;return function(_0x5c3848){logger['error'](_0x5c3848[_0xd781('0x28')]);if(_0x5c3848['name']){delete _0x5c3848[_0xd781('0x29')];}_0x3e868['status'](_0x123a6a)[_0xd781('0x2a')](_0x5c3848);};}exports[_0xd781('0x2b')]=function(_0x556127,_0x54521e){var _0x432d14={},_0x29e81a={},_0x1c7d83={'count':0x0,'rows':[]};var _0x5a389c=_['map'](db[_0xd781('0x2c')][_0xd781('0x2d')],function(_0x36a889){return{'name':_0x36a889['fieldName'],'type':_0x36a889['type'][_0xd781('0x2e')]};});_0x29e81a[_0xd781('0x2f')]=_['map'](_0x5a389c,_0xd781('0x29'));_0x29e81a[_0xd781('0x30')]=_['keys'](_0x556127[_0xd781('0x30')]);_0x29e81a[_0xd781('0x31')]=_[_0xd781('0x32')](_0x29e81a[_0xd781('0x2f')],_0x29e81a['query']);_0x432d14[_0xd781('0x33')]=_[_0xd781('0x32')](_0x29e81a[_0xd781('0x2f')],qs[_0xd781('0x34')](_0x556127['query'][_0xd781('0x34')]));_0x432d14[_0xd781('0x33')]=_0x432d14['attributes'][_0xd781('0x35')]?_0x432d14['attributes']:_0x29e81a[_0xd781('0x2f')];if(!_0x556127[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x36'))){_0x432d14[_0xd781('0x1e')]=qs['limit'](_0x556127[_0xd781('0x30')]['limit']);_0x432d14[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x556127['query'][_0xd781('0x1c')]);}_0x432d14[_0xd781('0x37')]=qs['sort'](_0x556127[_0xd781('0x30')][_0xd781('0x38')]);_0x432d14[_0xd781('0x39')]=qs['filters'](_[_0xd781('0x3a')](_0x556127[_0xd781('0x30')],_0x29e81a[_0xd781('0x31')]),_0x5a389c);if(_0x556127[_0xd781('0x30')][_0xd781('0x3b')]){_0x432d14[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x432d14[_0xd781('0x39')],{'$or':_[_0xd781('0x3d')](_0x5a389c,function(_0x5c6026){if(_0x5c6026[_0xd781('0x3e')]!=='VIRTUAL'){var _0x2504ac={};_0x2504ac[_0x5c6026[_0xd781('0x29')]]={'$like':'%'+_0x556127['query'][_0xd781('0x3b')]+'%'};return _0x2504ac;}})});}_0x432d14=_[_0xd781('0x3c')]({},_0x432d14,_0x556127[_0xd781('0x3f')]);var _0x402c9c={'where':_0x432d14['where']};return db[_0xd781('0x2c')]['count'](_0x402c9c)[_0xd781('0x26')](function(_0xcdaacf){_0x1c7d83['count']=_0xcdaacf;if(_0x556127['query'][_0xd781('0x40')]){_0x432d14[_0xd781('0x41')]=[{'all':!![]}];}return db[_0xd781('0x2c')][_0xd781('0x42')](_0x432d14);})['then'](function(_0x46e7f6){_0x1c7d83[_0xd781('0x43')]=_0x46e7f6;return _0x1c7d83;})['then'](respondWithFilteredResult(_0x54521e,_0x432d14))['catch'](handleError(_0x54521e,null));};exports[_0xd781('0x44')]=function(_0x1d901e,_0xaa552){var _0x4e2eea={'raw':!![],'where':{'id':_0x1d901e[_0xd781('0x45')]['id']}},_0x594f85={};_0x594f85[_0xd781('0x2f')]=_[_0xd781('0x46')](db[_0xd781('0x2c')][_0xd781('0x2d')]);_0x594f85[_0xd781('0x30')]=_['keys'](_0x1d901e['query']);_0x594f85[_0xd781('0x31')]=_[_0xd781('0x32')](_0x594f85[_0xd781('0x2f')],_0x594f85[_0xd781('0x30')]);_0x4e2eea[_0xd781('0x33')]=_['intersection'](_0x594f85[_0xd781('0x2f')],qs[_0xd781('0x34')](_0x1d901e[_0xd781('0x30')]['fields']));_0x4e2eea[_0xd781('0x33')]=_0x4e2eea[_0xd781('0x33')][_0xd781('0x35')]?_0x4e2eea['attributes']:_0x594f85[_0xd781('0x2f')];if(_0x1d901e[_0xd781('0x30')]['includeAll']){_0x4e2eea['include']=[{'all':!![]}];}_0x4e2eea=_[_0xd781('0x3c')]({},_0x4e2eea,_0x1d901e[_0xd781('0x3f')]);return db[_0xd781('0x2c')]['find'](_0x4e2eea)[_0xd781('0x26')](handleEntityNotFound(_0xaa552,null))[_0xd781('0x26')](respondWithResult(_0xaa552,null))[_0xd781('0x47')](handleError(_0xaa552,null));};exports[_0xd781('0x48')]=function(_0x336d30,_0x3828ad){return db[_0xd781('0x2c')]['create'](_0x336d30[_0xd781('0x49')],{})[_0xd781('0x26')](function(_0x1d54bd){var _0x4c7cb6=_0x336d30[_0xd781('0x4a')][_0xd781('0x27')]({'plain':!![]});if(!_0x4c7cb6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c7cb6[_0xd781('0x4b')]===_0xd781('0x4a')){var _0x41caac=_0x1d54bd[_0xd781('0x27')]({'plain':!![]});var _0x42a2f9='ContactItemTypes';return db[_0xd781('0x4c')]['find']({'where':{'name':_0x42a2f9,'userProfileId':_0x4c7cb6[_0xd781('0x4d')]},'raw':!![]})['then'](function(_0x2ce1f6){if(_0x2ce1f6&&_0x2ce1f6[_0xd781('0x4e')]===0x0){return db['UserProfileResource'][_0xd781('0x48')]({'name':_0x41caac['name'],'resourceId':_0x41caac['id'],'type':_0x2ce1f6['name'],'sectionId':_0x2ce1f6['id']},{})['then'](function(){return _0x1d54bd;});}else{return _0x1d54bd;}})[_0xd781('0x47')](function(_0x174fcd){logger['error'](_0xd781('0x4f'),_0x174fcd);throw _0x174fcd;});}return _0x1d54bd;})['then'](respondWithResult(_0x3828ad,0xc9))[_0xd781('0x47')](handleError(_0x3828ad,null));};exports[_0xd781('0x24')]=function(_0x39d47d,_0x19a6c2){if(_0x39d47d['body']['id']){delete _0x39d47d[_0xd781('0x49')]['id'];}return db['ContactItemType'][_0xd781('0x50')]({'where':{'id':_0x39d47d['params']['id']}})[_0xd781('0x26')](handleEntityNotFound(_0x19a6c2,null))[_0xd781('0x26')](saveUpdates(_0x39d47d['body'],null))[_0xd781('0x26')](respondWithResult(_0x19a6c2,null))[_0xd781('0x47')](handleError(_0x19a6c2,null));};exports[_0xd781('0x25')]=function(_0x32fd9f,_0xfc466c){return db[_0xd781('0x2c')]['find']({'where':{'id':_0x32fd9f['params']['id']}})[_0xd781('0x26')](handleEntityNotFound(_0xfc466c,null))[_0xd781('0x26')](db[_0xd781('0x51')][_0xd781('0x24')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x32fd9f['params']['id']}}))[_0xd781('0x26')](removeEntity(_0xfc466c,null))['catch'](handleError(_0xfc466c,null));}; \ No newline at end of file +var _0xea28=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','get','ContactItemTypes','sendStatus','stack','name','send','index','map','ContactItemType','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','intersection','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','UserProfileResource','body','params','destroy','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0xd8db13,_0x3cbe71){var _0x3c4c56=function(_0x5b89e0){while(--_0x5b89e0){_0xd8db13['push'](_0xd8db13['shift']());}};_0x3c4c56(++_0x3cbe71);}(_0xea28,0x13a));var _0x8ea2=function(_0x2b83a4,_0x55eaee){_0x2b83a4=_0x2b83a4-0x0;var _0x2235ce=_0xea28[_0x2b83a4];return _0x2235ce;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require(_0x8ea2('0x1'));var zipdir=require(_0x8ea2('0x2'));var jsonpatch=require(_0x8ea2('0x3'));var rp=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var BPromise=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var util=require('util');var path=require(_0x8ea2('0x8'));var sox=require(_0x8ea2('0x9'));var csv=require(_0x8ea2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea2('0xb'));var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0xa'));var querystring=require(_0x8ea2('0x11'));var Papa=require(_0x8ea2('0x12'));var Redis=require(_0x8ea2('0x13'));var authService=require(_0x8ea2('0x14'));var qs=require(_0x8ea2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ea2('0x16'))(_0x8ea2('0x17'));var utils=require(_0x8ea2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8ea2('0x19'));var db=require(_0x8ea2('0x1a'))['db'];function respondWithStatusCode(_0x1dfb6e,_0x10aead){_0x10aead=_0x10aead||0xcc;return function(_0xe47c0e){if(_0xe47c0e){return _0x1dfb6e['sendStatus'](_0x10aead);}return _0x1dfb6e[_0x8ea2('0x1b')](_0x10aead)['end']();};}function respondWithResult(_0x4b2192,_0x772bad){_0x772bad=_0x772bad||0xc8;return function(_0x4726a7){if(_0x4726a7){return _0x4b2192[_0x8ea2('0x1b')](_0x772bad)[_0x8ea2('0x1c')](_0x4726a7);}};}function respondWithFilteredResult(_0x393faf,_0xbb9bd1){return function(_0x3cff96){if(_0x3cff96){var _0x11f5e8=typeof _0xbb9bd1[_0x8ea2('0x1d')]===_0x8ea2('0x1e')&&typeof _0xbb9bd1[_0x8ea2('0x1f')]===_0x8ea2('0x1e');var _0x3bc774=_0x3cff96[_0x8ea2('0x20')];var _0x1b64cf=_0x11f5e8?0x0:_0xbb9bd1[_0x8ea2('0x1d')];var _0x467045=_0x11f5e8?_0x3cff96[_0x8ea2('0x20')]:_0xbb9bd1[_0x8ea2('0x1d')]+_0xbb9bd1[_0x8ea2('0x1f')];var _0x134cbe;if(_0x467045>=_0x3bc774){_0x467045=_0x3bc774;_0x134cbe=0xc8;}else{_0x134cbe=0xce;}_0x393faf[_0x8ea2('0x1b')](_0x134cbe);return _0x393faf['set']('Content-Range',_0x1b64cf+'-'+_0x467045+'/'+_0x3bc774)[_0x8ea2('0x1c')](_0x3cff96);}return null;};}function patchUpdates(_0x248c18){return function(_0x29151a){try{jsonpatch['apply'](_0x29151a,_0x248c18,!![]);}catch(_0x46f4fe){return BPromise[_0x8ea2('0x21')](_0x46f4fe);}return _0x29151a['save']();};}function saveUpdates(_0x3d593b,_0x283f00){return function(_0x37229a){if(_0x37229a){return _0x37229a[_0x8ea2('0x22')](_0x3d593b)[_0x8ea2('0x23')](function(_0xe5c943){return _0xe5c943;});}return null;};}function removeEntity(_0x199417,_0x1e4cc9){return function(_0x18ec34){if(_0x18ec34){return _0x18ec34['destroy']()[_0x8ea2('0x23')](function(){var _0x4f48bd=_0x18ec34[_0x8ea2('0x24')]({'plain':!![]});var _0x42bec8=_0x8ea2('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x42bec8,'resourceId':_0x4f48bd['id']}})[_0x8ea2('0x23')](function(){return _0x18ec34;});})['then'](function(){_0x199417[_0x8ea2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3be291,_0x12fa37){return function(_0x21c526){if(!_0x21c526){_0x3be291[_0x8ea2('0x26')](0x194);}return _0x21c526;};}function handleError(_0x4e1b90,_0x5ce1d4){_0x5ce1d4=_0x5ce1d4||0x1f4;return function(_0xacaa6c){logger['error'](_0xacaa6c[_0x8ea2('0x27')]);if(_0xacaa6c[_0x8ea2('0x28')]){delete _0xacaa6c[_0x8ea2('0x28')];}_0x4e1b90[_0x8ea2('0x1b')](_0x5ce1d4)[_0x8ea2('0x29')](_0xacaa6c);};}exports[_0x8ea2('0x2a')]=function(_0x32e225,_0x316707){var _0x19e868={},_0x9c5fac={},_0x56d914={'count':0x0,'rows':[]};var _0x5b7ff9=_[_0x8ea2('0x2b')](db[_0x8ea2('0x2c')]['rawAttributes'],function(_0x4a110f){return{'name':_0x4a110f[_0x8ea2('0x2d')],'type':_0x4a110f['type'][_0x8ea2('0x2e')]};});_0x9c5fac[_0x8ea2('0x2f')]=_['map'](_0x5b7ff9,_0x8ea2('0x28'));_0x9c5fac[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x32e225['query']);_0x9c5fac['filters']=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],_0x9c5fac[_0x8ea2('0x30')]);_0x19e868[_0x8ea2('0x32')]=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],qs[_0x8ea2('0x33')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x19e868[_0x8ea2('0x32')]=_0x19e868[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x19e868[_0x8ea2('0x32')]:_0x9c5fac['model'];if(!_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x35')](_0x8ea2('0x36'))){_0x19e868[_0x8ea2('0x1f')]=qs['limit'](_0x32e225[_0x8ea2('0x30')]['limit']);_0x19e868[_0x8ea2('0x1d')]=qs[_0x8ea2('0x1d')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x1d')]);}_0x19e868['order']=qs[_0x8ea2('0x37')](_0x32e225['query']['sort']);_0x19e868[_0x8ea2('0x38')]=qs['filters'](_[_0x8ea2('0x39')](_0x32e225[_0x8ea2('0x30')],_0x9c5fac[_0x8ea2('0x3a')]),_0x5b7ff9);if(_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x3b')]){_0x19e868['where']=_[_0x8ea2('0x3c')](_0x19e868['where'],{'$or':_[_0x8ea2('0x2b')](_0x5b7ff9,function(_0x282f00){if(_0x282f00[_0x8ea2('0x3d')]!==_0x8ea2('0x3e')){var _0x4f9a8c={};_0x4f9a8c[_0x282f00[_0x8ea2('0x28')]]={'$like':'%'+_0x32e225['query'][_0x8ea2('0x3b')]+'%'};return _0x4f9a8c;}})});}_0x19e868=_['merge']({},_0x19e868,_0x32e225[_0x8ea2('0x3f')]);var _0x450e8f={'where':_0x19e868[_0x8ea2('0x38')]};return db[_0x8ea2('0x2c')][_0x8ea2('0x20')](_0x450e8f)[_0x8ea2('0x23')](function(_0x2f4fa8){_0x56d914['count']=_0x2f4fa8;if(_0x32e225['query'][_0x8ea2('0x40')]){_0x19e868['include']=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x19e868);})[_0x8ea2('0x23')](function(_0x5d9ba0){_0x56d914[_0x8ea2('0x41')]=_0x5d9ba0;return _0x56d914;})[_0x8ea2('0x23')](respondWithFilteredResult(_0x316707,_0x19e868))[_0x8ea2('0x42')](handleError(_0x316707,null));};exports[_0x8ea2('0x43')]=function(_0x989d9b,_0x8f700f){var _0x3b2219={'raw':!![],'where':{'id':_0x989d9b['params']['id']}},_0x348b17={};_0x348b17[_0x8ea2('0x2f')]=_[_0x8ea2('0x31')](db[_0x8ea2('0x2c')]['rawAttributes']);_0x348b17[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x989d9b[_0x8ea2('0x30')]);_0x348b17[_0x8ea2('0x3a')]=_[_0x8ea2('0x44')](_0x348b17['model'],_0x348b17[_0x8ea2('0x30')]);_0x3b2219[_0x8ea2('0x32')]=_[_0x8ea2('0x44')](_0x348b17['model'],qs[_0x8ea2('0x33')](_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x3b2219[_0x8ea2('0x32')]=_0x3b2219[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x3b2219[_0x8ea2('0x32')]:_0x348b17[_0x8ea2('0x2f')];if(_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x40')]){_0x3b2219[_0x8ea2('0x45')]=[{'all':!![]}];}_0x3b2219=_[_0x8ea2('0x3c')]({},_0x3b2219,_0x989d9b[_0x8ea2('0x3f')]);return db[_0x8ea2('0x2c')]['find'](_0x3b2219)[_0x8ea2('0x23')](handleEntityNotFound(_0x8f700f,null))[_0x8ea2('0x23')](respondWithResult(_0x8f700f,null))[_0x8ea2('0x42')](handleError(_0x8f700f,null));};exports[_0x8ea2('0x46')]=function(_0x182a46,_0x1daa25){return db[_0x8ea2('0x2c')][_0x8ea2('0x46')](_0x182a46['body'],{})[_0x8ea2('0x23')](function(_0x37a1cf){var _0x24dddb=_0x182a46['user']['get']({'plain':!![]});if(!_0x24dddb)throw new Error(_0x8ea2('0x47'));if(_0x24dddb[_0x8ea2('0x48')]===_0x8ea2('0x49')){var _0x5e5c37=_0x37a1cf[_0x8ea2('0x24')]({'plain':!![]});var _0x315b5d=_0x8ea2('0x25');return db[_0x8ea2('0x4a')][_0x8ea2('0x4b')]({'where':{'name':_0x315b5d,'userProfileId':_0x24dddb['userProfileId']},'raw':!![]})['then'](function(_0x24a22a){if(_0x24a22a&&_0x24a22a[_0x8ea2('0x4c')]===0x0){return db[_0x8ea2('0x4d')]['create']({'name':_0x5e5c37[_0x8ea2('0x28')],'resourceId':_0x5e5c37['id'],'type':_0x24a22a[_0x8ea2('0x28')],'sectionId':_0x24a22a['id']},{})[_0x8ea2('0x23')](function(){return _0x37a1cf;});}else{return _0x37a1cf;}})['catch'](function(_0x5c6524){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c6524);throw _0x5c6524;});}return _0x37a1cf;})['then'](respondWithResult(_0x1daa25,0xc9))[_0x8ea2('0x42')](handleError(_0x1daa25,null));};exports[_0x8ea2('0x22')]=function(_0x5f56f8,_0x49cf11){if(_0x5f56f8[_0x8ea2('0x4e')]['id']){delete _0x5f56f8[_0x8ea2('0x4e')]['id'];}return db[_0x8ea2('0x2c')]['find']({'where':{'id':_0x5f56f8[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x49cf11,null))['then'](saveUpdates(_0x5f56f8[_0x8ea2('0x4e')],null))[_0x8ea2('0x23')](respondWithResult(_0x49cf11,null))[_0x8ea2('0x42')](handleError(_0x49cf11,null));};exports[_0x8ea2('0x50')]=function(_0x4728b4,_0x58674d){return db['ContactItemType']['find']({'where':{'id':_0x4728b4[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x58674d,null))[_0x8ea2('0x23')](db[_0x8ea2('0x51')][_0x8ea2('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4728b4[_0x8ea2('0x4f')]['id']}}))[_0x8ea2('0x23')](removeEntity(_0x58674d,null))['catch'](handleError(_0x58674d,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 431f5be..f247dd1 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 _0xa641=['bluebird','path','rimraf','./contactItemType.attributes','exports','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment'];(function(_0x3605d5,_0xeb9016){var _0x2c9664=function(_0x47b7fd){while(--_0x47b7fd){_0x3605d5['push'](_0x3605d5['shift']());}};_0x2c9664(++_0xeb9016);}(_0xa641,0x1db));var _0x1a64=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xa641[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0x1a64('0x0'));var util=require(_0x1a64('0x1'));var logger=require(_0x1a64('0x2'))(_0x1a64('0x3'));var moment=require(_0x1a64('0x4'));var BPromise=require(_0x1a64('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a64('0x6'));var rimraf=require(_0x1a64('0x7'));var config=require('../../config/environment');var attributes=require(_0x1a64('0x8'));module[_0x1a64('0x9')]=function(_0x39e5f0,_0x46e9e2){return _0x39e5f0['define'](_0x1a64('0xa'),attributes,{'tableName':_0x1a64('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4eab=['lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./contactItemType.attributes','define','ContactItemType','tools_contact_item_types'];(function(_0x13368b,_0x271a2a){var _0x2c7074=function(_0x456250){while(--_0x456250){_0x13368b['push'](_0x13368b['shift']());}};_0x2c7074(++_0x271a2a);}(_0x4eab,0x16b));var _0xb4ea=function(_0x4ec1ab,_0x5c4f99){_0x4ec1ab=_0x4ec1ab-0x0;var _0x16a433=_0x4eab[_0x4ec1ab];return _0x16a433;};'use strict';var _=require(_0xb4ea('0x0'));var util=require('util');var logger=require(_0xb4ea('0x1'))(_0xb4ea('0x2'));var moment=require('moment');var BPromise=require(_0xb4ea('0x3'));var rp=require(_0xb4ea('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb4ea('0x5'));var config=require(_0xb4ea('0x6'));var attributes=require(_0xb4ea('0x7'));module['exports']=function(_0x20dc3a,_0x1168b2){return _0x20dc3a[_0xb4ea('0x8')](_0xb4ea('0x9'),attributes,{'tableName':_0xb4ea('0xa'),'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 fc82ec6..b9d293d 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 _0xf51f=['../../config/logger','rpc','../../config/environment','client','request','then','info','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ContactItemType,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf51f,0x191));var _0xff51=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xf51f[_0x455c6c];return _0x488242;};'use strict';var _=require('lodash');var util=require(_0xff51('0x0'));var moment=require(_0xff51('0x1'));var BPromise=require(_0xff51('0x2'));var rs=require(_0xff51('0x3'));var fs=require('fs');var Redis=require(_0xff51('0x4'));var db=require(_0xff51('0x5'))['db'];var utils=require(_0xff51('0x6'));var logger=require(_0xff51('0x7'))(_0xff51('0x8'));var config=require(_0xff51('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xff51('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2993eb,_0x3f0a14,_0x3bacd7){return new BPromise(function(_0x1842cd,_0x51621a){return client[_0xff51('0xb')](_0x2993eb,_0x3bacd7)[_0xff51('0xc')](function(_0x222cb7){logger[_0xff51('0xd')]('ContactItemType,\x20%s,\x20%s',_0x3f0a14,'request\x20sent');logger[_0xff51('0xe')](_0xff51('0xf'),_0x3f0a14,_0xff51('0x10'),JSON[_0xff51('0x11')](_0x222cb7));if(_0x222cb7['error']){if(_0x222cb7[_0xff51('0x12')][_0xff51('0x13')]===0x1f4){logger['error']('ContactItemType,\x20%s,\x20%s',_0x3f0a14,_0x222cb7['error'][_0xff51('0x14')]);return _0x51621a(_0x222cb7[_0xff51('0x12')]['message']);}logger[_0xff51('0x12')]('ContactItemType,\x20%s,\x20%s',_0x3f0a14,_0x222cb7['error'][_0xff51('0x14')]);return _0x1842cd(_0x222cb7[_0xff51('0x12')][_0xff51('0x14')]);}else{logger[_0xff51('0xd')](_0xff51('0x15'),_0x3f0a14,_0xff51('0x10'));_0x1842cd(_0x222cb7[_0xff51('0x16')][_0xff51('0x14')]);}})[_0xff51('0x17')](function(_0x1cc92f){logger[_0xff51('0x12')](_0xff51('0x15'),_0x3f0a14,_0x1cc92f);_0x51621a(_0x1cc92f);});});} \ No newline at end of file +var _0xc927=['client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x3bd578,_0x26fb60){var _0x1ee548=function(_0x3bb3ee){while(--_0x3bb3ee){_0x3bd578['push'](_0x3bd578['shift']());}};_0x1ee548(++_0x26fb60);}(_0xc927,0xea));var _0x7c92=function(_0x429550,_0x30473f){_0x429550=_0x429550-0x0;var _0x40bfac=_0xc927[_0x429550];return _0x40bfac;};'use strict';var _=require(_0x7c92('0x0'));var util=require('util');var moment=require(_0x7c92('0x1'));var BPromise=require('bluebird');var rs=require(_0x7c92('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c92('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c92('0x4'))(_0x7c92('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7c92('0x6')][_0x7c92('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1da928,_0x4ee2bf,_0x3da9a4){return new BPromise(function(_0x376635,_0x5096ca){return client[_0x7c92('0x8')](_0x1da928,_0x3da9a4)[_0x7c92('0x9')](function(_0x4decf6){logger[_0x7c92('0xa')](_0x7c92('0xb'),_0x4ee2bf,_0x7c92('0xc'));logger['debug'](_0x7c92('0xd'),_0x4ee2bf,_0x7c92('0xc'),JSON[_0x7c92('0xe')](_0x4decf6));if(_0x4decf6[_0x7c92('0xf')]){if(_0x4decf6['error'][_0x7c92('0x10')]===0x1f4){logger[_0x7c92('0xf')]('ContactItemType,\x20%s,\x20%s',_0x4ee2bf,_0x4decf6[_0x7c92('0xf')][_0x7c92('0x11')]);return _0x5096ca(_0x4decf6[_0x7c92('0xf')][_0x7c92('0x11')]);}logger[_0x7c92('0xf')](_0x7c92('0xb'),_0x4ee2bf,_0x4decf6[_0x7c92('0xf')][_0x7c92('0x11')]);return _0x376635(_0x4decf6['error'][_0x7c92('0x11')]);}else{logger[_0x7c92('0xa')](_0x7c92('0xb'),_0x4ee2bf,_0x7c92('0xc'));_0x376635(_0x4decf6[_0x7c92('0x12')]['message']);}})[_0x7c92('0x13')](function(_0x3b698d){logger[_0x7c92('0xf')](_0x7c92('0xb'),_0x4ee2bf,_0x3b698d);_0x5096ca(_0x3b698d);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 77a5695..2c07301 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 _0xa652=['index','/:id','isAuthenticated','show','post','create','put','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./contactItemType.controller','get'];(function(_0x4b8c09,_0x457761){var _0x3c1023=function(_0x303574){while(--_0x303574){_0x4b8c09['push'](_0x4b8c09['shift']());}};_0x3c1023(++_0x457761);}(_0xa652,0x116));var _0x2a65=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa652[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x2a65('0x0'));var util=require(_0x2a65('0x1'));var path=require(_0x2a65('0x2'));var timeout=require('connect-timeout');var express=require(_0x2a65('0x3'));var router=express[_0x2a65('0x4')]();var fs_extra=require(_0x2a65('0x5'));var auth=require(_0x2a65('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2a65('0x7'));var controller=require(_0x2a65('0x8'));router[_0x2a65('0x9')]('/',auth['isAuthenticated'](),controller[_0x2a65('0xa')]);router['get'](_0x2a65('0xb'),auth[_0x2a65('0xc')](),controller[_0x2a65('0xd')]);router[_0x2a65('0xe')]('/',auth[_0x2a65('0xc')](),controller[_0x2a65('0xf')]);router[_0x2a65('0x10')](_0x2a65('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x2a65('0xc')](),controller['destroy']);module[_0x2a65('0x11')]=router; \ No newline at end of file +var _0xb1c2=['Router','fs-extra','../../components/auth/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x388ed3,_0x536a7d){var _0x5043a9=function(_0x2af8b6){while(--_0x2af8b6){_0x388ed3['push'](_0x388ed3['shift']());}};_0x5043a9(++_0x536a7d);}(_0xb1c2,0x19e));var _0x2b1c=function(_0xebe6e2,_0x2f84d7){_0xebe6e2=_0xebe6e2-0x0;var _0x3e35cb=_0xb1c2[_0xebe6e2];return _0x3e35cb;};'use strict';var multer=require(_0x2b1c('0x0'));var util=require(_0x2b1c('0x1'));var path=require(_0x2b1c('0x2'));var timeout=require(_0x2b1c('0x3'));var express=require('express');var router=express[_0x2b1c('0x4')]();var fs_extra=require(_0x2b1c('0x5'));var auth=require(_0x2b1c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2b1c('0x7'));var controller=require(_0x2b1c('0x8'));router[_0x2b1c('0x9')]('/',auth[_0x2b1c('0xa')](),controller[_0x2b1c('0xb')]);router[_0x2b1c('0x9')](_0x2b1c('0xc'),auth[_0x2b1c('0xa')](),controller[_0x2b1c('0xd')]);router['post']('/',auth[_0x2b1c('0xa')](),controller['create']);router[_0x2b1c('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x2b1c('0xf')]);router[_0x2b1c('0x10')]('/:id',auth[_0x2b1c('0xa')](),controller[_0x2b1c('0x11')]);module[_0x2b1c('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index af6d959..504148b 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 _0x2032=['name','exports','STRING'];(function(_0x2b606a,_0x27c00a){var _0x50c67b=function(_0x2bd75c){while(--_0x2bd75c){_0x2b606a['push'](_0x2b606a['shift']());}};_0x50c67b(++_0x27c00a);}(_0x2032,0xd9));var _0x2203=function(_0x22dd6e,_0x9bf0a1){_0x22dd6e=_0x22dd6e-0x0;var _0x3d5fdb=_0x2032[_0x22dd6e];return _0x3d5fdb;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x45d4ef,_0x1efd65){var _0x47f268=function(_0x7479f8){while(--_0x7479f8){_0x45d4ef['push'](_0x45d4ef['shift']());}};_0x47f268(++_0x1efd65);}(_0xb10b,0x12a));var _0xbb10=function(_0x514e38,_0x18958d){_0x514e38=_0x514e38-0x0;var _0x57305d=_0xb10b[_0x514e38];return _0x57305d;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 967cffb..63c595f 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 _0x7ce5=['../../config/license/util','defaults','socket.io-emitter','redis','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','destroy','get','CustomDashboards','UserProfileResource','then','error','stack','name','send','index','map','Dashboard','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','rawAttributes','keys','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','voice','attrFaxAccounts','attrOpenchannelAccounts','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','DashboardItem','length','order','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x5da107,_0x10357c){var _0x224f15=function(_0x2b7af8){while(--_0x2b7af8){_0x5da107['push'](_0x5da107['shift']());}};_0x224f15(++_0x10357c);}(_0x7ce5,0x67));var _0x57ce=function(_0xdeb3f5,_0x13caeb){_0xdeb3f5=_0xdeb3f5-0x0;var _0x1e23e8=_0x7ce5[_0xdeb3f5];return _0x1e23e8;};'use strict';var emlformat=require(_0x57ce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x57ce('0x1'));var jsonpatch=require(_0x57ce('0x2'));var rp=require(_0x57ce('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x57ce('0x4'));var path=require(_0x57ce('0x5'));var sox=require(_0x57ce('0x6'));var csv=require(_0x57ce('0x7'));var ejs=require(_0x57ce('0x8'));var fs=require('fs');var fs_extra=require(_0x57ce('0x9'));var _=require(_0x57ce('0xa'));var squel=require(_0x57ce('0xb'));var crypto=require('crypto');var jsforce=require(_0x57ce('0xc'));var deskjs=require(_0x57ce('0xd'));var toCsv=require(_0x57ce('0x7'));var querystring=require(_0x57ce('0xe'));var Papa=require('papaparse');var Redis=require(_0x57ce('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x57ce('0x10'));var hardwareService=require(_0x57ce('0x11'));var logger=require('../../config/logger')(_0x57ce('0x12'));var utils=require(_0x57ce('0x13'));var config=require(_0x57ce('0x14'));var licenseUtil=require(_0x57ce('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x57ce('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x57ce('0x17'))(new Redis(config[_0x57ce('0x18')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x54433b,_0xe1c8e){_0xe1c8e=_0xe1c8e||0xcc;return function(_0x35384f){if(_0x35384f){return _0x54433b[_0x57ce('0x19')](_0xe1c8e);}return _0x54433b[_0x57ce('0x1a')](_0xe1c8e)[_0x57ce('0x1b')]();};}function respondWithResult(_0x3b7aca,_0x5f4c4a){_0x5f4c4a=_0x5f4c4a||0xc8;return function(_0x4607fe){if(_0x4607fe){return _0x3b7aca[_0x57ce('0x1a')](_0x5f4c4a)[_0x57ce('0x1c')](_0x4607fe);}};}function respondWithFilteredResult(_0xe24209,_0x3bf638){return function(_0x231925){if(_0x231925){var _0x3b7b3d=typeof _0x3bf638[_0x57ce('0x1d')]===_0x57ce('0x1e')&&typeof _0x3bf638[_0x57ce('0x1f')]===_0x57ce('0x1e');var _0x1a6dbd=_0x231925[_0x57ce('0x20')];var _0x1ff70d=_0x3b7b3d?0x0:_0x3bf638[_0x57ce('0x1d')];var _0x5d69b9=_0x3b7b3d?_0x231925[_0x57ce('0x20')]:_0x3bf638[_0x57ce('0x1d')]+_0x3bf638[_0x57ce('0x1f')];var _0x3c324c;if(_0x5d69b9>=_0x1a6dbd){_0x5d69b9=_0x1a6dbd;_0x3c324c=0xc8;}else{_0x3c324c=0xce;}_0xe24209[_0x57ce('0x1a')](_0x3c324c);return _0xe24209['set']('Content-Range',_0x1ff70d+'-'+_0x5d69b9+'/'+_0x1a6dbd)['json'](_0x231925);}return null;};}function patchUpdates(_0x287ec9){return function(_0xc3cc18){try{jsonpatch[_0x57ce('0x21')](_0xc3cc18,_0x287ec9,!![]);}catch(_0x4a2528){return BPromise[_0x57ce('0x22')](_0x4a2528);}return _0xc3cc18['save']();};}function saveUpdates(_0x47013c,_0x47875b){return function(_0x43c1a5){if(_0x43c1a5){return _0x43c1a5[_0x57ce('0x23')](_0x47013c)['then'](function(_0x171c0e){return _0x171c0e;});}return null;};}function removeEntity(_0x4ffa7f,_0x27c3f2){return function(_0x5b1355){if(_0x5b1355){return _0x5b1355[_0x57ce('0x24')]()['then'](function(){var _0x417bd9=_0x5b1355[_0x57ce('0x25')]({'plain':!![]});var _0xbf4ff6=_0x57ce('0x26');return db[_0x57ce('0x27')]['destroy']({'where':{'type':_0xbf4ff6,'resourceId':_0x417bd9['id']}})[_0x57ce('0x28')](function(){return _0x5b1355;});})[_0x57ce('0x28')](function(){_0x4ffa7f[_0x57ce('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc56993,_0x1fb284){return function(_0x23fb13){if(!_0x23fb13){_0xc56993[_0x57ce('0x19')](0x194);}return _0x23fb13;};}function handleError(_0x53f7ae,_0x5d5537){_0x5d5537=_0x5d5537||0x1f4;return function(_0x8c16a3){logger[_0x57ce('0x29')](_0x8c16a3[_0x57ce('0x2a')]);if(_0x8c16a3[_0x57ce('0x2b')]){delete _0x8c16a3[_0x57ce('0x2b')];}_0x53f7ae[_0x57ce('0x1a')](_0x5d5537)[_0x57ce('0x2c')](_0x8c16a3);};}exports[_0x57ce('0x2d')]=function(_0x5b77b2,_0x45035d){var _0x34c8bf={},_0x7c82d1={},_0x374036={'count':0x0,'rows':[]};var _0x1d5e26=_[_0x57ce('0x2e')](db[_0x57ce('0x2f')]['rawAttributes'],function(_0x3b5bc5){return{'name':_0x3b5bc5[_0x57ce('0x30')],'type':_0x3b5bc5[_0x57ce('0x31')][_0x57ce('0x32')]};});_0x7c82d1[_0x57ce('0x33')]=_[_0x57ce('0x2e')](_0x1d5e26,_0x57ce('0x2b'));_0x7c82d1[_0x57ce('0x34')]=_['keys'](_0x5b77b2[_0x57ce('0x34')]);_0x7c82d1[_0x57ce('0x35')]=_['intersection'](_0x7c82d1[_0x57ce('0x33')],_0x7c82d1[_0x57ce('0x34')]);_0x34c8bf['attributes']=_[_0x57ce('0x36')](_0x7c82d1[_0x57ce('0x33')],qs[_0x57ce('0x37')](_0x5b77b2['query']['fields']));_0x34c8bf[_0x57ce('0x38')]=_0x34c8bf[_0x57ce('0x38')]['length']?_0x34c8bf[_0x57ce('0x38')]:_0x7c82d1['model'];if(!_0x5b77b2['query'][_0x57ce('0x39')](_0x57ce('0x3a'))){_0x34c8bf[_0x57ce('0x1f')]=qs[_0x57ce('0x1f')](_0x5b77b2[_0x57ce('0x34')][_0x57ce('0x1f')]);_0x34c8bf[_0x57ce('0x1d')]=qs[_0x57ce('0x1d')](_0x5b77b2[_0x57ce('0x34')][_0x57ce('0x1d')]);}_0x34c8bf['order']=qs['sort'](_0x5b77b2['query'][_0x57ce('0x3b')]);_0x34c8bf['where']=qs[_0x57ce('0x35')](_['pick'](_0x5b77b2[_0x57ce('0x34')],_0x7c82d1[_0x57ce('0x35')]),_0x1d5e26);if(_0x5b77b2[_0x57ce('0x34')][_0x57ce('0x3c')]){_0x34c8bf[_0x57ce('0x3d')]=_[_0x57ce('0x3e')](_0x34c8bf[_0x57ce('0x3d')],{'$or':_[_0x57ce('0x2e')](_0x1d5e26,function(_0x260c90){if(_0x260c90[_0x57ce('0x31')]!==_0x57ce('0x3f')){var _0x29b3b0={};_0x29b3b0[_0x260c90[_0x57ce('0x2b')]]={'$like':'%'+_0x5b77b2['query'][_0x57ce('0x3c')]+'%'};return _0x29b3b0;}})});}_0x34c8bf=_[_0x57ce('0x3e')]({},_0x34c8bf,_0x5b77b2[_0x57ce('0x40')]);var _0xdb1a04={'where':_0x34c8bf[_0x57ce('0x3d')]};return db[_0x57ce('0x2f')][_0x57ce('0x20')](_0xdb1a04)[_0x57ce('0x28')](function(_0x5ab6b2){_0x374036[_0x57ce('0x20')]=_0x5ab6b2;if(_0x5b77b2[_0x57ce('0x34')][_0x57ce('0x41')]){_0x34c8bf['include']=[{'all':!![]}];}return db[_0x57ce('0x2f')][_0x57ce('0x42')](_0x34c8bf);})[_0x57ce('0x28')](function(_0x5d49b4){_0x374036[_0x57ce('0x43')]=_0x5d49b4;return _0x374036;})['then'](respondWithFilteredResult(_0x45035d,_0x34c8bf))['catch'](handleError(_0x45035d,null));};exports[_0x57ce('0x44')]=function(_0x5ec6ef,_0x1a7313){var _0x1a4dfe={'raw':![],'where':{'id':_0x5ec6ef['params']['id']}},_0x1e0dfb={};_0x1e0dfb[_0x57ce('0x33')]=_['keys'](db['Dashboard'][_0x57ce('0x45')]);_0x1e0dfb['query']=_[_0x57ce('0x46')](_0x5ec6ef['query']);_0x1e0dfb[_0x57ce('0x35')]=_[_0x57ce('0x36')](_0x1e0dfb[_0x57ce('0x33')],_0x1e0dfb[_0x57ce('0x34')]);_0x1a4dfe[_0x57ce('0x38')]=_[_0x57ce('0x36')](_0x1e0dfb[_0x57ce('0x33')],qs[_0x57ce('0x37')](_0x5ec6ef[_0x57ce('0x34')][_0x57ce('0x37')]));_0x1a4dfe['attributes']=_0x1a4dfe[_0x57ce('0x38')]['length']?_0x1a4dfe[_0x57ce('0x38')]:_0x1e0dfb[_0x57ce('0x33')];if(_0x5ec6ef[_0x57ce('0x34')][_0x57ce('0x41')]){_0x1a4dfe[_0x57ce('0x47')]=[{'all':!![]}];}_0x1a4dfe=_[_0x57ce('0x3e')]({},_0x1a4dfe,_0x5ec6ef['options']);return db[_0x57ce('0x2f')][_0x57ce('0x48')](_0x1a4dfe)[_0x57ce('0x28')](handleEntityNotFound(_0x1a7313,null))[_0x57ce('0x28')](respondWithResult(_0x1a7313,null))[_0x57ce('0x49')](handleError(_0x1a7313,null));};exports[_0x57ce('0x4a')]=function(_0x110347,_0x2c8df6){return db[_0x57ce('0x2f')]['create'](_0x110347[_0x57ce('0x4b')],{})[_0x57ce('0x28')](function(_0x31ad65){var _0x22e6ef=_0x110347[_0x57ce('0x4c')][_0x57ce('0x25')]({'plain':!![]});if(!_0x22e6ef)throw new Error(_0x57ce('0x4d'));if(_0x22e6ef[_0x57ce('0x4e')]===_0x57ce('0x4c')){var _0x5c88a0=_0x31ad65[_0x57ce('0x25')]({'plain':!![]});var _0x362663=_0x57ce('0x26');return db[_0x57ce('0x4f')][_0x57ce('0x48')]({'where':{'name':_0x362663,'userProfileId':_0x22e6ef[_0x57ce('0x50')]},'raw':!![]})[_0x57ce('0x28')](function(_0x53cf82){if(_0x53cf82&&_0x53cf82[_0x57ce('0x51')]===0x0){return db[_0x57ce('0x27')][_0x57ce('0x4a')]({'name':_0x5c88a0['name'],'resourceId':_0x5c88a0['id'],'type':_0x53cf82[_0x57ce('0x2b')],'sectionId':_0x53cf82['id']},{})['then'](function(){return _0x31ad65;});}else{return _0x31ad65;}})[_0x57ce('0x49')](function(_0x1c5d86){logger[_0x57ce('0x29')](_0x57ce('0x52'),_0x1c5d86);throw _0x1c5d86;});}return _0x31ad65;})[_0x57ce('0x28')](respondWithResult(_0x2c8df6,0xc9))[_0x57ce('0x49')](handleError(_0x2c8df6,null));};exports[_0x57ce('0x53')]=function(_0xd6eb6a,_0x4e004e){var _0x2c455f={'where':{'id':_0xd6eb6a[_0x57ce('0x54')]['id']}},_0x2a5b84={};_0x2a5b84[_0x57ce('0x33')]=_[_0x57ce('0x46')](db['Dashboard'][_0x57ce('0x45')]);_0x2c455f[_0x57ce('0x38')]=_['intersection'](_0x2a5b84[_0x57ce('0x33')],qs[_0x57ce('0x37')](_0xd6eb6a[_0x57ce('0x34')][_0x57ce('0x37')]));_0x2c455f[_0x57ce('0x38')]=_0x2c455f[_0x57ce('0x38')]['length']?_0x2c455f[_0x57ce('0x38')]:_0x2a5b84[_0x57ce('0x33')];if(_0xd6eb6a['query']['includeAll']){_0x2c455f['include']=[{'all':!![]}];}_0x2c455f=_[_0x57ce('0x3e')]({},_0x2c455f,_0xd6eb6a[_0x57ce('0x40')]);return db['Dashboard']['find'](_0x2c455f)[_0x57ce('0x28')](handleEntityNotFound(_0x4e004e,null))[_0x57ce('0x28')](function(_0x610046){if(_0x610046){var _0x2ba278=_0x610046[_0x57ce('0x25')]({'plain':!![]});_0x2ba278=qs[_0x57ce('0x55')](_0x2ba278,['id',_0x57ce('0x56'),_0x57ce('0x57')]);_0xd6eb6a['body']=_[_0x57ce('0x55')](_0xd6eb6a['body'],['id','createdAt','updatedAt']);return db[_0x57ce('0x2f')][_0x57ce('0x4a')](_[_0x57ce('0x3e')](_0x2ba278,_0xd6eb6a['body']),{'include':_0xd6eb6a[_0x57ce('0x34')][_0x57ce('0x41')]?[{'all':!![]}]:undefined})[_0x57ce('0x28')](function(_0x287dba){var _0x3ea1ee=_0xd6eb6a['user'][_0x57ce('0x25')]({'plain':!![]});if(!_0x3ea1ee)throw new Error(_0x57ce('0x4d'));if(_0x3ea1ee[_0x57ce('0x4e')]===_0x57ce('0x4c')){var _0x41d9a2=_0x287dba[_0x57ce('0x25')]({'plain':!![]});var _0x9acff8='CustomDashboards';return db[_0x57ce('0x4f')][_0x57ce('0x48')]({'where':{'name':_0x9acff8,'userProfileId':_0x3ea1ee['userProfileId']},'raw':!![]})['then'](function(_0x29fd9e){if(_0x29fd9e&&_0x29fd9e[_0x57ce('0x51')]===0x0){return db[_0x57ce('0x27')][_0x57ce('0x4a')]({'name':_0x41d9a2[_0x57ce('0x2b')],'resourceId':_0x41d9a2['id'],'type':_0x29fd9e[_0x57ce('0x2b')],'sectionId':_0x29fd9e['id']},{})[_0x57ce('0x28')](function(){return _0x287dba;});}else{return _0x287dba;}})[_0x57ce('0x49')](function(_0x20f3b3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20f3b3);throw _0x20f3b3;});}return _0x287dba;});}})[_0x57ce('0x28')](respondWithResult(_0x4e004e,0xc9))[_0x57ce('0x49')](handleError(_0x4e004e,null));};exports[_0x57ce('0x23')]=function(_0x2c0475,_0x4bf03a){if(_0x2c0475['body']['id']){delete _0x2c0475[_0x57ce('0x4b')]['id'];}return db[_0x57ce('0x2f')][_0x57ce('0x48')]({'where':{'id':_0x2c0475['params']['id']}})['then'](handleEntityNotFound(_0x4bf03a,null))[_0x57ce('0x28')](saveUpdates(_0x2c0475['body'],null))[_0x57ce('0x28')](respondWithResult(_0x4bf03a,null))[_0x57ce('0x49')](handleError(_0x4bf03a,null));};exports[_0x57ce('0x24')]=function(_0x47a580,_0x49235a){return db[_0x57ce('0x2f')][_0x57ce('0x48')]({'where':{'id':_0x47a580[_0x57ce('0x54')]['id']}})[_0x57ce('0x28')](handleEntityNotFound(_0x49235a,null))[_0x57ce('0x28')](removeEntity(_0x49235a,null))[_0x57ce('0x49')](handleError(_0x49235a,null));};function widgetAttributes(_0x3a4a39){try{switch(_0x3a4a39['type']){case _0x57ce('0x58'):return[{'name':_0x57ce('0x59'),'value':_0x3a4a39['attrUrl']||(_0x3a4a39[_0x57ce('0x5a')]&&_0x3a4a39[_0x57ce('0x5a')][0x0]?_0x3a4a39[_0x57ce('0x5a')][0x0][_0x57ce('0x5b')]:undefined)||'https://'}];case _0x57ce('0x5c'):return[{'name':_0x57ce('0x5d'),'value':_0x3a4a39[_0x57ce('0x5d')]||(_0x3a4a39['attrs']&&_0x3a4a39[_0x57ce('0x5a')][0x0]?_0x3a4a39[_0x57ce('0x5a')][0x0][_0x57ce('0x5b')]:undefined)||''}];case _0x57ce('0x5e'):return[{'name':_0x57ce('0x5f'),'value':_0x3a4a39[_0x57ce('0x5f')]||(_0x3a4a39[_0x57ce('0x5a')]&&_0x3a4a39['attrs'][0x0]?_0x3a4a39[_0x57ce('0x5a')][0x0][_0x57ce('0x5b')]:undefined)||_0x57ce('0x60')},{'name':_0x57ce('0x61'),'value':_0x3a4a39[_0x57ce('0x61')]||(_0x3a4a39['attrs']&&_0x3a4a39['attrs'][0x1]?_0x3a4a39[_0x57ce('0x5a')][0x1][_0x57ce('0x5b')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x3a4a39[_0x57ce('0x62')]||(_0x3a4a39['attrs']&&_0x3a4a39[_0x57ce('0x5a')][0x2]?_0x3a4a39['attrs'][0x2][_0x57ce('0x5b')]:undefined)||0xc}];case'counter':return[{'name':_0x57ce('0x63'),'value':_0x3a4a39[_0x57ce('0x63')]||(_0x3a4a39[_0x57ce('0x5a')]&&_0x3a4a39[_0x57ce('0x5a')][0x0]?_0x3a4a39[_0x57ce('0x5a')][0x0][_0x57ce('0x5b')]:undefined)||_0x57ce('0x64')},{'name':_0x57ce('0x65'),'value':_0x3a4a39[_0x57ce('0x65')]||(_0x3a4a39[_0x57ce('0x5a')]&&_0x3a4a39[_0x57ce('0x5a')][0x1]?_0x3a4a39[_0x57ce('0x5a')][0x1][_0x57ce('0x5b')]:undefined)||[]},{'name':_0x57ce('0x62'),'value':_0x3a4a39[_0x57ce('0x62')]||(_0x3a4a39[_0x57ce('0x5a')]&&_0x3a4a39['attrs'][0x2]?_0x3a4a39['attrs'][0x2][_0x57ce('0x5b')]:undefined)||0x14},{'name':_0x57ce('0x66'),'value':_0x3a4a39[_0x57ce('0x66')]||(_0x3a4a39['attrs']&&_0x3a4a39[_0x57ce('0x5a')][0x3]?_0x3a4a39[_0x57ce('0x5a')][0x3][_0x57ce('0x5b')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x3a4a39[_0x57ce('0x67')]||(_0x3a4a39[_0x57ce('0x5a')]&&_0x3a4a39[_0x57ce('0x5a')][0x4]?_0x3a4a39[_0x57ce('0x5a')][0x4][_0x57ce('0x5b')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x3a4a39['attrFaxAccounts']||(_0x3a4a39[_0x57ce('0x5a')]&&_0x3a4a39[_0x57ce('0x5a')][0x5]?_0x3a4a39[_0x57ce('0x5a')][0x5]['value']:undefined)||''},{'name':_0x57ce('0x68'),'value':_0x3a4a39['attrSmsAccounts']||(_0x3a4a39[_0x57ce('0x5a')]&&_0x3a4a39['attrs'][0x6]?_0x3a4a39['attrs'][0x6][_0x57ce('0x5b')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3a4a39['attrOpenchannelAccounts']||(_0x3a4a39[_0x57ce('0x5a')]&&_0x3a4a39[_0x57ce('0x5a')][0x7]?_0x3a4a39[_0x57ce('0x5a')][0x7][_0x57ce('0x5b')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3a4a39[_0x57ce('0x69')]||(_0x3a4a39[_0x57ce('0x5a')]&&_0x3a4a39[_0x57ce('0x5a')][0x8]?_0x3a4a39[_0x57ce('0x5a')][0x8][_0x57ce('0x5b')]:undefined)||''},{'name':_0x57ce('0x6a'),'value':_0x3a4a39['attrChatWebsites']||(_0x3a4a39[_0x57ce('0x5a')]&&_0x3a4a39[_0x57ce('0x5a')][0x9]?_0x3a4a39[_0x57ce('0x5a')][0x9][_0x57ce('0x5b')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x57ce('0x6b'),'value':_0x3a4a39[_0x57ce('0x6b')]||(_0x3a4a39[_0x57ce('0x5a')]&&_0x3a4a39[_0x57ce('0x5a')][0x0]?_0x3a4a39[_0x57ce('0x5a')][0x0][_0x57ce('0x5b')]:undefined)||_0x57ce('0x64')},{'name':'attrSerie2','value':_0x3a4a39[_0x57ce('0x6c')]||(_0x3a4a39[_0x57ce('0x5a')]&&_0x3a4a39[_0x57ce('0x5a')][0x1]?_0x3a4a39['attrs'][0x1][_0x57ce('0x5b')]:undefined)||null},{'name':_0x57ce('0x6d'),'value':_0x3a4a39[_0x57ce('0x6d')]||(_0x3a4a39[_0x57ce('0x5a')]&&_0x3a4a39[_0x57ce('0x5a')][0x2]?_0x3a4a39[_0x57ce('0x5a')][0x2][_0x57ce('0x5b')]:undefined)||null},{'name':_0x57ce('0x65'),'value':_0x3a4a39[_0x57ce('0x65')]||(_0x3a4a39[_0x57ce('0x5a')]&&_0x3a4a39['attrs'][0x3]?_0x3a4a39[_0x57ce('0x5a')][0x3]['value']:undefined)||[]},{'name':_0x57ce('0x66'),'value':_0x3a4a39[_0x57ce('0x66')]||(_0x3a4a39[_0x57ce('0x5a')]&&_0x3a4a39[_0x57ce('0x5a')][0x4]?_0x3a4a39['attrs'][0x4][_0x57ce('0x5b')]:undefined)||_0x57ce('0x6e')},{'name':_0x57ce('0x67'),'value':_0x3a4a39[_0x57ce('0x67')]||(_0x3a4a39['attrs']&&_0x3a4a39[_0x57ce('0x5a')][0x5]?_0x3a4a39['attrs'][0x5][_0x57ce('0x5b')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x3a4a39[_0x57ce('0x6f')]||(_0x3a4a39[_0x57ce('0x5a')]&&_0x3a4a39[_0x57ce('0x5a')][0x6]?_0x3a4a39[_0x57ce('0x5a')][0x6]['value']:undefined)||''},{'name':_0x57ce('0x68'),'value':_0x3a4a39[_0x57ce('0x68')]||(_0x3a4a39[_0x57ce('0x5a')]&&_0x3a4a39[_0x57ce('0x5a')][0x7]?_0x3a4a39[_0x57ce('0x5a')][0x7][_0x57ce('0x5b')]:undefined)||''},{'name':_0x57ce('0x70'),'value':_0x3a4a39['attrOpenchannelAccounts']||(_0x3a4a39[_0x57ce('0x5a')]&&_0x3a4a39[_0x57ce('0x5a')][0x8]?_0x3a4a39[_0x57ce('0x5a')][0x8][_0x57ce('0x5b')]:undefined)||''},{'name':_0x57ce('0x69'),'value':_0x3a4a39['attrWhatsappAccounts']||(_0x3a4a39[_0x57ce('0x5a')]&&_0x3a4a39[_0x57ce('0x5a')][0x9]?_0x3a4a39[_0x57ce('0x5a')][0x9][_0x57ce('0x5b')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3a4a39['attrChatWebsites']||(_0x3a4a39[_0x57ce('0x5a')]&&_0x3a4a39['attrs'][0xa]?_0x3a4a39['attrs'][0xa][_0x57ce('0x5b')]:undefined)||''}];case'web-report':return[{'name':_0x57ce('0x71'),'type':_0x3a4a39['reportType']||(_0x3a4a39['attrs']&&_0x3a4a39[_0x57ce('0x5a')][0x0]?_0x3a4a39[_0x57ce('0x5a')][0x0]['type']:undefined)||null,'value':_0x3a4a39[_0x57ce('0x71')]||(_0x3a4a39['attrs']&&_0x3a4a39[_0x57ce('0x5a')][0x0]?_0x3a4a39[_0x57ce('0x5a')][0x0][_0x57ce('0x5b')]:undefined)||null},{'name':_0x57ce('0x72'),'value':_0x3a4a39[_0x57ce('0x72')]||(_0x3a4a39['attrs']&&_0x3a4a39[_0x57ce('0x5a')][0x1]?_0x3a4a39[_0x57ce('0x5a')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1d4091){logger[_0x57ce('0x29')](_0x57ce('0x73'),JSON[_0x57ce('0x74')](_0x1d4091));return[];}}exports[_0x57ce('0x75')]=function(_0x171dd5,_0x44b714,_0x299334){if(_0x171dd5['body']['id']){delete _0x171dd5['body']['id'];}return db['Dashboard'][_0x57ce('0x48')]({'where':{'id':_0x171dd5['params']['id']}})[_0x57ce('0x28')](handleEntityNotFound(_0x44b714,null))['then'](function(_0x57354c){if(_0x57354c){_0x171dd5[_0x57ce('0x4b')][_0x57ce('0x76')]=_0x57354c['id'];_0x171dd5[_0x57ce('0x4b')][_0x57ce('0x5a')]=widgetAttributes(_0x171dd5[_0x57ce('0x4b')]);return db['DashboardItem']['create'](_0x171dd5['body']);}})[_0x57ce('0x28')](respondWithResult(_0x44b714,null))[_0x57ce('0x49')](handleError(_0x44b714,null));};exports[_0x57ce('0x77')]=function(_0x455f2d,_0x13103e,_0x5f03d5){var _0x50f1c1={};var _0xb35e85={};var _0x5b19e4;var _0x329373;return db[_0x57ce('0x2f')][_0x57ce('0x78')]({'where':{'id':_0x455f2d[_0x57ce('0x54')]['id']}})[_0x57ce('0x28')](handleEntityNotFound(_0x13103e,null))['then'](function(_0x3a8a15){if(_0x3a8a15){_0x5b19e4=_0x3a8a15;_0xb35e85[_0x57ce('0x33')]=_[_0x57ce('0x46')](db[_0x57ce('0x79')][_0x57ce('0x45')]);_0xb35e85[_0x57ce('0x34')]=_[_0x57ce('0x46')](_0x455f2d[_0x57ce('0x34')]);_0xb35e85[_0x57ce('0x35')]=_['intersection'](_0xb35e85[_0x57ce('0x33')],_0xb35e85[_0x57ce('0x34')]);_0x50f1c1[_0x57ce('0x38')]=_[_0x57ce('0x36')](_0xb35e85[_0x57ce('0x33')],qs[_0x57ce('0x37')](_0x455f2d[_0x57ce('0x34')]['fields']));_0x50f1c1[_0x57ce('0x38')]=_0x50f1c1['attributes'][_0x57ce('0x7a')]?_0x50f1c1['attributes']:_0xb35e85['model'];_0x50f1c1[_0x57ce('0x7b')]=qs[_0x57ce('0x3b')](_0x455f2d[_0x57ce('0x34')][_0x57ce('0x3b')]);_0x50f1c1[_0x57ce('0x3d')]=qs[_0x57ce('0x35')](_['pick'](_0x455f2d[_0x57ce('0x34')],_0xb35e85[_0x57ce('0x35')]));if(_0x455f2d[_0x57ce('0x34')]['filter']){_0x50f1c1[_0x57ce('0x3d')]=_[_0x57ce('0x3e')](_0x50f1c1[_0x57ce('0x3d')],{'$or':_[_0x57ce('0x2e')](_0x50f1c1[_0x57ce('0x38')],function(_0xc31dba){var _0x4f558e={};_0x4f558e[_0xc31dba]={'$like':'%'+_0x455f2d['query']['filter']+'%'};return _0x4f558e;})});}_0x50f1c1=_[_0x57ce('0x3e')]({},_0x50f1c1,_0x455f2d[_0x57ce('0x40')]);return _0x5b19e4[_0x57ce('0x77')](_0x50f1c1);}})['then'](function(_0x92ecf2){if(_0x92ecf2){_0x329373=_0x92ecf2[_0x57ce('0x7a')];if(!_0x455f2d[_0x57ce('0x34')][_0x57ce('0x39')](_0x57ce('0x3a'))){_0x50f1c1[_0x57ce('0x1f')]=qs['limit'](_0x455f2d[_0x57ce('0x34')][_0x57ce('0x1f')]);_0x50f1c1[_0x57ce('0x1d')]=qs[_0x57ce('0x1d')](_0x455f2d['query']['offset']);}return _0x5b19e4[_0x57ce('0x77')](_0x50f1c1);}})[_0x57ce('0x28')](function(_0xafbcae){if(_0xafbcae){return _0xafbcae?{'count':_0x329373,'rows':_0xafbcae}:null;}})[_0x57ce('0x28')](respondWithResult(_0x13103e,null))['catch'](handleError(_0x13103e,null));}; \ No newline at end of file +var _0xd579=['end','status','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','stack','name','send','map','fieldName','type','key','model','query','intersection','attributes','fields','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','Dashboard','rawAttributes','keys','length','find','catch','create','body','role','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','autoAssociation','iframe','attrUrl','attrs','value','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','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x14f711,_0x23c7ef){var _0x54c0e6=function(_0x136f8d){while(--_0x136f8d){_0x14f711['push'](_0x14f711['shift']());}};_0x54c0e6(++_0x23c7ef);}(_0xd579,0x171));var _0x9d57=function(_0x1a27ad,_0x452b76){_0x1a27ad=_0x1a27ad-0x0;var _0x40e239=_0xd579[_0x1a27ad];return _0x40e239;};'use strict';var emlformat=require(_0x9d57('0x0'));var rimraf=require(_0x9d57('0x1'));var zipdir=require(_0x9d57('0x2'));var jsonpatch=require(_0x9d57('0x3'));var rp=require(_0x9d57('0x4'));var moment=require(_0x9d57('0x5'));var BPromise=require(_0x9d57('0x6'));var Mustache=require(_0x9d57('0x7'));var util=require(_0x9d57('0x8'));var path=require(_0x9d57('0x9'));var sox=require(_0x9d57('0xa'));var csv=require(_0x9d57('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d57('0xc'));var _=require(_0x9d57('0xd'));var squel=require(_0x9d57('0xe'));var crypto=require(_0x9d57('0xf'));var jsforce=require(_0x9d57('0x10'));var deskjs=require(_0x9d57('0x11'));var toCsv=require(_0x9d57('0xb'));var querystring=require(_0x9d57('0x12'));var Papa=require(_0x9d57('0x13'));var Redis=require(_0x9d57('0x14'));var authService=require(_0x9d57('0x15'));var qs=require(_0x9d57('0x16'));var as=require(_0x9d57('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9d57('0x18'));var utils=require(_0x9d57('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x9d57('0x1a'));var db=require(_0x9d57('0x1b'))['db'];config['redis']=_[_0x9d57('0x1c')](config[_0x9d57('0x1d')],{'host':_0x9d57('0x1e'),'port':0x18eb});var socket=require(_0x9d57('0x1f'))(new Redis(config[_0x9d57('0x1d')]));require('./dashboard.socket')[_0x9d57('0x20')](socket);function respondWithStatusCode(_0x37b646,_0xce4b72){_0xce4b72=_0xce4b72||0xcc;return function(_0x3e5451){if(_0x3e5451){return _0x37b646['sendStatus'](_0xce4b72);}return _0x37b646['status'](_0xce4b72)[_0x9d57('0x21')]();};}function respondWithResult(_0x5b495f,_0x43fb3d){_0x43fb3d=_0x43fb3d||0xc8;return function(_0x2691a2){if(_0x2691a2){return _0x5b495f[_0x9d57('0x22')](_0x43fb3d)['json'](_0x2691a2);}};}function respondWithFilteredResult(_0x28a45b,_0x391867){return function(_0x4fea1f){if(_0x4fea1f){var _0x4b648c=typeof _0x391867[_0x9d57('0x23')]===_0x9d57('0x24')&&typeof _0x391867[_0x9d57('0x25')]===_0x9d57('0x24');var _0x5abe8c=_0x4fea1f['count'];var _0x5e8aba=_0x4b648c?0x0:_0x391867[_0x9d57('0x23')];var _0xb4c8bb=_0x4b648c?_0x4fea1f['count']:_0x391867[_0x9d57('0x23')]+_0x391867[_0x9d57('0x25')];var _0x3966c5;if(_0xb4c8bb>=_0x5abe8c){_0xb4c8bb=_0x5abe8c;_0x3966c5=0xc8;}else{_0x3966c5=0xce;}_0x28a45b[_0x9d57('0x22')](_0x3966c5);return _0x28a45b[_0x9d57('0x26')](_0x9d57('0x27'),_0x5e8aba+'-'+_0xb4c8bb+'/'+_0x5abe8c)['json'](_0x4fea1f);}return null;};}function patchUpdates(_0x4e9ae2){return function(_0x15d268){try{jsonpatch[_0x9d57('0x28')](_0x15d268,_0x4e9ae2,!![]);}catch(_0x1fdbd0){return BPromise[_0x9d57('0x29')](_0x1fdbd0);}return _0x15d268[_0x9d57('0x2a')]();};}function saveUpdates(_0x5210a3,_0x2ef143){return function(_0x48f03e){if(_0x48f03e){return _0x48f03e[_0x9d57('0x2b')](_0x5210a3)[_0x9d57('0x2c')](function(_0x2e77b0){return _0x2e77b0;});}return null;};}function removeEntity(_0x9ee015,_0x41646b){return function(_0x5b2a18){if(_0x5b2a18){return _0x5b2a18['destroy']()[_0x9d57('0x2c')](function(){var _0xa8cc67=_0x5b2a18[_0x9d57('0x2d')]({'plain':!![]});var _0x4db318=_0x9d57('0x2e');return db[_0x9d57('0x2f')][_0x9d57('0x30')]({'where':{'type':_0x4db318,'resourceId':_0xa8cc67['id']}})['then'](function(){return _0x5b2a18;});})[_0x9d57('0x2c')](function(){_0x9ee015['status'](0xcc)[_0x9d57('0x21')]();});}};}function handleEntityNotFound(_0x4b71e3,_0x30f685){return function(_0x30e34a){if(!_0x30e34a){_0x4b71e3['sendStatus'](0x194);}return _0x30e34a;};}function handleError(_0x43d986,_0x43b016){_0x43b016=_0x43b016||0x1f4;return function(_0x3115bd){logger['error'](_0x3115bd[_0x9d57('0x31')]);if(_0x3115bd[_0x9d57('0x32')]){delete _0x3115bd[_0x9d57('0x32')];}_0x43d986[_0x9d57('0x22')](_0x43b016)[_0x9d57('0x33')](_0x3115bd);};}exports['index']=function(_0xb2da95,_0x5c5b65){var _0x940fa={},_0x631bf={},_0x4a2718={'count':0x0,'rows':[]};var _0x297e95=_[_0x9d57('0x34')](db['Dashboard']['rawAttributes'],function(_0x3bf16e){return{'name':_0x3bf16e[_0x9d57('0x35')],'type':_0x3bf16e[_0x9d57('0x36')][_0x9d57('0x37')]};});_0x631bf[_0x9d57('0x38')]=_['map'](_0x297e95,_0x9d57('0x32'));_0x631bf[_0x9d57('0x39')]=_['keys'](_0xb2da95[_0x9d57('0x39')]);_0x631bf['filters']=_[_0x9d57('0x3a')](_0x631bf['model'],_0x631bf['query']);_0x940fa[_0x9d57('0x3b')]=_[_0x9d57('0x3a')](_0x631bf[_0x9d57('0x38')],qs[_0x9d57('0x3c')](_0xb2da95[_0x9d57('0x39')][_0x9d57('0x3c')]));_0x940fa[_0x9d57('0x3b')]=_0x940fa[_0x9d57('0x3b')]['length']?_0x940fa[_0x9d57('0x3b')]:_0x631bf['model'];if(!_0xb2da95[_0x9d57('0x39')]['hasOwnProperty']('nolimit')){_0x940fa[_0x9d57('0x25')]=qs[_0x9d57('0x25')](_0xb2da95[_0x9d57('0x39')]['limit']);_0x940fa[_0x9d57('0x23')]=qs[_0x9d57('0x23')](_0xb2da95[_0x9d57('0x39')][_0x9d57('0x23')]);}_0x940fa[_0x9d57('0x3d')]=qs[_0x9d57('0x3e')](_0xb2da95[_0x9d57('0x39')][_0x9d57('0x3e')]);_0x940fa[_0x9d57('0x3f')]=qs[_0x9d57('0x40')](_[_0x9d57('0x41')](_0xb2da95['query'],_0x631bf[_0x9d57('0x40')]),_0x297e95);if(_0xb2da95[_0x9d57('0x39')][_0x9d57('0x42')]){_0x940fa[_0x9d57('0x3f')]=_[_0x9d57('0x43')](_0x940fa[_0x9d57('0x3f')],{'$or':_[_0x9d57('0x34')](_0x297e95,function(_0xf8224){if(_0xf8224[_0x9d57('0x36')]!==_0x9d57('0x44')){var _0x5f4e40={};_0x5f4e40[_0xf8224[_0x9d57('0x32')]]={'$like':'%'+_0xb2da95[_0x9d57('0x39')][_0x9d57('0x42')]+'%'};return _0x5f4e40;}})});}_0x940fa=_[_0x9d57('0x43')]({},_0x940fa,_0xb2da95[_0x9d57('0x45')]);var _0x4f8ab7={'where':_0x940fa[_0x9d57('0x3f')]};return db['Dashboard']['count'](_0x4f8ab7)[_0x9d57('0x2c')](function(_0x579b97){_0x4a2718[_0x9d57('0x46')]=_0x579b97;if(_0xb2da95[_0x9d57('0x39')][_0x9d57('0x47')]){_0x940fa[_0x9d57('0x48')]=[{'all':!![]}];}return db['Dashboard'][_0x9d57('0x49')](_0x940fa);})[_0x9d57('0x2c')](function(_0x4b5fd1){_0x4a2718[_0x9d57('0x4a')]=_0x4b5fd1;return _0x4a2718;})[_0x9d57('0x2c')](respondWithFilteredResult(_0x5c5b65,_0x940fa))['catch'](handleError(_0x5c5b65,null));};exports['show']=function(_0x51e9d9,_0x32d901){var _0x6c6fca={'raw':![],'where':{'id':_0x51e9d9[_0x9d57('0x4b')]['id']}},_0x1de3fd={};_0x1de3fd['model']=_['keys'](db[_0x9d57('0x4c')][_0x9d57('0x4d')]);_0x1de3fd[_0x9d57('0x39')]=_[_0x9d57('0x4e')](_0x51e9d9[_0x9d57('0x39')]);_0x1de3fd[_0x9d57('0x40')]=_['intersection'](_0x1de3fd['model'],_0x1de3fd[_0x9d57('0x39')]);_0x6c6fca[_0x9d57('0x3b')]=_['intersection'](_0x1de3fd[_0x9d57('0x38')],qs['fields'](_0x51e9d9[_0x9d57('0x39')]['fields']));_0x6c6fca[_0x9d57('0x3b')]=_0x6c6fca['attributes'][_0x9d57('0x4f')]?_0x6c6fca[_0x9d57('0x3b')]:_0x1de3fd[_0x9d57('0x38')];if(_0x51e9d9[_0x9d57('0x39')][_0x9d57('0x47')]){_0x6c6fca[_0x9d57('0x48')]=[{'all':!![]}];}_0x6c6fca=_[_0x9d57('0x43')]({},_0x6c6fca,_0x51e9d9[_0x9d57('0x45')]);return db[_0x9d57('0x4c')][_0x9d57('0x50')](_0x6c6fca)[_0x9d57('0x2c')](handleEntityNotFound(_0x32d901,null))[_0x9d57('0x2c')](respondWithResult(_0x32d901,null))[_0x9d57('0x51')](handleError(_0x32d901,null));};exports[_0x9d57('0x52')]=function(_0x30e5bb,_0x5b7620){return db['Dashboard'][_0x9d57('0x52')](_0x30e5bb[_0x9d57('0x53')],{})['then'](function(_0x36c937){var _0x5d2b7c=_0x30e5bb['user'][_0x9d57('0x2d')]({'plain':!![]});if(!_0x5d2b7c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d2b7c[_0x9d57('0x54')]===_0x9d57('0x55')){var _0x442f38=_0x36c937[_0x9d57('0x2d')]({'plain':!![]});var _0x459524=_0x9d57('0x2e');return db[_0x9d57('0x56')][_0x9d57('0x50')]({'where':{'name':_0x459524,'userProfileId':_0x5d2b7c[_0x9d57('0x57')]},'raw':!![]})['then'](function(_0x2efced){if(_0x2efced&&_0x2efced['autoAssociation']===0x0){return db[_0x9d57('0x2f')]['create']({'name':_0x442f38[_0x9d57('0x32')],'resourceId':_0x442f38['id'],'type':_0x2efced[_0x9d57('0x32')],'sectionId':_0x2efced['id']},{})[_0x9d57('0x2c')](function(){return _0x36c937;});}else{return _0x36c937;}})[_0x9d57('0x51')](function(_0x204e59){logger[_0x9d57('0x58')](_0x9d57('0x59'),_0x204e59);throw _0x204e59;});}return _0x36c937;})[_0x9d57('0x2c')](respondWithResult(_0x5b7620,0xc9))[_0x9d57('0x51')](handleError(_0x5b7620,null));};exports[_0x9d57('0x5a')]=function(_0x3747d5,_0x510278){var _0x143d65={'where':{'id':_0x3747d5[_0x9d57('0x4b')]['id']}},_0xa91db9={};_0xa91db9['model']=_[_0x9d57('0x4e')](db['Dashboard'][_0x9d57('0x4d')]);_0x143d65[_0x9d57('0x3b')]=_[_0x9d57('0x3a')](_0xa91db9[_0x9d57('0x38')],qs['fields'](_0x3747d5[_0x9d57('0x39')][_0x9d57('0x3c')]));_0x143d65[_0x9d57('0x3b')]=_0x143d65[_0x9d57('0x3b')][_0x9d57('0x4f')]?_0x143d65['attributes']:_0xa91db9[_0x9d57('0x38')];if(_0x3747d5['query'][_0x9d57('0x47')]){_0x143d65['include']=[{'all':!![]}];}_0x143d65=_[_0x9d57('0x43')]({},_0x143d65,_0x3747d5[_0x9d57('0x45')]);return db[_0x9d57('0x4c')]['find'](_0x143d65)[_0x9d57('0x2c')](handleEntityNotFound(_0x510278,null))['then'](function(_0x59872f){if(_0x59872f){var _0xb998d8=_0x59872f[_0x9d57('0x2d')]({'plain':!![]});_0xb998d8=qs[_0x9d57('0x5b')](_0xb998d8,['id',_0x9d57('0x5c'),'updatedAt']);_0x3747d5[_0x9d57('0x53')]=_['omit'](_0x3747d5[_0x9d57('0x53')],['id',_0x9d57('0x5c'),_0x9d57('0x5d')]);return db['Dashboard'][_0x9d57('0x52')](_[_0x9d57('0x43')](_0xb998d8,_0x3747d5['body']),{'include':_0x3747d5['query']['includeAll']?[{'all':!![]}]:undefined})[_0x9d57('0x2c')](function(_0x2e3263){var _0x2cb365=_0x3747d5['user']['get']({'plain':!![]});if(!_0x2cb365)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2cb365['role']==='user'){var _0x2d6c4e=_0x2e3263[_0x9d57('0x2d')]({'plain':!![]});var _0x5f0e95=_0x9d57('0x2e');return db['UserProfileSection']['find']({'where':{'name':_0x5f0e95,'userProfileId':_0x2cb365[_0x9d57('0x57')]},'raw':!![]})['then'](function(_0x1b8819){if(_0x1b8819&&_0x1b8819[_0x9d57('0x5e')]===0x0){return db[_0x9d57('0x2f')]['create']({'name':_0x2d6c4e[_0x9d57('0x32')],'resourceId':_0x2d6c4e['id'],'type':_0x1b8819[_0x9d57('0x32')],'sectionId':_0x1b8819['id']},{})[_0x9d57('0x2c')](function(){return _0x2e3263;});}else{return _0x2e3263;}})[_0x9d57('0x51')](function(_0xb6ac6){logger[_0x9d57('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb6ac6);throw _0xb6ac6;});}return _0x2e3263;});}})[_0x9d57('0x2c')](respondWithResult(_0x510278,0xc9))[_0x9d57('0x51')](handleError(_0x510278,null));};exports[_0x9d57('0x2b')]=function(_0x4ea6e9,_0x36adea){if(_0x4ea6e9[_0x9d57('0x53')]['id']){delete _0x4ea6e9[_0x9d57('0x53')]['id'];}return db[_0x9d57('0x4c')][_0x9d57('0x50')]({'where':{'id':_0x4ea6e9[_0x9d57('0x4b')]['id']}})[_0x9d57('0x2c')](handleEntityNotFound(_0x36adea,null))[_0x9d57('0x2c')](saveUpdates(_0x4ea6e9['body'],null))[_0x9d57('0x2c')](respondWithResult(_0x36adea,null))[_0x9d57('0x51')](handleError(_0x36adea,null));};exports[_0x9d57('0x30')]=function(_0x4d6bb1,_0x13c892){return db[_0x9d57('0x4c')][_0x9d57('0x50')]({'where':{'id':_0x4d6bb1[_0x9d57('0x4b')]['id']}})[_0x9d57('0x2c')](handleEntityNotFound(_0x13c892,null))[_0x9d57('0x2c')](removeEntity(_0x13c892,null))[_0x9d57('0x51')](handleError(_0x13c892,null));};function widgetAttributes(_0x591a8c){try{switch(_0x591a8c[_0x9d57('0x36')]){case _0x9d57('0x5f'):return[{'name':_0x9d57('0x60'),'value':_0x591a8c[_0x9d57('0x60')]||(_0x591a8c['attrs']&&_0x591a8c[_0x9d57('0x61')][0x0]?_0x591a8c['attrs'][0x0][_0x9d57('0x62')]:undefined)||'https://'}];case _0x9d57('0x63'):return[{'name':'attrPath','value':_0x591a8c[_0x9d57('0x64')]||(_0x591a8c['attrs']&&_0x591a8c[_0x9d57('0x61')][0x0]?_0x591a8c[_0x9d57('0x61')][0x0][_0x9d57('0x62')]:undefined)||''}];case _0x9d57('0x65'):return[{'name':_0x9d57('0x66'),'value':_0x591a8c['attrHourFormat']||(_0x591a8c['attrs']&&_0x591a8c[_0x9d57('0x61')][0x0]?_0x591a8c['attrs'][0x0][_0x9d57('0x62')]:undefined)||_0x9d57('0x67')},{'name':'attrTimezone','value':_0x591a8c[_0x9d57('0x68')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x1]?_0x591a8c[_0x9d57('0x61')][0x1][_0x9d57('0x62')]:undefined)||_0x9d57('0x69')},{'name':_0x9d57('0x6a'),'value':_0x591a8c[_0x9d57('0x6a')]||(_0x591a8c['attrs']&&_0x591a8c[_0x9d57('0x61')][0x2]?_0x591a8c[_0x9d57('0x61')][0x2][_0x9d57('0x62')]:undefined)||0xc}];case _0x9d57('0x6b'):return[{'name':_0x9d57('0x6c'),'value':_0x591a8c[_0x9d57('0x6c')]||(_0x591a8c['attrs']&&_0x591a8c['attrs'][0x0]?_0x591a8c[_0x9d57('0x61')][0x0][_0x9d57('0x62')]:undefined)||_0x9d57('0x6d')},{'name':'attrVoiceQueues','value':_0x591a8c[_0x9d57('0x6e')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c['attrs'][0x1]?_0x591a8c[_0x9d57('0x61')][0x1][_0x9d57('0x62')]:undefined)||[]},{'name':_0x9d57('0x6a'),'value':_0x591a8c[_0x9d57('0x6a')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x2]?_0x591a8c[_0x9d57('0x61')][0x2]['value']:undefined)||0x14},{'name':_0x9d57('0x6f'),'value':_0x591a8c['attrChannel']||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c['attrs'][0x3]?_0x591a8c['attrs'][0x3][_0x9d57('0x62')]:undefined)||_0x9d57('0x70')},{'name':_0x9d57('0x71'),'value':_0x591a8c[_0x9d57('0x71')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x4]?_0x591a8c[_0x9d57('0x61')][0x4][_0x9d57('0x62')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x591a8c[_0x9d57('0x72')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c['attrs'][0x5]?_0x591a8c[_0x9d57('0x61')][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x591a8c[_0x9d57('0x73')]||(_0x591a8c['attrs']&&_0x591a8c['attrs'][0x6]?_0x591a8c['attrs'][0x6][_0x9d57('0x62')]:undefined)||''},{'name':_0x9d57('0x74'),'value':_0x591a8c['attrOpenchannelAccounts']||(_0x591a8c['attrs']&&_0x591a8c['attrs'][0x7]?_0x591a8c[_0x9d57('0x61')][0x7][_0x9d57('0x62')]:undefined)||''},{'name':_0x9d57('0x75'),'value':_0x591a8c[_0x9d57('0x75')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x8]?_0x591a8c[_0x9d57('0x61')][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x591a8c[_0x9d57('0x76')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x9]?_0x591a8c[_0x9d57('0x61')][0x9][_0x9d57('0x62')]:undefined)||''}];case _0x9d57('0x77'):case _0x9d57('0x78'):return[{'name':_0x9d57('0x79'),'value':_0x591a8c[_0x9d57('0x79')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x0]?_0x591a8c[_0x9d57('0x61')][0x0][_0x9d57('0x62')]:undefined)||'total'},{'name':'attrSerie2','value':_0x591a8c[_0x9d57('0x7a')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x1]?_0x591a8c['attrs'][0x1][_0x9d57('0x62')]:undefined)||null},{'name':_0x9d57('0x7b'),'value':_0x591a8c[_0x9d57('0x7b')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x2]?_0x591a8c['attrs'][0x2][_0x9d57('0x62')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x591a8c[_0x9d57('0x6e')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x3]?_0x591a8c['attrs'][0x3][_0x9d57('0x62')]:undefined)||[]},{'name':_0x9d57('0x6f'),'value':_0x591a8c['attrChannel']||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x4]?_0x591a8c[_0x9d57('0x61')][0x4]['value']:undefined)||_0x9d57('0x70')},{'name':_0x9d57('0x71'),'value':_0x591a8c[_0x9d57('0x71')]||(_0x591a8c['attrs']&&_0x591a8c['attrs'][0x5]?_0x591a8c[_0x9d57('0x61')][0x5][_0x9d57('0x62')]:undefined)||''},{'name':_0x9d57('0x72'),'value':_0x591a8c[_0x9d57('0x72')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x6]?_0x591a8c[_0x9d57('0x61')][0x6][_0x9d57('0x62')]:undefined)||''},{'name':_0x9d57('0x73'),'value':_0x591a8c[_0x9d57('0x73')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x7]?_0x591a8c[_0x9d57('0x61')][0x7][_0x9d57('0x62')]:undefined)||''},{'name':_0x9d57('0x74'),'value':_0x591a8c[_0x9d57('0x74')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c['attrs'][0x8]?_0x591a8c['attrs'][0x8][_0x9d57('0x62')]:undefined)||''},{'name':_0x9d57('0x75'),'value':_0x591a8c[_0x9d57('0x75')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x9]?_0x591a8c['attrs'][0x9][_0x9d57('0x62')]:undefined)||''},{'name':'attrChatWebsites','value':_0x591a8c[_0x9d57('0x76')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c['attrs'][0xa]?_0x591a8c[_0x9d57('0x61')][0xa][_0x9d57('0x62')]:undefined)||''}];case _0x9d57('0x7c'):return[{'name':'attrReport','type':_0x591a8c[_0x9d57('0x7d')]||(_0x591a8c['attrs']&&_0x591a8c[_0x9d57('0x61')][0x0]?_0x591a8c[_0x9d57('0x61')][0x0][_0x9d57('0x36')]:undefined)||null,'value':_0x591a8c[_0x9d57('0x7e')]||(_0x591a8c['attrs']&&_0x591a8c['attrs'][0x0]?_0x591a8c[_0x9d57('0x61')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x591a8c[_0x9d57('0x7f')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x1]?_0x591a8c[_0x9d57('0x61')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1c86f6){logger[_0x9d57('0x58')](_0x9d57('0x80'),JSON[_0x9d57('0x81')](_0x1c86f6));return[];}}exports[_0x9d57('0x82')]=function(_0x5992b9,_0x45d56e,_0x16cfea){if(_0x5992b9['body']['id']){delete _0x5992b9[_0x9d57('0x53')]['id'];}return db[_0x9d57('0x4c')][_0x9d57('0x50')]({'where':{'id':_0x5992b9[_0x9d57('0x4b')]['id']}})['then'](handleEntityNotFound(_0x45d56e,null))['then'](function(_0x9d5189){if(_0x9d5189){_0x5992b9[_0x9d57('0x53')][_0x9d57('0x83')]=_0x9d5189['id'];_0x5992b9[_0x9d57('0x53')][_0x9d57('0x61')]=widgetAttributes(_0x5992b9[_0x9d57('0x53')]);return db['DashboardItem'][_0x9d57('0x52')](_0x5992b9[_0x9d57('0x53')]);}})['then'](respondWithResult(_0x45d56e,null))[_0x9d57('0x51')](handleError(_0x45d56e,null));};exports[_0x9d57('0x84')]=function(_0x47936e,_0x11199f,_0x43fe6e){var _0x210a42={};var _0x373673={};var _0x3646cc;var _0x400fec;return db[_0x9d57('0x4c')]['findOne']({'where':{'id':_0x47936e[_0x9d57('0x4b')]['id']}})[_0x9d57('0x2c')](handleEntityNotFound(_0x11199f,null))[_0x9d57('0x2c')](function(_0x5acd11){if(_0x5acd11){_0x3646cc=_0x5acd11;_0x373673['model']=_[_0x9d57('0x4e')](db['DashboardItem'][_0x9d57('0x4d')]);_0x373673[_0x9d57('0x39')]=_[_0x9d57('0x4e')](_0x47936e[_0x9d57('0x39')]);_0x373673['filters']=_[_0x9d57('0x3a')](_0x373673[_0x9d57('0x38')],_0x373673[_0x9d57('0x39')]);_0x210a42[_0x9d57('0x3b')]=_[_0x9d57('0x3a')](_0x373673[_0x9d57('0x38')],qs[_0x9d57('0x3c')](_0x47936e[_0x9d57('0x39')][_0x9d57('0x3c')]));_0x210a42['attributes']=_0x210a42[_0x9d57('0x3b')][_0x9d57('0x4f')]?_0x210a42[_0x9d57('0x3b')]:_0x373673['model'];_0x210a42[_0x9d57('0x3d')]=qs['sort'](_0x47936e['query'][_0x9d57('0x3e')]);_0x210a42[_0x9d57('0x3f')]=qs[_0x9d57('0x40')](_[_0x9d57('0x41')](_0x47936e[_0x9d57('0x39')],_0x373673[_0x9d57('0x40')]));if(_0x47936e[_0x9d57('0x39')][_0x9d57('0x42')]){_0x210a42[_0x9d57('0x3f')]=_[_0x9d57('0x43')](_0x210a42[_0x9d57('0x3f')],{'$or':_[_0x9d57('0x34')](_0x210a42[_0x9d57('0x3b')],function(_0x10f908){var _0x77affc={};_0x77affc[_0x10f908]={'$like':'%'+_0x47936e[_0x9d57('0x39')][_0x9d57('0x42')]+'%'};return _0x77affc;})});}_0x210a42=_[_0x9d57('0x43')]({},_0x210a42,_0x47936e[_0x9d57('0x45')]);return _0x3646cc[_0x9d57('0x84')](_0x210a42);}})['then'](function(_0x419e4a){if(_0x419e4a){_0x400fec=_0x419e4a['length'];if(!_0x47936e[_0x9d57('0x39')][_0x9d57('0x85')]('nolimit')){_0x210a42[_0x9d57('0x25')]=qs[_0x9d57('0x25')](_0x47936e[_0x9d57('0x39')][_0x9d57('0x25')]);_0x210a42[_0x9d57('0x23')]=qs['offset'](_0x47936e[_0x9d57('0x39')][_0x9d57('0x23')]);}return _0x3646cc[_0x9d57('0x84')](_0x210a42);}})[_0x9d57('0x2c')](function(_0x3ea27c){if(_0x3ea27c){return _0x3ea27c?{'count':_0x400fec,'rows':_0x3ea27c}:null;}})[_0x9d57('0x2c')](respondWithResult(_0x11199f,null))[_0x9d57('0x51')](handleError(_0x11199f,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index c45a4ce..8bb322b 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 _0x49dc=['save','emit','events','../../mysqldb','Dashboard','setMaxListeners'];(function(_0x1a1492,_0x26f28d){var _0x59eb2b=function(_0x50283d){while(--_0x50283d){_0x1a1492['push'](_0x1a1492['shift']());}};_0x59eb2b(++_0x26f28d);}(_0x49dc,0x1a6));var _0xc49d=function(_0x408807,_0x4f5e70){_0x408807=_0x408807-0x0;var _0x2e46ac=_0x49dc[_0x408807];return _0x2e46ac;};'use strict';var EventEmitter=require(_0xc49d('0x0'));var Dashboard=require(_0xc49d('0x1'))['db'][_0xc49d('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xc49d('0x3')](0x0);var events={'afterCreate':_0xc49d('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5b2d61){return function(_0x23dc4e,_0x1d0b02,_0x5c8479){DashboardEvents[_0xc49d('0x5')](_0x5b2d61+':'+_0x23dc4e['id'],_0x23dc4e);DashboardEvents['emit'](_0x5b2d61,_0x23dc4e);_0x5c8479(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0xbe54=['update','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x5c51fe,_0x5a2950){var _0x443ac2=function(_0x2b3bf2){while(--_0x2b3bf2){_0x5c51fe['push'](_0x5c51fe['shift']());}};_0x443ac2(++_0x5a2950);}(_0xbe54,0x9e));var _0x4be5=function(_0x196491,_0x53d977){_0x196491=_0x196491-0x0;var _0x34774c=_0xbe54[_0x196491];return _0x34774c;};'use strict';var EventEmitter=require(_0x4be5('0x0'));var Dashboard=require(_0x4be5('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x4be5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4be5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5933b2){return function(_0x47f992,_0x5e0437,_0x107a04){DashboardEvents['emit'](_0x5933b2+':'+_0x47f992['id'],_0x47f992);DashboardEvents[_0x4be5('0x4')](_0x5933b2,_0x47f992);_0x107a04(null);};}for(var e in events){if(events[_0x4be5('0x5')](e)){var event=events[e];Dashboard[_0x4be5('0x6')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 05c2082..a6f2df8 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 _0xa5bb=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define'];(function(_0x2eafa5,_0x461f1f){var _0x5ac5f6=function(_0x548bb9){while(--_0x548bb9){_0x2eafa5['push'](_0x2eafa5['shift']());}};_0x5ac5f6(++_0x461f1f);}(_0xa5bb,0x11e));var _0xba5b=function(_0x5c0c64,_0x2ce53f){_0x5c0c64=_0x5c0c64-0x0;var _0x1286bd=_0xa5bb[_0x5c0c64];return _0x1286bd;};'use strict';var _=require(_0xba5b('0x0'));var util=require(_0xba5b('0x1'));var logger=require(_0xba5b('0x2'))(_0xba5b('0x3'));var moment=require(_0xba5b('0x4'));var BPromise=require(_0xba5b('0x5'));var rp=require(_0xba5b('0x6'));var fs=require('fs');var path=require(_0xba5b('0x7'));var rimraf=require(_0xba5b('0x8'));var config=require(_0xba5b('0x9'));var attributes=require(_0xba5b('0xa'));module[_0xba5b('0xb')]=function(_0x23a90b,_0x13aa03){return _0x23a90b[_0xba5b('0xc')]('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6eb=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','Dashboard','dashboards','lodash'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xe6eb,0xd7));var _0xbe6e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe6eb[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbe6e('0x0'));var util=require(_0xbe6e('0x1'));var logger=require(_0xbe6e('0x2'))(_0xbe6e('0x3'));var moment=require(_0xbe6e('0x4'));var BPromise=require(_0xbe6e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe6e('0x6'));var rimraf=require(_0xbe6e('0x7'));var config=require(_0xbe6e('0x8'));var attributes=require('./dashboard.attributes');module[_0xbe6e('0x9')]=function(_0x4f57ca,_0x5b3321){return _0x4f57ca['define'](_0xbe6e('0xa'),attributes,{'tableName':_0xbe6e('0xb'),'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 2041cea..ef78c37 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 _0x5ed9=['../../config/environment','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x218ad0,_0x15e6ef){var _0xbff559=function(_0x3fa2c1){while(--_0x3fa2c1){_0x218ad0['push'](_0x218ad0['shift']());}};_0xbff559(++_0x15e6ef);}(_0x5ed9,0xf3));var _0x95ed=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5ed9[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x95ed('0x0'));var util=require('util');var moment=require(_0x95ed('0x1'));var BPromise=require(_0x95ed('0x2'));var rs=require(_0x95ed('0x3'));var fs=require('fs');var Redis=require(_0x95ed('0x4'));var db=require(_0x95ed('0x5'))['db'];var utils=require(_0x95ed('0x6'));var logger=require(_0x95ed('0x7'))(_0x95ed('0x8'));var config=require(_0x95ed('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x95ed('0xa')][_0x95ed('0xb')]({'port':0x232a});config[_0x95ed('0xc')]=_['defaults'](config[_0x95ed('0xc')],{'host':_0x95ed('0xd'),'port':0x18eb});var socket=require(_0x95ed('0xe'))(new Redis(config[_0x95ed('0xc')]));require(_0x95ed('0xf'))[_0x95ed('0x10')](socket);function respondWithRpcPromise(_0x3b4ecd,_0x4574db,_0x18f2e2){return new BPromise(function(_0x8931d9,_0x5343e0){return client[_0x95ed('0x11')](_0x3b4ecd,_0x18f2e2)['then'](function(_0x3f2dee){logger['info'](_0x95ed('0x12'),_0x4574db,_0x95ed('0x13'));logger[_0x95ed('0x14')](_0x95ed('0x15'),_0x4574db,_0x95ed('0x13'),JSON[_0x95ed('0x16')](_0x3f2dee));if(_0x3f2dee[_0x95ed('0x17')]){if(_0x3f2dee[_0x95ed('0x17')]['code']===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x4574db,_0x3f2dee['error'][_0x95ed('0x18')]);return _0x5343e0(_0x3f2dee['error'][_0x95ed('0x18')]);}logger[_0x95ed('0x17')]('Dashboard,\x20%s,\x20%s',_0x4574db,_0x3f2dee[_0x95ed('0x17')][_0x95ed('0x18')]);return _0x8931d9(_0x3f2dee['error'][_0x95ed('0x18')]);}else{logger[_0x95ed('0x19')](_0x95ed('0x12'),_0x4574db,'request\x20sent');_0x8931d9(_0x3f2dee[_0x95ed('0x1a')][_0x95ed('0x18')]);}})[_0x95ed('0x1b')](function(_0x5dc403){logger['error'](_0x95ed('0x12'),_0x4574db,_0x5dc403);_0x5343e0(_0x5dc403);});});} \ No newline at end of file +var _0xe12c=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch'];(function(_0x43db48,_0x242a8d){var _0x23010b=function(_0x544009){while(--_0x544009){_0x43db48['push'](_0x43db48['shift']());}};_0x23010b(++_0x242a8d);}(_0xe12c,0x118));var _0xce12=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xe12c[_0x485b5a];return _0xd2b34d;};'use strict';var _=require('lodash');var util=require(_0xce12('0x0'));var moment=require(_0xce12('0x1'));var BPromise=require(_0xce12('0x2'));var rs=require(_0xce12('0x3'));var fs=require('fs');var Redis=require(_0xce12('0x4'));var db=require(_0xce12('0x5'))['db'];var utils=require(_0xce12('0x6'));var logger=require(_0xce12('0x7'))(_0xce12('0x8'));var config=require(_0xce12('0x9'));var jayson=require(_0xce12('0xa'));var client=jayson['client'][_0xce12('0xb')]({'port':0x232a});config[_0xce12('0xc')]=_[_0xce12('0xd')](config[_0xce12('0xc')],{'host':_0xce12('0xe'),'port':0x18eb});var socket=require(_0xce12('0xf'))(new Redis(config[_0xce12('0xc')]));require(_0xce12('0x10'))[_0xce12('0x11')](socket);function respondWithRpcPromise(_0x5ed6fb,_0x214694,_0x5c0f40){return new BPromise(function(_0x4648db,_0x54e455){return client['request'](_0x5ed6fb,_0x5c0f40)[_0xce12('0x12')](function(_0xfea655){logger['info'](_0xce12('0x13'),_0x214694,_0xce12('0x14'));logger[_0xce12('0x15')](_0xce12('0x16'),_0x214694,_0xce12('0x14'),JSON[_0xce12('0x17')](_0xfea655));if(_0xfea655['error']){if(_0xfea655[_0xce12('0x18')]['code']===0x1f4){logger['error'](_0xce12('0x13'),_0x214694,_0xfea655[_0xce12('0x18')]['message']);return _0x54e455(_0xfea655[_0xce12('0x18')][_0xce12('0x19')]);}logger[_0xce12('0x18')]('Dashboard,\x20%s,\x20%s',_0x214694,_0xfea655[_0xce12('0x18')]['message']);return _0x4648db(_0xfea655[_0xce12('0x18')][_0xce12('0x19')]);}else{logger[_0xce12('0x1a')](_0xce12('0x13'),_0x214694,_0xce12('0x14'));_0x4648db(_0xfea655['result'][_0xce12('0x19')]);}})[_0xce12('0x1b')](function(_0x3a6bc5){logger['error']('Dashboard,\x20%s,\x20%s',_0x214694,_0x3a6bc5);_0x54e455(_0x3a6bc5);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 7c92a26..69632ec 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 _0x447a=['./dashboard.events','remove','update','emit','dashboard:'];(function(_0x691b43,_0x5bfb54){var _0x40f0da=function(_0x170c2f){while(--_0x170c2f){_0x691b43['push'](_0x691b43['shift']());}};_0x40f0da(++_0x5bfb54);}(_0x447a,0x131));var _0xa447=function(_0x531b1e,_0x301978){_0x531b1e=_0x531b1e-0x0;var _0x1208b6=_0x447a[_0x531b1e];return _0x1208b6;};'use strict';var DashboardEvents=require(_0xa447('0x0'));var events=['save',_0xa447('0x1'),_0xa447('0x2')];function createListener(_0x55b8c7,_0x28dc7d){return function(_0x37ca62){_0x28dc7d[_0xa447('0x3')](_0x55b8c7,_0x37ca62);};}function removeListener(_0x27adf1,_0x514631){return function(){DashboardEvents['removeListener'](_0x27adf1,_0x514631);};}exports['register']=function(_0x5d1c61){for(var _0x2dfef9=0x0,_0x12d782=events['length'];_0x2dfef9<_0x12d782;_0x2dfef9++){var _0x37e14b=events[_0x2dfef9];var _0x888a95=createListener(_0xa447('0x4')+_0x37e14b,_0x5d1c61);DashboardEvents['on'](_0x37e14b,_0x888a95);}}; \ No newline at end of file +var _0x68ad=['emit','removeListener','register','length','dashboard:','./dashboard.events','remove','update'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x68ad,0x195));var _0xd68a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x68ad[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardEvents=require(_0xd68a('0x0'));var events=['save',_0xd68a('0x1'),_0xd68a('0x2')];function createListener(_0x27a557,_0x4e05e2){return function(_0x30b11b){_0x4e05e2[_0xd68a('0x3')](_0x27a557,_0x30b11b);};}function removeListener(_0x182dc1,_0xcb3d45){return function(){DashboardEvents[_0xd68a('0x4')](_0x182dc1,_0xcb3d45);};}exports[_0xd68a('0x5')]=function(_0x395dfa){for(var _0x735ad9=0x0,_0x396463=events[_0xd68a('0x6')];_0x735ad9<_0x396463;_0x735ad9++){var _0x34eb70=events[_0x735ad9];var _0x2ae2d7=createListener(_0xd68a('0x7')+_0x34eb70,_0x395dfa);DashboardEvents['on'](_0x34eb70,_0x2ae2d7);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 3e58d6b..09e2464 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 _0x026c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','/:id/clone','clone','addItem','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x026c,0x133));var _0xc026=function(_0x1c156e,_0x3263a6){_0x1c156e=_0x1c156e-0x0;var _0x58fc22=_0x026c[_0x1c156e];return _0x58fc22;};'use strict';var multer=require(_0xc026('0x0'));var util=require(_0xc026('0x1'));var path=require(_0xc026('0x2'));var timeout=require(_0xc026('0x3'));var express=require(_0xc026('0x4'));var router=express[_0xc026('0x5')]();var fs_extra=require(_0xc026('0x6'));var auth=require(_0xc026('0x7'));var interaction=require(_0xc026('0x8'));var config=require(_0xc026('0x9'));var controller=require('./dashboard.controller');router[_0xc026('0xa')]('/',auth[_0xc026('0xb')](),controller[_0xc026('0xc')]);router['get'](_0xc026('0xd'),auth[_0xc026('0xb')](),controller[_0xc026('0xe')]);router['get'](_0xc026('0xf'),auth[_0xc026('0xb')](),controller[_0xc026('0x10')]);router[_0xc026('0x11')]('/',auth[_0xc026('0xb')](),controller['create']);router[_0xc026('0x11')](_0xc026('0x12'),auth['isAuthenticated'](),controller[_0xc026('0x13')]);router[_0xc026('0x11')](_0xc026('0xf'),auth[_0xc026('0xb')](),controller[_0xc026('0x14')]);router[_0xc026('0x15')](_0xc026('0xd'),auth[_0xc026('0xb')](),controller[_0xc026('0x16')]);router[_0xc026('0x17')](_0xc026('0xd'),auth[_0xc026('0xb')](),controller[_0xc026('0x18')]);module[_0xc026('0x19')]=router; \ No newline at end of file +var _0x3563=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','/:id','show','/:id/items','create','post','/:id/clone','clone','addItem','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4e2b6e,_0x5cc3cc){var _0x39464=function(_0x56398e){while(--_0x56398e){_0x4e2b6e['push'](_0x4e2b6e['shift']());}};_0x39464(++_0x5cc3cc);}(_0x3563,0x159));var _0x3356=function(_0x239887,_0x41243a){_0x239887=_0x239887-0x0;var _0x45296e=_0x3563[_0x239887];return _0x45296e;};'use strict';var multer=require(_0x3356('0x0'));var util=require(_0x3356('0x1'));var path=require(_0x3356('0x2'));var timeout=require(_0x3356('0x3'));var express=require(_0x3356('0x4'));var router=express[_0x3356('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3356('0x6'));var interaction=require(_0x3356('0x7'));var config=require(_0x3356('0x8'));var controller=require(_0x3356('0x9'));router[_0x3356('0xa')]('/',auth[_0x3356('0xb')](),controller['index']);router[_0x3356('0xa')](_0x3356('0xc'),auth['isAuthenticated'](),controller[_0x3356('0xd')]);router[_0x3356('0xa')](_0x3356('0xe'),auth[_0x3356('0xb')](),controller['getItems']);router['post']('/',auth[_0x3356('0xb')](),controller[_0x3356('0xf')]);router[_0x3356('0x10')](_0x3356('0x11'),auth['isAuthenticated'](),controller[_0x3356('0x12')]);router['post']('/:id/items',auth[_0x3356('0xb')](),controller[_0x3356('0x13')]);router[_0x3356('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x3356('0x15')]);router[_0x3356('0x16')](_0x3356('0xc'),auth[_0x3356('0xb')](),controller[_0x3356('0x17')]);module[_0x3356('0x18')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index ff7fed8..136a4c3 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 _0x31f0=['INTEGER','#ffffff','#2196f3','sequelize','lodash','STRING','TEXT','long','getDataValue','attrs','setDataValue','stringify'];(function(_0x356c1c,_0x5b0133){var _0x5bc706=function(_0x262ed6){while(--_0x262ed6){_0x356c1c['push'](_0x356c1c['shift']());}};_0x5bc706(++_0x5b0133);}(_0x31f0,0xb7));var _0x031f=function(_0x20cced,_0x4e5560){_0x20cced=_0x20cced-0x0;var _0x47ee35=_0x31f0[_0x20cced];return _0x47ee35;};'use strict';var Sequelize=require(_0x031f('0x0'));var squel=require('squel');var _=require(_0x031f('0x1'));module['exports']={'title':{'type':Sequelize[_0x031f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x031f('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x031f('0x3')](_0x031f('0x4')),'get':function(){try{return JSON['parse'](this[_0x031f('0x5')](_0x031f('0x6')));}catch(_0x4f6059){return[];}},'set':function(_0x4c0f94){try{this['setDataValue'](_0x031f('0x6'),JSON['stringify'](_0x4c0f94));}catch(_0x365f59){this[_0x031f('0x7')](_0x031f('0x6'),JSON[_0x031f('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x031f('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x031f('0x9')]},'col':{'type':Sequelize[_0x031f('0x9')]},'background':{'type':Sequelize[_0x031f('0x2')],'allowNull':![],'defaultValue':_0x031f('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x031f('0x2')],'allowNull':![],'defaultValue':_0x031f('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x031f('0x2')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x1261=['squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x491faa,_0x4f2907){var _0x414440=function(_0x310864){while(--_0x310864){_0x491faa['push'](_0x491faa['shift']());}};_0x414440(++_0x4f2907);}(_0x1261,0x144));var _0x1126=function(_0x237815,_0x1ef2b0){_0x237815=_0x237815-0x0;var _0x5498ee=_0x1261[_0x237815];return _0x5498ee;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x1126('0x0'));var _=require(_0x1126('0x1'));module[_0x1126('0x2')]={'title':{'type':Sequelize[_0x1126('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1126('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x1126('0x4')](_0x1126('0x5')),'get':function(){try{return JSON[_0x1126('0x6')](this[_0x1126('0x7')](_0x1126('0x8')));}catch(_0x5a2189){return[];}},'set':function(_0x5c68c8){try{this[_0x1126('0x9')](_0x1126('0x8'),JSON['stringify'](_0x5c68c8));}catch(_0x17e5f0){this[_0x1126('0x9')](_0x1126('0x8'),JSON[_0x1126('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x1126('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1126('0xb')]},'col':{'type':Sequelize[_0x1126('0xb')]},'background':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x1126('0xb')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 5bd2c2d..6812eba 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 _0x41fe=['web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','find','type','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3'];(function(_0x40b7ee,_0x3cfc4d){var _0x206aec=function(_0x1af8e6){while(--_0x1af8e6){_0x40b7ee['push'](_0x40b7ee['shift']());}};_0x206aec(++_0x3cfc4d);}(_0x41fe,0xd1));var _0xe41f=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x41fe[_0x55abd9];return _0x3e5669;};'use strict';var emlformat=require(_0xe41f('0x0'));var rimraf=require(_0xe41f('0x1'));var zipdir=require(_0xe41f('0x2'));var jsonpatch=require(_0xe41f('0x3'));var rp=require(_0xe41f('0x4'));var moment=require(_0xe41f('0x5'));var BPromise=require(_0xe41f('0x6'));var Mustache=require(_0xe41f('0x7'));var util=require(_0xe41f('0x8'));var path=require(_0xe41f('0x9'));var sox=require(_0xe41f('0xa'));var csv=require(_0xe41f('0xb'));var ejs=require(_0xe41f('0xc'));var fs=require('fs');var fs_extra=require(_0xe41f('0xd'));var _=require(_0xe41f('0xe'));var squel=require(_0xe41f('0xf'));var crypto=require(_0xe41f('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xe41f('0x11'));var toCsv=require(_0xe41f('0xb'));var querystring=require('querystring');var Papa=require(_0xe41f('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe41f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe41f('0x14'));var config=require(_0xe41f('0x15'));var licenseUtil=require(_0xe41f('0x16'));var db=require(_0xe41f('0x17'))['db'];config[_0xe41f('0x18')]=_[_0xe41f('0x19')](config[_0xe41f('0x18')],{'host':_0xe41f('0x1a'),'port':0x18eb});var socket=require(_0xe41f('0x1b'))(new Redis(config[_0xe41f('0x18')]));require('./dashboardItem.socket')[_0xe41f('0x1c')](socket);function respondWithStatusCode(_0x13a2dd,_0x544753){_0x544753=_0x544753||0xcc;return function(_0x16bc30){if(_0x16bc30){return _0x13a2dd[_0xe41f('0x1d')](_0x544753);}return _0x13a2dd[_0xe41f('0x1e')](_0x544753)[_0xe41f('0x1f')]();};}function respondWithResult(_0x194653,_0x3e4e83){_0x3e4e83=_0x3e4e83||0xc8;return function(_0xab3c7d){if(_0xab3c7d){return _0x194653['status'](_0x3e4e83)['json'](_0xab3c7d);}};}function respondWithFilteredResult(_0x2b5688,_0x5e59e2){return function(_0x5b5dd7){if(_0x5b5dd7){var _0x831479=typeof _0x5e59e2[_0xe41f('0x20')]===_0xe41f('0x21')&&typeof _0x5e59e2[_0xe41f('0x22')]===_0xe41f('0x21');var _0x5bd220=_0x5b5dd7[_0xe41f('0x23')];var _0x5339dd=_0x831479?0x0:_0x5e59e2[_0xe41f('0x20')];var _0x2c264c=_0x831479?_0x5b5dd7['count']:_0x5e59e2[_0xe41f('0x20')]+_0x5e59e2[_0xe41f('0x22')];var _0x171851;if(_0x2c264c>=_0x5bd220){_0x2c264c=_0x5bd220;_0x171851=0xc8;}else{_0x171851=0xce;}_0x2b5688['status'](_0x171851);return _0x2b5688[_0xe41f('0x24')](_0xe41f('0x25'),_0x5339dd+'-'+_0x2c264c+'/'+_0x5bd220)[_0xe41f('0x26')](_0x5b5dd7);}return null;};}function patchUpdates(_0x10ee63){return function(_0xa647ca){try{jsonpatch[_0xe41f('0x27')](_0xa647ca,_0x10ee63,!![]);}catch(_0x9c0c33){return BPromise['reject'](_0x9c0c33);}return _0xa647ca[_0xe41f('0x28')]();};}function saveUpdates(_0x5a443f,_0x4e8587){return function(_0x2f586e){if(_0x2f586e){return _0x2f586e[_0xe41f('0x29')](_0x5a443f)[_0xe41f('0x2a')](function(_0x4f7965){return _0x4f7965;});}return null;};}function removeEntity(_0x1ac25a,_0x573b3){return function(_0x115701){if(_0x115701){return _0x115701['destroy']()[_0xe41f('0x2a')](function(){_0x1ac25a['status'](0xcc)[_0xe41f('0x1f')]();});}};}function handleEntityNotFound(_0x44fb04,_0x5d30f5){return function(_0x20c671){if(!_0x20c671){_0x44fb04[_0xe41f('0x1d')](0x194);}return _0x20c671;};}function handleError(_0x3d4f0d,_0x68f74c){_0x68f74c=_0x68f74c||0x1f4;return function(_0x348531){logger[_0xe41f('0x2b')](_0x348531[_0xe41f('0x2c')]);if(_0x348531[_0xe41f('0x2d')]){delete _0x348531[_0xe41f('0x2d')];}_0x3d4f0d[_0xe41f('0x1e')](_0x68f74c)[_0xe41f('0x2e')](_0x348531);};}exports[_0xe41f('0x2f')]=function(_0x3c2464,_0xbca5b0){var _0x263c24={'raw':![],'where':{'id':_0x3c2464[_0xe41f('0x30')]['id']}},_0x4ef341={};_0x4ef341[_0xe41f('0x31')]=_[_0xe41f('0x32')](db[_0xe41f('0x33')][_0xe41f('0x34')]);_0x4ef341['query']=_[_0xe41f('0x32')](_0x3c2464[_0xe41f('0x35')]);_0x4ef341[_0xe41f('0x36')]=_[_0xe41f('0x37')](_0x4ef341['model'],_0x4ef341['query']);_0x263c24['attributes']=_[_0xe41f('0x37')](_0x4ef341[_0xe41f('0x31')],qs[_0xe41f('0x38')](_0x3c2464['query'][_0xe41f('0x38')]));_0x263c24[_0xe41f('0x39')]=_0x263c24[_0xe41f('0x39')][_0xe41f('0x3a')]?_0x263c24[_0xe41f('0x39')]:_0x4ef341[_0xe41f('0x31')];if(_0x3c2464[_0xe41f('0x35')][_0xe41f('0x3b')]){_0x263c24[_0xe41f('0x3c')]=[{'all':!![]}];}_0x263c24=_[_0xe41f('0x3d')]({},_0x263c24,_0x3c2464[_0xe41f('0x3e')]);return db[_0xe41f('0x33')]['find'](_0x263c24)[_0xe41f('0x2a')](handleEntityNotFound(_0xbca5b0,null))['then'](respondWithResult(_0xbca5b0,null))[_0xe41f('0x3f')](handleError(_0xbca5b0,null));};exports['destroy']=function(_0x1f1ebd,_0x498acc){return db['DashboardItem'][_0xe41f('0x40')]({'where':{'id':_0x1f1ebd[_0xe41f('0x30')]['id']}})[_0xe41f('0x2a')](handleEntityNotFound(_0x498acc,null))[_0xe41f('0x2a')](removeEntity(_0x498acc,null))[_0xe41f('0x3f')](handleError(_0x498acc,null));};function widgetAttributes(_0x489c83){try{switch(_0x489c83[_0xe41f('0x41')]){case _0xe41f('0x42'):return[{'name':_0xe41f('0x43'),'value':_0x489c83[_0xe41f('0x43')]||(_0x489c83[_0xe41f('0x44')]&&_0x489c83[_0xe41f('0x44')][0x0]?_0x489c83[_0xe41f('0x44')][0x0]['value']:undefined)||_0xe41f('0x45')}];case _0xe41f('0x46'):return[{'name':_0xe41f('0x47'),'value':_0x489c83[_0xe41f('0x47')]||(_0x489c83[_0xe41f('0x44')]&&_0x489c83[_0xe41f('0x44')][0x0]?_0x489c83[_0xe41f('0x44')][0x0][_0xe41f('0x48')]:undefined)||''}];case _0xe41f('0x49'):return[{'name':'attrHourFormat','value':_0x489c83['attrHourFormat']||(_0x489c83[_0xe41f('0x44')]&&_0x489c83['attrs'][0x0]?_0x489c83[_0xe41f('0x44')][0x0][_0xe41f('0x48')]:undefined)||_0xe41f('0x4a')},{'name':'attrTimezone','value':_0x489c83[_0xe41f('0x4b')]||(_0x489c83[_0xe41f('0x44')]&&_0x489c83['attrs'][0x1]?_0x489c83['attrs'][0x1][_0xe41f('0x48')]:undefined)||_0xe41f('0x4c')},{'name':_0xe41f('0x4d'),'value':_0x489c83[_0xe41f('0x4d')]||(_0x489c83[_0xe41f('0x44')]&&_0x489c83[_0xe41f('0x44')][0x2]?_0x489c83[_0xe41f('0x44')][0x2]['value']:undefined)||0xc}];case _0xe41f('0x4e'):return[{'name':_0xe41f('0x4f'),'value':_0x489c83['attrMetric']||(_0x489c83[_0xe41f('0x44')]&&_0x489c83['attrs'][0x0]?_0x489c83[_0xe41f('0x44')][0x0][_0xe41f('0x48')]:undefined)||_0xe41f('0x50')},{'name':'attrVoiceQueues','value':_0x489c83[_0xe41f('0x51')]||(_0x489c83['attrs']&&_0x489c83[_0xe41f('0x44')][0x1]?_0x489c83[_0xe41f('0x44')][0x1][_0xe41f('0x48')]:undefined)||[]},{'name':_0xe41f('0x4d'),'value':_0x489c83[_0xe41f('0x4d')]||(_0x489c83[_0xe41f('0x44')]&&_0x489c83[_0xe41f('0x44')][0x2]?_0x489c83[_0xe41f('0x44')][0x2]['value']:undefined)||0x14},{'name':_0xe41f('0x52'),'value':_0x489c83['attrChannel']||(_0x489c83[_0xe41f('0x44')]&&_0x489c83['attrs'][0x3]?_0x489c83[_0xe41f('0x44')][0x3][_0xe41f('0x48')]:undefined)||_0xe41f('0x53')},{'name':_0xe41f('0x54'),'value':_0x489c83['attrEmailAccounts']||(_0x489c83[_0xe41f('0x44')]&&_0x489c83['attrs'][0x4]?_0x489c83[_0xe41f('0x44')][0x4][_0xe41f('0x48')]:undefined)||''},{'name':_0xe41f('0x55'),'value':_0x489c83[_0xe41f('0x55')]||(_0x489c83['attrs']&&_0x489c83[_0xe41f('0x44')][0x5]?_0x489c83['attrs'][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x489c83[_0xe41f('0x56')]||(_0x489c83[_0xe41f('0x44')]&&_0x489c83['attrs'][0x6]?_0x489c83[_0xe41f('0x44')][0x6][_0xe41f('0x48')]:undefined)||''},{'name':_0xe41f('0x57'),'value':_0x489c83[_0xe41f('0x57')]||(_0x489c83[_0xe41f('0x44')]&&_0x489c83[_0xe41f('0x44')][0x7]?_0x489c83[_0xe41f('0x44')][0x7][_0xe41f('0x48')]:undefined)||''},{'name':_0xe41f('0x58'),'value':_0x489c83[_0xe41f('0x58')]||(_0x489c83['attrs']&&_0x489c83[_0xe41f('0x44')][0x8]?_0x489c83[_0xe41f('0x44')][0x8][_0xe41f('0x48')]:undefined)||''},{'name':'attrChatWebsites','value':_0x489c83[_0xe41f('0x59')]||(_0x489c83[_0xe41f('0x44')]&&_0x489c83[_0xe41f('0x44')][0x9]?_0x489c83[_0xe41f('0x44')][0x9][_0xe41f('0x48')]:undefined)||''}];case'multibar-chart':case _0xe41f('0x5a'):return[{'name':_0xe41f('0x5b'),'value':_0x489c83['attrSerie1']||(_0x489c83['attrs']&&_0x489c83['attrs'][0x0]?_0x489c83[_0xe41f('0x44')][0x0][_0xe41f('0x48')]:undefined)||_0xe41f('0x50')},{'name':_0xe41f('0x5c'),'value':_0x489c83[_0xe41f('0x5c')]||(_0x489c83[_0xe41f('0x44')]&&_0x489c83[_0xe41f('0x44')][0x1]?_0x489c83[_0xe41f('0x44')][0x1]['value']:undefined)||null},{'name':_0xe41f('0x5d'),'value':_0x489c83[_0xe41f('0x5d')]||(_0x489c83['attrs']&&_0x489c83[_0xe41f('0x44')][0x2]?_0x489c83[_0xe41f('0x44')][0x2]['value']:undefined)||null},{'name':_0xe41f('0x51'),'value':_0x489c83[_0xe41f('0x51')]||(_0x489c83['attrs']&&_0x489c83[_0xe41f('0x44')][0x3]?_0x489c83[_0xe41f('0x44')][0x3][_0xe41f('0x48')]:undefined)||[]},{'name':_0xe41f('0x52'),'value':_0x489c83[_0xe41f('0x52')]||(_0x489c83[_0xe41f('0x44')]&&_0x489c83['attrs'][0x4]?_0x489c83[_0xe41f('0x44')][0x4][_0xe41f('0x48')]:undefined)||'voice'},{'name':_0xe41f('0x54'),'value':_0x489c83[_0xe41f('0x54')]||(_0x489c83[_0xe41f('0x44')]&&_0x489c83['attrs'][0x5]?_0x489c83[_0xe41f('0x44')][0x5][_0xe41f('0x48')]:undefined)||''},{'name':_0xe41f('0x55'),'value':_0x489c83[_0xe41f('0x55')]||(_0x489c83['attrs']&&_0x489c83[_0xe41f('0x44')][0x6]?_0x489c83[_0xe41f('0x44')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x489c83[_0xe41f('0x56')]||(_0x489c83[_0xe41f('0x44')]&&_0x489c83['attrs'][0x7]?_0x489c83[_0xe41f('0x44')][0x7][_0xe41f('0x48')]:undefined)||''},{'name':_0xe41f('0x57'),'value':_0x489c83['attrOpenchannelAccounts']||(_0x489c83[_0xe41f('0x44')]&&_0x489c83['attrs'][0x8]?_0x489c83[_0xe41f('0x44')][0x8][_0xe41f('0x48')]:undefined)||''},{'name':_0xe41f('0x58'),'value':_0x489c83[_0xe41f('0x58')]||(_0x489c83[_0xe41f('0x44')]&&_0x489c83[_0xe41f('0x44')][0x9]?_0x489c83[_0xe41f('0x44')][0x9]['value']:undefined)||''},{'name':_0xe41f('0x59'),'value':_0x489c83[_0xe41f('0x59')]||(_0x489c83[_0xe41f('0x44')]&&_0x489c83['attrs'][0xa]?_0x489c83['attrs'][0xa]['value']:undefined)||''}];case _0xe41f('0x5e'):return[{'name':'attrReport','type':_0x489c83[_0xe41f('0x5f')]||(_0x489c83['attrs']&&_0x489c83['attrs'][0x0]?_0x489c83['attrs'][0x0][_0xe41f('0x41')]:undefined)||null,'value':_0x489c83[_0xe41f('0x60')]||(_0x489c83[_0xe41f('0x44')]&&_0x489c83[_0xe41f('0x44')][0x0]?_0x489c83[_0xe41f('0x44')][0x0]['value']:undefined)||null},{'name':_0xe41f('0x61'),'value':_0x489c83[_0xe41f('0x61')]||(_0x489c83['attrs']&&_0x489c83['attrs'][0x1]?_0x489c83[_0xe41f('0x44')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4738b8){logger[_0xe41f('0x2b')](_0xe41f('0x62'),JSON['stringify'](_0x4738b8));return[];}}exports[_0xe41f('0x63')]=function(_0x4fa7f0,_0x4979c9){if(_0x4fa7f0['body']){_0x4fa7f0['body'][_0xe41f('0x44')]=widgetAttributes(_0x4fa7f0[_0xe41f('0x64')]);}return db[_0xe41f('0x33')][_0xe41f('0x63')](_0x4fa7f0[_0xe41f('0x64')],{})[_0xe41f('0x2a')](respondWithResult(_0x4979c9,0xc9))[_0xe41f('0x3f')](handleError(_0x4979c9,null));};exports[_0xe41f('0x29')]=function(_0x200437,_0x585880){if(_0x200437['body']['id']){delete _0x200437[_0xe41f('0x64')]['id'];}_0x200437[_0xe41f('0x64')][_0xe41f('0x44')]=widgetAttributes(_0x200437['body']);return db[_0xe41f('0x33')][_0xe41f('0x40')]({'where':{'id':_0x200437[_0xe41f('0x30')]['id']}})[_0xe41f('0x2a')](handleEntityNotFound(_0x585880,null))[_0xe41f('0x2a')](saveUpdates(_0x200437[_0xe41f('0x64')],null))['then'](respondWithResult(_0x585880,null))[_0xe41f('0x3f')](handleError(_0x585880,null));}; \ No newline at end of file +var _0xf494=['name','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','counter','total','attrVoiceQueues','attrFontSize','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','end','error'];(function(_0x3edf05,_0x57907c){var _0x435bee=function(_0x16c688){while(--_0x16c688){_0x3edf05['push'](_0x3edf05['shift']());}};_0x435bee(++_0x57907c);}(_0xf494,0x1c6));var _0x4f49=function(_0xf6b597,_0x2b368f){_0xf6b597=_0xf6b597-0x0;var _0x599665=_0xf494[_0xf6b597];return _0x599665;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];config[_0x4f49('0x19')]=_['defaults'](config[_0x4f49('0x19')],{'host':_0x4f49('0x1a'),'port':0x18eb});var socket=require(_0x4f49('0x1b'))(new Redis(config[_0x4f49('0x19')]));require(_0x4f49('0x1c'))[_0x4f49('0x1d')](socket);function respondWithStatusCode(_0xfdb477,_0x5c373e){_0x5c373e=_0x5c373e||0xcc;return function(_0x515ace){if(_0x515ace){return _0xfdb477[_0x4f49('0x1e')](_0x5c373e);}return _0xfdb477[_0x4f49('0x1f')](_0x5c373e)['end']();};}function respondWithResult(_0x5bdfaf,_0x2f0a0d){_0x2f0a0d=_0x2f0a0d||0xc8;return function(_0x2ecaaa){if(_0x2ecaaa){return _0x5bdfaf[_0x4f49('0x1f')](_0x2f0a0d)['json'](_0x2ecaaa);}};}function respondWithFilteredResult(_0x1dccfd,_0x399be7){return function(_0x4e85df){if(_0x4e85df){var _0x49cdaf=typeof _0x399be7['offset']==='undefined'&&typeof _0x399be7['limit']===_0x4f49('0x20');var _0x1834f4=_0x4e85df[_0x4f49('0x21')];var _0x407042=_0x49cdaf?0x0:_0x399be7['offset'];var _0x416893=_0x49cdaf?_0x4e85df[_0x4f49('0x21')]:_0x399be7[_0x4f49('0x22')]+_0x399be7[_0x4f49('0x23')];var _0xea82f8;if(_0x416893>=_0x1834f4){_0x416893=_0x1834f4;_0xea82f8=0xc8;}else{_0xea82f8=0xce;}_0x1dccfd['status'](_0xea82f8);return _0x1dccfd[_0x4f49('0x24')](_0x4f49('0x25'),_0x407042+'-'+_0x416893+'/'+_0x1834f4)[_0x4f49('0x26')](_0x4e85df);}return null;};}function patchUpdates(_0x53b57d){return function(_0x40755e){try{jsonpatch[_0x4f49('0x27')](_0x40755e,_0x53b57d,!![]);}catch(_0x32ca7b){return BPromise[_0x4f49('0x28')](_0x32ca7b);}return _0x40755e[_0x4f49('0x29')]();};}function saveUpdates(_0x36187b,_0x559d98){return function(_0x4e9041){if(_0x4e9041){return _0x4e9041[_0x4f49('0x2a')](_0x36187b)[_0x4f49('0x2b')](function(_0x4fedbb){return _0x4fedbb;});}return null;};}function removeEntity(_0x408552,_0x2c1519){return function(_0x35f8e0){if(_0x35f8e0){return _0x35f8e0['destroy']()[_0x4f49('0x2b')](function(){_0x408552[_0x4f49('0x1f')](0xcc)[_0x4f49('0x2c')]();});}};}function handleEntityNotFound(_0x148153,_0xfefbab){return function(_0x122404){if(!_0x122404){_0x148153['sendStatus'](0x194);}return _0x122404;};}function handleError(_0x50c571,_0x239f44){_0x239f44=_0x239f44||0x1f4;return function(_0x2c00ee){logger[_0x4f49('0x2d')](_0x2c00ee['stack']);if(_0x2c00ee[_0x4f49('0x2e')]){delete _0x2c00ee[_0x4f49('0x2e')];}_0x50c571[_0x4f49('0x1f')](_0x239f44)['send'](_0x2c00ee);};}exports['show']=function(_0x3e207f,_0x27d004){var _0x7a6ea0={'raw':![],'where':{'id':_0x3e207f[_0x4f49('0x2f')]['id']}},_0x5e7076={};_0x5e7076[_0x4f49('0x30')]=_[_0x4f49('0x31')](db[_0x4f49('0x32')][_0x4f49('0x33')]);_0x5e7076[_0x4f49('0x34')]=_[_0x4f49('0x31')](_0x3e207f[_0x4f49('0x34')]);_0x5e7076[_0x4f49('0x35')]=_[_0x4f49('0x36')](_0x5e7076[_0x4f49('0x30')],_0x5e7076[_0x4f49('0x34')]);_0x7a6ea0[_0x4f49('0x37')]=_[_0x4f49('0x36')](_0x5e7076[_0x4f49('0x30')],qs[_0x4f49('0x38')](_0x3e207f[_0x4f49('0x34')][_0x4f49('0x38')]));_0x7a6ea0[_0x4f49('0x37')]=_0x7a6ea0['attributes'][_0x4f49('0x39')]?_0x7a6ea0[_0x4f49('0x37')]:_0x5e7076[_0x4f49('0x30')];if(_0x3e207f[_0x4f49('0x34')][_0x4f49('0x3a')]){_0x7a6ea0[_0x4f49('0x3b')]=[{'all':!![]}];}_0x7a6ea0=_[_0x4f49('0x3c')]({},_0x7a6ea0,_0x3e207f[_0x4f49('0x3d')]);return db[_0x4f49('0x32')][_0x4f49('0x3e')](_0x7a6ea0)[_0x4f49('0x2b')](handleEntityNotFound(_0x27d004,null))[_0x4f49('0x2b')](respondWithResult(_0x27d004,null))[_0x4f49('0x3f')](handleError(_0x27d004,null));};exports['destroy']=function(_0x371282,_0x27b7a9){return db[_0x4f49('0x32')][_0x4f49('0x3e')]({'where':{'id':_0x371282[_0x4f49('0x2f')]['id']}})[_0x4f49('0x2b')](handleEntityNotFound(_0x27b7a9,null))[_0x4f49('0x2b')](removeEntity(_0x27b7a9,null))[_0x4f49('0x3f')](handleError(_0x27b7a9,null));};function widgetAttributes(_0x10bfc4){try{switch(_0x10bfc4[_0x4f49('0x40')]){case _0x4f49('0x41'):return[{'name':_0x4f49('0x42'),'value':_0x10bfc4[_0x4f49('0x42')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4['attrs'][0x0]?_0x10bfc4[_0x4f49('0x43')][0x0][_0x4f49('0x44')]:undefined)||'https://'}];case _0x4f49('0x45'):return[{'name':_0x4f49('0x46'),'value':_0x10bfc4['attrPath']||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x0]?_0x10bfc4[_0x4f49('0x43')][0x0][_0x4f49('0x44')]:undefined)||''}];case _0x4f49('0x47'):return[{'name':_0x4f49('0x48'),'value':_0x10bfc4[_0x4f49('0x48')]||(_0x10bfc4['attrs']&&_0x10bfc4['attrs'][0x0]?_0x10bfc4['attrs'][0x0][_0x4f49('0x44')]:undefined)||_0x4f49('0x49')},{'name':_0x4f49('0x4a'),'value':_0x10bfc4[_0x4f49('0x4a')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x1]?_0x10bfc4[_0x4f49('0x43')][0x1][_0x4f49('0x44')]:undefined)||_0x4f49('0x4b')},{'name':'attrFontSize','value':_0x10bfc4['attrFontSize']||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x2]?_0x10bfc4[_0x4f49('0x43')][0x2]['value']:undefined)||0xc}];case _0x4f49('0x4c'):return[{'name':'attrMetric','value':_0x10bfc4['attrMetric']||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x0]?_0x10bfc4[_0x4f49('0x43')][0x0]['value']:undefined)||_0x4f49('0x4d')},{'name':_0x4f49('0x4e'),'value':_0x10bfc4['attrVoiceQueues']||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4['attrs'][0x1]?_0x10bfc4[_0x4f49('0x43')][0x1][_0x4f49('0x44')]:undefined)||[]},{'name':_0x4f49('0x4f'),'value':_0x10bfc4['attrFontSize']||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x2]?_0x10bfc4[_0x4f49('0x43')][0x2][_0x4f49('0x44')]:undefined)||0x14},{'name':_0x4f49('0x50'),'value':_0x10bfc4[_0x4f49('0x50')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x3]?_0x10bfc4[_0x4f49('0x43')][0x3][_0x4f49('0x44')]:undefined)||'voice'},{'name':_0x4f49('0x51'),'value':_0x10bfc4[_0x4f49('0x51')]||(_0x10bfc4['attrs']&&_0x10bfc4[_0x4f49('0x43')][0x4]?_0x10bfc4['attrs'][0x4][_0x4f49('0x44')]:undefined)||''},{'name':_0x4f49('0x52'),'value':_0x10bfc4[_0x4f49('0x52')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4['attrs'][0x5]?_0x10bfc4[_0x4f49('0x43')][0x5][_0x4f49('0x44')]:undefined)||''},{'name':_0x4f49('0x53'),'value':_0x10bfc4[_0x4f49('0x53')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x6]?_0x10bfc4[_0x4f49('0x43')][0x6][_0x4f49('0x44')]:undefined)||''},{'name':_0x4f49('0x54'),'value':_0x10bfc4[_0x4f49('0x54')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x7]?_0x10bfc4[_0x4f49('0x43')][0x7][_0x4f49('0x44')]:undefined)||''},{'name':_0x4f49('0x55'),'value':_0x10bfc4[_0x4f49('0x55')]||(_0x10bfc4['attrs']&&_0x10bfc4['attrs'][0x8]?_0x10bfc4[_0x4f49('0x43')][0x8][_0x4f49('0x44')]:undefined)||''},{'name':_0x4f49('0x56'),'value':_0x10bfc4[_0x4f49('0x56')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x9]?_0x10bfc4[_0x4f49('0x43')][0x9]['value']:undefined)||''}];case _0x4f49('0x57'):case'pie-chart':return[{'name':_0x4f49('0x58'),'value':_0x10bfc4[_0x4f49('0x58')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x0]?_0x10bfc4['attrs'][0x0][_0x4f49('0x44')]:undefined)||'total'},{'name':'attrSerie2','value':_0x10bfc4[_0x4f49('0x59')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x1]?_0x10bfc4[_0x4f49('0x43')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x10bfc4[_0x4f49('0x5a')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4['attrs'][0x2]?_0x10bfc4[_0x4f49('0x43')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x10bfc4[_0x4f49('0x4e')]||(_0x10bfc4['attrs']&&_0x10bfc4[_0x4f49('0x43')][0x3]?_0x10bfc4['attrs'][0x3][_0x4f49('0x44')]:undefined)||[]},{'name':_0x4f49('0x50'),'value':_0x10bfc4[_0x4f49('0x50')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x4]?_0x10bfc4[_0x4f49('0x43')][0x4][_0x4f49('0x44')]:undefined)||_0x4f49('0x5b')},{'name':'attrEmailAccounts','value':_0x10bfc4[_0x4f49('0x51')]||(_0x10bfc4['attrs']&&_0x10bfc4[_0x4f49('0x43')][0x5]?_0x10bfc4[_0x4f49('0x43')][0x5][_0x4f49('0x44')]:undefined)||''},{'name':_0x4f49('0x52'),'value':_0x10bfc4[_0x4f49('0x52')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4['attrs'][0x6]?_0x10bfc4[_0x4f49('0x43')][0x6][_0x4f49('0x44')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x10bfc4['attrSmsAccounts']||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x7]?_0x10bfc4[_0x4f49('0x43')][0x7][_0x4f49('0x44')]:undefined)||''},{'name':_0x4f49('0x54'),'value':_0x10bfc4['attrOpenchannelAccounts']||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4['attrs'][0x8]?_0x10bfc4[_0x4f49('0x43')][0x8][_0x4f49('0x44')]:undefined)||''},{'name':_0x4f49('0x55'),'value':_0x10bfc4['attrWhatsappAccounts']||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x9]?_0x10bfc4[_0x4f49('0x43')][0x9][_0x4f49('0x44')]:undefined)||''},{'name':'attrChatWebsites','value':_0x10bfc4[_0x4f49('0x56')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4['attrs'][0xa]?_0x10bfc4[_0x4f49('0x43')][0xa][_0x4f49('0x44')]:undefined)||''}];case _0x4f49('0x5c'):return[{'name':_0x4f49('0x5d'),'type':_0x10bfc4[_0x4f49('0x5e')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x0]?_0x10bfc4[_0x4f49('0x43')][0x0]['type']:undefined)||null,'value':_0x10bfc4[_0x4f49('0x5d')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x0]?_0x10bfc4[_0x4f49('0x43')][0x0][_0x4f49('0x44')]:undefined)||null},{'name':_0x4f49('0x5f'),'value':_0x10bfc4[_0x4f49('0x5f')]||(_0x10bfc4['attrs']&&_0x10bfc4[_0x4f49('0x43')][0x1]?_0x10bfc4['attrs'][0x1][_0x4f49('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x2b491c){logger[_0x4f49('0x2d')](_0x4f49('0x60'),JSON[_0x4f49('0x61')](_0x2b491c));return[];}}exports[_0x4f49('0x62')]=function(_0x61a565,_0x297698){if(_0x61a565[_0x4f49('0x63')]){_0x61a565[_0x4f49('0x63')]['attrs']=widgetAttributes(_0x61a565[_0x4f49('0x63')]);}return db[_0x4f49('0x32')][_0x4f49('0x62')](_0x61a565[_0x4f49('0x63')],{})['then'](respondWithResult(_0x297698,0xc9))['catch'](handleError(_0x297698,null));};exports[_0x4f49('0x2a')]=function(_0x5e4879,_0x30defd){if(_0x5e4879[_0x4f49('0x63')]['id']){delete _0x5e4879[_0x4f49('0x63')]['id'];}_0x5e4879[_0x4f49('0x63')][_0x4f49('0x43')]=widgetAttributes(_0x5e4879[_0x4f49('0x63')]);return db[_0x4f49('0x32')][_0x4f49('0x3e')]({'where':{'id':_0x5e4879[_0x4f49('0x2f')]['id']}})[_0x4f49('0x2b')](handleEntityNotFound(_0x30defd,null))[_0x4f49('0x2b')](saveUpdates(_0x5e4879[_0x4f49('0x63')],null))[_0x4f49('0x2b')](respondWithResult(_0x30defd,null))[_0x4f49('0x3f')](handleError(_0x30defd,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 56bd6ec..67f121d 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 _0xc02c=['setMaxListeners','update','remove','emit','hook','exports','events'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xc02c,0x16b));var _0xcc02=function(_0x140d2f,_0x2ad576){_0x140d2f=_0x140d2f-0x0;var _0x1a04c6=_0xc02c[_0x140d2f];return _0x1a04c6;};'use strict';var EventEmitter=require(_0xcc02('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xcc02('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcc02('0x2'),'afterDestroy':_0xcc02('0x3')};function emitEvent(_0x349096){return function(_0x357e24,_0x4513e1,_0x4a61f7){DashboardItemEvents[_0xcc02('0x4')](_0x349096+':'+_0x357e24['id'],_0x357e24);DashboardItemEvents[_0xcc02('0x4')](_0x349096,_0x357e24);_0x4a61f7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xcc02('0x5')](e,emitEvent(event));}}module[_0xcc02('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0x5505=['../../mysqldb','DashboardItem','save','update','remove','emit','hook','exports','events'];(function(_0xb80049,_0x442f7d){var _0x4ece41=function(_0x571734){while(--_0x571734){_0xb80049['push'](_0xb80049['shift']());}};_0x4ece41(++_0x442f7d);}(_0x5505,0x1ee));var _0x5550=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5505[_0x2b4411];return _0x8e41ef;};'use strict';var EventEmitter=require(_0x5550('0x0'));var DashboardItem=require(_0x5550('0x1'))['db'][_0x5550('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5550('0x3'),'afterUpdate':_0x5550('0x4'),'afterDestroy':_0x5550('0x5')};function emitEvent(_0x1d159a){return function(_0x2f24e2,_0x2aa014,_0x1948cb){DashboardItemEvents[_0x5550('0x6')](_0x1d159a+':'+_0x2f24e2['id'],_0x2f24e2);DashboardItemEvents[_0x5550('0x6')](_0x1d159a,_0x2f24e2);_0x1948cb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x5550('0x7')](e,emitEvent(event));}}module[_0x5550('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 bb1fd54..026d349 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 _0xd011=['exports','dashboard_items','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes'];(function(_0x156e99,_0x2bf27e){var _0x18870e=function(_0x3e6c3b){while(--_0x3e6c3b){_0x156e99['push'](_0x156e99['shift']());}};_0x18870e(++_0x2bf27e);}(_0xd011,0x156));var _0x1d01=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd011[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1d01('0x0'));var util=require('util');var logger=require(_0x1d01('0x1'))('api');var moment=require(_0x1d01('0x2'));var BPromise=require(_0x1d01('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1d01('0x4'));var rimraf=require(_0x1d01('0x5'));var config=require(_0x1d01('0x6'));var attributes=require(_0x1d01('0x7'));module[_0x1d01('0x8')]=function(_0x537fb8,_0xb35cab){return _0x537fb8['define']('DashboardItem',attributes,{'tableName':_0x1d01('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c5f=['DashboardItem','dashboard_items','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./dashboardItem.attributes','exports','define'];(function(_0x2bdecd,_0x21805f){var _0x56116e=function(_0x297d20){while(--_0x297d20){_0x2bdecd['push'](_0x2bdecd['shift']());}};_0x56116e(++_0x21805f);}(_0x5c5f,0x120));var _0xf5c5=function(_0x145b1e,_0x3e089c){_0x145b1e=_0x145b1e-0x0;var _0x5db350=_0x5c5f[_0x145b1e];return _0x5db350;};'use strict';var _=require(_0xf5c5('0x0'));var util=require(_0xf5c5('0x1'));var logger=require('../../config/logger')(_0xf5c5('0x2'));var moment=require(_0xf5c5('0x3'));var BPromise=require(_0xf5c5('0x4'));var rp=require(_0xf5c5('0x5'));var fs=require('fs');var path=require(_0xf5c5('0x6'));var rimraf=require(_0xf5c5('0x7'));var config=require('../../config/environment');var attributes=require(_0xf5c5('0x8'));module[_0xf5c5('0x9')]=function(_0x323036,_0x2c4dad){return _0x323036[_0xf5c5('0xa')](_0xf5c5('0xb'),attributes,{'tableName':_0xf5c5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index fbf3aa0..69fca94 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 _0x6473=['redis','defaults','localhost','socket.io-emitter','request\x20sent','debug','stringify','error','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x355d27,_0x37178b){var _0x2af066=function(_0x94b630){while(--_0x94b630){_0x355d27['push'](_0x355d27['shift']());}};_0x2af066(++_0x37178b);}(_0x6473,0x12a));var _0x3647=function(_0x32a32d,_0x5e3029){_0x32a32d=_0x32a32d-0x0;var _0x44322c=_0x6473[_0x32a32d];return _0x44322c;};'use strict';var _=require(_0x3647('0x0'));var util=require(_0x3647('0x1'));var moment=require(_0x3647('0x2'));var BPromise=require('bluebird');var rs=require(_0x3647('0x3'));var fs=require('fs');var Redis=require(_0x3647('0x4'));var db=require(_0x3647('0x5'))['db'];var utils=require(_0x3647('0x6'));var logger=require(_0x3647('0x7'))(_0x3647('0x8'));var config=require(_0x3647('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x3647('0xa')]=_[_0x3647('0xb')](config[_0x3647('0xa')],{'host':_0x3647('0xc'),'port':0x18eb});var socket=require(_0x3647('0xd'))(new Redis(config[_0x3647('0xa')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x6518c6,_0x5c4f45,_0x42d588){return new BPromise(function(_0x50541b,_0x3c567c){return client['request'](_0x6518c6,_0x42d588)['then'](function(_0x4af682){logger['info']('DashboardItem,\x20%s,\x20%s',_0x5c4f45,_0x3647('0xe'));logger[_0x3647('0xf')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x5c4f45,'request\x20sent',JSON[_0x3647('0x10')](_0x4af682));if(_0x4af682[_0x3647('0x11')]){if(_0x4af682[_0x3647('0x11')]['code']===0x1f4){logger[_0x3647('0x11')](_0x3647('0x12'),_0x5c4f45,_0x4af682['error'][_0x3647('0x13')]);return _0x3c567c(_0x4af682[_0x3647('0x11')]['message']);}logger[_0x3647('0x11')](_0x3647('0x12'),_0x5c4f45,_0x4af682[_0x3647('0x11')][_0x3647('0x13')]);return _0x50541b(_0x4af682['error'][_0x3647('0x13')]);}else{logger['info'](_0x3647('0x12'),_0x5c4f45,_0x3647('0xe'));_0x50541b(_0x4af682[_0x3647('0x14')][_0x3647('0x13')]);}})[_0x3647('0x15')](function(_0x99afbc){logger[_0x3647('0x11')](_0x3647('0x12'),_0x5c4f45,_0x99afbc);_0x3c567c(_0x99afbc);});});} \ No newline at end of file +var _0x51fa=['error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s'];(function(_0x379097,_0x104b7c){var _0x320154=function(_0x281595){while(--_0x281595){_0x379097['push'](_0x379097['shift']());}};_0x320154(++_0x104b7c);}(_0x51fa,0xe5));var _0xa51f=function(_0x35b44c,_0x80e76){_0x35b44c=_0x35b44c-0x0;var _0xeb4484=_0x51fa[_0x35b44c];return _0xeb4484;};'use strict';var _=require(_0xa51f('0x0'));var util=require(_0xa51f('0x1'));var moment=require(_0xa51f('0x2'));var BPromise=require(_0xa51f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa51f('0x4'))['db'];var utils=require(_0xa51f('0x5'));var logger=require('../../config/logger')(_0xa51f('0x6'));var config=require(_0xa51f('0x7'));var jayson=require(_0xa51f('0x8'));var client=jayson['client'][_0xa51f('0x9')]({'port':0x232a});config[_0xa51f('0xa')]=_[_0xa51f('0xb')](config[_0xa51f('0xa')],{'host':_0xa51f('0xc'),'port':0x18eb});var socket=require(_0xa51f('0xd'))(new Redis(config['redis']));require(_0xa51f('0xe'))[_0xa51f('0xf')](socket);function respondWithRpcPromise(_0x129a4d,_0x5ae16a,_0x2c4a18){return new BPromise(function(_0x83fe70,_0x18503c){return client[_0xa51f('0x10')](_0x129a4d,_0x2c4a18)[_0xa51f('0x11')](function(_0x2755da){logger[_0xa51f('0x12')](_0xa51f('0x13'),_0x5ae16a,_0xa51f('0x14'));logger[_0xa51f('0x15')](_0xa51f('0x16'),_0x5ae16a,_0xa51f('0x14'),JSON['stringify'](_0x2755da));if(_0x2755da['error']){if(_0x2755da[_0xa51f('0x17')][_0xa51f('0x18')]===0x1f4){logger[_0xa51f('0x17')]('DashboardItem,\x20%s,\x20%s',_0x5ae16a,_0x2755da[_0xa51f('0x17')][_0xa51f('0x19')]);return _0x18503c(_0x2755da[_0xa51f('0x17')][_0xa51f('0x19')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x5ae16a,_0x2755da[_0xa51f('0x17')]['message']);return _0x83fe70(_0x2755da['error'][_0xa51f('0x19')]);}else{logger[_0xa51f('0x12')]('DashboardItem,\x20%s,\x20%s',_0x5ae16a,'request\x20sent');_0x83fe70(_0x2755da[_0xa51f('0x1a')][_0xa51f('0x19')]);}})[_0xa51f('0x1b')](function(_0x2f7a68){logger[_0xa51f('0x17')](_0xa51f('0x13'),_0x5ae16a,_0x2f7a68);_0x18503c(_0x2f7a68);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 528913a..e5d185c 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 _0xfded=['./dashboardItem.events','remove','update','emit','removeListener','register','length','dashboardItem:'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xfded,0xa0));var _0xdfde=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0xfded[_0x1ee351];return _0x245aaf;};'use strict';var DashboardItemEvents=require(_0xdfde('0x0'));var events=['save',_0xdfde('0x1'),_0xdfde('0x2')];function createListener(_0x4f3734,_0x3d1ed6){return function(_0x56dd22){_0x3d1ed6[_0xdfde('0x3')](_0x4f3734,_0x56dd22);};}function removeListener(_0x1db6e2,_0x4d015b){return function(){DashboardItemEvents[_0xdfde('0x4')](_0x1db6e2,_0x4d015b);};}exports[_0xdfde('0x5')]=function(_0x5def5b){for(var _0x46c569=0x0,_0x4d74fa=events[_0xdfde('0x6')];_0x46c569<_0x4d74fa;_0x46c569++){var _0x15ea89=events[_0x46c569];var _0xd0c1de=createListener(_0xdfde('0x7')+_0x15ea89,_0x5def5b);DashboardItemEvents['on'](_0x15ea89,_0xd0c1de);}}; \ No newline at end of file +var _0x01f2=['removeListener','register','length','dashboardItem:','./dashboardItem.events','emit'];(function(_0x30142e,_0x37cbc6){var _0x45441a=function(_0x1d2706){while(--_0x1d2706){_0x30142e['push'](_0x30142e['shift']());}};_0x45441a(++_0x37cbc6);}(_0x01f2,0x184));var _0x201f=function(_0x5ae7bc,_0x38a9d6){_0x5ae7bc=_0x5ae7bc-0x0;var _0x14e200=_0x01f2[_0x5ae7bc];return _0x14e200;};'use strict';var DashboardItemEvents=require(_0x201f('0x0'));var events=['save','remove','update'];function createListener(_0x1f4ff0,_0x219233){return function(_0x299519){_0x219233[_0x201f('0x1')](_0x1f4ff0,_0x299519);};}function removeListener(_0x2744f5,_0x4281a9){return function(){DashboardItemEvents[_0x201f('0x2')](_0x2744f5,_0x4281a9);};}exports[_0x201f('0x3')]=function(_0x18c664){for(var _0x1d59f5=0x0,_0x379b75=events[_0x201f('0x4')];_0x1d59f5<_0x379b75;_0x1d59f5++){var _0x572a31=events[_0x1d59f5];var _0x37d68a=createListener(_0x201f('0x5')+_0x572a31,_0x18c664);DashboardItemEvents['on'](_0x572a31,_0x37d68a);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index e730a9d..fd0b7b1 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 _0x8b59=['exports','multer','connect-timeout','express','../../components/auth/service','./dashboardItem.controller','get','/:id','isAuthenticated','destroy'];(function(_0x4b4229,_0x20caf6){var _0x510da9=function(_0x4ffaf1){while(--_0x4ffaf1){_0x4b4229['push'](_0x4b4229['shift']());}};_0x510da9(++_0x20caf6);}(_0x8b59,0x191));var _0x98b5=function(_0x42c743,_0x1cc9e5){_0x42c743=_0x42c743-0x0;var _0x3f3244=_0x8b59[_0x42c743];return _0x3f3244;};'use strict';var multer=require(_0x98b5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x98b5('0x1'));var express=require(_0x98b5('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x98b5('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x98b5('0x4'));router[_0x98b5('0x5')](_0x98b5('0x6'),auth[_0x98b5('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x98b5('0x6'),auth[_0x98b5('0x7')](),controller['update']);router['delete'](_0x98b5('0x6'),auth[_0x98b5('0x7')](),controller[_0x98b5('0x8')]);module[_0x98b5('0x9')]=router; \ No newline at end of file +var _0x9efd=['path','express','Router','fs-extra','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer','util'];(function(_0x26e758,_0x1ddb95){var _0x1632b1=function(_0x1d3aa5){while(--_0x1d3aa5){_0x26e758['push'](_0x26e758['shift']());}};_0x1632b1(++_0x1ddb95);}(_0x9efd,0x196));var _0xd9ef=function(_0x247c27,_0x4053e5){_0x247c27=_0x247c27-0x0;var _0x20a4c6=_0x9efd[_0x247c27];return _0x20a4c6;};'use strict';var multer=require(_0xd9ef('0x0'));var util=require(_0xd9ef('0x1'));var path=require(_0xd9ef('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ef('0x3'));var router=express[_0xd9ef('0x4')]();var fs_extra=require(_0xd9ef('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd9ef('0x6'));var controller=require(_0xd9ef('0x7'));router[_0xd9ef('0x8')](_0xd9ef('0x9'),auth[_0xd9ef('0xa')](),controller['show']);router['post']('/',auth[_0xd9ef('0xa')](),controller[_0xd9ef('0xb')]);router[_0xd9ef('0xc')](_0xd9ef('0x9'),auth[_0xd9ef('0xa')](),controller[_0xd9ef('0xd')]);router[_0xd9ef('0xe')](_0xd9ef('0x9'),auth[_0xd9ef('0xa')](),controller[_0xd9ef('0xf')]);module[_0xd9ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 528b71d..4c0b45b 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 _0xc1f1=['STRING','ENUM','first','second','third','sequelize','exports'];(function(_0x59ece4,_0xce6de0){var _0x56a0ba=function(_0x4df59c){while(--_0x4df59c){_0x59ece4['push'](_0x59ece4['shift']());}};_0x56a0ba(++_0xce6de0);}(_0xc1f1,0xc2));var _0x1c1f=function(_0x158f5a,_0xaacc25){_0x158f5a=_0x158f5a-0x0;var _0xb3722e=_0xc1f1[_0x158f5a];return _0xb3722e;};'use strict';var Sequelize=require(_0x1c1f('0x0'));module[_0x1c1f('0x1')]={'name':{'type':Sequelize[_0x1c1f('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x1c1f('0x3')](_0x1c1f('0x4'),_0x1c1f('0x5'),_0x1c1f('0x6')),'allowNull':![],'defaultValue':_0x1c1f('0x4')},'description':{'type':Sequelize[_0x1c1f('0x2')]}}; \ No newline at end of file +var _0xc7dc=['ENUM','first','second','sequelize','exports','STRING'];(function(_0x819107,_0x2b42ba){var _0x395e85=function(_0x3f1d66){while(--_0x3f1d66){_0x819107['push'](_0x819107['shift']());}};_0x395e85(++_0x2b42ba);}(_0xc7dc,0xc9));var _0xcc7d=function(_0x50d086,_0x4e96e0){_0x50d086=_0x50d086-0x0;var _0x2e9e27=_0xc7dc[_0x50d086];return _0x2e9e27;};'use strict';var Sequelize=require(_0xcc7d('0x0'));module[_0xcc7d('0x1')]={'name':{'type':Sequelize[_0xcc7d('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xcc7d('0x3')](_0xcc7d('0x4'),_0xcc7d('0x5'),'third'),'allowNull':![],'defaultValue':_0xcc7d('0x4')},'description':{'type':Sequelize[_0xcc7d('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 5bff757..a030055 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 _0x1317=['keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','get','Dispositions','error','stack','name','send','map','Disposition','rawAttributes','type','key','model'];(function(_0x2ddd8b,_0x515476){var _0x40975b=function(_0x58df79){while(--_0x58df79){_0x2ddd8b['push'](_0x2ddd8b['shift']());}};_0x40975b(++_0x515476);}(_0x1317,0x1bb));var _0x7131=function(_0x34e63a,_0x12d90a){_0x34e63a=_0x34e63a-0x0;var _0x149b50=_0x1317[_0x34e63a];return _0x149b50;};'use strict';var emlformat=require(_0x7131('0x0'));var rimraf=require(_0x7131('0x1'));var zipdir=require(_0x7131('0x2'));var jsonpatch=require(_0x7131('0x3'));var rp=require(_0x7131('0x4'));var moment=require(_0x7131('0x5'));var BPromise=require(_0x7131('0x6'));var Mustache=require(_0x7131('0x7'));var util=require('util');var path=require(_0x7131('0x8'));var sox=require(_0x7131('0x9'));var csv=require(_0x7131('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7131('0xb'));var _=require(_0x7131('0xc'));var squel=require(_0x7131('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7131('0xe'));var Papa=require(_0x7131('0xf'));var Redis=require(_0x7131('0x10'));var authService=require(_0x7131('0x11'));var qs=require(_0x7131('0x12'));var as=require(_0x7131('0x13'));var hardwareService=require(_0x7131('0x14'));var logger=require('../../config/logger')(_0x7131('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7131('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x532681,_0x3b20a0){_0x3b20a0=_0x3b20a0||0xcc;return function(_0x1bb9f7){if(_0x1bb9f7){return _0x532681[_0x7131('0x17')](_0x3b20a0);}return _0x532681['status'](_0x3b20a0)[_0x7131('0x18')]();};}function respondWithResult(_0x2651d0,_0x3dab31){_0x3dab31=_0x3dab31||0xc8;return function(_0x18fec1){if(_0x18fec1){return _0x2651d0[_0x7131('0x19')](_0x3dab31)['json'](_0x18fec1);}};}function respondWithFilteredResult(_0x8903b7,_0x33890d){return function(_0x312252){if(_0x312252){var _0x2c0e4e=typeof _0x33890d[_0x7131('0x1a')]===_0x7131('0x1b')&&typeof _0x33890d[_0x7131('0x1c')]===_0x7131('0x1b');var _0x100784=_0x312252['count'];var _0x1c96f2=_0x2c0e4e?0x0:_0x33890d['offset'];var _0x4f088d=_0x2c0e4e?_0x312252[_0x7131('0x1d')]:_0x33890d[_0x7131('0x1a')]+_0x33890d[_0x7131('0x1c')];var _0x3a61a1;if(_0x4f088d>=_0x100784){_0x4f088d=_0x100784;_0x3a61a1=0xc8;}else{_0x3a61a1=0xce;}_0x8903b7[_0x7131('0x19')](_0x3a61a1);return _0x8903b7['set']('Content-Range',_0x1c96f2+'-'+_0x4f088d+'/'+_0x100784)[_0x7131('0x1e')](_0x312252);}return null;};}function patchUpdates(_0x27a7d8){return function(_0x44332d){try{jsonpatch[_0x7131('0x1f')](_0x44332d,_0x27a7d8,!![]);}catch(_0x3cbe3b){return BPromise[_0x7131('0x20')](_0x3cbe3b);}return _0x44332d[_0x7131('0x21')]();};}function saveUpdates(_0x173a11,_0x420125){return function(_0x1f03fc){if(_0x1f03fc){return _0x1f03fc[_0x7131('0x22')](_0x173a11)[_0x7131('0x23')](function(_0x34da57){return _0x34da57;});}return null;};}function removeEntity(_0x25d424,_0x2abc12){return function(_0x1c1a7f){if(_0x1c1a7f){return _0x1c1a7f[_0x7131('0x24')]()[_0x7131('0x23')](function(){var _0xd8aeee=_0x1c1a7f[_0x7131('0x25')]({'plain':!![]});var _0x502c99=_0x7131('0x26');return db['UserProfileResource'][_0x7131('0x24')]({'where':{'type':_0x502c99,'resourceId':_0xd8aeee['id']}})[_0x7131('0x23')](function(){return _0x1c1a7f;});})['then'](function(){_0x25d424['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x516194,_0x2dfa01){return function(_0xe7f504){if(!_0xe7f504){_0x516194[_0x7131('0x17')](0x194);}return _0xe7f504;};}function handleError(_0x21cac3,_0x24b58d){_0x24b58d=_0x24b58d||0x1f4;return function(_0x3de8e1){logger[_0x7131('0x27')](_0x3de8e1[_0x7131('0x28')]);if(_0x3de8e1[_0x7131('0x29')]){delete _0x3de8e1[_0x7131('0x29')];}_0x21cac3[_0x7131('0x19')](_0x24b58d)[_0x7131('0x2a')](_0x3de8e1);};}exports['index']=function(_0x3028f7,_0x219526){var _0x591a2f={},_0x49ada9={},_0x163416={'count':0x0,'rows':[]};var _0x29cc0e=_[_0x7131('0x2b')](db[_0x7131('0x2c')][_0x7131('0x2d')],function(_0x1271c4){return{'name':_0x1271c4['fieldName'],'type':_0x1271c4[_0x7131('0x2e')][_0x7131('0x2f')]};});_0x49ada9[_0x7131('0x30')]=_[_0x7131('0x2b')](_0x29cc0e,_0x7131('0x29'));_0x49ada9['query']=_[_0x7131('0x31')](_0x3028f7[_0x7131('0x32')]);_0x49ada9['filters']=_[_0x7131('0x33')](_0x49ada9['model'],_0x49ada9[_0x7131('0x32')]);_0x591a2f['attributes']=_[_0x7131('0x33')](_0x49ada9['model'],qs[_0x7131('0x34')](_0x3028f7[_0x7131('0x32')][_0x7131('0x34')]));_0x591a2f['attributes']=_0x591a2f[_0x7131('0x35')][_0x7131('0x36')]?_0x591a2f[_0x7131('0x35')]:_0x49ada9[_0x7131('0x30')];if(!_0x3028f7[_0x7131('0x32')][_0x7131('0x37')](_0x7131('0x38'))){_0x591a2f['limit']=qs['limit'](_0x3028f7[_0x7131('0x32')][_0x7131('0x1c')]);_0x591a2f[_0x7131('0x1a')]=qs[_0x7131('0x1a')](_0x3028f7['query']['offset']);}_0x591a2f[_0x7131('0x39')]=qs[_0x7131('0x3a')](_0x3028f7[_0x7131('0x32')][_0x7131('0x3a')]);_0x591a2f['where']=qs[_0x7131('0x3b')](_[_0x7131('0x3c')](_0x3028f7[_0x7131('0x32')],_0x49ada9['filters']),_0x29cc0e);if(_0x3028f7[_0x7131('0x32')]['filter']){_0x591a2f[_0x7131('0x3d')]=_[_0x7131('0x3e')](_0x591a2f[_0x7131('0x3d')],{'$or':_[_0x7131('0x2b')](_0x29cc0e,function(_0x42799c){if(_0x42799c[_0x7131('0x2e')]!==_0x7131('0x3f')){var _0x38955c={};_0x38955c[_0x42799c[_0x7131('0x29')]]={'$like':'%'+_0x3028f7['query'][_0x7131('0x40')]+'%'};return _0x38955c;}})});}_0x591a2f=_[_0x7131('0x3e')]({},_0x591a2f,_0x3028f7['options']);var _0x86d5d2={'where':_0x591a2f[_0x7131('0x3d')]};return db[_0x7131('0x2c')][_0x7131('0x1d')](_0x86d5d2)[_0x7131('0x23')](function(_0x27b406){_0x163416['count']=_0x27b406;if(_0x3028f7[_0x7131('0x32')][_0x7131('0x41')]){_0x591a2f[_0x7131('0x42')]=[{'all':!![]}];}return db['Disposition'][_0x7131('0x43')](_0x591a2f);})[_0x7131('0x23')](function(_0x4006c4){_0x163416[_0x7131('0x44')]=_0x4006c4;return _0x163416;})[_0x7131('0x23')](respondWithFilteredResult(_0x219526,_0x591a2f))[_0x7131('0x45')](handleError(_0x219526,null));};exports[_0x7131('0x46')]=function(_0x49f265,_0x3c7077){var _0x21fdaa={'raw':!![],'where':{'id':_0x49f265['params']['id']}},_0x3c3890={};_0x3c3890['model']=_[_0x7131('0x31')](db[_0x7131('0x2c')][_0x7131('0x2d')]);_0x3c3890[_0x7131('0x32')]=_[_0x7131('0x31')](_0x49f265[_0x7131('0x32')]);_0x3c3890['filters']=_[_0x7131('0x33')](_0x3c3890[_0x7131('0x30')],_0x3c3890[_0x7131('0x32')]);_0x21fdaa['attributes']=_['intersection'](_0x3c3890['model'],qs['fields'](_0x49f265[_0x7131('0x32')]['fields']));_0x21fdaa[_0x7131('0x35')]=_0x21fdaa['attributes'][_0x7131('0x36')]?_0x21fdaa[_0x7131('0x35')]:_0x3c3890[_0x7131('0x30')];if(_0x49f265[_0x7131('0x32')]['includeAll']){_0x21fdaa[_0x7131('0x42')]=[{'all':!![]}];}_0x21fdaa=_[_0x7131('0x3e')]({},_0x21fdaa,_0x49f265['options']);return db[_0x7131('0x2c')][_0x7131('0x47')](_0x21fdaa)[_0x7131('0x23')](handleEntityNotFound(_0x3c7077,null))[_0x7131('0x23')](respondWithResult(_0x3c7077,null))[_0x7131('0x45')](handleError(_0x3c7077,null));};exports[_0x7131('0x48')]=function(_0x58d031,_0x1bbf3b){return db[_0x7131('0x2c')][_0x7131('0x48')](_0x58d031['body'],{})[_0x7131('0x23')](function(_0x294eaf){var _0x52050f=_0x58d031[_0x7131('0x49')][_0x7131('0x25')]({'plain':!![]});if(!_0x52050f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52050f[_0x7131('0x4a')]==='user'){var _0x766dc8=_0x294eaf[_0x7131('0x25')]({'plain':!![]});var _0x55c1b7=_0x7131('0x26');return db[_0x7131('0x4b')][_0x7131('0x47')]({'where':{'name':_0x55c1b7,'userProfileId':_0x52050f[_0x7131('0x4c')]},'raw':!![]})[_0x7131('0x23')](function(_0x31f914){if(_0x31f914&&_0x31f914[_0x7131('0x4d')]===0x0){return db[_0x7131('0x4e')]['create']({'name':_0x766dc8['name'],'resourceId':_0x766dc8['id'],'type':_0x31f914[_0x7131('0x29')],'sectionId':_0x31f914['id']},{})[_0x7131('0x23')](function(){return _0x294eaf;});}else{return _0x294eaf;}})[_0x7131('0x45')](function(_0x562e79){logger['error'](_0x7131('0x4f'),_0x562e79);throw _0x562e79;});}return _0x294eaf;})[_0x7131('0x23')](respondWithResult(_0x1bbf3b,0xc9))[_0x7131('0x45')](handleError(_0x1bbf3b,null));};exports[_0x7131('0x22')]=function(_0x39f6b8,_0x208154){if(_0x39f6b8[_0x7131('0x50')]['id']){delete _0x39f6b8['body']['id'];}return db[_0x7131('0x2c')][_0x7131('0x47')]({'where':{'id':_0x39f6b8[_0x7131('0x51')]['id']}})['then'](handleEntityNotFound(_0x208154,null))[_0x7131('0x23')](saveUpdates(_0x39f6b8[_0x7131('0x50')],null))['then'](respondWithResult(_0x208154,null))[_0x7131('0x45')](handleError(_0x208154,null));};exports['destroy']=function(_0x18fb91,_0x21c6a1){return db[_0x7131('0x2c')]['find']({'where':{'id':_0x18fb91['params']['id']}})[_0x7131('0x23')](handleEntityNotFound(_0x21c6a1,null))[_0x7131('0x23')](removeEntity(_0x21c6a1,null))[_0x7131('0x45')](handleError(_0x21c6a1,null));}; \ No newline at end of file +var _0xedf9=['name','send','index','map','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','Disposition','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','Dispositions','UserProfileResource','error','stack'];(function(_0xca0df0,_0x50d081){var _0x5ed51d=function(_0xbb93f8){while(--_0xbb93f8){_0xca0df0['push'](_0xca0df0['shift']());}};_0x5ed51d(++_0x50d081);}(_0xedf9,0x130));var _0x9edf=function(_0x1b1f88,_0x3fe1cb){_0x1b1f88=_0x1b1f88-0x0;var _0x5045b9=_0xedf9[_0x1b1f88];return _0x5045b9;};'use strict';var emlformat=require(_0x9edf('0x0'));var rimraf=require(_0x9edf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9edf('0x2'));var moment=require('moment');var BPromise=require(_0x9edf('0x3'));var Mustache=require(_0x9edf('0x4'));var util=require(_0x9edf('0x5'));var path=require(_0x9edf('0x6'));var sox=require(_0x9edf('0x7'));var csv=require(_0x9edf('0x8'));var ejs=require(_0x9edf('0x9'));var fs=require('fs');var fs_extra=require(_0x9edf('0xa'));var _=require(_0x9edf('0xb'));var squel=require(_0x9edf('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9edf('0xd'));var toCsv=require(_0x9edf('0x8'));var querystring=require('querystring');var Papa=require(_0x9edf('0xe'));var Redis=require(_0x9edf('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9edf('0x10'));var as=require(_0x9edf('0x11'));var hardwareService=require(_0x9edf('0x12'));var logger=require(_0x9edf('0x13'))(_0x9edf('0x14'));var utils=require(_0x9edf('0x15'));var config=require(_0x9edf('0x16'));var licenseUtil=require(_0x9edf('0x17'));var db=require(_0x9edf('0x18'))['db'];function respondWithStatusCode(_0x4dcfd8,_0x108e04){_0x108e04=_0x108e04||0xcc;return function(_0x5289c5){if(_0x5289c5){return _0x4dcfd8[_0x9edf('0x19')](_0x108e04);}return _0x4dcfd8[_0x9edf('0x1a')](_0x108e04)[_0x9edf('0x1b')]();};}function respondWithResult(_0x2d94e9,_0x5e3852){_0x5e3852=_0x5e3852||0xc8;return function(_0x3beea4){if(_0x3beea4){return _0x2d94e9[_0x9edf('0x1a')](_0x5e3852)[_0x9edf('0x1c')](_0x3beea4);}};}function respondWithFilteredResult(_0x5a54a2,_0x51659d){return function(_0x1b7247){if(_0x1b7247){var _0x2ee789=typeof _0x51659d[_0x9edf('0x1d')]===_0x9edf('0x1e')&&typeof _0x51659d[_0x9edf('0x1f')]===_0x9edf('0x1e');var _0x283841=_0x1b7247[_0x9edf('0x20')];var _0x246711=_0x2ee789?0x0:_0x51659d[_0x9edf('0x1d')];var _0x6744d4=_0x2ee789?_0x1b7247[_0x9edf('0x20')]:_0x51659d['offset']+_0x51659d[_0x9edf('0x1f')];var _0x5a652f;if(_0x6744d4>=_0x283841){_0x6744d4=_0x283841;_0x5a652f=0xc8;}else{_0x5a652f=0xce;}_0x5a54a2[_0x9edf('0x1a')](_0x5a652f);return _0x5a54a2['set'](_0x9edf('0x21'),_0x246711+'-'+_0x6744d4+'/'+_0x283841)[_0x9edf('0x1c')](_0x1b7247);}return null;};}function patchUpdates(_0x32e6ed){return function(_0x477663){try{jsonpatch[_0x9edf('0x22')](_0x477663,_0x32e6ed,!![]);}catch(_0x945520){return BPromise[_0x9edf('0x23')](_0x945520);}return _0x477663[_0x9edf('0x24')]();};}function saveUpdates(_0x40bb10,_0x409686){return function(_0x1df3c6){if(_0x1df3c6){return _0x1df3c6[_0x9edf('0x25')](_0x40bb10)[_0x9edf('0x26')](function(_0xf11c57){return _0xf11c57;});}return null;};}function removeEntity(_0x56f461,_0x4f3f9c){return function(_0x479c6f){if(_0x479c6f){return _0x479c6f['destroy']()[_0x9edf('0x26')](function(){var _0x30f107=_0x479c6f[_0x9edf('0x27')]({'plain':!![]});var _0x43d02d=_0x9edf('0x28');return db[_0x9edf('0x29')]['destroy']({'where':{'type':_0x43d02d,'resourceId':_0x30f107['id']}})['then'](function(){return _0x479c6f;});})[_0x9edf('0x26')](function(){_0x56f461['status'](0xcc)[_0x9edf('0x1b')]();});}};}function handleEntityNotFound(_0xa3feb0,_0x1bddd1){return function(_0x43fe92){if(!_0x43fe92){_0xa3feb0['sendStatus'](0x194);}return _0x43fe92;};}function handleError(_0x1fa34b,_0x5a4877){_0x5a4877=_0x5a4877||0x1f4;return function(_0x52a1ee){logger[_0x9edf('0x2a')](_0x52a1ee[_0x9edf('0x2b')]);if(_0x52a1ee['name']){delete _0x52a1ee[_0x9edf('0x2c')];}_0x1fa34b[_0x9edf('0x1a')](_0x5a4877)[_0x9edf('0x2d')](_0x52a1ee);};}exports[_0x9edf('0x2e')]=function(_0x1940b4,_0x2b5c12){var _0x110cca={},_0x4130a9={},_0x5b8b80={'count':0x0,'rows':[]};var _0x552308=_[_0x9edf('0x2f')](db['Disposition']['rawAttributes'],function(_0x4d6f28){return{'name':_0x4d6f28[_0x9edf('0x30')],'type':_0x4d6f28[_0x9edf('0x31')][_0x9edf('0x32')]};});_0x4130a9[_0x9edf('0x33')]=_[_0x9edf('0x2f')](_0x552308,'name');_0x4130a9['query']=_['keys'](_0x1940b4['query']);_0x4130a9[_0x9edf('0x34')]=_[_0x9edf('0x35')](_0x4130a9[_0x9edf('0x33')],_0x4130a9[_0x9edf('0x36')]);_0x110cca[_0x9edf('0x37')]=_[_0x9edf('0x35')](_0x4130a9[_0x9edf('0x33')],qs[_0x9edf('0x38')](_0x1940b4[_0x9edf('0x36')][_0x9edf('0x38')]));_0x110cca[_0x9edf('0x37')]=_0x110cca[_0x9edf('0x37')][_0x9edf('0x39')]?_0x110cca[_0x9edf('0x37')]:_0x4130a9[_0x9edf('0x33')];if(!_0x1940b4[_0x9edf('0x36')]['hasOwnProperty'](_0x9edf('0x3a'))){_0x110cca[_0x9edf('0x1f')]=qs[_0x9edf('0x1f')](_0x1940b4[_0x9edf('0x36')][_0x9edf('0x1f')]);_0x110cca[_0x9edf('0x1d')]=qs[_0x9edf('0x1d')](_0x1940b4[_0x9edf('0x36')][_0x9edf('0x1d')]);}_0x110cca[_0x9edf('0x3b')]=qs[_0x9edf('0x3c')](_0x1940b4[_0x9edf('0x36')]['sort']);_0x110cca[_0x9edf('0x3d')]=qs[_0x9edf('0x34')](_[_0x9edf('0x3e')](_0x1940b4[_0x9edf('0x36')],_0x4130a9[_0x9edf('0x34')]),_0x552308);if(_0x1940b4['query']['filter']){_0x110cca[_0x9edf('0x3d')]=_['merge'](_0x110cca['where'],{'$or':_['map'](_0x552308,function(_0x15187b){if(_0x15187b[_0x9edf('0x31')]!==_0x9edf('0x3f')){var _0x271024={};_0x271024[_0x15187b[_0x9edf('0x2c')]]={'$like':'%'+_0x1940b4[_0x9edf('0x36')][_0x9edf('0x40')]+'%'};return _0x271024;}})});}_0x110cca=_[_0x9edf('0x41')]({},_0x110cca,_0x1940b4[_0x9edf('0x42')]);var _0x1d8884={'where':_0x110cca[_0x9edf('0x3d')]};return db[_0x9edf('0x43')][_0x9edf('0x20')](_0x1d8884)[_0x9edf('0x26')](function(_0x7263f0){_0x5b8b80[_0x9edf('0x20')]=_0x7263f0;if(_0x1940b4[_0x9edf('0x36')][_0x9edf('0x44')]){_0x110cca[_0x9edf('0x45')]=[{'all':!![]}];}return db[_0x9edf('0x43')][_0x9edf('0x46')](_0x110cca);})[_0x9edf('0x26')](function(_0x2b9f79){_0x5b8b80[_0x9edf('0x47')]=_0x2b9f79;return _0x5b8b80;})['then'](respondWithFilteredResult(_0x2b5c12,_0x110cca))[_0x9edf('0x48')](handleError(_0x2b5c12,null));};exports[_0x9edf('0x49')]=function(_0x16b795,_0x5675fd){var _0x27f741={'raw':!![],'where':{'id':_0x16b795[_0x9edf('0x4a')]['id']}},_0x47898b={};_0x47898b[_0x9edf('0x33')]=_[_0x9edf('0x4b')](db['Disposition']['rawAttributes']);_0x47898b[_0x9edf('0x36')]=_[_0x9edf('0x4b')](_0x16b795[_0x9edf('0x36')]);_0x47898b[_0x9edf('0x34')]=_[_0x9edf('0x35')](_0x47898b[_0x9edf('0x33')],_0x47898b[_0x9edf('0x36')]);_0x27f741[_0x9edf('0x37')]=_[_0x9edf('0x35')](_0x47898b[_0x9edf('0x33')],qs[_0x9edf('0x38')](_0x16b795[_0x9edf('0x36')][_0x9edf('0x38')]));_0x27f741['attributes']=_0x27f741['attributes'][_0x9edf('0x39')]?_0x27f741[_0x9edf('0x37')]:_0x47898b[_0x9edf('0x33')];if(_0x16b795[_0x9edf('0x36')][_0x9edf('0x44')]){_0x27f741[_0x9edf('0x45')]=[{'all':!![]}];}_0x27f741=_[_0x9edf('0x41')]({},_0x27f741,_0x16b795['options']);return db[_0x9edf('0x43')][_0x9edf('0x4c')](_0x27f741)[_0x9edf('0x26')](handleEntityNotFound(_0x5675fd,null))[_0x9edf('0x26')](respondWithResult(_0x5675fd,null))['catch'](handleError(_0x5675fd,null));};exports['create']=function(_0x422230,_0x4c4473){return db[_0x9edf('0x43')][_0x9edf('0x4d')](_0x422230[_0x9edf('0x4e')],{})[_0x9edf('0x26')](function(_0xc8e233){var _0x50f9ff=_0x422230[_0x9edf('0x4f')][_0x9edf('0x27')]({'plain':!![]});if(!_0x50f9ff)throw new Error(_0x9edf('0x50'));if(_0x50f9ff[_0x9edf('0x51')]==='user'){var _0x221209=_0xc8e233[_0x9edf('0x27')]({'plain':!![]});var _0x4c56ec=_0x9edf('0x28');return db[_0x9edf('0x52')][_0x9edf('0x4c')]({'where':{'name':_0x4c56ec,'userProfileId':_0x50f9ff[_0x9edf('0x53')]},'raw':!![]})['then'](function(_0x3573c2){if(_0x3573c2&&_0x3573c2[_0x9edf('0x54')]===0x0){return db[_0x9edf('0x29')][_0x9edf('0x4d')]({'name':_0x221209[_0x9edf('0x2c')],'resourceId':_0x221209['id'],'type':_0x3573c2[_0x9edf('0x2c')],'sectionId':_0x3573c2['id']},{})[_0x9edf('0x26')](function(){return _0xc8e233;});}else{return _0xc8e233;}})[_0x9edf('0x48')](function(_0x2b5608){logger['error'](_0x9edf('0x55'),_0x2b5608);throw _0x2b5608;});}return _0xc8e233;})[_0x9edf('0x26')](respondWithResult(_0x4c4473,0xc9))[_0x9edf('0x48')](handleError(_0x4c4473,null));};exports['update']=function(_0x34f5b7,_0x235d98){if(_0x34f5b7[_0x9edf('0x4e')]['id']){delete _0x34f5b7['body']['id'];}return db[_0x9edf('0x43')][_0x9edf('0x4c')]({'where':{'id':_0x34f5b7['params']['id']}})[_0x9edf('0x26')](handleEntityNotFound(_0x235d98,null))['then'](saveUpdates(_0x34f5b7[_0x9edf('0x4e')],null))['then'](respondWithResult(_0x235d98,null))[_0x9edf('0x48')](handleError(_0x235d98,null));};exports[_0x9edf('0x56')]=function(_0x1865e5,_0x2c0001){return db['Disposition'][_0x9edf('0x4c')]({'where':{'id':_0x1865e5['params']['id']}})[_0x9edf('0x26')](handleEntityNotFound(_0x2c0001,null))[_0x9edf('0x26')](removeEntity(_0x2c0001,null))[_0x9edf('0x48')](handleError(_0x2c0001,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 384c445..e82ce53 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 _0xad31=['bluebird','../../config/environment','./disposition.attributes','exports','Disposition','name_voice','name','ListId','name_chat','ChatWebsiteId','SmsAccountId','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','util','api','moment'];(function(_0x51ae22,_0x364012){var _0x15482c=function(_0x3c4073){while(--_0x3c4073){_0x51ae22['push'](_0x51ae22['shift']());}};_0x15482c(++_0x364012);}(_0xad31,0x152));var _0x1ad3=function(_0x4e23cb,_0x349ec4){_0x4e23cb=_0x4e23cb-0x0;var _0x445ef2=_0xad31[_0x4e23cb];return _0x445ef2;};'use strict';var _=require(_0x1ad3('0x0'));var util=require(_0x1ad3('0x1'));var logger=require('../../config/logger')(_0x1ad3('0x2'));var moment=require(_0x1ad3('0x3'));var BPromise=require(_0x1ad3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1ad3('0x5'));var attributes=require(_0x1ad3('0x6'));module[_0x1ad3('0x7')]=function(_0x35e5a6,_0x3b9573){return _0x35e5a6['define'](_0x1ad3('0x8'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x1ad3('0x9'),'fields':[_0x1ad3('0xa'),_0x1ad3('0xb')]},{'unique':!![],'name':_0x1ad3('0xc'),'fields':['name',_0x1ad3('0xd')]},{'unique':!![],'name':'name_mail','fields':[_0x1ad3('0xa'),'MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0x1ad3('0xa'),_0x1ad3('0xe')]},{'unique':!![],'name':'name_fax','fields':['name',_0x1ad3('0xf')]},{'unique':!![],'name':_0x1ad3('0x10'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0x1ad3('0x11'),'fields':[_0x1ad3('0xa'),_0x1ad3('0x12')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x33fd=['../../config/environment','./disposition.attributes','define','name_voice','ListId','name_chat','name','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x53ec4a,_0x43e28a){var _0x9d621c=function(_0x33dbd4){while(--_0x33dbd4){_0x53ec4a['push'](_0x53ec4a['shift']());}};_0x9d621c(++_0x43e28a);}(_0x33fd,0x1c7));var _0xd33f=function(_0x10626,_0x4fa035){_0x10626=_0x10626-0x0;var _0x2f43b3=_0x33fd[_0x10626];return _0x2f43b3;};'use strict';var _=require(_0xd33f('0x0'));var util=require(_0xd33f('0x1'));var logger=require(_0xd33f('0x2'))(_0xd33f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd33f('0x4'));var fs=require('fs');var path=require(_0xd33f('0x5'));var rimraf=require(_0xd33f('0x6'));var config=require(_0xd33f('0x7'));var attributes=require(_0xd33f('0x8'));module['exports']=function(_0x46dbf7,_0x339c8e){return _0x46dbf7[_0xd33f('0x9')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xd33f('0xa'),'fields':['name',_0xd33f('0xb')]},{'unique':!![],'name':_0xd33f('0xc'),'fields':[_0xd33f('0xd'),'ChatWebsiteId']},{'unique':!![],'name':_0xd33f('0xe'),'fields':['name',_0xd33f('0xf')]},{'unique':!![],'name':_0xd33f('0x10'),'fields':[_0xd33f('0xd'),_0xd33f('0x11')]},{'unique':!![],'name':_0xd33f('0x12'),'fields':[_0xd33f('0xd'),_0xd33f('0x13')]},{'unique':!![],'name':_0xd33f('0x14'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0xd33f('0xd'),'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 d85b1fb..bd8a585 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(_0x1d4980,_0x7101b4){var _0x2da3d3=function(_0x5a02e6){while(--_0x5a02e6){_0x1d4980['push'](_0x1d4980['shift']());}};_0x2da3d3(++_0x7101b4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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(_0x37fa03,_0x16ad88){var _0x54820c=function(_0xb17a41){while(--_0xb17a41){_0x37fa03['push'](_0x37fa03['shift']());}};_0x54820c(++_0x16ad88);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index bb022c2..f728c8e 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 _0xaf75=['show','create','update','delete','/:id','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','get'];(function(_0x4f634b,_0x1800b8){var _0x584eb5=function(_0x4dff46){while(--_0x4dff46){_0x4f634b['push'](_0x4f634b['shift']());}};_0x584eb5(++_0x1800b8);}(_0xaf75,0xcc));var _0x5af7=function(_0x48f3e8,_0x1f70d3){_0x48f3e8=_0x48f3e8-0x0;var _0x2ecd82=_0xaf75[_0x48f3e8];return _0x2ecd82;};'use strict';var multer=require(_0x5af7('0x0'));var util=require(_0x5af7('0x1'));var path=require('path');var timeout=require(_0x5af7('0x2'));var express=require(_0x5af7('0x3'));var router=express[_0x5af7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5af7('0x5'));var interaction=require(_0x5af7('0x6'));var config=require(_0x5af7('0x7'));var controller=require(_0x5af7('0x8'));router['get']('/',auth[_0x5af7('0x9')](),controller[_0x5af7('0xa')]);router[_0x5af7('0xb')]('/:id',auth[_0x5af7('0x9')](),controller[_0x5af7('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5af7('0xd')]);router['put']('/:id',auth[_0x5af7('0x9')](),controller[_0x5af7('0xe')]);router[_0x5af7('0xf')](_0x5af7('0x10'),auth[_0x5af7('0x9')](),controller['destroy']);module[_0x5af7('0x11')]=router; \ No newline at end of file +var _0xe33a=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','isAuthenticated','index','/:id','show','post','put'];(function(_0xab3370,_0x3f98f2){var _0x359956=function(_0x3960a2){while(--_0x3960a2){_0xab3370['push'](_0xab3370['shift']());}};_0x359956(++_0x3f98f2);}(_0xe33a,0x1bc));var _0xae33=function(_0x2707a7,_0x303d1c){_0x2707a7=_0x2707a7-0x0;var _0x10d254=_0xe33a[_0x2707a7];return _0x10d254;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xae33('0x0'));var timeout=require(_0xae33('0x1'));var express=require(_0xae33('0x2'));var router=express[_0xae33('0x3')]();var fs_extra=require(_0xae33('0x4'));var auth=require(_0xae33('0x5'));var interaction=require(_0xae33('0x6'));var config=require('../../config/environment');var controller=require(_0xae33('0x7'));router[_0xae33('0x8')]('/',auth[_0xae33('0x9')](),controller[_0xae33('0xa')]);router['get'](_0xae33('0xb'),auth['isAuthenticated'](),controller[_0xae33('0xc')]);router[_0xae33('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xae33('0xe')](_0xae33('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xae33('0xf')](_0xae33('0xb'),auth[_0xae33('0x9')](),controller[_0xae33('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 6d9e983..66fc254 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 _0xa41c=['yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','KHOMP','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa41c,0x189));var _0xca41=function(_0xe71fe1,_0x3c1808){_0xe71fe1=_0xe71fe1-0x0;var _0x3b1998=_0xa41c[_0xe71fe1];return _0x3b1998;};'use strict';var Sequelize=require(_0xca41('0x0'));module['exports']={'name':{'type':Sequelize[_0xca41('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xca41('0x1')]},'ecm':{'type':Sequelize[_0xca41('0x2')](_0xca41('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xca41('0x1')],'defaultValue':_0xca41('0x4')},'localstationid':{'type':Sequelize[_0xca41('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xca41('0x2')](_0xca41('0x5'),_0xca41('0x6'),_0xca41('0x7'),_0xca41('0x8'),_0xca41('0x9'),_0xca41('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xca41('0x2')](_0xca41('0x5'),_0xca41('0x6'),_0xca41('0x7'),_0xca41('0x8'),_0xca41('0x9'),_0xca41('0xa')),'defaultValue':_0xca41('0xa')},'modem':{'type':Sequelize[_0xca41('0x1')],'defaultValue':_0xca41('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xca41('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xca41('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xca41('0x2')](_0xca41('0xd'),_0xca41('0xe'),'DADHI',_0xca41('0xf')),'defaultValue':'SIP'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xca41('0xc')],'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[_0xca41('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xca41('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xca41('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xca41('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xca41('0x10')],'defaultValue':![],'comment':_0xca41('0x12'),'set':function(_0x130a95){if(!_0x130a95)this[_0xca41('0x13')](_0xca41('0x14'),null);this[_0xca41('0x13')](_0xca41('0x15'),_0x130a95);}}}; \ No newline at end of file +var _0x43e0=['7200','v17,v27,v29','INTEGER','SIP','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','yes','localstationid','ENUM','2400','4800','9600','12000','14400'];(function(_0x2f0983,_0x414536){var _0x2258ce=function(_0x100361){while(--_0x100361){_0x2f0983['push'](_0x2f0983['shift']());}};_0x2258ce(++_0x414536);}(_0x43e0,0x197));var _0x043e=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x43e0[_0x1deb03];return _0x189fe7;};'use strict';var Sequelize=require(_0x043e('0x0'));module[_0x043e('0x1')]={'name':{'type':Sequelize[_0x043e('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x043e('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x043e('0x3'),'no'),'defaultValue':_0x043e('0x3')},'headerinfo':{'type':Sequelize[_0x043e('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x043e('0x2')],'unique':_0x043e('0x4')},'minrate':{'type':Sequelize[_0x043e('0x5')](_0x043e('0x6'),_0x043e('0x7'),'7200',_0x043e('0x8'),_0x043e('0x9'),_0x043e('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x043e('0x5')](_0x043e('0x6'),_0x043e('0x7'),_0x043e('0xb'),'9600',_0x043e('0x9'),'14400'),'defaultValue':_0x043e('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x043e('0xc')},'gateway':{'type':Sequelize[_0x043e('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x043e('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x043e('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x043e('0x5')](_0x043e('0xe'),'IAX',_0x043e('0xf'),'KHOMP'),'defaultValue':_0x043e('0xe')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x043e('0x10')],'defaultValue':function(){return _0x043e('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x043e('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x043e('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x043e('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x043e('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x043e('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3ff599){if(!_0x3ff599)this[_0x043e('0x14')](_0x043e('0x15'),null);this[_0x043e('0x14')]('mandatoryDisposition',_0x3ff599);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 914c314..07c19c7 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 _0x566f=['message','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','FaxAccounts','stack','name','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','Pause','keys','include','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','FaxAccountId','Disposition','getDispositions','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addInteraction','omit','getInteractions','findOne','FaxInteraction','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','context','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','updateAccountApplications','VoiceExtension','tech','createdAt','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','updatedAt','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','\x22%s\x22\x20<%s>','fax','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x566f,0xa2));var _0xf566=function(_0x331e77,_0x114123){_0x331e77=_0x331e77-0x0;var _0x5b1b95=_0x566f[_0x331e77];return _0x5b1b95;};'use strict';var emlformat=require(_0xf566('0x0'));var rimraf=require(_0xf566('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf566('0x2'));var rp=require('request-promise');var moment=require(_0xf566('0x3'));var BPromise=require(_0xf566('0x4'));var Mustache=require(_0xf566('0x5'));var util=require(_0xf566('0x6'));var path=require(_0xf566('0x7'));var sox=require(_0xf566('0x8'));var csv=require(_0xf566('0x9'));var ejs=require(_0xf566('0xa'));var fs=require('fs');var fs_extra=require(_0xf566('0xb'));var _=require(_0xf566('0xc'));var squel=require(_0xf566('0xd'));var crypto=require(_0xf566('0xe'));var jsforce=require(_0xf566('0xf'));var deskjs=require(_0xf566('0x10'));var toCsv=require(_0xf566('0x9'));var querystring=require('querystring');var Papa=require(_0xf566('0x11'));var Redis=require(_0xf566('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf566('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf566('0x14'));var logger=require('../../config/logger')(_0xf566('0x15'));var utils=require(_0xf566('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf566('0x17'));var db=require('../../mysqldb')['db'];config[_0xf566('0x18')]=_[_0xf566('0x19')](config[_0xf566('0x18')],{'host':_0xf566('0x1a'),'port':0x18eb});var socket=require(_0xf566('0x1b'))(new Redis(config[_0xf566('0x18')]));require(_0xf566('0x1c'))[_0xf566('0x1d')](socket);var jayson=require(_0xf566('0x1e'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xf566('0x1f')][_0xf566('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2f3c1c,_0x64e944,_0x412bd0,_0x4086b5){return new BPromise(function(_0x2d5905,_0xe675fe){var _0xd1a27d=_0x4086b5||client;return _0xd1a27d[_0xf566('0x21')](_0x2f3c1c,_0x412bd0)['then'](function(_0x1f5862){logger[_0xf566('0x22')](_0xf566('0x23'),_0x64e944,_0xf566('0x24'));logger[_0xf566('0x25')](_0xf566('0x26'),_0x64e944,'request\x20sent',JSON[_0xf566('0x27')](_0x1f5862));if(_0x1f5862[_0xf566('0x28')]){if(_0x1f5862['error'][_0xf566('0x29')]===0x1f4){logger['error'](_0xf566('0x23'),_0x64e944,_0x1f5862[_0xf566('0x28')][_0xf566('0x2a')]);return _0xe675fe(_0x1f5862[_0xf566('0x28')]['message']);}logger['error'](_0xf566('0x23'),_0x64e944,_0x1f5862[_0xf566('0x28')]['message']);return _0x2d5905(_0x1f5862[_0xf566('0x28')][_0xf566('0x2a')]);}else{logger[_0xf566('0x22')]('FaxAccount,\x20%s,\x20%s',_0x64e944,'request\x20sent');_0x2d5905(_0x1f5862['result']['message']);}})[_0xf566('0x2b')](function(_0x4182ce){logger[_0xf566('0x28')](_0xf566('0x23'),_0x64e944,_0x4182ce);_0xe675fe(_0x4182ce);});});}function respondWithStatusCode(_0x354058,_0x15a882){_0x15a882=_0x15a882||0xcc;return function(_0x560cec){if(_0x560cec){return _0x354058[_0xf566('0x2c')](_0x15a882);}return _0x354058[_0xf566('0x2d')](_0x15a882)[_0xf566('0x2e')]();};}function respondWithResult(_0x37bba2,_0x4f6363){_0x4f6363=_0x4f6363||0xc8;return function(_0x2939df){if(_0x2939df){return _0x37bba2[_0xf566('0x2d')](_0x4f6363)['json'](_0x2939df);}};}function respondWithFilteredResult(_0x54822b,_0x49f8ad){return function(_0x392c06){if(_0x392c06){var _0x4ecdde=typeof _0x49f8ad[_0xf566('0x2f')]===_0xf566('0x30')&&typeof _0x49f8ad[_0xf566('0x31')]===_0xf566('0x30');var _0x4ad9ab=_0x392c06[_0xf566('0x32')];var _0x305593=_0x4ecdde?0x0:_0x49f8ad['offset'];var _0x2c1c48=_0x4ecdde?_0x392c06['count']:_0x49f8ad[_0xf566('0x2f')]+_0x49f8ad[_0xf566('0x31')];var _0x107014;if(_0x2c1c48>=_0x4ad9ab){_0x2c1c48=_0x4ad9ab;_0x107014=0xc8;}else{_0x107014=0xce;}_0x54822b[_0xf566('0x2d')](_0x107014);return _0x54822b[_0xf566('0x33')](_0xf566('0x34'),_0x305593+'-'+_0x2c1c48+'/'+_0x4ad9ab)[_0xf566('0x35')](_0x392c06);}return null;};}function patchUpdates(_0x4cdc81){return function(_0x393f1d){try{jsonpatch[_0xf566('0x36')](_0x393f1d,_0x4cdc81,!![]);}catch(_0x527589){return BPromise[_0xf566('0x37')](_0x527589);}return _0x393f1d['save']();};}function saveUpdates(_0xc15be2,_0x4cd7ce){return function(_0xbe0bfe){if(_0xbe0bfe){return _0xbe0bfe[_0xf566('0x38')](_0xc15be2)['then'](function(_0x583225){return _0x583225;});}return null;};}function removeEntity(_0x64d78,_0x3bfd53){return function(_0x1a8142){if(_0x1a8142){return _0x1a8142[_0xf566('0x39')]()[_0xf566('0x3a')](function(){var _0x4ea09c=_0x1a8142['get']({'plain':!![]});var _0x54209a=_0xf566('0x3b');return db['UserProfileResource'][_0xf566('0x39')]({'where':{'type':_0x54209a,'resourceId':_0x4ea09c['id']}})[_0xf566('0x3a')](function(){return _0x1a8142;});})[_0xf566('0x3a')](function(){_0x64d78[_0xf566('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4275fa,_0x3699fa){return function(_0x366b8a){if(!_0x366b8a){_0x4275fa['sendStatus'](0x194);}return _0x366b8a;};}function handleError(_0x35988c,_0x56d5be){_0x56d5be=_0x56d5be||0x1f4;return function(_0x190f6f){logger[_0xf566('0x28')](_0x190f6f[_0xf566('0x3c')]);if(_0x190f6f[_0xf566('0x3d')]){delete _0x190f6f[_0xf566('0x3d')];}_0x35988c['status'](_0x56d5be)['send'](_0x190f6f);};}exports[_0xf566('0x3e')]=function(_0x20db71,_0xcb9697){var _0x332b58={'include':[{'model':db['Pause'],'as':_0xf566('0x3f')}]},_0x195525={},_0xaf6572={'count':0x0,'rows':[]};var _0x1c7afc=_[_0xf566('0x40')](db[_0xf566('0x41')][_0xf566('0x42')],function(_0x37c0fd){return{'name':_0x37c0fd['fieldName'],'type':_0x37c0fd['type'][_0xf566('0x43')]};});_0x195525[_0xf566('0x44')]=_[_0xf566('0x40')](_0x1c7afc,_0xf566('0x3d'));_0x195525[_0xf566('0x45')]=_['keys'](_0x20db71[_0xf566('0x45')]);_0x195525[_0xf566('0x46')]=_[_0xf566('0x47')](_0x195525[_0xf566('0x44')],_0x195525[_0xf566('0x45')]);_0x332b58[_0xf566('0x48')]=_['intersection'](_0x195525[_0xf566('0x44')],qs[_0xf566('0x49')](_0x20db71[_0xf566('0x45')][_0xf566('0x49')]));_0x332b58['attributes']=_0x332b58[_0xf566('0x48')][_0xf566('0x4a')]?_0x332b58[_0xf566('0x48')]:_0x195525[_0xf566('0x44')];if(!_0x20db71[_0xf566('0x45')][_0xf566('0x4b')](_0xf566('0x4c'))){_0x332b58['limit']=qs[_0xf566('0x31')](_0x20db71[_0xf566('0x45')][_0xf566('0x31')]);_0x332b58[_0xf566('0x2f')]=qs['offset'](_0x20db71[_0xf566('0x45')][_0xf566('0x2f')]);}_0x332b58[_0xf566('0x4d')]=qs[_0xf566('0x4e')](_0x20db71[_0xf566('0x45')][_0xf566('0x4e')]);_0x332b58[_0xf566('0x4f')]=qs[_0xf566('0x46')](_[_0xf566('0x50')](_0x20db71[_0xf566('0x45')],_0x195525[_0xf566('0x46')]),_0x1c7afc);if(_0x20db71[_0xf566('0x45')]['filter']){_0x332b58[_0xf566('0x4f')]=_[_0xf566('0x51')](_0x332b58[_0xf566('0x4f')],{'$or':_['map'](_0x1c7afc,function(_0x4c9ae5){if(_0x4c9ae5[_0xf566('0x52')]!==_0xf566('0x53')){var _0x5ad4f2={};_0x5ad4f2[_0x4c9ae5['name']]={'$like':'%'+_0x20db71['query'][_0xf566('0x54')]+'%'};return _0x5ad4f2;}})});}_0x332b58=_[_0xf566('0x51')]({},_0x332b58,_0x20db71[_0xf566('0x55')]);var _0x9e154c={'where':_0x332b58[_0xf566('0x4f')]};return db['FaxAccount'][_0xf566('0x32')](_0x9e154c)['then'](function(_0x4e2492){_0xaf6572[_0xf566('0x32')]=_0x4e2492;if(_0x20db71[_0xf566('0x45')][_0xf566('0x56')]){_0x332b58['include']=[{'all':!![]}];}return db[_0xf566('0x41')][_0xf566('0x57')](_0x332b58);})[_0xf566('0x3a')](function(_0x14d1e6){_0xaf6572[_0xf566('0x58')]=_0x14d1e6;return _0xaf6572;})[_0xf566('0x3a')](respondWithFilteredResult(_0xcb9697,_0x332b58))[_0xf566('0x2b')](handleError(_0xcb9697,null));};exports[_0xf566('0x59')]=function(_0x25a57b,_0x285100){var _0x4cd6f9={'raw':![],'where':{'id':_0x25a57b[_0xf566('0x5a')]['id']},'include':[{'model':db[_0xf566('0x5b')],'as':_0xf566('0x3f')}]},_0x2f9acc={};_0x2f9acc['model']=_[_0xf566('0x5c')](db['FaxAccount'][_0xf566('0x42')]);_0x2f9acc['query']=_['keys'](_0x25a57b['query']);_0x2f9acc[_0xf566('0x46')]=_['intersection'](_0x2f9acc['model'],_0x2f9acc[_0xf566('0x45')]);_0x4cd6f9[_0xf566('0x48')]=_[_0xf566('0x47')](_0x2f9acc[_0xf566('0x44')],qs['fields'](_0x25a57b['query'][_0xf566('0x49')]));_0x4cd6f9[_0xf566('0x48')]=_0x4cd6f9[_0xf566('0x48')][_0xf566('0x4a')]?_0x4cd6f9['attributes']:_0x2f9acc[_0xf566('0x44')];if(_0x25a57b['query'][_0xf566('0x56')]){_0x4cd6f9[_0xf566('0x5d')]=[{'all':!![]}];}_0x4cd6f9=_[_0xf566('0x51')]({},_0x4cd6f9,_0x25a57b[_0xf566('0x55')]);return db[_0xf566('0x41')]['find'](_0x4cd6f9)[_0xf566('0x3a')](handleEntityNotFound(_0x285100,null))[_0xf566('0x3a')](respondWithResult(_0x285100,null))[_0xf566('0x2b')](handleError(_0x285100,null));};exports[_0xf566('0x5e')]=function(_0x1d029a,_0x21fafe){return db[_0xf566('0x41')][_0xf566('0x5e')](_0x1d029a[_0xf566('0x5f')],{})[_0xf566('0x3a')](function(_0x3432ea){var _0x147cdd=_0x1d029a['user'][_0xf566('0x60')]({'plain':!![]});if(!_0x147cdd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x147cdd[_0xf566('0x61')]===_0xf566('0x62')){var _0x3e7bd1=_0x3432ea['get']({'plain':!![]});var _0x3f140e=_0xf566('0x3b');return db[_0xf566('0x63')]['find']({'where':{'name':_0x3f140e,'userProfileId':_0x147cdd[_0xf566('0x64')]},'raw':!![]})['then'](function(_0x4b9a30){if(_0x4b9a30&&_0x4b9a30[_0xf566('0x65')]===0x0){return db[_0xf566('0x66')]['create']({'name':_0x3e7bd1['name'],'resourceId':_0x3e7bd1['id'],'type':_0x4b9a30[_0xf566('0x3d')],'sectionId':_0x4b9a30['id']},{})[_0xf566('0x3a')](function(){return _0x3432ea;});}else{return _0x3432ea;}})[_0xf566('0x2b')](function(_0xbe3f64){logger[_0xf566('0x28')](_0xf566('0x67'),_0xbe3f64);throw _0xbe3f64;});}return _0x3432ea;})[_0xf566('0x3a')](respondWithResult(_0x21fafe,0xc9))[_0xf566('0x2b')](handleError(_0x21fafe,null));};exports[_0xf566('0x38')]=function(_0x5b4722,_0x57ff7f){if(_0x5b4722[_0xf566('0x5f')]['id']){delete _0x5b4722[_0xf566('0x5f')]['id'];}return db[_0xf566('0x41')][_0xf566('0x68')]({'where':{'id':_0x5b4722['params']['id']},'include':[{'model':db['Pause'],'as':_0xf566('0x3f')}]})[_0xf566('0x3a')](handleEntityNotFound(_0x57ff7f,null))[_0xf566('0x3a')](saveUpdates(_0x5b4722[_0xf566('0x5f')],null))[_0xf566('0x3a')](respondWithResult(_0x57ff7f,null))['catch'](handleError(_0x57ff7f,null));};exports[_0xf566('0x39')]=function(_0x2870ad,_0x211c18){return db[_0xf566('0x41')][_0xf566('0x68')]({'where':{'id':_0x2870ad[_0xf566('0x5a')]['id']}})[_0xf566('0x3a')](handleEntityNotFound(_0x211c18,null))[_0xf566('0x3a')](removeEntity(_0x211c18,null))['catch'](handleError(_0x211c18,null));};exports[_0xf566('0x69')]=function(_0x1565a9,_0x453ca3){return db['FaxAccount'][_0xf566('0x69')]()[_0xf566('0x3a')](respondWithResult(_0x453ca3,null))[_0xf566('0x2b')](handleError(_0x453ca3,null));};exports[_0xf566('0x6a')]=function(_0x579d8a,_0x236cbb,_0x4df9e4){if(_0x579d8a[_0xf566('0x5f')]['id']){delete _0x579d8a[_0xf566('0x5f')]['id'];}return db[_0xf566('0x41')]['find']({'where':{'id':_0x579d8a[_0xf566('0x5a')]['id']}})['then'](handleEntityNotFound(_0x236cbb,null))[_0xf566('0x3a')](function(_0x2f9679){if(_0x2f9679){_0x579d8a['body'][_0xf566('0x6b')]=_0x2f9679['id'];return db[_0xf566('0x6c')][_0xf566('0x5e')](_0x579d8a[_0xf566('0x5f')]);}})[_0xf566('0x3a')](respondWithResult(_0x236cbb,null))[_0xf566('0x2b')](handleError(_0x236cbb,null));};exports[_0xf566('0x6d')]=function(_0x2e8fce,_0x310564,_0x52f746){var _0x5b9cf4={'raw':![],'where':{}};var _0x18a44a={};var _0x32ff1e={'count':0x0,'rows':[]};return db[_0xf566('0x41')]['findOne']({'where':{'id':_0x2e8fce[_0xf566('0x5a')]['id']}})[_0xf566('0x3a')](handleEntityNotFound(_0x310564,null))['then'](function(_0x487765){if(_0x487765){_0x18a44a[_0xf566('0x44')]=_[_0xf566('0x5c')](db[_0xf566('0x6c')][_0xf566('0x42')]);_0x18a44a['query']=_[_0xf566('0x5c')](_0x2e8fce[_0xf566('0x45')]);_0x18a44a[_0xf566('0x46')]=_[_0xf566('0x47')](_0x18a44a[_0xf566('0x44')],_0x18a44a[_0xf566('0x45')]);_0x5b9cf4[_0xf566('0x48')]=_[_0xf566('0x47')](_0x18a44a['model'],qs[_0xf566('0x49')](_0x2e8fce[_0xf566('0x45')]['fields']));_0x5b9cf4['attributes']=_0x5b9cf4['attributes'][_0xf566('0x4a')]?_0x5b9cf4[_0xf566('0x48')]:_0x18a44a['model'];if(!_0x2e8fce[_0xf566('0x45')]['hasOwnProperty'](_0xf566('0x4c'))){_0x5b9cf4[_0xf566('0x31')]=qs[_0xf566('0x31')](_0x2e8fce['query']['limit']);_0x5b9cf4[_0xf566('0x2f')]=qs[_0xf566('0x2f')](_0x2e8fce[_0xf566('0x45')]['offset']);}_0x5b9cf4['order']=qs[_0xf566('0x4e')](_0x2e8fce[_0xf566('0x45')][_0xf566('0x4e')]);_0x5b9cf4[_0xf566('0x4f')]=qs[_0xf566('0x46')](_[_0xf566('0x50')](_0x2e8fce['query'],_0x18a44a[_0xf566('0x46')]));_0x5b9cf4[_0xf566('0x4f')][_0xf566('0x6b')]=_0x487765['id'];if(_0x2e8fce[_0xf566('0x45')][_0xf566('0x54')]){_0x5b9cf4[_0xf566('0x4f')]=_[_0xf566('0x51')](_0x5b9cf4[_0xf566('0x4f')],{'$or':_[_0xf566('0x40')](_0x5b9cf4['attributes'],function(_0x2a9d56){var _0x30e75a={};_0x30e75a[_0x2a9d56]={'$like':'%'+_0x2e8fce[_0xf566('0x45')]['filter']+'%'};return _0x30e75a;})});}_0x5b9cf4=_[_0xf566('0x51')]({},_0x5b9cf4,_0x2e8fce[_0xf566('0x55')]);return db['Disposition'][_0xf566('0x32')]({'where':_0x5b9cf4['where']})['then'](function(_0x3cf6af){_0x32ff1e[_0xf566('0x32')]=_0x3cf6af;if(_0x2e8fce[_0xf566('0x45')][_0xf566('0x56')]){_0x5b9cf4['include']=[{'all':!![]}];}return db[_0xf566('0x6c')]['findAll'](_0x5b9cf4);})[_0xf566('0x3a')](function(_0x502231){_0x32ff1e[_0xf566('0x58')]=_0x502231;return _0x32ff1e;});}})[_0xf566('0x3a')](respondWithFilteredResult(_0x310564,_0x5b9cf4))['catch'](handleError(_0x310564,null));};exports[_0xf566('0x6e')]=function(_0x3268c4,_0x8456,_0x119e05){return db[_0xf566('0x41')][_0xf566('0x68')]({'where':{'id':_0x3268c4[_0xf566('0x5a')]['id']}})[_0xf566('0x3a')](handleEntityNotFound(_0x8456,null))[_0xf566('0x3a')](function(_0x3f14d7){if(_0x3f14d7){return _0x3f14d7['removeDispositions'](_0x3268c4[_0xf566('0x45')][_0xf566('0x6f')]);}})[_0xf566('0x3a')](respondWithStatusCode(_0x8456,null))['catch'](handleError(_0x8456,null));};exports['addAnswer']=function(_0x192ea2,_0x11d107,_0x54d65e){if(_0x192ea2[_0xf566('0x5f')]['id']){delete _0x192ea2['body']['id'];}return db[_0xf566('0x41')][_0xf566('0x68')]({'where':{'id':_0x192ea2[_0xf566('0x5a')]['id']}})[_0xf566('0x3a')](handleEntityNotFound(_0x11d107,null))['then'](function(_0x2dcba8){if(_0x2dcba8){_0x192ea2['body'][_0xf566('0x6b')]=_0x2dcba8['id'];return db['CannedAnswer'][_0xf566('0x5e')](_0x192ea2['body']);}})['then'](respondWithResult(_0x11d107,null))[_0xf566('0x2b')](handleError(_0x11d107,null));};exports[_0xf566('0x70')]=function(_0x32d34d,_0x4767d8,_0x4539b9){var _0x80138b={'raw':![],'where':{}};var _0x14087f={};var _0x5100c0={'count':0x0,'rows':[]};return db[_0xf566('0x41')]['findOne']({'where':{'id':_0x32d34d[_0xf566('0x5a')]['id']}})[_0xf566('0x3a')](handleEntityNotFound(_0x4767d8,null))[_0xf566('0x3a')](function(_0x4cf000){if(_0x4cf000){_0x14087f[_0xf566('0x44')]=_[_0xf566('0x5c')](db[_0xf566('0x71')][_0xf566('0x42')]);_0x14087f[_0xf566('0x45')]=_[_0xf566('0x5c')](_0x32d34d[_0xf566('0x45')]);_0x14087f[_0xf566('0x46')]=_['intersection'](_0x14087f[_0xf566('0x44')],_0x14087f[_0xf566('0x45')]);_0x80138b[_0xf566('0x48')]=_[_0xf566('0x47')](_0x14087f['model'],qs[_0xf566('0x49')](_0x32d34d[_0xf566('0x45')]['fields']));_0x80138b['attributes']=_0x80138b[_0xf566('0x48')][_0xf566('0x4a')]?_0x80138b[_0xf566('0x48')]:_0x14087f[_0xf566('0x44')];if(!_0x32d34d[_0xf566('0x45')][_0xf566('0x4b')](_0xf566('0x4c'))){_0x80138b[_0xf566('0x31')]=qs[_0xf566('0x31')](_0x32d34d['query'][_0xf566('0x31')]);_0x80138b[_0xf566('0x2f')]=qs['offset'](_0x32d34d['query']['offset']);}_0x80138b[_0xf566('0x4d')]=qs[_0xf566('0x4e')](_0x32d34d['query'][_0xf566('0x4e')]);_0x80138b[_0xf566('0x4f')]=qs[_0xf566('0x46')](_[_0xf566('0x50')](_0x32d34d[_0xf566('0x45')],_0x14087f[_0xf566('0x46')]));_0x80138b[_0xf566('0x4f')][_0xf566('0x6b')]=_0x4cf000['id'];if(_0x32d34d[_0xf566('0x45')][_0xf566('0x54')]){_0x80138b[_0xf566('0x4f')]=_['merge'](_0x80138b[_0xf566('0x4f')],{'$or':_[_0xf566('0x40')](_0x80138b[_0xf566('0x48')],function(_0x294c15){var _0x41a6c7={};_0x41a6c7[_0x294c15]={'$like':'%'+_0x32d34d[_0xf566('0x45')][_0xf566('0x54')]+'%'};return _0x41a6c7;})});}_0x80138b=_[_0xf566('0x51')]({},_0x80138b,_0x32d34d[_0xf566('0x55')]);return db['CannedAnswer'][_0xf566('0x32')]({'where':_0x80138b[_0xf566('0x4f')]})[_0xf566('0x3a')](function(_0x160c6f){_0x5100c0[_0xf566('0x32')]=_0x160c6f;if(_0x32d34d[_0xf566('0x45')]['includeAll']){_0x80138b['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xf566('0x57')](_0x80138b);})[_0xf566('0x3a')](function(_0x5cb5ad){_0x5100c0[_0xf566('0x58')]=_0x5cb5ad;return _0x5100c0;});}})[_0xf566('0x3a')](respondWithFilteredResult(_0x4767d8,_0x80138b))['catch'](handleError(_0x4767d8,null));};exports['removeAnswers']=function(_0x5950b3,_0x518db9,_0x4da7f8){return db[_0xf566('0x41')]['find']({'where':{'id':_0x5950b3[_0xf566('0x5a')]['id']}})[_0xf566('0x3a')](handleEntityNotFound(_0x518db9,null))['then'](function(_0x20459b){if(_0x20459b){return _0x20459b[_0xf566('0x72')](_0x5950b3['query'][_0xf566('0x6f')]);}})[_0xf566('0x3a')](respondWithStatusCode(_0x518db9,null))[_0xf566('0x2b')](handleError(_0x518db9,null));};exports[_0xf566('0x73')]=function(_0x2dffd8,_0x2ffabd,_0x2e2d91){return db['FaxInteraction'][_0xf566('0x68')]({'where':{'id':_0x2dffd8[_0xf566('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2ffabd,null))[_0xf566('0x3a')](function(_0x1bae35){if(_0x1bae35){return _0x1bae35[_0xf566('0x73')](_0x2dffd8['body'][_0xf566('0x6f')],_[_0xf566('0x74')](_0x2dffd8[_0xf566('0x5f')],[_0xf566('0x6f'),'id'])||{});}})[_0xf566('0x3a')](respondWithResult(_0x2ffabd,null))[_0xf566('0x2b')](handleError(_0x2ffabd,null));};exports[_0xf566('0x75')]=function(_0x583630,_0x181266,_0x320a11){var _0x23be92={'raw':![],'where':{}};var _0x3a7aa0={};var _0x4ba313={'count':0x0,'rows':[]};return db['FaxAccount'][_0xf566('0x76')]({'where':{'id':_0x583630[_0xf566('0x5a')]['id']}})[_0xf566('0x3a')](handleEntityNotFound(_0x181266,null))[_0xf566('0x3a')](function(_0x2b3457){if(_0x2b3457){_0x3a7aa0[_0xf566('0x44')]=_['keys'](db[_0xf566('0x77')]['rawAttributes']);_0x3a7aa0[_0xf566('0x45')]=_['keys'](_0x583630[_0xf566('0x45')]);_0x3a7aa0[_0xf566('0x46')]=_[_0xf566('0x47')](_0x3a7aa0[_0xf566('0x44')],_0x3a7aa0['query']);_0x23be92[_0xf566('0x48')]=_['intersection'](_0x3a7aa0[_0xf566('0x44')],qs['fields'](_0x583630[_0xf566('0x45')][_0xf566('0x49')]));_0x23be92[_0xf566('0x48')]=_0x23be92['attributes']['length']?_0x23be92[_0xf566('0x48')]:_0x3a7aa0[_0xf566('0x44')];if(!_0x583630['query'][_0xf566('0x4b')](_0xf566('0x4c'))){_0x23be92[_0xf566('0x31')]=qs[_0xf566('0x31')](_0x583630[_0xf566('0x45')][_0xf566('0x31')]);_0x23be92[_0xf566('0x2f')]=qs['offset'](_0x583630['query'][_0xf566('0x2f')]);}_0x23be92[_0xf566('0x4d')]=qs[_0xf566('0x4e')](_0x583630[_0xf566('0x45')][_0xf566('0x4e')]);_0x23be92[_0xf566('0x4f')]=qs[_0xf566('0x46')](_['pick'](_0x583630['query'],_0x3a7aa0[_0xf566('0x46')]));_0x23be92[_0xf566('0x4f')][_0xf566('0x6b')]=_0x2b3457['id'];if(_0x583630['query'][_0xf566('0x54')]){_0x23be92['where']=_[_0xf566('0x51')](_0x23be92['where'],{'$or':_[_0xf566('0x40')](_0x23be92[_0xf566('0x48')],function(_0x56b615){var _0x43654b={};_0x43654b[_0x56b615]={'$like':'%'+_0x583630['query'][_0xf566('0x54')]+'%'};return _0x43654b;})});}_0x23be92=_[_0xf566('0x51')]({},_0x23be92,_0x583630[_0xf566('0x55')]);return db[_0xf566('0x77')][_0xf566('0x32')]({'where':_0x23be92[_0xf566('0x4f')]})[_0xf566('0x3a')](function(_0x4b2983){_0x4ba313[_0xf566('0x32')]=_0x4b2983;if(_0x583630[_0xf566('0x45')][_0xf566('0x56')]){_0x23be92[_0xf566('0x5d')]=[{'model':db[_0xf566('0x78')],'as':_0xf566('0x79'),'required':![]},{'model':db[_0xf566('0x7a')],'as':_0xf566('0x7b'),'attributes':[_0xf566('0x3d'),_0xf566('0x7c'),'internal'],'required':![]},{'model':db[_0xf566('0x7d')],'as':_0xf566('0x7e'),'attributes':['id',_0xf566('0x3d'),_0xf566('0x7f')],'where':_0x583630[_0xf566('0x45')][_0xf566('0x80')]?{'id':_0x583630['query'][_0xf566('0x80')]}:undefined,'required':_0x583630[_0xf566('0x45')][_0xf566('0x80')]?!![]:![]}];}return db['FaxInteraction'][_0xf566('0x57')](_0x23be92);})[_0xf566('0x3a')](function(_0x47bb8d){_0x4ba313[_0xf566('0x58')]=_0x47bb8d;return _0x4ba313;});}})[_0xf566('0x3a')](respondWithFilteredResult(_0x181266,_0x23be92))[_0xf566('0x2b')](handleError(_0x181266,null));};exports[_0xf566('0x81')]=function(_0x455ad1,_0x3e2a10){var _0x5c6b9a=_0x455ad1[_0xf566('0x5a')]['id'];var _0x10140a=_0x455ad1[_0xf566('0x5f')];var _0x16bf65=0xc8;var _0x39f40b=null;return db[_0xf566('0x82')][_0xf566('0x83')]({'isolationLevel':db[_0xf566('0x82')][_0xf566('0x84')][_0xf566('0x85')][_0xf566('0x86')]},function(_0x1db678){return db[_0xf566('0x41')][_0xf566('0x76')]({'where':{'id':_0x5c6b9a},'transaction':_0x1db678})[_0xf566('0x3a')](function(_0x1a6518){if(_0x1a6518){return db[_0xf566('0x87')][_0xf566('0x39')]({'where':{'FaxAccountId':_0x5c6b9a},'transaction':_0x1db678})[_0xf566('0x3a')](function(){var _0x215993=_['map'](_0x10140a,function(_0x2095d6){_0x2095d6[_0xf566('0x6b')]=_0x5c6b9a;return _0x2095d6;});return db['FaxApplication'][_0xf566('0x88')](_0x215993,{'transaction':_0x1db678});});}else{_0x16bf65=0x194;_0x39f40b=[];}});})[_0xf566('0x3a')](function(){if(_0x16bf65!==0x194){return db['FaxApplication'][_0xf566('0x89')]({'where':{'FaxAccountId':_0x5c6b9a},'order':_0xf566('0x8a')})[_0xf566('0x3a')](function(_0x298cdc){_0x39f40b=_0x298cdc;});}})[_0xf566('0x2b')](function(_0x3cd371){_0x16bf65=0x1f4;logger[_0xf566('0x28')](_0x3cd371[_0xf566('0x3c')]);if(_0x3cd371['name']){delete _0x3cd371[_0xf566('0x3d')];}_0x39f40b=_0x3cd371;})[_0xf566('0x8b')](function(){if(_0x39f40b===null){_0x3e2a10[_0xf566('0x2c')](_0x16bf65);}else{if(_0x16bf65===0x1f4){_0x3e2a10[_0xf566('0x2d')](_0x16bf65)[_0xf566('0x8c')](_0x39f40b);}else{_0x3e2a10[_0xf566('0x2d')](_0x16bf65)[_0xf566('0x35')](_0x39f40b);}}});};exports['getApplications']=function(_0x47bf29,_0x59b786,_0x3a1952){var _0x1564e7={};var _0x45871a={};var _0x4792d0;var _0x294f9b;return db[_0xf566('0x41')][_0xf566('0x76')]({'where':{'id':_0x47bf29[_0xf566('0x5a')]['id']}})[_0xf566('0x3a')](handleEntityNotFound(_0x59b786,null))['then'](function(_0x398c4b){if(_0x398c4b){_0x4792d0=_0x398c4b;_0x45871a[_0xf566('0x44')]=_[_0xf566('0x5c')](db['FaxApplication'][_0xf566('0x42')]);_0x45871a[_0xf566('0x45')]=_[_0xf566('0x5c')](_0x47bf29[_0xf566('0x45')]);_0x45871a[_0xf566('0x46')]=_['intersection'](_0x45871a[_0xf566('0x44')],_0x45871a[_0xf566('0x45')]);_0x1564e7[_0xf566('0x48')]=_['intersection'](_0x45871a[_0xf566('0x44')],qs[_0xf566('0x49')](_0x47bf29['query'][_0xf566('0x49')]));_0x1564e7['attributes']=_0x1564e7['attributes']['length']?_0x1564e7['attributes']:_0x45871a[_0xf566('0x44')];_0x1564e7[_0xf566('0x4d')]=qs['sort'](_0x47bf29['query'][_0xf566('0x4e')]);_0x1564e7[_0xf566('0x4f')]=qs[_0xf566('0x46')](_['pick'](_0x47bf29[_0xf566('0x45')],_0x45871a[_0xf566('0x46')]));if(_0x47bf29['query'][_0xf566('0x54')]){_0x1564e7[_0xf566('0x4f')]=_[_0xf566('0x51')](_0x1564e7[_0xf566('0x4f')],{'$or':_[_0xf566('0x40')](_0x1564e7[_0xf566('0x48')],function(_0x576d23){var _0x34ab88={};_0x34ab88[_0x576d23]={'$like':'%'+_0x47bf29[_0xf566('0x45')][_0xf566('0x54')]+'%'};return _0x34ab88;})});}_0x1564e7=_[_0xf566('0x51')]({},_0x1564e7,_0x47bf29[_0xf566('0x55')]);return _0x4792d0[_0xf566('0x8d')](_0x1564e7);}})[_0xf566('0x3a')](function(_0x1bf184){if(_0x1bf184){_0x294f9b=_0x1bf184['length'];if(!_0x47bf29[_0xf566('0x45')][_0xf566('0x4b')](_0xf566('0x4c'))){_0x1564e7['limit']=qs[_0xf566('0x31')](_0x47bf29[_0xf566('0x45')][_0xf566('0x31')]);_0x1564e7[_0xf566('0x2f')]=qs[_0xf566('0x2f')](_0x47bf29[_0xf566('0x45')]['offset']);}return _0x4792d0[_0xf566('0x8d')](_0x1564e7);}})['then'](function(_0x269efe){if(_0x269efe){return _0x269efe?{'count':_0x294f9b,'rows':_0x269efe}:null;}})[_0xf566('0x3a')](respondWithResult(_0x59b786,null))[_0xf566('0x2b')](handleError(_0x59b786,null));};function Extension(_0x3a5479,_0x2116ea,_0xcb3a45,_0x48bf35){this[_0xf566('0x8e')]=_0xf566('0x8f');this[_0xf566('0x90')]=_0x3a5479[_0xf566('0x91')];this[_0xf566('0x92')]=_0x48bf35;this[_0xf566('0x52')]=_0xf566('0x93');this['description']=_0xf566('0x94');this['FaxAccountId']=_0x3a5479['id'];this[_0xf566('0x8a')]=_0x2116ea;this['appdata']=_0xcb3a45;}function createExtensionsReciveFax(_0x50b99a){var _0x27822a=0x1;var _0x1a01c1=[];_0x1a01c1['push'](new Extension(_0x50b99a,_0x27822a,'','Answer'));_0x27822a+=0x1;_0x1a01c1[_0xf566('0x95')](new Extension(_0x50b99a,_0x27822a,_0xf566('0x96'),_0xf566('0x97')));_0x27822a+=0x1;for(var _0x4f8c07 in _0x50b99a){if(_0x50b99a[_0xf566('0x4b')](_0x4f8c07)&&(_0x4f8c07===_0xf566('0x98')||_0x4f8c07===_0xf566('0x91')||_0x4f8c07===_0xf566('0x99')||_0x4f8c07===_0xf566('0x9a')||_0x4f8c07===_0xf566('0x9b')||_0x4f8c07===_0xf566('0x9c')||_0x4f8c07===_0xf566('0x9d')||_0x4f8c07==='modem'||_0x4f8c07===_0xf566('0x9e'))){_0x1a01c1[_0xf566('0x95')](new Extension(_0x50b99a,_0x27822a,_0xf566('0x9f')+_0x4f8c07+')='+_0x50b99a[_0x4f8c07],_0xf566('0x97')));_0x27822a+=0x1;}}_0x1a01c1[_0xf566('0x95')](new Extension(_0x50b99a,_0x27822a,'6',_0xf566('0xa0')));_0x27822a+=0x1;_0x1a01c1['push'](new Extension(_0x50b99a,_0x27822a,_0xf566('0xa1'),'ReceiveFax'));_0x27822a=0x0;return _0x1a01c1;}exports[_0xf566('0xa2')]=function(_0xbf7fc8,_0x28bd66,_0x3193c9){var _0x50994a;return db['sequelize'][_0xf566('0x83')](function(_0x5644f9){return db[_0xf566('0x41')][_0xf566('0x5e')](_0xbf7fc8[_0xf566('0x5f')],{'transaction':_0x5644f9})['then'](function(_0x16747d){_0x50994a=_0x16747d[_0xf566('0x60')]({'plain':!![]});return db['VoiceExtension'][_0xf566('0x88')](createExtensionsReciveFax(_0x50994a),{'transaction':_0x5644f9});});})[_0xf566('0x3a')](function(){return _0x50994a;})[_0xf566('0x3a')](respondWithResult(_0x28bd66,null))['catch'](handleError(_0x28bd66,null));};exports[_0xf566('0xa3')]=function(_0x4922ee,_0x49c8b1,_0x3c01c8){var _0x5058a7;return db[_0xf566('0x82')]['transaction'](function(_0x200581){return db[_0xf566('0x41')]['update'](_0x4922ee[_0xf566('0x5f')],{'where':{'id':_0x4922ee[_0xf566('0x5f')]['id']},'transaction':_0x200581})[_0xf566('0x3a')](function(_0x371606){return db['VoiceExtension'][_0xf566('0x39')]({'where':{'FaxAccountId':_0x4922ee['body']['id']},'transaction':_0x200581})['then'](function(_0x43b3c9){return db[_0xf566('0xa4')][_0xf566('0x88')](createExtensionsReciveFax(_[_0xf566('0x74')](_0x4922ee[_0xf566('0x5f')],[_0xf566('0xa5'),_0xf566('0x43'),_0xf566('0xa6'),'updatedAt','TrunkId',_0xf566('0xa7')])),{'transaction':_0x200581});});});})[_0xf566('0x3a')](function(){return db['FaxAccount'][_0xf566('0xa8')](_0x4922ee[_0xf566('0x5f')]['id']);})['then'](respondWithResult(_0x49c8b1,null))[_0xf566('0x2b')](handleError(_0x49c8b1,null));};exports[_0xf566('0xa9')]=function(_0x4d6c5e,_0x26b5f6,_0x13f790){var _0x1ab9b2={'raw':!![],'where':{}};var _0x59df35={};var _0xfab32={'count':0x0,'rows':[]};return db[_0xf566('0x41')][_0xf566('0x76')]({'where':{'id':_0x4d6c5e[_0xf566('0x5a')]['id']}})[_0xf566('0x3a')](handleEntityNotFound(_0x26b5f6,null))[_0xf566('0x3a')](function(_0xcfdd9a){if(_0xcfdd9a){_0x59df35[_0xf566('0x44')]=_[_0xf566('0x5c')](db[_0xf566('0xaa')][_0xf566('0x42')]);_0x59df35[_0xf566('0x45')]=_['keys'](_0x4d6c5e[_0xf566('0x45')]);_0x59df35[_0xf566('0x46')]=_[_0xf566('0x47')](_0x59df35['model'],_0x59df35[_0xf566('0x45')]);_0x1ab9b2[_0xf566('0x48')]=_['intersection'](_0x59df35[_0xf566('0x44')],qs[_0xf566('0x49')](_0x4d6c5e[_0xf566('0x45')]['fields']));_0x1ab9b2['attributes']=_0x1ab9b2[_0xf566('0x48')][_0xf566('0x4a')]?_0x1ab9b2[_0xf566('0x48')]:_0x59df35[_0xf566('0x44')];if(!_0x4d6c5e[_0xf566('0x45')]['hasOwnProperty'](_0xf566('0x4c'))){_0x1ab9b2[_0xf566('0x31')]=qs['limit'](_0x4d6c5e[_0xf566('0x45')][_0xf566('0x31')]);_0x1ab9b2[_0xf566('0x2f')]=qs['offset'](_0x4d6c5e[_0xf566('0x45')][_0xf566('0x2f')]);}_0x1ab9b2[_0xf566('0x4d')]=qs[_0xf566('0x4e')](_0x4d6c5e[_0xf566('0x45')][_0xf566('0x4e')]);_0x1ab9b2['where']=qs[_0xf566('0x46')](_['pick'](_0x4d6c5e['query'],_0x59df35['filters']));_0x1ab9b2[_0xf566('0x4f')][_0xf566('0x6b')]=_0xcfdd9a['id'];if(_0x4d6c5e[_0xf566('0x45')][_0xf566('0x54')]){_0x1ab9b2[_0xf566('0x4f')]=_[_0xf566('0x51')](_0x1ab9b2[_0xf566('0x4f')],{'$or':_[_0xf566('0x40')](_0x1ab9b2[_0xf566('0x48')],function(_0x5b54fc){var _0x1523da={};_0x1523da[_0x5b54fc]={'$like':'%'+_0x4d6c5e['query'][_0xf566('0x54')]+'%'};return _0x1523da;})});}if(_0x4d6c5e[_0xf566('0x45')][_0xf566('0xab')]){var _0x2f7b22=_0x4d6c5e[_0xf566('0x45')][_0xf566('0xab')][_0xf566('0xac')](',');var _0x5db228={};_0x5db228[_0x2f7b22[0x0]]={'$gte':moment(_0x2f7b22[0x1])[_0xf566('0xad')](_0xf566('0xae'))};_0x1ab9b2['where']=_['merge'](_0x1ab9b2[_0xf566('0x4f')],_0x5db228);}_0x1ab9b2=_[_0xf566('0x51')]({},_0x1ab9b2,_0x4d6c5e[_0xf566('0x55')]);return db[_0xf566('0xaa')][_0xf566('0x32')]({'where':_0x1ab9b2['where']})['then'](function(_0x4f21cc){_0xfab32[_0xf566('0x32')]=_0x4f21cc;if(_0x4d6c5e['query']['includeAll']){_0x1ab9b2[_0xf566('0x5d')]=[{'all':!![]}];}return db['FaxMessage'][_0xf566('0x57')](_0x1ab9b2);})['then'](function(_0x43caf7){_0xfab32['rows']=_0x43caf7;return _0xfab32;});}})[_0xf566('0x3a')](respondWithFilteredResult(_0x26b5f6,_0x1ab9b2))[_0xf566('0x2b')](handleError(_0x26b5f6,null));};exports[_0xf566('0x8c')]=function(_0x5ef648,_0xbd3e67,_0x20b434){var _0x449bd3,_0x3e171d={},_0x256b1e;if(_0x5ef648[_0xf566('0x5f')]['to']){_0x256b1e=_0x5ef648[_0xf566('0x5f')]['to'][0x0];}return db[_0xf566('0x41')]['find']({'where':{'id':_0x5ef648['params']['id']},'include':[{'model':db['CmList'],'as':_0xf566('0xaf'),'include':[{'model':db['CmContact'],'as':_0xf566('0xb0'),'where':{'fax':_0x256b1e},'limit':0x1,'order':[[_0xf566('0xb1'),_0xf566('0xb2')]]}]}]})['then'](handleEntityNotFound(_0xbd3e67,null))[_0xf566('0x3a')](function(_0x529079){_0x449bd3=_0x529079;if(_0x5ef648[_0xf566('0x5f')][_0xf566('0xb3')]&&_0x5ef648[_0xf566('0x5f')]['attachments'][_0xf566('0x4a')]){for(var _0x5c4d94=0x0;_0x5c4d94<_0x5ef648[_0xf566('0x5f')][_0xf566('0xb3')][_0xf566('0x4a')];_0x5c4d94+=0x1){_0x5ef648[_0xf566('0x5f')][_0xf566('0xb3')][_0x5c4d94]={'filename':_0x5ef648['body']['attachments'][_0x5c4d94][_0xf566('0x3d')],'id':_0x5ef648[_0xf566('0x5f')][_0xf566('0xb3')][_0x5c4d94]['id'],'path':path[_0xf566('0xb4')](config[_0xf566('0xb5')],_0xf566('0xb6'),_0x5ef648[_0xf566('0x5f')][_0xf566('0xb3')][_0x5c4d94][_0xf566('0xb7')])};}}return respondWithRpcPromise('CheckAfterSend',_0xf566('0xb8'),{'FaxAccountId':_[_0xf566('0xb9')](_0x5ef648[_0xf566('0x5a')]['id'])?undefined:_0x5ef648[_0xf566('0x5a')]['id'],'path':_['isNil'](_0x5ef648[_0xf566('0x5f')]['attachments'][0x0][_0xf566('0x7')])?undefined:_0x5ef648[_0xf566('0x5f')][_0xf566('0xb3')][0x0][_0xf566('0x7')],'fax':_['isNil'](_0x5ef648[_0xf566('0x5f')]['to'][0x0])?undefined:_0x5ef648[_0xf566('0x5f')]['to'][0x0]},client9002);})[_0xf566('0x3a')](function(){if(_0x449bd3){if(_[_0xf566('0xb9')](_0x5ef648['body']['from'])){_0x5ef648['body']['from']=util[_0xf566('0xad')](_0xf566('0xba'),_0x449bd3['name'],_0x449bd3[_0xf566('0xbb')]);}if(_0x449bd3['List']){if(_0x449bd3[_0xf566('0xaf')][_0xf566('0xb0')]['length']){return _0x449bd3[_0xf566('0xaf')][_0xf566('0xb0')][0x0];}else{return db['CmContact'][_0xf566('0x5e')](_['defaults'](_0x5ef648[_0xf566('0x5f')],{'firstName':_0x5ef648[_0xf566('0x5f')]['to'][0x0],'phone':_0x5ef648[_0xf566('0x5f')]['to'][0x0],'fax':_0x5ef648['body']['to'][0x0],'ListId':_0x449bd3[_0xf566('0xa7')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xf566('0xbc'));}})['then'](function(_0x9215ef){if(_0x9215ef){return db[_0xf566('0x77')][_0xf566('0x68')]({'where':{'ContactId':_0x9215ef['id'],'closed':![],'FaxAccountId':_0x449bd3['id']}})[_0xf566('0x3a')](function(_0x181b5d){if(_0x181b5d){return[_0x181b5d,![]];}return db[_0xf566('0x77')][_0xf566('0x5e')]({'UserId':_0x5ef648['user']['id'],'ContactId':_0x9215ef['id'],'FaxAccountId':_0x449bd3['id'],'fax':_0x5ef648[_0xf566('0x5f')]['to'][0x0],'firstMsgDirection':_0xf566('0xbd'),'Messages':[_['merge'](_0x5ef648[_0xf566('0x5f')],{'read':![],'body':_0x5ef648[_0xf566('0x5f')]['attachments'][0x0][_0xf566('0xbe')],'FaxAccountId':_0x449bd3['id'],'UserId':_0x5ef648[_0xf566('0x62')]['id'],'ContactId':_0x9215ef['id'],'AttachmentId':_0x5ef648[_0xf566('0x5f')][_0xf566('0xb3')][0x0]['id']})]},{'include':[{'model':db[_0xf566('0xaa')],'as':_0xf566('0xbf')}]})['then'](function(_0x4853fc){return[_0x4853fc,!![]];});});}else{throw new Error(_0xf566('0xc0'));}})[_0xf566('0xc1')](function(_0x136523,_0x33cf71){if(_0x33cf71){return _0x136523;}return db[_0xf566('0xaa')][_0xf566('0x5e')]({'direction':_0xf566('0xbd'),'read':![],'body':_0x5ef648['body']['attachments'][0x0][_0xf566('0xbe')],'FaxAccountId':_0x449bd3['id'],'FaxInteractionId':_0x136523['id'],'UserId':_0x5ef648[_0xf566('0x62')]['id'],'ContactId':_0x136523[_0xf566('0xc2')],'AttachmentId':_0x5ef648[_0xf566('0x5f')][_0xf566('0xb3')][0x0]['id']})[_0xf566('0x3a')](function(_0x3ec78b){_0x136523['dataValues'][_0xf566('0xbf')]=[];_0x136523['dataValues'][_0xf566('0xbf')]['push'](_0x3ec78b[_0xf566('0xc3')]);return _0x136523;});})[_0xf566('0x3a')](function(_0x366f09){respondWithRpcPromise(_0xf566('0xc4'),_0xf566('0xc4'),{'FaxAccountId':_[_0xf566('0xb9')](_0x5ef648[_0xf566('0x5a')]['id'])?undefined:_0x5ef648['params']['id'],'path':_['isNil'](_0x5ef648[_0xf566('0x5f')][_0xf566('0xb3')][0x0]['path'])?undefined:_0x5ef648[_0xf566('0x5f')]['attachments'][0x0][_0xf566('0x7')],'fax':_['isNil'](_0x5ef648[_0xf566('0x5f')]['to'][0x0])?undefined:_0x5ef648['body']['to'][0x0],'AttachmentId':_0x5ef648[_0xf566('0x5f')][_0xf566('0xb3')][0x0]['id']},client9002)['then'](function(_0x525ee1){logger[_0xf566('0x22')]('SendFaxRpc,\x20%s',_0x525ee1);})[_0xf566('0x2b')](function(_0x3ffe1b){logger['info'](_0xf566('0xc5'),_0x3ffe1b);});return _0x366f09;})[_0xf566('0x3a')](respondWithResult(_0xbd3e67,null))[_0xf566('0x2b')](handleError(_0xbd3e67,null));};exports[_0xf566('0xc6')]=function(_0x44fb78,_0x8d109d,_0x192323){return db[_0xf566('0x41')][_0xf566('0x68')]({'where':{'id':_0x44fb78[_0xf566('0x5a')]['id']}})[_0xf566('0x3a')](handleEntityNotFound(_0x8d109d,null))[_0xf566('0x3a')](function(_0x2eb935){if(_0x2eb935){return _0x2eb935[_0xf566('0xc6')](_0x44fb78[_0xf566('0x5f')][_0xf566('0x6f')],_[_0xf566('0x74')](_0x44fb78[_0xf566('0x5f')],[_0xf566('0x6f'),'id'])||{})[_0xf566('0xc1')](function(_0x2b5d34){for(var _0x47974a=0x0;_0x47974a<_0x44fb78[_0xf566('0x5f')]['ids'][_0xf566('0x4a')];_0x47974a+=0x1){socket[_0xf566('0xc7')](_0xf566('0xc8'),{'UserId':Number(_0x44fb78[_0xf566('0x5f')][_0xf566('0x6f')][_0x47974a]),'FaxAccountId':Number(_0x44fb78[_0xf566('0x5a')]['id'])});}return _0x2b5d34;});}})['then'](respondWithResult(_0x8d109d,null))['catch'](handleError(_0x8d109d,null));};exports[_0xf566('0xc9')]=function(_0x3fcda1,_0xc0393d,_0x5d984a){return db['FaxAccount'][_0xf566('0x68')]({'where':{'id':_0x3fcda1[_0xf566('0x5a')]['id']}})[_0xf566('0x3a')](handleEntityNotFound(_0xc0393d,null))[_0xf566('0x3a')](function(_0x265d0f){if(_0x265d0f){return _0x265d0f['removeAgents'](_0x3fcda1['query'][_0xf566('0x6f')])[_0xf566('0x3a')](function(){if(_[_0xf566('0xca')](_0x3fcda1[_0xf566('0x45')][_0xf566('0x6f')])){for(var _0x3f36f9=0x0;_0x3f36f9<_0x3fcda1['query'][_0xf566('0x6f')][_0xf566('0x4a')];_0x3f36f9+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x3fcda1[_0xf566('0x45')][_0xf566('0x6f')][_0x3f36f9]),'FaxAccountId':Number(_0x3fcda1[_0xf566('0x5a')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x3fcda1[_0xf566('0x45')][_0xf566('0x6f')]),'FaxAccountId':Number(_0x3fcda1[_0xf566('0x5a')]['id'])});}});}})[_0xf566('0x3a')](respondWithStatusCode(_0xc0393d,null))[_0xf566('0x2b')](handleError(_0xc0393d,null));};exports[_0xf566('0xcb')]=function(_0x3364db,_0x2491fe,_0x281aba){var _0x291110={};var _0xbb149c={};var _0x513404;var _0x575329;return db[_0xf566('0x41')][_0xf566('0x76')]({'where':{'id':_0x3364db['params']['id']}})[_0xf566('0x3a')](handleEntityNotFound(_0x2491fe,null))[_0xf566('0x3a')](function(_0x3427a1){if(_0x3427a1){_0x513404=_0x3427a1;_0xbb149c[_0xf566('0x44')]=_[_0xf566('0x5c')](db[_0xf566('0x7a')][_0xf566('0x42')]);_0xbb149c['query']=_[_0xf566('0x5c')](_0x3364db[_0xf566('0x45')]);_0xbb149c['filters']=_[_0xf566('0x47')](_0xbb149c[_0xf566('0x44')],_0xbb149c[_0xf566('0x45')]);_0x291110[_0xf566('0x48')]=_[_0xf566('0x47')](_0xbb149c[_0xf566('0x44')],qs[_0xf566('0x49')](_0x3364db[_0xf566('0x45')]['fields']));_0x291110[_0xf566('0x48')]=_0x291110[_0xf566('0x48')][_0xf566('0x4a')]?_0x291110[_0xf566('0x48')]:_0xbb149c[_0xf566('0x44')];_0x291110[_0xf566('0x4d')]=qs[_0xf566('0x4e')](_0x3364db['query'][_0xf566('0x4e')]);_0x291110[_0xf566('0x4f')]=qs[_0xf566('0x46')](_[_0xf566('0x50')](_0x3364db['query'],_0xbb149c[_0xf566('0x46')]));if(_0x3364db[_0xf566('0x45')][_0xf566('0x54')]){_0x291110[_0xf566('0x4f')]=_[_0xf566('0x51')](_0x291110['where'],{'$or':_['map'](_0x291110[_0xf566('0x48')],function(_0x1dd92c){var _0x57cc14={};_0x57cc14[_0x1dd92c]={'$like':'%'+_0x3364db[_0xf566('0x45')][_0xf566('0x54')]+'%'};return _0x57cc14;})});}_0x291110=_[_0xf566('0x51')]({},_0x291110,_0x3364db['options']);return _0x513404['getAgents'](_0x291110);}})[_0xf566('0x3a')](function(_0x9be247){if(_0x9be247){_0x575329=_0x9be247[_0xf566('0x4a')];if(!_0x3364db['query'][_0xf566('0x4b')](_0xf566('0x4c'))){_0x291110[_0xf566('0x31')]=qs[_0xf566('0x31')](_0x3364db[_0xf566('0x45')][_0xf566('0x31')]);_0x291110['offset']=qs[_0xf566('0x2f')](_0x3364db[_0xf566('0x45')]['offset']);}return _0x513404[_0xf566('0xcb')](_0x291110);}})[_0xf566('0x3a')](function(_0x116c54){if(_0x116c54){return _0x116c54?{'count':_0x575329,'rows':_0x116c54}:null;}})[_0xf566('0x3a')](respondWithResult(_0x2491fe,null))[_0xf566('0x2b')](handleError(_0x2491fe,null));}; \ No newline at end of file +var _0x25f9=['modem','push','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','VoiceExtension','updateAccountApplications','transaction','omit','tech','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','CmList','Contacts','updatedAt','DESC','attachments','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','Send\x20Fax\x20failed','Messages','Contact\x20not\x20found','spread','out','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./faxAccount.socket','register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','get','FaxAccounts','destroy','sendStatus','name','index','Pause','FaxAccount','rawAttributes','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','merge','map','type','VIRTUAL','options','includeAll','rows','show','params','mandatoryDispositionPause','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','filter','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','FaxInteraction','addInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','stack','finally','send','getApplications','context','exten','app','system','description','priority','Answer','CDR(type)=inbound-fax','Set','localstationid','faxdetect','headerinfo'];(function(_0x518b72,_0xbef3a2){var _0x43c7ba=function(_0x78fba2){while(--_0x78fba2){_0x518b72['push'](_0x518b72['shift']());}};_0x43c7ba(++_0xbef3a2);}(_0x25f9,0xfb));var _0x925f=function(_0x492e1e,_0x263285){_0x492e1e=_0x492e1e-0x0;var _0x3644ff=_0x25f9[_0x492e1e];return _0x3644ff;};'use strict';var emlformat=require(_0x925f('0x0'));var rimraf=require(_0x925f('0x1'));var zipdir=require(_0x925f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x925f('0x3'));var moment=require(_0x925f('0x4'));var BPromise=require(_0x925f('0x5'));var Mustache=require('mustache');var util=require(_0x925f('0x6'));var path=require(_0x925f('0x7'));var sox=require('sox');var csv=require(_0x925f('0x8'));var ejs=require(_0x925f('0x9'));var fs=require('fs');var fs_extra=require(_0x925f('0xa'));var _=require(_0x925f('0xb'));var squel=require(_0x925f('0xc'));var crypto=require(_0x925f('0xd'));var jsforce=require(_0x925f('0xe'));var deskjs=require(_0x925f('0xf'));var toCsv=require(_0x925f('0x8'));var querystring=require(_0x925f('0x10'));var Papa=require(_0x925f('0x11'));var Redis=require('ioredis');var authService=require(_0x925f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x925f('0x13'));var hardwareService=require(_0x925f('0x14'));var logger=require(_0x925f('0x15'))(_0x925f('0x16'));var utils=require(_0x925f('0x17'));var config=require(_0x925f('0x18'));var licenseUtil=require(_0x925f('0x19'));var db=require(_0x925f('0x1a'))['db'];config['redis']=_[_0x925f('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x925f('0x1c'))(new Redis(config[_0x925f('0x1d')]));require(_0x925f('0x1e'))[_0x925f('0x1f')](socket);var jayson=require(_0x925f('0x20'));var client=jayson[_0x925f('0x21')][_0x925f('0x22')]({'port':0x232c});var client9002=jayson[_0x925f('0x21')][_0x925f('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x527a40,_0x477f75,_0x151130,_0x1dbdb2){return new BPromise(function(_0x2fea51,_0x43a5f6){var _0x5d8e9a=_0x1dbdb2||client;return _0x5d8e9a[_0x925f('0x23')](_0x527a40,_0x151130)['then'](function(_0x3dc9bf){logger[_0x925f('0x24')](_0x925f('0x25'),_0x477f75,_0x925f('0x26'));logger['debug'](_0x925f('0x27'),_0x477f75,_0x925f('0x26'),JSON[_0x925f('0x28')](_0x3dc9bf));if(_0x3dc9bf[_0x925f('0x29')]){if(_0x3dc9bf['error'][_0x925f('0x2a')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x477f75,_0x3dc9bf[_0x925f('0x29')][_0x925f('0x2b')]);return _0x43a5f6(_0x3dc9bf[_0x925f('0x29')][_0x925f('0x2b')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x477f75,_0x3dc9bf['error'][_0x925f('0x2b')]);return _0x2fea51(_0x3dc9bf[_0x925f('0x29')][_0x925f('0x2b')]);}else{logger[_0x925f('0x24')](_0x925f('0x25'),_0x477f75,'request\x20sent');_0x2fea51(_0x3dc9bf[_0x925f('0x2c')]['message']);}})['catch'](function(_0xcb92db){logger[_0x925f('0x29')](_0x925f('0x25'),_0x477f75,_0xcb92db);_0x43a5f6(_0xcb92db);});});}function respondWithStatusCode(_0xa68f36,_0x352a10){_0x352a10=_0x352a10||0xcc;return function(_0x2d4838){if(_0x2d4838){return _0xa68f36['sendStatus'](_0x352a10);}return _0xa68f36['status'](_0x352a10)[_0x925f('0x2d')]();};}function respondWithResult(_0x13a286,_0x6c35e8){_0x6c35e8=_0x6c35e8||0xc8;return function(_0x406d6e){if(_0x406d6e){return _0x13a286[_0x925f('0x2e')](_0x6c35e8)[_0x925f('0x2f')](_0x406d6e);}};}function respondWithFilteredResult(_0x2f9283,_0x102f62){return function(_0x4371a0){if(_0x4371a0){var _0x19fcfe=typeof _0x102f62[_0x925f('0x30')]===_0x925f('0x31')&&typeof _0x102f62[_0x925f('0x32')]===_0x925f('0x31');var _0x3d2bad=_0x4371a0[_0x925f('0x33')];var _0x44519f=_0x19fcfe?0x0:_0x102f62['offset'];var _0x4034fe=_0x19fcfe?_0x4371a0['count']:_0x102f62[_0x925f('0x30')]+_0x102f62[_0x925f('0x32')];var _0xf931f7;if(_0x4034fe>=_0x3d2bad){_0x4034fe=_0x3d2bad;_0xf931f7=0xc8;}else{_0xf931f7=0xce;}_0x2f9283[_0x925f('0x2e')](_0xf931f7);return _0x2f9283[_0x925f('0x34')](_0x925f('0x35'),_0x44519f+'-'+_0x4034fe+'/'+_0x3d2bad)['json'](_0x4371a0);}return null;};}function patchUpdates(_0x1489c2){return function(_0x3a1a19){try{jsonpatch['apply'](_0x3a1a19,_0x1489c2,!![]);}catch(_0x3ff8ff){return BPromise[_0x925f('0x36')](_0x3ff8ff);}return _0x3a1a19[_0x925f('0x37')]();};}function saveUpdates(_0x51106b,_0x5df8f0){return function(_0x3cd520){if(_0x3cd520){return _0x3cd520['update'](_0x51106b)[_0x925f('0x38')](function(_0x85bede){return _0x85bede;});}return null;};}function removeEntity(_0x57a83a,_0x323bee){return function(_0x11a689){if(_0x11a689){return _0x11a689['destroy']()['then'](function(){var _0x4c319e=_0x11a689[_0x925f('0x39')]({'plain':!![]});var _0x245184=_0x925f('0x3a');return db['UserProfileResource'][_0x925f('0x3b')]({'where':{'type':_0x245184,'resourceId':_0x4c319e['id']}})['then'](function(){return _0x11a689;});})['then'](function(){_0x57a83a[_0x925f('0x2e')](0xcc)[_0x925f('0x2d')]();});}};}function handleEntityNotFound(_0xee3e9f,_0x10f6ff){return function(_0x533928){if(!_0x533928){_0xee3e9f[_0x925f('0x3c')](0x194);}return _0x533928;};}function handleError(_0x4f0549,_0x1322c0){_0x1322c0=_0x1322c0||0x1f4;return function(_0x229d26){logger[_0x925f('0x29')](_0x229d26['stack']);if(_0x229d26[_0x925f('0x3d')]){delete _0x229d26[_0x925f('0x3d')];}_0x4f0549['status'](_0x1322c0)['send'](_0x229d26);};}exports[_0x925f('0x3e')]=function(_0x20c642,_0x3ce3e4){var _0x3b50ba={'include':[{'model':db[_0x925f('0x3f')],'as':'mandatoryDispositionPause'}]},_0xa88a13={},_0x1c0c2c={'count':0x0,'rows':[]};var _0x223d1e=_['map'](db[_0x925f('0x40')][_0x925f('0x41')],function(_0x1e2f11){return{'name':_0x1e2f11['fieldName'],'type':_0x1e2f11['type'][_0x925f('0x42')]};});_0xa88a13[_0x925f('0x43')]=_['map'](_0x223d1e,_0x925f('0x3d'));_0xa88a13['query']=_[_0x925f('0x44')](_0x20c642[_0x925f('0x45')]);_0xa88a13['filters']=_[_0x925f('0x46')](_0xa88a13['model'],_0xa88a13[_0x925f('0x45')]);_0x3b50ba[_0x925f('0x47')]=_[_0x925f('0x46')](_0xa88a13[_0x925f('0x43')],qs['fields'](_0x20c642[_0x925f('0x45')][_0x925f('0x48')]));_0x3b50ba['attributes']=_0x3b50ba['attributes'][_0x925f('0x49')]?_0x3b50ba['attributes']:_0xa88a13[_0x925f('0x43')];if(!_0x20c642[_0x925f('0x45')][_0x925f('0x4a')]('nolimit')){_0x3b50ba[_0x925f('0x32')]=qs[_0x925f('0x32')](_0x20c642['query']['limit']);_0x3b50ba[_0x925f('0x30')]=qs[_0x925f('0x30')](_0x20c642[_0x925f('0x45')][_0x925f('0x30')]);}_0x3b50ba[_0x925f('0x4b')]=qs[_0x925f('0x4c')](_0x20c642[_0x925f('0x45')][_0x925f('0x4c')]);_0x3b50ba[_0x925f('0x4d')]=qs['filters'](_[_0x925f('0x4e')](_0x20c642[_0x925f('0x45')],_0xa88a13[_0x925f('0x4f')]),_0x223d1e);if(_0x20c642[_0x925f('0x45')]['filter']){_0x3b50ba[_0x925f('0x4d')]=_[_0x925f('0x50')](_0x3b50ba['where'],{'$or':_[_0x925f('0x51')](_0x223d1e,function(_0x509f4f){if(_0x509f4f[_0x925f('0x52')]!==_0x925f('0x53')){var _0x52d2bb={};_0x52d2bb[_0x509f4f[_0x925f('0x3d')]]={'$like':'%'+_0x20c642['query']['filter']+'%'};return _0x52d2bb;}})});}_0x3b50ba=_[_0x925f('0x50')]({},_0x3b50ba,_0x20c642[_0x925f('0x54')]);var _0x4933bb={'where':_0x3b50ba['where']};return db[_0x925f('0x40')][_0x925f('0x33')](_0x4933bb)[_0x925f('0x38')](function(_0x30e717){_0x1c0c2c[_0x925f('0x33')]=_0x30e717;if(_0x20c642['query'][_0x925f('0x55')]){_0x3b50ba['include']=[{'all':!![]}];}return db[_0x925f('0x40')]['findAll'](_0x3b50ba);})['then'](function(_0x1ee3c8){_0x1c0c2c[_0x925f('0x56')]=_0x1ee3c8;return _0x1c0c2c;})['then'](respondWithFilteredResult(_0x3ce3e4,_0x3b50ba))['catch'](handleError(_0x3ce3e4,null));};exports[_0x925f('0x57')]=function(_0x232118,_0x2efcf6){var _0xab681d={'raw':![],'where':{'id':_0x232118[_0x925f('0x58')]['id']},'include':[{'model':db[_0x925f('0x3f')],'as':_0x925f('0x59')}]},_0x20116c={};_0x20116c[_0x925f('0x43')]=_[_0x925f('0x44')](db[_0x925f('0x40')]['rawAttributes']);_0x20116c[_0x925f('0x45')]=_[_0x925f('0x44')](_0x232118[_0x925f('0x45')]);_0x20116c[_0x925f('0x4f')]=_[_0x925f('0x46')](_0x20116c[_0x925f('0x43')],_0x20116c[_0x925f('0x45')]);_0xab681d[_0x925f('0x47')]=_[_0x925f('0x46')](_0x20116c[_0x925f('0x43')],qs[_0x925f('0x48')](_0x232118[_0x925f('0x45')][_0x925f('0x48')]));_0xab681d[_0x925f('0x47')]=_0xab681d[_0x925f('0x47')][_0x925f('0x49')]?_0xab681d['attributes']:_0x20116c['model'];if(_0x232118[_0x925f('0x45')][_0x925f('0x55')]){_0xab681d[_0x925f('0x5a')]=[{'all':!![]}];}_0xab681d=_[_0x925f('0x50')]({},_0xab681d,_0x232118[_0x925f('0x54')]);return db['FaxAccount'][_0x925f('0x5b')](_0xab681d)[_0x925f('0x38')](handleEntityNotFound(_0x2efcf6,null))[_0x925f('0x38')](respondWithResult(_0x2efcf6,null))[_0x925f('0x5c')](handleError(_0x2efcf6,null));};exports[_0x925f('0x5d')]=function(_0x3becd5,_0xe9a922){return db[_0x925f('0x40')][_0x925f('0x5d')](_0x3becd5[_0x925f('0x5e')],{})[_0x925f('0x38')](function(_0x26d222){var _0x587e41=_0x3becd5['user']['get']({'plain':!![]});if(!_0x587e41)throw new Error(_0x925f('0x5f'));if(_0x587e41[_0x925f('0x60')]===_0x925f('0x61')){var _0x4cca93=_0x26d222['get']({'plain':!![]});var _0x3eea6f=_0x925f('0x3a');return db[_0x925f('0x62')][_0x925f('0x5b')]({'where':{'name':_0x3eea6f,'userProfileId':_0x587e41[_0x925f('0x63')]},'raw':!![]})[_0x925f('0x38')](function(_0x345905){if(_0x345905&&_0x345905['autoAssociation']===0x0){return db[_0x925f('0x64')][_0x925f('0x5d')]({'name':_0x4cca93[_0x925f('0x3d')],'resourceId':_0x4cca93['id'],'type':_0x345905[_0x925f('0x3d')],'sectionId':_0x345905['id']},{})[_0x925f('0x38')](function(){return _0x26d222;});}else{return _0x26d222;}})[_0x925f('0x5c')](function(_0x396078){logger[_0x925f('0x29')](_0x925f('0x65'),_0x396078);throw _0x396078;});}return _0x26d222;})[_0x925f('0x38')](respondWithResult(_0xe9a922,0xc9))['catch'](handleError(_0xe9a922,null));};exports[_0x925f('0x66')]=function(_0x4c6f90,_0xfacb2){if(_0x4c6f90[_0x925f('0x5e')]['id']){delete _0x4c6f90[_0x925f('0x5e')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x4c6f90[_0x925f('0x58')]['id']},'include':[{'model':db[_0x925f('0x3f')],'as':_0x925f('0x59')}]})[_0x925f('0x38')](handleEntityNotFound(_0xfacb2,null))['then'](saveUpdates(_0x4c6f90[_0x925f('0x5e')],null))[_0x925f('0x38')](respondWithResult(_0xfacb2,null))[_0x925f('0x5c')](handleError(_0xfacb2,null));};exports[_0x925f('0x3b')]=function(_0x3e2d67,_0x1cdb08){return db[_0x925f('0x40')][_0x925f('0x5b')]({'where':{'id':_0x3e2d67[_0x925f('0x58')]['id']}})[_0x925f('0x38')](handleEntityNotFound(_0x1cdb08,null))[_0x925f('0x38')](removeEntity(_0x1cdb08,null))[_0x925f('0x5c')](handleError(_0x1cdb08,null));};exports['describe']=function(_0x1075f0,_0x39a6c8){return db[_0x925f('0x40')][_0x925f('0x67')]()[_0x925f('0x38')](respondWithResult(_0x39a6c8,null))['catch'](handleError(_0x39a6c8,null));};exports[_0x925f('0x68')]=function(_0x54a943,_0x2a641b,_0x4f1972){if(_0x54a943[_0x925f('0x5e')]['id']){delete _0x54a943[_0x925f('0x5e')]['id'];}return db[_0x925f('0x40')][_0x925f('0x5b')]({'where':{'id':_0x54a943[_0x925f('0x58')]['id']}})[_0x925f('0x38')](handleEntityNotFound(_0x2a641b,null))[_0x925f('0x38')](function(_0xa0f6ae){if(_0xa0f6ae){_0x54a943[_0x925f('0x5e')][_0x925f('0x69')]=_0xa0f6ae['id'];return db[_0x925f('0x6a')][_0x925f('0x5d')](_0x54a943[_0x925f('0x5e')]);}})[_0x925f('0x38')](respondWithResult(_0x2a641b,null))[_0x925f('0x5c')](handleError(_0x2a641b,null));};exports[_0x925f('0x6b')]=function(_0x1dd4c0,_0xac63bc,_0x4ab438){var _0x3e4764={'raw':![],'where':{}};var _0x2325ef={};var _0x2bb6f9={'count':0x0,'rows':[]};return db[_0x925f('0x40')][_0x925f('0x6c')]({'where':{'id':_0x1dd4c0[_0x925f('0x58')]['id']}})[_0x925f('0x38')](handleEntityNotFound(_0xac63bc,null))[_0x925f('0x38')](function(_0x3e658a){if(_0x3e658a){_0x2325ef[_0x925f('0x43')]=_['keys'](db[_0x925f('0x6a')][_0x925f('0x41')]);_0x2325ef[_0x925f('0x45')]=_['keys'](_0x1dd4c0[_0x925f('0x45')]);_0x2325ef[_0x925f('0x4f')]=_[_0x925f('0x46')](_0x2325ef['model'],_0x2325ef[_0x925f('0x45')]);_0x3e4764[_0x925f('0x47')]=_[_0x925f('0x46')](_0x2325ef['model'],qs[_0x925f('0x48')](_0x1dd4c0['query']['fields']));_0x3e4764[_0x925f('0x47')]=_0x3e4764[_0x925f('0x47')][_0x925f('0x49')]?_0x3e4764[_0x925f('0x47')]:_0x2325ef[_0x925f('0x43')];if(!_0x1dd4c0[_0x925f('0x45')][_0x925f('0x4a')](_0x925f('0x6d'))){_0x3e4764[_0x925f('0x32')]=qs[_0x925f('0x32')](_0x1dd4c0[_0x925f('0x45')]['limit']);_0x3e4764[_0x925f('0x30')]=qs['offset'](_0x1dd4c0[_0x925f('0x45')]['offset']);}_0x3e4764[_0x925f('0x4b')]=qs['sort'](_0x1dd4c0[_0x925f('0x45')][_0x925f('0x4c')]);_0x3e4764[_0x925f('0x4d')]=qs[_0x925f('0x4f')](_[_0x925f('0x4e')](_0x1dd4c0[_0x925f('0x45')],_0x2325ef['filters']));_0x3e4764[_0x925f('0x4d')][_0x925f('0x69')]=_0x3e658a['id'];if(_0x1dd4c0[_0x925f('0x45')]['filter']){_0x3e4764[_0x925f('0x4d')]=_[_0x925f('0x50')](_0x3e4764[_0x925f('0x4d')],{'$or':_[_0x925f('0x51')](_0x3e4764[_0x925f('0x47')],function(_0x1f288b){var _0x4a6e56={};_0x4a6e56[_0x1f288b]={'$like':'%'+_0x1dd4c0[_0x925f('0x45')][_0x925f('0x6e')]+'%'};return _0x4a6e56;})});}_0x3e4764=_['merge']({},_0x3e4764,_0x1dd4c0[_0x925f('0x54')]);return db[_0x925f('0x6a')][_0x925f('0x33')]({'where':_0x3e4764[_0x925f('0x4d')]})['then'](function(_0x5e82b5){_0x2bb6f9[_0x925f('0x33')]=_0x5e82b5;if(_0x1dd4c0['query'][_0x925f('0x55')]){_0x3e4764['include']=[{'all':!![]}];}return db[_0x925f('0x6a')][_0x925f('0x6f')](_0x3e4764);})[_0x925f('0x38')](function(_0x127875){_0x2bb6f9[_0x925f('0x56')]=_0x127875;return _0x2bb6f9;});}})[_0x925f('0x38')](respondWithFilteredResult(_0xac63bc,_0x3e4764))['catch'](handleError(_0xac63bc,null));};exports[_0x925f('0x70')]=function(_0x1f5a10,_0x18873f,_0x577817){return db[_0x925f('0x40')][_0x925f('0x5b')]({'where':{'id':_0x1f5a10['params']['id']}})[_0x925f('0x38')](handleEntityNotFound(_0x18873f,null))[_0x925f('0x38')](function(_0x53a18f){if(_0x53a18f){return _0x53a18f['removeDispositions'](_0x1f5a10[_0x925f('0x45')][_0x925f('0x71')]);}})['then'](respondWithStatusCode(_0x18873f,null))[_0x925f('0x5c')](handleError(_0x18873f,null));};exports[_0x925f('0x72')]=function(_0x3331b8,_0x1c1280,_0x272acc){if(_0x3331b8[_0x925f('0x5e')]['id']){delete _0x3331b8['body']['id'];}return db[_0x925f('0x40')]['find']({'where':{'id':_0x3331b8['params']['id']}})[_0x925f('0x38')](handleEntityNotFound(_0x1c1280,null))[_0x925f('0x38')](function(_0x2f7fca){if(_0x2f7fca){_0x3331b8[_0x925f('0x5e')][_0x925f('0x69')]=_0x2f7fca['id'];return db[_0x925f('0x73')][_0x925f('0x5d')](_0x3331b8['body']);}})[_0x925f('0x38')](respondWithResult(_0x1c1280,null))[_0x925f('0x5c')](handleError(_0x1c1280,null));};exports[_0x925f('0x74')]=function(_0xc8143d,_0x27bd30,_0x24c016){var _0x8f607c={'raw':![],'where':{}};var _0x377b1e={};var _0x5c3428={'count':0x0,'rows':[]};return db['FaxAccount'][_0x925f('0x6c')]({'where':{'id':_0xc8143d['params']['id']}})[_0x925f('0x38')](handleEntityNotFound(_0x27bd30,null))[_0x925f('0x38')](function(_0x4a4371){if(_0x4a4371){_0x377b1e['model']=_[_0x925f('0x44')](db[_0x925f('0x73')][_0x925f('0x41')]);_0x377b1e[_0x925f('0x45')]=_[_0x925f('0x44')](_0xc8143d[_0x925f('0x45')]);_0x377b1e[_0x925f('0x4f')]=_[_0x925f('0x46')](_0x377b1e['model'],_0x377b1e['query']);_0x8f607c['attributes']=_['intersection'](_0x377b1e[_0x925f('0x43')],qs[_0x925f('0x48')](_0xc8143d[_0x925f('0x45')][_0x925f('0x48')]));_0x8f607c[_0x925f('0x47')]=_0x8f607c[_0x925f('0x47')][_0x925f('0x49')]?_0x8f607c[_0x925f('0x47')]:_0x377b1e[_0x925f('0x43')];if(!_0xc8143d['query'][_0x925f('0x4a')](_0x925f('0x6d'))){_0x8f607c[_0x925f('0x32')]=qs[_0x925f('0x32')](_0xc8143d[_0x925f('0x45')][_0x925f('0x32')]);_0x8f607c['offset']=qs[_0x925f('0x30')](_0xc8143d[_0x925f('0x45')][_0x925f('0x30')]);}_0x8f607c['order']=qs['sort'](_0xc8143d[_0x925f('0x45')]['sort']);_0x8f607c[_0x925f('0x4d')]=qs[_0x925f('0x4f')](_[_0x925f('0x4e')](_0xc8143d[_0x925f('0x45')],_0x377b1e['filters']));_0x8f607c['where'][_0x925f('0x69')]=_0x4a4371['id'];if(_0xc8143d[_0x925f('0x45')]['filter']){_0x8f607c[_0x925f('0x4d')]=_['merge'](_0x8f607c[_0x925f('0x4d')],{'$or':_[_0x925f('0x51')](_0x8f607c[_0x925f('0x47')],function(_0xf7b0c1){var _0x598139={};_0x598139[_0xf7b0c1]={'$like':'%'+_0xc8143d[_0x925f('0x45')][_0x925f('0x6e')]+'%'};return _0x598139;})});}_0x8f607c=_[_0x925f('0x50')]({},_0x8f607c,_0xc8143d['options']);return db[_0x925f('0x73')][_0x925f('0x33')]({'where':_0x8f607c[_0x925f('0x4d')]})[_0x925f('0x38')](function(_0x3f31e3){_0x5c3428[_0x925f('0x33')]=_0x3f31e3;if(_0xc8143d['query'][_0x925f('0x55')]){_0x8f607c[_0x925f('0x5a')]=[{'all':!![]}];}return db[_0x925f('0x73')][_0x925f('0x6f')](_0x8f607c);})['then'](function(_0x50056a){_0x5c3428[_0x925f('0x56')]=_0x50056a;return _0x5c3428;});}})[_0x925f('0x38')](respondWithFilteredResult(_0x27bd30,_0x8f607c))['catch'](handleError(_0x27bd30,null));};exports['removeAnswers']=function(_0x5b6b8d,_0xb3788d,_0x4df572){return db[_0x925f('0x40')]['find']({'where':{'id':_0x5b6b8d[_0x925f('0x58')]['id']}})[_0x925f('0x38')](handleEntityNotFound(_0xb3788d,null))[_0x925f('0x38')](function(_0x49194c){if(_0x49194c){return _0x49194c[_0x925f('0x75')](_0x5b6b8d[_0x925f('0x45')]['ids']);}})[_0x925f('0x38')](respondWithStatusCode(_0xb3788d,null))[_0x925f('0x5c')](handleError(_0xb3788d,null));};exports['addInteraction']=function(_0x436d21,_0x40f2dd,_0x226986){return db[_0x925f('0x76')][_0x925f('0x5b')]({'where':{'id':_0x436d21[_0x925f('0x58')]['id']}})['then'](handleEntityNotFound(_0x40f2dd,null))[_0x925f('0x38')](function(_0x457c69){if(_0x457c69){return _0x457c69[_0x925f('0x77')](_0x436d21[_0x925f('0x5e')][_0x925f('0x71')],_['omit'](_0x436d21[_0x925f('0x5e')],[_0x925f('0x71'),'id'])||{});}})[_0x925f('0x38')](respondWithResult(_0x40f2dd,null))[_0x925f('0x5c')](handleError(_0x40f2dd,null));};exports[_0x925f('0x78')]=function(_0x59656f,_0x4e115a,_0x480a31){var _0x48d862={'raw':![],'where':{}};var _0xfd3b0f={};var _0x304580={'count':0x0,'rows':[]};return db[_0x925f('0x40')][_0x925f('0x6c')]({'where':{'id':_0x59656f[_0x925f('0x58')]['id']}})[_0x925f('0x38')](handleEntityNotFound(_0x4e115a,null))[_0x925f('0x38')](function(_0x5c7500){if(_0x5c7500){_0xfd3b0f[_0x925f('0x43')]=_[_0x925f('0x44')](db[_0x925f('0x76')][_0x925f('0x41')]);_0xfd3b0f['query']=_['keys'](_0x59656f[_0x925f('0x45')]);_0xfd3b0f[_0x925f('0x4f')]=_[_0x925f('0x46')](_0xfd3b0f[_0x925f('0x43')],_0xfd3b0f[_0x925f('0x45')]);_0x48d862['attributes']=_[_0x925f('0x46')](_0xfd3b0f[_0x925f('0x43')],qs['fields'](_0x59656f[_0x925f('0x45')]['fields']));_0x48d862['attributes']=_0x48d862[_0x925f('0x47')][_0x925f('0x49')]?_0x48d862[_0x925f('0x47')]:_0xfd3b0f[_0x925f('0x43')];if(!_0x59656f[_0x925f('0x45')][_0x925f('0x4a')]('nolimit')){_0x48d862[_0x925f('0x32')]=qs[_0x925f('0x32')](_0x59656f[_0x925f('0x45')][_0x925f('0x32')]);_0x48d862[_0x925f('0x30')]=qs[_0x925f('0x30')](_0x59656f[_0x925f('0x45')][_0x925f('0x30')]);}_0x48d862[_0x925f('0x4b')]=qs['sort'](_0x59656f[_0x925f('0x45')]['sort']);_0x48d862['where']=qs[_0x925f('0x4f')](_['pick'](_0x59656f['query'],_0xfd3b0f[_0x925f('0x4f')]));_0x48d862['where'][_0x925f('0x69')]=_0x5c7500['id'];if(_0x59656f[_0x925f('0x45')]['filter']){_0x48d862[_0x925f('0x4d')]=_['merge'](_0x48d862[_0x925f('0x4d')],{'$or':_[_0x925f('0x51')](_0x48d862[_0x925f('0x47')],function(_0x49f598){var _0x2dd5f3={};_0x2dd5f3[_0x49f598]={'$like':'%'+_0x59656f[_0x925f('0x45')][_0x925f('0x6e')]+'%'};return _0x2dd5f3;})});}_0x48d862=_['merge']({},_0x48d862,_0x59656f[_0x925f('0x54')]);return db[_0x925f('0x76')]['count']({'where':_0x48d862[_0x925f('0x4d')]})['then'](function(_0x29a0e2){_0x304580[_0x925f('0x33')]=_0x29a0e2;if(_0x59656f[_0x925f('0x45')][_0x925f('0x55')]){_0x48d862['include']=[{'model':db[_0x925f('0x79')],'as':_0x925f('0x7a'),'required':![]},{'model':db[_0x925f('0x7b')],'as':_0x925f('0x7c'),'attributes':[_0x925f('0x3d'),_0x925f('0x7d'),_0x925f('0x7e')],'required':![]},{'model':db[_0x925f('0x7f')],'as':_0x925f('0x80'),'attributes':['id',_0x925f('0x3d'),_0x925f('0x81')],'where':_0x59656f[_0x925f('0x45')][_0x925f('0x82')]?{'id':_0x59656f[_0x925f('0x45')][_0x925f('0x82')]}:undefined,'required':_0x59656f[_0x925f('0x45')]['tag']?!![]:![]}];}return db[_0x925f('0x76')][_0x925f('0x6f')](_0x48d862);})['then'](function(_0x3607d7){_0x304580[_0x925f('0x56')]=_0x3607d7;return _0x304580;});}})[_0x925f('0x38')](respondWithFilteredResult(_0x4e115a,_0x48d862))[_0x925f('0x5c')](handleError(_0x4e115a,null));};exports[_0x925f('0x83')]=function(_0x546d09,_0x8934cd){var _0x141cea=_0x546d09['params']['id'];var _0x23a5c1=_0x546d09[_0x925f('0x5e')];var _0x29b639=0xc8;var _0x31acd5=null;return db[_0x925f('0x84')]['transaction']({'isolationLevel':db[_0x925f('0x84')][_0x925f('0x85')][_0x925f('0x86')][_0x925f('0x87')]},function(_0x4ec337){return db[_0x925f('0x40')]['findOne']({'where':{'id':_0x141cea},'transaction':_0x4ec337})[_0x925f('0x38')](function(_0x291ab9){if(_0x291ab9){return db[_0x925f('0x88')]['destroy']({'where':{'FaxAccountId':_0x141cea},'transaction':_0x4ec337})[_0x925f('0x38')](function(){var _0x1d649f=_['map'](_0x23a5c1,function(_0x343888){_0x343888['FaxAccountId']=_0x141cea;return _0x343888;});return db[_0x925f('0x88')][_0x925f('0x89')](_0x1d649f,{'transaction':_0x4ec337});});}else{_0x29b639=0x194;_0x31acd5=[];}});})[_0x925f('0x38')](function(){if(_0x29b639!==0x194){return db[_0x925f('0x88')][_0x925f('0x8a')]({'where':{'FaxAccountId':_0x141cea},'order':'priority'})['then'](function(_0x2a656e){_0x31acd5=_0x2a656e;});}})[_0x925f('0x5c')](function(_0x263531){_0x29b639=0x1f4;logger[_0x925f('0x29')](_0x263531[_0x925f('0x8b')]);if(_0x263531['name']){delete _0x263531[_0x925f('0x3d')];}_0x31acd5=_0x263531;})[_0x925f('0x8c')](function(){if(_0x31acd5===null){_0x8934cd[_0x925f('0x3c')](_0x29b639);}else{if(_0x29b639===0x1f4){_0x8934cd[_0x925f('0x2e')](_0x29b639)[_0x925f('0x8d')](_0x31acd5);}else{_0x8934cd[_0x925f('0x2e')](_0x29b639)[_0x925f('0x2f')](_0x31acd5);}}});};exports[_0x925f('0x8e')]=function(_0x2c8bc7,_0x55c5f9,_0x44b2bd){var _0x3ceb35={};var _0x324621={};var _0x190f92;var _0x3d4ba9;return db['FaxAccount'][_0x925f('0x6c')]({'where':{'id':_0x2c8bc7[_0x925f('0x58')]['id']}})[_0x925f('0x38')](handleEntityNotFound(_0x55c5f9,null))[_0x925f('0x38')](function(_0x57dc49){if(_0x57dc49){_0x190f92=_0x57dc49;_0x324621['model']=_[_0x925f('0x44')](db[_0x925f('0x88')]['rawAttributes']);_0x324621['query']=_[_0x925f('0x44')](_0x2c8bc7['query']);_0x324621[_0x925f('0x4f')]=_[_0x925f('0x46')](_0x324621[_0x925f('0x43')],_0x324621['query']);_0x3ceb35[_0x925f('0x47')]=_[_0x925f('0x46')](_0x324621[_0x925f('0x43')],qs['fields'](_0x2c8bc7[_0x925f('0x45')]['fields']));_0x3ceb35[_0x925f('0x47')]=_0x3ceb35['attributes'][_0x925f('0x49')]?_0x3ceb35[_0x925f('0x47')]:_0x324621[_0x925f('0x43')];_0x3ceb35[_0x925f('0x4b')]=qs[_0x925f('0x4c')](_0x2c8bc7[_0x925f('0x45')][_0x925f('0x4c')]);_0x3ceb35[_0x925f('0x4d')]=qs[_0x925f('0x4f')](_['pick'](_0x2c8bc7[_0x925f('0x45')],_0x324621[_0x925f('0x4f')]));if(_0x2c8bc7[_0x925f('0x45')][_0x925f('0x6e')]){_0x3ceb35['where']=_[_0x925f('0x50')](_0x3ceb35[_0x925f('0x4d')],{'$or':_[_0x925f('0x51')](_0x3ceb35[_0x925f('0x47')],function(_0x2bf21e){var _0x3223c0={};_0x3223c0[_0x2bf21e]={'$like':'%'+_0x2c8bc7[_0x925f('0x45')][_0x925f('0x6e')]+'%'};return _0x3223c0;})});}_0x3ceb35=_['merge']({},_0x3ceb35,_0x2c8bc7['options']);return _0x190f92[_0x925f('0x8e')](_0x3ceb35);}})[_0x925f('0x38')](function(_0x5be3ef){if(_0x5be3ef){_0x3d4ba9=_0x5be3ef[_0x925f('0x49')];if(!_0x2c8bc7[_0x925f('0x45')][_0x925f('0x4a')](_0x925f('0x6d'))){_0x3ceb35[_0x925f('0x32')]=qs[_0x925f('0x32')](_0x2c8bc7[_0x925f('0x45')][_0x925f('0x32')]);_0x3ceb35[_0x925f('0x30')]=qs[_0x925f('0x30')](_0x2c8bc7['query'][_0x925f('0x30')]);}return _0x190f92[_0x925f('0x8e')](_0x3ceb35);}})['then'](function(_0x365a49){if(_0x365a49){return _0x365a49?{'count':_0x3d4ba9,'rows':_0x365a49}:null;}})[_0x925f('0x38')](respondWithResult(_0x55c5f9,null))[_0x925f('0x5c')](handleError(_0x55c5f9,null));};function Extension(_0x5b9594,_0x1fa2c5,_0x586c4d,_0x3c99d0){this[_0x925f('0x8f')]='from-voip-provider';this[_0x925f('0x90')]=_0x5b9594['localstationid'];this[_0x925f('0x91')]=_0x3c99d0;this['type']=_0x925f('0x92');this[_0x925f('0x93')]='Fax\x20Extension';this[_0x925f('0x69')]=_0x5b9594['id'];this[_0x925f('0x94')]=_0x1fa2c5;this['appdata']=_0x586c4d;}function createExtensionsReciveFax(_0x120ae3){var _0x1de09f=0x1;var _0x37ca8a=[];_0x37ca8a['push'](new Extension(_0x120ae3,_0x1de09f,'',_0x925f('0x95')));_0x1de09f+=0x1;_0x37ca8a['push'](new Extension(_0x120ae3,_0x1de09f,_0x925f('0x96'),_0x925f('0x97')));_0x1de09f+=0x1;for(var _0x541cb4 in _0x120ae3){if(_0x120ae3[_0x925f('0x4a')](_0x541cb4)&&(_0x541cb4==='ecm'||_0x541cb4===_0x925f('0x98')||_0x541cb4==='gateway'||_0x541cb4===_0x925f('0x99')||_0x541cb4===_0x925f('0x9a')||_0x541cb4==='maxrate'||_0x541cb4==='minrate'||_0x541cb4===_0x925f('0x9b')||_0x541cb4==='t38timeout')){_0x37ca8a[_0x925f('0x9c')](new Extension(_0x120ae3,_0x1de09f,_0x925f('0x9d')+_0x541cb4+')='+_0x120ae3[_0x541cb4],'Set'));_0x1de09f+=0x1;}}_0x37ca8a[_0x925f('0x9c')](new Extension(_0x120ae3,_0x1de09f,'6','Wait'));_0x1de09f+=0x1;_0x37ca8a['push'](new Extension(_0x120ae3,_0x1de09f,_0x925f('0x9e'),'ReceiveFax'));_0x1de09f=0x0;return _0x37ca8a;}exports['addAccountApplications']=function(_0x26dd74,_0x2b9c26,_0x7b2e82){var _0x203a46;return db['sequelize']['transaction'](function(_0x2bab94){return db[_0x925f('0x40')]['create'](_0x26dd74[_0x925f('0x5e')],{'transaction':_0x2bab94})[_0x925f('0x38')](function(_0x295a61){_0x203a46=_0x295a61['get']({'plain':!![]});return db[_0x925f('0x9f')][_0x925f('0x89')](createExtensionsReciveFax(_0x203a46),{'transaction':_0x2bab94});});})[_0x925f('0x38')](function(){return _0x203a46;})[_0x925f('0x38')](respondWithResult(_0x2b9c26,null))[_0x925f('0x5c')](handleError(_0x2b9c26,null));};exports[_0x925f('0xa0')]=function(_0x224027,_0x3f7415,_0x3186d3){var _0x741c61;return db[_0x925f('0x84')][_0x925f('0xa1')](function(_0x4379d8){return db['FaxAccount']['update'](_0x224027[_0x925f('0x5e')],{'where':{'id':_0x224027[_0x925f('0x5e')]['id']},'transaction':_0x4379d8})['then'](function(_0x5e5a1e){return db[_0x925f('0x9f')][_0x925f('0x3b')]({'where':{'FaxAccountId':_0x224027[_0x925f('0x5e')]['id']},'transaction':_0x4379d8})['then'](function(_0x10c5af){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0x925f('0xa2')](_0x224027[_0x925f('0x5e')],[_0x925f('0xa3'),_0x925f('0x42'),_0x925f('0xa4'),'updatedAt',_0x925f('0xa5'),_0x925f('0xa6')])),{'transaction':_0x4379d8});});});})[_0x925f('0x38')](function(){return db[_0x925f('0x40')][_0x925f('0xa7')](_0x224027[_0x925f('0x5e')]['id']);})[_0x925f('0x38')](respondWithResult(_0x3f7415,null))[_0x925f('0x5c')](handleError(_0x3f7415,null));};exports[_0x925f('0xa8')]=function(_0x17733d,_0x39ae09,_0x579ba4){var _0x120593={'raw':!![],'where':{}};var _0x36ca4d={};var _0x3d3f0e={'count':0x0,'rows':[]};return db[_0x925f('0x40')][_0x925f('0x6c')]({'where':{'id':_0x17733d[_0x925f('0x58')]['id']}})[_0x925f('0x38')](handleEntityNotFound(_0x39ae09,null))[_0x925f('0x38')](function(_0x133a27){if(_0x133a27){_0x36ca4d[_0x925f('0x43')]=_[_0x925f('0x44')](db[_0x925f('0xa9')][_0x925f('0x41')]);_0x36ca4d[_0x925f('0x45')]=_[_0x925f('0x44')](_0x17733d[_0x925f('0x45')]);_0x36ca4d[_0x925f('0x4f')]=_[_0x925f('0x46')](_0x36ca4d[_0x925f('0x43')],_0x36ca4d['query']);_0x120593[_0x925f('0x47')]=_[_0x925f('0x46')](_0x36ca4d[_0x925f('0x43')],qs['fields'](_0x17733d[_0x925f('0x45')][_0x925f('0x48')]));_0x120593[_0x925f('0x47')]=_0x120593['attributes'][_0x925f('0x49')]?_0x120593['attributes']:_0x36ca4d[_0x925f('0x43')];if(!_0x17733d[_0x925f('0x45')][_0x925f('0x4a')](_0x925f('0x6d'))){_0x120593[_0x925f('0x32')]=qs[_0x925f('0x32')](_0x17733d[_0x925f('0x45')][_0x925f('0x32')]);_0x120593[_0x925f('0x30')]=qs['offset'](_0x17733d[_0x925f('0x45')]['offset']);}_0x120593[_0x925f('0x4b')]=qs[_0x925f('0x4c')](_0x17733d[_0x925f('0x45')][_0x925f('0x4c')]);_0x120593[_0x925f('0x4d')]=qs[_0x925f('0x4f')](_[_0x925f('0x4e')](_0x17733d['query'],_0x36ca4d[_0x925f('0x4f')]));_0x120593[_0x925f('0x4d')][_0x925f('0x69')]=_0x133a27['id'];if(_0x17733d[_0x925f('0x45')][_0x925f('0x6e')]){_0x120593[_0x925f('0x4d')]=_['merge'](_0x120593[_0x925f('0x4d')],{'$or':_['map'](_0x120593[_0x925f('0x47')],function(_0x1cde88){var _0x2cbe51={};_0x2cbe51[_0x1cde88]={'$like':'%'+_0x17733d[_0x925f('0x45')]['filter']+'%'};return _0x2cbe51;})});}if(_0x17733d['query'][_0x925f('0xaa')]){var _0x366cc7=_0x17733d[_0x925f('0x45')][_0x925f('0xaa')][_0x925f('0xab')](',');var _0x12eb65={};_0x12eb65[_0x366cc7[0x0]]={'$gte':moment(_0x366cc7[0x1])[_0x925f('0xac')]('YYYY-MM-DD\x20HH:mm:ss')};_0x120593[_0x925f('0x4d')]=_[_0x925f('0x50')](_0x120593[_0x925f('0x4d')],_0x12eb65);}_0x120593=_[_0x925f('0x50')]({},_0x120593,_0x17733d[_0x925f('0x54')]);return db[_0x925f('0xa9')][_0x925f('0x33')]({'where':_0x120593['where']})[_0x925f('0x38')](function(_0x45e5ee){_0x3d3f0e[_0x925f('0x33')]=_0x45e5ee;if(_0x17733d[_0x925f('0x45')][_0x925f('0x55')]){_0x120593['include']=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x120593);})[_0x925f('0x38')](function(_0x3bf060){_0x3d3f0e[_0x925f('0x56')]=_0x3bf060;return _0x3d3f0e;});}})[_0x925f('0x38')](respondWithFilteredResult(_0x39ae09,_0x120593))[_0x925f('0x5c')](handleError(_0x39ae09,null));};exports[_0x925f('0x8d')]=function(_0x1118ee,_0x13a1a9,_0x38e1f3){var _0x477dd7,_0x1388f4={},_0x42ca8c;if(_0x1118ee['body']['to']){_0x42ca8c=_0x1118ee[_0x925f('0x5e')]['to'][0x0];}return db[_0x925f('0x40')]['find']({'where':{'id':_0x1118ee[_0x925f('0x58')]['id']},'include':[{'model':db[_0x925f('0xad')],'as':'List','include':[{'model':db[_0x925f('0x79')],'as':_0x925f('0xae'),'where':{'fax':_0x42ca8c},'limit':0x1,'order':[[_0x925f('0xaf'),_0x925f('0xb0')]]}]}]})[_0x925f('0x38')](handleEntityNotFound(_0x13a1a9,null))[_0x925f('0x38')](function(_0x107344){_0x477dd7=_0x107344;if(_0x1118ee['body'][_0x925f('0xb1')]&&_0x1118ee['body']['attachments'][_0x925f('0x49')]){for(var _0xd45dd6=0x0;_0xd45dd6<_0x1118ee['body']['attachments'][_0x925f('0x49')];_0xd45dd6+=0x1){_0x1118ee['body'][_0x925f('0xb1')][_0xd45dd6]={'filename':_0x1118ee[_0x925f('0x5e')][_0x925f('0xb1')][_0xd45dd6][_0x925f('0x3d')],'id':_0x1118ee[_0x925f('0x5e')][_0x925f('0xb1')][_0xd45dd6]['id'],'path':path['join'](config[_0x925f('0xb2')],'server/files/attachments',_0x1118ee['body'][_0x925f('0xb1')][_0xd45dd6][_0x925f('0xb3')])};}}return respondWithRpcPromise(_0x925f('0xb4'),'CheckAfterSend',{'FaxAccountId':_[_0x925f('0xb5')](_0x1118ee[_0x925f('0x58')]['id'])?undefined:_0x1118ee[_0x925f('0x58')]['id'],'path':_[_0x925f('0xb5')](_0x1118ee[_0x925f('0x5e')][_0x925f('0xb1')][0x0][_0x925f('0x7')])?undefined:_0x1118ee['body']['attachments'][0x0][_0x925f('0x7')],'fax':_[_0x925f('0xb5')](_0x1118ee['body']['to'][0x0])?undefined:_0x1118ee[_0x925f('0x5e')]['to'][0x0]},client9002);})[_0x925f('0x38')](function(){if(_0x477dd7){if(_[_0x925f('0xb5')](_0x1118ee['body'][_0x925f('0xb6')])){_0x1118ee[_0x925f('0x5e')][_0x925f('0xb6')]=util[_0x925f('0xac')](_0x925f('0xb7'),_0x477dd7[_0x925f('0x3d')],_0x477dd7[_0x925f('0xb8')]);}if(_0x477dd7[_0x925f('0xb9')]){if(_0x477dd7[_0x925f('0xb9')][_0x925f('0xae')][_0x925f('0x49')]){return _0x477dd7[_0x925f('0xb9')][_0x925f('0xae')][0x0];}else{return db[_0x925f('0x79')][_0x925f('0x5d')](_[_0x925f('0x1b')](_0x1118ee[_0x925f('0x5e')],{'firstName':_0x1118ee[_0x925f('0x5e')]['to'][0x0],'phone':_0x1118ee[_0x925f('0x5e')]['to'][0x0],'fax':_0x1118ee['body']['to'][0x0],'ListId':_0x477dd7[_0x925f('0xa6')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x925f('0xba'));}})['then'](function(_0x83ecc2){if(_0x83ecc2){return db[_0x925f('0x76')][_0x925f('0x5b')]({'where':{'ContactId':_0x83ecc2['id'],'closed':![],'FaxAccountId':_0x477dd7['id']}})['then'](function(_0x2bcc5c){if(_0x2bcc5c){return[_0x2bcc5c,![]];}return db[_0x925f('0x76')]['create']({'UserId':_0x1118ee['user']['id'],'ContactId':_0x83ecc2['id'],'FaxAccountId':_0x477dd7['id'],'fax':_0x1118ee[_0x925f('0x5e')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x925f('0x50')](_0x1118ee[_0x925f('0x5e')],{'read':![],'body':_0x1118ee[_0x925f('0x5e')]['attachments'][0x0]['filename'],'FaxAccountId':_0x477dd7['id'],'UserId':_0x1118ee[_0x925f('0x61')]['id'],'ContactId':_0x83ecc2['id'],'AttachmentId':_0x1118ee[_0x925f('0x5e')][_0x925f('0xb1')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x925f('0xbb')}]})[_0x925f('0x38')](function(_0x3daa53){return[_0x3daa53,!![]];});});}else{throw new Error(_0x925f('0xbc'));}})[_0x925f('0xbd')](function(_0x529abc,_0x44bb15){if(_0x44bb15){return _0x529abc;}return db[_0x925f('0xa9')]['create']({'direction':_0x925f('0xbe'),'read':![],'body':_0x1118ee[_0x925f('0x5e')][_0x925f('0xb1')][0x0][_0x925f('0xbf')],'FaxAccountId':_0x477dd7['id'],'FaxInteractionId':_0x529abc['id'],'UserId':_0x1118ee[_0x925f('0x61')]['id'],'ContactId':_0x529abc[_0x925f('0xc0')],'AttachmentId':_0x1118ee[_0x925f('0x5e')][_0x925f('0xb1')][0x0]['id']})['then'](function(_0x8ab52a){_0x529abc[_0x925f('0xc1')][_0x925f('0xbb')]=[];_0x529abc[_0x925f('0xc1')][_0x925f('0xbb')][_0x925f('0x9c')](_0x8ab52a[_0x925f('0xc1')]);return _0x529abc;});})[_0x925f('0x38')](function(_0x1b0014){respondWithRpcPromise(_0x925f('0xc2'),_0x925f('0xc2'),{'FaxAccountId':_['isNil'](_0x1118ee[_0x925f('0x58')]['id'])?undefined:_0x1118ee[_0x925f('0x58')]['id'],'path':_['isNil'](_0x1118ee[_0x925f('0x5e')][_0x925f('0xb1')][0x0][_0x925f('0x7')])?undefined:_0x1118ee['body']['attachments'][0x0][_0x925f('0x7')],'fax':_[_0x925f('0xb5')](_0x1118ee['body']['to'][0x0])?undefined:_0x1118ee['body']['to'][0x0],'AttachmentId':_0x1118ee[_0x925f('0x5e')][_0x925f('0xb1')][0x0]['id']},client9002)['then'](function(_0x1dd686){logger[_0x925f('0x24')]('SendFaxRpc,\x20%s',_0x1dd686);})['catch'](function(_0x15001f){logger[_0x925f('0x24')](_0x925f('0xc3'),_0x15001f);});return _0x1b0014;})[_0x925f('0x38')](respondWithResult(_0x13a1a9,null))['catch'](handleError(_0x13a1a9,null));};exports['addAgents']=function(_0x657ec0,_0x21a50a,_0x5c6564){return db[_0x925f('0x40')][_0x925f('0x5b')]({'where':{'id':_0x657ec0[_0x925f('0x58')]['id']}})[_0x925f('0x38')](handleEntityNotFound(_0x21a50a,null))[_0x925f('0x38')](function(_0x3977ed){if(_0x3977ed){return _0x3977ed[_0x925f('0xc4')](_0x657ec0[_0x925f('0x5e')][_0x925f('0x71')],_['omit'](_0x657ec0[_0x925f('0x5e')],['ids','id'])||{})[_0x925f('0xbd')](function(_0x423685){for(var _0x515f30=0x0;_0x515f30<_0x657ec0['body']['ids'][_0x925f('0x49')];_0x515f30+=0x1){socket[_0x925f('0xc5')](_0x925f('0xc6'),{'UserId':Number(_0x657ec0[_0x925f('0x5e')][_0x925f('0x71')][_0x515f30]),'FaxAccountId':Number(_0x657ec0[_0x925f('0x58')]['id'])});}return _0x423685;});}})[_0x925f('0x38')](respondWithResult(_0x21a50a,null))[_0x925f('0x5c')](handleError(_0x21a50a,null));};exports[_0x925f('0xc7')]=function(_0x2ef99e,_0x17588f,_0x4222e4){return db[_0x925f('0x40')]['find']({'where':{'id':_0x2ef99e['params']['id']}})[_0x925f('0x38')](handleEntityNotFound(_0x17588f,null))['then'](function(_0xcf4301){if(_0xcf4301){return _0xcf4301[_0x925f('0xc7')](_0x2ef99e[_0x925f('0x45')][_0x925f('0x71')])['then'](function(){if(_[_0x925f('0xc8')](_0x2ef99e[_0x925f('0x45')][_0x925f('0x71')])){for(var _0x4093fa=0x0;_0x4093fa<_0x2ef99e[_0x925f('0x45')]['ids'][_0x925f('0x49')];_0x4093fa+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x2ef99e['query'][_0x925f('0x71')][_0x4093fa]),'FaxAccountId':Number(_0x2ef99e[_0x925f('0x58')]['id'])});}}else{socket[_0x925f('0xc5')](_0x925f('0xc9'),{'UserId':Number(_0x2ef99e[_0x925f('0x45')]['ids']),'FaxAccountId':Number(_0x2ef99e['params']['id'])});}});}})[_0x925f('0x38')](respondWithStatusCode(_0x17588f,null))[_0x925f('0x5c')](handleError(_0x17588f,null));};exports[_0x925f('0xca')]=function(_0x28ef89,_0x2bda55,_0x52c265){var _0x514069={};var _0x2b4caf={};var _0x2d2e96;var _0x3625a3;return db[_0x925f('0x40')][_0x925f('0x6c')]({'where':{'id':_0x28ef89['params']['id']}})['then'](handleEntityNotFound(_0x2bda55,null))[_0x925f('0x38')](function(_0x31efaf){if(_0x31efaf){_0x2d2e96=_0x31efaf;_0x2b4caf[_0x925f('0x43')]=_[_0x925f('0x44')](db[_0x925f('0x7b')][_0x925f('0x41')]);_0x2b4caf[_0x925f('0x45')]=_[_0x925f('0x44')](_0x28ef89[_0x925f('0x45')]);_0x2b4caf[_0x925f('0x4f')]=_[_0x925f('0x46')](_0x2b4caf[_0x925f('0x43')],_0x2b4caf[_0x925f('0x45')]);_0x514069[_0x925f('0x47')]=_[_0x925f('0x46')](_0x2b4caf['model'],qs[_0x925f('0x48')](_0x28ef89[_0x925f('0x45')][_0x925f('0x48')]));_0x514069['attributes']=_0x514069[_0x925f('0x47')][_0x925f('0x49')]?_0x514069[_0x925f('0x47')]:_0x2b4caf['model'];_0x514069[_0x925f('0x4b')]=qs[_0x925f('0x4c')](_0x28ef89[_0x925f('0x45')]['sort']);_0x514069[_0x925f('0x4d')]=qs[_0x925f('0x4f')](_[_0x925f('0x4e')](_0x28ef89[_0x925f('0x45')],_0x2b4caf[_0x925f('0x4f')]));if(_0x28ef89[_0x925f('0x45')][_0x925f('0x6e')]){_0x514069[_0x925f('0x4d')]=_[_0x925f('0x50')](_0x514069[_0x925f('0x4d')],{'$or':_['map'](_0x514069[_0x925f('0x47')],function(_0x8ef643){var _0x200791={};_0x200791[_0x8ef643]={'$like':'%'+_0x28ef89[_0x925f('0x45')]['filter']+'%'};return _0x200791;})});}_0x514069=_[_0x925f('0x50')]({},_0x514069,_0x28ef89[_0x925f('0x54')]);return _0x2d2e96[_0x925f('0xca')](_0x514069);}})[_0x925f('0x38')](function(_0x510819){if(_0x510819){_0x3625a3=_0x510819[_0x925f('0x49')];if(!_0x28ef89[_0x925f('0x45')][_0x925f('0x4a')](_0x925f('0x6d'))){_0x514069[_0x925f('0x32')]=qs['limit'](_0x28ef89[_0x925f('0x45')]['limit']);_0x514069[_0x925f('0x30')]=qs[_0x925f('0x30')](_0x28ef89['query'][_0x925f('0x30')]);}return _0x2d2e96[_0x925f('0xca')](_0x514069);}})[_0x925f('0x38')](function(_0x21e98b){if(_0x21e98b){return _0x21e98b?{'count':_0x3625a3,'rows':_0x21e98b}:null;}})[_0x925f('0x38')](respondWithResult(_0x2bda55,null))['catch'](handleError(_0x2bda55,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index cfc8a13..c361fcd 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 _0x347d=['hasOwnProperty','hook','events','../../mysqldb','FaxAccount','setMaxListeners','remove','emit'];(function(_0x5b4ce2,_0x4ff01d){var _0x800d62=function(_0x154525){while(--_0x154525){_0x5b4ce2['push'](_0x5b4ce2['shift']());}};_0x800d62(++_0x4ff01d);}(_0x347d,0x17a));var _0xd347=function(_0x4ee336,_0x52bb8c){_0x4ee336=_0x4ee336-0x0;var _0xcff62=_0x347d[_0x4ee336];return _0xcff62;};'use strict';var EventEmitter=require(_0xd347('0x0'));var FaxAccount=require(_0xd347('0x1'))['db'][_0xd347('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xd347('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd347('0x4')};function emitEvent(_0x966e77){return function(_0x46402f,_0x1f6100,_0x38e869){FaxAccountEvents[_0xd347('0x5')](_0x966e77+':'+_0x46402f['id'],_0x46402f);FaxAccountEvents['emit'](_0x966e77,_0x46402f);_0x38e869(null);};}for(var e in events){if(events[_0xd347('0x6')](e)){var event=events[e];FaxAccount[_0xd347('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x7dff=['update','emit','hasOwnProperty','hook','exports','events','FaxAccount','save'];(function(_0x3bafe8,_0x496974){var _0x4d4ebf=function(_0x39fe36){while(--_0x39fe36){_0x3bafe8['push'](_0x3bafe8['shift']());}};_0x4d4ebf(++_0x496974);}(_0x7dff,0x75));var _0xf7df=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x7dff[_0x13ea00];return _0x1f7347;};'use strict';var EventEmitter=require(_0xf7df('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xf7df('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf7df('0x2'),'afterUpdate':_0xf7df('0x3'),'afterDestroy':'remove'};function emitEvent(_0x78853d){return function(_0xbbf1e3,_0x4c3fb8,_0x1848e2){FaxAccountEvents[_0xf7df('0x4')](_0x78853d+':'+_0xbbf1e3['id'],_0xbbf1e3);FaxAccountEvents[_0xf7df('0x4')](_0x78853d,_0xbbf1e3);_0x1848e2(null);};}for(var e in events){if(events[_0xf7df('0x5')](e)){var event=events[e];FaxAccount[_0xf7df('0x6')](e,emitEvent(event));}}module[_0xf7df('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index d249bfe..0a89b3b 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 _0x9e66=['exports','define','fax_accounts','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1fdb40,_0x51351c){var _0x281f93=function(_0x35eebe){while(--_0x35eebe){_0x1fdb40['push'](_0x1fdb40['shift']());}};_0x281f93(++_0x51351c);}(_0x9e66,0x189));var _0x69e6=function(_0x243eca,_0x5e775e){_0x243eca=_0x243eca-0x0;var _0x11ce5a=_0x9e66[_0x243eca];return _0x11ce5a;};'use strict';var _=require(_0x69e6('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x69e6('0x1'));var BPromise=require(_0x69e6('0x2'));var rp=require(_0x69e6('0x3'));var fs=require('fs');var path=require(_0x69e6('0x4'));var rimraf=require(_0x69e6('0x5'));var config=require(_0x69e6('0x6'));var attributes=require('./faxAccount.attributes');module[_0x69e6('0x7')]=function(_0x551775,_0x14085e){return _0x551775[_0x69e6('0x8')]('FaxAccount',attributes,{'tableName':_0x69e6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bef=['request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5553f4,_0x97c641){var _0x588b61=function(_0x27ae89){while(--_0x27ae89){_0x5553f4['push'](_0x5553f4['shift']());}};_0x588b61(++_0x97c641);}(_0x4bef,0xa2));var _0xf4be=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4bef[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xf4be('0x0'));var util=require(_0xf4be('0x1'));var logger=require(_0xf4be('0x2'))(_0xf4be('0x3'));var moment=require(_0xf4be('0x4'));var BPromise=require(_0xf4be('0x5'));var rp=require(_0xf4be('0x6'));var fs=require('fs');var path=require(_0xf4be('0x7'));var rimraf=require(_0xf4be('0x8'));var config=require(_0xf4be('0x9'));var attributes=require(_0xf4be('0xa'));module[_0xf4be('0xb')]=function(_0x153747,_0xc6a475){return _0x153747[_0xf4be('0xc')](_0xf4be('0xd'),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 2675132..8a0dfbc 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 _0x8ebd=['attributes','include','map','model','then','info','stringify','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','List','Contacts','FaxApplication','Applications','applications','orderBy','priority','asc','length','create','contact','FaxInteraction','find','get','autoclose','push','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','FaxAccount,\x20%s,\x20%s','message','result','GetFaxAccount','FaxAccount','findAll','options','raw','where'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0x8ebd,0xea));var _0xd8eb=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x8ebd[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0xd8eb('0x0'));var util=require(_0xd8eb('0x1'));var moment=require(_0xd8eb('0x2'));var BPromise=require('bluebird');var rs=require(_0xd8eb('0x3'));var fs=require('fs');var Redis=require(_0xd8eb('0x4'));var db=require(_0xd8eb('0x5'))['db'];var utils=require(_0xd8eb('0x6'));var logger=require(_0xd8eb('0x7'))(_0xd8eb('0x8'));var config=require('../../config/environment');var jayson=require(_0xd8eb('0x9'));var client=jayson[_0xd8eb('0xa')][_0xd8eb('0xb')]({'port':0x232c});config[_0xd8eb('0xc')]=_[_0xd8eb('0xd')](config['redis'],{'host':_0xd8eb('0xe'),'port':0x18eb});var socket=require(_0xd8eb('0xf'))(new Redis(config[_0xd8eb('0xc')]));require('./faxAccount.socket')[_0xd8eb('0x10')](socket);function respondWithRpcPromise(_0x268579,_0x331fd5,_0x226a82){return new BPromise(function(_0x4630a0,_0x383ea7){return client[_0xd8eb('0x11')](_0x268579,_0x226a82)['then'](function(_0x56589b){logger['info']('FaxAccount,\x20%s,\x20%s',_0x331fd5,'request\x20sent');logger['debug'](_0xd8eb('0x12'),_0x331fd5,_0xd8eb('0x13'),JSON['stringify'](_0x56589b));if(_0x56589b[_0xd8eb('0x14')]){if(_0x56589b['error']['code']===0x1f4){logger[_0xd8eb('0x14')](_0xd8eb('0x15'),_0x331fd5,_0x56589b[_0xd8eb('0x14')][_0xd8eb('0x16')]);return _0x383ea7(_0x56589b[_0xd8eb('0x14')][_0xd8eb('0x16')]);}logger[_0xd8eb('0x14')](_0xd8eb('0x15'),_0x331fd5,_0x56589b[_0xd8eb('0x14')][_0xd8eb('0x16')]);return _0x4630a0(_0x56589b[_0xd8eb('0x14')][_0xd8eb('0x16')]);}else{logger['info'](_0xd8eb('0x15'),_0x331fd5,'request\x20sent');_0x4630a0(_0x56589b[_0xd8eb('0x17')]['message']);}})['catch'](function(_0x376a60){logger[_0xd8eb('0x14')](_0xd8eb('0x15'),_0x331fd5,_0x376a60);_0x383ea7(_0x376a60);});});}exports[_0xd8eb('0x18')]=function(_0x392a46){var _0x296313=this;return new Promise(function(_0x279599,_0x33df54){return db[_0xd8eb('0x19')][_0xd8eb('0x1a')]({'raw':_0x392a46['options']?_0x392a46[_0xd8eb('0x1b')][_0xd8eb('0x1c')]===undefined?!![]:![]:!![],'where':_0x392a46[_0xd8eb('0x1b')]?_0x392a46[_0xd8eb('0x1b')][_0xd8eb('0x1d')]||null:null,'attributes':_0x392a46[_0xd8eb('0x1b')]?_0x392a46[_0xd8eb('0x1b')][_0xd8eb('0x1e')]||null:null,'limit':_0x392a46['options']?_0x392a46[_0xd8eb('0x1b')]['limit']||null:null,'include':_0x392a46[_0xd8eb('0x1b')]?_0x392a46[_0xd8eb('0x1b')][_0xd8eb('0x1f')]?_['map'](_0x392a46[_0xd8eb('0x1b')][_0xd8eb('0x1f')],function(_0x3dec2f){return{'model':db[_0x3dec2f['model']],'as':_0x3dec2f['as'],'attributes':_0x3dec2f[_0xd8eb('0x1e')],'include':_0x3dec2f[_0xd8eb('0x1f')]?_[_0xd8eb('0x20')](_0x3dec2f['include'],function(_0xd641af){return{'model':db[_0xd641af[_0xd8eb('0x21')]],'as':_0xd641af['as'],'attributes':_0xd641af['attributes'],'include':_0xd641af[_0xd8eb('0x1f')]?_['map'](_0xd641af['include'],function(_0x2d2c61){return{'model':db[_0x2d2c61[_0xd8eb('0x21')]],'as':_0x2d2c61['as'],'attributes':_0x2d2c61[_0xd8eb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd8eb('0x22')](function(_0xb8a454){logger[_0xd8eb('0x23')]('GetFaxAccount',_0x392a46);logger['debug'](_0xd8eb('0x18'),_0x392a46,JSON[_0xd8eb('0x24')](_0xb8a454));_0x279599(_0xb8a454);})['catch'](function(_0x429e33){logger[_0xd8eb('0x14')](_0xd8eb('0x18'),_0x429e33['message'],_0x392a46);_0x33df54(_0x296313['error'](0x1f4,_0x429e33[_0xd8eb('0x16')]));});});};exports['NotifyFaxAccount']=function(_0x1f79b7,_0x4cd20b,_0x3d4cff){var _0x50502a=this;return new Promise(function(_0x192177,_0xfeab93){var _0x4af316={'body':_0x1f79b7[_0xd8eb('0x25')],'channel':_0xd8eb('0x26')};var _0x24c807=[];var _0x4bcaee=[];var _0x136423={};return db[_0xd8eb('0x27')][_0xd8eb('0x28')]()[_0xd8eb('0x22')](function(_0x3489c0){if(!_0x3489c0){throw new db[(_0xd8eb('0x29'))][(_0xd8eb('0x2a'))](_0xd8eb('0x2b'));}_0x24c807=_[_0xd8eb('0x2c')](_[_0xd8eb('0x2d')](_0x3489c0),[_0xd8eb('0x2e'),_0xd8eb('0x2f')]);_0x4bcaee=_[_0xd8eb('0x2c')](_[_0xd8eb('0x2d')](_0x3489c0),[_0xd8eb('0x2e'),_0xd8eb('0x2f'),'CompanyId',_0xd8eb('0x30')]);if(_0x1f79b7[_0xd8eb('0x25')]['id']){delete _0x1f79b7[_0xd8eb('0x25')]['id'];}if(_[_0xd8eb('0x31')](_0x1f79b7[_0xd8eb('0x25')][_0xd8eb('0x32')])){throw new db[(_0xd8eb('0x29'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xd8eb('0x31')](_0x1f79b7[_0xd8eb('0x25')][_0xd8eb('0x25')])||_0x1f79b7[_0xd8eb('0x25')][_0xd8eb('0x25')]===''){throw new db[(_0xd8eb('0x29'))]['ValidationError'](_0xd8eb('0x33'));}if(_[_0xd8eb('0x31')](_0x1f79b7[_0xd8eb('0x25')][_0xd8eb('0x34')])){throw new db[(_0xd8eb('0x29'))][(_0xd8eb('0x2a'))](_0xd8eb('0x35')+_0x4bcaee);}if(!_[_0xd8eb('0x36')](_0x4bcaee,_0x1f79b7[_0xd8eb('0x25')][_0xd8eb('0x34')])){throw new db[(_0xd8eb('0x29'))][(_0xd8eb('0x2a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4bcaee);}_0x136423[_0x1f79b7['body'][_0xd8eb('0x34')]]=_0x1f79b7[_0xd8eb('0x25')][_0xd8eb('0x32')];})[_0xd8eb('0x22')](function(){return db['FaxAccount']['find']({'where':{'id':_0x1f79b7[_0xd8eb('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0xd8eb('0x38'),'include':[{'model':db[_0xd8eb('0x27')],'as':_0xd8eb('0x39'),'where':_0x136423,'limit':0x1,'order':[[_0xd8eb('0x2f'),'DESC']]}]},{'model':db[_0xd8eb('0x3a')],'as':_0xd8eb('0x3b')}]});})['then'](function(_0x31a2f2){if(_0x31a2f2&&_0x31a2f2[_0xd8eb('0x38')]){var _0x4d1f60=_0x31a2f2['get']({'plain':!![]});_0x4af316[_0xd8eb('0x37')]=_0x4d1f60;_0x4af316[_0xd8eb('0x3c')]=_0x4d1f60[_0xd8eb('0x3b')];_0x4af316['list']=_0x4d1f60['List'];_0x4af316[_0xd8eb('0x3c')]=_[_0xd8eb('0x3d')](_0x4af316[_0xd8eb('0x3c')],[_0xd8eb('0x3e')],[_0xd8eb('0x3f')]);if(_0x4af316[_0xd8eb('0x37')][_0xd8eb('0x3b')]){delete _0x4af316['account']['Applications'];}if(_0x4af316['account'][_0xd8eb('0x38')]&&_0x4af316[_0xd8eb('0x37')]['List'][_0xd8eb('0x39')][_0xd8eb('0x40')]){return _0x4af316['account'][_0xd8eb('0x38')][_0xd8eb('0x39')][0x0];}var _0x2dcde2=_['defaults'](_0x1f79b7[_0xd8eb('0x25')],{'firstName':_0x1f79b7['body'][_0xd8eb('0x32')],'ListId':_0x4d1f60['ListId']});_0x2dcde2[_0x1f79b7['body'][_0xd8eb('0x34')]]=_0x1f79b7[_0xd8eb('0x25')][_0xd8eb('0x32')];return db[_0xd8eb('0x27')][_0xd8eb('0x41')](_0x2dcde2,{'fields':_0x24c807,'raw':!![]});}})['then'](function(_0x32cdf0){_0x4af316[_0xd8eb('0x42')]=_0x32cdf0;if(_0x32cdf0){var _0x26e481={'ContactId':_0x32cdf0['id'],'FaxAccountId':_0x1f79b7[_0xd8eb('0x37')]['id'],'fax':_0x32cdf0['fax']};return db[_0xd8eb('0x43')][_0xd8eb('0x44')]({'where':{'ContactId':_0x32cdf0['id'],'closed':![],'FaxAccountId':_0x1f79b7[_0xd8eb('0x37')]['id']}})['then'](function(_0xdf3e1){if(_0xdf3e1){return[_0xdf3e1,![]];}return db[_0xd8eb('0x43')][_0xd8eb('0x41')](_0x26e481)[_0xd8eb('0x22')](function(_0x489b63){return[_0x489b63,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x5635db,_0x3621bf){var _0x16adf8=_0x5635db[_0xd8eb('0x45')]({'plain':!![]});if(_0x3621bf){if(_0x4af316[_0xd8eb('0x37')][_0xd8eb('0x46')]){_0x4af316[_0xd8eb('0x3c')][_0xd8eb('0x47')]({'id':0x0,'priority':_0x4af316[_0xd8eb('0x3c')][_0xd8eb('0x40')]+0x1,'app':_0xd8eb('0x48'),'appdata':_0xd8eb('0x49'),'interval':_0xd8eb('0x4a')});}_0x16adf8['created']=!![];}else{_0x16adf8[_0xd8eb('0x4b')]=![];}_0x4af316['interaction']=_0x16adf8;return db[_0xd8eb('0x4c')][_0xd8eb('0x41')]({'body':_0x1f79b7['body'][_0xd8eb('0x25')],'FaxAccountId':_0x1f79b7['account']['id'],'FaxInteractionId':_0x5635db['id'],'direction':'in','ContactId':_0x5635db[_0xd8eb('0x4d')],'AttachmentId':_0x1f79b7[_0xd8eb('0x25')][_0xd8eb('0x4e')]});})['then'](function(_0x1df0d3){_0x4af316['message']=_0x1df0d3;if(_0x4af316[_0xd8eb('0x4f')]['UserId']){return db['User'][_0xd8eb('0x44')]({'attributes':['id',_0xd8eb('0x50')],'where':{'id':_0x4af316['interaction'][_0xd8eb('0x51')]}})[_0xd8eb('0x22')](function(_0x4b6bc4){if(_0x4b6bc4){_0x4af316[_0xd8eb('0x3c')][_0xd8eb('0x52')]({'id':0x0,'priority':0x0,'app':_0xd8eb('0x53'),'appdata':_0x4b6bc4[_0xd8eb('0x50')]+','+(_0x4af316[_0xd8eb('0x37')][_0xd8eb('0x54')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xd8eb('0x55'),_0xd8eb('0x56'),_0x4af316);});}return respondWithRpcPromise(_0xd8eb('0x55'),_0xd8eb('0x56'),_0x4af316);})[_0xd8eb('0x22')](function(_0x324b69){_0x192177(_0x324b69);})[_0xd8eb('0x57')](function(_0x628fa8){_0xfeab93(_0x50502a[_0xd8eb('0x14')](0x1f4,_0x628fa8[_0xd8eb('0x16')]));});});}; \ No newline at end of file +var _0x1d1d=['message','result','catch','GetFaxAccount','options','raw','map','include','model','attributes','then','stringify','NotifyFaxAccount','fax','CmContact','describe','ValidationError','difference','keys','createdAt','updatedAt','ListId','body','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','CmList','List','Contacts','DESC','Applications','get','account','applications','orderBy','asc','length','from','FaxInteraction','find','Contact\x20not\x20found','spread','autoclose','created','interaction','create','ContactId','UserId','User','name','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x5f41a9,_0x5347a8){var _0x4f68fb=function(_0x7cb0e9){while(--_0x7cb0e9){_0x5f41a9['push'](_0x5f41a9['shift']());}};_0x4f68fb(++_0x5347a8);}(_0x1d1d,0x8c));var _0xd1d1=function(_0x393788,_0x3492c4){_0x393788=_0x393788-0x0;var _0x3ca137=_0x1d1d[_0x393788];return _0x3ca137;};'use strict';var _=require(_0xd1d1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd1d1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd1d1('0x2'));var db=require(_0xd1d1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd1d1('0x4'))(_0xd1d1('0x5'));var config=require(_0xd1d1('0x6'));var jayson=require(_0xd1d1('0x7'));var client=jayson[_0xd1d1('0x8')][_0xd1d1('0x9')]({'port':0x232c});config[_0xd1d1('0xa')]=_[_0xd1d1('0xb')](config[_0xd1d1('0xa')],{'host':_0xd1d1('0xc'),'port':0x18eb});var socket=require(_0xd1d1('0xd'))(new Redis(config[_0xd1d1('0xa')]));require('./faxAccount.socket')[_0xd1d1('0xe')](socket);function respondWithRpcPromise(_0x5dacd5,_0x457e27,_0x1a0b70){return new BPromise(function(_0x1ac82e,_0x4cf237){return client[_0xd1d1('0xf')](_0x5dacd5,_0x1a0b70)['then'](function(_0x337f23){logger[_0xd1d1('0x10')](_0xd1d1('0x11'),_0x457e27,'request\x20sent');logger[_0xd1d1('0x12')](_0xd1d1('0x13'),_0x457e27,_0xd1d1('0x14'),JSON['stringify'](_0x337f23));if(_0x337f23[_0xd1d1('0x15')]){if(_0x337f23[_0xd1d1('0x15')]['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x457e27,_0x337f23[_0xd1d1('0x15')]['message']);return _0x4cf237(_0x337f23['error'][_0xd1d1('0x16')]);}logger[_0xd1d1('0x15')](_0xd1d1('0x11'),_0x457e27,_0x337f23[_0xd1d1('0x15')]['message']);return _0x1ac82e(_0x337f23[_0xd1d1('0x15')][_0xd1d1('0x16')]);}else{logger['info'](_0xd1d1('0x11'),_0x457e27,_0xd1d1('0x14'));_0x1ac82e(_0x337f23[_0xd1d1('0x17')]['message']);}})[_0xd1d1('0x18')](function(_0x1bf11e){logger[_0xd1d1('0x15')](_0xd1d1('0x11'),_0x457e27,_0x1bf11e);_0x4cf237(_0x1bf11e);});});}exports[_0xd1d1('0x19')]=function(_0x2b6189){var _0x1babaa=this;return new Promise(function(_0x14a341,_0x1d77cd){return db['FaxAccount']['findAll']({'raw':_0x2b6189[_0xd1d1('0x1a')]?_0x2b6189[_0xd1d1('0x1a')][_0xd1d1('0x1b')]===undefined?!![]:![]:!![],'where':_0x2b6189[_0xd1d1('0x1a')]?_0x2b6189[_0xd1d1('0x1a')]['where']||null:null,'attributes':_0x2b6189[_0xd1d1('0x1a')]?_0x2b6189[_0xd1d1('0x1a')]['attributes']||null:null,'limit':_0x2b6189[_0xd1d1('0x1a')]?_0x2b6189[_0xd1d1('0x1a')]['limit']||null:null,'include':_0x2b6189[_0xd1d1('0x1a')]?_0x2b6189[_0xd1d1('0x1a')]['include']?_[_0xd1d1('0x1c')](_0x2b6189[_0xd1d1('0x1a')][_0xd1d1('0x1d')],function(_0x12c81c){return{'model':db[_0x12c81c[_0xd1d1('0x1e')]],'as':_0x12c81c['as'],'attributes':_0x12c81c[_0xd1d1('0x1f')],'include':_0x12c81c['include']?_[_0xd1d1('0x1c')](_0x12c81c[_0xd1d1('0x1d')],function(_0x24ce0b){return{'model':db[_0x24ce0b[_0xd1d1('0x1e')]],'as':_0x24ce0b['as'],'attributes':_0x24ce0b[_0xd1d1('0x1f')],'include':_0x24ce0b[_0xd1d1('0x1d')]?_[_0xd1d1('0x1c')](_0x24ce0b[_0xd1d1('0x1d')],function(_0x384a3a){return{'model':db[_0x384a3a[_0xd1d1('0x1e')]],'as':_0x384a3a['as'],'attributes':_0x384a3a[_0xd1d1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd1d1('0x20')](function(_0x14dba6){logger[_0xd1d1('0x10')](_0xd1d1('0x19'),_0x2b6189);logger[_0xd1d1('0x12')](_0xd1d1('0x19'),_0x2b6189,JSON[_0xd1d1('0x21')](_0x14dba6));_0x14a341(_0x14dba6);})[_0xd1d1('0x18')](function(_0x500e46){logger[_0xd1d1('0x15')](_0xd1d1('0x19'),_0x500e46[_0xd1d1('0x16')],_0x2b6189);_0x1d77cd(_0x1babaa[_0xd1d1('0x15')](0x1f4,_0x500e46[_0xd1d1('0x16')]));});});};exports[_0xd1d1('0x22')]=function(_0x236ab7,_0x320ca6,_0x300164){var _0x3e2acf=this;return new Promise(function(_0x28d7d8,_0x4f50fa){var _0x20db40={'body':_0x236ab7['body'],'channel':_0xd1d1('0x23')};var _0x288818=[];var _0x2a83c4=[];var _0x1c318d={};return db[_0xd1d1('0x24')][_0xd1d1('0x25')]()['then'](function(_0x171f1b){if(!_0x171f1b){throw new db['Sequelize'][(_0xd1d1('0x26'))]('no\x20available\x20attributes');}_0x288818=_[_0xd1d1('0x27')](_[_0xd1d1('0x28')](_0x171f1b),[_0xd1d1('0x29'),'updatedAt']);_0x2a83c4=_[_0xd1d1('0x27')](_[_0xd1d1('0x28')](_0x171f1b),[_0xd1d1('0x29'),_0xd1d1('0x2a'),'CompanyId',_0xd1d1('0x2b')]);if(_0x236ab7[_0xd1d1('0x2c')]['id']){delete _0x236ab7[_0xd1d1('0x2c')]['id'];}if(_[_0xd1d1('0x2d')](_0x236ab7[_0xd1d1('0x2c')]['from'])){throw new db[(_0xd1d1('0x2e'))][(_0xd1d1('0x26'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x236ab7['body'][_0xd1d1('0x2c')])||_0x236ab7[_0xd1d1('0x2c')]['body']===''){throw new db['Sequelize'][(_0xd1d1('0x26'))](_0xd1d1('0x2f'));}if(_['isNil'](_0x236ab7['body'][_0xd1d1('0x30')])){throw new db['Sequelize']['ValidationError'](_0xd1d1('0x31')+_0x2a83c4);}if(!_['includes'](_0x2a83c4,_0x236ab7[_0xd1d1('0x2c')][_0xd1d1('0x30')])){throw new db['Sequelize'][(_0xd1d1('0x26'))](_0xd1d1('0x32')+_0x2a83c4);}_0x1c318d[_0x236ab7[_0xd1d1('0x2c')]['mapKey']]=_0x236ab7[_0xd1d1('0x2c')]['from'];})[_0xd1d1('0x20')](function(){return db[_0xd1d1('0x33')]['find']({'where':{'id':_0x236ab7['account']['id']},'include':[{'model':db[_0xd1d1('0x34')],'as':_0xd1d1('0x35'),'include':[{'model':db['CmContact'],'as':_0xd1d1('0x36'),'where':_0x1c318d,'limit':0x1,'order':[[_0xd1d1('0x2a'),_0xd1d1('0x37')]]}]},{'model':db['FaxApplication'],'as':_0xd1d1('0x38')}]});})[_0xd1d1('0x20')](function(_0x1a9dd7){if(_0x1a9dd7&&_0x1a9dd7['List']){var _0x14ce1f=_0x1a9dd7[_0xd1d1('0x39')]({'plain':!![]});_0x20db40[_0xd1d1('0x3a')]=_0x14ce1f;_0x20db40[_0xd1d1('0x3b')]=_0x14ce1f['Applications'];_0x20db40['list']=_0x14ce1f[_0xd1d1('0x35')];_0x20db40[_0xd1d1('0x3b')]=_[_0xd1d1('0x3c')](_0x20db40[_0xd1d1('0x3b')],['priority'],[_0xd1d1('0x3d')]);if(_0x20db40['account'][_0xd1d1('0x38')]){delete _0x20db40[_0xd1d1('0x3a')][_0xd1d1('0x38')];}if(_0x20db40[_0xd1d1('0x3a')][_0xd1d1('0x35')]&&_0x20db40['account']['List'][_0xd1d1('0x36')][_0xd1d1('0x3e')]){return _0x20db40['account']['List']['Contacts'][0x0];}var _0x39e239=_[_0xd1d1('0xb')](_0x236ab7[_0xd1d1('0x2c')],{'firstName':_0x236ab7[_0xd1d1('0x2c')][_0xd1d1('0x3f')],'ListId':_0x14ce1f['ListId']});_0x39e239[_0x236ab7[_0xd1d1('0x2c')]['mapKey']]=_0x236ab7[_0xd1d1('0x2c')][_0xd1d1('0x3f')];return db['CmContact']['create'](_0x39e239,{'fields':_0x288818,'raw':!![]});}})['then'](function(_0xc88762){_0x20db40['contact']=_0xc88762;if(_0xc88762){var _0x496626={'ContactId':_0xc88762['id'],'FaxAccountId':_0x236ab7['account']['id'],'fax':_0xc88762[_0xd1d1('0x23')]};return db[_0xd1d1('0x40')][_0xd1d1('0x41')]({'where':{'ContactId':_0xc88762['id'],'closed':![],'FaxAccountId':_0x236ab7[_0xd1d1('0x3a')]['id']}})[_0xd1d1('0x20')](function(_0xcd0ebe){if(_0xcd0ebe){return[_0xcd0ebe,![]];}return db['FaxInteraction']['create'](_0x496626)[_0xd1d1('0x20')](function(_0x2cf228){return[_0x2cf228,!![]];});});}else{throw new Error(_0xd1d1('0x42'));}})[_0xd1d1('0x43')](function(_0x297d45,_0x15588d){var _0x1d39f6=_0x297d45[_0xd1d1('0x39')]({'plain':!![]});if(_0x15588d){if(_0x20db40['account'][_0xd1d1('0x44')]){_0x20db40[_0xd1d1('0x3b')]['push']({'id':0x0,'priority':_0x20db40[_0xd1d1('0x3b')][_0xd1d1('0x3e')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0x1d39f6['created']=!![];}else{_0x1d39f6[_0xd1d1('0x45')]=![];}_0x20db40[_0xd1d1('0x46')]=_0x1d39f6;return db['FaxMessage'][_0xd1d1('0x47')]({'body':_0x236ab7['body'][_0xd1d1('0x2c')],'FaxAccountId':_0x236ab7[_0xd1d1('0x3a')]['id'],'FaxInteractionId':_0x297d45['id'],'direction':'in','ContactId':_0x297d45[_0xd1d1('0x48')],'AttachmentId':_0x236ab7[_0xd1d1('0x2c')]['AttachmentId']});})[_0xd1d1('0x20')](function(_0x2e238d){_0x20db40[_0xd1d1('0x16')]=_0x2e238d;if(_0x20db40[_0xd1d1('0x46')][_0xd1d1('0x49')]){return db[_0xd1d1('0x4a')][_0xd1d1('0x41')]({'attributes':['id',_0xd1d1('0x4b')],'where':{'id':_0x20db40['interaction'][_0xd1d1('0x49')]}})[_0xd1d1('0x20')](function(_0x98717f){if(_0x98717f){_0x20db40[_0xd1d1('0x3b')]['unshift']({'id':0x0,'priority':0x0,'app':_0xd1d1('0x4c'),'appdata':_0x98717f[_0xd1d1('0x4b')]+','+(_0x20db40[_0xd1d1('0x3a')][_0xd1d1('0x4d')]||0xa),'interval':_0xd1d1('0x4e')});}return respondWithRpcPromise(_0xd1d1('0x4f'),'startRouting',_0x20db40);});}return respondWithRpcPromise(_0xd1d1('0x4f'),_0xd1d1('0x50'),_0x20db40);})[_0xd1d1('0x20')](function(_0x55545f){_0x28d7d8(_0x55545f);})['catch'](function(_0x2fd6c4){_0x4f50fa(_0x3e2acf[_0xd1d1('0x15')](0x1f4,_0x2fd6c4[_0xd1d1('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 403f58b..6c90351 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 _0xbcae=['update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save'];(function(_0x4fa438,_0x1f15a7){var _0x4e3958=function(_0x28f510){while(--_0x28f510){_0x4fa438['push'](_0x4fa438['shift']());}};_0x4e3958(++_0x1f15a7);}(_0xbcae,0x16e));var _0xebca=function(_0x3befd1,_0xca3e6a){_0x3befd1=_0x3befd1-0x0;var _0x4446d7=_0xbcae[_0x3befd1];return _0x4446d7;};'use strict';var FaxAccountEvents=require(_0xebca('0x0'));var events=[_0xebca('0x1'),'remove',_0xebca('0x2')];function createListener(_0x3ac6ab,_0x1319f6){return function(_0x6666b8){_0x1319f6[_0xebca('0x3')](_0x3ac6ab,_0x6666b8);};}function removeListener(_0x46963e,_0x489f5d){return function(){FaxAccountEvents[_0xebca('0x4')](_0x46963e,_0x489f5d);};}exports[_0xebca('0x5')]=function(_0x143a0d){for(var _0x1837ba=0x0,_0x432a5e=events[_0xebca('0x6')];_0x1837ba<_0x432a5e;_0x1837ba++){var _0x3f7d92=events[_0x1837ba];var _0x347bb8=createListener(_0xebca('0x7')+_0x3f7d92,_0x143a0d);FaxAccountEvents['on'](_0x3f7d92,_0x347bb8);}}; \ No newline at end of file +var _0xc5c0=['update','emit','removeListener','register','./faxAccount.events','remove'];(function(_0x3a8376,_0x3a22eb){var _0x3f8326=function(_0x1a5a6b){while(--_0x1a5a6b){_0x3a8376['push'](_0x3a8376['shift']());}};_0x3f8326(++_0x3a22eb);}(_0xc5c0,0x94));var _0x0c5c=function(_0x1e7a82,_0x2d7f5d){_0x1e7a82=_0x1e7a82-0x0;var _0x2a4b67=_0xc5c0[_0x1e7a82];return _0x2a4b67;};'use strict';var FaxAccountEvents=require(_0x0c5c('0x0'));var events=['save',_0x0c5c('0x1'),_0x0c5c('0x2')];function createListener(_0x556851,_0x2b4e0){return function(_0xf7a7ab){_0x2b4e0[_0x0c5c('0x3')](_0x556851,_0xf7a7ab);};}function removeListener(_0x3f1545,_0x5e7650){return function(){FaxAccountEvents[_0x0c5c('0x4')](_0x3f1545,_0x5e7650);};}exports[_0x0c5c('0x5')]=function(_0xb252a1){for(var _0x2c756f=0x0,_0x1b35ab=events['length'];_0x2c756f<_0x1b35ab;_0x2c756f++){var _0x547d47=events[_0x2c756f];var _0x3cd9a5=createListener('faxAccount:'+_0x547d47,_0xb252a1);FaxAccountEvents['on'](_0x547d47,_0x3cd9a5);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 088bf2c..adac86a 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0xed62cc,_0x112282){var _0x45f280=function(_0x4a86da){while(--_0x4a86da){_0xed62cc['push'](_0xed62cc['shift']());}};_0x45f280(++_0x112282);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x5e4730,_0x28dfcc){var _0x20fc9b=function(_0x526217){while(--_0x526217){_0x5e4730['push'](_0x5e4730['shift']());}};_0x20fc9b(++_0x28dfcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 240df94..5ee1e87 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 _0x7228=['TEXT','STRING','*,*,*,*','INTEGER','noop'];(function(_0x157429,_0x4fb739){var _0x2c3c83=function(_0x2bd244){while(--_0x2bd244){_0x157429['push'](_0x157429['shift']());}};_0x2c3c83(++_0x4fb739);}(_0x7228,0x7b));var _0x8722=function(_0x3d64f8,_0x54568b){_0x3d64f8=_0x3d64f8-0x0;var _0x18b219=_0x7228[_0x3d64f8];return _0x18b219;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x8722('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8722('0x1')},'appdata':{'type':Sequelize[_0x8722('0x2')]()},'description':{'type':Sequelize[_0x8722('0x3')]},'interval':{'type':Sequelize[_0x8722('0x3')],'defaultValue':_0x8722('0x4')}}; \ No newline at end of file +var _0x48f1=['TEXT','INTEGER','STRING','noop'];(function(_0x5c8827,_0x5bc5d7){var _0x50ffd5=function(_0x4121bc){while(--_0x4121bc){_0x5c8827['push'](_0x5c8827['shift']());}};_0x50ffd5(++_0x5bc5d7);}(_0x48f1,0x14d));var _0x148f=function(_0xeb7580,_0x5cda92){_0xeb7580=_0xeb7580-0x0;var _0x3b53d3=_0x48f1[_0xeb7580];return _0x3b53d3;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x148f('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x148f('0x1')],'allowNull':![],'defaultValue':_0x148f('0x2')},'appdata':{'type':Sequelize[_0x148f('0x3')]()},'description':{'type':Sequelize[_0x148f('0x1')]},'interval':{'type':Sequelize[_0x148f('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 3889605..c8eb4d5 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 _0x3852=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','destroy','error','stack','name','map','FaxApplication','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','then','show','params','includeAll','find','create','body','catch','eml-format','rimraf','zip-dir'];(function(_0x23b5ad,_0x121592){var _0x42a0eb=function(_0x30d395){while(--_0x30d395){_0x23b5ad['push'](_0x23b5ad['shift']());}};_0x42a0eb(++_0x121592);}(_0x3852,0x1ad));var _0x2385=function(_0x2fa301,_0x20a0dd){_0x2fa301=_0x2fa301-0x0;var _0x2b84d8=_0x3852[_0x2fa301];return _0x2b84d8;};'use strict';var emlformat=require(_0x2385('0x0'));var rimraf=require(_0x2385('0x1'));var zipdir=require(_0x2385('0x2'));var jsonpatch=require(_0x2385('0x3'));var rp=require(_0x2385('0x4'));var moment=require(_0x2385('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2385('0x6'));var util=require(_0x2385('0x7'));var path=require(_0x2385('0x8'));var sox=require(_0x2385('0x9'));var csv=require(_0x2385('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2385('0xb'));var _=require(_0x2385('0xc'));var squel=require('squel');var crypto=require(_0x2385('0xd'));var jsforce=require(_0x2385('0xe'));var deskjs=require(_0x2385('0xf'));var toCsv=require(_0x2385('0xa'));var querystring=require(_0x2385('0x10'));var Papa=require('papaparse');var Redis=require(_0x2385('0x11'));var authService=require(_0x2385('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2385('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2385('0x14'))(_0x2385('0x15'));var utils=require(_0x2385('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2385('0x17'));var db=require(_0x2385('0x18'))['db'];function respondWithStatusCode(_0x28744b,_0x41cb54){_0x41cb54=_0x41cb54||0xcc;return function(_0x33196e){if(_0x33196e){return _0x28744b[_0x2385('0x19')](_0x41cb54);}return _0x28744b['status'](_0x41cb54)[_0x2385('0x1a')]();};}function respondWithResult(_0x319182,_0x1030f6){_0x1030f6=_0x1030f6||0xc8;return function(_0x16be3c){if(_0x16be3c){return _0x319182[_0x2385('0x1b')](_0x1030f6)[_0x2385('0x1c')](_0x16be3c);}};}function respondWithFilteredResult(_0xa0f218,_0x6866da){return function(_0x58714b){if(_0x58714b){var _0x1c8298=typeof _0x6866da['offset']==='undefined'&&typeof _0x6866da[_0x2385('0x1d')]===_0x2385('0x1e');var _0xd80626=_0x58714b[_0x2385('0x1f')];var _0x5cd656=_0x1c8298?0x0:_0x6866da[_0x2385('0x20')];var _0x8297da=_0x1c8298?_0x58714b[_0x2385('0x1f')]:_0x6866da[_0x2385('0x20')]+_0x6866da['limit'];var _0x5b8823;if(_0x8297da>=_0xd80626){_0x8297da=_0xd80626;_0x5b8823=0xc8;}else{_0x5b8823=0xce;}_0xa0f218[_0x2385('0x1b')](_0x5b8823);return _0xa0f218['set'](_0x2385('0x21'),_0x5cd656+'-'+_0x8297da+'/'+_0xd80626)[_0x2385('0x1c')](_0x58714b);}return null;};}function patchUpdates(_0x28bc3b){return function(_0x4f7f1a){try{jsonpatch[_0x2385('0x22')](_0x4f7f1a,_0x28bc3b,!![]);}catch(_0x551356){return BPromise[_0x2385('0x23')](_0x551356);}return _0x4f7f1a[_0x2385('0x24')]();};}function saveUpdates(_0x26d8b7,_0x4bd31c){return function(_0x7d2e5f){if(_0x7d2e5f){return _0x7d2e5f[_0x2385('0x25')](_0x26d8b7)['then'](function(_0x1b682e){return _0x1b682e;});}return null;};}function removeEntity(_0xf3f12b,_0x378c01){return function(_0x34b459){if(_0x34b459){return _0x34b459[_0x2385('0x26')]()['then'](function(){_0xf3f12b[_0x2385('0x1b')](0xcc)[_0x2385('0x1a')]();});}};}function handleEntityNotFound(_0x9f0b14,_0x5a0b3d){return function(_0x295bd0){if(!_0x295bd0){_0x9f0b14[_0x2385('0x19')](0x194);}return _0x295bd0;};}function handleError(_0x58f6e5,_0x2714c9){_0x2714c9=_0x2714c9||0x1f4;return function(_0x218d38){logger[_0x2385('0x27')](_0x218d38[_0x2385('0x28')]);if(_0x218d38[_0x2385('0x29')]){delete _0x218d38[_0x2385('0x29')];}_0x58f6e5[_0x2385('0x1b')](_0x2714c9)['send'](_0x218d38);};}exports['index']=function(_0x4a115e,_0x544d7c){var _0x4b31fa={},_0x1f75c5={},_0x1acca5={'count':0x0,'rows':[]};var _0x516fbe=_[_0x2385('0x2a')](db[_0x2385('0x2b')][_0x2385('0x2c')],function(_0x151aca){return{'name':_0x151aca['fieldName'],'type':_0x151aca['type'][_0x2385('0x2d')]};});_0x1f75c5[_0x2385('0x2e')]=_[_0x2385('0x2a')](_0x516fbe,_0x2385('0x29'));_0x1f75c5[_0x2385('0x2f')]=_[_0x2385('0x30')](_0x4a115e['query']);_0x1f75c5[_0x2385('0x31')]=_[_0x2385('0x32')](_0x1f75c5[_0x2385('0x2e')],_0x1f75c5[_0x2385('0x2f')]);_0x4b31fa[_0x2385('0x33')]=_[_0x2385('0x32')](_0x1f75c5[_0x2385('0x2e')],qs['fields'](_0x4a115e['query'][_0x2385('0x34')]));_0x4b31fa[_0x2385('0x33')]=_0x4b31fa[_0x2385('0x33')][_0x2385('0x35')]?_0x4b31fa[_0x2385('0x33')]:_0x1f75c5[_0x2385('0x2e')];if(!_0x4a115e['query'][_0x2385('0x36')]('nolimit')){_0x4b31fa[_0x2385('0x1d')]=qs['limit'](_0x4a115e[_0x2385('0x2f')]['limit']);_0x4b31fa[_0x2385('0x20')]=qs[_0x2385('0x20')](_0x4a115e[_0x2385('0x2f')][_0x2385('0x20')]);}_0x4b31fa['order']=qs['sort'](_0x4a115e[_0x2385('0x2f')]['sort']);_0x4b31fa[_0x2385('0x37')]=qs[_0x2385('0x31')](_[_0x2385('0x38')](_0x4a115e[_0x2385('0x2f')],_0x1f75c5[_0x2385('0x31')]),_0x516fbe);if(_0x4a115e[_0x2385('0x2f')][_0x2385('0x39')]){_0x4b31fa['where']=_[_0x2385('0x3a')](_0x4b31fa[_0x2385('0x37')],{'$or':_[_0x2385('0x2a')](_0x516fbe,function(_0x33e894){if(_0x33e894[_0x2385('0x3b')]!==_0x2385('0x3c')){var _0x357f14={};_0x357f14[_0x33e894[_0x2385('0x29')]]={'$like':'%'+_0x4a115e[_0x2385('0x2f')][_0x2385('0x39')]+'%'};return _0x357f14;}})});}_0x4b31fa=_['merge']({},_0x4b31fa,_0x4a115e[_0x2385('0x3d')]);var _0x278383={'where':_0x4b31fa[_0x2385('0x37')]};return db[_0x2385('0x2b')][_0x2385('0x1f')](_0x278383)['then'](function(_0x439b65){_0x1acca5['count']=_0x439b65;if(_0x4a115e[_0x2385('0x2f')]['includeAll']){_0x4b31fa['include']=[{'all':!![]}];}return db['FaxApplication'][_0x2385('0x3e')](_0x4b31fa);})['then'](function(_0x150c46){_0x1acca5[_0x2385('0x3f')]=_0x150c46;return _0x1acca5;})[_0x2385('0x40')](respondWithFilteredResult(_0x544d7c,_0x4b31fa))['catch'](handleError(_0x544d7c,null));};exports[_0x2385('0x41')]=function(_0x360b6a,_0x54dbc9){var _0x1f4e09={'raw':!![],'where':{'id':_0x360b6a[_0x2385('0x42')]['id']}},_0x1846ea={};_0x1846ea[_0x2385('0x2e')]=_[_0x2385('0x30')](db[_0x2385('0x2b')]['rawAttributes']);_0x1846ea[_0x2385('0x2f')]=_[_0x2385('0x30')](_0x360b6a['query']);_0x1846ea['filters']=_['intersection'](_0x1846ea['model'],_0x1846ea['query']);_0x1f4e09[_0x2385('0x33')]=_[_0x2385('0x32')](_0x1846ea[_0x2385('0x2e')],qs[_0x2385('0x34')](_0x360b6a[_0x2385('0x2f')]['fields']));_0x1f4e09['attributes']=_0x1f4e09[_0x2385('0x33')][_0x2385('0x35')]?_0x1f4e09[_0x2385('0x33')]:_0x1846ea[_0x2385('0x2e')];if(_0x360b6a[_0x2385('0x2f')][_0x2385('0x43')]){_0x1f4e09['include']=[{'all':!![]}];}_0x1f4e09=_[_0x2385('0x3a')]({},_0x1f4e09,_0x360b6a[_0x2385('0x3d')]);return db[_0x2385('0x2b')][_0x2385('0x44')](_0x1f4e09)[_0x2385('0x40')](handleEntityNotFound(_0x54dbc9,null))['then'](respondWithResult(_0x54dbc9,null))['catch'](handleError(_0x54dbc9,null));};exports[_0x2385('0x45')]=function(_0x34a316,_0xaa32d8){return db[_0x2385('0x2b')][_0x2385('0x45')](_0x34a316[_0x2385('0x46')],{})[_0x2385('0x40')](respondWithResult(_0xaa32d8,0xc9))['catch'](handleError(_0xaa32d8,null));};exports[_0x2385('0x25')]=function(_0x56e694,_0x2b43cf){if(_0x56e694[_0x2385('0x46')]['id']){delete _0x56e694[_0x2385('0x46')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x56e694[_0x2385('0x42')]['id']}})[_0x2385('0x40')](handleEntityNotFound(_0x2b43cf,null))[_0x2385('0x40')](saveUpdates(_0x56e694[_0x2385('0x46')],null))[_0x2385('0x40')](respondWithResult(_0x2b43cf,null))['catch'](handleError(_0x2b43cf,null));};exports['destroy']=function(_0x320dd5,_0x54cedf){return db[_0x2385('0x2b')][_0x2385('0x44')]({'where':{'id':_0x320dd5['params']['id']}})[_0x2385('0x40')](handleEntityNotFound(_0x54cedf,null))['then'](removeEntity(_0x54cedf,null))[_0x2385('0x47')](handleError(_0x54cedf,null));}; \ No newline at end of file +var _0x0c04=['lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','json','offset','limit','undefined','count','status','set','reject','save','update','then','destroy','error','stack','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','params','keys','intersection','create','body','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x4de31f,_0x5118c4){var _0x2477d3=function(_0x324ab2){while(--_0x324ab2){_0x4de31f['push'](_0x4de31f['shift']());}};_0x2477d3(++_0x5118c4);}(_0x0c04,0x82));var _0x40c0=function(_0x1907bf,_0x57778c){_0x1907bf=_0x1907bf-0x0;var _0x464f6f=_0x0c04[_0x1907bf];return _0x464f6f;};'use strict';var emlformat=require(_0x40c0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x40c0('0x1'));var jsonpatch=require(_0x40c0('0x2'));var rp=require('request-promise');var moment=require(_0x40c0('0x3'));var BPromise=require(_0x40c0('0x4'));var Mustache=require(_0x40c0('0x5'));var util=require(_0x40c0('0x6'));var path=require(_0x40c0('0x7'));var sox=require(_0x40c0('0x8'));var csv=require(_0x40c0('0x9'));var ejs=require(_0x40c0('0xa'));var fs=require('fs');var fs_extra=require(_0x40c0('0xb'));var _=require(_0x40c0('0xc'));var squel=require('squel');var crypto=require(_0x40c0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x40c0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x40c0('0xf'));var Papa=require(_0x40c0('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x40c0('0x11'));var hardwareService=require(_0x40c0('0x12'));var logger=require(_0x40c0('0x13'))(_0x40c0('0x14'));var utils=require(_0x40c0('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x40c0('0x16'))['db'];function respondWithStatusCode(_0x2430bd,_0x54fc23){_0x54fc23=_0x54fc23||0xcc;return function(_0x2a1aef){if(_0x2a1aef){return _0x2430bd['sendStatus'](_0x54fc23);}return _0x2430bd['status'](_0x54fc23)[_0x40c0('0x17')]();};}function respondWithResult(_0x39aba7,_0x2f8414){_0x2f8414=_0x2f8414||0xc8;return function(_0x1164a5){if(_0x1164a5){return _0x39aba7['status'](_0x2f8414)[_0x40c0('0x18')](_0x1164a5);}};}function respondWithFilteredResult(_0x3c1b3b,_0x2de64c){return function(_0x3abddb){if(_0x3abddb){var _0x680fea=typeof _0x2de64c[_0x40c0('0x19')]==='undefined'&&typeof _0x2de64c[_0x40c0('0x1a')]===_0x40c0('0x1b');var _0x32a505=_0x3abddb[_0x40c0('0x1c')];var _0x38fd51=_0x680fea?0x0:_0x2de64c['offset'];var _0x29760a=_0x680fea?_0x3abddb['count']:_0x2de64c[_0x40c0('0x19')]+_0x2de64c[_0x40c0('0x1a')];var _0x521f58;if(_0x29760a>=_0x32a505){_0x29760a=_0x32a505;_0x521f58=0xc8;}else{_0x521f58=0xce;}_0x3c1b3b[_0x40c0('0x1d')](_0x521f58);return _0x3c1b3b[_0x40c0('0x1e')]('Content-Range',_0x38fd51+'-'+_0x29760a+'/'+_0x32a505)['json'](_0x3abddb);}return null;};}function patchUpdates(_0x5dd609){return function(_0x51ae26){try{jsonpatch['apply'](_0x51ae26,_0x5dd609,!![]);}catch(_0xc722e0){return BPromise[_0x40c0('0x1f')](_0xc722e0);}return _0x51ae26[_0x40c0('0x20')]();};}function saveUpdates(_0x3b3788,_0x19fe85){return function(_0x5eb5c3){if(_0x5eb5c3){return _0x5eb5c3[_0x40c0('0x21')](_0x3b3788)[_0x40c0('0x22')](function(_0x1034bb){return _0x1034bb;});}return null;};}function removeEntity(_0x180128,_0x2adabe){return function(_0x49a3db){if(_0x49a3db){return _0x49a3db[_0x40c0('0x23')]()[_0x40c0('0x22')](function(){_0x180128[_0x40c0('0x1d')](0xcc)[_0x40c0('0x17')]();});}};}function handleEntityNotFound(_0x498a1c,_0x301e2b){return function(_0x382a16){if(!_0x382a16){_0x498a1c['sendStatus'](0x194);}return _0x382a16;};}function handleError(_0x1fa716,_0x3d6c6f){_0x3d6c6f=_0x3d6c6f||0x1f4;return function(_0x4d2549){logger[_0x40c0('0x24')](_0x4d2549[_0x40c0('0x25')]);if(_0x4d2549['name']){delete _0x4d2549['name'];}_0x1fa716[_0x40c0('0x1d')](_0x3d6c6f)[_0x40c0('0x26')](_0x4d2549);};}exports[_0x40c0('0x27')]=function(_0xe56d8a,_0x49ca1c){var _0x454ebc={},_0x18c815={},_0xae5d8e={'count':0x0,'rows':[]};var _0x73a34d=_[_0x40c0('0x28')](db[_0x40c0('0x29')][_0x40c0('0x2a')],function(_0x3c4267){return{'name':_0x3c4267[_0x40c0('0x2b')],'type':_0x3c4267[_0x40c0('0x2c')][_0x40c0('0x2d')]};});_0x18c815[_0x40c0('0x2e')]=_['map'](_0x73a34d,_0x40c0('0x2f'));_0x18c815[_0x40c0('0x30')]=_['keys'](_0xe56d8a[_0x40c0('0x30')]);_0x18c815[_0x40c0('0x31')]=_['intersection'](_0x18c815[_0x40c0('0x2e')],_0x18c815[_0x40c0('0x30')]);_0x454ebc[_0x40c0('0x32')]=_['intersection'](_0x18c815[_0x40c0('0x2e')],qs[_0x40c0('0x33')](_0xe56d8a['query'][_0x40c0('0x33')]));_0x454ebc['attributes']=_0x454ebc[_0x40c0('0x32')][_0x40c0('0x34')]?_0x454ebc['attributes']:_0x18c815['model'];if(!_0xe56d8a[_0x40c0('0x30')][_0x40c0('0x35')](_0x40c0('0x36'))){_0x454ebc[_0x40c0('0x1a')]=qs[_0x40c0('0x1a')](_0xe56d8a[_0x40c0('0x30')][_0x40c0('0x1a')]);_0x454ebc['offset']=qs[_0x40c0('0x19')](_0xe56d8a[_0x40c0('0x30')][_0x40c0('0x19')]);}_0x454ebc[_0x40c0('0x37')]=qs[_0x40c0('0x38')](_0xe56d8a[_0x40c0('0x30')][_0x40c0('0x38')]);_0x454ebc[_0x40c0('0x39')]=qs[_0x40c0('0x31')](_[_0x40c0('0x3a')](_0xe56d8a[_0x40c0('0x30')],_0x18c815[_0x40c0('0x31')]),_0x73a34d);if(_0xe56d8a[_0x40c0('0x30')][_0x40c0('0x3b')]){_0x454ebc[_0x40c0('0x39')]=_[_0x40c0('0x3c')](_0x454ebc['where'],{'$or':_[_0x40c0('0x28')](_0x73a34d,function(_0x124f00){if(_0x124f00[_0x40c0('0x2c')]!=='VIRTUAL'){var _0x51c507={};_0x51c507[_0x124f00[_0x40c0('0x2f')]]={'$like':'%'+_0xe56d8a['query'][_0x40c0('0x3b')]+'%'};return _0x51c507;}})});}_0x454ebc=_[_0x40c0('0x3c')]({},_0x454ebc,_0xe56d8a['options']);var _0x3c073={'where':_0x454ebc[_0x40c0('0x39')]};return db[_0x40c0('0x29')]['count'](_0x3c073)[_0x40c0('0x22')](function(_0x40db81){_0xae5d8e[_0x40c0('0x1c')]=_0x40db81;if(_0xe56d8a[_0x40c0('0x30')][_0x40c0('0x3d')]){_0x454ebc[_0x40c0('0x3e')]=[{'all':!![]}];}return db[_0x40c0('0x29')]['findAll'](_0x454ebc);})[_0x40c0('0x22')](function(_0x233240){_0xae5d8e[_0x40c0('0x3f')]=_0x233240;return _0xae5d8e;})[_0x40c0('0x22')](respondWithFilteredResult(_0x49ca1c,_0x454ebc))[_0x40c0('0x40')](handleError(_0x49ca1c,null));};exports['show']=function(_0x2a91ba,_0x5135cc){var _0x9ed6ba={'raw':!![],'where':{'id':_0x2a91ba[_0x40c0('0x41')]['id']}},_0x19373b={};_0x19373b['model']=_['keys'](db[_0x40c0('0x29')][_0x40c0('0x2a')]);_0x19373b['query']=_[_0x40c0('0x42')](_0x2a91ba[_0x40c0('0x30')]);_0x19373b[_0x40c0('0x31')]=_[_0x40c0('0x43')](_0x19373b[_0x40c0('0x2e')],_0x19373b['query']);_0x9ed6ba['attributes']=_['intersection'](_0x19373b[_0x40c0('0x2e')],qs['fields'](_0x2a91ba[_0x40c0('0x30')][_0x40c0('0x33')]));_0x9ed6ba[_0x40c0('0x32')]=_0x9ed6ba[_0x40c0('0x32')][_0x40c0('0x34')]?_0x9ed6ba[_0x40c0('0x32')]:_0x19373b['model'];if(_0x2a91ba['query'][_0x40c0('0x3d')]){_0x9ed6ba[_0x40c0('0x3e')]=[{'all':!![]}];}_0x9ed6ba=_[_0x40c0('0x3c')]({},_0x9ed6ba,_0x2a91ba['options']);return db['FaxApplication']['find'](_0x9ed6ba)[_0x40c0('0x22')](handleEntityNotFound(_0x5135cc,null))[_0x40c0('0x22')](respondWithResult(_0x5135cc,null))[_0x40c0('0x40')](handleError(_0x5135cc,null));};exports[_0x40c0('0x44')]=function(_0x179d53,_0x26199e){return db[_0x40c0('0x29')][_0x40c0('0x44')](_0x179d53[_0x40c0('0x45')],{})[_0x40c0('0x22')](respondWithResult(_0x26199e,0xc9))['catch'](handleError(_0x26199e,null));};exports[_0x40c0('0x21')]=function(_0xa05024,_0x1f2a52){if(_0xa05024[_0x40c0('0x45')]['id']){delete _0xa05024[_0x40c0('0x45')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0xa05024['params']['id']}})[_0x40c0('0x22')](handleEntityNotFound(_0x1f2a52,null))[_0x40c0('0x22')](saveUpdates(_0xa05024[_0x40c0('0x45')],null))[_0x40c0('0x22')](respondWithResult(_0x1f2a52,null))[_0x40c0('0x40')](handleError(_0x1f2a52,null));};exports['destroy']=function(_0x13510f,_0x27eff4){return db[_0x40c0('0x29')][_0x40c0('0x46')]({'where':{'id':_0x13510f[_0x40c0('0x41')]['id']}})['then'](handleEntityNotFound(_0x27eff4,null))[_0x40c0('0x22')](removeEntity(_0x27eff4,null))[_0x40c0('0x40')](handleError(_0x27eff4,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index cbe9929..eacd776 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 _0xe317=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4'];(function(_0x58bbcc,_0x41a061){var _0x581f2b=function(_0x2094d4){while(--_0x2094d4){_0x58bbcc['push'](_0x58bbcc['shift']());}};_0x581f2b(++_0x41a061);}(_0xe317,0xde));var _0x7e31=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xe317[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7e31('0x0'));var util=require(_0x7e31('0x1'));var logger=require(_0x7e31('0x2'))(_0x7e31('0x3'));var moment=require('moment');var BPromise=require(_0x7e31('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7e31('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7e31('0x6'));module[_0x7e31('0x7')]=function(_0x14eabd,_0x5d711f){return _0x14eabd[_0x7e31('0x8')](_0x7e31('0x9'),attributes,{'tableName':_0x7e31('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7e31('0xb'),'collate':_0x7e31('0xc')});}; \ No newline at end of file +var _0x5258=['path','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise'];(function(_0xfb4783,_0x3195e9){var _0x46e4f5=function(_0x4e1cbc){while(--_0x4e1cbc){_0xfb4783['push'](_0xfb4783['shift']());}};_0x46e4f5(++_0x3195e9);}(_0x5258,0x110));var _0x8525=function(_0x131e60,_0x5352ce){_0x131e60=_0x131e60-0x0;var _0x4bc497=_0x5258[_0x131e60];return _0x4bc497;};'use strict';var _=require(_0x8525('0x0'));var util=require(_0x8525('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8525('0x2'));var BPromise=require('bluebird');var rp=require(_0x8525('0x3'));var fs=require('fs');var path=require(_0x8525('0x4'));var rimraf=require('rimraf');var config=require(_0x8525('0x5'));var attributes=require(_0x8525('0x6'));module[_0x8525('0x7')]=function(_0x41b1eb,_0x39fce9){return _0x41b1eb[_0x8525('0x8')]('FaxApplication',attributes,{'tableName':_0x8525('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8525('0xa'),'collate':_0x8525('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index e61b26f..2a198d6 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 _0xe8b1=['debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','options','where','attributes','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x3936dc,_0x3a9fee){var _0x434a3a=function(_0x4ef3a3){while(--_0x4ef3a3){_0x3936dc['push'](_0x3936dc['shift']());}};_0x434a3a(++_0x3a9fee);}(_0xe8b1,0x8a));var _0x1e8b=function(_0x5dde65,_0x1eb6f7){_0x5dde65=_0x5dde65-0x0;var _0x1e9245=_0xe8b1[_0x5dde65];return _0x1e9245;};'use strict';var _=require(_0x1e8b('0x0'));var util=require(_0x1e8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1e8b('0x2'));var fs=require('fs');var Redis=require(_0x1e8b('0x3'));var db=require(_0x1e8b('0x4'))['db'];var utils=require(_0x1e8b('0x5'));var logger=require(_0x1e8b('0x6'))(_0x1e8b('0x7'));var config=require(_0x1e8b('0x8'));var jayson=require(_0x1e8b('0x9'));var client=jayson[_0x1e8b('0xa')][_0x1e8b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fbc48,_0x398f06,_0x3651d2){return new BPromise(function(_0x343d1e,_0x405b7b){return client[_0x1e8b('0xc')](_0x4fbc48,_0x3651d2)[_0x1e8b('0xd')](function(_0x36a48b){logger[_0x1e8b('0xe')](_0x1e8b('0xf'),_0x398f06,_0x1e8b('0x10'));logger[_0x1e8b('0x11')](_0x1e8b('0x12'),_0x398f06,_0x1e8b('0x10'),JSON[_0x1e8b('0x13')](_0x36a48b));if(_0x36a48b['error']){if(_0x36a48b[_0x1e8b('0x14')][_0x1e8b('0x15')]===0x1f4){logger[_0x1e8b('0x14')](_0x1e8b('0xf'),_0x398f06,_0x36a48b[_0x1e8b('0x14')]['message']);return _0x405b7b(_0x36a48b[_0x1e8b('0x14')]['message']);}logger[_0x1e8b('0x14')](_0x1e8b('0xf'),_0x398f06,_0x36a48b[_0x1e8b('0x14')][_0x1e8b('0x16')]);return _0x343d1e(_0x36a48b[_0x1e8b('0x14')][_0x1e8b('0x16')]);}else{logger['info'](_0x1e8b('0xf'),_0x398f06,_0x1e8b('0x10'));_0x343d1e(_0x36a48b[_0x1e8b('0x17')][_0x1e8b('0x16')]);}})[_0x1e8b('0x18')](function(_0x63f0c5){logger[_0x1e8b('0x14')](_0x1e8b('0xf'),_0x398f06,_0x63f0c5);_0x405b7b(_0x63f0c5);});});}exports[_0x1e8b('0x19')]=function(_0x2e7107){var _0xac9598=this;return new Promise(function(_0x25ab37,_0x3eb668){return db[_0x1e8b('0x1a')][_0x1e8b('0x1b')](_0x2e7107['body'],{'raw':_0x2e7107[_0x1e8b('0x1c')]?_0x2e7107[_0x1e8b('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e7107[_0x1e8b('0x1c')]?_0x2e7107['options'][_0x1e8b('0x1d')]||null:null,'attributes':_0x2e7107[_0x1e8b('0x1c')]?_0x2e7107[_0x1e8b('0x1c')][_0x1e8b('0x1e')]||null:null,'limit':_0x2e7107[_0x1e8b('0x1c')]?_0x2e7107[_0x1e8b('0x1c')]['limit']||null:null})[_0x1e8b('0xd')](function(_0x20be38){logger[_0x1e8b('0xe')]('UpdateFaxApplication',_0x2e7107);logger[_0x1e8b('0x11')](_0x1e8b('0x19'),_0x2e7107,JSON[_0x1e8b('0x13')](_0x20be38));_0x25ab37(_0x20be38);})[_0x1e8b('0x18')](function(_0x4d0faf){logger[_0x1e8b('0x14')](_0x1e8b('0x19'),_0x4d0faf[_0x1e8b('0x16')],_0x2e7107);_0x3eb668(_0xac9598['error'](0x1f4,_0x4d0faf[_0x1e8b('0x16')]));});});}; \ No newline at end of file +var _0xff89=['catch','UpdateFaxApplication','FaxApplication','body','options','raw','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x400a4f,_0x302b31){var _0x2d0335=function(_0x3d0955){while(--_0x3d0955){_0x400a4f['push'](_0x400a4f['shift']());}};_0x2d0335(++_0x302b31);}(_0xff89,0xaf));var _0x9ff8=function(_0xa56fec,_0x233950){_0xa56fec=_0xa56fec-0x0;var _0xa5d58e=_0xff89[_0xa56fec];return _0xa5d58e;};'use strict';var _=require(_0x9ff8('0x0'));var util=require(_0x9ff8('0x1'));var moment=require(_0x9ff8('0x2'));var BPromise=require(_0x9ff8('0x3'));var rs=require(_0x9ff8('0x4'));var fs=require('fs');var Redis=require(_0x9ff8('0x5'));var db=require(_0x9ff8('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9ff8('0x7'));var config=require(_0x9ff8('0x8'));var jayson=require(_0x9ff8('0x9'));var client=jayson[_0x9ff8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x555e68,_0x452782,_0x5c81c5){return new BPromise(function(_0x1d230f,_0x3eba33){return client[_0x9ff8('0xb')](_0x555e68,_0x5c81c5)['then'](function(_0x3f4329){logger['info'](_0x9ff8('0xc'),_0x452782,'request\x20sent');logger[_0x9ff8('0xd')](_0x9ff8('0xe'),_0x452782,'request\x20sent',JSON[_0x9ff8('0xf')](_0x3f4329));if(_0x3f4329[_0x9ff8('0x10')]){if(_0x3f4329[_0x9ff8('0x10')][_0x9ff8('0x11')]===0x1f4){logger[_0x9ff8('0x10')]('FaxApplication,\x20%s,\x20%s',_0x452782,_0x3f4329['error']['message']);return _0x3eba33(_0x3f4329[_0x9ff8('0x10')]['message']);}logger[_0x9ff8('0x10')](_0x9ff8('0xc'),_0x452782,_0x3f4329[_0x9ff8('0x10')][_0x9ff8('0x12')]);return _0x1d230f(_0x3f4329['error'][_0x9ff8('0x12')]);}else{logger[_0x9ff8('0x13')](_0x9ff8('0xc'),_0x452782,'request\x20sent');_0x1d230f(_0x3f4329[_0x9ff8('0x14')][_0x9ff8('0x12')]);}})[_0x9ff8('0x15')](function(_0x2b7b74){logger['error'](_0x9ff8('0xc'),_0x452782,_0x2b7b74);_0x3eba33(_0x2b7b74);});});}exports[_0x9ff8('0x16')]=function(_0x251170){var _0x37eea6=this;return new Promise(function(_0x1a9059,_0x2d2098){return db[_0x9ff8('0x17')]['update'](_0x251170[_0x9ff8('0x18')],{'raw':_0x251170[_0x9ff8('0x19')]?_0x251170[_0x9ff8('0x19')][_0x9ff8('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x251170[_0x9ff8('0x19')]?_0x251170[_0x9ff8('0x19')]['where']||null:null,'attributes':_0x251170[_0x9ff8('0x19')]?_0x251170[_0x9ff8('0x19')]['attributes']||null:null,'limit':_0x251170[_0x9ff8('0x19')]?_0x251170[_0x9ff8('0x19')][_0x9ff8('0x1b')]||null:null})['then'](function(_0x22ea2d){logger[_0x9ff8('0x13')](_0x9ff8('0x16'),_0x251170);logger[_0x9ff8('0xd')](_0x9ff8('0x16'),_0x251170,JSON[_0x9ff8('0xf')](_0x22ea2d));_0x1a9059(_0x22ea2d);})['catch'](function(_0x50296d){logger['error'](_0x9ff8('0x16'),_0x50296d[_0x9ff8('0x12')],_0x251170);_0x2d2098(_0x37eea6[_0x9ff8('0x10')](0x1f4,_0x50296d[_0x9ff8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index c217485..209644d 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 _0xdd4f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','express'];(function(_0x69ecce,_0x24639b){var _0x482c7b=function(_0x4b9732){while(--_0x4b9732){_0x69ecce['push'](_0x69ecce['shift']());}};_0x482c7b(++_0x24639b);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x35cd86,_0x347d09){_0x35cd86=_0x35cd86-0x0;var _0x19bd5c=_0xdd4f[_0x35cd86];return _0x19bd5c;};'use strict';var multer=require(_0xfdd4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfdd4('0x1'));var router=express[_0xfdd4('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfdd4('0x3'));var interaction=require(_0xfdd4('0x4'));var config=require(_0xfdd4('0x5'));var controller=require('./faxApplication.controller');router[_0xfdd4('0x6')]('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x8')]);router[_0xfdd4('0x6')](_0xfdd4('0x9'),auth['isAuthenticated'](),controller[_0xfdd4('0xa')]);router['post']('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0xb')]);router[_0xfdd4('0xc')]('/:id',auth[_0xfdd4('0x7')](),controller['update']);router[_0xfdd4('0xd')](_0xfdd4('0x9'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0xe')]);module[_0xfdd4('0xf')]=router; \ No newline at end of file +var _0xb03e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','show','post','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x3d216f,_0x345fc9){var _0x240d8c=function(_0x217db8){while(--_0x217db8){_0x3d216f['push'](_0x3d216f['shift']());}};_0x240d8c(++_0x345fc9);}(_0xb03e,0x1eb));var _0xeb03=function(_0x56b0a2,_0x4cd20d){_0x56b0a2=_0x56b0a2-0x0;var _0x5f2b98=_0xb03e[_0x56b0a2];return _0x5f2b98;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var fs_extra=require(_0xeb03('0x5'));var auth=require(_0xeb03('0x6'));var interaction=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var controller=require(_0xeb03('0x9'));router[_0xeb03('0xa')]('/',auth[_0xeb03('0xb')](),controller['index']);router[_0xeb03('0xa')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller[_0xeb03('0xd')]);router[_0xeb03('0xe')]('/',auth[_0xeb03('0xb')](),controller['create']);router[_0xeb03('0xf')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller['update']);router[_0xeb03('0x10')]('/:id',auth[_0xeb03('0xb')](),controller[_0xeb03('0x11')]);module[_0xeb03('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index e28ee32..e8429bf 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 _0x7960=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x4aab46,_0x54d8a8){var _0x348a0c=function(_0x159400){while(--_0x159400){_0x4aab46['push'](_0x4aab46['shift']());}};_0x348a0c(++_0x54d8a8);}(_0x7960,0x13b));var _0x0796=function(_0x1b742b,_0x1783a3){_0x1b742b=_0x1b742b-0x0;var _0x51fb05=_0x7960[_0x1b742b];return _0x51fb05;};'use strict';var Sequelize=require(_0x0796('0x0'));module[_0x0796('0x1')]={'closed':{'type':Sequelize[_0x0796('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0796('0x3')]},'disposition':{'type':Sequelize[_0x0796('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0796('0x4')]},'read1stAt':{'type':Sequelize[_0x0796('0x3')]},'fax':{'type':Sequelize[_0x0796('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x0796('0x5')]('in',_0x0796('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0796('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0796('0x5')]('in',_0x0796('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x09c3=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x51070b,_0x39c85d){var _0x153240=function(_0x7c02f2){while(--_0x7c02f2){_0x51070b['push'](_0x51070b['shift']());}};_0x153240(++_0x39c85d);}(_0x09c3,0xe1));var _0x309c=function(_0x5e3701,_0x596265){_0x5e3701=_0x5e3701-0x0;var _0x345dcf=_0x09c3[_0x5e3701];return _0x345dcf;};'use strict';var Sequelize=require(_0x309c('0x0'));module[_0x309c('0x1')]={'closed':{'type':Sequelize[_0x309c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x309c('0x3')]},'disposition':{'type':Sequelize[_0x309c('0x4')]},'secondDisposition':{'type':Sequelize[_0x309c('0x4')]},'thirdDisposition':{'type':Sequelize[_0x309c('0x4')]},'note':{'type':Sequelize[_0x309c('0x4')]},'read1stAt':{'type':Sequelize[_0x309c('0x3')]},'fax':{'type':Sequelize[_0x309c('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x309c('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x309c('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x309c('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 27a96ad..a55f43a 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 _0xa772=['json','offset','undefined','count','limit','set','Content-Range','update','then','end','sendStatus','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','getOptions','findAll','query','user','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','catch','destroy','describe','addMessage','FaxMessage','ids','omit','findOne','nolimit','sort','pick','where','FaxInteractionId','filter','$gte','addTags','setTags','spread','Tag','color','emit','removeTags','download','toString','join','root','server','files','format','transcript-%d-%s.zip','push','Attachment','createdAt','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','resolve','err','unlinkSync','rimraf','moment','bluebird','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','status'];(function(_0x4db85f,_0x38a10a){var _0x816e9b=function(_0x1d5a57){while(--_0x1d5a57){_0x4db85f['push'](_0x4db85f['shift']());}};_0x816e9b(++_0x38a10a);}(_0xa772,0x1d6));var _0x2a77=function(_0x56ea44,_0x368863){_0x56ea44=_0x56ea44-0x0;var _0xabc9b=_0xa772[_0x56ea44];return _0xabc9b;};'use strict';var rimraf=require(_0x2a77('0x0'));var zipdir=require('zip-dir');var moment=require(_0x2a77('0x1'));var BPromise=require(_0x2a77('0x2'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x2a77('0x3'));var Redis=require(_0x2a77('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0x2a77('0x5'));var logger=require('../../config/logger')(_0x2a77('0x6'));var config=require(_0x2a77('0x7'));var db=require(_0x2a77('0x8'))['db'];config[_0x2a77('0x9')]=_[_0x2a77('0xa')](config[_0x2a77('0x9')],{'host':_0x2a77('0xb'),'port':0x18eb});var socket=require(_0x2a77('0xc'))(new Redis(config['redis']));require(_0x2a77('0xd'))['register'](socket);function respondWithStatusCode(_0x5e03c3,_0x29991d){_0x29991d=_0x29991d||0xcc;return function(_0x207738){if(_0x207738){return _0x5e03c3['sendStatus'](_0x29991d);}return _0x5e03c3['status'](_0x29991d)['end']();};}function respondWithResult(_0x25ab2c,_0x52ac4f){_0x52ac4f=_0x52ac4f||0xc8;return function(_0x46011f){if(_0x46011f){return _0x25ab2c[_0x2a77('0xe')](_0x52ac4f)[_0x2a77('0xf')](_0x46011f);}};}function respondWithFilteredResult(_0x358636,_0x2a1871){return function(_0x15e0fe){if(_0x15e0fe){var _0x36cf2b=typeof _0x2a1871[_0x2a77('0x10')]===_0x2a77('0x11')&&typeof _0x2a1871['limit']==='undefined';var _0x180dbd=_0x15e0fe[_0x2a77('0x12')];var _0x3ca6df=_0x36cf2b?0x0:_0x2a1871[_0x2a77('0x10')];var _0x6d2b90=_0x36cf2b?_0x15e0fe[_0x2a77('0x12')]:_0x2a1871[_0x2a77('0x10')]+_0x2a1871[_0x2a77('0x13')];var _0x850ae1;if(_0x6d2b90>=_0x180dbd){_0x6d2b90=_0x180dbd;_0x850ae1=0xc8;}else{_0x850ae1=0xce;}_0x358636[_0x2a77('0xe')](_0x850ae1);return _0x358636[_0x2a77('0x14')](_0x2a77('0x15'),_0x3ca6df+'-'+_0x6d2b90+'/'+_0x180dbd)['json'](_0x15e0fe);}return null;};}function saveUpdates(_0x4aee2d){return function(_0xee5570){if(_0xee5570){return _0xee5570[_0x2a77('0x16')](_0x4aee2d)[_0x2a77('0x17')](function(_0x4e1263){return _0x4e1263;});}return null;};}function removeEntity(_0x18ddcf){return function(_0x560ed7){if(_0x560ed7){return _0x560ed7['destroy']()[_0x2a77('0x17')](function(){_0x18ddcf[_0x2a77('0xe')](0xcc)[_0x2a77('0x18')]();});}};}function handleEntityNotFound(_0x2e6075){return function(_0x2a8201){if(!_0x2a8201){_0x2e6075[_0x2a77('0x19')](0x194);}return _0x2a8201;};}function handleError(_0x378482,_0x3a4bd4){_0x3a4bd4=_0x3a4bd4||0x1f4;return function(_0x5d1ed1){logger['error'](_0x5d1ed1[_0x2a77('0x1a')]);if(_0x5d1ed1['name']){delete _0x5d1ed1[_0x2a77('0x1b')];}_0x378482[_0x2a77('0xe')](_0x3a4bd4)[_0x2a77('0x1c')](_0x5d1ed1);};}exports[_0x2a77('0x1d')]=function(_0x2bea3e,_0x1ee0f1){var _0x8b1409={};var _0xf2765f=_[_0x2a77('0x1e')](db[_0x2a77('0x1f')][_0x2a77('0x20')],function(_0x267279){return{'name':_0x267279[_0x2a77('0x21')],'type':_0x267279[_0x2a77('0x22')]['key']};});_0x8b1409=qs[_0x2a77('0x23')](_0xf2765f,_0x2bea3e);return interaction[_0x2a77('0x24')]('fax',_0x2bea3e[_0x2a77('0x25')],_0x2bea3e[_0x2a77('0x26')],_0x8b1409,_0xf2765f)[_0x2a77('0x17')](respondWithFilteredResult(_0x1ee0f1,_0x8b1409))['catch'](handleError(_0x1ee0f1,null));};exports['show']=function(_0x7ec938,_0x2297cd){var _0x53696f={'raw':![],'where':{'id':_0x7ec938[_0x2a77('0x27')]['id']}},_0x2bb79e={};_0x2bb79e[_0x2a77('0x28')]=_[_0x2a77('0x29')](db[_0x2a77('0x1f')][_0x2a77('0x20')]);_0x2bb79e['query']=_[_0x2a77('0x29')](_0x7ec938['query']);_0x2bb79e[_0x2a77('0x2a')]=_[_0x2a77('0x2b')](_0x2bb79e[_0x2a77('0x28')],_0x2bb79e[_0x2a77('0x25')]);_0x53696f[_0x2a77('0x2c')]=_[_0x2a77('0x2b')](_0x2bb79e[_0x2a77('0x28')],qs[_0x2a77('0x2d')](_0x7ec938['query'][_0x2a77('0x2d')]));_0x53696f[_0x2a77('0x2c')]=_0x53696f[_0x2a77('0x2c')][_0x2a77('0x2e')]?_0x53696f['attributes']:_0x2bb79e['model'];if(_0x7ec938[_0x2a77('0x25')][_0x2a77('0x2f')]){_0x53696f[_0x2a77('0x30')]=[{'all':!![]}];}_0x53696f=_[_0x2a77('0x31')]({},_0x53696f,_0x7ec938[_0x2a77('0x32')]);return db[_0x2a77('0x1f')][_0x2a77('0x33')](_0x53696f)[_0x2a77('0x17')](handleEntityNotFound(_0x2297cd,null))[_0x2a77('0x17')](respondWithResult(_0x2297cd,null))['catch'](handleError(_0x2297cd,null));};exports[_0x2a77('0x34')]=function(_0x21d2ff,_0x3b183c){return db[_0x2a77('0x1f')]['create'](_0x21d2ff[_0x2a77('0x35')],{})[_0x2a77('0x17')](respondWithResult(_0x3b183c,0xc9))['catch'](handleError(_0x3b183c,null));};exports[_0x2a77('0x16')]=function(_0x48a2ff,_0xf1c7b1){if(_0x48a2ff[_0x2a77('0x35')]['id']){delete _0x48a2ff[_0x2a77('0x35')]['id'];}return db[_0x2a77('0x1f')]['find']({'where':{'id':_0x48a2ff['params']['id']}})[_0x2a77('0x17')](handleEntityNotFound(_0xf1c7b1,null))[_0x2a77('0x17')](saveUpdates(_0x48a2ff[_0x2a77('0x35')],null))[_0x2a77('0x17')](respondWithResult(_0xf1c7b1,null))[_0x2a77('0x36')](handleError(_0xf1c7b1,null));};exports[_0x2a77('0x37')]=function(_0x16b5c0,_0x23e333){return db[_0x2a77('0x1f')]['find']({'where':{'id':_0x16b5c0['params']['id']}})[_0x2a77('0x17')](handleEntityNotFound(_0x23e333,null))['then'](removeEntity(_0x23e333,null))['catch'](handleError(_0x23e333,null));};exports['describe']=function(_0x59dbdd,_0x10ec85){return db[_0x2a77('0x1f')][_0x2a77('0x38')]()[_0x2a77('0x17')](respondWithResult(_0x10ec85,null))['catch'](handleError(_0x10ec85,null));};exports[_0x2a77('0x39')]=function(_0x528080,_0x539dd9){return db[_0x2a77('0x3a')]['find']({'where':{'id':_0x528080[_0x2a77('0x27')]['id']}})[_0x2a77('0x17')](handleEntityNotFound(_0x539dd9,null))[_0x2a77('0x17')](function(_0x359a90){if(_0x359a90){return _0x359a90[_0x2a77('0x39')](_0x528080[_0x2a77('0x35')][_0x2a77('0x3b')],_[_0x2a77('0x3c')](_0x528080[_0x2a77('0x35')],[_0x2a77('0x3b'),'id'])||{});}})[_0x2a77('0x17')](respondWithResult(_0x539dd9,null))[_0x2a77('0x36')](handleError(_0x539dd9,null));};exports['getMessages']=function(_0x29a9f9,_0x2b32b5){var _0x5c6c0e={'raw':![],'where':{}};var _0x5059da={};var _0x2d85b2={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x2a77('0x3d')]({'where':{'id':_0x29a9f9[_0x2a77('0x27')]['id']}})[_0x2a77('0x17')](handleEntityNotFound(_0x2b32b5,null))['then'](function(_0x59b222){if(_0x59b222){_0x5059da[_0x2a77('0x28')]=_[_0x2a77('0x29')](db['FaxMessage'][_0x2a77('0x20')]);_0x5059da['query']=_[_0x2a77('0x29')](_0x29a9f9[_0x2a77('0x25')]);_0x5059da['filters']=_['intersection'](_0x5059da[_0x2a77('0x28')],_0x5059da['query']);_0x5c6c0e['attributes']=_[_0x2a77('0x2b')](_0x5059da[_0x2a77('0x28')],qs[_0x2a77('0x2d')](_0x29a9f9[_0x2a77('0x25')][_0x2a77('0x2d')]));_0x5c6c0e[_0x2a77('0x2c')]=_0x5c6c0e[_0x2a77('0x2c')][_0x2a77('0x2e')]?_0x5c6c0e[_0x2a77('0x2c')]:_0x5059da[_0x2a77('0x28')];if(!_0x29a9f9[_0x2a77('0x25')]['hasOwnProperty'](_0x2a77('0x3e'))){_0x5c6c0e[_0x2a77('0x13')]=qs[_0x2a77('0x13')](_0x29a9f9[_0x2a77('0x25')][_0x2a77('0x13')]);_0x5c6c0e[_0x2a77('0x10')]=qs[_0x2a77('0x10')](_0x29a9f9['query'][_0x2a77('0x10')]);}_0x5c6c0e['order']=qs[_0x2a77('0x3f')](_0x29a9f9[_0x2a77('0x25')][_0x2a77('0x3f')]);_0x5c6c0e['where']=qs['filters'](_[_0x2a77('0x40')](_0x29a9f9[_0x2a77('0x25')],_0x5059da[_0x2a77('0x2a')]));_0x5c6c0e[_0x2a77('0x41')][_0x2a77('0x42')]=_0x59b222['id'];if(_0x29a9f9[_0x2a77('0x25')][_0x2a77('0x43')]){_0x5c6c0e[_0x2a77('0x41')]=_['merge'](_0x5c6c0e[_0x2a77('0x41')],{'$or':_[_0x2a77('0x1e')](_0x5c6c0e['attributes'],function(_0x2a5cd3){var _0xb641f={};_0xb641f[_0x2a5cd3]={'$like':'%'+_0x29a9f9[_0x2a77('0x25')][_0x2a77('0x43')]+'%'};return _0xb641f;})});}if(_0x29a9f9['query'][_0x2a77('0x44')]){var _0x77d72d=_0x29a9f9[_0x2a77('0x25')]['$gte']['split'](',');var _0x11d440={};_0x11d440[_0x77d72d[0x0]]={'$gte':moment(_0x77d72d[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x5c6c0e[_0x2a77('0x41')]=_[_0x2a77('0x31')](_0x5c6c0e['where'],_0x11d440);}_0x5c6c0e=_[_0x2a77('0x31')]({},_0x5c6c0e,_0x29a9f9[_0x2a77('0x32')]);return db[_0x2a77('0x3a')][_0x2a77('0x12')]({'where':_0x5c6c0e[_0x2a77('0x41')]})['then'](function(_0x25292b){_0x2d85b2[_0x2a77('0x12')]=_0x25292b;if(_0x29a9f9['query'][_0x2a77('0x2f')]){_0x5c6c0e[_0x2a77('0x30')]=[{'all':!![]}];}return db[_0x2a77('0x3a')][_0x2a77('0x24')](_0x5c6c0e);})['then'](function(_0x5e6539){_0x2d85b2['rows']=_0x5e6539;return _0x2d85b2;});}})[_0x2a77('0x17')](respondWithFilteredResult(_0x2b32b5,_0x5c6c0e))[_0x2a77('0x36')](handleError(_0x2b32b5,null));};exports[_0x2a77('0x45')]=function(_0x46afc2,_0x210c7f){return db[_0x2a77('0x1f')][_0x2a77('0x33')]({'where':{'id':_0x46afc2[_0x2a77('0x27')]['id']}})['then'](handleEntityNotFound(_0x210c7f,null))[_0x2a77('0x17')](function(_0x27766a){if(_0x27766a){return _0x27766a[_0x2a77('0x46')](_0x46afc2[_0x2a77('0x35')][_0x2a77('0x3b')],_[_0x2a77('0x3c')](_0x46afc2[_0x2a77('0x35')],[_0x2a77('0x3b'),'id'])||{})[_0x2a77('0x47')](function(){return db[_0x2a77('0x48')]['findAll']({'attributes':['id',_0x2a77('0x1b'),_0x2a77('0x49')],'where':{'id':_0x46afc2[_0x2a77('0x35')][_0x2a77('0x3b')]}});})[_0x2a77('0x17')](function(_0x4362a0){socket[_0x2a77('0x4a')]('faxInteractionTags:save',{'id':Number(_0x46afc2[_0x2a77('0x27')]['id']),'tags':_0x4362a0||[]});return{'id':Number(_0x46afc2[_0x2a77('0x27')]['id']),'tags':_0x4362a0||[]};});}})[_0x2a77('0x17')](respondWithResult(_0x210c7f,null))[_0x2a77('0x36')](handleError(_0x210c7f,null));};exports[_0x2a77('0x4b')]=function(_0x443986,_0x231a4c){return db[_0x2a77('0x1f')][_0x2a77('0x33')]({'where':{'id':_0x443986['params']['id']}})[_0x2a77('0x17')](handleEntityNotFound(_0x231a4c,null))['then'](function(_0x2f5406){if(_0x2f5406){return _0x2f5406[_0x2a77('0x4b')](_0x443986[_0x2a77('0x25')][_0x2a77('0x3b')]);}})[_0x2a77('0x17')](respondWithStatusCode(_0x231a4c,null))[_0x2a77('0x36')](handleError(_0x231a4c,null));};exports[_0x2a77('0x4c')]=function(_0xc781ba,_0x260537){var _0x1cc9be=moment()['unix']()[_0x2a77('0x4d')]();var _0x115d67=path[_0x2a77('0x4e')](config[_0x2a77('0x4f')],'server','files','tmp');var _0x58d56c=path['join'](config[_0x2a77('0x4f')],_0x2a77('0x50'),_0x2a77('0x51'),'attachments');var _0x6114b=path[_0x2a77('0x4e')](_0x115d67,_0x1cc9be);var _0x48ec1b=util[_0x2a77('0x52')](_0x2a77('0x53'),_0xc781ba[_0x2a77('0x27')]['id'],_0x1cc9be);var _0x4a625a=path[_0x2a77('0x4e')](_0x115d67,_0x48ec1b);var _0x36bb0f=[];_0x36bb0f[_0x2a77('0x54')]({'model':db[_0x2a77('0x55')],'as':_0x2a77('0x55'),'raw':!![]});var _0x1d4bf6=[{'model':db[_0x2a77('0x3a')],'as':'Messages','attributes':['id',_0x2a77('0x35'),_0x2a77('0x56')],'include':_0x36bb0f}];return db['FaxInteraction']['find']({'where':{'id':_0xc781ba[_0x2a77('0x27')]['id']},'include':_0x1d4bf6})[_0x2a77('0x17')](handleEntityNotFound(_0x260537,null))[_0x2a77('0x17')](function(_0xd7204){if(_0xd7204&&_0xd7204[_0x2a77('0x57')]){var _0x3f7500=_0xd7204[_0x2a77('0x58')]({'plain':!![]});fs[_0x2a77('0x59')](_0x6114b);for(var _0x555d75=0x0;_0x555d75<_0x3f7500['Messages']['length'];_0x555d75++){var _0x1ff9b5=_0x3f7500['Messages'][_0x555d75][_0x2a77('0x55')];if(_0x1ff9b5){var _0x1b799e=path['join'](_0x58d56c,_0x1ff9b5[_0x2a77('0x5a')]);if(fs[_0x2a77('0x5b')](_0x1b799e)){fs[_0x2a77('0x5c')](_0x1b799e)[_0x2a77('0x5d')](fs['createWriteStream'](path[_0x2a77('0x4e')](_0x6114b,_0x1ff9b5[_0x2a77('0x5a')])));}}}return BPromise[_0x2a77('0x5e')]()[_0x2a77('0x17')](function(){return new BPromise(function(_0x4fd2ed,_0x123e08){zipdir(_0x6114b,{'saveTo':_0x4a625a},function(_0x5d7a23,_0x2c02c3){if(_0x5d7a23)return _0x123e08(_0x5d7a23);return _0x4fd2ed(_0x2c02c3);});})[_0x2a77('0x17')](function(){return new BPromise(function(_0x2e2460,_0x27d834){rimraf(_0x6114b,function(_0x2d1f63){if(_0x2d1f63)_0x27d834(_0x2d1f63);return _0x2e2460();});});})['then'](function(){return _0x260537['download'](_0x4a625a,_0x48ec1b,function(_0x7e7c88){if(_0x7e7c88){console['log'](_0x2a77('0x5f'),_0x7e7c88);}else{fs[_0x2a77('0x60')](_0x4a625a);}});});});}else{return _0x260537[_0x2a77('0x19')](0xc8);}})[_0x2a77('0x36')](handleError(_0x260537,null));}; \ No newline at end of file +var _0x4751=['path','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../mysqldb','defaults','redis','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','user','catch','show','params','model','keys','FaxInteraction','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','update','destroy','addMessage','ids','omit','getMessages','FaxMessage','hasOwnProperty','nolimit','order','pick','where','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','color','emit','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','Attachment','Messages','createdAt','get','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','rimraf','zip-dir','moment','bluebird','util'];(function(_0x55df1c,_0x3ffc53){var _0x3d0528=function(_0x5e82bb){while(--_0x5e82bb){_0x55df1c['push'](_0x55df1c['shift']());}};_0x3d0528(++_0x3ffc53);}(_0x4751,0x19b));var _0x1475=function(_0x5d8e48,_0x504b33){_0x5d8e48=_0x5d8e48-0x0;var _0x1b9354=_0x4751[_0x5d8e48];return _0x1b9354;};'use strict';var rimraf=require(_0x1475('0x0'));var zipdir=require(_0x1475('0x1'));var moment=require(_0x1475('0x2'));var BPromise=require(_0x1475('0x3'));var util=require(_0x1475('0x4'));var path=require(_0x1475('0x5'));var fs=require('fs');var _=require(_0x1475('0x6'));var Redis=require(_0x1475('0x7'));var interaction=require(_0x1475('0x8'));var qs=require('../../components/parsers/qs');var logger=require(_0x1475('0x9'))(_0x1475('0xa'));var config=require('../../config/environment');var db=require(_0x1475('0xb'))['db'];config['redis']=_[_0x1475('0xc')](config[_0x1475('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1475('0xd')]));require('./faxInteraction.socket')[_0x1475('0xe')](socket);function respondWithStatusCode(_0x1d9829,_0x15699a){_0x15699a=_0x15699a||0xcc;return function(_0x599708){if(_0x599708){return _0x1d9829[_0x1475('0xf')](_0x15699a);}return _0x1d9829[_0x1475('0x10')](_0x15699a)[_0x1475('0x11')]();};}function respondWithResult(_0x538648,_0x38b894){_0x38b894=_0x38b894||0xc8;return function(_0x5d04c5){if(_0x5d04c5){return _0x538648[_0x1475('0x10')](_0x38b894)[_0x1475('0x12')](_0x5d04c5);}};}function respondWithFilteredResult(_0x5c6e78,_0x11b061){return function(_0x157e00){if(_0x157e00){var _0x408004=typeof _0x11b061['offset']===_0x1475('0x13')&&typeof _0x11b061[_0x1475('0x14')]===_0x1475('0x13');var _0x41ae13=_0x157e00[_0x1475('0x15')];var _0x15d60a=_0x408004?0x0:_0x11b061[_0x1475('0x16')];var _0x4e704c=_0x408004?_0x157e00[_0x1475('0x15')]:_0x11b061[_0x1475('0x16')]+_0x11b061[_0x1475('0x14')];var _0xea83e3;if(_0x4e704c>=_0x41ae13){_0x4e704c=_0x41ae13;_0xea83e3=0xc8;}else{_0xea83e3=0xce;}_0x5c6e78[_0x1475('0x10')](_0xea83e3);return _0x5c6e78[_0x1475('0x17')](_0x1475('0x18'),_0x15d60a+'-'+_0x4e704c+'/'+_0x41ae13)[_0x1475('0x12')](_0x157e00);}return null;};}function saveUpdates(_0x4e6405){return function(_0x44abc6){if(_0x44abc6){return _0x44abc6['update'](_0x4e6405)[_0x1475('0x19')](function(_0x5a7424){return _0x5a7424;});}return null;};}function removeEntity(_0x59d7ae){return function(_0x57ff40){if(_0x57ff40){return _0x57ff40['destroy']()[_0x1475('0x19')](function(){_0x59d7ae['status'](0xcc)[_0x1475('0x11')]();});}};}function handleEntityNotFound(_0x885cef){return function(_0x197b25){if(!_0x197b25){_0x885cef['sendStatus'](0x194);}return _0x197b25;};}function handleError(_0x540770,_0x2d6139){_0x2d6139=_0x2d6139||0x1f4;return function(_0x29762e){logger[_0x1475('0x1a')](_0x29762e[_0x1475('0x1b')]);if(_0x29762e[_0x1475('0x1c')]){delete _0x29762e['name'];}_0x540770[_0x1475('0x10')](_0x2d6139)['send'](_0x29762e);};}exports[_0x1475('0x1d')]=function(_0x55f722,_0x31f13){var _0x194c93={};var _0x15cdd8=_[_0x1475('0x1e')](db['FaxInteraction'][_0x1475('0x1f')],function(_0x1278a3){return{'name':_0x1278a3[_0x1475('0x20')],'type':_0x1278a3[_0x1475('0x21')][_0x1475('0x22')]};});_0x194c93=qs[_0x1475('0x23')](_0x15cdd8,_0x55f722);return interaction[_0x1475('0x24')](_0x1475('0x25'),_0x55f722[_0x1475('0x26')],_0x55f722[_0x1475('0x27')],_0x194c93,_0x15cdd8)[_0x1475('0x19')](respondWithFilteredResult(_0x31f13,_0x194c93))[_0x1475('0x28')](handleError(_0x31f13,null));};exports[_0x1475('0x29')]=function(_0x55b2dc,_0x4f925f){var _0x166a6c={'raw':![],'where':{'id':_0x55b2dc[_0x1475('0x2a')]['id']}},_0x3e365a={};_0x3e365a[_0x1475('0x2b')]=_[_0x1475('0x2c')](db[_0x1475('0x2d')][_0x1475('0x1f')]);_0x3e365a[_0x1475('0x26')]=_[_0x1475('0x2c')](_0x55b2dc[_0x1475('0x26')]);_0x3e365a[_0x1475('0x2e')]=_[_0x1475('0x2f')](_0x3e365a[_0x1475('0x2b')],_0x3e365a[_0x1475('0x26')]);_0x166a6c['attributes']=_['intersection'](_0x3e365a[_0x1475('0x2b')],qs[_0x1475('0x30')](_0x55b2dc[_0x1475('0x26')][_0x1475('0x30')]));_0x166a6c[_0x1475('0x31')]=_0x166a6c[_0x1475('0x31')][_0x1475('0x32')]?_0x166a6c[_0x1475('0x31')]:_0x3e365a[_0x1475('0x2b')];if(_0x55b2dc['query'][_0x1475('0x33')]){_0x166a6c[_0x1475('0x34')]=[{'all':!![]}];}_0x166a6c=_[_0x1475('0x35')]({},_0x166a6c,_0x55b2dc[_0x1475('0x36')]);return db[_0x1475('0x2d')][_0x1475('0x37')](_0x166a6c)[_0x1475('0x19')](handleEntityNotFound(_0x4f925f,null))['then'](respondWithResult(_0x4f925f,null))[_0x1475('0x28')](handleError(_0x4f925f,null));};exports[_0x1475('0x38')]=function(_0x4d12c1,_0x2626ce){return db[_0x1475('0x2d')][_0x1475('0x38')](_0x4d12c1[_0x1475('0x39')],{})[_0x1475('0x19')](respondWithResult(_0x2626ce,0xc9))[_0x1475('0x28')](handleError(_0x2626ce,null));};exports[_0x1475('0x3a')]=function(_0x41a244,_0x559ef5){if(_0x41a244[_0x1475('0x39')]['id']){delete _0x41a244[_0x1475('0x39')]['id'];}return db[_0x1475('0x2d')][_0x1475('0x37')]({'where':{'id':_0x41a244[_0x1475('0x2a')]['id']}})[_0x1475('0x19')](handleEntityNotFound(_0x559ef5,null))[_0x1475('0x19')](saveUpdates(_0x41a244[_0x1475('0x39')],null))[_0x1475('0x19')](respondWithResult(_0x559ef5,null))[_0x1475('0x28')](handleError(_0x559ef5,null));};exports[_0x1475('0x3b')]=function(_0x4845e5,_0xfcc11a){return db[_0x1475('0x2d')]['find']({'where':{'id':_0x4845e5[_0x1475('0x2a')]['id']}})[_0x1475('0x19')](handleEntityNotFound(_0xfcc11a,null))['then'](removeEntity(_0xfcc11a,null))['catch'](handleError(_0xfcc11a,null));};exports['describe']=function(_0x296992,_0x499e82){return db[_0x1475('0x2d')]['describe']()[_0x1475('0x19')](respondWithResult(_0x499e82,null))[_0x1475('0x28')](handleError(_0x499e82,null));};exports[_0x1475('0x3c')]=function(_0x674aba,_0x3aa660){return db['FaxMessage']['find']({'where':{'id':_0x674aba[_0x1475('0x2a')]['id']}})[_0x1475('0x19')](handleEntityNotFound(_0x3aa660,null))['then'](function(_0x145f34){if(_0x145f34){return _0x145f34[_0x1475('0x3c')](_0x674aba['body'][_0x1475('0x3d')],_[_0x1475('0x3e')](_0x674aba['body'],[_0x1475('0x3d'),'id'])||{});}})[_0x1475('0x19')](respondWithResult(_0x3aa660,null))[_0x1475('0x28')](handleError(_0x3aa660,null));};exports[_0x1475('0x3f')]=function(_0x544862,_0x416a36){var _0xa8749b={'raw':![],'where':{}};var _0x23ea0a={};var _0x3364e9={'count':0x0,'rows':[]};return db[_0x1475('0x2d')]['findOne']({'where':{'id':_0x544862[_0x1475('0x2a')]['id']}})[_0x1475('0x19')](handleEntityNotFound(_0x416a36,null))['then'](function(_0x544ba7){if(_0x544ba7){_0x23ea0a[_0x1475('0x2b')]=_['keys'](db[_0x1475('0x40')]['rawAttributes']);_0x23ea0a[_0x1475('0x26')]=_[_0x1475('0x2c')](_0x544862[_0x1475('0x26')]);_0x23ea0a[_0x1475('0x2e')]=_[_0x1475('0x2f')](_0x23ea0a[_0x1475('0x2b')],_0x23ea0a[_0x1475('0x26')]);_0xa8749b['attributes']=_[_0x1475('0x2f')](_0x23ea0a[_0x1475('0x2b')],qs[_0x1475('0x30')](_0x544862[_0x1475('0x26')][_0x1475('0x30')]));_0xa8749b[_0x1475('0x31')]=_0xa8749b[_0x1475('0x31')][_0x1475('0x32')]?_0xa8749b[_0x1475('0x31')]:_0x23ea0a['model'];if(!_0x544862[_0x1475('0x26')][_0x1475('0x41')](_0x1475('0x42'))){_0xa8749b[_0x1475('0x14')]=qs[_0x1475('0x14')](_0x544862['query'][_0x1475('0x14')]);_0xa8749b[_0x1475('0x16')]=qs[_0x1475('0x16')](_0x544862[_0x1475('0x26')][_0x1475('0x16')]);}_0xa8749b[_0x1475('0x43')]=qs['sort'](_0x544862['query']['sort']);_0xa8749b['where']=qs['filters'](_[_0x1475('0x44')](_0x544862[_0x1475('0x26')],_0x23ea0a[_0x1475('0x2e')]));_0xa8749b[_0x1475('0x45')][_0x1475('0x46')]=_0x544ba7['id'];if(_0x544862[_0x1475('0x26')][_0x1475('0x47')]){_0xa8749b[_0x1475('0x45')]=_[_0x1475('0x35')](_0xa8749b[_0x1475('0x45')],{'$or':_[_0x1475('0x1e')](_0xa8749b[_0x1475('0x31')],function(_0x47587b){var _0x8b14fd={};_0x8b14fd[_0x47587b]={'$like':'%'+_0x544862[_0x1475('0x26')]['filter']+'%'};return _0x8b14fd;})});}if(_0x544862['query']['$gte']){var _0x3aad78=_0x544862[_0x1475('0x26')][_0x1475('0x48')][_0x1475('0x49')](',');var _0x442ebf={};_0x442ebf[_0x3aad78[0x0]]={'$gte':moment(_0x3aad78[0x1])[_0x1475('0x4a')](_0x1475('0x4b'))};_0xa8749b[_0x1475('0x45')]=_[_0x1475('0x35')](_0xa8749b[_0x1475('0x45')],_0x442ebf);}_0xa8749b=_['merge']({},_0xa8749b,_0x544862[_0x1475('0x36')]);return db['FaxMessage'][_0x1475('0x15')]({'where':_0xa8749b[_0x1475('0x45')]})[_0x1475('0x19')](function(_0xdaab6a){_0x3364e9['count']=_0xdaab6a;if(_0x544862[_0x1475('0x26')][_0x1475('0x33')]){_0xa8749b['include']=[{'all':!![]}];}return db[_0x1475('0x40')][_0x1475('0x24')](_0xa8749b);})['then'](function(_0x403d0c){_0x3364e9[_0x1475('0x4c')]=_0x403d0c;return _0x3364e9;});}})[_0x1475('0x19')](respondWithFilteredResult(_0x416a36,_0xa8749b))[_0x1475('0x28')](handleError(_0x416a36,null));};exports[_0x1475('0x4d')]=function(_0x39b76a,_0x2a0fd6){return db['FaxInteraction'][_0x1475('0x37')]({'where':{'id':_0x39b76a['params']['id']}})[_0x1475('0x19')](handleEntityNotFound(_0x2a0fd6,null))[_0x1475('0x19')](function(_0x43932d){if(_0x43932d){return _0x43932d[_0x1475('0x4e')](_0x39b76a[_0x1475('0x39')][_0x1475('0x3d')],_['omit'](_0x39b76a[_0x1475('0x39')],['ids','id'])||{})[_0x1475('0x4f')](function(){return db['Tag']['findAll']({'attributes':['id',_0x1475('0x1c'),_0x1475('0x50')],'where':{'id':_0x39b76a[_0x1475('0x39')][_0x1475('0x3d')]}});})['then'](function(_0x579d77){socket[_0x1475('0x51')]('faxInteractionTags:save',{'id':Number(_0x39b76a[_0x1475('0x2a')]['id']),'tags':_0x579d77||[]});return{'id':Number(_0x39b76a['params']['id']),'tags':_0x579d77||[]};});}})[_0x1475('0x19')](respondWithResult(_0x2a0fd6,null))[_0x1475('0x28')](handleError(_0x2a0fd6,null));};exports[_0x1475('0x52')]=function(_0x1d068b,_0x1679f0){return db[_0x1475('0x2d')]['find']({'where':{'id':_0x1d068b['params']['id']}})[_0x1475('0x19')](handleEntityNotFound(_0x1679f0,null))[_0x1475('0x19')](function(_0x1d84a5){if(_0x1d84a5){return _0x1d84a5[_0x1475('0x52')](_0x1d068b['query'][_0x1475('0x3d')]);}})[_0x1475('0x19')](respondWithStatusCode(_0x1679f0,null))['catch'](handleError(_0x1679f0,null));};exports[_0x1475('0x53')]=function(_0x4bad47,_0x11a52c){var _0x5cfb90=moment()[_0x1475('0x54')]()[_0x1475('0x55')]();var _0x7af028=path[_0x1475('0x56')](config[_0x1475('0x57')],_0x1475('0x58'),_0x1475('0x59'),_0x1475('0x5a'));var _0x10bd83=path[_0x1475('0x56')](config['root'],_0x1475('0x58'),_0x1475('0x59'),_0x1475('0x5b'));var _0x20cb7a=path[_0x1475('0x56')](_0x7af028,_0x5cfb90);var _0x2a5213=util[_0x1475('0x4a')]('transcript-%d-%s.zip',_0x4bad47[_0x1475('0x2a')]['id'],_0x5cfb90);var _0x338c44=path[_0x1475('0x56')](_0x7af028,_0x2a5213);var _0x1c223e=[];_0x1c223e['push']({'model':db[_0x1475('0x5c')],'as':_0x1475('0x5c'),'raw':!![]});var _0x38891f=[{'model':db[_0x1475('0x40')],'as':_0x1475('0x5d'),'attributes':['id','body',_0x1475('0x5e')],'include':_0x1c223e}];return db[_0x1475('0x2d')]['find']({'where':{'id':_0x4bad47[_0x1475('0x2a')]['id']},'include':_0x38891f})[_0x1475('0x19')](handleEntityNotFound(_0x11a52c,null))[_0x1475('0x19')](function(_0x435b0f){if(_0x435b0f&&_0x435b0f[_0x1475('0x5d')]){var _0x344c46=_0x435b0f[_0x1475('0x5f')]({'plain':!![]});fs['mkdirSync'](_0x20cb7a);for(var _0x6b47e0=0x0;_0x6b47e0<_0x344c46[_0x1475('0x5d')]['length'];_0x6b47e0++){var _0x1157cc=_0x344c46[_0x1475('0x5d')][_0x6b47e0][_0x1475('0x5c')];if(_0x1157cc){var _0x3842fc=path[_0x1475('0x56')](_0x10bd83,_0x1157cc[_0x1475('0x60')]);if(fs[_0x1475('0x61')](_0x3842fc)){fs[_0x1475('0x62')](_0x3842fc)[_0x1475('0x63')](fs[_0x1475('0x64')](path['join'](_0x20cb7a,_0x1157cc[_0x1475('0x60')])));}}}return BPromise[_0x1475('0x65')]()[_0x1475('0x19')](function(){return new BPromise(function(_0xac546a,_0x5ae799){zipdir(_0x20cb7a,{'saveTo':_0x338c44},function(_0x1e683d,_0x16e726){if(_0x1e683d)return _0x5ae799(_0x1e683d);return _0xac546a(_0x16e726);});})[_0x1475('0x19')](function(){return new BPromise(function(_0x1adac8,_0x498756){rimraf(_0x20cb7a,function(_0xacd69d){if(_0xacd69d)_0x498756(_0xacd69d);return _0x1adac8();});});})[_0x1475('0x19')](function(){return _0x11a52c[_0x1475('0x53')](_0x338c44,_0x2a5213,function(_0x284c8a){if(_0x284c8a){console[_0x1475('0x66')](_0x1475('0x67'),_0x284c8a);}else{fs['unlinkSync'](_0x338c44);}});});});}else{return _0x11a52c['sendStatus'](0xc8);}})['catch'](handleError(_0x11a52c,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 96f39eb..c270ca4 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 _0xa479=['save','update','remove','then','Users','map','findAll','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','setMaxListeners'];(function(_0x45799a,_0x203d8d){var _0x20b234=function(_0x3faf51){while(--_0x3faf51){_0x45799a['push'](_0x45799a['shift']());}};_0x20b234(++_0x203d8d);}(_0xa479,0x1eb));var _0x9a47=function(_0x363414,_0x34289d){_0x363414=_0x363414-0x0;var _0x2cd631=_0xa479[_0x363414];return _0x2cd631;};'use strict';var EventEmitter=require(_0x9a47('0x0'));var FaxInteraction=require(_0x9a47('0x1'))['db'][_0x9a47('0x2')];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x9a47('0x3')](0x0);var events={'afterCreate':_0x9a47('0x4'),'afterUpdate':_0x9a47('0x5'),'afterDestroy':_0x9a47('0x6')};function emitEvent(_0xd14b16){return function(_0x51aba1,_0xb4cf86,_0x4c2e7e){_0x51aba1['getUsers']({'attributes':['id'],'raw':!![]})[_0x9a47('0x7')](function(_0x9fe7db){_0x51aba1['setDataValue'](_0x9a47('0x8'),_0x9fe7db[_0x9a47('0x9')](function(_0x101f2d){return{'id':_0x101f2d['id']};}));return FaxMessage[_0x9a47('0xa')]({'where':{'FaxInteractionId':_0x51aba1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9a47('0x7')](function(_0x130ee7){_0x51aba1['setDataValue']('unreadMessages',_0x130ee7['length']);FaxInteractionEvents[_0x9a47('0xb')](_0xd14b16+':'+_0x51aba1['id'],_0x51aba1);FaxInteractionEvents[_0x9a47('0xb')](_0xd14b16,_0x51aba1);_0x4c2e7e(null);})[_0x9a47('0xc')](_0x4c2e7e(null));};}for(var e in events){if(events[_0x9a47('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x9a47('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x5ba7=['setDataValue','Users','map','findAll','then','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x5ba7,0x13c));var _0x75ba=function(_0x4f2ec9,_0x2af84c){_0x4f2ec9=_0x4f2ec9-0x0;var _0x25f8bd=_0x5ba7[_0x4f2ec9];return _0x25f8bd;};'use strict';var EventEmitter=require(_0x75ba('0x0'));var FaxInteraction=require(_0x75ba('0x1'))['db'][_0x75ba('0x2')];var FaxMessage=require(_0x75ba('0x1'))['db'][_0x75ba('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x75ba('0x4')](0x0);var events={'afterCreate':_0x75ba('0x5'),'afterUpdate':_0x75ba('0x6'),'afterDestroy':_0x75ba('0x7')};function emitEvent(_0x10cab0){return function(_0x15e7fe,_0x135131,_0x41334b){_0x15e7fe['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x5ca662){_0x15e7fe[_0x75ba('0x8')](_0x75ba('0x9'),_0x5ca662[_0x75ba('0xa')](function(_0x2c334c){return{'id':_0x2c334c['id']};}));return FaxMessage[_0x75ba('0xb')]({'where':{'FaxInteractionId':_0x15e7fe['id'],'direction':'in','read':![]},'raw':!![]});})[_0x75ba('0xc')](function(_0x4b050d){_0x15e7fe['setDataValue'](_0x75ba('0xd'),_0x4b050d['length']);FaxInteractionEvents[_0x75ba('0xe')](_0x10cab0+':'+_0x15e7fe['id'],_0x15e7fe);FaxInteractionEvents[_0x75ba('0xe')](_0x10cab0,_0x15e7fe);_0x41334b(null);})[_0x75ba('0xf')](_0x41334b(null));};}for(var e in events){if(events[_0x75ba('0x10')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x75ba('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 787dec0..5cd8c8b 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 _0x2a82=['rimraf','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','bluebird','path'];(function(_0xef4724,_0x3d22cd){var _0x4e291d=function(_0x5f8ab0){while(--_0x5f8ab0){_0xef4724['push'](_0xef4724['shift']());}};_0x4e291d(++_0x3d22cd);}(_0x2a82,0xb3));var _0x22a8=function(_0x257bf0,_0x31a0bb){_0x257bf0=_0x257bf0-0x0;var _0x749b07=_0x2a82[_0x257bf0];return _0x749b07;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x22a8('0x0'))('api');var moment=require('moment');var BPromise=require(_0x22a8('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x22a8('0x2'));var rimraf=require(_0x22a8('0x3'));var config=require(_0x22a8('0x4'));var attributes=require(_0x22a8('0x5'));module['exports']=function(_0xb6d12a,_0x12fb81){return _0xb6d12a[_0x22a8('0x6')](_0x22a8('0x7'),attributes,{'tableName':_0x22a8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1521c6,_0x172f3c,_0x19291d){if(_0x1521c6[_0x22a8('0x9')](_0x22a8('0xa'))){_0x1521c6[_0x22a8('0xb')]=moment()['format'](_0x22a8('0xc'));}_0x19291d(null,_0x1521c6);}}});}; \ No newline at end of file +var _0x279a=['util','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closedAt','format','lodash'];(function(_0x4d3559,_0x137bca){var _0x21fc72=function(_0x34cc72){while(--_0x34cc72){_0x4d3559['push'](_0x4d3559['shift']());}};_0x21fc72(++_0x137bca);}(_0x279a,0xdc));var _0xa279=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x279a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa279('0x0'));var util=require(_0xa279('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa279('0x2'));var rimraf=require(_0xa279('0x3'));var config=require(_0xa279('0x4'));var attributes=require(_0xa279('0x5'));module[_0xa279('0x6')]=function(_0x5587f9,_0x2175b7){return _0x5587f9[_0xa279('0x7')](_0xa279('0x8'),attributes,{'tableName':_0xa279('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x45db04,_0xb7a2fe,_0x181969){if(_0x45db04[_0xa279('0xa')]('closed')){_0x45db04[_0xa279('0xb')]=moment()[_0xa279('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x181969(null,_0x45db04);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index a5b8e29..a3288b4 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 _0xa4e4=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxInteraction.socket','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','update','options','raw','where','attributes','limit','AddTagsToFaxInteraction','FaxInteraction','find','addTags','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x31cc0e,_0x24ba4c){var _0x144862=function(_0x4d236e){while(--_0x4d236e){_0x31cc0e['push'](_0x31cc0e['shift']());}};_0x144862(++_0x24ba4c);}(_0xa4e4,0xd7));var _0x4a4e=function(_0x2d55a1,_0x30cb10){_0x2d55a1=_0x2d55a1-0x0;var _0x39ed86=_0xa4e4[_0x2d55a1];return _0x39ed86;};'use strict';var _=require(_0x4a4e('0x0'));var util=require(_0x4a4e('0x1'));var moment=require(_0x4a4e('0x2'));var BPromise=require(_0x4a4e('0x3'));var rs=require(_0x4a4e('0x4'));var fs=require('fs');var Redis=require(_0x4a4e('0x5'));var db=require(_0x4a4e('0x6'))['db'];var utils=require(_0x4a4e('0x7'));var logger=require(_0x4a4e('0x8'))(_0x4a4e('0x9'));var config=require(_0x4a4e('0xa'));var jayson=require(_0x4a4e('0xb'));var client=jayson[_0x4a4e('0xc')][_0x4a4e('0xd')]({'port':0x232a});config[_0x4a4e('0xe')]=_[_0x4a4e('0xf')](config['redis'],{'host':_0x4a4e('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4a4e('0x11'))['register'](socket);function respondWithRpcPromise(_0x5cc6f9,_0x22b393,_0x21ff7c){return new BPromise(function(_0x323461,_0x553f75){return client['request'](_0x5cc6f9,_0x21ff7c)[_0x4a4e('0x12')](function(_0x3f189f){logger[_0x4a4e('0x13')](_0x4a4e('0x14'),_0x22b393,_0x4a4e('0x15'));logger[_0x4a4e('0x16')](_0x4a4e('0x17'),_0x22b393,'request\x20sent',JSON[_0x4a4e('0x18')](_0x3f189f));if(_0x3f189f[_0x4a4e('0x19')]){if(_0x3f189f[_0x4a4e('0x19')][_0x4a4e('0x1a')]===0x1f4){logger[_0x4a4e('0x19')](_0x4a4e('0x14'),_0x22b393,_0x3f189f[_0x4a4e('0x19')][_0x4a4e('0x1b')]);return _0x553f75(_0x3f189f[_0x4a4e('0x19')]['message']);}logger[_0x4a4e('0x19')](_0x4a4e('0x14'),_0x22b393,_0x3f189f[_0x4a4e('0x19')]['message']);return _0x323461(_0x3f189f['error']['message']);}else{logger[_0x4a4e('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x22b393,'request\x20sent');_0x323461(_0x3f189f[_0x4a4e('0x1c')][_0x4a4e('0x1b')]);}})[_0x4a4e('0x1d')](function(_0x515a1c){logger[_0x4a4e('0x19')](_0x4a4e('0x14'),_0x22b393,_0x515a1c);_0x553f75(_0x515a1c);});});}exports[_0x4a4e('0x1e')]=function(_0x30252f){var _0x25cf9c=this;return new Promise(function(_0x6b31fa,_0x23b9e1){return db['FaxInteraction'][_0x4a4e('0x1f')](_0x30252f['body'],{'raw':_0x30252f[_0x4a4e('0x20')]?_0x30252f[_0x4a4e('0x20')][_0x4a4e('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30252f['options']?_0x30252f['options'][_0x4a4e('0x22')]||null:null,'attributes':_0x30252f[_0x4a4e('0x20')]?_0x30252f[_0x4a4e('0x20')][_0x4a4e('0x23')]||null:null,'limit':_0x30252f[_0x4a4e('0x20')]?_0x30252f['options'][_0x4a4e('0x24')]||null:null})[_0x4a4e('0x12')](function(_0x35d275){logger['info'](_0x4a4e('0x1e'),_0x30252f);logger[_0x4a4e('0x16')](_0x4a4e('0x1e'),_0x30252f,JSON[_0x4a4e('0x18')](_0x35d275));_0x6b31fa(_0x35d275);})['catch'](function(_0x482096){logger['error']('UpdateFaxInteraction',_0x482096[_0x4a4e('0x1b')],_0x30252f);_0x23b9e1(_0x25cf9c[_0x4a4e('0x19')](0x1f4,_0x482096[_0x4a4e('0x1b')]));});});};exports[_0x4a4e('0x25')]=function(_0x2c355e){return new Promise(function(_0xd3b798,_0x7eede0){return db[_0x4a4e('0x26')][_0x4a4e('0x27')]({'where':_0x2c355e[_0x4a4e('0x20')]?_0x2c355e[_0x4a4e('0x20')]['where']||null:null})[_0x4a4e('0x12')](function(_0x243c8c){if(_0x243c8c){return _0x243c8c[_0x4a4e('0x28')](_0x2c355e[_0x4a4e('0x29')][_0x4a4e('0x2a')],_['omit'](_0x2c355e['body'],['ids','id'])||{});}})[_0x4a4e('0x2b')](function(_0x369e97){logger[_0x4a4e('0x13')](_0x4a4e('0x2c'),_0x2c355e);logger['debug'](_0x4a4e('0x2c'),_0x2c355e,JSON[_0x4a4e('0x18')](_0x369e97));_0xd3b798(_0x369e97);})['catch'](function(_0x2e7ac4){logger[_0x4a4e('0x19')](_0x4a4e('0x2c'),_0x2e7ac4[_0x4a4e('0x1b')],_0x2c355e);_0x7eede0(_this[_0x4a4e('0x19')](0x1f4,_0x2e7ac4['message']));});});}; \ No newline at end of file +var _0x6951=['defaults','socket.io-emitter','./faxInteraction.socket','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','limit','then','find','where','ids','omit','spread','AddTags','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x2d4065,_0x38dc95){var _0xef6016=function(_0x195cee){while(--_0x195cee){_0x2d4065['push'](_0x2d4065['shift']());}};_0xef6016(++_0x38dc95);}(_0x6951,0x125));var _0x1695=function(_0x422efa,_0x2c1246){_0x422efa=_0x422efa-0x0;var _0x40c2c7=_0x6951[_0x422efa];return _0x40c2c7;};'use strict';var _=require(_0x1695('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1695('0x1'));var rs=require(_0x1695('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1695('0x3'))['db'];var utils=require(_0x1695('0x4'));var logger=require('../../config/logger')(_0x1695('0x5'));var config=require(_0x1695('0x6'));var jayson=require(_0x1695('0x7'));var client=jayson[_0x1695('0x8')][_0x1695('0x9')]({'port':0x232a});config[_0x1695('0xa')]=_[_0x1695('0xb')](config[_0x1695('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1695('0xc'))(new Redis(config[_0x1695('0xa')]));require(_0x1695('0xd'))['register'](socket);function respondWithRpcPromise(_0x35c65b,_0x6388c5,_0x52062c){return new BPromise(function(_0x5e6293,_0x21ee3c){return client['request'](_0x35c65b,_0x52062c)['then'](function(_0x18f86e){logger[_0x1695('0xe')](_0x1695('0xf'),_0x6388c5,_0x1695('0x10'));logger[_0x1695('0x11')](_0x1695('0x12'),_0x6388c5,_0x1695('0x10'),JSON[_0x1695('0x13')](_0x18f86e));if(_0x18f86e[_0x1695('0x14')]){if(_0x18f86e[_0x1695('0x14')][_0x1695('0x15')]===0x1f4){logger['error'](_0x1695('0xf'),_0x6388c5,_0x18f86e[_0x1695('0x14')]['message']);return _0x21ee3c(_0x18f86e['error'][_0x1695('0x16')]);}logger[_0x1695('0x14')](_0x1695('0xf'),_0x6388c5,_0x18f86e[_0x1695('0x14')]['message']);return _0x5e6293(_0x18f86e['error'][_0x1695('0x16')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x6388c5,_0x1695('0x10'));_0x5e6293(_0x18f86e[_0x1695('0x17')][_0x1695('0x16')]);}})[_0x1695('0x18')](function(_0x32c8e0){logger[_0x1695('0x14')](_0x1695('0xf'),_0x6388c5,_0x32c8e0);_0x21ee3c(_0x32c8e0);});});}exports[_0x1695('0x19')]=function(_0x39f3ed){var _0x41253e=this;return new Promise(function(_0x2e3aa2,_0x7d3a1f){return db[_0x1695('0x1a')]['update'](_0x39f3ed[_0x1695('0x1b')],{'raw':_0x39f3ed['options']?_0x39f3ed[_0x1695('0x1c')][_0x1695('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39f3ed['options']?_0x39f3ed['options']['where']||null:null,'attributes':_0x39f3ed[_0x1695('0x1c')]?_0x39f3ed[_0x1695('0x1c')]['attributes']||null:null,'limit':_0x39f3ed['options']?_0x39f3ed['options'][_0x1695('0x1e')]||null:null})[_0x1695('0x1f')](function(_0x264475){logger[_0x1695('0xe')]('UpdateFaxInteraction',_0x39f3ed);logger[_0x1695('0x11')]('UpdateFaxInteraction',_0x39f3ed,JSON[_0x1695('0x13')](_0x264475));_0x2e3aa2(_0x264475);})[_0x1695('0x18')](function(_0x1b48ef){logger[_0x1695('0x14')]('UpdateFaxInteraction',_0x1b48ef[_0x1695('0x16')],_0x39f3ed);_0x7d3a1f(_0x41253e[_0x1695('0x14')](0x1f4,_0x1b48ef['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x3773ed){return new Promise(function(_0x30deaf,_0x17b6a8){return db[_0x1695('0x1a')][_0x1695('0x20')]({'where':_0x3773ed[_0x1695('0x1c')]?_0x3773ed[_0x1695('0x1c')][_0x1695('0x21')]||null:null})[_0x1695('0x1f')](function(_0x1c1cfa){if(_0x1c1cfa){return _0x1c1cfa['addTags'](_0x3773ed['body'][_0x1695('0x22')],_[_0x1695('0x23')](_0x3773ed[_0x1695('0x1b')],['ids','id'])||{});}})[_0x1695('0x24')](function(_0x504999){logger[_0x1695('0xe')]('AddTags',_0x3773ed);logger[_0x1695('0x11')](_0x1695('0x25'),_0x3773ed,JSON[_0x1695('0x13')](_0x504999));_0x30deaf(_0x504999);})[_0x1695('0x18')](function(_0xf67c38){logger[_0x1695('0x14')](_0x1695('0x25'),_0xf67c38[_0x1695('0x16')],_0x3773ed);_0x17b6a8(_this[_0x1695('0x14')](0x1f4,_0xf67c38['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index df6c63c..af6d3bf 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 _0x93dc=['remove','emit','removeListener','register','faxInteraction:','./faxInteraction.events','save'];(function(_0x2615bb,_0x1dfa80){var _0x193937=function(_0x48adab){while(--_0x48adab){_0x2615bb['push'](_0x2615bb['shift']());}};_0x193937(++_0x1dfa80);}(_0x93dc,0x98));var _0xc93d=function(_0x5a069f,_0x4156c1){_0x5a069f=_0x5a069f-0x0;var _0x291ede=_0x93dc[_0x5a069f];return _0x291ede;};'use strict';var FaxInteractionEvents=require(_0xc93d('0x0'));var events=[_0xc93d('0x1'),_0xc93d('0x2'),'update'];function createListener(_0x2e80e0,_0x1ddd16){return function(_0x355c81){_0x1ddd16[_0xc93d('0x3')](_0x2e80e0,_0x355c81);};}function removeListener(_0x574dcf,_0x2cf87a){return function(){FaxInteractionEvents[_0xc93d('0x4')](_0x574dcf,_0x2cf87a);};}exports[_0xc93d('0x5')]=function(_0x3ebe9e){for(var _0x44897c=0x0,_0x5534ad=events['length'];_0x44897c<_0x5534ad;_0x44897c++){var _0x383274=events[_0x44897c];var _0x2f8aa9=createListener(_0xc93d('0x6')+_0x383274,_0x3ebe9e);FaxInteractionEvents['on'](_0x383274,_0x2f8aa9);}}; \ No newline at end of file +var _0x2bd1=['length','faxInteraction:','./faxInteraction.events','update','emit','removeListener','register'];(function(_0x5f36cd,_0x37d4c9){var _0x49832a=function(_0xa82985){while(--_0xa82985){_0x5f36cd['push'](_0x5f36cd['shift']());}};_0x49832a(++_0x37d4c9);}(_0x2bd1,0x19f));var _0x12bd=function(_0x223bf6,_0x54acd){_0x223bf6=_0x223bf6-0x0;var _0x5676a5=_0x2bd1[_0x223bf6];return _0x5676a5;};'use strict';var FaxInteractionEvents=require(_0x12bd('0x0'));var events=['save','remove',_0x12bd('0x1')];function createListener(_0x51aa73,_0x4d83ed){return function(_0x4b7cc5){_0x4d83ed[_0x12bd('0x2')](_0x51aa73,_0x4b7cc5);};}function removeListener(_0x5be59c,_0x5840f0){return function(){FaxInteractionEvents[_0x12bd('0x3')](_0x5be59c,_0x5840f0);};}exports[_0x12bd('0x4')]=function(_0x30952a){for(var _0x1772e3=0x0,_0x34af77=events[_0x12bd('0x5')];_0x1772e3<_0x34af77;_0x1772e3++){var _0x49d24b=events[_0x1772e3];var _0x4ed74a=createListener(_0x12bd('0x6')+_0x49d24b,_0x30952a);FaxInteractionEvents['on'](_0x49d24b,_0x4ed74a);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index ffc66d9..4caa25a 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 _0xb581=['describe','/:id','show','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','/describe','isAuthenticated'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb581,0x71));var _0x1b58=function(_0x3e6247,_0x49feff){_0x3e6247=_0x3e6247-0x0;var _0x57036a=_0xb581[_0x3e6247];return _0x57036a;};'use strict';var multer=require(_0x1b58('0x0'));var util=require('util');var path=require(_0x1b58('0x1'));var timeout=require(_0x1b58('0x2'));var express=require(_0x1b58('0x3'));var router=express[_0x1b58('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1b58('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1b58('0x6'));var controller=require(_0x1b58('0x7'));router[_0x1b58('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1b58('0x8')](_0x1b58('0x9'),auth[_0x1b58('0xa')](),controller[_0x1b58('0xb')]);router[_0x1b58('0x8')](_0x1b58('0xc'),auth[_0x1b58('0xa')](),controller[_0x1b58('0xd')]);router['get']('/:id/messages',auth[_0x1b58('0xa')](),controller[_0x1b58('0xe')]);router[_0x1b58('0x8')](_0x1b58('0xf'),auth[_0x1b58('0xa')](),controller[_0x1b58('0x10')]);router[_0x1b58('0x11')]('/',auth[_0x1b58('0xa')](),controller[_0x1b58('0x12')]);router[_0x1b58('0x11')]('/:id/messages',auth[_0x1b58('0xa')](),controller[_0x1b58('0x13')]);router[_0x1b58('0x11')](_0x1b58('0x14'),auth[_0x1b58('0xa')](),interaction[_0x1b58('0x15')](_0x1b58('0x16'),_0x1b58('0x17')),controller[_0x1b58('0x18')]);router['put']('/:id',auth[_0x1b58('0xa')](),interaction['tracked'](_0x1b58('0x16'),'faxinteraction:update'),controller[_0x1b58('0x19')]);router[_0x1b58('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x1b58('0x15')]('fax',_0x1b58('0x1b')),controller[_0x1b58('0x1c')]);router['delete'](_0x1b58('0x14'),auth[_0x1b58('0xa')](),controller[_0x1b58('0x1d')]);module[_0x1b58('0x1e')]=router; \ No newline at end of file +var _0x34a9=['faxinteraction:update','update','delete','faxinteraction:destroy','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','/:id/download','download','post','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x34a9,0x148));var _0x934a=function(_0x57486e,_0x29810e){_0x57486e=_0x57486e-0x0;var _0x40a585=_0x34a9[_0x57486e];return _0x40a585;};'use strict';var multer=require(_0x934a('0x0'));var util=require(_0x934a('0x1'));var path=require('path');var timeout=require(_0x934a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x934a('0x3'));var auth=require(_0x934a('0x4'));var interaction=require(_0x934a('0x5'));var config=require('../../config/environment');var controller=require(_0x934a('0x6'));router[_0x934a('0x7')]('/',auth[_0x934a('0x8')](),controller[_0x934a('0x9')]);router[_0x934a('0x7')](_0x934a('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x934a('0x7')](_0x934a('0xb'),auth[_0x934a('0x8')](),controller[_0x934a('0xc')]);router[_0x934a('0x7')](_0x934a('0xd'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x934a('0xe'),auth[_0x934a('0x8')](),controller[_0x934a('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x934a('0x10')]('/:id/messages',auth[_0x934a('0x8')](),controller['addMessage']);router[_0x934a('0x10')](_0x934a('0x11'),auth['isAuthenticated'](),interaction[_0x934a('0x12')](_0x934a('0x13'),_0x934a('0x14')),controller[_0x934a('0x15')]);router[_0x934a('0x16')](_0x934a('0xb'),auth[_0x934a('0x8')](),interaction[_0x934a('0x12')]('fax',_0x934a('0x17')),controller[_0x934a('0x18')]);router[_0x934a('0x19')](_0x934a('0xb'),auth[_0x934a('0x8')](),interaction['tracked'](_0x934a('0x13'),_0x934a('0x1a')),controller['destroy']);router['delete'](_0x934a('0x11'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index c623b6b..d0fc12a 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 _0xadb8=['BOOLEAN','ENUM','out','DATE','TEXT'];(function(_0x10b48a,_0x1a0a3f){var _0x2c4533=function(_0x5e4be6){while(--_0x5e4be6){_0x10b48a['push'](_0x10b48a['shift']());}};_0x2c4533(++_0x1a0a3f);}(_0xadb8,0x1d0));var _0x8adb=function(_0x3438cf,_0x73b174){_0x3438cf=_0x3438cf-0x0;var _0x278698=_0xadb8[_0x3438cf];return _0x278698;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x8adb('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8adb('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8adb('0x2')]('in',_0x8adb('0x3')),'defaultValue':_0x8adb('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x8adb('0x0')],'defaultValue':null},'readAt':{'type':Sequelize[_0x8adb('0x4')]}}; \ No newline at end of file +var _0xe829=['TEXT','ENUM','out','DATE','sequelize','exports'];(function(_0x3b45c5,_0x1b1d6a){var _0x4aacb2=function(_0x5166cd){while(--_0x5166cd){_0x3b45c5['push'](_0x3b45c5['shift']());}};_0x4aacb2(++_0x1b1d6a);}(_0xe829,0x1d8));var _0x9e82=function(_0x43f47b,_0x311636){_0x43f47b=_0x43f47b-0x0;var _0x4af9a6=_0xe829[_0x43f47b];return _0x4af9a6;};'use strict';var Sequelize=require(_0x9e82('0x0'));module[_0x9e82('0x1')]={'body':{'type':Sequelize[_0x9e82('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9e82('0x3')]('in',_0x9e82('0x4')),'defaultValue':_0x9e82('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x9e82('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x9e82('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 6e9f22c..0a468be 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 _0xf7b4=['[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','interface','channel','motionChannel','event','EventManager','acceptmessage','get','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','contact','SIP/%s','rejectmessage','create','CmContact','findOne','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','AttachmentId','download','join','root','server','files','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','pick','where','filter','options','FaxMessage','includeAll','include','findAll','rows','show','params','fields','merge','find','body','describe','fax-interactions','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','FaxInteraction','isNil','read1stAt','interaction'];(function(_0x1990c4,_0x2b9f60){var _0x3fa215=function(_0x130b05){while(--_0x130b05){_0x1990c4['push'](_0x1990c4['shift']());}};_0x3fa215(++_0x2b9f60);}(_0xf7b4,0x1ee));var _0x4f7b=function(_0x36a691,_0x12b6fb){_0x36a691=_0x36a691-0x0;var _0x295970=_0xf7b4[_0x36a691];return _0x295970;};'use strict';var emlformat=require(_0x4f7b('0x0'));var rimraf=require(_0x4f7b('0x1'));var zipdir=require(_0x4f7b('0x2'));var jsonpatch=require(_0x4f7b('0x3'));var rp=require(_0x4f7b('0x4'));var moment=require(_0x4f7b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4f7b('0x6'));var util=require(_0x4f7b('0x7'));var path=require(_0x4f7b('0x8'));var sox=require(_0x4f7b('0x9'));var csv=require(_0x4f7b('0xa'));var ejs=require(_0x4f7b('0xb'));var fs=require('fs');var fs_extra=require(_0x4f7b('0xc'));var _=require(_0x4f7b('0xd'));var squel=require(_0x4f7b('0xe'));var crypto=require(_0x4f7b('0xf'));var jsforce=require(_0x4f7b('0x10'));var deskjs=require(_0x4f7b('0x11'));var toCsv=require(_0x4f7b('0xa'));var querystring=require(_0x4f7b('0x12'));var Papa=require(_0x4f7b('0x13'));var Redis=require(_0x4f7b('0x14'));var authService=require(_0x4f7b('0x15'));var qs=require(_0x4f7b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f7b('0x17'));var logger=require(_0x4f7b('0x18'))(_0x4f7b('0x19'));var utils=require(_0x4f7b('0x1a'));var config=require(_0x4f7b('0x1b'));var licenseUtil=require(_0x4f7b('0x1c'));var db=require(_0x4f7b('0x1d'))['db'];config[_0x4f7b('0x1e')]=_[_0x4f7b('0x1f')](config[_0x4f7b('0x1e')],{'host':_0x4f7b('0x20'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f7b('0x1e')]));require(_0x4f7b('0x21'))[_0x4f7b('0x22')](socket);var jayson=require(_0x4f7b('0x23'));var client=jayson[_0x4f7b('0x24')][_0x4f7b('0x25')]({'port':0x232c});var client9002=jayson[_0x4f7b('0x24')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34180b,_0x1b4d20,_0x48d256,_0x469566){return new BPromise(function(_0xb2b180,_0xb1ba9c){var _0x365d0c=_0x469566||client;return _0x365d0c[_0x4f7b('0x26')](_0x34180b,_0x48d256)[_0x4f7b('0x27')](function(_0x3f7d7a){logger[_0x4f7b('0x28')](_0x4f7b('0x29'),_0x1b4d20,_0x4f7b('0x2a'));logger[_0x4f7b('0x2b')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x1b4d20,_0x4f7b('0x2a'),JSON['stringify'](_0x3f7d7a));if(_0x3f7d7a[_0x4f7b('0x2c')]){if(_0x3f7d7a[_0x4f7b('0x2c')][_0x4f7b('0x2d')]===0x1f4){logger[_0x4f7b('0x2c')](_0x4f7b('0x29'),_0x1b4d20,_0x3f7d7a['error'][_0x4f7b('0x2e')]);return _0xb1ba9c(_0x3f7d7a[_0x4f7b('0x2c')][_0x4f7b('0x2e')]);}logger[_0x4f7b('0x2c')](_0x4f7b('0x29'),_0x1b4d20,_0x3f7d7a[_0x4f7b('0x2c')][_0x4f7b('0x2e')]);return _0xb2b180(_0x3f7d7a[_0x4f7b('0x2c')][_0x4f7b('0x2e')]);}else{logger[_0x4f7b('0x28')](_0x4f7b('0x29'),_0x1b4d20,'request\x20sent');_0xb2b180(_0x3f7d7a['result'][_0x4f7b('0x2e')]);}})[_0x4f7b('0x2f')](function(_0x42dc1b){logger[_0x4f7b('0x2c')](_0x4f7b('0x29'),_0x1b4d20,_0x42dc1b);_0xb1ba9c(_0x42dc1b);});});}function respondWithStatusCode(_0x447362,_0x265376){_0x265376=_0x265376||0xcc;return function(_0x56bb70){if(_0x56bb70){return _0x447362[_0x4f7b('0x30')](_0x265376);}return _0x447362[_0x4f7b('0x31')](_0x265376)['end']();};}function respondWithResult(_0x33159a,_0x1f2424){_0x1f2424=_0x1f2424||0xc8;return function(_0x56c847){if(_0x56c847){return _0x33159a[_0x4f7b('0x31')](_0x1f2424)[_0x4f7b('0x32')](_0x56c847);}};}function respondWithFilteredResult(_0x29b5ba,_0x162448){return function(_0x196027){if(_0x196027){var _0x29ed38=typeof _0x162448[_0x4f7b('0x33')]===_0x4f7b('0x34')&&typeof _0x162448['limit']==='undefined';var _0x5d4f93=_0x196027['count'];var _0x11ed0c=_0x29ed38?0x0:_0x162448[_0x4f7b('0x33')];var _0x86e8a0=_0x29ed38?_0x196027[_0x4f7b('0x35')]:_0x162448[_0x4f7b('0x33')]+_0x162448[_0x4f7b('0x36')];var _0x389665;if(_0x86e8a0>=_0x5d4f93){_0x86e8a0=_0x5d4f93;_0x389665=0xc8;}else{_0x389665=0xce;}_0x29b5ba['status'](_0x389665);return _0x29b5ba['set'](_0x4f7b('0x37'),_0x11ed0c+'-'+_0x86e8a0+'/'+_0x5d4f93)[_0x4f7b('0x32')](_0x196027);}return null;};}function patchUpdates(_0x4592ba){return function(_0x209d9f){try{jsonpatch[_0x4f7b('0x38')](_0x209d9f,_0x4592ba,!![]);}catch(_0x429c14){return BPromise[_0x4f7b('0x39')](_0x429c14);}return _0x209d9f[_0x4f7b('0x3a')]();};}function saveUpdates(_0x3e9469,_0x5bd0bf){return function(_0x1b78fd){if(_0x1b78fd){return _0x1b78fd[_0x4f7b('0x3b')](_0x3e9469)[_0x4f7b('0x27')](function(_0x3a5edd){return _0x3a5edd;});}return null;};}function removeEntity(_0x5e3295,_0x17f2dc){return function(_0x14766a){if(_0x14766a){return _0x14766a[_0x4f7b('0x3c')]()[_0x4f7b('0x27')](function(){_0x5e3295[_0x4f7b('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa8c23e,_0x4ac8b1){return function(_0x420163){if(!_0x420163){_0xa8c23e[_0x4f7b('0x30')](0x194);}return _0x420163;};}function handleError(_0x2da7b5,_0x266962){_0x266962=_0x266962||0x1f4;return function(_0x2d0e59){logger['error'](_0x2d0e59[_0x4f7b('0x3d')]);if(_0x2d0e59[_0x4f7b('0x3e')]){delete _0x2d0e59['name'];}_0x2da7b5[_0x4f7b('0x31')](_0x266962)[_0x4f7b('0x3f')](_0x2d0e59);};}exports[_0x4f7b('0x40')]=function(_0x30d3cf,_0x24a12b){var _0x2308fd={},_0x19f4f3={},_0x32d03f={'count':0x0,'rows':[]};var _0x398604=_[_0x4f7b('0x41')](db['FaxMessage'][_0x4f7b('0x42')],function(_0x5b07a4){return{'name':_0x5b07a4['fieldName'],'type':_0x5b07a4[_0x4f7b('0x43')][_0x4f7b('0x44')]};});_0x19f4f3[_0x4f7b('0x45')]=_[_0x4f7b('0x41')](_0x398604,_0x4f7b('0x3e'));_0x19f4f3[_0x4f7b('0x46')]=_[_0x4f7b('0x47')](_0x30d3cf['query']);_0x19f4f3[_0x4f7b('0x48')]=_[_0x4f7b('0x49')](_0x19f4f3[_0x4f7b('0x45')],_0x19f4f3[_0x4f7b('0x46')]);_0x2308fd[_0x4f7b('0x4a')]=_[_0x4f7b('0x49')](_0x19f4f3[_0x4f7b('0x45')],qs['fields'](_0x30d3cf[_0x4f7b('0x46')]['fields']));_0x2308fd[_0x4f7b('0x4a')]=_0x2308fd['attributes'][_0x4f7b('0x4b')]?_0x2308fd[_0x4f7b('0x4a')]:_0x19f4f3[_0x4f7b('0x45')];if(!_0x30d3cf[_0x4f7b('0x46')][_0x4f7b('0x4c')]('nolimit')){_0x2308fd[_0x4f7b('0x36')]=qs[_0x4f7b('0x36')](_0x30d3cf[_0x4f7b('0x46')][_0x4f7b('0x36')]);_0x2308fd[_0x4f7b('0x33')]=qs[_0x4f7b('0x33')](_0x30d3cf['query'][_0x4f7b('0x33')]);}_0x2308fd['order']=qs['sort'](_0x30d3cf['query'][_0x4f7b('0x4d')]);_0x2308fd['where']=qs[_0x4f7b('0x48')](_[_0x4f7b('0x4e')](_0x30d3cf[_0x4f7b('0x46')],_0x19f4f3[_0x4f7b('0x48')]),_0x398604);if(_0x30d3cf['query']['filter']){_0x2308fd[_0x4f7b('0x4f')]=_['merge'](_0x2308fd[_0x4f7b('0x4f')],{'$or':_[_0x4f7b('0x41')](_0x398604,function(_0x48744b){if(_0x48744b[_0x4f7b('0x43')]!=='VIRTUAL'){var _0x249893={};_0x249893[_0x48744b[_0x4f7b('0x3e')]]={'$like':'%'+_0x30d3cf[_0x4f7b('0x46')][_0x4f7b('0x50')]+'%'};return _0x249893;}})});}_0x2308fd=_['merge']({},_0x2308fd,_0x30d3cf[_0x4f7b('0x51')]);var _0x54c52d={'where':_0x2308fd[_0x4f7b('0x4f')]};return db[_0x4f7b('0x52')][_0x4f7b('0x35')](_0x54c52d)[_0x4f7b('0x27')](function(_0x276370){_0x32d03f['count']=_0x276370;if(_0x30d3cf[_0x4f7b('0x46')][_0x4f7b('0x53')]){_0x2308fd[_0x4f7b('0x54')]=[{'all':!![]}];}return db['FaxMessage'][_0x4f7b('0x55')](_0x2308fd);})['then'](function(_0x23aff2){_0x32d03f[_0x4f7b('0x56')]=_0x23aff2;return _0x32d03f;})['then'](respondWithFilteredResult(_0x24a12b,_0x2308fd))[_0x4f7b('0x2f')](handleError(_0x24a12b,null));};exports[_0x4f7b('0x57')]=function(_0x9270a8,_0x1f9130){var _0x1b3ce1={'raw':!![],'where':{'id':_0x9270a8[_0x4f7b('0x58')]['id']}},_0x236926={};_0x236926['model']=_[_0x4f7b('0x47')](db[_0x4f7b('0x52')][_0x4f7b('0x42')]);_0x236926['query']=_[_0x4f7b('0x47')](_0x9270a8[_0x4f7b('0x46')]);_0x236926[_0x4f7b('0x48')]=_[_0x4f7b('0x49')](_0x236926[_0x4f7b('0x45')],_0x236926[_0x4f7b('0x46')]);_0x1b3ce1[_0x4f7b('0x4a')]=_[_0x4f7b('0x49')](_0x236926[_0x4f7b('0x45')],qs[_0x4f7b('0x59')](_0x9270a8[_0x4f7b('0x46')]['fields']));_0x1b3ce1['attributes']=_0x1b3ce1['attributes'][_0x4f7b('0x4b')]?_0x1b3ce1[_0x4f7b('0x4a')]:_0x236926[_0x4f7b('0x45')];if(_0x9270a8[_0x4f7b('0x46')][_0x4f7b('0x53')]){_0x1b3ce1[_0x4f7b('0x54')]=[{'all':!![]}];}_0x1b3ce1=_[_0x4f7b('0x5a')]({},_0x1b3ce1,_0x9270a8[_0x4f7b('0x51')]);return db[_0x4f7b('0x52')][_0x4f7b('0x5b')](_0x1b3ce1)[_0x4f7b('0x27')](handleEntityNotFound(_0x1f9130,null))['then'](respondWithResult(_0x1f9130,null))['catch'](handleError(_0x1f9130,null));};exports['update']=function(_0x3ffdfc,_0x5452df){if(_0x3ffdfc['body']['id']){delete _0x3ffdfc[_0x4f7b('0x5c')]['id'];}return db[_0x4f7b('0x52')]['find']({'where':{'id':_0x3ffdfc['params']['id']}})[_0x4f7b('0x27')](handleEntityNotFound(_0x5452df,null))[_0x4f7b('0x27')](saveUpdates(_0x3ffdfc[_0x4f7b('0x5c')],null))['then'](respondWithResult(_0x5452df,null))['catch'](handleError(_0x5452df,null));};exports[_0x4f7b('0x3c')]=function(_0x350822,_0x31abb0){return db['FaxMessage'][_0x4f7b('0x5b')]({'where':{'id':_0x350822['params']['id']}})['then'](handleEntityNotFound(_0x31abb0,null))[_0x4f7b('0x27')](removeEntity(_0x31abb0,null))[_0x4f7b('0x2f')](handleError(_0x31abb0,null));};exports[_0x4f7b('0x5d')]=function(_0x594650,_0x4e4a74){return db[_0x4f7b('0x52')]['describe']()[_0x4f7b('0x27')](respondWithResult(_0x4e4a74,null))[_0x4f7b('0x2f')](handleError(_0x4e4a74,null));};var interaction_log=require(_0x4f7b('0x18'))(_0x4f7b('0x5e'));exports['accept']=function(_0x4788f8,_0x457c73,_0x191543){var _0x42ec68={'agent':{},'channel':_0x4f7b('0x5f')};if(_0x4788f8['body']['id']){delete _0x4788f8[_0x4f7b('0x5c')]['id'];}_0x4788f8['body'][_0x4f7b('0x60')]=!![];_0x4788f8[_0x4f7b('0x5c')][_0x4f7b('0x61')]=moment()[_0x4f7b('0x62')](_0x4f7b('0x63'));_0x4788f8[_0x4f7b('0x5c')]['UserId']=_0x4788f8['body'][_0x4f7b('0x64')]||_0x4788f8[_0x4f7b('0x65')]['id'];_0x42ec68['agent']['id']=_0x4788f8[_0x4f7b('0x5c')][_0x4f7b('0x64')];return db[_0x4f7b('0x52')][_0x4f7b('0x5b')]({'where':{'id':_0x4788f8[_0x4f7b('0x58')]['id'],'UserId':null}})[_0x4f7b('0x27')](handleEntityNotFound(_0x457c73,null))[_0x4f7b('0x27')](saveUpdates(_0x4788f8['body'],null))[_0x4f7b('0x27')](function(_0x30ee41){if(_0x30ee41){_0x42ec68[_0x4f7b('0x2e')]=_0x30ee41['get']({'plain':!![]});return db[_0x4f7b('0x66')]['find']({'where':{'id':_0x30ee41['FaxInteractionId']}});}return null;})[_0x4f7b('0x27')](handleEntityNotFound(_0x457c73,null))[_0x4f7b('0x27')](function(_0x1e789){if(_0x1e789){return _0x1e789[_0x4f7b('0x3b')]({'UserId':_0x4788f8[_0x4f7b('0x5c')]['UserId'],'read1stAt':_[_0x4f7b('0x67')](_0x1e789[_0x4f7b('0x68')])?moment()[_0x4f7b('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x4f7b('0x27')](function(_0x5f2e99){if(_0x5f2e99){_0x42ec68[_0x4f7b('0x69')]=_0x5f2e99['get']({'plain':!![]});interaction_log['info'](_0x4f7b('0x6a'),_0x4788f8['user']['id'],_0x4788f8[_0x4f7b('0x65')][_0x4f7b('0x3e')],_0x4788f8[_0x4f7b('0x65')]['role'],_0x42ec68['interaction']['id'],_0x4788f8[_0x4f7b('0x5c')]?JSON[_0x4f7b('0x6b')](_0x4788f8[_0x4f7b('0x5c')]):_0x4f7b('0x6c'));return respondWithRpcPromise(_0x4f7b('0x6d'),_0x4f7b('0x6e'),_0x42ec68);}return null;})[_0x4f7b('0x27')](function(_0x269de1){var _0x41e107='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x269de1[_0x4f7b('0x2e')][_0x4f7b('0x6f')];return db['sequelize'][_0x4f7b('0x46')](_0x41e107,{'type':db[_0x4f7b('0x70')][_0x4f7b('0x71')][_0x4f7b('0x72')],'raw':!![]})[_0x4f7b('0x27')](function(_0x10bbdf){return _0x10bbdf;});})['then'](function(_0x104c9c){if(_0x104c9c){_0x42ec68[_0x4f7b('0x2e')]['contact']=_0x104c9c[0x0];if(!_0x4788f8[_0x4f7b('0x5c')][_0x4f7b('0x64')])return;return db[_0x4f7b('0x73')][_0x4f7b('0x5b')]({'where':{'id':_0x4788f8['body'][_0x4f7b('0x64')],'role':_0x4f7b('0x74')},'attributes':['id',_0x4f7b('0x3e'),_0x4f7b('0x75'),_0x4f7b('0x76'),_0x4f7b('0x77')],'raw':!![]});}return null;})['then'](function(_0x4897c3){if(!_0x4897c3)return null;_0x42ec68[_0x4f7b('0x2e')]['agent']=_0x4897c3;return _0x42ec68;})['then'](function(_0x145531){if(_0x145531){if(_0x4788f8['body']['manual']){_0x42ec68[_0x4f7b('0x2e')][_0x4f7b('0x78')]=util[_0x4f7b('0x62')]('SIP/%s',_0x4788f8[_0x4f7b('0x65')][_0x4f7b('0x3e')]);_0x42ec68[_0x4f7b('0x2e')][_0x4f7b('0x79')]=_0x42ec68['channel'];_0x42ec68[_0x4f7b('0x2e')][_0x4f7b('0x7a')]=_0x42ec68['channel'];_0x42ec68[_0x4f7b('0x2e')][_0x4f7b('0x7b')]='accept';return respondWithRpcPromise(_0x4f7b('0x7c'),_0x4f7b('0x7c'),{'event':_0x4f7b('0x7d'),'message':_0x42ec68['message']},client9002)[_0x4f7b('0x27')](function(){return _0x42ec68;});}return _0x42ec68;}return null;})[_0x4f7b('0x27')](respondWithResult(_0x457c73,null))['catch'](handleError(_0x457c73,null));};var interaction_log=require(_0x4f7b('0x18'))(_0x4f7b('0x5e'));exports['reject']=function(_0x503cca,_0x1b5c7b,_0x576dd2){var _0x3d556e={'agent':{},'channel':_0x4f7b('0x5f')};if(_0x503cca[_0x4f7b('0x5c')]['id']){delete _0x503cca[_0x4f7b('0x5c')]['id'];}_0x503cca[_0x4f7b('0x5c')][_0x4f7b('0x64')]=_0x503cca[_0x4f7b('0x5c')]['UserId']||_0x503cca['user']['id'];_0x3d556e[_0x4f7b('0x74')]['id']=_0x503cca['body']['UserId'];return db['FaxMessage']['find']({'where':{'id':_0x503cca[_0x4f7b('0x58')]['id'],'UserId':null}})[_0x4f7b('0x27')](handleEntityNotFound(_0x1b5c7b,null))[_0x4f7b('0x27')](function(_0x540756){if(_0x540756){_0x3d556e['message']=_0x540756[_0x4f7b('0x7e')]({'plain':!![]});return db[_0x4f7b('0x66')][_0x4f7b('0x5b')]({'where':{'id':_0x540756[_0x4f7b('0x7f')]}});}return null;})[_0x4f7b('0x27')](handleEntityNotFound(_0x1b5c7b,null))[_0x4f7b('0x27')](function(_0x5bbff0){if(_0x5bbff0){_0x3d556e['interaction']=_0x5bbff0[_0x4f7b('0x7e')]({'plain':!![]});interaction_log[_0x4f7b('0x28')](_0x4f7b('0x80'),_0x503cca['user']['id'],_0x503cca[_0x4f7b('0x65')][_0x4f7b('0x3e')],_0x503cca[_0x4f7b('0x65')][_0x4f7b('0x81')],_0x3d556e[_0x4f7b('0x69')]['id'],_0x503cca[_0x4f7b('0x5c')]?JSON[_0x4f7b('0x6b')](_0x503cca[_0x4f7b('0x5c')]):_0x4f7b('0x6c'));return respondWithRpcPromise(_0x4f7b('0x82'),_0x4f7b('0x83'),_0x3d556e);}return null;})[_0x4f7b('0x27')](function(_0x5570ec){var _0x58849a=_0x4f7b('0x84')+_0x5570ec[_0x4f7b('0x2e')]['ContactId'];return db[_0x4f7b('0x85')][_0x4f7b('0x46')](_0x58849a,{'type':db[_0x4f7b('0x70')][_0x4f7b('0x71')][_0x4f7b('0x72')],'raw':!![]})[_0x4f7b('0x27')](function(_0x384e05){return _0x384e05;});})[_0x4f7b('0x27')](function(_0x2e6c3b){if(_0x2e6c3b){_0x3d556e['message'][_0x4f7b('0x86')]=_0x2e6c3b[0x0];if(!_0x503cca[_0x4f7b('0x5c')]['UserId'])return;return db[_0x4f7b('0x73')][_0x4f7b('0x5b')]({'where':{'id':_0x503cca[_0x4f7b('0x5c')]['UserId'],'role':_0x4f7b('0x74')},'attributes':['id','name',_0x4f7b('0x75'),_0x4f7b('0x76'),_0x4f7b('0x77')],'raw':!![]});}return null;})[_0x4f7b('0x27')](function(_0x129abd){if(!_0x129abd)return null;_0x3d556e[_0x4f7b('0x2e')][_0x4f7b('0x74')]=_0x129abd;return _0x3d556e;})[_0x4f7b('0x27')](function(_0x10f2a1){if(_0x10f2a1){_0x10f2a1['message'][_0x4f7b('0x78')]=util['format'](_0x4f7b('0x87'),_0x503cca[_0x4f7b('0x65')][_0x4f7b('0x3e')]);_0x10f2a1[_0x4f7b('0x2e')][_0x4f7b('0x79')]=_0x3d556e[_0x4f7b('0x79')];_0x10f2a1[_0x4f7b('0x2e')]['motionChannel']=_0x3d556e['channel'];_0x10f2a1[_0x4f7b('0x2e')][_0x4f7b('0x7b')]='reject';respondWithRpcPromise('EventManager',_0x4f7b('0x7c'),{'event':_0x4f7b('0x88'),'message':_0x10f2a1[_0x4f7b('0x2e')]},client9002);return _0x3d556e;}return null;})[_0x4f7b('0x27')](respondWithResult(_0x1b5c7b,null))['catch'](handleError(_0x1b5c7b,null));};exports[_0x4f7b('0x89')]=function(_0x109a98,_0x126b20){var _0xee2f2c;return db['FaxMessage'][_0x4f7b('0x89')](_0x109a98[_0x4f7b('0x5c')],{})[_0x4f7b('0x27')](function(_0x5e4d7a){_0xee2f2c=_0x5e4d7a;return db[_0x4f7b('0x8a')][_0x4f7b('0x8b')]({'where':{'id':_0xee2f2c['ContactId']}});})[_0x4f7b('0x27')](function(_0x4e50e0){if(_['isNil'](_0x4e50e0)){return;}else{_0xee2f2c[_0x4f7b('0x5f')]=_0x4e50e0[_0x4f7b('0x5f')];return db[_0x4f7b('0x8c')][_0x4f7b('0x8b')]({'where':{'id':_0xee2f2c['AttachmentId']}});}})[_0x4f7b('0x27')](function(_0x4688a6){return respondWithRpcPromise(_0x4f7b('0x8d'),_0x4f7b('0x8d'),{'FaxAccountId':_[_0x4f7b('0x67')](_0x109a98[_0x4f7b('0x5c')])?undefined:_0x109a98[_0x4f7b('0x5c')][_0x4f7b('0x8e')],'path':_[_0x4f7b('0x67')](_0x4688a6)?undefined:util[_0x4f7b('0x62')](_0x4f7b('0x8f'),_0x4688a6['basename']),'fax':_[_0x4f7b('0x67')](_0xee2f2c['fax'])?undefined:_0xee2f2c[_0x4f7b('0x5f')],'AttachmentId':_0xee2f2c[_0x4f7b('0x90')]},client9002);})[_0x4f7b('0x27')](respondWithResult(_0x126b20,0xc9))[_0x4f7b('0x2f')](handleError(_0x126b20,null));};exports[_0x4f7b('0x91')]=function(_0x126495,_0x1b6b67){var _0x386a23=path[_0x4f7b('0x92')](config[_0x4f7b('0x93')],_0x4f7b('0x94'),_0x4f7b('0x95'),'attachments');return db[_0x4f7b('0x52')][_0x4f7b('0x5b')]({'where':{'id':_0x126495['params']['id']},'include':[{'model':db['Attachment'],'as':_0x4f7b('0x8c')}]})['then'](handleEntityNotFound(_0x1b6b67,null))[_0x4f7b('0x27')](function(_0x126469){if(_0x126469){return _0x1b6b67[_0x4f7b('0x91')](path[_0x4f7b('0x92')](_0x386a23,_0x126469['Attachment']['basename']));}})[_0x4f7b('0x2f')](handleError(_0x1b6b67,null));}; \ No newline at end of file +var _0x0617=['internal','manual','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','FaxInteraction','FaxInteractionId','RejectMessage','rejectMessage','QueryTypes','event','rejectmessage','create','CmContact','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','basename','download','server','files','join','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','./faxMessage.socket','register','http','request','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxMessage','include','then','rows','show','params','includeAll','find','update','body','describe','fax-interactions','fax','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','isNil','format','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','agent','fullname','email'];(function(_0x49aa7d,_0x5d46d8){var _0xdd0d26=function(_0x159df7){while(--_0x159df7){_0x49aa7d['push'](_0x49aa7d['shift']());}};_0xdd0d26(++_0x5d46d8);}(_0x0617,0x1c6));var _0x7061=function(_0x4fd791,_0x180648){_0x4fd791=_0x4fd791-0x0;var _0x30c89e=_0x0617[_0x4fd791];return _0x30c89e;};'use strict';var emlformat=require(_0x7061('0x0'));var rimraf=require(_0x7061('0x1'));var zipdir=require(_0x7061('0x2'));var jsonpatch=require(_0x7061('0x3'));var rp=require(_0x7061('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7061('0x5'));var path=require(_0x7061('0x6'));var sox=require('sox');var csv=require(_0x7061('0x7'));var ejs=require(_0x7061('0x8'));var fs=require('fs');var fs_extra=require(_0x7061('0x9'));var _=require(_0x7061('0xa'));var squel=require('squel');var crypto=require(_0x7061('0xb'));var jsforce=require(_0x7061('0xc'));var deskjs=require(_0x7061('0xd'));var toCsv=require(_0x7061('0x7'));var querystring=require(_0x7061('0xe'));var Papa=require(_0x7061('0xf'));var Redis=require(_0x7061('0x10'));var authService=require(_0x7061('0x11'));var qs=require(_0x7061('0x12'));var as=require(_0x7061('0x13'));var hardwareService=require(_0x7061('0x14'));var logger=require(_0x7061('0x15'))('api');var utils=require(_0x7061('0x16'));var config=require(_0x7061('0x17'));var licenseUtil=require(_0x7061('0x18'));var db=require(_0x7061('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7061('0x1a'))(new Redis(config['redis']));require(_0x7061('0x1b'))[_0x7061('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x7061('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x36e046,_0x5965ee,_0xcbaca6,_0x5b00a9){return new BPromise(function(_0x47fe48,_0x56ab46){var _0x3d5ea4=_0x5b00a9||client;return _0x3d5ea4[_0x7061('0x1e')](_0x36e046,_0xcbaca6)['then'](function(_0x1ba08c){logger[_0x7061('0x1f')](_0x7061('0x20'),_0x5965ee,'request\x20sent');logger[_0x7061('0x21')](_0x7061('0x22'),_0x5965ee,_0x7061('0x23'),JSON['stringify'](_0x1ba08c));if(_0x1ba08c[_0x7061('0x24')]){if(_0x1ba08c[_0x7061('0x24')][_0x7061('0x25')]===0x1f4){logger[_0x7061('0x24')]('FaxMessage,\x20%s,\x20%s',_0x5965ee,_0x1ba08c['error']['message']);return _0x56ab46(_0x1ba08c['error'][_0x7061('0x26')]);}logger[_0x7061('0x24')](_0x7061('0x20'),_0x5965ee,_0x1ba08c[_0x7061('0x24')][_0x7061('0x26')]);return _0x47fe48(_0x1ba08c[_0x7061('0x24')][_0x7061('0x26')]);}else{logger['info'](_0x7061('0x20'),_0x5965ee,'request\x20sent');_0x47fe48(_0x1ba08c[_0x7061('0x27')][_0x7061('0x26')]);}})[_0x7061('0x28')](function(_0x20cbc7){logger[_0x7061('0x24')]('FaxMessage,\x20%s,\x20%s',_0x5965ee,_0x20cbc7);_0x56ab46(_0x20cbc7);});});}function respondWithStatusCode(_0x1bb23b,_0x43e344){_0x43e344=_0x43e344||0xcc;return function(_0x4a63b3){if(_0x4a63b3){return _0x1bb23b[_0x7061('0x29')](_0x43e344);}return _0x1bb23b[_0x7061('0x2a')](_0x43e344)[_0x7061('0x2b')]();};}function respondWithResult(_0x5dec6a,_0x5e2544){_0x5e2544=_0x5e2544||0xc8;return function(_0x28add9){if(_0x28add9){return _0x5dec6a[_0x7061('0x2a')](_0x5e2544)[_0x7061('0x2c')](_0x28add9);}};}function respondWithFilteredResult(_0x51f33f,_0x547664){return function(_0x5f3a91){if(_0x5f3a91){var _0x56d619=typeof _0x547664[_0x7061('0x2d')]===_0x7061('0x2e')&&typeof _0x547664[_0x7061('0x2f')]===_0x7061('0x2e');var _0x369b82=_0x5f3a91['count'];var _0xcafb5c=_0x56d619?0x0:_0x547664[_0x7061('0x2d')];var _0x18e75f=_0x56d619?_0x5f3a91[_0x7061('0x30')]:_0x547664[_0x7061('0x2d')]+_0x547664['limit'];var _0x14b3dc;if(_0x18e75f>=_0x369b82){_0x18e75f=_0x369b82;_0x14b3dc=0xc8;}else{_0x14b3dc=0xce;}_0x51f33f[_0x7061('0x2a')](_0x14b3dc);return _0x51f33f[_0x7061('0x31')]('Content-Range',_0xcafb5c+'-'+_0x18e75f+'/'+_0x369b82)[_0x7061('0x2c')](_0x5f3a91);}return null;};}function patchUpdates(_0x5bb661){return function(_0x37f5ab){try{jsonpatch[_0x7061('0x32')](_0x37f5ab,_0x5bb661,!![]);}catch(_0x2bdd4b){return BPromise[_0x7061('0x33')](_0x2bdd4b);}return _0x37f5ab[_0x7061('0x34')]();};}function saveUpdates(_0x5e51c5,_0x3251db){return function(_0x2d8936){if(_0x2d8936){return _0x2d8936['update'](_0x5e51c5)['then'](function(_0x1d9047){return _0x1d9047;});}return null;};}function removeEntity(_0x7843ec,_0x1f4d9f){return function(_0x192732){if(_0x192732){return _0x192732[_0x7061('0x35')]()['then'](function(){_0x7843ec[_0x7061('0x2a')](0xcc)[_0x7061('0x2b')]();});}};}function handleEntityNotFound(_0x398f88,_0x4c85a3){return function(_0x418d97){if(!_0x418d97){_0x398f88[_0x7061('0x29')](0x194);}return _0x418d97;};}function handleError(_0x1636ce,_0x468503){_0x468503=_0x468503||0x1f4;return function(_0x17acac){logger[_0x7061('0x24')](_0x17acac[_0x7061('0x36')]);if(_0x17acac[_0x7061('0x37')]){delete _0x17acac['name'];}_0x1636ce[_0x7061('0x2a')](_0x468503)[_0x7061('0x38')](_0x17acac);};}exports[_0x7061('0x39')]=function(_0x18d78c,_0x141c7f){var _0x1a6aa1={},_0x1375b0={},_0x131e6c={'count':0x0,'rows':[]};var _0x282c1f=_[_0x7061('0x3a')](db['FaxMessage'][_0x7061('0x3b')],function(_0x5688a0){return{'name':_0x5688a0[_0x7061('0x3c')],'type':_0x5688a0[_0x7061('0x3d')][_0x7061('0x3e')]};});_0x1375b0[_0x7061('0x3f')]=_[_0x7061('0x3a')](_0x282c1f,_0x7061('0x37'));_0x1375b0[_0x7061('0x40')]=_[_0x7061('0x41')](_0x18d78c['query']);_0x1375b0[_0x7061('0x42')]=_[_0x7061('0x43')](_0x1375b0[_0x7061('0x3f')],_0x1375b0[_0x7061('0x40')]);_0x1a6aa1[_0x7061('0x44')]=_[_0x7061('0x43')](_0x1375b0[_0x7061('0x3f')],qs['fields'](_0x18d78c[_0x7061('0x40')][_0x7061('0x45')]));_0x1a6aa1[_0x7061('0x44')]=_0x1a6aa1[_0x7061('0x44')][_0x7061('0x46')]?_0x1a6aa1[_0x7061('0x44')]:_0x1375b0['model'];if(!_0x18d78c[_0x7061('0x40')][_0x7061('0x47')]('nolimit')){_0x1a6aa1['limit']=qs[_0x7061('0x2f')](_0x18d78c['query'][_0x7061('0x2f')]);_0x1a6aa1[_0x7061('0x2d')]=qs[_0x7061('0x2d')](_0x18d78c['query'][_0x7061('0x2d')]);}_0x1a6aa1[_0x7061('0x48')]=qs['sort'](_0x18d78c[_0x7061('0x40')][_0x7061('0x49')]);_0x1a6aa1[_0x7061('0x4a')]=qs[_0x7061('0x42')](_[_0x7061('0x4b')](_0x18d78c['query'],_0x1375b0['filters']),_0x282c1f);if(_0x18d78c[_0x7061('0x40')][_0x7061('0x4c')]){_0x1a6aa1[_0x7061('0x4a')]=_[_0x7061('0x4d')](_0x1a6aa1[_0x7061('0x4a')],{'$or':_[_0x7061('0x3a')](_0x282c1f,function(_0x43bdda){if(_0x43bdda[_0x7061('0x3d')]!==_0x7061('0x4e')){var _0x488928={};_0x488928[_0x43bdda[_0x7061('0x37')]]={'$like':'%'+_0x18d78c[_0x7061('0x40')][_0x7061('0x4c')]+'%'};return _0x488928;}})});}_0x1a6aa1=_[_0x7061('0x4d')]({},_0x1a6aa1,_0x18d78c[_0x7061('0x4f')]);var _0x34a47d={'where':_0x1a6aa1[_0x7061('0x4a')]};return db[_0x7061('0x50')][_0x7061('0x30')](_0x34a47d)['then'](function(_0xbab31f){_0x131e6c['count']=_0xbab31f;if(_0x18d78c[_0x7061('0x40')]['includeAll']){_0x1a6aa1[_0x7061('0x51')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x1a6aa1);})[_0x7061('0x52')](function(_0xb4c0db){_0x131e6c[_0x7061('0x53')]=_0xb4c0db;return _0x131e6c;})[_0x7061('0x52')](respondWithFilteredResult(_0x141c7f,_0x1a6aa1))[_0x7061('0x28')](handleError(_0x141c7f,null));};exports[_0x7061('0x54')]=function(_0x12377e,_0x105f15){var _0x47c71f={'raw':!![],'where':{'id':_0x12377e[_0x7061('0x55')]['id']}},_0x3601cb={};_0x3601cb[_0x7061('0x3f')]=_[_0x7061('0x41')](db[_0x7061('0x50')][_0x7061('0x3b')]);_0x3601cb[_0x7061('0x40')]=_[_0x7061('0x41')](_0x12377e[_0x7061('0x40')]);_0x3601cb['filters']=_[_0x7061('0x43')](_0x3601cb[_0x7061('0x3f')],_0x3601cb[_0x7061('0x40')]);_0x47c71f[_0x7061('0x44')]=_[_0x7061('0x43')](_0x3601cb[_0x7061('0x3f')],qs[_0x7061('0x45')](_0x12377e['query']['fields']));_0x47c71f['attributes']=_0x47c71f[_0x7061('0x44')][_0x7061('0x46')]?_0x47c71f[_0x7061('0x44')]:_0x3601cb[_0x7061('0x3f')];if(_0x12377e[_0x7061('0x40')][_0x7061('0x56')]){_0x47c71f[_0x7061('0x51')]=[{'all':!![]}];}_0x47c71f=_[_0x7061('0x4d')]({},_0x47c71f,_0x12377e[_0x7061('0x4f')]);return db['FaxMessage'][_0x7061('0x57')](_0x47c71f)['then'](handleEntityNotFound(_0x105f15,null))[_0x7061('0x52')](respondWithResult(_0x105f15,null))['catch'](handleError(_0x105f15,null));};exports[_0x7061('0x58')]=function(_0x3d73cc,_0x188415){if(_0x3d73cc[_0x7061('0x59')]['id']){delete _0x3d73cc[_0x7061('0x59')]['id'];}return db[_0x7061('0x50')][_0x7061('0x57')]({'where':{'id':_0x3d73cc[_0x7061('0x55')]['id']}})[_0x7061('0x52')](handleEntityNotFound(_0x188415,null))['then'](saveUpdates(_0x3d73cc[_0x7061('0x59')],null))[_0x7061('0x52')](respondWithResult(_0x188415,null))[_0x7061('0x28')](handleError(_0x188415,null));};exports[_0x7061('0x35')]=function(_0x311a8a,_0x6ac885){return db['FaxMessage']['find']({'where':{'id':_0x311a8a[_0x7061('0x55')]['id']}})['then'](handleEntityNotFound(_0x6ac885,null))[_0x7061('0x52')](removeEntity(_0x6ac885,null))[_0x7061('0x28')](handleError(_0x6ac885,null));};exports[_0x7061('0x5a')]=function(_0x21e766,_0xf55c7c){return db['FaxMessage'][_0x7061('0x5a')]()[_0x7061('0x52')](respondWithResult(_0xf55c7c,null))[_0x7061('0x28')](handleError(_0xf55c7c,null));};var interaction_log=require('../../config/logger')(_0x7061('0x5b'));exports['accept']=function(_0x5deba4,_0x40e97d,_0x55abbd){var _0x27c186={'agent':{},'channel':_0x7061('0x5c')};if(_0x5deba4[_0x7061('0x59')]['id']){delete _0x5deba4[_0x7061('0x59')]['id'];}_0x5deba4[_0x7061('0x59')]['read']=!![];_0x5deba4[_0x7061('0x59')][_0x7061('0x5d')]=moment()['format'](_0x7061('0x5e'));_0x5deba4[_0x7061('0x59')][_0x7061('0x5f')]=_0x5deba4[_0x7061('0x59')][_0x7061('0x5f')]||_0x5deba4['user']['id'];_0x27c186['agent']['id']=_0x5deba4[_0x7061('0x59')]['UserId'];return db[_0x7061('0x50')][_0x7061('0x57')]({'where':{'id':_0x5deba4[_0x7061('0x55')]['id'],'UserId':null}})[_0x7061('0x52')](handleEntityNotFound(_0x40e97d,null))[_0x7061('0x52')](saveUpdates(_0x5deba4['body'],null))['then'](function(_0x27f4e6){if(_0x27f4e6){_0x27c186[_0x7061('0x26')]=_0x27f4e6['get']({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x27f4e6['FaxInteractionId']}});}return null;})[_0x7061('0x52')](handleEntityNotFound(_0x40e97d,null))['then'](function(_0x166c59){if(_0x166c59){return _0x166c59[_0x7061('0x58')]({'UserId':_0x5deba4[_0x7061('0x59')][_0x7061('0x5f')],'read1stAt':_[_0x7061('0x60')](_0x166c59['read1stAt'])?moment()[_0x7061('0x61')](_0x7061('0x5e')):undefined});}return null;})[_0x7061('0x52')](function(_0x312657){if(_0x312657){_0x27c186[_0x7061('0x62')]=_0x312657[_0x7061('0x63')]({'plain':!![]});interaction_log['info'](_0x7061('0x64'),_0x5deba4[_0x7061('0x65')]['id'],_0x5deba4[_0x7061('0x65')][_0x7061('0x37')],_0x5deba4[_0x7061('0x65')][_0x7061('0x66')],_0x27c186['interaction']['id'],_0x5deba4[_0x7061('0x59')]?JSON[_0x7061('0x67')](_0x5deba4[_0x7061('0x59')]):'null');return respondWithRpcPromise('AcceptMessage',_0x7061('0x68'),_0x27c186);}return null;})[_0x7061('0x52')](function(_0x4df5ac){var _0x19dc2b=_0x7061('0x69')+_0x4df5ac[_0x7061('0x26')][_0x7061('0x6a')];return db[_0x7061('0x6b')]['query'](_0x19dc2b,{'type':db[_0x7061('0x6c')]['QueryTypes'][_0x7061('0x6d')],'raw':!![]})['then'](function(_0x9fa385){return _0x9fa385;});})['then'](function(_0x520d49){if(_0x520d49){_0x27c186[_0x7061('0x26')][_0x7061('0x6e')]=_0x520d49[0x0];if(!_0x5deba4[_0x7061('0x59')]['UserId'])return;return db['User'][_0x7061('0x57')]({'where':{'id':_0x5deba4[_0x7061('0x59')][_0x7061('0x5f')],'role':_0x7061('0x6f')},'attributes':['id','name',_0x7061('0x70'),_0x7061('0x71'),_0x7061('0x72')],'raw':!![]});}return null;})['then'](function(_0x5bea86){if(!_0x5bea86)return null;_0x27c186[_0x7061('0x26')][_0x7061('0x6f')]=_0x5bea86;return _0x27c186;})[_0x7061('0x52')](function(_0x319e76){if(_0x319e76){if(_0x5deba4[_0x7061('0x59')][_0x7061('0x73')]){_0x27c186[_0x7061('0x26')][_0x7061('0x74')]=util[_0x7061('0x61')](_0x7061('0x75'),_0x5deba4[_0x7061('0x65')][_0x7061('0x37')]);_0x27c186[_0x7061('0x26')][_0x7061('0x76')]=_0x27c186[_0x7061('0x76')];_0x27c186[_0x7061('0x26')][_0x7061('0x77')]=_0x27c186[_0x7061('0x76')];_0x27c186[_0x7061('0x26')]['event']=_0x7061('0x78');return respondWithRpcPromise('EventManager',_0x7061('0x79'),{'event':_0x7061('0x7a'),'message':_0x27c186[_0x7061('0x26')]},client9002)['then'](function(){return _0x27c186;});}return _0x27c186;}return null;})[_0x7061('0x52')](respondWithResult(_0x40e97d,null))[_0x7061('0x28')](handleError(_0x40e97d,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x7061('0x33')]=function(_0x561fa5,_0x592a29,_0x5077f2){var _0x45dbe1={'agent':{},'channel':'fax'};if(_0x561fa5[_0x7061('0x59')]['id']){delete _0x561fa5['body']['id'];}_0x561fa5[_0x7061('0x59')][_0x7061('0x5f')]=_0x561fa5[_0x7061('0x59')]['UserId']||_0x561fa5[_0x7061('0x65')]['id'];_0x45dbe1[_0x7061('0x6f')]['id']=_0x561fa5[_0x7061('0x59')][_0x7061('0x5f')];return db[_0x7061('0x50')][_0x7061('0x57')]({'where':{'id':_0x561fa5[_0x7061('0x55')]['id'],'UserId':null}})[_0x7061('0x52')](handleEntityNotFound(_0x592a29,null))[_0x7061('0x52')](function(_0x14a252){if(_0x14a252){_0x45dbe1['message']=_0x14a252['get']({'plain':!![]});return db[_0x7061('0x7b')]['find']({'where':{'id':_0x14a252[_0x7061('0x7c')]}});}return null;})[_0x7061('0x52')](handleEntityNotFound(_0x592a29,null))[_0x7061('0x52')](function(_0x5ad14d){if(_0x5ad14d){_0x45dbe1['interaction']=_0x5ad14d[_0x7061('0x63')]({'plain':!![]});interaction_log[_0x7061('0x1f')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x561fa5[_0x7061('0x65')]['id'],_0x561fa5[_0x7061('0x65')][_0x7061('0x37')],_0x561fa5[_0x7061('0x65')][_0x7061('0x66')],_0x45dbe1[_0x7061('0x62')]['id'],_0x561fa5[_0x7061('0x59')]?JSON[_0x7061('0x67')](_0x561fa5[_0x7061('0x59')]):'null');return respondWithRpcPromise(_0x7061('0x7d'),_0x7061('0x7e'),_0x45dbe1);}return null;})[_0x7061('0x52')](function(_0x36971a){var _0x4c4eee=_0x7061('0x69')+_0x36971a[_0x7061('0x26')][_0x7061('0x6a')];return db[_0x7061('0x6b')][_0x7061('0x40')](_0x4c4eee,{'type':db[_0x7061('0x6c')][_0x7061('0x7f')][_0x7061('0x6d')],'raw':!![]})[_0x7061('0x52')](function(_0x40f83b){return _0x40f83b;});})[_0x7061('0x52')](function(_0xbe8e0a){if(_0xbe8e0a){_0x45dbe1[_0x7061('0x26')][_0x7061('0x6e')]=_0xbe8e0a[0x0];if(!_0x561fa5['body'][_0x7061('0x5f')])return;return db['User']['find']({'where':{'id':_0x561fa5[_0x7061('0x59')][_0x7061('0x5f')],'role':_0x7061('0x6f')},'attributes':['id',_0x7061('0x37'),_0x7061('0x70'),_0x7061('0x71'),_0x7061('0x72')],'raw':!![]});}return null;})[_0x7061('0x52')](function(_0x387593){if(!_0x387593)return null;_0x45dbe1[_0x7061('0x26')]['agent']=_0x387593;return _0x45dbe1;})['then'](function(_0x192135){if(_0x192135){_0x192135[_0x7061('0x26')]['interface']=util[_0x7061('0x61')](_0x7061('0x75'),_0x561fa5[_0x7061('0x65')][_0x7061('0x37')]);_0x192135[_0x7061('0x26')][_0x7061('0x76')]=_0x45dbe1[_0x7061('0x76')];_0x192135[_0x7061('0x26')][_0x7061('0x77')]=_0x45dbe1[_0x7061('0x76')];_0x192135['message'][_0x7061('0x80')]=_0x7061('0x33');respondWithRpcPromise(_0x7061('0x79'),_0x7061('0x79'),{'event':_0x7061('0x81'),'message':_0x192135['message']},client9002);return _0x45dbe1;}return null;})[_0x7061('0x52')](respondWithResult(_0x592a29,null))[_0x7061('0x28')](handleError(_0x592a29,null));};exports[_0x7061('0x82')]=function(_0x6a4766,_0x3c9095){var _0x3ebfd5;return db['FaxMessage'][_0x7061('0x82')](_0x6a4766[_0x7061('0x59')],{})[_0x7061('0x52')](function(_0x5acc90){_0x3ebfd5=_0x5acc90;return db[_0x7061('0x83')]['findOne']({'where':{'id':_0x3ebfd5[_0x7061('0x6a')]}});})[_0x7061('0x52')](function(_0x2c10de){if(_[_0x7061('0x60')](_0x2c10de)){return;}else{_0x3ebfd5['fax']=_0x2c10de[_0x7061('0x5c')];return db[_0x7061('0x84')][_0x7061('0x85')]({'where':{'id':_0x3ebfd5[_0x7061('0x86')]}});}})[_0x7061('0x52')](function(_0x10d7ba){return respondWithRpcPromise('SendFax',_0x7061('0x87'),{'FaxAccountId':_['isNil'](_0x6a4766[_0x7061('0x59')])?undefined:_0x6a4766[_0x7061('0x59')][_0x7061('0x88')],'path':_[_0x7061('0x60')](_0x10d7ba)?undefined:util[_0x7061('0x61')]('/var/opt/motion2/server/files/attachments/%s',_0x10d7ba[_0x7061('0x89')]),'fax':_[_0x7061('0x60')](_0x3ebfd5[_0x7061('0x5c')])?undefined:_0x3ebfd5['fax'],'AttachmentId':_0x3ebfd5[_0x7061('0x86')]},client9002);})[_0x7061('0x52')](respondWithResult(_0x3c9095,0xc9))[_0x7061('0x28')](handleError(_0x3c9095,null));};exports[_0x7061('0x8a')]=function(_0x2d50dc,_0x21de01){var _0x2cb843=path['join'](config['root'],_0x7061('0x8b'),_0x7061('0x8c'),'attachments');return db[_0x7061('0x50')]['find']({'where':{'id':_0x2d50dc[_0x7061('0x55')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x21de01,null))[_0x7061('0x52')](function(_0xb8c157){if(_0xb8c157){return _0x21de01[_0x7061('0x8a')](path[_0x7061('0x8d')](_0x2cb843,_0xb8c157['Attachment'][_0x7061('0x89')]));}})[_0x7061('0x28')](handleError(_0x21de01,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 345bcbd..90cd94c 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 _0xbd0e=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xbd0e,0x187));var _0xebd0=function(_0x3d0e12,_0x41e165){_0x3d0e12=_0x3d0e12-0x0;var _0x22da51=_0xbd0e[_0x3d0e12];return _0x22da51;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xebd0('0x0'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xebd0('0x1')](0x0);var events={'afterCreate':_0xebd0('0x2'),'afterUpdate':_0xebd0('0x3'),'afterDestroy':_0xebd0('0x4')};function emitEvent(_0x1f7733){return function(_0x811ddd,_0x4df56d,_0x54075a){FaxMessageEvents[_0xebd0('0x5')](_0x1f7733+':'+_0x811ddd['id'],_0x811ddd);FaxMessageEvents[_0xebd0('0x5')](_0x1f7733,_0x811ddd);_0x54075a(null);};}for(var e in events){if(events[_0xebd0('0x6')](e)){var event=events[e];FaxMessage[_0xebd0('0x7')](e,emitEvent(event));}}module[_0xebd0('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0xc17d=['FaxMessage','setMaxListeners','update','remove','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x5d8076,_0x2b476a){var _0x26811a=function(_0x434cbf){while(--_0x434cbf){_0x5d8076['push'](_0x5d8076['shift']());}};_0x26811a(++_0x2b476a);}(_0xc17d,0x96));var _0xdc17=function(_0x52156a,_0x350b21){_0x52156a=_0x52156a-0x0;var _0x40360a=_0xc17d[_0x52156a];return _0x40360a;};'use strict';var EventEmitter=require(_0xdc17('0x0'));var FaxMessage=require(_0xdc17('0x1'))['db'][_0xdc17('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xdc17('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdc17('0x4'),'afterDestroy':_0xdc17('0x5')};function emitEvent(_0xcbc140){return function(_0x388e27,_0x5e261e,_0x33efa9){FaxMessageEvents['emit'](_0xcbc140+':'+_0x388e27['id'],_0x388e27);FaxMessageEvents['emit'](_0xcbc140,_0x388e27);_0x33efa9(null);};}for(var e in events){if(events[_0xdc17('0x6')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xdc17('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 2f17c31..4146573 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 _0x6b5b=['direction','toLowerCase','out','isNil','UserId','FaxInteractionId','then','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','define','fax_messages','fti_fax_messages','body','FULLTEXT','models','get'];(function(_0x1d2b4b,_0x1b8974){var _0x54d25f=function(_0x1008e2){while(--_0x1008e2){_0x1d2b4b['push'](_0x1d2b4b['shift']());}};_0x54d25f(++_0x1b8974);}(_0x6b5b,0x168));var _0xb6b5=function(_0x4d60d0,_0x5d1e5f){_0x4d60d0=_0x4d60d0-0x0;var _0x16d1ed=_0x6b5b[_0x4d60d0];return _0x16d1ed;};'use strict';var _=require(_0xb6b5('0x0'));var util=require(_0xb6b5('0x1'));var logger=require(_0xb6b5('0x2'))(_0xb6b5('0x3'));var moment=require(_0xb6b5('0x4'));var BPromise=require('bluebird');var rp=require(_0xb6b5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb6b5('0x6'));var config=require(_0xb6b5('0x7'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x4836e,_0x42f429){return _0x4836e[_0xb6b5('0x8')]('FaxMessage',attributes,{'tableName':_0xb6b5('0x9'),'paranoid':![],'indexes':[{'name':_0xb6b5('0xa'),'fields':[_0xb6b5('0xb')],'type':_0xb6b5('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1b27f3,_0x3d4d65,_0x208af6){var _0x884461=_0x4836e[_0xb6b5('0xd')];var _0x3fb164=_0x1b27f3[_0xb6b5('0xe')]({'plain':!![]});if(_0x3fb164[_0xb6b5('0xf')][_0xb6b5('0x10')]()==='in'||_0x3fb164[_0xb6b5('0xf')][_0xb6b5('0x10')]()===_0xb6b5('0x11')&&!_0x3fb164['secret']&&!_[_0xb6b5('0x12')](_0x3fb164[_0xb6b5('0x13')])){_0x884461['FaxInteraction']['findOne']({'where':{'id':_0x3fb164[_0xb6b5('0x14')]}})[_0xb6b5('0x15')](function(_0x554846){if(_0x554846){_0x554846['update']({'lastMsgAt':_0x3fb164[_0xb6b5('0x16')],'lastMsgDirection':_0x3fb164[_0xb6b5('0xf')]['toLowerCase']()});}})['catch'](function(_0xdcc37f){console['error'](_0xdcc37f);});}_0x208af6();}},'charset':_0xb6b5('0x17'),'collate':_0xb6b5('0x18')});}; \ No newline at end of file +var _0x378a=['out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase'];(function(_0x3dce6a,_0x47e609){var _0x387341=function(_0x33eddf){while(--_0x33eddf){_0x3dce6a['push'](_0x3dce6a['shift']());}};_0x387341(++_0x47e609);}(_0x378a,0x89));var _0xa378=function(_0x3e80c0,_0x422f13){_0x3e80c0=_0x3e80c0-0x0;var _0x2c4e48=_0x378a[_0x3e80c0];return _0x2c4e48;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa378('0x0'))(_0xa378('0x1'));var moment=require(_0xa378('0x2'));var BPromise=require(_0xa378('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa378('0x4'));var rimraf=require(_0xa378('0x5'));var config=require(_0xa378('0x6'));var attributes=require(_0xa378('0x7'));module[_0xa378('0x8')]=function(_0x484e6f,_0x49dc6b){return _0x484e6f[_0xa378('0x9')](_0xa378('0xa'),attributes,{'tableName':_0xa378('0xb'),'paranoid':![],'indexes':[{'name':_0xa378('0xc'),'fields':[_0xa378('0xd')],'type':_0xa378('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x13afe3,_0x2e6ecd,_0x4f469b){var _0x5361e7=_0x484e6f['models'];var _0x44cf31=_0x13afe3[_0xa378('0xf')]({'plain':!![]});if(_0x44cf31[_0xa378('0x10')][_0xa378('0x11')]()==='in'||_0x44cf31[_0xa378('0x10')][_0xa378('0x11')]()===_0xa378('0x12')&&!_0x44cf31[_0xa378('0x13')]&&!_[_0xa378('0x14')](_0x44cf31[_0xa378('0x15')])){_0x5361e7[_0xa378('0x16')][_0xa378('0x17')]({'where':{'id':_0x44cf31[_0xa378('0x18')]}})['then'](function(_0x7e44a6){if(_0x7e44a6){_0x7e44a6[_0xa378('0x19')]({'lastMsgAt':_0x44cf31[_0xa378('0x1a')],'lastMsgDirection':_0x44cf31[_0xa378('0x10')][_0xa378('0x11')]()});}})[_0xa378('0x1b')](function(_0x1eee17){console[_0xa378('0x1c')](_0x1eee17);});}_0x4f469b();}},'charset':_0xa378('0x1d'),'collate':_0xa378('0x1e')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index cd18a85..125e5fb 100644 --- a/server/api/faxMessage/faxMessage.rpc.js +++ b/server/api/faxMessage/faxMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['create','body','raw','CreateFaxMessage','catch','FaxMessage','update','options','where','attributes','limit','UpdateFaxMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3b95ea,_0x1d4b77){var _0x4f0714=function(_0x182bff){while(--_0x182bff){_0x3b95ea['push'](_0x3b95ea['shift']());}};_0x4f0714(++_0x1d4b77);}(_0xedd9,0xfc));var _0x9edd=function(_0x424a6d,_0x205b32){_0x424a6d=_0x424a6d-0x0;var _0x97fe=_0xedd9[_0x424a6d];return _0x97fe;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});config['redis']=_[_0x9edd('0xc')](config['redis'],{'host':_0x9edd('0xd'),'port':0x18eb});var socket=require(_0x9edd('0xe'))(new Redis(config[_0x9edd('0xf')]));require(_0x9edd('0x10'))['register'](socket);function respondWithRpcPromise(_0x494a24,_0x5d2f90,_0x2076fc){return new BPromise(function(_0x138767,_0x523026){return client[_0x9edd('0x11')](_0x494a24,_0x2076fc)[_0x9edd('0x12')](function(_0x5b6c00){logger[_0x9edd('0x13')](_0x9edd('0x14'),_0x5d2f90,_0x9edd('0x15'));logger[_0x9edd('0x16')](_0x9edd('0x17'),_0x5d2f90,_0x9edd('0x15'),JSON[_0x9edd('0x18')](_0x5b6c00));if(_0x5b6c00[_0x9edd('0x19')]){if(_0x5b6c00['error'][_0x9edd('0x1a')]===0x1f4){logger[_0x9edd('0x19')](_0x9edd('0x14'),_0x5d2f90,_0x5b6c00[_0x9edd('0x19')][_0x9edd('0x1b')]);return _0x523026(_0x5b6c00[_0x9edd('0x19')][_0x9edd('0x1b')]);}logger[_0x9edd('0x19')]('FaxMessage,\x20%s,\x20%s',_0x5d2f90,_0x5b6c00[_0x9edd('0x19')][_0x9edd('0x1b')]);return _0x138767(_0x5b6c00[_0x9edd('0x19')]['message']);}else{logger[_0x9edd('0x13')](_0x9edd('0x14'),_0x5d2f90,_0x9edd('0x15'));_0x138767(_0x5b6c00['result'][_0x9edd('0x1b')]);}})['catch'](function(_0x2cdcef){logger[_0x9edd('0x19')]('FaxMessage,\x20%s,\x20%s',_0x5d2f90,_0x2cdcef);_0x523026(_0x2cdcef);});});}exports['CreateFaxMessage']=function(_0x45c3ab){var _0x50338f=this;return new Promise(function(_0x27a95a,_0x54a03f){return db['FaxMessage'][_0x9edd('0x1c')](_0x45c3ab[_0x9edd('0x1d')],{'raw':_0x45c3ab['options']?_0x45c3ab['options'][_0x9edd('0x1e')]===undefined?!![]:![]:!![]})[_0x9edd('0x12')](function(_0x477878){logger['info'](_0x9edd('0x1f'),_0x45c3ab);logger[_0x9edd('0x16')](_0x9edd('0x1f'),_0x45c3ab,JSON[_0x9edd('0x18')](_0x477878));_0x27a95a(_0x477878);})[_0x9edd('0x20')](function(_0x4c75d2){logger[_0x9edd('0x19')](_0x9edd('0x1f'),_0x4c75d2[_0x9edd('0x1b')],_0x45c3ab);_0x54a03f(_0x50338f[_0x9edd('0x19')](0x1f4,_0x4c75d2[_0x9edd('0x1b')]));});});};exports['UpdateFaxMessage']=function(_0x4b3d1b){var _0x3276ee=this;return new Promise(function(_0xfeca7b,_0x8d67aa){return db[_0x9edd('0x21')][_0x9edd('0x22')](_0x4b3d1b['body'],{'raw':_0x4b3d1b['options']?_0x4b3d1b[_0x9edd('0x23')][_0x9edd('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b3d1b[_0x9edd('0x23')]?_0x4b3d1b['options'][_0x9edd('0x24')]||null:null,'attributes':_0x4b3d1b[_0x9edd('0x23')]?_0x4b3d1b[_0x9edd('0x23')][_0x9edd('0x25')]||null:null,'limit':_0x4b3d1b['options']?_0x4b3d1b[_0x9edd('0x23')][_0x9edd('0x26')]||null:null})[_0x9edd('0x12')](function(_0x12c1bc){logger[_0x9edd('0x13')](_0x9edd('0x27'),_0x4b3d1b);logger[_0x9edd('0x16')](_0x9edd('0x27'),_0x4b3d1b,JSON[_0x9edd('0x18')](_0x12c1bc));_0xfeca7b(_0x12c1bc);})[_0x9edd('0x20')](function(_0x4fd03f){logger[_0x9edd('0x19')](_0x9edd('0x27'),_0x4fd03f[_0x9edd('0x1b')],_0x4b3d1b);_0x8d67aa(_0x3276ee[_0x9edd('0x19')](0x1f4,_0x4fd03f['message']));});});}; \ No newline at end of file +var _0x4b84=['CreateFaxMessage','FaxMessage','create','body','options','raw','stringify','UpdateFaxMessage','attributes','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','defaults','localhost','./faxMessage.socket','register','request','then','info','request\x20sent','debug','error','message','FaxMessage,\x20%s,\x20%s','result'];(function(_0x32e77a,_0x1a0440){var _0x13d5b1=function(_0x2c53b1){while(--_0x2c53b1){_0x32e77a['push'](_0x32e77a['shift']());}};_0x13d5b1(++_0x1a0440);}(_0x4b84,0x1cc));var _0x44b8=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0x4b84[_0x49d19d];return _0x4ebef1;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});config['redis']=_[_0x44b8('0x7')](config['redis'],{'host':_0x44b8('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x44b8('0x9'))[_0x44b8('0xa')](socket);function respondWithRpcPromise(_0x30ebc3,_0x48a371,_0xc650ec){return new BPromise(function(_0x2cc74b,_0x4315f6){return client[_0x44b8('0xb')](_0x30ebc3,_0xc650ec)[_0x44b8('0xc')](function(_0x37e471){logger[_0x44b8('0xd')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x44b8('0xe'));logger[_0x44b8('0xf')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x48a371,_0x44b8('0xe'),JSON['stringify'](_0x37e471));if(_0x37e471[_0x44b8('0x10')]){if(_0x37e471[_0x44b8('0x10')]['code']===0x1f4){logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x37e471['error'][_0x44b8('0x11')]);return _0x4315f6(_0x37e471[_0x44b8('0x10')][_0x44b8('0x11')]);}logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x37e471['error']['message']);return _0x2cc74b(_0x37e471[_0x44b8('0x10')]['message']);}else{logger[_0x44b8('0xd')](_0x44b8('0x12'),_0x48a371,'request\x20sent');_0x2cc74b(_0x37e471[_0x44b8('0x13')][_0x44b8('0x11')]);}})['catch'](function(_0x89bc30){logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x89bc30);_0x4315f6(_0x89bc30);});});}exports[_0x44b8('0x14')]=function(_0x8b4301){var _0xebfe79=this;return new Promise(function(_0x235bdc,_0x102ef9){return db[_0x44b8('0x15')][_0x44b8('0x16')](_0x8b4301[_0x44b8('0x17')],{'raw':_0x8b4301[_0x44b8('0x18')]?_0x8b4301[_0x44b8('0x18')][_0x44b8('0x19')]===undefined?!![]:![]:!![]})[_0x44b8('0xc')](function(_0x48327e){logger[_0x44b8('0xd')](_0x44b8('0x14'),_0x8b4301);logger[_0x44b8('0xf')](_0x44b8('0x14'),_0x8b4301,JSON[_0x44b8('0x1a')](_0x48327e));_0x235bdc(_0x48327e);})['catch'](function(_0x402497){logger['error'](_0x44b8('0x14'),_0x402497[_0x44b8('0x11')],_0x8b4301);_0x102ef9(_0xebfe79[_0x44b8('0x10')](0x1f4,_0x402497[_0x44b8('0x11')]));});});};exports[_0x44b8('0x1b')]=function(_0x59acbc){var _0x474f01=this;return new Promise(function(_0x502acf,_0x41d673){return db[_0x44b8('0x15')]['update'](_0x59acbc[_0x44b8('0x17')],{'raw':_0x59acbc[_0x44b8('0x18')]?_0x59acbc[_0x44b8('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59acbc[_0x44b8('0x18')]?_0x59acbc[_0x44b8('0x18')]['where']||null:null,'attributes':_0x59acbc[_0x44b8('0x18')]?_0x59acbc['options'][_0x44b8('0x1c')]||null:null,'limit':_0x59acbc['options']?_0x59acbc['options']['limit']||null:null})[_0x44b8('0xc')](function(_0x29b18d){logger[_0x44b8('0xd')](_0x44b8('0x1b'),_0x59acbc);logger[_0x44b8('0xf')](_0x44b8('0x1b'),_0x59acbc,JSON[_0x44b8('0x1a')](_0x29b18d));_0x502acf(_0x29b18d);})[_0x44b8('0x1d')](function(_0xd1d320){logger[_0x44b8('0x10')](_0x44b8('0x1b'),_0xd1d320[_0x44b8('0x11')],_0x59acbc);_0x41d673(_0x474f01[_0x44b8('0x10')](0x1f4,_0xd1d320['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 8429345..5afe8b7 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 _0x494d=['removeListener','register','length','./faxMessage.events','remove','update','emit'];(function(_0x3c6a2f,_0x398815){var _0x5a90e3=function(_0x25eada){while(--_0x25eada){_0x3c6a2f['push'](_0x3c6a2f['shift']());}};_0x5a90e3(++_0x398815);}(_0x494d,0x15a));var _0xd494=function(_0x30667a,_0x4dacbb){_0x30667a=_0x30667a-0x0;var _0x346acf=_0x494d[_0x30667a];return _0x346acf;};'use strict';var FaxMessageEvents=require(_0xd494('0x0'));var events=['save',_0xd494('0x1'),_0xd494('0x2')];function createListener(_0x712089,_0x359e9d){return function(_0x55215c){_0x359e9d[_0xd494('0x3')](_0x712089,_0x55215c);};}function removeListener(_0x497674,_0x1b370d){return function(){FaxMessageEvents[_0xd494('0x4')](_0x497674,_0x1b370d);};}exports[_0xd494('0x5')]=function(_0x381bad){for(var _0x573304=0x0,_0x4f9685=events[_0xd494('0x6')];_0x573304<_0x4f9685;_0x573304++){var _0x21e7d8=events[_0x573304];var _0x403f30=createListener('faxMessage:'+_0x21e7d8,_0x381bad);FaxMessageEvents['on'](_0x21e7d8,_0x403f30);}}; \ No newline at end of file +var _0x5846=['./faxMessage.events','save','remove','emit','removeListener','register','faxMessage:'];(function(_0x3d1b97,_0x659f66){var _0x1b352a=function(_0x203bbf){while(--_0x203bbf){_0x3d1b97['push'](_0x3d1b97['shift']());}};_0x1b352a(++_0x659f66);}(_0x5846,0x69));var _0x6584=function(_0x13aec3,_0x1a9a2e){_0x13aec3=_0x13aec3-0x0;var _0xde2e71=_0x5846[_0x13aec3];return _0xde2e71;};'use strict';var FaxMessageEvents=require(_0x6584('0x0'));var events=[_0x6584('0x1'),_0x6584('0x2'),'update'];function createListener(_0x5dc167,_0x2f03d4){return function(_0x149e14){_0x2f03d4[_0x6584('0x3')](_0x5dc167,_0x149e14);};}function removeListener(_0x2ee9a6,_0x14547b){return function(){FaxMessageEvents[_0x6584('0x4')](_0x2ee9a6,_0x14547b);};}exports[_0x6584('0x5')]=function(_0x286601){for(var _0xc9fe23=0x0,_0x17542f=events['length'];_0xc9fe23<_0x17542f;_0xc9fe23++){var _0x1b9cf0=events[_0xc9fe23];var _0x5db6cc=createListener(_0x6584('0x6')+_0x1b9cf0,_0x286601);FaxMessageEvents['on'](_0x1b9cf0,_0x5db6cc);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index fbb60a5..c5a0472 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 _0xf45e=['get','isAuthenticated','index','/describe','describe','/:id','show','download','post','tracked','fax','create','put','update','/:id/reject','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller'];(function(_0x418cd5,_0x2bc40f){var _0x235fc9=function(_0xa102fc){while(--_0xa102fc){_0x418cd5['push'](_0x418cd5['shift']());}};_0x235fc9(++_0x2bc40f);}(_0xf45e,0x115));var _0xef45=function(_0x530d19,_0x5479c6){_0x530d19=_0x530d19-0x0;var _0x2816b7=_0xf45e[_0x530d19];return _0x2816b7;};'use strict';var multer=require(_0xef45('0x0'));var util=require('util');var path=require(_0xef45('0x1'));var timeout=require('connect-timeout');var express=require(_0xef45('0x2'));var router=express[_0xef45('0x3')]();var fs_extra=require(_0xef45('0x4'));var auth=require(_0xef45('0x5'));var interaction=require(_0xef45('0x6'));var config=require(_0xef45('0x7'));var controller=require(_0xef45('0x8'));router[_0xef45('0x9')]('/',auth[_0xef45('0xa')](),controller[_0xef45('0xb')]);router[_0xef45('0x9')](_0xef45('0xc'),auth[_0xef45('0xa')](),controller[_0xef45('0xd')]);router[_0xef45('0x9')](_0xef45('0xe'),auth[_0xef45('0xa')](),controller[_0xef45('0xf')]);router[_0xef45('0x9')]('/:id/download',auth[_0xef45('0xa')](),controller[_0xef45('0x10')]);router[_0xef45('0x11')]('/',auth[_0xef45('0xa')](),interaction[_0xef45('0x12')](_0xef45('0x13'),'faxmessage:create'),controller[_0xef45('0x14')]);router[_0xef45('0x15')](_0xef45('0xe'),auth[_0xef45('0xa')](),controller[_0xef45('0x16')]);router['put']('/:id/accept',auth[_0xef45('0xa')](),controller['accept']);router[_0xef45('0x15')](_0xef45('0x17'),auth[_0xef45('0xa')](),controller['reject']);router['delete'](_0xef45('0xe'),auth['isAuthenticated'](),controller[_0xef45('0x18')]);module[_0xef45('0x19')]=router; \ No newline at end of file +var _0xbc9d=['path','connect-timeout','express','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id','/:id/accept','accept','reject','delete','destroy','multer','util'];(function(_0x40b5cb,_0x4e3a0f){var _0x3ecb59=function(_0x5e6075){while(--_0x5e6075){_0x40b5cb['push'](_0x40b5cb['shift']());}};_0x3ecb59(++_0x4e3a0f);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x1de31e,_0x4a621a){_0x1de31e=_0x1de31e-0x0;var _0x736a92=_0xbc9d[_0x1de31e];return _0x736a92;};'use strict';var multer=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var path=require(_0xdbc9('0x2'));var timeout=require(_0xdbc9('0x3'));var express=require(_0xdbc9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdbc9('0x5'));var config=require(_0xdbc9('0x6'));var controller=require(_0xdbc9('0x7'));router[_0xdbc9('0x8')]('/',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xa')]);router[_0xdbc9('0x8')]('/describe',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xb')]);router[_0xdbc9('0x8')]('/:id',auth[_0xdbc9('0x9')](),controller['show']);router['get'](_0xdbc9('0xc'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xd')]);router[_0xdbc9('0xe')]('/',auth['isAuthenticated'](),interaction[_0xdbc9('0xf')](_0xdbc9('0x10'),_0xdbc9('0x11')),controller[_0xdbc9('0x12')]);router[_0xdbc9('0x13')](_0xdbc9('0x14'),auth['isAuthenticated'](),controller['update']);router[_0xdbc9('0x13')](_0xdbc9('0x15'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x16')]);router[_0xdbc9('0x13')]('/:id/reject',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x17')]);router[_0xdbc9('0x18')]('/:id',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 6656ea7..b3a0939 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 _0xb754=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','rrmemory'];(function(_0x323970,_0x5bde6f){var _0x3217da=function(_0x4dcdf3){while(--_0x4dcdf3){_0x323970['push'](_0x323970['shift']());}};_0x3217da(++_0x5bde6f);}(_0xb754,0x1f2));var _0x4b75=function(_0xcb537a,_0x15ca9b){_0xcb537a=_0xcb537a-0x0;var _0x5dcba0=_0xb754[_0xcb537a];return _0x5dcba0;};'use strict';var Sequelize=require(_0x4b75('0x0'));module[_0x4b75('0x1')]={'name':{'type':Sequelize[_0x4b75('0x2')],'unique':_0x4b75('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x4b75('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4b75('0x5'),_0x4b75('0x6'),_0x4b75('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x4b75('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3936=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x30b431,_0x3fe97f){var _0x2ab081=function(_0x2ffb3d){while(--_0x2ffb3d){_0x30b431['push'](_0x30b431['shift']());}};_0x2ab081(++_0x3fe97f);}(_0x3936,0x18c));var _0x6393=function(_0x2b6235,_0xadfbcf){_0x2b6235=_0x2b6235-0x0;var _0x4cee7f=_0x3936[_0x2b6235];return _0x4cee7f;};'use strict';var Sequelize=require(_0x6393('0x0'));module['exports']={'name':{'type':Sequelize[_0x6393('0x1')],'unique':_0x6393('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6393('0x1')]},'timeout':{'type':Sequelize[_0x6393('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6393('0x4')](_0x6393('0x5'),_0x6393('0x6'),_0x6393('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x6393('0x3')],'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 016b3b0..19eceff 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 _0xc653=['ejs','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','update','then','get','FaxQueues','UserProfileResource','destroy','error','stack','name','send','index','map','FaxQueue','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','keys','rawAttributes','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','body','describe','getMembers','findOne','UserFaxQueue','sort','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','createdAt','count','format','updatedAt','getTeams','addTeams','ids','Team','Agents','voicePause','sequelize','each','findOrCreate','forEach','emit','userFaxQueue:save','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','transaction','removeTeams','addAgents','omit','removeAgents','isArray','userFaxQueue:remove','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x4ca019,_0x312c36){var _0xb205a5=function(_0x2075d9){while(--_0x2075d9){_0x4ca019['push'](_0x4ca019['shift']());}};_0xb205a5(++_0x312c36);}(_0xc653,0x83));var _0x3c65=function(_0x54f695,_0x17e578){_0x54f695=_0x54f695-0x0;var _0x5d8f73=_0xc653[_0x54f695];return _0x5d8f73;};'use strict';var emlformat=require(_0x3c65('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3c65('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c65('0x2'));var moment=require(_0x3c65('0x3'));var BPromise=require(_0x3c65('0x4'));var Mustache=require(_0x3c65('0x5'));var util=require('util');var path=require(_0x3c65('0x6'));var sox=require(_0x3c65('0x7'));var csv=require(_0x3c65('0x8'));var ejs=require(_0x3c65('0x9'));var fs=require('fs');var fs_extra=require(_0x3c65('0xa'));var _=require(_0x3c65('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3c65('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3c65('0x8'));var querystring=require('querystring');var Papa=require(_0x3c65('0xd'));var Redis=require(_0x3c65('0xe'));var authService=require(_0x3c65('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3c65('0x10'));var hardwareService=require(_0x3c65('0x11'));var logger=require(_0x3c65('0x12'))(_0x3c65('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3c65('0x14'));var db=require(_0x3c65('0x15'))['db'];config[_0x3c65('0x16')]=_[_0x3c65('0x17')](config[_0x3c65('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x3c65('0x18'))(new Redis(config[_0x3c65('0x16')]));require(_0x3c65('0x19'))['register'](socket);function respondWithStatusCode(_0x1a8f7b,_0x2e0359){_0x2e0359=_0x2e0359||0xcc;return function(_0x369745){if(_0x369745){return _0x1a8f7b[_0x3c65('0x1a')](_0x2e0359);}return _0x1a8f7b[_0x3c65('0x1b')](_0x2e0359)[_0x3c65('0x1c')]();};}function respondWithResult(_0xe12b70,_0x30675b){_0x30675b=_0x30675b||0xc8;return function(_0x3889db){if(_0x3889db){return _0xe12b70[_0x3c65('0x1b')](_0x30675b)[_0x3c65('0x1d')](_0x3889db);}};}function respondWithFilteredResult(_0x7eedd7,_0x3ed9c4){return function(_0x3b8dfa){if(_0x3b8dfa){var _0x3630b1=typeof _0x3ed9c4['offset']===_0x3c65('0x1e')&&typeof _0x3ed9c4[_0x3c65('0x1f')]==='undefined';var _0x5884b7=_0x3b8dfa['count'];var _0xf3f507=_0x3630b1?0x0:_0x3ed9c4[_0x3c65('0x20')];var _0xfcccdf=_0x3630b1?_0x3b8dfa['count']:_0x3ed9c4['offset']+_0x3ed9c4[_0x3c65('0x1f')];var _0x17774e;if(_0xfcccdf>=_0x5884b7){_0xfcccdf=_0x5884b7;_0x17774e=0xc8;}else{_0x17774e=0xce;}_0x7eedd7[_0x3c65('0x1b')](_0x17774e);return _0x7eedd7[_0x3c65('0x21')](_0x3c65('0x22'),_0xf3f507+'-'+_0xfcccdf+'/'+_0x5884b7)[_0x3c65('0x1d')](_0x3b8dfa);}return null;};}function patchUpdates(_0x26b36d){return function(_0x3cf2f9){try{jsonpatch[_0x3c65('0x23')](_0x3cf2f9,_0x26b36d,!![]);}catch(_0x3e5652){return BPromise[_0x3c65('0x24')](_0x3e5652);}return _0x3cf2f9['save']();};}function saveUpdates(_0x363042,_0x21f965){return function(_0x3e2467){if(_0x3e2467){return _0x3e2467[_0x3c65('0x25')](_0x363042)[_0x3c65('0x26')](function(_0x4f53d0){return _0x4f53d0;});}return null;};}function removeEntity(_0x3fdb25,_0x51db12){return function(_0x499da7){if(_0x499da7){return _0x499da7['destroy']()[_0x3c65('0x26')](function(){var _0x730f0c=_0x499da7[_0x3c65('0x27')]({'plain':!![]});var _0x3c13f5=_0x3c65('0x28');return db[_0x3c65('0x29')][_0x3c65('0x2a')]({'where':{'type':_0x3c13f5,'resourceId':_0x730f0c['id']}})[_0x3c65('0x26')](function(){return _0x499da7;});})[_0x3c65('0x26')](function(){_0x3fdb25[_0x3c65('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x399921,_0x462c8e){return function(_0x24f1ce){if(!_0x24f1ce){_0x399921[_0x3c65('0x1a')](0x194);}return _0x24f1ce;};}function handleError(_0x356223,_0x5066ab){_0x5066ab=_0x5066ab||0x1f4;return function(_0x1d44de){logger[_0x3c65('0x2b')](_0x1d44de[_0x3c65('0x2c')]);if(_0x1d44de['name']){delete _0x1d44de[_0x3c65('0x2d')];}_0x356223['status'](_0x5066ab)[_0x3c65('0x2e')](_0x1d44de);};}exports[_0x3c65('0x2f')]=function(_0xfda3c1,_0x38a544){var _0x5272fa={},_0x2491b7={},_0x470851={'count':0x0,'rows':[]};var _0x5a1fe0=_[_0x3c65('0x30')](db[_0x3c65('0x31')]['rawAttributes'],function(_0x2b0dd2){return{'name':_0x2b0dd2[_0x3c65('0x32')],'type':_0x2b0dd2['type']['key']};});_0x2491b7[_0x3c65('0x33')]=_['map'](_0x5a1fe0,_0x3c65('0x2d'));_0x2491b7['query']=_['keys'](_0xfda3c1[_0x3c65('0x34')]);_0x2491b7['filters']=_[_0x3c65('0x35')](_0x2491b7[_0x3c65('0x33')],_0x2491b7[_0x3c65('0x34')]);_0x5272fa[_0x3c65('0x36')]=_[_0x3c65('0x35')](_0x2491b7[_0x3c65('0x33')],qs[_0x3c65('0x37')](_0xfda3c1[_0x3c65('0x34')]['fields']));_0x5272fa[_0x3c65('0x36')]=_0x5272fa[_0x3c65('0x36')][_0x3c65('0x38')]?_0x5272fa[_0x3c65('0x36')]:_0x2491b7[_0x3c65('0x33')];if(!_0xfda3c1[_0x3c65('0x34')][_0x3c65('0x39')](_0x3c65('0x3a'))){_0x5272fa['limit']=qs[_0x3c65('0x1f')](_0xfda3c1[_0x3c65('0x34')][_0x3c65('0x1f')]);_0x5272fa[_0x3c65('0x20')]=qs[_0x3c65('0x20')](_0xfda3c1[_0x3c65('0x34')]['offset']);}_0x5272fa[_0x3c65('0x3b')]=qs['sort'](_0xfda3c1['query']['sort']);_0x5272fa[_0x3c65('0x3c')]=qs[_0x3c65('0x3d')](_[_0x3c65('0x3e')](_0xfda3c1[_0x3c65('0x34')],_0x2491b7[_0x3c65('0x3d')]),_0x5a1fe0);if(_0xfda3c1[_0x3c65('0x34')][_0x3c65('0x3f')]){_0x5272fa[_0x3c65('0x3c')]=_[_0x3c65('0x40')](_0x5272fa[_0x3c65('0x3c')],{'$or':_[_0x3c65('0x30')](_0x5a1fe0,function(_0x42480e){if(_0x42480e[_0x3c65('0x41')]!==_0x3c65('0x42')){var _0x29a04d={};_0x29a04d[_0x42480e['name']]={'$like':'%'+_0xfda3c1['query'][_0x3c65('0x3f')]+'%'};return _0x29a04d;}})});}_0x5272fa=_[_0x3c65('0x40')]({},_0x5272fa,_0xfda3c1[_0x3c65('0x43')]);var _0x28b36c={'where':_0x5272fa['where']};return db[_0x3c65('0x31')]['count'](_0x28b36c)[_0x3c65('0x26')](function(_0x20702e){_0x470851['count']=_0x20702e;if(_0xfda3c1[_0x3c65('0x34')]['includeAll']){_0x5272fa[_0x3c65('0x44')]=[{'all':!![]}];}return db[_0x3c65('0x31')][_0x3c65('0x45')](_0x5272fa);})[_0x3c65('0x26')](function(_0x4944dd){_0x470851[_0x3c65('0x46')]=_0x4944dd;return _0x470851;})['then'](respondWithFilteredResult(_0x38a544,_0x5272fa))[_0x3c65('0x47')](handleError(_0x38a544,null));};exports['show']=function(_0x230db9,_0x5b4527){var _0x529bee={'raw':!![],'where':{'id':_0x230db9[_0x3c65('0x48')]['id']}},_0x145537={};_0x145537[_0x3c65('0x33')]=_[_0x3c65('0x49')](db[_0x3c65('0x31')][_0x3c65('0x4a')]);_0x145537[_0x3c65('0x34')]=_[_0x3c65('0x49')](_0x230db9[_0x3c65('0x34')]);_0x145537[_0x3c65('0x3d')]=_[_0x3c65('0x35')](_0x145537[_0x3c65('0x33')],_0x145537[_0x3c65('0x34')]);_0x529bee[_0x3c65('0x36')]=_[_0x3c65('0x35')](_0x145537[_0x3c65('0x33')],qs['fields'](_0x230db9[_0x3c65('0x34')][_0x3c65('0x37')]));_0x529bee[_0x3c65('0x36')]=_0x529bee[_0x3c65('0x36')][_0x3c65('0x38')]?_0x529bee[_0x3c65('0x36')]:_0x145537[_0x3c65('0x33')];if(_0x230db9[_0x3c65('0x34')][_0x3c65('0x4b')]){_0x529bee['include']=[{'all':!![]}];}_0x529bee=_['merge']({},_0x529bee,_0x230db9[_0x3c65('0x43')]);return db[_0x3c65('0x31')]['find'](_0x529bee)[_0x3c65('0x26')](handleEntityNotFound(_0x5b4527,null))['then'](respondWithResult(_0x5b4527,null))[_0x3c65('0x47')](handleError(_0x5b4527,null));};exports[_0x3c65('0x4c')]=function(_0x1e38a9,_0x18b8e2){return db[_0x3c65('0x31')]['create'](_0x1e38a9['body'],{})['then'](function(_0x17a2c2){var _0x4d5ef8=_0x1e38a9[_0x3c65('0x4d')][_0x3c65('0x27')]({'plain':!![]});if(!_0x4d5ef8)throw new Error(_0x3c65('0x4e'));if(_0x4d5ef8[_0x3c65('0x4f')]==='user'){var _0x4f1284=_0x17a2c2[_0x3c65('0x27')]({'plain':!![]});var _0x2a739e=_0x3c65('0x28');return db[_0x3c65('0x50')][_0x3c65('0x51')]({'where':{'name':_0x2a739e,'userProfileId':_0x4d5ef8[_0x3c65('0x52')]},'raw':!![]})[_0x3c65('0x26')](function(_0x4887d7){if(_0x4887d7&&_0x4887d7[_0x3c65('0x53')]===0x0){return db[_0x3c65('0x29')]['create']({'name':_0x4f1284[_0x3c65('0x2d')],'resourceId':_0x4f1284['id'],'type':_0x4887d7[_0x3c65('0x2d')],'sectionId':_0x4887d7['id']},{})[_0x3c65('0x26')](function(){return _0x17a2c2;});}else{return _0x17a2c2;}})['catch'](function(_0x2d2478){logger[_0x3c65('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d2478);throw _0x2d2478;});}return _0x17a2c2;})['then'](respondWithResult(_0x18b8e2,0xc9))[_0x3c65('0x47')](handleError(_0x18b8e2,null));};exports['update']=function(_0x397581,_0x3d66cc){if(_0x397581[_0x3c65('0x54')]['id']){delete _0x397581['body']['id'];}return db[_0x3c65('0x31')][_0x3c65('0x51')]({'where':{'id':_0x397581[_0x3c65('0x48')]['id']}})['then'](handleEntityNotFound(_0x3d66cc,null))[_0x3c65('0x26')](saveUpdates(_0x397581['body'],null))[_0x3c65('0x26')](respondWithResult(_0x3d66cc,null))[_0x3c65('0x47')](handleError(_0x3d66cc,null));};exports[_0x3c65('0x2a')]=function(_0x36fca2,_0x26b0c1){return db['FaxQueue'][_0x3c65('0x51')]({'where':{'id':_0x36fca2[_0x3c65('0x48')]['id']}})[_0x3c65('0x26')](handleEntityNotFound(_0x26b0c1,null))[_0x3c65('0x26')](removeEntity(_0x26b0c1,null))[_0x3c65('0x47')](handleError(_0x26b0c1,null));};exports[_0x3c65('0x55')]=function(_0x41c05c,_0xe2002f){return db['FaxQueue'][_0x3c65('0x55')]()['then'](respondWithResult(_0xe2002f,null))[_0x3c65('0x47')](handleError(_0xe2002f,null));};exports[_0x3c65('0x56')]=function(_0x20b46e,_0x5e9059,_0xb497b1){var _0x5d3fa6={'raw':!![],'where':{}},_0x57df46={},_0x4d39b9;return db[_0x3c65('0x31')][_0x3c65('0x57')]({'where':{'id':_0x20b46e[_0x3c65('0x48')]['id']}})[_0x3c65('0x26')](handleEntityNotFound(_0x5e9059,null))[_0x3c65('0x26')](function(_0x1dc7ef){if(_0x1dc7ef){_0x4d39b9=_0x1dc7ef['get']({'plain':!![]});_0x57df46[_0x3c65('0x33')]=_['keys'](db[_0x3c65('0x58')][_0x3c65('0x4a')]);_0x57df46[_0x3c65('0x34')]=_[_0x3c65('0x49')](_0x20b46e[_0x3c65('0x34')]);_0x57df46[_0x3c65('0x3d')]=_['intersection'](_0x57df46[_0x3c65('0x33')],_0x57df46[_0x3c65('0x34')]);_0x5d3fa6[_0x3c65('0x36')]=_[_0x3c65('0x35')](_0x57df46['model'],qs[_0x3c65('0x37')](_0x20b46e[_0x3c65('0x34')]['fields']));_0x5d3fa6[_0x3c65('0x36')]=_0x5d3fa6[_0x3c65('0x36')][_0x3c65('0x38')]?_0x5d3fa6[_0x3c65('0x36')]:_0x57df46[_0x3c65('0x33')];if(!_0x20b46e[_0x3c65('0x34')][_0x3c65('0x39')](_0x3c65('0x3a'))){_0x5d3fa6[_0x3c65('0x1f')]=qs[_0x3c65('0x1f')](_0x20b46e[_0x3c65('0x34')][_0x3c65('0x1f')]);_0x5d3fa6[_0x3c65('0x20')]=qs[_0x3c65('0x20')](_0x20b46e[_0x3c65('0x34')][_0x3c65('0x20')]);}_0x5d3fa6[_0x3c65('0x3b')]=qs[_0x3c65('0x59')](_0x20b46e[_0x3c65('0x34')][_0x3c65('0x59')]);_0x5d3fa6['where']=qs[_0x3c65('0x3d')](_['pick'](_0x20b46e['query'],_0x57df46[_0x3c65('0x3d')]));_0x5d3fa6['where'][_0x3c65('0x5a')]=_0x1dc7ef['id'];if(_0x20b46e[_0x3c65('0x34')]['filter']){_0x5d3fa6['where']=_[_0x3c65('0x40')](_0x5d3fa6['where'],{'$or':_[_0x3c65('0x30')](_0x5d3fa6[_0x3c65('0x36')],function(_0x4b1dcd){var _0x4d2e26={};_0x4d2e26[_0x4b1dcd]={'$like':'%'+_0x20b46e[_0x3c65('0x34')][_0x3c65('0x3f')]+'%'};return _0x4d2e26;})});}_0x5d3fa6=_['merge']({},_0x5d3fa6,_0x20b46e[_0x3c65('0x43')]);return db[_0x3c65('0x58')][_0x3c65('0x45')](_0x5d3fa6);}})['then'](function(_0xaa8c89){if(_0xaa8c89){return db[_0x3c65('0x5b')][_0x3c65('0x5c')]({'where':{'id':_[_0x3c65('0x30')](_0xaa8c89,_0x3c65('0x5d')),'role':_0x3c65('0x5e')},'attributes':['id',_0x3c65('0x2d'),_0x3c65('0x5f'),'updatedAt',_0x3c65('0x60')]});}})[_0x3c65('0x26')](function(_0x4f597c){if(_0x4f597c){return{'count':_0x4f597c[_0x3c65('0x61')],'rows':_['map'](_0x4f597c['rows'],function(_0x49bc11){return{'membername':_0x49bc11[_0x3c65('0x2d')],'UserId':_0x49bc11['id'],'queue_name':_0x4d39b9['name'],'FaxQueueId':_0x4d39b9['id'],'interface':util[_0x3c65('0x62')]('%s/%s','SIP',_0x49bc11['name']),'penalty':0x0,'paused':_0x49bc11[_0x3c65('0x5f')],'createdAt':_0x49bc11['createdAt'],'updatedAt':_0x49bc11[_0x3c65('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3c65('0x26')](respondWithFilteredResult(_0x5e9059,_0x5d3fa6))[_0x3c65('0x47')](handleError(_0x5e9059,null));};exports[_0x3c65('0x64')]=function(_0x381b50,_0x107b69,_0x348967){var _0x2a66a6={};var _0x6f7004={};var _0x133550;var _0xc943e7;return db['FaxQueue'][_0x3c65('0x57')]({'where':{'id':_0x381b50[_0x3c65('0x48')]['id']}})[_0x3c65('0x26')](handleEntityNotFound(_0x107b69,null))[_0x3c65('0x26')](function(_0x408f67){if(_0x408f67){_0x133550=_0x408f67;_0x6f7004[_0x3c65('0x33')]=_[_0x3c65('0x49')](db['Team'][_0x3c65('0x4a')]);_0x6f7004['query']=_[_0x3c65('0x49')](_0x381b50[_0x3c65('0x34')]);_0x6f7004['filters']=_[_0x3c65('0x35')](_0x6f7004[_0x3c65('0x33')],_0x6f7004['query']);_0x2a66a6[_0x3c65('0x36')]=_[_0x3c65('0x35')](_0x6f7004['model'],qs[_0x3c65('0x37')](_0x381b50[_0x3c65('0x34')][_0x3c65('0x37')]));_0x2a66a6[_0x3c65('0x36')]=_0x2a66a6['attributes']['length']?_0x2a66a6[_0x3c65('0x36')]:_0x6f7004['model'];_0x2a66a6[_0x3c65('0x3b')]=qs[_0x3c65('0x59')](_0x381b50[_0x3c65('0x34')][_0x3c65('0x59')]);_0x2a66a6[_0x3c65('0x3c')]=qs[_0x3c65('0x3d')](_[_0x3c65('0x3e')](_0x381b50[_0x3c65('0x34')],_0x6f7004['filters']));if(_0x381b50[_0x3c65('0x34')][_0x3c65('0x3f')]){_0x2a66a6[_0x3c65('0x3c')]=_[_0x3c65('0x40')](_0x2a66a6[_0x3c65('0x3c')],{'$or':_[_0x3c65('0x30')](_0x2a66a6[_0x3c65('0x36')],function(_0x33edda){var _0x2555df={};_0x2555df[_0x33edda]={'$like':'%'+_0x381b50['query'][_0x3c65('0x3f')]+'%'};return _0x2555df;})});}_0x2a66a6=_[_0x3c65('0x40')]({},_0x2a66a6,_0x381b50[_0x3c65('0x43')]);return _0x133550[_0x3c65('0x64')](_0x2a66a6);}})['then'](function(_0x1c1795){if(_0x1c1795){_0xc943e7=_0x1c1795[_0x3c65('0x38')];if(!_0x381b50['query'][_0x3c65('0x39')](_0x3c65('0x3a'))){_0x2a66a6[_0x3c65('0x1f')]=qs[_0x3c65('0x1f')](_0x381b50[_0x3c65('0x34')][_0x3c65('0x1f')]);_0x2a66a6[_0x3c65('0x20')]=qs[_0x3c65('0x20')](_0x381b50[_0x3c65('0x34')][_0x3c65('0x20')]);}return _0x133550[_0x3c65('0x64')](_0x2a66a6);}})[_0x3c65('0x26')](function(_0x433372){if(_0x433372){return _0x433372?{'count':_0xc943e7,'rows':_0x433372}:null;}})['then'](respondWithResult(_0x107b69,null))[_0x3c65('0x47')](handleError(_0x107b69,null));};exports[_0x3c65('0x65')]=function(_0x316a48,_0x269fbe,_0x271dda){var _0x5ee3fc=_0x316a48[_0x3c65('0x54')][_0x3c65('0x66')];return db[_0x3c65('0x67')][_0x3c65('0x45')]({'where':{'id':_0x5ee3fc},'attributes':['id'],'include':[{'model':db[_0x3c65('0x5b')],'as':_0x3c65('0x68'),'attributes':['id',_0x3c65('0x2d'),'online',_0x3c65('0x69'),'interface'],'raw':!![]}]})[_0x3c65('0x26')](function(_0x1c381a){if(_0x1c381a){var _0x43c310=_['flatMap'](_0x1c381a,function(_0x577ca6){var _0x3fefc4=_0x577ca6[_0x3c65('0x27')]({'plain':!![]});return _0x3fefc4[_0x3c65('0x68')];});return db['FaxQueue'][_0x3c65('0x51')]({'where':{'id':_0x316a48[_0x3c65('0x48')]['id']}})[_0x3c65('0x26')](function(_0x129bbd){return db[_0x3c65('0x6a')]['transaction'](function(_0x265f34){return _0x129bbd[_0x3c65('0x65')](_0x5ee3fc,{'transaction':_0x265f34})[_0x3c65('0x26')](function(){return BPromise[_0x3c65('0x6b')](_0x43c310,function(_0x2ad493){return db['UserFaxQueue'][_0x3c65('0x6c')]({'where':{'UserId':_0x2ad493['id'],'FaxQueueId':_0x316a48[_0x3c65('0x48')]['id']},'transaction':_0x265f34});});})[_0x3c65('0x26')](function(){_0x43c310[_0x3c65('0x6d')](function(_0x51b31f){socket[_0x3c65('0x6e')](_0x3c65('0x6f'),{'UserId':_0x51b31f['id'],'FaxQueueId':_0x129bbd['id']});});});});});}})[_0x3c65('0x26')](respondWithStatusCode(_0x269fbe,null))[_0x3c65('0x47')](handleError(_0x269fbe,null));};exports['removeTeams']=function(_0x49f1cb,_0x412d13,_0x594112){return db['Team'][_0x3c65('0x45')]({'where':{'id':_0x49f1cb['query'][_0x3c65('0x66')]},'attributes':['id'],'include':[{'model':db[_0x3c65('0x5b')],'as':_0x3c65('0x68'),'attributes':['id'],'raw':!![]}]})[_0x3c65('0x26')](handleEntityNotFound(_0x412d13,null))[_0x3c65('0x26')](function(_0x38aeee){var _0x5b0714=_[_0x3c65('0x30')](_0x38aeee,'id');var _0x5ed978=[];var _0x11f311=[];var _0x56f2b3=squel['select']();_0x56f2b3[_0x3c65('0x70')](_0x3c65('0x71'))[_0x3c65('0x72')](_0x3c65('0x73'),'tq')[_0x3c65('0x74')](_0x3c65('0x75'),'ut',_0x3c65('0x76'))['where'](_0x3c65('0x77'),_0x49f1cb['params']['id']);for(var _0x36bc5e=0x0;_0x36bc5e<_0x38aeee[_0x3c65('0x38')];_0x36bc5e+=0x1){let _0x4089e6=_0x38aeee[_0x36bc5e];for(var _0x2715c1=0x0;_0x2715c1<_0x4089e6[_0x3c65('0x68')]['length'];_0x2715c1+=0x1){let _0x49146d=_0x4089e6['Agents'][_0x2715c1];var _0x40a165=_0x56f2b3[_0x3c65('0x78')]();_0x40a165[_0x3c65('0x3c')](_0x3c65('0x79'),_0x49146d['id']);_0x11f311[_0x3c65('0x7a')](db[_0x3c65('0x6a')]['query'](_0x40a165[_0x3c65('0x7b')](),{'type':db[_0x3c65('0x6a')]['QueryTypes'][_0x3c65('0x7c')]})[_0x3c65('0x26')](function(_0x9fa92e){if(_0x9fa92e[_0x3c65('0x38')]===0x1){return _0x49146d['id'];}else{var _0x549260=_[_0x3c65('0x7d')](_[_0x3c65('0x30')](_0x9fa92e,_0x3c65('0x7e')),function(_0x5ef7aa){return _[_0x3c65('0x7f')](_0x5b0714,_0x5ef7aa);});if(_0x549260){return _0x49146d['id'];}}}));}}return BPromise[_0x3c65('0x80')](_0x11f311)[_0x3c65('0x26')](function(_0x37cdaf){_0x5ed978=_(_0x5ed978)[_0x3c65('0x81')](_0x37cdaf)[_0x3c65('0x82')]()[_0x3c65('0x83')]();return db[_0x3c65('0x31')][_0x3c65('0x51')]({'where':{'id':_0x49f1cb[_0x3c65('0x48')]['id']}})[_0x3c65('0x26')](function(_0x2fbc9a){return db[_0x3c65('0x6a')][_0x3c65('0x84')](function(_0x5ec0af){return _0x2fbc9a[_0x3c65('0x85')](_0x49f1cb[_0x3c65('0x34')][_0x3c65('0x66')],{'transaction':_0x5ec0af})[_0x3c65('0x26')](function(){if(!_['isEmpty'](_0x5ed978)){return _0x2fbc9a['removeAgents'](_0x5ed978,{'transaction':_0x5ec0af});}})[_0x3c65('0x26')](function(){_0x5ed978[_0x3c65('0x6d')](function(_0x182a40){socket[_0x3c65('0x6e')]('userFaxQueue:remove',{'UserId':_0x182a40,'FaxQueueId':_0x2fbc9a['id']});});});});});});})['then'](respondWithStatusCode(_0x412d13,null))[_0x3c65('0x47')](handleError(_0x412d13,null));};exports['addAgents']=function(_0x358648,_0x129451,_0x433142){return db['FaxQueue']['find']({'where':{'id':_0x358648[_0x3c65('0x48')]['id']}})[_0x3c65('0x26')](handleEntityNotFound(_0x129451,null))[_0x3c65('0x26')](function(_0x3aba2a){if(_0x3aba2a){return _0x3aba2a[_0x3c65('0x86')](_0x358648[_0x3c65('0x54')][_0x3c65('0x66')],_[_0x3c65('0x87')](_0x358648[_0x3c65('0x54')],[_0x3c65('0x66'),'id'])||{})['spread'](function(_0x11ac2a){for(var _0x3c004d=0x0;_0x3c004d<_0x358648[_0x3c65('0x54')]['ids'][_0x3c65('0x38')];_0x3c004d+=0x1){socket[_0x3c65('0x6e')](_0x3c65('0x6f'),{'UserId':Number(_0x358648[_0x3c65('0x54')][_0x3c65('0x66')][_0x3c004d]),'FaxQueueId':Number(_0x358648[_0x3c65('0x48')]['id'])});}return _0x11ac2a;});}})['then'](respondWithResult(_0x129451,null))[_0x3c65('0x47')](handleError(_0x129451,null));};exports[_0x3c65('0x88')]=function(_0x11492b,_0x65ad73,_0x1fd0f0){return db[_0x3c65('0x31')][_0x3c65('0x51')]({'where':{'id':_0x11492b[_0x3c65('0x48')]['id']}})[_0x3c65('0x26')](handleEntityNotFound(_0x65ad73,null))[_0x3c65('0x26')](function(_0x46d46d){if(_0x46d46d){return _0x46d46d['removeAgents'](_0x11492b[_0x3c65('0x34')]['ids'])[_0x3c65('0x26')](function(){if(_[_0x3c65('0x89')](_0x11492b[_0x3c65('0x34')][_0x3c65('0x66')])){for(var _0x5b2c4f=0x0;_0x5b2c4f<_0x11492b['query']['ids'][_0x3c65('0x38')];_0x5b2c4f+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x11492b[_0x3c65('0x34')][_0x3c65('0x66')][_0x5b2c4f]),'FaxQueueId':Number(_0x11492b[_0x3c65('0x48')]['id'])});}}else{socket['emit'](_0x3c65('0x8a'),{'UserId':Number(_0x11492b[_0x3c65('0x34')][_0x3c65('0x66')]),'FaxQueueId':Number(_0x11492b[_0x3c65('0x48')]['id'])});}});}})[_0x3c65('0x26')](respondWithStatusCode(_0x65ad73,null))[_0x3c65('0x47')](handleError(_0x65ad73,null));};exports[_0x3c65('0x8b')]=function(_0x4b7634,_0x268d1e,_0x501987){var _0x4f3f9e={};var _0x4f09ed={};var _0x4081fa;var _0x5bd182;return db[_0x3c65('0x31')][_0x3c65('0x57')]({'where':{'id':_0x4b7634[_0x3c65('0x48')]['id']}})[_0x3c65('0x26')](handleEntityNotFound(_0x268d1e,null))[_0x3c65('0x26')](function(_0x4f44d7){if(_0x4f44d7){_0x4081fa=_0x4f44d7;_0x4f09ed[_0x3c65('0x33')]=_[_0x3c65('0x49')](db[_0x3c65('0x5b')][_0x3c65('0x4a')]);_0x4f09ed[_0x3c65('0x34')]=_[_0x3c65('0x49')](_0x4b7634[_0x3c65('0x34')]);_0x4f09ed[_0x3c65('0x3d')]=_[_0x3c65('0x35')](_0x4f09ed['model'],_0x4f09ed[_0x3c65('0x34')]);_0x4f3f9e[_0x3c65('0x36')]=_[_0x3c65('0x35')](_0x4f09ed[_0x3c65('0x33')],qs[_0x3c65('0x37')](_0x4b7634[_0x3c65('0x34')][_0x3c65('0x37')]));_0x4f3f9e[_0x3c65('0x36')]=_0x4f3f9e['attributes']['length']?_0x4f3f9e[_0x3c65('0x36')]:_0x4f09ed[_0x3c65('0x33')];_0x4f3f9e['order']=qs[_0x3c65('0x59')](_0x4b7634[_0x3c65('0x34')]['sort']);_0x4f3f9e[_0x3c65('0x3c')]=qs['filters'](_['pick'](_0x4b7634[_0x3c65('0x34')],_0x4f09ed[_0x3c65('0x3d')]));if(_0x4b7634[_0x3c65('0x34')][_0x3c65('0x3f')]){_0x4f3f9e[_0x3c65('0x3c')]=_[_0x3c65('0x40')](_0x4f3f9e[_0x3c65('0x3c')],{'$or':_[_0x3c65('0x30')](_0x4f3f9e[_0x3c65('0x36')],function(_0x2dadd4){var _0xc57c86={};_0xc57c86[_0x2dadd4]={'$like':'%'+_0x4b7634[_0x3c65('0x34')][_0x3c65('0x3f')]+'%'};return _0xc57c86;})});}_0x4f3f9e=_[_0x3c65('0x40')]({},_0x4f3f9e,_0x4b7634[_0x3c65('0x43')]);return _0x4081fa[_0x3c65('0x8b')](_0x4f3f9e);}})[_0x3c65('0x26')](function(_0x55348b){if(_0x55348b){_0x5bd182=_0x55348b[_0x3c65('0x38')];if(!_0x4b7634[_0x3c65('0x34')][_0x3c65('0x39')](_0x3c65('0x3a'))){_0x4f3f9e[_0x3c65('0x1f')]=qs[_0x3c65('0x1f')](_0x4b7634['query'][_0x3c65('0x1f')]);_0x4f3f9e[_0x3c65('0x20')]=qs[_0x3c65('0x20')](_0x4b7634[_0x3c65('0x34')][_0x3c65('0x20')]);}return _0x4081fa[_0x3c65('0x8b')](_0x4f3f9e);}})[_0x3c65('0x26')](function(_0x50a87d){if(_0x50a87d){return _0x50a87d?{'count':_0x5bd182,'rows':_0x50a87d}:null;}})[_0x3c65('0x26')](respondWithResult(_0x268d1e,null))[_0x3c65('0x47')](handleError(_0x268d1e,null));}; \ No newline at end of file +var _0xd0f3=['length','hasOwnProperty','order','sort','where','merge','filter','options','FaxQueue','includeAll','include','findAll','rows','catch','show','params','intersection','fields','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','pick','FaxQueueId','map','UserFaxQueue','User','UserId','agent','faxPause','updatedAt','createdAt','SIP','getTeams','nolimit','ids','Team','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','select','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','toString','QueryTypes','SELECT','union','compact','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','index','rawAttributes','type','keys','query','filters','model','attributes'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xd0f3,0xcd));var _0x3d0f=function(_0x221ca3,_0xb25dd3){_0x221ca3=_0x221ca3-0x0;var _0x5974e4=_0xd0f3[_0x221ca3];return _0x5974e4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3d0f('0x0'));var zipdir=require(_0x3d0f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d0f('0x2'));var moment=require(_0x3d0f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3d0f('0x4'));var util=require(_0x3d0f('0x5'));var path=require(_0x3d0f('0x6'));var sox=require(_0x3d0f('0x7'));var csv=require(_0x3d0f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3d0f('0x9'));var _=require('lodash');var squel=require(_0x3d0f('0xa'));var crypto=require(_0x3d0f('0xb'));var jsforce=require(_0x3d0f('0xc'));var deskjs=require(_0x3d0f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3d0f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3d0f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d0f('0x10'))(_0x3d0f('0x11'));var utils=require(_0x3d0f('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x3d0f('0x13'));var db=require(_0x3d0f('0x14'))['db'];config['redis']=_[_0x3d0f('0x15')](config[_0x3d0f('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d0f('0x17'))(new Redis(config[_0x3d0f('0x16')]));require('./faxQueue.socket')[_0x3d0f('0x18')](socket);function respondWithStatusCode(_0x55964c,_0xe7d4ba){_0xe7d4ba=_0xe7d4ba||0xcc;return function(_0x2b8d18){if(_0x2b8d18){return _0x55964c[_0x3d0f('0x19')](_0xe7d4ba);}return _0x55964c[_0x3d0f('0x1a')](_0xe7d4ba)[_0x3d0f('0x1b')]();};}function respondWithResult(_0x3ecbf4,_0x83934){_0x83934=_0x83934||0xc8;return function(_0x4318ff){if(_0x4318ff){return _0x3ecbf4[_0x3d0f('0x1a')](_0x83934)[_0x3d0f('0x1c')](_0x4318ff);}};}function respondWithFilteredResult(_0x58c8a0,_0x266a23){return function(_0x1c6c0d){if(_0x1c6c0d){var _0x4cce94=typeof _0x266a23[_0x3d0f('0x1d')]===_0x3d0f('0x1e')&&typeof _0x266a23[_0x3d0f('0x1f')]==='undefined';var _0x5a18f2=_0x1c6c0d[_0x3d0f('0x20')];var _0x5b90fa=_0x4cce94?0x0:_0x266a23['offset'];var _0x4a34c4=_0x4cce94?_0x1c6c0d[_0x3d0f('0x20')]:_0x266a23['offset']+_0x266a23[_0x3d0f('0x1f')];var _0x460665;if(_0x4a34c4>=_0x5a18f2){_0x4a34c4=_0x5a18f2;_0x460665=0xc8;}else{_0x460665=0xce;}_0x58c8a0[_0x3d0f('0x1a')](_0x460665);return _0x58c8a0[_0x3d0f('0x21')](_0x3d0f('0x22'),_0x5b90fa+'-'+_0x4a34c4+'/'+_0x5a18f2)['json'](_0x1c6c0d);}return null;};}function patchUpdates(_0xbd3589){return function(_0x5d3f65){try{jsonpatch[_0x3d0f('0x23')](_0x5d3f65,_0xbd3589,!![]);}catch(_0x241b00){return BPromise[_0x3d0f('0x24')](_0x241b00);}return _0x5d3f65[_0x3d0f('0x25')]();};}function saveUpdates(_0x318dc3,_0x5c91a2){return function(_0x473b3c){if(_0x473b3c){return _0x473b3c[_0x3d0f('0x26')](_0x318dc3)[_0x3d0f('0x27')](function(_0x4de604){return _0x4de604;});}return null;};}function removeEntity(_0x44f9cb,_0x408c0d){return function(_0x189700){if(_0x189700){return _0x189700[_0x3d0f('0x28')]()['then'](function(){var _0x178d7e=_0x189700[_0x3d0f('0x29')]({'plain':!![]});var _0xd1be9c=_0x3d0f('0x2a');return db[_0x3d0f('0x2b')]['destroy']({'where':{'type':_0xd1be9c,'resourceId':_0x178d7e['id']}})[_0x3d0f('0x27')](function(){return _0x189700;});})[_0x3d0f('0x27')](function(){_0x44f9cb[_0x3d0f('0x1a')](0xcc)[_0x3d0f('0x1b')]();});}};}function handleEntityNotFound(_0x463182,_0x291d8c){return function(_0x7ce317){if(!_0x7ce317){_0x463182[_0x3d0f('0x19')](0x194);}return _0x7ce317;};}function handleError(_0x5f18c9,_0x4f2de8){_0x4f2de8=_0x4f2de8||0x1f4;return function(_0x106e92){logger[_0x3d0f('0x2c')](_0x106e92[_0x3d0f('0x2d')]);if(_0x106e92[_0x3d0f('0x2e')]){delete _0x106e92[_0x3d0f('0x2e')];}_0x5f18c9[_0x3d0f('0x1a')](_0x4f2de8)['send'](_0x106e92);};}exports[_0x3d0f('0x2f')]=function(_0x19e236,_0x11261c){var _0x17e16d={},_0x5d3fec={},_0xb0d8ea={'count':0x0,'rows':[]};var _0x321636=_['map'](db['FaxQueue'][_0x3d0f('0x30')],function(_0x52f829){return{'name':_0x52f829['fieldName'],'type':_0x52f829[_0x3d0f('0x31')]['key']};});_0x5d3fec['model']=_['map'](_0x321636,_0x3d0f('0x2e'));_0x5d3fec['query']=_[_0x3d0f('0x32')](_0x19e236[_0x3d0f('0x33')]);_0x5d3fec[_0x3d0f('0x34')]=_['intersection'](_0x5d3fec[_0x3d0f('0x35')],_0x5d3fec[_0x3d0f('0x33')]);_0x17e16d['attributes']=_['intersection'](_0x5d3fec['model'],qs['fields'](_0x19e236['query']['fields']));_0x17e16d['attributes']=_0x17e16d[_0x3d0f('0x36')][_0x3d0f('0x37')]?_0x17e16d[_0x3d0f('0x36')]:_0x5d3fec[_0x3d0f('0x35')];if(!_0x19e236['query'][_0x3d0f('0x38')]('nolimit')){_0x17e16d[_0x3d0f('0x1f')]=qs['limit'](_0x19e236[_0x3d0f('0x33')][_0x3d0f('0x1f')]);_0x17e16d[_0x3d0f('0x1d')]=qs['offset'](_0x19e236['query'][_0x3d0f('0x1d')]);}_0x17e16d[_0x3d0f('0x39')]=qs[_0x3d0f('0x3a')](_0x19e236[_0x3d0f('0x33')][_0x3d0f('0x3a')]);_0x17e16d['where']=qs[_0x3d0f('0x34')](_['pick'](_0x19e236[_0x3d0f('0x33')],_0x5d3fec[_0x3d0f('0x34')]),_0x321636);if(_0x19e236['query']['filter']){_0x17e16d[_0x3d0f('0x3b')]=_[_0x3d0f('0x3c')](_0x17e16d['where'],{'$or':_['map'](_0x321636,function(_0x13a363){if(_0x13a363['type']!=='VIRTUAL'){var _0x4575c4={};_0x4575c4[_0x13a363[_0x3d0f('0x2e')]]={'$like':'%'+_0x19e236[_0x3d0f('0x33')][_0x3d0f('0x3d')]+'%'};return _0x4575c4;}})});}_0x17e16d=_[_0x3d0f('0x3c')]({},_0x17e16d,_0x19e236[_0x3d0f('0x3e')]);var _0x124e87={'where':_0x17e16d['where']};return db[_0x3d0f('0x3f')][_0x3d0f('0x20')](_0x124e87)['then'](function(_0x2f19cf){_0xb0d8ea[_0x3d0f('0x20')]=_0x2f19cf;if(_0x19e236['query'][_0x3d0f('0x40')]){_0x17e16d[_0x3d0f('0x41')]=[{'all':!![]}];}return db[_0x3d0f('0x3f')][_0x3d0f('0x42')](_0x17e16d);})[_0x3d0f('0x27')](function(_0x5c1fae){_0xb0d8ea[_0x3d0f('0x43')]=_0x5c1fae;return _0xb0d8ea;})[_0x3d0f('0x27')](respondWithFilteredResult(_0x11261c,_0x17e16d))[_0x3d0f('0x44')](handleError(_0x11261c,null));};exports[_0x3d0f('0x45')]=function(_0x518ce3,_0x2cad78){var _0x463bd3={'raw':!![],'where':{'id':_0x518ce3[_0x3d0f('0x46')]['id']}},_0x4bc47d={};_0x4bc47d[_0x3d0f('0x35')]=_['keys'](db[_0x3d0f('0x3f')][_0x3d0f('0x30')]);_0x4bc47d[_0x3d0f('0x33')]=_[_0x3d0f('0x32')](_0x518ce3[_0x3d0f('0x33')]);_0x4bc47d['filters']=_[_0x3d0f('0x47')](_0x4bc47d[_0x3d0f('0x35')],_0x4bc47d['query']);_0x463bd3[_0x3d0f('0x36')]=_[_0x3d0f('0x47')](_0x4bc47d[_0x3d0f('0x35')],qs[_0x3d0f('0x48')](_0x518ce3[_0x3d0f('0x33')][_0x3d0f('0x48')]));_0x463bd3['attributes']=_0x463bd3['attributes']['length']?_0x463bd3['attributes']:_0x4bc47d[_0x3d0f('0x35')];if(_0x518ce3[_0x3d0f('0x33')][_0x3d0f('0x40')]){_0x463bd3[_0x3d0f('0x41')]=[{'all':!![]}];}_0x463bd3=_[_0x3d0f('0x3c')]({},_0x463bd3,_0x518ce3['options']);return db[_0x3d0f('0x3f')][_0x3d0f('0x49')](_0x463bd3)[_0x3d0f('0x27')](handleEntityNotFound(_0x2cad78,null))[_0x3d0f('0x27')](respondWithResult(_0x2cad78,null))[_0x3d0f('0x44')](handleError(_0x2cad78,null));};exports[_0x3d0f('0x4a')]=function(_0x2980a5,_0x439c2a){return db[_0x3d0f('0x3f')][_0x3d0f('0x4a')](_0x2980a5[_0x3d0f('0x4b')],{})[_0x3d0f('0x27')](function(_0x256310){var _0x5d60d3=_0x2980a5['user'][_0x3d0f('0x29')]({'plain':!![]});if(!_0x5d60d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d60d3[_0x3d0f('0x4c')]===_0x3d0f('0x4d')){var _0x40c77e=_0x256310[_0x3d0f('0x29')]({'plain':!![]});var _0xef2777=_0x3d0f('0x2a');return db[_0x3d0f('0x4e')][_0x3d0f('0x49')]({'where':{'name':_0xef2777,'userProfileId':_0x5d60d3[_0x3d0f('0x4f')]},'raw':!![]})[_0x3d0f('0x27')](function(_0x1e0918){if(_0x1e0918&&_0x1e0918[_0x3d0f('0x50')]===0x0){return db[_0x3d0f('0x2b')]['create']({'name':_0x40c77e[_0x3d0f('0x2e')],'resourceId':_0x40c77e['id'],'type':_0x1e0918['name'],'sectionId':_0x1e0918['id']},{})[_0x3d0f('0x27')](function(){return _0x256310;});}else{return _0x256310;}})[_0x3d0f('0x44')](function(_0x4d1805){logger[_0x3d0f('0x2c')](_0x3d0f('0x51'),_0x4d1805);throw _0x4d1805;});}return _0x256310;})[_0x3d0f('0x27')](respondWithResult(_0x439c2a,0xc9))['catch'](handleError(_0x439c2a,null));};exports[_0x3d0f('0x26')]=function(_0x8132ce,_0x100f49){if(_0x8132ce[_0x3d0f('0x4b')]['id']){delete _0x8132ce[_0x3d0f('0x4b')]['id'];}return db[_0x3d0f('0x3f')][_0x3d0f('0x49')]({'where':{'id':_0x8132ce['params']['id']}})[_0x3d0f('0x27')](handleEntityNotFound(_0x100f49,null))[_0x3d0f('0x27')](saveUpdates(_0x8132ce[_0x3d0f('0x4b')],null))[_0x3d0f('0x27')](respondWithResult(_0x100f49,null))[_0x3d0f('0x44')](handleError(_0x100f49,null));};exports[_0x3d0f('0x28')]=function(_0x3aba68,_0x5c2d27){return db[_0x3d0f('0x3f')]['find']({'where':{'id':_0x3aba68[_0x3d0f('0x46')]['id']}})[_0x3d0f('0x27')](handleEntityNotFound(_0x5c2d27,null))['then'](removeEntity(_0x5c2d27,null))['catch'](handleError(_0x5c2d27,null));};exports[_0x3d0f('0x52')]=function(_0x2b3d27,_0xf08715){return db[_0x3d0f('0x3f')][_0x3d0f('0x52')]()[_0x3d0f('0x27')](respondWithResult(_0xf08715,null))[_0x3d0f('0x44')](handleError(_0xf08715,null));};exports[_0x3d0f('0x53')]=function(_0x1c94d3,_0x4bcce3,_0x15d696){var _0x564a0f={'raw':!![],'where':{}},_0x2b8dc8={},_0x464add;return db[_0x3d0f('0x3f')][_0x3d0f('0x54')]({'where':{'id':_0x1c94d3['params']['id']}})['then'](handleEntityNotFound(_0x4bcce3,null))['then'](function(_0xf19ee2){if(_0xf19ee2){_0x464add=_0xf19ee2[_0x3d0f('0x29')]({'plain':!![]});_0x2b8dc8[_0x3d0f('0x35')]=_[_0x3d0f('0x32')](db['UserFaxQueue'][_0x3d0f('0x30')]);_0x2b8dc8[_0x3d0f('0x33')]=_[_0x3d0f('0x32')](_0x1c94d3[_0x3d0f('0x33')]);_0x2b8dc8[_0x3d0f('0x34')]=_[_0x3d0f('0x47')](_0x2b8dc8[_0x3d0f('0x35')],_0x2b8dc8[_0x3d0f('0x33')]);_0x564a0f['attributes']=_[_0x3d0f('0x47')](_0x2b8dc8[_0x3d0f('0x35')],qs[_0x3d0f('0x48')](_0x1c94d3[_0x3d0f('0x33')][_0x3d0f('0x48')]));_0x564a0f['attributes']=_0x564a0f['attributes'][_0x3d0f('0x37')]?_0x564a0f[_0x3d0f('0x36')]:_0x2b8dc8['model'];if(!_0x1c94d3[_0x3d0f('0x33')][_0x3d0f('0x38')]('nolimit')){_0x564a0f[_0x3d0f('0x1f')]=qs[_0x3d0f('0x1f')](_0x1c94d3['query'][_0x3d0f('0x1f')]);_0x564a0f[_0x3d0f('0x1d')]=qs[_0x3d0f('0x1d')](_0x1c94d3['query'][_0x3d0f('0x1d')]);}_0x564a0f['order']=qs[_0x3d0f('0x3a')](_0x1c94d3[_0x3d0f('0x33')]['sort']);_0x564a0f[_0x3d0f('0x3b')]=qs[_0x3d0f('0x34')](_[_0x3d0f('0x55')](_0x1c94d3[_0x3d0f('0x33')],_0x2b8dc8[_0x3d0f('0x34')]));_0x564a0f[_0x3d0f('0x3b')][_0x3d0f('0x56')]=_0xf19ee2['id'];if(_0x1c94d3[_0x3d0f('0x33')]['filter']){_0x564a0f[_0x3d0f('0x3b')]=_[_0x3d0f('0x3c')](_0x564a0f[_0x3d0f('0x3b')],{'$or':_[_0x3d0f('0x57')](_0x564a0f[_0x3d0f('0x36')],function(_0x59545b){var _0x101ff9={};_0x101ff9[_0x59545b]={'$like':'%'+_0x1c94d3[_0x3d0f('0x33')][_0x3d0f('0x3d')]+'%'};return _0x101ff9;})});}_0x564a0f=_[_0x3d0f('0x3c')]({},_0x564a0f,_0x1c94d3[_0x3d0f('0x3e')]);return db[_0x3d0f('0x58')][_0x3d0f('0x42')](_0x564a0f);}})['then'](function(_0x3f92ef){if(_0x3f92ef){return db[_0x3d0f('0x59')]['findAndCountAll']({'where':{'id':_[_0x3d0f('0x57')](_0x3f92ef,_0x3d0f('0x5a')),'role':_0x3d0f('0x5b')},'attributes':['id',_0x3d0f('0x2e'),_0x3d0f('0x5c'),_0x3d0f('0x5d'),_0x3d0f('0x5e')]});}})[_0x3d0f('0x27')](function(_0x465123){if(_0x465123){return{'count':_0x465123[_0x3d0f('0x20')],'rows':_['map'](_0x465123[_0x3d0f('0x43')],function(_0x37f7d4){return{'membername':_0x37f7d4['name'],'UserId':_0x37f7d4['id'],'queue_name':_0x464add['name'],'FaxQueueId':_0x464add['id'],'interface':util['format']('%s/%s',_0x3d0f('0x5f'),_0x37f7d4[_0x3d0f('0x2e')]),'penalty':0x0,'paused':_0x37f7d4[_0x3d0f('0x5c')],'createdAt':_0x37f7d4[_0x3d0f('0x5e')],'updatedAt':_0x37f7d4[_0x3d0f('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4bcce3,_0x564a0f))['catch'](handleError(_0x4bcce3,null));};exports[_0x3d0f('0x60')]=function(_0x5bda5a,_0x50e20a,_0x215518){var _0x38f2b4={};var _0x540ca2={};var _0x41b441;var _0x28bf02;return db[_0x3d0f('0x3f')]['findOne']({'where':{'id':_0x5bda5a[_0x3d0f('0x46')]['id']}})[_0x3d0f('0x27')](handleEntityNotFound(_0x50e20a,null))['then'](function(_0x1495ac){if(_0x1495ac){_0x41b441=_0x1495ac;_0x540ca2[_0x3d0f('0x35')]=_[_0x3d0f('0x32')](db['Team'][_0x3d0f('0x30')]);_0x540ca2['query']=_[_0x3d0f('0x32')](_0x5bda5a[_0x3d0f('0x33')]);_0x540ca2[_0x3d0f('0x34')]=_['intersection'](_0x540ca2[_0x3d0f('0x35')],_0x540ca2['query']);_0x38f2b4[_0x3d0f('0x36')]=_[_0x3d0f('0x47')](_0x540ca2[_0x3d0f('0x35')],qs[_0x3d0f('0x48')](_0x5bda5a[_0x3d0f('0x33')][_0x3d0f('0x48')]));_0x38f2b4['attributes']=_0x38f2b4[_0x3d0f('0x36')][_0x3d0f('0x37')]?_0x38f2b4['attributes']:_0x540ca2['model'];_0x38f2b4[_0x3d0f('0x39')]=qs[_0x3d0f('0x3a')](_0x5bda5a['query']['sort']);_0x38f2b4['where']=qs[_0x3d0f('0x34')](_[_0x3d0f('0x55')](_0x5bda5a[_0x3d0f('0x33')],_0x540ca2[_0x3d0f('0x34')]));if(_0x5bda5a[_0x3d0f('0x33')][_0x3d0f('0x3d')]){_0x38f2b4[_0x3d0f('0x3b')]=_[_0x3d0f('0x3c')](_0x38f2b4[_0x3d0f('0x3b')],{'$or':_[_0x3d0f('0x57')](_0x38f2b4[_0x3d0f('0x36')],function(_0x4d9f88){var _0x5ea457={};_0x5ea457[_0x4d9f88]={'$like':'%'+_0x5bda5a[_0x3d0f('0x33')][_0x3d0f('0x3d')]+'%'};return _0x5ea457;})});}_0x38f2b4=_[_0x3d0f('0x3c')]({},_0x38f2b4,_0x5bda5a[_0x3d0f('0x3e')]);return _0x41b441[_0x3d0f('0x60')](_0x38f2b4);}})[_0x3d0f('0x27')](function(_0x5f0d66){if(_0x5f0d66){_0x28bf02=_0x5f0d66[_0x3d0f('0x37')];if(!_0x5bda5a[_0x3d0f('0x33')]['hasOwnProperty'](_0x3d0f('0x61'))){_0x38f2b4[_0x3d0f('0x1f')]=qs[_0x3d0f('0x1f')](_0x5bda5a[_0x3d0f('0x33')][_0x3d0f('0x1f')]);_0x38f2b4[_0x3d0f('0x1d')]=qs[_0x3d0f('0x1d')](_0x5bda5a[_0x3d0f('0x33')][_0x3d0f('0x1d')]);}return _0x41b441['getTeams'](_0x38f2b4);}})[_0x3d0f('0x27')](function(_0x119cd8){if(_0x119cd8){return _0x119cd8?{'count':_0x28bf02,'rows':_0x119cd8}:null;}})[_0x3d0f('0x27')](respondWithResult(_0x50e20a,null))[_0x3d0f('0x44')](handleError(_0x50e20a,null));};exports['addTeams']=function(_0x42e876,_0x4c6528,_0x442d3d){var _0x48bcfd=_0x42e876[_0x3d0f('0x4b')][_0x3d0f('0x62')];return db[_0x3d0f('0x63')][_0x3d0f('0x42')]({'where':{'id':_0x48bcfd},'attributes':['id'],'include':[{'model':db[_0x3d0f('0x59')],'as':_0x3d0f('0x64'),'attributes':['id',_0x3d0f('0x2e'),_0x3d0f('0x65'),_0x3d0f('0x66'),_0x3d0f('0x67')],'raw':!![]}]})['then'](function(_0x3047ba){if(_0x3047ba){var _0xe337c0=_['flatMap'](_0x3047ba,function(_0x294a6b){var _0x5d79ab=_0x294a6b[_0x3d0f('0x29')]({'plain':!![]});return _0x5d79ab[_0x3d0f('0x64')];});return db[_0x3d0f('0x3f')]['find']({'where':{'id':_0x42e876[_0x3d0f('0x46')]['id']}})[_0x3d0f('0x27')](function(_0xea2a41){return db[_0x3d0f('0x68')][_0x3d0f('0x69')](function(_0x115fca){return _0xea2a41[_0x3d0f('0x6a')](_0x48bcfd,{'transaction':_0x115fca})[_0x3d0f('0x27')](function(){return BPromise[_0x3d0f('0x6b')](_0xe337c0,function(_0x1a9562){return db[_0x3d0f('0x58')][_0x3d0f('0x6c')]({'where':{'UserId':_0x1a9562['id'],'FaxQueueId':_0x42e876[_0x3d0f('0x46')]['id']},'transaction':_0x115fca});});})['then'](function(){_0xe337c0[_0x3d0f('0x6d')](function(_0x95cedf){socket[_0x3d0f('0x6e')]('userFaxQueue:save',{'UserId':_0x95cedf['id'],'FaxQueueId':_0xea2a41['id']});});});});});}})['then'](respondWithStatusCode(_0x4c6528,null))[_0x3d0f('0x44')](handleError(_0x4c6528,null));};exports[_0x3d0f('0x6f')]=function(_0x29b20c,_0x3fe98a,_0x25a3b8){return db['Team'][_0x3d0f('0x42')]({'where':{'id':_0x29b20c[_0x3d0f('0x33')][_0x3d0f('0x62')]},'attributes':['id'],'include':[{'model':db[_0x3d0f('0x59')],'as':_0x3d0f('0x64'),'attributes':['id'],'raw':!![]}]})[_0x3d0f('0x27')](handleEntityNotFound(_0x3fe98a,null))['then'](function(_0x5d2c94){var _0x182c87=_[_0x3d0f('0x57')](_0x5d2c94,'id');var _0x8c8eb1=[];var _0x582590=[];var _0x161a8a=squel[_0x3d0f('0x70')]();_0x161a8a['field'](_0x3d0f('0x71'))['from']('team_has_fax_queues','tq')[_0x3d0f('0x72')](_0x3d0f('0x73'),'ut',_0x3d0f('0x74'))[_0x3d0f('0x3b')]('FaxQueueId\x20=\x20?',_0x29b20c[_0x3d0f('0x46')]['id']);for(var _0x3d12bc=0x0;_0x3d12bc<_0x5d2c94[_0x3d0f('0x37')];_0x3d12bc+=0x1){let _0x51b8b5=_0x5d2c94[_0x3d12bc];for(var _0x4c48ae=0x0;_0x4c48ae<_0x51b8b5['Agents']['length'];_0x4c48ae+=0x1){let _0x2da9e7=_0x51b8b5[_0x3d0f('0x64')][_0x4c48ae];var _0x5061ff=_0x161a8a['clone']();_0x5061ff[_0x3d0f('0x3b')]('ut.UserId\x20=\x20?',_0x2da9e7['id']);_0x582590[_0x3d0f('0x75')](db[_0x3d0f('0x68')][_0x3d0f('0x33')](_0x5061ff[_0x3d0f('0x76')](),{'type':db[_0x3d0f('0x68')][_0x3d0f('0x77')][_0x3d0f('0x78')]})[_0x3d0f('0x27')](function(_0x189376){if(_0x189376['length']===0x1){return _0x2da9e7['id'];}else{var _0x313dc5=_['every'](_['map'](_0x189376,'TeamId'),function(_0x460c20){return _['includes'](_0x182c87,_0x460c20);});if(_0x313dc5){return _0x2da9e7['id'];}}}));}}return BPromise['all'](_0x582590)[_0x3d0f('0x27')](function(_0x26084c){_0x8c8eb1=_(_0x8c8eb1)[_0x3d0f('0x79')](_0x26084c)[_0x3d0f('0x7a')]()['value']();return db[_0x3d0f('0x3f')][_0x3d0f('0x49')]({'where':{'id':_0x29b20c[_0x3d0f('0x46')]['id']}})[_0x3d0f('0x27')](function(_0x19fae6){return db[_0x3d0f('0x68')]['transaction'](function(_0x53e88d){return _0x19fae6[_0x3d0f('0x6f')](_0x29b20c['query'][_0x3d0f('0x62')],{'transaction':_0x53e88d})[_0x3d0f('0x27')](function(){if(!_[_0x3d0f('0x7b')](_0x8c8eb1)){return _0x19fae6[_0x3d0f('0x7c')](_0x8c8eb1,{'transaction':_0x53e88d});}})[_0x3d0f('0x27')](function(){_0x8c8eb1['forEach'](function(_0x1aeb1b){socket[_0x3d0f('0x6e')](_0x3d0f('0x7d'),{'UserId':_0x1aeb1b,'FaxQueueId':_0x19fae6['id']});});});});});});})[_0x3d0f('0x27')](respondWithStatusCode(_0x3fe98a,null))[_0x3d0f('0x44')](handleError(_0x3fe98a,null));};exports[_0x3d0f('0x7e')]=function(_0x1a2d7a,_0x38ddaf,_0x441aca){return db[_0x3d0f('0x3f')]['find']({'where':{'id':_0x1a2d7a['params']['id']}})['then'](handleEntityNotFound(_0x38ddaf,null))[_0x3d0f('0x27')](function(_0x2d262a){if(_0x2d262a){return _0x2d262a[_0x3d0f('0x7e')](_0x1a2d7a[_0x3d0f('0x4b')]['ids'],_[_0x3d0f('0x7f')](_0x1a2d7a[_0x3d0f('0x4b')],[_0x3d0f('0x62'),'id'])||{})[_0x3d0f('0x80')](function(_0x5fc0e9){for(var _0x3d54ec=0x0;_0x3d54ec<_0x1a2d7a['body'][_0x3d0f('0x62')]['length'];_0x3d54ec+=0x1){socket[_0x3d0f('0x6e')](_0x3d0f('0x81'),{'UserId':Number(_0x1a2d7a[_0x3d0f('0x4b')][_0x3d0f('0x62')][_0x3d54ec]),'FaxQueueId':Number(_0x1a2d7a['params']['id'])});}return _0x5fc0e9;});}})[_0x3d0f('0x27')](respondWithResult(_0x38ddaf,null))[_0x3d0f('0x44')](handleError(_0x38ddaf,null));};exports[_0x3d0f('0x7c')]=function(_0x2e9da0,_0x2a167a,_0x473db8){return db[_0x3d0f('0x3f')][_0x3d0f('0x49')]({'where':{'id':_0x2e9da0[_0x3d0f('0x46')]['id']}})[_0x3d0f('0x27')](handleEntityNotFound(_0x2a167a,null))[_0x3d0f('0x27')](function(_0x1f4e6a){if(_0x1f4e6a){return _0x1f4e6a['removeAgents'](_0x2e9da0[_0x3d0f('0x33')][_0x3d0f('0x62')])[_0x3d0f('0x27')](function(){if(_['isArray'](_0x2e9da0[_0x3d0f('0x33')][_0x3d0f('0x62')])){for(var _0x10dddf=0x0;_0x10dddf<_0x2e9da0['query'][_0x3d0f('0x62')]['length'];_0x10dddf+=0x1){socket['emit'](_0x3d0f('0x7d'),{'UserId':Number(_0x2e9da0[_0x3d0f('0x33')][_0x3d0f('0x62')][_0x10dddf]),'FaxQueueId':Number(_0x2e9da0[_0x3d0f('0x46')]['id'])});}}else{socket[_0x3d0f('0x6e')]('userFaxQueue:remove',{'UserId':Number(_0x2e9da0['query']['ids']),'FaxQueueId':Number(_0x2e9da0['params']['id'])});}});}})[_0x3d0f('0x27')](respondWithStatusCode(_0x2a167a,null))[_0x3d0f('0x44')](handleError(_0x2a167a,null));};exports['getAgents']=function(_0x1712d5,_0x270d7f,_0x2d1109){var _0x54b809={};var _0x238995={};var _0x2ee861;var _0x37fd88;return db[_0x3d0f('0x3f')][_0x3d0f('0x54')]({'where':{'id':_0x1712d5[_0x3d0f('0x46')]['id']}})[_0x3d0f('0x27')](handleEntityNotFound(_0x270d7f,null))[_0x3d0f('0x27')](function(_0x2f88b3){if(_0x2f88b3){_0x2ee861=_0x2f88b3;_0x238995['model']=_[_0x3d0f('0x32')](db[_0x3d0f('0x59')][_0x3d0f('0x30')]);_0x238995[_0x3d0f('0x33')]=_[_0x3d0f('0x32')](_0x1712d5[_0x3d0f('0x33')]);_0x238995['filters']=_[_0x3d0f('0x47')](_0x238995['model'],_0x238995[_0x3d0f('0x33')]);_0x54b809['attributes']=_[_0x3d0f('0x47')](_0x238995[_0x3d0f('0x35')],qs[_0x3d0f('0x48')](_0x1712d5['query'][_0x3d0f('0x48')]));_0x54b809[_0x3d0f('0x36')]=_0x54b809[_0x3d0f('0x36')][_0x3d0f('0x37')]?_0x54b809['attributes']:_0x238995[_0x3d0f('0x35')];_0x54b809[_0x3d0f('0x39')]=qs[_0x3d0f('0x3a')](_0x1712d5[_0x3d0f('0x33')][_0x3d0f('0x3a')]);_0x54b809[_0x3d0f('0x3b')]=qs[_0x3d0f('0x34')](_['pick'](_0x1712d5[_0x3d0f('0x33')],_0x238995[_0x3d0f('0x34')]));if(_0x1712d5[_0x3d0f('0x33')][_0x3d0f('0x3d')]){_0x54b809['where']=_[_0x3d0f('0x3c')](_0x54b809[_0x3d0f('0x3b')],{'$or':_[_0x3d0f('0x57')](_0x54b809[_0x3d0f('0x36')],function(_0xc6fcf5){var _0x39aa30={};_0x39aa30[_0xc6fcf5]={'$like':'%'+_0x1712d5[_0x3d0f('0x33')][_0x3d0f('0x3d')]+'%'};return _0x39aa30;})});}_0x54b809=_[_0x3d0f('0x3c')]({},_0x54b809,_0x1712d5[_0x3d0f('0x3e')]);return _0x2ee861['getAgents'](_0x54b809);}})[_0x3d0f('0x27')](function(_0x20263a){if(_0x20263a){_0x37fd88=_0x20263a[_0x3d0f('0x37')];if(!_0x1712d5[_0x3d0f('0x33')][_0x3d0f('0x38')]('nolimit')){_0x54b809[_0x3d0f('0x1f')]=qs['limit'](_0x1712d5[_0x3d0f('0x33')][_0x3d0f('0x1f')]);_0x54b809[_0x3d0f('0x1d')]=qs[_0x3d0f('0x1d')](_0x1712d5['query'][_0x3d0f('0x1d')]);}return _0x2ee861['getAgents'](_0x54b809);}})[_0x3d0f('0x27')](function(_0x272280){if(_0x272280){return _0x272280?{'count':_0x37fd88,'rows':_0x272280}:null;}})[_0x3d0f('0x27')](respondWithResult(_0x270d7f,null))[_0x3d0f('0x44')](handleError(_0x270d7f,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 7595601..0675510 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 _0x7945=['remove','emit','hasOwnProperty','hook','../../mysqldb','FaxQueue','save'];(function(_0x5de532,_0x2941c4){var _0x4e9192=function(_0x548a81){while(--_0x548a81){_0x5de532['push'](_0x5de532['shift']());}};_0x4e9192(++_0x2941c4);}(_0x7945,0x14d));var _0x5794=function(_0x290b21,_0x4a1487){_0x290b21=_0x290b21-0x0;var _0x1e40ba=_0x7945[_0x290b21];return _0x1e40ba;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x5794('0x0'))['db'][_0x5794('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5794('0x2'),'afterUpdate':'update','afterDestroy':_0x5794('0x3')};function emitEvent(_0x39bac0){return function(_0x5029ef,_0xf11d57,_0x34c85c){FaxQueueEvents[_0x5794('0x4')](_0x39bac0+':'+_0x5029ef['id'],_0x5029ef);FaxQueueEvents['emit'](_0x39bac0,_0x5029ef);_0x34c85c(null);};}for(var e in events){if(events[_0x5794('0x5')](e)){var event=events[e];FaxQueue[_0x5794('0x6')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0xcad1=['save','update','remove','emit','hook','exports','events','FaxQueue','setMaxListeners'];(function(_0x284781,_0x149474){var _0x140ecc=function(_0x75c57b){while(--_0x75c57b){_0x284781['push'](_0x284781['shift']());}};_0x140ecc(++_0x149474);}(_0xcad1,0x16e));var _0x1cad=function(_0x7a8ad8,_0x3924a8){_0x7a8ad8=_0x7a8ad8-0x0;var _0x3cdf82=_0xcad1[_0x7a8ad8];return _0x3cdf82;};'use strict';var EventEmitter=require(_0x1cad('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x1cad('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x1cad('0x2')](0x0);var events={'afterCreate':_0x1cad('0x3'),'afterUpdate':_0x1cad('0x4'),'afterDestroy':_0x1cad('0x5')};function emitEvent(_0x1df02b){return function(_0x5184f6,_0x201b48,_0x4a7772){FaxQueueEvents[_0x1cad('0x6')](_0x1df02b+':'+_0x5184f6['id'],_0x5184f6);FaxQueueEvents[_0x1cad('0x6')](_0x1df02b,_0x5184f6);_0x4a7772(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x1cad('0x7')](e,emitEvent(event));}}module[_0x1cad('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 d9080ea..f72d32b 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 _0x777e=['rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','api','moment','bluebird'];(function(_0x19e02a,_0xc0be3e){var _0x24b8ff=function(_0x2a1ad1){while(--_0x2a1ad1){_0x19e02a['push'](_0x19e02a['shift']());}};_0x24b8ff(++_0xc0be3e);}(_0x777e,0xeb));var _0xe777=function(_0x55e724,_0x8f22f1){_0x55e724=_0x55e724-0x0;var _0x1b317c=_0x777e[_0x55e724];return _0x1b317c;};'use strict';var _=require(_0xe777('0x0'));var util=require(_0xe777('0x1'));var logger=require('../../config/logger')(_0xe777('0x2'));var moment=require(_0xe777('0x3'));var BPromise=require(_0xe777('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe777('0x5'));var config=require(_0xe777('0x6'));var attributes=require(_0xe777('0x7'));module[_0xe777('0x8')]=function(_0x337309,_0x160ac0){return _0x337309[_0xe777('0x9')](_0xe777('0xa'),attributes,{'tableName':_0xe777('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61e5=['request-promise','path','rimraf','./faxQueue.attributes','FaxQueue','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x498ad8,_0x168ccb){var _0x165383=function(_0x41d1dc){while(--_0x41d1dc){_0x498ad8['push'](_0x498ad8['shift']());}};_0x165383(++_0x168ccb);}(_0x61e5,0xf7));var _0x561e=function(_0x28a580,_0x5a52f8){_0x28a580=_0x28a580-0x0;var _0x24096c=_0x61e5[_0x28a580];return _0x24096c;};'use strict';var _=require(_0x561e('0x0'));var util=require(_0x561e('0x1'));var logger=require(_0x561e('0x2'))(_0x561e('0x3'));var moment=require(_0x561e('0x4'));var BPromise=require(_0x561e('0x5'));var rp=require(_0x561e('0x6'));var fs=require('fs');var path=require(_0x561e('0x7'));var rimraf=require(_0x561e('0x8'));var config=require('../../config/environment');var attributes=require(_0x561e('0x9'));module['exports']=function(_0x3c31d9,_0x32d14f){return _0x3c31d9['define'](_0x561e('0xa'),attributes,{'tableName':'fax_queues','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 d8819e2..76c1a60 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 _0x03d9=['include','model','map','GetFaxQueue','find','where','ShowFaxQueue','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','socket.io-emitter','./faxQueue.socket','register','request','then','info','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxQueue,\x20%s,\x20%s','message','result','FaxQueue','raw','options','attributes'];(function(_0x18f80b,_0x46368a){var _0x54a62d=function(_0x5870c3){while(--_0x5870c3){_0x18f80b['push'](_0x18f80b['shift']());}};_0x54a62d(++_0x46368a);}(_0x03d9,0xe0));var _0x903d=function(_0x3c00bf,_0x40bb43){_0x3c00bf=_0x3c00bf-0x0;var _0x20ffdf=_0x03d9[_0x3c00bf];return _0x20ffdf;};'use strict';var _=require('lodash');var util=require(_0x903d('0x0'));var moment=require(_0x903d('0x1'));var BPromise=require(_0x903d('0x2'));var rs=require(_0x903d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x903d('0x4'))['db'];var utils=require(_0x903d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x903d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x903d('0x7')][_0x903d('0x8')]({'port':0x232a});config[_0x903d('0x9')]=_['defaults'](config[_0x903d('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x903d('0xa'))(new Redis(config['redis']));require(_0x903d('0xb'))[_0x903d('0xc')](socket);function respondWithRpcPromise(_0x46ab2d,_0x41e323,_0x5c69e3){return new BPromise(function(_0x17cc3a,_0xf4a9af){return client[_0x903d('0xd')](_0x46ab2d,_0x5c69e3)[_0x903d('0xe')](function(_0x1ade97){logger[_0x903d('0xf')]('FaxQueue,\x20%s,\x20%s',_0x41e323,'request\x20sent');logger[_0x903d('0x10')](_0x903d('0x11'),_0x41e323,_0x903d('0x12'),JSON[_0x903d('0x13')](_0x1ade97));if(_0x1ade97[_0x903d('0x14')]){if(_0x1ade97['error']['code']===0x1f4){logger['error'](_0x903d('0x15'),_0x41e323,_0x1ade97[_0x903d('0x14')]['message']);return _0xf4a9af(_0x1ade97[_0x903d('0x14')]['message']);}logger[_0x903d('0x14')]('FaxQueue,\x20%s,\x20%s',_0x41e323,_0x1ade97[_0x903d('0x14')][_0x903d('0x16')]);return _0x17cc3a(_0x1ade97['error'][_0x903d('0x16')]);}else{logger[_0x903d('0xf')](_0x903d('0x15'),_0x41e323,_0x903d('0x12'));_0x17cc3a(_0x1ade97[_0x903d('0x17')][_0x903d('0x16')]);}})['catch'](function(_0x7ae4f1){logger[_0x903d('0x14')](_0x903d('0x15'),_0x41e323,_0x7ae4f1);_0xf4a9af(_0x7ae4f1);});});}exports['GetFaxQueue']=function(_0x52151b){var _0x2c47fa=this;return new Promise(function(_0x3add79,_0x42703a){return db[_0x903d('0x18')]['findAll']({'raw':_0x52151b['options']?_0x52151b['options'][_0x903d('0x19')]===undefined?!![]:![]:!![],'where':_0x52151b[_0x903d('0x1a')]?_0x52151b[_0x903d('0x1a')]['where']||null:null,'attributes':_0x52151b[_0x903d('0x1a')]?_0x52151b[_0x903d('0x1a')][_0x903d('0x1b')]||null:null,'limit':_0x52151b[_0x903d('0x1a')]?_0x52151b[_0x903d('0x1a')]['limit']||null:null,'include':_0x52151b['options']?_0x52151b['options'][_0x903d('0x1c')]?_['map'](_0x52151b[_0x903d('0x1a')][_0x903d('0x1c')],function(_0x143d4c){return{'model':db[_0x143d4c[_0x903d('0x1d')]],'as':_0x143d4c['as'],'attributes':_0x143d4c[_0x903d('0x1b')],'include':_0x143d4c[_0x903d('0x1c')]?_[_0x903d('0x1e')](_0x143d4c[_0x903d('0x1c')],function(_0x27722d){return{'model':db[_0x27722d[_0x903d('0x1d')]],'as':_0x27722d['as'],'attributes':_0x27722d[_0x903d('0x1b')],'include':_0x27722d[_0x903d('0x1c')]?_[_0x903d('0x1e')](_0x27722d[_0x903d('0x1c')],function(_0xf186d3){return{'model':db[_0xf186d3[_0x903d('0x1d')]],'as':_0xf186d3['as'],'attributes':_0xf186d3[_0x903d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x903d('0xe')](function(_0x594268){logger[_0x903d('0xf')](_0x903d('0x1f'),_0x52151b);logger[_0x903d('0x10')](_0x903d('0x1f'),_0x52151b,JSON[_0x903d('0x13')](_0x594268));_0x3add79(_0x594268);})['catch'](function(_0x4139aa){logger['error'](_0x903d('0x1f'),_0x4139aa['message'],_0x52151b);_0x42703a(_0x2c47fa[_0x903d('0x14')](0x1f4,_0x4139aa[_0x903d('0x16')]));});});};exports['ShowFaxQueue']=function(_0x12430a){var _0x495b90=this;return new Promise(function(_0x1c8e0e,_0x3b1772){return db[_0x903d('0x18')][_0x903d('0x20')]({'raw':_0x12430a[_0x903d('0x1a')]?_0x12430a[_0x903d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x12430a[_0x903d('0x1a')]?_0x12430a['options'][_0x903d('0x21')]||null:null,'attributes':_0x12430a['options']?_0x12430a[_0x903d('0x1a')][_0x903d('0x1b')]||null:null,'include':_0x12430a[_0x903d('0x1a')]?_0x12430a[_0x903d('0x1a')][_0x903d('0x1c')]?_[_0x903d('0x1e')](_0x12430a[_0x903d('0x1a')]['include'],function(_0x54b612){return{'model':db[_0x54b612[_0x903d('0x1d')]],'as':_0x54b612['as'],'attributes':_0x54b612[_0x903d('0x1b')],'include':_0x54b612[_0x903d('0x1c')]?_['map'](_0x54b612['include'],function(_0x29a269){return{'model':db[_0x29a269[_0x903d('0x1d')]],'as':_0x29a269['as'],'attributes':_0x29a269['attributes'],'include':_0x29a269[_0x903d('0x1c')]?_[_0x903d('0x1e')](_0x29a269[_0x903d('0x1c')],function(_0x35d19a){return{'model':db[_0x35d19a['model']],'as':_0x35d19a['as'],'attributes':_0x35d19a['attributes']};}):[]};}):[]};}):[]:[]})[_0x903d('0xe')](function(_0xa71228){logger[_0x903d('0xf')]('ShowFaxQueue',_0x12430a);logger[_0x903d('0x10')](_0x903d('0x22'),_0x12430a,JSON[_0x903d('0x13')](_0xa71228));_0x1c8e0e(_0xa71228);})[_0x903d('0x23')](function(_0x57dd78){logger[_0x903d('0x14')](_0x903d('0x22'),_0x57dd78[_0x903d('0x16')],_0x12430a);_0x3b1772(_0x495b90[_0x903d('0x14')](0x1f4,_0x57dd78['message']));});});}; \ No newline at end of file +var _0x1c3c=['redis','./faxQueue.socket','request','then','FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','GetFaxQueue','FaxQueue','options','raw','where','attributes','include','map','model','debug','catch','ShowFaxQueue','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','localhost','socket.io-emitter'];(function(_0xbf5e16,_0x146ce3){var _0x5975a5=function(_0x2387a7){while(--_0x2387a7){_0xbf5e16['push'](_0xbf5e16['shift']());}};_0x5975a5(++_0x146ce3);}(_0x1c3c,0x84));var _0xc1c3=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x1c3c[_0x11c573];return _0x6b72de;};'use strict';var _=require('lodash');var util=require(_0xc1c3('0x0'));var moment=require(_0xc1c3('0x1'));var BPromise=require(_0xc1c3('0x2'));var rs=require(_0xc1c3('0x3'));var fs=require('fs');var Redis=require(_0xc1c3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1c3('0x5'));var logger=require('../../config/logger')(_0xc1c3('0x6'));var config=require(_0xc1c3('0x7'));var jayson=require(_0xc1c3('0x8'));var client=jayson[_0xc1c3('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xc1c3('0xa'),'port':0x18eb});var socket=require(_0xc1c3('0xb'))(new Redis(config[_0xc1c3('0xc')]));require(_0xc1c3('0xd'))['register'](socket);function respondWithRpcPromise(_0x5eb5ba,_0xd03a5e,_0x111b90){return new BPromise(function(_0x5d3426,_0x286249){return client[_0xc1c3('0xe')](_0x5eb5ba,_0x111b90)[_0xc1c3('0xf')](function(_0x210946){logger['info'](_0xc1c3('0x10'),_0xd03a5e,'request\x20sent');logger['debug'](_0xc1c3('0x11'),_0xd03a5e,_0xc1c3('0x12'),JSON[_0xc1c3('0x13')](_0x210946));if(_0x210946['error']){if(_0x210946['error']['code']===0x1f4){logger[_0xc1c3('0x14')](_0xc1c3('0x10'),_0xd03a5e,_0x210946[_0xc1c3('0x14')][_0xc1c3('0x15')]);return _0x286249(_0x210946[_0xc1c3('0x14')][_0xc1c3('0x15')]);}logger[_0xc1c3('0x14')](_0xc1c3('0x10'),_0xd03a5e,_0x210946[_0xc1c3('0x14')][_0xc1c3('0x15')]);return _0x5d3426(_0x210946[_0xc1c3('0x14')][_0xc1c3('0x15')]);}else{logger[_0xc1c3('0x16')](_0xc1c3('0x10'),_0xd03a5e,_0xc1c3('0x12'));_0x5d3426(_0x210946[_0xc1c3('0x17')][_0xc1c3('0x15')]);}})['catch'](function(_0x1c95fc){logger[_0xc1c3('0x14')](_0xc1c3('0x10'),_0xd03a5e,_0x1c95fc);_0x286249(_0x1c95fc);});});}exports[_0xc1c3('0x18')]=function(_0x4030aa){var _0x502d76=this;return new Promise(function(_0x22adf6,_0x25c72f){return db[_0xc1c3('0x19')]['findAll']({'raw':_0x4030aa[_0xc1c3('0x1a')]?_0x4030aa[_0xc1c3('0x1a')][_0xc1c3('0x1b')]===undefined?!![]:![]:!![],'where':_0x4030aa[_0xc1c3('0x1a')]?_0x4030aa[_0xc1c3('0x1a')][_0xc1c3('0x1c')]||null:null,'attributes':_0x4030aa['options']?_0x4030aa[_0xc1c3('0x1a')][_0xc1c3('0x1d')]||null:null,'limit':_0x4030aa['options']?_0x4030aa[_0xc1c3('0x1a')]['limit']||null:null,'include':_0x4030aa[_0xc1c3('0x1a')]?_0x4030aa['options'][_0xc1c3('0x1e')]?_[_0xc1c3('0x1f')](_0x4030aa['options'][_0xc1c3('0x1e')],function(_0x281de8){return{'model':db[_0x281de8[_0xc1c3('0x20')]],'as':_0x281de8['as'],'attributes':_0x281de8[_0xc1c3('0x1d')],'include':_0x281de8[_0xc1c3('0x1e')]?_[_0xc1c3('0x1f')](_0x281de8[_0xc1c3('0x1e')],function(_0x529007){return{'model':db[_0x529007[_0xc1c3('0x20')]],'as':_0x529007['as'],'attributes':_0x529007[_0xc1c3('0x1d')],'include':_0x529007[_0xc1c3('0x1e')]?_[_0xc1c3('0x1f')](_0x529007[_0xc1c3('0x1e')],function(_0x3d8310){return{'model':db[_0x3d8310[_0xc1c3('0x20')]],'as':_0x3d8310['as'],'attributes':_0x3d8310['attributes']};}):[]};}):[]};}):[]:[]})[_0xc1c3('0xf')](function(_0x8ebda9){logger[_0xc1c3('0x16')](_0xc1c3('0x18'),_0x4030aa);logger[_0xc1c3('0x21')]('GetFaxQueue',_0x4030aa,JSON['stringify'](_0x8ebda9));_0x22adf6(_0x8ebda9);})[_0xc1c3('0x22')](function(_0xbbe3f3){logger[_0xc1c3('0x14')]('GetFaxQueue',_0xbbe3f3[_0xc1c3('0x15')],_0x4030aa);_0x25c72f(_0x502d76[_0xc1c3('0x14')](0x1f4,_0xbbe3f3[_0xc1c3('0x15')]));});});};exports[_0xc1c3('0x23')]=function(_0x2a8aa0){var _0x26c557=this;return new Promise(function(_0x19fe5a,_0x37bb96){return db[_0xc1c3('0x19')]['find']({'raw':_0x2a8aa0[_0xc1c3('0x1a')]?_0x2a8aa0[_0xc1c3('0x1a')][_0xc1c3('0x1b')]===undefined?!![]:![]:!![],'where':_0x2a8aa0[_0xc1c3('0x1a')]?_0x2a8aa0[_0xc1c3('0x1a')][_0xc1c3('0x1c')]||null:null,'attributes':_0x2a8aa0[_0xc1c3('0x1a')]?_0x2a8aa0[_0xc1c3('0x1a')]['attributes']||null:null,'include':_0x2a8aa0[_0xc1c3('0x1a')]?_0x2a8aa0[_0xc1c3('0x1a')][_0xc1c3('0x1e')]?_[_0xc1c3('0x1f')](_0x2a8aa0[_0xc1c3('0x1a')]['include'],function(_0x1ac142){return{'model':db[_0x1ac142[_0xc1c3('0x20')]],'as':_0x1ac142['as'],'attributes':_0x1ac142[_0xc1c3('0x1d')],'include':_0x1ac142[_0xc1c3('0x1e')]?_[_0xc1c3('0x1f')](_0x1ac142['include'],function(_0x31b9fa){return{'model':db[_0x31b9fa[_0xc1c3('0x20')]],'as':_0x31b9fa['as'],'attributes':_0x31b9fa['attributes'],'include':_0x31b9fa['include']?_['map'](_0x31b9fa[_0xc1c3('0x1e')],function(_0xcf850){return{'model':db[_0xcf850[_0xc1c3('0x20')]],'as':_0xcf850['as'],'attributes':_0xcf850['attributes']};}):[]};}):[]};}):[]:[]})[_0xc1c3('0xf')](function(_0x187acc){logger[_0xc1c3('0x16')](_0xc1c3('0x23'),_0x2a8aa0);logger[_0xc1c3('0x21')]('ShowFaxQueue',_0x2a8aa0,JSON[_0xc1c3('0x13')](_0x187acc));_0x19fe5a(_0x187acc);})['catch'](function(_0x3f0ae2){logger[_0xc1c3('0x14')](_0xc1c3('0x23'),_0x3f0ae2[_0xc1c3('0x15')],_0x2a8aa0);_0x37bb96(_0x26c557[_0xc1c3('0x14')](0x1f4,_0x3f0ae2[_0xc1c3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index cf811b4..b8f1e11 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 _0xdc0d=['faxQueue:','./faxQueue.events','save','emit','removeListener','length'];(function(_0xa132b,_0x62769f){var _0x4c35d2=function(_0x3a8e87){while(--_0x3a8e87){_0xa132b['push'](_0xa132b['shift']());}};_0x4c35d2(++_0x62769f);}(_0xdc0d,0xc1));var _0xddc0=function(_0x3c82fb,_0x1b3e2b){_0x3c82fb=_0x3c82fb-0x0;var _0x174ed7=_0xdc0d[_0x3c82fb];return _0x174ed7;};'use strict';var FaxQueueEvents=require(_0xddc0('0x0'));var events=[_0xddc0('0x1'),'remove','update'];function createListener(_0x343a65,_0x2c124b){return function(_0x5a9437){_0x2c124b[_0xddc0('0x2')](_0x343a65,_0x5a9437);};}function removeListener(_0x380ad6,_0x434116){return function(){FaxQueueEvents[_0xddc0('0x3')](_0x380ad6,_0x434116);};}exports['register']=function(_0x9ee883){for(var _0x43ef0b=0x0,_0x121448=events[_0xddc0('0x4')];_0x43ef0b<_0x121448;_0x43ef0b++){var _0x597a04=events[_0x43ef0b];var _0x3d7a87=createListener(_0xddc0('0x5')+_0x597a04,_0x9ee883);FaxQueueEvents['on'](_0x597a04,_0x3d7a87);}}; \ No newline at end of file +var _0x9fa3=['remove','removeListener','register','save'];(function(_0x456aa6,_0x3e5961){var _0x40589b=function(_0x4e88c8){while(--_0x4e88c8){_0x456aa6['push'](_0x456aa6['shift']());}};_0x40589b(++_0x3e5961);}(_0x9fa3,0x67));var _0x39fa=function(_0x1fc9bd,_0x332272){_0x1fc9bd=_0x1fc9bd-0x0;var _0x40a3e5=_0x9fa3[_0x1fc9bd];return _0x40a3e5;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x39fa('0x0'),_0x39fa('0x1'),'update'];function createListener(_0x65362f,_0x24f498){return function(_0x204282){_0x24f498['emit'](_0x65362f,_0x204282);};}function removeListener(_0x4de787,_0x2b95a9){return function(){FaxQueueEvents[_0x39fa('0x2')](_0x4de787,_0x2b95a9);};}exports[_0x39fa('0x3')]=function(_0xce8de8){for(var _0x153ac4=0x0,_0x751422=events['length'];_0x153ac4<_0x751422;_0x153ac4++){var _0x18bc07=events[_0x153ac4];var _0x3f7c45=createListener('faxQueue:'+_0x18bc07,_0xce8de8);FaxQueueEvents['on'](_0x18bc07,_0x3f7c45);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index bd88d9a..7aba4db 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 _0x444e=['addAgents','put','update','delete','destroy','/:id/users','removeAgents','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getAgents','post'];(function(_0x51daf9,_0x3e84a6){var _0x3fbcb2=function(_0x5096ce){while(--_0x5096ce){_0x51daf9['push'](_0x51daf9['shift']());}};_0x3fbcb2(++_0x3e84a6);}(_0x444e,0xe8));var _0xe444=function(_0x7043f5,_0x3c6d8f){_0x7043f5=_0x7043f5-0x0;var _0x30129b=_0x444e[_0x7043f5];return _0x30129b;};'use strict';var multer=require(_0xe444('0x0'));var util=require('util');var path=require(_0xe444('0x1'));var timeout=require('connect-timeout');var express=require(_0xe444('0x2'));var router=express['Router']();var fs_extra=require(_0xe444('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe444('0x4'));var config=require(_0xe444('0x5'));var controller=require(_0xe444('0x6'));router[_0xe444('0x7')]('/',auth[_0xe444('0x8')](),controller[_0xe444('0x9')]);router['get'](_0xe444('0xa'),auth['isAuthenticated'](),controller[_0xe444('0xb')]);router['get'](_0xe444('0xc'),auth[_0xe444('0x8')](),controller[_0xe444('0xd')]);router['get']('/:id/members',auth[_0xe444('0x8')](),controller[_0xe444('0xe')]);router['get'](_0xe444('0xf'),auth['isAuthenticated'](),controller['getTeams']);router[_0xe444('0x7')]('/:id/users',auth[_0xe444('0x8')](),controller[_0xe444('0x10')]);router['post']('/',auth[_0xe444('0x8')](),controller['create']);router['post'](_0xe444('0xf'),auth[_0xe444('0x8')](),controller['addTeams']);router[_0xe444('0x11')]('/:id/users',auth[_0xe444('0x8')](),controller[_0xe444('0x12')]);router[_0xe444('0x13')](_0xe444('0xc'),auth[_0xe444('0x8')](),controller[_0xe444('0x14')]);router[_0xe444('0x15')](_0xe444('0xc'),auth[_0xe444('0x8')](),controller[_0xe444('0x16')]);router[_0xe444('0x15')](_0xe444('0xf'),auth[_0xe444('0x8')](),controller['removeTeams']);router[_0xe444('0x15')](_0xe444('0x17'),auth[_0xe444('0x8')](),controller[_0xe444('0x18')]);module['exports']=router; \ No newline at end of file +var _0x6a55=['index','/describe','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','express','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x417a35,_0x345a21){var _0x14fbf5=function(_0x4471ca){while(--_0x4471ca){_0x417a35['push'](_0x417a35['shift']());}};_0x14fbf5(++_0x345a21);}(_0x6a55,0xdb));var _0x56a5=function(_0x546aaf,_0x1ed138){_0x546aaf=_0x546aaf-0x0;var _0x1cbf6d=_0x6a55[_0x546aaf];return _0x1cbf6d;};'use strict';var multer=require(_0x56a5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x56a5('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x56a5('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x56a5('0x3'));var controller=require('./faxQueue.controller');router[_0x56a5('0x4')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0x6')]);router[_0x56a5('0x4')](_0x56a5('0x7'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x8')]);router[_0x56a5('0x4')]('/:id',auth[_0x56a5('0x5')](),controller[_0x56a5('0x9')]);router[_0x56a5('0x4')](_0x56a5('0xa'),auth[_0x56a5('0x5')](),controller[_0x56a5('0xb')]);router[_0x56a5('0x4')](_0x56a5('0xc'),auth[_0x56a5('0x5')](),controller['getTeams']);router['get'](_0x56a5('0xd'),auth[_0x56a5('0x5')](),controller[_0x56a5('0xe')]);router[_0x56a5('0xf')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0x10')]);router['post']('/:id/teams',auth[_0x56a5('0x5')](),controller[_0x56a5('0x11')]);router[_0x56a5('0xf')](_0x56a5('0xd'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x12')]);router[_0x56a5('0x13')]('/:id',auth[_0x56a5('0x5')](),controller['update']);router[_0x56a5('0x14')]('/:id',auth[_0x56a5('0x5')](),controller[_0x56a5('0x15')]);router[_0x56a5('0x14')](_0x56a5('0xc'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x16')]);router[_0x56a5('0x14')]('/:id/users',auth[_0x56a5('0x5')](),controller[_0x56a5('0x17')]);module[_0x56a5('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index c45ff6b..0d5fdf1 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 _0x93a6=['STRING','DATE','moment','sequelize','exports'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x93a6,0x1ab));var _0x693a=function(_0x1f109c,_0xd9952e){_0x1f109c=_0x1f109c-0x0;var _0x3984e8=_0x93a6[_0x1f109c];return _0x3984e8;};'use strict';var moment=require(_0x693a('0x0'));var Sequelize=require(_0x693a('0x1'));module[_0x693a('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x693a('0x3')]},'joinAt':{'type':Sequelize[_0x693a('0x4')]},'leaveAt':{'type':Sequelize[_0x693a('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1d1e=['sequelize','exports','STRING','DATE','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1d1e,0x9a));var _0xe1d1=function(_0x40022a,_0x490e53){_0x40022a=_0x40022a-0x0;var _0x1c8f3a=_0x1d1e[_0x40022a];return _0x1c8f3a;};'use strict';var moment=require(_0xe1d1('0x0'));var Sequelize=require(_0xe1d1('0x1'));module[_0xe1d1('0x2')]={'uniqueid':{'type':Sequelize[_0xe1d1('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe1d1('0x3')]},'joinAt':{'type':Sequelize[_0xe1d1('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xe1d1('0x4')]},'exitAt':{'type':Sequelize[_0xe1d1('0x4')]},'reason':{'type':Sequelize[_0xe1d1('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index ff4591f..9ac1dba 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 _0xffdc=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','map','type','options','includeAll','include','FaxQueueReport','findAll','catch','params','keys','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x204789,_0x2e6e57){var _0x2dded7=function(_0x2aa3af){while(--_0x2aa3af){_0x204789['push'](_0x204789['shift']());}};_0x2dded7(++_0x2e6e57);}(_0xffdc,0x7f));var _0xcffd=function(_0x5ac5d6,_0x51eb3e){_0x5ac5d6=_0x5ac5d6-0x0;var _0x2c8e34=_0xffdc[_0x5ac5d6];return _0x2c8e34;};'use strict';var emlformat=require(_0xcffd('0x0'));var rimraf=require(_0xcffd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcffd('0x2'));var rp=require(_0xcffd('0x3'));var moment=require('moment');var BPromise=require(_0xcffd('0x4'));var Mustache=require(_0xcffd('0x5'));var util=require(_0xcffd('0x6'));var path=require(_0xcffd('0x7'));var sox=require(_0xcffd('0x8'));var csv=require('to-csv');var ejs=require(_0xcffd('0x9'));var fs=require('fs');var fs_extra=require(_0xcffd('0xa'));var _=require(_0xcffd('0xb'));var squel=require(_0xcffd('0xc'));var crypto=require(_0xcffd('0xd'));var jsforce=require(_0xcffd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcffd('0xf'));var querystring=require(_0xcffd('0x10'));var Papa=require('papaparse');var Redis=require(_0xcffd('0x11'));var authService=require(_0xcffd('0x12'));var qs=require(_0xcffd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcffd('0x14'));var logger=require(_0xcffd('0x15'))(_0xcffd('0x16'));var utils=require(_0xcffd('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcffd('0x18'))['db'];function respondWithStatusCode(_0x187ca8,_0x1340b0){_0x1340b0=_0x1340b0||0xcc;return function(_0x4ec693){if(_0x4ec693){return _0x187ca8[_0xcffd('0x19')](_0x1340b0);}return _0x187ca8['status'](_0x1340b0)['end']();};}function respondWithResult(_0x765795,_0x20e134){_0x20e134=_0x20e134||0xc8;return function(_0x4edde4){if(_0x4edde4){return _0x765795[_0xcffd('0x1a')](_0x20e134)[_0xcffd('0x1b')](_0x4edde4);}};}function respondWithFilteredResult(_0x3d1e6e,_0x32f579){return function(_0x4ec386){if(_0x4ec386){var _0x4921d1=typeof _0x32f579[_0xcffd('0x1c')]===_0xcffd('0x1d')&&typeof _0x32f579[_0xcffd('0x1e')]===_0xcffd('0x1d');var _0x867e85=_0x4ec386['count'];var _0x4216c4=_0x4921d1?0x0:_0x32f579['offset'];var _0x18e9e1=_0x4921d1?_0x4ec386[_0xcffd('0x1f')]:_0x32f579[_0xcffd('0x1c')]+_0x32f579[_0xcffd('0x1e')];var _0x33a27e;if(_0x18e9e1>=_0x867e85){_0x18e9e1=_0x867e85;_0x33a27e=0xc8;}else{_0x33a27e=0xce;}_0x3d1e6e[_0xcffd('0x1a')](_0x33a27e);return _0x3d1e6e[_0xcffd('0x20')](_0xcffd('0x21'),_0x4216c4+'-'+_0x18e9e1+'/'+_0x867e85)['json'](_0x4ec386);}return null;};}function patchUpdates(_0x73d51a){return function(_0x1f36f4){try{jsonpatch[_0xcffd('0x22')](_0x1f36f4,_0x73d51a,!![]);}catch(_0x4029a7){return BPromise[_0xcffd('0x23')](_0x4029a7);}return _0x1f36f4[_0xcffd('0x24')]();};}function saveUpdates(_0x1ad69f,_0x5d2d3c){return function(_0x52fc51){if(_0x52fc51){return _0x52fc51[_0xcffd('0x25')](_0x1ad69f)[_0xcffd('0x26')](function(_0x44f901){return _0x44f901;});}return null;};}function removeEntity(_0x3935ff,_0x3c3839){return function(_0x345a4d){if(_0x345a4d){return _0x345a4d[_0xcffd('0x27')]()[_0xcffd('0x26')](function(){_0x3935ff[_0xcffd('0x1a')](0xcc)[_0xcffd('0x28')]();});}};}function handleEntityNotFound(_0x37185d,_0x1f232a){return function(_0x544ae7){if(!_0x544ae7){_0x37185d[_0xcffd('0x19')](0x194);}return _0x544ae7;};}function handleError(_0x2b5044,_0x2c66a7){_0x2c66a7=_0x2c66a7||0x1f4;return function(_0x547bdb){logger[_0xcffd('0x29')](_0x547bdb[_0xcffd('0x2a')]);if(_0x547bdb[_0xcffd('0x2b')]){delete _0x547bdb['name'];}_0x2b5044['status'](_0x2c66a7)[_0xcffd('0x2c')](_0x547bdb);};}exports[_0xcffd('0x2d')]=function(_0x4b1c7d,_0x3cb0dd){var _0x6641e={},_0x5a97cf={},_0x3f46ea={'count':0x0,'rows':[]};var _0x3ab051=_['map'](db['FaxQueueReport'][_0xcffd('0x2e')],function(_0x1c40fb){return{'name':_0x1c40fb[_0xcffd('0x2f')],'type':_0x1c40fb['type'][_0xcffd('0x30')]};});_0x5a97cf[_0xcffd('0x31')]=_['map'](_0x3ab051,_0xcffd('0x2b'));_0x5a97cf[_0xcffd('0x32')]=_['keys'](_0x4b1c7d[_0xcffd('0x32')]);_0x5a97cf['filters']=_[_0xcffd('0x33')](_0x5a97cf[_0xcffd('0x31')],_0x5a97cf['query']);_0x6641e[_0xcffd('0x34')]=_['intersection'](_0x5a97cf['model'],qs[_0xcffd('0x35')](_0x4b1c7d[_0xcffd('0x32')][_0xcffd('0x35')]));_0x6641e['attributes']=_0x6641e['attributes'][_0xcffd('0x36')]?_0x6641e[_0xcffd('0x34')]:_0x5a97cf['model'];if(!_0x4b1c7d['query'][_0xcffd('0x37')]('nolimit')){_0x6641e[_0xcffd('0x1e')]=qs[_0xcffd('0x1e')](_0x4b1c7d[_0xcffd('0x32')][_0xcffd('0x1e')]);_0x6641e[_0xcffd('0x1c')]=qs[_0xcffd('0x1c')](_0x4b1c7d['query'][_0xcffd('0x1c')]);}_0x6641e[_0xcffd('0x38')]=qs[_0xcffd('0x39')](_0x4b1c7d[_0xcffd('0x32')][_0xcffd('0x39')]);_0x6641e[_0xcffd('0x3a')]=qs['filters'](_[_0xcffd('0x3b')](_0x4b1c7d['query'],_0x5a97cf[_0xcffd('0x3c')]),_0x3ab051);if(_0x4b1c7d['query'][_0xcffd('0x3d')]){_0x6641e[_0xcffd('0x3a')]=_[_0xcffd('0x3e')](_0x6641e[_0xcffd('0x3a')],{'$or':_[_0xcffd('0x3f')](_0x3ab051,function(_0x345bcb){if(_0x345bcb[_0xcffd('0x40')]!=='VIRTUAL'){var _0x1d4960={};_0x1d4960[_0x345bcb[_0xcffd('0x2b')]]={'$like':'%'+_0x4b1c7d[_0xcffd('0x32')]['filter']+'%'};return _0x1d4960;}})});}_0x6641e=_[_0xcffd('0x3e')]({},_0x6641e,_0x4b1c7d[_0xcffd('0x41')]);var _0x464d82={'where':_0x6641e['where']};return db['FaxQueueReport']['count'](_0x464d82)[_0xcffd('0x26')](function(_0x214d4f){_0x3f46ea[_0xcffd('0x1f')]=_0x214d4f;if(_0x4b1c7d['query'][_0xcffd('0x42')]){_0x6641e[_0xcffd('0x43')]=[{'all':!![]}];}return db[_0xcffd('0x44')][_0xcffd('0x45')](_0x6641e);})[_0xcffd('0x26')](function(_0x10c868){_0x3f46ea['rows']=_0x10c868;return _0x3f46ea;})[_0xcffd('0x26')](respondWithFilteredResult(_0x3cb0dd,_0x6641e))[_0xcffd('0x46')](handleError(_0x3cb0dd,null));};exports['show']=function(_0x454735,_0x587a53){var _0x5cb0a9={'raw':!![],'where':{'id':_0x454735[_0xcffd('0x47')]['id']}},_0x23e8fc={};_0x23e8fc[_0xcffd('0x31')]=_[_0xcffd('0x48')](db[_0xcffd('0x44')][_0xcffd('0x2e')]);_0x23e8fc[_0xcffd('0x32')]=_[_0xcffd('0x48')](_0x454735[_0xcffd('0x32')]);_0x23e8fc[_0xcffd('0x3c')]=_['intersection'](_0x23e8fc[_0xcffd('0x31')],_0x23e8fc[_0xcffd('0x32')]);_0x5cb0a9['attributes']=_['intersection'](_0x23e8fc[_0xcffd('0x31')],qs[_0xcffd('0x35')](_0x454735[_0xcffd('0x32')][_0xcffd('0x35')]));_0x5cb0a9[_0xcffd('0x34')]=_0x5cb0a9['attributes']['length']?_0x5cb0a9['attributes']:_0x23e8fc[_0xcffd('0x31')];if(_0x454735[_0xcffd('0x32')][_0xcffd('0x42')]){_0x5cb0a9[_0xcffd('0x43')]=[{'all':!![]}];}_0x5cb0a9=_[_0xcffd('0x3e')]({},_0x5cb0a9,_0x454735[_0xcffd('0x41')]);return db[_0xcffd('0x44')][_0xcffd('0x49')](_0x5cb0a9)[_0xcffd('0x26')](handleEntityNotFound(_0x587a53,null))[_0xcffd('0x26')](respondWithResult(_0x587a53,null))[_0xcffd('0x46')](handleError(_0x587a53,null));};exports[_0xcffd('0x4a')]=function(_0x207d2a,_0x3f23c1){return db['FaxQueueReport'][_0xcffd('0x4a')](_0x207d2a['body'],{})['then'](respondWithResult(_0x3f23c1,0xc9))[_0xcffd('0x46')](handleError(_0x3f23c1,null));};exports['update']=function(_0x6e3701,_0x42b396){if(_0x6e3701['body']['id']){delete _0x6e3701[_0xcffd('0x4b')]['id'];}return db[_0xcffd('0x44')][_0xcffd('0x49')]({'where':{'id':_0x6e3701[_0xcffd('0x47')]['id']}})[_0xcffd('0x26')](handleEntityNotFound(_0x42b396,null))['then'](saveUpdates(_0x6e3701[_0xcffd('0x4b')],null))[_0xcffd('0x26')](respondWithResult(_0x42b396,null))[_0xcffd('0x46')](handleError(_0x42b396,null));};exports[_0xcffd('0x27')]=function(_0x16f8fe,_0x2cc53f){return db[_0xcffd('0x44')]['find']({'where':{'id':_0x16f8fe['params']['id']}})['then'](handleEntityNotFound(_0x2cc53f,null))['then'](removeEntity(_0x2cc53f,null))['catch'](handleError(_0x2cc53f,null));};exports[_0xcffd('0x4c')]=function(_0x5076ca,_0x53b879){return db[_0xcffd('0x44')][_0xcffd('0x4c')]()[_0xcffd('0x26')](respondWithResult(_0x53b879,null))[_0xcffd('0x46')](handleError(_0x53b879,null));}; \ No newline at end of file +var _0xbbfa=['sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','update','then','destroy','end','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path'];(function(_0x2ae8ce,_0x2a5a1f){var _0x4bf686=function(_0x41cabf){while(--_0x41cabf){_0x2ae8ce['push'](_0x2ae8ce['shift']());}};_0x4bf686(++_0x2a5a1f);}(_0xbbfa,0x1e9));var _0xabbf=function(_0x3f889c,_0x1c16af){_0x3f889c=_0x3f889c-0x0;var _0x5edf2a=_0xbbfa[_0x3f889c];return _0x5edf2a;};'use strict';var emlformat=require(_0xabbf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xabbf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xabbf('0x2'));var moment=require(_0xabbf('0x3'));var BPromise=require(_0xabbf('0x4'));var Mustache=require(_0xabbf('0x5'));var util=require(_0xabbf('0x6'));var path=require(_0xabbf('0x7'));var sox=require(_0xabbf('0x8'));var csv=require(_0xabbf('0x9'));var ejs=require(_0xabbf('0xa'));var fs=require('fs');var fs_extra=require(_0xabbf('0xb'));var _=require(_0xabbf('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xabbf('0xd'));var toCsv=require(_0xabbf('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xabbf('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xabbf('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xabbf('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xabbf('0x11'));var config=require(_0xabbf('0x12'));var licenseUtil=require(_0xabbf('0x13'));var db=require(_0xabbf('0x14'))['db'];function respondWithStatusCode(_0x265487,_0x1cc1a0){_0x1cc1a0=_0x1cc1a0||0xcc;return function(_0x28fb83){if(_0x28fb83){return _0x265487[_0xabbf('0x15')](_0x1cc1a0);}return _0x265487[_0xabbf('0x16')](_0x1cc1a0)['end']();};}function respondWithResult(_0x3c85e8,_0x5e6866){_0x5e6866=_0x5e6866||0xc8;return function(_0x3c6e6d){if(_0x3c6e6d){return _0x3c85e8['status'](_0x5e6866)[_0xabbf('0x17')](_0x3c6e6d);}};}function respondWithFilteredResult(_0x23a44a,_0x1df763){return function(_0x13b970){if(_0x13b970){var _0x529af0=typeof _0x1df763[_0xabbf('0x18')]===_0xabbf('0x19')&&typeof _0x1df763[_0xabbf('0x1a')]===_0xabbf('0x19');var _0xbfddcf=_0x13b970['count'];var _0x4252e1=_0x529af0?0x0:_0x1df763[_0xabbf('0x18')];var _0x57002d=_0x529af0?_0x13b970[_0xabbf('0x1b')]:_0x1df763[_0xabbf('0x18')]+_0x1df763['limit'];var _0x1269d9;if(_0x57002d>=_0xbfddcf){_0x57002d=_0xbfddcf;_0x1269d9=0xc8;}else{_0x1269d9=0xce;}_0x23a44a[_0xabbf('0x16')](_0x1269d9);return _0x23a44a[_0xabbf('0x1c')]('Content-Range',_0x4252e1+'-'+_0x57002d+'/'+_0xbfddcf)['json'](_0x13b970);}return null;};}function patchUpdates(_0xdf7640){return function(_0x4d4efb){try{jsonpatch[_0xabbf('0x1d')](_0x4d4efb,_0xdf7640,!![]);}catch(_0x918fc8){return BPromise['reject'](_0x918fc8);}return _0x4d4efb['save']();};}function saveUpdates(_0x44248b,_0x45cf44){return function(_0x2eaa02){if(_0x2eaa02){return _0x2eaa02[_0xabbf('0x1e')](_0x44248b)[_0xabbf('0x1f')](function(_0x35313f){return _0x35313f;});}return null;};}function removeEntity(_0x17d684,_0x573d83){return function(_0x281b36){if(_0x281b36){return _0x281b36[_0xabbf('0x20')]()[_0xabbf('0x1f')](function(){_0x17d684['status'](0xcc)[_0xabbf('0x21')]();});}};}function handleEntityNotFound(_0x26ebc6,_0x26bd52){return function(_0x28a5a1){if(!_0x28a5a1){_0x26ebc6[_0xabbf('0x15')](0x194);}return _0x28a5a1;};}function handleError(_0x5861fb,_0x3a0eca){_0x3a0eca=_0x3a0eca||0x1f4;return function(_0x4ef7cf){logger['error'](_0x4ef7cf[_0xabbf('0x22')]);if(_0x4ef7cf[_0xabbf('0x23')]){delete _0x4ef7cf['name'];}_0x5861fb[_0xabbf('0x16')](_0x3a0eca)[_0xabbf('0x24')](_0x4ef7cf);};}exports['index']=function(_0x4f8ed7,_0x53e49a){var _0x58c8bc={},_0xf50e5f={},_0x1c8439={'count':0x0,'rows':[]};var _0x242132=_[_0xabbf('0x25')](db[_0xabbf('0x26')][_0xabbf('0x27')],function(_0x1ed1fd){return{'name':_0x1ed1fd[_0xabbf('0x28')],'type':_0x1ed1fd[_0xabbf('0x29')][_0xabbf('0x2a')]};});_0xf50e5f['model']=_[_0xabbf('0x25')](_0x242132,'name');_0xf50e5f[_0xabbf('0x2b')]=_[_0xabbf('0x2c')](_0x4f8ed7['query']);_0xf50e5f[_0xabbf('0x2d')]=_[_0xabbf('0x2e')](_0xf50e5f[_0xabbf('0x2f')],_0xf50e5f[_0xabbf('0x2b')]);_0x58c8bc[_0xabbf('0x30')]=_[_0xabbf('0x2e')](_0xf50e5f[_0xabbf('0x2f')],qs['fields'](_0x4f8ed7['query'][_0xabbf('0x31')]));_0x58c8bc['attributes']=_0x58c8bc[_0xabbf('0x30')][_0xabbf('0x32')]?_0x58c8bc[_0xabbf('0x30')]:_0xf50e5f[_0xabbf('0x2f')];if(!_0x4f8ed7[_0xabbf('0x2b')][_0xabbf('0x33')](_0xabbf('0x34'))){_0x58c8bc['limit']=qs[_0xabbf('0x1a')](_0x4f8ed7[_0xabbf('0x2b')][_0xabbf('0x1a')]);_0x58c8bc['offset']=qs[_0xabbf('0x18')](_0x4f8ed7[_0xabbf('0x2b')][_0xabbf('0x18')]);}_0x58c8bc[_0xabbf('0x35')]=qs[_0xabbf('0x36')](_0x4f8ed7[_0xabbf('0x2b')][_0xabbf('0x36')]);_0x58c8bc[_0xabbf('0x37')]=qs[_0xabbf('0x2d')](_['pick'](_0x4f8ed7[_0xabbf('0x2b')],_0xf50e5f[_0xabbf('0x2d')]),_0x242132);if(_0x4f8ed7[_0xabbf('0x2b')][_0xabbf('0x38')]){_0x58c8bc[_0xabbf('0x37')]=_['merge'](_0x58c8bc[_0xabbf('0x37')],{'$or':_[_0xabbf('0x25')](_0x242132,function(_0x3d7a03){if(_0x3d7a03[_0xabbf('0x29')]!==_0xabbf('0x39')){var _0x580ca9={};_0x580ca9[_0x3d7a03['name']]={'$like':'%'+_0x4f8ed7[_0xabbf('0x2b')]['filter']+'%'};return _0x580ca9;}})});}_0x58c8bc=_[_0xabbf('0x3a')]({},_0x58c8bc,_0x4f8ed7[_0xabbf('0x3b')]);var _0x4af14f={'where':_0x58c8bc[_0xabbf('0x37')]};return db[_0xabbf('0x26')][_0xabbf('0x1b')](_0x4af14f)['then'](function(_0x9d37c4){_0x1c8439['count']=_0x9d37c4;if(_0x4f8ed7[_0xabbf('0x2b')][_0xabbf('0x3c')]){_0x58c8bc['include']=[{'all':!![]}];}return db[_0xabbf('0x26')][_0xabbf('0x3d')](_0x58c8bc);})[_0xabbf('0x1f')](function(_0x22cb8d){_0x1c8439[_0xabbf('0x3e')]=_0x22cb8d;return _0x1c8439;})[_0xabbf('0x1f')](respondWithFilteredResult(_0x53e49a,_0x58c8bc))[_0xabbf('0x3f')](handleError(_0x53e49a,null));};exports[_0xabbf('0x40')]=function(_0x113e7c,_0x47b425){var _0x477f1c={'raw':!![],'where':{'id':_0x113e7c['params']['id']}},_0x547672={};_0x547672[_0xabbf('0x2f')]=_[_0xabbf('0x2c')](db[_0xabbf('0x26')][_0xabbf('0x27')]);_0x547672[_0xabbf('0x2b')]=_[_0xabbf('0x2c')](_0x113e7c[_0xabbf('0x2b')]);_0x547672[_0xabbf('0x2d')]=_[_0xabbf('0x2e')](_0x547672[_0xabbf('0x2f')],_0x547672[_0xabbf('0x2b')]);_0x477f1c[_0xabbf('0x30')]=_[_0xabbf('0x2e')](_0x547672['model'],qs[_0xabbf('0x31')](_0x113e7c[_0xabbf('0x2b')]['fields']));_0x477f1c[_0xabbf('0x30')]=_0x477f1c[_0xabbf('0x30')][_0xabbf('0x32')]?_0x477f1c[_0xabbf('0x30')]:_0x547672[_0xabbf('0x2f')];if(_0x113e7c[_0xabbf('0x2b')][_0xabbf('0x3c')]){_0x477f1c[_0xabbf('0x41')]=[{'all':!![]}];}_0x477f1c=_[_0xabbf('0x3a')]({},_0x477f1c,_0x113e7c[_0xabbf('0x3b')]);return db[_0xabbf('0x26')][_0xabbf('0x42')](_0x477f1c)[_0xabbf('0x1f')](handleEntityNotFound(_0x47b425,null))[_0xabbf('0x1f')](respondWithResult(_0x47b425,null))[_0xabbf('0x3f')](handleError(_0x47b425,null));};exports[_0xabbf('0x43')]=function(_0x44910b,_0x2cecb6){return db[_0xabbf('0x26')][_0xabbf('0x43')](_0x44910b['body'],{})[_0xabbf('0x1f')](respondWithResult(_0x2cecb6,0xc9))[_0xabbf('0x3f')](handleError(_0x2cecb6,null));};exports[_0xabbf('0x1e')]=function(_0x370f66,_0x60d9d6){if(_0x370f66['body']['id']){delete _0x370f66[_0xabbf('0x44')]['id'];}return db[_0xabbf('0x26')]['find']({'where':{'id':_0x370f66[_0xabbf('0x45')]['id']}})[_0xabbf('0x1f')](handleEntityNotFound(_0x60d9d6,null))[_0xabbf('0x1f')](saveUpdates(_0x370f66[_0xabbf('0x44')],null))[_0xabbf('0x1f')](respondWithResult(_0x60d9d6,null))[_0xabbf('0x3f')](handleError(_0x60d9d6,null));};exports[_0xabbf('0x20')]=function(_0x4fa51f,_0x1588af){return db[_0xabbf('0x26')]['find']({'where':{'id':_0x4fa51f[_0xabbf('0x45')]['id']}})[_0xabbf('0x1f')](handleEntityNotFound(_0x1588af,null))[_0xabbf('0x1f')](removeEntity(_0x1588af,null))[_0xabbf('0x3f')](handleError(_0x1588af,null));};exports[_0xabbf('0x46')]=function(_0x407a31,_0x1be10a){return db[_0xabbf('0x26')][_0xabbf('0x46')]()[_0xabbf('0x1f')](respondWithResult(_0x1be10a,null))['catch'](handleError(_0x1be10a,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index e617d40..646b720 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fab=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','api'];(function(_0x20ff2e,_0x13708a){var _0x2fca70=function(_0x11df8d){while(--_0x11df8d){_0x20ff2e['push'](_0x20ff2e['shift']());}};_0x2fca70(++_0x13708a);}(_0x5fab,0x177));var _0xb5fa=function(_0x4c3296,_0x262566){_0x4c3296=_0x4c3296-0x0;var _0x5260de=_0x5fab[_0x4c3296];return _0x5260de;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0xc3c4d4,_0x14d514){var _0x50cafd=function(_0x486a9d){while(--_0x486a9d){_0xc3c4d4['push'](_0xc3c4d4['shift']());}};_0x50cafd(++_0x14d514);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2d13b1,_0x2678d5){_0x2d13b1=_0x2d13b1-0x0;var _0x18c844=_0x7fbe[_0x2d13b1];return _0x18c844;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index ac848bc..8c70f93 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 _0xe89c=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','update','where','attributes','limit','UpdateFaxQueueReport','lodash'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe89c,0x11f));var _0xce89=function(_0x76ccdb,_0x17d9f3){_0x76ccdb=_0x76ccdb-0x0;var _0x39ce12=_0xe89c[_0x76ccdb];return _0x39ce12;};'use strict';var _=require(_0xce89('0x0'));var util=require(_0xce89('0x1'));var moment=require(_0xce89('0x2'));var BPromise=require(_0xce89('0x3'));var rs=require(_0xce89('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xce89('0x5'));var logger=require(_0xce89('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xce89('0x7'));var client=jayson[_0xce89('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x490756,_0x16856c,_0x2a5b16){return new BPromise(function(_0x566346,_0x77e42){return client['request'](_0x490756,_0x2a5b16)[_0xce89('0x9')](function(_0x30abbf){logger[_0xce89('0xa')](_0xce89('0xb'),_0x16856c,_0xce89('0xc'));logger[_0xce89('0xd')](_0xce89('0xe'),_0x16856c,'request\x20sent',JSON[_0xce89('0xf')](_0x30abbf));if(_0x30abbf[_0xce89('0x10')]){if(_0x30abbf[_0xce89('0x10')][_0xce89('0x11')]===0x1f4){logger[_0xce89('0x10')](_0xce89('0xb'),_0x16856c,_0x30abbf[_0xce89('0x10')]['message']);return _0x77e42(_0x30abbf['error'][_0xce89('0x12')]);}logger['error'](_0xce89('0xb'),_0x16856c,_0x30abbf[_0xce89('0x10')]['message']);return _0x566346(_0x30abbf[_0xce89('0x10')][_0xce89('0x12')]);}else{logger[_0xce89('0xa')](_0xce89('0xb'),_0x16856c,_0xce89('0xc'));_0x566346(_0x30abbf[_0xce89('0x13')][_0xce89('0x12')]);}})[_0xce89('0x14')](function(_0x7748a1){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x16856c,_0x7748a1);_0x77e42(_0x7748a1);});});}exports[_0xce89('0x15')]=function(_0x2e9a87){var _0x49e306=this;return new Promise(function(_0x1f19ea,_0x2b7ee0){return db[_0xce89('0x16')][_0xce89('0x17')](_0x2e9a87[_0xce89('0x18')],{'raw':_0x2e9a87['options']?_0x2e9a87[_0xce89('0x19')][_0xce89('0x1a')]===undefined?!![]:![]:!![]})[_0xce89('0x9')](function(_0x58affa){logger['info'](_0xce89('0x15'),_0x2e9a87);logger[_0xce89('0xd')](_0xce89('0x15'),_0x2e9a87,JSON[_0xce89('0xf')](_0x58affa));_0x1f19ea(_0x58affa);})[_0xce89('0x14')](function(_0x3ea52c){logger[_0xce89('0x10')](_0xce89('0x15'),_0x3ea52c['message'],_0x2e9a87);_0x2b7ee0(_0x49e306[_0xce89('0x10')](0x1f4,_0x3ea52c[_0xce89('0x12')]));});});};exports['UpdateFaxQueueReport']=function(_0x27cc4d){var _0x344107=this;return new Promise(function(_0xd1af1c,_0x572e81){return db[_0xce89('0x16')][_0xce89('0x1b')](_0x27cc4d['body'],{'raw':_0x27cc4d[_0xce89('0x19')]?_0x27cc4d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27cc4d[_0xce89('0x19')]?_0x27cc4d[_0xce89('0x19')][_0xce89('0x1c')]||null:null,'attributes':_0x27cc4d['options']?_0x27cc4d['options'][_0xce89('0x1d')]||null:null,'limit':_0x27cc4d['options']?_0x27cc4d[_0xce89('0x19')][_0xce89('0x1e')]||null:null})['then'](function(_0x11d0ef){logger[_0xce89('0xa')](_0xce89('0x1f'),_0x27cc4d);logger[_0xce89('0xd')](_0xce89('0x1f'),_0x27cc4d,JSON[_0xce89('0xf')](_0x11d0ef));_0xd1af1c(_0x11d0ef);})[_0xce89('0x14')](function(_0x3dc057){logger[_0xce89('0x10')](_0xce89('0x1f'),_0x3dc057['message'],_0x27cc4d);_0x572e81(_0x344107[_0xce89('0x10')](0x1f4,_0x3dc057['message']));});});}; \ No newline at end of file +var _0x8d02=['raw','then','CreateFaxQueueReport','debug','stringify','catch','UpdateFaxQueueReport','update','where','limit','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','FaxQueueReport','options'];(function(_0x222abd,_0x30ffd2){var _0x5923ff=function(_0xa60d6f){while(--_0xa60d6f){_0x222abd['push'](_0x222abd['shift']());}};_0x5923ff(++_0x30ffd2);}(_0x8d02,0x149));var _0x28d0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x8d02[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x28d0('0x0'));var moment=require(_0x28d0('0x1'));var BPromise=require(_0x28d0('0x2'));var rs=require(_0x28d0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x28d0('0x4'))(_0x28d0('0x5'));var config=require(_0x28d0('0x6'));var jayson=require(_0x28d0('0x7'));var client=jayson['client'][_0x28d0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x432f37,_0x14dcc2,_0x4834c5){return new BPromise(function(_0x584ecc,_0x10c803){return client['request'](_0x432f37,_0x4834c5)['then'](function(_0x481f95){logger[_0x28d0('0x9')](_0x28d0('0xa'),_0x14dcc2,_0x28d0('0xb'));logger['debug'](_0x28d0('0xc'),_0x14dcc2,_0x28d0('0xb'),JSON['stringify'](_0x481f95));if(_0x481f95['error']){if(_0x481f95[_0x28d0('0xd')][_0x28d0('0xe')]===0x1f4){logger[_0x28d0('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x14dcc2,_0x481f95[_0x28d0('0xd')][_0x28d0('0xf')]);return _0x10c803(_0x481f95['error'][_0x28d0('0xf')]);}logger[_0x28d0('0xd')](_0x28d0('0xa'),_0x14dcc2,_0x481f95['error'][_0x28d0('0xf')]);return _0x584ecc(_0x481f95['error'][_0x28d0('0xf')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x14dcc2,_0x28d0('0xb'));_0x584ecc(_0x481f95[_0x28d0('0x10')][_0x28d0('0xf')]);}})['catch'](function(_0x33091f){logger[_0x28d0('0xd')](_0x28d0('0xa'),_0x14dcc2,_0x33091f);_0x10c803(_0x33091f);});});}exports['CreateFaxQueueReport']=function(_0x2ba81a){var _0xfc4147=this;return new Promise(function(_0x275524,_0x4d454a){return db[_0x28d0('0x11')]['create'](_0x2ba81a['body'],{'raw':_0x2ba81a[_0x28d0('0x12')]?_0x2ba81a[_0x28d0('0x12')][_0x28d0('0x13')]===undefined?!![]:![]:!![]})[_0x28d0('0x14')](function(_0x50f9d5){logger[_0x28d0('0x9')](_0x28d0('0x15'),_0x2ba81a);logger[_0x28d0('0x16')](_0x28d0('0x15'),_0x2ba81a,JSON[_0x28d0('0x17')](_0x50f9d5));_0x275524(_0x50f9d5);})[_0x28d0('0x18')](function(_0x11d613){logger['error'](_0x28d0('0x15'),_0x11d613[_0x28d0('0xf')],_0x2ba81a);_0x4d454a(_0xfc4147[_0x28d0('0xd')](0x1f4,_0x11d613[_0x28d0('0xf')]));});});};exports[_0x28d0('0x19')]=function(_0x5c36df){var _0x1cb2e5=this;return new Promise(function(_0x28e154,_0x2b997d){return db[_0x28d0('0x11')][_0x28d0('0x1a')](_0x5c36df['body'],{'raw':_0x5c36df[_0x28d0('0x12')]?_0x5c36df[_0x28d0('0x12')][_0x28d0('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c36df[_0x28d0('0x12')]?_0x5c36df[_0x28d0('0x12')][_0x28d0('0x1b')]||null:null,'attributes':_0x5c36df[_0x28d0('0x12')]?_0x5c36df[_0x28d0('0x12')]['attributes']||null:null,'limit':_0x5c36df[_0x28d0('0x12')]?_0x5c36df[_0x28d0('0x12')][_0x28d0('0x1c')]||null:null})['then'](function(_0x445597){logger[_0x28d0('0x9')](_0x28d0('0x19'),_0x5c36df);logger[_0x28d0('0x16')](_0x28d0('0x19'),_0x5c36df,JSON[_0x28d0('0x17')](_0x445597));_0x28e154(_0x445597);})[_0x28d0('0x18')](function(_0x30f1a0){logger[_0x28d0('0xd')](_0x28d0('0x19'),_0x30f1a0[_0x28d0('0xf')],_0x5c36df);_0x2b997d(_0x1cb2e5[_0x28d0('0xd')](0x1f4,_0x30f1a0[_0x28d0('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 63e6e16..baba955 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 _0x1a39=['multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','exports'];(function(_0x5cfd6c,_0x2c7695){var _0x336f9b=function(_0xa8e2f8){while(--_0xa8e2f8){_0x5cfd6c['push'](_0x5cfd6c['shift']());}};_0x336f9b(++_0x2c7695);}(_0x1a39,0x1db));var _0x91a3=function(_0x4b2ce8,_0x413a78){_0x4b2ce8=_0x4b2ce8-0x0;var _0x2bbfca=_0x1a39[_0x4b2ce8];return _0x2bbfca;};'use strict';var multer=require(_0x91a3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x91a3('0x1'));var express=require(_0x91a3('0x2'));var router=express[_0x91a3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x91a3('0x4'));var interaction=require(_0x91a3('0x5'));var config=require(_0x91a3('0x6'));var controller=require('./faxQueueReport.controller');router[_0x91a3('0x7')]('/',auth[_0x91a3('0x8')](),controller[_0x91a3('0x9')]);router['get'](_0x91a3('0xa'),auth['isAuthenticated'](),controller[_0x91a3('0xb')]);router[_0x91a3('0x7')](_0x91a3('0xc'),auth[_0x91a3('0x8')](),controller[_0x91a3('0xd')]);router[_0x91a3('0xe')]('/',auth[_0x91a3('0x8')](),controller[_0x91a3('0xf')]);router[_0x91a3('0x10')](_0x91a3('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x91a3('0x11')](_0x91a3('0xc'),auth[_0x91a3('0x8')](),controller['destroy']);module[_0x91a3('0x12')]=router; \ No newline at end of file +var _0x64fc=['./faxQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x580e40,_0x307ecf){var _0x41cbe2=function(_0x2460fc){while(--_0x2460fc){_0x580e40['push'](_0x580e40['shift']());}};_0x41cbe2(++_0x307ecf);}(_0x64fc,0x150));var _0xc64f=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x64fc[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0xc64f('0x0'));var util=require('util');var path=require(_0xc64f('0x1'));var timeout=require('connect-timeout');var express=require(_0xc64f('0x2'));var router=express[_0xc64f('0x3')]();var fs_extra=require(_0xc64f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc64f('0x5'));var config=require('../../config/environment');var controller=require(_0xc64f('0x6'));router[_0xc64f('0x7')]('/',auth['isAuthenticated'](),controller[_0xc64f('0x8')]);router[_0xc64f('0x7')](_0xc64f('0x9'),auth['isAuthenticated'](),controller[_0xc64f('0xa')]);router[_0xc64f('0x7')](_0xc64f('0xb'),auth[_0xc64f('0xc')](),controller['show']);router['post']('/',auth[_0xc64f('0xc')](),controller['create']);router[_0xc64f('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xc64f('0xe')]);router[_0xc64f('0xf')]('/:id',auth[_0xc64f('0xc')](),controller[_0xc64f('0x10')]);module[_0xc64f('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index fbc0241..c60d6fb 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x2e4cbf,_0x8763d3){var _0x52840f=function(_0x31b93f){while(--_0x31b93f){_0x2e4cbf['push'](_0x2e4cbf['shift']());}};_0x52840f(++_0x8763d3);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1e0239,_0x37c912){_0x1e0239=_0x1e0239-0x0;var _0x6756c8=_0xb43b[_0x1e0239];return _0x6756c8;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x2c9b79,_0x7cf58b){var _0x265032=function(_0x188a92){while(--_0x188a92){_0x2c9b79['push'](_0x2c9b79['shift']());}};_0x265032(++_0x7cf58b);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5015d2,_0x49d545){_0x5015d2=_0x5015d2-0x0;var _0x3a411d=_0xb43b[_0x5015d2];return _0x3a411d;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 38b41d3..e49dbf9 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 _0xeb45=['rows','catch','params','includeAll','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll'];(function(_0x1e40dc,_0x54291d){var _0x345daa=function(_0x467f98){while(--_0x467f98){_0x1e40dc['push'](_0x1e40dc['shift']());}};_0x345daa(++_0x54291d);}(_0xeb45,0x131));var _0x5eb4=function(_0x104d1e,_0x417423){_0x104d1e=_0x104d1e-0x0;var _0x14d21c=_0xeb45[_0x104d1e];return _0x14d21c;};'use strict';var emlformat=require(_0x5eb4('0x0'));var rimraf=require(_0x5eb4('0x1'));var zipdir=require(_0x5eb4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5eb4('0x3'));var moment=require('moment');var BPromise=require(_0x5eb4('0x4'));var Mustache=require(_0x5eb4('0x5'));var util=require(_0x5eb4('0x6'));var path=require('path');var sox=require(_0x5eb4('0x7'));var csv=require('to-csv');var ejs=require(_0x5eb4('0x8'));var fs=require('fs');var fs_extra=require(_0x5eb4('0x9'));var _=require(_0x5eb4('0xa'));var squel=require(_0x5eb4('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5eb4('0xc'));var Papa=require('papaparse');var Redis=require(_0x5eb4('0xd'));var authService=require(_0x5eb4('0xe'));var qs=require(_0x5eb4('0xf'));var as=require(_0x5eb4('0x10'));var hardwareService=require(_0x5eb4('0x11'));var logger=require(_0x5eb4('0x12'))(_0x5eb4('0x13'));var utils=require(_0x5eb4('0x14'));var config=require(_0x5eb4('0x15'));var licenseUtil=require(_0x5eb4('0x16'));var db=require(_0x5eb4('0x17'))['db'];function respondWithStatusCode(_0x1414bf,_0x571354){_0x571354=_0x571354||0xcc;return function(_0x5157df){if(_0x5157df){return _0x1414bf['sendStatus'](_0x571354);}return _0x1414bf[_0x5eb4('0x18')](_0x571354)[_0x5eb4('0x19')]();};}function respondWithResult(_0x4e4d6e,_0x568601){_0x568601=_0x568601||0xc8;return function(_0xd2a997){if(_0xd2a997){return _0x4e4d6e['status'](_0x568601)[_0x5eb4('0x1a')](_0xd2a997);}};}function respondWithFilteredResult(_0x3a4834,_0x193c51){return function(_0x2a22e9){if(_0x2a22e9){var _0x11f2df=typeof _0x193c51[_0x5eb4('0x1b')]===_0x5eb4('0x1c')&&typeof _0x193c51[_0x5eb4('0x1d')]===_0x5eb4('0x1c');var _0x2eb1f7=_0x2a22e9[_0x5eb4('0x1e')];var _0x428617=_0x11f2df?0x0:_0x193c51['offset'];var _0x1f0340=_0x11f2df?_0x2a22e9[_0x5eb4('0x1e')]:_0x193c51[_0x5eb4('0x1b')]+_0x193c51['limit'];var _0x19839c;if(_0x1f0340>=_0x2eb1f7){_0x1f0340=_0x2eb1f7;_0x19839c=0xc8;}else{_0x19839c=0xce;}_0x3a4834[_0x5eb4('0x18')](_0x19839c);return _0x3a4834[_0x5eb4('0x1f')]('Content-Range',_0x428617+'-'+_0x1f0340+'/'+_0x2eb1f7)['json'](_0x2a22e9);}return null;};}function patchUpdates(_0x307b4a){return function(_0x56a70c){try{jsonpatch[_0x5eb4('0x20')](_0x56a70c,_0x307b4a,!![]);}catch(_0x4ccb3e){return BPromise['reject'](_0x4ccb3e);}return _0x56a70c[_0x5eb4('0x21')]();};}function saveUpdates(_0x3a90e3,_0x2b2727){return function(_0xcfdbcf){if(_0xcfdbcf){return _0xcfdbcf[_0x5eb4('0x22')](_0x3a90e3)[_0x5eb4('0x23')](function(_0xa4b97d){return _0xa4b97d;});}return null;};}function removeEntity(_0x55b64e,_0x551016){return function(_0x22b9a9){if(_0x22b9a9){return _0x22b9a9['destroy']()[_0x5eb4('0x23')](function(){_0x55b64e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ce24d,_0x5abd18){return function(_0x49df66){if(!_0x49df66){_0x1ce24d['sendStatus'](0x194);}return _0x49df66;};}function handleError(_0x109c67,_0x19ea51){_0x19ea51=_0x19ea51||0x1f4;return function(_0x3ae99f){logger[_0x5eb4('0x24')](_0x3ae99f[_0x5eb4('0x25')]);if(_0x3ae99f[_0x5eb4('0x26')]){delete _0x3ae99f['name'];}_0x109c67[_0x5eb4('0x18')](_0x19ea51)[_0x5eb4('0x27')](_0x3ae99f);};}exports[_0x5eb4('0x28')]=function(_0x11ed6d,_0x330cb2){var _0x1db9f4={},_0x11b2ab={},_0x54cb5e={'count':0x0,'rows':[]};var _0x4a6379=_[_0x5eb4('0x29')](db[_0x5eb4('0x2a')][_0x5eb4('0x2b')],function(_0x2b7823){return{'name':_0x2b7823[_0x5eb4('0x2c')],'type':_0x2b7823['type'][_0x5eb4('0x2d')]};});_0x11b2ab[_0x5eb4('0x2e')]=_['map'](_0x4a6379,_0x5eb4('0x26'));_0x11b2ab[_0x5eb4('0x2f')]=_[_0x5eb4('0x30')](_0x11ed6d[_0x5eb4('0x2f')]);_0x11b2ab[_0x5eb4('0x31')]=_[_0x5eb4('0x32')](_0x11b2ab[_0x5eb4('0x2e')],_0x11b2ab[_0x5eb4('0x2f')]);_0x1db9f4[_0x5eb4('0x33')]=_[_0x5eb4('0x32')](_0x11b2ab[_0x5eb4('0x2e')],qs[_0x5eb4('0x34')](_0x11ed6d['query'][_0x5eb4('0x34')]));_0x1db9f4[_0x5eb4('0x33')]=_0x1db9f4[_0x5eb4('0x33')][_0x5eb4('0x35')]?_0x1db9f4[_0x5eb4('0x33')]:_0x11b2ab[_0x5eb4('0x2e')];if(!_0x11ed6d[_0x5eb4('0x2f')]['hasOwnProperty'](_0x5eb4('0x36'))){_0x1db9f4[_0x5eb4('0x1d')]=qs[_0x5eb4('0x1d')](_0x11ed6d[_0x5eb4('0x2f')][_0x5eb4('0x1d')]);_0x1db9f4['offset']=qs[_0x5eb4('0x1b')](_0x11ed6d[_0x5eb4('0x2f')][_0x5eb4('0x1b')]);}_0x1db9f4['order']=qs[_0x5eb4('0x37')](_0x11ed6d[_0x5eb4('0x2f')][_0x5eb4('0x37')]);_0x1db9f4[_0x5eb4('0x38')]=qs[_0x5eb4('0x31')](_[_0x5eb4('0x39')](_0x11ed6d[_0x5eb4('0x2f')],_0x11b2ab[_0x5eb4('0x31')]),_0x4a6379);if(_0x11ed6d[_0x5eb4('0x2f')]['filter']){_0x1db9f4[_0x5eb4('0x38')]=_[_0x5eb4('0x3a')](_0x1db9f4[_0x5eb4('0x38')],{'$or':_[_0x5eb4('0x29')](_0x4a6379,function(_0x1974cd){if(_0x1974cd[_0x5eb4('0x3b')]!==_0x5eb4('0x3c')){var _0x428f1c={};_0x428f1c[_0x1974cd[_0x5eb4('0x26')]]={'$like':'%'+_0x11ed6d['query'][_0x5eb4('0x3d')]+'%'};return _0x428f1c;}})});}_0x1db9f4=_[_0x5eb4('0x3a')]({},_0x1db9f4,_0x11ed6d[_0x5eb4('0x3e')]);var _0x3f303c={'where':_0x1db9f4[_0x5eb4('0x38')]};return db[_0x5eb4('0x2a')][_0x5eb4('0x1e')](_0x3f303c)[_0x5eb4('0x23')](function(_0x333308){_0x54cb5e[_0x5eb4('0x1e')]=_0x333308;if(_0x11ed6d['query']['includeAll']){_0x1db9f4[_0x5eb4('0x3f')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x5eb4('0x40')](_0x1db9f4);})['then'](function(_0x1aaa80){_0x54cb5e[_0x5eb4('0x41')]=_0x1aaa80;return _0x54cb5e;})['then'](respondWithFilteredResult(_0x330cb2,_0x1db9f4))[_0x5eb4('0x42')](handleError(_0x330cb2,null));};exports['show']=function(_0x3443f8,_0x4c6aca){var _0x30f0e4={'raw':!![],'where':{'id':_0x3443f8[_0x5eb4('0x43')]['id']}},_0x397d7b={};_0x397d7b[_0x5eb4('0x2e')]=_[_0x5eb4('0x30')](db[_0x5eb4('0x2a')]['rawAttributes']);_0x397d7b['query']=_[_0x5eb4('0x30')](_0x3443f8[_0x5eb4('0x2f')]);_0x397d7b[_0x5eb4('0x31')]=_[_0x5eb4('0x32')](_0x397d7b[_0x5eb4('0x2e')],_0x397d7b[_0x5eb4('0x2f')]);_0x30f0e4['attributes']=_[_0x5eb4('0x32')](_0x397d7b[_0x5eb4('0x2e')],qs[_0x5eb4('0x34')](_0x3443f8['query'][_0x5eb4('0x34')]));_0x30f0e4[_0x5eb4('0x33')]=_0x30f0e4[_0x5eb4('0x33')][_0x5eb4('0x35')]?_0x30f0e4[_0x5eb4('0x33')]:_0x397d7b[_0x5eb4('0x2e')];if(_0x3443f8['query'][_0x5eb4('0x44')]){_0x30f0e4[_0x5eb4('0x3f')]=[{'all':!![]}];}_0x30f0e4=_[_0x5eb4('0x3a')]({},_0x30f0e4,_0x3443f8[_0x5eb4('0x3e')]);return db[_0x5eb4('0x2a')][_0x5eb4('0x45')](_0x30f0e4)[_0x5eb4('0x23')](handleEntityNotFound(_0x4c6aca,null))[_0x5eb4('0x23')](respondWithResult(_0x4c6aca,null))[_0x5eb4('0x42')](handleError(_0x4c6aca,null));};exports[_0x5eb4('0x46')]=function(_0x3f6520,_0x3f4285){return db[_0x5eb4('0x2a')][_0x5eb4('0x46')](_0x3f6520[_0x5eb4('0x47')],{})[_0x5eb4('0x23')](respondWithResult(_0x3f4285,0xc9))[_0x5eb4('0x42')](handleError(_0x3f4285,null));};exports[_0x5eb4('0x22')]=function(_0x6d7e2f,_0x291c86){if(_0x6d7e2f['body']['id']){delete _0x6d7e2f[_0x5eb4('0x47')]['id'];}return db[_0x5eb4('0x2a')][_0x5eb4('0x45')]({'where':{'id':_0x6d7e2f[_0x5eb4('0x43')]['id']}})[_0x5eb4('0x23')](handleEntityNotFound(_0x291c86,null))['then'](saveUpdates(_0x6d7e2f['body'],null))[_0x5eb4('0x23')](respondWithResult(_0x291c86,null))[_0x5eb4('0x42')](handleError(_0x291c86,null));};exports[_0x5eb4('0x48')]=function(_0x2787c2,_0x4da392){return db[_0x5eb4('0x2a')][_0x5eb4('0x45')]({'where':{'id':_0x2787c2[_0x5eb4('0x43')]['id']}})[_0x5eb4('0x23')](handleEntityNotFound(_0x4da392,null))[_0x5eb4('0x23')](removeEntity(_0x4da392,null))[_0x5eb4('0x42')](handleError(_0x4da392,null));};exports[_0x5eb4('0x49')]=function(_0x5d4e05,_0x41ab83){return db[_0x5eb4('0x2a')]['describe']()['then'](respondWithResult(_0x41ab83,null))[_0x5eb4('0x42')](handleError(_0x41ab83,null));}; \ No newline at end of file +var _0x1834=['fields','query','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','destroy','then','error','stack','name','send','map','FaxTransferReport','rawAttributes','key','model','keys','attributes','intersection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1834,0x65));var _0x4183=function(_0x14eafa,_0x1f47c7){_0x14eafa=_0x14eafa-0x0;var _0x20cbd3=_0x1834[_0x14eafa];return _0x20cbd3;};'use strict';var emlformat=require(_0x4183('0x0'));var rimraf=require(_0x4183('0x1'));var zipdir=require(_0x4183('0x2'));var jsonpatch=require(_0x4183('0x3'));var rp=require(_0x4183('0x4'));var moment=require('moment');var BPromise=require(_0x4183('0x5'));var Mustache=require('mustache');var util=require(_0x4183('0x6'));var path=require(_0x4183('0x7'));var sox=require(_0x4183('0x8'));var csv=require(_0x4183('0x9'));var ejs=require(_0x4183('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4183('0xb'));var squel=require(_0x4183('0xc'));var crypto=require(_0x4183('0xd'));var jsforce=require(_0x4183('0xe'));var deskjs=require(_0x4183('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4183('0x10'));var Papa=require(_0x4183('0x11'));var Redis=require('ioredis');var authService=require(_0x4183('0x12'));var qs=require(_0x4183('0x13'));var as=require(_0x4183('0x14'));var hardwareService=require(_0x4183('0x15'));var logger=require(_0x4183('0x16'))(_0x4183('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4183('0x18'));var db=require(_0x4183('0x19'))['db'];function respondWithStatusCode(_0x48ea66,_0x440fb4){_0x440fb4=_0x440fb4||0xcc;return function(_0x3a34aa){if(_0x3a34aa){return _0x48ea66['sendStatus'](_0x440fb4);}return _0x48ea66[_0x4183('0x1a')](_0x440fb4)[_0x4183('0x1b')]();};}function respondWithResult(_0x244c37,_0x377010){_0x377010=_0x377010||0xc8;return function(_0x23ca7f){if(_0x23ca7f){return _0x244c37[_0x4183('0x1a')](_0x377010)[_0x4183('0x1c')](_0x23ca7f);}};}function respondWithFilteredResult(_0x20b541,_0x1ccfa8){return function(_0x1998c8){if(_0x1998c8){var _0x5eab35=typeof _0x1ccfa8[_0x4183('0x1d')]===_0x4183('0x1e')&&typeof _0x1ccfa8['limit']===_0x4183('0x1e');var _0x5a7c8=_0x1998c8[_0x4183('0x1f')];var _0x54b9f3=_0x5eab35?0x0:_0x1ccfa8['offset'];var _0xef1ca=_0x5eab35?_0x1998c8['count']:_0x1ccfa8['offset']+_0x1ccfa8[_0x4183('0x20')];var _0x9183c5;if(_0xef1ca>=_0x5a7c8){_0xef1ca=_0x5a7c8;_0x9183c5=0xc8;}else{_0x9183c5=0xce;}_0x20b541['status'](_0x9183c5);return _0x20b541[_0x4183('0x21')]('Content-Range',_0x54b9f3+'-'+_0xef1ca+'/'+_0x5a7c8)[_0x4183('0x1c')](_0x1998c8);}return null;};}function patchUpdates(_0x480371){return function(_0x4d5e21){try{jsonpatch[_0x4183('0x22')](_0x4d5e21,_0x480371,!![]);}catch(_0x263c14){return BPromise['reject'](_0x263c14);}return _0x4d5e21[_0x4183('0x23')]();};}function saveUpdates(_0x43970e,_0x5a97eb){return function(_0x30dd1e){if(_0x30dd1e){return _0x30dd1e[_0x4183('0x24')](_0x43970e)['then'](function(_0x489deb){return _0x489deb;});}return null;};}function removeEntity(_0x95cacd,_0x40b2d5){return function(_0x32800d){if(_0x32800d){return _0x32800d[_0x4183('0x25')]()[_0x4183('0x26')](function(){_0x95cacd[_0x4183('0x1a')](0xcc)[_0x4183('0x1b')]();});}};}function handleEntityNotFound(_0x44331d,_0x118ce4){return function(_0x49e049){if(!_0x49e049){_0x44331d['sendStatus'](0x194);}return _0x49e049;};}function handleError(_0x1af6e6,_0x268ff8){_0x268ff8=_0x268ff8||0x1f4;return function(_0x5556d5){logger[_0x4183('0x27')](_0x5556d5[_0x4183('0x28')]);if(_0x5556d5[_0x4183('0x29')]){delete _0x5556d5['name'];}_0x1af6e6[_0x4183('0x1a')](_0x268ff8)[_0x4183('0x2a')](_0x5556d5);};}exports['index']=function(_0x55ac28,_0x3c8138){var _0x13ea9a={},_0x9e7323={},_0x1ad1a6={'count':0x0,'rows':[]};var _0x3b35e7=_[_0x4183('0x2b')](db[_0x4183('0x2c')][_0x4183('0x2d')],function(_0x1b8447){return{'name':_0x1b8447['fieldName'],'type':_0x1b8447['type'][_0x4183('0x2e')]};});_0x9e7323[_0x4183('0x2f')]=_[_0x4183('0x2b')](_0x3b35e7,_0x4183('0x29'));_0x9e7323['query']=_[_0x4183('0x30')](_0x55ac28['query']);_0x9e7323['filters']=_['intersection'](_0x9e7323[_0x4183('0x2f')],_0x9e7323['query']);_0x13ea9a[_0x4183('0x31')]=_[_0x4183('0x32')](_0x9e7323[_0x4183('0x2f')],qs[_0x4183('0x33')](_0x55ac28[_0x4183('0x34')][_0x4183('0x33')]));_0x13ea9a[_0x4183('0x31')]=_0x13ea9a[_0x4183('0x31')][_0x4183('0x35')]?_0x13ea9a[_0x4183('0x31')]:_0x9e7323[_0x4183('0x2f')];if(!_0x55ac28[_0x4183('0x34')][_0x4183('0x36')](_0x4183('0x37'))){_0x13ea9a[_0x4183('0x20')]=qs['limit'](_0x55ac28['query'][_0x4183('0x20')]);_0x13ea9a[_0x4183('0x1d')]=qs[_0x4183('0x1d')](_0x55ac28[_0x4183('0x34')][_0x4183('0x1d')]);}_0x13ea9a[_0x4183('0x38')]=qs[_0x4183('0x39')](_0x55ac28['query']['sort']);_0x13ea9a[_0x4183('0x3a')]=qs[_0x4183('0x3b')](_[_0x4183('0x3c')](_0x55ac28[_0x4183('0x34')],_0x9e7323[_0x4183('0x3b')]),_0x3b35e7);if(_0x55ac28[_0x4183('0x34')][_0x4183('0x3d')]){_0x13ea9a[_0x4183('0x3a')]=_[_0x4183('0x3e')](_0x13ea9a['where'],{'$or':_[_0x4183('0x2b')](_0x3b35e7,function(_0x114250){if(_0x114250['type']!==_0x4183('0x3f')){var _0x167b9f={};_0x167b9f[_0x114250[_0x4183('0x29')]]={'$like':'%'+_0x55ac28['query'][_0x4183('0x3d')]+'%'};return _0x167b9f;}})});}_0x13ea9a=_[_0x4183('0x3e')]({},_0x13ea9a,_0x55ac28['options']);var _0x53e8b0={'where':_0x13ea9a['where']};return db[_0x4183('0x2c')][_0x4183('0x1f')](_0x53e8b0)[_0x4183('0x26')](function(_0x1a4921){_0x1ad1a6[_0x4183('0x1f')]=_0x1a4921;if(_0x55ac28[_0x4183('0x34')][_0x4183('0x40')]){_0x13ea9a[_0x4183('0x41')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x4183('0x42')](_0x13ea9a);})[_0x4183('0x26')](function(_0x1beefc){_0x1ad1a6[_0x4183('0x43')]=_0x1beefc;return _0x1ad1a6;})[_0x4183('0x26')](respondWithFilteredResult(_0x3c8138,_0x13ea9a))[_0x4183('0x44')](handleError(_0x3c8138,null));};exports[_0x4183('0x45')]=function(_0x4c90ac,_0x37ff2d){var _0xf1aa68={'raw':!![],'where':{'id':_0x4c90ac[_0x4183('0x46')]['id']}},_0x920b29={};_0x920b29[_0x4183('0x2f')]=_['keys'](db[_0x4183('0x2c')][_0x4183('0x2d')]);_0x920b29[_0x4183('0x34')]=_[_0x4183('0x30')](_0x4c90ac[_0x4183('0x34')]);_0x920b29[_0x4183('0x3b')]=_[_0x4183('0x32')](_0x920b29[_0x4183('0x2f')],_0x920b29[_0x4183('0x34')]);_0xf1aa68[_0x4183('0x31')]=_[_0x4183('0x32')](_0x920b29[_0x4183('0x2f')],qs[_0x4183('0x33')](_0x4c90ac[_0x4183('0x34')][_0x4183('0x33')]));_0xf1aa68[_0x4183('0x31')]=_0xf1aa68[_0x4183('0x31')][_0x4183('0x35')]?_0xf1aa68[_0x4183('0x31')]:_0x920b29[_0x4183('0x2f')];if(_0x4c90ac[_0x4183('0x34')][_0x4183('0x40')]){_0xf1aa68[_0x4183('0x41')]=[{'all':!![]}];}_0xf1aa68=_['merge']({},_0xf1aa68,_0x4c90ac[_0x4183('0x47')]);return db['FaxTransferReport'][_0x4183('0x48')](_0xf1aa68)['then'](handleEntityNotFound(_0x37ff2d,null))[_0x4183('0x26')](respondWithResult(_0x37ff2d,null))[_0x4183('0x44')](handleError(_0x37ff2d,null));};exports[_0x4183('0x49')]=function(_0x7f5763,_0x52f92e){return db[_0x4183('0x2c')][_0x4183('0x49')](_0x7f5763['body'],{})[_0x4183('0x26')](respondWithResult(_0x52f92e,0xc9))[_0x4183('0x44')](handleError(_0x52f92e,null));};exports[_0x4183('0x24')]=function(_0x4b9dd5,_0x5f4894){if(_0x4b9dd5['body']['id']){delete _0x4b9dd5[_0x4183('0x4a')]['id'];}return db[_0x4183('0x2c')][_0x4183('0x48')]({'where':{'id':_0x4b9dd5[_0x4183('0x46')]['id']}})['then'](handleEntityNotFound(_0x5f4894,null))[_0x4183('0x26')](saveUpdates(_0x4b9dd5['body'],null))[_0x4183('0x26')](respondWithResult(_0x5f4894,null))['catch'](handleError(_0x5f4894,null));};exports[_0x4183('0x25')]=function(_0x11753c,_0x351b67){return db[_0x4183('0x2c')]['find']({'where':{'id':_0x11753c[_0x4183('0x46')]['id']}})[_0x4183('0x26')](handleEntityNotFound(_0x351b67,null))[_0x4183('0x26')](removeEntity(_0x351b67,null))['catch'](handleError(_0x351b67,null));};exports[_0x4183('0x4b')]=function(_0x1d4f20,_0x4631a5){return db['FaxTransferReport'][_0x4183('0x4b')]()[_0x4183('0x26')](respondWithResult(_0x4631a5,null))['catch'](handleError(_0x4631a5,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 1cece43..4b37d77 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 _0x5d44=['../../config/logger','api','moment','bluebird','request-promise','rimraf','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util'];(function(_0x3b3862,_0x4d8fc5){var _0x5aa3fd=function(_0x1a02d4){while(--_0x1a02d4){_0x3b3862['push'](_0x3b3862['shift']());}};_0x5aa3fd(++_0x4d8fc5);}(_0x5d44,0x6c));var _0x45d4=function(_0x5df82a,_0x4d4d2e){_0x5df82a=_0x5df82a-0x0;var _0x3178dc=_0x5d44[_0x5df82a];return _0x3178dc;};'use strict';var _=require(_0x45d4('0x0'));var util=require(_0x45d4('0x1'));var logger=require(_0x45d4('0x2'))(_0x45d4('0x3'));var moment=require(_0x45d4('0x4'));var BPromise=require(_0x45d4('0x5'));var rp=require(_0x45d4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x45d4('0x7'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x56d86f,_0xff8609){return _0x56d86f['define'](_0x45d4('0x8'),attributes,{'tableName':_0x45d4('0x9'),'paranoid':![],'indexes':[{'name':_0x45d4('0xa'),'fields':[_0x45d4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa713=['api','request-promise','rimraf','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid','lodash'];(function(_0x3a112e,_0x1d1cd3){var _0x4cc64f=function(_0x4983b0){while(--_0x4983b0){_0x3a112e['push'](_0x3a112e['shift']());}};_0x4cc64f(++_0x1d1cd3);}(_0xa713,0x7d));var _0x3a71=function(_0x4a05c9,_0x58e0ab){_0x4a05c9=_0x4a05c9-0x0;var _0x9ac6ef=_0xa713[_0x4a05c9];return _0x9ac6ef;};'use strict';var _=require(_0x3a71('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3a71('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3a71('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3a71('0x3'));var config=require('../../config/environment');var attributes=require(_0x3a71('0x4'));module[_0x3a71('0x5')]=function(_0x49b8ee,_0x27de9a){return _0x49b8ee['define'](_0x3a71('0x6'),attributes,{'tableName':_0x3a71('0x7'),'paranoid':![],'indexes':[{'name':_0x3a71('0x8'),'fields':[_0x3a71('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 5c9ab17..062f24f 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 _0x00c3=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch'];(function(_0xe9e2f0,_0x1ff5ed){var _0x593ee1=function(_0x5081a2){while(--_0x5081a2){_0xe9e2f0['push'](_0xe9e2f0['shift']());}};_0x593ee1(++_0x1ff5ed);}(_0x00c3,0x120));var _0x300c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x00c3[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x300c('0x0'));var util=require(_0x300c('0x1'));var moment=require('moment');var BPromise=require(_0x300c('0x2'));var rs=require(_0x300c('0x3'));var fs=require('fs');var Redis=require(_0x300c('0x4'));var db=require(_0x300c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x300c('0x6'));var config=require(_0x300c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x300c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1dfccf,_0x24fae4,_0x175a40){return new BPromise(function(_0x3514c3,_0x46136d){return client[_0x300c('0x9')](_0x1dfccf,_0x175a40)['then'](function(_0x49df97){logger[_0x300c('0xa')](_0x300c('0xb'),_0x24fae4,'request\x20sent');logger[_0x300c('0xc')](_0x300c('0xd'),_0x24fae4,_0x300c('0xe'),JSON['stringify'](_0x49df97));if(_0x49df97[_0x300c('0xf')]){if(_0x49df97[_0x300c('0xf')]['code']===0x1f4){logger[_0x300c('0xf')](_0x300c('0xb'),_0x24fae4,_0x49df97[_0x300c('0xf')][_0x300c('0x10')]);return _0x46136d(_0x49df97[_0x300c('0xf')][_0x300c('0x10')]);}logger[_0x300c('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x24fae4,_0x49df97[_0x300c('0xf')][_0x300c('0x10')]);return _0x3514c3(_0x49df97[_0x300c('0xf')][_0x300c('0x10')]);}else{logger[_0x300c('0xa')](_0x300c('0xb'),_0x24fae4,_0x300c('0xe'));_0x3514c3(_0x49df97['result']['message']);}})[_0x300c('0x11')](function(_0x6fc4d0){logger[_0x300c('0xf')](_0x300c('0xb'),_0x24fae4,_0x6fc4d0);_0x46136d(_0x6fc4d0);});});} \ No newline at end of file +var _0x59de=['request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','FaxTransferReport,\x20%s,\x20%s'];(function(_0x56a088,_0x533cd5){var _0x2b4dea=function(_0x3daaff){while(--_0x3daaff){_0x56a088['push'](_0x56a088['shift']());}};_0x2b4dea(++_0x533cd5);}(_0x59de,0x1c1));var _0xe59d=function(_0x363593,_0x3b4415){_0x363593=_0x363593-0x0;var _0x439351=_0x59de[_0x363593];return _0x439351;};'use strict';var _=require(_0xe59d('0x0'));var util=require('util');var moment=require(_0xe59d('0x1'));var BPromise=require('bluebird');var rs=require(_0xe59d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe59d('0x3'))['db'];var utils=require(_0xe59d('0x4'));var logger=require(_0xe59d('0x5'))(_0xe59d('0x6'));var config=require(_0xe59d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe59d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d4d5a,_0x5505c3,_0x35eb50){return new BPromise(function(_0x185656,_0x7aa37b){return client[_0xe59d('0x9')](_0x4d4d5a,_0x35eb50)[_0xe59d('0xa')](function(_0x42b91e){logger[_0xe59d('0xb')](_0xe59d('0xc'),_0x5505c3,_0xe59d('0xd'));logger[_0xe59d('0xe')](_0xe59d('0xf'),_0x5505c3,_0xe59d('0xd'),JSON[_0xe59d('0x10')](_0x42b91e));if(_0x42b91e[_0xe59d('0x11')]){if(_0x42b91e[_0xe59d('0x11')][_0xe59d('0x12')]===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x5505c3,_0x42b91e[_0xe59d('0x11')]['message']);return _0x7aa37b(_0x42b91e[_0xe59d('0x11')][_0xe59d('0x13')]);}logger[_0xe59d('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x5505c3,_0x42b91e[_0xe59d('0x11')][_0xe59d('0x13')]);return _0x185656(_0x42b91e[_0xe59d('0x11')][_0xe59d('0x13')]);}else{logger[_0xe59d('0xb')](_0xe59d('0xc'),_0x5505c3,'request\x20sent');_0x185656(_0x42b91e[_0xe59d('0x14')][_0xe59d('0x13')]);}})[_0xe59d('0x15')](function(_0x814490){logger[_0xe59d('0x11')](_0xe59d('0xc'),_0x5505c3,_0x814490);_0x7aa37b(_0x814490);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 43ab43d..2a48eeb 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 _0xcc56=['isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get'];(function(_0x4d351e,_0x422f41){var _0x7de01d=function(_0x1ca06b){while(--_0x1ca06b){_0x4d351e['push'](_0x4d351e['shift']());}};_0x7de01d(++_0x422f41);}(_0xcc56,0xe6));var _0x6cc5=function(_0x564adf,_0x861a9){_0x564adf=_0x564adf-0x0;var _0x506f27=_0xcc56[_0x564adf];return _0x506f27;};'use strict';var multer=require(_0x6cc5('0x0'));var util=require(_0x6cc5('0x1'));var path=require('path');var timeout=require(_0x6cc5('0x2'));var express=require('express');var router=express[_0x6cc5('0x3')]();var fs_extra=require(_0x6cc5('0x4'));var auth=require(_0x6cc5('0x5'));var interaction=require(_0x6cc5('0x6'));var config=require(_0x6cc5('0x7'));var controller=require(_0x6cc5('0x8'));router[_0x6cc5('0x9')]('/',auth[_0x6cc5('0xa')](),controller['index']);router[_0x6cc5('0x9')](_0x6cc5('0xb'),auth[_0x6cc5('0xa')](),controller[_0x6cc5('0xc')]);router['get'](_0x6cc5('0xd'),auth[_0x6cc5('0xa')](),controller[_0x6cc5('0xe')]);router[_0x6cc5('0xf')]('/',auth['isAuthenticated'](),controller[_0x6cc5('0x10')]);router['put'](_0x6cc5('0xd'),auth[_0x6cc5('0xa')](),controller[_0x6cc5('0x11')]);router[_0x6cc5('0x12')](_0x6cc5('0xd'),auth['isAuthenticated'](),controller[_0x6cc5('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe887=['delete','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','/:id','post','create','put','update'];(function(_0x614ef4,_0x28a060){var _0x35e8e2=function(_0x55e81b){while(--_0x55e81b){_0x614ef4['push'](_0x614ef4['shift']());}};_0x35e8e2(++_0x28a060);}(_0xe887,0x179));var _0x7e88=function(_0x441ac4,_0x934d4){_0x441ac4=_0x441ac4-0x0;var _0x1f19f1=_0xe887[_0x441ac4];return _0x1f19f1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7e88('0x0'));var timeout=require(_0x7e88('0x1'));var express=require('express');var router=express[_0x7e88('0x2')]();var fs_extra=require(_0x7e88('0x3'));var auth=require(_0x7e88('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0x7e88('0x5')](),controller[_0x7e88('0x6')]);router[_0x7e88('0x7')]('/describe',auth[_0x7e88('0x5')](),controller['describe']);router[_0x7e88('0x7')](_0x7e88('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x7e88('0x9')]('/',auth[_0x7e88('0x5')](),controller[_0x7e88('0xa')]);router[_0x7e88('0xb')]('/:id',auth[_0x7e88('0x5')](),controller[_0x7e88('0xc')]);router[_0x7e88('0xd')](_0x7e88('0x8'),auth[_0x7e88('0x5')](),controller['destroy']);module[_0x7e88('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index ab97ef5..9931bc7 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 _0xfaee=['addConfiguration','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post'];(function(_0x2e4481,_0xd520da){var _0x2d29c9=function(_0x1012aa){while(--_0x1012aa){_0x2e4481['push'](_0x2e4481['shift']());}};_0x2d29c9(++_0xd520da);}(_0xfaee,0x82));var _0xefae=function(_0x52dfa5,_0x3908fd){_0x52dfa5=_0x52dfa5-0x0;var _0x1eaf0b=_0xfaee[_0x52dfa5];return _0x1eaf0b;};'use strict';var multer=require(_0xefae('0x0'));var util=require(_0xefae('0x1'));var path=require(_0xefae('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xefae('0x3')]();var fs_extra=require(_0xefae('0x4'));var auth=require(_0xefae('0x5'));var interaction=require(_0xefae('0x6'));var config=require(_0xefae('0x7'));var controller=require(_0xefae('0x8'));router[_0xefae('0x9')]('/',auth[_0xefae('0xa')](),controller[_0xefae('0xb')]);router[_0xefae('0x9')](_0xefae('0xc'),auth[_0xefae('0xa')](),controller[_0xefae('0xd')]);router[_0xefae('0x9')](_0xefae('0xe'),auth[_0xefae('0xa')](),controller[_0xefae('0xf')]);router[_0xefae('0x9')](_0xefae('0x10'),auth[_0xefae('0xa')](),controller[_0xefae('0x11')]);router['post']('/',auth[_0xefae('0xa')](),controller[_0xefae('0x12')]);router[_0xefae('0x13')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xefae('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xefae('0x15')]);router[_0xefae('0x16')](_0xefae('0xc'),auth[_0xefae('0xa')](),controller[_0xefae('0x17')]);module[_0xefae('0x18')]=router; \ No newline at end of file +var _0xbaf8=['put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','./intDeskAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','addConfiguration'];(function(_0x30f82b,_0x5986f9){var _0x2205b7=function(_0x23faab){while(--_0x23faab){_0x30f82b['push'](_0x30f82b['shift']());}};_0x2205b7(++_0x5986f9);}(_0xbaf8,0x101));var _0x8baf=function(_0x305cb0,_0x124dbf){_0x305cb0=_0x305cb0-0x0;var _0x5b4133=_0xbaf8[_0x305cb0];return _0x5b4133;};'use strict';var multer=require(_0x8baf('0x0'));var util=require('util');var path=require(_0x8baf('0x1'));var timeout=require(_0x8baf('0x2'));var express=require(_0x8baf('0x3'));var router=express[_0x8baf('0x4')]();var fs_extra=require(_0x8baf('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8baf('0x6'));router[_0x8baf('0x7')]('/',auth[_0x8baf('0x8')](),controller[_0x8baf('0x9')]);router[_0x8baf('0x7')]('/:id',auth[_0x8baf('0x8')](),controller['show']);router[_0x8baf('0x7')](_0x8baf('0xa'),auth['isAuthenticated'](),controller[_0x8baf('0xb')]);router[_0x8baf('0x7')]('/:id/fields',auth[_0x8baf('0x8')](),controller['getFields']);router['post']('/',auth[_0x8baf('0x8')](),controller['create']);router['post']('/:id/configurations',auth[_0x8baf('0x8')](),controller[_0x8baf('0xc')]);router[_0x8baf('0xd')](_0x8baf('0xe'),auth[_0x8baf('0x8')](),controller[_0x8baf('0xf')]);router[_0x8baf('0x10')](_0x8baf('0xe'),auth[_0x8baf('0x8')](),controller['destroy']);module[_0x8baf('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 207061d..0a579ee 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 _0x428e=['STRING','ENUM','integrationTab','newTab'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x428e,0xec));var _0xe428=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x428e[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe428('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe428('0x0')]},'remoteUri':{'type':Sequelize[_0xe428('0x0')]},'authType':{'type':Sequelize[_0xe428('0x1')]('basic'),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xe428('0x0')]},'consumerSecret':{'type':Sequelize[_0xe428('0x0')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xe428('0x0')]},'serverUrl':{'type':Sequelize[_0xe428('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xe428('0x1')](_0xe428('0x2'),_0xe428('0x3')),'defaultValue':_0xe428('0x2')}}; \ No newline at end of file +var _0xba48=['ENUM','basic','newTab','sequelize','STRING'];(function(_0x8018db,_0x3d6e4f){var _0x3cd654=function(_0x491e26){while(--_0x491e26){_0x8018db['push'](_0x8018db['shift']());}};_0x3cd654(++_0x3d6e4f);}(_0xba48,0xe9));var _0x8ba4=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xba48[_0x12d033];return _0x3b4e80;};'use strict';var Sequelize=require(_0x8ba4('0x0'));module['exports']={'name':{'type':Sequelize[_0x8ba4('0x1')]},'description':{'type':Sequelize[_0x8ba4('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8ba4('0x1')]},'authType':{'type':Sequelize[_0x8ba4('0x2')](_0x8ba4('0x3')),'defaultValue':_0x8ba4('0x3')},'password':{'type':Sequelize[_0x8ba4('0x1')]},'consumerKey':{'type':Sequelize[_0x8ba4('0x1')]},'consumerSecret':{'type':Sequelize[_0x8ba4('0x1')]},'token':{'type':Sequelize[_0x8ba4('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x8ba4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x8ba4('0x2')]('integrationTab',_0x8ba4('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 45dacfa..e826d0f 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 _0xf2c1=['test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','count','limit','Content-Range','apply','save','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','DeskAccount','include','findAll','rows','catch','params','keys','find','create','body','getConfigurations','findOne','DeskConfiguration','hasOwnProperty','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','DeskField','Subjects','priority','remoteUri','authType','username','consumerKey','consumerSecret','token','tokenSecret','slice','substring','GET','%s/custom_fields','application/json','basic','Authorization','format','%s:%s','toString','base64','concat','entries','label'];(function(_0x36ed80,_0x102296){var _0x418c68=function(_0x2a91fc){while(--_0x2a91fc){_0x36ed80['push'](_0x36ed80['shift']());}};_0x418c68(++_0x102296);}(_0xf2c1,0x1c2));var _0x1f2c=function(_0xd28119,_0x2a8097){_0xd28119=_0xd28119-0x0;var _0x418b38=_0xf2c1[_0xd28119];return _0x418b38;};'use strict';var emlformat=require(_0x1f2c('0x0'));var rimraf=require(_0x1f2c('0x1'));var zipdir=require(_0x1f2c('0x2'));var jsonpatch=require(_0x1f2c('0x3'));var rp=require(_0x1f2c('0x4'));var moment=require(_0x1f2c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1f2c('0x6'));var path=require(_0x1f2c('0x7'));var sox=require(_0x1f2c('0x8'));var csv=require(_0x1f2c('0x9'));var ejs=require(_0x1f2c('0xa'));var fs=require('fs');var fs_extra=require(_0x1f2c('0xb'));var _=require('lodash');var squel=require(_0x1f2c('0xc'));var crypto=require(_0x1f2c('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1f2c('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1f2c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1f2c('0xf'));var as=require(_0x1f2c('0x10'));var hardwareService=require(_0x1f2c('0x11'));var logger=require(_0x1f2c('0x12'))(_0x1f2c('0x13'));var utils=require(_0x1f2c('0x14'));var config=require(_0x1f2c('0x15'));var licenseUtil=require(_0x1f2c('0x16'));var db=require(_0x1f2c('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xe22940,_0x216143){_0x216143=_0x216143||0xcc;return function(_0x54018c){if(_0x54018c){return _0xe22940[_0x1f2c('0x18')](_0x216143);}return _0xe22940['status'](_0x216143)[_0x1f2c('0x19')]();};}function respondWithResult(_0x582118,_0xcd66fc){_0xcd66fc=_0xcd66fc||0xc8;return function(_0x1731d9){if(_0x1731d9){return _0x582118[_0x1f2c('0x1a')](_0xcd66fc)[_0x1f2c('0x1b')](_0x1731d9);}};}function respondWithFilteredResult(_0xbbdd9a,_0x34751e){return function(_0x344f80){if(_0x344f80){var _0x1d79b9=typeof _0x34751e[_0x1f2c('0x1c')]==='undefined'&&typeof _0x34751e['limit']==='undefined';var _0x36ef2f=_0x344f80[_0x1f2c('0x1d')];var _0x1933dd=_0x1d79b9?0x0:_0x34751e[_0x1f2c('0x1c')];var _0x2c705d=_0x1d79b9?_0x344f80['count']:_0x34751e[_0x1f2c('0x1c')]+_0x34751e[_0x1f2c('0x1e')];var _0x4594d5;if(_0x2c705d>=_0x36ef2f){_0x2c705d=_0x36ef2f;_0x4594d5=0xc8;}else{_0x4594d5=0xce;}_0xbbdd9a[_0x1f2c('0x1a')](_0x4594d5);return _0xbbdd9a['set'](_0x1f2c('0x1f'),_0x1933dd+'-'+_0x2c705d+'/'+_0x36ef2f)[_0x1f2c('0x1b')](_0x344f80);}return null;};}function patchUpdates(_0x21653e){return function(_0x5d36b8){try{jsonpatch[_0x1f2c('0x20')](_0x5d36b8,_0x21653e,!![]);}catch(_0x47b14a){return BPromise['reject'](_0x47b14a);}return _0x5d36b8[_0x1f2c('0x21')]();};}function saveUpdates(_0x300bfa,_0x21a523){return function(_0x3527c4){if(_0x3527c4){return _0x3527c4[_0x1f2c('0x22')](_0x300bfa)['then'](function(_0x21c572){return _0x21c572;});}return null;};}function removeEntity(_0x10080c,_0x2e6a77){return function(_0x38ba61){if(_0x38ba61){return _0x38ba61[_0x1f2c('0x23')]()[_0x1f2c('0x24')](function(){_0x10080c[_0x1f2c('0x1a')](0xcc)[_0x1f2c('0x19')]();});}};}function handleEntityNotFound(_0x32309e,_0x3e6ff7){return function(_0x23aedb){if(!_0x23aedb){_0x32309e[_0x1f2c('0x18')](0x194);}return _0x23aedb;};}function handleError(_0x5d2ef7,_0x408231){_0x408231=_0x408231||0x1f4;return function(_0x534cfb){logger['error'](_0x534cfb[_0x1f2c('0x25')]);if(_0x534cfb[_0x1f2c('0x26')]){delete _0x534cfb['name'];}_0x5d2ef7['status'](_0x408231)[_0x1f2c('0x27')](_0x534cfb);};}exports[_0x1f2c('0x28')]=function(_0x5bcec1,_0x2be42b){var _0x36ac69={},_0xe855d9={},_0x462b08={'count':0x0,'rows':[]};var _0x34bba7=_[_0x1f2c('0x29')](db['DeskAccount'][_0x1f2c('0x2a')],function(_0x817d90){return{'name':_0x817d90[_0x1f2c('0x2b')],'type':_0x817d90[_0x1f2c('0x2c')][_0x1f2c('0x2d')]};});_0xe855d9['model']=_[_0x1f2c('0x29')](_0x34bba7,_0x1f2c('0x26'));_0xe855d9[_0x1f2c('0x2e')]=_['keys'](_0x5bcec1[_0x1f2c('0x2e')]);_0xe855d9[_0x1f2c('0x2f')]=_[_0x1f2c('0x30')](_0xe855d9['model'],_0xe855d9['query']);_0x36ac69[_0x1f2c('0x31')]=_['intersection'](_0xe855d9[_0x1f2c('0x32')],qs[_0x1f2c('0x33')](_0x5bcec1[_0x1f2c('0x2e')][_0x1f2c('0x33')]));_0x36ac69['attributes']=_0x36ac69[_0x1f2c('0x31')][_0x1f2c('0x34')]?_0x36ac69[_0x1f2c('0x31')]:_0xe855d9[_0x1f2c('0x32')];if(!_0x5bcec1[_0x1f2c('0x2e')]['hasOwnProperty'](_0x1f2c('0x35'))){_0x36ac69['limit']=qs[_0x1f2c('0x1e')](_0x5bcec1[_0x1f2c('0x2e')][_0x1f2c('0x1e')]);_0x36ac69[_0x1f2c('0x1c')]=qs[_0x1f2c('0x1c')](_0x5bcec1['query'][_0x1f2c('0x1c')]);}_0x36ac69[_0x1f2c('0x36')]=qs[_0x1f2c('0x37')](_0x5bcec1[_0x1f2c('0x2e')]['sort']);_0x36ac69['where']=qs['filters'](_['pick'](_0x5bcec1[_0x1f2c('0x2e')],_0xe855d9['filters']),_0x34bba7);if(_0x5bcec1[_0x1f2c('0x2e')]['filter']){_0x36ac69[_0x1f2c('0x38')]=_[_0x1f2c('0x39')](_0x36ac69[_0x1f2c('0x38')],{'$or':_[_0x1f2c('0x29')](_0x34bba7,function(_0x4a11a7){if(_0x4a11a7[_0x1f2c('0x2c')]!==_0x1f2c('0x3a')){var _0x15af89={};_0x15af89[_0x4a11a7[_0x1f2c('0x26')]]={'$like':'%'+_0x5bcec1[_0x1f2c('0x2e')][_0x1f2c('0x3b')]+'%'};return _0x15af89;}})});}_0x36ac69=_[_0x1f2c('0x39')]({},_0x36ac69,_0x5bcec1[_0x1f2c('0x3c')]);var _0x1fb7c8={'where':_0x36ac69['where']};return db[_0x1f2c('0x3d')][_0x1f2c('0x1d')](_0x1fb7c8)[_0x1f2c('0x24')](function(_0x3cacbe){_0x462b08[_0x1f2c('0x1d')]=_0x3cacbe;if(_0x5bcec1[_0x1f2c('0x2e')]['includeAll']){_0x36ac69[_0x1f2c('0x3e')]=[{'all':!![]}];}return db[_0x1f2c('0x3d')][_0x1f2c('0x3f')](_0x36ac69);})[_0x1f2c('0x24')](function(_0x2905f6){_0x462b08[_0x1f2c('0x40')]=_0x2905f6;return _0x462b08;})[_0x1f2c('0x24')](respondWithFilteredResult(_0x2be42b,_0x36ac69))[_0x1f2c('0x41')](handleError(_0x2be42b,null));};exports['show']=function(_0x191054,_0x51bb2f){var _0x5de4f5={'raw':![],'where':{'id':_0x191054[_0x1f2c('0x42')]['id']}},_0x3b8f1d={};_0x3b8f1d[_0x1f2c('0x32')]=_[_0x1f2c('0x43')](db['DeskAccount'][_0x1f2c('0x2a')]);_0x3b8f1d[_0x1f2c('0x2e')]=_[_0x1f2c('0x43')](_0x191054[_0x1f2c('0x2e')]);_0x3b8f1d[_0x1f2c('0x2f')]=_[_0x1f2c('0x30')](_0x3b8f1d[_0x1f2c('0x32')],_0x3b8f1d[_0x1f2c('0x2e')]);_0x5de4f5[_0x1f2c('0x31')]=_[_0x1f2c('0x30')](_0x3b8f1d['model'],qs['fields'](_0x191054[_0x1f2c('0x2e')][_0x1f2c('0x33')]));_0x5de4f5[_0x1f2c('0x31')]=_0x5de4f5[_0x1f2c('0x31')]['length']?_0x5de4f5['attributes']:_0x3b8f1d[_0x1f2c('0x32')];if(_0x191054[_0x1f2c('0x2e')]['includeAll']){_0x5de4f5[_0x1f2c('0x3e')]=[{'all':!![]}];}_0x5de4f5=_[_0x1f2c('0x39')]({},_0x5de4f5,_0x191054[_0x1f2c('0x3c')]);return db[_0x1f2c('0x3d')][_0x1f2c('0x44')](_0x5de4f5)[_0x1f2c('0x24')](handleEntityNotFound(_0x51bb2f,null))[_0x1f2c('0x24')](respondWithResult(_0x51bb2f,null))['catch'](handleError(_0x51bb2f,null));};exports[_0x1f2c('0x45')]=function(_0x5d96d6,_0x298666){return db[_0x1f2c('0x3d')][_0x1f2c('0x45')](_0x5d96d6['body'],{})[_0x1f2c('0x24')](respondWithResult(_0x298666,0xc9))['catch'](handleError(_0x298666,null));};exports['update']=function(_0x5baa0a,_0x585f75){if(_0x5baa0a[_0x1f2c('0x46')]['id']){delete _0x5baa0a[_0x1f2c('0x46')]['id'];}return db[_0x1f2c('0x3d')]['find']({'where':{'id':_0x5baa0a[_0x1f2c('0x42')]['id']}})[_0x1f2c('0x24')](handleEntityNotFound(_0x585f75,null))['then'](saveUpdates(_0x5baa0a[_0x1f2c('0x46')],null))[_0x1f2c('0x24')](respondWithResult(_0x585f75,null))[_0x1f2c('0x41')](handleError(_0x585f75,null));};exports[_0x1f2c('0x23')]=function(_0x347a7d,_0x441311){return db[_0x1f2c('0x3d')][_0x1f2c('0x44')]({'where':{'id':_0x347a7d[_0x1f2c('0x42')]['id']}})[_0x1f2c('0x24')](handleEntityNotFound(_0x441311,null))[_0x1f2c('0x24')](removeEntity(_0x441311,null))[_0x1f2c('0x41')](handleError(_0x441311,null));};exports[_0x1f2c('0x47')]=function(_0x5d4a1e,_0x3bceaf,_0x2fd221){var _0x5a39f0={};var _0x2fdf44={};var _0x506b62;var _0x9f76bf;return db[_0x1f2c('0x3d')][_0x1f2c('0x48')]({'where':{'id':_0x5d4a1e[_0x1f2c('0x42')]['id']}})['then'](handleEntityNotFound(_0x3bceaf,null))[_0x1f2c('0x24')](function(_0xb0f789){if(_0xb0f789){_0x506b62=_0xb0f789;_0x2fdf44[_0x1f2c('0x32')]=_[_0x1f2c('0x43')](db[_0x1f2c('0x49')][_0x1f2c('0x2a')]);_0x2fdf44[_0x1f2c('0x2e')]=_[_0x1f2c('0x43')](_0x5d4a1e['query']);_0x2fdf44['filters']=_[_0x1f2c('0x30')](_0x2fdf44['model'],_0x2fdf44[_0x1f2c('0x2e')]);_0x5a39f0[_0x1f2c('0x31')]=_[_0x1f2c('0x30')](_0x2fdf44[_0x1f2c('0x32')],qs[_0x1f2c('0x33')](_0x5d4a1e['query'][_0x1f2c('0x33')]));_0x5a39f0['attributes']=_0x5a39f0['attributes'][_0x1f2c('0x34')]?_0x5a39f0[_0x1f2c('0x31')]:_0x2fdf44[_0x1f2c('0x32')];_0x5a39f0[_0x1f2c('0x36')]=qs[_0x1f2c('0x37')](_0x5d4a1e['query'][_0x1f2c('0x37')]);_0x5a39f0[_0x1f2c('0x38')]=qs['filters'](_['pick'](_0x5d4a1e[_0x1f2c('0x2e')],_0x2fdf44['filters']));if(_0x5d4a1e[_0x1f2c('0x2e')]['filter']){_0x5a39f0[_0x1f2c('0x38')]=_[_0x1f2c('0x39')](_0x5a39f0[_0x1f2c('0x38')],{'$or':_[_0x1f2c('0x29')](_0x5a39f0[_0x1f2c('0x31')],function(_0x1e16c5){var _0x26f811={};_0x26f811[_0x1e16c5]={'$like':'%'+_0x5d4a1e['query']['filter']+'%'};return _0x26f811;})});}_0x5a39f0=_[_0x1f2c('0x39')]({},_0x5a39f0,_0x5d4a1e['options']);return _0x506b62['getConfigurations'](_0x5a39f0);}})[_0x1f2c('0x24')](function(_0x47fdea){if(_0x47fdea){_0x9f76bf=_0x47fdea[_0x1f2c('0x34')];if(!_0x5d4a1e[_0x1f2c('0x2e')][_0x1f2c('0x4a')]('nolimit')){_0x5a39f0[_0x1f2c('0x1e')]=qs[_0x1f2c('0x1e')](_0x5d4a1e[_0x1f2c('0x2e')][_0x1f2c('0x1e')]);_0x5a39f0['offset']=qs[_0x1f2c('0x1c')](_0x5d4a1e['query']['offset']);}return _0x506b62[_0x1f2c('0x47')](_0x5a39f0);}})['then'](function(_0x1ed858){if(_0x1ed858){return _0x1ed858?{'count':_0x9f76bf,'rows':_0x1ed858}:null;}})[_0x1f2c('0x24')](respondWithResult(_0x3bceaf,null))[_0x1f2c('0x41')](handleError(_0x3bceaf,null));};exports[_0x1f2c('0x4b')]=function(_0x43c232,_0x964bb3,_0x46bb3c){if(_0x43c232[_0x1f2c('0x46')]['id']){delete _0x43c232[_0x1f2c('0x46')]['id'];}return db[_0x1f2c('0x3d')][_0x1f2c('0x48')]({'where':{'id':_0x43c232[_0x1f2c('0x42')]['id']}})[_0x1f2c('0x24')](handleEntityNotFound(_0x964bb3,null))[_0x1f2c('0x24')](function(_0x3118ef){if(_0x3118ef){_0x43c232[_0x1f2c('0x46')][_0x1f2c('0x4c')]=_0x3118ef['id'];_0x43c232['body']['Subjects']=integrations[_0x1f2c('0x4d')](_0x43c232['body']['channel'],_0x43c232['body']['type']);_0x43c232[_0x1f2c('0x46')][_0x1f2c('0x4e')]=integrations[_0x1f2c('0x4f')](_0x43c232['body'][_0x1f2c('0x50')],_0x43c232[_0x1f2c('0x46')][_0x1f2c('0x2c')]);return db[_0x1f2c('0x49')][_0x1f2c('0x45')](_0x43c232['body'],{'include':[{'model':db[_0x1f2c('0x51')],'as':_0x1f2c('0x52')},{'model':db[_0x1f2c('0x51')],'as':_0x1f2c('0x4e')}]});}return null;})[_0x1f2c('0x24')](respondWithResult(_0x964bb3,null))[_0x1f2c('0x41')](handleError(_0x964bb3,null));};exports['getFields']=function(_0x583b65,_0x72adef,_0x236f52){var _0x10e5ff=[{'name':_0x1f2c('0x53'),'label':_0x1f2c('0x53'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x29386b='';return db['DeskAccount'][_0x1f2c('0x48')]({'where':{'id':_0x583b65[_0x1f2c('0x42')]['id']},'attributes':['id',_0x1f2c('0x54'),_0x1f2c('0x55'),_0x1f2c('0x56'),'password',_0x1f2c('0x57'),_0x1f2c('0x58'),_0x1f2c('0x59'),_0x1f2c('0x5a')]})['then'](handleEntityNotFound(_0x72adef,null))[_0x1f2c('0x24')](function(_0x41eda2){if(_0x41eda2){_0x29386b=_0x41eda2[_0x1f2c('0x54')];var _0x4e12ec=_0x29386b[_0x1f2c('0x5b')](-0x1);if(_0x4e12ec==='/'){_0x29386b=_0x29386b[_0x1f2c('0x5c')](0x0,_0x29386b['lastIndexOf'](_0x4e12ec));}var _0x45a9d7={'method':_0x1f2c('0x5d'),'uri':util['format'](_0x1f2c('0x5e'),_0x29386b),'headers':{'Content-Type':_0x1f2c('0x5f'),'Accept':_0x1f2c('0x5f')},'json':!![]};if(_0x41eda2[_0x1f2c('0x55')]===_0x1f2c('0x60')){_0x45a9d7['headers'][_0x1f2c('0x61')]=util[_0x1f2c('0x62')]('Basic\x20%s',new Buffer(util['format'](_0x1f2c('0x63'),_0x41eda2['username'],_0x41eda2['password']))[_0x1f2c('0x64')](_0x1f2c('0x65')));}return rp(_0x45a9d7)[_0x1f2c('0x24')](function(_0x5b9075){return _0x10e5ff[_0x1f2c('0x66')](_['map'](_0x5b9075['_embedded'][_0x1f2c('0x67')],function(_0x55fc94){return{'id':_0x55fc94[_0x1f2c('0x26')],'name':_0x55fc94['name'],'type':_0x55fc94[_0x1f2c('0x2c')],'active':_0x55fc94['active'],'label':_0x55fc94[_0x1f2c('0x68')],'custom':!![]};}));});}})[_0x1f2c('0x24')](function(_0x3a231e){return{'count':_0x3a231e[_0x1f2c('0x34')],'rows':_0x3a231e};})[_0x1f2c('0x24')](respondWithResult(_0x72adef,null))[_0x1f2c('0x41')](function(_0x1bdcad){var _0x7d5700=_0x583b65[_0x1f2c('0x2e')][_0x1f2c('0x69')]?0x1f4:_0x1bdcad['statusCode']||0x1f4;logger['error'](_0x1f2c('0x6a'),_0x1f2c('0x6b'),_0x7d5700,JSON[_0x1f2c('0x6c')](_0x1bdcad));delete _0x1bdcad['name'];if(_0x7d5700===0x191){_0x7d5700=0x190;}_0x72adef[_0x1f2c('0x1a')](_0x7d5700)[_0x1f2c('0x27')](_0x583b65[_0x1f2c('0x2e')][_0x1f2c('0x69')]?{'message':_0x1f2c('0x6d'),'statusCode':_0x1bdcad[_0x1f2c('0x6e')]}:_0x1bdcad);});}; \ No newline at end of file +var _0x831b=['sort','pick','VIRTUAL','filter','merge','options','where','count','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','destroy','getConfigurations','DeskConfiguration','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','toString','base64','concat','_embedded','active','test','statusCode','stringify','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','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/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','then','error','stack','name','index','map','DeskAccount','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x5737d1,_0x41d434){var _0x25f470=function(_0x3efa96){while(--_0x3efa96){_0x5737d1['push'](_0x5737d1['shift']());}};_0x25f470(++_0x41d434);}(_0x831b,0x128));var _0xb831=function(_0x10dd79,_0x2cd1d0){_0x10dd79=_0x10dd79-0x0;var _0x4e8dfa=_0x831b[_0x10dd79];return _0x4e8dfa;};'use strict';var emlformat=require(_0xb831('0x0'));var rimraf=require(_0xb831('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb831('0x2'));var rp=require(_0xb831('0x3'));var moment=require(_0xb831('0x4'));var BPromise=require(_0xb831('0x5'));var Mustache=require(_0xb831('0x6'));var util=require(_0xb831('0x7'));var path=require(_0xb831('0x8'));var sox=require('sox');var csv=require(_0xb831('0x9'));var ejs=require(_0xb831('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb831('0xb'));var squel=require(_0xb831('0xc'));var crypto=require('crypto');var jsforce=require(_0xb831('0xd'));var deskjs=require(_0xb831('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb831('0xf'));var Papa=require('papaparse');var Redis=require(_0xb831('0x10'));var authService=require(_0xb831('0x11'));var qs=require(_0xb831('0x12'));var as=require(_0xb831('0x13'));var hardwareService=require(_0xb831('0x14'));var logger=require(_0xb831('0x15'))(_0xb831('0x16'));var utils=require(_0xb831('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb831('0x18'));var db=require(_0xb831('0x19'))['db'];var integrations=require(_0xb831('0x1a'));function respondWithStatusCode(_0x2a2b22,_0x3aca54){_0x3aca54=_0x3aca54||0xcc;return function(_0x4cd8ee){if(_0x4cd8ee){return _0x2a2b22[_0xb831('0x1b')](_0x3aca54);}return _0x2a2b22[_0xb831('0x1c')](_0x3aca54)[_0xb831('0x1d')]();};}function respondWithResult(_0x5241f3,_0x73a1a2){_0x73a1a2=_0x73a1a2||0xc8;return function(_0x1b4dee){if(_0x1b4dee){return _0x5241f3[_0xb831('0x1c')](_0x73a1a2)[_0xb831('0x1e')](_0x1b4dee);}};}function respondWithFilteredResult(_0x2599d5,_0x5352e0){return function(_0x3347af){if(_0x3347af){var _0x50e1d7=typeof _0x5352e0[_0xb831('0x1f')]==='undefined'&&typeof _0x5352e0['limit']===_0xb831('0x20');var _0x58d747=_0x3347af['count'];var _0x4eaca5=_0x50e1d7?0x0:_0x5352e0[_0xb831('0x1f')];var _0x31e483=_0x50e1d7?_0x3347af['count']:_0x5352e0[_0xb831('0x1f')]+_0x5352e0[_0xb831('0x21')];var _0x397996;if(_0x31e483>=_0x58d747){_0x31e483=_0x58d747;_0x397996=0xc8;}else{_0x397996=0xce;}_0x2599d5[_0xb831('0x1c')](_0x397996);return _0x2599d5[_0xb831('0x22')]('Content-Range',_0x4eaca5+'-'+_0x31e483+'/'+_0x58d747)['json'](_0x3347af);}return null;};}function patchUpdates(_0x4bcce6){return function(_0x3e9474){try{jsonpatch[_0xb831('0x23')](_0x3e9474,_0x4bcce6,!![]);}catch(_0x3af3c5){return BPromise[_0xb831('0x24')](_0x3af3c5);}return _0x3e9474[_0xb831('0x25')]();};}function saveUpdates(_0x16771e,_0x1cfd9e){return function(_0x527cea){if(_0x527cea){return _0x527cea['update'](_0x16771e)['then'](function(_0x12ec10){return _0x12ec10;});}return null;};}function removeEntity(_0xd5e514,_0x145c9f){return function(_0x35cfac){if(_0x35cfac){return _0x35cfac['destroy']()[_0xb831('0x26')](function(){_0xd5e514['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b23b7,_0x465de5){return function(_0x4039df){if(!_0x4039df){_0x5b23b7[_0xb831('0x1b')](0x194);}return _0x4039df;};}function handleError(_0x4ac68a,_0xb60fd3){_0xb60fd3=_0xb60fd3||0x1f4;return function(_0x19b7f6){logger[_0xb831('0x27')](_0x19b7f6[_0xb831('0x28')]);if(_0x19b7f6[_0xb831('0x29')]){delete _0x19b7f6[_0xb831('0x29')];}_0x4ac68a[_0xb831('0x1c')](_0xb60fd3)['send'](_0x19b7f6);};}exports[_0xb831('0x2a')]=function(_0x3a3a9a,_0x2e56ab){var _0xc46704={},_0x45e53c={},_0x122a55={'count':0x0,'rows':[]};var _0x20b00b=_[_0xb831('0x2b')](db[_0xb831('0x2c')][_0xb831('0x2d')],function(_0x1950f9){return{'name':_0x1950f9[_0xb831('0x2e')],'type':_0x1950f9[_0xb831('0x2f')]['key']};});_0x45e53c[_0xb831('0x30')]=_[_0xb831('0x2b')](_0x20b00b,_0xb831('0x29'));_0x45e53c['query']=_['keys'](_0x3a3a9a[_0xb831('0x31')]);_0x45e53c[_0xb831('0x32')]=_[_0xb831('0x33')](_0x45e53c['model'],_0x45e53c[_0xb831('0x31')]);_0xc46704['attributes']=_[_0xb831('0x33')](_0x45e53c[_0xb831('0x30')],qs[_0xb831('0x34')](_0x3a3a9a[_0xb831('0x31')][_0xb831('0x34')]));_0xc46704[_0xb831('0x35')]=_0xc46704[_0xb831('0x35')][_0xb831('0x36')]?_0xc46704['attributes']:_0x45e53c[_0xb831('0x30')];if(!_0x3a3a9a[_0xb831('0x31')][_0xb831('0x37')](_0xb831('0x38'))){_0xc46704[_0xb831('0x21')]=qs[_0xb831('0x21')](_0x3a3a9a[_0xb831('0x31')][_0xb831('0x21')]);_0xc46704['offset']=qs[_0xb831('0x1f')](_0x3a3a9a[_0xb831('0x31')][_0xb831('0x1f')]);}_0xc46704[_0xb831('0x39')]=qs[_0xb831('0x3a')](_0x3a3a9a[_0xb831('0x31')][_0xb831('0x3a')]);_0xc46704['where']=qs[_0xb831('0x32')](_[_0xb831('0x3b')](_0x3a3a9a[_0xb831('0x31')],_0x45e53c[_0xb831('0x32')]),_0x20b00b);if(_0x3a3a9a[_0xb831('0x31')]['filter']){_0xc46704['where']=_['merge'](_0xc46704['where'],{'$or':_[_0xb831('0x2b')](_0x20b00b,function(_0x1a19b1){if(_0x1a19b1[_0xb831('0x2f')]!==_0xb831('0x3c')){var _0x4c517e={};_0x4c517e[_0x1a19b1['name']]={'$like':'%'+_0x3a3a9a[_0xb831('0x31')][_0xb831('0x3d')]+'%'};return _0x4c517e;}})});}_0xc46704=_[_0xb831('0x3e')]({},_0xc46704,_0x3a3a9a[_0xb831('0x3f')]);var _0x3ca600={'where':_0xc46704[_0xb831('0x40')]};return db[_0xb831('0x2c')][_0xb831('0x41')](_0x3ca600)[_0xb831('0x26')](function(_0x5c4aa5){_0x122a55['count']=_0x5c4aa5;if(_0x3a3a9a['query'][_0xb831('0x42')]){_0xc46704['include']=[{'all':!![]}];}return db[_0xb831('0x2c')][_0xb831('0x43')](_0xc46704);})['then'](function(_0x3627d6){_0x122a55[_0xb831('0x44')]=_0x3627d6;return _0x122a55;})['then'](respondWithFilteredResult(_0x2e56ab,_0xc46704))[_0xb831('0x45')](handleError(_0x2e56ab,null));};exports[_0xb831('0x46')]=function(_0x427666,_0x1cfb89){var _0x349f3d={'raw':![],'where':{'id':_0x427666[_0xb831('0x47')]['id']}},_0x1eb250={};_0x1eb250[_0xb831('0x30')]=_['keys'](db['DeskAccount']['rawAttributes']);_0x1eb250['query']=_[_0xb831('0x48')](_0x427666[_0xb831('0x31')]);_0x1eb250[_0xb831('0x32')]=_[_0xb831('0x33')](_0x1eb250[_0xb831('0x30')],_0x1eb250[_0xb831('0x31')]);_0x349f3d[_0xb831('0x35')]=_['intersection'](_0x1eb250['model'],qs[_0xb831('0x34')](_0x427666[_0xb831('0x31')][_0xb831('0x34')]));_0x349f3d[_0xb831('0x35')]=_0x349f3d['attributes'][_0xb831('0x36')]?_0x349f3d['attributes']:_0x1eb250[_0xb831('0x30')];if(_0x427666['query']['includeAll']){_0x349f3d[_0xb831('0x49')]=[{'all':!![]}];}_0x349f3d=_[_0xb831('0x3e')]({},_0x349f3d,_0x427666[_0xb831('0x3f')]);return db[_0xb831('0x2c')][_0xb831('0x4a')](_0x349f3d)[_0xb831('0x26')](handleEntityNotFound(_0x1cfb89,null))[_0xb831('0x26')](respondWithResult(_0x1cfb89,null))[_0xb831('0x45')](handleError(_0x1cfb89,null));};exports[_0xb831('0x4b')]=function(_0x4016c7,_0x312d40){return db['DeskAccount'][_0xb831('0x4b')](_0x4016c7['body'],{})['then'](respondWithResult(_0x312d40,0xc9))['catch'](handleError(_0x312d40,null));};exports['update']=function(_0x2ee398,_0x50a1d4){if(_0x2ee398[_0xb831('0x4c')]['id']){delete _0x2ee398['body']['id'];}return db[_0xb831('0x2c')][_0xb831('0x4a')]({'where':{'id':_0x2ee398['params']['id']}})[_0xb831('0x26')](handleEntityNotFound(_0x50a1d4,null))[_0xb831('0x26')](saveUpdates(_0x2ee398['body'],null))['then'](respondWithResult(_0x50a1d4,null))[_0xb831('0x45')](handleError(_0x50a1d4,null));};exports[_0xb831('0x4d')]=function(_0x2f69c1,_0x44b4a0){return db['DeskAccount']['find']({'where':{'id':_0x2f69c1['params']['id']}})['then'](handleEntityNotFound(_0x44b4a0,null))[_0xb831('0x26')](removeEntity(_0x44b4a0,null))[_0xb831('0x45')](handleError(_0x44b4a0,null));};exports[_0xb831('0x4e')]=function(_0x397cff,_0x16221d,_0x4b2741){var _0x82da9c={};var _0x137438={};var _0x294246;var _0x53c97d;return db[_0xb831('0x2c')]['findOne']({'where':{'id':_0x397cff[_0xb831('0x47')]['id']}})[_0xb831('0x26')](handleEntityNotFound(_0x16221d,null))[_0xb831('0x26')](function(_0x45b864){if(_0x45b864){_0x294246=_0x45b864;_0x137438['model']=_['keys'](db[_0xb831('0x4f')][_0xb831('0x2d')]);_0x137438[_0xb831('0x31')]=_[_0xb831('0x48')](_0x397cff[_0xb831('0x31')]);_0x137438[_0xb831('0x32')]=_[_0xb831('0x33')](_0x137438[_0xb831('0x30')],_0x137438['query']);_0x82da9c[_0xb831('0x35')]=_[_0xb831('0x33')](_0x137438[_0xb831('0x30')],qs[_0xb831('0x34')](_0x397cff[_0xb831('0x31')][_0xb831('0x34')]));_0x82da9c['attributes']=_0x82da9c[_0xb831('0x35')][_0xb831('0x36')]?_0x82da9c['attributes']:_0x137438[_0xb831('0x30')];_0x82da9c[_0xb831('0x39')]=qs[_0xb831('0x3a')](_0x397cff['query'][_0xb831('0x3a')]);_0x82da9c['where']=qs[_0xb831('0x32')](_[_0xb831('0x3b')](_0x397cff[_0xb831('0x31')],_0x137438['filters']));if(_0x397cff[_0xb831('0x31')]['filter']){_0x82da9c['where']=_['merge'](_0x82da9c[_0xb831('0x40')],{'$or':_['map'](_0x82da9c['attributes'],function(_0x2e74bc){var _0x4afb7d={};_0x4afb7d[_0x2e74bc]={'$like':'%'+_0x397cff[_0xb831('0x31')][_0xb831('0x3d')]+'%'};return _0x4afb7d;})});}_0x82da9c=_[_0xb831('0x3e')]({},_0x82da9c,_0x397cff[_0xb831('0x3f')]);return _0x294246[_0xb831('0x4e')](_0x82da9c);}})[_0xb831('0x26')](function(_0x5e9018){if(_0x5e9018){_0x53c97d=_0x5e9018[_0xb831('0x36')];if(!_0x397cff['query'][_0xb831('0x37')](_0xb831('0x38'))){_0x82da9c['limit']=qs[_0xb831('0x21')](_0x397cff['query'][_0xb831('0x21')]);_0x82da9c[_0xb831('0x1f')]=qs[_0xb831('0x1f')](_0x397cff['query'][_0xb831('0x1f')]);}return _0x294246[_0xb831('0x4e')](_0x82da9c);}})[_0xb831('0x26')](function(_0x3e0f00){if(_0x3e0f00){return _0x3e0f00?{'count':_0x53c97d,'rows':_0x3e0f00}:null;}})[_0xb831('0x26')](respondWithResult(_0x16221d,null))[_0xb831('0x45')](handleError(_0x16221d,null));};exports[_0xb831('0x50')]=function(_0x109073,_0x4be766,_0x3e1327){if(_0x109073[_0xb831('0x4c')]['id']){delete _0x109073['body']['id'];}return db[_0xb831('0x2c')][_0xb831('0x51')]({'where':{'id':_0x109073[_0xb831('0x47')]['id']}})[_0xb831('0x26')](handleEntityNotFound(_0x4be766,null))[_0xb831('0x26')](function(_0x260189){if(_0x260189){_0x109073[_0xb831('0x4c')]['AccountId']=_0x260189['id'];_0x109073[_0xb831('0x4c')][_0xb831('0x52')]=integrations[_0xb831('0x53')](_0x109073['body'][_0xb831('0x54')],_0x109073[_0xb831('0x4c')]['type']);_0x109073[_0xb831('0x4c')][_0xb831('0x55')]=integrations[_0xb831('0x56')](_0x109073[_0xb831('0x4c')][_0xb831('0x54')],_0x109073[_0xb831('0x4c')][_0xb831('0x2f')]);return db['DeskConfiguration']['create'](_0x109073[_0xb831('0x4c')],{'include':[{'model':db[_0xb831('0x57')],'as':'Subjects'},{'model':db[_0xb831('0x57')],'as':_0xb831('0x55')}]});}return null;})['then'](respondWithResult(_0x4be766,null))[_0xb831('0x45')](handleError(_0x4be766,null));};exports[_0xb831('0x58')]=function(_0x5265b2,_0x422570,_0x301c1c){var _0x2b39ee=[{'name':_0xb831('0x59'),'label':_0xb831('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 _0x12d733='';return db[_0xb831('0x2c')][_0xb831('0x51')]({'where':{'id':_0x5265b2['params']['id']},'attributes':['id',_0xb831('0x5a'),_0xb831('0x5b'),_0xb831('0x5c'),_0xb831('0x5d'),_0xb831('0x5e'),_0xb831('0x5f'),_0xb831('0x60'),_0xb831('0x61')]})['then'](handleEntityNotFound(_0x422570,null))[_0xb831('0x26')](function(_0x3ed8ac){if(_0x3ed8ac){_0x12d733=_0x3ed8ac[_0xb831('0x5a')];var _0x56ef03=_0x12d733['slice'](-0x1);if(_0x56ef03==='/'){_0x12d733=_0x12d733[_0xb831('0x62')](0x0,_0x12d733[_0xb831('0x63')](_0x56ef03));}var _0x1e0d7c={'method':_0xb831('0x64'),'uri':util[_0xb831('0x65')](_0xb831('0x66'),_0x12d733),'headers':{'Content-Type':_0xb831('0x67'),'Accept':_0xb831('0x67')},'json':!![]};if(_0x3ed8ac[_0xb831('0x5b')]===_0xb831('0x68')){_0x1e0d7c[_0xb831('0x69')][_0xb831('0x6a')]=util[_0xb831('0x65')](_0xb831('0x6b'),new Buffer(util[_0xb831('0x65')]('%s:%s',_0x3ed8ac[_0xb831('0x5c')],_0x3ed8ac[_0xb831('0x5d')]))[_0xb831('0x6c')](_0xb831('0x6d')));}return rp(_0x1e0d7c)[_0xb831('0x26')](function(_0x1cb455){return _0x2b39ee[_0xb831('0x6e')](_[_0xb831('0x2b')](_0x1cb455[_0xb831('0x6f')]['entries'],function(_0x3e7b5b){return{'id':_0x3e7b5b[_0xb831('0x29')],'name':_0x3e7b5b[_0xb831('0x29')],'type':_0x3e7b5b[_0xb831('0x2f')],'active':_0x3e7b5b[_0xb831('0x70')],'label':_0x3e7b5b['label'],'custom':!![]};}));});}})[_0xb831('0x26')](function(_0x235c6e){return{'count':_0x235c6e[_0xb831('0x36')],'rows':_0x235c6e};})[_0xb831('0x26')](respondWithResult(_0x422570,null))[_0xb831('0x45')](function(_0x413dfb){var _0x56b60e=_0x5265b2[_0xb831('0x31')][_0xb831('0x71')]?0x1f4:_0x413dfb[_0xb831('0x72')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xb831('0x58'),_0x56b60e,JSON[_0xb831('0x73')](_0x413dfb));delete _0x413dfb[_0xb831('0x29')];if(_0x56b60e===0x191){_0x56b60e=0x190;}_0x422570[_0xb831('0x1c')](_0x56b60e)[_0xb831('0x74')](_0x5265b2[_0xb831('0x31')][_0xb831('0x71')]?{'message':_0xb831('0x75'),'statusCode':_0x413dfb[_0xb831('0x72')]}:_0x413dfb);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 84bb2da..40cf6a1 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 _0x2b1c=['moment','request-promise','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api'];(function(_0x4bd4b0,_0xa4659a){var _0x2b4538=function(_0x4732a5){while(--_0x4732a5){_0x4bd4b0['push'](_0x4bd4b0['shift']());}};_0x2b4538(++_0xa4659a);}(_0x2b1c,0xf3));var _0xc2b1=function(_0x33d704,_0x4246d4){_0x33d704=_0x33d704-0x0;var _0x9e3e92=_0x2b1c[_0x33d704];return _0x9e3e92;};'use strict';var _=require(_0xc2b1('0x0'));var util=require(_0xc2b1('0x1'));var logger=require(_0xc2b1('0x2'))(_0xc2b1('0x3'));var moment=require(_0xc2b1('0x4'));var BPromise=require('bluebird');var rp=require(_0xc2b1('0x5'));var fs=require('fs');var path=require(_0xc2b1('0x6'));var rimraf=require('rimraf');var config=require(_0xc2b1('0x7'));var attributes=require(_0xc2b1('0x8'));var integrations=require(_0xc2b1('0x9'));module[_0xc2b1('0xa')]=function(_0x10ebac,_0x59c480){return _0x10ebac['define'](_0xc2b1('0xb'),attributes,{'tableName':_0xc2b1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1d3=['DeskAccount','int_desk_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xd1d3,0xec));var _0x3d1d=function(_0x399925,_0x581887){_0x399925=_0x399925-0x0;var _0x31a04e=_0xd1d3[_0x399925];return _0x31a04e;};'use strict';var _=require(_0x3d1d('0x0'));var util=require('util');var logger=require(_0x3d1d('0x1'))(_0x3d1d('0x2'));var moment=require('moment');var BPromise=require(_0x3d1d('0x3'));var rp=require(_0x3d1d('0x4'));var fs=require('fs');var path=require(_0x3d1d('0x5'));var rimraf=require(_0x3d1d('0x6'));var config=require(_0x3d1d('0x7'));var attributes=require(_0x3d1d('0x8'));var integrations=require(_0x3d1d('0x9'));module[_0x3d1d('0xa')]=function(_0x274f0,_0x5c0b5f){return _0x274f0['define'](_0x3d1d('0xb'),attributes,{'tableName':_0x3d1d('0xc'),'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 88faecf..0e1ff37 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 _0xad05=['map','model','then','catch','ShowDeskAccount','DeskAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskAccount,\x20%s,\x20%s','result','GetDeskAccount','findAll','options','where','attributes','limit','include'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xad05,0x194));var _0x5ad0=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xad05[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x5ad0('0x0'));var util=require(_0x5ad0('0x1'));var moment=require(_0x5ad0('0x2'));var BPromise=require(_0x5ad0('0x3'));var rs=require(_0x5ad0('0x4'));var fs=require('fs');var Redis=require(_0x5ad0('0x5'));var db=require(_0x5ad0('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5ad0('0x7'));var config=require(_0x5ad0('0x8'));var jayson=require(_0x5ad0('0x9'));var client=jayson[_0x5ad0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fab07,_0xbdb350,_0xb8850){return new BPromise(function(_0x57f6aa,_0x1a40a2){return client['request'](_0x3fab07,_0xb8850)['then'](function(_0x4c49f1){logger[_0x5ad0('0xb')]('DeskAccount,\x20%s,\x20%s',_0xbdb350,_0x5ad0('0xc'));logger[_0x5ad0('0xd')](_0x5ad0('0xe'),_0xbdb350,_0x5ad0('0xc'),JSON[_0x5ad0('0xf')](_0x4c49f1));if(_0x4c49f1[_0x5ad0('0x10')]){if(_0x4c49f1[_0x5ad0('0x10')][_0x5ad0('0x11')]===0x1f4){logger[_0x5ad0('0x10')]('DeskAccount,\x20%s,\x20%s',_0xbdb350,_0x4c49f1[_0x5ad0('0x10')][_0x5ad0('0x12')]);return _0x1a40a2(_0x4c49f1['error']['message']);}logger[_0x5ad0('0x10')](_0x5ad0('0x13'),_0xbdb350,_0x4c49f1[_0x5ad0('0x10')][_0x5ad0('0x12')]);return _0x57f6aa(_0x4c49f1[_0x5ad0('0x10')][_0x5ad0('0x12')]);}else{logger['info'](_0x5ad0('0x13'),_0xbdb350,'request\x20sent');_0x57f6aa(_0x4c49f1[_0x5ad0('0x14')][_0x5ad0('0x12')]);}})['catch'](function(_0x2cb809){logger['error'](_0x5ad0('0x13'),_0xbdb350,_0x2cb809);_0x1a40a2(_0x2cb809);});});}exports[_0x5ad0('0x15')]=function(_0x338865){var _0x381514=this;return new Promise(function(_0x71f9bf,_0x549193){return db['DeskAccount'][_0x5ad0('0x16')]({'raw':_0x338865['options']?_0x338865['options']['raw']===undefined?!![]:![]:!![],'where':_0x338865[_0x5ad0('0x17')]?_0x338865[_0x5ad0('0x17')][_0x5ad0('0x18')]||null:null,'attributes':_0x338865['options']?_0x338865[_0x5ad0('0x17')][_0x5ad0('0x19')]||null:null,'limit':_0x338865[_0x5ad0('0x17')]?_0x338865[_0x5ad0('0x17')][_0x5ad0('0x1a')]||null:null,'include':_0x338865[_0x5ad0('0x17')]?_0x338865[_0x5ad0('0x17')][_0x5ad0('0x1b')]?_[_0x5ad0('0x1c')](_0x338865[_0x5ad0('0x17')][_0x5ad0('0x1b')],function(_0x4efb76){return{'model':db[_0x4efb76[_0x5ad0('0x1d')]],'as':_0x4efb76['as'],'attributes':_0x4efb76[_0x5ad0('0x19')],'include':_0x4efb76['include']?_[_0x5ad0('0x1c')](_0x4efb76[_0x5ad0('0x1b')],function(_0x4a62d9){return{'model':db[_0x4a62d9['model']],'as':_0x4a62d9['as'],'attributes':_0x4a62d9[_0x5ad0('0x19')],'include':_0x4a62d9[_0x5ad0('0x1b')]?_[_0x5ad0('0x1c')](_0x4a62d9['include'],function(_0x50fa05){return{'model':db[_0x50fa05[_0x5ad0('0x1d')]],'as':_0x50fa05['as'],'attributes':_0x50fa05['attributes']};}):[]};}):[]};}):[]:[]})[_0x5ad0('0x1e')](function(_0x540fb3){logger[_0x5ad0('0xb')](_0x5ad0('0x15'),_0x338865);logger[_0x5ad0('0xd')]('GetDeskAccount',_0x338865,JSON[_0x5ad0('0xf')](_0x540fb3));_0x71f9bf(_0x540fb3);})[_0x5ad0('0x1f')](function(_0x37bc7e){logger['error'](_0x5ad0('0x15'),_0x37bc7e['message'],_0x338865);_0x549193(_0x381514['error'](0x1f4,_0x37bc7e[_0x5ad0('0x12')]));});});};exports[_0x5ad0('0x20')]=function(_0x158193){var _0x2daf63=this;return new Promise(function(_0x19f283,_0x21ef8c){return db[_0x5ad0('0x21')][_0x5ad0('0x22')]({'raw':_0x158193[_0x5ad0('0x17')]?_0x158193[_0x5ad0('0x17')][_0x5ad0('0x23')]===undefined?!![]:![]:!![],'where':_0x158193[_0x5ad0('0x17')]?_0x158193['options'][_0x5ad0('0x18')]||null:null,'attributes':_0x158193[_0x5ad0('0x17')]?_0x158193[_0x5ad0('0x17')][_0x5ad0('0x19')]||null:null,'include':_0x158193[_0x5ad0('0x17')]?_0x158193[_0x5ad0('0x17')][_0x5ad0('0x1b')]?_[_0x5ad0('0x1c')](_0x158193[_0x5ad0('0x17')][_0x5ad0('0x1b')],function(_0x3d9996){return{'model':db[_0x3d9996[_0x5ad0('0x1d')]],'as':_0x3d9996['as'],'attributes':_0x3d9996['attributes'],'include':_0x3d9996['include']?_['map'](_0x3d9996[_0x5ad0('0x1b')],function(_0xccdf3){return{'model':db[_0xccdf3[_0x5ad0('0x1d')]],'as':_0xccdf3['as'],'attributes':_0xccdf3[_0x5ad0('0x19')],'include':_0xccdf3[_0x5ad0('0x1b')]?_[_0x5ad0('0x1c')](_0xccdf3[_0x5ad0('0x1b')],function(_0x31235b){return{'model':db[_0x31235b[_0x5ad0('0x1d')]],'as':_0x31235b['as'],'attributes':_0x31235b['attributes']};}):[]};}):[]};}):[]:[]})[_0x5ad0('0x1e')](function(_0x2116ef){logger['info'](_0x5ad0('0x20'),_0x158193);logger[_0x5ad0('0xd')]('ShowDeskAccount',_0x158193,JSON[_0x5ad0('0xf')](_0x2116ef));_0x19f283(_0x2116ef);})[_0x5ad0('0x1f')](function(_0x1cc855){logger[_0x5ad0('0x10')](_0x5ad0('0x20'),_0x1cc855[_0x5ad0('0x12')],_0x158193);_0x21ef8c(_0x2daf63[_0x5ad0('0x10')](0x1f4,_0x1cc855[_0x5ad0('0x12')]));});});}; \ No newline at end of file +var _0x200e=['request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','catch','find','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','DeskAccount,\x20%s,\x20%s'];(function(_0x2e7aa8,_0x2c6c40){var _0x13ec84=function(_0x30d511){while(--_0x30d511){_0x2e7aa8['push'](_0x2e7aa8['shift']());}};_0x13ec84(++_0x2c6c40);}(_0x200e,0xee));var _0xe200=function(_0x30674b,_0x271742){_0x30674b=_0x30674b-0x0;var _0x5e2ddd=_0x200e[_0x30674b];return _0x5e2ddd;};'use strict';var _=require(_0xe200('0x0'));var util=require(_0xe200('0x1'));var moment=require(_0xe200('0x2'));var BPromise=require(_0xe200('0x3'));var rs=require(_0xe200('0x4'));var fs=require('fs');var Redis=require(_0xe200('0x5'));var db=require(_0xe200('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe200('0x7'));var config=require(_0xe200('0x8'));var jayson=require(_0xe200('0x9'));var client=jayson['client'][_0xe200('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46e692,_0xf77eca,_0x525339){return new BPromise(function(_0x302a25,_0x49fb39){return client['request'](_0x46e692,_0x525339)[_0xe200('0xb')](function(_0x4ff405){logger[_0xe200('0xc')](_0xe200('0xd'),_0xf77eca,_0xe200('0xe'));logger[_0xe200('0xf')](_0xe200('0x10'),_0xf77eca,'request\x20sent',JSON[_0xe200('0x11')](_0x4ff405));if(_0x4ff405['error']){if(_0x4ff405[_0xe200('0x12')][_0xe200('0x13')]===0x1f4){logger[_0xe200('0x12')]('DeskAccount,\x20%s,\x20%s',_0xf77eca,_0x4ff405[_0xe200('0x12')][_0xe200('0x14')]);return _0x49fb39(_0x4ff405[_0xe200('0x12')][_0xe200('0x14')]);}logger[_0xe200('0x12')]('DeskAccount,\x20%s,\x20%s',_0xf77eca,_0x4ff405['error'][_0xe200('0x14')]);return _0x302a25(_0x4ff405['error'][_0xe200('0x14')]);}else{logger[_0xe200('0xc')](_0xe200('0xd'),_0xf77eca,_0xe200('0xe'));_0x302a25(_0x4ff405[_0xe200('0x15')][_0xe200('0x14')]);}})['catch'](function(_0x5f0cc0){logger[_0xe200('0x12')](_0xe200('0xd'),_0xf77eca,_0x5f0cc0);_0x49fb39(_0x5f0cc0);});});}exports[_0xe200('0x16')]=function(_0x300461){var _0x182fce=this;return new Promise(function(_0x166f9c,_0x16a7ed){return db[_0xe200('0x17')][_0xe200('0x18')]({'raw':_0x300461[_0xe200('0x19')]?_0x300461[_0xe200('0x19')][_0xe200('0x1a')]===undefined?!![]:![]:!![],'where':_0x300461[_0xe200('0x19')]?_0x300461[_0xe200('0x19')][_0xe200('0x1b')]||null:null,'attributes':_0x300461[_0xe200('0x19')]?_0x300461[_0xe200('0x19')][_0xe200('0x1c')]||null:null,'limit':_0x300461[_0xe200('0x19')]?_0x300461[_0xe200('0x19')][_0xe200('0x1d')]||null:null,'include':_0x300461['options']?_0x300461[_0xe200('0x19')][_0xe200('0x1e')]?_['map'](_0x300461[_0xe200('0x19')]['include'],function(_0x4a451c){return{'model':db[_0x4a451c[_0xe200('0x1f')]],'as':_0x4a451c['as'],'attributes':_0x4a451c[_0xe200('0x1c')],'include':_0x4a451c[_0xe200('0x1e')]?_['map'](_0x4a451c[_0xe200('0x1e')],function(_0x45be08){return{'model':db[_0x45be08[_0xe200('0x1f')]],'as':_0x45be08['as'],'attributes':_0x45be08[_0xe200('0x1c')],'include':_0x45be08[_0xe200('0x1e')]?_[_0xe200('0x20')](_0x45be08[_0xe200('0x1e')],function(_0x10a35e){return{'model':db[_0x10a35e[_0xe200('0x1f')]],'as':_0x10a35e['as'],'attributes':_0x10a35e[_0xe200('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe200('0xb')](function(_0x21c1ad){logger[_0xe200('0xc')](_0xe200('0x16'),_0x300461);logger['debug'](_0xe200('0x16'),_0x300461,JSON[_0xe200('0x11')](_0x21c1ad));_0x166f9c(_0x21c1ad);})[_0xe200('0x21')](function(_0x31ecdf){logger[_0xe200('0x12')]('GetDeskAccount',_0x31ecdf[_0xe200('0x14')],_0x300461);_0x16a7ed(_0x182fce[_0xe200('0x12')](0x1f4,_0x31ecdf[_0xe200('0x14')]));});});};exports['ShowDeskAccount']=function(_0x1b669e){var _0x439272=this;return new Promise(function(_0x146056,_0x78109d){return db[_0xe200('0x17')][_0xe200('0x22')]({'raw':_0x1b669e[_0xe200('0x19')]?_0x1b669e['options'][_0xe200('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b669e[_0xe200('0x19')]?_0x1b669e[_0xe200('0x19')][_0xe200('0x1b')]||null:null,'attributes':_0x1b669e[_0xe200('0x19')]?_0x1b669e[_0xe200('0x19')][_0xe200('0x1c')]||null:null,'include':_0x1b669e[_0xe200('0x19')]?_0x1b669e[_0xe200('0x19')][_0xe200('0x1e')]?_[_0xe200('0x20')](_0x1b669e[_0xe200('0x19')]['include'],function(_0x2efe7e){return{'model':db[_0x2efe7e[_0xe200('0x1f')]],'as':_0x2efe7e['as'],'attributes':_0x2efe7e[_0xe200('0x1c')],'include':_0x2efe7e[_0xe200('0x1e')]?_[_0xe200('0x20')](_0x2efe7e[_0xe200('0x1e')],function(_0x3915b3){return{'model':db[_0x3915b3['model']],'as':_0x3915b3['as'],'attributes':_0x3915b3[_0xe200('0x1c')],'include':_0x3915b3[_0xe200('0x1e')]?_['map'](_0x3915b3[_0xe200('0x1e')],function(_0x3b6846){return{'model':db[_0x3b6846[_0xe200('0x1f')]],'as':_0x3b6846['as'],'attributes':_0x3b6846[_0xe200('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe200('0xb')](function(_0x4076cc){logger['info'](_0xe200('0x23'),_0x1b669e);logger[_0xe200('0xf')](_0xe200('0x23'),_0x1b669e,JSON[_0xe200('0x11')](_0x4076cc));_0x146056(_0x4076cc);})[_0xe200('0x21')](function(_0x38c8c1){logger[_0xe200('0x12')](_0xe200('0x23'),_0x38c8c1['message'],_0x1b669e);_0x78109d(_0x439272[_0xe200('0x12')](0x1f4,_0x38c8c1[_0xe200('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 118d412..3243681 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x565bca,_0x1db8e5){var _0x3cf9b6=function(_0x401fd5){while(--_0x401fd5){_0x565bca['push'](_0x565bca['shift']());}};_0x3cf9b6(++_0x1db8e5);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file +var _0x7217=['getDescriptions','/:id/tags','post','setTags','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x63cea1,_0x2648c1){var _0x18d8d3=function(_0x654746){while(--_0x654746){_0x63cea1['push'](_0x63cea1['shift']());}};_0x18d8d3(++_0x2648c1);}(_0x7217,0x19e));var _0x7721=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7217[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getTags']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['put'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index e948c68..2e41585 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 _0x64aa=['exports','STRING','sequelize'];(function(_0x235983,_0xd22673){var _0x538b67=function(_0x1f1546){while(--_0x1f1546){_0x235983['push'](_0x235983['shift']());}};_0x538b67(++_0xd22673);}(_0x64aa,0x110));var _0xa64a=function(_0x4c9f6a,_0xcb2cb2){_0x4c9f6a=_0x4c9f6a-0x0;var _0x5df5b9=_0x64aa[_0x4c9f6a];return _0x5df5b9;};'use strict';var Sequelize=require(_0xa64a('0x0'));module[_0xa64a('0x1')]={'name':{'type':Sequelize[_0xa64a('0x2')]},'description':{'type':Sequelize[_0xa64a('0x2')]}}; \ No newline at end of file +var _0x049c=['STRING','sequelize','exports'];(function(_0x4517f2,_0x4a5676){var _0x1bb772=function(_0x529f09){while(--_0x529f09){_0x4517f2['push'](_0x4517f2['shift']());}};_0x1bb772(++_0x4a5676);}(_0x049c,0xa9));var _0xc049=function(_0x127af5,_0xa3ce45){_0x127af5=_0x127af5-0x0;var _0x4cc8dc=_0x049c[_0x127af5];return _0x4cc8dc;};'use strict';var Sequelize=require(_0xc049('0x0'));module[_0xc049('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc049('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index a98f2a1..88350d4 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 _0x00e0=['save','update','then','destroy','name','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getFields','findOne','DeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x27874a,_0x8f9742){var _0x5f30de=function(_0x17ce50){while(--_0x17ce50){_0x27874a['push'](_0x27874a['shift']());}};_0x5f30de(++_0x8f9742);}(_0x00e0,0x1d5));var _0x000e=function(_0x1b2c16,_0x4b2416){_0x1b2c16=_0x1b2c16-0x0;var _0x3bcc2c=_0x00e0[_0x1b2c16];return _0x3bcc2c;};'use strict';var emlformat=require(_0x000e('0x0'));var rimraf=require(_0x000e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x000e('0x2'));var rp=require(_0x000e('0x3'));var moment=require(_0x000e('0x4'));var BPromise=require(_0x000e('0x5'));var Mustache=require(_0x000e('0x6'));var util=require(_0x000e('0x7'));var path=require(_0x000e('0x8'));var sox=require(_0x000e('0x9'));var csv=require('to-csv');var ejs=require(_0x000e('0xa'));var fs=require('fs');var fs_extra=require(_0x000e('0xb'));var _=require(_0x000e('0xc'));var squel=require(_0x000e('0xd'));var crypto=require(_0x000e('0xe'));var jsforce=require(_0x000e('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x000e('0x10'));var Redis=require(_0x000e('0x11'));var authService=require(_0x000e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x000e('0x13'));var hardwareService=require(_0x000e('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x000e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x000e('0x16'))['db'];function respondWithStatusCode(_0x49df7,_0x5d2684){_0x5d2684=_0x5d2684||0xcc;return function(_0x3e5106){if(_0x3e5106){return _0x49df7[_0x000e('0x17')](_0x5d2684);}return _0x49df7[_0x000e('0x18')](_0x5d2684)[_0x000e('0x19')]();};}function respondWithResult(_0x40418c,_0x208376){_0x208376=_0x208376||0xc8;return function(_0x40b721){if(_0x40b721){return _0x40418c[_0x000e('0x18')](_0x208376)[_0x000e('0x1a')](_0x40b721);}};}function respondWithFilteredResult(_0x19c480,_0x2fea46){return function(_0x444882){if(_0x444882){var _0x2dead2=typeof _0x2fea46[_0x000e('0x1b')]===_0x000e('0x1c')&&typeof _0x2fea46[_0x000e('0x1d')]===_0x000e('0x1c');var _0x4158a9=_0x444882[_0x000e('0x1e')];var _0x791088=_0x2dead2?0x0:_0x2fea46[_0x000e('0x1b')];var _0x4cbea9=_0x2dead2?_0x444882['count']:_0x2fea46[_0x000e('0x1b')]+_0x2fea46[_0x000e('0x1d')];var _0x83fbbf;if(_0x4cbea9>=_0x4158a9){_0x4cbea9=_0x4158a9;_0x83fbbf=0xc8;}else{_0x83fbbf=0xce;}_0x19c480[_0x000e('0x18')](_0x83fbbf);return _0x19c480[_0x000e('0x1f')](_0x000e('0x20'),_0x791088+'-'+_0x4cbea9+'/'+_0x4158a9)[_0x000e('0x1a')](_0x444882);}return null;};}function patchUpdates(_0x4cf950){return function(_0x513d32){try{jsonpatch[_0x000e('0x21')](_0x513d32,_0x4cf950,!![]);}catch(_0xc33382){return BPromise[_0x000e('0x22')](_0xc33382);}return _0x513d32[_0x000e('0x23')]();};}function saveUpdates(_0x5338dc,_0x5c1d89){return function(_0x1c5fee){if(_0x1c5fee){return _0x1c5fee[_0x000e('0x24')](_0x5338dc)[_0x000e('0x25')](function(_0xcb1693){return _0xcb1693;});}return null;};}function removeEntity(_0x289409,_0x3e4a3a){return function(_0x406133){if(_0x406133){return _0x406133[_0x000e('0x26')]()[_0x000e('0x25')](function(){_0x289409[_0x000e('0x18')](0xcc)[_0x000e('0x19')]();});}};}function handleEntityNotFound(_0x76ebf1,_0x48cb6e){return function(_0x200b66){if(!_0x200b66){_0x76ebf1[_0x000e('0x17')](0x194);}return _0x200b66;};}function handleError(_0x199550,_0x162f5e){_0x162f5e=_0x162f5e||0x1f4;return function(_0x179ce9){logger['error'](_0x179ce9['stack']);if(_0x179ce9[_0x000e('0x27')]){delete _0x179ce9['name'];}_0x199550[_0x000e('0x18')](_0x162f5e)['send'](_0x179ce9);};}exports[_0x000e('0x28')]=function(_0x52efb3,_0x18301d){var _0x426e97={},_0x2f4020={},_0x43ec7b={'count':0x0,'rows':[]};var _0x2594b=_[_0x000e('0x29')](db[_0x000e('0x2a')][_0x000e('0x2b')],function(_0x186faf){return{'name':_0x186faf[_0x000e('0x2c')],'type':_0x186faf[_0x000e('0x2d')][_0x000e('0x2e')]};});_0x2f4020[_0x000e('0x2f')]=_[_0x000e('0x29')](_0x2594b,_0x000e('0x27'));_0x2f4020[_0x000e('0x30')]=_[_0x000e('0x31')](_0x52efb3['query']);_0x2f4020[_0x000e('0x32')]=_[_0x000e('0x33')](_0x2f4020[_0x000e('0x2f')],_0x2f4020[_0x000e('0x30')]);_0x426e97[_0x000e('0x34')]=_[_0x000e('0x33')](_0x2f4020[_0x000e('0x2f')],qs[_0x000e('0x35')](_0x52efb3[_0x000e('0x30')][_0x000e('0x35')]));_0x426e97[_0x000e('0x34')]=_0x426e97['attributes'][_0x000e('0x36')]?_0x426e97[_0x000e('0x34')]:_0x2f4020['model'];if(!_0x52efb3[_0x000e('0x30')][_0x000e('0x37')](_0x000e('0x38'))){_0x426e97[_0x000e('0x1d')]=qs['limit'](_0x52efb3['query'][_0x000e('0x1d')]);_0x426e97[_0x000e('0x1b')]=qs[_0x000e('0x1b')](_0x52efb3['query']['offset']);}_0x426e97[_0x000e('0x39')]=qs[_0x000e('0x3a')](_0x52efb3['query'][_0x000e('0x3a')]);_0x426e97['where']=qs['filters'](_[_0x000e('0x3b')](_0x52efb3[_0x000e('0x30')],_0x2f4020[_0x000e('0x32')]),_0x2594b);if(_0x52efb3[_0x000e('0x30')][_0x000e('0x3c')]){_0x426e97[_0x000e('0x3d')]=_[_0x000e('0x3e')](_0x426e97[_0x000e('0x3d')],{'$or':_['map'](_0x2594b,function(_0x4cfcb7){if(_0x4cfcb7[_0x000e('0x2d')]!==_0x000e('0x3f')){var _0x50c9c6={};_0x50c9c6[_0x4cfcb7[_0x000e('0x27')]]={'$like':'%'+_0x52efb3['query'][_0x000e('0x3c')]+'%'};return _0x50c9c6;}})});}_0x426e97=_['merge']({},_0x426e97,_0x52efb3[_0x000e('0x40')]);var _0x28d22f={'where':_0x426e97[_0x000e('0x3d')]};return db[_0x000e('0x2a')][_0x000e('0x1e')](_0x28d22f)[_0x000e('0x25')](function(_0x172fdf){_0x43ec7b[_0x000e('0x1e')]=_0x172fdf;if(_0x52efb3[_0x000e('0x30')][_0x000e('0x41')]){_0x426e97[_0x000e('0x42')]=[{'all':!![]}];}return db[_0x000e('0x2a')][_0x000e('0x43')](_0x426e97);})['then'](function(_0x2b849c){_0x43ec7b[_0x000e('0x44')]=_0x2b849c;return _0x43ec7b;})['then'](respondWithFilteredResult(_0x18301d,_0x426e97))[_0x000e('0x45')](handleError(_0x18301d,null));};exports[_0x000e('0x46')]=function(_0x285a21,_0x17fcc1){var _0x4c91a7={'raw':![],'where':{'id':_0x285a21['params']['id']}},_0x33b12e={};_0x33b12e[_0x000e('0x2f')]=_[_0x000e('0x31')](db['DeskConfiguration'][_0x000e('0x2b')]);_0x33b12e['query']=_[_0x000e('0x31')](_0x285a21['query']);_0x33b12e[_0x000e('0x32')]=_[_0x000e('0x33')](_0x33b12e['model'],_0x33b12e[_0x000e('0x30')]);_0x4c91a7['attributes']=_[_0x000e('0x33')](_0x33b12e[_0x000e('0x2f')],qs['fields'](_0x285a21['query'][_0x000e('0x35')]));_0x4c91a7[_0x000e('0x34')]=_0x4c91a7['attributes']['length']?_0x4c91a7[_0x000e('0x34')]:_0x33b12e['model'];if(_0x285a21['query'][_0x000e('0x41')]){_0x4c91a7[_0x000e('0x42')]=[{'all':!![]}];}_0x4c91a7=_[_0x000e('0x3e')]({},_0x4c91a7,_0x285a21['options']);return db[_0x000e('0x2a')][_0x000e('0x47')](_0x4c91a7)[_0x000e('0x25')](handleEntityNotFound(_0x17fcc1,null))[_0x000e('0x25')](respondWithResult(_0x17fcc1,null))[_0x000e('0x45')](handleError(_0x17fcc1,null));};exports[_0x000e('0x48')]=function(_0x10803c,_0x1cabf7){return db[_0x000e('0x2a')][_0x000e('0x48')](_0x10803c[_0x000e('0x49')],{})[_0x000e('0x25')](respondWithResult(_0x1cabf7,0xc9))[_0x000e('0x45')](handleError(_0x1cabf7,null));};exports[_0x000e('0x24')]=function(_0x125408,_0x3530c1){if(_0x125408[_0x000e('0x49')]['id']){delete _0x125408[_0x000e('0x49')]['id'];}return db['DeskConfiguration'][_0x000e('0x47')]({'where':{'id':_0x125408[_0x000e('0x4a')]['id']}})[_0x000e('0x25')](handleEntityNotFound(_0x3530c1,null))[_0x000e('0x25')](saveUpdates(_0x125408[_0x000e('0x49')],null))['then'](respondWithResult(_0x3530c1,null))[_0x000e('0x45')](handleError(_0x3530c1,null));};exports[_0x000e('0x26')]=function(_0x219d0c,_0x5dd541){return db[_0x000e('0x2a')]['find']({'where':{'id':_0x219d0c['params']['id']}})[_0x000e('0x25')](handleEntityNotFound(_0x5dd541,null))[_0x000e('0x25')](removeEntity(_0x5dd541,null))[_0x000e('0x45')](handleError(_0x5dd541,null));};exports[_0x000e('0x4b')]=function(_0x398137,_0x21ac1d,_0x392965){var _0x154814={};var _0x1d8b44={};var _0x2f8a71;var _0x34f028;return db[_0x000e('0x2a')][_0x000e('0x4c')]({'where':{'id':_0x398137[_0x000e('0x4a')]['id']}})[_0x000e('0x25')](handleEntityNotFound(_0x21ac1d,null))['then'](function(_0x153e2c){if(_0x153e2c){_0x2f8a71=_0x153e2c;_0x1d8b44[_0x000e('0x2f')]=_[_0x000e('0x31')](db['DeskField'][_0x000e('0x2b')]);_0x1d8b44[_0x000e('0x30')]=_[_0x000e('0x31')](_0x398137[_0x000e('0x30')]);_0x1d8b44[_0x000e('0x32')]=_['intersection'](_0x1d8b44[_0x000e('0x2f')],_0x1d8b44['query']);_0x154814[_0x000e('0x34')]=_[_0x000e('0x33')](_0x1d8b44[_0x000e('0x2f')],qs[_0x000e('0x35')](_0x398137[_0x000e('0x30')][_0x000e('0x35')]));_0x154814['attributes']=_0x154814[_0x000e('0x34')][_0x000e('0x36')]?_0x154814[_0x000e('0x34')]:_0x1d8b44['model'];_0x154814['order']=qs[_0x000e('0x3a')](_0x398137[_0x000e('0x30')][_0x000e('0x3a')]);_0x154814['where']=qs['filters'](_[_0x000e('0x3b')](_0x398137[_0x000e('0x30')],_0x1d8b44[_0x000e('0x32')]));if(_0x398137[_0x000e('0x30')]['filter']){_0x154814[_0x000e('0x3d')]=_[_0x000e('0x3e')](_0x154814[_0x000e('0x3d')],{'$or':_[_0x000e('0x29')](_0x154814[_0x000e('0x34')],function(_0x2bbafc){var _0x15c554={};_0x15c554[_0x2bbafc]={'$like':'%'+_0x398137[_0x000e('0x30')][_0x000e('0x3c')]+'%'};return _0x15c554;})});}_0x154814=_[_0x000e('0x3e')]({},_0x154814,_0x398137[_0x000e('0x40')]);return _0x2f8a71[_0x000e('0x4b')](_0x154814);}})[_0x000e('0x25')](function(_0x149731){if(_0x149731){_0x34f028=_0x149731[_0x000e('0x36')];if(!_0x398137[_0x000e('0x30')][_0x000e('0x37')](_0x000e('0x38'))){_0x154814[_0x000e('0x1d')]=qs[_0x000e('0x1d')](_0x398137[_0x000e('0x30')]['limit']);_0x154814[_0x000e('0x1b')]=qs[_0x000e('0x1b')](_0x398137['query'][_0x000e('0x1b')]);}return _0x2f8a71[_0x000e('0x4b')](_0x154814);}})[_0x000e('0x25')](function(_0x4d5534){if(_0x4d5534){return _0x4d5534?{'count':_0x34f028,'rows':_0x4d5534}:null;}})[_0x000e('0x25')](respondWithResult(_0x21ac1d,null))[_0x000e('0x45')](handleError(_0x21ac1d,null));};exports['getSubjects']=function(_0x1efc6d,_0x517118,_0x2cbef4){var _0x89f150={};var _0x4d5234={};var _0x330850;var _0x5b770c;return db[_0x000e('0x2a')][_0x000e('0x4c')]({'where':{'id':_0x1efc6d['params']['id']}})[_0x000e('0x25')](handleEntityNotFound(_0x517118,null))['then'](function(_0x70d772){if(_0x70d772){_0x330850=_0x70d772;_0x4d5234['model']=_[_0x000e('0x31')](db[_0x000e('0x4d')][_0x000e('0x2b')]);_0x4d5234[_0x000e('0x30')]=_[_0x000e('0x31')](_0x1efc6d[_0x000e('0x30')]);_0x4d5234[_0x000e('0x32')]=_[_0x000e('0x33')](_0x4d5234[_0x000e('0x2f')],_0x4d5234['query']);_0x89f150['attributes']=_['intersection'](_0x4d5234[_0x000e('0x2f')],qs['fields'](_0x1efc6d[_0x000e('0x30')][_0x000e('0x35')]));_0x89f150[_0x000e('0x34')]=_0x89f150[_0x000e('0x34')][_0x000e('0x36')]?_0x89f150[_0x000e('0x34')]:_0x4d5234[_0x000e('0x2f')];_0x89f150['order']=qs[_0x000e('0x3a')](_0x1efc6d[_0x000e('0x30')][_0x000e('0x3a')]);_0x89f150[_0x000e('0x3d')]=qs[_0x000e('0x32')](_[_0x000e('0x3b')](_0x1efc6d[_0x000e('0x30')],_0x4d5234[_0x000e('0x32')]));if(_0x1efc6d[_0x000e('0x30')][_0x000e('0x3c')]){_0x89f150[_0x000e('0x3d')]=_[_0x000e('0x3e')](_0x89f150[_0x000e('0x3d')],{'$or':_[_0x000e('0x29')](_0x89f150[_0x000e('0x34')],function(_0x4dba44){var _0x5f185e={};_0x5f185e[_0x4dba44]={'$like':'%'+_0x1efc6d['query'][_0x000e('0x3c')]+'%'};return _0x5f185e;})});}_0x89f150=_[_0x000e('0x3e')]({},_0x89f150,_0x1efc6d[_0x000e('0x40')]);return _0x330850[_0x000e('0x4e')](_0x89f150);}})[_0x000e('0x25')](function(_0x25b32f){if(_0x25b32f){_0x5b770c=_0x25b32f[_0x000e('0x36')];if(!_0x1efc6d[_0x000e('0x30')]['hasOwnProperty'](_0x000e('0x38'))){_0x89f150[_0x000e('0x1d')]=qs[_0x000e('0x1d')](_0x1efc6d[_0x000e('0x30')][_0x000e('0x1d')]);_0x89f150[_0x000e('0x1b')]=qs['offset'](_0x1efc6d[_0x000e('0x30')]['offset']);}return _0x330850[_0x000e('0x4e')](_0x89f150);}})[_0x000e('0x25')](function(_0x46d590){if(_0x46d590){return _0x46d590?{'count':_0x5b770c,'rows':_0x46d590}:null;}})[_0x000e('0x25')](respondWithResult(_0x517118,null))['catch'](handleError(_0x517118,null));};exports['getDescriptions']=function(_0x3138fd,_0x970c1b,_0x262b80){var _0x31c730={};var _0x231082={};var _0x454a47;var _0x34f789;return db[_0x000e('0x2a')][_0x000e('0x4c')]({'where':{'id':_0x3138fd[_0x000e('0x4a')]['id']}})[_0x000e('0x25')](handleEntityNotFound(_0x970c1b,null))[_0x000e('0x25')](function(_0x3d8b35){if(_0x3d8b35){_0x454a47=_0x3d8b35;_0x231082[_0x000e('0x2f')]=_['keys'](db[_0x000e('0x4d')][_0x000e('0x2b')]);_0x231082[_0x000e('0x30')]=_['keys'](_0x3138fd[_0x000e('0x30')]);_0x231082[_0x000e('0x32')]=_['intersection'](_0x231082[_0x000e('0x2f')],_0x231082[_0x000e('0x30')]);_0x31c730[_0x000e('0x34')]=_[_0x000e('0x33')](_0x231082[_0x000e('0x2f')],qs[_0x000e('0x35')](_0x3138fd[_0x000e('0x30')][_0x000e('0x35')]));_0x31c730['attributes']=_0x31c730['attributes'][_0x000e('0x36')]?_0x31c730[_0x000e('0x34')]:_0x231082[_0x000e('0x2f')];_0x31c730[_0x000e('0x39')]=qs[_0x000e('0x3a')](_0x3138fd[_0x000e('0x30')][_0x000e('0x3a')]);_0x31c730[_0x000e('0x3d')]=qs['filters'](_[_0x000e('0x3b')](_0x3138fd[_0x000e('0x30')],_0x231082[_0x000e('0x32')]));if(_0x3138fd['query']['filter']){_0x31c730[_0x000e('0x3d')]=_['merge'](_0x31c730[_0x000e('0x3d')],{'$or':_[_0x000e('0x29')](_0x31c730[_0x000e('0x34')],function(_0x3af9f6){var _0x13c431={};_0x13c431[_0x3af9f6]={'$like':'%'+_0x3138fd[_0x000e('0x30')][_0x000e('0x3c')]+'%'};return _0x13c431;})});}_0x31c730=_[_0x000e('0x3e')]({},_0x31c730,_0x3138fd[_0x000e('0x40')]);return _0x454a47[_0x000e('0x4f')](_0x31c730);}})[_0x000e('0x25')](function(_0x580195){if(_0x580195){_0x34f789=_0x580195[_0x000e('0x36')];if(!_0x3138fd[_0x000e('0x30')][_0x000e('0x37')]('nolimit')){_0x31c730['limit']=qs[_0x000e('0x1d')](_0x3138fd[_0x000e('0x30')][_0x000e('0x1d')]);_0x31c730[_0x000e('0x1b')]=qs[_0x000e('0x1b')](_0x3138fd[_0x000e('0x30')][_0x000e('0x1b')]);}return _0x454a47['getDescriptions'](_0x31c730);}})[_0x000e('0x25')](function(_0x4e2926){if(_0x4e2926){return _0x4e2926?{'count':_0x34f789,'rows':_0x4e2926}:null;}})['then'](respondWithResult(_0x970c1b,null))['catch'](handleError(_0x970c1b,null));};exports['getTags']=function(_0x630a19,_0x18a4cc,_0x1158ad){var _0x1917af={};var _0x59b78b={};var _0x2975fc;var _0x5d8d94;return db[_0x000e('0x2a')][_0x000e('0x4c')]({'where':{'id':_0x630a19['params']['id']}})[_0x000e('0x25')](handleEntityNotFound(_0x18a4cc,null))[_0x000e('0x25')](function(_0x58e18d){if(_0x58e18d){_0x2975fc=_0x58e18d;_0x59b78b[_0x000e('0x2f')]=_[_0x000e('0x31')](db[_0x000e('0x50')][_0x000e('0x2b')]);_0x59b78b[_0x000e('0x30')]=_[_0x000e('0x31')](_0x630a19[_0x000e('0x30')]);_0x59b78b[_0x000e('0x32')]=_[_0x000e('0x33')](_0x59b78b['model'],_0x59b78b[_0x000e('0x30')]);_0x1917af[_0x000e('0x34')]=_[_0x000e('0x33')](_0x59b78b[_0x000e('0x2f')],qs[_0x000e('0x35')](_0x630a19['query'][_0x000e('0x35')]));_0x1917af[_0x000e('0x34')]=_0x1917af[_0x000e('0x34')]['length']?_0x1917af['attributes']:_0x59b78b[_0x000e('0x2f')];_0x1917af[_0x000e('0x39')]=qs[_0x000e('0x3a')](_0x630a19[_0x000e('0x30')][_0x000e('0x3a')]);_0x1917af[_0x000e('0x3d')]=qs[_0x000e('0x32')](_[_0x000e('0x3b')](_0x630a19[_0x000e('0x30')],_0x59b78b[_0x000e('0x32')]));if(_0x630a19[_0x000e('0x30')][_0x000e('0x3c')]){_0x1917af['where']=_[_0x000e('0x3e')](_0x1917af[_0x000e('0x3d')],{'$or':_['map'](_0x1917af[_0x000e('0x34')],function(_0x2012e4){var _0x2d782b={};_0x2d782b[_0x2012e4]={'$like':'%'+_0x630a19[_0x000e('0x30')][_0x000e('0x3c')]+'%'};return _0x2d782b;})});}_0x1917af=_[_0x000e('0x3e')]({},_0x1917af,_0x630a19['options']);return _0x2975fc[_0x000e('0x51')](_0x1917af);}})[_0x000e('0x25')](function(_0x54c4f3){if(_0x54c4f3){_0x5d8d94=_0x54c4f3['length'];if(!_0x630a19['query'][_0x000e('0x37')](_0x000e('0x38'))){_0x1917af[_0x000e('0x1d')]=qs[_0x000e('0x1d')](_0x630a19[_0x000e('0x30')][_0x000e('0x1d')]);_0x1917af[_0x000e('0x1b')]=qs[_0x000e('0x1b')](_0x630a19[_0x000e('0x30')][_0x000e('0x1b')]);}return _0x2975fc[_0x000e('0x51')](_0x1917af);}})['then'](function(_0x55200a){if(_0x55200a){return _0x55200a?{'count':_0x5d8d94,'rows':_0x55200a}:null;}})[_0x000e('0x25')](respondWithResult(_0x18a4cc,null))[_0x000e('0x45')](handleError(_0x18a4cc,null));};exports[_0x000e('0x52')]=function(_0x13e117,_0xfba39b,_0x34b29b){if(_0x13e117[_0x000e('0x49')]['id']){delete _0x13e117['body']['id'];}return db[_0x000e('0x2a')][_0x000e('0x4c')]({'where':{'id':_0x13e117[_0x000e('0x4a')]['id']}})[_0x000e('0x25')](handleEntityNotFound(_0xfba39b,null))[_0x000e('0x25')](function(_0x210c1a){if(_0x210c1a){return _0x210c1a['setTags'](_0x13e117[_0x000e('0x49')][_0x000e('0x53')]||[]);}return null;})[_0x000e('0x25')](respondWithResult(_0xfba39b,null))[_0x000e('0x45')](handleError(_0xfba39b,null));}; \ No newline at end of file +var _0x6e27=['lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','count','limit','set','Content-Range','apply','reject','destroy','then','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','DeskConfiguration','include','rows','catch','show','params','length','includeAll','find','create','body','getFields','findOne','DeskField','nolimit','getSubjects','getDescriptions','getTags','ids','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x6e27,0x1d1));var _0x76e2=function(_0x490c35,_0x355416){_0x490c35=_0x490c35-0x0;var _0x4343b5=_0x6e27[_0x490c35];return _0x4343b5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76e2('0x0'));var zipdir=require(_0x76e2('0x1'));var jsonpatch=require(_0x76e2('0x2'));var rp=require('request-promise');var moment=require(_0x76e2('0x3'));var BPromise=require(_0x76e2('0x4'));var Mustache=require(_0x76e2('0x5'));var util=require('util');var path=require('path');var sox=require(_0x76e2('0x6'));var csv=require('to-csv');var ejs=require(_0x76e2('0x7'));var fs=require('fs');var fs_extra=require(_0x76e2('0x8'));var _=require(_0x76e2('0x9'));var squel=require(_0x76e2('0xa'));var crypto=require('crypto');var jsforce=require(_0x76e2('0xb'));var deskjs=require(_0x76e2('0xc'));var toCsv=require(_0x76e2('0xd'));var querystring=require('querystring');var Papa=require(_0x76e2('0xe'));var Redis=require(_0x76e2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x76e2('0x10'));var as=require(_0x76e2('0x11'));var hardwareService=require(_0x76e2('0x12'));var logger=require(_0x76e2('0x13'))(_0x76e2('0x14'));var utils=require(_0x76e2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x76e2('0x16'));var db=require(_0x76e2('0x17'))['db'];function respondWithStatusCode(_0x31278b,_0x556954){_0x556954=_0x556954||0xcc;return function(_0x2c0832){if(_0x2c0832){return _0x31278b['sendStatus'](_0x556954);}return _0x31278b[_0x76e2('0x18')](_0x556954)[_0x76e2('0x19')]();};}function respondWithResult(_0x3f9bfd,_0x404bba){_0x404bba=_0x404bba||0xc8;return function(_0x3050d4){if(_0x3050d4){return _0x3f9bfd['status'](_0x404bba)[_0x76e2('0x1a')](_0x3050d4);}};}function respondWithFilteredResult(_0x20d5f9,_0x4ba491){return function(_0x1836ef){if(_0x1836ef){var _0x168134=typeof _0x4ba491[_0x76e2('0x1b')]==='undefined'&&typeof _0x4ba491['limit']==='undefined';var _0x291344=_0x1836ef[_0x76e2('0x1c')];var _0x3bd236=_0x168134?0x0:_0x4ba491[_0x76e2('0x1b')];var _0x1f8584=_0x168134?_0x1836ef[_0x76e2('0x1c')]:_0x4ba491[_0x76e2('0x1b')]+_0x4ba491[_0x76e2('0x1d')];var _0x1a076c;if(_0x1f8584>=_0x291344){_0x1f8584=_0x291344;_0x1a076c=0xc8;}else{_0x1a076c=0xce;}_0x20d5f9['status'](_0x1a076c);return _0x20d5f9[_0x76e2('0x1e')](_0x76e2('0x1f'),_0x3bd236+'-'+_0x1f8584+'/'+_0x291344)[_0x76e2('0x1a')](_0x1836ef);}return null;};}function patchUpdates(_0x2928b6){return function(_0x4d67ff){try{jsonpatch[_0x76e2('0x20')](_0x4d67ff,_0x2928b6,!![]);}catch(_0x3b19b8){return BPromise[_0x76e2('0x21')](_0x3b19b8);}return _0x4d67ff['save']();};}function saveUpdates(_0x5323b4,_0x461fba){return function(_0x39d9a9){if(_0x39d9a9){return _0x39d9a9['update'](_0x5323b4)['then'](function(_0x590140){return _0x590140;});}return null;};}function removeEntity(_0x5d2952,_0x525bbf){return function(_0x3d95bf){if(_0x3d95bf){return _0x3d95bf[_0x76e2('0x22')]()[_0x76e2('0x23')](function(){_0x5d2952[_0x76e2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbf1c8c,_0xdb5faa){return function(_0x4039a9){if(!_0x4039a9){_0xbf1c8c['sendStatus'](0x194);}return _0x4039a9;};}function handleError(_0x7ec15,_0x3c9ca4){_0x3c9ca4=_0x3c9ca4||0x1f4;return function(_0x3db684){logger[_0x76e2('0x24')](_0x3db684[_0x76e2('0x25')]);if(_0x3db684[_0x76e2('0x26')]){delete _0x3db684[_0x76e2('0x26')];}_0x7ec15[_0x76e2('0x18')](_0x3c9ca4)['send'](_0x3db684);};}exports[_0x76e2('0x27')]=function(_0x2c3c9e,_0x2b730c){var _0x3bd84b={},_0x125163={},_0x216b49={'count':0x0,'rows':[]};var _0x3b653c=_['map'](db['DeskConfiguration'][_0x76e2('0x28')],function(_0x5df1b5){return{'name':_0x5df1b5[_0x76e2('0x29')],'type':_0x5df1b5[_0x76e2('0x2a')][_0x76e2('0x2b')]};});_0x125163[_0x76e2('0x2c')]=_[_0x76e2('0x2d')](_0x3b653c,_0x76e2('0x26'));_0x125163[_0x76e2('0x2e')]=_[_0x76e2('0x2f')](_0x2c3c9e[_0x76e2('0x2e')]);_0x125163[_0x76e2('0x30')]=_[_0x76e2('0x31')](_0x125163['model'],_0x125163[_0x76e2('0x2e')]);_0x3bd84b['attributes']=_['intersection'](_0x125163[_0x76e2('0x2c')],qs[_0x76e2('0x32')](_0x2c3c9e[_0x76e2('0x2e')][_0x76e2('0x32')]));_0x3bd84b['attributes']=_0x3bd84b['attributes']['length']?_0x3bd84b[_0x76e2('0x33')]:_0x125163[_0x76e2('0x2c')];if(!_0x2c3c9e['query'][_0x76e2('0x34')]('nolimit')){_0x3bd84b[_0x76e2('0x1d')]=qs['limit'](_0x2c3c9e[_0x76e2('0x2e')][_0x76e2('0x1d')]);_0x3bd84b[_0x76e2('0x1b')]=qs[_0x76e2('0x1b')](_0x2c3c9e['query'][_0x76e2('0x1b')]);}_0x3bd84b[_0x76e2('0x35')]=qs[_0x76e2('0x36')](_0x2c3c9e['query'][_0x76e2('0x36')]);_0x3bd84b[_0x76e2('0x37')]=qs[_0x76e2('0x30')](_['pick'](_0x2c3c9e['query'],_0x125163[_0x76e2('0x30')]),_0x3b653c);if(_0x2c3c9e['query']['filter']){_0x3bd84b[_0x76e2('0x37')]=_[_0x76e2('0x38')](_0x3bd84b[_0x76e2('0x37')],{'$or':_['map'](_0x3b653c,function(_0x6227a7){if(_0x6227a7[_0x76e2('0x2a')]!==_0x76e2('0x39')){var _0x6eebd={};_0x6eebd[_0x6227a7['name']]={'$like':'%'+_0x2c3c9e[_0x76e2('0x2e')][_0x76e2('0x3a')]+'%'};return _0x6eebd;}})});}_0x3bd84b=_['merge']({},_0x3bd84b,_0x2c3c9e[_0x76e2('0x3b')]);var _0x426818={'where':_0x3bd84b[_0x76e2('0x37')]};return db[_0x76e2('0x3c')][_0x76e2('0x1c')](_0x426818)['then'](function(_0x4d0452){_0x216b49[_0x76e2('0x1c')]=_0x4d0452;if(_0x2c3c9e[_0x76e2('0x2e')]['includeAll']){_0x3bd84b[_0x76e2('0x3d')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x3bd84b);})[_0x76e2('0x23')](function(_0x4e2c8c){_0x216b49[_0x76e2('0x3e')]=_0x4e2c8c;return _0x216b49;})[_0x76e2('0x23')](respondWithFilteredResult(_0x2b730c,_0x3bd84b))[_0x76e2('0x3f')](handleError(_0x2b730c,null));};exports[_0x76e2('0x40')]=function(_0x3918a4,_0x8d208a){var _0x4c7c04={'raw':![],'where':{'id':_0x3918a4[_0x76e2('0x41')]['id']}},_0x21ef7f={};_0x21ef7f[_0x76e2('0x2c')]=_[_0x76e2('0x2f')](db[_0x76e2('0x3c')]['rawAttributes']);_0x21ef7f[_0x76e2('0x2e')]=_[_0x76e2('0x2f')](_0x3918a4[_0x76e2('0x2e')]);_0x21ef7f['filters']=_[_0x76e2('0x31')](_0x21ef7f[_0x76e2('0x2c')],_0x21ef7f[_0x76e2('0x2e')]);_0x4c7c04['attributes']=_[_0x76e2('0x31')](_0x21ef7f[_0x76e2('0x2c')],qs['fields'](_0x3918a4[_0x76e2('0x2e')]['fields']));_0x4c7c04['attributes']=_0x4c7c04[_0x76e2('0x33')][_0x76e2('0x42')]?_0x4c7c04['attributes']:_0x21ef7f[_0x76e2('0x2c')];if(_0x3918a4[_0x76e2('0x2e')][_0x76e2('0x43')]){_0x4c7c04[_0x76e2('0x3d')]=[{'all':!![]}];}_0x4c7c04=_[_0x76e2('0x38')]({},_0x4c7c04,_0x3918a4[_0x76e2('0x3b')]);return db[_0x76e2('0x3c')][_0x76e2('0x44')](_0x4c7c04)[_0x76e2('0x23')](handleEntityNotFound(_0x8d208a,null))['then'](respondWithResult(_0x8d208a,null))[_0x76e2('0x3f')](handleError(_0x8d208a,null));};exports[_0x76e2('0x45')]=function(_0x2b3c55,_0x1b4b03){return db[_0x76e2('0x3c')][_0x76e2('0x45')](_0x2b3c55[_0x76e2('0x46')],{})[_0x76e2('0x23')](respondWithResult(_0x1b4b03,0xc9))[_0x76e2('0x3f')](handleError(_0x1b4b03,null));};exports['update']=function(_0xb0d6c8,_0x11bbee){if(_0xb0d6c8[_0x76e2('0x46')]['id']){delete _0xb0d6c8[_0x76e2('0x46')]['id'];}return db['DeskConfiguration'][_0x76e2('0x44')]({'where':{'id':_0xb0d6c8[_0x76e2('0x41')]['id']}})['then'](handleEntityNotFound(_0x11bbee,null))[_0x76e2('0x23')](saveUpdates(_0xb0d6c8[_0x76e2('0x46')],null))[_0x76e2('0x23')](respondWithResult(_0x11bbee,null))['catch'](handleError(_0x11bbee,null));};exports[_0x76e2('0x22')]=function(_0x4c37c4,_0x1b0c55){return db[_0x76e2('0x3c')][_0x76e2('0x44')]({'where':{'id':_0x4c37c4[_0x76e2('0x41')]['id']}})[_0x76e2('0x23')](handleEntityNotFound(_0x1b0c55,null))[_0x76e2('0x23')](removeEntity(_0x1b0c55,null))[_0x76e2('0x3f')](handleError(_0x1b0c55,null));};exports[_0x76e2('0x47')]=function(_0x592911,_0x188d44,_0x4704fd){var _0x40330f={};var _0x3acb46={};var _0xbcf50;var _0x3e0cc1;return db[_0x76e2('0x3c')][_0x76e2('0x48')]({'where':{'id':_0x592911[_0x76e2('0x41')]['id']}})[_0x76e2('0x23')](handleEntityNotFound(_0x188d44,null))[_0x76e2('0x23')](function(_0x15a7b8){if(_0x15a7b8){_0xbcf50=_0x15a7b8;_0x3acb46[_0x76e2('0x2c')]=_['keys'](db[_0x76e2('0x49')]['rawAttributes']);_0x3acb46[_0x76e2('0x2e')]=_[_0x76e2('0x2f')](_0x592911[_0x76e2('0x2e')]);_0x3acb46[_0x76e2('0x30')]=_[_0x76e2('0x31')](_0x3acb46[_0x76e2('0x2c')],_0x3acb46[_0x76e2('0x2e')]);_0x40330f[_0x76e2('0x33')]=_[_0x76e2('0x31')](_0x3acb46['model'],qs['fields'](_0x592911[_0x76e2('0x2e')][_0x76e2('0x32')]));_0x40330f['attributes']=_0x40330f[_0x76e2('0x33')][_0x76e2('0x42')]?_0x40330f[_0x76e2('0x33')]:_0x3acb46['model'];_0x40330f[_0x76e2('0x35')]=qs[_0x76e2('0x36')](_0x592911[_0x76e2('0x2e')][_0x76e2('0x36')]);_0x40330f[_0x76e2('0x37')]=qs['filters'](_['pick'](_0x592911[_0x76e2('0x2e')],_0x3acb46[_0x76e2('0x30')]));if(_0x592911[_0x76e2('0x2e')][_0x76e2('0x3a')]){_0x40330f[_0x76e2('0x37')]=_[_0x76e2('0x38')](_0x40330f[_0x76e2('0x37')],{'$or':_['map'](_0x40330f[_0x76e2('0x33')],function(_0x96aa30){var _0x56d7a9={};_0x56d7a9[_0x96aa30]={'$like':'%'+_0x592911[_0x76e2('0x2e')][_0x76e2('0x3a')]+'%'};return _0x56d7a9;})});}_0x40330f=_[_0x76e2('0x38')]({},_0x40330f,_0x592911[_0x76e2('0x3b')]);return _0xbcf50[_0x76e2('0x47')](_0x40330f);}})[_0x76e2('0x23')](function(_0x2359b3){if(_0x2359b3){_0x3e0cc1=_0x2359b3['length'];if(!_0x592911[_0x76e2('0x2e')][_0x76e2('0x34')](_0x76e2('0x4a'))){_0x40330f[_0x76e2('0x1d')]=qs[_0x76e2('0x1d')](_0x592911[_0x76e2('0x2e')][_0x76e2('0x1d')]);_0x40330f['offset']=qs[_0x76e2('0x1b')](_0x592911[_0x76e2('0x2e')][_0x76e2('0x1b')]);}return _0xbcf50['getFields'](_0x40330f);}})[_0x76e2('0x23')](function(_0xa550da){if(_0xa550da){return _0xa550da?{'count':_0x3e0cc1,'rows':_0xa550da}:null;}})[_0x76e2('0x23')](respondWithResult(_0x188d44,null))['catch'](handleError(_0x188d44,null));};exports[_0x76e2('0x4b')]=function(_0x55a67a,_0x549b91,_0x9d59f5){var _0x4c4d03={};var _0x4915a1={};var _0x22b4a8;var _0x555362;return db['DeskConfiguration'][_0x76e2('0x48')]({'where':{'id':_0x55a67a[_0x76e2('0x41')]['id']}})[_0x76e2('0x23')](handleEntityNotFound(_0x549b91,null))['then'](function(_0x226147){if(_0x226147){_0x22b4a8=_0x226147;_0x4915a1[_0x76e2('0x2c')]=_[_0x76e2('0x2f')](db['DeskField'][_0x76e2('0x28')]);_0x4915a1[_0x76e2('0x2e')]=_[_0x76e2('0x2f')](_0x55a67a['query']);_0x4915a1['filters']=_[_0x76e2('0x31')](_0x4915a1[_0x76e2('0x2c')],_0x4915a1[_0x76e2('0x2e')]);_0x4c4d03[_0x76e2('0x33')]=_[_0x76e2('0x31')](_0x4915a1[_0x76e2('0x2c')],qs['fields'](_0x55a67a['query'][_0x76e2('0x32')]));_0x4c4d03['attributes']=_0x4c4d03[_0x76e2('0x33')][_0x76e2('0x42')]?_0x4c4d03[_0x76e2('0x33')]:_0x4915a1[_0x76e2('0x2c')];_0x4c4d03[_0x76e2('0x35')]=qs[_0x76e2('0x36')](_0x55a67a[_0x76e2('0x2e')]['sort']);_0x4c4d03[_0x76e2('0x37')]=qs[_0x76e2('0x30')](_['pick'](_0x55a67a[_0x76e2('0x2e')],_0x4915a1[_0x76e2('0x30')]));if(_0x55a67a['query'][_0x76e2('0x3a')]){_0x4c4d03[_0x76e2('0x37')]=_[_0x76e2('0x38')](_0x4c4d03[_0x76e2('0x37')],{'$or':_[_0x76e2('0x2d')](_0x4c4d03[_0x76e2('0x33')],function(_0x3ac89f){var _0x42d4da={};_0x42d4da[_0x3ac89f]={'$like':'%'+_0x55a67a[_0x76e2('0x2e')]['filter']+'%'};return _0x42d4da;})});}_0x4c4d03=_['merge']({},_0x4c4d03,_0x55a67a[_0x76e2('0x3b')]);return _0x22b4a8[_0x76e2('0x4b')](_0x4c4d03);}})['then'](function(_0x2709b3){if(_0x2709b3){_0x555362=_0x2709b3['length'];if(!_0x55a67a[_0x76e2('0x2e')][_0x76e2('0x34')]('nolimit')){_0x4c4d03['limit']=qs[_0x76e2('0x1d')](_0x55a67a[_0x76e2('0x2e')][_0x76e2('0x1d')]);_0x4c4d03[_0x76e2('0x1b')]=qs[_0x76e2('0x1b')](_0x55a67a[_0x76e2('0x2e')][_0x76e2('0x1b')]);}return _0x22b4a8[_0x76e2('0x4b')](_0x4c4d03);}})[_0x76e2('0x23')](function(_0xfc307a){if(_0xfc307a){return _0xfc307a?{'count':_0x555362,'rows':_0xfc307a}:null;}})[_0x76e2('0x23')](respondWithResult(_0x549b91,null))['catch'](handleError(_0x549b91,null));};exports[_0x76e2('0x4c')]=function(_0x4bc267,_0x1a55b3,_0x15379a){var _0x54eacf={};var _0x2dd907={};var _0x48d43a;var _0x1ef4b1;return db['DeskConfiguration'][_0x76e2('0x48')]({'where':{'id':_0x4bc267[_0x76e2('0x41')]['id']}})[_0x76e2('0x23')](handleEntityNotFound(_0x1a55b3,null))[_0x76e2('0x23')](function(_0x44b158){if(_0x44b158){_0x48d43a=_0x44b158;_0x2dd907['model']=_[_0x76e2('0x2f')](db[_0x76e2('0x49')][_0x76e2('0x28')]);_0x2dd907[_0x76e2('0x2e')]=_['keys'](_0x4bc267['query']);_0x2dd907['filters']=_[_0x76e2('0x31')](_0x2dd907[_0x76e2('0x2c')],_0x2dd907[_0x76e2('0x2e')]);_0x54eacf[_0x76e2('0x33')]=_[_0x76e2('0x31')](_0x2dd907[_0x76e2('0x2c')],qs[_0x76e2('0x32')](_0x4bc267[_0x76e2('0x2e')][_0x76e2('0x32')]));_0x54eacf['attributes']=_0x54eacf[_0x76e2('0x33')][_0x76e2('0x42')]?_0x54eacf[_0x76e2('0x33')]:_0x2dd907[_0x76e2('0x2c')];_0x54eacf[_0x76e2('0x35')]=qs[_0x76e2('0x36')](_0x4bc267['query']['sort']);_0x54eacf[_0x76e2('0x37')]=qs[_0x76e2('0x30')](_['pick'](_0x4bc267['query'],_0x2dd907[_0x76e2('0x30')]));if(_0x4bc267[_0x76e2('0x2e')][_0x76e2('0x3a')]){_0x54eacf[_0x76e2('0x37')]=_['merge'](_0x54eacf['where'],{'$or':_[_0x76e2('0x2d')](_0x54eacf[_0x76e2('0x33')],function(_0x1fd111){var _0x1a2458={};_0x1a2458[_0x1fd111]={'$like':'%'+_0x4bc267[_0x76e2('0x2e')]['filter']+'%'};return _0x1a2458;})});}_0x54eacf=_[_0x76e2('0x38')]({},_0x54eacf,_0x4bc267[_0x76e2('0x3b')]);return _0x48d43a[_0x76e2('0x4c')](_0x54eacf);}})[_0x76e2('0x23')](function(_0xae8d41){if(_0xae8d41){_0x1ef4b1=_0xae8d41[_0x76e2('0x42')];if(!_0x4bc267[_0x76e2('0x2e')][_0x76e2('0x34')](_0x76e2('0x4a'))){_0x54eacf[_0x76e2('0x1d')]=qs[_0x76e2('0x1d')](_0x4bc267[_0x76e2('0x2e')][_0x76e2('0x1d')]);_0x54eacf[_0x76e2('0x1b')]=qs['offset'](_0x4bc267[_0x76e2('0x2e')][_0x76e2('0x1b')]);}return _0x48d43a['getDescriptions'](_0x54eacf);}})[_0x76e2('0x23')](function(_0x3ce966){if(_0x3ce966){return _0x3ce966?{'count':_0x1ef4b1,'rows':_0x3ce966}:null;}})[_0x76e2('0x23')](respondWithResult(_0x1a55b3,null))['catch'](handleError(_0x1a55b3,null));};exports[_0x76e2('0x4d')]=function(_0x35bda9,_0x3ab691,_0x85c5cc){var _0x24eebf={};var _0x518cbf={};var _0x511d52;var _0x11b140;return db['DeskConfiguration'][_0x76e2('0x48')]({'where':{'id':_0x35bda9[_0x76e2('0x41')]['id']}})['then'](handleEntityNotFound(_0x3ab691,null))[_0x76e2('0x23')](function(_0x5d4501){if(_0x5d4501){_0x511d52=_0x5d4501;_0x518cbf[_0x76e2('0x2c')]=_[_0x76e2('0x2f')](db['Tag'][_0x76e2('0x28')]);_0x518cbf[_0x76e2('0x2e')]=_[_0x76e2('0x2f')](_0x35bda9[_0x76e2('0x2e')]);_0x518cbf[_0x76e2('0x30')]=_[_0x76e2('0x31')](_0x518cbf['model'],_0x518cbf[_0x76e2('0x2e')]);_0x24eebf[_0x76e2('0x33')]=_['intersection'](_0x518cbf[_0x76e2('0x2c')],qs[_0x76e2('0x32')](_0x35bda9['query'][_0x76e2('0x32')]));_0x24eebf['attributes']=_0x24eebf[_0x76e2('0x33')][_0x76e2('0x42')]?_0x24eebf[_0x76e2('0x33')]:_0x518cbf[_0x76e2('0x2c')];_0x24eebf[_0x76e2('0x35')]=qs[_0x76e2('0x36')](_0x35bda9[_0x76e2('0x2e')][_0x76e2('0x36')]);_0x24eebf[_0x76e2('0x37')]=qs[_0x76e2('0x30')](_['pick'](_0x35bda9['query'],_0x518cbf['filters']));if(_0x35bda9[_0x76e2('0x2e')][_0x76e2('0x3a')]){_0x24eebf['where']=_['merge'](_0x24eebf[_0x76e2('0x37')],{'$or':_[_0x76e2('0x2d')](_0x24eebf[_0x76e2('0x33')],function(_0x52e115){var _0x36acb2={};_0x36acb2[_0x52e115]={'$like':'%'+_0x35bda9[_0x76e2('0x2e')][_0x76e2('0x3a')]+'%'};return _0x36acb2;})});}_0x24eebf=_[_0x76e2('0x38')]({},_0x24eebf,_0x35bda9[_0x76e2('0x3b')]);return _0x511d52[_0x76e2('0x4d')](_0x24eebf);}})[_0x76e2('0x23')](function(_0x178a84){if(_0x178a84){_0x11b140=_0x178a84[_0x76e2('0x42')];if(!_0x35bda9[_0x76e2('0x2e')][_0x76e2('0x34')]('nolimit')){_0x24eebf[_0x76e2('0x1d')]=qs[_0x76e2('0x1d')](_0x35bda9[_0x76e2('0x2e')][_0x76e2('0x1d')]);_0x24eebf[_0x76e2('0x1b')]=qs[_0x76e2('0x1b')](_0x35bda9['query'][_0x76e2('0x1b')]);}return _0x511d52['getTags'](_0x24eebf);}})[_0x76e2('0x23')](function(_0x1d67a1){if(_0x1d67a1){return _0x1d67a1?{'count':_0x11b140,'rows':_0x1d67a1}:null;}})[_0x76e2('0x23')](respondWithResult(_0x3ab691,null))[_0x76e2('0x3f')](handleError(_0x3ab691,null));};exports['setTags']=function(_0x327e0e,_0x369cdf,_0x467851){if(_0x327e0e[_0x76e2('0x46')]['id']){delete _0x327e0e[_0x76e2('0x46')]['id'];}return db['DeskConfiguration'][_0x76e2('0x48')]({'where':{'id':_0x327e0e[_0x76e2('0x41')]['id']}})[_0x76e2('0x23')](handleEntityNotFound(_0x369cdf,null))['then'](function(_0x268fb7){if(_0x268fb7){return _0x268fb7['setTags'](_0x327e0e[_0x76e2('0x46')][_0x76e2('0x4e')]||[]);}return null;})[_0x76e2('0x23')](respondWithResult(_0x369cdf,null))['catch'](handleError(_0x369cdf,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index ad4b89a..64d4331 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 _0xb606=['DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x165b2e,_0x4b9172){var _0x6ccc87=function(_0x22458c){while(--_0x22458c){_0x165b2e['push'](_0x165b2e['shift']());}};_0x6ccc87(++_0x4b9172);}(_0xb606,0x14c));var _0x6b60=function(_0x21cb7f,_0x48cd16){_0x21cb7f=_0x21cb7f-0x0;var _0x5a079a=_0xb606[_0x21cb7f];return _0x5a079a;};'use strict';var _=require(_0x6b60('0x0'));var util=require(_0x6b60('0x1'));var logger=require(_0x6b60('0x2'))('api');var moment=require(_0x6b60('0x3'));var BPromise=require('bluebird');var rp=require(_0x6b60('0x4'));var fs=require('fs');var path=require(_0x6b60('0x5'));var rimraf=require(_0x6b60('0x6'));var config=require(_0x6b60('0x7'));var attributes=require(_0x6b60('0x8'));module['exports']=function(_0x533fe5,_0x3fc90f){return _0x533fe5['define'](_0x6b60('0x9'),attributes,{'tableName':_0x6b60('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04c4=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','DeskConfiguration'];(function(_0x46111d,_0x5d286b){var _0xe82586=function(_0x39551b){while(--_0x39551b){_0x46111d['push'](_0x46111d['shift']());}};_0xe82586(++_0x5d286b);}(_0x04c4,0xa5));var _0x404c=function(_0x421e36,_0x18776e){_0x421e36=_0x421e36-0x0;var _0x20b3e3=_0x04c4[_0x421e36];return _0x20b3e3;};'use strict';var _=require(_0x404c('0x0'));var util=require(_0x404c('0x1'));var logger=require(_0x404c('0x2'))(_0x404c('0x3'));var moment=require('moment');var BPromise=require(_0x404c('0x4'));var rp=require(_0x404c('0x5'));var fs=require('fs');var path=require(_0x404c('0x6'));var rimraf=require(_0x404c('0x7'));var config=require(_0x404c('0x8'));var attributes=require('./intDeskConfiguration.attributes');module[_0x404c('0x9')]=function(_0x30a404,_0x199d32){return _0x30a404['define'](_0x404c('0xa'),attributes,{'tableName':'int_desk_configurations','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 e4d89e5..f99e1d5 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 _0x3f96=['request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x3f96,0x1d3));var _0x63f9=function(_0x19c56f,_0x271c69){_0x19c56f=_0x19c56f-0x0;var _0x2bfb45=_0x3f96[_0x19c56f];return _0x2bfb45;};'use strict';var _=require(_0x63f9('0x0'));var util=require(_0x63f9('0x1'));var moment=require(_0x63f9('0x2'));var BPromise=require(_0x63f9('0x3'));var rs=require(_0x63f9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x63f9('0x5'))['db'];var utils=require(_0x63f9('0x6'));var logger=require(_0x63f9('0x7'))(_0x63f9('0x8'));var config=require(_0x63f9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x63f9('0xa')][_0x63f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ca178,_0x3819ad,_0x494484){return new BPromise(function(_0x131280,_0x258200){return client[_0x63f9('0xc')](_0x1ca178,_0x494484)[_0x63f9('0xd')](function(_0x45cb1f){logger[_0x63f9('0xe')](_0x63f9('0xf'),_0x3819ad,_0x63f9('0x10'));logger['debug'](_0x63f9('0x11'),_0x3819ad,_0x63f9('0x10'),JSON['stringify'](_0x45cb1f));if(_0x45cb1f[_0x63f9('0x12')]){if(_0x45cb1f[_0x63f9('0x12')][_0x63f9('0x13')]===0x1f4){logger['error'](_0x63f9('0xf'),_0x3819ad,_0x45cb1f[_0x63f9('0x12')][_0x63f9('0x14')]);return _0x258200(_0x45cb1f[_0x63f9('0x12')][_0x63f9('0x14')]);}logger[_0x63f9('0x12')](_0x63f9('0xf'),_0x3819ad,_0x45cb1f['error'][_0x63f9('0x14')]);return _0x131280(_0x45cb1f['error'][_0x63f9('0x14')]);}else{logger['info'](_0x63f9('0xf'),_0x3819ad,_0x63f9('0x10'));_0x131280(_0x45cb1f[_0x63f9('0x15')][_0x63f9('0x14')]);}})[_0x63f9('0x16')](function(_0x1da33e){logger[_0x63f9('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x3819ad,_0x1da33e);_0x258200(_0x1da33e);});});} \ No newline at end of file +var _0xf271=['code','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x12742e,_0x43f6fa){var _0x173452=function(_0x500743){while(--_0x500743){_0x12742e['push'](_0x12742e['shift']());}};_0x173452(++_0x43f6fa);}(_0xf271,0x10b));var _0x1f27=function(_0x238428,_0x5dc614){_0x238428=_0x238428-0x0;var _0xaafb54=_0xf271[_0x238428];return _0xaafb54;};'use strict';var _=require(_0x1f27('0x0'));var util=require('util');var moment=require(_0x1f27('0x1'));var BPromise=require(_0x1f27('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f27('0x3'))['db'];var utils=require(_0x1f27('0x4'));var logger=require(_0x1f27('0x5'))(_0x1f27('0x6'));var config=require(_0x1f27('0x7'));var jayson=require(_0x1f27('0x8'));var client=jayson[_0x1f27('0x9')][_0x1f27('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e397f,_0x408347,_0x376e7b){return new BPromise(function(_0x2690db,_0xf12834){return client[_0x1f27('0xb')](_0x2e397f,_0x376e7b)[_0x1f27('0xc')](function(_0x153ac2){logger[_0x1f27('0xd')](_0x1f27('0xe'),_0x408347,_0x1f27('0xf'));logger['debug'](_0x1f27('0x10'),_0x408347,'request\x20sent',JSON[_0x1f27('0x11')](_0x153ac2));if(_0x153ac2[_0x1f27('0x12')]){if(_0x153ac2[_0x1f27('0x12')][_0x1f27('0x13')]===0x1f4){logger[_0x1f27('0x12')](_0x1f27('0xe'),_0x408347,_0x153ac2[_0x1f27('0x12')]['message']);return _0xf12834(_0x153ac2[_0x1f27('0x12')][_0x1f27('0x14')]);}logger[_0x1f27('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x408347,_0x153ac2[_0x1f27('0x12')][_0x1f27('0x14')]);return _0x2690db(_0x153ac2[_0x1f27('0x12')][_0x1f27('0x14')]);}else{logger[_0x1f27('0xd')](_0x1f27('0xe'),_0x408347,_0x1f27('0xf'));_0x2690db(_0x153ac2['result'][_0x1f27('0x14')]);}})[_0x1f27('0x15')](function(_0x3cda5b){logger[_0x1f27('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x408347,_0x3cda5b);_0xf12834(_0x3cda5b);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 8a40e60..e22b37d 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 _0x5f60=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','index','get','/:id','isAuthenticated','show'];(function(_0x1c9625,_0x49cd62){var _0x3fcef6=function(_0x4a8552){while(--_0x4a8552){_0x1c9625['push'](_0x1c9625['shift']());}};_0x3fcef6(++_0x49cd62);}(_0x5f60,0xed));var _0x05f6=function(_0x382ca6,_0x1aaf79){_0x382ca6=_0x382ca6-0x0;var _0x295a6c=_0x5f60[_0x382ca6];return _0x295a6c;};'use strict';var multer=require(_0x05f6('0x0'));var util=require('util');var path=require(_0x05f6('0x1'));var timeout=require(_0x05f6('0x2'));var express=require(_0x05f6('0x3'));var router=express[_0x05f6('0x4')]();var fs_extra=require(_0x05f6('0x5'));var auth=require(_0x05f6('0x6'));var interaction=require(_0x05f6('0x7'));var config=require(_0x05f6('0x8'));var controller=require(_0x05f6('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x05f6('0xa')]);router[_0x05f6('0xb')](_0x05f6('0xc'),auth[_0x05f6('0xd')](),controller[_0x05f6('0xe')]);router['post']('/',auth[_0x05f6('0xd')](),controller[_0x05f6('0xf')]);router[_0x05f6('0x10')]('/:id',auth[_0x05f6('0xd')](),controller[_0x05f6('0x11')]);router[_0x05f6('0x12')]('/:id',auth[_0x05f6('0xd')](),controller[_0x05f6('0x13')]);module[_0x05f6('0x14')]=router; \ No newline at end of file +var _0x84e5=['/:id','update','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','post'];(function(_0x25a40b,_0x6f205e){var _0x359b30=function(_0x1b0b3d){while(--_0x1b0b3d){_0x25a40b['push'](_0x25a40b['shift']());}};_0x359b30(++_0x6f205e);}(_0x84e5,0x111));var _0x584e=function(_0x44d9ab,_0x76bc69){_0x44d9ab=_0x44d9ab-0x0;var _0x31485e=_0x84e5[_0x44d9ab];return _0x31485e;};'use strict';var multer=require('multer');var util=require(_0x584e('0x0'));var path=require('path');var timeout=require(_0x584e('0x1'));var express=require(_0x584e('0x2'));var router=express[_0x584e('0x3')]();var fs_extra=require(_0x584e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x584e('0x5'));var config=require(_0x584e('0x6'));var controller=require(_0x584e('0x7'));router[_0x584e('0x8')]('/',auth[_0x584e('0x9')](),controller[_0x584e('0xa')]);router[_0x584e('0x8')]('/:id',auth[_0x584e('0x9')](),controller['show']);router[_0x584e('0xb')]('/',auth[_0x584e('0x9')](),controller['create']);router['put'](_0x584e('0xc'),auth['isAuthenticated'](),controller[_0x584e('0xd')]);router['delete'](_0x584e('0xc'),auth[_0x584e('0x9')](),controller['destroy']);module[_0x584e('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 926ef28..26ce85c 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 _0xc6c6=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x44004b,_0x372cd5){var _0x5d58e9=function(_0x19e8ef){while(--_0x19e8ef){_0x44004b['push'](_0x44004b['shift']());}};_0x5d58e9(++_0x372cd5);}(_0xc6c6,0x1c3));var _0x6c6c=function(_0x8854f2,_0x79542c){_0x8854f2=_0x8854f2-0x0;var _0x38505d=_0xc6c6[_0x8854f2];return _0x38505d;};'use strict';var Sequelize=require(_0x6c6c('0x0'));module[_0x6c6c('0x1')]={'type':{'type':Sequelize[_0x6c6c('0x2')](_0x6c6c('0x3'),_0x6c6c('0x4'),_0x6c6c('0x5'),_0x6c6c('0x6'),_0x6c6c('0x7')),'defaultValue':_0x6c6c('0x3')},'content':{'type':Sequelize[_0x6c6c('0x8')]},'key':{'type':Sequelize[_0x6c6c('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x6c6c('0x3'),_0x6c6c('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x6c6c('0x8')]},'idField':{'type':Sequelize[_0x6c6c('0x8')]},'nameField':{'type':Sequelize[_0x6c6c('0x8')]},'customField':{'type':Sequelize[_0x6c6c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6c6c('0x8')]}}; \ No newline at end of file +var _0x9c4b=['BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x497a7f,_0x1eb90e){var _0x19d47f=function(_0x316958){while(--_0x316958){_0x497a7f['push'](_0x497a7f['shift']());}};_0x19d47f(++_0x1eb90e);}(_0x9c4b,0x151));var _0xb9c4=function(_0x57fa91,_0x87ea8a){_0x57fa91=_0x57fa91-0x0;var _0x425572=_0x9c4b[_0x57fa91];return _0x425572;};'use strict';var Sequelize=require(_0xb9c4('0x0'));module['exports']={'type':{'type':Sequelize[_0xb9c4('0x1')](_0xb9c4('0x2'),_0xb9c4('0x3'),_0xb9c4('0x4'),_0xb9c4('0x5'),'picklist'),'defaultValue':_0xb9c4('0x2')},'content':{'type':Sequelize[_0xb9c4('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb9c4('0x1')]('string',_0xb9c4('0x3'),_0xb9c4('0x4'))},'keyContent':{'type':Sequelize[_0xb9c4('0x6')]},'idField':{'type':Sequelize[_0xb9c4('0x6')]},'nameField':{'type':Sequelize[_0xb9c4('0x6')]},'customField':{'type':Sequelize[_0xb9c4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 3d8a7e3..eba57d7 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 _0x7e3e=['params','keys','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','DeskField','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','options','include','rows','catch'];(function(_0xfd495c,_0x4a3c1a){var _0x561dd8=function(_0x83e915){while(--_0x83e915){_0xfd495c['push'](_0xfd495c['shift']());}};_0x561dd8(++_0x4a3c1a);}(_0x7e3e,0x126));var _0xe7e3=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x7e3e[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0xe7e3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe7e3('0x1'));var jsonpatch=require(_0xe7e3('0x2'));var rp=require(_0xe7e3('0x3'));var moment=require(_0xe7e3('0x4'));var BPromise=require(_0xe7e3('0x5'));var Mustache=require(_0xe7e3('0x6'));var util=require(_0xe7e3('0x7'));var path=require(_0xe7e3('0x8'));var sox=require(_0xe7e3('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe7e3('0xa'));var squel=require(_0xe7e3('0xb'));var crypto=require(_0xe7e3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe7e3('0xd'));var toCsv=require(_0xe7e3('0xe'));var querystring=require(_0xe7e3('0xf'));var Papa=require(_0xe7e3('0x10'));var Redis=require(_0xe7e3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe7e3('0x12'));var as=require(_0xe7e3('0x13'));var hardwareService=require(_0xe7e3('0x14'));var logger=require(_0xe7e3('0x15'))('api');var utils=require(_0xe7e3('0x16'));var config=require(_0xe7e3('0x17'));var licenseUtil=require(_0xe7e3('0x18'));var db=require(_0xe7e3('0x19'))['db'];function respondWithStatusCode(_0x38e1dd,_0x26d1ea){_0x26d1ea=_0x26d1ea||0xcc;return function(_0xa6e77d){if(_0xa6e77d){return _0x38e1dd[_0xe7e3('0x1a')](_0x26d1ea);}return _0x38e1dd['status'](_0x26d1ea)['end']();};}function respondWithResult(_0x50d98c,_0x1844b7){_0x1844b7=_0x1844b7||0xc8;return function(_0x424fd9){if(_0x424fd9){return _0x50d98c[_0xe7e3('0x1b')](_0x1844b7)['json'](_0x424fd9);}};}function respondWithFilteredResult(_0x1d544d,_0x36e523){return function(_0xe4a4ae){if(_0xe4a4ae){var _0x23d43e=typeof _0x36e523[_0xe7e3('0x1c')]==='undefined'&&typeof _0x36e523[_0xe7e3('0x1d')]===_0xe7e3('0x1e');var _0x3f0329=_0xe4a4ae['count'];var _0x25e3b9=_0x23d43e?0x0:_0x36e523['offset'];var _0x364d3d=_0x23d43e?_0xe4a4ae[_0xe7e3('0x1f')]:_0x36e523[_0xe7e3('0x1c')]+_0x36e523['limit'];var _0x29f19b;if(_0x364d3d>=_0x3f0329){_0x364d3d=_0x3f0329;_0x29f19b=0xc8;}else{_0x29f19b=0xce;}_0x1d544d['status'](_0x29f19b);return _0x1d544d[_0xe7e3('0x20')](_0xe7e3('0x21'),_0x25e3b9+'-'+_0x364d3d+'/'+_0x3f0329)['json'](_0xe4a4ae);}return null;};}function patchUpdates(_0x29b602){return function(_0x5160c4){try{jsonpatch[_0xe7e3('0x22')](_0x5160c4,_0x29b602,!![]);}catch(_0x11c5b3){return BPromise[_0xe7e3('0x23')](_0x11c5b3);}return _0x5160c4['save']();};}function saveUpdates(_0x431a75,_0x149ffc){return function(_0x3ab6ad){if(_0x3ab6ad){return _0x3ab6ad[_0xe7e3('0x24')](_0x431a75)[_0xe7e3('0x25')](function(_0x36eb4c){return _0x36eb4c;});}return null;};}function removeEntity(_0x5ebd3f,_0x2127a8){return function(_0x1be820){if(_0x1be820){return _0x1be820['destroy']()[_0xe7e3('0x25')](function(){_0x5ebd3f['status'](0xcc)[_0xe7e3('0x26')]();});}};}function handleEntityNotFound(_0x15417d,_0x1ea01c){return function(_0x2dfa1c){if(!_0x2dfa1c){_0x15417d[_0xe7e3('0x1a')](0x194);}return _0x2dfa1c;};}function handleError(_0xb20bb2,_0x351cc3){_0x351cc3=_0x351cc3||0x1f4;return function(_0x1054da){logger[_0xe7e3('0x27')](_0x1054da[_0xe7e3('0x28')]);if(_0x1054da[_0xe7e3('0x29')]){delete _0x1054da[_0xe7e3('0x29')];}_0xb20bb2[_0xe7e3('0x1b')](_0x351cc3)[_0xe7e3('0x2a')](_0x1054da);};}exports[_0xe7e3('0x2b')]=function(_0x12dc93,_0x1c7b61){var _0x57d287={},_0x42e1df={},_0x3c030c={'count':0x0,'rows':[]};var _0x575f07=_['map'](db[_0xe7e3('0x2c')][_0xe7e3('0x2d')],function(_0x570a79){return{'name':_0x570a79[_0xe7e3('0x2e')],'type':_0x570a79[_0xe7e3('0x2f')]['key']};});_0x42e1df[_0xe7e3('0x30')]=_[_0xe7e3('0x31')](_0x575f07,'name');_0x42e1df[_0xe7e3('0x32')]=_['keys'](_0x12dc93[_0xe7e3('0x32')]);_0x42e1df[_0xe7e3('0x33')]=_['intersection'](_0x42e1df[_0xe7e3('0x30')],_0x42e1df[_0xe7e3('0x32')]);_0x57d287['attributes']=_[_0xe7e3('0x34')](_0x42e1df[_0xe7e3('0x30')],qs['fields'](_0x12dc93['query'][_0xe7e3('0x35')]));_0x57d287[_0xe7e3('0x36')]=_0x57d287[_0xe7e3('0x36')][_0xe7e3('0x37')]?_0x57d287[_0xe7e3('0x36')]:_0x42e1df[_0xe7e3('0x30')];if(!_0x12dc93['query'][_0xe7e3('0x38')]('nolimit')){_0x57d287[_0xe7e3('0x1d')]=qs['limit'](_0x12dc93[_0xe7e3('0x32')]['limit']);_0x57d287[_0xe7e3('0x1c')]=qs[_0xe7e3('0x1c')](_0x12dc93['query'][_0xe7e3('0x1c')]);}_0x57d287[_0xe7e3('0x39')]=qs['sort'](_0x12dc93['query']['sort']);_0x57d287[_0xe7e3('0x3a')]=qs[_0xe7e3('0x33')](_[_0xe7e3('0x3b')](_0x12dc93[_0xe7e3('0x32')],_0x42e1df[_0xe7e3('0x33')]),_0x575f07);if(_0x12dc93[_0xe7e3('0x32')][_0xe7e3('0x3c')]){_0x57d287[_0xe7e3('0x3a')]=_[_0xe7e3('0x3d')](_0x57d287[_0xe7e3('0x3a')],{'$or':_['map'](_0x575f07,function(_0x132767){if(_0x132767['type']!=='VIRTUAL'){var _0x18768a={};_0x18768a[_0x132767[_0xe7e3('0x29')]]={'$like':'%'+_0x12dc93['query'][_0xe7e3('0x3c')]+'%'};return _0x18768a;}})});}_0x57d287=_[_0xe7e3('0x3d')]({},_0x57d287,_0x12dc93[_0xe7e3('0x3e')]);var _0x1f0ad={'where':_0x57d287[_0xe7e3('0x3a')]};return db[_0xe7e3('0x2c')]['count'](_0x1f0ad)[_0xe7e3('0x25')](function(_0x3a1825){_0x3c030c[_0xe7e3('0x1f')]=_0x3a1825;if(_0x12dc93[_0xe7e3('0x32')]['includeAll']){_0x57d287[_0xe7e3('0x3f')]=[{'all':!![]}];}return db[_0xe7e3('0x2c')]['findAll'](_0x57d287);})[_0xe7e3('0x25')](function(_0x4b32de){_0x3c030c[_0xe7e3('0x40')]=_0x4b32de;return _0x3c030c;})[_0xe7e3('0x25')](respondWithFilteredResult(_0x1c7b61,_0x57d287))[_0xe7e3('0x41')](handleError(_0x1c7b61,null));};exports['show']=function(_0x50a89d,_0x4b6e34){var _0x19458d={'raw':!![],'where':{'id':_0x50a89d[_0xe7e3('0x42')]['id']}},_0x3b9245={};_0x3b9245[_0xe7e3('0x30')]=_[_0xe7e3('0x43')](db[_0xe7e3('0x2c')][_0xe7e3('0x2d')]);_0x3b9245[_0xe7e3('0x32')]=_[_0xe7e3('0x43')](_0x50a89d[_0xe7e3('0x32')]);_0x3b9245[_0xe7e3('0x33')]=_[_0xe7e3('0x34')](_0x3b9245[_0xe7e3('0x30')],_0x3b9245[_0xe7e3('0x32')]);_0x19458d[_0xe7e3('0x36')]=_['intersection'](_0x3b9245[_0xe7e3('0x30')],qs['fields'](_0x50a89d[_0xe7e3('0x32')][_0xe7e3('0x35')]));_0x19458d[_0xe7e3('0x36')]=_0x19458d[_0xe7e3('0x36')][_0xe7e3('0x37')]?_0x19458d['attributes']:_0x3b9245[_0xe7e3('0x30')];if(_0x50a89d[_0xe7e3('0x32')]['includeAll']){_0x19458d['include']=[{'all':!![]}];}_0x19458d=_[_0xe7e3('0x3d')]({},_0x19458d,_0x50a89d[_0xe7e3('0x3e')]);return db['DeskField'][_0xe7e3('0x44')](_0x19458d)[_0xe7e3('0x25')](handleEntityNotFound(_0x4b6e34,null))[_0xe7e3('0x25')](respondWithResult(_0x4b6e34,null))[_0xe7e3('0x41')](handleError(_0x4b6e34,null));};exports[_0xe7e3('0x45')]=function(_0x813e19,_0x2712bf){return db[_0xe7e3('0x2c')][_0xe7e3('0x45')](_0x813e19[_0xe7e3('0x46')],{})[_0xe7e3('0x25')](respondWithResult(_0x2712bf,0xc9))[_0xe7e3('0x41')](handleError(_0x2712bf,null));};exports['update']=function(_0x4a3f2a,_0x3ebf14){if(_0x4a3f2a[_0xe7e3('0x46')]['id']){delete _0x4a3f2a['body']['id'];}return db[_0xe7e3('0x2c')][_0xe7e3('0x44')]({'where':{'id':_0x4a3f2a[_0xe7e3('0x42')]['id']}})[_0xe7e3('0x25')](handleEntityNotFound(_0x3ebf14,null))['then'](saveUpdates(_0x4a3f2a['body'],null))[_0xe7e3('0x25')](respondWithResult(_0x3ebf14,null))[_0xe7e3('0x41')](handleError(_0x3ebf14,null));};exports[_0xe7e3('0x47')]=function(_0x342c68,_0x57df30){return db[_0xe7e3('0x2c')]['find']({'where':{'id':_0x342c68[_0xe7e3('0x42')]['id']}})[_0xe7e3('0x25')](handleEntityNotFound(_0x57df30,null))[_0xe7e3('0x25')](removeEntity(_0x57df30,null))[_0xe7e3('0x41')](handleError(_0x57df30,null));}; \ No newline at end of file +var _0xee3c=['sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','findAll','rows','params','length','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','end','stack','name','send','index','DeskField','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order'];(function(_0x185f54,_0x499b38){var _0x484e97=function(_0x364f68){while(--_0x364f68){_0x185f54['push'](_0x185f54['shift']());}};_0x484e97(++_0x499b38);}(_0xee3c,0x14a));var _0xcee3=function(_0x391f04,_0x46d508){_0x391f04=_0x391f04-0x0;var _0x2eaf60=_0xee3c[_0x391f04];return _0x2eaf60;};'use strict';var emlformat=require(_0xcee3('0x0'));var rimraf=require(_0xcee3('0x1'));var zipdir=require(_0xcee3('0x2'));var jsonpatch=require(_0xcee3('0x3'));var rp=require(_0xcee3('0x4'));var moment=require(_0xcee3('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcee3('0x6'));var path=require(_0xcee3('0x7'));var sox=require(_0xcee3('0x8'));var csv=require(_0xcee3('0x9'));var ejs=require(_0xcee3('0xa'));var fs=require('fs');var fs_extra=require(_0xcee3('0xb'));var _=require(_0xcee3('0xc'));var squel=require(_0xcee3('0xd'));var crypto=require(_0xcee3('0xe'));var jsforce=require(_0xcee3('0xf'));var deskjs=require(_0xcee3('0x10'));var toCsv=require(_0xcee3('0x9'));var querystring=require(_0xcee3('0x11'));var Papa=require(_0xcee3('0x12'));var Redis=require(_0xcee3('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xcee3('0x14'));var as=require(_0xcee3('0x15'));var hardwareService=require(_0xcee3('0x16'));var logger=require(_0xcee3('0x17'))(_0xcee3('0x18'));var utils=require(_0xcee3('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xcee3('0x1a'));var db=require(_0xcee3('0x1b'))['db'];function respondWithStatusCode(_0x2db8ff,_0x1a47e1){_0x1a47e1=_0x1a47e1||0xcc;return function(_0xc4f4f2){if(_0xc4f4f2){return _0x2db8ff['sendStatus'](_0x1a47e1);}return _0x2db8ff[_0xcee3('0x1c')](_0x1a47e1)['end']();};}function respondWithResult(_0x559250,_0x53c810){_0x53c810=_0x53c810||0xc8;return function(_0x3ea063){if(_0x3ea063){return _0x559250[_0xcee3('0x1c')](_0x53c810)['json'](_0x3ea063);}};}function respondWithFilteredResult(_0x50bbf2,_0x34854a){return function(_0x505f09){if(_0x505f09){var _0x420b46=typeof _0x34854a['offset']===_0xcee3('0x1d')&&typeof _0x34854a[_0xcee3('0x1e')]==='undefined';var _0xc139b5=_0x505f09[_0xcee3('0x1f')];var _0x40cb8b=_0x420b46?0x0:_0x34854a[_0xcee3('0x20')];var _0x50bf6e=_0x420b46?_0x505f09[_0xcee3('0x1f')]:_0x34854a[_0xcee3('0x20')]+_0x34854a[_0xcee3('0x1e')];var _0x11bf37;if(_0x50bf6e>=_0xc139b5){_0x50bf6e=_0xc139b5;_0x11bf37=0xc8;}else{_0x11bf37=0xce;}_0x50bbf2['status'](_0x11bf37);return _0x50bbf2[_0xcee3('0x21')](_0xcee3('0x22'),_0x40cb8b+'-'+_0x50bf6e+'/'+_0xc139b5)[_0xcee3('0x23')](_0x505f09);}return null;};}function patchUpdates(_0x8b2470){return function(_0x11d116){try{jsonpatch[_0xcee3('0x24')](_0x11d116,_0x8b2470,!![]);}catch(_0x195ba9){return BPromise[_0xcee3('0x25')](_0x195ba9);}return _0x11d116[_0xcee3('0x26')]();};}function saveUpdates(_0x46d7a9,_0x40dd10){return function(_0xa1efbf){if(_0xa1efbf){return _0xa1efbf[_0xcee3('0x27')](_0x46d7a9)['then'](function(_0x1fee89){return _0x1fee89;});}return null;};}function removeEntity(_0x277194,_0x240736){return function(_0x1ee247){if(_0x1ee247){return _0x1ee247[_0xcee3('0x28')]()['then'](function(){_0x277194['status'](0xcc)[_0xcee3('0x29')]();});}};}function handleEntityNotFound(_0x5b92ba,_0x544509){return function(_0x228ff6){if(!_0x228ff6){_0x5b92ba['sendStatus'](0x194);}return _0x228ff6;};}function handleError(_0x452837,_0x202bfd){_0x202bfd=_0x202bfd||0x1f4;return function(_0x19a15e){logger['error'](_0x19a15e[_0xcee3('0x2a')]);if(_0x19a15e['name']){delete _0x19a15e[_0xcee3('0x2b')];}_0x452837['status'](_0x202bfd)[_0xcee3('0x2c')](_0x19a15e);};}exports[_0xcee3('0x2d')]=function(_0x5d965d,_0x3a2532){var _0x1efb1b={},_0x5c1a32={},_0x400cfe={'count':0x0,'rows':[]};var _0x4ef9da=_['map'](db[_0xcee3('0x2e')]['rawAttributes'],function(_0x22e342){return{'name':_0x22e342[_0xcee3('0x2f')],'type':_0x22e342[_0xcee3('0x30')][_0xcee3('0x31')]};});_0x5c1a32[_0xcee3('0x32')]=_[_0xcee3('0x33')](_0x4ef9da,_0xcee3('0x2b'));_0x5c1a32['query']=_[_0xcee3('0x34')](_0x5d965d['query']);_0x5c1a32[_0xcee3('0x35')]=_[_0xcee3('0x36')](_0x5c1a32[_0xcee3('0x32')],_0x5c1a32[_0xcee3('0x37')]);_0x1efb1b[_0xcee3('0x38')]=_[_0xcee3('0x36')](_0x5c1a32[_0xcee3('0x32')],qs[_0xcee3('0x39')](_0x5d965d['query'][_0xcee3('0x39')]));_0x1efb1b[_0xcee3('0x38')]=_0x1efb1b[_0xcee3('0x38')]['length']?_0x1efb1b[_0xcee3('0x38')]:_0x5c1a32[_0xcee3('0x32')];if(!_0x5d965d['query'][_0xcee3('0x3a')]('nolimit')){_0x1efb1b[_0xcee3('0x1e')]=qs['limit'](_0x5d965d['query'][_0xcee3('0x1e')]);_0x1efb1b['offset']=qs[_0xcee3('0x20')](_0x5d965d[_0xcee3('0x37')][_0xcee3('0x20')]);}_0x1efb1b[_0xcee3('0x3b')]=qs['sort'](_0x5d965d['query'][_0xcee3('0x3c')]);_0x1efb1b[_0xcee3('0x3d')]=qs['filters'](_[_0xcee3('0x3e')](_0x5d965d[_0xcee3('0x37')],_0x5c1a32['filters']),_0x4ef9da);if(_0x5d965d[_0xcee3('0x37')][_0xcee3('0x3f')]){_0x1efb1b[_0xcee3('0x3d')]=_[_0xcee3('0x40')](_0x1efb1b[_0xcee3('0x3d')],{'$or':_[_0xcee3('0x33')](_0x4ef9da,function(_0x49f1dc){if(_0x49f1dc[_0xcee3('0x30')]!==_0xcee3('0x41')){var _0x28e726={};_0x28e726[_0x49f1dc[_0xcee3('0x2b')]]={'$like':'%'+_0x5d965d[_0xcee3('0x37')][_0xcee3('0x3f')]+'%'};return _0x28e726;}})});}_0x1efb1b=_[_0xcee3('0x40')]({},_0x1efb1b,_0x5d965d['options']);var _0x139ddc={'where':_0x1efb1b[_0xcee3('0x3d')]};return db[_0xcee3('0x2e')]['count'](_0x139ddc)[_0xcee3('0x42')](function(_0x436961){_0x400cfe['count']=_0x436961;if(_0x5d965d[_0xcee3('0x37')][_0xcee3('0x43')]){_0x1efb1b[_0xcee3('0x44')]=[{'all':!![]}];}return db['DeskField'][_0xcee3('0x45')](_0x1efb1b);})[_0xcee3('0x42')](function(_0x1bb4a8){_0x400cfe[_0xcee3('0x46')]=_0x1bb4a8;return _0x400cfe;})[_0xcee3('0x42')](respondWithFilteredResult(_0x3a2532,_0x1efb1b))['catch'](handleError(_0x3a2532,null));};exports['show']=function(_0x42e197,_0x41cd61){var _0x45df47={'raw':!![],'where':{'id':_0x42e197[_0xcee3('0x47')]['id']}},_0x47159f={};_0x47159f[_0xcee3('0x32')]=_[_0xcee3('0x34')](db[_0xcee3('0x2e')]['rawAttributes']);_0x47159f[_0xcee3('0x37')]=_[_0xcee3('0x34')](_0x42e197[_0xcee3('0x37')]);_0x47159f[_0xcee3('0x35')]=_[_0xcee3('0x36')](_0x47159f[_0xcee3('0x32')],_0x47159f[_0xcee3('0x37')]);_0x45df47['attributes']=_[_0xcee3('0x36')](_0x47159f['model'],qs[_0xcee3('0x39')](_0x42e197[_0xcee3('0x37')]['fields']));_0x45df47[_0xcee3('0x38')]=_0x45df47[_0xcee3('0x38')][_0xcee3('0x48')]?_0x45df47[_0xcee3('0x38')]:_0x47159f[_0xcee3('0x32')];if(_0x42e197[_0xcee3('0x37')][_0xcee3('0x43')]){_0x45df47[_0xcee3('0x44')]=[{'all':!![]}];}_0x45df47=_[_0xcee3('0x40')]({},_0x45df47,_0x42e197[_0xcee3('0x49')]);return db['DeskField'][_0xcee3('0x4a')](_0x45df47)[_0xcee3('0x42')](handleEntityNotFound(_0x41cd61,null))['then'](respondWithResult(_0x41cd61,null))[_0xcee3('0x4b')](handleError(_0x41cd61,null));};exports[_0xcee3('0x4c')]=function(_0x31393e,_0x2726d9){return db[_0xcee3('0x2e')][_0xcee3('0x4c')](_0x31393e[_0xcee3('0x4d')],{})['then'](respondWithResult(_0x2726d9,0xc9))[_0xcee3('0x4b')](handleError(_0x2726d9,null));};exports[_0xcee3('0x27')]=function(_0x20bfc5,_0x27022b){if(_0x20bfc5[_0xcee3('0x4d')]['id']){delete _0x20bfc5[_0xcee3('0x4d')]['id'];}return db['DeskField'][_0xcee3('0x4a')]({'where':{'id':_0x20bfc5['params']['id']}})[_0xcee3('0x42')](handleEntityNotFound(_0x27022b,null))[_0xcee3('0x42')](saveUpdates(_0x20bfc5[_0xcee3('0x4d')],null))['then'](respondWithResult(_0x27022b,null))['catch'](handleError(_0x27022b,null));};exports[_0xcee3('0x28')]=function(_0x319c25,_0x47c149){return db[_0xcee3('0x2e')]['find']({'where':{'id':_0x319c25[_0xcee3('0x47')]['id']}})[_0xcee3('0x42')](handleEntityNotFound(_0x47c149,null))[_0xcee3('0x42')](removeEntity(_0x47c149,null))[_0xcee3('0x4b')](handleError(_0x47c149,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 29cd84b..3ce607d 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 _0x1ebe=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','define','DeskField','int_desk_fields','desk_unique_index','idField'];(function(_0x23c2c1,_0x2fb023){var _0x16640b=function(_0x572f58){while(--_0x572f58){_0x23c2c1['push'](_0x23c2c1['shift']());}};_0x16640b(++_0x2fb023);}(_0x1ebe,0x161));var _0xe1eb=function(_0xe1d6a7,_0x21af20){_0xe1d6a7=_0xe1d6a7-0x0;var _0x3c7562=_0x1ebe[_0xe1d6a7];return _0x3c7562;};'use strict';var _=require(_0xe1eb('0x0'));var util=require(_0xe1eb('0x1'));var logger=require(_0xe1eb('0x2'))(_0xe1eb('0x3'));var moment=require(_0xe1eb('0x4'));var BPromise=require(_0xe1eb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe1eb('0x6'));var rimraf=require(_0xe1eb('0x7'));var config=require(_0xe1eb('0x8'));var attributes=require(_0xe1eb('0x9'));module['exports']=function(_0x38b205,_0x5a0fd5){return _0x38b205[_0xe1eb('0xa')](_0xe1eb('0xb'),attributes,{'tableName':_0xe1eb('0xc'),'paranoid':![],'indexes':[{'name':_0xe1eb('0xd'),'fields':[_0xe1eb('0xe'),_0xe1eb('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4389=['./intDeskField.attributes','exports','define','DeskField','desk_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x25baa1,_0xbb0351){var _0x349f42=function(_0x5c95dd){while(--_0x5c95dd){_0x25baa1['push'](_0x25baa1['shift']());}};_0x349f42(++_0xbb0351);}(_0x4389,0x76));var _0x9438=function(_0x30b0fc,_0x5b7d06){_0x30b0fc=_0x30b0fc-0x0;var _0x481990=_0x4389[_0x30b0fc];return _0x481990;};'use strict';var _=require(_0x9438('0x0'));var util=require(_0x9438('0x1'));var logger=require(_0x9438('0x2'))('api');var moment=require(_0x9438('0x3'));var BPromise=require(_0x9438('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9438('0x5'));var rimraf=require(_0x9438('0x6'));var config=require(_0x9438('0x7'));var attributes=require(_0x9438('0x8'));module[_0x9438('0x9')]=function(_0x52b05f,_0x57bdca){return _0x52b05f[_0x9438('0xa')](_0x9438('0xb'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x9438('0xc'),'fields':['idField',_0x9438('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 8a74320..a9eeea8 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 _0xd58d=['moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x12e073,_0x4d43db){var _0x267748=function(_0x381284){while(--_0x381284){_0x12e073['push'](_0x12e073['shift']());}};_0x267748(++_0x4d43db);}(_0xd58d,0xf1));var _0xdd58=function(_0x4fd08b,_0x3035b5){_0x4fd08b=_0x4fd08b-0x0;var _0x26a5c6=_0xd58d[_0x4fd08b];return _0x26a5c6;};'use strict';var _=require(_0xdd58('0x0'));var util=require('util');var moment=require(_0xdd58('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd58('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd58('0x3'))['db'];var utils=require(_0xdd58('0x4'));var logger=require('../../config/logger')(_0xdd58('0x5'));var config=require(_0xdd58('0x6'));var jayson=require(_0xdd58('0x7'));var client=jayson[_0xdd58('0x8')][_0xdd58('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553509,_0x955cef,_0x3dd4d8){return new BPromise(function(_0xe8a483,_0x15b6b5){return client['request'](_0x553509,_0x3dd4d8)[_0xdd58('0xa')](function(_0x666ca4){logger[_0xdd58('0xb')](_0xdd58('0xc'),_0x955cef,'request\x20sent');logger[_0xdd58('0xd')](_0xdd58('0xe'),_0x955cef,_0xdd58('0xf'),JSON[_0xdd58('0x10')](_0x666ca4));if(_0x666ca4['error']){if(_0x666ca4[_0xdd58('0x11')][_0xdd58('0x12')]===0x1f4){logger[_0xdd58('0x11')]('DeskField,\x20%s,\x20%s',_0x955cef,_0x666ca4[_0xdd58('0x11')][_0xdd58('0x13')]);return _0x15b6b5(_0x666ca4[_0xdd58('0x11')]['message']);}logger[_0xdd58('0x11')]('DeskField,\x20%s,\x20%s',_0x955cef,_0x666ca4['error']['message']);return _0xe8a483(_0x666ca4['error'][_0xdd58('0x13')]);}else{logger[_0xdd58('0xb')](_0xdd58('0xc'),_0x955cef,'request\x20sent');_0xe8a483(_0x666ca4[_0xdd58('0x14')][_0xdd58('0x13')]);}})[_0xdd58('0x15')](function(_0x59e53c){logger[_0xdd58('0x11')](_0xdd58('0xc'),_0x955cef,_0x59e53c);_0x15b6b5(_0x59e53c);});});} \ No newline at end of file +var _0xf683=['DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','DeskField,\x20%s,\x20%s','result','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','client','then','info','debug'];(function(_0x13a3ac,_0x2e6afc){var _0x770689=function(_0x38b17b){while(--_0x38b17b){_0x13a3ac['push'](_0x13a3ac['shift']());}};_0x770689(++_0x2e6afc);}(_0xf683,0x170));var _0x3f68=function(_0x36fb97,_0x50dd70){_0x36fb97=_0x36fb97-0x0;var _0x161267=_0xf683[_0x36fb97];return _0x161267;};'use strict';var _=require('lodash');var util=require(_0x3f68('0x0'));var moment=require(_0x3f68('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f68('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f68('0x3'));var logger=require(_0x3f68('0x4'))('rpc');var config=require(_0x3f68('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3f68('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1881e2,_0x15b1cc,_0x345dff){return new BPromise(function(_0x54c284,_0x1f1921){return client['request'](_0x1881e2,_0x345dff)[_0x3f68('0x7')](function(_0x4c85e){logger[_0x3f68('0x8')]('DeskField,\x20%s,\x20%s',_0x15b1cc,'request\x20sent');logger[_0x3f68('0x9')](_0x3f68('0xa'),_0x15b1cc,_0x3f68('0xb'),JSON[_0x3f68('0xc')](_0x4c85e));if(_0x4c85e['error']){if(_0x4c85e[_0x3f68('0xd')][_0x3f68('0xe')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x15b1cc,_0x4c85e['error'][_0x3f68('0xf')]);return _0x1f1921(_0x4c85e[_0x3f68('0xd')][_0x3f68('0xf')]);}logger['error'](_0x3f68('0x10'),_0x15b1cc,_0x4c85e[_0x3f68('0xd')][_0x3f68('0xf')]);return _0x54c284(_0x4c85e[_0x3f68('0xd')][_0x3f68('0xf')]);}else{logger[_0x3f68('0x8')](_0x3f68('0x10'),_0x15b1cc,_0x3f68('0xb'));_0x54c284(_0x4c85e[_0x3f68('0x11')]['message']);}})['catch'](function(_0xd4500e){logger[_0x3f68('0xd')]('DeskField,\x20%s,\x20%s',_0x15b1cc,_0xd4500e);_0x1f1921(_0xd4500e);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 29e4cfe..9abfd2c 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 _0x7069=['express','fs-extra','./intDynamics365Account.controller','get','index','/:id','isAuthenticated','getFields','post','create','/:id/configurations','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x5aaba8,_0x248b94){var _0x13f7e3=function(_0x2db2c5){while(--_0x2db2c5){_0x5aaba8['push'](_0x5aaba8['shift']());}};_0x13f7e3(++_0x248b94);}(_0x7069,0x1eb));var _0x9706=function(_0x4dd4bf,_0x3d0380){_0x4dd4bf=_0x4dd4bf-0x0;var _0x18e625=_0x7069[_0x4dd4bf];return _0x18e625;};'use strict';var multer=require(_0x9706('0x0'));var util=require(_0x9706('0x1'));var path=require(_0x9706('0x2'));var timeout=require('connect-timeout');var express=require(_0x9706('0x3'));var router=express['Router']();var fs_extra=require(_0x9706('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9706('0x5'));router[_0x9706('0x6')]('/',auth['isAuthenticated'](),controller[_0x9706('0x7')]);router['get'](_0x9706('0x8'),auth[_0x9706('0x9')](),controller['show']);router[_0x9706('0x6')]('/:id/configurations',auth[_0x9706('0x9')](),controller['getConfigurations']);router[_0x9706('0x6')]('/:id/fields',auth[_0x9706('0x9')](),controller[_0x9706('0xa')]);router[_0x9706('0xb')]('/',auth['isAuthenticated'](),controller[_0x9706('0xc')]);router[_0x9706('0xb')](_0x9706('0xd'),auth[_0x9706('0x9')](),controller[_0x9706('0xe')]);router[_0x9706('0xf')](_0x9706('0x8'),auth[_0x9706('0x9')](),controller[_0x9706('0x10')]);router['delete']('/:id',auth[_0x9706('0x9')](),controller[_0x9706('0x11')]);module[_0x9706('0x12')]=router; \ No newline at end of file +var _0x1003=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','index','show','/:id/configurations','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','/:id'];(function(_0x4c27fb,_0x3cc27d){var _0xcdbabb=function(_0x587dd3){while(--_0x587dd3){_0x4c27fb['push'](_0x4c27fb['shift']());}};_0xcdbabb(++_0x3cc27d);}(_0x1003,0x1b3));var _0x3100=function(_0x50f903,_0x2e3a32){_0x50f903=_0x50f903-0x0;var _0x20358d=_0x1003[_0x50f903];return _0x20358d;};'use strict';var multer=require(_0x3100('0x0'));var util=require('util');var path=require(_0x3100('0x1'));var timeout=require(_0x3100('0x2'));var express=require(_0x3100('0x3'));var router=express[_0x3100('0x4')]();var fs_extra=require(_0x3100('0x5'));var auth=require(_0x3100('0x6'));var interaction=require(_0x3100('0x7'));var config=require('../../config/environment');var controller=require(_0x3100('0x8'));router[_0x3100('0x9')]('/',auth['isAuthenticated'](),controller[_0x3100('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3100('0xb')]);router['get'](_0x3100('0xc'),auth['isAuthenticated'](),controller[_0x3100('0xd')]);router['get'](_0x3100('0xe'),auth[_0x3100('0xf')](),controller[_0x3100('0x10')]);router[_0x3100('0x11')]('/',auth[_0x3100('0xf')](),controller['create']);router[_0x3100('0x11')](_0x3100('0xc'),auth[_0x3100('0xf')](),controller[_0x3100('0x12')]);router[_0x3100('0x13')](_0x3100('0x14'),auth[_0x3100('0xf')](),controller['update']);router[_0x3100('0x15')]('/:id',auth[_0x3100('0xf')](),controller[_0x3100('0x16')]);module[_0x3100('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index d5afa95..3825761 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 _0xdbf5=['exports','STRING','BOOLEAN'];(function(_0x5f416,_0xfbab7){var _0x5ec0cd=function(_0x249db6){while(--_0x249db6){_0x5f416['push'](_0x5f416['shift']());}};_0x5ec0cd(++_0xfbab7);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x4a1f0e,_0x65a426){_0x4a1f0e=_0x4a1f0e-0x0;var _0x36488b=_0xdbf5[_0x4a1f0e];return _0x36488b;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x5dbf('0x1')]},'remoteUri':{'type':Sequelize[_0x5dbf('0x1')]},'tenantId':{'type':Sequelize[_0x5dbf('0x1')]},'clientId':{'type':Sequelize[_0x5dbf('0x1')]},'clientSecret':{'type':Sequelize[_0x5dbf('0x1')]},'serverUrl':{'type':Sequelize[_0x5dbf('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x5dbf('0x1')]},'modernAuthentication':{'type':Sequelize[_0x5dbf('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb2ac=['STRING','BOOLEAN','sequelize','exports'];(function(_0x3e1efa,_0x548431){var _0x12ab20=function(_0x4abd9a){while(--_0x4abd9a){_0x3e1efa['push'](_0x3e1efa['shift']());}};_0x12ab20(++_0x548431);}(_0xb2ac,0x16a));var _0xcb2a=function(_0x1878f9,_0x5d148d){_0x1878f9=_0x1878f9-0x0;var _0x56da65=_0xb2ac[_0x1878f9];return _0x56da65;};'use strict';var Sequelize=require(_0xcb2a('0x0'));module[_0xcb2a('0x1')]={'name':{'type':Sequelize[_0xcb2a('0x2')]},'username':{'type':Sequelize[_0xcb2a('0x2')]},'password':{'type':Sequelize[_0xcb2a('0x2')]},'remoteUri':{'type':Sequelize[_0xcb2a('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xcb2a('0x2')]},'clientSecret':{'type':Sequelize[_0xcb2a('0x2')]},'serverUrl':{'type':Sequelize[_0xcb2a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xcb2a('0x2')]},'modernAuthentication':{'type':Sequelize[_0xcb2a('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 f26c671..657a300 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 _0xa596=['Descriptions','getDescriptions','Dynamics365Field','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','Incident','PhoneCall','title','description','ownerid','caseorigincode','phonenumber','regardingobjectid','phonecall_activity_parties','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyname','createdbyyominame','createdonbehalfbyyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientId','data5','modernAuthentication','access_token','CloudProvider','data7','/oauth2/token','clientSecret','GET','Bearer\x20','4.0','MetadataId','Attributes','remove','includes','LogicalName','forEach','@odata.type','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Label','UserLocalizedLabel','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','request-promise','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','offset','limit','count','set','update','then','destroy','status','sendStatus','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','hasOwnProperty','sort','where','merge','type','filter','options','includeAll','findAll','rows','catch','show','params','keys','fields','length','include','find','create','body','Dynamics365Configuration','order','nolimit','addConfiguration','findOne','getSubjects','channel'];(function(_0x541260,_0x4c7f2e){var _0x1dd2b5=function(_0x4140de){while(--_0x4140de){_0x541260['push'](_0x541260['shift']());}};_0x1dd2b5(++_0x4c7f2e);}(_0xa596,0x7b));var _0x6a59=function(_0x20c108,_0x6dc8b0){_0x20c108=_0x20c108-0x0;var _0x271ec5=_0xa596[_0x20c108];return _0x271ec5;};'use strict';var rp=require(_0x6a59('0x0'));var util=require(_0x6a59('0x1'));var _=require('lodash');var qs=require(_0x6a59('0x2'));var logger=require(_0x6a59('0x3'))(_0x6a59('0x4'));var db=require(_0x6a59('0x5'))['db'];var integrations=require(_0x6a59('0x6'));function respondWithResult(_0xf0435f,_0x11cce1){_0x11cce1=_0x11cce1||0xc8;return function(_0x272793){if(_0x272793){return _0xf0435f['status'](_0x11cce1)[_0x6a59('0x7')](_0x272793);}};}function respondWithFilteredResult(_0x3fab57,_0x21e97f){return function(_0x375a77){if(_0x375a77){var _0xb50532=typeof _0x21e97f[_0x6a59('0x8')]==='undefined'&&typeof _0x21e97f[_0x6a59('0x9')]==='undefined';var _0x21008c=_0x375a77['count'];var _0x55ef5b=_0xb50532?0x0:_0x21e97f[_0x6a59('0x8')];var _0x6e6ef7=_0xb50532?_0x375a77[_0x6a59('0xa')]:_0x21e97f['offset']+_0x21e97f[_0x6a59('0x9')];var _0x459924;if(_0x6e6ef7>=_0x21008c){_0x6e6ef7=_0x21008c;_0x459924=0xc8;}else{_0x459924=0xce;}_0x3fab57['status'](_0x459924);return _0x3fab57[_0x6a59('0xb')]('Content-Range',_0x55ef5b+'-'+_0x6e6ef7+'/'+_0x21008c)[_0x6a59('0x7')](_0x375a77);}return null;};}function saveUpdates(_0x3075ca){return function(_0x177506){if(_0x177506){return _0x177506[_0x6a59('0xc')](_0x3075ca)[_0x6a59('0xd')](function(_0x108c02){return _0x108c02;});}return null;};}function removeEntity(_0x1a1e36){return function(_0xb2fd50){if(_0xb2fd50){return _0xb2fd50[_0x6a59('0xe')]()[_0x6a59('0xd')](function(){_0x1a1e36[_0x6a59('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20aa2e){return function(_0x1ec768){if(!_0x1ec768){_0x20aa2e[_0x6a59('0x10')](0x194);}return _0x1ec768;};}function handleError(_0x2cd31a,_0x258441){_0x258441=_0x258441||0x1f4;return function(_0x39ad1e){logger['error'](_0x39ad1e[_0x6a59('0x11')]);if(_0x39ad1e[_0x6a59('0x12')]){delete _0x39ad1e[_0x6a59('0x12')];}_0x2cd31a[_0x6a59('0xf')](_0x258441)[_0x6a59('0x13')](_0x39ad1e);};}exports[_0x6a59('0x14')]=function(_0x4988e2,_0x3740b1){var _0xe7d724={},_0x2ac36d={},_0x31c9b3={'count':0x0,'rows':[]};var _0x34bde4=_[_0x6a59('0x15')](db[_0x6a59('0x16')][_0x6a59('0x17')],function(_0x2ae2ce){return{'name':_0x2ae2ce[_0x6a59('0x18')],'type':_0x2ae2ce['type'][_0x6a59('0x19')]};});_0x2ac36d[_0x6a59('0x1a')]=_[_0x6a59('0x15')](_0x34bde4,_0x6a59('0x12'));_0x2ac36d['query']=_['keys'](_0x4988e2[_0x6a59('0x1b')]);_0x2ac36d[_0x6a59('0x1c')]=_[_0x6a59('0x1d')](_0x2ac36d[_0x6a59('0x1a')],_0x2ac36d['query']);_0xe7d724['attributes']=_[_0x6a59('0x1d')](_0x2ac36d[_0x6a59('0x1a')],qs['fields'](_0x4988e2[_0x6a59('0x1b')]['fields']));_0xe7d724[_0x6a59('0x1e')]=_0xe7d724[_0x6a59('0x1e')]['length']?_0xe7d724[_0x6a59('0x1e')]:_0x2ac36d['model'];if(!_0x4988e2[_0x6a59('0x1b')][_0x6a59('0x1f')]('nolimit')){_0xe7d724[_0x6a59('0x9')]=qs['limit'](_0x4988e2[_0x6a59('0x1b')][_0x6a59('0x9')]);_0xe7d724[_0x6a59('0x8')]=qs[_0x6a59('0x8')](_0x4988e2[_0x6a59('0x1b')][_0x6a59('0x8')]);}_0xe7d724['order']=qs['sort'](_0x4988e2[_0x6a59('0x1b')][_0x6a59('0x20')]);_0xe7d724['where']=qs[_0x6a59('0x1c')](_['pick'](_0x4988e2[_0x6a59('0x1b')],_0x2ac36d[_0x6a59('0x1c')]),_0x34bde4);if(_0x4988e2[_0x6a59('0x1b')]['filter']){_0xe7d724[_0x6a59('0x21')]=_[_0x6a59('0x22')](_0xe7d724[_0x6a59('0x21')],{'$or':_['map'](_0x34bde4,function(_0x25fc63){if(_0x25fc63[_0x6a59('0x23')]!=='VIRTUAL'){var _0x3b8c8f={};_0x3b8c8f[_0x25fc63['name']]={'$like':'%'+_0x4988e2[_0x6a59('0x1b')][_0x6a59('0x24')]+'%'};return _0x3b8c8f;}})});}_0xe7d724=_['merge']({},_0xe7d724,_0x4988e2[_0x6a59('0x25')]);var _0x2af776={'where':_0xe7d724['where']};return db['Dynamics365Account']['count'](_0x2af776)['then'](function(_0x49542a){_0x31c9b3[_0x6a59('0xa')]=_0x49542a;if(_0x4988e2[_0x6a59('0x1b')][_0x6a59('0x26')]){_0xe7d724['include']=[{'all':!![]}];}return db[_0x6a59('0x16')][_0x6a59('0x27')](_0xe7d724);})['then'](function(_0x593de8){_0x31c9b3[_0x6a59('0x28')]=_0x593de8;return _0x31c9b3;})['then'](respondWithFilteredResult(_0x3740b1,_0xe7d724))[_0x6a59('0x29')](handleError(_0x3740b1,null));};exports[_0x6a59('0x2a')]=function(_0x38f8e5,_0x3077d5){var _0x31b9bc={'raw':![],'where':{'id':_0x38f8e5[_0x6a59('0x2b')]['id']}},_0x1a57f8={};_0x1a57f8[_0x6a59('0x1a')]=_[_0x6a59('0x2c')](db[_0x6a59('0x16')][_0x6a59('0x17')]);_0x1a57f8[_0x6a59('0x1b')]=_[_0x6a59('0x2c')](_0x38f8e5[_0x6a59('0x1b')]);_0x1a57f8[_0x6a59('0x1c')]=_[_0x6a59('0x1d')](_0x1a57f8['model'],_0x1a57f8[_0x6a59('0x1b')]);_0x31b9bc['attributes']=_[_0x6a59('0x1d')](_0x1a57f8[_0x6a59('0x1a')],qs[_0x6a59('0x2d')](_0x38f8e5[_0x6a59('0x1b')][_0x6a59('0x2d')]));_0x31b9bc[_0x6a59('0x1e')]=_0x31b9bc[_0x6a59('0x1e')][_0x6a59('0x2e')]?_0x31b9bc[_0x6a59('0x1e')]:_0x1a57f8['model'];if(_0x38f8e5[_0x6a59('0x1b')][_0x6a59('0x26')]){_0x31b9bc[_0x6a59('0x2f')]=[{'all':!![]}];}_0x31b9bc=_['merge']({},_0x31b9bc,_0x38f8e5['options']);return db[_0x6a59('0x16')][_0x6a59('0x30')](_0x31b9bc)[_0x6a59('0xd')](handleEntityNotFound(_0x3077d5,null))['then'](respondWithResult(_0x3077d5,null))[_0x6a59('0x29')](handleError(_0x3077d5,null));};exports[_0x6a59('0x31')]=function(_0x399532,_0x55734f){return db['Dynamics365Account'][_0x6a59('0x31')](_0x399532[_0x6a59('0x32')],{})[_0x6a59('0xd')](respondWithResult(_0x55734f,0xc9))[_0x6a59('0x29')](handleError(_0x55734f,null));};exports[_0x6a59('0xc')]=function(_0xf6225d,_0x55fc69){if(_0xf6225d['body']['id']){delete _0xf6225d[_0x6a59('0x32')]['id'];}return db['Dynamics365Account'][_0x6a59('0x30')]({'where':{'id':_0xf6225d[_0x6a59('0x2b')]['id']}})['then'](handleEntityNotFound(_0x55fc69,null))[_0x6a59('0xd')](saveUpdates(_0xf6225d[_0x6a59('0x32')],null))[_0x6a59('0xd')](respondWithResult(_0x55fc69,null))[_0x6a59('0x29')](handleError(_0x55fc69,null));};exports[_0x6a59('0xe')]=function(_0x481ed2,_0x239156){return db['Dynamics365Account']['find']({'where':{'id':_0x481ed2['params']['id']}})[_0x6a59('0xd')](handleEntityNotFound(_0x239156,null))[_0x6a59('0xd')](removeEntity(_0x239156,null))[_0x6a59('0x29')](handleError(_0x239156,null));};exports['getConfigurations']=function(_0x3aa691,_0x147653){var _0x10e4fe={};var _0x5bfe13={};var _0x4f3e48;var _0x53fc5e;return db[_0x6a59('0x16')]['findOne']({'where':{'id':_0x3aa691[_0x6a59('0x2b')]['id']}})[_0x6a59('0xd')](handleEntityNotFound(_0x147653,null))['then'](function(_0x5d9312){if(_0x5d9312){_0x4f3e48=_0x5d9312;_0x5bfe13['model']=_[_0x6a59('0x2c')](db[_0x6a59('0x33')][_0x6a59('0x17')]);_0x5bfe13[_0x6a59('0x1b')]=_[_0x6a59('0x2c')](_0x3aa691[_0x6a59('0x1b')]);_0x5bfe13[_0x6a59('0x1c')]=_['intersection'](_0x5bfe13[_0x6a59('0x1a')],_0x5bfe13[_0x6a59('0x1b')]);_0x10e4fe[_0x6a59('0x1e')]=_[_0x6a59('0x1d')](_0x5bfe13[_0x6a59('0x1a')],qs['fields'](_0x3aa691[_0x6a59('0x1b')][_0x6a59('0x2d')]));_0x10e4fe[_0x6a59('0x1e')]=_0x10e4fe[_0x6a59('0x1e')][_0x6a59('0x2e')]?_0x10e4fe[_0x6a59('0x1e')]:_0x5bfe13['model'];_0x10e4fe[_0x6a59('0x34')]=qs['sort'](_0x3aa691[_0x6a59('0x1b')][_0x6a59('0x20')]);_0x10e4fe[_0x6a59('0x21')]=qs['filters'](_['pick'](_0x3aa691['query'],_0x5bfe13[_0x6a59('0x1c')]));if(_0x3aa691[_0x6a59('0x1b')]['filter']){_0x10e4fe[_0x6a59('0x21')]=_[_0x6a59('0x22')](_0x10e4fe[_0x6a59('0x21')],{'$or':_[_0x6a59('0x15')](_0x10e4fe['attributes'],function(_0x4d5803){var _0x2bbd9b={};_0x2bbd9b[_0x4d5803]={'$like':'%'+_0x3aa691[_0x6a59('0x1b')][_0x6a59('0x24')]+'%'};return _0x2bbd9b;})});}_0x10e4fe=_[_0x6a59('0x22')]({},_0x10e4fe,_0x3aa691[_0x6a59('0x25')]);return _0x4f3e48['getConfigurations'](_0x10e4fe);}})['then'](function(_0x1a118e){if(_0x1a118e){_0x53fc5e=_0x1a118e[_0x6a59('0x2e')];if(!_0x3aa691[_0x6a59('0x1b')]['hasOwnProperty'](_0x6a59('0x35'))){_0x10e4fe['limit']=qs[_0x6a59('0x9')](_0x3aa691[_0x6a59('0x1b')]['limit']);_0x10e4fe[_0x6a59('0x8')]=qs[_0x6a59('0x8')](_0x3aa691[_0x6a59('0x1b')][_0x6a59('0x8')]);}return _0x4f3e48['getConfigurations'](_0x10e4fe);}})[_0x6a59('0xd')](function(_0x3b9bca){if(_0x3b9bca){return _0x3b9bca?{'count':_0x53fc5e,'rows':_0x3b9bca}:null;}})[_0x6a59('0xd')](respondWithResult(_0x147653,null))[_0x6a59('0x29')](handleError(_0x147653,null));};exports[_0x6a59('0x36')]=function(_0x81a9e0,_0x5c7cb7){if(_0x81a9e0[_0x6a59('0x32')]['id']){delete _0x81a9e0[_0x6a59('0x32')]['id'];}return db[_0x6a59('0x16')][_0x6a59('0x37')]({'where':{'id':_0x81a9e0['params']['id']}})[_0x6a59('0xd')](handleEntityNotFound(_0x5c7cb7,null))[_0x6a59('0xd')](function(_0x558431){if(_0x558431){_0x81a9e0[_0x6a59('0x32')]['AccountId']=_0x558431['id'];_0x81a9e0[_0x6a59('0x32')]['Subjects']=integrations[_0x6a59('0x38')](_0x81a9e0[_0x6a59('0x32')][_0x6a59('0x39')],_0x81a9e0[_0x6a59('0x32')][_0x6a59('0x23')]);_0x81a9e0[_0x6a59('0x32')][_0x6a59('0x3a')]=integrations[_0x6a59('0x3b')](_0x81a9e0[_0x6a59('0x32')][_0x6a59('0x39')],_0x81a9e0[_0x6a59('0x32')][_0x6a59('0x23')]);return db[_0x6a59('0x33')]['create'](_0x81a9e0[_0x6a59('0x32')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0x6a59('0x3c')],'as':_0x6a59('0x3a')}]});}return null;})['then'](respondWithResult(_0x5c7cb7,null))['catch'](handleError(_0x5c7cb7,null));};function sanitizeRemoteUri(_0x5dcaab){var _0x329b04=_0x5dcaab['slice'](-0x1);if(_0x329b04==='/')return _0x5dcaab[_0x6a59('0x3d')](0x0,_0x5dcaab[_0x6a59('0x3e')](_0x329b04));return _0x5dcaab;}function getWebApiUrl(_0x316844){return util[_0x6a59('0x3f')](_0x6a59('0x40'),_0x316844);}exports[_0x6a59('0x41')]=function(_0x4c1ce4,_0x2e86b9){var _0x2f98ea=_0x4c1ce4[_0x6a59('0x1b')][_0x6a59('0x42')];var _0x1f6666=_0x2f98ea==='incident'?_0x6a59('0x43'):_0x6a59('0x44');var _0x425233='';var _0xe6227e='';var _0x1bcfe9='';var _0x406f18='';var _0x5a9c68='';var _0x2e6637='';var _0x569cf4='';var _0x4b5005='';var _0x4630ef=[_0x6a59('0x45'),_0x6a59('0x46'),'customerid',_0x6a59('0x47'),_0x6a59('0x48'),'subject',_0x6a59('0x49'),_0x6a59('0x4a'),'directioncode',_0x6a59('0x4b')];var _0xa146c5=['accountidname',_0x6a59('0x4c'),'actualserviceunits',_0x6a59('0x4d'),_0x6a59('0x4e'),_0x6a59('0x4f'),_0x6a59('0x50'),_0x6a59('0x51'),'createdbyexternalpartyname','createdbyexternalpartyyominame',_0x6a59('0x52'),_0x6a59('0x53'),'createdon','createdonbehalfbyname',_0x6a59('0x54'),'customeridname','customeridtype','customeridyominame',_0x6a59('0x55'),_0x6a59('0x56'),'entityimage_timestamp',_0x6a59('0x57'),_0x6a59('0x58'),_0x6a59('0x59'),'firstresponsebykpiidname',_0x6a59('0x5a'),_0x6a59('0x5b'),_0x6a59('0x5c'),_0x6a59('0x5d'),_0x6a59('0x5e'),_0x6a59('0x5f'),_0x6a59('0x60'),'modifiedbyexternalpartyyominame',_0x6a59('0x61'),_0x6a59('0x62'),_0x6a59('0x63'),_0x6a59('0x64'),_0x6a59('0x65'),_0x6a59('0x66'),_0x6a59('0x67'),'numberofchildincidents','onholdtime',_0x6a59('0x68'),_0x6a59('0x69'),_0x6a59('0x6a'),_0x6a59('0x6b'),_0x6a59('0x6c'),_0x6a59('0x6d'),'primarycontactidyominame',_0x6a59('0x6e'),'productidname',_0x6a59('0x6f'),_0x6a59('0x70'),_0x6a59('0x71'),_0x6a59('0x72'),_0x6a59('0x73'),_0x6a59('0x74'),_0x6a59('0x75'),'slainvokedidname',_0x6a59('0x76'),_0x6a59('0x77'),_0x6a59('0x78'),_0x6a59('0x79'),_0x6a59('0x7a'),'ticketnumber',_0x6a59('0x7b'),_0x6a59('0x7c'),_0x6a59('0x7d'),_0x6a59('0x7e'),_0x6a59('0x7f')];var _0x18440d=_0x4630ef[_0x6a59('0x80')](_0xa146c5);return db[_0x6a59('0x16')]['findOne']({'where':{'id':_0x4c1ce4[_0x6a59('0x2b')]['id']},'attributes':['id',_0x6a59('0x81'),_0x6a59('0x82'),_0x6a59('0x83'),'tenantId',_0x6a59('0x84'),'clientSecret','modernAuthentication'],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','attributes':['id',_0x6a59('0x85'),'data7']}]})[_0x6a59('0xd')](handleEntityNotFound(_0x2e86b9,null))[_0x6a59('0xd')](function(_0x323357){if(_0x323357){if(_0x323357[_0x6a59('0x86')]){_0x323357[_0x6a59('0x87')]=_0x323357[_0x6a59('0x88')][_0x6a59('0x85')];_0x4b5005=sanitizeRemoteUri(_0x323357[_0x6a59('0x88')][_0x6a59('0x89')]);_0x569cf4=getWebApiUrl(_0x4b5005);return _0x323357;}_0x4b5005=sanitizeRemoteUri(_0x323357[_0x6a59('0x83')]);_0x569cf4=getWebApiUrl(_0x4b5005);var _0x498daa={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x323357['tenantId']+_0x6a59('0x8a'),'form':{'client_id':_0x323357['clientId'],'resource':_0x4b5005,'username':_0x323357[_0x6a59('0x81')],'password':_0x323357['password'],'grant_type':'password','client_secret':_0x323357[_0x6a59('0x8b')]},'json':!![]};return rp(_0x498daa);}})[_0x6a59('0xd')](function(_0x38430e){_0x2e6637=_0x38430e[_0x6a59('0x87')];var _0x388d1c={'method':_0x6a59('0x8c'),'uri':encodeURI(_0x569cf4+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x1f6666+'\x27'),'headers':{'Authorization':_0x6a59('0x8d')+_0x2e6637,'If-None-Match':null,'OData-Version':_0x6a59('0x8e')},'json':!![]};return rp(_0x388d1c);})[_0x6a59('0xd')](function(_0x330fb6){var _0x3377a5=_0x330fb6['value'][0x0];var _0x5a38e2=_0x3377a5[_0x6a59('0x8f')];var _0x5d7c15={'method':_0x6a59('0x8c'),'uri':_0x569cf4+'EntityDefinitions('+_0x5a38e2+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x6a59('0x8d')+_0x2e6637,'If-None-Match':null,'OData-Version':_0x6a59('0x8e')},'json':!![]};return rp(_0x5d7c15);})[_0x6a59('0xd')](function(_0x354700){_0x425233=_0x354700;_0xe6227e=_0x425233[_0x6a59('0x90')];_0xe6227e=_[_0x6a59('0x91')](_0xe6227e,function(_0x116039){return!_0x18440d[_0x6a59('0x92')](_0x116039[_0x6a59('0x93')]);});var _0x560d9a=[];var _0x140cfb=[];_0xe6227e[_0x6a59('0x94')](function(_0x33de47){if(_0x33de47[_0x6a59('0x95')]){var _0x5164a6=_0x33de47[_0x6a59('0x95')]['substring'](_0x33de47[_0x6a59('0x95')]['lastIndexOf']('.')+0x1);if(_0x5164a6==='PicklistAttributeMetadata'){_0x560d9a[_0x6a59('0x96')](getSelectList(_0x569cf4,_0x2f98ea,_0x140cfb,_0x425233[_0x6a59('0x8f')],_0x33de47[_0x6a59('0x8f')],_0x2e6637));}}});return Promise[_0x6a59('0x97')](_0x560d9a);})[_0x6a59('0xd')](function(_0x18ad1f){_0x1bcfe9=_0x18ad1f[0x0];var _0x10752c=[];var _0x459b03=[];_0xe6227e['forEach'](function(_0x18b2cc){if(!_[_0x6a59('0x98')](_0x18b2cc[_0x6a59('0x95')])){var _0x263ec0=_0x18b2cc[_0x6a59('0x95')][_0x6a59('0x3d')](_0x18b2cc[_0x6a59('0x95')][_0x6a59('0x3e')]('.')+0x1);if(_0x263ec0===_0x6a59('0x99')){_0x10752c[_0x6a59('0x96')](getBooleanList(_0x569cf4,_0x2f98ea,_0x459b03,_0x425233[_0x6a59('0x8f')],_0x18b2cc[_0x6a59('0x8f')],_0x2e6637));}}});return Promise[_0x6a59('0x97')](_0x10752c);})['then'](function(_0xc160f){_0x406f18=_0xc160f[0x0];var _0x106b18=[];var _0x3d438c=[];_0xe6227e[_0x6a59('0x94')](function(_0x1bcb94){if(_0x1bcb94[_0x6a59('0x95')]){var _0x2353c9=_0x1bcb94[_0x6a59('0x95')][_0x6a59('0x3d')](_0x1bcb94['@odata.type'][_0x6a59('0x3e')]('.')+0x1);if(_0x2353c9===_0x6a59('0x9a')||_0x2353c9===_0x6a59('0x9b')||_0x2353c9===_0x6a59('0x9c')||_0x2353c9===_0x6a59('0x9d')||_0x2353c9===_0x6a59('0x9e')||_0x2353c9===_0x6a59('0x9f')||_0x2353c9==='StatusAttributeMetadata'||_0x2353c9===_0x6a59('0xa0')||_0x2353c9===_0x6a59('0xa1')||_0x2353c9===_0x6a59('0xa2')){_0x106b18['push'](getInputList(_0x569cf4,_0x2f98ea,_0x2353c9,_0x3d438c,_0x425233['MetadataId'],_0x1bcb94['MetadataId'],_0x2e6637));}}});return Promise[_0x6a59('0x97')](_0x106b18);})[_0x6a59('0xd')](function(_0x183740){_0x5a9c68=_0x183740[0x0];var _0x528178=_0x1bcfe9[_0x6a59('0x80')](_0x406f18)['concat'](_0x5a9c68);var _0x405cac={'count':_0x528178[_0x6a59('0x2e')],'rows':_0x528178};return _0x405cac;})['then'](respondWithResult(_0x2e86b9,null))[_0x6a59('0x29')](function(_0x426429){var _0x372a61=_0x4c1ce4[_0x6a59('0x1b')][_0x6a59('0xa3')]?0x1f4:_0x426429[_0x6a59('0xa4')]||0x1f4;logger[_0x6a59('0xa5')](_0x426429[_0x6a59('0x11')]);delete _0x426429[_0x6a59('0x12')];if(_0x372a61===0x191){_0x372a61=0x190;}_0x2e86b9[_0x6a59('0xf')](_0x372a61)[_0x6a59('0x13')](_0x4c1ce4['query'][_0x6a59('0xa3')]?{'message':_0x6a59('0xa6'),'statusCode':_0x426429['statusCode']}:_0x426429);});};function getSelectList(_0x4b95e0,_0x333170,_0x49f1fd,_0x40e345,_0x2f9179,_0x32c23e){var _0x51931d={'method':_0x6a59('0x8c'),'uri':_0x4b95e0+_0x6a59('0xa7')+_0x40e345+_0x6a59('0xa8')+_0x2f9179+_0x6a59('0xa9')+_0x6a59('0xaa'),'headers':{'Authorization':'Bearer\x20'+_0x32c23e,'If-None-Match':null,'OData-Version':_0x6a59('0x8e')},'json':!![]};return rp(_0x51931d)[_0x6a59('0xd')](function(_0x2ab8a7){var _0xd41e55=[];var _0x34e39a=_0x2ab8a7['OptionSet']['Options'];_0x34e39a[_0x6a59('0x94')](function(_0x483858){_0xd41e55[_0x6a59('0x96')]({'name':_0x483858[_0x6a59('0xab')][_0x6a59('0xac')][_0x6a59('0xab')],'value':String(_0x483858['Value'])});});var _0x494280={'id':_0x333170+'_'+_0x2ab8a7['LogicalName'],'name':_0x2ab8a7[_0x6a59('0xad')][_0x6a59('0xac')]['Label'],'custom':![],'options':_0xd41e55};_0x49f1fd[_0x6a59('0x96')](_0x494280);return _0x49f1fd;});}function getBooleanList(_0x5b5cce,_0x24b506,_0xac4f3e,_0x372945,_0x498556,_0x4ad481){var _0x3f878c={'method':_0x6a59('0x8c'),'uri':_0x5b5cce+_0x6a59('0xa7')+_0x372945+_0x6a59('0xa8')+_0x498556+_0x6a59('0xae'),'headers':{'Authorization':_0x6a59('0x8d')+_0x4ad481,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3f878c)[_0x6a59('0xd')](function(_0x4cdbb1){var _0x30edcd=[];_0x30edcd['push']({'name':_0x4cdbb1[_0x6a59('0xaf')][_0x6a59('0xb0')][_0x6a59('0xab')][_0x6a59('0xac')][_0x6a59('0xab')],'value':_0x6a59('0xb1')},{'name':_0x4cdbb1[_0x6a59('0xaf')][_0x6a59('0xb2')]['Label'][_0x6a59('0xac')][_0x6a59('0xab')],'value':_0x6a59('0xb3')});var _0x55f1dd={'id':_0x24b506+'_'+_0x4cdbb1['LogicalName'],'name':_0x4cdbb1[_0x6a59('0xad')][_0x6a59('0xac')][_0x6a59('0xab')],'custom':![],'options':_0x30edcd};_0xac4f3e[_0x6a59('0x96')](_0x55f1dd);return _0xac4f3e;});}function getInputList(_0x23212e,_0xf6d4a3,_0x179823,_0x340338,_0x319dff,_0x5f0a3d,_0x3695d3){var _0x1dcce4={'method':_0x6a59('0x8c'),'uri':_0x23212e+_0x6a59('0xa7')+_0x319dff+_0x6a59('0xa8')+_0x5f0a3d+')/Microsoft.Dynamics.CRM.'+_0x179823+_0x6a59('0xb4'),'headers':{'Authorization':_0x6a59('0x8d')+_0x3695d3,'If-None-Match':null,'OData-Version':_0x6a59('0x8e')},'json':!![]};return rp(_0x1dcce4)[_0x6a59('0xd')](function(_0x32d1c1){var _0x4f1e4f={'id':_0xf6d4a3+'_'+_0x32d1c1[_0x6a59('0x93')],'name':_0x32d1c1[_0x6a59('0xad')][_0x6a59('0xac')]?_0x32d1c1['DisplayName'][_0x6a59('0xac')][_0x6a59('0xab')]:_0x32d1c1['LogicalName'],'custom':![],'options':[]};_0x340338['push'](_0x4f1e4f);return _0x340338;});} \ No newline at end of file +var _0xb910=['hasOwnProperty','AccountId','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','format','getFields','ticketType','incident','Incident','title','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','contactidname','contractdetailidname','contractidname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','kbarticleidname','modifiedbyexternalpartyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','username','password','clientSecret','modernAuthentication','CloudProvider','data5','data7','https://login.microsoftonline.com/','tenantId','clientId','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','LogicalName','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','forEach','StringAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','FalseOption','false','?$select=DisplayName,LogicalName','DisplayName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','keys','options','find','create','body','getConfigurations','findOne','Dynamics365Configuration','order'];(function(_0x277bd0,_0x25c006){var _0x4e92b7=function(_0x2996f4){while(--_0x2996f4){_0x277bd0['push'](_0x277bd0['shift']());}};_0x4e92b7(++_0x25c006);}(_0xb910,0x12b));var _0x0b91=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xb910[_0xaa0309];return _0x5de7ce;};'use strict';var rp=require(_0x0b91('0x0'));var util=require(_0x0b91('0x1'));var _=require(_0x0b91('0x2'));var qs=require(_0x0b91('0x3'));var logger=require(_0x0b91('0x4'))(_0x0b91('0x5'));var db=require(_0x0b91('0x6'))['db'];var integrations=require(_0x0b91('0x7'));function respondWithResult(_0x16ba05,_0x1bfbc7){_0x1bfbc7=_0x1bfbc7||0xc8;return function(_0x432232){if(_0x432232){return _0x16ba05[_0x0b91('0x8')](_0x1bfbc7)[_0x0b91('0x9')](_0x432232);}};}function respondWithFilteredResult(_0x1800dc,_0x5a22b6){return function(_0x156fd1){if(_0x156fd1){var _0xc65d86=typeof _0x5a22b6[_0x0b91('0xa')]===_0x0b91('0xb')&&typeof _0x5a22b6[_0x0b91('0xc')]===_0x0b91('0xb');var _0x4118b8=_0x156fd1[_0x0b91('0xd')];var _0x42e3dc=_0xc65d86?0x0:_0x5a22b6['offset'];var _0x2a38a3=_0xc65d86?_0x156fd1['count']:_0x5a22b6[_0x0b91('0xa')]+_0x5a22b6['limit'];var _0x4ee548;if(_0x2a38a3>=_0x4118b8){_0x2a38a3=_0x4118b8;_0x4ee548=0xc8;}else{_0x4ee548=0xce;}_0x1800dc[_0x0b91('0x8')](_0x4ee548);return _0x1800dc[_0x0b91('0xe')](_0x0b91('0xf'),_0x42e3dc+'-'+_0x2a38a3+'/'+_0x4118b8)[_0x0b91('0x9')](_0x156fd1);}return null;};}function saveUpdates(_0x5b6f36){return function(_0x2e8430){if(_0x2e8430){return _0x2e8430[_0x0b91('0x10')](_0x5b6f36)[_0x0b91('0x11')](function(_0x2ec488){return _0x2ec488;});}return null;};}function removeEntity(_0x590128){return function(_0x5e1ac4){if(_0x5e1ac4){return _0x5e1ac4[_0x0b91('0x12')]()[_0x0b91('0x11')](function(){_0x590128[_0x0b91('0x8')](0xcc)[_0x0b91('0x13')]();});}};}function handleEntityNotFound(_0x46c0f2){return function(_0x4ac8f5){if(!_0x4ac8f5){_0x46c0f2[_0x0b91('0x14')](0x194);}return _0x4ac8f5;};}function handleError(_0x25e66a,_0x2e8bb9){_0x2e8bb9=_0x2e8bb9||0x1f4;return function(_0x17d6fd){logger[_0x0b91('0x15')](_0x17d6fd[_0x0b91('0x16')]);if(_0x17d6fd[_0x0b91('0x17')]){delete _0x17d6fd[_0x0b91('0x17')];}_0x25e66a[_0x0b91('0x8')](_0x2e8bb9)[_0x0b91('0x18')](_0x17d6fd);};}exports[_0x0b91('0x19')]=function(_0xd44356,_0x4d5143){var _0x2df818={},_0x576a92={},_0x4e0134={'count':0x0,'rows':[]};var _0x3860af=_[_0x0b91('0x1a')](db[_0x0b91('0x1b')][_0x0b91('0x1c')],function(_0x140ba1){return{'name':_0x140ba1[_0x0b91('0x1d')],'type':_0x140ba1[_0x0b91('0x1e')][_0x0b91('0x1f')]};});_0x576a92[_0x0b91('0x20')]=_['map'](_0x3860af,'name');_0x576a92['query']=_['keys'](_0xd44356[_0x0b91('0x21')]);_0x576a92[_0x0b91('0x22')]=_[_0x0b91('0x23')](_0x576a92[_0x0b91('0x20')],_0x576a92[_0x0b91('0x21')]);_0x2df818[_0x0b91('0x24')]=_[_0x0b91('0x23')](_0x576a92[_0x0b91('0x20')],qs[_0x0b91('0x25')](_0xd44356[_0x0b91('0x21')][_0x0b91('0x25')]));_0x2df818[_0x0b91('0x24')]=_0x2df818['attributes'][_0x0b91('0x26')]?_0x2df818['attributes']:_0x576a92['model'];if(!_0xd44356[_0x0b91('0x21')]['hasOwnProperty'](_0x0b91('0x27'))){_0x2df818['limit']=qs[_0x0b91('0xc')](_0xd44356[_0x0b91('0x21')]['limit']);_0x2df818[_0x0b91('0xa')]=qs[_0x0b91('0xa')](_0xd44356['query']['offset']);}_0x2df818['order']=qs[_0x0b91('0x28')](_0xd44356[_0x0b91('0x21')][_0x0b91('0x28')]);_0x2df818[_0x0b91('0x29')]=qs[_0x0b91('0x22')](_[_0x0b91('0x2a')](_0xd44356[_0x0b91('0x21')],_0x576a92[_0x0b91('0x22')]),_0x3860af);if(_0xd44356[_0x0b91('0x21')][_0x0b91('0x2b')]){_0x2df818[_0x0b91('0x29')]=_['merge'](_0x2df818['where'],{'$or':_[_0x0b91('0x1a')](_0x3860af,function(_0x41c8f7){if(_0x41c8f7[_0x0b91('0x1e')]!==_0x0b91('0x2c')){var _0x1bf276={};_0x1bf276[_0x41c8f7[_0x0b91('0x17')]]={'$like':'%'+_0xd44356['query'][_0x0b91('0x2b')]+'%'};return _0x1bf276;}})});}_0x2df818=_[_0x0b91('0x2d')]({},_0x2df818,_0xd44356['options']);var _0x5e10d0={'where':_0x2df818[_0x0b91('0x29')]};return db[_0x0b91('0x1b')][_0x0b91('0xd')](_0x5e10d0)[_0x0b91('0x11')](function(_0x83c0d0){_0x4e0134['count']=_0x83c0d0;if(_0xd44356['query'][_0x0b91('0x2e')]){_0x2df818[_0x0b91('0x2f')]=[{'all':!![]}];}return db[_0x0b91('0x1b')][_0x0b91('0x30')](_0x2df818);})[_0x0b91('0x11')](function(_0x54050a){_0x4e0134[_0x0b91('0x31')]=_0x54050a;return _0x4e0134;})['then'](respondWithFilteredResult(_0x4d5143,_0x2df818))[_0x0b91('0x32')](handleError(_0x4d5143,null));};exports['show']=function(_0x4aa7fe,_0x5894a5){var _0x1fdc5b={'raw':![],'where':{'id':_0x4aa7fe[_0x0b91('0x33')]['id']}},_0x3dbaa4={};_0x3dbaa4['model']=_[_0x0b91('0x34')](db[_0x0b91('0x1b')][_0x0b91('0x1c')]);_0x3dbaa4[_0x0b91('0x21')]=_['keys'](_0x4aa7fe[_0x0b91('0x21')]);_0x3dbaa4['filters']=_[_0x0b91('0x23')](_0x3dbaa4[_0x0b91('0x20')],_0x3dbaa4[_0x0b91('0x21')]);_0x1fdc5b[_0x0b91('0x24')]=_[_0x0b91('0x23')](_0x3dbaa4['model'],qs[_0x0b91('0x25')](_0x4aa7fe[_0x0b91('0x21')]['fields']));_0x1fdc5b['attributes']=_0x1fdc5b[_0x0b91('0x24')][_0x0b91('0x26')]?_0x1fdc5b['attributes']:_0x3dbaa4[_0x0b91('0x20')];if(_0x4aa7fe[_0x0b91('0x21')][_0x0b91('0x2e')]){_0x1fdc5b['include']=[{'all':!![]}];}_0x1fdc5b=_['merge']({},_0x1fdc5b,_0x4aa7fe[_0x0b91('0x35')]);return db[_0x0b91('0x1b')][_0x0b91('0x36')](_0x1fdc5b)[_0x0b91('0x11')](handleEntityNotFound(_0x5894a5,null))[_0x0b91('0x11')](respondWithResult(_0x5894a5,null))[_0x0b91('0x32')](handleError(_0x5894a5,null));};exports[_0x0b91('0x37')]=function(_0x5e2e7a,_0x275b3c){return db[_0x0b91('0x1b')][_0x0b91('0x37')](_0x5e2e7a[_0x0b91('0x38')],{})['then'](respondWithResult(_0x275b3c,0xc9))[_0x0b91('0x32')](handleError(_0x275b3c,null));};exports[_0x0b91('0x10')]=function(_0x24bd16,_0x4295d5){if(_0x24bd16[_0x0b91('0x38')]['id']){delete _0x24bd16[_0x0b91('0x38')]['id'];}return db['Dynamics365Account'][_0x0b91('0x36')]({'where':{'id':_0x24bd16[_0x0b91('0x33')]['id']}})[_0x0b91('0x11')](handleEntityNotFound(_0x4295d5,null))[_0x0b91('0x11')](saveUpdates(_0x24bd16['body'],null))[_0x0b91('0x11')](respondWithResult(_0x4295d5,null))[_0x0b91('0x32')](handleError(_0x4295d5,null));};exports['destroy']=function(_0x42e97f,_0x2b0414){return db[_0x0b91('0x1b')]['find']({'where':{'id':_0x42e97f[_0x0b91('0x33')]['id']}})[_0x0b91('0x11')](handleEntityNotFound(_0x2b0414,null))[_0x0b91('0x11')](removeEntity(_0x2b0414,null))[_0x0b91('0x32')](handleError(_0x2b0414,null));};exports[_0x0b91('0x39')]=function(_0x12d9e3,_0x319b07){var _0x18d1f8={};var _0x2c7ddd={};var _0x1a1f74;var _0x2fa952;return db[_0x0b91('0x1b')][_0x0b91('0x3a')]({'where':{'id':_0x12d9e3[_0x0b91('0x33')]['id']}})[_0x0b91('0x11')](handleEntityNotFound(_0x319b07,null))['then'](function(_0x26007b){if(_0x26007b){_0x1a1f74=_0x26007b;_0x2c7ddd[_0x0b91('0x20')]=_[_0x0b91('0x34')](db[_0x0b91('0x3b')][_0x0b91('0x1c')]);_0x2c7ddd[_0x0b91('0x21')]=_[_0x0b91('0x34')](_0x12d9e3[_0x0b91('0x21')]);_0x2c7ddd[_0x0b91('0x22')]=_[_0x0b91('0x23')](_0x2c7ddd[_0x0b91('0x20')],_0x2c7ddd[_0x0b91('0x21')]);_0x18d1f8[_0x0b91('0x24')]=_['intersection'](_0x2c7ddd['model'],qs[_0x0b91('0x25')](_0x12d9e3[_0x0b91('0x21')][_0x0b91('0x25')]));_0x18d1f8['attributes']=_0x18d1f8['attributes'][_0x0b91('0x26')]?_0x18d1f8[_0x0b91('0x24')]:_0x2c7ddd[_0x0b91('0x20')];_0x18d1f8[_0x0b91('0x3c')]=qs[_0x0b91('0x28')](_0x12d9e3[_0x0b91('0x21')][_0x0b91('0x28')]);_0x18d1f8['where']=qs[_0x0b91('0x22')](_[_0x0b91('0x2a')](_0x12d9e3[_0x0b91('0x21')],_0x2c7ddd[_0x0b91('0x22')]));if(_0x12d9e3['query'][_0x0b91('0x2b')]){_0x18d1f8[_0x0b91('0x29')]=_['merge'](_0x18d1f8[_0x0b91('0x29')],{'$or':_[_0x0b91('0x1a')](_0x18d1f8[_0x0b91('0x24')],function(_0x3fd2eb){var _0x4d6f6b={};_0x4d6f6b[_0x3fd2eb]={'$like':'%'+_0x12d9e3['query'][_0x0b91('0x2b')]+'%'};return _0x4d6f6b;})});}_0x18d1f8=_[_0x0b91('0x2d')]({},_0x18d1f8,_0x12d9e3[_0x0b91('0x35')]);return _0x1a1f74[_0x0b91('0x39')](_0x18d1f8);}})[_0x0b91('0x11')](function(_0x112eb8){if(_0x112eb8){_0x2fa952=_0x112eb8['length'];if(!_0x12d9e3[_0x0b91('0x21')][_0x0b91('0x3d')](_0x0b91('0x27'))){_0x18d1f8[_0x0b91('0xc')]=qs[_0x0b91('0xc')](_0x12d9e3[_0x0b91('0x21')][_0x0b91('0xc')]);_0x18d1f8['offset']=qs[_0x0b91('0xa')](_0x12d9e3[_0x0b91('0x21')][_0x0b91('0xa')]);}return _0x1a1f74[_0x0b91('0x39')](_0x18d1f8);}})['then'](function(_0x173c35){if(_0x173c35){return _0x173c35?{'count':_0x2fa952,'rows':_0x173c35}:null;}})[_0x0b91('0x11')](respondWithResult(_0x319b07,null))[_0x0b91('0x32')](handleError(_0x319b07,null));};exports['addConfiguration']=function(_0x5be03c,_0x3d5ad0){if(_0x5be03c[_0x0b91('0x38')]['id']){delete _0x5be03c[_0x0b91('0x38')]['id'];}return db[_0x0b91('0x1b')][_0x0b91('0x3a')]({'where':{'id':_0x5be03c[_0x0b91('0x33')]['id']}})['then'](handleEntityNotFound(_0x3d5ad0,null))['then'](function(_0x26f2ba){if(_0x26f2ba){_0x5be03c['body'][_0x0b91('0x3e')]=_0x26f2ba['id'];_0x5be03c[_0x0b91('0x38')]['Subjects']=integrations[_0x0b91('0x3f')](_0x5be03c[_0x0b91('0x38')][_0x0b91('0x40')],_0x5be03c[_0x0b91('0x38')]['type']);_0x5be03c[_0x0b91('0x38')][_0x0b91('0x41')]=integrations[_0x0b91('0x42')](_0x5be03c[_0x0b91('0x38')][_0x0b91('0x40')],_0x5be03c['body'][_0x0b91('0x1e')]);return db[_0x0b91('0x3b')][_0x0b91('0x37')](_0x5be03c[_0x0b91('0x38')],{'include':[{'model':db[_0x0b91('0x43')],'as':'Subjects'},{'model':db[_0x0b91('0x43')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x3d5ad0,null))[_0x0b91('0x32')](handleError(_0x3d5ad0,null));};function sanitizeRemoteUri(_0x4e29ef){var _0x42743f=_0x4e29ef[_0x0b91('0x44')](-0x1);if(_0x42743f==='/')return _0x4e29ef[_0x0b91('0x45')](0x0,_0x4e29ef['lastIndexOf'](_0x42743f));return _0x4e29ef;}function getWebApiUrl(_0x17288f){return util[_0x0b91('0x46')]('%s/api/data/v9.0/',_0x17288f);}exports[_0x0b91('0x47')]=function(_0x5ee6e9,_0x201b16){var _0x50fc50=_0x5ee6e9[_0x0b91('0x21')][_0x0b91('0x48')];var _0x2c11e8=_0x50fc50===_0x0b91('0x49')?_0x0b91('0x4a'):'PhoneCall';var _0x4736a3='';var _0x5de550='';var _0x350281='';var _0x4a007d='';var _0x4f3e86='';var _0x3c88c3='';var _0x4c595a='';var _0x4bf42e='';var _0x28d73f=[_0x0b91('0x4b'),'description',_0x0b91('0x4c'),_0x0b91('0x4d'),_0x0b91('0x4e'),_0x0b91('0x4f'),'phonenumber',_0x0b91('0x50'),_0x0b91('0x51'),_0x0b91('0x52')];var _0x4f29d0=[_0x0b91('0x53'),_0x0b91('0x54'),'actualserviceunits','billedserviceunits',_0x0b91('0x55'),'contactidyominame',_0x0b91('0x56'),_0x0b91('0x57'),'createdbyexternalpartyname','createdbyexternalpartyyominame',_0x0b91('0x58'),_0x0b91('0x59'),_0x0b91('0x5a'),_0x0b91('0x5b'),'createdonbehalfbyyominame',_0x0b91('0x5c'),'customeridtype','customeridyominame',_0x0b91('0x5d'),_0x0b91('0x5e'),_0x0b91('0x5f'),'entityimage_url',_0x0b91('0x60'),_0x0b91('0x61'),'firstresponsebykpiidname','followupby','importsequencenumber','influencescore',_0x0b91('0x62'),'lastonholdtime','masteridname',_0x0b91('0x63'),'modifiedbyexternalpartyyominame','modifiedbyname',_0x0b91('0x64'),'modifiedon',_0x0b91('0x65'),_0x0b91('0x66'),'msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents',_0x0b91('0x67'),_0x0b91('0x68'),_0x0b91('0x69'),_0x0b91('0x6a'),'owneridyominame',_0x0b91('0x6b'),_0x0b91('0x6c'),_0x0b91('0x6d'),_0x0b91('0x6e'),'productidname',_0x0b91('0x6f'),_0x0b91('0x70'),_0x0b91('0x71'),'responseby',_0x0b91('0x72'),_0x0b91('0x73'),_0x0b91('0x74'),_0x0b91('0x75'),_0x0b91('0x76'),_0x0b91('0x77'),_0x0b91('0x78'),_0x0b91('0x79'),_0x0b91('0x7a'),_0x0b91('0x7b'),_0x0b91('0x7c'),_0x0b91('0x7d'),_0x0b91('0x7e'),'utcconversiontimezonecode','versionnumber'];var _0x5b26b4=_0x28d73f['concat'](_0x4f29d0);return db[_0x0b91('0x1b')]['findOne']({'where':{'id':_0x5ee6e9[_0x0b91('0x33')]['id']},'attributes':['id',_0x0b91('0x7f'),_0x0b91('0x80'),'remoteUri','tenantId','clientId',_0x0b91('0x81'),_0x0b91('0x82')],'include':[{'model':db[_0x0b91('0x83')],'as':_0x0b91('0x83'),'attributes':['id',_0x0b91('0x84'),'data7']}]})['then'](handleEntityNotFound(_0x201b16,null))[_0x0b91('0x11')](function(_0x117d04){if(_0x117d04){if(_0x117d04[_0x0b91('0x82')]){_0x117d04['access_token']=_0x117d04[_0x0b91('0x83')][_0x0b91('0x84')];_0x4bf42e=sanitizeRemoteUri(_0x117d04[_0x0b91('0x83')][_0x0b91('0x85')]);_0x4c595a=getWebApiUrl(_0x4bf42e);return _0x117d04;}_0x4bf42e=sanitizeRemoteUri(_0x117d04['remoteUri']);_0x4c595a=getWebApiUrl(_0x4bf42e);var _0x4070f4={'method':'POST','uri':_0x0b91('0x86')+_0x117d04[_0x0b91('0x87')]+'/oauth2/token','form':{'client_id':_0x117d04[_0x0b91('0x88')],'resource':_0x4bf42e,'username':_0x117d04[_0x0b91('0x7f')],'password':_0x117d04['password'],'grant_type':_0x0b91('0x80'),'client_secret':_0x117d04[_0x0b91('0x81')]},'json':!![]};return rp(_0x4070f4);}})['then'](function(_0x24c1b4){_0x3c88c3=_0x24c1b4['access_token'];var _0x51f261={'method':'GET','uri':encodeURI(_0x4c595a+_0x0b91('0x89')+_0x2c11e8+'\x27'),'headers':{'Authorization':_0x0b91('0x8a')+_0x3c88c3,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x51f261);})['then'](function(_0x3fda87){var _0x5de17c=_0x3fda87[_0x0b91('0x8b')][0x0];var _0x46ea07=_0x5de17c[_0x0b91('0x8c')];var _0x28e543={'method':_0x0b91('0x8d'),'uri':_0x4c595a+_0x0b91('0x8e')+_0x46ea07+_0x0b91('0x8f'),'headers':{'Authorization':_0x0b91('0x8a')+_0x3c88c3,'If-None-Match':null,'OData-Version':_0x0b91('0x90')},'json':!![]};return rp(_0x28e543);})[_0x0b91('0x11')](function(_0x1475e3){_0x4736a3=_0x1475e3;_0x5de550=_0x4736a3[_0x0b91('0x91')];_0x5de550=_[_0x0b91('0x92')](_0x5de550,function(_0x2f2588){return!_0x5b26b4[_0x0b91('0x93')](_0x2f2588[_0x0b91('0x94')]);});var _0x740ddb=[];var _0x405108=[];_0x5de550['forEach'](function(_0xd26c8f){if(_0xd26c8f[_0x0b91('0x95')]){var _0x4352da=_0xd26c8f[_0x0b91('0x95')][_0x0b91('0x45')](_0xd26c8f[_0x0b91('0x95')][_0x0b91('0x96')]('.')+0x1);if(_0x4352da===_0x0b91('0x97')){_0x740ddb[_0x0b91('0x98')](getSelectList(_0x4c595a,_0x50fc50,_0x405108,_0x4736a3['MetadataId'],_0xd26c8f[_0x0b91('0x8c')],_0x3c88c3));}}});return Promise[_0x0b91('0x99')](_0x740ddb);})['then'](function(_0x482f25){_0x350281=_0x482f25[0x0];var _0x309430=[];var _0x3d7a39=[];_0x5de550['forEach'](function(_0x562075){if(!_[_0x0b91('0x9a')](_0x562075[_0x0b91('0x95')])){var _0x487206=_0x562075[_0x0b91('0x95')][_0x0b91('0x45')](_0x562075[_0x0b91('0x95')][_0x0b91('0x96')]('.')+0x1);if(_0x487206===_0x0b91('0x9b')){_0x309430['push'](getBooleanList(_0x4c595a,_0x50fc50,_0x3d7a39,_0x4736a3[_0x0b91('0x8c')],_0x562075[_0x0b91('0x8c')],_0x3c88c3));}}});return Promise[_0x0b91('0x99')](_0x309430);})[_0x0b91('0x11')](function(_0x346a03){_0x4a007d=_0x346a03[0x0];var _0x43dc52=[];var _0x2e2fa5=[];_0x5de550[_0x0b91('0x9c')](function(_0x325ad8){if(_0x325ad8[_0x0b91('0x95')]){var _0xdd2676=_0x325ad8[_0x0b91('0x95')][_0x0b91('0x45')](_0x325ad8[_0x0b91('0x95')][_0x0b91('0x96')]('.')+0x1);if(_0xdd2676===_0x0b91('0x9d')||_0xdd2676==='DoubleAttributeMetadata'||_0xdd2676==='BigIntAttributeMetadata'||_0xdd2676===_0x0b91('0x9e')||_0xdd2676===_0x0b91('0x9f')||_0xdd2676===_0x0b91('0xa0')||_0xdd2676===_0x0b91('0xa1')||_0xdd2676===_0x0b91('0xa2')||_0xdd2676==='StateAttributeMetadata'||_0xdd2676===_0x0b91('0xa3')){_0x43dc52['push'](getInputList(_0x4c595a,_0x50fc50,_0xdd2676,_0x2e2fa5,_0x4736a3[_0x0b91('0x8c')],_0x325ad8[_0x0b91('0x8c')],_0x3c88c3));}}});return Promise[_0x0b91('0x99')](_0x43dc52);})[_0x0b91('0x11')](function(_0x56a959){_0x4f3e86=_0x56a959[0x0];var _0x22ca6d=_0x350281[_0x0b91('0xa4')](_0x4a007d)[_0x0b91('0xa4')](_0x4f3e86);var _0x3e8a64={'count':_0x22ca6d[_0x0b91('0x26')],'rows':_0x22ca6d};return _0x3e8a64;})['then'](respondWithResult(_0x201b16,null))['catch'](function(_0x73b219){var _0x533adb=_0x5ee6e9[_0x0b91('0x21')][_0x0b91('0xa5')]?0x1f4:_0x73b219[_0x0b91('0xa6')]||0x1f4;logger[_0x0b91('0x15')](_0x73b219['stack']);delete _0x73b219[_0x0b91('0x17')];if(_0x533adb===0x191){_0x533adb=0x190;}_0x201b16[_0x0b91('0x8')](_0x533adb)[_0x0b91('0x18')](_0x5ee6e9[_0x0b91('0x21')][_0x0b91('0xa5')]?{'message':_0x0b91('0xa7'),'statusCode':_0x73b219['statusCode']}:_0x73b219);});};function getSelectList(_0x6305a8,_0x53eab9,_0x1bda63,_0x455126,_0x5b6b05,_0x5870f3){var _0x409db6={'method':_0x0b91('0x8d'),'uri':_0x6305a8+_0x0b91('0x8e')+_0x455126+')/Attributes('+_0x5b6b05+_0x0b91('0xa8')+_0x0b91('0xa9'),'headers':{'Authorization':'Bearer\x20'+_0x5870f3,'If-None-Match':null,'OData-Version':_0x0b91('0x90')},'json':!![]};return rp(_0x409db6)['then'](function(_0x1736d9){var _0x33f7e8=[];var _0x2db89e=_0x1736d9[_0x0b91('0xaa')]['Options'];_0x2db89e['forEach'](function(_0x4c9de2){_0x33f7e8[_0x0b91('0x98')]({'name':_0x4c9de2[_0x0b91('0xab')][_0x0b91('0xac')]['Label'],'value':String(_0x4c9de2[_0x0b91('0xad')])});});var _0x481419={'id':_0x53eab9+'_'+_0x1736d9[_0x0b91('0x94')],'name':_0x1736d9['DisplayName'][_0x0b91('0xac')][_0x0b91('0xab')],'custom':![],'options':_0x33f7e8};_0x1bda63[_0x0b91('0x98')](_0x481419);return _0x1bda63;});}function getBooleanList(_0x26c39e,_0x12fd77,_0x341ec7,_0x1824d2,_0x49f2bb,_0xafaba){var _0x5c300a={'method':'GET','uri':_0x26c39e+_0x0b91('0x8e')+_0x1824d2+_0x0b91('0xae')+_0x49f2bb+_0x0b91('0xaf'),'headers':{'Authorization':_0x0b91('0x8a')+_0xafaba,'If-None-Match':null,'OData-Version':_0x0b91('0x90')},'json':!![]};return rp(_0x5c300a)[_0x0b91('0x11')](function(_0x343f74){var _0x1d822e=[];_0x1d822e[_0x0b91('0x98')]({'name':_0x343f74[_0x0b91('0xaa')]['TrueOption'][_0x0b91('0xab')][_0x0b91('0xac')][_0x0b91('0xab')],'value':'true'},{'name':_0x343f74[_0x0b91('0xaa')][_0x0b91('0xb0')][_0x0b91('0xab')][_0x0b91('0xac')][_0x0b91('0xab')],'value':_0x0b91('0xb1')});var _0x481f87={'id':_0x12fd77+'_'+_0x343f74['LogicalName'],'name':_0x343f74['DisplayName']['UserLocalizedLabel'][_0x0b91('0xab')],'custom':![],'options':_0x1d822e};_0x341ec7[_0x0b91('0x98')](_0x481f87);return _0x341ec7;});}function getInputList(_0x2a6999,_0x31dff6,_0x28854d,_0x4a4856,_0x985136,_0x2a6c29,_0x5c3c3d){var _0x37e686={'method':_0x0b91('0x8d'),'uri':_0x2a6999+_0x0b91('0x8e')+_0x985136+_0x0b91('0xae')+_0x2a6c29+')/Microsoft.Dynamics.CRM.'+_0x28854d+_0x0b91('0xb2'),'headers':{'Authorization':'Bearer\x20'+_0x5c3c3d,'If-None-Match':null,'OData-Version':_0x0b91('0x90')},'json':!![]};return rp(_0x37e686)[_0x0b91('0x11')](function(_0x58b257){var _0x542b69={'id':_0x31dff6+'_'+_0x58b257['LogicalName'],'name':_0x58b257[_0x0b91('0xb3')][_0x0b91('0xac')]?_0x58b257['DisplayName'][_0x0b91('0xac')][_0x0b91('0xab')]:_0x58b257[_0x0b91('0x94')],'custom':![],'options':[]};_0x4a4856[_0x0b91('0x98')](_0x542b69);return _0x4a4856;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index e43352d..843eb2f 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1424a1,_0x28df81){var _0x3308f1=function(_0x300b8c){while(--_0x300b8c){_0x1424a1['push'](_0x1424a1['shift']());}};_0x3308f1(++_0x28df81);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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(_0x48370b,_0x59c727){var _0x1a757b=function(_0x2e7824){while(--_0x2e7824){_0x48370b['push'](_0x48370b['shift']());}};_0x1a757b(++_0x59c727);}(_0xe706,0xa3));var _0x6e70=function(_0x38de16,_0x2acea8){_0x38de16=_0x38de16-0x0;var _0x594a90=_0xe706[_0x38de16];return _0x594a90;};'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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index f8cf4cb..66af8ca 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 _0x812d=['Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','raw','options','where','attributes','limit','include','map','model','ShowDynamics365Account','find','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3c3498,_0x44a0f2){var _0x42ac50=function(_0x33b830){while(--_0x33b830){_0x3c3498['push'](_0x3c3498['shift']());}};_0x42ac50(++_0x44a0f2);}(_0x812d,0x155));var _0xd812=function(_0x42e7a7,_0x3d8e83){_0x42e7a7=_0x42e7a7-0x0;var _0x5cfb77=_0x812d[_0x42e7a7];return _0x5cfb77;};'use strict';var _=require(_0xd812('0x0'));var util=require(_0xd812('0x1'));var moment=require('moment');var BPromise=require(_0xd812('0x2'));var rs=require(_0xd812('0x3'));var fs=require('fs');var Redis=require(_0xd812('0x4'));var db=require(_0xd812('0x5'))['db'];var utils=require(_0xd812('0x6'));var logger=require(_0xd812('0x7'))('rpc');var config=require(_0xd812('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd812('0x9')][_0xd812('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bf446,_0x4d6c1a,_0x3b00c2){return new BPromise(function(_0x384619,_0x3dd3c0){return client[_0xd812('0xb')](_0x3bf446,_0x3b00c2)['then'](function(_0x1e351a){logger[_0xd812('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x4d6c1a,_0xd812('0xd'));logger[_0xd812('0xe')](_0xd812('0xf'),_0x4d6c1a,_0xd812('0xd'),JSON[_0xd812('0x10')](_0x1e351a));if(_0x1e351a[_0xd812('0x11')]){if(_0x1e351a[_0xd812('0x11')][_0xd812('0x12')]===0x1f4){logger[_0xd812('0x11')](_0xd812('0x13'),_0x4d6c1a,_0x1e351a[_0xd812('0x11')][_0xd812('0x14')]);return _0x3dd3c0(_0x1e351a[_0xd812('0x11')][_0xd812('0x14')]);}logger[_0xd812('0x11')](_0xd812('0x13'),_0x4d6c1a,_0x1e351a[_0xd812('0x11')]['message']);return _0x384619(_0x1e351a[_0xd812('0x11')][_0xd812('0x14')]);}else{logger[_0xd812('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x4d6c1a,_0xd812('0xd'));_0x384619(_0x1e351a[_0xd812('0x15')][_0xd812('0x14')]);}})[_0xd812('0x16')](function(_0x540d35){logger[_0xd812('0x11')](_0xd812('0x13'),_0x4d6c1a,_0x540d35);_0x3dd3c0(_0x540d35);});});}exports[_0xd812('0x17')]=function(_0x3d6bb4){var _0x441dde=this;return new Promise(function(_0x3a5bad,_0x4d445c){return db[_0xd812('0x18')]['findAll']({'raw':_0x3d6bb4['options']?_0x3d6bb4['options'][_0xd812('0x19')]===undefined?!![]:![]:!![],'where':_0x3d6bb4[_0xd812('0x1a')]?_0x3d6bb4['options'][_0xd812('0x1b')]||null:null,'attributes':_0x3d6bb4[_0xd812('0x1a')]?_0x3d6bb4['options'][_0xd812('0x1c')]||null:null,'limit':_0x3d6bb4['options']?_0x3d6bb4[_0xd812('0x1a')][_0xd812('0x1d')]||null:null,'include':_0x3d6bb4[_0xd812('0x1a')]?_0x3d6bb4['options'][_0xd812('0x1e')]?_[_0xd812('0x1f')](_0x3d6bb4[_0xd812('0x1a')][_0xd812('0x1e')],function(_0xf412d9){return{'model':db[_0xf412d9[_0xd812('0x20')]],'as':_0xf412d9['as'],'attributes':_0xf412d9[_0xd812('0x1c')],'include':_0xf412d9[_0xd812('0x1e')]?_[_0xd812('0x1f')](_0xf412d9[_0xd812('0x1e')],function(_0x3d6312){return{'model':db[_0x3d6312[_0xd812('0x20')]],'as':_0x3d6312['as'],'attributes':_0x3d6312['attributes'],'include':_0x3d6312[_0xd812('0x1e')]?_[_0xd812('0x1f')](_0x3d6312[_0xd812('0x1e')],function(_0xd601a4){return{'model':db[_0xd601a4[_0xd812('0x20')]],'as':_0xd601a4['as'],'attributes':_0xd601a4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x278eb0){logger[_0xd812('0xc')](_0xd812('0x17'),_0x3d6bb4);logger[_0xd812('0xe')](_0xd812('0x17'),_0x3d6bb4,JSON[_0xd812('0x10')](_0x278eb0));_0x3a5bad(_0x278eb0);})[_0xd812('0x16')](function(_0x196be2){logger['error'](_0xd812('0x17'),_0x196be2['message'],_0x3d6bb4);_0x4d445c(_0x441dde[_0xd812('0x11')](0x1f4,_0x196be2[_0xd812('0x14')]));});});};exports[_0xd812('0x21')]=function(_0x1b4295){var _0x4a8ce5=this;return new Promise(function(_0x254321,_0x4e3fe5){return db[_0xd812('0x18')][_0xd812('0x22')]({'raw':_0x1b4295[_0xd812('0x1a')]?_0x1b4295[_0xd812('0x1a')][_0xd812('0x19')]===undefined?!![]:![]:!![],'where':_0x1b4295[_0xd812('0x1a')]?_0x1b4295[_0xd812('0x1a')]['where']||null:null,'attributes':_0x1b4295['options']?_0x1b4295['options'][_0xd812('0x1c')]||null:null,'include':_0x1b4295[_0xd812('0x1a')]?_0x1b4295[_0xd812('0x1a')][_0xd812('0x1e')]?_[_0xd812('0x1f')](_0x1b4295[_0xd812('0x1a')][_0xd812('0x1e')],function(_0x44e882){return{'model':db[_0x44e882['model']],'as':_0x44e882['as'],'attributes':_0x44e882['attributes'],'include':_0x44e882[_0xd812('0x1e')]?_[_0xd812('0x1f')](_0x44e882[_0xd812('0x1e')],function(_0x238963){return{'model':db[_0x238963[_0xd812('0x20')]],'as':_0x238963['as'],'attributes':_0x238963[_0xd812('0x1c')],'include':_0x238963[_0xd812('0x1e')]?_['map'](_0x238963['include'],function(_0x28f4b0){return{'model':db[_0x28f4b0[_0xd812('0x20')]],'as':_0x28f4b0['as'],'attributes':_0x28f4b0['attributes']};}):[]};}):[]};}):[]:[]})[_0xd812('0x23')](function(_0x531ff3){logger['info'](_0xd812('0x21'),_0x1b4295);logger[_0xd812('0xe')](_0xd812('0x21'),_0x1b4295,JSON[_0xd812('0x10')](_0x531ff3));_0x254321(_0x531ff3);})[_0xd812('0x16')](function(_0x390374){logger[_0xd812('0x11')](_0xd812('0x21'),_0x390374[_0xd812('0x14')],_0x1b4295);_0x4e3fe5(_0x4a8ce5[_0xd812('0x11')](0x1f4,_0x390374[_0xd812('0x14')]));});});}; \ No newline at end of file +var _0x90a8=['request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowDynamics365Account','find','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x50ead2,_0x17f05b){var _0x285149=function(_0x4831f5){while(--_0x4831f5){_0x50ead2['push'](_0x50ead2['shift']());}};_0x285149(++_0x17f05b);}(_0x90a8,0x82));var _0x890a=function(_0x5e6c6b,_0x427d18){_0x5e6c6b=_0x5e6c6b-0x0;var _0x1198ad=_0x90a8[_0x5e6c6b];return _0x1198ad;};'use strict';var _=require(_0x890a('0x0'));var util=require(_0x890a('0x1'));var moment=require(_0x890a('0x2'));var BPromise=require(_0x890a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x890a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x890a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x890a('0x6'));var jayson=require(_0x890a('0x7'));var client=jayson[_0x890a('0x8')][_0x890a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a3a14,_0x4f0249,_0x158536){return new BPromise(function(_0x12cfd2,_0x284a8b){return client[_0x890a('0xa')](_0x5a3a14,_0x158536)[_0x890a('0xb')](function(_0xf4c62e){logger['info'](_0x890a('0xc'),_0x4f0249,_0x890a('0xd'));logger[_0x890a('0xe')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x4f0249,_0x890a('0xd'),JSON[_0x890a('0xf')](_0xf4c62e));if(_0xf4c62e[_0x890a('0x10')]){if(_0xf4c62e[_0x890a('0x10')][_0x890a('0x11')]===0x1f4){logger[_0x890a('0x10')](_0x890a('0xc'),_0x4f0249,_0xf4c62e[_0x890a('0x10')][_0x890a('0x12')]);return _0x284a8b(_0xf4c62e[_0x890a('0x10')][_0x890a('0x12')]);}logger[_0x890a('0x10')](_0x890a('0xc'),_0x4f0249,_0xf4c62e[_0x890a('0x10')][_0x890a('0x12')]);return _0x12cfd2(_0xf4c62e[_0x890a('0x10')]['message']);}else{logger[_0x890a('0x13')](_0x890a('0xc'),_0x4f0249,_0x890a('0xd'));_0x12cfd2(_0xf4c62e[_0x890a('0x14')][_0x890a('0x12')]);}})['catch'](function(_0x8ec779){logger[_0x890a('0x10')](_0x890a('0xc'),_0x4f0249,_0x8ec779);_0x284a8b(_0x8ec779);});});}exports[_0x890a('0x15')]=function(_0x32f285){var _0x517c4e=this;return new Promise(function(_0x578ce9,_0x37e02a){return db[_0x890a('0x16')][_0x890a('0x17')]({'raw':_0x32f285[_0x890a('0x18')]?_0x32f285[_0x890a('0x18')][_0x890a('0x19')]===undefined?!![]:![]:!![],'where':_0x32f285[_0x890a('0x18')]?_0x32f285[_0x890a('0x18')][_0x890a('0x1a')]||null:null,'attributes':_0x32f285[_0x890a('0x18')]?_0x32f285[_0x890a('0x18')][_0x890a('0x1b')]||null:null,'limit':_0x32f285['options']?_0x32f285['options'][_0x890a('0x1c')]||null:null,'include':_0x32f285[_0x890a('0x18')]?_0x32f285[_0x890a('0x18')][_0x890a('0x1d')]?_[_0x890a('0x1e')](_0x32f285['options']['include'],function(_0x27aa50){return{'model':db[_0x27aa50[_0x890a('0x1f')]],'as':_0x27aa50['as'],'attributes':_0x27aa50['attributes'],'include':_0x27aa50[_0x890a('0x1d')]?_[_0x890a('0x1e')](_0x27aa50[_0x890a('0x1d')],function(_0x376bfd){return{'model':db[_0x376bfd[_0x890a('0x1f')]],'as':_0x376bfd['as'],'attributes':_0x376bfd[_0x890a('0x1b')],'include':_0x376bfd[_0x890a('0x1d')]?_['map'](_0x376bfd[_0x890a('0x1d')],function(_0xf5ad0){return{'model':db[_0xf5ad0[_0x890a('0x1f')]],'as':_0xf5ad0['as'],'attributes':_0xf5ad0[_0x890a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x890a('0xb')](function(_0x288f33){logger[_0x890a('0x13')](_0x890a('0x15'),_0x32f285);logger[_0x890a('0xe')](_0x890a('0x15'),_0x32f285,JSON[_0x890a('0xf')](_0x288f33));_0x578ce9(_0x288f33);})[_0x890a('0x20')](function(_0x1d8c50){logger['error'](_0x890a('0x15'),_0x1d8c50[_0x890a('0x12')],_0x32f285);_0x37e02a(_0x517c4e[_0x890a('0x10')](0x1f4,_0x1d8c50[_0x890a('0x12')]));});});};exports[_0x890a('0x21')]=function(_0x4663d6){var _0x4314ff=this;return new Promise(function(_0x11455b,_0x59f3bf){return db[_0x890a('0x16')][_0x890a('0x22')]({'raw':_0x4663d6[_0x890a('0x18')]?_0x4663d6[_0x890a('0x18')][_0x890a('0x19')]===undefined?!![]:![]:!![],'where':_0x4663d6[_0x890a('0x18')]?_0x4663d6[_0x890a('0x18')][_0x890a('0x1a')]||null:null,'attributes':_0x4663d6[_0x890a('0x18')]?_0x4663d6[_0x890a('0x18')][_0x890a('0x1b')]||null:null,'include':_0x4663d6['options']?_0x4663d6[_0x890a('0x18')][_0x890a('0x1d')]?_[_0x890a('0x1e')](_0x4663d6['options'][_0x890a('0x1d')],function(_0x536eb2){return{'model':db[_0x536eb2[_0x890a('0x1f')]],'as':_0x536eb2['as'],'attributes':_0x536eb2[_0x890a('0x1b')],'include':_0x536eb2['include']?_[_0x890a('0x1e')](_0x536eb2['include'],function(_0x3a3070){return{'model':db[_0x3a3070[_0x890a('0x1f')]],'as':_0x3a3070['as'],'attributes':_0x3a3070['attributes'],'include':_0x3a3070[_0x890a('0x1d')]?_[_0x890a('0x1e')](_0x3a3070[_0x890a('0x1d')],function(_0x237d70){return{'model':db[_0x237d70[_0x890a('0x1f')]],'as':_0x237d70['as'],'attributes':_0x237d70[_0x890a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x890a('0xb')](function(_0x1557df){logger[_0x890a('0x13')](_0x890a('0x21'),_0x4663d6);logger['debug'](_0x890a('0x21'),_0x4663d6,JSON[_0x890a('0xf')](_0x1557df));_0x11455b(_0x1557df);})[_0x890a('0x20')](function(_0x28cdfc){logger[_0x890a('0x10')](_0x890a('0x21'),_0x28cdfc[_0x890a('0x12')],_0x4663d6);_0x59f3bf(_0x4314ff[_0x890a('0x10')](0x1f4,_0x28cdfc[_0x890a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index a5a276f..d359869 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 _0x1ac8=['get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2c5032,_0x5117e2){var _0x899e91=function(_0x17c807){while(--_0x17c807){_0x2c5032['push'](_0x2c5032['shift']());}};_0x899e91(++_0x5117e2);}(_0x1ac8,0xd1));var _0x81ac=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1ac8[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x81ac('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x81ac('0x1'));var express=require(_0x81ac('0x2'));var router=express[_0x81ac('0x3')]();var fs_extra=require(_0x81ac('0x4'));var auth=require(_0x81ac('0x5'));var interaction=require(_0x81ac('0x6'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0x81ac('0x7')]('/',auth['isAuthenticated'](),controller[_0x81ac('0x8')]);router['get'](_0x81ac('0x9'),auth[_0x81ac('0xa')](),controller[_0x81ac('0xb')]);router[_0x81ac('0x7')](_0x81ac('0xc'),auth[_0x81ac('0xa')](),controller[_0x81ac('0xd')]);router['get'](_0x81ac('0xe'),auth[_0x81ac('0xa')](),controller[_0x81ac('0xf')]);router[_0x81ac('0x7')](_0x81ac('0x10'),auth[_0x81ac('0xa')](),controller[_0x81ac('0x11')]);router[_0x81ac('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x81ac('0x13')](_0x81ac('0x9'),auth[_0x81ac('0xa')](),controller[_0x81ac('0x14')]);router[_0x81ac('0x15')](_0x81ac('0x9'),auth[_0x81ac('0xa')](),controller[_0x81ac('0x16')]);module[_0x81ac('0x17')]=router; \ No newline at end of file +var _0xfa25=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','delete'];(function(_0x5ec634,_0xa835b9){var _0x5b94a9=function(_0x3a720e){while(--_0x3a720e){_0x5ec634['push'](_0x5ec634['shift']());}};_0x5b94a9(++_0xa835b9);}(_0xfa25,0xd1));var _0x5fa2=function(_0x475e85,_0x44bda5){_0x475e85=_0x475e85-0x0;var _0x2feb62=_0xfa25[_0x475e85];return _0x2feb62;};'use strict';var multer=require('multer');var util=require(_0x5fa2('0x0'));var path=require(_0x5fa2('0x1'));var timeout=require(_0x5fa2('0x2'));var express=require(_0x5fa2('0x3'));var router=express[_0x5fa2('0x4')]();var fs_extra=require(_0x5fa2('0x5'));var auth=require(_0x5fa2('0x6'));var interaction=require(_0x5fa2('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0x5fa2('0x8')]('/',auth[_0x5fa2('0x9')](),controller['index']);router['get'](_0x5fa2('0xa'),auth['isAuthenticated'](),controller[_0x5fa2('0xb')]);router[_0x5fa2('0x8')](_0x5fa2('0xc'),auth['isAuthenticated'](),controller[_0x5fa2('0xd')]);router[_0x5fa2('0x8')](_0x5fa2('0xe'),auth['isAuthenticated'](),controller[_0x5fa2('0xf')]);router['get']('/:id/descriptions',auth[_0x5fa2('0x9')](),controller[_0x5fa2('0x10')]);router['post']('/',auth[_0x5fa2('0x9')](),controller[_0x5fa2('0x11')]);router[_0x5fa2('0x12')](_0x5fa2('0xa'),auth[_0x5fa2('0x9')](),controller[_0x5fa2('0x13')]);router[_0x5fa2('0x14')](_0x5fa2('0xa'),auth[_0x5fa2('0x9')](),controller[_0x5fa2('0x15')]);module[_0x5fa2('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 8d5da64..60bb5c7 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 _0xbd78=['phonecall','contact','BOOLEAN','STRING','ENUM','incident'];(function(_0x444177,_0xf81ce0){var _0xd2031d=function(_0x4d5d84){while(--_0x4d5d84){_0x444177['push'](_0x444177['shift']());}};_0xd2031d(++_0xf81ce0);}(_0xbd78,0xab));var _0x8bd7=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbd78[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8bd7('0x0')]},'description':{'type':Sequelize[_0x8bd7('0x0')]},'ticketType':{'type':Sequelize[_0x8bd7('0x1')](_0x8bd7('0x2'),_0x8bd7('0x3')),'defaultValue':_0x8bd7('0x2')},'moduleCreate':{'type':Sequelize[_0x8bd7('0x1')]('contact','nothing'),'defaultValue':_0x8bd7('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x8bd7('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0xddac=['incident','ENUM','contact','nothing','sequelize','exports','STRING','phonecall'];(function(_0x42ac52,_0x471f14){var _0x1f970b=function(_0x5b6deb){while(--_0x5b6deb){_0x42ac52['push'](_0x42ac52['shift']());}};_0x1f970b(++_0x471f14);}(_0xddac,0x114));var _0xcdda=function(_0x1f500d,_0x1eb888){_0x1f500d=_0x1f500d-0x0;var _0x23b94f=_0xddac[_0x1f500d];return _0x23b94f;};'use strict';var Sequelize=require(_0xcdda('0x0'));module[_0xcdda('0x1')]={'name':{'type':Sequelize[_0xcdda('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM']('incident',_0xcdda('0x3')),'defaultValue':_0xcdda('0x4')},'moduleCreate':{'type':Sequelize[_0xcdda('0x5')](_0xcdda('0x6'),_0xcdda('0x7')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 7b6ef4a..cf807c0 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 _0x98fb=['util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','name','send','index','map','Dynamics365Configuration','rawAttributes','key','query','filters','model','attributes','fields','length','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','create','body','find','getFields','findOne','Dynamics365Field','hasOwnProperty','getSubjects','order','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x4b70dc,_0xf99dc5){var _0x1e3dca=function(_0xe2d4e4){while(--_0xe2d4e4){_0x4b70dc['push'](_0x4b70dc['shift']());}};_0x1e3dca(++_0xf99dc5);}(_0x98fb,0x1af));var _0xb98f=function(_0x29ba13,_0x4d9e6b){_0x29ba13=_0x29ba13-0x0;var _0x3e4392=_0x98fb[_0x29ba13];return _0x3e4392;};'use strict';var emlformat=require(_0xb98f('0x0'));var rimraf=require(_0xb98f('0x1'));var zipdir=require(_0xb98f('0x2'));var jsonpatch=require(_0xb98f('0x3'));var rp=require(_0xb98f('0x4'));var moment=require(_0xb98f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb98f('0x6'));var util=require(_0xb98f('0x7'));var path=require(_0xb98f('0x8'));var sox=require('sox');var csv=require(_0xb98f('0x9'));var ejs=require(_0xb98f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb98f('0xb'));var squel=require('squel');var crypto=require(_0xb98f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb98f('0xd'));var toCsv=require(_0xb98f('0x9'));var querystring=require(_0xb98f('0xe'));var Papa=require('papaparse');var Redis=require(_0xb98f('0xf'));var authService=require(_0xb98f('0x10'));var qs=require(_0xb98f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb98f('0x12'));var utils=require(_0xb98f('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x460b7b,_0x40b84f){_0x40b84f=_0x40b84f||0xcc;return function(_0x950551){if(_0x950551){return _0x460b7b['sendStatus'](_0x40b84f);}return _0x460b7b[_0xb98f('0x14')](_0x40b84f)[_0xb98f('0x15')]();};}function respondWithResult(_0x1fc94c,_0x1284ff){_0x1284ff=_0x1284ff||0xc8;return function(_0x4bc7ec){if(_0x4bc7ec){return _0x1fc94c[_0xb98f('0x14')](_0x1284ff)[_0xb98f('0x16')](_0x4bc7ec);}};}function respondWithFilteredResult(_0x145baf,_0x5035dd){return function(_0x118821){if(_0x118821){var _0x2d2272=typeof _0x5035dd[_0xb98f('0x17')]===_0xb98f('0x18')&&typeof _0x5035dd[_0xb98f('0x19')]===_0xb98f('0x18');var _0x54545e=_0x118821[_0xb98f('0x1a')];var _0x1eb9d8=_0x2d2272?0x0:_0x5035dd[_0xb98f('0x17')];var _0x44710c=_0x2d2272?_0x118821['count']:_0x5035dd['offset']+_0x5035dd[_0xb98f('0x19')];var _0x3d1357;if(_0x44710c>=_0x54545e){_0x44710c=_0x54545e;_0x3d1357=0xc8;}else{_0x3d1357=0xce;}_0x145baf[_0xb98f('0x14')](_0x3d1357);return _0x145baf[_0xb98f('0x1b')]('Content-Range',_0x1eb9d8+'-'+_0x44710c+'/'+_0x54545e)[_0xb98f('0x16')](_0x118821);}return null;};}function patchUpdates(_0x261467){return function(_0x400f2a){try{jsonpatch['apply'](_0x400f2a,_0x261467,!![]);}catch(_0x1d20f5){return BPromise[_0xb98f('0x1c')](_0x1d20f5);}return _0x400f2a[_0xb98f('0x1d')]();};}function saveUpdates(_0x1522ef,_0x3aedda){return function(_0x4a4e68){if(_0x4a4e68){return _0x4a4e68[_0xb98f('0x1e')](_0x1522ef)[_0xb98f('0x1f')](function(_0x377986){return _0x377986;});}return null;};}function removeEntity(_0x2c172a,_0x456950){return function(_0xf05939){if(_0xf05939){return _0xf05939[_0xb98f('0x20')]()[_0xb98f('0x1f')](function(){_0x2c172a[_0xb98f('0x14')](0xcc)[_0xb98f('0x15')]();});}};}function handleEntityNotFound(_0x385573,_0x8beaa){return function(_0x53409f){if(!_0x53409f){_0x385573['sendStatus'](0x194);}return _0x53409f;};}function handleError(_0x5cb33e,_0x313c73){_0x313c73=_0x313c73||0x1f4;return function(_0x38c084){logger[_0xb98f('0x21')](_0x38c084['stack']);if(_0x38c084[_0xb98f('0x22')]){delete _0x38c084[_0xb98f('0x22')];}_0x5cb33e[_0xb98f('0x14')](_0x313c73)[_0xb98f('0x23')](_0x38c084);};}exports[_0xb98f('0x24')]=function(_0x4db634,_0x47c2a3){var _0x1f5fa6={},_0x203485={},_0x572ef7={'count':0x0,'rows':[]};var _0x33a094=_[_0xb98f('0x25')](db[_0xb98f('0x26')][_0xb98f('0x27')],function(_0x17df1c){return{'name':_0x17df1c['fieldName'],'type':_0x17df1c['type'][_0xb98f('0x28')]};});_0x203485['model']=_[_0xb98f('0x25')](_0x33a094,_0xb98f('0x22'));_0x203485[_0xb98f('0x29')]=_['keys'](_0x4db634[_0xb98f('0x29')]);_0x203485[_0xb98f('0x2a')]=_['intersection'](_0x203485[_0xb98f('0x2b')],_0x203485[_0xb98f('0x29')]);_0x1f5fa6[_0xb98f('0x2c')]=_['intersection'](_0x203485[_0xb98f('0x2b')],qs[_0xb98f('0x2d')](_0x4db634[_0xb98f('0x29')]['fields']));_0x1f5fa6[_0xb98f('0x2c')]=_0x1f5fa6['attributes'][_0xb98f('0x2e')]?_0x1f5fa6['attributes']:_0x203485[_0xb98f('0x2b')];if(!_0x4db634['query']['hasOwnProperty'](_0xb98f('0x2f'))){_0x1f5fa6['limit']=qs['limit'](_0x4db634[_0xb98f('0x29')][_0xb98f('0x19')]);_0x1f5fa6[_0xb98f('0x17')]=qs[_0xb98f('0x17')](_0x4db634[_0xb98f('0x29')][_0xb98f('0x17')]);}_0x1f5fa6['order']=qs[_0xb98f('0x30')](_0x4db634[_0xb98f('0x29')][_0xb98f('0x30')]);_0x1f5fa6['where']=qs[_0xb98f('0x2a')](_[_0xb98f('0x31')](_0x4db634[_0xb98f('0x29')],_0x203485[_0xb98f('0x2a')]),_0x33a094);if(_0x4db634[_0xb98f('0x29')][_0xb98f('0x32')]){_0x1f5fa6[_0xb98f('0x33')]=_[_0xb98f('0x34')](_0x1f5fa6[_0xb98f('0x33')],{'$or':_[_0xb98f('0x25')](_0x33a094,function(_0x4cb569){if(_0x4cb569['type']!=='VIRTUAL'){var _0x200bb5={};_0x200bb5[_0x4cb569['name']]={'$like':'%'+_0x4db634[_0xb98f('0x29')][_0xb98f('0x32')]+'%'};return _0x200bb5;}})});}_0x1f5fa6=_[_0xb98f('0x34')]({},_0x1f5fa6,_0x4db634[_0xb98f('0x35')]);var _0x30c618={'where':_0x1f5fa6[_0xb98f('0x33')]};return db[_0xb98f('0x26')][_0xb98f('0x1a')](_0x30c618)['then'](function(_0x1a67a2){_0x572ef7['count']=_0x1a67a2;if(_0x4db634[_0xb98f('0x29')][_0xb98f('0x36')]){_0x1f5fa6[_0xb98f('0x37')]=[{'all':!![]}];}return db[_0xb98f('0x26')][_0xb98f('0x38')](_0x1f5fa6);})[_0xb98f('0x1f')](function(_0x3f717b){_0x572ef7[_0xb98f('0x39')]=_0x3f717b;return _0x572ef7;})['then'](respondWithFilteredResult(_0x47c2a3,_0x1f5fa6))[_0xb98f('0x3a')](handleError(_0x47c2a3,null));};exports[_0xb98f('0x3b')]=function(_0x366809,_0x362bce){var _0x44e730={'raw':![],'where':{'id':_0x366809[_0xb98f('0x3c')]['id']}},_0x2ecfe4={};_0x2ecfe4['model']=_['keys'](db[_0xb98f('0x26')][_0xb98f('0x27')]);_0x2ecfe4[_0xb98f('0x29')]=_[_0xb98f('0x3d')](_0x366809[_0xb98f('0x29')]);_0x2ecfe4[_0xb98f('0x2a')]=_['intersection'](_0x2ecfe4[_0xb98f('0x2b')],_0x2ecfe4[_0xb98f('0x29')]);_0x44e730[_0xb98f('0x2c')]=_[_0xb98f('0x3e')](_0x2ecfe4[_0xb98f('0x2b')],qs['fields'](_0x366809['query']['fields']));_0x44e730[_0xb98f('0x2c')]=_0x44e730[_0xb98f('0x2c')][_0xb98f('0x2e')]?_0x44e730[_0xb98f('0x2c')]:_0x2ecfe4['model'];if(_0x366809[_0xb98f('0x29')][_0xb98f('0x36')]){_0x44e730[_0xb98f('0x37')]=[{'all':!![]}];}_0x44e730=_['merge']({},_0x44e730,_0x366809[_0xb98f('0x35')]);return db['Dynamics365Configuration']['find'](_0x44e730)[_0xb98f('0x1f')](handleEntityNotFound(_0x362bce,null))['then'](respondWithResult(_0x362bce,null))[_0xb98f('0x3a')](handleError(_0x362bce,null));};exports[_0xb98f('0x3f')]=function(_0x52f039,_0x279d4e){return db[_0xb98f('0x26')][_0xb98f('0x3f')](_0x52f039['body'],{})[_0xb98f('0x1f')](respondWithResult(_0x279d4e,0xc9))[_0xb98f('0x3a')](handleError(_0x279d4e,null));};exports[_0xb98f('0x1e')]=function(_0x4dbdef,_0x7652db){if(_0x4dbdef[_0xb98f('0x40')]['id']){delete _0x4dbdef[_0xb98f('0x40')]['id'];}return db[_0xb98f('0x26')][_0xb98f('0x41')]({'where':{'id':_0x4dbdef[_0xb98f('0x3c')]['id']}})[_0xb98f('0x1f')](handleEntityNotFound(_0x7652db,null))['then'](saveUpdates(_0x4dbdef[_0xb98f('0x40')],null))[_0xb98f('0x1f')](respondWithResult(_0x7652db,null))[_0xb98f('0x3a')](handleError(_0x7652db,null));};exports[_0xb98f('0x20')]=function(_0xd7ba03,_0x4ebee8){return db[_0xb98f('0x26')][_0xb98f('0x41')]({'where':{'id':_0xd7ba03[_0xb98f('0x3c')]['id']}})[_0xb98f('0x1f')](handleEntityNotFound(_0x4ebee8,null))[_0xb98f('0x1f')](removeEntity(_0x4ebee8,null))[_0xb98f('0x3a')](handleError(_0x4ebee8,null));};exports[_0xb98f('0x42')]=function(_0x3c3c42,_0x475f11,_0x5ec334){var _0x5952fe={};var _0x43b7a5={};var _0x122a1e;var _0x402503;return db[_0xb98f('0x26')][_0xb98f('0x43')]({'where':{'id':_0x3c3c42[_0xb98f('0x3c')]['id']}})[_0xb98f('0x1f')](handleEntityNotFound(_0x475f11,null))[_0xb98f('0x1f')](function(_0x5eec4d){if(_0x5eec4d){_0x122a1e=_0x5eec4d;_0x43b7a5[_0xb98f('0x2b')]=_[_0xb98f('0x3d')](db[_0xb98f('0x44')][_0xb98f('0x27')]);_0x43b7a5[_0xb98f('0x29')]=_[_0xb98f('0x3d')](_0x3c3c42['query']);_0x43b7a5[_0xb98f('0x2a')]=_[_0xb98f('0x3e')](_0x43b7a5[_0xb98f('0x2b')],_0x43b7a5[_0xb98f('0x29')]);_0x5952fe['attributes']=_[_0xb98f('0x3e')](_0x43b7a5['model'],qs[_0xb98f('0x2d')](_0x3c3c42[_0xb98f('0x29')][_0xb98f('0x2d')]));_0x5952fe[_0xb98f('0x2c')]=_0x5952fe[_0xb98f('0x2c')][_0xb98f('0x2e')]?_0x5952fe['attributes']:_0x43b7a5['model'];_0x5952fe['order']=qs[_0xb98f('0x30')](_0x3c3c42[_0xb98f('0x29')][_0xb98f('0x30')]);_0x5952fe['where']=qs['filters'](_[_0xb98f('0x31')](_0x3c3c42['query'],_0x43b7a5[_0xb98f('0x2a')]));if(_0x3c3c42[_0xb98f('0x29')][_0xb98f('0x32')]){_0x5952fe['where']=_[_0xb98f('0x34')](_0x5952fe[_0xb98f('0x33')],{'$or':_[_0xb98f('0x25')](_0x5952fe[_0xb98f('0x2c')],function(_0x25cffe){var _0xd17be7={};_0xd17be7[_0x25cffe]={'$like':'%'+_0x3c3c42[_0xb98f('0x29')][_0xb98f('0x32')]+'%'};return _0xd17be7;})});}_0x5952fe=_[_0xb98f('0x34')]({},_0x5952fe,_0x3c3c42[_0xb98f('0x35')]);return _0x122a1e['getFields'](_0x5952fe);}})[_0xb98f('0x1f')](function(_0x448e93){if(_0x448e93){_0x402503=_0x448e93[_0xb98f('0x2e')];if(!_0x3c3c42[_0xb98f('0x29')][_0xb98f('0x45')](_0xb98f('0x2f'))){_0x5952fe[_0xb98f('0x19')]=qs[_0xb98f('0x19')](_0x3c3c42[_0xb98f('0x29')][_0xb98f('0x19')]);_0x5952fe[_0xb98f('0x17')]=qs[_0xb98f('0x17')](_0x3c3c42[_0xb98f('0x29')][_0xb98f('0x17')]);}return _0x122a1e[_0xb98f('0x42')](_0x5952fe);}})[_0xb98f('0x1f')](function(_0x3515a6){if(_0x3515a6){return _0x3515a6?{'count':_0x402503,'rows':_0x3515a6}:null;}})[_0xb98f('0x1f')](respondWithResult(_0x475f11,null))['catch'](handleError(_0x475f11,null));};exports[_0xb98f('0x46')]=function(_0x43ef71,_0x3d90de,_0x2fd9f5){var _0x314f93={};var _0x727fb={};var _0x3798e4;var _0xd1e000;return db[_0xb98f('0x26')][_0xb98f('0x43')]({'where':{'id':_0x43ef71[_0xb98f('0x3c')]['id']}})[_0xb98f('0x1f')](handleEntityNotFound(_0x3d90de,null))[_0xb98f('0x1f')](function(_0x1de08b){if(_0x1de08b){_0x3798e4=_0x1de08b;_0x727fb[_0xb98f('0x2b')]=_[_0xb98f('0x3d')](db[_0xb98f('0x44')][_0xb98f('0x27')]);_0x727fb[_0xb98f('0x29')]=_['keys'](_0x43ef71[_0xb98f('0x29')]);_0x727fb[_0xb98f('0x2a')]=_[_0xb98f('0x3e')](_0x727fb[_0xb98f('0x2b')],_0x727fb[_0xb98f('0x29')]);_0x314f93[_0xb98f('0x2c')]=_[_0xb98f('0x3e')](_0x727fb[_0xb98f('0x2b')],qs['fields'](_0x43ef71['query'][_0xb98f('0x2d')]));_0x314f93[_0xb98f('0x2c')]=_0x314f93[_0xb98f('0x2c')]['length']?_0x314f93[_0xb98f('0x2c')]:_0x727fb[_0xb98f('0x2b')];_0x314f93[_0xb98f('0x47')]=qs['sort'](_0x43ef71[_0xb98f('0x29')]['sort']);_0x314f93[_0xb98f('0x33')]=qs[_0xb98f('0x2a')](_[_0xb98f('0x31')](_0x43ef71[_0xb98f('0x29')],_0x727fb[_0xb98f('0x2a')]));if(_0x43ef71[_0xb98f('0x29')]['filter']){_0x314f93[_0xb98f('0x33')]=_[_0xb98f('0x34')](_0x314f93[_0xb98f('0x33')],{'$or':_[_0xb98f('0x25')](_0x314f93['attributes'],function(_0x16f1fd){var _0x44c91b={};_0x44c91b[_0x16f1fd]={'$like':'%'+_0x43ef71[_0xb98f('0x29')][_0xb98f('0x32')]+'%'};return _0x44c91b;})});}_0x314f93=_[_0xb98f('0x34')]({},_0x314f93,_0x43ef71['options']);return _0x3798e4[_0xb98f('0x46')](_0x314f93);}})[_0xb98f('0x1f')](function(_0x373f45){if(_0x373f45){_0xd1e000=_0x373f45[_0xb98f('0x2e')];if(!_0x43ef71['query'][_0xb98f('0x45')](_0xb98f('0x2f'))){_0x314f93['limit']=qs['limit'](_0x43ef71['query']['limit']);_0x314f93[_0xb98f('0x17')]=qs[_0xb98f('0x17')](_0x43ef71[_0xb98f('0x29')][_0xb98f('0x17')]);}return _0x3798e4[_0xb98f('0x46')](_0x314f93);}})[_0xb98f('0x1f')](function(_0x1c7b63){if(_0x1c7b63){return _0x1c7b63?{'count':_0xd1e000,'rows':_0x1c7b63}:null;}})['then'](respondWithResult(_0x3d90de,null))[_0xb98f('0x3a')](handleError(_0x3d90de,null));};exports[_0xb98f('0x48')]=function(_0x58f6d5,_0x48ad66,_0x2caee4){var _0x24679d={};var _0x2ba131={};var _0x2306c6;var _0x4b5a3e;return db['Dynamics365Configuration'][_0xb98f('0x43')]({'where':{'id':_0x58f6d5[_0xb98f('0x3c')]['id']}})[_0xb98f('0x1f')](handleEntityNotFound(_0x48ad66,null))[_0xb98f('0x1f')](function(_0x59e1ff){if(_0x59e1ff){_0x2306c6=_0x59e1ff;_0x2ba131['model']=_[_0xb98f('0x3d')](db[_0xb98f('0x44')][_0xb98f('0x27')]);_0x2ba131['query']=_['keys'](_0x58f6d5[_0xb98f('0x29')]);_0x2ba131[_0xb98f('0x2a')]=_['intersection'](_0x2ba131[_0xb98f('0x2b')],_0x2ba131[_0xb98f('0x29')]);_0x24679d['attributes']=_[_0xb98f('0x3e')](_0x2ba131['model'],qs['fields'](_0x58f6d5[_0xb98f('0x29')]['fields']));_0x24679d[_0xb98f('0x2c')]=_0x24679d[_0xb98f('0x2c')][_0xb98f('0x2e')]?_0x24679d['attributes']:_0x2ba131[_0xb98f('0x2b')];_0x24679d[_0xb98f('0x47')]=qs[_0xb98f('0x30')](_0x58f6d5[_0xb98f('0x29')][_0xb98f('0x30')]);_0x24679d[_0xb98f('0x33')]=qs[_0xb98f('0x2a')](_[_0xb98f('0x31')](_0x58f6d5[_0xb98f('0x29')],_0x2ba131[_0xb98f('0x2a')]));if(_0x58f6d5['query'][_0xb98f('0x32')]){_0x24679d['where']=_[_0xb98f('0x34')](_0x24679d[_0xb98f('0x33')],{'$or':_[_0xb98f('0x25')](_0x24679d['attributes'],function(_0x443f78){var _0x2f8e67={};_0x2f8e67[_0x443f78]={'$like':'%'+_0x58f6d5[_0xb98f('0x29')][_0xb98f('0x32')]+'%'};return _0x2f8e67;})});}_0x24679d=_[_0xb98f('0x34')]({},_0x24679d,_0x58f6d5['options']);return _0x2306c6[_0xb98f('0x48')](_0x24679d);}})[_0xb98f('0x1f')](function(_0x1c40ef){if(_0x1c40ef){_0x4b5a3e=_0x1c40ef['length'];if(!_0x58f6d5['query'][_0xb98f('0x45')](_0xb98f('0x2f'))){_0x24679d[_0xb98f('0x19')]=qs[_0xb98f('0x19')](_0x58f6d5[_0xb98f('0x29')][_0xb98f('0x19')]);_0x24679d['offset']=qs[_0xb98f('0x17')](_0x58f6d5[_0xb98f('0x29')]['offset']);}return _0x2306c6['getDescriptions'](_0x24679d);}})[_0xb98f('0x1f')](function(_0x3a02ff){if(_0x3a02ff){return _0x3a02ff?{'count':_0x4b5a3e,'rows':_0x3a02ff}:null;}})[_0xb98f('0x1f')](respondWithResult(_0x48ad66,null))[_0xb98f('0x3a')](handleError(_0x48ad66,null));}; \ No newline at end of file +var _0x730b=['findAll','rows','show','params','rawAttributes','find','create','body','catch','findOne','Dynamics365Field','filter','getFields','nolimit','getSubjects','getDescriptions','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','map','Dynamics365Configuration','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x5dc242,_0x3e61ac){var _0x2bb6f8=function(_0x42661e){while(--_0x42661e){_0x5dc242['push'](_0x5dc242['shift']());}};_0x2bb6f8(++_0x3e61ac);}(_0x730b,0x191));var _0xb730=function(_0x1e7d6d,_0x2d5a66){_0x1e7d6d=_0x1e7d6d-0x0;var _0x1ea7b6=_0x730b[_0x1e7d6d];return _0x1ea7b6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb730('0x0'));var rp=require('request-promise');var moment=require(_0xb730('0x1'));var BPromise=require(_0xb730('0x2'));var Mustache=require(_0xb730('0x3'));var util=require(_0xb730('0x4'));var path=require(_0xb730('0x5'));var sox=require('sox');var csv=require(_0xb730('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb730('0x7'));var _=require(_0xb730('0x8'));var squel=require(_0xb730('0x9'));var crypto=require('crypto');var jsforce=require(_0xb730('0xa'));var deskjs=require(_0xb730('0xb'));var toCsv=require(_0xb730('0x6'));var querystring=require('querystring');var Papa=require(_0xb730('0xc'));var Redis=require(_0xb730('0xd'));var authService=require(_0xb730('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xb730('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb730('0x10'));var licenseUtil=require(_0xb730('0x11'));var db=require(_0xb730('0x12'))['db'];function respondWithStatusCode(_0x315505,_0xd42a65){_0xd42a65=_0xd42a65||0xcc;return function(_0x2fbdc0){if(_0x2fbdc0){return _0x315505['sendStatus'](_0xd42a65);}return _0x315505[_0xb730('0x13')](_0xd42a65)['end']();};}function respondWithResult(_0x4758ad,_0x1b687e){_0x1b687e=_0x1b687e||0xc8;return function(_0x18a4dc){if(_0x18a4dc){return _0x4758ad[_0xb730('0x13')](_0x1b687e)[_0xb730('0x14')](_0x18a4dc);}};}function respondWithFilteredResult(_0x21664a,_0x302fc9){return function(_0x1be3e3){if(_0x1be3e3){var _0x56c070=typeof _0x302fc9[_0xb730('0x15')]===_0xb730('0x16')&&typeof _0x302fc9[_0xb730('0x17')]===_0xb730('0x16');var _0x59ecea=_0x1be3e3[_0xb730('0x18')];var _0x2b81a6=_0x56c070?0x0:_0x302fc9[_0xb730('0x15')];var _0x198d43=_0x56c070?_0x1be3e3[_0xb730('0x18')]:_0x302fc9['offset']+_0x302fc9[_0xb730('0x17')];var _0x326e47;if(_0x198d43>=_0x59ecea){_0x198d43=_0x59ecea;_0x326e47=0xc8;}else{_0x326e47=0xce;}_0x21664a[_0xb730('0x13')](_0x326e47);return _0x21664a['set'](_0xb730('0x19'),_0x2b81a6+'-'+_0x198d43+'/'+_0x59ecea)[_0xb730('0x14')](_0x1be3e3);}return null;};}function patchUpdates(_0x2030d9){return function(_0x34ff9e){try{jsonpatch[_0xb730('0x1a')](_0x34ff9e,_0x2030d9,!![]);}catch(_0x5579db){return BPromise[_0xb730('0x1b')](_0x5579db);}return _0x34ff9e[_0xb730('0x1c')]();};}function saveUpdates(_0x1d3ac9,_0x5daef7){return function(_0x52ee55){if(_0x52ee55){return _0x52ee55[_0xb730('0x1d')](_0x1d3ac9)[_0xb730('0x1e')](function(_0x25e63e){return _0x25e63e;});}return null;};}function removeEntity(_0x2c1d44,_0x4d5cc0){return function(_0x2cab11){if(_0x2cab11){return _0x2cab11[_0xb730('0x1f')]()[_0xb730('0x1e')](function(){_0x2c1d44[_0xb730('0x13')](0xcc)[_0xb730('0x20')]();});}};}function handleEntityNotFound(_0x2dd396,_0x302cbc){return function(_0x22cd68){if(!_0x22cd68){_0x2dd396[_0xb730('0x21')](0x194);}return _0x22cd68;};}function handleError(_0x1daffb,_0x39fa4e){_0x39fa4e=_0x39fa4e||0x1f4;return function(_0x1b5a2c){logger['error'](_0x1b5a2c[_0xb730('0x22')]);if(_0x1b5a2c['name']){delete _0x1b5a2c[_0xb730('0x23')];}_0x1daffb[_0xb730('0x13')](_0x39fa4e)[_0xb730('0x24')](_0x1b5a2c);};}exports[_0xb730('0x25')]=function(_0x2b2a19,_0x40ced3){var _0x2778a1={},_0x240183={},_0xd7505c={'count':0x0,'rows':[]};var _0x44e6b9=_[_0xb730('0x26')](db[_0xb730('0x27')]['rawAttributes'],function(_0x3fbca5){return{'name':_0x3fbca5[_0xb730('0x28')],'type':_0x3fbca5[_0xb730('0x29')][_0xb730('0x2a')]};});_0x240183[_0xb730('0x2b')]=_[_0xb730('0x26')](_0x44e6b9,'name');_0x240183[_0xb730('0x2c')]=_[_0xb730('0x2d')](_0x2b2a19['query']);_0x240183[_0xb730('0x2e')]=_['intersection'](_0x240183['model'],_0x240183[_0xb730('0x2c')]);_0x2778a1[_0xb730('0x2f')]=_[_0xb730('0x30')](_0x240183['model'],qs['fields'](_0x2b2a19['query'][_0xb730('0x31')]));_0x2778a1[_0xb730('0x2f')]=_0x2778a1[_0xb730('0x2f')][_0xb730('0x32')]?_0x2778a1[_0xb730('0x2f')]:_0x240183['model'];if(!_0x2b2a19[_0xb730('0x2c')][_0xb730('0x33')]('nolimit')){_0x2778a1[_0xb730('0x17')]=qs[_0xb730('0x17')](_0x2b2a19[_0xb730('0x2c')]['limit']);_0x2778a1[_0xb730('0x15')]=qs[_0xb730('0x15')](_0x2b2a19['query'][_0xb730('0x15')]);}_0x2778a1[_0xb730('0x34')]=qs[_0xb730('0x35')](_0x2b2a19[_0xb730('0x2c')]['sort']);_0x2778a1['where']=qs[_0xb730('0x2e')](_[_0xb730('0x36')](_0x2b2a19[_0xb730('0x2c')],_0x240183[_0xb730('0x2e')]),_0x44e6b9);if(_0x2b2a19[_0xb730('0x2c')]['filter']){_0x2778a1[_0xb730('0x37')]=_[_0xb730('0x38')](_0x2778a1['where'],{'$or':_[_0xb730('0x26')](_0x44e6b9,function(_0x22ef8b){if(_0x22ef8b[_0xb730('0x29')]!==_0xb730('0x39')){var _0x47954c={};_0x47954c[_0x22ef8b['name']]={'$like':'%'+_0x2b2a19['query']['filter']+'%'};return _0x47954c;}})});}_0x2778a1=_[_0xb730('0x38')]({},_0x2778a1,_0x2b2a19[_0xb730('0x3a')]);var _0x141405={'where':_0x2778a1['where']};return db[_0xb730('0x27')][_0xb730('0x18')](_0x141405)[_0xb730('0x1e')](function(_0x40d6f6){_0xd7505c[_0xb730('0x18')]=_0x40d6f6;if(_0x2b2a19[_0xb730('0x2c')][_0xb730('0x3b')]){_0x2778a1[_0xb730('0x3c')]=[{'all':!![]}];}return db[_0xb730('0x27')][_0xb730('0x3d')](_0x2778a1);})[_0xb730('0x1e')](function(_0x2191e6){_0xd7505c[_0xb730('0x3e')]=_0x2191e6;return _0xd7505c;})[_0xb730('0x1e')](respondWithFilteredResult(_0x40ced3,_0x2778a1))['catch'](handleError(_0x40ced3,null));};exports[_0xb730('0x3f')]=function(_0x18e219,_0x378499){var _0x4756b4={'raw':![],'where':{'id':_0x18e219[_0xb730('0x40')]['id']}},_0x180939={};_0x180939[_0xb730('0x2b')]=_['keys'](db[_0xb730('0x27')][_0xb730('0x41')]);_0x180939[_0xb730('0x2c')]=_[_0xb730('0x2d')](_0x18e219[_0xb730('0x2c')]);_0x180939[_0xb730('0x2e')]=_[_0xb730('0x30')](_0x180939[_0xb730('0x2b')],_0x180939[_0xb730('0x2c')]);_0x4756b4[_0xb730('0x2f')]=_[_0xb730('0x30')](_0x180939[_0xb730('0x2b')],qs[_0xb730('0x31')](_0x18e219[_0xb730('0x2c')][_0xb730('0x31')]));_0x4756b4['attributes']=_0x4756b4[_0xb730('0x2f')][_0xb730('0x32')]?_0x4756b4[_0xb730('0x2f')]:_0x180939['model'];if(_0x18e219[_0xb730('0x2c')]['includeAll']){_0x4756b4['include']=[{'all':!![]}];}_0x4756b4=_[_0xb730('0x38')]({},_0x4756b4,_0x18e219[_0xb730('0x3a')]);return db[_0xb730('0x27')][_0xb730('0x42')](_0x4756b4)[_0xb730('0x1e')](handleEntityNotFound(_0x378499,null))[_0xb730('0x1e')](respondWithResult(_0x378499,null))['catch'](handleError(_0x378499,null));};exports[_0xb730('0x43')]=function(_0x3ce36a,_0x2c5f74){return db['Dynamics365Configuration'][_0xb730('0x43')](_0x3ce36a[_0xb730('0x44')],{})['then'](respondWithResult(_0x2c5f74,0xc9))[_0xb730('0x45')](handleError(_0x2c5f74,null));};exports[_0xb730('0x1d')]=function(_0x559f4c,_0x26fd86){if(_0x559f4c[_0xb730('0x44')]['id']){delete _0x559f4c['body']['id'];}return db[_0xb730('0x27')]['find']({'where':{'id':_0x559f4c[_0xb730('0x40')]['id']}})[_0xb730('0x1e')](handleEntityNotFound(_0x26fd86,null))[_0xb730('0x1e')](saveUpdates(_0x559f4c['body'],null))['then'](respondWithResult(_0x26fd86,null))[_0xb730('0x45')](handleError(_0x26fd86,null));};exports['destroy']=function(_0x560580,_0x3a710f){return db[_0xb730('0x27')][_0xb730('0x42')]({'where':{'id':_0x560580['params']['id']}})[_0xb730('0x1e')](handleEntityNotFound(_0x3a710f,null))['then'](removeEntity(_0x3a710f,null))['catch'](handleError(_0x3a710f,null));};exports['getFields']=function(_0x2fb5a7,_0x4b0b20,_0x233ccc){var _0x3ae635={};var _0x268f06={};var _0x395fc7;var _0x5e9b44;return db[_0xb730('0x27')][_0xb730('0x46')]({'where':{'id':_0x2fb5a7[_0xb730('0x40')]['id']}})['then'](handleEntityNotFound(_0x4b0b20,null))[_0xb730('0x1e')](function(_0x1a4533){if(_0x1a4533){_0x395fc7=_0x1a4533;_0x268f06[_0xb730('0x2b')]=_[_0xb730('0x2d')](db[_0xb730('0x47')]['rawAttributes']);_0x268f06[_0xb730('0x2c')]=_[_0xb730('0x2d')](_0x2fb5a7[_0xb730('0x2c')]);_0x268f06[_0xb730('0x2e')]=_[_0xb730('0x30')](_0x268f06[_0xb730('0x2b')],_0x268f06[_0xb730('0x2c')]);_0x3ae635[_0xb730('0x2f')]=_[_0xb730('0x30')](_0x268f06[_0xb730('0x2b')],qs['fields'](_0x2fb5a7['query']['fields']));_0x3ae635[_0xb730('0x2f')]=_0x3ae635[_0xb730('0x2f')][_0xb730('0x32')]?_0x3ae635[_0xb730('0x2f')]:_0x268f06[_0xb730('0x2b')];_0x3ae635['order']=qs[_0xb730('0x35')](_0x2fb5a7[_0xb730('0x2c')][_0xb730('0x35')]);_0x3ae635['where']=qs['filters'](_['pick'](_0x2fb5a7[_0xb730('0x2c')],_0x268f06[_0xb730('0x2e')]));if(_0x2fb5a7[_0xb730('0x2c')]['filter']){_0x3ae635['where']=_[_0xb730('0x38')](_0x3ae635['where'],{'$or':_[_0xb730('0x26')](_0x3ae635[_0xb730('0x2f')],function(_0x1c7603){var _0x3006db={};_0x3006db[_0x1c7603]={'$like':'%'+_0x2fb5a7[_0xb730('0x2c')][_0xb730('0x48')]+'%'};return _0x3006db;})});}_0x3ae635=_[_0xb730('0x38')]({},_0x3ae635,_0x2fb5a7[_0xb730('0x3a')]);return _0x395fc7[_0xb730('0x49')](_0x3ae635);}})[_0xb730('0x1e')](function(_0x3f1c06){if(_0x3f1c06){_0x5e9b44=_0x3f1c06[_0xb730('0x32')];if(!_0x2fb5a7[_0xb730('0x2c')][_0xb730('0x33')](_0xb730('0x4a'))){_0x3ae635[_0xb730('0x17')]=qs[_0xb730('0x17')](_0x2fb5a7[_0xb730('0x2c')]['limit']);_0x3ae635[_0xb730('0x15')]=qs[_0xb730('0x15')](_0x2fb5a7['query'][_0xb730('0x15')]);}return _0x395fc7[_0xb730('0x49')](_0x3ae635);}})['then'](function(_0x415ba7){if(_0x415ba7){return _0x415ba7?{'count':_0x5e9b44,'rows':_0x415ba7}:null;}})['then'](respondWithResult(_0x4b0b20,null))[_0xb730('0x45')](handleError(_0x4b0b20,null));};exports['getSubjects']=function(_0x212688,_0x2c23b1,_0x6d24d3){var _0x4bd2fb={};var _0x2f1099={};var _0x473299;var _0x391269;return db[_0xb730('0x27')]['findOne']({'where':{'id':_0x212688['params']['id']}})[_0xb730('0x1e')](handleEntityNotFound(_0x2c23b1,null))[_0xb730('0x1e')](function(_0x5a6317){if(_0x5a6317){_0x473299=_0x5a6317;_0x2f1099[_0xb730('0x2b')]=_[_0xb730('0x2d')](db['Dynamics365Field'][_0xb730('0x41')]);_0x2f1099['query']=_[_0xb730('0x2d')](_0x212688['query']);_0x2f1099['filters']=_[_0xb730('0x30')](_0x2f1099[_0xb730('0x2b')],_0x2f1099[_0xb730('0x2c')]);_0x4bd2fb[_0xb730('0x2f')]=_[_0xb730('0x30')](_0x2f1099[_0xb730('0x2b')],qs[_0xb730('0x31')](_0x212688[_0xb730('0x2c')][_0xb730('0x31')]));_0x4bd2fb[_0xb730('0x2f')]=_0x4bd2fb[_0xb730('0x2f')][_0xb730('0x32')]?_0x4bd2fb[_0xb730('0x2f')]:_0x2f1099['model'];_0x4bd2fb['order']=qs[_0xb730('0x35')](_0x212688[_0xb730('0x2c')]['sort']);_0x4bd2fb[_0xb730('0x37')]=qs[_0xb730('0x2e')](_[_0xb730('0x36')](_0x212688['query'],_0x2f1099[_0xb730('0x2e')]));if(_0x212688[_0xb730('0x2c')][_0xb730('0x48')]){_0x4bd2fb[_0xb730('0x37')]=_[_0xb730('0x38')](_0x4bd2fb['where'],{'$or':_[_0xb730('0x26')](_0x4bd2fb[_0xb730('0x2f')],function(_0x37682f){var _0xcea3d8={};_0xcea3d8[_0x37682f]={'$like':'%'+_0x212688[_0xb730('0x2c')]['filter']+'%'};return _0xcea3d8;})});}_0x4bd2fb=_[_0xb730('0x38')]({},_0x4bd2fb,_0x212688['options']);return _0x473299[_0xb730('0x4b')](_0x4bd2fb);}})[_0xb730('0x1e')](function(_0x317b5d){if(_0x317b5d){_0x391269=_0x317b5d[_0xb730('0x32')];if(!_0x212688['query']['hasOwnProperty']('nolimit')){_0x4bd2fb[_0xb730('0x17')]=qs[_0xb730('0x17')](_0x212688[_0xb730('0x2c')]['limit']);_0x4bd2fb[_0xb730('0x15')]=qs[_0xb730('0x15')](_0x212688[_0xb730('0x2c')][_0xb730('0x15')]);}return _0x473299[_0xb730('0x4b')](_0x4bd2fb);}})[_0xb730('0x1e')](function(_0x122908){if(_0x122908){return _0x122908?{'count':_0x391269,'rows':_0x122908}:null;}})[_0xb730('0x1e')](respondWithResult(_0x2c23b1,null))[_0xb730('0x45')](handleError(_0x2c23b1,null));};exports[_0xb730('0x4c')]=function(_0x317984,_0x55fb0a,_0x37440a){var _0x5bad56={};var _0x520cfb={};var _0x1a60e4;var _0x1e07b7;return db[_0xb730('0x27')][_0xb730('0x46')]({'where':{'id':_0x317984[_0xb730('0x40')]['id']}})[_0xb730('0x1e')](handleEntityNotFound(_0x55fb0a,null))[_0xb730('0x1e')](function(_0x1ad029){if(_0x1ad029){_0x1a60e4=_0x1ad029;_0x520cfb[_0xb730('0x2b')]=_[_0xb730('0x2d')](db[_0xb730('0x47')][_0xb730('0x41')]);_0x520cfb[_0xb730('0x2c')]=_[_0xb730('0x2d')](_0x317984['query']);_0x520cfb[_0xb730('0x2e')]=_[_0xb730('0x30')](_0x520cfb[_0xb730('0x2b')],_0x520cfb['query']);_0x5bad56['attributes']=_[_0xb730('0x30')](_0x520cfb[_0xb730('0x2b')],qs['fields'](_0x317984['query'][_0xb730('0x31')]));_0x5bad56[_0xb730('0x2f')]=_0x5bad56[_0xb730('0x2f')][_0xb730('0x32')]?_0x5bad56['attributes']:_0x520cfb['model'];_0x5bad56['order']=qs[_0xb730('0x35')](_0x317984['query'][_0xb730('0x35')]);_0x5bad56['where']=qs[_0xb730('0x2e')](_[_0xb730('0x36')](_0x317984[_0xb730('0x2c')],_0x520cfb[_0xb730('0x2e')]));if(_0x317984[_0xb730('0x2c')][_0xb730('0x48')]){_0x5bad56['where']=_[_0xb730('0x38')](_0x5bad56[_0xb730('0x37')],{'$or':_[_0xb730('0x26')](_0x5bad56[_0xb730('0x2f')],function(_0x25079d){var _0x2755d4={};_0x2755d4[_0x25079d]={'$like':'%'+_0x317984[_0xb730('0x2c')][_0xb730('0x48')]+'%'};return _0x2755d4;})});}_0x5bad56=_[_0xb730('0x38')]({},_0x5bad56,_0x317984[_0xb730('0x3a')]);return _0x1a60e4[_0xb730('0x4c')](_0x5bad56);}})[_0xb730('0x1e')](function(_0x156fb7){if(_0x156fb7){_0x1e07b7=_0x156fb7[_0xb730('0x32')];if(!_0x317984['query'][_0xb730('0x33')](_0xb730('0x4a'))){_0x5bad56[_0xb730('0x17')]=qs[_0xb730('0x17')](_0x317984[_0xb730('0x2c')][_0xb730('0x17')]);_0x5bad56['offset']=qs[_0xb730('0x15')](_0x317984[_0xb730('0x2c')][_0xb730('0x15')]);}return _0x1a60e4[_0xb730('0x4c')](_0x5bad56);}})['then'](function(_0x1b2415){if(_0x1b2415){return _0x1b2415?{'count':_0x1e07b7,'rows':_0x1b2415}:null;}})[_0xb730('0x1e')](respondWithResult(_0x55fb0a,null))[_0xb730('0x45')](handleError(_0x55fb0a,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 97643de..67cd57c 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 _0x34e8=['int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration'];(function(_0x2980b2,_0x40bc92){var _0x3815be=function(_0xd9c5a1){while(--_0xd9c5a1){_0x2980b2['push'](_0x2980b2['shift']());}};_0x3815be(++_0x40bc92);}(_0x34e8,0x12c));var _0x834e=function(_0x4ff536,_0x5e7c62){_0x4ff536=_0x4ff536-0x0;var _0x30f946=_0x34e8[_0x4ff536];return _0x30f946;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00bb=['util','../../config/logger','moment','request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x38cebb,_0x137c66){var _0x2d3ef8=function(_0x2d0579){while(--_0x2d0579){_0x38cebb['push'](_0x38cebb['shift']());}};_0x2d3ef8(++_0x137c66);}(_0x00bb,0x1d8));var _0xb00b=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x00bb[_0x3054be];return _0x3df150;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index cb89011..8ca16a5 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 _0xc9b8=['Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xc9b8,0xd7));var _0x8c9b=function(_0x1e2868,_0x144b25){_0x1e2868=_0x1e2868-0x0;var _0x53dfc1=_0xc9b8[_0x1e2868];return _0x53dfc1;};'use strict';var _=require(_0x8c9b('0x0'));var util=require(_0x8c9b('0x1'));var moment=require(_0x8c9b('0x2'));var BPromise=require(_0x8c9b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c9b('0x4'));var db=require(_0x8c9b('0x5'))['db'];var utils=require(_0x8c9b('0x6'));var logger=require(_0x8c9b('0x7'))('rpc');var config=require(_0x8c9b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8c9b('0x9')][_0x8c9b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f08eb,_0xea5b71,_0x56ed45){return new BPromise(function(_0x3f1d11,_0x3fc0a4){return client[_0x8c9b('0xb')](_0x5f08eb,_0x56ed45)['then'](function(_0x149256){logger[_0x8c9b('0xc')](_0x8c9b('0xd'),_0xea5b71,_0x8c9b('0xe'));logger[_0x8c9b('0xf')](_0x8c9b('0x10'),_0xea5b71,_0x8c9b('0xe'),JSON[_0x8c9b('0x11')](_0x149256));if(_0x149256[_0x8c9b('0x12')]){if(_0x149256[_0x8c9b('0x12')]['code']===0x1f4){logger['error'](_0x8c9b('0xd'),_0xea5b71,_0x149256[_0x8c9b('0x12')][_0x8c9b('0x13')]);return _0x3fc0a4(_0x149256[_0x8c9b('0x12')][_0x8c9b('0x13')]);}logger[_0x8c9b('0x12')](_0x8c9b('0xd'),_0xea5b71,_0x149256[_0x8c9b('0x12')][_0x8c9b('0x13')]);return _0x3f1d11(_0x149256[_0x8c9b('0x12')][_0x8c9b('0x13')]);}else{logger[_0x8c9b('0xc')](_0x8c9b('0xd'),_0xea5b71,_0x8c9b('0xe'));_0x3f1d11(_0x149256['result'][_0x8c9b('0x13')]);}})[_0x8c9b('0x14')](function(_0x445bb7){logger[_0x8c9b('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0xea5b71,_0x445bb7);_0x3fc0a4(_0x445bb7);});});} \ No newline at end of file +var _0x4697=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x57ec4a,_0x39224f){var _0x55969d=function(_0x493b2d){while(--_0x493b2d){_0x57ec4a['push'](_0x57ec4a['shift']());}};_0x55969d(++_0x39224f);}(_0x4697,0x10c));var _0x7469=function(_0x371d6e,_0x3955d0){_0x371d6e=_0x371d6e-0x0;var _0x480004=_0x4697[_0x371d6e];return _0x480004;};'use strict';var _=require(_0x7469('0x0'));var util=require(_0x7469('0x1'));var moment=require(_0x7469('0x2'));var BPromise=require(_0x7469('0x3'));var rs=require(_0x7469('0x4'));var fs=require('fs');var Redis=require(_0x7469('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7469('0x6'))(_0x7469('0x7'));var config=require('../../config/environment');var jayson=require(_0x7469('0x8'));var client=jayson['client'][_0x7469('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf70dcf,_0x1a4286,_0x9a3d49){return new BPromise(function(_0x455a01,_0x4fbea4){return client[_0x7469('0xa')](_0xf70dcf,_0x9a3d49)[_0x7469('0xb')](function(_0x540334){logger[_0x7469('0xc')](_0x7469('0xd'),_0x1a4286,_0x7469('0xe'));logger['debug'](_0x7469('0xf'),_0x1a4286,'request\x20sent',JSON[_0x7469('0x10')](_0x540334));if(_0x540334[_0x7469('0x11')]){if(_0x540334[_0x7469('0x11')][_0x7469('0x12')]===0x1f4){logger['error'](_0x7469('0xd'),_0x1a4286,_0x540334[_0x7469('0x11')][_0x7469('0x13')]);return _0x4fbea4(_0x540334[_0x7469('0x11')][_0x7469('0x13')]);}logger[_0x7469('0x11')](_0x7469('0xd'),_0x1a4286,_0x540334[_0x7469('0x11')][_0x7469('0x13')]);return _0x455a01(_0x540334['error'][_0x7469('0x13')]);}else{logger[_0x7469('0xc')](_0x7469('0xd'),_0x1a4286,_0x7469('0xe'));_0x455a01(_0x540334[_0x7469('0x14')][_0x7469('0x13')]);}})[_0x7469('0x15')](function(_0x2c005c){logger[_0x7469('0x11')](_0x7469('0xd'),_0x1a4286,_0x2c005c);_0x4fbea4(_0x2c005c);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index c3a2131..4202723 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 _0x5c94=['isAuthenticated','show','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5c94,0x163));var _0x45c9=function(_0x421483,_0x5f4ad0){_0x421483=_0x421483-0x0;var _0x11eb48=_0x5c94[_0x421483];return _0x11eb48;};'use strict';var multer=require(_0x45c9('0x0'));var util=require(_0x45c9('0x1'));var path=require(_0x45c9('0x2'));var timeout=require(_0x45c9('0x3'));var express=require(_0x45c9('0x4'));var router=express[_0x45c9('0x5')]();var fs_extra=require(_0x45c9('0x6'));var auth=require(_0x45c9('0x7'));var interaction=require(_0x45c9('0x8'));var config=require(_0x45c9('0x9'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x45c9('0xa')]);router[_0x45c9('0xb')](_0x45c9('0xc'),auth[_0x45c9('0xd')](),controller[_0x45c9('0xe')]);router['post']('/',auth[_0x45c9('0xd')](),controller['create']);router['put']('/:id',auth[_0x45c9('0xd')](),controller['update']);router['delete'](_0x45c9('0xc'),auth[_0x45c9('0xd')](),controller[_0x45c9('0xf')]);module['exports']=router; \ No newline at end of file +var _0xb4eb=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x8f0382,_0x1c3a78){var _0x1b2a34=function(_0x368846){while(--_0x368846){_0x8f0382['push'](_0x8f0382['shift']());}};_0x1b2a34(++_0x1c3a78);}(_0xb4eb,0xfe));var _0xbb4e=function(_0x1c878c,_0xbc6905){_0x1c878c=_0x1c878c-0x0;var _0x8bb7d7=_0xb4eb[_0x1c878c];return _0x8bb7d7;};'use strict';var multer=require('multer');var util=require(_0xbb4e('0x0'));var path=require(_0xbb4e('0x1'));var timeout=require(_0xbb4e('0x2'));var express=require(_0xbb4e('0x3'));var router=express[_0xbb4e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbb4e('0x5'));var interaction=require(_0xbb4e('0x6'));var config=require(_0xbb4e('0x7'));var controller=require(_0xbb4e('0x8'));router[_0xbb4e('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb4e('0xa')]);router[_0xbb4e('0x9')](_0xbb4e('0xb'),auth[_0xbb4e('0xc')](),controller[_0xbb4e('0xd')]);router[_0xbb4e('0xe')]('/',auth['isAuthenticated'](),controller[_0xbb4e('0xf')]);router[_0xbb4e('0x10')]('/:id',auth[_0xbb4e('0xc')](),controller[_0xbb4e('0x11')]);router[_0xbb4e('0x12')](_0xbb4e('0xb'),auth[_0xbb4e('0xc')](),controller[_0xbb4e('0x13')]);module[_0xbb4e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 029e5bb..1c89b3f 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 _0xe8b6=['STRING','sequelize','exports','ENUM','string','variable','picklist'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xe8b6,0x1ac));var _0x6e8b=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe8b6[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x6e8b('0x0'));module[_0x6e8b('0x1')]={'type':{'type':Sequelize[_0x6e8b('0x2')](_0x6e8b('0x3'),_0x6e8b('0x4'),'customVariable','keyValue',_0x6e8b('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6e8b('0x6')]},'key':{'type':Sequelize[_0x6e8b('0x6')]},'keyType':{'type':Sequelize[_0x6e8b('0x2')](_0x6e8b('0x3'),_0x6e8b('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x6e8b('0x6')]},'idField':{'type':Sequelize[_0x6e8b('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6e8b('0x6')]}}; \ No newline at end of file +var _0x5c69=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x3d5184,_0x34079c){var _0x36ba50=function(_0x2b6b54){while(--_0x2b6b54){_0x3d5184['push'](_0x3d5184['shift']());}};_0x36ba50(++_0x34079c);}(_0x5c69,0x1d2));var _0x95c6=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x5c69[_0x4b2436];return _0x4f5ab2;};'use strict';var Sequelize=require(_0x95c6('0x0'));module[_0x95c6('0x1')]={'type':{'type':Sequelize[_0x95c6('0x2')](_0x95c6('0x3'),_0x95c6('0x4'),_0x95c6('0x5'),_0x95c6('0x6'),_0x95c6('0x7')),'defaultValue':_0x95c6('0x3')},'content':{'type':Sequelize[_0x95c6('0x8')]},'key':{'type':Sequelize[_0x95c6('0x8')]},'keyType':{'type':Sequelize[_0x95c6('0x2')]('string',_0x95c6('0x4'),_0x95c6('0x5'))},'keyContent':{'type':Sequelize[_0x95c6('0x8')]},'idField':{'type':Sequelize[_0x95c6('0x8')]},'nameField':{'type':Sequelize[_0x95c6('0x8')]},'customField':{'type':Sequelize[_0x95c6('0x9')],'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 ff15f71..dac028c 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 _0x0667=['end','status','undefined','limit','count','offset','set','json','apply','reject','save','update','then','destroy','error','name','send','index','Dynamics365Field','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x0667,0x76));var _0x7066=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0667[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7066('0x0'));var zipdir=require(_0x7066('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7066('0x2'));var moment=require(_0x7066('0x3'));var BPromise=require(_0x7066('0x4'));var Mustache=require(_0x7066('0x5'));var util=require('util');var path=require(_0x7066('0x6'));var sox=require(_0x7066('0x7'));var csv=require(_0x7066('0x8'));var ejs=require(_0x7066('0x9'));var fs=require('fs');var fs_extra=require(_0x7066('0xa'));var _=require('lodash');var squel=require(_0x7066('0xb'));var crypto=require('crypto');var jsforce=require(_0x7066('0xc'));var deskjs=require(_0x7066('0xd'));var toCsv=require(_0x7066('0x8'));var querystring=require(_0x7066('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7066('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7066('0x10'));var hardwareService=require(_0x7066('0x11'));var logger=require(_0x7066('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x7066('0x13'));var licenseUtil=require(_0x7066('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x515f83,_0x551724){_0x551724=_0x551724||0xcc;return function(_0x3d5f70){if(_0x3d5f70){return _0x515f83[_0x7066('0x15')](_0x551724);}return _0x515f83['status'](_0x551724)[_0x7066('0x16')]();};}function respondWithResult(_0x493ced,_0x2d9a18){_0x2d9a18=_0x2d9a18||0xc8;return function(_0x5a829c){if(_0x5a829c){return _0x493ced[_0x7066('0x17')](_0x2d9a18)['json'](_0x5a829c);}};}function respondWithFilteredResult(_0x5cde35,_0x15bba2){return function(_0x4d4f3b){if(_0x4d4f3b){var _0x4e19a6=typeof _0x15bba2['offset']===_0x7066('0x18')&&typeof _0x15bba2[_0x7066('0x19')]===_0x7066('0x18');var _0xef63ef=_0x4d4f3b['count'];var _0x4ba29b=_0x4e19a6?0x0:_0x15bba2['offset'];var _0x47b8b9=_0x4e19a6?_0x4d4f3b[_0x7066('0x1a')]:_0x15bba2[_0x7066('0x1b')]+_0x15bba2[_0x7066('0x19')];var _0x30340a;if(_0x47b8b9>=_0xef63ef){_0x47b8b9=_0xef63ef;_0x30340a=0xc8;}else{_0x30340a=0xce;}_0x5cde35[_0x7066('0x17')](_0x30340a);return _0x5cde35[_0x7066('0x1c')]('Content-Range',_0x4ba29b+'-'+_0x47b8b9+'/'+_0xef63ef)[_0x7066('0x1d')](_0x4d4f3b);}return null;};}function patchUpdates(_0x21de12){return function(_0x290da9){try{jsonpatch[_0x7066('0x1e')](_0x290da9,_0x21de12,!![]);}catch(_0xb34ed0){return BPromise[_0x7066('0x1f')](_0xb34ed0);}return _0x290da9[_0x7066('0x20')]();};}function saveUpdates(_0x42f3cd,_0x42c171){return function(_0x23ce9c){if(_0x23ce9c){return _0x23ce9c[_0x7066('0x21')](_0x42f3cd)[_0x7066('0x22')](function(_0x474915){return _0x474915;});}return null;};}function removeEntity(_0x269ca7,_0x2ea3ff){return function(_0x59fb5b){if(_0x59fb5b){return _0x59fb5b[_0x7066('0x23')]()['then'](function(){_0x269ca7['status'](0xcc)[_0x7066('0x16')]();});}};}function handleEntityNotFound(_0x51fcc4,_0x106e1d){return function(_0x16de72){if(!_0x16de72){_0x51fcc4[_0x7066('0x15')](0x194);}return _0x16de72;};}function handleError(_0x2536d4,_0x378d73){_0x378d73=_0x378d73||0x1f4;return function(_0x4fc292){logger[_0x7066('0x24')](_0x4fc292['stack']);if(_0x4fc292[_0x7066('0x25')]){delete _0x4fc292[_0x7066('0x25')];}_0x2536d4[_0x7066('0x17')](_0x378d73)[_0x7066('0x26')](_0x4fc292);};}exports[_0x7066('0x27')]=function(_0x2fc857,_0x220a53){var _0x4f2ef2={},_0x1c851b={},_0xe07fc5={'count':0x0,'rows':[]};var _0x3f2f07=_['map'](db[_0x7066('0x28')]['rawAttributes'],function(_0x3a5c0e){return{'name':_0x3a5c0e[_0x7066('0x29')],'type':_0x3a5c0e[_0x7066('0x2a')][_0x7066('0x2b')]};});_0x1c851b[_0x7066('0x2c')]=_[_0x7066('0x2d')](_0x3f2f07,_0x7066('0x25'));_0x1c851b['query']=_[_0x7066('0x2e')](_0x2fc857[_0x7066('0x2f')]);_0x1c851b[_0x7066('0x30')]=_[_0x7066('0x31')](_0x1c851b[_0x7066('0x2c')],_0x1c851b[_0x7066('0x2f')]);_0x4f2ef2[_0x7066('0x32')]=_[_0x7066('0x31')](_0x1c851b[_0x7066('0x2c')],qs[_0x7066('0x33')](_0x2fc857[_0x7066('0x2f')]['fields']));_0x4f2ef2[_0x7066('0x32')]=_0x4f2ef2[_0x7066('0x32')]['length']?_0x4f2ef2['attributes']:_0x1c851b[_0x7066('0x2c')];if(!_0x2fc857[_0x7066('0x2f')][_0x7066('0x34')]('nolimit')){_0x4f2ef2[_0x7066('0x19')]=qs[_0x7066('0x19')](_0x2fc857[_0x7066('0x2f')][_0x7066('0x19')]);_0x4f2ef2[_0x7066('0x1b')]=qs[_0x7066('0x1b')](_0x2fc857[_0x7066('0x2f')][_0x7066('0x1b')]);}_0x4f2ef2[_0x7066('0x35')]=qs[_0x7066('0x36')](_0x2fc857[_0x7066('0x2f')][_0x7066('0x36')]);_0x4f2ef2[_0x7066('0x37')]=qs[_0x7066('0x30')](_['pick'](_0x2fc857[_0x7066('0x2f')],_0x1c851b[_0x7066('0x30')]),_0x3f2f07);if(_0x2fc857[_0x7066('0x2f')][_0x7066('0x38')]){_0x4f2ef2[_0x7066('0x37')]=_[_0x7066('0x39')](_0x4f2ef2[_0x7066('0x37')],{'$or':_[_0x7066('0x2d')](_0x3f2f07,function(_0x4d43ea){if(_0x4d43ea['type']!=='VIRTUAL'){var _0x346578={};_0x346578[_0x4d43ea[_0x7066('0x25')]]={'$like':'%'+_0x2fc857[_0x7066('0x2f')][_0x7066('0x38')]+'%'};return _0x346578;}})});}_0x4f2ef2=_['merge']({},_0x4f2ef2,_0x2fc857[_0x7066('0x3a')]);var _0x32e929={'where':_0x4f2ef2[_0x7066('0x37')]};return db[_0x7066('0x28')][_0x7066('0x1a')](_0x32e929)[_0x7066('0x22')](function(_0x330bab){_0xe07fc5[_0x7066('0x1a')]=_0x330bab;if(_0x2fc857[_0x7066('0x2f')][_0x7066('0x3b')]){_0x4f2ef2[_0x7066('0x3c')]=[{'all':!![]}];}return db[_0x7066('0x28')][_0x7066('0x3d')](_0x4f2ef2);})[_0x7066('0x22')](function(_0x1f3283){_0xe07fc5['rows']=_0x1f3283;return _0xe07fc5;})[_0x7066('0x22')](respondWithFilteredResult(_0x220a53,_0x4f2ef2))[_0x7066('0x3e')](handleError(_0x220a53,null));};exports[_0x7066('0x3f')]=function(_0x5378d0,_0x21820e){var _0x276062={'raw':!![],'where':{'id':_0x5378d0[_0x7066('0x40')]['id']}},_0x4c50d6={};_0x4c50d6[_0x7066('0x2c')]=_[_0x7066('0x2e')](db['Dynamics365Field'][_0x7066('0x41')]);_0x4c50d6['query']=_[_0x7066('0x2e')](_0x5378d0[_0x7066('0x2f')]);_0x4c50d6[_0x7066('0x30')]=_['intersection'](_0x4c50d6['model'],_0x4c50d6['query']);_0x276062['attributes']=_['intersection'](_0x4c50d6['model'],qs[_0x7066('0x33')](_0x5378d0[_0x7066('0x2f')][_0x7066('0x33')]));_0x276062['attributes']=_0x276062[_0x7066('0x32')][_0x7066('0x42')]?_0x276062[_0x7066('0x32')]:_0x4c50d6['model'];if(_0x5378d0[_0x7066('0x2f')][_0x7066('0x3b')]){_0x276062[_0x7066('0x3c')]=[{'all':!![]}];}_0x276062=_[_0x7066('0x39')]({},_0x276062,_0x5378d0['options']);return db[_0x7066('0x28')][_0x7066('0x43')](_0x276062)[_0x7066('0x22')](handleEntityNotFound(_0x21820e,null))[_0x7066('0x22')](respondWithResult(_0x21820e,null))[_0x7066('0x3e')](handleError(_0x21820e,null));};exports['create']=function(_0x33de31,_0x2a324b){return db[_0x7066('0x28')][_0x7066('0x44')](_0x33de31[_0x7066('0x45')],{})[_0x7066('0x22')](respondWithResult(_0x2a324b,0xc9))[_0x7066('0x3e')](handleError(_0x2a324b,null));};exports['update']=function(_0x2e8c1b,_0x151281){if(_0x2e8c1b[_0x7066('0x45')]['id']){delete _0x2e8c1b[_0x7066('0x45')]['id'];}return db[_0x7066('0x28')][_0x7066('0x43')]({'where':{'id':_0x2e8c1b['params']['id']}})[_0x7066('0x22')](handleEntityNotFound(_0x151281,null))['then'](saveUpdates(_0x2e8c1b[_0x7066('0x45')],null))[_0x7066('0x22')](respondWithResult(_0x151281,null))[_0x7066('0x3e')](handleError(_0x151281,null));};exports[_0x7066('0x23')]=function(_0x366abc,_0x4f3ac0){return db[_0x7066('0x28')][_0x7066('0x43')]({'where':{'id':_0x366abc[_0x7066('0x40')]['id']}})[_0x7066('0x22')](handleEntityNotFound(_0x4f3ac0,null))['then'](removeEntity(_0x4f3ac0,null))[_0x7066('0x3e')](handleError(_0x4f3ac0,null));}; \ No newline at end of file +var _0x1d5a=['count','apply','reject','save','update','destroy','then','error','name','send','index','map','Dynamics365Field','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','merge','options','include','catch','show','params','rawAttributes','keys','includeAll','create','body','find','eml-format','rimraf','request-promise','moment','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x1d5a,0xfa));var _0xa1d5=function(_0x3f69ae,_0x37dc63){_0x3f69ae=_0x3f69ae-0x0;var _0x358991=_0x1d5a[_0x3f69ae];return _0x358991;};'use strict';var emlformat=require(_0xa1d5('0x0'));var rimraf=require(_0xa1d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa1d5('0x2'));var moment=require(_0xa1d5('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa1d5('0x4'));var sox=require(_0xa1d5('0x5'));var csv=require('to-csv');var ejs=require(_0xa1d5('0x6'));var fs=require('fs');var fs_extra=require(_0xa1d5('0x7'));var _=require(_0xa1d5('0x8'));var squel=require(_0xa1d5('0x9'));var crypto=require(_0xa1d5('0xa'));var jsforce=require(_0xa1d5('0xb'));var deskjs=require(_0xa1d5('0xc'));var toCsv=require(_0xa1d5('0xd'));var querystring=require('querystring');var Papa=require(_0xa1d5('0xe'));var Redis=require(_0xa1d5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa1d5('0x10'));var as=require(_0xa1d5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa1d5('0x12'));var utils=require(_0xa1d5('0x13'));var config=require(_0xa1d5('0x14'));var licenseUtil=require(_0xa1d5('0x15'));var db=require(_0xa1d5('0x16'))['db'];function respondWithStatusCode(_0x67aad9,_0x52549e){_0x52549e=_0x52549e||0xcc;return function(_0x93bc52){if(_0x93bc52){return _0x67aad9[_0xa1d5('0x17')](_0x52549e);}return _0x67aad9[_0xa1d5('0x18')](_0x52549e)[_0xa1d5('0x19')]();};}function respondWithResult(_0x51b948,_0x27caa3){_0x27caa3=_0x27caa3||0xc8;return function(_0x2cab38){if(_0x2cab38){return _0x51b948[_0xa1d5('0x18')](_0x27caa3)[_0xa1d5('0x1a')](_0x2cab38);}};}function respondWithFilteredResult(_0x291aca,_0x3c372b){return function(_0x5ea773){if(_0x5ea773){var _0x1832ee=typeof _0x3c372b['offset']===_0xa1d5('0x1b')&&typeof _0x3c372b[_0xa1d5('0x1c')]===_0xa1d5('0x1b');var _0x483509=_0x5ea773['count'];var _0x5e89f2=_0x1832ee?0x0:_0x3c372b[_0xa1d5('0x1d')];var _0x10fc23=_0x1832ee?_0x5ea773[_0xa1d5('0x1e')]:_0x3c372b[_0xa1d5('0x1d')]+_0x3c372b[_0xa1d5('0x1c')];var _0x56bc15;if(_0x10fc23>=_0x483509){_0x10fc23=_0x483509;_0x56bc15=0xc8;}else{_0x56bc15=0xce;}_0x291aca[_0xa1d5('0x18')](_0x56bc15);return _0x291aca['set']('Content-Range',_0x5e89f2+'-'+_0x10fc23+'/'+_0x483509)[_0xa1d5('0x1a')](_0x5ea773);}return null;};}function patchUpdates(_0x4e72c6){return function(_0x86f303){try{jsonpatch[_0xa1d5('0x1f')](_0x86f303,_0x4e72c6,!![]);}catch(_0x4c00cf){return BPromise[_0xa1d5('0x20')](_0x4c00cf);}return _0x86f303[_0xa1d5('0x21')]();};}function saveUpdates(_0x4bc519,_0x1acd54){return function(_0x1f8c77){if(_0x1f8c77){return _0x1f8c77[_0xa1d5('0x22')](_0x4bc519)['then'](function(_0x3fee9c){return _0x3fee9c;});}return null;};}function removeEntity(_0x5424bc,_0x40d9cd){return function(_0x47d7bc){if(_0x47d7bc){return _0x47d7bc[_0xa1d5('0x23')]()[_0xa1d5('0x24')](function(){_0x5424bc['status'](0xcc)[_0xa1d5('0x19')]();});}};}function handleEntityNotFound(_0x4e997a,_0x4e91df){return function(_0x209c01){if(!_0x209c01){_0x4e997a[_0xa1d5('0x17')](0x194);}return _0x209c01;};}function handleError(_0x10c33f,_0x4fe31b){_0x4fe31b=_0x4fe31b||0x1f4;return function(_0x2e7dae){logger[_0xa1d5('0x25')](_0x2e7dae['stack']);if(_0x2e7dae['name']){delete _0x2e7dae[_0xa1d5('0x26')];}_0x10c33f[_0xa1d5('0x18')](_0x4fe31b)[_0xa1d5('0x27')](_0x2e7dae);};}exports[_0xa1d5('0x28')]=function(_0x3aaef8,_0x10b0f5){var _0x5c40f8={},_0x1aacc3={},_0x340eb2={'count':0x0,'rows':[]};var _0xb5c279=_[_0xa1d5('0x29')](db[_0xa1d5('0x2a')]['rawAttributes'],function(_0x52817d){return{'name':_0x52817d['fieldName'],'type':_0x52817d['type'][_0xa1d5('0x2b')]};});_0x1aacc3[_0xa1d5('0x2c')]=_[_0xa1d5('0x29')](_0xb5c279,_0xa1d5('0x26'));_0x1aacc3[_0xa1d5('0x2d')]=_['keys'](_0x3aaef8['query']);_0x1aacc3[_0xa1d5('0x2e')]=_[_0xa1d5('0x2f')](_0x1aacc3[_0xa1d5('0x2c')],_0x1aacc3[_0xa1d5('0x2d')]);_0x5c40f8[_0xa1d5('0x30')]=_[_0xa1d5('0x2f')](_0x1aacc3['model'],qs[_0xa1d5('0x31')](_0x3aaef8[_0xa1d5('0x2d')][_0xa1d5('0x31')]));_0x5c40f8[_0xa1d5('0x30')]=_0x5c40f8[_0xa1d5('0x30')][_0xa1d5('0x32')]?_0x5c40f8['attributes']:_0x1aacc3['model'];if(!_0x3aaef8[_0xa1d5('0x2d')][_0xa1d5('0x33')]('nolimit')){_0x5c40f8['limit']=qs[_0xa1d5('0x1c')](_0x3aaef8['query'][_0xa1d5('0x1c')]);_0x5c40f8[_0xa1d5('0x1d')]=qs['offset'](_0x3aaef8[_0xa1d5('0x2d')][_0xa1d5('0x1d')]);}_0x5c40f8[_0xa1d5('0x34')]=qs[_0xa1d5('0x35')](_0x3aaef8[_0xa1d5('0x2d')][_0xa1d5('0x35')]);_0x5c40f8[_0xa1d5('0x36')]=qs[_0xa1d5('0x2e')](_[_0xa1d5('0x37')](_0x3aaef8[_0xa1d5('0x2d')],_0x1aacc3[_0xa1d5('0x2e')]),_0xb5c279);if(_0x3aaef8[_0xa1d5('0x2d')][_0xa1d5('0x38')]){_0x5c40f8[_0xa1d5('0x36')]=_['merge'](_0x5c40f8[_0xa1d5('0x36')],{'$or':_[_0xa1d5('0x29')](_0xb5c279,function(_0x40802b){if(_0x40802b[_0xa1d5('0x39')]!=='VIRTUAL'){var _0x3faca9={};_0x3faca9[_0x40802b[_0xa1d5('0x26')]]={'$like':'%'+_0x3aaef8['query']['filter']+'%'};return _0x3faca9;}})});}_0x5c40f8=_[_0xa1d5('0x3a')]({},_0x5c40f8,_0x3aaef8[_0xa1d5('0x3b')]);var _0x95e941={'where':_0x5c40f8[_0xa1d5('0x36')]};return db[_0xa1d5('0x2a')][_0xa1d5('0x1e')](_0x95e941)['then'](function(_0x4f88c2){_0x340eb2[_0xa1d5('0x1e')]=_0x4f88c2;if(_0x3aaef8[_0xa1d5('0x2d')]['includeAll']){_0x5c40f8[_0xa1d5('0x3c')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x5c40f8);})['then'](function(_0x26bb80){_0x340eb2['rows']=_0x26bb80;return _0x340eb2;})['then'](respondWithFilteredResult(_0x10b0f5,_0x5c40f8))[_0xa1d5('0x3d')](handleError(_0x10b0f5,null));};exports[_0xa1d5('0x3e')]=function(_0x6ca778,_0x40a419){var _0x1bf919={'raw':!![],'where':{'id':_0x6ca778[_0xa1d5('0x3f')]['id']}},_0x436f86={};_0x436f86[_0xa1d5('0x2c')]=_['keys'](db[_0xa1d5('0x2a')][_0xa1d5('0x40')]);_0x436f86['query']=_[_0xa1d5('0x41')](_0x6ca778[_0xa1d5('0x2d')]);_0x436f86[_0xa1d5('0x2e')]=_[_0xa1d5('0x2f')](_0x436f86[_0xa1d5('0x2c')],_0x436f86[_0xa1d5('0x2d')]);_0x1bf919[_0xa1d5('0x30')]=_['intersection'](_0x436f86[_0xa1d5('0x2c')],qs[_0xa1d5('0x31')](_0x6ca778[_0xa1d5('0x2d')][_0xa1d5('0x31')]));_0x1bf919[_0xa1d5('0x30')]=_0x1bf919[_0xa1d5('0x30')][_0xa1d5('0x32')]?_0x1bf919[_0xa1d5('0x30')]:_0x436f86['model'];if(_0x6ca778[_0xa1d5('0x2d')][_0xa1d5('0x42')]){_0x1bf919[_0xa1d5('0x3c')]=[{'all':!![]}];}_0x1bf919=_[_0xa1d5('0x3a')]({},_0x1bf919,_0x6ca778[_0xa1d5('0x3b')]);return db[_0xa1d5('0x2a')]['find'](_0x1bf919)[_0xa1d5('0x24')](handleEntityNotFound(_0x40a419,null))[_0xa1d5('0x24')](respondWithResult(_0x40a419,null))[_0xa1d5('0x3d')](handleError(_0x40a419,null));};exports[_0xa1d5('0x43')]=function(_0xb73936,_0x263a48){return db['Dynamics365Field'][_0xa1d5('0x43')](_0xb73936[_0xa1d5('0x44')],{})[_0xa1d5('0x24')](respondWithResult(_0x263a48,0xc9))[_0xa1d5('0x3d')](handleError(_0x263a48,null));};exports['update']=function(_0x2a0cb6,_0x523225){if(_0x2a0cb6[_0xa1d5('0x44')]['id']){delete _0x2a0cb6[_0xa1d5('0x44')]['id'];}return db['Dynamics365Field'][_0xa1d5('0x45')]({'where':{'id':_0x2a0cb6[_0xa1d5('0x3f')]['id']}})[_0xa1d5('0x24')](handleEntityNotFound(_0x523225,null))[_0xa1d5('0x24')](saveUpdates(_0x2a0cb6[_0xa1d5('0x44')],null))['then'](respondWithResult(_0x523225,null))[_0xa1d5('0x3d')](handleError(_0x523225,null));};exports[_0xa1d5('0x23')]=function(_0x58dd57,_0x43cfdb){return db[_0xa1d5('0x2a')]['find']({'where':{'id':_0x58dd57[_0xa1d5('0x3f')]['id']}})[_0xa1d5('0x24')](handleEntityNotFound(_0x43cfdb,null))[_0xa1d5('0x24')](removeEntity(_0x43cfdb,null))['catch'](handleError(_0x43cfdb,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 9092dae..c46828c 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 _0x554f=['idField','FieldId','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','define','int_dynamics365_fields'];(function(_0x2e35af,_0x57454e){var _0x389d5e=function(_0x4bc75a){while(--_0x4bc75a){_0x2e35af['push'](_0x2e35af['shift']());}};_0x389d5e(++_0x57454e);}(_0x554f,0x1d6));var _0xf554=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x554f[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0xf554('0x0'));var util=require(_0xf554('0x1'));var logger=require('../../config/logger')(_0xf554('0x2'));var moment=require(_0xf554('0x3'));var BPromise=require('bluebird');var rp=require(_0xf554('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf554('0x5'));var config=require(_0xf554('0x6'));var attributes=require(_0xf554('0x7'));module['exports']=function(_0x1e18ad,_0x425715){return _0x1e18ad[_0xf554('0x8')]('Dynamics365Field',attributes,{'tableName':_0xf554('0x9'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xf554('0xa'),_0xf554('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5115=['path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','idField','../../config/logger','api','moment','request-promise'];(function(_0x49b415,_0x21d38e){var _0x2cfe7c=function(_0x1d23fa){while(--_0x1d23fa){_0x49b415['push'](_0x49b415['shift']());}};_0x2cfe7c(++_0x21d38e);}(_0x5115,0xec));var _0x5511=function(_0x280fc6,_0x41200){_0x280fc6=_0x280fc6-0x0;var _0x4a40ae=_0x5115[_0x280fc6];return _0x4a40ae;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5511('0x0'))(_0x5511('0x1'));var moment=require(_0x5511('0x2'));var BPromise=require('bluebird');var rp=require(_0x5511('0x3'));var fs=require('fs');var path=require(_0x5511('0x4'));var rimraf=require(_0x5511('0x5'));var config=require(_0x5511('0x6'));var attributes=require(_0x5511('0x7'));module[_0x5511('0x8')]=function(_0x1b3462,_0x130ff5){return _0x1b3462[_0x5511('0x9')](_0x5511('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x5511('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 852e327..483a58f 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 _0xb7cd=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','Dynamics365Field,\x20%s,\x20%s','message','result'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xb7cd,0x144));var _0xdb7c=function(_0x32572d,_0x18b3ad){_0x32572d=_0x32572d-0x0;var _0x361da8=_0xb7cd[_0x32572d];return _0x361da8;};'use strict';var _=require(_0xdb7c('0x0'));var util=require(_0xdb7c('0x1'));var moment=require(_0xdb7c('0x2'));var BPromise=require('bluebird');var rs=require(_0xdb7c('0x3'));var fs=require('fs');var Redis=require(_0xdb7c('0x4'));var db=require(_0xdb7c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb7c('0x6'))('rpc');var config=require(_0xdb7c('0x7'));var jayson=require(_0xdb7c('0x8'));var client=jayson[_0xdb7c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d3957,_0x1eb4c5,_0x5e2630){return new BPromise(function(_0x1847b1,_0x31e75c){return client['request'](_0x1d3957,_0x5e2630)['then'](function(_0x73625b){logger[_0xdb7c('0xa')]('Dynamics365Field,\x20%s,\x20%s',_0x1eb4c5,_0xdb7c('0xb'));logger[_0xdb7c('0xc')](_0xdb7c('0xd'),_0x1eb4c5,_0xdb7c('0xb'),JSON['stringify'](_0x73625b));if(_0x73625b[_0xdb7c('0xe')]){if(_0x73625b[_0xdb7c('0xe')]['code']===0x1f4){logger[_0xdb7c('0xe')](_0xdb7c('0xf'),_0x1eb4c5,_0x73625b['error'][_0xdb7c('0x10')]);return _0x31e75c(_0x73625b[_0xdb7c('0xe')][_0xdb7c('0x10')]);}logger['error'](_0xdb7c('0xf'),_0x1eb4c5,_0x73625b['error'][_0xdb7c('0x10')]);return _0x1847b1(_0x73625b[_0xdb7c('0xe')][_0xdb7c('0x10')]);}else{logger['info'](_0xdb7c('0xf'),_0x1eb4c5,_0xdb7c('0xb'));_0x1847b1(_0x73625b[_0xdb7c('0x11')][_0xdb7c('0x10')]);}})['catch'](function(_0x2b7946){logger[_0xdb7c('0xe')](_0xdb7c('0xf'),_0x1eb4c5,_0x2b7946);_0x31e75c(_0x2b7946);});});} \ No newline at end of file +var _0xd2a7=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5403b2,_0xfd5b38){var _0x283bb2=function(_0x12080d){while(--_0x12080d){_0x5403b2['push'](_0x5403b2['shift']());}};_0x283bb2(++_0xfd5b38);}(_0xd2a7,0x1aa));var _0x7d2a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2a7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7d2a('0x0'));var util=require(_0x7d2a('0x1'));var moment=require(_0x7d2a('0x2'));var BPromise=require(_0x7d2a('0x3'));var rs=require(_0x7d2a('0x4'));var fs=require('fs');var Redis=require(_0x7d2a('0x5'));var db=require(_0x7d2a('0x6'))['db'];var utils=require(_0x7d2a('0x7'));var logger=require(_0x7d2a('0x8'))(_0x7d2a('0x9'));var config=require(_0x7d2a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7d2a('0xb')][_0x7d2a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2dd541,_0x5271fa,_0x24137b){return new BPromise(function(_0x47db62,_0x51267f){return client[_0x7d2a('0xd')](_0x2dd541,_0x24137b)[_0x7d2a('0xe')](function(_0x5c60b8){logger[_0x7d2a('0xf')](_0x7d2a('0x10'),_0x5271fa,_0x7d2a('0x11'));logger[_0x7d2a('0x12')](_0x7d2a('0x13'),_0x5271fa,_0x7d2a('0x11'),JSON[_0x7d2a('0x14')](_0x5c60b8));if(_0x5c60b8[_0x7d2a('0x15')]){if(_0x5c60b8['error'][_0x7d2a('0x16')]===0x1f4){logger[_0x7d2a('0x15')](_0x7d2a('0x10'),_0x5271fa,_0x5c60b8[_0x7d2a('0x15')]['message']);return _0x51267f(_0x5c60b8[_0x7d2a('0x15')][_0x7d2a('0x17')]);}logger['error'](_0x7d2a('0x10'),_0x5271fa,_0x5c60b8[_0x7d2a('0x15')][_0x7d2a('0x17')]);return _0x47db62(_0x5c60b8[_0x7d2a('0x15')][_0x7d2a('0x17')]);}else{logger[_0x7d2a('0xf')](_0x7d2a('0x10'),_0x5271fa,_0x7d2a('0x11'));_0x47db62(_0x5c60b8['result']['message']);}})[_0x7d2a('0x18')](function(_0x1b9347){logger['error'](_0x7d2a('0x10'),_0x5271fa,_0x1b9347);_0x51267f(_0x1b9347);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index f0c00e3..d5dd38d 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 _0xca3c=['../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','post','create','/:id/configurations','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x7c2ad1,_0x25d916){var _0x46342=function(_0x414c2f){while(--_0x414c2f){_0x7c2ad1['push'](_0x7c2ad1['shift']());}};_0x46342(++_0x25d916);}(_0xca3c,0xc1));var _0xcca3=function(_0x2e4246,_0x15153d){_0x2e4246=_0x2e4246-0x0;var _0x30af5e=_0xca3c[_0x2e4246];return _0x30af5e;};'use strict';var multer=require('multer');var util=require(_0xcca3('0x0'));var path=require(_0xcca3('0x1'));var timeout=require(_0xcca3('0x2'));var express=require(_0xcca3('0x3'));var router=express[_0xcca3('0x4')]();var fs_extra=require(_0xcca3('0x5'));var auth=require(_0xcca3('0x6'));var interaction=require(_0xcca3('0x7'));var config=require(_0xcca3('0x8'));var controller=require(_0xcca3('0x9'));router[_0xcca3('0xa')]('/',auth[_0xcca3('0xb')](),controller[_0xcca3('0xc')]);router[_0xcca3('0xa')](_0xcca3('0xd'),auth[_0xcca3('0xb')](),controller[_0xcca3('0xe')]);router['get']('/:id/configurations',auth[_0xcca3('0xb')](),controller[_0xcca3('0xf')]);router['get'](_0xcca3('0x10'),auth[_0xcca3('0xb')](),controller['getFields']);router[_0xcca3('0x11')]('/',auth[_0xcca3('0xb')](),controller[_0xcca3('0x12')]);router[_0xcca3('0x11')](_0xcca3('0x13'),auth[_0xcca3('0xb')](),controller['addConfiguration']);router[_0xcca3('0x14')]('/:id',auth[_0xcca3('0xb')](),controller[_0xcca3('0x15')]);router[_0xcca3('0x16')](_0xcca3('0xd'),auth[_0xcca3('0xb')](),controller[_0xcca3('0x17')]);module[_0xcca3('0x18')]=router; \ No newline at end of file +var _0x9204=['delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id','/:id/configurations','isAuthenticated','/:id/fields','getFields','post','addConfiguration','put','update'];(function(_0xb467fc,_0x5f015b){var _0x537229=function(_0x1caf0a){while(--_0x1caf0a){_0xb467fc['push'](_0xb467fc['shift']());}};_0x537229(++_0x5f015b);}(_0x9204,0xb2));var _0x4920=function(_0x14d83f,_0x5b522a){_0x14d83f=_0x14d83f-0x0;var _0x2a8046=_0x9204[_0x14d83f];return _0x2a8046;};'use strict';var multer=require(_0x4920('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4920('0x1'));var express=require(_0x4920('0x2'));var router=express[_0x4920('0x3')]();var fs_extra=require(_0x4920('0x4'));var auth=require(_0x4920('0x5'));var interaction=require(_0x4920('0x6'));var config=require(_0x4920('0x7'));var controller=require(_0x4920('0x8'));router[_0x4920('0x9')]('/',auth['isAuthenticated'](),controller[_0x4920('0xa')]);router[_0x4920('0x9')](_0x4920('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4920('0x9')](_0x4920('0xc'),auth[_0x4920('0xd')](),controller['getConfigurations']);router['get'](_0x4920('0xe'),auth[_0x4920('0xd')](),controller[_0x4920('0xf')]);router[_0x4920('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4920('0x10')](_0x4920('0xc'),auth[_0x4920('0xd')](),controller[_0x4920('0x11')]);router[_0x4920('0x12')]('/:id',auth[_0x4920('0xd')](),controller[_0x4920('0x13')]);router[_0x4920('0x14')](_0x4920('0xb'),auth[_0x4920('0xd')](),controller['destroy']);module[_0x4920('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 2c4741d..8ddc36c 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 _0xb44a=['STRING'];(function(_0x1e3c2f,_0x53b8d1){var _0x40ac24=function(_0x418cbc){while(--_0x418cbc){_0x1e3c2f['push'](_0x1e3c2f['shift']());}};_0x40ac24(++_0x53b8d1);}(_0xb44a,0x1c2));var _0xab44=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xb44a[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xab44('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xab44('0x0')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xab44('0x0')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xab44('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x7b84=['sequelize','exports','STRING','username','remoteUri'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x7b84,0x17c));var _0x47b8=function(_0x1b0cb7,_0x572bfe){_0x1b0cb7=_0x1b0cb7-0x0;var _0x43ca23=_0x7b84[_0x1b0cb7];return _0x43ca23;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'name':{'type':Sequelize[_0x47b8('0x2')]},'description':{'type':Sequelize[_0x47b8('0x2')]},'username':{'type':Sequelize[_0x47b8('0x2')],'unique':_0x47b8('0x3')},'apiKey':{'type':Sequelize[_0x47b8('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x47b8('0x4')},'serverUrl':{'type':Sequelize[_0x47b8('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 74c0b60..8e937e7 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 _0x82b0=['priority','source','group','company','remove','default','custom_dropdown','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','destroy','stack','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','then','rows','catch','show','params','find','create','update','body','FreshdeskConfiguration','getConfigurations','addConfiguration','findOne','getSubjects','channel','FreshdeskField','Subjects','Descriptions','getFields','remoteUri','slice','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','subject','agent','description'];(function(_0x3f4206,_0x34f784){var _0x198508=function(_0x804620){while(--_0x804620){_0x3f4206['push'](_0x3f4206['shift']());}};_0x198508(++_0x34f784);}(_0x82b0,0x81));var _0x082b=function(_0xd3b0ac,_0x2f5065){_0xd3b0ac=_0xd3b0ac-0x0;var _0x3d773e=_0x82b0[_0xd3b0ac];return _0x3d773e;};'use strict';var emlformat=require(_0x082b('0x0'));var rimraf=require(_0x082b('0x1'));var zipdir=require(_0x082b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x082b('0x3'));var moment=require(_0x082b('0x4'));var BPromise=require(_0x082b('0x5'));var Mustache=require(_0x082b('0x6'));var util=require('util');var path=require(_0x082b('0x7'));var sox=require(_0x082b('0x8'));var csv=require(_0x082b('0x9'));var ejs=require(_0x082b('0xa'));var fs=require('fs');var fs_extra=require(_0x082b('0xb'));var _=require('lodash');var squel=require(_0x082b('0xc'));var crypto=require(_0x082b('0xd'));var jsforce=require(_0x082b('0xe'));var deskjs=require(_0x082b('0xf'));var toCsv=require(_0x082b('0x9'));var querystring=require(_0x082b('0x10'));var Papa=require(_0x082b('0x11'));var Redis=require(_0x082b('0x12'));var authService=require(_0x082b('0x13'));var qs=require(_0x082b('0x14'));var as=require(_0x082b('0x15'));var hardwareService=require(_0x082b('0x16'));var logger=require(_0x082b('0x17'))(_0x082b('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x082b('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1c1f9d,_0x324251){_0x324251=_0x324251||0xcc;return function(_0x535946){if(_0x535946){return _0x1c1f9d[_0x082b('0x1a')](_0x324251);}return _0x1c1f9d[_0x082b('0x1b')](_0x324251)[_0x082b('0x1c')]();};}function respondWithResult(_0x1f0c32,_0x40e206){_0x40e206=_0x40e206||0xc8;return function(_0x4d7ad9){if(_0x4d7ad9){return _0x1f0c32[_0x082b('0x1b')](_0x40e206)[_0x082b('0x1d')](_0x4d7ad9);}};}function respondWithFilteredResult(_0x49db08,_0x2c4f86){return function(_0x588d8a){if(_0x588d8a){var _0xb373c9=typeof _0x2c4f86[_0x082b('0x1e')]==='undefined'&&typeof _0x2c4f86[_0x082b('0x1f')]===_0x082b('0x20');var _0x2442d1=_0x588d8a[_0x082b('0x21')];var _0x4adfc6=_0xb373c9?0x0:_0x2c4f86[_0x082b('0x1e')];var _0x2d5cbc=_0xb373c9?_0x588d8a[_0x082b('0x21')]:_0x2c4f86[_0x082b('0x1e')]+_0x2c4f86[_0x082b('0x1f')];var _0x1f403a;if(_0x2d5cbc>=_0x2442d1){_0x2d5cbc=_0x2442d1;_0x1f403a=0xc8;}else{_0x1f403a=0xce;}_0x49db08[_0x082b('0x1b')](_0x1f403a);return _0x49db08[_0x082b('0x22')]('Content-Range',_0x4adfc6+'-'+_0x2d5cbc+'/'+_0x2442d1)[_0x082b('0x1d')](_0x588d8a);}return null;};}function patchUpdates(_0x2fffc3){return function(_0x36683e){try{jsonpatch['apply'](_0x36683e,_0x2fffc3,!![]);}catch(_0x3c0b03){return BPromise[_0x082b('0x23')](_0x3c0b03);}return _0x36683e[_0x082b('0x24')]();};}function saveUpdates(_0x56fbd2,_0x47c0d9){return function(_0x47454f){if(_0x47454f){return _0x47454f['update'](_0x56fbd2)['then'](function(_0x3ae657){return _0x3ae657;});}return null;};}function removeEntity(_0xaa7eb,_0x271340){return function(_0x376d0a){if(_0x376d0a){return _0x376d0a[_0x082b('0x25')]()['then'](function(){_0xaa7eb[_0x082b('0x1b')](0xcc)[_0x082b('0x1c')]();});}};}function handleEntityNotFound(_0x40d737,_0x1082bf){return function(_0x20d85b){if(!_0x20d85b){_0x40d737[_0x082b('0x1a')](0x194);}return _0x20d85b;};}function handleError(_0x1b6dfc,_0x4e30e8){_0x4e30e8=_0x4e30e8||0x1f4;return function(_0x20ff4a){logger['error'](_0x20ff4a[_0x082b('0x26')]);if(_0x20ff4a['name']){delete _0x20ff4a[_0x082b('0x27')];}_0x1b6dfc[_0x082b('0x1b')](_0x4e30e8)['send'](_0x20ff4a);};}exports[_0x082b('0x28')]=function(_0x4b172b,_0x228a5a){var _0x55d059={},_0x528e52={},_0x25dcaf={'count':0x0,'rows':[]};var _0x1f8ce4=_[_0x082b('0x29')](db[_0x082b('0x2a')][_0x082b('0x2b')],function(_0x3194d5){return{'name':_0x3194d5[_0x082b('0x2c')],'type':_0x3194d5[_0x082b('0x2d')][_0x082b('0x2e')]};});_0x528e52[_0x082b('0x2f')]=_[_0x082b('0x29')](_0x1f8ce4,'name');_0x528e52[_0x082b('0x30')]=_[_0x082b('0x31')](_0x4b172b[_0x082b('0x30')]);_0x528e52[_0x082b('0x32')]=_[_0x082b('0x33')](_0x528e52['model'],_0x528e52['query']);_0x55d059[_0x082b('0x34')]=_[_0x082b('0x33')](_0x528e52['model'],qs[_0x082b('0x35')](_0x4b172b[_0x082b('0x30')]['fields']));_0x55d059[_0x082b('0x34')]=_0x55d059['attributes'][_0x082b('0x36')]?_0x55d059[_0x082b('0x34')]:_0x528e52['model'];if(!_0x4b172b[_0x082b('0x30')][_0x082b('0x37')](_0x082b('0x38'))){_0x55d059[_0x082b('0x1f')]=qs[_0x082b('0x1f')](_0x4b172b['query'][_0x082b('0x1f')]);_0x55d059['offset']=qs[_0x082b('0x1e')](_0x4b172b[_0x082b('0x30')][_0x082b('0x1e')]);}_0x55d059[_0x082b('0x39')]=qs[_0x082b('0x3a')](_0x4b172b[_0x082b('0x30')][_0x082b('0x3a')]);_0x55d059[_0x082b('0x3b')]=qs['filters'](_[_0x082b('0x3c')](_0x4b172b[_0x082b('0x30')],_0x528e52['filters']),_0x1f8ce4);if(_0x4b172b[_0x082b('0x30')][_0x082b('0x3d')]){_0x55d059[_0x082b('0x3b')]=_[_0x082b('0x3e')](_0x55d059[_0x082b('0x3b')],{'$or':_[_0x082b('0x29')](_0x1f8ce4,function(_0xe01d7a){if(_0xe01d7a[_0x082b('0x2d')]!=='VIRTUAL'){var _0x31832d={};_0x31832d[_0xe01d7a[_0x082b('0x27')]]={'$like':'%'+_0x4b172b[_0x082b('0x30')][_0x082b('0x3d')]+'%'};return _0x31832d;}})});}_0x55d059=_['merge']({},_0x55d059,_0x4b172b[_0x082b('0x3f')]);var _0xa22d4e={'where':_0x55d059[_0x082b('0x3b')]};return db[_0x082b('0x2a')][_0x082b('0x21')](_0xa22d4e)['then'](function(_0x436e50){_0x25dcaf[_0x082b('0x21')]=_0x436e50;if(_0x4b172b['query'][_0x082b('0x40')]){_0x55d059[_0x082b('0x41')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x082b('0x42')](_0x55d059);})[_0x082b('0x43')](function(_0x22cea5){_0x25dcaf[_0x082b('0x44')]=_0x22cea5;return _0x25dcaf;})[_0x082b('0x43')](respondWithFilteredResult(_0x228a5a,_0x55d059))[_0x082b('0x45')](handleError(_0x228a5a,null));};exports[_0x082b('0x46')]=function(_0x2b9257,_0x26c958){var _0x5ed239={'raw':![],'where':{'id':_0x2b9257[_0x082b('0x47')]['id']}},_0xe8c120={};_0xe8c120[_0x082b('0x2f')]=_[_0x082b('0x31')](db['FreshdeskAccount'][_0x082b('0x2b')]);_0xe8c120[_0x082b('0x30')]=_[_0x082b('0x31')](_0x2b9257['query']);_0xe8c120[_0x082b('0x32')]=_[_0x082b('0x33')](_0xe8c120[_0x082b('0x2f')],_0xe8c120[_0x082b('0x30')]);_0x5ed239[_0x082b('0x34')]=_[_0x082b('0x33')](_0xe8c120['model'],qs[_0x082b('0x35')](_0x2b9257[_0x082b('0x30')][_0x082b('0x35')]));_0x5ed239[_0x082b('0x34')]=_0x5ed239[_0x082b('0x34')][_0x082b('0x36')]?_0x5ed239[_0x082b('0x34')]:_0xe8c120[_0x082b('0x2f')];if(_0x2b9257['query'][_0x082b('0x40')]){_0x5ed239[_0x082b('0x41')]=[{'all':!![]}];}_0x5ed239=_[_0x082b('0x3e')]({},_0x5ed239,_0x2b9257['options']);return db[_0x082b('0x2a')][_0x082b('0x48')](_0x5ed239)['then'](handleEntityNotFound(_0x26c958,null))[_0x082b('0x43')](respondWithResult(_0x26c958,null))['catch'](handleError(_0x26c958,null));};exports[_0x082b('0x49')]=function(_0x5d238e,_0x1f1b8f){return db['FreshdeskAccount'][_0x082b('0x49')](_0x5d238e['body'],{})[_0x082b('0x43')](respondWithResult(_0x1f1b8f,0xc9))['catch'](handleError(_0x1f1b8f,null));};exports[_0x082b('0x4a')]=function(_0x518f6b,_0x46d5b1){if(_0x518f6b[_0x082b('0x4b')]['id']){delete _0x518f6b[_0x082b('0x4b')]['id'];}return db[_0x082b('0x2a')][_0x082b('0x48')]({'where':{'id':_0x518f6b[_0x082b('0x47')]['id']}})[_0x082b('0x43')](handleEntityNotFound(_0x46d5b1,null))['then'](saveUpdates(_0x518f6b[_0x082b('0x4b')],null))[_0x082b('0x43')](respondWithResult(_0x46d5b1,null))[_0x082b('0x45')](handleError(_0x46d5b1,null));};exports['destroy']=function(_0x221b13,_0x41d21c){return db[_0x082b('0x2a')][_0x082b('0x48')]({'where':{'id':_0x221b13[_0x082b('0x47')]['id']}})[_0x082b('0x43')](handleEntityNotFound(_0x41d21c,null))[_0x082b('0x43')](removeEntity(_0x41d21c,null))['catch'](handleError(_0x41d21c,null));};exports['getConfigurations']=function(_0xbcbd1d,_0x4a484b,_0x28751c){var _0x39bcd1={};var _0x1e76a3={};var _0x53ebc1;var _0x4a48f8;return db['FreshdeskAccount']['findOne']({'where':{'id':_0xbcbd1d[_0x082b('0x47')]['id']}})[_0x082b('0x43')](handleEntityNotFound(_0x4a484b,null))['then'](function(_0x397f3d){if(_0x397f3d){_0x53ebc1=_0x397f3d;_0x1e76a3[_0x082b('0x2f')]=_[_0x082b('0x31')](db[_0x082b('0x4c')]['rawAttributes']);_0x1e76a3[_0x082b('0x30')]=_[_0x082b('0x31')](_0xbcbd1d[_0x082b('0x30')]);_0x1e76a3[_0x082b('0x32')]=_[_0x082b('0x33')](_0x1e76a3['model'],_0x1e76a3[_0x082b('0x30')]);_0x39bcd1[_0x082b('0x34')]=_['intersection'](_0x1e76a3[_0x082b('0x2f')],qs[_0x082b('0x35')](_0xbcbd1d['query'][_0x082b('0x35')]));_0x39bcd1['attributes']=_0x39bcd1[_0x082b('0x34')][_0x082b('0x36')]?_0x39bcd1['attributes']:_0x1e76a3[_0x082b('0x2f')];_0x39bcd1['order']=qs[_0x082b('0x3a')](_0xbcbd1d[_0x082b('0x30')]['sort']);_0x39bcd1['where']=qs['filters'](_[_0x082b('0x3c')](_0xbcbd1d[_0x082b('0x30')],_0x1e76a3[_0x082b('0x32')]));if(_0xbcbd1d[_0x082b('0x30')][_0x082b('0x3d')]){_0x39bcd1[_0x082b('0x3b')]=_[_0x082b('0x3e')](_0x39bcd1[_0x082b('0x3b')],{'$or':_['map'](_0x39bcd1[_0x082b('0x34')],function(_0x195328){var _0x5b3122={};_0x5b3122[_0x195328]={'$like':'%'+_0xbcbd1d[_0x082b('0x30')][_0x082b('0x3d')]+'%'};return _0x5b3122;})});}_0x39bcd1=_[_0x082b('0x3e')]({},_0x39bcd1,_0xbcbd1d[_0x082b('0x3f')]);return _0x53ebc1[_0x082b('0x4d')](_0x39bcd1);}})[_0x082b('0x43')](function(_0x76db84){if(_0x76db84){_0x4a48f8=_0x76db84['length'];if(!_0xbcbd1d[_0x082b('0x30')][_0x082b('0x37')]('nolimit')){_0x39bcd1[_0x082b('0x1f')]=qs[_0x082b('0x1f')](_0xbcbd1d['query']['limit']);_0x39bcd1[_0x082b('0x1e')]=qs[_0x082b('0x1e')](_0xbcbd1d[_0x082b('0x30')][_0x082b('0x1e')]);}return _0x53ebc1['getConfigurations'](_0x39bcd1);}})[_0x082b('0x43')](function(_0x24ac98){if(_0x24ac98){return _0x24ac98?{'count':_0x4a48f8,'rows':_0x24ac98}:null;}})['then'](respondWithResult(_0x4a484b,null))[_0x082b('0x45')](handleError(_0x4a484b,null));};exports[_0x082b('0x4e')]=function(_0x6c21f8,_0x36b87d,_0x49928b){if(_0x6c21f8[_0x082b('0x4b')]['id']){delete _0x6c21f8[_0x082b('0x4b')]['id'];}return db[_0x082b('0x2a')][_0x082b('0x4f')]({'where':{'id':_0x6c21f8[_0x082b('0x47')]['id']}})[_0x082b('0x43')](handleEntityNotFound(_0x36b87d,null))[_0x082b('0x43')](function(_0x80ae28){if(_0x80ae28){_0x6c21f8[_0x082b('0x4b')]['AccountId']=_0x80ae28['id'];_0x6c21f8[_0x082b('0x4b')]['Subjects']=integrations[_0x082b('0x50')](_0x6c21f8[_0x082b('0x4b')]['channel'],_0x6c21f8[_0x082b('0x4b')]['type']);_0x6c21f8['body']['Descriptions']=integrations['getDescriptions'](_0x6c21f8[_0x082b('0x4b')][_0x082b('0x51')],_0x6c21f8[_0x082b('0x4b')][_0x082b('0x2d')]);return db[_0x082b('0x4c')][_0x082b('0x49')](_0x6c21f8['body'],{'include':[{'model':db[_0x082b('0x52')],'as':_0x082b('0x53')},{'model':db['FreshdeskField'],'as':_0x082b('0x54')}]});}return null;})[_0x082b('0x43')](respondWithResult(_0x36b87d,null))[_0x082b('0x45')](handleError(_0x36b87d,null));};exports[_0x082b('0x55')]=function(_0x42619a,_0x16ae26,_0x358899){var _0x15a397='';return db[_0x082b('0x2a')][_0x082b('0x4f')]({'where':{'id':_0x42619a['params']['id']},'attributes':['id',_0x082b('0x56'),'apiKey']})[_0x082b('0x43')](handleEntityNotFound(_0x16ae26,null))[_0x082b('0x43')](function(_0x473686){if(_0x473686){_0x15a397=_0x473686[_0x082b('0x56')];var _0x7a6c6f=_0x15a397[_0x082b('0x57')](-0x1);if(_0x7a6c6f==='/'){_0x15a397=_0x15a397['substring'](0x0,_0x15a397[_0x082b('0x58')](_0x7a6c6f));}return rp({'method':_0x082b('0x59'),'uri':util[_0x082b('0x5a')](_0x082b('0x5b'),_0x15a397,_0x082b('0x5c')),'headers':{'Authorization':util[_0x082b('0x5a')](_0x082b('0x5d'),new Buffer(util['format'](_0x082b('0x5e'),_0x473686[_0x082b('0x5f')]))['toString']('base64'))},'json':!![]});}})[_0x082b('0x43')](function(_0x3f7ae7){if(_0x3f7ae7){var _0x57fcef=['requester',_0x082b('0x60'),_0x082b('0x61'),_0x082b('0x62'),_0x082b('0x1b'),_0x082b('0x63'),'group',_0x082b('0x64'),'ticket_type',_0x082b('0x65'),_0x082b('0x66')];_[_0x082b('0x67')](_0x3f7ae7,function(_0x3a3300){return _0x57fcef['includes'](_0x3a3300[_0x082b('0x27')])||!_0x3a3300[_0x082b('0x68')]&&_0x3a3300['type']!=='custom_text'&&_0x3a3300[_0x082b('0x2d')]!==_0x082b('0x69');});return{'count':_0x3f7ae7['length'],'rows':_['map'](_0x3f7ae7,function(_0x32f4cb){return{'id':_0x32f4cb[_0x082b('0x27')],'name':_0x32f4cb['label'],'custom':!_0x32f4cb[_0x082b('0x68')],'options':_0x32f4cb[_0x082b('0x6a')]?_[_0x082b('0x29')](_0x32f4cb[_0x082b('0x6a')],function(_0x2903b4){return{'name':_[_0x082b('0x6b')](_0x2903b4),'value':_0x2903b4};}):[]};})};}})[_0x082b('0x43')](respondWithResult(_0x16ae26,null))[_0x082b('0x45')](function(_0x3e872d){var _0x55d724=_0x42619a[_0x082b('0x30')][_0x082b('0x6c')]?0x1f4:_0x3e872d[_0x082b('0x6d')]||0x1f4;logger[_0x082b('0x6e')](_0x082b('0x6f'),_0x082b('0x55'),_0x55d724,JSON['stringify'](_0x3e872d));delete _0x3e872d[_0x082b('0x27')];if(_0x55d724===0x191){_0x55d724=0x190;}_0x16ae26[_0x082b('0x1b')](_0x55d724)[_0x082b('0x70')](_0x42619a[_0x082b('0x30')][_0x082b('0x6c')]?{'message':_0x082b('0x71'),'statusCode':_0x3e872d['statusCode']}:_0x3e872d);});}; \ No newline at end of file +var _0x0b96=['sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskAccount','includeAll','findAll','rows','show','include','find','catch','body','params','destroy','findOne','FreshdeskConfiguration','getConfigurations','AccountId','Subjects','getSubjects','channel','FreshdeskField','Descriptions','remoteUri','apiKey','substring','lastIndexOf','%s/%s','format','%s:X','toString','base64','agent','description','priority','source','group','company','remove','includes','default','custom_text','label','choices','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','error','stack','name','index','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order'];(function(_0x5a0383,_0x312ffe){var _0x1adda7=function(_0x1a0cf5){while(--_0x1a0cf5){_0x5a0383['push'](_0x5a0383['shift']());}};_0x1adda7(++_0x312ffe);}(_0x0b96,0xa5));var _0x60b9=function(_0x56aad3,_0x3d48bc){_0x56aad3=_0x56aad3-0x0;var _0x1d165a=_0x0b96[_0x56aad3];return _0x1d165a;};'use strict';var emlformat=require(_0x60b9('0x0'));var rimraf=require(_0x60b9('0x1'));var zipdir=require(_0x60b9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x60b9('0x3'));var moment=require(_0x60b9('0x4'));var BPromise=require(_0x60b9('0x5'));var Mustache=require('mustache');var util=require(_0x60b9('0x6'));var path=require(_0x60b9('0x7'));var sox=require('sox');var csv=require(_0x60b9('0x8'));var ejs=require(_0x60b9('0x9'));var fs=require('fs');var fs_extra=require(_0x60b9('0xa'));var _=require(_0x60b9('0xb'));var squel=require(_0x60b9('0xc'));var crypto=require(_0x60b9('0xd'));var jsforce=require(_0x60b9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x60b9('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x60b9('0xf'));var authService=require(_0x60b9('0x10'));var qs=require(_0x60b9('0x11'));var as=require(_0x60b9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x60b9('0x13'))(_0x60b9('0x14'));var utils=require(_0x60b9('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x60b9('0x16'));var db=require(_0x60b9('0x17'))['db'];var integrations=require(_0x60b9('0x18'));function respondWithStatusCode(_0xa4144b,_0x243e4a){_0x243e4a=_0x243e4a||0xcc;return function(_0x225df6){if(_0x225df6){return _0xa4144b[_0x60b9('0x19')](_0x243e4a);}return _0xa4144b[_0x60b9('0x1a')](_0x243e4a)[_0x60b9('0x1b')]();};}function respondWithResult(_0xd5e23a,_0x443435){_0x443435=_0x443435||0xc8;return function(_0x5e0d9b){if(_0x5e0d9b){return _0xd5e23a[_0x60b9('0x1a')](_0x443435)[_0x60b9('0x1c')](_0x5e0d9b);}};}function respondWithFilteredResult(_0x991547,_0x20834a){return function(_0x2d4995){if(_0x2d4995){var _0x5f4ec7=typeof _0x20834a[_0x60b9('0x1d')]===_0x60b9('0x1e')&&typeof _0x20834a[_0x60b9('0x1f')]===_0x60b9('0x1e');var _0x5e30f9=_0x2d4995['count'];var _0x2aa04c=_0x5f4ec7?0x0:_0x20834a[_0x60b9('0x1d')];var _0xfa8dc5=_0x5f4ec7?_0x2d4995[_0x60b9('0x20')]:_0x20834a[_0x60b9('0x1d')]+_0x20834a[_0x60b9('0x1f')];var _0x13771a;if(_0xfa8dc5>=_0x5e30f9){_0xfa8dc5=_0x5e30f9;_0x13771a=0xc8;}else{_0x13771a=0xce;}_0x991547['status'](_0x13771a);return _0x991547[_0x60b9('0x21')]('Content-Range',_0x2aa04c+'-'+_0xfa8dc5+'/'+_0x5e30f9)[_0x60b9('0x1c')](_0x2d4995);}return null;};}function patchUpdates(_0x293bb6){return function(_0xb273d4){try{jsonpatch[_0x60b9('0x22')](_0xb273d4,_0x293bb6,!![]);}catch(_0x549954){return BPromise[_0x60b9('0x23')](_0x549954);}return _0xb273d4[_0x60b9('0x24')]();};}function saveUpdates(_0x33da87,_0x54a11f){return function(_0x19fde9){if(_0x19fde9){return _0x19fde9['update'](_0x33da87)[_0x60b9('0x25')](function(_0x12a6e8){return _0x12a6e8;});}return null;};}function removeEntity(_0x237ab5,_0x285c05){return function(_0x365d11){if(_0x365d11){return _0x365d11['destroy']()[_0x60b9('0x25')](function(){_0x237ab5[_0x60b9('0x1a')](0xcc)[_0x60b9('0x1b')]();});}};}function handleEntityNotFound(_0x943f74,_0x4eb65b){return function(_0x375534){if(!_0x375534){_0x943f74['sendStatus'](0x194);}return _0x375534;};}function handleError(_0xf6fc17,_0x45ae9d){_0x45ae9d=_0x45ae9d||0x1f4;return function(_0x3aba43){logger[_0x60b9('0x26')](_0x3aba43[_0x60b9('0x27')]);if(_0x3aba43[_0x60b9('0x28')]){delete _0x3aba43[_0x60b9('0x28')];}_0xf6fc17['status'](_0x45ae9d)['send'](_0x3aba43);};}exports[_0x60b9('0x29')]=function(_0x2f9e3a,_0xcfc109){var _0xb40e96={},_0x51976d={},_0x5b07bc={'count':0x0,'rows':[]};var _0x46e8c1=_['map'](db['FreshdeskAccount'][_0x60b9('0x2a')],function(_0x3580af){return{'name':_0x3580af[_0x60b9('0x2b')],'type':_0x3580af[_0x60b9('0x2c')]['key']};});_0x51976d[_0x60b9('0x2d')]=_[_0x60b9('0x2e')](_0x46e8c1,_0x60b9('0x28'));_0x51976d[_0x60b9('0x2f')]=_[_0x60b9('0x30')](_0x2f9e3a[_0x60b9('0x2f')]);_0x51976d[_0x60b9('0x31')]=_['intersection'](_0x51976d[_0x60b9('0x2d')],_0x51976d[_0x60b9('0x2f')]);_0xb40e96[_0x60b9('0x32')]=_[_0x60b9('0x33')](_0x51976d[_0x60b9('0x2d')],qs[_0x60b9('0x34')](_0x2f9e3a['query']['fields']));_0xb40e96[_0x60b9('0x32')]=_0xb40e96[_0x60b9('0x32')][_0x60b9('0x35')]?_0xb40e96[_0x60b9('0x32')]:_0x51976d[_0x60b9('0x2d')];if(!_0x2f9e3a['query'][_0x60b9('0x36')](_0x60b9('0x37'))){_0xb40e96[_0x60b9('0x1f')]=qs['limit'](_0x2f9e3a[_0x60b9('0x2f')]['limit']);_0xb40e96['offset']=qs[_0x60b9('0x1d')](_0x2f9e3a[_0x60b9('0x2f')][_0x60b9('0x1d')]);}_0xb40e96[_0x60b9('0x38')]=qs['sort'](_0x2f9e3a[_0x60b9('0x2f')][_0x60b9('0x39')]);_0xb40e96[_0x60b9('0x3a')]=qs[_0x60b9('0x31')](_[_0x60b9('0x3b')](_0x2f9e3a['query'],_0x51976d['filters']),_0x46e8c1);if(_0x2f9e3a[_0x60b9('0x2f')][_0x60b9('0x3c')]){_0xb40e96[_0x60b9('0x3a')]=_[_0x60b9('0x3d')](_0xb40e96['where'],{'$or':_[_0x60b9('0x2e')](_0x46e8c1,function(_0x2c2b06){if(_0x2c2b06[_0x60b9('0x2c')]!==_0x60b9('0x3e')){var _0x32c79c={};_0x32c79c[_0x2c2b06['name']]={'$like':'%'+_0x2f9e3a[_0x60b9('0x2f')][_0x60b9('0x3c')]+'%'};return _0x32c79c;}})});}_0xb40e96=_[_0x60b9('0x3d')]({},_0xb40e96,_0x2f9e3a[_0x60b9('0x3f')]);var _0x20f6e7={'where':_0xb40e96[_0x60b9('0x3a')]};return db[_0x60b9('0x40')][_0x60b9('0x20')](_0x20f6e7)['then'](function(_0x46d49c){_0x5b07bc[_0x60b9('0x20')]=_0x46d49c;if(_0x2f9e3a['query'][_0x60b9('0x41')]){_0xb40e96['include']=[{'all':!![]}];}return db[_0x60b9('0x40')][_0x60b9('0x42')](_0xb40e96);})[_0x60b9('0x25')](function(_0x5d81bf){_0x5b07bc[_0x60b9('0x43')]=_0x5d81bf;return _0x5b07bc;})['then'](respondWithFilteredResult(_0xcfc109,_0xb40e96))['catch'](handleError(_0xcfc109,null));};exports[_0x60b9('0x44')]=function(_0x5ea159,_0x189a89){var _0x492205={'raw':![],'where':{'id':_0x5ea159['params']['id']}},_0xb5bf35={};_0xb5bf35['model']=_['keys'](db[_0x60b9('0x40')][_0x60b9('0x2a')]);_0xb5bf35[_0x60b9('0x2f')]=_['keys'](_0x5ea159[_0x60b9('0x2f')]);_0xb5bf35[_0x60b9('0x31')]=_['intersection'](_0xb5bf35[_0x60b9('0x2d')],_0xb5bf35[_0x60b9('0x2f')]);_0x492205['attributes']=_[_0x60b9('0x33')](_0xb5bf35[_0x60b9('0x2d')],qs[_0x60b9('0x34')](_0x5ea159[_0x60b9('0x2f')]['fields']));_0x492205[_0x60b9('0x32')]=_0x492205['attributes'][_0x60b9('0x35')]?_0x492205[_0x60b9('0x32')]:_0xb5bf35[_0x60b9('0x2d')];if(_0x5ea159[_0x60b9('0x2f')]['includeAll']){_0x492205[_0x60b9('0x45')]=[{'all':!![]}];}_0x492205=_['merge']({},_0x492205,_0x5ea159[_0x60b9('0x3f')]);return db['FreshdeskAccount'][_0x60b9('0x46')](_0x492205)[_0x60b9('0x25')](handleEntityNotFound(_0x189a89,null))[_0x60b9('0x25')](respondWithResult(_0x189a89,null))[_0x60b9('0x47')](handleError(_0x189a89,null));};exports['create']=function(_0x4f2684,_0x1fa48e){return db[_0x60b9('0x40')]['create'](_0x4f2684['body'],{})[_0x60b9('0x25')](respondWithResult(_0x1fa48e,0xc9))[_0x60b9('0x47')](handleError(_0x1fa48e,null));};exports['update']=function(_0x56ee08,_0x234dca){if(_0x56ee08[_0x60b9('0x48')]['id']){delete _0x56ee08[_0x60b9('0x48')]['id'];}return db[_0x60b9('0x40')]['find']({'where':{'id':_0x56ee08[_0x60b9('0x49')]['id']}})[_0x60b9('0x25')](handleEntityNotFound(_0x234dca,null))[_0x60b9('0x25')](saveUpdates(_0x56ee08[_0x60b9('0x48')],null))[_0x60b9('0x25')](respondWithResult(_0x234dca,null))['catch'](handleError(_0x234dca,null));};exports[_0x60b9('0x4a')]=function(_0x42056c,_0x31702a){return db['FreshdeskAccount'][_0x60b9('0x46')]({'where':{'id':_0x42056c[_0x60b9('0x49')]['id']}})[_0x60b9('0x25')](handleEntityNotFound(_0x31702a,null))['then'](removeEntity(_0x31702a,null))['catch'](handleError(_0x31702a,null));};exports['getConfigurations']=function(_0x28cff0,_0xf5c9c6,_0x11d184){var _0x3eca10={};var _0x27b19d={};var _0x119654;var _0x22252a;return db['FreshdeskAccount'][_0x60b9('0x4b')]({'where':{'id':_0x28cff0[_0x60b9('0x49')]['id']}})['then'](handleEntityNotFound(_0xf5c9c6,null))[_0x60b9('0x25')](function(_0x1fc6dd){if(_0x1fc6dd){_0x119654=_0x1fc6dd;_0x27b19d[_0x60b9('0x2d')]=_[_0x60b9('0x30')](db[_0x60b9('0x4c')][_0x60b9('0x2a')]);_0x27b19d[_0x60b9('0x2f')]=_['keys'](_0x28cff0[_0x60b9('0x2f')]);_0x27b19d['filters']=_[_0x60b9('0x33')](_0x27b19d[_0x60b9('0x2d')],_0x27b19d[_0x60b9('0x2f')]);_0x3eca10[_0x60b9('0x32')]=_['intersection'](_0x27b19d[_0x60b9('0x2d')],qs[_0x60b9('0x34')](_0x28cff0['query'][_0x60b9('0x34')]));_0x3eca10[_0x60b9('0x32')]=_0x3eca10[_0x60b9('0x32')][_0x60b9('0x35')]?_0x3eca10[_0x60b9('0x32')]:_0x27b19d[_0x60b9('0x2d')];_0x3eca10[_0x60b9('0x38')]=qs[_0x60b9('0x39')](_0x28cff0['query'][_0x60b9('0x39')]);_0x3eca10[_0x60b9('0x3a')]=qs[_0x60b9('0x31')](_['pick'](_0x28cff0[_0x60b9('0x2f')],_0x27b19d['filters']));if(_0x28cff0[_0x60b9('0x2f')][_0x60b9('0x3c')]){_0x3eca10[_0x60b9('0x3a')]=_[_0x60b9('0x3d')](_0x3eca10[_0x60b9('0x3a')],{'$or':_[_0x60b9('0x2e')](_0x3eca10[_0x60b9('0x32')],function(_0x594e2f){var _0x1094ad={};_0x1094ad[_0x594e2f]={'$like':'%'+_0x28cff0[_0x60b9('0x2f')]['filter']+'%'};return _0x1094ad;})});}_0x3eca10=_[_0x60b9('0x3d')]({},_0x3eca10,_0x28cff0['options']);return _0x119654[_0x60b9('0x4d')](_0x3eca10);}})[_0x60b9('0x25')](function(_0x237a3f){if(_0x237a3f){_0x22252a=_0x237a3f[_0x60b9('0x35')];if(!_0x28cff0[_0x60b9('0x2f')][_0x60b9('0x36')](_0x60b9('0x37'))){_0x3eca10[_0x60b9('0x1f')]=qs[_0x60b9('0x1f')](_0x28cff0[_0x60b9('0x2f')][_0x60b9('0x1f')]);_0x3eca10['offset']=qs['offset'](_0x28cff0[_0x60b9('0x2f')][_0x60b9('0x1d')]);}return _0x119654[_0x60b9('0x4d')](_0x3eca10);}})[_0x60b9('0x25')](function(_0x2985c9){if(_0x2985c9){return _0x2985c9?{'count':_0x22252a,'rows':_0x2985c9}:null;}})['then'](respondWithResult(_0xf5c9c6,null))[_0x60b9('0x47')](handleError(_0xf5c9c6,null));};exports['addConfiguration']=function(_0xe1bdcc,_0x29f9b5,_0x5f0f63){if(_0xe1bdcc['body']['id']){delete _0xe1bdcc[_0x60b9('0x48')]['id'];}return db[_0x60b9('0x40')][_0x60b9('0x4b')]({'where':{'id':_0xe1bdcc['params']['id']}})[_0x60b9('0x25')](handleEntityNotFound(_0x29f9b5,null))[_0x60b9('0x25')](function(_0x54358a){if(_0x54358a){_0xe1bdcc[_0x60b9('0x48')][_0x60b9('0x4e')]=_0x54358a['id'];_0xe1bdcc[_0x60b9('0x48')][_0x60b9('0x4f')]=integrations[_0x60b9('0x50')](_0xe1bdcc[_0x60b9('0x48')][_0x60b9('0x51')],_0xe1bdcc['body'][_0x60b9('0x2c')]);_0xe1bdcc[_0x60b9('0x48')]['Descriptions']=integrations['getDescriptions'](_0xe1bdcc[_0x60b9('0x48')]['channel'],_0xe1bdcc[_0x60b9('0x48')]['type']);return db[_0x60b9('0x4c')]['create'](_0xe1bdcc['body'],{'include':[{'model':db[_0x60b9('0x52')],'as':_0x60b9('0x4f')},{'model':db[_0x60b9('0x52')],'as':_0x60b9('0x53')}]});}return null;})[_0x60b9('0x25')](respondWithResult(_0x29f9b5,null))[_0x60b9('0x47')](handleError(_0x29f9b5,null));};exports['getFields']=function(_0x22199b,_0x4662f2,_0x20703e){var _0x7169ae='';return db[_0x60b9('0x40')][_0x60b9('0x4b')]({'where':{'id':_0x22199b[_0x60b9('0x49')]['id']},'attributes':['id',_0x60b9('0x54'),_0x60b9('0x55')]})['then'](handleEntityNotFound(_0x4662f2,null))[_0x60b9('0x25')](function(_0x4394ef){if(_0x4394ef){_0x7169ae=_0x4394ef[_0x60b9('0x54')];var _0x58a898=_0x7169ae['slice'](-0x1);if(_0x58a898==='/'){_0x7169ae=_0x7169ae[_0x60b9('0x56')](0x0,_0x7169ae[_0x60b9('0x57')](_0x58a898));}return rp({'method':'GET','uri':util['format'](_0x60b9('0x58'),_0x7169ae,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x60b9('0x59')]('Basic\x20%s',new Buffer(util[_0x60b9('0x59')](_0x60b9('0x5a'),_0x4394ef[_0x60b9('0x55')]))[_0x60b9('0x5b')](_0x60b9('0x5c')))},'json':!![]});}})[_0x60b9('0x25')](function(_0x126660){if(_0x126660){var _0x6b6fc4=['requester','subject',_0x60b9('0x5d'),_0x60b9('0x5e'),'status',_0x60b9('0x5f'),'group',_0x60b9('0x60'),'ticket_type',_0x60b9('0x61'),_0x60b9('0x62')];_[_0x60b9('0x63')](_0x126660,function(_0x411330){return _0x6b6fc4[_0x60b9('0x64')](_0x411330[_0x60b9('0x28')])||!_0x411330[_0x60b9('0x65')]&&_0x411330[_0x60b9('0x2c')]!==_0x60b9('0x66')&&_0x411330[_0x60b9('0x2c')]!=='custom_dropdown';});return{'count':_0x126660[_0x60b9('0x35')],'rows':_[_0x60b9('0x2e')](_0x126660,function(_0x1a633d){return{'id':_0x1a633d['name'],'name':_0x1a633d[_0x60b9('0x67')],'custom':!_0x1a633d[_0x60b9('0x65')],'options':_0x1a633d['choices']?_[_0x60b9('0x2e')](_0x1a633d[_0x60b9('0x68')],function(_0x54e9f8){return{'name':_['capitalize'](_0x54e9f8),'value':_0x54e9f8};}):[]};})};}})[_0x60b9('0x25')](respondWithResult(_0x4662f2,null))[_0x60b9('0x47')](function(_0x22fba9){var _0x45ebe5=_0x22199b[_0x60b9('0x2f')][_0x60b9('0x69')]?0x1f4:_0x22fba9['statusCode']||0x1f4;logger[_0x60b9('0x26')](_0x60b9('0x6a'),_0x60b9('0x6b'),_0x45ebe5,JSON[_0x60b9('0x6c')](_0x22fba9));delete _0x22fba9[_0x60b9('0x28')];if(_0x45ebe5===0x191){_0x45ebe5=0x190;}_0x4662f2[_0x60b9('0x1a')](_0x45ebe5)[_0x60b9('0x6d')](_0x22199b[_0x60b9('0x2f')][_0x60b9('0x69')]?{'message':_0x60b9('0x6e'),'statusCode':_0x22fba9['statusCode']}:_0x22fba9);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index f02bb81..c382afe 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 _0x63c8=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x7de188,_0x1b5488){var _0x5e5b30=function(_0x59936c){while(--_0x59936c){_0x7de188['push'](_0x7de188['shift']());}};_0x5e5b30(++_0x1b5488);}(_0x63c8,0xd8));var _0x863c=function(_0x13ad15,_0x5cad55){_0x13ad15=_0x13ad15-0x0;var _0x594a85=_0x63c8[_0x13ad15];return _0x594a85;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x863c('0x0'))('api');var moment=require(_0x863c('0x1'));var BPromise=require(_0x863c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x863c('0x3'));var rimraf=require(_0x863c('0x4'));var config=require(_0x863c('0x5'));var attributes=require(_0x863c('0x6'));var integrations=require(_0x863c('0x7'));module[_0x863c('0x8')]=function(_0x18a019,_0xfc0fbf){return _0x18a019[_0x863c('0x9')](_0x863c('0xa'),attributes,{'tableName':_0x863c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe69=['api','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger'];(function(_0x2d090b,_0x1aa363){var _0x537445=function(_0x35a8e3){while(--_0x35a8e3){_0x2d090b['push'](_0x2d090b['shift']());}};_0x537445(++_0x1aa363);}(_0xfe69,0xeb));var _0x9fe6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfe69[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x9fe6('0x0'));var util=require(_0x9fe6('0x1'));var logger=require(_0x9fe6('0x2'))(_0x9fe6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9fe6('0x4'));var fs=require('fs');var path=require(_0x9fe6('0x5'));var rimraf=require(_0x9fe6('0x6'));var config=require(_0x9fe6('0x7'));var attributes=require(_0x9fe6('0x8'));var integrations=require(_0x9fe6('0x9'));module[_0x9fe6('0xa')]=function(_0x595038,_0x5af3f3){return _0x595038[_0x9fe6('0xb')](_0x9fe6('0xc'),attributes,{'tableName':_0x9fe6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 35a8bf2..8f4f4ca 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 _0xd846=['result','GetFreshdeskAccount','options','raw','where','limit','include','map','model','attributes','catch','ShowFreshdeskAccount','find','debug','stringify','lodash','util','moment','ioredis','../../config/logger','rpc','jayson/promise','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x2dedfa,_0xe7a56c){var _0x553565=function(_0xdb7775){while(--_0xdb7775){_0x2dedfa['push'](_0x2dedfa['shift']());}};_0x553565(++_0xe7a56c);}(_0xd846,0x195));var _0x6d84=function(_0x1a5674,_0x320754){_0x1a5674=_0x1a5674-0x0;var _0x14670a=_0xd846[_0x1a5674];return _0x14670a;};'use strict';var _=require(_0x6d84('0x0'));var util=require(_0x6d84('0x1'));var moment=require(_0x6d84('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d84('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d84('0x4'))(_0x6d84('0x5'));var config=require('../../config/environment');var jayson=require(_0x6d84('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ae0a3,_0x417efe,_0x7b9556){return new BPromise(function(_0x3577cf,_0x20f36c){return client[_0x6d84('0x7')](_0x3ae0a3,_0x7b9556)[_0x6d84('0x8')](function(_0x224b60){logger[_0x6d84('0x9')](_0x6d84('0xa'),_0x417efe,_0x6d84('0xb'));logger['debug'](_0x6d84('0xc'),_0x417efe,'request\x20sent',JSON['stringify'](_0x224b60));if(_0x224b60[_0x6d84('0xd')]){if(_0x224b60[_0x6d84('0xd')]['code']===0x1f4){logger['error'](_0x6d84('0xa'),_0x417efe,_0x224b60[_0x6d84('0xd')][_0x6d84('0xe')]);return _0x20f36c(_0x224b60[_0x6d84('0xd')][_0x6d84('0xe')]);}logger[_0x6d84('0xd')](_0x6d84('0xa'),_0x417efe,_0x224b60[_0x6d84('0xd')][_0x6d84('0xe')]);return _0x3577cf(_0x224b60[_0x6d84('0xd')][_0x6d84('0xe')]);}else{logger[_0x6d84('0x9')](_0x6d84('0xa'),_0x417efe,'request\x20sent');_0x3577cf(_0x224b60[_0x6d84('0xf')][_0x6d84('0xe')]);}})['catch'](function(_0xa26940){logger[_0x6d84('0xd')](_0x6d84('0xa'),_0x417efe,_0xa26940);_0x20f36c(_0xa26940);});});}exports[_0x6d84('0x10')]=function(_0x1a903c){var _0x24d1c0=this;return new Promise(function(_0x315ebd,_0x5a3cd4){return db['FreshdeskAccount']['findAll']({'raw':_0x1a903c['options']?_0x1a903c[_0x6d84('0x11')][_0x6d84('0x12')]===undefined?!![]:![]:!![],'where':_0x1a903c[_0x6d84('0x11')]?_0x1a903c[_0x6d84('0x11')][_0x6d84('0x13')]||null:null,'attributes':_0x1a903c[_0x6d84('0x11')]?_0x1a903c[_0x6d84('0x11')]['attributes']||null:null,'limit':_0x1a903c[_0x6d84('0x11')]?_0x1a903c['options'][_0x6d84('0x14')]||null:null,'include':_0x1a903c['options']?_0x1a903c[_0x6d84('0x11')][_0x6d84('0x15')]?_[_0x6d84('0x16')](_0x1a903c[_0x6d84('0x11')][_0x6d84('0x15')],function(_0x464b88){return{'model':db[_0x464b88[_0x6d84('0x17')]],'as':_0x464b88['as'],'attributes':_0x464b88[_0x6d84('0x18')],'include':_0x464b88['include']?_[_0x6d84('0x16')](_0x464b88[_0x6d84('0x15')],function(_0x1add21){return{'model':db[_0x1add21[_0x6d84('0x17')]],'as':_0x1add21['as'],'attributes':_0x1add21['attributes'],'include':_0x1add21['include']?_[_0x6d84('0x16')](_0x1add21[_0x6d84('0x15')],function(_0x1a1dcd){return{'model':db[_0x1a1dcd['model']],'as':_0x1a1dcd['as'],'attributes':_0x1a1dcd[_0x6d84('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6d84('0x8')](function(_0x3dc46b){logger[_0x6d84('0x9')](_0x6d84('0x10'),_0x1a903c);logger['debug'](_0x6d84('0x10'),_0x1a903c,JSON['stringify'](_0x3dc46b));_0x315ebd(_0x3dc46b);})[_0x6d84('0x19')](function(_0x283cd0){logger[_0x6d84('0xd')](_0x6d84('0x10'),_0x283cd0[_0x6d84('0xe')],_0x1a903c);_0x5a3cd4(_0x24d1c0['error'](0x1f4,_0x283cd0[_0x6d84('0xe')]));});});};exports[_0x6d84('0x1a')]=function(_0x3cfd50){var _0x1be2d6=this;return new Promise(function(_0xabe911,_0x392d18){return db['FreshdeskAccount'][_0x6d84('0x1b')]({'raw':_0x3cfd50[_0x6d84('0x11')]?_0x3cfd50[_0x6d84('0x11')][_0x6d84('0x12')]===undefined?!![]:![]:!![],'where':_0x3cfd50['options']?_0x3cfd50[_0x6d84('0x11')][_0x6d84('0x13')]||null:null,'attributes':_0x3cfd50[_0x6d84('0x11')]?_0x3cfd50['options'][_0x6d84('0x18')]||null:null,'include':_0x3cfd50['options']?_0x3cfd50[_0x6d84('0x11')][_0x6d84('0x15')]?_[_0x6d84('0x16')](_0x3cfd50['options'][_0x6d84('0x15')],function(_0x636625){return{'model':db[_0x636625['model']],'as':_0x636625['as'],'attributes':_0x636625['attributes'],'include':_0x636625[_0x6d84('0x15')]?_[_0x6d84('0x16')](_0x636625[_0x6d84('0x15')],function(_0x30d50c){return{'model':db[_0x30d50c['model']],'as':_0x30d50c['as'],'attributes':_0x30d50c[_0x6d84('0x18')],'include':_0x30d50c['include']?_[_0x6d84('0x16')](_0x30d50c[_0x6d84('0x15')],function(_0x3ea3f3){return{'model':db[_0x3ea3f3[_0x6d84('0x17')]],'as':_0x3ea3f3['as'],'attributes':_0x3ea3f3[_0x6d84('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6d84('0x8')](function(_0x4c9754){logger[_0x6d84('0x9')](_0x6d84('0x1a'),_0x3cfd50);logger[_0x6d84('0x1c')](_0x6d84('0x1a'),_0x3cfd50,JSON[_0x6d84('0x1d')](_0x4c9754));_0xabe911(_0x4c9754);})[_0x6d84('0x19')](function(_0x513b3c){logger[_0x6d84('0xd')](_0x6d84('0x1a'),_0x513b3c[_0x6d84('0xe')],_0x3cfd50);_0x392d18(_0x1be2d6[_0x6d84('0xd')](0x1f4,_0x513b3c[_0x6d84('0xe')]));});});}; \ No newline at end of file +var _0xb45f=['http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','raw','options','where','attributes','limit','include','map','model','GetFreshdeskAccount','debug','ShowFreshdeskAccount','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x456a4b,_0x51df8){var _0x42957c=function(_0x431de8){while(--_0x431de8){_0x456a4b['push'](_0x456a4b['shift']());}};_0x42957c(++_0x51df8);}(_0xb45f,0x1b0));var _0xfb45=function(_0x43c929,_0x15d338){_0x43c929=_0x43c929-0x0;var _0x1b38fd=_0xb45f[_0x43c929];return _0x1b38fd;};'use strict';var _=require(_0xfb45('0x0'));var util=require(_0xfb45('0x1'));var moment=require(_0xfb45('0x2'));var BPromise=require(_0xfb45('0x3'));var rs=require(_0xfb45('0x4'));var fs=require('fs');var Redis=require(_0xfb45('0x5'));var db=require(_0xfb45('0x6'))['db'];var utils=require(_0xfb45('0x7'));var logger=require(_0xfb45('0x8'))(_0xfb45('0x9'));var config=require('../../config/environment');var jayson=require(_0xfb45('0xa'));var client=jayson[_0xfb45('0xb')][_0xfb45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c2ba6,_0x324414,_0x57a0e9){return new BPromise(function(_0x39f649,_0x138a3e){return client[_0xfb45('0xd')](_0x3c2ba6,_0x57a0e9)['then'](function(_0x4aec60){logger[_0xfb45('0xe')](_0xfb45('0xf'),_0x324414,_0xfb45('0x10'));logger['debug'](_0xfb45('0x11'),_0x324414,'request\x20sent',JSON[_0xfb45('0x12')](_0x4aec60));if(_0x4aec60['error']){if(_0x4aec60[_0xfb45('0x13')][_0xfb45('0x14')]===0x1f4){logger[_0xfb45('0x13')](_0xfb45('0xf'),_0x324414,_0x4aec60['error'][_0xfb45('0x15')]);return _0x138a3e(_0x4aec60[_0xfb45('0x13')]['message']);}logger[_0xfb45('0x13')](_0xfb45('0xf'),_0x324414,_0x4aec60[_0xfb45('0x13')][_0xfb45('0x15')]);return _0x39f649(_0x4aec60[_0xfb45('0x13')]['message']);}else{logger[_0xfb45('0xe')](_0xfb45('0xf'),_0x324414,'request\x20sent');_0x39f649(_0x4aec60[_0xfb45('0x16')]['message']);}})[_0xfb45('0x17')](function(_0x22192e){logger[_0xfb45('0x13')](_0xfb45('0xf'),_0x324414,_0x22192e);_0x138a3e(_0x22192e);});});}exports['GetFreshdeskAccount']=function(_0x2d4874){var _0x3ef6e9=this;return new Promise(function(_0x25b4b0,_0x2536e8){return db['FreshdeskAccount']['findAll']({'raw':_0x2d4874['options']?_0x2d4874['options'][_0xfb45('0x18')]===undefined?!![]:![]:!![],'where':_0x2d4874[_0xfb45('0x19')]?_0x2d4874['options'][_0xfb45('0x1a')]||null:null,'attributes':_0x2d4874[_0xfb45('0x19')]?_0x2d4874['options'][_0xfb45('0x1b')]||null:null,'limit':_0x2d4874[_0xfb45('0x19')]?_0x2d4874[_0xfb45('0x19')][_0xfb45('0x1c')]||null:null,'include':_0x2d4874[_0xfb45('0x19')]?_0x2d4874[_0xfb45('0x19')][_0xfb45('0x1d')]?_['map'](_0x2d4874[_0xfb45('0x19')][_0xfb45('0x1d')],function(_0x49296d){return{'model':db[_0x49296d['model']],'as':_0x49296d['as'],'attributes':_0x49296d[_0xfb45('0x1b')],'include':_0x49296d[_0xfb45('0x1d')]?_[_0xfb45('0x1e')](_0x49296d[_0xfb45('0x1d')],function(_0x1d0c08){return{'model':db[_0x1d0c08[_0xfb45('0x1f')]],'as':_0x1d0c08['as'],'attributes':_0x1d0c08['attributes'],'include':_0x1d0c08[_0xfb45('0x1d')]?_[_0xfb45('0x1e')](_0x1d0c08[_0xfb45('0x1d')],function(_0x5ac672){return{'model':db[_0x5ac672[_0xfb45('0x1f')]],'as':_0x5ac672['as'],'attributes':_0x5ac672['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x21e248){logger['info'](_0xfb45('0x20'),_0x2d4874);logger[_0xfb45('0x21')](_0xfb45('0x20'),_0x2d4874,JSON[_0xfb45('0x12')](_0x21e248));_0x25b4b0(_0x21e248);})['catch'](function(_0x58e97b){logger['error']('GetFreshdeskAccount',_0x58e97b[_0xfb45('0x15')],_0x2d4874);_0x2536e8(_0x3ef6e9[_0xfb45('0x13')](0x1f4,_0x58e97b[_0xfb45('0x15')]));});});};exports[_0xfb45('0x22')]=function(_0x1a3d88){var _0x1895db=this;return new Promise(function(_0x28a287,_0x45d078){return db['FreshdeskAccount'][_0xfb45('0x23')]({'raw':_0x1a3d88[_0xfb45('0x19')]?_0x1a3d88[_0xfb45('0x19')][_0xfb45('0x18')]===undefined?!![]:![]:!![],'where':_0x1a3d88[_0xfb45('0x19')]?_0x1a3d88[_0xfb45('0x19')][_0xfb45('0x1a')]||null:null,'attributes':_0x1a3d88[_0xfb45('0x19')]?_0x1a3d88['options']['attributes']||null:null,'include':_0x1a3d88[_0xfb45('0x19')]?_0x1a3d88['options'][_0xfb45('0x1d')]?_[_0xfb45('0x1e')](_0x1a3d88[_0xfb45('0x19')][_0xfb45('0x1d')],function(_0x4b368c){return{'model':db[_0x4b368c['model']],'as':_0x4b368c['as'],'attributes':_0x4b368c[_0xfb45('0x1b')],'include':_0x4b368c[_0xfb45('0x1d')]?_[_0xfb45('0x1e')](_0x4b368c[_0xfb45('0x1d')],function(_0x2726aa){return{'model':db[_0x2726aa['model']],'as':_0x2726aa['as'],'attributes':_0x2726aa[_0xfb45('0x1b')],'include':_0x2726aa[_0xfb45('0x1d')]?_[_0xfb45('0x1e')](_0x2726aa[_0xfb45('0x1d')],function(_0x3f1304){return{'model':db[_0x3f1304[_0xfb45('0x1f')]],'as':_0x3f1304['as'],'attributes':_0x3f1304[_0xfb45('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfb45('0x24')](function(_0x5c1774){logger[_0xfb45('0xe')](_0xfb45('0x22'),_0x1a3d88);logger['debug'](_0xfb45('0x22'),_0x1a3d88,JSON[_0xfb45('0x12')](_0x5c1774));_0x28a287(_0x5c1774);})[_0xfb45('0x17')](function(_0x40c21a){logger[_0xfb45('0x13')]('ShowFreshdeskAccount',_0x40c21a[_0xfb45('0x15')],_0x1a3d88);_0x45d078(_0x1895db['error'](0x1f4,_0x40c21a[_0xfb45('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 0cd5338..0e3af81 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 _0x56dc=['/:id/fields','getFields','/:id/subjects','getTags','create','post','/:id/tags','put','update','delete','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show'];(function(_0x5376cf,_0x28eec2){var _0x4be478=function(_0x3ce049){while(--_0x3ce049){_0x5376cf['push'](_0x5376cf['shift']());}};_0x4be478(++_0x28eec2);}(_0x56dc,0xe6));var _0xc56d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56dc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc56d('0x0'));var util=require(_0xc56d('0x1'));var path=require('path');var timeout=require(_0xc56d('0x2'));var express=require('express');var router=express[_0xc56d('0x3')]();var fs_extra=require(_0xc56d('0x4'));var auth=require(_0xc56d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc56d('0x6'));var controller=require(_0xc56d('0x7'));router[_0xc56d('0x8')]('/',auth[_0xc56d('0x9')](),controller['index']);router[_0xc56d('0x8')](_0xc56d('0xa'),auth[_0xc56d('0x9')](),controller[_0xc56d('0xb')]);router[_0xc56d('0x8')](_0xc56d('0xc'),auth[_0xc56d('0x9')](),controller[_0xc56d('0xd')]);router[_0xc56d('0x8')](_0xc56d('0xe'),auth[_0xc56d('0x9')](),controller['getSubjects']);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0xc56d('0x8')]('/:id/tags',auth[_0xc56d('0x9')](),controller[_0xc56d('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc56d('0x10')]);router[_0xc56d('0x11')](_0xc56d('0x12'),auth[_0xc56d('0x9')](),controller['setTags']);router[_0xc56d('0x13')](_0xc56d('0xa'),auth[_0xc56d('0x9')](),controller[_0xc56d('0x14')]);router[_0xc56d('0x15')](_0xc56d('0xa'),auth[_0xc56d('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7717=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x380501,_0x3babe6){var _0x1950d1=function(_0xc57c93){while(--_0xc57c93){_0x380501['push'](_0x380501['shift']());}};_0x1950d1(++_0x3babe6);}(_0x7717,0xac));var _0x7771=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7717[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0x7771('0x0'));var path=require(_0x7771('0x1'));var timeout=require(_0x7771('0x2'));var express=require('express');var router=express[_0x7771('0x3')]();var fs_extra=require(_0x7771('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7771('0x5'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x7771('0x6')]('/',auth[_0x7771('0x7')](),controller[_0x7771('0x8')]);router[_0x7771('0x6')](_0x7771('0x9'),auth[_0x7771('0x7')](),controller[_0x7771('0xa')]);router['get']('/:id/fields',auth[_0x7771('0x7')](),controller[_0x7771('0xb')]);router[_0x7771('0x6')](_0x7771('0xc'),auth[_0x7771('0x7')](),controller[_0x7771('0xd')]);router['get'](_0x7771('0xe'),auth[_0x7771('0x7')](),controller[_0x7771('0xf')]);router[_0x7771('0x6')](_0x7771('0x10'),auth[_0x7771('0x7')](),controller['getTags']);router[_0x7771('0x11')]('/',auth[_0x7771('0x7')](),controller[_0x7771('0x12')]);router[_0x7771('0x11')](_0x7771('0x10'),auth['isAuthenticated'](),controller['setTags']);router[_0x7771('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x7771('0x14')]);router[_0x7771('0x15')](_0x7771('0x9'),auth[_0x7771('0x7')](),controller[_0x7771('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 3277219..112e9f1 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 _0x3f20=['STRING','sequelize','exports'];(function(_0x1a94ca,_0x1dc1ed){var _0x2d88f8=function(_0x175fcc){while(--_0x175fcc){_0x1a94ca['push'](_0x1a94ca['shift']());}};_0x2d88f8(++_0x1dc1ed);}(_0x3f20,0x106));var _0x03f2=function(_0x1e0a14,_0x4234b8){_0x1e0a14=_0x1e0a14-0x0;var _0x162b71=_0x3f20[_0x1e0a14];return _0x162b71;};'use strict';var Sequelize=require(_0x03f2('0x0'));module[_0x03f2('0x1')]={'name':{'type':Sequelize[_0x03f2('0x2')]},'description':{'type':Sequelize[_0x03f2('0x2')]}}; \ No newline at end of file +var _0xb712=['exports','STRING','sequelize'];(function(_0x25f12b,_0xa1ff3d){var _0x31a8df=function(_0x4c3e0c){while(--_0x4c3e0c){_0x25f12b['push'](_0x25f12b['shift']());}};_0x31a8df(++_0xa1ff3d);}(_0xb712,0x131));var _0x2b71=function(_0x386e19,_0x1a9d87){_0x386e19=_0x386e19-0x0;var _0xdbfbcc=_0xb712[_0x386e19];return _0xdbfbcc;};'use strict';var Sequelize=require(_0x2b71('0x0'));module[_0x2b71('0x1')]={'name':{'type':Sequelize[_0x2b71('0x2')]},'description':{'type':Sequelize[_0x2b71('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index de38da7..fb35de1 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 _0x2829=['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','error','stack','name','index','map','FreshdeskConfiguration','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','keys','create','body','find','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x190b3a,_0x1a1645){var _0x44079f=function(_0x347ce4){while(--_0x347ce4){_0x190b3a['push'](_0x190b3a['shift']());}};_0x44079f(++_0x1a1645);}(_0x2829,0x1a2));var _0x9282=function(_0xa014d1,_0x2f0148){_0xa014d1=_0xa014d1-0x0;var _0x326240=_0x2829[_0xa014d1];return _0x326240;};'use strict';var emlformat=require(_0x9282('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9282('0x1'));var jsonpatch=require(_0x9282('0x2'));var rp=require('request-promise');var moment=require(_0x9282('0x3'));var BPromise=require(_0x9282('0x4'));var Mustache=require(_0x9282('0x5'));var util=require(_0x9282('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9282('0x7'));var ejs=require(_0x9282('0x8'));var fs=require('fs');var fs_extra=require(_0x9282('0x9'));var _=require(_0x9282('0xa'));var squel=require('squel');var crypto=require(_0x9282('0xb'));var jsforce=require(_0x9282('0xc'));var deskjs=require(_0x9282('0xd'));var toCsv=require(_0x9282('0x7'));var querystring=require(_0x9282('0xe'));var Papa=require(_0x9282('0xf'));var Redis=require(_0x9282('0x10'));var authService=require(_0x9282('0x11'));var qs=require(_0x9282('0x12'));var as=require(_0x9282('0x13'));var hardwareService=require(_0x9282('0x14'));var logger=require(_0x9282('0x15'))(_0x9282('0x16'));var utils=require(_0x9282('0x17'));var config=require(_0x9282('0x18'));var licenseUtil=require(_0x9282('0x19'));var db=require(_0x9282('0x1a'))['db'];function respondWithStatusCode(_0x4f25be,_0x4c713e){_0x4c713e=_0x4c713e||0xcc;return function(_0x27d4f7){if(_0x27d4f7){return _0x4f25be[_0x9282('0x1b')](_0x4c713e);}return _0x4f25be[_0x9282('0x1c')](_0x4c713e)[_0x9282('0x1d')]();};}function respondWithResult(_0xe43514,_0x15da47){_0x15da47=_0x15da47||0xc8;return function(_0x207dbb){if(_0x207dbb){return _0xe43514[_0x9282('0x1c')](_0x15da47)[_0x9282('0x1e')](_0x207dbb);}};}function respondWithFilteredResult(_0x23441f,_0x143c7f){return function(_0x4a81c7){if(_0x4a81c7){var _0x52f65e=typeof _0x143c7f[_0x9282('0x1f')]===_0x9282('0x20')&&typeof _0x143c7f[_0x9282('0x21')]===_0x9282('0x20');var _0x158b70=_0x4a81c7[_0x9282('0x22')];var _0x35782b=_0x52f65e?0x0:_0x143c7f['offset'];var _0x240b7c=_0x52f65e?_0x4a81c7[_0x9282('0x22')]:_0x143c7f['offset']+_0x143c7f[_0x9282('0x21')];var _0x242083;if(_0x240b7c>=_0x158b70){_0x240b7c=_0x158b70;_0x242083=0xc8;}else{_0x242083=0xce;}_0x23441f[_0x9282('0x1c')](_0x242083);return _0x23441f[_0x9282('0x23')](_0x9282('0x24'),_0x35782b+'-'+_0x240b7c+'/'+_0x158b70)[_0x9282('0x1e')](_0x4a81c7);}return null;};}function patchUpdates(_0x331d29){return function(_0x170142){try{jsonpatch[_0x9282('0x25')](_0x170142,_0x331d29,!![]);}catch(_0x581f71){return BPromise[_0x9282('0x26')](_0x581f71);}return _0x170142[_0x9282('0x27')]();};}function saveUpdates(_0x5db007,_0x50be85){return function(_0x5d4b6c){if(_0x5d4b6c){return _0x5d4b6c[_0x9282('0x28')](_0x5db007)[_0x9282('0x29')](function(_0x23f953){return _0x23f953;});}return null;};}function removeEntity(_0x3e4899,_0x29a944){return function(_0x225cf0){if(_0x225cf0){return _0x225cf0[_0x9282('0x2a')]()[_0x9282('0x29')](function(){_0x3e4899[_0x9282('0x1c')](0xcc)[_0x9282('0x1d')]();});}};}function handleEntityNotFound(_0x470247,_0x2e181e){return function(_0xf5737a){if(!_0xf5737a){_0x470247[_0x9282('0x1b')](0x194);}return _0xf5737a;};}function handleError(_0x4ba3c8,_0x2c2d01){_0x2c2d01=_0x2c2d01||0x1f4;return function(_0x5b7e99){logger[_0x9282('0x2b')](_0x5b7e99[_0x9282('0x2c')]);if(_0x5b7e99['name']){delete _0x5b7e99[_0x9282('0x2d')];}_0x4ba3c8['status'](_0x2c2d01)['send'](_0x5b7e99);};}exports[_0x9282('0x2e')]=function(_0x4ccbae,_0x5b9cc8){var _0x137e92={},_0x50f336={},_0x484c7e={'count':0x0,'rows':[]};var _0x13cc99=_[_0x9282('0x2f')](db[_0x9282('0x30')]['rawAttributes'],function(_0x5e54c2){return{'name':_0x5e54c2[_0x9282('0x31')],'type':_0x5e54c2[_0x9282('0x32')]['key']};});_0x50f336[_0x9282('0x33')]=_[_0x9282('0x2f')](_0x13cc99,_0x9282('0x2d'));_0x50f336[_0x9282('0x34')]=_['keys'](_0x4ccbae[_0x9282('0x34')]);_0x50f336['filters']=_[_0x9282('0x35')](_0x50f336[_0x9282('0x33')],_0x50f336[_0x9282('0x34')]);_0x137e92['attributes']=_[_0x9282('0x35')](_0x50f336['model'],qs[_0x9282('0x36')](_0x4ccbae['query'][_0x9282('0x36')]));_0x137e92[_0x9282('0x37')]=_0x137e92[_0x9282('0x37')][_0x9282('0x38')]?_0x137e92[_0x9282('0x37')]:_0x50f336[_0x9282('0x33')];if(!_0x4ccbae[_0x9282('0x34')][_0x9282('0x39')](_0x9282('0x3a'))){_0x137e92[_0x9282('0x21')]=qs[_0x9282('0x21')](_0x4ccbae[_0x9282('0x34')]['limit']);_0x137e92[_0x9282('0x1f')]=qs[_0x9282('0x1f')](_0x4ccbae[_0x9282('0x34')]['offset']);}_0x137e92[_0x9282('0x3b')]=qs[_0x9282('0x3c')](_0x4ccbae[_0x9282('0x34')][_0x9282('0x3c')]);_0x137e92[_0x9282('0x3d')]=qs[_0x9282('0x3e')](_[_0x9282('0x3f')](_0x4ccbae['query'],_0x50f336[_0x9282('0x3e')]),_0x13cc99);if(_0x4ccbae[_0x9282('0x34')][_0x9282('0x40')]){_0x137e92[_0x9282('0x3d')]=_[_0x9282('0x41')](_0x137e92[_0x9282('0x3d')],{'$or':_[_0x9282('0x2f')](_0x13cc99,function(_0x397648){if(_0x397648[_0x9282('0x32')]!==_0x9282('0x42')){var _0x4ab5a7={};_0x4ab5a7[_0x397648[_0x9282('0x2d')]]={'$like':'%'+_0x4ccbae[_0x9282('0x34')][_0x9282('0x40')]+'%'};return _0x4ab5a7;}})});}_0x137e92=_['merge']({},_0x137e92,_0x4ccbae[_0x9282('0x43')]);var _0x462ad4={'where':_0x137e92[_0x9282('0x3d')]};return db[_0x9282('0x30')][_0x9282('0x22')](_0x462ad4)[_0x9282('0x29')](function(_0x408a64){_0x484c7e[_0x9282('0x22')]=_0x408a64;if(_0x4ccbae['query'][_0x9282('0x44')]){_0x137e92[_0x9282('0x45')]=[{'all':!![]}];}return db[_0x9282('0x30')][_0x9282('0x46')](_0x137e92);})['then'](function(_0x5093fa){_0x484c7e['rows']=_0x5093fa;return _0x484c7e;})['then'](respondWithFilteredResult(_0x5b9cc8,_0x137e92))[_0x9282('0x47')](handleError(_0x5b9cc8,null));};exports[_0x9282('0x48')]=function(_0x538706,_0x35b050){var _0x51ecb7={'raw':![],'where':{'id':_0x538706[_0x9282('0x49')]['id']}},_0x2184e9={};_0x2184e9[_0x9282('0x33')]=_['keys'](db[_0x9282('0x30')][_0x9282('0x4a')]);_0x2184e9[_0x9282('0x34')]=_[_0x9282('0x4b')](_0x538706[_0x9282('0x34')]);_0x2184e9[_0x9282('0x3e')]=_['intersection'](_0x2184e9['model'],_0x2184e9[_0x9282('0x34')]);_0x51ecb7[_0x9282('0x37')]=_['intersection'](_0x2184e9[_0x9282('0x33')],qs[_0x9282('0x36')](_0x538706[_0x9282('0x34')][_0x9282('0x36')]));_0x51ecb7[_0x9282('0x37')]=_0x51ecb7[_0x9282('0x37')][_0x9282('0x38')]?_0x51ecb7[_0x9282('0x37')]:_0x2184e9[_0x9282('0x33')];if(_0x538706[_0x9282('0x34')]['includeAll']){_0x51ecb7[_0x9282('0x45')]=[{'all':!![]}];}_0x51ecb7=_['merge']({},_0x51ecb7,_0x538706[_0x9282('0x43')]);return db[_0x9282('0x30')]['find'](_0x51ecb7)[_0x9282('0x29')](handleEntityNotFound(_0x35b050,null))[_0x9282('0x29')](respondWithResult(_0x35b050,null))['catch'](handleError(_0x35b050,null));};exports[_0x9282('0x4c')]=function(_0x25318d,_0x4a8e00){return db[_0x9282('0x30')]['create'](_0x25318d[_0x9282('0x4d')],{})['then'](respondWithResult(_0x4a8e00,0xc9))[_0x9282('0x47')](handleError(_0x4a8e00,null));};exports[_0x9282('0x28')]=function(_0x3a5e09,_0x4b36f2){if(_0x3a5e09[_0x9282('0x4d')]['id']){delete _0x3a5e09[_0x9282('0x4d')]['id'];}return db[_0x9282('0x30')]['find']({'where':{'id':_0x3a5e09['params']['id']}})['then'](handleEntityNotFound(_0x4b36f2,null))[_0x9282('0x29')](saveUpdates(_0x3a5e09[_0x9282('0x4d')],null))[_0x9282('0x29')](respondWithResult(_0x4b36f2,null))['catch'](handleError(_0x4b36f2,null));};exports['destroy']=function(_0x5f4ed1,_0x521c88){return db[_0x9282('0x30')][_0x9282('0x4e')]({'where':{'id':_0x5f4ed1[_0x9282('0x49')]['id']}})[_0x9282('0x29')](handleEntityNotFound(_0x521c88,null))[_0x9282('0x29')](removeEntity(_0x521c88,null))[_0x9282('0x47')](handleError(_0x521c88,null));};exports[_0x9282('0x4f')]=function(_0x2c7c36,_0x35d399,_0x5c3dfe){var _0x4563cc={};var _0x3b3a6c={};var _0x202949;var _0x1ba897;return db[_0x9282('0x30')][_0x9282('0x50')]({'where':{'id':_0x2c7c36[_0x9282('0x49')]['id']}})[_0x9282('0x29')](handleEntityNotFound(_0x35d399,null))[_0x9282('0x29')](function(_0x14f895){if(_0x14f895){_0x202949=_0x14f895;_0x3b3a6c['model']=_[_0x9282('0x4b')](db[_0x9282('0x51')][_0x9282('0x4a')]);_0x3b3a6c[_0x9282('0x34')]=_[_0x9282('0x4b')](_0x2c7c36['query']);_0x3b3a6c[_0x9282('0x3e')]=_[_0x9282('0x35')](_0x3b3a6c[_0x9282('0x33')],_0x3b3a6c[_0x9282('0x34')]);_0x4563cc['attributes']=_['intersection'](_0x3b3a6c[_0x9282('0x33')],qs['fields'](_0x2c7c36['query']['fields']));_0x4563cc[_0x9282('0x37')]=_0x4563cc[_0x9282('0x37')][_0x9282('0x38')]?_0x4563cc[_0x9282('0x37')]:_0x3b3a6c[_0x9282('0x33')];_0x4563cc[_0x9282('0x3b')]=qs[_0x9282('0x3c')](_0x2c7c36[_0x9282('0x34')][_0x9282('0x3c')]);_0x4563cc[_0x9282('0x3d')]=qs['filters'](_[_0x9282('0x3f')](_0x2c7c36['query'],_0x3b3a6c[_0x9282('0x3e')]));if(_0x2c7c36[_0x9282('0x34')][_0x9282('0x40')]){_0x4563cc['where']=_['merge'](_0x4563cc['where'],{'$or':_[_0x9282('0x2f')](_0x4563cc[_0x9282('0x37')],function(_0x3237b7){var _0x45390c={};_0x45390c[_0x3237b7]={'$like':'%'+_0x2c7c36[_0x9282('0x34')][_0x9282('0x40')]+'%'};return _0x45390c;})});}_0x4563cc=_['merge']({},_0x4563cc,_0x2c7c36[_0x9282('0x43')]);return _0x202949['getFields'](_0x4563cc);}})[_0x9282('0x29')](function(_0x1e136f){if(_0x1e136f){_0x1ba897=_0x1e136f['length'];if(!_0x2c7c36[_0x9282('0x34')][_0x9282('0x39')](_0x9282('0x3a'))){_0x4563cc['limit']=qs[_0x9282('0x21')](_0x2c7c36['query'][_0x9282('0x21')]);_0x4563cc[_0x9282('0x1f')]=qs[_0x9282('0x1f')](_0x2c7c36['query'][_0x9282('0x1f')]);}return _0x202949[_0x9282('0x4f')](_0x4563cc);}})[_0x9282('0x29')](function(_0x6d19ea){if(_0x6d19ea){return _0x6d19ea?{'count':_0x1ba897,'rows':_0x6d19ea}:null;}})[_0x9282('0x29')](respondWithResult(_0x35d399,null))[_0x9282('0x47')](handleError(_0x35d399,null));};exports[_0x9282('0x52')]=function(_0x3f0182,_0x414998,_0x4483aa){var _0x3435f={};var _0x233f3b={};var _0x107a50;var _0x560aa3;return db['FreshdeskConfiguration'][_0x9282('0x50')]({'where':{'id':_0x3f0182['params']['id']}})[_0x9282('0x29')](handleEntityNotFound(_0x414998,null))[_0x9282('0x29')](function(_0x1a5ae0){if(_0x1a5ae0){_0x107a50=_0x1a5ae0;_0x233f3b[_0x9282('0x33')]=_[_0x9282('0x4b')](db[_0x9282('0x51')][_0x9282('0x4a')]);_0x233f3b[_0x9282('0x34')]=_[_0x9282('0x4b')](_0x3f0182['query']);_0x233f3b[_0x9282('0x3e')]=_[_0x9282('0x35')](_0x233f3b[_0x9282('0x33')],_0x233f3b['query']);_0x3435f[_0x9282('0x37')]=_['intersection'](_0x233f3b[_0x9282('0x33')],qs[_0x9282('0x36')](_0x3f0182['query'][_0x9282('0x36')]));_0x3435f[_0x9282('0x37')]=_0x3435f[_0x9282('0x37')][_0x9282('0x38')]?_0x3435f['attributes']:_0x233f3b[_0x9282('0x33')];_0x3435f['order']=qs[_0x9282('0x3c')](_0x3f0182[_0x9282('0x34')][_0x9282('0x3c')]);_0x3435f[_0x9282('0x3d')]=qs[_0x9282('0x3e')](_[_0x9282('0x3f')](_0x3f0182[_0x9282('0x34')],_0x233f3b[_0x9282('0x3e')]));if(_0x3f0182['query']['filter']){_0x3435f[_0x9282('0x3d')]=_['merge'](_0x3435f[_0x9282('0x3d')],{'$or':_[_0x9282('0x2f')](_0x3435f[_0x9282('0x37')],function(_0x4e58e0){var _0x5a7372={};_0x5a7372[_0x4e58e0]={'$like':'%'+_0x3f0182[_0x9282('0x34')][_0x9282('0x40')]+'%'};return _0x5a7372;})});}_0x3435f=_[_0x9282('0x41')]({},_0x3435f,_0x3f0182['options']);return _0x107a50[_0x9282('0x52')](_0x3435f);}})[_0x9282('0x29')](function(_0x1dc51d){if(_0x1dc51d){_0x560aa3=_0x1dc51d[_0x9282('0x38')];if(!_0x3f0182[_0x9282('0x34')][_0x9282('0x39')]('nolimit')){_0x3435f[_0x9282('0x21')]=qs[_0x9282('0x21')](_0x3f0182[_0x9282('0x34')][_0x9282('0x21')]);_0x3435f['offset']=qs[_0x9282('0x1f')](_0x3f0182[_0x9282('0x34')]['offset']);}return _0x107a50[_0x9282('0x52')](_0x3435f);}})[_0x9282('0x29')](function(_0x3025ca){if(_0x3025ca){return _0x3025ca?{'count':_0x560aa3,'rows':_0x3025ca}:null;}})[_0x9282('0x29')](respondWithResult(_0x414998,null))[_0x9282('0x47')](handleError(_0x414998,null));};exports[_0x9282('0x53')]=function(_0xb504e7,_0x5d6823,_0x49fcd7){var _0x2e8e46={};var _0x49de40={};var _0x5ce9cf;var _0x3bb7f9;return db['FreshdeskConfiguration'][_0x9282('0x50')]({'where':{'id':_0xb504e7['params']['id']}})[_0x9282('0x29')](handleEntityNotFound(_0x5d6823,null))['then'](function(_0x5db580){if(_0x5db580){_0x5ce9cf=_0x5db580;_0x49de40[_0x9282('0x33')]=_[_0x9282('0x4b')](db[_0x9282('0x51')][_0x9282('0x4a')]);_0x49de40['query']=_['keys'](_0xb504e7[_0x9282('0x34')]);_0x49de40[_0x9282('0x3e')]=_[_0x9282('0x35')](_0x49de40[_0x9282('0x33')],_0x49de40['query']);_0x2e8e46['attributes']=_[_0x9282('0x35')](_0x49de40['model'],qs[_0x9282('0x36')](_0xb504e7['query'][_0x9282('0x36')]));_0x2e8e46[_0x9282('0x37')]=_0x2e8e46[_0x9282('0x37')][_0x9282('0x38')]?_0x2e8e46[_0x9282('0x37')]:_0x49de40[_0x9282('0x33')];_0x2e8e46[_0x9282('0x3b')]=qs[_0x9282('0x3c')](_0xb504e7[_0x9282('0x34')][_0x9282('0x3c')]);_0x2e8e46[_0x9282('0x3d')]=qs['filters'](_[_0x9282('0x3f')](_0xb504e7[_0x9282('0x34')],_0x49de40[_0x9282('0x3e')]));if(_0xb504e7[_0x9282('0x34')][_0x9282('0x40')]){_0x2e8e46[_0x9282('0x3d')]=_[_0x9282('0x41')](_0x2e8e46[_0x9282('0x3d')],{'$or':_['map'](_0x2e8e46['attributes'],function(_0x3f3255){var _0x42ddf4={};_0x42ddf4[_0x3f3255]={'$like':'%'+_0xb504e7[_0x9282('0x34')][_0x9282('0x40')]+'%'};return _0x42ddf4;})});}_0x2e8e46=_[_0x9282('0x41')]({},_0x2e8e46,_0xb504e7[_0x9282('0x43')]);return _0x5ce9cf[_0x9282('0x53')](_0x2e8e46);}})['then'](function(_0x1ef552){if(_0x1ef552){_0x3bb7f9=_0x1ef552[_0x9282('0x38')];if(!_0xb504e7[_0x9282('0x34')][_0x9282('0x39')](_0x9282('0x3a'))){_0x2e8e46['limit']=qs[_0x9282('0x21')](_0xb504e7[_0x9282('0x34')][_0x9282('0x21')]);_0x2e8e46[_0x9282('0x1f')]=qs[_0x9282('0x1f')](_0xb504e7[_0x9282('0x34')]['offset']);}return _0x5ce9cf['getDescriptions'](_0x2e8e46);}})['then'](function(_0x568d84){if(_0x568d84){return _0x568d84?{'count':_0x3bb7f9,'rows':_0x568d84}:null;}})[_0x9282('0x29')](respondWithResult(_0x5d6823,null))['catch'](handleError(_0x5d6823,null));};exports['getTags']=function(_0x2ab975,_0x433e0a,_0x108c83){var _0x59eaaf={};var _0x17ebcb={};var _0x382356;var _0x36a96c;return db[_0x9282('0x30')][_0x9282('0x50')]({'where':{'id':_0x2ab975[_0x9282('0x49')]['id']}})[_0x9282('0x29')](handleEntityNotFound(_0x433e0a,null))[_0x9282('0x29')](function(_0x41b62b){if(_0x41b62b){_0x382356=_0x41b62b;_0x17ebcb[_0x9282('0x33')]=_[_0x9282('0x4b')](db[_0x9282('0x54')][_0x9282('0x4a')]);_0x17ebcb[_0x9282('0x34')]=_[_0x9282('0x4b')](_0x2ab975[_0x9282('0x34')]);_0x17ebcb['filters']=_['intersection'](_0x17ebcb[_0x9282('0x33')],_0x17ebcb['query']);_0x59eaaf['attributes']=_['intersection'](_0x17ebcb[_0x9282('0x33')],qs[_0x9282('0x36')](_0x2ab975[_0x9282('0x34')]['fields']));_0x59eaaf[_0x9282('0x37')]=_0x59eaaf[_0x9282('0x37')]['length']?_0x59eaaf[_0x9282('0x37')]:_0x17ebcb[_0x9282('0x33')];_0x59eaaf[_0x9282('0x3b')]=qs[_0x9282('0x3c')](_0x2ab975[_0x9282('0x34')][_0x9282('0x3c')]);_0x59eaaf[_0x9282('0x3d')]=qs[_0x9282('0x3e')](_[_0x9282('0x3f')](_0x2ab975[_0x9282('0x34')],_0x17ebcb[_0x9282('0x3e')]));if(_0x2ab975[_0x9282('0x34')][_0x9282('0x40')]){_0x59eaaf[_0x9282('0x3d')]=_['merge'](_0x59eaaf[_0x9282('0x3d')],{'$or':_['map'](_0x59eaaf[_0x9282('0x37')],function(_0x2f8c89){var _0x5d1c55={};_0x5d1c55[_0x2f8c89]={'$like':'%'+_0x2ab975[_0x9282('0x34')][_0x9282('0x40')]+'%'};return _0x5d1c55;})});}_0x59eaaf=_[_0x9282('0x41')]({},_0x59eaaf,_0x2ab975['options']);return _0x382356[_0x9282('0x55')](_0x59eaaf);}})[_0x9282('0x29')](function(_0x254892){if(_0x254892){_0x36a96c=_0x254892['length'];if(!_0x2ab975[_0x9282('0x34')][_0x9282('0x39')]('nolimit')){_0x59eaaf[_0x9282('0x21')]=qs[_0x9282('0x21')](_0x2ab975[_0x9282('0x34')][_0x9282('0x21')]);_0x59eaaf[_0x9282('0x1f')]=qs[_0x9282('0x1f')](_0x2ab975[_0x9282('0x34')][_0x9282('0x1f')]);}return _0x382356[_0x9282('0x55')](_0x59eaaf);}})['then'](function(_0x5a99d0){if(_0x5a99d0){return _0x5a99d0?{'count':_0x36a96c,'rows':_0x5a99d0}:null;}})['then'](respondWithResult(_0x433e0a,null))[_0x9282('0x47')](handleError(_0x433e0a,null));};exports['setTags']=function(_0x16c24d,_0x37a964,_0x4a66c3){if(_0x16c24d[_0x9282('0x4d')]['id']){delete _0x16c24d['body']['id'];}return db[_0x9282('0x30')][_0x9282('0x50')]({'where':{'id':_0x16c24d['params']['id']}})[_0x9282('0x29')](handleEntityNotFound(_0x37a964,null))[_0x9282('0x29')](function(_0x4813ff){if(_0x4813ff){return _0x4813ff[_0x9282('0x56')](_0x16c24d['body'][_0x9282('0x57')]||[]);}return null;})['then'](respondWithResult(_0x37a964,null))['catch'](handleError(_0x37a964,null));}; \ No newline at end of file +var _0xe0ba=['findOne','hasOwnProperty','nolimit','getSubjects','FreshdeskField','fields','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields'];(function(_0x5ec8c2,_0x417546){var _0x48559b=function(_0x1b5bd8){while(--_0x1b5bd8){_0x5ec8c2['push'](_0x5ec8c2['shift']());}};_0x48559b(++_0x417546);}(_0xe0ba,0x122));var _0xae0b=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xe0ba[_0x17928f];return _0x500b63;};'use strict';var emlformat=require(_0xae0b('0x0'));var rimraf=require(_0xae0b('0x1'));var zipdir=require(_0xae0b('0x2'));var jsonpatch=require(_0xae0b('0x3'));var rp=require(_0xae0b('0x4'));var moment=require(_0xae0b('0x5'));var BPromise=require(_0xae0b('0x6'));var Mustache=require(_0xae0b('0x7'));var util=require(_0xae0b('0x8'));var path=require('path');var sox=require(_0xae0b('0x9'));var csv=require('to-csv');var ejs=require(_0xae0b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae0b('0xb'));var squel=require(_0xae0b('0xc'));var crypto=require(_0xae0b('0xd'));var jsforce=require(_0xae0b('0xe'));var deskjs=require(_0xae0b('0xf'));var toCsv=require(_0xae0b('0x10'));var querystring=require(_0xae0b('0x11'));var Papa=require(_0xae0b('0x12'));var Redis=require(_0xae0b('0x13'));var authService=require(_0xae0b('0x14'));var qs=require(_0xae0b('0x15'));var as=require(_0xae0b('0x16'));var hardwareService=require(_0xae0b('0x17'));var logger=require(_0xae0b('0x18'))(_0xae0b('0x19'));var utils=require(_0xae0b('0x1a'));var config=require(_0xae0b('0x1b'));var licenseUtil=require(_0xae0b('0x1c'));var db=require(_0xae0b('0x1d'))['db'];function respondWithStatusCode(_0x3f3ada,_0x2efb46){_0x2efb46=_0x2efb46||0xcc;return function(_0xd02453){if(_0xd02453){return _0x3f3ada[_0xae0b('0x1e')](_0x2efb46);}return _0x3f3ada[_0xae0b('0x1f')](_0x2efb46)[_0xae0b('0x20')]();};}function respondWithResult(_0xd818c7,_0x478c18){_0x478c18=_0x478c18||0xc8;return function(_0x41dfaf){if(_0x41dfaf){return _0xd818c7[_0xae0b('0x1f')](_0x478c18)[_0xae0b('0x21')](_0x41dfaf);}};}function respondWithFilteredResult(_0x3d3ea0,_0x19c77f){return function(_0x3d0780){if(_0x3d0780){var _0x5c1786=typeof _0x19c77f[_0xae0b('0x22')]==='undefined'&&typeof _0x19c77f[_0xae0b('0x23')]===_0xae0b('0x24');var _0x597b95=_0x3d0780[_0xae0b('0x25')];var _0x159c74=_0x5c1786?0x0:_0x19c77f[_0xae0b('0x22')];var _0xb613e6=_0x5c1786?_0x3d0780[_0xae0b('0x25')]:_0x19c77f[_0xae0b('0x22')]+_0x19c77f[_0xae0b('0x23')];var _0x175b7f;if(_0xb613e6>=_0x597b95){_0xb613e6=_0x597b95;_0x175b7f=0xc8;}else{_0x175b7f=0xce;}_0x3d3ea0[_0xae0b('0x1f')](_0x175b7f);return _0x3d3ea0['set'](_0xae0b('0x26'),_0x159c74+'-'+_0xb613e6+'/'+_0x597b95)[_0xae0b('0x21')](_0x3d0780);}return null;};}function patchUpdates(_0x40ecd8){return function(_0x129194){try{jsonpatch[_0xae0b('0x27')](_0x129194,_0x40ecd8,!![]);}catch(_0x350fc1){return BPromise[_0xae0b('0x28')](_0x350fc1);}return _0x129194[_0xae0b('0x29')]();};}function saveUpdates(_0x6c8745,_0x5bcc20){return function(_0x38b366){if(_0x38b366){return _0x38b366[_0xae0b('0x2a')](_0x6c8745)['then'](function(_0x1f4ba9){return _0x1f4ba9;});}return null;};}function removeEntity(_0x3fd1c2,_0x340edc){return function(_0x2490f5){if(_0x2490f5){return _0x2490f5[_0xae0b('0x2b')]()[_0xae0b('0x2c')](function(){_0x3fd1c2['status'](0xcc)[_0xae0b('0x20')]();});}};}function handleEntityNotFound(_0x2f3874,_0x4c9b46){return function(_0x18cc4a){if(!_0x18cc4a){_0x2f3874['sendStatus'](0x194);}return _0x18cc4a;};}function handleError(_0x4d3a94,_0x3b12af){_0x3b12af=_0x3b12af||0x1f4;return function(_0x3e86cc){logger[_0xae0b('0x2d')](_0x3e86cc[_0xae0b('0x2e')]);if(_0x3e86cc[_0xae0b('0x2f')]){delete _0x3e86cc[_0xae0b('0x2f')];}_0x4d3a94['status'](_0x3b12af)[_0xae0b('0x30')](_0x3e86cc);};}exports[_0xae0b('0x31')]=function(_0x3363d1,_0xe257b6){var _0x55640c={},_0xedb73d={},_0x457c37={'count':0x0,'rows':[]};var _0x1d7281=_[_0xae0b('0x32')](db[_0xae0b('0x33')][_0xae0b('0x34')],function(_0x586c9d){return{'name':_0x586c9d[_0xae0b('0x35')],'type':_0x586c9d[_0xae0b('0x36')][_0xae0b('0x37')]};});_0xedb73d[_0xae0b('0x38')]=_[_0xae0b('0x32')](_0x1d7281,_0xae0b('0x2f'));_0xedb73d[_0xae0b('0x39')]=_[_0xae0b('0x3a')](_0x3363d1[_0xae0b('0x39')]);_0xedb73d[_0xae0b('0x3b')]=_[_0xae0b('0x3c')](_0xedb73d['model'],_0xedb73d[_0xae0b('0x39')]);_0x55640c['attributes']=_['intersection'](_0xedb73d[_0xae0b('0x38')],qs['fields'](_0x3363d1['query']['fields']));_0x55640c[_0xae0b('0x3d')]=_0x55640c[_0xae0b('0x3d')][_0xae0b('0x3e')]?_0x55640c[_0xae0b('0x3d')]:_0xedb73d[_0xae0b('0x38')];if(!_0x3363d1[_0xae0b('0x39')]['hasOwnProperty']('nolimit')){_0x55640c[_0xae0b('0x23')]=qs[_0xae0b('0x23')](_0x3363d1[_0xae0b('0x39')]['limit']);_0x55640c['offset']=qs[_0xae0b('0x22')](_0x3363d1[_0xae0b('0x39')][_0xae0b('0x22')]);}_0x55640c[_0xae0b('0x3f')]=qs['sort'](_0x3363d1['query'][_0xae0b('0x40')]);_0x55640c[_0xae0b('0x41')]=qs[_0xae0b('0x3b')](_[_0xae0b('0x42')](_0x3363d1['query'],_0xedb73d[_0xae0b('0x3b')]),_0x1d7281);if(_0x3363d1['query'][_0xae0b('0x43')]){_0x55640c[_0xae0b('0x41')]=_[_0xae0b('0x44')](_0x55640c[_0xae0b('0x41')],{'$or':_[_0xae0b('0x32')](_0x1d7281,function(_0x177ae8){if(_0x177ae8[_0xae0b('0x36')]!==_0xae0b('0x45')){var _0x5db706={};_0x5db706[_0x177ae8['name']]={'$like':'%'+_0x3363d1[_0xae0b('0x39')]['filter']+'%'};return _0x5db706;}})});}_0x55640c=_['merge']({},_0x55640c,_0x3363d1[_0xae0b('0x46')]);var _0x1539af={'where':_0x55640c[_0xae0b('0x41')]};return db[_0xae0b('0x33')][_0xae0b('0x25')](_0x1539af)[_0xae0b('0x2c')](function(_0x16e732){_0x457c37['count']=_0x16e732;if(_0x3363d1[_0xae0b('0x39')][_0xae0b('0x47')]){_0x55640c[_0xae0b('0x48')]=[{'all':!![]}];}return db[_0xae0b('0x33')][_0xae0b('0x49')](_0x55640c);})[_0xae0b('0x2c')](function(_0x524e14){_0x457c37[_0xae0b('0x4a')]=_0x524e14;return _0x457c37;})[_0xae0b('0x2c')](respondWithFilteredResult(_0xe257b6,_0x55640c))[_0xae0b('0x4b')](handleError(_0xe257b6,null));};exports[_0xae0b('0x4c')]=function(_0x45dc24,_0x146f10){var _0x5e86c3={'raw':![],'where':{'id':_0x45dc24[_0xae0b('0x4d')]['id']}},_0x3a525e={};_0x3a525e['model']=_[_0xae0b('0x3a')](db[_0xae0b('0x33')][_0xae0b('0x34')]);_0x3a525e[_0xae0b('0x39')]=_[_0xae0b('0x3a')](_0x45dc24[_0xae0b('0x39')]);_0x3a525e['filters']=_[_0xae0b('0x3c')](_0x3a525e[_0xae0b('0x38')],_0x3a525e[_0xae0b('0x39')]);_0x5e86c3[_0xae0b('0x3d')]=_[_0xae0b('0x3c')](_0x3a525e['model'],qs['fields'](_0x45dc24[_0xae0b('0x39')]['fields']));_0x5e86c3[_0xae0b('0x3d')]=_0x5e86c3[_0xae0b('0x3d')][_0xae0b('0x3e')]?_0x5e86c3[_0xae0b('0x3d')]:_0x3a525e[_0xae0b('0x38')];if(_0x45dc24[_0xae0b('0x39')][_0xae0b('0x47')]){_0x5e86c3[_0xae0b('0x48')]=[{'all':!![]}];}_0x5e86c3=_[_0xae0b('0x44')]({},_0x5e86c3,_0x45dc24[_0xae0b('0x46')]);return db[_0xae0b('0x33')][_0xae0b('0x4e')](_0x5e86c3)['then'](handleEntityNotFound(_0x146f10,null))[_0xae0b('0x2c')](respondWithResult(_0x146f10,null))[_0xae0b('0x4b')](handleError(_0x146f10,null));};exports[_0xae0b('0x4f')]=function(_0x51cfdd,_0x237fdb){return db['FreshdeskConfiguration'][_0xae0b('0x4f')](_0x51cfdd[_0xae0b('0x50')],{})[_0xae0b('0x2c')](respondWithResult(_0x237fdb,0xc9))[_0xae0b('0x4b')](handleError(_0x237fdb,null));};exports['update']=function(_0x535434,_0x311149){if(_0x535434[_0xae0b('0x50')]['id']){delete _0x535434[_0xae0b('0x50')]['id'];}return db[_0xae0b('0x33')][_0xae0b('0x4e')]({'where':{'id':_0x535434[_0xae0b('0x4d')]['id']}})[_0xae0b('0x2c')](handleEntityNotFound(_0x311149,null))['then'](saveUpdates(_0x535434['body'],null))['then'](respondWithResult(_0x311149,null))[_0xae0b('0x4b')](handleError(_0x311149,null));};exports[_0xae0b('0x2b')]=function(_0x41da94,_0x328787){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x41da94[_0xae0b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x328787,null))[_0xae0b('0x2c')](removeEntity(_0x328787,null))[_0xae0b('0x4b')](handleError(_0x328787,null));};exports[_0xae0b('0x51')]=function(_0x3b64c4,_0x27a585,_0x297c4e){var _0x2e2fc6={};var _0x1a360e={};var _0x2ccfac;var _0x5f221e;return db[_0xae0b('0x33')][_0xae0b('0x52')]({'where':{'id':_0x3b64c4[_0xae0b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x27a585,null))[_0xae0b('0x2c')](function(_0x4ca3fe){if(_0x4ca3fe){_0x2ccfac=_0x4ca3fe;_0x1a360e[_0xae0b('0x38')]=_[_0xae0b('0x3a')](db['FreshdeskField'][_0xae0b('0x34')]);_0x1a360e[_0xae0b('0x39')]=_[_0xae0b('0x3a')](_0x3b64c4[_0xae0b('0x39')]);_0x1a360e['filters']=_['intersection'](_0x1a360e[_0xae0b('0x38')],_0x1a360e[_0xae0b('0x39')]);_0x2e2fc6[_0xae0b('0x3d')]=_[_0xae0b('0x3c')](_0x1a360e['model'],qs['fields'](_0x3b64c4[_0xae0b('0x39')]['fields']));_0x2e2fc6[_0xae0b('0x3d')]=_0x2e2fc6[_0xae0b('0x3d')]['length']?_0x2e2fc6['attributes']:_0x1a360e[_0xae0b('0x38')];_0x2e2fc6[_0xae0b('0x3f')]=qs[_0xae0b('0x40')](_0x3b64c4[_0xae0b('0x39')]['sort']);_0x2e2fc6['where']=qs[_0xae0b('0x3b')](_[_0xae0b('0x42')](_0x3b64c4[_0xae0b('0x39')],_0x1a360e[_0xae0b('0x3b')]));if(_0x3b64c4['query'][_0xae0b('0x43')]){_0x2e2fc6[_0xae0b('0x41')]=_[_0xae0b('0x44')](_0x2e2fc6['where'],{'$or':_[_0xae0b('0x32')](_0x2e2fc6[_0xae0b('0x3d')],function(_0x3a79c6){var _0x5476f8={};_0x5476f8[_0x3a79c6]={'$like':'%'+_0x3b64c4['query'][_0xae0b('0x43')]+'%'};return _0x5476f8;})});}_0x2e2fc6=_[_0xae0b('0x44')]({},_0x2e2fc6,_0x3b64c4[_0xae0b('0x46')]);return _0x2ccfac[_0xae0b('0x51')](_0x2e2fc6);}})[_0xae0b('0x2c')](function(_0x43957f){if(_0x43957f){_0x5f221e=_0x43957f['length'];if(!_0x3b64c4[_0xae0b('0x39')][_0xae0b('0x53')](_0xae0b('0x54'))){_0x2e2fc6[_0xae0b('0x23')]=qs[_0xae0b('0x23')](_0x3b64c4[_0xae0b('0x39')][_0xae0b('0x23')]);_0x2e2fc6[_0xae0b('0x22')]=qs[_0xae0b('0x22')](_0x3b64c4['query'][_0xae0b('0x22')]);}return _0x2ccfac[_0xae0b('0x51')](_0x2e2fc6);}})[_0xae0b('0x2c')](function(_0x18bc6b){if(_0x18bc6b){return _0x18bc6b?{'count':_0x5f221e,'rows':_0x18bc6b}:null;}})['then'](respondWithResult(_0x27a585,null))['catch'](handleError(_0x27a585,null));};exports[_0xae0b('0x55')]=function(_0x7787e8,_0x246d73,_0x50556){var _0x129f03={};var _0x59c5a2={};var _0x34ac56;var _0x466698;return db[_0xae0b('0x33')][_0xae0b('0x52')]({'where':{'id':_0x7787e8[_0xae0b('0x4d')]['id']}})[_0xae0b('0x2c')](handleEntityNotFound(_0x246d73,null))[_0xae0b('0x2c')](function(_0x40bada){if(_0x40bada){_0x34ac56=_0x40bada;_0x59c5a2[_0xae0b('0x38')]=_[_0xae0b('0x3a')](db[_0xae0b('0x56')][_0xae0b('0x34')]);_0x59c5a2[_0xae0b('0x39')]=_[_0xae0b('0x3a')](_0x7787e8[_0xae0b('0x39')]);_0x59c5a2[_0xae0b('0x3b')]=_[_0xae0b('0x3c')](_0x59c5a2[_0xae0b('0x38')],_0x59c5a2['query']);_0x129f03[_0xae0b('0x3d')]=_[_0xae0b('0x3c')](_0x59c5a2['model'],qs['fields'](_0x7787e8['query'][_0xae0b('0x57')]));_0x129f03[_0xae0b('0x3d')]=_0x129f03[_0xae0b('0x3d')][_0xae0b('0x3e')]?_0x129f03['attributes']:_0x59c5a2[_0xae0b('0x38')];_0x129f03[_0xae0b('0x3f')]=qs[_0xae0b('0x40')](_0x7787e8['query'][_0xae0b('0x40')]);_0x129f03[_0xae0b('0x41')]=qs[_0xae0b('0x3b')](_[_0xae0b('0x42')](_0x7787e8[_0xae0b('0x39')],_0x59c5a2['filters']));if(_0x7787e8[_0xae0b('0x39')]['filter']){_0x129f03[_0xae0b('0x41')]=_['merge'](_0x129f03['where'],{'$or':_[_0xae0b('0x32')](_0x129f03[_0xae0b('0x3d')],function(_0x7c367a){var _0x1e5e11={};_0x1e5e11[_0x7c367a]={'$like':'%'+_0x7787e8[_0xae0b('0x39')][_0xae0b('0x43')]+'%'};return _0x1e5e11;})});}_0x129f03=_['merge']({},_0x129f03,_0x7787e8[_0xae0b('0x46')]);return _0x34ac56[_0xae0b('0x55')](_0x129f03);}})['then'](function(_0x2a87a8){if(_0x2a87a8){_0x466698=_0x2a87a8[_0xae0b('0x3e')];if(!_0x7787e8[_0xae0b('0x39')][_0xae0b('0x53')](_0xae0b('0x54'))){_0x129f03[_0xae0b('0x23')]=qs[_0xae0b('0x23')](_0x7787e8[_0xae0b('0x39')][_0xae0b('0x23')]);_0x129f03[_0xae0b('0x22')]=qs[_0xae0b('0x22')](_0x7787e8[_0xae0b('0x39')][_0xae0b('0x22')]);}return _0x34ac56[_0xae0b('0x55')](_0x129f03);}})[_0xae0b('0x2c')](function(_0x11b38f){if(_0x11b38f){return _0x11b38f?{'count':_0x466698,'rows':_0x11b38f}:null;}})['then'](respondWithResult(_0x246d73,null))[_0xae0b('0x4b')](handleError(_0x246d73,null));};exports[_0xae0b('0x58')]=function(_0x4234a0,_0x5b54ab,_0x5776f4){var _0x45230d={};var _0x5f2bc6={};var _0x574e10;var _0x47ed84;return db['FreshdeskConfiguration'][_0xae0b('0x52')]({'where':{'id':_0x4234a0[_0xae0b('0x4d')]['id']}})[_0xae0b('0x2c')](handleEntityNotFound(_0x5b54ab,null))[_0xae0b('0x2c')](function(_0x1996e5){if(_0x1996e5){_0x574e10=_0x1996e5;_0x5f2bc6[_0xae0b('0x38')]=_['keys'](db[_0xae0b('0x56')]['rawAttributes']);_0x5f2bc6[_0xae0b('0x39')]=_['keys'](_0x4234a0[_0xae0b('0x39')]);_0x5f2bc6['filters']=_['intersection'](_0x5f2bc6[_0xae0b('0x38')],_0x5f2bc6['query']);_0x45230d[_0xae0b('0x3d')]=_['intersection'](_0x5f2bc6[_0xae0b('0x38')],qs['fields'](_0x4234a0[_0xae0b('0x39')][_0xae0b('0x57')]));_0x45230d['attributes']=_0x45230d[_0xae0b('0x3d')][_0xae0b('0x3e')]?_0x45230d[_0xae0b('0x3d')]:_0x5f2bc6['model'];_0x45230d['order']=qs[_0xae0b('0x40')](_0x4234a0[_0xae0b('0x39')]['sort']);_0x45230d[_0xae0b('0x41')]=qs[_0xae0b('0x3b')](_[_0xae0b('0x42')](_0x4234a0[_0xae0b('0x39')],_0x5f2bc6['filters']));if(_0x4234a0[_0xae0b('0x39')]['filter']){_0x45230d[_0xae0b('0x41')]=_[_0xae0b('0x44')](_0x45230d[_0xae0b('0x41')],{'$or':_[_0xae0b('0x32')](_0x45230d[_0xae0b('0x3d')],function(_0x4d5df2){var _0x160105={};_0x160105[_0x4d5df2]={'$like':'%'+_0x4234a0['query'][_0xae0b('0x43')]+'%'};return _0x160105;})});}_0x45230d=_[_0xae0b('0x44')]({},_0x45230d,_0x4234a0[_0xae0b('0x46')]);return _0x574e10[_0xae0b('0x58')](_0x45230d);}})['then'](function(_0x14166c){if(_0x14166c){_0x47ed84=_0x14166c[_0xae0b('0x3e')];if(!_0x4234a0[_0xae0b('0x39')][_0xae0b('0x53')](_0xae0b('0x54'))){_0x45230d['limit']=qs['limit'](_0x4234a0[_0xae0b('0x39')][_0xae0b('0x23')]);_0x45230d[_0xae0b('0x22')]=qs[_0xae0b('0x22')](_0x4234a0[_0xae0b('0x39')][_0xae0b('0x22')]);}return _0x574e10[_0xae0b('0x58')](_0x45230d);}})[_0xae0b('0x2c')](function(_0x3c20a4){if(_0x3c20a4){return _0x3c20a4?{'count':_0x47ed84,'rows':_0x3c20a4}:null;}})[_0xae0b('0x2c')](respondWithResult(_0x5b54ab,null))[_0xae0b('0x4b')](handleError(_0x5b54ab,null));};exports[_0xae0b('0x59')]=function(_0x14feab,_0xe8ab29,_0x533742){var _0x1795c0={};var _0x26fdba={};var _0x50b89f;var _0x490a3d;return db[_0xae0b('0x33')]['findOne']({'where':{'id':_0x14feab[_0xae0b('0x4d')]['id']}})[_0xae0b('0x2c')](handleEntityNotFound(_0xe8ab29,null))[_0xae0b('0x2c')](function(_0x21971b){if(_0x21971b){_0x50b89f=_0x21971b;_0x26fdba[_0xae0b('0x38')]=_['keys'](db[_0xae0b('0x5a')]['rawAttributes']);_0x26fdba[_0xae0b('0x39')]=_['keys'](_0x14feab[_0xae0b('0x39')]);_0x26fdba['filters']=_[_0xae0b('0x3c')](_0x26fdba['model'],_0x26fdba[_0xae0b('0x39')]);_0x1795c0[_0xae0b('0x3d')]=_[_0xae0b('0x3c')](_0x26fdba[_0xae0b('0x38')],qs['fields'](_0x14feab[_0xae0b('0x39')][_0xae0b('0x57')]));_0x1795c0[_0xae0b('0x3d')]=_0x1795c0[_0xae0b('0x3d')][_0xae0b('0x3e')]?_0x1795c0[_0xae0b('0x3d')]:_0x26fdba[_0xae0b('0x38')];_0x1795c0[_0xae0b('0x3f')]=qs[_0xae0b('0x40')](_0x14feab['query']['sort']);_0x1795c0[_0xae0b('0x41')]=qs[_0xae0b('0x3b')](_['pick'](_0x14feab[_0xae0b('0x39')],_0x26fdba[_0xae0b('0x3b')]));if(_0x14feab['query'][_0xae0b('0x43')]){_0x1795c0[_0xae0b('0x41')]=_[_0xae0b('0x44')](_0x1795c0[_0xae0b('0x41')],{'$or':_[_0xae0b('0x32')](_0x1795c0[_0xae0b('0x3d')],function(_0x576a0a){var _0x211143={};_0x211143[_0x576a0a]={'$like':'%'+_0x14feab[_0xae0b('0x39')]['filter']+'%'};return _0x211143;})});}_0x1795c0=_[_0xae0b('0x44')]({},_0x1795c0,_0x14feab[_0xae0b('0x46')]);return _0x50b89f[_0xae0b('0x59')](_0x1795c0);}})[_0xae0b('0x2c')](function(_0x103b6b){if(_0x103b6b){_0x490a3d=_0x103b6b[_0xae0b('0x3e')];if(!_0x14feab['query']['hasOwnProperty'](_0xae0b('0x54'))){_0x1795c0[_0xae0b('0x23')]=qs['limit'](_0x14feab[_0xae0b('0x39')][_0xae0b('0x23')]);_0x1795c0[_0xae0b('0x22')]=qs['offset'](_0x14feab[_0xae0b('0x39')][_0xae0b('0x22')]);}return _0x50b89f[_0xae0b('0x59')](_0x1795c0);}})[_0xae0b('0x2c')](function(_0x1a32a6){if(_0x1a32a6){return _0x1a32a6?{'count':_0x490a3d,'rows':_0x1a32a6}:null;}})[_0xae0b('0x2c')](respondWithResult(_0xe8ab29,null))[_0xae0b('0x4b')](handleError(_0xe8ab29,null));};exports[_0xae0b('0x5b')]=function(_0x3d6cb,_0x135969,_0x8c063f){if(_0x3d6cb['body']['id']){delete _0x3d6cb[_0xae0b('0x50')]['id'];}return db[_0xae0b('0x33')][_0xae0b('0x52')]({'where':{'id':_0x3d6cb[_0xae0b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x135969,null))[_0xae0b('0x2c')](function(_0x1ffc71){if(_0x1ffc71){return _0x1ffc71[_0xae0b('0x5b')](_0x3d6cb['body'][_0xae0b('0x5c')]||[]);}return null;})['then'](respondWithResult(_0x135969,null))[_0xae0b('0x4b')](handleError(_0x135969,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index bce3896..3d95b8e 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 _0x6667=['./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6667,0x154));var _0x7666=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0x6667[_0x18cac4];return _0x2227c6;};'use strict';var _=require(_0x7666('0x0'));var util=require(_0x7666('0x1'));var logger=require(_0x7666('0x2'))('api');var moment=require(_0x7666('0x3'));var BPromise=require('bluebird');var rp=require(_0x7666('0x4'));var fs=require('fs');var path=require(_0x7666('0x5'));var rimraf=require(_0x7666('0x6'));var config=require(_0x7666('0x7'));var attributes=require(_0x7666('0x8'));module['exports']=function(_0x28e721,_0x4410cb){return _0x28e721[_0x7666('0x9')](_0x7666('0xa'),attributes,{'tableName':_0x7666('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bc6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','lodash','util','../../config/logger'];(function(_0x23f847,_0x48fa09){var _0x53ed96=function(_0x598c8d){while(--_0x598c8d){_0x23f847['push'](_0x23f847['shift']());}};_0x53ed96(++_0x48fa09);}(_0x1bc6,0xed));var _0x61bc=function(_0x44f548,_0x5d4dd5){_0x44f548=_0x44f548-0x0;var _0x48361c=_0x1bc6[_0x44f548];return _0x48361c;};'use strict';var _=require(_0x61bc('0x0'));var util=require(_0x61bc('0x1'));var logger=require(_0x61bc('0x2'))('api');var moment=require(_0x61bc('0x3'));var BPromise=require(_0x61bc('0x4'));var rp=require(_0x61bc('0x5'));var fs=require('fs');var path=require(_0x61bc('0x6'));var rimraf=require(_0x61bc('0x7'));var config=require(_0x61bc('0x8'));var attributes=require(_0x61bc('0x9'));module['exports']=function(_0x167ab9,_0x516a9e){return _0x167ab9[_0x61bc('0xa')](_0x61bc('0xb'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index bcf6f55..99e03bb 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 _0x93cc=['error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x52276c,_0x51aab0){var _0x4d774c=function(_0x1a36e7){while(--_0x1a36e7){_0x52276c['push'](_0x52276c['shift']());}};_0x4d774c(++_0x51aab0);}(_0x93cc,0x17c));var _0xc93c=function(_0x8f7a88,_0x1f9e6a){_0x8f7a88=_0x8f7a88-0x0;var _0x50ec9b=_0x93cc[_0x8f7a88];return _0x50ec9b;};'use strict';var _=require(_0xc93c('0x0'));var util=require(_0xc93c('0x1'));var moment=require(_0xc93c('0x2'));var BPromise=require(_0xc93c('0x3'));var rs=require(_0xc93c('0x4'));var fs=require('fs');var Redis=require(_0xc93c('0x5'));var db=require(_0xc93c('0x6'))['db'];var utils=require(_0xc93c('0x7'));var logger=require(_0xc93c('0x8'))(_0xc93c('0x9'));var config=require('../../config/environment');var jayson=require(_0xc93c('0xa'));var client=jayson[_0xc93c('0xb')][_0xc93c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x30861e,_0x2bba76,_0x4eb5a5){return new BPromise(function(_0x200b01,_0x3ee6e2){return client[_0xc93c('0xd')](_0x30861e,_0x4eb5a5)['then'](function(_0x205607){logger[_0xc93c('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2bba76,'request\x20sent');logger[_0xc93c('0xf')](_0xc93c('0x10'),_0x2bba76,'request\x20sent',JSON[_0xc93c('0x11')](_0x205607));if(_0x205607['error']){if(_0x205607['error'][_0xc93c('0x12')]===0x1f4){logger['error'](_0xc93c('0x13'),_0x2bba76,_0x205607[_0xc93c('0x14')]['message']);return _0x3ee6e2(_0x205607[_0xc93c('0x14')][_0xc93c('0x15')]);}logger[_0xc93c('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2bba76,_0x205607['error'][_0xc93c('0x15')]);return _0x200b01(_0x205607[_0xc93c('0x14')]['message']);}else{logger['info'](_0xc93c('0x13'),_0x2bba76,_0xc93c('0x16'));_0x200b01(_0x205607[_0xc93c('0x17')]['message']);}})[_0xc93c('0x18')](function(_0x220f13){logger[_0xc93c('0x14')](_0xc93c('0x13'),_0x2bba76,_0x220f13);_0x3ee6e2(_0x220f13);});});} \ No newline at end of file +var _0x3155=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result'];(function(_0x3cd087,_0x2d9784){var _0x126f65=function(_0x48b897){while(--_0x48b897){_0x3cd087['push'](_0x3cd087['shift']());}};_0x126f65(++_0x2d9784);}(_0x3155,0xa9));var _0x5315=function(_0x315002,_0x4ee032){_0x315002=_0x315002-0x0;var _0x54e480=_0x3155[_0x315002];return _0x54e480;};'use strict';var _=require('lodash');var util=require(_0x5315('0x0'));var moment=require('moment');var BPromise=require(_0x5315('0x1'));var rs=require(_0x5315('0x2'));var fs=require('fs');var Redis=require(_0x5315('0x3'));var db=require(_0x5315('0x4'))['db'];var utils=require(_0x5315('0x5'));var logger=require(_0x5315('0x6'))(_0x5315('0x7'));var config=require(_0x5315('0x8'));var jayson=require(_0x5315('0x9'));var client=jayson[_0x5315('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c7254,_0xd4d526,_0x4f2f37){return new BPromise(function(_0xf23158,_0x32d65d){return client[_0x5315('0xb')](_0x5c7254,_0x4f2f37)[_0x5315('0xc')](function(_0xdda331){logger[_0x5315('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xd4d526,_0x5315('0xe'));logger[_0x5315('0xf')](_0x5315('0x10'),_0xd4d526,'request\x20sent',JSON[_0x5315('0x11')](_0xdda331));if(_0xdda331['error']){if(_0xdda331[_0x5315('0x12')][_0x5315('0x13')]===0x1f4){logger['error'](_0x5315('0x14'),_0xd4d526,_0xdda331[_0x5315('0x12')][_0x5315('0x15')]);return _0x32d65d(_0xdda331[_0x5315('0x12')][_0x5315('0x15')]);}logger[_0x5315('0x12')](_0x5315('0x14'),_0xd4d526,_0xdda331[_0x5315('0x12')]['message']);return _0xf23158(_0xdda331[_0x5315('0x12')]['message']);}else{logger[_0x5315('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xd4d526,_0x5315('0xe'));_0xf23158(_0xdda331[_0x5315('0x16')][_0x5315('0x15')]);}})[_0x5315('0x17')](function(_0x37f030){logger[_0x5315('0x12')](_0x5315('0x14'),_0xd4d526,_0x37f030);_0x32d65d(_0x37f030);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 5488163..b73025e 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 _0xdea0=['multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports'];(function(_0xee7498,_0x502cea){var _0x47a170=function(_0x1e591a){while(--_0x1e591a){_0xee7498['push'](_0xee7498['shift']());}};_0x47a170(++_0x502cea);}(_0xdea0,0xaa));var _0x0dea=function(_0x35bf27,_0x15f6e4){_0x35bf27=_0x35bf27-0x0;var _0x2c6ebb=_0xdea0[_0x35bf27];return _0x2c6ebb;};'use strict';var multer=require(_0x0dea('0x0'));var util=require(_0x0dea('0x1'));var path=require('path');var timeout=require(_0x0dea('0x2'));var express=require(_0x0dea('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0dea('0x4'));var interaction=require(_0x0dea('0x5'));var config=require('../../config/environment');var controller=require(_0x0dea('0x6'));router[_0x0dea('0x7')]('/',auth[_0x0dea('0x8')](),controller[_0x0dea('0x9')]);router[_0x0dea('0x7')](_0x0dea('0xa'),auth['isAuthenticated'](),controller[_0x0dea('0xb')]);router['post']('/',auth[_0x0dea('0x8')](),controller[_0x0dea('0xc')]);router['put'](_0x0dea('0xa'),auth[_0x0dea('0x8')](),controller[_0x0dea('0xd')]);router[_0x0dea('0xe')](_0x0dea('0xa'),auth['isAuthenticated'](),controller[_0x0dea('0xf')]);module[_0x0dea('0x10')]=router; \ No newline at end of file +var _0xe933=['delete','destroy','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','/:id','show','create','put','update'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xe933,0x1f0));var _0x3e93=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xe933[_0x599f41];return _0x2e4d58;};'use strict';var multer=require('multer');var util=require(_0x3e93('0x0'));var path=require(_0x3e93('0x1'));var timeout=require('connect-timeout');var express=require(_0x3e93('0x2'));var router=express['Router']();var fs_extra=require(_0x3e93('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3e93('0x4'));var config=require(_0x3e93('0x5'));var controller=require(_0x3e93('0x6'));router[_0x3e93('0x7')]('/',auth[_0x3e93('0x8')](),controller['index']);router['get'](_0x3e93('0x9'),auth[_0x3e93('0x8')](),controller[_0x3e93('0xa')]);router['post']('/',auth[_0x3e93('0x8')](),controller[_0x3e93('0xb')]);router[_0x3e93('0xc')](_0x3e93('0x9'),auth[_0x3e93('0x8')](),controller[_0x3e93('0xd')]);router[_0x3e93('0xe')]('/:id',auth[_0x3e93('0x8')](),controller[_0x3e93('0xf')]);module[_0x3e93('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 7a5a157..acbf0e0 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 _0x702f=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x46a0b1,_0x50ebba){var _0x3628bc=function(_0x1afb4e){while(--_0x1afb4e){_0x46a0b1['push'](_0x46a0b1['shift']());}};_0x3628bc(++_0x50ebba);}(_0x702f,0x1df));var _0xf702=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x702f[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xf702('0x0')]={'type':{'type':Sequelize[_0xf702('0x1')](_0xf702('0x2'),_0xf702('0x3'),_0xf702('0x4'),_0xf702('0x5'),_0xf702('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf702('0x7')]},'key':{'type':Sequelize[_0xf702('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xf702('0x2'),_0xf702('0x3'),_0xf702('0x4'))},'keyContent':{'type':Sequelize[_0xf702('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf702('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf702('0x7')]}}; \ No newline at end of file +var _0xb6e1=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x3a964d,_0x305ccf){var _0x536907=function(_0x493e27){while(--_0x493e27){_0x3a964d['push'](_0x3a964d['shift']());}};_0x536907(++_0x305ccf);}(_0xb6e1,0xb0));var _0x1b6e=function(_0x313be9,_0x1de21d){_0x313be9=_0x313be9-0x0;var _0x2ebcd2=_0xb6e1[_0x313be9];return _0x2ebcd2;};'use strict';var Sequelize=require(_0x1b6e('0x0'));module[_0x1b6e('0x1')]={'type':{'type':Sequelize[_0x1b6e('0x2')](_0x1b6e('0x3'),_0x1b6e('0x4'),_0x1b6e('0x5'),_0x1b6e('0x6'),_0x1b6e('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1b6e('0x8')]},'key':{'type':Sequelize[_0x1b6e('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x1b6e('0x3'),_0x1b6e('0x4'),_0x1b6e('0x5'))},'keyContent':{'type':Sequelize[_0x1b6e('0x8')]},'idField':{'type':Sequelize[_0x1b6e('0x8')]},'nameField':{'type':Sequelize[_0x1b6e('0x8')]},'customField':{'type':Sequelize[_0x1b6e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1b6e('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index e63eef2..45415a1 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 _0xcb91=['fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','FreshdeskField','includeAll','rows','catch','params','include','merge','options','create','body','find','zip-dir'];(function(_0x3c9950,_0x3a805a){var _0x4203ff=function(_0x415098){while(--_0x415098){_0x3c9950['push'](_0x3c9950['shift']());}};_0x4203ff(++_0x3a805a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x269ee8,_0x477226){_0x269ee8=_0x269ee8-0x0;var _0x4d98bd=_0xcb91[_0x269ee8];return _0x4d98bd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}exports[_0x1cb9('0x28')]=function(_0xb644b3,_0x41e5c2){var _0x9de64b={},_0x48888d={},_0x405a2f={'count':0x0,'rows':[]};var _0x536635=_[_0x1cb9('0x29')](db['FreshdeskField'][_0x1cb9('0x2a')],function(_0x41011c){return{'name':_0x41011c[_0x1cb9('0x2b')],'type':_0x41011c[_0x1cb9('0x2c')]['key']};});_0x48888d[_0x1cb9('0x2d')]=_['map'](_0x536635,_0x1cb9('0x26'));_0x48888d[_0x1cb9('0x2e')]=_[_0x1cb9('0x2f')](_0xb644b3['query']);_0x48888d[_0x1cb9('0x30')]=_['intersection'](_0x48888d[_0x1cb9('0x2d')],_0x48888d['query']);_0x9de64b[_0x1cb9('0x31')]=_[_0x1cb9('0x32')](_0x48888d[_0x1cb9('0x2d')],qs[_0x1cb9('0x33')](_0xb644b3['query'][_0x1cb9('0x33')]));_0x9de64b[_0x1cb9('0x31')]=_0x9de64b[_0x1cb9('0x31')][_0x1cb9('0x34')]?_0x9de64b[_0x1cb9('0x31')]:_0x48888d[_0x1cb9('0x2d')];if(!_0xb644b3[_0x1cb9('0x2e')][_0x1cb9('0x35')](_0x1cb9('0x36'))){_0x9de64b[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0xb644b3[_0x1cb9('0x2e')][_0x1cb9('0x1c')]);_0x9de64b['offset']=qs['offset'](_0xb644b3[_0x1cb9('0x2e')][_0x1cb9('0x1a')]);}_0x9de64b[_0x1cb9('0x37')]=qs[_0x1cb9('0x38')](_0xb644b3[_0x1cb9('0x2e')][_0x1cb9('0x38')]);_0x9de64b[_0x1cb9('0x39')]=qs[_0x1cb9('0x30')](_['pick'](_0xb644b3[_0x1cb9('0x2e')],_0x48888d[_0x1cb9('0x30')]),_0x536635);if(_0xb644b3[_0x1cb9('0x2e')]['filter']){_0x9de64b[_0x1cb9('0x39')]=_['merge'](_0x9de64b[_0x1cb9('0x39')],{'$or':_['map'](_0x536635,function(_0x2a73f2){if(_0x2a73f2[_0x1cb9('0x2c')]!==_0x1cb9('0x3a')){var _0x2bcacd={};_0x2bcacd[_0x2a73f2[_0x1cb9('0x26')]]={'$like':'%'+_0xb644b3[_0x1cb9('0x2e')][_0x1cb9('0x3b')]+'%'};return _0x2bcacd;}})});}_0x9de64b=_['merge']({},_0x9de64b,_0xb644b3['options']);var _0x4111b8={'where':_0x9de64b[_0x1cb9('0x39')]};return db[_0x1cb9('0x3c')][_0x1cb9('0x1d')](_0x4111b8)[_0x1cb9('0x22')](function(_0x1d7304){_0x405a2f[_0x1cb9('0x1d')]=_0x1d7304;if(_0xb644b3['query'][_0x1cb9('0x3d')]){_0x9de64b['include']=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x9de64b);})[_0x1cb9('0x22')](function(_0x397ff9){_0x405a2f[_0x1cb9('0x3e')]=_0x397ff9;return _0x405a2f;})[_0x1cb9('0x22')](respondWithFilteredResult(_0x41e5c2,_0x9de64b))[_0x1cb9('0x3f')](handleError(_0x41e5c2,null));};exports['show']=function(_0x2a624f,_0x523866){var _0x91121={'raw':!![],'where':{'id':_0x2a624f[_0x1cb9('0x40')]['id']}},_0x71db9d={};_0x71db9d['model']=_[_0x1cb9('0x2f')](db['FreshdeskField'][_0x1cb9('0x2a')]);_0x71db9d[_0x1cb9('0x2e')]=_['keys'](_0x2a624f['query']);_0x71db9d[_0x1cb9('0x30')]=_[_0x1cb9('0x32')](_0x71db9d[_0x1cb9('0x2d')],_0x71db9d[_0x1cb9('0x2e')]);_0x91121[_0x1cb9('0x31')]=_['intersection'](_0x71db9d[_0x1cb9('0x2d')],qs['fields'](_0x2a624f['query']['fields']));_0x91121[_0x1cb9('0x31')]=_0x91121[_0x1cb9('0x31')][_0x1cb9('0x34')]?_0x91121[_0x1cb9('0x31')]:_0x71db9d[_0x1cb9('0x2d')];if(_0x2a624f[_0x1cb9('0x2e')][_0x1cb9('0x3d')]){_0x91121[_0x1cb9('0x41')]=[{'all':!![]}];}_0x91121=_[_0x1cb9('0x42')]({},_0x91121,_0x2a624f[_0x1cb9('0x43')]);return db[_0x1cb9('0x3c')]['find'](_0x91121)[_0x1cb9('0x22')](handleEntityNotFound(_0x523866,null))[_0x1cb9('0x22')](respondWithResult(_0x523866,null))[_0x1cb9('0x3f')](handleError(_0x523866,null));};exports['create']=function(_0x179e81,_0x57251){return db[_0x1cb9('0x3c')][_0x1cb9('0x44')](_0x179e81[_0x1cb9('0x45')],{})['then'](respondWithResult(_0x57251,0xc9))[_0x1cb9('0x3f')](handleError(_0x57251,null));};exports['update']=function(_0x2eaa11,_0x4ac483){if(_0x2eaa11[_0x1cb9('0x45')]['id']){delete _0x2eaa11[_0x1cb9('0x45')]['id'];}return db[_0x1cb9('0x3c')][_0x1cb9('0x46')]({'where':{'id':_0x2eaa11['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x4ac483,null))[_0x1cb9('0x22')](saveUpdates(_0x2eaa11[_0x1cb9('0x45')],null))[_0x1cb9('0x22')](respondWithResult(_0x4ac483,null))[_0x1cb9('0x3f')](handleError(_0x4ac483,null));};exports[_0x1cb9('0x23')]=function(_0x17b92a,_0x3b6a92){return db[_0x1cb9('0x3c')][_0x1cb9('0x46')]({'where':{'id':_0x17b92a['params']['id']}})['then'](handleEntityNotFound(_0x3b6a92,null))[_0x1cb9('0x22')](removeEntity(_0x3b6a92,null))[_0x1cb9('0x3f')](handleError(_0x3b6a92,null));}; \ No newline at end of file +var _0x6b24=['rawAttributes','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','options','includeAll','findAll','rows','catch','include','merge','find','create','body','destroy','params','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','FreshdeskField'];(function(_0x1e80ae,_0x3b5129){var _0x369354=function(_0x41141a){while(--_0x41141a){_0x1e80ae['push'](_0x1e80ae['shift']());}};_0x369354(++_0x3b5129);}(_0x6b24,0x1ce));var _0x46b2=function(_0x1abeb2,_0x79f462){_0x1abeb2=_0x1abeb2-0x0;var _0x48da20=_0x6b24[_0x1abeb2];return _0x48da20;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x46b2('0x0'));var zipdir=require(_0x46b2('0x1'));var jsonpatch=require(_0x46b2('0x2'));var rp=require(_0x46b2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x46b2('0x4'));var path=require('path');var sox=require(_0x46b2('0x5'));var csv=require('to-csv');var ejs=require(_0x46b2('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x46b2('0x7'));var crypto=require(_0x46b2('0x8'));var jsforce=require(_0x46b2('0x9'));var deskjs=require(_0x46b2('0xa'));var toCsv=require(_0x46b2('0xb'));var querystring=require(_0x46b2('0xc'));var Papa=require(_0x46b2('0xd'));var Redis=require(_0x46b2('0xe'));var authService=require(_0x46b2('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x46b2('0x10'));var logger=require(_0x46b2('0x11'))(_0x46b2('0x12'));var utils=require('../../config/utils');var config=require(_0x46b2('0x13'));var licenseUtil=require(_0x46b2('0x14'));var db=require(_0x46b2('0x15'))['db'];function respondWithStatusCode(_0x5343fc,_0x468ae9){_0x468ae9=_0x468ae9||0xcc;return function(_0x886e41){if(_0x886e41){return _0x5343fc[_0x46b2('0x16')](_0x468ae9);}return _0x5343fc[_0x46b2('0x17')](_0x468ae9)[_0x46b2('0x18')]();};}function respondWithResult(_0x1cf0f0,_0x3ff25d){_0x3ff25d=_0x3ff25d||0xc8;return function(_0x228261){if(_0x228261){return _0x1cf0f0[_0x46b2('0x17')](_0x3ff25d)[_0x46b2('0x19')](_0x228261);}};}function respondWithFilteredResult(_0x563b05,_0x43e0d9){return function(_0x5b49da){if(_0x5b49da){var _0x49479c=typeof _0x43e0d9[_0x46b2('0x1a')]===_0x46b2('0x1b')&&typeof _0x43e0d9[_0x46b2('0x1c')]===_0x46b2('0x1b');var _0x373c49=_0x5b49da[_0x46b2('0x1d')];var _0x226ab5=_0x49479c?0x0:_0x43e0d9['offset'];var _0x316c39=_0x49479c?_0x5b49da['count']:_0x43e0d9[_0x46b2('0x1a')]+_0x43e0d9[_0x46b2('0x1c')];var _0x9b4723;if(_0x316c39>=_0x373c49){_0x316c39=_0x373c49;_0x9b4723=0xc8;}else{_0x9b4723=0xce;}_0x563b05['status'](_0x9b4723);return _0x563b05[_0x46b2('0x1e')](_0x46b2('0x1f'),_0x226ab5+'-'+_0x316c39+'/'+_0x373c49)[_0x46b2('0x19')](_0x5b49da);}return null;};}function patchUpdates(_0x1e5c35){return function(_0x350f85){try{jsonpatch[_0x46b2('0x20')](_0x350f85,_0x1e5c35,!![]);}catch(_0x3a0ea5){return BPromise[_0x46b2('0x21')](_0x3a0ea5);}return _0x350f85[_0x46b2('0x22')]();};}function saveUpdates(_0x259f2f,_0x29ade9){return function(_0x1b5fbe){if(_0x1b5fbe){return _0x1b5fbe[_0x46b2('0x23')](_0x259f2f)[_0x46b2('0x24')](function(_0x1caa77){return _0x1caa77;});}return null;};}function removeEntity(_0x50011b,_0x209519){return function(_0x4c2983){if(_0x4c2983){return _0x4c2983['destroy']()[_0x46b2('0x24')](function(){_0x50011b[_0x46b2('0x17')](0xcc)[_0x46b2('0x18')]();});}};}function handleEntityNotFound(_0x134526,_0x16f646){return function(_0x58069e){if(!_0x58069e){_0x134526[_0x46b2('0x16')](0x194);}return _0x58069e;};}function handleError(_0x138f6c,_0x5ca1c7){_0x5ca1c7=_0x5ca1c7||0x1f4;return function(_0x3c5997){logger['error'](_0x3c5997[_0x46b2('0x25')]);if(_0x3c5997[_0x46b2('0x26')]){delete _0x3c5997[_0x46b2('0x26')];}_0x138f6c[_0x46b2('0x17')](_0x5ca1c7)[_0x46b2('0x27')](_0x3c5997);};}exports[_0x46b2('0x28')]=function(_0x74615,_0x1a6caf){var _0x429496={},_0x20ccb2={},_0x5421d9={'count':0x0,'rows':[]};var _0x4e2a9b=_['map'](db[_0x46b2('0x29')][_0x46b2('0x2a')],function(_0x2a2f8d){return{'name':_0x2a2f8d['fieldName'],'type':_0x2a2f8d[_0x46b2('0x2b')][_0x46b2('0x2c')]};});_0x20ccb2['model']=_[_0x46b2('0x2d')](_0x4e2a9b,_0x46b2('0x26'));_0x20ccb2[_0x46b2('0x2e')]=_[_0x46b2('0x2f')](_0x74615[_0x46b2('0x2e')]);_0x20ccb2[_0x46b2('0x30')]=_[_0x46b2('0x31')](_0x20ccb2[_0x46b2('0x32')],_0x20ccb2[_0x46b2('0x2e')]);_0x429496['attributes']=_[_0x46b2('0x31')](_0x20ccb2[_0x46b2('0x32')],qs[_0x46b2('0x33')](_0x74615['query'][_0x46b2('0x33')]));_0x429496[_0x46b2('0x34')]=_0x429496[_0x46b2('0x34')][_0x46b2('0x35')]?_0x429496['attributes']:_0x20ccb2[_0x46b2('0x32')];if(!_0x74615['query'][_0x46b2('0x36')](_0x46b2('0x37'))){_0x429496[_0x46b2('0x1c')]=qs[_0x46b2('0x1c')](_0x74615[_0x46b2('0x2e')][_0x46b2('0x1c')]);_0x429496[_0x46b2('0x1a')]=qs['offset'](_0x74615[_0x46b2('0x2e')][_0x46b2('0x1a')]);}_0x429496[_0x46b2('0x38')]=qs[_0x46b2('0x39')](_0x74615[_0x46b2('0x2e')][_0x46b2('0x39')]);_0x429496[_0x46b2('0x3a')]=qs['filters'](_['pick'](_0x74615['query'],_0x20ccb2[_0x46b2('0x30')]),_0x4e2a9b);if(_0x74615[_0x46b2('0x2e')]['filter']){_0x429496[_0x46b2('0x3a')]=_['merge'](_0x429496['where'],{'$or':_[_0x46b2('0x2d')](_0x4e2a9b,function(_0x1716a3){if(_0x1716a3[_0x46b2('0x2b')]!==_0x46b2('0x3b')){var _0x4dcd03={};_0x4dcd03[_0x1716a3[_0x46b2('0x26')]]={'$like':'%'+_0x74615['query']['filter']+'%'};return _0x4dcd03;}})});}_0x429496=_['merge']({},_0x429496,_0x74615[_0x46b2('0x3c')]);var _0x1599fa={'where':_0x429496[_0x46b2('0x3a')]};return db['FreshdeskField'][_0x46b2('0x1d')](_0x1599fa)['then'](function(_0x30afdb){_0x5421d9[_0x46b2('0x1d')]=_0x30afdb;if(_0x74615['query'][_0x46b2('0x3d')]){_0x429496['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x46b2('0x3e')](_0x429496);})['then'](function(_0x22c896){_0x5421d9[_0x46b2('0x3f')]=_0x22c896;return _0x5421d9;})[_0x46b2('0x24')](respondWithFilteredResult(_0x1a6caf,_0x429496))[_0x46b2('0x40')](handleError(_0x1a6caf,null));};exports['show']=function(_0x15451a,_0x13343e){var _0x205027={'raw':!![],'where':{'id':_0x15451a['params']['id']}},_0x4fdfeb={};_0x4fdfeb[_0x46b2('0x32')]=_[_0x46b2('0x2f')](db[_0x46b2('0x29')][_0x46b2('0x2a')]);_0x4fdfeb['query']=_['keys'](_0x15451a[_0x46b2('0x2e')]);_0x4fdfeb[_0x46b2('0x30')]=_[_0x46b2('0x31')](_0x4fdfeb[_0x46b2('0x32')],_0x4fdfeb[_0x46b2('0x2e')]);_0x205027[_0x46b2('0x34')]=_['intersection'](_0x4fdfeb['model'],qs[_0x46b2('0x33')](_0x15451a[_0x46b2('0x2e')][_0x46b2('0x33')]));_0x205027[_0x46b2('0x34')]=_0x205027['attributes'][_0x46b2('0x35')]?_0x205027[_0x46b2('0x34')]:_0x4fdfeb[_0x46b2('0x32')];if(_0x15451a[_0x46b2('0x2e')]['includeAll']){_0x205027[_0x46b2('0x41')]=[{'all':!![]}];}_0x205027=_[_0x46b2('0x42')]({},_0x205027,_0x15451a[_0x46b2('0x3c')]);return db[_0x46b2('0x29')][_0x46b2('0x43')](_0x205027)[_0x46b2('0x24')](handleEntityNotFound(_0x13343e,null))[_0x46b2('0x24')](respondWithResult(_0x13343e,null))['catch'](handleError(_0x13343e,null));};exports[_0x46b2('0x44')]=function(_0x14cdc9,_0x55c0aa){return db[_0x46b2('0x29')]['create'](_0x14cdc9[_0x46b2('0x45')],{})['then'](respondWithResult(_0x55c0aa,0xc9))[_0x46b2('0x40')](handleError(_0x55c0aa,null));};exports[_0x46b2('0x23')]=function(_0x4f8bd6,_0x301c64){if(_0x4f8bd6[_0x46b2('0x45')]['id']){delete _0x4f8bd6['body']['id'];}return db['FreshdeskField'][_0x46b2('0x43')]({'where':{'id':_0x4f8bd6['params']['id']}})[_0x46b2('0x24')](handleEntityNotFound(_0x301c64,null))['then'](saveUpdates(_0x4f8bd6[_0x46b2('0x45')],null))[_0x46b2('0x24')](respondWithResult(_0x301c64,null))[_0x46b2('0x40')](handleError(_0x301c64,null));};exports[_0x46b2('0x46')]=function(_0x27a9cf,_0x251c28){return db[_0x46b2('0x29')][_0x46b2('0x43')]({'where':{'id':_0x27a9cf[_0x46b2('0x47')]['id']}})[_0x46b2('0x24')](handleEntityNotFound(_0x251c28,null))[_0x46b2('0x24')](removeEntity(_0x251c28,null))[_0x46b2('0x40')](handleError(_0x251c28,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 3efc04b..98d8b32 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 _0xa554=['FieldId','lodash','../../config/logger','api','bluebird','request-promise','rimraf','./intFreshdeskField.attributes','define','int_freshdesk_fields','freshdesk_unique_index','idField'];(function(_0x49dc5e,_0x45732a){var _0x23d47f=function(_0x542789){while(--_0x542789){_0x49dc5e['push'](_0x49dc5e['shift']());}};_0x23d47f(++_0x45732a);}(_0xa554,0x12d));var _0x4a55=function(_0x1cebde,_0x233efa){_0x1cebde=_0x1cebde-0x0;var _0x5edbba=_0xa554[_0x1cebde];return _0x5edbba;};'use strict';var _=require(_0x4a55('0x0'));var util=require('util');var logger=require(_0x4a55('0x1'))(_0x4a55('0x2'));var moment=require('moment');var BPromise=require(_0x4a55('0x3'));var rp=require(_0x4a55('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4a55('0x5'));var config=require('../../config/environment');var attributes=require(_0x4a55('0x6'));module['exports']=function(_0x5eb575,_0x1c63bf){return _0x5eb575[_0x4a55('0x7')]('FreshdeskField',attributes,{'tableName':_0x4a55('0x8'),'paranoid':![],'indexes':[{'name':_0x4a55('0x9'),'fields':[_0x4a55('0xa'),_0x4a55('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9dbc=['lodash','util','api','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId'];(function(_0x1790bf,_0x53ee06){var _0x36e244=function(_0x3d37a0){while(--_0x3d37a0){_0x1790bf['push'](_0x1790bf['shift']());}};_0x36e244(++_0x53ee06);}(_0x9dbc,0x15e));var _0xc9db=function(_0x589fee,_0x358efb){_0x589fee=_0x589fee-0x0;var _0x2f8f27=_0x9dbc[_0x589fee];return _0x2f8f27;};'use strict';var _=require(_0xc9db('0x0'));var util=require(_0xc9db('0x1'));var logger=require('../../config/logger')(_0xc9db('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc9db('0x3'));var fs=require('fs');var path=require(_0xc9db('0x4'));var rimraf=require(_0xc9db('0x5'));var config=require(_0xc9db('0x6'));var attributes=require(_0xc9db('0x7'));module[_0xc9db('0x8')]=function(_0x29087b,_0x5ac03e){return _0x29087b[_0xc9db('0x9')](_0xc9db('0xa'),attributes,{'tableName':_0xc9db('0xb'),'paranoid':![],'indexes':[{'name':_0xc9db('0xc'),'fields':['idField',_0xc9db('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 2a9a412..fc91bbb 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 _0x71f5=['FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x3e25d9,_0x488174){var _0x9fa4d7=function(_0x58087e){while(--_0x58087e){_0x3e25d9['push'](_0x3e25d9['shift']());}};_0x9fa4d7(++_0x488174);}(_0x71f5,0x163));var _0x571f=function(_0x192099,_0x38a593){_0x192099=_0x192099-0x0;var _0x3d6ccc=_0x71f5[_0x192099];return _0x3d6ccc;};'use strict';var _=require(_0x571f('0x0'));var util=require(_0x571f('0x1'));var moment=require(_0x571f('0x2'));var BPromise=require(_0x571f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x571f('0x4'));var db=require(_0x571f('0x5'))['db'];var utils=require(_0x571f('0x6'));var logger=require('../../config/logger')(_0x571f('0x7'));var config=require(_0x571f('0x8'));var jayson=require(_0x571f('0x9'));var client=jayson['client'][_0x571f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x196742,_0x584681,_0x9cd32e){return new BPromise(function(_0x6b5d51,_0x56ccbd){return client[_0x571f('0xb')](_0x196742,_0x9cd32e)[_0x571f('0xc')](function(_0x268ed9){logger['info'](_0x571f('0xd'),_0x584681,'request\x20sent');logger[_0x571f('0xe')](_0x571f('0xf'),_0x584681,_0x571f('0x10'),JSON['stringify'](_0x268ed9));if(_0x268ed9[_0x571f('0x11')]){if(_0x268ed9[_0x571f('0x11')][_0x571f('0x12')]===0x1f4){logger[_0x571f('0x11')](_0x571f('0xd'),_0x584681,_0x268ed9[_0x571f('0x11')]['message']);return _0x56ccbd(_0x268ed9[_0x571f('0x11')][_0x571f('0x13')]);}logger[_0x571f('0x11')](_0x571f('0xd'),_0x584681,_0x268ed9[_0x571f('0x11')]['message']);return _0x6b5d51(_0x268ed9[_0x571f('0x11')][_0x571f('0x13')]);}else{logger[_0x571f('0x14')]('FreshdeskField,\x20%s,\x20%s',_0x584681,_0x571f('0x10'));_0x6b5d51(_0x268ed9[_0x571f('0x15')][_0x571f('0x13')]);}})[_0x571f('0x16')](function(_0x2637fa){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x584681,_0x2637fa);_0x56ccbd(_0x2637fa);});});} \ No newline at end of file +var _0x2d52=['catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x219d87,_0x1cb6f7){var _0x22823d=function(_0x5357bf){while(--_0x5357bf){_0x219d87['push'](_0x219d87['shift']());}};_0x22823d(++_0x1cb6f7);}(_0x2d52,0xdd));var _0x22d5=function(_0x39fff0,_0x259d98){_0x39fff0=_0x39fff0-0x0;var _0x547163=_0x2d52[_0x39fff0];return _0x547163;};'use strict';var _=require(_0x22d5('0x0'));var util=require(_0x22d5('0x1'));var moment=require(_0x22d5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22d5('0x3'));var db=require(_0x22d5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x22d5('0x5'))(_0x22d5('0x6'));var config=require(_0x22d5('0x7'));var jayson=require(_0x22d5('0x8'));var client=jayson[_0x22d5('0x9')][_0x22d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46d8be,_0x56c7e2,_0x49aaab){return new BPromise(function(_0x119ac2,_0x4e3b59){return client['request'](_0x46d8be,_0x49aaab)[_0x22d5('0xb')](function(_0x28b1f5){logger['info'](_0x22d5('0xc'),_0x56c7e2,_0x22d5('0xd'));logger[_0x22d5('0xe')](_0x22d5('0xf'),_0x56c7e2,_0x22d5('0xd'),JSON[_0x22d5('0x10')](_0x28b1f5));if(_0x28b1f5[_0x22d5('0x11')]){if(_0x28b1f5[_0x22d5('0x11')][_0x22d5('0x12')]===0x1f4){logger['error'](_0x22d5('0xc'),_0x56c7e2,_0x28b1f5[_0x22d5('0x11')][_0x22d5('0x13')]);return _0x4e3b59(_0x28b1f5[_0x22d5('0x11')][_0x22d5('0x13')]);}logger[_0x22d5('0x11')](_0x22d5('0xc'),_0x56c7e2,_0x28b1f5[_0x22d5('0x11')][_0x22d5('0x13')]);return _0x119ac2(_0x28b1f5[_0x22d5('0x11')]['message']);}else{logger['info'](_0x22d5('0xc'),_0x56c7e2,_0x22d5('0xd'));_0x119ac2(_0x28b1f5[_0x22d5('0x14')][_0x22d5('0x13')]);}})[_0x22d5('0x15')](function(_0x26b004){logger['error'](_0x22d5('0xc'),_0x56c7e2,_0x26b004);_0x4e3b59(_0x26b004);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index ffed054..32626d8 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 _0xa478=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','getConfigurations','getFields','post','/:id/configurations','update'];(function(_0x3a39a1,_0x66e0fb){var _0x2471b4=function(_0x597d1e){while(--_0x597d1e){_0x3a39a1['push'](_0x3a39a1['shift']());}};_0x2471b4(++_0x66e0fb);}(_0xa478,0x136));var _0x8a47=function(_0x5b5eb4,_0x117c87){_0x5b5eb4=_0x5b5eb4-0x0;var _0x42af53=_0xa478[_0x5b5eb4];return _0x42af53;};'use strict';var multer=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var path=require(_0x8a47('0x2'));var timeout=require(_0x8a47('0x3'));var express=require(_0x8a47('0x4'));var router=express[_0x8a47('0x5')]();var fs_extra=require(_0x8a47('0x6'));var auth=require(_0x8a47('0x7'));var interaction=require(_0x8a47('0x8'));var config=require(_0x8a47('0x9'));var controller=require(_0x8a47('0xa'));router[_0x8a47('0xb')]('/',auth['isAuthenticated'](),controller[_0x8a47('0xc')]);router[_0x8a47('0xb')](_0x8a47('0xd'),auth[_0x8a47('0xe')](),controller['show']);router[_0x8a47('0xb')]('/:id/configurations',auth[_0x8a47('0xe')](),controller[_0x8a47('0xf')]);router[_0x8a47('0xb')]('/:id/fields',auth[_0x8a47('0xe')](),controller[_0x8a47('0x10')]);router['post']('/',auth[_0x8a47('0xe')](),controller['create']);router[_0x8a47('0x11')](_0x8a47('0x12'),auth[_0x8a47('0xe')](),controller['addConfiguration']);router['put']('/:id',auth[_0x8a47('0xe')](),controller[_0x8a47('0x13')]);router['delete'](_0x8a47('0xd'),auth[_0x8a47('0xe')](),controller[_0x8a47('0x14')]);module[_0x8a47('0x15')]=router; \ No newline at end of file +var _0x1be1=['getFields','post','create','addConfiguration','/:id','delete','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','show','/:id/configurations','/:id/fields'];(function(_0xfeb52e,_0x505b63){var _0x541770=function(_0x4ac61a){while(--_0x4ac61a){_0xfeb52e['push'](_0xfeb52e['shift']());}};_0x541770(++_0x505b63);}(_0x1be1,0x192));var _0x11be=function(_0x24b10f,_0x3ec7e3){_0x24b10f=_0x24b10f-0x0;var _0x2ca927=_0x1be1[_0x24b10f];return _0x2ca927;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var fs_extra=require(_0x11be('0x3'));var auth=require(_0x11be('0x4'));var interaction=require(_0x11be('0x5'));var config=require('../../config/environment');var controller=require(_0x11be('0x6'));router[_0x11be('0x7')]('/',auth[_0x11be('0x8')](),controller['index']);router[_0x11be('0x7')]('/:id',auth[_0x11be('0x8')](),controller[_0x11be('0x9')]);router[_0x11be('0x7')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller['getConfigurations']);router[_0x11be('0x7')](_0x11be('0xb'),auth['isAuthenticated'](),controller[_0x11be('0xc')]);router[_0x11be('0xd')]('/',auth[_0x11be('0x8')](),controller[_0x11be('0xe')]);router['post'](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xf')]);router['put'](_0x11be('0x10'),auth[_0x11be('0x8')](),controller['update']);router[_0x11be('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 9208b5d..b8e93f7 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 _0x2a07=['sequelize','exports','STRING','remoteUri'];(function(_0xa16cc0,_0x217e43){var _0x5b7c04=function(_0xb3e2eb){while(--_0xb3e2eb){_0xa16cc0['push'](_0xa16cc0['shift']());}};_0x5b7c04(++_0x217e43);}(_0x2a07,0x74));var _0x72a0=function(_0x104b35,_0x13f218){_0x104b35=_0x104b35-0x0;var _0x55584d=_0x2a07[_0x104b35];return _0x55584d;};'use strict';var Sequelize=require(_0x72a0('0x0'));module[_0x72a0('0x1')]={'name':{'type':Sequelize[_0x72a0('0x2')]},'description':{'type':Sequelize[_0x72a0('0x2')]},'username':{'type':Sequelize[_0x72a0('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x72a0('0x2')]},'remoteUri':{'type':Sequelize[_0x72a0('0x2')],'unique':_0x72a0('0x3')},'serverUrl':{'type':Sequelize[_0x72a0('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xc2c7=['exports','STRING','username','remoteUri'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xc2c7,0x134));var _0x7c2c=function(_0x441d68,_0x5639e6){_0x441d68=_0x441d68-0x0;var _0x5489e0=_0xc2c7[_0x441d68];return _0x5489e0;};'use strict';var Sequelize=require('sequelize');module[_0x7c2c('0x0')]={'name':{'type':Sequelize[_0x7c2c('0x1')]},'description':{'type':Sequelize[_0x7c2c('0x1')]},'username':{'type':Sequelize[_0x7c2c('0x1')],'unique':_0x7c2c('0x2')},'apiKey':{'type':Sequelize[_0x7c2c('0x1')]},'remoteUri':{'type':Sequelize[_0x7c2c('0x1')],'unique':_0x7c2c('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index bed8319..77c1eeb 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 _0x7c29=['AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','type','FreshsalesField','getFields','username','apiKey','remoteUri','slice','substring','lastIndexOf','GET','%s%s','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','getConfigurations','FreshsalesConfiguration','fields','hasOwnProperty','addConfiguration','findOne'];(function(_0x22b991,_0x54c8d6){var _0x23ecb7=function(_0x171172){while(--_0x171172){_0x22b991['push'](_0x22b991['shift']());}};_0x23ecb7(++_0x54c8d6);}(_0x7c29,0x1c5));var _0x97c2=function(_0x23b8bb,_0x44a2a8){_0x23b8bb=_0x23b8bb-0x0;var _0x2ad659=_0x7c29[_0x23b8bb];return _0x2ad659;};'use strict';var emlformat=require(_0x97c2('0x0'));var rimraf=require(_0x97c2('0x1'));var zipdir=require(_0x97c2('0x2'));var jsonpatch=require(_0x97c2('0x3'));var rp=require(_0x97c2('0x4'));var moment=require(_0x97c2('0x5'));var BPromise=require(_0x97c2('0x6'));var Mustache=require('mustache');var util=require(_0x97c2('0x7'));var path=require(_0x97c2('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97c2('0x9'));var _=require(_0x97c2('0xa'));var squel=require(_0x97c2('0xb'));var crypto=require(_0x97c2('0xc'));var jsforce=require(_0x97c2('0xd'));var deskjs=require(_0x97c2('0xe'));var toCsv=require(_0x97c2('0xf'));var querystring=require('querystring');var Papa=require(_0x97c2('0x10'));var Redis=require('ioredis');var authService=require(_0x97c2('0x11'));var qs=require(_0x97c2('0x12'));var as=require(_0x97c2('0x13'));var hardwareService=require(_0x97c2('0x14'));var logger=require('../../config/logger')(_0x97c2('0x15'));var utils=require(_0x97c2('0x16'));var config=require(_0x97c2('0x17'));var licenseUtil=require(_0x97c2('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3f2ff0,_0x7b56b1){_0x7b56b1=_0x7b56b1||0xcc;return function(_0x1bb9d6){if(_0x1bb9d6){return _0x3f2ff0[_0x97c2('0x19')](_0x7b56b1);}return _0x3f2ff0['status'](_0x7b56b1)['end']();};}function respondWithResult(_0x2bd034,_0x5e7721){_0x5e7721=_0x5e7721||0xc8;return function(_0x4106e8){if(_0x4106e8){return _0x2bd034[_0x97c2('0x1a')](_0x5e7721)[_0x97c2('0x1b')](_0x4106e8);}};}function respondWithFilteredResult(_0x1f0899,_0x3438e3){return function(_0x349d0a){if(_0x349d0a){var _0x93f838=typeof _0x3438e3[_0x97c2('0x1c')]==='undefined'&&typeof _0x3438e3['limit']===_0x97c2('0x1d');var _0x32ce30=_0x349d0a[_0x97c2('0x1e')];var _0x5b8887=_0x93f838?0x0:_0x3438e3[_0x97c2('0x1c')];var _0x159d91=_0x93f838?_0x349d0a['count']:_0x3438e3['offset']+_0x3438e3[_0x97c2('0x1f')];var _0xbc76f5;if(_0x159d91>=_0x32ce30){_0x159d91=_0x32ce30;_0xbc76f5=0xc8;}else{_0xbc76f5=0xce;}_0x1f0899[_0x97c2('0x1a')](_0xbc76f5);return _0x1f0899[_0x97c2('0x20')](_0x97c2('0x21'),_0x5b8887+'-'+_0x159d91+'/'+_0x32ce30)[_0x97c2('0x1b')](_0x349d0a);}return null;};}function patchUpdates(_0x181d89){return function(_0x14c2ca){try{jsonpatch[_0x97c2('0x22')](_0x14c2ca,_0x181d89,!![]);}catch(_0xf63e00){return BPromise[_0x97c2('0x23')](_0xf63e00);}return _0x14c2ca['save']();};}function saveUpdates(_0x5787b3,_0x2097d6){return function(_0x5bcfa2){if(_0x5bcfa2){return _0x5bcfa2[_0x97c2('0x24')](_0x5787b3)['then'](function(_0x411401){return _0x411401;});}return null;};}function removeEntity(_0x203d26,_0x46dc26){return function(_0x34660e){if(_0x34660e){return _0x34660e[_0x97c2('0x25')]()[_0x97c2('0x26')](function(){_0x203d26['status'](0xcc)[_0x97c2('0x27')]();});}};}function handleEntityNotFound(_0x3626d6,_0x438dce){return function(_0x47c594){if(!_0x47c594){_0x3626d6['sendStatus'](0x194);}return _0x47c594;};}function handleError(_0xdddcc2,_0x45fb27){_0x45fb27=_0x45fb27||0x1f4;return function(_0x408b83){logger[_0x97c2('0x28')](_0x408b83[_0x97c2('0x29')]);if(_0x408b83[_0x97c2('0x2a')]){delete _0x408b83[_0x97c2('0x2a')];}_0xdddcc2[_0x97c2('0x1a')](_0x45fb27)[_0x97c2('0x2b')](_0x408b83);};}exports[_0x97c2('0x2c')]=function(_0x2df8a5,_0x49fdda){var _0x1cc1cb={},_0x32b26d={},_0x359fe4={'count':0x0,'rows':[]};var _0x4db3fb=_[_0x97c2('0x2d')](db[_0x97c2('0x2e')][_0x97c2('0x2f')],function(_0x8dc179){return{'name':_0x8dc179[_0x97c2('0x30')],'type':_0x8dc179['type'][_0x97c2('0x31')]};});_0x32b26d[_0x97c2('0x32')]=_[_0x97c2('0x2d')](_0x4db3fb,_0x97c2('0x2a'));_0x32b26d[_0x97c2('0x33')]=_[_0x97c2('0x34')](_0x2df8a5[_0x97c2('0x33')]);_0x32b26d[_0x97c2('0x35')]=_[_0x97c2('0x36')](_0x32b26d[_0x97c2('0x32')],_0x32b26d[_0x97c2('0x33')]);_0x1cc1cb[_0x97c2('0x37')]=_[_0x97c2('0x36')](_0x32b26d[_0x97c2('0x32')],qs['fields'](_0x2df8a5[_0x97c2('0x33')]['fields']));_0x1cc1cb[_0x97c2('0x37')]=_0x1cc1cb['attributes'][_0x97c2('0x38')]?_0x1cc1cb['attributes']:_0x32b26d[_0x97c2('0x32')];if(!_0x2df8a5[_0x97c2('0x33')]['hasOwnProperty'](_0x97c2('0x39'))){_0x1cc1cb['limit']=qs[_0x97c2('0x1f')](_0x2df8a5[_0x97c2('0x33')][_0x97c2('0x1f')]);_0x1cc1cb[_0x97c2('0x1c')]=qs[_0x97c2('0x1c')](_0x2df8a5['query'][_0x97c2('0x1c')]);}_0x1cc1cb[_0x97c2('0x3a')]=qs[_0x97c2('0x3b')](_0x2df8a5[_0x97c2('0x33')][_0x97c2('0x3b')]);_0x1cc1cb[_0x97c2('0x3c')]=qs[_0x97c2('0x35')](_[_0x97c2('0x3d')](_0x2df8a5[_0x97c2('0x33')],_0x32b26d['filters']),_0x4db3fb);if(_0x2df8a5[_0x97c2('0x33')][_0x97c2('0x3e')]){_0x1cc1cb[_0x97c2('0x3c')]=_[_0x97c2('0x3f')](_0x1cc1cb[_0x97c2('0x3c')],{'$or':_[_0x97c2('0x2d')](_0x4db3fb,function(_0x14981c){if(_0x14981c['type']!==_0x97c2('0x40')){var _0x5ef57b={};_0x5ef57b[_0x14981c['name']]={'$like':'%'+_0x2df8a5[_0x97c2('0x33')]['filter']+'%'};return _0x5ef57b;}})});}_0x1cc1cb=_[_0x97c2('0x3f')]({},_0x1cc1cb,_0x2df8a5[_0x97c2('0x41')]);var _0x542f3d={'where':_0x1cc1cb['where']};return db[_0x97c2('0x2e')][_0x97c2('0x1e')](_0x542f3d)[_0x97c2('0x26')](function(_0x7631d6){_0x359fe4['count']=_0x7631d6;if(_0x2df8a5[_0x97c2('0x33')]['includeAll']){_0x1cc1cb[_0x97c2('0x42')]=[{'all':!![]}];}return db[_0x97c2('0x2e')][_0x97c2('0x43')](_0x1cc1cb);})[_0x97c2('0x26')](function(_0x265462){_0x359fe4[_0x97c2('0x44')]=_0x265462;return _0x359fe4;})[_0x97c2('0x26')](respondWithFilteredResult(_0x49fdda,_0x1cc1cb))[_0x97c2('0x45')](handleError(_0x49fdda,null));};exports[_0x97c2('0x46')]=function(_0x13a972,_0x553ca6){var _0x2fd2fd={'raw':![],'where':{'id':_0x13a972[_0x97c2('0x47')]['id']}},_0xd9bfbf={};_0xd9bfbf[_0x97c2('0x32')]=_[_0x97c2('0x34')](db[_0x97c2('0x2e')]['rawAttributes']);_0xd9bfbf[_0x97c2('0x33')]=_['keys'](_0x13a972[_0x97c2('0x33')]);_0xd9bfbf['filters']=_[_0x97c2('0x36')](_0xd9bfbf[_0x97c2('0x32')],_0xd9bfbf['query']);_0x2fd2fd[_0x97c2('0x37')]=_[_0x97c2('0x36')](_0xd9bfbf[_0x97c2('0x32')],qs['fields'](_0x13a972[_0x97c2('0x33')]['fields']));_0x2fd2fd[_0x97c2('0x37')]=_0x2fd2fd[_0x97c2('0x37')][_0x97c2('0x38')]?_0x2fd2fd[_0x97c2('0x37')]:_0xd9bfbf[_0x97c2('0x32')];if(_0x13a972[_0x97c2('0x33')][_0x97c2('0x48')]){_0x2fd2fd['include']=[{'all':!![]}];}_0x2fd2fd=_[_0x97c2('0x3f')]({},_0x2fd2fd,_0x13a972[_0x97c2('0x41')]);return db['FreshsalesAccount'][_0x97c2('0x49')](_0x2fd2fd)[_0x97c2('0x26')](handleEntityNotFound(_0x553ca6,null))[_0x97c2('0x26')](respondWithResult(_0x553ca6,null))[_0x97c2('0x45')](handleError(_0x553ca6,null));};exports[_0x97c2('0x4a')]=function(_0x5df58f,_0x28825d){return db[_0x97c2('0x2e')][_0x97c2('0x4a')](_0x5df58f['body'],{})['then'](respondWithResult(_0x28825d,0xc9))[_0x97c2('0x45')](handleError(_0x28825d,null));};exports[_0x97c2('0x24')]=function(_0x2e45d6,_0xdd74f4){if(_0x2e45d6[_0x97c2('0x4b')]['id']){delete _0x2e45d6['body']['id'];}return db[_0x97c2('0x2e')]['find']({'where':{'id':_0x2e45d6['params']['id']}})['then'](handleEntityNotFound(_0xdd74f4,null))['then'](saveUpdates(_0x2e45d6[_0x97c2('0x4b')],null))['then'](respondWithResult(_0xdd74f4,null))[_0x97c2('0x45')](handleError(_0xdd74f4,null));};exports[_0x97c2('0x25')]=function(_0x59efb2,_0x272515){return db['FreshsalesAccount']['find']({'where':{'id':_0x59efb2[_0x97c2('0x47')]['id']}})[_0x97c2('0x26')](handleEntityNotFound(_0x272515,null))['then'](removeEntity(_0x272515,null))[_0x97c2('0x45')](handleError(_0x272515,null));};exports[_0x97c2('0x4c')]=function(_0x46a3cb,_0x3c8d5c,_0x416ec6){var _0xe90834={};var _0x428a9a={};var _0x376da9;var _0x2affb8;return db[_0x97c2('0x2e')]['findOne']({'where':{'id':_0x46a3cb[_0x97c2('0x47')]['id']}})[_0x97c2('0x26')](handleEntityNotFound(_0x3c8d5c,null))[_0x97c2('0x26')](function(_0x1d9b12){if(_0x1d9b12){_0x376da9=_0x1d9b12;_0x428a9a['model']=_['keys'](db[_0x97c2('0x4d')]['rawAttributes']);_0x428a9a[_0x97c2('0x33')]=_['keys'](_0x46a3cb[_0x97c2('0x33')]);_0x428a9a[_0x97c2('0x35')]=_['intersection'](_0x428a9a[_0x97c2('0x32')],_0x428a9a[_0x97c2('0x33')]);_0xe90834[_0x97c2('0x37')]=_[_0x97c2('0x36')](_0x428a9a[_0x97c2('0x32')],qs[_0x97c2('0x4e')](_0x46a3cb['query']['fields']));_0xe90834['attributes']=_0xe90834['attributes']['length']?_0xe90834['attributes']:_0x428a9a[_0x97c2('0x32')];_0xe90834[_0x97c2('0x3a')]=qs[_0x97c2('0x3b')](_0x46a3cb[_0x97c2('0x33')]['sort']);_0xe90834[_0x97c2('0x3c')]=qs[_0x97c2('0x35')](_[_0x97c2('0x3d')](_0x46a3cb['query'],_0x428a9a[_0x97c2('0x35')]));if(_0x46a3cb[_0x97c2('0x33')][_0x97c2('0x3e')]){_0xe90834[_0x97c2('0x3c')]=_[_0x97c2('0x3f')](_0xe90834[_0x97c2('0x3c')],{'$or':_[_0x97c2('0x2d')](_0xe90834[_0x97c2('0x37')],function(_0x4dff99){var _0x261148={};_0x261148[_0x4dff99]={'$like':'%'+_0x46a3cb[_0x97c2('0x33')][_0x97c2('0x3e')]+'%'};return _0x261148;})});}_0xe90834=_['merge']({},_0xe90834,_0x46a3cb[_0x97c2('0x41')]);return _0x376da9[_0x97c2('0x4c')](_0xe90834);}})[_0x97c2('0x26')](function(_0x3e1e38){if(_0x3e1e38){_0x2affb8=_0x3e1e38[_0x97c2('0x38')];if(!_0x46a3cb['query'][_0x97c2('0x4f')]('nolimit')){_0xe90834['limit']=qs[_0x97c2('0x1f')](_0x46a3cb['query'][_0x97c2('0x1f')]);_0xe90834[_0x97c2('0x1c')]=qs[_0x97c2('0x1c')](_0x46a3cb[_0x97c2('0x33')][_0x97c2('0x1c')]);}return _0x376da9['getConfigurations'](_0xe90834);}})[_0x97c2('0x26')](function(_0x3db32a){if(_0x3db32a){return _0x3db32a?{'count':_0x2affb8,'rows':_0x3db32a}:null;}})[_0x97c2('0x26')](respondWithResult(_0x3c8d5c,null))[_0x97c2('0x45')](handleError(_0x3c8d5c,null));};exports[_0x97c2('0x50')]=function(_0x594d9c,_0x5d477f,_0x56f77c){if(_0x594d9c[_0x97c2('0x4b')]['id']){delete _0x594d9c[_0x97c2('0x4b')]['id'];}return db[_0x97c2('0x2e')][_0x97c2('0x51')]({'where':{'id':_0x594d9c[_0x97c2('0x47')]['id']}})[_0x97c2('0x26')](handleEntityNotFound(_0x5d477f,null))[_0x97c2('0x26')](function(_0x390860){if(_0x390860){_0x594d9c[_0x97c2('0x4b')][_0x97c2('0x52')]=_0x390860['id'];_0x594d9c[_0x97c2('0x4b')][_0x97c2('0x53')]=integrations[_0x97c2('0x54')](_0x594d9c[_0x97c2('0x4b')][_0x97c2('0x55')],_0x594d9c[_0x97c2('0x4b')]['type']);_0x594d9c[_0x97c2('0x4b')][_0x97c2('0x56')]=integrations[_0x97c2('0x57')](_0x594d9c[_0x97c2('0x4b')][_0x97c2('0x55')],_0x594d9c['body'][_0x97c2('0x58')]);return db[_0x97c2('0x4d')][_0x97c2('0x4a')](_0x594d9c[_0x97c2('0x4b')],{'include':[{'model':db[_0x97c2('0x59')],'as':'Subjects'},{'model':db[_0x97c2('0x59')],'as':_0x97c2('0x56')}]});}return null;})['then'](respondWithResult(_0x5d477f,null))[_0x97c2('0x45')](handleError(_0x5d477f,null));};exports[_0x97c2('0x5a')]=function(_0x3a4ed4,_0x2c70aa,_0x2b6aa0){var _0x109520='';var _0x32d103='';return db[_0x97c2('0x2e')][_0x97c2('0x51')]({'where':{'id':_0x3a4ed4[_0x97c2('0x47')]['id']},'attributes':['id',_0x97c2('0x5b'),'remoteUri',_0x97c2('0x5c')]})[_0x97c2('0x26')](handleEntityNotFound(_0x2c70aa,null))[_0x97c2('0x26')](function(_0x97c79e){if(_0x97c79e){_0x32d103=_0x97c79e[_0x97c2('0x5b')];_0x109520=_0x97c79e[_0x97c2('0x5d')];var _0x4ab4c8=_0x97c79e[_0x97c2('0x5d')][_0x97c2('0x5e')](-0x1);if(_0x4ab4c8==='/'){_0x109520=_0x109520[_0x97c2('0x5f')](0x0,_0x109520[_0x97c2('0x60')](_0x4ab4c8));}return rp({'method':_0x97c2('0x61'),'uri':util['format'](_0x97c2('0x62'),_0x109520,'/api/selector/owners'),'headers':{'Authorization':_0x97c2('0x63')+_0x97c79e[_0x97c2('0x5c')]},'json':!![]});}})[_0x97c2('0x26')](function(_0x585cb6){if(_0x585cb6){var _0x4984cb=_0x585cb6[_0x97c2('0x64')];var _0x2f6a25=![];var _0x38bffe=null;for(_0x38bffe=0x0;_0x38bffe<_0x4984cb[_0x97c2('0x38')];_0x38bffe++){if(_0x4984cb[_0x38bffe][_0x97c2('0x65')]===_0x32d103){_0x2f6a25=!![];}}if(_0x2f6a25){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x97c2('0x66')});}}})[_0x97c2('0x26')](respondWithResult(_0x2c70aa,null))[_0x97c2('0x45')](function(_0x6dd59b){var _0x96f14b=_0x3a4ed4[_0x97c2('0x33')]['test']?0x1f4:_0x6dd59b['statusCode']||0x1f4;logger['error'](_0x97c2('0x67'),_0x97c2('0x5a'),_0x96f14b,JSON[_0x97c2('0x68')](_0x6dd59b));delete _0x6dd59b[_0x97c2('0x2a')];if(_0x96f14b===0x191){_0x96f14b=0x190;}_0x2c70aa[_0x97c2('0x1a')](_0x96f14b)[_0x97c2('0x2b')](_0x3a4ed4[_0x97c2('0x33')]['test']?{'message':_0x97c2('0x69'),'statusCode':_0x6dd59b[_0x97c2('0x6a')]}:_0x6dd59b);});}; \ No newline at end of file +var _0x4dbd=['path','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','json','undefined','count','offset','set','apply','reject','save','update','then','end','sendStatus','name','send','index','FreshsalesAccount','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','map','type','filter','options','includeAll','include','findAll','rows','rawAttributes','find','create','body','catch','params','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','FreshsalesField','getFields','remoteUri','apiKey','username','slice','substring','GET','format','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util'];(function(_0x54cf2a,_0x2556f2){var _0x4996f4=function(_0x179894){while(--_0x179894){_0x54cf2a['push'](_0x54cf2a['shift']());}};_0x4996f4(++_0x2556f2);}(_0x4dbd,0x165));var _0xd4db=function(_0x340d52,_0x430452){_0x340d52=_0x340d52-0x0;var _0x440752=_0x4dbd[_0x340d52];return _0x440752;};'use strict';var emlformat=require(_0xd4db('0x0'));var rimraf=require(_0xd4db('0x1'));var zipdir=require(_0xd4db('0x2'));var jsonpatch=require(_0xd4db('0x3'));var rp=require('request-promise');var moment=require(_0xd4db('0x4'));var BPromise=require(_0xd4db('0x5'));var Mustache=require('mustache');var util=require(_0xd4db('0x6'));var path=require(_0xd4db('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd4db('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd4db('0x9'));var Redis=require(_0xd4db('0xa'));var authService=require('../../components/auth/service');var qs=require(_0xd4db('0xb'));var as=require(_0xd4db('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4db('0xd'))(_0xd4db('0xe'));var utils=require('../../config/utils');var config=require(_0xd4db('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0xd4db('0x10'))['db'];var integrations=require(_0xd4db('0x11'));function respondWithStatusCode(_0x34657e,_0x553097){_0x553097=_0x553097||0xcc;return function(_0x1a3be0){if(_0x1a3be0){return _0x34657e['sendStatus'](_0x553097);}return _0x34657e[_0xd4db('0x12')](_0x553097)['end']();};}function respondWithResult(_0x165e82,_0x6410d9){_0x6410d9=_0x6410d9||0xc8;return function(_0x51695f){if(_0x51695f){return _0x165e82[_0xd4db('0x12')](_0x6410d9)[_0xd4db('0x13')](_0x51695f);}};}function respondWithFilteredResult(_0x1efb1d,_0x3da1fd){return function(_0x5f3f65){if(_0x5f3f65){var _0x3275d6=typeof _0x3da1fd['offset']===_0xd4db('0x14')&&typeof _0x3da1fd['limit']===_0xd4db('0x14');var _0x2a724a=_0x5f3f65[_0xd4db('0x15')];var _0x568901=_0x3275d6?0x0:_0x3da1fd[_0xd4db('0x16')];var _0x17b16b=_0x3275d6?_0x5f3f65[_0xd4db('0x15')]:_0x3da1fd[_0xd4db('0x16')]+_0x3da1fd['limit'];var _0x22d7a8;if(_0x17b16b>=_0x2a724a){_0x17b16b=_0x2a724a;_0x22d7a8=0xc8;}else{_0x22d7a8=0xce;}_0x1efb1d[_0xd4db('0x12')](_0x22d7a8);return _0x1efb1d[_0xd4db('0x17')]('Content-Range',_0x568901+'-'+_0x17b16b+'/'+_0x2a724a)[_0xd4db('0x13')](_0x5f3f65);}return null;};}function patchUpdates(_0x25b4c3){return function(_0x10451e){try{jsonpatch[_0xd4db('0x18')](_0x10451e,_0x25b4c3,!![]);}catch(_0x17f821){return BPromise[_0xd4db('0x19')](_0x17f821);}return _0x10451e[_0xd4db('0x1a')]();};}function saveUpdates(_0x4c0535,_0x16d94c){return function(_0x5bb867){if(_0x5bb867){return _0x5bb867[_0xd4db('0x1b')](_0x4c0535)[_0xd4db('0x1c')](function(_0x389522){return _0x389522;});}return null;};}function removeEntity(_0x2c203a,_0x327afd){return function(_0x42ed94){if(_0x42ed94){return _0x42ed94['destroy']()[_0xd4db('0x1c')](function(){_0x2c203a[_0xd4db('0x12')](0xcc)[_0xd4db('0x1d')]();});}};}function handleEntityNotFound(_0xbb4816,_0x3a3866){return function(_0xe20add){if(!_0xe20add){_0xbb4816[_0xd4db('0x1e')](0x194);}return _0xe20add;};}function handleError(_0x18ebd7,_0xf58772){_0xf58772=_0xf58772||0x1f4;return function(_0x637a45){logger['error'](_0x637a45['stack']);if(_0x637a45[_0xd4db('0x1f')]){delete _0x637a45[_0xd4db('0x1f')];}_0x18ebd7[_0xd4db('0x12')](_0xf58772)[_0xd4db('0x20')](_0x637a45);};}exports[_0xd4db('0x21')]=function(_0x40ca2e,_0x2b0cca){var _0x608d59={},_0x504971={},_0x1e20e5={'count':0x0,'rows':[]};var _0x5b16e8=_['map'](db[_0xd4db('0x22')]['rawAttributes'],function(_0x58f4d2){return{'name':_0x58f4d2['fieldName'],'type':_0x58f4d2['type']['key']};});_0x504971[_0xd4db('0x23')]=_['map'](_0x5b16e8,_0xd4db('0x1f'));_0x504971[_0xd4db('0x24')]=_[_0xd4db('0x25')](_0x40ca2e[_0xd4db('0x24')]);_0x504971[_0xd4db('0x26')]=_[_0xd4db('0x27')](_0x504971[_0xd4db('0x23')],_0x504971[_0xd4db('0x24')]);_0x608d59[_0xd4db('0x28')]=_[_0xd4db('0x27')](_0x504971[_0xd4db('0x23')],qs['fields'](_0x40ca2e['query'][_0xd4db('0x29')]));_0x608d59[_0xd4db('0x28')]=_0x608d59[_0xd4db('0x28')][_0xd4db('0x2a')]?_0x608d59[_0xd4db('0x28')]:_0x504971[_0xd4db('0x23')];if(!_0x40ca2e[_0xd4db('0x24')][_0xd4db('0x2b')](_0xd4db('0x2c'))){_0x608d59[_0xd4db('0x2d')]=qs['limit'](_0x40ca2e[_0xd4db('0x24')][_0xd4db('0x2d')]);_0x608d59['offset']=qs[_0xd4db('0x16')](_0x40ca2e['query'][_0xd4db('0x16')]);}_0x608d59[_0xd4db('0x2e')]=qs[_0xd4db('0x2f')](_0x40ca2e[_0xd4db('0x24')][_0xd4db('0x2f')]);_0x608d59[_0xd4db('0x30')]=qs[_0xd4db('0x26')](_[_0xd4db('0x31')](_0x40ca2e[_0xd4db('0x24')],_0x504971['filters']),_0x5b16e8);if(_0x40ca2e[_0xd4db('0x24')]['filter']){_0x608d59[_0xd4db('0x30')]=_[_0xd4db('0x32')](_0x608d59[_0xd4db('0x30')],{'$or':_[_0xd4db('0x33')](_0x5b16e8,function(_0x4f11d0){if(_0x4f11d0[_0xd4db('0x34')]!=='VIRTUAL'){var _0x3af333={};_0x3af333[_0x4f11d0[_0xd4db('0x1f')]]={'$like':'%'+_0x40ca2e[_0xd4db('0x24')][_0xd4db('0x35')]+'%'};return _0x3af333;}})});}_0x608d59=_[_0xd4db('0x32')]({},_0x608d59,_0x40ca2e[_0xd4db('0x36')]);var _0x233e37={'where':_0x608d59['where']};return db[_0xd4db('0x22')][_0xd4db('0x15')](_0x233e37)[_0xd4db('0x1c')](function(_0x1ac01e){_0x1e20e5[_0xd4db('0x15')]=_0x1ac01e;if(_0x40ca2e[_0xd4db('0x24')][_0xd4db('0x37')]){_0x608d59[_0xd4db('0x38')]=[{'all':!![]}];}return db[_0xd4db('0x22')][_0xd4db('0x39')](_0x608d59);})[_0xd4db('0x1c')](function(_0x2b71c2){_0x1e20e5[_0xd4db('0x3a')]=_0x2b71c2;return _0x1e20e5;})[_0xd4db('0x1c')](respondWithFilteredResult(_0x2b0cca,_0x608d59))['catch'](handleError(_0x2b0cca,null));};exports['show']=function(_0x2c7257,_0x17c3c5){var _0x4d646b={'raw':![],'where':{'id':_0x2c7257['params']['id']}},_0x4e2714={};_0x4e2714[_0xd4db('0x23')]=_[_0xd4db('0x25')](db['FreshsalesAccount'][_0xd4db('0x3b')]);_0x4e2714[_0xd4db('0x24')]=_[_0xd4db('0x25')](_0x2c7257[_0xd4db('0x24')]);_0x4e2714[_0xd4db('0x26')]=_[_0xd4db('0x27')](_0x4e2714['model'],_0x4e2714[_0xd4db('0x24')]);_0x4d646b['attributes']=_[_0xd4db('0x27')](_0x4e2714[_0xd4db('0x23')],qs[_0xd4db('0x29')](_0x2c7257['query']['fields']));_0x4d646b[_0xd4db('0x28')]=_0x4d646b[_0xd4db('0x28')]['length']?_0x4d646b[_0xd4db('0x28')]:_0x4e2714['model'];if(_0x2c7257['query']['includeAll']){_0x4d646b['include']=[{'all':!![]}];}_0x4d646b=_[_0xd4db('0x32')]({},_0x4d646b,_0x2c7257['options']);return db[_0xd4db('0x22')][_0xd4db('0x3c')](_0x4d646b)[_0xd4db('0x1c')](handleEntityNotFound(_0x17c3c5,null))['then'](respondWithResult(_0x17c3c5,null))['catch'](handleError(_0x17c3c5,null));};exports[_0xd4db('0x3d')]=function(_0xdd0b1d,_0x531047){return db[_0xd4db('0x22')][_0xd4db('0x3d')](_0xdd0b1d[_0xd4db('0x3e')],{})[_0xd4db('0x1c')](respondWithResult(_0x531047,0xc9))[_0xd4db('0x3f')](handleError(_0x531047,null));};exports['update']=function(_0x3a27db,_0x28d4b3){if(_0x3a27db['body']['id']){delete _0x3a27db[_0xd4db('0x3e')]['id'];}return db['FreshsalesAccount'][_0xd4db('0x3c')]({'where':{'id':_0x3a27db[_0xd4db('0x40')]['id']}})[_0xd4db('0x1c')](handleEntityNotFound(_0x28d4b3,null))[_0xd4db('0x1c')](saveUpdates(_0x3a27db['body'],null))[_0xd4db('0x1c')](respondWithResult(_0x28d4b3,null))[_0xd4db('0x3f')](handleError(_0x28d4b3,null));};exports['destroy']=function(_0x27063d,_0x2b3451){return db[_0xd4db('0x22')][_0xd4db('0x3c')]({'where':{'id':_0x27063d[_0xd4db('0x40')]['id']}})[_0xd4db('0x1c')](handleEntityNotFound(_0x2b3451,null))['then'](removeEntity(_0x2b3451,null))[_0xd4db('0x3f')](handleError(_0x2b3451,null));};exports[_0xd4db('0x41')]=function(_0x5cc3f0,_0x12bde5,_0x3aaf0f){var _0x3f1527={};var _0x526abf={};var _0xd3332f;var _0x4f6817;return db[_0xd4db('0x22')][_0xd4db('0x42')]({'where':{'id':_0x5cc3f0[_0xd4db('0x40')]['id']}})[_0xd4db('0x1c')](handleEntityNotFound(_0x12bde5,null))[_0xd4db('0x1c')](function(_0x477007){if(_0x477007){_0xd3332f=_0x477007;_0x526abf[_0xd4db('0x23')]=_['keys'](db[_0xd4db('0x43')][_0xd4db('0x3b')]);_0x526abf[_0xd4db('0x24')]=_[_0xd4db('0x25')](_0x5cc3f0[_0xd4db('0x24')]);_0x526abf[_0xd4db('0x26')]=_['intersection'](_0x526abf[_0xd4db('0x23')],_0x526abf[_0xd4db('0x24')]);_0x3f1527[_0xd4db('0x28')]=_[_0xd4db('0x27')](_0x526abf[_0xd4db('0x23')],qs[_0xd4db('0x29')](_0x5cc3f0['query'][_0xd4db('0x29')]));_0x3f1527[_0xd4db('0x28')]=_0x3f1527[_0xd4db('0x28')][_0xd4db('0x2a')]?_0x3f1527[_0xd4db('0x28')]:_0x526abf[_0xd4db('0x23')];_0x3f1527['order']=qs[_0xd4db('0x2f')](_0x5cc3f0[_0xd4db('0x24')]['sort']);_0x3f1527['where']=qs[_0xd4db('0x26')](_['pick'](_0x5cc3f0['query'],_0x526abf[_0xd4db('0x26')]));if(_0x5cc3f0[_0xd4db('0x24')]['filter']){_0x3f1527['where']=_[_0xd4db('0x32')](_0x3f1527[_0xd4db('0x30')],{'$or':_[_0xd4db('0x33')](_0x3f1527[_0xd4db('0x28')],function(_0x5486ce){var _0x51c9ad={};_0x51c9ad[_0x5486ce]={'$like':'%'+_0x5cc3f0['query'][_0xd4db('0x35')]+'%'};return _0x51c9ad;})});}_0x3f1527=_[_0xd4db('0x32')]({},_0x3f1527,_0x5cc3f0[_0xd4db('0x36')]);return _0xd3332f['getConfigurations'](_0x3f1527);}})[_0xd4db('0x1c')](function(_0x45eb4d){if(_0x45eb4d){_0x4f6817=_0x45eb4d[_0xd4db('0x2a')];if(!_0x5cc3f0['query'][_0xd4db('0x2b')](_0xd4db('0x2c'))){_0x3f1527['limit']=qs[_0xd4db('0x2d')](_0x5cc3f0[_0xd4db('0x24')]['limit']);_0x3f1527[_0xd4db('0x16')]=qs[_0xd4db('0x16')](_0x5cc3f0['query']['offset']);}return _0xd3332f[_0xd4db('0x41')](_0x3f1527);}})['then'](function(_0x34cb9a){if(_0x34cb9a){return _0x34cb9a?{'count':_0x4f6817,'rows':_0x34cb9a}:null;}})[_0xd4db('0x1c')](respondWithResult(_0x12bde5,null))[_0xd4db('0x3f')](handleError(_0x12bde5,null));};exports[_0xd4db('0x44')]=function(_0x5e9487,_0x15a40b,_0x3ee00c){if(_0x5e9487['body']['id']){delete _0x5e9487[_0xd4db('0x3e')]['id'];}return db['FreshsalesAccount'][_0xd4db('0x42')]({'where':{'id':_0x5e9487[_0xd4db('0x40')]['id']}})[_0xd4db('0x1c')](handleEntityNotFound(_0x15a40b,null))[_0xd4db('0x1c')](function(_0x424fe2){if(_0x424fe2){_0x5e9487['body'][_0xd4db('0x45')]=_0x424fe2['id'];_0x5e9487[_0xd4db('0x3e')][_0xd4db('0x46')]=integrations[_0xd4db('0x47')](_0x5e9487[_0xd4db('0x3e')][_0xd4db('0x48')],_0x5e9487[_0xd4db('0x3e')]['type']);_0x5e9487[_0xd4db('0x3e')]['Descriptions']=integrations['getDescriptions'](_0x5e9487[_0xd4db('0x3e')]['channel'],_0x5e9487[_0xd4db('0x3e')]['type']);return db[_0xd4db('0x43')][_0xd4db('0x3d')](_0x5e9487[_0xd4db('0x3e')],{'include':[{'model':db[_0xd4db('0x49')],'as':'Subjects'},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})[_0xd4db('0x1c')](respondWithResult(_0x15a40b,null))['catch'](handleError(_0x15a40b,null));};exports[_0xd4db('0x4a')]=function(_0x39c9e4,_0x21a522,_0x118a0c){var _0x5ef3e1='';var _0x2f8c6c='';return db[_0xd4db('0x22')][_0xd4db('0x42')]({'where':{'id':_0x39c9e4[_0xd4db('0x40')]['id']},'attributes':['id','username',_0xd4db('0x4b'),_0xd4db('0x4c')]})[_0xd4db('0x1c')](handleEntityNotFound(_0x21a522,null))['then'](function(_0x4fa441){if(_0x4fa441){_0x2f8c6c=_0x4fa441[_0xd4db('0x4d')];_0x5ef3e1=_0x4fa441[_0xd4db('0x4b')];var _0x35733f=_0x4fa441[_0xd4db('0x4b')][_0xd4db('0x4e')](-0x1);if(_0x35733f==='/'){_0x5ef3e1=_0x5ef3e1[_0xd4db('0x4f')](0x0,_0x5ef3e1['lastIndexOf'](_0x35733f));}return rp({'method':_0xd4db('0x50'),'uri':util[_0xd4db('0x51')](_0xd4db('0x52'),_0x5ef3e1,_0xd4db('0x53')),'headers':{'Authorization':'Token\x20token='+_0x4fa441[_0xd4db('0x4c')]},'json':!![]});}})['then'](function(_0x2d90c6){if(_0x2d90c6){var _0x13f296=_0x2d90c6[_0xd4db('0x54')];var _0x434203=![];var _0x46bc96=null;for(_0x46bc96=0x0;_0x46bc96<_0x13f296[_0xd4db('0x2a')];_0x46bc96++){if(_0x13f296[_0x46bc96][_0xd4db('0x55')]===_0x2f8c6c){_0x434203=!![];}}if(_0x434203){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xd4db('0x56')});}}})[_0xd4db('0x1c')](respondWithResult(_0x21a522,null))['catch'](function(_0x37ca8a){var _0x1f78ec=_0x39c9e4['query'][_0xd4db('0x57')]?0x1f4:_0x37ca8a[_0xd4db('0x58')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x1f78ec,JSON[_0xd4db('0x59')](_0x37ca8a));delete _0x37ca8a['name'];if(_0x1f78ec===0x191){_0x1f78ec=0x190;}_0x21a522[_0xd4db('0x12')](_0x1f78ec)[_0xd4db('0x20')](_0x39c9e4[_0xd4db('0x24')][_0xd4db('0x57')]?{'message':_0xd4db('0x5a'),'statusCode':_0x37ca8a['statusCode']}:_0x37ca8a);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index e952d99..2f85cde 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 _0x68b3=['moment','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x524b72,_0x20b621){var _0x337c08=function(_0x1e2202){while(--_0x1e2202){_0x524b72['push'](_0x524b72['shift']());}};_0x337c08(++_0x20b621);}(_0x68b3,0x1d8));var _0x368b=function(_0x1ed74f,_0x527d86){_0x1ed74f=_0x1ed74f-0x0;var _0x345493=_0x68b3[_0x1ed74f];return _0x345493;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var logger=require(_0x368b('0x2'))(_0x368b('0x3'));var moment=require(_0x368b('0x4'));var BPromise=require('bluebird');var rp=require(_0x368b('0x5'));var fs=require('fs');var path=require(_0x368b('0x6'));var rimraf=require(_0x368b('0x7'));var config=require(_0x368b('0x8'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x368b('0x9'));module[_0x368b('0xa')]=function(_0x104dad,_0x23584a){return _0x104dad[_0x368b('0xb')](_0x368b('0xc'),attributes,{'tableName':_0x368b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x187d=['exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesAccount.attributes'];(function(_0x26a4ea,_0xa72fb8){var _0x1b669e=function(_0x4e8bba){while(--_0x4e8bba){_0x26a4ea['push'](_0x26a4ea['shift']());}};_0x1b669e(++_0xa72fb8);}(_0x187d,0x93));var _0xd187=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x187d[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xd187('0x9')]=function(_0x58ee7,_0x444a60){return _0x58ee7[_0xd187('0xa')](_0xd187('0xb'),attributes,{'tableName':_0xd187('0xc'),'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 ccb6efa..12826c6 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 _0x781d=['model','map','GetFreshsalesAccount','find','ShowFreshsalesAccount','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','FreshsalesAccount','findAll','options','where','attributes','limit','include'];(function(_0x3a9635,_0x1ab817){var _0x10d08c=function(_0x222242){while(--_0x222242){_0x3a9635['push'](_0x3a9635['shift']());}};_0x10d08c(++_0x1ab817);}(_0x781d,0x14a));var _0xd781=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x781d[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd781('0x2'));var fs=require('fs');var Redis=require(_0xd781('0x3'));var db=require(_0xd781('0x4'))['db'];var utils=require(_0xd781('0x5'));var logger=require(_0xd781('0x6'))(_0xd781('0x7'));var config=require(_0xd781('0x8'));var jayson=require(_0xd781('0x9'));var client=jayson[_0xd781('0xa')][_0xd781('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a07f0,_0x133509,_0x1a242d){return new BPromise(function(_0x50610d,_0x248172){return client['request'](_0x5a07f0,_0x1a242d)[_0xd781('0xc')](function(_0x5c18c8){logger[_0xd781('0xd')](_0xd781('0xe'),_0x133509,'request\x20sent');logger[_0xd781('0xf')](_0xd781('0x10'),_0x133509,'request\x20sent',JSON['stringify'](_0x5c18c8));if(_0x5c18c8[_0xd781('0x11')]){if(_0x5c18c8[_0xd781('0x11')][_0xd781('0x12')]===0x1f4){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);return _0x248172(_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);}logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8['error'][_0xd781('0x13')]);return _0x50610d(_0x5c18c8[_0xd781('0x11')]['message']);}else{logger[_0xd781('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x133509,_0xd781('0x14'));_0x50610d(_0x5c18c8[_0xd781('0x15')][_0xd781('0x13')]);}})[_0xd781('0x16')](function(_0x42a9c1){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x42a9c1);_0x248172(_0x42a9c1);});});}exports['GetFreshsalesAccount']=function(_0x1407fc){var _0x3f2922=this;return new Promise(function(_0x395d9c,_0x2f1273){return db[_0xd781('0x17')][_0xd781('0x18')]({'raw':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')][_0xd781('0x1a')]||null:null,'attributes':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')][_0xd781('0x1b')]||null:null,'limit':_0x1407fc[_0xd781('0x19')]?_0x1407fc['options'][_0xd781('0x1c')]||null:null,'include':_0x1407fc['options']?_0x1407fc['options'][_0xd781('0x1d')]?_['map'](_0x1407fc[_0xd781('0x19')][_0xd781('0x1d')],function(_0x395087){return{'model':db[_0x395087[_0xd781('0x1e')]],'as':_0x395087['as'],'attributes':_0x395087[_0xd781('0x1b')],'include':_0x395087[_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x395087[_0xd781('0x1d')],function(_0x10940b){return{'model':db[_0x10940b['model']],'as':_0x10940b['as'],'attributes':_0x10940b['attributes'],'include':_0x10940b[_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x10940b[_0xd781('0x1d')],function(_0x57b41e){return{'model':db[_0x57b41e[_0xd781('0x1e')]],'as':_0x57b41e['as'],'attributes':_0x57b41e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e29c8){logger['info'](_0xd781('0x20'),_0x1407fc);logger[_0xd781('0xf')]('GetFreshsalesAccount',_0x1407fc,JSON['stringify'](_0x1e29c8));_0x395d9c(_0x1e29c8);})[_0xd781('0x16')](function(_0x5b0464){logger[_0xd781('0x11')]('GetFreshsalesAccount',_0x5b0464[_0xd781('0x13')],_0x1407fc);_0x2f1273(_0x3f2922[_0xd781('0x11')](0x1f4,_0x5b0464['message']));});});};exports['ShowFreshsalesAccount']=function(_0x432d14){var _0x29e81a=this;return new Promise(function(_0x1c7d83,_0x5a389c){return db['FreshsalesAccount'][_0xd781('0x21')]({'raw':_0x432d14[_0xd781('0x19')]?_0x432d14[_0xd781('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1a')]||null:null,'attributes':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1b')]||null:null,'include':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x432d14[_0xd781('0x19')]['include'],function(_0x23dffb){return{'model':db[_0x23dffb[_0xd781('0x1e')]],'as':_0x23dffb['as'],'attributes':_0x23dffb[_0xd781('0x1b')],'include':_0x23dffb[_0xd781('0x1d')]?_['map'](_0x23dffb[_0xd781('0x1d')],function(_0x3f20e2){return{'model':db[_0x3f20e2['model']],'as':_0x3f20e2['as'],'attributes':_0x3f20e2[_0xd781('0x1b')],'include':_0x3f20e2['include']?_[_0xd781('0x1f')](_0x3f20e2[_0xd781('0x1d')],function(_0x57fdb6){return{'model':db[_0x57fdb6[_0xd781('0x1e')]],'as':_0x57fdb6['as'],'attributes':_0x57fdb6[_0xd781('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a29b7){logger['info'](_0xd781('0x22'),_0x432d14);logger[_0xd781('0xf')]('ShowFreshsalesAccount',_0x432d14,JSON[_0xd781('0x23')](_0x2a29b7));_0x1c7d83(_0x2a29b7);})[_0xd781('0x16')](function(_0x5651de){logger[_0xd781('0x11')](_0xd781('0x22'),_0x5651de[_0xd781('0x13')],_0x432d14);_0x5a389c(_0x29e81a['error'](0x1f4,_0x5651de[_0xd781('0x13')]));});});}; \ No newline at end of file +var _0x77d4=['util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowFreshsalesAccount','find'];(function(_0x211679,_0x484f81){var _0x19b622=function(_0x5608c4){while(--_0x5608c4){_0x211679['push'](_0x211679['shift']());}};_0x19b622(++_0x484f81);}(_0x77d4,0x108));var _0x477d=function(_0x148783,_0x1ac458){_0x148783=_0x148783-0x0;var _0x85329a=_0x77d4[_0x148783];return _0x85329a;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var moment=require('moment');var BPromise=require(_0x477d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x477d('0x2'));var db=require(_0x477d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x477d('0x4'));var config=require(_0x477d('0x5'));var jayson=require(_0x477d('0x6'));var client=jayson[_0x477d('0x7')][_0x477d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45ca2d,_0x5153df,_0x4f4fb4){return new BPromise(function(_0x2dd5d2,_0x579859){return client['request'](_0x45ca2d,_0x4f4fb4)[_0x477d('0x9')](function(_0x29f11b){logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));logger['debug'](_0x477d('0xd'),_0x5153df,'request\x20sent',JSON[_0x477d('0xe')](_0x29f11b));if(_0x29f11b[_0x477d('0xf')]){if(_0x29f11b['error'][_0x477d('0x10')]===0x1f4){logger[_0x477d('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x5153df,_0x29f11b['error'][_0x477d('0x11')]);return _0x579859(_0x29f11b[_0x477d('0xf')]['message']);}logger[_0x477d('0xf')](_0x477d('0xb'),_0x5153df,_0x29f11b['error']['message']);return _0x2dd5d2(_0x29f11b[_0x477d('0xf')]['message']);}else{logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));_0x2dd5d2(_0x29f11b['result'][_0x477d('0x11')]);}})[_0x477d('0x12')](function(_0x29c6f8){logger[_0x477d('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x5153df,_0x29c6f8);_0x579859(_0x29c6f8);});});}exports[_0x477d('0x13')]=function(_0x5d5553){var _0x367965=this;return new Promise(function(_0x1399d7,_0x159beb){return db[_0x477d('0x14')][_0x477d('0x15')]({'raw':_0x5d5553[_0x477d('0x16')]?_0x5d5553['options'][_0x477d('0x17')]===undefined?!![]:![]:!![],'where':_0x5d5553['options']?_0x5d5553[_0x477d('0x16')][_0x477d('0x18')]||null:null,'attributes':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x19')]||null:null,'limit':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x1a')]||null:null,'include':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x5d5553[_0x477d('0x16')][_0x477d('0x1b')],function(_0x4e6a44){return{'model':db[_0x4e6a44[_0x477d('0x1d')]],'as':_0x4e6a44['as'],'attributes':_0x4e6a44['attributes'],'include':_0x4e6a44[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x4e6a44[_0x477d('0x1b')],function(_0x2287b4){return{'model':db[_0x2287b4['model']],'as':_0x2287b4['as'],'attributes':_0x2287b4[_0x477d('0x19')],'include':_0x2287b4[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x2287b4['include'],function(_0x585648){return{'model':db[_0x585648[_0x477d('0x1d')]],'as':_0x585648['as'],'attributes':_0x585648[_0x477d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x477d('0x9')](function(_0x5c8ef1){logger[_0x477d('0xa')](_0x477d('0x13'),_0x5d5553);logger[_0x477d('0x1e')](_0x477d('0x13'),_0x5d5553,JSON[_0x477d('0xe')](_0x5c8ef1));_0x1399d7(_0x5c8ef1);})['catch'](function(_0x2fc959){logger[_0x477d('0xf')](_0x477d('0x13'),_0x2fc959[_0x477d('0x11')],_0x5d5553);_0x159beb(_0x367965[_0x477d('0xf')](0x1f4,_0x2fc959[_0x477d('0x11')]));});});};exports[_0x477d('0x1f')]=function(_0x98b5d9){var _0x204541=this;return new Promise(function(_0x8fe6c4,_0x41b790){return db[_0x477d('0x14')][_0x477d('0x20')]({'raw':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9[_0x477d('0x16')][_0x477d('0x17')]===undefined?!![]:![]:!![],'where':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9[_0x477d('0x16')][_0x477d('0x18')]||null:null,'attributes':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9['options'][_0x477d('0x19')]||null:null,'include':_0x98b5d9['options']?_0x98b5d9[_0x477d('0x16')][_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x98b5d9['options'][_0x477d('0x1b')],function(_0x1201a9){return{'model':db[_0x1201a9[_0x477d('0x1d')]],'as':_0x1201a9['as'],'attributes':_0x1201a9[_0x477d('0x19')],'include':_0x1201a9[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x1201a9[_0x477d('0x1b')],function(_0xf84c4c){return{'model':db[_0xf84c4c[_0x477d('0x1d')]],'as':_0xf84c4c['as'],'attributes':_0xf84c4c[_0x477d('0x19')],'include':_0xf84c4c['include']?_[_0x477d('0x1c')](_0xf84c4c[_0x477d('0x1b')],function(_0xb41cd8){return{'model':db[_0xb41cd8['model']],'as':_0xb41cd8['as'],'attributes':_0xb41cd8[_0x477d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x477d('0x9')](function(_0x1b0410){logger['info']('ShowFreshsalesAccount',_0x98b5d9);logger[_0x477d('0x1e')](_0x477d('0x1f'),_0x98b5d9,JSON[_0x477d('0xe')](_0x1b0410));_0x8fe6c4(_0x1b0410);})[_0x477d('0x12')](function(_0x1c0d86){logger['error'](_0x477d('0x1f'),_0x1c0d86['message'],_0x98b5d9);_0x41b790(_0x204541[_0x477d('0xf')](0x1f4,_0x1c0d86[_0x477d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 3644239..2de36b9 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 _0x864b=['../../components/interaction/service','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','show','getSubjects','getFields','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x512973,_0x564e8b){var _0x32f2e1=function(_0x5d5d3b){while(--_0x5d5d3b){_0x512973['push'](_0x512973['shift']());}};_0x32f2e1(++_0x564e8b);}(_0x864b,0x94));var _0xb864=function(_0x28311a,_0x451ba4){_0x28311a=_0x28311a-0x0;var _0x3494a4=_0x864b[_0x28311a];return _0x3494a4;};'use strict';var multer=require('multer');var util=require(_0xb864('0x0'));var path=require('path');var timeout=require(_0xb864('0x1'));var express=require(_0xb864('0x2'));var router=express[_0xb864('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb864('0x4'));var config=require('../../config/environment');var controller=require(_0xb864('0x5'));router[_0xb864('0x6')]('/',auth['isAuthenticated'](),controller[_0xb864('0x7')]);router['get'](_0xb864('0x8'),auth[_0xb864('0x9')](),controller[_0xb864('0xa')]);router[_0xb864('0x6')]('/:id/subjects',auth[_0xb864('0x9')](),controller[_0xb864('0xb')]);router['get']('/:id/descriptions',auth[_0xb864('0x9')](),controller['getDescriptions']);router['get']('/:id/fields',auth[_0xb864('0x9')](),controller[_0xb864('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb864('0xd')]);router[_0xb864('0xe')](_0xb864('0x8'),auth['isAuthenticated'](),controller[_0xb864('0xf')]);router[_0xb864('0x10')]('/:id',auth[_0xb864('0x9')](),controller[_0xb864('0x11')]);module[_0xb864('0x12')]=router; \ No newline at end of file +var _0x29f8=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x24d8dd,_0x103354){var _0x126a6d=function(_0xeb4fc7){while(--_0xeb4fc7){_0x24d8dd['push'](_0x24d8dd['shift']());}};_0x126a6d(++_0x103354);}(_0x29f8,0xb2));var _0x829f=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x29f8[_0x1d9aa0];return _0x226868;};'use strict';var multer=require(_0x829f('0x0'));var util=require(_0x829f('0x1'));var path=require(_0x829f('0x2'));var timeout=require(_0x829f('0x3'));var express=require(_0x829f('0x4'));var router=express[_0x829f('0x5')]();var fs_extra=require(_0x829f('0x6'));var auth=require(_0x829f('0x7'));var interaction=require(_0x829f('0x8'));var config=require('../../config/environment');var controller=require(_0x829f('0x9'));router[_0x829f('0xa')]('/',auth[_0x829f('0xb')](),controller[_0x829f('0xc')]);router['get'](_0x829f('0xd'),auth['isAuthenticated'](),controller[_0x829f('0xe')]);router['get'](_0x829f('0xf'),auth[_0x829f('0xb')](),controller[_0x829f('0x10')]);router[_0x829f('0xa')](_0x829f('0x11'),auth[_0x829f('0xb')](),controller['getDescriptions']);router[_0x829f('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x829f('0x12')]);router[_0x829f('0x13')]('/',auth[_0x829f('0xb')](),controller[_0x829f('0x14')]);router[_0x829f('0x15')](_0x829f('0xd'),auth[_0x829f('0xb')](),controller[_0x829f('0x16')]);router[_0x829f('0x17')](_0x829f('0xd'),auth[_0x829f('0xb')](),controller[_0x829f('0x18')]);module[_0x829f('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 1df43a3..f7fbe1e 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 _0x406b=['sequelize','exports','STRING'];(function(_0x22dbdf,_0x329abf){var _0x34705f=function(_0x19b4b4){while(--_0x19b4b4){_0x22dbdf['push'](_0x22dbdf['shift']());}};_0x34705f(++_0x329abf);}(_0x406b,0xd5));var _0xb406=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x406b[_0x550d12];return _0x12103d;};'use strict';var Sequelize=require(_0xb406('0x0'));module[_0xb406('0x1')]={'name':{'type':Sequelize[_0xb406('0x2')]},'description':{'type':Sequelize[_0xb406('0x2')]}}; \ No newline at end of file +var _0x7150=['exports','sequelize'];(function(_0x1f8e5d,_0x4d5d9b){var _0x1b8893=function(_0x4d12c9){while(--_0x4d12c9){_0x1f8e5d['push'](_0x1f8e5d['shift']());}};_0x1b8893(++_0x4d5d9b);}(_0x7150,0x153));var _0x0715=function(_0x4fd5de,_0x854f9f){_0x4fd5de=_0x4fd5de-0x0;var _0x194d47=_0x7150[_0x4fd5de];return _0x194d47;};'use strict';var Sequelize=require(_0x0715('0x0'));module[_0x0715('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 027322f..226c48f 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 _0x6681=['Content-Range','reject','save','update','destroy','then','stack','name','index','map','FreshsalesConfiguration','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','catch','show','find','body','params','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x4be1a1,_0x2f1e92){var _0x2731c3=function(_0x274686){while(--_0x274686){_0x4be1a1['push'](_0x4be1a1['shift']());}};_0x2731c3(++_0x2f1e92);}(_0x6681,0x1ad));var _0x1668=function(_0x100052,_0x9b9203){_0x100052=_0x100052-0x0;var _0x47e466=_0x6681[_0x100052];return _0x47e466;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1668('0x0'));var zipdir=require(_0x1668('0x1'));var jsonpatch=require(_0x1668('0x2'));var rp=require('request-promise');var moment=require(_0x1668('0x3'));var BPromise=require(_0x1668('0x4'));var Mustache=require('mustache');var util=require(_0x1668('0x5'));var path=require(_0x1668('0x6'));var sox=require(_0x1668('0x7'));var csv=require(_0x1668('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1668('0x9'));var _=require(_0x1668('0xa'));var squel=require(_0x1668('0xb'));var crypto=require(_0x1668('0xc'));var jsforce=require(_0x1668('0xd'));var deskjs=require(_0x1668('0xe'));var toCsv=require(_0x1668('0x8'));var querystring=require(_0x1668('0xf'));var Papa=require(_0x1668('0x10'));var Redis=require(_0x1668('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1668('0x12'));var as=require(_0x1668('0x13'));var hardwareService=require(_0x1668('0x14'));var logger=require(_0x1668('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1668('0x16'));var db=require(_0x1668('0x17'))['db'];function respondWithStatusCode(_0x4d7788,_0x1e0b66){_0x1e0b66=_0x1e0b66||0xcc;return function(_0x26789b){if(_0x26789b){return _0x4d7788[_0x1668('0x18')](_0x1e0b66);}return _0x4d7788[_0x1668('0x19')](_0x1e0b66)[_0x1668('0x1a')]();};}function respondWithResult(_0x4534c3,_0x12fa89){_0x12fa89=_0x12fa89||0xc8;return function(_0x4ab7dc){if(_0x4ab7dc){return _0x4534c3[_0x1668('0x19')](_0x12fa89)[_0x1668('0x1b')](_0x4ab7dc);}};}function respondWithFilteredResult(_0x378212,_0x27a154){return function(_0x1c28da){if(_0x1c28da){var _0x4b160f=typeof _0x27a154[_0x1668('0x1c')]===_0x1668('0x1d')&&typeof _0x27a154[_0x1668('0x1e')]===_0x1668('0x1d');var _0x1d0e65=_0x1c28da['count'];var _0x4cd205=_0x4b160f?0x0:_0x27a154[_0x1668('0x1c')];var _0x176fdd=_0x4b160f?_0x1c28da[_0x1668('0x1f')]:_0x27a154[_0x1668('0x1c')]+_0x27a154['limit'];var _0x35e490;if(_0x176fdd>=_0x1d0e65){_0x176fdd=_0x1d0e65;_0x35e490=0xc8;}else{_0x35e490=0xce;}_0x378212['status'](_0x35e490);return _0x378212[_0x1668('0x20')](_0x1668('0x21'),_0x4cd205+'-'+_0x176fdd+'/'+_0x1d0e65)[_0x1668('0x1b')](_0x1c28da);}return null;};}function patchUpdates(_0x31c769){return function(_0x23351d){try{jsonpatch['apply'](_0x23351d,_0x31c769,!![]);}catch(_0x1d80d1){return BPromise[_0x1668('0x22')](_0x1d80d1);}return _0x23351d[_0x1668('0x23')]();};}function saveUpdates(_0x45033f,_0x4aaeea){return function(_0x5c7d9b){if(_0x5c7d9b){return _0x5c7d9b[_0x1668('0x24')](_0x45033f)['then'](function(_0x4a040c){return _0x4a040c;});}return null;};}function removeEntity(_0x43ae90,_0x221beb){return function(_0x2be416){if(_0x2be416){return _0x2be416[_0x1668('0x25')]()[_0x1668('0x26')](function(){_0x43ae90[_0x1668('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x88969f,_0x44bf1){return function(_0x2f2233){if(!_0x2f2233){_0x88969f['sendStatus'](0x194);}return _0x2f2233;};}function handleError(_0x598eee,_0x29146a){_0x29146a=_0x29146a||0x1f4;return function(_0x411dc0){logger['error'](_0x411dc0[_0x1668('0x27')]);if(_0x411dc0[_0x1668('0x28')]){delete _0x411dc0[_0x1668('0x28')];}_0x598eee[_0x1668('0x19')](_0x29146a)['send'](_0x411dc0);};}exports[_0x1668('0x29')]=function(_0x37cb34,_0x44028d){var _0x47e602={},_0x30a3a5={},_0x1b8aa8={'count':0x0,'rows':[]};var _0x2bced7=_[_0x1668('0x2a')](db[_0x1668('0x2b')][_0x1668('0x2c')],function(_0x5da160){return{'name':_0x5da160[_0x1668('0x2d')],'type':_0x5da160['type']['key']};});_0x30a3a5['model']=_[_0x1668('0x2a')](_0x2bced7,_0x1668('0x28'));_0x30a3a5[_0x1668('0x2e')]=_[_0x1668('0x2f')](_0x37cb34['query']);_0x30a3a5[_0x1668('0x30')]=_[_0x1668('0x31')](_0x30a3a5['model'],_0x30a3a5[_0x1668('0x2e')]);_0x47e602['attributes']=_['intersection'](_0x30a3a5[_0x1668('0x32')],qs[_0x1668('0x33')](_0x37cb34[_0x1668('0x2e')][_0x1668('0x33')]));_0x47e602['attributes']=_0x47e602[_0x1668('0x34')][_0x1668('0x35')]?_0x47e602['attributes']:_0x30a3a5[_0x1668('0x32')];if(!_0x37cb34[_0x1668('0x2e')][_0x1668('0x36')](_0x1668('0x37'))){_0x47e602[_0x1668('0x1e')]=qs[_0x1668('0x1e')](_0x37cb34[_0x1668('0x2e')][_0x1668('0x1e')]);_0x47e602[_0x1668('0x1c')]=qs[_0x1668('0x1c')](_0x37cb34[_0x1668('0x2e')]['offset']);}_0x47e602[_0x1668('0x38')]=qs['sort'](_0x37cb34[_0x1668('0x2e')][_0x1668('0x39')]);_0x47e602['where']=qs['filters'](_[_0x1668('0x3a')](_0x37cb34[_0x1668('0x2e')],_0x30a3a5[_0x1668('0x30')]),_0x2bced7);if(_0x37cb34[_0x1668('0x2e')][_0x1668('0x3b')]){_0x47e602[_0x1668('0x3c')]=_[_0x1668('0x3d')](_0x47e602[_0x1668('0x3c')],{'$or':_[_0x1668('0x2a')](_0x2bced7,function(_0x3aebdb){if(_0x3aebdb[_0x1668('0x3e')]!==_0x1668('0x3f')){var _0x3544f8={};_0x3544f8[_0x3aebdb[_0x1668('0x28')]]={'$like':'%'+_0x37cb34['query'][_0x1668('0x3b')]+'%'};return _0x3544f8;}})});}_0x47e602=_['merge']({},_0x47e602,_0x37cb34[_0x1668('0x40')]);var _0x1f2af7={'where':_0x47e602['where']};return db[_0x1668('0x2b')]['count'](_0x1f2af7)[_0x1668('0x26')](function(_0x1a9f67){_0x1b8aa8['count']=_0x1a9f67;if(_0x37cb34[_0x1668('0x2e')][_0x1668('0x41')]){_0x47e602[_0x1668('0x42')]=[{'all':!![]}];}return db[_0x1668('0x2b')]['findAll'](_0x47e602);})['then'](function(_0xed8a2a){_0x1b8aa8['rows']=_0xed8a2a;return _0x1b8aa8;})['then'](respondWithFilteredResult(_0x44028d,_0x47e602))[_0x1668('0x43')](handleError(_0x44028d,null));};exports[_0x1668('0x44')]=function(_0x51be87,_0x32ea57){var _0x4cfab6={'raw':![],'where':{'id':_0x51be87['params']['id']}},_0x2484e3={};_0x2484e3['model']=_['keys'](db[_0x1668('0x2b')][_0x1668('0x2c')]);_0x2484e3[_0x1668('0x2e')]=_[_0x1668('0x2f')](_0x51be87[_0x1668('0x2e')]);_0x2484e3[_0x1668('0x30')]=_[_0x1668('0x31')](_0x2484e3[_0x1668('0x32')],_0x2484e3[_0x1668('0x2e')]);_0x4cfab6['attributes']=_[_0x1668('0x31')](_0x2484e3['model'],qs['fields'](_0x51be87[_0x1668('0x2e')][_0x1668('0x33')]));_0x4cfab6['attributes']=_0x4cfab6[_0x1668('0x34')][_0x1668('0x35')]?_0x4cfab6['attributes']:_0x2484e3[_0x1668('0x32')];if(_0x51be87['query']['includeAll']){_0x4cfab6[_0x1668('0x42')]=[{'all':!![]}];}_0x4cfab6=_[_0x1668('0x3d')]({},_0x4cfab6,_0x51be87[_0x1668('0x40')]);return db[_0x1668('0x2b')][_0x1668('0x45')](_0x4cfab6)[_0x1668('0x26')](handleEntityNotFound(_0x32ea57,null))[_0x1668('0x26')](respondWithResult(_0x32ea57,null))[_0x1668('0x43')](handleError(_0x32ea57,null));};exports['create']=function(_0xd771eb,_0x260255){return db['FreshsalesConfiguration']['create'](_0xd771eb[_0x1668('0x46')],{})[_0x1668('0x26')](respondWithResult(_0x260255,0xc9))[_0x1668('0x43')](handleError(_0x260255,null));};exports[_0x1668('0x24')]=function(_0xc4afbc,_0x1ca649){if(_0xc4afbc[_0x1668('0x46')]['id']){delete _0xc4afbc['body']['id'];}return db[_0x1668('0x2b')][_0x1668('0x45')]({'where':{'id':_0xc4afbc[_0x1668('0x47')]['id']}})[_0x1668('0x26')](handleEntityNotFound(_0x1ca649,null))[_0x1668('0x26')](saveUpdates(_0xc4afbc['body'],null))[_0x1668('0x26')](respondWithResult(_0x1ca649,null))[_0x1668('0x43')](handleError(_0x1ca649,null));};exports[_0x1668('0x25')]=function(_0x1afaf8,_0x5d930b){return db[_0x1668('0x2b')]['find']({'where':{'id':_0x1afaf8[_0x1668('0x47')]['id']}})[_0x1668('0x26')](handleEntityNotFound(_0x5d930b,null))[_0x1668('0x26')](removeEntity(_0x5d930b,null))['catch'](handleError(_0x5d930b,null));};exports[_0x1668('0x48')]=function(_0x46f42a,_0x5bcd4c,_0x5f58eb){var _0x41ed20={};var _0x54d33f={};var _0x37a336;var _0x1dff52;return db['FreshsalesConfiguration'][_0x1668('0x49')]({'where':{'id':_0x46f42a['params']['id']}})[_0x1668('0x26')](handleEntityNotFound(_0x5bcd4c,null))['then'](function(_0x723d35){if(_0x723d35){_0x37a336=_0x723d35;_0x54d33f[_0x1668('0x32')]=_['keys'](db[_0x1668('0x4a')]['rawAttributes']);_0x54d33f['query']=_[_0x1668('0x2f')](_0x46f42a['query']);_0x54d33f['filters']=_['intersection'](_0x54d33f[_0x1668('0x32')],_0x54d33f[_0x1668('0x2e')]);_0x41ed20[_0x1668('0x34')]=_[_0x1668('0x31')](_0x54d33f[_0x1668('0x32')],qs[_0x1668('0x33')](_0x46f42a['query']['fields']));_0x41ed20[_0x1668('0x34')]=_0x41ed20[_0x1668('0x34')][_0x1668('0x35')]?_0x41ed20[_0x1668('0x34')]:_0x54d33f['model'];_0x41ed20['order']=qs[_0x1668('0x39')](_0x46f42a['query'][_0x1668('0x39')]);_0x41ed20[_0x1668('0x3c')]=qs[_0x1668('0x30')](_['pick'](_0x46f42a['query'],_0x54d33f['filters']));if(_0x46f42a[_0x1668('0x2e')][_0x1668('0x3b')]){_0x41ed20[_0x1668('0x3c')]=_['merge'](_0x41ed20[_0x1668('0x3c')],{'$or':_['map'](_0x41ed20[_0x1668('0x34')],function(_0x1a26fd){var _0x23f2a7={};_0x23f2a7[_0x1a26fd]={'$like':'%'+_0x46f42a[_0x1668('0x2e')][_0x1668('0x3b')]+'%'};return _0x23f2a7;})});}_0x41ed20=_[_0x1668('0x3d')]({},_0x41ed20,_0x46f42a['options']);return _0x37a336[_0x1668('0x48')](_0x41ed20);}})[_0x1668('0x26')](function(_0x26c593){if(_0x26c593){_0x1dff52=_0x26c593[_0x1668('0x35')];if(!_0x46f42a[_0x1668('0x2e')][_0x1668('0x36')]('nolimit')){_0x41ed20[_0x1668('0x1e')]=qs[_0x1668('0x1e')](_0x46f42a[_0x1668('0x2e')][_0x1668('0x1e')]);_0x41ed20[_0x1668('0x1c')]=qs[_0x1668('0x1c')](_0x46f42a[_0x1668('0x2e')][_0x1668('0x1c')]);}return _0x37a336[_0x1668('0x48')](_0x41ed20);}})['then'](function(_0x19370d){if(_0x19370d){return _0x19370d?{'count':_0x1dff52,'rows':_0x19370d}:null;}})[_0x1668('0x26')](respondWithResult(_0x5bcd4c,null))[_0x1668('0x43')](handleError(_0x5bcd4c,null));};exports[_0x1668('0x4b')]=function(_0x118551,_0x263adc,_0x287504){var _0x446d7e={};var _0xad487e={};var _0x23135b;var _0x1eb51f;return db[_0x1668('0x2b')][_0x1668('0x49')]({'where':{'id':_0x118551[_0x1668('0x47')]['id']}})['then'](handleEntityNotFound(_0x263adc,null))[_0x1668('0x26')](function(_0x3d3c02){if(_0x3d3c02){_0x23135b=_0x3d3c02;_0xad487e['model']=_[_0x1668('0x2f')](db[_0x1668('0x4a')]['rawAttributes']);_0xad487e[_0x1668('0x2e')]=_[_0x1668('0x2f')](_0x118551[_0x1668('0x2e')]);_0xad487e[_0x1668('0x30')]=_[_0x1668('0x31')](_0xad487e['model'],_0xad487e['query']);_0x446d7e['attributes']=_['intersection'](_0xad487e[_0x1668('0x32')],qs[_0x1668('0x33')](_0x118551[_0x1668('0x2e')]['fields']));_0x446d7e[_0x1668('0x34')]=_0x446d7e[_0x1668('0x34')][_0x1668('0x35')]?_0x446d7e[_0x1668('0x34')]:_0xad487e[_0x1668('0x32')];_0x446d7e[_0x1668('0x38')]=qs[_0x1668('0x39')](_0x118551[_0x1668('0x2e')][_0x1668('0x39')]);_0x446d7e[_0x1668('0x3c')]=qs[_0x1668('0x30')](_[_0x1668('0x3a')](_0x118551[_0x1668('0x2e')],_0xad487e[_0x1668('0x30')]));if(_0x118551[_0x1668('0x2e')][_0x1668('0x3b')]){_0x446d7e['where']=_[_0x1668('0x3d')](_0x446d7e['where'],{'$or':_[_0x1668('0x2a')](_0x446d7e[_0x1668('0x34')],function(_0x434e8e){var _0x574ccc={};_0x574ccc[_0x434e8e]={'$like':'%'+_0x118551[_0x1668('0x2e')]['filter']+'%'};return _0x574ccc;})});}_0x446d7e=_[_0x1668('0x3d')]({},_0x446d7e,_0x118551[_0x1668('0x40')]);return _0x23135b[_0x1668('0x4b')](_0x446d7e);}})[_0x1668('0x26')](function(_0x46d65f){if(_0x46d65f){_0x1eb51f=_0x46d65f[_0x1668('0x35')];if(!_0x118551[_0x1668('0x2e')]['hasOwnProperty'](_0x1668('0x37'))){_0x446d7e['limit']=qs[_0x1668('0x1e')](_0x118551[_0x1668('0x2e')][_0x1668('0x1e')]);_0x446d7e[_0x1668('0x1c')]=qs[_0x1668('0x1c')](_0x118551[_0x1668('0x2e')][_0x1668('0x1c')]);}return _0x23135b[_0x1668('0x4b')](_0x446d7e);}})[_0x1668('0x26')](function(_0x3f29e4){if(_0x3f29e4){return _0x3f29e4?{'count':_0x1eb51f,'rows':_0x3f29e4}:null;}})[_0x1668('0x26')](respondWithResult(_0x263adc,null))[_0x1668('0x43')](handleError(_0x263adc,null));};exports[_0x1668('0x4c')]=function(_0x3e97a4,_0x1d1c1f,_0x1d1278){var _0x920016={};var _0x139031={};var _0x2d868a;var _0x258fcf;return db[_0x1668('0x2b')][_0x1668('0x49')]({'where':{'id':_0x3e97a4[_0x1668('0x47')]['id']}})[_0x1668('0x26')](handleEntityNotFound(_0x1d1c1f,null))['then'](function(_0x245377){if(_0x245377){_0x2d868a=_0x245377;_0x139031[_0x1668('0x32')]=_[_0x1668('0x2f')](db[_0x1668('0x4a')][_0x1668('0x2c')]);_0x139031[_0x1668('0x2e')]=_['keys'](_0x3e97a4['query']);_0x139031[_0x1668('0x30')]=_['intersection'](_0x139031[_0x1668('0x32')],_0x139031[_0x1668('0x2e')]);_0x920016[_0x1668('0x34')]=_[_0x1668('0x31')](_0x139031['model'],qs[_0x1668('0x33')](_0x3e97a4[_0x1668('0x2e')]['fields']));_0x920016[_0x1668('0x34')]=_0x920016[_0x1668('0x34')]['length']?_0x920016['attributes']:_0x139031[_0x1668('0x32')];_0x920016[_0x1668('0x38')]=qs[_0x1668('0x39')](_0x3e97a4['query'][_0x1668('0x39')]);_0x920016['where']=qs[_0x1668('0x30')](_[_0x1668('0x3a')](_0x3e97a4['query'],_0x139031[_0x1668('0x30')]));if(_0x3e97a4[_0x1668('0x2e')][_0x1668('0x3b')]){_0x920016[_0x1668('0x3c')]=_[_0x1668('0x3d')](_0x920016[_0x1668('0x3c')],{'$or':_[_0x1668('0x2a')](_0x920016[_0x1668('0x34')],function(_0x4691c5){var _0x5cf950={};_0x5cf950[_0x4691c5]={'$like':'%'+_0x3e97a4['query'][_0x1668('0x3b')]+'%'};return _0x5cf950;})});}_0x920016=_[_0x1668('0x3d')]({},_0x920016,_0x3e97a4[_0x1668('0x40')]);return _0x2d868a['getFields'](_0x920016);}})[_0x1668('0x26')](function(_0x406701){if(_0x406701){_0x258fcf=_0x406701[_0x1668('0x35')];if(!_0x3e97a4[_0x1668('0x2e')]['hasOwnProperty'](_0x1668('0x37'))){_0x920016[_0x1668('0x1e')]=qs[_0x1668('0x1e')](_0x3e97a4[_0x1668('0x2e')]['limit']);_0x920016[_0x1668('0x1c')]=qs['offset'](_0x3e97a4[_0x1668('0x2e')][_0x1668('0x1c')]);}return _0x2d868a[_0x1668('0x4c')](_0x920016);}})[_0x1668('0x26')](function(_0x3b094c){if(_0x3b094c){return _0x3b094c?{'count':_0x258fcf,'rows':_0x3b094c}:null;}})[_0x1668('0x26')](respondWithResult(_0x1d1c1f,null))[_0x1668('0x43')](handleError(_0x1d1c1f,null));}; \ No newline at end of file +var _0xc0d4=['rows','show','length','find','create','catch','body','params','getSubjects','findOne','FreshsalesField','pick','getDescriptions','getFields','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FreshsalesConfiguration','includeAll','include','findAll'];(function(_0x29b27e,_0x41e08b){var _0xffb544=function(_0x36654f){while(--_0x36654f){_0x29b27e['push'](_0x29b27e['shift']());}};_0xffb544(++_0x41e08b);}(_0xc0d4,0x19e));var _0x4c0d=function(_0x14790f,_0x432b5f){_0x14790f=_0x14790f-0x0;var _0x5acc1f=_0xc0d4[_0x14790f];return _0x5acc1f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4c0d('0x0'));var jsonpatch=require(_0x4c0d('0x1'));var rp=require(_0x4c0d('0x2'));var moment=require(_0x4c0d('0x3'));var BPromise=require(_0x4c0d('0x4'));var Mustache=require(_0x4c0d('0x5'));var util=require(_0x4c0d('0x6'));var path=require(_0x4c0d('0x7'));var sox=require(_0x4c0d('0x8'));var csv=require('to-csv');var ejs=require(_0x4c0d('0x9'));var fs=require('fs');var fs_extra=require(_0x4c0d('0xa'));var _=require(_0x4c0d('0xb'));var squel=require(_0x4c0d('0xc'));var crypto=require(_0x4c0d('0xd'));var jsforce=require(_0x4c0d('0xe'));var deskjs=require(_0x4c0d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4c0d('0x10'));var Redis=require(_0x4c0d('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4c0d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c0d('0x13'))(_0x4c0d('0x14'));var utils=require(_0x4c0d('0x15'));var config=require(_0x4c0d('0x16'));var licenseUtil=require(_0x4c0d('0x17'));var db=require(_0x4c0d('0x18'))['db'];function respondWithStatusCode(_0x41e2b8,_0x33efb6){_0x33efb6=_0x33efb6||0xcc;return function(_0x1ccace){if(_0x1ccace){return _0x41e2b8[_0x4c0d('0x19')](_0x33efb6);}return _0x41e2b8[_0x4c0d('0x1a')](_0x33efb6)[_0x4c0d('0x1b')]();};}function respondWithResult(_0x1fb1cf,_0x1edd33){_0x1edd33=_0x1edd33||0xc8;return function(_0x52cd2a){if(_0x52cd2a){return _0x1fb1cf[_0x4c0d('0x1a')](_0x1edd33)['json'](_0x52cd2a);}};}function respondWithFilteredResult(_0x309689,_0x252ace){return function(_0x195635){if(_0x195635){var _0x180b10=typeof _0x252ace['offset']==='undefined'&&typeof _0x252ace['limit']===_0x4c0d('0x1c');var _0x2b8125=_0x195635[_0x4c0d('0x1d')];var _0x2765ca=_0x180b10?0x0:_0x252ace[_0x4c0d('0x1e')];var _0x23f7c2=_0x180b10?_0x195635[_0x4c0d('0x1d')]:_0x252ace['offset']+_0x252ace[_0x4c0d('0x1f')];var _0x2792d5;if(_0x23f7c2>=_0x2b8125){_0x23f7c2=_0x2b8125;_0x2792d5=0xc8;}else{_0x2792d5=0xce;}_0x309689[_0x4c0d('0x1a')](_0x2792d5);return _0x309689['set'](_0x4c0d('0x20'),_0x2765ca+'-'+_0x23f7c2+'/'+_0x2b8125)['json'](_0x195635);}return null;};}function patchUpdates(_0x111c60){return function(_0x1cd757){try{jsonpatch[_0x4c0d('0x21')](_0x1cd757,_0x111c60,!![]);}catch(_0x1aec23){return BPromise[_0x4c0d('0x22')](_0x1aec23);}return _0x1cd757[_0x4c0d('0x23')]();};}function saveUpdates(_0x294ba2,_0x3e28ec){return function(_0x23aa9d){if(_0x23aa9d){return _0x23aa9d[_0x4c0d('0x24')](_0x294ba2)[_0x4c0d('0x25')](function(_0x62b891){return _0x62b891;});}return null;};}function removeEntity(_0x21b436,_0x551eed){return function(_0x5760a7){if(_0x5760a7){return _0x5760a7[_0x4c0d('0x26')]()['then'](function(){_0x21b436[_0x4c0d('0x1a')](0xcc)[_0x4c0d('0x1b')]();});}};}function handleEntityNotFound(_0x3a5876,_0x416b8c){return function(_0x196a47){if(!_0x196a47){_0x3a5876[_0x4c0d('0x19')](0x194);}return _0x196a47;};}function handleError(_0x38c396,_0x3a698b){_0x3a698b=_0x3a698b||0x1f4;return function(_0x1affea){logger[_0x4c0d('0x27')](_0x1affea[_0x4c0d('0x28')]);if(_0x1affea[_0x4c0d('0x29')]){delete _0x1affea[_0x4c0d('0x29')];}_0x38c396[_0x4c0d('0x1a')](_0x3a698b)['send'](_0x1affea);};}exports['index']=function(_0x170f3f,_0x5951f5){var _0x1d289c={},_0x175b68={},_0x24a147={'count':0x0,'rows':[]};var _0x21d61f=_[_0x4c0d('0x2a')](db['FreshsalesConfiguration'][_0x4c0d('0x2b')],function(_0x43f973){return{'name':_0x43f973[_0x4c0d('0x2c')],'type':_0x43f973[_0x4c0d('0x2d')]['key']};});_0x175b68[_0x4c0d('0x2e')]=_['map'](_0x21d61f,'name');_0x175b68[_0x4c0d('0x2f')]=_[_0x4c0d('0x30')](_0x170f3f[_0x4c0d('0x2f')]);_0x175b68[_0x4c0d('0x31')]=_[_0x4c0d('0x32')](_0x175b68[_0x4c0d('0x2e')],_0x175b68[_0x4c0d('0x2f')]);_0x1d289c['attributes']=_[_0x4c0d('0x32')](_0x175b68[_0x4c0d('0x2e')],qs[_0x4c0d('0x33')](_0x170f3f[_0x4c0d('0x2f')]['fields']));_0x1d289c[_0x4c0d('0x34')]=_0x1d289c[_0x4c0d('0x34')]['length']?_0x1d289c['attributes']:_0x175b68['model'];if(!_0x170f3f['query'][_0x4c0d('0x35')](_0x4c0d('0x36'))){_0x1d289c[_0x4c0d('0x1f')]=qs[_0x4c0d('0x1f')](_0x170f3f[_0x4c0d('0x2f')][_0x4c0d('0x1f')]);_0x1d289c[_0x4c0d('0x1e')]=qs[_0x4c0d('0x1e')](_0x170f3f[_0x4c0d('0x2f')][_0x4c0d('0x1e')]);}_0x1d289c[_0x4c0d('0x37')]=qs[_0x4c0d('0x38')](_0x170f3f[_0x4c0d('0x2f')][_0x4c0d('0x38')]);_0x1d289c[_0x4c0d('0x39')]=qs[_0x4c0d('0x31')](_['pick'](_0x170f3f['query'],_0x175b68[_0x4c0d('0x31')]),_0x21d61f);if(_0x170f3f[_0x4c0d('0x2f')][_0x4c0d('0x3a')]){_0x1d289c['where']=_[_0x4c0d('0x3b')](_0x1d289c[_0x4c0d('0x39')],{'$or':_['map'](_0x21d61f,function(_0x305506){if(_0x305506[_0x4c0d('0x2d')]!==_0x4c0d('0x3c')){var _0x4d6d73={};_0x4d6d73[_0x305506[_0x4c0d('0x29')]]={'$like':'%'+_0x170f3f[_0x4c0d('0x2f')][_0x4c0d('0x3a')]+'%'};return _0x4d6d73;}})});}_0x1d289c=_[_0x4c0d('0x3b')]({},_0x1d289c,_0x170f3f[_0x4c0d('0x3d')]);var _0x774065={'where':_0x1d289c['where']};return db[_0x4c0d('0x3e')][_0x4c0d('0x1d')](_0x774065)['then'](function(_0x5682ae){_0x24a147[_0x4c0d('0x1d')]=_0x5682ae;if(_0x170f3f[_0x4c0d('0x2f')][_0x4c0d('0x3f')]){_0x1d289c[_0x4c0d('0x40')]=[{'all':!![]}];}return db[_0x4c0d('0x3e')][_0x4c0d('0x41')](_0x1d289c);})[_0x4c0d('0x25')](function(_0x4d7b0b){_0x24a147[_0x4c0d('0x42')]=_0x4d7b0b;return _0x24a147;})['then'](respondWithFilteredResult(_0x5951f5,_0x1d289c))['catch'](handleError(_0x5951f5,null));};exports[_0x4c0d('0x43')]=function(_0x1973d3,_0x584ae0){var _0x4150f0={'raw':![],'where':{'id':_0x1973d3['params']['id']}},_0x29564f={};_0x29564f[_0x4c0d('0x2e')]=_[_0x4c0d('0x30')](db[_0x4c0d('0x3e')]['rawAttributes']);_0x29564f[_0x4c0d('0x2f')]=_['keys'](_0x1973d3[_0x4c0d('0x2f')]);_0x29564f[_0x4c0d('0x31')]=_[_0x4c0d('0x32')](_0x29564f[_0x4c0d('0x2e')],_0x29564f[_0x4c0d('0x2f')]);_0x4150f0[_0x4c0d('0x34')]=_['intersection'](_0x29564f[_0x4c0d('0x2e')],qs[_0x4c0d('0x33')](_0x1973d3[_0x4c0d('0x2f')][_0x4c0d('0x33')]));_0x4150f0[_0x4c0d('0x34')]=_0x4150f0[_0x4c0d('0x34')][_0x4c0d('0x44')]?_0x4150f0[_0x4c0d('0x34')]:_0x29564f[_0x4c0d('0x2e')];if(_0x1973d3['query'][_0x4c0d('0x3f')]){_0x4150f0['include']=[{'all':!![]}];}_0x4150f0=_[_0x4c0d('0x3b')]({},_0x4150f0,_0x1973d3[_0x4c0d('0x3d')]);return db[_0x4c0d('0x3e')][_0x4c0d('0x45')](_0x4150f0)[_0x4c0d('0x25')](handleEntityNotFound(_0x584ae0,null))[_0x4c0d('0x25')](respondWithResult(_0x584ae0,null))['catch'](handleError(_0x584ae0,null));};exports['create']=function(_0x4ede99,_0x7a22f8){return db[_0x4c0d('0x3e')][_0x4c0d('0x46')](_0x4ede99['body'],{})['then'](respondWithResult(_0x7a22f8,0xc9))[_0x4c0d('0x47')](handleError(_0x7a22f8,null));};exports[_0x4c0d('0x24')]=function(_0xf2888b,_0x10263f){if(_0xf2888b[_0x4c0d('0x48')]['id']){delete _0xf2888b[_0x4c0d('0x48')]['id'];}return db['FreshsalesConfiguration'][_0x4c0d('0x45')]({'where':{'id':_0xf2888b['params']['id']}})[_0x4c0d('0x25')](handleEntityNotFound(_0x10263f,null))[_0x4c0d('0x25')](saveUpdates(_0xf2888b['body'],null))['then'](respondWithResult(_0x10263f,null))[_0x4c0d('0x47')](handleError(_0x10263f,null));};exports[_0x4c0d('0x26')]=function(_0x3210aa,_0x543df1){return db[_0x4c0d('0x3e')][_0x4c0d('0x45')]({'where':{'id':_0x3210aa[_0x4c0d('0x49')]['id']}})[_0x4c0d('0x25')](handleEntityNotFound(_0x543df1,null))[_0x4c0d('0x25')](removeEntity(_0x543df1,null))[_0x4c0d('0x47')](handleError(_0x543df1,null));};exports[_0x4c0d('0x4a')]=function(_0xa0a7c3,_0x3e541,_0x415d0b){var _0x18b930={};var _0x158145={};var _0x8f8fe4;var _0x1a5219;return db['FreshsalesConfiguration'][_0x4c0d('0x4b')]({'where':{'id':_0xa0a7c3['params']['id']}})[_0x4c0d('0x25')](handleEntityNotFound(_0x3e541,null))['then'](function(_0x2f1cfd){if(_0x2f1cfd){_0x8f8fe4=_0x2f1cfd;_0x158145['model']=_[_0x4c0d('0x30')](db[_0x4c0d('0x4c')][_0x4c0d('0x2b')]);_0x158145[_0x4c0d('0x2f')]=_[_0x4c0d('0x30')](_0xa0a7c3[_0x4c0d('0x2f')]);_0x158145[_0x4c0d('0x31')]=_[_0x4c0d('0x32')](_0x158145[_0x4c0d('0x2e')],_0x158145[_0x4c0d('0x2f')]);_0x18b930[_0x4c0d('0x34')]=_[_0x4c0d('0x32')](_0x158145[_0x4c0d('0x2e')],qs[_0x4c0d('0x33')](_0xa0a7c3[_0x4c0d('0x2f')][_0x4c0d('0x33')]));_0x18b930[_0x4c0d('0x34')]=_0x18b930[_0x4c0d('0x34')][_0x4c0d('0x44')]?_0x18b930[_0x4c0d('0x34')]:_0x158145['model'];_0x18b930['order']=qs[_0x4c0d('0x38')](_0xa0a7c3[_0x4c0d('0x2f')][_0x4c0d('0x38')]);_0x18b930['where']=qs[_0x4c0d('0x31')](_[_0x4c0d('0x4d')](_0xa0a7c3['query'],_0x158145[_0x4c0d('0x31')]));if(_0xa0a7c3[_0x4c0d('0x2f')]['filter']){_0x18b930[_0x4c0d('0x39')]=_['merge'](_0x18b930[_0x4c0d('0x39')],{'$or':_[_0x4c0d('0x2a')](_0x18b930['attributes'],function(_0x22ff35){var _0x3571c9={};_0x3571c9[_0x22ff35]={'$like':'%'+_0xa0a7c3[_0x4c0d('0x2f')]['filter']+'%'};return _0x3571c9;})});}_0x18b930=_[_0x4c0d('0x3b')]({},_0x18b930,_0xa0a7c3[_0x4c0d('0x3d')]);return _0x8f8fe4[_0x4c0d('0x4a')](_0x18b930);}})[_0x4c0d('0x25')](function(_0x1e11cd){if(_0x1e11cd){_0x1a5219=_0x1e11cd[_0x4c0d('0x44')];if(!_0xa0a7c3['query'][_0x4c0d('0x35')](_0x4c0d('0x36'))){_0x18b930[_0x4c0d('0x1f')]=qs[_0x4c0d('0x1f')](_0xa0a7c3[_0x4c0d('0x2f')]['limit']);_0x18b930['offset']=qs[_0x4c0d('0x1e')](_0xa0a7c3[_0x4c0d('0x2f')][_0x4c0d('0x1e')]);}return _0x8f8fe4[_0x4c0d('0x4a')](_0x18b930);}})[_0x4c0d('0x25')](function(_0x483fc0){if(_0x483fc0){return _0x483fc0?{'count':_0x1a5219,'rows':_0x483fc0}:null;}})['then'](respondWithResult(_0x3e541,null))[_0x4c0d('0x47')](handleError(_0x3e541,null));};exports[_0x4c0d('0x4e')]=function(_0x5c7337,_0x43534f,_0x27e764){var _0x4d5324={};var _0x3fa4b9={};var _0x3cb74f;var _0x3007b3;return db[_0x4c0d('0x3e')][_0x4c0d('0x4b')]({'where':{'id':_0x5c7337[_0x4c0d('0x49')]['id']}})[_0x4c0d('0x25')](handleEntityNotFound(_0x43534f,null))[_0x4c0d('0x25')](function(_0x483817){if(_0x483817){_0x3cb74f=_0x483817;_0x3fa4b9[_0x4c0d('0x2e')]=_[_0x4c0d('0x30')](db[_0x4c0d('0x4c')][_0x4c0d('0x2b')]);_0x3fa4b9['query']=_[_0x4c0d('0x30')](_0x5c7337[_0x4c0d('0x2f')]);_0x3fa4b9[_0x4c0d('0x31')]=_[_0x4c0d('0x32')](_0x3fa4b9[_0x4c0d('0x2e')],_0x3fa4b9['query']);_0x4d5324[_0x4c0d('0x34')]=_[_0x4c0d('0x32')](_0x3fa4b9[_0x4c0d('0x2e')],qs[_0x4c0d('0x33')](_0x5c7337['query'][_0x4c0d('0x33')]));_0x4d5324[_0x4c0d('0x34')]=_0x4d5324['attributes'][_0x4c0d('0x44')]?_0x4d5324['attributes']:_0x3fa4b9[_0x4c0d('0x2e')];_0x4d5324[_0x4c0d('0x37')]=qs[_0x4c0d('0x38')](_0x5c7337['query'][_0x4c0d('0x38')]);_0x4d5324[_0x4c0d('0x39')]=qs[_0x4c0d('0x31')](_['pick'](_0x5c7337[_0x4c0d('0x2f')],_0x3fa4b9[_0x4c0d('0x31')]));if(_0x5c7337[_0x4c0d('0x2f')][_0x4c0d('0x3a')]){_0x4d5324[_0x4c0d('0x39')]=_[_0x4c0d('0x3b')](_0x4d5324[_0x4c0d('0x39')],{'$or':_['map'](_0x4d5324['attributes'],function(_0x30b07d){var _0x5a8797={};_0x5a8797[_0x30b07d]={'$like':'%'+_0x5c7337[_0x4c0d('0x2f')][_0x4c0d('0x3a')]+'%'};return _0x5a8797;})});}_0x4d5324=_[_0x4c0d('0x3b')]({},_0x4d5324,_0x5c7337[_0x4c0d('0x3d')]);return _0x3cb74f[_0x4c0d('0x4e')](_0x4d5324);}})['then'](function(_0x20e2b8){if(_0x20e2b8){_0x3007b3=_0x20e2b8[_0x4c0d('0x44')];if(!_0x5c7337[_0x4c0d('0x2f')][_0x4c0d('0x35')](_0x4c0d('0x36'))){_0x4d5324[_0x4c0d('0x1f')]=qs[_0x4c0d('0x1f')](_0x5c7337[_0x4c0d('0x2f')][_0x4c0d('0x1f')]);_0x4d5324[_0x4c0d('0x1e')]=qs[_0x4c0d('0x1e')](_0x5c7337[_0x4c0d('0x2f')][_0x4c0d('0x1e')]);}return _0x3cb74f[_0x4c0d('0x4e')](_0x4d5324);}})['then'](function(_0x697b1f){if(_0x697b1f){return _0x697b1f?{'count':_0x3007b3,'rows':_0x697b1f}:null;}})['then'](respondWithResult(_0x43534f,null))[_0x4c0d('0x47')](handleError(_0x43534f,null));};exports[_0x4c0d('0x4f')]=function(_0x282e18,_0x2e7987,_0x48a7c0){var _0x42bb88={};var _0x4de67c={};var _0x1635c2;var _0x1a08fe;return db[_0x4c0d('0x3e')]['findOne']({'where':{'id':_0x282e18['params']['id']}})[_0x4c0d('0x25')](handleEntityNotFound(_0x2e7987,null))[_0x4c0d('0x25')](function(_0x49ce86){if(_0x49ce86){_0x1635c2=_0x49ce86;_0x4de67c[_0x4c0d('0x2e')]=_[_0x4c0d('0x30')](db[_0x4c0d('0x4c')][_0x4c0d('0x2b')]);_0x4de67c[_0x4c0d('0x2f')]=_[_0x4c0d('0x30')](_0x282e18[_0x4c0d('0x2f')]);_0x4de67c[_0x4c0d('0x31')]=_['intersection'](_0x4de67c['model'],_0x4de67c[_0x4c0d('0x2f')]);_0x42bb88[_0x4c0d('0x34')]=_[_0x4c0d('0x32')](_0x4de67c[_0x4c0d('0x2e')],qs[_0x4c0d('0x33')](_0x282e18[_0x4c0d('0x2f')][_0x4c0d('0x33')]));_0x42bb88[_0x4c0d('0x34')]=_0x42bb88[_0x4c0d('0x34')]['length']?_0x42bb88[_0x4c0d('0x34')]:_0x4de67c['model'];_0x42bb88[_0x4c0d('0x37')]=qs[_0x4c0d('0x38')](_0x282e18['query'][_0x4c0d('0x38')]);_0x42bb88[_0x4c0d('0x39')]=qs[_0x4c0d('0x31')](_[_0x4c0d('0x4d')](_0x282e18['query'],_0x4de67c[_0x4c0d('0x31')]));if(_0x282e18[_0x4c0d('0x2f')][_0x4c0d('0x3a')]){_0x42bb88[_0x4c0d('0x39')]=_[_0x4c0d('0x3b')](_0x42bb88[_0x4c0d('0x39')],{'$or':_[_0x4c0d('0x2a')](_0x42bb88[_0x4c0d('0x34')],function(_0x3576b2){var _0x157122={};_0x157122[_0x3576b2]={'$like':'%'+_0x282e18[_0x4c0d('0x2f')][_0x4c0d('0x3a')]+'%'};return _0x157122;})});}_0x42bb88=_[_0x4c0d('0x3b')]({},_0x42bb88,_0x282e18[_0x4c0d('0x3d')]);return _0x1635c2[_0x4c0d('0x4f')](_0x42bb88);}})[_0x4c0d('0x25')](function(_0x34a36b){if(_0x34a36b){_0x1a08fe=_0x34a36b[_0x4c0d('0x44')];if(!_0x282e18['query'][_0x4c0d('0x35')](_0x4c0d('0x36'))){_0x42bb88[_0x4c0d('0x1f')]=qs[_0x4c0d('0x1f')](_0x282e18[_0x4c0d('0x2f')][_0x4c0d('0x1f')]);_0x42bb88[_0x4c0d('0x1e')]=qs[_0x4c0d('0x1e')](_0x282e18[_0x4c0d('0x2f')][_0x4c0d('0x1e')]);}return _0x1635c2[_0x4c0d('0x4f')](_0x42bb88);}})[_0x4c0d('0x25')](function(_0x314dd7){if(_0x314dd7){return _0x314dd7?{'count':_0x1a08fe,'rows':_0x314dd7}:null;}})[_0x4c0d('0x25')](respondWithResult(_0x2e7987,null))[_0x4c0d('0x47')](handleError(_0x2e7987,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index c8fd349..f7b33e4 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 _0x52ed=['int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0x5e82ae,_0x1bf62f){var _0x2e3d18=function(_0x42dc5b){while(--_0x42dc5b){_0x5e82ae['push'](_0x5e82ae['shift']());}};_0x2e3d18(++_0x1bf62f);}(_0x52ed,0x79));var _0xd52e=function(_0x1aecdc,_0x522a27){_0x1aecdc=_0x1aecdc-0x0;var _0xef638b=_0x52ed[_0x1aecdc];return _0xef638b;};'use strict';var _=require(_0xd52e('0x0'));var util=require(_0xd52e('0x1'));var logger=require(_0xd52e('0x2'))(_0xd52e('0x3'));var moment=require(_0xd52e('0x4'));var BPromise=require(_0xd52e('0x5'));var rp=require(_0xd52e('0x6'));var fs=require('fs');var path=require(_0xd52e('0x7'));var rimraf=require(_0xd52e('0x8'));var config=require(_0xd52e('0x9'));var attributes=require(_0xd52e('0xa'));module[_0xd52e('0xb')]=function(_0x1842d8,_0x42ce41){return _0x1842d8[_0xd52e('0xc')](_0xd52e('0xd'),attributes,{'tableName':_0xd52e('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa2c=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger'];(function(_0x4c0c09,_0x44481d){var _0x173e5e=function(_0x232343){while(--_0x232343){_0x4c0c09['push'](_0x4c0c09['shift']());}};_0x173e5e(++_0x44481d);}(_0xaa2c,0x1a1));var _0xcaa2=function(_0x4ea52c,_0x3fe304){_0x4ea52c=_0x4ea52c-0x0;var _0x52dbe9=_0xaa2c[_0x4ea52c];return _0x52dbe9;};'use strict';var _=require(_0xcaa2('0x0'));var util=require(_0xcaa2('0x1'));var logger=require(_0xcaa2('0x2'))(_0xcaa2('0x3'));var moment=require(_0xcaa2('0x4'));var BPromise=require(_0xcaa2('0x5'));var rp=require(_0xcaa2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcaa2('0x7'));var config=require(_0xcaa2('0x8'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xcaa2('0x9')]=function(_0x5de808,_0x2af53e){return _0x5de808['define'](_0xcaa2('0xa'),attributes,{'tableName':_0xcaa2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 208af21..038d1ab 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 _0x2cdf=['rpc','../../config/environment','jayson/promise','client','then','info','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3d2d6f,_0x368872){var _0x5c0022=function(_0x408819){while(--_0x408819){_0x3d2d6f['push'](_0x3d2d6f['shift']());}};_0x5c0022(++_0x368872);}(_0x2cdf,0xbf));var _0xf2cd=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x2cdf[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0xf2cd('0x0'));var util=require(_0xf2cd('0x1'));var moment=require(_0xf2cd('0x2'));var BPromise=require(_0xf2cd('0x3'));var rs=require(_0xf2cd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf2cd('0x5'))['db'];var utils=require(_0xf2cd('0x6'));var logger=require('../../config/logger')(_0xf2cd('0x7'));var config=require(_0xf2cd('0x8'));var jayson=require(_0xf2cd('0x9'));var client=jayson[_0xf2cd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f14e7,_0x3de2f7,_0x536148){return new BPromise(function(_0x4ce0ee,_0x534865){return client['request'](_0x3f14e7,_0x536148)[_0xf2cd('0xb')](function(_0x232912){logger[_0xf2cd('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3de2f7,'request\x20sent');logger[_0xf2cd('0xd')](_0xf2cd('0xe'),_0x3de2f7,_0xf2cd('0xf'),JSON[_0xf2cd('0x10')](_0x232912));if(_0x232912[_0xf2cd('0x11')]){if(_0x232912[_0xf2cd('0x11')][_0xf2cd('0x12')]===0x1f4){logger[_0xf2cd('0x11')](_0xf2cd('0x13'),_0x3de2f7,_0x232912['error'][_0xf2cd('0x14')]);return _0x534865(_0x232912[_0xf2cd('0x11')]['message']);}logger[_0xf2cd('0x11')](_0xf2cd('0x13'),_0x3de2f7,_0x232912[_0xf2cd('0x11')]['message']);return _0x4ce0ee(_0x232912['error']['message']);}else{logger[_0xf2cd('0xc')](_0xf2cd('0x13'),_0x3de2f7,_0xf2cd('0xf'));_0x4ce0ee(_0x232912['result'][_0xf2cd('0x14')]);}})[_0xf2cd('0x15')](function(_0x2d328e){logger[_0xf2cd('0x11')](_0xf2cd('0x13'),_0x3de2f7,_0x2d328e);_0x534865(_0x2d328e);});});} \ No newline at end of file +var _0xbc8d=['jayson/promise','client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x56d952,_0x1ef93d){var _0x4fdd5a=function(_0x4ddf27){while(--_0x4ddf27){_0x56d952['push'](_0x56d952['shift']());}};_0x4fdd5a(++_0x1ef93d);}(_0xbc8d,0x66));var _0xdbc8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc8d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdbc8('0x0'));var util=require(_0xdbc8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdbc8('0x2'));var db=require(_0xdbc8('0x3'))['db'];var utils=require(_0xdbc8('0x4'));var logger=require(_0xdbc8('0x5'))(_0xdbc8('0x6'));var config=require(_0xdbc8('0x7'));var jayson=require(_0xdbc8('0x8'));var client=jayson[_0xdbc8('0x9')][_0xdbc8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3aaf53,_0x30b62b,_0xa85c58){return new BPromise(function(_0x1afa57,_0x10487b){return client[_0xdbc8('0xb')](_0x3aaf53,_0xa85c58)[_0xdbc8('0xc')](function(_0x4c9005){logger['info'](_0xdbc8('0xd'),_0x30b62b,_0xdbc8('0xe'));logger[_0xdbc8('0xf')](_0xdbc8('0x10'),_0x30b62b,_0xdbc8('0xe'),JSON[_0xdbc8('0x11')](_0x4c9005));if(_0x4c9005[_0xdbc8('0x12')]){if(_0x4c9005['error'][_0xdbc8('0x13')]===0x1f4){logger[_0xdbc8('0x12')](_0xdbc8('0xd'),_0x30b62b,_0x4c9005[_0xdbc8('0x12')][_0xdbc8('0x14')]);return _0x10487b(_0x4c9005['error'][_0xdbc8('0x14')]);}logger[_0xdbc8('0x12')](_0xdbc8('0xd'),_0x30b62b,_0x4c9005['error']['message']);return _0x1afa57(_0x4c9005[_0xdbc8('0x12')][_0xdbc8('0x14')]);}else{logger[_0xdbc8('0x15')](_0xdbc8('0xd'),_0x30b62b,'request\x20sent');_0x1afa57(_0x4c9005['result']['message']);}})['catch'](function(_0x465c82){logger[_0xdbc8('0x12')](_0xdbc8('0xd'),_0x30b62b,_0x465c82);_0x10487b(_0x465c82);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 09a328a..0156269 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 _0x2fda=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','post','create','put','exports'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x2fda,0x186));var _0xa2fd=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x2fda[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0xa2fd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa2fd('0x1'));var express=require(_0xa2fd('0x2'));var router=express[_0xa2fd('0x3')]();var fs_extra=require(_0xa2fd('0x4'));var auth=require(_0xa2fd('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router[_0xa2fd('0x6')]('/',auth[_0xa2fd('0x7')](),controller['index']);router[_0xa2fd('0x6')](_0xa2fd('0x8'),auth[_0xa2fd('0x7')](),controller['show']);router[_0xa2fd('0x9')]('/',auth[_0xa2fd('0x7')](),controller[_0xa2fd('0xa')]);router[_0xa2fd('0xb')](_0xa2fd('0x8'),auth[_0xa2fd('0x7')](),controller['update']);router['delete']('/:id',auth[_0xa2fd('0x7')](),controller['destroy']);module[_0xa2fd('0xc')]=router; \ No newline at end of file +var _0x057a=['destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x057a,0x1a6));var _0xa057=function(_0x4157b7,_0x2080cc){_0x4157b7=_0x4157b7-0x0;var _0x2ae77c=_0x057a[_0x4157b7];return _0x2ae77c;};'use strict';var multer=require(_0xa057('0x0'));var util=require(_0xa057('0x1'));var path=require(_0xa057('0x2'));var timeout=require('connect-timeout');var express=require(_0xa057('0x3'));var router=express['Router']();var fs_extra=require(_0xa057('0x4'));var auth=require(_0xa057('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa057('0x6'));var controller=require(_0xa057('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa057('0x8')]);router[_0xa057('0x9')](_0xa057('0xa'),auth[_0xa057('0xb')](),controller[_0xa057('0xc')]);router[_0xa057('0xd')]('/',auth[_0xa057('0xb')](),controller[_0xa057('0xe')]);router[_0xa057('0xf')](_0xa057('0xa'),auth[_0xa057('0xb')](),controller[_0xa057('0x10')]);router[_0xa057('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa057('0x12')]);module[_0xa057('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index f90d336..54e72d5 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 _0x0806=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0806,0x179));var _0x6080=function(_0x5174a2,_0xcc516e){_0x5174a2=_0x5174a2-0x0;var _0x281d6b=_0x0806[_0x5174a2];return _0x281d6b;};'use strict';var Sequelize=require(_0x6080('0x0'));module[_0x6080('0x1')]={'type':{'type':Sequelize[_0x6080('0x2')](_0x6080('0x3'),_0x6080('0x4'),_0x6080('0x5'),_0x6080('0x6'),_0x6080('0x7')),'defaultValue':_0x6080('0x3')},'content':{'type':Sequelize[_0x6080('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6080('0x2')](_0x6080('0x3'),'variable',_0x6080('0x5'))},'keyContent':{'type':Sequelize[_0x6080('0x8')]},'idField':{'type':Sequelize[_0x6080('0x8')]},'nameField':{'type':Sequelize[_0x6080('0x8')]},'customField':{'type':Sequelize[_0x6080('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6080('0x8')]}}; \ No newline at end of file +var _0xaed3=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xaed3,0x1c6));var _0x3aed=function(_0x1a8bbc,_0x17a086){_0x1a8bbc=_0x1a8bbc-0x0;var _0x212fc2=_0xaed3[_0x1a8bbc];return _0x212fc2;};'use strict';var Sequelize=require(_0x3aed('0x0'));module[_0x3aed('0x1')]={'type':{'type':Sequelize[_0x3aed('0x2')](_0x3aed('0x3'),_0x3aed('0x4'),_0x3aed('0x5'),_0x3aed('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x3aed('0x7')]},'key':{'type':Sequelize[_0x3aed('0x7')]},'keyType':{'type':Sequelize[_0x3aed('0x2')]('string',_0x3aed('0x4'),_0x3aed('0x5'))},'keyContent':{'type':Sequelize[_0x3aed('0x7')]},'idField':{'type':Sequelize[_0x3aed('0x7')]},'nameField':{'type':Sequelize[_0x3aed('0x7')]},'customField':{'type':Sequelize[_0x3aed('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3aed('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 0a841ba..e2187e3 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 _0x708e=['query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','FreshsalesField','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','rimraf','fast-json-patch','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection'];(function(_0xe525c9,_0x5c612d){var _0x5dc0d9=function(_0x44bafe){while(--_0x44bafe){_0xe525c9['push'](_0xe525c9['shift']());}};_0x5dc0d9(++_0x5c612d);}(_0x708e,0x17b));var _0xe708=function(_0x3747ae,_0x408e61){_0x3747ae=_0x3747ae-0x0;var _0x339035=_0x708e[_0x3747ae];return _0x339035;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe708('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe708('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe708('0x2'));var Mustache=require('mustache');var util=require(_0xe708('0x3'));var path=require('path');var sox=require(_0xe708('0x4'));var csv=require(_0xe708('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe708('0x6'));var crypto=require(_0xe708('0x7'));var jsforce=require(_0xe708('0x8'));var deskjs=require(_0xe708('0x9'));var toCsv=require(_0xe708('0x5'));var querystring=require(_0xe708('0xa'));var Papa=require(_0xe708('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe708('0xc'));var as=require(_0xe708('0xd'));var hardwareService=require(_0xe708('0xe'));var logger=require(_0xe708('0xf'))('api');var utils=require('../../config/utils');var config=require(_0xe708('0x10'));var licenseUtil=require(_0xe708('0x11'));var db=require(_0xe708('0x12'))['db'];function respondWithStatusCode(_0x3c8384,_0x30362b){_0x30362b=_0x30362b||0xcc;return function(_0x2357c6){if(_0x2357c6){return _0x3c8384[_0xe708('0x13')](_0x30362b);}return _0x3c8384[_0xe708('0x14')](_0x30362b)[_0xe708('0x15')]();};}function respondWithResult(_0x3247e2,_0x43fea3){_0x43fea3=_0x43fea3||0xc8;return function(_0x352b99){if(_0x352b99){return _0x3247e2[_0xe708('0x14')](_0x43fea3)['json'](_0x352b99);}};}function respondWithFilteredResult(_0x2453ac,_0x50bceb){return function(_0x433065){if(_0x433065){var _0x6b1f45=typeof _0x50bceb[_0xe708('0x16')]===_0xe708('0x17')&&typeof _0x50bceb[_0xe708('0x18')]===_0xe708('0x17');var _0x2e8eb1=_0x433065[_0xe708('0x19')];var _0x4cfff9=_0x6b1f45?0x0:_0x50bceb['offset'];var _0xfac3f2=_0x6b1f45?_0x433065[_0xe708('0x19')]:_0x50bceb[_0xe708('0x16')]+_0x50bceb[_0xe708('0x18')];var _0x5870de;if(_0xfac3f2>=_0x2e8eb1){_0xfac3f2=_0x2e8eb1;_0x5870de=0xc8;}else{_0x5870de=0xce;}_0x2453ac[_0xe708('0x14')](_0x5870de);return _0x2453ac[_0xe708('0x1a')](_0xe708('0x1b'),_0x4cfff9+'-'+_0xfac3f2+'/'+_0x2e8eb1)['json'](_0x433065);}return null;};}function patchUpdates(_0x2a0a3e){return function(_0xef651a){try{jsonpatch[_0xe708('0x1c')](_0xef651a,_0x2a0a3e,!![]);}catch(_0xab7a3c){return BPromise[_0xe708('0x1d')](_0xab7a3c);}return _0xef651a[_0xe708('0x1e')]();};}function saveUpdates(_0x2ab511,_0x1fbb57){return function(_0x376794){if(_0x376794){return _0x376794[_0xe708('0x1f')](_0x2ab511)['then'](function(_0x38457b){return _0x38457b;});}return null;};}function removeEntity(_0x2cb02d,_0x48aa3b){return function(_0x2944e3){if(_0x2944e3){return _0x2944e3[_0xe708('0x20')]()[_0xe708('0x21')](function(){_0x2cb02d[_0xe708('0x14')](0xcc)[_0xe708('0x15')]();});}};}function handleEntityNotFound(_0x47a3a9,_0x8c2cf){return function(_0x118032){if(!_0x118032){_0x47a3a9['sendStatus'](0x194);}return _0x118032;};}function handleError(_0x45f4e3,_0xb6fe8c){_0xb6fe8c=_0xb6fe8c||0x1f4;return function(_0x3d8aee){logger[_0xe708('0x22')](_0x3d8aee[_0xe708('0x23')]);if(_0x3d8aee[_0xe708('0x24')]){delete _0x3d8aee[_0xe708('0x24')];}_0x45f4e3['status'](_0xb6fe8c)[_0xe708('0x25')](_0x3d8aee);};}exports['index']=function(_0x337b06,_0x1885e0){var _0x5d5f76={},_0x304965={},_0x6856f1={'count':0x0,'rows':[]};var _0x3c751b=_[_0xe708('0x26')](db['FreshsalesField'][_0xe708('0x27')],function(_0x1bc6f7){return{'name':_0x1bc6f7[_0xe708('0x28')],'type':_0x1bc6f7[_0xe708('0x29')][_0xe708('0x2a')]};});_0x304965[_0xe708('0x2b')]=_[_0xe708('0x26')](_0x3c751b,_0xe708('0x24'));_0x304965['query']=_[_0xe708('0x2c')](_0x337b06['query']);_0x304965[_0xe708('0x2d')]=_[_0xe708('0x2e')](_0x304965[_0xe708('0x2b')],_0x304965[_0xe708('0x2f')]);_0x5d5f76[_0xe708('0x30')]=_[_0xe708('0x2e')](_0x304965[_0xe708('0x2b')],qs['fields'](_0x337b06[_0xe708('0x2f')][_0xe708('0x31')]));_0x5d5f76['attributes']=_0x5d5f76['attributes'][_0xe708('0x32')]?_0x5d5f76[_0xe708('0x30')]:_0x304965[_0xe708('0x2b')];if(!_0x337b06['query'][_0xe708('0x33')](_0xe708('0x34'))){_0x5d5f76['limit']=qs[_0xe708('0x18')](_0x337b06[_0xe708('0x2f')][_0xe708('0x18')]);_0x5d5f76[_0xe708('0x16')]=qs[_0xe708('0x16')](_0x337b06[_0xe708('0x2f')][_0xe708('0x16')]);}_0x5d5f76[_0xe708('0x35')]=qs[_0xe708('0x36')](_0x337b06[_0xe708('0x2f')][_0xe708('0x36')]);_0x5d5f76['where']=qs[_0xe708('0x2d')](_['pick'](_0x337b06[_0xe708('0x2f')],_0x304965['filters']),_0x3c751b);if(_0x337b06[_0xe708('0x2f')][_0xe708('0x37')]){_0x5d5f76[_0xe708('0x38')]=_['merge'](_0x5d5f76[_0xe708('0x38')],{'$or':_['map'](_0x3c751b,function(_0x260c5f){if(_0x260c5f[_0xe708('0x29')]!==_0xe708('0x39')){var _0x33e977={};_0x33e977[_0x260c5f[_0xe708('0x24')]]={'$like':'%'+_0x337b06[_0xe708('0x2f')][_0xe708('0x37')]+'%'};return _0x33e977;}})});}_0x5d5f76=_[_0xe708('0x3a')]({},_0x5d5f76,_0x337b06['options']);var _0x130fea={'where':_0x5d5f76['where']};return db[_0xe708('0x3b')][_0xe708('0x19')](_0x130fea)[_0xe708('0x21')](function(_0x133e92){_0x6856f1['count']=_0x133e92;if(_0x337b06['query']['includeAll']){_0x5d5f76[_0xe708('0x3c')]=[{'all':!![]}];}return db[_0xe708('0x3b')][_0xe708('0x3d')](_0x5d5f76);})['then'](function(_0xceb0c2){_0x6856f1[_0xe708('0x3e')]=_0xceb0c2;return _0x6856f1;})[_0xe708('0x21')](respondWithFilteredResult(_0x1885e0,_0x5d5f76))[_0xe708('0x3f')](handleError(_0x1885e0,null));};exports[_0xe708('0x40')]=function(_0x265873,_0x5b12a7){var _0x4b3162={'raw':!![],'where':{'id':_0x265873['params']['id']}},_0x55ecb9={};_0x55ecb9[_0xe708('0x2b')]=_[_0xe708('0x2c')](db['FreshsalesField'][_0xe708('0x27')]);_0x55ecb9['query']=_[_0xe708('0x2c')](_0x265873['query']);_0x55ecb9[_0xe708('0x2d')]=_[_0xe708('0x2e')](_0x55ecb9[_0xe708('0x2b')],_0x55ecb9['query']);_0x4b3162['attributes']=_[_0xe708('0x2e')](_0x55ecb9['model'],qs[_0xe708('0x31')](_0x265873[_0xe708('0x2f')]['fields']));_0x4b3162[_0xe708('0x30')]=_0x4b3162[_0xe708('0x30')]['length']?_0x4b3162['attributes']:_0x55ecb9['model'];if(_0x265873['query'][_0xe708('0x41')]){_0x4b3162[_0xe708('0x3c')]=[{'all':!![]}];}_0x4b3162=_['merge']({},_0x4b3162,_0x265873[_0xe708('0x42')]);return db[_0xe708('0x3b')][_0xe708('0x43')](_0x4b3162)['then'](handleEntityNotFound(_0x5b12a7,null))[_0xe708('0x21')](respondWithResult(_0x5b12a7,null))[_0xe708('0x3f')](handleError(_0x5b12a7,null));};exports['create']=function(_0x348021,_0x2a729f){return db[_0xe708('0x3b')][_0xe708('0x44')](_0x348021['body'],{})[_0xe708('0x21')](respondWithResult(_0x2a729f,0xc9))[_0xe708('0x3f')](handleError(_0x2a729f,null));};exports['update']=function(_0x4bba3f,_0x13ffab){if(_0x4bba3f[_0xe708('0x45')]['id']){delete _0x4bba3f[_0xe708('0x45')]['id'];}return db['FreshsalesField'][_0xe708('0x43')]({'where':{'id':_0x4bba3f[_0xe708('0x46')]['id']}})[_0xe708('0x21')](handleEntityNotFound(_0x13ffab,null))[_0xe708('0x21')](saveUpdates(_0x4bba3f['body'],null))[_0xe708('0x21')](respondWithResult(_0x13ffab,null))['catch'](handleError(_0x13ffab,null));};exports[_0xe708('0x20')]=function(_0x20ed5e,_0x29e5b1){return db['FreshsalesField'][_0xe708('0x43')]({'where':{'id':_0x20ed5e[_0xe708('0x46')]['id']}})[_0xe708('0x21')](handleEntityNotFound(_0x29e5b1,null))[_0xe708('0x21')](removeEntity(_0x29e5b1,null))[_0xe708('0x3f')](handleError(_0x29e5b1,null));}; \ No newline at end of file +var _0x14e8=['bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','FreshsalesField','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','merge','find','create','body','catch','rimraf','fast-json-patch','moment'];(function(_0x5c6b72,_0x134dcb){var _0x45e9e3=function(_0xe7eb97){while(--_0xe7eb97){_0x5c6b72['push'](_0x5c6b72['shift']());}};_0x45e9e3(++_0x134dcb);}(_0x14e8,0x1b9));var _0x814e=function(_0x5a2b06,_0x254bbb){_0x5a2b06=_0x5a2b06-0x0;var _0x40e9b0=_0x14e8[_0x5a2b06];return _0x40e9b0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x814e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x814e('0x1'));var rp=require('request-promise');var moment=require(_0x814e('0x2'));var BPromise=require(_0x814e('0x3'));var Mustache=require(_0x814e('0x4'));var util=require(_0x814e('0x5'));var path=require(_0x814e('0x6'));var sox=require('sox');var csv=require(_0x814e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x814e('0x8'));var _=require(_0x814e('0x9'));var squel=require(_0x814e('0xa'));var crypto=require('crypto');var jsforce=require(_0x814e('0xb'));var deskjs=require(_0x814e('0xc'));var toCsv=require(_0x814e('0x7'));var querystring=require(_0x814e('0xd'));var Papa=require(_0x814e('0xe'));var Redis=require(_0x814e('0xf'));var authService=require(_0x814e('0x10'));var qs=require(_0x814e('0x11'));var as=require(_0x814e('0x12'));var hardwareService=require(_0x814e('0x13'));var logger=require('../../config/logger')(_0x814e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x814e('0x15'));var db=require(_0x814e('0x16'))['db'];function respondWithStatusCode(_0x4bc2c2,_0x1340f5){_0x1340f5=_0x1340f5||0xcc;return function(_0x1995b4){if(_0x1995b4){return _0x4bc2c2[_0x814e('0x17')](_0x1340f5);}return _0x4bc2c2[_0x814e('0x18')](_0x1340f5)[_0x814e('0x19')]();};}function respondWithResult(_0x91d96b,_0x33fd74){_0x33fd74=_0x33fd74||0xc8;return function(_0x106503){if(_0x106503){return _0x91d96b[_0x814e('0x18')](_0x33fd74)[_0x814e('0x1a')](_0x106503);}};}function respondWithFilteredResult(_0x5e8870,_0x34b9b2){return function(_0x1941eb){if(_0x1941eb){var _0x5649a1=typeof _0x34b9b2[_0x814e('0x1b')]===_0x814e('0x1c')&&typeof _0x34b9b2[_0x814e('0x1d')]===_0x814e('0x1c');var _0x3514f4=_0x1941eb[_0x814e('0x1e')];var _0x421be0=_0x5649a1?0x0:_0x34b9b2['offset'];var _0x30f39f=_0x5649a1?_0x1941eb[_0x814e('0x1e')]:_0x34b9b2[_0x814e('0x1b')]+_0x34b9b2[_0x814e('0x1d')];var _0x485397;if(_0x30f39f>=_0x3514f4){_0x30f39f=_0x3514f4;_0x485397=0xc8;}else{_0x485397=0xce;}_0x5e8870['status'](_0x485397);return _0x5e8870[_0x814e('0x1f')](_0x814e('0x20'),_0x421be0+'-'+_0x30f39f+'/'+_0x3514f4)[_0x814e('0x1a')](_0x1941eb);}return null;};}function patchUpdates(_0x3e66d7){return function(_0x1d47a3){try{jsonpatch['apply'](_0x1d47a3,_0x3e66d7,!![]);}catch(_0x159539){return BPromise[_0x814e('0x21')](_0x159539);}return _0x1d47a3[_0x814e('0x22')]();};}function saveUpdates(_0x301814,_0x2bdc72){return function(_0x50097a){if(_0x50097a){return _0x50097a[_0x814e('0x23')](_0x301814)[_0x814e('0x24')](function(_0x14cb47){return _0x14cb47;});}return null;};}function removeEntity(_0x308372,_0x15aa7f){return function(_0x24b4cc){if(_0x24b4cc){return _0x24b4cc[_0x814e('0x25')]()['then'](function(){_0x308372['status'](0xcc)[_0x814e('0x19')]();});}};}function handleEntityNotFound(_0x4c18b3,_0x18afda){return function(_0x38168c){if(!_0x38168c){_0x4c18b3[_0x814e('0x17')](0x194);}return _0x38168c;};}function handleError(_0x2212a0,_0xdd8155){_0xdd8155=_0xdd8155||0x1f4;return function(_0xaab2af){logger['error'](_0xaab2af[_0x814e('0x26')]);if(_0xaab2af[_0x814e('0x27')]){delete _0xaab2af['name'];}_0x2212a0[_0x814e('0x18')](_0xdd8155)[_0x814e('0x28')](_0xaab2af);};}exports['index']=function(_0x45cf21,_0x5baa8e){var _0x2699e8={},_0x4f79fa={},_0x313374={'count':0x0,'rows':[]};var _0x384f65=_['map'](db[_0x814e('0x29')][_0x814e('0x2a')],function(_0x32ab5c){return{'name':_0x32ab5c[_0x814e('0x2b')],'type':_0x32ab5c[_0x814e('0x2c')][_0x814e('0x2d')]};});_0x4f79fa['model']=_[_0x814e('0x2e')](_0x384f65,_0x814e('0x27'));_0x4f79fa[_0x814e('0x2f')]=_[_0x814e('0x30')](_0x45cf21[_0x814e('0x2f')]);_0x4f79fa[_0x814e('0x31')]=_[_0x814e('0x32')](_0x4f79fa['model'],_0x4f79fa[_0x814e('0x2f')]);_0x2699e8[_0x814e('0x33')]=_[_0x814e('0x32')](_0x4f79fa[_0x814e('0x34')],qs[_0x814e('0x35')](_0x45cf21[_0x814e('0x2f')][_0x814e('0x35')]));_0x2699e8['attributes']=_0x2699e8[_0x814e('0x33')][_0x814e('0x36')]?_0x2699e8[_0x814e('0x33')]:_0x4f79fa['model'];if(!_0x45cf21[_0x814e('0x2f')][_0x814e('0x37')](_0x814e('0x38'))){_0x2699e8[_0x814e('0x1d')]=qs[_0x814e('0x1d')](_0x45cf21[_0x814e('0x2f')][_0x814e('0x1d')]);_0x2699e8['offset']=qs[_0x814e('0x1b')](_0x45cf21[_0x814e('0x2f')][_0x814e('0x1b')]);}_0x2699e8['order']=qs[_0x814e('0x39')](_0x45cf21[_0x814e('0x2f')][_0x814e('0x39')]);_0x2699e8[_0x814e('0x3a')]=qs[_0x814e('0x31')](_[_0x814e('0x3b')](_0x45cf21['query'],_0x4f79fa[_0x814e('0x31')]),_0x384f65);if(_0x45cf21[_0x814e('0x2f')][_0x814e('0x3c')]){_0x2699e8[_0x814e('0x3a')]=_['merge'](_0x2699e8[_0x814e('0x3a')],{'$or':_[_0x814e('0x2e')](_0x384f65,function(_0x4d181b){if(_0x4d181b[_0x814e('0x2c')]!==_0x814e('0x3d')){var _0x11fc30={};_0x11fc30[_0x4d181b[_0x814e('0x27')]]={'$like':'%'+_0x45cf21['query'][_0x814e('0x3c')]+'%'};return _0x11fc30;}})});}_0x2699e8=_['merge']({},_0x2699e8,_0x45cf21[_0x814e('0x3e')]);var _0x45f882={'where':_0x2699e8[_0x814e('0x3a')]};return db['FreshsalesField'][_0x814e('0x1e')](_0x45f882)[_0x814e('0x24')](function(_0x58a218){_0x313374['count']=_0x58a218;if(_0x45cf21[_0x814e('0x2f')][_0x814e('0x3f')]){_0x2699e8[_0x814e('0x40')]=[{'all':!![]}];}return db[_0x814e('0x29')][_0x814e('0x41')](_0x2699e8);})[_0x814e('0x24')](function(_0x593c8d){_0x313374[_0x814e('0x42')]=_0x593c8d;return _0x313374;})[_0x814e('0x24')](respondWithFilteredResult(_0x5baa8e,_0x2699e8))['catch'](handleError(_0x5baa8e,null));};exports[_0x814e('0x43')]=function(_0x1a6157,_0xf80e16){var _0x41ca15={'raw':!![],'where':{'id':_0x1a6157[_0x814e('0x44')]['id']}},_0x29259c={};_0x29259c[_0x814e('0x34')]=_['keys'](db[_0x814e('0x29')][_0x814e('0x2a')]);_0x29259c[_0x814e('0x2f')]=_['keys'](_0x1a6157['query']);_0x29259c[_0x814e('0x31')]=_[_0x814e('0x32')](_0x29259c[_0x814e('0x34')],_0x29259c[_0x814e('0x2f')]);_0x41ca15['attributes']=_[_0x814e('0x32')](_0x29259c[_0x814e('0x34')],qs[_0x814e('0x35')](_0x1a6157[_0x814e('0x2f')][_0x814e('0x35')]));_0x41ca15[_0x814e('0x33')]=_0x41ca15[_0x814e('0x33')][_0x814e('0x36')]?_0x41ca15[_0x814e('0x33')]:_0x29259c['model'];if(_0x1a6157[_0x814e('0x2f')]['includeAll']){_0x41ca15['include']=[{'all':!![]}];}_0x41ca15=_[_0x814e('0x45')]({},_0x41ca15,_0x1a6157['options']);return db[_0x814e('0x29')][_0x814e('0x46')](_0x41ca15)[_0x814e('0x24')](handleEntityNotFound(_0xf80e16,null))[_0x814e('0x24')](respondWithResult(_0xf80e16,null))['catch'](handleError(_0xf80e16,null));};exports[_0x814e('0x47')]=function(_0x3b7839,_0x27370c){return db['FreshsalesField'][_0x814e('0x47')](_0x3b7839[_0x814e('0x48')],{})[_0x814e('0x24')](respondWithResult(_0x27370c,0xc9))[_0x814e('0x49')](handleError(_0x27370c,null));};exports[_0x814e('0x23')]=function(_0xcd5a66,_0x384be8){if(_0xcd5a66[_0x814e('0x48')]['id']){delete _0xcd5a66[_0x814e('0x48')]['id'];}return db['FreshsalesField'][_0x814e('0x46')]({'where':{'id':_0xcd5a66[_0x814e('0x44')]['id']}})['then'](handleEntityNotFound(_0x384be8,null))[_0x814e('0x24')](saveUpdates(_0xcd5a66[_0x814e('0x48')],null))[_0x814e('0x24')](respondWithResult(_0x384be8,null))[_0x814e('0x49')](handleError(_0x384be8,null));};exports['destroy']=function(_0x6804c1,_0x394c2c){return db[_0x814e('0x29')][_0x814e('0x46')]({'where':{'id':_0x6804c1[_0x814e('0x44')]['id']}})['then'](handleEntityNotFound(_0x394c2c,null))['then'](removeEntity(_0x394c2c,null))[_0x814e('0x49')](handleError(_0x394c2c,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index bb00975..133960d 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 _0x4959=['FieldId','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField'];(function(_0xa7ea60,_0x432302){var _0x35e830=function(_0x3f89b9){while(--_0x3f89b9){_0xa7ea60['push'](_0xa7ea60['shift']());}};_0x35e830(++_0x432302);}(_0x4959,0x9b));var _0x9495=function(_0x2edbd1,_0x5e0af9){_0x2edbd1=_0x2edbd1-0x0;var _0x380595=_0x4959[_0x2edbd1];return _0x380595;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9495('0x0'))(_0x9495('0x1'));var moment=require(_0x9495('0x2'));var BPromise=require('bluebird');var rp=require(_0x9495('0x3'));var fs=require('fs');var path=require(_0x9495('0x4'));var rimraf=require(_0x9495('0x5'));var config=require(_0x9495('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0x9495('0x7')]=function(_0x2225a0,_0x2c716d){return _0x2225a0[_0x9495('0x8')](_0x9495('0x9'),attributes,{'tableName':_0x9495('0xa'),'paranoid':![],'indexes':[{'name':_0x9495('0xb'),'fields':[_0x9495('0xc'),_0x9495('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x45d8=['path','../../config/environment','./intFreshsalesField.attributes','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x47dd85,_0x2c5ce3){var _0x11356a=function(_0x22146c){while(--_0x22146c){_0x47dd85['push'](_0x47dd85['shift']());}};_0x11356a(++_0x2c5ce3);}(_0x45d8,0x174));var _0x845d=function(_0x22ee0f,_0x22e6d2){_0x22ee0f=_0x22ee0f-0x0;var _0x204696=_0x45d8[_0x22ee0f];return _0x204696;};'use strict';var _=require(_0x845d('0x0'));var util=require(_0x845d('0x1'));var logger=require(_0x845d('0x2'))(_0x845d('0x3'));var moment=require(_0x845d('0x4'));var BPromise=require(_0x845d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x845d('0x6'));var rimraf=require('rimraf');var config=require(_0x845d('0x7'));var attributes=require(_0x845d('0x8'));module['exports']=function(_0x4ba664,_0x312806){return _0x4ba664['define'](_0x845d('0x9'),attributes,{'tableName':_0x845d('0xa'),'paranoid':![],'indexes':[{'name':_0x845d('0xb'),'fields':[_0x845d('0xc'),_0x845d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 61a55ab..da16359 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 _0x326f=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4a2f4c,_0x4e93c9){var _0x4253e3=function(_0x5537a7){while(--_0x5537a7){_0x4a2f4c['push'](_0x4a2f4c['shift']());}};_0x4253e3(++_0x4e93c9);}(_0x326f,0xd1));var _0xf326=function(_0x767165,_0x25c55b){_0x767165=_0x767165-0x0;var _0x2b9a5f=_0x326f[_0x767165];return _0x2b9a5f;};'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')]('FreshsalesField,\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')]('FreshsalesField,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +var _0x1261=['then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\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(_0x4b62a6,_0x4a4e4f){var _0x39e3fa=function(_0xf5b0d1){while(--_0xf5b0d1){_0x4b62a6['push'](_0x4b62a6['shift']());}};_0x39e3fa(++_0x4a4e4f);}(_0x1261,0x144));var _0x1126=function(_0x114ae4,_0x14bdc9){_0x114ae4=_0x114ae4-0x0;var _0x32f566=_0x1261[_0x114ae4];return _0x32f566;};'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')]('FreshsalesField,\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/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index bc4f527..e32246b 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(_0x420d9f,_0xf1a8ce){var _0x501d3a=function(_0x2b804e){while(--_0x2b804e){_0x420d9f['push'](_0x420d9f['shift']());}};_0x501d3a(++_0xf1a8ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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(_0x2f2fcb,_0x5d36b0){var _0x386b00=function(_0x57d13f){while(--_0x57d13f){_0x2f2fcb['push'](_0x2f2fcb['shift']());}};_0x386b00(++_0x5d36b0);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 634d33d..c988d74 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 _0x95c3=['newTab','STRING','ENUM','integrationTab'];(function(_0x812607,_0x36bddb){var _0x8c5ac9=function(_0x4759b4){while(--_0x4759b4){_0x812607['push'](_0x812607['shift']());}};_0x8c5ac9(++_0x36bddb);}(_0x95c3,0x6d));var _0x395c=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0x95c3[_0x247fa1];return _0x244f35;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x395c('0x0')]},'description':{'type':Sequelize[_0x395c('0x0')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0x395c('0x0')]},'password':{'type':Sequelize[_0x395c('0x0')]},'clientId':{'type':Sequelize[_0x395c('0x0')]},'clientSecret':{'type':Sequelize[_0x395c('0x0')]},'securityToken':{'type':Sequelize[_0x395c('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x395c('0x1')](_0x395c('0x2'),_0x395c('0x3')),'defaultValue':_0x395c('0x2')}}; \ No newline at end of file +var _0x093f=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x093f,0xd2));var _0xf093=function(_0x16023c,_0x6305c9){_0x16023c=_0x16023c-0x0;var _0x230534=_0x093f[_0x16023c];return _0x230534;};'use strict';var Sequelize=require(_0xf093('0x0'));module[_0xf093('0x1')]={'name':{'type':Sequelize[_0xf093('0x2')]},'description':{'type':Sequelize[_0xf093('0x2')]},'username':{'type':Sequelize[_0xf093('0x2')],'unique':_0xf093('0x3')},'remoteUri':{'type':Sequelize[_0xf093('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xf093('0x2')]},'clientSecret':{'type':Sequelize[_0xf093('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf093('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf093('0x4')](_0xf093('0x5'),_0xf093('0x6')),'defaultValue':_0xf093('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index c4c514f..996eefe 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 _0x35e2=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','SalesforceConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','Task','findOne','username','password','securityToken','remoteUri','slice','lastIndexOf','clientSecret','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','Description','string','int','picklist','boolean','email','includes','custom','picklistValues','label','value','True','true','False','false','stringify','test','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch'];(function(_0x4d0c1f,_0x1c434b){var _0x552ef2=function(_0x715917){while(--_0x715917){_0x4d0c1f['push'](_0x4d0c1f['shift']());}};_0x552ef2(++_0x1c434b);}(_0x35e2,0x1ed));var _0x235e=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x35e2[_0x15bc81];return _0x59440e;};'use strict';var emlformat=require(_0x235e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x235e('0x1'));var jsonpatch=require(_0x235e('0x2'));var rp=require(_0x235e('0x3'));var moment=require('moment');var BPromise=require(_0x235e('0x4'));var Mustache=require(_0x235e('0x5'));var util=require(_0x235e('0x6'));var path=require(_0x235e('0x7'));var sox=require(_0x235e('0x8'));var csv=require(_0x235e('0x9'));var ejs=require(_0x235e('0xa'));var fs=require('fs');var fs_extra=require(_0x235e('0xb'));var _=require(_0x235e('0xc'));var squel=require(_0x235e('0xd'));var crypto=require(_0x235e('0xe'));var jsforce=require(_0x235e('0xf'));var deskjs=require(_0x235e('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x235e('0x11'));var Redis=require(_0x235e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x235e('0x13'));var as=require(_0x235e('0x14'));var hardwareService=require(_0x235e('0x15'));var logger=require(_0x235e('0x16'))(_0x235e('0x17'));var utils=require(_0x235e('0x18'));var config=require(_0x235e('0x19'));var licenseUtil=require(_0x235e('0x1a'));var db=require(_0x235e('0x1b'))['db'];var integrations=require(_0x235e('0x1c'));function respondWithStatusCode(_0x3dfbd7,_0x244724){_0x244724=_0x244724||0xcc;return function(_0x35215f){if(_0x35215f){return _0x3dfbd7[_0x235e('0x1d')](_0x244724);}return _0x3dfbd7['status'](_0x244724)['end']();};}function respondWithResult(_0xbe5aaf,_0x2f5b0d){_0x2f5b0d=_0x2f5b0d||0xc8;return function(_0x142f68){if(_0x142f68){return _0xbe5aaf[_0x235e('0x1e')](_0x2f5b0d)[_0x235e('0x1f')](_0x142f68);}};}function respondWithFilteredResult(_0x2564c3,_0x49c8ac){return function(_0x5135a9){if(_0x5135a9){var _0x4723d4=typeof _0x49c8ac[_0x235e('0x20')]===_0x235e('0x21')&&typeof _0x49c8ac[_0x235e('0x22')]===_0x235e('0x21');var _0x1ee7c9=_0x5135a9[_0x235e('0x23')];var _0x526cf7=_0x4723d4?0x0:_0x49c8ac[_0x235e('0x20')];var _0x5b2064=_0x4723d4?_0x5135a9[_0x235e('0x23')]:_0x49c8ac[_0x235e('0x20')]+_0x49c8ac[_0x235e('0x22')];var _0x525860;if(_0x5b2064>=_0x1ee7c9){_0x5b2064=_0x1ee7c9;_0x525860=0xc8;}else{_0x525860=0xce;}_0x2564c3[_0x235e('0x1e')](_0x525860);return _0x2564c3[_0x235e('0x24')](_0x235e('0x25'),_0x526cf7+'-'+_0x5b2064+'/'+_0x1ee7c9)[_0x235e('0x1f')](_0x5135a9);}return null;};}function patchUpdates(_0x2acf82){return function(_0x461b53){try{jsonpatch[_0x235e('0x26')](_0x461b53,_0x2acf82,!![]);}catch(_0x4473c8){return BPromise[_0x235e('0x27')](_0x4473c8);}return _0x461b53[_0x235e('0x28')]();};}function saveUpdates(_0x4149ea,_0xb24d05){return function(_0x1f1b3d){if(_0x1f1b3d){return _0x1f1b3d['update'](_0x4149ea)[_0x235e('0x29')](function(_0xc43cfc){return _0xc43cfc;});}return null;};}function removeEntity(_0x2b1dd1,_0x1acb81){return function(_0x113128){if(_0x113128){return _0x113128[_0x235e('0x2a')]()['then'](function(){_0x2b1dd1[_0x235e('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1478c0,_0xff022){return function(_0x5bf1f8){if(!_0x5bf1f8){_0x1478c0[_0x235e('0x1d')](0x194);}return _0x5bf1f8;};}function handleError(_0x8ec5b9,_0x1913c7){_0x1913c7=_0x1913c7||0x1f4;return function(_0x3fbd7c){logger[_0x235e('0x2b')](_0x3fbd7c[_0x235e('0x2c')]);if(_0x3fbd7c[_0x235e('0x2d')]){delete _0x3fbd7c[_0x235e('0x2d')];}_0x8ec5b9[_0x235e('0x1e')](_0x1913c7)[_0x235e('0x2e')](_0x3fbd7c);};}exports[_0x235e('0x2f')]=function(_0x3017ef,_0x46fdb2){var _0x2e8239={},_0xc760a9={},_0x2908a2={'count':0x0,'rows':[]};var _0x13104b=_['map'](db[_0x235e('0x30')][_0x235e('0x31')],function(_0x3102d9){return{'name':_0x3102d9[_0x235e('0x32')],'type':_0x3102d9[_0x235e('0x33')][_0x235e('0x34')]};});_0xc760a9['model']=_[_0x235e('0x35')](_0x13104b,_0x235e('0x2d'));_0xc760a9[_0x235e('0x36')]=_[_0x235e('0x37')](_0x3017ef[_0x235e('0x36')]);_0xc760a9[_0x235e('0x38')]=_[_0x235e('0x39')](_0xc760a9['model'],_0xc760a9[_0x235e('0x36')]);_0x2e8239[_0x235e('0x3a')]=_['intersection'](_0xc760a9[_0x235e('0x3b')],qs[_0x235e('0x3c')](_0x3017ef[_0x235e('0x36')][_0x235e('0x3c')]));_0x2e8239['attributes']=_0x2e8239['attributes'][_0x235e('0x3d')]?_0x2e8239[_0x235e('0x3a')]:_0xc760a9[_0x235e('0x3b')];if(!_0x3017ef[_0x235e('0x36')]['hasOwnProperty'](_0x235e('0x3e'))){_0x2e8239[_0x235e('0x22')]=qs['limit'](_0x3017ef[_0x235e('0x36')][_0x235e('0x22')]);_0x2e8239[_0x235e('0x20')]=qs['offset'](_0x3017ef[_0x235e('0x36')][_0x235e('0x20')]);}_0x2e8239[_0x235e('0x3f')]=qs['sort'](_0x3017ef[_0x235e('0x36')][_0x235e('0x40')]);_0x2e8239[_0x235e('0x41')]=qs[_0x235e('0x38')](_[_0x235e('0x42')](_0x3017ef[_0x235e('0x36')],_0xc760a9[_0x235e('0x38')]),_0x13104b);if(_0x3017ef[_0x235e('0x36')][_0x235e('0x43')]){_0x2e8239[_0x235e('0x41')]=_[_0x235e('0x44')](_0x2e8239['where'],{'$or':_['map'](_0x13104b,function(_0x485282){if(_0x485282[_0x235e('0x33')]!==_0x235e('0x45')){var _0x468126={};_0x468126[_0x485282['name']]={'$like':'%'+_0x3017ef['query'][_0x235e('0x43')]+'%'};return _0x468126;}})});}_0x2e8239=_[_0x235e('0x44')]({},_0x2e8239,_0x3017ef[_0x235e('0x46')]);var _0x59cf39={'where':_0x2e8239[_0x235e('0x41')]};return db[_0x235e('0x30')][_0x235e('0x23')](_0x59cf39)[_0x235e('0x29')](function(_0x20565e){_0x2908a2[_0x235e('0x23')]=_0x20565e;if(_0x3017ef['query'][_0x235e('0x47')]){_0x2e8239[_0x235e('0x48')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x235e('0x49')](_0x2e8239);})[_0x235e('0x29')](function(_0x4e5afd){_0x2908a2['rows']=_0x4e5afd;return _0x2908a2;})[_0x235e('0x29')](respondWithFilteredResult(_0x46fdb2,_0x2e8239))[_0x235e('0x4a')](handleError(_0x46fdb2,null));};exports[_0x235e('0x4b')]=function(_0x572ba2,_0x2a0c38){var _0xc144dc={'raw':![],'where':{'id':_0x572ba2[_0x235e('0x4c')]['id']}},_0xddbb0c={};_0xddbb0c['model']=_[_0x235e('0x37')](db[_0x235e('0x30')]['rawAttributes']);_0xddbb0c[_0x235e('0x36')]=_['keys'](_0x572ba2[_0x235e('0x36')]);_0xddbb0c[_0x235e('0x38')]=_[_0x235e('0x39')](_0xddbb0c['model'],_0xddbb0c[_0x235e('0x36')]);_0xc144dc[_0x235e('0x3a')]=_['intersection'](_0xddbb0c[_0x235e('0x3b')],qs['fields'](_0x572ba2[_0x235e('0x36')][_0x235e('0x3c')]));_0xc144dc['attributes']=_0xc144dc[_0x235e('0x3a')][_0x235e('0x3d')]?_0xc144dc[_0x235e('0x3a')]:_0xddbb0c[_0x235e('0x3b')];if(_0x572ba2[_0x235e('0x36')][_0x235e('0x47')]){_0xc144dc[_0x235e('0x48')]=[{'all':!![]}];}_0xc144dc=_['merge']({},_0xc144dc,_0x572ba2[_0x235e('0x46')]);return db['SalesforceAccount'][_0x235e('0x4d')](_0xc144dc)[_0x235e('0x29')](handleEntityNotFound(_0x2a0c38,null))[_0x235e('0x29')](respondWithResult(_0x2a0c38,null))[_0x235e('0x4a')](handleError(_0x2a0c38,null));};exports['create']=function(_0x13830d,_0x54dc9d){return db[_0x235e('0x30')][_0x235e('0x4e')](_0x13830d['body'],{})[_0x235e('0x29')](respondWithResult(_0x54dc9d,0xc9))[_0x235e('0x4a')](handleError(_0x54dc9d,null));};exports['update']=function(_0x661795,_0x62ee11){if(_0x661795['body']['id']){delete _0x661795['body']['id'];}return db[_0x235e('0x30')]['find']({'where':{'id':_0x661795[_0x235e('0x4c')]['id']}})[_0x235e('0x29')](handleEntityNotFound(_0x62ee11,null))[_0x235e('0x29')](saveUpdates(_0x661795[_0x235e('0x4f')],null))[_0x235e('0x29')](respondWithResult(_0x62ee11,null))['catch'](handleError(_0x62ee11,null));};exports['destroy']=function(_0x51a09f,_0x408b15){return db[_0x235e('0x30')][_0x235e('0x4d')]({'where':{'id':_0x51a09f[_0x235e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x408b15,null))[_0x235e('0x29')](removeEntity(_0x408b15,null))['catch'](handleError(_0x408b15,null));};exports['getConfigurations']=function(_0x42e6c6,_0x3b409e,_0x991486){var _0xb74128={};var _0x4838c5={};var _0x31edb1;var _0x235a1d;return db[_0x235e('0x30')]['findOne']({'where':{'id':_0x42e6c6[_0x235e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3b409e,null))[_0x235e('0x29')](function(_0x1a2e92){if(_0x1a2e92){_0x31edb1=_0x1a2e92;_0x4838c5[_0x235e('0x3b')]=_[_0x235e('0x37')](db[_0x235e('0x50')][_0x235e('0x31')]);_0x4838c5[_0x235e('0x36')]=_['keys'](_0x42e6c6['query']);_0x4838c5[_0x235e('0x38')]=_[_0x235e('0x39')](_0x4838c5[_0x235e('0x3b')],_0x4838c5[_0x235e('0x36')]);_0xb74128[_0x235e('0x3a')]=_[_0x235e('0x39')](_0x4838c5['model'],qs['fields'](_0x42e6c6[_0x235e('0x36')]['fields']));_0xb74128[_0x235e('0x3a')]=_0xb74128[_0x235e('0x3a')][_0x235e('0x3d')]?_0xb74128[_0x235e('0x3a')]:_0x4838c5[_0x235e('0x3b')];_0xb74128[_0x235e('0x3f')]=qs[_0x235e('0x40')](_0x42e6c6[_0x235e('0x36')][_0x235e('0x40')]);_0xb74128[_0x235e('0x41')]=qs['filters'](_[_0x235e('0x42')](_0x42e6c6[_0x235e('0x36')],_0x4838c5[_0x235e('0x38')]));if(_0x42e6c6['query'][_0x235e('0x43')]){_0xb74128['where']=_[_0x235e('0x44')](_0xb74128[_0x235e('0x41')],{'$or':_[_0x235e('0x35')](_0xb74128[_0x235e('0x3a')],function(_0x5c5981){var _0x22166a={};_0x22166a[_0x5c5981]={'$like':'%'+_0x42e6c6[_0x235e('0x36')][_0x235e('0x43')]+'%'};return _0x22166a;})});}_0xb74128=_['merge']({},_0xb74128,_0x42e6c6['options']);return _0x31edb1[_0x235e('0x51')](_0xb74128);}})[_0x235e('0x29')](function(_0xafc113){if(_0xafc113){_0x235a1d=_0xafc113[_0x235e('0x3d')];if(!_0x42e6c6['query']['hasOwnProperty']('nolimit')){_0xb74128[_0x235e('0x22')]=qs[_0x235e('0x22')](_0x42e6c6[_0x235e('0x36')]['limit']);_0xb74128[_0x235e('0x20')]=qs['offset'](_0x42e6c6[_0x235e('0x36')][_0x235e('0x20')]);}return _0x31edb1[_0x235e('0x51')](_0xb74128);}})[_0x235e('0x29')](function(_0x77a6b7){if(_0x77a6b7){return _0x77a6b7?{'count':_0x235a1d,'rows':_0x77a6b7}:null;}})[_0x235e('0x29')](respondWithResult(_0x3b409e,null))[_0x235e('0x4a')](handleError(_0x3b409e,null));};exports[_0x235e('0x52')]=function(_0x464166,_0x4fb893,_0x309d42){if(_0x464166[_0x235e('0x4f')]['id']){delete _0x464166[_0x235e('0x4f')]['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x464166[_0x235e('0x4c')]['id']}})[_0x235e('0x29')](handleEntityNotFound(_0x4fb893,null))[_0x235e('0x29')](function(_0x3efe7a){if(_0x3efe7a){_0x464166[_0x235e('0x4f')][_0x235e('0x53')]=_0x3efe7a['id'];_0x464166['body'][_0x235e('0x54')]=integrations[_0x235e('0x55')](_0x464166[_0x235e('0x4f')][_0x235e('0x56')],_0x464166[_0x235e('0x4f')]['type']);_0x464166[_0x235e('0x4f')]['Descriptions']=integrations[_0x235e('0x57')](_0x464166['body'][_0x235e('0x56')],_0x464166[_0x235e('0x4f')]['type']);return db[_0x235e('0x50')]['create'](_0x464166['body'],{'include':[{'model':db[_0x235e('0x58')],'as':_0x235e('0x54')},{'model':db[_0x235e('0x58')],'as':_0x235e('0x59')}]});}return null;})[_0x235e('0x29')](respondWithResult(_0x4fb893,null))['catch'](handleError(_0x4fb893,null));};exports['getFields']=function(_0x3627a7,_0x1c976f,_0x4e6db3){var _0x48a0af;var _0x112b69='';var _0x4f35da=_0x235e('0x5a');return db['SalesforceAccount'][_0x235e('0x5b')]({'where':{'id':_0x3627a7[_0x235e('0x4c')]['id']},'attributes':['id','remoteUri','clientId','clientSecret',_0x235e('0x5c'),_0x235e('0x5d'),_0x235e('0x5e')]})[_0x235e('0x29')](handleEntityNotFound(_0x1c976f,null))[_0x235e('0x29')](function(_0x2607bb){if(_0x2607bb){_0x112b69=_0x2607bb[_0x235e('0x5f')];var _0x5da816=_0x112b69[_0x235e('0x60')](-0x1);if(_0x5da816==='/'){_0x112b69=_0x112b69['substring'](0x0,_0x112b69[_0x235e('0x61')](_0x5da816));}_0x48a0af=new jsforce['Connection']({'oauth2':{'loginUrl':_0x112b69,'clientId':_0x2607bb['clientId'],'clientSecret':_0x2607bb[_0x235e('0x62')]}});return _0x48a0af['login'](_0x2607bb[_0x235e('0x5c')],_0x2607bb[_0x235e('0x5d')]['concat'](_0x2607bb[_0x235e('0x5e')]));}})[_0x235e('0x29')](function(_0x9f2613){if(_0x9f2613){if(!_['isNil'](_0x3627a7[_0x235e('0x36')][_0x235e('0x63')])){_0x4f35da=_0x3627a7['query'][_0x235e('0x63')];}return _0x48a0af[_0x235e('0x64')](_0x4f35da)[_0x235e('0x65')]();}})['then'](function(_0x5738f9){var _0x5e113c=[_0x235e('0x66'),_0x235e('0x67'),_0x235e('0x68'),'IsRecurrence','Subject',_0x235e('0x69')];var _0x599dc5=[_0x235e('0x6a'),_0x235e('0x6b'),_0x235e('0x6c'),_0x235e('0x6d'),_0x235e('0x6e'),'textarea','phone'];if(_0x5738f9){_['remove'](_0x5738f9['fields'],function(_0x383076){return _0x5e113c[_0x235e('0x6f')](_0x383076[_0x235e('0x2d')])||!_0x599dc5[_0x235e('0x6f')](_0x383076['type']);});return{'count':_0x5738f9[_0x235e('0x3c')][_0x235e('0x3d')],'rows':_['map'](_0x5738f9[_0x235e('0x3c')],function(_0x1b5fcc){return{'id':_0x1b5fcc['name'],'name':_0x1b5fcc['label'],'custom':_0x1b5fcc[_0x235e('0x70')],'options':_0x1b5fcc[_0x235e('0x71')][_0x235e('0x3d')]>0x0?_[_0x235e('0x35')](_0x1b5fcc[_0x235e('0x71')],function(_0x5122ad){return{'name':_0x5122ad[_0x235e('0x72')],'value':_0x5122ad[_0x235e('0x73')]};}):_0x1b5fcc[_0x235e('0x33')]==_0x235e('0x6d')?[{'name':_0x235e('0x74'),'value':_0x235e('0x75')},{'name':_0x235e('0x76'),'value':_0x235e('0x77')}]:[]};})};}})[_0x235e('0x29')](respondWithResult(_0x1c976f,null))['catch'](function(_0x58d68e){var _0x565949=_0x3627a7[_0x235e('0x36')]['test']?0x1f4:_0x58d68e['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x565949,JSON[_0x235e('0x78')](_0x58d68e));delete _0x58d68e['name'];if(_0x565949===0x191){_0x565949=0x190;}_0x1c976f['status'](_0x565949)[_0x235e('0x2e')](_0x3627a7[_0x235e('0x36')][_0x235e('0x79')]?{'message':_0x235e('0x7a'),'statusCode':_0x58d68e[_0x235e('0x7b')]}:_0x58d68e);});}; \ No newline at end of file +var _0xd6e7=['update','then','destroy','end','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','catch','create','body','params','getConfigurations','findOne','SalesforceConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','Connection','login','ticketType','sobject','describe','OwnerId','ActivityDate','IsRecurrence','Subject','string','int','picklist','email','textarea','phone','remove','includes','custom','picklistValues','label','value','True','true','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','save'];(function(_0x2d0c35,_0x4a61b7){var _0x38c831=function(_0x347369){while(--_0x347369){_0x2d0c35['push'](_0x2d0c35['shift']());}};_0x38c831(++_0x4a61b7);}(_0xd6e7,0x157));var _0x7d6e=function(_0x5e6e0d,_0x16ab7e){_0x5e6e0d=_0x5e6e0d-0x0;var _0x129048=_0xd6e7[_0x5e6e0d];return _0x129048;};'use strict';var emlformat=require(_0x7d6e('0x0'));var rimraf=require(_0x7d6e('0x1'));var zipdir=require(_0x7d6e('0x2'));var jsonpatch=require(_0x7d6e('0x3'));var rp=require(_0x7d6e('0x4'));var moment=require(_0x7d6e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7d6e('0x6'));var util=require(_0x7d6e('0x7'));var path=require(_0x7d6e('0x8'));var sox=require(_0x7d6e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d6e('0xa'));var _=require(_0x7d6e('0xb'));var squel=require(_0x7d6e('0xc'));var crypto=require(_0x7d6e('0xd'));var jsforce=require(_0x7d6e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7d6e('0xf'));var querystring=require(_0x7d6e('0x10'));var Papa=require(_0x7d6e('0x11'));var Redis=require(_0x7d6e('0x12'));var authService=require(_0x7d6e('0x13'));var qs=require(_0x7d6e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d6e('0x15'));var logger=require(_0x7d6e('0x16'))(_0x7d6e('0x17'));var utils=require(_0x7d6e('0x18'));var config=require(_0x7d6e('0x19'));var licenseUtil=require(_0x7d6e('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7d6e('0x1b'));function respondWithStatusCode(_0x322348,_0x4079b5){_0x4079b5=_0x4079b5||0xcc;return function(_0x12a30c){if(_0x12a30c){return _0x322348[_0x7d6e('0x1c')](_0x4079b5);}return _0x322348[_0x7d6e('0x1d')](_0x4079b5)['end']();};}function respondWithResult(_0x14c757,_0x359300){_0x359300=_0x359300||0xc8;return function(_0x57dd46){if(_0x57dd46){return _0x14c757[_0x7d6e('0x1d')](_0x359300)[_0x7d6e('0x1e')](_0x57dd46);}};}function respondWithFilteredResult(_0x1fcf6d,_0x4b289d){return function(_0x3a2b1f){if(_0x3a2b1f){var _0xbf9d09=typeof _0x4b289d[_0x7d6e('0x1f')]==='undefined'&&typeof _0x4b289d[_0x7d6e('0x20')]===_0x7d6e('0x21');var _0x4ad585=_0x3a2b1f[_0x7d6e('0x22')];var _0x4b0593=_0xbf9d09?0x0:_0x4b289d[_0x7d6e('0x1f')];var _0x36f792=_0xbf9d09?_0x3a2b1f[_0x7d6e('0x22')]:_0x4b289d[_0x7d6e('0x1f')]+_0x4b289d[_0x7d6e('0x20')];var _0xf5dd4a;if(_0x36f792>=_0x4ad585){_0x36f792=_0x4ad585;_0xf5dd4a=0xc8;}else{_0xf5dd4a=0xce;}_0x1fcf6d[_0x7d6e('0x1d')](_0xf5dd4a);return _0x1fcf6d['set'](_0x7d6e('0x23'),_0x4b0593+'-'+_0x36f792+'/'+_0x4ad585)['json'](_0x3a2b1f);}return null;};}function patchUpdates(_0x2c4075){return function(_0x13a7cd){try{jsonpatch[_0x7d6e('0x24')](_0x13a7cd,_0x2c4075,!![]);}catch(_0x5d2060){return BPromise['reject'](_0x5d2060);}return _0x13a7cd[_0x7d6e('0x25')]();};}function saveUpdates(_0x3da7a0,_0xc6bed2){return function(_0x56c2cc){if(_0x56c2cc){return _0x56c2cc[_0x7d6e('0x26')](_0x3da7a0)[_0x7d6e('0x27')](function(_0x582cda){return _0x582cda;});}return null;};}function removeEntity(_0x18295b,_0x89486e){return function(_0x3a7568){if(_0x3a7568){return _0x3a7568[_0x7d6e('0x28')]()[_0x7d6e('0x27')](function(){_0x18295b[_0x7d6e('0x1d')](0xcc)[_0x7d6e('0x29')]();});}};}function handleEntityNotFound(_0x189eca,_0x36d2a1){return function(_0x3a2cb2){if(!_0x3a2cb2){_0x189eca[_0x7d6e('0x1c')](0x194);}return _0x3a2cb2;};}function handleError(_0x5689ab,_0x41047b){_0x41047b=_0x41047b||0x1f4;return function(_0x396e42){logger['error'](_0x396e42[_0x7d6e('0x2a')]);if(_0x396e42[_0x7d6e('0x2b')]){delete _0x396e42[_0x7d6e('0x2b')];}_0x5689ab[_0x7d6e('0x1d')](_0x41047b)[_0x7d6e('0x2c')](_0x396e42);};}exports[_0x7d6e('0x2d')]=function(_0xdd4341,_0x11befd){var _0xfa34b7={},_0x3a9292={},_0x754ad7={'count':0x0,'rows':[]};var _0x19ad74=_[_0x7d6e('0x2e')](db[_0x7d6e('0x2f')][_0x7d6e('0x30')],function(_0x35b1ea){return{'name':_0x35b1ea[_0x7d6e('0x31')],'type':_0x35b1ea[_0x7d6e('0x32')][_0x7d6e('0x33')]};});_0x3a9292[_0x7d6e('0x34')]=_[_0x7d6e('0x2e')](_0x19ad74,_0x7d6e('0x2b'));_0x3a9292['query']=_[_0x7d6e('0x35')](_0xdd4341[_0x7d6e('0x36')]);_0x3a9292[_0x7d6e('0x37')]=_[_0x7d6e('0x38')](_0x3a9292[_0x7d6e('0x34')],_0x3a9292[_0x7d6e('0x36')]);_0xfa34b7[_0x7d6e('0x39')]=_[_0x7d6e('0x38')](_0x3a9292[_0x7d6e('0x34')],qs[_0x7d6e('0x3a')](_0xdd4341['query']['fields']));_0xfa34b7[_0x7d6e('0x39')]=_0xfa34b7[_0x7d6e('0x39')][_0x7d6e('0x3b')]?_0xfa34b7[_0x7d6e('0x39')]:_0x3a9292['model'];if(!_0xdd4341['query'][_0x7d6e('0x3c')]('nolimit')){_0xfa34b7['limit']=qs[_0x7d6e('0x20')](_0xdd4341[_0x7d6e('0x36')][_0x7d6e('0x20')]);_0xfa34b7[_0x7d6e('0x1f')]=qs['offset'](_0xdd4341['query'][_0x7d6e('0x1f')]);}_0xfa34b7[_0x7d6e('0x3d')]=qs[_0x7d6e('0x3e')](_0xdd4341[_0x7d6e('0x36')]['sort']);_0xfa34b7[_0x7d6e('0x3f')]=qs['filters'](_['pick'](_0xdd4341['query'],_0x3a9292[_0x7d6e('0x37')]),_0x19ad74);if(_0xdd4341['query'][_0x7d6e('0x40')]){_0xfa34b7['where']=_[_0x7d6e('0x41')](_0xfa34b7[_0x7d6e('0x3f')],{'$or':_[_0x7d6e('0x2e')](_0x19ad74,function(_0x1f1d5b){if(_0x1f1d5b['type']!==_0x7d6e('0x42')){var _0x200f9c={};_0x200f9c[_0x1f1d5b[_0x7d6e('0x2b')]]={'$like':'%'+_0xdd4341[_0x7d6e('0x36')]['filter']+'%'};return _0x200f9c;}})});}_0xfa34b7=_[_0x7d6e('0x41')]({},_0xfa34b7,_0xdd4341[_0x7d6e('0x43')]);var _0x11e280={'where':_0xfa34b7[_0x7d6e('0x3f')]};return db[_0x7d6e('0x2f')][_0x7d6e('0x22')](_0x11e280)[_0x7d6e('0x27')](function(_0x4c34b1){_0x754ad7[_0x7d6e('0x22')]=_0x4c34b1;if(_0xdd4341['query'][_0x7d6e('0x44')]){_0xfa34b7[_0x7d6e('0x45')]=[{'all':!![]}];}return db[_0x7d6e('0x2f')][_0x7d6e('0x46')](_0xfa34b7);})[_0x7d6e('0x27')](function(_0x2d72bf){_0x754ad7[_0x7d6e('0x47')]=_0x2d72bf;return _0x754ad7;})['then'](respondWithFilteredResult(_0x11befd,_0xfa34b7))['catch'](handleError(_0x11befd,null));};exports['show']=function(_0x116cfd,_0x152ed3){var _0x1235cc={'raw':![],'where':{'id':_0x116cfd['params']['id']}},_0x3c0da1={};_0x3c0da1[_0x7d6e('0x34')]=_[_0x7d6e('0x35')](db[_0x7d6e('0x2f')]['rawAttributes']);_0x3c0da1[_0x7d6e('0x36')]=_[_0x7d6e('0x35')](_0x116cfd['query']);_0x3c0da1[_0x7d6e('0x37')]=_['intersection'](_0x3c0da1[_0x7d6e('0x34')],_0x3c0da1[_0x7d6e('0x36')]);_0x1235cc[_0x7d6e('0x39')]=_[_0x7d6e('0x38')](_0x3c0da1[_0x7d6e('0x34')],qs[_0x7d6e('0x3a')](_0x116cfd[_0x7d6e('0x36')][_0x7d6e('0x3a')]));_0x1235cc[_0x7d6e('0x39')]=_0x1235cc['attributes'][_0x7d6e('0x3b')]?_0x1235cc[_0x7d6e('0x39')]:_0x3c0da1['model'];if(_0x116cfd[_0x7d6e('0x36')][_0x7d6e('0x44')]){_0x1235cc['include']=[{'all':!![]}];}_0x1235cc=_[_0x7d6e('0x41')]({},_0x1235cc,_0x116cfd[_0x7d6e('0x43')]);return db[_0x7d6e('0x2f')][_0x7d6e('0x48')](_0x1235cc)[_0x7d6e('0x27')](handleEntityNotFound(_0x152ed3,null))[_0x7d6e('0x27')](respondWithResult(_0x152ed3,null))[_0x7d6e('0x49')](handleError(_0x152ed3,null));};exports[_0x7d6e('0x4a')]=function(_0x148a9f,_0x1fe2e0){return db[_0x7d6e('0x2f')][_0x7d6e('0x4a')](_0x148a9f['body'],{})[_0x7d6e('0x27')](respondWithResult(_0x1fe2e0,0xc9))[_0x7d6e('0x49')](handleError(_0x1fe2e0,null));};exports[_0x7d6e('0x26')]=function(_0xb30962,_0x42a874){if(_0xb30962[_0x7d6e('0x4b')]['id']){delete _0xb30962['body']['id'];}return db[_0x7d6e('0x2f')][_0x7d6e('0x48')]({'where':{'id':_0xb30962['params']['id']}})['then'](handleEntityNotFound(_0x42a874,null))['then'](saveUpdates(_0xb30962[_0x7d6e('0x4b')],null))[_0x7d6e('0x27')](respondWithResult(_0x42a874,null))[_0x7d6e('0x49')](handleError(_0x42a874,null));};exports['destroy']=function(_0x35ef2f,_0x34123a){return db[_0x7d6e('0x2f')]['find']({'where':{'id':_0x35ef2f[_0x7d6e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x34123a,null))[_0x7d6e('0x27')](removeEntity(_0x34123a,null))[_0x7d6e('0x49')](handleError(_0x34123a,null));};exports[_0x7d6e('0x4d')]=function(_0x2aa558,_0x1e6a90,_0x7ac332){var _0x4ba0e1={};var _0x4219bd={};var _0x3b5041;var _0x5c65fd;return db['SalesforceAccount'][_0x7d6e('0x4e')]({'where':{'id':_0x2aa558[_0x7d6e('0x4c')]['id']}})[_0x7d6e('0x27')](handleEntityNotFound(_0x1e6a90,null))[_0x7d6e('0x27')](function(_0xd0f505){if(_0xd0f505){_0x3b5041=_0xd0f505;_0x4219bd[_0x7d6e('0x34')]=_[_0x7d6e('0x35')](db[_0x7d6e('0x4f')][_0x7d6e('0x30')]);_0x4219bd[_0x7d6e('0x36')]=_[_0x7d6e('0x35')](_0x2aa558['query']);_0x4219bd[_0x7d6e('0x37')]=_[_0x7d6e('0x38')](_0x4219bd['model'],_0x4219bd['query']);_0x4ba0e1[_0x7d6e('0x39')]=_[_0x7d6e('0x38')](_0x4219bd['model'],qs['fields'](_0x2aa558['query'][_0x7d6e('0x3a')]));_0x4ba0e1['attributes']=_0x4ba0e1[_0x7d6e('0x39')][_0x7d6e('0x3b')]?_0x4ba0e1[_0x7d6e('0x39')]:_0x4219bd[_0x7d6e('0x34')];_0x4ba0e1['order']=qs['sort'](_0x2aa558['query'][_0x7d6e('0x3e')]);_0x4ba0e1[_0x7d6e('0x3f')]=qs[_0x7d6e('0x37')](_[_0x7d6e('0x50')](_0x2aa558['query'],_0x4219bd[_0x7d6e('0x37')]));if(_0x2aa558[_0x7d6e('0x36')][_0x7d6e('0x40')]){_0x4ba0e1[_0x7d6e('0x3f')]=_[_0x7d6e('0x41')](_0x4ba0e1['where'],{'$or':_[_0x7d6e('0x2e')](_0x4ba0e1[_0x7d6e('0x39')],function(_0x5c1de9){var _0x6035ce={};_0x6035ce[_0x5c1de9]={'$like':'%'+_0x2aa558[_0x7d6e('0x36')]['filter']+'%'};return _0x6035ce;})});}_0x4ba0e1=_[_0x7d6e('0x41')]({},_0x4ba0e1,_0x2aa558[_0x7d6e('0x43')]);return _0x3b5041[_0x7d6e('0x4d')](_0x4ba0e1);}})[_0x7d6e('0x27')](function(_0x11a916){if(_0x11a916){_0x5c65fd=_0x11a916[_0x7d6e('0x3b')];if(!_0x2aa558[_0x7d6e('0x36')][_0x7d6e('0x3c')](_0x7d6e('0x51'))){_0x4ba0e1[_0x7d6e('0x20')]=qs[_0x7d6e('0x20')](_0x2aa558['query'][_0x7d6e('0x20')]);_0x4ba0e1[_0x7d6e('0x1f')]=qs[_0x7d6e('0x1f')](_0x2aa558[_0x7d6e('0x36')][_0x7d6e('0x1f')]);}return _0x3b5041['getConfigurations'](_0x4ba0e1);}})[_0x7d6e('0x27')](function(_0x197a25){if(_0x197a25){return _0x197a25?{'count':_0x5c65fd,'rows':_0x197a25}:null;}})[_0x7d6e('0x27')](respondWithResult(_0x1e6a90,null))['catch'](handleError(_0x1e6a90,null));};exports[_0x7d6e('0x52')]=function(_0x1e1602,_0x2dbfff,_0x2eb0a5){if(_0x1e1602['body']['id']){delete _0x1e1602[_0x7d6e('0x4b')]['id'];}return db[_0x7d6e('0x2f')][_0x7d6e('0x4e')]({'where':{'id':_0x1e1602[_0x7d6e('0x4c')]['id']}})[_0x7d6e('0x27')](handleEntityNotFound(_0x2dbfff,null))['then'](function(_0x54c849){if(_0x54c849){_0x1e1602['body'][_0x7d6e('0x53')]=_0x54c849['id'];_0x1e1602['body'][_0x7d6e('0x54')]=integrations[_0x7d6e('0x55')](_0x1e1602[_0x7d6e('0x4b')]['channel'],_0x1e1602[_0x7d6e('0x4b')][_0x7d6e('0x32')]);_0x1e1602[_0x7d6e('0x4b')][_0x7d6e('0x56')]=integrations[_0x7d6e('0x57')](_0x1e1602['body'][_0x7d6e('0x58')],_0x1e1602[_0x7d6e('0x4b')][_0x7d6e('0x32')]);return db[_0x7d6e('0x4f')][_0x7d6e('0x4a')](_0x1e1602[_0x7d6e('0x4b')],{'include':[{'model':db[_0x7d6e('0x59')],'as':_0x7d6e('0x54')},{'model':db['SalesforceField'],'as':_0x7d6e('0x56')}]});}return null;})[_0x7d6e('0x27')](respondWithResult(_0x2dbfff,null))[_0x7d6e('0x49')](handleError(_0x2dbfff,null));};exports[_0x7d6e('0x5a')]=function(_0x4b7bd1,_0x2de7e7,_0xc4be4d){var _0x12b0b7;var _0xc37352='';var _0x1f890c=_0x7d6e('0x5b');return db[_0x7d6e('0x2f')][_0x7d6e('0x4e')]({'where':{'id':_0x4b7bd1[_0x7d6e('0x4c')]['id']},'attributes':['id',_0x7d6e('0x5c'),_0x7d6e('0x5d'),_0x7d6e('0x5e'),_0x7d6e('0x5f'),_0x7d6e('0x60'),_0x7d6e('0x61')]})[_0x7d6e('0x27')](handleEntityNotFound(_0x2de7e7,null))[_0x7d6e('0x27')](function(_0x3814af){if(_0x3814af){_0xc37352=_0x3814af[_0x7d6e('0x5c')];var _0xcebea7=_0xc37352[_0x7d6e('0x62')](-0x1);if(_0xcebea7==='/'){_0xc37352=_0xc37352['substring'](0x0,_0xc37352['lastIndexOf'](_0xcebea7));}_0x12b0b7=new jsforce[(_0x7d6e('0x63'))]({'oauth2':{'loginUrl':_0xc37352,'clientId':_0x3814af[_0x7d6e('0x5d')],'clientSecret':_0x3814af[_0x7d6e('0x5e')]}});return _0x12b0b7[_0x7d6e('0x64')](_0x3814af[_0x7d6e('0x5f')],_0x3814af[_0x7d6e('0x60')]['concat'](_0x3814af[_0x7d6e('0x61')]));}})[_0x7d6e('0x27')](function(_0x2bb83a){if(_0x2bb83a){if(!_['isNil'](_0x4b7bd1[_0x7d6e('0x36')][_0x7d6e('0x65')])){_0x1f890c=_0x4b7bd1[_0x7d6e('0x36')]['ticketType'];}return _0x12b0b7[_0x7d6e('0x66')](_0x1f890c)[_0x7d6e('0x67')]();}})[_0x7d6e('0x27')](function(_0x4b3704){var _0x506247=[_0x7d6e('0x68'),_0x7d6e('0x69'),'IsReminderSet',_0x7d6e('0x6a'),_0x7d6e('0x6b'),'Description'];var _0x1be3ed=[_0x7d6e('0x6c'),_0x7d6e('0x6d'),_0x7d6e('0x6e'),'boolean',_0x7d6e('0x6f'),_0x7d6e('0x70'),_0x7d6e('0x71')];if(_0x4b3704){_[_0x7d6e('0x72')](_0x4b3704[_0x7d6e('0x3a')],function(_0x2e3cab){return _0x506247[_0x7d6e('0x73')](_0x2e3cab[_0x7d6e('0x2b')])||!_0x1be3ed[_0x7d6e('0x73')](_0x2e3cab['type']);});return{'count':_0x4b3704[_0x7d6e('0x3a')][_0x7d6e('0x3b')],'rows':_['map'](_0x4b3704[_0x7d6e('0x3a')],function(_0x28db7a){return{'id':_0x28db7a[_0x7d6e('0x2b')],'name':_0x28db7a['label'],'custom':_0x28db7a[_0x7d6e('0x74')],'options':_0x28db7a[_0x7d6e('0x75')][_0x7d6e('0x3b')]>0x0?_[_0x7d6e('0x2e')](_0x28db7a[_0x7d6e('0x75')],function(_0x44f1e0){return{'name':_0x44f1e0[_0x7d6e('0x76')],'value':_0x44f1e0[_0x7d6e('0x77')]};}):_0x28db7a[_0x7d6e('0x32')]=='boolean'?[{'name':_0x7d6e('0x78'),'value':_0x7d6e('0x79')},{'name':'False','value':'false'}]:[]};})};}})[_0x7d6e('0x27')](respondWithResult(_0x2de7e7,null))[_0x7d6e('0x49')](function(_0x31cf1c){var _0x156b57=_0x4b7bd1['query'][_0x7d6e('0x7a')]?0x1f4:_0x31cf1c['statusCode']||0x1f4;logger[_0x7d6e('0x7b')](_0x7d6e('0x7c'),_0x7d6e('0x5a'),_0x156b57,JSON[_0x7d6e('0x7d')](_0x31cf1c));delete _0x31cf1c['name'];if(_0x156b57===0x191){_0x156b57=0x190;}_0x2de7e7[_0x7d6e('0x1d')](_0x156b57)[_0x7d6e('0x2c')](_0x4b7bd1[_0x7d6e('0x36')][_0x7d6e('0x7a')]?{'message':_0x7d6e('0x7e'),'statusCode':_0x31cf1c['statusCode']}:_0x31cf1c);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index b0a9509..d92ec4c 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 _0x754e=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','util','../../config/logger'];(function(_0x16ccae,_0x3c2852){var _0x3bcffd=function(_0x29fc29){while(--_0x29fc29){_0x16ccae['push'](_0x16ccae['shift']());}};_0x3bcffd(++_0x3c2852);}(_0x754e,0xa6));var _0xe754=function(_0x1414fa,_0x26d79a){_0x1414fa=_0x1414fa-0x0;var _0x3c55dd=_0x754e[_0x1414fa];return _0x3c55dd;};'use strict';var _=require('lodash');var util=require(_0xe754('0x0'));var logger=require(_0xe754('0x1'))(_0xe754('0x2'));var moment=require(_0xe754('0x3'));var BPromise=require(_0xe754('0x4'));var rp=require(_0xe754('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe754('0x6'));var config=require(_0xe754('0x7'));var attributes=require(_0xe754('0x8'));var integrations=require(_0xe754('0x9'));module[_0xe754('0xa')]=function(_0x830cf9,_0x5a55e8){return _0x830cf9['define'](_0xe754('0xb'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d28=['moment','request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','api'];(function(_0x4965ea,_0x206e05){var _0x2682c5=function(_0x468d93){while(--_0x468d93){_0x4965ea['push'](_0x4965ea['shift']());}};_0x2682c5(++_0x206e05);}(_0x7d28,0x75));var _0x87d2=function(_0x4f3c4b,_0x5c653b){_0x4f3c4b=_0x4f3c4b-0x0;var _0x4e0c89=_0x7d28[_0x4f3c4b];return _0x4e0c89;};'use strict';var _=require(_0x87d2('0x0'));var util=require('util');var logger=require(_0x87d2('0x1'))(_0x87d2('0x2'));var moment=require(_0x87d2('0x3'));var BPromise=require('bluebird');var rp=require(_0x87d2('0x4'));var fs=require('fs');var path=require(_0x87d2('0x5'));var rimraf=require(_0x87d2('0x6'));var config=require('../../config/environment');var attributes=require(_0x87d2('0x7'));var integrations=require(_0x87d2('0x8'));module['exports']=function(_0x205d9e,_0x99e603){return _0x205d9e[_0x87d2('0x9')](_0x87d2('0xa'),attributes,{'tableName':_0x87d2('0xb'),'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 24c0c9a..aa4ddda 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 _0xfbad=['info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','limit','map','include','model','attributes','debug','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x3810c4,_0x39350b){var _0x5b264c=function(_0x4d4c37){while(--_0x4d4c37){_0x3810c4['push'](_0x3810c4['shift']());}};_0x5b264c(++_0x39350b);}(_0xfbad,0x129));var _0xdfba=function(_0x143727,_0x775f88){_0x143727=_0x143727-0x0;var _0x4753e5=_0xfbad[_0x143727];return _0x4753e5;};'use strict';var _=require(_0xdfba('0x0'));var util=require(_0xdfba('0x1'));var moment=require(_0xdfba('0x2'));var BPromise=require(_0xdfba('0x3'));var rs=require(_0xdfba('0x4'));var fs=require('fs');var Redis=require(_0xdfba('0x5'));var db=require(_0xdfba('0x6'))['db'];var utils=require(_0xdfba('0x7'));var logger=require(_0xdfba('0x8'))(_0xdfba('0x9'));var config=require(_0xdfba('0xa'));var jayson=require(_0xdfba('0xb'));var client=jayson[_0xdfba('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c94ea,_0x392e7f,_0x4ea2a2){return new BPromise(function(_0x3e70da,_0x7bf895){return client[_0xdfba('0xd')](_0x1c94ea,_0x4ea2a2)[_0xdfba('0xe')](function(_0x55cddb){logger[_0xdfba('0xf')](_0xdfba('0x10'),_0x392e7f,_0xdfba('0x11'));logger['debug'](_0xdfba('0x12'),_0x392e7f,_0xdfba('0x11'),JSON[_0xdfba('0x13')](_0x55cddb));if(_0x55cddb[_0xdfba('0x14')]){if(_0x55cddb[_0xdfba('0x14')][_0xdfba('0x15')]===0x1f4){logger[_0xdfba('0x14')](_0xdfba('0x10'),_0x392e7f,_0x55cddb['error'][_0xdfba('0x16')]);return _0x7bf895(_0x55cddb['error'][_0xdfba('0x16')]);}logger['error'](_0xdfba('0x10'),_0x392e7f,_0x55cddb[_0xdfba('0x14')][_0xdfba('0x16')]);return _0x3e70da(_0x55cddb[_0xdfba('0x14')]['message']);}else{logger[_0xdfba('0xf')](_0xdfba('0x10'),_0x392e7f,'request\x20sent');_0x3e70da(_0x55cddb[_0xdfba('0x17')][_0xdfba('0x16')]);}})[_0xdfba('0x18')](function(_0x440430){logger[_0xdfba('0x14')](_0xdfba('0x10'),_0x392e7f,_0x440430);_0x7bf895(_0x440430);});});}exports[_0xdfba('0x19')]=function(_0x1b6d93){var _0x776c3d=this;return new Promise(function(_0x5c7706,_0x128b6c){return db[_0xdfba('0x1a')][_0xdfba('0x1b')]({'raw':_0x1b6d93[_0xdfba('0x1c')]?_0x1b6d93[_0xdfba('0x1c')][_0xdfba('0x1d')]===undefined?!![]:![]:!![],'where':_0x1b6d93['options']?_0x1b6d93[_0xdfba('0x1c')][_0xdfba('0x1e')]||null:null,'attributes':_0x1b6d93[_0xdfba('0x1c')]?_0x1b6d93[_0xdfba('0x1c')]['attributes']||null:null,'limit':_0x1b6d93[_0xdfba('0x1c')]?_0x1b6d93[_0xdfba('0x1c')][_0xdfba('0x1f')]||null:null,'include':_0x1b6d93[_0xdfba('0x1c')]?_0x1b6d93['options']['include']?_[_0xdfba('0x20')](_0x1b6d93[_0xdfba('0x1c')][_0xdfba('0x21')],function(_0x2e326b){return{'model':db[_0x2e326b[_0xdfba('0x22')]],'as':_0x2e326b['as'],'attributes':_0x2e326b[_0xdfba('0x23')],'include':_0x2e326b[_0xdfba('0x21')]?_[_0xdfba('0x20')](_0x2e326b['include'],function(_0x197398){return{'model':db[_0x197398['model']],'as':_0x197398['as'],'attributes':_0x197398['attributes'],'include':_0x197398[_0xdfba('0x21')]?_[_0xdfba('0x20')](_0x197398['include'],function(_0x1e1c0b){return{'model':db[_0x1e1c0b[_0xdfba('0x22')]],'as':_0x1e1c0b['as'],'attributes':_0x1e1c0b['attributes']};}):[]};}):[]};}):[]:[]})[_0xdfba('0xe')](function(_0x39a7c6){logger['info'](_0xdfba('0x19'),_0x1b6d93);logger[_0xdfba('0x24')]('GetSalesforceAccount',_0x1b6d93,JSON['stringify'](_0x39a7c6));_0x5c7706(_0x39a7c6);})['catch'](function(_0x4b30d3){logger[_0xdfba('0x14')]('GetSalesforceAccount',_0x4b30d3[_0xdfba('0x16')],_0x1b6d93);_0x128b6c(_0x776c3d[_0xdfba('0x14')](0x1f4,_0x4b30d3[_0xdfba('0x16')]));});});};exports[_0xdfba('0x25')]=function(_0x4e503b){var _0x3c3178=this;return new Promise(function(_0x3edab6,_0x1ed088){return db[_0xdfba('0x1a')][_0xdfba('0x26')]({'raw':_0x4e503b[_0xdfba('0x1c')]?_0x4e503b[_0xdfba('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4e503b['options']?_0x4e503b['options']['where']||null:null,'attributes':_0x4e503b['options']?_0x4e503b[_0xdfba('0x1c')][_0xdfba('0x23')]||null:null,'include':_0x4e503b[_0xdfba('0x1c')]?_0x4e503b[_0xdfba('0x1c')][_0xdfba('0x21')]?_[_0xdfba('0x20')](_0x4e503b[_0xdfba('0x1c')][_0xdfba('0x21')],function(_0x16b061){return{'model':db[_0x16b061[_0xdfba('0x22')]],'as':_0x16b061['as'],'attributes':_0x16b061[_0xdfba('0x23')],'include':_0x16b061['include']?_[_0xdfba('0x20')](_0x16b061[_0xdfba('0x21')],function(_0x792e59){return{'model':db[_0x792e59[_0xdfba('0x22')]],'as':_0x792e59['as'],'attributes':_0x792e59[_0xdfba('0x23')],'include':_0x792e59['include']?_[_0xdfba('0x20')](_0x792e59[_0xdfba('0x21')],function(_0x33b8d9){return{'model':db[_0x33b8d9[_0xdfba('0x22')]],'as':_0x33b8d9['as'],'attributes':_0x33b8d9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ab23d){logger[_0xdfba('0xf')]('ShowSalesforceAccount',_0x4e503b);logger[_0xdfba('0x24')](_0xdfba('0x25'),_0x4e503b,JSON[_0xdfba('0x13')](_0x5ab23d));_0x3edab6(_0x5ab23d);})[_0xdfba('0x18')](function(_0x34f06a){logger['error']('ShowSalesforceAccount',_0x34f06a[_0xdfba('0x16')],_0x4e503b);_0x1ed088(_0x3c3178[_0xdfba('0x14')](0x1f4,_0x34f06a[_0xdfba('0x16')]));});});}; \ No newline at end of file +var _0xdc3c=['rpc','../../config/environment','jayson/promise','client','http','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','limit','include','model','map','then','ShowSalesforceAccount','find','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x40a9eb,_0x14dc41){var _0x229d40=function(_0x14d300){while(--_0x14d300){_0x40a9eb['push'](_0x40a9eb['shift']());}};_0x229d40(++_0x14dc41);}(_0xdc3c,0x1b4));var _0xcdc3=function(_0x4b0aa7,_0x486490){_0x4b0aa7=_0x4b0aa7-0x0;var _0x332021=_0xdc3c[_0x4b0aa7];return _0x332021;};'use strict';var _=require(_0xcdc3('0x0'));var util=require('util');var moment=require(_0xcdc3('0x1'));var BPromise=require(_0xcdc3('0x2'));var rs=require(_0xcdc3('0x3'));var fs=require('fs');var Redis=require(_0xcdc3('0x4'));var db=require(_0xcdc3('0x5'))['db'];var utils=require(_0xcdc3('0x6'));var logger=require(_0xcdc3('0x7'))(_0xcdc3('0x8'));var config=require(_0xcdc3('0x9'));var jayson=require(_0xcdc3('0xa'));var client=jayson[_0xcdc3('0xb')][_0xcdc3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x406814,_0x428b03,_0x79b6b1){return new BPromise(function(_0xcbc8f1,_0x58c8f3){return client['request'](_0x406814,_0x79b6b1)['then'](function(_0x3aa1b2){logger[_0xcdc3('0xd')](_0xcdc3('0xe'),_0x428b03,_0xcdc3('0xf'));logger[_0xcdc3('0x10')](_0xcdc3('0x11'),_0x428b03,_0xcdc3('0xf'),JSON[_0xcdc3('0x12')](_0x3aa1b2));if(_0x3aa1b2[_0xcdc3('0x13')]){if(_0x3aa1b2['error']['code']===0x1f4){logger[_0xcdc3('0x13')](_0xcdc3('0xe'),_0x428b03,_0x3aa1b2[_0xcdc3('0x13')][_0xcdc3('0x14')]);return _0x58c8f3(_0x3aa1b2[_0xcdc3('0x13')][_0xcdc3('0x14')]);}logger[_0xcdc3('0x13')](_0xcdc3('0xe'),_0x428b03,_0x3aa1b2['error'][_0xcdc3('0x14')]);return _0xcbc8f1(_0x3aa1b2['error'][_0xcdc3('0x14')]);}else{logger['info'](_0xcdc3('0xe'),_0x428b03,_0xcdc3('0xf'));_0xcbc8f1(_0x3aa1b2[_0xcdc3('0x15')][_0xcdc3('0x14')]);}})[_0xcdc3('0x16')](function(_0xaf3ec3){logger[_0xcdc3('0x13')](_0xcdc3('0xe'),_0x428b03,_0xaf3ec3);_0x58c8f3(_0xaf3ec3);});});}exports[_0xcdc3('0x17')]=function(_0xc24bd1){var _0x1a28e6=this;return new Promise(function(_0x480c1c,_0x285adb){return db[_0xcdc3('0x18')][_0xcdc3('0x19')]({'raw':_0xc24bd1[_0xcdc3('0x1a')]?_0xc24bd1[_0xcdc3('0x1a')][_0xcdc3('0x1b')]===undefined?!![]:![]:!![],'where':_0xc24bd1['options']?_0xc24bd1['options']['where']||null:null,'attributes':_0xc24bd1[_0xcdc3('0x1a')]?_0xc24bd1['options'][_0xcdc3('0x1c')]||null:null,'limit':_0xc24bd1[_0xcdc3('0x1a')]?_0xc24bd1[_0xcdc3('0x1a')][_0xcdc3('0x1d')]||null:null,'include':_0xc24bd1[_0xcdc3('0x1a')]?_0xc24bd1[_0xcdc3('0x1a')][_0xcdc3('0x1e')]?_['map'](_0xc24bd1['options'][_0xcdc3('0x1e')],function(_0x2bc477){return{'model':db[_0x2bc477[_0xcdc3('0x1f')]],'as':_0x2bc477['as'],'attributes':_0x2bc477[_0xcdc3('0x1c')],'include':_0x2bc477['include']?_[_0xcdc3('0x20')](_0x2bc477[_0xcdc3('0x1e')],function(_0x499d63){return{'model':db[_0x499d63[_0xcdc3('0x1f')]],'as':_0x499d63['as'],'attributes':_0x499d63[_0xcdc3('0x1c')],'include':_0x499d63['include']?_[_0xcdc3('0x20')](_0x499d63[_0xcdc3('0x1e')],function(_0x41efc9){return{'model':db[_0x41efc9[_0xcdc3('0x1f')]],'as':_0x41efc9['as'],'attributes':_0x41efc9[_0xcdc3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcdc3('0x21')](function(_0x32a44d){logger[_0xcdc3('0xd')]('GetSalesforceAccount',_0xc24bd1);logger[_0xcdc3('0x10')]('GetSalesforceAccount',_0xc24bd1,JSON[_0xcdc3('0x12')](_0x32a44d));_0x480c1c(_0x32a44d);})[_0xcdc3('0x16')](function(_0x574da2){logger[_0xcdc3('0x13')](_0xcdc3('0x17'),_0x574da2['message'],_0xc24bd1);_0x285adb(_0x1a28e6[_0xcdc3('0x13')](0x1f4,_0x574da2[_0xcdc3('0x14')]));});});};exports[_0xcdc3('0x22')]=function(_0x117edd){var _0x3d64ac=this;return new Promise(function(_0x5baa2e,_0x359482){return db[_0xcdc3('0x18')][_0xcdc3('0x23')]({'raw':_0x117edd[_0xcdc3('0x1a')]?_0x117edd[_0xcdc3('0x1a')][_0xcdc3('0x1b')]===undefined?!![]:![]:!![],'where':_0x117edd[_0xcdc3('0x1a')]?_0x117edd[_0xcdc3('0x1a')][_0xcdc3('0x24')]||null:null,'attributes':_0x117edd['options']?_0x117edd[_0xcdc3('0x1a')][_0xcdc3('0x1c')]||null:null,'include':_0x117edd[_0xcdc3('0x1a')]?_0x117edd['options'][_0xcdc3('0x1e')]?_[_0xcdc3('0x20')](_0x117edd[_0xcdc3('0x1a')][_0xcdc3('0x1e')],function(_0x459919){return{'model':db[_0x459919[_0xcdc3('0x1f')]],'as':_0x459919['as'],'attributes':_0x459919[_0xcdc3('0x1c')],'include':_0x459919[_0xcdc3('0x1e')]?_[_0xcdc3('0x20')](_0x459919[_0xcdc3('0x1e')],function(_0x18dcee){return{'model':db[_0x18dcee[_0xcdc3('0x1f')]],'as':_0x18dcee['as'],'attributes':_0x18dcee[_0xcdc3('0x1c')],'include':_0x18dcee[_0xcdc3('0x1e')]?_[_0xcdc3('0x20')](_0x18dcee['include'],function(_0xb1935){return{'model':db[_0xb1935[_0xcdc3('0x1f')]],'as':_0xb1935['as'],'attributes':_0xb1935[_0xcdc3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcdc3('0x21')](function(_0x12b03e){logger[_0xcdc3('0xd')]('ShowSalesforceAccount',_0x117edd);logger[_0xcdc3('0x10')](_0xcdc3('0x22'),_0x117edd,JSON['stringify'](_0x12b03e));_0x5baa2e(_0x12b03e);})[_0xcdc3('0x16')](function(_0x144283){logger[_0xcdc3('0x13')](_0xcdc3('0x22'),_0x144283[_0xcdc3('0x14')],_0x117edd);_0x359482(_0x3d64ac[_0xcdc3('0x13')](0x1f4,_0x144283[_0xcdc3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 460d004..9117d37 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 _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0xf4adc9,_0x56d05e){var _0x30690c=function(_0x4d1403){while(--_0x4d1403){_0xf4adc9['push'](_0xf4adc9['shift']());}};_0x30690c(++_0x56d05e);}(_0x7a54,0x106));var _0x47a5=function(_0x3883ad,_0x295d1d){_0x3883ad=_0x3883ad-0x0;var _0x32b934=_0x7a54[_0x3883ad];return _0x32b934;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file +var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0x0b0e,0x187));var _0xe0b0=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0x0b0e[_0x466bc5];return _0x138952;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index fcc5979..64fce64 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 _0x5fcc=['contact','account','lead','sequelize','exports','STRING','ENUM','Case','Task','contact_lead'];(function(_0x57c7ec,_0x5d3a1e){var _0x547b40=function(_0x56c4ad){while(--_0x56c4ad){_0x57c7ec['push'](_0x57c7ec['shift']());}};_0x547b40(++_0x5d3a1e);}(_0x5fcc,0x161));var _0xc5fc=function(_0xde179d,_0xaec6f7){_0xde179d=_0xde179d-0x0;var _0x1cf9a7=_0x5fcc[_0xde179d];return _0x1cf9a7;};'use strict';var Sequelize=require(_0xc5fc('0x0'));module[_0xc5fc('0x1')]={'name':{'type':Sequelize[_0xc5fc('0x2')]},'description':{'type':Sequelize[_0xc5fc('0x2')]},'ticketType':{'type':Sequelize[_0xc5fc('0x3')]('Task',_0xc5fc('0x4')),'defaultValue':_0xc5fc('0x5')},'moduleSearch':{'type':Sequelize['ENUM'](_0xc5fc('0x6'),_0xc5fc('0x7'),'lead','account_contact_lead',_0xc5fc('0x8')),'defaultValue':_0xc5fc('0x6')},'moduleCreate':{'type':Sequelize[_0xc5fc('0x3')]('nothing',_0xc5fc('0x7'),_0xc5fc('0x9'),_0xc5fc('0x8')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xc5fc('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xc5fc('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xc5fc('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xc5fc('0x2')]}}; \ No newline at end of file +var _0x315b=['contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize','exports','STRING','ENUM','Case','Task'];(function(_0x58a8d2,_0x3c26de){var _0x169225=function(_0x4e9866){while(--_0x4e9866){_0x58a8d2['push'](_0x58a8d2['shift']());}};_0x169225(++_0x3c26de);}(_0x315b,0x162));var _0xb315=function(_0x1675cd,_0x164f78){_0x1675cd=_0x1675cd-0x0;var _0x2b762d=_0x315b[_0x1675cd];return _0x2b762d;};'use strict';var Sequelize=require(_0xb315('0x0'));module[_0xb315('0x1')]={'name':{'type':Sequelize[_0xb315('0x2')]},'description':{'type':Sequelize[_0xb315('0x2')]},'ticketType':{'type':Sequelize[_0xb315('0x3')]('Task',_0xb315('0x4')),'defaultValue':_0xb315('0x5')},'moduleSearch':{'type':Sequelize[_0xb315('0x3')](_0xb315('0x6'),_0xb315('0x7'),_0xb315('0x8'),_0xb315('0x9'),_0xb315('0xa')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xb315('0x3')](_0xb315('0xb'),'contact',_0xb315('0x8'),_0xb315('0xa')),'defaultValue':_0xb315('0x8')},'leadId':{'type':Sequelize[_0xb315('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xb315('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xb315('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xb315('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index eba3ea3..bcdc6c9 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 _0x956a=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','params','getFields','findOne','SalesforceField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SalesforceConfiguration','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x434804,_0x415f68){var _0x573fc8=function(_0x3ce265){while(--_0x3ce265){_0x434804['push'](_0x434804['shift']());}};_0x573fc8(++_0x415f68);}(_0x956a,0xb6));var _0xa956=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x956a[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa956('0x0'));var zipdir=require(_0xa956('0x1'));var jsonpatch=require(_0xa956('0x2'));var rp=require(_0xa956('0x3'));var moment=require(_0xa956('0x4'));var BPromise=require(_0xa956('0x5'));var Mustache=require(_0xa956('0x6'));var util=require(_0xa956('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa956('0x8'));var ejs=require(_0xa956('0x9'));var fs=require('fs');var fs_extra=require(_0xa956('0xa'));var _=require('lodash');var squel=require(_0xa956('0xb'));var crypto=require(_0xa956('0xc'));var jsforce=require(_0xa956('0xd'));var deskjs=require(_0xa956('0xe'));var toCsv=require(_0xa956('0x8'));var querystring=require(_0xa956('0xf'));var Papa=require(_0xa956('0x10'));var Redis=require('ioredis');var authService=require(_0xa956('0x11'));var qs=require(_0xa956('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa956('0x13'));var logger=require(_0xa956('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xa956('0x15'));var licenseUtil=require(_0xa956('0x16'));var db=require(_0xa956('0x17'))['db'];function respondWithStatusCode(_0x4badea,_0x365f72){_0x365f72=_0x365f72||0xcc;return function(_0x277b64){if(_0x277b64){return _0x4badea[_0xa956('0x18')](_0x365f72);}return _0x4badea['status'](_0x365f72)['end']();};}function respondWithResult(_0xb63ef0,_0x48ac9f){_0x48ac9f=_0x48ac9f||0xc8;return function(_0x59ec97){if(_0x59ec97){return _0xb63ef0[_0xa956('0x19')](_0x48ac9f)[_0xa956('0x1a')](_0x59ec97);}};}function respondWithFilteredResult(_0x2044d2,_0x54d416){return function(_0x4b57f4){if(_0x4b57f4){var _0x5027c7=typeof _0x54d416[_0xa956('0x1b')]==='undefined'&&typeof _0x54d416[_0xa956('0x1c')]===_0xa956('0x1d');var _0x5681ce=_0x4b57f4[_0xa956('0x1e')];var _0x461c14=_0x5027c7?0x0:_0x54d416[_0xa956('0x1b')];var _0x5c7baf=_0x5027c7?_0x4b57f4['count']:_0x54d416[_0xa956('0x1b')]+_0x54d416[_0xa956('0x1c')];var _0x2b23bc;if(_0x5c7baf>=_0x5681ce){_0x5c7baf=_0x5681ce;_0x2b23bc=0xc8;}else{_0x2b23bc=0xce;}_0x2044d2[_0xa956('0x19')](_0x2b23bc);return _0x2044d2['set']('Content-Range',_0x461c14+'-'+_0x5c7baf+'/'+_0x5681ce)['json'](_0x4b57f4);}return null;};}function patchUpdates(_0x34c8c9){return function(_0x24125e){try{jsonpatch[_0xa956('0x1f')](_0x24125e,_0x34c8c9,!![]);}catch(_0x2af038){return BPromise[_0xa956('0x20')](_0x2af038);}return _0x24125e[_0xa956('0x21')]();};}function saveUpdates(_0x10f4f6,_0x2c1500){return function(_0x450ab7){if(_0x450ab7){return _0x450ab7[_0xa956('0x22')](_0x10f4f6)[_0xa956('0x23')](function(_0x5a9fae){return _0x5a9fae;});}return null;};}function removeEntity(_0x1d7fd9,_0x1c7a31){return function(_0x5c2924){if(_0x5c2924){return _0x5c2924[_0xa956('0x24')]()[_0xa956('0x23')](function(){_0x1d7fd9[_0xa956('0x19')](0xcc)[_0xa956('0x25')]();});}};}function handleEntityNotFound(_0x2eb9ca,_0x514ce3){return function(_0x73e035){if(!_0x73e035){_0x2eb9ca[_0xa956('0x18')](0x194);}return _0x73e035;};}function handleError(_0x217716,_0x137220){_0x137220=_0x137220||0x1f4;return function(_0x3533fe){logger[_0xa956('0x26')](_0x3533fe[_0xa956('0x27')]);if(_0x3533fe[_0xa956('0x28')]){delete _0x3533fe[_0xa956('0x28')];}_0x217716['status'](_0x137220)[_0xa956('0x29')](_0x3533fe);};}exports[_0xa956('0x2a')]=function(_0x1f5005,_0x416b91){var _0x3cd0a7={},_0x172909={},_0x385b70={'count':0x0,'rows':[]};var _0x1c43c6=_[_0xa956('0x2b')](db[_0xa956('0x2c')]['rawAttributes'],function(_0x4ea596){return{'name':_0x4ea596[_0xa956('0x2d')],'type':_0x4ea596[_0xa956('0x2e')]['key']};});_0x172909['model']=_[_0xa956('0x2b')](_0x1c43c6,_0xa956('0x28'));_0x172909[_0xa956('0x2f')]=_[_0xa956('0x30')](_0x1f5005[_0xa956('0x2f')]);_0x172909[_0xa956('0x31')]=_[_0xa956('0x32')](_0x172909[_0xa956('0x33')],_0x172909[_0xa956('0x2f')]);_0x3cd0a7[_0xa956('0x34')]=_['intersection'](_0x172909['model'],qs[_0xa956('0x35')](_0x1f5005[_0xa956('0x2f')]['fields']));_0x3cd0a7['attributes']=_0x3cd0a7['attributes'][_0xa956('0x36')]?_0x3cd0a7[_0xa956('0x34')]:_0x172909[_0xa956('0x33')];if(!_0x1f5005['query'][_0xa956('0x37')](_0xa956('0x38'))){_0x3cd0a7[_0xa956('0x1c')]=qs[_0xa956('0x1c')](_0x1f5005['query']['limit']);_0x3cd0a7[_0xa956('0x1b')]=qs[_0xa956('0x1b')](_0x1f5005[_0xa956('0x2f')][_0xa956('0x1b')]);}_0x3cd0a7[_0xa956('0x39')]=qs[_0xa956('0x3a')](_0x1f5005[_0xa956('0x2f')][_0xa956('0x3a')]);_0x3cd0a7[_0xa956('0x3b')]=qs[_0xa956('0x31')](_[_0xa956('0x3c')](_0x1f5005[_0xa956('0x2f')],_0x172909['filters']),_0x1c43c6);if(_0x1f5005[_0xa956('0x2f')][_0xa956('0x3d')]){_0x3cd0a7[_0xa956('0x3b')]=_[_0xa956('0x3e')](_0x3cd0a7['where'],{'$or':_[_0xa956('0x2b')](_0x1c43c6,function(_0x45a850){if(_0x45a850[_0xa956('0x2e')]!==_0xa956('0x3f')){var _0x4da884={};_0x4da884[_0x45a850[_0xa956('0x28')]]={'$like':'%'+_0x1f5005[_0xa956('0x2f')][_0xa956('0x3d')]+'%'};return _0x4da884;}})});}_0x3cd0a7=_['merge']({},_0x3cd0a7,_0x1f5005[_0xa956('0x40')]);var _0x1c92db={'where':_0x3cd0a7[_0xa956('0x3b')]};return db[_0xa956('0x2c')][_0xa956('0x1e')](_0x1c92db)[_0xa956('0x23')](function(_0x1e28dc){_0x385b70[_0xa956('0x1e')]=_0x1e28dc;if(_0x1f5005[_0xa956('0x2f')][_0xa956('0x41')]){_0x3cd0a7[_0xa956('0x42')]=[{'all':!![]}];}return db[_0xa956('0x2c')][_0xa956('0x43')](_0x3cd0a7);})[_0xa956('0x23')](function(_0x2413db){_0x385b70['rows']=_0x2413db;return _0x385b70;})[_0xa956('0x23')](respondWithFilteredResult(_0x416b91,_0x3cd0a7))[_0xa956('0x44')](handleError(_0x416b91,null));};exports[_0xa956('0x45')]=function(_0x4da679,_0x598fec){var _0x13ce1f={'raw':![],'where':{'id':_0x4da679['params']['id']}},_0x4fce58={};_0x4fce58[_0xa956('0x33')]=_[_0xa956('0x30')](db['SalesforceConfiguration'][_0xa956('0x46')]);_0x4fce58[_0xa956('0x2f')]=_[_0xa956('0x30')](_0x4da679[_0xa956('0x2f')]);_0x4fce58[_0xa956('0x31')]=_[_0xa956('0x32')](_0x4fce58[_0xa956('0x33')],_0x4fce58[_0xa956('0x2f')]);_0x13ce1f[_0xa956('0x34')]=_['intersection'](_0x4fce58['model'],qs[_0xa956('0x35')](_0x4da679['query']['fields']));_0x13ce1f[_0xa956('0x34')]=_0x13ce1f[_0xa956('0x34')][_0xa956('0x36')]?_0x13ce1f['attributes']:_0x4fce58['model'];if(_0x4da679[_0xa956('0x2f')][_0xa956('0x41')]){_0x13ce1f[_0xa956('0x42')]=[{'all':!![]}];}_0x13ce1f=_['merge']({},_0x13ce1f,_0x4da679[_0xa956('0x40')]);return db[_0xa956('0x2c')][_0xa956('0x47')](_0x13ce1f)['then'](handleEntityNotFound(_0x598fec,null))[_0xa956('0x23')](respondWithResult(_0x598fec,null))[_0xa956('0x44')](handleError(_0x598fec,null));};exports[_0xa956('0x48')]=function(_0x47601e,_0x20c661){return db[_0xa956('0x2c')][_0xa956('0x48')](_0x47601e[_0xa956('0x49')],{})[_0xa956('0x23')](respondWithResult(_0x20c661,0xc9))[_0xa956('0x44')](handleError(_0x20c661,null));};exports[_0xa956('0x22')]=function(_0x51f7dc,_0x54d5e8){if(_0x51f7dc[_0xa956('0x49')]['id']){delete _0x51f7dc['body']['id'];}return db[_0xa956('0x2c')]['find']({'where':{'id':_0x51f7dc[_0xa956('0x4a')]['id']}})['then'](handleEntityNotFound(_0x54d5e8,null))[_0xa956('0x23')](saveUpdates(_0x51f7dc[_0xa956('0x49')],null))['then'](respondWithResult(_0x54d5e8,null))[_0xa956('0x44')](handleError(_0x54d5e8,null));};exports[_0xa956('0x24')]=function(_0x433c1f,_0x43da44){return db[_0xa956('0x2c')][_0xa956('0x47')]({'where':{'id':_0x433c1f[_0xa956('0x4a')]['id']}})[_0xa956('0x23')](handleEntityNotFound(_0x43da44,null))[_0xa956('0x23')](removeEntity(_0x43da44,null))['catch'](handleError(_0x43da44,null));};exports[_0xa956('0x4b')]=function(_0xa5978e,_0x2a86a7,_0x546112){var _0x52d21d={};var _0x5e8f11={};var _0x1e3c4a;var _0x5575b2;return db[_0xa956('0x2c')][_0xa956('0x4c')]({'where':{'id':_0xa5978e[_0xa956('0x4a')]['id']}})[_0xa956('0x23')](handleEntityNotFound(_0x2a86a7,null))['then'](function(_0x53a1ba){if(_0x53a1ba){_0x1e3c4a=_0x53a1ba;_0x5e8f11[_0xa956('0x33')]=_['keys'](db[_0xa956('0x4d')]['rawAttributes']);_0x5e8f11[_0xa956('0x2f')]=_[_0xa956('0x30')](_0xa5978e['query']);_0x5e8f11[_0xa956('0x31')]=_[_0xa956('0x32')](_0x5e8f11[_0xa956('0x33')],_0x5e8f11['query']);_0x52d21d[_0xa956('0x34')]=_[_0xa956('0x32')](_0x5e8f11[_0xa956('0x33')],qs[_0xa956('0x35')](_0xa5978e[_0xa956('0x2f')][_0xa956('0x35')]));_0x52d21d['attributes']=_0x52d21d[_0xa956('0x34')]['length']?_0x52d21d[_0xa956('0x34')]:_0x5e8f11[_0xa956('0x33')];_0x52d21d[_0xa956('0x39')]=qs[_0xa956('0x3a')](_0xa5978e['query'][_0xa956('0x3a')]);_0x52d21d[_0xa956('0x3b')]=qs['filters'](_[_0xa956('0x3c')](_0xa5978e[_0xa956('0x2f')],_0x5e8f11[_0xa956('0x31')]));if(_0xa5978e[_0xa956('0x2f')][_0xa956('0x3d')]){_0x52d21d[_0xa956('0x3b')]=_[_0xa956('0x3e')](_0x52d21d[_0xa956('0x3b')],{'$or':_['map'](_0x52d21d[_0xa956('0x34')],function(_0x2945c5){var _0x25f466={};_0x25f466[_0x2945c5]={'$like':'%'+_0xa5978e[_0xa956('0x2f')]['filter']+'%'};return _0x25f466;})});}_0x52d21d=_[_0xa956('0x3e')]({},_0x52d21d,_0xa5978e['options']);return _0x1e3c4a[_0xa956('0x4b')](_0x52d21d);}})[_0xa956('0x23')](function(_0x2c5402){if(_0x2c5402){_0x5575b2=_0x2c5402[_0xa956('0x36')];if(!_0xa5978e['query'][_0xa956('0x37')](_0xa956('0x38'))){_0x52d21d[_0xa956('0x1c')]=qs[_0xa956('0x1c')](_0xa5978e[_0xa956('0x2f')]['limit']);_0x52d21d['offset']=qs['offset'](_0xa5978e[_0xa956('0x2f')][_0xa956('0x1b')]);}return _0x1e3c4a[_0xa956('0x4b')](_0x52d21d);}})['then'](function(_0x2e2b84){if(_0x2e2b84){return _0x2e2b84?{'count':_0x5575b2,'rows':_0x2e2b84}:null;}})['then'](respondWithResult(_0x2a86a7,null))['catch'](handleError(_0x2a86a7,null));};exports['getSubjects']=function(_0x2b5d35,_0x39ae7c,_0x2be3e3){var _0x3a210b={};var _0x397527={};var _0x1730ae;var _0x33b0a8;return db[_0xa956('0x2c')]['findOne']({'where':{'id':_0x2b5d35['params']['id']}})[_0xa956('0x23')](handleEntityNotFound(_0x39ae7c,null))[_0xa956('0x23')](function(_0x3a99e6){if(_0x3a99e6){_0x1730ae=_0x3a99e6;_0x397527[_0xa956('0x33')]=_['keys'](db[_0xa956('0x4d')]['rawAttributes']);_0x397527['query']=_['keys'](_0x2b5d35['query']);_0x397527[_0xa956('0x31')]=_[_0xa956('0x32')](_0x397527[_0xa956('0x33')],_0x397527['query']);_0x3a210b[_0xa956('0x34')]=_[_0xa956('0x32')](_0x397527[_0xa956('0x33')],qs['fields'](_0x2b5d35[_0xa956('0x2f')]['fields']));_0x3a210b['attributes']=_0x3a210b[_0xa956('0x34')]['length']?_0x3a210b[_0xa956('0x34')]:_0x397527[_0xa956('0x33')];_0x3a210b[_0xa956('0x39')]=qs[_0xa956('0x3a')](_0x2b5d35[_0xa956('0x2f')][_0xa956('0x3a')]);_0x3a210b[_0xa956('0x3b')]=qs[_0xa956('0x31')](_[_0xa956('0x3c')](_0x2b5d35[_0xa956('0x2f')],_0x397527[_0xa956('0x31')]));if(_0x2b5d35['query'][_0xa956('0x3d')]){_0x3a210b[_0xa956('0x3b')]=_[_0xa956('0x3e')](_0x3a210b[_0xa956('0x3b')],{'$or':_[_0xa956('0x2b')](_0x3a210b[_0xa956('0x34')],function(_0x5be282){var _0x1748c4={};_0x1748c4[_0x5be282]={'$like':'%'+_0x2b5d35[_0xa956('0x2f')][_0xa956('0x3d')]+'%'};return _0x1748c4;})});}_0x3a210b=_[_0xa956('0x3e')]({},_0x3a210b,_0x2b5d35['options']);return _0x1730ae[_0xa956('0x4e')](_0x3a210b);}})['then'](function(_0xcb18cd){if(_0xcb18cd){_0x33b0a8=_0xcb18cd['length'];if(!_0x2b5d35[_0xa956('0x2f')][_0xa956('0x37')](_0xa956('0x38'))){_0x3a210b[_0xa956('0x1c')]=qs[_0xa956('0x1c')](_0x2b5d35['query']['limit']);_0x3a210b[_0xa956('0x1b')]=qs['offset'](_0x2b5d35[_0xa956('0x2f')][_0xa956('0x1b')]);}return _0x1730ae['getSubjects'](_0x3a210b);}})[_0xa956('0x23')](function(_0x91ca66){if(_0x91ca66){return _0x91ca66?{'count':_0x33b0a8,'rows':_0x91ca66}:null;}})[_0xa956('0x23')](respondWithResult(_0x39ae7c,null))[_0xa956('0x44')](handleError(_0x39ae7c,null));};exports[_0xa956('0x4f')]=function(_0x147041,_0x1c0236,_0x9471c8){var _0x50ddee={};var _0x5740ae={};var _0x27bbfb;var _0xc3fa98;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x147041['params']['id']}})[_0xa956('0x23')](handleEntityNotFound(_0x1c0236,null))['then'](function(_0x53db01){if(_0x53db01){_0x27bbfb=_0x53db01;_0x5740ae[_0xa956('0x33')]=_[_0xa956('0x30')](db['SalesforceField'][_0xa956('0x46')]);_0x5740ae[_0xa956('0x2f')]=_[_0xa956('0x30')](_0x147041['query']);_0x5740ae[_0xa956('0x31')]=_['intersection'](_0x5740ae[_0xa956('0x33')],_0x5740ae[_0xa956('0x2f')]);_0x50ddee[_0xa956('0x34')]=_[_0xa956('0x32')](_0x5740ae[_0xa956('0x33')],qs['fields'](_0x147041[_0xa956('0x2f')]['fields']));_0x50ddee[_0xa956('0x34')]=_0x50ddee[_0xa956('0x34')][_0xa956('0x36')]?_0x50ddee['attributes']:_0x5740ae[_0xa956('0x33')];_0x50ddee[_0xa956('0x39')]=qs[_0xa956('0x3a')](_0x147041[_0xa956('0x2f')]['sort']);_0x50ddee[_0xa956('0x3b')]=qs[_0xa956('0x31')](_[_0xa956('0x3c')](_0x147041[_0xa956('0x2f')],_0x5740ae[_0xa956('0x31')]));if(_0x147041[_0xa956('0x2f')][_0xa956('0x3d')]){_0x50ddee[_0xa956('0x3b')]=_[_0xa956('0x3e')](_0x50ddee[_0xa956('0x3b')],{'$or':_[_0xa956('0x2b')](_0x50ddee[_0xa956('0x34')],function(_0x19db36){var _0x2cd112={};_0x2cd112[_0x19db36]={'$like':'%'+_0x147041['query'][_0xa956('0x3d')]+'%'};return _0x2cd112;})});}_0x50ddee=_[_0xa956('0x3e')]({},_0x50ddee,_0x147041[_0xa956('0x40')]);return _0x27bbfb['getDescriptions'](_0x50ddee);}})[_0xa956('0x23')](function(_0xd47228){if(_0xd47228){_0xc3fa98=_0xd47228[_0xa956('0x36')];if(!_0x147041[_0xa956('0x2f')]['hasOwnProperty']('nolimit')){_0x50ddee['limit']=qs[_0xa956('0x1c')](_0x147041[_0xa956('0x2f')][_0xa956('0x1c')]);_0x50ddee[_0xa956('0x1b')]=qs['offset'](_0x147041['query']['offset']);}return _0x27bbfb['getDescriptions'](_0x50ddee);}})[_0xa956('0x23')](function(_0x562f55){if(_0x562f55){return _0x562f55?{'count':_0xc3fa98,'rows':_0x562f55}:null;}})[_0xa956('0x23')](respondWithResult(_0x1c0236,null))[_0xa956('0x44')](handleError(_0x1c0236,null));}; \ No newline at end of file +var _0x16e6=['squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','create','body','find','getFields','findOne','keys','SalesforceField','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x16e6,0xe8));var _0x616e=function(_0x507403,_0x3f954d){_0x507403=_0x507403-0x0;var _0x1327c=_0x16e6[_0x507403];return _0x1327c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x616e('0x0'));var jsonpatch=require(_0x616e('0x1'));var rp=require(_0x616e('0x2'));var moment=require('moment');var BPromise=require(_0x616e('0x3'));var Mustache=require('mustache');var util=require(_0x616e('0x4'));var path=require(_0x616e('0x5'));var sox=require(_0x616e('0x6'));var csv=require(_0x616e('0x7'));var ejs=require(_0x616e('0x8'));var fs=require('fs');var fs_extra=require(_0x616e('0x9'));var _=require(_0x616e('0xa'));var squel=require(_0x616e('0xb'));var crypto=require('crypto');var jsforce=require(_0x616e('0xc'));var deskjs=require(_0x616e('0xd'));var toCsv=require(_0x616e('0x7'));var querystring=require(_0x616e('0xe'));var Papa=require('papaparse');var Redis=require(_0x616e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x616e('0x10'));var as=require(_0x616e('0x11'));var hardwareService=require(_0x616e('0x12'));var logger=require(_0x616e('0x13'))(_0x616e('0x14'));var utils=require('../../config/utils');var config=require(_0x616e('0x15'));var licenseUtil=require(_0x616e('0x16'));var db=require(_0x616e('0x17'))['db'];function respondWithStatusCode(_0x449feb,_0x24e4cf){_0x24e4cf=_0x24e4cf||0xcc;return function(_0x2272b0){if(_0x2272b0){return _0x449feb[_0x616e('0x18')](_0x24e4cf);}return _0x449feb[_0x616e('0x19')](_0x24e4cf)[_0x616e('0x1a')]();};}function respondWithResult(_0x498058,_0x554662){_0x554662=_0x554662||0xc8;return function(_0x13d222){if(_0x13d222){return _0x498058['status'](_0x554662)[_0x616e('0x1b')](_0x13d222);}};}function respondWithFilteredResult(_0x413e51,_0xbe71f0){return function(_0x204ca6){if(_0x204ca6){var _0x27fbad=typeof _0xbe71f0[_0x616e('0x1c')]===_0x616e('0x1d')&&typeof _0xbe71f0[_0x616e('0x1e')]==='undefined';var _0x2bbaee=_0x204ca6[_0x616e('0x1f')];var _0xb60b63=_0x27fbad?0x0:_0xbe71f0[_0x616e('0x1c')];var _0x5f45d8=_0x27fbad?_0x204ca6[_0x616e('0x1f')]:_0xbe71f0['offset']+_0xbe71f0[_0x616e('0x1e')];var _0x328642;if(_0x5f45d8>=_0x2bbaee){_0x5f45d8=_0x2bbaee;_0x328642=0xc8;}else{_0x328642=0xce;}_0x413e51[_0x616e('0x19')](_0x328642);return _0x413e51[_0x616e('0x20')]('Content-Range',_0xb60b63+'-'+_0x5f45d8+'/'+_0x2bbaee)[_0x616e('0x1b')](_0x204ca6);}return null;};}function patchUpdates(_0x2ef8f1){return function(_0x2e0f63){try{jsonpatch[_0x616e('0x21')](_0x2e0f63,_0x2ef8f1,!![]);}catch(_0x395ade){return BPromise['reject'](_0x395ade);}return _0x2e0f63[_0x616e('0x22')]();};}function saveUpdates(_0x46e663,_0x3acccb){return function(_0x2685ae){if(_0x2685ae){return _0x2685ae[_0x616e('0x23')](_0x46e663)[_0x616e('0x24')](function(_0x50c02a){return _0x50c02a;});}return null;};}function removeEntity(_0x2f67af,_0x5c179a){return function(_0x37aca8){if(_0x37aca8){return _0x37aca8[_0x616e('0x25')]()[_0x616e('0x24')](function(){_0x2f67af[_0x616e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f8738,_0x57c658){return function(_0x3dcd7d){if(!_0x3dcd7d){_0x3f8738['sendStatus'](0x194);}return _0x3dcd7d;};}function handleError(_0x111af3,_0x589dc4){_0x589dc4=_0x589dc4||0x1f4;return function(_0x33ba29){logger[_0x616e('0x26')](_0x33ba29[_0x616e('0x27')]);if(_0x33ba29[_0x616e('0x28')]){delete _0x33ba29[_0x616e('0x28')];}_0x111af3[_0x616e('0x19')](_0x589dc4)['send'](_0x33ba29);};}exports[_0x616e('0x29')]=function(_0x407927,_0x2c217b){var _0x1b0108={},_0x2c00dd={},_0x2f13a5={'count':0x0,'rows':[]};var _0x229393=_[_0x616e('0x2a')](db[_0x616e('0x2b')][_0x616e('0x2c')],function(_0x39044c){return{'name':_0x39044c[_0x616e('0x2d')],'type':_0x39044c[_0x616e('0x2e')][_0x616e('0x2f')]};});_0x2c00dd[_0x616e('0x30')]=_[_0x616e('0x2a')](_0x229393,_0x616e('0x28'));_0x2c00dd[_0x616e('0x31')]=_['keys'](_0x407927[_0x616e('0x31')]);_0x2c00dd[_0x616e('0x32')]=_[_0x616e('0x33')](_0x2c00dd[_0x616e('0x30')],_0x2c00dd['query']);_0x1b0108['attributes']=_['intersection'](_0x2c00dd[_0x616e('0x30')],qs[_0x616e('0x34')](_0x407927[_0x616e('0x31')][_0x616e('0x34')]));_0x1b0108[_0x616e('0x35')]=_0x1b0108[_0x616e('0x35')]['length']?_0x1b0108[_0x616e('0x35')]:_0x2c00dd[_0x616e('0x30')];if(!_0x407927[_0x616e('0x31')][_0x616e('0x36')](_0x616e('0x37'))){_0x1b0108['limit']=qs[_0x616e('0x1e')](_0x407927[_0x616e('0x31')][_0x616e('0x1e')]);_0x1b0108['offset']=qs[_0x616e('0x1c')](_0x407927[_0x616e('0x31')][_0x616e('0x1c')]);}_0x1b0108[_0x616e('0x38')]=qs[_0x616e('0x39')](_0x407927['query'][_0x616e('0x39')]);_0x1b0108[_0x616e('0x3a')]=qs['filters'](_[_0x616e('0x3b')](_0x407927[_0x616e('0x31')],_0x2c00dd[_0x616e('0x32')]),_0x229393);if(_0x407927[_0x616e('0x31')][_0x616e('0x3c')]){_0x1b0108[_0x616e('0x3a')]=_[_0x616e('0x3d')](_0x1b0108[_0x616e('0x3a')],{'$or':_[_0x616e('0x2a')](_0x229393,function(_0x24484e){if(_0x24484e['type']!==_0x616e('0x3e')){var _0x16e133={};_0x16e133[_0x24484e['name']]={'$like':'%'+_0x407927[_0x616e('0x31')][_0x616e('0x3c')]+'%'};return _0x16e133;}})});}_0x1b0108=_['merge']({},_0x1b0108,_0x407927[_0x616e('0x3f')]);var _0x2315fd={'where':_0x1b0108[_0x616e('0x3a')]};return db[_0x616e('0x2b')][_0x616e('0x1f')](_0x2315fd)['then'](function(_0x5749c3){_0x2f13a5[_0x616e('0x1f')]=_0x5749c3;if(_0x407927[_0x616e('0x31')][_0x616e('0x40')]){_0x1b0108['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x616e('0x41')](_0x1b0108);})[_0x616e('0x24')](function(_0x23eefa){_0x2f13a5[_0x616e('0x42')]=_0x23eefa;return _0x2f13a5;})[_0x616e('0x24')](respondWithFilteredResult(_0x2c217b,_0x1b0108))[_0x616e('0x43')](handleError(_0x2c217b,null));};exports[_0x616e('0x44')]=function(_0x99be18,_0x295e7a){var _0x157956={'raw':![],'where':{'id':_0x99be18[_0x616e('0x45')]['id']}},_0x520a92={};_0x520a92['model']=_['keys'](db[_0x616e('0x2b')][_0x616e('0x2c')]);_0x520a92[_0x616e('0x31')]=_['keys'](_0x99be18[_0x616e('0x31')]);_0x520a92[_0x616e('0x32')]=_[_0x616e('0x33')](_0x520a92['model'],_0x520a92['query']);_0x157956[_0x616e('0x35')]=_['intersection'](_0x520a92['model'],qs['fields'](_0x99be18['query'][_0x616e('0x34')]));_0x157956[_0x616e('0x35')]=_0x157956['attributes'][_0x616e('0x46')]?_0x157956['attributes']:_0x520a92['model'];if(_0x99be18[_0x616e('0x31')][_0x616e('0x40')]){_0x157956[_0x616e('0x47')]=[{'all':!![]}];}_0x157956=_[_0x616e('0x3d')]({},_0x157956,_0x99be18[_0x616e('0x3f')]);return db[_0x616e('0x2b')]['find'](_0x157956)[_0x616e('0x24')](handleEntityNotFound(_0x295e7a,null))['then'](respondWithResult(_0x295e7a,null))[_0x616e('0x43')](handleError(_0x295e7a,null));};exports['create']=function(_0x41b421,_0x2dee0f){return db[_0x616e('0x2b')][_0x616e('0x48')](_0x41b421[_0x616e('0x49')],{})[_0x616e('0x24')](respondWithResult(_0x2dee0f,0xc9))['catch'](handleError(_0x2dee0f,null));};exports[_0x616e('0x23')]=function(_0x43bf3a,_0x1b543b){if(_0x43bf3a[_0x616e('0x49')]['id']){delete _0x43bf3a[_0x616e('0x49')]['id'];}return db[_0x616e('0x2b')][_0x616e('0x4a')]({'where':{'id':_0x43bf3a[_0x616e('0x45')]['id']}})[_0x616e('0x24')](handleEntityNotFound(_0x1b543b,null))[_0x616e('0x24')](saveUpdates(_0x43bf3a[_0x616e('0x49')],null))[_0x616e('0x24')](respondWithResult(_0x1b543b,null))[_0x616e('0x43')](handleError(_0x1b543b,null));};exports[_0x616e('0x25')]=function(_0xfc7729,_0x58db42){return db[_0x616e('0x2b')]['find']({'where':{'id':_0xfc7729[_0x616e('0x45')]['id']}})['then'](handleEntityNotFound(_0x58db42,null))[_0x616e('0x24')](removeEntity(_0x58db42,null))[_0x616e('0x43')](handleError(_0x58db42,null));};exports[_0x616e('0x4b')]=function(_0x590d9a,_0x137c13,_0x187b46){var _0x23ecd2={};var _0x3cb4d5={};var _0x4e64e9;var _0x520ce0;return db['SalesforceConfiguration'][_0x616e('0x4c')]({'where':{'id':_0x590d9a[_0x616e('0x45')]['id']}})['then'](handleEntityNotFound(_0x137c13,null))[_0x616e('0x24')](function(_0x1ffff4){if(_0x1ffff4){_0x4e64e9=_0x1ffff4;_0x3cb4d5[_0x616e('0x30')]=_[_0x616e('0x4d')](db[_0x616e('0x4e')][_0x616e('0x2c')]);_0x3cb4d5[_0x616e('0x31')]=_['keys'](_0x590d9a['query']);_0x3cb4d5[_0x616e('0x32')]=_[_0x616e('0x33')](_0x3cb4d5[_0x616e('0x30')],_0x3cb4d5[_0x616e('0x31')]);_0x23ecd2[_0x616e('0x35')]=_[_0x616e('0x33')](_0x3cb4d5[_0x616e('0x30')],qs[_0x616e('0x34')](_0x590d9a[_0x616e('0x31')]['fields']));_0x23ecd2[_0x616e('0x35')]=_0x23ecd2[_0x616e('0x35')][_0x616e('0x46')]?_0x23ecd2[_0x616e('0x35')]:_0x3cb4d5[_0x616e('0x30')];_0x23ecd2[_0x616e('0x38')]=qs[_0x616e('0x39')](_0x590d9a[_0x616e('0x31')]['sort']);_0x23ecd2[_0x616e('0x3a')]=qs[_0x616e('0x32')](_[_0x616e('0x3b')](_0x590d9a[_0x616e('0x31')],_0x3cb4d5[_0x616e('0x32')]));if(_0x590d9a[_0x616e('0x31')][_0x616e('0x3c')]){_0x23ecd2[_0x616e('0x3a')]=_[_0x616e('0x3d')](_0x23ecd2[_0x616e('0x3a')],{'$or':_['map'](_0x23ecd2[_0x616e('0x35')],function(_0x23b984){var _0x7d946a={};_0x7d946a[_0x23b984]={'$like':'%'+_0x590d9a[_0x616e('0x31')][_0x616e('0x3c')]+'%'};return _0x7d946a;})});}_0x23ecd2=_['merge']({},_0x23ecd2,_0x590d9a[_0x616e('0x3f')]);return _0x4e64e9[_0x616e('0x4b')](_0x23ecd2);}})[_0x616e('0x24')](function(_0x2cbe1e){if(_0x2cbe1e){_0x520ce0=_0x2cbe1e[_0x616e('0x46')];if(!_0x590d9a[_0x616e('0x31')][_0x616e('0x36')](_0x616e('0x37'))){_0x23ecd2[_0x616e('0x1e')]=qs[_0x616e('0x1e')](_0x590d9a['query'][_0x616e('0x1e')]);_0x23ecd2[_0x616e('0x1c')]=qs[_0x616e('0x1c')](_0x590d9a[_0x616e('0x31')][_0x616e('0x1c')]);}return _0x4e64e9[_0x616e('0x4b')](_0x23ecd2);}})[_0x616e('0x24')](function(_0x450f9c){if(_0x450f9c){return _0x450f9c?{'count':_0x520ce0,'rows':_0x450f9c}:null;}})[_0x616e('0x24')](respondWithResult(_0x137c13,null))['catch'](handleError(_0x137c13,null));};exports[_0x616e('0x4f')]=function(_0x41aff1,_0x5479f7,_0x53b25e){var _0x7fca1e={};var _0x12e6a1={};var _0x4e62f7;var _0x41f3b5;return db[_0x616e('0x2b')]['findOne']({'where':{'id':_0x41aff1[_0x616e('0x45')]['id']}})['then'](handleEntityNotFound(_0x5479f7,null))['then'](function(_0x1005a4){if(_0x1005a4){_0x4e62f7=_0x1005a4;_0x12e6a1['model']=_[_0x616e('0x4d')](db[_0x616e('0x4e')]['rawAttributes']);_0x12e6a1[_0x616e('0x31')]=_[_0x616e('0x4d')](_0x41aff1[_0x616e('0x31')]);_0x12e6a1['filters']=_[_0x616e('0x33')](_0x12e6a1[_0x616e('0x30')],_0x12e6a1['query']);_0x7fca1e['attributes']=_['intersection'](_0x12e6a1['model'],qs[_0x616e('0x34')](_0x41aff1['query'][_0x616e('0x34')]));_0x7fca1e[_0x616e('0x35')]=_0x7fca1e[_0x616e('0x35')][_0x616e('0x46')]?_0x7fca1e[_0x616e('0x35')]:_0x12e6a1[_0x616e('0x30')];_0x7fca1e[_0x616e('0x38')]=qs[_0x616e('0x39')](_0x41aff1[_0x616e('0x31')][_0x616e('0x39')]);_0x7fca1e[_0x616e('0x3a')]=qs['filters'](_[_0x616e('0x3b')](_0x41aff1[_0x616e('0x31')],_0x12e6a1[_0x616e('0x32')]));if(_0x41aff1['query'][_0x616e('0x3c')]){_0x7fca1e['where']=_[_0x616e('0x3d')](_0x7fca1e[_0x616e('0x3a')],{'$or':_['map'](_0x7fca1e[_0x616e('0x35')],function(_0x357f36){var _0x5ada19={};_0x5ada19[_0x357f36]={'$like':'%'+_0x41aff1[_0x616e('0x31')]['filter']+'%'};return _0x5ada19;})});}_0x7fca1e=_[_0x616e('0x3d')]({},_0x7fca1e,_0x41aff1[_0x616e('0x3f')]);return _0x4e62f7[_0x616e('0x4f')](_0x7fca1e);}})[_0x616e('0x24')](function(_0x207257){if(_0x207257){_0x41f3b5=_0x207257[_0x616e('0x46')];if(!_0x41aff1[_0x616e('0x31')]['hasOwnProperty'](_0x616e('0x37'))){_0x7fca1e[_0x616e('0x1e')]=qs['limit'](_0x41aff1['query'][_0x616e('0x1e')]);_0x7fca1e[_0x616e('0x1c')]=qs[_0x616e('0x1c')](_0x41aff1['query'][_0x616e('0x1c')]);}return _0x4e62f7[_0x616e('0x4f')](_0x7fca1e);}})[_0x616e('0x24')](function(_0x161b44){if(_0x161b44){return _0x161b44?{'count':_0x41f3b5,'rows':_0x161b44}:null;}})[_0x616e('0x24')](respondWithResult(_0x5479f7,null))[_0x616e('0x43')](handleError(_0x5479f7,null));};exports['getDescriptions']=function(_0x46a101,_0xfecd7d,_0x293226){var _0x11bc44={};var _0x3858b9={};var _0x17f166;var _0x417488;return db[_0x616e('0x2b')][_0x616e('0x4c')]({'where':{'id':_0x46a101[_0x616e('0x45')]['id']}})[_0x616e('0x24')](handleEntityNotFound(_0xfecd7d,null))[_0x616e('0x24')](function(_0x94be21){if(_0x94be21){_0x17f166=_0x94be21;_0x3858b9['model']=_[_0x616e('0x4d')](db[_0x616e('0x4e')][_0x616e('0x2c')]);_0x3858b9[_0x616e('0x31')]=_[_0x616e('0x4d')](_0x46a101['query']);_0x3858b9[_0x616e('0x32')]=_[_0x616e('0x33')](_0x3858b9[_0x616e('0x30')],_0x3858b9[_0x616e('0x31')]);_0x11bc44[_0x616e('0x35')]=_[_0x616e('0x33')](_0x3858b9['model'],qs['fields'](_0x46a101[_0x616e('0x31')][_0x616e('0x34')]));_0x11bc44[_0x616e('0x35')]=_0x11bc44['attributes'][_0x616e('0x46')]?_0x11bc44['attributes']:_0x3858b9[_0x616e('0x30')];_0x11bc44['order']=qs[_0x616e('0x39')](_0x46a101[_0x616e('0x31')]['sort']);_0x11bc44[_0x616e('0x3a')]=qs[_0x616e('0x32')](_[_0x616e('0x3b')](_0x46a101[_0x616e('0x31')],_0x3858b9[_0x616e('0x32')]));if(_0x46a101[_0x616e('0x31')][_0x616e('0x3c')]){_0x11bc44[_0x616e('0x3a')]=_[_0x616e('0x3d')](_0x11bc44[_0x616e('0x3a')],{'$or':_[_0x616e('0x2a')](_0x11bc44[_0x616e('0x35')],function(_0x27828b){var _0x24d311={};_0x24d311[_0x27828b]={'$like':'%'+_0x46a101[_0x616e('0x31')][_0x616e('0x3c')]+'%'};return _0x24d311;})});}_0x11bc44=_[_0x616e('0x3d')]({},_0x11bc44,_0x46a101[_0x616e('0x3f')]);return _0x17f166[_0x616e('0x50')](_0x11bc44);}})[_0x616e('0x24')](function(_0x119685){if(_0x119685){_0x417488=_0x119685[_0x616e('0x46')];if(!_0x46a101[_0x616e('0x31')][_0x616e('0x36')](_0x616e('0x37'))){_0x11bc44['limit']=qs[_0x616e('0x1e')](_0x46a101[_0x616e('0x31')][_0x616e('0x1e')]);_0x11bc44[_0x616e('0x1c')]=qs[_0x616e('0x1c')](_0x46a101[_0x616e('0x31')][_0x616e('0x1c')]);}return _0x17f166[_0x616e('0x50')](_0x11bc44);}})['then'](function(_0x195b80){if(_0x195b80){return _0x195b80?{'count':_0x417488,'rows':_0x195b80}:null;}})[_0x616e('0x24')](respondWithResult(_0xfecd7d,null))[_0x616e('0x43')](handleError(_0xfecd7d,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index dc7b547..2d7d902 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 _0xdfbc=['exports','define','int_salesforce_configurations','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xdfbc,0x1bf));var _0xcdfb=function(_0x34d98b,_0x1d54c6){_0x34d98b=_0x34d98b-0x0;var _0x55abfa=_0xdfbc[_0x34d98b];return _0x55abfa;};'use strict';var _=require(_0xcdfb('0x0'));var util=require(_0xcdfb('0x1'));var logger=require('../../config/logger')(_0xcdfb('0x2'));var moment=require(_0xcdfb('0x3'));var BPromise=require(_0xcdfb('0x4'));var rp=require(_0xcdfb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcdfb('0x6'));var config=require(_0xcdfb('0x7'));var attributes=require(_0xcdfb('0x8'));module[_0xcdfb('0x9')]=function(_0x1b7bd9,_0x322fbf){return _0x1b7bd9[_0xcdfb('0xa')]('SalesforceConfiguration',attributes,{'tableName':_0xcdfb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a20=['path','../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','api','bluebird','request-promise'];(function(_0x2bdd09,_0x4627f7){var _0x2728a6=function(_0x7f043a){while(--_0x7f043a){_0x2bdd09['push'](_0x2bdd09['shift']());}};_0x2728a6(++_0x4627f7);}(_0x5a20,0xb6));var _0x05a2=function(_0x3cb4fe,_0x5c1995){_0x3cb4fe=_0x3cb4fe-0x0;var _0x3a81d2=_0x5a20[_0x3cb4fe];return _0x3a81d2;};'use strict';var _=require(_0x05a2('0x0'));var util=require(_0x05a2('0x1'));var logger=require('../../config/logger')(_0x05a2('0x2'));var moment=require('moment');var BPromise=require(_0x05a2('0x3'));var rp=require(_0x05a2('0x4'));var fs=require('fs');var path=require(_0x05a2('0x5'));var rimraf=require('rimraf');var config=require(_0x05a2('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x05a2('0x7')]=function(_0x58b475,_0x205228){return _0x58b475[_0x05a2('0x8')](_0x05a2('0x9'),attributes,{'tableName':_0x05a2('0xa'),'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 4133f6e..676c8b6 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 _0x07c3=['info','SalesforceConfiguration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0x07c3,0x172));var _0x307c=function(_0x48245e,_0x178e51){_0x48245e=_0x48245e-0x0;var _0x4e5e30=_0x07c3[_0x48245e];return _0x4e5e30;};'use strict';var _=require('lodash');var util=require(_0x307c('0x0'));var moment=require(_0x307c('0x1'));var BPromise=require('bluebird');var rs=require(_0x307c('0x2'));var fs=require('fs');var Redis=require(_0x307c('0x3'));var db=require(_0x307c('0x4'))['db'];var utils=require(_0x307c('0x5'));var logger=require(_0x307c('0x6'))(_0x307c('0x7'));var config=require(_0x307c('0x8'));var jayson=require(_0x307c('0x9'));var client=jayson[_0x307c('0xa')][_0x307c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x585bbd,_0xeb388f,_0x5eb4ff){return new BPromise(function(_0x325ec9,_0x3f7617){return client[_0x307c('0xc')](_0x585bbd,_0x5eb4ff)[_0x307c('0xd')](function(_0x106c9b){logger[_0x307c('0xe')](_0x307c('0xf'),_0xeb388f,'request\x20sent');logger[_0x307c('0x10')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0xeb388f,'request\x20sent',JSON[_0x307c('0x11')](_0x106c9b));if(_0x106c9b[_0x307c('0x12')]){if(_0x106c9b['error'][_0x307c('0x13')]===0x1f4){logger['error'](_0x307c('0xf'),_0xeb388f,_0x106c9b[_0x307c('0x12')][_0x307c('0x14')]);return _0x3f7617(_0x106c9b[_0x307c('0x12')][_0x307c('0x14')]);}logger[_0x307c('0x12')](_0x307c('0xf'),_0xeb388f,_0x106c9b[_0x307c('0x12')][_0x307c('0x14')]);return _0x325ec9(_0x106c9b[_0x307c('0x12')][_0x307c('0x14')]);}else{logger[_0x307c('0xe')](_0x307c('0xf'),_0xeb388f,_0x307c('0x15'));_0x325ec9(_0x106c9b[_0x307c('0x16')]['message']);}})[_0x307c('0x17')](function(_0x58f76e){logger['error'](_0x307c('0xf'),_0xeb388f,_0x58f76e);_0x3f7617(_0x58f76e);});});} \ No newline at end of file +var _0x94c1=['http','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x1d9559,_0x383d96){var _0x3be939=function(_0x3f12ed){while(--_0x3f12ed){_0x1d9559['push'](_0x1d9559['shift']());}};_0x3be939(++_0x383d96);}(_0x94c1,0x9d));var _0x194c=function(_0x1d18ed,_0xcdc45b){_0x1d18ed=_0x1d18ed-0x0;var _0x197425=_0x94c1[_0x1d18ed];return _0x197425;};'use strict';var _=require(_0x194c('0x0'));var util=require(_0x194c('0x1'));var moment=require(_0x194c('0x2'));var BPromise=require('bluebird');var rs=require(_0x194c('0x3'));var fs=require('fs');var Redis=require(_0x194c('0x4'));var db=require(_0x194c('0x5'))['db'];var utils=require(_0x194c('0x6'));var logger=require(_0x194c('0x7'))(_0x194c('0x8'));var config=require('../../config/environment');var jayson=require(_0x194c('0x9'));var client=jayson[_0x194c('0xa')][_0x194c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f449c,_0x1821b7,_0x78f820){return new BPromise(function(_0x2e0ce8,_0x32d6b9){return client['request'](_0x4f449c,_0x78f820)[_0x194c('0xc')](function(_0x76b2aa){logger[_0x194c('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1821b7,_0x194c('0xe'));logger[_0x194c('0xf')](_0x194c('0x10'),_0x1821b7,'request\x20sent',JSON[_0x194c('0x11')](_0x76b2aa));if(_0x76b2aa[_0x194c('0x12')]){if(_0x76b2aa[_0x194c('0x12')][_0x194c('0x13')]===0x1f4){logger[_0x194c('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1821b7,_0x76b2aa[_0x194c('0x12')][_0x194c('0x14')]);return _0x32d6b9(_0x76b2aa['error'][_0x194c('0x14')]);}logger[_0x194c('0x12')](_0x194c('0x15'),_0x1821b7,_0x76b2aa[_0x194c('0x12')][_0x194c('0x14')]);return _0x2e0ce8(_0x76b2aa[_0x194c('0x12')][_0x194c('0x14')]);}else{logger[_0x194c('0xd')](_0x194c('0x15'),_0x1821b7,_0x194c('0xe'));_0x2e0ce8(_0x76b2aa[_0x194c('0x16')][_0x194c('0x14')]);}})[_0x194c('0x17')](function(_0xb9e199){logger['error'](_0x194c('0x15'),_0x1821b7,_0xb9e199);_0x32d6b9(_0xb9e199);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index f3c6c05..8910ebb 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 _0xd4ba=['../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','put','update','delete','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd4ba,0x16a));var _0xad4b=function(_0x782a2a,_0x51e40e){_0x782a2a=_0x782a2a-0x0;var _0x141b9f=_0xd4ba[_0x782a2a];return _0x141b9f;};'use strict';var multer=require(_0xad4b('0x0'));var util=require('util');var path=require(_0xad4b('0x1'));var timeout=require('connect-timeout');var express=require(_0xad4b('0x2'));var router=express[_0xad4b('0x3')]();var fs_extra=require(_0xad4b('0x4'));var auth=require(_0xad4b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xad4b('0x6'));var controller=require(_0xad4b('0x7'));router[_0xad4b('0x8')]('/',auth[_0xad4b('0x9')](),controller[_0xad4b('0xa')]);router['get'](_0xad4b('0xb'),auth[_0xad4b('0x9')](),controller[_0xad4b('0xc')]);router['post']('/',auth[_0xad4b('0x9')](),controller['create']);router[_0xad4b('0xd')](_0xad4b('0xb'),auth[_0xad4b('0x9')](),controller[_0xad4b('0xe')]);router[_0xad4b('0xf')]('/:id',auth[_0xad4b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xeab2=['post','create','put','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./intSalesforceField.controller','get','/:id','isAuthenticated','show'];(function(_0x1eb7d1,_0x26b951){var _0x511b48=function(_0x598ba8){while(--_0x598ba8){_0x1eb7d1['push'](_0x1eb7d1['shift']());}};_0x511b48(++_0x26b951);}(_0xeab2,0x75));var _0x2eab=function(_0x29e3b6,_0x40b0b4){_0x29e3b6=_0x29e3b6-0x0;var _0x55d4b0=_0xeab2[_0x29e3b6];return _0x55d4b0;};'use strict';var multer=require(_0x2eab('0x0'));var util=require('util');var path=require(_0x2eab('0x1'));var timeout=require(_0x2eab('0x2'));var express=require('express');var router=express[_0x2eab('0x3')]();var fs_extra=require(_0x2eab('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2eab('0x5'));var controller=require(_0x2eab('0x6'));router[_0x2eab('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2eab('0x7')](_0x2eab('0x8'),auth[_0x2eab('0x9')](),controller[_0x2eab('0xa')]);router[_0x2eab('0xb')]('/',auth[_0x2eab('0x9')](),controller[_0x2eab('0xc')]);router[_0x2eab('0xd')](_0x2eab('0x8'),auth[_0x2eab('0x9')](),controller['update']);router[_0x2eab('0xe')](_0x2eab('0x8'),auth['isAuthenticated'](),controller[_0x2eab('0xf')]);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 b948a9c..89ac406 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 _0xaf64=['variable','keyValue','picklist','STRING','customVariable','sequelize','ENUM','string'];(function(_0x79b649,_0x2115b3){var _0x1af9b1=function(_0x153c9f){while(--_0x153c9f){_0x79b649['push'](_0x79b649['shift']());}};_0x1af9b1(++_0x2115b3);}(_0xaf64,0x65));var _0x4af6=function(_0x26b5ff,_0x92009a){_0x26b5ff=_0x26b5ff-0x0;var _0x58603e=_0xaf64[_0x26b5ff];return _0x58603e;};'use strict';var Sequelize=require(_0x4af6('0x0'));module['exports']={'type':{'type':Sequelize[_0x4af6('0x1')](_0x4af6('0x2'),_0x4af6('0x3'),'customVariable',_0x4af6('0x4'),_0x4af6('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4af6('0x6')]},'key':{'type':Sequelize[_0x4af6('0x6')]},'keyType':{'type':Sequelize[_0x4af6('0x1')](_0x4af6('0x2'),'variable',_0x4af6('0x7'))},'keyContent':{'type':Sequelize[_0x4af6('0x6')]},'idField':{'type':Sequelize[_0x4af6('0x6')]},'variableName':{'type':Sequelize[_0x4af6('0x6')]}}; \ No newline at end of file +var _0x075a=['variable','customVariable','keyValue','STRING','ENUM','string'];(function(_0x22c9ab,_0x234127){var _0x595ecb=function(_0x38af29){while(--_0x38af29){_0x22c9ab['push'](_0x22c9ab['shift']());}};_0x595ecb(++_0x234127);}(_0x075a,0xd0));var _0xa075=function(_0x4b4cc9,_0x462caa){_0x4b4cc9=_0x4b4cc9-0x0;var _0x43cf0e=_0x075a[_0x4b4cc9];return _0x43cf0e;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xa075('0x0')](_0xa075('0x1'),_0xa075('0x2'),_0xa075('0x3'),_0xa075('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xa075('0x5')]},'key':{'type':Sequelize[_0xa075('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0xa075('0x2'),_0xa075('0x3'))},'keyContent':{'type':Sequelize[_0xa075('0x5')]},'idField':{'type':Sequelize[_0xa075('0x5')]},'variableName':{'type':Sequelize[_0xa075('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index c4d427c..2137e5d 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 _0x3d7d=['fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','end','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','SalesforceField','includeAll','rows','catch','show','rawAttributes','find','create','body','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x49155d,_0x2bb881){var _0x4c5f0f=function(_0x290321){while(--_0x290321){_0x49155d['push'](_0x49155d['shift']());}};_0x4c5f0f(++_0x2bb881);}(_0x3d7d,0x1c3));var _0xd3d7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3d7d[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xd3d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd3d7('0x1'));var jsonpatch=require(_0xd3d7('0x2'));var rp=require(_0xd3d7('0x3'));var moment=require(_0xd3d7('0x4'));var BPromise=require(_0xd3d7('0x5'));var Mustache=require(_0xd3d7('0x6'));var util=require(_0xd3d7('0x7'));var path=require('path');var sox=require(_0xd3d7('0x8'));var csv=require(_0xd3d7('0x9'));var ejs=require(_0xd3d7('0xa'));var fs=require('fs');var fs_extra=require(_0xd3d7('0xb'));var _=require(_0xd3d7('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd3d7('0xd'));var deskjs=require(_0xd3d7('0xe'));var toCsv=require(_0xd3d7('0x9'));var querystring=require(_0xd3d7('0xf'));var Papa=require(_0xd3d7('0x10'));var Redis=require(_0xd3d7('0x11'));var authService=require(_0xd3d7('0x12'));var qs=require(_0xd3d7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3d7('0x14'));var logger=require(_0xd3d7('0x15'))(_0xd3d7('0x16'));var utils=require(_0xd3d7('0x17'));var config=require(_0xd3d7('0x18'));var licenseUtil=require(_0xd3d7('0x19'));var db=require(_0xd3d7('0x1a'))['db'];function respondWithStatusCode(_0x36a41f,_0x136353){_0x136353=_0x136353||0xcc;return function(_0x4ff566){if(_0x4ff566){return _0x36a41f[_0xd3d7('0x1b')](_0x136353);}return _0x36a41f[_0xd3d7('0x1c')](_0x136353)['end']();};}function respondWithResult(_0x545440,_0x5036ad){_0x5036ad=_0x5036ad||0xc8;return function(_0x3e9efa){if(_0x3e9efa){return _0x545440['status'](_0x5036ad)[_0xd3d7('0x1d')](_0x3e9efa);}};}function respondWithFilteredResult(_0x570685,_0xcb2e7e){return function(_0x22641c){if(_0x22641c){var _0x52bea1=typeof _0xcb2e7e[_0xd3d7('0x1e')]===_0xd3d7('0x1f')&&typeof _0xcb2e7e[_0xd3d7('0x20')]===_0xd3d7('0x1f');var _0x11b66c=_0x22641c['count'];var _0x13ffc6=_0x52bea1?0x0:_0xcb2e7e[_0xd3d7('0x1e')];var _0x1d7f71=_0x52bea1?_0x22641c[_0xd3d7('0x21')]:_0xcb2e7e[_0xd3d7('0x1e')]+_0xcb2e7e[_0xd3d7('0x20')];var _0x4795b7;if(_0x1d7f71>=_0x11b66c){_0x1d7f71=_0x11b66c;_0x4795b7=0xc8;}else{_0x4795b7=0xce;}_0x570685[_0xd3d7('0x1c')](_0x4795b7);return _0x570685[_0xd3d7('0x22')](_0xd3d7('0x23'),_0x13ffc6+'-'+_0x1d7f71+'/'+_0x11b66c)[_0xd3d7('0x1d')](_0x22641c);}return null;};}function patchUpdates(_0x3eafe8){return function(_0xfffc5){try{jsonpatch[_0xd3d7('0x24')](_0xfffc5,_0x3eafe8,!![]);}catch(_0x4e4d91){return BPromise['reject'](_0x4e4d91);}return _0xfffc5[_0xd3d7('0x25')]();};}function saveUpdates(_0x28f382,_0x1be90d){return function(_0x237903){if(_0x237903){return _0x237903[_0xd3d7('0x26')](_0x28f382)[_0xd3d7('0x27')](function(_0x51d354){return _0x51d354;});}return null;};}function removeEntity(_0x2eb660,_0x57c75f){return function(_0x279704){if(_0x279704){return _0x279704['destroy']()[_0xd3d7('0x27')](function(){_0x2eb660['status'](0xcc)[_0xd3d7('0x28')]();});}};}function handleEntityNotFound(_0x1d28e0,_0x181e11){return function(_0x21f0e9){if(!_0x21f0e9){_0x1d28e0[_0xd3d7('0x1b')](0x194);}return _0x21f0e9;};}function handleError(_0x21de03,_0x5fb0e2){_0x5fb0e2=_0x5fb0e2||0x1f4;return function(_0x581c32){logger['error'](_0x581c32[_0xd3d7('0x29')]);if(_0x581c32[_0xd3d7('0x2a')]){delete _0x581c32[_0xd3d7('0x2a')];}_0x21de03[_0xd3d7('0x1c')](_0x5fb0e2)[_0xd3d7('0x2b')](_0x581c32);};}exports[_0xd3d7('0x2c')]=function(_0x132742,_0x68a605){var _0x555fbe={},_0x5e761a={},_0xed0814={'count':0x0,'rows':[]};var _0x5ab3b8=_[_0xd3d7('0x2d')](db['SalesforceField']['rawAttributes'],function(_0x2d6872){return{'name':_0x2d6872[_0xd3d7('0x2e')],'type':_0x2d6872[_0xd3d7('0x2f')][_0xd3d7('0x30')]};});_0x5e761a[_0xd3d7('0x31')]=_[_0xd3d7('0x2d')](_0x5ab3b8,'name');_0x5e761a[_0xd3d7('0x32')]=_[_0xd3d7('0x33')](_0x132742['query']);_0x5e761a[_0xd3d7('0x34')]=_[_0xd3d7('0x35')](_0x5e761a[_0xd3d7('0x31')],_0x5e761a[_0xd3d7('0x32')]);_0x555fbe[_0xd3d7('0x36')]=_[_0xd3d7('0x35')](_0x5e761a[_0xd3d7('0x31')],qs['fields'](_0x132742[_0xd3d7('0x32')][_0xd3d7('0x37')]));_0x555fbe[_0xd3d7('0x36')]=_0x555fbe['attributes'][_0xd3d7('0x38')]?_0x555fbe[_0xd3d7('0x36')]:_0x5e761a[_0xd3d7('0x31')];if(!_0x132742[_0xd3d7('0x32')][_0xd3d7('0x39')](_0xd3d7('0x3a'))){_0x555fbe[_0xd3d7('0x20')]=qs[_0xd3d7('0x20')](_0x132742[_0xd3d7('0x32')][_0xd3d7('0x20')]);_0x555fbe[_0xd3d7('0x1e')]=qs[_0xd3d7('0x1e')](_0x132742[_0xd3d7('0x32')][_0xd3d7('0x1e')]);}_0x555fbe[_0xd3d7('0x3b')]=qs[_0xd3d7('0x3c')](_0x132742[_0xd3d7('0x32')][_0xd3d7('0x3c')]);_0x555fbe[_0xd3d7('0x3d')]=qs[_0xd3d7('0x34')](_['pick'](_0x132742[_0xd3d7('0x32')],_0x5e761a['filters']),_0x5ab3b8);if(_0x132742[_0xd3d7('0x32')][_0xd3d7('0x3e')]){_0x555fbe[_0xd3d7('0x3d')]=_[_0xd3d7('0x3f')](_0x555fbe[_0xd3d7('0x3d')],{'$or':_[_0xd3d7('0x2d')](_0x5ab3b8,function(_0x266f48){if(_0x266f48[_0xd3d7('0x2f')]!==_0xd3d7('0x40')){var _0x22d7c1={};_0x22d7c1[_0x266f48['name']]={'$like':'%'+_0x132742[_0xd3d7('0x32')][_0xd3d7('0x3e')]+'%'};return _0x22d7c1;}})});}_0x555fbe=_[_0xd3d7('0x3f')]({},_0x555fbe,_0x132742[_0xd3d7('0x41')]);var _0x177752={'where':_0x555fbe[_0xd3d7('0x3d')]};return db[_0xd3d7('0x42')][_0xd3d7('0x21')](_0x177752)[_0xd3d7('0x27')](function(_0x139927){_0xed0814[_0xd3d7('0x21')]=_0x139927;if(_0x132742['query'][_0xd3d7('0x43')]){_0x555fbe['include']=[{'all':!![]}];}return db[_0xd3d7('0x42')]['findAll'](_0x555fbe);})[_0xd3d7('0x27')](function(_0xbe14b7){_0xed0814[_0xd3d7('0x44')]=_0xbe14b7;return _0xed0814;})[_0xd3d7('0x27')](respondWithFilteredResult(_0x68a605,_0x555fbe))[_0xd3d7('0x45')](handleError(_0x68a605,null));};exports[_0xd3d7('0x46')]=function(_0x5ca4c8,_0x4142aa){var _0x21b660={'raw':!![],'where':{'id':_0x5ca4c8['params']['id']}},_0x2e1832={};_0x2e1832['model']=_[_0xd3d7('0x33')](db['SalesforceField'][_0xd3d7('0x47')]);_0x2e1832[_0xd3d7('0x32')]=_[_0xd3d7('0x33')](_0x5ca4c8[_0xd3d7('0x32')]);_0x2e1832[_0xd3d7('0x34')]=_['intersection'](_0x2e1832[_0xd3d7('0x31')],_0x2e1832[_0xd3d7('0x32')]);_0x21b660[_0xd3d7('0x36')]=_[_0xd3d7('0x35')](_0x2e1832[_0xd3d7('0x31')],qs[_0xd3d7('0x37')](_0x5ca4c8['query'][_0xd3d7('0x37')]));_0x21b660[_0xd3d7('0x36')]=_0x21b660[_0xd3d7('0x36')]['length']?_0x21b660[_0xd3d7('0x36')]:_0x2e1832[_0xd3d7('0x31')];if(_0x5ca4c8[_0xd3d7('0x32')][_0xd3d7('0x43')]){_0x21b660['include']=[{'all':!![]}];}_0x21b660=_[_0xd3d7('0x3f')]({},_0x21b660,_0x5ca4c8[_0xd3d7('0x41')]);return db[_0xd3d7('0x42')][_0xd3d7('0x48')](_0x21b660)['then'](handleEntityNotFound(_0x4142aa,null))[_0xd3d7('0x27')](respondWithResult(_0x4142aa,null))[_0xd3d7('0x45')](handleError(_0x4142aa,null));};exports['create']=function(_0x557b7f,_0x2cef5e){return db['SalesforceField'][_0xd3d7('0x49')](_0x557b7f[_0xd3d7('0x4a')],{})[_0xd3d7('0x27')](respondWithResult(_0x2cef5e,0xc9))[_0xd3d7('0x45')](handleError(_0x2cef5e,null));};exports[_0xd3d7('0x26')]=function(_0x53bfa6,_0x3a3222){if(_0x53bfa6[_0xd3d7('0x4a')]['id']){delete _0x53bfa6[_0xd3d7('0x4a')]['id'];}return db['SalesforceField'][_0xd3d7('0x48')]({'where':{'id':_0x53bfa6[_0xd3d7('0x4b')]['id']}})[_0xd3d7('0x27')](handleEntityNotFound(_0x3a3222,null))[_0xd3d7('0x27')](saveUpdates(_0x53bfa6[_0xd3d7('0x4a')],null))[_0xd3d7('0x27')](respondWithResult(_0x3a3222,null))[_0xd3d7('0x45')](handleError(_0x3a3222,null));};exports[_0xd3d7('0x4c')]=function(_0x17f126,_0xce6c06){return db[_0xd3d7('0x42')][_0xd3d7('0x48')]({'where':{'id':_0x17f126['params']['id']}})[_0xd3d7('0x27')](handleEntityNotFound(_0xce6c06,null))[_0xd3d7('0x27')](removeEntity(_0xce6c06,null))[_0xd3d7('0x45')](handleError(_0xce6c06,null));}; \ No newline at end of file +var _0xb983=['body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','SalesforceField','include','findAll','catch','show','params','includeAll','find','create'];(function(_0x370f7d,_0x1db710){var _0x48173a=function(_0x592acb){while(--_0x592acb){_0x370f7d['push'](_0x370f7d['shift']());}};_0x48173a(++_0x1db710);}(_0xb983,0x91));var _0x3b98=function(_0x5ef905,_0x564b87){_0x5ef905=_0x5ef905-0x0;var _0x367808=_0xb983[_0x5ef905];return _0x367808;};'use strict';var emlformat=require(_0x3b98('0x0'));var rimraf=require(_0x3b98('0x1'));var zipdir=require(_0x3b98('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b98('0x3'));var moment=require(_0x3b98('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3b98('0x5'));var util=require(_0x3b98('0x6'));var path=require(_0x3b98('0x7'));var sox=require(_0x3b98('0x8'));var csv=require(_0x3b98('0x9'));var ejs=require(_0x3b98('0xa'));var fs=require('fs');var fs_extra=require(_0x3b98('0xb'));var _=require(_0x3b98('0xc'));var squel=require(_0x3b98('0xd'));var crypto=require(_0x3b98('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3b98('0x9'));var querystring=require(_0x3b98('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3b98('0x10'));var as=require(_0x3b98('0x11'));var hardwareService=require(_0x3b98('0x12'));var logger=require(_0x3b98('0x13'))(_0x3b98('0x14'));var utils=require(_0x3b98('0x15'));var config=require(_0x3b98('0x16'));var licenseUtil=require(_0x3b98('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4db520,_0x56872e){_0x56872e=_0x56872e||0xcc;return function(_0xf86092){if(_0xf86092){return _0x4db520['sendStatus'](_0x56872e);}return _0x4db520['status'](_0x56872e)[_0x3b98('0x18')]();};}function respondWithResult(_0x1d3ef8,_0x1dd02c){_0x1dd02c=_0x1dd02c||0xc8;return function(_0xb30fd){if(_0xb30fd){return _0x1d3ef8[_0x3b98('0x19')](_0x1dd02c)[_0x3b98('0x1a')](_0xb30fd);}};}function respondWithFilteredResult(_0x29e79e,_0x1d554a){return function(_0x14f21f){if(_0x14f21f){var _0x593242=typeof _0x1d554a[_0x3b98('0x1b')]===_0x3b98('0x1c')&&typeof _0x1d554a['limit']===_0x3b98('0x1c');var _0x203bf1=_0x14f21f[_0x3b98('0x1d')];var _0x537417=_0x593242?0x0:_0x1d554a[_0x3b98('0x1b')];var _0x3325a5=_0x593242?_0x14f21f['count']:_0x1d554a[_0x3b98('0x1b')]+_0x1d554a[_0x3b98('0x1e')];var _0x13408c;if(_0x3325a5>=_0x203bf1){_0x3325a5=_0x203bf1;_0x13408c=0xc8;}else{_0x13408c=0xce;}_0x29e79e[_0x3b98('0x19')](_0x13408c);return _0x29e79e[_0x3b98('0x1f')]('Content-Range',_0x537417+'-'+_0x3325a5+'/'+_0x203bf1)[_0x3b98('0x1a')](_0x14f21f);}return null;};}function patchUpdates(_0x3deff5){return function(_0x389548){try{jsonpatch[_0x3b98('0x20')](_0x389548,_0x3deff5,!![]);}catch(_0x273585){return BPromise[_0x3b98('0x21')](_0x273585);}return _0x389548[_0x3b98('0x22')]();};}function saveUpdates(_0x1c558c,_0xe6b118){return function(_0x23becf){if(_0x23becf){return _0x23becf[_0x3b98('0x23')](_0x1c558c)[_0x3b98('0x24')](function(_0x37603c){return _0x37603c;});}return null;};}function removeEntity(_0x3142a9,_0x3315af){return function(_0x3eb82f){if(_0x3eb82f){return _0x3eb82f[_0x3b98('0x25')]()['then'](function(){_0x3142a9[_0x3b98('0x19')](0xcc)[_0x3b98('0x18')]();});}};}function handleEntityNotFound(_0xd3a962,_0x38aabd){return function(_0x5f1f26){if(!_0x5f1f26){_0xd3a962['sendStatus'](0x194);}return _0x5f1f26;};}function handleError(_0x279a47,_0x2cb06b){_0x2cb06b=_0x2cb06b||0x1f4;return function(_0x42bf60){logger[_0x3b98('0x26')](_0x42bf60[_0x3b98('0x27')]);if(_0x42bf60['name']){delete _0x42bf60[_0x3b98('0x28')];}_0x279a47['status'](_0x2cb06b)[_0x3b98('0x29')](_0x42bf60);};}exports['index']=function(_0x1983e9,_0x58be1d){var _0x5bb285={},_0x24026a={},_0x1592c7={'count':0x0,'rows':[]};var _0x48db61=_[_0x3b98('0x2a')](db['SalesforceField'][_0x3b98('0x2b')],function(_0x505adb){return{'name':_0x505adb[_0x3b98('0x2c')],'type':_0x505adb['type'][_0x3b98('0x2d')]};});_0x24026a[_0x3b98('0x2e')]=_['map'](_0x48db61,_0x3b98('0x28'));_0x24026a['query']=_[_0x3b98('0x2f')](_0x1983e9[_0x3b98('0x30')]);_0x24026a[_0x3b98('0x31')]=_['intersection'](_0x24026a[_0x3b98('0x2e')],_0x24026a['query']);_0x5bb285[_0x3b98('0x32')]=_[_0x3b98('0x33')](_0x24026a[_0x3b98('0x2e')],qs[_0x3b98('0x34')](_0x1983e9[_0x3b98('0x30')][_0x3b98('0x34')]));_0x5bb285[_0x3b98('0x32')]=_0x5bb285[_0x3b98('0x32')][_0x3b98('0x35')]?_0x5bb285[_0x3b98('0x32')]:_0x24026a[_0x3b98('0x2e')];if(!_0x1983e9[_0x3b98('0x30')]['hasOwnProperty']('nolimit')){_0x5bb285[_0x3b98('0x1e')]=qs['limit'](_0x1983e9[_0x3b98('0x30')][_0x3b98('0x1e')]);_0x5bb285[_0x3b98('0x1b')]=qs[_0x3b98('0x1b')](_0x1983e9[_0x3b98('0x30')][_0x3b98('0x1b')]);}_0x5bb285[_0x3b98('0x36')]=qs[_0x3b98('0x37')](_0x1983e9[_0x3b98('0x30')][_0x3b98('0x37')]);_0x5bb285[_0x3b98('0x38')]=qs[_0x3b98('0x31')](_[_0x3b98('0x39')](_0x1983e9['query'],_0x24026a['filters']),_0x48db61);if(_0x1983e9[_0x3b98('0x30')][_0x3b98('0x3a')]){_0x5bb285[_0x3b98('0x38')]=_[_0x3b98('0x3b')](_0x5bb285[_0x3b98('0x38')],{'$or':_['map'](_0x48db61,function(_0x97c38e){if(_0x97c38e['type']!==_0x3b98('0x3c')){var _0x1198f4={};_0x1198f4[_0x97c38e['name']]={'$like':'%'+_0x1983e9[_0x3b98('0x30')][_0x3b98('0x3a')]+'%'};return _0x1198f4;}})});}_0x5bb285=_[_0x3b98('0x3b')]({},_0x5bb285,_0x1983e9[_0x3b98('0x3d')]);var _0x9d9137={'where':_0x5bb285[_0x3b98('0x38')]};return db[_0x3b98('0x3e')]['count'](_0x9d9137)[_0x3b98('0x24')](function(_0x75de0f){_0x1592c7[_0x3b98('0x1d')]=_0x75de0f;if(_0x1983e9[_0x3b98('0x30')]['includeAll']){_0x5bb285[_0x3b98('0x3f')]=[{'all':!![]}];}return db[_0x3b98('0x3e')][_0x3b98('0x40')](_0x5bb285);})['then'](function(_0x28391e){_0x1592c7['rows']=_0x28391e;return _0x1592c7;})[_0x3b98('0x24')](respondWithFilteredResult(_0x58be1d,_0x5bb285))[_0x3b98('0x41')](handleError(_0x58be1d,null));};exports[_0x3b98('0x42')]=function(_0x56bad1,_0x2176c0){var _0x560795={'raw':!![],'where':{'id':_0x56bad1[_0x3b98('0x43')]['id']}},_0x4f77b7={};_0x4f77b7[_0x3b98('0x2e')]=_[_0x3b98('0x2f')](db['SalesforceField'][_0x3b98('0x2b')]);_0x4f77b7[_0x3b98('0x30')]=_[_0x3b98('0x2f')](_0x56bad1[_0x3b98('0x30')]);_0x4f77b7[_0x3b98('0x31')]=_['intersection'](_0x4f77b7[_0x3b98('0x2e')],_0x4f77b7['query']);_0x560795[_0x3b98('0x32')]=_[_0x3b98('0x33')](_0x4f77b7[_0x3b98('0x2e')],qs[_0x3b98('0x34')](_0x56bad1[_0x3b98('0x30')][_0x3b98('0x34')]));_0x560795[_0x3b98('0x32')]=_0x560795[_0x3b98('0x32')][_0x3b98('0x35')]?_0x560795[_0x3b98('0x32')]:_0x4f77b7[_0x3b98('0x2e')];if(_0x56bad1[_0x3b98('0x30')][_0x3b98('0x44')]){_0x560795[_0x3b98('0x3f')]=[{'all':!![]}];}_0x560795=_[_0x3b98('0x3b')]({},_0x560795,_0x56bad1[_0x3b98('0x3d')]);return db['SalesforceField'][_0x3b98('0x45')](_0x560795)['then'](handleEntityNotFound(_0x2176c0,null))[_0x3b98('0x24')](respondWithResult(_0x2176c0,null))[_0x3b98('0x41')](handleError(_0x2176c0,null));};exports['create']=function(_0x3b3ad5,_0x244606){return db[_0x3b98('0x3e')][_0x3b98('0x46')](_0x3b3ad5[_0x3b98('0x47')],{})[_0x3b98('0x24')](respondWithResult(_0x244606,0xc9))['catch'](handleError(_0x244606,null));};exports[_0x3b98('0x23')]=function(_0x4fd197,_0x4cf153){if(_0x4fd197[_0x3b98('0x47')]['id']){delete _0x4fd197[_0x3b98('0x47')]['id'];}return db[_0x3b98('0x3e')][_0x3b98('0x45')]({'where':{'id':_0x4fd197[_0x3b98('0x43')]['id']}})[_0x3b98('0x24')](handleEntityNotFound(_0x4cf153,null))[_0x3b98('0x24')](saveUpdates(_0x4fd197[_0x3b98('0x47')],null))['then'](respondWithResult(_0x4cf153,null))[_0x3b98('0x41')](handleError(_0x4cf153,null));};exports['destroy']=function(_0x34fb1b,_0x4d6829){return db[_0x3b98('0x3e')]['find']({'where':{'id':_0x34fb1b[_0x3b98('0x43')]['id']}})[_0x3b98('0x24')](handleEntityNotFound(_0x4d6829,null))['then'](removeEntity(_0x4d6829,null))[_0x3b98('0x41')](handleError(_0x4d6829,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 30a2976..702b016 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 _0xbb9d=['define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbb9d,0x127));var _0xdbb9=function(_0x8ad2dd,_0x2a5364){_0x8ad2dd=_0x8ad2dd-0x0;var _0x1a9112=_0xbb9d[_0x8ad2dd];return _0x1a9112;};'use strict';var _=require(_0xdbb9('0x0'));var util=require(_0xdbb9('0x1'));var logger=require(_0xdbb9('0x2'))(_0xdbb9('0x3'));var moment=require(_0xdbb9('0x4'));var BPromise=require(_0xdbb9('0x5'));var rp=require(_0xdbb9('0x6'));var fs=require('fs');var path=require(_0xdbb9('0x7'));var rimraf=require(_0xdbb9('0x8'));var config=require(_0xdbb9('0x9'));var attributes=require(_0xdbb9('0xa'));module['exports']=function(_0x49581a,_0x4f12a0){return _0x49581a[_0xdbb9('0xb')](_0xdbb9('0xc'),attributes,{'tableName':_0xdbb9('0xd'),'paranoid':![],'indexes':[{'name':_0xdbb9('0xe'),'fields':[_0xdbb9('0xf'),_0xdbb9('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4bbe=['exports','define','SalesforceField','salesforce_unique_index','FieldId','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceField.attributes'];(function(_0xfada82,_0x18d901){var _0x76c8b3=function(_0x46952e){while(--_0x46952e){_0xfada82['push'](_0xfada82['shift']());}};_0x76c8b3(++_0x18d901);}(_0x4bbe,0x163));var _0xe4bb=function(_0x3b410d,_0x1c5220){_0x3b410d=_0x3b410d-0x0;var _0x325d47=_0x4bbe[_0x3b410d];return _0x325d47;};'use strict';var _=require(_0xe4bb('0x0'));var util=require(_0xe4bb('0x1'));var logger=require('../../config/logger')(_0xe4bb('0x2'));var moment=require(_0xe4bb('0x3'));var BPromise=require(_0xe4bb('0x4'));var rp=require(_0xe4bb('0x5'));var fs=require('fs');var path=require(_0xe4bb('0x6'));var rimraf=require('rimraf');var config=require(_0xe4bb('0x7'));var attributes=require(_0xe4bb('0x8'));module[_0xe4bb('0x9')]=function(_0x524c6f,_0x3dd2e7){return _0x524c6f[_0xe4bb('0xa')](_0xe4bb('0xb'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xe4bb('0xc'),'fields':['idField',_0xe4bb('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index c891d62..a0a74d8 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 _0xef45=['../../config/environment','client','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../config/logger'];(function(_0x45b0b7,_0x577bd4){var _0x10d101=function(_0x19893e){while(--_0x19893e){_0x45b0b7['push'](_0x45b0b7['shift']());}};_0x10d101(++_0x577bd4);}(_0xef45,0xcc));var _0x5ef4=function(_0x38adc4,_0x279319){_0x38adc4=_0x38adc4-0x0;var _0x20b733=_0xef45[_0x38adc4];return _0x20b733;};'use strict';var _=require(_0x5ef4('0x0'));var util=require(_0x5ef4('0x1'));var moment=require(_0x5ef4('0x2'));var BPromise=require(_0x5ef4('0x3'));var rs=require(_0x5ef4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5ef4('0x5'))('rpc');var config=require(_0x5ef4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5ef4('0x7')][_0x5ef4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c1107,_0x1e3741,_0x538504){return new BPromise(function(_0x25bffc,_0x34e977){return client[_0x5ef4('0x9')](_0x4c1107,_0x538504)[_0x5ef4('0xa')](function(_0x2180d0){logger['info'](_0x5ef4('0xb'),_0x1e3741,_0x5ef4('0xc'));logger[_0x5ef4('0xd')](_0x5ef4('0xe'),_0x1e3741,_0x5ef4('0xc'),JSON[_0x5ef4('0xf')](_0x2180d0));if(_0x2180d0[_0x5ef4('0x10')]){if(_0x2180d0[_0x5ef4('0x10')][_0x5ef4('0x11')]===0x1f4){logger[_0x5ef4('0x10')]('SalesforceField,\x20%s,\x20%s',_0x1e3741,_0x2180d0['error']['message']);return _0x34e977(_0x2180d0[_0x5ef4('0x10')][_0x5ef4('0x12')]);}logger[_0x5ef4('0x10')](_0x5ef4('0xb'),_0x1e3741,_0x2180d0[_0x5ef4('0x10')]['message']);return _0x25bffc(_0x2180d0[_0x5ef4('0x10')][_0x5ef4('0x12')]);}else{logger[_0x5ef4('0x13')](_0x5ef4('0xb'),_0x1e3741,_0x5ef4('0xc'));_0x25bffc(_0x2180d0[_0x5ef4('0x14')][_0x5ef4('0x12')]);}})['catch'](function(_0x33f077){logger[_0x5ef4('0x10')](_0x5ef4('0xb'),_0x1e3741,_0x33f077);_0x34e977(_0x33f077);});});} \ No newline at end of file +var _0x11ac=['message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x41453a,_0x19559a){var _0x36b884=function(_0x38cdaf){while(--_0x38cdaf){_0x41453a['push'](_0x41453a['shift']());}};_0x36b884(++_0x19559a);}(_0x11ac,0x18e));var _0xc11a=function(_0x480afe,_0x175253){_0x480afe=_0x480afe-0x0;var _0x19e5f9=_0x11ac[_0x480afe];return _0x19e5f9;};'use strict';var _=require(_0xc11a('0x0'));var util=require(_0xc11a('0x1'));var moment=require(_0xc11a('0x2'));var BPromise=require(_0xc11a('0x3'));var rs=require(_0xc11a('0x4'));var fs=require('fs');var Redis=require(_0xc11a('0x5'));var db=require(_0xc11a('0x6'))['db'];var utils=require(_0xc11a('0x7'));var logger=require(_0xc11a('0x8'))(_0xc11a('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc11a('0xa')][_0xc11a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x100a22,_0x12dae9,_0x5e87f4){return new BPromise(function(_0x187704,_0x5c9eaf){return client[_0xc11a('0xc')](_0x100a22,_0x5e87f4)[_0xc11a('0xd')](function(_0x32ed0c){logger['info'](_0xc11a('0xe'),_0x12dae9,_0xc11a('0xf'));logger[_0xc11a('0x10')](_0xc11a('0x11'),_0x12dae9,_0xc11a('0xf'),JSON['stringify'](_0x32ed0c));if(_0x32ed0c[_0xc11a('0x12')]){if(_0x32ed0c[_0xc11a('0x12')][_0xc11a('0x13')]===0x1f4){logger[_0xc11a('0x12')](_0xc11a('0xe'),_0x12dae9,_0x32ed0c[_0xc11a('0x12')][_0xc11a('0x14')]);return _0x5c9eaf(_0x32ed0c['error']['message']);}logger['error'](_0xc11a('0xe'),_0x12dae9,_0x32ed0c[_0xc11a('0x12')][_0xc11a('0x14')]);return _0x187704(_0x32ed0c[_0xc11a('0x12')][_0xc11a('0x14')]);}else{logger[_0xc11a('0x15')](_0xc11a('0xe'),_0x12dae9,_0xc11a('0xf'));_0x187704(_0x32ed0c['result']['message']);}})['catch'](function(_0x268098){logger[_0xc11a('0x12')](_0xc11a('0xe'),_0x12dae9,_0x268098);_0x5c9eaf(_0x268098);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 37edc54..6ee48f8 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 _0x30fc=['/:id','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','exports','multer','util','connect-timeout','express','fs-extra','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index'];(function(_0x175174,_0x1ec35f){var _0x25b620=function(_0x4df524){while(--_0x4df524){_0x175174['push'](_0x175174['shift']());}};_0x25b620(++_0x1ec35f);}(_0x30fc,0xfa));var _0xc30f=function(_0x5062da,_0x4400d2){_0x5062da=_0x5062da-0x0;var _0x46d327=_0x30fc[_0x5062da];return _0x46d327;};'use strict';var multer=require(_0xc30f('0x0'));var util=require(_0xc30f('0x1'));var path=require('path');var timeout=require(_0xc30f('0x2'));var express=require(_0xc30f('0x3'));var router=express['Router']();var fs_extra=require(_0xc30f('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc30f('0x5'));var controller=require(_0xc30f('0x6'));router[_0xc30f('0x7')]('/',auth[_0xc30f('0x8')](),controller[_0xc30f('0x9')]);router[_0xc30f('0x7')](_0xc30f('0xa'),auth[_0xc30f('0x8')](),controller['show']);router[_0xc30f('0x7')]('/:id/configurations',auth[_0xc30f('0x8')](),controller[_0xc30f('0xb')]);router[_0xc30f('0x7')](_0xc30f('0xc'),auth[_0xc30f('0x8')](),controller[_0xc30f('0xd')]);router[_0xc30f('0xe')]('/',auth[_0xc30f('0x8')](),controller[_0xc30f('0xf')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xc30f('0x10')]);router[_0xc30f('0x11')]('/:id',auth[_0xc30f('0x8')](),controller[_0xc30f('0x12')]);router['delete']('/:id',auth[_0xc30f('0x8')](),controller['destroy']);module[_0xc30f('0x13')]=router; \ No newline at end of file +var _0x0fc2=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','delete','exports','multer','util','path','connect-timeout','Router'];(function(_0x2c170a,_0x5014fa){var _0x546098=function(_0x1738f6){while(--_0x1738f6){_0x2c170a['push'](_0x2c170a['shift']());}};_0x546098(++_0x5014fa);}(_0x0fc2,0x6e));var _0x20fc=function(_0x39675a,_0x35d94f){_0x39675a=_0x39675a-0x0;var _0x25d638=_0x0fc2[_0x39675a];return _0x25d638;};'use strict';var multer=require(_0x20fc('0x0'));var util=require(_0x20fc('0x1'));var path=require(_0x20fc('0x2'));var timeout=require(_0x20fc('0x3'));var express=require('express');var router=express[_0x20fc('0x4')]();var fs_extra=require(_0x20fc('0x5'));var auth=require(_0x20fc('0x6'));var interaction=require(_0x20fc('0x7'));var config=require(_0x20fc('0x8'));var controller=require(_0x20fc('0x9'));router[_0x20fc('0xa')]('/',auth[_0x20fc('0xb')](),controller[_0x20fc('0xc')]);router[_0x20fc('0xa')](_0x20fc('0xd'),auth[_0x20fc('0xb')](),controller[_0x20fc('0xe')]);router[_0x20fc('0xa')](_0x20fc('0xf'),auth[_0x20fc('0xb')](),controller['getConfigurations']);router[_0x20fc('0xa')](_0x20fc('0x10'),auth[_0x20fc('0xb')](),controller['getFields']);router[_0x20fc('0x11')]('/',auth[_0x20fc('0xb')](),controller[_0x20fc('0x12')]);router[_0x20fc('0x11')](_0x20fc('0xf'),auth[_0x20fc('0xb')](),controller[_0x20fc('0x13')]);router[_0x20fc('0x14')]('/:id',auth[_0x20fc('0xb')](),controller['update']);router[_0x20fc('0x15')]('/:id',auth[_0x20fc('0xb')](),controller['destroy']);module[_0x20fc('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 85b9584..3ec498f 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 _0xcf62=['remoteUri','exports','STRING','username'];(function(_0x12efb1,_0x209905){var _0x2dbf53=function(_0x1a728e){while(--_0x1a728e){_0x12efb1['push'](_0x12efb1['shift']());}};_0x2dbf53(++_0x209905);}(_0xcf62,0xad));var _0x2cf6=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xcf62[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require('sequelize');module[_0x2cf6('0x0')]={'name':{'type':Sequelize[_0x2cf6('0x1')]},'description':{'type':Sequelize[_0x2cf6('0x1')]},'username':{'type':Sequelize[_0x2cf6('0x1')],'unique':_0x2cf6('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2cf6('0x1')],'unique':_0x2cf6('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x538b=['remoteUri','sequelize','exports','STRING','username'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x538b,0x187));var _0xb538=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x538b[_0x68c979];return _0x4f0001;};'use strict';var Sequelize=require(_0xb538('0x0'));module[_0xb538('0x1')]={'name':{'type':Sequelize[_0xb538('0x2')]},'description':{'type':Sequelize[_0xb538('0x2')]},'username':{'type':Sequelize[_0xb538('0x2')],'unique':_0xb538('0x3')},'password':{'type':Sequelize[_0xb538('0x2')]},'email':{'type':Sequelize[_0xb538('0x2')]},'remoteUri':{'type':Sequelize[_0xb538('0x2')],'unique':_0xb538('0x4')},'serverUrl':{'type':Sequelize[_0xb538('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 af68b24..3e02344 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 _0xae7e=['opened_by','user_input','sys_created_on','state','calendar_stc','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','expected_start','business_duration','work_end','resolved_at','approval_set','work_notes','short_description','close_code','delivery_task','work_start','additional_assignee_list','close_notes','closed_by','sys_id','reopened_by','problem_id','company','reassignment_count','activity_due','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','all','log','TCL:\x20_object','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','True','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','push','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','merge','type','VIRTUAL','where','includeAll','include','ServicenowAccount','findAll','rows','show','params','options','find','catch','create','body','findOne','ServicenowConfiguration','getConfigurations','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','hold_reason','knowledge','subcategory','notify','incident_state','severity','category','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','number'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xae7e,0x1b1));var _0xeae7=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xae7e[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xeae7('0x0'));var jsonpatch=require(_0xeae7('0x1'));var rp=require('request-promise');var moment=require(_0xeae7('0x2'));var BPromise=require(_0xeae7('0x3'));var Mustache=require('mustache');var util=require(_0xeae7('0x4'));var path=require(_0xeae7('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeae7('0x6'));var fs=require('fs');var fs_extra=require(_0xeae7('0x7'));var _=require(_0xeae7('0x8'));var squel=require(_0xeae7('0x9'));var crypto=require('crypto');var jsforce=require(_0xeae7('0xa'));var deskjs=require(_0xeae7('0xb'));var toCsv=require(_0xeae7('0xc'));var querystring=require(_0xeae7('0xd'));var Papa=require(_0xeae7('0xe'));var Redis=require('ioredis');var authService=require(_0xeae7('0xf'));var qs=require(_0xeae7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeae7('0x11'));var logger=require(_0xeae7('0x12'))(_0xeae7('0x13'));var utils=require(_0xeae7('0x14'));var config=require(_0xeae7('0x15'));var licenseUtil=require(_0xeae7('0x16'));var db=require(_0xeae7('0x17'))['db'];var integrations=require(_0xeae7('0x18'));function respondWithStatusCode(_0x15ab92,_0x21219f){_0x21219f=_0x21219f||0xcc;return function(_0x2ae485){if(_0x2ae485){return _0x15ab92[_0xeae7('0x19')](_0x21219f);}return _0x15ab92[_0xeae7('0x1a')](_0x21219f)[_0xeae7('0x1b')]();};}function respondWithResult(_0x17ee95,_0x79954d){_0x79954d=_0x79954d||0xc8;return function(_0x11d99b){if(_0x11d99b){return _0x17ee95[_0xeae7('0x1a')](_0x79954d)['json'](_0x11d99b);}};}function respondWithFilteredResult(_0x45fbd8,_0x2d0493){return function(_0x32dd11){if(_0x32dd11){var _0x50442d=typeof _0x2d0493[_0xeae7('0x1c')]===_0xeae7('0x1d')&&typeof _0x2d0493[_0xeae7('0x1e')]===_0xeae7('0x1d');var _0x570a74=_0x32dd11[_0xeae7('0x1f')];var _0x5d3363=_0x50442d?0x0:_0x2d0493[_0xeae7('0x1c')];var _0x55f234=_0x50442d?_0x32dd11['count']:_0x2d0493['offset']+_0x2d0493[_0xeae7('0x1e')];var _0x28dd75;if(_0x55f234>=_0x570a74){_0x55f234=_0x570a74;_0x28dd75=0xc8;}else{_0x28dd75=0xce;}_0x45fbd8[_0xeae7('0x1a')](_0x28dd75);return _0x45fbd8[_0xeae7('0x20')](_0xeae7('0x21'),_0x5d3363+'-'+_0x55f234+'/'+_0x570a74)[_0xeae7('0x22')](_0x32dd11);}return null;};}function patchUpdates(_0x17aaba){return function(_0x523f58){try{jsonpatch[_0xeae7('0x23')](_0x523f58,_0x17aaba,!![]);}catch(_0x5803d4){return BPromise[_0xeae7('0x24')](_0x5803d4);}return _0x523f58[_0xeae7('0x25')]();};}function saveUpdates(_0x5c5d77,_0x49ec52){return function(_0x528c14){if(_0x528c14){return _0x528c14[_0xeae7('0x26')](_0x5c5d77)[_0xeae7('0x27')](function(_0x510e9b){return _0x510e9b;});}return null;};}function removeEntity(_0x354fec,_0x3e8679){return function(_0x3c7188){if(_0x3c7188){return _0x3c7188[_0xeae7('0x28')]()['then'](function(){_0x354fec['status'](0xcc)[_0xeae7('0x1b')]();});}};}function handleEntityNotFound(_0x335368,_0x50c326){return function(_0x339800){if(!_0x339800){_0x335368[_0xeae7('0x19')](0x194);}return _0x339800;};}function handleError(_0x1bb483,_0x58a28a){_0x58a28a=_0x58a28a||0x1f4;return function(_0x429ca3){logger[_0xeae7('0x29')](_0x429ca3[_0xeae7('0x2a')]);if(_0x429ca3[_0xeae7('0x2b')]){delete _0x429ca3[_0xeae7('0x2b')];}_0x1bb483['status'](_0x58a28a)[_0xeae7('0x2c')](_0x429ca3);};}exports[_0xeae7('0x2d')]=function(_0x30934b,_0x18ca95){var _0x321eb2={},_0x5f400b={},_0xf8a11b={'count':0x0,'rows':[]};var _0x5a149d=_[_0xeae7('0x2e')](db['ServicenowAccount'][_0xeae7('0x2f')],function(_0x2682f0){return{'name':_0x2682f0[_0xeae7('0x30')],'type':_0x2682f0['type']['key']};});_0x5f400b[_0xeae7('0x31')]=_[_0xeae7('0x2e')](_0x5a149d,'name');_0x5f400b['query']=_[_0xeae7('0x32')](_0x30934b['query']);_0x5f400b['filters']=_['intersection'](_0x5f400b[_0xeae7('0x31')],_0x5f400b[_0xeae7('0x33')]);_0x321eb2[_0xeae7('0x34')]=_[_0xeae7('0x35')](_0x5f400b[_0xeae7('0x31')],qs[_0xeae7('0x36')](_0x30934b['query'][_0xeae7('0x36')]));_0x321eb2[_0xeae7('0x34')]=_0x321eb2[_0xeae7('0x34')][_0xeae7('0x37')]?_0x321eb2[_0xeae7('0x34')]:_0x5f400b[_0xeae7('0x31')];if(!_0x30934b['query'][_0xeae7('0x38')](_0xeae7('0x39'))){_0x321eb2['limit']=qs[_0xeae7('0x1e')](_0x30934b[_0xeae7('0x33')][_0xeae7('0x1e')]);_0x321eb2[_0xeae7('0x1c')]=qs[_0xeae7('0x1c')](_0x30934b['query']['offset']);}_0x321eb2[_0xeae7('0x3a')]=qs['sort'](_0x30934b[_0xeae7('0x33')][_0xeae7('0x3b')]);_0x321eb2['where']=qs['filters'](_[_0xeae7('0x3c')](_0x30934b[_0xeae7('0x33')],_0x5f400b[_0xeae7('0x3d')]),_0x5a149d);if(_0x30934b['query'][_0xeae7('0x3e')]){_0x321eb2['where']=_[_0xeae7('0x3f')](_0x321eb2['where'],{'$or':_[_0xeae7('0x2e')](_0x5a149d,function(_0x584763){if(_0x584763[_0xeae7('0x40')]!==_0xeae7('0x41')){var _0x321f0b={};_0x321f0b[_0x584763[_0xeae7('0x2b')]]={'$like':'%'+_0x30934b['query'][_0xeae7('0x3e')]+'%'};return _0x321f0b;}})});}_0x321eb2=_[_0xeae7('0x3f')]({},_0x321eb2,_0x30934b['options']);var _0x16dd35={'where':_0x321eb2[_0xeae7('0x42')]};return db['ServicenowAccount'][_0xeae7('0x1f')](_0x16dd35)[_0xeae7('0x27')](function(_0x1d4154){_0xf8a11b['count']=_0x1d4154;if(_0x30934b[_0xeae7('0x33')][_0xeae7('0x43')]){_0x321eb2[_0xeae7('0x44')]=[{'all':!![]}];}return db[_0xeae7('0x45')][_0xeae7('0x46')](_0x321eb2);})['then'](function(_0x136dab){_0xf8a11b[_0xeae7('0x47')]=_0x136dab;return _0xf8a11b;})['then'](respondWithFilteredResult(_0x18ca95,_0x321eb2))['catch'](handleError(_0x18ca95,null));};exports[_0xeae7('0x48')]=function(_0x15301a,_0x1e76ec){var _0x5e7c9b={'raw':![],'where':{'id':_0x15301a[_0xeae7('0x49')]['id']}},_0xcd7254={};_0xcd7254[_0xeae7('0x31')]=_[_0xeae7('0x32')](db[_0xeae7('0x45')][_0xeae7('0x2f')]);_0xcd7254[_0xeae7('0x33')]=_[_0xeae7('0x32')](_0x15301a['query']);_0xcd7254[_0xeae7('0x3d')]=_[_0xeae7('0x35')](_0xcd7254[_0xeae7('0x31')],_0xcd7254[_0xeae7('0x33')]);_0x5e7c9b[_0xeae7('0x34')]=_[_0xeae7('0x35')](_0xcd7254[_0xeae7('0x31')],qs[_0xeae7('0x36')](_0x15301a[_0xeae7('0x33')]['fields']));_0x5e7c9b[_0xeae7('0x34')]=_0x5e7c9b[_0xeae7('0x34')][_0xeae7('0x37')]?_0x5e7c9b[_0xeae7('0x34')]:_0xcd7254[_0xeae7('0x31')];if(_0x15301a[_0xeae7('0x33')][_0xeae7('0x43')]){_0x5e7c9b['include']=[{'all':!![]}];}_0x5e7c9b=_[_0xeae7('0x3f')]({},_0x5e7c9b,_0x15301a[_0xeae7('0x4a')]);return db[_0xeae7('0x45')][_0xeae7('0x4b')](_0x5e7c9b)[_0xeae7('0x27')](handleEntityNotFound(_0x1e76ec,null))['then'](respondWithResult(_0x1e76ec,null))[_0xeae7('0x4c')](handleError(_0x1e76ec,null));};exports['create']=function(_0x319aff,_0x7b96ec){return db[_0xeae7('0x45')][_0xeae7('0x4d')](_0x319aff[_0xeae7('0x4e')],{})[_0xeae7('0x27')](respondWithResult(_0x7b96ec,0xc9))['catch'](handleError(_0x7b96ec,null));};exports[_0xeae7('0x26')]=function(_0x476a2f,_0x140800){if(_0x476a2f[_0xeae7('0x4e')]['id']){delete _0x476a2f[_0xeae7('0x4e')]['id'];}return db[_0xeae7('0x45')]['find']({'where':{'id':_0x476a2f['params']['id']}})[_0xeae7('0x27')](handleEntityNotFound(_0x140800,null))[_0xeae7('0x27')](saveUpdates(_0x476a2f[_0xeae7('0x4e')],null))[_0xeae7('0x27')](respondWithResult(_0x140800,null))['catch'](handleError(_0x140800,null));};exports[_0xeae7('0x28')]=function(_0x2ca2a4,_0x336120){return db[_0xeae7('0x45')][_0xeae7('0x4b')]({'where':{'id':_0x2ca2a4[_0xeae7('0x49')]['id']}})[_0xeae7('0x27')](handleEntityNotFound(_0x336120,null))['then'](removeEntity(_0x336120,null))['catch'](handleError(_0x336120,null));};exports['getConfigurations']=function(_0xf9667a,_0x4d7e17,_0x38e390){var _0x3915ef={};var _0x4d80fd={};var _0x2dc50c;var _0x44f2bf;return db[_0xeae7('0x45')][_0xeae7('0x4f')]({'where':{'id':_0xf9667a[_0xeae7('0x49')]['id']}})[_0xeae7('0x27')](handleEntityNotFound(_0x4d7e17,null))[_0xeae7('0x27')](function(_0x16d4bd){if(_0x16d4bd){_0x2dc50c=_0x16d4bd;_0x4d80fd[_0xeae7('0x31')]=_[_0xeae7('0x32')](db[_0xeae7('0x50')][_0xeae7('0x2f')]);_0x4d80fd['query']=_[_0xeae7('0x32')](_0xf9667a[_0xeae7('0x33')]);_0x4d80fd[_0xeae7('0x3d')]=_[_0xeae7('0x35')](_0x4d80fd[_0xeae7('0x31')],_0x4d80fd[_0xeae7('0x33')]);_0x3915ef[_0xeae7('0x34')]=_[_0xeae7('0x35')](_0x4d80fd[_0xeae7('0x31')],qs['fields'](_0xf9667a[_0xeae7('0x33')][_0xeae7('0x36')]));_0x3915ef[_0xeae7('0x34')]=_0x3915ef[_0xeae7('0x34')][_0xeae7('0x37')]?_0x3915ef[_0xeae7('0x34')]:_0x4d80fd[_0xeae7('0x31')];_0x3915ef['order']=qs[_0xeae7('0x3b')](_0xf9667a[_0xeae7('0x33')][_0xeae7('0x3b')]);_0x3915ef[_0xeae7('0x42')]=qs[_0xeae7('0x3d')](_[_0xeae7('0x3c')](_0xf9667a[_0xeae7('0x33')],_0x4d80fd[_0xeae7('0x3d')]));if(_0xf9667a['query'][_0xeae7('0x3e')]){_0x3915ef[_0xeae7('0x42')]=_[_0xeae7('0x3f')](_0x3915ef[_0xeae7('0x42')],{'$or':_[_0xeae7('0x2e')](_0x3915ef[_0xeae7('0x34')],function(_0x161c9b){var _0x160d2b={};_0x160d2b[_0x161c9b]={'$like':'%'+_0xf9667a[_0xeae7('0x33')][_0xeae7('0x3e')]+'%'};return _0x160d2b;})});}_0x3915ef=_[_0xeae7('0x3f')]({},_0x3915ef,_0xf9667a[_0xeae7('0x4a')]);return _0x2dc50c[_0xeae7('0x51')](_0x3915ef);}})['then'](function(_0x4271cd){if(_0x4271cd){_0x44f2bf=_0x4271cd[_0xeae7('0x37')];if(!_0xf9667a[_0xeae7('0x33')][_0xeae7('0x38')](_0xeae7('0x39'))){_0x3915ef['limit']=qs[_0xeae7('0x1e')](_0xf9667a['query'][_0xeae7('0x1e')]);_0x3915ef[_0xeae7('0x1c')]=qs[_0xeae7('0x1c')](_0xf9667a[_0xeae7('0x33')][_0xeae7('0x1c')]);}return _0x2dc50c['getConfigurations'](_0x3915ef);}})[_0xeae7('0x27')](function(_0xa2d864){if(_0xa2d864){return _0xa2d864?{'count':_0x44f2bf,'rows':_0xa2d864}:null;}})[_0xeae7('0x27')](respondWithResult(_0x4d7e17,null))['catch'](handleError(_0x4d7e17,null));};exports['addConfiguration']=function(_0x49218e,_0x1f2616,_0x1761ac){if(_0x49218e[_0xeae7('0x4e')]['id']){delete _0x49218e[_0xeae7('0x4e')]['id'];}return db[_0xeae7('0x45')][_0xeae7('0x4f')]({'where':{'id':_0x49218e['params']['id']}})[_0xeae7('0x27')](handleEntityNotFound(_0x1f2616,null))[_0xeae7('0x27')](function(_0x2df406){if(_0x2df406){_0x49218e['body'][_0xeae7('0x52')]=_0x2df406['id'];_0x49218e[_0xeae7('0x4e')]['Subjects']=integrations[_0xeae7('0x53')](_0x49218e[_0xeae7('0x4e')][_0xeae7('0x54')],_0x49218e['body'][_0xeae7('0x40')]);_0x49218e[_0xeae7('0x4e')][_0xeae7('0x55')]=integrations[_0xeae7('0x56')](_0x49218e[_0xeae7('0x4e')][_0xeae7('0x54')],_0x49218e[_0xeae7('0x4e')][_0xeae7('0x40')]);return db[_0xeae7('0x50')][_0xeae7('0x4d')](_0x49218e[_0xeae7('0x4e')],{'include':[{'model':db[_0xeae7('0x57')],'as':_0xeae7('0x58')},{'model':db[_0xeae7('0x57')],'as':_0xeae7('0x55')}]});}return null;})[_0xeae7('0x27')](respondWithResult(_0x1f2616,null))[_0xeae7('0x4c')](handleError(_0x1f2616,null));};exports[_0xeae7('0x59')]=function(_0x3a2f4b,_0x588a5b,_0x2e5d30){var _0x25a15d=['made_sla',_0xeae7('0x5a'),_0xeae7('0x5b'),_0xeae7('0x5c'),'close_code',_0xeae7('0x5d'),_0xeae7('0x5e'),_0xeae7('0x5f'),_0xeae7('0x60')];var _0x17eb86=[_0xeae7('0x61'),'made_sla',_0xeae7('0x62'),_0xeae7('0x63'),'upon_reject',_0xeae7('0x64'),_0xeae7('0x65'),_0xeae7('0x5a'),_0xeae7('0x66'),_0xeae7('0x67'),'resolved_by','sys_updated_by',_0xeae7('0x68'),_0xeae7('0x69'),_0xeae7('0x6a'),'sys_domain',_0xeae7('0x6b'),'sys_created_by',_0xeae7('0x5b'),'order',_0xeae7('0x6c'),'closed_at',_0xeae7('0x6d'),_0xeae7('0x6e'),_0xeae7('0x6f'),_0xeae7('0x70'),_0xeae7('0x71'),_0xeae7('0x72'),_0xeae7('0x73'),'sys_domain_path','rfc','time_worked',_0xeae7('0x74'),'opened_at',_0xeae7('0x75'),'group_list',_0xeae7('0x76'),'reopened_time',_0xeae7('0x77'),'caller_id',_0xeae7('0x78'),_0xeae7('0x5c'),_0xeae7('0x79'),_0xeae7('0x7a'),_0xeae7('0x7b'),'correlation_display',_0xeae7('0x7c'),_0xeae7('0x7d'),'assignment_group','business_stc',_0xeae7('0x7e'),'description','calendar_duration','notify','sys_class_name',_0xeae7('0x7f'),_0xeae7('0x80'),'follow_up','parent_incident',_0xeae7('0x81'),'contact_type',_0xeae7('0x82'),_0xeae7('0x5e'),'urgency',_0xeae7('0x83'),_0xeae7('0x84'),_0xeae7('0x85'),_0xeae7('0x86'),'assigned_to',_0xeae7('0x5f'),_0xeae7('0x87'),_0xeae7('0x88'),'approval',_0xeae7('0x89'),_0xeae7('0x8a'),_0xeae7('0x8b'),_0xeae7('0x8c'),_0xeae7('0x8d'),'escalation','upon_approval',_0xeae7('0x8e'),_0xeae7('0x8f'),_0xeae7('0x60')];var _0x1cc562='';var _0x439123='';var _0x251f86=[];var _0x1e4c3d='';var _0x3bda2d='';var _0x1dca00=[];var _0x257c4d='';var _0x54f1d2='';var _0x108037={};var _0x45f268='';return db[_0xeae7('0x45')][_0xeae7('0x4f')]({'where':{'id':_0x3a2f4b[_0xeae7('0x49')]['id']},'attributes':['id',_0xeae7('0x90'),_0xeae7('0x91'),_0xeae7('0x92'),_0xeae7('0x93'),_0xeae7('0x94')]})[_0xeae7('0x27')](handleEntityNotFound(_0x588a5b,null))[_0xeae7('0x27')](function(_0xd1de9){if(_0xd1de9){_0x45f268=_0xd1de9[_0xeae7('0x93')];var _0x5de3e0=_0x45f268[_0xeae7('0x95')](-0x1);if(_0x5de3e0==='/'){_0x45f268=_0x45f268['substring'](0x0,_0x45f268['lastIndexOf'](_0x5de3e0));}_0x54f1d2=util['format'](_0xeae7('0x96'),_0x45f268);_0x257c4d=util[_0xeae7('0x97')](_0xeae7('0x98'),_0x45f268);_0x108037={'user':_0xd1de9[_0xeae7('0x90')],'pass':_0xd1de9[_0xeae7('0x91')]};var _0x5200d5={'method':_0xeae7('0x99'),'uri':_0x54f1d2+_0xeae7('0x9a'),'auth':_0x108037,'json':!![]};return rp(_0x5200d5);}})[_0xeae7('0x27')](function(_0x46cc62){if(_0x46cc62[_0xeae7('0x9b')][_0xeae7('0x37')]>0x0){_0x1cc562=_0x46cc62[_0xeae7('0x9b')];}console['log'](_0xeae7('0x9c'),_0x1cc562);_0x1dca00=[];_0x439123=Object[_0xeae7('0x9d')]([],_0x1cc562);_[_0xeae7('0x9e')](_0x439123,function(_0x524e7a){return!_0x25a15d[_0xeae7('0x9f')](_0x524e7a['name']);});_0x439123[_0xeae7('0xa0')](function(_0x1ed3c7){var _0x436621=createFieldObject(_0x257c4d,_0x108037,_0x1ed3c7[_0xeae7('0xa1')],_0x1ed3c7[_0xeae7('0x2b')],_0x1ed3c7[_0xeae7('0xa2')],![]);_0x1dca00['push'](_0x436621);});return Promise[_0xeae7('0xa3')](_0x1dca00);})[_0xeae7('0x27')](function(_0x13d106){_0x251f86=_0x13d106;_0x1e4c3d=Object[_0xeae7('0x9d')]([],_0x1cc562);console[_0xeae7('0xa4')](_0xeae7('0xa5'),_0x1cc562);_[_0xeae7('0x9e')](_0x1e4c3d,function(_0x4f2591){return _0x17eb86['includes'](_0x4f2591[_0xeae7('0x2b')]);});console[_0xeae7('0xa4')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x1e4c3d);_0x1dca00=[];_0x1e4c3d[_0xeae7('0xa0')](function(_0x228c69){var _0x15bd1e=createFieldObject(_0x257c4d,_0x108037,_0x228c69['internalType'],_0x228c69[_0xeae7('0x2b')],_0x228c69['label'],!![]);_0x1dca00['push'](_0x15bd1e);});return Promise[_0xeae7('0xa3')](_0x1dca00);})[_0xeae7('0x27')](function(_0x39ac9b){_0x3bda2d=_0x39ac9b;var _0x26719d=_0x251f86[_0xeae7('0xa6')](_0x3bda2d);return{'count':_0x26719d[_0xeae7('0x37')],'rows':_0x26719d};})[_0xeae7('0x27')](respondWithResult(_0x588a5b,null))[_0xeae7('0x4c')](function(_0x1109df){console[_0xeae7('0xa4')](_0xeae7('0xa7')+_0x1109df);var _0x535545=_0x3a2f4b[_0xeae7('0x33')][_0xeae7('0xa8')]?0x1f4:_0x1109df['statusCode']||0x1f4;logger['error'](_0x1109df[_0xeae7('0x2a')]);delete _0x1109df[_0xeae7('0x2b')];if(_0x535545===0x191){_0x535545=0x190;}_0x588a5b[_0xeae7('0x1a')](_0x535545)[_0xeae7('0x2c')](_0x3a2f4b[_0xeae7('0x33')][_0xeae7('0xa8')]?{'message':_0xeae7('0xa9'),'statusCode':_0x1109df[_0xeae7('0xaa')]}:_0x1109df);});};function createFieldObject(_0xf0f17b,_0x1a6a8e,_0x1f953a,_0x5e3256,_0x4db24b,_0x56bb4d){return new Promise(function(_0x33c118,_0x16a5fd){var _0x88fa78={'id':_0x5e3256,'name':_0x4db24b,'custom':_0x56bb4d};if(_0x1f953a===_0xeae7('0xab')){_0x88fa78[_0xeae7('0x4a')]=[{'name':_0xeae7('0xac'),'value':_0xeae7('0xad')},{'name':'False','value':_0xeae7('0xae')}];_0x33c118(_0x88fa78);}else{var _0x920c4={'method':'GET','uri':_0xf0f17b+_0xeae7('0xaf')+_0x5e3256,'auth':_0x1a6a8e,'json':!![]};return rp(_0x920c4)[_0xeae7('0x27')](function(_0x47259a){var _0x3dbaa2=[];if(_0x47259a['result'][_0xeae7('0x37')]>0x0){_0x47259a[_0xeae7('0x9b')][_0xeae7('0xa0')](function(_0x262ff4){if(_0x262ff4[_0xeae7('0xb0')]===_0xeae7('0xae')){var _0x1c15e9={'name':_0x262ff4['label'],'value':_0x262ff4[_0xeae7('0xb1')]};_0x3dbaa2[_0xeae7('0xb2')](_0x1c15e9);}});}_0x88fa78['options']=_0x3dbaa2;if(_0x88fa78[_0xeae7('0x4a')][_0xeae7('0x37')]>0x0){_0x33c118(_0x88fa78);}else{if(_0x56bb4d==![]){_0x33c118();}else{_0x33c118(_0x88fa78);}}});}});} \ No newline at end of file +var _0x042c=['reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_tags','correlation_id','location','username','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','incident?sysparm_display_value=all','result','assign','remove','includes','forEach','internalType','push','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','ServiceNow\x20error:\x20','test','statusCode','stack','Wrong\x20credentials','boolean','True','GET','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','map','ServicenowAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','findOne','ServicenowConfiguration','rawAttributes','order','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','ServicenowField','made_sla','hold_reason','knowledge','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','business_service','priority','sys_domain_path','rfc','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','subcategory','work_notes','short_description','delivery_task','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','company'];(function(_0x181d2d,_0x480cc8){var _0x4a0cfc=function(_0x5e96b1){while(--_0x5e96b1){_0x181d2d['push'](_0x181d2d['shift']());}};_0x4a0cfc(++_0x480cc8);}(_0x042c,0xe3));var _0xc042=function(_0x49fa24,_0x340e17){_0x49fa24=_0x49fa24-0x0;var _0x16bf61=_0x042c[_0x49fa24];return _0x16bf61;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc042('0x0'));var jsonpatch=require(_0xc042('0x1'));var rp=require(_0xc042('0x2'));var moment=require('moment');var BPromise=require(_0xc042('0x3'));var Mustache=require(_0xc042('0x4'));var util=require(_0xc042('0x5'));var path=require('path');var sox=require(_0xc042('0x6'));var csv=require(_0xc042('0x7'));var ejs=require(_0xc042('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc042('0x9'));var squel=require(_0xc042('0xa'));var crypto=require(_0xc042('0xb'));var jsforce=require(_0xc042('0xc'));var deskjs=require(_0xc042('0xd'));var toCsv=require(_0xc042('0x7'));var querystring=require(_0xc042('0xe'));var Papa=require(_0xc042('0xf'));var Redis=require(_0xc042('0x10'));var authService=require(_0xc042('0x11'));var qs=require(_0xc042('0x12'));var as=require(_0xc042('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc042('0x14'))(_0xc042('0x15'));var utils=require(_0xc042('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc042('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc042('0x18'));function respondWithStatusCode(_0x3baf6d,_0x41a0f7){_0x41a0f7=_0x41a0f7||0xcc;return function(_0x3862a0){if(_0x3862a0){return _0x3baf6d[_0xc042('0x19')](_0x41a0f7);}return _0x3baf6d['status'](_0x41a0f7)[_0xc042('0x1a')]();};}function respondWithResult(_0x32d538,_0x453874){_0x453874=_0x453874||0xc8;return function(_0x556606){if(_0x556606){return _0x32d538[_0xc042('0x1b')](_0x453874)[_0xc042('0x1c')](_0x556606);}};}function respondWithFilteredResult(_0x2dc303,_0x456ef9){return function(_0xee595a){if(_0xee595a){var _0x1d5774=typeof _0x456ef9[_0xc042('0x1d')]===_0xc042('0x1e')&&typeof _0x456ef9[_0xc042('0x1f')]===_0xc042('0x1e');var _0x152dff=_0xee595a['count'];var _0x58654a=_0x1d5774?0x0:_0x456ef9[_0xc042('0x1d')];var _0x520497=_0x1d5774?_0xee595a[_0xc042('0x20')]:_0x456ef9[_0xc042('0x1d')]+_0x456ef9[_0xc042('0x1f')];var _0x25eaa5;if(_0x520497>=_0x152dff){_0x520497=_0x152dff;_0x25eaa5=0xc8;}else{_0x25eaa5=0xce;}_0x2dc303[_0xc042('0x1b')](_0x25eaa5);return _0x2dc303[_0xc042('0x21')](_0xc042('0x22'),_0x58654a+'-'+_0x520497+'/'+_0x152dff)[_0xc042('0x1c')](_0xee595a);}return null;};}function patchUpdates(_0x324fc4){return function(_0x57c0e9){try{jsonpatch['apply'](_0x57c0e9,_0x324fc4,!![]);}catch(_0x4dbe0e){return BPromise[_0xc042('0x23')](_0x4dbe0e);}return _0x57c0e9[_0xc042('0x24')]();};}function saveUpdates(_0x52ee9f,_0xa8e223){return function(_0xc4c990){if(_0xc4c990){return _0xc4c990[_0xc042('0x25')](_0x52ee9f)[_0xc042('0x26')](function(_0x296fa8){return _0x296fa8;});}return null;};}function removeEntity(_0x441a42,_0xce1ddf){return function(_0x243eab){if(_0x243eab){return _0x243eab[_0xc042('0x27')]()[_0xc042('0x26')](function(){_0x441a42[_0xc042('0x1b')](0xcc)[_0xc042('0x1a')]();});}};}function handleEntityNotFound(_0x2e9ad6,_0x33395f){return function(_0x335824){if(!_0x335824){_0x2e9ad6['sendStatus'](0x194);}return _0x335824;};}function handleError(_0x5218ea,_0x4e91db){_0x4e91db=_0x4e91db||0x1f4;return function(_0x93fc63){logger[_0xc042('0x28')](_0x93fc63['stack']);if(_0x93fc63['name']){delete _0x93fc63[_0xc042('0x29')];}_0x5218ea[_0xc042('0x1b')](_0x4e91db)[_0xc042('0x2a')](_0x93fc63);};}exports['index']=function(_0x8200bf,_0x36688a){var _0x675e5f={},_0x327c09={},_0x20cbe8={'count':0x0,'rows':[]};var _0x1c1b04=_[_0xc042('0x2b')](db[_0xc042('0x2c')]['rawAttributes'],function(_0x1c5cfd){return{'name':_0x1c5cfd[_0xc042('0x2d')],'type':_0x1c5cfd[_0xc042('0x2e')][_0xc042('0x2f')]};});_0x327c09[_0xc042('0x30')]=_['map'](_0x1c1b04,_0xc042('0x29'));_0x327c09[_0xc042('0x31')]=_[_0xc042('0x32')](_0x8200bf[_0xc042('0x31')]);_0x327c09[_0xc042('0x33')]=_['intersection'](_0x327c09['model'],_0x327c09[_0xc042('0x31')]);_0x675e5f[_0xc042('0x34')]=_[_0xc042('0x35')](_0x327c09['model'],qs[_0xc042('0x36')](_0x8200bf[_0xc042('0x31')][_0xc042('0x36')]));_0x675e5f[_0xc042('0x34')]=_0x675e5f[_0xc042('0x34')][_0xc042('0x37')]?_0x675e5f[_0xc042('0x34')]:_0x327c09[_0xc042('0x30')];if(!_0x8200bf[_0xc042('0x31')][_0xc042('0x38')](_0xc042('0x39'))){_0x675e5f[_0xc042('0x1f')]=qs['limit'](_0x8200bf[_0xc042('0x31')][_0xc042('0x1f')]);_0x675e5f[_0xc042('0x1d')]=qs['offset'](_0x8200bf['query']['offset']);}_0x675e5f['order']=qs['sort'](_0x8200bf['query'][_0xc042('0x3a')]);_0x675e5f[_0xc042('0x3b')]=qs[_0xc042('0x33')](_[_0xc042('0x3c')](_0x8200bf['query'],_0x327c09[_0xc042('0x33')]),_0x1c1b04);if(_0x8200bf[_0xc042('0x31')][_0xc042('0x3d')]){_0x675e5f[_0xc042('0x3b')]=_[_0xc042('0x3e')](_0x675e5f['where'],{'$or':_[_0xc042('0x2b')](_0x1c1b04,function(_0xbf956d){if(_0xbf956d['type']!==_0xc042('0x3f')){var _0x2f9cef={};_0x2f9cef[_0xbf956d[_0xc042('0x29')]]={'$like':'%'+_0x8200bf['query']['filter']+'%'};return _0x2f9cef;}})});}_0x675e5f=_[_0xc042('0x3e')]({},_0x675e5f,_0x8200bf[_0xc042('0x40')]);var _0x41c992={'where':_0x675e5f[_0xc042('0x3b')]};return db[_0xc042('0x2c')][_0xc042('0x20')](_0x41c992)[_0xc042('0x26')](function(_0xac730b){_0x20cbe8[_0xc042('0x20')]=_0xac730b;if(_0x8200bf[_0xc042('0x31')]['includeAll']){_0x675e5f[_0xc042('0x41')]=[{'all':!![]}];}return db[_0xc042('0x2c')][_0xc042('0x42')](_0x675e5f);})['then'](function(_0x46b670){_0x20cbe8[_0xc042('0x43')]=_0x46b670;return _0x20cbe8;})[_0xc042('0x26')](respondWithFilteredResult(_0x36688a,_0x675e5f))[_0xc042('0x44')](handleError(_0x36688a,null));};exports[_0xc042('0x45')]=function(_0x5a2597,_0x5b607a){var _0x531f88={'raw':![],'where':{'id':_0x5a2597[_0xc042('0x46')]['id']}},_0x5c6d9f={};_0x5c6d9f[_0xc042('0x30')]=_['keys'](db[_0xc042('0x2c')]['rawAttributes']);_0x5c6d9f['query']=_[_0xc042('0x32')](_0x5a2597[_0xc042('0x31')]);_0x5c6d9f[_0xc042('0x33')]=_[_0xc042('0x35')](_0x5c6d9f[_0xc042('0x30')],_0x5c6d9f[_0xc042('0x31')]);_0x531f88[_0xc042('0x34')]=_[_0xc042('0x35')](_0x5c6d9f['model'],qs[_0xc042('0x36')](_0x5a2597[_0xc042('0x31')][_0xc042('0x36')]));_0x531f88[_0xc042('0x34')]=_0x531f88[_0xc042('0x34')][_0xc042('0x37')]?_0x531f88['attributes']:_0x5c6d9f[_0xc042('0x30')];if(_0x5a2597[_0xc042('0x31')][_0xc042('0x47')]){_0x531f88[_0xc042('0x41')]=[{'all':!![]}];}_0x531f88=_[_0xc042('0x3e')]({},_0x531f88,_0x5a2597[_0xc042('0x40')]);return db[_0xc042('0x2c')][_0xc042('0x48')](_0x531f88)[_0xc042('0x26')](handleEntityNotFound(_0x5b607a,null))['then'](respondWithResult(_0x5b607a,null))[_0xc042('0x44')](handleError(_0x5b607a,null));};exports['create']=function(_0x51121c,_0x3609de){return db['ServicenowAccount'][_0xc042('0x49')](_0x51121c[_0xc042('0x4a')],{})[_0xc042('0x26')](respondWithResult(_0x3609de,0xc9))['catch'](handleError(_0x3609de,null));};exports[_0xc042('0x25')]=function(_0x571f61,_0x34e9a2){if(_0x571f61[_0xc042('0x4a')]['id']){delete _0x571f61[_0xc042('0x4a')]['id'];}return db[_0xc042('0x2c')][_0xc042('0x48')]({'where':{'id':_0x571f61[_0xc042('0x46')]['id']}})[_0xc042('0x26')](handleEntityNotFound(_0x34e9a2,null))['then'](saveUpdates(_0x571f61[_0xc042('0x4a')],null))[_0xc042('0x26')](respondWithResult(_0x34e9a2,null))['catch'](handleError(_0x34e9a2,null));};exports[_0xc042('0x27')]=function(_0x1202f1,_0x16ddb0){return db[_0xc042('0x2c')][_0xc042('0x48')]({'where':{'id':_0x1202f1[_0xc042('0x46')]['id']}})[_0xc042('0x26')](handleEntityNotFound(_0x16ddb0,null))[_0xc042('0x26')](removeEntity(_0x16ddb0,null))['catch'](handleError(_0x16ddb0,null));};exports['getConfigurations']=function(_0x203e62,_0x92ddc,_0x3162b2){var _0x2d3e3d={};var _0x1d605b={};var _0xae3d6b;var _0x71bcec;return db[_0xc042('0x2c')][_0xc042('0x4b')]({'where':{'id':_0x203e62[_0xc042('0x46')]['id']}})['then'](handleEntityNotFound(_0x92ddc,null))['then'](function(_0x207cf1){if(_0x207cf1){_0xae3d6b=_0x207cf1;_0x1d605b['model']=_[_0xc042('0x32')](db[_0xc042('0x4c')][_0xc042('0x4d')]);_0x1d605b[_0xc042('0x31')]=_[_0xc042('0x32')](_0x203e62[_0xc042('0x31')]);_0x1d605b['filters']=_[_0xc042('0x35')](_0x1d605b['model'],_0x1d605b[_0xc042('0x31')]);_0x2d3e3d[_0xc042('0x34')]=_[_0xc042('0x35')](_0x1d605b[_0xc042('0x30')],qs['fields'](_0x203e62['query'][_0xc042('0x36')]));_0x2d3e3d['attributes']=_0x2d3e3d['attributes'][_0xc042('0x37')]?_0x2d3e3d['attributes']:_0x1d605b[_0xc042('0x30')];_0x2d3e3d[_0xc042('0x4e')]=qs[_0xc042('0x3a')](_0x203e62[_0xc042('0x31')][_0xc042('0x3a')]);_0x2d3e3d[_0xc042('0x3b')]=qs[_0xc042('0x33')](_[_0xc042('0x3c')](_0x203e62[_0xc042('0x31')],_0x1d605b[_0xc042('0x33')]));if(_0x203e62['query']['filter']){_0x2d3e3d[_0xc042('0x3b')]=_[_0xc042('0x3e')](_0x2d3e3d[_0xc042('0x3b')],{'$or':_['map'](_0x2d3e3d['attributes'],function(_0x186ae1){var _0x5408b9={};_0x5408b9[_0x186ae1]={'$like':'%'+_0x203e62['query']['filter']+'%'};return _0x5408b9;})});}_0x2d3e3d=_[_0xc042('0x3e')]({},_0x2d3e3d,_0x203e62[_0xc042('0x40')]);return _0xae3d6b[_0xc042('0x4f')](_0x2d3e3d);}})['then'](function(_0x37d55e){if(_0x37d55e){_0x71bcec=_0x37d55e[_0xc042('0x37')];if(!_0x203e62[_0xc042('0x31')]['hasOwnProperty'](_0xc042('0x39'))){_0x2d3e3d[_0xc042('0x1f')]=qs[_0xc042('0x1f')](_0x203e62['query'][_0xc042('0x1f')]);_0x2d3e3d[_0xc042('0x1d')]=qs[_0xc042('0x1d')](_0x203e62[_0xc042('0x31')][_0xc042('0x1d')]);}return _0xae3d6b[_0xc042('0x4f')](_0x2d3e3d);}})[_0xc042('0x26')](function(_0x3e4f93){if(_0x3e4f93){return _0x3e4f93?{'count':_0x71bcec,'rows':_0x3e4f93}:null;}})[_0xc042('0x26')](respondWithResult(_0x92ddc,null))['catch'](handleError(_0x92ddc,null));};exports['addConfiguration']=function(_0x3c1818,_0x149950,_0x258edb){if(_0x3c1818['body']['id']){delete _0x3c1818[_0xc042('0x4a')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x3c1818[_0xc042('0x46')]['id']}})[_0xc042('0x26')](handleEntityNotFound(_0x149950,null))[_0xc042('0x26')](function(_0x2d20c7){if(_0x2d20c7){_0x3c1818['body'][_0xc042('0x50')]=_0x2d20c7['id'];_0x3c1818[_0xc042('0x4a')][_0xc042('0x51')]=integrations[_0xc042('0x52')](_0x3c1818[_0xc042('0x4a')][_0xc042('0x53')],_0x3c1818[_0xc042('0x4a')]['type']);_0x3c1818['body'][_0xc042('0x54')]=integrations['getDescriptions'](_0x3c1818['body']['channel'],_0x3c1818['body'][_0xc042('0x2e')]);return db[_0xc042('0x4c')]['create'](_0x3c1818[_0xc042('0x4a')],{'include':[{'model':db[_0xc042('0x55')],'as':_0xc042('0x51')},{'model':db[_0xc042('0x55')],'as':_0xc042('0x54')}]});}return null;})[_0xc042('0x26')](respondWithResult(_0x149950,null))[_0xc042('0x44')](handleError(_0x149950,null));};exports['getFields']=function(_0x15b999,_0x27796c,_0x1f10ff){var _0x149b60=[_0xc042('0x56'),_0xc042('0x57'),_0xc042('0x58'),'subcategory',_0xc042('0x59'),_0xc042('0x5a'),_0xc042('0x5b'),_0xc042('0x5c'),_0xc042('0x5d')];var _0x2e3a16=[_0xc042('0x5e'),'made_sla',_0xc042('0x5f'),_0xc042('0x60'),_0xc042('0x61'),_0xc042('0x62'),_0xc042('0x63'),'hold_reason',_0xc042('0x64'),_0xc042('0x65'),_0xc042('0x66'),'sys_updated_by',_0xc042('0x67'),_0xc042('0x68'),_0xc042('0x69'),_0xc042('0x6a'),'state',_0xc042('0x6b'),'knowledge',_0xc042('0x4e'),_0xc042('0x6c'),_0xc042('0x6d'),_0xc042('0x6e'),_0xc042('0x6f'),'impact',_0xc042('0x70'),'work_notes_list',_0xc042('0x71'),_0xc042('0x72'),_0xc042('0x73'),_0xc042('0x74'),'time_worked','expected_start',_0xc042('0x75'),_0xc042('0x76'),'group_list',_0xc042('0x77'),_0xc042('0x78'),_0xc042('0x79'),_0xc042('0x7a'),'approval_set',_0xc042('0x7b'),_0xc042('0x7c'),_0xc042('0x7d'),_0xc042('0x59'),'correlation_display',_0xc042('0x7e'),'work_start','assignment_group','business_stc',_0xc042('0x7f'),_0xc042('0x80'),_0xc042('0x81'),_0xc042('0x5a'),_0xc042('0x82'),_0xc042('0x83'),_0xc042('0x84'),_0xc042('0x85'),_0xc042('0x86'),_0xc042('0x87'),'contact_type',_0xc042('0x88'),'incident_state',_0xc042('0x89'),'problem_id',_0xc042('0x8a'),_0xc042('0x8b'),_0xc042('0x8c'),_0xc042('0x8d'),_0xc042('0x5c'),_0xc042('0x8e'),_0xc042('0x8f'),_0xc042('0x90'),_0xc042('0x91'),_0xc042('0x92'),'sys_mod_count','reopen_count',_0xc042('0x93'),'escalation','upon_approval',_0xc042('0x94'),_0xc042('0x95'),_0xc042('0x5d')];var _0x1f3ef9='';var _0x1c9ee5='';var _0x239d26=[];var _0x57005b='';var _0x28bf80='';var _0x1c4908=[];var _0x544f47='';var _0x51e64f='';var _0x136d92={};var _0x2f13a1='';return db[_0xc042('0x2c')]['findOne']({'where':{'id':_0x15b999[_0xc042('0x46')]['id']},'attributes':['id',_0xc042('0x96'),_0xc042('0x97'),_0xc042('0x98'),'remoteUri','serverUrl']})['then'](handleEntityNotFound(_0x27796c,null))[_0xc042('0x26')](function(_0x3f5e23){if(_0x3f5e23){_0x2f13a1=_0x3f5e23[_0xc042('0x99')];var _0x38eb3e=_0x2f13a1[_0xc042('0x9a')](-0x1);if(_0x38eb3e==='/'){_0x2f13a1=_0x2f13a1[_0xc042('0x9b')](0x0,_0x2f13a1[_0xc042('0x9c')](_0x38eb3e));}_0x51e64f=util[_0xc042('0x9d')](_0xc042('0x9e'),_0x2f13a1);_0x544f47=util[_0xc042('0x9d')](_0xc042('0x9f'),_0x2f13a1);_0x136d92={'user':_0x3f5e23[_0xc042('0x96')],'pass':_0x3f5e23[_0xc042('0x97')]};var _0x4013ad={'method':'GET','uri':_0x51e64f+_0xc042('0xa0'),'auth':_0x136d92,'json':!![]};return rp(_0x4013ad);}})[_0xc042('0x26')](function(_0x25d671){if(_0x25d671[_0xc042('0xa1')]['length']>0x0){_0x1f3ef9=_0x25d671[_0xc042('0xa1')];}console['log']('incident\x20table\x20objects',_0x1f3ef9);_0x1c4908=[];_0x1c9ee5=Object[_0xc042('0xa2')]([],_0x1f3ef9);_[_0xc042('0xa3')](_0x1c9ee5,function(_0x389b9f){return!_0x149b60[_0xc042('0xa4')](_0x389b9f[_0xc042('0x29')]);});_0x1c9ee5[_0xc042('0xa5')](function(_0x45216b){var _0xe33165=createFieldObject(_0x544f47,_0x136d92,_0x45216b[_0xc042('0xa6')],_0x45216b[_0xc042('0x29')],_0x45216b['label'],![]);_0x1c4908[_0xc042('0xa7')](_0xe33165);});return Promise['all'](_0x1c4908);})[_0xc042('0x26')](function(_0x5c5ee3){_0x239d26=_0x5c5ee3;_0x57005b=Object['assign']([],_0x1f3ef9);console[_0xc042('0xa8')]('TCL:\x20_object',_0x1f3ef9);_[_0xc042('0xa3')](_0x57005b,function(_0x52a9a9){return _0x2e3a16[_0xc042('0xa4')](_0x52a9a9[_0xc042('0x29')]);});console[_0xc042('0xa8')](_0xc042('0xa9'),_0x57005b);_0x1c4908=[];_0x57005b['forEach'](function(_0x5c419f){var _0x8ad54=createFieldObject(_0x544f47,_0x136d92,_0x5c419f[_0xc042('0xa6')],_0x5c419f[_0xc042('0x29')],_0x5c419f[_0xc042('0xaa')],!![]);_0x1c4908[_0xc042('0xa7')](_0x8ad54);});return Promise['all'](_0x1c4908);})[_0xc042('0x26')](function(_0x453426){_0x28bf80=_0x453426;var _0x3b6685=_0x239d26['concat'](_0x28bf80);return{'count':_0x3b6685[_0xc042('0x37')],'rows':_0x3b6685};})[_0xc042('0x26')](respondWithResult(_0x27796c,null))[_0xc042('0x44')](function(_0x36d36f){console['log'](_0xc042('0xab')+_0x36d36f);var _0x5bb41a=_0x15b999[_0xc042('0x31')][_0xc042('0xac')]?0x1f4:_0x36d36f[_0xc042('0xad')]||0x1f4;logger[_0xc042('0x28')](_0x36d36f[_0xc042('0xae')]);delete _0x36d36f['name'];if(_0x5bb41a===0x191){_0x5bb41a=0x190;}_0x27796c[_0xc042('0x1b')](_0x5bb41a)[_0xc042('0x2a')](_0x15b999[_0xc042('0x31')]['test']?{'message':_0xc042('0xaf'),'statusCode':_0x36d36f[_0xc042('0xad')]}:_0x36d36f);});};function createFieldObject(_0x155e1f,_0x10051c,_0x2e9821,_0xeabcfe,_0xb78f81,_0x5f2407){return new Promise(function(_0x147d15,_0x277e5e){var _0x3d1308={'id':_0xeabcfe,'name':_0xb78f81,'custom':_0x5f2407};if(_0x2e9821===_0xc042('0xb0')){_0x3d1308[_0xc042('0x40')]=[{'name':_0xc042('0xb1'),'value':'true'},{'name':'False','value':'false'}];_0x147d15(_0x3d1308);}else{var _0x2e72d8={'method':_0xc042('0xb2'),'uri':_0x155e1f+_0xc042('0xb3')+_0xeabcfe,'auth':_0x10051c,'json':!![]};return rp(_0x2e72d8)['then'](function(_0x462223){var _0x585396=[];if(_0x462223[_0xc042('0xa1')][_0xc042('0x37')]>0x0){_0x462223[_0xc042('0xa1')][_0xc042('0xa5')](function(_0x429a4c){if(_0x429a4c[_0xc042('0xb4')]===_0xc042('0xb5')){var _0x369fad={'name':_0x429a4c['label'],'value':_0x429a4c[_0xc042('0xb6')]};_0x585396['push'](_0x369fad);}});}_0x3d1308[_0xc042('0x40')]=_0x585396;if(_0x3d1308['options'][_0xc042('0x37')]>0x0){_0x147d15(_0x3d1308);}else{if(_0x5f2407==![]){_0x147d15();}else{_0x147d15(_0x3d1308);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 91058ce..f112cb0 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 _0x2bd8=['bluebird','request-promise','path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','api','moment'];(function(_0x53d9c8,_0x135efe){var _0x5a9dbc=function(_0x409535){while(--_0x409535){_0x53d9c8['push'](_0x53d9c8['shift']());}};_0x5a9dbc(++_0x135efe);}(_0x2bd8,0x130));var _0x82bd=function(_0xbbf562,_0x3bda76){_0xbbf562=_0xbbf562-0x0;var _0x3ba871=_0x2bd8[_0xbbf562];return _0x3ba871;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var logger=require(_0x82bd('0x1'))(_0x82bd('0x2'));var moment=require(_0x82bd('0x3'));var BPromise=require(_0x82bd('0x4'));var rp=require(_0x82bd('0x5'));var fs=require('fs');var path=require(_0x82bd('0x6'));var rimraf=require(_0x82bd('0x7'));var config=require('../../config/environment');var attributes=require(_0x82bd('0x8'));var integrations=require(_0x82bd('0x9'));module[_0x82bd('0xa')]=function(_0x5ceb60,_0x19dbb1){return _0x5ceb60[_0x82bd('0xb')](_0x82bd('0xc'),attributes,{'tableName':_0x82bd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda19=['request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','moment'];(function(_0x1a3c77,_0x3f7c0f){var _0x156d41=function(_0x4d5823){while(--_0x4d5823){_0x1a3c77['push'](_0x1a3c77['shift']());}};_0x156d41(++_0x3f7c0f);}(_0xda19,0xd5));var _0x9da1=function(_0xab16c1,_0x2810ed){_0xab16c1=_0xab16c1-0x0;var _0x45675c=_0xda19[_0xab16c1];return _0x45675c;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var logger=require(_0x9da1('0x1'))('api');var moment=require(_0x9da1('0x2'));var BPromise=require('bluebird');var rp=require(_0x9da1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var attributes=require(_0x9da1('0x6'));var integrations=require(_0x9da1('0x7'));module[_0x9da1('0x8')]=function(_0x2dcbc6,_0x23e4f7){return _0x2dcbc6[_0x9da1('0x9')](_0x9da1('0xa'),attributes,{'tableName':_0x9da1('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 386385f..a6946bd 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 _0x452d=['find','stringify','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','GetServicenowAccount','findAll','options','where','include','map','attributes','model','ShowServicenowAccount'];(function(_0x4b1780,_0x1d24f8){var _0x1e6db0=function(_0x1cafe0){while(--_0x1cafe0){_0x4b1780['push'](_0x4b1780['shift']());}};_0x1e6db0(++_0x1d24f8);}(_0x452d,0x14d));var _0xd452=function(_0x3d5e45,_0x4bcb15){_0x3d5e45=_0x3d5e45-0x0;var _0x579ffc=_0x452d[_0x3d5e45];return _0x579ffc;};'use strict';var _=require(_0xd452('0x0'));var util=require(_0xd452('0x1'));var moment=require(_0xd452('0x2'));var BPromise=require(_0xd452('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd452('0x4'));var db=require(_0xd452('0x5'))['db'];var utils=require(_0xd452('0x6'));var logger=require(_0xd452('0x7'))(_0xd452('0x8'));var config=require(_0xd452('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd452('0xa')][_0xd452('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25c6e0,_0x48e14d,_0x4e2cce){return new BPromise(function(_0x42b42e,_0x3dbdb8){return client[_0xd452('0xc')](_0x25c6e0,_0x4e2cce)[_0xd452('0xd')](function(_0x45081d){logger['info'](_0xd452('0xe'),_0x48e14d,_0xd452('0xf'));logger[_0xd452('0x10')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x48e14d,_0xd452('0xf'),JSON['stringify'](_0x45081d));if(_0x45081d[_0xd452('0x11')]){if(_0x45081d['error'][_0xd452('0x12')]===0x1f4){logger[_0xd452('0x11')](_0xd452('0xe'),_0x48e14d,_0x45081d[_0xd452('0x11')][_0xd452('0x13')]);return _0x3dbdb8(_0x45081d['error'][_0xd452('0x13')]);}logger[_0xd452('0x11')](_0xd452('0xe'),_0x48e14d,_0x45081d[_0xd452('0x11')]['message']);return _0x42b42e(_0x45081d[_0xd452('0x11')][_0xd452('0x13')]);}else{logger[_0xd452('0x14')](_0xd452('0xe'),_0x48e14d,_0xd452('0xf'));_0x42b42e(_0x45081d['result']['message']);}})['catch'](function(_0x396a80){logger[_0xd452('0x11')](_0xd452('0xe'),_0x48e14d,_0x396a80);_0x3dbdb8(_0x396a80);});});}exports[_0xd452('0x15')]=function(_0x1b67d6){var _0x221edb=this;return new Promise(function(_0x23e09c,_0x1d4717){return db['ServicenowAccount'][_0xd452('0x16')]({'raw':_0x1b67d6[_0xd452('0x17')]?_0x1b67d6['options']['raw']===undefined?!![]:![]:!![],'where':_0x1b67d6[_0xd452('0x17')]?_0x1b67d6['options'][_0xd452('0x18')]||null:null,'attributes':_0x1b67d6['options']?_0x1b67d6['options']['attributes']||null:null,'limit':_0x1b67d6[_0xd452('0x17')]?_0x1b67d6[_0xd452('0x17')]['limit']||null:null,'include':_0x1b67d6[_0xd452('0x17')]?_0x1b67d6['options'][_0xd452('0x19')]?_[_0xd452('0x1a')](_0x1b67d6[_0xd452('0x17')]['include'],function(_0x396391){return{'model':db[_0x396391['model']],'as':_0x396391['as'],'attributes':_0x396391[_0xd452('0x1b')],'include':_0x396391['include']?_[_0xd452('0x1a')](_0x396391[_0xd452('0x19')],function(_0x32f040){return{'model':db[_0x32f040[_0xd452('0x1c')]],'as':_0x32f040['as'],'attributes':_0x32f040[_0xd452('0x1b')],'include':_0x32f040[_0xd452('0x19')]?_[_0xd452('0x1a')](_0x32f040['include'],function(_0x51361f){return{'model':db[_0x51361f['model']],'as':_0x51361f['as'],'attributes':_0x51361f['attributes']};}):[]};}):[]};}):[]:[]})[_0xd452('0xd')](function(_0x320191){logger['info'](_0xd452('0x15'),_0x1b67d6);logger['debug'](_0xd452('0x15'),_0x1b67d6,JSON['stringify'](_0x320191));_0x23e09c(_0x320191);})['catch'](function(_0x4af8ee){logger['error'](_0xd452('0x15'),_0x4af8ee[_0xd452('0x13')],_0x1b67d6);_0x1d4717(_0x221edb[_0xd452('0x11')](0x1f4,_0x4af8ee[_0xd452('0x13')]));});});};exports[_0xd452('0x1d')]=function(_0x3aba92){var _0x548871=this;return new Promise(function(_0x585f7b,_0x5c0fe4){return db['ServicenowAccount'][_0xd452('0x1e')]({'raw':_0x3aba92['options']?_0x3aba92[_0xd452('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3aba92['options']?_0x3aba92['options'][_0xd452('0x18')]||null:null,'attributes':_0x3aba92['options']?_0x3aba92[_0xd452('0x17')][_0xd452('0x1b')]||null:null,'include':_0x3aba92['options']?_0x3aba92[_0xd452('0x17')][_0xd452('0x19')]?_[_0xd452('0x1a')](_0x3aba92[_0xd452('0x17')]['include'],function(_0x2e2fbe){return{'model':db[_0x2e2fbe[_0xd452('0x1c')]],'as':_0x2e2fbe['as'],'attributes':_0x2e2fbe[_0xd452('0x1b')],'include':_0x2e2fbe[_0xd452('0x19')]?_[_0xd452('0x1a')](_0x2e2fbe[_0xd452('0x19')],function(_0x4ae054){return{'model':db[_0x4ae054[_0xd452('0x1c')]],'as':_0x4ae054['as'],'attributes':_0x4ae054[_0xd452('0x1b')],'include':_0x4ae054[_0xd452('0x19')]?_[_0xd452('0x1a')](_0x4ae054[_0xd452('0x19')],function(_0x92a560){return{'model':db[_0x92a560['model']],'as':_0x92a560['as'],'attributes':_0x92a560[_0xd452('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd452('0xd')](function(_0x59c59e){logger[_0xd452('0x14')](_0xd452('0x1d'),_0x3aba92);logger[_0xd452('0x10')](_0xd452('0x1d'),_0x3aba92,JSON[_0xd452('0x1f')](_0x59c59e));_0x585f7b(_0x59c59e);})[_0xd452('0x20')](function(_0x4fcc38){logger[_0xd452('0x11')]('ShowServicenowAccount',_0x4fcc38[_0xd452('0x13')],_0x3aba92);_0x5c0fe4(_0x548871[_0xd452('0x11')](0x1f4,_0x4fcc38['message']));});});}; \ No newline at end of file +var _0x17fc=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','limit','map','include','model','ShowServicenowAccount','find','raw','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0x17fc,0x1ab));var _0xc17f=function(_0xf95580,_0x2dfe6b){_0xf95580=_0xf95580-0x0;var _0x1608b3=_0x17fc[_0xf95580];return _0x1608b3;};'use strict';var _=require(_0xc17f('0x0'));var util=require(_0xc17f('0x1'));var moment=require(_0xc17f('0x2'));var BPromise=require(_0xc17f('0x3'));var rs=require(_0xc17f('0x4'));var fs=require('fs');var Redis=require(_0xc17f('0x5'));var db=require(_0xc17f('0x6'))['db'];var utils=require(_0xc17f('0x7'));var logger=require(_0xc17f('0x8'))(_0xc17f('0x9'));var config=require('../../config/environment');var jayson=require(_0xc17f('0xa'));var client=jayson[_0xc17f('0xb')][_0xc17f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x158131,_0x180f45,_0x411b5e){return new BPromise(function(_0x87820c,_0x553b6a){return client['request'](_0x158131,_0x411b5e)[_0xc17f('0xd')](function(_0x2cc1eb){logger[_0xc17f('0xe')](_0xc17f('0xf'),_0x180f45,_0xc17f('0x10'));logger[_0xc17f('0x11')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x180f45,_0xc17f('0x10'),JSON[_0xc17f('0x12')](_0x2cc1eb));if(_0x2cc1eb[_0xc17f('0x13')]){if(_0x2cc1eb['error']['code']===0x1f4){logger[_0xc17f('0x13')](_0xc17f('0xf'),_0x180f45,_0x2cc1eb[_0xc17f('0x13')][_0xc17f('0x14')]);return _0x553b6a(_0x2cc1eb[_0xc17f('0x13')]['message']);}logger[_0xc17f('0x13')](_0xc17f('0xf'),_0x180f45,_0x2cc1eb[_0xc17f('0x13')][_0xc17f('0x14')]);return _0x87820c(_0x2cc1eb[_0xc17f('0x13')][_0xc17f('0x14')]);}else{logger[_0xc17f('0xe')](_0xc17f('0xf'),_0x180f45,_0xc17f('0x10'));_0x87820c(_0x2cc1eb[_0xc17f('0x15')][_0xc17f('0x14')]);}})['catch'](function(_0x1bc348){logger[_0xc17f('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x180f45,_0x1bc348);_0x553b6a(_0x1bc348);});});}exports[_0xc17f('0x16')]=function(_0x57e379){var _0x4038a0=this;return new Promise(function(_0x5cbb59,_0x131f2b){return db[_0xc17f('0x17')][_0xc17f('0x18')]({'raw':_0x57e379['options']?_0x57e379[_0xc17f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x57e379['options']?_0x57e379[_0xc17f('0x19')][_0xc17f('0x1a')]||null:null,'attributes':_0x57e379['options']?_0x57e379[_0xc17f('0x19')][_0xc17f('0x1b')]||null:null,'limit':_0x57e379[_0xc17f('0x19')]?_0x57e379[_0xc17f('0x19')][_0xc17f('0x1c')]||null:null,'include':_0x57e379[_0xc17f('0x19')]?_0x57e379[_0xc17f('0x19')]['include']?_[_0xc17f('0x1d')](_0x57e379[_0xc17f('0x19')][_0xc17f('0x1e')],function(_0x47a7a3){return{'model':db[_0x47a7a3[_0xc17f('0x1f')]],'as':_0x47a7a3['as'],'attributes':_0x47a7a3[_0xc17f('0x1b')],'include':_0x47a7a3['include']?_[_0xc17f('0x1d')](_0x47a7a3['include'],function(_0x116761){return{'model':db[_0x116761[_0xc17f('0x1f')]],'as':_0x116761['as'],'attributes':_0x116761[_0xc17f('0x1b')],'include':_0x116761['include']?_[_0xc17f('0x1d')](_0x116761[_0xc17f('0x1e')],function(_0x35513c){return{'model':db[_0x35513c[_0xc17f('0x1f')]],'as':_0x35513c['as'],'attributes':_0x35513c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a4e23){logger[_0xc17f('0xe')]('GetServicenowAccount',_0x57e379);logger[_0xc17f('0x11')](_0xc17f('0x16'),_0x57e379,JSON[_0xc17f('0x12')](_0x5a4e23));_0x5cbb59(_0x5a4e23);})['catch'](function(_0x38ac6c){logger[_0xc17f('0x13')](_0xc17f('0x16'),_0x38ac6c['message'],_0x57e379);_0x131f2b(_0x4038a0[_0xc17f('0x13')](0x1f4,_0x38ac6c[_0xc17f('0x14')]));});});};exports[_0xc17f('0x20')]=function(_0x22857e){var _0x47cf63=this;return new Promise(function(_0x24ff80,_0x52a144){return db[_0xc17f('0x17')][_0xc17f('0x21')]({'raw':_0x22857e[_0xc17f('0x19')]?_0x22857e['options'][_0xc17f('0x22')]===undefined?!![]:![]:!![],'where':_0x22857e[_0xc17f('0x19')]?_0x22857e[_0xc17f('0x19')]['where']||null:null,'attributes':_0x22857e[_0xc17f('0x19')]?_0x22857e[_0xc17f('0x19')]['attributes']||null:null,'include':_0x22857e[_0xc17f('0x19')]?_0x22857e[_0xc17f('0x19')][_0xc17f('0x1e')]?_['map'](_0x22857e['options'][_0xc17f('0x1e')],function(_0x438613){return{'model':db[_0x438613[_0xc17f('0x1f')]],'as':_0x438613['as'],'attributes':_0x438613['attributes'],'include':_0x438613[_0xc17f('0x1e')]?_[_0xc17f('0x1d')](_0x438613['include'],function(_0x581953){return{'model':db[_0x581953[_0xc17f('0x1f')]],'as':_0x581953['as'],'attributes':_0x581953['attributes'],'include':_0x581953[_0xc17f('0x1e')]?_[_0xc17f('0x1d')](_0x581953[_0xc17f('0x1e')],function(_0x1cb36f){return{'model':db[_0x1cb36f['model']],'as':_0x1cb36f['as'],'attributes':_0x1cb36f[_0xc17f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15b233){logger[_0xc17f('0xe')](_0xc17f('0x20'),_0x22857e);logger['debug'](_0xc17f('0x20'),_0x22857e,JSON[_0xc17f('0x12')](_0x15b233));_0x24ff80(_0x15b233);})[_0xc17f('0x23')](function(_0x5c21bb){logger[_0xc17f('0x13')](_0xc17f('0x20'),_0x5c21bb[_0xc17f('0x14')],_0x22857e);_0x52a144(_0x47cf63[_0xc17f('0x13')](0x1f4,_0x5c21bb[_0xc17f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index e9c324e..a2e8cc8 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 _0x413a=['post','create','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0xc19b34,_0x561cfc){var _0x1c192d=function(_0x4102c9){while(--_0x4102c9){_0xc19b34['push'](_0xc19b34['shift']());}};_0x1c192d(++_0x561cfc);}(_0x413a,0x1e6));var _0xa413=function(_0x561ddf,_0xa90c6c){_0x561ddf=_0x561ddf-0x0;var _0x457957=_0x413a[_0x561ddf];return _0x457957;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa413('0x0'));var timeout=require(_0xa413('0x1'));var express=require(_0xa413('0x2'));var router=express[_0xa413('0x3')]();var fs_extra=require(_0xa413('0x4'));var auth=require(_0xa413('0x5'));var interaction=require(_0xa413('0x6'));var config=require(_0xa413('0x7'));var controller=require('./intServicenowConfiguration.controller');router[_0xa413('0x8')]('/',auth[_0xa413('0x9')](),controller['index']);router[_0xa413('0x8')](_0xa413('0xa'),auth[_0xa413('0x9')](),controller[_0xa413('0xb')]);router[_0xa413('0x8')](_0xa413('0xc'),auth[_0xa413('0x9')](),controller[_0xa413('0xd')]);router['get'](_0xa413('0xe'),auth[_0xa413('0x9')](),controller[_0xa413('0xf')]);router[_0xa413('0x8')](_0xa413('0x10'),auth['isAuthenticated'](),controller[_0xa413('0x11')]);router[_0xa413('0x12')]('/',auth['isAuthenticated'](),controller[_0xa413('0x13')]);router[_0xa413('0x14')](_0xa413('0xa'),auth[_0xa413('0x9')](),controller[_0xa413('0x15')]);router['delete'](_0xa413('0xa'),auth['isAuthenticated'](),controller[_0xa413('0x16')]);module[_0xa413('0x17')]=router; \ No newline at end of file +var _0x7468=['fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','get','show','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0xb847da,_0x4660a1){var _0x1cf518=function(_0x5cc648){while(--_0x5cc648){_0xb847da['push'](_0xb847da['shift']());}};_0x1cf518(++_0x4660a1);}(_0x7468,0xca));var _0x8746=function(_0x100430,_0x5e8254){_0x100430=_0x100430-0x0;var _0x2018bb=_0x7468[_0x100430];return _0x2018bb;};'use strict';var multer=require(_0x8746('0x0'));var util=require(_0x8746('0x1'));var path=require(_0x8746('0x2'));var timeout=require(_0x8746('0x3'));var express=require(_0x8746('0x4'));var router=express['Router']();var fs_extra=require(_0x8746('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8746('0x6'));var config=require(_0x8746('0x7'));var controller=require(_0x8746('0x8'));router['get']('/',auth[_0x8746('0x9')](),controller['index']);router[_0x8746('0xa')]('/:id',auth[_0x8746('0x9')](),controller[_0x8746('0xb')]);router[_0x8746('0xa')](_0x8746('0xc'),auth[_0x8746('0x9')](),controller[_0x8746('0xd')]);router[_0x8746('0xa')]('/:id/subjects',auth[_0x8746('0x9')](),controller[_0x8746('0xe')]);router[_0x8746('0xa')](_0x8746('0xf'),auth[_0x8746('0x9')](),controller['getDescriptions']);router[_0x8746('0x10')]('/',auth[_0x8746('0x9')](),controller[_0x8746('0x11')]);router[_0x8746('0x12')](_0x8746('0x13'),auth['isAuthenticated'](),controller[_0x8746('0x14')]);router[_0x8746('0x15')](_0x8746('0x13'),auth[_0x8746('0x9')](),controller['destroy']);module[_0x8746('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 4cb4d43..bd41c67 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 _0xb366=['sequelize','STRING'];(function(_0x1a4403,_0x22d1be){var _0x2bcab6=function(_0x510856){while(--_0x510856){_0x1a4403['push'](_0x1a4403['shift']());}};_0x2bcab6(++_0x22d1be);}(_0xb366,0xaa));var _0x6b36=function(_0x290903,_0x2a9159){_0x290903=_0x290903-0x0;var _0x3659e8=_0xb366[_0x290903];return _0x3659e8;};'use strict';var Sequelize=require(_0x6b36('0x0'));module['exports']={'name':{'type':Sequelize[_0x6b36('0x1')]},'description':{'type':Sequelize[_0x6b36('0x1')]}}; \ No newline at end of file +var _0x70ef=['exports','STRING','sequelize'];(function(_0x31ad45,_0x1ee3b3){var _0x34fd4f=function(_0x1821b7){while(--_0x1821b7){_0x31ad45['push'](_0x31ad45['shift']());}};_0x34fd4f(++_0x1ee3b3);}(_0x70ef,0x1d9));var _0xf70e=function(_0x40ae63,_0x478b08){_0x40ae63=_0x40ae63-0x0;var _0x29c9bf=_0x70ef[_0x40ae63];return _0x29c9bf;};'use strict';var Sequelize=require(_0xf70e('0x0'));module[_0xf70e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf70e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index c063409..8538c85 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 _0xd6a8=['count','status','Content-Range','apply','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','pick','where','merge','type','VIRTUAL','filter','ServicenowConfiguration','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','getFields','ServicenowField','order','sort','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit'];(function(_0x3793d0,_0x20c1e3){var _0x28b5fb=function(_0x1dc804){while(--_0x1dc804){_0x3793d0['push'](_0x3793d0['shift']());}};_0x28b5fb(++_0x20c1e3);}(_0xd6a8,0x1c7));var _0x8d6a=function(_0x263d59,_0x4c0366){_0x263d59=_0x263d59-0x0;var _0x5cbc8f=_0xd6a8[_0x263d59];return _0x5cbc8f;};'use strict';var emlformat=require(_0x8d6a('0x0'));var rimraf=require(_0x8d6a('0x1'));var zipdir=require(_0x8d6a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8d6a('0x3'));var BPromise=require(_0x8d6a('0x4'));var Mustache=require(_0x8d6a('0x5'));var util=require(_0x8d6a('0x6'));var path=require('path');var sox=require(_0x8d6a('0x7'));var csv=require(_0x8d6a('0x8'));var ejs=require(_0x8d6a('0x9'));var fs=require('fs');var fs_extra=require(_0x8d6a('0xa'));var _=require(_0x8d6a('0xb'));var squel=require(_0x8d6a('0xc'));var crypto=require(_0x8d6a('0xd'));var jsforce=require(_0x8d6a('0xe'));var deskjs=require(_0x8d6a('0xf'));var toCsv=require(_0x8d6a('0x8'));var querystring=require(_0x8d6a('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8d6a('0x11'));var as=require(_0x8d6a('0x12'));var hardwareService=require(_0x8d6a('0x13'));var logger=require(_0x8d6a('0x14'))('api');var utils=require(_0x8d6a('0x15'));var config=require(_0x8d6a('0x16'));var licenseUtil=require(_0x8d6a('0x17'));var db=require(_0x8d6a('0x18'))['db'];function respondWithStatusCode(_0x219620,_0x5e7dc7){_0x5e7dc7=_0x5e7dc7||0xcc;return function(_0x3ebe2f){if(_0x3ebe2f){return _0x219620[_0x8d6a('0x19')](_0x5e7dc7);}return _0x219620['status'](_0x5e7dc7)[_0x8d6a('0x1a')]();};}function respondWithResult(_0x50f50b,_0x1bf5ac){_0x1bf5ac=_0x1bf5ac||0xc8;return function(_0x312661){if(_0x312661){return _0x50f50b['status'](_0x1bf5ac)[_0x8d6a('0x1b')](_0x312661);}};}function respondWithFilteredResult(_0x1b74ec,_0x2686b6){return function(_0x3d3859){if(_0x3d3859){var _0x4a0f72=typeof _0x2686b6[_0x8d6a('0x1c')]===_0x8d6a('0x1d')&&typeof _0x2686b6[_0x8d6a('0x1e')]===_0x8d6a('0x1d');var _0x4189ae=_0x3d3859[_0x8d6a('0x1f')];var _0x7ccfa4=_0x4a0f72?0x0:_0x2686b6[_0x8d6a('0x1c')];var _0x4a6f63=_0x4a0f72?_0x3d3859[_0x8d6a('0x1f')]:_0x2686b6[_0x8d6a('0x1c')]+_0x2686b6[_0x8d6a('0x1e')];var _0x2d8877;if(_0x4a6f63>=_0x4189ae){_0x4a6f63=_0x4189ae;_0x2d8877=0xc8;}else{_0x2d8877=0xce;}_0x1b74ec[_0x8d6a('0x20')](_0x2d8877);return _0x1b74ec['set'](_0x8d6a('0x21'),_0x7ccfa4+'-'+_0x4a6f63+'/'+_0x4189ae)[_0x8d6a('0x1b')](_0x3d3859);}return null;};}function patchUpdates(_0x42dfd3){return function(_0x4fe59f){try{jsonpatch[_0x8d6a('0x22')](_0x4fe59f,_0x42dfd3,!![]);}catch(_0x240cda){return BPromise['reject'](_0x240cda);}return _0x4fe59f['save']();};}function saveUpdates(_0x2ec6de,_0x357912){return function(_0x20f7ae){if(_0x20f7ae){return _0x20f7ae[_0x8d6a('0x23')](_0x2ec6de)['then'](function(_0x3bf33e){return _0x3bf33e;});}return null;};}function removeEntity(_0x26bd8d,_0x22dd19){return function(_0x39c61f){if(_0x39c61f){return _0x39c61f[_0x8d6a('0x24')]()[_0x8d6a('0x25')](function(){_0x26bd8d['status'](0xcc)[_0x8d6a('0x1a')]();});}};}function handleEntityNotFound(_0x2d9522,_0x1b2434){return function(_0x9dfb51){if(!_0x9dfb51){_0x2d9522[_0x8d6a('0x19')](0x194);}return _0x9dfb51;};}function handleError(_0x58b676,_0x31f665){_0x31f665=_0x31f665||0x1f4;return function(_0x42d2d){logger[_0x8d6a('0x26')](_0x42d2d[_0x8d6a('0x27')]);if(_0x42d2d[_0x8d6a('0x28')]){delete _0x42d2d[_0x8d6a('0x28')];}_0x58b676[_0x8d6a('0x20')](_0x31f665)[_0x8d6a('0x29')](_0x42d2d);};}exports[_0x8d6a('0x2a')]=function(_0x211c04,_0x1be684){var _0x313550={},_0x235884={},_0x2249da={'count':0x0,'rows':[]};var _0x500c36=_[_0x8d6a('0x2b')](db['ServicenowConfiguration'][_0x8d6a('0x2c')],function(_0x1edbe8){return{'name':_0x1edbe8[_0x8d6a('0x2d')],'type':_0x1edbe8['type'][_0x8d6a('0x2e')]};});_0x235884[_0x8d6a('0x2f')]=_['map'](_0x500c36,'name');_0x235884[_0x8d6a('0x30')]=_[_0x8d6a('0x31')](_0x211c04[_0x8d6a('0x30')]);_0x235884[_0x8d6a('0x32')]=_[_0x8d6a('0x33')](_0x235884[_0x8d6a('0x2f')],_0x235884[_0x8d6a('0x30')]);_0x313550[_0x8d6a('0x34')]=_[_0x8d6a('0x33')](_0x235884[_0x8d6a('0x2f')],qs[_0x8d6a('0x35')](_0x211c04[_0x8d6a('0x30')][_0x8d6a('0x35')]));_0x313550[_0x8d6a('0x34')]=_0x313550[_0x8d6a('0x34')][_0x8d6a('0x36')]?_0x313550[_0x8d6a('0x34')]:_0x235884[_0x8d6a('0x2f')];if(!_0x211c04[_0x8d6a('0x30')][_0x8d6a('0x37')]('nolimit')){_0x313550[_0x8d6a('0x1e')]=qs[_0x8d6a('0x1e')](_0x211c04[_0x8d6a('0x30')][_0x8d6a('0x1e')]);_0x313550[_0x8d6a('0x1c')]=qs[_0x8d6a('0x1c')](_0x211c04[_0x8d6a('0x30')]['offset']);}_0x313550['order']=qs['sort'](_0x211c04[_0x8d6a('0x30')]['sort']);_0x313550['where']=qs[_0x8d6a('0x32')](_[_0x8d6a('0x38')](_0x211c04[_0x8d6a('0x30')],_0x235884[_0x8d6a('0x32')]),_0x500c36);if(_0x211c04['query']['filter']){_0x313550[_0x8d6a('0x39')]=_[_0x8d6a('0x3a')](_0x313550[_0x8d6a('0x39')],{'$or':_[_0x8d6a('0x2b')](_0x500c36,function(_0x468829){if(_0x468829[_0x8d6a('0x3b')]!==_0x8d6a('0x3c')){var _0x48660c={};_0x48660c[_0x468829[_0x8d6a('0x28')]]={'$like':'%'+_0x211c04['query'][_0x8d6a('0x3d')]+'%'};return _0x48660c;}})});}_0x313550=_[_0x8d6a('0x3a')]({},_0x313550,_0x211c04['options']);var _0x825f05={'where':_0x313550[_0x8d6a('0x39')]};return db[_0x8d6a('0x3e')][_0x8d6a('0x1f')](_0x825f05)[_0x8d6a('0x25')](function(_0x3b1537){_0x2249da['count']=_0x3b1537;if(_0x211c04[_0x8d6a('0x30')][_0x8d6a('0x3f')]){_0x313550[_0x8d6a('0x40')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x8d6a('0x41')](_0x313550);})[_0x8d6a('0x25')](function(_0xdc74a7){_0x2249da[_0x8d6a('0x42')]=_0xdc74a7;return _0x2249da;})[_0x8d6a('0x25')](respondWithFilteredResult(_0x1be684,_0x313550))[_0x8d6a('0x43')](handleError(_0x1be684,null));};exports[_0x8d6a('0x44')]=function(_0x1ddd22,_0x1b1551){var _0x586f72={'raw':![],'where':{'id':_0x1ddd22['params']['id']}},_0x255041={};_0x255041[_0x8d6a('0x2f')]=_[_0x8d6a('0x31')](db[_0x8d6a('0x3e')][_0x8d6a('0x2c')]);_0x255041[_0x8d6a('0x30')]=_['keys'](_0x1ddd22[_0x8d6a('0x30')]);_0x255041[_0x8d6a('0x32')]=_[_0x8d6a('0x33')](_0x255041['model'],_0x255041['query']);_0x586f72['attributes']=_['intersection'](_0x255041[_0x8d6a('0x2f')],qs['fields'](_0x1ddd22[_0x8d6a('0x30')][_0x8d6a('0x35')]));_0x586f72[_0x8d6a('0x34')]=_0x586f72['attributes'][_0x8d6a('0x36')]?_0x586f72[_0x8d6a('0x34')]:_0x255041[_0x8d6a('0x2f')];if(_0x1ddd22[_0x8d6a('0x30')][_0x8d6a('0x3f')]){_0x586f72[_0x8d6a('0x40')]=[{'all':!![]}];}_0x586f72=_[_0x8d6a('0x3a')]({},_0x586f72,_0x1ddd22[_0x8d6a('0x45')]);return db[_0x8d6a('0x3e')][_0x8d6a('0x46')](_0x586f72)['then'](handleEntityNotFound(_0x1b1551,null))['then'](respondWithResult(_0x1b1551,null))[_0x8d6a('0x43')](handleError(_0x1b1551,null));};exports[_0x8d6a('0x47')]=function(_0x4ca11e,_0x5e27a9){return db['ServicenowConfiguration']['create'](_0x4ca11e[_0x8d6a('0x48')],{})['then'](respondWithResult(_0x5e27a9,0xc9))[_0x8d6a('0x43')](handleError(_0x5e27a9,null));};exports['update']=function(_0x448ddc,_0x562d72){if(_0x448ddc[_0x8d6a('0x48')]['id']){delete _0x448ddc['body']['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x448ddc[_0x8d6a('0x49')]['id']}})[_0x8d6a('0x25')](handleEntityNotFound(_0x562d72,null))[_0x8d6a('0x25')](saveUpdates(_0x448ddc['body'],null))[_0x8d6a('0x25')](respondWithResult(_0x562d72,null))[_0x8d6a('0x43')](handleError(_0x562d72,null));};exports[_0x8d6a('0x24')]=function(_0x2ab228,_0x33edea){return db['ServicenowConfiguration']['find']({'where':{'id':_0x2ab228[_0x8d6a('0x49')]['id']}})[_0x8d6a('0x25')](handleEntityNotFound(_0x33edea,null))[_0x8d6a('0x25')](removeEntity(_0x33edea,null))[_0x8d6a('0x43')](handleError(_0x33edea,null));};exports[_0x8d6a('0x4a')]=function(_0x2549aa,_0x36725b,_0x223dad){var _0x6f70d4={};var _0xfcde1c={};var _0x316e78;var _0x1aa97b;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x2549aa[_0x8d6a('0x49')]['id']}})[_0x8d6a('0x25')](handleEntityNotFound(_0x36725b,null))['then'](function(_0x1141e4){if(_0x1141e4){_0x316e78=_0x1141e4;_0xfcde1c[_0x8d6a('0x2f')]=_[_0x8d6a('0x31')](db[_0x8d6a('0x4b')]['rawAttributes']);_0xfcde1c['query']=_[_0x8d6a('0x31')](_0x2549aa[_0x8d6a('0x30')]);_0xfcde1c[_0x8d6a('0x32')]=_[_0x8d6a('0x33')](_0xfcde1c['model'],_0xfcde1c['query']);_0x6f70d4[_0x8d6a('0x34')]=_[_0x8d6a('0x33')](_0xfcde1c[_0x8d6a('0x2f')],qs[_0x8d6a('0x35')](_0x2549aa[_0x8d6a('0x30')][_0x8d6a('0x35')]));_0x6f70d4[_0x8d6a('0x34')]=_0x6f70d4['attributes'][_0x8d6a('0x36')]?_0x6f70d4[_0x8d6a('0x34')]:_0xfcde1c[_0x8d6a('0x2f')];_0x6f70d4[_0x8d6a('0x4c')]=qs[_0x8d6a('0x4d')](_0x2549aa[_0x8d6a('0x30')][_0x8d6a('0x4d')]);_0x6f70d4['where']=qs[_0x8d6a('0x32')](_['pick'](_0x2549aa[_0x8d6a('0x30')],_0xfcde1c[_0x8d6a('0x32')]));if(_0x2549aa['query'][_0x8d6a('0x3d')]){_0x6f70d4['where']=_[_0x8d6a('0x3a')](_0x6f70d4['where'],{'$or':_[_0x8d6a('0x2b')](_0x6f70d4['attributes'],function(_0x15ef14){var _0x35c1da={};_0x35c1da[_0x15ef14]={'$like':'%'+_0x2549aa['query'][_0x8d6a('0x3d')]+'%'};return _0x35c1da;})});}_0x6f70d4=_[_0x8d6a('0x3a')]({},_0x6f70d4,_0x2549aa[_0x8d6a('0x45')]);return _0x316e78['getFields'](_0x6f70d4);}})['then'](function(_0xc3050a){if(_0xc3050a){_0x1aa97b=_0xc3050a[_0x8d6a('0x36')];if(!_0x2549aa['query'][_0x8d6a('0x37')](_0x8d6a('0x4e'))){_0x6f70d4[_0x8d6a('0x1e')]=qs[_0x8d6a('0x1e')](_0x2549aa[_0x8d6a('0x30')][_0x8d6a('0x1e')]);_0x6f70d4[_0x8d6a('0x1c')]=qs[_0x8d6a('0x1c')](_0x2549aa[_0x8d6a('0x30')][_0x8d6a('0x1c')]);}return _0x316e78[_0x8d6a('0x4a')](_0x6f70d4);}})[_0x8d6a('0x25')](function(_0x48ed01){if(_0x48ed01){return _0x48ed01?{'count':_0x1aa97b,'rows':_0x48ed01}:null;}})[_0x8d6a('0x25')](respondWithResult(_0x36725b,null))['catch'](handleError(_0x36725b,null));};exports[_0x8d6a('0x4f')]=function(_0x10d0e1,_0x3c8e85,_0x30f352){var _0x238d59={};var _0x2a29d9={};var _0xdb5f90;var _0x3498f7;return db[_0x8d6a('0x3e')]['findOne']({'where':{'id':_0x10d0e1[_0x8d6a('0x49')]['id']}})[_0x8d6a('0x25')](handleEntityNotFound(_0x3c8e85,null))[_0x8d6a('0x25')](function(_0x39cd0a){if(_0x39cd0a){_0xdb5f90=_0x39cd0a;_0x2a29d9[_0x8d6a('0x2f')]=_[_0x8d6a('0x31')](db[_0x8d6a('0x4b')][_0x8d6a('0x2c')]);_0x2a29d9[_0x8d6a('0x30')]=_['keys'](_0x10d0e1[_0x8d6a('0x30')]);_0x2a29d9[_0x8d6a('0x32')]=_[_0x8d6a('0x33')](_0x2a29d9[_0x8d6a('0x2f')],_0x2a29d9[_0x8d6a('0x30')]);_0x238d59['attributes']=_[_0x8d6a('0x33')](_0x2a29d9[_0x8d6a('0x2f')],qs[_0x8d6a('0x35')](_0x10d0e1[_0x8d6a('0x30')][_0x8d6a('0x35')]));_0x238d59[_0x8d6a('0x34')]=_0x238d59['attributes'][_0x8d6a('0x36')]?_0x238d59[_0x8d6a('0x34')]:_0x2a29d9[_0x8d6a('0x2f')];_0x238d59[_0x8d6a('0x4c')]=qs[_0x8d6a('0x4d')](_0x10d0e1[_0x8d6a('0x30')]['sort']);_0x238d59[_0x8d6a('0x39')]=qs[_0x8d6a('0x32')](_[_0x8d6a('0x38')](_0x10d0e1[_0x8d6a('0x30')],_0x2a29d9[_0x8d6a('0x32')]));if(_0x10d0e1[_0x8d6a('0x30')]['filter']){_0x238d59[_0x8d6a('0x39')]=_[_0x8d6a('0x3a')](_0x238d59[_0x8d6a('0x39')],{'$or':_[_0x8d6a('0x2b')](_0x238d59[_0x8d6a('0x34')],function(_0x4dc9f9){var _0x4f710e={};_0x4f710e[_0x4dc9f9]={'$like':'%'+_0x10d0e1[_0x8d6a('0x30')]['filter']+'%'};return _0x4f710e;})});}_0x238d59=_[_0x8d6a('0x3a')]({},_0x238d59,_0x10d0e1['options']);return _0xdb5f90[_0x8d6a('0x4f')](_0x238d59);}})[_0x8d6a('0x25')](function(_0x461a9f){if(_0x461a9f){_0x3498f7=_0x461a9f[_0x8d6a('0x36')];if(!_0x10d0e1['query'][_0x8d6a('0x37')](_0x8d6a('0x4e'))){_0x238d59['limit']=qs[_0x8d6a('0x1e')](_0x10d0e1[_0x8d6a('0x30')][_0x8d6a('0x1e')]);_0x238d59[_0x8d6a('0x1c')]=qs[_0x8d6a('0x1c')](_0x10d0e1['query']['offset']);}return _0xdb5f90[_0x8d6a('0x4f')](_0x238d59);}})[_0x8d6a('0x25')](function(_0x5dc8a7){if(_0x5dc8a7){return _0x5dc8a7?{'count':_0x3498f7,'rows':_0x5dc8a7}:null;}})[_0x8d6a('0x25')](respondWithResult(_0x3c8e85,null))[_0x8d6a('0x43')](handleError(_0x3c8e85,null));};exports[_0x8d6a('0x50')]=function(_0x3f26e5,_0x23c7a5,_0x430ea3){var _0x4bbf9a={};var _0x4870ea={};var _0x23e8cc;var _0x27d58d;return db[_0x8d6a('0x3e')]['findOne']({'where':{'id':_0x3f26e5[_0x8d6a('0x49')]['id']}})[_0x8d6a('0x25')](handleEntityNotFound(_0x23c7a5,null))[_0x8d6a('0x25')](function(_0x20eb78){if(_0x20eb78){_0x23e8cc=_0x20eb78;_0x4870ea[_0x8d6a('0x2f')]=_[_0x8d6a('0x31')](db[_0x8d6a('0x4b')][_0x8d6a('0x2c')]);_0x4870ea[_0x8d6a('0x30')]=_[_0x8d6a('0x31')](_0x3f26e5[_0x8d6a('0x30')]);_0x4870ea['filters']=_[_0x8d6a('0x33')](_0x4870ea[_0x8d6a('0x2f')],_0x4870ea[_0x8d6a('0x30')]);_0x4bbf9a[_0x8d6a('0x34')]=_[_0x8d6a('0x33')](_0x4870ea['model'],qs[_0x8d6a('0x35')](_0x3f26e5[_0x8d6a('0x30')][_0x8d6a('0x35')]));_0x4bbf9a[_0x8d6a('0x34')]=_0x4bbf9a[_0x8d6a('0x34')]['length']?_0x4bbf9a[_0x8d6a('0x34')]:_0x4870ea['model'];_0x4bbf9a['order']=qs[_0x8d6a('0x4d')](_0x3f26e5[_0x8d6a('0x30')][_0x8d6a('0x4d')]);_0x4bbf9a['where']=qs[_0x8d6a('0x32')](_[_0x8d6a('0x38')](_0x3f26e5[_0x8d6a('0x30')],_0x4870ea[_0x8d6a('0x32')]));if(_0x3f26e5[_0x8d6a('0x30')][_0x8d6a('0x3d')]){_0x4bbf9a['where']=_['merge'](_0x4bbf9a[_0x8d6a('0x39')],{'$or':_[_0x8d6a('0x2b')](_0x4bbf9a[_0x8d6a('0x34')],function(_0x46dc22){var _0x2196bc={};_0x2196bc[_0x46dc22]={'$like':'%'+_0x3f26e5[_0x8d6a('0x30')]['filter']+'%'};return _0x2196bc;})});}_0x4bbf9a=_[_0x8d6a('0x3a')]({},_0x4bbf9a,_0x3f26e5['options']);return _0x23e8cc[_0x8d6a('0x50')](_0x4bbf9a);}})[_0x8d6a('0x25')](function(_0x52e051){if(_0x52e051){_0x27d58d=_0x52e051[_0x8d6a('0x36')];if(!_0x3f26e5[_0x8d6a('0x30')][_0x8d6a('0x37')](_0x8d6a('0x4e'))){_0x4bbf9a[_0x8d6a('0x1e')]=qs[_0x8d6a('0x1e')](_0x3f26e5[_0x8d6a('0x30')][_0x8d6a('0x1e')]);_0x4bbf9a[_0x8d6a('0x1c')]=qs[_0x8d6a('0x1c')](_0x3f26e5['query'][_0x8d6a('0x1c')]);}return _0x23e8cc[_0x8d6a('0x50')](_0x4bbf9a);}})[_0x8d6a('0x25')](function(_0x4ef9b5){if(_0x4ef9b5){return _0x4ef9b5?{'count':_0x27d58d,'rows':_0x4ef9b5}:null;}})['then'](respondWithResult(_0x23c7a5,null))[_0x8d6a('0x43')](handleError(_0x23c7a5,null));}; \ No newline at end of file +var _0xeb83=['apply','reject','save','update','then','error','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','length','includeAll','include','find','create','body','getFields','findOne','hasOwnProperty','getSubjects','getDescriptions','ServicenowField','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x53fd68,_0x508a41){var _0x9e77bb=function(_0x16f999){while(--_0x16f999){_0x53fd68['push'](_0x53fd68['shift']());}};_0x9e77bb(++_0x508a41);}(_0xeb83,0xd7));var _0x3eb8=function(_0x169845,_0x11a247){_0x169845=_0x169845-0x0;var _0xae394c=_0xeb83[_0x169845];return _0xae394c;};'use strict';var emlformat=require(_0x3eb8('0x0'));var rimraf=require(_0x3eb8('0x1'));var zipdir=require(_0x3eb8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3eb8('0x3'));var moment=require(_0x3eb8('0x4'));var BPromise=require(_0x3eb8('0x5'));var Mustache=require('mustache');var util=require(_0x3eb8('0x6'));var path=require(_0x3eb8('0x7'));var sox=require(_0x3eb8('0x8'));var csv=require(_0x3eb8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3eb8('0xa'));var squel=require(_0x3eb8('0xb'));var crypto=require(_0x3eb8('0xc'));var jsforce=require(_0x3eb8('0xd'));var deskjs=require(_0x3eb8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3eb8('0xf'));var Papa=require(_0x3eb8('0x10'));var Redis=require(_0x3eb8('0x11'));var authService=require(_0x3eb8('0x12'));var qs=require(_0x3eb8('0x13'));var as=require(_0x3eb8('0x14'));var hardwareService=require(_0x3eb8('0x15'));var logger=require('../../config/logger')(_0x3eb8('0x16'));var utils=require(_0x3eb8('0x17'));var config=require(_0x3eb8('0x18'));var licenseUtil=require(_0x3eb8('0x19'));var db=require(_0x3eb8('0x1a'))['db'];function respondWithStatusCode(_0x2184ef,_0x169113){_0x169113=_0x169113||0xcc;return function(_0x431d4d){if(_0x431d4d){return _0x2184ef[_0x3eb8('0x1b')](_0x169113);}return _0x2184ef[_0x3eb8('0x1c')](_0x169113)[_0x3eb8('0x1d')]();};}function respondWithResult(_0x2b764f,_0x5cf8a4){_0x5cf8a4=_0x5cf8a4||0xc8;return function(_0x1fcf06){if(_0x1fcf06){return _0x2b764f['status'](_0x5cf8a4)[_0x3eb8('0x1e')](_0x1fcf06);}};}function respondWithFilteredResult(_0x71d575,_0x57fc1a){return function(_0x4ac46c){if(_0x4ac46c){var _0x3ff1af=typeof _0x57fc1a[_0x3eb8('0x1f')]==='undefined'&&typeof _0x57fc1a[_0x3eb8('0x20')]===_0x3eb8('0x21');var _0x3aa2e0=_0x4ac46c[_0x3eb8('0x22')];var _0x1cae88=_0x3ff1af?0x0:_0x57fc1a['offset'];var _0x3c1a27=_0x3ff1af?_0x4ac46c[_0x3eb8('0x22')]:_0x57fc1a[_0x3eb8('0x1f')]+_0x57fc1a[_0x3eb8('0x20')];var _0x824fb0;if(_0x3c1a27>=_0x3aa2e0){_0x3c1a27=_0x3aa2e0;_0x824fb0=0xc8;}else{_0x824fb0=0xce;}_0x71d575[_0x3eb8('0x1c')](_0x824fb0);return _0x71d575[_0x3eb8('0x23')](_0x3eb8('0x24'),_0x1cae88+'-'+_0x3c1a27+'/'+_0x3aa2e0)['json'](_0x4ac46c);}return null;};}function patchUpdates(_0x1d1d17){return function(_0x142412){try{jsonpatch[_0x3eb8('0x25')](_0x142412,_0x1d1d17,!![]);}catch(_0x9bd826){return BPromise[_0x3eb8('0x26')](_0x9bd826);}return _0x142412[_0x3eb8('0x27')]();};}function saveUpdates(_0x52375f,_0x1a5cc8){return function(_0x1e488f){if(_0x1e488f){return _0x1e488f[_0x3eb8('0x28')](_0x52375f)[_0x3eb8('0x29')](function(_0x29f9ac){return _0x29f9ac;});}return null;};}function removeEntity(_0x25f81c,_0x5dc125){return function(_0x49bc5a){if(_0x49bc5a){return _0x49bc5a['destroy']()[_0x3eb8('0x29')](function(){_0x25f81c[_0x3eb8('0x1c')](0xcc)[_0x3eb8('0x1d')]();});}};}function handleEntityNotFound(_0xbbff71,_0x20efa9){return function(_0x4610eb){if(!_0x4610eb){_0xbbff71[_0x3eb8('0x1b')](0x194);}return _0x4610eb;};}function handleError(_0x48c25b,_0x4804c9){_0x4804c9=_0x4804c9||0x1f4;return function(_0x2066e1){logger[_0x3eb8('0x2a')](_0x2066e1['stack']);if(_0x2066e1[_0x3eb8('0x2b')]){delete _0x2066e1[_0x3eb8('0x2b')];}_0x48c25b[_0x3eb8('0x1c')](_0x4804c9)[_0x3eb8('0x2c')](_0x2066e1);};}exports[_0x3eb8('0x2d')]=function(_0x1cdd87,_0x18bd57){var _0x7527b7={},_0x1de7ac={},_0x282eaf={'count':0x0,'rows':[]};var _0x4c8cd9=_[_0x3eb8('0x2e')](db[_0x3eb8('0x2f')][_0x3eb8('0x30')],function(_0x28b42c){return{'name':_0x28b42c[_0x3eb8('0x31')],'type':_0x28b42c[_0x3eb8('0x32')]['key']};});_0x1de7ac[_0x3eb8('0x33')]=_[_0x3eb8('0x2e')](_0x4c8cd9,_0x3eb8('0x2b'));_0x1de7ac[_0x3eb8('0x34')]=_[_0x3eb8('0x35')](_0x1cdd87['query']);_0x1de7ac[_0x3eb8('0x36')]=_[_0x3eb8('0x37')](_0x1de7ac['model'],_0x1de7ac[_0x3eb8('0x34')]);_0x7527b7['attributes']=_[_0x3eb8('0x37')](_0x1de7ac['model'],qs[_0x3eb8('0x38')](_0x1cdd87['query'][_0x3eb8('0x38')]));_0x7527b7[_0x3eb8('0x39')]=_0x7527b7['attributes']['length']?_0x7527b7[_0x3eb8('0x39')]:_0x1de7ac['model'];if(!_0x1cdd87[_0x3eb8('0x34')]['hasOwnProperty'](_0x3eb8('0x3a'))){_0x7527b7[_0x3eb8('0x20')]=qs[_0x3eb8('0x20')](_0x1cdd87['query'][_0x3eb8('0x20')]);_0x7527b7[_0x3eb8('0x1f')]=qs[_0x3eb8('0x1f')](_0x1cdd87[_0x3eb8('0x34')][_0x3eb8('0x1f')]);}_0x7527b7[_0x3eb8('0x3b')]=qs['sort'](_0x1cdd87['query'][_0x3eb8('0x3c')]);_0x7527b7[_0x3eb8('0x3d')]=qs[_0x3eb8('0x36')](_[_0x3eb8('0x3e')](_0x1cdd87[_0x3eb8('0x34')],_0x1de7ac[_0x3eb8('0x36')]),_0x4c8cd9);if(_0x1cdd87[_0x3eb8('0x34')]['filter']){_0x7527b7[_0x3eb8('0x3d')]=_[_0x3eb8('0x3f')](_0x7527b7[_0x3eb8('0x3d')],{'$or':_[_0x3eb8('0x2e')](_0x4c8cd9,function(_0x366c0c){if(_0x366c0c[_0x3eb8('0x32')]!==_0x3eb8('0x40')){var _0x4c9627={};_0x4c9627[_0x366c0c[_0x3eb8('0x2b')]]={'$like':'%'+_0x1cdd87['query'][_0x3eb8('0x41')]+'%'};return _0x4c9627;}})});}_0x7527b7=_['merge']({},_0x7527b7,_0x1cdd87[_0x3eb8('0x42')]);var _0x256613={'where':_0x7527b7[_0x3eb8('0x3d')]};return db[_0x3eb8('0x2f')][_0x3eb8('0x22')](_0x256613)[_0x3eb8('0x29')](function(_0x3f4042){_0x282eaf[_0x3eb8('0x22')]=_0x3f4042;if(_0x1cdd87[_0x3eb8('0x34')]['includeAll']){_0x7527b7['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x3eb8('0x43')](_0x7527b7);})[_0x3eb8('0x29')](function(_0x1e6324){_0x282eaf[_0x3eb8('0x44')]=_0x1e6324;return _0x282eaf;})[_0x3eb8('0x29')](respondWithFilteredResult(_0x18bd57,_0x7527b7))[_0x3eb8('0x45')](handleError(_0x18bd57,null));};exports[_0x3eb8('0x46')]=function(_0x15d7a8,_0x5e716c){var _0x109399={'raw':![],'where':{'id':_0x15d7a8[_0x3eb8('0x47')]['id']}},_0x4229c6={};_0x4229c6['model']=_[_0x3eb8('0x35')](db['ServicenowConfiguration'][_0x3eb8('0x30')]);_0x4229c6[_0x3eb8('0x34')]=_[_0x3eb8('0x35')](_0x15d7a8[_0x3eb8('0x34')]);_0x4229c6[_0x3eb8('0x36')]=_[_0x3eb8('0x37')](_0x4229c6[_0x3eb8('0x33')],_0x4229c6[_0x3eb8('0x34')]);_0x109399[_0x3eb8('0x39')]=_[_0x3eb8('0x37')](_0x4229c6[_0x3eb8('0x33')],qs[_0x3eb8('0x38')](_0x15d7a8[_0x3eb8('0x34')][_0x3eb8('0x38')]));_0x109399[_0x3eb8('0x39')]=_0x109399[_0x3eb8('0x39')][_0x3eb8('0x48')]?_0x109399[_0x3eb8('0x39')]:_0x4229c6[_0x3eb8('0x33')];if(_0x15d7a8[_0x3eb8('0x34')][_0x3eb8('0x49')]){_0x109399[_0x3eb8('0x4a')]=[{'all':!![]}];}_0x109399=_['merge']({},_0x109399,_0x15d7a8['options']);return db['ServicenowConfiguration'][_0x3eb8('0x4b')](_0x109399)[_0x3eb8('0x29')](handleEntityNotFound(_0x5e716c,null))[_0x3eb8('0x29')](respondWithResult(_0x5e716c,null))[_0x3eb8('0x45')](handleError(_0x5e716c,null));};exports[_0x3eb8('0x4c')]=function(_0x49c30a,_0x3cb8ce){return db[_0x3eb8('0x2f')]['create'](_0x49c30a[_0x3eb8('0x4d')],{})['then'](respondWithResult(_0x3cb8ce,0xc9))[_0x3eb8('0x45')](handleError(_0x3cb8ce,null));};exports['update']=function(_0x4915b1,_0x12aceb){if(_0x4915b1['body']['id']){delete _0x4915b1[_0x3eb8('0x4d')]['id'];}return db['ServicenowConfiguration'][_0x3eb8('0x4b')]({'where':{'id':_0x4915b1[_0x3eb8('0x47')]['id']}})[_0x3eb8('0x29')](handleEntityNotFound(_0x12aceb,null))[_0x3eb8('0x29')](saveUpdates(_0x4915b1[_0x3eb8('0x4d')],null))[_0x3eb8('0x29')](respondWithResult(_0x12aceb,null))[_0x3eb8('0x45')](handleError(_0x12aceb,null));};exports['destroy']=function(_0xf53316,_0x1f4c08){return db[_0x3eb8('0x2f')][_0x3eb8('0x4b')]({'where':{'id':_0xf53316['params']['id']}})[_0x3eb8('0x29')](handleEntityNotFound(_0x1f4c08,null))['then'](removeEntity(_0x1f4c08,null))[_0x3eb8('0x45')](handleError(_0x1f4c08,null));};exports[_0x3eb8('0x4e')]=function(_0x369297,_0x2a38e2,_0x399e62){var _0xa63cb2={};var _0x8ca66b={};var _0x2dac6a;var _0x454833;return db[_0x3eb8('0x2f')][_0x3eb8('0x4f')]({'where':{'id':_0x369297['params']['id']}})[_0x3eb8('0x29')](handleEntityNotFound(_0x2a38e2,null))[_0x3eb8('0x29')](function(_0x4d5f7f){if(_0x4d5f7f){_0x2dac6a=_0x4d5f7f;_0x8ca66b['model']=_[_0x3eb8('0x35')](db['ServicenowField'][_0x3eb8('0x30')]);_0x8ca66b['query']=_[_0x3eb8('0x35')](_0x369297[_0x3eb8('0x34')]);_0x8ca66b['filters']=_[_0x3eb8('0x37')](_0x8ca66b[_0x3eb8('0x33')],_0x8ca66b[_0x3eb8('0x34')]);_0xa63cb2[_0x3eb8('0x39')]=_['intersection'](_0x8ca66b[_0x3eb8('0x33')],qs['fields'](_0x369297[_0x3eb8('0x34')][_0x3eb8('0x38')]));_0xa63cb2[_0x3eb8('0x39')]=_0xa63cb2['attributes'][_0x3eb8('0x48')]?_0xa63cb2[_0x3eb8('0x39')]:_0x8ca66b[_0x3eb8('0x33')];_0xa63cb2['order']=qs[_0x3eb8('0x3c')](_0x369297[_0x3eb8('0x34')][_0x3eb8('0x3c')]);_0xa63cb2[_0x3eb8('0x3d')]=qs[_0x3eb8('0x36')](_[_0x3eb8('0x3e')](_0x369297['query'],_0x8ca66b[_0x3eb8('0x36')]));if(_0x369297[_0x3eb8('0x34')][_0x3eb8('0x41')]){_0xa63cb2[_0x3eb8('0x3d')]=_[_0x3eb8('0x3f')](_0xa63cb2[_0x3eb8('0x3d')],{'$or':_[_0x3eb8('0x2e')](_0xa63cb2[_0x3eb8('0x39')],function(_0x449746){var _0x2a6fe9={};_0x2a6fe9[_0x449746]={'$like':'%'+_0x369297[_0x3eb8('0x34')][_0x3eb8('0x41')]+'%'};return _0x2a6fe9;})});}_0xa63cb2=_[_0x3eb8('0x3f')]({},_0xa63cb2,_0x369297[_0x3eb8('0x42')]);return _0x2dac6a[_0x3eb8('0x4e')](_0xa63cb2);}})[_0x3eb8('0x29')](function(_0x515214){if(_0x515214){_0x454833=_0x515214[_0x3eb8('0x48')];if(!_0x369297['query'][_0x3eb8('0x50')]('nolimit')){_0xa63cb2[_0x3eb8('0x20')]=qs['limit'](_0x369297[_0x3eb8('0x34')]['limit']);_0xa63cb2[_0x3eb8('0x1f')]=qs['offset'](_0x369297['query'][_0x3eb8('0x1f')]);}return _0x2dac6a[_0x3eb8('0x4e')](_0xa63cb2);}})[_0x3eb8('0x29')](function(_0x4704d7){if(_0x4704d7){return _0x4704d7?{'count':_0x454833,'rows':_0x4704d7}:null;}})[_0x3eb8('0x29')](respondWithResult(_0x2a38e2,null))[_0x3eb8('0x45')](handleError(_0x2a38e2,null));};exports['getSubjects']=function(_0x2a49a4,_0x206946,_0x47fb92){var _0x4c422c={};var _0x46ecac={};var _0x3c482a;var _0x2524ea;return db[_0x3eb8('0x2f')][_0x3eb8('0x4f')]({'where':{'id':_0x2a49a4['params']['id']}})['then'](handleEntityNotFound(_0x206946,null))[_0x3eb8('0x29')](function(_0x347f26){if(_0x347f26){_0x3c482a=_0x347f26;_0x46ecac['model']=_[_0x3eb8('0x35')](db['ServicenowField']['rawAttributes']);_0x46ecac[_0x3eb8('0x34')]=_['keys'](_0x2a49a4['query']);_0x46ecac[_0x3eb8('0x36')]=_[_0x3eb8('0x37')](_0x46ecac['model'],_0x46ecac[_0x3eb8('0x34')]);_0x4c422c[_0x3eb8('0x39')]=_['intersection'](_0x46ecac[_0x3eb8('0x33')],qs['fields'](_0x2a49a4[_0x3eb8('0x34')]['fields']));_0x4c422c[_0x3eb8('0x39')]=_0x4c422c[_0x3eb8('0x39')][_0x3eb8('0x48')]?_0x4c422c[_0x3eb8('0x39')]:_0x46ecac['model'];_0x4c422c['order']=qs[_0x3eb8('0x3c')](_0x2a49a4[_0x3eb8('0x34')]['sort']);_0x4c422c['where']=qs['filters'](_['pick'](_0x2a49a4[_0x3eb8('0x34')],_0x46ecac[_0x3eb8('0x36')]));if(_0x2a49a4[_0x3eb8('0x34')][_0x3eb8('0x41')]){_0x4c422c[_0x3eb8('0x3d')]=_['merge'](_0x4c422c['where'],{'$or':_[_0x3eb8('0x2e')](_0x4c422c[_0x3eb8('0x39')],function(_0xd329c5){var _0x4d122c={};_0x4d122c[_0xd329c5]={'$like':'%'+_0x2a49a4[_0x3eb8('0x34')]['filter']+'%'};return _0x4d122c;})});}_0x4c422c=_[_0x3eb8('0x3f')]({},_0x4c422c,_0x2a49a4[_0x3eb8('0x42')]);return _0x3c482a[_0x3eb8('0x51')](_0x4c422c);}})[_0x3eb8('0x29')](function(_0x4a1773){if(_0x4a1773){_0x2524ea=_0x4a1773[_0x3eb8('0x48')];if(!_0x2a49a4[_0x3eb8('0x34')][_0x3eb8('0x50')](_0x3eb8('0x3a'))){_0x4c422c[_0x3eb8('0x20')]=qs[_0x3eb8('0x20')](_0x2a49a4[_0x3eb8('0x34')]['limit']);_0x4c422c[_0x3eb8('0x1f')]=qs[_0x3eb8('0x1f')](_0x2a49a4[_0x3eb8('0x34')][_0x3eb8('0x1f')]);}return _0x3c482a[_0x3eb8('0x51')](_0x4c422c);}})[_0x3eb8('0x29')](function(_0x4aa6d8){if(_0x4aa6d8){return _0x4aa6d8?{'count':_0x2524ea,'rows':_0x4aa6d8}:null;}})[_0x3eb8('0x29')](respondWithResult(_0x206946,null))[_0x3eb8('0x45')](handleError(_0x206946,null));};exports[_0x3eb8('0x52')]=function(_0x4ea768,_0x3e47b6,_0xc84acd){var _0x1c18d2={};var _0x565c48={};var _0x2d78ec;var _0x44f662;return db[_0x3eb8('0x2f')]['findOne']({'where':{'id':_0x4ea768[_0x3eb8('0x47')]['id']}})[_0x3eb8('0x29')](handleEntityNotFound(_0x3e47b6,null))[_0x3eb8('0x29')](function(_0x501cef){if(_0x501cef){_0x2d78ec=_0x501cef;_0x565c48[_0x3eb8('0x33')]=_[_0x3eb8('0x35')](db[_0x3eb8('0x53')][_0x3eb8('0x30')]);_0x565c48['query']=_[_0x3eb8('0x35')](_0x4ea768[_0x3eb8('0x34')]);_0x565c48['filters']=_[_0x3eb8('0x37')](_0x565c48[_0x3eb8('0x33')],_0x565c48[_0x3eb8('0x34')]);_0x1c18d2['attributes']=_[_0x3eb8('0x37')](_0x565c48[_0x3eb8('0x33')],qs['fields'](_0x4ea768[_0x3eb8('0x34')][_0x3eb8('0x38')]));_0x1c18d2[_0x3eb8('0x39')]=_0x1c18d2['attributes']['length']?_0x1c18d2[_0x3eb8('0x39')]:_0x565c48[_0x3eb8('0x33')];_0x1c18d2['order']=qs['sort'](_0x4ea768[_0x3eb8('0x34')][_0x3eb8('0x3c')]);_0x1c18d2[_0x3eb8('0x3d')]=qs[_0x3eb8('0x36')](_[_0x3eb8('0x3e')](_0x4ea768[_0x3eb8('0x34')],_0x565c48[_0x3eb8('0x36')]));if(_0x4ea768[_0x3eb8('0x34')][_0x3eb8('0x41')]){_0x1c18d2[_0x3eb8('0x3d')]=_[_0x3eb8('0x3f')](_0x1c18d2['where'],{'$or':_[_0x3eb8('0x2e')](_0x1c18d2['attributes'],function(_0xe44253){var _0x8f077b={};_0x8f077b[_0xe44253]={'$like':'%'+_0x4ea768[_0x3eb8('0x34')]['filter']+'%'};return _0x8f077b;})});}_0x1c18d2=_[_0x3eb8('0x3f')]({},_0x1c18d2,_0x4ea768[_0x3eb8('0x42')]);return _0x2d78ec[_0x3eb8('0x52')](_0x1c18d2);}})[_0x3eb8('0x29')](function(_0xcc91cc){if(_0xcc91cc){_0x44f662=_0xcc91cc[_0x3eb8('0x48')];if(!_0x4ea768[_0x3eb8('0x34')][_0x3eb8('0x50')](_0x3eb8('0x3a'))){_0x1c18d2[_0x3eb8('0x20')]=qs[_0x3eb8('0x20')](_0x4ea768[_0x3eb8('0x34')][_0x3eb8('0x20')]);_0x1c18d2[_0x3eb8('0x1f')]=qs['offset'](_0x4ea768[_0x3eb8('0x34')][_0x3eb8('0x1f')]);}return _0x2d78ec[_0x3eb8('0x52')](_0x1c18d2);}})[_0x3eb8('0x29')](function(_0x121fca){if(_0x121fca){return _0x121fca?{'count':_0x44f662,'rows':_0x121fca}:null;}})['then'](respondWithResult(_0x3e47b6,null))[_0x3eb8('0x45')](handleError(_0x3e47b6,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 0148acb..8050625 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 _0x7b08=['path','rimraf','../../config/environment','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api','moment','request-promise'];(function(_0x4bb2b9,_0x459c78){var _0x40e2a2=function(_0x19a26c){while(--_0x19a26c){_0x4bb2b9['push'](_0x4bb2b9['shift']());}};_0x40e2a2(++_0x459c78);}(_0x7b08,0x163));var _0x87b0=function(_0x346684,_0x204ae1){_0x346684=_0x346684-0x0;var _0x134ff4=_0x7b08[_0x346684];return _0x134ff4;};'use strict';var _=require(_0x87b0('0x0'));var util=require('util');var logger=require(_0x87b0('0x1'))(_0x87b0('0x2'));var moment=require(_0x87b0('0x3'));var BPromise=require('bluebird');var rp=require(_0x87b0('0x4'));var fs=require('fs');var path=require(_0x87b0('0x5'));var rimraf=require(_0x87b0('0x6'));var config=require(_0x87b0('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x87b0('0x8')]=function(_0x2b7526,_0x233040){return _0x2b7526[_0x87b0('0x9')](_0x87b0('0xa'),attributes,{'tableName':_0x87b0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bc6=['request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5b0b5a,_0x409931){var _0x191f91=function(_0x480404){while(--_0x480404){_0x5b0b5a['push'](_0x5b0b5a['shift']());}};_0x191f91(++_0x409931);}(_0x1bc6,0x94));var _0x61bc=function(_0x304909,_0x1202b1){_0x304909=_0x304909-0x0;var _0x2b8db0=_0x1bc6[_0x304909];return _0x2b8db0;};'use strict';var _=require(_0x61bc('0x0'));var util=require(_0x61bc('0x1'));var logger=require(_0x61bc('0x2'))(_0x61bc('0x3'));var moment=require(_0x61bc('0x4'));var BPromise=require(_0x61bc('0x5'));var rp=require(_0x61bc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x61bc('0x7'));var config=require(_0x61bc('0x8'));var attributes=require(_0x61bc('0x9'));module[_0x61bc('0xa')]=function(_0x362ebb,_0x1af9bc){return _0x362ebb[_0x61bc('0xb')](_0x61bc('0xc'),attributes,{'tableName':_0x61bc('0xd'),'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 0251c70..f6bbb3b 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 _0x3d8f=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0x3aaa01,_0x336f39){var _0x2f3cef=function(_0x434f30){while(--_0x434f30){_0x3aaa01['push'](_0x3aaa01['shift']());}};_0x2f3cef(++_0x336f39);}(_0x3d8f,0x18c));var _0xf3d8=function(_0x4364a4,_0x92f21d){_0x4364a4=_0x4364a4-0x0;var _0x432962=_0x3d8f[_0x4364a4];return _0x432962;};'use strict';var _=require('lodash');var util=require(_0xf3d8('0x0'));var moment=require(_0xf3d8('0x1'));var BPromise=require(_0xf3d8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3d8('0x3'));var db=require(_0xf3d8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf3d8('0x5'))(_0xf3d8('0x6'));var config=require(_0xf3d8('0x7'));var jayson=require(_0xf3d8('0x8'));var client=jayson[_0xf3d8('0x9')][_0xf3d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x468675,_0x279e99,_0x52c508){return new BPromise(function(_0x4b6b2c,_0x1e6313){return client[_0xf3d8('0xb')](_0x468675,_0x52c508)[_0xf3d8('0xc')](function(_0x1caf82){logger['info'](_0xf3d8('0xd'),_0x279e99,_0xf3d8('0xe'));logger['debug'](_0xf3d8('0xf'),_0x279e99,'request\x20sent',JSON['stringify'](_0x1caf82));if(_0x1caf82[_0xf3d8('0x10')]){if(_0x1caf82[_0xf3d8('0x10')][_0xf3d8('0x11')]===0x1f4){logger['error'](_0xf3d8('0xd'),_0x279e99,_0x1caf82[_0xf3d8('0x10')][_0xf3d8('0x12')]);return _0x1e6313(_0x1caf82['error'][_0xf3d8('0x12')]);}logger['error'](_0xf3d8('0xd'),_0x279e99,_0x1caf82['error'][_0xf3d8('0x12')]);return _0x4b6b2c(_0x1caf82[_0xf3d8('0x10')]['message']);}else{logger[_0xf3d8('0x13')](_0xf3d8('0xd'),_0x279e99,_0xf3d8('0xe'));_0x4b6b2c(_0x1caf82[_0xf3d8('0x14')]['message']);}})[_0xf3d8('0x15')](function(_0xc0d716){logger[_0xf3d8('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x279e99,_0xc0d716);_0x1e6313(_0xc0d716);});});} \ No newline at end of file +var _0x9719=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x237671,_0x3a1449){var _0x8376f6=function(_0x239c46){while(--_0x239c46){_0x237671['push'](_0x237671['shift']());}};_0x8376f6(++_0x3a1449);}(_0x9719,0x79));var _0x9971=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9719[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x9971('0x0'));var util=require(_0x9971('0x1'));var moment=require(_0x9971('0x2'));var BPromise=require(_0x9971('0x3'));var rs=require(_0x9971('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9971('0x5'))['db'];var utils=require(_0x9971('0x6'));var logger=require(_0x9971('0x7'))('rpc');var config=require(_0x9971('0x8'));var jayson=require(_0x9971('0x9'));var client=jayson[_0x9971('0xa')][_0x9971('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15ee24,_0x11b397,_0x54ac3c){return new BPromise(function(_0x1cdb99,_0x49e6ec){return client[_0x9971('0xc')](_0x15ee24,_0x54ac3c)[_0x9971('0xd')](function(_0x508076){logger[_0x9971('0xe')](_0x9971('0xf'),_0x11b397,'request\x20sent');logger[_0x9971('0x10')](_0x9971('0x11'),_0x11b397,_0x9971('0x12'),JSON[_0x9971('0x13')](_0x508076));if(_0x508076[_0x9971('0x14')]){if(_0x508076[_0x9971('0x14')][_0x9971('0x15')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x11b397,_0x508076[_0x9971('0x14')][_0x9971('0x16')]);return _0x49e6ec(_0x508076[_0x9971('0x14')][_0x9971('0x16')]);}logger[_0x9971('0x14')](_0x9971('0xf'),_0x11b397,_0x508076[_0x9971('0x14')][_0x9971('0x16')]);return _0x1cdb99(_0x508076[_0x9971('0x14')]['message']);}else{logger[_0x9971('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x11b397,'request\x20sent');_0x1cdb99(_0x508076[_0x9971('0x17')][_0x9971('0x16')]);}})[_0x9971('0x18')](function(_0x22c78f){logger[_0x9971('0x14')](_0x9971('0xf'),_0x11b397,_0x22c78f);_0x49e6ec(_0x22c78f);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index c855cba..9f3a741 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 _0x06f2=['Router','fs-extra','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util','path','express'];(function(_0x74895e,_0x298c35){var _0x40bc2a=function(_0x558c6d){while(--_0x558c6d){_0x74895e['push'](_0x74895e['shift']());}};_0x40bc2a(++_0x298c35);}(_0x06f2,0x68));var _0x206f=function(_0x335951,_0xbbbc9e){_0x335951=_0x335951-0x0;var _0x2b07da=_0x06f2[_0x335951];return _0x2b07da;};'use strict';var multer=require(_0x206f('0x0'));var util=require(_0x206f('0x1'));var path=require(_0x206f('0x2'));var timeout=require('connect-timeout');var express=require(_0x206f('0x3'));var router=express[_0x206f('0x4')]();var fs_extra=require(_0x206f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x206f('0x6'));var controller=require(_0x206f('0x7'));router[_0x206f('0x8')]('/',auth[_0x206f('0x9')](),controller['index']);router[_0x206f('0x8')](_0x206f('0xa'),auth[_0x206f('0x9')](),controller[_0x206f('0xb')]);router[_0x206f('0xc')]('/',auth[_0x206f('0x9')](),controller[_0x206f('0xd')]);router[_0x206f('0xe')](_0x206f('0xa'),auth[_0x206f('0x9')](),controller[_0x206f('0xf')]);router[_0x206f('0x10')](_0x206f('0xa'),auth[_0x206f('0x9')](),controller[_0x206f('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc81d=['index','show','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intServicenowField.controller','get'];(function(_0x3822f8,_0x12e40b){var _0x4b50ff=function(_0x2da695){while(--_0x2da695){_0x3822f8['push'](_0x3822f8['shift']());}};_0x4b50ff(++_0x12e40b);}(_0xc81d,0x1ba));var _0xdc81=function(_0x47da1c,_0x1cb9bb){_0x47da1c=_0x47da1c-0x0;var _0xe2c24d=_0xc81d[_0x47da1c];return _0xe2c24d;};'use strict';var multer=require(_0xdc81('0x0'));var util=require('util');var path=require(_0xdc81('0x1'));var timeout=require(_0xdc81('0x2'));var express=require('express');var router=express[_0xdc81('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdc81('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdc81('0x5'));var controller=require(_0xdc81('0x6'));router[_0xdc81('0x7')]('/',auth['isAuthenticated'](),controller[_0xdc81('0x8')]);router[_0xdc81('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xdc81('0x9')]);router['post']('/',auth[_0xdc81('0xa')](),controller[_0xdc81('0xb')]);router[_0xdc81('0xc')](_0xdc81('0xd'),auth[_0xdc81('0xa')](),controller[_0xdc81('0xe')]);router[_0xdc81('0xf')](_0xdc81('0xd'),auth['isAuthenticated'](),controller[_0xdc81('0x10')]);module[_0xdc81('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index b249bce..988b6dd 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 _0x332b=['keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable'];(function(_0x244896,_0x206e0e){var _0x53452a=function(_0x280202){while(--_0x280202){_0x244896['push'](_0x244896['shift']());}};_0x53452a(++_0x206e0e);}(_0x332b,0x12d));var _0xb332=function(_0x3a7761,_0x15f53c){_0x3a7761=_0x3a7761-0x0;var _0x2b7aaf=_0x332b[_0x3a7761];return _0x2b7aaf;};'use strict';var Sequelize=require(_0xb332('0x0'));module['exports']={'type':{'type':Sequelize[_0xb332('0x1')](_0xb332('0x2'),_0xb332('0x3'),_0xb332('0x4'),_0xb332('0x5'),_0xb332('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb332('0x7')]},'key':{'type':Sequelize[_0xb332('0x7')]},'keyType':{'type':Sequelize[_0xb332('0x1')](_0xb332('0x2'),_0xb332('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xb332('0x7')]},'idField':{'type':Sequelize[_0xb332('0x7')]},'nameField':{'type':Sequelize[_0xb332('0x7')]},'customField':{'type':Sequelize[_0xb332('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5bea=['ENUM','BOOLEAN','sequelize','string','variable','customVariable','keyValue','STRING'];(function(_0x22c64b,_0x1a5050){var _0x1f0573=function(_0x551aac){while(--_0x551aac){_0x22c64b['push'](_0x22c64b['shift']());}};_0x1f0573(++_0x1a5050);}(_0x5bea,0xba));var _0xa5be=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5bea[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xa5be('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xa5be('0x1'),_0xa5be('0x2'),_0xa5be('0x3'),_0xa5be('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xa5be('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa5be('0x6')](_0xa5be('0x1'),_0xa5be('0x2'),_0xa5be('0x3'))},'keyContent':{'type':Sequelize[_0xa5be('0x5')]},'idField':{'type':Sequelize[_0xa5be('0x5')]},'nameField':{'type':Sequelize[_0xa5be('0x5')]},'customField':{'type':Sequelize[_0xa5be('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 5ea60a7..061c872 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 _0x3b91=['find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ServicenowField','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes'];(function(_0x462d8c,_0x5d4794){var _0x50579e=function(_0x220ffd){while(--_0x220ffd){_0x462d8c['push'](_0x462d8c['shift']());}};_0x50579e(++_0x5d4794);}(_0x3b91,0x91));var _0x13b9=function(_0x3181cc,_0x28447f){_0x3181cc=_0x3181cc-0x0;var _0x547a4a=_0x3b91[_0x3181cc];return _0x547a4a;};'use strict';var emlformat=require(_0x13b9('0x0'));var rimraf=require(_0x13b9('0x1'));var zipdir=require(_0x13b9('0x2'));var jsonpatch=require(_0x13b9('0x3'));var rp=require(_0x13b9('0x4'));var moment=require(_0x13b9('0x5'));var BPromise=require(_0x13b9('0x6'));var Mustache=require(_0x13b9('0x7'));var util=require(_0x13b9('0x8'));var path=require('path');var sox=require(_0x13b9('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x13b9('0xa'));var _=require(_0x13b9('0xb'));var squel=require(_0x13b9('0xc'));var crypto=require(_0x13b9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x13b9('0xe'));var toCsv=require('to-csv');var querystring=require(_0x13b9('0xf'));var Papa=require('papaparse');var Redis=require(_0x13b9('0x10'));var authService=require(_0x13b9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x13b9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x13b9('0x13'));var utils=require(_0x13b9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x13b9('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24ffe0,_0x52ee21){_0x52ee21=_0x52ee21||0xcc;return function(_0x2ad5b2){if(_0x2ad5b2){return _0x24ffe0['sendStatus'](_0x52ee21);}return _0x24ffe0['status'](_0x52ee21)[_0x13b9('0x16')]();};}function respondWithResult(_0x478d1f,_0x578921){_0x578921=_0x578921||0xc8;return function(_0x4f6374){if(_0x4f6374){return _0x478d1f['status'](_0x578921)[_0x13b9('0x17')](_0x4f6374);}};}function respondWithFilteredResult(_0x46051f,_0x4e1074){return function(_0x568818){if(_0x568818){var _0xadd45a=typeof _0x4e1074[_0x13b9('0x18')]===_0x13b9('0x19')&&typeof _0x4e1074['limit']===_0x13b9('0x19');var _0x498f3b=_0x568818[_0x13b9('0x1a')];var _0x5b2688=_0xadd45a?0x0:_0x4e1074[_0x13b9('0x18')];var _0x26bdf1=_0xadd45a?_0x568818[_0x13b9('0x1a')]:_0x4e1074['offset']+_0x4e1074[_0x13b9('0x1b')];var _0x4e96f5;if(_0x26bdf1>=_0x498f3b){_0x26bdf1=_0x498f3b;_0x4e96f5=0xc8;}else{_0x4e96f5=0xce;}_0x46051f[_0x13b9('0x1c')](_0x4e96f5);return _0x46051f[_0x13b9('0x1d')](_0x13b9('0x1e'),_0x5b2688+'-'+_0x26bdf1+'/'+_0x498f3b)['json'](_0x568818);}return null;};}function patchUpdates(_0x9a4390){return function(_0x34cc66){try{jsonpatch[_0x13b9('0x1f')](_0x34cc66,_0x9a4390,!![]);}catch(_0x413f83){return BPromise[_0x13b9('0x20')](_0x413f83);}return _0x34cc66[_0x13b9('0x21')]();};}function saveUpdates(_0x267d9d,_0x5ba5e8){return function(_0x59f079){if(_0x59f079){return _0x59f079[_0x13b9('0x22')](_0x267d9d)[_0x13b9('0x23')](function(_0xa20832){return _0xa20832;});}return null;};}function removeEntity(_0x1c1b23,_0x1ef77b){return function(_0x32388b){if(_0x32388b){return _0x32388b[_0x13b9('0x24')]()[_0x13b9('0x23')](function(){_0x1c1b23[_0x13b9('0x1c')](0xcc)[_0x13b9('0x16')]();});}};}function handleEntityNotFound(_0x4e8566,_0x5ab907){return function(_0xa2c33d){if(!_0xa2c33d){_0x4e8566['sendStatus'](0x194);}return _0xa2c33d;};}function handleError(_0x519f1e,_0x3d1e24){_0x3d1e24=_0x3d1e24||0x1f4;return function(_0x59cfc6){logger[_0x13b9('0x25')](_0x59cfc6[_0x13b9('0x26')]);if(_0x59cfc6[_0x13b9('0x27')]){delete _0x59cfc6[_0x13b9('0x27')];}_0x519f1e[_0x13b9('0x1c')](_0x3d1e24)['send'](_0x59cfc6);};}exports[_0x13b9('0x28')]=function(_0x552c13,_0x110c58){var _0x51d5e4={},_0x4e3856={},_0x2e479={'count':0x0,'rows':[]};var _0x1cfe9f=_[_0x13b9('0x29')](db[_0x13b9('0x2a')]['rawAttributes'],function(_0x52a8d4){return{'name':_0x52a8d4['fieldName'],'type':_0x52a8d4[_0x13b9('0x2b')][_0x13b9('0x2c')]};});_0x4e3856[_0x13b9('0x2d')]=_[_0x13b9('0x29')](_0x1cfe9f,_0x13b9('0x27'));_0x4e3856['query']=_[_0x13b9('0x2e')](_0x552c13[_0x13b9('0x2f')]);_0x4e3856[_0x13b9('0x30')]=_[_0x13b9('0x31')](_0x4e3856[_0x13b9('0x2d')],_0x4e3856[_0x13b9('0x2f')]);_0x51d5e4[_0x13b9('0x32')]=_['intersection'](_0x4e3856[_0x13b9('0x2d')],qs[_0x13b9('0x33')](_0x552c13[_0x13b9('0x2f')][_0x13b9('0x33')]));_0x51d5e4[_0x13b9('0x32')]=_0x51d5e4[_0x13b9('0x32')][_0x13b9('0x34')]?_0x51d5e4[_0x13b9('0x32')]:_0x4e3856['model'];if(!_0x552c13[_0x13b9('0x2f')][_0x13b9('0x35')](_0x13b9('0x36'))){_0x51d5e4[_0x13b9('0x1b')]=qs[_0x13b9('0x1b')](_0x552c13['query']['limit']);_0x51d5e4[_0x13b9('0x18')]=qs[_0x13b9('0x18')](_0x552c13[_0x13b9('0x2f')][_0x13b9('0x18')]);}_0x51d5e4['order']=qs[_0x13b9('0x37')](_0x552c13[_0x13b9('0x2f')][_0x13b9('0x37')]);_0x51d5e4[_0x13b9('0x38')]=qs[_0x13b9('0x30')](_[_0x13b9('0x39')](_0x552c13[_0x13b9('0x2f')],_0x4e3856[_0x13b9('0x30')]),_0x1cfe9f);if(_0x552c13[_0x13b9('0x2f')]['filter']){_0x51d5e4[_0x13b9('0x38')]=_[_0x13b9('0x3a')](_0x51d5e4[_0x13b9('0x38')],{'$or':_['map'](_0x1cfe9f,function(_0x2d130a){if(_0x2d130a[_0x13b9('0x2b')]!=='VIRTUAL'){var _0xdfaaa6={};_0xdfaaa6[_0x2d130a[_0x13b9('0x27')]]={'$like':'%'+_0x552c13['query'][_0x13b9('0x3b')]+'%'};return _0xdfaaa6;}})});}_0x51d5e4=_[_0x13b9('0x3a')]({},_0x51d5e4,_0x552c13[_0x13b9('0x3c')]);var _0x31a9ca={'where':_0x51d5e4['where']};return db[_0x13b9('0x2a')][_0x13b9('0x1a')](_0x31a9ca)[_0x13b9('0x23')](function(_0x47fee0){_0x2e479[_0x13b9('0x1a')]=_0x47fee0;if(_0x552c13[_0x13b9('0x2f')][_0x13b9('0x3d')]){_0x51d5e4[_0x13b9('0x3e')]=[{'all':!![]}];}return db[_0x13b9('0x2a')][_0x13b9('0x3f')](_0x51d5e4);})['then'](function(_0x877bb2){_0x2e479['rows']=_0x877bb2;return _0x2e479;})[_0x13b9('0x23')](respondWithFilteredResult(_0x110c58,_0x51d5e4))[_0x13b9('0x40')](handleError(_0x110c58,null));};exports[_0x13b9('0x41')]=function(_0x325638,_0x1c43af){var _0x1ac086={'raw':!![],'where':{'id':_0x325638[_0x13b9('0x42')]['id']}},_0x4f4860={};_0x4f4860['model']=_[_0x13b9('0x2e')](db[_0x13b9('0x2a')][_0x13b9('0x43')]);_0x4f4860[_0x13b9('0x2f')]=_[_0x13b9('0x2e')](_0x325638[_0x13b9('0x2f')]);_0x4f4860[_0x13b9('0x30')]=_[_0x13b9('0x31')](_0x4f4860['model'],_0x4f4860[_0x13b9('0x2f')]);_0x1ac086[_0x13b9('0x32')]=_[_0x13b9('0x31')](_0x4f4860[_0x13b9('0x2d')],qs[_0x13b9('0x33')](_0x325638[_0x13b9('0x2f')][_0x13b9('0x33')]));_0x1ac086[_0x13b9('0x32')]=_0x1ac086[_0x13b9('0x32')][_0x13b9('0x34')]?_0x1ac086[_0x13b9('0x32')]:_0x4f4860[_0x13b9('0x2d')];if(_0x325638[_0x13b9('0x2f')][_0x13b9('0x3d')]){_0x1ac086['include']=[{'all':!![]}];}_0x1ac086=_[_0x13b9('0x3a')]({},_0x1ac086,_0x325638[_0x13b9('0x3c')]);return db['ServicenowField'][_0x13b9('0x44')](_0x1ac086)[_0x13b9('0x23')](handleEntityNotFound(_0x1c43af,null))[_0x13b9('0x23')](respondWithResult(_0x1c43af,null))['catch'](handleError(_0x1c43af,null));};exports[_0x13b9('0x45')]=function(_0x501198,_0x208e7b){return db['ServicenowField'][_0x13b9('0x45')](_0x501198['body'],{})[_0x13b9('0x23')](respondWithResult(_0x208e7b,0xc9))[_0x13b9('0x40')](handleError(_0x208e7b,null));};exports[_0x13b9('0x22')]=function(_0x4629f9,_0x55505b){if(_0x4629f9[_0x13b9('0x46')]['id']){delete _0x4629f9[_0x13b9('0x46')]['id'];}return db[_0x13b9('0x2a')]['find']({'where':{'id':_0x4629f9[_0x13b9('0x42')]['id']}})[_0x13b9('0x23')](handleEntityNotFound(_0x55505b,null))['then'](saveUpdates(_0x4629f9[_0x13b9('0x46')],null))[_0x13b9('0x23')](respondWithResult(_0x55505b,null))[_0x13b9('0x40')](handleError(_0x55505b,null));};exports[_0x13b9('0x24')]=function(_0x4c4eb3,_0x231081){return db[_0x13b9('0x2a')][_0x13b9('0x44')]({'where':{'id':_0x4c4eb3[_0x13b9('0x42')]['id']}})[_0x13b9('0x23')](handleEntityNotFound(_0x231081,null))['then'](removeEntity(_0x231081,null))[_0x13b9('0x40')](handleError(_0x231081,null));}; \ No newline at end of file +var _0x1c20=['lodash','crypto','desk.js','to-csv','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','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','ServicenowField','rawAttributes','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x1c20,0x180));var _0x01c2=function(_0x4fbb15,_0x21be0c){_0x4fbb15=_0x4fbb15-0x0;var _0x436338=_0x1c20[_0x4fbb15];return _0x436338;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01c2('0x0'));var zipdir=require(_0x01c2('0x1'));var jsonpatch=require(_0x01c2('0x2'));var rp=require(_0x01c2('0x3'));var moment=require(_0x01c2('0x4'));var BPromise=require(_0x01c2('0x5'));var Mustache=require(_0x01c2('0x6'));var util=require(_0x01c2('0x7'));var path=require(_0x01c2('0x8'));var sox=require(_0x01c2('0x9'));var csv=require('to-csv');var ejs=require(_0x01c2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x01c2('0xb'));var squel=require('squel');var crypto=require(_0x01c2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x01c2('0xd'));var toCsv=require(_0x01c2('0xe'));var querystring=require('querystring');var Papa=require(_0x01c2('0xf'));var Redis=require(_0x01c2('0x10'));var authService=require(_0x01c2('0x11'));var qs=require(_0x01c2('0x12'));var as=require(_0x01c2('0x13'));var hardwareService=require(_0x01c2('0x14'));var logger=require('../../config/logger')(_0x01c2('0x15'));var utils=require(_0x01c2('0x16'));var config=require(_0x01c2('0x17'));var licenseUtil=require(_0x01c2('0x18'));var db=require(_0x01c2('0x19'))['db'];function respondWithStatusCode(_0x237dbd,_0x1d962c){_0x1d962c=_0x1d962c||0xcc;return function(_0x206e63){if(_0x206e63){return _0x237dbd[_0x01c2('0x1a')](_0x1d962c);}return _0x237dbd[_0x01c2('0x1b')](_0x1d962c)[_0x01c2('0x1c')]();};}function respondWithResult(_0x397a54,_0x41c108){_0x41c108=_0x41c108||0xc8;return function(_0x27aa0f){if(_0x27aa0f){return _0x397a54[_0x01c2('0x1b')](_0x41c108)[_0x01c2('0x1d')](_0x27aa0f);}};}function respondWithFilteredResult(_0x33fa92,_0x67b2b5){return function(_0x3a8d26){if(_0x3a8d26){var _0x2289eb=typeof _0x67b2b5[_0x01c2('0x1e')]===_0x01c2('0x1f')&&typeof _0x67b2b5[_0x01c2('0x20')]===_0x01c2('0x1f');var _0x119859=_0x3a8d26[_0x01c2('0x21')];var _0x36f4d6=_0x2289eb?0x0:_0x67b2b5[_0x01c2('0x1e')];var _0x6ee915=_0x2289eb?_0x3a8d26[_0x01c2('0x21')]:_0x67b2b5[_0x01c2('0x1e')]+_0x67b2b5[_0x01c2('0x20')];var _0x2ec737;if(_0x6ee915>=_0x119859){_0x6ee915=_0x119859;_0x2ec737=0xc8;}else{_0x2ec737=0xce;}_0x33fa92[_0x01c2('0x1b')](_0x2ec737);return _0x33fa92[_0x01c2('0x22')](_0x01c2('0x23'),_0x36f4d6+'-'+_0x6ee915+'/'+_0x119859)[_0x01c2('0x1d')](_0x3a8d26);}return null;};}function patchUpdates(_0x9374e9){return function(_0x43bfd2){try{jsonpatch['apply'](_0x43bfd2,_0x9374e9,!![]);}catch(_0x6ce2d9){return BPromise[_0x01c2('0x24')](_0x6ce2d9);}return _0x43bfd2[_0x01c2('0x25')]();};}function saveUpdates(_0x54fddc,_0x35f5b8){return function(_0x311a73){if(_0x311a73){return _0x311a73[_0x01c2('0x26')](_0x54fddc)['then'](function(_0x5af0b6){return _0x5af0b6;});}return null;};}function removeEntity(_0x51bbaf,_0x5b104e){return function(_0x43189f){if(_0x43189f){return _0x43189f[_0x01c2('0x27')]()[_0x01c2('0x28')](function(){_0x51bbaf[_0x01c2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21aa32,_0x19c9db){return function(_0x3d3282){if(!_0x3d3282){_0x21aa32['sendStatus'](0x194);}return _0x3d3282;};}function handleError(_0x1cde65,_0xb29cdf){_0xb29cdf=_0xb29cdf||0x1f4;return function(_0x3f4a73){logger[_0x01c2('0x29')](_0x3f4a73[_0x01c2('0x2a')]);if(_0x3f4a73['name']){delete _0x3f4a73[_0x01c2('0x2b')];}_0x1cde65[_0x01c2('0x1b')](_0xb29cdf)[_0x01c2('0x2c')](_0x3f4a73);};}exports[_0x01c2('0x2d')]=function(_0x25c8c7,_0x1be119){var _0x2bd85f={},_0x1ab7a4={},_0x215e5c={'count':0x0,'rows':[]};var _0x15f65c=_[_0x01c2('0x2e')](db[_0x01c2('0x2f')][_0x01c2('0x30')],function(_0x486593){return{'name':_0x486593['fieldName'],'type':_0x486593[_0x01c2('0x31')][_0x01c2('0x32')]};});_0x1ab7a4['model']=_[_0x01c2('0x2e')](_0x15f65c,_0x01c2('0x2b'));_0x1ab7a4['query']=_[_0x01c2('0x33')](_0x25c8c7[_0x01c2('0x34')]);_0x1ab7a4[_0x01c2('0x35')]=_[_0x01c2('0x36')](_0x1ab7a4['model'],_0x1ab7a4['query']);_0x2bd85f[_0x01c2('0x37')]=_[_0x01c2('0x36')](_0x1ab7a4[_0x01c2('0x38')],qs[_0x01c2('0x39')](_0x25c8c7[_0x01c2('0x34')][_0x01c2('0x39')]));_0x2bd85f[_0x01c2('0x37')]=_0x2bd85f['attributes'][_0x01c2('0x3a')]?_0x2bd85f[_0x01c2('0x37')]:_0x1ab7a4[_0x01c2('0x38')];if(!_0x25c8c7[_0x01c2('0x34')][_0x01c2('0x3b')](_0x01c2('0x3c'))){_0x2bd85f['limit']=qs[_0x01c2('0x20')](_0x25c8c7['query'][_0x01c2('0x20')]);_0x2bd85f['offset']=qs['offset'](_0x25c8c7[_0x01c2('0x34')][_0x01c2('0x1e')]);}_0x2bd85f[_0x01c2('0x3d')]=qs[_0x01c2('0x3e')](_0x25c8c7[_0x01c2('0x34')]['sort']);_0x2bd85f[_0x01c2('0x3f')]=qs['filters'](_[_0x01c2('0x40')](_0x25c8c7[_0x01c2('0x34')],_0x1ab7a4['filters']),_0x15f65c);if(_0x25c8c7['query']['filter']){_0x2bd85f[_0x01c2('0x3f')]=_['merge'](_0x2bd85f[_0x01c2('0x3f')],{'$or':_[_0x01c2('0x2e')](_0x15f65c,function(_0x5f590d){if(_0x5f590d['type']!==_0x01c2('0x41')){var _0x3a55cd={};_0x3a55cd[_0x5f590d[_0x01c2('0x2b')]]={'$like':'%'+_0x25c8c7['query'][_0x01c2('0x42')]+'%'};return _0x3a55cd;}})});}_0x2bd85f=_[_0x01c2('0x43')]({},_0x2bd85f,_0x25c8c7[_0x01c2('0x44')]);var _0x17215e={'where':_0x2bd85f[_0x01c2('0x3f')]};return db[_0x01c2('0x2f')]['count'](_0x17215e)[_0x01c2('0x28')](function(_0x534e5b){_0x215e5c[_0x01c2('0x21')]=_0x534e5b;if(_0x25c8c7[_0x01c2('0x34')][_0x01c2('0x45')]){_0x2bd85f['include']=[{'all':!![]}];}return db[_0x01c2('0x2f')][_0x01c2('0x46')](_0x2bd85f);})[_0x01c2('0x28')](function(_0xed8775){_0x215e5c[_0x01c2('0x47')]=_0xed8775;return _0x215e5c;})[_0x01c2('0x28')](respondWithFilteredResult(_0x1be119,_0x2bd85f))[_0x01c2('0x48')](handleError(_0x1be119,null));};exports[_0x01c2('0x49')]=function(_0x197a96,_0x3d25ee){var _0x2ae224={'raw':!![],'where':{'id':_0x197a96[_0x01c2('0x4a')]['id']}},_0x331c60={};_0x331c60['model']=_[_0x01c2('0x33')](db['ServicenowField']['rawAttributes']);_0x331c60[_0x01c2('0x34')]=_[_0x01c2('0x33')](_0x197a96[_0x01c2('0x34')]);_0x331c60[_0x01c2('0x35')]=_[_0x01c2('0x36')](_0x331c60[_0x01c2('0x38')],_0x331c60[_0x01c2('0x34')]);_0x2ae224[_0x01c2('0x37')]=_['intersection'](_0x331c60[_0x01c2('0x38')],qs[_0x01c2('0x39')](_0x197a96[_0x01c2('0x34')][_0x01c2('0x39')]));_0x2ae224[_0x01c2('0x37')]=_0x2ae224[_0x01c2('0x37')][_0x01c2('0x3a')]?_0x2ae224['attributes']:_0x331c60[_0x01c2('0x38')];if(_0x197a96[_0x01c2('0x34')][_0x01c2('0x45')]){_0x2ae224[_0x01c2('0x4b')]=[{'all':!![]}];}_0x2ae224=_[_0x01c2('0x43')]({},_0x2ae224,_0x197a96[_0x01c2('0x44')]);return db[_0x01c2('0x2f')][_0x01c2('0x4c')](_0x2ae224)[_0x01c2('0x28')](handleEntityNotFound(_0x3d25ee,null))[_0x01c2('0x28')](respondWithResult(_0x3d25ee,null))[_0x01c2('0x48')](handleError(_0x3d25ee,null));};exports['create']=function(_0x390476,_0x40dcee){return db[_0x01c2('0x2f')][_0x01c2('0x4d')](_0x390476['body'],{})[_0x01c2('0x28')](respondWithResult(_0x40dcee,0xc9))[_0x01c2('0x48')](handleError(_0x40dcee,null));};exports[_0x01c2('0x26')]=function(_0x4d3c72,_0x355b2b){if(_0x4d3c72['body']['id']){delete _0x4d3c72[_0x01c2('0x4e')]['id'];}return db['ServicenowField'][_0x01c2('0x4c')]({'where':{'id':_0x4d3c72[_0x01c2('0x4a')]['id']}})[_0x01c2('0x28')](handleEntityNotFound(_0x355b2b,null))['then'](saveUpdates(_0x4d3c72['body'],null))[_0x01c2('0x28')](respondWithResult(_0x355b2b,null))[_0x01c2('0x48')](handleError(_0x355b2b,null));};exports['destroy']=function(_0x116fb4,_0x43cec2){return db[_0x01c2('0x2f')][_0x01c2('0x4c')]({'where':{'id':_0x116fb4[_0x01c2('0x4a')]['id']}})[_0x01c2('0x28')](handleEntityNotFound(_0x43cec2,null))[_0x01c2('0x28')](removeEntity(_0x43cec2,null))[_0x01c2('0x48')](handleError(_0x43cec2,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 31ebf79..247c6a1 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 _0x0c7d=['api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util'];(function(_0x50c13d,_0x1ff40e){var _0x39806e=function(_0x13586f){while(--_0x13586f){_0x50c13d['push'](_0x50c13d['shift']());}};_0x39806e(++_0x1ff40e);}(_0x0c7d,0x11b));var _0xd0c7=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x0c7d[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0xd0c7('0x0'));var util=require(_0xd0c7('0x1'));var logger=require('../../config/logger')(_0xd0c7('0x2'));var moment=require(_0xd0c7('0x3'));var BPromise=require(_0xd0c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd0c7('0x5'));var rimraf=require(_0xd0c7('0x6'));var config=require(_0xd0c7('0x7'));var attributes=require(_0xd0c7('0x8'));module[_0xd0c7('0x9')]=function(_0x130157,_0x5d92b3){return _0x130157[_0xd0c7('0xa')]('ServicenowField',attributes,{'tableName':_0xd0c7('0xb'),'paranoid':![],'indexes':[{'name':_0xd0c7('0xc'),'fields':[_0xd0c7('0xd'),_0xd0c7('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb090=['servicenow_unique_index','FieldId','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields'];(function(_0x561975,_0x1d64fc){var _0x15b7f5=function(_0x43bfc1){while(--_0x43bfc1){_0x561975['push'](_0x561975['shift']());}};_0x15b7f5(++_0x1d64fc);}(_0xb090,0x1c2));var _0x0b09=function(_0x41bcc3,_0x101b3a){_0x41bcc3=_0x41bcc3-0x0;var _0x237c99=_0xb090[_0x41bcc3];return _0x237c99;};'use strict';var _=require(_0x0b09('0x0'));var util=require(_0x0b09('0x1'));var logger=require(_0x0b09('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0b09('0x3'));var fs=require('fs');var path=require(_0x0b09('0x4'));var rimraf=require(_0x0b09('0x5'));var config=require(_0x0b09('0x6'));var attributes=require(_0x0b09('0x7'));module[_0x0b09('0x8')]=function(_0xaa085a,_0x4ef365){return _0xaa085a[_0x0b09('0x9')](_0x0b09('0xa'),attributes,{'tableName':_0x0b09('0xb'),'paranoid':![],'indexes':[{'name':_0x0b09('0xc'),'fields':['idField',_0x0b09('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 a8f5119..5dbab2f 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 _0x0713=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x24fefe,_0x450323){var _0x4f8a8b=function(_0x435e7d){while(--_0x435e7d){_0x24fefe['push'](_0x24fefe['shift']());}};_0x4f8a8b(++_0x450323);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x268176,_0x20348e){var _0x233db8=function(_0x2cf259){while(--_0x2cf259){_0x268176['push'](_0x268176['shift']());}};_0x233db8(++_0x20348e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 4dc3d0b..0a7af2b 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(_0x532c83,_0x30a8f0){var _0x90058=function(_0x4092c5){while(--_0x4092c5){_0x532c83['push'](_0x532c83['shift']());}};_0x90058(++_0x30a8f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x308d0f,_0x124390){var _0x166585=function(_0x58ea9c){while(--_0x58ea9c){_0x308d0f['push'](_0x308d0f['shift']());}};_0x166585(++_0x124390);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 09b2c88..90dc1c9 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(_0x2e585e,_0x2e36ab){var _0x28adc0=function(_0x18de07){while(--_0x18de07){_0x2e585e['push'](_0x2e585e['shift']());}};_0x28adc0(++_0x2e36ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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(_0x51f2fd,_0x56d77a){var _0x553cc0=function(_0x4d24b0){while(--_0x4d24b0){_0x51f2fd['push'](_0x51f2fd['shift']());}};_0x553cc0(++_0x56d77a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 402bccf..045cfaf 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 _0x2c2a=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','stack','name','send','map','SugarcrmAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','includeAll','findAll','rows','catch','show','options','find','create','body','update','params','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','description','date_start','duration_hours','parent_name','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','Calls','values','module_fields','remove','includes','endsWith','value','error','test','Wrong\x20credentials','statusCode'];(function(_0x316fd3,_0x1b2723){var _0x185b28=function(_0x307dd9){while(--_0x307dd9){_0x316fd3['push'](_0x316fd3['shift']());}};_0x185b28(++_0x1b2723);}(_0x2c2a,0x73));var _0xa2c2=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x2c2a[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0xa2c2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa2c2('0x1'));var jsonpatch=require(_0xa2c2('0x2'));var rp=require(_0xa2c2('0x3'));var moment=require(_0xa2c2('0x4'));var BPromise=require(_0xa2c2('0x5'));var Mustache=require(_0xa2c2('0x6'));var util=require(_0xa2c2('0x7'));var path=require('path');var sox=require(_0xa2c2('0x8'));var csv=require(_0xa2c2('0x9'));var ejs=require(_0xa2c2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa2c2('0xb'));var squel=require(_0xa2c2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa2c2('0xd'));var toCsv=require(_0xa2c2('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa2c2('0xe'));var authService=require(_0xa2c2('0xf'));var qs=require(_0xa2c2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa2c2('0x11'));var logger=require(_0xa2c2('0x12'))('api');var utils=require(_0xa2c2('0x13'));var config=require(_0xa2c2('0x14'));var licenseUtil=require(_0xa2c2('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x31656b,_0x509bc7){_0x509bc7=_0x509bc7||0xcc;return function(_0x491f9a){if(_0x491f9a){return _0x31656b[_0xa2c2('0x16')](_0x509bc7);}return _0x31656b[_0xa2c2('0x17')](_0x509bc7)[_0xa2c2('0x18')]();};}function respondWithResult(_0x3dd8fa,_0x4d0d1a){_0x4d0d1a=_0x4d0d1a||0xc8;return function(_0x429867){if(_0x429867){return _0x3dd8fa[_0xa2c2('0x17')](_0x4d0d1a)['json'](_0x429867);}};}function respondWithFilteredResult(_0x2a5407,_0x5823ea){return function(_0x555776){if(_0x555776){var _0x31590c=typeof _0x5823ea[_0xa2c2('0x19')]===_0xa2c2('0x1a')&&typeof _0x5823ea[_0xa2c2('0x1b')]===_0xa2c2('0x1a');var _0x31dfc2=_0x555776[_0xa2c2('0x1c')];var _0x4c1cdd=_0x31590c?0x0:_0x5823ea[_0xa2c2('0x19')];var _0x54dea6=_0x31590c?_0x555776['count']:_0x5823ea[_0xa2c2('0x19')]+_0x5823ea['limit'];var _0x419f85;if(_0x54dea6>=_0x31dfc2){_0x54dea6=_0x31dfc2;_0x419f85=0xc8;}else{_0x419f85=0xce;}_0x2a5407['status'](_0x419f85);return _0x2a5407[_0xa2c2('0x1d')](_0xa2c2('0x1e'),_0x4c1cdd+'-'+_0x54dea6+'/'+_0x31dfc2)['json'](_0x555776);}return null;};}function patchUpdates(_0x5af61d){return function(_0x206c62){try{jsonpatch[_0xa2c2('0x1f')](_0x206c62,_0x5af61d,!![]);}catch(_0x420407){return BPromise['reject'](_0x420407);}return _0x206c62[_0xa2c2('0x20')]();};}function saveUpdates(_0x1bd9d2,_0x9717c0){return function(_0x248ebc){if(_0x248ebc){return _0x248ebc['update'](_0x1bd9d2)['then'](function(_0x2e3b08){return _0x2e3b08;});}return null;};}function removeEntity(_0x587f76,_0x3f22b9){return function(_0x1b2c04){if(_0x1b2c04){return _0x1b2c04[_0xa2c2('0x21')]()[_0xa2c2('0x22')](function(){_0x587f76[_0xa2c2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe74f63,_0x5211e6){return function(_0x168869){if(!_0x168869){_0xe74f63[_0xa2c2('0x16')](0x194);}return _0x168869;};}function handleError(_0x577f1c,_0x5e45e6){_0x5e45e6=_0x5e45e6||0x1f4;return function(_0x42d5b7){logger['error'](_0x42d5b7[_0xa2c2('0x23')]);if(_0x42d5b7[_0xa2c2('0x24')]){delete _0x42d5b7[_0xa2c2('0x24')];}_0x577f1c[_0xa2c2('0x17')](_0x5e45e6)[_0xa2c2('0x25')](_0x42d5b7);};}exports['index']=function(_0x4fdc51,_0x96d8b8){var _0x2ce9a4={},_0xa210ca={},_0x1f5eca={'count':0x0,'rows':[]};var _0x10291a=_[_0xa2c2('0x26')](db[_0xa2c2('0x27')][_0xa2c2('0x28')],function(_0x3a5501){return{'name':_0x3a5501[_0xa2c2('0x29')],'type':_0x3a5501['type'][_0xa2c2('0x2a')]};});_0xa210ca['model']=_[_0xa2c2('0x26')](_0x10291a,_0xa2c2('0x24'));_0xa210ca[_0xa2c2('0x2b')]=_[_0xa2c2('0x2c')](_0x4fdc51[_0xa2c2('0x2b')]);_0xa210ca[_0xa2c2('0x2d')]=_[_0xa2c2('0x2e')](_0xa210ca[_0xa2c2('0x2f')],_0xa210ca[_0xa2c2('0x2b')]);_0x2ce9a4[_0xa2c2('0x30')]=_[_0xa2c2('0x2e')](_0xa210ca[_0xa2c2('0x2f')],qs[_0xa2c2('0x31')](_0x4fdc51[_0xa2c2('0x2b')][_0xa2c2('0x31')]));_0x2ce9a4[_0xa2c2('0x30')]=_0x2ce9a4[_0xa2c2('0x30')][_0xa2c2('0x32')]?_0x2ce9a4[_0xa2c2('0x30')]:_0xa210ca['model'];if(!_0x4fdc51[_0xa2c2('0x2b')][_0xa2c2('0x33')](_0xa2c2('0x34'))){_0x2ce9a4[_0xa2c2('0x1b')]=qs['limit'](_0x4fdc51[_0xa2c2('0x2b')][_0xa2c2('0x1b')]);_0x2ce9a4['offset']=qs[_0xa2c2('0x19')](_0x4fdc51['query'][_0xa2c2('0x19')]);}_0x2ce9a4[_0xa2c2('0x35')]=qs[_0xa2c2('0x36')](_0x4fdc51[_0xa2c2('0x2b')][_0xa2c2('0x36')]);_0x2ce9a4['where']=qs[_0xa2c2('0x2d')](_[_0xa2c2('0x37')](_0x4fdc51['query'],_0xa210ca['filters']),_0x10291a);if(_0x4fdc51[_0xa2c2('0x2b')][_0xa2c2('0x38')]){_0x2ce9a4['where']=_[_0xa2c2('0x39')](_0x2ce9a4[_0xa2c2('0x3a')],{'$or':_['map'](_0x10291a,function(_0x264f73){if(_0x264f73[_0xa2c2('0x3b')]!=='VIRTUAL'){var _0x1b2830={};_0x1b2830[_0x264f73['name']]={'$like':'%'+_0x4fdc51['query'][_0xa2c2('0x38')]+'%'};return _0x1b2830;}})});}_0x2ce9a4=_[_0xa2c2('0x39')]({},_0x2ce9a4,_0x4fdc51['options']);var _0x39d4d4={'where':_0x2ce9a4[_0xa2c2('0x3a')]};return db['SugarcrmAccount'][_0xa2c2('0x1c')](_0x39d4d4)[_0xa2c2('0x22')](function(_0x859709){_0x1f5eca[_0xa2c2('0x1c')]=_0x859709;if(_0x4fdc51[_0xa2c2('0x2b')][_0xa2c2('0x3c')]){_0x2ce9a4['include']=[{'all':!![]}];}return db[_0xa2c2('0x27')][_0xa2c2('0x3d')](_0x2ce9a4);})[_0xa2c2('0x22')](function(_0x13d4d1){_0x1f5eca[_0xa2c2('0x3e')]=_0x13d4d1;return _0x1f5eca;})['then'](respondWithFilteredResult(_0x96d8b8,_0x2ce9a4))[_0xa2c2('0x3f')](handleError(_0x96d8b8,null));};exports[_0xa2c2('0x40')]=function(_0x589395,_0xa91162){var _0x26155a={'raw':![],'where':{'id':_0x589395['params']['id']}},_0x45552d={};_0x45552d['model']=_[_0xa2c2('0x2c')](db[_0xa2c2('0x27')][_0xa2c2('0x28')]);_0x45552d['query']=_[_0xa2c2('0x2c')](_0x589395[_0xa2c2('0x2b')]);_0x45552d[_0xa2c2('0x2d')]=_['intersection'](_0x45552d[_0xa2c2('0x2f')],_0x45552d[_0xa2c2('0x2b')]);_0x26155a[_0xa2c2('0x30')]=_[_0xa2c2('0x2e')](_0x45552d[_0xa2c2('0x2f')],qs[_0xa2c2('0x31')](_0x589395[_0xa2c2('0x2b')][_0xa2c2('0x31')]));_0x26155a[_0xa2c2('0x30')]=_0x26155a[_0xa2c2('0x30')][_0xa2c2('0x32')]?_0x26155a[_0xa2c2('0x30')]:_0x45552d[_0xa2c2('0x2f')];if(_0x589395[_0xa2c2('0x2b')][_0xa2c2('0x3c')]){_0x26155a['include']=[{'all':!![]}];}_0x26155a=_[_0xa2c2('0x39')]({},_0x26155a,_0x589395[_0xa2c2('0x41')]);return db['SugarcrmAccount'][_0xa2c2('0x42')](_0x26155a)[_0xa2c2('0x22')](handleEntityNotFound(_0xa91162,null))['then'](respondWithResult(_0xa91162,null))['catch'](handleError(_0xa91162,null));};exports[_0xa2c2('0x43')]=function(_0xce424,_0x4c6c9e){return db[_0xa2c2('0x27')][_0xa2c2('0x43')](_0xce424[_0xa2c2('0x44')],{})['then'](respondWithResult(_0x4c6c9e,0xc9))[_0xa2c2('0x3f')](handleError(_0x4c6c9e,null));};exports[_0xa2c2('0x45')]=function(_0x4e9091,_0x4732a0){if(_0x4e9091[_0xa2c2('0x44')]['id']){delete _0x4e9091[_0xa2c2('0x44')]['id'];}return db['SugarcrmAccount'][_0xa2c2('0x42')]({'where':{'id':_0x4e9091[_0xa2c2('0x46')]['id']}})[_0xa2c2('0x22')](handleEntityNotFound(_0x4732a0,null))[_0xa2c2('0x22')](saveUpdates(_0x4e9091['body'],null))[_0xa2c2('0x22')](respondWithResult(_0x4732a0,null))[_0xa2c2('0x3f')](handleError(_0x4732a0,null));};exports['destroy']=function(_0x429adf,_0x5bd5e9){return db[_0xa2c2('0x27')][_0xa2c2('0x42')]({'where':{'id':_0x429adf[_0xa2c2('0x46')]['id']}})['then'](handleEntityNotFound(_0x5bd5e9,null))[_0xa2c2('0x22')](removeEntity(_0x5bd5e9,null))[_0xa2c2('0x3f')](handleError(_0x5bd5e9,null));};exports[_0xa2c2('0x47')]=function(_0x422121,_0x15a737,_0x5d1170){var _0x626210={};var _0x707547={};var _0x10e648;var _0x7ddb93;return db['SugarcrmAccount'][_0xa2c2('0x48')]({'where':{'id':_0x422121['params']['id']}})[_0xa2c2('0x22')](handleEntityNotFound(_0x15a737,null))[_0xa2c2('0x22')](function(_0x3717e3){if(_0x3717e3){_0x10e648=_0x3717e3;_0x707547[_0xa2c2('0x2f')]=_['keys'](db[_0xa2c2('0x49')][_0xa2c2('0x28')]);_0x707547[_0xa2c2('0x2b')]=_[_0xa2c2('0x2c')](_0x422121[_0xa2c2('0x2b')]);_0x707547[_0xa2c2('0x2d')]=_[_0xa2c2('0x2e')](_0x707547[_0xa2c2('0x2f')],_0x707547[_0xa2c2('0x2b')]);_0x626210[_0xa2c2('0x30')]=_[_0xa2c2('0x2e')](_0x707547['model'],qs[_0xa2c2('0x31')](_0x422121[_0xa2c2('0x2b')][_0xa2c2('0x31')]));_0x626210[_0xa2c2('0x30')]=_0x626210['attributes']['length']?_0x626210['attributes']:_0x707547[_0xa2c2('0x2f')];_0x626210['order']=qs[_0xa2c2('0x36')](_0x422121[_0xa2c2('0x2b')]['sort']);_0x626210[_0xa2c2('0x3a')]=qs[_0xa2c2('0x2d')](_[_0xa2c2('0x37')](_0x422121[_0xa2c2('0x2b')],_0x707547[_0xa2c2('0x2d')]));if(_0x422121[_0xa2c2('0x2b')][_0xa2c2('0x38')]){_0x626210[_0xa2c2('0x3a')]=_[_0xa2c2('0x39')](_0x626210[_0xa2c2('0x3a')],{'$or':_[_0xa2c2('0x26')](_0x626210['attributes'],function(_0x4fa9db){var _0x393689={};_0x393689[_0x4fa9db]={'$like':'%'+_0x422121['query']['filter']+'%'};return _0x393689;})});}_0x626210=_[_0xa2c2('0x39')]({},_0x626210,_0x422121['options']);return _0x10e648['getConfigurations'](_0x626210);}})[_0xa2c2('0x22')](function(_0x2fc95e){if(_0x2fc95e){_0x7ddb93=_0x2fc95e[_0xa2c2('0x32')];if(!_0x422121[_0xa2c2('0x2b')]['hasOwnProperty']('nolimit')){_0x626210[_0xa2c2('0x1b')]=qs[_0xa2c2('0x1b')](_0x422121['query'][_0xa2c2('0x1b')]);_0x626210[_0xa2c2('0x19')]=qs['offset'](_0x422121[_0xa2c2('0x2b')][_0xa2c2('0x19')]);}return _0x10e648[_0xa2c2('0x47')](_0x626210);}})[_0xa2c2('0x22')](function(_0x4a2dfb){if(_0x4a2dfb){return _0x4a2dfb?{'count':_0x7ddb93,'rows':_0x4a2dfb}:null;}})[_0xa2c2('0x22')](respondWithResult(_0x15a737,null))[_0xa2c2('0x3f')](handleError(_0x15a737,null));};exports[_0xa2c2('0x4a')]=function(_0x3ae437,_0x1de254,_0x456b73){if(_0x3ae437['body']['id']){delete _0x3ae437[_0xa2c2('0x44')]['id'];}return db[_0xa2c2('0x27')]['findOne']({'where':{'id':_0x3ae437[_0xa2c2('0x46')]['id']}})[_0xa2c2('0x22')](handleEntityNotFound(_0x1de254,null))[_0xa2c2('0x22')](function(_0xb26ce1){if(_0xb26ce1){_0x3ae437[_0xa2c2('0x44')][_0xa2c2('0x4b')]=_0xb26ce1['id'];_0x3ae437[_0xa2c2('0x44')][_0xa2c2('0x4c')]=integrations[_0xa2c2('0x4d')](_0x3ae437['body'][_0xa2c2('0x4e')],_0x3ae437['body'][_0xa2c2('0x3b')]);_0x3ae437[_0xa2c2('0x44')]['Descriptions']=integrations[_0xa2c2('0x4f')](_0x3ae437['body'][_0xa2c2('0x4e')],_0x3ae437[_0xa2c2('0x44')][_0xa2c2('0x3b')]);return db['SugarcrmConfiguration'][_0xa2c2('0x43')](_0x3ae437[_0xa2c2('0x44')],{'include':[{'model':db[_0xa2c2('0x50')],'as':_0xa2c2('0x4c')},{'model':db[_0xa2c2('0x50')],'as':_0xa2c2('0x51')}]});}return null;})[_0xa2c2('0x22')](respondWithResult(_0x1de254,null))['catch'](handleError(_0x1de254,null));};exports[_0xa2c2('0x52')]=function(_0x421d74,_0xd5d9c4,_0x4cef6a){var _0x223801='';var _0x56e89c=['id',_0xa2c2('0x24'),_0xa2c2('0x53'),'created_by',_0xa2c2('0x54'),_0xa2c2('0x55'),_0xa2c2('0x56'),'duration_minutes','parent_id','parent_type',_0xa2c2('0x57'),'direction'];return db[_0xa2c2('0x27')]['findOne']({'where':{'id':_0x421d74[_0xa2c2('0x46')]['id']},'attributes':['id',_0xa2c2('0x58'),_0xa2c2('0x59'),_0xa2c2('0x5a')]})['then'](handleEntityNotFound(_0xd5d9c4,null))[_0xa2c2('0x22')](function(_0x110b29){if(_0x110b29){_0x223801=_0x110b29[_0xa2c2('0x5a')];var _0x1ca098=_0x223801[_0xa2c2('0x5b')](-0x1);if(_0x1ca098==='/'){_0x223801=_0x223801[_0xa2c2('0x5c')](0x0,_0x223801[_0xa2c2('0x5d')](_0x1ca098));}return rp({'method':_0xa2c2('0x5e'),'uri':util[_0xa2c2('0x5f')](_0xa2c2('0x60'),_0x223801,_0xa2c2('0x61')),'json':!![],'form':{'method':_0xa2c2('0x62'),'input_type':_0xa2c2('0x63'),'response_type':_0xa2c2('0x63'),'rest_data':JSON[_0xa2c2('0x64')]({'user_auth':{'user_name':_0x110b29[_0xa2c2('0x58')],'password':_0x110b29['password'],'encryption':_0xa2c2('0x65')},'application':_0xa2c2('0x66')})}});}})[_0xa2c2('0x22')](function(_0x448a40){if(_0x448a40&&_0x448a40[_0xa2c2('0x24')]!=='Invalid\x20Login'&&_0x448a40['name']!==_0xa2c2('0x67')){return rp({'method':'POST','uri':util[_0xa2c2('0x5f')](_0xa2c2('0x60'),_0x223801,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0xa2c2('0x63'),'rest_data':JSON[_0xa2c2('0x64')]({'session':_0x448a40['id'],'module_name':_0xa2c2('0x68')})}})[_0xa2c2('0x22')](function(_0x4bfff9){if(_0x4bfff9){var _0x334415=_[_0xa2c2('0x69')](_0x4bfff9[_0xa2c2('0x6a')]);_[_0xa2c2('0x6b')](_0x334415,function(_0x18f212){return _0x56e89c[_0xa2c2('0x6c')](_0x18f212['name']);});return{'count':_0x334415[_0xa2c2('0x32')],'rows':_['map'](_0x334415,function(_0x3b2999){return{'id':_0x3b2999[_0xa2c2('0x24')],'name':_0x3b2999['label'],'custom':_[_0xa2c2('0x6d')](_0x3b2999['name'],'_c')?!![]:![],'options':_0x3b2999['options']?_[_0xa2c2('0x26')](_[_0xa2c2('0x69')](_0x3b2999[_0xa2c2('0x41')]),function(_0x3ee2a5){return{'name':_0x3ee2a5[_0xa2c2('0x6e')],'value':_0x3ee2a5['name']};}):[]};})};}})[_0xa2c2('0x22')](respondWithResult(_0xd5d9c4,null))['catch'](function(_0x30d8da){var _0x5117e1=_0x421d74[_0xa2c2('0x2b')]['test']?0x1f4:_0x30d8da['statusCode']||0x1f4;logger[_0xa2c2('0x6f')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5117e1,JSON[_0xa2c2('0x64')](_0x30d8da));delete _0x30d8da[_0xa2c2('0x24')];if(_0x5117e1===0x191){_0x5117e1=0x190;}_0xd5d9c4['status'](_0x5117e1)[_0xa2c2('0x25')](_0x421d74['query'][_0xa2c2('0x70')]?{'message':_0xa2c2('0x71'),'statusCode':_0x30d8da[_0xa2c2('0x72')]}:_0x30d8da);});}else{var _0x1f26ee=0x1f4;_0xd5d9c4[_0xa2c2('0x17')](_0x1f26ee)[_0xa2c2('0x25')]({'message':_0xa2c2('0x71'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x6759=['addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmConfiguration','SugarcrmField','getFields','created_by','description','date_start','duration_hours','duration_minutes','parent_type','direction','findOne','username','password','remoteUri','slice','substring','format','%s%s','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','/service/v4_1/rest.php','get_module_fields','values','module_fields','remove','includes','label','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','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','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','end','json','offset','limit','undefined','count','status','set','reject','save','then','sendStatus','error','stack','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','getConfigurations'];(function(_0x41b807,_0x35fcda){var _0xc88ec0=function(_0x1c3833){while(--_0x1c3833){_0x41b807['push'](_0x41b807['shift']());}};_0xc88ec0(++_0x35fcda);}(_0x6759,0x197));var _0x9675=function(_0x3e5325,_0x55af33){_0x3e5325=_0x3e5325-0x0;var _0x5a1c63=_0x6759[_0x3e5325];return _0x5a1c63;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9675('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9675('0x1'));var rp=require(_0x9675('0x2'));var moment=require(_0x9675('0x3'));var BPromise=require(_0x9675('0x4'));var Mustache=require(_0x9675('0x5'));var util=require(_0x9675('0x6'));var path=require(_0x9675('0x7'));var sox=require(_0x9675('0x8'));var csv=require(_0x9675('0x9'));var ejs=require(_0x9675('0xa'));var fs=require('fs');var fs_extra=require(_0x9675('0xb'));var _=require(_0x9675('0xc'));var squel=require('squel');var crypto=require(_0x9675('0xd'));var jsforce=require(_0x9675('0xe'));var deskjs=require(_0x9675('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9675('0x10'));var Papa=require(_0x9675('0x11'));var Redis=require(_0x9675('0x12'));var authService=require(_0x9675('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9675('0x14'));var hardwareService=require(_0x9675('0x15'));var logger=require(_0x9675('0x16'))(_0x9675('0x17'));var utils=require(_0x9675('0x18'));var config=require(_0x9675('0x19'));var licenseUtil=require(_0x9675('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9675('0x1b'));function respondWithStatusCode(_0x2779de,_0x3576a3){_0x3576a3=_0x3576a3||0xcc;return function(_0x4d7a91){if(_0x4d7a91){return _0x2779de['sendStatus'](_0x3576a3);}return _0x2779de['status'](_0x3576a3)[_0x9675('0x1c')]();};}function respondWithResult(_0x151bf3,_0x5c2d5f){_0x5c2d5f=_0x5c2d5f||0xc8;return function(_0x49a955){if(_0x49a955){return _0x151bf3['status'](_0x5c2d5f)[_0x9675('0x1d')](_0x49a955);}};}function respondWithFilteredResult(_0x5d97b5,_0x304803){return function(_0x5161f5){if(_0x5161f5){var _0xa0aa9=typeof _0x304803[_0x9675('0x1e')]==='undefined'&&typeof _0x304803[_0x9675('0x1f')]===_0x9675('0x20');var _0x33f6fe=_0x5161f5['count'];var _0x2883e8=_0xa0aa9?0x0:_0x304803[_0x9675('0x1e')];var _0x26ee4f=_0xa0aa9?_0x5161f5[_0x9675('0x21')]:_0x304803['offset']+_0x304803[_0x9675('0x1f')];var _0x1df7f;if(_0x26ee4f>=_0x33f6fe){_0x26ee4f=_0x33f6fe;_0x1df7f=0xc8;}else{_0x1df7f=0xce;}_0x5d97b5[_0x9675('0x22')](_0x1df7f);return _0x5d97b5[_0x9675('0x23')]('Content-Range',_0x2883e8+'-'+_0x26ee4f+'/'+_0x33f6fe)[_0x9675('0x1d')](_0x5161f5);}return null;};}function patchUpdates(_0x29a0bc){return function(_0xbe2521){try{jsonpatch['apply'](_0xbe2521,_0x29a0bc,!![]);}catch(_0x37ea31){return BPromise[_0x9675('0x24')](_0x37ea31);}return _0xbe2521[_0x9675('0x25')]();};}function saveUpdates(_0x133b57,_0x120d28){return function(_0x2a1c50){if(_0x2a1c50){return _0x2a1c50['update'](_0x133b57)[_0x9675('0x26')](function(_0x7b85f7){return _0x7b85f7;});}return null;};}function removeEntity(_0x15cafd,_0x4b0144){return function(_0x121db5){if(_0x121db5){return _0x121db5['destroy']()[_0x9675('0x26')](function(){_0x15cafd[_0x9675('0x22')](0xcc)[_0x9675('0x1c')]();});}};}function handleEntityNotFound(_0x1c7f6b,_0x2819d6){return function(_0x1e9e30){if(!_0x1e9e30){_0x1c7f6b[_0x9675('0x27')](0x194);}return _0x1e9e30;};}function handleError(_0xe6d61,_0x1fc047){_0x1fc047=_0x1fc047||0x1f4;return function(_0x1546f8){logger[_0x9675('0x28')](_0x1546f8[_0x9675('0x29')]);if(_0x1546f8['name']){delete _0x1546f8['name'];}_0xe6d61[_0x9675('0x22')](_0x1fc047)[_0x9675('0x2a')](_0x1546f8);};}exports[_0x9675('0x2b')]=function(_0x56a770,_0x862210){var _0x2b6fee={},_0x162bf0={},_0x5f1bdf={'count':0x0,'rows':[]};var _0x85a734=_[_0x9675('0x2c')](db[_0x9675('0x2d')][_0x9675('0x2e')],function(_0x180081){return{'name':_0x180081[_0x9675('0x2f')],'type':_0x180081[_0x9675('0x30')]['key']};});_0x162bf0[_0x9675('0x31')]=_[_0x9675('0x2c')](_0x85a734,_0x9675('0x32'));_0x162bf0['query']=_[_0x9675('0x33')](_0x56a770[_0x9675('0x34')]);_0x162bf0[_0x9675('0x35')]=_[_0x9675('0x36')](_0x162bf0[_0x9675('0x31')],_0x162bf0[_0x9675('0x34')]);_0x2b6fee['attributes']=_['intersection'](_0x162bf0[_0x9675('0x31')],qs[_0x9675('0x37')](_0x56a770[_0x9675('0x34')]['fields']));_0x2b6fee[_0x9675('0x38')]=_0x2b6fee[_0x9675('0x38')]['length']?_0x2b6fee[_0x9675('0x38')]:_0x162bf0[_0x9675('0x31')];if(!_0x56a770[_0x9675('0x34')][_0x9675('0x39')](_0x9675('0x3a'))){_0x2b6fee[_0x9675('0x1f')]=qs[_0x9675('0x1f')](_0x56a770['query'][_0x9675('0x1f')]);_0x2b6fee[_0x9675('0x1e')]=qs[_0x9675('0x1e')](_0x56a770[_0x9675('0x34')]['offset']);}_0x2b6fee['order']=qs['sort'](_0x56a770[_0x9675('0x34')][_0x9675('0x3b')]);_0x2b6fee[_0x9675('0x3c')]=qs['filters'](_[_0x9675('0x3d')](_0x56a770[_0x9675('0x34')],_0x162bf0[_0x9675('0x35')]),_0x85a734);if(_0x56a770[_0x9675('0x34')][_0x9675('0x3e')]){_0x2b6fee[_0x9675('0x3c')]=_[_0x9675('0x3f')](_0x2b6fee[_0x9675('0x3c')],{'$or':_[_0x9675('0x2c')](_0x85a734,function(_0x1f2679){if(_0x1f2679[_0x9675('0x30')]!=='VIRTUAL'){var _0xe62a1b={};_0xe62a1b[_0x1f2679['name']]={'$like':'%'+_0x56a770[_0x9675('0x34')][_0x9675('0x3e')]+'%'};return _0xe62a1b;}})});}_0x2b6fee=_[_0x9675('0x3f')]({},_0x2b6fee,_0x56a770[_0x9675('0x40')]);var _0x41c345={'where':_0x2b6fee[_0x9675('0x3c')]};return db[_0x9675('0x2d')][_0x9675('0x21')](_0x41c345)[_0x9675('0x26')](function(_0x2dd742){_0x5f1bdf[_0x9675('0x21')]=_0x2dd742;if(_0x56a770['query'][_0x9675('0x41')]){_0x2b6fee[_0x9675('0x42')]=[{'all':!![]}];}return db[_0x9675('0x2d')][_0x9675('0x43')](_0x2b6fee);})['then'](function(_0x2be6cf){_0x5f1bdf[_0x9675('0x44')]=_0x2be6cf;return _0x5f1bdf;})[_0x9675('0x26')](respondWithFilteredResult(_0x862210,_0x2b6fee))[_0x9675('0x45')](handleError(_0x862210,null));};exports[_0x9675('0x46')]=function(_0x10f6e7,_0x4db620){var _0x262187={'raw':![],'where':{'id':_0x10f6e7['params']['id']}},_0x160c9f={};_0x160c9f[_0x9675('0x31')]=_[_0x9675('0x33')](db['SugarcrmAccount'][_0x9675('0x2e')]);_0x160c9f[_0x9675('0x34')]=_[_0x9675('0x33')](_0x10f6e7['query']);_0x160c9f[_0x9675('0x35')]=_[_0x9675('0x36')](_0x160c9f[_0x9675('0x31')],_0x160c9f[_0x9675('0x34')]);_0x262187['attributes']=_[_0x9675('0x36')](_0x160c9f[_0x9675('0x31')],qs[_0x9675('0x37')](_0x10f6e7[_0x9675('0x34')][_0x9675('0x37')]));_0x262187[_0x9675('0x38')]=_0x262187[_0x9675('0x38')][_0x9675('0x47')]?_0x262187[_0x9675('0x38')]:_0x160c9f[_0x9675('0x31')];if(_0x10f6e7[_0x9675('0x34')][_0x9675('0x41')]){_0x262187[_0x9675('0x42')]=[{'all':!![]}];}_0x262187=_['merge']({},_0x262187,_0x10f6e7['options']);return db['SugarcrmAccount'][_0x9675('0x48')](_0x262187)[_0x9675('0x26')](handleEntityNotFound(_0x4db620,null))[_0x9675('0x26')](respondWithResult(_0x4db620,null))[_0x9675('0x45')](handleError(_0x4db620,null));};exports[_0x9675('0x49')]=function(_0xbdf865,_0x1fdd0c){return db['SugarcrmAccount']['create'](_0xbdf865[_0x9675('0x4a')],{})[_0x9675('0x26')](respondWithResult(_0x1fdd0c,0xc9))[_0x9675('0x45')](handleError(_0x1fdd0c,null));};exports['update']=function(_0x4c8baf,_0x9680b){if(_0x4c8baf[_0x9675('0x4a')]['id']){delete _0x4c8baf[_0x9675('0x4a')]['id'];}return db['SugarcrmAccount'][_0x9675('0x48')]({'where':{'id':_0x4c8baf[_0x9675('0x4b')]['id']}})[_0x9675('0x26')](handleEntityNotFound(_0x9680b,null))['then'](saveUpdates(_0x4c8baf[_0x9675('0x4a')],null))['then'](respondWithResult(_0x9680b,null))[_0x9675('0x45')](handleError(_0x9680b,null));};exports['destroy']=function(_0x132d74,_0x3c6b75){return db[_0x9675('0x2d')]['find']({'where':{'id':_0x132d74[_0x9675('0x4b')]['id']}})[_0x9675('0x26')](handleEntityNotFound(_0x3c6b75,null))[_0x9675('0x26')](removeEntity(_0x3c6b75,null))[_0x9675('0x45')](handleError(_0x3c6b75,null));};exports[_0x9675('0x4c')]=function(_0x4c54b4,_0x4a690b,_0x48dd6d){var _0x963e19={};var _0x3f7477={};var _0x33f48b;var _0x298a99;return db[_0x9675('0x2d')]['findOne']({'where':{'id':_0x4c54b4[_0x9675('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4a690b,null))[_0x9675('0x26')](function(_0x430aff){if(_0x430aff){_0x33f48b=_0x430aff;_0x3f7477['model']=_[_0x9675('0x33')](db['SugarcrmConfiguration']['rawAttributes']);_0x3f7477['query']=_[_0x9675('0x33')](_0x4c54b4[_0x9675('0x34')]);_0x3f7477[_0x9675('0x35')]=_[_0x9675('0x36')](_0x3f7477[_0x9675('0x31')],_0x3f7477[_0x9675('0x34')]);_0x963e19['attributes']=_[_0x9675('0x36')](_0x3f7477[_0x9675('0x31')],qs[_0x9675('0x37')](_0x4c54b4['query'][_0x9675('0x37')]));_0x963e19[_0x9675('0x38')]=_0x963e19[_0x9675('0x38')][_0x9675('0x47')]?_0x963e19[_0x9675('0x38')]:_0x3f7477[_0x9675('0x31')];_0x963e19['order']=qs[_0x9675('0x3b')](_0x4c54b4[_0x9675('0x34')][_0x9675('0x3b')]);_0x963e19[_0x9675('0x3c')]=qs[_0x9675('0x35')](_['pick'](_0x4c54b4[_0x9675('0x34')],_0x3f7477['filters']));if(_0x4c54b4[_0x9675('0x34')][_0x9675('0x3e')]){_0x963e19[_0x9675('0x3c')]=_[_0x9675('0x3f')](_0x963e19[_0x9675('0x3c')],{'$or':_[_0x9675('0x2c')](_0x963e19[_0x9675('0x38')],function(_0x2efb36){var _0x558294={};_0x558294[_0x2efb36]={'$like':'%'+_0x4c54b4[_0x9675('0x34')][_0x9675('0x3e')]+'%'};return _0x558294;})});}_0x963e19=_[_0x9675('0x3f')]({},_0x963e19,_0x4c54b4[_0x9675('0x40')]);return _0x33f48b[_0x9675('0x4c')](_0x963e19);}})[_0x9675('0x26')](function(_0x25a159){if(_0x25a159){_0x298a99=_0x25a159[_0x9675('0x47')];if(!_0x4c54b4[_0x9675('0x34')][_0x9675('0x39')](_0x9675('0x3a'))){_0x963e19[_0x9675('0x1f')]=qs['limit'](_0x4c54b4[_0x9675('0x34')]['limit']);_0x963e19[_0x9675('0x1e')]=qs[_0x9675('0x1e')](_0x4c54b4[_0x9675('0x34')][_0x9675('0x1e')]);}return _0x33f48b[_0x9675('0x4c')](_0x963e19);}})[_0x9675('0x26')](function(_0x7296d0){if(_0x7296d0){return _0x7296d0?{'count':_0x298a99,'rows':_0x7296d0}:null;}})['then'](respondWithResult(_0x4a690b,null))[_0x9675('0x45')](handleError(_0x4a690b,null));};exports[_0x9675('0x4d')]=function(_0x3d39f9,_0x42f361,_0xe14a10){if(_0x3d39f9[_0x9675('0x4a')]['id']){delete _0x3d39f9[_0x9675('0x4a')]['id'];}return db[_0x9675('0x2d')]['findOne']({'where':{'id':_0x3d39f9[_0x9675('0x4b')]['id']}})['then'](handleEntityNotFound(_0x42f361,null))['then'](function(_0x273243){if(_0x273243){_0x3d39f9['body'][_0x9675('0x4e')]=_0x273243['id'];_0x3d39f9[_0x9675('0x4a')][_0x9675('0x4f')]=integrations[_0x9675('0x50')](_0x3d39f9['body']['channel'],_0x3d39f9[_0x9675('0x4a')]['type']);_0x3d39f9['body'][_0x9675('0x51')]=integrations[_0x9675('0x52')](_0x3d39f9[_0x9675('0x4a')][_0x9675('0x53')],_0x3d39f9[_0x9675('0x4a')][_0x9675('0x30')]);return db[_0x9675('0x54')][_0x9675('0x49')](_0x3d39f9[_0x9675('0x4a')],{'include':[{'model':db['SugarcrmField'],'as':_0x9675('0x4f')},{'model':db[_0x9675('0x55')],'as':_0x9675('0x51')}]});}return null;})['then'](respondWithResult(_0x42f361,null))[_0x9675('0x45')](handleError(_0x42f361,null));};exports[_0x9675('0x56')]=function(_0x23f678,_0x13ed42,_0x4c9926){var _0x4c9df7='';var _0x5f4875=['id',_0x9675('0x32'),'assigned_user_id',_0x9675('0x57'),_0x9675('0x58'),_0x9675('0x59'),_0x9675('0x5a'),_0x9675('0x5b'),'parent_id',_0x9675('0x5c'),'parent_name',_0x9675('0x5d')];return db[_0x9675('0x2d')][_0x9675('0x5e')]({'where':{'id':_0x23f678[_0x9675('0x4b')]['id']},'attributes':['id',_0x9675('0x5f'),_0x9675('0x60'),_0x9675('0x61')]})[_0x9675('0x26')](handleEntityNotFound(_0x13ed42,null))[_0x9675('0x26')](function(_0x57b437){if(_0x57b437){_0x4c9df7=_0x57b437[_0x9675('0x61')];var _0x1f4099=_0x4c9df7[_0x9675('0x62')](-0x1);if(_0x1f4099==='/'){_0x4c9df7=_0x4c9df7[_0x9675('0x63')](0x0,_0x4c9df7['lastIndexOf'](_0x1f4099));}return rp({'method':'POST','uri':util[_0x9675('0x64')](_0x9675('0x65'),_0x4c9df7,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0x9675('0x66'),'response_type':_0x9675('0x66'),'rest_data':JSON[_0x9675('0x67')]({'user_auth':{'user_name':_0x57b437[_0x9675('0x5f')],'password':_0x57b437[_0x9675('0x60')],'encryption':_0x9675('0x68')},'application':_0x9675('0x69')})}});}})[_0x9675('0x26')](function(_0x444fb2){if(_0x444fb2&&_0x444fb2[_0x9675('0x32')]!==_0x9675('0x6a')&&_0x444fb2[_0x9675('0x32')]!==_0x9675('0x6b')){return rp({'method':_0x9675('0x6c'),'uri':util[_0x9675('0x64')](_0x9675('0x65'),_0x4c9df7,_0x9675('0x6d')),'json':!![],'form':{'method':_0x9675('0x6e'),'input_type':_0x9675('0x66'),'response_type':_0x9675('0x66'),'rest_data':JSON[_0x9675('0x67')]({'session':_0x444fb2['id'],'module_name':'Calls'})}})[_0x9675('0x26')](function(_0x2a836c){if(_0x2a836c){var _0x238d8f=_[_0x9675('0x6f')](_0x2a836c[_0x9675('0x70')]);_[_0x9675('0x71')](_0x238d8f,function(_0x4fb5c1){return _0x5f4875[_0x9675('0x72')](_0x4fb5c1[_0x9675('0x32')]);});return{'count':_0x238d8f[_0x9675('0x47')],'rows':_[_0x9675('0x2c')](_0x238d8f,function(_0x5909d0){return{'id':_0x5909d0[_0x9675('0x32')],'name':_0x5909d0[_0x9675('0x73')],'custom':_[_0x9675('0x74')](_0x5909d0['name'],'_c')?!![]:![],'options':_0x5909d0[_0x9675('0x40')]?_[_0x9675('0x2c')](_[_0x9675('0x6f')](_0x5909d0[_0x9675('0x40')]),function(_0xc3fe28){return{'name':_0xc3fe28['value'],'value':_0xc3fe28['name']};}):[]};})};}})[_0x9675('0x26')](respondWithResult(_0x13ed42,null))[_0x9675('0x45')](function(_0x2df869){var _0x60345b=_0x23f678[_0x9675('0x34')][_0x9675('0x75')]?0x1f4:_0x2df869[_0x9675('0x76')]||0x1f4;logger[_0x9675('0x28')](_0x9675('0x77'),_0x9675('0x56'),_0x60345b,JSON[_0x9675('0x67')](_0x2df869));delete _0x2df869[_0x9675('0x32')];if(_0x60345b===0x191){_0x60345b=0x190;}_0x13ed42[_0x9675('0x22')](_0x60345b)[_0x9675('0x2a')](_0x23f678[_0x9675('0x34')][_0x9675('0x75')]?{'message':_0x9675('0x78'),'statusCode':_0x2df869[_0x9675('0x76')]}:_0x2df869);});}else{var _0x101ecc=0x1f4;_0x13ed42['status'](_0x101ecc)[_0x9675('0x2a')]({'message':_0x9675('0x78'),'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 45e2a11..7ca9eb1 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 _0x5323=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x495c53,_0x5dd58b){var _0x20abe0=function(_0x29db0f){while(--_0x29db0f){_0x495c53['push'](_0x495c53['shift']());}};_0x20abe0(++_0x5dd58b);}(_0x5323,0x88));var _0x3532=function(_0x3d32db,_0xff9997){_0x3d32db=_0x3d32db-0x0;var _0x699f06=_0x5323[_0x3d32db];return _0x699f06;};'use strict';var _=require(_0x3532('0x0'));var util=require(_0x3532('0x1'));var logger=require(_0x3532('0x2'))(_0x3532('0x3'));var moment=require(_0x3532('0x4'));var BPromise=require('bluebird');var rp=require(_0x3532('0x5'));var fs=require('fs');var path=require(_0x3532('0x6'));var rimraf=require(_0x3532('0x7'));var config=require('../../config/environment');var attributes=require(_0x3532('0x8'));var integrations=require(_0x3532('0x9'));module[_0x3532('0xa')]=function(_0x4814de,_0x3f7668){return _0x4814de['define'](_0x3532('0xb'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1267=['int_sugarcrm_accounts','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','define'];(function(_0x2e50f1,_0x4b3469){var _0x42ac15=function(_0x32c440){while(--_0x32c440){_0x2e50f1['push'](_0x2e50f1['shift']());}};_0x42ac15(++_0x4b3469);}(_0x1267,0xb5));var _0x7126=function(_0x18c428,_0x17f370){_0x18c428=_0x18c428-0x0;var _0x62fb76=_0x1267[_0x18c428];return _0x62fb76;};'use strict';var _=require(_0x7126('0x0'));var util=require(_0x7126('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7126('0x2'));var BPromise=require(_0x7126('0x3'));var rp=require(_0x7126('0x4'));var fs=require('fs');var path=require(_0x7126('0x5'));var rimraf=require(_0x7126('0x6'));var config=require(_0x7126('0x7'));var attributes=require(_0x7126('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x7126('0x9')]=function(_0x3fe051,_0x5175bf){return _0x3fe051[_0x7126('0xa')]('SugarcrmAccount',attributes,{'tableName':_0x7126('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 101fbca..bddd4ab 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 _0xc4d5=['options','attributes','limit','include','map','model','stringify','ShowSugarcrmAccount','SugarcrmAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSugarcrmAccount','findAll'];(function(_0x3476a4,_0x488313){var _0xc0df9=function(_0x4e9550){while(--_0x4e9550){_0x3476a4['push'](_0x3476a4['shift']());}};_0xc0df9(++_0x488313);}(_0xc4d5,0x1c7));var _0x5c4d=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0xc4d5[_0x15ea09];return _0x3e9c78;};'use strict';var _=require(_0x5c4d('0x0'));var util=require(_0x5c4d('0x1'));var moment=require(_0x5c4d('0x2'));var BPromise=require(_0x5c4d('0x3'));var rs=require(_0x5c4d('0x4'));var fs=require('fs');var Redis=require(_0x5c4d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5c4d('0x6'));var logger=require(_0x5c4d('0x7'))(_0x5c4d('0x8'));var config=require(_0x5c4d('0x9'));var jayson=require(_0x5c4d('0xa'));var client=jayson[_0x5c4d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x348fac,_0x2d0277,_0x28a995){return new BPromise(function(_0x205c94,_0x2bfe18){return client[_0x5c4d('0xc')](_0x348fac,_0x28a995)[_0x5c4d('0xd')](function(_0x3b87b3){logger[_0x5c4d('0xe')](_0x5c4d('0xf'),_0x2d0277,_0x5c4d('0x10'));logger[_0x5c4d('0x11')](_0x5c4d('0x12'),_0x2d0277,_0x5c4d('0x10'),JSON['stringify'](_0x3b87b3));if(_0x3b87b3[_0x5c4d('0x13')]){if(_0x3b87b3['error'][_0x5c4d('0x14')]===0x1f4){logger[_0x5c4d('0x13')](_0x5c4d('0xf'),_0x2d0277,_0x3b87b3[_0x5c4d('0x13')]['message']);return _0x2bfe18(_0x3b87b3[_0x5c4d('0x13')][_0x5c4d('0x15')]);}logger[_0x5c4d('0x13')](_0x5c4d('0xf'),_0x2d0277,_0x3b87b3[_0x5c4d('0x13')][_0x5c4d('0x15')]);return _0x205c94(_0x3b87b3[_0x5c4d('0x13')][_0x5c4d('0x15')]);}else{logger[_0x5c4d('0xe')](_0x5c4d('0xf'),_0x2d0277,_0x5c4d('0x10'));_0x205c94(_0x3b87b3[_0x5c4d('0x16')][_0x5c4d('0x15')]);}})[_0x5c4d('0x17')](function(_0x2ca559){logger[_0x5c4d('0x13')](_0x5c4d('0xf'),_0x2d0277,_0x2ca559);_0x2bfe18(_0x2ca559);});});}exports[_0x5c4d('0x18')]=function(_0x59f2a7){var _0x6c54eb=this;return new Promise(function(_0x30b041,_0x3cfbc4){return db['SugarcrmAccount'][_0x5c4d('0x19')]({'raw':_0x59f2a7[_0x5c4d('0x1a')]?_0x59f2a7[_0x5c4d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x59f2a7[_0x5c4d('0x1a')]?_0x59f2a7[_0x5c4d('0x1a')]['where']||null:null,'attributes':_0x59f2a7['options']?_0x59f2a7['options'][_0x5c4d('0x1b')]||null:null,'limit':_0x59f2a7[_0x5c4d('0x1a')]?_0x59f2a7[_0x5c4d('0x1a')][_0x5c4d('0x1c')]||null:null,'include':_0x59f2a7[_0x5c4d('0x1a')]?_0x59f2a7[_0x5c4d('0x1a')][_0x5c4d('0x1d')]?_[_0x5c4d('0x1e')](_0x59f2a7[_0x5c4d('0x1a')][_0x5c4d('0x1d')],function(_0x2a4c95){return{'model':db[_0x2a4c95[_0x5c4d('0x1f')]],'as':_0x2a4c95['as'],'attributes':_0x2a4c95['attributes'],'include':_0x2a4c95[_0x5c4d('0x1d')]?_[_0x5c4d('0x1e')](_0x2a4c95['include'],function(_0x541850){return{'model':db[_0x541850['model']],'as':_0x541850['as'],'attributes':_0x541850[_0x5c4d('0x1b')],'include':_0x541850[_0x5c4d('0x1d')]?_['map'](_0x541850[_0x5c4d('0x1d')],function(_0x2c348e){return{'model':db[_0x2c348e[_0x5c4d('0x1f')]],'as':_0x2c348e['as'],'attributes':_0x2c348e[_0x5c4d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5c4d('0xd')](function(_0x3a5caa){logger['info'](_0x5c4d('0x18'),_0x59f2a7);logger[_0x5c4d('0x11')]('GetSugarcrmAccount',_0x59f2a7,JSON[_0x5c4d('0x20')](_0x3a5caa));_0x30b041(_0x3a5caa);})[_0x5c4d('0x17')](function(_0x52c318){logger['error'](_0x5c4d('0x18'),_0x52c318[_0x5c4d('0x15')],_0x59f2a7);_0x3cfbc4(_0x6c54eb[_0x5c4d('0x13')](0x1f4,_0x52c318[_0x5c4d('0x15')]));});});};exports[_0x5c4d('0x21')]=function(_0x5f0eb4){var _0x23471b=this;return new Promise(function(_0x1b30eb,_0x5f5c8f){return db[_0x5c4d('0x22')][_0x5c4d('0x23')]({'raw':_0x5f0eb4[_0x5c4d('0x1a')]?_0x5f0eb4[_0x5c4d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5f0eb4[_0x5c4d('0x1a')]?_0x5f0eb4['options'][_0x5c4d('0x24')]||null:null,'attributes':_0x5f0eb4[_0x5c4d('0x1a')]?_0x5f0eb4[_0x5c4d('0x1a')]['attributes']||null:null,'include':_0x5f0eb4[_0x5c4d('0x1a')]?_0x5f0eb4[_0x5c4d('0x1a')][_0x5c4d('0x1d')]?_[_0x5c4d('0x1e')](_0x5f0eb4['options'][_0x5c4d('0x1d')],function(_0x5d9b30){return{'model':db[_0x5d9b30[_0x5c4d('0x1f')]],'as':_0x5d9b30['as'],'attributes':_0x5d9b30[_0x5c4d('0x1b')],'include':_0x5d9b30[_0x5c4d('0x1d')]?_[_0x5c4d('0x1e')](_0x5d9b30[_0x5c4d('0x1d')],function(_0x1b43c1){return{'model':db[_0x1b43c1[_0x5c4d('0x1f')]],'as':_0x1b43c1['as'],'attributes':_0x1b43c1[_0x5c4d('0x1b')],'include':_0x1b43c1[_0x5c4d('0x1d')]?_[_0x5c4d('0x1e')](_0x1b43c1['include'],function(_0x21561d){return{'model':db[_0x21561d[_0x5c4d('0x1f')]],'as':_0x21561d['as'],'attributes':_0x21561d[_0x5c4d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5c4d('0xd')](function(_0x4c4343){logger['info'](_0x5c4d('0x21'),_0x5f0eb4);logger[_0x5c4d('0x11')](_0x5c4d('0x21'),_0x5f0eb4,JSON['stringify'](_0x4c4343));_0x1b30eb(_0x4c4343);})['catch'](function(_0x221450){logger[_0x5c4d('0x13')](_0x5c4d('0x21'),_0x221450[_0x5c4d('0x15')],_0x5f0eb4);_0x5f5c8f(_0x23471b[_0x5c4d('0x13')](0x1f4,_0x221450[_0x5c4d('0x15')]));});});}; \ No newline at end of file +var _0xabaf=['attributes','include','map','model','debug','find','raw','where','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xabaf,0x7e));var _0xfaba=function(_0x13be3a,_0x9e14ec){_0x13be3a=_0x13be3a-0x0;var _0x41d6e2=_0xabaf[_0x13be3a];return _0x41d6e2;};'use strict';var _=require(_0xfaba('0x0'));var util=require(_0xfaba('0x1'));var moment=require(_0xfaba('0x2'));var BPromise=require(_0xfaba('0x3'));var rs=require(_0xfaba('0x4'));var fs=require('fs');var Redis=require(_0xfaba('0x5'));var db=require(_0xfaba('0x6'))['db'];var utils=require(_0xfaba('0x7'));var logger=require(_0xfaba('0x8'))(_0xfaba('0x9'));var config=require(_0xfaba('0xa'));var jayson=require(_0xfaba('0xb'));var client=jayson[_0xfaba('0xc')][_0xfaba('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x379b54,_0x1928b0,_0x1550ee){return new BPromise(function(_0x4d9e51,_0x453e58){return client[_0xfaba('0xe')](_0x379b54,_0x1550ee)[_0xfaba('0xf')](function(_0x54993d){logger[_0xfaba('0x10')](_0xfaba('0x11'),_0x1928b0,_0xfaba('0x12'));logger['debug'](_0xfaba('0x13'),_0x1928b0,_0xfaba('0x12'),JSON[_0xfaba('0x14')](_0x54993d));if(_0x54993d[_0xfaba('0x15')]){if(_0x54993d[_0xfaba('0x15')][_0xfaba('0x16')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x1928b0,_0x54993d[_0xfaba('0x15')][_0xfaba('0x17')]);return _0x453e58(_0x54993d[_0xfaba('0x15')][_0xfaba('0x17')]);}logger[_0xfaba('0x15')](_0xfaba('0x11'),_0x1928b0,_0x54993d[_0xfaba('0x15')][_0xfaba('0x17')]);return _0x4d9e51(_0x54993d[_0xfaba('0x15')][_0xfaba('0x17')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x1928b0,_0xfaba('0x12'));_0x4d9e51(_0x54993d[_0xfaba('0x18')]['message']);}})[_0xfaba('0x19')](function(_0x1810e7){logger['error'](_0xfaba('0x11'),_0x1928b0,_0x1810e7);_0x453e58(_0x1810e7);});});}exports[_0xfaba('0x1a')]=function(_0x15a4f1){var _0x34bf85=this;return new Promise(function(_0x472239,_0x2c9d74){return db[_0xfaba('0x1b')][_0xfaba('0x1c')]({'raw':_0x15a4f1['options']?_0x15a4f1[_0xfaba('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x15a4f1['options']?_0x15a4f1[_0xfaba('0x1d')]['where']||null:null,'attributes':_0x15a4f1[_0xfaba('0x1d')]?_0x15a4f1[_0xfaba('0x1d')][_0xfaba('0x1e')]||null:null,'limit':_0x15a4f1[_0xfaba('0x1d')]?_0x15a4f1['options']['limit']||null:null,'include':_0x15a4f1[_0xfaba('0x1d')]?_0x15a4f1[_0xfaba('0x1d')][_0xfaba('0x1f')]?_[_0xfaba('0x20')](_0x15a4f1[_0xfaba('0x1d')][_0xfaba('0x1f')],function(_0x3b7eb1){return{'model':db[_0x3b7eb1[_0xfaba('0x21')]],'as':_0x3b7eb1['as'],'attributes':_0x3b7eb1[_0xfaba('0x1e')],'include':_0x3b7eb1[_0xfaba('0x1f')]?_[_0xfaba('0x20')](_0x3b7eb1[_0xfaba('0x1f')],function(_0x789f5d){return{'model':db[_0x789f5d[_0xfaba('0x21')]],'as':_0x789f5d['as'],'attributes':_0x789f5d[_0xfaba('0x1e')],'include':_0x789f5d['include']?_[_0xfaba('0x20')](_0x789f5d[_0xfaba('0x1f')],function(_0x379cec){return{'model':db[_0x379cec[_0xfaba('0x21')]],'as':_0x379cec['as'],'attributes':_0x379cec[_0xfaba('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfaba('0xf')](function(_0x20bbd3){logger[_0xfaba('0x10')](_0xfaba('0x1a'),_0x15a4f1);logger[_0xfaba('0x22')](_0xfaba('0x1a'),_0x15a4f1,JSON[_0xfaba('0x14')](_0x20bbd3));_0x472239(_0x20bbd3);})[_0xfaba('0x19')](function(_0x444b3c){logger['error'](_0xfaba('0x1a'),_0x444b3c['message'],_0x15a4f1);_0x2c9d74(_0x34bf85['error'](0x1f4,_0x444b3c[_0xfaba('0x17')]));});});};exports['ShowSugarcrmAccount']=function(_0x2869cf){var _0x4df080=this;return new Promise(function(_0x9cdb78,_0x58bdb3){return db['SugarcrmAccount'][_0xfaba('0x23')]({'raw':_0x2869cf[_0xfaba('0x1d')]?_0x2869cf['options'][_0xfaba('0x24')]===undefined?!![]:![]:!![],'where':_0x2869cf['options']?_0x2869cf['options'][_0xfaba('0x25')]||null:null,'attributes':_0x2869cf[_0xfaba('0x1d')]?_0x2869cf[_0xfaba('0x1d')]['attributes']||null:null,'include':_0x2869cf['options']?_0x2869cf[_0xfaba('0x1d')][_0xfaba('0x1f')]?_['map'](_0x2869cf[_0xfaba('0x1d')]['include'],function(_0x602df9){return{'model':db[_0x602df9[_0xfaba('0x21')]],'as':_0x602df9['as'],'attributes':_0x602df9['attributes'],'include':_0x602df9['include']?_['map'](_0x602df9[_0xfaba('0x1f')],function(_0x23edb5){return{'model':db[_0x23edb5[_0xfaba('0x21')]],'as':_0x23edb5['as'],'attributes':_0x23edb5[_0xfaba('0x1e')],'include':_0x23edb5[_0xfaba('0x1f')]?_['map'](_0x23edb5['include'],function(_0x5d3cdf){return{'model':db[_0x5d3cdf['model']],'as':_0x5d3cdf['as'],'attributes':_0x5d3cdf['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x314f4b){logger['info'](_0xfaba('0x26'),_0x2869cf);logger[_0xfaba('0x22')](_0xfaba('0x26'),_0x2869cf,JSON[_0xfaba('0x14')](_0x314f4b));_0x9cdb78(_0x314f4b);})[_0xfaba('0x19')](function(_0x169a81){logger['error'](_0xfaba('0x26'),_0x169a81['message'],_0x2869cf);_0x58bdb3(_0x4df080[_0xfaba('0x15')](0x1f4,_0x169a81['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 6c7fb2c..fcf7021 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 _0x62e6=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','getDescriptions','post','create','put','/:id','update'];(function(_0x2de972,_0x327b30){var _0x16c25d=function(_0x144542){while(--_0x144542){_0x2de972['push'](_0x2de972['shift']());}};_0x16c25d(++_0x327b30);}(_0x62e6,0x10b));var _0x662e=function(_0x2634a7,_0x118508){_0x2634a7=_0x2634a7-0x0;var _0xa52e2c=_0x62e6[_0x2634a7];return _0xa52e2c;};'use strict';var multer=require(_0x662e('0x0'));var util=require(_0x662e('0x1'));var path=require('path');var timeout=require(_0x662e('0x2'));var express=require(_0x662e('0x3'));var router=express[_0x662e('0x4')]();var fs_extra=require(_0x662e('0x5'));var auth=require(_0x662e('0x6'));var interaction=require(_0x662e('0x7'));var config=require(_0x662e('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x662e('0x9')]('/',auth[_0x662e('0xa')](),controller[_0x662e('0xb')]);router[_0x662e('0x9')]('/:id',auth[_0x662e('0xa')](),controller[_0x662e('0xc')]);router[_0x662e('0x9')](_0x662e('0xd'),auth[_0x662e('0xa')](),controller[_0x662e('0xe')]);router[_0x662e('0x9')]('/:id/subjects',auth[_0x662e('0xa')](),controller['getSubjects']);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x662e('0xf')]);router[_0x662e('0x10')]('/',auth[_0x662e('0xa')](),controller[_0x662e('0x11')]);router[_0x662e('0x12')](_0x662e('0x13'),auth[_0x662e('0xa')](),controller[_0x662e('0x14')]);router[_0x662e('0x15')](_0x662e('0x13'),auth['isAuthenticated'](),controller[_0x662e('0x16')]);module[_0x662e('0x17')]=router; \ No newline at end of file +var _0xbd0b=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','/:id','update','delete','exports','multer'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xbd0b,0xbc));var _0xbbd0=function(_0x3f1b6c,_0x3579ca){_0x3f1b6c=_0x3f1b6c-0x0;var _0x3a1460=_0xbd0b[_0x3f1b6c];return _0x3a1460;};'use strict';var multer=require(_0xbbd0('0x0'));var util=require(_0xbbd0('0x1'));var path=require('path');var timeout=require(_0xbbd0('0x2'));var express=require('express');var router=express[_0xbbd0('0x3')]();var fs_extra=require(_0xbbd0('0x4'));var auth=require(_0xbbd0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbbd0('0x6'));var controller=require(_0xbbd0('0x7'));router[_0xbbd0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbbd0('0x8')]('/:id',auth[_0xbbd0('0x9')](),controller[_0xbbd0('0xa')]);router[_0xbbd0('0x8')](_0xbbd0('0xb'),auth[_0xbbd0('0x9')](),controller['getFields']);router[_0xbbd0('0x8')](_0xbbd0('0xc'),auth[_0xbbd0('0x9')](),controller[_0xbbd0('0xd')]);router[_0xbbd0('0x8')]('/:id/descriptions',auth[_0xbbd0('0x9')](),controller[_0xbbd0('0xe')]);router[_0xbbd0('0xf')]('/',auth[_0xbbd0('0x9')](),controller[_0xbbd0('0x10')]);router['put'](_0xbbd0('0x11'),auth[_0xbbd0('0x9')](),controller[_0xbbd0('0x12')]);router[_0xbbd0('0x13')](_0xbbd0('0x11'),auth[_0xbbd0('0x9')](),controller['destroy']);module[_0xbbd0('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 180c107..84d5f02 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 _0xd76b=['STRING','exports'];(function(_0x589eb4,_0xaa2019){var _0xf50816=function(_0x572fc5){while(--_0x572fc5){_0x589eb4['push'](_0x589eb4['shift']());}};_0xf50816(++_0xaa2019);}(_0xd76b,0x1af));var _0xbd76=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xd76b[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require('sequelize');module[_0xbd76('0x0')]={'name':{'type':Sequelize[_0xbd76('0x1')]},'description':{'type':Sequelize[_0xbd76('0x1')]}}; \ No newline at end of file +var _0xe9af=['sequelize','exports','STRING'];(function(_0x3a2118,_0x31fc3c){var _0x1d181d=function(_0x26a734){while(--_0x26a734){_0x3a2118['push'](_0x3a2118['shift']());}};_0x1d181d(++_0x31fc3c);}(_0xe9af,0x1a4));var _0xfe9a=function(_0x171ea9,_0x3814d1){_0x171ea9=_0x171ea9-0x0;var _0x4a5985=_0xe9af[_0x171ea9];return _0x4a5985;};'use strict';var Sequelize=require(_0xfe9a('0x0'));module[_0xfe9a('0x1')]={'name':{'type':Sequelize[_0xfe9a('0x2')]},'description':{'type':Sequelize[_0xfe9a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 4ceacb2..b6eafd5 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 _0x23fa=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','catch','params','keys','find','create','body','getFields','SugarcrmField','findOne','getSubjects','pick','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','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','offset','undefined','limit','count'];(function(_0xb3cbf2,_0x3e4e09){var _0xaf90c0=function(_0x1fccb8){while(--_0x1fccb8){_0xb3cbf2['push'](_0xb3cbf2['shift']());}};_0xaf90c0(++_0x3e4e09);}(_0x23fa,0x11e));var _0xa23f=function(_0x30f1b0,_0xebe464){_0x30f1b0=_0x30f1b0-0x0;var _0x349da3=_0x23fa[_0x30f1b0];return _0x349da3;};'use strict';var emlformat=require(_0xa23f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa23f('0x1'));var jsonpatch=require(_0xa23f('0x2'));var rp=require(_0xa23f('0x3'));var moment=require(_0xa23f('0x4'));var BPromise=require(_0xa23f('0x5'));var Mustache=require(_0xa23f('0x6'));var util=require('util');var path=require(_0xa23f('0x7'));var sox=require(_0xa23f('0x8'));var csv=require('to-csv');var ejs=require(_0xa23f('0x9'));var fs=require('fs');var fs_extra=require(_0xa23f('0xa'));var _=require(_0xa23f('0xb'));var squel=require(_0xa23f('0xc'));var crypto=require(_0xa23f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa23f('0xe'));var toCsv=require(_0xa23f('0xf'));var querystring=require('querystring');var Papa=require(_0xa23f('0x10'));var Redis=require('ioredis');var authService=require(_0xa23f('0x11'));var qs=require(_0xa23f('0x12'));var as=require(_0xa23f('0x13'));var hardwareService=require(_0xa23f('0x14'));var logger=require('../../config/logger')(_0xa23f('0x15'));var utils=require(_0xa23f('0x16'));var config=require(_0xa23f('0x17'));var licenseUtil=require(_0xa23f('0x18'));var db=require(_0xa23f('0x19'))['db'];function respondWithStatusCode(_0x3b531f,_0x6c19d0){_0x6c19d0=_0x6c19d0||0xcc;return function(_0x37db47){if(_0x37db47){return _0x3b531f[_0xa23f('0x1a')](_0x6c19d0);}return _0x3b531f[_0xa23f('0x1b')](_0x6c19d0)[_0xa23f('0x1c')]();};}function respondWithResult(_0x4082a1,_0x5270c6){_0x5270c6=_0x5270c6||0xc8;return function(_0x5d0918){if(_0x5d0918){return _0x4082a1[_0xa23f('0x1b')](_0x5270c6)[_0xa23f('0x1d')](_0x5d0918);}};}function respondWithFilteredResult(_0x1f6b67,_0x5a386c){return function(_0x2ccd00){if(_0x2ccd00){var _0x4e2d16=typeof _0x5a386c[_0xa23f('0x1e')]===_0xa23f('0x1f')&&typeof _0x5a386c[_0xa23f('0x20')]==='undefined';var _0x3d9316=_0x2ccd00[_0xa23f('0x21')];var _0x3eb834=_0x4e2d16?0x0:_0x5a386c[_0xa23f('0x1e')];var _0x3f66e1=_0x4e2d16?_0x2ccd00['count']:_0x5a386c['offset']+_0x5a386c[_0xa23f('0x20')];var _0x31ae82;if(_0x3f66e1>=_0x3d9316){_0x3f66e1=_0x3d9316;_0x31ae82=0xc8;}else{_0x31ae82=0xce;}_0x1f6b67[_0xa23f('0x1b')](_0x31ae82);return _0x1f6b67[_0xa23f('0x22')](_0xa23f('0x23'),_0x3eb834+'-'+_0x3f66e1+'/'+_0x3d9316)[_0xa23f('0x1d')](_0x2ccd00);}return null;};}function patchUpdates(_0x549adb){return function(_0x103db0){try{jsonpatch['apply'](_0x103db0,_0x549adb,!![]);}catch(_0x2ae53a){return BPromise[_0xa23f('0x24')](_0x2ae53a);}return _0x103db0[_0xa23f('0x25')]();};}function saveUpdates(_0x239b48,_0xf5f7d9){return function(_0x25d758){if(_0x25d758){return _0x25d758[_0xa23f('0x26')](_0x239b48)[_0xa23f('0x27')](function(_0x5548c7){return _0x5548c7;});}return null;};}function removeEntity(_0x3b6709,_0x1657f2){return function(_0xcc82b0){if(_0xcc82b0){return _0xcc82b0[_0xa23f('0x28')]()[_0xa23f('0x27')](function(){_0x3b6709['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xbebdbe,_0x45697c){return function(_0x5dd549){if(!_0x5dd549){_0xbebdbe['sendStatus'](0x194);}return _0x5dd549;};}function handleError(_0x494c92,_0x28eb32){_0x28eb32=_0x28eb32||0x1f4;return function(_0x13c263){logger[_0xa23f('0x29')](_0x13c263[_0xa23f('0x2a')]);if(_0x13c263[_0xa23f('0x2b')]){delete _0x13c263[_0xa23f('0x2b')];}_0x494c92[_0xa23f('0x1b')](_0x28eb32)['send'](_0x13c263);};}exports[_0xa23f('0x2c')]=function(_0x390276,_0xacc057){var _0x17a609={},_0x4d813a={},_0x4cbf29={'count':0x0,'rows':[]};var _0x1f4878=_[_0xa23f('0x2d')](db[_0xa23f('0x2e')][_0xa23f('0x2f')],function(_0x32b6bb){return{'name':_0x32b6bb[_0xa23f('0x30')],'type':_0x32b6bb[_0xa23f('0x31')][_0xa23f('0x32')]};});_0x4d813a['model']=_[_0xa23f('0x2d')](_0x1f4878,'name');_0x4d813a[_0xa23f('0x33')]=_['keys'](_0x390276[_0xa23f('0x33')]);_0x4d813a[_0xa23f('0x34')]=_[_0xa23f('0x35')](_0x4d813a[_0xa23f('0x36')],_0x4d813a[_0xa23f('0x33')]);_0x17a609['attributes']=_['intersection'](_0x4d813a[_0xa23f('0x36')],qs[_0xa23f('0x37')](_0x390276[_0xa23f('0x33')]['fields']));_0x17a609[_0xa23f('0x38')]=_0x17a609[_0xa23f('0x38')][_0xa23f('0x39')]?_0x17a609[_0xa23f('0x38')]:_0x4d813a[_0xa23f('0x36')];if(!_0x390276[_0xa23f('0x33')][_0xa23f('0x3a')](_0xa23f('0x3b'))){_0x17a609['limit']=qs[_0xa23f('0x20')](_0x390276[_0xa23f('0x33')]['limit']);_0x17a609[_0xa23f('0x1e')]=qs['offset'](_0x390276['query'][_0xa23f('0x1e')]);}_0x17a609[_0xa23f('0x3c')]=qs[_0xa23f('0x3d')](_0x390276[_0xa23f('0x33')][_0xa23f('0x3d')]);_0x17a609[_0xa23f('0x3e')]=qs[_0xa23f('0x34')](_['pick'](_0x390276['query'],_0x4d813a[_0xa23f('0x34')]),_0x1f4878);if(_0x390276[_0xa23f('0x33')][_0xa23f('0x3f')]){_0x17a609['where']=_[_0xa23f('0x40')](_0x17a609[_0xa23f('0x3e')],{'$or':_[_0xa23f('0x2d')](_0x1f4878,function(_0x1f2e00){if(_0x1f2e00[_0xa23f('0x31')]!==_0xa23f('0x41')){var _0x37a572={};_0x37a572[_0x1f2e00['name']]={'$like':'%'+_0x390276[_0xa23f('0x33')][_0xa23f('0x3f')]+'%'};return _0x37a572;}})});}_0x17a609=_[_0xa23f('0x40')]({},_0x17a609,_0x390276[_0xa23f('0x42')]);var _0x1a13c4={'where':_0x17a609[_0xa23f('0x3e')]};return db[_0xa23f('0x2e')][_0xa23f('0x21')](_0x1a13c4)[_0xa23f('0x27')](function(_0x8ccd09){_0x4cbf29['count']=_0x8ccd09;if(_0x390276[_0xa23f('0x33')]['includeAll']){_0x17a609[_0xa23f('0x43')]=[{'all':!![]}];}return db[_0xa23f('0x2e')]['findAll'](_0x17a609);})[_0xa23f('0x27')](function(_0x2069d4){_0x4cbf29['rows']=_0x2069d4;return _0x4cbf29;})['then'](respondWithFilteredResult(_0xacc057,_0x17a609))[_0xa23f('0x44')](handleError(_0xacc057,null));};exports['show']=function(_0x321ee7,_0x2c414f){var _0x22148f={'raw':![],'where':{'id':_0x321ee7[_0xa23f('0x45')]['id']}},_0x280de7={};_0x280de7['model']=_[_0xa23f('0x46')](db[_0xa23f('0x2e')][_0xa23f('0x2f')]);_0x280de7[_0xa23f('0x33')]=_[_0xa23f('0x46')](_0x321ee7[_0xa23f('0x33')]);_0x280de7[_0xa23f('0x34')]=_['intersection'](_0x280de7[_0xa23f('0x36')],_0x280de7[_0xa23f('0x33')]);_0x22148f[_0xa23f('0x38')]=_[_0xa23f('0x35')](_0x280de7[_0xa23f('0x36')],qs[_0xa23f('0x37')](_0x321ee7['query'][_0xa23f('0x37')]));_0x22148f[_0xa23f('0x38')]=_0x22148f[_0xa23f('0x38')][_0xa23f('0x39')]?_0x22148f[_0xa23f('0x38')]:_0x280de7[_0xa23f('0x36')];if(_0x321ee7[_0xa23f('0x33')]['includeAll']){_0x22148f[_0xa23f('0x43')]=[{'all':!![]}];}_0x22148f=_[_0xa23f('0x40')]({},_0x22148f,_0x321ee7[_0xa23f('0x42')]);return db[_0xa23f('0x2e')][_0xa23f('0x47')](_0x22148f)[_0xa23f('0x27')](handleEntityNotFound(_0x2c414f,null))[_0xa23f('0x27')](respondWithResult(_0x2c414f,null))['catch'](handleError(_0x2c414f,null));};exports[_0xa23f('0x48')]=function(_0x1e2c6d,_0x33519b){return db[_0xa23f('0x2e')][_0xa23f('0x48')](_0x1e2c6d['body'],{})[_0xa23f('0x27')](respondWithResult(_0x33519b,0xc9))[_0xa23f('0x44')](handleError(_0x33519b,null));};exports[_0xa23f('0x26')]=function(_0x45032e,_0x5509ca){if(_0x45032e[_0xa23f('0x49')]['id']){delete _0x45032e[_0xa23f('0x49')]['id'];}return db[_0xa23f('0x2e')][_0xa23f('0x47')]({'where':{'id':_0x45032e[_0xa23f('0x45')]['id']}})[_0xa23f('0x27')](handleEntityNotFound(_0x5509ca,null))[_0xa23f('0x27')](saveUpdates(_0x45032e['body'],null))['then'](respondWithResult(_0x5509ca,null))[_0xa23f('0x44')](handleError(_0x5509ca,null));};exports[_0xa23f('0x28')]=function(_0x2500d6,_0x4511f1){return db[_0xa23f('0x2e')][_0xa23f('0x47')]({'where':{'id':_0x2500d6[_0xa23f('0x45')]['id']}})['then'](handleEntityNotFound(_0x4511f1,null))[_0xa23f('0x27')](removeEntity(_0x4511f1,null))[_0xa23f('0x44')](handleError(_0x4511f1,null));};exports[_0xa23f('0x4a')]=function(_0x218d50,_0x10de0b,_0x50bb1a){var _0xb65e0e={};var _0x25082d={};var _0xb5f65d;var _0x1a5dbf;return db[_0xa23f('0x2e')]['findOne']({'where':{'id':_0x218d50[_0xa23f('0x45')]['id']}})['then'](handleEntityNotFound(_0x10de0b,null))[_0xa23f('0x27')](function(_0x28faab){if(_0x28faab){_0xb5f65d=_0x28faab;_0x25082d[_0xa23f('0x36')]=_[_0xa23f('0x46')](db[_0xa23f('0x4b')][_0xa23f('0x2f')]);_0x25082d[_0xa23f('0x33')]=_['keys'](_0x218d50[_0xa23f('0x33')]);_0x25082d[_0xa23f('0x34')]=_['intersection'](_0x25082d[_0xa23f('0x36')],_0x25082d[_0xa23f('0x33')]);_0xb65e0e['attributes']=_[_0xa23f('0x35')](_0x25082d['model'],qs[_0xa23f('0x37')](_0x218d50[_0xa23f('0x33')]['fields']));_0xb65e0e['attributes']=_0xb65e0e[_0xa23f('0x38')][_0xa23f('0x39')]?_0xb65e0e[_0xa23f('0x38')]:_0x25082d[_0xa23f('0x36')];_0xb65e0e[_0xa23f('0x3c')]=qs[_0xa23f('0x3d')](_0x218d50['query'][_0xa23f('0x3d')]);_0xb65e0e['where']=qs['filters'](_['pick'](_0x218d50[_0xa23f('0x33')],_0x25082d[_0xa23f('0x34')]));if(_0x218d50[_0xa23f('0x33')]['filter']){_0xb65e0e[_0xa23f('0x3e')]=_[_0xa23f('0x40')](_0xb65e0e[_0xa23f('0x3e')],{'$or':_['map'](_0xb65e0e['attributes'],function(_0x283d26){var _0x3b4692={};_0x3b4692[_0x283d26]={'$like':'%'+_0x218d50[_0xa23f('0x33')][_0xa23f('0x3f')]+'%'};return _0x3b4692;})});}_0xb65e0e=_[_0xa23f('0x40')]({},_0xb65e0e,_0x218d50[_0xa23f('0x42')]);return _0xb5f65d['getFields'](_0xb65e0e);}})[_0xa23f('0x27')](function(_0x4f6a72){if(_0x4f6a72){_0x1a5dbf=_0x4f6a72['length'];if(!_0x218d50[_0xa23f('0x33')]['hasOwnProperty'](_0xa23f('0x3b'))){_0xb65e0e[_0xa23f('0x20')]=qs[_0xa23f('0x20')](_0x218d50[_0xa23f('0x33')][_0xa23f('0x20')]);_0xb65e0e[_0xa23f('0x1e')]=qs[_0xa23f('0x1e')](_0x218d50[_0xa23f('0x33')][_0xa23f('0x1e')]);}return _0xb5f65d['getFields'](_0xb65e0e);}})['then'](function(_0x3eecca){if(_0x3eecca){return _0x3eecca?{'count':_0x1a5dbf,'rows':_0x3eecca}:null;}})['then'](respondWithResult(_0x10de0b,null))[_0xa23f('0x44')](handleError(_0x10de0b,null));};exports['getSubjects']=function(_0x15e1e1,_0x4fd845,_0xfdbbc9){var _0xd69c17={};var _0x4f61a9={};var _0xde2ca4;var _0x16f104;return db[_0xa23f('0x2e')][_0xa23f('0x4c')]({'where':{'id':_0x15e1e1[_0xa23f('0x45')]['id']}})['then'](handleEntityNotFound(_0x4fd845,null))[_0xa23f('0x27')](function(_0x7de166){if(_0x7de166){_0xde2ca4=_0x7de166;_0x4f61a9[_0xa23f('0x36')]=_[_0xa23f('0x46')](db[_0xa23f('0x4b')][_0xa23f('0x2f')]);_0x4f61a9[_0xa23f('0x33')]=_[_0xa23f('0x46')](_0x15e1e1[_0xa23f('0x33')]);_0x4f61a9[_0xa23f('0x34')]=_['intersection'](_0x4f61a9[_0xa23f('0x36')],_0x4f61a9[_0xa23f('0x33')]);_0xd69c17[_0xa23f('0x38')]=_[_0xa23f('0x35')](_0x4f61a9[_0xa23f('0x36')],qs[_0xa23f('0x37')](_0x15e1e1[_0xa23f('0x33')][_0xa23f('0x37')]));_0xd69c17[_0xa23f('0x38')]=_0xd69c17[_0xa23f('0x38')]['length']?_0xd69c17[_0xa23f('0x38')]:_0x4f61a9['model'];_0xd69c17['order']=qs['sort'](_0x15e1e1[_0xa23f('0x33')][_0xa23f('0x3d')]);_0xd69c17[_0xa23f('0x3e')]=qs[_0xa23f('0x34')](_['pick'](_0x15e1e1[_0xa23f('0x33')],_0x4f61a9['filters']));if(_0x15e1e1['query'][_0xa23f('0x3f')]){_0xd69c17['where']=_[_0xa23f('0x40')](_0xd69c17[_0xa23f('0x3e')],{'$or':_['map'](_0xd69c17[_0xa23f('0x38')],function(_0x932c05){var _0x2343e1={};_0x2343e1[_0x932c05]={'$like':'%'+_0x15e1e1[_0xa23f('0x33')][_0xa23f('0x3f')]+'%'};return _0x2343e1;})});}_0xd69c17=_[_0xa23f('0x40')]({},_0xd69c17,_0x15e1e1[_0xa23f('0x42')]);return _0xde2ca4[_0xa23f('0x4d')](_0xd69c17);}})[_0xa23f('0x27')](function(_0x3fc846){if(_0x3fc846){_0x16f104=_0x3fc846[_0xa23f('0x39')];if(!_0x15e1e1[_0xa23f('0x33')][_0xa23f('0x3a')](_0xa23f('0x3b'))){_0xd69c17[_0xa23f('0x20')]=qs[_0xa23f('0x20')](_0x15e1e1['query'][_0xa23f('0x20')]);_0xd69c17[_0xa23f('0x1e')]=qs[_0xa23f('0x1e')](_0x15e1e1[_0xa23f('0x33')][_0xa23f('0x1e')]);}return _0xde2ca4[_0xa23f('0x4d')](_0xd69c17);}})[_0xa23f('0x27')](function(_0x5754ee){if(_0x5754ee){return _0x5754ee?{'count':_0x16f104,'rows':_0x5754ee}:null;}})[_0xa23f('0x27')](respondWithResult(_0x4fd845,null))[_0xa23f('0x44')](handleError(_0x4fd845,null));};exports['getDescriptions']=function(_0x10b3ce,_0x1e4c63,_0x4deaed){var _0xae00c1={};var _0x14cba1={};var _0x893478;var _0x304a79;return db[_0xa23f('0x2e')][_0xa23f('0x4c')]({'where':{'id':_0x10b3ce['params']['id']}})[_0xa23f('0x27')](handleEntityNotFound(_0x1e4c63,null))['then'](function(_0x2c38f3){if(_0x2c38f3){_0x893478=_0x2c38f3;_0x14cba1[_0xa23f('0x36')]=_['keys'](db[_0xa23f('0x4b')][_0xa23f('0x2f')]);_0x14cba1['query']=_[_0xa23f('0x46')](_0x10b3ce[_0xa23f('0x33')]);_0x14cba1['filters']=_[_0xa23f('0x35')](_0x14cba1[_0xa23f('0x36')],_0x14cba1['query']);_0xae00c1['attributes']=_[_0xa23f('0x35')](_0x14cba1[_0xa23f('0x36')],qs[_0xa23f('0x37')](_0x10b3ce[_0xa23f('0x33')][_0xa23f('0x37')]));_0xae00c1['attributes']=_0xae00c1[_0xa23f('0x38')][_0xa23f('0x39')]?_0xae00c1[_0xa23f('0x38')]:_0x14cba1['model'];_0xae00c1[_0xa23f('0x3c')]=qs[_0xa23f('0x3d')](_0x10b3ce['query'][_0xa23f('0x3d')]);_0xae00c1[_0xa23f('0x3e')]=qs[_0xa23f('0x34')](_[_0xa23f('0x4e')](_0x10b3ce['query'],_0x14cba1['filters']));if(_0x10b3ce[_0xa23f('0x33')][_0xa23f('0x3f')]){_0xae00c1[_0xa23f('0x3e')]=_[_0xa23f('0x40')](_0xae00c1['where'],{'$or':_[_0xa23f('0x2d')](_0xae00c1[_0xa23f('0x38')],function(_0x4c5179){var _0x17a466={};_0x17a466[_0x4c5179]={'$like':'%'+_0x10b3ce[_0xa23f('0x33')]['filter']+'%'};return _0x17a466;})});}_0xae00c1=_[_0xa23f('0x40')]({},_0xae00c1,_0x10b3ce['options']);return _0x893478[_0xa23f('0x4f')](_0xae00c1);}})['then'](function(_0x185b83){if(_0x185b83){_0x304a79=_0x185b83[_0xa23f('0x39')];if(!_0x10b3ce[_0xa23f('0x33')]['hasOwnProperty'](_0xa23f('0x3b'))){_0xae00c1[_0xa23f('0x20')]=qs[_0xa23f('0x20')](_0x10b3ce[_0xa23f('0x33')][_0xa23f('0x20')]);_0xae00c1['offset']=qs[_0xa23f('0x1e')](_0x10b3ce[_0xa23f('0x33')][_0xa23f('0x1e')]);}return _0x893478[_0xa23f('0x4f')](_0xae00c1);}})['then'](function(_0x1975f5){if(_0x1975f5){return _0x1975f5?{'count':_0x304a79,'rows':_0x1975f5}:null;}})[_0xa23f('0x27')](respondWithResult(_0x1e4c63,null))[_0xa23f('0x44')](handleError(_0x1e4c63,null));}; \ No newline at end of file +var _0x2e37=['fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','apply','reject','save','update','then','destroy','end','error','name','send','index','SugarcrmConfiguration','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','keys','length','includeAll','include','find','create','body','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2e37,0x1d6));var _0x72e3=function(_0x2d982d,_0x121028){_0x2d982d=_0x2d982d-0x0;var _0x4f36b0=_0x2e37[_0x2d982d];return _0x4f36b0;};'use strict';var emlformat=require(_0x72e3('0x0'));var rimraf=require(_0x72e3('0x1'));var zipdir=require(_0x72e3('0x2'));var jsonpatch=require(_0x72e3('0x3'));var rp=require(_0x72e3('0x4'));var moment=require(_0x72e3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x72e3('0x6'));var util=require(_0x72e3('0x7'));var path=require(_0x72e3('0x8'));var sox=require('sox');var csv=require(_0x72e3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x72e3('0xa'));var _=require('lodash');var squel=require(_0x72e3('0xb'));var crypto=require(_0x72e3('0xc'));var jsforce=require(_0x72e3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x72e3('0x9'));var querystring=require(_0x72e3('0xe'));var Papa=require('papaparse');var Redis=require(_0x72e3('0xf'));var authService=require(_0x72e3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x72e3('0x11'));var hardwareService=require(_0x72e3('0x12'));var logger=require(_0x72e3('0x13'))('api');var utils=require(_0x72e3('0x14'));var config=require(_0x72e3('0x15'));var licenseUtil=require(_0x72e3('0x16'));var db=require(_0x72e3('0x17'))['db'];function respondWithStatusCode(_0x58d576,_0x3b1410){_0x3b1410=_0x3b1410||0xcc;return function(_0x758d05){if(_0x758d05){return _0x58d576[_0x72e3('0x18')](_0x3b1410);}return _0x58d576['status'](_0x3b1410)['end']();};}function respondWithResult(_0x16cd94,_0x16b9ad){_0x16b9ad=_0x16b9ad||0xc8;return function(_0xbc0d4){if(_0xbc0d4){return _0x16cd94['status'](_0x16b9ad)[_0x72e3('0x19')](_0xbc0d4);}};}function respondWithFilteredResult(_0x289702,_0x5463e5){return function(_0x21e5cb){if(_0x21e5cb){var _0x4e75dc=typeof _0x5463e5[_0x72e3('0x1a')]==='undefined'&&typeof _0x5463e5[_0x72e3('0x1b')]===_0x72e3('0x1c');var _0x527f07=_0x21e5cb[_0x72e3('0x1d')];var _0x1e1cf5=_0x4e75dc?0x0:_0x5463e5[_0x72e3('0x1a')];var _0x584b26=_0x4e75dc?_0x21e5cb['count']:_0x5463e5['offset']+_0x5463e5['limit'];var _0x4adf76;if(_0x584b26>=_0x527f07){_0x584b26=_0x527f07;_0x4adf76=0xc8;}else{_0x4adf76=0xce;}_0x289702[_0x72e3('0x1e')](_0x4adf76);return _0x289702['set']('Content-Range',_0x1e1cf5+'-'+_0x584b26+'/'+_0x527f07)[_0x72e3('0x19')](_0x21e5cb);}return null;};}function patchUpdates(_0x153247){return function(_0x1bcded){try{jsonpatch[_0x72e3('0x1f')](_0x1bcded,_0x153247,!![]);}catch(_0x2ab13e){return BPromise[_0x72e3('0x20')](_0x2ab13e);}return _0x1bcded[_0x72e3('0x21')]();};}function saveUpdates(_0x57072d,_0x52d6ee){return function(_0x2f32a2){if(_0x2f32a2){return _0x2f32a2[_0x72e3('0x22')](_0x57072d)[_0x72e3('0x23')](function(_0x3af56a){return _0x3af56a;});}return null;};}function removeEntity(_0x20c8b0,_0x36cfb9){return function(_0x5c4861){if(_0x5c4861){return _0x5c4861[_0x72e3('0x24')]()[_0x72e3('0x23')](function(){_0x20c8b0[_0x72e3('0x1e')](0xcc)[_0x72e3('0x25')]();});}};}function handleEntityNotFound(_0x286ddf,_0x2145df){return function(_0x20933f){if(!_0x20933f){_0x286ddf[_0x72e3('0x18')](0x194);}return _0x20933f;};}function handleError(_0x476098,_0x408d17){_0x408d17=_0x408d17||0x1f4;return function(_0x445b05){logger[_0x72e3('0x26')](_0x445b05['stack']);if(_0x445b05[_0x72e3('0x27')]){delete _0x445b05[_0x72e3('0x27')];}_0x476098[_0x72e3('0x1e')](_0x408d17)[_0x72e3('0x28')](_0x445b05);};}exports[_0x72e3('0x29')]=function(_0x11fe21,_0x5b6cc1){var _0x5c4c0a={},_0x77a0c7={},_0x15a134={'count':0x0,'rows':[]};var _0x3c8f1c=_['map'](db[_0x72e3('0x2a')][_0x72e3('0x2b')],function(_0xdde5a4){return{'name':_0xdde5a4[_0x72e3('0x2c')],'type':_0xdde5a4[_0x72e3('0x2d')]['key']};});_0x77a0c7[_0x72e3('0x2e')]=_[_0x72e3('0x2f')](_0x3c8f1c,'name');_0x77a0c7[_0x72e3('0x30')]=_['keys'](_0x11fe21[_0x72e3('0x30')]);_0x77a0c7[_0x72e3('0x31')]=_[_0x72e3('0x32')](_0x77a0c7[_0x72e3('0x2e')],_0x77a0c7['query']);_0x5c4c0a['attributes']=_['intersection'](_0x77a0c7[_0x72e3('0x2e')],qs[_0x72e3('0x33')](_0x11fe21[_0x72e3('0x30')]['fields']));_0x5c4c0a[_0x72e3('0x34')]=_0x5c4c0a['attributes']['length']?_0x5c4c0a[_0x72e3('0x34')]:_0x77a0c7['model'];if(!_0x11fe21[_0x72e3('0x30')][_0x72e3('0x35')](_0x72e3('0x36'))){_0x5c4c0a['limit']=qs[_0x72e3('0x1b')](_0x11fe21[_0x72e3('0x30')][_0x72e3('0x1b')]);_0x5c4c0a[_0x72e3('0x1a')]=qs[_0x72e3('0x1a')](_0x11fe21['query']['offset']);}_0x5c4c0a[_0x72e3('0x37')]=qs[_0x72e3('0x38')](_0x11fe21[_0x72e3('0x30')][_0x72e3('0x38')]);_0x5c4c0a['where']=qs['filters'](_[_0x72e3('0x39')](_0x11fe21[_0x72e3('0x30')],_0x77a0c7['filters']),_0x3c8f1c);if(_0x11fe21[_0x72e3('0x30')]['filter']){_0x5c4c0a[_0x72e3('0x3a')]=_[_0x72e3('0x3b')](_0x5c4c0a['where'],{'$or':_[_0x72e3('0x2f')](_0x3c8f1c,function(_0x3c83ca){if(_0x3c83ca['type']!==_0x72e3('0x3c')){var _0x5ba2ac={};_0x5ba2ac[_0x3c83ca['name']]={'$like':'%'+_0x11fe21['query'][_0x72e3('0x3d')]+'%'};return _0x5ba2ac;}})});}_0x5c4c0a=_[_0x72e3('0x3b')]({},_0x5c4c0a,_0x11fe21[_0x72e3('0x3e')]);var _0x807657={'where':_0x5c4c0a[_0x72e3('0x3a')]};return db[_0x72e3('0x2a')][_0x72e3('0x1d')](_0x807657)[_0x72e3('0x23')](function(_0x3400e6){_0x15a134[_0x72e3('0x1d')]=_0x3400e6;if(_0x11fe21[_0x72e3('0x30')]['includeAll']){_0x5c4c0a['include']=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x72e3('0x3f')](_0x5c4c0a);})['then'](function(_0x18523f){_0x15a134[_0x72e3('0x40')]=_0x18523f;return _0x15a134;})[_0x72e3('0x23')](respondWithFilteredResult(_0x5b6cc1,_0x5c4c0a))[_0x72e3('0x41')](handleError(_0x5b6cc1,null));};exports[_0x72e3('0x42')]=function(_0x22d9df,_0x211973){var _0x376667={'raw':![],'where':{'id':_0x22d9df[_0x72e3('0x43')]['id']}},_0x5c075b={};_0x5c075b[_0x72e3('0x2e')]=_[_0x72e3('0x44')](db[_0x72e3('0x2a')][_0x72e3('0x2b')]);_0x5c075b[_0x72e3('0x30')]=_[_0x72e3('0x44')](_0x22d9df[_0x72e3('0x30')]);_0x5c075b[_0x72e3('0x31')]=_[_0x72e3('0x32')](_0x5c075b[_0x72e3('0x2e')],_0x5c075b[_0x72e3('0x30')]);_0x376667['attributes']=_[_0x72e3('0x32')](_0x5c075b[_0x72e3('0x2e')],qs[_0x72e3('0x33')](_0x22d9df[_0x72e3('0x30')][_0x72e3('0x33')]));_0x376667[_0x72e3('0x34')]=_0x376667[_0x72e3('0x34')][_0x72e3('0x45')]?_0x376667['attributes']:_0x5c075b[_0x72e3('0x2e')];if(_0x22d9df[_0x72e3('0x30')][_0x72e3('0x46')]){_0x376667[_0x72e3('0x47')]=[{'all':!![]}];}_0x376667=_[_0x72e3('0x3b')]({},_0x376667,_0x22d9df[_0x72e3('0x3e')]);return db[_0x72e3('0x2a')][_0x72e3('0x48')](_0x376667)[_0x72e3('0x23')](handleEntityNotFound(_0x211973,null))[_0x72e3('0x23')](respondWithResult(_0x211973,null))['catch'](handleError(_0x211973,null));};exports['create']=function(_0x493533,_0xb3cf14){return db[_0x72e3('0x2a')][_0x72e3('0x49')](_0x493533[_0x72e3('0x4a')],{})[_0x72e3('0x23')](respondWithResult(_0xb3cf14,0xc9))['catch'](handleError(_0xb3cf14,null));};exports[_0x72e3('0x22')]=function(_0x518289,_0x460f3b){if(_0x518289[_0x72e3('0x4a')]['id']){delete _0x518289[_0x72e3('0x4a')]['id'];}return db[_0x72e3('0x2a')]['find']({'where':{'id':_0x518289[_0x72e3('0x43')]['id']}})[_0x72e3('0x23')](handleEntityNotFound(_0x460f3b,null))[_0x72e3('0x23')](saveUpdates(_0x518289[_0x72e3('0x4a')],null))['then'](respondWithResult(_0x460f3b,null))['catch'](handleError(_0x460f3b,null));};exports[_0x72e3('0x24')]=function(_0x1f7e9d,_0x435467){return db['SugarcrmConfiguration'][_0x72e3('0x48')]({'where':{'id':_0x1f7e9d[_0x72e3('0x43')]['id']}})[_0x72e3('0x23')](handleEntityNotFound(_0x435467,null))[_0x72e3('0x23')](removeEntity(_0x435467,null))[_0x72e3('0x41')](handleError(_0x435467,null));};exports[_0x72e3('0x4b')]=function(_0x10bc1a,_0x3dd772,_0x46637d){var _0x2182b4={};var _0x597451={};var _0x418289;var _0x277182;return db[_0x72e3('0x2a')]['findOne']({'where':{'id':_0x10bc1a[_0x72e3('0x43')]['id']}})[_0x72e3('0x23')](handleEntityNotFound(_0x3dd772,null))[_0x72e3('0x23')](function(_0x9540a5){if(_0x9540a5){_0x418289=_0x9540a5;_0x597451[_0x72e3('0x2e')]=_[_0x72e3('0x44')](db['SugarcrmField']['rawAttributes']);_0x597451[_0x72e3('0x30')]=_[_0x72e3('0x44')](_0x10bc1a[_0x72e3('0x30')]);_0x597451['filters']=_[_0x72e3('0x32')](_0x597451[_0x72e3('0x2e')],_0x597451[_0x72e3('0x30')]);_0x2182b4[_0x72e3('0x34')]=_[_0x72e3('0x32')](_0x597451['model'],qs[_0x72e3('0x33')](_0x10bc1a[_0x72e3('0x30')][_0x72e3('0x33')]));_0x2182b4[_0x72e3('0x34')]=_0x2182b4[_0x72e3('0x34')]['length']?_0x2182b4['attributes']:_0x597451['model'];_0x2182b4[_0x72e3('0x37')]=qs[_0x72e3('0x38')](_0x10bc1a[_0x72e3('0x30')][_0x72e3('0x38')]);_0x2182b4[_0x72e3('0x3a')]=qs[_0x72e3('0x31')](_[_0x72e3('0x39')](_0x10bc1a[_0x72e3('0x30')],_0x597451[_0x72e3('0x31')]));if(_0x10bc1a['query']['filter']){_0x2182b4[_0x72e3('0x3a')]=_[_0x72e3('0x3b')](_0x2182b4['where'],{'$or':_[_0x72e3('0x2f')](_0x2182b4[_0x72e3('0x34')],function(_0xd0eb33){var _0x3e66eb={};_0x3e66eb[_0xd0eb33]={'$like':'%'+_0x10bc1a[_0x72e3('0x30')][_0x72e3('0x3d')]+'%'};return _0x3e66eb;})});}_0x2182b4=_[_0x72e3('0x3b')]({},_0x2182b4,_0x10bc1a[_0x72e3('0x3e')]);return _0x418289[_0x72e3('0x4b')](_0x2182b4);}})['then'](function(_0x4f475f){if(_0x4f475f){_0x277182=_0x4f475f[_0x72e3('0x45')];if(!_0x10bc1a[_0x72e3('0x30')]['hasOwnProperty'](_0x72e3('0x36'))){_0x2182b4[_0x72e3('0x1b')]=qs[_0x72e3('0x1b')](_0x10bc1a[_0x72e3('0x30')]['limit']);_0x2182b4[_0x72e3('0x1a')]=qs[_0x72e3('0x1a')](_0x10bc1a['query'][_0x72e3('0x1a')]);}return _0x418289[_0x72e3('0x4b')](_0x2182b4);}})[_0x72e3('0x23')](function(_0x146c39){if(_0x146c39){return _0x146c39?{'count':_0x277182,'rows':_0x146c39}:null;}})[_0x72e3('0x23')](respondWithResult(_0x3dd772,null))['catch'](handleError(_0x3dd772,null));};exports['getSubjects']=function(_0xcac850,_0x3ae2d7,_0x5b0c7b){var _0x412a9e={};var _0x1e3a1c={};var _0xdc4a01;var _0x4cb4c1;return db[_0x72e3('0x2a')][_0x72e3('0x4c')]({'where':{'id':_0xcac850[_0x72e3('0x43')]['id']}})[_0x72e3('0x23')](handleEntityNotFound(_0x3ae2d7,null))[_0x72e3('0x23')](function(_0x522c31){if(_0x522c31){_0xdc4a01=_0x522c31;_0x1e3a1c[_0x72e3('0x2e')]=_[_0x72e3('0x44')](db[_0x72e3('0x4d')][_0x72e3('0x2b')]);_0x1e3a1c[_0x72e3('0x30')]=_[_0x72e3('0x44')](_0xcac850['query']);_0x1e3a1c[_0x72e3('0x31')]=_[_0x72e3('0x32')](_0x1e3a1c['model'],_0x1e3a1c['query']);_0x412a9e['attributes']=_[_0x72e3('0x32')](_0x1e3a1c[_0x72e3('0x2e')],qs[_0x72e3('0x33')](_0xcac850[_0x72e3('0x30')][_0x72e3('0x33')]));_0x412a9e[_0x72e3('0x34')]=_0x412a9e[_0x72e3('0x34')][_0x72e3('0x45')]?_0x412a9e[_0x72e3('0x34')]:_0x1e3a1c[_0x72e3('0x2e')];_0x412a9e[_0x72e3('0x37')]=qs['sort'](_0xcac850['query']['sort']);_0x412a9e[_0x72e3('0x3a')]=qs[_0x72e3('0x31')](_['pick'](_0xcac850[_0x72e3('0x30')],_0x1e3a1c['filters']));if(_0xcac850[_0x72e3('0x30')]['filter']){_0x412a9e[_0x72e3('0x3a')]=_[_0x72e3('0x3b')](_0x412a9e[_0x72e3('0x3a')],{'$or':_[_0x72e3('0x2f')](_0x412a9e[_0x72e3('0x34')],function(_0x147f81){var _0xd812b0={};_0xd812b0[_0x147f81]={'$like':'%'+_0xcac850[_0x72e3('0x30')][_0x72e3('0x3d')]+'%'};return _0xd812b0;})});}_0x412a9e=_[_0x72e3('0x3b')]({},_0x412a9e,_0xcac850[_0x72e3('0x3e')]);return _0xdc4a01[_0x72e3('0x4e')](_0x412a9e);}})[_0x72e3('0x23')](function(_0x121f59){if(_0x121f59){_0x4cb4c1=_0x121f59[_0x72e3('0x45')];if(!_0xcac850[_0x72e3('0x30')][_0x72e3('0x35')](_0x72e3('0x36'))){_0x412a9e[_0x72e3('0x1b')]=qs['limit'](_0xcac850['query']['limit']);_0x412a9e['offset']=qs[_0x72e3('0x1a')](_0xcac850['query']['offset']);}return _0xdc4a01[_0x72e3('0x4e')](_0x412a9e);}})[_0x72e3('0x23')](function(_0x1bccd7){if(_0x1bccd7){return _0x1bccd7?{'count':_0x4cb4c1,'rows':_0x1bccd7}:null;}})[_0x72e3('0x23')](respondWithResult(_0x3ae2d7,null))[_0x72e3('0x41')](handleError(_0x3ae2d7,null));};exports[_0x72e3('0x4f')]=function(_0x5a2ddf,_0x1d24eb,_0x4ef961){var _0x2993e1={};var _0x31fb1f={};var _0xcb2485;var _0x17fd95;return db['SugarcrmConfiguration'][_0x72e3('0x4c')]({'where':{'id':_0x5a2ddf['params']['id']}})[_0x72e3('0x23')](handleEntityNotFound(_0x1d24eb,null))[_0x72e3('0x23')](function(_0x3a9ed1){if(_0x3a9ed1){_0xcb2485=_0x3a9ed1;_0x31fb1f['model']=_[_0x72e3('0x44')](db['SugarcrmField'][_0x72e3('0x2b')]);_0x31fb1f[_0x72e3('0x30')]=_[_0x72e3('0x44')](_0x5a2ddf[_0x72e3('0x30')]);_0x31fb1f[_0x72e3('0x31')]=_[_0x72e3('0x32')](_0x31fb1f[_0x72e3('0x2e')],_0x31fb1f[_0x72e3('0x30')]);_0x2993e1['attributes']=_['intersection'](_0x31fb1f['model'],qs['fields'](_0x5a2ddf[_0x72e3('0x30')]['fields']));_0x2993e1['attributes']=_0x2993e1[_0x72e3('0x34')][_0x72e3('0x45')]?_0x2993e1[_0x72e3('0x34')]:_0x31fb1f['model'];_0x2993e1[_0x72e3('0x37')]=qs[_0x72e3('0x38')](_0x5a2ddf[_0x72e3('0x30')][_0x72e3('0x38')]);_0x2993e1['where']=qs[_0x72e3('0x31')](_['pick'](_0x5a2ddf['query'],_0x31fb1f[_0x72e3('0x31')]));if(_0x5a2ddf['query'][_0x72e3('0x3d')]){_0x2993e1['where']=_[_0x72e3('0x3b')](_0x2993e1['where'],{'$or':_[_0x72e3('0x2f')](_0x2993e1[_0x72e3('0x34')],function(_0x543406){var _0xb97653={};_0xb97653[_0x543406]={'$like':'%'+_0x5a2ddf[_0x72e3('0x30')]['filter']+'%'};return _0xb97653;})});}_0x2993e1=_['merge']({},_0x2993e1,_0x5a2ddf[_0x72e3('0x3e')]);return _0xcb2485[_0x72e3('0x4f')](_0x2993e1);}})[_0x72e3('0x23')](function(_0x5372e6){if(_0x5372e6){_0x17fd95=_0x5372e6[_0x72e3('0x45')];if(!_0x5a2ddf[_0x72e3('0x30')][_0x72e3('0x35')](_0x72e3('0x36'))){_0x2993e1[_0x72e3('0x1b')]=qs[_0x72e3('0x1b')](_0x5a2ddf[_0x72e3('0x30')][_0x72e3('0x1b')]);_0x2993e1['offset']=qs[_0x72e3('0x1a')](_0x5a2ddf[_0x72e3('0x30')][_0x72e3('0x1a')]);}return _0xcb2485[_0x72e3('0x4f')](_0x2993e1);}})['then'](function(_0x557ce1){if(_0x557ce1){return _0x557ce1?{'count':_0x17fd95,'rows':_0x557ce1}:null;}})[_0x72e3('0x23')](respondWithResult(_0x1d24eb,null))['catch'](handleError(_0x1d24eb,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index c5ec292..35e16a7 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 _0xe4c3=['moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','api'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xe4c3,0x101));var _0x3e4c=function(_0x4403ab,_0xabd65b){_0x4403ab=_0x4403ab-0x0;var _0x1e32f0=_0xe4c3[_0x4403ab];return _0x1e32f0;};'use strict';var _=require('lodash');var util=require(_0x3e4c('0x0'));var logger=require(_0x3e4c('0x1'))(_0x3e4c('0x2'));var moment=require(_0x3e4c('0x3'));var BPromise=require(_0x3e4c('0x4'));var rp=require(_0x3e4c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e4c('0x6'));var config=require(_0x3e4c('0x7'));var attributes=require(_0x3e4c('0x8'));module[_0x3e4c('0x9')]=function(_0x344d8c,_0xdfcfe4){return _0x344d8c[_0x3e4c('0xa')](_0x3e4c('0xb'),attributes,{'tableName':_0x3e4c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50db=['SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x4d3b49,_0x5b6b77){var _0x1e6b06=function(_0x1777f0){while(--_0x1777f0){_0x4d3b49['push'](_0x4d3b49['shift']());}};_0x1e6b06(++_0x5b6b77);}(_0x50db,0xb2));var _0xb50d=function(_0x6ebca,_0x5bb242){_0x6ebca=_0x6ebca-0x0;var _0x468f82=_0x50db[_0x6ebca];return _0x468f82;};'use strict';var _=require('lodash');var util=require(_0xb50d('0x0'));var logger=require(_0xb50d('0x1'))(_0xb50d('0x2'));var moment=require(_0xb50d('0x3'));var BPromise=require(_0xb50d('0x4'));var rp=require(_0xb50d('0x5'));var fs=require('fs');var path=require(_0xb50d('0x6'));var rimraf=require('rimraf');var config=require(_0xb50d('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x1a107e,_0x1cf58a){return _0x1a107e[_0xb50d('0x8')](_0xb50d('0x9'),attributes,{'tableName':_0xb50d('0xa'),'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 bba200f..608b394 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 _0x0c53=['jayson/promise','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0x0c53,0x1b7));var _0x30c5=function(_0x1e9b08,_0x2035eb){_0x1e9b08=_0x1e9b08-0x0;var _0x390449=_0x0c53[_0x1e9b08];return _0x390449;};'use strict';var _=require(_0x30c5('0x0'));var util=require(_0x30c5('0x1'));var moment=require(_0x30c5('0x2'));var BPromise=require(_0x30c5('0x3'));var rs=require(_0x30c5('0x4'));var fs=require('fs');var Redis=require(_0x30c5('0x5'));var db=require(_0x30c5('0x6'))['db'];var utils=require(_0x30c5('0x7'));var logger=require(_0x30c5('0x8'))(_0x30c5('0x9'));var config=require(_0x30c5('0xa'));var jayson=require(_0x30c5('0xb'));var client=jayson[_0x30c5('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb0cba7,_0x25d4c6,_0xf99536){return new BPromise(function(_0x2524e4,_0x5b3c6b){return client[_0x30c5('0xd')](_0xb0cba7,_0xf99536)[_0x30c5('0xe')](function(_0x51a5dd){logger[_0x30c5('0xf')](_0x30c5('0x10'),_0x25d4c6,_0x30c5('0x11'));logger[_0x30c5('0x12')](_0x30c5('0x13'),_0x25d4c6,_0x30c5('0x11'),JSON[_0x30c5('0x14')](_0x51a5dd));if(_0x51a5dd[_0x30c5('0x15')]){if(_0x51a5dd['error']['code']===0x1f4){logger['error'](_0x30c5('0x10'),_0x25d4c6,_0x51a5dd['error']['message']);return _0x5b3c6b(_0x51a5dd[_0x30c5('0x15')][_0x30c5('0x16')]);}logger[_0x30c5('0x15')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x25d4c6,_0x51a5dd[_0x30c5('0x15')]['message']);return _0x2524e4(_0x51a5dd['error'][_0x30c5('0x16')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x25d4c6,'request\x20sent');_0x2524e4(_0x51a5dd[_0x30c5('0x17')]['message']);}})[_0x30c5('0x18')](function(_0x7535a9){logger[_0x30c5('0x15')](_0x30c5('0x10'),_0x25d4c6,_0x7535a9);_0x5b3c6b(_0x7535a9);});});} \ No newline at end of file +var _0xa0d8=['request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x31c713,_0x256f06){var _0x2bd888=function(_0x431116){while(--_0x431116){_0x31c713['push'](_0x31c713['shift']());}};_0x2bd888(++_0x256f06);}(_0xa0d8,0x1ee));var _0x8a0d=function(_0x407425,_0x4972be){_0x407425=_0x407425-0x0;var _0x2e1109=_0xa0d8[_0x407425];return _0x2e1109;};'use strict';var _=require(_0x8a0d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8a0d('0x1'));var fs=require('fs');var Redis=require(_0x8a0d('0x2'));var db=require(_0x8a0d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a0d('0x4'))(_0x8a0d('0x5'));var config=require('../../config/environment');var jayson=require(_0x8a0d('0x6'));var client=jayson[_0x8a0d('0x7')][_0x8a0d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x114c77,_0x28c34c,_0x3bdfbf){return new BPromise(function(_0x1536dc,_0x1d0160){return client[_0x8a0d('0x9')](_0x114c77,_0x3bdfbf)[_0x8a0d('0xa')](function(_0x128782){logger['info'](_0x8a0d('0xb'),_0x28c34c,_0x8a0d('0xc'));logger[_0x8a0d('0xd')](_0x8a0d('0xe'),_0x28c34c,'request\x20sent',JSON[_0x8a0d('0xf')](_0x128782));if(_0x128782[_0x8a0d('0x10')]){if(_0x128782[_0x8a0d('0x10')][_0x8a0d('0x11')]===0x1f4){logger[_0x8a0d('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x28c34c,_0x128782[_0x8a0d('0x10')]['message']);return _0x1d0160(_0x128782[_0x8a0d('0x10')][_0x8a0d('0x12')]);}logger['error'](_0x8a0d('0xb'),_0x28c34c,_0x128782[_0x8a0d('0x10')][_0x8a0d('0x12')]);return _0x1536dc(_0x128782[_0x8a0d('0x10')][_0x8a0d('0x12')]);}else{logger[_0x8a0d('0x13')](_0x8a0d('0xb'),_0x28c34c,'request\x20sent');_0x1536dc(_0x128782[_0x8a0d('0x14')][_0x8a0d('0x12')]);}})[_0x8a0d('0x15')](function(_0x17792a){logger['error'](_0x8a0d('0xb'),_0x28c34c,_0x17792a);_0x1d0160(_0x17792a);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 19b3989..243305b 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 _0x4e9d=['get','isAuthenticated','index','/:id','show','post','update','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','./intSugarcrmField.controller'];(function(_0x49988d,_0x15dae4){var _0x2259f7=function(_0x1c964d){while(--_0x1c964d){_0x49988d['push'](_0x49988d['shift']());}};_0x2259f7(++_0x15dae4);}(_0x4e9d,0x1bc));var _0xd4e9=function(_0x4cddc9,_0x5e7f02){_0x4cddc9=_0x4cddc9-0x0;var _0x1b6f2b=_0x4e9d[_0x4cddc9];return _0x1b6f2b;};'use strict';var multer=require(_0xd4e9('0x0'));var util=require(_0xd4e9('0x1'));var path=require('path');var timeout=require(_0xd4e9('0x2'));var express=require(_0xd4e9('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd4e9('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd4e9('0x5'));router[_0xd4e9('0x6')]('/',auth[_0xd4e9('0x7')](),controller[_0xd4e9('0x8')]);router[_0xd4e9('0x6')](_0xd4e9('0x9'),auth[_0xd4e9('0x7')](),controller[_0xd4e9('0xa')]);router[_0xd4e9('0xb')]('/',auth[_0xd4e9('0x7')](),controller['create']);router['put'](_0xd4e9('0x9'),auth[_0xd4e9('0x7')](),controller[_0xd4e9('0xc')]);router['delete']('/:id',auth[_0xd4e9('0x7')](),controller[_0xd4e9('0xd')]);module[_0xd4e9('0xe')]=router; \ No newline at end of file +var _0x9368=['util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','show','put','/:id','delete','exports','multer'];(function(_0x1ba218,_0x572043){var _0x563346=function(_0x2a94ab){while(--_0x2a94ab){_0x1ba218['push'](_0x1ba218['shift']());}};_0x563346(++_0x572043);}(_0x9368,0xbf));var _0x8936=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x9368[_0x1beef3];return _0x5af964;};'use strict';var multer=require(_0x8936('0x0'));var util=require(_0x8936('0x1'));var path=require(_0x8936('0x2'));var timeout=require(_0x8936('0x3'));var express=require(_0x8936('0x4'));var router=express[_0x8936('0x5')]();var fs_extra=require(_0x8936('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8936('0x7'));var controller=require(_0x8936('0x8'));router[_0x8936('0x9')]('/',auth[_0x8936('0xa')](),controller['index']);router[_0x8936('0x9')]('/:id',auth[_0x8936('0xa')](),controller[_0x8936('0xb')]);router['post']('/',auth[_0x8936('0xa')](),controller['create']);router[_0x8936('0xc')](_0x8936('0xd'),auth[_0x8936('0xa')](),controller['update']);router[_0x8936('0xe')](_0x8936('0xd'),auth[_0x8936('0xa')](),controller['destroy']);module[_0x8936('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 8a98dfa..1f21a4c 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 _0x2639=['keyValue','picklist','STRING','ENUM','sequelize','string','variable','customVariable'];(function(_0x1f28bb,_0x355cdb){var _0x473d6e=function(_0x5debec){while(--_0x5debec){_0x1f28bb['push'](_0x1f28bb['shift']());}};_0x473d6e(++_0x355cdb);}(_0x2639,0xbc));var _0x9263=function(_0x2c9263,_0x45b0e7){_0x2c9263=_0x2c9263-0x0;var _0x562388=_0x2639[_0x2c9263];return _0x562388;};'use strict';var Sequelize=require(_0x9263('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x9263('0x1'),_0x9263('0x2'),_0x9263('0x3'),_0x9263('0x4'),_0x9263('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9263('0x6')]},'key':{'type':Sequelize[_0x9263('0x6')]},'keyType':{'type':Sequelize[_0x9263('0x7')](_0x9263('0x1'),'variable',_0x9263('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9263('0x6')]},'nameField':{'type':Sequelize[_0x9263('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9263('0x6')]}}; \ No newline at end of file +var _0x6233=['keyValue','picklist','string','STRING','BOOLEAN','exports','variable','customVariable'];(function(_0x59a85c,_0x39f54f){var _0x35580f=function(_0xd6f8f8){while(--_0xd6f8f8){_0x59a85c['push'](_0x59a85c['shift']());}};_0x35580f(++_0x39f54f);}(_0x6233,0x1a5));var _0x3623=function(_0xe05b25,_0x5376ab){_0xe05b25=_0xe05b25-0x0;var _0x1b143c=_0x6233[_0xe05b25];return _0x1b143c;};'use strict';var Sequelize=require('sequelize');module[_0x3623('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0x3623('0x1'),_0x3623('0x2'),_0x3623('0x3'),_0x3623('0x4')),'defaultValue':_0x3623('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3623('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x3623('0x5'),_0x3623('0x1'),_0x3623('0x2'))},'keyContent':{'type':Sequelize[_0x3623('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3623('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3623('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 3d9ba20..d0a6992 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 _0x4d86=['ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','error','stack','name','index','map','SugarcrmField','rawAttributes','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse'];(function(_0x594f0f,_0x3d69a3){var _0x190ca1=function(_0x52c4d9){while(--_0x52c4d9){_0x594f0f['push'](_0x594f0f['shift']());}};_0x190ca1(++_0x3d69a3);}(_0x4d86,0x15e));var _0x64d8=function(_0xf92b74,_0x1bf21f){_0xf92b74=_0xf92b74-0x0;var _0x413d99=_0x4d86[_0xf92b74];return _0x413d99;};'use strict';var emlformat=require(_0x64d8('0x0'));var rimraf=require(_0x64d8('0x1'));var zipdir=require(_0x64d8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x64d8('0x3'));var moment=require(_0x64d8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x64d8('0x5'));var path=require(_0x64d8('0x6'));var sox=require(_0x64d8('0x7'));var csv=require('to-csv');var ejs=require(_0x64d8('0x8'));var fs=require('fs');var fs_extra=require(_0x64d8('0x9'));var _=require('lodash');var squel=require(_0x64d8('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x64d8('0xb'));var toCsv=require(_0x64d8('0xc'));var querystring=require(_0x64d8('0xd'));var Papa=require(_0x64d8('0xe'));var Redis=require(_0x64d8('0xf'));var authService=require(_0x64d8('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64d8('0x11'));var logger=require('../../config/logger')(_0x64d8('0x12'));var utils=require(_0x64d8('0x13'));var config=require(_0x64d8('0x14'));var licenseUtil=require(_0x64d8('0x15'));var db=require(_0x64d8('0x16'))['db'];function respondWithStatusCode(_0x4fce62,_0x554c99){_0x554c99=_0x554c99||0xcc;return function(_0x2c4a16){if(_0x2c4a16){return _0x4fce62[_0x64d8('0x17')](_0x554c99);}return _0x4fce62['status'](_0x554c99)[_0x64d8('0x18')]();};}function respondWithResult(_0x152f6e,_0x2ec48b){_0x2ec48b=_0x2ec48b||0xc8;return function(_0x5920a7){if(_0x5920a7){return _0x152f6e[_0x64d8('0x19')](_0x2ec48b)[_0x64d8('0x1a')](_0x5920a7);}};}function respondWithFilteredResult(_0x1a0815,_0x41c785){return function(_0x4d3a47){if(_0x4d3a47){var _0x1851ba=typeof _0x41c785[_0x64d8('0x1b')]==='undefined'&&typeof _0x41c785['limit']===_0x64d8('0x1c');var _0x3d8694=_0x4d3a47[_0x64d8('0x1d')];var _0x30a6b7=_0x1851ba?0x0:_0x41c785[_0x64d8('0x1b')];var _0x503291=_0x1851ba?_0x4d3a47[_0x64d8('0x1d')]:_0x41c785['offset']+_0x41c785[_0x64d8('0x1e')];var _0x298b75;if(_0x503291>=_0x3d8694){_0x503291=_0x3d8694;_0x298b75=0xc8;}else{_0x298b75=0xce;}_0x1a0815['status'](_0x298b75);return _0x1a0815[_0x64d8('0x1f')](_0x64d8('0x20'),_0x30a6b7+'-'+_0x503291+'/'+_0x3d8694)[_0x64d8('0x1a')](_0x4d3a47);}return null;};}function patchUpdates(_0x2d8398){return function(_0x9f5e99){try{jsonpatch['apply'](_0x9f5e99,_0x2d8398,!![]);}catch(_0x4d8cdb){return BPromise[_0x64d8('0x21')](_0x4d8cdb);}return _0x9f5e99[_0x64d8('0x22')]();};}function saveUpdates(_0x1fb6a6,_0x5bd48d){return function(_0x2644be){if(_0x2644be){return _0x2644be[_0x64d8('0x23')](_0x1fb6a6)['then'](function(_0x4776eb){return _0x4776eb;});}return null;};}function removeEntity(_0x44f554,_0x262d2a){return function(_0x280486){if(_0x280486){return _0x280486[_0x64d8('0x24')]()[_0x64d8('0x25')](function(){_0x44f554[_0x64d8('0x19')](0xcc)[_0x64d8('0x18')]();});}};}function handleEntityNotFound(_0x1f14d8,_0x41061c){return function(_0x4e1eb2){if(!_0x4e1eb2){_0x1f14d8[_0x64d8('0x17')](0x194);}return _0x4e1eb2;};}function handleError(_0x1c443b,_0x4b190b){_0x4b190b=_0x4b190b||0x1f4;return function(_0x5e8e99){logger[_0x64d8('0x26')](_0x5e8e99[_0x64d8('0x27')]);if(_0x5e8e99[_0x64d8('0x28')]){delete _0x5e8e99[_0x64d8('0x28')];}_0x1c443b[_0x64d8('0x19')](_0x4b190b)['send'](_0x5e8e99);};}exports[_0x64d8('0x29')]=function(_0x507d06,_0x32d501){var _0x529a82={},_0xdbe145={},_0x6d5483={'count':0x0,'rows':[]};var _0x59a4a2=_[_0x64d8('0x2a')](db[_0x64d8('0x2b')][_0x64d8('0x2c')],function(_0x22044f){return{'name':_0x22044f['fieldName'],'type':_0x22044f[_0x64d8('0x2d')][_0x64d8('0x2e')]};});_0xdbe145['model']=_[_0x64d8('0x2a')](_0x59a4a2,_0x64d8('0x28'));_0xdbe145['query']=_[_0x64d8('0x2f')](_0x507d06[_0x64d8('0x30')]);_0xdbe145[_0x64d8('0x31')]=_[_0x64d8('0x32')](_0xdbe145['model'],_0xdbe145[_0x64d8('0x30')]);_0x529a82[_0x64d8('0x33')]=_[_0x64d8('0x32')](_0xdbe145[_0x64d8('0x34')],qs[_0x64d8('0x35')](_0x507d06[_0x64d8('0x30')][_0x64d8('0x35')]));_0x529a82['attributes']=_0x529a82[_0x64d8('0x33')][_0x64d8('0x36')]?_0x529a82['attributes']:_0xdbe145[_0x64d8('0x34')];if(!_0x507d06[_0x64d8('0x30')][_0x64d8('0x37')]('nolimit')){_0x529a82[_0x64d8('0x1e')]=qs[_0x64d8('0x1e')](_0x507d06[_0x64d8('0x30')][_0x64d8('0x1e')]);_0x529a82[_0x64d8('0x1b')]=qs[_0x64d8('0x1b')](_0x507d06['query']['offset']);}_0x529a82[_0x64d8('0x38')]=qs[_0x64d8('0x39')](_0x507d06[_0x64d8('0x30')][_0x64d8('0x39')]);_0x529a82[_0x64d8('0x3a')]=qs[_0x64d8('0x31')](_[_0x64d8('0x3b')](_0x507d06['query'],_0xdbe145[_0x64d8('0x31')]),_0x59a4a2);if(_0x507d06['query'][_0x64d8('0x3c')]){_0x529a82[_0x64d8('0x3a')]=_[_0x64d8('0x3d')](_0x529a82[_0x64d8('0x3a')],{'$or':_[_0x64d8('0x2a')](_0x59a4a2,function(_0x4b33e0){if(_0x4b33e0['type']!=='VIRTUAL'){var _0x50f9ce={};_0x50f9ce[_0x4b33e0['name']]={'$like':'%'+_0x507d06[_0x64d8('0x30')][_0x64d8('0x3c')]+'%'};return _0x50f9ce;}})});}_0x529a82=_[_0x64d8('0x3d')]({},_0x529a82,_0x507d06[_0x64d8('0x3e')]);var _0x1ecdd5={'where':_0x529a82[_0x64d8('0x3a')]};return db[_0x64d8('0x2b')][_0x64d8('0x1d')](_0x1ecdd5)[_0x64d8('0x25')](function(_0x57dc1e){_0x6d5483['count']=_0x57dc1e;if(_0x507d06[_0x64d8('0x30')][_0x64d8('0x3f')]){_0x529a82[_0x64d8('0x40')]=[{'all':!![]}];}return db[_0x64d8('0x2b')][_0x64d8('0x41')](_0x529a82);})[_0x64d8('0x25')](function(_0x256383){_0x6d5483[_0x64d8('0x42')]=_0x256383;return _0x6d5483;})['then'](respondWithFilteredResult(_0x32d501,_0x529a82))[_0x64d8('0x43')](handleError(_0x32d501,null));};exports[_0x64d8('0x44')]=function(_0xef3f5a,_0x57e8fb){var _0x29e80c={'raw':!![],'where':{'id':_0xef3f5a[_0x64d8('0x45')]['id']}},_0x2f766b={};_0x2f766b[_0x64d8('0x34')]=_[_0x64d8('0x2f')](db[_0x64d8('0x2b')][_0x64d8('0x2c')]);_0x2f766b[_0x64d8('0x30')]=_[_0x64d8('0x2f')](_0xef3f5a[_0x64d8('0x30')]);_0x2f766b[_0x64d8('0x31')]=_[_0x64d8('0x32')](_0x2f766b[_0x64d8('0x34')],_0x2f766b[_0x64d8('0x30')]);_0x29e80c[_0x64d8('0x33')]=_[_0x64d8('0x32')](_0x2f766b[_0x64d8('0x34')],qs['fields'](_0xef3f5a[_0x64d8('0x30')][_0x64d8('0x35')]));_0x29e80c['attributes']=_0x29e80c[_0x64d8('0x33')][_0x64d8('0x36')]?_0x29e80c[_0x64d8('0x33')]:_0x2f766b[_0x64d8('0x34')];if(_0xef3f5a[_0x64d8('0x30')]['includeAll']){_0x29e80c[_0x64d8('0x40')]=[{'all':!![]}];}_0x29e80c=_[_0x64d8('0x3d')]({},_0x29e80c,_0xef3f5a[_0x64d8('0x3e')]);return db[_0x64d8('0x2b')][_0x64d8('0x46')](_0x29e80c)[_0x64d8('0x25')](handleEntityNotFound(_0x57e8fb,null))['then'](respondWithResult(_0x57e8fb,null))['catch'](handleError(_0x57e8fb,null));};exports[_0x64d8('0x47')]=function(_0xeb98fe,_0x55d406){return db[_0x64d8('0x2b')][_0x64d8('0x47')](_0xeb98fe[_0x64d8('0x48')],{})[_0x64d8('0x25')](respondWithResult(_0x55d406,0xc9))[_0x64d8('0x43')](handleError(_0x55d406,null));};exports[_0x64d8('0x23')]=function(_0xfc3595,_0x1b5d1a){if(_0xfc3595[_0x64d8('0x48')]['id']){delete _0xfc3595[_0x64d8('0x48')]['id'];}return db[_0x64d8('0x2b')][_0x64d8('0x46')]({'where':{'id':_0xfc3595[_0x64d8('0x45')]['id']}})['then'](handleEntityNotFound(_0x1b5d1a,null))[_0x64d8('0x25')](saveUpdates(_0xfc3595[_0x64d8('0x48')],null))[_0x64d8('0x25')](respondWithResult(_0x1b5d1a,null))[_0x64d8('0x43')](handleError(_0x1b5d1a,null));};exports[_0x64d8('0x24')]=function(_0x5c1d76,_0x397157){return db[_0x64d8('0x2b')]['find']({'where':{'id':_0x5c1d76[_0x64d8('0x45')]['id']}})[_0x64d8('0x25')](handleEntityNotFound(_0x397157,null))[_0x64d8('0x25')](removeEntity(_0x397157,null))[_0x64d8('0x43')](handleError(_0x397157,null));}; \ No newline at end of file +var _0x27a9=['undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','SugarcrmField','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','options','include','findAll','rows','show','params','rawAttributes','keys','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit'];(function(_0x4dbfce,_0xf32dad){var _0xed4af1=function(_0x4ac0a9){while(--_0x4ac0a9){_0x4dbfce['push'](_0x4dbfce['shift']());}};_0xed4af1(++_0xf32dad);}(_0x27a9,0x1e2));var _0x927a=function(_0xa8f5ed,_0x37f782){_0xa8f5ed=_0xa8f5ed-0x0;var _0x99f5be=_0x27a9[_0xa8f5ed];return _0x99f5be;};'use strict';var emlformat=require(_0x927a('0x0'));var rimraf=require(_0x927a('0x1'));var zipdir=require(_0x927a('0x2'));var jsonpatch=require(_0x927a('0x3'));var rp=require(_0x927a('0x4'));var moment=require(_0x927a('0x5'));var BPromise=require(_0x927a('0x6'));var Mustache=require(_0x927a('0x7'));var util=require(_0x927a('0x8'));var path=require(_0x927a('0x9'));var sox=require('sox');var csv=require(_0x927a('0xa'));var ejs=require(_0x927a('0xb'));var fs=require('fs');var fs_extra=require(_0x927a('0xc'));var _=require(_0x927a('0xd'));var squel=require('squel');var crypto=require(_0x927a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x927a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x927a('0x10'));var Papa=require(_0x927a('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x927a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x927a('0x13'));var logger=require(_0x927a('0x14'))(_0x927a('0x15'));var utils=require(_0x927a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x927a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2194c8,_0x20a8dd){_0x20a8dd=_0x20a8dd||0xcc;return function(_0x2c0844){if(_0x2c0844){return _0x2194c8[_0x927a('0x18')](_0x20a8dd);}return _0x2194c8[_0x927a('0x19')](_0x20a8dd)['end']();};}function respondWithResult(_0x2e6df5,_0x3e60a6){_0x3e60a6=_0x3e60a6||0xc8;return function(_0x3fdc79){if(_0x3fdc79){return _0x2e6df5[_0x927a('0x19')](_0x3e60a6)[_0x927a('0x1a')](_0x3fdc79);}};}function respondWithFilteredResult(_0x5a7b78,_0x1d5b93){return function(_0x1d6fc7){if(_0x1d6fc7){var _0x2719ac=typeof _0x1d5b93[_0x927a('0x1b')]==='undefined'&&typeof _0x1d5b93[_0x927a('0x1c')]===_0x927a('0x1d');var _0x268588=_0x1d6fc7[_0x927a('0x1e')];var _0x583458=_0x2719ac?0x0:_0x1d5b93['offset'];var _0x3457ae=_0x2719ac?_0x1d6fc7[_0x927a('0x1e')]:_0x1d5b93[_0x927a('0x1b')]+_0x1d5b93['limit'];var _0x1168bf;if(_0x3457ae>=_0x268588){_0x3457ae=_0x268588;_0x1168bf=0xc8;}else{_0x1168bf=0xce;}_0x5a7b78[_0x927a('0x19')](_0x1168bf);return _0x5a7b78[_0x927a('0x1f')](_0x927a('0x20'),_0x583458+'-'+_0x3457ae+'/'+_0x268588)[_0x927a('0x1a')](_0x1d6fc7);}return null;};}function patchUpdates(_0x1bd464){return function(_0x404555){try{jsonpatch[_0x927a('0x21')](_0x404555,_0x1bd464,!![]);}catch(_0x163480){return BPromise[_0x927a('0x22')](_0x163480);}return _0x404555[_0x927a('0x23')]();};}function saveUpdates(_0x59dfe0,_0x51c3a8){return function(_0x303090){if(_0x303090){return _0x303090[_0x927a('0x24')](_0x59dfe0)['then'](function(_0xe377f4){return _0xe377f4;});}return null;};}function removeEntity(_0x562c56,_0x1af3dd){return function(_0x455c15){if(_0x455c15){return _0x455c15[_0x927a('0x25')]()[_0x927a('0x26')](function(){_0x562c56[_0x927a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26988b,_0xf8b0b1){return function(_0x2cd033){if(!_0x2cd033){_0x26988b[_0x927a('0x18')](0x194);}return _0x2cd033;};}function handleError(_0x2768d6,_0x55c8da){_0x55c8da=_0x55c8da||0x1f4;return function(_0x71a25d){logger[_0x927a('0x27')](_0x71a25d[_0x927a('0x28')]);if(_0x71a25d[_0x927a('0x29')]){delete _0x71a25d[_0x927a('0x29')];}_0x2768d6[_0x927a('0x19')](_0x55c8da)[_0x927a('0x2a')](_0x71a25d);};}exports['index']=function(_0x22561e,_0x25f88a){var _0x414a5f={},_0x524f1a={},_0x5cc9ee={'count':0x0,'rows':[]};var _0x52f2aa=_[_0x927a('0x2b')](db[_0x927a('0x2c')]['rawAttributes'],function(_0x5af706){return{'name':_0x5af706[_0x927a('0x2d')],'type':_0x5af706[_0x927a('0x2e')][_0x927a('0x2f')]};});_0x524f1a[_0x927a('0x30')]=_[_0x927a('0x2b')](_0x52f2aa,_0x927a('0x29'));_0x524f1a[_0x927a('0x31')]=_['keys'](_0x22561e[_0x927a('0x31')]);_0x524f1a[_0x927a('0x32')]=_[_0x927a('0x33')](_0x524f1a[_0x927a('0x30')],_0x524f1a['query']);_0x414a5f[_0x927a('0x34')]=_[_0x927a('0x33')](_0x524f1a['model'],qs[_0x927a('0x35')](_0x22561e[_0x927a('0x31')]['fields']));_0x414a5f[_0x927a('0x34')]=_0x414a5f[_0x927a('0x34')][_0x927a('0x36')]?_0x414a5f[_0x927a('0x34')]:_0x524f1a[_0x927a('0x30')];if(!_0x22561e[_0x927a('0x31')][_0x927a('0x37')]('nolimit')){_0x414a5f[_0x927a('0x1c')]=qs['limit'](_0x22561e[_0x927a('0x31')][_0x927a('0x1c')]);_0x414a5f['offset']=qs[_0x927a('0x1b')](_0x22561e[_0x927a('0x31')]['offset']);}_0x414a5f[_0x927a('0x38')]=qs[_0x927a('0x39')](_0x22561e[_0x927a('0x31')][_0x927a('0x39')]);_0x414a5f[_0x927a('0x3a')]=qs[_0x927a('0x32')](_[_0x927a('0x3b')](_0x22561e['query'],_0x524f1a[_0x927a('0x32')]),_0x52f2aa);if(_0x22561e[_0x927a('0x31')][_0x927a('0x3c')]){_0x414a5f[_0x927a('0x3a')]=_['merge'](_0x414a5f['where'],{'$or':_[_0x927a('0x2b')](_0x52f2aa,function(_0x189d65){if(_0x189d65[_0x927a('0x2e')]!=='VIRTUAL'){var _0x368ffe={};_0x368ffe[_0x189d65[_0x927a('0x29')]]={'$like':'%'+_0x22561e['query'][_0x927a('0x3c')]+'%'};return _0x368ffe;}})});}_0x414a5f=_['merge']({},_0x414a5f,_0x22561e[_0x927a('0x3d')]);var _0x5ced08={'where':_0x414a5f[_0x927a('0x3a')]};return db[_0x927a('0x2c')]['count'](_0x5ced08)['then'](function(_0x544310){_0x5cc9ee[_0x927a('0x1e')]=_0x544310;if(_0x22561e[_0x927a('0x31')]['includeAll']){_0x414a5f[_0x927a('0x3e')]=[{'all':!![]}];}return db[_0x927a('0x2c')][_0x927a('0x3f')](_0x414a5f);})[_0x927a('0x26')](function(_0x1cd689){_0x5cc9ee[_0x927a('0x40')]=_0x1cd689;return _0x5cc9ee;})[_0x927a('0x26')](respondWithFilteredResult(_0x25f88a,_0x414a5f))['catch'](handleError(_0x25f88a,null));};exports[_0x927a('0x41')]=function(_0x3c8aad,_0x25b1fd){var _0x50d7a3={'raw':!![],'where':{'id':_0x3c8aad[_0x927a('0x42')]['id']}},_0x2d8b87={};_0x2d8b87[_0x927a('0x30')]=_['keys'](db['SugarcrmField'][_0x927a('0x43')]);_0x2d8b87[_0x927a('0x31')]=_[_0x927a('0x44')](_0x3c8aad[_0x927a('0x31')]);_0x2d8b87['filters']=_[_0x927a('0x33')](_0x2d8b87[_0x927a('0x30')],_0x2d8b87['query']);_0x50d7a3['attributes']=_[_0x927a('0x33')](_0x2d8b87[_0x927a('0x30')],qs['fields'](_0x3c8aad[_0x927a('0x31')][_0x927a('0x35')]));_0x50d7a3[_0x927a('0x34')]=_0x50d7a3['attributes'][_0x927a('0x36')]?_0x50d7a3[_0x927a('0x34')]:_0x2d8b87[_0x927a('0x30')];if(_0x3c8aad[_0x927a('0x31')]['includeAll']){_0x50d7a3['include']=[{'all':!![]}];}_0x50d7a3=_['merge']({},_0x50d7a3,_0x3c8aad[_0x927a('0x3d')]);return db[_0x927a('0x2c')][_0x927a('0x45')](_0x50d7a3)[_0x927a('0x26')](handleEntityNotFound(_0x25b1fd,null))[_0x927a('0x26')](respondWithResult(_0x25b1fd,null))[_0x927a('0x46')](handleError(_0x25b1fd,null));};exports[_0x927a('0x47')]=function(_0x238ae8,_0x4a5789){return db[_0x927a('0x2c')][_0x927a('0x47')](_0x238ae8[_0x927a('0x48')],{})[_0x927a('0x26')](respondWithResult(_0x4a5789,0xc9))['catch'](handleError(_0x4a5789,null));};exports[_0x927a('0x24')]=function(_0x2ee9ec,_0x59e919){if(_0x2ee9ec[_0x927a('0x48')]['id']){delete _0x2ee9ec['body']['id'];}return db[_0x927a('0x2c')][_0x927a('0x45')]({'where':{'id':_0x2ee9ec[_0x927a('0x42')]['id']}})[_0x927a('0x26')](handleEntityNotFound(_0x59e919,null))[_0x927a('0x26')](saveUpdates(_0x2ee9ec[_0x927a('0x48')],null))['then'](respondWithResult(_0x59e919,null))['catch'](handleError(_0x59e919,null));};exports[_0x927a('0x25')]=function(_0x1c3873,_0x16fca9){return db[_0x927a('0x2c')][_0x927a('0x45')]({'where':{'id':_0x1c3873[_0x927a('0x42')]['id']}})[_0x927a('0x26')](handleEntityNotFound(_0x16fca9,null))[_0x927a('0x26')](removeEntity(_0x16fca9,null))[_0x927a('0x46')](handleError(_0x16fca9,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 2cec875..4f6f27a 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 _0xf0f5=['request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3b1520,_0x5168dd){var _0x422986=function(_0x11f1bf){while(--_0x11f1bf){_0x3b1520['push'](_0x3b1520['shift']());}};_0x422986(++_0x5168dd);}(_0xf0f5,0x89));var _0x5f0f=function(_0x5752f1,_0x3c9165){_0x5752f1=_0x5752f1-0x0;var _0x3c3ef1=_0xf0f5[_0x5752f1];return _0x3c3ef1;};'use strict';var _=require(_0x5f0f('0x0'));var util=require(_0x5f0f('0x1'));var logger=require(_0x5f0f('0x2'))(_0x5f0f('0x3'));var moment=require(_0x5f0f('0x4'));var BPromise=require(_0x5f0f('0x5'));var rp=require(_0x5f0f('0x6'));var fs=require('fs');var path=require(_0x5f0f('0x7'));var rimraf=require(_0x5f0f('0x8'));var config=require(_0x5f0f('0x9'));var attributes=require(_0x5f0f('0xa'));module['exports']=function(_0x7fd60c,_0xf0d28a){return _0x7fd60c['define']('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x5f0f('0xb'),_0x5f0f('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xebb7=['SugarcrmField','int_sugarcrm_fields','idField','lodash','util','../../config/logger','api','request-promise','path','rimraf','./intSugarcrmField.attributes','exports','define'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xebb7,0x162));var _0x7ebb=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xebb7[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0x7ebb('0x0'));var util=require(_0x7ebb('0x1'));var logger=require(_0x7ebb('0x2'))(_0x7ebb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7ebb('0x4'));var fs=require('fs');var path=require(_0x7ebb('0x5'));var rimraf=require(_0x7ebb('0x6'));var config=require('../../config/environment');var attributes=require(_0x7ebb('0x7'));module[_0x7ebb('0x8')]=function(_0x4ecfd1,_0x5948b7){return _0x4ecfd1[_0x7ebb('0x9')](_0x7ebb('0xa'),attributes,{'tableName':_0x7ebb('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x7ebb('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 9e13ace..017c110 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 _0x5e80=['error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SugarcrmField,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4c7b20,_0x361515){var _0x4872bd=function(_0x358e19){while(--_0x358e19){_0x4c7b20['push'](_0x4c7b20['shift']());}};_0x4872bd(++_0x361515);}(_0x5e80,0x1f2));var _0x05e8=function(_0x7fcd17,_0x9f66f8){_0x7fcd17=_0x7fcd17-0x0;var _0x2db383=_0x5e80[_0x7fcd17];return _0x2db383;};'use strict';var _=require(_0x05e8('0x0'));var util=require('util');var moment=require(_0x05e8('0x1'));var BPromise=require(_0x05e8('0x2'));var rs=require(_0x05e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05e8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x05e8('0x5'))(_0x05e8('0x6'));var config=require(_0x05e8('0x7'));var jayson=require(_0x05e8('0x8'));var client=jayson['client'][_0x05e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xfbedd5,_0x3d555e,_0x1016a9){return new BPromise(function(_0x5ce239,_0xcde5fa){return client[_0x05e8('0xa')](_0xfbedd5,_0x1016a9)['then'](function(_0x4368de){logger[_0x05e8('0xb')](_0x05e8('0xc'),_0x3d555e,'request\x20sent');logger['debug'](_0x05e8('0xd'),_0x3d555e,'request\x20sent',JSON[_0x05e8('0xe')](_0x4368de));if(_0x4368de['error']){if(_0x4368de[_0x05e8('0xf')][_0x05e8('0x10')]===0x1f4){logger[_0x05e8('0xf')](_0x05e8('0xc'),_0x3d555e,_0x4368de[_0x05e8('0xf')][_0x05e8('0x11')]);return _0xcde5fa(_0x4368de['error'][_0x05e8('0x11')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x3d555e,_0x4368de[_0x05e8('0xf')][_0x05e8('0x11')]);return _0x5ce239(_0x4368de[_0x05e8('0xf')][_0x05e8('0x11')]);}else{logger[_0x05e8('0xb')](_0x05e8('0xc'),_0x3d555e,'request\x20sent');_0x5ce239(_0x4368de[_0x05e8('0x12')][_0x05e8('0x11')]);}})['catch'](function(_0x541044){logger[_0x05e8('0xf')](_0x05e8('0xc'),_0x3d555e,_0x541044);_0xcde5fa(_0x541044);});});} \ No newline at end of file +var _0x9174=['error','code','message','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5d75a6,_0x4012ea){var _0x801009=function(_0x5cc872){while(--_0x5cc872){_0x5d75a6['push'](_0x5d75a6['shift']());}};_0x801009(++_0x4012ea);}(_0x9174,0x17d));var _0x4917=function(_0x4f1bbc,_0x33d39d){_0x4f1bbc=_0x4f1bbc-0x0;var _0x2fae93=_0x9174[_0x4f1bbc];return _0x2fae93;};'use strict';var _=require(_0x4917('0x0'));var util=require('util');var moment=require(_0x4917('0x1'));var BPromise=require(_0x4917('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4917('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4917('0x4'));var logger=require(_0x4917('0x5'))('rpc');var config=require(_0x4917('0x6'));var jayson=require(_0x4917('0x7'));var client=jayson['client'][_0x4917('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x112f0b,_0x368ff2,_0x5c3b7a){return new BPromise(function(_0x89f0a,_0x223f88){return client[_0x4917('0x9')](_0x112f0b,_0x5c3b7a)[_0x4917('0xa')](function(_0x4458b0){logger[_0x4917('0xb')](_0x4917('0xc'),_0x368ff2,_0x4917('0xd'));logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x368ff2,_0x4917('0xd'),JSON[_0x4917('0xe')](_0x4458b0));if(_0x4458b0[_0x4917('0xf')]){if(_0x4458b0[_0x4917('0xf')][_0x4917('0x10')]===0x1f4){logger[_0x4917('0xf')](_0x4917('0xc'),_0x368ff2,_0x4458b0[_0x4917('0xf')][_0x4917('0x11')]);return _0x223f88(_0x4458b0[_0x4917('0xf')][_0x4917('0x11')]);}logger[_0x4917('0xf')](_0x4917('0xc'),_0x368ff2,_0x4458b0[_0x4917('0xf')][_0x4917('0x11')]);return _0x89f0a(_0x4458b0[_0x4917('0xf')][_0x4917('0x11')]);}else{logger[_0x4917('0xb')](_0x4917('0xc'),_0x368ff2,'request\x20sent');_0x89f0a(_0x4458b0['result'][_0x4917('0x11')]);}})['catch'](function(_0x218d97){logger['error'](_0x4917('0xc'),_0x368ff2,_0x218d97);_0x223f88(_0x218d97);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 0d507b5..c21329e 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 _0x046b=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','exports','util','path','connect-timeout'];(function(_0x5c509c,_0x123d62){var _0x3da3be=function(_0xb01776){while(--_0xb01776){_0x5c509c['push'](_0x5c509c['shift']());}};_0x3da3be(++_0x123d62);}(_0x046b,0x147));var _0xb046=function(_0x23b3b7,_0x3243a9){_0x23b3b7=_0x23b3b7-0x0;var _0x44cbeb=_0x046b[_0x23b3b7];return _0x44cbeb;};'use strict';var multer=require('multer');var util=require(_0xb046('0x0'));var path=require(_0xb046('0x1'));var timeout=require(_0xb046('0x2'));var express=require(_0xb046('0x3'));var router=express[_0xb046('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb046('0x5'));var interaction=require(_0xb046('0x6'));var config=require(_0xb046('0x7'));var controller=require(_0xb046('0x8'));router[_0xb046('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb046('0x9')](_0xb046('0xa'),auth[_0xb046('0xb')](),controller[_0xb046('0xc')]);router[_0xb046('0x9')](_0xb046('0xd'),auth[_0xb046('0xb')](),controller[_0xb046('0xe')]);router['get'](_0xb046('0xf'),auth['isAuthenticated'](),controller[_0xb046('0x10')]);router[_0xb046('0x11')]('/',auth[_0xb046('0xb')](),controller[_0xb046('0x12')]);router[_0xb046('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0xb046('0x13')](_0xb046('0xa'),auth['isAuthenticated'](),controller[_0xb046('0x14')]);router['delete'](_0xb046('0xa'),auth[_0xb046('0xb')](),controller['destroy']);module[_0xb046('0x15')]=router; \ No newline at end of file +var _0x43f5=['index','show','/:id/configurations','getFields','create','post','put','/:id','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated'];(function(_0x46d14b,_0x147907){var _0x367dfd=function(_0x117d8e){while(--_0x117d8e){_0x46d14b['push'](_0x46d14b['shift']());}};_0x367dfd(++_0x147907);}(_0x43f5,0x9d));var _0x543f=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x43f5[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x543f('0x0'));var util=require(_0x543f('0x1'));var path=require('path');var timeout=require(_0x543f('0x2'));var express=require(_0x543f('0x3'));var router=express[_0x543f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x543f('0x5'));var interaction=require(_0x543f('0x6'));var config=require(_0x543f('0x7'));var controller=require(_0x543f('0x8'));router[_0x543f('0x9')]('/',auth[_0x543f('0xa')](),controller[_0x543f('0xb')]);router[_0x543f('0x9')]('/:id',auth[_0x543f('0xa')](),controller[_0x543f('0xc')]);router[_0x543f('0x9')](_0x543f('0xd'),auth[_0x543f('0xa')](),controller['getConfigurations']);router[_0x543f('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x543f('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x543f('0xf')]);router[_0x543f('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x543f('0x11')](_0x543f('0x12'),auth[_0x543f('0xa')](),controller['update']);router[_0x543f('0x13')](_0x543f('0x12'),auth[_0x543f('0xa')](),controller['destroy']);module[_0x543f('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 229bdff..9daa630 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 _0x269c=['STRING','HelpDesk'];(function(_0x2c94cb,_0x5efec5){var _0x43e767=function(_0x135982){while(--_0x135982){_0x2c94cb['push'](_0x2c94cb['shift']());}};_0x43e767(++_0x5efec5);}(_0x269c,0xb8));var _0xc269=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x269c[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc269('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xc269('0x0')]},'username':{'type':Sequelize[_0xc269('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xc269('0x0')],'allowNull':![],'defaultValue':_0xc269('0x1')},'remoteUri':{'type':Sequelize[_0xc269('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x5f22=['STRING','sequelize'];(function(_0x42f29e,_0xe41cc0){var _0xf6a61=function(_0x175932){while(--_0x175932){_0x42f29e['push'](_0x42f29e['shift']());}};_0xf6a61(++_0xe41cc0);}(_0x5f22,0x187));var _0x25f2=function(_0x406fbb,_0x1093e5){_0x406fbb=_0x406fbb-0x0;var _0x8e921d=_0x5f22[_0x406fbb];return _0x8e921d;};'use strict';var Sequelize=require(_0x25f2('0x0'));module['exports']={'name':{'type':Sequelize[_0x25f2('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x25f2('0x1')]},'username':{'type':Sequelize[_0x25f2('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x25f2('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x25f2('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x25f2('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 4b365aa..9e74f5a 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 _0x68f9=['GET','getchallenge','success','POST','token','describe','result','sessionName','owner','remove','includes','editable','label','startsWith','picklist','picklistValues','value','log','test','statusCode','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','VtigerAccount','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','params','length','find','create','body','findOne','VtigerConfiguration','getConfigurations','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','VtigerField','getFields','description','moduleName','remoteUri','serverUrl','accessKey','username','format','%s/webservice.php'];(function(_0x285a2a,_0x4580d6){var _0x26372a=function(_0x58050b){while(--_0x58050b){_0x285a2a['push'](_0x285a2a['shift']());}};_0x26372a(++_0x4580d6);}(_0x68f9,0x165));var _0x968f=function(_0x4920f8,_0x2872ba){_0x4920f8=_0x4920f8-0x0;var _0x2a27ee=_0x68f9[_0x4920f8];return _0x2a27ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x968f('0x0'));var zipdir=require(_0x968f('0x1'));var jsonpatch=require(_0x968f('0x2'));var rp=require('request-promise');var moment=require(_0x968f('0x3'));var BPromise=require(_0x968f('0x4'));var Mustache=require(_0x968f('0x5'));var util=require(_0x968f('0x6'));var path=require(_0x968f('0x7'));var sox=require(_0x968f('0x8'));var csv=require(_0x968f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x968f('0xa'));var _=require(_0x968f('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x968f('0xc'));var deskjs=require(_0x968f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x968f('0xe'));var Redis=require(_0x968f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x968f('0x10'));var as=require(_0x968f('0x11'));var hardwareService=require(_0x968f('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x968f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x968f('0x14'));var db=require(_0x968f('0x15'))['db'];var integrations=require(_0x968f('0x16'));function respondWithStatusCode(_0x58dfe1,_0x2b2976){_0x2b2976=_0x2b2976||0xcc;return function(_0x370a07){if(_0x370a07){return _0x58dfe1[_0x968f('0x17')](_0x2b2976);}return _0x58dfe1['status'](_0x2b2976)[_0x968f('0x18')]();};}function respondWithResult(_0x37fae2,_0x4decb4){_0x4decb4=_0x4decb4||0xc8;return function(_0x21651b){if(_0x21651b){return _0x37fae2[_0x968f('0x19')](_0x4decb4)[_0x968f('0x1a')](_0x21651b);}};}function respondWithFilteredResult(_0x55d808,_0x2c384a){return function(_0x8967ba){if(_0x8967ba){var _0x40cbf5=typeof _0x2c384a[_0x968f('0x1b')]==='undefined'&&typeof _0x2c384a['limit']===_0x968f('0x1c');var _0x39c6d5=_0x8967ba['count'];var _0x45d440=_0x40cbf5?0x0:_0x2c384a[_0x968f('0x1b')];var _0x581656=_0x40cbf5?_0x8967ba['count']:_0x2c384a['offset']+_0x2c384a['limit'];var _0x21107a;if(_0x581656>=_0x39c6d5){_0x581656=_0x39c6d5;_0x21107a=0xc8;}else{_0x21107a=0xce;}_0x55d808[_0x968f('0x19')](_0x21107a);return _0x55d808[_0x968f('0x1d')](_0x968f('0x1e'),_0x45d440+'-'+_0x581656+'/'+_0x39c6d5)[_0x968f('0x1a')](_0x8967ba);}return null;};}function patchUpdates(_0x27a975){return function(_0x35726e){try{jsonpatch[_0x968f('0x1f')](_0x35726e,_0x27a975,!![]);}catch(_0x74c8ef){return BPromise[_0x968f('0x20')](_0x74c8ef);}return _0x35726e['save']();};}function saveUpdates(_0x22c53b,_0x564e88){return function(_0x221951){if(_0x221951){return _0x221951[_0x968f('0x21')](_0x22c53b)[_0x968f('0x22')](function(_0x2d71b8){return _0x2d71b8;});}return null;};}function removeEntity(_0x4f22fe,_0x5c7903){return function(_0x2c9a4a){if(_0x2c9a4a){return _0x2c9a4a[_0x968f('0x23')]()['then'](function(){_0x4f22fe['status'](0xcc)[_0x968f('0x18')]();});}};}function handleEntityNotFound(_0x412ee5,_0x8612e6){return function(_0x14cdcf){if(!_0x14cdcf){_0x412ee5[_0x968f('0x17')](0x194);}return _0x14cdcf;};}function handleError(_0x3544d8,_0x47ee6f){_0x47ee6f=_0x47ee6f||0x1f4;return function(_0x175fc7){logger[_0x968f('0x24')](_0x175fc7['stack']);if(_0x175fc7[_0x968f('0x25')]){delete _0x175fc7[_0x968f('0x25')];}_0x3544d8['status'](_0x47ee6f)[_0x968f('0x26')](_0x175fc7);};}exports[_0x968f('0x27')]=function(_0x1071d6,_0x3e8b31){var _0x483589={},_0x555708={},_0x39c0a8={'count':0x0,'rows':[]};var _0x2d5d1=_[_0x968f('0x28')](db[_0x968f('0x29')]['rawAttributes'],function(_0x5cfd93){return{'name':_0x5cfd93['fieldName'],'type':_0x5cfd93[_0x968f('0x2a')][_0x968f('0x2b')]};});_0x555708[_0x968f('0x2c')]=_[_0x968f('0x28')](_0x2d5d1,_0x968f('0x25'));_0x555708[_0x968f('0x2d')]=_[_0x968f('0x2e')](_0x1071d6[_0x968f('0x2d')]);_0x555708[_0x968f('0x2f')]=_[_0x968f('0x30')](_0x555708[_0x968f('0x2c')],_0x555708[_0x968f('0x2d')]);_0x483589['attributes']=_[_0x968f('0x30')](_0x555708[_0x968f('0x2c')],qs[_0x968f('0x31')](_0x1071d6[_0x968f('0x2d')][_0x968f('0x31')]));_0x483589[_0x968f('0x32')]=_0x483589[_0x968f('0x32')]['length']?_0x483589[_0x968f('0x32')]:_0x555708['model'];if(!_0x1071d6[_0x968f('0x2d')][_0x968f('0x33')](_0x968f('0x34'))){_0x483589['limit']=qs[_0x968f('0x35')](_0x1071d6[_0x968f('0x2d')][_0x968f('0x35')]);_0x483589[_0x968f('0x1b')]=qs[_0x968f('0x1b')](_0x1071d6[_0x968f('0x2d')][_0x968f('0x1b')]);}_0x483589[_0x968f('0x36')]=qs[_0x968f('0x37')](_0x1071d6[_0x968f('0x2d')]['sort']);_0x483589['where']=qs[_0x968f('0x2f')](_[_0x968f('0x38')](_0x1071d6[_0x968f('0x2d')],_0x555708['filters']),_0x2d5d1);if(_0x1071d6[_0x968f('0x2d')]['filter']){_0x483589[_0x968f('0x39')]=_[_0x968f('0x3a')](_0x483589['where'],{'$or':_['map'](_0x2d5d1,function(_0x5c2a71){if(_0x5c2a71[_0x968f('0x2a')]!==_0x968f('0x3b')){var _0x211d96={};_0x211d96[_0x5c2a71['name']]={'$like':'%'+_0x1071d6[_0x968f('0x2d')][_0x968f('0x3c')]+'%'};return _0x211d96;}})});}_0x483589=_[_0x968f('0x3a')]({},_0x483589,_0x1071d6[_0x968f('0x3d')]);var _0x2bb186={'where':_0x483589[_0x968f('0x39')]};return db[_0x968f('0x29')][_0x968f('0x3e')](_0x2bb186)[_0x968f('0x22')](function(_0x5240f7){_0x39c0a8['count']=_0x5240f7;if(_0x1071d6[_0x968f('0x2d')][_0x968f('0x3f')]){_0x483589[_0x968f('0x40')]=[{'all':!![]}];}return db[_0x968f('0x29')][_0x968f('0x41')](_0x483589);})[_0x968f('0x22')](function(_0x20742e){_0x39c0a8[_0x968f('0x42')]=_0x20742e;return _0x39c0a8;})['then'](respondWithFilteredResult(_0x3e8b31,_0x483589))[_0x968f('0x43')](handleError(_0x3e8b31,null));};exports['show']=function(_0x541371,_0xb91cac){var _0x2141c4={'raw':![],'where':{'id':_0x541371[_0x968f('0x44')]['id']}},_0x1d55f5={};_0x1d55f5[_0x968f('0x2c')]=_[_0x968f('0x2e')](db[_0x968f('0x29')]['rawAttributes']);_0x1d55f5[_0x968f('0x2d')]=_[_0x968f('0x2e')](_0x541371[_0x968f('0x2d')]);_0x1d55f5[_0x968f('0x2f')]=_[_0x968f('0x30')](_0x1d55f5[_0x968f('0x2c')],_0x1d55f5[_0x968f('0x2d')]);_0x2141c4[_0x968f('0x32')]=_[_0x968f('0x30')](_0x1d55f5['model'],qs['fields'](_0x541371[_0x968f('0x2d')][_0x968f('0x31')]));_0x2141c4[_0x968f('0x32')]=_0x2141c4[_0x968f('0x32')][_0x968f('0x45')]?_0x2141c4[_0x968f('0x32')]:_0x1d55f5['model'];if(_0x541371[_0x968f('0x2d')][_0x968f('0x3f')]){_0x2141c4[_0x968f('0x40')]=[{'all':!![]}];}_0x2141c4=_['merge']({},_0x2141c4,_0x541371[_0x968f('0x3d')]);return db['VtigerAccount'][_0x968f('0x46')](_0x2141c4)[_0x968f('0x22')](handleEntityNotFound(_0xb91cac,null))['then'](respondWithResult(_0xb91cac,null))['catch'](handleError(_0xb91cac,null));};exports[_0x968f('0x47')]=function(_0x1f24ed,_0xb72658){return db[_0x968f('0x29')][_0x968f('0x47')](_0x1f24ed['body'],{})[_0x968f('0x22')](respondWithResult(_0xb72658,0xc9))[_0x968f('0x43')](handleError(_0xb72658,null));};exports['update']=function(_0x577328,_0x34f578){if(_0x577328[_0x968f('0x48')]['id']){delete _0x577328['body']['id'];}return db['VtigerAccount'][_0x968f('0x46')]({'where':{'id':_0x577328[_0x968f('0x44')]['id']}})['then'](handleEntityNotFound(_0x34f578,null))[_0x968f('0x22')](saveUpdates(_0x577328[_0x968f('0x48')],null))[_0x968f('0x22')](respondWithResult(_0x34f578,null))[_0x968f('0x43')](handleError(_0x34f578,null));};exports[_0x968f('0x23')]=function(_0x4f9939,_0x291f66){return db['VtigerAccount'][_0x968f('0x46')]({'where':{'id':_0x4f9939['params']['id']}})[_0x968f('0x22')](handleEntityNotFound(_0x291f66,null))[_0x968f('0x22')](removeEntity(_0x291f66,null))[_0x968f('0x43')](handleError(_0x291f66,null));};exports['getConfigurations']=function(_0x1572d7,_0x44a66d,_0x389279){var _0x166f9c={};var _0x107460={};var _0x5fb8c;var _0x43dc3b;return db['VtigerAccount'][_0x968f('0x49')]({'where':{'id':_0x1572d7[_0x968f('0x44')]['id']}})['then'](handleEntityNotFound(_0x44a66d,null))[_0x968f('0x22')](function(_0x58f837){if(_0x58f837){_0x5fb8c=_0x58f837;_0x107460[_0x968f('0x2c')]=_[_0x968f('0x2e')](db[_0x968f('0x4a')]['rawAttributes']);_0x107460[_0x968f('0x2d')]=_[_0x968f('0x2e')](_0x1572d7['query']);_0x107460[_0x968f('0x2f')]=_[_0x968f('0x30')](_0x107460[_0x968f('0x2c')],_0x107460[_0x968f('0x2d')]);_0x166f9c[_0x968f('0x32')]=_[_0x968f('0x30')](_0x107460[_0x968f('0x2c')],qs['fields'](_0x1572d7[_0x968f('0x2d')][_0x968f('0x31')]));_0x166f9c[_0x968f('0x32')]=_0x166f9c[_0x968f('0x32')][_0x968f('0x45')]?_0x166f9c['attributes']:_0x107460[_0x968f('0x2c')];_0x166f9c[_0x968f('0x36')]=qs[_0x968f('0x37')](_0x1572d7[_0x968f('0x2d')]['sort']);_0x166f9c['where']=qs[_0x968f('0x2f')](_['pick'](_0x1572d7[_0x968f('0x2d')],_0x107460[_0x968f('0x2f')]));if(_0x1572d7[_0x968f('0x2d')][_0x968f('0x3c')]){_0x166f9c[_0x968f('0x39')]=_[_0x968f('0x3a')](_0x166f9c[_0x968f('0x39')],{'$or':_[_0x968f('0x28')](_0x166f9c[_0x968f('0x32')],function(_0x1d3fc9){var _0x255770={};_0x255770[_0x1d3fc9]={'$like':'%'+_0x1572d7[_0x968f('0x2d')][_0x968f('0x3c')]+'%'};return _0x255770;})});}_0x166f9c=_[_0x968f('0x3a')]({},_0x166f9c,_0x1572d7['options']);return _0x5fb8c[_0x968f('0x4b')](_0x166f9c);}})['then'](function(_0x21499c){if(_0x21499c){_0x43dc3b=_0x21499c[_0x968f('0x45')];if(!_0x1572d7[_0x968f('0x2d')][_0x968f('0x33')](_0x968f('0x34'))){_0x166f9c[_0x968f('0x35')]=qs[_0x968f('0x35')](_0x1572d7[_0x968f('0x2d')][_0x968f('0x35')]);_0x166f9c[_0x968f('0x1b')]=qs[_0x968f('0x1b')](_0x1572d7[_0x968f('0x2d')][_0x968f('0x1b')]);}return _0x5fb8c[_0x968f('0x4b')](_0x166f9c);}})[_0x968f('0x22')](function(_0x22463f){if(_0x22463f){return _0x22463f?{'count':_0x43dc3b,'rows':_0x22463f}:null;}})['then'](respondWithResult(_0x44a66d,null))[_0x968f('0x43')](handleError(_0x44a66d,null));};exports['addConfiguration']=function(_0x43936a,_0x5b6e8a,_0x35b173){if(_0x43936a[_0x968f('0x48')]['id']){delete _0x43936a[_0x968f('0x48')]['id'];}return db[_0x968f('0x29')]['findOne']({'where':{'id':_0x43936a['params']['id']}})['then'](handleEntityNotFound(_0x5b6e8a,null))[_0x968f('0x22')](function(_0xc9743a){if(_0xc9743a){_0x43936a[_0x968f('0x48')][_0x968f('0x4c')]=_0xc9743a['id'];_0x43936a[_0x968f('0x48')][_0x968f('0x4d')]=integrations[_0x968f('0x4e')](_0x43936a['body']['channel'],_0x43936a[_0x968f('0x48')][_0x968f('0x2a')]);_0x43936a['body'][_0x968f('0x4f')]=integrations[_0x968f('0x50')](_0x43936a[_0x968f('0x48')]['channel'],_0x43936a[_0x968f('0x48')][_0x968f('0x2a')]);return db[_0x968f('0x4a')][_0x968f('0x47')](_0x43936a['body'],{'include':[{'model':db[_0x968f('0x51')],'as':_0x968f('0x4d')},{'model':db[_0x968f('0x51')],'as':_0x968f('0x4f')}]});}return null;})[_0x968f('0x22')](respondWithResult(_0x5b6e8a,null))['catch'](handleError(_0x5b6e8a,null));};var md5=require('md5');exports[_0x968f('0x52')]=function(_0x54e26e,_0x1195d4,_0x314702){var _0x22257c=null;var _0x1e56ab=null;var _0x9dee96=null;var _0x45da86=null;var _0x1f9699='';return db[_0x968f('0x29')][_0x968f('0x49')]({'where':{'id':_0x54e26e['params']['id']},'attributes':['id','name','username',_0x968f('0x53'),_0x968f('0x54'),_0x968f('0x55'),_0x968f('0x56'),_0x968f('0x57')]})[_0x968f('0x22')](handleEntityNotFound(_0x1195d4,null))[_0x968f('0x22')](function(_0xadc52c){if(_0xadc52c){_0x22257c=_0xadc52c[_0x968f('0x58')];_0x1e56ab=_0xadc52c['accessKey'];_0x9dee96=_0xadc52c[_0x968f('0x54')];_0x1f9699=_0xadc52c['remoteUri'];var _0x39f766=_0x1f9699['slice'](-0x1);if(_0x39f766==='/'){_0x1f9699=_0x1f9699['substring'](0x0,_0x1f9699['lastIndexOf'](_0x39f766));}_0x45da86=util[_0x968f('0x59')](_0x968f('0x5a'),_0x1f9699);var _0x2160ea={'method':_0x968f('0x5b'),'uri':_0x45da86,'qs':{'operation':_0x968f('0x5c'),'username':_0xadc52c['username']},'json':!![]};return rp(_0x2160ea);}})[_0x968f('0x22')](function(_0x452e0a){if(_0x452e0a[_0x968f('0x5d')]){var _0x3d4611={'method':_0x968f('0x5e'),'uri':_0x45da86,'form':{'operation':'login','username':_0x22257c,'accessKey':md5(_0x452e0a['result'][_0x968f('0x5f')]+_0x1e56ab)},'json':!![]};return rp(_0x3d4611);}})[_0x968f('0x22')](function(_0x30cb71){if(_0x30cb71[_0x968f('0x5d')]){var _0x28330b={'method':'GET','uri':_0x45da86,'qs':{'operation':_0x968f('0x60'),'username':_0x22257c,'sessionName':_0x30cb71[_0x968f('0x61')][_0x968f('0x62')],'elementType':_0x9dee96},'json':!![]};return rp(_0x28330b);}})['then'](function(_0xc9feba){if(_0xc9feba[_0x968f('0x5d')]){var _0x290426=['autogenerated','reference',_0x968f('0x63')];_[_0x968f('0x64')](_0xc9feba[_0x968f('0x61')][_0x968f('0x31')],function(_0x5b22d7){return _0x290426[_0x968f('0x65')](_0x5b22d7[_0x968f('0x2a')][_0x968f('0x25')]);});_[_0x968f('0x64')](_0xc9feba[_0x968f('0x61')][_0x968f('0x31')],function(_0x3078cf){return _0x3078cf[_0x968f('0x66')]==='false';});return{'count':_0xc9feba[_0x968f('0x61')]['fields'][_0x968f('0x45')],'rows':_[_0x968f('0x28')](_0xc9feba[_0x968f('0x61')][_0x968f('0x31')],function(_0x37597b){return{'id':_0x37597b[_0x968f('0x25')],'name':_0x37597b[_0x968f('0x67')],'custom':_[_0x968f('0x68')](_0x37597b[_0x968f('0x25')],'cf_')?!![]:![],'options':_0x37597b[_0x968f('0x2a')]['name']===_0x968f('0x69')&&_0x37597b[_0x968f('0x2a')][_0x968f('0x6a')]['length']>0x0?_['map'](_0x37597b[_0x968f('0x2a')][_0x968f('0x6a')],function(_0x442c58){return{'name':_0x442c58[_0x968f('0x67')],'value':_0x442c58[_0x968f('0x6b')]};}):[]};})};}})[_0x968f('0x22')](respondWithResult(_0x1195d4,null))['catch'](function(_0x5e0330){console[_0x968f('0x6c')]('vTiger\x20error:\x20'+_0x5e0330);var _0x4aaf83=_0x54e26e[_0x968f('0x2d')][_0x968f('0x6d')]?0x1f4:_0x5e0330[_0x968f('0x6e')]||0x1f4;logger[_0x968f('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x968f('0x52'),_0x4aaf83,JSON['stringify'](_0x5e0330));delete _0x5e0330[_0x968f('0x25')];if(_0x4aaf83===0x191){_0x4aaf83=0x190;}_0x1195d4[_0x968f('0x19')](_0x4aaf83)['send'](_0x54e26e[_0x968f('0x2d')][_0x968f('0x6d')]?{'message':_0x968f('0x6f'),'statusCode':_0x5e0330[_0x968f('0x6e')]}:_0x5e0330);});}; \ No newline at end of file +var _0xf30e=['includes','editable','label','startsWith','cf_','picklist','picklistValues','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','error','name','send','index','map','rawAttributes','type','model','query','keys','attributes','intersection','fields','nolimit','order','sort','filters','pick','where','VIRTUAL','filter','merge','options','includeAll','findAll','rows','show','params','VtigerAccount','length','find','catch','create','body','destroy','findOne','getConfigurations','hasOwnProperty','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerField','getFields','username','description','moduleName','remoteUri','accessKey','substring','lastIndexOf','%s/webservice.php','GET','success','login','result','token','describe','autogenerated','owner'];(function(_0x9307ea,_0x38968a){var _0x295554=function(_0x342dcf){while(--_0x342dcf){_0x9307ea['push'](_0x9307ea['shift']());}};_0x295554(++_0x38968a);}(_0xf30e,0xe7));var _0xef30=function(_0x4b26b5,_0x4f71fd){_0x4b26b5=_0x4b26b5-0x0;var _0x4dec71=_0xf30e[_0x4b26b5];return _0x4dec71;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xef30('0x0'));var rp=require(_0xef30('0x1'));var moment=require(_0xef30('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xef30('0x3'));var util=require('util');var path=require(_0xef30('0x4'));var sox=require(_0xef30('0x5'));var csv=require(_0xef30('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef30('0x7'));var _=require(_0xef30('0x8'));var squel=require(_0xef30('0x9'));var crypto=require('crypto');var jsforce=require(_0xef30('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xef30('0x6'));var querystring=require(_0xef30('0xb'));var Papa=require(_0xef30('0xc'));var Redis=require('ioredis');var authService=require(_0xef30('0xd'));var qs=require(_0xef30('0xe'));var as=require(_0xef30('0xf'));var hardwareService=require(_0xef30('0x10'));var logger=require(_0xef30('0x11'))(_0xef30('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xef30('0x13'));var db=require(_0xef30('0x14'))['db'];var integrations=require(_0xef30('0x15'));function respondWithStatusCode(_0x59dcff,_0x54e806){_0x54e806=_0x54e806||0xcc;return function(_0x338f28){if(_0x338f28){return _0x59dcff['sendStatus'](_0x54e806);}return _0x59dcff['status'](_0x54e806)[_0xef30('0x16')]();};}function respondWithResult(_0x43ad40,_0x11b7ea){_0x11b7ea=_0x11b7ea||0xc8;return function(_0x1ba108){if(_0x1ba108){return _0x43ad40[_0xef30('0x17')](_0x11b7ea)[_0xef30('0x18')](_0x1ba108);}};}function respondWithFilteredResult(_0x5486ee,_0xc26d94){return function(_0x24d7f3){if(_0x24d7f3){var _0x546a52=typeof _0xc26d94[_0xef30('0x19')]==='undefined'&&typeof _0xc26d94[_0xef30('0x1a')]==='undefined';var _0x497617=_0x24d7f3[_0xef30('0x1b')];var _0x5f1dac=_0x546a52?0x0:_0xc26d94[_0xef30('0x19')];var _0x6ef6db=_0x546a52?_0x24d7f3['count']:_0xc26d94[_0xef30('0x19')]+_0xc26d94[_0xef30('0x1a')];var _0x3f8567;if(_0x6ef6db>=_0x497617){_0x6ef6db=_0x497617;_0x3f8567=0xc8;}else{_0x3f8567=0xce;}_0x5486ee[_0xef30('0x17')](_0x3f8567);return _0x5486ee[_0xef30('0x1c')](_0xef30('0x1d'),_0x5f1dac+'-'+_0x6ef6db+'/'+_0x497617)[_0xef30('0x18')](_0x24d7f3);}return null;};}function patchUpdates(_0x381f30){return function(_0x4a28c3){try{jsonpatch[_0xef30('0x1e')](_0x4a28c3,_0x381f30,!![]);}catch(_0x2a3716){return BPromise[_0xef30('0x1f')](_0x2a3716);}return _0x4a28c3[_0xef30('0x20')]();};}function saveUpdates(_0xcaf496,_0x4424b6){return function(_0x30dec4){if(_0x30dec4){return _0x30dec4['update'](_0xcaf496)['then'](function(_0x4a83d7){return _0x4a83d7;});}return null;};}function removeEntity(_0x3414d9,_0x2767e5){return function(_0x2c2b70){if(_0x2c2b70){return _0x2c2b70['destroy']()[_0xef30('0x21')](function(){_0x3414d9[_0xef30('0x17')](0xcc)[_0xef30('0x16')]();});}};}function handleEntityNotFound(_0x2a7398,_0x10e2d1){return function(_0x4e9645){if(!_0x4e9645){_0x2a7398[_0xef30('0x22')](0x194);}return _0x4e9645;};}function handleError(_0x25cf12,_0x228edf){_0x228edf=_0x228edf||0x1f4;return function(_0x5bd5fa){logger[_0xef30('0x23')](_0x5bd5fa['stack']);if(_0x5bd5fa[_0xef30('0x24')]){delete _0x5bd5fa['name'];}_0x25cf12[_0xef30('0x17')](_0x228edf)[_0xef30('0x25')](_0x5bd5fa);};}exports[_0xef30('0x26')]=function(_0x133851,_0x8498ab){var _0x10ec55={},_0x5ae69e={},_0x1bec3d={'count':0x0,'rows':[]};var _0x34f9ec=_[_0xef30('0x27')](db['VtigerAccount'][_0xef30('0x28')],function(_0x190f34){return{'name':_0x190f34['fieldName'],'type':_0x190f34[_0xef30('0x29')]['key']};});_0x5ae69e[_0xef30('0x2a')]=_['map'](_0x34f9ec,_0xef30('0x24'));_0x5ae69e[_0xef30('0x2b')]=_[_0xef30('0x2c')](_0x133851['query']);_0x5ae69e['filters']=_['intersection'](_0x5ae69e[_0xef30('0x2a')],_0x5ae69e[_0xef30('0x2b')]);_0x10ec55[_0xef30('0x2d')]=_[_0xef30('0x2e')](_0x5ae69e[_0xef30('0x2a')],qs[_0xef30('0x2f')](_0x133851[_0xef30('0x2b')][_0xef30('0x2f')]));_0x10ec55['attributes']=_0x10ec55[_0xef30('0x2d')]['length']?_0x10ec55[_0xef30('0x2d')]:_0x5ae69e['model'];if(!_0x133851[_0xef30('0x2b')]['hasOwnProperty'](_0xef30('0x30'))){_0x10ec55[_0xef30('0x1a')]=qs[_0xef30('0x1a')](_0x133851[_0xef30('0x2b')][_0xef30('0x1a')]);_0x10ec55['offset']=qs['offset'](_0x133851['query'][_0xef30('0x19')]);}_0x10ec55[_0xef30('0x31')]=qs[_0xef30('0x32')](_0x133851[_0xef30('0x2b')][_0xef30('0x32')]);_0x10ec55['where']=qs[_0xef30('0x33')](_[_0xef30('0x34')](_0x133851[_0xef30('0x2b')],_0x5ae69e[_0xef30('0x33')]),_0x34f9ec);if(_0x133851[_0xef30('0x2b')]['filter']){_0x10ec55[_0xef30('0x35')]=_['merge'](_0x10ec55['where'],{'$or':_[_0xef30('0x27')](_0x34f9ec,function(_0x5b531f){if(_0x5b531f[_0xef30('0x29')]!==_0xef30('0x36')){var _0x3fc211={};_0x3fc211[_0x5b531f[_0xef30('0x24')]]={'$like':'%'+_0x133851[_0xef30('0x2b')][_0xef30('0x37')]+'%'};return _0x3fc211;}})});}_0x10ec55=_[_0xef30('0x38')]({},_0x10ec55,_0x133851[_0xef30('0x39')]);var _0x58c3d7={'where':_0x10ec55['where']};return db['VtigerAccount']['count'](_0x58c3d7)['then'](function(_0xe08292){_0x1bec3d[_0xef30('0x1b')]=_0xe08292;if(_0x133851['query'][_0xef30('0x3a')]){_0x10ec55['include']=[{'all':!![]}];}return db['VtigerAccount'][_0xef30('0x3b')](_0x10ec55);})[_0xef30('0x21')](function(_0x360cc5){_0x1bec3d[_0xef30('0x3c')]=_0x360cc5;return _0x1bec3d;})['then'](respondWithFilteredResult(_0x8498ab,_0x10ec55))['catch'](handleError(_0x8498ab,null));};exports[_0xef30('0x3d')]=function(_0x5cb1fb,_0x27a183){var _0x36f10c={'raw':![],'where':{'id':_0x5cb1fb[_0xef30('0x3e')]['id']}},_0x2656c5={};_0x2656c5[_0xef30('0x2a')]=_[_0xef30('0x2c')](db[_0xef30('0x3f')][_0xef30('0x28')]);_0x2656c5[_0xef30('0x2b')]=_[_0xef30('0x2c')](_0x5cb1fb['query']);_0x2656c5[_0xef30('0x33')]=_[_0xef30('0x2e')](_0x2656c5['model'],_0x2656c5[_0xef30('0x2b')]);_0x36f10c[_0xef30('0x2d')]=_['intersection'](_0x2656c5[_0xef30('0x2a')],qs['fields'](_0x5cb1fb['query']['fields']));_0x36f10c['attributes']=_0x36f10c[_0xef30('0x2d')][_0xef30('0x40')]?_0x36f10c['attributes']:_0x2656c5[_0xef30('0x2a')];if(_0x5cb1fb[_0xef30('0x2b')][_0xef30('0x3a')]){_0x36f10c['include']=[{'all':!![]}];}_0x36f10c=_[_0xef30('0x38')]({},_0x36f10c,_0x5cb1fb['options']);return db['VtigerAccount'][_0xef30('0x41')](_0x36f10c)['then'](handleEntityNotFound(_0x27a183,null))[_0xef30('0x21')](respondWithResult(_0x27a183,null))[_0xef30('0x42')](handleError(_0x27a183,null));};exports['create']=function(_0x69fa2b,_0x157525){return db[_0xef30('0x3f')][_0xef30('0x43')](_0x69fa2b[_0xef30('0x44')],{})[_0xef30('0x21')](respondWithResult(_0x157525,0xc9))['catch'](handleError(_0x157525,null));};exports['update']=function(_0x13b89a,_0x21a60c){if(_0x13b89a[_0xef30('0x44')]['id']){delete _0x13b89a[_0xef30('0x44')]['id'];}return db[_0xef30('0x3f')]['find']({'where':{'id':_0x13b89a[_0xef30('0x3e')]['id']}})[_0xef30('0x21')](handleEntityNotFound(_0x21a60c,null))[_0xef30('0x21')](saveUpdates(_0x13b89a['body'],null))[_0xef30('0x21')](respondWithResult(_0x21a60c,null))['catch'](handleError(_0x21a60c,null));};exports[_0xef30('0x45')]=function(_0x96344a,_0x5ce331){return db['VtigerAccount'][_0xef30('0x41')]({'where':{'id':_0x96344a[_0xef30('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5ce331,null))['then'](removeEntity(_0x5ce331,null))['catch'](handleError(_0x5ce331,null));};exports['getConfigurations']=function(_0x311f56,_0x461fb3,_0x4122ef){var _0x5390bd={};var _0x5a3954={};var _0x7a70d9;var _0x1974d7;return db[_0xef30('0x3f')][_0xef30('0x46')]({'where':{'id':_0x311f56['params']['id']}})[_0xef30('0x21')](handleEntityNotFound(_0x461fb3,null))['then'](function(_0x3223c9){if(_0x3223c9){_0x7a70d9=_0x3223c9;_0x5a3954[_0xef30('0x2a')]=_[_0xef30('0x2c')](db['VtigerConfiguration'][_0xef30('0x28')]);_0x5a3954['query']=_[_0xef30('0x2c')](_0x311f56[_0xef30('0x2b')]);_0x5a3954['filters']=_[_0xef30('0x2e')](_0x5a3954[_0xef30('0x2a')],_0x5a3954[_0xef30('0x2b')]);_0x5390bd[_0xef30('0x2d')]=_['intersection'](_0x5a3954['model'],qs[_0xef30('0x2f')](_0x311f56[_0xef30('0x2b')][_0xef30('0x2f')]));_0x5390bd[_0xef30('0x2d')]=_0x5390bd[_0xef30('0x2d')]['length']?_0x5390bd[_0xef30('0x2d')]:_0x5a3954[_0xef30('0x2a')];_0x5390bd['order']=qs[_0xef30('0x32')](_0x311f56[_0xef30('0x2b')][_0xef30('0x32')]);_0x5390bd[_0xef30('0x35')]=qs['filters'](_[_0xef30('0x34')](_0x311f56[_0xef30('0x2b')],_0x5a3954['filters']));if(_0x311f56[_0xef30('0x2b')][_0xef30('0x37')]){_0x5390bd['where']=_[_0xef30('0x38')](_0x5390bd['where'],{'$or':_[_0xef30('0x27')](_0x5390bd[_0xef30('0x2d')],function(_0x3ccebd){var _0x2717b7={};_0x2717b7[_0x3ccebd]={'$like':'%'+_0x311f56[_0xef30('0x2b')][_0xef30('0x37')]+'%'};return _0x2717b7;})});}_0x5390bd=_[_0xef30('0x38')]({},_0x5390bd,_0x311f56['options']);return _0x7a70d9[_0xef30('0x47')](_0x5390bd);}})[_0xef30('0x21')](function(_0x473d0c){if(_0x473d0c){_0x1974d7=_0x473d0c[_0xef30('0x40')];if(!_0x311f56['query'][_0xef30('0x48')]('nolimit')){_0x5390bd[_0xef30('0x1a')]=qs[_0xef30('0x1a')](_0x311f56['query'][_0xef30('0x1a')]);_0x5390bd[_0xef30('0x19')]=qs[_0xef30('0x19')](_0x311f56[_0xef30('0x2b')]['offset']);}return _0x7a70d9[_0xef30('0x47')](_0x5390bd);}})[_0xef30('0x21')](function(_0x52603e){if(_0x52603e){return _0x52603e?{'count':_0x1974d7,'rows':_0x52603e}:null;}})[_0xef30('0x21')](respondWithResult(_0x461fb3,null))[_0xef30('0x42')](handleError(_0x461fb3,null));};exports['addConfiguration']=function(_0x59084a,_0x55db23,_0x5ef785){if(_0x59084a['body']['id']){delete _0x59084a[_0xef30('0x44')]['id'];}return db['VtigerAccount'][_0xef30('0x46')]({'where':{'id':_0x59084a['params']['id']}})['then'](handleEntityNotFound(_0x55db23,null))['then'](function(_0x369a61){if(_0x369a61){_0x59084a[_0xef30('0x44')]['AccountId']=_0x369a61['id'];_0x59084a['body'][_0xef30('0x49')]=integrations[_0xef30('0x4a')](_0x59084a['body']['channel'],_0x59084a[_0xef30('0x44')][_0xef30('0x29')]);_0x59084a[_0xef30('0x44')][_0xef30('0x4b')]=integrations[_0xef30('0x4c')](_0x59084a[_0xef30('0x44')][_0xef30('0x4d')],_0x59084a[_0xef30('0x44')][_0xef30('0x29')]);return db['VtigerConfiguration'][_0xef30('0x43')](_0x59084a[_0xef30('0x44')],{'include':[{'model':db[_0xef30('0x4e')],'as':_0xef30('0x49')},{'model':db[_0xef30('0x4e')],'as':_0xef30('0x4b')}]});}return null;})[_0xef30('0x21')](respondWithResult(_0x55db23,null))[_0xef30('0x42')](handleError(_0x55db23,null));};var md5=require('md5');exports[_0xef30('0x4f')]=function(_0x1e6351,_0x2337d4,_0x14a603){var _0x4601b7=null;var _0x4e4387=null;var _0x33c1de=null;var _0x2a9acf=null;var _0x2fdcd8='';return db['VtigerAccount'][_0xef30('0x46')]({'where':{'id':_0x1e6351['params']['id']},'attributes':['id',_0xef30('0x24'),_0xef30('0x50'),_0xef30('0x51'),_0xef30('0x52'),_0xef30('0x53'),'serverUrl',_0xef30('0x54')]})[_0xef30('0x21')](handleEntityNotFound(_0x2337d4,null))[_0xef30('0x21')](function(_0xc052d5){if(_0xc052d5){_0x4601b7=_0xc052d5[_0xef30('0x50')];_0x4e4387=_0xc052d5[_0xef30('0x54')];_0x33c1de=_0xc052d5['moduleName'];_0x2fdcd8=_0xc052d5['remoteUri'];var _0x182f0d=_0x2fdcd8['slice'](-0x1);if(_0x182f0d==='/'){_0x2fdcd8=_0x2fdcd8[_0xef30('0x55')](0x0,_0x2fdcd8[_0xef30('0x56')](_0x182f0d));}_0x2a9acf=util['format'](_0xef30('0x57'),_0x2fdcd8);var _0x1dec01={'method':_0xef30('0x58'),'uri':_0x2a9acf,'qs':{'operation':'getchallenge','username':_0xc052d5[_0xef30('0x50')]},'json':!![]};return rp(_0x1dec01);}})[_0xef30('0x21')](function(_0x4e0cdb){if(_0x4e0cdb[_0xef30('0x59')]){var _0x17fe33={'method':'POST','uri':_0x2a9acf,'form':{'operation':_0xef30('0x5a'),'username':_0x4601b7,'accessKey':md5(_0x4e0cdb[_0xef30('0x5b')][_0xef30('0x5c')]+_0x4e4387)},'json':!![]};return rp(_0x17fe33);}})['then'](function(_0x3f2d66){if(_0x3f2d66[_0xef30('0x59')]){var _0x35b80f={'method':'GET','uri':_0x2a9acf,'qs':{'operation':_0xef30('0x5d'),'username':_0x4601b7,'sessionName':_0x3f2d66[_0xef30('0x5b')]['sessionName'],'elementType':_0x33c1de},'json':!![]};return rp(_0x35b80f);}})['then'](function(_0x2be5cf){if(_0x2be5cf[_0xef30('0x59')]){var _0x2b0122=[_0xef30('0x5e'),'reference',_0xef30('0x5f')];_['remove'](_0x2be5cf['result']['fields'],function(_0x142eca){return _0x2b0122[_0xef30('0x60')](_0x142eca[_0xef30('0x29')][_0xef30('0x24')]);});_['remove'](_0x2be5cf['result'][_0xef30('0x2f')],function(_0x955ad8){return _0x955ad8[_0xef30('0x61')]==='false';});return{'count':_0x2be5cf[_0xef30('0x5b')][_0xef30('0x2f')][_0xef30('0x40')],'rows':_[_0xef30('0x27')](_0x2be5cf['result'][_0xef30('0x2f')],function(_0x1a5979){return{'id':_0x1a5979['name'],'name':_0x1a5979[_0xef30('0x62')],'custom':_[_0xef30('0x63')](_0x1a5979['name'],_0xef30('0x64'))?!![]:![],'options':_0x1a5979[_0xef30('0x29')][_0xef30('0x24')]===_0xef30('0x65')&&_0x1a5979['type']['picklistValues']['length']>0x0?_['map'](_0x1a5979[_0xef30('0x29')][_0xef30('0x66')],function(_0x4f802d){return{'name':_0x4f802d[_0xef30('0x62')],'value':_0x4f802d['value']};}):[]};})};}})[_0xef30('0x21')](respondWithResult(_0x2337d4,null))[_0xef30('0x42')](function(_0xcb78ff){console['log'](_0xef30('0x67')+_0xcb78ff);var _0x52e14f=_0x1e6351['query'][_0xef30('0x68')]?0x1f4:_0xcb78ff[_0xef30('0x69')]||0x1f4;logger['error'](_0xef30('0x6a'),_0xef30('0x4f'),_0x52e14f,JSON[_0xef30('0x6b')](_0xcb78ff));delete _0xcb78ff[_0xef30('0x24')];if(_0x52e14f===0x191){_0x52e14f=0x190;}_0x2337d4['status'](_0x52e14f)['send'](_0x1e6351[_0xef30('0x2b')][_0xef30('0x68')]?{'message':_0xef30('0x6c'),'statusCode':_0xcb78ff['statusCode']}:_0xcb78ff);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 52d5f59..362a37c 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 _0xe402=['api','moment','bluebird','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','define','VtigerAccount','lodash','util','../../config/logger'];(function(_0x5fc42c,_0x42ff9a){var _0x3b791a=function(_0x19052c){while(--_0x19052c){_0x5fc42c['push'](_0x5fc42c['shift']());}};_0x3b791a(++_0x42ff9a);}(_0xe402,0x1c5));var _0x2e40=function(_0x491b81,_0x127953){_0x491b81=_0x491b81-0x0;var _0x369f8a=_0xe402[_0x491b81];return _0x369f8a;};'use strict';var _=require(_0x2e40('0x0'));var util=require(_0x2e40('0x1'));var logger=require(_0x2e40('0x2'))(_0x2e40('0x3'));var moment=require(_0x2e40('0x4'));var BPromise=require(_0x2e40('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e40('0x6'));var rimraf=require(_0x2e40('0x7'));var config=require('../../config/environment');var attributes=require(_0x2e40('0x8'));var integrations=require(_0x2e40('0x9'));module['exports']=function(_0x45ed27,_0x415f63){return _0x45ed27[_0x2e40('0xa')](_0x2e40('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81fc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util','../../config/logger','api'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0x81fc,0x106));var _0xc81f=function(_0x701f97,_0x323d8d){_0x701f97=_0x701f97-0x0;var _0x5a2b76=_0x81fc[_0x701f97];return _0x5a2b76;};'use strict';var _=require(_0xc81f('0x0'));var util=require(_0xc81f('0x1'));var logger=require(_0xc81f('0x2'))(_0xc81f('0x3'));var moment=require(_0xc81f('0x4'));var BPromise=require(_0xc81f('0x5'));var rp=require(_0xc81f('0x6'));var fs=require('fs');var path=require(_0xc81f('0x7'));var rimraf=require(_0xc81f('0x8'));var config=require(_0xc81f('0x9'));var attributes=require(_0xc81f('0xa'));var integrations=require(_0xc81f('0xb'));module[_0xc81f('0xc')]=function(_0x209f9a,_0x4d61f5){return _0x209f9a[_0xc81f('0xd')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index e937a79..f9aac9f 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 _0xa74f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetVtigerAccount','VtigerAccount','options','raw','where','limit','attributes','include','map','model','ShowVtigerAccount','find','moment'];(function(_0x5146e9,_0x539fea){var _0x36be24=function(_0x4dc2d8){while(--_0x4dc2d8){_0x5146e9['push'](_0x5146e9['shift']());}};_0x36be24(++_0x539fea);}(_0xa74f,0x9a));var _0xfa74=function(_0x3daa8c,_0x388a87){_0x3daa8c=_0x3daa8c-0x0;var _0x2b1bd7=_0xa74f[_0x3daa8c];return _0x2b1bd7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa74('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa74('0x1'));var db=require(_0xfa74('0x2'))['db'];var utils=require(_0xfa74('0x3'));var logger=require(_0xfa74('0x4'))('rpc');var config=require(_0xfa74('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfa74('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x9ddbd2,_0x3ac32e,_0x2d9fa9){return new BPromise(function(_0x287921,_0x344e04){return client['request'](_0x9ddbd2,_0x2d9fa9)[_0xfa74('0x7')](function(_0x37d4d8){logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,'request\x20sent');logger[_0xfa74('0xa')](_0xfa74('0xb'),_0x3ac32e,'request\x20sent',JSON[_0xfa74('0xc')](_0x37d4d8));if(_0x37d4d8[_0xfa74('0xd')]){if(_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xe')]===0x1f4){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x344e04(_0x37d4d8[_0xfa74('0xd')]['message']);}logger[_0xfa74('0xd')](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x287921(_0x37d4d8[_0xfa74('0xd')]['message']);}else{logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,_0xfa74('0x10'));_0x287921(_0x37d4d8[_0xfa74('0x11')][_0xfa74('0xf')]);}})[_0xfa74('0x12')](function(_0x3b9e32){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x3b9e32);_0x344e04(_0x3b9e32);});});}exports[_0xfa74('0x13')]=function(_0x51dda1){var _0x4928b6=this;return new Promise(function(_0x31d3c1,_0x25a36b){return db[_0xfa74('0x14')]['findAll']({'raw':_0x51dda1[_0xfa74('0x15')]?_0x51dda1[_0xfa74('0x15')][_0xfa74('0x16')]===undefined?!![]:![]:!![],'where':_0x51dda1['options']?_0x51dda1[_0xfa74('0x15')][_0xfa74('0x17')]||null:null,'attributes':_0x51dda1[_0xfa74('0x15')]?_0x51dda1['options']['attributes']||null:null,'limit':_0x51dda1[_0xfa74('0x15')]?_0x51dda1[_0xfa74('0x15')][_0xfa74('0x18')]||null:null,'include':_0x51dda1[_0xfa74('0x15')]?_0x51dda1[_0xfa74('0x15')]['include']?_['map'](_0x51dda1[_0xfa74('0x15')]['include'],function(_0x48cbd3){return{'model':db[_0x48cbd3['model']],'as':_0x48cbd3['as'],'attributes':_0x48cbd3[_0xfa74('0x19')],'include':_0x48cbd3[_0xfa74('0x1a')]?_[_0xfa74('0x1b')](_0x48cbd3['include'],function(_0x530f99){return{'model':db[_0x530f99[_0xfa74('0x1c')]],'as':_0x530f99['as'],'attributes':_0x530f99[_0xfa74('0x19')],'include':_0x530f99['include']?_[_0xfa74('0x1b')](_0x530f99['include'],function(_0x1a8cf7){return{'model':db[_0x1a8cf7[_0xfa74('0x1c')]],'as':_0x1a8cf7['as'],'attributes':_0x1a8cf7['attributes']};}):[]};}):[]};}):[]:[]})[_0xfa74('0x7')](function(_0x1130de){logger[_0xfa74('0x8')](_0xfa74('0x13'),_0x51dda1);logger['debug'](_0xfa74('0x13'),_0x51dda1,JSON[_0xfa74('0xc')](_0x1130de));_0x31d3c1(_0x1130de);})[_0xfa74('0x12')](function(_0x57d90e){logger['error'](_0xfa74('0x13'),_0x57d90e[_0xfa74('0xf')],_0x51dda1);_0x25a36b(_0x4928b6['error'](0x1f4,_0x57d90e['message']));});});};exports[_0xfa74('0x1d')]=function(_0x564060){var _0x2238d4=this;return new Promise(function(_0x4d6d0a,_0x363173){return db[_0xfa74('0x14')][_0xfa74('0x1e')]({'raw':_0x564060[_0xfa74('0x15')]?_0x564060['options'][_0xfa74('0x16')]===undefined?!![]:![]:!![],'where':_0x564060[_0xfa74('0x15')]?_0x564060[_0xfa74('0x15')][_0xfa74('0x17')]||null:null,'attributes':_0x564060[_0xfa74('0x15')]?_0x564060[_0xfa74('0x15')][_0xfa74('0x19')]||null:null,'include':_0x564060['options']?_0x564060[_0xfa74('0x15')]['include']?_[_0xfa74('0x1b')](_0x564060[_0xfa74('0x15')][_0xfa74('0x1a')],function(_0x1b5ff0){return{'model':db[_0x1b5ff0['model']],'as':_0x1b5ff0['as'],'attributes':_0x1b5ff0['attributes'],'include':_0x1b5ff0[_0xfa74('0x1a')]?_[_0xfa74('0x1b')](_0x1b5ff0[_0xfa74('0x1a')],function(_0x25863f){return{'model':db[_0x25863f['model']],'as':_0x25863f['as'],'attributes':_0x25863f[_0xfa74('0x19')],'include':_0x25863f[_0xfa74('0x1a')]?_['map'](_0x25863f['include'],function(_0x557510){return{'model':db[_0x557510['model']],'as':_0x557510['as'],'attributes':_0x557510['attributes']};}):[]};}):[]};}):[]:[]})[_0xfa74('0x7')](function(_0x1c3b44){logger[_0xfa74('0x8')](_0xfa74('0x1d'),_0x564060);logger[_0xfa74('0xa')](_0xfa74('0x1d'),_0x564060,JSON[_0xfa74('0xc')](_0x1c3b44));_0x4d6d0a(_0x1c3b44);})[_0xfa74('0x12')](function(_0x1a2d52){logger['error'](_0xfa74('0x1d'),_0x1a2d52[_0xfa74('0xf')],_0x564060);_0x363173(_0x2238d4[_0xfa74('0xd')](0x1f4,_0x1a2d52[_0xfa74('0xf')]));});});}; \ No newline at end of file +var _0xa5fa=['jayson/promise','client','http','request','info','debug','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','include','map','model','then','ShowVtigerAccount','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x947079,_0x3f1e56){var _0x568dba=function(_0x13b82f){while(--_0x13b82f){_0x947079['push'](_0x947079['shift']());}};_0x568dba(++_0x3f1e56);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x5df35c,_0x2ab072){_0x5df35c=_0x5df35c-0x0;var _0x5233be=_0xa5fa[_0x5df35c];return _0x5233be;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var rs=require(_0xaa5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa5f('0x4'))['db'];var utils=require(_0xaa5f('0x5'));var logger=require('../../config/logger')(_0xaa5f('0x6'));var config=require(_0xaa5f('0x7'));var jayson=require(_0xaa5f('0x8'));var client=jayson[_0xaa5f('0x9')][_0xaa5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13b606,_0x302138,_0xc326df){return new BPromise(function(_0x74f64f,_0x3f550e){return client[_0xaa5f('0xb')](_0x13b606,_0xc326df)['then'](function(_0x1674c2){logger[_0xaa5f('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x302138,'request\x20sent');logger[_0xaa5f('0xd')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x302138,'request\x20sent',JSON[_0xaa5f('0xe')](_0x1674c2));if(_0x1674c2['error']){if(_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x10')]===0x1f4){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')]['message']);return _0x3f550e(_0x1674c2[_0xaa5f('0xf')]['message']);}logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x12')]);return _0x74f64f(_0x1674c2[_0xaa5f('0xf')]['message']);}else{logger['info'](_0xaa5f('0x11'),_0x302138,_0xaa5f('0x13'));_0x74f64f(_0x1674c2[_0xaa5f('0x14')][_0xaa5f('0x12')]);}})[_0xaa5f('0x15')](function(_0x1fa36a){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1fa36a);_0x3f550e(_0x1fa36a);});});}exports[_0xaa5f('0x16')]=function(_0x3d874f){var _0x22175f=this;return new Promise(function(_0x1019e8,_0x4f4cd5){return db[_0xaa5f('0x17')][_0xaa5f('0x18')]({'raw':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')][_0xaa5f('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')][_0xaa5f('0x1b')]||null:null,'attributes':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')][_0xaa5f('0x1c')]||null:null,'limit':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')]['limit']||null:null,'include':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f['options'][_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x3d874f['options'][_0xaa5f('0x1d')],function(_0x1032ce){return{'model':db[_0x1032ce['model']],'as':_0x1032ce['as'],'attributes':_0x1032ce[_0xaa5f('0x1c')],'include':_0x1032ce[_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x1032ce[_0xaa5f('0x1d')],function(_0x1f66c0){return{'model':db[_0x1f66c0[_0xaa5f('0x1f')]],'as':_0x1f66c0['as'],'attributes':_0x1f66c0[_0xaa5f('0x1c')],'include':_0x1f66c0[_0xaa5f('0x1d')]?_['map'](_0x1f66c0[_0xaa5f('0x1d')],function(_0x3a66e8){return{'model':db[_0x3a66e8[_0xaa5f('0x1f')]],'as':_0x3a66e8['as'],'attributes':_0x3a66e8['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa5f('0x20')](function(_0x269209){logger[_0xaa5f('0xc')]('GetVtigerAccount',_0x3d874f);logger[_0xaa5f('0xd')]('GetVtigerAccount',_0x3d874f,JSON['stringify'](_0x269209));_0x1019e8(_0x269209);})[_0xaa5f('0x15')](function(_0x50998f){logger[_0xaa5f('0xf')]('GetVtigerAccount',_0x50998f['message'],_0x3d874f);_0x4f4cd5(_0x22175f['error'](0x1f4,_0x50998f[_0xaa5f('0x12')]));});});};exports['ShowVtigerAccount']=function(_0x310828){var _0xc0bb03=this;return new Promise(function(_0x555876,_0x58f608){return db[_0xaa5f('0x17')]['find']({'raw':_0x310828[_0xaa5f('0x19')]?_0x310828[_0xaa5f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x310828[_0xaa5f('0x19')]?_0x310828[_0xaa5f('0x19')][_0xaa5f('0x1b')]||null:null,'attributes':_0x310828['options']?_0x310828[_0xaa5f('0x19')][_0xaa5f('0x1c')]||null:null,'include':_0x310828['options']?_0x310828['options']['include']?_['map'](_0x310828[_0xaa5f('0x19')][_0xaa5f('0x1d')],function(_0x2a6015){return{'model':db[_0x2a6015[_0xaa5f('0x1f')]],'as':_0x2a6015['as'],'attributes':_0x2a6015[_0xaa5f('0x1c')],'include':_0x2a6015[_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x2a6015['include'],function(_0x1ab07f){return{'model':db[_0x1ab07f[_0xaa5f('0x1f')]],'as':_0x1ab07f['as'],'attributes':_0x1ab07f[_0xaa5f('0x1c')],'include':_0x1ab07f[_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x1ab07f[_0xaa5f('0x1d')],function(_0x49442c){return{'model':db[_0x49442c[_0xaa5f('0x1f')]],'as':_0x49442c['as'],'attributes':_0x49442c[_0xaa5f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xaa5f('0x20')](function(_0x2ac0f8){logger[_0xaa5f('0xc')]('ShowVtigerAccount',_0x310828);logger['debug'](_0xaa5f('0x21'),_0x310828,JSON[_0xaa5f('0xe')](_0x2ac0f8));_0x555876(_0x2ac0f8);})[_0xaa5f('0x15')](function(_0x964105){logger['error'](_0xaa5f('0x21'),_0x964105[_0xaa5f('0x12')],_0x310828);_0x58f608(_0xc0bb03[_0xaa5f('0xf')](0x1f4,_0x964105[_0xaa5f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 31d227e..3dd3e19 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 _0xde7c=['get','isAuthenticated','index','/:id','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xde7c,0x6a));var _0xcde7=function(_0xb7e531,_0x2abb7d){_0xb7e531=_0xb7e531-0x0;var _0x111c47=_0xde7c[_0xb7e531];return _0x111c47;};'use strict';var multer=require('multer');var util=require(_0xcde7('0x0'));var path=require(_0xcde7('0x1'));var timeout=require('connect-timeout');var express=require(_0xcde7('0x2'));var router=express[_0xcde7('0x3')]();var fs_extra=require(_0xcde7('0x4'));var auth=require(_0xcde7('0x5'));var interaction=require(_0xcde7('0x6'));var config=require(_0xcde7('0x7'));var controller=require(_0xcde7('0x8'));router[_0xcde7('0x9')]('/',auth[_0xcde7('0xa')](),controller[_0xcde7('0xb')]);router[_0xcde7('0x9')](_0xcde7('0xc'),auth[_0xcde7('0xa')](),controller['show']);router[_0xcde7('0x9')]('/:id/fields',auth[_0xcde7('0xa')](),controller[_0xcde7('0xd')]);router[_0xcde7('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xcde7('0xe')]);router['get'](_0xcde7('0xf'),auth[_0xcde7('0xa')](),controller[_0xcde7('0x10')]);router['post']('/',auth[_0xcde7('0xa')](),controller[_0xcde7('0x11')]);router[_0xcde7('0x12')](_0xcde7('0xc'),auth[_0xcde7('0xa')](),controller[_0xcde7('0x13')]);router[_0xcde7('0x14')](_0xcde7('0xc'),auth[_0xcde7('0xa')](),controller[_0xcde7('0x15')]);module[_0xcde7('0x16')]=router; \ No newline at end of file +var _0xb41c=['/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intVtigerConfiguration.controller','isAuthenticated','index','get'];(function(_0x2714ce,_0x4214b3){var _0x1d5cba=function(_0x321964){while(--_0x321964){_0x2714ce['push'](_0x2714ce['shift']());}};_0x1d5cba(++_0x4214b3);}(_0xb41c,0x114));var _0xcb41=function(_0x21e153,_0x1cb3c3){_0x21e153=_0x21e153-0x0;var _0x38d924=_0xb41c[_0x21e153];return _0x38d924;};'use strict';var multer=require(_0xcb41('0x0'));var util=require(_0xcb41('0x1'));var path=require(_0xcb41('0x2'));var timeout=require(_0xcb41('0x3'));var express=require(_0xcb41('0x4'));var router=express[_0xcb41('0x5')]();var fs_extra=require(_0xcb41('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xcb41('0x7'));var config=require('../../config/environment');var controller=require(_0xcb41('0x8'));router['get']('/',auth[_0xcb41('0x9')](),controller[_0xcb41('0xa')]);router[_0xcb41('0xb')](_0xcb41('0xc'),auth[_0xcb41('0x9')](),controller[_0xcb41('0xd')]);router[_0xcb41('0xb')](_0xcb41('0xe'),auth[_0xcb41('0x9')](),controller[_0xcb41('0xf')]);router[_0xcb41('0xb')](_0xcb41('0x10'),auth[_0xcb41('0x9')](),controller[_0xcb41('0x11')]);router[_0xcb41('0xb')](_0xcb41('0x12'),auth['isAuthenticated'](),controller[_0xcb41('0x13')]);router['post']('/',auth[_0xcb41('0x9')](),controller[_0xcb41('0x14')]);router[_0xcb41('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xcb41('0x16')]('/:id',auth[_0xcb41('0x9')](),controller['destroy']);module[_0xcb41('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 33e4d20..c5c53d1 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 _0x5417=['exports','STRING','sequelize'];(function(_0x55a6d1,_0xaf8aa9){var _0x5c4e54=function(_0x6ff66d){while(--_0x6ff66d){_0x55a6d1['push'](_0x55a6d1['shift']());}};_0x5c4e54(++_0xaf8aa9);}(_0x5417,0x9e));var _0x7541=function(_0x5a0bab,_0x168def){_0x5a0bab=_0x5a0bab-0x0;var _0x32b15a=_0x5417[_0x5a0bab];return _0x32b15a;};'use strict';var Sequelize=require(_0x7541('0x0'));module[_0x7541('0x1')]={'name':{'type':Sequelize[_0x7541('0x2')]},'description':{'type':Sequelize[_0x7541('0x2')]}}; \ No newline at end of file +var _0xbf2e=['sequelize','exports','STRING'];(function(_0x52c613,_0x53587a){var _0x3010a5=function(_0x5683b1){while(--_0x5683b1){_0x52c613['push'](_0x52c613['shift']());}};_0x3010a5(++_0x53587a);}(_0xbf2e,0xab));var _0xebf2=function(_0x1ee2a3,_0x139f54){_0x1ee2a3=_0x1ee2a3-0x0;var _0x37c06f=_0xbf2e[_0x1ee2a3];return _0x37c06f;};'use strict';var Sequelize=require(_0xebf2('0x0'));module[_0xebf2('0x1')]={'name':{'type':Sequelize[_0xebf2('0x2')]},'description':{'type':Sequelize[_0xebf2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index b420965..11a2cf2 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 _0x3452=['getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','pick','filter','merge','where','type','VIRTUAL','options','include','catch','show','includeAll','find','create','body','params','getFields','findOne','sort','hasOwnProperty','VtigerField'];(function(_0x6ae31c,_0x260835){var _0x263ec3=function(_0x1a914a){while(--_0x1a914a){_0x6ae31c['push'](_0x6ae31c['shift']());}};_0x263ec3(++_0x260835);}(_0x3452,0x183));var _0x2345=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3452[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x2345('0x0'));var rimraf=require(_0x2345('0x1'));var zipdir=require(_0x2345('0x2'));var jsonpatch=require(_0x2345('0x3'));var rp=require(_0x2345('0x4'));var moment=require(_0x2345('0x5'));var BPromise=require(_0x2345('0x6'));var Mustache=require(_0x2345('0x7'));var util=require(_0x2345('0x8'));var path=require('path');var sox=require(_0x2345('0x9'));var csv=require(_0x2345('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2345('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2345('0xc'));var jsforce=require(_0x2345('0xd'));var deskjs=require(_0x2345('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2345('0xf'));var Papa=require(_0x2345('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2345('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2345('0x12'));var config=require(_0x2345('0x13'));var licenseUtil=require(_0x2345('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cfbab,_0x2a2667){_0x2a2667=_0x2a2667||0xcc;return function(_0x4c6666){if(_0x4c6666){return _0x4cfbab[_0x2345('0x15')](_0x2a2667);}return _0x4cfbab[_0x2345('0x16')](_0x2a2667)[_0x2345('0x17')]();};}function respondWithResult(_0x418af8,_0x1fdd40){_0x1fdd40=_0x1fdd40||0xc8;return function(_0x362da0){if(_0x362da0){return _0x418af8[_0x2345('0x16')](_0x1fdd40)[_0x2345('0x18')](_0x362da0);}};}function respondWithFilteredResult(_0x530856,_0x18415b){return function(_0x36bf24){if(_0x36bf24){var _0x2b194a=typeof _0x18415b['offset']===_0x2345('0x19')&&typeof _0x18415b['limit']==='undefined';var _0x29be27=_0x36bf24[_0x2345('0x1a')];var _0x39f066=_0x2b194a?0x0:_0x18415b[_0x2345('0x1b')];var _0x4a57c1=_0x2b194a?_0x36bf24[_0x2345('0x1a')]:_0x18415b['offset']+_0x18415b['limit'];var _0x4f44c0;if(_0x4a57c1>=_0x29be27){_0x4a57c1=_0x29be27;_0x4f44c0=0xc8;}else{_0x4f44c0=0xce;}_0x530856[_0x2345('0x16')](_0x4f44c0);return _0x530856[_0x2345('0x1c')](_0x2345('0x1d'),_0x39f066+'-'+_0x4a57c1+'/'+_0x29be27)['json'](_0x36bf24);}return null;};}function patchUpdates(_0x44b4da){return function(_0x3c7f46){try{jsonpatch[_0x2345('0x1e')](_0x3c7f46,_0x44b4da,!![]);}catch(_0x1fce2e){return BPromise[_0x2345('0x1f')](_0x1fce2e);}return _0x3c7f46[_0x2345('0x20')]();};}function saveUpdates(_0x5debb,_0x324476){return function(_0x22fee3){if(_0x22fee3){return _0x22fee3['update'](_0x5debb)[_0x2345('0x21')](function(_0x5760b2){return _0x5760b2;});}return null;};}function removeEntity(_0x403915,_0x72769e){return function(_0x421033){if(_0x421033){return _0x421033[_0x2345('0x22')]()[_0x2345('0x21')](function(){_0x403915[_0x2345('0x16')](0xcc)[_0x2345('0x17')]();});}};}function handleEntityNotFound(_0xd49ed0,_0x3570f4){return function(_0x400dde){if(!_0x400dde){_0xd49ed0['sendStatus'](0x194);}return _0x400dde;};}function handleError(_0x4bbbc1,_0x57665f){_0x57665f=_0x57665f||0x1f4;return function(_0x2e853a){logger[_0x2345('0x23')](_0x2e853a['stack']);if(_0x2e853a[_0x2345('0x24')]){delete _0x2e853a[_0x2345('0x24')];}_0x4bbbc1[_0x2345('0x16')](_0x57665f)[_0x2345('0x25')](_0x2e853a);};}exports[_0x2345('0x26')]=function(_0x505120,_0x20e8bf){var _0x1e2f89={},_0x5e2e05={},_0x1ac0b6={'count':0x0,'rows':[]};var _0x28fe83=_[_0x2345('0x27')](db[_0x2345('0x28')][_0x2345('0x29')],function(_0x2a8a20){return{'name':_0x2a8a20[_0x2345('0x2a')],'type':_0x2a8a20['type'][_0x2345('0x2b')]};});_0x5e2e05[_0x2345('0x2c')]=_['map'](_0x28fe83,'name');_0x5e2e05['query']=_[_0x2345('0x2d')](_0x505120[_0x2345('0x2e')]);_0x5e2e05[_0x2345('0x2f')]=_[_0x2345('0x30')](_0x5e2e05[_0x2345('0x2c')],_0x5e2e05[_0x2345('0x2e')]);_0x1e2f89[_0x2345('0x31')]=_['intersection'](_0x5e2e05[_0x2345('0x2c')],qs[_0x2345('0x32')](_0x505120[_0x2345('0x2e')][_0x2345('0x32')]));_0x1e2f89['attributes']=_0x1e2f89[_0x2345('0x31')][_0x2345('0x33')]?_0x1e2f89[_0x2345('0x31')]:_0x5e2e05['model'];if(!_0x505120['query']['hasOwnProperty'](_0x2345('0x34'))){_0x1e2f89['limit']=qs[_0x2345('0x35')](_0x505120[_0x2345('0x2e')][_0x2345('0x35')]);_0x1e2f89[_0x2345('0x1b')]=qs[_0x2345('0x1b')](_0x505120[_0x2345('0x2e')][_0x2345('0x1b')]);}_0x1e2f89[_0x2345('0x36')]=qs['sort'](_0x505120[_0x2345('0x2e')]['sort']);_0x1e2f89['where']=qs[_0x2345('0x2f')](_[_0x2345('0x37')](_0x505120[_0x2345('0x2e')],_0x5e2e05['filters']),_0x28fe83);if(_0x505120[_0x2345('0x2e')][_0x2345('0x38')]){_0x1e2f89['where']=_[_0x2345('0x39')](_0x1e2f89[_0x2345('0x3a')],{'$or':_[_0x2345('0x27')](_0x28fe83,function(_0x1992cf){if(_0x1992cf[_0x2345('0x3b')]!==_0x2345('0x3c')){var _0x44c96a={};_0x44c96a[_0x1992cf[_0x2345('0x24')]]={'$like':'%'+_0x505120[_0x2345('0x2e')][_0x2345('0x38')]+'%'};return _0x44c96a;}})});}_0x1e2f89=_[_0x2345('0x39')]({},_0x1e2f89,_0x505120[_0x2345('0x3d')]);var _0x59c959={'where':_0x1e2f89[_0x2345('0x3a')]};return db['VtigerConfiguration'][_0x2345('0x1a')](_0x59c959)[_0x2345('0x21')](function(_0x3ffcfb){_0x1ac0b6[_0x2345('0x1a')]=_0x3ffcfb;if(_0x505120[_0x2345('0x2e')]['includeAll']){_0x1e2f89[_0x2345('0x3e')]=[{'all':!![]}];}return db[_0x2345('0x28')]['findAll'](_0x1e2f89);})['then'](function(_0x4b3b99){_0x1ac0b6['rows']=_0x4b3b99;return _0x1ac0b6;})[_0x2345('0x21')](respondWithFilteredResult(_0x20e8bf,_0x1e2f89))[_0x2345('0x3f')](handleError(_0x20e8bf,null));};exports[_0x2345('0x40')]=function(_0x52112c,_0x2d3d89){var _0x4ad06b={'raw':![],'where':{'id':_0x52112c['params']['id']}},_0x37874c={};_0x37874c[_0x2345('0x2c')]=_[_0x2345('0x2d')](db['VtigerConfiguration'][_0x2345('0x29')]);_0x37874c['query']=_[_0x2345('0x2d')](_0x52112c[_0x2345('0x2e')]);_0x37874c[_0x2345('0x2f')]=_[_0x2345('0x30')](_0x37874c['model'],_0x37874c[_0x2345('0x2e')]);_0x4ad06b['attributes']=_[_0x2345('0x30')](_0x37874c[_0x2345('0x2c')],qs[_0x2345('0x32')](_0x52112c[_0x2345('0x2e')][_0x2345('0x32')]));_0x4ad06b[_0x2345('0x31')]=_0x4ad06b[_0x2345('0x31')][_0x2345('0x33')]?_0x4ad06b['attributes']:_0x37874c['model'];if(_0x52112c[_0x2345('0x2e')][_0x2345('0x41')]){_0x4ad06b['include']=[{'all':!![]}];}_0x4ad06b=_['merge']({},_0x4ad06b,_0x52112c[_0x2345('0x3d')]);return db[_0x2345('0x28')][_0x2345('0x42')](_0x4ad06b)[_0x2345('0x21')](handleEntityNotFound(_0x2d3d89,null))['then'](respondWithResult(_0x2d3d89,null))['catch'](handleError(_0x2d3d89,null));};exports[_0x2345('0x43')]=function(_0x199d28,_0x145563){return db[_0x2345('0x28')][_0x2345('0x43')](_0x199d28[_0x2345('0x44')],{})[_0x2345('0x21')](respondWithResult(_0x145563,0xc9))[_0x2345('0x3f')](handleError(_0x145563,null));};exports['update']=function(_0x38f9ac,_0x7ed0ff){if(_0x38f9ac[_0x2345('0x44')]['id']){delete _0x38f9ac[_0x2345('0x44')]['id'];}return db[_0x2345('0x28')][_0x2345('0x42')]({'where':{'id':_0x38f9ac[_0x2345('0x45')]['id']}})[_0x2345('0x21')](handleEntityNotFound(_0x7ed0ff,null))[_0x2345('0x21')](saveUpdates(_0x38f9ac[_0x2345('0x44')],null))[_0x2345('0x21')](respondWithResult(_0x7ed0ff,null))[_0x2345('0x3f')](handleError(_0x7ed0ff,null));};exports[_0x2345('0x22')]=function(_0x533113,_0x12ef06){return db[_0x2345('0x28')][_0x2345('0x42')]({'where':{'id':_0x533113[_0x2345('0x45')]['id']}})[_0x2345('0x21')](handleEntityNotFound(_0x12ef06,null))[_0x2345('0x21')](removeEntity(_0x12ef06,null))[_0x2345('0x3f')](handleError(_0x12ef06,null));};exports[_0x2345('0x46')]=function(_0x536a0b,_0x4a2d13,_0x41f22a){var _0x22fe6e={};var _0x5a165f={};var _0x4cd4f0;var _0x3372ee;return db['VtigerConfiguration'][_0x2345('0x47')]({'where':{'id':_0x536a0b[_0x2345('0x45')]['id']}})[_0x2345('0x21')](handleEntityNotFound(_0x4a2d13,null))[_0x2345('0x21')](function(_0x2d0521){if(_0x2d0521){_0x4cd4f0=_0x2d0521;_0x5a165f[_0x2345('0x2c')]=_[_0x2345('0x2d')](db['VtigerField'][_0x2345('0x29')]);_0x5a165f[_0x2345('0x2e')]=_[_0x2345('0x2d')](_0x536a0b[_0x2345('0x2e')]);_0x5a165f[_0x2345('0x2f')]=_['intersection'](_0x5a165f['model'],_0x5a165f[_0x2345('0x2e')]);_0x22fe6e[_0x2345('0x31')]=_[_0x2345('0x30')](_0x5a165f[_0x2345('0x2c')],qs['fields'](_0x536a0b[_0x2345('0x2e')][_0x2345('0x32')]));_0x22fe6e['attributes']=_0x22fe6e[_0x2345('0x31')]['length']?_0x22fe6e[_0x2345('0x31')]:_0x5a165f[_0x2345('0x2c')];_0x22fe6e['order']=qs[_0x2345('0x48')](_0x536a0b[_0x2345('0x2e')][_0x2345('0x48')]);_0x22fe6e[_0x2345('0x3a')]=qs[_0x2345('0x2f')](_['pick'](_0x536a0b[_0x2345('0x2e')],_0x5a165f[_0x2345('0x2f')]));if(_0x536a0b[_0x2345('0x2e')]['filter']){_0x22fe6e[_0x2345('0x3a')]=_[_0x2345('0x39')](_0x22fe6e[_0x2345('0x3a')],{'$or':_[_0x2345('0x27')](_0x22fe6e['attributes'],function(_0x30bd45){var _0x35ff6e={};_0x35ff6e[_0x30bd45]={'$like':'%'+_0x536a0b[_0x2345('0x2e')][_0x2345('0x38')]+'%'};return _0x35ff6e;})});}_0x22fe6e=_[_0x2345('0x39')]({},_0x22fe6e,_0x536a0b[_0x2345('0x3d')]);return _0x4cd4f0[_0x2345('0x46')](_0x22fe6e);}})[_0x2345('0x21')](function(_0x3db5f5){if(_0x3db5f5){_0x3372ee=_0x3db5f5[_0x2345('0x33')];if(!_0x536a0b['query'][_0x2345('0x49')](_0x2345('0x34'))){_0x22fe6e[_0x2345('0x35')]=qs[_0x2345('0x35')](_0x536a0b[_0x2345('0x2e')][_0x2345('0x35')]);_0x22fe6e[_0x2345('0x1b')]=qs[_0x2345('0x1b')](_0x536a0b[_0x2345('0x2e')][_0x2345('0x1b')]);}return _0x4cd4f0[_0x2345('0x46')](_0x22fe6e);}})[_0x2345('0x21')](function(_0x40b1cf){if(_0x40b1cf){return _0x40b1cf?{'count':_0x3372ee,'rows':_0x40b1cf}:null;}})['then'](respondWithResult(_0x4a2d13,null))[_0x2345('0x3f')](handleError(_0x4a2d13,null));};exports['getSubjects']=function(_0x25c0d8,_0x59d124,_0xadcea1){var _0x560e07={};var _0x18439a={};var _0xb024f4;var _0x92a7b2;return db['VtigerConfiguration'][_0x2345('0x47')]({'where':{'id':_0x25c0d8[_0x2345('0x45')]['id']}})[_0x2345('0x21')](handleEntityNotFound(_0x59d124,null))['then'](function(_0x59f710){if(_0x59f710){_0xb024f4=_0x59f710;_0x18439a[_0x2345('0x2c')]=_['keys'](db[_0x2345('0x4a')][_0x2345('0x29')]);_0x18439a[_0x2345('0x2e')]=_[_0x2345('0x2d')](_0x25c0d8[_0x2345('0x2e')]);_0x18439a[_0x2345('0x2f')]=_[_0x2345('0x30')](_0x18439a[_0x2345('0x2c')],_0x18439a[_0x2345('0x2e')]);_0x560e07[_0x2345('0x31')]=_[_0x2345('0x30')](_0x18439a['model'],qs['fields'](_0x25c0d8[_0x2345('0x2e')][_0x2345('0x32')]));_0x560e07[_0x2345('0x31')]=_0x560e07['attributes'][_0x2345('0x33')]?_0x560e07['attributes']:_0x18439a[_0x2345('0x2c')];_0x560e07[_0x2345('0x36')]=qs[_0x2345('0x48')](_0x25c0d8[_0x2345('0x2e')][_0x2345('0x48')]);_0x560e07[_0x2345('0x3a')]=qs[_0x2345('0x2f')](_['pick'](_0x25c0d8[_0x2345('0x2e')],_0x18439a[_0x2345('0x2f')]));if(_0x25c0d8[_0x2345('0x2e')]['filter']){_0x560e07['where']=_[_0x2345('0x39')](_0x560e07['where'],{'$or':_[_0x2345('0x27')](_0x560e07[_0x2345('0x31')],function(_0x1b0e89){var _0x1bb4bd={};_0x1bb4bd[_0x1b0e89]={'$like':'%'+_0x25c0d8[_0x2345('0x2e')][_0x2345('0x38')]+'%'};return _0x1bb4bd;})});}_0x560e07=_['merge']({},_0x560e07,_0x25c0d8[_0x2345('0x3d')]);return _0xb024f4[_0x2345('0x4b')](_0x560e07);}})['then'](function(_0x54f99e){if(_0x54f99e){_0x92a7b2=_0x54f99e[_0x2345('0x33')];if(!_0x25c0d8[_0x2345('0x2e')]['hasOwnProperty'](_0x2345('0x34'))){_0x560e07[_0x2345('0x35')]=qs[_0x2345('0x35')](_0x25c0d8[_0x2345('0x2e')][_0x2345('0x35')]);_0x560e07[_0x2345('0x1b')]=qs['offset'](_0x25c0d8[_0x2345('0x2e')][_0x2345('0x1b')]);}return _0xb024f4['getSubjects'](_0x560e07);}})['then'](function(_0x243789){if(_0x243789){return _0x243789?{'count':_0x92a7b2,'rows':_0x243789}:null;}})[_0x2345('0x21')](respondWithResult(_0x59d124,null))[_0x2345('0x3f')](handleError(_0x59d124,null));};exports[_0x2345('0x4c')]=function(_0x5b2be8,_0x58555c,_0x254c07){var _0x1f447a={};var _0x2f25c7={};var _0x4dcc1d;var _0x66585d;return db[_0x2345('0x28')][_0x2345('0x47')]({'where':{'id':_0x5b2be8[_0x2345('0x45')]['id']}})[_0x2345('0x21')](handleEntityNotFound(_0x58555c,null))[_0x2345('0x21')](function(_0x3e5deb){if(_0x3e5deb){_0x4dcc1d=_0x3e5deb;_0x2f25c7[_0x2345('0x2c')]=_['keys'](db['VtigerField'][_0x2345('0x29')]);_0x2f25c7[_0x2345('0x2e')]=_[_0x2345('0x2d')](_0x5b2be8['query']);_0x2f25c7[_0x2345('0x2f')]=_[_0x2345('0x30')](_0x2f25c7[_0x2345('0x2c')],_0x2f25c7[_0x2345('0x2e')]);_0x1f447a[_0x2345('0x31')]=_[_0x2345('0x30')](_0x2f25c7[_0x2345('0x2c')],qs[_0x2345('0x32')](_0x5b2be8[_0x2345('0x2e')]['fields']));_0x1f447a[_0x2345('0x31')]=_0x1f447a[_0x2345('0x31')]['length']?_0x1f447a[_0x2345('0x31')]:_0x2f25c7[_0x2345('0x2c')];_0x1f447a[_0x2345('0x36')]=qs[_0x2345('0x48')](_0x5b2be8['query'][_0x2345('0x48')]);_0x1f447a[_0x2345('0x3a')]=qs[_0x2345('0x2f')](_[_0x2345('0x37')](_0x5b2be8[_0x2345('0x2e')],_0x2f25c7[_0x2345('0x2f')]));if(_0x5b2be8['query']['filter']){_0x1f447a[_0x2345('0x3a')]=_[_0x2345('0x39')](_0x1f447a[_0x2345('0x3a')],{'$or':_['map'](_0x1f447a[_0x2345('0x31')],function(_0x13ea01){var _0x4e83d1={};_0x4e83d1[_0x13ea01]={'$like':'%'+_0x5b2be8[_0x2345('0x2e')][_0x2345('0x38')]+'%'};return _0x4e83d1;})});}_0x1f447a=_[_0x2345('0x39')]({},_0x1f447a,_0x5b2be8[_0x2345('0x3d')]);return _0x4dcc1d[_0x2345('0x4c')](_0x1f447a);}})['then'](function(_0x230e4c){if(_0x230e4c){_0x66585d=_0x230e4c[_0x2345('0x33')];if(!_0x5b2be8[_0x2345('0x2e')][_0x2345('0x49')](_0x2345('0x34'))){_0x1f447a[_0x2345('0x35')]=qs['limit'](_0x5b2be8[_0x2345('0x2e')]['limit']);_0x1f447a['offset']=qs[_0x2345('0x1b')](_0x5b2be8[_0x2345('0x2e')][_0x2345('0x1b')]);}return _0x4dcc1d[_0x2345('0x4c')](_0x1f447a);}})[_0x2345('0x21')](function(_0x42519f){if(_0x42519f){return _0x42519f?{'count':_0x66585d,'rows':_0x42519f}:null;}})['then'](respondWithResult(_0x58555c,null))[_0x2345('0x3f')](handleError(_0x58555c,null));}; \ No newline at end of file +var _0x7754=['fast-json-patch','request-promise','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','VtigerConfiguration','includeAll','include','findAll','rows','params','fields','create','body','catch','find','VtigerField','pick','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir'];(function(_0x422b48,_0xf131fb){var _0x4a6f67=function(_0x13309e){while(--_0x13309e){_0x422b48['push'](_0x422b48['shift']());}};_0x4a6f67(++_0xf131fb);}(_0x7754,0x1d7));var _0x4775=function(_0x25c326,_0x250137){_0x25c326=_0x25c326-0x0;var _0x762452=_0x7754[_0x25c326];return _0x762452;};'use strict';var emlformat=require(_0x4775('0x0'));var rimraf=require(_0x4775('0x1'));var zipdir=require(_0x4775('0x2'));var jsonpatch=require(_0x4775('0x3'));var rp=require(_0x4775('0x4'));var moment=require('moment');var BPromise=require(_0x4775('0x5'));var Mustache=require(_0x4775('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4775('0x7'));var csv=require('to-csv');var ejs=require(_0x4775('0x8'));var fs=require('fs');var fs_extra=require(_0x4775('0x9'));var _=require('lodash');var squel=require(_0x4775('0xa'));var crypto=require(_0x4775('0xb'));var jsforce=require(_0x4775('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4775('0xd'));var Papa=require(_0x4775('0xe'));var Redis=require('ioredis');var authService=require(_0x4775('0xf'));var qs=require(_0x4775('0x10'));var as=require(_0x4775('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4775('0x12'))(_0x4775('0x13'));var utils=require('../../config/utils');var config=require(_0x4775('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4775('0x15'))['db'];function respondWithStatusCode(_0x2373d0,_0x9ecd23){_0x9ecd23=_0x9ecd23||0xcc;return function(_0x585b7e){if(_0x585b7e){return _0x2373d0[_0x4775('0x16')](_0x9ecd23);}return _0x2373d0[_0x4775('0x17')](_0x9ecd23)[_0x4775('0x18')]();};}function respondWithResult(_0x572a32,_0x3a65d2){_0x3a65d2=_0x3a65d2||0xc8;return function(_0x2f02a7){if(_0x2f02a7){return _0x572a32[_0x4775('0x17')](_0x3a65d2)[_0x4775('0x19')](_0x2f02a7);}};}function respondWithFilteredResult(_0x36a0e2,_0x2c595b){return function(_0x8d9cf1){if(_0x8d9cf1){var _0xb83394=typeof _0x2c595b['offset']==='undefined'&&typeof _0x2c595b[_0x4775('0x1a')]===_0x4775('0x1b');var _0x58b63b=_0x8d9cf1[_0x4775('0x1c')];var _0x25c740=_0xb83394?0x0:_0x2c595b['offset'];var _0x370f20=_0xb83394?_0x8d9cf1[_0x4775('0x1c')]:_0x2c595b[_0x4775('0x1d')]+_0x2c595b[_0x4775('0x1a')];var _0x27f990;if(_0x370f20>=_0x58b63b){_0x370f20=_0x58b63b;_0x27f990=0xc8;}else{_0x27f990=0xce;}_0x36a0e2[_0x4775('0x17')](_0x27f990);return _0x36a0e2[_0x4775('0x1e')](_0x4775('0x1f'),_0x25c740+'-'+_0x370f20+'/'+_0x58b63b)[_0x4775('0x19')](_0x8d9cf1);}return null;};}function patchUpdates(_0x22e92a){return function(_0xb0f44c){try{jsonpatch[_0x4775('0x20')](_0xb0f44c,_0x22e92a,!![]);}catch(_0x16a277){return BPromise['reject'](_0x16a277);}return _0xb0f44c[_0x4775('0x21')]();};}function saveUpdates(_0x2508a5,_0x2cd7d9){return function(_0x242d95){if(_0x242d95){return _0x242d95[_0x4775('0x22')](_0x2508a5)[_0x4775('0x23')](function(_0x2481fb){return _0x2481fb;});}return null;};}function removeEntity(_0x4363e4,_0x13d794){return function(_0x19fe64){if(_0x19fe64){return _0x19fe64[_0x4775('0x24')]()[_0x4775('0x23')](function(){_0x4363e4[_0x4775('0x17')](0xcc)[_0x4775('0x18')]();});}};}function handleEntityNotFound(_0x1b125f,_0x516483){return function(_0x1ada1c){if(!_0x1ada1c){_0x1b125f['sendStatus'](0x194);}return _0x1ada1c;};}function handleError(_0x5ec017,_0x9edce6){_0x9edce6=_0x9edce6||0x1f4;return function(_0x28411a){logger[_0x4775('0x25')](_0x28411a[_0x4775('0x26')]);if(_0x28411a[_0x4775('0x27')]){delete _0x28411a[_0x4775('0x27')];}_0x5ec017['status'](_0x9edce6)[_0x4775('0x28')](_0x28411a);};}exports[_0x4775('0x29')]=function(_0x135730,_0x758626){var _0x5811a1={},_0x1bdbe1={},_0x5a8090={'count':0x0,'rows':[]};var _0xd77757=_[_0x4775('0x2a')](db['VtigerConfiguration'][_0x4775('0x2b')],function(_0x23acc6){return{'name':_0x23acc6[_0x4775('0x2c')],'type':_0x23acc6[_0x4775('0x2d')][_0x4775('0x2e')]};});_0x1bdbe1[_0x4775('0x2f')]=_[_0x4775('0x2a')](_0xd77757,_0x4775('0x27'));_0x1bdbe1[_0x4775('0x30')]=_[_0x4775('0x31')](_0x135730[_0x4775('0x30')]);_0x1bdbe1[_0x4775('0x32')]=_[_0x4775('0x33')](_0x1bdbe1[_0x4775('0x2f')],_0x1bdbe1[_0x4775('0x30')]);_0x5811a1[_0x4775('0x34')]=_[_0x4775('0x33')](_0x1bdbe1[_0x4775('0x2f')],qs['fields'](_0x135730['query']['fields']));_0x5811a1[_0x4775('0x34')]=_0x5811a1[_0x4775('0x34')][_0x4775('0x35')]?_0x5811a1[_0x4775('0x34')]:_0x1bdbe1[_0x4775('0x2f')];if(!_0x135730[_0x4775('0x30')][_0x4775('0x36')](_0x4775('0x37'))){_0x5811a1['limit']=qs[_0x4775('0x1a')](_0x135730[_0x4775('0x30')]['limit']);_0x5811a1[_0x4775('0x1d')]=qs[_0x4775('0x1d')](_0x135730[_0x4775('0x30')]['offset']);}_0x5811a1[_0x4775('0x38')]=qs[_0x4775('0x39')](_0x135730[_0x4775('0x30')]['sort']);_0x5811a1[_0x4775('0x3a')]=qs['filters'](_['pick'](_0x135730[_0x4775('0x30')],_0x1bdbe1['filters']),_0xd77757);if(_0x135730[_0x4775('0x30')][_0x4775('0x3b')]){_0x5811a1[_0x4775('0x3a')]=_[_0x4775('0x3c')](_0x5811a1[_0x4775('0x3a')],{'$or':_[_0x4775('0x2a')](_0xd77757,function(_0x13d1f5){if(_0x13d1f5[_0x4775('0x2d')]!=='VIRTUAL'){var _0x5b3146={};_0x5b3146[_0x13d1f5[_0x4775('0x27')]]={'$like':'%'+_0x135730['query'][_0x4775('0x3b')]+'%'};return _0x5b3146;}})});}_0x5811a1=_['merge']({},_0x5811a1,_0x135730[_0x4775('0x3d')]);var _0x1094a4={'where':_0x5811a1[_0x4775('0x3a')]};return db[_0x4775('0x3e')][_0x4775('0x1c')](_0x1094a4)[_0x4775('0x23')](function(_0x26655b){_0x5a8090[_0x4775('0x1c')]=_0x26655b;if(_0x135730[_0x4775('0x30')][_0x4775('0x3f')]){_0x5811a1[_0x4775('0x40')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x4775('0x41')](_0x5811a1);})[_0x4775('0x23')](function(_0x25720a){_0x5a8090[_0x4775('0x42')]=_0x25720a;return _0x5a8090;})[_0x4775('0x23')](respondWithFilteredResult(_0x758626,_0x5811a1))['catch'](handleError(_0x758626,null));};exports['show']=function(_0x357cde,_0x1f9b6e){var _0x42aa2e={'raw':![],'where':{'id':_0x357cde[_0x4775('0x43')]['id']}},_0x4a5b7f={};_0x4a5b7f[_0x4775('0x2f')]=_['keys'](db[_0x4775('0x3e')][_0x4775('0x2b')]);_0x4a5b7f['query']=_[_0x4775('0x31')](_0x357cde[_0x4775('0x30')]);_0x4a5b7f[_0x4775('0x32')]=_[_0x4775('0x33')](_0x4a5b7f['model'],_0x4a5b7f[_0x4775('0x30')]);_0x42aa2e['attributes']=_['intersection'](_0x4a5b7f['model'],qs['fields'](_0x357cde[_0x4775('0x30')][_0x4775('0x44')]));_0x42aa2e[_0x4775('0x34')]=_0x42aa2e[_0x4775('0x34')][_0x4775('0x35')]?_0x42aa2e[_0x4775('0x34')]:_0x4a5b7f[_0x4775('0x2f')];if(_0x357cde[_0x4775('0x30')]['includeAll']){_0x42aa2e[_0x4775('0x40')]=[{'all':!![]}];}_0x42aa2e=_[_0x4775('0x3c')]({},_0x42aa2e,_0x357cde[_0x4775('0x3d')]);return db[_0x4775('0x3e')]['find'](_0x42aa2e)[_0x4775('0x23')](handleEntityNotFound(_0x1f9b6e,null))[_0x4775('0x23')](respondWithResult(_0x1f9b6e,null))['catch'](handleError(_0x1f9b6e,null));};exports[_0x4775('0x45')]=function(_0x5e6662,_0x40e2e0){return db[_0x4775('0x3e')][_0x4775('0x45')](_0x5e6662[_0x4775('0x46')],{})[_0x4775('0x23')](respondWithResult(_0x40e2e0,0xc9))[_0x4775('0x47')](handleError(_0x40e2e0,null));};exports[_0x4775('0x22')]=function(_0x386177,_0x3673e5){if(_0x386177[_0x4775('0x46')]['id']){delete _0x386177[_0x4775('0x46')]['id'];}return db[_0x4775('0x3e')][_0x4775('0x48')]({'where':{'id':_0x386177[_0x4775('0x43')]['id']}})[_0x4775('0x23')](handleEntityNotFound(_0x3673e5,null))['then'](saveUpdates(_0x386177[_0x4775('0x46')],null))[_0x4775('0x23')](respondWithResult(_0x3673e5,null))[_0x4775('0x47')](handleError(_0x3673e5,null));};exports[_0x4775('0x24')]=function(_0x28c900,_0x28a0c9){return db[_0x4775('0x3e')]['find']({'where':{'id':_0x28c900[_0x4775('0x43')]['id']}})[_0x4775('0x23')](handleEntityNotFound(_0x28a0c9,null))['then'](removeEntity(_0x28a0c9,null))[_0x4775('0x47')](handleError(_0x28a0c9,null));};exports['getFields']=function(_0x1243cd,_0x3ed3b5,_0x27dd39){var _0x34faf7={};var _0x371dad={};var _0x3b2327;var _0x6a4d19;return db[_0x4775('0x3e')]['findOne']({'where':{'id':_0x1243cd[_0x4775('0x43')]['id']}})[_0x4775('0x23')](handleEntityNotFound(_0x3ed3b5,null))[_0x4775('0x23')](function(_0x50b7d3){if(_0x50b7d3){_0x3b2327=_0x50b7d3;_0x371dad[_0x4775('0x2f')]=_[_0x4775('0x31')](db[_0x4775('0x49')][_0x4775('0x2b')]);_0x371dad[_0x4775('0x30')]=_['keys'](_0x1243cd[_0x4775('0x30')]);_0x371dad['filters']=_[_0x4775('0x33')](_0x371dad[_0x4775('0x2f')],_0x371dad['query']);_0x34faf7[_0x4775('0x34')]=_[_0x4775('0x33')](_0x371dad[_0x4775('0x2f')],qs['fields'](_0x1243cd[_0x4775('0x30')][_0x4775('0x44')]));_0x34faf7[_0x4775('0x34')]=_0x34faf7[_0x4775('0x34')]['length']?_0x34faf7[_0x4775('0x34')]:_0x371dad[_0x4775('0x2f')];_0x34faf7[_0x4775('0x38')]=qs[_0x4775('0x39')](_0x1243cd['query'][_0x4775('0x39')]);_0x34faf7[_0x4775('0x3a')]=qs[_0x4775('0x32')](_[_0x4775('0x4a')](_0x1243cd['query'],_0x371dad['filters']));if(_0x1243cd['query'][_0x4775('0x3b')]){_0x34faf7[_0x4775('0x3a')]=_[_0x4775('0x3c')](_0x34faf7['where'],{'$or':_[_0x4775('0x2a')](_0x34faf7[_0x4775('0x34')],function(_0x4efe85){var _0x212344={};_0x212344[_0x4efe85]={'$like':'%'+_0x1243cd[_0x4775('0x30')]['filter']+'%'};return _0x212344;})});}_0x34faf7=_[_0x4775('0x3c')]({},_0x34faf7,_0x1243cd[_0x4775('0x3d')]);return _0x3b2327['getFields'](_0x34faf7);}})['then'](function(_0x929413){if(_0x929413){_0x6a4d19=_0x929413[_0x4775('0x35')];if(!_0x1243cd['query']['hasOwnProperty'](_0x4775('0x37'))){_0x34faf7[_0x4775('0x1a')]=qs[_0x4775('0x1a')](_0x1243cd['query'][_0x4775('0x1a')]);_0x34faf7[_0x4775('0x1d')]=qs[_0x4775('0x1d')](_0x1243cd['query'][_0x4775('0x1d')]);}return _0x3b2327[_0x4775('0x4b')](_0x34faf7);}})[_0x4775('0x23')](function(_0x2446ba){if(_0x2446ba){return _0x2446ba?{'count':_0x6a4d19,'rows':_0x2446ba}:null;}})[_0x4775('0x23')](respondWithResult(_0x3ed3b5,null))[_0x4775('0x47')](handleError(_0x3ed3b5,null));};exports[_0x4775('0x4c')]=function(_0x438dbf,_0x45cdfe,_0x441df9){var _0x8e3312={};var _0x36fb9b={};var _0x8928ed;var _0x3f2edd;return db[_0x4775('0x3e')][_0x4775('0x4d')]({'where':{'id':_0x438dbf[_0x4775('0x43')]['id']}})[_0x4775('0x23')](handleEntityNotFound(_0x45cdfe,null))[_0x4775('0x23')](function(_0x29a6b4){if(_0x29a6b4){_0x8928ed=_0x29a6b4;_0x36fb9b[_0x4775('0x2f')]=_[_0x4775('0x31')](db[_0x4775('0x49')][_0x4775('0x2b')]);_0x36fb9b[_0x4775('0x30')]=_['keys'](_0x438dbf[_0x4775('0x30')]);_0x36fb9b[_0x4775('0x32')]=_['intersection'](_0x36fb9b[_0x4775('0x2f')],_0x36fb9b[_0x4775('0x30')]);_0x8e3312[_0x4775('0x34')]=_[_0x4775('0x33')](_0x36fb9b[_0x4775('0x2f')],qs['fields'](_0x438dbf[_0x4775('0x30')][_0x4775('0x44')]));_0x8e3312['attributes']=_0x8e3312['attributes'][_0x4775('0x35')]?_0x8e3312['attributes']:_0x36fb9b[_0x4775('0x2f')];_0x8e3312[_0x4775('0x38')]=qs[_0x4775('0x39')](_0x438dbf[_0x4775('0x30')]['sort']);_0x8e3312['where']=qs['filters'](_['pick'](_0x438dbf[_0x4775('0x30')],_0x36fb9b[_0x4775('0x32')]));if(_0x438dbf[_0x4775('0x30')][_0x4775('0x3b')]){_0x8e3312[_0x4775('0x3a')]=_['merge'](_0x8e3312[_0x4775('0x3a')],{'$or':_[_0x4775('0x2a')](_0x8e3312[_0x4775('0x34')],function(_0x836aa7){var _0x1eea7a={};_0x1eea7a[_0x836aa7]={'$like':'%'+_0x438dbf[_0x4775('0x30')][_0x4775('0x3b')]+'%'};return _0x1eea7a;})});}_0x8e3312=_[_0x4775('0x3c')]({},_0x8e3312,_0x438dbf[_0x4775('0x3d')]);return _0x8928ed[_0x4775('0x4c')](_0x8e3312);}})[_0x4775('0x23')](function(_0x3bd1f3){if(_0x3bd1f3){_0x3f2edd=_0x3bd1f3['length'];if(!_0x438dbf['query'][_0x4775('0x36')](_0x4775('0x37'))){_0x8e3312[_0x4775('0x1a')]=qs[_0x4775('0x1a')](_0x438dbf[_0x4775('0x30')][_0x4775('0x1a')]);_0x8e3312[_0x4775('0x1d')]=qs[_0x4775('0x1d')](_0x438dbf[_0x4775('0x30')][_0x4775('0x1d')]);}return _0x8928ed[_0x4775('0x4c')](_0x8e3312);}})[_0x4775('0x23')](function(_0x1e0978){if(_0x1e0978){return _0x1e0978?{'count':_0x3f2edd,'rows':_0x1e0978}:null;}})[_0x4775('0x23')](respondWithResult(_0x45cdfe,null))[_0x4775('0x47')](handleError(_0x45cdfe,null));};exports[_0x4775('0x4e')]=function(_0x163b10,_0x51adcb,_0x3a2a54){var _0x327834={};var _0x451d6e={};var _0x2f13a2;var _0x25c89d;return db[_0x4775('0x3e')][_0x4775('0x4d')]({'where':{'id':_0x163b10[_0x4775('0x43')]['id']}})['then'](handleEntityNotFound(_0x51adcb,null))[_0x4775('0x23')](function(_0x3d25d8){if(_0x3d25d8){_0x2f13a2=_0x3d25d8;_0x451d6e[_0x4775('0x2f')]=_['keys'](db[_0x4775('0x49')][_0x4775('0x2b')]);_0x451d6e[_0x4775('0x30')]=_[_0x4775('0x31')](_0x163b10[_0x4775('0x30')]);_0x451d6e[_0x4775('0x32')]=_[_0x4775('0x33')](_0x451d6e[_0x4775('0x2f')],_0x451d6e[_0x4775('0x30')]);_0x327834[_0x4775('0x34')]=_['intersection'](_0x451d6e[_0x4775('0x2f')],qs[_0x4775('0x44')](_0x163b10['query']['fields']));_0x327834[_0x4775('0x34')]=_0x327834[_0x4775('0x34')][_0x4775('0x35')]?_0x327834[_0x4775('0x34')]:_0x451d6e[_0x4775('0x2f')];_0x327834['order']=qs[_0x4775('0x39')](_0x163b10[_0x4775('0x30')][_0x4775('0x39')]);_0x327834[_0x4775('0x3a')]=qs[_0x4775('0x32')](_[_0x4775('0x4a')](_0x163b10[_0x4775('0x30')],_0x451d6e[_0x4775('0x32')]));if(_0x163b10[_0x4775('0x30')]['filter']){_0x327834['where']=_[_0x4775('0x3c')](_0x327834[_0x4775('0x3a')],{'$or':_['map'](_0x327834[_0x4775('0x34')],function(_0x2a4278){var _0x1ff832={};_0x1ff832[_0x2a4278]={'$like':'%'+_0x163b10['query'][_0x4775('0x3b')]+'%'};return _0x1ff832;})});}_0x327834=_[_0x4775('0x3c')]({},_0x327834,_0x163b10[_0x4775('0x3d')]);return _0x2f13a2[_0x4775('0x4e')](_0x327834);}})[_0x4775('0x23')](function(_0x208c1a){if(_0x208c1a){_0x25c89d=_0x208c1a[_0x4775('0x35')];if(!_0x163b10[_0x4775('0x30')][_0x4775('0x36')](_0x4775('0x37'))){_0x327834['limit']=qs[_0x4775('0x1a')](_0x163b10[_0x4775('0x30')]['limit']);_0x327834[_0x4775('0x1d')]=qs[_0x4775('0x1d')](_0x163b10['query'][_0x4775('0x1d')]);}return _0x2f13a2[_0x4775('0x4e')](_0x327834);}})[_0x4775('0x23')](function(_0x229575){if(_0x229575){return _0x229575?{'count':_0x25c89d,'rows':_0x229575}:null;}})[_0x4775('0x23')](respondWithResult(_0x51adcb,null))[_0x4775('0x47')](handleError(_0x51adcb,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index ef8b456..ccdf6e2 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 _0x6b90=['bluebird','request-promise','rimraf','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger'];(function(_0x54ccf1,_0x494b78){var _0xf4c475=function(_0x3affbb){while(--_0x3affbb){_0x54ccf1['push'](_0x54ccf1['shift']());}};_0xf4c475(++_0x494b78);}(_0x6b90,0x76));var _0x06b9=function(_0x1c7e86,_0x24906b){_0x1c7e86=_0x1c7e86-0x0;var _0x238734=_0x6b90[_0x1c7e86];return _0x238734;};'use strict';var _=require(_0x06b9('0x0'));var util=require(_0x06b9('0x1'));var logger=require(_0x06b9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x06b9('0x3'));var rp=require(_0x06b9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x06b9('0x5'));var config=require('../../config/environment');var attributes=require(_0x06b9('0x6'));module[_0x06b9('0x7')]=function(_0x37efde,_0x4d541e){return _0x37efde[_0x06b9('0x8')](_0x06b9('0x9'),attributes,{'tableName':_0x06b9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9606=['int_vtiger_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VtigerConfiguration'];(function(_0x4971d8,_0x1d444b){var _0xfbc542=function(_0x10900f){while(--_0x10900f){_0x4971d8['push'](_0x4971d8['shift']());}};_0xfbc542(++_0x1d444b);}(_0x9606,0x69));var _0x6960=function(_0x5d487a,_0x1cdcfc){_0x5d487a=_0x5d487a-0x0;var _0x24db27=_0x9606[_0x5d487a];return _0x24db27;};'use strict';var _=require(_0x6960('0x0'));var util=require(_0x6960('0x1'));var logger=require('../../config/logger')(_0x6960('0x2'));var moment=require(_0x6960('0x3'));var BPromise=require(_0x6960('0x4'));var rp=require(_0x6960('0x5'));var fs=require('fs');var path=require(_0x6960('0x6'));var rimraf=require(_0x6960('0x7'));var config=require(_0x6960('0x8'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x6960('0x9')]=function(_0x48fd17,_0x833f46){return _0x48fd17[_0x6960('0xa')](_0x6960('0xb'),attributes,{'tableName':_0x6960('0xc'),'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 ea74b20..18d8322 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 _0xf23b=['moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf23b,0xdc));var _0xbf23=function(_0x3103ac,_0x59f413){_0x3103ac=_0x3103ac-0x0;var _0x39c4fb=_0xf23b[_0x3103ac];return _0x39c4fb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbf23('0x0'));var BPromise=require(_0xbf23('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbf23('0x2'));var logger=require(_0xbf23('0x3'))(_0xbf23('0x4'));var config=require(_0xbf23('0x5'));var jayson=require(_0xbf23('0x6'));var client=jayson[_0xbf23('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53d257,_0x2dc1b9,_0x11303a){return new BPromise(function(_0x5eb782,_0x3af56a){return client[_0xbf23('0x8')](_0x53d257,_0x11303a)['then'](function(_0x48a99c){logger[_0xbf23('0x9')](_0xbf23('0xa'),_0x2dc1b9,_0xbf23('0xb'));logger[_0xbf23('0xc')](_0xbf23('0xd'),_0x2dc1b9,_0xbf23('0xb'),JSON[_0xbf23('0xe')](_0x48a99c));if(_0x48a99c[_0xbf23('0xf')]){if(_0x48a99c['error'][_0xbf23('0x10')]===0x1f4){logger[_0xbf23('0xf')](_0xbf23('0xa'),_0x2dc1b9,_0x48a99c['error'][_0xbf23('0x11')]);return _0x3af56a(_0x48a99c[_0xbf23('0xf')][_0xbf23('0x11')]);}logger[_0xbf23('0xf')](_0xbf23('0xa'),_0x2dc1b9,_0x48a99c['error'][_0xbf23('0x11')]);return _0x5eb782(_0x48a99c['error'][_0xbf23('0x11')]);}else{logger['info'](_0xbf23('0xa'),_0x2dc1b9,_0xbf23('0xb'));_0x5eb782(_0x48a99c[_0xbf23('0x12')]['message']);}})[_0xbf23('0x13')](function(_0x2a966c){logger[_0xbf23('0xf')](_0xbf23('0xa'),_0x2dc1b9,_0x2a966c);_0x3af56a(_0x2a966c);});});} \ No newline at end of file +var _0x2d55=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','VtigerConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','moment','randomstring'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x2d55,0x18e));var _0x52d5=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2d55[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x52d5('0x0'));var BPromise=require('bluebird');var rs=require(_0x52d5('0x1'));var fs=require('fs');var Redis=require(_0x52d5('0x2'));var db=require(_0x52d5('0x3'))['db'];var utils=require(_0x52d5('0x4'));var logger=require(_0x52d5('0x5'))(_0x52d5('0x6'));var config=require('../../config/environment');var jayson=require(_0x52d5('0x7'));var client=jayson[_0x52d5('0x8')][_0x52d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xafdbea,_0xca50a7,_0x1aa638){return new BPromise(function(_0x184e2e,_0x43bab6){return client['request'](_0xafdbea,_0x1aa638)['then'](function(_0x54da9b){logger[_0x52d5('0xa')](_0x52d5('0xb'),_0xca50a7,'request\x20sent');logger[_0x52d5('0xc')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0xca50a7,_0x52d5('0xd'),JSON[_0x52d5('0xe')](_0x54da9b));if(_0x54da9b[_0x52d5('0xf')]){if(_0x54da9b[_0x52d5('0xf')][_0x52d5('0x10')]===0x1f4){logger['error'](_0x52d5('0xb'),_0xca50a7,_0x54da9b[_0x52d5('0xf')]['message']);return _0x43bab6(_0x54da9b[_0x52d5('0xf')][_0x52d5('0x11')]);}logger[_0x52d5('0xf')](_0x52d5('0xb'),_0xca50a7,_0x54da9b[_0x52d5('0xf')][_0x52d5('0x11')]);return _0x184e2e(_0x54da9b['error'][_0x52d5('0x11')]);}else{logger[_0x52d5('0xa')](_0x52d5('0xb'),_0xca50a7,_0x52d5('0xd'));_0x184e2e(_0x54da9b[_0x52d5('0x12')][_0x52d5('0x11')]);}})[_0x52d5('0x13')](function(_0x4e4f5e){logger['error'](_0x52d5('0xb'),_0xca50a7,_0x4e4f5e);_0x43bab6(_0x4e4f5e);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 1a93879..863f3e9 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 _0x2483=['../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1ae5c0,_0x5c7b9d){var _0x255057=function(_0x3dd90f){while(--_0x3dd90f){_0x1ae5c0['push'](_0x1ae5c0['shift']());}};_0x255057(++_0x5c7b9d);}(_0x2483,0xca));var _0x3248=function(_0x2b92c1,_0x5892cb){_0x2b92c1=_0x2b92c1-0x0;var _0x581968=_0x2483[_0x2b92c1];return _0x581968;};'use strict';var multer=require(_0x3248('0x0'));var util=require(_0x3248('0x1'));var path=require(_0x3248('0x2'));var timeout=require(_0x3248('0x3'));var express=require(_0x3248('0x4'));var router=express[_0x3248('0x5')]();var fs_extra=require(_0x3248('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3248('0x7'));var controller=require('./intVtigerField.controller');router[_0x3248('0x8')]('/',auth[_0x3248('0x9')](),controller[_0x3248('0xa')]);router['get'](_0x3248('0xb'),auth[_0x3248('0x9')](),controller[_0x3248('0xc')]);router['post']('/',auth[_0x3248('0x9')](),controller[_0x3248('0xd')]);router[_0x3248('0xe')]('/:id',auth[_0x3248('0x9')](),controller[_0x3248('0xf')]);router[_0x3248('0x10')](_0x3248('0xb'),auth[_0x3248('0x9')](),controller[_0x3248('0x11')]);module[_0x3248('0x12')]=router; \ No newline at end of file +var _0xe18b=['get','index','/:id','isAuthenticated','show','update','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller'];(function(_0x507d9f,_0x3e1d56){var _0xea1e39=function(_0x42dfee){while(--_0x42dfee){_0x507d9f['push'](_0x507d9f['shift']());}};_0xea1e39(++_0x3e1d56);}(_0xe18b,0x1a0));var _0xbe18=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe18b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbe18('0x0'));var util=require(_0xbe18('0x1'));var path=require(_0xbe18('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbe18('0x3')]();var fs_extra=require(_0xbe18('0x4'));var auth=require(_0xbe18('0x5'));var interaction=require(_0xbe18('0x6'));var config=require(_0xbe18('0x7'));var controller=require(_0xbe18('0x8'));router[_0xbe18('0x9')]('/',auth['isAuthenticated'](),controller[_0xbe18('0xa')]);router[_0xbe18('0x9')](_0xbe18('0xb'),auth[_0xbe18('0xc')](),controller[_0xbe18('0xd')]);router['post']('/',auth[_0xbe18('0xc')](),controller['create']);router['put'](_0xbe18('0xb'),auth[_0xbe18('0xc')](),controller[_0xbe18('0xe')]);router[_0xbe18('0xf')](_0xbe18('0xb'),auth[_0xbe18('0xc')](),controller[_0xbe18('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 98aad0f..d1ce1ec 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 _0xd778=['customVariable','picklist','string','STRING','sequelize','exports','ENUM','variable'];(function(_0xf50142,_0x367876){var _0x596f1e=function(_0xc9a56f){while(--_0xc9a56f){_0xf50142['push'](_0xf50142['shift']());}};_0x596f1e(++_0x367876);}(_0xd778,0x144));var _0x8d77=function(_0x261f03,_0x3bc635){_0x261f03=_0x261f03-0x0;var _0x58b4ba=_0xd778[_0x261f03];return _0x58b4ba;};'use strict';var Sequelize=require(_0x8d77('0x0'));module[_0x8d77('0x1')]={'type':{'type':Sequelize[_0x8d77('0x2')]('string',_0x8d77('0x3'),_0x8d77('0x4'),'keyValue',_0x8d77('0x5')),'defaultValue':_0x8d77('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8d77('0x7')]},'keyType':{'type':Sequelize[_0x8d77('0x2')]('string',_0x8d77('0x3'),_0x8d77('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8d77('0x7')]},'nameField':{'type':Sequelize[_0x8d77('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbb48=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x47159c,_0x1c8216){var _0x454dbe=function(_0x2b54f7){while(--_0x2b54f7){_0x47159c['push'](_0x47159c['shift']());}};_0x454dbe(++_0x1c8216);}(_0xbb48,0x1b3));var _0x8bb4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbb48[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x8bb4('0x0'));module[_0x8bb4('0x1')]={'type':{'type':Sequelize[_0x8bb4('0x2')](_0x8bb4('0x3'),_0x8bb4('0x4'),_0x8bb4('0x5'),_0x8bb4('0x6'),_0x8bb4('0x7')),'defaultValue':_0x8bb4('0x3')},'content':{'type':Sequelize[_0x8bb4('0x8')]},'key':{'type':Sequelize[_0x8bb4('0x8')]},'keyType':{'type':Sequelize[_0x8bb4('0x2')](_0x8bb4('0x3'),_0x8bb4('0x4'),_0x8bb4('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8bb4('0x8')]},'nameField':{'type':Sequelize[_0x8bb4('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8bb4('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 4ac525e..ded76b9 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 _0xfc7d=['end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','VtigerField','rawAttributes','fieldName','key','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','rows','catch','show','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x3dabfe,_0xff68ca){var _0x5618e1=function(_0x5ae725){while(--_0x5ae725){_0x3dabfe['push'](_0x3dabfe['shift']());}};_0x5618e1(++_0xff68ca);}(_0xfc7d,0x161));var _0xdfc7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfc7d[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdfc7('0x0'));var zipdir=require(_0xdfc7('0x1'));var jsonpatch=require(_0xdfc7('0x2'));var rp=require(_0xdfc7('0x3'));var moment=require(_0xdfc7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdfc7('0x5'));var path=require(_0xdfc7('0x6'));var sox=require(_0xdfc7('0x7'));var csv=require('to-csv');var ejs=require(_0xdfc7('0x8'));var fs=require('fs');var fs_extra=require(_0xdfc7('0x9'));var _=require(_0xdfc7('0xa'));var squel=require(_0xdfc7('0xb'));var crypto=require('crypto');var jsforce=require(_0xdfc7('0xc'));var deskjs=require(_0xdfc7('0xd'));var toCsv=require(_0xdfc7('0xe'));var querystring=require(_0xdfc7('0xf'));var Papa=require(_0xdfc7('0x10'));var Redis=require('ioredis');var authService=require(_0xdfc7('0x11'));var qs=require(_0xdfc7('0x12'));var as=require(_0xdfc7('0x13'));var hardwareService=require(_0xdfc7('0x14'));var logger=require(_0xdfc7('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xdfc7('0x16'));var licenseUtil=require(_0xdfc7('0x17'));var db=require(_0xdfc7('0x18'))['db'];function respondWithStatusCode(_0x2b5445,_0x3fa552){_0x3fa552=_0x3fa552||0xcc;return function(_0x843b31){if(_0x843b31){return _0x2b5445[_0xdfc7('0x19')](_0x3fa552);}return _0x2b5445[_0xdfc7('0x1a')](_0x3fa552)[_0xdfc7('0x1b')]();};}function respondWithResult(_0x56aece,_0x3b1634){_0x3b1634=_0x3b1634||0xc8;return function(_0x1ac02b){if(_0x1ac02b){return _0x56aece[_0xdfc7('0x1a')](_0x3b1634)[_0xdfc7('0x1c')](_0x1ac02b);}};}function respondWithFilteredResult(_0x18be50,_0x261987){return function(_0x948cf8){if(_0x948cf8){var _0x59ab84=typeof _0x261987[_0xdfc7('0x1d')]==='undefined'&&typeof _0x261987[_0xdfc7('0x1e')]===_0xdfc7('0x1f');var _0x4cd576=_0x948cf8[_0xdfc7('0x20')];var _0x1f1d8d=_0x59ab84?0x0:_0x261987['offset'];var _0xa44f77=_0x59ab84?_0x948cf8[_0xdfc7('0x20')]:_0x261987[_0xdfc7('0x1d')]+_0x261987[_0xdfc7('0x1e')];var _0x225248;if(_0xa44f77>=_0x4cd576){_0xa44f77=_0x4cd576;_0x225248=0xc8;}else{_0x225248=0xce;}_0x18be50['status'](_0x225248);return _0x18be50[_0xdfc7('0x21')](_0xdfc7('0x22'),_0x1f1d8d+'-'+_0xa44f77+'/'+_0x4cd576)[_0xdfc7('0x1c')](_0x948cf8);}return null;};}function patchUpdates(_0xe1004e){return function(_0x337d58){try{jsonpatch['apply'](_0x337d58,_0xe1004e,!![]);}catch(_0x475bd0){return BPromise[_0xdfc7('0x23')](_0x475bd0);}return _0x337d58[_0xdfc7('0x24')]();};}function saveUpdates(_0x39ba79,_0x309acf){return function(_0x31e9b9){if(_0x31e9b9){return _0x31e9b9[_0xdfc7('0x25')](_0x39ba79)['then'](function(_0xdf7be){return _0xdf7be;});}return null;};}function removeEntity(_0x4c782e,_0x5e4cbf){return function(_0x28de06){if(_0x28de06){return _0x28de06[_0xdfc7('0x26')]()[_0xdfc7('0x27')](function(){_0x4c782e[_0xdfc7('0x1a')](0xcc)[_0xdfc7('0x1b')]();});}};}function handleEntityNotFound(_0x438854,_0x3b88e7){return function(_0x3ca799){if(!_0x3ca799){_0x438854[_0xdfc7('0x19')](0x194);}return _0x3ca799;};}function handleError(_0x3c2894,_0x65af3){_0x65af3=_0x65af3||0x1f4;return function(_0x345e86){logger[_0xdfc7('0x28')](_0x345e86['stack']);if(_0x345e86[_0xdfc7('0x29')]){delete _0x345e86[_0xdfc7('0x29')];}_0x3c2894[_0xdfc7('0x1a')](_0x65af3)[_0xdfc7('0x2a')](_0x345e86);};}exports[_0xdfc7('0x2b')]=function(_0xa86701,_0x67ee81){var _0x5579bf={},_0x2c78a7={},_0x3c489d={'count':0x0,'rows':[]};var _0x1e2d9c=_[_0xdfc7('0x2c')](db[_0xdfc7('0x2d')][_0xdfc7('0x2e')],function(_0x20ea96){return{'name':_0x20ea96[_0xdfc7('0x2f')],'type':_0x20ea96['type'][_0xdfc7('0x30')]};});_0x2c78a7['model']=_[_0xdfc7('0x2c')](_0x1e2d9c,_0xdfc7('0x29'));_0x2c78a7['query']=_[_0xdfc7('0x31')](_0xa86701['query']);_0x2c78a7[_0xdfc7('0x32')]=_[_0xdfc7('0x33')](_0x2c78a7[_0xdfc7('0x34')],_0x2c78a7[_0xdfc7('0x35')]);_0x5579bf['attributes']=_[_0xdfc7('0x33')](_0x2c78a7[_0xdfc7('0x34')],qs['fields'](_0xa86701[_0xdfc7('0x35')][_0xdfc7('0x36')]));_0x5579bf['attributes']=_0x5579bf[_0xdfc7('0x37')][_0xdfc7('0x38')]?_0x5579bf[_0xdfc7('0x37')]:_0x2c78a7['model'];if(!_0xa86701['query'][_0xdfc7('0x39')](_0xdfc7('0x3a'))){_0x5579bf[_0xdfc7('0x1e')]=qs[_0xdfc7('0x1e')](_0xa86701['query']['limit']);_0x5579bf[_0xdfc7('0x1d')]=qs[_0xdfc7('0x1d')](_0xa86701[_0xdfc7('0x35')]['offset']);}_0x5579bf[_0xdfc7('0x3b')]=qs[_0xdfc7('0x3c')](_0xa86701['query']['sort']);_0x5579bf[_0xdfc7('0x3d')]=qs['filters'](_[_0xdfc7('0x3e')](_0xa86701[_0xdfc7('0x35')],_0x2c78a7[_0xdfc7('0x32')]),_0x1e2d9c);if(_0xa86701[_0xdfc7('0x35')][_0xdfc7('0x3f')]){_0x5579bf[_0xdfc7('0x3d')]=_['merge'](_0x5579bf[_0xdfc7('0x3d')],{'$or':_[_0xdfc7('0x2c')](_0x1e2d9c,function(_0x4040f7){if(_0x4040f7[_0xdfc7('0x40')]!==_0xdfc7('0x41')){var _0x1f3f47={};_0x1f3f47[_0x4040f7[_0xdfc7('0x29')]]={'$like':'%'+_0xa86701[_0xdfc7('0x35')]['filter']+'%'};return _0x1f3f47;}})});}_0x5579bf=_[_0xdfc7('0x42')]({},_0x5579bf,_0xa86701[_0xdfc7('0x43')]);var _0x5c7619={'where':_0x5579bf[_0xdfc7('0x3d')]};return db[_0xdfc7('0x2d')][_0xdfc7('0x20')](_0x5c7619)[_0xdfc7('0x27')](function(_0x549954){_0x3c489d[_0xdfc7('0x20')]=_0x549954;if(_0xa86701[_0xdfc7('0x35')][_0xdfc7('0x44')]){_0x5579bf['include']=[{'all':!![]}];}return db[_0xdfc7('0x2d')]['findAll'](_0x5579bf);})[_0xdfc7('0x27')](function(_0x37435d){_0x3c489d[_0xdfc7('0x45')]=_0x37435d;return _0x3c489d;})[_0xdfc7('0x27')](respondWithFilteredResult(_0x67ee81,_0x5579bf))[_0xdfc7('0x46')](handleError(_0x67ee81,null));};exports[_0xdfc7('0x47')]=function(_0x3d43bd,_0x28d5bd){var _0xd88c25={'raw':!![],'where':{'id':_0x3d43bd['params']['id']}},_0x11a91e={};_0x11a91e['model']=_[_0xdfc7('0x31')](db[_0xdfc7('0x2d')]['rawAttributes']);_0x11a91e[_0xdfc7('0x35')]=_[_0xdfc7('0x31')](_0x3d43bd[_0xdfc7('0x35')]);_0x11a91e[_0xdfc7('0x32')]=_[_0xdfc7('0x33')](_0x11a91e[_0xdfc7('0x34')],_0x11a91e[_0xdfc7('0x35')]);_0xd88c25[_0xdfc7('0x37')]=_[_0xdfc7('0x33')](_0x11a91e['model'],qs[_0xdfc7('0x36')](_0x3d43bd[_0xdfc7('0x35')][_0xdfc7('0x36')]));_0xd88c25['attributes']=_0xd88c25['attributes'][_0xdfc7('0x38')]?_0xd88c25[_0xdfc7('0x37')]:_0x11a91e[_0xdfc7('0x34')];if(_0x3d43bd[_0xdfc7('0x35')][_0xdfc7('0x44')]){_0xd88c25['include']=[{'all':!![]}];}_0xd88c25=_[_0xdfc7('0x42')]({},_0xd88c25,_0x3d43bd['options']);return db[_0xdfc7('0x2d')][_0xdfc7('0x48')](_0xd88c25)['then'](handleEntityNotFound(_0x28d5bd,null))[_0xdfc7('0x27')](respondWithResult(_0x28d5bd,null))[_0xdfc7('0x46')](handleError(_0x28d5bd,null));};exports[_0xdfc7('0x49')]=function(_0x2d9426,_0x584c28){return db['VtigerField'][_0xdfc7('0x49')](_0x2d9426[_0xdfc7('0x4a')],{})[_0xdfc7('0x27')](respondWithResult(_0x584c28,0xc9))[_0xdfc7('0x46')](handleError(_0x584c28,null));};exports[_0xdfc7('0x25')]=function(_0x3a2aa5,_0x43ef8c){if(_0x3a2aa5[_0xdfc7('0x4a')]['id']){delete _0x3a2aa5['body']['id'];}return db[_0xdfc7('0x2d')][_0xdfc7('0x48')]({'where':{'id':_0x3a2aa5[_0xdfc7('0x4b')]['id']}})[_0xdfc7('0x27')](handleEntityNotFound(_0x43ef8c,null))[_0xdfc7('0x27')](saveUpdates(_0x3a2aa5['body'],null))[_0xdfc7('0x27')](respondWithResult(_0x43ef8c,null))[_0xdfc7('0x46')](handleError(_0x43ef8c,null));};exports[_0xdfc7('0x26')]=function(_0x30c0c2,_0xaed396){return db[_0xdfc7('0x2d')]['find']({'where':{'id':_0x30c0c2[_0xdfc7('0x4b')]['id']}})[_0xdfc7('0x27')](handleEntityNotFound(_0xaed396,null))[_0xdfc7('0x27')](removeEntity(_0xaed396,null))['catch'](handleError(_0xaed396,null));}; \ No newline at end of file +var _0xcdb3=['ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','rows','catch','params','intersection','create','body','find','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x200e08,_0x4d55bd){var _0x186293=function(_0x849463){while(--_0x849463){_0x200e08['push'](_0x200e08['shift']());}};_0x186293(++_0x4d55bd);}(_0xcdb3,0x89));var _0x3cdb=function(_0x15e928,_0x55e514){_0x15e928=_0x15e928-0x0;var _0x1b989a=_0xcdb3[_0x15e928];return _0x1b989a;};'use strict';var emlformat=require(_0x3cdb('0x0'));var rimraf=require(_0x3cdb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3cdb('0x2'));var rp=require('request-promise');var moment=require(_0x3cdb('0x3'));var BPromise=require(_0x3cdb('0x4'));var Mustache=require(_0x3cdb('0x5'));var util=require('util');var path=require(_0x3cdb('0x6'));var sox=require(_0x3cdb('0x7'));var csv=require(_0x3cdb('0x8'));var ejs=require(_0x3cdb('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3cdb('0xa'));var crypto=require(_0x3cdb('0xb'));var jsforce=require(_0x3cdb('0xc'));var deskjs=require(_0x3cdb('0xd'));var toCsv=require(_0x3cdb('0x8'));var querystring=require(_0x3cdb('0xe'));var Papa=require(_0x3cdb('0xf'));var Redis=require(_0x3cdb('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3cdb('0x11'));var hardwareService=require(_0x3cdb('0x12'));var logger=require(_0x3cdb('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x3cdb('0x14'));var licenseUtil=require(_0x3cdb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33fb47,_0x3dfebd){_0x3dfebd=_0x3dfebd||0xcc;return function(_0x53bd54){if(_0x53bd54){return _0x33fb47[_0x3cdb('0x16')](_0x3dfebd);}return _0x33fb47[_0x3cdb('0x17')](_0x3dfebd)[_0x3cdb('0x18')]();};}function respondWithResult(_0x46accb,_0x20c637){_0x20c637=_0x20c637||0xc8;return function(_0xa8e937){if(_0xa8e937){return _0x46accb[_0x3cdb('0x17')](_0x20c637)['json'](_0xa8e937);}};}function respondWithFilteredResult(_0x105f79,_0x8446ce){return function(_0x5072f9){if(_0x5072f9){var _0x51198e=typeof _0x8446ce[_0x3cdb('0x19')]===_0x3cdb('0x1a')&&typeof _0x8446ce[_0x3cdb('0x1b')]===_0x3cdb('0x1a');var _0x490be9=_0x5072f9[_0x3cdb('0x1c')];var _0x59e3ea=_0x51198e?0x0:_0x8446ce[_0x3cdb('0x19')];var _0x552ff2=_0x51198e?_0x5072f9[_0x3cdb('0x1c')]:_0x8446ce[_0x3cdb('0x19')]+_0x8446ce['limit'];var _0x5d8ccf;if(_0x552ff2>=_0x490be9){_0x552ff2=_0x490be9;_0x5d8ccf=0xc8;}else{_0x5d8ccf=0xce;}_0x105f79['status'](_0x5d8ccf);return _0x105f79[_0x3cdb('0x1d')](_0x3cdb('0x1e'),_0x59e3ea+'-'+_0x552ff2+'/'+_0x490be9)[_0x3cdb('0x1f')](_0x5072f9);}return null;};}function patchUpdates(_0x4c66ed){return function(_0x552a94){try{jsonpatch[_0x3cdb('0x20')](_0x552a94,_0x4c66ed,!![]);}catch(_0x2f1c2b){return BPromise[_0x3cdb('0x21')](_0x2f1c2b);}return _0x552a94[_0x3cdb('0x22')]();};}function saveUpdates(_0x5efc27,_0x3c34eb){return function(_0x5ae444){if(_0x5ae444){return _0x5ae444[_0x3cdb('0x23')](_0x5efc27)['then'](function(_0x44920e){return _0x44920e;});}return null;};}function removeEntity(_0x2ddf3c,_0x2b814c){return function(_0x99e698){if(_0x99e698){return _0x99e698[_0x3cdb('0x24')]()['then'](function(){_0x2ddf3c[_0x3cdb('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10030d,_0x5e0ff2){return function(_0x345caf){if(!_0x345caf){_0x10030d[_0x3cdb('0x16')](0x194);}return _0x345caf;};}function handleError(_0x1b79c8,_0x5952f0){_0x5952f0=_0x5952f0||0x1f4;return function(_0x384f89){logger[_0x3cdb('0x25')](_0x384f89[_0x3cdb('0x26')]);if(_0x384f89['name']){delete _0x384f89[_0x3cdb('0x27')];}_0x1b79c8[_0x3cdb('0x17')](_0x5952f0)[_0x3cdb('0x28')](_0x384f89);};}exports[_0x3cdb('0x29')]=function(_0x8485bf,_0x30bf2f){var _0x1cbf75={},_0x1d2df7={},_0x50881d={'count':0x0,'rows':[]};var _0x4495bc=_[_0x3cdb('0x2a')](db[_0x3cdb('0x2b')][_0x3cdb('0x2c')],function(_0x2fdabb){return{'name':_0x2fdabb[_0x3cdb('0x2d')],'type':_0x2fdabb['type'][_0x3cdb('0x2e')]};});_0x1d2df7[_0x3cdb('0x2f')]=_[_0x3cdb('0x2a')](_0x4495bc,_0x3cdb('0x27'));_0x1d2df7[_0x3cdb('0x30')]=_['keys'](_0x8485bf[_0x3cdb('0x30')]);_0x1d2df7[_0x3cdb('0x31')]=_['intersection'](_0x1d2df7[_0x3cdb('0x2f')],_0x1d2df7[_0x3cdb('0x30')]);_0x1cbf75[_0x3cdb('0x32')]=_['intersection'](_0x1d2df7[_0x3cdb('0x2f')],qs[_0x3cdb('0x33')](_0x8485bf[_0x3cdb('0x30')][_0x3cdb('0x33')]));_0x1cbf75[_0x3cdb('0x32')]=_0x1cbf75['attributes'][_0x3cdb('0x34')]?_0x1cbf75['attributes']:_0x1d2df7[_0x3cdb('0x2f')];if(!_0x8485bf[_0x3cdb('0x30')]['hasOwnProperty'](_0x3cdb('0x35'))){_0x1cbf75[_0x3cdb('0x1b')]=qs[_0x3cdb('0x1b')](_0x8485bf['query'][_0x3cdb('0x1b')]);_0x1cbf75[_0x3cdb('0x19')]=qs[_0x3cdb('0x19')](_0x8485bf[_0x3cdb('0x30')][_0x3cdb('0x19')]);}_0x1cbf75[_0x3cdb('0x36')]=qs['sort'](_0x8485bf[_0x3cdb('0x30')][_0x3cdb('0x37')]);_0x1cbf75[_0x3cdb('0x38')]=qs[_0x3cdb('0x31')](_[_0x3cdb('0x39')](_0x8485bf[_0x3cdb('0x30')],_0x1d2df7[_0x3cdb('0x31')]),_0x4495bc);if(_0x8485bf['query'][_0x3cdb('0x3a')]){_0x1cbf75[_0x3cdb('0x38')]=_[_0x3cdb('0x3b')](_0x1cbf75[_0x3cdb('0x38')],{'$or':_[_0x3cdb('0x2a')](_0x4495bc,function(_0x562075){if(_0x562075[_0x3cdb('0x3c')]!==_0x3cdb('0x3d')){var _0x3b3870={};_0x3b3870[_0x562075[_0x3cdb('0x27')]]={'$like':'%'+_0x8485bf[_0x3cdb('0x30')]['filter']+'%'};return _0x3b3870;}})});}_0x1cbf75=_[_0x3cdb('0x3b')]({},_0x1cbf75,_0x8485bf[_0x3cdb('0x3e')]);var _0x1d744f={'where':_0x1cbf75[_0x3cdb('0x38')]};return db[_0x3cdb('0x2b')][_0x3cdb('0x1c')](_0x1d744f)[_0x3cdb('0x3f')](function(_0x3673d3){_0x50881d[_0x3cdb('0x1c')]=_0x3673d3;if(_0x8485bf['query'][_0x3cdb('0x40')]){_0x1cbf75[_0x3cdb('0x41')]=[{'all':!![]}];}return db[_0x3cdb('0x2b')]['findAll'](_0x1cbf75);})['then'](function(_0xf9f442){_0x50881d[_0x3cdb('0x42')]=_0xf9f442;return _0x50881d;})['then'](respondWithFilteredResult(_0x30bf2f,_0x1cbf75))[_0x3cdb('0x43')](handleError(_0x30bf2f,null));};exports['show']=function(_0x5798fe,_0x342488){var _0x2898d4={'raw':!![],'where':{'id':_0x5798fe[_0x3cdb('0x44')]['id']}},_0xaa0ede={};_0xaa0ede[_0x3cdb('0x2f')]=_['keys'](db[_0x3cdb('0x2b')][_0x3cdb('0x2c')]);_0xaa0ede[_0x3cdb('0x30')]=_['keys'](_0x5798fe[_0x3cdb('0x30')]);_0xaa0ede[_0x3cdb('0x31')]=_[_0x3cdb('0x45')](_0xaa0ede[_0x3cdb('0x2f')],_0xaa0ede[_0x3cdb('0x30')]);_0x2898d4['attributes']=_[_0x3cdb('0x45')](_0xaa0ede[_0x3cdb('0x2f')],qs[_0x3cdb('0x33')](_0x5798fe[_0x3cdb('0x30')][_0x3cdb('0x33')]));_0x2898d4[_0x3cdb('0x32')]=_0x2898d4[_0x3cdb('0x32')][_0x3cdb('0x34')]?_0x2898d4[_0x3cdb('0x32')]:_0xaa0ede['model'];if(_0x5798fe['query']['includeAll']){_0x2898d4[_0x3cdb('0x41')]=[{'all':!![]}];}_0x2898d4=_[_0x3cdb('0x3b')]({},_0x2898d4,_0x5798fe[_0x3cdb('0x3e')]);return db[_0x3cdb('0x2b')]['find'](_0x2898d4)[_0x3cdb('0x3f')](handleEntityNotFound(_0x342488,null))[_0x3cdb('0x3f')](respondWithResult(_0x342488,null))['catch'](handleError(_0x342488,null));};exports[_0x3cdb('0x46')]=function(_0x34a8b0,_0x117900){return db[_0x3cdb('0x2b')]['create'](_0x34a8b0[_0x3cdb('0x47')],{})[_0x3cdb('0x3f')](respondWithResult(_0x117900,0xc9))['catch'](handleError(_0x117900,null));};exports['update']=function(_0x2cce4c,_0x4e96c1){if(_0x2cce4c['body']['id']){delete _0x2cce4c[_0x3cdb('0x47')]['id'];}return db[_0x3cdb('0x2b')][_0x3cdb('0x48')]({'where':{'id':_0x2cce4c[_0x3cdb('0x44')]['id']}})[_0x3cdb('0x3f')](handleEntityNotFound(_0x4e96c1,null))[_0x3cdb('0x3f')](saveUpdates(_0x2cce4c[_0x3cdb('0x47')],null))[_0x3cdb('0x3f')](respondWithResult(_0x4e96c1,null))[_0x3cdb('0x43')](handleError(_0x4e96c1,null));};exports[_0x3cdb('0x24')]=function(_0x1904d5,_0x365b10){return db[_0x3cdb('0x2b')][_0x3cdb('0x48')]({'where':{'id':_0x1904d5[_0x3cdb('0x44')]['id']}})[_0x3cdb('0x3f')](handleEntityNotFound(_0x365b10,null))[_0x3cdb('0x3f')](removeEntity(_0x365b10,null))['catch'](handleError(_0x365b10,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 4c9a451..9a58a2b 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 _0x4b4d=['define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes'];(function(_0xa79977,_0x4f7f12){var _0x109f10=function(_0x56780f){while(--_0x56780f){_0xa79977['push'](_0xa79977['shift']());}};_0x109f10(++_0x4f7f12);}(_0x4b4d,0xb0));var _0xd4b4=function(_0x3815be,_0xc693be){_0x3815be=_0x3815be-0x0;var _0x309881=_0x4b4d[_0x3815be];return _0x309881;};'use strict';var _=require(_0xd4b4('0x0'));var util=require(_0xd4b4('0x1'));var logger=require(_0xd4b4('0x2'))(_0xd4b4('0x3'));var moment=require(_0xd4b4('0x4'));var BPromise=require(_0xd4b4('0x5'));var rp=require(_0xd4b4('0x6'));var fs=require('fs');var path=require(_0xd4b4('0x7'));var rimraf=require(_0xd4b4('0x8'));var config=require(_0xd4b4('0x9'));var attributes=require(_0xd4b4('0xa'));module['exports']=function(_0x286f9f,_0xa31f70){return _0x286f9f[_0xd4b4('0xb')](_0xd4b4('0xc'),attributes,{'tableName':_0xd4b4('0xd'),'paranoid':![],'indexes':[{'name':_0xd4b4('0xe'),'fields':[_0xd4b4('0xf'),_0xd4b4('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x25ef=['int_vtiger_fields','vtiger_unique_index','idField','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intVtigerField.attributes','exports','define','VtigerField'];(function(_0x1c1b8c,_0x4c253d){var _0x1ee4c4=function(_0xb9bff5){while(--_0xb9bff5){_0x1c1b8c['push'](_0x1c1b8c['shift']());}};_0x1ee4c4(++_0x4c253d);}(_0x25ef,0xf3));var _0xf25e=function(_0xbb2be9,_0x33c378){_0xbb2be9=_0xbb2be9-0x0;var _0x4aedf7=_0x25ef[_0xbb2be9];return _0x4aedf7;};'use strict';var _=require(_0xf25e('0x0'));var util=require(_0xf25e('0x1'));var logger=require(_0xf25e('0x2'))(_0xf25e('0x3'));var moment=require(_0xf25e('0x4'));var BPromise=require('bluebird');var rp=require(_0xf25e('0x5'));var fs=require('fs');var path=require(_0xf25e('0x6'));var rimraf=require(_0xf25e('0x7'));var config=require('../../config/environment');var attributes=require(_0xf25e('0x8'));module[_0xf25e('0x9')]=function(_0x4c9fe9,_0x5003ad){return _0x4c9fe9[_0xf25e('0xa')](_0xf25e('0xb'),attributes,{'tableName':_0xf25e('0xc'),'paranoid':![],'indexes':[{'name':_0xf25e('0xd'),'fields':[_0xf25e('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 181c8c0..e45d6af 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 _0xd691=['debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerField,\x20%s,\x20%s'];(function(_0x401b7d,_0x35a035){var _0x5cc403=function(_0x14778d){while(--_0x14778d){_0x401b7d['push'](_0x401b7d['shift']());}};_0x5cc403(++_0x35a035);}(_0xd691,0x182));var _0x1d69=function(_0x39551a,_0x116007){_0x39551a=_0x39551a-0x0;var _0x4b0b62=_0xd691[_0x39551a];return _0x4b0b62;};'use strict';var _=require('lodash');var util=require(_0x1d69('0x0'));var moment=require(_0x1d69('0x1'));var BPromise=require(_0x1d69('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1d69('0x3'));var logger=require(_0x1d69('0x4'))(_0x1d69('0x5'));var config=require(_0x1d69('0x6'));var jayson=require(_0x1d69('0x7'));var client=jayson['client'][_0x1d69('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x481091,_0xa19511,_0x466cbd){return new BPromise(function(_0x5a95fe,_0x539b6c){return client[_0x1d69('0x9')](_0x481091,_0x466cbd)[_0x1d69('0xa')](function(_0x186505){logger[_0x1d69('0xb')](_0x1d69('0xc'),_0xa19511,'request\x20sent');logger[_0x1d69('0xd')](_0x1d69('0xe'),_0xa19511,_0x1d69('0xf'),JSON[_0x1d69('0x10')](_0x186505));if(_0x186505[_0x1d69('0x11')]){if(_0x186505[_0x1d69('0x11')][_0x1d69('0x12')]===0x1f4){logger[_0x1d69('0x11')](_0x1d69('0xc'),_0xa19511,_0x186505[_0x1d69('0x11')]['message']);return _0x539b6c(_0x186505[_0x1d69('0x11')][_0x1d69('0x13')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0xa19511,_0x186505[_0x1d69('0x11')][_0x1d69('0x13')]);return _0x5a95fe(_0x186505[_0x1d69('0x11')]['message']);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0xa19511,_0x1d69('0xf'));_0x5a95fe(_0x186505['result'][_0x1d69('0x13')]);}})[_0x1d69('0x14')](function(_0xe9c089){logger[_0x1d69('0x11')](_0x1d69('0xc'),_0xa19511,_0xe9c089);_0x539b6c(_0xe9c089);});});} \ No newline at end of file +var _0xe356=['lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','VtigerField,\x20%s,\x20%s','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result'];(function(_0x339db5,_0x441041){var _0x142ff8=function(_0x4c8ac0){while(--_0x4c8ac0){_0x339db5['push'](_0x339db5['shift']());}};_0x142ff8(++_0x441041);}(_0xe356,0x1ee));var _0x6e35=function(_0x380255,_0x1f8089){_0x380255=_0x380255-0x0;var _0x25641e=_0xe356[_0x380255];return _0x25641e;};'use strict';var _=require(_0x6e35('0x0'));var util=require(_0x6e35('0x1'));var moment=require(_0x6e35('0x2'));var BPromise=require(_0x6e35('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e35('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6e35('0x5'));var logger=require(_0x6e35('0x6'))(_0x6e35('0x7'));var config=require('../../config/environment');var jayson=require(_0x6e35('0x8'));var client=jayson[_0x6e35('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x389ae2,_0xba948e,_0x114b4c){return new BPromise(function(_0x1da99b,_0x5119fa){return client[_0x6e35('0xa')](_0x389ae2,_0x114b4c)['then'](function(_0x3b3c16){logger['info'](_0x6e35('0xb'),_0xba948e,'request\x20sent');logger['debug'](_0x6e35('0xc'),_0xba948e,_0x6e35('0xd'),JSON['stringify'](_0x3b3c16));if(_0x3b3c16['error']){if(_0x3b3c16[_0x6e35('0xe')][_0x6e35('0xf')]===0x1f4){logger[_0x6e35('0xe')]('VtigerField,\x20%s,\x20%s',_0xba948e,_0x3b3c16[_0x6e35('0xe')][_0x6e35('0x10')]);return _0x5119fa(_0x3b3c16[_0x6e35('0xe')]['message']);}logger[_0x6e35('0xe')](_0x6e35('0xb'),_0xba948e,_0x3b3c16[_0x6e35('0xe')]['message']);return _0x1da99b(_0x3b3c16[_0x6e35('0xe')][_0x6e35('0x10')]);}else{logger[_0x6e35('0x11')]('VtigerField,\x20%s,\x20%s',_0xba948e,_0x6e35('0xd'));_0x1da99b(_0x3b3c16[_0x6e35('0x12')][_0x6e35('0x10')]);}})['catch'](function(_0x3e7e7a){logger[_0x6e35('0xe')](_0x6e35('0xb'),_0xba948e,_0x3e7e7a);_0x5119fa(_0x3e7e7a);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index ed61261..ade9fe6 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 _0x23d5=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','index','show','/:id/configurations','get','/:id/fields','getFields','post','create','put','/:id','update','delete','destroy','exports','path'];(function(_0x329485,_0x4f7e0d){var _0x3dd0bb=function(_0x2ec059){while(--_0x2ec059){_0x329485['push'](_0x329485['shift']());}};_0x3dd0bb(++_0x4f7e0d);}(_0x23d5,0xd1));var _0x523d=function(_0x5b4091,_0x619a88){_0x5b4091=_0x5b4091-0x0;var _0x595549=_0x23d5[_0x5b4091];return _0x595549;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x523d('0x0'));var timeout=require(_0x523d('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x523d('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x523d('0x3'));var config=require(_0x523d('0x4'));var controller=require(_0x523d('0x5'));router['get']('/',auth[_0x523d('0x6')](),controller[_0x523d('0x7')]);router['get']('/:id',auth[_0x523d('0x6')](),controller[_0x523d('0x8')]);router['get'](_0x523d('0x9'),auth[_0x523d('0x6')](),controller['getConfigurations']);router[_0x523d('0xa')](_0x523d('0xb'),auth[_0x523d('0x6')](),controller[_0x523d('0xc')]);router[_0x523d('0xd')]('/',auth[_0x523d('0x6')](),controller[_0x523d('0xe')]);router[_0x523d('0xd')](_0x523d('0x9'),auth[_0x523d('0x6')](),controller['addConfiguration']);router[_0x523d('0xf')](_0x523d('0x10'),auth[_0x523d('0x6')](),controller[_0x523d('0x11')]);router[_0x523d('0x12')](_0x523d('0x10'),auth['isAuthenticated'](),controller[_0x523d('0x13')]);module[_0x523d('0x14')]=router; \ No newline at end of file +var _0x3e59=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated'];(function(_0x373655,_0x1191ae){var _0x4908a0=function(_0x338cb6){while(--_0x338cb6){_0x373655['push'](_0x373655['shift']());}};_0x4908a0(++_0x1191ae);}(_0x3e59,0xb6));var _0x93e5=function(_0x30cf8d,_0x286354){_0x30cf8d=_0x30cf8d-0x0;var _0x92e924=_0x3e59[_0x30cf8d];return _0x92e924;};'use strict';var multer=require(_0x93e5('0x0'));var util=require('util');var path=require(_0x93e5('0x1'));var timeout=require(_0x93e5('0x2'));var express=require('express');var router=express[_0x93e5('0x3')]();var fs_extra=require(_0x93e5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x93e5('0x5'));var config=require(_0x93e5('0x6'));var controller=require(_0x93e5('0x7'));router[_0x93e5('0x8')]('/',auth[_0x93e5('0x9')](),controller[_0x93e5('0xa')]);router[_0x93e5('0x8')](_0x93e5('0xb'),auth[_0x93e5('0x9')](),controller[_0x93e5('0xc')]);router[_0x93e5('0x8')](_0x93e5('0xd'),auth[_0x93e5('0x9')](),controller[_0x93e5('0xe')]);router[_0x93e5('0x8')](_0x93e5('0xf'),auth['isAuthenticated'](),controller[_0x93e5('0x10')]);router[_0x93e5('0x11')]('/',auth[_0x93e5('0x9')](),controller[_0x93e5('0x12')]);router['post'](_0x93e5('0xd'),auth[_0x93e5('0x9')](),controller['addConfiguration']);router[_0x93e5('0x13')](_0x93e5('0xb'),auth['isAuthenticated'](),controller[_0x93e5('0x14')]);router[_0x93e5('0x15')]('/:id',auth[_0x93e5('0x9')](),controller[_0x93e5('0x16')]);module[_0x93e5('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 3622658..e1f2522 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 _0x2581=['ENUM','password','token','integrationTab','newTab','sequelize','exports','STRING','remoteUri'];(function(_0x99f68b,_0x31afe7){var _0x34e587=function(_0x463d83){while(--_0x463d83){_0x99f68b['push'](_0x99f68b['shift']());}};_0x34e587(++_0x31afe7);}(_0x2581,0xcb));var _0x1258=function(_0xe6ea92,_0x47e161){_0xe6ea92=_0xe6ea92-0x0;var _0x4e1339=_0x2581[_0xe6ea92];return _0x4e1339;};'use strict';var Sequelize=require(_0x1258('0x0'));module[_0x1258('0x1')]={'name':{'type':Sequelize[_0x1258('0x2')]},'description':{'type':Sequelize[_0x1258('0x2')]},'username':{'type':Sequelize[_0x1258('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x1258('0x2')]},'token':{'type':Sequelize[_0x1258('0x2')]},'remoteUri':{'type':Sequelize[_0x1258('0x2')],'unique':_0x1258('0x3')},'authType':{'type':Sequelize[_0x1258('0x4')](_0x1258('0x5'),_0x1258('0x6')),'defaultValue':_0x1258('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x1258('0x4')](_0x1258('0x7'),_0x1258('0x8')),'defaultValue':_0x1258('0x7')}}; \ No newline at end of file +var _0xf108=['newTab','sequelize','STRING','remoteUri','ENUM','password','token','integrationTab'];(function(_0x30c7c5,_0x168208){var _0x29e24e=function(_0x427d3e){while(--_0x427d3e){_0x30c7c5['push'](_0x30c7c5['shift']());}};_0x29e24e(++_0x168208);}(_0xf108,0x1d9));var _0x8f10=function(_0x54c2f9,_0x139a91){_0x54c2f9=_0x54c2f9-0x0;var _0x2ef0bd=_0xf108[_0x54c2f9];return _0x2ef0bd;};'use strict';var Sequelize=require(_0x8f10('0x0'));module['exports']={'name':{'type':Sequelize[_0x8f10('0x1')]},'description':{'type':Sequelize[_0x8f10('0x1')]},'username':{'type':Sequelize[_0x8f10('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8f10('0x1')],'unique':_0x8f10('0x2')},'authType':{'type':Sequelize[_0x8f10('0x3')](_0x8f10('0x4'),_0x8f10('0x5')),'defaultValue':_0x8f10('0x4')},'serverUrl':{'type':Sequelize[_0x8f10('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x8f10('0x3')](_0x8f10('0x6'),_0x8f10('0x7')),'defaultValue':_0x8f10('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 31a42b5..468d063 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 _0xbc9d=['merge','map','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','length','find','create','update','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','getSubjects','channel','ZendeskField','Subjects','Descriptions','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','%s:%s','toString','base64','Basic\x20%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','stack','send','index','ZendeskAccount','rawAttributes','type','key','name','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick'];(function(_0x2e3107,_0x25f970){var _0x833d69=function(_0x420e78){while(--_0x420e78){_0x2e3107['push'](_0x2e3107['shift']());}};_0x833d69(++_0x25f970);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x5a6073,_0x287c10){_0x5a6073=_0x5a6073-0x0;var _0x1a1772=_0xbc9d[_0x5a6073];return _0x1a1772;};'use strict';var emlformat=require(_0xdbc9('0x0'));var rimraf=require(_0xdbc9('0x1'));var zipdir=require(_0xdbc9('0x2'));var jsonpatch=require(_0xdbc9('0x3'));var rp=require(_0xdbc9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbc9('0x5'));var path=require(_0xdbc9('0x6'));var sox=require(_0xdbc9('0x7'));var csv=require(_0xdbc9('0x8'));var ejs=require(_0xdbc9('0x9'));var fs=require('fs');var fs_extra=require(_0xdbc9('0xa'));var _=require(_0xdbc9('0xb'));var squel=require('squel');var crypto=require(_0xdbc9('0xc'));var jsforce=require(_0xdbc9('0xd'));var deskjs=require(_0xdbc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdbc9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbc9('0x10'));var qs=require(_0xdbc9('0x11'));var as=require(_0xdbc9('0x12'));var hardwareService=require(_0xdbc9('0x13'));var logger=require('../../config/logger')(_0xdbc9('0x14'));var utils=require(_0xdbc9('0x15'));var config=require(_0xdbc9('0x16'));var licenseUtil=require(_0xdbc9('0x17'));var db=require(_0xdbc9('0x18'))['db'];var integrations=require(_0xdbc9('0x19'));function respondWithStatusCode(_0x48bc83,_0x567e71){_0x567e71=_0x567e71||0xcc;return function(_0x3d0fdd){if(_0x3d0fdd){return _0x48bc83[_0xdbc9('0x1a')](_0x567e71);}return _0x48bc83[_0xdbc9('0x1b')](_0x567e71)[_0xdbc9('0x1c')]();};}function respondWithResult(_0x53495d,_0x4a9dcb){_0x4a9dcb=_0x4a9dcb||0xc8;return function(_0x2b7bd){if(_0x2b7bd){return _0x53495d[_0xdbc9('0x1b')](_0x4a9dcb)[_0xdbc9('0x1d')](_0x2b7bd);}};}function respondWithFilteredResult(_0x4c7b4f,_0x1b4616){return function(_0x1abee8){if(_0x1abee8){var _0x4fdb81=typeof _0x1b4616[_0xdbc9('0x1e')]===_0xdbc9('0x1f')&&typeof _0x1b4616[_0xdbc9('0x20')]===_0xdbc9('0x1f');var _0x1f22f4=_0x1abee8[_0xdbc9('0x21')];var _0x9f343d=_0x4fdb81?0x0:_0x1b4616[_0xdbc9('0x1e')];var _0x2ad952=_0x4fdb81?_0x1abee8[_0xdbc9('0x21')]:_0x1b4616['offset']+_0x1b4616[_0xdbc9('0x20')];var _0x497be2;if(_0x2ad952>=_0x1f22f4){_0x2ad952=_0x1f22f4;_0x497be2=0xc8;}else{_0x497be2=0xce;}_0x4c7b4f[_0xdbc9('0x1b')](_0x497be2);return _0x4c7b4f[_0xdbc9('0x22')]('Content-Range',_0x9f343d+'-'+_0x2ad952+'/'+_0x1f22f4)[_0xdbc9('0x1d')](_0x1abee8);}return null;};}function patchUpdates(_0x5367dc){return function(_0x569f32){try{jsonpatch['apply'](_0x569f32,_0x5367dc,!![]);}catch(_0x4f3b5d){return BPromise[_0xdbc9('0x23')](_0x4f3b5d);}return _0x569f32[_0xdbc9('0x24')]();};}function saveUpdates(_0x570ad9,_0x16dcf7){return function(_0x20563e){if(_0x20563e){return _0x20563e['update'](_0x570ad9)[_0xdbc9('0x25')](function(_0x6b788){return _0x6b788;});}return null;};}function removeEntity(_0x1b1c0d,_0x119230){return function(_0x3400e7){if(_0x3400e7){return _0x3400e7[_0xdbc9('0x26')]()[_0xdbc9('0x25')](function(){_0x1b1c0d[_0xdbc9('0x1b')](0xcc)[_0xdbc9('0x1c')]();});}};}function handleEntityNotFound(_0x4a868b,_0x550bef){return function(_0xe309ae){if(!_0xe309ae){_0x4a868b[_0xdbc9('0x1a')](0x194);}return _0xe309ae;};}function handleError(_0x1053ca,_0x24fdec){_0x24fdec=_0x24fdec||0x1f4;return function(_0x50c3ee){logger[_0xdbc9('0x27')](_0x50c3ee[_0xdbc9('0x28')]);if(_0x50c3ee['name']){delete _0x50c3ee['name'];}_0x1053ca[_0xdbc9('0x1b')](_0x24fdec)[_0xdbc9('0x29')](_0x50c3ee);};}exports[_0xdbc9('0x2a')]=function(_0x59bfd2,_0x13a432){var _0x539e57={},_0x561f8e={},_0x210a40={'count':0x0,'rows':[]};var _0x49da36=_['map'](db[_0xdbc9('0x2b')][_0xdbc9('0x2c')],function(_0x1cb557){return{'name':_0x1cb557['fieldName'],'type':_0x1cb557[_0xdbc9('0x2d')][_0xdbc9('0x2e')]};});_0x561f8e['model']=_['map'](_0x49da36,_0xdbc9('0x2f'));_0x561f8e[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x59bfd2[_0xdbc9('0x30')]);_0x561f8e[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x561f8e[_0xdbc9('0x34')],_0x561f8e['query']);_0x539e57[_0xdbc9('0x35')]=_[_0xdbc9('0x33')](_0x561f8e[_0xdbc9('0x34')],qs[_0xdbc9('0x36')](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x36')]));_0x539e57['attributes']=_0x539e57[_0xdbc9('0x35')]['length']?_0x539e57['attributes']:_0x561f8e['model'];if(!_0x59bfd2['query']['hasOwnProperty'](_0xdbc9('0x37'))){_0x539e57[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x59bfd2['query'][_0xdbc9('0x20')]);_0x539e57[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x1e')]);}_0x539e57[_0xdbc9('0x38')]=qs['sort'](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x39')]);_0x539e57[_0xdbc9('0x3a')]=qs['filters'](_[_0xdbc9('0x3b')](_0x59bfd2[_0xdbc9('0x30')],_0x561f8e[_0xdbc9('0x32')]),_0x49da36);if(_0x59bfd2[_0xdbc9('0x30')]['filter']){_0x539e57['where']=_[_0xdbc9('0x3c')](_0x539e57[_0xdbc9('0x3a')],{'$or':_[_0xdbc9('0x3d')](_0x49da36,function(_0x1ef970){if(_0x1ef970['type']!==_0xdbc9('0x3e')){var _0x3827be={};_0x3827be[_0x1ef970[_0xdbc9('0x2f')]]={'$like':'%'+_0x59bfd2['query'][_0xdbc9('0x3f')]+'%'};return _0x3827be;}})});}_0x539e57=_[_0xdbc9('0x3c')]({},_0x539e57,_0x59bfd2[_0xdbc9('0x40')]);var _0x523c79={'where':_0x539e57[_0xdbc9('0x3a')]};return db[_0xdbc9('0x2b')]['count'](_0x523c79)['then'](function(_0xfc34d5){_0x210a40[_0xdbc9('0x21')]=_0xfc34d5;if(_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x41')]){_0x539e57['include']=[{'all':!![]}];}return db[_0xdbc9('0x2b')][_0xdbc9('0x42')](_0x539e57);})['then'](function(_0x8445b8){_0x210a40[_0xdbc9('0x43')]=_0x8445b8;return _0x210a40;})['then'](respondWithFilteredResult(_0x13a432,_0x539e57))[_0xdbc9('0x44')](handleError(_0x13a432,null));};exports[_0xdbc9('0x45')]=function(_0x2adb23,_0x3415c3){var _0x3ed4de={'raw':![],'where':{'id':_0x2adb23[_0xdbc9('0x46')]['id']}},_0x1cd538={};_0x1cd538['model']=_['keys'](db[_0xdbc9('0x2b')][_0xdbc9('0x2c')]);_0x1cd538[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x2adb23[_0xdbc9('0x30')]);_0x1cd538[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x1cd538[_0xdbc9('0x34')],_0x1cd538[_0xdbc9('0x30')]);_0x3ed4de[_0xdbc9('0x35')]=_[_0xdbc9('0x33')](_0x1cd538['model'],qs['fields'](_0x2adb23[_0xdbc9('0x30')][_0xdbc9('0x36')]));_0x3ed4de[_0xdbc9('0x35')]=_0x3ed4de[_0xdbc9('0x35')][_0xdbc9('0x47')]?_0x3ed4de[_0xdbc9('0x35')]:_0x1cd538[_0xdbc9('0x34')];if(_0x2adb23[_0xdbc9('0x30')]['includeAll']){_0x3ed4de['include']=[{'all':!![]}];}_0x3ed4de=_[_0xdbc9('0x3c')]({},_0x3ed4de,_0x2adb23[_0xdbc9('0x40')]);return db[_0xdbc9('0x2b')][_0xdbc9('0x48')](_0x3ed4de)[_0xdbc9('0x25')](handleEntityNotFound(_0x3415c3,null))[_0xdbc9('0x25')](respondWithResult(_0x3415c3,null))[_0xdbc9('0x44')](handleError(_0x3415c3,null));};exports[_0xdbc9('0x49')]=function(_0x43e3ec,_0x589557){return db[_0xdbc9('0x2b')][_0xdbc9('0x49')](_0x43e3ec['body'],{})['then'](respondWithResult(_0x589557,0xc9))[_0xdbc9('0x44')](handleError(_0x589557,null));};exports[_0xdbc9('0x4a')]=function(_0x133a13,_0x49a55c){if(_0x133a13[_0xdbc9('0x4b')]['id']){delete _0x133a13[_0xdbc9('0x4b')]['id'];}return db[_0xdbc9('0x2b')][_0xdbc9('0x48')]({'where':{'id':_0x133a13['params']['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x49a55c,null))[_0xdbc9('0x25')](saveUpdates(_0x133a13[_0xdbc9('0x4b')],null))[_0xdbc9('0x25')](respondWithResult(_0x49a55c,null))['catch'](handleError(_0x49a55c,null));};exports[_0xdbc9('0x26')]=function(_0x36c70e,_0x3f49b7){return db[_0xdbc9('0x2b')][_0xdbc9('0x48')]({'where':{'id':_0x36c70e[_0xdbc9('0x46')]['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x3f49b7,null))[_0xdbc9('0x25')](removeEntity(_0x3f49b7,null))['catch'](handleError(_0x3f49b7,null));};exports[_0xdbc9('0x4c')]=function(_0x4d09e1,_0x3f493e,_0x4279bc){var _0x53771a={};var _0x561737={};var _0xc7335d;var _0x4b55df;return db[_0xdbc9('0x2b')][_0xdbc9('0x4d')]({'where':{'id':_0x4d09e1[_0xdbc9('0x46')]['id']}})['then'](handleEntityNotFound(_0x3f493e,null))[_0xdbc9('0x25')](function(_0x1c52e6){if(_0x1c52e6){_0xc7335d=_0x1c52e6;_0x561737[_0xdbc9('0x34')]=_[_0xdbc9('0x31')](db[_0xdbc9('0x4e')][_0xdbc9('0x2c')]);_0x561737[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x4d09e1['query']);_0x561737['filters']=_['intersection'](_0x561737[_0xdbc9('0x34')],_0x561737[_0xdbc9('0x30')]);_0x53771a[_0xdbc9('0x35')]=_['intersection'](_0x561737['model'],qs[_0xdbc9('0x36')](_0x4d09e1[_0xdbc9('0x30')]['fields']));_0x53771a['attributes']=_0x53771a[_0xdbc9('0x35')][_0xdbc9('0x47')]?_0x53771a[_0xdbc9('0x35')]:_0x561737[_0xdbc9('0x34')];_0x53771a[_0xdbc9('0x38')]=qs[_0xdbc9('0x39')](_0x4d09e1['query'][_0xdbc9('0x39')]);_0x53771a[_0xdbc9('0x3a')]=qs[_0xdbc9('0x32')](_['pick'](_0x4d09e1[_0xdbc9('0x30')],_0x561737[_0xdbc9('0x32')]));if(_0x4d09e1[_0xdbc9('0x30')]['filter']){_0x53771a[_0xdbc9('0x3a')]=_['merge'](_0x53771a[_0xdbc9('0x3a')],{'$or':_[_0xdbc9('0x3d')](_0x53771a[_0xdbc9('0x35')],function(_0x26ed1c){var _0x148061={};_0x148061[_0x26ed1c]={'$like':'%'+_0x4d09e1[_0xdbc9('0x30')]['filter']+'%'};return _0x148061;})});}_0x53771a=_[_0xdbc9('0x3c')]({},_0x53771a,_0x4d09e1['options']);return _0xc7335d[_0xdbc9('0x4c')](_0x53771a);}})[_0xdbc9('0x25')](function(_0x53fcd6){if(_0x53fcd6){_0x4b55df=_0x53fcd6[_0xdbc9('0x47')];if(!_0x4d09e1[_0xdbc9('0x30')]['hasOwnProperty']('nolimit')){_0x53771a[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x4d09e1[_0xdbc9('0x30')]['limit']);_0x53771a[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x4d09e1['query'][_0xdbc9('0x1e')]);}return _0xc7335d[_0xdbc9('0x4c')](_0x53771a);}})['then'](function(_0x4876f9){if(_0x4876f9){return _0x4876f9?{'count':_0x4b55df,'rows':_0x4876f9}:null;}})[_0xdbc9('0x25')](respondWithResult(_0x3f493e,null))[_0xdbc9('0x44')](handleError(_0x3f493e,null));};exports[_0xdbc9('0x4f')]=function(_0xa8b4d9,_0x3e93d3,_0x14cbf4){if(_0xa8b4d9[_0xdbc9('0x4b')]['id']){delete _0xa8b4d9[_0xdbc9('0x4b')]['id'];}return db['ZendeskAccount'][_0xdbc9('0x4d')]({'where':{'id':_0xa8b4d9[_0xdbc9('0x46')]['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x3e93d3,null))[_0xdbc9('0x25')](function(_0x38f7da){if(_0x38f7da){_0xa8b4d9[_0xdbc9('0x4b')][_0xdbc9('0x50')]=_0x38f7da['id'];_0xa8b4d9[_0xdbc9('0x4b')]['Subjects']=integrations[_0xdbc9('0x51')](_0xa8b4d9['body'][_0xdbc9('0x52')],_0xa8b4d9['body'][_0xdbc9('0x2d')]);_0xa8b4d9[_0xdbc9('0x4b')]['Descriptions']=integrations['getDescriptions'](_0xa8b4d9['body'][_0xdbc9('0x52')],_0xa8b4d9[_0xdbc9('0x4b')][_0xdbc9('0x2d')]);return db['ZendeskConfiguration'][_0xdbc9('0x49')](_0xa8b4d9[_0xdbc9('0x4b')],{'include':[{'model':db[_0xdbc9('0x53')],'as':_0xdbc9('0x54')},{'model':db[_0xdbc9('0x53')],'as':_0xdbc9('0x55')}]});}return null;})[_0xdbc9('0x25')](respondWithResult(_0x3e93d3,null))[_0xdbc9('0x44')](handleError(_0x3e93d3,null));};exports[_0xdbc9('0x56')]=function(_0x5e6522,_0x2787d9,_0x2c3223){var _0x511778='';return db['ZendeskAccount'][_0xdbc9('0x4d')]({'where':{'id':_0x5e6522[_0xdbc9('0x46')]['id']},'attributes':['id',_0xdbc9('0x57'),_0xdbc9('0x58'),_0xdbc9('0x59'),_0xdbc9('0x5a'),_0xdbc9('0x5b')]})['then'](handleEntityNotFound(_0x2787d9,null))[_0xdbc9('0x25')](function(_0x19af46){if(_0x19af46){_0x511778=_0x19af46[_0xdbc9('0x5b')];var _0x4a412e=_0x511778[_0xdbc9('0x5c')](-0x1);if(_0x4a412e==='/'){_0x511778=_0x511778[_0xdbc9('0x5d')](0x0,_0x511778[_0xdbc9('0x5e')](_0x4a412e));}var _0x2b4905={'method':_0xdbc9('0x5f'),'uri':util[_0xdbc9('0x60')](_0xdbc9('0x61'),_0x511778,_0xdbc9('0x62')),'json':!![]};switch(_0x19af46[_0xdbc9('0x5a')]){case _0xdbc9('0x58'):_0x2b4905[_0xdbc9('0x63')]={'Authorization':util[_0xdbc9('0x60')]('Basic\x20%s',new Buffer(util['format'](_0xdbc9('0x64'),_0x19af46['username'],_0x19af46['password']))[_0xdbc9('0x65')](_0xdbc9('0x66')))};break;case _0xdbc9('0x59'):_0x2b4905['headers']={'Authorization':util[_0xdbc9('0x60')](_0xdbc9('0x67'),new Buffer(util[_0xdbc9('0x60')]('%s/token:%s',_0x19af46[_0xdbc9('0x57')],_0x19af46[_0xdbc9('0x59')]))['toString'](_0xdbc9('0x66')))};break;default:throw new db[(_0xdbc9('0x68'))][(_0xdbc9('0x69'))](_0xdbc9('0x6a'));}return rp(_0x2b4905);}})[_0xdbc9('0x25')](function(_0x501754){if(_0x501754){var _0x4f984b=[_0xdbc9('0x6b'),_0xdbc9('0x6c'),'group',_0xdbc9('0x6d')];_[_0xdbc9('0x6e')](_0x501754[_0xdbc9('0x62')],function(_0x5802fc){return _0x4f984b[_0xdbc9('0x6f')](_0x5802fc[_0xdbc9('0x2d')]);});return{'count':_0x501754[_0xdbc9('0x62')][_0xdbc9('0x47')],'rows':_[_0xdbc9('0x3d')](_0x501754[_0xdbc9('0x62')],function(_0x1b053a){return{'id':_0x1b053a['id'],'name':_0x1b053a[_0xdbc9('0x70')]>0x7?_0x1b053a['title']:_0x1b053a[_0xdbc9('0x2d')],'custom':_0x1b053a[_0xdbc9('0x70')]>0x7?!![]:![],'options':_0x1b053a[_0xdbc9('0x71')]?_0x1b053a[_0xdbc9('0x71')]:_0x1b053a['custom_field_options']?_0x1b053a[_0xdbc9('0x72')]:[]};})};}})['then'](respondWithResult(_0x2787d9,null))['catch'](function(_0x34ebeb){var _0x3400d0=_0x5e6522['query'][_0xdbc9('0x73')]?0x1f4:_0x34ebeb[_0xdbc9('0x74')]||0x1f4;logger[_0xdbc9('0x27')](_0xdbc9('0x75'),_0xdbc9('0x56'),_0x3400d0,JSON[_0xdbc9('0x76')](_0x34ebeb));delete _0x34ebeb[_0xdbc9('0x2f')];if(_0x3400d0===0x191){_0x3400d0=0x190;}_0x2787d9['status'](_0x3400d0)['send'](_0x5e6522[_0xdbc9('0x30')][_0xdbc9('0x73')]?{'message':_0xdbc9('0x77'),'statusCode':_0x34ebeb['statusCode']}:_0x34ebeb);});}; \ No newline at end of file +var _0x7916=['hasOwnProperty','order','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','update','body','getConfigurations','ZendeskConfiguration','sort','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskField','findOne','password','token','remoteUri','slice','substring','GET','format','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','username','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','undefined','count','limit','status','set','apply','save','then','destroy','error','name','map','ZendeskAccount','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes'];(function(_0x42354f,_0x208cd6){var _0x333877=function(_0x4b25f0){while(--_0x4b25f0){_0x42354f['push'](_0x42354f['shift']());}};_0x333877(++_0x208cd6);}(_0x7916,0x128));var _0x6791=function(_0x10d371,_0x22e727){_0x10d371=_0x10d371-0x0;var _0x268600=_0x7916[_0x10d371];return _0x268600;};'use strict';var emlformat=require(_0x6791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6791('0x1'));var jsonpatch=require(_0x6791('0x2'));var rp=require('request-promise');var moment=require(_0x6791('0x3'));var BPromise=require(_0x6791('0x4'));var Mustache=require(_0x6791('0x5'));var util=require(_0x6791('0x6'));var path=require('path');var sox=require(_0x6791('0x7'));var csv=require('to-csv');var ejs=require(_0x6791('0x8'));var fs=require('fs');var fs_extra=require(_0x6791('0x9'));var _=require('lodash');var squel=require(_0x6791('0xa'));var crypto=require('crypto');var jsforce=require(_0x6791('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6791('0xc'));var Papa=require(_0x6791('0xd'));var Redis=require('ioredis');var authService=require(_0x6791('0xe'));var qs=require(_0x6791('0xf'));var as=require(_0x6791('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6791('0x11'))(_0x6791('0x12'));var utils=require(_0x6791('0x13'));var config=require(_0x6791('0x14'));var licenseUtil=require(_0x6791('0x15'));var db=require(_0x6791('0x16'))['db'];var integrations=require(_0x6791('0x17'));function respondWithStatusCode(_0x16c62b,_0x423e22){_0x423e22=_0x423e22||0xcc;return function(_0x11c730){if(_0x11c730){return _0x16c62b[_0x6791('0x18')](_0x423e22);}return _0x16c62b['status'](_0x423e22)['end']();};}function respondWithResult(_0x34b28d,_0x5122f9){_0x5122f9=_0x5122f9||0xc8;return function(_0x2a9151){if(_0x2a9151){return _0x34b28d['status'](_0x5122f9)[_0x6791('0x19')](_0x2a9151);}};}function respondWithFilteredResult(_0x163898,_0x517910){return function(_0x3e4792){if(_0x3e4792){var _0x4b80ed=typeof _0x517910[_0x6791('0x1a')]===_0x6791('0x1b')&&typeof _0x517910['limit']===_0x6791('0x1b');var _0x36d7a1=_0x3e4792['count'];var _0x1872f5=_0x4b80ed?0x0:_0x517910['offset'];var _0xe55dba=_0x4b80ed?_0x3e4792[_0x6791('0x1c')]:_0x517910[_0x6791('0x1a')]+_0x517910[_0x6791('0x1d')];var _0x25adbc;if(_0xe55dba>=_0x36d7a1){_0xe55dba=_0x36d7a1;_0x25adbc=0xc8;}else{_0x25adbc=0xce;}_0x163898[_0x6791('0x1e')](_0x25adbc);return _0x163898[_0x6791('0x1f')]('Content-Range',_0x1872f5+'-'+_0xe55dba+'/'+_0x36d7a1)[_0x6791('0x19')](_0x3e4792);}return null;};}function patchUpdates(_0x306acb){return function(_0x51368e){try{jsonpatch[_0x6791('0x20')](_0x51368e,_0x306acb,!![]);}catch(_0x3b57f0){return BPromise['reject'](_0x3b57f0);}return _0x51368e[_0x6791('0x21')]();};}function saveUpdates(_0x309610,_0x15b9ab){return function(_0x12d83b){if(_0x12d83b){return _0x12d83b['update'](_0x309610)[_0x6791('0x22')](function(_0x1b516d){return _0x1b516d;});}return null;};}function removeEntity(_0x4a8717,_0x53bb44){return function(_0x4b23bc){if(_0x4b23bc){return _0x4b23bc[_0x6791('0x23')]()['then'](function(){_0x4a8717[_0x6791('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a092,_0x496273){return function(_0x5cadc){if(!_0x5cadc){_0x54a092[_0x6791('0x18')](0x194);}return _0x5cadc;};}function handleError(_0xd49b84,_0x56a74e){_0x56a74e=_0x56a74e||0x1f4;return function(_0x3def2e){logger[_0x6791('0x24')](_0x3def2e['stack']);if(_0x3def2e[_0x6791('0x25')]){delete _0x3def2e['name'];}_0xd49b84[_0x6791('0x1e')](_0x56a74e)['send'](_0x3def2e);};}exports['index']=function(_0x270a1d,_0x551718){var _0x2f56a2={},_0x34b006={},_0x483d6c={'count':0x0,'rows':[]};var _0x240a9f=_[_0x6791('0x26')](db[_0x6791('0x27')][_0x6791('0x28')],function(_0x5d9d54){return{'name':_0x5d9d54['fieldName'],'type':_0x5d9d54[_0x6791('0x29')]['key']};});_0x34b006[_0x6791('0x2a')]=_[_0x6791('0x26')](_0x240a9f,_0x6791('0x25'));_0x34b006[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x270a1d[_0x6791('0x2b')]);_0x34b006[_0x6791('0x2d')]=_[_0x6791('0x2e')](_0x34b006[_0x6791('0x2a')],_0x34b006[_0x6791('0x2b')]);_0x2f56a2['attributes']=_[_0x6791('0x2e')](_0x34b006[_0x6791('0x2a')],qs[_0x6791('0x2f')](_0x270a1d[_0x6791('0x2b')][_0x6791('0x2f')]));_0x2f56a2[_0x6791('0x30')]=_0x2f56a2['attributes']['length']?_0x2f56a2['attributes']:_0x34b006[_0x6791('0x2a')];if(!_0x270a1d[_0x6791('0x2b')][_0x6791('0x31')]('nolimit')){_0x2f56a2['limit']=qs[_0x6791('0x1d')](_0x270a1d[_0x6791('0x2b')][_0x6791('0x1d')]);_0x2f56a2[_0x6791('0x1a')]=qs['offset'](_0x270a1d[_0x6791('0x2b')][_0x6791('0x1a')]);}_0x2f56a2[_0x6791('0x32')]=qs['sort'](_0x270a1d[_0x6791('0x2b')]['sort']);_0x2f56a2['where']=qs[_0x6791('0x2d')](_[_0x6791('0x33')](_0x270a1d['query'],_0x34b006[_0x6791('0x2d')]),_0x240a9f);if(_0x270a1d[_0x6791('0x2b')][_0x6791('0x34')]){_0x2f56a2[_0x6791('0x35')]=_[_0x6791('0x36')](_0x2f56a2['where'],{'$or':_[_0x6791('0x26')](_0x240a9f,function(_0xc95516){if(_0xc95516[_0x6791('0x29')]!=='VIRTUAL'){var _0x3a6062={};_0x3a6062[_0xc95516[_0x6791('0x25')]]={'$like':'%'+_0x270a1d[_0x6791('0x2b')]['filter']+'%'};return _0x3a6062;}})});}_0x2f56a2=_[_0x6791('0x36')]({},_0x2f56a2,_0x270a1d[_0x6791('0x37')]);var _0x13be81={'where':_0x2f56a2[_0x6791('0x35')]};return db['ZendeskAccount'][_0x6791('0x1c')](_0x13be81)[_0x6791('0x22')](function(_0x3e95b6){_0x483d6c[_0x6791('0x1c')]=_0x3e95b6;if(_0x270a1d[_0x6791('0x2b')][_0x6791('0x38')]){_0x2f56a2[_0x6791('0x39')]=[{'all':!![]}];}return db[_0x6791('0x27')][_0x6791('0x3a')](_0x2f56a2);})['then'](function(_0x52c03a){_0x483d6c[_0x6791('0x3b')]=_0x52c03a;return _0x483d6c;})[_0x6791('0x22')](respondWithFilteredResult(_0x551718,_0x2f56a2))['catch'](handleError(_0x551718,null));};exports[_0x6791('0x3c')]=function(_0x1c9913,_0x1c6803){var _0x3edb86={'raw':![],'where':{'id':_0x1c9913[_0x6791('0x3d')]['id']}},_0x1a922e={};_0x1a922e[_0x6791('0x2a')]=_['keys'](db[_0x6791('0x27')]['rawAttributes']);_0x1a922e[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x1c9913[_0x6791('0x2b')]);_0x1a922e[_0x6791('0x2d')]=_['intersection'](_0x1a922e[_0x6791('0x2a')],_0x1a922e[_0x6791('0x2b')]);_0x3edb86[_0x6791('0x30')]=_[_0x6791('0x2e')](_0x1a922e[_0x6791('0x2a')],qs[_0x6791('0x2f')](_0x1c9913[_0x6791('0x2b')][_0x6791('0x2f')]));_0x3edb86['attributes']=_0x3edb86[_0x6791('0x30')][_0x6791('0x3e')]?_0x3edb86[_0x6791('0x30')]:_0x1a922e[_0x6791('0x2a')];if(_0x1c9913['query'][_0x6791('0x38')]){_0x3edb86[_0x6791('0x39')]=[{'all':!![]}];}_0x3edb86=_['merge']({},_0x3edb86,_0x1c9913[_0x6791('0x37')]);return db['ZendeskAccount'][_0x6791('0x3f')](_0x3edb86)[_0x6791('0x22')](handleEntityNotFound(_0x1c6803,null))[_0x6791('0x22')](respondWithResult(_0x1c6803,null))[_0x6791('0x40')](handleError(_0x1c6803,null));};exports[_0x6791('0x41')]=function(_0xb2a2,_0x4163f5){return db[_0x6791('0x27')][_0x6791('0x41')](_0xb2a2['body'],{})[_0x6791('0x22')](respondWithResult(_0x4163f5,0xc9))['catch'](handleError(_0x4163f5,null));};exports[_0x6791('0x42')]=function(_0x2bb86a,_0x276002){if(_0x2bb86a[_0x6791('0x43')]['id']){delete _0x2bb86a[_0x6791('0x43')]['id'];}return db['ZendeskAccount'][_0x6791('0x3f')]({'where':{'id':_0x2bb86a[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x276002,null))[_0x6791('0x22')](saveUpdates(_0x2bb86a[_0x6791('0x43')],null))['then'](respondWithResult(_0x276002,null))[_0x6791('0x40')](handleError(_0x276002,null));};exports[_0x6791('0x23')]=function(_0x4ff9f4,_0x3df699){return db['ZendeskAccount'][_0x6791('0x3f')]({'where':{'id':_0x4ff9f4[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x3df699,null))[_0x6791('0x22')](removeEntity(_0x3df699,null))['catch'](handleError(_0x3df699,null));};exports[_0x6791('0x44')]=function(_0x243faf,_0x5655c8,_0x189b22){var _0x4370ab={};var _0x3a895b={};var _0x5df56e;var _0x355e97;return db[_0x6791('0x27')]['findOne']({'where':{'id':_0x243faf[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x5655c8,null))['then'](function(_0x169531){if(_0x169531){_0x5df56e=_0x169531;_0x3a895b[_0x6791('0x2a')]=_[_0x6791('0x2c')](db[_0x6791('0x45')]['rawAttributes']);_0x3a895b[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x243faf[_0x6791('0x2b')]);_0x3a895b['filters']=_['intersection'](_0x3a895b[_0x6791('0x2a')],_0x3a895b[_0x6791('0x2b')]);_0x4370ab[_0x6791('0x30')]=_[_0x6791('0x2e')](_0x3a895b[_0x6791('0x2a')],qs['fields'](_0x243faf['query'][_0x6791('0x2f')]));_0x4370ab['attributes']=_0x4370ab['attributes'][_0x6791('0x3e')]?_0x4370ab[_0x6791('0x30')]:_0x3a895b[_0x6791('0x2a')];_0x4370ab[_0x6791('0x32')]=qs[_0x6791('0x46')](_0x243faf[_0x6791('0x2b')]['sort']);_0x4370ab['where']=qs[_0x6791('0x2d')](_[_0x6791('0x33')](_0x243faf['query'],_0x3a895b[_0x6791('0x2d')]));if(_0x243faf['query'][_0x6791('0x34')]){_0x4370ab[_0x6791('0x35')]=_['merge'](_0x4370ab[_0x6791('0x35')],{'$or':_[_0x6791('0x26')](_0x4370ab[_0x6791('0x30')],function(_0x49ed65){var _0x3ba679={};_0x3ba679[_0x49ed65]={'$like':'%'+_0x243faf[_0x6791('0x2b')][_0x6791('0x34')]+'%'};return _0x3ba679;})});}_0x4370ab=_[_0x6791('0x36')]({},_0x4370ab,_0x243faf[_0x6791('0x37')]);return _0x5df56e['getConfigurations'](_0x4370ab);}})['then'](function(_0x1a9acd){if(_0x1a9acd){_0x355e97=_0x1a9acd[_0x6791('0x3e')];if(!_0x243faf['query'][_0x6791('0x31')](_0x6791('0x47'))){_0x4370ab[_0x6791('0x1d')]=qs[_0x6791('0x1d')](_0x243faf[_0x6791('0x2b')][_0x6791('0x1d')]);_0x4370ab[_0x6791('0x1a')]=qs[_0x6791('0x1a')](_0x243faf['query'][_0x6791('0x1a')]);}return _0x5df56e[_0x6791('0x44')](_0x4370ab);}})[_0x6791('0x22')](function(_0x1a9a2e){if(_0x1a9a2e){return _0x1a9a2e?{'count':_0x355e97,'rows':_0x1a9a2e}:null;}})['then'](respondWithResult(_0x5655c8,null))[_0x6791('0x40')](handleError(_0x5655c8,null));};exports[_0x6791('0x48')]=function(_0xa8a8dd,_0x5ca809,_0x205320){if(_0xa8a8dd[_0x6791('0x43')]['id']){delete _0xa8a8dd[_0x6791('0x43')]['id'];}return db[_0x6791('0x27')]['findOne']({'where':{'id':_0xa8a8dd[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x5ca809,null))['then'](function(_0x1114d4){if(_0x1114d4){_0xa8a8dd[_0x6791('0x43')][_0x6791('0x49')]=_0x1114d4['id'];_0xa8a8dd[_0x6791('0x43')][_0x6791('0x4a')]=integrations[_0x6791('0x4b')](_0xa8a8dd['body'][_0x6791('0x4c')],_0xa8a8dd[_0x6791('0x43')][_0x6791('0x29')]);_0xa8a8dd['body'][_0x6791('0x4d')]=integrations['getDescriptions'](_0xa8a8dd[_0x6791('0x43')][_0x6791('0x4c')],_0xa8a8dd[_0x6791('0x43')][_0x6791('0x29')]);return db[_0x6791('0x45')]['create'](_0xa8a8dd[_0x6791('0x43')],{'include':[{'model':db[_0x6791('0x4e')],'as':_0x6791('0x4a')},{'model':db[_0x6791('0x4e')],'as':'Descriptions'}]});}return null;})[_0x6791('0x22')](respondWithResult(_0x5ca809,null))[_0x6791('0x40')](handleError(_0x5ca809,null));};exports['getFields']=function(_0x34691c,_0x1fa44a,_0x567302){var _0x201465='';return db[_0x6791('0x27')][_0x6791('0x4f')]({'where':{'id':_0x34691c[_0x6791('0x3d')]['id']},'attributes':['id','username',_0x6791('0x50'),_0x6791('0x51'),'authType',_0x6791('0x52')]})[_0x6791('0x22')](handleEntityNotFound(_0x1fa44a,null))[_0x6791('0x22')](function(_0x20c736){if(_0x20c736){_0x201465=_0x20c736[_0x6791('0x52')];var _0x4ecf62=_0x201465[_0x6791('0x53')](-0x1);if(_0x4ecf62==='/'){_0x201465=_0x201465[_0x6791('0x54')](0x0,_0x201465['lastIndexOf'](_0x4ecf62));}var _0x4463ef={'method':_0x6791('0x55'),'uri':util[_0x6791('0x56')]('%s/%s',_0x201465,_0x6791('0x57')),'json':!![]};switch(_0x20c736[_0x6791('0x58')]){case _0x6791('0x50'):_0x4463ef[_0x6791('0x59')]={'Authorization':util[_0x6791('0x56')](_0x6791('0x5a'),new Buffer(util[_0x6791('0x56')](_0x6791('0x5b'),_0x20c736['username'],_0x20c736[_0x6791('0x50')]))[_0x6791('0x5c')]('base64'))};break;case _0x6791('0x51'):_0x4463ef[_0x6791('0x59')]={'Authorization':util[_0x6791('0x56')]('Basic\x20%s',new Buffer(util[_0x6791('0x56')]('%s/token:%s',_0x20c736[_0x6791('0x5d')],_0x20c736[_0x6791('0x51')]))[_0x6791('0x5c')](_0x6791('0x5e')))};break;default:throw new db[(_0x6791('0x5f'))][(_0x6791('0x60'))](_0x6791('0x61'));}return rp(_0x4463ef);}})[_0x6791('0x22')](function(_0x23e0d3){if(_0x23e0d3){var _0x1fa853=[_0x6791('0x62'),_0x6791('0x63'),_0x6791('0x64'),_0x6791('0x65')];_[_0x6791('0x66')](_0x23e0d3[_0x6791('0x57')],function(_0x3b53b8){return _0x1fa853[_0x6791('0x67')](_0x3b53b8[_0x6791('0x29')]);});return{'count':_0x23e0d3['ticket_fields']['length'],'rows':_['map'](_0x23e0d3[_0x6791('0x57')],function(_0x31c1a8){return{'id':_0x31c1a8['id'],'name':_0x31c1a8[_0x6791('0x68')]>0x7?_0x31c1a8[_0x6791('0x69')]:_0x31c1a8[_0x6791('0x29')],'custom':_0x31c1a8[_0x6791('0x68')]>0x7?!![]:![],'options':_0x31c1a8[_0x6791('0x6a')]?_0x31c1a8[_0x6791('0x6a')]:_0x31c1a8[_0x6791('0x6b')]?_0x31c1a8[_0x6791('0x6b')]:[]};})};}})[_0x6791('0x22')](respondWithResult(_0x1fa44a,null))[_0x6791('0x40')](function(_0x44ec4d){var _0x4047b6=_0x34691c[_0x6791('0x2b')][_0x6791('0x6c')]?0x1f4:_0x44ec4d[_0x6791('0x6d')]||0x1f4;logger[_0x6791('0x24')](_0x6791('0x6e'),_0x6791('0x6f'),_0x4047b6,JSON[_0x6791('0x70')](_0x44ec4d));delete _0x44ec4d[_0x6791('0x25')];if(_0x4047b6===0x191){_0x4047b6=0x190;}_0x1fa44a[_0x6791('0x1e')](_0x4047b6)[_0x6791('0x71')](_0x34691c[_0x6791('0x2b')]['test']?{'message':_0x6791('0x72'),'statusCode':_0x44ec4d['statusCode']}:_0x44ec4d);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 8b0fb74..4af5592 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 _0x7d34=['../../config/environment','./intZendeskAccount.attributes','exports','define','ZendeskAccount','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4547c7,_0x414a46){var _0x389625=function(_0x1ab359){while(--_0x1ab359){_0x4547c7['push'](_0x4547c7['shift']());}};_0x389625(++_0x414a46);}(_0x7d34,0x198));var _0x47d3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x7d34[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x47d3('0x0'));var util=require(_0x47d3('0x1'));var logger=require(_0x47d3('0x2'))(_0x47d3('0x3'));var moment=require(_0x47d3('0x4'));var BPromise=require(_0x47d3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47d3('0x6'));var rimraf=require(_0x47d3('0x7'));var config=require(_0x47d3('0x8'));var attributes=require(_0x47d3('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x47d3('0xa')]=function(_0x4eb994,_0x3e290f){return _0x4eb994[_0x47d3('0xb')](_0x47d3('0xc'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7793=['int_zendesk_accounts','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./intZendeskAccount.attributes','exports'];(function(_0x4513e8,_0x16f480){var _0x1e8758=function(_0x5c2038){while(--_0x5c2038){_0x4513e8['push'](_0x4513e8['shift']());}};_0x1e8758(++_0x16f480);}(_0x7793,0x97));var _0x3779=function(_0x492dfd,_0x40f69e){_0x492dfd=_0x492dfd-0x0;var _0x55c595=_0x7793[_0x492dfd];return _0x55c595;};'use strict';var _=require(_0x3779('0x0'));var util=require('util');var logger=require(_0x3779('0x1'))(_0x3779('0x2'));var moment=require(_0x3779('0x3'));var BPromise=require(_0x3779('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3779('0x5'));var rimraf=require('rimraf');var config=require(_0x3779('0x6'));var attributes=require(_0x3779('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x3779('0x8')]=function(_0x403cf9,_0x2af7d3){return _0x403cf9['define']('ZendeskAccount',attributes,{'tableName':_0x3779('0x9'),'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 1dfb352..b2e7e0a 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 _0x5315=['catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','limit','include','map','attributes','model','ShowZendeskAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ZendeskAccount,\x20%s,\x20%s','result'];(function(_0x117005,_0x2cd977){var _0x42d561=function(_0x1a427e){while(--_0x1a427e){_0x117005['push'](_0x117005['shift']());}};_0x42d561(++_0x2cd977);}(_0x5315,0x1a5));var _0x5531=function(_0x33f77e,_0x40468f){_0x33f77e=_0x33f77e-0x0;var _0x166d01=_0x5315[_0x33f77e];return _0x166d01;};'use strict';var _=require(_0x5531('0x0'));var util=require(_0x5531('0x1'));var moment=require(_0x5531('0x2'));var BPromise=require(_0x5531('0x3'));var rs=require(_0x5531('0x4'));var fs=require('fs');var Redis=require(_0x5531('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5531('0x6'));var logger=require(_0x5531('0x7'))(_0x5531('0x8'));var config=require(_0x5531('0x9'));var jayson=require(_0x5531('0xa'));var client=jayson[_0x5531('0xb')][_0x5531('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3bd92b,_0xbce265,_0x141238){return new BPromise(function(_0x44a34,_0x1eec92){return client['request'](_0x3bd92b,_0x141238)[_0x5531('0xd')](function(_0x257ceb){logger[_0x5531('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0xbce265,_0x5531('0xf'));logger[_0x5531('0x10')](_0x5531('0x11'),_0xbce265,_0x5531('0xf'),JSON[_0x5531('0x12')](_0x257ceb));if(_0x257ceb[_0x5531('0x13')]){if(_0x257ceb[_0x5531('0x13')]['code']===0x1f4){logger[_0x5531('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0xbce265,_0x257ceb[_0x5531('0x13')][_0x5531('0x14')]);return _0x1eec92(_0x257ceb[_0x5531('0x13')]['message']);}logger['error'](_0x5531('0x15'),_0xbce265,_0x257ceb[_0x5531('0x13')][_0x5531('0x14')]);return _0x44a34(_0x257ceb['error']['message']);}else{logger[_0x5531('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0xbce265,'request\x20sent');_0x44a34(_0x257ceb[_0x5531('0x16')][_0x5531('0x14')]);}})[_0x5531('0x17')](function(_0xb84aad){logger[_0x5531('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0xbce265,_0xb84aad);_0x1eec92(_0xb84aad);});});}exports[_0x5531('0x18')]=function(_0x129722){var _0x386d66=this;return new Promise(function(_0x11a77a,_0x5eba14){return db[_0x5531('0x19')][_0x5531('0x1a')]({'raw':_0x129722['options']?_0x129722[_0x5531('0x1b')][_0x5531('0x1c')]===undefined?!![]:![]:!![],'where':_0x129722[_0x5531('0x1b')]?_0x129722[_0x5531('0x1b')]['where']||null:null,'attributes':_0x129722['options']?_0x129722[_0x5531('0x1b')]['attributes']||null:null,'limit':_0x129722[_0x5531('0x1b')]?_0x129722[_0x5531('0x1b')][_0x5531('0x1d')]||null:null,'include':_0x129722[_0x5531('0x1b')]?_0x129722[_0x5531('0x1b')][_0x5531('0x1e')]?_[_0x5531('0x1f')](_0x129722[_0x5531('0x1b')][_0x5531('0x1e')],function(_0x1017db){return{'model':db[_0x1017db['model']],'as':_0x1017db['as'],'attributes':_0x1017db[_0x5531('0x20')],'include':_0x1017db[_0x5531('0x1e')]?_['map'](_0x1017db[_0x5531('0x1e')],function(_0x4ca732){return{'model':db[_0x4ca732[_0x5531('0x21')]],'as':_0x4ca732['as'],'attributes':_0x4ca732[_0x5531('0x20')],'include':_0x4ca732[_0x5531('0x1e')]?_[_0x5531('0x1f')](_0x4ca732[_0x5531('0x1e')],function(_0x12f90d){return{'model':db[_0x12f90d[_0x5531('0x21')]],'as':_0x12f90d['as'],'attributes':_0x12f90d[_0x5531('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5531('0xd')](function(_0x46c33a){logger[_0x5531('0xe')](_0x5531('0x18'),_0x129722);logger['debug']('GetZendeskAccount',_0x129722,JSON[_0x5531('0x12')](_0x46c33a));_0x11a77a(_0x46c33a);})[_0x5531('0x17')](function(_0x428635){logger[_0x5531('0x13')]('GetZendeskAccount',_0x428635[_0x5531('0x14')],_0x129722);_0x5eba14(_0x386d66['error'](0x1f4,_0x428635['message']));});});};exports[_0x5531('0x22')]=function(_0x1279a4){var _0x1139af=this;return new Promise(function(_0x4b6605,_0xa4a260){return db['ZendeskAccount'][_0x5531('0x23')]({'raw':_0x1279a4[_0x5531('0x1b')]?_0x1279a4[_0x5531('0x1b')][_0x5531('0x1c')]===undefined?!![]:![]:!![],'where':_0x1279a4['options']?_0x1279a4[_0x5531('0x1b')][_0x5531('0x24')]||null:null,'attributes':_0x1279a4['options']?_0x1279a4[_0x5531('0x1b')][_0x5531('0x20')]||null:null,'include':_0x1279a4[_0x5531('0x1b')]?_0x1279a4['options'][_0x5531('0x1e')]?_[_0x5531('0x1f')](_0x1279a4[_0x5531('0x1b')][_0x5531('0x1e')],function(_0xe4938){return{'model':db[_0xe4938['model']],'as':_0xe4938['as'],'attributes':_0xe4938[_0x5531('0x20')],'include':_0xe4938['include']?_[_0x5531('0x1f')](_0xe4938[_0x5531('0x1e')],function(_0x171945){return{'model':db[_0x171945[_0x5531('0x21')]],'as':_0x171945['as'],'attributes':_0x171945[_0x5531('0x20')],'include':_0x171945[_0x5531('0x1e')]?_[_0x5531('0x1f')](_0x171945[_0x5531('0x1e')],function(_0x5659df){return{'model':db[_0x5659df[_0x5531('0x21')]],'as':_0x5659df['as'],'attributes':_0x5659df[_0x5531('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5531('0xd')](function(_0x5a6e92){logger[_0x5531('0xe')](_0x5531('0x22'),_0x1279a4);logger[_0x5531('0x10')](_0x5531('0x22'),_0x1279a4,JSON[_0x5531('0x12')](_0x5a6e92));_0x4b6605(_0x5a6e92);})['catch'](function(_0x5da51c){logger[_0x5531('0x13')]('ShowZendeskAccount',_0x5da51c[_0x5531('0x14')],_0x1279a4);_0xa4a260(_0x1139af[_0x5531('0x13')](0x1f4,_0x5da51c[_0x5531('0x14')]));});});}; \ No newline at end of file +var _0xb99c=['ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetZendeskAccount','findAll','options','raw','attributes','map','include','model','debug','ShowZendeskAccount','ZendeskAccount','find','where','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x46e523,_0xe6fccb){var _0x5da0ee=function(_0x396682){while(--_0x396682){_0x46e523['push'](_0x46e523['shift']());}};_0x5da0ee(++_0xe6fccb);}(_0xb99c,0x1c6));var _0xcb99=function(_0x2da9db,_0x16a3e4){_0x2da9db=_0x2da9db-0x0;var _0x306a99=_0xb99c[_0x2da9db];return _0x306a99;};'use strict';var _=require(_0xcb99('0x0'));var util=require('util');var moment=require(_0xcb99('0x1'));var BPromise=require(_0xcb99('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb99('0x3'));var db=require(_0xcb99('0x4'))['db'];var utils=require(_0xcb99('0x5'));var logger=require(_0xcb99('0x6'))('rpc');var config=require(_0xcb99('0x7'));var jayson=require(_0xcb99('0x8'));var client=jayson[_0xcb99('0x9')][_0xcb99('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x398d83,_0x12907a,_0x2691d6){return new BPromise(function(_0x1afdf3,_0x4d2b73){return client[_0xcb99('0xb')](_0x398d83,_0x2691d6)[_0xcb99('0xc')](function(_0x244a32){logger[_0xcb99('0xd')](_0xcb99('0xe'),_0x12907a,_0xcb99('0xf'));logger['debug'](_0xcb99('0x10'),_0x12907a,_0xcb99('0xf'),JSON['stringify'](_0x244a32));if(_0x244a32['error']){if(_0x244a32['error'][_0xcb99('0x11')]===0x1f4){logger[_0xcb99('0x12')](_0xcb99('0xe'),_0x12907a,_0x244a32[_0xcb99('0x12')]['message']);return _0x4d2b73(_0x244a32[_0xcb99('0x12')][_0xcb99('0x13')]);}logger[_0xcb99('0x12')](_0xcb99('0xe'),_0x12907a,_0x244a32['error']['message']);return _0x1afdf3(_0x244a32[_0xcb99('0x12')][_0xcb99('0x13')]);}else{logger[_0xcb99('0xd')](_0xcb99('0xe'),_0x12907a,_0xcb99('0xf'));_0x1afdf3(_0x244a32[_0xcb99('0x14')][_0xcb99('0x13')]);}})[_0xcb99('0x15')](function(_0x9607c4){logger[_0xcb99('0x12')](_0xcb99('0xe'),_0x12907a,_0x9607c4);_0x4d2b73(_0x9607c4);});});}exports[_0xcb99('0x16')]=function(_0x3a13b8){var _0x5ff93f=this;return new Promise(function(_0x82d6c2,_0x534524){return db['ZendeskAccount'][_0xcb99('0x17')]({'raw':_0x3a13b8[_0xcb99('0x18')]?_0x3a13b8[_0xcb99('0x18')][_0xcb99('0x19')]===undefined?!![]:![]:!![],'where':_0x3a13b8[_0xcb99('0x18')]?_0x3a13b8['options']['where']||null:null,'attributes':_0x3a13b8[_0xcb99('0x18')]?_0x3a13b8[_0xcb99('0x18')][_0xcb99('0x1a')]||null:null,'limit':_0x3a13b8[_0xcb99('0x18')]?_0x3a13b8['options']['limit']||null:null,'include':_0x3a13b8['options']?_0x3a13b8[_0xcb99('0x18')]['include']?_[_0xcb99('0x1b')](_0x3a13b8['options'][_0xcb99('0x1c')],function(_0x51b905){return{'model':db[_0x51b905[_0xcb99('0x1d')]],'as':_0x51b905['as'],'attributes':_0x51b905[_0xcb99('0x1a')],'include':_0x51b905['include']?_['map'](_0x51b905[_0xcb99('0x1c')],function(_0x36a693){return{'model':db[_0x36a693[_0xcb99('0x1d')]],'as':_0x36a693['as'],'attributes':_0x36a693[_0xcb99('0x1a')],'include':_0x36a693[_0xcb99('0x1c')]?_[_0xcb99('0x1b')](_0x36a693['include'],function(_0x318e4c){return{'model':db[_0x318e4c['model']],'as':_0x318e4c['as'],'attributes':_0x318e4c[_0xcb99('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcb99('0xc')](function(_0x359af0){logger[_0xcb99('0xd')]('GetZendeskAccount',_0x3a13b8);logger[_0xcb99('0x1e')](_0xcb99('0x16'),_0x3a13b8,JSON['stringify'](_0x359af0));_0x82d6c2(_0x359af0);})[_0xcb99('0x15')](function(_0x5899bd){logger[_0xcb99('0x12')](_0xcb99('0x16'),_0x5899bd[_0xcb99('0x13')],_0x3a13b8);_0x534524(_0x5ff93f[_0xcb99('0x12')](0x1f4,_0x5899bd['message']));});});};exports[_0xcb99('0x1f')]=function(_0x394e23){var _0x38efdc=this;return new Promise(function(_0x551101,_0x4fdad1){return db[_0xcb99('0x20')][_0xcb99('0x21')]({'raw':_0x394e23['options']?_0x394e23[_0xcb99('0x18')][_0xcb99('0x19')]===undefined?!![]:![]:!![],'where':_0x394e23[_0xcb99('0x18')]?_0x394e23[_0xcb99('0x18')][_0xcb99('0x22')]||null:null,'attributes':_0x394e23[_0xcb99('0x18')]?_0x394e23[_0xcb99('0x18')]['attributes']||null:null,'include':_0x394e23[_0xcb99('0x18')]?_0x394e23[_0xcb99('0x18')][_0xcb99('0x1c')]?_[_0xcb99('0x1b')](_0x394e23[_0xcb99('0x18')][_0xcb99('0x1c')],function(_0x4fbd58){return{'model':db[_0x4fbd58[_0xcb99('0x1d')]],'as':_0x4fbd58['as'],'attributes':_0x4fbd58[_0xcb99('0x1a')],'include':_0x4fbd58[_0xcb99('0x1c')]?_['map'](_0x4fbd58[_0xcb99('0x1c')],function(_0x574716){return{'model':db[_0x574716[_0xcb99('0x1d')]],'as':_0x574716['as'],'attributes':_0x574716['attributes'],'include':_0x574716['include']?_['map'](_0x574716[_0xcb99('0x1c')],function(_0x5f5529){return{'model':db[_0x5f5529['model']],'as':_0x5f5529['as'],'attributes':_0x5f5529[_0xcb99('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45495b){logger[_0xcb99('0xd')](_0xcb99('0x1f'),_0x394e23);logger['debug'](_0xcb99('0x1f'),_0x394e23,JSON[_0xcb99('0x23')](_0x45495b));_0x551101(_0x45495b);})[_0xcb99('0x15')](function(_0x5c2320){logger[_0xcb99('0x12')](_0xcb99('0x1f'),_0x5c2320['message'],_0x394e23);_0x4fdad1(_0x38efdc[_0xcb99('0x12')](0x1f4,_0x5c2320['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index be87c12..c323891 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 _0x4fc2=['get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','/:id','show'];(function(_0x210a36,_0x4f26d0){var _0x469407=function(_0x47067e){while(--_0x47067e){_0x210a36['push'](_0x210a36['shift']());}};_0x469407(++_0x4f26d0);}(_0x4fc2,0x111));var _0x24fc=function(_0x382af1,_0x44e6d1){_0x382af1=_0x382af1-0x0;var _0x31d1ca=_0x4fc2[_0x382af1];return _0x31d1ca;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['getFields']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['get'](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['getTags']);router[_0x24fc('0x14')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x15')]);router[_0x24fc('0x14')](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['setTags']);router[_0x24fc('0x16')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x17')]);router['delete'](_0x24fc('0xb'),auth['isAuthenticated'](),controller[_0x24fc('0x18')]);module[_0x24fc('0x19')]=router; \ No newline at end of file +var _0x878f=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','/:id/fields','/:id/subjects','isAuthenticated','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x878f,0x173));var _0xf878=function(_0xdd8351,_0x1ccdf0){_0xdd8351=_0xdd8351-0x0;var _0x616c02=_0x878f[_0xdd8351];return _0x616c02;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var fs_extra=require(_0xf878('0x5'));var auth=require(_0xf878('0x6'));var interaction=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var controller=require(_0xf878('0x9'));router[_0xf878('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf878('0xa')](_0xf878('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0xf878('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xf878('0xa')](_0xf878('0xd'),auth[_0xf878('0xe')](),controller['getSubjects']);router[_0xf878('0xa')](_0xf878('0xf'),auth['isAuthenticated'](),controller[_0xf878('0x10')]);router['get'](_0xf878('0x11'),auth[_0xf878('0xe')](),controller[_0xf878('0x12')]);router['post']('/',auth[_0xf878('0xe')](),controller[_0xf878('0x13')]);router[_0xf878('0x14')]('/:id/tags',auth[_0xf878('0xe')](),controller[_0xf878('0x15')]);router[_0xf878('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xf878('0x17')]);router[_0xf878('0x18')](_0xf878('0xb'),auth[_0xf878('0xe')](),controller[_0xf878('0x19')]);module[_0xf878('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index f8e1cc3..0c6d688 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 _0x456b=['sequelize','exports','STRING'];(function(_0xc2100d,_0x3c552c){var _0x4bce11=function(_0x522e2a){while(--_0x522e2a){_0xc2100d['push'](_0xc2100d['shift']());}};_0x4bce11(++_0x3c552c);}(_0x456b,0xea));var _0xb456=function(_0x1d9063,_0x4bcd88){_0x1d9063=_0x1d9063-0x0;var _0x2e8fec=_0x456b[_0x1d9063];return _0x2e8fec;};'use strict';var Sequelize=require(_0xb456('0x0'));module[_0xb456('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb456('0x2')]}}; \ No newline at end of file +var _0x2179=['STRING'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2179,0x179));var _0x9217=function(_0x58d90a,_0x1a2ea6){_0x58d90a=_0x58d90a-0x0;var _0x3938a9=_0x2179[_0x58d90a];return _0x3938a9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9217('0x0')]},'description':{'type':Sequelize[_0x9217('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 91a2c2b..bb05698 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 _0x585b=['findOne','ZendeskField','pick','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','undefined','count','offset','limit','status','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','include','options','find','create','body','getFields'];(function(_0x3e85a4,_0x18c3a9){var _0x21e7d1=function(_0x48457d){while(--_0x48457d){_0x3e85a4['push'](_0x3e85a4['shift']());}};_0x21e7d1(++_0x18c3a9);}(_0x585b,0x108));var _0xb585=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x585b[_0x2dadb9];return _0x2f0097;};'use strict';var emlformat=require(_0xb585('0x0'));var rimraf=require(_0xb585('0x1'));var zipdir=require(_0xb585('0x2'));var jsonpatch=require(_0xb585('0x3'));var rp=require(_0xb585('0x4'));var moment=require(_0xb585('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb585('0x6'));var util=require('util');var path=require(_0xb585('0x7'));var sox=require(_0xb585('0x8'));var csv=require('to-csv');var ejs=require(_0xb585('0x9'));var fs=require('fs');var fs_extra=require(_0xb585('0xa'));var _=require('lodash');var squel=require(_0xb585('0xb'));var crypto=require(_0xb585('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb585('0xd'));var querystring=require(_0xb585('0xe'));var Papa=require(_0xb585('0xf'));var Redis=require(_0xb585('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb585('0x11'));var as=require(_0xb585('0x12'));var hardwareService=require(_0xb585('0x13'));var logger=require(_0xb585('0x14'))('api');var utils=require(_0xb585('0x15'));var config=require(_0xb585('0x16'));var licenseUtil=require(_0xb585('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27ca21,_0x28f8df){_0x28f8df=_0x28f8df||0xcc;return function(_0x34b6a4){if(_0x34b6a4){return _0x27ca21[_0xb585('0x18')](_0x28f8df);}return _0x27ca21['status'](_0x28f8df)['end']();};}function respondWithResult(_0x1de36c,_0x222698){_0x222698=_0x222698||0xc8;return function(_0x4a75ba){if(_0x4a75ba){return _0x1de36c['status'](_0x222698)[_0xb585('0x19')](_0x4a75ba);}};}function respondWithFilteredResult(_0x5908d4,_0x22a3e1){return function(_0x3cb936){if(_0x3cb936){var _0x31811f=typeof _0x22a3e1['offset']===_0xb585('0x1a')&&typeof _0x22a3e1['limit']===_0xb585('0x1a');var _0x1f6439=_0x3cb936[_0xb585('0x1b')];var _0x4a0dfa=_0x31811f?0x0:_0x22a3e1[_0xb585('0x1c')];var _0x355c8c=_0x31811f?_0x3cb936[_0xb585('0x1b')]:_0x22a3e1[_0xb585('0x1c')]+_0x22a3e1[_0xb585('0x1d')];var _0x2d2218;if(_0x355c8c>=_0x1f6439){_0x355c8c=_0x1f6439;_0x2d2218=0xc8;}else{_0x2d2218=0xce;}_0x5908d4[_0xb585('0x1e')](_0x2d2218);return _0x5908d4[_0xb585('0x1f')](_0xb585('0x20'),_0x4a0dfa+'-'+_0x355c8c+'/'+_0x1f6439)[_0xb585('0x19')](_0x3cb936);}return null;};}function patchUpdates(_0x4c07bc){return function(_0x414cc5){try{jsonpatch['apply'](_0x414cc5,_0x4c07bc,!![]);}catch(_0x34d481){return BPromise[_0xb585('0x21')](_0x34d481);}return _0x414cc5[_0xb585('0x22')]();};}function saveUpdates(_0xef3fb6,_0x12531a){return function(_0x3c22a2){if(_0x3c22a2){return _0x3c22a2[_0xb585('0x23')](_0xef3fb6)[_0xb585('0x24')](function(_0x2deace){return _0x2deace;});}return null;};}function removeEntity(_0x6075e9,_0x5db02f){return function(_0x3cf6ef){if(_0x3cf6ef){return _0x3cf6ef[_0xb585('0x25')]()[_0xb585('0x24')](function(){_0x6075e9[_0xb585('0x1e')](0xcc)[_0xb585('0x26')]();});}};}function handleEntityNotFound(_0x3f70a5,_0x2ab2cb){return function(_0x361762){if(!_0x361762){_0x3f70a5[_0xb585('0x18')](0x194);}return _0x361762;};}function handleError(_0x17b07f,_0x571675){_0x571675=_0x571675||0x1f4;return function(_0x1942be){logger[_0xb585('0x27')](_0x1942be[_0xb585('0x28')]);if(_0x1942be[_0xb585('0x29')]){delete _0x1942be[_0xb585('0x29')];}_0x17b07f['status'](_0x571675)[_0xb585('0x2a')](_0x1942be);};}exports['index']=function(_0x2cd22e,_0x5b70e5){var _0x4fb9d4={},_0x248ddc={},_0x534b27={'count':0x0,'rows':[]};var _0x3c5d09=_[_0xb585('0x2b')](db[_0xb585('0x2c')][_0xb585('0x2d')],function(_0x32a824){return{'name':_0x32a824[_0xb585('0x2e')],'type':_0x32a824[_0xb585('0x2f')][_0xb585('0x30')]};});_0x248ddc[_0xb585('0x31')]=_['map'](_0x3c5d09,'name');_0x248ddc['query']=_[_0xb585('0x32')](_0x2cd22e[_0xb585('0x33')]);_0x248ddc[_0xb585('0x34')]=_[_0xb585('0x35')](_0x248ddc[_0xb585('0x31')],_0x248ddc[_0xb585('0x33')]);_0x4fb9d4[_0xb585('0x36')]=_['intersection'](_0x248ddc[_0xb585('0x31')],qs[_0xb585('0x37')](_0x2cd22e[_0xb585('0x33')]['fields']));_0x4fb9d4[_0xb585('0x36')]=_0x4fb9d4[_0xb585('0x36')][_0xb585('0x38')]?_0x4fb9d4['attributes']:_0x248ddc[_0xb585('0x31')];if(!_0x2cd22e[_0xb585('0x33')][_0xb585('0x39')](_0xb585('0x3a'))){_0x4fb9d4['limit']=qs[_0xb585('0x1d')](_0x2cd22e['query'][_0xb585('0x1d')]);_0x4fb9d4[_0xb585('0x1c')]=qs[_0xb585('0x1c')](_0x2cd22e[_0xb585('0x33')]['offset']);}_0x4fb9d4[_0xb585('0x3b')]=qs['sort'](_0x2cd22e[_0xb585('0x33')][_0xb585('0x3c')]);_0x4fb9d4[_0xb585('0x3d')]=qs[_0xb585('0x34')](_['pick'](_0x2cd22e[_0xb585('0x33')],_0x248ddc[_0xb585('0x34')]),_0x3c5d09);if(_0x2cd22e[_0xb585('0x33')][_0xb585('0x3e')]){_0x4fb9d4[_0xb585('0x3d')]=_[_0xb585('0x3f')](_0x4fb9d4['where'],{'$or':_[_0xb585('0x2b')](_0x3c5d09,function(_0x269704){if(_0x269704['type']!==_0xb585('0x40')){var _0x734990={};_0x734990[_0x269704[_0xb585('0x29')]]={'$like':'%'+_0x2cd22e[_0xb585('0x33')]['filter']+'%'};return _0x734990;}})});}_0x4fb9d4=_['merge']({},_0x4fb9d4,_0x2cd22e['options']);var _0x1c4fde={'where':_0x4fb9d4[_0xb585('0x3d')]};return db[_0xb585('0x2c')]['count'](_0x1c4fde)['then'](function(_0x23e2d5){_0x534b27[_0xb585('0x1b')]=_0x23e2d5;if(_0x2cd22e['query'][_0xb585('0x41')]){_0x4fb9d4['include']=[{'all':!![]}];}return db[_0xb585('0x2c')]['findAll'](_0x4fb9d4);})[_0xb585('0x24')](function(_0x18c7d2){_0x534b27[_0xb585('0x42')]=_0x18c7d2;return _0x534b27;})[_0xb585('0x24')](respondWithFilteredResult(_0x5b70e5,_0x4fb9d4))[_0xb585('0x43')](handleError(_0x5b70e5,null));};exports[_0xb585('0x44')]=function(_0x2fdf9a,_0x4e7a2b){var _0x23dcaf={'raw':![],'where':{'id':_0x2fdf9a[_0xb585('0x45')]['id']}},_0x5e10cf={};_0x5e10cf[_0xb585('0x31')]=_[_0xb585('0x32')](db[_0xb585('0x2c')][_0xb585('0x2d')]);_0x5e10cf[_0xb585('0x33')]=_['keys'](_0x2fdf9a[_0xb585('0x33')]);_0x5e10cf[_0xb585('0x34')]=_['intersection'](_0x5e10cf['model'],_0x5e10cf[_0xb585('0x33')]);_0x23dcaf[_0xb585('0x36')]=_[_0xb585('0x35')](_0x5e10cf[_0xb585('0x31')],qs[_0xb585('0x37')](_0x2fdf9a[_0xb585('0x33')][_0xb585('0x37')]));_0x23dcaf[_0xb585('0x36')]=_0x23dcaf[_0xb585('0x36')][_0xb585('0x38')]?_0x23dcaf['attributes']:_0x5e10cf['model'];if(_0x2fdf9a[_0xb585('0x33')][_0xb585('0x41')]){_0x23dcaf[_0xb585('0x46')]=[{'all':!![]}];}_0x23dcaf=_['merge']({},_0x23dcaf,_0x2fdf9a[_0xb585('0x47')]);return db[_0xb585('0x2c')][_0xb585('0x48')](_0x23dcaf)[_0xb585('0x24')](handleEntityNotFound(_0x4e7a2b,null))[_0xb585('0x24')](respondWithResult(_0x4e7a2b,null))[_0xb585('0x43')](handleError(_0x4e7a2b,null));};exports['create']=function(_0x40b7ac,_0x3e2372){return db[_0xb585('0x2c')][_0xb585('0x49')](_0x40b7ac[_0xb585('0x4a')],{})[_0xb585('0x24')](respondWithResult(_0x3e2372,0xc9))[_0xb585('0x43')](handleError(_0x3e2372,null));};exports[_0xb585('0x23')]=function(_0x21ef4b,_0xfbc4ab){if(_0x21ef4b['body']['id']){delete _0x21ef4b[_0xb585('0x4a')]['id'];}return db[_0xb585('0x2c')][_0xb585('0x48')]({'where':{'id':_0x21ef4b[_0xb585('0x45')]['id']}})[_0xb585('0x24')](handleEntityNotFound(_0xfbc4ab,null))[_0xb585('0x24')](saveUpdates(_0x21ef4b['body'],null))[_0xb585('0x24')](respondWithResult(_0xfbc4ab,null))[_0xb585('0x43')](handleError(_0xfbc4ab,null));};exports[_0xb585('0x25')]=function(_0x319eea,_0x5a31e0){return db[_0xb585('0x2c')][_0xb585('0x48')]({'where':{'id':_0x319eea[_0xb585('0x45')]['id']}})[_0xb585('0x24')](handleEntityNotFound(_0x5a31e0,null))[_0xb585('0x24')](removeEntity(_0x5a31e0,null))[_0xb585('0x43')](handleError(_0x5a31e0,null));};exports[_0xb585('0x4b')]=function(_0x58da48,_0x228e30,_0x595668){var _0x4ea34e={};var _0x39ac19={};var _0x51fc77;var _0x226887;return db[_0xb585('0x2c')][_0xb585('0x4c')]({'where':{'id':_0x58da48[_0xb585('0x45')]['id']}})[_0xb585('0x24')](handleEntityNotFound(_0x228e30,null))[_0xb585('0x24')](function(_0x59734b){if(_0x59734b){_0x51fc77=_0x59734b;_0x39ac19[_0xb585('0x31')]=_[_0xb585('0x32')](db[_0xb585('0x4d')]['rawAttributes']);_0x39ac19[_0xb585('0x33')]=_[_0xb585('0x32')](_0x58da48[_0xb585('0x33')]);_0x39ac19[_0xb585('0x34')]=_[_0xb585('0x35')](_0x39ac19['model'],_0x39ac19[_0xb585('0x33')]);_0x4ea34e[_0xb585('0x36')]=_['intersection'](_0x39ac19['model'],qs[_0xb585('0x37')](_0x58da48[_0xb585('0x33')][_0xb585('0x37')]));_0x4ea34e['attributes']=_0x4ea34e[_0xb585('0x36')]['length']?_0x4ea34e[_0xb585('0x36')]:_0x39ac19[_0xb585('0x31')];_0x4ea34e[_0xb585('0x3b')]=qs['sort'](_0x58da48[_0xb585('0x33')][_0xb585('0x3c')]);_0x4ea34e[_0xb585('0x3d')]=qs[_0xb585('0x34')](_[_0xb585('0x4e')](_0x58da48['query'],_0x39ac19[_0xb585('0x34')]));if(_0x58da48[_0xb585('0x33')][_0xb585('0x3e')]){_0x4ea34e[_0xb585('0x3d')]=_[_0xb585('0x3f')](_0x4ea34e[_0xb585('0x3d')],{'$or':_[_0xb585('0x2b')](_0x4ea34e['attributes'],function(_0x5ba528){var _0x405549={};_0x405549[_0x5ba528]={'$like':'%'+_0x58da48[_0xb585('0x33')]['filter']+'%'};return _0x405549;})});}_0x4ea34e=_['merge']({},_0x4ea34e,_0x58da48[_0xb585('0x47')]);return _0x51fc77[_0xb585('0x4b')](_0x4ea34e);}})[_0xb585('0x24')](function(_0x154f7b){if(_0x154f7b){_0x226887=_0x154f7b[_0xb585('0x38')];if(!_0x58da48[_0xb585('0x33')][_0xb585('0x39')](_0xb585('0x3a'))){_0x4ea34e['limit']=qs[_0xb585('0x1d')](_0x58da48['query'][_0xb585('0x1d')]);_0x4ea34e['offset']=qs['offset'](_0x58da48[_0xb585('0x33')][_0xb585('0x1c')]);}return _0x51fc77[_0xb585('0x4b')](_0x4ea34e);}})[_0xb585('0x24')](function(_0x119ae5){if(_0x119ae5){return _0x119ae5?{'count':_0x226887,'rows':_0x119ae5}:null;}})[_0xb585('0x24')](respondWithResult(_0x228e30,null))[_0xb585('0x43')](handleError(_0x228e30,null));};exports['getSubjects']=function(_0x2f1f52,_0x4ce674,_0x547891){var _0x558d91={};var _0xa1a4a2={};var _0x5d0ba5;var _0x963cfd;return db['ZendeskConfiguration'][_0xb585('0x4c')]({'where':{'id':_0x2f1f52['params']['id']}})[_0xb585('0x24')](handleEntityNotFound(_0x4ce674,null))['then'](function(_0x1f3b85){if(_0x1f3b85){_0x5d0ba5=_0x1f3b85;_0xa1a4a2[_0xb585('0x31')]=_['keys'](db[_0xb585('0x4d')][_0xb585('0x2d')]);_0xa1a4a2[_0xb585('0x33')]=_['keys'](_0x2f1f52['query']);_0xa1a4a2[_0xb585('0x34')]=_['intersection'](_0xa1a4a2[_0xb585('0x31')],_0xa1a4a2[_0xb585('0x33')]);_0x558d91['attributes']=_[_0xb585('0x35')](_0xa1a4a2[_0xb585('0x31')],qs['fields'](_0x2f1f52[_0xb585('0x33')][_0xb585('0x37')]));_0x558d91[_0xb585('0x36')]=_0x558d91[_0xb585('0x36')][_0xb585('0x38')]?_0x558d91[_0xb585('0x36')]:_0xa1a4a2['model'];_0x558d91[_0xb585('0x3b')]=qs[_0xb585('0x3c')](_0x2f1f52[_0xb585('0x33')][_0xb585('0x3c')]);_0x558d91['where']=qs[_0xb585('0x34')](_[_0xb585('0x4e')](_0x2f1f52['query'],_0xa1a4a2[_0xb585('0x34')]));if(_0x2f1f52[_0xb585('0x33')][_0xb585('0x3e')]){_0x558d91[_0xb585('0x3d')]=_[_0xb585('0x3f')](_0x558d91[_0xb585('0x3d')],{'$or':_[_0xb585('0x2b')](_0x558d91[_0xb585('0x36')],function(_0x4ba6d1){var _0xd6483={};_0xd6483[_0x4ba6d1]={'$like':'%'+_0x2f1f52[_0xb585('0x33')][_0xb585('0x3e')]+'%'};return _0xd6483;})});}_0x558d91=_[_0xb585('0x3f')]({},_0x558d91,_0x2f1f52[_0xb585('0x47')]);return _0x5d0ba5['getSubjects'](_0x558d91);}})[_0xb585('0x24')](function(_0x282d8c){if(_0x282d8c){_0x963cfd=_0x282d8c[_0xb585('0x38')];if(!_0x2f1f52['query'][_0xb585('0x39')](_0xb585('0x3a'))){_0x558d91[_0xb585('0x1d')]=qs[_0xb585('0x1d')](_0x2f1f52['query'][_0xb585('0x1d')]);_0x558d91[_0xb585('0x1c')]=qs[_0xb585('0x1c')](_0x2f1f52['query'][_0xb585('0x1c')]);}return _0x5d0ba5[_0xb585('0x4f')](_0x558d91);}})[_0xb585('0x24')](function(_0x350438){if(_0x350438){return _0x350438?{'count':_0x963cfd,'rows':_0x350438}:null;}})[_0xb585('0x24')](respondWithResult(_0x4ce674,null))[_0xb585('0x43')](handleError(_0x4ce674,null));};exports[_0xb585('0x50')]=function(_0x450e9c,_0x532b3f,_0x34bd4c){var _0x18dae7={};var _0x5ce690={};var _0x49e2cc;var _0x5c31f6;return db[_0xb585('0x2c')][_0xb585('0x4c')]({'where':{'id':_0x450e9c[_0xb585('0x45')]['id']}})[_0xb585('0x24')](handleEntityNotFound(_0x532b3f,null))['then'](function(_0x159e0b){if(_0x159e0b){_0x49e2cc=_0x159e0b;_0x5ce690['model']=_[_0xb585('0x32')](db[_0xb585('0x4d')][_0xb585('0x2d')]);_0x5ce690[_0xb585('0x33')]=_['keys'](_0x450e9c[_0xb585('0x33')]);_0x5ce690[_0xb585('0x34')]=_[_0xb585('0x35')](_0x5ce690['model'],_0x5ce690[_0xb585('0x33')]);_0x18dae7[_0xb585('0x36')]=_['intersection'](_0x5ce690[_0xb585('0x31')],qs[_0xb585('0x37')](_0x450e9c['query'][_0xb585('0x37')]));_0x18dae7[_0xb585('0x36')]=_0x18dae7[_0xb585('0x36')]['length']?_0x18dae7[_0xb585('0x36')]:_0x5ce690[_0xb585('0x31')];_0x18dae7[_0xb585('0x3b')]=qs['sort'](_0x450e9c[_0xb585('0x33')]['sort']);_0x18dae7[_0xb585('0x3d')]=qs[_0xb585('0x34')](_['pick'](_0x450e9c[_0xb585('0x33')],_0x5ce690['filters']));if(_0x450e9c['query']['filter']){_0x18dae7['where']=_[_0xb585('0x3f')](_0x18dae7[_0xb585('0x3d')],{'$or':_['map'](_0x18dae7[_0xb585('0x36')],function(_0x5637b9){var _0x56a2e6={};_0x56a2e6[_0x5637b9]={'$like':'%'+_0x450e9c[_0xb585('0x33')][_0xb585('0x3e')]+'%'};return _0x56a2e6;})});}_0x18dae7=_['merge']({},_0x18dae7,_0x450e9c[_0xb585('0x47')]);return _0x49e2cc['getDescriptions'](_0x18dae7);}})[_0xb585('0x24')](function(_0x584f2b){if(_0x584f2b){_0x5c31f6=_0x584f2b['length'];if(!_0x450e9c[_0xb585('0x33')]['hasOwnProperty'](_0xb585('0x3a'))){_0x18dae7['limit']=qs[_0xb585('0x1d')](_0x450e9c['query'][_0xb585('0x1d')]);_0x18dae7['offset']=qs[_0xb585('0x1c')](_0x450e9c[_0xb585('0x33')][_0xb585('0x1c')]);}return _0x49e2cc[_0xb585('0x50')](_0x18dae7);}})[_0xb585('0x24')](function(_0x2e1be0){if(_0x2e1be0){return _0x2e1be0?{'count':_0x5c31f6,'rows':_0x2e1be0}:null;}})[_0xb585('0x24')](respondWithResult(_0x532b3f,null))[_0xb585('0x43')](handleError(_0x532b3f,null));};exports['getTags']=function(_0x377163,_0x3e7d24,_0x22dd18){var _0x555123={};var _0x52d1e0={};var _0x59c6b1;var _0x2c887e;return db[_0xb585('0x2c')]['findOne']({'where':{'id':_0x377163[_0xb585('0x45')]['id']}})[_0xb585('0x24')](handleEntityNotFound(_0x3e7d24,null))['then'](function(_0x25fcb0){if(_0x25fcb0){_0x59c6b1=_0x25fcb0;_0x52d1e0[_0xb585('0x31')]=_[_0xb585('0x32')](db[_0xb585('0x51')][_0xb585('0x2d')]);_0x52d1e0[_0xb585('0x33')]=_['keys'](_0x377163[_0xb585('0x33')]);_0x52d1e0[_0xb585('0x34')]=_[_0xb585('0x35')](_0x52d1e0[_0xb585('0x31')],_0x52d1e0['query']);_0x555123['attributes']=_[_0xb585('0x35')](_0x52d1e0[_0xb585('0x31')],qs[_0xb585('0x37')](_0x377163['query'][_0xb585('0x37')]));_0x555123[_0xb585('0x36')]=_0x555123[_0xb585('0x36')][_0xb585('0x38')]?_0x555123[_0xb585('0x36')]:_0x52d1e0[_0xb585('0x31')];_0x555123[_0xb585('0x3b')]=qs['sort'](_0x377163[_0xb585('0x33')][_0xb585('0x3c')]);_0x555123[_0xb585('0x3d')]=qs['filters'](_[_0xb585('0x4e')](_0x377163[_0xb585('0x33')],_0x52d1e0['filters']));if(_0x377163[_0xb585('0x33')][_0xb585('0x3e')]){_0x555123[_0xb585('0x3d')]=_[_0xb585('0x3f')](_0x555123['where'],{'$or':_[_0xb585('0x2b')](_0x555123[_0xb585('0x36')],function(_0x10bd93){var _0x49da6d={};_0x49da6d[_0x10bd93]={'$like':'%'+_0x377163[_0xb585('0x33')][_0xb585('0x3e')]+'%'};return _0x49da6d;})});}_0x555123=_[_0xb585('0x3f')]({},_0x555123,_0x377163[_0xb585('0x47')]);return _0x59c6b1[_0xb585('0x52')](_0x555123);}})['then'](function(_0x1be50d){if(_0x1be50d){_0x2c887e=_0x1be50d[_0xb585('0x38')];if(!_0x377163['query']['hasOwnProperty'](_0xb585('0x3a'))){_0x555123[_0xb585('0x1d')]=qs[_0xb585('0x1d')](_0x377163['query'][_0xb585('0x1d')]);_0x555123[_0xb585('0x1c')]=qs[_0xb585('0x1c')](_0x377163[_0xb585('0x33')]['offset']);}return _0x59c6b1[_0xb585('0x52')](_0x555123);}})[_0xb585('0x24')](function(_0x5387ba){if(_0x5387ba){return _0x5387ba?{'count':_0x2c887e,'rows':_0x5387ba}:null;}})['then'](respondWithResult(_0x3e7d24,null))[_0xb585('0x43')](handleError(_0x3e7d24,null));};exports[_0xb585('0x53')]=function(_0x3c34ef,_0x571196,_0x18b436){if(_0x3c34ef['body']['id']){delete _0x3c34ef[_0xb585('0x4a')]['id'];}return db[_0xb585('0x2c')][_0xb585('0x4c')]({'where':{'id':_0x3c34ef[_0xb585('0x45')]['id']}})[_0xb585('0x24')](handleEntityNotFound(_0x571196,null))['then'](function(_0xefb2bd){if(_0xefb2bd){return _0xefb2bd[_0xb585('0x53')](_0x3c34ef[_0xb585('0x4a')][_0xb585('0x54')]||[]);}return null;})['then'](respondWithResult(_0x571196,null))['catch'](handleError(_0x571196,null));}; \ No newline at end of file +var _0xabf1=['fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','set','reject','save','update','then','destroy','error','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','pick','filter','where','merge','count','includeAll','include','findAll','rows','params','keys','options','find','catch','create','body','findOne','ZendeskField','sort','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x363a8f,_0x47435c){var _0x2d81f0=function(_0x5234f7){while(--_0x5234f7){_0x363a8f['push'](_0x363a8f['shift']());}};_0x2d81f0(++_0x47435c);}(_0xabf1,0x1f3));var _0x1abf=function(_0x3e0b90,_0x525086){_0x3e0b90=_0x3e0b90-0x0;var _0x3538f4=_0xabf1[_0x3e0b90];return _0x3538f4;};'use strict';var emlformat=require(_0x1abf('0x0'));var rimraf=require(_0x1abf('0x1'));var zipdir=require(_0x1abf('0x2'));var jsonpatch=require(_0x1abf('0x3'));var rp=require(_0x1abf('0x4'));var moment=require(_0x1abf('0x5'));var BPromise=require(_0x1abf('0x6'));var Mustache=require(_0x1abf('0x7'));var util=require(_0x1abf('0x8'));var path=require('path');var sox=require(_0x1abf('0x9'));var csv=require(_0x1abf('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1abf('0xb'));var _=require(_0x1abf('0xc'));var squel=require(_0x1abf('0xd'));var crypto=require('crypto');var jsforce=require(_0x1abf('0xe'));var deskjs=require(_0x1abf('0xf'));var toCsv=require(_0x1abf('0xa'));var querystring=require(_0x1abf('0x10'));var Papa=require(_0x1abf('0x11'));var Redis=require('ioredis');var authService=require(_0x1abf('0x12'));var qs=require(_0x1abf('0x13'));var as=require(_0x1abf('0x14'));var hardwareService=require(_0x1abf('0x15'));var logger=require(_0x1abf('0x16'))(_0x1abf('0x17'));var utils=require(_0x1abf('0x18'));var config=require(_0x1abf('0x19'));var licenseUtil=require(_0x1abf('0x1a'));var db=require(_0x1abf('0x1b'))['db'];function respondWithStatusCode(_0x7fa5fe,_0x767bb){_0x767bb=_0x767bb||0xcc;return function(_0x48ee64){if(_0x48ee64){return _0x7fa5fe['sendStatus'](_0x767bb);}return _0x7fa5fe[_0x1abf('0x1c')](_0x767bb)[_0x1abf('0x1d')]();};}function respondWithResult(_0x38c004,_0x1c4a24){_0x1c4a24=_0x1c4a24||0xc8;return function(_0x4a4128){if(_0x4a4128){return _0x38c004[_0x1abf('0x1c')](_0x1c4a24)[_0x1abf('0x1e')](_0x4a4128);}};}function respondWithFilteredResult(_0xb3ace4,_0x2fca73){return function(_0x14d3f9){if(_0x14d3f9){var _0x584c6c=typeof _0x2fca73[_0x1abf('0x1f')]==='undefined'&&typeof _0x2fca73['limit']===_0x1abf('0x20');var _0x975b20=_0x14d3f9['count'];var _0x2405bc=_0x584c6c?0x0:_0x2fca73['offset'];var _0x42a6c5=_0x584c6c?_0x14d3f9['count']:_0x2fca73['offset']+_0x2fca73['limit'];var _0x4e9096;if(_0x42a6c5>=_0x975b20){_0x42a6c5=_0x975b20;_0x4e9096=0xc8;}else{_0x4e9096=0xce;}_0xb3ace4[_0x1abf('0x1c')](_0x4e9096);return _0xb3ace4[_0x1abf('0x21')]('Content-Range',_0x2405bc+'-'+_0x42a6c5+'/'+_0x975b20)[_0x1abf('0x1e')](_0x14d3f9);}return null;};}function patchUpdates(_0x8f24f7){return function(_0x602b22){try{jsonpatch['apply'](_0x602b22,_0x8f24f7,!![]);}catch(_0x971250){return BPromise[_0x1abf('0x22')](_0x971250);}return _0x602b22[_0x1abf('0x23')]();};}function saveUpdates(_0x769652,_0x166f0d){return function(_0x15dc94){if(_0x15dc94){return _0x15dc94[_0x1abf('0x24')](_0x769652)[_0x1abf('0x25')](function(_0x5d36c9){return _0x5d36c9;});}return null;};}function removeEntity(_0x3a064c,_0x2c71a3){return function(_0x353f35){if(_0x353f35){return _0x353f35[_0x1abf('0x26')]()['then'](function(){_0x3a064c[_0x1abf('0x1c')](0xcc)[_0x1abf('0x1d')]();});}};}function handleEntityNotFound(_0x261948,_0x335b83){return function(_0x32560d){if(!_0x32560d){_0x261948['sendStatus'](0x194);}return _0x32560d;};}function handleError(_0x3ac93e,_0xcc461c){_0xcc461c=_0xcc461c||0x1f4;return function(_0x33b40c){logger[_0x1abf('0x27')](_0x33b40c[_0x1abf('0x28')]);if(_0x33b40c[_0x1abf('0x29')]){delete _0x33b40c['name'];}_0x3ac93e[_0x1abf('0x1c')](_0xcc461c)[_0x1abf('0x2a')](_0x33b40c);};}exports[_0x1abf('0x2b')]=function(_0x1137ff,_0x48e45c){var _0x121bc7={},_0x429bf6={},_0x3c4982={'count':0x0,'rows':[]};var _0x3da4b4=_['map'](db[_0x1abf('0x2c')][_0x1abf('0x2d')],function(_0x5afec6){return{'name':_0x5afec6[_0x1abf('0x2e')],'type':_0x5afec6[_0x1abf('0x2f')]['key']};});_0x429bf6[_0x1abf('0x30')]=_[_0x1abf('0x31')](_0x3da4b4,_0x1abf('0x29'));_0x429bf6[_0x1abf('0x32')]=_['keys'](_0x1137ff[_0x1abf('0x32')]);_0x429bf6[_0x1abf('0x33')]=_[_0x1abf('0x34')](_0x429bf6['model'],_0x429bf6[_0x1abf('0x32')]);_0x121bc7['attributes']=_[_0x1abf('0x34')](_0x429bf6[_0x1abf('0x30')],qs[_0x1abf('0x35')](_0x1137ff[_0x1abf('0x32')][_0x1abf('0x35')]));_0x121bc7['attributes']=_0x121bc7[_0x1abf('0x36')][_0x1abf('0x37')]?_0x121bc7[_0x1abf('0x36')]:_0x429bf6['model'];if(!_0x1137ff[_0x1abf('0x32')][_0x1abf('0x38')](_0x1abf('0x39'))){_0x121bc7[_0x1abf('0x3a')]=qs[_0x1abf('0x3a')](_0x1137ff[_0x1abf('0x32')][_0x1abf('0x3a')]);_0x121bc7['offset']=qs['offset'](_0x1137ff['query'][_0x1abf('0x1f')]);}_0x121bc7[_0x1abf('0x3b')]=qs['sort'](_0x1137ff[_0x1abf('0x32')]['sort']);_0x121bc7['where']=qs['filters'](_[_0x1abf('0x3c')](_0x1137ff['query'],_0x429bf6[_0x1abf('0x33')]),_0x3da4b4);if(_0x1137ff[_0x1abf('0x32')][_0x1abf('0x3d')]){_0x121bc7[_0x1abf('0x3e')]=_[_0x1abf('0x3f')](_0x121bc7[_0x1abf('0x3e')],{'$or':_[_0x1abf('0x31')](_0x3da4b4,function(_0x5da496){if(_0x5da496['type']!=='VIRTUAL'){var _0x37139b={};_0x37139b[_0x5da496[_0x1abf('0x29')]]={'$like':'%'+_0x1137ff[_0x1abf('0x32')]['filter']+'%'};return _0x37139b;}})});}_0x121bc7=_[_0x1abf('0x3f')]({},_0x121bc7,_0x1137ff['options']);var _0x25cfce={'where':_0x121bc7[_0x1abf('0x3e')]};return db['ZendeskConfiguration']['count'](_0x25cfce)[_0x1abf('0x25')](function(_0x26c33e){_0x3c4982[_0x1abf('0x40')]=_0x26c33e;if(_0x1137ff[_0x1abf('0x32')][_0x1abf('0x41')]){_0x121bc7[_0x1abf('0x42')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x1abf('0x43')](_0x121bc7);})['then'](function(_0x4ba668){_0x3c4982[_0x1abf('0x44')]=_0x4ba668;return _0x3c4982;})[_0x1abf('0x25')](respondWithFilteredResult(_0x48e45c,_0x121bc7))['catch'](handleError(_0x48e45c,null));};exports['show']=function(_0x2eabd6,_0x208ce3){var _0x1d42a1={'raw':![],'where':{'id':_0x2eabd6[_0x1abf('0x45')]['id']}},_0x6d1486={};_0x6d1486[_0x1abf('0x30')]=_['keys'](db[_0x1abf('0x2c')][_0x1abf('0x2d')]);_0x6d1486[_0x1abf('0x32')]=_[_0x1abf('0x46')](_0x2eabd6[_0x1abf('0x32')]);_0x6d1486[_0x1abf('0x33')]=_[_0x1abf('0x34')](_0x6d1486[_0x1abf('0x30')],_0x6d1486[_0x1abf('0x32')]);_0x1d42a1[_0x1abf('0x36')]=_[_0x1abf('0x34')](_0x6d1486[_0x1abf('0x30')],qs[_0x1abf('0x35')](_0x2eabd6['query'][_0x1abf('0x35')]));_0x1d42a1[_0x1abf('0x36')]=_0x1d42a1[_0x1abf('0x36')]['length']?_0x1d42a1[_0x1abf('0x36')]:_0x6d1486[_0x1abf('0x30')];if(_0x2eabd6[_0x1abf('0x32')][_0x1abf('0x41')]){_0x1d42a1[_0x1abf('0x42')]=[{'all':!![]}];}_0x1d42a1=_[_0x1abf('0x3f')]({},_0x1d42a1,_0x2eabd6[_0x1abf('0x47')]);return db[_0x1abf('0x2c')][_0x1abf('0x48')](_0x1d42a1)[_0x1abf('0x25')](handleEntityNotFound(_0x208ce3,null))[_0x1abf('0x25')](respondWithResult(_0x208ce3,null))[_0x1abf('0x49')](handleError(_0x208ce3,null));};exports[_0x1abf('0x4a')]=function(_0x11046b,_0x127d15){return db[_0x1abf('0x2c')][_0x1abf('0x4a')](_0x11046b[_0x1abf('0x4b')],{})[_0x1abf('0x25')](respondWithResult(_0x127d15,0xc9))[_0x1abf('0x49')](handleError(_0x127d15,null));};exports[_0x1abf('0x24')]=function(_0x4c5e6d,_0x1ac83e){if(_0x4c5e6d[_0x1abf('0x4b')]['id']){delete _0x4c5e6d[_0x1abf('0x4b')]['id'];}return db[_0x1abf('0x2c')][_0x1abf('0x48')]({'where':{'id':_0x4c5e6d['params']['id']}})[_0x1abf('0x25')](handleEntityNotFound(_0x1ac83e,null))[_0x1abf('0x25')](saveUpdates(_0x4c5e6d['body'],null))['then'](respondWithResult(_0x1ac83e,null))['catch'](handleError(_0x1ac83e,null));};exports[_0x1abf('0x26')]=function(_0x587f6f,_0x264fb1){return db['ZendeskConfiguration']['find']({'where':{'id':_0x587f6f[_0x1abf('0x45')]['id']}})[_0x1abf('0x25')](handleEntityNotFound(_0x264fb1,null))[_0x1abf('0x25')](removeEntity(_0x264fb1,null))['catch'](handleError(_0x264fb1,null));};exports['getFields']=function(_0x1241e8,_0x162f2b,_0xf2c791){var _0x5dbc77={};var _0x32a80b={};var _0xc0d4c1;var _0x1c4aa5;return db[_0x1abf('0x2c')][_0x1abf('0x4c')]({'where':{'id':_0x1241e8[_0x1abf('0x45')]['id']}})['then'](handleEntityNotFound(_0x162f2b,null))[_0x1abf('0x25')](function(_0x4cffac){if(_0x4cffac){_0xc0d4c1=_0x4cffac;_0x32a80b[_0x1abf('0x30')]=_['keys'](db[_0x1abf('0x4d')]['rawAttributes']);_0x32a80b[_0x1abf('0x32')]=_[_0x1abf('0x46')](_0x1241e8[_0x1abf('0x32')]);_0x32a80b[_0x1abf('0x33')]=_[_0x1abf('0x34')](_0x32a80b[_0x1abf('0x30')],_0x32a80b[_0x1abf('0x32')]);_0x5dbc77[_0x1abf('0x36')]=_[_0x1abf('0x34')](_0x32a80b[_0x1abf('0x30')],qs[_0x1abf('0x35')](_0x1241e8[_0x1abf('0x32')]['fields']));_0x5dbc77[_0x1abf('0x36')]=_0x5dbc77[_0x1abf('0x36')][_0x1abf('0x37')]?_0x5dbc77[_0x1abf('0x36')]:_0x32a80b['model'];_0x5dbc77[_0x1abf('0x3b')]=qs[_0x1abf('0x4e')](_0x1241e8['query'][_0x1abf('0x4e')]);_0x5dbc77[_0x1abf('0x3e')]=qs[_0x1abf('0x33')](_['pick'](_0x1241e8[_0x1abf('0x32')],_0x32a80b['filters']));if(_0x1241e8[_0x1abf('0x32')][_0x1abf('0x3d')]){_0x5dbc77[_0x1abf('0x3e')]=_['merge'](_0x5dbc77[_0x1abf('0x3e')],{'$or':_[_0x1abf('0x31')](_0x5dbc77[_0x1abf('0x36')],function(_0x4bd962){var _0x338bd9={};_0x338bd9[_0x4bd962]={'$like':'%'+_0x1241e8['query'][_0x1abf('0x3d')]+'%'};return _0x338bd9;})});}_0x5dbc77=_[_0x1abf('0x3f')]({},_0x5dbc77,_0x1241e8[_0x1abf('0x47')]);return _0xc0d4c1['getFields'](_0x5dbc77);}})['then'](function(_0x5b657c){if(_0x5b657c){_0x1c4aa5=_0x5b657c[_0x1abf('0x37')];if(!_0x1241e8[_0x1abf('0x32')][_0x1abf('0x38')]('nolimit')){_0x5dbc77[_0x1abf('0x3a')]=qs[_0x1abf('0x3a')](_0x1241e8[_0x1abf('0x32')]['limit']);_0x5dbc77[_0x1abf('0x1f')]=qs[_0x1abf('0x1f')](_0x1241e8[_0x1abf('0x32')][_0x1abf('0x1f')]);}return _0xc0d4c1['getFields'](_0x5dbc77);}})['then'](function(_0x1dc1c1){if(_0x1dc1c1){return _0x1dc1c1?{'count':_0x1c4aa5,'rows':_0x1dc1c1}:null;}})[_0x1abf('0x25')](respondWithResult(_0x162f2b,null))[_0x1abf('0x49')](handleError(_0x162f2b,null));};exports['getSubjects']=function(_0x49dbff,_0x2cab4c,_0x3328d4){var _0x3b8849={};var _0x4d22ed={};var _0x2fe167;var _0x2661e2;return db['ZendeskConfiguration'][_0x1abf('0x4c')]({'where':{'id':_0x49dbff[_0x1abf('0x45')]['id']}})[_0x1abf('0x25')](handleEntityNotFound(_0x2cab4c,null))[_0x1abf('0x25')](function(_0x457c65){if(_0x457c65){_0x2fe167=_0x457c65;_0x4d22ed[_0x1abf('0x30')]=_['keys'](db[_0x1abf('0x4d')]['rawAttributes']);_0x4d22ed[_0x1abf('0x32')]=_[_0x1abf('0x46')](_0x49dbff['query']);_0x4d22ed[_0x1abf('0x33')]=_[_0x1abf('0x34')](_0x4d22ed[_0x1abf('0x30')],_0x4d22ed[_0x1abf('0x32')]);_0x3b8849['attributes']=_[_0x1abf('0x34')](_0x4d22ed['model'],qs['fields'](_0x49dbff[_0x1abf('0x32')][_0x1abf('0x35')]));_0x3b8849['attributes']=_0x3b8849['attributes'][_0x1abf('0x37')]?_0x3b8849['attributes']:_0x4d22ed[_0x1abf('0x30')];_0x3b8849[_0x1abf('0x3b')]=qs[_0x1abf('0x4e')](_0x49dbff[_0x1abf('0x32')]['sort']);_0x3b8849[_0x1abf('0x3e')]=qs['filters'](_[_0x1abf('0x3c')](_0x49dbff['query'],_0x4d22ed[_0x1abf('0x33')]));if(_0x49dbff[_0x1abf('0x32')][_0x1abf('0x3d')]){_0x3b8849[_0x1abf('0x3e')]=_[_0x1abf('0x3f')](_0x3b8849[_0x1abf('0x3e')],{'$or':_[_0x1abf('0x31')](_0x3b8849[_0x1abf('0x36')],function(_0x5742b2){var _0x2cf109={};_0x2cf109[_0x5742b2]={'$like':'%'+_0x49dbff[_0x1abf('0x32')][_0x1abf('0x3d')]+'%'};return _0x2cf109;})});}_0x3b8849=_[_0x1abf('0x3f')]({},_0x3b8849,_0x49dbff[_0x1abf('0x47')]);return _0x2fe167['getSubjects'](_0x3b8849);}})[_0x1abf('0x25')](function(_0x35e92e){if(_0x35e92e){_0x2661e2=_0x35e92e[_0x1abf('0x37')];if(!_0x49dbff[_0x1abf('0x32')][_0x1abf('0x38')](_0x1abf('0x39'))){_0x3b8849[_0x1abf('0x3a')]=qs[_0x1abf('0x3a')](_0x49dbff['query'][_0x1abf('0x3a')]);_0x3b8849[_0x1abf('0x1f')]=qs[_0x1abf('0x1f')](_0x49dbff[_0x1abf('0x32')][_0x1abf('0x1f')]);}return _0x2fe167[_0x1abf('0x4f')](_0x3b8849);}})[_0x1abf('0x25')](function(_0x488347){if(_0x488347){return _0x488347?{'count':_0x2661e2,'rows':_0x488347}:null;}})['then'](respondWithResult(_0x2cab4c,null))['catch'](handleError(_0x2cab4c,null));};exports[_0x1abf('0x50')]=function(_0x7e685,_0x330442,_0x68e25e){var _0xfa85ec={};var _0x1e69a4={};var _0x3c3f97;var _0x1c509c;return db[_0x1abf('0x2c')][_0x1abf('0x4c')]({'where':{'id':_0x7e685[_0x1abf('0x45')]['id']}})[_0x1abf('0x25')](handleEntityNotFound(_0x330442,null))[_0x1abf('0x25')](function(_0x3f86c4){if(_0x3f86c4){_0x3c3f97=_0x3f86c4;_0x1e69a4[_0x1abf('0x30')]=_['keys'](db[_0x1abf('0x4d')][_0x1abf('0x2d')]);_0x1e69a4[_0x1abf('0x32')]=_[_0x1abf('0x46')](_0x7e685['query']);_0x1e69a4[_0x1abf('0x33')]=_['intersection'](_0x1e69a4[_0x1abf('0x30')],_0x1e69a4[_0x1abf('0x32')]);_0xfa85ec[_0x1abf('0x36')]=_[_0x1abf('0x34')](_0x1e69a4[_0x1abf('0x30')],qs[_0x1abf('0x35')](_0x7e685[_0x1abf('0x32')][_0x1abf('0x35')]));_0xfa85ec['attributes']=_0xfa85ec[_0x1abf('0x36')][_0x1abf('0x37')]?_0xfa85ec[_0x1abf('0x36')]:_0x1e69a4[_0x1abf('0x30')];_0xfa85ec[_0x1abf('0x3b')]=qs[_0x1abf('0x4e')](_0x7e685[_0x1abf('0x32')][_0x1abf('0x4e')]);_0xfa85ec[_0x1abf('0x3e')]=qs[_0x1abf('0x33')](_[_0x1abf('0x3c')](_0x7e685[_0x1abf('0x32')],_0x1e69a4['filters']));if(_0x7e685[_0x1abf('0x32')][_0x1abf('0x3d')]){_0xfa85ec[_0x1abf('0x3e')]=_[_0x1abf('0x3f')](_0xfa85ec[_0x1abf('0x3e')],{'$or':_[_0x1abf('0x31')](_0xfa85ec['attributes'],function(_0x5ca87b){var _0x4f4bc9={};_0x4f4bc9[_0x5ca87b]={'$like':'%'+_0x7e685['query'][_0x1abf('0x3d')]+'%'};return _0x4f4bc9;})});}_0xfa85ec=_[_0x1abf('0x3f')]({},_0xfa85ec,_0x7e685[_0x1abf('0x47')]);return _0x3c3f97[_0x1abf('0x50')](_0xfa85ec);}})['then'](function(_0x4556bb){if(_0x4556bb){_0x1c509c=_0x4556bb[_0x1abf('0x37')];if(!_0x7e685['query'][_0x1abf('0x38')](_0x1abf('0x39'))){_0xfa85ec[_0x1abf('0x3a')]=qs['limit'](_0x7e685[_0x1abf('0x32')][_0x1abf('0x3a')]);_0xfa85ec['offset']=qs[_0x1abf('0x1f')](_0x7e685[_0x1abf('0x32')]['offset']);}return _0x3c3f97[_0x1abf('0x50')](_0xfa85ec);}})[_0x1abf('0x25')](function(_0x65bcf1){if(_0x65bcf1){return _0x65bcf1?{'count':_0x1c509c,'rows':_0x65bcf1}:null;}})['then'](respondWithResult(_0x330442,null))[_0x1abf('0x49')](handleError(_0x330442,null));};exports[_0x1abf('0x51')]=function(_0x46522b,_0xa90dd,_0x2d3a16){var _0x189864={};var _0x47306a={};var _0x4936d0;var _0xed3b8f;return db[_0x1abf('0x2c')][_0x1abf('0x4c')]({'where':{'id':_0x46522b[_0x1abf('0x45')]['id']}})[_0x1abf('0x25')](handleEntityNotFound(_0xa90dd,null))['then'](function(_0x35549c){if(_0x35549c){_0x4936d0=_0x35549c;_0x47306a[_0x1abf('0x30')]=_['keys'](db[_0x1abf('0x52')][_0x1abf('0x2d')]);_0x47306a[_0x1abf('0x32')]=_[_0x1abf('0x46')](_0x46522b[_0x1abf('0x32')]);_0x47306a[_0x1abf('0x33')]=_[_0x1abf('0x34')](_0x47306a['model'],_0x47306a['query']);_0x189864[_0x1abf('0x36')]=_['intersection'](_0x47306a[_0x1abf('0x30')],qs[_0x1abf('0x35')](_0x46522b[_0x1abf('0x32')][_0x1abf('0x35')]));_0x189864[_0x1abf('0x36')]=_0x189864[_0x1abf('0x36')][_0x1abf('0x37')]?_0x189864[_0x1abf('0x36')]:_0x47306a[_0x1abf('0x30')];_0x189864[_0x1abf('0x3b')]=qs[_0x1abf('0x4e')](_0x46522b[_0x1abf('0x32')][_0x1abf('0x4e')]);_0x189864[_0x1abf('0x3e')]=qs[_0x1abf('0x33')](_[_0x1abf('0x3c')](_0x46522b[_0x1abf('0x32')],_0x47306a[_0x1abf('0x33')]));if(_0x46522b['query']['filter']){_0x189864[_0x1abf('0x3e')]=_[_0x1abf('0x3f')](_0x189864[_0x1abf('0x3e')],{'$or':_['map'](_0x189864[_0x1abf('0x36')],function(_0x5a5002){var _0x4e58cd={};_0x4e58cd[_0x5a5002]={'$like':'%'+_0x46522b[_0x1abf('0x32')][_0x1abf('0x3d')]+'%'};return _0x4e58cd;})});}_0x189864=_[_0x1abf('0x3f')]({},_0x189864,_0x46522b[_0x1abf('0x47')]);return _0x4936d0[_0x1abf('0x51')](_0x189864);}})[_0x1abf('0x25')](function(_0x55d3bc){if(_0x55d3bc){_0xed3b8f=_0x55d3bc[_0x1abf('0x37')];if(!_0x46522b[_0x1abf('0x32')][_0x1abf('0x38')](_0x1abf('0x39'))){_0x189864[_0x1abf('0x3a')]=qs[_0x1abf('0x3a')](_0x46522b[_0x1abf('0x32')]['limit']);_0x189864[_0x1abf('0x1f')]=qs[_0x1abf('0x1f')](_0x46522b[_0x1abf('0x32')][_0x1abf('0x1f')]);}return _0x4936d0[_0x1abf('0x51')](_0x189864);}})[_0x1abf('0x25')](function(_0x3b64ae){if(_0x3b64ae){return _0x3b64ae?{'count':_0xed3b8f,'rows':_0x3b64ae}:null;}})[_0x1abf('0x25')](respondWithResult(_0xa90dd,null))[_0x1abf('0x49')](handleError(_0xa90dd,null));};exports[_0x1abf('0x53')]=function(_0x50da0a,_0x31b309,_0x28d547){if(_0x50da0a['body']['id']){delete _0x50da0a[_0x1abf('0x4b')]['id'];}return db[_0x1abf('0x2c')][_0x1abf('0x4c')]({'where':{'id':_0x50da0a[_0x1abf('0x45')]['id']}})[_0x1abf('0x25')](handleEntityNotFound(_0x31b309,null))[_0x1abf('0x25')](function(_0x212284){if(_0x212284){return _0x212284['setTags'](_0x50da0a['body'][_0x1abf('0x54')]||[]);}return null;})[_0x1abf('0x25')](respondWithResult(_0x31b309,null))[_0x1abf('0x49')](handleError(_0x31b309,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 0d9e41c..af75e71 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 _0x5c00=['moment','request-promise','path','rimraf','../../config/environment','exports','define','int_zendesk_configurations','lodash','util','../../config/logger'];(function(_0x34a24c,_0x2a9e62){var _0x3b09f8=function(_0x3291f5){while(--_0x3291f5){_0x34a24c['push'](_0x34a24c['shift']());}};_0x3b09f8(++_0x2a9e62);}(_0x5c00,0x17e));var _0x05c0=function(_0x33670a,_0x55e188){_0x33670a=_0x33670a-0x0;var _0x36ad1d=_0x5c00[_0x33670a];return _0x36ad1d;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var logger=require(_0x05c0('0x2'))('api');var moment=require(_0x05c0('0x3'));var BPromise=require('bluebird');var rp=require(_0x05c0('0x4'));var fs=require('fs');var path=require(_0x05c0('0x5'));var rimraf=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x05c0('0x8')]=function(_0x3521fe,_0x261624){return _0x3521fe[_0x05c0('0x9')]('ZendeskConfiguration',attributes,{'tableName':_0x05c0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9be=['path','rimraf','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5db2c7,_0x4c79c7){var _0x459dd9=function(_0x31f9d3){while(--_0x31f9d3){_0x5db2c7['push'](_0x5db2c7['shift']());}};_0x459dd9(++_0x4c79c7);}(_0xb9be,0xc5));var _0xeb9b=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0xb9be[_0x562f3b];return _0x1edd55;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var logger=require(_0xeb9b('0x2'))(_0xeb9b('0x3'));var moment=require(_0xeb9b('0x4'));var BPromise=require(_0xeb9b('0x5'));var rp=require(_0xeb9b('0x6'));var fs=require('fs');var path=require(_0xeb9b('0x7'));var rimraf=require(_0xeb9b('0x8'));var config=require('../../config/environment');var attributes=require('./intZendeskConfiguration.attributes');module[_0xeb9b('0x9')]=function(_0x181810,_0x2529cb){return _0x181810['define'](_0xeb9b('0xa'),attributes,{'tableName':_0xeb9b('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 307987f..d2c1ff1 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 _0xb282=['../../config/logger','rpc','../../config/environment','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x198317,_0x581aa0){var _0x2956e1=function(_0x56379e){while(--_0x56379e){_0x198317['push'](_0x198317['shift']());}};_0x2956e1(++_0x581aa0);}(_0xb282,0x18a));var _0x2b28=function(_0x3b81eb,_0x175f32){_0x3b81eb=_0x3b81eb-0x0;var _0x149491=_0xb282[_0x3b81eb];return _0x149491;};'use strict';var _=require(_0x2b28('0x0'));var util=require(_0x2b28('0x1'));var moment=require('moment');var BPromise=require(_0x2b28('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b28('0x3'));var db=require(_0x2b28('0x4'))['db'];var utils=require(_0x2b28('0x5'));var logger=require(_0x2b28('0x6'))(_0x2b28('0x7'));var config=require(_0x2b28('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2b28('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48df9d,_0x898f12,_0x470d01){return new BPromise(function(_0x2646d2,_0x3ef638){return client[_0x2b28('0xa')](_0x48df9d,_0x470d01)['then'](function(_0x4e85f3){logger[_0x2b28('0xb')](_0x2b28('0xc'),_0x898f12,_0x2b28('0xd'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x898f12,_0x2b28('0xd'),JSON[_0x2b28('0xe')](_0x4e85f3));if(_0x4e85f3[_0x2b28('0xf')]){if(_0x4e85f3[_0x2b28('0xf')][_0x2b28('0x10')]===0x1f4){logger['error'](_0x2b28('0xc'),_0x898f12,_0x4e85f3[_0x2b28('0xf')]['message']);return _0x3ef638(_0x4e85f3[_0x2b28('0xf')][_0x2b28('0x11')]);}logger[_0x2b28('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x898f12,_0x4e85f3[_0x2b28('0xf')][_0x2b28('0x11')]);return _0x2646d2(_0x4e85f3[_0x2b28('0xf')][_0x2b28('0x11')]);}else{logger[_0x2b28('0xb')](_0x2b28('0xc'),_0x898f12,'request\x20sent');_0x2646d2(_0x4e85f3[_0x2b28('0x12')][_0x2b28('0x11')]);}})[_0x2b28('0x13')](function(_0x2d74ad){logger[_0x2b28('0xf')](_0x2b28('0xc'),_0x898f12,_0x2d74ad);_0x3ef638(_0x2d74ad);});});} \ No newline at end of file +var _0x42d5=['message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x757222,_0x4f4259){var _0x28f476=function(_0x2d5761){while(--_0x2d5761){_0x757222['push'](_0x757222['shift']());}};_0x28f476(++_0x4f4259);}(_0x42d5,0x6c));var _0x542d=function(_0x18dcd4,_0x36e03e){_0x18dcd4=_0x18dcd4-0x0;var _0x1f7e7a=_0x42d5[_0x18dcd4];return _0x1f7e7a;};'use strict';var _=require('lodash');var util=require(_0x542d('0x0'));var moment=require(_0x542d('0x1'));var BPromise=require('bluebird');var rs=require(_0x542d('0x2'));var fs=require('fs');var Redis=require(_0x542d('0x3'));var db=require(_0x542d('0x4'))['db'];var utils=require(_0x542d('0x5'));var logger=require(_0x542d('0x6'))('rpc');var config=require(_0x542d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x542d('0x8')][_0x542d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3657d9,_0x1d969f,_0x2ae076){return new BPromise(function(_0x4e9454,_0x277bda){return client[_0x542d('0xa')](_0x3657d9,_0x2ae076)[_0x542d('0xb')](function(_0xb4d139){logger[_0x542d('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1d969f,'request\x20sent');logger['debug'](_0x542d('0xd'),_0x1d969f,_0x542d('0xe'),JSON[_0x542d('0xf')](_0xb4d139));if(_0xb4d139[_0x542d('0x10')]){if(_0xb4d139[_0x542d('0x10')]['code']===0x1f4){logger[_0x542d('0x10')](_0x542d('0x11'),_0x1d969f,_0xb4d139[_0x542d('0x10')][_0x542d('0x12')]);return _0x277bda(_0xb4d139['error'][_0x542d('0x12')]);}logger[_0x542d('0x10')](_0x542d('0x11'),_0x1d969f,_0xb4d139[_0x542d('0x10')][_0x542d('0x12')]);return _0x4e9454(_0xb4d139[_0x542d('0x10')][_0x542d('0x12')]);}else{logger[_0x542d('0xc')](_0x542d('0x11'),_0x1d969f,_0x542d('0xe'));_0x4e9454(_0xb4d139[_0x542d('0x13')]['message']);}})[_0x542d('0x14')](function(_0x44a141){logger[_0x542d('0x10')](_0x542d('0x11'),_0x1d969f,_0x44a141);_0x277bda(_0x44a141);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 040da47..e9895cc 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 _0x75b2=['../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1dde8d,_0x3b6986){var _0x3e712e=function(_0x4da6f1){while(--_0x4da6f1){_0x1dde8d['push'](_0x1dde8d['shift']());}};_0x3e712e(++_0x3b6986);}(_0x75b2,0x1c4));var _0x275b=function(_0x54f287,_0x38f40d){_0x54f287=_0x54f287-0x0;var _0x420491=_0x75b2[_0x54f287];return _0x420491;};'use strict';var multer=require(_0x275b('0x0'));var util=require(_0x275b('0x1'));var path=require('path');var timeout=require(_0x275b('0x2'));var express=require(_0x275b('0x3'));var router=express[_0x275b('0x4')]();var fs_extra=require(_0x275b('0x5'));var auth=require(_0x275b('0x6'));var interaction=require(_0x275b('0x7'));var config=require(_0x275b('0x8'));var controller=require(_0x275b('0x9'));router[_0x275b('0xa')]('/',auth[_0x275b('0xb')](),controller[_0x275b('0xc')]);router['get'](_0x275b('0xd'),auth[_0x275b('0xb')](),controller[_0x275b('0xe')]);router['post']('/',auth[_0x275b('0xb')](),controller[_0x275b('0xf')]);router[_0x275b('0x10')](_0x275b('0xd'),auth['isAuthenticated'](),controller[_0x275b('0x11')]);router[_0x275b('0x12')](_0x275b('0xd'),auth[_0x275b('0xb')](),controller[_0x275b('0x13')]);module['exports']=router; \ No newline at end of file +var _0x79e3=['/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x79e3,0x16d));var _0x379e=function(_0x255536,_0x3815c3){_0x255536=_0x255536-0x0;var _0xd83e5a=_0x79e3[_0x255536];return _0xd83e5a;};'use strict';var multer=require(_0x379e('0x0'));var util=require(_0x379e('0x1'));var path=require(_0x379e('0x2'));var timeout=require(_0x379e('0x3'));var express=require(_0x379e('0x4'));var router=express[_0x379e('0x5')]();var fs_extra=require(_0x379e('0x6'));var auth=require(_0x379e('0x7'));var interaction=require(_0x379e('0x8'));var config=require(_0x379e('0x9'));var controller=require(_0x379e('0xa'));router[_0x379e('0xb')]('/',auth[_0x379e('0xc')](),controller['index']);router[_0x379e('0xb')](_0x379e('0xd'),auth[_0x379e('0xc')](),controller[_0x379e('0xe')]);router[_0x379e('0xf')]('/',auth[_0x379e('0xc')](),controller[_0x379e('0x10')]);router[_0x379e('0x11')](_0x379e('0xd'),auth['isAuthenticated'](),controller[_0x379e('0x12')]);router[_0x379e('0x13')]('/:id',auth[_0x379e('0xc')](),controller[_0x379e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index d038bb7..aa51e57 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 _0x1dac=['BOOLEAN','exports','ENUM','string','variable','keyValue','STRING','customVariable'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1dac,0x111));var _0xc1da=function(_0x3e7bb8,_0x11f26c){_0x3e7bb8=_0x3e7bb8-0x0;var _0x160bf4=_0x1dac[_0x3e7bb8];return _0x160bf4;};'use strict';var Sequelize=require('sequelize');module[_0xc1da('0x0')]={'type':{'type':Sequelize[_0xc1da('0x1')](_0xc1da('0x2'),_0xc1da('0x3'),'customVariable',_0xc1da('0x4'),'picklist'),'defaultValue':_0xc1da('0x2')},'content':{'type':Sequelize[_0xc1da('0x5')]},'key':{'type':Sequelize[_0xc1da('0x5')]},'keyType':{'type':Sequelize[_0xc1da('0x1')](_0xc1da('0x2'),_0xc1da('0x3'),_0xc1da('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc1da('0x5')]},'customField':{'type':Sequelize[_0xc1da('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc1da('0x5')]}}; \ No newline at end of file +var _0xa5a0=['sequelize','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x1477ac,_0x1d44c3){var _0x19bbf8=function(_0x3edfd6){while(--_0x3edfd6){_0x1477ac['push'](_0x1477ac['shift']());}};_0x19bbf8(++_0x1d44c3);}(_0xa5a0,0x118));var _0x0a5a=function(_0x489c33,_0x314ad3){_0x489c33=_0x489c33-0x0;var _0x394565=_0xa5a0[_0x489c33];return _0x394565;};'use strict';var Sequelize=require(_0x0a5a('0x0'));module['exports']={'type':{'type':Sequelize[_0x0a5a('0x1')](_0x0a5a('0x2'),_0x0a5a('0x3'),_0x0a5a('0x4'),'keyValue',_0x0a5a('0x5')),'defaultValue':_0x0a5a('0x2')},'content':{'type':Sequelize[_0x0a5a('0x6')]},'key':{'type':Sequelize[_0x0a5a('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x0a5a('0x2'),_0x0a5a('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x0a5a('0x6')]},'idField':{'type':Sequelize[_0x0a5a('0x6')]},'nameField':{'type':Sequelize[_0x0a5a('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0a5a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 2a03f74..cb66364 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 _0xdafd=['update','then','destroy','end','sendStatus','error','stack','name','send','index','map','ZendeskField','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','limit','count','apply','reject','save'];(function(_0x5251de,_0x37bbe1){var _0x590d6a=function(_0x567886){while(--_0x567886){_0x5251de['push'](_0x5251de['shift']());}};_0x590d6a(++_0x37bbe1);}(_0xdafd,0x146));var _0xddaf=function(_0x1bb759,_0x233f25){_0x1bb759=_0x1bb759-0x0;var _0x2fe32f=_0xdafd[_0x1bb759];return _0x2fe32f;};'use strict';var emlformat=require(_0xddaf('0x0'));var rimraf=require(_0xddaf('0x1'));var zipdir=require(_0xddaf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xddaf('0x3'));var moment=require(_0xddaf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xddaf('0x5'));var util=require('util');var path=require(_0xddaf('0x6'));var sox=require('sox');var csv=require(_0xddaf('0x7'));var ejs=require(_0xddaf('0x8'));var fs=require('fs');var fs_extra=require(_0xddaf('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xddaf('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xddaf('0xb'));var Papa=require(_0xddaf('0xc'));var Redis=require('ioredis');var authService=require(_0xddaf('0xd'));var qs=require(_0xddaf('0xe'));var as=require(_0xddaf('0xf'));var hardwareService=require(_0xddaf('0x10'));var logger=require(_0xddaf('0x11'))('api');var utils=require(_0xddaf('0x12'));var config=require(_0xddaf('0x13'));var licenseUtil=require(_0xddaf('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59f567,_0x323f5c){_0x323f5c=_0x323f5c||0xcc;return function(_0x4a3096){if(_0x4a3096){return _0x59f567['sendStatus'](_0x323f5c);}return _0x59f567[_0xddaf('0x15')](_0x323f5c)['end']();};}function respondWithResult(_0x25104b,_0x2c0f8d){_0x2c0f8d=_0x2c0f8d||0xc8;return function(_0x5087cd){if(_0x5087cd){return _0x25104b[_0xddaf('0x15')](_0x2c0f8d)[_0xddaf('0x16')](_0x5087cd);}};}function respondWithFilteredResult(_0x48d719,_0x1f0af1){return function(_0xfe5f0b){if(_0xfe5f0b){var _0x30d99b=typeof _0x1f0af1['offset']===_0xddaf('0x17')&&typeof _0x1f0af1[_0xddaf('0x18')]===_0xddaf('0x17');var _0x2df60d=_0xfe5f0b[_0xddaf('0x19')];var _0x1a8087=_0x30d99b?0x0:_0x1f0af1['offset'];var _0x8ef5db=_0x30d99b?_0xfe5f0b[_0xddaf('0x19')]:_0x1f0af1['offset']+_0x1f0af1[_0xddaf('0x18')];var _0x2c9f47;if(_0x8ef5db>=_0x2df60d){_0x8ef5db=_0x2df60d;_0x2c9f47=0xc8;}else{_0x2c9f47=0xce;}_0x48d719[_0xddaf('0x15')](_0x2c9f47);return _0x48d719['set']('Content-Range',_0x1a8087+'-'+_0x8ef5db+'/'+_0x2df60d)['json'](_0xfe5f0b);}return null;};}function patchUpdates(_0x5addd2){return function(_0x13db55){try{jsonpatch[_0xddaf('0x1a')](_0x13db55,_0x5addd2,!![]);}catch(_0x370dcf){return BPromise[_0xddaf('0x1b')](_0x370dcf);}return _0x13db55[_0xddaf('0x1c')]();};}function saveUpdates(_0x2f9c87,_0x17924a){return function(_0x13ea86){if(_0x13ea86){return _0x13ea86[_0xddaf('0x1d')](_0x2f9c87)[_0xddaf('0x1e')](function(_0x1e477d){return _0x1e477d;});}return null;};}function removeEntity(_0x563076,_0x166c74){return function(_0x3feae1){if(_0x3feae1){return _0x3feae1[_0xddaf('0x1f')]()[_0xddaf('0x1e')](function(){_0x563076['status'](0xcc)[_0xddaf('0x20')]();});}};}function handleEntityNotFound(_0x9f6037,_0x269094){return function(_0x1e2a75){if(!_0x1e2a75){_0x9f6037[_0xddaf('0x21')](0x194);}return _0x1e2a75;};}function handleError(_0x563014,_0x3ac694){_0x3ac694=_0x3ac694||0x1f4;return function(_0x119e10){logger[_0xddaf('0x22')](_0x119e10[_0xddaf('0x23')]);if(_0x119e10[_0xddaf('0x24')]){delete _0x119e10[_0xddaf('0x24')];}_0x563014[_0xddaf('0x15')](_0x3ac694)[_0xddaf('0x25')](_0x119e10);};}exports[_0xddaf('0x26')]=function(_0x579bce,_0x5d9b8d){var _0x546cc7={},_0x40f908={},_0x3e1bc0={'count':0x0,'rows':[]};var _0x1673ea=_[_0xddaf('0x27')](db[_0xddaf('0x28')]['rawAttributes'],function(_0x53804e){return{'name':_0x53804e['fieldName'],'type':_0x53804e[_0xddaf('0x29')][_0xddaf('0x2a')]};});_0x40f908[_0xddaf('0x2b')]=_[_0xddaf('0x27')](_0x1673ea,_0xddaf('0x24'));_0x40f908['query']=_[_0xddaf('0x2c')](_0x579bce[_0xddaf('0x2d')]);_0x40f908[_0xddaf('0x2e')]=_[_0xddaf('0x2f')](_0x40f908[_0xddaf('0x2b')],_0x40f908[_0xddaf('0x2d')]);_0x546cc7['attributes']=_[_0xddaf('0x2f')](_0x40f908[_0xddaf('0x2b')],qs['fields'](_0x579bce['query'][_0xddaf('0x30')]));_0x546cc7[_0xddaf('0x31')]=_0x546cc7[_0xddaf('0x31')][_0xddaf('0x32')]?_0x546cc7[_0xddaf('0x31')]:_0x40f908['model'];if(!_0x579bce[_0xddaf('0x2d')][_0xddaf('0x33')](_0xddaf('0x34'))){_0x546cc7[_0xddaf('0x18')]=qs[_0xddaf('0x18')](_0x579bce['query'][_0xddaf('0x18')]);_0x546cc7[_0xddaf('0x35')]=qs[_0xddaf('0x35')](_0x579bce[_0xddaf('0x2d')][_0xddaf('0x35')]);}_0x546cc7[_0xddaf('0x36')]=qs[_0xddaf('0x37')](_0x579bce[_0xddaf('0x2d')][_0xddaf('0x37')]);_0x546cc7[_0xddaf('0x38')]=qs[_0xddaf('0x2e')](_['pick'](_0x579bce['query'],_0x40f908['filters']),_0x1673ea);if(_0x579bce[_0xddaf('0x2d')][_0xddaf('0x39')]){_0x546cc7[_0xddaf('0x38')]=_[_0xddaf('0x3a')](_0x546cc7[_0xddaf('0x38')],{'$or':_['map'](_0x1673ea,function(_0x250422){if(_0x250422[_0xddaf('0x29')]!==_0xddaf('0x3b')){var _0x461b23={};_0x461b23[_0x250422[_0xddaf('0x24')]]={'$like':'%'+_0x579bce['query'][_0xddaf('0x39')]+'%'};return _0x461b23;}})});}_0x546cc7=_[_0xddaf('0x3a')]({},_0x546cc7,_0x579bce['options']);var _0x214e54={'where':_0x546cc7[_0xddaf('0x38')]};return db[_0xddaf('0x28')]['count'](_0x214e54)[_0xddaf('0x1e')](function(_0xf4052f){_0x3e1bc0[_0xddaf('0x19')]=_0xf4052f;if(_0x579bce[_0xddaf('0x2d')][_0xddaf('0x3c')]){_0x546cc7[_0xddaf('0x3d')]=[{'all':!![]}];}return db['ZendeskField'][_0xddaf('0x3e')](_0x546cc7);})[_0xddaf('0x1e')](function(_0x3df1b9){_0x3e1bc0[_0xddaf('0x3f')]=_0x3df1b9;return _0x3e1bc0;})['then'](respondWithFilteredResult(_0x5d9b8d,_0x546cc7))[_0xddaf('0x40')](handleError(_0x5d9b8d,null));};exports['show']=function(_0x2cd574,_0x10b726){var _0x2d355c={'raw':!![],'where':{'id':_0x2cd574[_0xddaf('0x41')]['id']}},_0x463a5a={};_0x463a5a['model']=_[_0xddaf('0x2c')](db['ZendeskField'][_0xddaf('0x42')]);_0x463a5a['query']=_[_0xddaf('0x2c')](_0x2cd574[_0xddaf('0x2d')]);_0x463a5a['filters']=_[_0xddaf('0x2f')](_0x463a5a[_0xddaf('0x2b')],_0x463a5a[_0xddaf('0x2d')]);_0x2d355c[_0xddaf('0x31')]=_[_0xddaf('0x2f')](_0x463a5a[_0xddaf('0x2b')],qs['fields'](_0x2cd574[_0xddaf('0x2d')][_0xddaf('0x30')]));_0x2d355c[_0xddaf('0x31')]=_0x2d355c[_0xddaf('0x31')][_0xddaf('0x32')]?_0x2d355c[_0xddaf('0x31')]:_0x463a5a[_0xddaf('0x2b')];if(_0x2cd574[_0xddaf('0x2d')][_0xddaf('0x3c')]){_0x2d355c[_0xddaf('0x3d')]=[{'all':!![]}];}_0x2d355c=_[_0xddaf('0x3a')]({},_0x2d355c,_0x2cd574[_0xddaf('0x43')]);return db[_0xddaf('0x28')][_0xddaf('0x44')](_0x2d355c)[_0xddaf('0x1e')](handleEntityNotFound(_0x10b726,null))['then'](respondWithResult(_0x10b726,null))[_0xddaf('0x40')](handleError(_0x10b726,null));};exports[_0xddaf('0x45')]=function(_0x3950bc,_0x9b2da0){return db[_0xddaf('0x28')][_0xddaf('0x45')](_0x3950bc['body'],{})[_0xddaf('0x1e')](respondWithResult(_0x9b2da0,0xc9))[_0xddaf('0x40')](handleError(_0x9b2da0,null));};exports[_0xddaf('0x1d')]=function(_0x391f28,_0x470312){if(_0x391f28[_0xddaf('0x46')]['id']){delete _0x391f28[_0xddaf('0x46')]['id'];}return db['ZendeskField'][_0xddaf('0x44')]({'where':{'id':_0x391f28[_0xddaf('0x41')]['id']}})['then'](handleEntityNotFound(_0x470312,null))[_0xddaf('0x1e')](saveUpdates(_0x391f28[_0xddaf('0x46')],null))[_0xddaf('0x1e')](respondWithResult(_0x470312,null))[_0xddaf('0x40')](handleError(_0x470312,null));};exports[_0xddaf('0x1f')]=function(_0x4665cf,_0x5a546f){return db[_0xddaf('0x28')][_0xddaf('0x44')]({'where':{'id':_0x4665cf[_0xddaf('0x41')]['id']}})[_0xddaf('0x1e')](handleEntityNotFound(_0x5a546f,null))[_0xddaf('0x1e')](removeEntity(_0x5a546f,null))[_0xddaf('0x40')](handleError(_0x5a546f,null));}; \ No newline at end of file +var _0x7df1=['stack','name','send','rawAttributes','type','model','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','merge','VIRTUAL','options','ZendeskField','includeAll','findAll','rows','catch','show','include','find','create','body','params','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','count','set','json','reject','save','update','destroy','then','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7df1,0x1bf));var _0x17df=function(_0x43e83e,_0x49b134){_0x43e83e=_0x43e83e-0x0;var _0x342b19=_0x7df1[_0x43e83e];return _0x342b19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x17df('0x0'));var zipdir=require(_0x17df('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x17df('0x2'));var BPromise=require(_0x17df('0x3'));var Mustache=require('mustache');var util=require(_0x17df('0x4'));var path=require('path');var sox=require(_0x17df('0x5'));var csv=require(_0x17df('0x6'));var ejs=require(_0x17df('0x7'));var fs=require('fs');var fs_extra=require(_0x17df('0x8'));var _=require(_0x17df('0x9'));var squel=require(_0x17df('0xa'));var crypto=require(_0x17df('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x17df('0xc'));var toCsv=require(_0x17df('0x6'));var querystring=require('querystring');var Papa=require(_0x17df('0xd'));var Redis=require(_0x17df('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x17df('0xf'));var as=require(_0x17df('0x10'));var hardwareService=require(_0x17df('0x11'));var logger=require(_0x17df('0x12'))('api');var utils=require(_0x17df('0x13'));var config=require(_0x17df('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x17df('0x15'))['db'];function respondWithStatusCode(_0x4e13e6,_0xca4eac){_0xca4eac=_0xca4eac||0xcc;return function(_0x3921b0){if(_0x3921b0){return _0x4e13e6[_0x17df('0x16')](_0xca4eac);}return _0x4e13e6[_0x17df('0x17')](_0xca4eac)[_0x17df('0x18')]();};}function respondWithResult(_0x43aca7,_0x78b498){_0x78b498=_0x78b498||0xc8;return function(_0x49adce){if(_0x49adce){return _0x43aca7['status'](_0x78b498)['json'](_0x49adce);}};}function respondWithFilteredResult(_0x803c23,_0x57e167){return function(_0xd9bf4b){if(_0xd9bf4b){var _0x52f488=typeof _0x57e167[_0x17df('0x19')]==='undefined'&&typeof _0x57e167[_0x17df('0x1a')]==='undefined';var _0x740193=_0xd9bf4b[_0x17df('0x1b')];var _0x3ee845=_0x52f488?0x0:_0x57e167['offset'];var _0x5d963b=_0x52f488?_0xd9bf4b[_0x17df('0x1b')]:_0x57e167[_0x17df('0x19')]+_0x57e167[_0x17df('0x1a')];var _0x26578b;if(_0x5d963b>=_0x740193){_0x5d963b=_0x740193;_0x26578b=0xc8;}else{_0x26578b=0xce;}_0x803c23[_0x17df('0x17')](_0x26578b);return _0x803c23[_0x17df('0x1c')]('Content-Range',_0x3ee845+'-'+_0x5d963b+'/'+_0x740193)[_0x17df('0x1d')](_0xd9bf4b);}return null;};}function patchUpdates(_0x46dc35){return function(_0x4999c7){try{jsonpatch['apply'](_0x4999c7,_0x46dc35,!![]);}catch(_0x476966){return BPromise[_0x17df('0x1e')](_0x476966);}return _0x4999c7[_0x17df('0x1f')]();};}function saveUpdates(_0x4e9a32,_0xccffff){return function(_0x14aae7){if(_0x14aae7){return _0x14aae7[_0x17df('0x20')](_0x4e9a32)['then'](function(_0x200b98){return _0x200b98;});}return null;};}function removeEntity(_0x9cc58e,_0x466efe){return function(_0x605cc9){if(_0x605cc9){return _0x605cc9[_0x17df('0x21')]()[_0x17df('0x22')](function(){_0x9cc58e[_0x17df('0x17')](0xcc)[_0x17df('0x18')]();});}};}function handleEntityNotFound(_0x4d44b0,_0x90f083){return function(_0x178abe){if(!_0x178abe){_0x4d44b0[_0x17df('0x16')](0x194);}return _0x178abe;};}function handleError(_0x307911,_0x5a0eb8){_0x5a0eb8=_0x5a0eb8||0x1f4;return function(_0x40e2fd){logger[_0x17df('0x23')](_0x40e2fd[_0x17df('0x24')]);if(_0x40e2fd[_0x17df('0x25')]){delete _0x40e2fd[_0x17df('0x25')];}_0x307911[_0x17df('0x17')](_0x5a0eb8)[_0x17df('0x26')](_0x40e2fd);};}exports['index']=function(_0x345975,_0x47219a){var _0x4256d3={},_0xfef9c2={},_0x11d5a7={'count':0x0,'rows':[]};var _0x5673ef=_['map'](db['ZendeskField'][_0x17df('0x27')],function(_0x383b3e){return{'name':_0x383b3e['fieldName'],'type':_0x383b3e[_0x17df('0x28')]['key']};});_0xfef9c2[_0x17df('0x29')]=_[_0x17df('0x2a')](_0x5673ef,_0x17df('0x25'));_0xfef9c2['query']=_[_0x17df('0x2b')](_0x345975['query']);_0xfef9c2['filters']=_[_0x17df('0x2c')](_0xfef9c2[_0x17df('0x29')],_0xfef9c2[_0x17df('0x2d')]);_0x4256d3[_0x17df('0x2e')]=_['intersection'](_0xfef9c2[_0x17df('0x29')],qs[_0x17df('0x2f')](_0x345975[_0x17df('0x2d')][_0x17df('0x2f')]));_0x4256d3[_0x17df('0x2e')]=_0x4256d3[_0x17df('0x2e')][_0x17df('0x30')]?_0x4256d3[_0x17df('0x2e')]:_0xfef9c2['model'];if(!_0x345975['query'][_0x17df('0x31')]('nolimit')){_0x4256d3['limit']=qs['limit'](_0x345975['query'][_0x17df('0x1a')]);_0x4256d3['offset']=qs['offset'](_0x345975['query'][_0x17df('0x19')]);}_0x4256d3[_0x17df('0x32')]=qs[_0x17df('0x33')](_0x345975[_0x17df('0x2d')][_0x17df('0x33')]);_0x4256d3[_0x17df('0x34')]=qs['filters'](_[_0x17df('0x35')](_0x345975['query'],_0xfef9c2[_0x17df('0x36')]),_0x5673ef);if(_0x345975['query']['filter']){_0x4256d3[_0x17df('0x34')]=_[_0x17df('0x37')](_0x4256d3[_0x17df('0x34')],{'$or':_[_0x17df('0x2a')](_0x5673ef,function(_0x354159){if(_0x354159[_0x17df('0x28')]!==_0x17df('0x38')){var _0x40a634={};_0x40a634[_0x354159[_0x17df('0x25')]]={'$like':'%'+_0x345975[_0x17df('0x2d')]['filter']+'%'};return _0x40a634;}})});}_0x4256d3=_[_0x17df('0x37')]({},_0x4256d3,_0x345975[_0x17df('0x39')]);var _0x57c9f8={'where':_0x4256d3[_0x17df('0x34')]};return db[_0x17df('0x3a')][_0x17df('0x1b')](_0x57c9f8)[_0x17df('0x22')](function(_0x919e2e){_0x11d5a7['count']=_0x919e2e;if(_0x345975['query'][_0x17df('0x3b')]){_0x4256d3['include']=[{'all':!![]}];}return db[_0x17df('0x3a')][_0x17df('0x3c')](_0x4256d3);})[_0x17df('0x22')](function(_0x5a36ee){_0x11d5a7[_0x17df('0x3d')]=_0x5a36ee;return _0x11d5a7;})[_0x17df('0x22')](respondWithFilteredResult(_0x47219a,_0x4256d3))[_0x17df('0x3e')](handleError(_0x47219a,null));};exports[_0x17df('0x3f')]=function(_0x81a360,_0x252f01){var _0x49348c={'raw':!![],'where':{'id':_0x81a360['params']['id']}},_0x5d3079={};_0x5d3079[_0x17df('0x29')]=_['keys'](db[_0x17df('0x3a')]['rawAttributes']);_0x5d3079['query']=_[_0x17df('0x2b')](_0x81a360[_0x17df('0x2d')]);_0x5d3079[_0x17df('0x36')]=_[_0x17df('0x2c')](_0x5d3079[_0x17df('0x29')],_0x5d3079[_0x17df('0x2d')]);_0x49348c[_0x17df('0x2e')]=_['intersection'](_0x5d3079[_0x17df('0x29')],qs[_0x17df('0x2f')](_0x81a360[_0x17df('0x2d')][_0x17df('0x2f')]));_0x49348c[_0x17df('0x2e')]=_0x49348c[_0x17df('0x2e')]['length']?_0x49348c[_0x17df('0x2e')]:_0x5d3079['model'];if(_0x81a360[_0x17df('0x2d')][_0x17df('0x3b')]){_0x49348c[_0x17df('0x40')]=[{'all':!![]}];}_0x49348c=_['merge']({},_0x49348c,_0x81a360[_0x17df('0x39')]);return db[_0x17df('0x3a')][_0x17df('0x41')](_0x49348c)[_0x17df('0x22')](handleEntityNotFound(_0x252f01,null))['then'](respondWithResult(_0x252f01,null))[_0x17df('0x3e')](handleError(_0x252f01,null));};exports[_0x17df('0x42')]=function(_0x41aecc,_0x5a1ff6){return db[_0x17df('0x3a')][_0x17df('0x42')](_0x41aecc[_0x17df('0x43')],{})[_0x17df('0x22')](respondWithResult(_0x5a1ff6,0xc9))[_0x17df('0x3e')](handleError(_0x5a1ff6,null));};exports[_0x17df('0x20')]=function(_0x124744,_0x54a81e){if(_0x124744[_0x17df('0x43')]['id']){delete _0x124744[_0x17df('0x43')]['id'];}return db['ZendeskField'][_0x17df('0x41')]({'where':{'id':_0x124744[_0x17df('0x44')]['id']}})[_0x17df('0x22')](handleEntityNotFound(_0x54a81e,null))[_0x17df('0x22')](saveUpdates(_0x124744[_0x17df('0x43')],null))['then'](respondWithResult(_0x54a81e,null))[_0x17df('0x3e')](handleError(_0x54a81e,null));};exports[_0x17df('0x21')]=function(_0x505bef,_0x204f24){return db['ZendeskField'][_0x17df('0x41')]({'where':{'id':_0x505bef[_0x17df('0x44')]['id']}})[_0x17df('0x22')](handleEntityNotFound(_0x204f24,null))['then'](removeEntity(_0x204f24,null))['catch'](handleError(_0x204f24,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 2785942..e70d55f 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 _0xaf7a=['../../config/logger','request-promise','../../config/environment','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0xaf7a,0x12a));var _0xaaf7=function(_0x4b78a1,_0x1066e1){_0x4b78a1=_0x4b78a1-0x0;var _0x5bc361=_0xaf7a[_0x4b78a1];return _0x5bc361;};'use strict';var _=require(_0xaaf7('0x0'));var util=require(_0xaaf7('0x1'));var logger=require(_0xaaf7('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaaf7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaaf7('0x4'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0xb5419b,_0x3fba9f){return _0xb5419b[_0xaaf7('0x5')]('ZendeskField',attributes,{'tableName':_0xaaf7('0x6'),'paranoid':![],'indexes':[{'name':_0xaaf7('0x7'),'fields':[_0xaaf7('0x8'),_0xaaf7('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x151b=['define','zendesk_unique_index','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes'];(function(_0x46a9f2,_0x63d490){var _0x23117e=function(_0x46ac05){while(--_0x46ac05){_0x46a9f2['push'](_0x46a9f2['shift']());}};_0x23117e(++_0x63d490);}(_0x151b,0x1b3));var _0xb151=function(_0x28a7ba,_0x53a7b2){_0x28a7ba=_0x28a7ba-0x0;var _0x388fa4=_0x151b[_0x28a7ba];return _0x388fa4;};'use strict';var _=require(_0xb151('0x0'));var util=require('util');var logger=require(_0xb151('0x1'))(_0xb151('0x2'));var moment=require('moment');var BPromise=require(_0xb151('0x3'));var rp=require(_0xb151('0x4'));var fs=require('fs');var path=require(_0xb151('0x5'));var rimraf=require(_0xb151('0x6'));var config=require(_0xb151('0x7'));var attributes=require(_0xb151('0x8'));module['exports']=function(_0x13c32e,_0x124a8e){return _0x13c32e[_0xb151('0x9')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xb151('0xa'),'fields':['idField',_0xb151('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 9d57be8..9ea98fe 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 _0xa053=['../../config/environment','client','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc'];(function(_0xfd7b8,_0x4b30c4){var _0x494707=function(_0x18e1e8){while(--_0x18e1e8){_0xfd7b8['push'](_0xfd7b8['shift']());}};_0x494707(++_0x4b30c4);}(_0xa053,0x1b1));var _0x3a05=function(_0x2a05ff,_0x47204b){_0x2a05ff=_0x2a05ff-0x0;var _0x196e23=_0xa053[_0x2a05ff];return _0x196e23;};'use strict';var _=require(_0x3a05('0x0'));var util=require(_0x3a05('0x1'));var moment=require(_0x3a05('0x2'));var BPromise=require(_0x3a05('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a05('0x4'));var db=require(_0x3a05('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3a05('0x6'));var config=require(_0x3a05('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3a05('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cb1be,_0x438aa6,_0x1d8cc0){return new BPromise(function(_0x202c58,_0x4dbb1a){return client['request'](_0x3cb1be,_0x1d8cc0)[_0x3a05('0x9')](function(_0x15814b){logger[_0x3a05('0xa')](_0x3a05('0xb'),_0x438aa6,_0x3a05('0xc'));logger[_0x3a05('0xd')](_0x3a05('0xe'),_0x438aa6,_0x3a05('0xc'),JSON[_0x3a05('0xf')](_0x15814b));if(_0x15814b['error']){if(_0x15814b[_0x3a05('0x10')][_0x3a05('0x11')]===0x1f4){logger[_0x3a05('0x10')](_0x3a05('0xb'),_0x438aa6,_0x15814b[_0x3a05('0x10')][_0x3a05('0x12')]);return _0x4dbb1a(_0x15814b[_0x3a05('0x10')][_0x3a05('0x12')]);}logger['error'](_0x3a05('0xb'),_0x438aa6,_0x15814b[_0x3a05('0x10')]['message']);return _0x202c58(_0x15814b[_0x3a05('0x10')][_0x3a05('0x12')]);}else{logger[_0x3a05('0xa')](_0x3a05('0xb'),_0x438aa6,_0x3a05('0xc'));_0x202c58(_0x15814b[_0x3a05('0x13')][_0x3a05('0x12')]);}})['catch'](function(_0x2b1b8b){logger[_0x3a05('0x10')]('ZendeskField,\x20%s,\x20%s',_0x438aa6,_0x2b1b8b);_0x4dbb1a(_0x2b1b8b);});});} \ No newline at end of file +var _0xb7b7=['bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment'];(function(_0x2d1519,_0x6d4b66){var _0x28bbb1=function(_0x221502){while(--_0x221502){_0x2d1519['push'](_0x2d1519['shift']());}};_0x28bbb1(++_0x6d4b66);}(_0xb7b7,0xef));var _0x7b7b=function(_0x140bc7,_0x1743d2){_0x140bc7=_0x140bc7-0x0;var _0x1d1a7e=_0xb7b7[_0x140bc7];return _0x1d1a7e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7b7b('0x0'));var BPromise=require(_0x7b7b('0x1'));var rs=require(_0x7b7b('0x2'));var fs=require('fs');var Redis=require(_0x7b7b('0x3'));var db=require(_0x7b7b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7b7b('0x5'));var config=require(_0x7b7b('0x6'));var jayson=require(_0x7b7b('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x44ecd7,_0xf02958,_0x9545c6){return new BPromise(function(_0x384689,_0x40b110){return client[_0x7b7b('0x8')](_0x44ecd7,_0x9545c6)[_0x7b7b('0x9')](function(_0x31b056){logger[_0x7b7b('0xa')](_0x7b7b('0xb'),_0xf02958,_0x7b7b('0xc'));logger[_0x7b7b('0xd')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0xf02958,'request\x20sent',JSON[_0x7b7b('0xe')](_0x31b056));if(_0x31b056[_0x7b7b('0xf')]){if(_0x31b056[_0x7b7b('0xf')][_0x7b7b('0x10')]===0x1f4){logger[_0x7b7b('0xf')]('ZendeskField,\x20%s,\x20%s',_0xf02958,_0x31b056[_0x7b7b('0xf')]['message']);return _0x40b110(_0x31b056[_0x7b7b('0xf')][_0x7b7b('0x11')]);}logger['error'](_0x7b7b('0xb'),_0xf02958,_0x31b056[_0x7b7b('0xf')]['message']);return _0x384689(_0x31b056[_0x7b7b('0xf')][_0x7b7b('0x11')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0xf02958,_0x7b7b('0xc'));_0x384689(_0x31b056[_0x7b7b('0x12')]['message']);}})[_0x7b7b('0x13')](function(_0x487554){logger[_0x7b7b('0xf')](_0x7b7b('0xb'),_0xf02958,_0x487554);_0x40b110(_0x487554);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index cb3e11f..2287976 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 _0xf1fa=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get'];(function(_0x5b8aa9,_0xf9e326){var _0x4afc73=function(_0x9b90fe){while(--_0x9b90fe){_0x5b8aa9['push'](_0x5b8aa9['shift']());}};_0x4afc73(++_0xf9e326);}(_0xf1fa,0x1db));var _0xaf1f=function(_0x554904,_0x7b0685){_0x554904=_0x554904-0x0;var _0x19edc3=_0xf1fa[_0x554904];return _0x19edc3;};'use strict';var multer=require(_0xaf1f('0x0'));var util=require(_0xaf1f('0x1'));var path=require(_0xaf1f('0x2'));var timeout=require(_0xaf1f('0x3'));var express=require(_0xaf1f('0x4'));var router=express[_0xaf1f('0x5')]();var fs_extra=require(_0xaf1f('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaf1f('0x7'));var controller=require('./intZohoAccount.controller');router[_0xaf1f('0x8')]('/',auth[_0xaf1f('0x9')](),controller[_0xaf1f('0xa')]);router[_0xaf1f('0x8')](_0xaf1f('0xb'),auth[_0xaf1f('0x9')](),controller[_0xaf1f('0xc')]);router[_0xaf1f('0x8')](_0xaf1f('0xd'),auth[_0xaf1f('0x9')](),controller[_0xaf1f('0xe')]);router[_0xaf1f('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xaf1f('0xf')]);router[_0xaf1f('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0xaf1f('0x9')](),controller[_0xaf1f('0x11')]);router[_0xaf1f('0x12')](_0xaf1f('0xb'),auth[_0xaf1f('0x9')](),controller[_0xaf1f('0x13')]);router[_0xaf1f('0x14')](_0xaf1f('0xb'),auth[_0xaf1f('0x9')](),controller[_0xaf1f('0x15')]);module['exports']=router; \ No newline at end of file +var _0xb7b6=['/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7b6,0x15f));var _0x6b7b=function(_0x463950,_0x44f689){_0x463950=_0x463950-0x0;var _0x330904=_0xb7b6[_0x463950];return _0x330904;};'use strict';var multer=require(_0x6b7b('0x0'));var util=require(_0x6b7b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b7b('0x2'));var router=express[_0x6b7b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6b7b('0x4'));var interaction=require(_0x6b7b('0x5'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0x6b7b('0x6')]('/',auth[_0x6b7b('0x7')](),controller[_0x6b7b('0x8')]);router[_0x6b7b('0x6')](_0x6b7b('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x6b7b('0x6')](_0x6b7b('0xa'),auth[_0x6b7b('0x7')](),controller[_0x6b7b('0xb')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x6b7b('0xc')]);router[_0x6b7b('0xd')]('/',auth[_0x6b7b('0x7')](),controller[_0x6b7b('0xe')]);router[_0x6b7b('0xd')](_0x6b7b('0xa'),auth['isAuthenticated'](),controller[_0x6b7b('0xf')]);router[_0x6b7b('0x10')]('/:id',auth[_0x6b7b('0x7')](),controller[_0x6b7b('0x11')]);router['delete'](_0x6b7b('0x9'),auth['isAuthenticated'](),controller[_0x6b7b('0x12')]);module[_0x6b7b('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 1b90604..5474898 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 _0x0a9a=['STRING','exports'];(function(_0xb05949,_0x5c7d55){var _0x436671=function(_0x404eae){while(--_0x404eae){_0xb05949['push'](_0xb05949['shift']());}};_0x436671(++_0x5c7d55);}(_0x0a9a,0x183));var _0xa0a9=function(_0x916e3b,_0x502885){_0x916e3b=_0x916e3b-0x0;var _0x3d1fcf=_0x0a9a[_0x916e3b];return _0x3d1fcf;};'use strict';var Sequelize=require('sequelize');module[_0xa0a9('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa0a9('0x1')]},'host':{'type':Sequelize[_0xa0a9('0x1')]},'zone':{'type':Sequelize[_0xa0a9('0x1')]},'clientId':{'type':Sequelize[_0xa0a9('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xa0a9('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xa0a9('0x1')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x668b=['exports','STRING','sequelize'];(function(_0x54ea7a,_0x19df9b){var _0x65a10d=function(_0x1bf936){while(--_0x1bf936){_0x54ea7a['push'](_0x54ea7a['shift']());}};_0x65a10d(++_0x19df9b);}(_0x668b,0x140));var _0xb668=function(_0x53f402,_0x326920){_0x53f402=_0x53f402-0x0;var _0x45a76d=_0x668b[_0x53f402];return _0x45a76d;};'use strict';var Sequelize=require(_0xb668('0x0'));module[_0xb668('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb668('0x2')]},'host':{'type':Sequelize[_0xb668('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb668('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb668('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xb668('0x2')]},'refreshToken':{'type':Sequelize[_0xb668('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 8196ab6..283fe41 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 _0x6cc8=['api_name','display_label','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','limit','undefined','count','update','then','destroy','error','stack','name','send','index','map','ZohoAccount','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','create','body','catch','getConfigurations','ZohoConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','Descriptions','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','clientSecret','serverUrl','code','host','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Duration','Call_Result','remove'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x6cc8,0x80));var _0x86cc=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x6cc8[_0x1b828b];return _0x98da1a;};'use strict';var emlformat=require(_0x86cc('0x0'));var rimraf=require(_0x86cc('0x1'));var zipdir=require(_0x86cc('0x2'));var jsonpatch=require(_0x86cc('0x3'));var rp=require(_0x86cc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x86cc('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x86cc('0x6'));var ejs=require(_0x86cc('0x7'));var fs=require('fs');var fs_extra=require(_0x86cc('0x8'));var _=require(_0x86cc('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86cc('0xa'));var toCsv=require(_0x86cc('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x86cc('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x86cc('0xc'));var as=require(_0x86cc('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x86cc('0xe'))(_0x86cc('0xf'));var utils=require(_0x86cc('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x833441,_0x264436){_0x264436=_0x264436||0xcc;return function(_0xdc318d){if(_0xdc318d){return _0x833441[_0x86cc('0x11')](_0x264436);}return _0x833441[_0x86cc('0x12')](_0x264436)[_0x86cc('0x13')]();};}function respondWithResult(_0x2c2405,_0x3cdef5){_0x3cdef5=_0x3cdef5||0xc8;return function(_0x1fe7fd){if(_0x1fe7fd){return _0x2c2405[_0x86cc('0x12')](_0x3cdef5)[_0x86cc('0x14')](_0x1fe7fd);}};}function respondWithFilteredResult(_0x5b17a5,_0x2fab9a){return function(_0x1f3d5d){if(_0x1f3d5d){var _0xbc8f4d=typeof _0x2fab9a[_0x86cc('0x15')]==='undefined'&&typeof _0x2fab9a[_0x86cc('0x16')]===_0x86cc('0x17');var _0x37e3dc=_0x1f3d5d[_0x86cc('0x18')];var _0x34377a=_0xbc8f4d?0x0:_0x2fab9a[_0x86cc('0x15')];var _0x38731c=_0xbc8f4d?_0x1f3d5d[_0x86cc('0x18')]:_0x2fab9a[_0x86cc('0x15')]+_0x2fab9a[_0x86cc('0x16')];var _0x14eabb;if(_0x38731c>=_0x37e3dc){_0x38731c=_0x37e3dc;_0x14eabb=0xc8;}else{_0x14eabb=0xce;}_0x5b17a5[_0x86cc('0x12')](_0x14eabb);return _0x5b17a5['set']('Content-Range',_0x34377a+'-'+_0x38731c+'/'+_0x37e3dc)[_0x86cc('0x14')](_0x1f3d5d);}return null;};}function patchUpdates(_0xd34a0c){return function(_0x3d292d){try{jsonpatch['apply'](_0x3d292d,_0xd34a0c,!![]);}catch(_0x452a4f){return BPromise['reject'](_0x452a4f);}return _0x3d292d['save']();};}function saveUpdates(_0x303a46,_0x3dd684){return function(_0x2a5c86){if(_0x2a5c86){return _0x2a5c86[_0x86cc('0x19')](_0x303a46)[_0x86cc('0x1a')](function(_0x166819){return _0x166819;});}return null;};}function removeEntity(_0x55a9b2,_0xa27a13){return function(_0x3702d4){if(_0x3702d4){return _0x3702d4[_0x86cc('0x1b')]()[_0x86cc('0x1a')](function(){_0x55a9b2['status'](0xcc)[_0x86cc('0x13')]();});}};}function handleEntityNotFound(_0x34bad0,_0x4e1944){return function(_0x5d280b){if(!_0x5d280b){_0x34bad0['sendStatus'](0x194);}return _0x5d280b;};}function handleError(_0x506415,_0x1e2fa0){_0x1e2fa0=_0x1e2fa0||0x1f4;return function(_0x1727b8){logger[_0x86cc('0x1c')](_0x1727b8[_0x86cc('0x1d')]);if(_0x1727b8[_0x86cc('0x1e')]){delete _0x1727b8[_0x86cc('0x1e')];}_0x506415[_0x86cc('0x12')](_0x1e2fa0)[_0x86cc('0x1f')](_0x1727b8);};}exports[_0x86cc('0x20')]=function(_0x48523c,_0x59ac5d){var _0x1aa628={},_0xe83387={},_0x39eff7={'count':0x0,'rows':[]};var _0x49ca7c=_[_0x86cc('0x21')](db[_0x86cc('0x22')]['rawAttributes'],function(_0x2bb88e){return{'name':_0x2bb88e[_0x86cc('0x23')],'type':_0x2bb88e[_0x86cc('0x24')][_0x86cc('0x25')]};});_0xe83387[_0x86cc('0x26')]=_[_0x86cc('0x21')](_0x49ca7c,'name');_0xe83387[_0x86cc('0x27')]=_['keys'](_0x48523c[_0x86cc('0x27')]);_0xe83387[_0x86cc('0x28')]=_[_0x86cc('0x29')](_0xe83387[_0x86cc('0x26')],_0xe83387[_0x86cc('0x27')]);_0x1aa628['attributes']=_['intersection'](_0xe83387['model'],qs[_0x86cc('0x2a')](_0x48523c[_0x86cc('0x27')][_0x86cc('0x2a')]));_0x1aa628[_0x86cc('0x2b')]=_0x1aa628[_0x86cc('0x2b')][_0x86cc('0x2c')]?_0x1aa628[_0x86cc('0x2b')]:_0xe83387[_0x86cc('0x26')];if(!_0x48523c['query'][_0x86cc('0x2d')](_0x86cc('0x2e'))){_0x1aa628[_0x86cc('0x16')]=qs['limit'](_0x48523c[_0x86cc('0x27')]['limit']);_0x1aa628['offset']=qs['offset'](_0x48523c[_0x86cc('0x27')][_0x86cc('0x15')]);}_0x1aa628[_0x86cc('0x2f')]=qs['sort'](_0x48523c[_0x86cc('0x27')][_0x86cc('0x30')]);_0x1aa628[_0x86cc('0x31')]=qs[_0x86cc('0x28')](_[_0x86cc('0x32')](_0x48523c[_0x86cc('0x27')],_0xe83387['filters']),_0x49ca7c);if(_0x48523c[_0x86cc('0x27')][_0x86cc('0x33')]){_0x1aa628['where']=_[_0x86cc('0x34')](_0x1aa628[_0x86cc('0x31')],{'$or':_[_0x86cc('0x21')](_0x49ca7c,function(_0x28b992){if(_0x28b992[_0x86cc('0x24')]!=='VIRTUAL'){var _0x65b205={};_0x65b205[_0x28b992[_0x86cc('0x1e')]]={'$like':'%'+_0x48523c['query'][_0x86cc('0x33')]+'%'};return _0x65b205;}})});}_0x1aa628=_[_0x86cc('0x34')]({},_0x1aa628,_0x48523c[_0x86cc('0x35')]);var _0x4c492b={'where':_0x1aa628[_0x86cc('0x31')]};return db[_0x86cc('0x22')][_0x86cc('0x18')](_0x4c492b)[_0x86cc('0x1a')](function(_0x54f749){_0x39eff7['count']=_0x54f749;if(_0x48523c[_0x86cc('0x27')]['includeAll']){_0x1aa628[_0x86cc('0x36')]=[{'all':!![]}];}return db['ZohoAccount'][_0x86cc('0x37')](_0x1aa628);})[_0x86cc('0x1a')](function(_0x7e9b52){_0x39eff7[_0x86cc('0x38')]=_0x7e9b52;return _0x39eff7;})[_0x86cc('0x1a')](respondWithFilteredResult(_0x59ac5d,_0x1aa628))['catch'](handleError(_0x59ac5d,null));};exports[_0x86cc('0x39')]=function(_0x54a955,_0x51a8ea){var _0x39ed53={'raw':![],'where':{'id':_0x54a955[_0x86cc('0x3a')]['id']}},_0x5f15ca={};_0x5f15ca['model']=_[_0x86cc('0x3b')](db['ZohoAccount'][_0x86cc('0x3c')]);_0x5f15ca[_0x86cc('0x27')]=_[_0x86cc('0x3b')](_0x54a955['query']);_0x5f15ca[_0x86cc('0x28')]=_[_0x86cc('0x29')](_0x5f15ca[_0x86cc('0x26')],_0x5f15ca[_0x86cc('0x27')]);_0x39ed53[_0x86cc('0x2b')]=_['intersection'](_0x5f15ca[_0x86cc('0x26')],qs[_0x86cc('0x2a')](_0x54a955[_0x86cc('0x27')][_0x86cc('0x2a')]));_0x39ed53['attributes']=_0x39ed53[_0x86cc('0x2b')]['length']?_0x39ed53[_0x86cc('0x2b')]:_0x5f15ca[_0x86cc('0x26')];if(_0x54a955['query'][_0x86cc('0x3d')]){_0x39ed53[_0x86cc('0x36')]=[{'all':!![]}];}_0x39ed53=_[_0x86cc('0x34')]({},_0x39ed53,_0x54a955['options']);return db[_0x86cc('0x22')][_0x86cc('0x3e')](_0x39ed53)[_0x86cc('0x1a')](handleEntityNotFound(_0x51a8ea,null))[_0x86cc('0x1a')](respondWithResult(_0x51a8ea,null))['catch'](handleError(_0x51a8ea,null));};exports[_0x86cc('0x3f')]=function(_0x21e3ca,_0x3214f0){return db[_0x86cc('0x22')]['create'](_0x21e3ca[_0x86cc('0x40')],{})['then'](respondWithResult(_0x3214f0,0xc9))[_0x86cc('0x41')](handleError(_0x3214f0,null));};exports[_0x86cc('0x19')]=function(_0x5ea649,_0x3f3d71){if(_0x5ea649[_0x86cc('0x40')]['id']){delete _0x5ea649[_0x86cc('0x40')]['id'];}return db[_0x86cc('0x22')][_0x86cc('0x3e')]({'where':{'id':_0x5ea649[_0x86cc('0x3a')]['id']}})[_0x86cc('0x1a')](handleEntityNotFound(_0x3f3d71,null))[_0x86cc('0x1a')](saveUpdates(_0x5ea649['body'],null))['then'](respondWithResult(_0x3f3d71,null))[_0x86cc('0x41')](handleError(_0x3f3d71,null));};exports[_0x86cc('0x1b')]=function(_0x30ef1b,_0x21c0ad){return db['ZohoAccount'][_0x86cc('0x3e')]({'where':{'id':_0x30ef1b[_0x86cc('0x3a')]['id']}})[_0x86cc('0x1a')](handleEntityNotFound(_0x21c0ad,null))['then'](removeEntity(_0x21c0ad,null))['catch'](handleError(_0x21c0ad,null));};exports[_0x86cc('0x42')]=function(_0xd057a5,_0x4fd5f0,_0x21d596){var _0x3a9aef={};var _0x53d744={};var _0x10a7b4;var _0x4e0210;return db['ZohoAccount']['findOne']({'where':{'id':_0xd057a5[_0x86cc('0x3a')]['id']}})[_0x86cc('0x1a')](handleEntityNotFound(_0x4fd5f0,null))[_0x86cc('0x1a')](function(_0x306ac2){if(_0x306ac2){_0x10a7b4=_0x306ac2;_0x53d744['model']=_['keys'](db[_0x86cc('0x43')][_0x86cc('0x3c')]);_0x53d744[_0x86cc('0x27')]=_[_0x86cc('0x3b')](_0xd057a5[_0x86cc('0x27')]);_0x53d744['filters']=_[_0x86cc('0x29')](_0x53d744[_0x86cc('0x26')],_0x53d744[_0x86cc('0x27')]);_0x3a9aef[_0x86cc('0x2b')]=_['intersection'](_0x53d744[_0x86cc('0x26')],qs[_0x86cc('0x2a')](_0xd057a5[_0x86cc('0x27')][_0x86cc('0x2a')]));_0x3a9aef[_0x86cc('0x2b')]=_0x3a9aef['attributes'][_0x86cc('0x2c')]?_0x3a9aef[_0x86cc('0x2b')]:_0x53d744[_0x86cc('0x26')];_0x3a9aef[_0x86cc('0x2f')]=qs[_0x86cc('0x30')](_0xd057a5[_0x86cc('0x27')]['sort']);_0x3a9aef[_0x86cc('0x31')]=qs[_0x86cc('0x28')](_[_0x86cc('0x32')](_0xd057a5['query'],_0x53d744[_0x86cc('0x28')]));if(_0xd057a5[_0x86cc('0x27')]['filter']){_0x3a9aef[_0x86cc('0x31')]=_[_0x86cc('0x34')](_0x3a9aef[_0x86cc('0x31')],{'$or':_[_0x86cc('0x21')](_0x3a9aef[_0x86cc('0x2b')],function(_0x72e77f){var _0x2dd102={};_0x2dd102[_0x72e77f]={'$like':'%'+_0xd057a5['query'][_0x86cc('0x33')]+'%'};return _0x2dd102;})});}_0x3a9aef=_[_0x86cc('0x34')]({},_0x3a9aef,_0xd057a5[_0x86cc('0x35')]);return _0x10a7b4['getConfigurations'](_0x3a9aef);}})[_0x86cc('0x1a')](function(_0x2481b1){if(_0x2481b1){_0x4e0210=_0x2481b1[_0x86cc('0x2c')];if(!_0xd057a5[_0x86cc('0x27')][_0x86cc('0x2d')](_0x86cc('0x2e'))){_0x3a9aef[_0x86cc('0x16')]=qs['limit'](_0xd057a5[_0x86cc('0x27')][_0x86cc('0x16')]);_0x3a9aef[_0x86cc('0x15')]=qs[_0x86cc('0x15')](_0xd057a5[_0x86cc('0x27')][_0x86cc('0x15')]);}return _0x10a7b4['getConfigurations'](_0x3a9aef);}})['then'](function(_0x418ccc){if(_0x418ccc){return _0x418ccc?{'count':_0x4e0210,'rows':_0x418ccc}:null;}})['then'](respondWithResult(_0x4fd5f0,null))['catch'](handleError(_0x4fd5f0,null));};exports[_0x86cc('0x44')]=function(_0x467c71,_0x2dc40f,_0x14576e){if(_0x467c71['body']['id']){delete _0x467c71[_0x86cc('0x40')]['id'];}return db[_0x86cc('0x22')][_0x86cc('0x45')]({'where':{'id':_0x467c71[_0x86cc('0x3a')]['id']}})[_0x86cc('0x1a')](handleEntityNotFound(_0x2dc40f,null))[_0x86cc('0x1a')](function(_0x3b3ff2){if(_0x3b3ff2){_0x467c71[_0x86cc('0x40')][_0x86cc('0x46')]=_0x3b3ff2['id'];_0x467c71['body'][_0x86cc('0x47')]=integrations[_0x86cc('0x48')](_0x467c71[_0x86cc('0x40')][_0x86cc('0x49')],_0x467c71['body'][_0x86cc('0x24')]);_0x467c71[_0x86cc('0x40')]['Descriptions']=integrations[_0x86cc('0x4a')](_0x467c71['body'][_0x86cc('0x49')],_0x467c71[_0x86cc('0x40')][_0x86cc('0x24')]);return db[_0x86cc('0x43')]['create'](_0x467c71[_0x86cc('0x40')],{'include':[{'model':db['ZohoField'],'as':_0x86cc('0x47')},{'model':db['ZohoField'],'as':_0x86cc('0x4b')}]});}return null;})['then'](respondWithResult(_0x2dc40f,null))[_0x86cc('0x41')](handleError(_0x2dc40f,null));};function getAccessToken(_0x4816ec){return new Promise(function(_0xd2de56,_0x132f0e){var _0x5dffb3;switch(_0x4816ec['zone']){case'US':_0x5dffb3=_0x86cc('0x4c');break;case'AU':_0x5dffb3=_0x86cc('0x4d');break;case'EU':_0x5dffb3=_0x86cc('0x4e');break;case'IN':_0x5dffb3=_0x86cc('0x4f');break;case'CN':_0x5dffb3=_0x86cc('0x50');break;default:_0x5dffb3=_0x86cc('0x4e');break;}var _0xdfb33c={'method':_0x86cc('0x51'),'uri':_0x5dffb3+'/oauth/v2/token','qs':{'refresh_token':_0x4816ec[_0x86cc('0x52')],'client_id':_0x4816ec[_0x86cc('0x53')],'client_secret':_0x4816ec['clientSecret'],'grant_type':_0x86cc('0x54')},'json':!![]};return rp(_0xdfb33c)[_0x86cc('0x1a')](function(_0x377fee){if(_0x377fee[_0x86cc('0x55')]){_0xd2de56(_0x377fee[_0x86cc('0x55')]);}else{_0x132f0e(_0x86cc('0x56'));}})['catch'](function(_0x44cfcf){_0x132f0e(_0x44cfcf);});});}exports[_0x86cc('0x57')]=function(_0x5e07fd,_0x5c5882,_0x363b1f){var _0x1ad5d1,_0x52f926,_0x3420b4,_0xc4ff89,_0x1d320a;return db[_0x86cc('0x22')][_0x86cc('0x45')]({'where':{'id':_0x5e07fd[_0x86cc('0x3a')]['id']},'attributes':['id','host','zone',_0x86cc('0x53'),_0x86cc('0x58'),_0x86cc('0x59'),_0x86cc('0x5a'),_0x86cc('0x52')]})[_0x86cc('0x1a')](handleEntityNotFound(_0x5c5882,null))[_0x86cc('0x1a')](function(_0x8ced77){_0x1d320a=_0x8ced77;_0x1ad5d1=_0x1d320a[_0x86cc('0x5b')];_0x52f926=_0x1ad5d1===_0x86cc('0x5c')?'eu':_0x86cc('0x5d');_0x3420b4=_0x1d320a[_0x86cc('0x59')];var _0x353975=_0x3420b4[_0x86cc('0x5e')](-0x1);if(_0x353975==='/'||_0x353975==='\x5c'||_0x353975===':'){_0x3420b4=_0x3420b4[_0x86cc('0x5f')](0x0,_0x3420b4[_0x86cc('0x60')](_0x353975));}if(!_0x1d320a[_0x86cc('0x52')]){throw new Error(_0x86cc('0x61'));}return getAccessToken(_0x1d320a);})[_0x86cc('0x1a')](function(_0x607afb){if(_0x607afb){return rp({'method':'GET','uri':util[_0x86cc('0x62')](_0x86cc('0x63'),_0x52f926),'qs':{'module':_0x86cc('0x64')},'headers':{'Authorization':_0x86cc('0x65')+_0x607afb},'json':!![]});}})['then'](function(_0xe6dd21){if(_0xe6dd21){if(_0xe6dd21['response']&&_0xe6dd21[_0x86cc('0x66')][_0x86cc('0x1c')]){throw new Error(_0xe6dd21['response'][_0x86cc('0x1c')][_0x86cc('0x67')]);}var _0x24bc56=[];var _0x2b7549=[];var _0x324edd=['Owner',_0x86cc('0x68'),_0x86cc('0x69'),_0x86cc('0x6a'),_0x86cc('0x6b'),_0x86cc('0x6c'),'Call_Start_Time','Call_Type'];_0x2b7549=_[_0x86cc('0x6d')](_0xe6dd21[_0x86cc('0x2a')],function(_0x4e7ff3){return _0x324edd['includes'](_0x4e7ff3[_0x86cc('0x6e')]);});for(var _0x439fac=0x0;_0x439fac<_0x2b7549[_0x86cc('0x2c')];_0x439fac++){if(_0x2b7549[_0x439fac]['system_mandatory']===![]){_0x24bc56['push']({'id':_0x2b7549[_0x439fac]['id'],'name':_0x2b7549[_0x439fac][_0x86cc('0x6f')],'custom':_0x2b7549[_0x439fac][_0x86cc('0x70')],'options':_0x2b7549[_0x439fac][_0x86cc('0x71')]==='picklist'&&_0x2b7549[_0x439fac][_0x86cc('0x72')]['length']>-0x1?_[_0x86cc('0x21')](_0x2b7549[_0x439fac][_0x86cc('0x72')],function(_0x14072e){return{'name':_0x14072e,'value':_0x14072e};}):[]});}}return{'count':_0x24bc56[_0x86cc('0x2c')],'rows':_0x24bc56};}else{return{'count':0x0,'rows':[]};}})[_0x86cc('0x1a')](respondWithResult(_0x5c5882,null))[_0x86cc('0x41')](function(_0xe6d1c3){var _0x566c0e=_0x5e07fd[_0x86cc('0x27')]['test']?0x1f4:_0xe6d1c3[_0x86cc('0x73')]||0x1f4;logger[_0x86cc('0x1c')](_0x86cc('0x74'),_0x86cc('0x57'),_0x566c0e,JSON[_0x86cc('0x75')](_0xe6d1c3));delete _0xe6d1c3[_0x86cc('0x1e')];if(_0x566c0e===0x191){_0x566c0e=0x190;}_0x5c5882['status'](_0x566c0e)[_0x86cc('0x1f')](_0x5e07fd[_0x86cc('0x27')]['test']?{'message':_0x86cc('0x76'),'statusCode':_0xe6d1c3[_0x86cc('0x73')]}:_0xe6d1c3);});}; \ No newline at end of file +var _0x6374=['remove','api_name','system_mandatory','push','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','ZohoAccount','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','find','catch','create','body','params','getConfigurations','findOne','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','response','Owner','Description','WhoId','Call_Duration','Call_Start_Time'];(function(_0x4a6b6b,_0x428c40){var _0x25977a=function(_0x4ce72e){while(--_0x4ce72e){_0x4a6b6b['push'](_0x4a6b6b['shift']());}};_0x25977a(++_0x428c40);}(_0x6374,0x187));var _0x4637=function(_0x1dffba,_0x5619a8){_0x1dffba=_0x1dffba-0x0;var _0x1120d4=_0x6374[_0x1dffba];return _0x1120d4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4637('0x0'));var jsonpatch=require(_0x4637('0x1'));var rp=require(_0x4637('0x2'));var moment=require(_0x4637('0x3'));var BPromise=require(_0x4637('0x4'));var Mustache=require(_0x4637('0x5'));var util=require(_0x4637('0x6'));var path=require('path');var sox=require(_0x4637('0x7'));var csv=require(_0x4637('0x8'));var ejs=require(_0x4637('0x9'));var fs=require('fs');var fs_extra=require(_0x4637('0xa'));var _=require(_0x4637('0xb'));var squel=require('squel');var crypto=require(_0x4637('0xc'));var jsforce=require(_0x4637('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4637('0xe'));var authService=require(_0x4637('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4637('0x10'));var hardwareService=require(_0x4637('0x11'));var logger=require('../../config/logger')(_0x4637('0x12'));var utils=require(_0x4637('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4637('0x14'))['db'];var integrations=require(_0x4637('0x15'));function respondWithStatusCode(_0x142a66,_0x27547b){_0x27547b=_0x27547b||0xcc;return function(_0x3ee714){if(_0x3ee714){return _0x142a66[_0x4637('0x16')](_0x27547b);}return _0x142a66[_0x4637('0x17')](_0x27547b)[_0x4637('0x18')]();};}function respondWithResult(_0x51a5f9,_0xc0cb7){_0xc0cb7=_0xc0cb7||0xc8;return function(_0x2253fd){if(_0x2253fd){return _0x51a5f9[_0x4637('0x17')](_0xc0cb7)[_0x4637('0x19')](_0x2253fd);}};}function respondWithFilteredResult(_0x2986e9,_0x461c70){return function(_0x58f30b){if(_0x58f30b){var _0x2dcb69=typeof _0x461c70[_0x4637('0x1a')]===_0x4637('0x1b')&&typeof _0x461c70[_0x4637('0x1c')]===_0x4637('0x1b');var _0x22311e=_0x58f30b[_0x4637('0x1d')];var _0x740b7d=_0x2dcb69?0x0:_0x461c70[_0x4637('0x1a')];var _0x3cca0e=_0x2dcb69?_0x58f30b['count']:_0x461c70[_0x4637('0x1a')]+_0x461c70['limit'];var _0x12e081;if(_0x3cca0e>=_0x22311e){_0x3cca0e=_0x22311e;_0x12e081=0xc8;}else{_0x12e081=0xce;}_0x2986e9[_0x4637('0x17')](_0x12e081);return _0x2986e9[_0x4637('0x1e')]('Content-Range',_0x740b7d+'-'+_0x3cca0e+'/'+_0x22311e)['json'](_0x58f30b);}return null;};}function patchUpdates(_0x44aca9){return function(_0x2cf48a){try{jsonpatch[_0x4637('0x1f')](_0x2cf48a,_0x44aca9,!![]);}catch(_0x14a7d7){return BPromise[_0x4637('0x20')](_0x14a7d7);}return _0x2cf48a[_0x4637('0x21')]();};}function saveUpdates(_0x2cb606,_0x17c0e9){return function(_0x132989){if(_0x132989){return _0x132989[_0x4637('0x22')](_0x2cb606)[_0x4637('0x23')](function(_0x2d279a){return _0x2d279a;});}return null;};}function removeEntity(_0x27eb03,_0x163637){return function(_0x420169){if(_0x420169){return _0x420169[_0x4637('0x24')]()[_0x4637('0x23')](function(){_0x27eb03[_0x4637('0x17')](0xcc)[_0x4637('0x18')]();});}};}function handleEntityNotFound(_0x1761c1,_0x32f199){return function(_0x5bb050){if(!_0x5bb050){_0x1761c1[_0x4637('0x16')](0x194);}return _0x5bb050;};}function handleError(_0x4138fa,_0x51ce4c){_0x51ce4c=_0x51ce4c||0x1f4;return function(_0x4a7b03){logger[_0x4637('0x25')](_0x4a7b03[_0x4637('0x26')]);if(_0x4a7b03['name']){delete _0x4a7b03[_0x4637('0x27')];}_0x4138fa[_0x4637('0x17')](_0x51ce4c)[_0x4637('0x28')](_0x4a7b03);};}exports[_0x4637('0x29')]=function(_0xedd793,_0x3ced0d){var _0x1fe2eb={},_0x3ab876={},_0x3cb2ab={'count':0x0,'rows':[]};var _0x2662a9=_['map'](db[_0x4637('0x2a')][_0x4637('0x2b')],function(_0x50d49c){return{'name':_0x50d49c['fieldName'],'type':_0x50d49c[_0x4637('0x2c')][_0x4637('0x2d')]};});_0x3ab876[_0x4637('0x2e')]=_[_0x4637('0x2f')](_0x2662a9,_0x4637('0x27'));_0x3ab876[_0x4637('0x30')]=_[_0x4637('0x31')](_0xedd793[_0x4637('0x30')]);_0x3ab876['filters']=_[_0x4637('0x32')](_0x3ab876[_0x4637('0x2e')],_0x3ab876[_0x4637('0x30')]);_0x1fe2eb[_0x4637('0x33')]=_[_0x4637('0x32')](_0x3ab876[_0x4637('0x2e')],qs[_0x4637('0x34')](_0xedd793[_0x4637('0x30')][_0x4637('0x34')]));_0x1fe2eb[_0x4637('0x33')]=_0x1fe2eb[_0x4637('0x33')][_0x4637('0x35')]?_0x1fe2eb[_0x4637('0x33')]:_0x3ab876[_0x4637('0x2e')];if(!_0xedd793[_0x4637('0x30')]['hasOwnProperty'](_0x4637('0x36'))){_0x1fe2eb[_0x4637('0x1c')]=qs['limit'](_0xedd793[_0x4637('0x30')][_0x4637('0x1c')]);_0x1fe2eb[_0x4637('0x1a')]=qs[_0x4637('0x1a')](_0xedd793['query'][_0x4637('0x1a')]);}_0x1fe2eb[_0x4637('0x37')]=qs[_0x4637('0x38')](_0xedd793[_0x4637('0x30')][_0x4637('0x38')]);_0x1fe2eb[_0x4637('0x39')]=qs[_0x4637('0x3a')](_['pick'](_0xedd793[_0x4637('0x30')],_0x3ab876[_0x4637('0x3a')]),_0x2662a9);if(_0xedd793[_0x4637('0x30')]['filter']){_0x1fe2eb[_0x4637('0x39')]=_[_0x4637('0x3b')](_0x1fe2eb[_0x4637('0x39')],{'$or':_[_0x4637('0x2f')](_0x2662a9,function(_0x5cee66){if(_0x5cee66[_0x4637('0x2c')]!==_0x4637('0x3c')){var _0x321f4d={};_0x321f4d[_0x5cee66[_0x4637('0x27')]]={'$like':'%'+_0xedd793['query'][_0x4637('0x3d')]+'%'};return _0x321f4d;}})});}_0x1fe2eb=_[_0x4637('0x3b')]({},_0x1fe2eb,_0xedd793[_0x4637('0x3e')]);var _0x5b402c={'where':_0x1fe2eb[_0x4637('0x39')]};return db[_0x4637('0x2a')][_0x4637('0x1d')](_0x5b402c)[_0x4637('0x23')](function(_0x1f9cb2){_0x3cb2ab['count']=_0x1f9cb2;if(_0xedd793['query'][_0x4637('0x3f')]){_0x1fe2eb[_0x4637('0x40')]=[{'all':!![]}];}return db[_0x4637('0x2a')][_0x4637('0x41')](_0x1fe2eb);})[_0x4637('0x23')](function(_0x50a30f){_0x3cb2ab['rows']=_0x50a30f;return _0x3cb2ab;})[_0x4637('0x23')](respondWithFilteredResult(_0x3ced0d,_0x1fe2eb))['catch'](handleError(_0x3ced0d,null));};exports['show']=function(_0x44df3b,_0x140cb2){var _0x3a8e70={'raw':![],'where':{'id':_0x44df3b['params']['id']}},_0x22f8c1={};_0x22f8c1[_0x4637('0x2e')]=_[_0x4637('0x31')](db[_0x4637('0x2a')]['rawAttributes']);_0x22f8c1['query']=_[_0x4637('0x31')](_0x44df3b['query']);_0x22f8c1[_0x4637('0x3a')]=_[_0x4637('0x32')](_0x22f8c1[_0x4637('0x2e')],_0x22f8c1[_0x4637('0x30')]);_0x3a8e70[_0x4637('0x33')]=_[_0x4637('0x32')](_0x22f8c1[_0x4637('0x2e')],qs[_0x4637('0x34')](_0x44df3b['query'][_0x4637('0x34')]));_0x3a8e70['attributes']=_0x3a8e70[_0x4637('0x33')]['length']?_0x3a8e70['attributes']:_0x22f8c1[_0x4637('0x2e')];if(_0x44df3b[_0x4637('0x30')][_0x4637('0x3f')]){_0x3a8e70[_0x4637('0x40')]=[{'all':!![]}];}_0x3a8e70=_[_0x4637('0x3b')]({},_0x3a8e70,_0x44df3b[_0x4637('0x3e')]);return db[_0x4637('0x2a')][_0x4637('0x42')](_0x3a8e70)[_0x4637('0x23')](handleEntityNotFound(_0x140cb2,null))[_0x4637('0x23')](respondWithResult(_0x140cb2,null))[_0x4637('0x43')](handleError(_0x140cb2,null));};exports[_0x4637('0x44')]=function(_0x2aedd0,_0x588dc6){return db[_0x4637('0x2a')][_0x4637('0x44')](_0x2aedd0[_0x4637('0x45')],{})[_0x4637('0x23')](respondWithResult(_0x588dc6,0xc9))[_0x4637('0x43')](handleError(_0x588dc6,null));};exports[_0x4637('0x22')]=function(_0x4eed6e,_0x255974){if(_0x4eed6e[_0x4637('0x45')]['id']){delete _0x4eed6e['body']['id'];}return db['ZohoAccount'][_0x4637('0x42')]({'where':{'id':_0x4eed6e[_0x4637('0x46')]['id']}})[_0x4637('0x23')](handleEntityNotFound(_0x255974,null))[_0x4637('0x23')](saveUpdates(_0x4eed6e[_0x4637('0x45')],null))[_0x4637('0x23')](respondWithResult(_0x255974,null))[_0x4637('0x43')](handleError(_0x255974,null));};exports['destroy']=function(_0xa44ad6,_0x28c04f){return db[_0x4637('0x2a')]['find']({'where':{'id':_0xa44ad6[_0x4637('0x46')]['id']}})[_0x4637('0x23')](handleEntityNotFound(_0x28c04f,null))['then'](removeEntity(_0x28c04f,null))[_0x4637('0x43')](handleError(_0x28c04f,null));};exports[_0x4637('0x47')]=function(_0x1d3fe6,_0x28123f,_0x375618){var _0x31a944={};var _0x1710cb={};var _0xbebaf6;var _0x1a79f2;return db['ZohoAccount'][_0x4637('0x48')]({'where':{'id':_0x1d3fe6[_0x4637('0x46')]['id']}})[_0x4637('0x23')](handleEntityNotFound(_0x28123f,null))[_0x4637('0x23')](function(_0x1e5ed1){if(_0x1e5ed1){_0xbebaf6=_0x1e5ed1;_0x1710cb[_0x4637('0x2e')]=_[_0x4637('0x31')](db['ZohoConfiguration']['rawAttributes']);_0x1710cb[_0x4637('0x30')]=_[_0x4637('0x31')](_0x1d3fe6[_0x4637('0x30')]);_0x1710cb[_0x4637('0x3a')]=_[_0x4637('0x32')](_0x1710cb[_0x4637('0x2e')],_0x1710cb[_0x4637('0x30')]);_0x31a944[_0x4637('0x33')]=_[_0x4637('0x32')](_0x1710cb[_0x4637('0x2e')],qs[_0x4637('0x34')](_0x1d3fe6[_0x4637('0x30')][_0x4637('0x34')]));_0x31a944['attributes']=_0x31a944[_0x4637('0x33')][_0x4637('0x35')]?_0x31a944[_0x4637('0x33')]:_0x1710cb['model'];_0x31a944[_0x4637('0x37')]=qs[_0x4637('0x38')](_0x1d3fe6[_0x4637('0x30')][_0x4637('0x38')]);_0x31a944[_0x4637('0x39')]=qs['filters'](_['pick'](_0x1d3fe6['query'],_0x1710cb['filters']));if(_0x1d3fe6['query'][_0x4637('0x3d')]){_0x31a944[_0x4637('0x39')]=_[_0x4637('0x3b')](_0x31a944[_0x4637('0x39')],{'$or':_[_0x4637('0x2f')](_0x31a944[_0x4637('0x33')],function(_0x1c845e){var _0x36887b={};_0x36887b[_0x1c845e]={'$like':'%'+_0x1d3fe6[_0x4637('0x30')]['filter']+'%'};return _0x36887b;})});}_0x31a944=_[_0x4637('0x3b')]({},_0x31a944,_0x1d3fe6[_0x4637('0x3e')]);return _0xbebaf6[_0x4637('0x47')](_0x31a944);}})[_0x4637('0x23')](function(_0x40ea4a){if(_0x40ea4a){_0x1a79f2=_0x40ea4a[_0x4637('0x35')];if(!_0x1d3fe6[_0x4637('0x30')][_0x4637('0x49')]('nolimit')){_0x31a944['limit']=qs[_0x4637('0x1c')](_0x1d3fe6[_0x4637('0x30')]['limit']);_0x31a944[_0x4637('0x1a')]=qs['offset'](_0x1d3fe6['query'][_0x4637('0x1a')]);}return _0xbebaf6['getConfigurations'](_0x31a944);}})[_0x4637('0x23')](function(_0xa7279d){if(_0xa7279d){return _0xa7279d?{'count':_0x1a79f2,'rows':_0xa7279d}:null;}})[_0x4637('0x23')](respondWithResult(_0x28123f,null))[_0x4637('0x43')](handleError(_0x28123f,null));};exports[_0x4637('0x4a')]=function(_0x3bebd6,_0x1e85a1,_0x51be45){if(_0x3bebd6[_0x4637('0x45')]['id']){delete _0x3bebd6['body']['id'];}return db[_0x4637('0x2a')][_0x4637('0x48')]({'where':{'id':_0x3bebd6[_0x4637('0x46')]['id']}})[_0x4637('0x23')](handleEntityNotFound(_0x1e85a1,null))['then'](function(_0x23a3d1){if(_0x23a3d1){_0x3bebd6[_0x4637('0x45')]['AccountId']=_0x23a3d1['id'];_0x3bebd6[_0x4637('0x45')][_0x4637('0x4b')]=integrations[_0x4637('0x4c')](_0x3bebd6[_0x4637('0x45')][_0x4637('0x4d')],_0x3bebd6['body']['type']);_0x3bebd6[_0x4637('0x45')][_0x4637('0x4e')]=integrations[_0x4637('0x4f')](_0x3bebd6['body'][_0x4637('0x4d')],_0x3bebd6['body'][_0x4637('0x2c')]);return db[_0x4637('0x50')][_0x4637('0x44')](_0x3bebd6[_0x4637('0x45')],{'include':[{'model':db[_0x4637('0x51')],'as':_0x4637('0x4b')},{'model':db[_0x4637('0x51')],'as':'Descriptions'}]});}return null;})[_0x4637('0x23')](respondWithResult(_0x1e85a1,null))[_0x4637('0x43')](handleError(_0x1e85a1,null));};function getAccessToken(_0x4a33d9){return new Promise(function(_0x1ba400,_0xba37f8){var _0x1fa1de;switch(_0x4a33d9[_0x4637('0x52')]){case'US':_0x1fa1de=_0x4637('0x53');break;case'AU':_0x1fa1de=_0x4637('0x54');break;case'EU':_0x1fa1de=_0x4637('0x55');break;case'IN':_0x1fa1de=_0x4637('0x56');break;case'CN':_0x1fa1de=_0x4637('0x57');break;default:_0x1fa1de=_0x4637('0x55');break;}var _0x81aeb2={'method':_0x4637('0x58'),'uri':_0x1fa1de+_0x4637('0x59'),'qs':{'refresh_token':_0x4a33d9[_0x4637('0x5a')],'client_id':_0x4a33d9[_0x4637('0x5b')],'client_secret':_0x4a33d9[_0x4637('0x5c')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x81aeb2)[_0x4637('0x23')](function(_0x3f0455){if(_0x3f0455[_0x4637('0x5d')]){_0x1ba400(_0x3f0455[_0x4637('0x5d')]);}else{_0xba37f8(_0x4637('0x5e'));}})[_0x4637('0x43')](function(_0x2a6006){_0xba37f8(_0x2a6006);});});}exports['getFields']=function(_0x49492c,_0x44f06f,_0x29bd8f){var _0x273779,_0x5851b3,_0x4653eb,_0xb33637,_0x32b6c3;return db[_0x4637('0x2a')][_0x4637('0x48')]({'where':{'id':_0x49492c['params']['id']},'attributes':['id',_0x4637('0x5f'),'zone',_0x4637('0x5b'),_0x4637('0x5c'),_0x4637('0x60'),_0x4637('0x61'),'refreshToken']})['then'](handleEntityNotFound(_0x44f06f,null))[_0x4637('0x23')](function(_0x44cd8d){_0x32b6c3=_0x44cd8d;_0x273779=_0x32b6c3['host'];_0x5851b3=_0x273779===_0x4637('0x62')?'eu':_0x4637('0x63');_0x4653eb=_0x32b6c3['serverUrl'];var _0x525e00=_0x4653eb[_0x4637('0x64')](-0x1);if(_0x525e00==='/'||_0x525e00==='\x5c'||_0x525e00===':'){_0x4653eb=_0x4653eb[_0x4637('0x65')](0x0,_0x4653eb[_0x4637('0x66')](_0x525e00));}if(!_0x32b6c3[_0x4637('0x5a')]){throw new Error(_0x4637('0x67'));}return getAccessToken(_0x32b6c3);})[_0x4637('0x23')](function(_0x45b5ac){if(_0x45b5ac){return rp({'method':_0x4637('0x68'),'uri':util[_0x4637('0x69')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x5851b3),'qs':{'module':_0x4637('0x6a')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x45b5ac},'json':!![]});}})[_0x4637('0x23')](function(_0x2bd609){if(_0x2bd609){if(_0x2bd609[_0x4637('0x6b')]&&_0x2bd609[_0x4637('0x6b')][_0x4637('0x25')]){throw new Error(_0x2bd609[_0x4637('0x6b')][_0x4637('0x25')]['message']);}var _0x3d8c83=[];var _0x479e2a=[];var _0xc8be1e=[_0x4637('0x6c'),'Subject',_0x4637('0x6d'),_0x4637('0x6e'),_0x4637('0x6f'),'Call_Result',_0x4637('0x70'),'Call_Type'];_0x479e2a=_[_0x4637('0x71')](_0x2bd609[_0x4637('0x34')],function(_0x11abc5){return _0xc8be1e['includes'](_0x11abc5[_0x4637('0x72')]);});for(var _0x57f032=0x0;_0x57f032<_0x479e2a[_0x4637('0x35')];_0x57f032++){if(_0x479e2a[_0x57f032][_0x4637('0x73')]===![]){_0x3d8c83[_0x4637('0x74')]({'id':_0x479e2a[_0x57f032]['id'],'name':_0x479e2a[_0x57f032]['display_label'],'custom':_0x479e2a[_0x57f032][_0x4637('0x75')],'options':_0x479e2a[_0x57f032][_0x4637('0x76')]===_0x4637('0x77')&&_0x479e2a[_0x57f032][_0x4637('0x78')][_0x4637('0x35')]>-0x1?_[_0x4637('0x2f')](_0x479e2a[_0x57f032][_0x4637('0x78')],function(_0x4f1eb4){return{'name':_0x4f1eb4,'value':_0x4f1eb4};}):[]});}}return{'count':_0x3d8c83[_0x4637('0x35')],'rows':_0x3d8c83};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x44f06f,null))[_0x4637('0x43')](function(_0x2a3f5b){var _0x54c255=_0x49492c[_0x4637('0x30')][_0x4637('0x79')]?0x1f4:_0x2a3f5b[_0x4637('0x7a')]||0x1f4;logger[_0x4637('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x4637('0x7b'),_0x54c255,JSON[_0x4637('0x7c')](_0x2a3f5b));delete _0x2a3f5b[_0x4637('0x27')];if(_0x54c255===0x191){_0x54c255=0x190;}_0x44f06f[_0x4637('0x17')](_0x54c255)[_0x4637('0x28')](_0x49492c[_0x4637('0x30')][_0x4637('0x79')]?{'message':_0x4637('0x7d'),'statusCode':_0x2a3f5b[_0x4637('0x7a')]}:_0x2a3f5b);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 0c14b01..259ca92 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 _0x3ea3=['lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientSecret','code','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','host','slice','https://accounts.zoho.in','https://accounts.zoho.eu','authorization_code','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d'];(function(_0x36105a,_0x59e2eb){var _0x504112=function(_0x4b981a){while(--_0x4b981a){_0x36105a['push'](_0x36105a['shift']());}};_0x504112(++_0x59e2eb);}(_0x3ea3,0xb0));var _0x33ea=function(_0xf6ebda,_0x18d2ed){_0xf6ebda=_0xf6ebda-0x0;var _0x195749=_0x3ea3[_0xf6ebda];return _0x195749;};'use strict';var _=require(_0x33ea('0x0'));var util=require(_0x33ea('0x1'));var logger=require(_0x33ea('0x2'))('api');var moment=require(_0x33ea('0x3'));var BPromise=require(_0x33ea('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x33ea('0x5'));var rimraf=require('rimraf');var config=require(_0x33ea('0x6'));var attributes=require(_0x33ea('0x7'));var integrations=require(_0x33ea('0x8'));module[_0x33ea('0x9')]=function(_0x1128af,_0xcd3bee){return _0x1128af[_0x33ea('0xa')](_0x33ea('0xb'),attributes,{'tableName':_0x33ea('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x51ed72,_0x479dde,_0x55854d){if(_0x51ed72[_0x33ea('0xd')]('zone')||_0x51ed72['changed'](_0x33ea('0xe'))||_0x51ed72['changed']('clientId')||_0x51ed72[_0x33ea('0xd')](_0x33ea('0xf'))||_0x51ed72[_0x33ea('0xd')](_0x33ea('0x10'))||_0x51ed72['changed']('host')){var _0x32dfef,_0x6d0e21;_0x32dfef=_0x51ed72[_0x33ea('0xe')];var _0x1f2a41=_0x32dfef['slice'](-0x1);if(_0x1f2a41==='/'||_0x1f2a41==='\x5c'||_0x1f2a41===':'){_0x32dfef=_0x32dfef[_0x33ea('0x11')](0x0,_0x32dfef[_0x33ea('0x12')](_0x1f2a41));}switch(_0x51ed72[_0x33ea('0x13')]){case'US':_0x6d0e21=_0x33ea('0x14');break;case'AU':_0x6d0e21=_0x33ea('0x15');break;case'IN':_0x6d0e21='https://accounts.zoho.in';break;case'CN':_0x6d0e21=_0x33ea('0x16');break;default:_0x6d0e21='https://accounts.zoho.eu';break;}var _0x116e7b={'method':_0x33ea('0x17'),'uri':_0x6d0e21+_0x33ea('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x51ed72[_0x33ea('0x19')],'client_secret':_0x51ed72['clientSecret'],'redirect_uri':_0x51ed72['serverUrl'],'code':_0x51ed72['code']},'headers':{'Content-Type':_0x33ea('0x1a')}};return rp(_0x116e7b)[_0x33ea('0x1b')](function(_0x178594){var _0x3a65c7=JSON[_0x33ea('0x1c')](_0x178594);if(_0x3a65c7[_0x33ea('0x1d')]){_0x51ed72[_0x33ea('0x1e')]=_0x3a65c7[_0x33ea('0x1d')];logger['info'](util[_0x33ea('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x51ed72[_0x33ea('0x20')],_0x51ed72['id']));}else{logger[_0x33ea('0x21')](util[_0x33ea('0x1f')](_0x33ea('0x22'),_0x51ed72[_0x33ea('0x20')],_0x51ed72['id']),util[_0x33ea('0x23')](_0x3a65c7,{'showHidden':![],'depth':null}));}return _0x55854d(null,_0x479dde);})[_0x33ea('0x24')](function(_0x56306b){logger[_0x33ea('0x21')](util[_0x33ea('0x1f')](_0x33ea('0x22'),_0x51ed72[_0x33ea('0x20')],_0x51ed72['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x55854d(_0x56306b);});}else{return _0x55854d(null,_0x479dde);}},'beforeUpdate':function(_0x3ee232,_0x267876,_0x35806f){if(_0x3ee232[_0x33ea('0xd')]('zone')||_0x3ee232['changed'](_0x33ea('0xe'))||_0x3ee232[_0x33ea('0xd')](_0x33ea('0x19'))||_0x3ee232[_0x33ea('0xd')](_0x33ea('0xf'))||_0x3ee232['changed'](_0x33ea('0x10'))||_0x3ee232[_0x33ea('0xd')](_0x33ea('0x25'))){var _0x18bc8c,_0x1b98d2;_0x18bc8c=_0x3ee232[_0x33ea('0xe')];var _0x4fd073=_0x18bc8c[_0x33ea('0x26')](-0x1);if(_0x4fd073==='/'||_0x4fd073==='\x5c'||_0x4fd073===':'){_0x18bc8c=_0x18bc8c[_0x33ea('0x11')](0x0,_0x18bc8c[_0x33ea('0x12')](_0x4fd073));}switch(_0x3ee232[_0x33ea('0x13')]){case'US':_0x1b98d2=_0x33ea('0x14');break;case'AU':_0x1b98d2='https://accounts.zoho.com.au';break;case'IN':_0x1b98d2=_0x33ea('0x27');break;case'CN':_0x1b98d2=_0x33ea('0x16');break;default:_0x1b98d2=_0x33ea('0x28');break;}var _0x46d8e5={'method':'POST','uri':_0x1b98d2+_0x33ea('0x18'),'form':{'grant_type':_0x33ea('0x29'),'client_id':_0x3ee232['clientId'],'client_secret':_0x3ee232[_0x33ea('0xf')],'redirect_uri':_0x3ee232[_0x33ea('0xe')],'code':_0x3ee232[_0x33ea('0x10')]},'headers':{'Content-Type':_0x33ea('0x1a')}};return rp(_0x46d8e5)['then'](function(_0x5568d3){var _0x38fd68=JSON[_0x33ea('0x1c')](_0x5568d3);if(_0x38fd68[_0x33ea('0x1d')]){_0x3ee232['refreshToken']=_0x38fd68[_0x33ea('0x1d')];logger[_0x33ea('0x2a')](util[_0x33ea('0x1f')](_0x33ea('0x2b'),_0x3ee232[_0x33ea('0x20')],_0x3ee232['id']));}else{logger[_0x33ea('0x21')](util[_0x33ea('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3ee232[_0x33ea('0x20')],_0x3ee232['id']),util['inspect'](_0x38fd68,{'showHidden':![],'depth':null}));}return _0x35806f(null,_0x267876);})[_0x33ea('0x24')](function(_0x1f9d8c){logger['error'](util['format'](_0x33ea('0x22'),_0x3ee232['name'],_0x3ee232['id']),util[_0x33ea('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x35806f(_0x1f9d8c);});}else{return _0x35806f(null,_0x267876);}}}});}; \ No newline at end of file +var _0x4d4c=['../../components/integrations/configuration','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientSecret','code','host','slice','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','refresh_token','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','error','inspect','authorization_code','application/x-www-form-urlencoded','then','parse','info','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4709c8,_0x3384ca){var _0x478cdd=function(_0x5193ce){while(--_0x5193ce){_0x4709c8['push'](_0x4709c8['shift']());}};_0x478cdd(++_0x3384ca);}(_0x4d4c,0x98));var _0xc4d4=function(_0xd511d,_0x3546b9){_0xd511d=_0xd511d-0x0;var _0x3f148e=_0x4d4c[_0xd511d];return _0x3f148e;};'use strict';var _=require('lodash');var util=require(_0xc4d4('0x0'));var logger=require(_0xc4d4('0x1'))(_0xc4d4('0x2'));var moment=require(_0xc4d4('0x3'));var BPromise=require(_0xc4d4('0x4'));var rp=require(_0xc4d4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc4d4('0x6'));var config=require(_0xc4d4('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xc4d4('0x8'));module['exports']=function(_0x906e78,_0x11276b){return _0x906e78['define'](_0xc4d4('0x9'),attributes,{'tableName':_0xc4d4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x76726e,_0x360a53,_0x989baf){if(_0x76726e['changed'](_0xc4d4('0xb'))||_0x76726e[_0xc4d4('0xc')](_0xc4d4('0xd'))||_0x76726e['changed']('clientId')||_0x76726e[_0xc4d4('0xc')](_0xc4d4('0xe'))||_0x76726e[_0xc4d4('0xc')](_0xc4d4('0xf'))||_0x76726e[_0xc4d4('0xc')](_0xc4d4('0x10'))){var _0x17984e,_0x8e4841;_0x17984e=_0x76726e[_0xc4d4('0xd')];var _0x427423=_0x17984e[_0xc4d4('0x11')](-0x1);if(_0x427423==='/'||_0x427423==='\x5c'||_0x427423===':'){_0x17984e=_0x17984e['substring'](0x0,_0x17984e[_0xc4d4('0x12')](_0x427423));}switch(_0x76726e[_0xc4d4('0xb')]){case'US':_0x8e4841='https://accounts.zoho.com';break;case'AU':_0x8e4841=_0xc4d4('0x13');break;case'IN':_0x8e4841=_0xc4d4('0x14');break;case'CN':_0x8e4841=_0xc4d4('0x15');break;default:_0x8e4841=_0xc4d4('0x16');break;}var _0x54ffb9={'method':_0xc4d4('0x17'),'uri':_0x8e4841+_0xc4d4('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x76726e[_0xc4d4('0x19')],'client_secret':_0x76726e[_0xc4d4('0xe')],'redirect_uri':_0x76726e[_0xc4d4('0xd')],'code':_0x76726e[_0xc4d4('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x54ffb9)['then'](function(_0x38be79){var _0x222f33=JSON['parse'](_0x38be79);if(_0x222f33[_0xc4d4('0x1a')]){_0x76726e[_0xc4d4('0x1b')]=_0x222f33[_0xc4d4('0x1a')];logger['info'](util['format'](_0xc4d4('0x1c'),_0x76726e[_0xc4d4('0x1d')],_0x76726e['id']));}else{logger['error'](util[_0xc4d4('0x1e')](_0xc4d4('0x1f'),_0x76726e[_0xc4d4('0x1d')],_0x76726e['id']),util['inspect'](_0x222f33,{'showHidden':![],'depth':null}));}return _0x989baf(null,_0x360a53);})[_0xc4d4('0x20')](function(_0x100913){logger[_0xc4d4('0x21')](util['format'](_0xc4d4('0x1f'),_0x76726e[_0xc4d4('0x1d')],_0x76726e['id']),util[_0xc4d4('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x989baf(_0x100913);});}else{return _0x989baf(null,_0x360a53);}},'beforeUpdate':function(_0x470635,_0x2d3bf9,_0x4f0733){if(_0x470635['changed'](_0xc4d4('0xb'))||_0x470635[_0xc4d4('0xc')](_0xc4d4('0xd'))||_0x470635[_0xc4d4('0xc')](_0xc4d4('0x19'))||_0x470635[_0xc4d4('0xc')](_0xc4d4('0xe'))||_0x470635['changed'](_0xc4d4('0xf'))||_0x470635[_0xc4d4('0xc')](_0xc4d4('0x10'))){var _0x5ccd2c,_0x40c572;_0x5ccd2c=_0x470635[_0xc4d4('0xd')];var _0x42073d=_0x5ccd2c['slice'](-0x1);if(_0x42073d==='/'||_0x42073d==='\x5c'||_0x42073d===':'){_0x5ccd2c=_0x5ccd2c['substring'](0x0,_0x5ccd2c[_0xc4d4('0x12')](_0x42073d));}switch(_0x470635[_0xc4d4('0xb')]){case'US':_0x40c572='https://accounts.zoho.com';break;case'AU':_0x40c572='https://accounts.zoho.com.au';break;case'IN':_0x40c572=_0xc4d4('0x14');break;case'CN':_0x40c572='https://accounts.zoho.com.cn';break;default:_0x40c572=_0xc4d4('0x16');break;}var _0x525cbb={'method':_0xc4d4('0x17'),'uri':_0x40c572+'/oauth/v2/token','form':{'grant_type':_0xc4d4('0x23'),'client_id':_0x470635[_0xc4d4('0x19')],'client_secret':_0x470635[_0xc4d4('0xe')],'redirect_uri':_0x470635[_0xc4d4('0xd')],'code':_0x470635[_0xc4d4('0xf')]},'headers':{'Content-Type':_0xc4d4('0x24')}};return rp(_0x525cbb)[_0xc4d4('0x25')](function(_0x3358a1){var _0x5d1d6e=JSON[_0xc4d4('0x26')](_0x3358a1);if(_0x5d1d6e[_0xc4d4('0x1a')]){_0x470635['refreshToken']=_0x5d1d6e[_0xc4d4('0x1a')];logger[_0xc4d4('0x27')](util[_0xc4d4('0x1e')](_0xc4d4('0x1c'),_0x470635[_0xc4d4('0x1d')],_0x470635['id']));}else{logger[_0xc4d4('0x21')](util[_0xc4d4('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x470635[_0xc4d4('0x1d')],_0x470635['id']),util[_0xc4d4('0x22')](_0x5d1d6e,{'showHidden':![],'depth':null}));}return _0x4f0733(null,_0x2d3bf9);})[_0xc4d4('0x20')](function(_0x36bd5c){logger[_0xc4d4('0x21')](util[_0xc4d4('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x470635[_0xc4d4('0x1d')],_0x470635['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x4f0733(_0x36bd5c);});}else{return _0x4f0733(null,_0x2d3bf9);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 66a37ed..4d18e4e 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 _0xceef=['attributes','include','map','model','ShowZohoAccount','find','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetZohoAccount','ZohoAccount','findAll','raw','options','where'];(function(_0x194b9e,_0x5def06){var _0x2f34ce=function(_0x2bedd3){while(--_0x2bedd3){_0x194b9e['push'](_0x194b9e['shift']());}};_0x2f34ce(++_0x5def06);}(_0xceef,0xf6));var _0xfcee=function(_0x3d3ddd,_0x59b504){_0x3d3ddd=_0x3d3ddd-0x0;var _0x52a4f9=_0xceef[_0x3d3ddd];return _0x52a4f9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfcee('0x0'));var BPromise=require(_0xfcee('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcee('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfcee('0x3'));var logger=require(_0xfcee('0x4'))('rpc');var config=require(_0xfcee('0x5'));var jayson=require(_0xfcee('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x35234a,_0xfbfb75,_0xd69040){return new BPromise(function(_0x5b0d2c,_0x513a59){return client[_0xfcee('0x7')](_0x35234a,_0xd69040)[_0xfcee('0x8')](function(_0xcea858){logger[_0xfcee('0x9')](_0xfcee('0xa'),_0xfbfb75,_0xfcee('0xb'));logger[_0xfcee('0xc')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0xfbfb75,_0xfcee('0xb'),JSON[_0xfcee('0xd')](_0xcea858));if(_0xcea858[_0xfcee('0xe')]){if(_0xcea858[_0xfcee('0xe')][_0xfcee('0xf')]===0x1f4){logger[_0xfcee('0xe')](_0xfcee('0xa'),_0xfbfb75,_0xcea858[_0xfcee('0xe')][_0xfcee('0x10')]);return _0x513a59(_0xcea858['error'][_0xfcee('0x10')]);}logger[_0xfcee('0xe')]('ZohoAccount,\x20%s,\x20%s',_0xfbfb75,_0xcea858['error'][_0xfcee('0x10')]);return _0x5b0d2c(_0xcea858[_0xfcee('0xe')][_0xfcee('0x10')]);}else{logger[_0xfcee('0x9')](_0xfcee('0xa'),_0xfbfb75,_0xfcee('0xb'));_0x5b0d2c(_0xcea858['result'][_0xfcee('0x10')]);}})[_0xfcee('0x11')](function(_0x38a971){logger['error'](_0xfcee('0xa'),_0xfbfb75,_0x38a971);_0x513a59(_0x38a971);});});}exports[_0xfcee('0x12')]=function(_0x45c690){var _0x47ddd8=this;return new Promise(function(_0x37fa9c,_0x13ec8b){return db[_0xfcee('0x13')][_0xfcee('0x14')]({'raw':_0x45c690['options']?_0x45c690['options'][_0xfcee('0x15')]===undefined?!![]:![]:!![],'where':_0x45c690[_0xfcee('0x16')]?_0x45c690[_0xfcee('0x16')][_0xfcee('0x17')]||null:null,'attributes':_0x45c690[_0xfcee('0x16')]?_0x45c690[_0xfcee('0x16')][_0xfcee('0x18')]||null:null,'limit':_0x45c690['options']?_0x45c690[_0xfcee('0x16')]['limit']||null:null,'include':_0x45c690['options']?_0x45c690[_0xfcee('0x16')][_0xfcee('0x19')]?_[_0xfcee('0x1a')](_0x45c690[_0xfcee('0x16')][_0xfcee('0x19')],function(_0x463df4){return{'model':db[_0x463df4[_0xfcee('0x1b')]],'as':_0x463df4['as'],'attributes':_0x463df4[_0xfcee('0x18')],'include':_0x463df4[_0xfcee('0x19')]?_[_0xfcee('0x1a')](_0x463df4[_0xfcee('0x19')],function(_0x475a48){return{'model':db[_0x475a48[_0xfcee('0x1b')]],'as':_0x475a48['as'],'attributes':_0x475a48[_0xfcee('0x18')],'include':_0x475a48[_0xfcee('0x19')]?_['map'](_0x475a48['include'],function(_0x56c9f7){return{'model':db[_0x56c9f7[_0xfcee('0x1b')]],'as':_0x56c9f7['as'],'attributes':_0x56c9f7[_0xfcee('0x18')]};}):[]};}):[]};}):[]:[]})[_0xfcee('0x8')](function(_0x2e7e74){logger[_0xfcee('0x9')](_0xfcee('0x12'),_0x45c690);logger[_0xfcee('0xc')](_0xfcee('0x12'),_0x45c690,JSON[_0xfcee('0xd')](_0x2e7e74));_0x37fa9c(_0x2e7e74);})['catch'](function(_0x2dc32){logger[_0xfcee('0xe')](_0xfcee('0x12'),_0x2dc32[_0xfcee('0x10')],_0x45c690);_0x13ec8b(_0x47ddd8[_0xfcee('0xe')](0x1f4,_0x2dc32[_0xfcee('0x10')]));});});};exports[_0xfcee('0x1c')]=function(_0x5ed336){var _0x329ff0=this;return new Promise(function(_0x27c6fc,_0x397629){return db[_0xfcee('0x13')][_0xfcee('0x1d')]({'raw':_0x5ed336[_0xfcee('0x16')]?_0x5ed336[_0xfcee('0x16')][_0xfcee('0x15')]===undefined?!![]:![]:!![],'where':_0x5ed336[_0xfcee('0x16')]?_0x5ed336[_0xfcee('0x16')]['where']||null:null,'attributes':_0x5ed336[_0xfcee('0x16')]?_0x5ed336['options'][_0xfcee('0x18')]||null:null,'include':_0x5ed336[_0xfcee('0x16')]?_0x5ed336[_0xfcee('0x16')]['include']?_['map'](_0x5ed336[_0xfcee('0x16')]['include'],function(_0x4625ff){return{'model':db[_0x4625ff[_0xfcee('0x1b')]],'as':_0x4625ff['as'],'attributes':_0x4625ff[_0xfcee('0x18')],'include':_0x4625ff[_0xfcee('0x19')]?_[_0xfcee('0x1a')](_0x4625ff[_0xfcee('0x19')],function(_0x43fe34){return{'model':db[_0x43fe34['model']],'as':_0x43fe34['as'],'attributes':_0x43fe34['attributes'],'include':_0x43fe34[_0xfcee('0x19')]?_['map'](_0x43fe34[_0xfcee('0x19')],function(_0x22ebf4){return{'model':db[_0x22ebf4[_0xfcee('0x1b')]],'as':_0x22ebf4['as'],'attributes':_0x22ebf4[_0xfcee('0x18')]};}):[]};}):[]};}):[]:[]})[_0xfcee('0x8')](function(_0x5de47d){logger['info'](_0xfcee('0x1c'),_0x5ed336);logger[_0xfcee('0xc')](_0xfcee('0x1c'),_0x5ed336,JSON[_0xfcee('0xd')](_0x5de47d));_0x27c6fc(_0x5de47d);})[_0xfcee('0x11')](function(_0x9a5c7f){logger[_0xfcee('0xe')]('ShowZohoAccount',_0x9a5c7f['message'],_0x5ed336);_0x397629(_0x329ff0[_0xfcee('0xe')](0x1f4,_0x9a5c7f[_0xfcee('0x10')]));});});}; \ No newline at end of file +var _0x5c3c=['find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetZohoAccount','ZohoAccount','findAll','options','where','limit','include','map','model','attributes','debug','catch','ShowZohoAccount'];(function(_0x573e79,_0x2654ca){var _0x3caca7=function(_0x4d36e6){while(--_0x4d36e6){_0x573e79['push'](_0x573e79['shift']());}};_0x3caca7(++_0x2654ca);}(_0x5c3c,0x132));var _0xc5c3=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x5c3c[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require(_0xc5c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require(_0xc5c3('0x6'));var logger=require(_0xc5c3('0x7'))(_0xc5c3('0x8'));var config=require(_0xc5c3('0x9'));var jayson=require(_0xc5c3('0xa'));var client=jayson[_0xc5c3('0xb')][_0xc5c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a392b,_0x4b8404,_0x591f7d){return new BPromise(function(_0x723c31,_0x522be1){return client['request'](_0x5a392b,_0x591f7d)[_0xc5c3('0xd')](function(_0x46e2c1){logger['info'](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));logger['debug'](_0xc5c3('0x10'),_0x4b8404,_0xc5c3('0xf'),JSON[_0xc5c3('0x11')](_0x46e2c1));if(_0x46e2c1['error']){if(_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x13')]===0x1f4){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x522be1(_0x46e2c1['error'][_0xc5c3('0x14')]);}logger[_0xc5c3('0x12')](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x723c31(_0x46e2c1['error']['message']);}else{logger[_0xc5c3('0x15')](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));_0x723c31(_0x46e2c1[_0xc5c3('0x16')]['message']);}})['catch'](function(_0x467ba9){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x467ba9);_0x522be1(_0x467ba9);});});}exports[_0xc5c3('0x17')]=function(_0x2ff158){var _0x13c867=this;return new Promise(function(_0x28bae6,_0x5e11d5){return db[_0xc5c3('0x18')][_0xc5c3('0x19')]({'raw':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')][_0xc5c3('0x1b')]||null:null,'attributes':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')]['attributes']||null:null,'limit':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')][_0xc5c3('0x1c')]||null:null,'include':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')][_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x2ff158['options']['include'],function(_0x45affe){return{'model':db[_0x45affe[_0xc5c3('0x1f')]],'as':_0x45affe['as'],'attributes':_0x45affe['attributes'],'include':_0x45affe['include']?_[_0xc5c3('0x1e')](_0x45affe[_0xc5c3('0x1d')],function(_0x38a3df){return{'model':db[_0x38a3df['model']],'as':_0x38a3df['as'],'attributes':_0x38a3df['attributes'],'include':_0x38a3df[_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x38a3df[_0xc5c3('0x1d')],function(_0x29791c){return{'model':db[_0x29791c['model']],'as':_0x29791c['as'],'attributes':_0x29791c[_0xc5c3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2eacec){logger['info'](_0xc5c3('0x17'),_0x2ff158);logger[_0xc5c3('0x21')](_0xc5c3('0x17'),_0x2ff158,JSON[_0xc5c3('0x11')](_0x2eacec));_0x28bae6(_0x2eacec);})[_0xc5c3('0x22')](function(_0x2d07e1){logger[_0xc5c3('0x12')]('GetZohoAccount',_0x2d07e1[_0xc5c3('0x14')],_0x2ff158);_0x5e11d5(_0x13c867['error'](0x1f4,_0x2d07e1[_0xc5c3('0x14')]));});});};exports[_0xc5c3('0x23')]=function(_0x5b26e9){var _0x4daa8b=this;return new Promise(function(_0x2e648f,_0x46f149){return db[_0xc5c3('0x18')][_0xc5c3('0x24')]({'raw':_0x5b26e9['options']?_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x25')]===undefined?!![]:![]:!![],'where':_0x5b26e9[_0xc5c3('0x1a')]?_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x1b')]||null:null,'attributes':_0x5b26e9[_0xc5c3('0x1a')]?_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x20')]||null:null,'include':_0x5b26e9[_0xc5c3('0x1a')]?_0x5b26e9['options'][_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x1d')],function(_0x330391){return{'model':db[_0x330391[_0xc5c3('0x1f')]],'as':_0x330391['as'],'attributes':_0x330391[_0xc5c3('0x20')],'include':_0x330391['include']?_['map'](_0x330391[_0xc5c3('0x1d')],function(_0x55fccf){return{'model':db[_0x55fccf[_0xc5c3('0x1f')]],'as':_0x55fccf['as'],'attributes':_0x55fccf[_0xc5c3('0x20')],'include':_0x55fccf[_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x55fccf[_0xc5c3('0x1d')],function(_0x498677){return{'model':db[_0x498677[_0xc5c3('0x1f')]],'as':_0x498677['as'],'attributes':_0x498677[_0xc5c3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29f57d){logger[_0xc5c3('0x15')](_0xc5c3('0x23'),_0x5b26e9);logger[_0xc5c3('0x21')](_0xc5c3('0x23'),_0x5b26e9,JSON[_0xc5c3('0x11')](_0x29f57d));_0x2e648f(_0x29f57d);})[_0xc5c3('0x22')](function(_0x2ad440){logger[_0xc5c3('0x12')](_0xc5c3('0x23'),_0x2ad440['message'],_0x5b26e9);_0x46f149(_0x4daa8b[_0xc5c3('0x12')](0x1f4,_0x2ad440['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 391ae45..c270515 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 _0x3ee9=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','/:id','delete','destroy','multer','util'];(function(_0x39b68b,_0x4ad96d){var _0xae091f=function(_0x13b5e1){while(--_0x13b5e1){_0x39b68b['push'](_0x39b68b['shift']());}};_0xae091f(++_0x4ad96d);}(_0x3ee9,0xf0));var _0x93ee=function(_0x32dbcd,_0x463cd2){_0x32dbcd=_0x32dbcd-0x0;var _0x303818=_0x3ee9[_0x32dbcd];return _0x303818;};'use strict';var multer=require(_0x93ee('0x0'));var util=require(_0x93ee('0x1'));var path=require(_0x93ee('0x2'));var timeout=require(_0x93ee('0x3'));var express=require('express');var router=express[_0x93ee('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x93ee('0x5'));var interaction=require(_0x93ee('0x6'));var config=require(_0x93ee('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0x93ee('0x8')]('/',auth[_0x93ee('0x9')](),controller[_0x93ee('0xa')]);router['get']('/:id',auth[_0x93ee('0x9')](),controller[_0x93ee('0xb')]);router['get'](_0x93ee('0xc'),auth[_0x93ee('0x9')](),controller[_0x93ee('0xd')]);router[_0x93ee('0x8')](_0x93ee('0xe'),auth[_0x93ee('0x9')](),controller[_0x93ee('0xf')]);router[_0x93ee('0x8')](_0x93ee('0x10'),auth[_0x93ee('0x9')](),controller['getDescriptions']);router[_0x93ee('0x11')]('/',auth[_0x93ee('0x9')](),controller['create']);router[_0x93ee('0x12')](_0x93ee('0x13'),auth[_0x93ee('0x9')](),controller['update']);router[_0x93ee('0x14')](_0x93ee('0x13'),auth[_0x93ee('0x9')](),controller[_0x93ee('0x15')]);module['exports']=router; \ No newline at end of file +var _0x1788=['isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get'];(function(_0x54dadf,_0x19f0ef){var _0xeb2d64=function(_0x3449bb){while(--_0x3449bb){_0x54dadf['push'](_0x54dadf['shift']());}};_0xeb2d64(++_0x19f0ef);}(_0x1788,0x81));var _0x8178=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x1788[_0x346737];return _0x1ade2e;};'use strict';var multer=require('multer');var util=require(_0x8178('0x0'));var path=require(_0x8178('0x1'));var timeout=require(_0x8178('0x2'));var express=require(_0x8178('0x3'));var router=express[_0x8178('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8178('0x5'));var interaction=require(_0x8178('0x6'));var config=require('../../config/environment');var controller=require(_0x8178('0x7'));router[_0x8178('0x8')]('/',auth[_0x8178('0x9')](),controller[_0x8178('0xa')]);router[_0x8178('0x8')](_0x8178('0xb'),auth[_0x8178('0x9')](),controller[_0x8178('0xc')]);router['get'](_0x8178('0xd'),auth[_0x8178('0x9')](),controller[_0x8178('0xe')]);router[_0x8178('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x8178('0xf')]);router[_0x8178('0x8')](_0x8178('0x10'),auth['isAuthenticated'](),controller[_0x8178('0x11')]);router['post']('/',auth[_0x8178('0x9')](),controller[_0x8178('0x12')]);router[_0x8178('0x13')](_0x8178('0xb'),auth[_0x8178('0x9')](),controller[_0x8178('0x14')]);router[_0x8178('0x15')](_0x8178('0xb'),auth[_0x8178('0x9')](),controller['destroy']);module[_0x8178('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 6c3c25d..839455c 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 _0x93ac=['STRING','ENUM','contact','nothing','contact_lead','lead','sequelize','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x93ac,0x9e));var _0xc93a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x93ac[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc93a('0x0'));module[_0xc93a('0x1')]={'name':{'type':Sequelize[_0xc93a('0x2')]},'moduleCreate':{'type':Sequelize[_0xc93a('0x3')]('lead',_0xc93a('0x4'),_0xc93a('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM'](_0xc93a('0x6'),_0xc93a('0x4'),_0xc93a('0x7')),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9362=['contact_lead','sequelize','STRING','lead','contact','nothing'];(function(_0x1114dc,_0x50aed4){var _0x164894=function(_0x40ec33){while(--_0x40ec33){_0x1114dc['push'](_0x1114dc['shift']());}};_0x164894(++_0x50aed4);}(_0x9362,0x169));var _0x2936=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9362[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x2936('0x0'));module['exports']={'name':{'type':Sequelize[_0x2936('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x2936('0x2'),_0x2936('0x3'),_0x2936('0x4')),'defaultValue':_0x2936('0x2')},'moduleSearch':{'type':Sequelize['ENUM'](_0x2936('0x5'),'contact',_0x2936('0x2')),'defaultValue':_0x2936('0x5')},'description':{'type':Sequelize[_0x2936('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index a1538d2..6de6df7 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 _0x7969=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','ZohoConfiguration','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','filter','options','count','includeAll','findAll','rows','catch','params','rawAttributes','length','include','find','create','body','destroy','getFields','findOne','ZohoField','nolimit','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x7969,0xdf));var _0x9796=function(_0x47866c,_0x5e8256){_0x47866c=_0x47866c-0x0;var _0xfb804=_0x7969[_0x47866c];return _0xfb804;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9796('0x0'));var zipdir=require(_0x9796('0x1'));var jsonpatch=require(_0x9796('0x2'));var rp=require(_0x9796('0x3'));var moment=require(_0x9796('0x4'));var BPromise=require(_0x9796('0x5'));var Mustache=require(_0x9796('0x6'));var util=require('util');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(_0x9796('0x7'));var _=require(_0x9796('0x8'));var squel=require(_0x9796('0x9'));var crypto=require(_0x9796('0xa'));var jsforce=require(_0x9796('0xb'));var deskjs=require(_0x9796('0xc'));var toCsv=require(_0x9796('0xd'));var querystring=require(_0x9796('0xe'));var Papa=require('papaparse');var Redis=require(_0x9796('0xf'));var authService=require(_0x9796('0x10'));var qs=require(_0x9796('0x11'));var as=require(_0x9796('0x12'));var hardwareService=require(_0x9796('0x13'));var logger=require('../../config/logger')(_0x9796('0x14'));var utils=require(_0x9796('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb1c16c,_0x4bf3ae){_0x4bf3ae=_0x4bf3ae||0xcc;return function(_0x274736){if(_0x274736){return _0xb1c16c[_0x9796('0x16')](_0x4bf3ae);}return _0xb1c16c[_0x9796('0x17')](_0x4bf3ae)[_0x9796('0x18')]();};}function respondWithResult(_0x1191ed,_0x327613){_0x327613=_0x327613||0xc8;return function(_0x470cb8){if(_0x470cb8){return _0x1191ed[_0x9796('0x17')](_0x327613)[_0x9796('0x19')](_0x470cb8);}};}function respondWithFilteredResult(_0x5e12db,_0x368c90){return function(_0x17727d){if(_0x17727d){var _0x3247ee=typeof _0x368c90[_0x9796('0x1a')]===_0x9796('0x1b')&&typeof _0x368c90[_0x9796('0x1c')]==='undefined';var _0x55993a=_0x17727d['count'];var _0x59965e=_0x3247ee?0x0:_0x368c90[_0x9796('0x1a')];var _0x59f8a1=_0x3247ee?_0x17727d['count']:_0x368c90[_0x9796('0x1a')]+_0x368c90['limit'];var _0x2c6a93;if(_0x59f8a1>=_0x55993a){_0x59f8a1=_0x55993a;_0x2c6a93=0xc8;}else{_0x2c6a93=0xce;}_0x5e12db['status'](_0x2c6a93);return _0x5e12db[_0x9796('0x1d')](_0x9796('0x1e'),_0x59965e+'-'+_0x59f8a1+'/'+_0x55993a)[_0x9796('0x19')](_0x17727d);}return null;};}function patchUpdates(_0xea72ae){return function(_0x33edf4){try{jsonpatch[_0x9796('0x1f')](_0x33edf4,_0xea72ae,!![]);}catch(_0x2f51bd){return BPromise[_0x9796('0x20')](_0x2f51bd);}return _0x33edf4[_0x9796('0x21')]();};}function saveUpdates(_0x18401c,_0x18c405){return function(_0x3fabf7){if(_0x3fabf7){return _0x3fabf7[_0x9796('0x22')](_0x18401c)[_0x9796('0x23')](function(_0x309ccd){return _0x309ccd;});}return null;};}function removeEntity(_0x79b93d,_0x149d0d){return function(_0xb46849){if(_0xb46849){return _0xb46849['destroy']()[_0x9796('0x23')](function(){_0x79b93d['status'](0xcc)[_0x9796('0x18')]();});}};}function handleEntityNotFound(_0xd96eda,_0x2df4be){return function(_0x4b4ec4){if(!_0x4b4ec4){_0xd96eda[_0x9796('0x16')](0x194);}return _0x4b4ec4;};}function handleError(_0x1c495c,_0x22a565){_0x22a565=_0x22a565||0x1f4;return function(_0x22c9a3){logger[_0x9796('0x24')](_0x22c9a3[_0x9796('0x25')]);if(_0x22c9a3[_0x9796('0x26')]){delete _0x22c9a3[_0x9796('0x26')];}_0x1c495c[_0x9796('0x17')](_0x22a565)['send'](_0x22c9a3);};}exports[_0x9796('0x27')]=function(_0x85e735,_0x27754a){var _0x311d84={},_0x36025a={},_0x2529de={'count':0x0,'rows':[]};var _0x3b478d=_[_0x9796('0x28')](db[_0x9796('0x29')]['rawAttributes'],function(_0x65cabf){return{'name':_0x65cabf[_0x9796('0x2a')],'type':_0x65cabf[_0x9796('0x2b')][_0x9796('0x2c')]};});_0x36025a[_0x9796('0x2d')]=_[_0x9796('0x28')](_0x3b478d,'name');_0x36025a['query']=_[_0x9796('0x2e')](_0x85e735['query']);_0x36025a[_0x9796('0x2f')]=_[_0x9796('0x30')](_0x36025a[_0x9796('0x2d')],_0x36025a[_0x9796('0x31')]);_0x311d84['attributes']=_[_0x9796('0x30')](_0x36025a[_0x9796('0x2d')],qs['fields'](_0x85e735[_0x9796('0x31')][_0x9796('0x32')]));_0x311d84['attributes']=_0x311d84[_0x9796('0x33')]['length']?_0x311d84[_0x9796('0x33')]:_0x36025a[_0x9796('0x2d')];if(!_0x85e735[_0x9796('0x31')][_0x9796('0x34')]('nolimit')){_0x311d84[_0x9796('0x1c')]=qs['limit'](_0x85e735[_0x9796('0x31')][_0x9796('0x1c')]);_0x311d84['offset']=qs[_0x9796('0x1a')](_0x85e735[_0x9796('0x31')][_0x9796('0x1a')]);}_0x311d84[_0x9796('0x35')]=qs[_0x9796('0x36')](_0x85e735['query'][_0x9796('0x36')]);_0x311d84[_0x9796('0x37')]=qs[_0x9796('0x2f')](_[_0x9796('0x38')](_0x85e735[_0x9796('0x31')],_0x36025a['filters']),_0x3b478d);if(_0x85e735['query']['filter']){_0x311d84[_0x9796('0x37')]=_[_0x9796('0x39')](_0x311d84[_0x9796('0x37')],{'$or':_[_0x9796('0x28')](_0x3b478d,function(_0x1821ae){if(_0x1821ae[_0x9796('0x2b')]!=='VIRTUAL'){var _0x4a2c17={};_0x4a2c17[_0x1821ae[_0x9796('0x26')]]={'$like':'%'+_0x85e735[_0x9796('0x31')][_0x9796('0x3a')]+'%'};return _0x4a2c17;}})});}_0x311d84=_[_0x9796('0x39')]({},_0x311d84,_0x85e735[_0x9796('0x3b')]);var _0xdef80a={'where':_0x311d84[_0x9796('0x37')]};return db[_0x9796('0x29')]['count'](_0xdef80a)[_0x9796('0x23')](function(_0x57447e){_0x2529de[_0x9796('0x3c')]=_0x57447e;if(_0x85e735[_0x9796('0x31')][_0x9796('0x3d')]){_0x311d84['include']=[{'all':!![]}];}return db[_0x9796('0x29')][_0x9796('0x3e')](_0x311d84);})[_0x9796('0x23')](function(_0x21891b){_0x2529de[_0x9796('0x3f')]=_0x21891b;return _0x2529de;})[_0x9796('0x23')](respondWithFilteredResult(_0x27754a,_0x311d84))[_0x9796('0x40')](handleError(_0x27754a,null));};exports['show']=function(_0x26a4b4,_0x48b39f){var _0x1a9c6b={'raw':![],'where':{'id':_0x26a4b4[_0x9796('0x41')]['id']}},_0x5ba0fe={};_0x5ba0fe[_0x9796('0x2d')]=_['keys'](db[_0x9796('0x29')][_0x9796('0x42')]);_0x5ba0fe[_0x9796('0x31')]=_[_0x9796('0x2e')](_0x26a4b4[_0x9796('0x31')]);_0x5ba0fe['filters']=_[_0x9796('0x30')](_0x5ba0fe['model'],_0x5ba0fe[_0x9796('0x31')]);_0x1a9c6b[_0x9796('0x33')]=_['intersection'](_0x5ba0fe[_0x9796('0x2d')],qs['fields'](_0x26a4b4[_0x9796('0x31')]['fields']));_0x1a9c6b[_0x9796('0x33')]=_0x1a9c6b[_0x9796('0x33')][_0x9796('0x43')]?_0x1a9c6b['attributes']:_0x5ba0fe['model'];if(_0x26a4b4['query'][_0x9796('0x3d')]){_0x1a9c6b[_0x9796('0x44')]=[{'all':!![]}];}_0x1a9c6b=_['merge']({},_0x1a9c6b,_0x26a4b4['options']);return db['ZohoConfiguration'][_0x9796('0x45')](_0x1a9c6b)[_0x9796('0x23')](handleEntityNotFound(_0x48b39f,null))[_0x9796('0x23')](respondWithResult(_0x48b39f,null))[_0x9796('0x40')](handleError(_0x48b39f,null));};exports[_0x9796('0x46')]=function(_0x3c5302,_0x18395e){return db[_0x9796('0x29')][_0x9796('0x46')](_0x3c5302['body'],{})[_0x9796('0x23')](respondWithResult(_0x18395e,0xc9))['catch'](handleError(_0x18395e,null));};exports[_0x9796('0x22')]=function(_0x3f21f3,_0x2ea09d){if(_0x3f21f3[_0x9796('0x47')]['id']){delete _0x3f21f3[_0x9796('0x47')]['id'];}return db[_0x9796('0x29')][_0x9796('0x45')]({'where':{'id':_0x3f21f3[_0x9796('0x41')]['id']}})[_0x9796('0x23')](handleEntityNotFound(_0x2ea09d,null))['then'](saveUpdates(_0x3f21f3['body'],null))[_0x9796('0x23')](respondWithResult(_0x2ea09d,null))[_0x9796('0x40')](handleError(_0x2ea09d,null));};exports[_0x9796('0x48')]=function(_0x33743d,_0x24ee7e){return db['ZohoConfiguration']['find']({'where':{'id':_0x33743d['params']['id']}})[_0x9796('0x23')](handleEntityNotFound(_0x24ee7e,null))['then'](removeEntity(_0x24ee7e,null))['catch'](handleError(_0x24ee7e,null));};exports[_0x9796('0x49')]=function(_0x17be97,_0x58b143,_0x31a164){var _0x29e065={};var _0x405b42={};var _0xab9bc6;var _0x49a09e;return db[_0x9796('0x29')][_0x9796('0x4a')]({'where':{'id':_0x17be97[_0x9796('0x41')]['id']}})[_0x9796('0x23')](handleEntityNotFound(_0x58b143,null))['then'](function(_0x555afa){if(_0x555afa){_0xab9bc6=_0x555afa;_0x405b42[_0x9796('0x2d')]=_[_0x9796('0x2e')](db[_0x9796('0x4b')][_0x9796('0x42')]);_0x405b42[_0x9796('0x31')]=_[_0x9796('0x2e')](_0x17be97[_0x9796('0x31')]);_0x405b42[_0x9796('0x2f')]=_[_0x9796('0x30')](_0x405b42[_0x9796('0x2d')],_0x405b42[_0x9796('0x31')]);_0x29e065['attributes']=_[_0x9796('0x30')](_0x405b42[_0x9796('0x2d')],qs[_0x9796('0x32')](_0x17be97[_0x9796('0x31')][_0x9796('0x32')]));_0x29e065['attributes']=_0x29e065[_0x9796('0x33')][_0x9796('0x43')]?_0x29e065[_0x9796('0x33')]:_0x405b42[_0x9796('0x2d')];_0x29e065[_0x9796('0x35')]=qs[_0x9796('0x36')](_0x17be97['query'][_0x9796('0x36')]);_0x29e065[_0x9796('0x37')]=qs[_0x9796('0x2f')](_[_0x9796('0x38')](_0x17be97[_0x9796('0x31')],_0x405b42[_0x9796('0x2f')]));if(_0x17be97[_0x9796('0x31')][_0x9796('0x3a')]){_0x29e065[_0x9796('0x37')]=_[_0x9796('0x39')](_0x29e065[_0x9796('0x37')],{'$or':_[_0x9796('0x28')](_0x29e065['attributes'],function(_0x1e10db){var _0x464c74={};_0x464c74[_0x1e10db]={'$like':'%'+_0x17be97[_0x9796('0x31')][_0x9796('0x3a')]+'%'};return _0x464c74;})});}_0x29e065=_[_0x9796('0x39')]({},_0x29e065,_0x17be97['options']);return _0xab9bc6['getFields'](_0x29e065);}})[_0x9796('0x23')](function(_0x5c0764){if(_0x5c0764){_0x49a09e=_0x5c0764[_0x9796('0x43')];if(!_0x17be97['query']['hasOwnProperty'](_0x9796('0x4c'))){_0x29e065[_0x9796('0x1c')]=qs['limit'](_0x17be97[_0x9796('0x31')][_0x9796('0x1c')]);_0x29e065['offset']=qs[_0x9796('0x1a')](_0x17be97['query'][_0x9796('0x1a')]);}return _0xab9bc6[_0x9796('0x49')](_0x29e065);}})['then'](function(_0x166a6e){if(_0x166a6e){return _0x166a6e?{'count':_0x49a09e,'rows':_0x166a6e}:null;}})[_0x9796('0x23')](respondWithResult(_0x58b143,null))[_0x9796('0x40')](handleError(_0x58b143,null));};exports['getSubjects']=function(_0xdf61dc,_0x6ed0eb,_0x3c2375){var _0x131cbe={};var _0x12986d={};var _0x502780;var _0x9b8a7b;return db['ZohoConfiguration']['findOne']({'where':{'id':_0xdf61dc['params']['id']}})[_0x9796('0x23')](handleEntityNotFound(_0x6ed0eb,null))[_0x9796('0x23')](function(_0x5b99fc){if(_0x5b99fc){_0x502780=_0x5b99fc;_0x12986d['model']=_[_0x9796('0x2e')](db[_0x9796('0x4b')][_0x9796('0x42')]);_0x12986d[_0x9796('0x31')]=_[_0x9796('0x2e')](_0xdf61dc[_0x9796('0x31')]);_0x12986d[_0x9796('0x2f')]=_[_0x9796('0x30')](_0x12986d[_0x9796('0x2d')],_0x12986d['query']);_0x131cbe[_0x9796('0x33')]=_[_0x9796('0x30')](_0x12986d[_0x9796('0x2d')],qs['fields'](_0xdf61dc[_0x9796('0x31')][_0x9796('0x32')]));_0x131cbe[_0x9796('0x33')]=_0x131cbe[_0x9796('0x33')][_0x9796('0x43')]?_0x131cbe['attributes']:_0x12986d['model'];_0x131cbe[_0x9796('0x35')]=qs['sort'](_0xdf61dc[_0x9796('0x31')][_0x9796('0x36')]);_0x131cbe['where']=qs[_0x9796('0x2f')](_['pick'](_0xdf61dc[_0x9796('0x31')],_0x12986d['filters']));if(_0xdf61dc['query'][_0x9796('0x3a')]){_0x131cbe[_0x9796('0x37')]=_[_0x9796('0x39')](_0x131cbe[_0x9796('0x37')],{'$or':_[_0x9796('0x28')](_0x131cbe[_0x9796('0x33')],function(_0x47203f){var _0x250ade={};_0x250ade[_0x47203f]={'$like':'%'+_0xdf61dc[_0x9796('0x31')][_0x9796('0x3a')]+'%'};return _0x250ade;})});}_0x131cbe=_[_0x9796('0x39')]({},_0x131cbe,_0xdf61dc[_0x9796('0x3b')]);return _0x502780['getSubjects'](_0x131cbe);}})['then'](function(_0xb76457){if(_0xb76457){_0x9b8a7b=_0xb76457[_0x9796('0x43')];if(!_0xdf61dc[_0x9796('0x31')]['hasOwnProperty'](_0x9796('0x4c'))){_0x131cbe[_0x9796('0x1c')]=qs['limit'](_0xdf61dc[_0x9796('0x31')][_0x9796('0x1c')]);_0x131cbe[_0x9796('0x1a')]=qs['offset'](_0xdf61dc[_0x9796('0x31')][_0x9796('0x1a')]);}return _0x502780[_0x9796('0x4d')](_0x131cbe);}})['then'](function(_0x3a866b){if(_0x3a866b){return _0x3a866b?{'count':_0x9b8a7b,'rows':_0x3a866b}:null;}})[_0x9796('0x23')](respondWithResult(_0x6ed0eb,null))['catch'](handleError(_0x6ed0eb,null));};exports[_0x9796('0x4e')]=function(_0x11969a,_0x549587,_0x5262e4){var _0x571606={};var _0x10fdfb={};var _0x4e97d0;var _0x41b633;return db[_0x9796('0x29')]['findOne']({'where':{'id':_0x11969a[_0x9796('0x41')]['id']}})[_0x9796('0x23')](handleEntityNotFound(_0x549587,null))[_0x9796('0x23')](function(_0x2d1967){if(_0x2d1967){_0x4e97d0=_0x2d1967;_0x10fdfb[_0x9796('0x2d')]=_[_0x9796('0x2e')](db[_0x9796('0x4b')][_0x9796('0x42')]);_0x10fdfb[_0x9796('0x31')]=_[_0x9796('0x2e')](_0x11969a[_0x9796('0x31')]);_0x10fdfb['filters']=_[_0x9796('0x30')](_0x10fdfb[_0x9796('0x2d')],_0x10fdfb['query']);_0x571606[_0x9796('0x33')]=_['intersection'](_0x10fdfb[_0x9796('0x2d')],qs[_0x9796('0x32')](_0x11969a[_0x9796('0x31')][_0x9796('0x32')]));_0x571606['attributes']=_0x571606[_0x9796('0x33')][_0x9796('0x43')]?_0x571606['attributes']:_0x10fdfb[_0x9796('0x2d')];_0x571606[_0x9796('0x35')]=qs[_0x9796('0x36')](_0x11969a[_0x9796('0x31')][_0x9796('0x36')]);_0x571606[_0x9796('0x37')]=qs[_0x9796('0x2f')](_['pick'](_0x11969a[_0x9796('0x31')],_0x10fdfb[_0x9796('0x2f')]));if(_0x11969a['query'][_0x9796('0x3a')]){_0x571606[_0x9796('0x37')]=_[_0x9796('0x39')](_0x571606['where'],{'$or':_[_0x9796('0x28')](_0x571606[_0x9796('0x33')],function(_0x421d04){var _0x38db62={};_0x38db62[_0x421d04]={'$like':'%'+_0x11969a[_0x9796('0x31')][_0x9796('0x3a')]+'%'};return _0x38db62;})});}_0x571606=_[_0x9796('0x39')]({},_0x571606,_0x11969a[_0x9796('0x3b')]);return _0x4e97d0[_0x9796('0x4e')](_0x571606);}})['then'](function(_0x4b3ed0){if(_0x4b3ed0){_0x41b633=_0x4b3ed0[_0x9796('0x43')];if(!_0x11969a[_0x9796('0x31')][_0x9796('0x34')](_0x9796('0x4c'))){_0x571606[_0x9796('0x1c')]=qs[_0x9796('0x1c')](_0x11969a[_0x9796('0x31')][_0x9796('0x1c')]);_0x571606[_0x9796('0x1a')]=qs[_0x9796('0x1a')](_0x11969a[_0x9796('0x31')][_0x9796('0x1a')]);}return _0x4e97d0['getDescriptions'](_0x571606);}})[_0x9796('0x23')](function(_0x5e43a4){if(_0x5e43a4){return _0x5e43a4?{'count':_0x41b633,'rows':_0x5e43a4}:null;}})[_0x9796('0x23')](respondWithResult(_0x549587,null))[_0x9796('0x40')](handleError(_0x549587,null));}; \ No newline at end of file +var _0xdddb=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','apply','reject','update','destroy','then','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','filter','getFields','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xdddb,0xdc));var _0xbddd=function(_0x926fea,_0x2a564d){_0x926fea=_0x926fea-0x0;var _0x203245=_0xdddb[_0x926fea];return _0x203245;};'use strict';var emlformat=require(_0xbddd('0x0'));var rimraf=require(_0xbddd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbddd('0x2'));var rp=require('request-promise');var moment=require(_0xbddd('0x3'));var BPromise=require(_0xbddd('0x4'));var Mustache=require(_0xbddd('0x5'));var util=require(_0xbddd('0x6'));var path=require(_0xbddd('0x7'));var sox=require(_0xbddd('0x8'));var csv=require('to-csv');var ejs=require(_0xbddd('0x9'));var fs=require('fs');var fs_extra=require(_0xbddd('0xa'));var _=require('lodash');var squel=require(_0xbddd('0xb'));var crypto=require(_0xbddd('0xc'));var jsforce=require(_0xbddd('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbddd('0xe'));var querystring=require('querystring');var Papa=require(_0xbddd('0xf'));var Redis=require('ioredis');var authService=require(_0xbddd('0x10'));var qs=require(_0xbddd('0x11'));var as=require(_0xbddd('0x12'));var hardwareService=require(_0xbddd('0x13'));var logger=require(_0xbddd('0x14'))(_0xbddd('0x15'));var utils=require(_0xbddd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbddd('0x17'));var db=require(_0xbddd('0x18'))['db'];function respondWithStatusCode(_0x489d79,_0x5901a9){_0x5901a9=_0x5901a9||0xcc;return function(_0x1737b6){if(_0x1737b6){return _0x489d79[_0xbddd('0x19')](_0x5901a9);}return _0x489d79['status'](_0x5901a9)['end']();};}function respondWithResult(_0x5f0b88,_0x2ed075){_0x2ed075=_0x2ed075||0xc8;return function(_0x36735a){if(_0x36735a){return _0x5f0b88[_0xbddd('0x1a')](_0x2ed075)[_0xbddd('0x1b')](_0x36735a);}};}function respondWithFilteredResult(_0x563747,_0x4da616){return function(_0x34bbf0){if(_0x34bbf0){var _0x38e1b9=typeof _0x4da616[_0xbddd('0x1c')]===_0xbddd('0x1d')&&typeof _0x4da616['limit']==='undefined';var _0x205a9b=_0x34bbf0[_0xbddd('0x1e')];var _0x4de8ff=_0x38e1b9?0x0:_0x4da616[_0xbddd('0x1c')];var _0x436722=_0x38e1b9?_0x34bbf0[_0xbddd('0x1e')]:_0x4da616['offset']+_0x4da616['limit'];var _0x286198;if(_0x436722>=_0x205a9b){_0x436722=_0x205a9b;_0x286198=0xc8;}else{_0x286198=0xce;}_0x563747[_0xbddd('0x1a')](_0x286198);return _0x563747[_0xbddd('0x1f')]('Content-Range',_0x4de8ff+'-'+_0x436722+'/'+_0x205a9b)[_0xbddd('0x1b')](_0x34bbf0);}return null;};}function patchUpdates(_0x1fb9d4){return function(_0x220257){try{jsonpatch[_0xbddd('0x20')](_0x220257,_0x1fb9d4,!![]);}catch(_0x4e384c){return BPromise[_0xbddd('0x21')](_0x4e384c);}return _0x220257['save']();};}function saveUpdates(_0x4b7b14,_0x48e48f){return function(_0x75c12b){if(_0x75c12b){return _0x75c12b[_0xbddd('0x22')](_0x4b7b14)['then'](function(_0x55cb43){return _0x55cb43;});}return null;};}function removeEntity(_0xcf7735,_0x68fe78){return function(_0x5497ca){if(_0x5497ca){return _0x5497ca[_0xbddd('0x23')]()[_0xbddd('0x24')](function(){_0xcf7735[_0xbddd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47a7fc,_0xfb233f){return function(_0x2faa79){if(!_0x2faa79){_0x47a7fc[_0xbddd('0x19')](0x194);}return _0x2faa79;};}function handleError(_0x51b397,_0x3f46a4){_0x3f46a4=_0x3f46a4||0x1f4;return function(_0x50d6cf){logger[_0xbddd('0x25')](_0x50d6cf[_0xbddd('0x26')]);if(_0x50d6cf[_0xbddd('0x27')]){delete _0x50d6cf[_0xbddd('0x27')];}_0x51b397[_0xbddd('0x1a')](_0x3f46a4)[_0xbddd('0x28')](_0x50d6cf);};}exports[_0xbddd('0x29')]=function(_0x236117,_0x3729ed){var _0x1b215d={},_0x4ef95e={},_0x1d97b4={'count':0x0,'rows':[]};var _0x3e7204=_[_0xbddd('0x2a')](db[_0xbddd('0x2b')][_0xbddd('0x2c')],function(_0x3df758){return{'name':_0x3df758['fieldName'],'type':_0x3df758[_0xbddd('0x2d')][_0xbddd('0x2e')]};});_0x4ef95e[_0xbddd('0x2f')]=_['map'](_0x3e7204,_0xbddd('0x27'));_0x4ef95e[_0xbddd('0x30')]=_[_0xbddd('0x31')](_0x236117[_0xbddd('0x30')]);_0x4ef95e[_0xbddd('0x32')]=_[_0xbddd('0x33')](_0x4ef95e[_0xbddd('0x2f')],_0x4ef95e['query']);_0x1b215d[_0xbddd('0x34')]=_[_0xbddd('0x33')](_0x4ef95e['model'],qs['fields'](_0x236117[_0xbddd('0x30')][_0xbddd('0x35')]));_0x1b215d[_0xbddd('0x34')]=_0x1b215d[_0xbddd('0x34')][_0xbddd('0x36')]?_0x1b215d[_0xbddd('0x34')]:_0x4ef95e[_0xbddd('0x2f')];if(!_0x236117[_0xbddd('0x30')]['hasOwnProperty'](_0xbddd('0x37'))){_0x1b215d[_0xbddd('0x38')]=qs['limit'](_0x236117[_0xbddd('0x30')][_0xbddd('0x38')]);_0x1b215d[_0xbddd('0x1c')]=qs[_0xbddd('0x1c')](_0x236117[_0xbddd('0x30')][_0xbddd('0x1c')]);}_0x1b215d[_0xbddd('0x39')]=qs[_0xbddd('0x3a')](_0x236117[_0xbddd('0x30')][_0xbddd('0x3a')]);_0x1b215d[_0xbddd('0x3b')]=qs[_0xbddd('0x32')](_[_0xbddd('0x3c')](_0x236117[_0xbddd('0x30')],_0x4ef95e[_0xbddd('0x32')]),_0x3e7204);if(_0x236117[_0xbddd('0x30')]['filter']){_0x1b215d[_0xbddd('0x3b')]=_[_0xbddd('0x3d')](_0x1b215d[_0xbddd('0x3b')],{'$or':_[_0xbddd('0x2a')](_0x3e7204,function(_0x3e7592){if(_0x3e7592[_0xbddd('0x2d')]!==_0xbddd('0x3e')){var _0x15c049={};_0x15c049[_0x3e7592[_0xbddd('0x27')]]={'$like':'%'+_0x236117[_0xbddd('0x30')]['filter']+'%'};return _0x15c049;}})});}_0x1b215d=_[_0xbddd('0x3d')]({},_0x1b215d,_0x236117['options']);var _0x23572f={'where':_0x1b215d['where']};return db['ZohoConfiguration'][_0xbddd('0x1e')](_0x23572f)[_0xbddd('0x24')](function(_0xb5b45c){_0x1d97b4[_0xbddd('0x1e')]=_0xb5b45c;if(_0x236117[_0xbddd('0x30')][_0xbddd('0x3f')]){_0x1b215d[_0xbddd('0x40')]=[{'all':!![]}];}return db[_0xbddd('0x2b')][_0xbddd('0x41')](_0x1b215d);})['then'](function(_0x322daa){_0x1d97b4[_0xbddd('0x42')]=_0x322daa;return _0x1d97b4;})[_0xbddd('0x24')](respondWithFilteredResult(_0x3729ed,_0x1b215d))[_0xbddd('0x43')](handleError(_0x3729ed,null));};exports[_0xbddd('0x44')]=function(_0x8d833b,_0x2c37d4){var _0x4a71eb={'raw':![],'where':{'id':_0x8d833b[_0xbddd('0x45')]['id']}},_0x1a69c6={};_0x1a69c6[_0xbddd('0x2f')]=_[_0xbddd('0x31')](db['ZohoConfiguration']['rawAttributes']);_0x1a69c6[_0xbddd('0x30')]=_[_0xbddd('0x31')](_0x8d833b['query']);_0x1a69c6['filters']=_[_0xbddd('0x33')](_0x1a69c6[_0xbddd('0x2f')],_0x1a69c6[_0xbddd('0x30')]);_0x4a71eb['attributes']=_[_0xbddd('0x33')](_0x1a69c6[_0xbddd('0x2f')],qs[_0xbddd('0x35')](_0x8d833b['query'][_0xbddd('0x35')]));_0x4a71eb['attributes']=_0x4a71eb['attributes'][_0xbddd('0x36')]?_0x4a71eb[_0xbddd('0x34')]:_0x1a69c6['model'];if(_0x8d833b['query'][_0xbddd('0x3f')]){_0x4a71eb[_0xbddd('0x40')]=[{'all':!![]}];}_0x4a71eb=_[_0xbddd('0x3d')]({},_0x4a71eb,_0x8d833b[_0xbddd('0x46')]);return db[_0xbddd('0x2b')][_0xbddd('0x47')](_0x4a71eb)[_0xbddd('0x24')](handleEntityNotFound(_0x2c37d4,null))[_0xbddd('0x24')](respondWithResult(_0x2c37d4,null))[_0xbddd('0x43')](handleError(_0x2c37d4,null));};exports[_0xbddd('0x48')]=function(_0x298a6d,_0x445070){return db['ZohoConfiguration'][_0xbddd('0x48')](_0x298a6d['body'],{})[_0xbddd('0x24')](respondWithResult(_0x445070,0xc9))[_0xbddd('0x43')](handleError(_0x445070,null));};exports[_0xbddd('0x22')]=function(_0x2bb063,_0x2cbde3){if(_0x2bb063[_0xbddd('0x49')]['id']){delete _0x2bb063[_0xbddd('0x49')]['id'];}return db[_0xbddd('0x2b')]['find']({'where':{'id':_0x2bb063[_0xbddd('0x45')]['id']}})[_0xbddd('0x24')](handleEntityNotFound(_0x2cbde3,null))['then'](saveUpdates(_0x2bb063[_0xbddd('0x49')],null))['then'](respondWithResult(_0x2cbde3,null))[_0xbddd('0x43')](handleError(_0x2cbde3,null));};exports[_0xbddd('0x23')]=function(_0x3cea16,_0x45eecc){return db[_0xbddd('0x2b')][_0xbddd('0x47')]({'where':{'id':_0x3cea16[_0xbddd('0x45')]['id']}})[_0xbddd('0x24')](handleEntityNotFound(_0x45eecc,null))[_0xbddd('0x24')](removeEntity(_0x45eecc,null))[_0xbddd('0x43')](handleError(_0x45eecc,null));};exports['getFields']=function(_0x65d337,_0x4ca820,_0x24f3c4){var _0x594574={};var _0x2e152e={};var _0x5c5f18;var _0x57e747;return db[_0xbddd('0x2b')]['findOne']({'where':{'id':_0x65d337[_0xbddd('0x45')]['id']}})[_0xbddd('0x24')](handleEntityNotFound(_0x4ca820,null))[_0xbddd('0x24')](function(_0xf1c779){if(_0xf1c779){_0x5c5f18=_0xf1c779;_0x2e152e[_0xbddd('0x2f')]=_[_0xbddd('0x31')](db['ZohoField'][_0xbddd('0x2c')]);_0x2e152e['query']=_['keys'](_0x65d337[_0xbddd('0x30')]);_0x2e152e[_0xbddd('0x32')]=_[_0xbddd('0x33')](_0x2e152e['model'],_0x2e152e['query']);_0x594574[_0xbddd('0x34')]=_[_0xbddd('0x33')](_0x2e152e[_0xbddd('0x2f')],qs['fields'](_0x65d337['query']['fields']));_0x594574[_0xbddd('0x34')]=_0x594574[_0xbddd('0x34')]['length']?_0x594574[_0xbddd('0x34')]:_0x2e152e[_0xbddd('0x2f')];_0x594574[_0xbddd('0x39')]=qs[_0xbddd('0x3a')](_0x65d337[_0xbddd('0x30')][_0xbddd('0x3a')]);_0x594574[_0xbddd('0x3b')]=qs['filters'](_['pick'](_0x65d337['query'],_0x2e152e[_0xbddd('0x32')]));if(_0x65d337['query'][_0xbddd('0x4a')]){_0x594574[_0xbddd('0x3b')]=_[_0xbddd('0x3d')](_0x594574[_0xbddd('0x3b')],{'$or':_[_0xbddd('0x2a')](_0x594574[_0xbddd('0x34')],function(_0x30d378){var _0x7c0cee={};_0x7c0cee[_0x30d378]={'$like':'%'+_0x65d337['query'][_0xbddd('0x4a')]+'%'};return _0x7c0cee;})});}_0x594574=_[_0xbddd('0x3d')]({},_0x594574,_0x65d337['options']);return _0x5c5f18[_0xbddd('0x4b')](_0x594574);}})[_0xbddd('0x24')](function(_0x3ca115){if(_0x3ca115){_0x57e747=_0x3ca115[_0xbddd('0x36')];if(!_0x65d337[_0xbddd('0x30')][_0xbddd('0x4c')]('nolimit')){_0x594574[_0xbddd('0x38')]=qs[_0xbddd('0x38')](_0x65d337[_0xbddd('0x30')]['limit']);_0x594574['offset']=qs[_0xbddd('0x1c')](_0x65d337[_0xbddd('0x30')][_0xbddd('0x1c')]);}return _0x5c5f18[_0xbddd('0x4b')](_0x594574);}})[_0xbddd('0x24')](function(_0x258b48){if(_0x258b48){return _0x258b48?{'count':_0x57e747,'rows':_0x258b48}:null;}})[_0xbddd('0x24')](respondWithResult(_0x4ca820,null))[_0xbddd('0x43')](handleError(_0x4ca820,null));};exports[_0xbddd('0x4d')]=function(_0x22d084,_0xc519e1,_0x576bda){var _0x1305be={};var _0xfde360={};var _0x2049ce;var _0x579383;return db[_0xbddd('0x2b')][_0xbddd('0x4e')]({'where':{'id':_0x22d084['params']['id']}})[_0xbddd('0x24')](handleEntityNotFound(_0xc519e1,null))[_0xbddd('0x24')](function(_0x68d418){if(_0x68d418){_0x2049ce=_0x68d418;_0xfde360['model']=_[_0xbddd('0x31')](db['ZohoField']['rawAttributes']);_0xfde360[_0xbddd('0x30')]=_['keys'](_0x22d084[_0xbddd('0x30')]);_0xfde360[_0xbddd('0x32')]=_[_0xbddd('0x33')](_0xfde360[_0xbddd('0x2f')],_0xfde360[_0xbddd('0x30')]);_0x1305be['attributes']=_[_0xbddd('0x33')](_0xfde360[_0xbddd('0x2f')],qs['fields'](_0x22d084['query'][_0xbddd('0x35')]));_0x1305be[_0xbddd('0x34')]=_0x1305be['attributes']['length']?_0x1305be[_0xbddd('0x34')]:_0xfde360[_0xbddd('0x2f')];_0x1305be[_0xbddd('0x39')]=qs['sort'](_0x22d084['query']['sort']);_0x1305be[_0xbddd('0x3b')]=qs[_0xbddd('0x32')](_[_0xbddd('0x3c')](_0x22d084[_0xbddd('0x30')],_0xfde360[_0xbddd('0x32')]));if(_0x22d084[_0xbddd('0x30')][_0xbddd('0x4a')]){_0x1305be[_0xbddd('0x3b')]=_[_0xbddd('0x3d')](_0x1305be['where'],{'$or':_['map'](_0x1305be['attributes'],function(_0x2a62bc){var _0x28fd8b={};_0x28fd8b[_0x2a62bc]={'$like':'%'+_0x22d084[_0xbddd('0x30')][_0xbddd('0x4a')]+'%'};return _0x28fd8b;})});}_0x1305be=_[_0xbddd('0x3d')]({},_0x1305be,_0x22d084['options']);return _0x2049ce[_0xbddd('0x4d')](_0x1305be);}})['then'](function(_0x369137){if(_0x369137){_0x579383=_0x369137[_0xbddd('0x36')];if(!_0x22d084[_0xbddd('0x30')][_0xbddd('0x4c')](_0xbddd('0x37'))){_0x1305be[_0xbddd('0x38')]=qs[_0xbddd('0x38')](_0x22d084[_0xbddd('0x30')][_0xbddd('0x38')]);_0x1305be['offset']=qs[_0xbddd('0x1c')](_0x22d084[_0xbddd('0x30')][_0xbddd('0x1c')]);}return _0x2049ce[_0xbddd('0x4d')](_0x1305be);}})[_0xbddd('0x24')](function(_0x9539a3){if(_0x9539a3){return _0x9539a3?{'count':_0x579383,'rows':_0x9539a3}:null;}})[_0xbddd('0x24')](respondWithResult(_0xc519e1,null))['catch'](handleError(_0xc519e1,null));};exports[_0xbddd('0x4f')]=function(_0x311ae4,_0x20555a,_0x5c7a3b){var _0x79c580={};var _0x51843f={};var _0x264467;var _0x44966a;return db['ZohoConfiguration'][_0xbddd('0x4e')]({'where':{'id':_0x311ae4[_0xbddd('0x45')]['id']}})[_0xbddd('0x24')](handleEntityNotFound(_0x20555a,null))[_0xbddd('0x24')](function(_0x3f1c01){if(_0x3f1c01){_0x264467=_0x3f1c01;_0x51843f['model']=_[_0xbddd('0x31')](db['ZohoField'][_0xbddd('0x2c')]);_0x51843f[_0xbddd('0x30')]=_[_0xbddd('0x31')](_0x311ae4[_0xbddd('0x30')]);_0x51843f[_0xbddd('0x32')]=_[_0xbddd('0x33')](_0x51843f['model'],_0x51843f[_0xbddd('0x30')]);_0x79c580['attributes']=_['intersection'](_0x51843f[_0xbddd('0x2f')],qs['fields'](_0x311ae4[_0xbddd('0x30')]['fields']));_0x79c580['attributes']=_0x79c580[_0xbddd('0x34')]['length']?_0x79c580[_0xbddd('0x34')]:_0x51843f[_0xbddd('0x2f')];_0x79c580[_0xbddd('0x39')]=qs['sort'](_0x311ae4[_0xbddd('0x30')][_0xbddd('0x3a')]);_0x79c580['where']=qs[_0xbddd('0x32')](_[_0xbddd('0x3c')](_0x311ae4[_0xbddd('0x30')],_0x51843f[_0xbddd('0x32')]));if(_0x311ae4[_0xbddd('0x30')]['filter']){_0x79c580[_0xbddd('0x3b')]=_[_0xbddd('0x3d')](_0x79c580['where'],{'$or':_['map'](_0x79c580[_0xbddd('0x34')],function(_0xcac815){var _0x3b022b={};_0x3b022b[_0xcac815]={'$like':'%'+_0x311ae4[_0xbddd('0x30')][_0xbddd('0x4a')]+'%'};return _0x3b022b;})});}_0x79c580=_[_0xbddd('0x3d')]({},_0x79c580,_0x311ae4[_0xbddd('0x46')]);return _0x264467['getDescriptions'](_0x79c580);}})[_0xbddd('0x24')](function(_0xdcb63d){if(_0xdcb63d){_0x44966a=_0xdcb63d[_0xbddd('0x36')];if(!_0x311ae4['query'][_0xbddd('0x4c')]('nolimit')){_0x79c580['limit']=qs['limit'](_0x311ae4[_0xbddd('0x30')][_0xbddd('0x38')]);_0x79c580['offset']=qs[_0xbddd('0x1c')](_0x311ae4['query'][_0xbddd('0x1c')]);}return _0x264467[_0xbddd('0x4f')](_0x79c580);}})['then'](function(_0x42227a){if(_0x42227a){return _0x42227a?{'count':_0x44966a,'rows':_0x42227a}:null;}})[_0xbddd('0x24')](respondWithResult(_0x20555a,null))['catch'](handleError(_0x20555a,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index dd68c78..38bb742 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 _0x4f96=['./intZohoConfiguration.attributes','define','int_zoho_configurations','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0xc98354,_0x3bf67b){var _0x424479=function(_0x2604c7){while(--_0x2604c7){_0xc98354['push'](_0xc98354['shift']());}};_0x424479(++_0x3bf67b);}(_0x4f96,0x150));var _0x64f9=function(_0x4fb70e,_0x34f3cd){_0x4fb70e=_0x4fb70e-0x0;var _0x3ee8ed=_0x4f96[_0x4fb70e];return _0x3ee8ed;};'use strict';var _=require(_0x64f9('0x0'));var util=require('util');var logger=require(_0x64f9('0x1'))(_0x64f9('0x2'));var moment=require(_0x64f9('0x3'));var BPromise=require('bluebird');var rp=require(_0x64f9('0x4'));var fs=require('fs');var path=require(_0x64f9('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x64f9('0x6'));module['exports']=function(_0x4a4517,_0x4235bd){return _0x4a4517[_0x64f9('0x7')]('ZohoConfiguration',attributes,{'tableName':_0x64f9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x232b=['ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x562617,_0x13a5fa){var _0x3a29d6=function(_0x5e5d4f){while(--_0x5e5d4f){_0x562617['push'](_0x562617['shift']());}};_0x3a29d6(++_0x13a5fa);}(_0x232b,0xe6));var _0xb232=function(_0x572382,_0x1cffda){_0x572382=_0x572382-0x0;var _0x2a1ddf=_0x232b[_0x572382];return _0x2a1ddf;};'use strict';var _=require(_0xb232('0x0'));var util=require('util');var logger=require(_0xb232('0x1'))(_0xb232('0x2'));var moment=require(_0xb232('0x3'));var BPromise=require(_0xb232('0x4'));var rp=require(_0xb232('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb232('0x6'));var attributes=require(_0xb232('0x7'));module[_0xb232('0x8')]=function(_0x480b9e,_0x4e9ab7){return _0x480b9e[_0xb232('0x9')](_0xb232('0xa'),attributes,{'tableName':_0xb232('0xb'),'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 ec67b66..540480f 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 _0xc497=['../../config/environment','jayson/promise','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x50a641,_0x45318d){var _0x47a277=function(_0x153b55){while(--_0x153b55){_0x50a641['push'](_0x50a641['shift']());}};_0x47a277(++_0x45318d);}(_0xc497,0xd4));var _0x7c49=function(_0x404056,_0xc166ab){_0x404056=_0x404056-0x0;var _0x1ea7a3=_0xc497[_0x404056];return _0x1ea7a3;};'use strict';var _=require(_0x7c49('0x0'));var util=require(_0x7c49('0x1'));var moment=require(_0x7c49('0x2'));var BPromise=require('bluebird');var rs=require(_0x7c49('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c49('0x4'))['db'];var utils=require(_0x7c49('0x5'));var logger=require(_0x7c49('0x6'))(_0x7c49('0x7'));var config=require(_0x7c49('0x8'));var jayson=require(_0x7c49('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3154e1,_0x12e8b3,_0x4eb97f){return new BPromise(function(_0x1a66e1,_0x26e904){return client['request'](_0x3154e1,_0x4eb97f)[_0x7c49('0xa')](function(_0x4718e6){logger[_0x7c49('0xb')](_0x7c49('0xc'),_0x12e8b3,_0x7c49('0xd'));logger[_0x7c49('0xe')](_0x7c49('0xf'),_0x12e8b3,'request\x20sent',JSON[_0x7c49('0x10')](_0x4718e6));if(_0x4718e6[_0x7c49('0x11')]){if(_0x4718e6[_0x7c49('0x11')][_0x7c49('0x12')]===0x1f4){logger[_0x7c49('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x12e8b3,_0x4718e6[_0x7c49('0x11')][_0x7c49('0x13')]);return _0x26e904(_0x4718e6[_0x7c49('0x11')]['message']);}logger[_0x7c49('0x11')](_0x7c49('0xc'),_0x12e8b3,_0x4718e6[_0x7c49('0x11')][_0x7c49('0x13')]);return _0x1a66e1(_0x4718e6[_0x7c49('0x11')][_0x7c49('0x13')]);}else{logger[_0x7c49('0xb')](_0x7c49('0xc'),_0x12e8b3,_0x7c49('0xd'));_0x1a66e1(_0x4718e6[_0x7c49('0x14')]['message']);}})[_0x7c49('0x15')](function(_0x57628d){logger[_0x7c49('0x11')](_0x7c49('0xc'),_0x12e8b3,_0x57628d);_0x26e904(_0x57628d);});});} \ No newline at end of file +var _0x1412=['ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x1412,0x11b));var _0x2141=function(_0x4df549,_0x45ae17){_0x4df549=_0x4df549-0x0;var _0x153884=_0x1412[_0x4df549];return _0x153884;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2141('0x0'));var BPromise=require(_0x2141('0x1'));var rs=require(_0x2141('0x2'));var fs=require('fs');var Redis=require(_0x2141('0x3'));var db=require(_0x2141('0x4'))['db'];var utils=require(_0x2141('0x5'));var logger=require(_0x2141('0x6'))(_0x2141('0x7'));var config=require(_0x2141('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2141('0x9')][_0x2141('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc71537,_0x112161,_0x415b7c){return new BPromise(function(_0x1878d6,_0x5f370d){return client[_0x2141('0xb')](_0xc71537,_0x415b7c)[_0x2141('0xc')](function(_0x495d67){logger['info'](_0x2141('0xd'),_0x112161,_0x2141('0xe'));logger[_0x2141('0xf')](_0x2141('0x10'),_0x112161,_0x2141('0xe'),JSON[_0x2141('0x11')](_0x495d67));if(_0x495d67[_0x2141('0x12')]){if(_0x495d67['error'][_0x2141('0x13')]===0x1f4){logger[_0x2141('0x12')](_0x2141('0xd'),_0x112161,_0x495d67['error'][_0x2141('0x14')]);return _0x5f370d(_0x495d67[_0x2141('0x12')][_0x2141('0x14')]);}logger['error'](_0x2141('0xd'),_0x112161,_0x495d67[_0x2141('0x12')][_0x2141('0x14')]);return _0x1878d6(_0x495d67['error'][_0x2141('0x14')]);}else{logger['info'](_0x2141('0xd'),_0x112161,'request\x20sent');_0x1878d6(_0x495d67[_0x2141('0x15')][_0x2141('0x14')]);}})[_0x2141('0x16')](function(_0x3339b5){logger[_0x2141('0x12')](_0x2141('0xd'),_0x112161,_0x3339b5);_0x5f370d(_0x3339b5);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 1ea5c8e..02fccf4 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 _0x5390=['put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x1307c8,_0x3d0128){var _0x3cba97=function(_0x1ec0e3){while(--_0x1ec0e3){_0x1307c8['push'](_0x1307c8['shift']());}};_0x3cba97(++_0x3d0128);}(_0x5390,0xaf));var _0x0539=function(_0x2f6afb,_0x2643f5){_0x2f6afb=_0x2f6afb-0x0;var _0x37fba1=_0x5390[_0x2f6afb];return _0x37fba1;};'use strict';var multer=require(_0x0539('0x0'));var util=require(_0x0539('0x1'));var path=require(_0x0539('0x2'));var timeout=require('connect-timeout');var express=require(_0x0539('0x3'));var router=express[_0x0539('0x4')]();var fs_extra=require(_0x0539('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0539('0x6'));var config=require(_0x0539('0x7'));var controller=require(_0x0539('0x8'));router[_0x0539('0x9')]('/',auth[_0x0539('0xa')](),controller['index']);router[_0x0539('0x9')](_0x0539('0xb'),auth[_0x0539('0xa')](),controller[_0x0539('0xc')]);router[_0x0539('0xd')]('/',auth[_0x0539('0xa')](),controller[_0x0539('0xe')]);router[_0x0539('0xf')]('/:id',auth[_0x0539('0xa')](),controller[_0x0539('0x10')]);router[_0x0539('0x11')](_0x0539('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x0539('0x12')]=router; \ No newline at end of file +var _0x9e2d=['put','/:id','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','show','create'];(function(_0x51a5c8,_0x4ace6d){var _0x2805b4=function(_0x1254f3){while(--_0x1254f3){_0x51a5c8['push'](_0x51a5c8['shift']());}};_0x2805b4(++_0x4ace6d);}(_0x9e2d,0xc8));var _0xd9e2=function(_0x50db53,_0x3dba48){_0x50db53=_0x50db53-0x0;var _0x28a3c8=_0x9e2d[_0x50db53];return _0x28a3c8;};'use strict';var multer=require(_0xd9e2('0x0'));var util=require(_0xd9e2('0x1'));var path=require(_0xd9e2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd9e2('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd9e2('0x4'));var config=require('../../config/environment');var controller=require(_0xd9e2('0x5'));router[_0xd9e2('0x6')]('/',auth[_0xd9e2('0x7')](),controller['index']);router[_0xd9e2('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xd9e2('0x8')]);router['post']('/',auth[_0xd9e2('0x7')](),controller[_0xd9e2('0x9')]);router[_0xd9e2('0xa')](_0xd9e2('0xb'),auth[_0xd9e2('0x7')](),controller['update']);router[_0xd9e2('0xc')]('/:id',auth[_0xd9e2('0x7')](),controller[_0xd9e2('0xd')]);module[_0xd9e2('0xe')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 519fd27..cb82569 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 _0x9bfa=['BOOLEAN','sequelize','exports','ENUM','variable','picklist','string','STRING'];(function(_0x4f6213,_0x2f8a0b){var _0x37659d=function(_0x48a88a){while(--_0x48a88a){_0x4f6213['push'](_0x4f6213['shift']());}};_0x37659d(++_0x2f8a0b);}(_0x9bfa,0x101));var _0xa9bf=function(_0x34c008,_0x335846){_0x34c008=_0x34c008-0x0;var _0x256ac0=_0x9bfa[_0x34c008];return _0x256ac0;};'use strict';var Sequelize=require(_0xa9bf('0x0'));module[_0xa9bf('0x1')]={'type':{'type':Sequelize[_0xa9bf('0x2')]('string',_0xa9bf('0x3'),'customVariable','keyValue',_0xa9bf('0x4')),'defaultValue':_0xa9bf('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa9bf('0x6')]},'keyType':{'type':Sequelize[_0xa9bf('0x2')](_0xa9bf('0x5'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xa9bf('0x6')]},'idField':{'type':Sequelize[_0xa9bf('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa9bf('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa9bf('0x6')]}}; \ No newline at end of file +var _0x18e4=['string','variable','customVariable','picklist','STRING','sequelize','exports','ENUM'];(function(_0x3160bf,_0x13f9c3){var _0x1b1664=function(_0x1c58f8){while(--_0x1c58f8){_0x3160bf['push'](_0x3160bf['shift']());}};_0x1b1664(++_0x13f9c3);}(_0x18e4,0x6d));var _0x418e=function(_0x1bb80c,_0x26d406){_0x1bb80c=_0x1bb80c-0x0;var _0x368f16=_0x18e4[_0x1bb80c];return _0x368f16;};'use strict';var Sequelize=require(_0x418e('0x0'));module[_0x418e('0x1')]={'type':{'type':Sequelize[_0x418e('0x2')](_0x418e('0x3'),_0x418e('0x4'),_0x418e('0x5'),'keyValue',_0x418e('0x6')),'defaultValue':_0x418e('0x3')},'content':{'type':Sequelize[_0x418e('0x7')]},'key':{'type':Sequelize[_0x418e('0x7')]},'keyType':{'type':Sequelize[_0x418e('0x2')](_0x418e('0x3'),'variable',_0x418e('0x5'))},'keyContent':{'type':Sequelize[_0x418e('0x7')]},'idField':{'type':Sequelize[_0x418e('0x7')]},'nameField':{'type':Sequelize[_0x418e('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x418e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 583cd6a..5ec1a89 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 _0x3ec3=['nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','count','then','includeAll','findAll','rows','catch','show','options','find','create','body','update','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','querystring','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','Content-Range','json','apply','reject','destroy','stack','name','send','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x509e19,_0x424afb){var _0x4de49a=function(_0x5d6adc){while(--_0x5d6adc){_0x509e19['push'](_0x509e19['shift']());}};_0x4de49a(++_0x424afb);}(_0x3ec3,0x1d2));var _0x33ec=function(_0x573a27,_0x26d295){_0x573a27=_0x573a27-0x0;var _0x49f7c0=_0x3ec3[_0x573a27];return _0x49f7c0;};'use strict';var emlformat=require(_0x33ec('0x0'));var rimraf=require(_0x33ec('0x1'));var zipdir=require(_0x33ec('0x2'));var jsonpatch=require(_0x33ec('0x3'));var rp=require(_0x33ec('0x4'));var moment=require(_0x33ec('0x5'));var BPromise=require(_0x33ec('0x6'));var Mustache=require(_0x33ec('0x7'));var util=require(_0x33ec('0x8'));var path=require(_0x33ec('0x9'));var sox=require(_0x33ec('0xa'));var csv=require(_0x33ec('0xb'));var ejs=require(_0x33ec('0xc'));var fs=require('fs');var fs_extra=require(_0x33ec('0xd'));var _=require(_0x33ec('0xe'));var squel=require(_0x33ec('0xf'));var crypto=require(_0x33ec('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x33ec('0xb'));var querystring=require(_0x33ec('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x33ec('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x33ec('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x33ec('0x14'));var utils=require(_0x33ec('0x15'));var config=require(_0x33ec('0x16'));var licenseUtil=require(_0x33ec('0x17'));var db=require(_0x33ec('0x18'))['db'];function respondWithStatusCode(_0x48dfc2,_0x37dd87){_0x37dd87=_0x37dd87||0xcc;return function(_0x184482){if(_0x184482){return _0x48dfc2[_0x33ec('0x19')](_0x37dd87);}return _0x48dfc2[_0x33ec('0x1a')](_0x37dd87)[_0x33ec('0x1b')]();};}function respondWithResult(_0x1d475c,_0x3d5554){_0x3d5554=_0x3d5554||0xc8;return function(_0x2b238b){if(_0x2b238b){return _0x1d475c[_0x33ec('0x1a')](_0x3d5554)['json'](_0x2b238b);}};}function respondWithFilteredResult(_0x46e258,_0x1a08ae){return function(_0x30c89f){if(_0x30c89f){var _0x5d8ede=typeof _0x1a08ae[_0x33ec('0x1c')]===_0x33ec('0x1d')&&typeof _0x1a08ae['limit']===_0x33ec('0x1d');var _0x14c5b3=_0x30c89f['count'];var _0x4b7b46=_0x5d8ede?0x0:_0x1a08ae[_0x33ec('0x1c')];var _0x5124c7=_0x5d8ede?_0x30c89f['count']:_0x1a08ae['offset']+_0x1a08ae['limit'];var _0x304b17;if(_0x5124c7>=_0x14c5b3){_0x5124c7=_0x14c5b3;_0x304b17=0xc8;}else{_0x304b17=0xce;}_0x46e258[_0x33ec('0x1a')](_0x304b17);return _0x46e258['set'](_0x33ec('0x1e'),_0x4b7b46+'-'+_0x5124c7+'/'+_0x14c5b3)[_0x33ec('0x1f')](_0x30c89f);}return null;};}function patchUpdates(_0x122a97){return function(_0xcdf3c8){try{jsonpatch[_0x33ec('0x20')](_0xcdf3c8,_0x122a97,!![]);}catch(_0x13cf2f){return BPromise[_0x33ec('0x21')](_0x13cf2f);}return _0xcdf3c8['save']();};}function saveUpdates(_0x59fcd7,_0x400007){return function(_0x1763a9){if(_0x1763a9){return _0x1763a9['update'](_0x59fcd7)['then'](function(_0x13c7d7){return _0x13c7d7;});}return null;};}function removeEntity(_0x2bc085,_0x382f2a){return function(_0x5c44f4){if(_0x5c44f4){return _0x5c44f4[_0x33ec('0x22')]()['then'](function(){_0x2bc085['status'](0xcc)[_0x33ec('0x1b')]();});}};}function handleEntityNotFound(_0x548156,_0x5017e1){return function(_0x11529f){if(!_0x11529f){_0x548156['sendStatus'](0x194);}return _0x11529f;};}function handleError(_0x1a1ff7,_0x464957){_0x464957=_0x464957||0x1f4;return function(_0x5d79e3){logger['error'](_0x5d79e3[_0x33ec('0x23')]);if(_0x5d79e3[_0x33ec('0x24')]){delete _0x5d79e3[_0x33ec('0x24')];}_0x1a1ff7[_0x33ec('0x1a')](_0x464957)[_0x33ec('0x25')](_0x5d79e3);};}exports['index']=function(_0x1d1f9,_0x262ba3){var _0x52860c={},_0xd9c333={},_0x4acfeb={'count':0x0,'rows':[]};var _0xd76941=_[_0x33ec('0x26')](db[_0x33ec('0x27')][_0x33ec('0x28')],function(_0x1d5c8d){return{'name':_0x1d5c8d[_0x33ec('0x29')],'type':_0x1d5c8d[_0x33ec('0x2a')][_0x33ec('0x2b')]};});_0xd9c333[_0x33ec('0x2c')]=_[_0x33ec('0x26')](_0xd76941,_0x33ec('0x24'));_0xd9c333[_0x33ec('0x2d')]=_[_0x33ec('0x2e')](_0x1d1f9[_0x33ec('0x2d')]);_0xd9c333['filters']=_[_0x33ec('0x2f')](_0xd9c333['model'],_0xd9c333[_0x33ec('0x2d')]);_0x52860c['attributes']=_[_0x33ec('0x2f')](_0xd9c333['model'],qs[_0x33ec('0x30')](_0x1d1f9['query'][_0x33ec('0x30')]));_0x52860c['attributes']=_0x52860c[_0x33ec('0x31')][_0x33ec('0x32')]?_0x52860c[_0x33ec('0x31')]:_0xd9c333['model'];if(!_0x1d1f9[_0x33ec('0x2d')][_0x33ec('0x33')](_0x33ec('0x34'))){_0x52860c[_0x33ec('0x35')]=qs[_0x33ec('0x35')](_0x1d1f9[_0x33ec('0x2d')][_0x33ec('0x35')]);_0x52860c[_0x33ec('0x1c')]=qs[_0x33ec('0x1c')](_0x1d1f9[_0x33ec('0x2d')][_0x33ec('0x1c')]);}_0x52860c['order']=qs['sort'](_0x1d1f9[_0x33ec('0x2d')][_0x33ec('0x36')]);_0x52860c[_0x33ec('0x37')]=qs[_0x33ec('0x38')](_[_0x33ec('0x39')](_0x1d1f9[_0x33ec('0x2d')],_0xd9c333[_0x33ec('0x38')]),_0xd76941);if(_0x1d1f9[_0x33ec('0x2d')][_0x33ec('0x3a')]){_0x52860c[_0x33ec('0x37')]=_[_0x33ec('0x3b')](_0x52860c[_0x33ec('0x37')],{'$or':_[_0x33ec('0x26')](_0xd76941,function(_0x4d44a8){if(_0x4d44a8[_0x33ec('0x2a')]!==_0x33ec('0x3c')){var _0x1def53={};_0x1def53[_0x4d44a8[_0x33ec('0x24')]]={'$like':'%'+_0x1d1f9[_0x33ec('0x2d')]['filter']+'%'};return _0x1def53;}})});}_0x52860c=_[_0x33ec('0x3b')]({},_0x52860c,_0x1d1f9['options']);var _0x1e9b05={'where':_0x52860c[_0x33ec('0x37')]};return db['ZohoField'][_0x33ec('0x3d')](_0x1e9b05)[_0x33ec('0x3e')](function(_0xe24e09){_0x4acfeb['count']=_0xe24e09;if(_0x1d1f9['query'][_0x33ec('0x3f')]){_0x52860c['include']=[{'all':!![]}];}return db[_0x33ec('0x27')][_0x33ec('0x40')](_0x52860c);})['then'](function(_0x34ff49){_0x4acfeb[_0x33ec('0x41')]=_0x34ff49;return _0x4acfeb;})['then'](respondWithFilteredResult(_0x262ba3,_0x52860c))[_0x33ec('0x42')](handleError(_0x262ba3,null));};exports[_0x33ec('0x43')]=function(_0x47f1ec,_0x14228d){var _0x59bd44={'raw':!![],'where':{'id':_0x47f1ec['params']['id']}},_0x58717d={};_0x58717d[_0x33ec('0x2c')]=_['keys'](db[_0x33ec('0x27')][_0x33ec('0x28')]);_0x58717d[_0x33ec('0x2d')]=_['keys'](_0x47f1ec['query']);_0x58717d[_0x33ec('0x38')]=_['intersection'](_0x58717d[_0x33ec('0x2c')],_0x58717d[_0x33ec('0x2d')]);_0x59bd44['attributes']=_[_0x33ec('0x2f')](_0x58717d[_0x33ec('0x2c')],qs['fields'](_0x47f1ec['query'][_0x33ec('0x30')]));_0x59bd44[_0x33ec('0x31')]=_0x59bd44['attributes']['length']?_0x59bd44[_0x33ec('0x31')]:_0x58717d[_0x33ec('0x2c')];if(_0x47f1ec[_0x33ec('0x2d')][_0x33ec('0x3f')]){_0x59bd44['include']=[{'all':!![]}];}_0x59bd44=_[_0x33ec('0x3b')]({},_0x59bd44,_0x47f1ec[_0x33ec('0x44')]);return db['ZohoField'][_0x33ec('0x45')](_0x59bd44)[_0x33ec('0x3e')](handleEntityNotFound(_0x14228d,null))[_0x33ec('0x3e')](respondWithResult(_0x14228d,null))[_0x33ec('0x42')](handleError(_0x14228d,null));};exports[_0x33ec('0x46')]=function(_0x49c76b,_0x428438){return db[_0x33ec('0x27')][_0x33ec('0x46')](_0x49c76b[_0x33ec('0x47')],{})['then'](respondWithResult(_0x428438,0xc9))[_0x33ec('0x42')](handleError(_0x428438,null));};exports[_0x33ec('0x48')]=function(_0x15a6d6,_0x4266e3){if(_0x15a6d6[_0x33ec('0x47')]['id']){delete _0x15a6d6[_0x33ec('0x47')]['id'];}return db[_0x33ec('0x27')][_0x33ec('0x45')]({'where':{'id':_0x15a6d6[_0x33ec('0x49')]['id']}})[_0x33ec('0x3e')](handleEntityNotFound(_0x4266e3,null))['then'](saveUpdates(_0x15a6d6['body'],null))[_0x33ec('0x3e')](respondWithResult(_0x4266e3,null))[_0x33ec('0x42')](handleError(_0x4266e3,null));};exports[_0x33ec('0x22')]=function(_0x350df4,_0x19c0f5){return db['ZohoField'][_0x33ec('0x45')]({'where':{'id':_0x350df4[_0x33ec('0x49')]['id']}})[_0x33ec('0x3e')](handleEntityNotFound(_0x19c0f5,null))[_0x33ec('0x3e')](removeEntity(_0x19c0f5,null))[_0x33ec('0x42')](handleError(_0x19c0f5,null));}; \ No newline at end of file +var _0x6612=['keys','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','error','name','send','index','map','ZohoField','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','VIRTUAL','merge','options','where','includeAll','include','findAll','rows','catch','show','params'];(function(_0x4fb308,_0x5c2fd7){var _0x2e7a23=function(_0x32e795){while(--_0x32e795){_0x4fb308['push'](_0x4fb308['shift']());}};_0x2e7a23(++_0x5c2fd7);}(_0x6612,0xcd));var _0x2661=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x6612[_0x481bf7];return _0x461787;};'use strict';var emlformat=require(_0x2661('0x0'));var rimraf=require(_0x2661('0x1'));var zipdir=require(_0x2661('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2661('0x3'));var moment=require(_0x2661('0x4'));var BPromise=require(_0x2661('0x5'));var Mustache=require(_0x2661('0x6'));var util=require('util');var path=require('path');var sox=require(_0x2661('0x7'));var csv=require(_0x2661('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2661('0x9'));var squel=require(_0x2661('0xa'));var crypto=require(_0x2661('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2661('0x8'));var querystring=require('querystring');var Papa=require(_0x2661('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2661('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2661('0xe'));var logger=require(_0x2661('0xf'))('api');var utils=require(_0x2661('0x10'));var config=require(_0x2661('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x426ff0,_0x116868){_0x116868=_0x116868||0xcc;return function(_0x3a39fd){if(_0x3a39fd){return _0x426ff0[_0x2661('0x12')](_0x116868);}return _0x426ff0[_0x2661('0x13')](_0x116868)[_0x2661('0x14')]();};}function respondWithResult(_0x3d07a4,_0x409340){_0x409340=_0x409340||0xc8;return function(_0x1d2422){if(_0x1d2422){return _0x3d07a4['status'](_0x409340)['json'](_0x1d2422);}};}function respondWithFilteredResult(_0x46ceff,_0x56f4ab){return function(_0x5dbd4a){if(_0x5dbd4a){var _0x381056=typeof _0x56f4ab[_0x2661('0x15')]===_0x2661('0x16')&&typeof _0x56f4ab[_0x2661('0x17')]===_0x2661('0x16');var _0xe80cac=_0x5dbd4a[_0x2661('0x18')];var _0x1198c1=_0x381056?0x0:_0x56f4ab[_0x2661('0x15')];var _0x39b6c4=_0x381056?_0x5dbd4a[_0x2661('0x18')]:_0x56f4ab[_0x2661('0x15')]+_0x56f4ab[_0x2661('0x17')];var _0x3517e3;if(_0x39b6c4>=_0xe80cac){_0x39b6c4=_0xe80cac;_0x3517e3=0xc8;}else{_0x3517e3=0xce;}_0x46ceff['status'](_0x3517e3);return _0x46ceff[_0x2661('0x19')](_0x2661('0x1a'),_0x1198c1+'-'+_0x39b6c4+'/'+_0xe80cac)[_0x2661('0x1b')](_0x5dbd4a);}return null;};}function patchUpdates(_0x3bbe51){return function(_0x2621e1){try{jsonpatch[_0x2661('0x1c')](_0x2621e1,_0x3bbe51,!![]);}catch(_0x108ecc){return BPromise['reject'](_0x108ecc);}return _0x2621e1[_0x2661('0x1d')]();};}function saveUpdates(_0x42d4a2,_0x6cb014){return function(_0x577e81){if(_0x577e81){return _0x577e81['update'](_0x42d4a2)[_0x2661('0x1e')](function(_0x30b8c7){return _0x30b8c7;});}return null;};}function removeEntity(_0x982cee,_0x16eab7){return function(_0x459e90){if(_0x459e90){return _0x459e90[_0x2661('0x1f')]()[_0x2661('0x1e')](function(){_0x982cee['status'](0xcc)[_0x2661('0x14')]();});}};}function handleEntityNotFound(_0x49255a,_0x4deb41){return function(_0x5a6885){if(!_0x5a6885){_0x49255a[_0x2661('0x12')](0x194);}return _0x5a6885;};}function handleError(_0x587cba,_0x4a78f4){_0x4a78f4=_0x4a78f4||0x1f4;return function(_0x512a46){logger[_0x2661('0x20')](_0x512a46['stack']);if(_0x512a46[_0x2661('0x21')]){delete _0x512a46[_0x2661('0x21')];}_0x587cba[_0x2661('0x13')](_0x4a78f4)[_0x2661('0x22')](_0x512a46);};}exports[_0x2661('0x23')]=function(_0x27a103,_0x31df4d){var _0x1c512c={},_0x1914ec={},_0xea03c={'count':0x0,'rows':[]};var _0x5c0d1b=_[_0x2661('0x24')](db[_0x2661('0x25')]['rawAttributes'],function(_0x929ad9){return{'name':_0x929ad9[_0x2661('0x26')],'type':_0x929ad9[_0x2661('0x27')][_0x2661('0x28')]};});_0x1914ec[_0x2661('0x29')]=_['map'](_0x5c0d1b,_0x2661('0x21'));_0x1914ec['query']=_['keys'](_0x27a103[_0x2661('0x2a')]);_0x1914ec[_0x2661('0x2b')]=_[_0x2661('0x2c')](_0x1914ec[_0x2661('0x29')],_0x1914ec[_0x2661('0x2a')]);_0x1c512c['attributes']=_[_0x2661('0x2c')](_0x1914ec[_0x2661('0x29')],qs[_0x2661('0x2d')](_0x27a103[_0x2661('0x2a')][_0x2661('0x2d')]));_0x1c512c[_0x2661('0x2e')]=_0x1c512c[_0x2661('0x2e')][_0x2661('0x2f')]?_0x1c512c['attributes']:_0x1914ec[_0x2661('0x29')];if(!_0x27a103[_0x2661('0x2a')][_0x2661('0x30')]('nolimit')){_0x1c512c['limit']=qs['limit'](_0x27a103[_0x2661('0x2a')][_0x2661('0x17')]);_0x1c512c['offset']=qs['offset'](_0x27a103[_0x2661('0x2a')]['offset']);}_0x1c512c['order']=qs[_0x2661('0x31')](_0x27a103['query'][_0x2661('0x31')]);_0x1c512c['where']=qs[_0x2661('0x2b')](_[_0x2661('0x32')](_0x27a103['query'],_0x1914ec[_0x2661('0x2b')]),_0x5c0d1b);if(_0x27a103[_0x2661('0x2a')][_0x2661('0x33')]){_0x1c512c['where']=_['merge'](_0x1c512c['where'],{'$or':_[_0x2661('0x24')](_0x5c0d1b,function(_0x4dc8ca){if(_0x4dc8ca[_0x2661('0x27')]!==_0x2661('0x34')){var _0x596c99={};_0x596c99[_0x4dc8ca[_0x2661('0x21')]]={'$like':'%'+_0x27a103[_0x2661('0x2a')]['filter']+'%'};return _0x596c99;}})});}_0x1c512c=_[_0x2661('0x35')]({},_0x1c512c,_0x27a103[_0x2661('0x36')]);var _0x415c68={'where':_0x1c512c[_0x2661('0x37')]};return db[_0x2661('0x25')]['count'](_0x415c68)[_0x2661('0x1e')](function(_0x363ca1){_0xea03c[_0x2661('0x18')]=_0x363ca1;if(_0x27a103[_0x2661('0x2a')][_0x2661('0x38')]){_0x1c512c[_0x2661('0x39')]=[{'all':!![]}];}return db[_0x2661('0x25')][_0x2661('0x3a')](_0x1c512c);})['then'](function(_0x1d007a){_0xea03c[_0x2661('0x3b')]=_0x1d007a;return _0xea03c;})[_0x2661('0x1e')](respondWithFilteredResult(_0x31df4d,_0x1c512c))[_0x2661('0x3c')](handleError(_0x31df4d,null));};exports[_0x2661('0x3d')]=function(_0x40706e,_0x37ca91){var _0xb14ea={'raw':!![],'where':{'id':_0x40706e[_0x2661('0x3e')]['id']}},_0x3c1369={};_0x3c1369[_0x2661('0x29')]=_[_0x2661('0x3f')](db[_0x2661('0x25')]['rawAttributes']);_0x3c1369[_0x2661('0x2a')]=_[_0x2661('0x3f')](_0x40706e['query']);_0x3c1369[_0x2661('0x2b')]=_['intersection'](_0x3c1369[_0x2661('0x29')],_0x3c1369[_0x2661('0x2a')]);_0xb14ea['attributes']=_['intersection'](_0x3c1369[_0x2661('0x29')],qs['fields'](_0x40706e[_0x2661('0x2a')][_0x2661('0x2d')]));_0xb14ea['attributes']=_0xb14ea[_0x2661('0x2e')][_0x2661('0x2f')]?_0xb14ea['attributes']:_0x3c1369[_0x2661('0x29')];if(_0x40706e[_0x2661('0x2a')][_0x2661('0x38')]){_0xb14ea[_0x2661('0x39')]=[{'all':!![]}];}_0xb14ea=_[_0x2661('0x35')]({},_0xb14ea,_0x40706e[_0x2661('0x36')]);return db[_0x2661('0x25')][_0x2661('0x40')](_0xb14ea)['then'](handleEntityNotFound(_0x37ca91,null))[_0x2661('0x1e')](respondWithResult(_0x37ca91,null))[_0x2661('0x3c')](handleError(_0x37ca91,null));};exports[_0x2661('0x41')]=function(_0x479837,_0x376714){return db[_0x2661('0x25')][_0x2661('0x41')](_0x479837['body'],{})[_0x2661('0x1e')](respondWithResult(_0x376714,0xc9))[_0x2661('0x3c')](handleError(_0x376714,null));};exports['update']=function(_0x46ac20,_0x5e990a){if(_0x46ac20[_0x2661('0x42')]['id']){delete _0x46ac20[_0x2661('0x42')]['id'];}return db[_0x2661('0x25')]['find']({'where':{'id':_0x46ac20[_0x2661('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5e990a,null))[_0x2661('0x1e')](saveUpdates(_0x46ac20['body'],null))[_0x2661('0x1e')](respondWithResult(_0x5e990a,null))[_0x2661('0x3c')](handleError(_0x5e990a,null));};exports[_0x2661('0x1f')]=function(_0x26e001,_0x4c81ca){return db[_0x2661('0x25')]['find']({'where':{'id':_0x26e001[_0x2661('0x3e')]['id']}})[_0x2661('0x1e')](handleEntityNotFound(_0x4c81ca,null))[_0x2661('0x1e')](removeEntity(_0x4c81ca,null))[_0x2661('0x3c')](handleError(_0x4c81ca,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index f2a0bac..5fc6a4c 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 _0x781d=['rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash','util','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x781d,0x14a));var _0xd781=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x781d[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd781('0x2'));var BPromise=require(_0xd781('0x3'));var rp=require(_0xd781('0x4'));var fs=require('fs');var path=require(_0xd781('0x5'));var rimraf=require(_0xd781('0x6'));var config=require(_0xd781('0x7'));var attributes=require(_0xd781('0x8'));module[_0xd781('0x9')]=function(_0x830b,_0x2f98ee){return _0x830b['define'](_0xd781('0xa'),attributes,{'tableName':_0xd781('0xb'),'paranoid':![],'indexes':[{'name':_0xd781('0xc'),'fields':[_0xd781('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d38=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','idField','FieldId'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x6d38,0x1ef));var _0x86d3=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x6d38[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var logger=require(_0x86d3('0x1'))(_0x86d3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var attributes=require(_0x86d3('0x6'));module['exports']=function(_0x2d8272,_0xfbbc15){return _0x2d8272[_0x86d3('0x7')](_0x86d3('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x86d3('0x9'),_0x86d3('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index fa60047..880f321 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 _0xaca7=['error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x26ac27,_0x574b86){var _0x44a599=function(_0x130e2c){while(--_0x130e2c){_0x26ac27['push'](_0x26ac27['shift']());}};_0x44a599(++_0x574b86);}(_0xaca7,0x138));var _0x7aca=function(_0x220751,_0x5ad30c){_0x220751=_0x220751-0x0;var _0x2764a6=_0xaca7[_0x220751];return _0x2764a6;};'use strict';var _=require(_0x7aca('0x0'));var util=require(_0x7aca('0x1'));var moment=require('moment');var BPromise=require(_0x7aca('0x2'));var rs=require(_0x7aca('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7aca('0x4'))['db'];var utils=require(_0x7aca('0x5'));var logger=require(_0x7aca('0x6'))(_0x7aca('0x7'));var config=require('../../config/environment');var jayson=require(_0x7aca('0x8'));var client=jayson['client'][_0x7aca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x298626,_0x281672,_0x585ca4){return new BPromise(function(_0x19bbe1,_0x351332){return client[_0x7aca('0xa')](_0x298626,_0x585ca4)[_0x7aca('0xb')](function(_0x2d32e7){logger[_0x7aca('0xc')](_0x7aca('0xd'),_0x281672,_0x7aca('0xe'));logger[_0x7aca('0xf')](_0x7aca('0x10'),_0x281672,_0x7aca('0xe'),JSON[_0x7aca('0x11')](_0x2d32e7));if(_0x2d32e7[_0x7aca('0x12')]){if(_0x2d32e7['error']['code']===0x1f4){logger['error'](_0x7aca('0xd'),_0x281672,_0x2d32e7[_0x7aca('0x12')][_0x7aca('0x13')]);return _0x351332(_0x2d32e7[_0x7aca('0x12')][_0x7aca('0x13')]);}logger['error'](_0x7aca('0xd'),_0x281672,_0x2d32e7[_0x7aca('0x12')][_0x7aca('0x13')]);return _0x19bbe1(_0x2d32e7[_0x7aca('0x12')][_0x7aca('0x13')]);}else{logger[_0x7aca('0xc')](_0x7aca('0xd'),_0x281672,_0x7aca('0xe'));_0x19bbe1(_0x2d32e7[_0x7aca('0x14')][_0x7aca('0x13')]);}})[_0x7aca('0x15')](function(_0x17f8d4){logger[_0x7aca('0x12')](_0x7aca('0xd'),_0x281672,_0x17f8d4);_0x351332(_0x17f8d4);});});} \ No newline at end of file +var _0x38eb=['client','http','then','ZohoField,\x20%s,\x20%s','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','message','error','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x39f017,_0x1e8fae){var _0x374124=function(_0x55721a){while(--_0x55721a){_0x39f017['push'](_0x39f017['shift']());}};_0x374124(++_0x1e8fae);}(_0x38eb,0x98));var _0xb38e=function(_0x5ca88a,_0x3b0939){_0x5ca88a=_0x5ca88a-0x0;var _0x1a8302=_0x38eb[_0x5ca88a];return _0x1a8302;};'use strict';var _=require(_0xb38e('0x0'));var util=require('util');var moment=require(_0xb38e('0x1'));var BPromise=require(_0xb38e('0x2'));var rs=require(_0xb38e('0x3'));var fs=require('fs');var Redis=require(_0xb38e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb38e('0x5'))(_0xb38e('0x6'));var config=require(_0xb38e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb38e('0x8')][_0xb38e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ec85b,_0x40fbfc,_0x255373){return new BPromise(function(_0x417670,_0x49d8d7){return client['request'](_0x2ec85b,_0x255373)[_0xb38e('0xa')](function(_0xa8fa2a){logger['info'](_0xb38e('0xb'),_0x40fbfc,'request\x20sent');logger['debug'](_0xb38e('0xc'),_0x40fbfc,_0xb38e('0xd'),JSON[_0xb38e('0xe')](_0xa8fa2a));if(_0xa8fa2a['error']){if(_0xa8fa2a['error']['code']===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x40fbfc,_0xa8fa2a['error'][_0xb38e('0xf')]);return _0x49d8d7(_0xa8fa2a[_0xb38e('0x10')][_0xb38e('0xf')]);}logger[_0xb38e('0x10')](_0xb38e('0xb'),_0x40fbfc,_0xa8fa2a[_0xb38e('0x10')][_0xb38e('0xf')]);return _0x417670(_0xa8fa2a['error'][_0xb38e('0xf')]);}else{logger[_0xb38e('0x11')]('ZohoField,\x20%s,\x20%s',_0x40fbfc,'request\x20sent');_0x417670(_0xa8fa2a[_0xb38e('0x12')][_0xb38e('0xf')]);}})[_0xb38e('0x13')](function(_0x659c13){logger[_0xb38e('0x10')](_0xb38e('0xb'),_0x40fbfc,_0x659c13);_0x49d8d7(_0x659c13);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index a86e63b..24fa916 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x487496,_0x249683){var _0x539dc8=function(_0x2c38e1){while(--_0x2c38e1){_0x487496['push'](_0x487496['shift']());}};_0x539dc8(++_0x249683);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xfca425,_0x2950d6){var _0x44ea89=function(_0x5c0db6){while(--_0x5c0db6){_0xfca425['push'](_0xfca425['shift']());}};_0x44ea89(++_0x2950d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index de2c26d..9b9f0ad 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 _0x5ba7=['unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize','exports','STRING'];(function(_0x8bc36d,_0xdf0ed7){var _0x2dd45a=function(_0x541ca1){while(--_0x541ca1){_0x8bc36d['push'](_0x8bc36d['shift']());}};_0x2dd45a(++_0xdf0ed7);}(_0x5ba7,0x1b5));var _0x75ba=function(_0x5a18b7,_0x123722){_0x5a18b7=_0x5a18b7-0x0;var _0x3f8745=_0x5ba7[_0x5a18b7];return _0x3f8745;};'use strict';var Sequelize=require(_0x75ba('0x0'));module[_0x75ba('0x1')]={'name':{'type':Sequelize[_0x75ba('0x2')],'allowNull':![],'unique':_0x75ba('0x3')},'version':{'type':Sequelize[_0x75ba('0x2')],'allowNull':![],'unique':_0x75ba('0x3')},'main':{'type':Sequelize[_0x75ba('0x2')],'defaultValue':_0x75ba('0x4')},'filename':{'type':Sequelize[_0x75ba('0x2')]},'path':{'type':Sequelize[_0x75ba('0x2')]},'type':{'type':Sequelize[_0x75ba('0x2')]},'size':{'type':Sequelize[_0x75ba('0x5')]},'active':{'type':Sequelize[_0x75ba('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x75ba('0x2')]},'logo':{'type':Sequelize[_0x75ba('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0x75ba('0x7')},'description':{'type':Sequelize[_0x75ba('0x2')]},'title':{'type':Sequelize[_0x75ba('0x2')]},'remoteUri':{'type':Sequelize[_0x75ba('0x2')]},'link':{'type':Sequelize[_0x75ba('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x0ab9=['unique_name_and_version','app.js','INTEGER','BOOLEAN','state','exports','STRING'];(function(_0x3d2679,_0x113525){var _0x437d2b=function(_0x387f51){while(--_0x387f51){_0x3d2679['push'](_0x3d2679['shift']());}};_0x437d2b(++_0x113525);}(_0x0ab9,0x101));var _0x90ab=function(_0xf7fbce,_0xff8639){_0xf7fbce=_0xf7fbce-0x0;var _0x22ceeb=_0x0ab9[_0xf7fbce];return _0x22ceeb;};'use strict';var Sequelize=require('sequelize');module[_0x90ab('0x0')]={'name':{'type':Sequelize[_0x90ab('0x1')],'allowNull':![],'unique':_0x90ab('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0x90ab('0x3')},'filename':{'type':Sequelize[_0x90ab('0x1')]},'path':{'type':Sequelize[_0x90ab('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x90ab('0x4')]},'active':{'type':Sequelize[_0x90ab('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x90ab('0x1')]},'logo':{'type':Sequelize[_0x90ab('0x1')]},'state':{'type':Sequelize[_0x90ab('0x1')],'unique':_0x90ab('0x6')},'description':{'type':Sequelize[_0x90ab('0x1')]},'title':{'type':Sequelize[_0x90ab('0x1')]},'remoteUri':{'type':Sequelize[_0x90ab('0x1')]},'link':{'type':Sequelize[_0x90ab('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 730a7da..521e59f 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 _0x66fa=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','includeAll','include','Integration','findAll','rows','catch','merge','options','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x66fa,0x117));var _0xa66f=function(_0x2d7ab1,_0x479df3){_0x2d7ab1=_0x2d7ab1-0x0;var _0x52dc5b=_0x66fa[_0x2d7ab1];return _0x52dc5b;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa66f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x251189,_0x14af70){_0x14af70=_0x14af70||0xcc;return function(_0xca12f8){if(_0xca12f8){return _0x251189['sendStatus'](_0x14af70);}return _0x251189['status'](_0x14af70)[_0xa66f('0x15')]();};}function respondWithResult(_0x4e09cf,_0x528427){_0x528427=_0x528427||0xc8;return function(_0x5a7b16){if(_0x5a7b16){return _0x4e09cf[_0xa66f('0x16')](_0x528427)[_0xa66f('0x17')](_0x5a7b16);}};}function respondWithFilteredResult(_0x267129,_0x236d64){return function(_0xd348f9){if(_0xd348f9){var _0x567d4f=typeof _0x236d64['offset']===_0xa66f('0x18')&&typeof _0x236d64[_0xa66f('0x19')]===_0xa66f('0x18');var _0x403f4d=_0xd348f9['count'];var _0x1cbe64=_0x567d4f?0x0:_0x236d64['offset'];var _0x4a28d4=_0x567d4f?_0xd348f9[_0xa66f('0x1a')]:_0x236d64[_0xa66f('0x1b')]+_0x236d64[_0xa66f('0x19')];var _0x355ddc;if(_0x4a28d4>=_0x403f4d){_0x4a28d4=_0x403f4d;_0x355ddc=0xc8;}else{_0x355ddc=0xce;}_0x267129[_0xa66f('0x16')](_0x355ddc);return _0x267129[_0xa66f('0x1c')](_0xa66f('0x1d'),_0x1cbe64+'-'+_0x4a28d4+'/'+_0x403f4d)[_0xa66f('0x17')](_0xd348f9);}return null;};}function patchUpdates(_0x2033a4){return function(_0x2d9602){try{jsonpatch[_0xa66f('0x1e')](_0x2d9602,_0x2033a4,!![]);}catch(_0xbba376){return BPromise[_0xa66f('0x1f')](_0xbba376);}return _0x2d9602[_0xa66f('0x20')]();};}function saveUpdates(_0x82924d,_0x5cd613){return function(_0x27f570){if(_0x27f570){return _0x27f570[_0xa66f('0x21')](_0x82924d)[_0xa66f('0x22')](function(_0x37ee13){return _0x37ee13;});}return null;};}function removeEntity(_0x5cbd82,_0x337602){return function(_0x473822){if(_0x473822){return _0x473822[_0xa66f('0x23')]()[_0xa66f('0x22')](function(){_0x5cbd82['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xed98b9,_0x598942){return function(_0x3a3e4f){if(!_0x3a3e4f){_0xed98b9[_0xa66f('0x24')](0x194);}return _0x3a3e4f;};}function handleError(_0x384164,_0x57da7f){_0x57da7f=_0x57da7f||0x1f4;return function(_0x4683c7){logger[_0xa66f('0x25')](_0x4683c7[_0xa66f('0x26')]);if(_0x4683c7[_0xa66f('0x27')]){delete _0x4683c7[_0xa66f('0x27')];}_0x384164[_0xa66f('0x16')](_0x57da7f)[_0xa66f('0x28')](_0x4683c7);};}exports[_0xa66f('0x29')]=function(_0x20ee67,_0x117d03){var _0x45f71c={},_0x63650b={},_0x42b966={'count':0x0,'rows':[]};var _0xeeb22e=_['map'](db['Integration'][_0xa66f('0x2a')],function(_0x27ceae){return{'name':_0x27ceae['fieldName'],'type':_0x27ceae[_0xa66f('0x2b')][_0xa66f('0x2c')]};});_0x63650b['model']=_[_0xa66f('0x2d')](_0xeeb22e,_0xa66f('0x27'));_0x63650b[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x20ee67[_0xa66f('0x2e')]);_0x63650b['filters']=_[_0xa66f('0x30')](_0x63650b['model'],_0x63650b[_0xa66f('0x2e')]);_0x45f71c[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x63650b['model'],qs[_0xa66f('0x32')](_0x20ee67[_0xa66f('0x2e')]['fields']));_0x45f71c[_0xa66f('0x31')]=_0x45f71c[_0xa66f('0x31')][_0xa66f('0x33')]?_0x45f71c[_0xa66f('0x31')]:_0x63650b[_0xa66f('0x34')];if(!_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x35')](_0xa66f('0x36'))){_0x45f71c[_0xa66f('0x19')]=qs[_0xa66f('0x19')](_0x20ee67['query'][_0xa66f('0x19')]);_0x45f71c['offset']=qs[_0xa66f('0x1b')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x1b')]);}_0x45f71c[_0xa66f('0x37')]=qs[_0xa66f('0x38')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x38')]);_0x45f71c[_0xa66f('0x39')]=qs['filters'](_[_0xa66f('0x3a')](_0x20ee67['query'],_0x63650b[_0xa66f('0x3b')]),_0xeeb22e);if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3c')]){_0x45f71c['where']=_['merge'](_0x45f71c[_0xa66f('0x39')],{'$or':_[_0xa66f('0x2d')](_0xeeb22e,function(_0x20b07e){if(_0x20b07e[_0xa66f('0x2b')]!==_0xa66f('0x3d')){var _0x581dca={};_0x581dca[_0x20b07e['name']]={'$like':'%'+_0x20ee67['query'][_0xa66f('0x3c')]+'%'};return _0x581dca;}})});}_0x45f71c=_['merge']({},_0x45f71c,_0x20ee67['options']);var _0x5bf856={'where':_0x45f71c[_0xa66f('0x39')]};return db['Integration'][_0xa66f('0x1a')](_0x5bf856)[_0xa66f('0x22')](function(_0x23a546){_0x42b966[_0xa66f('0x1a')]=_0x23a546;if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3e')]){_0x45f71c[_0xa66f('0x3f')]=[{'all':!![]}];}return db[_0xa66f('0x40')][_0xa66f('0x41')](_0x45f71c);})[_0xa66f('0x22')](function(_0x3a7929){_0x42b966[_0xa66f('0x42')]=_0x3a7929;return _0x42b966;})[_0xa66f('0x22')](respondWithFilteredResult(_0x117d03,_0x45f71c))[_0xa66f('0x43')](handleError(_0x117d03,null));};exports['show']=function(_0x36037c,_0x25c2cb){var _0x58c1f2={'raw':![],'where':{'id':_0x36037c['params']['id']}},_0x248587={};_0x248587[_0xa66f('0x34')]=_[_0xa66f('0x2f')](db['Integration'][_0xa66f('0x2a')]);_0x248587[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x36037c['query']);_0x248587[_0xa66f('0x3b')]=_['intersection'](_0x248587[_0xa66f('0x34')],_0x248587[_0xa66f('0x2e')]);_0x58c1f2[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x248587[_0xa66f('0x34')],qs[_0xa66f('0x32')](_0x36037c[_0xa66f('0x2e')]['fields']));_0x58c1f2[_0xa66f('0x31')]=_0x58c1f2[_0xa66f('0x31')][_0xa66f('0x33')]?_0x58c1f2[_0xa66f('0x31')]:_0x248587[_0xa66f('0x34')];if(_0x36037c['query']['includeAll']){_0x58c1f2[_0xa66f('0x3f')]=[{'all':!![]}];}_0x58c1f2=_[_0xa66f('0x44')]({},_0x58c1f2,_0x36037c[_0xa66f('0x45')]);return db[_0xa66f('0x40')][_0xa66f('0x46')](_0x58c1f2)[_0xa66f('0x22')](handleEntityNotFound(_0x25c2cb,null))['then'](respondWithResult(_0x25c2cb,null))[_0xa66f('0x43')](handleError(_0x25c2cb,null));};exports[_0xa66f('0x47')]=function(_0x3f9cdd,_0x5651e9){return db['Integration'][_0xa66f('0x47')](_0x3f9cdd[_0xa66f('0x48')],{})[_0xa66f('0x22')](respondWithResult(_0x5651e9,0xc9))['catch'](handleError(_0x5651e9,null));};exports['update']=function(_0x52054e,_0x19e7ce){if(_0x52054e[_0xa66f('0x48')]['id']){delete _0x52054e[_0xa66f('0x48')]['id'];}return db[_0xa66f('0x40')][_0xa66f('0x46')]({'where':{'id':_0x52054e[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x19e7ce,null))[_0xa66f('0x22')](saveUpdates(_0x52054e['body'],null))[_0xa66f('0x22')](respondWithResult(_0x19e7ce,null))[_0xa66f('0x43')](handleError(_0x19e7ce,null));};exports[_0xa66f('0x23')]=function(_0x393755,_0x11597b){return db[_0xa66f('0x40')]['find']({'where':{'id':_0x393755[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x11597b,null))[_0xa66f('0x22')](removeEntity(_0x11597b,null))[_0xa66f('0x43')](handleError(_0x11597b,null));}; \ No newline at end of file +var _0x1883=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Integration','includeAll','include','findAll','params','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x339854,_0x5cae3f){var _0x4b10aa=function(_0x4b4a6d){while(--_0x4b4a6d){_0x339854['push'](_0x339854['shift']());}};_0x4b10aa(++_0x5cae3f);}(_0x1883,0xab));var _0x3188=function(_0x3f80c1,_0x3992df){_0x3f80c1=_0x3f80c1-0x0;var _0x47f48e=_0x1883[_0x3f80c1];return _0x47f48e;};'use strict';var emlformat=require(_0x3188('0x0'));var rimraf=require(_0x3188('0x1'));var zipdir=require(_0x3188('0x2'));var jsonpatch=require(_0x3188('0x3'));var rp=require(_0x3188('0x4'));var moment=require(_0x3188('0x5'));var BPromise=require(_0x3188('0x6'));var Mustache=require(_0x3188('0x7'));var util=require(_0x3188('0x8'));var path=require(_0x3188('0x9'));var sox=require(_0x3188('0xa'));var csv=require(_0x3188('0xb'));var ejs=require(_0x3188('0xc'));var fs=require('fs');var fs_extra=require(_0x3188('0xd'));var _=require(_0x3188('0xe'));var squel=require(_0x3188('0xf'));var crypto=require(_0x3188('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3188('0x11'));var toCsv=require(_0x3188('0xb'));var querystring=require('querystring');var Papa=require(_0x3188('0x12'));var Redis=require('ioredis');var authService=require(_0x3188('0x13'));var qs=require(_0x3188('0x14'));var as=require(_0x3188('0x15'));var hardwareService=require(_0x3188('0x16'));var logger=require('../../config/logger')(_0x3188('0x17'));var utils=require(_0x3188('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3188('0x19'))['db'];function respondWithStatusCode(_0x45e94e,_0x20fef6){_0x20fef6=_0x20fef6||0xcc;return function(_0x3ae228){if(_0x3ae228){return _0x45e94e[_0x3188('0x1a')](_0x20fef6);}return _0x45e94e[_0x3188('0x1b')](_0x20fef6)['end']();};}function respondWithResult(_0x276d69,_0x5e0044){_0x5e0044=_0x5e0044||0xc8;return function(_0x4a2f36){if(_0x4a2f36){return _0x276d69[_0x3188('0x1b')](_0x5e0044)['json'](_0x4a2f36);}};}function respondWithFilteredResult(_0x54a87f,_0x32c239){return function(_0x1beead){if(_0x1beead){var _0xa2269=typeof _0x32c239[_0x3188('0x1c')]===_0x3188('0x1d')&&typeof _0x32c239[_0x3188('0x1e')]==='undefined';var _0x19cc72=_0x1beead[_0x3188('0x1f')];var _0x3f5b35=_0xa2269?0x0:_0x32c239[_0x3188('0x1c')];var _0x18a71a=_0xa2269?_0x1beead[_0x3188('0x1f')]:_0x32c239[_0x3188('0x1c')]+_0x32c239[_0x3188('0x1e')];var _0x5bcbba;if(_0x18a71a>=_0x19cc72){_0x18a71a=_0x19cc72;_0x5bcbba=0xc8;}else{_0x5bcbba=0xce;}_0x54a87f[_0x3188('0x1b')](_0x5bcbba);return _0x54a87f[_0x3188('0x20')]('Content-Range',_0x3f5b35+'-'+_0x18a71a+'/'+_0x19cc72)['json'](_0x1beead);}return null;};}function patchUpdates(_0x5d8d62){return function(_0x46a318){try{jsonpatch[_0x3188('0x21')](_0x46a318,_0x5d8d62,!![]);}catch(_0xd292b5){return BPromise['reject'](_0xd292b5);}return _0x46a318['save']();};}function saveUpdates(_0x266260,_0x461286){return function(_0x375077){if(_0x375077){return _0x375077[_0x3188('0x22')](_0x266260)[_0x3188('0x23')](function(_0x4bd5ee){return _0x4bd5ee;});}return null;};}function removeEntity(_0x30cf2c,_0x33f882){return function(_0x5a2e67){if(_0x5a2e67){return _0x5a2e67[_0x3188('0x24')]()['then'](function(){_0x30cf2c['status'](0xcc)[_0x3188('0x25')]();});}};}function handleEntityNotFound(_0x129bd7,_0x87d5a3){return function(_0x1aeaba){if(!_0x1aeaba){_0x129bd7[_0x3188('0x1a')](0x194);}return _0x1aeaba;};}function handleError(_0x2cd060,_0xe57f73){_0xe57f73=_0xe57f73||0x1f4;return function(_0x11021c){logger['error'](_0x11021c[_0x3188('0x26')]);if(_0x11021c[_0x3188('0x27')]){delete _0x11021c['name'];}_0x2cd060[_0x3188('0x1b')](_0xe57f73)[_0x3188('0x28')](_0x11021c);};}exports[_0x3188('0x29')]=function(_0x44db9a,_0x20e6aa){var _0x1f1c6f={},_0x8f810f={},_0x472926={'count':0x0,'rows':[]};var _0x57c21c=_[_0x3188('0x2a')](db['Integration'][_0x3188('0x2b')],function(_0x5623f1){return{'name':_0x5623f1[_0x3188('0x2c')],'type':_0x5623f1[_0x3188('0x2d')][_0x3188('0x2e')]};});_0x8f810f[_0x3188('0x2f')]=_[_0x3188('0x2a')](_0x57c21c,_0x3188('0x27'));_0x8f810f[_0x3188('0x30')]=_[_0x3188('0x31')](_0x44db9a[_0x3188('0x30')]);_0x8f810f[_0x3188('0x32')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],_0x8f810f[_0x3188('0x30')]);_0x1f1c6f[_0x3188('0x34')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],qs[_0x3188('0x35')](_0x44db9a[_0x3188('0x30')]['fields']));_0x1f1c6f[_0x3188('0x34')]=_0x1f1c6f['attributes'][_0x3188('0x36')]?_0x1f1c6f[_0x3188('0x34')]:_0x8f810f['model'];if(!_0x44db9a[_0x3188('0x30')][_0x3188('0x37')](_0x3188('0x38'))){_0x1f1c6f[_0x3188('0x1e')]=qs[_0x3188('0x1e')](_0x44db9a[_0x3188('0x30')][_0x3188('0x1e')]);_0x1f1c6f['offset']=qs['offset'](_0x44db9a[_0x3188('0x30')][_0x3188('0x1c')]);}_0x1f1c6f[_0x3188('0x39')]=qs[_0x3188('0x3a')](_0x44db9a['query'][_0x3188('0x3a')]);_0x1f1c6f[_0x3188('0x3b')]=qs[_0x3188('0x32')](_[_0x3188('0x3c')](_0x44db9a['query'],_0x8f810f[_0x3188('0x32')]),_0x57c21c);if(_0x44db9a['query'][_0x3188('0x3d')]){_0x1f1c6f['where']=_[_0x3188('0x3e')](_0x1f1c6f[_0x3188('0x3b')],{'$or':_[_0x3188('0x2a')](_0x57c21c,function(_0x2990c4){if(_0x2990c4[_0x3188('0x2d')]!==_0x3188('0x3f')){var _0x4666b2={};_0x4666b2[_0x2990c4[_0x3188('0x27')]]={'$like':'%'+_0x44db9a[_0x3188('0x30')][_0x3188('0x3d')]+'%'};return _0x4666b2;}})});}_0x1f1c6f=_['merge']({},_0x1f1c6f,_0x44db9a[_0x3188('0x40')]);var _0x2bad0f={'where':_0x1f1c6f[_0x3188('0x3b')]};return db[_0x3188('0x41')][_0x3188('0x1f')](_0x2bad0f)[_0x3188('0x23')](function(_0x5a815d){_0x472926[_0x3188('0x1f')]=_0x5a815d;if(_0x44db9a['query'][_0x3188('0x42')]){_0x1f1c6f[_0x3188('0x43')]=[{'all':!![]}];}return db[_0x3188('0x41')][_0x3188('0x44')](_0x1f1c6f);})[_0x3188('0x23')](function(_0x549ab2){_0x472926['rows']=_0x549ab2;return _0x472926;})['then'](respondWithFilteredResult(_0x20e6aa,_0x1f1c6f))['catch'](handleError(_0x20e6aa,null));};exports['show']=function(_0x763943,_0x28c224){var _0x3e5f90={'raw':![],'where':{'id':_0x763943[_0x3188('0x45')]['id']}},_0x1b40b1={};_0x1b40b1['model']=_[_0x3188('0x31')](db['Integration'][_0x3188('0x2b')]);_0x1b40b1[_0x3188('0x30')]=_[_0x3188('0x31')](_0x763943[_0x3188('0x30')]);_0x1b40b1['filters']=_[_0x3188('0x33')](_0x1b40b1[_0x3188('0x2f')],_0x1b40b1[_0x3188('0x30')]);_0x3e5f90[_0x3188('0x34')]=_[_0x3188('0x33')](_0x1b40b1['model'],qs['fields'](_0x763943[_0x3188('0x30')][_0x3188('0x35')]));_0x3e5f90['attributes']=_0x3e5f90[_0x3188('0x34')][_0x3188('0x36')]?_0x3e5f90['attributes']:_0x1b40b1[_0x3188('0x2f')];if(_0x763943[_0x3188('0x30')][_0x3188('0x42')]){_0x3e5f90[_0x3188('0x43')]=[{'all':!![]}];}_0x3e5f90=_[_0x3188('0x3e')]({},_0x3e5f90,_0x763943['options']);return db[_0x3188('0x41')]['find'](_0x3e5f90)[_0x3188('0x23')](handleEntityNotFound(_0x28c224,null))[_0x3188('0x23')](respondWithResult(_0x28c224,null))[_0x3188('0x46')](handleError(_0x28c224,null));};exports[_0x3188('0x47')]=function(_0xe4cbb0,_0x315524){return db[_0x3188('0x41')][_0x3188('0x47')](_0xe4cbb0[_0x3188('0x48')],{})[_0x3188('0x23')](respondWithResult(_0x315524,0xc9))[_0x3188('0x46')](handleError(_0x315524,null));};exports['update']=function(_0x50fd56,_0x1b012d){if(_0x50fd56['body']['id']){delete _0x50fd56[_0x3188('0x48')]['id'];}return db[_0x3188('0x41')]['find']({'where':{'id':_0x50fd56[_0x3188('0x45')]['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x1b012d,null))[_0x3188('0x23')](saveUpdates(_0x50fd56[_0x3188('0x48')],null))[_0x3188('0x23')](respondWithResult(_0x1b012d,null))[_0x3188('0x46')](handleError(_0x1b012d,null));};exports[_0x3188('0x24')]=function(_0x1e3592,_0x59a177){return db[_0x3188('0x41')][_0x3188('0x49')]({'where':{'id':_0x1e3592['params']['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x59a177,null))['then'](removeEntity(_0x59a177,null))[_0x3188('0x46')](handleError(_0x59a177,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 680b914..01d3a4d 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 _0x1f78=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./integration.attributes','exports','define','integrations','lodash','util'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x1f78,0x11c));var _0x81f7=function(_0x3e48ee,_0x3a01e3){_0x3e48ee=_0x3e48ee-0x0;var _0x392bc8=_0x1f78[_0x3e48ee];return _0x392bc8;};'use strict';var _=require(_0x81f7('0x0'));var util=require(_0x81f7('0x1'));var logger=require(_0x81f7('0x2'))(_0x81f7('0x3'));var moment=require(_0x81f7('0x4'));var BPromise=require(_0x81f7('0x5'));var rp=require(_0x81f7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x81f7('0x7'));var config=require(_0x81f7('0x8'));var attributes=require(_0x81f7('0x9'));module[_0x81f7('0xa')]=function(_0xd4e584,_0x33f815){return _0xd4e584[_0x81f7('0xb')]('Integration',attributes,{'tableName':_0x81f7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb913=['rimraf','./integration.attributes','exports','define','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2a1c03,_0x4342f9){var _0x2a42d4=function(_0x5206d2){while(--_0x5206d2){_0x2a1c03['push'](_0x2a1c03['shift']());}};_0x2a42d4(++_0x4342f9);}(_0xb913,0x14a));var _0x3b91=function(_0x4e0e22,_0x1f505f){_0x4e0e22=_0x4e0e22-0x0;var _0x2c4d40=_0xb913[_0x4e0e22];return _0x2c4d40;};'use strict';var _=require(_0x3b91('0x0'));var util=require(_0x3b91('0x1'));var logger=require(_0x3b91('0x2'))(_0x3b91('0x3'));var moment=require(_0x3b91('0x4'));var BPromise=require(_0x3b91('0x5'));var rp=require(_0x3b91('0x6'));var fs=require('fs');var path=require(_0x3b91('0x7'));var rimraf=require(_0x3b91('0x8'));var config=require('../../config/environment');var attributes=require(_0x3b91('0x9'));module[_0x3b91('0xa')]=function(_0xec7da9,_0x257a4a){return _0xec7da9[_0x3b91('0xb')]('Integration',attributes,{'tableName':_0x3b91('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 1e83f53..70df122 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 _0x2542=['info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x3d0bfd,_0x4c63e5){var _0x44f479=function(_0x12669b){while(--_0x12669b){_0x3d0bfd['push'](_0x3d0bfd['shift']());}};_0x44f479(++_0x4c63e5);}(_0x2542,0x169));var _0x2254=function(_0xac1238,_0x36e7f4){_0xac1238=_0xac1238-0x0;var _0x4f010b=_0x2542[_0xac1238];return _0x4f010b;};'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);});});} \ No newline at end of file +var _0x2542=['info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x458db5,_0x35f7dd){var _0x372a66=function(_0x326657){while(--_0x326657){_0x458db5['push'](_0x458db5['shift']());}};_0x372a66(++_0x35f7dd);}(_0x2542,0x169));var _0x2254=function(_0x53f6fc,_0x427e16){_0x53f6fc=_0x53f6fc-0x0;var _0x383715=_0x2542[_0x53f6fc];return _0x383715;};'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);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 0f84a9d..bd9a757 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 _0xef0f=['update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x58a8f7,_0x47543a){var _0x5b843f=function(_0x5b7da6){while(--_0x5b7da6){_0x58a8f7['push'](_0x58a8f7['shift']());}};_0x5b843f(++_0x47543a);}(_0xef0f,0x168));var _0xfef0=function(_0x42b696,_0x180cee){_0x42b696=_0x42b696-0x0;var _0x1238e5=_0xef0f[_0x42b696];return _0x1238e5;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var fs_extra=require(_0xfef0('0x4'));var auth=require(_0xfef0('0x5'));var interaction=require(_0xfef0('0x6'));var config=require('../../config/environment');var controller=require(_0xfef0('0x7'));router[_0xfef0('0x8')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0xa')]);router[_0xfef0('0x8')](_0xfef0('0xb'),auth['isAuthenticated'](),controller[_0xfef0('0xc')]);router['get'](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0xe')]);router[_0xfef0('0xf')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0x10')]);router[_0xfef0('0x11')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x12')]);router[_0xfef0('0x13')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc2c7=['/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe'];(function(_0x45c320,_0x5ecb5e){var _0x45b6c5=function(_0x429136){while(--_0x429136){_0x45c320['push'](_0x45c320['shift']());}};_0x45b6c5(++_0x5ecb5e);}(_0xc2c7,0x134));var _0x7c2c=function(_0x128d3e,_0x5451cc){_0x128d3e=_0x128d3e-0x0;var _0x2582b6=_0xc2c7[_0x128d3e];return _0x2582b6;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./integrationReport.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['post']('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xe')]);router[_0x7c2c('0xf')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x10')]);router[_0x7c2c('0x11')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x12')]);module[_0x7c2c('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 6e91453..f1e750b 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 _0x725d=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize'];(function(_0x2cb708,_0x5dc3d2){var _0x17715c=function(_0x17a445){while(--_0x17a445){_0x2cb708['push'](_0x2cb708['shift']());}};_0x17715c(++_0x5dc3d2);}(_0x725d,0x171));var _0xd725=function(_0x358bec,_0x1f23f1){_0x358bec=_0x358bec-0x0;var _0x1015ab=_0x725d[_0x358bec];return _0x1015ab;};'use strict';var Sequelize=require(_0xd725('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xd725('0x1')]},'integrationId':{'type':Sequelize[_0xd725('0x2')]},'contacts':{'type':Sequelize[_0xd725('0x1')]},'uniqueid':{'type':Sequelize[_0xd725('0x1')]},'calleridnum':{'type':Sequelize[_0xd725('0x1')]},'calleridname':{'type':Sequelize[_0xd725('0x1')]},'queue':{'type':Sequelize[_0xd725('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xd725('0x3')]},'agentconnectAt':{'type':Sequelize[_0xd725('0x3')]},'holdtime':{'type':Sequelize[_0xd725('0x2')]},'agentcomplete':{'type':Sequelize[_0xd725('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xd725('0x2')]},'agentacw':{'type':Sequelize[_0xd725('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xd725('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xd725('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xd725('0x3')]},'agentdump':{'type':Sequelize[_0xd725('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xd725('0x3')]},'lastevent':{'type':Sequelize[_0xd725('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xd725('0x2')]},'channelstatedesc':{'type':Sequelize[_0xd725('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd725('0x1')]},'connectedlinename':{'type':Sequelize[_0xd725('0x1')]},'language':{'type':Sequelize[_0xd725('0x1')]},'accountcode':{'type':Sequelize[_0xd725('0x1')]},'context':{'type':Sequelize[_0xd725('0x1')]},'exten':{'type':Sequelize[_0xd725('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd725('0x1')]},'destchannelstate':{'type':Sequelize[_0xd725('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xd725('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd725('0x1')]},'destcalleridname':{'type':Sequelize[_0xd725('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xd725('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xd725('0x1')]},'destcontext':{'type':Sequelize[_0xd725('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xd725('0x1')]},'destuniqueid':{'type':Sequelize[_0xd725('0x1')]},'messageId':{'type':Sequelize[_0xd725('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xd725('0x1')]},'from':{'type':Sequelize[_0xd725('0x1')]},'to':{'type':Sequelize[_0xd725('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xd725('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xd725('0x6')]('SENT',_0xd725('0x7'),_0xd725('0x8'),_0xd725('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xd725('0x1')]},'appdata':{'type':Sequelize[_0xd725('0x1')]},'projectId':{'type':Sequelize[_0xd725('0x2')]}}; \ No newline at end of file +var _0x5f75=['ENUM','SENT','SENDING','FAILED','exports','STRING','DATE','BOOLEAN','INTEGER','TEXT'];(function(_0x2cdfac,_0x31c9a2){var _0x2256eb=function(_0x3a394e){while(--_0x3a394e){_0x2cdfac['push'](_0x2cdfac['shift']());}};_0x2256eb(++_0x31c9a2);}(_0x5f75,0x162));var _0x55f7=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0x5f75[_0x48d6a3];return _0x38bfa0;};'use strict';var Sequelize=require('sequelize');module[_0x55f7('0x0')]={'integration':{'type':Sequelize[_0x55f7('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x55f7('0x1')]},'ticketId':{'type':Sequelize[_0x55f7('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x55f7('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x55f7('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x55f7('0x1')]},'membername':{'type':Sequelize[_0x55f7('0x1')]},'agentcalledAt':{'type':Sequelize[_0x55f7('0x2')]},'agentconnectAt':{'type':Sequelize[_0x55f7('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x55f7('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x55f7('0x2')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x55f7('0x4')]},'reason':{'type':Sequelize[_0x55f7('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x55f7('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x55f7('0x2')]},'agentdump':{'type':Sequelize[_0x55f7('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x55f7('0x2')]},'lastevent':{'type':Sequelize[_0x55f7('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x55f7('0x4')]},'channelstatedesc':{'type':Sequelize[_0x55f7('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x55f7('0x1')]},'language':{'type':Sequelize[_0x55f7('0x1')]},'accountcode':{'type':Sequelize[_0x55f7('0x1')]},'context':{'type':Sequelize[_0x55f7('0x1')]},'exten':{'type':Sequelize[_0x55f7('0x1')]},'priority':{'type':Sequelize[_0x55f7('0x1')]},'destchannel':{'type':Sequelize[_0x55f7('0x1')]},'destchannelstate':{'type':Sequelize[_0x55f7('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x55f7('0x1')]},'destcalleridnum':{'type':Sequelize[_0x55f7('0x1')]},'destcalleridname':{'type':Sequelize[_0x55f7('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x55f7('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x55f7('0x1')]},'destaccountcode':{'type':Sequelize[_0x55f7('0x1')]},'destcontext':{'type':Sequelize[_0x55f7('0x1')]},'destexten':{'type':Sequelize[_0x55f7('0x1')]},'destpriority':{'type':Sequelize[_0x55f7('0x1')]},'destuniqueid':{'type':Sequelize[_0x55f7('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x55f7('0x1')]},'subject':{'type':Sequelize[_0x55f7('0x1')]},'from':{'type':Sequelize[_0x55f7('0x1')]},'to':{'type':Sequelize[_0x55f7('0x1')]},'cc':{'type':Sequelize[_0x55f7('0x1')]},'attachment':{'type':Sequelize[_0x55f7('0x5')]},'html':{'type':Sequelize[_0x55f7('0x5')]},'text':{'type':Sequelize[_0x55f7('0x5')]},'status':{'type':Sequelize[_0x55f7('0x6')](_0x55f7('0x7'),_0x55f7('0x8'),'RECEIVED',_0x55f7('0x9'))},'url':{'type':Sequelize[_0x55f7('0x1')]},'app':{'type':Sequelize[_0x55f7('0x1')]},'appdata':{'type':Sequelize[_0x55f7('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index eaea121..4c3cc48 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 _0xca63=['undefined','limit','count','status','set','apply','reject','save','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','then','findAll','catch','params','includeAll','include','options','find','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','json','offset'];(function(_0x29d424,_0x1a20c0){var _0x15bb46=function(_0x1b3491){while(--_0x1b3491){_0x29d424['push'](_0x29d424['shift']());}};_0x15bb46(++_0x1a20c0);}(_0xca63,0xc3));var _0x3ca6=function(_0x36f7ea,_0x76c3a){_0x36f7ea=_0x36f7ea-0x0;var _0x1adc5c=_0xca63[_0x36f7ea];return _0x1adc5c;};'use strict';var emlformat=require(_0x3ca6('0x0'));var rimraf=require(_0x3ca6('0x1'));var zipdir=require(_0x3ca6('0x2'));var jsonpatch=require(_0x3ca6('0x3'));var rp=require(_0x3ca6('0x4'));var moment=require(_0x3ca6('0x5'));var BPromise=require(_0x3ca6('0x6'));var Mustache=require(_0x3ca6('0x7'));var util=require(_0x3ca6('0x8'));var path=require('path');var sox=require(_0x3ca6('0x9'));var csv=require(_0x3ca6('0xa'));var ejs=require(_0x3ca6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ca6('0xc'));var squel=require(_0x3ca6('0xd'));var crypto=require('crypto');var jsforce=require(_0x3ca6('0xe'));var deskjs=require(_0x3ca6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3ca6('0x10'));var Papa=require(_0x3ca6('0x11'));var Redis=require(_0x3ca6('0x12'));var authService=require(_0x3ca6('0x13'));var qs=require(_0x3ca6('0x14'));var as=require(_0x3ca6('0x15'));var hardwareService=require(_0x3ca6('0x16'));var logger=require('../../config/logger')(_0x3ca6('0x17'));var utils=require(_0x3ca6('0x18'));var config=require(_0x3ca6('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x3ca6('0x1a'))['db'];function respondWithStatusCode(_0x2ab83a,_0x773a0f){_0x773a0f=_0x773a0f||0xcc;return function(_0x5394e8){if(_0x5394e8){return _0x2ab83a['sendStatus'](_0x773a0f);}return _0x2ab83a['status'](_0x773a0f)[_0x3ca6('0x1b')]();};}function respondWithResult(_0x102e54,_0x1f3282){_0x1f3282=_0x1f3282||0xc8;return function(_0xe6a607){if(_0xe6a607){return _0x102e54['status'](_0x1f3282)[_0x3ca6('0x1c')](_0xe6a607);}};}function respondWithFilteredResult(_0x331a25,_0x502e3b){return function(_0x30d672){if(_0x30d672){var _0x1bf5b8=typeof _0x502e3b[_0x3ca6('0x1d')]===_0x3ca6('0x1e')&&typeof _0x502e3b[_0x3ca6('0x1f')]===_0x3ca6('0x1e');var _0x15d8c8=_0x30d672[_0x3ca6('0x20')];var _0x22c4e2=_0x1bf5b8?0x0:_0x502e3b[_0x3ca6('0x1d')];var _0x19095d=_0x1bf5b8?_0x30d672[_0x3ca6('0x20')]:_0x502e3b[_0x3ca6('0x1d')]+_0x502e3b[_0x3ca6('0x1f')];var _0x4b16f7;if(_0x19095d>=_0x15d8c8){_0x19095d=_0x15d8c8;_0x4b16f7=0xc8;}else{_0x4b16f7=0xce;}_0x331a25[_0x3ca6('0x21')](_0x4b16f7);return _0x331a25[_0x3ca6('0x22')]('Content-Range',_0x22c4e2+'-'+_0x19095d+'/'+_0x15d8c8)[_0x3ca6('0x1c')](_0x30d672);}return null;};}function patchUpdates(_0x1fd15b){return function(_0x5370c7){try{jsonpatch[_0x3ca6('0x23')](_0x5370c7,_0x1fd15b,!![]);}catch(_0x461880){return BPromise[_0x3ca6('0x24')](_0x461880);}return _0x5370c7[_0x3ca6('0x25')]();};}function saveUpdates(_0x2737dc,_0x58498e){return function(_0x1608a4){if(_0x1608a4){return _0x1608a4['update'](_0x2737dc)['then'](function(_0x3a15af){return _0x3a15af;});}return null;};}function removeEntity(_0x3e0e17,_0x5d6299){return function(_0xde15f2){if(_0xde15f2){return _0xde15f2[_0x3ca6('0x26')]()['then'](function(){_0x3e0e17['status'](0xcc)[_0x3ca6('0x1b')]();});}};}function handleEntityNotFound(_0x205db0,_0x5c8ab3){return function(_0x354c78){if(!_0x354c78){_0x205db0['sendStatus'](0x194);}return _0x354c78;};}function handleError(_0x1f13b,_0x5642f7){_0x5642f7=_0x5642f7||0x1f4;return function(_0x33774b){logger[_0x3ca6('0x27')](_0x33774b[_0x3ca6('0x28')]);if(_0x33774b[_0x3ca6('0x29')]){delete _0x33774b['name'];}_0x1f13b[_0x3ca6('0x21')](_0x5642f7)[_0x3ca6('0x2a')](_0x33774b);};}exports[_0x3ca6('0x2b')]=function(_0xf8654b,_0x93e4f2){var _0x462ad6={},_0x1ed5fc={},_0x330e12={'count':0x0,'rows':[]};var _0x9757cf=_[_0x3ca6('0x2c')](db[_0x3ca6('0x2d')][_0x3ca6('0x2e')],function(_0x197ce1){return{'name':_0x197ce1['fieldName'],'type':_0x197ce1[_0x3ca6('0x2f')][_0x3ca6('0x30')]};});_0x1ed5fc[_0x3ca6('0x31')]=_[_0x3ca6('0x2c')](_0x9757cf,'name');_0x1ed5fc[_0x3ca6('0x32')]=_[_0x3ca6('0x33')](_0xf8654b['query']);_0x1ed5fc[_0x3ca6('0x34')]=_['intersection'](_0x1ed5fc[_0x3ca6('0x31')],_0x1ed5fc['query']);_0x462ad6[_0x3ca6('0x35')]=_[_0x3ca6('0x36')](_0x1ed5fc['model'],qs['fields'](_0xf8654b[_0x3ca6('0x32')][_0x3ca6('0x37')]));_0x462ad6['attributes']=_0x462ad6[_0x3ca6('0x35')][_0x3ca6('0x38')]?_0x462ad6[_0x3ca6('0x35')]:_0x1ed5fc[_0x3ca6('0x31')];if(!_0xf8654b[_0x3ca6('0x32')]['hasOwnProperty']('nolimit')){_0x462ad6['limit']=qs[_0x3ca6('0x1f')](_0xf8654b[_0x3ca6('0x32')][_0x3ca6('0x1f')]);_0x462ad6[_0x3ca6('0x1d')]=qs[_0x3ca6('0x1d')](_0xf8654b[_0x3ca6('0x32')][_0x3ca6('0x1d')]);}_0x462ad6[_0x3ca6('0x39')]=qs[_0x3ca6('0x3a')](_0xf8654b['query'][_0x3ca6('0x3a')]);_0x462ad6[_0x3ca6('0x3b')]=qs[_0x3ca6('0x34')](_[_0x3ca6('0x3c')](_0xf8654b[_0x3ca6('0x32')],_0x1ed5fc['filters']),_0x9757cf);if(_0xf8654b['query']['filter']){_0x462ad6[_0x3ca6('0x3b')]=_[_0x3ca6('0x3d')](_0x462ad6[_0x3ca6('0x3b')],{'$or':_[_0x3ca6('0x2c')](_0x9757cf,function(_0x211101){if(_0x211101['type']!==_0x3ca6('0x3e')){var _0x2c639e={};_0x2c639e[_0x211101[_0x3ca6('0x29')]]={'$like':'%'+_0xf8654b[_0x3ca6('0x32')][_0x3ca6('0x3f')]+'%'};return _0x2c639e;}})});}_0x462ad6=_[_0x3ca6('0x3d')]({},_0x462ad6,_0xf8654b['options']);var _0x10da86={'where':_0x462ad6[_0x3ca6('0x3b')]};return db['IntegrationReport'][_0x3ca6('0x20')](_0x10da86)[_0x3ca6('0x40')](function(_0x3e831e){_0x330e12['count']=_0x3e831e;if(_0xf8654b[_0x3ca6('0x32')]['includeAll']){_0x462ad6['include']=[{'all':!![]}];}return db[_0x3ca6('0x2d')][_0x3ca6('0x41')](_0x462ad6);})['then'](function(_0x557f2b){_0x330e12['rows']=_0x557f2b;return _0x330e12;})['then'](respondWithFilteredResult(_0x93e4f2,_0x462ad6))[_0x3ca6('0x42')](handleError(_0x93e4f2,null));};exports['show']=function(_0x2eb526,_0x3da6c7){var _0x35cfe7={'raw':![],'where':{'id':_0x2eb526[_0x3ca6('0x43')]['id']}},_0x1d42cd={};_0x1d42cd[_0x3ca6('0x31')]=_[_0x3ca6('0x33')](db['IntegrationReport']['rawAttributes']);_0x1d42cd[_0x3ca6('0x32')]=_[_0x3ca6('0x33')](_0x2eb526[_0x3ca6('0x32')]);_0x1d42cd[_0x3ca6('0x34')]=_['intersection'](_0x1d42cd[_0x3ca6('0x31')],_0x1d42cd[_0x3ca6('0x32')]);_0x35cfe7[_0x3ca6('0x35')]=_[_0x3ca6('0x36')](_0x1d42cd[_0x3ca6('0x31')],qs['fields'](_0x2eb526[_0x3ca6('0x32')][_0x3ca6('0x37')]));_0x35cfe7[_0x3ca6('0x35')]=_0x35cfe7[_0x3ca6('0x35')][_0x3ca6('0x38')]?_0x35cfe7[_0x3ca6('0x35')]:_0x1d42cd[_0x3ca6('0x31')];if(_0x2eb526[_0x3ca6('0x32')][_0x3ca6('0x44')]){_0x35cfe7[_0x3ca6('0x45')]=[{'all':!![]}];}_0x35cfe7=_[_0x3ca6('0x3d')]({},_0x35cfe7,_0x2eb526[_0x3ca6('0x46')]);return db[_0x3ca6('0x2d')][_0x3ca6('0x47')](_0x35cfe7)[_0x3ca6('0x40')](handleEntityNotFound(_0x3da6c7,null))[_0x3ca6('0x40')](respondWithResult(_0x3da6c7,null))[_0x3ca6('0x42')](handleError(_0x3da6c7,null));};exports['create']=function(_0x27d2ff,_0xde53dc){return db[_0x3ca6('0x2d')]['create'](_0x27d2ff[_0x3ca6('0x48')],{})[_0x3ca6('0x40')](respondWithResult(_0xde53dc,0xc9))[_0x3ca6('0x42')](handleError(_0xde53dc,null));};exports[_0x3ca6('0x49')]=function(_0x3e7e0c,_0x228858){if(_0x3e7e0c[_0x3ca6('0x48')]['id']){delete _0x3e7e0c['body']['id'];}return db[_0x3ca6('0x2d')][_0x3ca6('0x47')]({'where':{'id':_0x3e7e0c[_0x3ca6('0x43')]['id']}})[_0x3ca6('0x40')](handleEntityNotFound(_0x228858,null))[_0x3ca6('0x40')](saveUpdates(_0x3e7e0c[_0x3ca6('0x48')],null))[_0x3ca6('0x40')](respondWithResult(_0x228858,null))[_0x3ca6('0x42')](handleError(_0x228858,null));};exports['destroy']=function(_0x4af411,_0x1edc33){return db[_0x3ca6('0x2d')]['find']({'where':{'id':_0x4af411[_0x3ca6('0x43')]['id']}})['then'](handleEntityNotFound(_0x1edc33,null))['then'](removeEntity(_0x1edc33,null))[_0x3ca6('0x42')](handleError(_0x1edc33,null));};exports[_0x3ca6('0x4a')]=function(_0x1c9aa5,_0x11e467){return db[_0x3ca6('0x2d')][_0x3ca6('0x4a')]()['then'](respondWithResult(_0x11e467,null))[_0x3ca6('0x42')](handleError(_0x11e467,null));}; \ No newline at end of file +var _0x4835=['create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','end','error','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','find'];(function(_0x54fa13,_0x2a276b){var _0x4ec3f2=function(_0x177801){while(--_0x177801){_0x54fa13['push'](_0x54fa13['shift']());}};_0x4ec3f2(++_0x2a276b);}(_0x4835,0x18e));var _0x5483=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0x4835[_0x4017b0];return _0x5ed4f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5483('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5483('0x1'));var rp=require(_0x5483('0x2'));var moment=require(_0x5483('0x3'));var BPromise=require(_0x5483('0x4'));var Mustache=require(_0x5483('0x5'));var util=require(_0x5483('0x6'));var path=require(_0x5483('0x7'));var sox=require(_0x5483('0x8'));var csv=require(_0x5483('0x9'));var ejs=require(_0x5483('0xa'));var fs=require('fs');var fs_extra=require(_0x5483('0xb'));var _=require(_0x5483('0xc'));var squel=require(_0x5483('0xd'));var crypto=require(_0x5483('0xe'));var jsforce=require(_0x5483('0xf'));var deskjs=require(_0x5483('0x10'));var toCsv=require(_0x5483('0x9'));var querystring=require(_0x5483('0x11'));var Papa=require(_0x5483('0x12'));var Redis=require(_0x5483('0x13'));var authService=require(_0x5483('0x14'));var qs=require(_0x5483('0x15'));var as=require(_0x5483('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5483('0x17'))(_0x5483('0x18'));var utils=require(_0x5483('0x19'));var config=require(_0x5483('0x1a'));var licenseUtil=require(_0x5483('0x1b'));var db=require(_0x5483('0x1c'))['db'];function respondWithStatusCode(_0x40ae38,_0x3b4d86){_0x3b4d86=_0x3b4d86||0xcc;return function(_0x629384){if(_0x629384){return _0x40ae38[_0x5483('0x1d')](_0x3b4d86);}return _0x40ae38[_0x5483('0x1e')](_0x3b4d86)['end']();};}function respondWithResult(_0x2e8558,_0x9a7965){_0x9a7965=_0x9a7965||0xc8;return function(_0x5447a4){if(_0x5447a4){return _0x2e8558[_0x5483('0x1e')](_0x9a7965)[_0x5483('0x1f')](_0x5447a4);}};}function respondWithFilteredResult(_0x5c178f,_0xad8b0b){return function(_0x3e918f){if(_0x3e918f){var _0x3cbedc=typeof _0xad8b0b[_0x5483('0x20')]===_0x5483('0x21')&&typeof _0xad8b0b[_0x5483('0x22')]==='undefined';var _0x4a29c2=_0x3e918f[_0x5483('0x23')];var _0x1af23a=_0x3cbedc?0x0:_0xad8b0b['offset'];var _0x53061b=_0x3cbedc?_0x3e918f[_0x5483('0x23')]:_0xad8b0b[_0x5483('0x20')]+_0xad8b0b[_0x5483('0x22')];var _0x46ed97;if(_0x53061b>=_0x4a29c2){_0x53061b=_0x4a29c2;_0x46ed97=0xc8;}else{_0x46ed97=0xce;}_0x5c178f[_0x5483('0x1e')](_0x46ed97);return _0x5c178f['set'](_0x5483('0x24'),_0x1af23a+'-'+_0x53061b+'/'+_0x4a29c2)[_0x5483('0x1f')](_0x3e918f);}return null;};}function patchUpdates(_0x393988){return function(_0x2c9b02){try{jsonpatch['apply'](_0x2c9b02,_0x393988,!![]);}catch(_0xc97e00){return BPromise[_0x5483('0x25')](_0xc97e00);}return _0x2c9b02[_0x5483('0x26')]();};}function saveUpdates(_0x4943b7,_0xdd0d4e){return function(_0x511d53){if(_0x511d53){return _0x511d53[_0x5483('0x27')](_0x4943b7)[_0x5483('0x28')](function(_0x5c2369){return _0x5c2369;});}return null;};}function removeEntity(_0x439443,_0x85134a){return function(_0x3d19fd){if(_0x3d19fd){return _0x3d19fd[_0x5483('0x29')]()['then'](function(){_0x439443[_0x5483('0x1e')](0xcc)[_0x5483('0x2a')]();});}};}function handleEntityNotFound(_0xc3900d,_0x12ff43){return function(_0x4c5865){if(!_0x4c5865){_0xc3900d['sendStatus'](0x194);}return _0x4c5865;};}function handleError(_0x2f5585,_0x5610cf){_0x5610cf=_0x5610cf||0x1f4;return function(_0x48b925){logger[_0x5483('0x2b')](_0x48b925['stack']);if(_0x48b925['name']){delete _0x48b925['name'];}_0x2f5585[_0x5483('0x1e')](_0x5610cf)[_0x5483('0x2c')](_0x48b925);};}exports[_0x5483('0x2d')]=function(_0x2c3554,_0x13e519){var _0x194bbb={},_0x187f69={},_0xac4b46={'count':0x0,'rows':[]};var _0x38b7df=_[_0x5483('0x2e')](db[_0x5483('0x2f')][_0x5483('0x30')],function(_0x5edb9f){return{'name':_0x5edb9f[_0x5483('0x31')],'type':_0x5edb9f[_0x5483('0x32')][_0x5483('0x33')]};});_0x187f69[_0x5483('0x34')]=_[_0x5483('0x2e')](_0x38b7df,_0x5483('0x35'));_0x187f69[_0x5483('0x36')]=_[_0x5483('0x37')](_0x2c3554[_0x5483('0x36')]);_0x187f69['filters']=_[_0x5483('0x38')](_0x187f69[_0x5483('0x34')],_0x187f69[_0x5483('0x36')]);_0x194bbb[_0x5483('0x39')]=_[_0x5483('0x38')](_0x187f69['model'],qs[_0x5483('0x3a')](_0x2c3554[_0x5483('0x36')][_0x5483('0x3a')]));_0x194bbb[_0x5483('0x39')]=_0x194bbb[_0x5483('0x39')]['length']?_0x194bbb[_0x5483('0x39')]:_0x187f69[_0x5483('0x34')];if(!_0x2c3554[_0x5483('0x36')][_0x5483('0x3b')](_0x5483('0x3c'))){_0x194bbb[_0x5483('0x22')]=qs['limit'](_0x2c3554[_0x5483('0x36')]['limit']);_0x194bbb[_0x5483('0x20')]=qs[_0x5483('0x20')](_0x2c3554[_0x5483('0x36')][_0x5483('0x20')]);}_0x194bbb[_0x5483('0x3d')]=qs[_0x5483('0x3e')](_0x2c3554['query'][_0x5483('0x3e')]);_0x194bbb[_0x5483('0x3f')]=qs[_0x5483('0x40')](_['pick'](_0x2c3554[_0x5483('0x36')],_0x187f69[_0x5483('0x40')]),_0x38b7df);if(_0x2c3554[_0x5483('0x36')][_0x5483('0x41')]){_0x194bbb['where']=_[_0x5483('0x42')](_0x194bbb[_0x5483('0x3f')],{'$or':_[_0x5483('0x2e')](_0x38b7df,function(_0x4bd8d1){if(_0x4bd8d1[_0x5483('0x32')]!==_0x5483('0x43')){var _0x1e4232={};_0x1e4232[_0x4bd8d1['name']]={'$like':'%'+_0x2c3554[_0x5483('0x36')][_0x5483('0x41')]+'%'};return _0x1e4232;}})});}_0x194bbb=_[_0x5483('0x42')]({},_0x194bbb,_0x2c3554[_0x5483('0x44')]);var _0x25f074={'where':_0x194bbb['where']};return db['IntegrationReport'][_0x5483('0x23')](_0x25f074)[_0x5483('0x28')](function(_0x1a9f7f){_0xac4b46[_0x5483('0x23')]=_0x1a9f7f;if(_0x2c3554[_0x5483('0x36')]['includeAll']){_0x194bbb[_0x5483('0x45')]=[{'all':!![]}];}return db[_0x5483('0x2f')][_0x5483('0x46')](_0x194bbb);})['then'](function(_0x580bef){_0xac4b46[_0x5483('0x47')]=_0x580bef;return _0xac4b46;})[_0x5483('0x28')](respondWithFilteredResult(_0x13e519,_0x194bbb))[_0x5483('0x48')](handleError(_0x13e519,null));};exports[_0x5483('0x49')]=function(_0x48372f,_0x102e34){var _0x3769ee={'raw':![],'where':{'id':_0x48372f[_0x5483('0x4a')]['id']}},_0x4b1d8c={};_0x4b1d8c['model']=_[_0x5483('0x37')](db['IntegrationReport'][_0x5483('0x30')]);_0x4b1d8c['query']=_['keys'](_0x48372f['query']);_0x4b1d8c['filters']=_[_0x5483('0x38')](_0x4b1d8c['model'],_0x4b1d8c[_0x5483('0x36')]);_0x3769ee[_0x5483('0x39')]=_[_0x5483('0x38')](_0x4b1d8c[_0x5483('0x34')],qs[_0x5483('0x3a')](_0x48372f[_0x5483('0x36')][_0x5483('0x3a')]));_0x3769ee['attributes']=_0x3769ee[_0x5483('0x39')]['length']?_0x3769ee[_0x5483('0x39')]:_0x4b1d8c[_0x5483('0x34')];if(_0x48372f[_0x5483('0x36')]['includeAll']){_0x3769ee[_0x5483('0x45')]=[{'all':!![]}];}_0x3769ee=_['merge']({},_0x3769ee,_0x48372f[_0x5483('0x44')]);return db[_0x5483('0x2f')][_0x5483('0x4b')](_0x3769ee)[_0x5483('0x28')](handleEntityNotFound(_0x102e34,null))[_0x5483('0x28')](respondWithResult(_0x102e34,null))[_0x5483('0x48')](handleError(_0x102e34,null));};exports[_0x5483('0x4c')]=function(_0x2f629b,_0x121f7a){return db[_0x5483('0x2f')][_0x5483('0x4c')](_0x2f629b[_0x5483('0x4d')],{})[_0x5483('0x28')](respondWithResult(_0x121f7a,0xc9))[_0x5483('0x48')](handleError(_0x121f7a,null));};exports['update']=function(_0x34784f,_0x52333a){if(_0x34784f['body']['id']){delete _0x34784f['body']['id'];}return db['IntegrationReport'][_0x5483('0x4b')]({'where':{'id':_0x34784f[_0x5483('0x4a')]['id']}})[_0x5483('0x28')](handleEntityNotFound(_0x52333a,null))[_0x5483('0x28')](saveUpdates(_0x34784f[_0x5483('0x4d')],null))['then'](respondWithResult(_0x52333a,null))[_0x5483('0x48')](handleError(_0x52333a,null));};exports[_0x5483('0x29')]=function(_0x3b3a37,_0x56de76){return db['IntegrationReport'][_0x5483('0x4b')]({'where':{'id':_0x3b3a37[_0x5483('0x4a')]['id']}})['then'](handleEntityNotFound(_0x56de76,null))[_0x5483('0x28')](removeEntity(_0x56de76,null))[_0x5483('0x48')](handleError(_0x56de76,null));};exports[_0x5483('0x4e')]=function(_0x20050a,_0x52f1e6){return db[_0x5483('0x2f')][_0x5483('0x4e')]()[_0x5483('0x28')](respondWithResult(_0x52f1e6,null))[_0x5483('0x48')](handleError(_0x52f1e6,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 0c33be5..dd1ac73 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 _0x7786=['../../config/logger','api','moment','path','rimraf','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7786,0x1ae));var _0x6778=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7786[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6778('0x0'));var util=require(_0x6778('0x1'));var logger=require(_0x6778('0x2'))(_0x6778('0x3'));var moment=require(_0x6778('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6778('0x5'));var rimraf=require(_0x6778('0x6'));var config=require('../../config/environment');var attributes=require(_0x6778('0x7'));module[_0x6778('0x8')]=function(_0x1b58bd,_0x438977){return _0x1b58bd[_0x6778('0x9')](_0x6778('0xa'),attributes,{'tableName':_0x6778('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63ea=['path','rimraf','../../config/environment','./integrationReport.attributes','define','IntegrationReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x12271d,_0x5dd2b8){var _0x213831=function(_0x554d08){while(--_0x554d08){_0x12271d['push'](_0x12271d['shift']());}};_0x213831(++_0x5dd2b8);}(_0x63ea,0xa2));var _0xa63e=function(_0x5d3780,_0x3fb2ff){_0x5d3780=_0x5d3780-0x0;var _0x5b4e25=_0x63ea[_0x5d3780];return _0x5b4e25;};'use strict';var _=require(_0xa63e('0x0'));var util=require(_0xa63e('0x1'));var logger=require(_0xa63e('0x2'))(_0xa63e('0x3'));var moment=require(_0xa63e('0x4'));var BPromise=require(_0xa63e('0x5'));var rp=require(_0xa63e('0x6'));var fs=require('fs');var path=require(_0xa63e('0x7'));var rimraf=require(_0xa63e('0x8'));var config=require(_0xa63e('0x9'));var attributes=require(_0xa63e('0xa'));module['exports']=function(_0x4106df,_0x21ac53){return _0x4106df[_0xa63e('0xb')](_0xa63e('0xc'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index dfb7762..7da4ea7 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 _0xda19=['error','message','info','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x47e439,_0x17f879){var _0x2ff1b7=function(_0xa1153c){while(--_0xa1153c){_0x47e439['push'](_0x47e439['shift']());}};_0x2ff1b7(++_0x17f879);}(_0xda19,0xd5));var _0x9da1=function(_0x1d0024,_0x3bcd79){_0x1d0024=_0x1d0024-0x0;var _0x26e247=_0xda19[_0x1d0024];return _0x26e247;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e4f7,_0x2c3cdd,_0x1c24e6){return new BPromise(function(_0x5e2d18,_0x47df89){return client['request'](_0x23e4f7,_0x1c24e6)['then'](function(_0x417312){logger['info'](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));logger[_0x9da1('0xc')](_0x9da1('0xd'),_0x2c3cdd,_0x9da1('0xb'),JSON[_0x9da1('0xe')](_0x417312));if(_0x417312[_0x9da1('0xf')]){if(_0x417312['error']['code']===0x1f4){logger[_0x9da1('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x2c3cdd,_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);return _0x47df89(_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);}logger['error'](_0x9da1('0xa'),_0x2c3cdd,_0x417312['error']['message']);return _0x5e2d18(_0x417312[_0x9da1('0xf')]['message']);}else{logger[_0x9da1('0x11')](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));_0x5e2d18(_0x417312[_0x9da1('0x12')][_0x9da1('0x10')]);}})['catch'](function(_0x16f75a){logger[_0x9da1('0xf')](_0x9da1('0xa'),_0x2c3cdd,_0x16f75a);_0x47df89(_0x16f75a);});});} \ No newline at end of file +var _0xc6ac=['http','request','then','info','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x136c8d,_0x21bd05){var _0xef24d0=function(_0xbc19f){while(--_0xbc19f){_0x136c8d['push'](_0x136c8d['shift']());}};_0xef24d0(++_0x21bd05);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x76af14,_0x308072){_0x76af14=_0x76af14-0x0;var _0xb0772a=_0xc6ac[_0x76af14];return _0xb0772a;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 791e187..828bd1a 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 _0xe444=['addIntervals','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','./interval.controller','get','isAuthenticated','/:id','getIntervals','post','create','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xe444,0xe0));var _0x4e44=function(_0x4a0be6,_0x488a9f){_0x4a0be6=_0x4a0be6-0x0;var _0x2e9616=_0xe444[_0x4a0be6];return _0x2e9616;};'use strict';var multer=require(_0x4e44('0x0'));var util=require(_0x4e44('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4e44('0x2'));var router=express[_0x4e44('0x3')]();var fs_extra=require(_0x4e44('0x4'));var auth=require(_0x4e44('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4e44('0x6'));router[_0x4e44('0x7')]('/',auth[_0x4e44('0x8')](),controller['index']);router[_0x4e44('0x7')](_0x4e44('0x9'),auth[_0x4e44('0x8')](),controller['show']);router[_0x4e44('0x7')]('/:id/sub_intervals',auth[_0x4e44('0x8')](),controller[_0x4e44('0xa')]);router[_0x4e44('0xb')]('/',auth[_0x4e44('0x8')](),controller[_0x4e44('0xc')]);router['post'](_0x4e44('0xd'),auth['isAuthenticated'](),controller[_0x4e44('0xe')]);router[_0x4e44('0xb')](_0x4e44('0xf'),auth[_0x4e44('0x8')](),controller[_0x4e44('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4e44('0x11')]);router['delete'](_0x4e44('0x9'),auth[_0x4e44('0x8')](),controller[_0x4e44('0x12')]);module[_0x4e44('0x13')]=router; \ No newline at end of file +var _0x908e=['getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/sub_intervals'];(function(_0x547035,_0x421a9d){var _0x4d55cd=function(_0x3fe2bb){while(--_0x3fe2bb){_0x547035['push'](_0x547035['shift']());}};_0x4d55cd(++_0x421a9d);}(_0x908e,0x182));var _0xe908=function(_0x43884a,_0x154135){_0x43884a=_0x43884a-0x0;var _0x55c82a=_0x908e[_0x43884a];return _0x55c82a;};'use strict';var multer=require(_0xe908('0x0'));var util=require(_0xe908('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe908('0x2'));var router=express[_0xe908('0x3')]();var fs_extra=require(_0xe908('0x4'));var auth=require(_0xe908('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe908('0x6'));var controller=require('./interval.controller');router['get']('/',auth[_0xe908('0x7')](),controller[_0xe908('0x8')]);router[_0xe908('0x9')](_0xe908('0xa'),auth[_0xe908('0x7')](),controller[_0xe908('0xb')]);router['get'](_0xe908('0xc'),auth['isAuthenticated'](),controller[_0xe908('0xd')]);router[_0xe908('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe908('0xe')](_0xe908('0xc'),auth[_0xe908('0x7')](),controller[_0xe908('0xf')]);router[_0xe908('0xe')](_0xe908('0x10'),auth[_0xe908('0x7')](),controller[_0xe908('0x11')]);router['put']('/:id',auth[_0xe908('0x7')](),controller['update']);router[_0xe908('0x12')](_0xe908('0xa'),auth[_0xe908('0x7')](),controller[_0xe908('0x13')]);module[_0xe908('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 0710672..afd9384 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 _0xe265=['STRING'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xe265,0x99));var _0x5e26=function(_0x5bd7ea,_0x3639b7){_0x5bd7ea=_0x5bd7ea-0x0;var _0x5a6044=_0xe265[_0x5bd7ea];return _0x5a6044;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5e26('0x0')]},'description':{'type':Sequelize[_0x5e26('0x0')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xbd37=['exports','STRING'];(function(_0x5ea8e4,_0x52a367){var _0x180817=function(_0x5e5046){while(--_0x5e5046){_0x5ea8e4['push'](_0x5ea8e4['shift']());}};_0x180817(++_0x52a367);}(_0xbd37,0x124));var _0x7bd3=function(_0x311f9d,_0x653511){_0x311f9d=_0x311f9d-0x0;var _0x4a64c2=_0xbd37[_0x311f9d];return _0x4a64c2;};'use strict';var Sequelize=require('sequelize');module[_0x7bd3('0x0')]={'name':{'type':Sequelize[_0x7bd3('0x1')]},'description':{'type':Sequelize[_0x7bd3('0x1')]},'interval':{'type':Sequelize[_0x7bd3('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 27c09ca..f5bf2a5 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 _0xe93d=['order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addInterval','getIntervals','findOne','hasOwnProperty','nolimit','addIntervals','transaction','IntervalId','bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','destroy','then','get','Intervals','UserProfileResource','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0x3412ab,_0x5a2b22){var _0x37ad1d=function(_0x46ef9b){while(--_0x46ef9b){_0x3412ab['push'](_0x3412ab['shift']());}};_0x37ad1d(++_0x5a2b22);}(_0xe93d,0x137));var _0xde93=function(_0xed61e8,_0x262f51){_0xed61e8=_0xed61e8-0x0;var _0x20abf0=_0xe93d[_0xed61e8];return _0x20abf0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xde93('0x0'));var zipdir=require(_0xde93('0x1'));var jsonpatch=require(_0xde93('0x2'));var rp=require(_0xde93('0x3'));var moment=require(_0xde93('0x4'));var BPromise=require(_0xde93('0x5'));var Mustache=require(_0xde93('0x6'));var util=require(_0xde93('0x7'));var path=require(_0xde93('0x8'));var sox=require(_0xde93('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xde93('0xa'));var squel=require(_0xde93('0xb'));var crypto=require(_0xde93('0xc'));var jsforce=require(_0xde93('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xde93('0xe'));var querystring=require(_0xde93('0xf'));var Papa=require(_0xde93('0x10'));var Redis=require(_0xde93('0x11'));var authService=require(_0xde93('0x12'));var qs=require(_0xde93('0x13'));var as=require(_0xde93('0x14'));var hardwareService=require(_0xde93('0x15'));var logger=require(_0xde93('0x16'))(_0xde93('0x17'));var utils=require(_0xde93('0x18'));var config=require(_0xde93('0x19'));var licenseUtil=require(_0xde93('0x1a'));var db=require('../../mysqldb')['db'];var extensions=require(_0xde93('0x1b'));function respondWithStatusCode(_0x26ecc7,_0x514f40){_0x514f40=_0x514f40||0xcc;return function(_0xdcc907){if(_0xdcc907){return _0x26ecc7[_0xde93('0x1c')](_0x514f40);}return _0x26ecc7[_0xde93('0x1d')](_0x514f40)['end']();};}function respondWithResult(_0x544340,_0x1c8b6a){_0x1c8b6a=_0x1c8b6a||0xc8;return function(_0x564b92){if(_0x564b92){return _0x544340['status'](_0x1c8b6a)[_0xde93('0x1e')](_0x564b92);}};}function respondWithFilteredResult(_0x5ee5c4,_0x50d645){return function(_0x57f244){if(_0x57f244){var _0x3565a0=typeof _0x50d645['offset']===_0xde93('0x1f')&&typeof _0x50d645[_0xde93('0x20')]===_0xde93('0x1f');var _0x268fd7=_0x57f244[_0xde93('0x21')];var _0x268a8d=_0x3565a0?0x0:_0x50d645['offset'];var _0x4e0f25=_0x3565a0?_0x57f244[_0xde93('0x21')]:_0x50d645[_0xde93('0x22')]+_0x50d645[_0xde93('0x20')];var _0x30b3d2;if(_0x4e0f25>=_0x268fd7){_0x4e0f25=_0x268fd7;_0x30b3d2=0xc8;}else{_0x30b3d2=0xce;}_0x5ee5c4['status'](_0x30b3d2);return _0x5ee5c4['set'](_0xde93('0x23'),_0x268a8d+'-'+_0x4e0f25+'/'+_0x268fd7)[_0xde93('0x1e')](_0x57f244);}return null;};}function patchUpdates(_0x4be8b7){return function(_0x111050){try{jsonpatch[_0xde93('0x24')](_0x111050,_0x4be8b7,!![]);}catch(_0x32df31){return BPromise[_0xde93('0x25')](_0x32df31);}return _0x111050['save']();};}function saveUpdates(_0x433396,_0x540357){return function(_0x2340d0){if(_0x2340d0){return _0x2340d0['update'](_0x433396)['then'](function(_0x2761d9){return _0x2761d9;});}return null;};}function removeEntity(_0x1bd247,_0x563ead){return function(_0x1c5031){if(_0x1c5031){return _0x1c5031[_0xde93('0x26')]()[_0xde93('0x27')](function(){var _0x595002=_0x1c5031[_0xde93('0x28')]({'plain':!![]});var _0xac28cc=_0xde93('0x29');return db[_0xde93('0x2a')][_0xde93('0x26')]({'where':{'type':_0xac28cc,'resourceId':_0x595002['id']}})['then'](function(){return _0x1c5031;});})[_0xde93('0x27')](function(){_0x1bd247[_0xde93('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbbdf6c,_0xe7d502){return function(_0x169dd4){if(!_0x169dd4){_0xbbdf6c[_0xde93('0x1c')](0x194);}return _0x169dd4;};}function handleError(_0x77ff30,_0x13269d){_0x13269d=_0x13269d||0x1f4;return function(_0x345d69){logger[_0xde93('0x2b')](_0x345d69[_0xde93('0x2c')]);if(_0x345d69['name']){delete _0x345d69[_0xde93('0x2d')];}_0x77ff30[_0xde93('0x1d')](_0x13269d)[_0xde93('0x2e')](_0x345d69);};}exports[_0xde93('0x2f')]=function(_0x4a079e,_0x13eea9){var _0x18cbe2={},_0x2882c5={},_0x4773bf={'count':0x0,'rows':[]};var _0x2a2c46=_[_0xde93('0x30')](db[_0xde93('0x31')][_0xde93('0x32')],function(_0x1e8df7){return{'name':_0x1e8df7[_0xde93('0x33')],'type':_0x1e8df7[_0xde93('0x34')]['key']};});_0x2882c5[_0xde93('0x35')]=_[_0xde93('0x30')](_0x2a2c46,_0xde93('0x2d'));_0x2882c5[_0xde93('0x36')]=_[_0xde93('0x37')](_0x4a079e['query']);_0x2882c5[_0xde93('0x38')]=_[_0xde93('0x39')](_0x2882c5[_0xde93('0x35')],_0x2882c5[_0xde93('0x36')]);_0x18cbe2['attributes']=_[_0xde93('0x39')](_0x2882c5[_0xde93('0x35')],qs[_0xde93('0x3a')](_0x4a079e[_0xde93('0x36')][_0xde93('0x3a')]));_0x18cbe2[_0xde93('0x3b')]=_0x18cbe2[_0xde93('0x3b')][_0xde93('0x3c')]?_0x18cbe2[_0xde93('0x3b')]:_0x2882c5[_0xde93('0x35')];if(!_0x4a079e[_0xde93('0x36')]['hasOwnProperty']('nolimit')){_0x18cbe2['limit']=qs['limit'](_0x4a079e['query'][_0xde93('0x20')]);_0x18cbe2['offset']=qs[_0xde93('0x22')](_0x4a079e[_0xde93('0x36')][_0xde93('0x22')]);}_0x18cbe2[_0xde93('0x3d')]=qs[_0xde93('0x3e')](_0x4a079e[_0xde93('0x36')][_0xde93('0x3e')]);_0x18cbe2['where']=qs[_0xde93('0x38')](_[_0xde93('0x3f')](_0x4a079e[_0xde93('0x36')],_0x2882c5[_0xde93('0x38')]),_0x2a2c46);if(_0x4a079e[_0xde93('0x36')][_0xde93('0x40')]){_0x18cbe2[_0xde93('0x41')]=_[_0xde93('0x42')](_0x18cbe2[_0xde93('0x41')],{'$or':_['map'](_0x2a2c46,function(_0x4c5018){if(_0x4c5018[_0xde93('0x34')]!=='VIRTUAL'){var _0x161461={};_0x161461[_0x4c5018[_0xde93('0x2d')]]={'$like':'%'+_0x4a079e[_0xde93('0x36')][_0xde93('0x40')]+'%'};return _0x161461;}})});}_0x18cbe2=_[_0xde93('0x42')]({},_0x18cbe2,_0x4a079e['options']);var _0x5d6c1e={'where':_0x18cbe2[_0xde93('0x41')]};return db[_0xde93('0x31')][_0xde93('0x21')](_0x5d6c1e)['then'](function(_0x2c6a73){_0x4773bf[_0xde93('0x21')]=_0x2c6a73;if(_0x4a079e[_0xde93('0x36')][_0xde93('0x43')]){_0x18cbe2[_0xde93('0x44')]=[{'all':!![]}];}return db[_0xde93('0x31')][_0xde93('0x45')](_0x18cbe2);})[_0xde93('0x27')](function(_0x536344){_0x4773bf[_0xde93('0x46')]=_0x536344;return _0x4773bf;})['then'](respondWithFilteredResult(_0x13eea9,_0x18cbe2))[_0xde93('0x47')](handleError(_0x13eea9,null));};exports[_0xde93('0x48')]=function(_0xfc5bb1,_0x525e23){var _0x376332={'raw':!![],'where':{'id':_0xfc5bb1['params']['id']}},_0x50e262={};_0x50e262[_0xde93('0x35')]=_[_0xde93('0x37')](db[_0xde93('0x31')][_0xde93('0x32')]);_0x50e262['query']=_[_0xde93('0x37')](_0xfc5bb1[_0xde93('0x36')]);_0x50e262[_0xde93('0x38')]=_[_0xde93('0x39')](_0x50e262[_0xde93('0x35')],_0x50e262['query']);_0x376332[_0xde93('0x3b')]=_['intersection'](_0x50e262[_0xde93('0x35')],qs['fields'](_0xfc5bb1[_0xde93('0x36')]['fields']));_0x376332[_0xde93('0x3b')]=_0x376332['attributes'][_0xde93('0x3c')]?_0x376332['attributes']:_0x50e262[_0xde93('0x35')];if(_0xfc5bb1[_0xde93('0x36')]['includeAll']){_0x376332[_0xde93('0x44')]=[{'all':!![]}];}_0x376332=_[_0xde93('0x42')]({},_0x376332,_0xfc5bb1[_0xde93('0x49')]);return db[_0xde93('0x31')][_0xde93('0x4a')](_0x376332)['then'](handleEntityNotFound(_0x525e23,null))[_0xde93('0x27')](respondWithResult(_0x525e23,null))[_0xde93('0x47')](handleError(_0x525e23,null));};exports[_0xde93('0x4b')]=function(_0x423722,_0x34dcb9){return db[_0xde93('0x31')][_0xde93('0x4b')](_0x423722['body'],{})[_0xde93('0x27')](function(_0x412110){var _0x424051=_0x423722['user']['get']({'plain':!![]});if(!_0x424051)throw new Error(_0xde93('0x4c'));if(_0x424051[_0xde93('0x4d')]===_0xde93('0x4e')){var _0x55ee93=_0x412110[_0xde93('0x28')]({'plain':!![]});var _0x44f733='Intervals';return db[_0xde93('0x4f')][_0xde93('0x4a')]({'where':{'name':_0x44f733,'userProfileId':_0x424051[_0xde93('0x50')]},'raw':!![]})['then'](function(_0x77585c){if(_0x77585c&&_0x77585c['autoAssociation']===0x0){return db[_0xde93('0x2a')]['create']({'name':_0x55ee93['name'],'resourceId':_0x55ee93['id'],'type':_0x77585c[_0xde93('0x2d')],'sectionId':_0x77585c['id']},{})[_0xde93('0x27')](function(){return _0x412110;});}else{return _0x412110;}})[_0xde93('0x47')](function(_0x179142){logger[_0xde93('0x2b')](_0xde93('0x51'),_0x179142);throw _0x179142;});}return _0x412110;})[_0xde93('0x27')](respondWithResult(_0x34dcb9,0xc9))['catch'](handleError(_0x34dcb9,null));};exports['update']=function(_0x5de847,_0x2e6a20){if(_0x5de847['body']['id']){delete _0x5de847[_0xde93('0x52')]['id'];}return db[_0xde93('0x31')]['find']({'where':{'id':_0x5de847[_0xde93('0x53')]['id']}})['then'](handleEntityNotFound(_0x2e6a20,null))[_0xde93('0x27')](saveUpdates(_0x5de847[_0xde93('0x52')],null))[_0xde93('0x27')](respondWithResult(_0x2e6a20,null))[_0xde93('0x47')](handleError(_0x2e6a20,null));};exports[_0xde93('0x26')]=function(_0xa475bd,_0x162319){return db['Interval'][_0xde93('0x4a')]({'where':{'id':_0xa475bd[_0xde93('0x53')]['id']}})[_0xde93('0x27')](handleEntityNotFound(_0x162319,null))[_0xde93('0x27')](removeEntity(_0x162319,null))[_0xde93('0x47')](handleError(_0x162319,null));};exports[_0xde93('0x54')]=function(_0x8394e1,_0x46a22a,_0x1691de){if(_0x8394e1['body']['id']){delete _0x8394e1[_0xde93('0x52')]['id'];}return db['Interval'][_0xde93('0x4a')]({'where':{'id':_0x8394e1[_0xde93('0x53')]['id']}})[_0xde93('0x27')](handleEntityNotFound(_0x46a22a,null))[_0xde93('0x27')](function(_0xaef22){if(_0xaef22){_0x8394e1['body']['IntervalId']=_0xaef22['id'];return db[_0xde93('0x31')][_0xde93('0x4b')](_0x8394e1[_0xde93('0x52')]);}})[_0xde93('0x27')](respondWithResult(_0x46a22a,null))[_0xde93('0x47')](handleError(_0x46a22a,null));};exports[_0xde93('0x55')]=function(_0x3f241b,_0x156e05,_0xe9a0da){var _0x23599e={};var _0x272d83={};var _0x336fc0;var _0xe0585d;return db['Interval'][_0xde93('0x56')]({'where':{'id':_0x3f241b[_0xde93('0x53')]['id']}})['then'](handleEntityNotFound(_0x156e05,null))[_0xde93('0x27')](function(_0xf9dd1){if(_0xf9dd1){_0x336fc0=_0xf9dd1;_0x272d83[_0xde93('0x35')]=_[_0xde93('0x37')](db[_0xde93('0x31')][_0xde93('0x32')]);_0x272d83[_0xde93('0x36')]=_[_0xde93('0x37')](_0x3f241b['query']);_0x272d83[_0xde93('0x38')]=_[_0xde93('0x39')](_0x272d83[_0xde93('0x35')],_0x272d83[_0xde93('0x36')]);_0x23599e[_0xde93('0x3b')]=_[_0xde93('0x39')](_0x272d83[_0xde93('0x35')],qs[_0xde93('0x3a')](_0x3f241b[_0xde93('0x36')][_0xde93('0x3a')]));_0x23599e[_0xde93('0x3b')]=_0x23599e[_0xde93('0x3b')][_0xde93('0x3c')]?_0x23599e[_0xde93('0x3b')]:_0x272d83['model'];_0x23599e[_0xde93('0x3d')]=qs[_0xde93('0x3e')](_0x3f241b[_0xde93('0x36')][_0xde93('0x3e')]);_0x23599e['where']=qs[_0xde93('0x38')](_[_0xde93('0x3f')](_0x3f241b[_0xde93('0x36')],_0x272d83['filters']));if(_0x3f241b['query'][_0xde93('0x40')]){_0x23599e['where']=_[_0xde93('0x42')](_0x23599e[_0xde93('0x41')],{'$or':_[_0xde93('0x30')](_0x23599e[_0xde93('0x3b')],function(_0x24c8ce){var _0x324586={};_0x324586[_0x24c8ce]={'$like':'%'+_0x3f241b['query'][_0xde93('0x40')]+'%'};return _0x324586;})});}_0x23599e=_[_0xde93('0x42')]({},_0x23599e,_0x3f241b[_0xde93('0x49')]);return _0x336fc0[_0xde93('0x55')](_0x23599e);}})['then'](function(_0x793e34){if(_0x793e34){_0xe0585d=_0x793e34[_0xde93('0x3c')];if(!_0x3f241b[_0xde93('0x36')][_0xde93('0x57')](_0xde93('0x58'))){_0x23599e[_0xde93('0x20')]=qs[_0xde93('0x20')](_0x3f241b['query'][_0xde93('0x20')]);_0x23599e['offset']=qs['offset'](_0x3f241b[_0xde93('0x36')]['offset']);}return _0x336fc0[_0xde93('0x55')](_0x23599e);}})['then'](function(_0x23036d){if(_0x23036d){return _0x23036d?{'count':_0xe0585d,'rows':_0x23036d}:null;}})['then'](respondWithResult(_0x156e05,null))[_0xde93('0x47')](handleError(_0x156e05,null));};exports[_0xde93('0x59')]=function(_0x28a6d8,_0x31fa71,_0x417d3a){return db['Interval']['findOne']({'where':{'id':_0x28a6d8['params']['id']}})[_0xde93('0x27')](handleEntityNotFound(_0x31fa71,null))['then'](function(_0x17a1f5){if(_0x17a1f5){return db['sequelize'][_0xde93('0x5a')](function(_0x206134){return db['Interval']['destroy']({'where':{'IntervalId':_0x28a6d8['params']['id']},'transaction':_0x206134})['then'](function(_0x48e53c){var _0x4ef3c5=_[_0xde93('0x30')](_0x28a6d8['body'],function(_0x749169){delete _0x749169['id'];_0x749169[_0xde93('0x5b')]=_0x28a6d8['params']['id'];return _0x749169;});return db[_0xde93('0x31')][_0xde93('0x5c')](_0x4ef3c5,{'transaction':_0x206134});});})[_0xde93('0x27')](function(){return db[_0xde93('0x31')][_0xde93('0x45')]({'where':{'IntervalId':_0x28a6d8[_0xde93('0x53')]['id']}});});}})['then'](respondWithResult(_0x31fa71,null))[_0xde93('0x47')](handleError(_0x31fa71,null));}; \ No newline at end of file +var _0xc990=['util','path','to-csv','ejs','fs-extra','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','json','offset','undefined','limit','count','status','apply','then','destroy','Intervals','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','Interval','includeAll','include','findAll','show','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','params','IntervalId','getIntervals','findOne','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x25d092,_0x469bd3){var _0x3d20e5=function(_0x2afa1a){while(--_0x2afa1a){_0x25d092['push'](_0x25d092['shift']());}};_0x3d20e5(++_0x469bd3);}(_0xc990,0x9c));var _0x0c99=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc990[_0x4d613c];return _0x301fe3;};'use strict';var emlformat=require(_0x0c99('0x0'));var rimraf=require(_0x0c99('0x1'));var zipdir=require(_0x0c99('0x2'));var jsonpatch=require(_0x0c99('0x3'));var rp=require('request-promise');var moment=require(_0x0c99('0x4'));var BPromise=require(_0x0c99('0x5'));var Mustache=require('mustache');var util=require(_0x0c99('0x6'));var path=require(_0x0c99('0x7'));var sox=require('sox');var csv=require(_0x0c99('0x8'));var ejs=require(_0x0c99('0x9'));var fs=require('fs');var fs_extra=require(_0x0c99('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0c99('0x8'));var querystring=require(_0x0c99('0xb'));var Papa=require(_0x0c99('0xc'));var Redis=require(_0x0c99('0xd'));var authService=require(_0x0c99('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0c99('0xf'));var hardwareService=require(_0x0c99('0x10'));var logger=require(_0x0c99('0x11'))(_0x0c99('0x12'));var utils=require('../../config/utils');var config=require(_0x0c99('0x13'));var licenseUtil=require(_0x0c99('0x14'));var db=require(_0x0c99('0x15'))['db'];var extensions=require(_0x0c99('0x16'));function respondWithStatusCode(_0x37d660,_0x2b31de){_0x2b31de=_0x2b31de||0xcc;return function(_0x34a21d){if(_0x34a21d){return _0x37d660[_0x0c99('0x17')](_0x2b31de);}return _0x37d660['status'](_0x2b31de)[_0x0c99('0x18')]();};}function respondWithResult(_0x2b55a2,_0x298afb){_0x298afb=_0x298afb||0xc8;return function(_0x3e6a50){if(_0x3e6a50){return _0x2b55a2['status'](_0x298afb)[_0x0c99('0x19')](_0x3e6a50);}};}function respondWithFilteredResult(_0x125577,_0x1e765a){return function(_0x3e693f){if(_0x3e693f){var _0x514818=typeof _0x1e765a[_0x0c99('0x1a')]===_0x0c99('0x1b')&&typeof _0x1e765a[_0x0c99('0x1c')]===_0x0c99('0x1b');var _0x482821=_0x3e693f[_0x0c99('0x1d')];var _0x3ba8a9=_0x514818?0x0:_0x1e765a[_0x0c99('0x1a')];var _0x525935=_0x514818?_0x3e693f[_0x0c99('0x1d')]:_0x1e765a[_0x0c99('0x1a')]+_0x1e765a['limit'];var _0x1131cc;if(_0x525935>=_0x482821){_0x525935=_0x482821;_0x1131cc=0xc8;}else{_0x1131cc=0xce;}_0x125577[_0x0c99('0x1e')](_0x1131cc);return _0x125577['set']('Content-Range',_0x3ba8a9+'-'+_0x525935+'/'+_0x482821)['json'](_0x3e693f);}return null;};}function patchUpdates(_0x546c3d){return function(_0x2397b2){try{jsonpatch[_0x0c99('0x1f')](_0x2397b2,_0x546c3d,!![]);}catch(_0x461c61){return BPromise['reject'](_0x461c61);}return _0x2397b2['save']();};}function saveUpdates(_0x1eda7d,_0x3eb1d0){return function(_0x2db17d){if(_0x2db17d){return _0x2db17d['update'](_0x1eda7d)[_0x0c99('0x20')](function(_0x13ca0f){return _0x13ca0f;});}return null;};}function removeEntity(_0x1935b0,_0x50961c){return function(_0x15f6cf){if(_0x15f6cf){return _0x15f6cf[_0x0c99('0x21')]()[_0x0c99('0x20')](function(){var _0x445242=_0x15f6cf['get']({'plain':!![]});var _0x39abec=_0x0c99('0x22');return db[_0x0c99('0x23')][_0x0c99('0x21')]({'where':{'type':_0x39abec,'resourceId':_0x445242['id']}})['then'](function(){return _0x15f6cf;});})[_0x0c99('0x20')](function(){_0x1935b0[_0x0c99('0x1e')](0xcc)[_0x0c99('0x18')]();});}};}function handleEntityNotFound(_0xd139c3,_0x225a13){return function(_0x4dadcf){if(!_0x4dadcf){_0xd139c3[_0x0c99('0x17')](0x194);}return _0x4dadcf;};}function handleError(_0x55d5b8,_0x8c1a94){_0x8c1a94=_0x8c1a94||0x1f4;return function(_0x330d09){logger[_0x0c99('0x24')](_0x330d09[_0x0c99('0x25')]);if(_0x330d09[_0x0c99('0x26')]){delete _0x330d09[_0x0c99('0x26')];}_0x55d5b8[_0x0c99('0x1e')](_0x8c1a94)[_0x0c99('0x27')](_0x330d09);};}exports[_0x0c99('0x28')]=function(_0x5e6dfd,_0x59a9f4){var _0x3a0350={},_0x56e5fb={},_0x5be729={'count':0x0,'rows':[]};var _0xd5f36e=_[_0x0c99('0x29')](db['Interval'][_0x0c99('0x2a')],function(_0x284a16){return{'name':_0x284a16['fieldName'],'type':_0x284a16[_0x0c99('0x2b')]['key']};});_0x56e5fb[_0x0c99('0x2c')]=_[_0x0c99('0x29')](_0xd5f36e,'name');_0x56e5fb[_0x0c99('0x2d')]=_[_0x0c99('0x2e')](_0x5e6dfd[_0x0c99('0x2d')]);_0x56e5fb['filters']=_[_0x0c99('0x2f')](_0x56e5fb[_0x0c99('0x2c')],_0x56e5fb[_0x0c99('0x2d')]);_0x3a0350[_0x0c99('0x30')]=_[_0x0c99('0x2f')](_0x56e5fb[_0x0c99('0x2c')],qs['fields'](_0x5e6dfd[_0x0c99('0x2d')][_0x0c99('0x31')]));_0x3a0350[_0x0c99('0x30')]=_0x3a0350['attributes'][_0x0c99('0x32')]?_0x3a0350['attributes']:_0x56e5fb[_0x0c99('0x2c')];if(!_0x5e6dfd['query'][_0x0c99('0x33')](_0x0c99('0x34'))){_0x3a0350['limit']=qs[_0x0c99('0x1c')](_0x5e6dfd['query'][_0x0c99('0x1c')]);_0x3a0350['offset']=qs[_0x0c99('0x1a')](_0x5e6dfd[_0x0c99('0x2d')][_0x0c99('0x1a')]);}_0x3a0350[_0x0c99('0x35')]=qs['sort'](_0x5e6dfd[_0x0c99('0x2d')][_0x0c99('0x36')]);_0x3a0350[_0x0c99('0x37')]=qs[_0x0c99('0x38')](_[_0x0c99('0x39')](_0x5e6dfd[_0x0c99('0x2d')],_0x56e5fb[_0x0c99('0x38')]),_0xd5f36e);if(_0x5e6dfd['query'][_0x0c99('0x3a')]){_0x3a0350[_0x0c99('0x37')]=_['merge'](_0x3a0350['where'],{'$or':_[_0x0c99('0x29')](_0xd5f36e,function(_0x41e07c){if(_0x41e07c[_0x0c99('0x2b')]!==_0x0c99('0x3b')){var _0x410d48={};_0x410d48[_0x41e07c[_0x0c99('0x26')]]={'$like':'%'+_0x5e6dfd[_0x0c99('0x2d')][_0x0c99('0x3a')]+'%'};return _0x410d48;}})});}_0x3a0350=_[_0x0c99('0x3c')]({},_0x3a0350,_0x5e6dfd['options']);var _0x3700ed={'where':_0x3a0350['where']};return db[_0x0c99('0x3d')][_0x0c99('0x1d')](_0x3700ed)['then'](function(_0x2b6db6){_0x5be729[_0x0c99('0x1d')]=_0x2b6db6;if(_0x5e6dfd['query'][_0x0c99('0x3e')]){_0x3a0350[_0x0c99('0x3f')]=[{'all':!![]}];}return db[_0x0c99('0x3d')][_0x0c99('0x40')](_0x3a0350);})['then'](function(_0x578d80){_0x5be729['rows']=_0x578d80;return _0x5be729;})[_0x0c99('0x20')](respondWithFilteredResult(_0x59a9f4,_0x3a0350))['catch'](handleError(_0x59a9f4,null));};exports[_0x0c99('0x41')]=function(_0x3b1ae6,_0x490f8e){var _0x127ddb={'raw':!![],'where':{'id':_0x3b1ae6['params']['id']}},_0x58e424={};_0x58e424['model']=_['keys'](db['Interval'][_0x0c99('0x2a')]);_0x58e424['query']=_[_0x0c99('0x2e')](_0x3b1ae6[_0x0c99('0x2d')]);_0x58e424[_0x0c99('0x38')]=_[_0x0c99('0x2f')](_0x58e424[_0x0c99('0x2c')],_0x58e424[_0x0c99('0x2d')]);_0x127ddb[_0x0c99('0x30')]=_[_0x0c99('0x2f')](_0x58e424['model'],qs[_0x0c99('0x31')](_0x3b1ae6[_0x0c99('0x2d')][_0x0c99('0x31')]));_0x127ddb['attributes']=_0x127ddb[_0x0c99('0x30')][_0x0c99('0x32')]?_0x127ddb[_0x0c99('0x30')]:_0x58e424[_0x0c99('0x2c')];if(_0x3b1ae6['query']['includeAll']){_0x127ddb[_0x0c99('0x3f')]=[{'all':!![]}];}_0x127ddb=_[_0x0c99('0x3c')]({},_0x127ddb,_0x3b1ae6[_0x0c99('0x42')]);return db[_0x0c99('0x3d')][_0x0c99('0x43')](_0x127ddb)[_0x0c99('0x20')](handleEntityNotFound(_0x490f8e,null))[_0x0c99('0x20')](respondWithResult(_0x490f8e,null))[_0x0c99('0x44')](handleError(_0x490f8e,null));};exports[_0x0c99('0x45')]=function(_0x22c59d,_0x30fa72){return db['Interval']['create'](_0x22c59d[_0x0c99('0x46')],{})['then'](function(_0x454146){var _0x2952c6=_0x22c59d[_0x0c99('0x47')][_0x0c99('0x48')]({'plain':!![]});if(!_0x2952c6)throw new Error(_0x0c99('0x49'));if(_0x2952c6[_0x0c99('0x4a')]===_0x0c99('0x47')){var _0xa53712=_0x454146[_0x0c99('0x48')]({'plain':!![]});var _0x2ee8cf=_0x0c99('0x22');return db['UserProfileSection'][_0x0c99('0x43')]({'where':{'name':_0x2ee8cf,'userProfileId':_0x2952c6['userProfileId']},'raw':!![]})[_0x0c99('0x20')](function(_0x4616cc){if(_0x4616cc&&_0x4616cc[_0x0c99('0x4b')]===0x0){return db[_0x0c99('0x23')][_0x0c99('0x45')]({'name':_0xa53712['name'],'resourceId':_0xa53712['id'],'type':_0x4616cc[_0x0c99('0x26')],'sectionId':_0x4616cc['id']},{})[_0x0c99('0x20')](function(){return _0x454146;});}else{return _0x454146;}})[_0x0c99('0x44')](function(_0x34a7ef){logger[_0x0c99('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34a7ef);throw _0x34a7ef;});}return _0x454146;})['then'](respondWithResult(_0x30fa72,0xc9))['catch'](handleError(_0x30fa72,null));};exports['update']=function(_0x43b3ae,_0x550270){if(_0x43b3ae[_0x0c99('0x46')]['id']){delete _0x43b3ae[_0x0c99('0x46')]['id'];}return db['Interval']['find']({'where':{'id':_0x43b3ae[_0x0c99('0x4c')]['id']}})[_0x0c99('0x20')](handleEntityNotFound(_0x550270,null))['then'](saveUpdates(_0x43b3ae[_0x0c99('0x46')],null))[_0x0c99('0x20')](respondWithResult(_0x550270,null))[_0x0c99('0x44')](handleError(_0x550270,null));};exports[_0x0c99('0x21')]=function(_0x4d4235,_0xb9d613){return db[_0x0c99('0x3d')][_0x0c99('0x43')]({'where':{'id':_0x4d4235[_0x0c99('0x4c')]['id']}})[_0x0c99('0x20')](handleEntityNotFound(_0xb9d613,null))[_0x0c99('0x20')](removeEntity(_0xb9d613,null))['catch'](handleError(_0xb9d613,null));};exports['addInterval']=function(_0x569919,_0xfcdab8,_0x5a7783){if(_0x569919[_0x0c99('0x46')]['id']){delete _0x569919[_0x0c99('0x46')]['id'];}return db[_0x0c99('0x3d')][_0x0c99('0x43')]({'where':{'id':_0x569919[_0x0c99('0x4c')]['id']}})[_0x0c99('0x20')](handleEntityNotFound(_0xfcdab8,null))[_0x0c99('0x20')](function(_0x318324){if(_0x318324){_0x569919[_0x0c99('0x46')][_0x0c99('0x4d')]=_0x318324['id'];return db[_0x0c99('0x3d')]['create'](_0x569919[_0x0c99('0x46')]);}})['then'](respondWithResult(_0xfcdab8,null))[_0x0c99('0x44')](handleError(_0xfcdab8,null));};exports[_0x0c99('0x4e')]=function(_0x11b191,_0x31ec0f,_0x23c2a5){var _0x1c3723={};var _0x26687f={};var _0x16f233;var _0x33d77e;return db[_0x0c99('0x3d')]['findOne']({'where':{'id':_0x11b191[_0x0c99('0x4c')]['id']}})[_0x0c99('0x20')](handleEntityNotFound(_0x31ec0f,null))['then'](function(_0x77dfe7){if(_0x77dfe7){_0x16f233=_0x77dfe7;_0x26687f[_0x0c99('0x2c')]=_[_0x0c99('0x2e')](db['Interval']['rawAttributes']);_0x26687f[_0x0c99('0x2d')]=_[_0x0c99('0x2e')](_0x11b191[_0x0c99('0x2d')]);_0x26687f['filters']=_[_0x0c99('0x2f')](_0x26687f[_0x0c99('0x2c')],_0x26687f[_0x0c99('0x2d')]);_0x1c3723['attributes']=_[_0x0c99('0x2f')](_0x26687f[_0x0c99('0x2c')],qs[_0x0c99('0x31')](_0x11b191[_0x0c99('0x2d')]['fields']));_0x1c3723['attributes']=_0x1c3723[_0x0c99('0x30')][_0x0c99('0x32')]?_0x1c3723['attributes']:_0x26687f[_0x0c99('0x2c')];_0x1c3723[_0x0c99('0x35')]=qs[_0x0c99('0x36')](_0x11b191[_0x0c99('0x2d')]['sort']);_0x1c3723['where']=qs['filters'](_[_0x0c99('0x39')](_0x11b191[_0x0c99('0x2d')],_0x26687f[_0x0c99('0x38')]));if(_0x11b191['query']['filter']){_0x1c3723[_0x0c99('0x37')]=_[_0x0c99('0x3c')](_0x1c3723[_0x0c99('0x37')],{'$or':_['map'](_0x1c3723[_0x0c99('0x30')],function(_0x2f7dcb){var _0x237e8b={};_0x237e8b[_0x2f7dcb]={'$like':'%'+_0x11b191['query']['filter']+'%'};return _0x237e8b;})});}_0x1c3723=_['merge']({},_0x1c3723,_0x11b191[_0x0c99('0x42')]);return _0x16f233[_0x0c99('0x4e')](_0x1c3723);}})[_0x0c99('0x20')](function(_0x19c573){if(_0x19c573){_0x33d77e=_0x19c573[_0x0c99('0x32')];if(!_0x11b191[_0x0c99('0x2d')][_0x0c99('0x33')]('nolimit')){_0x1c3723['limit']=qs[_0x0c99('0x1c')](_0x11b191[_0x0c99('0x2d')][_0x0c99('0x1c')]);_0x1c3723['offset']=qs[_0x0c99('0x1a')](_0x11b191[_0x0c99('0x2d')][_0x0c99('0x1a')]);}return _0x16f233[_0x0c99('0x4e')](_0x1c3723);}})['then'](function(_0x3a4cc9){if(_0x3a4cc9){return _0x3a4cc9?{'count':_0x33d77e,'rows':_0x3a4cc9}:null;}})[_0x0c99('0x20')](respondWithResult(_0x31ec0f,null))[_0x0c99('0x44')](handleError(_0x31ec0f,null));};exports['addIntervals']=function(_0x4e367d,_0x29959f,_0x3e828a){return db[_0x0c99('0x3d')][_0x0c99('0x4f')]({'where':{'id':_0x4e367d['params']['id']}})[_0x0c99('0x20')](handleEntityNotFound(_0x29959f,null))['then'](function(_0x30ac66){if(_0x30ac66){return db['sequelize']['transaction'](function(_0x3bea63){return db[_0x0c99('0x3d')][_0x0c99('0x21')]({'where':{'IntervalId':_0x4e367d['params']['id']},'transaction':_0x3bea63})[_0x0c99('0x20')](function(_0x1bd5bd){var _0x19799b=_[_0x0c99('0x29')](_0x4e367d[_0x0c99('0x46')],function(_0xfa0ee3){delete _0xfa0ee3['id'];_0xfa0ee3[_0x0c99('0x4d')]=_0x4e367d[_0x0c99('0x4c')]['id'];return _0xfa0ee3;});return db[_0x0c99('0x3d')][_0x0c99('0x50')](_0x19799b,{'transaction':_0x3bea63});});})['then'](function(){return db['Interval'][_0x0c99('0x40')]({'where':{'IntervalId':_0x4e367d[_0x0c99('0x4c')]['id']}});});}})[_0x0c99('0x20')](respondWithResult(_0x29959f,null))[_0x0c99('0x44')](handleError(_0x29959f,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index f3c31fd..ad746cd 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 _0x7ff6=['rewrite','interval','getIntervals','then','all','map','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x7ff6,0x112));var _0x67ff=function(_0x1d1b7c,_0x2243f9){_0x1d1b7c=_0x1d1b7c-0x0;var _0x431465=_0x7ff6[_0x1d1b7c];return _0x431465;};'use strict';var attributes=require(_0x67ff('0x0'));var extensions=require(_0x67ff('0x1'));var iftime=require(_0x67ff('0x2'))[_0x67ff('0x3')];module[_0x67ff('0x4')]=function(_0xa25f5f){return _0xa25f5f[_0x67ff('0x5')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xe34b4){extensions['rewrite'](_0xa25f5f,_0xe34b4);},'afterBulkCreate':function(_0x2cef06,_0x2aafa4,_0x1d3c47){_0x1d3c47();extensions[_0x67ff('0x6')](_0xa25f5f,_0x2cef06[0x0]);},'afterUpdate':function(_0x4fdbac){extensions[_0x67ff('0x6')](_0xa25f5f,_0x4fdbac);},'afterDestroy':function(_0x42c2bf){extensions['rewrite'](_0xa25f5f,_0x42c2bf);}},'instanceMethods':{'ifTime':function(_0xd591fe=undefined,_0x28c747=new Date()){if(typeof this['interval']==='string'){return iftime(this[_0x67ff('0x7')],_0xd591fe,_0x28c747);}else{return this[_0x67ff('0x8')]()[_0x67ff('0x9')](function(_0x5a2848){return Promise[_0x67ff('0xa')](_0x5a2848[_0x67ff('0xb')](function(_0x5d77f3){return _0x5d77f3[_0x67ff('0xc')](_0xd591fe,_0x28c747);}));})[_0x67ff('0x9')](function(_0x3471de){return _0x3471de[_0x67ff('0xd')](function(_0x32d849,_0x47f767){return _0x32d849||_0x47f767;},![]);});}}}});}; \ No newline at end of file +var _0xd527=['reduce','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','interval','string','getIntervals','then','all','map','ifTime'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xd527,0x12d));var _0x7d52=function(_0x3f2d02,_0x2c7deb){_0x3f2d02=_0x3f2d02-0x0;var _0x54092b=_0xd527[_0x3f2d02];return _0x54092b;};'use strict';var attributes=require(_0x7d52('0x0'));var extensions=require(_0x7d52('0x1'));var iftime=require('../../utils/iftime')['iftime'];module[_0x7d52('0x2')]=function(_0x92cef1){return _0x92cef1[_0x7d52('0x3')](_0x7d52('0x4'),attributes,{'tableName':_0x7d52('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2953da){extensions[_0x7d52('0x6')](_0x92cef1,_0x2953da);},'afterBulkCreate':function(_0x1eddf9,_0x57fe26,_0xce5991){_0xce5991();extensions[_0x7d52('0x6')](_0x92cef1,_0x1eddf9[0x0]);},'afterUpdate':function(_0x1a47a4){extensions[_0x7d52('0x6')](_0x92cef1,_0x1a47a4);},'afterDestroy':function(_0x1c2445){extensions[_0x7d52('0x6')](_0x92cef1,_0x1c2445);}},'instanceMethods':{'ifTime':function(_0x5f13ff=undefined,_0x2a6fca=new Date()){if(typeof this[_0x7d52('0x7')]===_0x7d52('0x8')){return iftime(this[_0x7d52('0x7')],_0x5f13ff,_0x2a6fca);}else{return this[_0x7d52('0x9')]()[_0x7d52('0xa')](function(_0x39aca5){return Promise[_0x7d52('0xb')](_0x39aca5[_0x7d52('0xc')](function(_0x4c4c75){return _0x4c4c75[_0x7d52('0xd')](_0x5f13ff,_0x2a6fca);}));})[_0x7d52('0xa')](function(_0x2c6711){return _0x2c6711[_0x7d52('0xe')](function(_0xecf771,_0x3982e0){return _0xecf771||_0x3982e0;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 930dee3..19e4193 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 _0xd861=['IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','silly','reduce','lodash','util','../../mysqldb','../../utils/iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','catch','error','ShowInterval','message','all','ifTime','format','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervals','string','timezone','length'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd861,0x1bc));var _0x1d86=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd861[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x1d86('0x0'));var util=require(_0x1d86('0x1'));var db=require(_0x1d86('0x2'))['db'];var iftime=require(_0x1d86('0x3'))['iftime'];var logger=require(_0x1d86('0x4'))(_0x1d86('0x5'));exports[_0x1d86('0x6')]=function(_0x3dbba2){var _0x28345c=this;return new Promise(function(_0xd911bd,_0x30347d){return db[_0x1d86('0x7')][_0x1d86('0x8')]({'raw':_0x3dbba2[_0x1d86('0x9')]?_0x3dbba2['options'][_0x1d86('0xa')]===undefined?!![]:![]:!![],'where':_0x3dbba2[_0x1d86('0x9')]?_0x3dbba2[_0x1d86('0x9')][_0x1d86('0xb')]||null:null,'attributes':_0x3dbba2[_0x1d86('0x9')]?_0x3dbba2[_0x1d86('0x9')][_0x1d86('0xc')]||null:null,'limit':_0x3dbba2['options']?_0x3dbba2[_0x1d86('0x9')][_0x1d86('0xd')]||null:null,'include':_0x3dbba2[_0x1d86('0x9')]?_0x3dbba2[_0x1d86('0x9')][_0x1d86('0xe')]?_[_0x1d86('0xf')](_0x3dbba2[_0x1d86('0x9')][_0x1d86('0xe')],function(_0xfa142){return{'model':db[_0xfa142['model']],'as':_0xfa142['as'],'attributes':_0xfa142[_0x1d86('0xc')],'include':_0xfa142[_0x1d86('0xe')]?_[_0x1d86('0xf')](_0xfa142[_0x1d86('0xe')],function(_0x38c5d1){return{'model':db[_0x38c5d1[_0x1d86('0x10')]],'as':_0x38c5d1['as'],'attributes':_0x38c5d1[_0x1d86('0xc')],'include':_0x38c5d1[_0x1d86('0xe')]?_[_0x1d86('0xf')](_0x38c5d1['include'],function(_0x319549){return{'model':db[_0x319549[_0x1d86('0x10')]],'as':_0x319549['as'],'attributes':_0x319549[_0x1d86('0xc')]};}):[]};}):[]};}):[]:[]})[_0x1d86('0x11')](function(_0x29f028){logger[_0x1d86('0x12')](_0x1d86('0x6'),_0x3dbba2);logger[_0x1d86('0x13')](_0x1d86('0x6'),_0x3dbba2,JSON['stringify'](_0x29f028));_0xd911bd(_0x29f028);})[_0x1d86('0x14')](function(_0x2e427f){logger[_0x1d86('0x15')]('GetInterval',_0x2e427f['message'],_0x3dbba2);_0x30347d(_0x28345c[_0x1d86('0x15')](0x1f4,_0x2e427f['message']));});});};exports[_0x1d86('0x16')]=function(_0x46ceb1){var _0x274d87=this;return new Promise(function(_0x146e6a,_0x153d63){return db['Interval']['find']({'raw':_0x46ceb1[_0x1d86('0x9')]?_0x46ceb1[_0x1d86('0x9')][_0x1d86('0xa')]===undefined?!![]:![]:!![],'where':_0x46ceb1[_0x1d86('0x9')]?_0x46ceb1['options'][_0x1d86('0xb')]||null:null,'attributes':_0x46ceb1[_0x1d86('0x9')]?_0x46ceb1[_0x1d86('0x9')][_0x1d86('0xc')]||null:null,'include':_0x46ceb1['options']?_0x46ceb1['options'][_0x1d86('0xe')]?_[_0x1d86('0xf')](_0x46ceb1[_0x1d86('0x9')][_0x1d86('0xe')],function(_0x321a4d){return{'model':db[_0x321a4d[_0x1d86('0x10')]],'as':_0x321a4d['as'],'attributes':_0x321a4d[_0x1d86('0xc')],'include':_0x321a4d[_0x1d86('0xe')]?_[_0x1d86('0xf')](_0x321a4d[_0x1d86('0xe')],function(_0x44fdd3){return{'model':db[_0x44fdd3['model']],'as':_0x44fdd3['as'],'attributes':_0x44fdd3['attributes'],'include':_0x44fdd3[_0x1d86('0xe')]?_[_0x1d86('0xf')](_0x44fdd3[_0x1d86('0xe')],function(_0x2cefe4){return{'model':db[_0x2cefe4[_0x1d86('0x10')]],'as':_0x2cefe4['as'],'attributes':_0x2cefe4[_0x1d86('0xc')]};}):[]};}):[]};}):[]:[]})[_0x1d86('0x11')](function(_0x14ccf2){logger[_0x1d86('0x12')]('ShowInterval',_0x46ceb1);logger[_0x1d86('0x13')](_0x1d86('0x16'),_0x46ceb1,JSON['stringify'](_0x14ccf2));_0x146e6a(_0x14ccf2);})[_0x1d86('0x14')](function(_0x3a4bd1){logger[_0x1d86('0x15')](_0x1d86('0x16'),_0x3a4bd1[_0x1d86('0x17')],_0x46ceb1);_0x153d63(_0x274d87[_0x1d86('0x15')](0x1f4,_0x3a4bd1[_0x1d86('0x17')]));});});};function checkArrayOfIntervals(_0x1f8304,_0x3c4356){var _0x37bc3f=[];return db[_0x1d86('0x7')][_0x1d86('0x8')]({'where':{'id':_0x1f8304}})['then'](function(_0x1f13a5){_0x37bc3f=_0x1f13a5;return Promise[_0x1d86('0x18')](_0x37bc3f[_0x1d86('0xf')](function(_0x3f98c7){return _0x3f98c7[_0x1d86('0x19')](_0x3c4356);}));})[_0x1d86('0x11')](function(_0x11ae2e){var _0x24a842=_0x11ae2e['reduce'](function(_0x52f8d2,_0x49b7e6){return _0x52f8d2||_0x49b7e6;},![]);logger[_0x1d86('0x12')](util[_0x1d86('0x1a')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x37bc3f[_0x1d86('0xf')](function(_0x466dd7){return _0x466dd7[_0x1d86('0x1b')];})[_0x1d86('0x1c')](',\x20'),_0x37bc3f[_0x1d86('0xf')](function(_0x150074){return _0x150074['id'];})[_0x1d86('0x1c')](',\x20')));return _0x24a842;});}function checkSingleInterval(_0x1af58d,_0xccbcc){return db[_0x1d86('0x7')][_0x1d86('0x1d')](_0x1af58d)[_0x1d86('0x11')](function(_0x16c576){if(_0x16c576){logger[_0x1d86('0x12')](util[_0x1d86('0x1a')](_0x1d86('0x1e'),_0x16c576[_0x1d86('0x1b')],_0x16c576['id']));return _0x16c576[_0x1d86('0x19')](_0xccbcc);}});}exports[_0x1d86('0x1f')]=function(_0x2e1fbd){var _0x567cd7=_0x2e1fbd['intervalIds'];var _0x43f1d7=Array['isArray'](_0x2e1fbd[_0x1d86('0x20')])?_0x2e1fbd[_0x1d86('0x20')]:typeof _0x2e1fbd[_0x1d86('0x20')]===_0x1d86('0x21')?[_0x2e1fbd['intervals']]:[];var _0x4984ed=_0x2e1fbd[_0x1d86('0x22')]||undefined;var _0x5633fc=![];if(_0x43f1d7[_0x1d86('0x23')]){logger[_0x1d86('0x12')](util[_0x1d86('0x1a')](_0x1d86('0x24'),_0x43f1d7[_0x1d86('0x1c')](';\x20')));}if(_0x4984ed){logger[_0x1d86('0x12')](util[_0x1d86('0x1a')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x4984ed));}logger[_0x1d86('0x13')](_0x1d86('0x25'),_0x5633fc);logger[_0x1d86('0x26')]('IntervalIftime',_0x2e1fbd);return Promise['resolve']()[_0x1d86('0x11')](function(){if(Array['isArray'](_0x567cd7)){return checkArrayOfIntervals(_0x567cd7,_0x4984ed);}else if(_0x567cd7){return checkSingleInterval(_0x567cd7,_0x4984ed);}})[_0x1d86('0x11')](function(_0x408606){var _0x638b31=_0x43f1d7[_0x1d86('0x27')](function(_0x5343de,_0x21f68c){return _0x5343de||iftime(_0x21f68c,_0x4984ed);},![]);_0x5633fc=_0x408606||_0x638b31;return _0x5633fc;})[_0x1d86('0x14')](function(_0x12ed2b){logger['error'](_0x1d86('0x1f'),_0x2e1fbd,_0x12ed2b);throw this['error'](0x1f4,_0x12ed2b[_0x1d86('0x17')]);});}; \ No newline at end of file +var _0x77b6=['raw','where','attributes','limit','include','map','model','then','info','catch','error','message','ShowInterval','find','debug','stringify','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','silly','lodash','util','../../config/logger','rpc','GetInterval','Interval','findAll','options'];(function(_0x39f647,_0x1d9ecb){var _0x3cd5f7=function(_0x2771d2){while(--_0x2771d2){_0x39f647['push'](_0x39f647['shift']());}};_0x3cd5f7(++_0x1d9ecb);}(_0x77b6,0x140));var _0x677b=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x77b6[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x677b('0x0'));var util=require(_0x677b('0x1'));var db=require('../../mysqldb')['db'];var iftime=require('../../utils/iftime')['iftime'];var logger=require(_0x677b('0x2'))(_0x677b('0x3'));exports[_0x677b('0x4')]=function(_0x35ff4a){var _0x3127c4=this;return new Promise(function(_0xce921e,_0x136bd9){return db[_0x677b('0x5')][_0x677b('0x6')]({'raw':_0x35ff4a[_0x677b('0x7')]?_0x35ff4a[_0x677b('0x7')][_0x677b('0x8')]===undefined?!![]:![]:!![],'where':_0x35ff4a[_0x677b('0x7')]?_0x35ff4a[_0x677b('0x7')][_0x677b('0x9')]||null:null,'attributes':_0x35ff4a[_0x677b('0x7')]?_0x35ff4a[_0x677b('0x7')][_0x677b('0xa')]||null:null,'limit':_0x35ff4a[_0x677b('0x7')]?_0x35ff4a[_0x677b('0x7')][_0x677b('0xb')]||null:null,'include':_0x35ff4a[_0x677b('0x7')]?_0x35ff4a[_0x677b('0x7')][_0x677b('0xc')]?_['map'](_0x35ff4a[_0x677b('0x7')][_0x677b('0xc')],function(_0x37c6eb){return{'model':db[_0x37c6eb['model']],'as':_0x37c6eb['as'],'attributes':_0x37c6eb[_0x677b('0xa')],'include':_0x37c6eb[_0x677b('0xc')]?_[_0x677b('0xd')](_0x37c6eb[_0x677b('0xc')],function(_0x3775fd){return{'model':db[_0x3775fd[_0x677b('0xe')]],'as':_0x3775fd['as'],'attributes':_0x3775fd[_0x677b('0xa')],'include':_0x3775fd[_0x677b('0xc')]?_['map'](_0x3775fd[_0x677b('0xc')],function(_0x47ec39){return{'model':db[_0x47ec39[_0x677b('0xe')]],'as':_0x47ec39['as'],'attributes':_0x47ec39[_0x677b('0xa')]};}):[]};}):[]};}):[]:[]})[_0x677b('0xf')](function(_0x3d530f){logger[_0x677b('0x10')](_0x677b('0x4'),_0x35ff4a);logger['debug'](_0x677b('0x4'),_0x35ff4a,JSON['stringify'](_0x3d530f));_0xce921e(_0x3d530f);})[_0x677b('0x11')](function(_0x4c31ed){logger[_0x677b('0x12')](_0x677b('0x4'),_0x4c31ed[_0x677b('0x13')],_0x35ff4a);_0x136bd9(_0x3127c4[_0x677b('0x12')](0x1f4,_0x4c31ed[_0x677b('0x13')]));});});};exports[_0x677b('0x14')]=function(_0x5c1f52){var _0x50e3f0=this;return new Promise(function(_0xec0eb2,_0x2691d3){return db[_0x677b('0x5')][_0x677b('0x15')]({'raw':_0x5c1f52[_0x677b('0x7')]?_0x5c1f52[_0x677b('0x7')][_0x677b('0x8')]===undefined?!![]:![]:!![],'where':_0x5c1f52[_0x677b('0x7')]?_0x5c1f52['options']['where']||null:null,'attributes':_0x5c1f52[_0x677b('0x7')]?_0x5c1f52['options'][_0x677b('0xa')]||null:null,'include':_0x5c1f52[_0x677b('0x7')]?_0x5c1f52[_0x677b('0x7')][_0x677b('0xc')]?_['map'](_0x5c1f52['options'][_0x677b('0xc')],function(_0x525b42){return{'model':db[_0x525b42['model']],'as':_0x525b42['as'],'attributes':_0x525b42['attributes'],'include':_0x525b42[_0x677b('0xc')]?_[_0x677b('0xd')](_0x525b42['include'],function(_0x5f3da5){return{'model':db[_0x5f3da5[_0x677b('0xe')]],'as':_0x5f3da5['as'],'attributes':_0x5f3da5[_0x677b('0xa')],'include':_0x5f3da5[_0x677b('0xc')]?_[_0x677b('0xd')](_0x5f3da5['include'],function(_0x54f278){return{'model':db[_0x54f278[_0x677b('0xe')]],'as':_0x54f278['as'],'attributes':_0x54f278[_0x677b('0xa')]};}):[]};}):[]};}):[]:[]})[_0x677b('0xf')](function(_0x367e61){logger[_0x677b('0x10')](_0x677b('0x14'),_0x5c1f52);logger[_0x677b('0x16')](_0x677b('0x14'),_0x5c1f52,JSON[_0x677b('0x17')](_0x367e61));_0xec0eb2(_0x367e61);})[_0x677b('0x11')](function(_0x2969f5){logger['error'](_0x677b('0x14'),_0x2969f5['message'],_0x5c1f52);_0x2691d3(_0x50e3f0[_0x677b('0x12')](0x1f4,_0x2969f5[_0x677b('0x13')]));});});};function checkArrayOfIntervals(_0xf12850,_0x4025bf){var _0x34e42f=[];return db[_0x677b('0x5')][_0x677b('0x6')]({'where':{'id':_0xf12850}})[_0x677b('0xf')](function(_0x129c1d){_0x34e42f=_0x129c1d;return Promise['all'](_0x34e42f[_0x677b('0xd')](function(_0x4fced4){return _0x4fced4[_0x677b('0x18')](_0x4025bf);}));})[_0x677b('0xf')](function(_0x3aef8a){var _0xc7e2a7=_0x3aef8a[_0x677b('0x19')](function(_0x34399d,_0x541a09){return _0x34399d||_0x541a09;},![]);logger['info'](util[_0x677b('0x1a')](_0x677b('0x1b'),_0x34e42f[_0x677b('0xd')](function(_0x50b47f){return _0x50b47f[_0x677b('0x1c')];})[_0x677b('0x1d')](',\x20'),_0x34e42f['map'](function(_0x222080){return _0x222080['id'];})['join'](',\x20')));return _0xc7e2a7;});}function checkSingleInterval(_0x356570,_0x303ad7){return db[_0x677b('0x5')]['findById'](_0x356570)['then'](function(_0x4d2f52){if(_0x4d2f52){logger[_0x677b('0x10')](util[_0x677b('0x1a')](_0x677b('0x1e'),_0x4d2f52[_0x677b('0x1c')],_0x4d2f52['id']));return _0x4d2f52[_0x677b('0x18')](_0x303ad7);}});}exports[_0x677b('0x1f')]=function(_0x182402){var _0x469faa=_0x182402[_0x677b('0x20')];var _0x21c7b1=Array[_0x677b('0x21')](_0x182402['intervals'])?_0x182402['intervals']:typeof _0x182402[_0x677b('0x22')]===_0x677b('0x23')?[_0x182402[_0x677b('0x22')]]:[];var _0xd76fad=_0x182402[_0x677b('0x24')]||undefined;var _0x452147=![];if(_0x21c7b1[_0x677b('0x25')]){logger[_0x677b('0x10')](util['format'](_0x677b('0x26'),_0x21c7b1[_0x677b('0x1d')](';\x20')));}if(_0xd76fad){logger[_0x677b('0x10')](util[_0x677b('0x1a')](_0x677b('0x27'),_0xd76fad));}logger[_0x677b('0x16')]('Iftime',_0x452147);logger[_0x677b('0x28')](_0x677b('0x1f'),_0x182402);return Promise['resolve']()[_0x677b('0xf')](function(){if(Array[_0x677b('0x21')](_0x469faa)){return checkArrayOfIntervals(_0x469faa,_0xd76fad);}else if(_0x469faa){return checkSingleInterval(_0x469faa,_0xd76fad);}})[_0x677b('0xf')](function(_0x202a61){var _0x14f79e=_0x21c7b1[_0x677b('0x19')](function(_0x167717,_0x69fae7){return _0x167717||iftime(_0x69fae7,_0xd76fad);},![]);_0x452147=_0x202a61||_0x14f79e;return _0x452147;})[_0x677b('0x11')](function(_0x5334f3){logger[_0x677b('0x12')]('IntervalIftime',_0x182402,_0x5334f3);throw this[_0x677b('0x12')](0x1f4,_0x5334f3['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 05d94b9..dd15bb9 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(_0x42aeab,_0x226e9f){var _0xc28a86=function(_0x1bf475){while(--_0x1bf475){_0x42aeab['push'](_0x42aeab['shift']());}};_0xc28a86(++_0x226e9f);}(_0x2032,0xd9));var _0x2203=function(_0x1ff786,_0x339971){_0x1ff786=_0x1ff786-0x0;var _0x11529a=_0x2032[_0x1ff786];return _0x11529a;};'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 _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x29c9f6,_0x29b430){var _0xfbc70e=function(_0x2ee258){while(--_0x2ee258){_0x29c9f6['push'](_0x29c9f6['shift']());}};_0xfbc70e(++_0x29b430);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3700a0,_0x1ae90f){_0x3700a0=_0x3700a0-0x0;var _0x230f66=_0x5f2f[_0x3700a0];return _0x230f66;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index b20480b..438441f 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 _0xeefe=['name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','base64','setEncoding','utf8','data','status','statusCode','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','send','body','connection','socket','remoteAddress','https','../../config/logger','support','key','MOTGUI','summary','Report','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503'];(function(_0x178977,_0x2d061e){var _0x1fb94=function(_0x2740dc){while(--_0x2740dc){_0x178977['push'](_0x178977['shift']());}};_0x1fb94(++_0x2d061e);}(_0xeefe,0xa5));var _0xeeef=function(_0x594fd3,_0x362221){_0x594fd3=_0x594fd3-0x0;var _0xb4f4cb=_0xeefe[_0x594fd3];return _0xb4f4cb;};'use strict';var BPromise=require('bluebird');var https=require(_0xeeef('0x0'));var logger=require(_0xeeef('0x1'))('api');var USERNAME=_0xeeef('0x2');var PASSWORD='3eAmWpBVP0';function openIssue(_0x23770c,_0x508e28){var _0x4cb1ca={'fields':{'project':{'key':_0x23770c[_0xeeef('0x3')]||_0xeeef('0x4')},'summary':(_0x23770c[_0xeeef('0x5')]||_0xeeef('0x6'))+_0xeeef('0x7')+_0x23770c['ip'],'description':_0x23770c['description']||JSON[_0xeeef('0x8')](_0x23770c),'issuetype':{'name':_0x23770c[_0xeeef('0x9')]||_0xeeef('0xa')}}};_0x4cb1ca[_0xeeef('0xb')][_0xeeef('0xc')]=_0x23770c[_0xeeef('0xd')];_0x4cb1ca[_0xeeef('0xb')][_0xeeef('0xe')]=_0x23770c[_0xeeef('0xf')];_0x4cb1ca['fields'][_0xeeef('0x10')]=_0x23770c[_0xeeef('0x11')];_0x4cb1ca[_0xeeef('0xb')][_0xeeef('0x12')]=_0x23770c[_0xeeef('0x13')];_0x4cb1ca[_0xeeef('0xb')][_0xeeef('0x14')]=_0x23770c[_0xeeef('0x15')];_0x4cb1ca['fields'][_0xeeef('0x16')]=_0x23770c['ip'];var _0x5a1e0c={'host':_0xeeef('0x17'),'port':0x1bb,'path':_0xeeef('0x18'),'method':_0xeeef('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0xeeef('0x1a'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xeeef('0x1b'))}};var _0x1bff6a=JSON[_0xeeef('0x8')](_0x4cb1ca);var _0x27b22e=https['request'](_0x5a1e0c,function(_0x185347){_0x185347[_0xeeef('0x1c')](_0xeeef('0x1d'));var _0x580c8d='';_0x185347['on'](_0xeeef('0x1e'),function(_0xf27d17){_0x580c8d+=_0xf27d17;});_0x185347['on']('end',function(){if(_0x508e28){return _0x508e28[_0xeeef('0x1f')](_0x185347[_0xeeef('0x20')])['json'](JSON[_0xeeef('0x21')](_0x580c8d));}});});_0x27b22e['on'](_0xeeef('0x22'),function(_0x4c8b23){if(_0x508e28){return _0x508e28[_0xeeef('0x1f')](0x1f4)[_0xeeef('0x23')]({'errors':[{'message':_0xeeef('0x24'),'type':_0xeeef('0x25')}]});}});_0x27b22e[_0xeeef('0x26')](_0x1bff6a);_0x27b22e[_0xeeef('0x27')]();}exports[_0xeeef('0x28')]=openIssue;exports[_0xeeef('0x29')]=function(_0x5152ef,_0x3c6819){_0x5152ef[_0xeeef('0x2a')]['ip']=_0x5152ef['headers']['x-forwarded-for']||_0x5152ef[_0xeeef('0x2b')]['remoteAddress']||_0x5152ef[_0xeeef('0x2c')][_0xeeef('0x2d')]||_0x5152ef[_0xeeef('0x2b')][_0xeeef('0x2c')][_0xeeef('0x2d')];return openIssue(_0x5152ef[_0xeeef('0x2a')],_0x3c6819);}; \ No newline at end of file +var _0x400b=['parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','connection','bluebird','https','../../config/logger','support','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','Basic\x20','toString','base64','request','data','end','status','statusCode','json'];(function(_0x741dbd,_0x460548){var _0x14486c=function(_0x3d63cc){while(--_0x3d63cc){_0x741dbd['push'](_0x741dbd['shift']());}};_0x14486c(++_0x460548);}(_0x400b,0x1ef));var _0xb400=function(_0x565987,_0x16e813){_0x565987=_0x565987-0x0;var _0x310296=_0x400b[_0x565987];return _0x310296;};'use strict';var BPromise=require(_0xb400('0x0'));var https=require(_0xb400('0x1'));var logger=require(_0xb400('0x2'))('api');var USERNAME=_0xb400('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x2e53aa,_0x4dd4d8){var _0x346ad2={'fields':{'project':{'key':_0x2e53aa[_0xb400('0x4')]||_0xb400('0x5')},'summary':(_0x2e53aa[_0xb400('0x6')]||_0xb400('0x7'))+_0xb400('0x8')+_0x2e53aa['ip'],'description':_0x2e53aa[_0xb400('0x9')]||JSON[_0xb400('0xa')](_0x2e53aa),'issuetype':{'name':_0x2e53aa[_0xb400('0xb')]||_0xb400('0xc')}}};_0x346ad2[_0xb400('0xd')][_0xb400('0xe')]=_0x2e53aa[_0xb400('0xf')];_0x346ad2['fields']['customfield_11501']=_0x2e53aa['oldToken'];_0x346ad2[_0xb400('0xd')][_0xb400('0x10')]=_0x2e53aa[_0xb400('0x11')];_0x346ad2[_0xb400('0xd')]['customfield_11503']=_0x2e53aa[_0xb400('0x12')];_0x346ad2[_0xb400('0xd')][_0xb400('0x13')]=_0x2e53aa[_0xb400('0x14')];_0x346ad2[_0xb400('0xd')][_0xb400('0x15')]=_0x2e53aa['ip'];var _0x3ab819={'host':_0xb400('0x16'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xb400('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xb400('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xb400('0x19')](_0xb400('0x1a'))}};var _0x45e8eb=JSON[_0xb400('0xa')](_0x346ad2);var _0x5b37c7=https[_0xb400('0x1b')](_0x3ab819,function(_0x339074){_0x339074['setEncoding']('utf8');var _0x1647c9='';_0x339074['on'](_0xb400('0x1c'),function(_0x17a66c){_0x1647c9+=_0x17a66c;});_0x339074['on'](_0xb400('0x1d'),function(){if(_0x4dd4d8){return _0x4dd4d8[_0xb400('0x1e')](_0x339074[_0xb400('0x1f')])[_0xb400('0x20')](JSON[_0xb400('0x21')](_0x1647c9));}});});_0x5b37c7['on']('error',function(_0x57005d){if(_0x4dd4d8){return _0x4dd4d8['status'](0x1f4)[_0xb400('0x20')]({'errors':[{'message':_0xb400('0x22'),'type':_0xb400('0x23')}]});}});_0x5b37c7['write'](_0x45e8eb);_0x5b37c7[_0xb400('0x1d')]();}exports[_0xb400('0x24')]=openIssue;exports[_0xb400('0x25')]=function(_0x5c5265,_0x280fb7){_0x5c5265[_0xb400('0x26')]['ip']=_0x5c5265[_0xb400('0x27')][_0xb400('0x28')]||_0x5c5265['connection'][_0xb400('0x29')]||_0x5c5265[_0xb400('0x2a')][_0xb400('0x29')]||_0x5c5265[_0xb400('0x2b')]['socket'][_0xb400('0x29')];return openIssue(_0x5c5265[_0xb400('0x26')],_0x280fb7);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 358328f..12cb152 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 _0x4ea3=['multer','util','path','connect-timeout','Router','../../components/auth/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','/:id','post','update','destroy','exports'];(function(_0x5e8ff8,_0x3e8081){var _0x258962=function(_0x4e5023){while(--_0x4e5023){_0x5e8ff8['push'](_0x5e8ff8['shift']());}};_0x258962(++_0x3e8081);}(_0x4ea3,0x70));var _0x34ea=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4ea3[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var path=require(_0x34ea('0x2'));var timeout=require(_0x34ea('0x3'));var express=require('express');var router=express[_0x34ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x34ea('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x34ea('0x6'));router[_0x34ea('0x7')]('/',auth[_0x34ea('0x8')](),controller[_0x34ea('0x9')]);router[_0x34ea('0x7')](_0x34ea('0xa'),auth[_0x34ea('0x8')](),controller['describe']);router[_0x34ea('0x7')](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller['show']);router[_0x34ea('0xc')]('/',auth[_0x34ea('0x8')](),controller['create']);router['put'](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller[_0x34ea('0xd')]);router['delete'](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller[_0x34ea('0xe')]);module[_0x34ea('0xf')]=router; \ No newline at end of file +var _0x9bde=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','delete','destroy','util','connect-timeout','Router'];(function(_0x2e2984,_0x70ab4a){var _0x4a34d1=function(_0x8afe97){while(--_0x8afe97){_0x2e2984['push'](_0x2e2984['shift']());}};_0x4a34d1(++_0x70ab4a);}(_0x9bde,0xe1));var _0xe9bd=function(_0x28b717,_0x14c6dd){_0x28b717=_0x28b717-0x0;var _0x2c897e=_0x9bde[_0x28b717];return _0x2c897e;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var fs_extra=require(_0xe9bd('0x3'));var auth=require(_0xe9bd('0x4'));var interaction=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var controller=require(_0xe9bd('0x7'));router[_0xe9bd('0x8')]('/',auth['isAuthenticated'](),controller[_0xe9bd('0x9')]);router[_0xe9bd('0x8')](_0xe9bd('0xa'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xc')]);router[_0xe9bd('0x8')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xe')]);router[_0xe9bd('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe9bd('0x10')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller['update']);router[_0xe9bd('0x11')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0x12')]);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 2ad97a6..3e692ac 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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7a54,0x106));var _0x47a5=function(_0x3c5111,_0x2bcf75){_0x3c5111=_0x3c5111-0x0;var _0x56772a=_0x7a54[_0x3c5111];return _0x56772a;};'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(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x7a54,0x106));var _0x47a5=function(_0x49be91,_0x383d8d){_0x49be91=_0x49be91-0x0;var _0x78f944=_0x7a54[_0x49be91];return _0x78f944;};'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 7442d3f..fcad2bf 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 _0xdb70=['catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','key','map','query','filters','attributes','intersection','fields','length','model','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find'];(function(_0x337a7a,_0x5f3233){var _0x1f72db=function(_0xc1a70c){while(--_0xc1a70c){_0x337a7a['push'](_0x337a7a['shift']());}};_0x1f72db(++_0x5f3233);}(_0xdb70,0xa0));var _0x0db7=function(_0x543813,_0x13b710){_0x543813=_0x543813-0x0;var _0x487dd2=_0xdb70[_0x543813];return _0x487dd2;};'use strict';var emlformat=require(_0x0db7('0x0'));var rimraf=require(_0x0db7('0x1'));var zipdir=require(_0x0db7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0db7('0x3'));var moment=require(_0x0db7('0x4'));var BPromise=require(_0x0db7('0x5'));var Mustache=require(_0x0db7('0x6'));var util=require(_0x0db7('0x7'));var path=require(_0x0db7('0x8'));var sox=require(_0x0db7('0x9'));var csv=require(_0x0db7('0xa'));var ejs=require(_0x0db7('0xb'));var fs=require('fs');var fs_extra=require(_0x0db7('0xc'));var _=require(_0x0db7('0xd'));var squel=require('squel');var crypto=require(_0x0db7('0xe'));var jsforce=require(_0x0db7('0xf'));var deskjs=require(_0x0db7('0x10'));var toCsv=require(_0x0db7('0xa'));var querystring=require(_0x0db7('0x11'));var Papa=require(_0x0db7('0x12'));var Redis=require('ioredis');var authService=require(_0x0db7('0x13'));var qs=require(_0x0db7('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0db7('0x15'));var logger=require(_0x0db7('0x16'))(_0x0db7('0x17'));var utils=require(_0x0db7('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0db7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9aed4f,_0x2959a2){_0x2959a2=_0x2959a2||0xcc;return function(_0x33ec07){if(_0x33ec07){return _0x9aed4f[_0x0db7('0x1a')](_0x2959a2);}return _0x9aed4f[_0x0db7('0x1b')](_0x2959a2)['end']();};}function respondWithResult(_0x76c036,_0x195556){_0x195556=_0x195556||0xc8;return function(_0x45f594){if(_0x45f594){return _0x76c036[_0x0db7('0x1b')](_0x195556)[_0x0db7('0x1c')](_0x45f594);}};}function respondWithFilteredResult(_0x446448,_0x41b2b3){return function(_0x2edbe9){if(_0x2edbe9){var _0xb9127d=typeof _0x41b2b3[_0x0db7('0x1d')]==='undefined'&&typeof _0x41b2b3[_0x0db7('0x1e')]===_0x0db7('0x1f');var _0x18cf37=_0x2edbe9[_0x0db7('0x20')];var _0x31082b=_0xb9127d?0x0:_0x41b2b3[_0x0db7('0x1d')];var _0x52e95e=_0xb9127d?_0x2edbe9['count']:_0x41b2b3[_0x0db7('0x1d')]+_0x41b2b3[_0x0db7('0x1e')];var _0xe9a55d;if(_0x52e95e>=_0x18cf37){_0x52e95e=_0x18cf37;_0xe9a55d=0xc8;}else{_0xe9a55d=0xce;}_0x446448['status'](_0xe9a55d);return _0x446448[_0x0db7('0x21')](_0x0db7('0x22'),_0x31082b+'-'+_0x52e95e+'/'+_0x18cf37)[_0x0db7('0x1c')](_0x2edbe9);}return null;};}function patchUpdates(_0x211fc0){return function(_0x5a0b04){try{jsonpatch[_0x0db7('0x23')](_0x5a0b04,_0x211fc0,!![]);}catch(_0x48feb2){return BPromise[_0x0db7('0x24')](_0x48feb2);}return _0x5a0b04['save']();};}function saveUpdates(_0x59b7e4,_0x135429){return function(_0x156aaa){if(_0x156aaa){return _0x156aaa[_0x0db7('0x25')](_0x59b7e4)[_0x0db7('0x26')](function(_0x18fc1c){return _0x18fc1c;});}return null;};}function removeEntity(_0x368243,_0xc05009){return function(_0x274bf1){if(_0x274bf1){return _0x274bf1[_0x0db7('0x27')]()[_0x0db7('0x26')](function(){_0x368243[_0x0db7('0x1b')](0xcc)[_0x0db7('0x28')]();});}};}function handleEntityNotFound(_0x299c22,_0x55f339){return function(_0x521565){if(!_0x521565){_0x299c22['sendStatus'](0x194);}return _0x521565;};}function handleError(_0x594e6a,_0x568e60){_0x568e60=_0x568e60||0x1f4;return function(_0x5d2e46){logger[_0x0db7('0x29')](_0x5d2e46[_0x0db7('0x2a')]);if(_0x5d2e46[_0x0db7('0x2b')]){delete _0x5d2e46['name'];}_0x594e6a['status'](_0x568e60)[_0x0db7('0x2c')](_0x5d2e46);};}exports[_0x0db7('0x2d')]=function(_0x3f2169,_0x37ade4){var _0x29ed0a={},_0xfc7311={},_0x4ca418={'count':0x0,'rows':[]};var _0x2de626=_['map'](db[_0x0db7('0x2e')][_0x0db7('0x2f')],function(_0x1481aa){return{'name':_0x1481aa[_0x0db7('0x30')],'type':_0x1481aa['type'][_0x0db7('0x31')]};});_0xfc7311['model']=_[_0x0db7('0x32')](_0x2de626,_0x0db7('0x2b'));_0xfc7311[_0x0db7('0x33')]=_['keys'](_0x3f2169[_0x0db7('0x33')]);_0xfc7311[_0x0db7('0x34')]=_['intersection'](_0xfc7311['model'],_0xfc7311[_0x0db7('0x33')]);_0x29ed0a[_0x0db7('0x35')]=_[_0x0db7('0x36')](_0xfc7311['model'],qs['fields'](_0x3f2169[_0x0db7('0x33')][_0x0db7('0x37')]));_0x29ed0a[_0x0db7('0x35')]=_0x29ed0a['attributes'][_0x0db7('0x38')]?_0x29ed0a[_0x0db7('0x35')]:_0xfc7311[_0x0db7('0x39')];if(!_0x3f2169[_0x0db7('0x33')]['hasOwnProperty'](_0x0db7('0x3a'))){_0x29ed0a['limit']=qs[_0x0db7('0x1e')](_0x3f2169['query'][_0x0db7('0x1e')]);_0x29ed0a[_0x0db7('0x1d')]=qs[_0x0db7('0x1d')](_0x3f2169['query']['offset']);}_0x29ed0a[_0x0db7('0x3b')]=qs[_0x0db7('0x3c')](_0x3f2169[_0x0db7('0x33')][_0x0db7('0x3c')]);_0x29ed0a[_0x0db7('0x3d')]=qs[_0x0db7('0x34')](_['pick'](_0x3f2169[_0x0db7('0x33')],_0xfc7311[_0x0db7('0x34')]),_0x2de626);if(_0x3f2169['query'][_0x0db7('0x3e')]){_0x29ed0a['where']=_[_0x0db7('0x3f')](_0x29ed0a['where'],{'$or':_[_0x0db7('0x32')](_0x2de626,function(_0x27ed23){if(_0x27ed23['type']!==_0x0db7('0x40')){var _0x100ef9={};_0x100ef9[_0x27ed23['name']]={'$like':'%'+_0x3f2169[_0x0db7('0x33')]['filter']+'%'};return _0x100ef9;}})});}_0x29ed0a=_[_0x0db7('0x3f')]({},_0x29ed0a,_0x3f2169[_0x0db7('0x41')]);var _0x32c295={'where':_0x29ed0a[_0x0db7('0x3d')]};return db[_0x0db7('0x2e')]['count'](_0x32c295)[_0x0db7('0x26')](function(_0x2545bf){_0x4ca418[_0x0db7('0x20')]=_0x2545bf;if(_0x3f2169[_0x0db7('0x33')][_0x0db7('0x42')]){_0x29ed0a[_0x0db7('0x43')]=[{'all':!![]}];}return db[_0x0db7('0x2e')][_0x0db7('0x44')](_0x29ed0a);})[_0x0db7('0x26')](function(_0x4591fe){_0x4ca418[_0x0db7('0x45')]=_0x4591fe;return _0x4ca418;})[_0x0db7('0x26')](respondWithFilteredResult(_0x37ade4,_0x29ed0a))['catch'](handleError(_0x37ade4,null));};exports[_0x0db7('0x46')]=function(_0x4a9066,_0x23558a){var _0x150936={'raw':!![],'where':{'id':_0x4a9066[_0x0db7('0x47')]['id']}},_0x55732f={};_0x55732f['model']=_[_0x0db7('0x48')](db[_0x0db7('0x2e')][_0x0db7('0x2f')]);_0x55732f[_0x0db7('0x33')]=_[_0x0db7('0x48')](_0x4a9066[_0x0db7('0x33')]);_0x55732f[_0x0db7('0x34')]=_[_0x0db7('0x36')](_0x55732f[_0x0db7('0x39')],_0x55732f['query']);_0x150936['attributes']=_['intersection'](_0x55732f[_0x0db7('0x39')],qs[_0x0db7('0x37')](_0x4a9066[_0x0db7('0x33')][_0x0db7('0x37')]));_0x150936[_0x0db7('0x35')]=_0x150936[_0x0db7('0x35')]['length']?_0x150936[_0x0db7('0x35')]:_0x55732f[_0x0db7('0x39')];if(_0x4a9066['query'][_0x0db7('0x42')]){_0x150936[_0x0db7('0x43')]=[{'all':!![]}];}_0x150936=_[_0x0db7('0x3f')]({},_0x150936,_0x4a9066['options']);return db[_0x0db7('0x2e')][_0x0db7('0x49')](_0x150936)[_0x0db7('0x26')](handleEntityNotFound(_0x23558a,null))[_0x0db7('0x26')](respondWithResult(_0x23558a,null))[_0x0db7('0x4a')](handleError(_0x23558a,null));};exports['create']=function(_0x23d9b3,_0x2388fa){return db[_0x0db7('0x2e')][_0x0db7('0x4b')](_0x23d9b3['body'],{})['then'](respondWithResult(_0x2388fa,0xc9))[_0x0db7('0x4a')](handleError(_0x2388fa,null));};exports['update']=function(_0x534daa,_0x3281bd){if(_0x534daa[_0x0db7('0x4c')]['id']){delete _0x534daa['body']['id'];}return db[_0x0db7('0x2e')][_0x0db7('0x49')]({'where':{'id':_0x534daa[_0x0db7('0x47')]['id']}})[_0x0db7('0x26')](handleEntityNotFound(_0x3281bd,null))['then'](saveUpdates(_0x534daa['body'],null))['then'](respondWithResult(_0x3281bd,null))[_0x0db7('0x4a')](handleError(_0x3281bd,null));};exports[_0x0db7('0x27')]=function(_0x1ac5df,_0x10863b){return db['JscriptyAnswerReport'][_0x0db7('0x49')]({'where':{'id':_0x1ac5df['params']['id']}})['then'](handleEntityNotFound(_0x10863b,null))['then'](removeEntity(_0x10863b,null))[_0x0db7('0x4a')](handleError(_0x10863b,null));};exports[_0x0db7('0x4d')]=function(_0x12bfda,_0x31f2a7){return db[_0x0db7('0x2e')]['describe']()[_0x0db7('0x26')](respondWithResult(_0x31f2a7,null))[_0x0db7('0x4a')](handleError(_0x31f2a7,null));}; \ No newline at end of file +var _0x2e8a=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','end','error','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','rimraf','zip-dir','request-promise','moment','mustache','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service'];(function(_0xa5e327,_0x189c74){var _0x5a0aef=function(_0x34f918){while(--_0x34f918){_0xa5e327['push'](_0xa5e327['shift']());}};_0x5a0aef(++_0x189c74);}(_0x2e8a,0xc7));var _0xa2e8=function(_0x340d17,_0x3d6339){_0x340d17=_0x340d17-0x0;var _0x4a18d1=_0x2e8a[_0x340d17];return _0x4a18d1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa2e8('0x0'));var zipdir=require(_0xa2e8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa2e8('0x2'));var moment=require(_0xa2e8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa2e8('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa2e8('0x5'));var fs=require('fs');var fs_extra=require(_0xa2e8('0x6'));var _=require(_0xa2e8('0x7'));var squel=require('squel');var crypto=require(_0xa2e8('0x8'));var jsforce=require(_0xa2e8('0x9'));var deskjs=require(_0xa2e8('0xa'));var toCsv=require(_0xa2e8('0xb'));var querystring=require('querystring');var Papa=require(_0xa2e8('0xc'));var Redis=require('ioredis');var authService=require(_0xa2e8('0xd'));var qs=require(_0xa2e8('0xe'));var as=require(_0xa2e8('0xf'));var hardwareService=require(_0xa2e8('0x10'));var logger=require(_0xa2e8('0x11'))('api');var utils=require(_0xa2e8('0x12'));var config=require(_0xa2e8('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xa2e8('0x14'))['db'];function respondWithStatusCode(_0x4e985d,_0x38abcb){_0x38abcb=_0x38abcb||0xcc;return function(_0x1dfccb){if(_0x1dfccb){return _0x4e985d[_0xa2e8('0x15')](_0x38abcb);}return _0x4e985d['status'](_0x38abcb)['end']();};}function respondWithResult(_0x5e3a2b,_0x469c1e){_0x469c1e=_0x469c1e||0xc8;return function(_0x517d54){if(_0x517d54){return _0x5e3a2b[_0xa2e8('0x16')](_0x469c1e)['json'](_0x517d54);}};}function respondWithFilteredResult(_0x5a99bf,_0x29cd40){return function(_0x41161f){if(_0x41161f){var _0x79aba2=typeof _0x29cd40[_0xa2e8('0x17')]===_0xa2e8('0x18')&&typeof _0x29cd40['limit']===_0xa2e8('0x18');var _0x53ca1f=_0x41161f['count'];var _0x1a7583=_0x79aba2?0x0:_0x29cd40[_0xa2e8('0x17')];var _0x21e869=_0x79aba2?_0x41161f[_0xa2e8('0x19')]:_0x29cd40[_0xa2e8('0x17')]+_0x29cd40['limit'];var _0x523bfd;if(_0x21e869>=_0x53ca1f){_0x21e869=_0x53ca1f;_0x523bfd=0xc8;}else{_0x523bfd=0xce;}_0x5a99bf[_0xa2e8('0x16')](_0x523bfd);return _0x5a99bf[_0xa2e8('0x1a')](_0xa2e8('0x1b'),_0x1a7583+'-'+_0x21e869+'/'+_0x53ca1f)[_0xa2e8('0x1c')](_0x41161f);}return null;};}function patchUpdates(_0xd8f70){return function(_0x280a87){try{jsonpatch['apply'](_0x280a87,_0xd8f70,!![]);}catch(_0x31e0f3){return BPromise[_0xa2e8('0x1d')](_0x31e0f3);}return _0x280a87[_0xa2e8('0x1e')]();};}function saveUpdates(_0x1ba92a,_0x51e9a9){return function(_0x527a3f){if(_0x527a3f){return _0x527a3f[_0xa2e8('0x1f')](_0x1ba92a)[_0xa2e8('0x20')](function(_0x5941c4){return _0x5941c4;});}return null;};}function removeEntity(_0x518532,_0x520545){return function(_0x32758e){if(_0x32758e){return _0x32758e[_0xa2e8('0x21')]()[_0xa2e8('0x20')](function(){_0x518532[_0xa2e8('0x16')](0xcc)[_0xa2e8('0x22')]();});}};}function handleEntityNotFound(_0x2b50cb,_0x107963){return function(_0x18d684){if(!_0x18d684){_0x2b50cb[_0xa2e8('0x15')](0x194);}return _0x18d684;};}function handleError(_0x3e42ff,_0x475cba){_0x475cba=_0x475cba||0x1f4;return function(_0x63fe5e){logger[_0xa2e8('0x23')](_0x63fe5e['stack']);if(_0x63fe5e[_0xa2e8('0x24')]){delete _0x63fe5e[_0xa2e8('0x24')];}_0x3e42ff[_0xa2e8('0x16')](_0x475cba)[_0xa2e8('0x25')](_0x63fe5e);};}exports['index']=function(_0x54775c,_0x2dbb3a){var _0x14558f={},_0x5367c6={},_0x6f918f={'count':0x0,'rows':[]};var _0xdf0f7f=_[_0xa2e8('0x26')](db[_0xa2e8('0x27')][_0xa2e8('0x28')],function(_0x1142e2){return{'name':_0x1142e2[_0xa2e8('0x29')],'type':_0x1142e2['type']['key']};});_0x5367c6[_0xa2e8('0x2a')]=_[_0xa2e8('0x26')](_0xdf0f7f,_0xa2e8('0x24'));_0x5367c6[_0xa2e8('0x2b')]=_[_0xa2e8('0x2c')](_0x54775c[_0xa2e8('0x2b')]);_0x5367c6[_0xa2e8('0x2d')]=_[_0xa2e8('0x2e')](_0x5367c6['model'],_0x5367c6[_0xa2e8('0x2b')]);_0x14558f[_0xa2e8('0x2f')]=_[_0xa2e8('0x2e')](_0x5367c6['model'],qs[_0xa2e8('0x30')](_0x54775c[_0xa2e8('0x2b')][_0xa2e8('0x30')]));_0x14558f[_0xa2e8('0x2f')]=_0x14558f[_0xa2e8('0x2f')][_0xa2e8('0x31')]?_0x14558f[_0xa2e8('0x2f')]:_0x5367c6[_0xa2e8('0x2a')];if(!_0x54775c[_0xa2e8('0x2b')][_0xa2e8('0x32')](_0xa2e8('0x33'))){_0x14558f[_0xa2e8('0x34')]=qs['limit'](_0x54775c[_0xa2e8('0x2b')][_0xa2e8('0x34')]);_0x14558f[_0xa2e8('0x17')]=qs[_0xa2e8('0x17')](_0x54775c[_0xa2e8('0x2b')][_0xa2e8('0x17')]);}_0x14558f[_0xa2e8('0x35')]=qs['sort'](_0x54775c['query']['sort']);_0x14558f['where']=qs[_0xa2e8('0x2d')](_[_0xa2e8('0x36')](_0x54775c[_0xa2e8('0x2b')],_0x5367c6[_0xa2e8('0x2d')]),_0xdf0f7f);if(_0x54775c['query'][_0xa2e8('0x37')]){_0x14558f[_0xa2e8('0x38')]=_['merge'](_0x14558f[_0xa2e8('0x38')],{'$or':_[_0xa2e8('0x26')](_0xdf0f7f,function(_0xccbb19){if(_0xccbb19[_0xa2e8('0x39')]!==_0xa2e8('0x3a')){var _0x3faec4={};_0x3faec4[_0xccbb19[_0xa2e8('0x24')]]={'$like':'%'+_0x54775c[_0xa2e8('0x2b')][_0xa2e8('0x37')]+'%'};return _0x3faec4;}})});}_0x14558f=_[_0xa2e8('0x3b')]({},_0x14558f,_0x54775c[_0xa2e8('0x3c')]);var _0x2c0e31={'where':_0x14558f[_0xa2e8('0x38')]};return db['JscriptyAnswerReport'][_0xa2e8('0x19')](_0x2c0e31)[_0xa2e8('0x20')](function(_0x129d7d){_0x6f918f[_0xa2e8('0x19')]=_0x129d7d;if(_0x54775c['query'][_0xa2e8('0x3d')]){_0x14558f[_0xa2e8('0x3e')]=[{'all':!![]}];}return db[_0xa2e8('0x27')][_0xa2e8('0x3f')](_0x14558f);})['then'](function(_0x2b24ad){_0x6f918f[_0xa2e8('0x40')]=_0x2b24ad;return _0x6f918f;})[_0xa2e8('0x20')](respondWithFilteredResult(_0x2dbb3a,_0x14558f))[_0xa2e8('0x41')](handleError(_0x2dbb3a,null));};exports['show']=function(_0xf3a6df,_0x2fc282){var _0x596c77={'raw':!![],'where':{'id':_0xf3a6df[_0xa2e8('0x42')]['id']}},_0x415671={};_0x415671[_0xa2e8('0x2a')]=_[_0xa2e8('0x2c')](db[_0xa2e8('0x27')][_0xa2e8('0x28')]);_0x415671['query']=_['keys'](_0xf3a6df['query']);_0x415671['filters']=_[_0xa2e8('0x2e')](_0x415671[_0xa2e8('0x2a')],_0x415671[_0xa2e8('0x2b')]);_0x596c77[_0xa2e8('0x2f')]=_[_0xa2e8('0x2e')](_0x415671[_0xa2e8('0x2a')],qs['fields'](_0xf3a6df[_0xa2e8('0x2b')][_0xa2e8('0x30')]));_0x596c77['attributes']=_0x596c77['attributes'][_0xa2e8('0x31')]?_0x596c77['attributes']:_0x415671[_0xa2e8('0x2a')];if(_0xf3a6df['query']['includeAll']){_0x596c77[_0xa2e8('0x3e')]=[{'all':!![]}];}_0x596c77=_[_0xa2e8('0x3b')]({},_0x596c77,_0xf3a6df[_0xa2e8('0x3c')]);return db[_0xa2e8('0x27')][_0xa2e8('0x43')](_0x596c77)[_0xa2e8('0x20')](handleEntityNotFound(_0x2fc282,null))[_0xa2e8('0x20')](respondWithResult(_0x2fc282,null))[_0xa2e8('0x41')](handleError(_0x2fc282,null));};exports['create']=function(_0x2d79fa,_0x9c4023){return db[_0xa2e8('0x27')][_0xa2e8('0x44')](_0x2d79fa[_0xa2e8('0x45')],{})[_0xa2e8('0x20')](respondWithResult(_0x9c4023,0xc9))['catch'](handleError(_0x9c4023,null));};exports[_0xa2e8('0x1f')]=function(_0x4dfa8c,_0x4721fd){if(_0x4dfa8c[_0xa2e8('0x45')]['id']){delete _0x4dfa8c[_0xa2e8('0x45')]['id'];}return db[_0xa2e8('0x27')]['find']({'where':{'id':_0x4dfa8c[_0xa2e8('0x42')]['id']}})[_0xa2e8('0x20')](handleEntityNotFound(_0x4721fd,null))[_0xa2e8('0x20')](saveUpdates(_0x4dfa8c[_0xa2e8('0x45')],null))[_0xa2e8('0x20')](respondWithResult(_0x4721fd,null))[_0xa2e8('0x41')](handleError(_0x4721fd,null));};exports[_0xa2e8('0x21')]=function(_0x88e2f8,_0x470912){return db[_0xa2e8('0x27')]['find']({'where':{'id':_0x88e2f8[_0xa2e8('0x42')]['id']}})[_0xa2e8('0x20')](handleEntityNotFound(_0x470912,null))[_0xa2e8('0x20')](removeEntity(_0x470912,null))[_0xa2e8('0x41')](handleError(_0x470912,null));};exports[_0xa2e8('0x46')]=function(_0x585a40,_0x75b60f){return db[_0xa2e8('0x27')][_0xa2e8('0x46')]()[_0xa2e8('0x20')](respondWithResult(_0x75b60f,null))['catch'](handleError(_0x75b60f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index be31bf9..699cb29 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 _0x186e=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','util'];(function(_0x133eb2,_0x56f0b7){var _0x5e2761=function(_0x38d051){while(--_0x38d051){_0x133eb2['push'](_0x133eb2['shift']());}};_0x5e2761(++_0x56f0b7);}(_0x186e,0xef));var _0xe186=function(_0x2e37c1,_0x3ca3a3){_0x2e37c1=_0x2e37c1-0x0;var _0x5fb1f6=_0x186e[_0x2e37c1];return _0x5fb1f6;};'use strict';var _=require('lodash');var util=require(_0xe186('0x0'));var logger=require(_0xe186('0x1'))('api');var moment=require(_0xe186('0x2'));var BPromise=require('bluebird');var rp=require(_0xe186('0x3'));var fs=require('fs');var path=require(_0xe186('0x4'));var rimraf=require(_0xe186('0x5'));var config=require(_0xe186('0x6'));var attributes=require(_0xe186('0x7'));module[_0xe186('0x8')]=function(_0x3b61c6,_0x4cd20e){return _0x3b61c6[_0xe186('0x9')](_0xe186('0xa'),attributes,{'tableName':_0xe186('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa554=['path','../../config/environment','exports','define','JscriptyAnswerReport','../../config/logger','bluebird','request-promise'];(function(_0x4b9996,_0x471642){var _0x1d33ea=function(_0x3efafe){while(--_0x3efafe){_0x4b9996['push'](_0x4b9996['shift']());}};_0x1d33ea(++_0x471642);}(_0xa554,0x10d));var _0x4a55=function(_0x50b861,_0x3d1d0a){_0x50b861=_0x50b861-0x0;var _0x550079=_0xa554[_0x50b861];return _0x550079;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4a55('0x0'))('api');var moment=require('moment');var BPromise=require(_0x4a55('0x1'));var rp=require(_0x4a55('0x2'));var fs=require('fs');var path=require(_0x4a55('0x3'));var rimraf=require('rimraf');var config=require(_0x4a55('0x4'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x4a55('0x5')]=function(_0x3f112f,_0x51c576){return _0x3f112f[_0x4a55('0x6')](_0x4a55('0x7'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index ae57160..0d4b38c 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 _0x29be=['error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xa2e584,_0x2ded2f){var _0xf4a6c4=function(_0x2f31d9){while(--_0x2f31d9){_0xa2e584['push'](_0xa2e584['shift']());}};_0xf4a6c4(++_0x2ded2f);}(_0x29be,0xca));var _0xe29b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x29be[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xe29b('0x0'));var util=require(_0xe29b('0x1'));var moment=require(_0xe29b('0x2'));var BPromise=require(_0xe29b('0x3'));var rs=require(_0xe29b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe29b('0x5'))['db'];var utils=require(_0xe29b('0x6'));var logger=require('../../config/logger')(_0xe29b('0x7'));var config=require(_0xe29b('0x8'));var jayson=require(_0xe29b('0x9'));var client=jayson[_0xe29b('0xa')][_0xe29b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bfa2f,_0x2b9c8f,_0x4c464d){return new BPromise(function(_0x2d3754,_0x2f53a4){return client[_0xe29b('0xc')](_0x1bfa2f,_0x4c464d)['then'](function(_0xa870e9){logger[_0xe29b('0xd')](_0xe29b('0xe'),_0x2b9c8f,_0xe29b('0xf'));logger['debug'](_0xe29b('0x10'),_0x2b9c8f,_0xe29b('0xf'),JSON[_0xe29b('0x11')](_0xa870e9));if(_0xa870e9['error']){if(_0xa870e9[_0xe29b('0x12')][_0xe29b('0x13')]===0x1f4){logger[_0xe29b('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2b9c8f,_0xa870e9['error'][_0xe29b('0x14')]);return _0x2f53a4(_0xa870e9[_0xe29b('0x12')][_0xe29b('0x14')]);}logger['error'](_0xe29b('0xe'),_0x2b9c8f,_0xa870e9[_0xe29b('0x12')][_0xe29b('0x14')]);return _0x2d3754(_0xa870e9[_0xe29b('0x12')][_0xe29b('0x14')]);}else{logger[_0xe29b('0xd')](_0xe29b('0xe'),_0x2b9c8f,_0xe29b('0xf'));_0x2d3754(_0xa870e9['result']['message']);}})[_0xe29b('0x15')](function(_0x47839b){logger[_0xe29b('0x12')](_0xe29b('0xe'),_0x2b9c8f,_0x47839b);_0x2f53a4(_0x47839b);});});} \ No newline at end of file +var _0xbf92=['client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x2fcf9d,_0x86df01){var _0xd948a=function(_0x1d4d2c){while(--_0x1d4d2c){_0x2fcf9d['push'](_0x2fcf9d['shift']());}};_0xd948a(++_0x86df01);}(_0xbf92,0x182));var _0x2bf9=function(_0x1db80b,_0xf6d409){_0x1db80b=_0x1db80b-0x0;var _0x344939=_0xbf92[_0x1db80b];return _0x344939;};'use strict';var _=require(_0x2bf9('0x0'));var util=require(_0x2bf9('0x1'));var moment=require(_0x2bf9('0x2'));var BPromise=require(_0x2bf9('0x3'));var rs=require(_0x2bf9('0x4'));var fs=require('fs');var Redis=require(_0x2bf9('0x5'));var db=require(_0x2bf9('0x6'))['db'];var utils=require(_0x2bf9('0x7'));var logger=require(_0x2bf9('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2bf9('0x9'));var client=jayson[_0x2bf9('0xa')][_0x2bf9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36c6d2,_0x4b4645,_0x243f77){return new BPromise(function(_0x402200,_0x274195){return client[_0x2bf9('0xc')](_0x36c6d2,_0x243f77)[_0x2bf9('0xd')](function(_0xbd3c14){logger['info'](_0x2bf9('0xe'),_0x4b4645,_0x2bf9('0xf'));logger['debug'](_0x2bf9('0x10'),_0x4b4645,'request\x20sent',JSON[_0x2bf9('0x11')](_0xbd3c14));if(_0xbd3c14[_0x2bf9('0x12')]){if(_0xbd3c14[_0x2bf9('0x12')][_0x2bf9('0x13')]===0x1f4){logger[_0x2bf9('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4b4645,_0xbd3c14[_0x2bf9('0x12')][_0x2bf9('0x14')]);return _0x274195(_0xbd3c14[_0x2bf9('0x12')][_0x2bf9('0x14')]);}logger[_0x2bf9('0x12')](_0x2bf9('0xe'),_0x4b4645,_0xbd3c14['error'][_0x2bf9('0x14')]);return _0x402200(_0xbd3c14[_0x2bf9('0x12')][_0x2bf9('0x14')]);}else{logger['info'](_0x2bf9('0xe'),_0x4b4645,_0x2bf9('0xf'));_0x402200(_0xbd3c14['result'][_0x2bf9('0x14')]);}})[_0x2bf9('0x15')](function(_0x2331c2){logger[_0x2bf9('0x12')](_0x2bf9('0xe'),_0x4b4645,_0x2331c2);_0x274195(_0x2331c2);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 062f6c4..3a95945 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 _0x68f3=['index','show','/:id/answers','getAnswers','/:id/summary','getSummary','create','post','clone','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated'];(function(_0xfc6f31,_0x29edeb){var _0x59b15b=function(_0x593fe2){while(--_0x593fe2){_0xfc6f31['push'](_0xfc6f31['shift']());}};_0x59b15b(++_0x29edeb);}(_0x68f3,0x139));var _0x368f=function(_0xe5aab5,_0x555546){_0xe5aab5=_0xe5aab5-0x0;var _0x16401c=_0x68f3[_0xe5aab5];return _0x16401c;};'use strict';var multer=require(_0x368f('0x0'));var util=require(_0x368f('0x1'));var path=require(_0x368f('0x2'));var timeout=require(_0x368f('0x3'));var express=require('express');var router=express[_0x368f('0x4')]();var fs_extra=require(_0x368f('0x5'));var auth=require(_0x368f('0x6'));var interaction=require(_0x368f('0x7'));var config=require(_0x368f('0x8'));var controller=require(_0x368f('0x9'));router[_0x368f('0xa')]('/',auth[_0x368f('0xb')](),controller[_0x368f('0xc')]);router[_0x368f('0xa')]('/:id',auth[_0x368f('0xb')](),controller[_0x368f('0xd')]);router[_0x368f('0xa')]('/:id/sessions',auth[_0x368f('0xb')](),controller['getSessions']);router[_0x368f('0xa')](_0x368f('0xe'),auth[_0x368f('0xb')](),controller[_0x368f('0xf')]);router[_0x368f('0xa')](_0x368f('0x10'),auth['isAuthenticated'](),timeout('30s'),controller[_0x368f('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x368f('0x12')]);router[_0x368f('0x13')]('/:id/clone',auth[_0x368f('0xb')](),controller[_0x368f('0x14')]);router['put'](_0x368f('0x15'),auth[_0x368f('0xb')](),controller['update']);router[_0x368f('0x16')](_0x368f('0x15'),auth[_0x368f('0xb')](),controller[_0x368f('0x17')]);module[_0x368f('0x18')]=router; \ No newline at end of file +var _0xe908=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','update','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x5d2f93,_0x2b3c81){var _0xa1c2f4=function(_0x7c14cf){while(--_0x7c14cf){_0x5d2f93['push'](_0x5d2f93['shift']());}};_0xa1c2f4(++_0x2b3c81);}(_0xe908,0x1db));var _0x8e90=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xe908[_0x334841];return _0x5beb4b;};'use strict';var multer=require(_0x8e90('0x0'));var util=require(_0x8e90('0x1'));var path=require(_0x8e90('0x2'));var timeout=require(_0x8e90('0x3'));var express=require('express');var router=express[_0x8e90('0x4')]();var fs_extra=require(_0x8e90('0x5'));var auth=require(_0x8e90('0x6'));var interaction=require(_0x8e90('0x7'));var config=require(_0x8e90('0x8'));var controller=require(_0x8e90('0x9'));router[_0x8e90('0xa')]('/',auth[_0x8e90('0xb')](),controller[_0x8e90('0xc')]);router[_0x8e90('0xa')](_0x8e90('0xd'),auth[_0x8e90('0xb')](),controller[_0x8e90('0xe')]);router[_0x8e90('0xa')](_0x8e90('0xf'),auth[_0x8e90('0xb')](),controller[_0x8e90('0x10')]);router['get'](_0x8e90('0x11'),auth[_0x8e90('0xb')](),controller[_0x8e90('0x12')]);router[_0x8e90('0xa')](_0x8e90('0x13'),auth[_0x8e90('0xb')](),timeout(_0x8e90('0x14')),controller[_0x8e90('0x15')]);router[_0x8e90('0x16')]('/',auth[_0x8e90('0xb')](),controller[_0x8e90('0x17')]);router[_0x8e90('0x16')](_0x8e90('0x18'),auth['isAuthenticated'](),controller[_0x8e90('0x19')]);router[_0x8e90('0x1a')](_0x8e90('0xd'),auth['isAuthenticated'](),controller[_0x8e90('0x1b')]);router['delete'](_0x8e90('0xd'),auth[_0x8e90('0xb')](),controller[_0x8e90('0x1c')]);module[_0x8e90('0x1d')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index ef04a45..f7a29a6 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 _0x8bf5=['isObjectLike','setDataValue','formData','stringify','isString','format','getDataValue','BOOLEAN','sequelize','lodash','util','exports','name','TEXT','long'];(function(_0x1c2a8d,_0x374f00){var _0x40aa35=function(_0x5c4a2c){while(--_0x5c4a2c){_0x1c2a8d['push'](_0x1c2a8d['shift']());}};_0x40aa35(++_0x374f00);}(_0x8bf5,0x1d9));var _0x58bf=function(_0x234913,_0x5810a2){_0x234913=_0x234913-0x0;var _0x5835f0=_0x8bf5[_0x234913];return _0x5835f0;};'use strict';var Sequelize=require(_0x58bf('0x0'));var _=require(_0x58bf('0x1'));var util=require(_0x58bf('0x2'));module[_0x58bf('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x58bf('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x58bf('0x5')](_0x58bf('0x6')),'set':function(_0x2a2f1f){if(_[_0x58bf('0x7')](_0x2a2f1f)){this[_0x58bf('0x8')](_0x58bf('0x9'),JSON[_0x58bf('0xa')](_0x2a2f1f));}else if(_[_0x58bf('0xb')](_0x2a2f1f)){this[_0x58bf('0x8')](_0x58bf('0x9'),_0x2a2f1f);}else{this[_0x58bf('0x8')](_0x58bf('0x9'),util[_0x58bf('0xc')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0x58bf('0x4'))||'',this[_0x58bf('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x58bf('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x996f=['setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','name','STRING','long'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x996f,0x171));var _0xf996=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x996f[_0x16d10f];return _0x50c823;};'use strict';var Sequelize=require(_0xf996('0x0'));var _=require(_0xf996('0x1'));var util=require(_0xf996('0x2'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xf996('0x3')},'description':{'type':Sequelize[_0xf996('0x4')]},'formData':{'type':Sequelize['TEXT'](_0xf996('0x5')),'set':function(_0x21b94e){if(_['isObjectLike'](_0x21b94e)){this[_0xf996('0x6')]('formData',JSON[_0xf996('0x7')](_0x21b94e));}else if(_[_0xf996('0x8')](_0x21b94e)){this[_0xf996('0x6')](_0xf996('0x9'),_0x21b94e);}else{this[_0xf996('0x6')](_0xf996('0x9'),util[_0xf996('0xa')](_0xf996('0xb'),this['getDataValue']('name')||'',this[_0xf996('0xc')](_0xf996('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xf996('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xf996('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 9f7f596..5dab48d 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 _0x793b=['pick','filter','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','omit','createdAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','merge','JscriptySessionReport','findAll','JscriptyAnswerReport','order','rows','number','fromCharCode','toString','indexOf','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','name','send','map','JscriptyProject','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where'];(function(_0x769acd,_0xce76ab){var _0x1aba04=function(_0x3af41b){while(--_0x3af41b){_0x769acd['push'](_0x769acd['shift']());}};_0x1aba04(++_0xce76ab);}(_0x793b,0x189));var _0xb793=function(_0x24fe78,_0x570a7c){_0x24fe78=_0x24fe78-0x0;var _0x1620c4=_0x793b[_0x24fe78];return _0x1620c4;};'use strict';var emlformat=require(_0xb793('0x0'));var rimraf=require(_0xb793('0x1'));var zipdir=require(_0xb793('0x2'));var jsonpatch=require(_0xb793('0x3'));var rp=require(_0xb793('0x4'));var moment=require('moment');var BPromise=require(_0xb793('0x5'));var Mustache=require(_0xb793('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb793('0x7'));var csv=require(_0xb793('0x8'));var ejs=require(_0xb793('0x9'));var fs=require('fs');var fs_extra=require(_0xb793('0xa'));var _=require(_0xb793('0xb'));var squel=require(_0xb793('0xc'));var crypto=require(_0xb793('0xd'));var jsforce=require(_0xb793('0xe'));var deskjs=require(_0xb793('0xf'));var toCsv=require(_0xb793('0x8'));var querystring=require(_0xb793('0x10'));var Papa=require(_0xb793('0x11'));var Redis=require(_0xb793('0x12'));var authService=require(_0xb793('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb793('0x14'));var hardwareService=require(_0xb793('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xb793('0x16'));var config=require(_0xb793('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb793('0x18'))['db'];function respondWithStatusCode(_0x2dd4ce,_0x4ae048){_0x4ae048=_0x4ae048||0xcc;return function(_0x13d536){if(_0x13d536){return _0x2dd4ce[_0xb793('0x19')](_0x4ae048);}return _0x2dd4ce[_0xb793('0x1a')](_0x4ae048)[_0xb793('0x1b')]();};}function respondWithResult(_0x22ed49,_0x1823ff){_0x1823ff=_0x1823ff||0xc8;return function(_0x19d2cb){if(_0x19d2cb){return _0x22ed49['status'](_0x1823ff)[_0xb793('0x1c')](_0x19d2cb);}};}function respondWithFilteredResult(_0x512ba4,_0x5a2baa){return function(_0x20ab1e){if(_0x20ab1e){var _0x18fb18=typeof _0x5a2baa[_0xb793('0x1d')]===_0xb793('0x1e')&&typeof _0x5a2baa[_0xb793('0x1f')]===_0xb793('0x1e');var _0x18c005=_0x20ab1e[_0xb793('0x20')];var _0x977026=_0x18fb18?0x0:_0x5a2baa[_0xb793('0x1d')];var _0x2c9e87=_0x18fb18?_0x20ab1e[_0xb793('0x20')]:_0x5a2baa[_0xb793('0x1d')]+_0x5a2baa[_0xb793('0x1f')];var _0x422fbc;if(_0x2c9e87>=_0x18c005){_0x2c9e87=_0x18c005;_0x422fbc=0xc8;}else{_0x422fbc=0xce;}_0x512ba4[_0xb793('0x1a')](_0x422fbc);return _0x512ba4['set'](_0xb793('0x21'),_0x977026+'-'+_0x2c9e87+'/'+_0x18c005)[_0xb793('0x1c')](_0x20ab1e);}return null;};}function patchUpdates(_0x54bfd4){return function(_0xc9bf85){try{jsonpatch[_0xb793('0x22')](_0xc9bf85,_0x54bfd4,!![]);}catch(_0x7d91d){return BPromise[_0xb793('0x23')](_0x7d91d);}return _0xc9bf85[_0xb793('0x24')]();};}function saveUpdates(_0x4b55c0,_0x5ecf9c){return function(_0x43855b){if(_0x43855b){return _0x43855b[_0xb793('0x25')](_0x4b55c0)[_0xb793('0x26')](function(_0x42081a){return _0x42081a;});}return null;};}function removeEntity(_0x37302f,_0x3753d3){return function(_0x4d4544){if(_0x4d4544){return _0x4d4544[_0xb793('0x27')]()['then'](function(){var _0x10947e=_0x4d4544[_0xb793('0x28')]({'plain':!![]});var _0x14ecb0=_0xb793('0x29');return db[_0xb793('0x2a')][_0xb793('0x27')]({'where':{'type':_0x14ecb0,'resourceId':_0x10947e['id']}})[_0xb793('0x26')](function(){return _0x4d4544;});})['then'](function(){_0x37302f[_0xb793('0x1a')](0xcc)[_0xb793('0x1b')]();});}};}function handleEntityNotFound(_0x411f00,_0x2d5444){return function(_0x35cd9d){if(!_0x35cd9d){_0x411f00[_0xb793('0x19')](0x194);}return _0x35cd9d;};}function handleError(_0x5db9e0,_0x2ccb56){_0x2ccb56=_0x2ccb56||0x1f4;return function(_0x249acf){logger[_0xb793('0x2b')](_0x249acf['stack']);if(_0x249acf[_0xb793('0x2c')]){delete _0x249acf[_0xb793('0x2c')];}_0x5db9e0[_0xb793('0x1a')](_0x2ccb56)[_0xb793('0x2d')](_0x249acf);};}exports['index']=function(_0x493a8c,_0x3d7934){var _0x4b0297={},_0x4864f0={},_0x8a0bed={'count':0x0,'rows':[]};var _0x2e659d=_[_0xb793('0x2e')](db[_0xb793('0x2f')]['rawAttributes'],function(_0x78afcd){return{'name':_0x78afcd[_0xb793('0x30')],'type':_0x78afcd[_0xb793('0x31')][_0xb793('0x32')]};});_0x4864f0['model']=_[_0xb793('0x2e')](_0x2e659d,_0xb793('0x2c'));_0x4864f0[_0xb793('0x33')]=_[_0xb793('0x34')](_0x493a8c[_0xb793('0x33')]);_0x4864f0[_0xb793('0x35')]=_[_0xb793('0x36')](_0x4864f0[_0xb793('0x37')],_0x4864f0['query']);_0x4b0297['attributes']=_[_0xb793('0x36')](_0x4864f0[_0xb793('0x37')],qs[_0xb793('0x38')](_0x493a8c[_0xb793('0x33')]['fields']));_0x4b0297[_0xb793('0x39')]=_0x4b0297[_0xb793('0x39')][_0xb793('0x3a')]?_0x4b0297[_0xb793('0x39')]:_0x4864f0[_0xb793('0x37')];if(!_0x493a8c['query'][_0xb793('0x3b')](_0xb793('0x3c'))){_0x4b0297[_0xb793('0x1f')]=qs[_0xb793('0x1f')](_0x493a8c[_0xb793('0x33')][_0xb793('0x1f')]);_0x4b0297[_0xb793('0x1d')]=qs['offset'](_0x493a8c[_0xb793('0x33')][_0xb793('0x1d')]);}_0x4b0297['order']=qs[_0xb793('0x3d')](_0x493a8c[_0xb793('0x33')]['sort']);_0x4b0297[_0xb793('0x3e')]=qs['filters'](_[_0xb793('0x3f')](_0x493a8c[_0xb793('0x33')],_0x4864f0['filters']),_0x2e659d);if(_0x493a8c[_0xb793('0x33')][_0xb793('0x40')]){_0x4b0297['where']=_['merge'](_0x4b0297[_0xb793('0x3e')],{'$or':_[_0xb793('0x2e')](_0x2e659d,function(_0x109070){if(_0x109070[_0xb793('0x31')]!==_0xb793('0x41')){var _0x2462f4={};_0x2462f4[_0x109070[_0xb793('0x2c')]]={'$like':'%'+_0x493a8c['query'][_0xb793('0x40')]+'%'};return _0x2462f4;}})});}_0x4b0297=_['merge']({},_0x4b0297,_0x493a8c[_0xb793('0x42')]);var _0x411bd8={'where':_0x4b0297[_0xb793('0x3e')]};return db[_0xb793('0x2f')][_0xb793('0x20')](_0x411bd8)['then'](function(_0x5eb049){_0x8a0bed[_0xb793('0x20')]=_0x5eb049;if(_0x493a8c['query'][_0xb793('0x43')]){_0x4b0297[_0xb793('0x44')]=[{'all':!![]}];}return db[_0xb793('0x2f')]['findAll'](_0x4b0297);})[_0xb793('0x26')](function(_0x42ae72){_0x8a0bed['rows']=_0x42ae72;return _0x8a0bed;})[_0xb793('0x26')](respondWithFilteredResult(_0x3d7934,_0x4b0297))[_0xb793('0x45')](handleError(_0x3d7934,null));};exports[_0xb793('0x46')]=function(_0x1ba5a2,_0x544a15){var _0x19b40b={'raw':![],'where':{'id':_0x1ba5a2[_0xb793('0x47')]['id']}},_0x3b58a0={};_0x3b58a0['model']=_[_0xb793('0x34')](db[_0xb793('0x2f')][_0xb793('0x48')]);_0x3b58a0['query']=_[_0xb793('0x34')](_0x1ba5a2[_0xb793('0x33')]);_0x3b58a0['filters']=_[_0xb793('0x36')](_0x3b58a0[_0xb793('0x37')],_0x3b58a0['query']);_0x19b40b[_0xb793('0x39')]=_['intersection'](_0x3b58a0['model'],qs[_0xb793('0x38')](_0x1ba5a2['query'][_0xb793('0x38')]));_0x19b40b[_0xb793('0x39')]=_0x19b40b[_0xb793('0x39')]['length']?_0x19b40b[_0xb793('0x39')]:_0x3b58a0[_0xb793('0x37')];if(_0x1ba5a2[_0xb793('0x33')][_0xb793('0x43')]){_0x19b40b[_0xb793('0x44')]=[{'all':!![]}];}_0x19b40b=_['merge']({},_0x19b40b,_0x1ba5a2[_0xb793('0x42')]);return db[_0xb793('0x2f')][_0xb793('0x49')](_0x19b40b)[_0xb793('0x26')](handleEntityNotFound(_0x544a15,null))['then'](respondWithResult(_0x544a15,null))[_0xb793('0x45')](handleError(_0x544a15,null));};exports['create']=function(_0x5b069d,_0x41fc7a){return db[_0xb793('0x2f')][_0xb793('0x4a')](_0x5b069d[_0xb793('0x4b')],{})[_0xb793('0x26')](function(_0x30f7a1){var _0x258cd7=_0x5b069d['user'][_0xb793('0x28')]({'plain':!![]});if(!_0x258cd7)throw new Error(_0xb793('0x4c'));if(_0x258cd7[_0xb793('0x4d')]===_0xb793('0x4e')){var _0xa72be6=_0x30f7a1[_0xb793('0x28')]({'plain':!![]});var _0x410bc4=_0xb793('0x29');return db[_0xb793('0x4f')][_0xb793('0x49')]({'where':{'name':_0x410bc4,'userProfileId':_0x258cd7['userProfileId']},'raw':!![]})['then'](function(_0xd1721c){if(_0xd1721c&&_0xd1721c[_0xb793('0x50')]===0x0){return db[_0xb793('0x2a')][_0xb793('0x4a')]({'name':_0xa72be6['name'],'resourceId':_0xa72be6['id'],'type':_0xd1721c[_0xb793('0x2c')],'sectionId':_0xd1721c['id']},{})[_0xb793('0x26')](function(){return _0x30f7a1;});}else{return _0x30f7a1;}})[_0xb793('0x45')](function(_0x1ff0b9){logger[_0xb793('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ff0b9);throw _0x1ff0b9;});}return _0x30f7a1;})[_0xb793('0x26')](respondWithResult(_0x41fc7a,0xc9))[_0xb793('0x45')](handleError(_0x41fc7a,null));};exports['clone']=function(_0x586b6d,_0x688faa){var _0x3335f8={'where':{'id':_0x586b6d[_0xb793('0x47')]['id']}},_0xa0cef9={};_0xa0cef9['model']=_[_0xb793('0x34')](db[_0xb793('0x2f')][_0xb793('0x48')]);_0x3335f8[_0xb793('0x39')]=_['intersection'](_0xa0cef9[_0xb793('0x37')],qs[_0xb793('0x38')](_0x586b6d['query']['fields']));_0x3335f8[_0xb793('0x39')]=_0x3335f8['attributes']['length']?_0x3335f8[_0xb793('0x39')]:_0xa0cef9[_0xb793('0x37')];if(_0x586b6d[_0xb793('0x33')][_0xb793('0x43')]){_0x3335f8[_0xb793('0x44')]=[{'all':!![]}];}_0x3335f8=_['merge']({},_0x3335f8,_0x586b6d[_0xb793('0x42')]);return db['JscriptyProject'][_0xb793('0x49')](_0x3335f8)['then'](handleEntityNotFound(_0x688faa,null))[_0xb793('0x26')](function(_0x30f7e8){if(_0x30f7e8){var _0x3f45c7=_0x30f7e8[_0xb793('0x28')]({'plain':!![]});_0x3f45c7=qs[_0xb793('0x51')](_0x3f45c7,['id','createdAt','updatedAt']);_0x586b6d[_0xb793('0x4b')]=_[_0xb793('0x51')](_0x586b6d[_0xb793('0x4b')],['id',_0xb793('0x52'),'updatedAt']);return db[_0xb793('0x2f')][_0xb793('0x4a')](_['merge'](_0x3f45c7,_0x586b6d['body']),{'include':_0x586b6d['query'][_0xb793('0x43')]?[{'all':!![]}]:undefined})[_0xb793('0x26')](function(_0x48c6f0){var _0x4bf10c=_0x586b6d[_0xb793('0x4e')][_0xb793('0x28')]({'plain':!![]});if(!_0x4bf10c)throw new Error(_0xb793('0x4c'));if(_0x4bf10c[_0xb793('0x4d')]===_0xb793('0x4e')){var _0x4d809f=_0x48c6f0[_0xb793('0x28')]({'plain':!![]});var _0x1b5ba5=_0xb793('0x29');return db[_0xb793('0x4f')][_0xb793('0x49')]({'where':{'name':_0x1b5ba5,'userProfileId':_0x4bf10c[_0xb793('0x53')]},'raw':!![]})['then'](function(_0x17d02b){if(_0x17d02b&&_0x17d02b[_0xb793('0x50')]===0x0){return db[_0xb793('0x2a')][_0xb793('0x4a')]({'name':_0x4d809f['name'],'resourceId':_0x4d809f['id'],'type':_0x17d02b[_0xb793('0x2c')],'sectionId':_0x17d02b['id']},{})[_0xb793('0x26')](function(){return _0x48c6f0;});}else{return _0x48c6f0;}})['catch'](function(_0x226206){logger[_0xb793('0x2b')](_0xb793('0x54'),_0x226206);throw _0x226206;});}return _0x48c6f0;});}})['then'](respondWithResult(_0x688faa,0xc9))[_0xb793('0x45')](handleError(_0x688faa,null));};exports[_0xb793('0x25')]=function(_0x436be9,_0x3cb411){if(_0x436be9['body']['id']){delete _0x436be9[_0xb793('0x4b')]['id'];}return db['JscriptyProject'][_0xb793('0x49')]({'where':{'id':_0x436be9[_0xb793('0x47')]['id']}})['then'](handleEntityNotFound(_0x3cb411,null))['then'](saveUpdates(_0x436be9[_0xb793('0x4b')],null))[_0xb793('0x26')](respondWithResult(_0x3cb411,null))[_0xb793('0x45')](handleError(_0x3cb411,null));};exports[_0xb793('0x27')]=function(_0xd02314,_0x4a86ba){return db[_0xb793('0x2f')]['find']({'where':{'id':_0xd02314[_0xb793('0x47')]['id']}})[_0xb793('0x26')](handleEntityNotFound(_0x4a86ba,null))['then'](removeEntity(_0x4a86ba,null))[_0xb793('0x45')](handleError(_0x4a86ba,null));};exports['getSessions']=function(_0x3fd94f,_0xc9361d,_0x4d6b85){var _0xf235d4={'raw':!![],'where':{}};var _0x4d5ccc={};var _0x1f61e3={'count':0x0,'rows':[]};return db[_0xb793('0x2f')][_0xb793('0x55')]({'where':{'id':_0x3fd94f[_0xb793('0x47')]['id']}})[_0xb793('0x26')](handleEntityNotFound(_0xc9361d,null))[_0xb793('0x26')](function(_0x41aa54){if(_0x41aa54){_0x4d5ccc[_0xb793('0x37')]=_[_0xb793('0x34')](db['JscriptySessionReport']['rawAttributes']);_0x4d5ccc['query']=_['keys'](_0x3fd94f['query']);_0x4d5ccc[_0xb793('0x35')]=_[_0xb793('0x36')](_0x4d5ccc[_0xb793('0x37')],_0x4d5ccc['query']);_0xf235d4[_0xb793('0x39')]=_[_0xb793('0x36')](_0x4d5ccc[_0xb793('0x37')],qs[_0xb793('0x38')](_0x3fd94f[_0xb793('0x33')][_0xb793('0x38')]));_0xf235d4[_0xb793('0x39')]=_0xf235d4[_0xb793('0x39')][_0xb793('0x3a')]?_0xf235d4[_0xb793('0x39')]:_0x4d5ccc[_0xb793('0x37')];if(!_0x3fd94f[_0xb793('0x33')][_0xb793('0x3b')](_0xb793('0x3c'))){_0xf235d4[_0xb793('0x1f')]=qs[_0xb793('0x1f')](_0x3fd94f['query'][_0xb793('0x1f')]);_0xf235d4[_0xb793('0x1d')]=qs[_0xb793('0x1d')](_0x3fd94f['query'][_0xb793('0x1d')]);}_0xf235d4['order']=qs['sort'](_0x3fd94f[_0xb793('0x33')][_0xb793('0x3d')]);_0xf235d4[_0xb793('0x3e')]=qs['filters'](_[_0xb793('0x3f')](_0x3fd94f[_0xb793('0x33')],_0x4d5ccc[_0xb793('0x35')]));_0xf235d4['where']['ProjectId']=_0x41aa54['id'];if(_0x3fd94f[_0xb793('0x33')]['filter']){_0xf235d4[_0xb793('0x3e')]=_[_0xb793('0x56')](_0xf235d4['where'],{'$or':_[_0xb793('0x2e')](_0xf235d4[_0xb793('0x39')],function(_0xe340d4){var _0x3a8739={};_0x3a8739[_0xe340d4]={'$like':'%'+_0x3fd94f[_0xb793('0x33')][_0xb793('0x40')]+'%'};return _0x3a8739;})});}_0xf235d4=_[_0xb793('0x56')]({},_0xf235d4,_0x3fd94f[_0xb793('0x42')]);return db[_0xb793('0x57')][_0xb793('0x20')]({'where':_0xf235d4[_0xb793('0x3e')]})[_0xb793('0x26')](function(_0x44abc0){_0x1f61e3['count']=_0x44abc0;if(_0x3fd94f[_0xb793('0x33')]['includeAll']){_0xf235d4['include']=[{'all':!![]}];}return db[_0xb793('0x57')][_0xb793('0x58')](_0xf235d4);})[_0xb793('0x26')](function(_0x12ded8){_0x1f61e3['rows']=_0x12ded8;return _0x1f61e3;});}})[_0xb793('0x26')](respondWithFilteredResult(_0xc9361d,_0xf235d4))[_0xb793('0x45')](handleError(_0xc9361d,null));};exports['getAnswers']=function(_0x17e413,_0x9d3743,_0x1bcf9d){var _0x48a965={'raw':!![],'where':{}};var _0x20e896={};var _0x30138e={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xb793('0x55')]({'where':{'id':_0x17e413[_0xb793('0x47')]['id']}})[_0xb793('0x26')](handleEntityNotFound(_0x9d3743,null))[_0xb793('0x26')](function(_0x40d0b2){if(_0x40d0b2){_0x20e896['model']=_[_0xb793('0x34')](db[_0xb793('0x59')]['rawAttributes']);_0x20e896[_0xb793('0x33')]=_[_0xb793('0x34')](_0x17e413['query']);_0x20e896[_0xb793('0x35')]=_[_0xb793('0x36')](_0x20e896[_0xb793('0x37')],_0x20e896[_0xb793('0x33')]);_0x48a965[_0xb793('0x39')]=_[_0xb793('0x36')](_0x20e896[_0xb793('0x37')],qs['fields'](_0x17e413[_0xb793('0x33')]['fields']));_0x48a965[_0xb793('0x39')]=_0x48a965[_0xb793('0x39')][_0xb793('0x3a')]?_0x48a965[_0xb793('0x39')]:_0x20e896['model'];if(!_0x17e413['query'][_0xb793('0x3b')](_0xb793('0x3c'))){_0x48a965[_0xb793('0x1f')]=qs[_0xb793('0x1f')](_0x17e413[_0xb793('0x33')][_0xb793('0x1f')]);_0x48a965[_0xb793('0x1d')]=qs['offset'](_0x17e413['query']['offset']);}_0x48a965[_0xb793('0x5a')]=qs[_0xb793('0x3d')](_0x17e413[_0xb793('0x33')][_0xb793('0x3d')]);_0x48a965[_0xb793('0x3e')]=qs[_0xb793('0x35')](_[_0xb793('0x3f')](_0x17e413['query'],_0x20e896[_0xb793('0x35')]));_0x48a965[_0xb793('0x3e')]['ProjectId']=_0x40d0b2['id'];if(_0x17e413['query'][_0xb793('0x40')]){_0x48a965[_0xb793('0x3e')]=_[_0xb793('0x56')](_0x48a965['where'],{'$or':_[_0xb793('0x2e')](_0x48a965['attributes'],function(_0x52b765){var _0x2e5dae={};_0x2e5dae[_0x52b765]={'$like':'%'+_0x17e413[_0xb793('0x33')][_0xb793('0x40')]+'%'};return _0x2e5dae;})});}_0x48a965=_[_0xb793('0x56')]({},_0x48a965,_0x17e413[_0xb793('0x42')]);return db['JscriptyAnswerReport']['count']({'where':_0x48a965[_0xb793('0x3e')]})[_0xb793('0x26')](function(_0x21f53c){_0x30138e[_0xb793('0x20')]=_0x21f53c;if(_0x17e413[_0xb793('0x33')][_0xb793('0x43')]){_0x48a965[_0xb793('0x44')]=[{'all':!![]}];}return db[_0xb793('0x59')][_0xb793('0x58')](_0x48a965);})[_0xb793('0x26')](function(_0x2b11aa){_0x30138e[_0xb793('0x5b')]=_0x2b11aa;return _0x30138e;});}})['then'](respondWithFilteredResult(_0x9d3743,_0x48a965))[_0xb793('0x45')](handleError(_0x9d3743,null));};function char(_0x313f89){return _0xb793('0x5c')===typeof _0x313f89?String[_0xb793('0x5d')][_0xb793('0x22')](null,arguments):_0x313f89;}function needsEncapsulation(_0x1f94b3){return!!_0x1f94b3&&(_0x1f94b3[_0xb793('0x5e')]()[_0xb793('0x5f')](char(0xd))>=0x0||_0x1f94b3[_0xb793('0x5e')]()['indexOf'](char(0xa))>=0x0||_0x1f94b3[_0xb793('0x5e')]()[_0xb793('0x5f')](char(0x2c))>=0x0||_0x1f94b3['toString']()[_0xb793('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x3c9090){var _0x5a84b2=char(0x22),_0x3044db='\x5c'+char(0x22),_0x16230f=_0x3c9090[_0xb793('0x5e')]()['replace'](new RegExp(_0x5a84b2,'g'),_0x3044db);return _0x5a84b2+_0x16230f+_0x5a84b2;}exports['getSummary']=function(_0x5a16aa,_0x44f729,_0x557602){var _0x5b49fb,_0x51e968;var _0x33f428={'where':{'ProjectId':_0x5a16aa[_0xb793('0x47')]['id']}};if(_0x5a16aa[_0xb793('0x33')][_0xb793('0x60')]){_0x33f428[_0xb793('0x3e')][_0xb793('0x61')]=JSON['parse'](_0x5a16aa[_0xb793('0x33')][_0xb793('0x60')]);}return db[_0xb793('0x57')][_0xb793('0x58')](_0x33f428)[_0xb793('0x26')](handleEntityNotFound(_0x44f729,null))[_0xb793('0x26')](function(_0x5bfca4){if(_0x5bfca4){_0x5b49fb=_0x5bfca4;return db[_0xb793('0x62')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0x5b49fb,'id')},'ProjectId':_0x5a16aa[_0xb793('0x47')]['id']},'order':_0xb793('0x63')});}})[_0xb793('0x26')](handleEntityNotFound(_0x44f729,null))[_0xb793('0x26')](function(_0xa3e597){if(_0xa3e597){_0x51e968=_0xa3e597;var _0x18a485={};for(var _0x1d77f2=0x0,_0x4814ef=_0x51e968[_0xb793('0x3a')];_0x1d77f2<_0x4814ef;_0x1d77f2++){if(!_0x18a485[_0xb793('0x3b')](_0x51e968[_0x1d77f2][_0xb793('0x64')])){_0x18a485[_0x51e968[_0x1d77f2][_0xb793('0x64')]]=needsEncapsulation(_0x51e968[_0x1d77f2]['question'])?encapsulate(_0x51e968[_0x1d77f2][_0xb793('0x65')]):_0x51e968[_0x1d77f2][_0xb793('0x65')];}}var _0x13e090=[],_0x59bc94={};for(var _0x74bc29=0x0,_0x381b58=_0x5b49fb[_0xb793('0x3a')];_0x74bc29<_0x381b58;_0x74bc29++){_0x59bc94={'ProjectId':_0x5a16aa['params']['id'],'SessionId':_0x5b49fb[_0x74bc29]['id'],'StartTime':moment(_0x5b49fb[_0x74bc29]['starttime'])[_0xb793('0x66')](_0xb793('0x67'))};for(var _0xa94d99=0x0,_0x1efa07=_0x51e968[_0xb793('0x3a')];_0xa94d99<_0x1efa07;_0xa94d99++){if(_0x51e968[_0xa94d99][_0xb793('0x68')]==_0x5b49fb[_0x74bc29]['id']&&_0x18a485[_0xb793('0x3b')](_0x51e968[_0xa94d99]['questionId'])){_0x59bc94[_0x18a485[_0x51e968[_0xa94d99]['questionId']]]=_0x51e968[_0xa94d99][_0xb793('0x69')];}}for(var _0xece831 in _0x18a485){if(!_0x59bc94[_0xb793('0x3b')](_0x18a485[_0xece831])){_0x59bc94[_0x18a485[_0xece831]]=null;}}_0x13e090[_0xb793('0x6a')](_0x59bc94);}return _0x13e090;}})[_0xb793('0x26')](function(_0x19afbe){if(!_[_0xb793('0x6b')](_0x19afbe)){var _0x422b1d=toCsv(_0x19afbe);var _0x546d5c=Date['now']();fs['writeFileSync'](util[_0xb793('0x66')](_0xb793('0x6c'),_0x5a16aa[_0xb793('0x47')]['id'],_0x546d5c),_0x422b1d);_0x44f729[_0xb793('0x6d')]('Content-disposition',_0xb793('0x6e')+util[_0xb793('0x66')](_0xb793('0x6f'),_0x5a16aa['params']['id'],_0x546d5c));_0x44f729[_0xb793('0x6d')]('Content-type',_0xb793('0x70'));return _0x44f729[_0xb793('0x71')](util['format'](_0xb793('0x6c'),_0x5a16aa[_0xb793('0x47')]['id'],_0x546d5c));}else{return _0x44f729[_0xb793('0x19')](0xcc);}})[_0xb793('0x45')](handleError(_0x44f729,null));}; \ No newline at end of file +var _0xed3c=['destroy','get','UserProfileResource','end','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','UserProfileSection','userProfileId','autoAssociation','omit','createdAt','updatedAt','body','role','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','JscriptySessionReport','sort','pick','ProjectId','include','getAnswers','findOne','order','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Jscripty_Project_%d_Summary_%s.csv','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then'];(function(_0x19f1bf,_0x55db02){var _0x42311b=function(_0x2fdb6b){while(--_0x2fdb6b){_0x19f1bf['push'](_0x19f1bf['shift']());}};_0x42311b(++_0x55db02);}(_0xed3c,0x1a6));var _0xced3=function(_0xfa2f68,_0x23836e){_0xfa2f68=_0xfa2f68-0x0;var _0x252d9a=_0xed3c[_0xfa2f68];return _0x252d9a;};'use strict';var emlformat=require(_0xced3('0x0'));var rimraf=require(_0xced3('0x1'));var zipdir=require(_0xced3('0x2'));var jsonpatch=require(_0xced3('0x3'));var rp=require('request-promise');var moment=require(_0xced3('0x4'));var BPromise=require(_0xced3('0x5'));var Mustache=require(_0xced3('0x6'));var util=require('util');var path=require('path');var sox=require(_0xced3('0x7'));var csv=require(_0xced3('0x8'));var ejs=require(_0xced3('0x9'));var fs=require('fs');var fs_extra=require(_0xced3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xced3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xced3('0xc'));var Redis=require(_0xced3('0xd'));var authService=require(_0xced3('0xe'));var qs=require(_0xced3('0xf'));var as=require(_0xced3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xced3('0x11'))(_0xced3('0x12'));var utils=require(_0xced3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xced3('0x14'));var db=require(_0xced3('0x15'))['db'];function respondWithStatusCode(_0x42d879,_0x3b2ac4){_0x3b2ac4=_0x3b2ac4||0xcc;return function(_0x457caf){if(_0x457caf){return _0x42d879[_0xced3('0x16')](_0x3b2ac4);}return _0x42d879[_0xced3('0x17')](_0x3b2ac4)['end']();};}function respondWithResult(_0x65bb58,_0x5e186e){_0x5e186e=_0x5e186e||0xc8;return function(_0xf2db6f){if(_0xf2db6f){return _0x65bb58[_0xced3('0x17')](_0x5e186e)[_0xced3('0x18')](_0xf2db6f);}};}function respondWithFilteredResult(_0x39e4aa,_0x4dd4c3){return function(_0x146a21){if(_0x146a21){var _0x322c2d=typeof _0x4dd4c3['offset']===_0xced3('0x19')&&typeof _0x4dd4c3[_0xced3('0x1a')]===_0xced3('0x19');var _0x17f611=_0x146a21['count'];var _0x4569af=_0x322c2d?0x0:_0x4dd4c3['offset'];var _0x353580=_0x322c2d?_0x146a21[_0xced3('0x1b')]:_0x4dd4c3[_0xced3('0x1c')]+_0x4dd4c3[_0xced3('0x1a')];var _0x44143f;if(_0x353580>=_0x17f611){_0x353580=_0x17f611;_0x44143f=0xc8;}else{_0x44143f=0xce;}_0x39e4aa[_0xced3('0x17')](_0x44143f);return _0x39e4aa[_0xced3('0x1d')](_0xced3('0x1e'),_0x4569af+'-'+_0x353580+'/'+_0x17f611)[_0xced3('0x18')](_0x146a21);}return null;};}function patchUpdates(_0x17c011){return function(_0x2008f2){try{jsonpatch['apply'](_0x2008f2,_0x17c011,!![]);}catch(_0x5b8b1f){return BPromise['reject'](_0x5b8b1f);}return _0x2008f2[_0xced3('0x1f')]();};}function saveUpdates(_0x342b9e,_0x21e074){return function(_0x4bf915){if(_0x4bf915){return _0x4bf915[_0xced3('0x20')](_0x342b9e)[_0xced3('0x21')](function(_0x526854){return _0x526854;});}return null;};}function removeEntity(_0x559fa2,_0x3adf14){return function(_0x101708){if(_0x101708){return _0x101708[_0xced3('0x22')]()[_0xced3('0x21')](function(){var _0x50f7c1=_0x101708[_0xced3('0x23')]({'plain':!![]});var _0x23f92b='Projects';return db[_0xced3('0x24')]['destroy']({'where':{'type':_0x23f92b,'resourceId':_0x50f7c1['id']}})[_0xced3('0x21')](function(){return _0x101708;});})[_0xced3('0x21')](function(){_0x559fa2[_0xced3('0x17')](0xcc)[_0xced3('0x25')]();});}};}function handleEntityNotFound(_0x2ec2c4,_0x502cf1){return function(_0x5454c0){if(!_0x5454c0){_0x2ec2c4[_0xced3('0x16')](0x194);}return _0x5454c0;};}function handleError(_0x5bb425,_0x2ab8a8){_0x2ab8a8=_0x2ab8a8||0x1f4;return function(_0x1e6923){logger['error'](_0x1e6923[_0xced3('0x26')]);if(_0x1e6923[_0xced3('0x27')]){delete _0x1e6923[_0xced3('0x27')];}_0x5bb425[_0xced3('0x17')](_0x2ab8a8)[_0xced3('0x28')](_0x1e6923);};}exports[_0xced3('0x29')]=function(_0x895a32,_0x41d003){var _0x116cc7={},_0x559b8e={},_0xa78899={'count':0x0,'rows':[]};var _0x1b8baa=_[_0xced3('0x2a')](db[_0xced3('0x2b')][_0xced3('0x2c')],function(_0x21e4a2){return{'name':_0x21e4a2[_0xced3('0x2d')],'type':_0x21e4a2[_0xced3('0x2e')][_0xced3('0x2f')]};});_0x559b8e[_0xced3('0x30')]=_[_0xced3('0x2a')](_0x1b8baa,_0xced3('0x27'));_0x559b8e[_0xced3('0x31')]=_[_0xced3('0x32')](_0x895a32[_0xced3('0x31')]);_0x559b8e[_0xced3('0x33')]=_[_0xced3('0x34')](_0x559b8e[_0xced3('0x30')],_0x559b8e[_0xced3('0x31')]);_0x116cc7[_0xced3('0x35')]=_[_0xced3('0x34')](_0x559b8e['model'],qs[_0xced3('0x36')](_0x895a32['query'][_0xced3('0x36')]));_0x116cc7[_0xced3('0x35')]=_0x116cc7[_0xced3('0x35')][_0xced3('0x37')]?_0x116cc7[_0xced3('0x35')]:_0x559b8e[_0xced3('0x30')];if(!_0x895a32[_0xced3('0x31')][_0xced3('0x38')](_0xced3('0x39'))){_0x116cc7[_0xced3('0x1a')]=qs['limit'](_0x895a32[_0xced3('0x31')][_0xced3('0x1a')]);_0x116cc7['offset']=qs[_0xced3('0x1c')](_0x895a32[_0xced3('0x31')][_0xced3('0x1c')]);}_0x116cc7['order']=qs['sort'](_0x895a32[_0xced3('0x31')]['sort']);_0x116cc7[_0xced3('0x3a')]=qs[_0xced3('0x33')](_['pick'](_0x895a32[_0xced3('0x31')],_0x559b8e[_0xced3('0x33')]),_0x1b8baa);if(_0x895a32[_0xced3('0x31')]['filter']){_0x116cc7[_0xced3('0x3a')]=_['merge'](_0x116cc7['where'],{'$or':_[_0xced3('0x2a')](_0x1b8baa,function(_0x31e281){if(_0x31e281[_0xced3('0x2e')]!=='VIRTUAL'){var _0xb2cf20={};_0xb2cf20[_0x31e281[_0xced3('0x27')]]={'$like':'%'+_0x895a32[_0xced3('0x31')][_0xced3('0x3b')]+'%'};return _0xb2cf20;}})});}_0x116cc7=_[_0xced3('0x3c')]({},_0x116cc7,_0x895a32[_0xced3('0x3d')]);var _0x30e890={'where':_0x116cc7[_0xced3('0x3a')]};return db[_0xced3('0x2b')][_0xced3('0x1b')](_0x30e890)[_0xced3('0x21')](function(_0x38855f){_0xa78899[_0xced3('0x1b')]=_0x38855f;if(_0x895a32[_0xced3('0x31')][_0xced3('0x3e')]){_0x116cc7['include']=[{'all':!![]}];}return db[_0xced3('0x2b')][_0xced3('0x3f')](_0x116cc7);})[_0xced3('0x21')](function(_0x1a6c1f){_0xa78899[_0xced3('0x40')]=_0x1a6c1f;return _0xa78899;})[_0xced3('0x21')](respondWithFilteredResult(_0x41d003,_0x116cc7))[_0xced3('0x41')](handleError(_0x41d003,null));};exports[_0xced3('0x42')]=function(_0x1ab7e0,_0x4cea5c){var _0x6c0238={'raw':![],'where':{'id':_0x1ab7e0[_0xced3('0x43')]['id']}},_0x47ab23={};_0x47ab23[_0xced3('0x30')]=_[_0xced3('0x32')](db['JscriptyProject'][_0xced3('0x2c')]);_0x47ab23[_0xced3('0x31')]=_[_0xced3('0x32')](_0x1ab7e0[_0xced3('0x31')]);_0x47ab23['filters']=_[_0xced3('0x34')](_0x47ab23[_0xced3('0x30')],_0x47ab23[_0xced3('0x31')]);_0x6c0238[_0xced3('0x35')]=_[_0xced3('0x34')](_0x47ab23['model'],qs[_0xced3('0x36')](_0x1ab7e0[_0xced3('0x31')][_0xced3('0x36')]));_0x6c0238[_0xced3('0x35')]=_0x6c0238[_0xced3('0x35')][_0xced3('0x37')]?_0x6c0238[_0xced3('0x35')]:_0x47ab23['model'];if(_0x1ab7e0[_0xced3('0x31')][_0xced3('0x3e')]){_0x6c0238['include']=[{'all':!![]}];}_0x6c0238=_['merge']({},_0x6c0238,_0x1ab7e0[_0xced3('0x3d')]);return db['JscriptyProject'][_0xced3('0x44')](_0x6c0238)[_0xced3('0x21')](handleEntityNotFound(_0x4cea5c,null))[_0xced3('0x21')](respondWithResult(_0x4cea5c,null))[_0xced3('0x41')](handleError(_0x4cea5c,null));};exports[_0xced3('0x45')]=function(_0x1b3396,_0x3700ed){return db[_0xced3('0x2b')][_0xced3('0x45')](_0x1b3396['body'],{})[_0xced3('0x21')](function(_0x8df206){var _0x2aa876=_0x1b3396[_0xced3('0x46')][_0xced3('0x23')]({'plain':!![]});if(!_0x2aa876)throw new Error(_0xced3('0x47'));if(_0x2aa876['role']===_0xced3('0x46')){var _0x629ecf=_0x8df206[_0xced3('0x23')]({'plain':!![]});var _0x409da0=_0xced3('0x48');return db[_0xced3('0x49')][_0xced3('0x44')]({'where':{'name':_0x409da0,'userProfileId':_0x2aa876[_0xced3('0x4a')]},'raw':!![]})[_0xced3('0x21')](function(_0x44d779){if(_0x44d779&&_0x44d779[_0xced3('0x4b')]===0x0){return db[_0xced3('0x24')]['create']({'name':_0x629ecf[_0xced3('0x27')],'resourceId':_0x629ecf['id'],'type':_0x44d779['name'],'sectionId':_0x44d779['id']},{})[_0xced3('0x21')](function(){return _0x8df206;});}else{return _0x8df206;}})[_0xced3('0x41')](function(_0xc93e05){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc93e05);throw _0xc93e05;});}return _0x8df206;})[_0xced3('0x21')](respondWithResult(_0x3700ed,0xc9))[_0xced3('0x41')](handleError(_0x3700ed,null));};exports['clone']=function(_0x3f41cc,_0x4ae67d){var _0x3dba69={'where':{'id':_0x3f41cc['params']['id']}},_0x3f9582={};_0x3f9582[_0xced3('0x30')]=_[_0xced3('0x32')](db[_0xced3('0x2b')]['rawAttributes']);_0x3dba69[_0xced3('0x35')]=_['intersection'](_0x3f9582[_0xced3('0x30')],qs[_0xced3('0x36')](_0x3f41cc[_0xced3('0x31')][_0xced3('0x36')]));_0x3dba69[_0xced3('0x35')]=_0x3dba69[_0xced3('0x35')][_0xced3('0x37')]?_0x3dba69[_0xced3('0x35')]:_0x3f9582[_0xced3('0x30')];if(_0x3f41cc[_0xced3('0x31')][_0xced3('0x3e')]){_0x3dba69['include']=[{'all':!![]}];}_0x3dba69=_[_0xced3('0x3c')]({},_0x3dba69,_0x3f41cc[_0xced3('0x3d')]);return db[_0xced3('0x2b')][_0xced3('0x44')](_0x3dba69)[_0xced3('0x21')](handleEntityNotFound(_0x4ae67d,null))[_0xced3('0x21')](function(_0x4d0916){if(_0x4d0916){var _0x9db425=_0x4d0916[_0xced3('0x23')]({'plain':!![]});_0x9db425=qs[_0xced3('0x4c')](_0x9db425,['id',_0xced3('0x4d'),_0xced3('0x4e')]);_0x3f41cc[_0xced3('0x4f')]=_['omit'](_0x3f41cc[_0xced3('0x4f')],['id','createdAt',_0xced3('0x4e')]);return db['JscriptyProject'][_0xced3('0x45')](_[_0xced3('0x3c')](_0x9db425,_0x3f41cc['body']),{'include':_0x3f41cc[_0xced3('0x31')][_0xced3('0x3e')]?[{'all':!![]}]:undefined})[_0xced3('0x21')](function(_0x3bb7d5){var _0x1ec94b=_0x3f41cc[_0xced3('0x46')][_0xced3('0x23')]({'plain':!![]});if(!_0x1ec94b)throw new Error(_0xced3('0x47'));if(_0x1ec94b[_0xced3('0x50')]===_0xced3('0x46')){var _0x181831=_0x3bb7d5[_0xced3('0x23')]({'plain':!![]});var _0x38033f='Projects';return db[_0xced3('0x49')][_0xced3('0x44')]({'where':{'name':_0x38033f,'userProfileId':_0x1ec94b[_0xced3('0x4a')]},'raw':!![]})[_0xced3('0x21')](function(_0x4f8a3f){if(_0x4f8a3f&&_0x4f8a3f[_0xced3('0x4b')]===0x0){return db[_0xced3('0x24')][_0xced3('0x45')]({'name':_0x181831[_0xced3('0x27')],'resourceId':_0x181831['id'],'type':_0x4f8a3f[_0xced3('0x27')],'sectionId':_0x4f8a3f['id']},{})[_0xced3('0x21')](function(){return _0x3bb7d5;});}else{return _0x3bb7d5;}})[_0xced3('0x41')](function(_0x4df923){logger[_0xced3('0x51')](_0xced3('0x52'),_0x4df923);throw _0x4df923;});}return _0x3bb7d5;});}})['then'](respondWithResult(_0x4ae67d,0xc9))[_0xced3('0x41')](handleError(_0x4ae67d,null));};exports[_0xced3('0x20')]=function(_0x3a9dac,_0x2ac060){if(_0x3a9dac['body']['id']){delete _0x3a9dac[_0xced3('0x4f')]['id'];}return db[_0xced3('0x2b')][_0xced3('0x44')]({'where':{'id':_0x3a9dac[_0xced3('0x43')]['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x2ac060,null))[_0xced3('0x21')](saveUpdates(_0x3a9dac[_0xced3('0x4f')],null))[_0xced3('0x21')](respondWithResult(_0x2ac060,null))[_0xced3('0x41')](handleError(_0x2ac060,null));};exports[_0xced3('0x22')]=function(_0x47ec8c,_0x3d39de){return db[_0xced3('0x2b')]['find']({'where':{'id':_0x47ec8c['params']['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x3d39de,null))['then'](removeEntity(_0x3d39de,null))[_0xced3('0x41')](handleError(_0x3d39de,null));};exports[_0xced3('0x53')]=function(_0x5e3d3d,_0x2936b5,_0x40c376){var _0x5ad22e={'raw':!![],'where':{}};var _0x10716f={};var _0x52ab35={'count':0x0,'rows':[]};return db[_0xced3('0x2b')]['findOne']({'where':{'id':_0x5e3d3d[_0xced3('0x43')]['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x2936b5,null))[_0xced3('0x21')](function(_0x4f2035){if(_0x4f2035){_0x10716f[_0xced3('0x30')]=_[_0xced3('0x32')](db[_0xced3('0x54')]['rawAttributes']);_0x10716f[_0xced3('0x31')]=_[_0xced3('0x32')](_0x5e3d3d[_0xced3('0x31')]);_0x10716f[_0xced3('0x33')]=_['intersection'](_0x10716f['model'],_0x10716f[_0xced3('0x31')]);_0x5ad22e[_0xced3('0x35')]=_[_0xced3('0x34')](_0x10716f[_0xced3('0x30')],qs[_0xced3('0x36')](_0x5e3d3d[_0xced3('0x31')]['fields']));_0x5ad22e[_0xced3('0x35')]=_0x5ad22e['attributes'][_0xced3('0x37')]?_0x5ad22e[_0xced3('0x35')]:_0x10716f[_0xced3('0x30')];if(!_0x5e3d3d[_0xced3('0x31')]['hasOwnProperty'](_0xced3('0x39'))){_0x5ad22e[_0xced3('0x1a')]=qs['limit'](_0x5e3d3d['query'][_0xced3('0x1a')]);_0x5ad22e[_0xced3('0x1c')]=qs[_0xced3('0x1c')](_0x5e3d3d[_0xced3('0x31')][_0xced3('0x1c')]);}_0x5ad22e['order']=qs[_0xced3('0x55')](_0x5e3d3d[_0xced3('0x31')][_0xced3('0x55')]);_0x5ad22e[_0xced3('0x3a')]=qs['filters'](_[_0xced3('0x56')](_0x5e3d3d[_0xced3('0x31')],_0x10716f[_0xced3('0x33')]));_0x5ad22e[_0xced3('0x3a')][_0xced3('0x57')]=_0x4f2035['id'];if(_0x5e3d3d[_0xced3('0x31')][_0xced3('0x3b')]){_0x5ad22e[_0xced3('0x3a')]=_[_0xced3('0x3c')](_0x5ad22e[_0xced3('0x3a')],{'$or':_['map'](_0x5ad22e[_0xced3('0x35')],function(_0x1e7ff1){var _0x498ea9={};_0x498ea9[_0x1e7ff1]={'$like':'%'+_0x5e3d3d[_0xced3('0x31')][_0xced3('0x3b')]+'%'};return _0x498ea9;})});}_0x5ad22e=_[_0xced3('0x3c')]({},_0x5ad22e,_0x5e3d3d[_0xced3('0x3d')]);return db[_0xced3('0x54')]['count']({'where':_0x5ad22e[_0xced3('0x3a')]})[_0xced3('0x21')](function(_0x5df405){_0x52ab35[_0xced3('0x1b')]=_0x5df405;if(_0x5e3d3d[_0xced3('0x31')][_0xced3('0x3e')]){_0x5ad22e[_0xced3('0x58')]=[{'all':!![]}];}return db[_0xced3('0x54')][_0xced3('0x3f')](_0x5ad22e);})['then'](function(_0x2d9a57){_0x52ab35[_0xced3('0x40')]=_0x2d9a57;return _0x52ab35;});}})[_0xced3('0x21')](respondWithFilteredResult(_0x2936b5,_0x5ad22e))[_0xced3('0x41')](handleError(_0x2936b5,null));};exports[_0xced3('0x59')]=function(_0xde525f,_0x5a74af,_0x5045a9){var _0xe9ef4e={'raw':!![],'where':{}};var _0xb6530d={};var _0x32d7c2={'count':0x0,'rows':[]};return db[_0xced3('0x2b')][_0xced3('0x5a')]({'where':{'id':_0xde525f[_0xced3('0x43')]['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x5a74af,null))['then'](function(_0x3d64ec){if(_0x3d64ec){_0xb6530d[_0xced3('0x30')]=_['keys'](db['JscriptyAnswerReport'][_0xced3('0x2c')]);_0xb6530d[_0xced3('0x31')]=_[_0xced3('0x32')](_0xde525f[_0xced3('0x31')]);_0xb6530d[_0xced3('0x33')]=_['intersection'](_0xb6530d[_0xced3('0x30')],_0xb6530d['query']);_0xe9ef4e[_0xced3('0x35')]=_[_0xced3('0x34')](_0xb6530d[_0xced3('0x30')],qs[_0xced3('0x36')](_0xde525f[_0xced3('0x31')]['fields']));_0xe9ef4e[_0xced3('0x35')]=_0xe9ef4e[_0xced3('0x35')][_0xced3('0x37')]?_0xe9ef4e[_0xced3('0x35')]:_0xb6530d['model'];if(!_0xde525f['query'][_0xced3('0x38')](_0xced3('0x39'))){_0xe9ef4e[_0xced3('0x1a')]=qs[_0xced3('0x1a')](_0xde525f[_0xced3('0x31')][_0xced3('0x1a')]);_0xe9ef4e[_0xced3('0x1c')]=qs[_0xced3('0x1c')](_0xde525f['query']['offset']);}_0xe9ef4e[_0xced3('0x5b')]=qs[_0xced3('0x55')](_0xde525f[_0xced3('0x31')][_0xced3('0x55')]);_0xe9ef4e[_0xced3('0x3a')]=qs[_0xced3('0x33')](_[_0xced3('0x56')](_0xde525f[_0xced3('0x31')],_0xb6530d[_0xced3('0x33')]));_0xe9ef4e[_0xced3('0x3a')][_0xced3('0x57')]=_0x3d64ec['id'];if(_0xde525f['query'][_0xced3('0x3b')]){_0xe9ef4e['where']=_[_0xced3('0x3c')](_0xe9ef4e[_0xced3('0x3a')],{'$or':_[_0xced3('0x2a')](_0xe9ef4e[_0xced3('0x35')],function(_0x1df2d1){var _0x39fdf4={};_0x39fdf4[_0x1df2d1]={'$like':'%'+_0xde525f[_0xced3('0x31')][_0xced3('0x3b')]+'%'};return _0x39fdf4;})});}_0xe9ef4e=_[_0xced3('0x3c')]({},_0xe9ef4e,_0xde525f[_0xced3('0x3d')]);return db[_0xced3('0x5c')][_0xced3('0x1b')]({'where':_0xe9ef4e[_0xced3('0x3a')]})[_0xced3('0x21')](function(_0x41f83e){_0x32d7c2[_0xced3('0x1b')]=_0x41f83e;if(_0xde525f[_0xced3('0x31')]['includeAll']){_0xe9ef4e['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xced3('0x3f')](_0xe9ef4e);})[_0xced3('0x21')](function(_0x3acb1d){_0x32d7c2[_0xced3('0x40')]=_0x3acb1d;return _0x32d7c2;});}})[_0xced3('0x21')](respondWithFilteredResult(_0x5a74af,_0xe9ef4e))[_0xced3('0x41')](handleError(_0x5a74af,null));};function char(_0x587891){return _0xced3('0x5d')===typeof _0x587891?String[_0xced3('0x5e')]['apply'](null,arguments):_0x587891;}function needsEncapsulation(_0x5e6a80){return!!_0x5e6a80&&(_0x5e6a80[_0xced3('0x5f')]()[_0xced3('0x60')](char(0xd))>=0x0||_0x5e6a80[_0xced3('0x5f')]()[_0xced3('0x60')](char(0xa))>=0x0||_0x5e6a80[_0xced3('0x5f')]()[_0xced3('0x60')](char(0x2c))>=0x0||_0x5e6a80['toString']()[_0xced3('0x60')](char(0x22))>=0x0);}function encapsulate(_0x577d52){var _0x1633e1=char(0x22),_0x3d9158='\x5c'+char(0x22),_0x44a80b=_0x577d52['toString']()['replace'](new RegExp(_0x1633e1,'g'),_0x3d9158);return _0x1633e1+_0x44a80b+_0x1633e1;}exports['getSummary']=function(_0x1da164,_0x1dd390,_0x5540a8){var _0x399ca8,_0x3e3d60;var _0x548330={'where':{'ProjectId':_0x1da164[_0xced3('0x43')]['id']}};if(_0x1da164[_0xced3('0x31')][_0xced3('0x61')]){_0x548330[_0xced3('0x3a')][_0xced3('0x62')]=JSON[_0xced3('0x63')](_0x1da164[_0xced3('0x31')][_0xced3('0x61')]);}return db['JscriptySessionReport'][_0xced3('0x3f')](_0x548330)[_0xced3('0x21')](handleEntityNotFound(_0x1dd390,null))[_0xced3('0x21')](function(_0x1c7d1f){if(_0x1c7d1f){_0x399ca8=_0x1c7d1f;return db[_0xced3('0x64')][_0xced3('0x3f')]({'where':{'SessionId':{'$in':_[_0xced3('0x2a')](_0x399ca8,'id')},'ProjectId':_0x1da164[_0xced3('0x43')]['id']},'order':_0xced3('0x65')});}})[_0xced3('0x21')](handleEntityNotFound(_0x1dd390,null))[_0xced3('0x21')](function(_0x8ca138){if(_0x8ca138){_0x3e3d60=_0x8ca138;var _0x425057={};for(var _0xfe27a5=0x0,_0x46f536=_0x3e3d60['length'];_0xfe27a5<_0x46f536;_0xfe27a5++){if(!_0x425057[_0xced3('0x38')](_0x3e3d60[_0xfe27a5][_0xced3('0x66')])){_0x425057[_0x3e3d60[_0xfe27a5][_0xced3('0x66')]]=needsEncapsulation(_0x3e3d60[_0xfe27a5][_0xced3('0x67')])?encapsulate(_0x3e3d60[_0xfe27a5][_0xced3('0x67')]):_0x3e3d60[_0xfe27a5]['question'];}}var _0x4d5fc7=[],_0x9c4096={};for(var _0x1f9354=0x0,_0x2796fd=_0x399ca8[_0xced3('0x37')];_0x1f9354<_0x2796fd;_0x1f9354++){_0x9c4096={'ProjectId':_0x1da164[_0xced3('0x43')]['id'],'SessionId':_0x399ca8[_0x1f9354]['id'],'StartTime':moment(_0x399ca8[_0x1f9354][_0xced3('0x62')])[_0xced3('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x5e4368=0x0,_0x394416=_0x3e3d60['length'];_0x5e4368<_0x394416;_0x5e4368++){if(_0x3e3d60[_0x5e4368][_0xced3('0x69')]==_0x399ca8[_0x1f9354]['id']&&_0x425057[_0xced3('0x38')](_0x3e3d60[_0x5e4368][_0xced3('0x66')])){_0x9c4096[_0x425057[_0x3e3d60[_0x5e4368][_0xced3('0x66')]]]=_0x3e3d60[_0x5e4368][_0xced3('0x6a')];}}for(var _0xca87c4 in _0x425057){if(!_0x9c4096[_0xced3('0x38')](_0x425057[_0xca87c4])){_0x9c4096[_0x425057[_0xca87c4]]=null;}}_0x4d5fc7[_0xced3('0x6b')](_0x9c4096);}return _0x4d5fc7;}})[_0xced3('0x21')](function(_0x2b688c){if(!_[_0xced3('0x6c')](_0x2b688c)){var _0x28a497=toCsv(_0x2b688c);var _0x1994d3=Date[_0xced3('0x6d')]();fs['writeFileSync'](util['format'](_0xced3('0x6e'),_0x1da164['params']['id'],_0x1994d3),_0x28a497);_0x1dd390[_0xced3('0x6f')]('Content-disposition','attachment;\x20filename='+util[_0xced3('0x68')](_0xced3('0x70'),_0x1da164[_0xced3('0x43')]['id'],_0x1994d3));_0x1dd390[_0xced3('0x6f')]('Content-type','text/csv');return _0x1dd390[_0xced3('0x71')](util[_0xced3('0x68')](_0xced3('0x6e'),_0x1da164['params']['id'],_0x1994d3));}else{return _0x1dd390[_0xced3('0x16')](0xcc);}})['catch'](handleError(_0x1dd390,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index a7559df..da4db13 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 _0x83d3=['define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5790e3,_0x580c13){var _0x473303=function(_0x31a27d){while(--_0x31a27d){_0x5790e3['push'](_0x5790e3['shift']());}};_0x473303(++_0x580c13);}(_0x83d3,0x17c));var _0x383d=function(_0x552cf8,_0x493a58){_0x552cf8=_0x552cf8-0x0;var _0x5b0eca=_0x83d3[_0x552cf8];return _0x5b0eca;};'use strict';var _=require(_0x383d('0x0'));var util=require(_0x383d('0x1'));var logger=require(_0x383d('0x2'))(_0x383d('0x3'));var moment=require(_0x383d('0x4'));var BPromise=require('bluebird');var rp=require(_0x383d('0x5'));var fs=require('fs');var path=require(_0x383d('0x6'));var rimraf=require(_0x383d('0x7'));var config=require(_0x383d('0x8'));var attributes=require('./jscriptyProject.attributes');module[_0x383d('0x9')]=function(_0x4f3c10,_0x50eaff){return _0x4f3c10[_0x383d('0xa')](_0x383d('0xb'),attributes,{'tableName':_0x383d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c46=['api','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','lodash'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x8c46,0x171));var _0x68c4=function(_0x3cdf76,_0x63322b){_0x3cdf76=_0x3cdf76-0x0;var _0x1f1bdb=_0x8c46[_0x3cdf76];return _0x1f1bdb;};'use strict';var _=require(_0x68c4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x68c4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x68c4('0x2'));var fs=require('fs');var path=require(_0x68c4('0x3'));var rimraf=require(_0x68c4('0x4'));var config=require(_0x68c4('0x5'));var attributes=require(_0x68c4('0x6'));module[_0x68c4('0x7')]=function(_0x40ce21,_0x1516cf){return _0x40ce21[_0x68c4('0x8')](_0x68c4('0x9'),attributes,{'tableName':'jscripty_projects','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 236fdf0..2596866 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x6438bb,_0x21b463){var _0x116c41=function(_0x373af9){while(--_0x373af9){_0x6438bb['push'](_0x6438bb['shift']());}};_0x116c41(++_0x21b463);}(_0xb43b,0x1b2));var _0xbb43=function(_0xdfdbb0,_0x2313b5){_0xdfdbb0=_0xdfdbb0-0x0;var _0x38f082=_0xb43b[_0xdfdbb0];return _0x38f082;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file +var _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1361e1,_0x130813){var _0x3a9950=function(_0xd4ab06){while(--_0xd4ab06){_0x1361e1['push'](_0x1361e1['shift']());}};_0x3a9950(++_0x130813);}(_0x70e0,0x17b));var _0x070e=function(_0x1512b4,_0x3e34b7){_0x1512b4=_0x1512b4-0x0;var _0x1ae658=_0x70e0[_0x1512b4];return _0x1ae658;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 47fb404..615261e 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 _0x925f=['../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','delete','/:id','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4674c3,_0x48f787){var _0x95024c=function(_0x2b4971){while(--_0x2b4971){_0x4674c3['push'](_0x4674c3['shift']());}};_0x95024c(++_0x48f787);}(_0x925f,0x1c8));var _0xf925=function(_0xe1770a,_0x4fc5d6){_0xe1770a=_0xe1770a-0x0;var _0x3e6274=_0x925f[_0xe1770a];return _0x3e6274;};'use strict';var multer=require(_0xf925('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf925('0x1'));var express=require(_0xf925('0x2'));var router=express[_0xf925('0x3')]();var fs_extra=require(_0xf925('0x4'));var auth=require(_0xf925('0x5'));var interaction=require(_0xf925('0x6'));var config=require(_0xf925('0x7'));var controller=require(_0xf925('0x8'));router[_0xf925('0x9')]('/',auth[_0xf925('0xa')](),controller[_0xf925('0xb')]);router[_0xf925('0x9')](_0xf925('0xc'),auth[_0xf925('0xa')](),controller[_0xf925('0xd')]);router['get']('/:id',auth[_0xf925('0xa')](),controller[_0xf925('0xe')]);router[_0xf925('0xf')]('/',auth[_0xf925('0xa')](),controller[_0xf925('0x10')]);router[_0xf925('0x11')]('/:id',auth[_0xf925('0xa')](),controller['update']);router[_0xf925('0x12')](_0xf925('0x13'),auth[_0xf925('0xa')](),controller[_0xf925('0x14')]);module[_0xf925('0x15')]=router; \ No newline at end of file +var _0x2e31=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','update','delete','exports','multer'];(function(_0xf55e73,_0x3fecc5){var _0x116b99=function(_0x314e0c){while(--_0x314e0c){_0xf55e73['push'](_0xf55e73['shift']());}};_0x116b99(++_0x3fecc5);}(_0x2e31,0xa1));var _0x12e3=function(_0x94078,_0x5c31ee){_0x94078=_0x94078-0x0;var _0x233ec9=_0x2e31[_0x94078];return _0x233ec9;};'use strict';var multer=require(_0x12e3('0x0'));var util=require(_0x12e3('0x1'));var path=require(_0x12e3('0x2'));var timeout=require(_0x12e3('0x3'));var express=require(_0x12e3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x12e3('0x5'));var interaction=require(_0x12e3('0x6'));var config=require('../../config/environment');var controller=require(_0x12e3('0x7'));router[_0x12e3('0x8')]('/',auth[_0x12e3('0x9')](),controller['index']);router[_0x12e3('0x8')](_0x12e3('0xa'),auth[_0x12e3('0x9')](),controller[_0x12e3('0xb')]);router[_0x12e3('0x8')](_0x12e3('0xc'),auth[_0x12e3('0x9')](),controller['show']);router[_0x12e3('0xd')]('/',auth[_0x12e3('0x9')](),controller[_0x12e3('0xe')]);router['put'](_0x12e3('0xc'),auth['isAuthenticated'](),controller[_0x12e3('0xf')]);router[_0x12e3('0x10')](_0x12e3('0xc'),auth[_0x12e3('0x9')](),controller['destroy']);module[_0x12e3('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 0c8e2b6..d9fa9f9 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(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x7a54,0x106));var _0x47a5=function(_0x5c7317,_0x163465){_0x5c7317=_0x5c7317-0x0;var _0x55bc0a=_0x7a54[_0x5c7317];return _0x55bc0a;};'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(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x7a54,0x106));var _0x47a5=function(_0x4e2453,_0x24b590){_0x4e2453=_0x4e2453-0x0;var _0x32b11a=_0x7a54[_0x4e2453];return _0x32b11a;};'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 5bf14bf..6f57089 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 _0xbe13=['where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','end','error','stack','name','index','JscriptyQuestionReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort'];(function(_0x5c3514,_0x18e281){var _0x56e259=function(_0x4914e3){while(--_0x4914e3){_0x5c3514['push'](_0x5c3514['shift']());}};_0x56e259(++_0x18e281);}(_0xbe13,0x1b8));var _0x3be1=function(_0x537c99,_0x3a9e9c){_0x537c99=_0x537c99-0x0;var _0x35b831=_0xbe13[_0x537c99];return _0x35b831;};'use strict';var emlformat=require(_0x3be1('0x0'));var rimraf=require(_0x3be1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3be1('0x2'));var rp=require(_0x3be1('0x3'));var moment=require(_0x3be1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3be1('0x5'));var util=require(_0x3be1('0x6'));var path=require(_0x3be1('0x7'));var sox=require(_0x3be1('0x8'));var csv=require(_0x3be1('0x9'));var ejs=require(_0x3be1('0xa'));var fs=require('fs');var fs_extra=require(_0x3be1('0xb'));var _=require(_0x3be1('0xc'));var squel=require(_0x3be1('0xd'));var crypto=require(_0x3be1('0xe'));var jsforce=require(_0x3be1('0xf'));var deskjs=require(_0x3be1('0x10'));var toCsv=require(_0x3be1('0x9'));var querystring=require(_0x3be1('0x11'));var Papa=require(_0x3be1('0x12'));var Redis=require(_0x3be1('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3be1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3be1('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3be1('0x16'));var db=require(_0x3be1('0x17'))['db'];function respondWithStatusCode(_0x512497,_0x393057){_0x393057=_0x393057||0xcc;return function(_0x56fe4f){if(_0x56fe4f){return _0x512497[_0x3be1('0x18')](_0x393057);}return _0x512497[_0x3be1('0x19')](_0x393057)['end']();};}function respondWithResult(_0x10607f,_0x5b3345){_0x5b3345=_0x5b3345||0xc8;return function(_0x35d01b){if(_0x35d01b){return _0x10607f[_0x3be1('0x19')](_0x5b3345)[_0x3be1('0x1a')](_0x35d01b);}};}function respondWithFilteredResult(_0x5c273d,_0x1e54c9){return function(_0x26c23e){if(_0x26c23e){var _0x52e21a=typeof _0x1e54c9['offset']===_0x3be1('0x1b')&&typeof _0x1e54c9[_0x3be1('0x1c')]==='undefined';var _0x18f4ef=_0x26c23e[_0x3be1('0x1d')];var _0x5929a5=_0x52e21a?0x0:_0x1e54c9[_0x3be1('0x1e')];var _0x166b8c=_0x52e21a?_0x26c23e['count']:_0x1e54c9[_0x3be1('0x1e')]+_0x1e54c9[_0x3be1('0x1c')];var _0xaf5d87;if(_0x166b8c>=_0x18f4ef){_0x166b8c=_0x18f4ef;_0xaf5d87=0xc8;}else{_0xaf5d87=0xce;}_0x5c273d[_0x3be1('0x19')](_0xaf5d87);return _0x5c273d[_0x3be1('0x1f')](_0x3be1('0x20'),_0x5929a5+'-'+_0x166b8c+'/'+_0x18f4ef)[_0x3be1('0x1a')](_0x26c23e);}return null;};}function patchUpdates(_0x1b541c){return function(_0x5c915d){try{jsonpatch[_0x3be1('0x21')](_0x5c915d,_0x1b541c,!![]);}catch(_0x265698){return BPromise['reject'](_0x265698);}return _0x5c915d[_0x3be1('0x22')]();};}function saveUpdates(_0x3c488f,_0x518125){return function(_0x28d944){if(_0x28d944){return _0x28d944[_0x3be1('0x23')](_0x3c488f)[_0x3be1('0x24')](function(_0x2181cd){return _0x2181cd;});}return null;};}function removeEntity(_0x34d7b7,_0x490193){return function(_0x179ea8){if(_0x179ea8){return _0x179ea8['destroy']()[_0x3be1('0x24')](function(){_0x34d7b7[_0x3be1('0x19')](0xcc)[_0x3be1('0x25')]();});}};}function handleEntityNotFound(_0x1011f,_0x59c459){return function(_0x104647){if(!_0x104647){_0x1011f[_0x3be1('0x18')](0x194);}return _0x104647;};}function handleError(_0x5036d8,_0x2ac61c){_0x2ac61c=_0x2ac61c||0x1f4;return function(_0x1d3fb8){logger[_0x3be1('0x26')](_0x1d3fb8[_0x3be1('0x27')]);if(_0x1d3fb8[_0x3be1('0x28')]){delete _0x1d3fb8['name'];}_0x5036d8[_0x3be1('0x19')](_0x2ac61c)['send'](_0x1d3fb8);};}exports[_0x3be1('0x29')]=function(_0x3e584e,_0x5d19e4){var _0x505fd7={},_0x492e7d={},_0x214d1c={'count':0x0,'rows':[]};var _0x4ab6de=_['map'](db[_0x3be1('0x2a')][_0x3be1('0x2b')],function(_0x1b3be3){return{'name':_0x1b3be3['fieldName'],'type':_0x1b3be3[_0x3be1('0x2c')][_0x3be1('0x2d')]};});_0x492e7d[_0x3be1('0x2e')]=_[_0x3be1('0x2f')](_0x4ab6de,_0x3be1('0x28'));_0x492e7d[_0x3be1('0x30')]=_[_0x3be1('0x31')](_0x3e584e['query']);_0x492e7d[_0x3be1('0x32')]=_[_0x3be1('0x33')](_0x492e7d[_0x3be1('0x2e')],_0x492e7d[_0x3be1('0x30')]);_0x505fd7[_0x3be1('0x34')]=_['intersection'](_0x492e7d[_0x3be1('0x2e')],qs[_0x3be1('0x35')](_0x3e584e[_0x3be1('0x30')][_0x3be1('0x35')]));_0x505fd7[_0x3be1('0x34')]=_0x505fd7[_0x3be1('0x34')]['length']?_0x505fd7[_0x3be1('0x34')]:_0x492e7d[_0x3be1('0x2e')];if(!_0x3e584e[_0x3be1('0x30')]['hasOwnProperty'](_0x3be1('0x36'))){_0x505fd7[_0x3be1('0x1c')]=qs[_0x3be1('0x1c')](_0x3e584e[_0x3be1('0x30')][_0x3be1('0x1c')]);_0x505fd7['offset']=qs[_0x3be1('0x1e')](_0x3e584e[_0x3be1('0x30')][_0x3be1('0x1e')]);}_0x505fd7[_0x3be1('0x37')]=qs['sort'](_0x3e584e[_0x3be1('0x30')][_0x3be1('0x38')]);_0x505fd7[_0x3be1('0x39')]=qs[_0x3be1('0x32')](_['pick'](_0x3e584e[_0x3be1('0x30')],_0x492e7d['filters']),_0x4ab6de);if(_0x3e584e[_0x3be1('0x30')][_0x3be1('0x3a')]){_0x505fd7['where']=_[_0x3be1('0x3b')](_0x505fd7[_0x3be1('0x39')],{'$or':_[_0x3be1('0x2f')](_0x4ab6de,function(_0x2a2f6f){if(_0x2a2f6f[_0x3be1('0x2c')]!==_0x3be1('0x3c')){var _0x216cb2={};_0x216cb2[_0x2a2f6f[_0x3be1('0x28')]]={'$like':'%'+_0x3e584e[_0x3be1('0x30')][_0x3be1('0x3a')]+'%'};return _0x216cb2;}})});}_0x505fd7=_[_0x3be1('0x3b')]({},_0x505fd7,_0x3e584e[_0x3be1('0x3d')]);var _0x51ac76={'where':_0x505fd7[_0x3be1('0x39')]};return db[_0x3be1('0x2a')][_0x3be1('0x1d')](_0x51ac76)[_0x3be1('0x24')](function(_0x565f0a){_0x214d1c[_0x3be1('0x1d')]=_0x565f0a;if(_0x3e584e[_0x3be1('0x30')]['includeAll']){_0x505fd7[_0x3be1('0x3e')]=[{'all':!![]}];}return db[_0x3be1('0x2a')][_0x3be1('0x3f')](_0x505fd7);})[_0x3be1('0x24')](function(_0x13f754){_0x214d1c[_0x3be1('0x40')]=_0x13f754;return _0x214d1c;})['then'](respondWithFilteredResult(_0x5d19e4,_0x505fd7))[_0x3be1('0x41')](handleError(_0x5d19e4,null));};exports['show']=function(_0x51b3d4,_0x1ff071){var _0x12ad99={'raw':!![],'where':{'id':_0x51b3d4[_0x3be1('0x42')]['id']}},_0x5bb290={};_0x5bb290[_0x3be1('0x2e')]=_['keys'](db[_0x3be1('0x2a')][_0x3be1('0x2b')]);_0x5bb290[_0x3be1('0x30')]=_[_0x3be1('0x31')](_0x51b3d4[_0x3be1('0x30')]);_0x5bb290[_0x3be1('0x32')]=_[_0x3be1('0x33')](_0x5bb290[_0x3be1('0x2e')],_0x5bb290[_0x3be1('0x30')]);_0x12ad99[_0x3be1('0x34')]=_['intersection'](_0x5bb290[_0x3be1('0x2e')],qs[_0x3be1('0x35')](_0x51b3d4['query']['fields']));_0x12ad99[_0x3be1('0x34')]=_0x12ad99[_0x3be1('0x34')]['length']?_0x12ad99[_0x3be1('0x34')]:_0x5bb290[_0x3be1('0x2e')];if(_0x51b3d4['query']['includeAll']){_0x12ad99['include']=[{'all':!![]}];}_0x12ad99=_['merge']({},_0x12ad99,_0x51b3d4[_0x3be1('0x3d')]);return db[_0x3be1('0x2a')][_0x3be1('0x43')](_0x12ad99)[_0x3be1('0x24')](handleEntityNotFound(_0x1ff071,null))[_0x3be1('0x24')](respondWithResult(_0x1ff071,null))['catch'](handleError(_0x1ff071,null));};exports[_0x3be1('0x44')]=function(_0x3ebc8a,_0x30de53){return db[_0x3be1('0x2a')]['create'](_0x3ebc8a[_0x3be1('0x45')],{})[_0x3be1('0x24')](respondWithResult(_0x30de53,0xc9))[_0x3be1('0x41')](handleError(_0x30de53,null));};exports['update']=function(_0x590104,_0x49ab12){if(_0x590104['body']['id']){delete _0x590104['body']['id'];}return db[_0x3be1('0x2a')]['find']({'where':{'id':_0x590104[_0x3be1('0x42')]['id']}})['then'](handleEntityNotFound(_0x49ab12,null))[_0x3be1('0x24')](saveUpdates(_0x590104[_0x3be1('0x45')],null))[_0x3be1('0x24')](respondWithResult(_0x49ab12,null))[_0x3be1('0x41')](handleError(_0x49ab12,null));};exports['destroy']=function(_0x1e458b,_0x2e1678){return db[_0x3be1('0x2a')][_0x3be1('0x43')]({'where':{'id':_0x1e458b[_0x3be1('0x42')]['id']}})[_0x3be1('0x24')](handleEntityNotFound(_0x2e1678,null))[_0x3be1('0x24')](removeEntity(_0x2e1678,null))[_0x3be1('0x41')](handleError(_0x2e1678,null));};exports[_0x3be1('0x46')]=function(_0x273d2f,_0x3eef67){return db[_0x3be1('0x2a')]['describe']()['then'](respondWithResult(_0x3eef67,null))[_0x3be1('0x41')](handleError(_0x3eef67,null));}; \ No newline at end of file +var _0x3ad4=['limit','count','offset','Content-Range','json','update','then','destroy','error','stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','keys','intersection','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ad4,0xbe));var _0x43ad=function(_0x41beb0,_0x2298de){_0x41beb0=_0x41beb0-0x0;var _0x77cc6f=_0x3ad4[_0x41beb0];return _0x77cc6f;};'use strict';var emlformat=require(_0x43ad('0x0'));var rimraf=require(_0x43ad('0x1'));var zipdir=require(_0x43ad('0x2'));var jsonpatch=require(_0x43ad('0x3'));var rp=require(_0x43ad('0x4'));var moment=require(_0x43ad('0x5'));var BPromise=require(_0x43ad('0x6'));var Mustache=require(_0x43ad('0x7'));var util=require(_0x43ad('0x8'));var path=require('path');var sox=require(_0x43ad('0x9'));var csv=require(_0x43ad('0xa'));var ejs=require(_0x43ad('0xb'));var fs=require('fs');var fs_extra=require(_0x43ad('0xc'));var _=require('lodash');var squel=require(_0x43ad('0xd'));var crypto=require(_0x43ad('0xe'));var jsforce=require(_0x43ad('0xf'));var deskjs=require(_0x43ad('0x10'));var toCsv=require(_0x43ad('0xa'));var querystring=require('querystring');var Papa=require(_0x43ad('0x11'));var Redis=require(_0x43ad('0x12'));var authService=require(_0x43ad('0x13'));var qs=require(_0x43ad('0x14'));var as=require(_0x43ad('0x15'));var hardwareService=require(_0x43ad('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x43ad('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x43ad('0x18'))['db'];function respondWithStatusCode(_0x36264f,_0x5c6ee7){_0x5c6ee7=_0x5c6ee7||0xcc;return function(_0x1af7f1){if(_0x1af7f1){return _0x36264f[_0x43ad('0x19')](_0x5c6ee7);}return _0x36264f[_0x43ad('0x1a')](_0x5c6ee7)[_0x43ad('0x1b')]();};}function respondWithResult(_0x6b5f33,_0x4dc337){_0x4dc337=_0x4dc337||0xc8;return function(_0x40e039){if(_0x40e039){return _0x6b5f33['status'](_0x4dc337)['json'](_0x40e039);}};}function respondWithFilteredResult(_0x3bfb89,_0x243489){return function(_0x1533d5){if(_0x1533d5){var _0x582cbc=typeof _0x243489['offset']===_0x43ad('0x1c')&&typeof _0x243489[_0x43ad('0x1d')]==='undefined';var _0x4396de=_0x1533d5[_0x43ad('0x1e')];var _0x19cd36=_0x582cbc?0x0:_0x243489[_0x43ad('0x1f')];var _0x6e6383=_0x582cbc?_0x1533d5[_0x43ad('0x1e')]:_0x243489[_0x43ad('0x1f')]+_0x243489[_0x43ad('0x1d')];var _0xbbb1e;if(_0x6e6383>=_0x4396de){_0x6e6383=_0x4396de;_0xbbb1e=0xc8;}else{_0xbbb1e=0xce;}_0x3bfb89[_0x43ad('0x1a')](_0xbbb1e);return _0x3bfb89['set'](_0x43ad('0x20'),_0x19cd36+'-'+_0x6e6383+'/'+_0x4396de)[_0x43ad('0x21')](_0x1533d5);}return null;};}function patchUpdates(_0x42fc20){return function(_0x3ab420){try{jsonpatch['apply'](_0x3ab420,_0x42fc20,!![]);}catch(_0xd13fc3){return BPromise['reject'](_0xd13fc3);}return _0x3ab420['save']();};}function saveUpdates(_0x18ac2e,_0x2d1f58){return function(_0x5527c5){if(_0x5527c5){return _0x5527c5[_0x43ad('0x22')](_0x18ac2e)[_0x43ad('0x23')](function(_0x1796b1){return _0x1796b1;});}return null;};}function removeEntity(_0x5e8c82,_0x5e55b7){return function(_0x2448d2){if(_0x2448d2){return _0x2448d2[_0x43ad('0x24')]()[_0x43ad('0x23')](function(){_0x5e8c82[_0x43ad('0x1a')](0xcc)[_0x43ad('0x1b')]();});}};}function handleEntityNotFound(_0x3e5689,_0x46469c){return function(_0x3652ed){if(!_0x3652ed){_0x3e5689[_0x43ad('0x19')](0x194);}return _0x3652ed;};}function handleError(_0x38fa15,_0x5b1833){_0x5b1833=_0x5b1833||0x1f4;return function(_0x7f78fb){logger[_0x43ad('0x25')](_0x7f78fb[_0x43ad('0x26')]);if(_0x7f78fb['name']){delete _0x7f78fb[_0x43ad('0x27')];}_0x38fa15[_0x43ad('0x1a')](_0x5b1833)[_0x43ad('0x28')](_0x7f78fb);};}exports['index']=function(_0x4e6c11,_0xf85e0f){var _0x2abd19={},_0x55310b={},_0x3c7c56={'count':0x0,'rows':[]};var _0x4b4866=_[_0x43ad('0x29')](db[_0x43ad('0x2a')][_0x43ad('0x2b')],function(_0x1b15af){return{'name':_0x1b15af[_0x43ad('0x2c')],'type':_0x1b15af[_0x43ad('0x2d')][_0x43ad('0x2e')]};});_0x55310b[_0x43ad('0x2f')]=_['map'](_0x4b4866,_0x43ad('0x27'));_0x55310b[_0x43ad('0x30')]=_['keys'](_0x4e6c11[_0x43ad('0x30')]);_0x55310b[_0x43ad('0x31')]=_['intersection'](_0x55310b['model'],_0x55310b['query']);_0x2abd19[_0x43ad('0x32')]=_['intersection'](_0x55310b[_0x43ad('0x2f')],qs[_0x43ad('0x33')](_0x4e6c11[_0x43ad('0x30')][_0x43ad('0x33')]));_0x2abd19[_0x43ad('0x32')]=_0x2abd19['attributes']['length']?_0x2abd19[_0x43ad('0x32')]:_0x55310b[_0x43ad('0x2f')];if(!_0x4e6c11['query']['hasOwnProperty'](_0x43ad('0x34'))){_0x2abd19[_0x43ad('0x1d')]=qs[_0x43ad('0x1d')](_0x4e6c11[_0x43ad('0x30')]['limit']);_0x2abd19[_0x43ad('0x1f')]=qs[_0x43ad('0x1f')](_0x4e6c11[_0x43ad('0x30')][_0x43ad('0x1f')]);}_0x2abd19[_0x43ad('0x35')]=qs[_0x43ad('0x36')](_0x4e6c11[_0x43ad('0x30')][_0x43ad('0x36')]);_0x2abd19[_0x43ad('0x37')]=qs['filters'](_['pick'](_0x4e6c11[_0x43ad('0x30')],_0x55310b['filters']),_0x4b4866);if(_0x4e6c11[_0x43ad('0x30')][_0x43ad('0x38')]){_0x2abd19[_0x43ad('0x37')]=_['merge'](_0x2abd19[_0x43ad('0x37')],{'$or':_[_0x43ad('0x29')](_0x4b4866,function(_0x2b70e8){if(_0x2b70e8[_0x43ad('0x2d')]!==_0x43ad('0x39')){var _0x4d7975={};_0x4d7975[_0x2b70e8['name']]={'$like':'%'+_0x4e6c11[_0x43ad('0x30')]['filter']+'%'};return _0x4d7975;}})});}_0x2abd19=_[_0x43ad('0x3a')]({},_0x2abd19,_0x4e6c11[_0x43ad('0x3b')]);var _0x2d17f1={'where':_0x2abd19['where']};return db['JscriptyQuestionReport'][_0x43ad('0x1e')](_0x2d17f1)[_0x43ad('0x23')](function(_0x58851c){_0x3c7c56[_0x43ad('0x1e')]=_0x58851c;if(_0x4e6c11['query'][_0x43ad('0x3c')]){_0x2abd19['include']=[{'all':!![]}];}return db[_0x43ad('0x2a')][_0x43ad('0x3d')](_0x2abd19);})[_0x43ad('0x23')](function(_0x1f267f){_0x3c7c56[_0x43ad('0x3e')]=_0x1f267f;return _0x3c7c56;})[_0x43ad('0x23')](respondWithFilteredResult(_0xf85e0f,_0x2abd19))[_0x43ad('0x3f')](handleError(_0xf85e0f,null));};exports['show']=function(_0x4cb6cc,_0x4c8583){var _0x11fb13={'raw':!![],'where':{'id':_0x4cb6cc[_0x43ad('0x40')]['id']}},_0x49a60a={};_0x49a60a[_0x43ad('0x2f')]=_[_0x43ad('0x41')](db[_0x43ad('0x2a')][_0x43ad('0x2b')]);_0x49a60a['query']=_[_0x43ad('0x41')](_0x4cb6cc[_0x43ad('0x30')]);_0x49a60a[_0x43ad('0x31')]=_[_0x43ad('0x42')](_0x49a60a[_0x43ad('0x2f')],_0x49a60a[_0x43ad('0x30')]);_0x11fb13[_0x43ad('0x32')]=_['intersection'](_0x49a60a[_0x43ad('0x2f')],qs[_0x43ad('0x33')](_0x4cb6cc[_0x43ad('0x30')]['fields']));_0x11fb13[_0x43ad('0x32')]=_0x11fb13[_0x43ad('0x32')][_0x43ad('0x43')]?_0x11fb13['attributes']:_0x49a60a[_0x43ad('0x2f')];if(_0x4cb6cc['query'][_0x43ad('0x3c')]){_0x11fb13[_0x43ad('0x44')]=[{'all':!![]}];}_0x11fb13=_[_0x43ad('0x3a')]({},_0x11fb13,_0x4cb6cc[_0x43ad('0x3b')]);return db[_0x43ad('0x2a')][_0x43ad('0x45')](_0x11fb13)[_0x43ad('0x23')](handleEntityNotFound(_0x4c8583,null))[_0x43ad('0x23')](respondWithResult(_0x4c8583,null))[_0x43ad('0x3f')](handleError(_0x4c8583,null));};exports[_0x43ad('0x46')]=function(_0x540785,_0x2ee454){return db[_0x43ad('0x2a')][_0x43ad('0x46')](_0x540785[_0x43ad('0x47')],{})[_0x43ad('0x23')](respondWithResult(_0x2ee454,0xc9))[_0x43ad('0x3f')](handleError(_0x2ee454,null));};exports[_0x43ad('0x22')]=function(_0x57d8ce,_0x8ec011){if(_0x57d8ce['body']['id']){delete _0x57d8ce['body']['id'];}return db[_0x43ad('0x2a')][_0x43ad('0x45')]({'where':{'id':_0x57d8ce[_0x43ad('0x40')]['id']}})[_0x43ad('0x23')](handleEntityNotFound(_0x8ec011,null))['then'](saveUpdates(_0x57d8ce['body'],null))[_0x43ad('0x23')](respondWithResult(_0x8ec011,null))[_0x43ad('0x3f')](handleError(_0x8ec011,null));};exports[_0x43ad('0x24')]=function(_0x5769de,_0x36d170){return db[_0x43ad('0x2a')]['find']({'where':{'id':_0x5769de['params']['id']}})[_0x43ad('0x23')](handleEntityNotFound(_0x36d170,null))['then'](removeEntity(_0x36d170,null))[_0x43ad('0x3f')](handleError(_0x36d170,null));};exports[_0x43ad('0x48')]=function(_0x53298f,_0x18d1d7){return db[_0x43ad('0x2a')][_0x43ad('0x48')]()[_0x43ad('0x23')](respondWithResult(_0x18d1d7,null))[_0x43ad('0x3f')](handleError(_0x18d1d7,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 5e00677..72aae93 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 _0x3165=['api','moment','bluebird','path','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0x17e3e4,_0x5b7cff){var _0x505fb8=function(_0x50550b){while(--_0x50550b){_0x17e3e4['push'](_0x17e3e4['shift']());}};_0x505fb8(++_0x5b7cff);}(_0x3165,0xad));var _0x5316=function(_0x673670,_0x587353){_0x673670=_0x673670-0x0;var _0x5ff604=_0x3165[_0x673670];return _0x5ff604;};'use strict';var _=require(_0x5316('0x0'));var util=require(_0x5316('0x1'));var logger=require(_0x5316('0x2'))(_0x5316('0x3'));var moment=require(_0x5316('0x4'));var BPromise=require(_0x5316('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5316('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5316('0x7'));module['exports']=function(_0x47f0ed,_0x1c8f96){return _0x47f0ed[_0x5316('0x8')](_0x5316('0x9'),attributes,{'tableName':_0x5316('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68f8=['./jscriptyQuestionReport.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5592a9,_0x576d19){var _0xd1df3d=function(_0xb527c0){while(--_0xb527c0){_0x5592a9['push'](_0x5592a9['shift']());}};_0xd1df3d(++_0x576d19);}(_0x68f8,0x9c));var _0x868f=function(_0x2d76a9,_0x4b023f){_0x2d76a9=_0x2d76a9-0x0;var _0x2eeee4=_0x68f8[_0x2d76a9];return _0x2eeee4;};'use strict';var _=require(_0x868f('0x0'));var util=require(_0x868f('0x1'));var logger=require(_0x868f('0x2'))(_0x868f('0x3'));var moment=require(_0x868f('0x4'));var BPromise=require(_0x868f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x868f('0x6'));var rimraf=require(_0x868f('0x7'));var config=require(_0x868f('0x8'));var attributes=require(_0x868f('0x9'));module[_0x868f('0xa')]=function(_0x2cb1b5,_0xad50b2){return _0x2cb1b5['define']('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','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 70862c6..33ad8b2 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 _0xd769=['stringify','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','JscriptyQuestionReport,\x20%s,\x20%s','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xd769,0xf9));var _0x9d76=function(_0x14280a,_0x5930a9){_0x14280a=_0x14280a-0x0;var _0x3cae77=_0xd769[_0x14280a];return _0x3cae77;};'use strict';var _=require(_0x9d76('0x0'));var util=require(_0x9d76('0x1'));var moment=require(_0x9d76('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d76('0x3'));var db=require(_0x9d76('0x4'))['db'];var utils=require(_0x9d76('0x5'));var logger=require(_0x9d76('0x6'))(_0x9d76('0x7'));var config=require(_0x9d76('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9d76('0x9')][_0x9d76('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22bc9b,_0x34a9e3,_0x4103d6){return new BPromise(function(_0x43e2f4,_0xe6493a){return client[_0x9d76('0xb')](_0x22bc9b,_0x4103d6)['then'](function(_0xa06cbf){logger['info'](_0x9d76('0xc'),_0x34a9e3,'request\x20sent');logger['debug'](_0x9d76('0xd'),_0x34a9e3,_0x9d76('0xe'),JSON[_0x9d76('0xf')](_0xa06cbf));if(_0xa06cbf[_0x9d76('0x10')]){if(_0xa06cbf[_0x9d76('0x10')][_0x9d76('0x11')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x34a9e3,_0xa06cbf[_0x9d76('0x10')]['message']);return _0xe6493a(_0xa06cbf[_0x9d76('0x10')][_0x9d76('0x12')]);}logger[_0x9d76('0x10')](_0x9d76('0xc'),_0x34a9e3,_0xa06cbf[_0x9d76('0x10')][_0x9d76('0x12')]);return _0x43e2f4(_0xa06cbf[_0x9d76('0x10')][_0x9d76('0x12')]);}else{logger[_0x9d76('0x13')](_0x9d76('0xc'),_0x34a9e3,_0x9d76('0xe'));_0x43e2f4(_0xa06cbf[_0x9d76('0x14')]['message']);}})[_0x9d76('0x15')](function(_0xb05496){logger[_0x9d76('0x10')](_0x9d76('0xc'),_0x34a9e3,_0xb05496);_0xe6493a(_0xb05496);});});} \ No newline at end of file +var _0x0ada=['jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','util','moment','bluebird','randomstring','../../config/utils','../../config/environment'];(function(_0x5e4eb4,_0x52afca){var _0x303419=function(_0x3f977c){while(--_0x3f977c){_0x5e4eb4['push'](_0x5e4eb4['shift']());}};_0x303419(++_0x52afca);}(_0x0ada,0xe4));var _0xa0ad=function(_0x4f2b09,_0x243211){_0x4f2b09=_0x4f2b09-0x0;var _0x2a0ccf=_0x0ada[_0x4f2b09];return _0x2a0ccf;};'use strict';var _=require('lodash');var util=require(_0xa0ad('0x0'));var moment=require(_0xa0ad('0x1'));var BPromise=require(_0xa0ad('0x2'));var rs=require(_0xa0ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa0ad('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xa0ad('0x5'));var jayson=require(_0xa0ad('0x6'));var client=jayson[_0xa0ad('0x7')][_0xa0ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1becb3,_0x415d65,_0x281a11){return new BPromise(function(_0x4c06df,_0x5487c4){return client[_0xa0ad('0x9')](_0x1becb3,_0x281a11)[_0xa0ad('0xa')](function(_0x3ebbf4){logger[_0xa0ad('0xb')](_0xa0ad('0xc'),_0x415d65,_0xa0ad('0xd'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x415d65,_0xa0ad('0xd'),JSON[_0xa0ad('0xe')](_0x3ebbf4));if(_0x3ebbf4[_0xa0ad('0xf')]){if(_0x3ebbf4['error'][_0xa0ad('0x10')]===0x1f4){logger['error'](_0xa0ad('0xc'),_0x415d65,_0x3ebbf4[_0xa0ad('0xf')][_0xa0ad('0x11')]);return _0x5487c4(_0x3ebbf4[_0xa0ad('0xf')]['message']);}logger[_0xa0ad('0xf')](_0xa0ad('0xc'),_0x415d65,_0x3ebbf4[_0xa0ad('0xf')][_0xa0ad('0x11')]);return _0x4c06df(_0x3ebbf4[_0xa0ad('0xf')]['message']);}else{logger[_0xa0ad('0xb')](_0xa0ad('0xc'),_0x415d65,_0xa0ad('0xd'));_0x4c06df(_0x3ebbf4['result'][_0xa0ad('0x11')]);}})['catch'](function(_0x4db446){logger[_0xa0ad('0xf')](_0xa0ad('0xc'),_0x415d65,_0x4db446);_0x5487c4(_0x4db446);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index a1ed71a..18f2622 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 _0xe23a=['create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','show','/:id/questions','post'];(function(_0x28e740,_0x5afaf8){var _0x2c6a8b=function(_0x1efd15){while(--_0x1efd15){_0x28e740['push'](_0x28e740['shift']());}};_0x2c6a8b(++_0x5afaf8);}(_0xe23a,0x1a9));var _0xae23=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xe23a[_0x2576d7];return _0x16a08c;};'use strict';var multer=require(_0xae23('0x0'));var util=require('util');var path=require(_0xae23('0x1'));var timeout=require(_0xae23('0x2'));var express=require(_0xae23('0x3'));var router=express[_0xae23('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xae23('0x5'));var config=require(_0xae23('0x6'));var controller=require(_0xae23('0x7'));router[_0xae23('0x8')]('/',auth[_0xae23('0x9')](),controller[_0xae23('0xa')]);router[_0xae23('0x8')]('/describe',auth[_0xae23('0x9')](),controller[_0xae23('0xb')]);router[_0xae23('0x8')](_0xae23('0xc'),auth[_0xae23('0x9')](),controller[_0xae23('0xd')]);router[_0xae23('0x8')](_0xae23('0xe'),auth[_0xae23('0x9')](),controller['getQuestions']);router[_0xae23('0xf')]('/',auth['isAuthenticated'](),controller[_0xae23('0x10')]);router[_0xae23('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xae23('0x12')]);router[_0xae23('0x13')](_0xae23('0xc'),auth[_0xae23('0x9')](),controller['destroy']);module[_0xae23('0x14')]=router; \ No newline at end of file +var _0xa1e9=['isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','post','create','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get'];(function(_0x10c1b4,_0x1b223c){var _0x39fcc3=function(_0x35223f){while(--_0x35223f){_0x10c1b4['push'](_0x10c1b4['shift']());}};_0x39fcc3(++_0x1b223c);}(_0xa1e9,0xab));var _0x9a1e=function(_0x4403e5,_0x32ddae){_0x4403e5=_0x4403e5-0x0;var _0x512114=_0xa1e9[_0x4403e5];return _0x512114;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9a1e('0x0'));var timeout=require(_0x9a1e('0x1'));var express=require(_0x9a1e('0x2'));var router=express[_0x9a1e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9a1e('0x4'));var interaction=require(_0x9a1e('0x5'));var config=require(_0x9a1e('0x6'));var controller=require(_0x9a1e('0x7'));router[_0x9a1e('0x8')]('/',auth[_0x9a1e('0x9')](),controller['index']);router['get']('/describe',auth[_0x9a1e('0x9')](),controller[_0x9a1e('0xa')]);router[_0x9a1e('0x8')](_0x9a1e('0xb'),auth[_0x9a1e('0x9')](),controller[_0x9a1e('0xc')]);router['get'](_0x9a1e('0xd'),auth['isAuthenticated'](),controller[_0x9a1e('0xe')]);router[_0x9a1e('0xf')]('/',auth[_0x9a1e('0x9')](),controller[_0x9a1e('0x10')]);router['put']('/:id',auth[_0x9a1e('0x9')](),controller[_0x9a1e('0x11')]);router[_0x9a1e('0x12')](_0x9a1e('0xb'),auth['isAuthenticated'](),controller[_0x9a1e('0x13')]);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 f75de0c..2b6f27b 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 _0x77ca=['starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','DATE','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77ca,0x12f));var _0xa77c=function(_0x5a64fd,_0x5c8a3c){_0x5a64fd=_0x5a64fd-0x0;var _0x3ba0c7=_0x77ca[_0x5a64fd];return _0x3ba0c7;};'use strict';var moment=require(_0xa77c('0x0'));var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize[_0xa77c('0x1')],'set':function(_0x54b893){this[_0xa77c('0x2')](_0xa77c('0x3'),_0x54b893);this[_0xa77c('0x2')](_0xa77c('0x4'),moment()[_0xa77c('0x5')](_0xa77c('0x6')));}},'endtime':{'type':Sequelize[_0xa77c('0x1')]},'membername':{'type':Sequelize[_0xa77c('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xa77c('0x7')]},'uniqueid':{'type':Sequelize[_0xa77c('0x7')]},'calleridname':{'type':Sequelize[_0xa77c('0x7')]},'calleridnum':{'type':Sequelize[_0xa77c('0x7')]},'completed':{'type':Sequelize[_0xa77c('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xea4f=['starttime','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','DATE','setDataValue'];(function(_0x188e34,_0x2d2c8){var _0x2838c6=function(_0x176707){while(--_0x176707){_0x188e34['push'](_0x188e34['shift']());}};_0x2838c6(++_0x2d2c8);}(_0xea4f,0x7a));var _0xfea4=function(_0x26ddc7,_0x4551df){_0x26ddc7=_0x26ddc7-0x0;var _0x4774f4=_0xea4f[_0x26ddc7];return _0x4774f4;};'use strict';var moment=require(_0xfea4('0x0'));var Sequelize=require(_0xfea4('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xfea4('0x2')],'set':function(_0x27c478){this[_0xfea4('0x3')](_0xfea4('0x4'),_0x27c478);this['setDataValue']('endtime',moment()['format'](_0xfea4('0x5')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xfea4('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xfea4('0x6')]},'calleridnum':{'type':Sequelize[_0xfea4('0x6')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 4e7d419..13ebb01 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 _0xc4ad=['SessionId','findAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','params','describe','getQuestions'];(function(_0x350c92,_0x1ef418){var _0x5cb1bc=function(_0x3579b1){while(--_0x3579b1){_0x350c92['push'](_0x350c92['shift']());}};_0x5cb1bc(++_0x1ef418);}(_0xc4ad,0x19c));var _0xdc4a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4ad[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdc4a('0x0'));var zipdir=require(_0xdc4a('0x1'));var jsonpatch=require(_0xdc4a('0x2'));var rp=require(_0xdc4a('0x3'));var moment=require(_0xdc4a('0x4'));var BPromise=require(_0xdc4a('0x5'));var Mustache=require(_0xdc4a('0x6'));var util=require(_0xdc4a('0x7'));var path=require('path');var sox=require(_0xdc4a('0x8'));var csv=require(_0xdc4a('0x9'));var ejs=require(_0xdc4a('0xa'));var fs=require('fs');var fs_extra=require(_0xdc4a('0xb'));var _=require(_0xdc4a('0xc'));var squel=require('squel');var crypto=require(_0xdc4a('0xd'));var jsforce=require(_0xdc4a('0xe'));var deskjs=require(_0xdc4a('0xf'));var toCsv=require(_0xdc4a('0x9'));var querystring=require(_0xdc4a('0x10'));var Papa=require('papaparse');var Redis=require(_0xdc4a('0x11'));var authService=require(_0xdc4a('0x12'));var qs=require(_0xdc4a('0x13'));var as=require(_0xdc4a('0x14'));var hardwareService=require(_0xdc4a('0x15'));var logger=require('../../config/logger')(_0xdc4a('0x16'));var utils=require(_0xdc4a('0x17'));var config=require(_0xdc4a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xdc4a('0x19'))['db'];function respondWithStatusCode(_0x571ea2,_0x57ae5b){_0x57ae5b=_0x57ae5b||0xcc;return function(_0x43bbd8){if(_0x43bbd8){return _0x571ea2[_0xdc4a('0x1a')](_0x57ae5b);}return _0x571ea2[_0xdc4a('0x1b')](_0x57ae5b)[_0xdc4a('0x1c')]();};}function respondWithResult(_0xfdd1a7,_0x4af4a7){_0x4af4a7=_0x4af4a7||0xc8;return function(_0x19330d){if(_0x19330d){return _0xfdd1a7[_0xdc4a('0x1b')](_0x4af4a7)['json'](_0x19330d);}};}function respondWithFilteredResult(_0x260476,_0x1399e2){return function(_0x1ca091){if(_0x1ca091){var _0x25e966=typeof _0x1399e2[_0xdc4a('0x1d')]==='undefined'&&typeof _0x1399e2[_0xdc4a('0x1e')]===_0xdc4a('0x1f');var _0x5297a5=_0x1ca091[_0xdc4a('0x20')];var _0x5b01fe=_0x25e966?0x0:_0x1399e2[_0xdc4a('0x1d')];var _0x261a53=_0x25e966?_0x1ca091[_0xdc4a('0x20')]:_0x1399e2['offset']+_0x1399e2[_0xdc4a('0x1e')];var _0x1ef09a;if(_0x261a53>=_0x5297a5){_0x261a53=_0x5297a5;_0x1ef09a=0xc8;}else{_0x1ef09a=0xce;}_0x260476[_0xdc4a('0x1b')](_0x1ef09a);return _0x260476[_0xdc4a('0x21')](_0xdc4a('0x22'),_0x5b01fe+'-'+_0x261a53+'/'+_0x5297a5)[_0xdc4a('0x23')](_0x1ca091);}return null;};}function patchUpdates(_0x18e76e){return function(_0x486125){try{jsonpatch[_0xdc4a('0x24')](_0x486125,_0x18e76e,!![]);}catch(_0x2c0207){return BPromise[_0xdc4a('0x25')](_0x2c0207);}return _0x486125[_0xdc4a('0x26')]();};}function saveUpdates(_0x19ba0f,_0x2cce1d){return function(_0x47bb22){if(_0x47bb22){return _0x47bb22[_0xdc4a('0x27')](_0x19ba0f)[_0xdc4a('0x28')](function(_0x463594){return _0x463594;});}return null;};}function removeEntity(_0x3fb5e0,_0x5b24f9){return function(_0x2969c5){if(_0x2969c5){return _0x2969c5[_0xdc4a('0x29')]()[_0xdc4a('0x28')](function(){_0x3fb5e0[_0xdc4a('0x1b')](0xcc)[_0xdc4a('0x1c')]();});}};}function handleEntityNotFound(_0x4d6b8f,_0x3682b3){return function(_0x4d866b){if(!_0x4d866b){_0x4d6b8f['sendStatus'](0x194);}return _0x4d866b;};}function handleError(_0x215dea,_0x2b06b9){_0x2b06b9=_0x2b06b9||0x1f4;return function(_0x453120){logger['error'](_0x453120[_0xdc4a('0x2a')]);if(_0x453120[_0xdc4a('0x2b')]){delete _0x453120[_0xdc4a('0x2b')];}_0x215dea[_0xdc4a('0x1b')](_0x2b06b9)[_0xdc4a('0x2c')](_0x453120);};}exports[_0xdc4a('0x2d')]=function(_0x47ca34,_0x2aaf27){var _0x1dbd95={},_0x419171={},_0x138e78={'count':0x0,'rows':[]};var _0x190cab=_[_0xdc4a('0x2e')](db[_0xdc4a('0x2f')][_0xdc4a('0x30')],function(_0x221cc2){return{'name':_0x221cc2[_0xdc4a('0x31')],'type':_0x221cc2[_0xdc4a('0x32')][_0xdc4a('0x33')]};});_0x419171[_0xdc4a('0x34')]=_['map'](_0x190cab,_0xdc4a('0x2b'));_0x419171[_0xdc4a('0x35')]=_[_0xdc4a('0x36')](_0x47ca34[_0xdc4a('0x35')]);_0x419171[_0xdc4a('0x37')]=_[_0xdc4a('0x38')](_0x419171[_0xdc4a('0x34')],_0x419171[_0xdc4a('0x35')]);_0x1dbd95[_0xdc4a('0x39')]=_[_0xdc4a('0x38')](_0x419171[_0xdc4a('0x34')],qs['fields'](_0x47ca34[_0xdc4a('0x35')][_0xdc4a('0x3a')]));_0x1dbd95[_0xdc4a('0x39')]=_0x1dbd95[_0xdc4a('0x39')][_0xdc4a('0x3b')]?_0x1dbd95[_0xdc4a('0x39')]:_0x419171[_0xdc4a('0x34')];if(!_0x47ca34[_0xdc4a('0x35')][_0xdc4a('0x3c')](_0xdc4a('0x3d'))){_0x1dbd95[_0xdc4a('0x1e')]=qs[_0xdc4a('0x1e')](_0x47ca34[_0xdc4a('0x35')][_0xdc4a('0x1e')]);_0x1dbd95[_0xdc4a('0x1d')]=qs['offset'](_0x47ca34[_0xdc4a('0x35')][_0xdc4a('0x1d')]);}_0x1dbd95[_0xdc4a('0x3e')]=qs[_0xdc4a('0x3f')](_0x47ca34['query'][_0xdc4a('0x3f')]);_0x1dbd95['where']=qs[_0xdc4a('0x37')](_['pick'](_0x47ca34[_0xdc4a('0x35')],_0x419171[_0xdc4a('0x37')]),_0x190cab);if(_0x47ca34[_0xdc4a('0x35')][_0xdc4a('0x40')]){_0x1dbd95['where']=_[_0xdc4a('0x41')](_0x1dbd95[_0xdc4a('0x42')],{'$or':_['map'](_0x190cab,function(_0x29d691){if(_0x29d691[_0xdc4a('0x32')]!==_0xdc4a('0x43')){var _0x10c695={};_0x10c695[_0x29d691['name']]={'$like':'%'+_0x47ca34[_0xdc4a('0x35')][_0xdc4a('0x40')]+'%'};return _0x10c695;}})});}_0x1dbd95=_[_0xdc4a('0x41')]({},_0x1dbd95,_0x47ca34[_0xdc4a('0x44')]);var _0x5d2a6b={'where':_0x1dbd95[_0xdc4a('0x42')]};return db['JscriptySessionReport'][_0xdc4a('0x20')](_0x5d2a6b)['then'](function(_0x134fac){_0x138e78[_0xdc4a('0x20')]=_0x134fac;if(_0x47ca34[_0xdc4a('0x35')][_0xdc4a('0x45')]){_0x1dbd95[_0xdc4a('0x46')]=[{'all':!![]}];}return db[_0xdc4a('0x2f')]['findAll'](_0x1dbd95);})[_0xdc4a('0x28')](function(_0x5f0fa1){_0x138e78[_0xdc4a('0x47')]=_0x5f0fa1;return _0x138e78;})[_0xdc4a('0x28')](respondWithFilteredResult(_0x2aaf27,_0x1dbd95))[_0xdc4a('0x48')](handleError(_0x2aaf27,null));};exports[_0xdc4a('0x49')]=function(_0x4c8fda,_0x5ebc5e){var _0xc8e34={'raw':!![],'where':{'id':_0x4c8fda['params']['id']}},_0x1b9fc3={};_0x1b9fc3['model']=_[_0xdc4a('0x36')](db[_0xdc4a('0x2f')][_0xdc4a('0x30')]);_0x1b9fc3[_0xdc4a('0x35')]=_['keys'](_0x4c8fda['query']);_0x1b9fc3[_0xdc4a('0x37')]=_[_0xdc4a('0x38')](_0x1b9fc3[_0xdc4a('0x34')],_0x1b9fc3[_0xdc4a('0x35')]);_0xc8e34[_0xdc4a('0x39')]=_['intersection'](_0x1b9fc3[_0xdc4a('0x34')],qs['fields'](_0x4c8fda[_0xdc4a('0x35')]['fields']));_0xc8e34[_0xdc4a('0x39')]=_0xc8e34[_0xdc4a('0x39')][_0xdc4a('0x3b')]?_0xc8e34[_0xdc4a('0x39')]:_0x1b9fc3[_0xdc4a('0x34')];if(_0x4c8fda['query']['includeAll']){_0xc8e34[_0xdc4a('0x46')]=[{'all':!![]}];}_0xc8e34=_[_0xdc4a('0x41')]({},_0xc8e34,_0x4c8fda['options']);return db[_0xdc4a('0x2f')][_0xdc4a('0x4a')](_0xc8e34)[_0xdc4a('0x28')](handleEntityNotFound(_0x5ebc5e,null))['then'](respondWithResult(_0x5ebc5e,null))[_0xdc4a('0x48')](handleError(_0x5ebc5e,null));};exports[_0xdc4a('0x4b')]=function(_0x23788a,_0x3296bf){return db[_0xdc4a('0x2f')][_0xdc4a('0x4b')](_0x23788a[_0xdc4a('0x4c')],{})[_0xdc4a('0x28')](respondWithResult(_0x3296bf,0xc9))['catch'](handleError(_0x3296bf,null));};exports[_0xdc4a('0x27')]=function(_0xacb2bd,_0x51c5b7){if(_0xacb2bd[_0xdc4a('0x4c')]['id']){delete _0xacb2bd['body']['id'];}return db['JscriptySessionReport'][_0xdc4a('0x4a')]({'where':{'id':_0xacb2bd[_0xdc4a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x51c5b7,null))[_0xdc4a('0x28')](saveUpdates(_0xacb2bd['body'],null))[_0xdc4a('0x28')](respondWithResult(_0x51c5b7,null))[_0xdc4a('0x48')](handleError(_0x51c5b7,null));};exports[_0xdc4a('0x29')]=function(_0x3f683c,_0xe09d46){return db['JscriptySessionReport'][_0xdc4a('0x4a')]({'where':{'id':_0x3f683c[_0xdc4a('0x4d')]['id']}})[_0xdc4a('0x28')](handleEntityNotFound(_0xe09d46,null))['then'](removeEntity(_0xe09d46,null))[_0xdc4a('0x48')](handleError(_0xe09d46,null));};exports['describe']=function(_0x428192,_0x2620d1){return db[_0xdc4a('0x2f')][_0xdc4a('0x4e')]()[_0xdc4a('0x28')](respondWithResult(_0x2620d1,null))[_0xdc4a('0x48')](handleError(_0x2620d1,null));};exports[_0xdc4a('0x4f')]=function(_0x1e90dc,_0x524154,_0x283616){var _0x2dce2f={'raw':!![],'where':{}};var _0xaf376e={};var _0x3b0f0d={'count':0x0,'rows':[]};return db[_0xdc4a('0x2f')]['findOne']({'where':{'id':_0x1e90dc['params']['id']}})[_0xdc4a('0x28')](handleEntityNotFound(_0x524154,null))[_0xdc4a('0x28')](function(_0x290739){if(_0x290739){_0xaf376e[_0xdc4a('0x34')]=_[_0xdc4a('0x36')](db['JscriptyQuestionReport']['rawAttributes']);_0xaf376e['query']=_[_0xdc4a('0x36')](_0x1e90dc['query']);_0xaf376e['filters']=_[_0xdc4a('0x38')](_0xaf376e[_0xdc4a('0x34')],_0xaf376e[_0xdc4a('0x35')]);_0x2dce2f[_0xdc4a('0x39')]=_[_0xdc4a('0x38')](_0xaf376e[_0xdc4a('0x34')],qs[_0xdc4a('0x3a')](_0x1e90dc[_0xdc4a('0x35')][_0xdc4a('0x3a')]));_0x2dce2f[_0xdc4a('0x39')]=_0x2dce2f[_0xdc4a('0x39')][_0xdc4a('0x3b')]?_0x2dce2f[_0xdc4a('0x39')]:_0xaf376e[_0xdc4a('0x34')];if(!_0x1e90dc[_0xdc4a('0x35')][_0xdc4a('0x3c')](_0xdc4a('0x3d'))){_0x2dce2f[_0xdc4a('0x1e')]=qs[_0xdc4a('0x1e')](_0x1e90dc['query']['limit']);_0x2dce2f[_0xdc4a('0x1d')]=qs[_0xdc4a('0x1d')](_0x1e90dc[_0xdc4a('0x35')][_0xdc4a('0x1d')]);}_0x2dce2f['order']=qs[_0xdc4a('0x3f')](_0x1e90dc['query'][_0xdc4a('0x3f')]);_0x2dce2f['where']=qs['filters'](_['pick'](_0x1e90dc[_0xdc4a('0x35')],_0xaf376e[_0xdc4a('0x37')]));_0x2dce2f['where'][_0xdc4a('0x50')]=_0x290739['id'];if(_0x1e90dc[_0xdc4a('0x35')][_0xdc4a('0x40')]){_0x2dce2f['where']=_['merge'](_0x2dce2f[_0xdc4a('0x42')],{'$or':_[_0xdc4a('0x2e')](_0x2dce2f[_0xdc4a('0x39')],function(_0x38fdf3){var _0x11fd7a={};_0x11fd7a[_0x38fdf3]={'$like':'%'+_0x1e90dc['query'][_0xdc4a('0x40')]+'%'};return _0x11fd7a;})});}_0x2dce2f=_[_0xdc4a('0x41')]({},_0x2dce2f,_0x1e90dc[_0xdc4a('0x44')]);return db['JscriptyQuestionReport'][_0xdc4a('0x20')]({'where':_0x2dce2f['where']})[_0xdc4a('0x28')](function(_0x5b6ee6){_0x3b0f0d['count']=_0x5b6ee6;if(_0x1e90dc[_0xdc4a('0x35')][_0xdc4a('0x45')]){_0x2dce2f[_0xdc4a('0x46')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xdc4a('0x51')](_0x2dce2f);})[_0xdc4a('0x28')](function(_0x2de1f6){_0x3b0f0d[_0xdc4a('0x47')]=_0x2de1f6;return _0x3b0f0d;});}})[_0xdc4a('0x28')](respondWithFilteredResult(_0x524154,_0x2dce2f))[_0xdc4a('0x48')](handleError(_0x524154,null));}; \ No newline at end of file +var _0xca6d=['type','then','includeAll','include','rows','catch','show','rawAttributes','options','find','create','body','describe','getQuestions','findOne','params','JscriptyQuestionReport','nolimit','order','pick','SessionId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','error','name','JscriptySessionReport','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','filter','merge','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca6d,0x1ea));var _0xdca6=function(_0x57014b,_0x360c0f){_0x57014b=_0x57014b-0x0;var _0x2b258a=_0xca6d[_0x57014b];return _0x2b258a;};'use strict';var emlformat=require(_0xdca6('0x0'));var rimraf=require(_0xdca6('0x1'));var zipdir=require(_0xdca6('0x2'));var jsonpatch=require(_0xdca6('0x3'));var rp=require(_0xdca6('0x4'));var moment=require(_0xdca6('0x5'));var BPromise=require(_0xdca6('0x6'));var Mustache=require(_0xdca6('0x7'));var util=require('util');var path=require(_0xdca6('0x8'));var sox=require('sox');var csv=require(_0xdca6('0x9'));var ejs=require(_0xdca6('0xa'));var fs=require('fs');var fs_extra=require(_0xdca6('0xb'));var _=require(_0xdca6('0xc'));var squel=require(_0xdca6('0xd'));var crypto=require(_0xdca6('0xe'));var jsforce=require(_0xdca6('0xf'));var deskjs=require(_0xdca6('0x10'));var toCsv=require(_0xdca6('0x9'));var querystring=require('querystring');var Papa=require(_0xdca6('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdca6('0x12'));var hardwareService=require(_0xdca6('0x13'));var logger=require(_0xdca6('0x14'))('api');var utils=require(_0xdca6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdca6('0x16'));var db=require(_0xdca6('0x17'))['db'];function respondWithStatusCode(_0x2e40fe,_0x1958e4){_0x1958e4=_0x1958e4||0xcc;return function(_0x5f1b88){if(_0x5f1b88){return _0x2e40fe[_0xdca6('0x18')](_0x1958e4);}return _0x2e40fe[_0xdca6('0x19')](_0x1958e4)[_0xdca6('0x1a')]();};}function respondWithResult(_0x52fca1,_0x3a0fa8){_0x3a0fa8=_0x3a0fa8||0xc8;return function(_0x18f4d5){if(_0x18f4d5){return _0x52fca1['status'](_0x3a0fa8)[_0xdca6('0x1b')](_0x18f4d5);}};}function respondWithFilteredResult(_0x5a0775,_0x4eb4a8){return function(_0x40e6b6){if(_0x40e6b6){var _0x34345e=typeof _0x4eb4a8[_0xdca6('0x1c')]===_0xdca6('0x1d')&&typeof _0x4eb4a8[_0xdca6('0x1e')]===_0xdca6('0x1d');var _0x326031=_0x40e6b6[_0xdca6('0x1f')];var _0x50a954=_0x34345e?0x0:_0x4eb4a8[_0xdca6('0x1c')];var _0x109391=_0x34345e?_0x40e6b6[_0xdca6('0x1f')]:_0x4eb4a8[_0xdca6('0x1c')]+_0x4eb4a8[_0xdca6('0x1e')];var _0x18d0bd;if(_0x109391>=_0x326031){_0x109391=_0x326031;_0x18d0bd=0xc8;}else{_0x18d0bd=0xce;}_0x5a0775[_0xdca6('0x19')](_0x18d0bd);return _0x5a0775[_0xdca6('0x20')](_0xdca6('0x21'),_0x50a954+'-'+_0x109391+'/'+_0x326031)[_0xdca6('0x1b')](_0x40e6b6);}return null;};}function patchUpdates(_0x4fec9b){return function(_0x3876ff){try{jsonpatch[_0xdca6('0x22')](_0x3876ff,_0x4fec9b,!![]);}catch(_0xcfb29c){return BPromise[_0xdca6('0x23')](_0xcfb29c);}return _0x3876ff['save']();};}function saveUpdates(_0x19c54e,_0x30540b){return function(_0x3e7280){if(_0x3e7280){return _0x3e7280[_0xdca6('0x24')](_0x19c54e)['then'](function(_0x3f7870){return _0x3f7870;});}return null;};}function removeEntity(_0x187954,_0x1f6968){return function(_0x4d7fe6){if(_0x4d7fe6){return _0x4d7fe6[_0xdca6('0x25')]()['then'](function(){_0x187954['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e8108,_0x212d36){return function(_0x1bebdb){if(!_0x1bebdb){_0x2e8108['sendStatus'](0x194);}return _0x1bebdb;};}function handleError(_0x372a66,_0x354eaa){_0x354eaa=_0x354eaa||0x1f4;return function(_0x5a7cc0){logger[_0xdca6('0x26')](_0x5a7cc0['stack']);if(_0x5a7cc0[_0xdca6('0x27')]){delete _0x5a7cc0[_0xdca6('0x27')];}_0x372a66[_0xdca6('0x19')](_0x354eaa)['send'](_0x5a7cc0);};}exports['index']=function(_0x4946c7,_0x1bedbd){var _0xd75c8e={},_0x591740={},_0x248f81={'count':0x0,'rows':[]};var _0x3577a1=_['map'](db[_0xdca6('0x28')]['rawAttributes'],function(_0x3d963a){return{'name':_0x3d963a['fieldName'],'type':_0x3d963a['type'][_0xdca6('0x29')]};});_0x591740[_0xdca6('0x2a')]=_[_0xdca6('0x2b')](_0x3577a1,_0xdca6('0x27'));_0x591740[_0xdca6('0x2c')]=_[_0xdca6('0x2d')](_0x4946c7['query']);_0x591740[_0xdca6('0x2e')]=_[_0xdca6('0x2f')](_0x591740[_0xdca6('0x2a')],_0x591740[_0xdca6('0x2c')]);_0xd75c8e[_0xdca6('0x30')]=_['intersection'](_0x591740['model'],qs[_0xdca6('0x31')](_0x4946c7[_0xdca6('0x2c')][_0xdca6('0x31')]));_0xd75c8e['attributes']=_0xd75c8e[_0xdca6('0x30')][_0xdca6('0x32')]?_0xd75c8e[_0xdca6('0x30')]:_0x591740[_0xdca6('0x2a')];if(!_0x4946c7[_0xdca6('0x2c')][_0xdca6('0x33')]('nolimit')){_0xd75c8e['limit']=qs[_0xdca6('0x1e')](_0x4946c7['query'][_0xdca6('0x1e')]);_0xd75c8e[_0xdca6('0x1c')]=qs[_0xdca6('0x1c')](_0x4946c7['query']['offset']);}_0xd75c8e['order']=qs[_0xdca6('0x34')](_0x4946c7[_0xdca6('0x2c')][_0xdca6('0x34')]);_0xd75c8e['where']=qs[_0xdca6('0x2e')](_['pick'](_0x4946c7[_0xdca6('0x2c')],_0x591740['filters']),_0x3577a1);if(_0x4946c7['query'][_0xdca6('0x35')]){_0xd75c8e['where']=_[_0xdca6('0x36')](_0xd75c8e[_0xdca6('0x37')],{'$or':_[_0xdca6('0x2b')](_0x3577a1,function(_0x5ca34e){if(_0x5ca34e[_0xdca6('0x38')]!=='VIRTUAL'){var _0x1b2b19={};_0x1b2b19[_0x5ca34e['name']]={'$like':'%'+_0x4946c7[_0xdca6('0x2c')][_0xdca6('0x35')]+'%'};return _0x1b2b19;}})});}_0xd75c8e=_[_0xdca6('0x36')]({},_0xd75c8e,_0x4946c7['options']);var _0x22056f={'where':_0xd75c8e[_0xdca6('0x37')]};return db[_0xdca6('0x28')][_0xdca6('0x1f')](_0x22056f)[_0xdca6('0x39')](function(_0xc52ff3){_0x248f81['count']=_0xc52ff3;if(_0x4946c7['query'][_0xdca6('0x3a')]){_0xd75c8e[_0xdca6('0x3b')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0xd75c8e);})[_0xdca6('0x39')](function(_0x1d81b8){_0x248f81[_0xdca6('0x3c')]=_0x1d81b8;return _0x248f81;})['then'](respondWithFilteredResult(_0x1bedbd,_0xd75c8e))[_0xdca6('0x3d')](handleError(_0x1bedbd,null));};exports[_0xdca6('0x3e')]=function(_0x4b70d0,_0x15f4be){var _0x870739={'raw':!![],'where':{'id':_0x4b70d0['params']['id']}},_0x70a1c4={};_0x70a1c4['model']=_[_0xdca6('0x2d')](db[_0xdca6('0x28')][_0xdca6('0x3f')]);_0x70a1c4['query']=_['keys'](_0x4b70d0[_0xdca6('0x2c')]);_0x70a1c4[_0xdca6('0x2e')]=_['intersection'](_0x70a1c4[_0xdca6('0x2a')],_0x70a1c4[_0xdca6('0x2c')]);_0x870739[_0xdca6('0x30')]=_[_0xdca6('0x2f')](_0x70a1c4[_0xdca6('0x2a')],qs['fields'](_0x4b70d0[_0xdca6('0x2c')][_0xdca6('0x31')]));_0x870739[_0xdca6('0x30')]=_0x870739[_0xdca6('0x30')][_0xdca6('0x32')]?_0x870739[_0xdca6('0x30')]:_0x70a1c4['model'];if(_0x4b70d0[_0xdca6('0x2c')][_0xdca6('0x3a')]){_0x870739[_0xdca6('0x3b')]=[{'all':!![]}];}_0x870739=_['merge']({},_0x870739,_0x4b70d0[_0xdca6('0x40')]);return db[_0xdca6('0x28')][_0xdca6('0x41')](_0x870739)[_0xdca6('0x39')](handleEntityNotFound(_0x15f4be,null))[_0xdca6('0x39')](respondWithResult(_0x15f4be,null))['catch'](handleError(_0x15f4be,null));};exports['create']=function(_0x1a3bcb,_0x51078f){return db[_0xdca6('0x28')][_0xdca6('0x42')](_0x1a3bcb['body'],{})['then'](respondWithResult(_0x51078f,0xc9))['catch'](handleError(_0x51078f,null));};exports[_0xdca6('0x24')]=function(_0x1db2b2,_0x3b6498){if(_0x1db2b2[_0xdca6('0x43')]['id']){delete _0x1db2b2['body']['id'];}return db[_0xdca6('0x28')][_0xdca6('0x41')]({'where':{'id':_0x1db2b2['params']['id']}})[_0xdca6('0x39')](handleEntityNotFound(_0x3b6498,null))[_0xdca6('0x39')](saveUpdates(_0x1db2b2[_0xdca6('0x43')],null))[_0xdca6('0x39')](respondWithResult(_0x3b6498,null))[_0xdca6('0x3d')](handleError(_0x3b6498,null));};exports[_0xdca6('0x25')]=function(_0x23a3e6,_0x201a74){return db[_0xdca6('0x28')][_0xdca6('0x41')]({'where':{'id':_0x23a3e6['params']['id']}})['then'](handleEntityNotFound(_0x201a74,null))[_0xdca6('0x39')](removeEntity(_0x201a74,null))[_0xdca6('0x3d')](handleError(_0x201a74,null));};exports['describe']=function(_0x682b2c,_0x28d248){return db[_0xdca6('0x28')][_0xdca6('0x44')]()['then'](respondWithResult(_0x28d248,null))[_0xdca6('0x3d')](handleError(_0x28d248,null));};exports[_0xdca6('0x45')]=function(_0x15ea80,_0xe8dce9,_0x2d7329){var _0x3be5a0={'raw':!![],'where':{}};var _0x1f0f17={};var _0x38998b={'count':0x0,'rows':[]};return db[_0xdca6('0x28')][_0xdca6('0x46')]({'where':{'id':_0x15ea80[_0xdca6('0x47')]['id']}})[_0xdca6('0x39')](handleEntityNotFound(_0xe8dce9,null))[_0xdca6('0x39')](function(_0x3e69a1){if(_0x3e69a1){_0x1f0f17[_0xdca6('0x2a')]=_[_0xdca6('0x2d')](db[_0xdca6('0x48')]['rawAttributes']);_0x1f0f17[_0xdca6('0x2c')]=_[_0xdca6('0x2d')](_0x15ea80[_0xdca6('0x2c')]);_0x1f0f17[_0xdca6('0x2e')]=_[_0xdca6('0x2f')](_0x1f0f17[_0xdca6('0x2a')],_0x1f0f17[_0xdca6('0x2c')]);_0x3be5a0[_0xdca6('0x30')]=_[_0xdca6('0x2f')](_0x1f0f17[_0xdca6('0x2a')],qs['fields'](_0x15ea80[_0xdca6('0x2c')]['fields']));_0x3be5a0[_0xdca6('0x30')]=_0x3be5a0['attributes'][_0xdca6('0x32')]?_0x3be5a0['attributes']:_0x1f0f17['model'];if(!_0x15ea80[_0xdca6('0x2c')][_0xdca6('0x33')](_0xdca6('0x49'))){_0x3be5a0[_0xdca6('0x1e')]=qs[_0xdca6('0x1e')](_0x15ea80[_0xdca6('0x2c')][_0xdca6('0x1e')]);_0x3be5a0[_0xdca6('0x1c')]=qs[_0xdca6('0x1c')](_0x15ea80[_0xdca6('0x2c')][_0xdca6('0x1c')]);}_0x3be5a0[_0xdca6('0x4a')]=qs[_0xdca6('0x34')](_0x15ea80[_0xdca6('0x2c')][_0xdca6('0x34')]);_0x3be5a0[_0xdca6('0x37')]=qs[_0xdca6('0x2e')](_[_0xdca6('0x4b')](_0x15ea80['query'],_0x1f0f17[_0xdca6('0x2e')]));_0x3be5a0[_0xdca6('0x37')][_0xdca6('0x4c')]=_0x3e69a1['id'];if(_0x15ea80[_0xdca6('0x2c')][_0xdca6('0x35')]){_0x3be5a0[_0xdca6('0x37')]=_[_0xdca6('0x36')](_0x3be5a0[_0xdca6('0x37')],{'$or':_['map'](_0x3be5a0['attributes'],function(_0x1f2539){var _0x1f17bf={};_0x1f17bf[_0x1f2539]={'$like':'%'+_0x15ea80[_0xdca6('0x2c')][_0xdca6('0x35')]+'%'};return _0x1f17bf;})});}_0x3be5a0=_[_0xdca6('0x36')]({},_0x3be5a0,_0x15ea80[_0xdca6('0x40')]);return db[_0xdca6('0x48')]['count']({'where':_0x3be5a0[_0xdca6('0x37')]})[_0xdca6('0x39')](function(_0x9662c7){_0x38998b[_0xdca6('0x1f')]=_0x9662c7;if(_0x15ea80['query'][_0xdca6('0x3a')]){_0x3be5a0[_0xdca6('0x3b')]=[{'all':!![]}];}return db[_0xdca6('0x48')][_0xdca6('0x4d')](_0x3be5a0);})[_0xdca6('0x39')](function(_0x2bf16f){_0x38998b[_0xdca6('0x3c')]=_0x2bf16f;return _0x38998b;});}})[_0xdca6('0x39')](respondWithFilteredResult(_0xe8dce9,_0x3be5a0))[_0xdca6('0x3d')](handleError(_0xe8dce9,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 77934a0..d950a55 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 _0xc1c6=['moment','request-promise','path','rimraf','exports','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0x1035b7,_0x5c2130){var _0x515cf1=function(_0x501cfe){while(--_0x501cfe){_0x1035b7['push'](_0x1035b7['shift']());}};_0x515cf1(++_0x5c2130);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x3b8a5b,_0x238cb5){_0x3b8a5b=_0x3b8a5b-0x0;var _0x26acb5=_0xc1c6[_0x3b8a5b];return _0x26acb5;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4819=['report_jscripty_sessions','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','JscriptySessionReport'];(function(_0x449123,_0x2696c0){var _0x4151c0=function(_0x5ad137){while(--_0x5ad137){_0x449123['push'](_0x449123['shift']());}};_0x4151c0(++_0x2696c0);}(_0x4819,0xcd));var _0x9481=function(_0x4ef1a9,_0x59a5fa){_0x4ef1a9=_0x4ef1a9-0x0;var _0x23f201=_0x4819[_0x4ef1a9];return _0x23f201;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('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 74323d4..835d1f9 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 _0x7bd0=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7bd0,0x111));var _0x07bd=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0x7bd0[_0x22b68a];return _0x1ac67a;};'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});function respondWithRpcPromise(_0x422a22,_0x2e4cd1,_0x5a939d){return new BPromise(function(_0x3968d9,_0x5cd446){return client[_0x07bd('0xd')](_0x422a22,_0x5a939d)[_0x07bd('0xe')](function(_0x323724){logger['info'](_0x07bd('0xf'),_0x2e4cd1,_0x07bd('0x10'));logger[_0x07bd('0x11')](_0x07bd('0x12'),_0x2e4cd1,'request\x20sent',JSON[_0x07bd('0x13')](_0x323724));if(_0x323724[_0x07bd('0x14')]){if(_0x323724[_0x07bd('0x14')][_0x07bd('0x15')]===0x1f4){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x5cd446(_0x323724['error']['message']);}logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x3968d9(_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);}else{logger[_0x07bd('0x17')]('JscriptySessionReport,\x20%s,\x20%s',_0x2e4cd1,_0x07bd('0x10'));_0x3968d9(_0x323724['result'][_0x07bd('0x16')]);}})[_0x07bd('0x18')](function(_0x31655a){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x31655a);_0x5cd446(_0x31655a);});});} \ No newline at end of file +var _0xd117=['request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','debug','stringify','code','error','message'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xd117,0x182));var _0x7d11=function(_0x40f9a0,_0x3458cc){_0x40f9a0=_0x40f9a0-0x0;var _0x3e3144=_0xd117[_0x40f9a0];return _0x3e3144;};'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')]('JscriptySessionReport,\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);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 48a22b8..8e86566 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 _0x22bd=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports'];(function(_0x543724,_0x3c2574){var _0x1d88ff=function(_0x43b505){while(--_0x43b505){_0x543724['push'](_0x543724['shift']());}};_0x1d88ff(++_0x3c2574);}(_0x22bd,0xd0));var _0xd22b=function(_0x319ecd,_0x48625f){_0x319ecd=_0x319ecd-0x0;var _0x3ee126=_0x22bd[_0x319ecd];return _0x3ee126;};'use strict';var multer=require('multer');var util=require(_0xd22b('0x0'));var path=require(_0xd22b('0x1'));var timeout=require(_0xd22b('0x2'));var express=require(_0xd22b('0x3'));var router=express['Router']();var fs_extra=require(_0xd22b('0x4'));var auth=require(_0xd22b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd22b('0x6'));var controller=require('./license.controller');router[_0xd22b('0x7')]('/',controller[_0xd22b('0x8')]);router[_0xd22b('0x9')](_0xd22b('0xa'),auth[_0xd22b('0xb')](),controller[_0xd22b('0xc')]);router[_0xd22b('0x7')](_0xd22b('0xd'),auth[_0xd22b('0xb')](),controller[_0xd22b('0xe')]);module[_0xd22b('0xf')]=router; \ No newline at end of file +var _0x6511=['./license.controller','get','index','put','/:id','isAuthenticated','update','downloadLogFile','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0x6511,0x8f));var _0x1651=function(_0x416a0a,_0x24f91f){_0x416a0a=_0x416a0a-0x0;var _0x574c9f=_0x6511[_0x416a0a];return _0x574c9f;};'use strict';var multer=require(_0x1651('0x0'));var util=require(_0x1651('0x1'));var path=require('path');var timeout=require(_0x1651('0x2'));var express=require(_0x1651('0x3'));var router=express[_0x1651('0x4')]();var fs_extra=require(_0x1651('0x5'));var auth=require(_0x1651('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1651('0x7'));router[_0x1651('0x8')]('/',controller[_0x1651('0x9')]);router[_0x1651('0xa')](_0x1651('0xb'),auth[_0x1651('0xc')](),controller[_0x1651('0xd')]);router[_0x1651('0x8')]('/download_log_file',auth[_0x1651('0xc')](),controller[_0x1651('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 450a773..f343d0a 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 _0xb5ef=['INTEGER','TEXT','STRING'];(function(_0xaf3df5,_0x39ca16){var _0x3c199b=function(_0x4b41d4){while(--_0x4b41d4){_0xaf3df5['push'](_0xaf3df5['shift']());}};_0x3c199b(++_0x39ca16);}(_0xb5ef,0x18a));var _0xfb5e=function(_0x1f5261,_0x400d29){_0x1f5261=_0x1f5261-0x0;var _0x4be286=_0xb5ef[_0x1f5261];return _0x4be286;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize[_0xfb5e('0x0')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xfb5e('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0xfb5e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0a9a=['sequelize','STRING','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0a9a,0x132));var _0xa0a9=function(_0x257949,_0xe7dc53){_0x257949=_0x257949-0x0;var _0x112383=_0x0a9a[_0x257949];return _0x112383;};'use strict';var Sequelize=require(_0xa0a9('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xa0a9('0x1')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xa0a9('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 7dc7a06..d6e1008 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 _0x0807=['rawAttributes','keys','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','get','checkLicense','key','demo','downloadLogFile','join','/var','xcally','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','model','License'];(function(_0x504c79,_0x196ccc){var _0x31d4a9=function(_0x4443cf){while(--_0x4443cf){_0x504c79['push'](_0x504c79['shift']());}};_0x31d4a9(++_0x196ccc);}(_0x0807,0x1b5));var _0x7080=function(_0x1c853b,_0x2f0460){_0x1c853b=_0x1c853b-0x0;var _0x44ee2c=_0x0807[_0x1c853b];return _0x44ee2c;};'use strict';var emlformat=require(_0x7080('0x0'));var rimraf=require(_0x7080('0x1'));var zipdir=require(_0x7080('0x2'));var jsonpatch=require(_0x7080('0x3'));var rp=require(_0x7080('0x4'));var moment=require(_0x7080('0x5'));var BPromise=require(_0x7080('0x6'));var Mustache=require(_0x7080('0x7'));var util=require('util');var path=require(_0x7080('0x8'));var sox=require('sox');var csv=require(_0x7080('0x9'));var ejs=require(_0x7080('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7080('0xb'));var squel=require('squel');var crypto=require(_0x7080('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7080('0xd'));var toCsv=require(_0x7080('0x9'));var querystring=require(_0x7080('0xe'));var Papa=require(_0x7080('0xf'));var Redis=require(_0x7080('0x10'));var authService=require(_0x7080('0x11'));var qs=require(_0x7080('0x12'));var as=require(_0x7080('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7080('0x14'));var utils=require(_0x7080('0x15'));var config=require(_0x7080('0x16'));var licenseUtil=require(_0x7080('0x17'));var db=require(_0x7080('0x18'))['db'];function respondWithStatusCode(_0x544210,_0x1dc4e8){_0x1dc4e8=_0x1dc4e8||0xcc;return function(_0x42197c){if(_0x42197c){return _0x544210['sendStatus'](_0x1dc4e8);}return _0x544210[_0x7080('0x19')](_0x1dc4e8)[_0x7080('0x1a')]();};}function respondWithResult(_0x1348ea,_0x2997e4){_0x2997e4=_0x2997e4||0xc8;return function(_0x3af8b6){if(_0x3af8b6){return _0x1348ea[_0x7080('0x19')](_0x2997e4)[_0x7080('0x1b')](_0x3af8b6);}};}function respondWithFilteredResult(_0x1ac249,_0x51664b){return function(_0xfc2110){if(_0xfc2110){var _0x160ffa=typeof _0x51664b[_0x7080('0x1c')]===_0x7080('0x1d')&&typeof _0x51664b[_0x7080('0x1e')]===_0x7080('0x1d');var _0x29aac1=_0xfc2110['count'];var _0x9bf602=_0x160ffa?0x0:_0x51664b[_0x7080('0x1c')];var _0x12d01b=_0x160ffa?_0xfc2110[_0x7080('0x1f')]:_0x51664b[_0x7080('0x1c')]+_0x51664b[_0x7080('0x1e')];var _0x4a3121;if(_0x12d01b>=_0x29aac1){_0x12d01b=_0x29aac1;_0x4a3121=0xc8;}else{_0x4a3121=0xce;}_0x1ac249[_0x7080('0x19')](_0x4a3121);return _0x1ac249[_0x7080('0x20')](_0x7080('0x21'),_0x9bf602+'-'+_0x12d01b+'/'+_0x29aac1)[_0x7080('0x1b')](_0xfc2110);}return null;};}function patchUpdates(_0x3a447b){return function(_0x158b20){try{jsonpatch['apply'](_0x158b20,_0x3a447b,!![]);}catch(_0x10e1c0){return BPromise[_0x7080('0x22')](_0x10e1c0);}return _0x158b20[_0x7080('0x23')]();};}function saveUpdates(_0x154f72,_0x2f57cb){return function(_0x56935d){if(_0x56935d){return _0x56935d[_0x7080('0x24')](_0x154f72)[_0x7080('0x25')](function(_0x3cd1dc){return _0x3cd1dc;});}return null;};}function removeEntity(_0x5eb3a6,_0x47a056){return function(_0x1d54b1){if(_0x1d54b1){return _0x1d54b1[_0x7080('0x26')]()[_0x7080('0x25')](function(){_0x5eb3a6[_0x7080('0x19')](0xcc)[_0x7080('0x1a')]();});}};}function handleEntityNotFound(_0x593399,_0x2f2f65){return function(_0x143659){if(!_0x143659){_0x593399[_0x7080('0x27')](0x194);}return _0x143659;};}function handleError(_0x5b441c,_0x5dad76){_0x5dad76=_0x5dad76||0x1f4;return function(_0x45d30d){logger[_0x7080('0x28')](_0x45d30d[_0x7080('0x29')]);if(_0x45d30d[_0x7080('0x2a')]){delete _0x45d30d[_0x7080('0x2a')];}_0x5b441c[_0x7080('0x19')](_0x5dad76)['send'](_0x45d30d);};}var utilLicense=require(_0x7080('0x17'));exports[_0x7080('0x2b')]=function(_0x3f3dcb,_0x294aef){var _0x4487c0={'raw':!![],'where':{'id':0x1}},_0x59e54e={};_0x59e54e[_0x7080('0x2c')]=_['keys'](db[_0x7080('0x2d')][_0x7080('0x2e')]);_0x59e54e['query']=_[_0x7080('0x2f')](_0x3f3dcb[_0x7080('0x30')]);_0x59e54e[_0x7080('0x31')]=_[_0x7080('0x32')](_0x59e54e[_0x7080('0x2c')],_0x59e54e[_0x7080('0x30')]);_0x4487c0[_0x7080('0x33')]=_[_0x7080('0x32')](_0x59e54e['model'],qs['fields'](_0x3f3dcb[_0x7080('0x30')][_0x7080('0x34')]));_0x4487c0['attributes']=_0x4487c0[_0x7080('0x33')][_0x7080('0x35')]?_0x4487c0['attributes']:_0x59e54e[_0x7080('0x2c')];_0x4487c0=_[_0x7080('0x36')]({},_0x4487c0,_0x3f3dcb[_0x7080('0x37')]);return utilLicense[_0x7080('0x38')](_0x4487c0)[_0x7080('0x25')](respondWithResult(_0x294aef,null))[_0x7080('0x39')](handleError(_0x294aef,null));};exports[_0x7080('0x24')]=function(_0x10c259,_0x23d6d9){if(_0x10c259[_0x7080('0x3a')]['id']){delete _0x10c259['body']['id'];}return db[_0x7080('0x2d')][_0x7080('0x3b')]({'where':{'id':_0x10c259['params']['id']}})[_0x7080('0x25')](handleEntityNotFound(_0x23d6d9,null))['then'](function(_0x33d8c5){var _0x56477e=_0x33d8c5[_0x7080('0x3c')]({'plain':!![]});return utilLicense[_0x7080('0x3d')](_0x56477e,_0x10c259[_0x7080('0x3a')][_0x7080('0x3e')]);})['then'](function(_0x1d9f85){if(!_0x1d9f85[_0x7080('0x3f')]){return saveUpdates(_0x10c259['body'],null);}return _0x1d9f85;})[_0x7080('0x25')](respondWithResult(_0x23d6d9,null))[_0x7080('0x39')](handleError(_0x23d6d9,null));};exports[_0x7080('0x40')]=function(_0x4ea4f5,_0x35542b){var _0x812c82='license-info.log';var _0x3c357f=path[_0x7080('0x41')](_0x7080('0x42'),'log',_0x7080('0x43'),_0x812c82);_0x35542b['setHeader']('Content-disposition','attachment;\x20filename='+_0x812c82);_0x35542b['set']('Content-Type',_0x7080('0x44'));_0x35542b['download'](_0x3c357f);}; \ No newline at end of file +var _0x2c57=['../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','name','send','model','keys','License','query','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','then','get','checkLicense','key','downloadLogFile','license-info.log','join','/var','log','xcally','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0xb48df0,_0x138d5b){var _0x2a60df=function(_0xd222ed){while(--_0xd222ed){_0xb48df0['push'](_0xb48df0['shift']());}};_0x2a60df(++_0x138d5b);}(_0x2c57,0x75));var _0x72c5=function(_0x30565c,_0x14dbf2){_0x30565c=_0x30565c-0x0;var _0x55e4b7=_0x2c57[_0x30565c];return _0x55e4b7;};'use strict';var emlformat=require(_0x72c5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x72c5('0x1'));var rp=require('request-promise');var moment=require(_0x72c5('0x2'));var BPromise=require(_0x72c5('0x3'));var Mustache=require('mustache');var util=require(_0x72c5('0x4'));var path=require(_0x72c5('0x5'));var sox=require('sox');var csv=require(_0x72c5('0x6'));var ejs=require(_0x72c5('0x7'));var fs=require('fs');var fs_extra=require(_0x72c5('0x8'));var _=require('lodash');var squel=require(_0x72c5('0x9'));var crypto=require(_0x72c5('0xa'));var jsforce=require(_0x72c5('0xb'));var deskjs=require(_0x72c5('0xc'));var toCsv=require(_0x72c5('0x6'));var querystring=require(_0x72c5('0xd'));var Papa=require(_0x72c5('0xe'));var Redis=require(_0x72c5('0xf'));var authService=require(_0x72c5('0x10'));var qs=require(_0x72c5('0x11'));var as=require(_0x72c5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x72c5('0x13'));var utils=require(_0x72c5('0x14'));var config=require(_0x72c5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x72c5('0x16'))['db'];function respondWithStatusCode(_0x5b788d,_0x51a09b){_0x51a09b=_0x51a09b||0xcc;return function(_0x450593){if(_0x450593){return _0x5b788d[_0x72c5('0x17')](_0x51a09b);}return _0x5b788d[_0x72c5('0x18')](_0x51a09b)[_0x72c5('0x19')]();};}function respondWithResult(_0x307f6,_0xc312bb){_0xc312bb=_0xc312bb||0xc8;return function(_0x1e2b21){if(_0x1e2b21){return _0x307f6['status'](_0xc312bb)['json'](_0x1e2b21);}};}function respondWithFilteredResult(_0x1721ec,_0x15200){return function(_0x1114b6){if(_0x1114b6){var _0x54eaf2=typeof _0x15200[_0x72c5('0x1a')]===_0x72c5('0x1b')&&typeof _0x15200[_0x72c5('0x1c')]===_0x72c5('0x1b');var _0x155778=_0x1114b6[_0x72c5('0x1d')];var _0x7b40b=_0x54eaf2?0x0:_0x15200['offset'];var _0x45688f=_0x54eaf2?_0x1114b6['count']:_0x15200[_0x72c5('0x1a')]+_0x15200[_0x72c5('0x1c')];var _0x51fc07;if(_0x45688f>=_0x155778){_0x45688f=_0x155778;_0x51fc07=0xc8;}else{_0x51fc07=0xce;}_0x1721ec[_0x72c5('0x18')](_0x51fc07);return _0x1721ec[_0x72c5('0x1e')](_0x72c5('0x1f'),_0x7b40b+'-'+_0x45688f+'/'+_0x155778)[_0x72c5('0x20')](_0x1114b6);}return null;};}function patchUpdates(_0xc66c60){return function(_0x1ca15){try{jsonpatch[_0x72c5('0x21')](_0x1ca15,_0xc66c60,!![]);}catch(_0x32a4ce){return BPromise[_0x72c5('0x22')](_0x32a4ce);}return _0x1ca15[_0x72c5('0x23')]();};}function saveUpdates(_0x31d83f,_0x23b795){return function(_0x117f8a){if(_0x117f8a){return _0x117f8a[_0x72c5('0x24')](_0x31d83f)['then'](function(_0xcb86e7){return _0xcb86e7;});}return null;};}function removeEntity(_0xa40022,_0x1d3dc8){return function(_0x2191c5){if(_0x2191c5){return _0x2191c5[_0x72c5('0x25')]()['then'](function(){_0xa40022[_0x72c5('0x18')](0xcc)[_0x72c5('0x19')]();});}};}function handleEntityNotFound(_0x30c91a,_0x35cd1b){return function(_0x1ea7b3){if(!_0x1ea7b3){_0x30c91a[_0x72c5('0x17')](0x194);}return _0x1ea7b3;};}function handleError(_0x523f56,_0x39c5dd){_0x39c5dd=_0x39c5dd||0x1f4;return function(_0x361284){logger['error'](_0x361284['stack']);if(_0x361284[_0x72c5('0x26')]){delete _0x361284['name'];}_0x523f56[_0x72c5('0x18')](_0x39c5dd)[_0x72c5('0x27')](_0x361284);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0x22b2a6,_0x535a57){var _0x59370e={'raw':!![],'where':{'id':0x1}},_0x33fb02={};_0x33fb02[_0x72c5('0x28')]=_[_0x72c5('0x29')](db[_0x72c5('0x2a')]['rawAttributes']);_0x33fb02['query']=_[_0x72c5('0x29')](_0x22b2a6[_0x72c5('0x2b')]);_0x33fb02['filters']=_[_0x72c5('0x2c')](_0x33fb02['model'],_0x33fb02['query']);_0x59370e[_0x72c5('0x2d')]=_[_0x72c5('0x2c')](_0x33fb02[_0x72c5('0x28')],qs[_0x72c5('0x2e')](_0x22b2a6[_0x72c5('0x2b')][_0x72c5('0x2e')]));_0x59370e['attributes']=_0x59370e[_0x72c5('0x2d')][_0x72c5('0x2f')]?_0x59370e['attributes']:_0x33fb02[_0x72c5('0x28')];_0x59370e=_[_0x72c5('0x30')]({},_0x59370e,_0x22b2a6[_0x72c5('0x31')]);return utilLicense[_0x72c5('0x32')](_0x59370e)['then'](respondWithResult(_0x535a57,null))[_0x72c5('0x33')](handleError(_0x535a57,null));};exports['update']=function(_0x5ec4e3,_0x46d034){if(_0x5ec4e3['body']['id']){delete _0x5ec4e3[_0x72c5('0x34')]['id'];}return db[_0x72c5('0x2a')][_0x72c5('0x35')]({'where':{'id':_0x5ec4e3['params']['id']}})[_0x72c5('0x36')](handleEntityNotFound(_0x46d034,null))[_0x72c5('0x36')](function(_0x3606fd){var _0x12517d=_0x3606fd[_0x72c5('0x37')]({'plain':!![]});return utilLicense[_0x72c5('0x38')](_0x12517d,_0x5ec4e3['body'][_0x72c5('0x39')]);})[_0x72c5('0x36')](function(_0x13cfb5){if(!_0x13cfb5['demo']){return saveUpdates(_0x5ec4e3['body'],null);}return _0x13cfb5;})['then'](respondWithResult(_0x46d034,null))[_0x72c5('0x33')](handleError(_0x46d034,null));};exports[_0x72c5('0x3a')]=function(_0x18898b,_0xd2b454){var _0x22212b=_0x72c5('0x3b');var _0x2b732c=path[_0x72c5('0x3c')](_0x72c5('0x3d'),_0x72c5('0x3e'),_0x72c5('0x3f'),_0x22212b);_0xd2b454['setHeader'](_0x72c5('0x40'),_0x72c5('0x41')+_0x22212b);_0xd2b454[_0x72c5('0x1e')](_0x72c5('0x42'),_0x72c5('0x43'));_0xd2b454[_0x72c5('0x44')](_0x2b732c);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index fa27243..8b4e695 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 _0x652a=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','License','license','lodash','util'];(function(_0x2063ba,_0x342f8a){var _0x2b09e6=function(_0x422517){while(--_0x422517){_0x2063ba['push'](_0x2063ba['shift']());}};_0x2b09e6(++_0x342f8a);}(_0x652a,0x177));var _0xa652=function(_0x1608e0,_0x21f28c){_0x1608e0=_0x1608e0-0x0;var _0x4cbfdd=_0x652a[_0x1608e0];return _0x4cbfdd;};'use strict';var _=require(_0xa652('0x0'));var util=require(_0xa652('0x1'));var logger=require(_0xa652('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa652('0x3'));var rp=require(_0xa652('0x4'));var fs=require('fs');var path=require(_0xa652('0x5'));var rimraf=require(_0xa652('0x6'));var config=require(_0xa652('0x7'));var attributes=require(_0xa652('0x8'));module[_0xa652('0x9')]=function(_0x284536,_0xc165e4){return _0x284536[_0xa652('0xa')](_0xa652('0xb'),attributes,{'tableName':_0xa652('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bdb=['bluebird','request-promise','../../config/environment','exports','define','License','license','api'];(function(_0x371c6d,_0xb66639){var _0x40e38f=function(_0x2ba5ff){while(--_0x2ba5ff){_0x371c6d['push'](_0x371c6d['shift']());}};_0x40e38f(++_0xb66639);}(_0x7bdb,0x11f));var _0xb7bd=function(_0x562ec2,_0x33932b){_0x562ec2=_0x562ec2-0x0;var _0xd3a205=_0x7bdb[_0x562ec2];return _0xd3a205;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb7bd('0x0'));var moment=require('moment');var BPromise=require(_0xb7bd('0x1'));var rp=require(_0xb7bd('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb7bd('0x3'));var attributes=require('./license.attributes');module[_0xb7bd('0x4')]=function(_0x44766e,_0x3b8ec6){return _0x44766e[_0xb7bd('0x5')](_0xb7bd('0x6'),attributes,{'tableName':_0xb7bd('0x7'),'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 eab3088..04889ba 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 _0x6697=['error','code','License,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3592ab,_0x4f669a){var _0x13298a=function(_0x25f018){while(--_0x25f018){_0x3592ab['push'](_0x3592ab['shift']());}};_0x13298a(++_0x4f669a);}(_0x6697,0xae));var _0x7669=function(_0x59b27d,_0x5046e3){_0x59b27d=_0x59b27d-0x0;var _0x3f5a08=_0x6697[_0x59b27d];return _0x3f5a08;};'use strict';var _=require(_0x7669('0x0'));var util=require(_0x7669('0x1'));var moment=require('moment');var BPromise=require(_0x7669('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7669('0x3'));var db=require(_0x7669('0x4'))['db'];var utils=require(_0x7669('0x5'));var logger=require(_0x7669('0x6'))(_0x7669('0x7'));var config=require(_0x7669('0x8'));var jayson=require(_0x7669('0x9'));var client=jayson[_0x7669('0xa')][_0x7669('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x101a1e,_0x321cb9,_0x4deb1d){return new BPromise(function(_0x457572,_0x1334c3){return client[_0x7669('0xc')](_0x101a1e,_0x4deb1d)[_0x7669('0xd')](function(_0x2eff14){logger['info']('License,\x20%s,\x20%s',_0x321cb9,_0x7669('0xe'));logger[_0x7669('0xf')](_0x7669('0x10'),_0x321cb9,_0x7669('0xe'),JSON[_0x7669('0x11')](_0x2eff14));if(_0x2eff14[_0x7669('0x12')]){if(_0x2eff14[_0x7669('0x12')][_0x7669('0x13')]===0x1f4){logger[_0x7669('0x12')](_0x7669('0x14'),_0x321cb9,_0x2eff14['error']['message']);return _0x1334c3(_0x2eff14[_0x7669('0x12')][_0x7669('0x15')]);}logger[_0x7669('0x12')]('License,\x20%s,\x20%s',_0x321cb9,_0x2eff14[_0x7669('0x12')][_0x7669('0x15')]);return _0x457572(_0x2eff14[_0x7669('0x12')][_0x7669('0x15')]);}else{logger['info'](_0x7669('0x14'),_0x321cb9,_0x7669('0xe'));_0x457572(_0x2eff14[_0x7669('0x16')][_0x7669('0x15')]);}})[_0x7669('0x17')](function(_0x5b84e6){logger[_0x7669('0x12')](_0x7669('0x14'),_0x321cb9,_0x5b84e6);_0x1334c3(_0x5b84e6);});});} \ No newline at end of file +var _0x81bd=['License,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error'];(function(_0x2e66a5,_0x24eed5){var _0x461b23=function(_0x18095f){while(--_0x18095f){_0x2e66a5['push'](_0x2e66a5['shift']());}};_0x461b23(++_0x24eed5);}(_0x81bd,0x1bd));var _0xd81b=function(_0x64a51,_0x1c61b7){_0x64a51=_0x64a51-0x0;var _0x1eba45=_0x81bd[_0x64a51];return _0x1eba45;};'use strict';var _=require('lodash');var util=require(_0xd81b('0x0'));var moment=require(_0xd81b('0x1'));var BPromise=require(_0xd81b('0x2'));var rs=require(_0xd81b('0x3'));var fs=require('fs');var Redis=require(_0xd81b('0x4'));var db=require(_0xd81b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x6'))(_0xd81b('0x7'));var config=require('../../config/environment');var jayson=require(_0xd81b('0x8'));var client=jayson[_0xd81b('0x9')][_0xd81b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a50b6,_0x4f8b79,_0x64a536){return new BPromise(function(_0x2c7283,_0x51f4f5){return client[_0xd81b('0xb')](_0x2a50b6,_0x64a536)[_0xd81b('0xc')](function(_0x501589){logger['info']('License,\x20%s,\x20%s',_0x4f8b79,_0xd81b('0xd'));logger[_0xd81b('0xe')](_0xd81b('0xf'),_0x4f8b79,_0xd81b('0xd'),JSON['stringify'](_0x501589));if(_0x501589['error']){if(_0x501589[_0xd81b('0x10')]['code']===0x1f4){logger[_0xd81b('0x10')](_0xd81b('0x11'),_0x4f8b79,_0x501589['error']['message']);return _0x51f4f5(_0x501589[_0xd81b('0x10')][_0xd81b('0x12')]);}logger[_0xd81b('0x10')](_0xd81b('0x11'),_0x4f8b79,_0x501589[_0xd81b('0x10')][_0xd81b('0x12')]);return _0x2c7283(_0x501589[_0xd81b('0x10')]['message']);}else{logger['info'](_0xd81b('0x11'),_0x4f8b79,_0xd81b('0xd'));_0x2c7283(_0x501589[_0xd81b('0x13')]['message']);}})[_0xd81b('0x14')](function(_0x4df1a0){logger['error']('License,\x20%s,\x20%s',_0x4f8b79,_0x4df1a0);_0x51f4f5(_0x4df1a0);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 6a81bd9..a09c4ec 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 _0x7fb7=['getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','post','addAnswer','create','addSmtp','addInteraction','/:id/applications','addApplications','/:id/send','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','removeImap','destroy','removeAgents','exports','multer','util','connect-timeout','Router','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions'];(function(_0x318e60,_0x493627){var _0xafcfdd=function(_0x4db025){while(--_0x4db025){_0x318e60['push'](_0x318e60['shift']());}};_0xafcfdd(++_0x493627);}(_0x7fb7,0x191));var _0x77fb=function(_0x1b25c1,_0x2c6ce6){_0x1b25c1=_0x1b25c1-0x0;var _0x1e4447=_0x7fb7[_0x1b25c1];return _0x1e4447;};'use strict';var multer=require(_0x77fb('0x0'));var util=require(_0x77fb('0x1'));var path=require('path');var timeout=require(_0x77fb('0x2'));var express=require('express');var router=express[_0x77fb('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x77fb('0x4'));var controller=require(_0x77fb('0x5'));router[_0x77fb('0x6')]('/',auth[_0x77fb('0x7')](),controller[_0x77fb('0x8')]);router['get'](_0x77fb('0x9'),auth[_0x77fb('0x7')](),controller[_0x77fb('0xa')]);router[_0x77fb('0x6')]('/:id',auth[_0x77fb('0x7')](),controller[_0x77fb('0xb')]);router[_0x77fb('0x6')](_0x77fb('0xc'),auth[_0x77fb('0x7')](),controller[_0x77fb('0xd')]);router[_0x77fb('0x6')](_0x77fb('0xe'),auth[_0x77fb('0x7')](),controller[_0x77fb('0xf')]);router[_0x77fb('0x6')](_0x77fb('0x10'),auth[_0x77fb('0x7')](),controller[_0x77fb('0x11')]);router['get'](_0x77fb('0x12'),auth[_0x77fb('0x7')](),controller[_0x77fb('0x13')]);router[_0x77fb('0x6')](_0x77fb('0x14'),auth[_0x77fb('0x7')](),controller[_0x77fb('0x15')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller[_0x77fb('0x16')]);router[_0x77fb('0x6')](_0x77fb('0x17'),auth[_0x77fb('0x7')](),controller[_0x77fb('0x18')]);router[_0x77fb('0x6')]('/:id/verify',auth[_0x77fb('0x7')](),controller[_0x77fb('0x19')]);router[_0x77fb('0x6')](_0x77fb('0x1a'),auth[_0x77fb('0x7')](),controller['getAgents']);router[_0x77fb('0x1b')](_0x77fb('0xc'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x77fb('0x1b')](_0x77fb('0xe'),auth[_0x77fb('0x7')](),controller[_0x77fb('0x1c')]);router[_0x77fb('0x1b')]('/',auth['isAuthenticated'](),controller[_0x77fb('0x1d')]);router[_0x77fb('0x1b')](_0x77fb('0x10'),auth[_0x77fb('0x7')](),controller['addImap']);router['post'](_0x77fb('0x12'),auth[_0x77fb('0x7')](),controller[_0x77fb('0x1e')]);router[_0x77fb('0x1b')](_0x77fb('0x14'),auth['isAuthenticated'](),controller[_0x77fb('0x1f')]);router[_0x77fb('0x1b')](_0x77fb('0x20'),auth[_0x77fb('0x7')](),controller[_0x77fb('0x21')]);router[_0x77fb('0x1b')](_0x77fb('0x22'),auth[_0x77fb('0x7')](),controller['send']);router['post'](_0x77fb('0x1a'),auth[_0x77fb('0x7')](),controller[_0x77fb('0x23')]);router[_0x77fb('0x24')](_0x77fb('0x25'),auth[_0x77fb('0x7')](),controller[_0x77fb('0x26')]);router[_0x77fb('0x27')](_0x77fb('0xc'),auth[_0x77fb('0x7')](),controller[_0x77fb('0x28')]);router[_0x77fb('0x27')](_0x77fb('0xe'),auth[_0x77fb('0x7')](),controller[_0x77fb('0x29')]);router[_0x77fb('0x27')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x77fb('0x2a')]);router[_0x77fb('0x27')](_0x77fb('0x12'),auth[_0x77fb('0x7')](),controller['removeSmtp']);router['delete'](_0x77fb('0x25'),auth[_0x77fb('0x7')](),controller[_0x77fb('0x2b')]);router[_0x77fb('0x27')](_0x77fb('0x1a'),auth[_0x77fb('0x7')](),controller[_0x77fb('0x2c')]);module[_0x77fb('0x2d')]=router; \ No newline at end of file +var _0x1a4e=['getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages'];(function(_0x5d1044,_0x18f656){var _0x3cd90e=function(_0x3c40be){while(--_0x3c40be){_0x5d1044['push'](_0x5d1044['shift']());}};_0x3cd90e(++_0x18f656);}(_0x1a4e,0x1ac));var _0xe1a4=function(_0xb36ccf,_0x24c93b){_0xb36ccf=_0xb36ccf-0x0;var _0x37b01e=_0x1a4e[_0xb36ccf];return _0x37b01e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe1a4('0x0'));var timeout=require(_0xe1a4('0x1'));var express=require('express');var router=express[_0xe1a4('0x2')]();var fs_extra=require(_0xe1a4('0x3'));var auth=require(_0xe1a4('0x4'));var interaction=require(_0xe1a4('0x5'));var config=require(_0xe1a4('0x6'));var controller=require('./mailAccount.controller');router['get']('/',auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x8')]);router[_0xe1a4('0x9')]('/describe',auth[_0xe1a4('0x7')](),controller[_0xe1a4('0xa')]);router['get'](_0xe1a4('0xb'),auth[_0xe1a4('0x7')](),controller['show']);router[_0xe1a4('0x9')](_0xe1a4('0xc'),auth[_0xe1a4('0x7')](),controller['getDispositions']);router[_0xe1a4('0x9')](_0xe1a4('0xd'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0xe')]);router['get'](_0xe1a4('0xf'),auth[_0xe1a4('0x7')](),controller['getImap']);router[_0xe1a4('0x9')](_0xe1a4('0x10'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x11')]);router['get'](_0xe1a4('0x12'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x13')]);router[_0xe1a4('0x9')]('/:id/applications',auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x14')]);router[_0xe1a4('0x9')](_0xe1a4('0x15'),auth['isAuthenticated'](),controller[_0xe1a4('0x16')]);router['get'](_0xe1a4('0x17'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x18')]);router[_0xe1a4('0x9')](_0xe1a4('0x19'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x1a')]);router[_0xe1a4('0x1b')]('/:id/dispositions',auth[_0xe1a4('0x7')](),controller['addDisposition']);router['post'](_0xe1a4('0xd'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x1c')]);router[_0xe1a4('0x1b')]('/',auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x1d')]);router['post'](_0xe1a4('0xf'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x1e')]);router[_0xe1a4('0x1b')](_0xe1a4('0x10'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x1f')]);router['post']('/:id/interactions',auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x20')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xe1a4('0x21')]);router[_0xe1a4('0x1b')]('/:id/send',auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x22')]);router['post'](_0xe1a4('0x19'),auth['isAuthenticated'](),controller[_0xe1a4('0x23')]);router[_0xe1a4('0x24')](_0xe1a4('0xb'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x25')]);router[_0xe1a4('0x26')](_0xe1a4('0xc'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x27')]);router['delete'](_0xe1a4('0xd'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x28')]);router[_0xe1a4('0x26')](_0xe1a4('0xf'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x29')]);router[_0xe1a4('0x26')](_0xe1a4('0x10'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x2a')]);router[_0xe1a4('0x26')]('/:id',auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x2b')]);router[_0xe1a4('0x26')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xe1a4('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 332fe6d..a441831 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 _0x4305=['INTEGER','UNSIGNED','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','ENUM','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif'];(function(_0x5aa572,_0x4a47fd){var _0x145cfb=function(_0x4bbad5){while(--_0x4bbad5){_0x5aa572['push'](_0x5aa572['shift']());}};_0x145cfb(++_0x4a47fd);}(_0x4305,0x181));var _0x5430=function(_0x4dbf11,_0x36a91f){_0x4dbf11=_0x4dbf11-0x0;var _0x571bf9=_0x4305[_0x4dbf11];return _0x571bf9;};'use strict';var Sequelize=require(_0x5430('0x0'));module[_0x5430('0x1')]={'description':{'type':Sequelize[_0x5430('0x2')]},'name':{'type':Sequelize[_0x5430('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x5430('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x5430('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x5430('0x4')]},'markAsUnread':{'type':Sequelize[_0x5430('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x5430('0x2')],'allowNull':![],'defaultValue':_0x5430('0x5')},'fontSize':{'type':Sequelize[_0x5430('0x6')](0x2)[_0x5430('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x5430('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x5430('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5430('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5430('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5430('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5430('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5430('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5430('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5430('0x3')],'defaultValue':![],'comment':_0x5430('0x8'),'set':function(_0x4da5fe){if(!_0x4da5fe)this[_0x5430('0x9')](_0x5430('0xa'),null);this['setDataValue']('mandatoryDisposition',_0x4da5fe);}},'provider':{'type':Sequelize[_0x5430('0xb')]('gmail','hotmail',_0x5430('0xc'),_0x5430('0xd')),'defaultValue':null,'get':function(){if(!this[_0x5430('0xe')](_0x5430('0xf')))return _0x5430('0x10');return this['getDataValue']('provider');},'set':function(_0x1d6f50){if(_0x1d6f50===_0x5430('0x10'))_0x1d6f50=null;return this[_0x5430('0x9')](_0x5430('0xf'),_0x1d6f50);}}}; \ No newline at end of file +var _0x8e8e=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','hotmail','yahoo','outlook365','provider','custom','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED'];(function(_0x22c174,_0x241161){var _0x4ae0ec=function(_0x3beeeb){while(--_0x3beeeb){_0x22c174['push'](_0x22c174['shift']());}};_0x4ae0ec(++_0x241161);}(_0x8e8e,0xdd));var _0xe8e8=function(_0x239f30,_0x4dbad1){_0x239f30=_0x239f30-0x0;var _0x575926=_0x8e8e[_0x239f30];return _0x575926;};'use strict';var Sequelize=require('sequelize');module[_0xe8e8('0x0')]={'description':{'type':Sequelize[_0xe8e8('0x1')]},'name':{'type':Sequelize[_0xe8e8('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xe8e8('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xe8e8('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xe8e8('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xe8e8('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xe8e8('0x1')],'allowNull':![],'defaultValue':_0xe8e8('0x4')},'fontSize':{'type':Sequelize[_0xe8e8('0x5')](0x2)[_0xe8e8('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xe8e8('0x7');}},'notificationSound':{'type':Sequelize[_0xe8e8('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe8e8('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe8e8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe8e8('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe8e8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe8e8('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe8e8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe8e8('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xe8e8('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe8e8('0x9'),'set':function(_0x5283cf){if(!_0x5283cf)this[_0xe8e8('0xa')](_0xe8e8('0xb'),null);this[_0xe8e8('0xa')]('mandatoryDisposition',_0x5283cf);}},'provider':{'type':Sequelize[_0xe8e8('0xc')](_0xe8e8('0xd'),_0xe8e8('0xe'),_0xe8e8('0xf'),_0xe8e8('0x10')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0xe8e8('0x11')))return _0xe8e8('0x12');return this['getDataValue'](_0xe8e8('0x11'));},'set':function(_0x5bae3c){if(_0x5bae3c===_0xe8e8('0x12'))_0x5bae3c=null;return this[_0xe8e8('0xa')]('provider',_0x5bae3c);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 1273cde..0005440 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 _0x9ad6=['VIRTUAL','options','MailAccount','includeAll','include','findAll','params','MailServerOut','rawAttributes','find','body','provider','custom','secure','mandatoryDispositionPause','describe','MailAccountId','Disposition','getDispositions','findOne','order','pick','removeDispositions','ids','addAnswer','CannedAnswer','create','rows','removeAnswers','email','ListId','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','internal','Tag','color','tag','transaction','sequelize','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','verifySmtp','ValidationError','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','util','path','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','destroy','UserProfileResource','stack','name','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','pass','password','modernAuthentication','CloudProviderId','host','service','authentication','user','username','Imap','port','Smtp','MailServerIn','Pause','map','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x524124,_0x3cf4cc){var _0x145fdc=function(_0x328428){while(--_0x328428){_0x524124['push'](_0x524124['shift']());}};_0x145fdc(++_0x3cf4cc);}(_0x9ad6,0x1e5));var _0x69ad=function(_0x2ef02d,_0x10c837){_0x2ef02d=_0x2ef02d-0x0;var _0x35b5ca=_0x9ad6[_0x2ef02d];return _0x35b5ca;};'use strict';var moment=require(_0x69ad('0x0'));var BPromise=require('bluebird');var util=require(_0x69ad('0x1'));var path=require(_0x69ad('0x2'));var _=require(_0x69ad('0x3'));var juice=require('juice');var Redis=require(_0x69ad('0x4'));var qs=require(_0x69ad('0x5'));var logger=require('../../config/logger')(_0x69ad('0x6'));var config=require(_0x69ad('0x7'));var db=require(_0x69ad('0x8'))['db'];config[_0x69ad('0x9')]=_[_0x69ad('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x69ad('0xb'))(new Redis(config[_0x69ad('0x9')]));require('./mailAccount.socket')[_0x69ad('0xc')](socket);var jayson=require(_0x69ad('0xd'));var client=jayson['client'][_0x69ad('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x5071a7,_0x332f01,_0x51b258,_0x35c569){return new BPromise(function(_0x3af3a7,_0x433806){var _0x6999f0=_0x35c569||client;return _0x6999f0[_0x69ad('0xf')](_0x5071a7,_0x51b258)[_0x69ad('0x10')](function(_0x3b8d40){logger[_0x69ad('0x11')](_0x69ad('0x12'),_0x332f01,_0x69ad('0x13'));logger['debug'](_0x69ad('0x14'),_0x332f01,'request\x20sent',JSON['stringify'](_0x3b8d40));if(_0x3b8d40[_0x69ad('0x15')]){if(_0x3b8d40['error'][_0x69ad('0x16')]===0x1f4){logger[_0x69ad('0x15')](_0x69ad('0x12'),_0x332f01,_0x3b8d40[_0x69ad('0x15')]['message']);return _0x433806(_0x3b8d40[_0x69ad('0x15')][_0x69ad('0x17')]);}logger['error'](_0x69ad('0x12'),_0x332f01,_0x3b8d40[_0x69ad('0x15')][_0x69ad('0x17')]);return _0x3af3a7(_0x3b8d40[_0x69ad('0x15')][_0x69ad('0x17')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x332f01,_0x69ad('0x13'));_0x3af3a7(_0x3b8d40[_0x69ad('0x18')][_0x69ad('0x17')]);}})[_0x69ad('0x19')](function(_0xee2bdf){logger['error']('MailAccount,\x20%s,\x20%s',_0x332f01,_0xee2bdf);_0x433806(_0xee2bdf);});});}function respondWithStatusCode(_0x4f9459,_0x3684fb){_0x3684fb=_0x3684fb||0xcc;return function(_0x33e655){if(_0x33e655){return _0x4f9459[_0x69ad('0x1a')](_0x3684fb);}return _0x4f9459[_0x69ad('0x1b')](_0x3684fb)[_0x69ad('0x1c')]();};}function respondWithResult(_0x3f7272,_0x4dbab6){_0x4dbab6=_0x4dbab6||0xc8;return function(_0x1f468b){if(_0x1f468b){return _0x3f7272[_0x69ad('0x1b')](_0x4dbab6)[_0x69ad('0x1d')](_0x1f468b);}};}function respondWithFilteredResult(_0x162e5d,_0x2bfdb4){return function(_0x154826){if(_0x154826){var _0x4d0359=typeof _0x2bfdb4[_0x69ad('0x1e')]===_0x69ad('0x1f')&&typeof _0x2bfdb4[_0x69ad('0x20')]==='undefined';var _0xe26340=_0x154826[_0x69ad('0x21')];var _0x2663bc=_0x4d0359?0x0:_0x2bfdb4['offset'];var _0x52e64c=_0x4d0359?_0x154826[_0x69ad('0x21')]:_0x2bfdb4['offset']+_0x2bfdb4[_0x69ad('0x20')];var _0x233852;if(_0x52e64c>=_0xe26340){_0x52e64c=_0xe26340;_0x233852=0xc8;}else{_0x233852=0xce;}_0x162e5d['status'](_0x233852);return _0x162e5d['set'](_0x69ad('0x22'),_0x2663bc+'-'+_0x52e64c+'/'+_0xe26340)[_0x69ad('0x1d')](_0x154826);}return null;};}function saveUpdates(_0x40eedf){return function(_0x47ef73){if(_0x47ef73){return _0x47ef73[_0x69ad('0x23')](_0x40eedf)[_0x69ad('0x10')](function(_0x5a7040){return _0x5a7040;});}return null;};}function removeEntity(_0x2ed483){return function(_0x582cef){if(_0x582cef){return _0x582cef[_0x69ad('0x24')]()[_0x69ad('0x10')](function(){var _0x5b57c1=_0x582cef['get']({'plain':!![]});var _0x44c875='MailAccounts';return db[_0x69ad('0x25')][_0x69ad('0x24')]({'where':{'type':_0x44c875,'resourceId':_0x5b57c1['id']}})[_0x69ad('0x10')](function(){return _0x582cef;});})[_0x69ad('0x10')](function(){_0x2ed483[_0x69ad('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1be81f){return function(_0x5f5dd4){if(!_0x5f5dd4){_0x1be81f[_0x69ad('0x1a')](0x194);}return _0x5f5dd4;};}function handleError(_0x341507,_0xa6b0fd){_0xa6b0fd=_0xa6b0fd||0x1f4;return function(_0x3a981f){logger[_0x69ad('0x15')](_0x3a981f[_0x69ad('0x26')]);if(_0x3a981f[_0x69ad('0x27')]){delete _0x3a981f[_0x69ad('0x27')];}_0x341507[_0x69ad('0x1b')](_0xa6b0fd)['send'](_0x3a981f);};}function getImapHost(_0x55da2f){switch(_0x55da2f){case _0x69ad('0x28'):return _0x69ad('0x29');case _0x69ad('0x2a'):return _0x69ad('0x2b');case _0x69ad('0x2c'):return _0x69ad('0x2d');case _0x69ad('0x2e'):return'outlook.office365.com';}throw new Error(_0x69ad('0x2f'),_0x55da2f);}function getSmtpHost(_0x55f8e6){switch(_0x55f8e6){case _0x69ad('0x28'):return _0x69ad('0x30');case _0x69ad('0x2a'):return _0x69ad('0x31');case _0x69ad('0x2c'):return _0x69ad('0x32');case _0x69ad('0x2e'):return'smtp.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x55f8e6);}function getAuthenticationOptions(_0x819a2,_0x342100){var _0x481169={};var _0x2e63db={};if(_0x819a2){_0x481169['user']=_0x2e63db['user']=_0x342100['username'];_0x481169['password']=_0x2e63db[_0x69ad('0x33')]=_0x342100[_0x69ad('0x34')];if(_0x342100[_0x69ad('0x35')]){_0x481169[_0x69ad('0x35')]=_0x2e63db[_0x69ad('0x35')]=!![];_0x481169[_0x69ad('0x36')]=_0x2e63db[_0x69ad('0x36')]=_0x342100[_0x69ad('0x36')];_0x481169[_0x69ad('0x34')]=_0x2e63db[_0x69ad('0x33')]=null;}else{_0x481169[_0x69ad('0x36')]=_0x2e63db[_0x69ad('0x36')]=null;}_0x481169[_0x69ad('0x37')]=getImapHost(_0x819a2);_0x481169['port']=0x3e1;_0x2e63db[_0x69ad('0x37')]=getSmtpHost(_0x819a2);_0x2e63db['port']=0x24b;_0x2e63db['secure']=![];_0x481169[_0x69ad('0x38')]=_0x2e63db[_0x69ad('0x38')]=null;}else{if(_0x342100[_0x69ad('0x39')]){_0x481169[_0x69ad('0x3a')]=_0x2e63db[_0x69ad('0x3a')]=_0x342100[_0x69ad('0x3b')];_0x481169['password']=_0x2e63db[_0x69ad('0x33')]=_0x342100[_0x69ad('0x34')];}else{_0x481169[_0x69ad('0x39')]=_0x2e63db[_0x69ad('0x39')]=![];_0x481169[_0x69ad('0x3a')]=_0x2e63db[_0x69ad('0x3a')]=null;_0x481169[_0x69ad('0x34')]=_0x2e63db[_0x69ad('0x33')]=null;}_0x481169[_0x69ad('0x37')]=_0x342100[_0x69ad('0x3c')][_0x69ad('0x37')];_0x481169['port']=_0x342100[_0x69ad('0x3c')][_0x69ad('0x3d')];_0x2e63db[_0x69ad('0x37')]=_0x342100[_0x69ad('0x3e')]['host'];_0x2e63db[_0x69ad('0x3d')]=_0x342100[_0x69ad('0x3e')][_0x69ad('0x3d')];}return{'Imap':_0x481169,'Smtp':_0x2e63db};}exports['index']=function(_0x34ff69,_0xa4e1d9){var _0x3d0d9f={'include':[{'model':db[_0x69ad('0x3f')],'as':_0x69ad('0x3c')},{'model':db['MailServerOut'],'as':_0x69ad('0x3e')},{'model':db[_0x69ad('0x40')],'as':'mandatoryDispositionPause'}]},_0x2d1d1e={},_0x952e46={'count':0x0,'rows':[]};var _0x391a8d=_[_0x69ad('0x41')](db['MailAccount']['rawAttributes'],function(_0x40d431){return{'name':_0x40d431['fieldName'],'type':_0x40d431[_0x69ad('0x42')][_0x69ad('0x43')]};});_0x2d1d1e[_0x69ad('0x44')]=_[_0x69ad('0x41')](_0x391a8d,_0x69ad('0x27'));_0x2d1d1e[_0x69ad('0x45')]=_[_0x69ad('0x46')](_0x34ff69['query']);_0x2d1d1e[_0x69ad('0x47')]=_[_0x69ad('0x48')](_0x2d1d1e[_0x69ad('0x44')],_0x2d1d1e[_0x69ad('0x45')]);_0x3d0d9f['attributes']=_[_0x69ad('0x48')](_0x2d1d1e[_0x69ad('0x44')],qs[_0x69ad('0x49')](_0x34ff69['query'][_0x69ad('0x49')]));_0x3d0d9f[_0x69ad('0x4a')]=_0x3d0d9f[_0x69ad('0x4a')][_0x69ad('0x4b')]?_0x3d0d9f['attributes']:_0x2d1d1e[_0x69ad('0x44')];if(!_0x34ff69[_0x69ad('0x45')][_0x69ad('0x4c')](_0x69ad('0x4d'))){_0x3d0d9f['limit']=qs[_0x69ad('0x20')](_0x34ff69['query'][_0x69ad('0x20')]);_0x3d0d9f['offset']=qs['offset'](_0x34ff69[_0x69ad('0x45')][_0x69ad('0x1e')]);}_0x3d0d9f['order']=qs['sort'](_0x34ff69['query'][_0x69ad('0x4e')]);_0x3d0d9f[_0x69ad('0x4f')]=qs['filters'](_['pick'](_0x34ff69[_0x69ad('0x45')],_0x2d1d1e[_0x69ad('0x47')]),_0x391a8d);if(_0x34ff69[_0x69ad('0x45')][_0x69ad('0x50')]){_0x3d0d9f[_0x69ad('0x4f')]=_[_0x69ad('0x51')](_0x3d0d9f[_0x69ad('0x4f')],{'$or':_[_0x69ad('0x41')](_0x391a8d,function(_0x4f5b2a){if(_0x4f5b2a[_0x69ad('0x42')]!==_0x69ad('0x52')){var _0x4a9d39={};_0x4a9d39[_0x4f5b2a[_0x69ad('0x27')]]={'$like':'%'+_0x34ff69['query']['filter']+'%'};return _0x4a9d39;}})});}_0x3d0d9f=_['merge']({},_0x3d0d9f,_0x34ff69[_0x69ad('0x53')]);var _0x84ef53={'where':_0x3d0d9f[_0x69ad('0x4f')]};return db[_0x69ad('0x54')][_0x69ad('0x21')](_0x84ef53)[_0x69ad('0x10')](function(_0x2ae1b1){_0x952e46[_0x69ad('0x21')]=_0x2ae1b1;if(_0x34ff69[_0x69ad('0x45')][_0x69ad('0x55')]){_0x3d0d9f[_0x69ad('0x56')]=[{'all':!![]}];}return db[_0x69ad('0x54')][_0x69ad('0x57')](_0x3d0d9f);})['then'](function(_0x1d08ae){_0x952e46['rows']=_0x1d08ae;return _0x952e46;})['then'](respondWithFilteredResult(_0xa4e1d9,_0x3d0d9f))['catch'](handleError(_0xa4e1d9,null));};exports['show']=function(_0x144256,_0x5357ba){var _0x58fec1={'raw':![],'where':{'id':_0x144256[_0x69ad('0x58')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x69ad('0x59')],'as':_0x69ad('0x3e')},{'model':db[_0x69ad('0x40')],'as':'mandatoryDispositionPause'}]},_0x23bc9d={};_0x23bc9d[_0x69ad('0x44')]=_[_0x69ad('0x46')](db[_0x69ad('0x54')][_0x69ad('0x5a')]);_0x23bc9d[_0x69ad('0x45')]=_[_0x69ad('0x46')](_0x144256['query']);_0x23bc9d[_0x69ad('0x47')]=_[_0x69ad('0x48')](_0x23bc9d['model'],_0x23bc9d[_0x69ad('0x45')]);_0x58fec1[_0x69ad('0x4a')]=_[_0x69ad('0x48')](_0x23bc9d['model'],qs[_0x69ad('0x49')](_0x144256[_0x69ad('0x45')]['fields']));_0x58fec1[_0x69ad('0x4a')]=_0x58fec1[_0x69ad('0x4a')][_0x69ad('0x4b')]?_0x58fec1[_0x69ad('0x4a')]:_0x23bc9d['model'];if(_0x144256[_0x69ad('0x45')][_0x69ad('0x55')]){_0x58fec1[_0x69ad('0x56')]=[{'all':!![]}];}_0x58fec1=_[_0x69ad('0x51')]({},_0x58fec1,_0x144256['options']);return db[_0x69ad('0x54')][_0x69ad('0x5b')](_0x58fec1)[_0x69ad('0x10')](handleEntityNotFound(_0x5357ba,null))[_0x69ad('0x10')](respondWithResult(_0x5357ba,null))[_0x69ad('0x19')](handleError(_0x5357ba,null));};exports[_0x69ad('0x23')]=function(_0x4bf820,_0xba7bb0){if(_0x4bf820[_0x69ad('0x5c')]['id']){delete _0x4bf820[_0x69ad('0x5c')]['id'];}var _0x7c78f6=_0x4bf820[_0x69ad('0x5c')][_0x69ad('0x5d')]===_0x69ad('0x5e')?null:_0x4bf820[_0x69ad('0x5c')][_0x69ad('0x5d')];var _0x922ef9=_0x4bf820[_0x69ad('0x5c')][_0x69ad('0x3c')]||{};var _0x5594a0=_0x4bf820[_0x69ad('0x5c')][_0x69ad('0x3e')]||{};if(_0x7c78f6){_0x922ef9[_0x69ad('0x37')]=getImapHost(_0x7c78f6);_0x922ef9['port']=0x3e1;_0x5594a0[_0x69ad('0x37')]=getSmtpHost(_0x7c78f6);_0x5594a0[_0x69ad('0x3d')]=0x24b;_0x5594a0[_0x69ad('0x5f')]=![];}if(_0x5594a0[_0x69ad('0x35')]){_0x5594a0[_0x69ad('0x5f')]=![];}else{_0x5594a0[_0x69ad('0x36')]=null;}if(!_0x922ef9[_0x69ad('0x35')])_0x922ef9[_0x69ad('0x36')]=null;_0x4bf820['body'][_0x69ad('0x3c')]=_0x922ef9;_0x4bf820[_0x69ad('0x5c')]['Smtp']=_0x5594a0;return db['MailAccount'][_0x69ad('0x5b')]({'where':{'id':_0x4bf820[_0x69ad('0x58')]['id']},'include':[{'model':db[_0x69ad('0x3f')],'as':_0x69ad('0x3c')},{'model':db['MailServerOut'],'as':_0x69ad('0x3e')},{'model':db[_0x69ad('0x40')],'as':_0x69ad('0x60')}]})['then'](handleEntityNotFound(_0xba7bb0,null))[_0x69ad('0x10')](function(_0x257cd5){if(!_0x257cd5)throw new Error('Mail\x20Account\x20not\x20found');if(_0x257cd5[_0x69ad('0x38')])delete _0x4bf820['body'][_0x69ad('0x3c')];return _0x257cd5;})[_0x69ad('0x10')](saveUpdates(_0x4bf820[_0x69ad('0x5c')],null))[_0x69ad('0x10')](function(_0x1ce438){if(!_0x4bf820['body'][_0x69ad('0x3c')])return _0x1ce438;return db['MailServerIn'][_0x69ad('0x23')](_0x4bf820[_0x69ad('0x5c')][_0x69ad('0x3c')],{'where':{'MailAccountId':_0x1ce438['id']}})[_0x69ad('0x10')](function(){return _0x1ce438;});})[_0x69ad('0x10')](function(_0x4c4b1a){if(!_0x4bf820[_0x69ad('0x5c')][_0x69ad('0x3e')])return _0x4c4b1a;return db[_0x69ad('0x59')][_0x69ad('0x23')](_0x4bf820[_0x69ad('0x5c')]['Smtp'],{'where':{'MailAccountId':_0x4c4b1a['id']}})[_0x69ad('0x10')](function(){return _0x4c4b1a;});})[_0x69ad('0x10')](respondWithResult(_0xba7bb0,null))[_0x69ad('0x19')](handleError(_0xba7bb0,null));};exports['describe']=function(_0xd1ed7b,_0x62179a){return db[_0x69ad('0x54')][_0x69ad('0x61')]()[_0x69ad('0x10')](respondWithResult(_0x62179a,null))['catch'](handleError(_0x62179a,null));};exports['addDisposition']=function(_0x243e34,_0x48eb09){if(_0x243e34[_0x69ad('0x5c')]['id']){delete _0x243e34[_0x69ad('0x5c')]['id'];}return db[_0x69ad('0x54')][_0x69ad('0x5b')]({'where':{'id':_0x243e34[_0x69ad('0x58')]['id']}})[_0x69ad('0x10')](handleEntityNotFound(_0x48eb09,null))['then'](function(_0x465122){if(_0x465122){_0x243e34['body'][_0x69ad('0x62')]=_0x465122['id'];return db[_0x69ad('0x63')]['create'](_0x243e34[_0x69ad('0x5c')]);}})[_0x69ad('0x10')](respondWithResult(_0x48eb09,null))[_0x69ad('0x19')](handleError(_0x48eb09,null));};exports[_0x69ad('0x64')]=function(_0x2a3196,_0x34cf3d){var _0x50e8fa={'raw':![],'where':{}};var _0x71fd81={};var _0x2012bd={'count':0x0,'rows':[]};return db[_0x69ad('0x54')][_0x69ad('0x65')]({'where':{'id':_0x2a3196[_0x69ad('0x58')]['id']}})[_0x69ad('0x10')](handleEntityNotFound(_0x34cf3d,null))[_0x69ad('0x10')](function(_0x87fd3a){if(_0x87fd3a){_0x71fd81[_0x69ad('0x44')]=_[_0x69ad('0x46')](db[_0x69ad('0x63')]['rawAttributes']);_0x71fd81[_0x69ad('0x45')]=_[_0x69ad('0x46')](_0x2a3196[_0x69ad('0x45')]);_0x71fd81[_0x69ad('0x47')]=_[_0x69ad('0x48')](_0x71fd81[_0x69ad('0x44')],_0x71fd81[_0x69ad('0x45')]);_0x50e8fa['attributes']=_[_0x69ad('0x48')](_0x71fd81[_0x69ad('0x44')],qs[_0x69ad('0x49')](_0x2a3196['query'][_0x69ad('0x49')]));_0x50e8fa[_0x69ad('0x4a')]=_0x50e8fa['attributes'][_0x69ad('0x4b')]?_0x50e8fa[_0x69ad('0x4a')]:_0x71fd81[_0x69ad('0x44')];if(!_0x2a3196[_0x69ad('0x45')]['hasOwnProperty'](_0x69ad('0x4d'))){_0x50e8fa['limit']=qs[_0x69ad('0x20')](_0x2a3196['query'][_0x69ad('0x20')]);_0x50e8fa[_0x69ad('0x1e')]=qs['offset'](_0x2a3196['query'][_0x69ad('0x1e')]);}_0x50e8fa[_0x69ad('0x66')]=qs[_0x69ad('0x4e')](_0x2a3196[_0x69ad('0x45')]['sort']);_0x50e8fa[_0x69ad('0x4f')]=qs[_0x69ad('0x47')](_[_0x69ad('0x67')](_0x2a3196[_0x69ad('0x45')],_0x71fd81['filters']));_0x50e8fa[_0x69ad('0x4f')][_0x69ad('0x62')]=_0x87fd3a['id'];if(_0x2a3196[_0x69ad('0x45')][_0x69ad('0x50')]){_0x50e8fa[_0x69ad('0x4f')]=_['merge'](_0x50e8fa[_0x69ad('0x4f')],{'$or':_['map'](_0x50e8fa['attributes'],function(_0x1c39df){var _0x289017={};_0x289017[_0x1c39df]={'$like':'%'+_0x2a3196[_0x69ad('0x45')][_0x69ad('0x50')]+'%'};return _0x289017;})});}_0x50e8fa=_[_0x69ad('0x51')]({},_0x50e8fa,_0x2a3196['options']);return db[_0x69ad('0x63')][_0x69ad('0x21')]({'where':_0x50e8fa[_0x69ad('0x4f')]})[_0x69ad('0x10')](function(_0x344f2b){_0x2012bd[_0x69ad('0x21')]=_0x344f2b;if(_0x2a3196['query']['includeAll']){_0x50e8fa[_0x69ad('0x56')]=[{'all':!![]}];}return db[_0x69ad('0x63')][_0x69ad('0x57')](_0x50e8fa);})[_0x69ad('0x10')](function(_0x4c92dc){_0x2012bd['rows']=_0x4c92dc;return _0x2012bd;});}})[_0x69ad('0x10')](respondWithFilteredResult(_0x34cf3d,_0x50e8fa))['catch'](handleError(_0x34cf3d,null));};exports[_0x69ad('0x68')]=function(_0x46461c,_0x4b9967){return db['MailAccount'][_0x69ad('0x5b')]({'where':{'id':_0x46461c['params']['id']}})['then'](handleEntityNotFound(_0x4b9967,null))[_0x69ad('0x10')](function(_0x4985b2){if(_0x4985b2){return _0x4985b2[_0x69ad('0x68')](_0x46461c['query'][_0x69ad('0x69')]);}})[_0x69ad('0x10')](respondWithStatusCode(_0x4b9967,null))[_0x69ad('0x19')](handleError(_0x4b9967,null));};exports[_0x69ad('0x6a')]=function(_0x1de61d,_0x3ddbf9){if(_0x1de61d[_0x69ad('0x5c')]['id']){delete _0x1de61d[_0x69ad('0x5c')]['id'];}return db['MailAccount'][_0x69ad('0x5b')]({'where':{'id':_0x1de61d[_0x69ad('0x58')]['id']}})[_0x69ad('0x10')](handleEntityNotFound(_0x3ddbf9,null))[_0x69ad('0x10')](function(_0x184d21){if(_0x184d21){_0x1de61d[_0x69ad('0x5c')][_0x69ad('0x62')]=_0x184d21['id'];return db[_0x69ad('0x6b')][_0x69ad('0x6c')](_0x1de61d['body']);}})[_0x69ad('0x10')](respondWithResult(_0x3ddbf9,null))[_0x69ad('0x19')](handleError(_0x3ddbf9,null));};exports['getAnswers']=function(_0x570d06,_0x1fd7a0){var _0x2e6836={'raw':![],'where':{}};var _0x5e655d={};var _0x116cf3={'count':0x0,'rows':[]};return db[_0x69ad('0x54')]['findOne']({'where':{'id':_0x570d06[_0x69ad('0x58')]['id']}})[_0x69ad('0x10')](handleEntityNotFound(_0x1fd7a0,null))['then'](function(_0x4db399){if(_0x4db399){_0x5e655d[_0x69ad('0x44')]=_[_0x69ad('0x46')](db[_0x69ad('0x6b')][_0x69ad('0x5a')]);_0x5e655d[_0x69ad('0x45')]=_[_0x69ad('0x46')](_0x570d06[_0x69ad('0x45')]);_0x5e655d[_0x69ad('0x47')]=_[_0x69ad('0x48')](_0x5e655d[_0x69ad('0x44')],_0x5e655d['query']);_0x2e6836[_0x69ad('0x4a')]=_[_0x69ad('0x48')](_0x5e655d[_0x69ad('0x44')],qs[_0x69ad('0x49')](_0x570d06[_0x69ad('0x45')]['fields']));_0x2e6836[_0x69ad('0x4a')]=_0x2e6836[_0x69ad('0x4a')][_0x69ad('0x4b')]?_0x2e6836['attributes']:_0x5e655d['model'];if(!_0x570d06[_0x69ad('0x45')]['hasOwnProperty'](_0x69ad('0x4d'))){_0x2e6836[_0x69ad('0x20')]=qs[_0x69ad('0x20')](_0x570d06['query'][_0x69ad('0x20')]);_0x2e6836[_0x69ad('0x1e')]=qs[_0x69ad('0x1e')](_0x570d06[_0x69ad('0x45')]['offset']);}_0x2e6836[_0x69ad('0x66')]=qs[_0x69ad('0x4e')](_0x570d06[_0x69ad('0x45')][_0x69ad('0x4e')]);_0x2e6836[_0x69ad('0x4f')]=qs[_0x69ad('0x47')](_['pick'](_0x570d06['query'],_0x5e655d['filters']));_0x2e6836[_0x69ad('0x4f')][_0x69ad('0x62')]=_0x4db399['id'];if(_0x570d06[_0x69ad('0x45')][_0x69ad('0x50')]){_0x2e6836[_0x69ad('0x4f')]=_[_0x69ad('0x51')](_0x2e6836['where'],{'$or':_['map'](_0x2e6836[_0x69ad('0x4a')],function(_0x218b4d){var _0x4a195b={};_0x4a195b[_0x218b4d]={'$like':'%'+_0x570d06[_0x69ad('0x45')][_0x69ad('0x50')]+'%'};return _0x4a195b;})});}_0x2e6836=_['merge']({},_0x2e6836,_0x570d06[_0x69ad('0x53')]);return db[_0x69ad('0x6b')][_0x69ad('0x21')]({'where':_0x2e6836[_0x69ad('0x4f')]})[_0x69ad('0x10')](function(_0x4daf70){_0x116cf3[_0x69ad('0x21')]=_0x4daf70;if(_0x570d06[_0x69ad('0x45')][_0x69ad('0x55')]){_0x2e6836[_0x69ad('0x56')]=[{'all':!![]}];}return db[_0x69ad('0x6b')]['findAll'](_0x2e6836);})[_0x69ad('0x10')](function(_0x245fcb){_0x116cf3[_0x69ad('0x6d')]=_0x245fcb;return _0x116cf3;});}})[_0x69ad('0x10')](respondWithFilteredResult(_0x1fd7a0,_0x2e6836))[_0x69ad('0x19')](handleError(_0x1fd7a0,null));};exports[_0x69ad('0x6e')]=function(_0x19730d,_0x248106){return db[_0x69ad('0x54')]['find']({'where':{'id':_0x19730d[_0x69ad('0x58')]['id']}})[_0x69ad('0x10')](handleEntityNotFound(_0x248106,null))['then'](function(_0x635128){if(_0x635128){return _0x635128[_0x69ad('0x6e')](_0x19730d['query'][_0x69ad('0x69')]);}})[_0x69ad('0x10')](respondWithStatusCode(_0x248106,null))[_0x69ad('0x19')](handleError(_0x248106,null));};exports[_0x69ad('0x6c')]=function(_0xf06b5b,_0x42655d){var _0x2527f9={'name':_0xf06b5b['body'][_0x69ad('0x27')],'key':_0xf06b5b['body'][_0x69ad('0x43')],'provider':_0xf06b5b['body'][_0x69ad('0x5d')]===_0x69ad('0x5e')?null:_0xf06b5b[_0x69ad('0x5c')]['provider'],'email':_0xf06b5b[_0x69ad('0x5c')][_0x69ad('0x6f')],'ListId':_0xf06b5b['body'][_0x69ad('0x70')],'active':!_['isNil'](_0xf06b5b[_0x69ad('0x5c')]['active'])?_0xf06b5b['body'][_0x69ad('0x71')]:!![],'description':_0xf06b5b['body'][_0x69ad('0x72')]||null};var _0x2dd9b7=getAuthenticationOptions(_0x2527f9[_0x69ad('0x5d')],_0xf06b5b[_0x69ad('0x5c')]);_0x2527f9[_0x69ad('0x3c')]=_0x2dd9b7[_0x69ad('0x3c')];_0x2527f9[_0x69ad('0x3e')]=_0x2dd9b7[_0x69ad('0x3e')];return db[_0x69ad('0x54')]['create'](_0x2527f9,{'include':[{'model':db[_0x69ad('0x59')],'as':_0x69ad('0x3e')},{'model':db['MailServerIn'],'as':_0x69ad('0x3c')}]})[_0x69ad('0x10')](function(_0xe82320){var _0x12865f=_0xf06b5b[_0x69ad('0x3a')][_0x69ad('0x73')]({'plain':!![]});if(!_0x12865f)throw new Error(_0x69ad('0x74'));if(_0x12865f[_0x69ad('0x75')]===_0x69ad('0x3a')){var _0x29443e=_0xe82320['get']({'plain':!![]});return db[_0x69ad('0x76')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x12865f['userProfileId']},'raw':!![]})[_0x69ad('0x10')](function(_0xe60c10){if(_0xe60c10&&_0xe60c10[_0x69ad('0x77')]===0x0){return db[_0x69ad('0x25')][_0x69ad('0x6c')]({'name':_0x29443e[_0x69ad('0x27')],'resourceId':_0x29443e['id'],'type':_0xe60c10[_0x69ad('0x27')],'sectionId':_0xe60c10['id']},{})['then'](function(){return _0xe82320;});}else{return _0xe82320;}})[_0x69ad('0x19')](function(_0x5b66e4){logger[_0x69ad('0x15')](_0x69ad('0x78'),_0x5b66e4);throw _0x5b66e4;});}return _0xe82320;})[_0x69ad('0x10')](respondWithResult(_0x42655d,0xc9))['catch'](handleError(_0x42655d,null));};exports['getImap']=function(_0x15f2e5,_0x42748c){return db[_0x69ad('0x54')][_0x69ad('0x65')]({'where':{'id':_0x15f2e5['params']['id']}})[_0x69ad('0x10')](handleEntityNotFound(_0x42748c,null))[_0x69ad('0x10')](function(_0x571388){if(_0x571388){return _0x571388[_0x69ad('0x79')]();}return null;})[_0x69ad('0x10')](respondWithResult(_0x42748c,null))['catch'](handleError(_0x42748c,null));};exports[_0x69ad('0x7a')]=function(_0x54741c,_0x3b649c){if(_0x54741c[_0x69ad('0x5c')]['id']){delete _0x54741c[_0x69ad('0x5c')]['id'];}return db[_0x69ad('0x54')][_0x69ad('0x5b')]({'where':{'id':_0x54741c['params']['id']}})[_0x69ad('0x10')](handleEntityNotFound(_0x3b649c,null))[_0x69ad('0x10')](function(_0x52548d){if(_0x52548d){_0x54741c[_0x69ad('0x5c')][_0x69ad('0x62')]=_0x52548d['id'];return db[_0x69ad('0x3f')][_0x69ad('0x6c')](_0x54741c['body']);}})[_0x69ad('0x10')](respondWithResult(_0x3b649c,null))[_0x69ad('0x19')](handleError(_0x3b649c,null));};exports['removeImap']=function(_0x975241,_0x1a6172){return db[_0x69ad('0x54')][_0x69ad('0x65')]({'where':{'id':_0x975241[_0x69ad('0x58')]['id']}})[_0x69ad('0x10')](handleEntityNotFound(_0x1a6172,null))[_0x69ad('0x10')](function(_0x4914c8){if(_0x4914c8){return _0x4914c8[_0x69ad('0x7b')](null);}return null;})[_0x69ad('0x10')](respondWithStatusCode(_0x1a6172,null))[_0x69ad('0x19')](handleError(_0x1a6172,null));};exports['getSmtp']=function(_0x584191,_0x4465c8){return db[_0x69ad('0x54')][_0x69ad('0x65')]({'where':{'id':_0x584191[_0x69ad('0x58')]['id']}})[_0x69ad('0x10')](handleEntityNotFound(_0x4465c8,null))[_0x69ad('0x10')](function(_0x2bffdb){if(_0x2bffdb){return _0x2bffdb[_0x69ad('0x7c')]();}return null;})[_0x69ad('0x10')](respondWithResult(_0x4465c8,null))[_0x69ad('0x19')](handleError(_0x4465c8,null));};exports['addSmtp']=function(_0x360bec,_0xc242eb){if(_0x360bec[_0x69ad('0x5c')]['id']){delete _0x360bec[_0x69ad('0x5c')]['id'];}return db[_0x69ad('0x54')]['find']({'where':{'id':_0x360bec[_0x69ad('0x58')]['id']}})[_0x69ad('0x10')](handleEntityNotFound(_0xc242eb,null))['then'](function(_0x43c112){if(_0x43c112){_0x360bec['body'][_0x69ad('0x62')]=_0x43c112['id'];return db['MailServerOut'][_0x69ad('0x6c')](_0x360bec[_0x69ad('0x5c')]);}})[_0x69ad('0x10')](respondWithResult(_0xc242eb,null))['catch'](handleError(_0xc242eb,null));};exports[_0x69ad('0x7d')]=function(_0x4b8bef,_0x335412){return db[_0x69ad('0x54')][_0x69ad('0x65')]({'where':{'id':_0x4b8bef[_0x69ad('0x58')]['id']}})[_0x69ad('0x10')](handleEntityNotFound(_0x335412,null))['then'](function(_0x479f7c){if(_0x479f7c){return _0x479f7c[_0x69ad('0x7e')](null);}return null;})['then'](respondWithStatusCode(_0x335412,null))[_0x69ad('0x19')](handleError(_0x335412,null));};exports['addInteraction']=function(_0x5ec977,_0x154ff2){return db[_0x69ad('0x7f')][_0x69ad('0x5b')]({'where':{'id':_0x5ec977[_0x69ad('0x58')]['id']}})[_0x69ad('0x10')](handleEntityNotFound(_0x154ff2,null))[_0x69ad('0x10')](function(_0x370b76){if(_0x370b76){return _0x370b76[_0x69ad('0x80')](_0x5ec977[_0x69ad('0x5c')][_0x69ad('0x69')],_[_0x69ad('0x81')](_0x5ec977[_0x69ad('0x5c')],['ids','id'])||{});}})['then'](respondWithResult(_0x154ff2,null))['catch'](handleError(_0x154ff2,null));};exports[_0x69ad('0x82')]=function(_0x5d83f5,_0x297c90){var _0x4aaa04={'raw':![],'where':{}};var _0x2c03fd={};var _0x5815a7={'count':0x0,'rows':[]};return db[_0x69ad('0x54')][_0x69ad('0x65')]({'where':{'id':_0x5d83f5[_0x69ad('0x58')]['id']}})[_0x69ad('0x10')](handleEntityNotFound(_0x297c90,null))['then'](function(_0x1bab3f){if(_0x1bab3f){_0x2c03fd[_0x69ad('0x44')]=_[_0x69ad('0x46')](db['MailInteraction'][_0x69ad('0x5a')]);_0x2c03fd['query']=_[_0x69ad('0x46')](_0x5d83f5[_0x69ad('0x45')]);_0x2c03fd[_0x69ad('0x47')]=_[_0x69ad('0x48')](_0x2c03fd[_0x69ad('0x44')],_0x2c03fd[_0x69ad('0x45')]);_0x4aaa04[_0x69ad('0x4a')]=_['intersection'](_0x2c03fd[_0x69ad('0x44')],qs[_0x69ad('0x49')](_0x5d83f5[_0x69ad('0x45')]['fields']));_0x4aaa04[_0x69ad('0x4a')]=_0x4aaa04['attributes'][_0x69ad('0x4b')]?_0x4aaa04[_0x69ad('0x4a')]:_0x2c03fd[_0x69ad('0x44')];if(!_0x5d83f5[_0x69ad('0x45')][_0x69ad('0x4c')]('nolimit')){_0x4aaa04[_0x69ad('0x20')]=qs[_0x69ad('0x20')](_0x5d83f5[_0x69ad('0x45')][_0x69ad('0x20')]);_0x4aaa04['offset']=qs[_0x69ad('0x1e')](_0x5d83f5[_0x69ad('0x45')][_0x69ad('0x1e')]);}_0x4aaa04[_0x69ad('0x66')]=qs[_0x69ad('0x4e')](_0x5d83f5[_0x69ad('0x45')][_0x69ad('0x4e')]);_0x4aaa04['where']=qs['filters'](_['pick'](_0x5d83f5['query'],_0x2c03fd[_0x69ad('0x47')]));_0x4aaa04[_0x69ad('0x4f')][_0x69ad('0x62')]=_0x1bab3f['id'];if(_0x5d83f5['query'][_0x69ad('0x50')]){_0x4aaa04[_0x69ad('0x4f')]=_[_0x69ad('0x51')](_0x4aaa04[_0x69ad('0x4f')],{'$or':_[_0x69ad('0x41')](_0x4aaa04[_0x69ad('0x4a')],function(_0x589fa7){var _0x2c36e4={};_0x2c36e4[_0x589fa7]={'$like':'%'+_0x5d83f5['query'][_0x69ad('0x50')]+'%'};return _0x2c36e4;})});}_0x4aaa04=_[_0x69ad('0x51')]({},_0x4aaa04,_0x5d83f5[_0x69ad('0x53')]);return db[_0x69ad('0x7f')][_0x69ad('0x21')]({'where':_0x4aaa04[_0x69ad('0x4f')]})[_0x69ad('0x10')](function(_0x59a356){_0x5815a7[_0x69ad('0x21')]=_0x59a356;if(_0x5d83f5['query'][_0x69ad('0x55')]){_0x4aaa04[_0x69ad('0x56')]=[{'model':db[_0x69ad('0x83')],'as':_0x69ad('0x84'),'required':![]},{'model':db[_0x69ad('0x85')],'as':'Owner','attributes':[_0x69ad('0x27'),'fullname',_0x69ad('0x86')],'required':![]},{'model':db[_0x69ad('0x87')],'as':'Tags','attributes':['id',_0x69ad('0x27'),_0x69ad('0x88')],'where':_0x5d83f5['query'][_0x69ad('0x89')]?{'id':_0x5d83f5[_0x69ad('0x45')][_0x69ad('0x89')]}:undefined,'required':_0x5d83f5[_0x69ad('0x45')]['tag']?!![]:![]}];}return db[_0x69ad('0x7f')]['findAll'](_0x4aaa04);})[_0x69ad('0x10')](function(_0x13de14){_0x5815a7[_0x69ad('0x6d')]=_0x13de14;return _0x5815a7;});}})[_0x69ad('0x10')](respondWithFilteredResult(_0x297c90,_0x4aaa04))[_0x69ad('0x19')](handleError(_0x297c90,null));};exports['addApplications']=function addApplications(_0x5c7690,_0xc81304){var _0x382be2=_0x5c7690[_0x69ad('0x58')]['id'];var _0x2ff1b1=_0x5c7690[_0x69ad('0x5c')];var _0x54c918=0xc8;var _0x4aac61=null;return db['sequelize'][_0x69ad('0x8a')]({'isolationLevel':db[_0x69ad('0x8b')]['Transaction'][_0x69ad('0x8c')]['READ_COMMITTED']},function(_0x3a8ed4){return db[_0x69ad('0x54')]['findOne']({'where':{'id':_0x382be2},'transaction':_0x3a8ed4})[_0x69ad('0x10')](function(_0x992b82){if(_0x992b82){return db[_0x69ad('0x8d')]['destroy']({'where':{'MailAccountId':_0x382be2},'transaction':_0x3a8ed4})[_0x69ad('0x10')](function(){var _0x53ab8a=_['map'](_0x2ff1b1,function(_0x3c9bfa){_0x3c9bfa[_0x69ad('0x62')]=_0x382be2;return _0x3c9bfa;});return db[_0x69ad('0x8d')][_0x69ad('0x8e')](_0x53ab8a,{'transaction':_0x3a8ed4});});}else{_0x54c918=0x194;_0x4aac61=[];}});})[_0x69ad('0x10')](function(){if(_0x54c918!==0x194){return db[_0x69ad('0x8d')][_0x69ad('0x8f')]({'where':{'MailAccountId':_0x382be2},'order':_0x69ad('0x90')})['then'](function(_0x19c089){_0x4aac61=_0x19c089;});}})['catch'](function(_0xfa2e21){_0x54c918=0x1f4;logger[_0x69ad('0x15')](_0xfa2e21[_0x69ad('0x26')]);if(_0xfa2e21[_0x69ad('0x27')]){delete _0xfa2e21[_0x69ad('0x27')];}_0x4aac61=_0xfa2e21;})[_0x69ad('0x91')](function(){if(_0x4aac61===null){_0xc81304[_0x69ad('0x1a')](_0x54c918);}else{if(_0x54c918===0x1f4){_0xc81304[_0x69ad('0x1b')](_0x54c918)[_0x69ad('0x92')](_0x4aac61);}else{_0xc81304[_0x69ad('0x1b')](_0x54c918)['json'](_0x4aac61);}}});};exports[_0x69ad('0x93')]=function(_0x51bb85,_0x4fd929){var _0x3fed14={};var _0x59a693={};var _0x40b84e;var _0x284590;return db[_0x69ad('0x54')][_0x69ad('0x65')]({'where':{'id':_0x51bb85[_0x69ad('0x58')]['id']}})[_0x69ad('0x10')](handleEntityNotFound(_0x4fd929,null))[_0x69ad('0x10')](function(_0x271318){if(_0x271318){_0x40b84e=_0x271318;_0x59a693[_0x69ad('0x44')]=_[_0x69ad('0x46')](db[_0x69ad('0x8d')][_0x69ad('0x5a')]);_0x59a693['query']=_['keys'](_0x51bb85['query']);_0x59a693[_0x69ad('0x47')]=_['intersection'](_0x59a693[_0x69ad('0x44')],_0x59a693[_0x69ad('0x45')]);_0x3fed14[_0x69ad('0x4a')]=_[_0x69ad('0x48')](_0x59a693[_0x69ad('0x44')],qs[_0x69ad('0x49')](_0x51bb85['query'][_0x69ad('0x49')]));_0x3fed14['attributes']=_0x3fed14[_0x69ad('0x4a')][_0x69ad('0x4b')]?_0x3fed14[_0x69ad('0x4a')]:_0x59a693[_0x69ad('0x44')];_0x3fed14[_0x69ad('0x66')]=qs[_0x69ad('0x4e')](_0x51bb85[_0x69ad('0x45')]['sort']);_0x3fed14['where']=qs['filters'](_[_0x69ad('0x67')](_0x51bb85[_0x69ad('0x45')],_0x59a693[_0x69ad('0x47')]));if(_0x51bb85[_0x69ad('0x45')]['filter']){_0x3fed14['where']=_[_0x69ad('0x51')](_0x3fed14[_0x69ad('0x4f')],{'$or':_[_0x69ad('0x41')](_0x3fed14[_0x69ad('0x4a')],function(_0x475752){var _0x364935={};_0x364935[_0x475752]={'$like':'%'+_0x51bb85[_0x69ad('0x45')][_0x69ad('0x50')]+'%'};return _0x364935;})});}_0x3fed14=_[_0x69ad('0x51')]({},_0x3fed14,_0x51bb85[_0x69ad('0x53')]);return _0x40b84e[_0x69ad('0x93')](_0x3fed14);}})['then'](function(_0x1f9120){if(_0x1f9120){_0x284590=_0x1f9120['length'];if(!_0x51bb85[_0x69ad('0x45')][_0x69ad('0x4c')](_0x69ad('0x4d'))){_0x3fed14[_0x69ad('0x20')]=qs[_0x69ad('0x20')](_0x51bb85[_0x69ad('0x45')][_0x69ad('0x20')]);_0x3fed14[_0x69ad('0x1e')]=qs[_0x69ad('0x1e')](_0x51bb85[_0x69ad('0x45')]['offset']);}return _0x40b84e[_0x69ad('0x93')](_0x3fed14);}})[_0x69ad('0x10')](function(_0x130516){if(_0x130516){return _0x130516?{'count':_0x284590,'rows':_0x130516}:null;}})[_0x69ad('0x10')](respondWithResult(_0x4fd929,null))[_0x69ad('0x19')](handleError(_0x4fd929,null));};exports[_0x69ad('0x94')]=function(_0x43ebd7,_0x515bf6){var _0x37edeb={'raw':!![],'where':{}};var _0xf1b21f={};var _0x2e8754={'count':0x0,'rows':[]};return db[_0x69ad('0x54')]['findOne']({'where':{'id':_0x43ebd7[_0x69ad('0x58')]['id']}})[_0x69ad('0x10')](handleEntityNotFound(_0x515bf6,null))[_0x69ad('0x10')](function(_0x1ae515){if(_0x1ae515){_0xf1b21f[_0x69ad('0x44')]=_['keys'](db[_0x69ad('0x95')][_0x69ad('0x5a')]);_0xf1b21f[_0x69ad('0x45')]=_[_0x69ad('0x46')](_0x43ebd7[_0x69ad('0x45')]);_0xf1b21f[_0x69ad('0x47')]=_['intersection'](_0xf1b21f[_0x69ad('0x44')],_0xf1b21f[_0x69ad('0x45')]);_0x37edeb[_0x69ad('0x4a')]=_[_0x69ad('0x48')](_0xf1b21f[_0x69ad('0x44')],qs[_0x69ad('0x49')](_0x43ebd7[_0x69ad('0x45')]['fields']));_0x37edeb['attributes']=_0x37edeb['attributes'][_0x69ad('0x4b')]?_0x37edeb['attributes']:_0xf1b21f[_0x69ad('0x44')];if(!_0x43ebd7['query']['hasOwnProperty'](_0x69ad('0x4d'))){_0x37edeb[_0x69ad('0x20')]=qs[_0x69ad('0x20')](_0x43ebd7[_0x69ad('0x45')][_0x69ad('0x20')]);_0x37edeb[_0x69ad('0x1e')]=qs[_0x69ad('0x1e')](_0x43ebd7[_0x69ad('0x45')][_0x69ad('0x1e')]);}_0x37edeb['order']=qs[_0x69ad('0x4e')](_0x43ebd7[_0x69ad('0x45')][_0x69ad('0x4e')]);_0x37edeb[_0x69ad('0x4f')]=qs['filters'](_[_0x69ad('0x67')](_0x43ebd7[_0x69ad('0x45')],_0xf1b21f[_0x69ad('0x47')]));_0x37edeb[_0x69ad('0x4f')]['MailAccountId']=_0x1ae515['id'];if(_0x43ebd7[_0x69ad('0x45')][_0x69ad('0x50')]){_0x37edeb[_0x69ad('0x4f')]=_[_0x69ad('0x51')](_0x37edeb['where'],{'$or':_[_0x69ad('0x41')](_0x37edeb['attributes'],function(_0xe96efb){var _0x2b832c={};_0x2b832c[_0xe96efb]={'$like':'%'+_0x43ebd7[_0x69ad('0x45')][_0x69ad('0x50')]+'%'};return _0x2b832c;})});}if(_0x43ebd7[_0x69ad('0x45')][_0x69ad('0x96')]){var _0x1fcb49=_0x43ebd7[_0x69ad('0x45')][_0x69ad('0x96')][_0x69ad('0x97')](',');var _0x4ecb62={};_0x4ecb62[_0x1fcb49[0x0]]={'$gte':moment(_0x1fcb49[0x1])[_0x69ad('0x98')](_0x69ad('0x99'))};_0x37edeb[_0x69ad('0x4f')]=_[_0x69ad('0x51')](_0x37edeb[_0x69ad('0x4f')],_0x4ecb62);}_0x37edeb=_[_0x69ad('0x51')]({},_0x37edeb,_0x43ebd7['options']);return db[_0x69ad('0x95')][_0x69ad('0x21')]({'where':_0x37edeb[_0x69ad('0x4f')]})['then'](function(_0x880db6){_0x2e8754[_0x69ad('0x21')]=_0x880db6;if(_0x43ebd7['query'][_0x69ad('0x55')]){_0x37edeb[_0x69ad('0x56')]=[{'all':!![]}];}return db[_0x69ad('0x95')][_0x69ad('0x57')](_0x37edeb);})['then'](function(_0x5b915c){if(_0x43ebd7[_0x69ad('0x45')][_0x69ad('0x9a')]===_0x69ad('0x9b')){for(var _0x5d23bb=0x0;_0x5d23bb<_0x5b915c[_0x69ad('0x4b')];_0x5d23bb++){_0x5b915c[_0x5d23bb][_0x69ad('0x5c')]=juice(_0x5b915c[_0x5d23bb][_0x69ad('0x5c')]);}}_0x2e8754['rows']=_0x5b915c;return _0x2e8754;});}})[_0x69ad('0x10')](respondWithFilteredResult(_0x515bf6,_0x37edeb))[_0x69ad('0x19')](handleError(_0x515bf6,null));};exports[_0x69ad('0x92')]=function(_0x208870,_0x348e1b){var _0x672c5d,_0x3f9cd4={},_0x40a6b6;if(_0x208870[_0x69ad('0x5c')]['to']){_0x40a6b6=_0x208870[_0x69ad('0x5c')]['to'][_0x69ad('0x97')](',')[0x0];}return db[_0x69ad('0x54')]['find']({'where':{'id':_0x208870[_0x69ad('0x58')]['id']},'include':[{'model':db[_0x69ad('0x9c')],'as':_0x69ad('0x9d'),'include':[{'model':db['CmContact'],'as':_0x69ad('0x9e'),'where':{'email':_0x40a6b6},'limit':0x1,'order':[[_0x69ad('0x9f'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x69ad('0x3e'),'raw':!![],'include':[{'model':db[_0x69ad('0xa0')],'as':_0x69ad('0xa0'),'raw':!![]}]}]})[_0x69ad('0x10')](handleEntityNotFound(_0x348e1b,null))[_0x69ad('0x10')](function(_0x565816){if(!_0x565816)return;_0x672c5d=_0x565816;if(!_0x565816[_0x69ad('0x3e')])throw new Error(_0x69ad('0xa1'));if(_[_0x69ad('0xa2')](_0x208870[_0x69ad('0x5c')][_0x69ad('0xa3')])){_0x208870[_0x69ad('0x5c')][_0x69ad('0xa3')]=util[_0x69ad('0x98')](_0x69ad('0xa4'),_0x565816[_0x69ad('0x27')],_0x565816[_0x69ad('0x6f')]||_0x565816[_0x69ad('0x3e')]['user']);}if(_0x208870['body'][_0x69ad('0xa5')]&&_0x208870[_0x69ad('0x5c')][_0x69ad('0xa5')][_0x69ad('0x4b')]){for(var _0x4a2208=0x0;_0x4a2208<_0x208870[_0x69ad('0x5c')][_0x69ad('0xa5')][_0x69ad('0x4b')];_0x4a2208+=0x1){_0x208870[_0x69ad('0x5c')]['attachments'][_0x4a2208]={'filename':_0x208870['body']['attachments'][_0x4a2208]['name'],'path':path[_0x69ad('0xa6')](config[_0x69ad('0xa7')],_0x69ad('0xa8'),_0x208870[_0x69ad('0x5c')][_0x69ad('0xa5')][_0x4a2208][_0x69ad('0xa9')])};}}var _0x429c2e=_0x565816[_0x69ad('0xaa')]();return respondWithRpcPromise(_0x69ad('0xab'),_0x69ad('0xac'),{'account':_0x429c2e,'message':_0x208870['body']});})['then'](function(_0x256225){if(!_0x256225)return;_0x3f9cd4=_0x256225;if(!_0x672c5d[_0x69ad('0x9d')])throw new Error(_0x69ad('0xad'));if(_0x672c5d['List'][_0x69ad('0x9e')]['length'])return _0x672c5d[_0x69ad('0x9d')]['Contacts'][0x0];return db[_0x69ad('0x83')][_0x69ad('0x6c')](_[_0x69ad('0xa')](_0x208870[_0x69ad('0x5c')],{'firstName':_0x208870['body']['to'],'email':_0x208870[_0x69ad('0x5c')]['to'],'phone':_0x208870[_0x69ad('0x5c')]['to'],'ListId':_0x672c5d[_0x69ad('0x70')]}));})[_0x69ad('0x10')](function(_0x40d7a0){if(!_0x40d7a0)return;var _0x3233bc={'UserId':_0x208870[_0x69ad('0x3a')]['id'],'ContactId':_0x40d7a0['id'],'MailAccountId':_0x672c5d['id'],'inReplyTo':_0x3f9cd4[_0x69ad('0xae')],'to':_0x208870['body']['from'],'cc':_0x208870[_0x69ad('0x5c')]['cc'],'subject':_0x208870[_0x69ad('0x5c')][_0x69ad('0xaf')],'attach':_0x208870['body'][_0x69ad('0xb0')],'firstMsgDirection':_0x69ad('0xb1'),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x69ad('0xb1'),'Messages':[_[_0x69ad('0x51')](_0x208870[_0x69ad('0x5c')],{'messageId':_0x3f9cd4[_0x69ad('0xae')],'sentAt':moment()[_0x69ad('0x98')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x672c5d['id'],'UserId':_0x208870[_0x69ad('0x3a')]['id'],'ContactId':_0x40d7a0['id']})]};if(_0x208870['body'][_0x69ad('0xb2')]){_0x3233bc=_['merge'](_0x3233bc,_0x208870[_0x69ad('0x5c')][_0x69ad('0xb2')]);}return db[_0x69ad('0x7f')][_0x69ad('0x6c')](_0x3233bc,{'include':[{'model':db[_0x69ad('0x95')],'as':'Messages'}]});})[_0x69ad('0x10')](respondWithResult(_0x348e1b,null))[_0x69ad('0x19')](handleError(_0x348e1b,null));};exports['verifySmtp']=function(_0x2c49e9,_0x1bbe03){return db[_0x69ad('0x54')]['find']({'where':{'id':_0x2c49e9['params']['id']},'include':[{'model':db[_0x69ad('0x59')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x69ad('0xa0'),'raw':!![]}]}]})[_0x69ad('0x10')](handleEntityNotFound(_0x1bbe03,null))[_0x69ad('0x10')](function(_0xbcf673){if(!_0xbcf673[_0x69ad('0x3e')])return;var _0x95802c=_0xbcf673['getSmtpOptions']();return respondWithRpcPromise('VerifySmtp',_0x69ad('0xb3'),{'account':_0x95802c});})[_0x69ad('0x10')](respondWithResult(_0x1bbe03,null))[_0x69ad('0x19')](handleError(_0x1bbe03,null));};exports[_0x69ad('0x24')]=function(_0x37684b,_0x587ada){return db['MailAccount']['find']({'where':{'id':_0x37684b[_0x69ad('0x58')]['id']}})[_0x69ad('0x10')](handleEntityNotFound(_0x587ada,null))[_0x69ad('0x10')](function(_0x1e85a5){if(_0x1e85a5&&_0x1e85a5[_0x69ad('0x38')]){throw new db['Sequelize'][(_0x69ad('0xb4'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x1e85a5;})[_0x69ad('0x10')](removeEntity(_0x587ada,null))[_0x69ad('0x19')](handleError(_0x587ada,null));};exports[_0x69ad('0xb5')]=function(_0x16c8d8,_0x160e10){return db[_0x69ad('0x54')][_0x69ad('0x5b')]({'where':{'id':_0x16c8d8[_0x69ad('0x58')]['id']}})[_0x69ad('0x10')](handleEntityNotFound(_0x160e10,null))[_0x69ad('0x10')](function(_0xb6ce04){if(_0xb6ce04){return _0xb6ce04[_0x69ad('0xb5')](_0x16c8d8[_0x69ad('0x5c')][_0x69ad('0x69')],_[_0x69ad('0x81')](_0x16c8d8[_0x69ad('0x5c')],[_0x69ad('0x69'),'id'])||{})[_0x69ad('0xb6')](function(_0x59b044){for(var _0x394645=0x0;_0x394645<_0x16c8d8[_0x69ad('0x5c')][_0x69ad('0x69')][_0x69ad('0x4b')];_0x394645+=0x1){socket[_0x69ad('0xb7')](_0x69ad('0xb8'),{'UserId':Number(_0x16c8d8[_0x69ad('0x5c')]['ids'][_0x394645]),'MailAccountId':Number(_0x16c8d8['params']['id'])});}return _0x59b044;});}})['then'](respondWithResult(_0x160e10,null))[_0x69ad('0x19')](handleError(_0x160e10,null));};exports[_0x69ad('0xb9')]=function(_0x55f9e2,_0x38ca0b){return db['MailAccount']['find']({'where':{'id':_0x55f9e2[_0x69ad('0x58')]['id']}})[_0x69ad('0x10')](handleEntityNotFound(_0x38ca0b,null))[_0x69ad('0x10')](function(_0x53ab9a){if(_0x53ab9a){return _0x53ab9a['removeAgents'](_0x55f9e2[_0x69ad('0x45')][_0x69ad('0x69')])['then'](function(){if(_[_0x69ad('0xba')](_0x55f9e2['query'][_0x69ad('0x69')])){for(var _0x283745=0x0;_0x283745<_0x55f9e2[_0x69ad('0x45')]['ids'][_0x69ad('0x4b')];_0x283745+=0x1){socket['emit'](_0x69ad('0xbb'),{'UserId':Number(_0x55f9e2['query'][_0x69ad('0x69')][_0x283745]),'MailAccountId':Number(_0x55f9e2['params']['id'])});}}else{socket[_0x69ad('0xb7')](_0x69ad('0xbb'),{'UserId':Number(_0x55f9e2[_0x69ad('0x45')][_0x69ad('0x69')]),'MailAccountId':Number(_0x55f9e2[_0x69ad('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x38ca0b,null))[_0x69ad('0x19')](handleError(_0x38ca0b,null));};exports[_0x69ad('0xbc')]=function(_0x4ed41b,_0x1e8e70){var _0x23ebcf={};var _0x1bf7dc={};var _0x451a49;var _0x4dc20b;return db['MailAccount']['findOne']({'where':{'id':_0x4ed41b[_0x69ad('0x58')]['id']}})['then'](handleEntityNotFound(_0x1e8e70,null))[_0x69ad('0x10')](function(_0x2f74ba){if(_0x2f74ba){_0x451a49=_0x2f74ba;_0x1bf7dc[_0x69ad('0x44')]=_[_0x69ad('0x46')](db[_0x69ad('0x85')][_0x69ad('0x5a')]);_0x1bf7dc[_0x69ad('0x45')]=_[_0x69ad('0x46')](_0x4ed41b[_0x69ad('0x45')]);_0x1bf7dc[_0x69ad('0x47')]=_['intersection'](_0x1bf7dc['model'],_0x1bf7dc[_0x69ad('0x45')]);_0x23ebcf[_0x69ad('0x4a')]=_['intersection'](_0x1bf7dc[_0x69ad('0x44')],qs[_0x69ad('0x49')](_0x4ed41b[_0x69ad('0x45')][_0x69ad('0x49')]));_0x23ebcf[_0x69ad('0x4a')]=_0x23ebcf['attributes'][_0x69ad('0x4b')]?_0x23ebcf[_0x69ad('0x4a')]:_0x1bf7dc[_0x69ad('0x44')];_0x23ebcf[_0x69ad('0x66')]=qs[_0x69ad('0x4e')](_0x4ed41b['query'][_0x69ad('0x4e')]);_0x23ebcf[_0x69ad('0x4f')]=qs[_0x69ad('0x47')](_[_0x69ad('0x67')](_0x4ed41b[_0x69ad('0x45')],_0x1bf7dc[_0x69ad('0x47')]));if(_0x4ed41b[_0x69ad('0x45')][_0x69ad('0x50')]){_0x23ebcf[_0x69ad('0x4f')]=_[_0x69ad('0x51')](_0x23ebcf[_0x69ad('0x4f')],{'$or':_[_0x69ad('0x41')](_0x23ebcf[_0x69ad('0x4a')],function(_0xd91d00){var _0x1a35f6={};_0x1a35f6[_0xd91d00]={'$like':'%'+_0x4ed41b[_0x69ad('0x45')][_0x69ad('0x50')]+'%'};return _0x1a35f6;})});}_0x23ebcf=_[_0x69ad('0x51')]({},_0x23ebcf,_0x4ed41b['options']);return _0x451a49[_0x69ad('0xbc')](_0x23ebcf);}})[_0x69ad('0x10')](function(_0x2431ef){if(_0x2431ef){_0x4dc20b=_0x2431ef['length'];if(!_0x4ed41b[_0x69ad('0x45')][_0x69ad('0x4c')](_0x69ad('0x4d'))){_0x23ebcf[_0x69ad('0x20')]=qs[_0x69ad('0x20')](_0x4ed41b['query'][_0x69ad('0x20')]);_0x23ebcf[_0x69ad('0x1e')]=qs[_0x69ad('0x1e')](_0x4ed41b['query']['offset']);}return _0x451a49[_0x69ad('0xbc')](_0x23ebcf);}})['then'](function(_0x24a05f){if(_0x24a05f){return _0x24a05f?{'count':_0x4dc20b,'rows':_0x24a05f}:null;}})[_0x69ad('0x10')](respondWithResult(_0x1e8e70,null))['catch'](handleError(_0x1e8e70,null));}; \ No newline at end of file +var _0xe212=['YYYY-MM-DD\x20HH:mm:ss','messageId','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','addAgents','omit','spread','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','emit','getAgents','util','path','lodash','juice','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','then','get','UserProfileResource','stack','name','send','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','show','params','include','find','body','provider','custom','describe','addDisposition','MailAccountId','Disposition','create','findOne','includeAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','email','ListId','active','role','UserProfileSection','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','MailInteraction','addInteraction','getInteractions','CmContact','Contact','User','Owner','internal','Tags','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','finally','getApplications','getMessages','$gte','split','format','MailMessage','inlineCss','true','CmList','List','Contacts','DESC','CloudProvider','isNil','from','attachments','root','server/files/attachments','basename','getSmtpOptions','sendMail','List\x20not\x20found','subject','attach','out'];(function(_0x581abe,_0x56ed62){var _0x56a811=function(_0x3d5c97){while(--_0x3d5c97){_0x581abe['push'](_0x581abe['shift']());}};_0x56a811(++_0x56ed62);}(_0xe212,0x18a));var _0x2e21=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xe212[_0x12fc8d];return _0x3f9d04;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x2e21('0x0'));var path=require(_0x2e21('0x1'));var _=require(_0x2e21('0x2'));var juice=require(_0x2e21('0x3'));var Redis=require(_0x2e21('0x4'));var qs=require(_0x2e21('0x5'));var logger=require('../../config/logger')(_0x2e21('0x6'));var config=require(_0x2e21('0x7'));var db=require('../../mysqldb')['db'];config[_0x2e21('0x8')]=_[_0x2e21('0x9')](config[_0x2e21('0x8')],{'host':_0x2e21('0xa'),'port':0x18eb});var socket=require(_0x2e21('0xb'))(new Redis(config[_0x2e21('0x8')]));require(_0x2e21('0xc'))[_0x2e21('0xd')](socket);var jayson=require(_0x2e21('0xe'));var client=jayson[_0x2e21('0xf')][_0x2e21('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x5a8c2b,_0x256f84,_0x4f1444,_0x33c11d){return new BPromise(function(_0x11e0d0,_0x27630e){var _0x1303c3=_0x33c11d||client;return _0x1303c3[_0x2e21('0x11')](_0x5a8c2b,_0x4f1444)['then'](function(_0x15687e){logger[_0x2e21('0x12')](_0x2e21('0x13'),_0x256f84,_0x2e21('0x14'));logger['debug'](_0x2e21('0x15'),_0x256f84,_0x2e21('0x14'),JSON[_0x2e21('0x16')](_0x15687e));if(_0x15687e[_0x2e21('0x17')]){if(_0x15687e[_0x2e21('0x17')][_0x2e21('0x18')]===0x1f4){logger[_0x2e21('0x17')]('MailAccount,\x20%s,\x20%s',_0x256f84,_0x15687e[_0x2e21('0x17')][_0x2e21('0x19')]);return _0x27630e(_0x15687e['error'][_0x2e21('0x19')]);}logger[_0x2e21('0x17')](_0x2e21('0x13'),_0x256f84,_0x15687e['error'][_0x2e21('0x19')]);return _0x11e0d0(_0x15687e['error'][_0x2e21('0x19')]);}else{logger[_0x2e21('0x12')](_0x2e21('0x13'),_0x256f84,'request\x20sent');_0x11e0d0(_0x15687e['result']['message']);}})[_0x2e21('0x1a')](function(_0x5bff6c){logger[_0x2e21('0x17')](_0x2e21('0x13'),_0x256f84,_0x5bff6c);_0x27630e(_0x5bff6c);});});}function respondWithStatusCode(_0x5da0e8,_0x220a1c){_0x220a1c=_0x220a1c||0xcc;return function(_0x2c4054){if(_0x2c4054){return _0x5da0e8[_0x2e21('0x1b')](_0x220a1c);}return _0x5da0e8[_0x2e21('0x1c')](_0x220a1c)[_0x2e21('0x1d')]();};}function respondWithResult(_0x3703ff,_0x4f522a){_0x4f522a=_0x4f522a||0xc8;return function(_0x3fbaff){if(_0x3fbaff){return _0x3703ff[_0x2e21('0x1c')](_0x4f522a)[_0x2e21('0x1e')](_0x3fbaff);}};}function respondWithFilteredResult(_0x38da79,_0x10b73b){return function(_0x2eb253){if(_0x2eb253){var _0x511c3a=typeof _0x10b73b[_0x2e21('0x1f')]==='undefined'&&typeof _0x10b73b['limit']===_0x2e21('0x20');var _0x3593d5=_0x2eb253[_0x2e21('0x21')];var _0x35ad6c=_0x511c3a?0x0:_0x10b73b[_0x2e21('0x1f')];var _0x8f757=_0x511c3a?_0x2eb253['count']:_0x10b73b[_0x2e21('0x1f')]+_0x10b73b[_0x2e21('0x22')];var _0x154067;if(_0x8f757>=_0x3593d5){_0x8f757=_0x3593d5;_0x154067=0xc8;}else{_0x154067=0xce;}_0x38da79[_0x2e21('0x1c')](_0x154067);return _0x38da79[_0x2e21('0x23')](_0x2e21('0x24'),_0x35ad6c+'-'+_0x8f757+'/'+_0x3593d5)[_0x2e21('0x1e')](_0x2eb253);}return null;};}function saveUpdates(_0x354353){return function(_0x5a7d29){if(_0x5a7d29){return _0x5a7d29[_0x2e21('0x25')](_0x354353)['then'](function(_0x2dd6de){return _0x2dd6de;});}return null;};}function removeEntity(_0x48f2de){return function(_0x30efa3){if(_0x30efa3){return _0x30efa3[_0x2e21('0x26')]()[_0x2e21('0x27')](function(){var _0x113f83=_0x30efa3[_0x2e21('0x28')]({'plain':!![]});var _0xe0a1a2='MailAccounts';return db[_0x2e21('0x29')][_0x2e21('0x26')]({'where':{'type':_0xe0a1a2,'resourceId':_0x113f83['id']}})[_0x2e21('0x27')](function(){return _0x30efa3;});})[_0x2e21('0x27')](function(){_0x48f2de['status'](0xcc)[_0x2e21('0x1d')]();});}};}function handleEntityNotFound(_0x5026aa){return function(_0x134f22){if(!_0x134f22){_0x5026aa[_0x2e21('0x1b')](0x194);}return _0x134f22;};}function handleError(_0x57cb39,_0x2b4230){_0x2b4230=_0x2b4230||0x1f4;return function(_0x45b8f2){logger[_0x2e21('0x17')](_0x45b8f2[_0x2e21('0x2a')]);if(_0x45b8f2[_0x2e21('0x2b')]){delete _0x45b8f2[_0x2e21('0x2b')];}_0x57cb39[_0x2e21('0x1c')](_0x2b4230)[_0x2e21('0x2c')](_0x45b8f2);};}function getImapHost(_0x183170){switch(_0x183170){case'gmail':return _0x2e21('0x2d');case _0x2e21('0x2e'):return _0x2e21('0x2f');case _0x2e21('0x30'):return _0x2e21('0x31');case _0x2e21('0x32'):return _0x2e21('0x33');}throw new Error(_0x2e21('0x34'),_0x183170);}function getSmtpHost(_0x52ee32){switch(_0x52ee32){case'gmail':return'smtp.gmail.com';case'yahoo':return'smtp.mail.yahoo.com';case _0x2e21('0x30'):return _0x2e21('0x35');case _0x2e21('0x32'):return _0x2e21('0x36');}throw new Error('Unknown\x20email\x20service\x20provider',_0x52ee32);}function getAuthenticationOptions(_0x3f6716,_0x4c562a){var _0x2d2203={};var _0x26ef71={};if(_0x3f6716){_0x2d2203[_0x2e21('0x37')]=_0x26ef71[_0x2e21('0x37')]=_0x4c562a[_0x2e21('0x38')];_0x2d2203[_0x2e21('0x39')]=_0x26ef71[_0x2e21('0x3a')]=_0x4c562a[_0x2e21('0x39')];if(_0x4c562a['modernAuthentication']){_0x2d2203['modernAuthentication']=_0x26ef71[_0x2e21('0x3b')]=!![];_0x2d2203['CloudProviderId']=_0x26ef71[_0x2e21('0x3c')]=_0x4c562a[_0x2e21('0x3c')];_0x2d2203[_0x2e21('0x39')]=_0x26ef71[_0x2e21('0x3a')]=null;}else{_0x2d2203[_0x2e21('0x3c')]=_0x26ef71[_0x2e21('0x3c')]=null;}_0x2d2203[_0x2e21('0x3d')]=getImapHost(_0x3f6716);_0x2d2203[_0x2e21('0x3e')]=0x3e1;_0x26ef71[_0x2e21('0x3d')]=getSmtpHost(_0x3f6716);_0x26ef71[_0x2e21('0x3e')]=0x24b;_0x26ef71[_0x2e21('0x3f')]=![];_0x2d2203[_0x2e21('0x40')]=_0x26ef71[_0x2e21('0x40')]=null;}else{if(_0x4c562a['authentication']){_0x2d2203[_0x2e21('0x37')]=_0x26ef71[_0x2e21('0x37')]=_0x4c562a[_0x2e21('0x38')];_0x2d2203[_0x2e21('0x39')]=_0x26ef71[_0x2e21('0x3a')]=_0x4c562a[_0x2e21('0x39')];}else{_0x2d2203[_0x2e21('0x41')]=_0x26ef71[_0x2e21('0x41')]=![];_0x2d2203[_0x2e21('0x37')]=_0x26ef71[_0x2e21('0x37')]=null;_0x2d2203['password']=_0x26ef71[_0x2e21('0x3a')]=null;}_0x2d2203['host']=_0x4c562a['Imap'][_0x2e21('0x3d')];_0x2d2203['port']=_0x4c562a[_0x2e21('0x42')][_0x2e21('0x3e')];_0x26ef71['host']=_0x4c562a[_0x2e21('0x43')][_0x2e21('0x3d')];_0x26ef71[_0x2e21('0x3e')]=_0x4c562a[_0x2e21('0x43')][_0x2e21('0x3e')];}return{'Imap':_0x2d2203,'Smtp':_0x26ef71};}exports[_0x2e21('0x44')]=function(_0x14edc4,_0x5af0b9){var _0x152170={'include':[{'model':db[_0x2e21('0x45')],'as':_0x2e21('0x42')},{'model':db[_0x2e21('0x46')],'as':_0x2e21('0x43')},{'model':db[_0x2e21('0x47')],'as':_0x2e21('0x48')}]},_0x3e5cc6={},_0x314410={'count':0x0,'rows':[]};var _0x287af4=_[_0x2e21('0x49')](db[_0x2e21('0x4a')][_0x2e21('0x4b')],function(_0x118fd8){return{'name':_0x118fd8[_0x2e21('0x4c')],'type':_0x118fd8[_0x2e21('0x4d')][_0x2e21('0x4e')]};});_0x3e5cc6[_0x2e21('0x4f')]=_[_0x2e21('0x49')](_0x287af4,_0x2e21('0x2b'));_0x3e5cc6[_0x2e21('0x50')]=_[_0x2e21('0x51')](_0x14edc4[_0x2e21('0x50')]);_0x3e5cc6[_0x2e21('0x52')]=_[_0x2e21('0x53')](_0x3e5cc6[_0x2e21('0x4f')],_0x3e5cc6[_0x2e21('0x50')]);_0x152170[_0x2e21('0x54')]=_[_0x2e21('0x53')](_0x3e5cc6[_0x2e21('0x4f')],qs[_0x2e21('0x55')](_0x14edc4[_0x2e21('0x50')][_0x2e21('0x55')]));_0x152170[_0x2e21('0x54')]=_0x152170[_0x2e21('0x54')][_0x2e21('0x56')]?_0x152170[_0x2e21('0x54')]:_0x3e5cc6[_0x2e21('0x4f')];if(!_0x14edc4['query'][_0x2e21('0x57')](_0x2e21('0x58'))){_0x152170['limit']=qs[_0x2e21('0x22')](_0x14edc4[_0x2e21('0x50')][_0x2e21('0x22')]);_0x152170['offset']=qs[_0x2e21('0x1f')](_0x14edc4['query'][_0x2e21('0x1f')]);}_0x152170[_0x2e21('0x59')]=qs[_0x2e21('0x5a')](_0x14edc4['query'][_0x2e21('0x5a')]);_0x152170[_0x2e21('0x5b')]=qs[_0x2e21('0x52')](_[_0x2e21('0x5c')](_0x14edc4[_0x2e21('0x50')],_0x3e5cc6[_0x2e21('0x52')]),_0x287af4);if(_0x14edc4['query']['filter']){_0x152170[_0x2e21('0x5b')]=_[_0x2e21('0x5d')](_0x152170[_0x2e21('0x5b')],{'$or':_[_0x2e21('0x49')](_0x287af4,function(_0x4b9b55){if(_0x4b9b55[_0x2e21('0x4d')]!==_0x2e21('0x5e')){var _0x125dda={};_0x125dda[_0x4b9b55[_0x2e21('0x2b')]]={'$like':'%'+_0x14edc4[_0x2e21('0x50')][_0x2e21('0x5f')]+'%'};return _0x125dda;}})});}_0x152170=_[_0x2e21('0x5d')]({},_0x152170,_0x14edc4[_0x2e21('0x60')]);var _0x47a55d={'where':_0x152170['where']};return db[_0x2e21('0x4a')][_0x2e21('0x21')](_0x47a55d)[_0x2e21('0x27')](function(_0x5d8b48){_0x314410['count']=_0x5d8b48;if(_0x14edc4[_0x2e21('0x50')]['includeAll']){_0x152170['include']=[{'all':!![]}];}return db[_0x2e21('0x4a')][_0x2e21('0x61')](_0x152170);})['then'](function(_0x31f218){_0x314410['rows']=_0x31f218;return _0x314410;})[_0x2e21('0x27')](respondWithFilteredResult(_0x5af0b9,_0x152170))['catch'](handleError(_0x5af0b9,null));};exports[_0x2e21('0x62')]=function(_0x2ef200,_0x1abdbd){var _0x160f7d={'raw':![],'where':{'id':_0x2ef200[_0x2e21('0x63')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x2e21('0x42')},{'model':db[_0x2e21('0x46')],'as':_0x2e21('0x43')},{'model':db[_0x2e21('0x47')],'as':_0x2e21('0x48')}]},_0x3cec57={};_0x3cec57['model']=_['keys'](db[_0x2e21('0x4a')][_0x2e21('0x4b')]);_0x3cec57[_0x2e21('0x50')]=_[_0x2e21('0x51')](_0x2ef200[_0x2e21('0x50')]);_0x3cec57[_0x2e21('0x52')]=_[_0x2e21('0x53')](_0x3cec57['model'],_0x3cec57['query']);_0x160f7d[_0x2e21('0x54')]=_[_0x2e21('0x53')](_0x3cec57[_0x2e21('0x4f')],qs[_0x2e21('0x55')](_0x2ef200[_0x2e21('0x50')][_0x2e21('0x55')]));_0x160f7d[_0x2e21('0x54')]=_0x160f7d[_0x2e21('0x54')][_0x2e21('0x56')]?_0x160f7d[_0x2e21('0x54')]:_0x3cec57['model'];if(_0x2ef200[_0x2e21('0x50')]['includeAll']){_0x160f7d[_0x2e21('0x64')]=[{'all':!![]}];}_0x160f7d=_['merge']({},_0x160f7d,_0x2ef200[_0x2e21('0x60')]);return db[_0x2e21('0x4a')][_0x2e21('0x65')](_0x160f7d)[_0x2e21('0x27')](handleEntityNotFound(_0x1abdbd,null))[_0x2e21('0x27')](respondWithResult(_0x1abdbd,null))[_0x2e21('0x1a')](handleError(_0x1abdbd,null));};exports[_0x2e21('0x25')]=function(_0x4bd24b,_0x422f61){if(_0x4bd24b[_0x2e21('0x66')]['id']){delete _0x4bd24b[_0x2e21('0x66')]['id'];}var _0x58ece9=_0x4bd24b[_0x2e21('0x66')][_0x2e21('0x67')]===_0x2e21('0x68')?null:_0x4bd24b[_0x2e21('0x66')][_0x2e21('0x67')];var _0x1a7571=_0x4bd24b[_0x2e21('0x66')][_0x2e21('0x42')]||{};var _0x2b83d7=_0x4bd24b['body'][_0x2e21('0x43')]||{};if(_0x58ece9){_0x1a7571['host']=getImapHost(_0x58ece9);_0x1a7571['port']=0x3e1;_0x2b83d7[_0x2e21('0x3d')]=getSmtpHost(_0x58ece9);_0x2b83d7[_0x2e21('0x3e')]=0x24b;_0x2b83d7[_0x2e21('0x3f')]=![];}if(_0x2b83d7[_0x2e21('0x3b')]){_0x2b83d7[_0x2e21('0x3f')]=![];}else{_0x2b83d7[_0x2e21('0x3c')]=null;}if(!_0x1a7571[_0x2e21('0x3b')])_0x1a7571[_0x2e21('0x3c')]=null;_0x4bd24b[_0x2e21('0x66')][_0x2e21('0x42')]=_0x1a7571;_0x4bd24b[_0x2e21('0x66')]['Smtp']=_0x2b83d7;return db['MailAccount'][_0x2e21('0x65')]({'where':{'id':_0x4bd24b[_0x2e21('0x63')]['id']},'include':[{'model':db[_0x2e21('0x45')],'as':_0x2e21('0x42')},{'model':db[_0x2e21('0x46')],'as':_0x2e21('0x43')},{'model':db[_0x2e21('0x47')],'as':_0x2e21('0x48')}]})[_0x2e21('0x27')](handleEntityNotFound(_0x422f61,null))['then'](function(_0x3e6240){if(!_0x3e6240)throw new Error('Mail\x20Account\x20not\x20found');if(_0x3e6240[_0x2e21('0x40')])delete _0x4bd24b[_0x2e21('0x66')][_0x2e21('0x42')];return _0x3e6240;})[_0x2e21('0x27')](saveUpdates(_0x4bd24b['body'],null))[_0x2e21('0x27')](function(_0xcb8a00){if(!_0x4bd24b[_0x2e21('0x66')][_0x2e21('0x42')])return _0xcb8a00;return db[_0x2e21('0x45')][_0x2e21('0x25')](_0x4bd24b[_0x2e21('0x66')][_0x2e21('0x42')],{'where':{'MailAccountId':_0xcb8a00['id']}})[_0x2e21('0x27')](function(){return _0xcb8a00;});})[_0x2e21('0x27')](function(_0x2006f3){if(!_0x4bd24b[_0x2e21('0x66')]['Smtp'])return _0x2006f3;return db['MailServerOut'][_0x2e21('0x25')](_0x4bd24b[_0x2e21('0x66')][_0x2e21('0x43')],{'where':{'MailAccountId':_0x2006f3['id']}})[_0x2e21('0x27')](function(){return _0x2006f3;});})[_0x2e21('0x27')](respondWithResult(_0x422f61,null))['catch'](handleError(_0x422f61,null));};exports[_0x2e21('0x69')]=function(_0x9197d4,_0x56b751){return db[_0x2e21('0x4a')][_0x2e21('0x69')]()[_0x2e21('0x27')](respondWithResult(_0x56b751,null))[_0x2e21('0x1a')](handleError(_0x56b751,null));};exports[_0x2e21('0x6a')]=function(_0x213172,_0x181407){if(_0x213172[_0x2e21('0x66')]['id']){delete _0x213172[_0x2e21('0x66')]['id'];}return db[_0x2e21('0x4a')][_0x2e21('0x65')]({'where':{'id':_0x213172[_0x2e21('0x63')]['id']}})['then'](handleEntityNotFound(_0x181407,null))[_0x2e21('0x27')](function(_0x54159d){if(_0x54159d){_0x213172[_0x2e21('0x66')][_0x2e21('0x6b')]=_0x54159d['id'];return db[_0x2e21('0x6c')][_0x2e21('0x6d')](_0x213172[_0x2e21('0x66')]);}})[_0x2e21('0x27')](respondWithResult(_0x181407,null))['catch'](handleError(_0x181407,null));};exports['getDispositions']=function(_0x20f733,_0xdcc863){var _0x2fd456={'raw':![],'where':{}};var _0x1668c0={};var _0x2d26c7={'count':0x0,'rows':[]};return db[_0x2e21('0x4a')][_0x2e21('0x6e')]({'where':{'id':_0x20f733['params']['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0xdcc863,null))[_0x2e21('0x27')](function(_0x394843){if(_0x394843){_0x1668c0[_0x2e21('0x4f')]=_['keys'](db[_0x2e21('0x6c')][_0x2e21('0x4b')]);_0x1668c0[_0x2e21('0x50')]=_[_0x2e21('0x51')](_0x20f733[_0x2e21('0x50')]);_0x1668c0[_0x2e21('0x52')]=_[_0x2e21('0x53')](_0x1668c0[_0x2e21('0x4f')],_0x1668c0['query']);_0x2fd456[_0x2e21('0x54')]=_[_0x2e21('0x53')](_0x1668c0[_0x2e21('0x4f')],qs[_0x2e21('0x55')](_0x20f733[_0x2e21('0x50')][_0x2e21('0x55')]));_0x2fd456[_0x2e21('0x54')]=_0x2fd456['attributes'][_0x2e21('0x56')]?_0x2fd456[_0x2e21('0x54')]:_0x1668c0['model'];if(!_0x20f733[_0x2e21('0x50')][_0x2e21('0x57')](_0x2e21('0x58'))){_0x2fd456[_0x2e21('0x22')]=qs[_0x2e21('0x22')](_0x20f733[_0x2e21('0x50')][_0x2e21('0x22')]);_0x2fd456[_0x2e21('0x1f')]=qs[_0x2e21('0x1f')](_0x20f733['query']['offset']);}_0x2fd456[_0x2e21('0x59')]=qs[_0x2e21('0x5a')](_0x20f733[_0x2e21('0x50')][_0x2e21('0x5a')]);_0x2fd456['where']=qs[_0x2e21('0x52')](_[_0x2e21('0x5c')](_0x20f733['query'],_0x1668c0[_0x2e21('0x52')]));_0x2fd456[_0x2e21('0x5b')][_0x2e21('0x6b')]=_0x394843['id'];if(_0x20f733[_0x2e21('0x50')][_0x2e21('0x5f')]){_0x2fd456[_0x2e21('0x5b')]=_[_0x2e21('0x5d')](_0x2fd456['where'],{'$or':_['map'](_0x2fd456[_0x2e21('0x54')],function(_0xb68f55){var _0x26567f={};_0x26567f[_0xb68f55]={'$like':'%'+_0x20f733[_0x2e21('0x50')][_0x2e21('0x5f')]+'%'};return _0x26567f;})});}_0x2fd456=_[_0x2e21('0x5d')]({},_0x2fd456,_0x20f733[_0x2e21('0x60')]);return db[_0x2e21('0x6c')][_0x2e21('0x21')]({'where':_0x2fd456['where']})[_0x2e21('0x27')](function(_0x27d4e2){_0x2d26c7[_0x2e21('0x21')]=_0x27d4e2;if(_0x20f733[_0x2e21('0x50')][_0x2e21('0x6f')]){_0x2fd456['include']=[{'all':!![]}];}return db[_0x2e21('0x6c')]['findAll'](_0x2fd456);})[_0x2e21('0x27')](function(_0x12012a){_0x2d26c7[_0x2e21('0x70')]=_0x12012a;return _0x2d26c7;});}})[_0x2e21('0x27')](respondWithFilteredResult(_0xdcc863,_0x2fd456))['catch'](handleError(_0xdcc863,null));};exports[_0x2e21('0x71')]=function(_0x29c49a,_0x4c4731){return db[_0x2e21('0x4a')]['find']({'where':{'id':_0x29c49a[_0x2e21('0x63')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x4c4731,null))[_0x2e21('0x27')](function(_0x1ff848){if(_0x1ff848){return _0x1ff848[_0x2e21('0x71')](_0x29c49a['query'][_0x2e21('0x72')]);}})[_0x2e21('0x27')](respondWithStatusCode(_0x4c4731,null))[_0x2e21('0x1a')](handleError(_0x4c4731,null));};exports[_0x2e21('0x73')]=function(_0xdc5ec,_0x513b4a){if(_0xdc5ec[_0x2e21('0x66')]['id']){delete _0xdc5ec[_0x2e21('0x66')]['id'];}return db[_0x2e21('0x4a')][_0x2e21('0x65')]({'where':{'id':_0xdc5ec[_0x2e21('0x63')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x513b4a,null))[_0x2e21('0x27')](function(_0x253348){if(_0x253348){_0xdc5ec[_0x2e21('0x66')][_0x2e21('0x6b')]=_0x253348['id'];return db[_0x2e21('0x74')][_0x2e21('0x6d')](_0xdc5ec[_0x2e21('0x66')]);}})[_0x2e21('0x27')](respondWithResult(_0x513b4a,null))[_0x2e21('0x1a')](handleError(_0x513b4a,null));};exports[_0x2e21('0x75')]=function(_0x361f65,_0x44fc28){var _0x29b088={'raw':![],'where':{}};var _0x14c513={};var _0xb1db2c={'count':0x0,'rows':[]};return db[_0x2e21('0x4a')][_0x2e21('0x6e')]({'where':{'id':_0x361f65[_0x2e21('0x63')]['id']}})['then'](handleEntityNotFound(_0x44fc28,null))[_0x2e21('0x27')](function(_0x4b18d2){if(_0x4b18d2){_0x14c513[_0x2e21('0x4f')]=_[_0x2e21('0x51')](db[_0x2e21('0x74')]['rawAttributes']);_0x14c513[_0x2e21('0x50')]=_[_0x2e21('0x51')](_0x361f65['query']);_0x14c513[_0x2e21('0x52')]=_['intersection'](_0x14c513[_0x2e21('0x4f')],_0x14c513[_0x2e21('0x50')]);_0x29b088['attributes']=_[_0x2e21('0x53')](_0x14c513[_0x2e21('0x4f')],qs[_0x2e21('0x55')](_0x361f65[_0x2e21('0x50')][_0x2e21('0x55')]));_0x29b088['attributes']=_0x29b088['attributes']['length']?_0x29b088[_0x2e21('0x54')]:_0x14c513[_0x2e21('0x4f')];if(!_0x361f65[_0x2e21('0x50')][_0x2e21('0x57')](_0x2e21('0x58'))){_0x29b088[_0x2e21('0x22')]=qs[_0x2e21('0x22')](_0x361f65[_0x2e21('0x50')][_0x2e21('0x22')]);_0x29b088[_0x2e21('0x1f')]=qs['offset'](_0x361f65[_0x2e21('0x50')][_0x2e21('0x1f')]);}_0x29b088[_0x2e21('0x59')]=qs['sort'](_0x361f65[_0x2e21('0x50')][_0x2e21('0x5a')]);_0x29b088[_0x2e21('0x5b')]=qs['filters'](_['pick'](_0x361f65['query'],_0x14c513[_0x2e21('0x52')]));_0x29b088['where'][_0x2e21('0x6b')]=_0x4b18d2['id'];if(_0x361f65[_0x2e21('0x50')][_0x2e21('0x5f')]){_0x29b088[_0x2e21('0x5b')]=_[_0x2e21('0x5d')](_0x29b088[_0x2e21('0x5b')],{'$or':_['map'](_0x29b088[_0x2e21('0x54')],function(_0x31bfac){var _0x115f9a={};_0x115f9a[_0x31bfac]={'$like':'%'+_0x361f65['query'][_0x2e21('0x5f')]+'%'};return _0x115f9a;})});}_0x29b088=_['merge']({},_0x29b088,_0x361f65['options']);return db[_0x2e21('0x74')][_0x2e21('0x21')]({'where':_0x29b088[_0x2e21('0x5b')]})[_0x2e21('0x27')](function(_0x284e01){_0xb1db2c[_0x2e21('0x21')]=_0x284e01;if(_0x361f65[_0x2e21('0x50')][_0x2e21('0x6f')]){_0x29b088[_0x2e21('0x64')]=[{'all':!![]}];}return db[_0x2e21('0x74')]['findAll'](_0x29b088);})['then'](function(_0x5f4a6d){_0xb1db2c[_0x2e21('0x70')]=_0x5f4a6d;return _0xb1db2c;});}})[_0x2e21('0x27')](respondWithFilteredResult(_0x44fc28,_0x29b088))[_0x2e21('0x1a')](handleError(_0x44fc28,null));};exports['removeAnswers']=function(_0x3367f0,_0x3c4145){return db[_0x2e21('0x4a')]['find']({'where':{'id':_0x3367f0[_0x2e21('0x63')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x3c4145,null))[_0x2e21('0x27')](function(_0x1a6e68){if(_0x1a6e68){return _0x1a6e68['removeAnswers'](_0x3367f0[_0x2e21('0x50')][_0x2e21('0x72')]);}})['then'](respondWithStatusCode(_0x3c4145,null))[_0x2e21('0x1a')](handleError(_0x3c4145,null));};exports[_0x2e21('0x6d')]=function(_0x1b944c,_0x21177e){var _0x31a6a6={'name':_0x1b944c[_0x2e21('0x66')][_0x2e21('0x2b')],'key':_0x1b944c[_0x2e21('0x66')]['key'],'provider':_0x1b944c['body'][_0x2e21('0x67')]===_0x2e21('0x68')?null:_0x1b944c['body'][_0x2e21('0x67')],'email':_0x1b944c[_0x2e21('0x66')][_0x2e21('0x76')],'ListId':_0x1b944c['body'][_0x2e21('0x77')],'active':!_['isNil'](_0x1b944c[_0x2e21('0x66')][_0x2e21('0x78')])?_0x1b944c[_0x2e21('0x66')]['active']:!![],'description':_0x1b944c[_0x2e21('0x66')]['description']||null};var _0x44a458=getAuthenticationOptions(_0x31a6a6['provider'],_0x1b944c[_0x2e21('0x66')]);_0x31a6a6[_0x2e21('0x42')]=_0x44a458['Imap'];_0x31a6a6[_0x2e21('0x43')]=_0x44a458[_0x2e21('0x43')];return db[_0x2e21('0x4a')][_0x2e21('0x6d')](_0x31a6a6,{'include':[{'model':db[_0x2e21('0x46')],'as':_0x2e21('0x43')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0x2e21('0x27')](function(_0x37c7a9){var _0x33f061=_0x1b944c[_0x2e21('0x37')]['get']({'plain':!![]});if(!_0x33f061)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33f061[_0x2e21('0x79')]===_0x2e21('0x37')){var _0x148424=_0x37c7a9[_0x2e21('0x28')]({'plain':!![]});return db[_0x2e21('0x7a')][_0x2e21('0x65')]({'where':{'name':'MailAccounts','userProfileId':_0x33f061['userProfileId']},'raw':!![]})['then'](function(_0x1aa8a3){if(_0x1aa8a3&&_0x1aa8a3['autoAssociation']===0x0){return db[_0x2e21('0x29')][_0x2e21('0x6d')]({'name':_0x148424[_0x2e21('0x2b')],'resourceId':_0x148424['id'],'type':_0x1aa8a3[_0x2e21('0x2b')],'sectionId':_0x1aa8a3['id']},{})[_0x2e21('0x27')](function(){return _0x37c7a9;});}else{return _0x37c7a9;}})[_0x2e21('0x1a')](function(_0x372b21){logger[_0x2e21('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x372b21);throw _0x372b21;});}return _0x37c7a9;})[_0x2e21('0x27')](respondWithResult(_0x21177e,0xc9))[_0x2e21('0x1a')](handleError(_0x21177e,null));};exports[_0x2e21('0x7b')]=function(_0x852a37,_0xec28aa){return db[_0x2e21('0x4a')][_0x2e21('0x6e')]({'where':{'id':_0x852a37[_0x2e21('0x63')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0xec28aa,null))[_0x2e21('0x27')](function(_0x2e5ab0){if(_0x2e5ab0){return _0x2e5ab0[_0x2e21('0x7b')]();}return null;})[_0x2e21('0x27')](respondWithResult(_0xec28aa,null))[_0x2e21('0x1a')](handleError(_0xec28aa,null));};exports[_0x2e21('0x7c')]=function(_0x1c6bd3,_0x131b98){if(_0x1c6bd3[_0x2e21('0x66')]['id']){delete _0x1c6bd3[_0x2e21('0x66')]['id'];}return db[_0x2e21('0x4a')][_0x2e21('0x65')]({'where':{'id':_0x1c6bd3[_0x2e21('0x63')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x131b98,null))['then'](function(_0x3c0e73){if(_0x3c0e73){_0x1c6bd3['body']['MailAccountId']=_0x3c0e73['id'];return db[_0x2e21('0x45')][_0x2e21('0x6d')](_0x1c6bd3[_0x2e21('0x66')]);}})[_0x2e21('0x27')](respondWithResult(_0x131b98,null))[_0x2e21('0x1a')](handleError(_0x131b98,null));};exports[_0x2e21('0x7d')]=function(_0x1b90b2,_0xcb50ce){return db[_0x2e21('0x4a')][_0x2e21('0x6e')]({'where':{'id':_0x1b90b2[_0x2e21('0x63')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0xcb50ce,null))[_0x2e21('0x27')](function(_0x415d74){if(_0x415d74){return _0x415d74[_0x2e21('0x7e')](null);}return null;})[_0x2e21('0x27')](respondWithStatusCode(_0xcb50ce,null))[_0x2e21('0x1a')](handleError(_0xcb50ce,null));};exports['getSmtp']=function(_0x43ddcb,_0x213fbe){return db['MailAccount'][_0x2e21('0x6e')]({'where':{'id':_0x43ddcb['params']['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x213fbe,null))[_0x2e21('0x27')](function(_0x56a741){if(_0x56a741){return _0x56a741[_0x2e21('0x7f')]();}return null;})[_0x2e21('0x27')](respondWithResult(_0x213fbe,null))[_0x2e21('0x1a')](handleError(_0x213fbe,null));};exports[_0x2e21('0x80')]=function(_0x5a31c4,_0xf2070e){if(_0x5a31c4[_0x2e21('0x66')]['id']){delete _0x5a31c4['body']['id'];}return db['MailAccount'][_0x2e21('0x65')]({'where':{'id':_0x5a31c4['params']['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0xf2070e,null))[_0x2e21('0x27')](function(_0x4fb06e){if(_0x4fb06e){_0x5a31c4[_0x2e21('0x66')][_0x2e21('0x6b')]=_0x4fb06e['id'];return db[_0x2e21('0x46')]['create'](_0x5a31c4[_0x2e21('0x66')]);}})[_0x2e21('0x27')](respondWithResult(_0xf2070e,null))[_0x2e21('0x1a')](handleError(_0xf2070e,null));};exports[_0x2e21('0x81')]=function(_0x42fa27,_0x288c47){return db[_0x2e21('0x4a')][_0x2e21('0x6e')]({'where':{'id':_0x42fa27[_0x2e21('0x63')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x288c47,null))[_0x2e21('0x27')](function(_0x256160){if(_0x256160){return _0x256160['setSmtp'](null);}return null;})[_0x2e21('0x27')](respondWithStatusCode(_0x288c47,null))['catch'](handleError(_0x288c47,null));};exports['addInteraction']=function(_0x41bc20,_0x35016a){return db[_0x2e21('0x82')]['find']({'where':{'id':_0x41bc20[_0x2e21('0x63')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x35016a,null))['then'](function(_0xe59f72){if(_0xe59f72){return _0xe59f72[_0x2e21('0x83')](_0x41bc20['body']['ids'],_['omit'](_0x41bc20[_0x2e21('0x66')],[_0x2e21('0x72'),'id'])||{});}})[_0x2e21('0x27')](respondWithResult(_0x35016a,null))['catch'](handleError(_0x35016a,null));};exports[_0x2e21('0x84')]=function(_0x244d97,_0x2b3fd2){var _0x5e2975={'raw':![],'where':{}};var _0x39c34d={};var _0x21e326={'count':0x0,'rows':[]};return db[_0x2e21('0x4a')][_0x2e21('0x6e')]({'where':{'id':_0x244d97['params']['id']}})['then'](handleEntityNotFound(_0x2b3fd2,null))[_0x2e21('0x27')](function(_0x2a7af9){if(_0x2a7af9){_0x39c34d[_0x2e21('0x4f')]=_['keys'](db['MailInteraction'][_0x2e21('0x4b')]);_0x39c34d['query']=_['keys'](_0x244d97[_0x2e21('0x50')]);_0x39c34d[_0x2e21('0x52')]=_['intersection'](_0x39c34d[_0x2e21('0x4f')],_0x39c34d[_0x2e21('0x50')]);_0x5e2975[_0x2e21('0x54')]=_['intersection'](_0x39c34d[_0x2e21('0x4f')],qs[_0x2e21('0x55')](_0x244d97[_0x2e21('0x50')][_0x2e21('0x55')]));_0x5e2975[_0x2e21('0x54')]=_0x5e2975['attributes'][_0x2e21('0x56')]?_0x5e2975['attributes']:_0x39c34d[_0x2e21('0x4f')];if(!_0x244d97['query'][_0x2e21('0x57')](_0x2e21('0x58'))){_0x5e2975['limit']=qs[_0x2e21('0x22')](_0x244d97[_0x2e21('0x50')][_0x2e21('0x22')]);_0x5e2975['offset']=qs[_0x2e21('0x1f')](_0x244d97['query']['offset']);}_0x5e2975[_0x2e21('0x59')]=qs[_0x2e21('0x5a')](_0x244d97['query'][_0x2e21('0x5a')]);_0x5e2975[_0x2e21('0x5b')]=qs[_0x2e21('0x52')](_['pick'](_0x244d97[_0x2e21('0x50')],_0x39c34d[_0x2e21('0x52')]));_0x5e2975[_0x2e21('0x5b')]['MailAccountId']=_0x2a7af9['id'];if(_0x244d97['query'][_0x2e21('0x5f')]){_0x5e2975[_0x2e21('0x5b')]=_[_0x2e21('0x5d')](_0x5e2975[_0x2e21('0x5b')],{'$or':_[_0x2e21('0x49')](_0x5e2975[_0x2e21('0x54')],function(_0x581cad){var _0x1f5df4={};_0x1f5df4[_0x581cad]={'$like':'%'+_0x244d97[_0x2e21('0x50')]['filter']+'%'};return _0x1f5df4;})});}_0x5e2975=_['merge']({},_0x5e2975,_0x244d97[_0x2e21('0x60')]);return db[_0x2e21('0x82')]['count']({'where':_0x5e2975[_0x2e21('0x5b')]})[_0x2e21('0x27')](function(_0x1b0ad8){_0x21e326[_0x2e21('0x21')]=_0x1b0ad8;if(_0x244d97[_0x2e21('0x50')][_0x2e21('0x6f')]){_0x5e2975[_0x2e21('0x64')]=[{'model':db[_0x2e21('0x85')],'as':_0x2e21('0x86'),'required':![]},{'model':db[_0x2e21('0x87')],'as':_0x2e21('0x88'),'attributes':['name','fullname',_0x2e21('0x89')],'required':![]},{'model':db['Tag'],'as':_0x2e21('0x8a'),'attributes':['id',_0x2e21('0x2b'),'color'],'where':_0x244d97[_0x2e21('0x50')]['tag']?{'id':_0x244d97[_0x2e21('0x50')][_0x2e21('0x8b')]}:undefined,'required':_0x244d97[_0x2e21('0x50')][_0x2e21('0x8b')]?!![]:![]}];}return db[_0x2e21('0x82')][_0x2e21('0x61')](_0x5e2975);})['then'](function(_0x154a34){_0x21e326[_0x2e21('0x70')]=_0x154a34;return _0x21e326;});}})['then'](respondWithFilteredResult(_0x2b3fd2,_0x5e2975))['catch'](handleError(_0x2b3fd2,null));};exports['addApplications']=function addApplications(_0x5abf84,_0x223b06){var _0x59fd51=_0x5abf84[_0x2e21('0x63')]['id'];var _0xd3e272=_0x5abf84[_0x2e21('0x66')];var _0x471913=0xc8;var _0x285984=null;return db[_0x2e21('0x8c')][_0x2e21('0x8d')]({'isolationLevel':db[_0x2e21('0x8c')][_0x2e21('0x8e')][_0x2e21('0x8f')][_0x2e21('0x90')]},function(_0x328c0f){return db['MailAccount'][_0x2e21('0x6e')]({'where':{'id':_0x59fd51},'transaction':_0x328c0f})[_0x2e21('0x27')](function(_0x52f016){if(_0x52f016){return db['MailApplication'][_0x2e21('0x26')]({'where':{'MailAccountId':_0x59fd51},'transaction':_0x328c0f})['then'](function(){var _0x466548=_[_0x2e21('0x49')](_0xd3e272,function(_0x4fd8ce){_0x4fd8ce['MailAccountId']=_0x59fd51;return _0x4fd8ce;});return db[_0x2e21('0x91')]['bulkCreate'](_0x466548,{'transaction':_0x328c0f});});}else{_0x471913=0x194;_0x285984=[];}});})['then'](function(){if(_0x471913!==0x194){return db[_0x2e21('0x91')][_0x2e21('0x92')]({'where':{'MailAccountId':_0x59fd51},'order':'priority'})[_0x2e21('0x27')](function(_0x19846a){_0x285984=_0x19846a;});}})[_0x2e21('0x1a')](function(_0x210ab2){_0x471913=0x1f4;logger[_0x2e21('0x17')](_0x210ab2['stack']);if(_0x210ab2[_0x2e21('0x2b')]){delete _0x210ab2['name'];}_0x285984=_0x210ab2;})[_0x2e21('0x93')](function(){if(_0x285984===null){_0x223b06[_0x2e21('0x1b')](_0x471913);}else{if(_0x471913===0x1f4){_0x223b06[_0x2e21('0x1c')](_0x471913)[_0x2e21('0x2c')](_0x285984);}else{_0x223b06[_0x2e21('0x1c')](_0x471913)[_0x2e21('0x1e')](_0x285984);}}});};exports[_0x2e21('0x94')]=function(_0x29a6d0,_0x402aab){var _0xf7020e={};var _0x19c9af={};var _0x4e9b8d;var _0x275511;return db[_0x2e21('0x4a')][_0x2e21('0x6e')]({'where':{'id':_0x29a6d0[_0x2e21('0x63')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x402aab,null))[_0x2e21('0x27')](function(_0x41ff48){if(_0x41ff48){_0x4e9b8d=_0x41ff48;_0x19c9af[_0x2e21('0x4f')]=_[_0x2e21('0x51')](db[_0x2e21('0x91')][_0x2e21('0x4b')]);_0x19c9af['query']=_[_0x2e21('0x51')](_0x29a6d0[_0x2e21('0x50')]);_0x19c9af['filters']=_['intersection'](_0x19c9af[_0x2e21('0x4f')],_0x19c9af['query']);_0xf7020e[_0x2e21('0x54')]=_[_0x2e21('0x53')](_0x19c9af['model'],qs['fields'](_0x29a6d0['query'][_0x2e21('0x55')]));_0xf7020e[_0x2e21('0x54')]=_0xf7020e[_0x2e21('0x54')][_0x2e21('0x56')]?_0xf7020e[_0x2e21('0x54')]:_0x19c9af['model'];_0xf7020e[_0x2e21('0x59')]=qs[_0x2e21('0x5a')](_0x29a6d0[_0x2e21('0x50')][_0x2e21('0x5a')]);_0xf7020e[_0x2e21('0x5b')]=qs[_0x2e21('0x52')](_[_0x2e21('0x5c')](_0x29a6d0[_0x2e21('0x50')],_0x19c9af[_0x2e21('0x52')]));if(_0x29a6d0[_0x2e21('0x50')][_0x2e21('0x5f')]){_0xf7020e['where']=_[_0x2e21('0x5d')](_0xf7020e[_0x2e21('0x5b')],{'$or':_[_0x2e21('0x49')](_0xf7020e[_0x2e21('0x54')],function(_0x4db6a2){var _0x30ba07={};_0x30ba07[_0x4db6a2]={'$like':'%'+_0x29a6d0['query'][_0x2e21('0x5f')]+'%'};return _0x30ba07;})});}_0xf7020e=_['merge']({},_0xf7020e,_0x29a6d0[_0x2e21('0x60')]);return _0x4e9b8d[_0x2e21('0x94')](_0xf7020e);}})[_0x2e21('0x27')](function(_0x75ee67){if(_0x75ee67){_0x275511=_0x75ee67[_0x2e21('0x56')];if(!_0x29a6d0[_0x2e21('0x50')][_0x2e21('0x57')]('nolimit')){_0xf7020e[_0x2e21('0x22')]=qs[_0x2e21('0x22')](_0x29a6d0[_0x2e21('0x50')][_0x2e21('0x22')]);_0xf7020e[_0x2e21('0x1f')]=qs[_0x2e21('0x1f')](_0x29a6d0['query']['offset']);}return _0x4e9b8d[_0x2e21('0x94')](_0xf7020e);}})['then'](function(_0x585123){if(_0x585123){return _0x585123?{'count':_0x275511,'rows':_0x585123}:null;}})[_0x2e21('0x27')](respondWithResult(_0x402aab,null))[_0x2e21('0x1a')](handleError(_0x402aab,null));};exports[_0x2e21('0x95')]=function(_0x1a7b1c,_0x4452a5){var _0x526ec6={'raw':!![],'where':{}};var _0x46e742={};var _0x57e6cd={'count':0x0,'rows':[]};return db['MailAccount'][_0x2e21('0x6e')]({'where':{'id':_0x1a7b1c[_0x2e21('0x63')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x4452a5,null))[_0x2e21('0x27')](function(_0x3b4313){if(_0x3b4313){_0x46e742['model']=_[_0x2e21('0x51')](db['MailMessage'][_0x2e21('0x4b')]);_0x46e742['query']=_['keys'](_0x1a7b1c[_0x2e21('0x50')]);_0x46e742[_0x2e21('0x52')]=_[_0x2e21('0x53')](_0x46e742[_0x2e21('0x4f')],_0x46e742[_0x2e21('0x50')]);_0x526ec6['attributes']=_[_0x2e21('0x53')](_0x46e742['model'],qs[_0x2e21('0x55')](_0x1a7b1c[_0x2e21('0x50')][_0x2e21('0x55')]));_0x526ec6[_0x2e21('0x54')]=_0x526ec6[_0x2e21('0x54')][_0x2e21('0x56')]?_0x526ec6[_0x2e21('0x54')]:_0x46e742[_0x2e21('0x4f')];if(!_0x1a7b1c[_0x2e21('0x50')][_0x2e21('0x57')](_0x2e21('0x58'))){_0x526ec6[_0x2e21('0x22')]=qs[_0x2e21('0x22')](_0x1a7b1c[_0x2e21('0x50')]['limit']);_0x526ec6[_0x2e21('0x1f')]=qs['offset'](_0x1a7b1c['query'][_0x2e21('0x1f')]);}_0x526ec6[_0x2e21('0x59')]=qs[_0x2e21('0x5a')](_0x1a7b1c[_0x2e21('0x50')][_0x2e21('0x5a')]);_0x526ec6[_0x2e21('0x5b')]=qs[_0x2e21('0x52')](_['pick'](_0x1a7b1c[_0x2e21('0x50')],_0x46e742['filters']));_0x526ec6[_0x2e21('0x5b')][_0x2e21('0x6b')]=_0x3b4313['id'];if(_0x1a7b1c[_0x2e21('0x50')]['filter']){_0x526ec6['where']=_[_0x2e21('0x5d')](_0x526ec6[_0x2e21('0x5b')],{'$or':_['map'](_0x526ec6['attributes'],function(_0xa7fd90){var _0x19bd98={};_0x19bd98[_0xa7fd90]={'$like':'%'+_0x1a7b1c[_0x2e21('0x50')]['filter']+'%'};return _0x19bd98;})});}if(_0x1a7b1c[_0x2e21('0x50')][_0x2e21('0x96')]){var _0x181981=_0x1a7b1c[_0x2e21('0x50')]['$gte'][_0x2e21('0x97')](',');var _0x1c19f3={};_0x1c19f3[_0x181981[0x0]]={'$gte':moment(_0x181981[0x1])[_0x2e21('0x98')]('YYYY-MM-DD\x20HH:mm:ss')};_0x526ec6[_0x2e21('0x5b')]=_[_0x2e21('0x5d')](_0x526ec6[_0x2e21('0x5b')],_0x1c19f3);}_0x526ec6=_[_0x2e21('0x5d')]({},_0x526ec6,_0x1a7b1c[_0x2e21('0x60')]);return db['MailMessage'][_0x2e21('0x21')]({'where':_0x526ec6[_0x2e21('0x5b')]})[_0x2e21('0x27')](function(_0x4af94c){_0x57e6cd[_0x2e21('0x21')]=_0x4af94c;if(_0x1a7b1c['query'][_0x2e21('0x6f')]){_0x526ec6[_0x2e21('0x64')]=[{'all':!![]}];}return db[_0x2e21('0x99')][_0x2e21('0x61')](_0x526ec6);})[_0x2e21('0x27')](function(_0x40c6a2){if(_0x1a7b1c[_0x2e21('0x50')][_0x2e21('0x9a')]===_0x2e21('0x9b')){for(var _0x3915c2=0x0;_0x3915c2<_0x40c6a2[_0x2e21('0x56')];_0x3915c2++){_0x40c6a2[_0x3915c2][_0x2e21('0x66')]=juice(_0x40c6a2[_0x3915c2][_0x2e21('0x66')]);}}_0x57e6cd['rows']=_0x40c6a2;return _0x57e6cd;});}})[_0x2e21('0x27')](respondWithFilteredResult(_0x4452a5,_0x526ec6))['catch'](handleError(_0x4452a5,null));};exports[_0x2e21('0x2c')]=function(_0x4dba6d,_0xe1c440){var _0x54db3a,_0x41b789={},_0xd69775;if(_0x4dba6d[_0x2e21('0x66')]['to']){_0xd69775=_0x4dba6d[_0x2e21('0x66')]['to'][_0x2e21('0x97')](',')[0x0];}return db[_0x2e21('0x4a')]['find']({'where':{'id':_0x4dba6d[_0x2e21('0x63')]['id']},'include':[{'model':db[_0x2e21('0x9c')],'as':_0x2e21('0x9d'),'include':[{'model':db['CmContact'],'as':_0x2e21('0x9e'),'where':{'email':_0xd69775},'limit':0x1,'order':[['updatedAt',_0x2e21('0x9f')]]}]},{'model':db[_0x2e21('0x46')],'as':_0x2e21('0x43'),'raw':!![],'include':[{'model':db[_0x2e21('0xa0')],'as':'CloudProvider','raw':!![]}]}]})[_0x2e21('0x27')](handleEntityNotFound(_0xe1c440,null))[_0x2e21('0x27')](function(_0x477e60){if(!_0x477e60)return;_0x54db3a=_0x477e60;if(!_0x477e60[_0x2e21('0x43')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x2e21('0xa1')](_0x4dba6d['body']['from'])){_0x4dba6d[_0x2e21('0x66')][_0x2e21('0xa2')]=util[_0x2e21('0x98')]('%s\x20<%s>',_0x477e60[_0x2e21('0x2b')],_0x477e60[_0x2e21('0x76')]||_0x477e60[_0x2e21('0x43')][_0x2e21('0x37')]);}if(_0x4dba6d[_0x2e21('0x66')]['attachments']&&_0x4dba6d[_0x2e21('0x66')]['attachments'][_0x2e21('0x56')]){for(var _0x171c49=0x0;_0x171c49<_0x4dba6d[_0x2e21('0x66')][_0x2e21('0xa3')][_0x2e21('0x56')];_0x171c49+=0x1){_0x4dba6d[_0x2e21('0x66')][_0x2e21('0xa3')][_0x171c49]={'filename':_0x4dba6d['body'][_0x2e21('0xa3')][_0x171c49][_0x2e21('0x2b')],'path':path['join'](config[_0x2e21('0xa4')],_0x2e21('0xa5'),_0x4dba6d[_0x2e21('0x66')][_0x2e21('0xa3')][_0x171c49][_0x2e21('0xa6')])};}}var _0x3c260e=_0x477e60[_0x2e21('0xa7')]();return respondWithRpcPromise('SendMail',_0x2e21('0xa8'),{'account':_0x3c260e,'message':_0x4dba6d['body']});})[_0x2e21('0x27')](function(_0x3c0b19){if(!_0x3c0b19)return;_0x41b789=_0x3c0b19;if(!_0x54db3a[_0x2e21('0x9d')])throw new Error(_0x2e21('0xa9'));if(_0x54db3a[_0x2e21('0x9d')][_0x2e21('0x9e')][_0x2e21('0x56')])return _0x54db3a[_0x2e21('0x9d')][_0x2e21('0x9e')][0x0];return db[_0x2e21('0x85')][_0x2e21('0x6d')](_['defaults'](_0x4dba6d[_0x2e21('0x66')],{'firstName':_0x4dba6d[_0x2e21('0x66')]['to'],'email':_0x4dba6d[_0x2e21('0x66')]['to'],'phone':_0x4dba6d[_0x2e21('0x66')]['to'],'ListId':_0x54db3a['ListId']}));})[_0x2e21('0x27')](function(_0x4a6d95){if(!_0x4a6d95)return;var _0x584727={'UserId':_0x4dba6d[_0x2e21('0x37')]['id'],'ContactId':_0x4a6d95['id'],'MailAccountId':_0x54db3a['id'],'inReplyTo':_0x41b789['messageId'],'to':_0x4dba6d[_0x2e21('0x66')][_0x2e21('0xa2')],'cc':_0x4dba6d[_0x2e21('0x66')]['cc'],'subject':_0x4dba6d[_0x2e21('0x66')][_0x2e21('0xaa')],'attach':_0x4dba6d[_0x2e21('0x66')][_0x2e21('0xab')],'firstMsgDirection':_0x2e21('0xac'),'lastMsgAt':moment()[_0x2e21('0x98')](_0x2e21('0xad')),'lastMsgDirection':_0x2e21('0xac'),'Messages':[_[_0x2e21('0x5d')](_0x4dba6d['body'],{'messageId':_0x41b789[_0x2e21('0xae')],'sentAt':moment()[_0x2e21('0x98')](_0x2e21('0xad')),'read':!![],'MailAccountId':_0x54db3a['id'],'UserId':_0x4dba6d[_0x2e21('0x37')]['id'],'ContactId':_0x4a6d95['id']})]};if(_0x4dba6d[_0x2e21('0x66')][_0x2e21('0xaf')]){_0x584727=_[_0x2e21('0x5d')](_0x584727,_0x4dba6d['body'][_0x2e21('0xaf')]);}return db[_0x2e21('0x82')][_0x2e21('0x6d')](_0x584727,{'include':[{'model':db[_0x2e21('0x99')],'as':_0x2e21('0xb0')}]});})['then'](respondWithResult(_0xe1c440,null))[_0x2e21('0x1a')](handleError(_0xe1c440,null));};exports['verifySmtp']=function(_0x37f8ac,_0x1e6751){return db[_0x2e21('0x4a')][_0x2e21('0x65')]({'where':{'id':_0x37f8ac[_0x2e21('0x63')]['id']},'include':[{'model':db[_0x2e21('0x46')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x2e21('0xa0'),'raw':!![]}]}]})[_0x2e21('0x27')](handleEntityNotFound(_0x1e6751,null))[_0x2e21('0x27')](function(_0x4a7d59){if(!_0x4a7d59[_0x2e21('0x43')])return;var _0x137158=_0x4a7d59[_0x2e21('0xa7')]();return respondWithRpcPromise(_0x2e21('0xb1'),_0x2e21('0xb2'),{'account':_0x137158});})[_0x2e21('0x27')](respondWithResult(_0x1e6751,null))[_0x2e21('0x1a')](handleError(_0x1e6751,null));};exports[_0x2e21('0x26')]=function(_0xfc0a1d,_0x28b897){return db['MailAccount'][_0x2e21('0x65')]({'where':{'id':_0xfc0a1d[_0x2e21('0x63')]['id']}})['then'](handleEntityNotFound(_0x28b897,null))[_0x2e21('0x27')](function(_0xf14c69){if(_0xf14c69&&_0xf14c69[_0x2e21('0x40')]){throw new db[(_0x2e21('0xb3'))]['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0xf14c69;})[_0x2e21('0x27')](removeEntity(_0x28b897,null))[_0x2e21('0x1a')](handleError(_0x28b897,null));};exports[_0x2e21('0xb4')]=function(_0x13e7b3,_0x3a530a){return db[_0x2e21('0x4a')][_0x2e21('0x65')]({'where':{'id':_0x13e7b3['params']['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x3a530a,null))[_0x2e21('0x27')](function(_0x486e11){if(_0x486e11){return _0x486e11['addAgents'](_0x13e7b3['body'][_0x2e21('0x72')],_[_0x2e21('0xb5')](_0x13e7b3['body'],[_0x2e21('0x72'),'id'])||{})[_0x2e21('0xb6')](function(_0x41bdf6){for(var _0x2a6053=0x0;_0x2a6053<_0x13e7b3['body']['ids'][_0x2e21('0x56')];_0x2a6053+=0x1){socket['emit'](_0x2e21('0xb7'),{'UserId':Number(_0x13e7b3[_0x2e21('0x66')][_0x2e21('0x72')][_0x2a6053]),'MailAccountId':Number(_0x13e7b3[_0x2e21('0x63')]['id'])});}return _0x41bdf6;});}})[_0x2e21('0x27')](respondWithResult(_0x3a530a,null))[_0x2e21('0x1a')](handleError(_0x3a530a,null));};exports[_0x2e21('0xb8')]=function(_0xb8f6b1,_0x108171){return db[_0x2e21('0x4a')][_0x2e21('0x65')]({'where':{'id':_0xb8f6b1[_0x2e21('0x63')]['id']}})['then'](handleEntityNotFound(_0x108171,null))[_0x2e21('0x27')](function(_0x2cdce1){if(_0x2cdce1){return _0x2cdce1[_0x2e21('0xb8')](_0xb8f6b1[_0x2e21('0x50')][_0x2e21('0x72')])[_0x2e21('0x27')](function(){if(_[_0x2e21('0xb9')](_0xb8f6b1[_0x2e21('0x50')][_0x2e21('0x72')])){for(var _0x2b150b=0x0;_0x2b150b<_0xb8f6b1[_0x2e21('0x50')][_0x2e21('0x72')][_0x2e21('0x56')];_0x2b150b+=0x1){socket['emit'](_0x2e21('0xba'),{'UserId':Number(_0xb8f6b1[_0x2e21('0x50')]['ids'][_0x2b150b]),'MailAccountId':Number(_0xb8f6b1[_0x2e21('0x63')]['id'])});}}else{socket[_0x2e21('0xbb')](_0x2e21('0xba'),{'UserId':Number(_0xb8f6b1['query']['ids']),'MailAccountId':Number(_0xb8f6b1[_0x2e21('0x63')]['id'])});}});}})['then'](respondWithStatusCode(_0x108171,null))[_0x2e21('0x1a')](handleError(_0x108171,null));};exports[_0x2e21('0xbc')]=function(_0x28eb48,_0x6060c6){var _0x59069b={};var _0x1e1bb6={};var _0x58fca5;var _0x587884;return db['MailAccount'][_0x2e21('0x6e')]({'where':{'id':_0x28eb48[_0x2e21('0x63')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x6060c6,null))[_0x2e21('0x27')](function(_0x35ecad){if(_0x35ecad){_0x58fca5=_0x35ecad;_0x1e1bb6[_0x2e21('0x4f')]=_[_0x2e21('0x51')](db[_0x2e21('0x87')][_0x2e21('0x4b')]);_0x1e1bb6[_0x2e21('0x50')]=_[_0x2e21('0x51')](_0x28eb48[_0x2e21('0x50')]);_0x1e1bb6[_0x2e21('0x52')]=_['intersection'](_0x1e1bb6[_0x2e21('0x4f')],_0x1e1bb6[_0x2e21('0x50')]);_0x59069b[_0x2e21('0x54')]=_[_0x2e21('0x53')](_0x1e1bb6[_0x2e21('0x4f')],qs[_0x2e21('0x55')](_0x28eb48[_0x2e21('0x50')][_0x2e21('0x55')]));_0x59069b[_0x2e21('0x54')]=_0x59069b[_0x2e21('0x54')][_0x2e21('0x56')]?_0x59069b[_0x2e21('0x54')]:_0x1e1bb6['model'];_0x59069b[_0x2e21('0x59')]=qs[_0x2e21('0x5a')](_0x28eb48['query'][_0x2e21('0x5a')]);_0x59069b[_0x2e21('0x5b')]=qs['filters'](_['pick'](_0x28eb48[_0x2e21('0x50')],_0x1e1bb6[_0x2e21('0x52')]));if(_0x28eb48[_0x2e21('0x50')]['filter']){_0x59069b['where']=_[_0x2e21('0x5d')](_0x59069b[_0x2e21('0x5b')],{'$or':_['map'](_0x59069b['attributes'],function(_0x4e4339){var _0x13693f={};_0x13693f[_0x4e4339]={'$like':'%'+_0x28eb48[_0x2e21('0x50')]['filter']+'%'};return _0x13693f;})});}_0x59069b=_['merge']({},_0x59069b,_0x28eb48['options']);return _0x58fca5[_0x2e21('0xbc')](_0x59069b);}})['then'](function(_0x17c981){if(_0x17c981){_0x587884=_0x17c981['length'];if(!_0x28eb48[_0x2e21('0x50')][_0x2e21('0x57')]('nolimit')){_0x59069b[_0x2e21('0x22')]=qs[_0x2e21('0x22')](_0x28eb48[_0x2e21('0x50')][_0x2e21('0x22')]);_0x59069b[_0x2e21('0x1f')]=qs[_0x2e21('0x1f')](_0x28eb48['query'][_0x2e21('0x1f')]);}return _0x58fca5['getAgents'](_0x59069b);}})[_0x2e21('0x27')](function(_0x584fb7){if(_0x584fb7){return _0x584fb7?{'count':_0x587884,'rows':_0x584fb7}:null;}})[_0x2e21('0x27')](respondWithResult(_0x6060c6,null))[_0x2e21('0x1a')](handleError(_0x6060c6,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 79e3387..375ecd2 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 _0x2ff5=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','MailAccount','save'];(function(_0x3a4c5b,_0x73d779){var _0x28174b=function(_0x12840d){while(--_0x12840d){_0x3a4c5b['push'](_0x3a4c5b['shift']());}};_0x28174b(++_0x73d779);}(_0x2ff5,0x1d5));var _0x52ff=function(_0x2587a0,_0x4f0882){_0x2587a0=_0x2587a0-0x0;var _0x5bfb41=_0x2ff5[_0x2587a0];return _0x5bfb41;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x52ff('0x0'))['db'][_0x52ff('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x52ff('0x2'),'afterUpdate':_0x52ff('0x3'),'afterDestroy':_0x52ff('0x4')};function emitEvent(_0x36b0e9){return function(_0x190df8,_0xbfba62,_0x4f5f6e){MailAccountEvents[_0x52ff('0x5')](_0x36b0e9+':'+_0x190df8['id'],_0x190df8);MailAccountEvents[_0x52ff('0x5')](_0x36b0e9,_0x190df8);_0x4f5f6e(null);};}for(var e in events){if(events[_0x52ff('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x52ff('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x070f=['MailAccount','save','update','remove','emit','exports','events'];(function(_0x19ea49,_0xd8ecd8){var _0x505553=function(_0x1de04f){while(--_0x1de04f){_0x19ea49['push'](_0x19ea49['shift']());}};_0x505553(++_0xd8ecd8);}(_0x070f,0x13a));var _0xf070=function(_0x377685,_0x325b5b){_0x377685=_0x377685-0x0;var _0x1c44c3=_0x070f[_0x377685];return _0x1c44c3;};'use strict';var EventEmitter=require(_0xf070('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xf070('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf070('0x2'),'afterUpdate':_0xf070('0x3'),'afterDestroy':_0xf070('0x4')};function emitEvent(_0x100840){return function(_0x2f656e,_0x124467,_0x585478){MailAccountEvents[_0xf070('0x5')](_0x100840+':'+_0x2f656e['id'],_0x2f656e);MailAccountEvents['emit'](_0x100840,_0x2f656e);_0x585478(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xf070('0x6')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 2ed9320..aaa4b0d 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 _0x623d=['Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','pass','exports','define','mail_accounts','provider','custom','service','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider'];(function(_0x1b99aa,_0x46bb9a){var _0x541d7c=function(_0x2ebd10){while(--_0x2ebd10){_0x1b99aa['push'](_0x1b99aa['shift']());}};_0x541d7c(++_0x46bb9a);}(_0x623d,0xfd));var _0xd623=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x623d[_0x934425];return _0x31d596;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xd623('0x0')]=function(_0x196d43){return _0x196d43[_0xd623('0x1')]('MailAccount',attributes,{'tableName':_0xd623('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x441953=this;var _0x3d11b7={'id':_0x441953['id'],'tls':{'rejectUnauthorized':![]}};if(_0x441953[_0xd623('0x3')]!==_0xd623('0x4')){_0x3d11b7[_0xd623('0x5')]=_0x441953['provider'];}else{_0x3d11b7[_0xd623('0x6')]=_0x441953[_0xd623('0x7')][_0xd623('0x6')];_0x3d11b7['port']=_0x441953['Smtp'][_0xd623('0x8')];_0x3d11b7['secure']=_0x441953[_0xd623('0x7')][_0xd623('0x9')];}if(_0x441953[_0xd623('0x7')][_0xd623('0xa')]){if(_0x441953[_0xd623('0x7')][_0xd623('0xb')]){if(!_0x441953[_0xd623('0x7')][_0xd623('0xc')])throw new Error(_0xd623('0xd'));_0x3d11b7[_0xd623('0xe')]={'type':_0xd623('0xf'),'user':_0x441953[_0xd623('0x7')][_0xd623('0x10')],'accessToken':_0x441953[_0xd623('0x7')][_0xd623('0xc')][_0xd623('0x11')]};}else{_0x3d11b7[_0xd623('0xe')]={'user':_0x441953[_0xd623('0x7')][_0xd623('0x10')],'pass':_0x441953[_0xd623('0x7')][_0xd623('0x12')]};}}return _0x3d11b7;}}});}; \ No newline at end of file +var _0x1384=['service','provider','host','Smtp','secure','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','./mailAccount.attributes','MailAccount','mail_accounts','custom'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1384,0x176));var _0x4138=function(_0x2af3f3,_0xe1b480){_0x2af3f3=_0x2af3f3-0x0;var _0x4cb12b=_0x1384[_0x2af3f3];return _0x4cb12b;};'use strict';var attributes=require(_0x4138('0x0'));module['exports']=function(_0x47275d){return _0x47275d['define'](_0x4138('0x1'),attributes,{'tableName':_0x4138('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x3002fb=this;var _0x446d20={'id':_0x3002fb['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3002fb['provider']!==_0x4138('0x3')){_0x446d20[_0x4138('0x4')]=_0x3002fb[_0x4138('0x5')];}else{_0x446d20[_0x4138('0x6')]=_0x3002fb[_0x4138('0x7')]['host'];_0x446d20['port']=_0x3002fb['Smtp']['port'];_0x446d20['secure']=_0x3002fb[_0x4138('0x7')][_0x4138('0x8')];}if(_0x3002fb[_0x4138('0x7')]['authentication']){if(_0x3002fb[_0x4138('0x7')][_0x4138('0x9')]){if(!_0x3002fb['Smtp']['CloudProvider'])throw new Error(_0x4138('0xa'));_0x446d20[_0x4138('0xb')]={'type':_0x4138('0xc'),'user':_0x3002fb[_0x4138('0x7')][_0x4138('0xd')],'accessToken':_0x3002fb[_0x4138('0x7')]['CloudProvider']['data5']};}else{_0x446d20['auth']={'user':_0x3002fb[_0x4138('0x7')][_0x4138('0xd')],'pass':_0x3002fb[_0x4138('0x7')]['pass']};}}return _0x446d20;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index bae7a5c..a5faaa4 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 _0x0295=['setDataValue','smtpOptions','getSmtpOptions','stringify','NotifyMailAccount','body','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','applications','priority','asc','autoclose','close','*,*,*,*','length','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','update','created','create','attachments','originTo','originCc','bcc','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','interaction','UserId','User','name','agent','Start','startRouting','lodash','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','message','catch','GetMailAccount','MailAccount','findAll','options','attributes','limit','include','model','map','debug','ShowMailAccount','find','where','smtp'];(function(_0x79b649,_0x2115b3){var _0x1af9b1=function(_0x153c9f){while(--_0x153c9f){_0x79b649['push'](_0x79b649['shift']());}};_0x1af9b1(++_0x2115b3);}(_0x0295,0x1f0));var _0x5029=function(_0x404c35,_0xedfe89){_0x404c35=_0x404c35-0x0;var _0x28c900=_0x0295[_0x404c35];return _0x28c900;};'use strict';var _=require(_0x5029('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5029('0x1'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0x5029('0x2'))(_0x5029('0x3'));var config=require(_0x5029('0x4'));var jayson=require(_0x5029('0x5'));var client=jayson[_0x5029('0x6')][_0x5029('0x7')]({'port':0x232c});config[_0x5029('0x8')]=_[_0x5029('0x9')](config[_0x5029('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5029('0xa'))['register'](socket);function respondWithRpcPromise(_0x1532e9,_0x5bccfc,_0x14d4ef){return new BPromise(function(_0x520bc3,_0x222ddb){return client[_0x5029('0xb')](_0x1532e9,_0x14d4ef)[_0x5029('0xc')](function(_0x52fa95){logger[_0x5029('0xd')](_0x5029('0xe'),_0x5bccfc,_0x5029('0xf'));logger['debug'](_0x5029('0x10'),_0x5bccfc,_0x5029('0xf'),JSON['stringify'](_0x52fa95));if(_0x52fa95['error']){if(_0x52fa95['error']['code']===0x1f4){logger[_0x5029('0x11')](_0x5029('0xe'),_0x5bccfc,_0x52fa95[_0x5029('0x11')][_0x5029('0x12')]);return _0x222ddb(_0x52fa95[_0x5029('0x11')][_0x5029('0x12')]);}logger[_0x5029('0x11')](_0x5029('0xe'),_0x5bccfc,_0x52fa95[_0x5029('0x11')][_0x5029('0x12')]);return _0x520bc3(_0x52fa95[_0x5029('0x11')][_0x5029('0x12')]);}else{logger[_0x5029('0xd')](_0x5029('0xe'),_0x5bccfc,_0x5029('0xf'));_0x520bc3(_0x52fa95['result'][_0x5029('0x12')]);}})[_0x5029('0x13')](function(_0x35de81){logger[_0x5029('0x11')](_0x5029('0xe'),_0x5bccfc,_0x35de81);_0x222ddb(_0x35de81);});});}exports[_0x5029('0x14')]=function(_0xaba461){var _0x4adbb3=this;return new Promise(function(_0x226a5c,_0x5696b1){return db[_0x5029('0x15')][_0x5029('0x16')]({'raw':_0xaba461[_0x5029('0x17')]?_0xaba461[_0x5029('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xaba461['options']?_0xaba461[_0x5029('0x17')]['where']||null:null,'attributes':_0xaba461[_0x5029('0x17')]?_0xaba461[_0x5029('0x17')][_0x5029('0x18')]||null:null,'limit':_0xaba461[_0x5029('0x17')]?_0xaba461[_0x5029('0x17')][_0x5029('0x19')]||null:null,'include':_0xaba461[_0x5029('0x17')]?_0xaba461[_0x5029('0x17')][_0x5029('0x1a')]?_['map'](_0xaba461['options']['include'],function(_0x588d90){return{'model':db[_0x588d90[_0x5029('0x1b')]],'as':_0x588d90['as'],'attributes':_0x588d90['attributes'],'include':_0x588d90['include']?_[_0x5029('0x1c')](_0x588d90[_0x5029('0x1a')],function(_0x36d810){return{'model':db[_0x36d810['model']],'as':_0x36d810['as'],'attributes':_0x36d810[_0x5029('0x18')],'include':_0x36d810[_0x5029('0x1a')]?_['map'](_0x36d810[_0x5029('0x1a')],function(_0x31f0a0){return{'model':db[_0x31f0a0[_0x5029('0x1b')]],'as':_0x31f0a0['as'],'attributes':_0x31f0a0['attributes']};}):[]};}):[]};}):[]:[]})[_0x5029('0xc')](function(_0x251f99){logger[_0x5029('0xd')]('GetMailAccount',_0xaba461);logger[_0x5029('0x1d')](_0x5029('0x14'),_0xaba461,JSON['stringify'](_0x251f99));_0x226a5c(_0x251f99);})[_0x5029('0x13')](function(_0x25032b){logger[_0x5029('0x11')](_0x5029('0x14'),_0x25032b[_0x5029('0x12')],_0xaba461);_0x5696b1(_0x4adbb3[_0x5029('0x11')](0x1f4,_0x25032b[_0x5029('0x12')]));});});};exports[_0x5029('0x1e')]=function(_0x250156){var _0x22559a=this;return new Promise(function(_0x358a2b,_0x4519c8){return db['MailAccount'][_0x5029('0x1f')]({'raw':_0x250156['options']?_0x250156[_0x5029('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x250156['options']?_0x250156[_0x5029('0x17')][_0x5029('0x20')]||null:null,'attributes':_0x250156[_0x5029('0x17')]?_0x250156['options'][_0x5029('0x18')]||null:null,'include':_0x250156[_0x5029('0x17')]?_0x250156[_0x5029('0x17')][_0x5029('0x1a')]?_[_0x5029('0x1c')](_0x250156[_0x5029('0x17')][_0x5029('0x1a')],function(_0x22205e){return{'model':db[_0x22205e[_0x5029('0x1b')]],'as':_0x22205e['as'],'attributes':_0x22205e['attributes'],'include':_0x22205e[_0x5029('0x1a')]?_[_0x5029('0x1c')](_0x22205e[_0x5029('0x1a')],function(_0x1b3817){return{'model':db[_0x1b3817['model']],'as':_0x1b3817['as'],'attributes':_0x1b3817[_0x5029('0x18')],'include':_0x1b3817[_0x5029('0x1a')]?_[_0x5029('0x1c')](_0x1b3817['include'],function(_0x4904cc){return{'model':db[_0x4904cc[_0x5029('0x1b')]],'as':_0x4904cc['as'],'attributes':_0x4904cc[_0x5029('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57784c){if(_0x250156[_0x5029('0x17')][_0x5029('0x21')]===!![])_0x57784c[_0x5029('0x22')](_0x5029('0x23'),_0x57784c[_0x5029('0x24')]());logger[_0x5029('0xd')](_0x5029('0x1e'),_0x250156);logger[_0x5029('0x1d')](_0x5029('0x1e'),_0x250156,JSON[_0x5029('0x25')](_0x57784c));_0x358a2b(_0x57784c);})[_0x5029('0x13')](function(_0xbdb3fa){logger[_0x5029('0x11')](_0x5029('0x1e'),_0xbdb3fa['message'],_0x250156);_0x4519c8(_0x22559a['error'](0x1f4,_0xbdb3fa[_0x5029('0x12')]));});});};exports[_0x5029('0x26')]=function(_0x423ed1){var _0x48c9eb=this;return new Promise(function(_0x32d8a3,_0x39b216){var _0x52572a={'body':_0x423ed1[_0x5029('0x27')],'channel':'mail'};var _0x506f0d=_['difference'](_[_0x5029('0x28')](db[_0x5029('0x29')][_0x5029('0x2a')]),[_0x5029('0x2b'),_0x5029('0x2c'),_0x5029('0x2d'),_0x5029('0x2e')]);var _0x1021ea=![];if(_0x423ed1[_0x5029('0x27')]['id']){delete _0x423ed1['body']['id'];}if(_[_0x5029('0x2f')](_0x423ed1[_0x5029('0x27')][_0x5029('0x30')])){return _0x39b216(_0x48c9eb[_0x5029('0x11')](0x1f4,_0x5029('0x31')));}if(_[_0x5029('0x2f')](_0x423ed1['body'][_0x5029('0x27')])||_0x423ed1[_0x5029('0x27')][_0x5029('0x27')]===''){return _0x39b216(_0x48c9eb[_0x5029('0x11')](0x1f4,_0x5029('0x32')));}if(_['isNil'](_0x423ed1[_0x5029('0x27')][_0x5029('0x33')])){return _0x39b216(_0x48c9eb[_0x5029('0x11')](0x1f4,_0x5029('0x34')+_0x506f0d));}if(!_[_0x5029('0x35')](_0x506f0d,_0x423ed1[_0x5029('0x27')][_0x5029('0x33')])){return _0x39b216(_0x48c9eb[_0x5029('0x11')](0x1f4,_0x5029('0x36')+_0x506f0d));}var _0x51514e={};_0x51514e[_0x423ed1[_0x5029('0x27')][_0x5029('0x33')]]=_0x423ed1[_0x5029('0x27')][_0x5029('0x30')];return db['MailAccount']['find']({'where':{'id':_0x423ed1[_0x5029('0x37')]['id']},'include':[{'model':db[_0x5029('0x38')],'as':_0x5029('0x39'),'include':[{'model':db[_0x5029('0x29')],'as':_0x5029('0x3a'),'where':_0x51514e,'limit':0x1,'order':[[_0x5029('0x2c'),_0x5029('0x3b')]]}]},{'model':db[_0x5029('0x3c')],'as':_0x5029('0x3d')},{'model':db[_0x5029('0x3e')],'as':_0x5029('0x3f'),'include':[{'model':db[_0x5029('0x40')],'as':_0x5029('0x40')}]}]})[_0x5029('0xc')](function(_0x3168bd){if(_0x3168bd&&_0x3168bd[_0x5029('0x39')]){var _0x10fc07=_0x3168bd[_0x5029('0x41')]({'plain':!![]});_0x52572a[_0x5029('0x37')]=_[_0x5029('0x42')](_0x10fc07,[_0x5029('0x3d'),'List']);_0x52572a[_0x5029('0x37')]['smtpOptions']=_0x3168bd[_0x5029('0x24')]();_0x52572a[_0x5029('0x43')]=_0x10fc07['Applications'];_0x52572a['list']=_0x10fc07[_0x5029('0x39')];_0x52572a['applications']=_['orderBy'](_0x52572a[_0x5029('0x43')],[_0x5029('0x44')],[_0x5029('0x45')]);if(_0x52572a['account']&&_0x52572a['account'][_0x5029('0x46')]){_0x52572a[_0x5029('0x43')]['push']({'id':0x0,'priority':_0x52572a[_0x5029('0x43')]['length']+0x1,'app':_0x5029('0x47'),'appdata':'autoclose','interval':_0x5029('0x48')});}if(_0x52572a[_0x5029('0x37')][_0x5029('0x3d')]){delete _0x52572a[_0x5029('0x37')][_0x5029('0x3d')];}if(_0x52572a[_0x5029('0x37')][_0x5029('0x39')]){delete _0x52572a[_0x5029('0x37')]['List'];}if(_0x10fc07[_0x5029('0x39')]['Contacts'][_0x5029('0x49')]){return _0x10fc07[_0x5029('0x39')]['Contacts'][0x0];}var _0x2a2da5=_['defaults'](_0x423ed1['body'],{'firstName':_0x423ed1['body'][_0x5029('0x30')],'ListId':_0x10fc07['ListId']});_0x2a2da5[_0x423ed1[_0x5029('0x27')][_0x5029('0x33')]]=_0x423ed1[_0x5029('0x27')]['from'];return db[_0x5029('0x29')]['create'](_0x2a2da5);}else{throw new Error('List\x20not\x20found');}})[_0x5029('0xc')](function(_0x98abd1){_0x52572a[_0x5029('0x4a')]=_0x98abd1;if(_0x98abd1){if(!_0x423ed1[_0x5029('0x27')][_0x5029('0x12')]['messageId']){_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x4b')]=rs[_0x5029('0x4c')]()+'\x20'+_0x423ed1['body'][_0x5029('0x12')][_0x5029('0x30')];}var _0x4d4a2d={'ContactId':_0x98abd1['id'],'MailAccountId':_0x423ed1['account']['id'],'inReplyTo':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x4b')],'to':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x30')],'cc':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')]['cc'],'subject':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x4d')],'attach':_0x423ed1['body']['message'][_0x5029('0x4e')],'lastMsgAt':moment()[_0x5029('0x4f')](_0x5029('0x50')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x5029('0x1f')]({'where':{'closed':![],'MailAccountId':_0x423ed1[_0x5029('0x37')]['id']},'include':[{'model':db[_0x5029('0x51')],'as':_0x5029('0x52'),'attributes':[_0x5029('0x4b')],'where':{'messageId':_0x423ed1['body'][_0x5029('0x12')][_0x5029('0x53')]}}]})[_0x5029('0xc')](function(_0x5bf867){if(_0x5bf867){return[_0x5bf867,![]];}return db[_0x5029('0x54')]['create'](_0x4d4a2d)[_0x5029('0xc')](function(_0x4f2f0c){return[_0x4f2f0c,!![]];});});}else{throw new Error(_0x5029('0x55'));}})[_0x5029('0x56')](function(_0x2ad2e3,_0x2f5301){if(_0x2ad2e3){_0x1021ea=_0x2f5301;if(!_0x2f5301){return _0x2ad2e3[_0x5029('0x57')]({'inReplyTo':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x4b')],'to':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x30')],'cc':_0x423ed1[_0x5029('0x27')]['message']['cc'],'subject':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x4d')],'attach':_0x2ad2e3['attach']?_0x2ad2e3[_0x5029('0x4e')]:_0x423ed1['body'][_0x5029('0x12')]['attach'],'substatus':null,'substatusAt':moment()['format'](_0x5029('0x50')),'lastMsgAt':moment()['format'](_0x5029('0x50')),'lastMsgDirection':'in'});}else{return _0x2ad2e3;}}})[_0x5029('0xc')](function(_0x382994){_0x52572a['interaction']=_0x382994[_0x5029('0x41')]({'plain':!![]});_0x52572a['interaction'][_0x5029('0x58')]=_0x1021ea;return db[_0x5029('0x51')][_0x5029('0x59')]({'body':_0x423ed1[_0x5029('0x27')][_0x5029('0x27')],'MailAccountId':_0x423ed1['account']['id'],'MailInteractionId':_0x382994['id'],'direction':'in','ContactId':_0x52572a[_0x5029('0x4a')]['id'],'messageId':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x4b')],'from':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x30')],'to':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')]['to'],'cc':_0x423ed1['body']['message']['cc'],'subject':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x4d')],'attach':_0x423ed1[_0x5029('0x27')]['message'][_0x5029('0x4e')],'Attachments':_0x423ed1['body']['message'][_0x5029('0x5a')],'originTo':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x5b')],'originCc':_0x423ed1['body'][_0x5029('0x12')][_0x5029('0x5c')],'bcc':_0x423ed1['body'][_0x5029('0x12')][_0x5029('0x5d')],'ChatWebsiteId':_0x423ed1['body']['message']['ChatWebsiteId']||null,'originChannel':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x5e')]||_0x5029('0x5f'),'ChatOfflineMessageId':_0x423ed1[_0x5029('0x27')][_0x5029('0x12')][_0x5029('0x60')]||null},{'include':[{'model':db[_0x5029('0x61')],'as':_0x5029('0x62')}]});})['then'](function(_0x4bf5cf){_0x52572a[_0x5029('0x12')]=_0x4bf5cf;if(_0x52572a[_0x5029('0x63')][_0x5029('0x64')]){return db[_0x5029('0x65')][_0x5029('0x1f')]({'attributes':['id',_0x5029('0x66')],'where':{'id':_0x52572a[_0x5029('0x63')]['UserId']}})[_0x5029('0xc')](function(_0x3a0d6f){if(_0x3a0d6f){_0x52572a[_0x5029('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':_0x5029('0x67'),'appdata':_0x3a0d6f[_0x5029('0x66')]+','+(_0x52572a[_0x5029('0x37')]['waitForTheAssignedAgent']||0xa),'interval':_0x5029('0x48')});}return respondWithRpcPromise(_0x5029('0x68'),_0x5029('0x69'),_0x52572a);});}return respondWithRpcPromise('Start',_0x5029('0x69'),_0x52572a);})[_0x5029('0xc')](function(_0x5a35bc){_0x32d8a3(_0x5a35bc);})[_0x5029('0x13')](function(_0x42d795){_0x39b216(_0x48c9eb[_0x5029('0x11')](0x1f4,_0x42d795[_0x5029('0x12')]));});});}; \ No newline at end of file +var _0x187d=['account','List','Contacts','DESC','MailApplication','Applications','MailServerOut','CloudProvider','get','list','applications','orderBy','priority','autoclose','length','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','update','interaction','created','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','attributes','include','model','map','debug','ShowMailAccount','find','where','smtp','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey'];(function(_0x4af23c,_0x50e294){var _0x194b63=function(_0x44f871){while(--_0x44f871){_0x4af23c['push'](_0x4af23c['shift']());}};_0x194b63(++_0x50e294);}(_0x187d,0x93));var _0xd187=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x187d[_0x32d457];return _0x338386;};'use strict';var _=require(_0xd187('0x0'));var moment=require('moment');var BPromise=require(_0xd187('0x1'));var rs=require(_0xd187('0x2'));var Redis=require(_0xd187('0x3'));var db=require(_0xd187('0x4'))['db'];var logger=require(_0xd187('0x5'))(_0xd187('0x6'));var config=require('../../config/environment');var jayson=require(_0xd187('0x7'));var client=jayson[_0xd187('0x8')]['http']({'port':0x232c});config[_0xd187('0x9')]=_[_0xd187('0xa')](config[_0xd187('0x9')],{'host':_0xd187('0xb'),'port':0x18eb});var socket=require(_0xd187('0xc'))(new Redis(config[_0xd187('0x9')]));require(_0xd187('0xd'))[_0xd187('0xe')](socket);function respondWithRpcPromise(_0x5b480f,_0x342539,_0x42848b){return new BPromise(function(_0x4039f6,_0x473866){return client[_0xd187('0xf')](_0x5b480f,_0x42848b)[_0xd187('0x10')](function(_0x59c194){logger[_0xd187('0x11')](_0xd187('0x12'),_0x342539,_0xd187('0x13'));logger['debug'](_0xd187('0x14'),_0x342539,_0xd187('0x13'),JSON[_0xd187('0x15')](_0x59c194));if(_0x59c194['error']){if(_0x59c194[_0xd187('0x16')][_0xd187('0x17')]===0x1f4){logger[_0xd187('0x16')](_0xd187('0x12'),_0x342539,_0x59c194['error'][_0xd187('0x18')]);return _0x473866(_0x59c194[_0xd187('0x16')][_0xd187('0x18')]);}logger[_0xd187('0x16')]('MailAccount,\x20%s,\x20%s',_0x342539,_0x59c194[_0xd187('0x16')]['message']);return _0x4039f6(_0x59c194['error'][_0xd187('0x18')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x342539,_0xd187('0x13'));_0x4039f6(_0x59c194[_0xd187('0x19')][_0xd187('0x18')]);}})[_0xd187('0x1a')](function(_0x21df74){logger[_0xd187('0x16')](_0xd187('0x12'),_0x342539,_0x21df74);_0x473866(_0x21df74);});});}exports[_0xd187('0x1b')]=function(_0x4f2f88){var _0x46fca3=this;return new Promise(function(_0x170d5c,_0x11b2a1){return db[_0xd187('0x1c')]['findAll']({'raw':_0x4f2f88[_0xd187('0x1d')]?_0x4f2f88[_0xd187('0x1d')][_0xd187('0x1e')]===undefined?!![]:![]:!![],'where':_0x4f2f88['options']?_0x4f2f88['options']['where']||null:null,'attributes':_0x4f2f88[_0xd187('0x1d')]?_0x4f2f88[_0xd187('0x1d')][_0xd187('0x1f')]||null:null,'limit':_0x4f2f88['options']?_0x4f2f88[_0xd187('0x1d')]['limit']||null:null,'include':_0x4f2f88[_0xd187('0x1d')]?_0x4f2f88['options'][_0xd187('0x20')]?_['map'](_0x4f2f88['options'][_0xd187('0x20')],function(_0x4d992b){return{'model':db[_0x4d992b[_0xd187('0x21')]],'as':_0x4d992b['as'],'attributes':_0x4d992b[_0xd187('0x1f')],'include':_0x4d992b['include']?_['map'](_0x4d992b[_0xd187('0x20')],function(_0xeff822){return{'model':db[_0xeff822[_0xd187('0x21')]],'as':_0xeff822['as'],'attributes':_0xeff822[_0xd187('0x1f')],'include':_0xeff822['include']?_[_0xd187('0x22')](_0xeff822[_0xd187('0x20')],function(_0x5c8e52){return{'model':db[_0x5c8e52[_0xd187('0x21')]],'as':_0x5c8e52['as'],'attributes':_0x5c8e52[_0xd187('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd187('0x10')](function(_0x4c50a5){logger[_0xd187('0x11')]('GetMailAccount',_0x4f2f88);logger[_0xd187('0x23')](_0xd187('0x1b'),_0x4f2f88,JSON[_0xd187('0x15')](_0x4c50a5));_0x170d5c(_0x4c50a5);})[_0xd187('0x1a')](function(_0x489f2e){logger[_0xd187('0x16')](_0xd187('0x1b'),_0x489f2e['message'],_0x4f2f88);_0x11b2a1(_0x46fca3['error'](0x1f4,_0x489f2e[_0xd187('0x18')]));});});};exports[_0xd187('0x24')]=function(_0x13f285){var _0x481346=this;return new Promise(function(_0x2874b2,_0x2d8843){return db[_0xd187('0x1c')][_0xd187('0x25')]({'raw':_0x13f285['options']?_0x13f285[_0xd187('0x1d')][_0xd187('0x1e')]===undefined?!![]:![]:!![],'where':_0x13f285[_0xd187('0x1d')]?_0x13f285['options'][_0xd187('0x26')]||null:null,'attributes':_0x13f285['options']?_0x13f285[_0xd187('0x1d')][_0xd187('0x1f')]||null:null,'include':_0x13f285[_0xd187('0x1d')]?_0x13f285['options']['include']?_[_0xd187('0x22')](_0x13f285[_0xd187('0x1d')]['include'],function(_0x4591e0){return{'model':db[_0x4591e0[_0xd187('0x21')]],'as':_0x4591e0['as'],'attributes':_0x4591e0[_0xd187('0x1f')],'include':_0x4591e0['include']?_['map'](_0x4591e0[_0xd187('0x20')],function(_0xf32da2){return{'model':db[_0xf32da2['model']],'as':_0xf32da2['as'],'attributes':_0xf32da2['attributes'],'include':_0xf32da2['include']?_[_0xd187('0x22')](_0xf32da2['include'],function(_0x28c252){return{'model':db[_0x28c252[_0xd187('0x21')]],'as':_0x28c252['as'],'attributes':_0x28c252['attributes']};}):[]};}):[]};}):[]:[]})[_0xd187('0x10')](function(_0x5674ca){if(_0x13f285[_0xd187('0x1d')][_0xd187('0x27')]===!![])_0x5674ca['setDataValue'](_0xd187('0x28'),_0x5674ca[_0xd187('0x29')]());logger['info'](_0xd187('0x24'),_0x13f285);logger['debug']('ShowMailAccount',_0x13f285,JSON[_0xd187('0x15')](_0x5674ca));_0x2874b2(_0x5674ca);})[_0xd187('0x1a')](function(_0xdecb24){logger[_0xd187('0x16')](_0xd187('0x24'),_0xdecb24['message'],_0x13f285);_0x2d8843(_0x481346[_0xd187('0x16')](0x1f4,_0xdecb24[_0xd187('0x18')]));});});};exports[_0xd187('0x2a')]=function(_0x4f3139){var _0x4b121c=this;return new Promise(function(_0x538c05,_0x595195){var _0x21bb3c={'body':_0x4f3139[_0xd187('0x2b')],'channel':_0xd187('0x2c')};var _0x367303=_[_0xd187('0x2d')](_[_0xd187('0x2e')](db[_0xd187('0x2f')][_0xd187('0x30')]),['createdAt',_0xd187('0x31'),_0xd187('0x32'),_0xd187('0x33')]);var _0x51c7fc=![];if(_0x4f3139[_0xd187('0x2b')]['id']){delete _0x4f3139['body']['id'];}if(_[_0xd187('0x34')](_0x4f3139[_0xd187('0x2b')][_0xd187('0x35')])){return _0x595195(_0x4b121c[_0xd187('0x16')](0x1f4,_0xd187('0x36')));}if(_['isNil'](_0x4f3139[_0xd187('0x2b')][_0xd187('0x2b')])||_0x4f3139[_0xd187('0x2b')][_0xd187('0x2b')]===''){return _0x595195(_0x4b121c['error'](0x1f4,_0xd187('0x37')));}if(_[_0xd187('0x34')](_0x4f3139['body'][_0xd187('0x38')])){return _0x595195(_0x4b121c[_0xd187('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x367303));}if(!_['includes'](_0x367303,_0x4f3139[_0xd187('0x2b')][_0xd187('0x38')])){return _0x595195(_0x4b121c['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x367303));}var _0x4f616d={};_0x4f616d[_0x4f3139[_0xd187('0x2b')][_0xd187('0x38')]]=_0x4f3139[_0xd187('0x2b')][_0xd187('0x35')];return db[_0xd187('0x1c')][_0xd187('0x25')]({'where':{'id':_0x4f3139[_0xd187('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0xd187('0x3a'),'include':[{'model':db[_0xd187('0x2f')],'as':_0xd187('0x3b'),'where':_0x4f616d,'limit':0x1,'order':[[_0xd187('0x31'),_0xd187('0x3c')]]}]},{'model':db[_0xd187('0x3d')],'as':_0xd187('0x3e')},{'model':db[_0xd187('0x3f')],'as':'Smtp','include':[{'model':db[_0xd187('0x40')],'as':_0xd187('0x40')}]}]})[_0xd187('0x10')](function(_0x1449d7){if(_0x1449d7&&_0x1449d7[_0xd187('0x3a')]){var _0x5ad646=_0x1449d7[_0xd187('0x41')]({'plain':!![]});_0x21bb3c[_0xd187('0x39')]=_['omit'](_0x5ad646,[_0xd187('0x3e'),_0xd187('0x3a')]);_0x21bb3c['account']['smtpOptions']=_0x1449d7['getSmtpOptions']();_0x21bb3c['applications']=_0x5ad646[_0xd187('0x3e')];_0x21bb3c[_0xd187('0x42')]=_0x5ad646[_0xd187('0x3a')];_0x21bb3c[_0xd187('0x43')]=_[_0xd187('0x44')](_0x21bb3c[_0xd187('0x43')],[_0xd187('0x45')],['asc']);if(_0x21bb3c[_0xd187('0x39')]&&_0x21bb3c[_0xd187('0x39')][_0xd187('0x46')]){_0x21bb3c[_0xd187('0x43')]['push']({'id':0x0,'priority':_0x21bb3c[_0xd187('0x43')]['length']+0x1,'app':'close','appdata':_0xd187('0x46'),'interval':'*,*,*,*'});}if(_0x21bb3c[_0xd187('0x39')][_0xd187('0x3e')]){delete _0x21bb3c[_0xd187('0x39')][_0xd187('0x3e')];}if(_0x21bb3c[_0xd187('0x39')][_0xd187('0x3a')]){delete _0x21bb3c[_0xd187('0x39')][_0xd187('0x3a')];}if(_0x5ad646[_0xd187('0x3a')]['Contacts'][_0xd187('0x47')]){return _0x5ad646[_0xd187('0x3a')]['Contacts'][0x0];}var _0x471f11=_[_0xd187('0xa')](_0x4f3139[_0xd187('0x2b')],{'firstName':_0x4f3139['body'][_0xd187('0x35')],'ListId':_0x5ad646[_0xd187('0x33')]});_0x471f11[_0x4f3139['body'][_0xd187('0x38')]]=_0x4f3139[_0xd187('0x2b')]['from'];return db[_0xd187('0x2f')]['create'](_0x471f11);}else{throw new Error(_0xd187('0x48'));}})[_0xd187('0x10')](function(_0x3a2a00){_0x21bb3c[_0xd187('0x49')]=_0x3a2a00;if(_0x3a2a00){if(!_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')]){_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x4a')]=rs[_0xd187('0x4b')]()+'\x20'+_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x35')];}var _0x945810={'ContactId':_0x3a2a00['id'],'MailAccountId':_0x4f3139[_0xd187('0x39')]['id'],'inReplyTo':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')],'to':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x35')],'cc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['cc'],'subject':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4c')],'attach':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4d')],'lastMsgAt':moment()[_0xd187('0x4e')](_0xd187('0x4f')),'lastMsgDirection':'in'};return db['MailInteraction'][_0xd187('0x25')]({'where':{'closed':![],'MailAccountId':_0x4f3139['account']['id']},'include':[{'model':db[_0xd187('0x50')],'as':_0xd187('0x51'),'attributes':[_0xd187('0x4a')],'where':{'messageId':_0x4f3139[_0xd187('0x2b')]['message'][_0xd187('0x52')]}}]})[_0xd187('0x10')](function(_0x4f89a6){if(_0x4f89a6){return[_0x4f89a6,![]];}return db['MailInteraction'][_0xd187('0x53')](_0x945810)[_0xd187('0x10')](function(_0x2870ad){return[_0x2870ad,!![]];});});}else{throw new Error(_0xd187('0x54'));}})['spread'](function(_0x2c1df4,_0x49543f){if(_0x2c1df4){_0x51c7fc=_0x49543f;if(!_0x49543f){return _0x2c1df4[_0xd187('0x55')]({'inReplyTo':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')],'to':_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x35')],'cc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['cc'],'subject':_0x4f3139[_0xd187('0x2b')]['message']['subject'],'attach':_0x2c1df4[_0xd187('0x4d')]?_0x2c1df4[_0xd187('0x4d')]:_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4d')],'substatus':null,'substatusAt':moment()[_0xd187('0x4e')](_0xd187('0x4f')),'lastMsgAt':moment()[_0xd187('0x4e')](_0xd187('0x4f')),'lastMsgDirection':'in'});}else{return _0x2c1df4;}}})[_0xd187('0x10')](function(_0x379e89){_0x21bb3c[_0xd187('0x56')]=_0x379e89['get']({'plain':!![]});_0x21bb3c[_0xd187('0x56')][_0xd187('0x57')]=_0x51c7fc;return db['MailMessage'][_0xd187('0x53')]({'body':_0x4f3139[_0xd187('0x2b')]['body'],'MailAccountId':_0x4f3139['account']['id'],'MailInteractionId':_0x379e89['id'],'direction':'in','ContactId':_0x21bb3c[_0xd187('0x49')]['id'],'messageId':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')],'from':_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x35')],'to':_0x4f3139['body']['message']['to'],'cc':_0x4f3139[_0xd187('0x2b')]['message']['cc'],'subject':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['subject'],'attach':_0x4f3139[_0xd187('0x2b')]['message'][_0xd187('0x4d')],'Attachments':_0x4f3139['body']['message']['attachments'],'originTo':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x58')],'originCc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x59')],'bcc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['bcc'],'ChatWebsiteId':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x5a')]||null,'originChannel':_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x5b')]||_0xd187('0x5c'),'ChatOfflineMessageId':_0x4f3139[_0xd187('0x2b')]['message'][_0xd187('0x5d')]||null},{'include':[{'model':db[_0xd187('0x5e')],'as':'Attachments'}]});})[_0xd187('0x10')](function(_0x3afdd9){_0x21bb3c[_0xd187('0x18')]=_0x3afdd9;if(_0x21bb3c[_0xd187('0x56')]['UserId']){return db[_0xd187('0x5f')][_0xd187('0x25')]({'attributes':['id','name'],'where':{'id':_0x21bb3c[_0xd187('0x56')]['UserId']}})['then'](function(_0x506c53){if(_0x506c53){_0x21bb3c[_0xd187('0x43')][_0xd187('0x60')]({'id':0x0,'priority':0x0,'app':_0xd187('0x61'),'appdata':_0x506c53[_0xd187('0x62')]+','+(_0x21bb3c[_0xd187('0x39')][_0xd187('0x63')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xd187('0x64'),_0xd187('0x65'),_0x21bb3c);});}return respondWithRpcPromise('Start','startRouting',_0x21bb3c);})[_0xd187('0x10')](function(_0x3e1c19){_0x538c05(_0x3e1c19);})[_0xd187('0x1a')](function(_0x1f163a){_0x595195(_0x4b121c[_0xd187('0x16')](0x1f4,_0x1f163a[_0xd187('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 9303e7b..9a54d98 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 _0xb22c=['emit','register','length','mailAccount:','save','remove','update'];(function(_0x1c30d8,_0x58c093){var _0x1154d2=function(_0xefe855){while(--_0xefe855){_0x1c30d8['push'](_0x1c30d8['shift']());}};_0x1154d2(++_0x58c093);}(_0xb22c,0x66));var _0xcb22=function(_0xb5887f,_0x1d8df0){_0xb5887f=_0xb5887f-0x0;var _0x1acf2d=_0xb22c[_0xb5887f];return _0x1acf2d;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xcb22('0x0'),_0xcb22('0x1'),_0xcb22('0x2')];function createListener(_0x2be625,_0xb07501){return function(_0x1eeaca){_0xb07501[_0xcb22('0x3')](_0x2be625,_0x1eeaca);};}function removeListener(_0x8a99b8,_0x1c4a14){return function(){MailAccountEvents['removeListener'](_0x8a99b8,_0x1c4a14);};}exports[_0xcb22('0x4')]=function(_0x11fe85){for(var _0x4728c3=0x0,_0x200316=events[_0xcb22('0x5')];_0x4728c3<_0x200316;_0x4728c3++){var _0x513fce=events[_0x4728c3];var _0x40caa8=createListener(_0xcb22('0x6')+_0x513fce,_0x11fe85);MailAccountEvents['on'](_0x513fce,_0x40caa8);}}; \ No newline at end of file +var _0x6afd=['length','mailAccount:','save','remove','update','emit','removeListener','register'];(function(_0x5c61a9,_0x4b8ddb){var _0x7b0451=function(_0xb24e4c){while(--_0xb24e4c){_0x5c61a9['push'](_0x5c61a9['shift']());}};_0x7b0451(++_0x4b8ddb);}(_0x6afd,0x9a));var _0xd6af=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x6afd[_0x8de54f];return _0x14cba4;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xd6af('0x0'),_0xd6af('0x1'),_0xd6af('0x2')];function createListener(_0x4a35a4,_0x435c0f){return function(_0x39de8a){_0x435c0f[_0xd6af('0x3')](_0x4a35a4,_0x39de8a);};}function removeListener(_0x5e4286,_0x2ec2f5){return function(){MailAccountEvents[_0xd6af('0x4')](_0x5e4286,_0x2ec2f5);};}exports[_0xd6af('0x5')]=function(_0x565aaf){for(var _0x647903=0x0,_0x36fa8f=events[_0xd6af('0x6')];_0x647903<_0x36fa8f;_0x647903++){var _0x3610cc=events[_0x647903];var _0x1c28fb=createListener(_0xd6af('0x7')+_0x3610cc,_0x565aaf);MailAccountEvents['on'](_0x3610cc,_0x1c28fb);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 2e6d515..159a673 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 _0xc6b5=['exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','/:id','show','put','delete','isAuthenticated','destroy'];(function(_0x56ee15,_0x1effd1){var _0x94991f=function(_0x5018fa){while(--_0x5018fa){_0x56ee15['push'](_0x56ee15['shift']());}};_0x94991f(++_0x1effd1);}(_0xc6b5,0x187));var _0x5c6b=function(_0x131843,_0x5753b5){_0x131843=_0x131843-0x0;var _0xdee672=_0xc6b5[_0x131843];return _0xdee672;};'use strict';var multer=require(_0x5c6b('0x0'));var util=require(_0x5c6b('0x1'));var path=require('path');var timeout=require(_0x5c6b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5c6b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5c6b('0x4'));var config=require(_0x5c6b('0x5'));var controller=require('./mailApplication.controller');router['get'](_0x5c6b('0x6'),auth['isAuthenticated'](),controller[_0x5c6b('0x7')]);router[_0x5c6b('0x8')](_0x5c6b('0x6'),auth['isAuthenticated'](),controller['update']);router[_0x5c6b('0x9')](_0x5c6b('0x6'),auth[_0x5c6b('0xa')](),controller[_0x5c6b('0xb')]);module[_0x5c6b('0xc')]=router; \ No newline at end of file +var _0x9281=['/:id','isAuthenticated','update','delete','destroy','exports','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get'];(function(_0x558615,_0x1eb496){var _0x1e032a=function(_0x538f1d){while(--_0x538f1d){_0x558615['push'](_0x558615['shift']());}};_0x1e032a(++_0x1eb496);}(_0x9281,0xc6));var _0x1928=function(_0x351c33,_0x15cae6){_0x351c33=_0x351c33-0x0;var _0x66b8fd=_0x9281[_0x351c33];return _0x66b8fd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1928('0x0'));var timeout=require(_0x1928('0x1'));var express=require(_0x1928('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1928('0x3'));var config=require(_0x1928('0x4'));var controller=require('./mailApplication.controller');router[_0x1928('0x5')](_0x1928('0x6'),auth[_0x1928('0x7')](),controller['show']);router['put'](_0x1928('0x6'),auth[_0x1928('0x7')](),controller[_0x1928('0x8')]);router[_0x1928('0x9')](_0x1928('0x6'),auth[_0x1928('0x7')](),controller[_0x1928('0xa')]);module[_0x1928('0xb')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 2207d3f..47c4c54 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 _0x7f2c=['STRING','noop','TEXT','sequelize','INTEGER'];(function(_0x44e00a,_0x248bbc){var _0x2bdfba=function(_0x5e66c4){while(--_0x5e66c4){_0x44e00a['push'](_0x44e00a['shift']());}};_0x2bdfba(++_0x248bbc);}(_0x7f2c,0x11b));var _0xc7f2=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7f2c[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xc7f2('0x0'));module['exports']={'priority':{'type':Sequelize[_0xc7f2('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc7f2('0x2')],'allowNull':![],'defaultValue':_0xc7f2('0x3')},'appdata':{'type':Sequelize[_0xc7f2('0x4')]()},'description':{'type':Sequelize[_0xc7f2('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x038f=['INTEGER','STRING','noop'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x038f,0x93));var _0xf038=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0x038f[_0x2300c7];return _0x23f720;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xf038('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xf038('0x1')],'allowNull':![],'defaultValue':_0xf038('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf038('0x1')]},'interval':{'type':Sequelize[_0xf038('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index b23501e..e79bb40 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 _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x585133,_0x2412a1){var _0x18254a=function(_0x4c8aaf){while(--_0x4c8aaf){_0x585133['push'](_0x585133['shift']());}};_0x18254a(++_0x2412a1);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file +var _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x3c2a3a,_0x23b601){var _0x3c5e96=function(_0x3f691b){while(--_0x3f691b){_0x3c2a3a['push'](_0x3c2a3a['shift']());}};_0x3c5e96(++_0x23b601);}(_0x70e0,0x17b));var _0x070e=function(_0x5db4c8,_0x46462a){_0x5db4c8=_0x5db4c8-0x0;var _0x27d8c2=_0x70e0[_0x5db4c8];return _0x27d8c2;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index cf6ab4a..1e7bb8a 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 _0x3a4b=['request-promise','path','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4','lodash','util','../../config/logger','moment'];(function(_0xb182cd,_0x3e8527){var _0x293b4d=function(_0x35a31d){while(--_0x35a31d){_0xb182cd['push'](_0xb182cd['shift']());}};_0x293b4d(++_0x3e8527);}(_0x3a4b,0x1dc));var _0xb3a4=function(_0x296a49,_0x399dbb){_0x296a49=_0x296a49-0x0;var _0x12e1e0=_0x3a4b[_0x296a49];return _0x12e1e0;};'use strict';var _=require(_0xb3a4('0x0'));var util=require(_0xb3a4('0x1'));var logger=require(_0xb3a4('0x2'))('api');var moment=require(_0xb3a4('0x3'));var BPromise=require('bluebird');var rp=require(_0xb3a4('0x4'));var fs=require('fs');var path=require(_0xb3a4('0x5'));var rimraf=require('rimraf');var config=require(_0xb3a4('0x6'));var attributes=require(_0xb3a4('0x7'));module[_0xb3a4('0x8')]=function(_0x479b4f,_0x4e2d24){return _0x479b4f['define'](_0xb3a4('0x9'),attributes,{'tableName':_0xb3a4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb3a4('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa465=['utf8mb4','util','moment','bluebird','request-promise','path','rimraf','./mailApplication.attributes','define','MailApplication'];(function(_0xd4fe09,_0x23084c){var _0x23ef4e=function(_0xed58c){while(--_0xed58c){_0xd4fe09['push'](_0xd4fe09['shift']());}};_0x23ef4e(++_0x23084c);}(_0xa465,0x19b));var _0x5a46=function(_0x490014,_0x519ad6){_0x490014=_0x490014-0x0;var _0x289bee=_0xa465[_0x490014];return _0x289bee;};'use strict';var _=require('lodash');var util=require(_0x5a46('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5a46('0x1'));var BPromise=require(_0x5a46('0x2'));var rp=require(_0x5a46('0x3'));var fs=require('fs');var path=require(_0x5a46('0x4'));var rimraf=require(_0x5a46('0x5'));var config=require('../../config/environment');var attributes=require(_0x5a46('0x6'));module['exports']=function(_0x5c2592,_0x53bc21){return _0x5c2592[_0x5a46('0x7')](_0x5a46('0x8'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5a46('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 9afa4f0..ae2a815 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 _0x81ea=['info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','UpdateMailApplication','update','options','raw','where','limit','then','stringify','lodash','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x297603,_0x4e351c){var _0x5a5f5c=function(_0x4aeb30){while(--_0x4aeb30){_0x297603['push'](_0x297603['shift']());}};_0x5a5f5c(++_0x4e351c);}(_0x81ea,0x188));var _0xa81e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x81ea[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xa81e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa81e('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xa81e('0x2'));var logger=require(_0xa81e('0x3'))('rpc');var config=require(_0xa81e('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xa81e('0x5')][_0xa81e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x13d679,_0x100c2a,_0x455cd4){return new BPromise(function(_0x294688,_0xf8fad){return client[_0xa81e('0x7')](_0x13d679,_0x455cd4)['then'](function(_0x1a4005){logger[_0xa81e('0x8')](_0xa81e('0x9'),_0x100c2a,'request\x20sent');logger[_0xa81e('0xa')](_0xa81e('0xb'),_0x100c2a,'request\x20sent',JSON['stringify'](_0x1a4005));if(_0x1a4005['error']){if(_0x1a4005[_0xa81e('0xc')][_0xa81e('0xd')]===0x1f4){logger['error'](_0xa81e('0x9'),_0x100c2a,_0x1a4005[_0xa81e('0xc')][_0xa81e('0xe')]);return _0xf8fad(_0x1a4005[_0xa81e('0xc')][_0xa81e('0xe')]);}logger[_0xa81e('0xc')](_0xa81e('0x9'),_0x100c2a,_0x1a4005['error'][_0xa81e('0xe')]);return _0x294688(_0x1a4005[_0xa81e('0xc')][_0xa81e('0xe')]);}else{logger[_0xa81e('0x8')](_0xa81e('0x9'),_0x100c2a,_0xa81e('0xf'));_0x294688(_0x1a4005[_0xa81e('0x10')][_0xa81e('0xe')]);}})['catch'](function(_0x548251){logger[_0xa81e('0xc')](_0xa81e('0x9'),_0x100c2a,_0x548251);_0xf8fad(_0x548251);});});}exports[_0xa81e('0x11')]=function(_0x340df5){var _0x43ddc7=this;return new Promise(function(_0x1912b5,_0x5c9171){return db['MailApplication'][_0xa81e('0x12')](_0x340df5['body'],{'raw':_0x340df5[_0xa81e('0x13')]?_0x340df5[_0xa81e('0x13')][_0xa81e('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x340df5[_0xa81e('0x13')]?_0x340df5[_0xa81e('0x13')][_0xa81e('0x15')]||null:null,'attributes':_0x340df5[_0xa81e('0x13')]?_0x340df5[_0xa81e('0x13')]['attributes']||null:null,'limit':_0x340df5[_0xa81e('0x13')]?_0x340df5[_0xa81e('0x13')][_0xa81e('0x16')]||null:null})[_0xa81e('0x17')](function(_0x3fe862){logger[_0xa81e('0x8')](_0xa81e('0x11'),_0x340df5);logger[_0xa81e('0xa')](_0xa81e('0x11'),_0x340df5,JSON[_0xa81e('0x18')](_0x3fe862));_0x1912b5(_0x3fe862);})['catch'](function(_0x7c9bec){logger[_0xa81e('0xc')](_0xa81e('0x11'),_0x7c9bec['message'],_0x340df5);_0x5c9171(_0x43ddc7['error'](0x1f4,_0x7c9bec[_0xa81e('0xe')]));});});}; \ No newline at end of file +var _0x78d8=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','UpdateMailApplication','MailApplication','update','options','raw','where','attributes','limit','lodash','util'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x78d8,0x120));var _0x878d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x78d8[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x878d('0x0'));var util=require(_0x878d('0x1'));var moment=require(_0x878d('0x2'));var BPromise=require(_0x878d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x878d('0x4'));var db=require(_0x878d('0x5'))['db'];var utils=require(_0x878d('0x6'));var logger=require('../../config/logger')(_0x878d('0x7'));var config=require(_0x878d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x878d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5bd5ef,_0x2af687,_0x481890){return new BPromise(function(_0x2a9ef0,_0x2a71f7){return client[_0x878d('0xa')](_0x5bd5ef,_0x481890)[_0x878d('0xb')](function(_0x5ae164){logger['info'](_0x878d('0xc'),_0x2af687,_0x878d('0xd'));logger[_0x878d('0xe')](_0x878d('0xf'),_0x2af687,_0x878d('0xd'),JSON[_0x878d('0x10')](_0x5ae164));if(_0x5ae164[_0x878d('0x11')]){if(_0x5ae164[_0x878d('0x11')]['code']===0x1f4){logger[_0x878d('0x11')]('MailApplication,\x20%s,\x20%s',_0x2af687,_0x5ae164[_0x878d('0x11')][_0x878d('0x12')]);return _0x2a71f7(_0x5ae164[_0x878d('0x11')][_0x878d('0x12')]);}logger['error'](_0x878d('0xc'),_0x2af687,_0x5ae164['error']['message']);return _0x2a9ef0(_0x5ae164[_0x878d('0x11')][_0x878d('0x12')]);}else{logger[_0x878d('0x13')]('MailApplication,\x20%s,\x20%s',_0x2af687,_0x878d('0xd'));_0x2a9ef0(_0x5ae164['result'][_0x878d('0x12')]);}})[_0x878d('0x14')](function(_0x4fe893){logger[_0x878d('0x11')](_0x878d('0xc'),_0x2af687,_0x4fe893);_0x2a71f7(_0x4fe893);});});}exports[_0x878d('0x15')]=function(_0x5e6cde){var _0x2ceec7=this;return new Promise(function(_0x11944a,_0x26d59b){return db[_0x878d('0x16')][_0x878d('0x17')](_0x5e6cde['body'],{'raw':_0x5e6cde[_0x878d('0x18')]?_0x5e6cde[_0x878d('0x18')][_0x878d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e6cde[_0x878d('0x18')]?_0x5e6cde['options'][_0x878d('0x1a')]||null:null,'attributes':_0x5e6cde['options']?_0x5e6cde[_0x878d('0x18')][_0x878d('0x1b')]||null:null,'limit':_0x5e6cde[_0x878d('0x18')]?_0x5e6cde[_0x878d('0x18')][_0x878d('0x1c')]||null:null})[_0x878d('0xb')](function(_0x5884fb){logger[_0x878d('0x13')](_0x878d('0x15'),_0x5e6cde);logger[_0x878d('0xe')]('UpdateMailApplication',_0x5e6cde,JSON[_0x878d('0x10')](_0x5884fb));_0x11944a(_0x5884fb);})[_0x878d('0x14')](function(_0xc24b1d){logger['error']('UpdateMailApplication',_0xc24b1d[_0x878d('0x12')],_0x5e6cde);_0x26d59b(_0x2ceec7[_0x878d('0x11')](0x1f4,_0xc24b1d[_0x878d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 49cd473..c430dc2 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 _0xd6cd=['mailinteraction:update','update','delete','mailinteraction:destroy','destroy','/:id/tags','removeTags','exports','express','../../components/auth/service','./mailInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','tracked','mail','mailinteraction:addtags','addTags'];(function(_0x6d433e,_0x43ff2f){var _0x15b71c=function(_0x3dae80){while(--_0x3dae80){_0x6d433e['push'](_0x6d433e['shift']());}};_0x15b71c(++_0x43ff2f);}(_0xd6cd,0x19d));var _0xdd6c=function(_0x518859,_0x4b6e03){_0x518859=_0x518859-0x0;var _0x23ac54=_0xd6cd[_0x518859];return _0x23ac54;};'use strict';var express=require(_0xdd6c('0x0'));var router=express['Router']();var auth=require(_0xdd6c('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0xdd6c('0x2'));router[_0xdd6c('0x3')]('/',auth['isAuthenticated'](),controller[_0xdd6c('0x4')]);router[_0xdd6c('0x3')](_0xdd6c('0x5'),auth[_0xdd6c('0x6')](),controller[_0xdd6c('0x7')]);router[_0xdd6c('0x3')](_0xdd6c('0x8'),auth['isAuthenticated'](),controller[_0xdd6c('0x9')]);router['get'](_0xdd6c('0xa'),auth[_0xdd6c('0x6')](),controller[_0xdd6c('0xb')]);router['get'](_0xdd6c('0xc'),auth[_0xdd6c('0x6')](),controller['download']);router[_0xdd6c('0xd')]('/',auth['isAuthenticated'](),controller[_0xdd6c('0xe')]);router['post'](_0xdd6c('0xa'),auth[_0xdd6c('0x6')](),controller['addMessage']);router[_0xdd6c('0xd')]('/:id/tags',auth[_0xdd6c('0x6')](),interaction[_0xdd6c('0xf')](_0xdd6c('0x10'),_0xdd6c('0x11')),controller[_0xdd6c('0x12')]);router['put']('/:id',auth[_0xdd6c('0x6')](),interaction[_0xdd6c('0xf')](_0xdd6c('0x10'),_0xdd6c('0x13')),controller[_0xdd6c('0x14')]);router[_0xdd6c('0x15')](_0xdd6c('0x8'),auth[_0xdd6c('0x6')](),interaction[_0xdd6c('0xf')](_0xdd6c('0x10'),_0xdd6c('0x16')),controller[_0xdd6c('0x17')]);router[_0xdd6c('0x15')](_0xdd6c('0x18'),auth[_0xdd6c('0x6')](),controller[_0xdd6c('0x19')]);module[_0xdd6c('0x1a')]=router; \ No newline at end of file +var _0x08ce=['Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','tracked','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','exports'];(function(_0x3d4f79,_0x43c681){var _0x390012=function(_0x353cc2){while(--_0x353cc2){_0x3d4f79['push'](_0x3d4f79['shift']());}};_0x390012(++_0x43c681);}(_0x08ce,0xbd));var _0xe08c=function(_0x2fdd18,_0x21f7cb){_0x2fdd18=_0x2fdd18-0x0;var _0x1c0217=_0x08ce[_0x2fdd18];return _0x1c0217;};'use strict';var express=require('express');var router=express[_0xe08c('0x0')]();var auth=require(_0xe08c('0x1'));var interaction=require(_0xe08c('0x2'));var controller=require('./mailInteraction.controller');router[_0xe08c('0x3')]('/',auth['isAuthenticated'](),controller[_0xe08c('0x4')]);router[_0xe08c('0x3')](_0xe08c('0x5'),auth[_0xe08c('0x6')](),controller['describe']);router[_0xe08c('0x3')](_0xe08c('0x7'),auth[_0xe08c('0x6')](),controller[_0xe08c('0x8')]);router['get'](_0xe08c('0x9'),auth['isAuthenticated'](),controller['getMessages']);router[_0xe08c('0x3')](_0xe08c('0xa'),auth['isAuthenticated'](),controller[_0xe08c('0xb')]);router[_0xe08c('0xc')]('/',auth[_0xe08c('0x6')](),controller[_0xe08c('0xd')]);router['post'](_0xe08c('0x9'),auth[_0xe08c('0x6')](),controller[_0xe08c('0xe')]);router[_0xe08c('0xc')](_0xe08c('0xf'),auth['isAuthenticated'](),interaction['tracked'](_0xe08c('0x10'),_0xe08c('0x11')),controller[_0xe08c('0x12')]);router[_0xe08c('0x13')](_0xe08c('0x7'),auth[_0xe08c('0x6')](),interaction[_0xe08c('0x14')](_0xe08c('0x10'),_0xe08c('0x15')),controller[_0xe08c('0x16')]);router[_0xe08c('0x17')](_0xe08c('0x7'),auth['isAuthenticated'](),interaction[_0xe08c('0x14')](_0xe08c('0x10'),_0xe08c('0x18')),controller[_0xe08c('0x19')]);router[_0xe08c('0x17')](_0xe08c('0xf'),auth[_0xe08c('0x6')](),controller['removeTags']);module[_0xe08c('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 2d05f77..8601ca1 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 _0x0f83=['DATE','ENUM','out','iconv','exports','STRING','TEXT','long','BOOLEAN'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0x0f83,0x66));var _0x30f8=function(_0x359fe4,_0x50f9e4){_0x359fe4=_0x359fe4-0x0;var _0x32e4a3=_0x0f83[_0x359fe4];return _0x32e4a3;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x30f8('0x0'));module[_0x30f8('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x30f8('0x2')]},'secondDisposition':{'type':Sequelize[_0x30f8('0x2')]},'thirdDisposition':{'type':Sequelize[_0x30f8('0x2')]},'note':{'type':Sequelize[_0x30f8('0x2')]},'inReplyTo':{'type':Sequelize[_0x30f8('0x2')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x30f8('0x3')](_0x30f8('0x4'))},'subject':{'type':Sequelize[_0x30f8('0x3')]()},'attach':{'type':Sequelize[_0x30f8('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x30f8('0x6')]},'substatus':{'type':Sequelize[_0x30f8('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x30f8('0x6')]},'firstMsgDirection':{'type':Sequelize[_0x30f8('0x7')]('in',_0x30f8('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x30f8('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x30f8('0x7')]('in',_0x30f8('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x30f8('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x93f5=['TEXT','long','ENUM','out','sequelize','BOOLEAN','DATE','STRING'];(function(_0x356a7e,_0x1d1abc){var _0xe84f52=function(_0x3286cc){while(--_0x3286cc){_0x356a7e['push'](_0x356a7e['shift']());}};_0xe84f52(++_0x1d1abc);}(_0x93f5,0x10c));var _0x593f=function(_0xff86f5,_0x1ffa07){_0xff86f5=_0xff86f5-0x0;var _0x4ac851=_0x93f5[_0xff86f5];return _0x4ac851;};'use strict';var Sequelize=require(_0x593f('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0x593f('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x593f('0x2')]},'disposition':{'type':Sequelize[_0x593f('0x3')]},'secondDisposition':{'type':Sequelize[_0x593f('0x3')]},'thirdDisposition':{'type':Sequelize[_0x593f('0x3')]},'note':{'type':Sequelize[_0x593f('0x3')]},'inReplyTo':{'type':Sequelize[_0x593f('0x3')](0x1fe)},'to':{'type':Sequelize[_0x593f('0x3')]},'cc':{'type':Sequelize[_0x593f('0x4')](_0x593f('0x5'))},'subject':{'type':Sequelize[_0x593f('0x4')]()},'attach':{'type':Sequelize[_0x593f('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x593f('0x2')]},'substatus':{'type':Sequelize[_0x593f('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x593f('0x6')]('in',_0x593f('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x593f('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x593f('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x593f('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index fca9956..7a007ec 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 _0xd4ac=['rimraf','moment','path','lodash','juice','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','name','send','index','map','fieldName','type','key','getOptions','findAll','query','user','model','keys','rawAttributes','filters','intersection','attributes','fields','include','merge','options','MailInteraction','find','catch','create','body','params','destroy','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','includeAll','inlineCss','true','length','rows','spread','color','emit','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','each','from','headers','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync'];(function(_0x2698b5,_0x2faad4){var _0x5375c1=function(_0x5d5348){while(--_0x5d5348){_0x2698b5['push'](_0x2698b5['shift']());}};_0x5375c1(++_0x2faad4);}(_0xd4ac,0x1b4));var _0xcd4a=function(_0x5a190c,_0x5a64f6){_0x5a190c=_0x5a190c-0x0;var _0x2fb442=_0xd4ac[_0x5a190c];return _0x2fb442;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd4a('0x0'));var zipdir=require('zip-dir');var moment=require(_0xcd4a('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xcd4a('0x2'));var fs=require('fs');var _=require(_0xcd4a('0x3'));var juice=require(_0xcd4a('0x4'));var Redis=require('ioredis');var interaction=require(_0xcd4a('0x5'));var qs=require(_0xcd4a('0x6'));var logger=require('../../config/logger')(_0xcd4a('0x7'));var config=require(_0xcd4a('0x8'));var db=require(_0xcd4a('0x9'))['db'];var htmlEntities=require(_0xcd4a('0xa'));config[_0xcd4a('0xb')]=_[_0xcd4a('0xc')](config[_0xcd4a('0xb')],{'host':_0xcd4a('0xd'),'port':0x18eb});var socket=require(_0xcd4a('0xe'))(new Redis(config[_0xcd4a('0xb')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x1c69ef,_0x58d75b){_0x58d75b=_0x58d75b||0xcc;return function(_0x1d0c29){if(_0x1d0c29){return _0x1c69ef[_0xcd4a('0xf')](_0x58d75b);}return _0x1c69ef[_0xcd4a('0x10')](_0x58d75b)[_0xcd4a('0x11')]();};}function respondWithResult(_0x3bd88e,_0x1e3686){_0x1e3686=_0x1e3686||0xc8;return function(_0xd50b6f){if(_0xd50b6f){return _0x3bd88e[_0xcd4a('0x10')](_0x1e3686)[_0xcd4a('0x12')](_0xd50b6f);}};}function respondWithFilteredResult(_0x30320b,_0x14aa1f){return function(_0x45400f){if(_0x45400f){var _0x2e0527=typeof _0x14aa1f[_0xcd4a('0x13')]==='undefined'&&typeof _0x14aa1f['limit']===_0xcd4a('0x14');var _0x113e29=_0x45400f[_0xcd4a('0x15')];var _0x17b663=_0x2e0527?0x0:_0x14aa1f['offset'];var _0x4fde4b=_0x2e0527?_0x45400f['count']:_0x14aa1f[_0xcd4a('0x13')]+_0x14aa1f[_0xcd4a('0x16')];var _0x1f367c;if(_0x4fde4b>=_0x113e29){_0x4fde4b=_0x113e29;_0x1f367c=0xc8;}else{_0x1f367c=0xce;}_0x30320b['status'](_0x1f367c);return _0x30320b[_0xcd4a('0x17')](_0xcd4a('0x18'),_0x17b663+'-'+_0x4fde4b+'/'+_0x113e29)[_0xcd4a('0x12')](_0x45400f);}return null;};}function saveUpdates(_0x1de497){return function(_0x13d9c7){if(_0x13d9c7){return _0x13d9c7['update'](_0x1de497)[_0xcd4a('0x19')](function(_0x103669){return _0x103669;});}return null;};}function removeEntity(_0xcc8136){return function(_0x3dca5c){if(_0x3dca5c){return _0x3dca5c['destroy']()['then'](function(){_0xcc8136['status'](0xcc)[_0xcd4a('0x11')]();});}};}function handleEntityNotFound(_0x1ada7c){return function(_0x1e8908){if(!_0x1e8908){_0x1ada7c[_0xcd4a('0xf')](0x194);}return _0x1e8908;};}function handleError(_0x1a6607,_0x14ec6d){_0x14ec6d=_0x14ec6d||0x1f4;return function(_0x3b57f7){logger['error'](_0x3b57f7['stack']);if(_0x3b57f7[_0xcd4a('0x1a')]){delete _0x3b57f7['name'];}_0x1a6607[_0xcd4a('0x10')](_0x14ec6d)[_0xcd4a('0x1b')](_0x3b57f7);};}exports[_0xcd4a('0x1c')]=function(_0x4f1a6a,_0x46a556){var _0x38f1e9={};var _0x123803=_[_0xcd4a('0x1d')](db['MailInteraction']['rawAttributes'],function(_0x141ed8){return{'name':_0x141ed8[_0xcd4a('0x1e')],'type':_0x141ed8[_0xcd4a('0x1f')][_0xcd4a('0x20')]};});_0x38f1e9=qs[_0xcd4a('0x21')](_0x123803,_0x4f1a6a);return interaction[_0xcd4a('0x22')]('mail',_0x4f1a6a[_0xcd4a('0x23')],_0x4f1a6a[_0xcd4a('0x24')],_0x38f1e9,_0x123803)['then'](respondWithFilteredResult(_0x46a556,_0x38f1e9))['catch'](handleError(_0x46a556,null));};exports['show']=function(_0x602d3,_0x29248c){var _0x483613={'raw':![],'where':{'id':_0x602d3['params']['id']}},_0x38251a={};_0x38251a[_0xcd4a('0x25')]=_[_0xcd4a('0x26')](db['MailInteraction'][_0xcd4a('0x27')]);_0x38251a['query']=_[_0xcd4a('0x26')](_0x602d3[_0xcd4a('0x23')]);_0x38251a[_0xcd4a('0x28')]=_[_0xcd4a('0x29')](_0x38251a['model'],_0x38251a[_0xcd4a('0x23')]);_0x483613[_0xcd4a('0x2a')]=_[_0xcd4a('0x29')](_0x38251a[_0xcd4a('0x25')],qs[_0xcd4a('0x2b')](_0x602d3['query']['fields']));_0x483613['attributes']=_0x483613[_0xcd4a('0x2a')]['length']?_0x483613['attributes']:_0x38251a[_0xcd4a('0x25')];if(_0x602d3[_0xcd4a('0x23')]['includeAll']){_0x483613[_0xcd4a('0x2c')]=[{'all':!![]}];}_0x483613=_[_0xcd4a('0x2d')]({},_0x483613,_0x602d3[_0xcd4a('0x2e')]);return db[_0xcd4a('0x2f')][_0xcd4a('0x30')](_0x483613)[_0xcd4a('0x19')](handleEntityNotFound(_0x29248c,null))[_0xcd4a('0x19')](respondWithResult(_0x29248c,null))[_0xcd4a('0x31')](handleError(_0x29248c,null));};exports['create']=function(_0x54e55a,_0x12b98e){return db[_0xcd4a('0x2f')][_0xcd4a('0x32')](_0x54e55a[_0xcd4a('0x33')],{})[_0xcd4a('0x19')](respondWithResult(_0x12b98e,0xc9))[_0xcd4a('0x31')](handleError(_0x12b98e,null));};exports['update']=function(_0x1632d7,_0x12aa0f){if(_0x1632d7[_0xcd4a('0x33')]['id']){delete _0x1632d7['body']['id'];}return db[_0xcd4a('0x2f')][_0xcd4a('0x30')]({'where':{'id':_0x1632d7[_0xcd4a('0x34')]['id']}})[_0xcd4a('0x19')](handleEntityNotFound(_0x12aa0f,null))[_0xcd4a('0x19')](saveUpdates(_0x1632d7[_0xcd4a('0x33')],null))[_0xcd4a('0x19')](respondWithResult(_0x12aa0f,null))[_0xcd4a('0x31')](handleError(_0x12aa0f,null));};exports[_0xcd4a('0x35')]=function(_0x215ee9,_0x197b54){return db[_0xcd4a('0x2f')][_0xcd4a('0x30')]({'where':{'id':_0x215ee9[_0xcd4a('0x34')]['id']}})[_0xcd4a('0x19')](handleEntityNotFound(_0x197b54,null))[_0xcd4a('0x19')](removeEntity(_0x197b54,null))[_0xcd4a('0x31')](handleError(_0x197b54,null));};exports[_0xcd4a('0x36')]=function(_0x408bc2,_0x131521){return db[_0xcd4a('0x2f')][_0xcd4a('0x36')]()['then'](respondWithResult(_0x131521,null))[_0xcd4a('0x31')](handleError(_0x131521,null));};exports[_0xcd4a('0x37')]=function(_0x4a2d61,_0x2d9040){return db[_0xcd4a('0x38')][_0xcd4a('0x30')]({'where':{'id':_0x4a2d61[_0xcd4a('0x34')]['id']}})[_0xcd4a('0x19')](handleEntityNotFound(_0x2d9040,null))[_0xcd4a('0x19')](function(_0x3b3cc7){if(_0x3b3cc7){return _0x3b3cc7[_0xcd4a('0x37')](_0x4a2d61[_0xcd4a('0x33')][_0xcd4a('0x39')],_[_0xcd4a('0x3a')](_0x4a2d61['body'],[_0xcd4a('0x39'),'id'])||{});}})[_0xcd4a('0x19')](respondWithResult(_0x2d9040,null))[_0xcd4a('0x31')](handleError(_0x2d9040,null));};exports[_0xcd4a('0x3b')]=function(_0xade23a,_0x493062){var _0x4216e6={'raw':![],'where':{}};var _0x55fe85={};var _0x1f8d60={'count':0x0,'rows':[]};return db['MailInteraction'][_0xcd4a('0x3c')]({'where':{'id':_0xade23a[_0xcd4a('0x34')]['id']}})[_0xcd4a('0x19')](handleEntityNotFound(_0x493062,null))[_0xcd4a('0x19')](function(_0x5b0613){if(_0x5b0613){_0x55fe85['model']=_[_0xcd4a('0x26')](db[_0xcd4a('0x38')][_0xcd4a('0x27')]);_0x55fe85[_0xcd4a('0x23')]=_[_0xcd4a('0x26')](_0xade23a['query']);_0x55fe85[_0xcd4a('0x28')]=_[_0xcd4a('0x29')](_0x55fe85['model'],_0x55fe85[_0xcd4a('0x23')]);_0x4216e6['attributes']=_['intersection'](_0x55fe85[_0xcd4a('0x25')],qs[_0xcd4a('0x2b')](_0xade23a[_0xcd4a('0x23')]['fields']));_0x4216e6[_0xcd4a('0x2a')]=_0x4216e6[_0xcd4a('0x2a')]['length']?_0x4216e6[_0xcd4a('0x2a')]:_0x55fe85[_0xcd4a('0x25')];if(!_0xade23a[_0xcd4a('0x23')][_0xcd4a('0x3d')](_0xcd4a('0x3e'))){_0x4216e6['limit']=qs[_0xcd4a('0x16')](_0xade23a[_0xcd4a('0x23')][_0xcd4a('0x16')]);_0x4216e6[_0xcd4a('0x13')]=qs[_0xcd4a('0x13')](_0xade23a['query'][_0xcd4a('0x13')]);}_0x4216e6[_0xcd4a('0x3f')]=qs[_0xcd4a('0x40')](_0xade23a[_0xcd4a('0x23')][_0xcd4a('0x40')]);_0x4216e6[_0xcd4a('0x41')]=qs['filters'](_[_0xcd4a('0x42')](_0xade23a[_0xcd4a('0x23')],_0x55fe85[_0xcd4a('0x28')]));_0x4216e6[_0xcd4a('0x41')][_0xcd4a('0x43')]=_0x5b0613['id'];if(_0xade23a['query'][_0xcd4a('0x44')]){_0x4216e6[_0xcd4a('0x41')]=_[_0xcd4a('0x2d')](_0x4216e6[_0xcd4a('0x41')],{'$or':_[_0xcd4a('0x1d')](_0x4216e6[_0xcd4a('0x2a')],function(_0xe40671){var _0x389e0b={};_0x389e0b[_0xe40671]={'$like':'%'+_0xade23a['query'][_0xcd4a('0x44')]+'%'};return _0x389e0b;})});}if(_0xade23a['query'][_0xcd4a('0x45')]){var _0x55b033=_0xade23a[_0xcd4a('0x23')][_0xcd4a('0x45')][_0xcd4a('0x46')](',');var _0x205abe={};_0x205abe[_0x55b033[0x0]]={'$gte':moment(_0x55b033[0x1])[_0xcd4a('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4216e6[_0xcd4a('0x41')]=_['merge'](_0x4216e6[_0xcd4a('0x41')],_0x205abe);}_0x4216e6=_['merge']({},_0x4216e6,_0xade23a['options']);return db[_0xcd4a('0x38')][_0xcd4a('0x15')]({'where':_0x4216e6[_0xcd4a('0x41')]})['then'](function(_0x260dba){_0x1f8d60[_0xcd4a('0x15')]=_0x260dba;if(_0xade23a[_0xcd4a('0x23')][_0xcd4a('0x48')]){_0x4216e6['include']=[{'all':!![]}];}return db[_0xcd4a('0x38')][_0xcd4a('0x22')](_0x4216e6);})[_0xcd4a('0x19')](function(_0x3405e5){if(_0xade23a[_0xcd4a('0x23')][_0xcd4a('0x49')]===_0xcd4a('0x4a')){for(var _0x4387a9=0x0;_0x4387a9<_0x3405e5[_0xcd4a('0x4b')];_0x4387a9++){_0x3405e5[_0x4387a9][_0xcd4a('0x33')]=juice(_0x3405e5[_0x4387a9][_0xcd4a('0x33')]);}}_0x1f8d60[_0xcd4a('0x4c')]=_0x3405e5;return _0x1f8d60;});}})[_0xcd4a('0x19')](respondWithFilteredResult(_0x493062,_0x4216e6))[_0xcd4a('0x31')](handleError(_0x493062,null));};exports['addTags']=function(_0x20cc79,_0x2c0670){return db[_0xcd4a('0x2f')][_0xcd4a('0x30')]({'where':{'id':_0x20cc79[_0xcd4a('0x34')]['id']}})['then'](handleEntityNotFound(_0x2c0670,null))[_0xcd4a('0x19')](function(_0x4dffc1){if(_0x4dffc1){return _0x4dffc1['setTags'](_0x20cc79['body'][_0xcd4a('0x39')],_['omit'](_0x20cc79[_0xcd4a('0x33')],[_0xcd4a('0x39'),'id'])||{})[_0xcd4a('0x4d')](function(){return db['Tag'][_0xcd4a('0x22')]({'attributes':['id',_0xcd4a('0x1a'),_0xcd4a('0x4e')],'where':{'id':_0x20cc79[_0xcd4a('0x33')]['ids']}});})[_0xcd4a('0x19')](function(_0x4e7ad7){socket[_0xcd4a('0x4f')]('mailInteractionTags:save',{'id':Number(_0x20cc79['params']['id']),'tags':_0x4e7ad7||[]});return{'id':Number(_0x20cc79['params']['id']),'tags':_0x4e7ad7||[]};});}})[_0xcd4a('0x19')](respondWithResult(_0x2c0670,null))['catch'](handleError(_0x2c0670,null));};exports[_0xcd4a('0x50')]=function(_0x223f9c,_0x287a55){return db[_0xcd4a('0x2f')][_0xcd4a('0x30')]({'where':{'id':_0x223f9c['params']['id']}})[_0xcd4a('0x19')](handleEntityNotFound(_0x287a55,null))[_0xcd4a('0x19')](function(_0x5005d7){if(_0x5005d7){return _0x5005d7[_0xcd4a('0x50')](_0x223f9c[_0xcd4a('0x23')][_0xcd4a('0x39')]);}})[_0xcd4a('0x19')](respondWithStatusCode(_0x287a55,null))[_0xcd4a('0x31')](handleError(_0x287a55,null));};exports[_0xcd4a('0x51')]=function(_0x41f7da,_0x2d033e){var _0x85f523=moment()[_0xcd4a('0x52')]()['toString']();var _0x3bc625=path['join'](config[_0xcd4a('0x53')],_0xcd4a('0x54'),_0xcd4a('0x55'),_0xcd4a('0x56'));var _0x728f8a=path[_0xcd4a('0x57')](config[_0xcd4a('0x53')],_0xcd4a('0x54'),_0xcd4a('0x55'),_0xcd4a('0x58'));var _0x50a4cb=path[_0xcd4a('0x57')](_0x3bc625,_0x85f523);var _0x4add37=util[_0xcd4a('0x47')](_0xcd4a('0x59'),_0x41f7da[_0xcd4a('0x34')]['id'],_0x85f523);var _0x22e406=path[_0xcd4a('0x57')](_0x3bc625,_0x4add37);var _0x1e0298=[];if(_0x41f7da[_0xcd4a('0x23')][_0xcd4a('0x58')]){_0x1e0298[_0xcd4a('0x5a')]({'model':db[_0xcd4a('0x5b')],'as':_0xcd4a('0x5c'),'raw':!![]});}var _0x56b3f8=[{'model':db[_0xcd4a('0x38')],'as':_0xcd4a('0x5d'),'attributes':['id',_0xcd4a('0x33'),'from','to','cc',_0xcd4a('0x5e'),_0xcd4a('0x5f'),_0xcd4a('0x60')],'where':{'secret':![]},'order':qs[_0xcd4a('0x40')]('id'),'include':_0x1e0298}];return db[_0xcd4a('0x2f')][_0xcd4a('0x30')]({'where':{'id':_0x41f7da[_0xcd4a('0x34')]['id']},'include':_0x56b3f8})['then'](handleEntityNotFound(_0x2d033e,null))[_0xcd4a('0x19')](function(_0x56b3de){if(_0x56b3de&&_0x56b3de[_0xcd4a('0x5d')]){var _0x1bce3f=_0x56b3de[_0xcd4a('0x61')]({'plain':!![]});fs[_0xcd4a('0x62')](_0x50a4cb);return BPromise[_0xcd4a('0x63')](_0x1bce3f[_0xcd4a('0x5d')],function(_0x4439a4,_0x45461e){var _0x5d398d={'from':_0x4439a4[_0xcd4a('0x64')],'to':_0x4439a4['to']||'missing.recipient@your.company.com','subject':_0x4439a4[_0xcd4a('0x5f')],'html':htmlEntities['decode'](_0x4439a4[_0xcd4a('0x33')]),'headers':{'Date':moment(_0x4439a4[_0xcd4a('0x60')])[_0xcd4a('0x47')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x4439a4['cc']){_0x5d398d[_0xcd4a('0x65')]['Cc']=_0x4439a4['cc'];}if(_0x4439a4[_0xcd4a('0x5e')]){_0x5d398d[_0xcd4a('0x65')][_0xcd4a('0x66')]=_0x4439a4[_0xcd4a('0x5e')];}return new BPromise(function(_0x51d33a,_0x2cc05b){if(_0x4439a4[_0xcd4a('0x5c')]){for(var _0x6eae7a=0x0;_0x6eae7a<_0x4439a4[_0xcd4a('0x5c')][_0xcd4a('0x4b')];_0x6eae7a++){var _0x58bb63=_0x4439a4[_0xcd4a('0x5c')][_0x6eae7a];var _0x5f53d8=path[_0xcd4a('0x57')](_0x728f8a,_0x58bb63[_0xcd4a('0x67')]);if(fs[_0xcd4a('0x68')](_0x5f53d8)){_0x5d398d['attachments']['push']({'name':_0x58bb63[_0xcd4a('0x1a')],'contentType':_0x58bb63[_0xcd4a('0x1f')],'data':fs[_0xcd4a('0x69')](_0x5f53d8)});}}}emlformat['build'](_0x5d398d,function(_0xe9789e,_0x1c32c1){if(_0xe9789e)return _0x2cc05b(_0xe9789e);fs[_0xcd4a('0x6a')](path[_0xcd4a('0x57')](_0x50a4cb,util['format'](_0xcd4a('0x6b'),_0x45461e)),_0x1c32c1);return _0x51d33a(_0x1c32c1);});});})['then'](function(){return new BPromise(function(_0x2ffa0a,_0x2f9857){zipdir(_0x50a4cb,{'saveTo':_0x22e406},function(_0x1f2a5f,_0x226cba){if(_0x1f2a5f)return _0x2f9857(_0x1f2a5f);return _0x2ffa0a(_0x226cba);});})['then'](function(){return new BPromise(function(_0x386edd,_0x18e391){rimraf(_0x50a4cb,function(_0x2ea7fe){if(_0x2ea7fe)_0x18e391(_0x2ea7fe);return _0x386edd();});});})[_0xcd4a('0x19')](function(){return _0x2d033e['download'](_0x22e406,_0x4add37,function(_0x343f1f){if(!_0x343f1f)fs[_0xcd4a('0x6c')](_0x22e406);});});});}else{return _0x2d033e[_0xcd4a('0xf')](0xc8);}})['catch'](handleError(_0x2d033e,null));}; \ No newline at end of file +var _0x5512=['offset','undefined','limit','count','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','map','MailInteraction','rawAttributes','fieldName','type','key','findAll','query','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','body','describe','addMessage','MailMessage','getMessages','findOne','nolimit','where','pick','MailInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','true','rows','setTags','ids','omit','spread','color','mailInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','attachments','join','format','transcript-%d-%s.zip','push','Attachment','Messages','bcc','subject','createdAt','sort','get','mkdirSync','each','from','missing.recipient@your.company.com','decode','headers','Bcc','Attachments','basename','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','end','status','json'];(function(_0x3ba466,_0x58e1a5){var _0x5065c8=function(_0x5cf367){while(--_0x5cf367){_0x3ba466['push'](_0x3ba466['shift']());}};_0x5065c8(++_0x58e1a5);}(_0x5512,0xcf));var _0x2551=function(_0x48c785,_0xd2bc23){_0x48c785=_0x48c785-0x0;var _0xa67dda=_0x5512[_0x48c785];return _0xa67dda;};'use strict';var emlformat=require(_0x2551('0x0'));var rimraf=require(_0x2551('0x1'));var zipdir=require('zip-dir');var moment=require(_0x2551('0x2'));var BPromise=require(_0x2551('0x3'));var util=require(_0x2551('0x4'));var path=require(_0x2551('0x5'));var fs=require('fs');var _=require(_0x2551('0x6'));var juice=require(_0x2551('0x7'));var Redis=require(_0x2551('0x8'));var interaction=require('../../components/interaction/service');var qs=require(_0x2551('0x9'));var logger=require(_0x2551('0xa'))(_0x2551('0xb'));var config=require(_0x2551('0xc'));var db=require(_0x2551('0xd'))['db'];var htmlEntities=require(_0x2551('0xe'));config[_0x2551('0xf')]=_[_0x2551('0x10')](config[_0x2551('0xf')],{'host':_0x2551('0x11'),'port':0x18eb});var socket=require(_0x2551('0x12'))(new Redis(config[_0x2551('0xf')]));require(_0x2551('0x13'))['register'](socket);function respondWithStatusCode(_0x21cf10,_0x314222){_0x314222=_0x314222||0xcc;return function(_0x2ad6dd){if(_0x2ad6dd){return _0x21cf10['sendStatus'](_0x314222);}return _0x21cf10['status'](_0x314222)[_0x2551('0x14')]();};}function respondWithResult(_0x2195c9,_0x209394){_0x209394=_0x209394||0xc8;return function(_0x2663a9){if(_0x2663a9){return _0x2195c9[_0x2551('0x15')](_0x209394)[_0x2551('0x16')](_0x2663a9);}};}function respondWithFilteredResult(_0x10625c,_0x4584ab){return function(_0x13f6b6){if(_0x13f6b6){var _0xf1b6c2=typeof _0x4584ab[_0x2551('0x17')]===_0x2551('0x18')&&typeof _0x4584ab[_0x2551('0x19')]===_0x2551('0x18');var _0x3695a2=_0x13f6b6[_0x2551('0x1a')];var _0x5449d6=_0xf1b6c2?0x0:_0x4584ab[_0x2551('0x17')];var _0x255219=_0xf1b6c2?_0x13f6b6[_0x2551('0x1a')]:_0x4584ab[_0x2551('0x17')]+_0x4584ab[_0x2551('0x19')];var _0x24f9e5;if(_0x255219>=_0x3695a2){_0x255219=_0x3695a2;_0x24f9e5=0xc8;}else{_0x24f9e5=0xce;}_0x10625c[_0x2551('0x15')](_0x24f9e5);return _0x10625c[_0x2551('0x1b')](_0x2551('0x1c'),_0x5449d6+'-'+_0x255219+'/'+_0x3695a2)[_0x2551('0x16')](_0x13f6b6);}return null;};}function saveUpdates(_0x6c01f7){return function(_0x38ec1f){if(_0x38ec1f){return _0x38ec1f[_0x2551('0x1d')](_0x6c01f7)[_0x2551('0x1e')](function(_0x22437e){return _0x22437e;});}return null;};}function removeEntity(_0x371805){return function(_0x1b12f2){if(_0x1b12f2){return _0x1b12f2[_0x2551('0x1f')]()['then'](function(){_0x371805[_0x2551('0x15')](0xcc)[_0x2551('0x14')]();});}};}function handleEntityNotFound(_0x3237cf){return function(_0xe3077b){if(!_0xe3077b){_0x3237cf[_0x2551('0x20')](0x194);}return _0xe3077b;};}function handleError(_0x589e4d,_0x30088b){_0x30088b=_0x30088b||0x1f4;return function(_0x2162f1){logger[_0x2551('0x21')](_0x2162f1[_0x2551('0x22')]);if(_0x2162f1[_0x2551('0x23')]){delete _0x2162f1[_0x2551('0x23')];}_0x589e4d['status'](_0x30088b)['send'](_0x2162f1);};}exports['index']=function(_0x3d633e,_0x20f2cc){var _0x4a7d9d={};var _0x4d4f31=_[_0x2551('0x24')](db[_0x2551('0x25')][_0x2551('0x26')],function(_0x12d488){return{'name':_0x12d488[_0x2551('0x27')],'type':_0x12d488[_0x2551('0x28')][_0x2551('0x29')]};});_0x4a7d9d=qs['getOptions'](_0x4d4f31,_0x3d633e);return interaction[_0x2551('0x2a')]('mail',_0x3d633e[_0x2551('0x2b')],_0x3d633e['user'],_0x4a7d9d,_0x4d4f31)[_0x2551('0x1e')](respondWithFilteredResult(_0x20f2cc,_0x4a7d9d))[_0x2551('0x2c')](handleError(_0x20f2cc,null));};exports[_0x2551('0x2d')]=function(_0x55e6d0,_0x61c438){var _0x5cd07a={'raw':![],'where':{'id':_0x55e6d0[_0x2551('0x2e')]['id']}},_0x5ca680={};_0x5ca680[_0x2551('0x2f')]=_[_0x2551('0x30')](db[_0x2551('0x25')]['rawAttributes']);_0x5ca680['query']=_[_0x2551('0x30')](_0x55e6d0['query']);_0x5ca680[_0x2551('0x31')]=_['intersection'](_0x5ca680['model'],_0x5ca680[_0x2551('0x2b')]);_0x5cd07a['attributes']=_[_0x2551('0x32')](_0x5ca680[_0x2551('0x2f')],qs[_0x2551('0x33')](_0x55e6d0[_0x2551('0x2b')][_0x2551('0x33')]));_0x5cd07a[_0x2551('0x34')]=_0x5cd07a[_0x2551('0x34')][_0x2551('0x35')]?_0x5cd07a[_0x2551('0x34')]:_0x5ca680[_0x2551('0x2f')];if(_0x55e6d0[_0x2551('0x2b')][_0x2551('0x36')]){_0x5cd07a[_0x2551('0x37')]=[{'all':!![]}];}_0x5cd07a=_[_0x2551('0x38')]({},_0x5cd07a,_0x55e6d0[_0x2551('0x39')]);return db['MailInteraction'][_0x2551('0x3a')](_0x5cd07a)[_0x2551('0x1e')](handleEntityNotFound(_0x61c438,null))[_0x2551('0x1e')](respondWithResult(_0x61c438,null))['catch'](handleError(_0x61c438,null));};exports['create']=function(_0x4ce055,_0x9fc065){return db[_0x2551('0x25')]['create'](_0x4ce055[_0x2551('0x3b')],{})[_0x2551('0x1e')](respondWithResult(_0x9fc065,0xc9))[_0x2551('0x2c')](handleError(_0x9fc065,null));};exports[_0x2551('0x1d')]=function(_0x228aa1,_0x14dd5f){if(_0x228aa1[_0x2551('0x3b')]['id']){delete _0x228aa1[_0x2551('0x3b')]['id'];}return db[_0x2551('0x25')][_0x2551('0x3a')]({'where':{'id':_0x228aa1[_0x2551('0x2e')]['id']}})['then'](handleEntityNotFound(_0x14dd5f,null))[_0x2551('0x1e')](saveUpdates(_0x228aa1['body'],null))[_0x2551('0x1e')](respondWithResult(_0x14dd5f,null))['catch'](handleError(_0x14dd5f,null));};exports[_0x2551('0x1f')]=function(_0x2cbd22,_0xdc81ec){return db['MailInteraction'][_0x2551('0x3a')]({'where':{'id':_0x2cbd22['params']['id']}})[_0x2551('0x1e')](handleEntityNotFound(_0xdc81ec,null))['then'](removeEntity(_0xdc81ec,null))[_0x2551('0x2c')](handleError(_0xdc81ec,null));};exports[_0x2551('0x3c')]=function(_0x21d4e3,_0x25d300){return db[_0x2551('0x25')][_0x2551('0x3c')]()['then'](respondWithResult(_0x25d300,null))[_0x2551('0x2c')](handleError(_0x25d300,null));};exports[_0x2551('0x3d')]=function(_0x240f1c,_0x6f69b5){return db[_0x2551('0x3e')][_0x2551('0x3a')]({'where':{'id':_0x240f1c[_0x2551('0x2e')]['id']}})[_0x2551('0x1e')](handleEntityNotFound(_0x6f69b5,null))[_0x2551('0x1e')](function(_0x5ddeac){if(_0x5ddeac){return _0x5ddeac['addMessage'](_0x240f1c['body']['ids'],_['omit'](_0x240f1c[_0x2551('0x3b')],['ids','id'])||{});}})[_0x2551('0x1e')](respondWithResult(_0x6f69b5,null))[_0x2551('0x2c')](handleError(_0x6f69b5,null));};exports[_0x2551('0x3f')]=function(_0x2603e3,_0x2396d3){var _0x10a95a={'raw':![],'where':{}};var _0x2ebbff={};var _0x436596={'count':0x0,'rows':[]};return db[_0x2551('0x25')][_0x2551('0x40')]({'where':{'id':_0x2603e3[_0x2551('0x2e')]['id']}})[_0x2551('0x1e')](handleEntityNotFound(_0x2396d3,null))['then'](function(_0x499a5e){if(_0x499a5e){_0x2ebbff[_0x2551('0x2f')]=_[_0x2551('0x30')](db[_0x2551('0x3e')][_0x2551('0x26')]);_0x2ebbff[_0x2551('0x2b')]=_['keys'](_0x2603e3[_0x2551('0x2b')]);_0x2ebbff['filters']=_['intersection'](_0x2ebbff[_0x2551('0x2f')],_0x2ebbff[_0x2551('0x2b')]);_0x10a95a[_0x2551('0x34')]=_[_0x2551('0x32')](_0x2ebbff['model'],qs['fields'](_0x2603e3[_0x2551('0x2b')][_0x2551('0x33')]));_0x10a95a['attributes']=_0x10a95a[_0x2551('0x34')][_0x2551('0x35')]?_0x10a95a[_0x2551('0x34')]:_0x2ebbff[_0x2551('0x2f')];if(!_0x2603e3[_0x2551('0x2b')]['hasOwnProperty'](_0x2551('0x41'))){_0x10a95a[_0x2551('0x19')]=qs[_0x2551('0x19')](_0x2603e3[_0x2551('0x2b')][_0x2551('0x19')]);_0x10a95a['offset']=qs['offset'](_0x2603e3[_0x2551('0x2b')][_0x2551('0x17')]);}_0x10a95a['order']=qs['sort'](_0x2603e3[_0x2551('0x2b')]['sort']);_0x10a95a[_0x2551('0x42')]=qs[_0x2551('0x31')](_[_0x2551('0x43')](_0x2603e3[_0x2551('0x2b')],_0x2ebbff[_0x2551('0x31')]));_0x10a95a['where'][_0x2551('0x44')]=_0x499a5e['id'];if(_0x2603e3['query']['filter']){_0x10a95a[_0x2551('0x42')]=_[_0x2551('0x38')](_0x10a95a[_0x2551('0x42')],{'$or':_[_0x2551('0x24')](_0x10a95a['attributes'],function(_0x364843){var _0x153668={};_0x153668[_0x364843]={'$like':'%'+_0x2603e3[_0x2551('0x2b')][_0x2551('0x45')]+'%'};return _0x153668;})});}if(_0x2603e3[_0x2551('0x2b')][_0x2551('0x46')]){var _0xfe83bd=_0x2603e3['query'][_0x2551('0x46')][_0x2551('0x47')](',');var _0x1ad126={};_0x1ad126[_0xfe83bd[0x0]]={'$gte':moment(_0xfe83bd[0x1])['format'](_0x2551('0x48'))};_0x10a95a[_0x2551('0x42')]=_[_0x2551('0x38')](_0x10a95a[_0x2551('0x42')],_0x1ad126);}_0x10a95a=_[_0x2551('0x38')]({},_0x10a95a,_0x2603e3[_0x2551('0x39')]);return db[_0x2551('0x3e')][_0x2551('0x1a')]({'where':_0x10a95a['where']})[_0x2551('0x1e')](function(_0x1799b6){_0x436596[_0x2551('0x1a')]=_0x1799b6;if(_0x2603e3['query'][_0x2551('0x36')]){_0x10a95a[_0x2551('0x37')]=[{'all':!![]}];}return db[_0x2551('0x3e')][_0x2551('0x2a')](_0x10a95a);})['then'](function(_0x1d596f){if(_0x2603e3[_0x2551('0x2b')]['inlineCss']===_0x2551('0x49')){for(var _0x47145f=0x0;_0x47145f<_0x1d596f['length'];_0x47145f++){_0x1d596f[_0x47145f]['body']=juice(_0x1d596f[_0x47145f][_0x2551('0x3b')]);}}_0x436596[_0x2551('0x4a')]=_0x1d596f;return _0x436596;});}})[_0x2551('0x1e')](respondWithFilteredResult(_0x2396d3,_0x10a95a))[_0x2551('0x2c')](handleError(_0x2396d3,null));};exports['addTags']=function(_0x50e360,_0x2a0b05){return db[_0x2551('0x25')][_0x2551('0x3a')]({'where':{'id':_0x50e360[_0x2551('0x2e')]['id']}})[_0x2551('0x1e')](handleEntityNotFound(_0x2a0b05,null))['then'](function(_0xe2ebc4){if(_0xe2ebc4){return _0xe2ebc4[_0x2551('0x4b')](_0x50e360['body'][_0x2551('0x4c')],_[_0x2551('0x4d')](_0x50e360['body'],[_0x2551('0x4c'),'id'])||{})[_0x2551('0x4e')](function(){return db['Tag'][_0x2551('0x2a')]({'attributes':['id',_0x2551('0x23'),_0x2551('0x4f')],'where':{'id':_0x50e360[_0x2551('0x3b')]['ids']}});})[_0x2551('0x1e')](function(_0x203b7f){socket['emit'](_0x2551('0x50'),{'id':Number(_0x50e360[_0x2551('0x2e')]['id']),'tags':_0x203b7f||[]});return{'id':Number(_0x50e360[_0x2551('0x2e')]['id']),'tags':_0x203b7f||[]};});}})[_0x2551('0x1e')](respondWithResult(_0x2a0b05,null))[_0x2551('0x2c')](handleError(_0x2a0b05,null));};exports[_0x2551('0x51')]=function(_0x3168a8,_0xca515){return db[_0x2551('0x25')][_0x2551('0x3a')]({'where':{'id':_0x3168a8[_0x2551('0x2e')]['id']}})[_0x2551('0x1e')](handleEntityNotFound(_0xca515,null))['then'](function(_0x27e583){if(_0x27e583){return _0x27e583[_0x2551('0x51')](_0x3168a8['query'][_0x2551('0x4c')]);}})[_0x2551('0x1e')](respondWithStatusCode(_0xca515,null))[_0x2551('0x2c')](handleError(_0xca515,null));};exports[_0x2551('0x52')]=function(_0x269d43,_0x3ceb7f){var _0x9837e4=moment()[_0x2551('0x53')]()[_0x2551('0x54')]();var _0xa14382=path['join'](config[_0x2551('0x55')],_0x2551('0x56'),_0x2551('0x57'),_0x2551('0x58'));var _0xeac406=path['join'](config[_0x2551('0x55')],_0x2551('0x56'),_0x2551('0x57'),_0x2551('0x59'));var _0x4aa000=path[_0x2551('0x5a')](_0xa14382,_0x9837e4);var _0x84eb2d=util[_0x2551('0x5b')](_0x2551('0x5c'),_0x269d43[_0x2551('0x2e')]['id'],_0x9837e4);var _0x5ed6a8=path[_0x2551('0x5a')](_0xa14382,_0x84eb2d);var _0x488eee=[];if(_0x269d43[_0x2551('0x2b')]['attachments']){_0x488eee[_0x2551('0x5d')]({'model':db[_0x2551('0x5e')],'as':'Attachments','raw':!![]});}var _0x4f1dc8=[{'model':db['MailMessage'],'as':_0x2551('0x5f'),'attributes':['id',_0x2551('0x3b'),'from','to','cc',_0x2551('0x60'),_0x2551('0x61'),_0x2551('0x62')],'where':{'secret':![]},'order':qs[_0x2551('0x63')]('id'),'include':_0x488eee}];return db[_0x2551('0x25')]['find']({'where':{'id':_0x269d43[_0x2551('0x2e')]['id']},'include':_0x4f1dc8})[_0x2551('0x1e')](handleEntityNotFound(_0x3ceb7f,null))[_0x2551('0x1e')](function(_0x3b0339){if(_0x3b0339&&_0x3b0339['Messages']){var _0x363a8e=_0x3b0339[_0x2551('0x64')]({'plain':!![]});fs[_0x2551('0x65')](_0x4aa000);return BPromise[_0x2551('0x66')](_0x363a8e[_0x2551('0x5f')],function(_0xd6cf9c,_0x5636cc){var _0x1561e7={'from':_0xd6cf9c[_0x2551('0x67')],'to':_0xd6cf9c['to']||_0x2551('0x68'),'subject':_0xd6cf9c['subject'],'html':htmlEntities[_0x2551('0x69')](_0xd6cf9c['body']),'headers':{'Date':moment(_0xd6cf9c['createdAt'])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0xd6cf9c['cc']){_0x1561e7[_0x2551('0x6a')]['Cc']=_0xd6cf9c['cc'];}if(_0xd6cf9c[_0x2551('0x60')]){_0x1561e7[_0x2551('0x6a')][_0x2551('0x6b')]=_0xd6cf9c[_0x2551('0x60')];}return new BPromise(function(_0x7721f3,_0x4b3796){if(_0xd6cf9c[_0x2551('0x6c')]){for(var _0xfd2407=0x0;_0xfd2407<_0xd6cf9c[_0x2551('0x6c')][_0x2551('0x35')];_0xfd2407++){var _0xcd5d00=_0xd6cf9c[_0x2551('0x6c')][_0xfd2407];var _0x399499=path['join'](_0xeac406,_0xcd5d00[_0x2551('0x6d')]);if(fs['existsSync'](_0x399499)){_0x1561e7[_0x2551('0x59')][_0x2551('0x5d')]({'name':_0xcd5d00[_0x2551('0x23')],'contentType':_0xcd5d00['type'],'data':fs[_0x2551('0x6e')](_0x399499)});}}}emlformat[_0x2551('0x6f')](_0x1561e7,function(_0x2c5814,_0x55659e){if(_0x2c5814)return _0x4b3796(_0x2c5814);fs[_0x2551('0x70')](path[_0x2551('0x5a')](_0x4aa000,util[_0x2551('0x5b')](_0x2551('0x71'),_0x5636cc)),_0x55659e);return _0x7721f3(_0x55659e);});});})[_0x2551('0x1e')](function(){return new BPromise(function(_0x21585f,_0x210781){zipdir(_0x4aa000,{'saveTo':_0x5ed6a8},function(_0x4cd6b1,_0x38e614){if(_0x4cd6b1)return _0x210781(_0x4cd6b1);return _0x21585f(_0x38e614);});})[_0x2551('0x1e')](function(){return new BPromise(function(_0x549605,_0x2fc198){rimraf(_0x4aa000,function(_0x58c468){if(_0x58c468)_0x2fc198(_0x58c468);return _0x549605();});});})['then'](function(){return _0x3ceb7f['download'](_0x5ed6a8,_0x84eb2d,function(_0x105c0c){if(!_0x105c0c)fs[_0x2551('0x72')](_0x5ed6a8);});});});}else{return _0x3ceb7f[_0x2551('0x20')](0xc8);}})['catch'](handleError(_0x3ceb7f,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 9767874..15cde3c 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 _0xcab3=['catch','hasOwnProperty','exports','../../mysqldb','MailInteraction','save','update','remove','getUsers','setDataValue','Users','map','findAll','unreadMessages','emit'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0xcab3,0xf3));var _0x3cab=function(_0x223480,_0x3411e9){_0x223480=_0x223480-0x0;var _0x28e0cd=_0xcab3[_0x223480];return _0x28e0cd;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x3cab('0x0'))['db'][_0x3cab('0x1')];var MailMessage=require(_0x3cab('0x0'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3cab('0x2'),'afterUpdate':_0x3cab('0x3'),'afterDestroy':_0x3cab('0x4')};function emitEvent(_0x8bfc25){return function(_0x20aeb,_0xa25b1,_0x3a01ee){_0x20aeb[_0x3cab('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x7fefd2){_0x20aeb[_0x3cab('0x6')](_0x3cab('0x7'),_0x7fefd2[_0x3cab('0x8')](function(_0x4e7154){return{'id':_0x4e7154['id']};}));return MailMessage[_0x3cab('0x9')]({'where':{'MailInteractionId':_0x20aeb['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3fa3b5){_0x20aeb['setDataValue'](_0x3cab('0xa'),_0x3fa3b5['length']);MailInteractionEvents[_0x3cab('0xb')](_0x8bfc25+':'+_0x20aeb['id'],_0x20aeb);MailInteractionEvents[_0x3cab('0xb')](_0x8bfc25,_0x20aeb);_0x3a01ee(null);})[_0x3cab('0xc')](_0x3a01ee(null));};}for(var e in events){if(events[_0x3cab('0xd')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x3cab('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0xf21f=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','events','../../mysqldb','MailInteraction'];(function(_0x4c84aa,_0x1df309){var _0x344ed0=function(_0x5ce728){while(--_0x5ce728){_0x4c84aa['push'](_0x4c84aa['shift']());}};_0x344ed0(++_0x1df309);}(_0xf21f,0xfd));var _0xff21=function(_0x16acb7,_0x23f034){_0x16acb7=_0x16acb7-0x0;var _0x39bf39=_0xf21f[_0x16acb7];return _0x39bf39;};'use strict';var EventEmitter=require(_0xff21('0x0'));var MailInteraction=require(_0xff21('0x1'))['db'][_0xff21('0x2')];var MailMessage=require(_0xff21('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xff21('0x3')](0x0);var events={'afterCreate':_0xff21('0x4'),'afterUpdate':_0xff21('0x5'),'afterDestroy':_0xff21('0x6')};function emitEvent(_0x278a2d){return function(_0x3961d4,_0x5bd32c,_0x3b3e3b){_0x3961d4[_0xff21('0x7')]({'attributes':['id'],'raw':!![]})[_0xff21('0x8')](function(_0x49109e){_0x3961d4[_0xff21('0x9')](_0xff21('0xa'),_0x49109e[_0xff21('0xb')](function(_0x48397f){return{'id':_0x48397f['id']};}));return MailMessage[_0xff21('0xc')]({'where':{'MailInteractionId':_0x3961d4['id'],'direction':'in','read':![]},'raw':!![]});})[_0xff21('0x8')](function(_0x58af08){_0x3961d4[_0xff21('0x9')](_0xff21('0xd'),_0x58af08[_0xff21('0xe')]);MailInteractionEvents[_0xff21('0xf')](_0x278a2d+':'+_0x3961d4['id'],_0x3961d4);MailInteractionEvents['emit'](_0x278a2d,_0x3961d4);_0x3b3e3b(null);})['catch'](_0x3b3e3b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index e097535..d29e2af 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 _0xd50f=['YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','closed','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','subject','substatus','substatusAt','format'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0xd50f,0xa8));var _0xfd50=function(_0x5343a2,_0x44fd3c){_0x5343a2=_0x5343a2-0x0;var _0x56e866=_0xd50f[_0x5343a2];return _0x56e866;};'use strict';var _=require(_0xfd50('0x0'));var util=require(_0xfd50('0x1'));var logger=require(_0xfd50('0x2'))(_0xfd50('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfd50('0x4'));var fs=require('fs');var path=require(_0xfd50('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfd50('0x6'));module[_0xfd50('0x7')]=function(_0x3a1749,_0x27097f){return _0x3a1749['define'](_0xfd50('0x8'),attributes,{'tableName':_0xfd50('0x9'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xfd50('0xa'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x244736,_0x589189,_0x59c6b0){if(_0x244736[_0xfd50('0xb')]){_0x244736[_0xfd50('0xc')]=moment()[_0xfd50('0xd')](_0xfd50('0xe'));}if(_0x244736['closed']){_0x244736[_0xfd50('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x59c6b0(null,_0x589189);},'beforeUpdate':function(_0x785530,_0x375f87,_0x35e5d5){if(_0x785530['changed'](_0xfd50('0xb'))){_0x785530[_0xfd50('0xc')]=_0x785530[_0xfd50('0xb')]?moment()[_0xfd50('0xd')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x785530[_0xfd50('0x10')](_0xfd50('0x11'))){_0x785530['closedAt']=moment()['format'](_0xfd50('0xe'));_0x785530[_0xfd50('0xb')]=null;_0x785530['substatusAt']=null;}_0x35e5d5(null,_0x785530);},'afterUpdate':function(_0x35fd66,_0x26e300,_0x4e37e9){var _0x3ace47=_0x3a1749[_0xfd50('0x12')];var _0xdbb325=_0x35fd66[_0xfd50('0x13')]({'plain':!![]});if(_0xdbb325[_0xfd50('0x11')]){return _0x3ace47[_0xfd50('0x14')][_0xfd50('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0xdbb325['id']}})[_0xfd50('0x16')](function(){_0x4e37e9();})[_0xfd50('0x17')](function(_0x5188ab){_0x4e37e9(_0x5188ab);});}else{_0x4e37e9();}}},'charset':_0xfd50('0x18'),'collate':_0xfd50('0x19')});}; \ No newline at end of file +var _0x5ffa=['YYYY-MM-DD\x20HH:mm:ss','changed','substatus','models','get','MailMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','closed','closedAt','format'];(function(_0x90cb2b,_0x4fcc39){var _0x36c9bd=function(_0x5881dc){while(--_0x5881dc){_0x90cb2b['push'](_0x90cb2b['shift']());}};_0x36c9bd(++_0x4fcc39);}(_0x5ffa,0x1ac));var _0xa5ff=function(_0x4e5029,_0x456d7f){_0x4e5029=_0x4e5029-0x0;var _0x28a104=_0x5ffa[_0x4e5029];return _0x28a104;};'use strict';var _=require(_0xa5ff('0x0'));var util=require(_0xa5ff('0x1'));var logger=require(_0xa5ff('0x2'))(_0xa5ff('0x3'));var moment=require(_0xa5ff('0x4'));var BPromise=require('bluebird');var rp=require(_0xa5ff('0x5'));var fs=require('fs');var path=require(_0xa5ff('0x6'));var rimraf=require('rimraf');var config=require(_0xa5ff('0x7'));var attributes=require(_0xa5ff('0x8'));module[_0xa5ff('0x9')]=function(_0x5ece3c,_0x1521f2){return _0x5ece3c[_0xa5ff('0xa')](_0xa5ff('0xb'),attributes,{'tableName':_0xa5ff('0xc'),'paranoid':![],'indexes':[{'name':_0xa5ff('0xd'),'fields':[_0xa5ff('0xe'),'to'],'type':_0xa5ff('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x10603e,_0x212d35,_0x5d8ee8){if(_0x10603e['substatus']){_0x10603e[_0xa5ff('0x10')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x10603e[_0xa5ff('0x11')]){_0x10603e[_0xa5ff('0x12')]=moment()[_0xa5ff('0x13')](_0xa5ff('0x14'));}_0x5d8ee8(null,_0x212d35);},'beforeUpdate':function(_0x1156d,_0x190af6,_0x1c0153){if(_0x1156d[_0xa5ff('0x15')](_0xa5ff('0x16'))){_0x1156d[_0xa5ff('0x10')]=_0x1156d[_0xa5ff('0x16')]?moment()[_0xa5ff('0x13')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x1156d[_0xa5ff('0x15')]('closed')){_0x1156d[_0xa5ff('0x12')]=moment()[_0xa5ff('0x13')](_0xa5ff('0x14'));_0x1156d['substatus']=null;_0x1156d[_0xa5ff('0x10')]=null;}_0x1c0153(null,_0x1156d);},'afterUpdate':function(_0x1d6252,_0x19d50e,_0x247e17){var _0x2ebb3b=_0x5ece3c[_0xa5ff('0x17')];var _0x3a41f7=_0x1d6252[_0xa5ff('0x18')]({'plain':!![]});if(_0x3a41f7['closed']){return _0x2ebb3b[_0xa5ff('0x19')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x3a41f7['id']}})['then'](function(){_0x247e17();})['catch'](function(_0x4d010f){_0x247e17(_0x4d010f);});}else{_0x247e17();}}},'charset':_0xa5ff('0x1a'),'collate':_0xa5ff('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 7ed4cdc..401b85a 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 _0xa21e=['debug','stringify','error','code','message','result','UpdateMailInteraction','update','options','raw','where','attributes','limit','then','AddTagsToMailInteraction','MailInteraction','find','addTags','ids','omit','AddTags','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','info','MailInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x506aa6,_0x13dd78){var _0x5e35d9=function(_0x2213eb){while(--_0x2213eb){_0x506aa6['push'](_0x506aa6['shift']());}};_0x5e35d9(++_0x13dd78);}(_0xa21e,0x166));var _0xea21=function(_0x171fdc,_0x16ae91){_0x171fdc=_0x171fdc-0x0;var _0x3782ea=_0xa21e[_0x171fdc];return _0x3782ea;};'use strict';var _=require(_0xea21('0x0'));var util=require(_0xea21('0x1'));var moment=require(_0xea21('0x2'));var BPromise=require('bluebird');var rs=require(_0xea21('0x3'));var fs=require('fs');var Redis=require(_0xea21('0x4'));var db=require(_0xea21('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xea21('0x6'));var config=require(_0xea21('0x7'));var jayson=require(_0xea21('0x8'));var client=jayson[_0xea21('0x9')][_0xea21('0xa')]({'port':0x232a});config[_0xea21('0xb')]=_[_0xea21('0xc')](config[_0xea21('0xb')],{'host':_0xea21('0xd'),'port':0x18eb});var socket=require(_0xea21('0xe'))(new Redis(config[_0xea21('0xb')]));require(_0xea21('0xf'))[_0xea21('0x10')](socket);function respondWithRpcPromise(_0x4be1a7,_0x2200e8,_0x48d053){return new BPromise(function(_0x527f76,_0x43c4a9){return client['request'](_0x4be1a7,_0x48d053)['then'](function(_0x45c449){logger[_0xea21('0x11')](_0xea21('0x12'),_0x2200e8,_0xea21('0x13'));logger[_0xea21('0x14')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x2200e8,_0xea21('0x13'),JSON[_0xea21('0x15')](_0x45c449));if(_0x45c449['error']){if(_0x45c449[_0xea21('0x16')][_0xea21('0x17')]===0x1f4){logger[_0xea21('0x16')](_0xea21('0x12'),_0x2200e8,_0x45c449[_0xea21('0x16')][_0xea21('0x18')]);return _0x43c4a9(_0x45c449[_0xea21('0x16')]['message']);}logger[_0xea21('0x16')]('MailInteraction,\x20%s,\x20%s',_0x2200e8,_0x45c449['error'][_0xea21('0x18')]);return _0x527f76(_0x45c449[_0xea21('0x16')][_0xea21('0x18')]);}else{logger['info'](_0xea21('0x12'),_0x2200e8,_0xea21('0x13'));_0x527f76(_0x45c449[_0xea21('0x19')][_0xea21('0x18')]);}})['catch'](function(_0x2af4be){logger[_0xea21('0x16')]('MailInteraction,\x20%s,\x20%s',_0x2200e8,_0x2af4be);_0x43c4a9(_0x2af4be);});});}exports[_0xea21('0x1a')]=function(_0x29d8ba){var _0x5896d7=this;return new Promise(function(_0xa381ae,_0x9cef15){return db['MailInteraction'][_0xea21('0x1b')](_0x29d8ba['body'],{'raw':_0x29d8ba[_0xea21('0x1c')]?_0x29d8ba[_0xea21('0x1c')][_0xea21('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29d8ba[_0xea21('0x1c')]?_0x29d8ba[_0xea21('0x1c')][_0xea21('0x1e')]||null:null,'attributes':_0x29d8ba[_0xea21('0x1c')]?_0x29d8ba[_0xea21('0x1c')][_0xea21('0x1f')]||null:null,'limit':_0x29d8ba['options']?_0x29d8ba[_0xea21('0x1c')][_0xea21('0x20')]||null:null})[_0xea21('0x21')](function(_0x382699){logger[_0xea21('0x11')](_0xea21('0x1a'),_0x29d8ba);logger['debug'](_0xea21('0x1a'),_0x29d8ba,JSON[_0xea21('0x15')](_0x382699));_0xa381ae(_0x382699);})['catch'](function(_0x583a28){logger['error']('UpdateMailInteraction',_0x583a28['message'],_0x29d8ba);_0x9cef15(_0x5896d7[_0xea21('0x16')](0x1f4,_0x583a28['message']));});});};exports[_0xea21('0x22')]=function(_0x4dada2){return new Promise(function(_0x378e7c,_0x10efc4){return db[_0xea21('0x23')][_0xea21('0x24')]({'where':_0x4dada2['options']?_0x4dada2['options']['where']||null:null})[_0xea21('0x21')](function(_0x5e76e8){if(_0x5e76e8){return _0x5e76e8[_0xea21('0x25')](_0x4dada2['body'][_0xea21('0x26')],_[_0xea21('0x27')](_0x4dada2['body'],[_0xea21('0x26'),'id'])||{});}})['spread'](function(_0x3ce534){logger[_0xea21('0x11')](_0xea21('0x28'),_0x4dada2);logger['debug'](_0xea21('0x28'),_0x4dada2,JSON[_0xea21('0x15')](_0x3ce534));_0x378e7c(_0x3ce534);})[_0xea21('0x29')](function(_0x523911){logger[_0xea21('0x16')]('AddTags',_0x523911[_0xea21('0x18')],_0x4dada2);_0x10efc4(_this['error'](0x1f4,_0x523911['message']));});});}; \ No newline at end of file +var _0x0b16=['error','code','message','info','result','UpdateMailInteraction','MailInteraction','options','raw','where','limit','catch','AddTagsToMailInteraction','find','addTags','ids','omit','body','spread','AddTags','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xb0b922,_0x183826){var _0x5dc41e=function(_0x461183){while(--_0x461183){_0xb0b922['push'](_0xb0b922['shift']());}};_0x5dc41e(++_0x183826);}(_0x0b16,0x8f));var _0x60b1=function(_0x2960a6,_0x52a6b3){_0x2960a6=_0x2960a6-0x0;var _0x1ae2e0=_0x0b16[_0x2960a6];return _0x1ae2e0;};'use strict';var _=require(_0x60b1('0x0'));var util=require('util');var moment=require(_0x60b1('0x1'));var BPromise=require(_0x60b1('0x2'));var rs=require(_0x60b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x60b1('0x4'));var logger=require(_0x60b1('0x5'))(_0x60b1('0x6'));var config=require(_0x60b1('0x7'));var jayson=require(_0x60b1('0x8'));var client=jayson['client'][_0x60b1('0x9')]({'port':0x232a});config[_0x60b1('0xa')]=_[_0x60b1('0xb')](config[_0x60b1('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x60b1('0xc'))(new Redis(config[_0x60b1('0xa')]));require(_0x60b1('0xd'))[_0x60b1('0xe')](socket);function respondWithRpcPromise(_0x298ac7,_0x162512,_0x48d01e){return new BPromise(function(_0x367732,_0x27faba){return client['request'](_0x298ac7,_0x48d01e)[_0x60b1('0xf')](function(_0x1e29c5){logger['info'](_0x60b1('0x10'),_0x162512,_0x60b1('0x11'));logger[_0x60b1('0x12')](_0x60b1('0x13'),_0x162512,_0x60b1('0x11'),JSON[_0x60b1('0x14')](_0x1e29c5));if(_0x1e29c5[_0x60b1('0x15')]){if(_0x1e29c5[_0x60b1('0x15')][_0x60b1('0x16')]===0x1f4){logger[_0x60b1('0x15')]('MailInteraction,\x20%s,\x20%s',_0x162512,_0x1e29c5[_0x60b1('0x15')][_0x60b1('0x17')]);return _0x27faba(_0x1e29c5[_0x60b1('0x15')][_0x60b1('0x17')]);}logger[_0x60b1('0x15')](_0x60b1('0x10'),_0x162512,_0x1e29c5[_0x60b1('0x15')][_0x60b1('0x17')]);return _0x367732(_0x1e29c5['error'][_0x60b1('0x17')]);}else{logger[_0x60b1('0x18')](_0x60b1('0x10'),_0x162512,_0x60b1('0x11'));_0x367732(_0x1e29c5[_0x60b1('0x19')][_0x60b1('0x17')]);}})['catch'](function(_0x46fbac){logger['error'](_0x60b1('0x10'),_0x162512,_0x46fbac);_0x27faba(_0x46fbac);});});}exports[_0x60b1('0x1a')]=function(_0x2c7ab4){var _0x25ec37=this;return new Promise(function(_0x487d9b,_0xb68442){return db[_0x60b1('0x1b')]['update'](_0x2c7ab4['body'],{'raw':_0x2c7ab4['options']?_0x2c7ab4[_0x60b1('0x1c')][_0x60b1('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c7ab4[_0x60b1('0x1c')]?_0x2c7ab4[_0x60b1('0x1c')][_0x60b1('0x1e')]||null:null,'attributes':_0x2c7ab4[_0x60b1('0x1c')]?_0x2c7ab4[_0x60b1('0x1c')]['attributes']||null:null,'limit':_0x2c7ab4[_0x60b1('0x1c')]?_0x2c7ab4[_0x60b1('0x1c')][_0x60b1('0x1f')]||null:null})['then'](function(_0x152143){logger[_0x60b1('0x18')](_0x60b1('0x1a'),_0x2c7ab4);logger['debug']('UpdateMailInteraction',_0x2c7ab4,JSON[_0x60b1('0x14')](_0x152143));_0x487d9b(_0x152143);})[_0x60b1('0x20')](function(_0x3b0c28){logger['error'](_0x60b1('0x1a'),_0x3b0c28[_0x60b1('0x17')],_0x2c7ab4);_0xb68442(_0x25ec37[_0x60b1('0x15')](0x1f4,_0x3b0c28[_0x60b1('0x17')]));});});};exports[_0x60b1('0x21')]=function(_0x9469ec){return new Promise(function(_0xa804d0,_0x1c5424){return db[_0x60b1('0x1b')][_0x60b1('0x22')]({'where':_0x9469ec[_0x60b1('0x1c')]?_0x9469ec[_0x60b1('0x1c')][_0x60b1('0x1e')]||null:null})['then'](function(_0x4b34a7){if(_0x4b34a7){return _0x4b34a7[_0x60b1('0x23')](_0x9469ec['body'][_0x60b1('0x24')],_[_0x60b1('0x25')](_0x9469ec[_0x60b1('0x26')],['ids','id'])||{});}})[_0x60b1('0x27')](function(_0x38576a){logger[_0x60b1('0x18')](_0x60b1('0x28'),_0x9469ec);logger['debug'](_0x60b1('0x28'),_0x9469ec,JSON[_0x60b1('0x14')](_0x38576a));_0xa804d0(_0x38576a);})[_0x60b1('0x20')](function(_0x12cb60){logger['error'](_0x60b1('0x28'),_0x12cb60[_0x60b1('0x17')],_0x9469ec);_0x1c5424(_this['error'](0x1f4,_0x12cb60['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index d8f725e..51180a8 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 _0xddb1=['save','remove','update','emit','removeListener','length','./mailInteraction.events'];(function(_0x4891fa,_0x2150e9){var _0x15e86d=function(_0x4e0296){while(--_0x4e0296){_0x4891fa['push'](_0x4891fa['shift']());}};_0x15e86d(++_0x2150e9);}(_0xddb1,0xfb));var _0x1ddb=function(_0x5f4206,_0x33ab5d){_0x5f4206=_0x5f4206-0x0;var _0x4820c2=_0xddb1[_0x5f4206];return _0x4820c2;};'use strict';var MailInteractionEvents=require(_0x1ddb('0x0'));var events=[_0x1ddb('0x1'),_0x1ddb('0x2'),_0x1ddb('0x3')];function createListener(_0xd48ca6,_0x29feb3){return function(_0x3d1a38){_0x29feb3[_0x1ddb('0x4')](_0xd48ca6,_0x3d1a38);};}function removeListener(_0xccf838,_0xa9b823){return function(){MailInteractionEvents[_0x1ddb('0x5')](_0xccf838,_0xa9b823);};}exports['register']=function(_0x599b38){for(var _0xf5973d=0x0,_0x565b18=events[_0x1ddb('0x6')];_0xf5973d<_0x565b18;_0xf5973d++){var _0x468854=events[_0xf5973d];var _0x334000=createListener('mailInteraction:'+_0x468854,_0x599b38);MailInteractionEvents['on'](_0x468854,_0x334000);}}; \ No newline at end of file +var _0x4073=['emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','save','update'];(function(_0x44fd4c,_0x101855){var _0x3ffc14=function(_0xffc8c9){while(--_0xffc8c9){_0x44fd4c['push'](_0x44fd4c['shift']());}};_0x3ffc14(++_0x101855);}(_0x4073,0x1cd));var _0x3407=function(_0x46fa99,_0x244ea9){_0x46fa99=_0x46fa99-0x0;var _0x3c0340=_0x4073[_0x46fa99];return _0x3c0340;};'use strict';var MailInteractionEvents=require(_0x3407('0x0'));var events=[_0x3407('0x1'),'remove',_0x3407('0x2')];function createListener(_0x4cd5e7,_0x59a983){return function(_0x1bc0bb){_0x59a983[_0x3407('0x3')](_0x4cd5e7,_0x1bc0bb);};}function removeListener(_0x142bdf,_0x2ad216){return function(){MailInteractionEvents[_0x3407('0x4')](_0x142bdf,_0x2ad216);};}exports[_0x3407('0x5')]=function(_0x2e79dc){for(var _0x2830cd=0x0,_0x53f498=events[_0x3407('0x6')];_0x2830cd<_0x53f498;_0x2830cd++){var _0x3cfeec=events[_0x2830cd];var _0x50e5bf=createListener(_0x3407('0x7')+_0x3cfeec,_0x2e79dc);MailInteractionEvents['on'](_0x3cfeec,_0x50e5bf);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index c3a33e7..0f5d973 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 _0xe806=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','tracked','mail','create','put','/:id','update','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x595d57,_0x48d9b3){var _0x5cc819=function(_0x148bb0){while(--_0x148bb0){_0x595d57['push'](_0x595d57['shift']());}};_0x5cc819(++_0x48d9b3);}(_0xe806,0x1bd));var _0x6e80=function(_0x3ab897,_0x289ca0){_0x3ab897=_0x3ab897-0x0;var _0x6df12d=_0xe806[_0x3ab897];return _0x6df12d;};'use strict';var multer=require(_0x6e80('0x0'));var util=require(_0x6e80('0x1'));var path=require(_0x6e80('0x2'));var timeout=require(_0x6e80('0x3'));var express=require(_0x6e80('0x4'));var router=express[_0x6e80('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6e80('0x6'));var interaction=require(_0x6e80('0x7'));var config=require(_0x6e80('0x8'));var controller=require(_0x6e80('0x9'));router[_0x6e80('0xa')]('/',auth[_0x6e80('0xb')](),controller[_0x6e80('0xc')]);router['get'](_0x6e80('0xd'),auth[_0x6e80('0xb')](),controller[_0x6e80('0xe')]);router[_0x6e80('0xa')]('/:id',auth[_0x6e80('0xb')](),controller[_0x6e80('0xf')]);router['get'](_0x6e80('0x10'),auth[_0x6e80('0xb')](),controller[_0x6e80('0x11')]);router['post']('/',auth[_0x6e80('0xb')](),interaction[_0x6e80('0x12')](_0x6e80('0x13'),'mailmessage:create'),controller[_0x6e80('0x14')]);router[_0x6e80('0x15')](_0x6e80('0x16'),auth['isAuthenticated'](),controller[_0x6e80('0x17')]);router[_0x6e80('0x15')](_0x6e80('0x18'),auth[_0x6e80('0xb')](),controller[_0x6e80('0x19')]);router[_0x6e80('0x15')]('/:id/reject',auth[_0x6e80('0xb')](),controller[_0x6e80('0x1a')]);router[_0x6e80('0x1b')](_0x6e80('0x16'),auth[_0x6e80('0xb')](),controller[_0x6e80('0x1c')]);module[_0x6e80('0x1d')]=router; \ No newline at end of file +var _0x3ee7=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','show','/:id/download','post','mail','create','put','update','reject','delete','destroy','exports','util','express'];(function(_0x2e89ce,_0xaef0e1){var _0x69ed15=function(_0x2f180e){while(--_0x2f180e){_0x2e89ce['push'](_0x2e89ce['shift']());}};_0x69ed15(++_0xaef0e1);}(_0x3ee7,0x98));var _0x73ee=function(_0x5af977,_0x5770c8){_0x5af977=_0x5af977-0x0;var _0x4823d1=_0x3ee7[_0x5af977];return _0x4823d1;};'use strict';var multer=require('multer');var util=require(_0x73ee('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x73ee('0x1'));var router=express['Router']();var fs_extra=require(_0x73ee('0x2'));var auth=require(_0x73ee('0x3'));var interaction=require(_0x73ee('0x4'));var config=require(_0x73ee('0x5'));var controller=require(_0x73ee('0x6'));router[_0x73ee('0x7')]('/',auth[_0x73ee('0x8')](),controller[_0x73ee('0x9')]);router['get'](_0x73ee('0xa'),auth[_0x73ee('0x8')](),controller['describe']);router[_0x73ee('0x7')]('/:id',auth[_0x73ee('0x8')](),controller[_0x73ee('0xb')]);router[_0x73ee('0x7')](_0x73ee('0xc'),auth[_0x73ee('0x8')](),controller['download']);router[_0x73ee('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x73ee('0xe'),'mailmessage:create'),controller[_0x73ee('0xf')]);router[_0x73ee('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x73ee('0x11')]);router[_0x73ee('0x10')]('/:id/accept',auth[_0x73ee('0x8')](),controller['accept']);router[_0x73ee('0x10')]('/:id/reject',auth[_0x73ee('0x8')](),controller[_0x73ee('0x12')]);router[_0x73ee('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x73ee('0x14')]);module[_0x73ee('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 8702b93..33e2129 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 _0xf398=['out','STRING','long','DATE','BOOLEAN','Email','Chat','sequelize','lodash','exports','TEXT','ENUM'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xf398,0x7f));var _0x8f39=function(_0x3e70dc,_0x5f1075){_0x3e70dc=_0x3e70dc-0x0;var _0x589049=_0xf398[_0x3e70dc];return _0x589049;};'use strict';var Sequelize=require(_0x8f39('0x0'));var _=require(_0x8f39('0x1'));module[_0x8f39('0x2')]={'body':{'type':Sequelize[_0x8f39('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x8f39('0x3')]('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x8f39('0x4')]('in',_0x8f39('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x8f39('0x6')](0x1fe)},'from':{'type':Sequelize[_0x8f39('0x6')]},'to':{'type':Sequelize['TEXT'](_0x8f39('0x7'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0x8f39('0x3')](_0x8f39('0x7'))},'subject':{'type':Sequelize[_0x8f39('0x3')]},'sentAt':{'type':Sequelize[_0x8f39('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x8f39('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x8f39('0x8')]},'originTo':{'type':Sequelize[_0x8f39('0x3')](_0x8f39('0x7'))},'originCc':{'type':Sequelize[_0x8f39('0x3')](_0x8f39('0x7'))},'originChannel':{'type':Sequelize['ENUM'](_0x8f39('0xa'),_0x8f39('0xb')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0xd388=['sequelize','lodash','TEXT','long','BOOLEAN','ENUM','out','STRING','INTEGER','DATE','Email','Chat'];(function(_0x1112a4,_0x133f9c){var _0x221f61=function(_0x24d01b){while(--_0x24d01b){_0x1112a4['push'](_0x1112a4['shift']());}};_0x221f61(++_0x133f9c);}(_0xd388,0x6c));var _0x8d38=function(_0x9144c1,_0x157e52){_0x9144c1=_0x9144c1-0x0;var _0x45abe9=_0xd388[_0x9144c1];return _0x45abe9;};'use strict';var Sequelize=require(_0x8d38('0x0'));var _=require(_0x8d38('0x1'));module['exports']={'body':{'type':Sequelize[_0x8d38('0x2')](_0x8d38('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x8d38('0x2')]('medium')},'read':{'type':Sequelize[_0x8d38('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8d38('0x5')]('in','out'),'defaultValue':_0x8d38('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8d38('0x7')](0x1fe)},'from':{'type':Sequelize[_0x8d38('0x7')]},'to':{'type':Sequelize[_0x8d38('0x2')]('long')},'cc':{'type':Sequelize[_0x8d38('0x2')](_0x8d38('0x3'))},'bcc':{'type':Sequelize['TEXT'](_0x8d38('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x8d38('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x8d38('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x8d38('0x9')]},'originTo':{'type':Sequelize[_0x8d38('0x2')](_0x8d38('0x3'))},'originCc':{'type':Sequelize[_0x8d38('0x2')](_0x8d38('0x3'))},'originChannel':{'type':Sequelize[_0x8d38('0x5')](_0x8d38('0xa'),_0x8d38('0xb')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 3f8fb23..4e4b8c1 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 _0x5a23=['[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','download','toString','server','files','tmp','root','bcc','createdAt','Attachment','Attachments','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','build','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','register','jayson/promise','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','json','undefined','limit','count','offset','set','Content-Range','update','destroy','status','end','sendStatus','stack','name','send','index','map','MailMessage','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','body','describe','create','direction','out','secret','split','MailAccount','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','attachments','join','server/files/attachments','basename','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','QueryTypes','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject'];(function(_0x4967a9,_0x204034){var _0x267f0b=function(_0x4643dd){while(--_0x4643dd){_0x4967a9['push'](_0x4967a9['shift']());}};_0x267f0b(++_0x204034);}(_0x5a23,0x15d));var _0x35a2=function(_0x3a8d4e,_0x5ca041){_0x3a8d4e=_0x3a8d4e-0x0;var _0x25d24e=_0x5a23[_0x3a8d4e];return _0x25d24e;};'use strict';var emlformat=require(_0x35a2('0x0'));var moment=require(_0x35a2('0x1'));var BPromise=require(_0x35a2('0x2'));var util=require(_0x35a2('0x3'));var path=require(_0x35a2('0x4'));var fs=require('fs');var _=require(_0x35a2('0x5'));var Redis=require(_0x35a2('0x6'));var htmlToText=require(_0x35a2('0x7'));var qs=require(_0x35a2('0x8'));var logger=require(_0x35a2('0x9'))(_0x35a2('0xa'));var interaction_log=require('../../config/logger')('mail-interactions');var config=require(_0x35a2('0xb'));var db=require(_0x35a2('0xc'))['db'];config[_0x35a2('0xd')]=_[_0x35a2('0xe')](config[_0x35a2('0xd')],{'host':_0x35a2('0xf'),'port':0x18eb});var socket=require(_0x35a2('0x10'))(new Redis(config['redis']));var htmlEntities=require(_0x35a2('0x11'));require('./mailMessage.socket')[_0x35a2('0x12')](socket);var jayson=require(_0x35a2('0x13'));var client=jayson['client'][_0x35a2('0x14')]({'port':0x232c});var client9003=jayson['client'][_0x35a2('0x14')]({'port':0x232b});var client9002=jayson['client'][_0x35a2('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x424095,_0x2bc2ac,_0x191fe2,_0x4e49cb){return new BPromise(function(_0x51b86f,_0x2fb8b2){var _0x190e29=_0x4e49cb||client;return _0x190e29[_0x35a2('0x15')](_0x424095,_0x191fe2)[_0x35a2('0x16')](function(_0x1eacc7){logger[_0x35a2('0x17')](_0x35a2('0x18'),_0x2bc2ac,_0x35a2('0x19'));logger[_0x35a2('0x1a')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x2bc2ac,_0x35a2('0x19'),JSON[_0x35a2('0x1b')](_0x1eacc7));if(_0x1eacc7[_0x35a2('0x1c')]){if(_0x1eacc7[_0x35a2('0x1c')][_0x35a2('0x1d')]===0x1f4){logger[_0x35a2('0x1c')]('MailMessage,\x20%s,\x20%s',_0x2bc2ac,_0x1eacc7[_0x35a2('0x1c')]['message']);return _0x2fb8b2(_0x1eacc7[_0x35a2('0x1c')][_0x35a2('0x1e')]);}logger['error'](_0x35a2('0x18'),_0x2bc2ac,_0x1eacc7[_0x35a2('0x1c')][_0x35a2('0x1e')]);return _0x51b86f(_0x1eacc7[_0x35a2('0x1c')][_0x35a2('0x1e')]);}else{logger['info'](_0x35a2('0x18'),_0x2bc2ac,'request\x20sent');_0x51b86f(_0x1eacc7['result'][_0x35a2('0x1e')]);}})['catch'](function(_0x553895){logger[_0x35a2('0x1c')]('MailMessage,\x20%s,\x20%s',_0x2bc2ac,_0x553895);_0x2fb8b2(_0x553895);});});}function respondWithResult(_0xb1bdc9,_0x46f981){_0x46f981=_0x46f981||0xc8;return function(_0x402e3e){if(_0x402e3e){return _0xb1bdc9['status'](_0x46f981)[_0x35a2('0x1f')](_0x402e3e);}};}function respondWithFilteredResult(_0x1fff27,_0x2ef128){return function(_0x4c5db8){if(_0x4c5db8){var _0x5bc835=typeof _0x2ef128['offset']===_0x35a2('0x20')&&typeof _0x2ef128[_0x35a2('0x21')]===_0x35a2('0x20');var _0x47f94b=_0x4c5db8[_0x35a2('0x22')];var _0x34ed23=_0x5bc835?0x0:_0x2ef128[_0x35a2('0x23')];var _0x27f2b4=_0x5bc835?_0x4c5db8[_0x35a2('0x22')]:_0x2ef128['offset']+_0x2ef128['limit'];var _0x4ff627;if(_0x27f2b4>=_0x47f94b){_0x27f2b4=_0x47f94b;_0x4ff627=0xc8;}else{_0x4ff627=0xce;}_0x1fff27['status'](_0x4ff627);return _0x1fff27[_0x35a2('0x24')](_0x35a2('0x25'),_0x34ed23+'-'+_0x27f2b4+'/'+_0x47f94b)['json'](_0x4c5db8);}return null;};}function saveUpdates(_0x2869d3){return function(_0x4765fa){if(_0x4765fa){return _0x4765fa[_0x35a2('0x26')](_0x2869d3)[_0x35a2('0x16')](function(_0x1b80c6){return _0x1b80c6;});}return null;};}function removeEntity(_0x4a67df){return function(_0x3397a1){if(_0x3397a1){return _0x3397a1[_0x35a2('0x27')]()[_0x35a2('0x16')](function(){_0x4a67df[_0x35a2('0x28')](0xcc)[_0x35a2('0x29')]();});}};}function handleEntityNotFound(_0x2d105e){return function(_0x8fc41e){if(!_0x8fc41e){_0x2d105e[_0x35a2('0x2a')](0x194);}return _0x8fc41e;};}function handleError(_0x178fae,_0xf952a6){_0xf952a6=_0xf952a6||0x1f4;return function(_0xa77bf4){logger['error'](_0xa77bf4[_0x35a2('0x2b')]);if(_0xa77bf4[_0x35a2('0x2c')]){delete _0xa77bf4['name'];}_0x178fae['status'](_0xf952a6)[_0x35a2('0x2d')](_0xa77bf4);};}exports[_0x35a2('0x2e')]=function(_0x216794,_0xcc6e53){var _0x56d7ad={},_0x2997d3={},_0x401228={'count':0x0,'rows':[]};var _0x16860c=_[_0x35a2('0x2f')](db[_0x35a2('0x30')]['rawAttributes'],function(_0x221f5b){return{'name':_0x221f5b[_0x35a2('0x31')],'type':_0x221f5b['type'][_0x35a2('0x32')]};});_0x2997d3[_0x35a2('0x33')]=_[_0x35a2('0x2f')](_0x16860c,'name');_0x2997d3[_0x35a2('0x34')]=_[_0x35a2('0x35')](_0x216794[_0x35a2('0x34')]);_0x2997d3['filters']=_[_0x35a2('0x36')](_0x2997d3[_0x35a2('0x33')],_0x2997d3[_0x35a2('0x34')]);_0x56d7ad[_0x35a2('0x37')]=_[_0x35a2('0x36')](_0x2997d3[_0x35a2('0x33')],qs['fields'](_0x216794['query'][_0x35a2('0x38')]));_0x56d7ad['attributes']=_0x56d7ad['attributes'][_0x35a2('0x39')]?_0x56d7ad[_0x35a2('0x37')]:_0x2997d3[_0x35a2('0x33')];if(!_0x216794[_0x35a2('0x34')][_0x35a2('0x3a')](_0x35a2('0x3b'))){_0x56d7ad[_0x35a2('0x21')]=qs['limit'](_0x216794[_0x35a2('0x34')][_0x35a2('0x21')]);_0x56d7ad[_0x35a2('0x23')]=qs[_0x35a2('0x23')](_0x216794[_0x35a2('0x34')]['offset']);}_0x56d7ad[_0x35a2('0x3c')]=qs[_0x35a2('0x3d')](_0x216794[_0x35a2('0x34')][_0x35a2('0x3d')]);_0x56d7ad[_0x35a2('0x3e')]=qs[_0x35a2('0x3f')](_[_0x35a2('0x40')](_0x216794[_0x35a2('0x34')],_0x2997d3['filters']),_0x16860c);if(_0x216794['query'][_0x35a2('0x41')]){_0x56d7ad[_0x35a2('0x3e')]=_[_0x35a2('0x42')](_0x56d7ad['where'],{'$or':_[_0x35a2('0x2f')](_0x16860c,function(_0x3d7234){if(_0x3d7234[_0x35a2('0x43')]!==_0x35a2('0x44')){var _0x18787b={};_0x18787b[_0x3d7234['name']]={'$like':'%'+_0x216794['query']['filter']+'%'};return _0x18787b;}})});}_0x56d7ad=_[_0x35a2('0x42')]({},_0x56d7ad,_0x216794[_0x35a2('0x45')]);var _0x592f8b={'where':_0x56d7ad[_0x35a2('0x3e')]};return db[_0x35a2('0x30')][_0x35a2('0x22')](_0x592f8b)['then'](function(_0xb6f558){_0x401228[_0x35a2('0x22')]=_0xb6f558;if(_0x216794[_0x35a2('0x34')]['includeAll']){_0x56d7ad['include']=[{'all':!![]}];}return db['MailMessage'][_0x35a2('0x46')](_0x56d7ad);})[_0x35a2('0x16')](function(_0x3c3916){_0x401228[_0x35a2('0x47')]=_0x3c3916;return _0x401228;})[_0x35a2('0x16')](respondWithFilteredResult(_0xcc6e53,_0x56d7ad))[_0x35a2('0x48')](handleError(_0xcc6e53,null));};exports[_0x35a2('0x49')]=function(_0xdad087,_0x33b1fb){var _0x40846a={'raw':!![],'where':{'id':_0xdad087[_0x35a2('0x4a')]['id']}},_0x26a918={};_0x26a918[_0x35a2('0x33')]=_[_0x35a2('0x35')](db['MailMessage']['rawAttributes']);_0x26a918[_0x35a2('0x34')]=_[_0x35a2('0x35')](_0xdad087[_0x35a2('0x34')]);_0x26a918['filters']=_[_0x35a2('0x36')](_0x26a918[_0x35a2('0x33')],_0x26a918[_0x35a2('0x34')]);_0x40846a['attributes']=_['intersection'](_0x26a918[_0x35a2('0x33')],qs[_0x35a2('0x38')](_0xdad087[_0x35a2('0x34')][_0x35a2('0x38')]));_0x40846a[_0x35a2('0x37')]=_0x40846a[_0x35a2('0x37')][_0x35a2('0x39')]?_0x40846a[_0x35a2('0x37')]:_0x26a918[_0x35a2('0x33')];if(_0xdad087['query'][_0x35a2('0x4b')]){_0x40846a[_0x35a2('0x4c')]=[{'all':!![]}];}_0x40846a=_[_0x35a2('0x42')]({},_0x40846a,_0xdad087[_0x35a2('0x45')]);return db['MailMessage'][_0x35a2('0x4d')](_0x40846a)['then'](handleEntityNotFound(_0x33b1fb,null))[_0x35a2('0x16')](respondWithResult(_0x33b1fb,null))[_0x35a2('0x48')](handleError(_0x33b1fb,null));};exports[_0x35a2('0x26')]=function(_0x3aa6ca,_0x3b9318){if(_0x3aa6ca['body']['id']){delete _0x3aa6ca[_0x35a2('0x4e')]['id'];}return db[_0x35a2('0x30')][_0x35a2('0x4d')]({'where':{'id':_0x3aa6ca['params']['id']}})[_0x35a2('0x16')](handleEntityNotFound(_0x3b9318,null))['then'](saveUpdates(_0x3aa6ca[_0x35a2('0x4e')],null))['then'](respondWithResult(_0x3b9318,null))[_0x35a2('0x48')](handleError(_0x3b9318,null));};exports['destroy']=function(_0x4ebb2b,_0xafefdf){return db[_0x35a2('0x30')][_0x35a2('0x4d')]({'where':{'id':_0x4ebb2b[_0x35a2('0x4a')]['id']}})[_0x35a2('0x16')](handleEntityNotFound(_0xafefdf,null))['then'](removeEntity(_0xafefdf,null))[_0x35a2('0x48')](handleError(_0xafefdf,null));};exports[_0x35a2('0x4f')]=function(_0x1a9f23,_0x4c9c2b){return db[_0x35a2('0x30')][_0x35a2('0x4f')]()[_0x35a2('0x16')](respondWithResult(_0x4c9c2b,null))[_0x35a2('0x48')](handleError(_0x4c9c2b,null));};exports[_0x35a2('0x50')]=function(_0x5b2a86,_0x569980){return db['MailMessage'][_0x35a2('0x50')](_0x5b2a86[_0x35a2('0x4e')])[_0x35a2('0x16')](function(_0x31e3eb){if(_0x31e3eb){if(_0x31e3eb[_0x35a2('0x51')]===_0x35a2('0x52')&&!_0x31e3eb[_0x35a2('0x53')]){var _0x578e7f,_0x4323ff,_0x4f7a7f;if(_0x5b2a86[_0x35a2('0x4e')]['to']){_0x4323ff=_0x5b2a86['body']['to'][_0x35a2('0x54')](',')[0x0];}return db[_0x35a2('0x55')]['findOne']({'where':{'id':_0x31e3eb[_0x35a2('0x56')]},'include':[{'model':db[_0x35a2('0x57')],'as':_0x35a2('0x58'),'include':[{'model':db[_0x35a2('0x59')],'as':_0x35a2('0x5a'),'where':{'email':_0x4323ff},'limit':0x1,'order':[[_0x35a2('0x5b'),_0x35a2('0x5c')]]}]},{'model':db[_0x35a2('0x5d')],'as':_0x35a2('0x5e'),'raw':!![],'include':[{'model':db[_0x35a2('0x5f')],'as':_0x35a2('0x5f'),'raw':!![]}]}]})['then'](function(_0x4b5f04){_0x578e7f=_0x4b5f04;if(!_0x578e7f||!_0x578e7f[_0x35a2('0x5e')])return;var _0x735466=_0x578e7f['getSmtpOptions']();if(_0x5b2a86['body'][_0x35a2('0x60')]&&_0x5b2a86[_0x35a2('0x4e')][_0x35a2('0x60')][_0x35a2('0x39')]){for(var _0x91289d=0x0;_0x91289d<_0x5b2a86['body']['attachments'][_0x35a2('0x39')];_0x91289d+=0x1){_0x5b2a86[_0x35a2('0x4e')][_0x35a2('0x60')][_0x91289d]={'filename':_0x5b2a86['body'][_0x35a2('0x60')][_0x91289d][_0x35a2('0x2c')],'path':path[_0x35a2('0x61')](config['root'],_0x35a2('0x62'),_0x5b2a86[_0x35a2('0x4e')][_0x35a2('0x60')][_0x91289d][_0x35a2('0x63')])};}}_0x4f7a7f={'account':_0x735466,'message':_0x5b2a86[_0x35a2('0x4e')]};return;})['then'](function(){if(_0x578e7f[_0x35a2('0x58')]){if(_0x578e7f['List'][_0x35a2('0x5a')]['length']){return _0x578e7f[_0x35a2('0x58')][_0x35a2('0x5a')][0x0];}else{return db[_0x35a2('0x59')]['create'](_['defaults'](_0x5b2a86[_0x35a2('0x4e')],{'firstName':_0x5b2a86[_0x35a2('0x4e')]['to'],'email':_0x5b2a86[_0x35a2('0x4e')]['to'],'phone':_0x5b2a86['body']['to'],'ListId':_0x578e7f['ListId']}));}}else{throw new Error(_0x35a2('0x64'));}})[_0x35a2('0x16')](function(){if(_0x4f7a7f){return respondWithRpcPromise(_0x35a2('0x65'),'sendMail',_0x4f7a7f,client9003)[_0x35a2('0x16')](function(_0x4d7ead){return _0x31e3eb['update']({'read':!![],'messageId':_0x4d7ead[_0x35a2('0x66')],'sentAt':moment()[_0x35a2('0x67')](_0x35a2('0x68'))});})['catch'](function(_0x44c94b){logger[_0x35a2('0x1c')]('%s',JSON[_0x35a2('0x1b')](_0x44c94b));return _0x31e3eb;});}return _0x31e3eb;});}return _0x31e3eb;}})[_0x35a2('0x16')](respondWithResult(_0x569980,0xc9))['catch'](handleError(_0x569980,null));};exports[_0x35a2('0x69')]=function(_0x400967,_0xb06805){var _0xd5099d={'agent':{},'channel':_0x35a2('0x6a')};if(_0x400967['body']['id']){delete _0x400967['body']['id'];}_0x400967[_0x35a2('0x4e')][_0x35a2('0x6b')]=!![];_0x400967[_0x35a2('0x4e')]['readAt']=moment()[_0x35a2('0x67')](_0x35a2('0x68'));_0x400967[_0x35a2('0x4e')][_0x35a2('0x6c')]=_0x400967[_0x35a2('0x4e')][_0x35a2('0x6c')]||_0x400967[_0x35a2('0x6d')]['id'];_0xd5099d[_0x35a2('0x6e')]['id']=_0x400967[_0x35a2('0x4e')][_0x35a2('0x6c')];return db['MailMessage'][_0x35a2('0x4d')]({'where':{'id':_0x400967[_0x35a2('0x4a')]['id'],'UserId':null}})[_0x35a2('0x16')](handleEntityNotFound(_0xb06805,null))[_0x35a2('0x16')](saveUpdates(_0x400967['body'],null))['then'](function(_0x7c6577){if(_0x7c6577){_0xd5099d['message']=_0x7c6577[_0x35a2('0x6f')]({'plain':!![]});return db[_0x35a2('0x70')]['find']({'where':{'id':_0x7c6577[_0x35a2('0x71')]}});}return null;})[_0x35a2('0x16')](handleEntityNotFound(_0xb06805,null))[_0x35a2('0x16')](function(_0x23b50a){if(_0x23b50a){return _0x23b50a[_0x35a2('0x26')]({'UserId':_0x400967[_0x35a2('0x4e')][_0x35a2('0x6c')],'read1stAt':_[_0x35a2('0x72')](_0x23b50a[_0x35a2('0x73')])?moment()[_0x35a2('0x67')](_0x35a2('0x68')):undefined});}return null;})['then'](function(_0x3db9bf){if(_0x3db9bf){_0xd5099d[_0x35a2('0x74')]=_0x3db9bf[_0x35a2('0x6f')]({'plain':!![]});interaction_log[_0x35a2('0x17')](_0x35a2('0x75'),_0x400967[_0x35a2('0x6d')]['id'],_0x400967[_0x35a2('0x6d')][_0x35a2('0x2c')],_0x400967['user'][_0x35a2('0x76')],_0xd5099d[_0x35a2('0x74')]['id'],_0x400967[_0x35a2('0x4e')]?JSON[_0x35a2('0x1b')](_0x400967[_0x35a2('0x4e')]):_0x35a2('0x77'));return respondWithRpcPromise(_0x35a2('0x78'),_0x35a2('0x79'),_0xd5099d);}return null;})['then'](function(_0x2f019a){var _0x173212='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2f019a['message'][_0x35a2('0x7a')];return db['sequelize'][_0x35a2('0x34')](_0x173212,{'type':db['Sequelize'][_0x35a2('0x7b')]['SELECT'],'raw':!![]})[_0x35a2('0x16')](function(_0x5dc799){return _0x5dc799;});})[_0x35a2('0x16')](function(_0x14b861){if(_0x14b861){_0xd5099d[_0x35a2('0x1e')]['contact']=_0x14b861[0x0];if(!_0x400967['body'][_0x35a2('0x6c')])return;return db[_0x35a2('0x7c')][_0x35a2('0x4d')]({'where':{'id':_0x400967['body'][_0x35a2('0x6c')],'role':_0x35a2('0x6e')},'attributes':['id',_0x35a2('0x2c'),_0x35a2('0x7d'),_0x35a2('0x7e'),_0x35a2('0x7f')],'raw':!![]});}return null;})[_0x35a2('0x16')](function(_0x36d87d){if(!_0x36d87d)return null;_0xd5099d[_0x35a2('0x1e')][_0x35a2('0x6e')]=_0x36d87d;return _0xd5099d;})[_0x35a2('0x16')](function(_0x305f31){if(_0x305f31){if(_0x400967[_0x35a2('0x4e')]['manual']){_0xd5099d['message'][_0x35a2('0x80')]=util[_0x35a2('0x67')](_0x35a2('0x81'),_0x400967[_0x35a2('0x6d')][_0x35a2('0x2c')]);_0xd5099d[_0x35a2('0x1e')][_0x35a2('0x82')]=_0xd5099d[_0x35a2('0x82')];_0xd5099d[_0x35a2('0x1e')][_0x35a2('0x83')]=_0xd5099d[_0x35a2('0x82')];_0xd5099d[_0x35a2('0x1e')][_0x35a2('0x84')]=_0x35a2('0x69');_0xd5099d[_0x35a2('0x1e')][_0x35a2('0x4e')]=htmlToText[_0x35a2('0x85')](_0xd5099d[_0x35a2('0x1e')][_0x35a2('0x4e')]);return respondWithRpcPromise(_0x35a2('0x86'),_0x35a2('0x86'),{'event':_0x35a2('0x87'),'message':_0xd5099d['message']},client9002)[_0x35a2('0x16')](function(){return _0xd5099d;});}return _0xd5099d;}return null;})[_0x35a2('0x16')](respondWithResult(_0xb06805,null))[_0x35a2('0x48')](handleError(_0xb06805,null));};exports[_0x35a2('0x88')]=function(_0x3dc86c,_0x3cdf5d){var _0x54d86f={'agent':{},'channel':_0x35a2('0x6a')};if(_0x3dc86c[_0x35a2('0x4e')]['id']){delete _0x3dc86c[_0x35a2('0x4e')]['id'];}_0x3dc86c[_0x35a2('0x4e')][_0x35a2('0x6c')]=_0x3dc86c[_0x35a2('0x4e')][_0x35a2('0x6c')]||_0x3dc86c[_0x35a2('0x6d')]['id'];_0x54d86f[_0x35a2('0x6e')]['id']=_0x3dc86c[_0x35a2('0x4e')][_0x35a2('0x6c')];return db[_0x35a2('0x30')][_0x35a2('0x4d')]({'where':{'id':_0x3dc86c[_0x35a2('0x4a')]['id'],'UserId':null}})[_0x35a2('0x16')](handleEntityNotFound(_0x3cdf5d,null))[_0x35a2('0x16')](function(_0x474acb){if(_0x474acb){_0x54d86f[_0x35a2('0x1e')]=_0x474acb[_0x35a2('0x6f')]({'plain':!![]});return db['MailInteraction'][_0x35a2('0x4d')]({'where':{'id':_0x474acb[_0x35a2('0x71')]}});}return null;})[_0x35a2('0x16')](handleEntityNotFound(_0x3cdf5d,null))[_0x35a2('0x16')](function(_0x2fff89){if(_0x2fff89){_0x54d86f[_0x35a2('0x74')]=_0x2fff89[_0x35a2('0x6f')]({'plain':!![]});interaction_log[_0x35a2('0x17')](_0x35a2('0x89'),_0x3dc86c[_0x35a2('0x6d')]['id'],_0x3dc86c['user'][_0x35a2('0x2c')],_0x3dc86c[_0x35a2('0x6d')][_0x35a2('0x76')],_0x54d86f['interaction']['id'],_0x3dc86c[_0x35a2('0x4e')]?JSON[_0x35a2('0x1b')](_0x3dc86c['body']):_0x35a2('0x77'));return respondWithRpcPromise(_0x35a2('0x8a'),'rejectMessage',_0x54d86f);}return null;})[_0x35a2('0x16')](function(_0x1e6604){var _0x2112b0=_0x35a2('0x8b')+_0x1e6604['message'][_0x35a2('0x7a')];return db[_0x35a2('0x8c')][_0x35a2('0x34')](_0x2112b0,{'type':db[_0x35a2('0x8d')]['QueryTypes'][_0x35a2('0x8e')],'raw':!![]})[_0x35a2('0x16')](function(_0x38150b){return _0x38150b;});})[_0x35a2('0x16')](function(_0x1456cb){if(_0x1456cb){_0x54d86f[_0x35a2('0x1e')]['contact']=_0x1456cb[0x0];if(!_0x3dc86c[_0x35a2('0x4e')]['UserId'])return;return db[_0x35a2('0x7c')][_0x35a2('0x4d')]({'where':{'id':_0x3dc86c['body']['UserId'],'role':_0x35a2('0x6e')},'attributes':['id',_0x35a2('0x2c'),_0x35a2('0x7d'),_0x35a2('0x7e'),_0x35a2('0x7f')],'raw':!![]});}return null;})[_0x35a2('0x16')](function(_0x43dfaa){if(!_0x43dfaa)return null;_0x54d86f[_0x35a2('0x1e')][_0x35a2('0x6e')]=_0x43dfaa;return _0x54d86f;})[_0x35a2('0x16')](function(_0x42914a){if(_0x42914a){_0x42914a['message']['interface']=util[_0x35a2('0x67')](_0x35a2('0x81'),_0x3dc86c['user']['name']);_0x42914a[_0x35a2('0x1e')][_0x35a2('0x82')]=_0x54d86f['channel'];_0x42914a[_0x35a2('0x1e')]['motionChannel']=_0x54d86f[_0x35a2('0x82')];_0x42914a['message'][_0x35a2('0x84')]=_0x35a2('0x88');_0x42914a[_0x35a2('0x1e')]['body']=htmlToText[_0x35a2('0x85')](_0x54d86f['message']['body']);respondWithRpcPromise(_0x35a2('0x86'),_0x35a2('0x86'),{'event':'rejectmessage','message':_0x42914a[_0x35a2('0x1e')]},client9002);return _0x54d86f;}return null;})['then'](respondWithResult(_0x3cdf5d,null))[_0x35a2('0x48')](handleError(_0x3cdf5d,null));};exports[_0x35a2('0x8f')]=function(_0xda9901,_0x1786cb){var _0x4ab2d7=moment()['unix']()[_0x35a2('0x90')]();var _0x1a1055=path[_0x35a2('0x61')](config['root'],_0x35a2('0x91'),_0x35a2('0x92'),_0x35a2('0x93'));var _0x370772=path['join'](config[_0x35a2('0x94')],'server',_0x35a2('0x92'),_0x35a2('0x60'));var _0x541bbc=util[_0x35a2('0x67')]('message-%s.eml',_0x4ab2d7);return db[_0x35a2('0x30')][_0x35a2('0x4d')]({'where':{'id':_0xda9901[_0x35a2('0x4a')]['id']},'attributes':['id',_0x35a2('0x4e'),'from','to','cc',_0x35a2('0x95'),'subject',_0x35a2('0x96')],'include':_0xda9901['query']['attachments']?[{'model':db[_0x35a2('0x97')],'as':_0x35a2('0x98')}]:undefined})[_0x35a2('0x16')](handleEntityNotFound(_0x1786cb,null))['then'](function(_0xe26bd0){if(_0xe26bd0){var _0x48e1ca=_0xe26bd0;var _0x3196da={'from':_0x48e1ca['from'],'to':_0x48e1ca['to'],'subject':_0x48e1ca[_0x35a2('0x99')],'html':htmlEntities[_0x35a2('0x9a')](_0x48e1ca[_0x35a2('0x4e')]),'headers':{'Date':moment(_0x48e1ca['createdAt'])[_0x35a2('0x67')](_0x35a2('0x9b'))},'attachments':[]};if(_0xe26bd0['cc']){_0x3196da[_0x35a2('0x9c')]['Cc']=_0xe26bd0['cc'];}if(_0xe26bd0[_0x35a2('0x95')]){_0x3196da[_0x35a2('0x9c')][_0x35a2('0x9d')]=_0xe26bd0[_0x35a2('0x95')];}return new BPromise(function(_0x1366fb,_0x13e429){if(_0xe26bd0[_0x35a2('0x98')]){for(var _0x516385=0x0;_0x516385<_0xe26bd0[_0x35a2('0x98')]['length'];_0x516385++){var _0x1829ce=_0xe26bd0['Attachments'][_0x516385];var _0x23ea50=path[_0x35a2('0x61')](_0x370772,_0x1829ce[_0x35a2('0x63')]);if(fs[_0x35a2('0x9e')](_0x23ea50)){_0x3196da['attachments'][_0x35a2('0x9f')]({'name':_0x1829ce[_0x35a2('0x2c')],'contentType':_0x1829ce[_0x35a2('0x43')],'data':fs['readFileSync'](_0x23ea50)});}}}emlformat[_0x35a2('0xa0')](_0x3196da,function(_0x4d5e90,_0x2db2ef){if(_0x4d5e90)return _0x13e429(_0x4d5e90);fs['writeFileSync'](path[_0x35a2('0x61')](_0x1a1055,_0x541bbc),_0x2db2ef);return _0x1366fb(_0x2db2ef);});});}})[_0x35a2('0x16')](function(_0x1f1b37){if(_0x1f1b37){return _0x1786cb['download'](path['join'](_0x1a1055,_0x541bbc),_0x541bbc,function(_0x3b4abc){if(!_0x3b4abc)fs[_0x35a2('0xa1')](path[_0x35a2('0x61')](_0x1a1055,_0x541bbc));});}})[_0x35a2('0x48')](handleError(_0x1786cb,null));}; \ No newline at end of file +var _0x1be2=['catch','status','offset','limit','undefined','count','set','Content-Range','json','update','destroy','then','end','sendStatus','name','send','index','map','MailMessage','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','findAll','rows','show','params','includeAll','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','CloudProvider','Smtp','attachments','join','root','server/files/attachments','basename','List\x20not\x20found','sendMail','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','format','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','role','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','User','rejectmessage','server','files','tmp','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','decode','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','download','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x510cd9,_0x551300){var _0x2b1f61=function(_0x345249){while(--_0x345249){_0x510cd9['push'](_0x510cd9['shift']());}};_0x2b1f61(++_0x551300);}(_0x1be2,0x11e));var _0x21be=function(_0xae0b38,_0x31c459){_0xae0b38=_0xae0b38-0x0;var _0x26d0fb=_0x1be2[_0xae0b38];return _0x26d0fb;};'use strict';var emlformat=require(_0x21be('0x0'));var moment=require(_0x21be('0x1'));var BPromise=require('bluebird');var util=require(_0x21be('0x2'));var path=require(_0x21be('0x3'));var fs=require('fs');var _=require(_0x21be('0x4'));var Redis=require(_0x21be('0x5'));var htmlToText=require(_0x21be('0x6'));var qs=require(_0x21be('0x7'));var logger=require(_0x21be('0x8'))(_0x21be('0x9'));var interaction_log=require(_0x21be('0x8'))(_0x21be('0xa'));var config=require('../../config/environment');var db=require(_0x21be('0xb'))['db'];config[_0x21be('0xc')]=_[_0x21be('0xd')](config[_0x21be('0xc')],{'host':_0x21be('0xe'),'port':0x18eb});var socket=require(_0x21be('0xf'))(new Redis(config['redis']));var htmlEntities=require(_0x21be('0x10'));require(_0x21be('0x11'))[_0x21be('0x12')](socket);var jayson=require(_0x21be('0x13'));var client=jayson[_0x21be('0x14')]['http']({'port':0x232c});var client9003=jayson['client'][_0x21be('0x15')]({'port':0x232b});var client9002=jayson[_0x21be('0x14')][_0x21be('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x2d2153,_0x22ec18,_0x1c639d,_0x240789){return new BPromise(function(_0x5a9008,_0x5e3084){var _0x4cce36=_0x240789||client;return _0x4cce36['request'](_0x2d2153,_0x1c639d)['then'](function(_0x1587e2){logger['info'](_0x21be('0x16'),_0x22ec18,_0x21be('0x17'));logger['debug'](_0x21be('0x18'),_0x22ec18,_0x21be('0x17'),JSON[_0x21be('0x19')](_0x1587e2));if(_0x1587e2[_0x21be('0x1a')]){if(_0x1587e2[_0x21be('0x1a')]['code']===0x1f4){logger[_0x21be('0x1a')](_0x21be('0x16'),_0x22ec18,_0x1587e2[_0x21be('0x1a')]['message']);return _0x5e3084(_0x1587e2[_0x21be('0x1a')][_0x21be('0x1b')]);}logger['error'](_0x21be('0x16'),_0x22ec18,_0x1587e2['error'][_0x21be('0x1b')]);return _0x5a9008(_0x1587e2[_0x21be('0x1a')][_0x21be('0x1b')]);}else{logger[_0x21be('0x1c')]('MailMessage,\x20%s,\x20%s',_0x22ec18,'request\x20sent');_0x5a9008(_0x1587e2[_0x21be('0x1d')][_0x21be('0x1b')]);}})[_0x21be('0x1e')](function(_0x3a27c6){logger[_0x21be('0x1a')](_0x21be('0x16'),_0x22ec18,_0x3a27c6);_0x5e3084(_0x3a27c6);});});}function respondWithResult(_0x73f00,_0x4ad84e){_0x4ad84e=_0x4ad84e||0xc8;return function(_0x489851){if(_0x489851){return _0x73f00[_0x21be('0x1f')](_0x4ad84e)['json'](_0x489851);}};}function respondWithFilteredResult(_0x4c778e,_0x4f61d4){return function(_0x6f9f2b){if(_0x6f9f2b){var _0x10b907=typeof _0x4f61d4[_0x21be('0x20')]==='undefined'&&typeof _0x4f61d4[_0x21be('0x21')]===_0x21be('0x22');var _0x17b460=_0x6f9f2b[_0x21be('0x23')];var _0x961efa=_0x10b907?0x0:_0x4f61d4['offset'];var _0x43bdf0=_0x10b907?_0x6f9f2b[_0x21be('0x23')]:_0x4f61d4['offset']+_0x4f61d4[_0x21be('0x21')];var _0x1d0a03;if(_0x43bdf0>=_0x17b460){_0x43bdf0=_0x17b460;_0x1d0a03=0xc8;}else{_0x1d0a03=0xce;}_0x4c778e[_0x21be('0x1f')](_0x1d0a03);return _0x4c778e[_0x21be('0x24')](_0x21be('0x25'),_0x961efa+'-'+_0x43bdf0+'/'+_0x17b460)[_0x21be('0x26')](_0x6f9f2b);}return null;};}function saveUpdates(_0xf22ada){return function(_0x23ce8c){if(_0x23ce8c){return _0x23ce8c[_0x21be('0x27')](_0xf22ada)['then'](function(_0x10a4d5){return _0x10a4d5;});}return null;};}function removeEntity(_0x279736){return function(_0x19f566){if(_0x19f566){return _0x19f566[_0x21be('0x28')]()[_0x21be('0x29')](function(){_0x279736[_0x21be('0x1f')](0xcc)[_0x21be('0x2a')]();});}};}function handleEntityNotFound(_0x2b1854){return function(_0x298be6){if(!_0x298be6){_0x2b1854[_0x21be('0x2b')](0x194);}return _0x298be6;};}function handleError(_0x111a0d,_0x2419fa){_0x2419fa=_0x2419fa||0x1f4;return function(_0x584a5a){logger[_0x21be('0x1a')](_0x584a5a['stack']);if(_0x584a5a['name']){delete _0x584a5a[_0x21be('0x2c')];}_0x111a0d[_0x21be('0x1f')](_0x2419fa)[_0x21be('0x2d')](_0x584a5a);};}exports[_0x21be('0x2e')]=function(_0x5c3bdf,_0x87d17d){var _0xb147bc={},_0x14e7cf={},_0x48b812={'count':0x0,'rows':[]};var _0x2d0083=_[_0x21be('0x2f')](db[_0x21be('0x30')][_0x21be('0x31')],function(_0x745018){return{'name':_0x745018['fieldName'],'type':_0x745018['type'][_0x21be('0x32')]};});_0x14e7cf[_0x21be('0x33')]=_[_0x21be('0x2f')](_0x2d0083,_0x21be('0x2c'));_0x14e7cf[_0x21be('0x34')]=_[_0x21be('0x35')](_0x5c3bdf[_0x21be('0x34')]);_0x14e7cf['filters']=_[_0x21be('0x36')](_0x14e7cf[_0x21be('0x33')],_0x14e7cf['query']);_0xb147bc['attributes']=_[_0x21be('0x36')](_0x14e7cf['model'],qs[_0x21be('0x37')](_0x5c3bdf[_0x21be('0x34')]['fields']));_0xb147bc[_0x21be('0x38')]=_0xb147bc[_0x21be('0x38')][_0x21be('0x39')]?_0xb147bc[_0x21be('0x38')]:_0x14e7cf[_0x21be('0x33')];if(!_0x5c3bdf[_0x21be('0x34')][_0x21be('0x3a')](_0x21be('0x3b'))){_0xb147bc[_0x21be('0x21')]=qs['limit'](_0x5c3bdf[_0x21be('0x34')][_0x21be('0x21')]);_0xb147bc['offset']=qs['offset'](_0x5c3bdf['query'][_0x21be('0x20')]);}_0xb147bc['order']=qs[_0x21be('0x3c')](_0x5c3bdf[_0x21be('0x34')]['sort']);_0xb147bc[_0x21be('0x3d')]=qs[_0x21be('0x3e')](_[_0x21be('0x3f')](_0x5c3bdf[_0x21be('0x34')],_0x14e7cf[_0x21be('0x3e')]),_0x2d0083);if(_0x5c3bdf[_0x21be('0x34')]['filter']){_0xb147bc['where']=_[_0x21be('0x40')](_0xb147bc[_0x21be('0x3d')],{'$or':_[_0x21be('0x2f')](_0x2d0083,function(_0x21bc13){if(_0x21bc13[_0x21be('0x41')]!==_0x21be('0x42')){var _0xa62739={};_0xa62739[_0x21bc13[_0x21be('0x2c')]]={'$like':'%'+_0x5c3bdf[_0x21be('0x34')]['filter']+'%'};return _0xa62739;}})});}_0xb147bc=_[_0x21be('0x40')]({},_0xb147bc,_0x5c3bdf['options']);var _0x147a1b={'where':_0xb147bc[_0x21be('0x3d')]};return db[_0x21be('0x30')][_0x21be('0x23')](_0x147a1b)[_0x21be('0x29')](function(_0xd083e7){_0x48b812[_0x21be('0x23')]=_0xd083e7;if(_0x5c3bdf['query']['includeAll']){_0xb147bc['include']=[{'all':!![]}];}return db[_0x21be('0x30')][_0x21be('0x43')](_0xb147bc);})[_0x21be('0x29')](function(_0x217abf){_0x48b812[_0x21be('0x44')]=_0x217abf;return _0x48b812;})[_0x21be('0x29')](respondWithFilteredResult(_0x87d17d,_0xb147bc))[_0x21be('0x1e')](handleError(_0x87d17d,null));};exports[_0x21be('0x45')]=function(_0x5e3449,_0x4d6b70){var _0x5c95d7={'raw':!![],'where':{'id':_0x5e3449[_0x21be('0x46')]['id']}},_0x5119f8={};_0x5119f8[_0x21be('0x33')]=_[_0x21be('0x35')](db[_0x21be('0x30')][_0x21be('0x31')]);_0x5119f8[_0x21be('0x34')]=_[_0x21be('0x35')](_0x5e3449[_0x21be('0x34')]);_0x5119f8[_0x21be('0x3e')]=_[_0x21be('0x36')](_0x5119f8[_0x21be('0x33')],_0x5119f8[_0x21be('0x34')]);_0x5c95d7[_0x21be('0x38')]=_['intersection'](_0x5119f8[_0x21be('0x33')],qs[_0x21be('0x37')](_0x5e3449['query'][_0x21be('0x37')]));_0x5c95d7['attributes']=_0x5c95d7[_0x21be('0x38')][_0x21be('0x39')]?_0x5c95d7[_0x21be('0x38')]:_0x5119f8[_0x21be('0x33')];if(_0x5e3449['query'][_0x21be('0x47')]){_0x5c95d7['include']=[{'all':!![]}];}_0x5c95d7=_[_0x21be('0x40')]({},_0x5c95d7,_0x5e3449['options']);return db[_0x21be('0x30')][_0x21be('0x48')](_0x5c95d7)[_0x21be('0x29')](handleEntityNotFound(_0x4d6b70,null))[_0x21be('0x29')](respondWithResult(_0x4d6b70,null))[_0x21be('0x1e')](handleError(_0x4d6b70,null));};exports[_0x21be('0x27')]=function(_0x5cd09e,_0x369e87){if(_0x5cd09e['body']['id']){delete _0x5cd09e[_0x21be('0x49')]['id'];}return db[_0x21be('0x30')][_0x21be('0x48')]({'where':{'id':_0x5cd09e['params']['id']}})[_0x21be('0x29')](handleEntityNotFound(_0x369e87,null))[_0x21be('0x29')](saveUpdates(_0x5cd09e['body'],null))[_0x21be('0x29')](respondWithResult(_0x369e87,null))[_0x21be('0x1e')](handleError(_0x369e87,null));};exports[_0x21be('0x28')]=function(_0x3f6ba0,_0x494228){return db[_0x21be('0x30')][_0x21be('0x48')]({'where':{'id':_0x3f6ba0[_0x21be('0x46')]['id']}})[_0x21be('0x29')](handleEntityNotFound(_0x494228,null))['then'](removeEntity(_0x494228,null))[_0x21be('0x1e')](handleError(_0x494228,null));};exports[_0x21be('0x4a')]=function(_0x4549b1,_0xa33450){return db[_0x21be('0x30')][_0x21be('0x4a')]()[_0x21be('0x29')](respondWithResult(_0xa33450,null))['catch'](handleError(_0xa33450,null));};exports[_0x21be('0x4b')]=function(_0x29ee18,_0x371052){return db['MailMessage'][_0x21be('0x4b')](_0x29ee18[_0x21be('0x49')])[_0x21be('0x29')](function(_0x1f8ef6){if(_0x1f8ef6){if(_0x1f8ef6[_0x21be('0x4c')]===_0x21be('0x4d')&&!_0x1f8ef6[_0x21be('0x4e')]){var _0x4b4132,_0x547df3,_0x92221;if(_0x29ee18['body']['to']){_0x547df3=_0x29ee18[_0x21be('0x49')]['to'][_0x21be('0x4f')](',')[0x0];}return db[_0x21be('0x50')][_0x21be('0x51')]({'where':{'id':_0x1f8ef6[_0x21be('0x52')]},'include':[{'model':db[_0x21be('0x53')],'as':_0x21be('0x54'),'include':[{'model':db[_0x21be('0x55')],'as':_0x21be('0x56'),'where':{'email':_0x547df3},'limit':0x1,'order':[[_0x21be('0x57'),_0x21be('0x58')]]}]},{'model':db[_0x21be('0x59')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x21be('0x5a')],'as':_0x21be('0x5a'),'raw':!![]}]}]})['then'](function(_0x51f496){_0x4b4132=_0x51f496;if(!_0x4b4132||!_0x4b4132[_0x21be('0x5b')])return;var _0x52728b=_0x4b4132['getSmtpOptions']();if(_0x29ee18[_0x21be('0x49')][_0x21be('0x5c')]&&_0x29ee18['body'][_0x21be('0x5c')]['length']){for(var _0x405d45=0x0;_0x405d45<_0x29ee18[_0x21be('0x49')][_0x21be('0x5c')]['length'];_0x405d45+=0x1){_0x29ee18[_0x21be('0x49')][_0x21be('0x5c')][_0x405d45]={'filename':_0x29ee18[_0x21be('0x49')][_0x21be('0x5c')][_0x405d45][_0x21be('0x2c')],'path':path[_0x21be('0x5d')](config[_0x21be('0x5e')],_0x21be('0x5f'),_0x29ee18[_0x21be('0x49')]['attachments'][_0x405d45][_0x21be('0x60')])};}}_0x92221={'account':_0x52728b,'message':_0x29ee18[_0x21be('0x49')]};return;})[_0x21be('0x29')](function(){if(_0x4b4132[_0x21be('0x54')]){if(_0x4b4132[_0x21be('0x54')][_0x21be('0x56')][_0x21be('0x39')]){return _0x4b4132['List'][_0x21be('0x56')][0x0];}else{return db[_0x21be('0x55')]['create'](_[_0x21be('0xd')](_0x29ee18[_0x21be('0x49')],{'firstName':_0x29ee18['body']['to'],'email':_0x29ee18[_0x21be('0x49')]['to'],'phone':_0x29ee18[_0x21be('0x49')]['to'],'ListId':_0x4b4132['ListId']}));}}else{throw new Error(_0x21be('0x61'));}})[_0x21be('0x29')](function(){if(_0x92221){return respondWithRpcPromise('SendMail',_0x21be('0x62'),_0x92221,client9003)[_0x21be('0x29')](function(_0x2d98ee){return _0x1f8ef6[_0x21be('0x27')]({'read':!![],'messageId':_0x2d98ee['messageId'],'sentAt':moment()['format'](_0x21be('0x63'))});})[_0x21be('0x1e')](function(_0x4beb67){logger[_0x21be('0x1a')]('%s',JSON[_0x21be('0x19')](_0x4beb67));return _0x1f8ef6;});}return _0x1f8ef6;});}return _0x1f8ef6;}})[_0x21be('0x29')](respondWithResult(_0x371052,0xc9))[_0x21be('0x1e')](handleError(_0x371052,null));};exports[_0x21be('0x64')]=function(_0x3b8794,_0x83f705){var _0x31a0b4={'agent':{},'channel':_0x21be('0x65')};if(_0x3b8794['body']['id']){delete _0x3b8794[_0x21be('0x49')]['id'];}_0x3b8794[_0x21be('0x49')]['read']=!![];_0x3b8794['body'][_0x21be('0x66')]=moment()[_0x21be('0x67')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b8794[_0x21be('0x49')]['UserId']=_0x3b8794[_0x21be('0x49')][_0x21be('0x68')]||_0x3b8794[_0x21be('0x69')]['id'];_0x31a0b4[_0x21be('0x6a')]['id']=_0x3b8794['body'][_0x21be('0x68')];return db[_0x21be('0x30')][_0x21be('0x48')]({'where':{'id':_0x3b8794['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x83f705,null))[_0x21be('0x29')](saveUpdates(_0x3b8794[_0x21be('0x49')],null))[_0x21be('0x29')](function(_0x48527d){if(_0x48527d){_0x31a0b4['message']=_0x48527d[_0x21be('0x6b')]({'plain':!![]});return db[_0x21be('0x6c')]['find']({'where':{'id':_0x48527d[_0x21be('0x6d')]}});}return null;})['then'](handleEntityNotFound(_0x83f705,null))[_0x21be('0x29')](function(_0xf98b0c){if(_0xf98b0c){return _0xf98b0c[_0x21be('0x27')]({'UserId':_0x3b8794[_0x21be('0x49')][_0x21be('0x68')],'read1stAt':_[_0x21be('0x6e')](_0xf98b0c[_0x21be('0x6f')])?moment()['format'](_0x21be('0x63')):undefined});}return null;})[_0x21be('0x29')](function(_0x391378){if(_0x391378){_0x31a0b4['interaction']=_0x391378[_0x21be('0x6b')]({'plain':!![]});interaction_log[_0x21be('0x1c')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3b8794[_0x21be('0x69')]['id'],_0x3b8794[_0x21be('0x69')][_0x21be('0x2c')],_0x3b8794[_0x21be('0x69')][_0x21be('0x70')],_0x31a0b4['interaction']['id'],_0x3b8794[_0x21be('0x49')]?JSON[_0x21be('0x19')](_0x3b8794[_0x21be('0x49')]):_0x21be('0x71'));return respondWithRpcPromise(_0x21be('0x72'),_0x21be('0x73'),_0x31a0b4);}return null;})[_0x21be('0x29')](function(_0x330cb9){var _0x20c169='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x330cb9['message'][_0x21be('0x74')];return db['sequelize'][_0x21be('0x34')](_0x20c169,{'type':db[_0x21be('0x75')][_0x21be('0x76')][_0x21be('0x77')],'raw':!![]})[_0x21be('0x29')](function(_0x318f0f){return _0x318f0f;});})[_0x21be('0x29')](function(_0x25f50a){if(_0x25f50a){_0x31a0b4[_0x21be('0x1b')][_0x21be('0x78')]=_0x25f50a[0x0];if(!_0x3b8794[_0x21be('0x49')][_0x21be('0x68')])return;return db['User'][_0x21be('0x48')]({'where':{'id':_0x3b8794[_0x21be('0x49')][_0x21be('0x68')],'role':_0x21be('0x6a')},'attributes':['id',_0x21be('0x2c'),'fullname',_0x21be('0x79'),_0x21be('0x7a')],'raw':!![]});}return null;})['then'](function(_0x108da8){if(!_0x108da8)return null;_0x31a0b4['message'][_0x21be('0x6a')]=_0x108da8;return _0x31a0b4;})['then'](function(_0x2c0155){if(_0x2c0155){if(_0x3b8794[_0x21be('0x49')][_0x21be('0x7b')]){_0x31a0b4[_0x21be('0x1b')][_0x21be('0x7c')]=util['format'](_0x21be('0x7d'),_0x3b8794[_0x21be('0x69')][_0x21be('0x2c')]);_0x31a0b4[_0x21be('0x1b')][_0x21be('0x7e')]=_0x31a0b4[_0x21be('0x7e')];_0x31a0b4[_0x21be('0x1b')][_0x21be('0x7f')]=_0x31a0b4[_0x21be('0x7e')];_0x31a0b4[_0x21be('0x1b')][_0x21be('0x80')]=_0x21be('0x64');_0x31a0b4['message'][_0x21be('0x49')]=htmlToText[_0x21be('0x81')](_0x31a0b4['message']['body']);return respondWithRpcPromise('EventManager',_0x21be('0x82'),{'event':_0x21be('0x83'),'message':_0x31a0b4[_0x21be('0x1b')]},client9002)[_0x21be('0x29')](function(){return _0x31a0b4;});}return _0x31a0b4;}return null;})[_0x21be('0x29')](respondWithResult(_0x83f705,null))[_0x21be('0x1e')](handleError(_0x83f705,null));};exports[_0x21be('0x84')]=function(_0x31a3af,_0x352952){var _0x45b2b6={'agent':{},'channel':_0x21be('0x65')};if(_0x31a3af[_0x21be('0x49')]['id']){delete _0x31a3af[_0x21be('0x49')]['id'];}_0x31a3af[_0x21be('0x49')][_0x21be('0x68')]=_0x31a3af[_0x21be('0x49')]['UserId']||_0x31a3af[_0x21be('0x69')]['id'];_0x45b2b6[_0x21be('0x6a')]['id']=_0x31a3af[_0x21be('0x49')][_0x21be('0x68')];return db[_0x21be('0x30')][_0x21be('0x48')]({'where':{'id':_0x31a3af[_0x21be('0x46')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x352952,null))[_0x21be('0x29')](function(_0xf40b71){if(_0xf40b71){_0x45b2b6['message']=_0xf40b71[_0x21be('0x6b')]({'plain':!![]});return db['MailInteraction'][_0x21be('0x48')]({'where':{'id':_0xf40b71[_0x21be('0x6d')]}});}return null;})[_0x21be('0x29')](handleEntityNotFound(_0x352952,null))[_0x21be('0x29')](function(_0x517ac6){if(_0x517ac6){_0x45b2b6[_0x21be('0x85')]=_0x517ac6[_0x21be('0x6b')]({'plain':!![]});interaction_log[_0x21be('0x1c')](_0x21be('0x86'),_0x31a3af[_0x21be('0x69')]['id'],_0x31a3af[_0x21be('0x69')][_0x21be('0x2c')],_0x31a3af[_0x21be('0x69')][_0x21be('0x70')],_0x45b2b6['interaction']['id'],_0x31a3af['body']?JSON[_0x21be('0x19')](_0x31a3af[_0x21be('0x49')]):_0x21be('0x71'));return respondWithRpcPromise(_0x21be('0x87'),'rejectMessage',_0x45b2b6);}return null;})[_0x21be('0x29')](function(_0x3228d5){var _0x48de39=_0x21be('0x88')+_0x3228d5[_0x21be('0x1b')]['ContactId'];return db['sequelize'][_0x21be('0x34')](_0x48de39,{'type':db[_0x21be('0x75')]['QueryTypes'][_0x21be('0x77')],'raw':!![]})[_0x21be('0x29')](function(_0x50512c){return _0x50512c;});})[_0x21be('0x29')](function(_0x56c072){if(_0x56c072){_0x45b2b6[_0x21be('0x1b')][_0x21be('0x78')]=_0x56c072[0x0];if(!_0x31a3af['body']['UserId'])return;return db[_0x21be('0x89')][_0x21be('0x48')]({'where':{'id':_0x31a3af[_0x21be('0x49')][_0x21be('0x68')],'role':_0x21be('0x6a')},'attributes':['id','name','fullname',_0x21be('0x79'),'internal'],'raw':!![]});}return null;})['then'](function(_0x41f8de){if(!_0x41f8de)return null;_0x45b2b6[_0x21be('0x1b')][_0x21be('0x6a')]=_0x41f8de;return _0x45b2b6;})['then'](function(_0x50c140){if(_0x50c140){_0x50c140[_0x21be('0x1b')][_0x21be('0x7c')]=util[_0x21be('0x67')](_0x21be('0x7d'),_0x31a3af['user'][_0x21be('0x2c')]);_0x50c140[_0x21be('0x1b')][_0x21be('0x7e')]=_0x45b2b6['channel'];_0x50c140['message'][_0x21be('0x7f')]=_0x45b2b6[_0x21be('0x7e')];_0x50c140['message'][_0x21be('0x80')]=_0x21be('0x84');_0x50c140['message'][_0x21be('0x49')]=htmlToText[_0x21be('0x81')](_0x45b2b6[_0x21be('0x1b')][_0x21be('0x49')]);respondWithRpcPromise(_0x21be('0x82'),_0x21be('0x82'),{'event':_0x21be('0x8a'),'message':_0x50c140[_0x21be('0x1b')]},client9002);return _0x45b2b6;}return null;})[_0x21be('0x29')](respondWithResult(_0x352952,null))[_0x21be('0x1e')](handleError(_0x352952,null));};exports['download']=function(_0x128d74,_0x44569b){var _0x36abb7=moment()['unix']()['toString']();var _0x3cdbd8=path[_0x21be('0x5d')](config['root'],_0x21be('0x8b'),_0x21be('0x8c'),_0x21be('0x8d'));var _0x589568=path[_0x21be('0x5d')](config[_0x21be('0x5e')],'server',_0x21be('0x8c'),_0x21be('0x5c'));var _0x4a6f15=util['format'](_0x21be('0x8e'),_0x36abb7);return db[_0x21be('0x30')][_0x21be('0x48')]({'where':{'id':_0x128d74[_0x21be('0x46')]['id']},'attributes':['id','body',_0x21be('0x8f'),'to','cc',_0x21be('0x90'),'subject',_0x21be('0x91')],'include':_0x128d74[_0x21be('0x34')][_0x21be('0x5c')]?[{'model':db[_0x21be('0x92')],'as':_0x21be('0x93')}]:undefined})[_0x21be('0x29')](handleEntityNotFound(_0x44569b,null))['then'](function(_0x2304ce){if(_0x2304ce){var _0x29fed0=_0x2304ce;var _0x4632ad={'from':_0x29fed0[_0x21be('0x8f')],'to':_0x29fed0['to'],'subject':_0x29fed0['subject'],'html':htmlEntities[_0x21be('0x94')](_0x29fed0['body']),'headers':{'Date':moment(_0x29fed0[_0x21be('0x91')])[_0x21be('0x67')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x2304ce['cc']){_0x4632ad[_0x21be('0x95')]['Cc']=_0x2304ce['cc'];}if(_0x2304ce[_0x21be('0x90')]){_0x4632ad['headers'][_0x21be('0x96')]=_0x2304ce[_0x21be('0x90')];}return new BPromise(function(_0x262c1c,_0x564ec1){if(_0x2304ce['Attachments']){for(var _0x21d6f5=0x0;_0x21d6f5<_0x2304ce[_0x21be('0x93')]['length'];_0x21d6f5++){var _0x1c47bf=_0x2304ce['Attachments'][_0x21d6f5];var _0x5effa1=path[_0x21be('0x5d')](_0x589568,_0x1c47bf[_0x21be('0x60')]);if(fs[_0x21be('0x97')](_0x5effa1)){_0x4632ad[_0x21be('0x5c')][_0x21be('0x98')]({'name':_0x1c47bf[_0x21be('0x2c')],'contentType':_0x1c47bf[_0x21be('0x41')],'data':fs[_0x21be('0x99')](_0x5effa1)});}}}emlformat[_0x21be('0x9a')](_0x4632ad,function(_0x38065d,_0xd6bc99){if(_0x38065d)return _0x564ec1(_0x38065d);fs[_0x21be('0x9b')](path[_0x21be('0x5d')](_0x3cdbd8,_0x4a6f15),_0xd6bc99);return _0x262c1c(_0xd6bc99);});});}})[_0x21be('0x29')](function(_0x13b49a){if(_0x13b49a){return _0x44569b[_0x21be('0x9c')](path[_0x21be('0x5d')](_0x3cdbd8,_0x4a6f15),_0x4a6f15,function(_0x3a8381){if(!_0x3a8381)fs[_0x21be('0x9d')](path[_0x21be('0x5d')](_0x3cdbd8,_0x4a6f15));});}})['catch'](handleError(_0x44569b,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index eca86a7..e8ee5fc 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 _0x41c2=['hook','exports','events','../../mysqldb','MailMessage','save','remove','emit'];(function(_0x14880e,_0x5f42f8){var _0x390bb0=function(_0x45c54b){while(--_0x45c54b){_0x14880e['push'](_0x14880e['shift']());}};_0x390bb0(++_0x5f42f8);}(_0x41c2,0x6a));var _0x241c=function(_0x37ca8b,_0x9b7a36){_0x37ca8b=_0x37ca8b-0x0;var _0x4cf533=_0x41c2[_0x37ca8b];return _0x4cf533;};'use strict';var EventEmitter=require(_0x241c('0x0'));var MailMessage=require(_0x241c('0x1'))['db'][_0x241c('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x241c('0x3'),'afterUpdate':'update','afterDestroy':_0x241c('0x4')};function emitEvent(_0x55b07f){return function(_0x680f80,_0x5660e3,_0x187854){MailMessageEvents[_0x241c('0x5')](_0x55b07f+':'+_0x680f80['id'],_0x680f80);MailMessageEvents[_0x241c('0x5')](_0x55b07f,_0x680f80);_0x187854(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x241c('0x6')](e,emitEvent(event));}}module[_0x241c('0x7')]=MailMessageEvents; \ No newline at end of file +var _0xaf9a=['hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit'];(function(_0x496dcb,_0x3d7bb0){var _0x119f69=function(_0x43077f){while(--_0x43077f){_0x496dcb['push'](_0x496dcb['shift']());}};_0x119f69(++_0x3d7bb0);}(_0xaf9a,0x12c));var _0xaaf9=function(_0xa123d8,_0x47a3e2){_0xa123d8=_0xa123d8-0x0;var _0x2f4fd6=_0xaf9a[_0xa123d8];return _0x2f4fd6;};'use strict';var EventEmitter=require(_0xaaf9('0x0'));var MailMessage=require(_0xaaf9('0x1'))['db'][_0xaaf9('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xaaf9('0x3')](0x0);var events={'afterCreate':_0xaaf9('0x4'),'afterUpdate':_0xaaf9('0x5'),'afterDestroy':_0xaaf9('0x6')};function emitEvent(_0x3508b9){return function(_0x411d17,_0x225501,_0x428322){MailMessageEvents[_0xaaf9('0x7')](_0x3508b9+':'+_0x411d17['id'],_0x411d17);MailMessageEvents[_0xaaf9('0x7')](_0x3508b9,_0x411d17);_0x428322(null);};}for(var e in events){if(events[_0xaaf9('0x8')](e)){var event=events[e];MailMessage[_0xaaf9('0x9')](e,emitEvent(event));}}module[_0xaaf9('0xa')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 4b31f6e..6cc7c11 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 _0x0105=['fromString','get','direction','toLowerCase','secret','UserId','findOne','MailInteractionId','then','createdAt','error','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','body','plainBody'];(function(_0x4b80b1,_0x413ad2){var _0xa74ca3=function(_0x333da2){while(--_0x333da2){_0x4b80b1['push'](_0x4b80b1['shift']());}};_0xa74ca3(++_0x413ad2);}(_0x0105,0x1be));var _0x5010=function(_0xcf8e7a,_0x23c00b){_0xcf8e7a=_0xcf8e7a-0x0;var _0x412c26=_0x0105[_0xcf8e7a];return _0x412c26;};'use strict';var _=require(_0x5010('0x0'));var util=require(_0x5010('0x1'));var logger=require('../../config/logger')(_0x5010('0x2'));var moment=require(_0x5010('0x3'));var BPromise=require(_0x5010('0x4'));var rp=require(_0x5010('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x5010('0x6'));var rimraf=require('rimraf');var config=require(_0x5010('0x7'));var attributes=require(_0x5010('0x8'));module[_0x5010('0x9')]=function(_0x41f640,_0x2a848a){return _0x41f640[_0x5010('0xa')](_0x5010('0xb'),attributes,{'tableName':_0x5010('0xc'),'paranoid':![],'indexes':[{'name':_0x5010('0xd'),'fields':[_0x5010('0xd')]},{'name':_0x5010('0xe'),'fields':['plainBody',_0x5010('0xf')],'type':_0x5010('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4b9395,_0x1e83bc,_0x5ceceb){if(_0x4b9395[_0x5010('0x11')]){_0x4b9395[_0x5010('0x12')]=htmlToText[_0x5010('0x13')](_0x4b9395[_0x5010('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5ceceb(null,_0x1e83bc);},'afterCreate':function(_0x2a6f45,_0x117756,_0x5cb1ec){var _0x1ab232=_0x41f640['models'];var _0x3f5fee=_0x2a6f45[_0x5010('0x14')]({'plain':!![]});if(_0x3f5fee[_0x5010('0x15')][_0x5010('0x16')]()==='in'||_0x3f5fee[_0x5010('0x15')][_0x5010('0x16')]()==='out'&&!_0x3f5fee[_0x5010('0x17')]&&!_['isNil'](_0x3f5fee[_0x5010('0x18')])){_0x1ab232['MailInteraction'][_0x5010('0x19')]({'where':{'id':_0x3f5fee[_0x5010('0x1a')]}})[_0x5010('0x1b')](function(_0x294e40){if(_0x294e40){_0x294e40['update']({'lastMsgAt':_0x3f5fee[_0x5010('0x1c')],'lastMsgDirection':_0x3f5fee[_0x5010('0x15')]['toLowerCase']()});}})['catch'](function(_0x53f9fe){console[_0x5010('0x1d')](_0x53f9fe);});}_0x5cb1ec();}},'charset':'utf8mb4','collate':_0x5010('0x1e')});}; \ No newline at end of file +var _0xfc3c=['request-promise','html-to-text','path','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','body','plainBody','fromString','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x414708,_0x40bdd5){var _0x5ef823=function(_0x413ca2){while(--_0x413ca2){_0x414708['push'](_0x414708['shift']());}};_0x5ef823(++_0x40bdd5);}(_0xfc3c,0x8e));var _0xcfc3=function(_0x4f5c2a,_0x465535){_0x4f5c2a=_0x4f5c2a-0x0;var _0x1b2e6e=_0xfc3c[_0x4f5c2a];return _0x1b2e6e;};'use strict';var _=require(_0xcfc3('0x0'));var util=require(_0xcfc3('0x1'));var logger=require(_0xcfc3('0x2'))(_0xcfc3('0x3'));var moment=require(_0xcfc3('0x4'));var BPromise=require(_0xcfc3('0x5'));var rp=require(_0xcfc3('0x6'));var htmlToText=require(_0xcfc3('0x7'));var fs=require('fs');var path=require(_0xcfc3('0x8'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcfc3('0x9'));module[_0xcfc3('0xa')]=function(_0xf85d31,_0x26c3b1){return _0xf85d31[_0xcfc3('0xb')](_0xcfc3('0xc'),attributes,{'tableName':_0xcfc3('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xcfc3('0xe')]},{'name':_0xcfc3('0xf'),'fields':['plainBody',_0xcfc3('0x10')],'type':_0xcfc3('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x313478,_0x4d6cd2,_0x591d90){if(_0x313478[_0xcfc3('0x12')]){_0x313478[_0xcfc3('0x13')]=htmlToText[_0xcfc3('0x14')](_0x313478['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x591d90(null,_0x4d6cd2);},'afterCreate':function(_0x3bb881,_0x3bffb3,_0x2ede98){var _0x58149b=_0xf85d31[_0xcfc3('0x15')];var _0x5a5710=_0x3bb881[_0xcfc3('0x16')]({'plain':!![]});if(_0x5a5710[_0xcfc3('0x17')][_0xcfc3('0x18')]()==='in'||_0x5a5710['direction'][_0xcfc3('0x18')]()==='out'&&!_0x5a5710[_0xcfc3('0x19')]&&!_[_0xcfc3('0x1a')](_0x5a5710[_0xcfc3('0x1b')])){_0x58149b['MailInteraction'][_0xcfc3('0x1c')]({'where':{'id':_0x5a5710[_0xcfc3('0x1d')]}})[_0xcfc3('0x1e')](function(_0x56494f){if(_0x56494f){_0x56494f[_0xcfc3('0x1f')]({'lastMsgAt':_0x5a5710[_0xcfc3('0x20')],'lastMsgDirection':_0x5a5710[_0xcfc3('0x17')]['toLowerCase']()});}})[_0xcfc3('0x21')](function(_0x5f1cea){console[_0xcfc3('0x22')](_0x5f1cea);});}_0x2ede98();}},'charset':_0xcfc3('0x23'),'collate':_0xcfc3('0x24')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 18201c3..ee3d9f4 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 _0xbaf0=['request','then','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','MailMessage','create','body','options','raw','CreateMailMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','register'];(function(_0x56d187,_0xde6765){var _0x2b2d65=function(_0x240701){while(--_0x240701){_0x56d187['push'](_0x56d187['shift']());}};_0x2b2d65(++_0xde6765);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'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});config[_0x0baf('0xc')]=_[_0x0baf('0xd')](config[_0x0baf('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0baf('0xe'))(new Redis(config['redis']));require(_0x0baf('0xf'))[_0x0baf('0x10')](socket);function respondWithRpcPromise(_0x465528,_0x2f46e8,_0x7f54d4){return new BPromise(function(_0xf4c8ac,_0x41cead){return client[_0x0baf('0x11')](_0x465528,_0x7f54d4)[_0x0baf('0x12')](function(_0x1d60a2){logger[_0x0baf('0x13')]('MailMessage,\x20%s,\x20%s',_0x2f46e8,'request\x20sent');logger[_0x0baf('0x14')](_0x0baf('0x15'),_0x2f46e8,_0x0baf('0x16'),JSON[_0x0baf('0x17')](_0x1d60a2));if(_0x1d60a2['error']){if(_0x1d60a2[_0x0baf('0x18')]['code']===0x1f4){logger[_0x0baf('0x18')](_0x0baf('0x19'),_0x2f46e8,_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);return _0x41cead(_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x2f46e8,_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);return _0xf4c8ac(_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);}else{logger[_0x0baf('0x13')](_0x0baf('0x19'),_0x2f46e8,'request\x20sent');_0xf4c8ac(_0x1d60a2[_0x0baf('0x1b')][_0x0baf('0x1a')]);}})[_0x0baf('0x1c')](function(_0x3e9cb4){logger[_0x0baf('0x18')](_0x0baf('0x19'),_0x2f46e8,_0x3e9cb4);_0x41cead(_0x3e9cb4);});});}exports['CreateMailMessage']=function(_0x5cff5d){var _0x1410ec=this;return new Promise(function(_0x154f48,_0x32e839){return db[_0x0baf('0x1d')][_0x0baf('0x1e')](_0x5cff5d[_0x0baf('0x1f')],{'raw':_0x5cff5d[_0x0baf('0x20')]?_0x5cff5d[_0x0baf('0x20')][_0x0baf('0x21')]===undefined?!![]:![]:!![]})[_0x0baf('0x12')](function(_0x54f2fa){logger[_0x0baf('0x13')]('CreateMailMessage',_0x5cff5d);logger[_0x0baf('0x14')]('CreateMailMessage',_0x5cff5d,JSON['stringify'](_0x54f2fa));_0x154f48(_0x54f2fa);})[_0x0baf('0x1c')](function(_0x48a0e9){logger['error'](_0x0baf('0x22'),_0x48a0e9[_0x0baf('0x1a')],_0x5cff5d);_0x32e839(_0x1410ec[_0x0baf('0x18')](0x1f4,_0x48a0e9[_0x0baf('0x1a')]));});});}; \ No newline at end of file +var _0x4991=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','then','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','MailMessage,\x20%s,\x20%s','info','result','MailMessage','create','body','options','raw','CreateMailMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5c7510,_0xbb110){var _0x549cdf=function(_0x431b10){while(--_0x431b10){_0x5c7510['push'](_0x5c7510['shift']());}};_0x549cdf(++_0xbb110);}(_0x4991,0xf7));var _0x1499=function(_0x3848ff,_0x11fce2){_0x3848ff=_0x3848ff-0x0;var _0x26fcaa=_0x4991[_0x3848ff];return _0x26fcaa;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var moment=require(_0x1499('0x1'));var BPromise=require('bluebird');var rs=require(_0x1499('0x2'));var fs=require('fs');var Redis=require(_0x1499('0x3'));var db=require(_0x1499('0x4'))['db'];var utils=require(_0x1499('0x5'));var logger=require(_0x1499('0x6'))(_0x1499('0x7'));var config=require(_0x1499('0x8'));var jayson=require(_0x1499('0x9'));var client=jayson['client'][_0x1499('0xa')]({'port':0x232a});config[_0x1499('0xb')]=_[_0x1499('0xc')](config[_0x1499('0xb')],{'host':_0x1499('0xd'),'port':0x18eb});var socket=require(_0x1499('0xe'))(new Redis(config[_0x1499('0xb')]));require(_0x1499('0xf'))['register'](socket);function respondWithRpcPromise(_0x16e8ad,_0x36a053,_0x575251){return new BPromise(function(_0x2a4816,_0x352180){return client['request'](_0x16e8ad,_0x575251)[_0x1499('0x10')](function(_0x2867b1){logger['info']('MailMessage,\x20%s,\x20%s',_0x36a053,'request\x20sent');logger[_0x1499('0x11')](_0x1499('0x12'),_0x36a053,_0x1499('0x13'),JSON[_0x1499('0x14')](_0x2867b1));if(_0x2867b1[_0x1499('0x15')]){if(_0x2867b1['error']['code']===0x1f4){logger[_0x1499('0x15')]('MailMessage,\x20%s,\x20%s',_0x36a053,_0x2867b1[_0x1499('0x15')][_0x1499('0x16')]);return _0x352180(_0x2867b1[_0x1499('0x15')][_0x1499('0x16')]);}logger['error'](_0x1499('0x17'),_0x36a053,_0x2867b1[_0x1499('0x15')]['message']);return _0x2a4816(_0x2867b1[_0x1499('0x15')][_0x1499('0x16')]);}else{logger[_0x1499('0x18')](_0x1499('0x17'),_0x36a053,_0x1499('0x13'));_0x2a4816(_0x2867b1[_0x1499('0x19')]['message']);}})['catch'](function(_0x5bcb5f){logger[_0x1499('0x15')](_0x1499('0x17'),_0x36a053,_0x5bcb5f);_0x352180(_0x5bcb5f);});});}exports['CreateMailMessage']=function(_0x351da9){var _0x3c13a1=this;return new Promise(function(_0x28dff3,_0x18e4a6){return db[_0x1499('0x1a')][_0x1499('0x1b')](_0x351da9[_0x1499('0x1c')],{'raw':_0x351da9[_0x1499('0x1d')]?_0x351da9[_0x1499('0x1d')][_0x1499('0x1e')]===undefined?!![]:![]:!![]})[_0x1499('0x10')](function(_0x836081){logger[_0x1499('0x18')](_0x1499('0x1f'),_0x351da9);logger[_0x1499('0x11')](_0x1499('0x1f'),_0x351da9,JSON[_0x1499('0x14')](_0x836081));_0x28dff3(_0x836081);})['catch'](function(_0x258e9c){logger[_0x1499('0x15')](_0x1499('0x1f'),_0x258e9c[_0x1499('0x16')],_0x351da9);_0x18e4a6(_0x3c13a1[_0x1499('0x15')](0x1f4,_0x258e9c[_0x1499('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 445be08..3241d85 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 _0xd6b2=['save','update','emit','removeListener','register','length','mailMessage:','./mailMessage.events'];(function(_0x35d504,_0x2a0647){var _0x2cbb2d=function(_0x541503){while(--_0x541503){_0x35d504['push'](_0x35d504['shift']());}};_0x2cbb2d(++_0x2a0647);}(_0xd6b2,0x18f));var _0x2d6b=function(_0x5d8aec,_0x2603e6){_0x5d8aec=_0x5d8aec-0x0;var _0x741fa4=_0xd6b2[_0x5d8aec];return _0x741fa4;};'use strict';var MailMessageEvents=require(_0x2d6b('0x0'));var events=[_0x2d6b('0x1'),'remove',_0x2d6b('0x2')];function createListener(_0x5424ef,_0x332b14){return function(_0x263b62){_0x332b14[_0x2d6b('0x3')](_0x5424ef,_0x263b62);};}function removeListener(_0x23ff49,_0x2e6871){return function(){MailMessageEvents[_0x2d6b('0x4')](_0x23ff49,_0x2e6871);};}exports[_0x2d6b('0x5')]=function(_0x28bd9c){for(var _0x3ec9eb=0x0,_0x47e2ce=events[_0x2d6b('0x6')];_0x3ec9eb<_0x47e2ce;_0x3ec9eb++){var _0x394858=events[_0x3ec9eb];var _0x1ffded=createListener(_0x2d6b('0x7')+_0x394858,_0x28bd9c);MailMessageEvents['on'](_0x394858,_0x1ffded);}}; \ No newline at end of file +var _0x5a8b=['length','save','remove','update','removeListener','register'];(function(_0x4bb145,_0x3e7d33){var _0x4db596=function(_0x144489){while(--_0x144489){_0x4bb145['push'](_0x4bb145['shift']());}};_0x4db596(++_0x3e7d33);}(_0x5a8b,0x103));var _0xb5a8=function(_0x174e2c,_0x80146a){_0x174e2c=_0x174e2c-0x0;var _0x1d6c80=_0x5a8b[_0x174e2c];return _0x1d6c80;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xb5a8('0x0'),_0xb5a8('0x1'),_0xb5a8('0x2')];function createListener(_0x2fdb22,_0x1d8cb4){return function(_0x1d0613){_0x1d8cb4['emit'](_0x2fdb22,_0x1d0613);};}function removeListener(_0x4aca12,_0x3ebf25){return function(){MailMessageEvents[_0xb5a8('0x3')](_0x4aca12,_0x3ebf25);};}exports[_0xb5a8('0x4')]=function(_0x7acf58){for(var _0x36de42=0x0,_0x554424=events[_0xb5a8('0x5')];_0x36de42<_0x554424;_0x36de42++){var _0x2db2cd=events[_0x36de42];var _0x86b612=createListener('mailMessage:'+_0x2db2cd,_0x7acf58);MailMessageEvents['on'](_0x2db2cd,_0x86b612);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index d1c6194..6a03b18 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 _0x8ac1=['isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','put','/:id','update','destroy','removeTeams','delete','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get'];(function(_0x5d22d0,_0x33ca97){var _0x4daca4=function(_0x21151d){while(--_0x21151d){_0x5d22d0['push'](_0x5d22d0['shift']());}};_0x4daca4(++_0x33ca97);}(_0x8ac1,0xfc));var _0x18ac=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8ac1[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x18ac('0x0'));var util=require(_0x18ac('0x1'));var path=require(_0x18ac('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x18ac('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x18ac('0x4'));var interaction=require(_0x18ac('0x5'));var config=require(_0x18ac('0x6'));var controller=require(_0x18ac('0x7'));router[_0x18ac('0x8')]('/',auth[_0x18ac('0x9')](),controller[_0x18ac('0xa')]);router['get'](_0x18ac('0xb'),auth['isAuthenticated'](),controller[_0x18ac('0xc')]);router[_0x18ac('0x8')]('/:id',auth[_0x18ac('0x9')](),controller[_0x18ac('0xd')]);router[_0x18ac('0x8')](_0x18ac('0xe'),auth[_0x18ac('0x9')](),controller[_0x18ac('0xf')]);router[_0x18ac('0x8')](_0x18ac('0x10'),auth[_0x18ac('0x9')](),controller['getTeams']);router[_0x18ac('0x8')](_0x18ac('0x11'),auth['isAuthenticated'](),controller[_0x18ac('0x12')]);router[_0x18ac('0x13')]('/',auth['isAuthenticated'](),controller[_0x18ac('0x14')]);router[_0x18ac('0x13')](_0x18ac('0x10'),auth['isAuthenticated'](),controller['addTeams']);router[_0x18ac('0x13')](_0x18ac('0x11'),auth[_0x18ac('0x9')](),controller['addAgents']);router[_0x18ac('0x15')](_0x18ac('0x16'),auth[_0x18ac('0x9')](),controller[_0x18ac('0x17')]);router['delete'](_0x18ac('0x16'),auth[_0x18ac('0x9')](),controller[_0x18ac('0x18')]);router['delete'](_0x18ac('0x10'),auth[_0x18ac('0x9')](),controller[_0x18ac('0x19')]);router[_0x18ac('0x1a')]('/:id/users',auth[_0x18ac('0x9')](),controller[_0x18ac('0x1b')]);module[_0x18ac('0x1c')]=router; \ No newline at end of file +var _0x520c=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./mailQueue.controller','isAuthenticated','index','get','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put'];(function(_0xa5a43c,_0x3ca368){var _0x217ce0=function(_0x1dd15f){while(--_0x1dd15f){_0xa5a43c['push'](_0xa5a43c['shift']());}};_0x217ce0(++_0x3ca368);}(_0x520c,0x1d6));var _0xc520=function(_0x24392f,_0x15a3e5){_0x24392f=_0x24392f-0x0;var _0x591e33=_0x520c[_0x24392f];return _0x591e33;};'use strict';var multer=require(_0xc520('0x0'));var util=require(_0xc520('0x1'));var path=require('path');var timeout=require(_0xc520('0x2'));var express=require(_0xc520('0x3'));var router=express[_0xc520('0x4')]();var fs_extra=require(_0xc520('0x5'));var auth=require(_0xc520('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc520('0x7'));router['get']('/',auth[_0xc520('0x8')](),controller[_0xc520('0x9')]);router[_0xc520('0xa')]('/describe',auth[_0xc520('0x8')](),controller[_0xc520('0xb')]);router[_0xc520('0xa')](_0xc520('0xc'),auth[_0xc520('0x8')](),controller[_0xc520('0xd')]);router[_0xc520('0xa')](_0xc520('0xe'),auth[_0xc520('0x8')](),controller[_0xc520('0xf')]);router[_0xc520('0xa')](_0xc520('0x10'),auth[_0xc520('0x8')](),controller[_0xc520('0x11')]);router[_0xc520('0xa')](_0xc520('0x12'),auth[_0xc520('0x8')](),controller[_0xc520('0x13')]);router[_0xc520('0x14')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xc520('0x10'),auth[_0xc520('0x8')](),controller['addTeams']);router['post']('/:id/users',auth[_0xc520('0x8')](),controller[_0xc520('0x15')]);router[_0xc520('0x16')](_0xc520('0xc'),auth[_0xc520('0x8')](),controller[_0xc520('0x17')]);router[_0xc520('0x18')]('/:id',auth[_0xc520('0x8')](),controller[_0xc520('0x19')]);router[_0xc520('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0xc520('0x1a')]);router[_0xc520('0x18')](_0xc520('0x12'),auth[_0xc520('0x8')](),controller[_0xc520('0x1b')]);module[_0xc520('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 49e50dd..a5e1099 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 _0xc22e=['sequelize','exports','name','rrmemory','beepall','roundrobin'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xc22e,0x168));var _0xec22=function(_0x502c57,_0x3c3006){_0x502c57=_0x502c57-0x0;var _0x13ecd7=_0xc22e[_0x502c57];return _0x13ecd7;};'use strict';var Sequelize=require(_0xec22('0x0'));module[_0xec22('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xec22('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xec22('0x3'),_0xec22('0x4'),_0xec22('0x5'))}}; \ No newline at end of file +var _0xdead=['roundrobin','sequelize','exports','STRING','name','rrmemory','beepall'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xdead,0x1eb));var _0xddea=function(_0x3a966d,_0x3646e1){_0x3a966d=_0x3a966d-0x0;var _0x347523=_0xdead[_0x3a966d];return _0x347523;};'use strict';var Sequelize=require(_0xddea('0x0'));module[_0xddea('0x1')]={'name':{'type':Sequelize[_0xddea('0x2')],'unique':_0xddea('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xddea('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xddea('0x4'),_0xddea('0x5'),_0xddea('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 5c14350..154c9ac 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 _0xf78d=['tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','limit','undefined','count','offset','set','reject','save','update','then','get','MailQueues','UserProfileResource','destroy','error','stack','name','send','index','map','MailQueue','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','params','keys','rawAttributes','find','create','body','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','UserMailQueue','order','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','format','%s/%s','createdAt','Team','getTeams','addTeams','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','removeTeams','ids','Agents','select','field'];(function(_0x41759e,_0x314ca9){var _0x263812=function(_0x1cbf3f){while(--_0x1cbf3f){_0x41759e['push'](_0x41759e['shift']());}};_0x263812(++_0x314ca9);}(_0xf78d,0x1c7));var _0xdf78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf78d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf78('0x0'));var zipdir=require(_0xdf78('0x1'));var jsonpatch=require(_0xdf78('0x2'));var rp=require(_0xdf78('0x3'));var moment=require(_0xdf78('0x4'));var BPromise=require(_0xdf78('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdf78('0x6'));var sox=require(_0xdf78('0x7'));var csv=require(_0xdf78('0x8'));var ejs=require(_0xdf78('0x9'));var fs=require('fs');var fs_extra=require(_0xdf78('0xa'));var _=require(_0xdf78('0xb'));var squel=require(_0xdf78('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdf78('0xd'));var toCsv=require(_0xdf78('0x8'));var querystring=require('querystring');var Papa=require(_0xdf78('0xe'));var Redis=require(_0xdf78('0xf'));var authService=require(_0xdf78('0x10'));var qs=require(_0xdf78('0x11'));var as=require(_0xdf78('0x12'));var hardwareService=require(_0xdf78('0x13'));var logger=require(_0xdf78('0x14'))(_0xdf78('0x15'));var utils=require(_0xdf78('0x16'));var config=require(_0xdf78('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdf78('0x18'))['db'];config['redis']=_[_0xdf78('0x19')](config[_0xdf78('0x1a')],{'host':_0xdf78('0x1b'),'port':0x18eb});var socket=require(_0xdf78('0x1c'))(new Redis(config[_0xdf78('0x1a')]));require(_0xdf78('0x1d'))['register'](socket);function respondWithStatusCode(_0x4d572d,_0xdf4520){_0xdf4520=_0xdf4520||0xcc;return function(_0x29fd13){if(_0x29fd13){return _0x4d572d[_0xdf78('0x1e')](_0xdf4520);}return _0x4d572d[_0xdf78('0x1f')](_0xdf4520)[_0xdf78('0x20')]();};}function respondWithResult(_0x1a6afb,_0x517364){_0x517364=_0x517364||0xc8;return function(_0x15abb7){if(_0x15abb7){return _0x1a6afb[_0xdf78('0x1f')](_0x517364)[_0xdf78('0x21')](_0x15abb7);}};}function respondWithFilteredResult(_0x11dc81,_0x3bc83e){return function(_0x9f719b){if(_0x9f719b){var _0x518dac=typeof _0x3bc83e['offset']==='undefined'&&typeof _0x3bc83e[_0xdf78('0x22')]===_0xdf78('0x23');var _0x2a869b=_0x9f719b[_0xdf78('0x24')];var _0x764b9f=_0x518dac?0x0:_0x3bc83e['offset'];var _0x46b482=_0x518dac?_0x9f719b[_0xdf78('0x24')]:_0x3bc83e[_0xdf78('0x25')]+_0x3bc83e[_0xdf78('0x22')];var _0x5b40b3;if(_0x46b482>=_0x2a869b){_0x46b482=_0x2a869b;_0x5b40b3=0xc8;}else{_0x5b40b3=0xce;}_0x11dc81[_0xdf78('0x1f')](_0x5b40b3);return _0x11dc81[_0xdf78('0x26')]('Content-Range',_0x764b9f+'-'+_0x46b482+'/'+_0x2a869b)['json'](_0x9f719b);}return null;};}function patchUpdates(_0x3e6e9a){return function(_0x1c1c77){try{jsonpatch['apply'](_0x1c1c77,_0x3e6e9a,!![]);}catch(_0x1ae1f8){return BPromise[_0xdf78('0x27')](_0x1ae1f8);}return _0x1c1c77[_0xdf78('0x28')]();};}function saveUpdates(_0x109bb3,_0x45cbe6){return function(_0x44b69a){if(_0x44b69a){return _0x44b69a[_0xdf78('0x29')](_0x109bb3)['then'](function(_0x23c13e){return _0x23c13e;});}return null;};}function removeEntity(_0x30a217,_0x357ac7){return function(_0xd287e2){if(_0xd287e2){return _0xd287e2['destroy']()[_0xdf78('0x2a')](function(){var _0x2bf8bf=_0xd287e2[_0xdf78('0x2b')]({'plain':!![]});var _0x4bea0e=_0xdf78('0x2c');return db[_0xdf78('0x2d')][_0xdf78('0x2e')]({'where':{'type':_0x4bea0e,'resourceId':_0x2bf8bf['id']}})['then'](function(){return _0xd287e2;});})[_0xdf78('0x2a')](function(){_0x30a217[_0xdf78('0x1f')](0xcc)[_0xdf78('0x20')]();});}};}function handleEntityNotFound(_0x5c49f8,_0x3166ae){return function(_0xe43c11){if(!_0xe43c11){_0x5c49f8[_0xdf78('0x1e')](0x194);}return _0xe43c11;};}function handleError(_0x1c72f0,_0x4593fa){_0x4593fa=_0x4593fa||0x1f4;return function(_0x477a0a){logger[_0xdf78('0x2f')](_0x477a0a[_0xdf78('0x30')]);if(_0x477a0a[_0xdf78('0x31')]){delete _0x477a0a[_0xdf78('0x31')];}_0x1c72f0[_0xdf78('0x1f')](_0x4593fa)[_0xdf78('0x32')](_0x477a0a);};}exports[_0xdf78('0x33')]=function(_0x162a6f,_0x586115){var _0x537db9={},_0x4a9336={},_0x26965d={'count':0x0,'rows':[]};var _0x36f4f4=_[_0xdf78('0x34')](db[_0xdf78('0x35')]['rawAttributes'],function(_0x5b12e6){return{'name':_0x5b12e6['fieldName'],'type':_0x5b12e6['type'][_0xdf78('0x36')]};});_0x4a9336[_0xdf78('0x37')]=_[_0xdf78('0x34')](_0x36f4f4,_0xdf78('0x31'));_0x4a9336[_0xdf78('0x38')]=_['keys'](_0x162a6f[_0xdf78('0x38')]);_0x4a9336[_0xdf78('0x39')]=_[_0xdf78('0x3a')](_0x4a9336[_0xdf78('0x37')],_0x4a9336[_0xdf78('0x38')]);_0x537db9[_0xdf78('0x3b')]=_[_0xdf78('0x3a')](_0x4a9336[_0xdf78('0x37')],qs[_0xdf78('0x3c')](_0x162a6f[_0xdf78('0x38')][_0xdf78('0x3c')]));_0x537db9[_0xdf78('0x3b')]=_0x537db9['attributes'][_0xdf78('0x3d')]?_0x537db9[_0xdf78('0x3b')]:_0x4a9336[_0xdf78('0x37')];if(!_0x162a6f[_0xdf78('0x38')][_0xdf78('0x3e')]('nolimit')){_0x537db9['limit']=qs[_0xdf78('0x22')](_0x162a6f[_0xdf78('0x38')][_0xdf78('0x22')]);_0x537db9[_0xdf78('0x25')]=qs[_0xdf78('0x25')](_0x162a6f[_0xdf78('0x38')][_0xdf78('0x25')]);}_0x537db9['order']=qs[_0xdf78('0x3f')](_0x162a6f[_0xdf78('0x38')][_0xdf78('0x3f')]);_0x537db9[_0xdf78('0x40')]=qs[_0xdf78('0x39')](_[_0xdf78('0x41')](_0x162a6f[_0xdf78('0x38')],_0x4a9336['filters']),_0x36f4f4);if(_0x162a6f[_0xdf78('0x38')][_0xdf78('0x42')]){_0x537db9[_0xdf78('0x40')]=_['merge'](_0x537db9['where'],{'$or':_[_0xdf78('0x34')](_0x36f4f4,function(_0x5ae60a){if(_0x5ae60a[_0xdf78('0x43')]!==_0xdf78('0x44')){var _0x1a44a3={};_0x1a44a3[_0x5ae60a[_0xdf78('0x31')]]={'$like':'%'+_0x162a6f[_0xdf78('0x38')]['filter']+'%'};return _0x1a44a3;}})});}_0x537db9=_[_0xdf78('0x45')]({},_0x537db9,_0x162a6f[_0xdf78('0x46')]);var _0x423dde={'where':_0x537db9[_0xdf78('0x40')]};return db[_0xdf78('0x35')]['count'](_0x423dde)[_0xdf78('0x2a')](function(_0x44a03a){_0x26965d[_0xdf78('0x24')]=_0x44a03a;if(_0x162a6f[_0xdf78('0x38')]['includeAll']){_0x537db9[_0xdf78('0x47')]=[{'all':!![]}];}return db[_0xdf78('0x35')][_0xdf78('0x48')](_0x537db9);})[_0xdf78('0x2a')](function(_0x1da3d6){_0x26965d[_0xdf78('0x49')]=_0x1da3d6;return _0x26965d;})['then'](respondWithFilteredResult(_0x586115,_0x537db9))[_0xdf78('0x4a')](handleError(_0x586115,null));};exports['show']=function(_0x538519,_0x5556ba){var _0xb937dd={'raw':!![],'where':{'id':_0x538519[_0xdf78('0x4b')]['id']}},_0x5b7edc={};_0x5b7edc[_0xdf78('0x37')]=_[_0xdf78('0x4c')](db[_0xdf78('0x35')][_0xdf78('0x4d')]);_0x5b7edc[_0xdf78('0x38')]=_[_0xdf78('0x4c')](_0x538519[_0xdf78('0x38')]);_0x5b7edc[_0xdf78('0x39')]=_[_0xdf78('0x3a')](_0x5b7edc['model'],_0x5b7edc[_0xdf78('0x38')]);_0xb937dd[_0xdf78('0x3b')]=_[_0xdf78('0x3a')](_0x5b7edc[_0xdf78('0x37')],qs[_0xdf78('0x3c')](_0x538519[_0xdf78('0x38')][_0xdf78('0x3c')]));_0xb937dd[_0xdf78('0x3b')]=_0xb937dd[_0xdf78('0x3b')][_0xdf78('0x3d')]?_0xb937dd['attributes']:_0x5b7edc[_0xdf78('0x37')];if(_0x538519[_0xdf78('0x38')]['includeAll']){_0xb937dd[_0xdf78('0x47')]=[{'all':!![]}];}_0xb937dd=_[_0xdf78('0x45')]({},_0xb937dd,_0x538519[_0xdf78('0x46')]);return db[_0xdf78('0x35')][_0xdf78('0x4e')](_0xb937dd)['then'](handleEntityNotFound(_0x5556ba,null))['then'](respondWithResult(_0x5556ba,null))[_0xdf78('0x4a')](handleError(_0x5556ba,null));};exports[_0xdf78('0x4f')]=function(_0x56218e,_0x3023b0){return db[_0xdf78('0x35')][_0xdf78('0x4f')](_0x56218e[_0xdf78('0x50')],{})[_0xdf78('0x2a')](function(_0x29f21d){var _0xc71a68=_0x56218e['user'][_0xdf78('0x2b')]({'plain':!![]});if(!_0xc71a68)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc71a68[_0xdf78('0x51')]==='user'){var _0x32b1b7=_0x29f21d[_0xdf78('0x2b')]({'plain':!![]});var _0x168920=_0xdf78('0x2c');return db[_0xdf78('0x52')][_0xdf78('0x4e')]({'where':{'name':_0x168920,'userProfileId':_0xc71a68[_0xdf78('0x53')]},'raw':!![]})[_0xdf78('0x2a')](function(_0x58d756){if(_0x58d756&&_0x58d756[_0xdf78('0x54')]===0x0){return db['UserProfileResource'][_0xdf78('0x4f')]({'name':_0x32b1b7['name'],'resourceId':_0x32b1b7['id'],'type':_0x58d756[_0xdf78('0x31')],'sectionId':_0x58d756['id']},{})[_0xdf78('0x2a')](function(){return _0x29f21d;});}else{return _0x29f21d;}})['catch'](function(_0x251c98){logger[_0xdf78('0x2f')](_0xdf78('0x55'),_0x251c98);throw _0x251c98;});}return _0x29f21d;})[_0xdf78('0x2a')](respondWithResult(_0x3023b0,0xc9))['catch'](handleError(_0x3023b0,null));};exports['update']=function(_0x73e26f,_0x59b66b){if(_0x73e26f[_0xdf78('0x50')]['id']){delete _0x73e26f[_0xdf78('0x50')]['id'];}return db[_0xdf78('0x35')][_0xdf78('0x4e')]({'where':{'id':_0x73e26f['params']['id']}})[_0xdf78('0x2a')](handleEntityNotFound(_0x59b66b,null))['then'](saveUpdates(_0x73e26f[_0xdf78('0x50')],null))[_0xdf78('0x2a')](respondWithResult(_0x59b66b,null))[_0xdf78('0x4a')](handleError(_0x59b66b,null));};exports[_0xdf78('0x2e')]=function(_0x37ccc2,_0x57e75b){return db[_0xdf78('0x35')][_0xdf78('0x4e')]({'where':{'id':_0x37ccc2[_0xdf78('0x4b')]['id']}})[_0xdf78('0x2a')](handleEntityNotFound(_0x57e75b,null))[_0xdf78('0x2a')](removeEntity(_0x57e75b,null))['catch'](handleError(_0x57e75b,null));};exports['describe']=function(_0x608031,_0x540bb4){return db[_0xdf78('0x35')]['describe']()[_0xdf78('0x2a')](respondWithResult(_0x540bb4,null))[_0xdf78('0x4a')](handleError(_0x540bb4,null));};exports[_0xdf78('0x56')]=function(_0x633608,_0x1f69fb,_0x18fb54){var _0x10fa72={'raw':!![],'where':{}},_0x126b73={},_0x133d53;return db[_0xdf78('0x35')][_0xdf78('0x57')]({'where':{'id':_0x633608['params']['id']}})[_0xdf78('0x2a')](handleEntityNotFound(_0x1f69fb,null))[_0xdf78('0x2a')](function(_0x121f49){if(_0x121f49){_0x133d53=_0x121f49['get']({'plain':!![]});_0x126b73[_0xdf78('0x37')]=_[_0xdf78('0x4c')](db[_0xdf78('0x58')][_0xdf78('0x4d')]);_0x126b73[_0xdf78('0x38')]=_[_0xdf78('0x4c')](_0x633608['query']);_0x126b73[_0xdf78('0x39')]=_[_0xdf78('0x3a')](_0x126b73[_0xdf78('0x37')],_0x126b73[_0xdf78('0x38')]);_0x10fa72['attributes']=_['intersection'](_0x126b73[_0xdf78('0x37')],qs[_0xdf78('0x3c')](_0x633608[_0xdf78('0x38')][_0xdf78('0x3c')]));_0x10fa72['attributes']=_0x10fa72[_0xdf78('0x3b')][_0xdf78('0x3d')]?_0x10fa72[_0xdf78('0x3b')]:_0x126b73[_0xdf78('0x37')];if(!_0x633608['query'][_0xdf78('0x3e')]('nolimit')){_0x10fa72[_0xdf78('0x22')]=qs[_0xdf78('0x22')](_0x633608[_0xdf78('0x38')][_0xdf78('0x22')]);_0x10fa72[_0xdf78('0x25')]=qs[_0xdf78('0x25')](_0x633608[_0xdf78('0x38')]['offset']);}_0x10fa72[_0xdf78('0x59')]=qs[_0xdf78('0x3f')](_0x633608[_0xdf78('0x38')]['sort']);_0x10fa72[_0xdf78('0x40')]=qs[_0xdf78('0x39')](_[_0xdf78('0x41')](_0x633608[_0xdf78('0x38')],_0x126b73[_0xdf78('0x39')]));_0x10fa72['where'][_0xdf78('0x5a')]=_0x121f49['id'];if(_0x633608[_0xdf78('0x38')][_0xdf78('0x42')]){_0x10fa72[_0xdf78('0x40')]=_['merge'](_0x10fa72['where'],{'$or':_['map'](_0x10fa72[_0xdf78('0x3b')],function(_0x1a1b9a){var _0xeef722={};_0xeef722[_0x1a1b9a]={'$like':'%'+_0x633608[_0xdf78('0x38')]['filter']+'%'};return _0xeef722;})});}_0x10fa72=_[_0xdf78('0x45')]({},_0x10fa72,_0x633608[_0xdf78('0x46')]);return db[_0xdf78('0x58')][_0xdf78('0x48')](_0x10fa72);}})[_0xdf78('0x2a')](function(_0x4c3bc8){if(_0x4c3bc8){return db[_0xdf78('0x5b')][_0xdf78('0x5c')]({'where':{'id':_[_0xdf78('0x34')](_0x4c3bc8,_0xdf78('0x5d')),'role':_0xdf78('0x5e')},'attributes':['id',_0xdf78('0x31'),_0xdf78('0x5f'),_0xdf78('0x60'),'createdAt']});}})[_0xdf78('0x2a')](function(_0x33f979){if(_0x33f979){return{'count':_0x33f979[_0xdf78('0x24')],'rows':_[_0xdf78('0x34')](_0x33f979[_0xdf78('0x49')],function(_0x135b45){return{'membername':_0x135b45[_0xdf78('0x31')],'UserId':_0x135b45['id'],'queue_name':_0x133d53['name'],'MailQueueId':_0x133d53['id'],'interface':util[_0xdf78('0x61')](_0xdf78('0x62'),'SIP',_0x135b45[_0xdf78('0x31')]),'penalty':0x0,'paused':_0x135b45[_0xdf78('0x5f')],'createdAt':_0x135b45[_0xdf78('0x63')],'updatedAt':_0x135b45[_0xdf78('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdf78('0x2a')](respondWithFilteredResult(_0x1f69fb,_0x10fa72))[_0xdf78('0x4a')](handleError(_0x1f69fb,null));};exports['getTeams']=function(_0x7b6a30,_0x543f0c,_0x433cc3){var _0x16fe59={};var _0x3f8242={};var _0x256977;var _0x2cdd77;return db[_0xdf78('0x35')][_0xdf78('0x57')]({'where':{'id':_0x7b6a30['params']['id']}})[_0xdf78('0x2a')](handleEntityNotFound(_0x543f0c,null))[_0xdf78('0x2a')](function(_0x1a82a8){if(_0x1a82a8){_0x256977=_0x1a82a8;_0x3f8242['model']=_[_0xdf78('0x4c')](db[_0xdf78('0x64')][_0xdf78('0x4d')]);_0x3f8242['query']=_[_0xdf78('0x4c')](_0x7b6a30[_0xdf78('0x38')]);_0x3f8242[_0xdf78('0x39')]=_[_0xdf78('0x3a')](_0x3f8242[_0xdf78('0x37')],_0x3f8242[_0xdf78('0x38')]);_0x16fe59[_0xdf78('0x3b')]=_[_0xdf78('0x3a')](_0x3f8242[_0xdf78('0x37')],qs['fields'](_0x7b6a30[_0xdf78('0x38')][_0xdf78('0x3c')]));_0x16fe59[_0xdf78('0x3b')]=_0x16fe59[_0xdf78('0x3b')][_0xdf78('0x3d')]?_0x16fe59[_0xdf78('0x3b')]:_0x3f8242['model'];_0x16fe59['order']=qs[_0xdf78('0x3f')](_0x7b6a30['query'][_0xdf78('0x3f')]);_0x16fe59[_0xdf78('0x40')]=qs[_0xdf78('0x39')](_[_0xdf78('0x41')](_0x7b6a30[_0xdf78('0x38')],_0x3f8242[_0xdf78('0x39')]));if(_0x7b6a30[_0xdf78('0x38')][_0xdf78('0x42')]){_0x16fe59[_0xdf78('0x40')]=_['merge'](_0x16fe59[_0xdf78('0x40')],{'$or':_[_0xdf78('0x34')](_0x16fe59['attributes'],function(_0x17bead){var _0x332679={};_0x332679[_0x17bead]={'$like':'%'+_0x7b6a30[_0xdf78('0x38')][_0xdf78('0x42')]+'%'};return _0x332679;})});}_0x16fe59=_[_0xdf78('0x45')]({},_0x16fe59,_0x7b6a30[_0xdf78('0x46')]);return _0x256977[_0xdf78('0x65')](_0x16fe59);}})[_0xdf78('0x2a')](function(_0x4dbad7){if(_0x4dbad7){_0x2cdd77=_0x4dbad7[_0xdf78('0x3d')];if(!_0x7b6a30[_0xdf78('0x38')][_0xdf78('0x3e')]('nolimit')){_0x16fe59[_0xdf78('0x22')]=qs[_0xdf78('0x22')](_0x7b6a30[_0xdf78('0x38')]['limit']);_0x16fe59[_0xdf78('0x25')]=qs[_0xdf78('0x25')](_0x7b6a30[_0xdf78('0x38')][_0xdf78('0x25')]);}return _0x256977[_0xdf78('0x65')](_0x16fe59);}})[_0xdf78('0x2a')](function(_0x42bb26){if(_0x42bb26){return _0x42bb26?{'count':_0x2cdd77,'rows':_0x42bb26}:null;}})[_0xdf78('0x2a')](respondWithResult(_0x543f0c,null))[_0xdf78('0x4a')](handleError(_0x543f0c,null));};exports[_0xdf78('0x66')]=function(_0x56dd31,_0x17d1d4,_0x445d1a){var _0x2afcd0=_0x56dd31['body']['ids'];return db['Team']['findAll']({'where':{'id':_0x2afcd0},'attributes':['id'],'include':[{'model':db[_0xdf78('0x5b')],'as':'Agents','attributes':['id',_0xdf78('0x31'),_0xdf78('0x67'),_0xdf78('0x68'),_0xdf78('0x69')],'raw':!![]}]})[_0xdf78('0x2a')](function(_0x39d193){if(_0x39d193){var _0x3c0a5c=_[_0xdf78('0x6a')](_0x39d193,function(_0x4b8c77){var _0x226aea=_0x4b8c77[_0xdf78('0x2b')]({'plain':!![]});return _0x226aea['Agents'];});return db[_0xdf78('0x35')]['find']({'where':{'id':_0x56dd31[_0xdf78('0x4b')]['id']}})[_0xdf78('0x2a')](function(_0x44fa1f){return db[_0xdf78('0x6b')][_0xdf78('0x6c')](function(_0x23368c){return _0x44fa1f[_0xdf78('0x66')](_0x2afcd0,{'transaction':_0x23368c})[_0xdf78('0x2a')](function(){return BPromise[_0xdf78('0x6d')](_0x3c0a5c,function(_0x1ce2f1){return db[_0xdf78('0x58')][_0xdf78('0x6e')]({'where':{'UserId':_0x1ce2f1['id'],'MailQueueId':_0x56dd31[_0xdf78('0x4b')]['id']},'transaction':_0x23368c});});})['then'](function(){_0x3c0a5c[_0xdf78('0x6f')](function(_0x16bc7f){socket['emit']('userMailQueue:save',{'UserId':_0x16bc7f['id'],'MailQueueId':_0x44fa1f['id']});});});});});}})[_0xdf78('0x2a')](respondWithStatusCode(_0x17d1d4,null))['catch'](handleError(_0x17d1d4,null));};exports[_0xdf78('0x70')]=function(_0x2965a2,_0xb2958a,_0x135219){return db[_0xdf78('0x64')][_0xdf78('0x48')]({'where':{'id':_0x2965a2[_0xdf78('0x38')][_0xdf78('0x71')]},'attributes':['id'],'include':[{'model':db[_0xdf78('0x5b')],'as':_0xdf78('0x72'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xb2958a,null))[_0xdf78('0x2a')](function(_0x1db9df){var _0xd98929=_[_0xdf78('0x34')](_0x1db9df,'id');var _0x4154f1=[];var _0x530ca6=[];var _0x273040=squel[_0xdf78('0x73')]();_0x273040[_0xdf78('0x74')](_0xdf78('0x75'))[_0xdf78('0x76')]('team_has_mail_queues','tq')[_0xdf78('0x77')](_0xdf78('0x78'),'ut',_0xdf78('0x79'))[_0xdf78('0x40')](_0xdf78('0x7a'),_0x2965a2[_0xdf78('0x4b')]['id']);for(var _0x1a335b=0x0;_0x1a335b<_0x1db9df[_0xdf78('0x3d')];_0x1a335b+=0x1){let _0x558ed4=_0x1db9df[_0x1a335b];for(var _0x540f53=0x0;_0x540f53<_0x558ed4[_0xdf78('0x72')][_0xdf78('0x3d')];_0x540f53+=0x1){let _0x5956d7=_0x558ed4[_0xdf78('0x72')][_0x540f53];var _0x5e65c=_0x273040[_0xdf78('0x7b')]();_0x5e65c['where'](_0xdf78('0x7c'),_0x5956d7['id']);_0x530ca6[_0xdf78('0x7d')](db[_0xdf78('0x6b')]['query'](_0x5e65c[_0xdf78('0x7e')](),{'type':db['sequelize'][_0xdf78('0x7f')][_0xdf78('0x80')]})[_0xdf78('0x2a')](function(_0x5d8db0){if(_0x5d8db0[_0xdf78('0x3d')]===0x1){return _0x5956d7['id'];}else{var _0x16af9c=_[_0xdf78('0x81')](_['map'](_0x5d8db0,_0xdf78('0x82')),function(_0x49da9e){return _[_0xdf78('0x83')](_0xd98929,_0x49da9e);});if(_0x16af9c){return _0x5956d7['id'];}}}));}}return BPromise[_0xdf78('0x84')](_0x530ca6)['then'](function(_0x10edc7){_0x4154f1=_(_0x4154f1)['union'](_0x10edc7)['compact']()[_0xdf78('0x85')]();return db['MailQueue']['find']({'where':{'id':_0x2965a2[_0xdf78('0x4b')]['id']}})['then'](function(_0x3607b4){return db[_0xdf78('0x6b')][_0xdf78('0x6c')](function(_0x39c2f4){return _0x3607b4[_0xdf78('0x70')](_0x2965a2[_0xdf78('0x38')][_0xdf78('0x71')],{'transaction':_0x39c2f4})[_0xdf78('0x2a')](function(){if(!_['isEmpty'](_0x4154f1)){return _0x3607b4[_0xdf78('0x86')](_0x4154f1,{'transaction':_0x39c2f4});}})[_0xdf78('0x2a')](function(){_0x4154f1[_0xdf78('0x6f')](function(_0x5e398a){socket[_0xdf78('0x87')](_0xdf78('0x88'),{'UserId':_0x5e398a,'MailQueueId':_0x3607b4['id']});});});});});});})[_0xdf78('0x2a')](respondWithStatusCode(_0xb2958a,null))[_0xdf78('0x4a')](handleError(_0xb2958a,null));};exports[_0xdf78('0x89')]=function(_0x264da5,_0x421d63,_0x3aadd6){return db[_0xdf78('0x35')][_0xdf78('0x4e')]({'where':{'id':_0x264da5[_0xdf78('0x4b')]['id']}})[_0xdf78('0x2a')](handleEntityNotFound(_0x421d63,null))[_0xdf78('0x2a')](function(_0x1edfc3){if(_0x1edfc3){return _0x1edfc3[_0xdf78('0x89')](_0x264da5[_0xdf78('0x50')][_0xdf78('0x71')],_[_0xdf78('0x8a')](_0x264da5[_0xdf78('0x50')],['ids','id'])||{})[_0xdf78('0x8b')](function(_0x5465fe){for(var _0x4e7c05=0x0;_0x4e7c05<_0x264da5[_0xdf78('0x50')][_0xdf78('0x71')][_0xdf78('0x3d')];_0x4e7c05+=0x1){socket[_0xdf78('0x87')](_0xdf78('0x8c'),{'UserId':Number(_0x264da5[_0xdf78('0x50')]['ids'][_0x4e7c05]),'MailQueueId':Number(_0x264da5[_0xdf78('0x4b')]['id'])});}return _0x5465fe;});}})[_0xdf78('0x2a')](respondWithResult(_0x421d63,null))[_0xdf78('0x4a')](handleError(_0x421d63,null));};exports[_0xdf78('0x86')]=function(_0x4a14cf,_0x1034a3,_0x560cee){return db[_0xdf78('0x35')][_0xdf78('0x4e')]({'where':{'id':_0x4a14cf['params']['id']}})[_0xdf78('0x2a')](handleEntityNotFound(_0x1034a3,null))[_0xdf78('0x2a')](function(_0x3bc00d){if(_0x3bc00d){return _0x3bc00d[_0xdf78('0x86')](_0x4a14cf[_0xdf78('0x38')][_0xdf78('0x71')])[_0xdf78('0x2a')](function(){if(_[_0xdf78('0x8d')](_0x4a14cf[_0xdf78('0x38')][_0xdf78('0x71')])){for(var _0xc974ec=0x0;_0xc974ec<_0x4a14cf[_0xdf78('0x38')][_0xdf78('0x71')][_0xdf78('0x3d')];_0xc974ec+=0x1){socket[_0xdf78('0x87')]('userMailQueue:remove',{'UserId':Number(_0x4a14cf[_0xdf78('0x38')][_0xdf78('0x71')][_0xc974ec]),'MailQueueId':Number(_0x4a14cf[_0xdf78('0x4b')]['id'])});}}else{socket[_0xdf78('0x87')]('userMailQueue:remove',{'UserId':Number(_0x4a14cf[_0xdf78('0x38')]['ids']),'MailQueueId':Number(_0x4a14cf[_0xdf78('0x4b')]['id'])});}});}})[_0xdf78('0x2a')](respondWithStatusCode(_0x1034a3,null))[_0xdf78('0x4a')](handleError(_0x1034a3,null));};exports[_0xdf78('0x8e')]=function(_0x56cda3,_0x85fa3d,_0x481be8){var _0x271358={};var _0x5a8259={};var _0xaeab11;var _0x724615;return db[_0xdf78('0x35')][_0xdf78('0x57')]({'where':{'id':_0x56cda3[_0xdf78('0x4b')]['id']}})[_0xdf78('0x2a')](handleEntityNotFound(_0x85fa3d,null))['then'](function(_0x167889){if(_0x167889){_0xaeab11=_0x167889;_0x5a8259['model']=_[_0xdf78('0x4c')](db[_0xdf78('0x5b')][_0xdf78('0x4d')]);_0x5a8259[_0xdf78('0x38')]=_[_0xdf78('0x4c')](_0x56cda3[_0xdf78('0x38')]);_0x5a8259[_0xdf78('0x39')]=_[_0xdf78('0x3a')](_0x5a8259[_0xdf78('0x37')],_0x5a8259[_0xdf78('0x38')]);_0x271358[_0xdf78('0x3b')]=_[_0xdf78('0x3a')](_0x5a8259[_0xdf78('0x37')],qs[_0xdf78('0x3c')](_0x56cda3[_0xdf78('0x38')][_0xdf78('0x3c')]));_0x271358[_0xdf78('0x3b')]=_0x271358[_0xdf78('0x3b')][_0xdf78('0x3d')]?_0x271358[_0xdf78('0x3b')]:_0x5a8259[_0xdf78('0x37')];_0x271358[_0xdf78('0x59')]=qs[_0xdf78('0x3f')](_0x56cda3[_0xdf78('0x38')][_0xdf78('0x3f')]);_0x271358[_0xdf78('0x40')]=qs[_0xdf78('0x39')](_[_0xdf78('0x41')](_0x56cda3[_0xdf78('0x38')],_0x5a8259[_0xdf78('0x39')]));if(_0x56cda3['query']['filter']){_0x271358['where']=_[_0xdf78('0x45')](_0x271358[_0xdf78('0x40')],{'$or':_[_0xdf78('0x34')](_0x271358[_0xdf78('0x3b')],function(_0x4516cc){var _0xc0a75b={};_0xc0a75b[_0x4516cc]={'$like':'%'+_0x56cda3['query']['filter']+'%'};return _0xc0a75b;})});}_0x271358=_['merge']({},_0x271358,_0x56cda3[_0xdf78('0x46')]);return _0xaeab11[_0xdf78('0x8e')](_0x271358);}})[_0xdf78('0x2a')](function(_0x25e93b){if(_0x25e93b){_0x724615=_0x25e93b[_0xdf78('0x3d')];if(!_0x56cda3[_0xdf78('0x38')][_0xdf78('0x3e')]('nolimit')){_0x271358['limit']=qs[_0xdf78('0x22')](_0x56cda3[_0xdf78('0x38')][_0xdf78('0x22')]);_0x271358[_0xdf78('0x25')]=qs[_0xdf78('0x25')](_0x56cda3[_0xdf78('0x38')][_0xdf78('0x25')]);}return _0xaeab11['getAgents'](_0x271358);}})[_0xdf78('0x2a')](function(_0x1098c4){if(_0x1098c4){return _0x1098c4?{'count':_0x724615,'rows':_0x1098c4}:null;}})[_0xdf78('0x2a')](respondWithResult(_0x85fa3d,null))[_0xdf78('0x4a')](handleError(_0x85fa3d,null));}; \ No newline at end of file +var _0x92aa=['then','destroy','get','MailQueues','UserProfileResource','sendStatus','error','stack','name','send','MailQueue','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','length','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','getMembers','findOne','UserMailQueue','order','User','findAndCountAll','UserId','updatedAt','format','%s/%s','SIP','mailPause','createdAt','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','findOrCreate','forEach','select','field','tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','removeTeams','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x92aa,0xf3));var _0xa92a=function(_0x3552ba,_0x2efbaa){_0x3552ba=_0x3552ba-0x0;var _0x5ded86=_0x92aa[_0x3552ba];return _0x5ded86;};'use strict';var emlformat=require(_0xa92a('0x0'));var rimraf=require(_0xa92a('0x1'));var zipdir=require(_0xa92a('0x2'));var jsonpatch=require(_0xa92a('0x3'));var rp=require(_0xa92a('0x4'));var moment=require('moment');var BPromise=require(_0xa92a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa92a('0x6'));var sox=require('sox');var csv=require(_0xa92a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa92a('0x8'));var squel=require(_0xa92a('0x9'));var crypto=require('crypto');var jsforce=require(_0xa92a('0xa'));var deskjs=require(_0xa92a('0xb'));var toCsv=require(_0xa92a('0x7'));var querystring=require(_0xa92a('0xc'));var Papa=require(_0xa92a('0xd'));var Redis=require('ioredis');var authService=require(_0xa92a('0xe'));var qs=require(_0xa92a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa92a('0x10'));var logger=require(_0xa92a('0x11'))(_0xa92a('0x12'));var utils=require('../../config/utils');var config=require(_0xa92a('0x13'));var licenseUtil=require(_0xa92a('0x14'));var db=require(_0xa92a('0x15'))['db'];config[_0xa92a('0x16')]=_[_0xa92a('0x17')](config[_0xa92a('0x16')],{'host':_0xa92a('0x18'),'port':0x18eb});var socket=require(_0xa92a('0x19'))(new Redis(config[_0xa92a('0x16')]));require(_0xa92a('0x1a'))[_0xa92a('0x1b')](socket);function respondWithStatusCode(_0x3ae339,_0x4e09bd){_0x4e09bd=_0x4e09bd||0xcc;return function(_0x5ed07c){if(_0x5ed07c){return _0x3ae339['sendStatus'](_0x4e09bd);}return _0x3ae339[_0xa92a('0x1c')](_0x4e09bd)[_0xa92a('0x1d')]();};}function respondWithResult(_0x2508eb,_0x45f89c){_0x45f89c=_0x45f89c||0xc8;return function(_0x1a8c3d){if(_0x1a8c3d){return _0x2508eb[_0xa92a('0x1c')](_0x45f89c)[_0xa92a('0x1e')](_0x1a8c3d);}};}function respondWithFilteredResult(_0x296713,_0xf0665f){return function(_0x371f1a){if(_0x371f1a){var _0x5284de=typeof _0xf0665f[_0xa92a('0x1f')]===_0xa92a('0x20')&&typeof _0xf0665f['limit']==='undefined';var _0x3d0365=_0x371f1a[_0xa92a('0x21')];var _0x54a0da=_0x5284de?0x0:_0xf0665f[_0xa92a('0x1f')];var _0x49b393=_0x5284de?_0x371f1a[_0xa92a('0x21')]:_0xf0665f['offset']+_0xf0665f[_0xa92a('0x22')];var _0x394ddc;if(_0x49b393>=_0x3d0365){_0x49b393=_0x3d0365;_0x394ddc=0xc8;}else{_0x394ddc=0xce;}_0x296713[_0xa92a('0x1c')](_0x394ddc);return _0x296713[_0xa92a('0x23')](_0xa92a('0x24'),_0x54a0da+'-'+_0x49b393+'/'+_0x3d0365)[_0xa92a('0x1e')](_0x371f1a);}return null;};}function patchUpdates(_0x26f7f3){return function(_0x4b1c13){try{jsonpatch[_0xa92a('0x25')](_0x4b1c13,_0x26f7f3,!![]);}catch(_0x1596fc){return BPromise['reject'](_0x1596fc);}return _0x4b1c13[_0xa92a('0x26')]();};}function saveUpdates(_0x2f69c4,_0x4d44de){return function(_0x3fe260){if(_0x3fe260){return _0x3fe260['update'](_0x2f69c4)[_0xa92a('0x27')](function(_0x120508){return _0x120508;});}return null;};}function removeEntity(_0x3d54c0,_0x3c4ab6){return function(_0x2668ba){if(_0x2668ba){return _0x2668ba[_0xa92a('0x28')]()[_0xa92a('0x27')](function(){var _0x53d560=_0x2668ba[_0xa92a('0x29')]({'plain':!![]});var _0x52b039=_0xa92a('0x2a');return db[_0xa92a('0x2b')][_0xa92a('0x28')]({'where':{'type':_0x52b039,'resourceId':_0x53d560['id']}})[_0xa92a('0x27')](function(){return _0x2668ba;});})['then'](function(){_0x3d54c0[_0xa92a('0x1c')](0xcc)[_0xa92a('0x1d')]();});}};}function handleEntityNotFound(_0x3a88e5,_0x3c099b){return function(_0x45a77d){if(!_0x45a77d){_0x3a88e5[_0xa92a('0x2c')](0x194);}return _0x45a77d;};}function handleError(_0x2767b8,_0x14b096){_0x14b096=_0x14b096||0x1f4;return function(_0x1fc7fa){logger[_0xa92a('0x2d')](_0x1fc7fa[_0xa92a('0x2e')]);if(_0x1fc7fa[_0xa92a('0x2f')]){delete _0x1fc7fa['name'];}_0x2767b8[_0xa92a('0x1c')](_0x14b096)[_0xa92a('0x30')](_0x1fc7fa);};}exports['index']=function(_0x56aa62,_0x3a9ac1){var _0xfc97eb={},_0x2db05a={},_0x15fc49={'count':0x0,'rows':[]};var _0x32fef4=_['map'](db[_0xa92a('0x31')][_0xa92a('0x32')],function(_0x1d2d74){return{'name':_0x1d2d74['fieldName'],'type':_0x1d2d74[_0xa92a('0x33')][_0xa92a('0x34')]};});_0x2db05a[_0xa92a('0x35')]=_['map'](_0x32fef4,_0xa92a('0x2f'));_0x2db05a[_0xa92a('0x36')]=_[_0xa92a('0x37')](_0x56aa62[_0xa92a('0x36')]);_0x2db05a[_0xa92a('0x38')]=_[_0xa92a('0x39')](_0x2db05a[_0xa92a('0x35')],_0x2db05a['query']);_0xfc97eb['attributes']=_['intersection'](_0x2db05a[_0xa92a('0x35')],qs[_0xa92a('0x3a')](_0x56aa62[_0xa92a('0x36')]['fields']));_0xfc97eb[_0xa92a('0x3b')]=_0xfc97eb['attributes']['length']?_0xfc97eb['attributes']:_0x2db05a['model'];if(!_0x56aa62[_0xa92a('0x36')][_0xa92a('0x3c')](_0xa92a('0x3d'))){_0xfc97eb[_0xa92a('0x22')]=qs[_0xa92a('0x22')](_0x56aa62['query'][_0xa92a('0x22')]);_0xfc97eb[_0xa92a('0x1f')]=qs[_0xa92a('0x1f')](_0x56aa62[_0xa92a('0x36')][_0xa92a('0x1f')]);}_0xfc97eb['order']=qs[_0xa92a('0x3e')](_0x56aa62['query'][_0xa92a('0x3e')]);_0xfc97eb[_0xa92a('0x3f')]=qs[_0xa92a('0x38')](_[_0xa92a('0x40')](_0x56aa62[_0xa92a('0x36')],_0x2db05a['filters']),_0x32fef4);if(_0x56aa62[_0xa92a('0x36')]['filter']){_0xfc97eb[_0xa92a('0x3f')]=_[_0xa92a('0x41')](_0xfc97eb['where'],{'$or':_[_0xa92a('0x42')](_0x32fef4,function(_0x197aa9){if(_0x197aa9[_0xa92a('0x33')]!==_0xa92a('0x43')){var _0x4ef6ac={};_0x4ef6ac[_0x197aa9[_0xa92a('0x2f')]]={'$like':'%'+_0x56aa62['query'][_0xa92a('0x44')]+'%'};return _0x4ef6ac;}})});}_0xfc97eb=_[_0xa92a('0x41')]({},_0xfc97eb,_0x56aa62[_0xa92a('0x45')]);var _0x4c348c={'where':_0xfc97eb['where']};return db[_0xa92a('0x31')][_0xa92a('0x21')](_0x4c348c)['then'](function(_0x1945e1){_0x15fc49['count']=_0x1945e1;if(_0x56aa62['query'][_0xa92a('0x46')]){_0xfc97eb[_0xa92a('0x47')]=[{'all':!![]}];}return db['MailQueue'][_0xa92a('0x48')](_0xfc97eb);})[_0xa92a('0x27')](function(_0x2bbaa3){_0x15fc49[_0xa92a('0x49')]=_0x2bbaa3;return _0x15fc49;})[_0xa92a('0x27')](respondWithFilteredResult(_0x3a9ac1,_0xfc97eb))['catch'](handleError(_0x3a9ac1,null));};exports[_0xa92a('0x4a')]=function(_0x3990cd,_0x5a83ea){var _0x4187ee={'raw':!![],'where':{'id':_0x3990cd['params']['id']}},_0x15d843={};_0x15d843[_0xa92a('0x35')]=_[_0xa92a('0x37')](db[_0xa92a('0x31')][_0xa92a('0x32')]);_0x15d843['query']=_[_0xa92a('0x37')](_0x3990cd[_0xa92a('0x36')]);_0x15d843['filters']=_[_0xa92a('0x39')](_0x15d843[_0xa92a('0x35')],_0x15d843['query']);_0x4187ee[_0xa92a('0x3b')]=_[_0xa92a('0x39')](_0x15d843[_0xa92a('0x35')],qs[_0xa92a('0x3a')](_0x3990cd['query']['fields']));_0x4187ee[_0xa92a('0x3b')]=_0x4187ee[_0xa92a('0x3b')][_0xa92a('0x4b')]?_0x4187ee['attributes']:_0x15d843[_0xa92a('0x35')];if(_0x3990cd[_0xa92a('0x36')][_0xa92a('0x46')]){_0x4187ee[_0xa92a('0x47')]=[{'all':!![]}];}_0x4187ee=_['merge']({},_0x4187ee,_0x3990cd['options']);return db[_0xa92a('0x31')][_0xa92a('0x4c')](_0x4187ee)['then'](handleEntityNotFound(_0x5a83ea,null))['then'](respondWithResult(_0x5a83ea,null))[_0xa92a('0x4d')](handleError(_0x5a83ea,null));};exports[_0xa92a('0x4e')]=function(_0x57c05a,_0x396375){return db[_0xa92a('0x31')][_0xa92a('0x4e')](_0x57c05a['body'],{})[_0xa92a('0x27')](function(_0x41ab32){var _0x3c0ffa=_0x57c05a[_0xa92a('0x4f')]['get']({'plain':!![]});if(!_0x3c0ffa)throw new Error(_0xa92a('0x50'));if(_0x3c0ffa['role']==='user'){var _0x294094=_0x41ab32['get']({'plain':!![]});var _0x38d359=_0xa92a('0x2a');return db[_0xa92a('0x51')][_0xa92a('0x4c')]({'where':{'name':_0x38d359,'userProfileId':_0x3c0ffa['userProfileId']},'raw':!![]})[_0xa92a('0x27')](function(_0x134acb){if(_0x134acb&&_0x134acb[_0xa92a('0x52')]===0x0){return db[_0xa92a('0x2b')][_0xa92a('0x4e')]({'name':_0x294094[_0xa92a('0x2f')],'resourceId':_0x294094['id'],'type':_0x134acb[_0xa92a('0x2f')],'sectionId':_0x134acb['id']},{})[_0xa92a('0x27')](function(){return _0x41ab32;});}else{return _0x41ab32;}})['catch'](function(_0x3b1a12){logger[_0xa92a('0x2d')](_0xa92a('0x53'),_0x3b1a12);throw _0x3b1a12;});}return _0x41ab32;})[_0xa92a('0x27')](respondWithResult(_0x396375,0xc9))[_0xa92a('0x4d')](handleError(_0x396375,null));};exports[_0xa92a('0x54')]=function(_0x75e033,_0x2b61e2){if(_0x75e033['body']['id']){delete _0x75e033[_0xa92a('0x55')]['id'];}return db['MailQueue'][_0xa92a('0x4c')]({'where':{'id':_0x75e033[_0xa92a('0x56')]['id']}})[_0xa92a('0x27')](handleEntityNotFound(_0x2b61e2,null))[_0xa92a('0x27')](saveUpdates(_0x75e033[_0xa92a('0x55')],null))[_0xa92a('0x27')](respondWithResult(_0x2b61e2,null))['catch'](handleError(_0x2b61e2,null));};exports[_0xa92a('0x28')]=function(_0x329962,_0x442850){return db[_0xa92a('0x31')][_0xa92a('0x4c')]({'where':{'id':_0x329962[_0xa92a('0x56')]['id']}})[_0xa92a('0x27')](handleEntityNotFound(_0x442850,null))[_0xa92a('0x27')](removeEntity(_0x442850,null))['catch'](handleError(_0x442850,null));};exports[_0xa92a('0x57')]=function(_0x30eaca,_0x11d71b){return db[_0xa92a('0x31')][_0xa92a('0x57')]()[_0xa92a('0x27')](respondWithResult(_0x11d71b,null))['catch'](handleError(_0x11d71b,null));};exports[_0xa92a('0x58')]=function(_0x58cbfe,_0x211ed9,_0x2e94ff){var _0x23a71d={'raw':!![],'where':{}},_0x234821={},_0x29e9ef;return db[_0xa92a('0x31')][_0xa92a('0x59')]({'where':{'id':_0x58cbfe[_0xa92a('0x56')]['id']}})[_0xa92a('0x27')](handleEntityNotFound(_0x211ed9,null))['then'](function(_0x1b5d8d){if(_0x1b5d8d){_0x29e9ef=_0x1b5d8d[_0xa92a('0x29')]({'plain':!![]});_0x234821[_0xa92a('0x35')]=_[_0xa92a('0x37')](db[_0xa92a('0x5a')][_0xa92a('0x32')]);_0x234821[_0xa92a('0x36')]=_[_0xa92a('0x37')](_0x58cbfe[_0xa92a('0x36')]);_0x234821[_0xa92a('0x38')]=_[_0xa92a('0x39')](_0x234821['model'],_0x234821[_0xa92a('0x36')]);_0x23a71d['attributes']=_['intersection'](_0x234821[_0xa92a('0x35')],qs[_0xa92a('0x3a')](_0x58cbfe['query']['fields']));_0x23a71d[_0xa92a('0x3b')]=_0x23a71d[_0xa92a('0x3b')][_0xa92a('0x4b')]?_0x23a71d[_0xa92a('0x3b')]:_0x234821[_0xa92a('0x35')];if(!_0x58cbfe[_0xa92a('0x36')][_0xa92a('0x3c')](_0xa92a('0x3d'))){_0x23a71d[_0xa92a('0x22')]=qs[_0xa92a('0x22')](_0x58cbfe[_0xa92a('0x36')]['limit']);_0x23a71d['offset']=qs[_0xa92a('0x1f')](_0x58cbfe[_0xa92a('0x36')][_0xa92a('0x1f')]);}_0x23a71d[_0xa92a('0x5b')]=qs['sort'](_0x58cbfe[_0xa92a('0x36')]['sort']);_0x23a71d[_0xa92a('0x3f')]=qs['filters'](_[_0xa92a('0x40')](_0x58cbfe[_0xa92a('0x36')],_0x234821[_0xa92a('0x38')]));_0x23a71d[_0xa92a('0x3f')]['MailQueueId']=_0x1b5d8d['id'];if(_0x58cbfe[_0xa92a('0x36')]['filter']){_0x23a71d[_0xa92a('0x3f')]=_['merge'](_0x23a71d['where'],{'$or':_[_0xa92a('0x42')](_0x23a71d[_0xa92a('0x3b')],function(_0x255470){var _0x5e7490={};_0x5e7490[_0x255470]={'$like':'%'+_0x58cbfe[_0xa92a('0x36')][_0xa92a('0x44')]+'%'};return _0x5e7490;})});}_0x23a71d=_[_0xa92a('0x41')]({},_0x23a71d,_0x58cbfe[_0xa92a('0x45')]);return db[_0xa92a('0x5a')][_0xa92a('0x48')](_0x23a71d);}})[_0xa92a('0x27')](function(_0x397ac0){if(_0x397ac0){return db[_0xa92a('0x5c')][_0xa92a('0x5d')]({'where':{'id':_[_0xa92a('0x42')](_0x397ac0,_0xa92a('0x5e')),'role':'agent'},'attributes':['id','name','mailPause',_0xa92a('0x5f'),'createdAt']});}})['then'](function(_0x502076){if(_0x502076){return{'count':_0x502076[_0xa92a('0x21')],'rows':_['map'](_0x502076['rows'],function(_0x4a42a4){return{'membername':_0x4a42a4[_0xa92a('0x2f')],'UserId':_0x4a42a4['id'],'queue_name':_0x29e9ef[_0xa92a('0x2f')],'MailQueueId':_0x29e9ef['id'],'interface':util[_0xa92a('0x60')](_0xa92a('0x61'),_0xa92a('0x62'),_0x4a42a4[_0xa92a('0x2f')]),'penalty':0x0,'paused':_0x4a42a4[_0xa92a('0x63')],'createdAt':_0x4a42a4[_0xa92a('0x64')],'updatedAt':_0x4a42a4[_0xa92a('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa92a('0x27')](respondWithFilteredResult(_0x211ed9,_0x23a71d))[_0xa92a('0x4d')](handleError(_0x211ed9,null));};exports[_0xa92a('0x65')]=function(_0x4a39ba,_0x3b2294,_0x23fd09){var _0x3e8d7d={};var _0x339ebf={};var _0x21dd17;var _0x40ae03;return db[_0xa92a('0x31')][_0xa92a('0x59')]({'where':{'id':_0x4a39ba[_0xa92a('0x56')]['id']}})['then'](handleEntityNotFound(_0x3b2294,null))[_0xa92a('0x27')](function(_0x499aa4){if(_0x499aa4){_0x21dd17=_0x499aa4;_0x339ebf[_0xa92a('0x35')]=_['keys'](db[_0xa92a('0x66')][_0xa92a('0x32')]);_0x339ebf['query']=_[_0xa92a('0x37')](_0x4a39ba[_0xa92a('0x36')]);_0x339ebf[_0xa92a('0x38')]=_[_0xa92a('0x39')](_0x339ebf['model'],_0x339ebf[_0xa92a('0x36')]);_0x3e8d7d[_0xa92a('0x3b')]=_[_0xa92a('0x39')](_0x339ebf['model'],qs[_0xa92a('0x3a')](_0x4a39ba[_0xa92a('0x36')]['fields']));_0x3e8d7d[_0xa92a('0x3b')]=_0x3e8d7d[_0xa92a('0x3b')][_0xa92a('0x4b')]?_0x3e8d7d[_0xa92a('0x3b')]:_0x339ebf[_0xa92a('0x35')];_0x3e8d7d[_0xa92a('0x5b')]=qs[_0xa92a('0x3e')](_0x4a39ba['query']['sort']);_0x3e8d7d['where']=qs['filters'](_[_0xa92a('0x40')](_0x4a39ba[_0xa92a('0x36')],_0x339ebf[_0xa92a('0x38')]));if(_0x4a39ba[_0xa92a('0x36')]['filter']){_0x3e8d7d['where']=_[_0xa92a('0x41')](_0x3e8d7d[_0xa92a('0x3f')],{'$or':_[_0xa92a('0x42')](_0x3e8d7d[_0xa92a('0x3b')],function(_0x4cce09){var _0x1f8a0b={};_0x1f8a0b[_0x4cce09]={'$like':'%'+_0x4a39ba['query']['filter']+'%'};return _0x1f8a0b;})});}_0x3e8d7d=_[_0xa92a('0x41')]({},_0x3e8d7d,_0x4a39ba['options']);return _0x21dd17['getTeams'](_0x3e8d7d);}})[_0xa92a('0x27')](function(_0x2ae688){if(_0x2ae688){_0x40ae03=_0x2ae688[_0xa92a('0x4b')];if(!_0x4a39ba[_0xa92a('0x36')][_0xa92a('0x3c')]('nolimit')){_0x3e8d7d[_0xa92a('0x22')]=qs['limit'](_0x4a39ba[_0xa92a('0x36')][_0xa92a('0x22')]);_0x3e8d7d[_0xa92a('0x1f')]=qs[_0xa92a('0x1f')](_0x4a39ba[_0xa92a('0x36')][_0xa92a('0x1f')]);}return _0x21dd17[_0xa92a('0x65')](_0x3e8d7d);}})[_0xa92a('0x27')](function(_0x475f45){if(_0x475f45){return _0x475f45?{'count':_0x40ae03,'rows':_0x475f45}:null;}})[_0xa92a('0x27')](respondWithResult(_0x3b2294,null))[_0xa92a('0x4d')](handleError(_0x3b2294,null));};exports[_0xa92a('0x67')]=function(_0x598fd9,_0x3224f5,_0x1ac685){var _0x5b32c0=_0x598fd9[_0xa92a('0x55')][_0xa92a('0x68')];return db[_0xa92a('0x66')][_0xa92a('0x48')]({'where':{'id':_0x5b32c0},'attributes':['id'],'include':[{'model':db[_0xa92a('0x5c')],'as':'Agents','attributes':['id','name',_0xa92a('0x69'),_0xa92a('0x6a'),_0xa92a('0x6b')],'raw':!![]}]})[_0xa92a('0x27')](function(_0x21759d){if(_0x21759d){var _0x348c2b=_[_0xa92a('0x6c')](_0x21759d,function(_0x35574b){var _0x49b4d8=_0x35574b[_0xa92a('0x29')]({'plain':!![]});return _0x49b4d8[_0xa92a('0x6d')];});return db['MailQueue'][_0xa92a('0x4c')]({'where':{'id':_0x598fd9['params']['id']}})['then'](function(_0x20053d){return db['sequelize']['transaction'](function(_0x2289d7){return _0x20053d[_0xa92a('0x67')](_0x5b32c0,{'transaction':_0x2289d7})[_0xa92a('0x27')](function(){return BPromise['each'](_0x348c2b,function(_0x48ad3b){return db[_0xa92a('0x5a')][_0xa92a('0x6e')]({'where':{'UserId':_0x48ad3b['id'],'MailQueueId':_0x598fd9['params']['id']},'transaction':_0x2289d7});});})[_0xa92a('0x27')](function(){_0x348c2b[_0xa92a('0x6f')](function(_0x20cea2){socket['emit']('userMailQueue:save',{'UserId':_0x20cea2['id'],'MailQueueId':_0x20053d['id']});});});});});}})[_0xa92a('0x27')](respondWithStatusCode(_0x3224f5,null))[_0xa92a('0x4d')](handleError(_0x3224f5,null));};exports['removeTeams']=function(_0x1d0ffb,_0x51d9c1,_0xc95e25){return db[_0xa92a('0x66')]['findAll']({'where':{'id':_0x1d0ffb[_0xa92a('0x36')][_0xa92a('0x68')]},'attributes':['id'],'include':[{'model':db[_0xa92a('0x5c')],'as':_0xa92a('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xa92a('0x27')](handleEntityNotFound(_0x51d9c1,null))[_0xa92a('0x27')](function(_0x182392){var _0x22098c=_[_0xa92a('0x42')](_0x182392,'id');var _0x5dcb02=[];var _0x447174=[];var _0x854d34=squel[_0xa92a('0x70')]();_0x854d34[_0xa92a('0x71')](_0xa92a('0x72'))[_0xa92a('0x73')](_0xa92a('0x74'),'tq')[_0xa92a('0x75')]('user_has_teams','ut',_0xa92a('0x76'))[_0xa92a('0x3f')](_0xa92a('0x77'),_0x1d0ffb['params']['id']);for(var _0x45eb91=0x0;_0x45eb91<_0x182392['length'];_0x45eb91+=0x1){let _0x1227c9=_0x182392[_0x45eb91];for(var _0x422292=0x0;_0x422292<_0x1227c9[_0xa92a('0x6d')][_0xa92a('0x4b')];_0x422292+=0x1){let _0x140011=_0x1227c9['Agents'][_0x422292];var _0x4e08cd=_0x854d34['clone']();_0x4e08cd[_0xa92a('0x3f')](_0xa92a('0x78'),_0x140011['id']);_0x447174['push'](db[_0xa92a('0x79')]['query'](_0x4e08cd[_0xa92a('0x7a')](),{'type':db[_0xa92a('0x79')][_0xa92a('0x7b')][_0xa92a('0x7c')]})[_0xa92a('0x27')](function(_0xfbdc14){if(_0xfbdc14[_0xa92a('0x4b')]===0x1){return _0x140011['id'];}else{var _0x457589=_[_0xa92a('0x7d')](_[_0xa92a('0x42')](_0xfbdc14,_0xa92a('0x7e')),function(_0x45530c){return _['includes'](_0x22098c,_0x45530c);});if(_0x457589){return _0x140011['id'];}}}));}}return BPromise[_0xa92a('0x7f')](_0x447174)[_0xa92a('0x27')](function(_0x454856){_0x5dcb02=_(_0x5dcb02)[_0xa92a('0x80')](_0x454856)[_0xa92a('0x81')]()[_0xa92a('0x82')]();return db[_0xa92a('0x31')][_0xa92a('0x4c')]({'where':{'id':_0x1d0ffb['params']['id']}})[_0xa92a('0x27')](function(_0x42a03e){return db['sequelize']['transaction'](function(_0x59162a){return _0x42a03e[_0xa92a('0x83')](_0x1d0ffb['query'][_0xa92a('0x68')],{'transaction':_0x59162a})[_0xa92a('0x27')](function(){if(!_[_0xa92a('0x84')](_0x5dcb02)){return _0x42a03e[_0xa92a('0x85')](_0x5dcb02,{'transaction':_0x59162a});}})['then'](function(){_0x5dcb02['forEach'](function(_0xf87576){socket[_0xa92a('0x86')](_0xa92a('0x87'),{'UserId':_0xf87576,'MailQueueId':_0x42a03e['id']});});});});});});})[_0xa92a('0x27')](respondWithStatusCode(_0x51d9c1,null))[_0xa92a('0x4d')](handleError(_0x51d9c1,null));};exports[_0xa92a('0x88')]=function(_0x2f8b15,_0x54d9b1,_0x1c49ad){return db['MailQueue'][_0xa92a('0x4c')]({'where':{'id':_0x2f8b15[_0xa92a('0x56')]['id']}})[_0xa92a('0x27')](handleEntityNotFound(_0x54d9b1,null))[_0xa92a('0x27')](function(_0x1acdb7){if(_0x1acdb7){return _0x1acdb7['addAgents'](_0x2f8b15[_0xa92a('0x55')][_0xa92a('0x68')],_[_0xa92a('0x89')](_0x2f8b15[_0xa92a('0x55')],['ids','id'])||{})[_0xa92a('0x8a')](function(_0x47627d){for(var _0x51a10c=0x0;_0x51a10c<_0x2f8b15[_0xa92a('0x55')]['ids'][_0xa92a('0x4b')];_0x51a10c+=0x1){socket[_0xa92a('0x86')](_0xa92a('0x8b'),{'UserId':Number(_0x2f8b15[_0xa92a('0x55')][_0xa92a('0x68')][_0x51a10c]),'MailQueueId':Number(_0x2f8b15['params']['id'])});}return _0x47627d;});}})[_0xa92a('0x27')](respondWithResult(_0x54d9b1,null))['catch'](handleError(_0x54d9b1,null));};exports['removeAgents']=function(_0x2c66ae,_0x259647,_0x17e988){return db[_0xa92a('0x31')]['find']({'where':{'id':_0x2c66ae[_0xa92a('0x56')]['id']}})[_0xa92a('0x27')](handleEntityNotFound(_0x259647,null))[_0xa92a('0x27')](function(_0x32e31d){if(_0x32e31d){return _0x32e31d['removeAgents'](_0x2c66ae[_0xa92a('0x36')][_0xa92a('0x68')])[_0xa92a('0x27')](function(){if(_['isArray'](_0x2c66ae[_0xa92a('0x36')][_0xa92a('0x68')])){for(var _0x11785f=0x0;_0x11785f<_0x2c66ae['query'][_0xa92a('0x68')][_0xa92a('0x4b')];_0x11785f+=0x1){socket[_0xa92a('0x86')]('userMailQueue:remove',{'UserId':Number(_0x2c66ae[_0xa92a('0x36')][_0xa92a('0x68')][_0x11785f]),'MailQueueId':Number(_0x2c66ae[_0xa92a('0x56')]['id'])});}}else{socket['emit'](_0xa92a('0x87'),{'UserId':Number(_0x2c66ae[_0xa92a('0x36')]['ids']),'MailQueueId':Number(_0x2c66ae[_0xa92a('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x259647,null))[_0xa92a('0x4d')](handleError(_0x259647,null));};exports[_0xa92a('0x8c')]=function(_0x4192ce,_0x4e47aa,_0x491cdc){var _0x14f2c7={};var _0x4f37b4={};var _0x38d2f5;var _0x37a446;return db['MailQueue'][_0xa92a('0x59')]({'where':{'id':_0x4192ce['params']['id']}})[_0xa92a('0x27')](handleEntityNotFound(_0x4e47aa,null))[_0xa92a('0x27')](function(_0x4ac9bb){if(_0x4ac9bb){_0x38d2f5=_0x4ac9bb;_0x4f37b4['model']=_[_0xa92a('0x37')](db[_0xa92a('0x5c')]['rawAttributes']);_0x4f37b4['query']=_['keys'](_0x4192ce[_0xa92a('0x36')]);_0x4f37b4[_0xa92a('0x38')]=_['intersection'](_0x4f37b4[_0xa92a('0x35')],_0x4f37b4[_0xa92a('0x36')]);_0x14f2c7[_0xa92a('0x3b')]=_[_0xa92a('0x39')](_0x4f37b4[_0xa92a('0x35')],qs[_0xa92a('0x3a')](_0x4192ce[_0xa92a('0x36')][_0xa92a('0x3a')]));_0x14f2c7['attributes']=_0x14f2c7[_0xa92a('0x3b')]['length']?_0x14f2c7['attributes']:_0x4f37b4[_0xa92a('0x35')];_0x14f2c7[_0xa92a('0x5b')]=qs[_0xa92a('0x3e')](_0x4192ce[_0xa92a('0x36')][_0xa92a('0x3e')]);_0x14f2c7[_0xa92a('0x3f')]=qs[_0xa92a('0x38')](_[_0xa92a('0x40')](_0x4192ce[_0xa92a('0x36')],_0x4f37b4[_0xa92a('0x38')]));if(_0x4192ce[_0xa92a('0x36')][_0xa92a('0x44')]){_0x14f2c7[_0xa92a('0x3f')]=_[_0xa92a('0x41')](_0x14f2c7['where'],{'$or':_[_0xa92a('0x42')](_0x14f2c7[_0xa92a('0x3b')],function(_0x42f105){var _0xffabc={};_0xffabc[_0x42f105]={'$like':'%'+_0x4192ce['query']['filter']+'%'};return _0xffabc;})});}_0x14f2c7=_['merge']({},_0x14f2c7,_0x4192ce[_0xa92a('0x45')]);return _0x38d2f5[_0xa92a('0x8c')](_0x14f2c7);}})[_0xa92a('0x27')](function(_0xace0ed){if(_0xace0ed){_0x37a446=_0xace0ed['length'];if(!_0x4192ce[_0xa92a('0x36')]['hasOwnProperty'](_0xa92a('0x3d'))){_0x14f2c7[_0xa92a('0x22')]=qs['limit'](_0x4192ce[_0xa92a('0x36')]['limit']);_0x14f2c7['offset']=qs[_0xa92a('0x1f')](_0x4192ce[_0xa92a('0x36')][_0xa92a('0x1f')]);}return _0x38d2f5[_0xa92a('0x8c')](_0x14f2c7);}})[_0xa92a('0x27')](function(_0xe86501){if(_0xe86501){return _0xe86501?{'count':_0x37a446,'rows':_0xe86501}:null;}})['then'](respondWithResult(_0x4e47aa,null))[_0xa92a('0x4d')](handleError(_0x4e47aa,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index a4bc873..5073050 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 _0xc9e0=['exports','events','../../mysqldb','MailQueue','update','remove','emit','hasOwnProperty','hook'];(function(_0x2197a4,_0xbd9896){var _0x2e140d=function(_0x4e88b4){while(--_0x4e88b4){_0x2197a4['push'](_0x2197a4['shift']());}};_0x2e140d(++_0xbd9896);}(_0xc9e0,0x6d));var _0x0c9e=function(_0x2bf49b,_0x3f54b5){_0x2bf49b=_0x2bf49b-0x0;var _0x3de09a=_0xc9e0[_0x2bf49b];return _0x3de09a;};'use strict';var EventEmitter=require(_0x0c9e('0x0'));var MailQueue=require(_0x0c9e('0x1'))['db'][_0x0c9e('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0c9e('0x3'),'afterDestroy':_0x0c9e('0x4')};function emitEvent(_0x5bddfa){return function(_0x41839c,_0x570256,_0x58d04f){MailQueueEvents['emit'](_0x5bddfa+':'+_0x41839c['id'],_0x41839c);MailQueueEvents[_0x0c9e('0x5')](_0x5bddfa,_0x41839c);_0x58d04f(null);};}for(var e in events){if(events[_0x0c9e('0x6')](e)){var event=events[e];MailQueue[_0x0c9e('0x7')](e,emitEvent(event));}}module[_0x0c9e('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x974f=['hasOwnProperty','exports','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit'];(function(_0x2d36fe,_0x4c058f){var _0x417693=function(_0x1b6e6b){while(--_0x1b6e6b){_0x2d36fe['push'](_0x2d36fe['shift']());}};_0x417693(++_0x4c058f);}(_0x974f,0x89));var _0xf974=function(_0x13bc44,_0x59c258){_0x13bc44=_0x13bc44-0x0;var _0x237054=_0x974f[_0x13bc44];return _0x237054;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xf974('0x0'))['db'][_0xf974('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xf974('0x2')](0x0);var events={'afterCreate':_0xf974('0x3'),'afterUpdate':_0xf974('0x4'),'afterDestroy':_0xf974('0x5')};function emitEvent(_0x5b5d46){return function(_0x5c2c2e,_0x355418,_0x2207d0){MailQueueEvents[_0xf974('0x6')](_0x5b5d46+':'+_0x5c2c2e['id'],_0x5c2c2e);MailQueueEvents['emit'](_0x5b5d46,_0x5c2c2e);_0x2207d0(null);};}for(var e in events){if(events[_0xf974('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xf974('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index b10d744..8841f38 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 _0x0638=['MailQueue','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0x0638,0xc7));var _0x8063=function(_0x2b5b44,_0x17189c){_0x2b5b44=_0x2b5b44-0x0;var _0x32cb66=_0x0638[_0x2b5b44];return _0x32cb66;};'use strict';var _=require('lodash');var util=require(_0x8063('0x0'));var logger=require(_0x8063('0x1'))(_0x8063('0x2'));var moment=require('moment');var BPromise=require(_0x8063('0x3'));var rp=require(_0x8063('0x4'));var fs=require('fs');var path=require(_0x8063('0x5'));var rimraf=require(_0x8063('0x6'));var config=require(_0x8063('0x7'));var attributes=require('./mailQueue.attributes');module[_0x8063('0x8')]=function(_0x11fc4e,_0x38b438){return _0x11fc4e[_0x8063('0x9')](_0x8063('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ab6=['../../config/environment','./mailQueue.attributes','MailQueue','mail_queues','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x19e0f6,_0x54a108){var _0x5aaaee=function(_0x165f2c){while(--_0x165f2c){_0x19e0f6['push'](_0x19e0f6['shift']());}};_0x5aaaee(++_0x54a108);}(_0x8ab6,0x1bc));var _0x68ab=function(_0x5dd418,_0x413268){_0x5dd418=_0x5dd418-0x0;var _0x313a73=_0x8ab6[_0x5dd418];return _0x313a73;};'use strict';var _=require(_0x68ab('0x0'));var util=require('util');var logger=require(_0x68ab('0x1'))(_0x68ab('0x2'));var moment=require('moment');var BPromise=require(_0x68ab('0x3'));var rp=require(_0x68ab('0x4'));var fs=require('fs');var path=require(_0x68ab('0x5'));var rimraf=require(_0x68ab('0x6'));var config=require(_0x68ab('0x7'));var attributes=require(_0x68ab('0x8'));module['exports']=function(_0x54e96a,_0xaa6be8){return _0x54e96a['define'](_0x68ab('0x9'),attributes,{'tableName':_0x68ab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 167f74b..cbd03b5 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 _0x98de=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','GetMailQueue','findAll','options','where','attributes','include','map','model','ShowMailQueue','MailQueue','raw','lodash','util','moment','randomstring'];(function(_0x5a9c8d,_0x8c8efe){var _0x15af92=function(_0x17deba){while(--_0x17deba){_0x5a9c8d['push'](_0x5a9c8d['shift']());}};_0x15af92(++_0x8c8efe);}(_0x98de,0x114));var _0xe98d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x98de[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe98d('0x0'));var util=require(_0xe98d('0x1'));var moment=require(_0xe98d('0x2'));var BPromise=require('bluebird');var rs=require(_0xe98d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe98d('0x4'))['db'];var utils=require(_0xe98d('0x5'));var logger=require(_0xe98d('0x6'))(_0xe98d('0x7'));var config=require(_0xe98d('0x8'));var jayson=require(_0xe98d('0x9'));var client=jayson[_0xe98d('0xa')]['http']({'port':0x232a});config[_0xe98d('0xb')]=_[_0xe98d('0xc')](config[_0xe98d('0xb')],{'host':_0xe98d('0xd'),'port':0x18eb});var socket=require(_0xe98d('0xe'))(new Redis(config['redis']));require(_0xe98d('0xf'))[_0xe98d('0x10')](socket);function respondWithRpcPromise(_0x4dc9b6,_0x2e01a5,_0x103ac0){return new BPromise(function(_0x1b88b7,_0xa9843b){return client[_0xe98d('0x11')](_0x4dc9b6,_0x103ac0)[_0xe98d('0x12')](function(_0x669c2d){logger[_0xe98d('0x13')](_0xe98d('0x14'),_0x2e01a5,_0xe98d('0x15'));logger[_0xe98d('0x16')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x2e01a5,_0xe98d('0x15'),JSON[_0xe98d('0x17')](_0x669c2d));if(_0x669c2d['error']){if(_0x669c2d['error'][_0xe98d('0x18')]===0x1f4){logger[_0xe98d('0x19')](_0xe98d('0x14'),_0x2e01a5,_0x669c2d[_0xe98d('0x19')]['message']);return _0xa9843b(_0x669c2d[_0xe98d('0x19')]['message']);}logger[_0xe98d('0x19')](_0xe98d('0x14'),_0x2e01a5,_0x669c2d['error'][_0xe98d('0x1a')]);return _0x1b88b7(_0x669c2d['error'][_0xe98d('0x1a')]);}else{logger[_0xe98d('0x13')](_0xe98d('0x14'),_0x2e01a5,'request\x20sent');_0x1b88b7(_0x669c2d[_0xe98d('0x1b')][_0xe98d('0x1a')]);}})[_0xe98d('0x1c')](function(_0x4fb354){logger[_0xe98d('0x19')](_0xe98d('0x14'),_0x2e01a5,_0x4fb354);_0xa9843b(_0x4fb354);});});}exports[_0xe98d('0x1d')]=function(_0x2b5954){var _0x2d1713=this;return new Promise(function(_0x40f7c6,_0x591603){return db['MailQueue'][_0xe98d('0x1e')]({'raw':_0x2b5954[_0xe98d('0x1f')]?_0x2b5954[_0xe98d('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2b5954['options']?_0x2b5954['options'][_0xe98d('0x20')]||null:null,'attributes':_0x2b5954[_0xe98d('0x1f')]?_0x2b5954[_0xe98d('0x1f')][_0xe98d('0x21')]||null:null,'limit':_0x2b5954[_0xe98d('0x1f')]?_0x2b5954['options']['limit']||null:null,'include':_0x2b5954[_0xe98d('0x1f')]?_0x2b5954[_0xe98d('0x1f')][_0xe98d('0x22')]?_[_0xe98d('0x23')](_0x2b5954['options'][_0xe98d('0x22')],function(_0x42d61e){return{'model':db[_0x42d61e[_0xe98d('0x24')]],'as':_0x42d61e['as'],'attributes':_0x42d61e[_0xe98d('0x21')],'include':_0x42d61e['include']?_['map'](_0x42d61e[_0xe98d('0x22')],function(_0x5a4cb0){return{'model':db[_0x5a4cb0['model']],'as':_0x5a4cb0['as'],'attributes':_0x5a4cb0[_0xe98d('0x21')],'include':_0x5a4cb0[_0xe98d('0x22')]?_[_0xe98d('0x23')](_0x5a4cb0['include'],function(_0x50847f){return{'model':db[_0x50847f[_0xe98d('0x24')]],'as':_0x50847f['as'],'attributes':_0x50847f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b518c){logger[_0xe98d('0x13')](_0xe98d('0x1d'),_0x2b5954);logger[_0xe98d('0x16')](_0xe98d('0x1d'),_0x2b5954,JSON['stringify'](_0x1b518c));_0x40f7c6(_0x1b518c);})[_0xe98d('0x1c')](function(_0x41b126){logger[_0xe98d('0x19')](_0xe98d('0x1d'),_0x41b126[_0xe98d('0x1a')],_0x2b5954);_0x591603(_0x2d1713[_0xe98d('0x19')](0x1f4,_0x41b126['message']));});});};exports[_0xe98d('0x25')]=function(_0x5db60e){var _0x3d65e2=this;return new Promise(function(_0x3b44da,_0x48dd0e){return db[_0xe98d('0x26')]['find']({'raw':_0x5db60e[_0xe98d('0x1f')]?_0x5db60e[_0xe98d('0x1f')][_0xe98d('0x27')]===undefined?!![]:![]:!![],'where':_0x5db60e['options']?_0x5db60e[_0xe98d('0x1f')][_0xe98d('0x20')]||null:null,'attributes':_0x5db60e[_0xe98d('0x1f')]?_0x5db60e[_0xe98d('0x1f')][_0xe98d('0x21')]||null:null,'include':_0x5db60e[_0xe98d('0x1f')]?_0x5db60e['options'][_0xe98d('0x22')]?_[_0xe98d('0x23')](_0x5db60e[_0xe98d('0x1f')][_0xe98d('0x22')],function(_0xd63e68){return{'model':db[_0xd63e68[_0xe98d('0x24')]],'as':_0xd63e68['as'],'attributes':_0xd63e68[_0xe98d('0x21')],'include':_0xd63e68['include']?_[_0xe98d('0x23')](_0xd63e68[_0xe98d('0x22')],function(_0x3079ef){return{'model':db[_0x3079ef['model']],'as':_0x3079ef['as'],'attributes':_0x3079ef[_0xe98d('0x21')],'include':_0x3079ef[_0xe98d('0x22')]?_[_0xe98d('0x23')](_0x3079ef[_0xe98d('0x22')],function(_0xc9b668){return{'model':db[_0xc9b668[_0xe98d('0x24')]],'as':_0xc9b668['as'],'attributes':_0xc9b668[_0xe98d('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe98d('0x12')](function(_0x23efc3){logger[_0xe98d('0x13')]('ShowMailQueue',_0x5db60e);logger['debug'](_0xe98d('0x25'),_0x5db60e,JSON['stringify'](_0x23efc3));_0x3b44da(_0x23efc3);})[_0xe98d('0x1c')](function(_0x43c666){logger[_0xe98d('0x19')](_0xe98d('0x25'),_0x43c666['message'],_0x5db60e);_0x48dd0e(_0x3d65e2[_0xe98d('0x19')](0x1f4,_0x43c666['message']));});});}; \ No newline at end of file +var _0xebe6=['findAll','options','raw','where','limit','include','map','model','attributes','GetMailQueue','MailQueue','find','ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xebe6,0x13a));var _0x6ebe=function(_0x919445,_0x5467dc){_0x919445=_0x919445-0x0;var _0x511b3e=_0xebe6[_0x919445];return _0x511b3e;};'use strict';var _=require(_0x6ebe('0x0'));var util=require(_0x6ebe('0x1'));var moment=require(_0x6ebe('0x2'));var BPromise=require(_0x6ebe('0x3'));var rs=require(_0x6ebe('0x4'));var fs=require('fs');var Redis=require(_0x6ebe('0x5'));var db=require(_0x6ebe('0x6'))['db'];var utils=require(_0x6ebe('0x7'));var logger=require(_0x6ebe('0x8'))(_0x6ebe('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6ebe('0xa')][_0x6ebe('0xb')]({'port':0x232a});config[_0x6ebe('0xc')]=_[_0x6ebe('0xd')](config[_0x6ebe('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6ebe('0xe'))(new Redis(config['redis']));require(_0x6ebe('0xf'))[_0x6ebe('0x10')](socket);function respondWithRpcPromise(_0x81fa22,_0x37cbdf,_0x2f9b6c){return new BPromise(function(_0x3f43f5,_0x4adc0a){return client[_0x6ebe('0x11')](_0x81fa22,_0x2f9b6c)[_0x6ebe('0x12')](function(_0x332858){logger[_0x6ebe('0x13')](_0x6ebe('0x14'),_0x37cbdf,_0x6ebe('0x15'));logger[_0x6ebe('0x16')](_0x6ebe('0x17'),_0x37cbdf,'request\x20sent',JSON[_0x6ebe('0x18')](_0x332858));if(_0x332858['error']){if(_0x332858[_0x6ebe('0x19')][_0x6ebe('0x1a')]===0x1f4){logger['error'](_0x6ebe('0x14'),_0x37cbdf,_0x332858[_0x6ebe('0x19')][_0x6ebe('0x1b')]);return _0x4adc0a(_0x332858[_0x6ebe('0x19')][_0x6ebe('0x1b')]);}logger[_0x6ebe('0x19')](_0x6ebe('0x14'),_0x37cbdf,_0x332858[_0x6ebe('0x19')][_0x6ebe('0x1b')]);return _0x3f43f5(_0x332858['error']['message']);}else{logger[_0x6ebe('0x13')]('MailQueue,\x20%s,\x20%s',_0x37cbdf,'request\x20sent');_0x3f43f5(_0x332858[_0x6ebe('0x1c')][_0x6ebe('0x1b')]);}})[_0x6ebe('0x1d')](function(_0x4a329b){logger[_0x6ebe('0x19')](_0x6ebe('0x14'),_0x37cbdf,_0x4a329b);_0x4adc0a(_0x4a329b);});});}exports['GetMailQueue']=function(_0xe50b88){var _0xbbe58d=this;return new Promise(function(_0x58c124,_0x50de75){return db['MailQueue'][_0x6ebe('0x1e')]({'raw':_0xe50b88[_0x6ebe('0x1f')]?_0xe50b88[_0x6ebe('0x1f')][_0x6ebe('0x20')]===undefined?!![]:![]:!![],'where':_0xe50b88[_0x6ebe('0x1f')]?_0xe50b88[_0x6ebe('0x1f')][_0x6ebe('0x21')]||null:null,'attributes':_0xe50b88[_0x6ebe('0x1f')]?_0xe50b88[_0x6ebe('0x1f')]['attributes']||null:null,'limit':_0xe50b88[_0x6ebe('0x1f')]?_0xe50b88['options'][_0x6ebe('0x22')]||null:null,'include':_0xe50b88[_0x6ebe('0x1f')]?_0xe50b88['options'][_0x6ebe('0x23')]?_[_0x6ebe('0x24')](_0xe50b88['options'][_0x6ebe('0x23')],function(_0x225267){return{'model':db[_0x225267[_0x6ebe('0x25')]],'as':_0x225267['as'],'attributes':_0x225267['attributes'],'include':_0x225267[_0x6ebe('0x23')]?_['map'](_0x225267[_0x6ebe('0x23')],function(_0x5ab718){return{'model':db[_0x5ab718[_0x6ebe('0x25')]],'as':_0x5ab718['as'],'attributes':_0x5ab718[_0x6ebe('0x26')],'include':_0x5ab718[_0x6ebe('0x23')]?_[_0x6ebe('0x24')](_0x5ab718[_0x6ebe('0x23')],function(_0x3ddd78){return{'model':db[_0x3ddd78[_0x6ebe('0x25')]],'as':_0x3ddd78['as'],'attributes':_0x3ddd78[_0x6ebe('0x26')]};}):[]};}):[]};}):[]:[]})[_0x6ebe('0x12')](function(_0x131c9b){logger[_0x6ebe('0x13')](_0x6ebe('0x27'),_0xe50b88);logger['debug'](_0x6ebe('0x27'),_0xe50b88,JSON[_0x6ebe('0x18')](_0x131c9b));_0x58c124(_0x131c9b);})['catch'](function(_0x161ce6){logger[_0x6ebe('0x19')](_0x6ebe('0x27'),_0x161ce6[_0x6ebe('0x1b')],_0xe50b88);_0x50de75(_0xbbe58d['error'](0x1f4,_0x161ce6['message']));});});};exports['ShowMailQueue']=function(_0x22a713){var _0x531888=this;return new Promise(function(_0x3f83ab,_0x4d88c8){return db[_0x6ebe('0x28')][_0x6ebe('0x29')]({'raw':_0x22a713[_0x6ebe('0x1f')]?_0x22a713[_0x6ebe('0x1f')][_0x6ebe('0x20')]===undefined?!![]:![]:!![],'where':_0x22a713[_0x6ebe('0x1f')]?_0x22a713[_0x6ebe('0x1f')][_0x6ebe('0x21')]||null:null,'attributes':_0x22a713[_0x6ebe('0x1f')]?_0x22a713[_0x6ebe('0x1f')][_0x6ebe('0x26')]||null:null,'include':_0x22a713[_0x6ebe('0x1f')]?_0x22a713[_0x6ebe('0x1f')][_0x6ebe('0x23')]?_['map'](_0x22a713['options'][_0x6ebe('0x23')],function(_0x997a1){return{'model':db[_0x997a1[_0x6ebe('0x25')]],'as':_0x997a1['as'],'attributes':_0x997a1[_0x6ebe('0x26')],'include':_0x997a1[_0x6ebe('0x23')]?_[_0x6ebe('0x24')](_0x997a1[_0x6ebe('0x23')],function(_0x2d0893){return{'model':db[_0x2d0893[_0x6ebe('0x25')]],'as':_0x2d0893['as'],'attributes':_0x2d0893[_0x6ebe('0x26')],'include':_0x2d0893[_0x6ebe('0x23')]?_['map'](_0x2d0893['include'],function(_0x4cf4b8){return{'model':db[_0x4cf4b8[_0x6ebe('0x25')]],'as':_0x4cf4b8['as'],'attributes':_0x4cf4b8[_0x6ebe('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28bb18){logger['info'](_0x6ebe('0x2a'),_0x22a713);logger[_0x6ebe('0x16')](_0x6ebe('0x2a'),_0x22a713,JSON[_0x6ebe('0x18')](_0x28bb18));_0x3f83ab(_0x28bb18);})['catch'](function(_0x5365c1){logger['error'](_0x6ebe('0x2a'),_0x5365c1['message'],_0x22a713);_0x4d88c8(_0x531888[_0x6ebe('0x19')](0x1f4,_0x5365c1[_0x6ebe('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 687c82f..8859d4a 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 _0xbc90=['removeListener','register','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc90,0xee));var _0x0bc9=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbc90[_0x465028];return _0xb783d4;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x0bc9('0x0'),_0x0bc9('0x1'),'update'];function createListener(_0x1201a6,_0x437e7d){return function(_0x30ccf3){_0x437e7d['emit'](_0x1201a6,_0x30ccf3);};}function removeListener(_0x319a2c,_0x26690b){return function(){MailQueueEvents[_0x0bc9('0x2')](_0x319a2c,_0x26690b);};}exports[_0x0bc9('0x3')]=function(_0x3b1dd7){for(var _0x430e6f=0x0,_0x55ba33=events['length'];_0x430e6f<_0x55ba33;_0x430e6f++){var _0x248b1a=events[_0x430e6f];var _0x989c6a=createListener('mailQueue:'+_0x248b1a,_0x3b1dd7);MailQueueEvents['on'](_0x248b1a,_0x989c6a);}}; \ No newline at end of file +var _0x0641=['length','./mailQueue.events','save','remove','update','emit','register'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x0641,0x1ac));var _0x1064=function(_0x57c538,_0x499b3f){_0x57c538=_0x57c538-0x0;var _0x230956=_0x0641[_0x57c538];return _0x230956;};'use strict';var MailQueueEvents=require(_0x1064('0x0'));var events=[_0x1064('0x1'),_0x1064('0x2'),_0x1064('0x3')];function createListener(_0x5ed10b,_0x59a0f4){return function(_0x3338bf){_0x59a0f4[_0x1064('0x4')](_0x5ed10b,_0x3338bf);};}function removeListener(_0xa0bcd,_0x143f56){return function(){MailQueueEvents['removeListener'](_0xa0bcd,_0x143f56);};}exports[_0x1064('0x5')]=function(_0x57b6b0){for(var _0x2a508d=0x0,_0x97a1f2=events[_0x1064('0x6')];_0x2a508d<_0x97a1f2;_0x2a508d++){var _0x2aff10=events[_0x2a508d];var _0x441998=createListener('mailQueue:'+_0x2aff10,_0x57b6b0);MailQueueEvents['on'](_0x2aff10,_0x441998);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 7ad3924..4c52baa 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 _0x15f7=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','/describe','describe','isAuthenticated','post','create','put','delete','/:id','exports','multer'];(function(_0x176308,_0x5b4d58){var _0x545160=function(_0x3a52a3){while(--_0x3a52a3){_0x176308['push'](_0x176308['shift']());}};_0x545160(++_0x5b4d58);}(_0x15f7,0xa1));var _0x715f=function(_0x547add,_0x387042){_0x547add=_0x547add-0x0;var _0x2ed1f3=_0x15f7[_0x547add];return _0x2ed1f3;};'use strict';var multer=require(_0x715f('0x0'));var util=require(_0x715f('0x1'));var path=require(_0x715f('0x2'));var timeout=require(_0x715f('0x3'));var express=require(_0x715f('0x4'));var router=express[_0x715f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x715f('0x6'));var interaction=require(_0x715f('0x7'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x715f('0x8')](_0x715f('0x9'),auth['isAuthenticated'](),controller[_0x715f('0xa')]);router[_0x715f('0x8')]('/:id',auth[_0x715f('0xb')](),controller['show']);router[_0x715f('0xc')]('/',auth[_0x715f('0xb')](),controller[_0x715f('0xd')]);router[_0x715f('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x715f('0xf')](_0x715f('0x10'),auth[_0x715f('0xb')](),controller['destroy']);module[_0x715f('0x11')]=router; \ No newline at end of file +var _0xd97d=['/:id','update','delete','multer','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','describe'];(function(_0x278fc3,_0x5992eb){var _0x1ac4a5=function(_0xa6ef4e){while(--_0xa6ef4e){_0x278fc3['push'](_0x278fc3['shift']());}};_0x1ac4a5(++_0x5992eb);}(_0xd97d,0x1a3));var _0xdd97=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0xd97d[_0x59bcb1];return _0x4a737f;};'use strict';var multer=require(_0xdd97('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdd97('0x1')]();var fs_extra=require(_0xdd97('0x2'));var auth=require(_0xdd97('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xdd97('0x4'));var controller=require(_0xdd97('0x5'));router[_0xdd97('0x6')]('/',auth[_0xdd97('0x7')](),controller[_0xdd97('0x8')]);router[_0xdd97('0x6')]('/describe',auth[_0xdd97('0x7')](),controller[_0xdd97('0x9')]);router['get'](_0xdd97('0xa'),auth[_0xdd97('0x7')](),controller['show']);router['post']('/',auth[_0xdd97('0x7')](),controller['create']);router['put']('/:id',auth[_0xdd97('0x7')](),controller[_0xdd97('0xb')]);router[_0xdd97('0xc')](_0xdd97('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index f5fb94b..ed661d4 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 _0x5e69=['STRING','DATE','moment','sequelize','exports'];(function(_0x236696,_0x2e0d3d){var _0x563194=function(_0x442453){while(--_0x442453){_0x236696['push'](_0x236696['shift']());}};_0x563194(++_0x2e0d3d);}(_0x5e69,0x147));var _0x95e6=function(_0x5f08a6,_0x400121){_0x5f08a6=_0x5f08a6-0x0;var _0x5d0641=_0x5e69[_0x5f08a6];return _0x5d0641;};'use strict';var moment=require(_0x95e6('0x0'));var Sequelize=require(_0x95e6('0x1'));module[_0x95e6('0x2')]={'uniqueid':{'type':Sequelize[_0x95e6('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x95e6('0x3')]},'joinAt':{'type':Sequelize[_0x95e6('0x4')]},'leaveAt':{'type':Sequelize[_0x95e6('0x4')]},'acceptAt':{'type':Sequelize[_0x95e6('0x4')]},'exitAt':{'type':Sequelize[_0x95e6('0x4')]},'reason':{'type':Sequelize[_0x95e6('0x3')]}}; \ No newline at end of file +var _0xc155=['STRING','DATE','moment','sequelize','exports'];(function(_0x5b7349,_0x5ade11){var _0x43c4f8=function(_0x2b206f){while(--_0x2b206f){_0x5b7349['push'](_0x5b7349['shift']());}};_0x43c4f8(++_0x5ade11);}(_0xc155,0x16a));var _0x5c15=function(_0x18990f,_0x5825dd){_0x18990f=_0x18990f-0x0;var _0xea6cbc=_0xc155[_0x18990f];return _0xea6cbc;};'use strict';var moment=require(_0x5c15('0x0'));var Sequelize=require(_0x5c15('0x1'));module[_0x5c15('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5c15('0x3')]},'joinAt':{'type':Sequelize[_0x5c15('0x4')]},'leaveAt':{'type':Sequelize[_0x5c15('0x4')]},'acceptAt':{'type':Sequelize[_0x5c15('0x4')]},'exitAt':{'type':Sequelize[_0x5c15('0x4')]},'reason':{'type':Sequelize[_0x5c15('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 8ad6cd1..c0f4490 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 _0xd117=['filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','MailQueueReport','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1e09af,_0x43ec32){var _0x25177c=function(_0x2ba917){while(--_0x2ba917){_0x1e09af['push'](_0x1e09af['shift']());}};_0x25177c(++_0x43ec32);}(_0xd117,0x182));var _0x7d11=function(_0x43c3f9,_0x1861cb){_0x43c3f9=_0x43c3f9-0x0;var _0x4f4f54=_0xd117[_0x43c3f9];return _0x4f4f54;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require(_0x7d11('0x2'));var jsonpatch=require(_0x7d11('0x3'));var rp=require(_0x7d11('0x4'));var moment=require(_0x7d11('0x5'));var BPromise=require(_0x7d11('0x6'));var Mustache=require(_0x7d11('0x7'));var util=require(_0x7d11('0x8'));var path=require(_0x7d11('0x9'));var sox=require(_0x7d11('0xa'));var csv=require(_0x7d11('0xb'));var ejs=require(_0x7d11('0xc'));var fs=require('fs');var fs_extra=require(_0x7d11('0xd'));var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xb'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var Redis=require(_0x7d11('0x13'));var authService=require(_0x7d11('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7d11('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d11('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d11('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4767d5,_0x471f46){_0x471f46=_0x471f46||0xcc;return function(_0x5ee572){if(_0x5ee572){return _0x4767d5[_0x7d11('0x18')](_0x471f46);}return _0x4767d5[_0x7d11('0x19')](_0x471f46)['end']();};}function respondWithResult(_0x324de5,_0x16949d){_0x16949d=_0x16949d||0xc8;return function(_0x20a2df){if(_0x20a2df){return _0x324de5[_0x7d11('0x19')](_0x16949d)[_0x7d11('0x1a')](_0x20a2df);}};}function respondWithFilteredResult(_0xeae744,_0x2a269e){return function(_0xb1669e){if(_0xb1669e){var _0x4aa795=typeof _0x2a269e[_0x7d11('0x1b')]===_0x7d11('0x1c')&&typeof _0x2a269e[_0x7d11('0x1d')]===_0x7d11('0x1c');var _0x45f916=_0xb1669e['count'];var _0x456cb9=_0x4aa795?0x0:_0x2a269e[_0x7d11('0x1b')];var _0x4d1306=_0x4aa795?_0xb1669e['count']:_0x2a269e[_0x7d11('0x1b')]+_0x2a269e['limit'];var _0x1f9990;if(_0x4d1306>=_0x45f916){_0x4d1306=_0x45f916;_0x1f9990=0xc8;}else{_0x1f9990=0xce;}_0xeae744['status'](_0x1f9990);return _0xeae744[_0x7d11('0x1e')](_0x7d11('0x1f'),_0x456cb9+'-'+_0x4d1306+'/'+_0x45f916)[_0x7d11('0x1a')](_0xb1669e);}return null;};}function patchUpdates(_0x46f662){return function(_0x30df70){try{jsonpatch[_0x7d11('0x20')](_0x30df70,_0x46f662,!![]);}catch(_0x4297f8){return BPromise[_0x7d11('0x21')](_0x4297f8);}return _0x30df70['save']();};}function saveUpdates(_0x441917,_0x4a34f4){return function(_0x58455b){if(_0x58455b){return _0x58455b['update'](_0x441917)[_0x7d11('0x22')](function(_0x3545dc){return _0x3545dc;});}return null;};}function removeEntity(_0x44476c,_0x1a7853){return function(_0x355d14){if(_0x355d14){return _0x355d14[_0x7d11('0x23')]()[_0x7d11('0x22')](function(){_0x44476c[_0x7d11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c2b4,_0x577ca9){return function(_0x4bfa76){if(!_0x4bfa76){_0x36c2b4['sendStatus'](0x194);}return _0x4bfa76;};}function handleError(_0x3ba092,_0x59cdba){_0x59cdba=_0x59cdba||0x1f4;return function(_0x180e1e){logger[_0x7d11('0x24')](_0x180e1e[_0x7d11('0x25')]);if(_0x180e1e['name']){delete _0x180e1e[_0x7d11('0x26')];}_0x3ba092[_0x7d11('0x19')](_0x59cdba)[_0x7d11('0x27')](_0x180e1e);};}exports['index']=function(_0x601650,_0x35a789){var _0x18c049={},_0x38f1be={},_0x4c7d6a={'count':0x0,'rows':[]};var _0x1a7745=_['map'](db[_0x7d11('0x28')]['rawAttributes'],function(_0x31866d){return{'name':_0x31866d[_0x7d11('0x29')],'type':_0x31866d[_0x7d11('0x2a')]['key']};});_0x38f1be['model']=_[_0x7d11('0x2b')](_0x1a7745,_0x7d11('0x26'));_0x38f1be['query']=_[_0x7d11('0x2c')](_0x601650[_0x7d11('0x2d')]);_0x38f1be[_0x7d11('0x2e')]=_['intersection'](_0x38f1be[_0x7d11('0x2f')],_0x38f1be['query']);_0x18c049['attributes']=_[_0x7d11('0x30')](_0x38f1be['model'],qs[_0x7d11('0x31')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x31')]));_0x18c049[_0x7d11('0x32')]=_0x18c049['attributes'][_0x7d11('0x33')]?_0x18c049[_0x7d11('0x32')]:_0x38f1be['model'];if(!_0x601650['query'][_0x7d11('0x34')](_0x7d11('0x35'))){_0x18c049['limit']=qs[_0x7d11('0x1d')](_0x601650['query']['limit']);_0x18c049[_0x7d11('0x1b')]=qs['offset'](_0x601650['query'][_0x7d11('0x1b')]);}_0x18c049[_0x7d11('0x36')]=qs[_0x7d11('0x37')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x37')]);_0x18c049[_0x7d11('0x38')]=qs[_0x7d11('0x2e')](_[_0x7d11('0x39')](_0x601650[_0x7d11('0x2d')],_0x38f1be[_0x7d11('0x2e')]),_0x1a7745);if(_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]){_0x18c049['where']=_[_0x7d11('0x3b')](_0x18c049['where'],{'$or':_[_0x7d11('0x2b')](_0x1a7745,function(_0x111e26){if(_0x111e26[_0x7d11('0x2a')]!==_0x7d11('0x3c')){var _0x4f8fd2={};_0x4f8fd2[_0x111e26[_0x7d11('0x26')]]={'$like':'%'+_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]+'%'};return _0x4f8fd2;}})});}_0x18c049=_[_0x7d11('0x3b')]({},_0x18c049,_0x601650['options']);var _0x22730e={'where':_0x18c049['where']};return db[_0x7d11('0x28')]['count'](_0x22730e)[_0x7d11('0x22')](function(_0x622725){_0x4c7d6a[_0x7d11('0x3d')]=_0x622725;if(_0x601650[_0x7d11('0x2d')]['includeAll']){_0x18c049['include']=[{'all':!![]}];}return db[_0x7d11('0x28')][_0x7d11('0x3e')](_0x18c049);})['then'](function(_0x1caef9){_0x4c7d6a[_0x7d11('0x3f')]=_0x1caef9;return _0x4c7d6a;})[_0x7d11('0x22')](respondWithFilteredResult(_0x35a789,_0x18c049))[_0x7d11('0x40')](handleError(_0x35a789,null));};exports[_0x7d11('0x41')]=function(_0x2e1647,_0x47e968){var _0x25b73b={'raw':!![],'where':{'id':_0x2e1647[_0x7d11('0x42')]['id']}},_0x5cf6a6={};_0x5cf6a6[_0x7d11('0x2f')]=_[_0x7d11('0x2c')](db[_0x7d11('0x28')][_0x7d11('0x43')]);_0x5cf6a6[_0x7d11('0x2d')]=_['keys'](_0x2e1647['query']);_0x5cf6a6['filters']=_[_0x7d11('0x30')](_0x5cf6a6[_0x7d11('0x2f')],_0x5cf6a6[_0x7d11('0x2d')]);_0x25b73b[_0x7d11('0x32')]=_[_0x7d11('0x30')](_0x5cf6a6['model'],qs[_0x7d11('0x31')](_0x2e1647[_0x7d11('0x2d')]['fields']));_0x25b73b[_0x7d11('0x32')]=_0x25b73b[_0x7d11('0x32')][_0x7d11('0x33')]?_0x25b73b['attributes']:_0x5cf6a6[_0x7d11('0x2f')];if(_0x2e1647[_0x7d11('0x2d')][_0x7d11('0x44')]){_0x25b73b['include']=[{'all':!![]}];}_0x25b73b=_[_0x7d11('0x3b')]({},_0x25b73b,_0x2e1647['options']);return db[_0x7d11('0x28')][_0x7d11('0x45')](_0x25b73b)[_0x7d11('0x22')](handleEntityNotFound(_0x47e968,null))[_0x7d11('0x22')](respondWithResult(_0x47e968,null))[_0x7d11('0x40')](handleError(_0x47e968,null));};exports[_0x7d11('0x46')]=function(_0x161213,_0x193631){return db[_0x7d11('0x28')]['create'](_0x161213['body'],{})['then'](respondWithResult(_0x193631,0xc9))[_0x7d11('0x40')](handleError(_0x193631,null));};exports[_0x7d11('0x47')]=function(_0x20297a,_0x18ae0e){if(_0x20297a[_0x7d11('0x48')]['id']){delete _0x20297a[_0x7d11('0x48')]['id'];}return db[_0x7d11('0x28')][_0x7d11('0x45')]({'where':{'id':_0x20297a[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x18ae0e,null))[_0x7d11('0x22')](saveUpdates(_0x20297a[_0x7d11('0x48')],null))['then'](respondWithResult(_0x18ae0e,null))[_0x7d11('0x40')](handleError(_0x18ae0e,null));};exports[_0x7d11('0x23')]=function(_0x29207f,_0x553a03){return db['MailQueueReport'][_0x7d11('0x45')]({'where':{'id':_0x29207f[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x553a03,null))['then'](removeEntity(_0x553a03,null))['catch'](handleError(_0x553a03,null));};exports[_0x7d11('0x49')]=function(_0x36af2b,_0x5e6234){return db[_0x7d11('0x28')][_0x7d11('0x49')]()[_0x7d11('0x22')](respondWithResult(_0x5e6234,null))[_0x7d11('0x40')](handleError(_0x5e6234,null));}; \ No newline at end of file +var _0x6050=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','name','send','index','map','MailQueueReport','rawAttributes','type','key','model','query','keys'];(function(_0x2bdf1d,_0x5c0ad5){var _0x328abf=function(_0x549c38){while(--_0x549c38){_0x2bdf1d['push'](_0x2bdf1d['shift']());}};_0x328abf(++_0x5c0ad5);}(_0x6050,0x196));var _0x0605=function(_0x11991b,_0x1b05ea){_0x11991b=_0x11991b-0x0;var _0x487808=_0x6050[_0x11991b];return _0x487808;};'use strict';var emlformat=require(_0x0605('0x0'));var rimraf=require(_0x0605('0x1'));var zipdir=require(_0x0605('0x2'));var jsonpatch=require(_0x0605('0x3'));var rp=require(_0x0605('0x4'));var moment=require(_0x0605('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0605('0x6'));var util=require(_0x0605('0x7'));var path=require(_0x0605('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0605('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0605('0xa'));var deskjs=require(_0x0605('0xb'));var toCsv=require(_0x0605('0xc'));var querystring=require(_0x0605('0xd'));var Papa=require(_0x0605('0xe'));var Redis=require('ioredis');var authService=require(_0x0605('0xf'));var qs=require(_0x0605('0x10'));var as=require(_0x0605('0x11'));var hardwareService=require(_0x0605('0x12'));var logger=require(_0x0605('0x13'))(_0x0605('0x14'));var utils=require(_0x0605('0x15'));var config=require(_0x0605('0x16'));var licenseUtil=require(_0x0605('0x17'));var db=require(_0x0605('0x18'))['db'];function respondWithStatusCode(_0xd22e35,_0x39e288){_0x39e288=_0x39e288||0xcc;return function(_0x34c9e6){if(_0x34c9e6){return _0xd22e35[_0x0605('0x19')](_0x39e288);}return _0xd22e35[_0x0605('0x1a')](_0x39e288)[_0x0605('0x1b')]();};}function respondWithResult(_0x169a70,_0x65a20b){_0x65a20b=_0x65a20b||0xc8;return function(_0x1b944f){if(_0x1b944f){return _0x169a70['status'](_0x65a20b)[_0x0605('0x1c')](_0x1b944f);}};}function respondWithFilteredResult(_0x1a802b,_0x4993ab){return function(_0x5ce56a){if(_0x5ce56a){var _0x4eefe9=typeof _0x4993ab[_0x0605('0x1d')]===_0x0605('0x1e')&&typeof _0x4993ab[_0x0605('0x1f')]===_0x0605('0x1e');var _0xefc557=_0x5ce56a[_0x0605('0x20')];var _0x2b7b5a=_0x4eefe9?0x0:_0x4993ab[_0x0605('0x1d')];var _0x193520=_0x4eefe9?_0x5ce56a[_0x0605('0x20')]:_0x4993ab[_0x0605('0x1d')]+_0x4993ab[_0x0605('0x1f')];var _0x2e2204;if(_0x193520>=_0xefc557){_0x193520=_0xefc557;_0x2e2204=0xc8;}else{_0x2e2204=0xce;}_0x1a802b[_0x0605('0x1a')](_0x2e2204);return _0x1a802b['set'](_0x0605('0x21'),_0x2b7b5a+'-'+_0x193520+'/'+_0xefc557)[_0x0605('0x1c')](_0x5ce56a);}return null;};}function patchUpdates(_0x430f28){return function(_0x443326){try{jsonpatch[_0x0605('0x22')](_0x443326,_0x430f28,!![]);}catch(_0x90b2e1){return BPromise[_0x0605('0x23')](_0x90b2e1);}return _0x443326[_0x0605('0x24')]();};}function saveUpdates(_0x226ef5,_0x5b0d44){return function(_0xc334b8){if(_0xc334b8){return _0xc334b8['update'](_0x226ef5)[_0x0605('0x25')](function(_0x118e9c){return _0x118e9c;});}return null;};}function removeEntity(_0x110098,_0xf182c4){return function(_0x10c575){if(_0x10c575){return _0x10c575[_0x0605('0x26')]()[_0x0605('0x25')](function(){_0x110098[_0x0605('0x1a')](0xcc)[_0x0605('0x1b')]();});}};}function handleEntityNotFound(_0x2896d7,_0x9f2833){return function(_0x1c3722){if(!_0x1c3722){_0x2896d7['sendStatus'](0x194);}return _0x1c3722;};}function handleError(_0x6bc204,_0x3c8e36){_0x3c8e36=_0x3c8e36||0x1f4;return function(_0x4b1e0c){logger['error'](_0x4b1e0c['stack']);if(_0x4b1e0c[_0x0605('0x27')]){delete _0x4b1e0c[_0x0605('0x27')];}_0x6bc204[_0x0605('0x1a')](_0x3c8e36)[_0x0605('0x28')](_0x4b1e0c);};}exports[_0x0605('0x29')]=function(_0x4554df,_0x4e32ef){var _0x34f25d={},_0x5daef6={},_0xa836f2={'count':0x0,'rows':[]};var _0x3640b9=_[_0x0605('0x2a')](db[_0x0605('0x2b')][_0x0605('0x2c')],function(_0x352dd6){return{'name':_0x352dd6['fieldName'],'type':_0x352dd6[_0x0605('0x2d')][_0x0605('0x2e')]};});_0x5daef6[_0x0605('0x2f')]=_[_0x0605('0x2a')](_0x3640b9,_0x0605('0x27'));_0x5daef6[_0x0605('0x30')]=_[_0x0605('0x31')](_0x4554df[_0x0605('0x30')]);_0x5daef6[_0x0605('0x32')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],_0x5daef6[_0x0605('0x30')]);_0x34f25d[_0x0605('0x34')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x4554df[_0x0605('0x30')][_0x0605('0x35')]));_0x34f25d[_0x0605('0x34')]=_0x34f25d[_0x0605('0x34')][_0x0605('0x36')]?_0x34f25d[_0x0605('0x34')]:_0x5daef6[_0x0605('0x2f')];if(!_0x4554df[_0x0605('0x30')][_0x0605('0x37')](_0x0605('0x38'))){_0x34f25d[_0x0605('0x1f')]=qs['limit'](_0x4554df[_0x0605('0x30')][_0x0605('0x1f')]);_0x34f25d['offset']=qs[_0x0605('0x1d')](_0x4554df[_0x0605('0x30')]['offset']);}_0x34f25d[_0x0605('0x39')]=qs[_0x0605('0x3a')](_0x4554df[_0x0605('0x30')][_0x0605('0x3a')]);_0x34f25d[_0x0605('0x3b')]=qs[_0x0605('0x32')](_['pick'](_0x4554df['query'],_0x5daef6[_0x0605('0x32')]),_0x3640b9);if(_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]){_0x34f25d['where']=_[_0x0605('0x3d')](_0x34f25d['where'],{'$or':_[_0x0605('0x2a')](_0x3640b9,function(_0x1e98f6){if(_0x1e98f6[_0x0605('0x2d')]!==_0x0605('0x3e')){var _0x42f7ce={};_0x42f7ce[_0x1e98f6[_0x0605('0x27')]]={'$like':'%'+_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]+'%'};return _0x42f7ce;}})});}_0x34f25d=_[_0x0605('0x3d')]({},_0x34f25d,_0x4554df[_0x0605('0x3f')]);var _0x57aa15={'where':_0x34f25d[_0x0605('0x3b')]};return db['MailQueueReport'][_0x0605('0x20')](_0x57aa15)[_0x0605('0x25')](function(_0x45787e){_0xa836f2['count']=_0x45787e;if(_0x4554df['query'][_0x0605('0x40')]){_0x34f25d['include']=[{'all':!![]}];}return db[_0x0605('0x2b')][_0x0605('0x41')](_0x34f25d);})[_0x0605('0x25')](function(_0x3de34a){_0xa836f2[_0x0605('0x42')]=_0x3de34a;return _0xa836f2;})[_0x0605('0x25')](respondWithFilteredResult(_0x4e32ef,_0x34f25d))[_0x0605('0x43')](handleError(_0x4e32ef,null));};exports[_0x0605('0x44')]=function(_0x3fa553,_0x10bb36){var _0x18d3ce={'raw':!![],'where':{'id':_0x3fa553[_0x0605('0x45')]['id']}},_0x3616a3={};_0x3616a3['model']=_['keys'](db[_0x0605('0x2b')]['rawAttributes']);_0x3616a3[_0x0605('0x30')]=_[_0x0605('0x31')](_0x3fa553['query']);_0x3616a3[_0x0605('0x32')]=_[_0x0605('0x33')](_0x3616a3['model'],_0x3616a3[_0x0605('0x30')]);_0x18d3ce[_0x0605('0x34')]=_['intersection'](_0x3616a3[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x3fa553['query'][_0x0605('0x35')]));_0x18d3ce['attributes']=_0x18d3ce['attributes'][_0x0605('0x36')]?_0x18d3ce[_0x0605('0x34')]:_0x3616a3[_0x0605('0x2f')];if(_0x3fa553[_0x0605('0x30')][_0x0605('0x40')]){_0x18d3ce[_0x0605('0x46')]=[{'all':!![]}];}_0x18d3ce=_[_0x0605('0x3d')]({},_0x18d3ce,_0x3fa553[_0x0605('0x3f')]);return db['MailQueueReport'][_0x0605('0x47')](_0x18d3ce)[_0x0605('0x25')](handleEntityNotFound(_0x10bb36,null))[_0x0605('0x25')](respondWithResult(_0x10bb36,null))['catch'](handleError(_0x10bb36,null));};exports[_0x0605('0x48')]=function(_0x1fb70b,_0x45cc1a){return db[_0x0605('0x2b')][_0x0605('0x48')](_0x1fb70b[_0x0605('0x49')],{})[_0x0605('0x25')](respondWithResult(_0x45cc1a,0xc9))[_0x0605('0x43')](handleError(_0x45cc1a,null));};exports[_0x0605('0x4a')]=function(_0x4bc55e,_0x3c597c){if(_0x4bc55e[_0x0605('0x49')]['id']){delete _0x4bc55e[_0x0605('0x49')]['id'];}return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4bc55e[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x3c597c,null))[_0x0605('0x25')](saveUpdates(_0x4bc55e[_0x0605('0x49')],null))[_0x0605('0x25')](respondWithResult(_0x3c597c,null))['catch'](handleError(_0x3c597c,null));};exports['destroy']=function(_0x4876c7,_0x2687a8){return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4876c7[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x2687a8,null))[_0x0605('0x25')](removeEntity(_0x2687a8,null))['catch'](handleError(_0x2687a8,null));};exports[_0x0605('0x4b')]=function(_0x286485,_0x184232){return db[_0x0605('0x2b')]['describe']()[_0x0605('0x25')](respondWithResult(_0x184232,null))[_0x0605('0x43')](handleError(_0x184232,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index b81a2a8..9d5c6fa 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 _0x0d74=['path','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','util','bluebird','request-promise'];(function(_0x4cbfcd,_0x5d085e){var _0x43bc51=function(_0x4e9bd6){while(--_0x4e9bd6){_0x4cbfcd['push'](_0x4cbfcd['shift']());}};_0x43bc51(++_0x5d085e);}(_0x0d74,0x1c9));var _0x40d7=function(_0x17601d,_0x274052){_0x17601d=_0x17601d-0x0;var _0x3ab50a=_0x0d74[_0x17601d];return _0x3ab50a;};'use strict';var _=require('lodash');var util=require(_0x40d7('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x40d7('0x1'));var rp=require(_0x40d7('0x2'));var fs=require('fs');var path=require(_0x40d7('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x40d7('0x4'));module[_0x40d7('0x5')]=function(_0x98659b,_0x2035dc){return _0x98659b[_0x40d7('0x6')](_0x40d7('0x7'),attributes,{'tableName':_0x40d7('0x8'),'paranoid':![],'indexes':[{'name':_0x40d7('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8436=['rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x8436,0xd7));var _0x6843=function(_0x1636bb,_0x21621a){_0x1636bb=_0x1636bb-0x0;var _0x54d8bb=_0x8436[_0x1636bb];return _0x54d8bb;};'use strict';var _=require(_0x6843('0x0'));var util=require(_0x6843('0x1'));var logger=require('../../config/logger')(_0x6843('0x2'));var moment=require(_0x6843('0x3'));var BPromise=require(_0x6843('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6843('0x5'));var config=require(_0x6843('0x6'));var attributes=require(_0x6843('0x7'));module['exports']=function(_0x4b5f83,_0x316d8a){return _0x4b5f83[_0x6843('0x8')](_0x6843('0x9'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x6843('0xa'),'fields':[_0x6843('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index d129964..177e12a 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4a40da,_0x36432e){var _0x47dd15=function(_0x4f1357){while(--_0x4f1357){_0x4a40da['push'](_0x4a40da['shift']());}};_0x47dd15(++_0x36432e);}(_0x1261,0x144));var _0x1126=function(_0x305c93,_0x3421dc){_0x305c93=_0x305c93-0x0;var _0x5bae39=_0x1261[_0x305c93];return _0x5bae39;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file +var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x2514f7,_0x2f3f6a){var _0x47a88c=function(_0x4cf132){while(--_0x4cf132){_0x2514f7['push'](_0x2514f7['shift']());}};_0x47a88c(++_0x2f3f6a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xc4aa[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 6410ba1..08592b1 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x32dd6d,_0x4d0501){var _0x145b35=function(_0x521e62){while(--_0x521e62){_0x32dd6d['push'](_0x32dd6d['shift']());}};_0x145b35(++_0x4d0501);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x551bd8,_0x536959){var _0x41755d=function(_0x43f2b0){while(--_0x43f2b0){_0x551bd8['push'](_0x551bd8['shift']());}};_0x41755d(++_0x536959);}(_0x70e0,0x17b));var _0x070e=function(_0x59800a,_0x5239ed){_0x59800a=_0x59800a-0x0;var _0x1d1f0c=_0x70e0[_0x59800a];return _0x1d1f0c;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index a1be6a1..c6f5386 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 _0xbc09=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xbc09,0x179));var _0x9bc0=function(_0x3e9fa6,_0x416a05){_0x3e9fa6=_0x3e9fa6-0x0;var _0x573302=_0xbc09[_0x3e9fa6];return _0x573302;};'use strict';var Sequelize=require(_0x9bc0('0x0'));module[_0x9bc0('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x9bc0('0x2')]},'authentication':{'type':Sequelize[_0x9bc0('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x9bc0('0x2')]},'password':{'type':Sequelize[_0x9bc0('0x2')]},'port':{'type':Sequelize[_0x9bc0('0x4')]},'tls':{'type':Sequelize[_0x9bc0('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x9bc0('0x2')],'defaultValue':_0x9bc0('0x5')},'connTimeout':{'type':Sequelize[_0x9bc0('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x9bc0('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x9bc0('0x2')]},'modernAuthentication':{'type':Sequelize[_0x9bc0('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf325=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x25a7b1,_0x57d8f3){var _0x199615=function(_0x1d05e4){while(--_0x1d05e4){_0x25a7b1['push'](_0x25a7b1['shift']());}};_0x199615(++_0x57d8f3);}(_0xf325,0x73));var _0x5f32=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xf325[_0x1e4360];return _0x31e6b4;};'use strict';var Sequelize=require(_0x5f32('0x0'));module[_0x5f32('0x1')]={'description':{'type':Sequelize[_0x5f32('0x2')]},'host':{'type':Sequelize[_0x5f32('0x2')]},'authentication':{'type':Sequelize[_0x5f32('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x5f32('0x2')]},'password':{'type':Sequelize[_0x5f32('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x5f32('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x5f32('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x5f32('0x2')]},'modernAuthentication':{'type':Sequelize[_0x5f32('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 42ce9d1..2265cca 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 _0x1842=['../../config/environment','./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','lodash','util','../../config/logger','request-promise','rimraf'];(function(_0x471ebe,_0x19988a){var _0x557b4b=function(_0x353c89){while(--_0x353c89){_0x471ebe['push'](_0x471ebe['shift']());}};_0x557b4b(++_0x19988a);}(_0x1842,0xff));var _0x2184=function(_0x4263e8,_0x2b117e){_0x4263e8=_0x4263e8-0x0;var _0x3ca2cf=_0x1842[_0x4263e8];return _0x3ca2cf;};'use strict';var _=require(_0x2184('0x0'));var util=require(_0x2184('0x1'));var logger=require(_0x2184('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2184('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2184('0x4'));var config=require(_0x2184('0x5'));var attributes=require(_0x2184('0x6'));module[_0x2184('0x7')]=function(_0x1bddc8,_0x3212eb){return _0x1bddc8['define'](_0x2184('0x8'),attributes,{'tableName':_0x2184('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb65e=['define','MailServerIn','mail_servers_in','lodash','util','api','moment','../../config/environment'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0xb65e,0x1ab));var _0xeb65=function(_0x2abb65,_0x14f3fa){_0x2abb65=_0x2abb65-0x0;var _0x52e662=_0xb65e[_0x2abb65];return _0x52e662;};'use strict';var _=require(_0xeb65('0x0'));var util=require(_0xeb65('0x1'));var logger=require('../../config/logger')(_0xeb65('0x2'));var moment=require(_0xeb65('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(_0xeb65('0x4'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x205264,_0x331594){return _0x205264[_0xeb65('0x5')](_0xeb65('0x6'),attributes,{'tableName':_0xeb65('0x7'),'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 11c3214..7f1aa9c 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 _0x7f97=['map','model','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailServerIn,\x20%s,\x20%s','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','attributes','limit','include'];(function(_0xae1364,_0x44863f){var _0x55104f=function(_0x83d4f1){while(--_0x83d4f1){_0xae1364['push'](_0xae1364['shift']());}};_0x55104f(++_0x44863f);}(_0x7f97,0x157));var _0x77f9=function(_0x27ec0f,_0x563be5){_0x27ec0f=_0x27ec0f-0x0;var _0x40a56d=_0x7f97[_0x27ec0f];return _0x40a56d;};'use strict';var _=require('lodash');var util=require(_0x77f9('0x0'));var moment=require(_0x77f9('0x1'));var BPromise=require('bluebird');var rs=require(_0x77f9('0x2'));var fs=require('fs');var Redis=require(_0x77f9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x77f9('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x77f9('0x5'));var jayson=require(_0x77f9('0x6'));var client=jayson['client'][_0x77f9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1a833a,_0x29a7b4,_0x1be0b5){return new BPromise(function(_0x1d917a,_0x437964){return client[_0x77f9('0x8')](_0x1a833a,_0x1be0b5)[_0x77f9('0x9')](function(_0x1d2ae5){logger[_0x77f9('0xa')]('MailServerIn,\x20%s,\x20%s',_0x29a7b4,_0x77f9('0xb'));logger[_0x77f9('0xc')](_0x77f9('0xd'),_0x29a7b4,'request\x20sent',JSON[_0x77f9('0xe')](_0x1d2ae5));if(_0x1d2ae5[_0x77f9('0xf')]){if(_0x1d2ae5[_0x77f9('0xf')][_0x77f9('0x10')]===0x1f4){logger[_0x77f9('0xf')]('MailServerIn,\x20%s,\x20%s',_0x29a7b4,_0x1d2ae5[_0x77f9('0xf')][_0x77f9('0x11')]);return _0x437964(_0x1d2ae5[_0x77f9('0xf')][_0x77f9('0x11')]);}logger['error'](_0x77f9('0x12'),_0x29a7b4,_0x1d2ae5[_0x77f9('0xf')]['message']);return _0x1d917a(_0x1d2ae5[_0x77f9('0xf')][_0x77f9('0x11')]);}else{logger[_0x77f9('0xa')](_0x77f9('0x12'),_0x29a7b4,_0x77f9('0xb'));_0x1d917a(_0x1d2ae5[_0x77f9('0x13')][_0x77f9('0x11')]);}})[_0x77f9('0x14')](function(_0xa20f3e){logger[_0x77f9('0xf')](_0x77f9('0x12'),_0x29a7b4,_0xa20f3e);_0x437964(_0xa20f3e);});});}exports[_0x77f9('0x15')]=function(_0x1f139c){var _0x425290=this;return new Promise(function(_0x25d561,_0x3a2fdf){return db[_0x77f9('0x16')][_0x77f9('0x17')]({'raw':_0x1f139c[_0x77f9('0x18')]?_0x1f139c[_0x77f9('0x18')][_0x77f9('0x19')]===undefined?!![]:![]:!![],'where':_0x1f139c[_0x77f9('0x18')]?_0x1f139c['options']['where']||null:null,'attributes':_0x1f139c['options']?_0x1f139c['options'][_0x77f9('0x1a')]||null:null,'limit':_0x1f139c['options']?_0x1f139c[_0x77f9('0x18')][_0x77f9('0x1b')]||null:null,'include':_0x1f139c[_0x77f9('0x18')]?_0x1f139c[_0x77f9('0x18')][_0x77f9('0x1c')]?_[_0x77f9('0x1d')](_0x1f139c[_0x77f9('0x18')][_0x77f9('0x1c')],function(_0x47656d){return{'model':db[_0x47656d[_0x77f9('0x1e')]],'as':_0x47656d['as'],'attributes':_0x47656d[_0x77f9('0x1a')],'include':_0x47656d['include']?_['map'](_0x47656d[_0x77f9('0x1c')],function(_0x1bc63f){return{'model':db[_0x1bc63f[_0x77f9('0x1e')]],'as':_0x1bc63f['as'],'attributes':_0x1bc63f['attributes'],'include':_0x1bc63f[_0x77f9('0x1c')]?_[_0x77f9('0x1d')](_0x1bc63f[_0x77f9('0x1c')],function(_0x4ec346){return{'model':db[_0x4ec346['model']],'as':_0x4ec346['as'],'attributes':_0x4ec346[_0x77f9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x77f9('0x9')](function(_0x1d0186){logger[_0x77f9('0xa')](_0x77f9('0x15'),_0x1f139c);logger['debug']('GetMailServerIn',_0x1f139c,JSON['stringify'](_0x1d0186));_0x25d561(_0x1d0186);})['catch'](function(_0x5312a4){logger['error'](_0x77f9('0x15'),_0x5312a4[_0x77f9('0x11')],_0x1f139c);_0x3a2fdf(_0x425290[_0x77f9('0xf')](0x1f4,_0x5312a4['message']));});});}; \ No newline at end of file +var _0x2ba6=['MailServerIn','findAll','options','where','limit','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','MailServerIn,\x20%s,\x20%s','message','info','result','catch','GetMailServerIn'];(function(_0x4903e5,_0x2d50e2){var _0x553c4f=function(_0x210aac){while(--_0x210aac){_0x4903e5['push'](_0x4903e5['shift']());}};_0x553c4f(++_0x2d50e2);}(_0x2ba6,0x135));var _0x62ba=function(_0x231400,_0x5ab389){_0x231400=_0x231400-0x0;var _0x4dfc4e=_0x2ba6[_0x231400];return _0x4dfc4e;};'use strict';var _=require(_0x62ba('0x0'));var util=require(_0x62ba('0x1'));var moment=require(_0x62ba('0x2'));var BPromise=require(_0x62ba('0x3'));var rs=require(_0x62ba('0x4'));var fs=require('fs');var Redis=require(_0x62ba('0x5'));var db=require(_0x62ba('0x6'))['db'];var utils=require(_0x62ba('0x7'));var logger=require(_0x62ba('0x8'))('rpc');var config=require(_0x62ba('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x8f9618,_0x2c78e9,_0x4a3c6b){return new BPromise(function(_0x2d3397,_0x3bfd53){return client['request'](_0x8f9618,_0x4a3c6b)['then'](function(_0x4b19d3){logger['info']('MailServerIn,\x20%s,\x20%s',_0x2c78e9,_0x62ba('0xa'));logger[_0x62ba('0xb')](_0x62ba('0xc'),_0x2c78e9,_0x62ba('0xa'),JSON[_0x62ba('0xd')](_0x4b19d3));if(_0x4b19d3['error']){if(_0x4b19d3[_0x62ba('0xe')]['code']===0x1f4){logger[_0x62ba('0xe')](_0x62ba('0xf'),_0x2c78e9,_0x4b19d3[_0x62ba('0xe')][_0x62ba('0x10')]);return _0x3bfd53(_0x4b19d3[_0x62ba('0xe')][_0x62ba('0x10')]);}logger[_0x62ba('0xe')](_0x62ba('0xf'),_0x2c78e9,_0x4b19d3[_0x62ba('0xe')][_0x62ba('0x10')]);return _0x2d3397(_0x4b19d3['error'][_0x62ba('0x10')]);}else{logger[_0x62ba('0x11')](_0x62ba('0xf'),_0x2c78e9,'request\x20sent');_0x2d3397(_0x4b19d3[_0x62ba('0x12')][_0x62ba('0x10')]);}})[_0x62ba('0x13')](function(_0x371c24){logger[_0x62ba('0xe')](_0x62ba('0xf'),_0x2c78e9,_0x371c24);_0x3bfd53(_0x371c24);});});}exports[_0x62ba('0x14')]=function(_0x489b94){var _0x256f7a=this;return new Promise(function(_0x5913ee,_0x5c5cd3){return db[_0x62ba('0x15')][_0x62ba('0x16')]({'raw':_0x489b94[_0x62ba('0x17')]?_0x489b94['options']['raw']===undefined?!![]:![]:!![],'where':_0x489b94['options']?_0x489b94[_0x62ba('0x17')][_0x62ba('0x18')]||null:null,'attributes':_0x489b94[_0x62ba('0x17')]?_0x489b94[_0x62ba('0x17')]['attributes']||null:null,'limit':_0x489b94[_0x62ba('0x17')]?_0x489b94[_0x62ba('0x17')][_0x62ba('0x19')]||null:null,'include':_0x489b94[_0x62ba('0x17')]?_0x489b94[_0x62ba('0x17')][_0x62ba('0x1a')]?_[_0x62ba('0x1b')](_0x489b94[_0x62ba('0x17')][_0x62ba('0x1a')],function(_0x44438e){return{'model':db[_0x44438e[_0x62ba('0x1c')]],'as':_0x44438e['as'],'attributes':_0x44438e['attributes'],'include':_0x44438e['include']?_['map'](_0x44438e[_0x62ba('0x1a')],function(_0x1dd45b){return{'model':db[_0x1dd45b['model']],'as':_0x1dd45b['as'],'attributes':_0x1dd45b[_0x62ba('0x1d')],'include':_0x1dd45b[_0x62ba('0x1a')]?_[_0x62ba('0x1b')](_0x1dd45b[_0x62ba('0x1a')],function(_0x1ad93c){return{'model':db[_0x1ad93c[_0x62ba('0x1c')]],'as':_0x1ad93c['as'],'attributes':_0x1ad93c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x9b433f){logger['info'](_0x62ba('0x14'),_0x489b94);logger['debug'](_0x62ba('0x14'),_0x489b94,JSON['stringify'](_0x9b433f));_0x5913ee(_0x9b433f);})[_0x62ba('0x13')](function(_0x1f4602){logger['error'](_0x62ba('0x14'),_0x1f4602[_0x62ba('0x10')],_0x489b94);_0x5c5cd3(_0x256f7a[_0x62ba('0xe')](0x1f4,_0x1f4602[_0x62ba('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 2525c03..7f53288 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(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_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('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x7a54,0x106));var _0x47a5=function(_0x2f7bf6,_0xff298){_0x2f7bf6=_0x2f7bf6-0x0;var _0x3ffb0a=_0x7a54[_0x2f7bf6];return _0x3ffb0a;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 036ea33..fce254c 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 _0xa571=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x31404e,_0x36cba7){var _0x346994=function(_0xb441b){while(--_0xb441b){_0x31404e['push'](_0x31404e['shift']());}};_0x346994(++_0x36cba7);}(_0xa571,0x107));var _0x1a57=function(_0x4164ab,_0x46b3be){_0x4164ab=_0x4164ab-0x0;var _0x4f7810=_0xa571[_0x4164ab];return _0x4f7810;};'use strict';var Sequelize=require(_0x1a57('0x0'));module[_0x1a57('0x1')]={'description':{'type':Sequelize[_0x1a57('0x2')]},'host':{'type':Sequelize[_0x1a57('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x1a57('0x2')]},'port':{'type':Sequelize[_0x1a57('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x1a57('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0abf=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x2461f7,_0x42d91c){var _0x5525c3=function(_0x1674ea){while(--_0x1674ea){_0x2461f7['push'](_0x2461f7['shift']());}};_0x5525c3(++_0x42d91c);}(_0x0abf,0xe8));var _0xf0ab=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0abf[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0xf0ab('0x0'));module['exports']={'description':{'type':Sequelize[_0xf0ab('0x1')]},'host':{'type':Sequelize[_0xf0ab('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xf0ab('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xf0ab('0x1')]},'authentication':{'type':Sequelize[_0xf0ab('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xf0ab('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 34b604a..684b57a 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 _0xaa62=['options','includeAll','include','rows','params','length','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','where','VIRTUAL','filter','merge'];(function(_0x5868d1,_0x4542c8){var _0x378047=function(_0x1a5a36){while(--_0x1a5a36){_0x5868d1['push'](_0x5868d1['shift']());}};_0x378047(++_0x4542c8);}(_0xaa62,0x13f));var _0x2aa6=function(_0x2c6f1e,_0xe1bd5b){_0x2c6f1e=_0x2c6f1e-0x0;var _0x2f94bb=_0xaa62[_0x2c6f1e];return _0x2f94bb;};'use strict';var emlformat=require(_0x2aa6('0x0'));var rimraf=require(_0x2aa6('0x1'));var zipdir=require(_0x2aa6('0x2'));var jsonpatch=require(_0x2aa6('0x3'));var rp=require(_0x2aa6('0x4'));var moment=require(_0x2aa6('0x5'));var BPromise=require(_0x2aa6('0x6'));var Mustache=require(_0x2aa6('0x7'));var util=require(_0x2aa6('0x8'));var path=require(_0x2aa6('0x9'));var sox=require(_0x2aa6('0xa'));var csv=require('to-csv');var ejs=require(_0x2aa6('0xb'));var fs=require('fs');var fs_extra=require(_0x2aa6('0xc'));var _=require(_0x2aa6('0xd'));var squel=require('squel');var crypto=require(_0x2aa6('0xe'));var jsforce=require(_0x2aa6('0xf'));var deskjs=require(_0x2aa6('0x10'));var toCsv=require(_0x2aa6('0x11'));var querystring=require(_0x2aa6('0x12'));var Papa=require(_0x2aa6('0x13'));var Redis=require(_0x2aa6('0x14'));var authService=require(_0x2aa6('0x15'));var qs=require(_0x2aa6('0x16'));var as=require(_0x2aa6('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2aa6('0x18'));var licenseUtil=require(_0x2aa6('0x19'));var db=require(_0x2aa6('0x1a'))['db'];function respondWithStatusCode(_0x1cacd2,_0xa41440){_0xa41440=_0xa41440||0xcc;return function(_0x4af571){if(_0x4af571){return _0x1cacd2[_0x2aa6('0x1b')](_0xa41440);}return _0x1cacd2[_0x2aa6('0x1c')](_0xa41440)[_0x2aa6('0x1d')]();};}function respondWithResult(_0x276954,_0x5cf220){_0x5cf220=_0x5cf220||0xc8;return function(_0x31c892){if(_0x31c892){return _0x276954[_0x2aa6('0x1c')](_0x5cf220)[_0x2aa6('0x1e')](_0x31c892);}};}function respondWithFilteredResult(_0x7951ae,_0xa7bc15){return function(_0x4115b7){if(_0x4115b7){var _0x4ea3db=typeof _0xa7bc15[_0x2aa6('0x1f')]==='undefined'&&typeof _0xa7bc15[_0x2aa6('0x20')]==='undefined';var _0x4c7fb1=_0x4115b7[_0x2aa6('0x21')];var _0x3217c6=_0x4ea3db?0x0:_0xa7bc15[_0x2aa6('0x1f')];var _0x5191ea=_0x4ea3db?_0x4115b7[_0x2aa6('0x21')]:_0xa7bc15['offset']+_0xa7bc15[_0x2aa6('0x20')];var _0x6f36f0;if(_0x5191ea>=_0x4c7fb1){_0x5191ea=_0x4c7fb1;_0x6f36f0=0xc8;}else{_0x6f36f0=0xce;}_0x7951ae[_0x2aa6('0x1c')](_0x6f36f0);return _0x7951ae[_0x2aa6('0x22')](_0x2aa6('0x23'),_0x3217c6+'-'+_0x5191ea+'/'+_0x4c7fb1)[_0x2aa6('0x1e')](_0x4115b7);}return null;};}function patchUpdates(_0x43d99a){return function(_0x2b68c9){try{jsonpatch[_0x2aa6('0x24')](_0x2b68c9,_0x43d99a,!![]);}catch(_0x436662){return BPromise[_0x2aa6('0x25')](_0x436662);}return _0x2b68c9[_0x2aa6('0x26')]();};}function saveUpdates(_0x1c180e,_0x24e53f){return function(_0x5c3a3f){if(_0x5c3a3f){return _0x5c3a3f['update'](_0x1c180e)[_0x2aa6('0x27')](function(_0x2810b7){return _0x2810b7;});}return null;};}function removeEntity(_0x5642f7,_0x3582a5){return function(_0x1588fb){if(_0x1588fb){return _0x1588fb[_0x2aa6('0x28')]()[_0x2aa6('0x27')](function(){_0x5642f7['status'](0xcc)[_0x2aa6('0x1d')]();});}};}function handleEntityNotFound(_0xab37e4,_0x4caa35){return function(_0x2961d3){if(!_0x2961d3){_0xab37e4['sendStatus'](0x194);}return _0x2961d3;};}function handleError(_0x23cc02,_0xa899d8){_0xa899d8=_0xa899d8||0x1f4;return function(_0x3d129d){logger[_0x2aa6('0x29')](_0x3d129d[_0x2aa6('0x2a')]);if(_0x3d129d[_0x2aa6('0x2b')]){delete _0x3d129d[_0x2aa6('0x2b')];}_0x23cc02['status'](_0xa899d8)['send'](_0x3d129d);};}exports[_0x2aa6('0x2c')]=function(_0x1bb2a6,_0x58a6b7){var _0x4a4b34={},_0x3ce811={},_0x533eeb={'count':0x0,'rows':[]};var _0x31e808=_[_0x2aa6('0x2d')](db[_0x2aa6('0x2e')][_0x2aa6('0x2f')],function(_0x3c3ce1){return{'name':_0x3c3ce1[_0x2aa6('0x30')],'type':_0x3c3ce1[_0x2aa6('0x31')][_0x2aa6('0x32')]};});_0x3ce811[_0x2aa6('0x33')]=_['map'](_0x31e808,_0x2aa6('0x2b'));_0x3ce811['query']=_[_0x2aa6('0x34')](_0x1bb2a6['query']);_0x3ce811['filters']=_[_0x2aa6('0x35')](_0x3ce811[_0x2aa6('0x33')],_0x3ce811[_0x2aa6('0x36')]);_0x4a4b34[_0x2aa6('0x37')]=_[_0x2aa6('0x35')](_0x3ce811[_0x2aa6('0x33')],qs[_0x2aa6('0x38')](_0x1bb2a6[_0x2aa6('0x36')]['fields']));_0x4a4b34['attributes']=_0x4a4b34[_0x2aa6('0x37')]['length']?_0x4a4b34[_0x2aa6('0x37')]:_0x3ce811[_0x2aa6('0x33')];if(!_0x1bb2a6[_0x2aa6('0x36')][_0x2aa6('0x39')](_0x2aa6('0x3a'))){_0x4a4b34['limit']=qs['limit'](_0x1bb2a6[_0x2aa6('0x36')][_0x2aa6('0x20')]);_0x4a4b34['offset']=qs[_0x2aa6('0x1f')](_0x1bb2a6[_0x2aa6('0x36')][_0x2aa6('0x1f')]);}_0x4a4b34[_0x2aa6('0x3b')]=qs[_0x2aa6('0x3c')](_0x1bb2a6['query'][_0x2aa6('0x3c')]);_0x4a4b34['where']=qs[_0x2aa6('0x3d')](_['pick'](_0x1bb2a6['query'],_0x3ce811[_0x2aa6('0x3d')]),_0x31e808);if(_0x1bb2a6[_0x2aa6('0x36')]['filter']){_0x4a4b34[_0x2aa6('0x3e')]=_['merge'](_0x4a4b34[_0x2aa6('0x3e')],{'$or':_['map'](_0x31e808,function(_0x2bc37a){if(_0x2bc37a['type']!==_0x2aa6('0x3f')){var _0x5a7f00={};_0x5a7f00[_0x2bc37a[_0x2aa6('0x2b')]]={'$like':'%'+_0x1bb2a6[_0x2aa6('0x36')][_0x2aa6('0x40')]+'%'};return _0x5a7f00;}})});}_0x4a4b34=_[_0x2aa6('0x41')]({},_0x4a4b34,_0x1bb2a6[_0x2aa6('0x42')]);var _0x556f17={'where':_0x4a4b34[_0x2aa6('0x3e')]};return db[_0x2aa6('0x2e')]['count'](_0x556f17)['then'](function(_0x39b350){_0x533eeb[_0x2aa6('0x21')]=_0x39b350;if(_0x1bb2a6[_0x2aa6('0x36')][_0x2aa6('0x43')]){_0x4a4b34[_0x2aa6('0x44')]=[{'all':!![]}];}return db[_0x2aa6('0x2e')]['findAll'](_0x4a4b34);})[_0x2aa6('0x27')](function(_0x1990a7){_0x533eeb[_0x2aa6('0x45')]=_0x1990a7;return _0x533eeb;})['then'](respondWithFilteredResult(_0x58a6b7,_0x4a4b34))['catch'](handleError(_0x58a6b7,null));};exports['show']=function(_0x138008,_0x22dd4d){var _0x349786={'raw':!![],'where':{'id':_0x138008[_0x2aa6('0x46')]['id']}},_0x5f0173={};_0x5f0173[_0x2aa6('0x33')]=_[_0x2aa6('0x34')](db[_0x2aa6('0x2e')][_0x2aa6('0x2f')]);_0x5f0173['query']=_[_0x2aa6('0x34')](_0x138008[_0x2aa6('0x36')]);_0x5f0173[_0x2aa6('0x3d')]=_['intersection'](_0x5f0173[_0x2aa6('0x33')],_0x5f0173['query']);_0x349786['attributes']=_[_0x2aa6('0x35')](_0x5f0173['model'],qs[_0x2aa6('0x38')](_0x138008[_0x2aa6('0x36')]['fields']));_0x349786[_0x2aa6('0x37')]=_0x349786['attributes'][_0x2aa6('0x47')]?_0x349786[_0x2aa6('0x37')]:_0x5f0173[_0x2aa6('0x33')];if(_0x138008[_0x2aa6('0x36')][_0x2aa6('0x43')]){_0x349786[_0x2aa6('0x44')]=[{'all':!![]}];}_0x349786=_['merge']({},_0x349786,_0x138008[_0x2aa6('0x42')]);return db[_0x2aa6('0x2e')][_0x2aa6('0x48')](_0x349786)['then'](handleEntityNotFound(_0x22dd4d,null))[_0x2aa6('0x27')](respondWithResult(_0x22dd4d,null))[_0x2aa6('0x49')](handleError(_0x22dd4d,null));};exports[_0x2aa6('0x4a')]=function(_0x3338c1,_0x3b50eb){return db[_0x2aa6('0x2e')][_0x2aa6('0x4a')](_0x3338c1[_0x2aa6('0x4b')],{})[_0x2aa6('0x27')](respondWithResult(_0x3b50eb,0xc9))[_0x2aa6('0x49')](handleError(_0x3b50eb,null));};exports[_0x2aa6('0x4c')]=function(_0x3765c4,_0x548931){if(_0x3765c4['body']['id']){delete _0x3765c4[_0x2aa6('0x4b')]['id'];}return db[_0x2aa6('0x2e')][_0x2aa6('0x48')]({'where':{'id':_0x3765c4[_0x2aa6('0x46')]['id']}})['then'](handleEntityNotFound(_0x548931,null))[_0x2aa6('0x27')](saveUpdates(_0x3765c4[_0x2aa6('0x4b')],null))['then'](respondWithResult(_0x548931,null))[_0x2aa6('0x49')](handleError(_0x548931,null));};exports[_0x2aa6('0x28')]=function(_0x336202,_0x5e0b08){return db['MailServerOut'][_0x2aa6('0x48')]({'where':{'id':_0x336202[_0x2aa6('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e0b08,null))['then'](removeEntity(_0x5e0b08,null))[_0x2aa6('0x49')](handleError(_0x5e0b08,null));}; \ No newline at end of file +var _0xcdff=['../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','destroy','then','error','stack','name','send','index','rawAttributes','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','MailServerOut','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x2e5981,_0xe4e846){var _0x6e4fef=function(_0x252b0c){while(--_0x252b0c){_0x2e5981['push'](_0x2e5981['shift']());}};_0x6e4fef(++_0xe4e846);}(_0xcdff,0xfd));var _0xfcdf=function(_0x2d30da,_0x571401){_0x2d30da=_0x2d30da-0x0;var _0x1f0a3c=_0xcdff[_0x2d30da];return _0x1f0a3c;};'use strict';var emlformat=require(_0xfcdf('0x0'));var rimraf=require(_0xfcdf('0x1'));var zipdir=require(_0xfcdf('0x2'));var jsonpatch=require(_0xfcdf('0x3'));var rp=require(_0xfcdf('0x4'));var moment=require(_0xfcdf('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfcdf('0x6'));var sox=require('sox');var csv=require(_0xfcdf('0x7'));var ejs=require(_0xfcdf('0x8'));var fs=require('fs');var fs_extra=require(_0xfcdf('0x9'));var _=require(_0xfcdf('0xa'));var squel=require(_0xfcdf('0xb'));var crypto=require(_0xfcdf('0xc'));var jsforce=require(_0xfcdf('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfcdf('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfcdf('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfcdf('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcdf('0x10'));var logger=require(_0xfcdf('0x11'))(_0xfcdf('0x12'));var utils=require('../../config/utils');var config=require(_0xfcdf('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x141727,_0x5c9764){_0x5c9764=_0x5c9764||0xcc;return function(_0x5be45a){if(_0x5be45a){return _0x141727[_0xfcdf('0x14')](_0x5c9764);}return _0x141727[_0xfcdf('0x15')](_0x5c9764)[_0xfcdf('0x16')]();};}function respondWithResult(_0xffca45,_0x314f18){_0x314f18=_0x314f18||0xc8;return function(_0x145887){if(_0x145887){return _0xffca45[_0xfcdf('0x15')](_0x314f18)[_0xfcdf('0x17')](_0x145887);}};}function respondWithFilteredResult(_0x1e3b33,_0x5ebb08){return function(_0x5b7272){if(_0x5b7272){var _0x131a94=typeof _0x5ebb08[_0xfcdf('0x18')]==='undefined'&&typeof _0x5ebb08[_0xfcdf('0x19')]===_0xfcdf('0x1a');var _0x31884e=_0x5b7272[_0xfcdf('0x1b')];var _0x24abb5=_0x131a94?0x0:_0x5ebb08['offset'];var _0x2bdfbf=_0x131a94?_0x5b7272[_0xfcdf('0x1b')]:_0x5ebb08[_0xfcdf('0x18')]+_0x5ebb08[_0xfcdf('0x19')];var _0x1d4591;if(_0x2bdfbf>=_0x31884e){_0x2bdfbf=_0x31884e;_0x1d4591=0xc8;}else{_0x1d4591=0xce;}_0x1e3b33[_0xfcdf('0x15')](_0x1d4591);return _0x1e3b33[_0xfcdf('0x1c')](_0xfcdf('0x1d'),_0x24abb5+'-'+_0x2bdfbf+'/'+_0x31884e)[_0xfcdf('0x17')](_0x5b7272);}return null;};}function patchUpdates(_0x3eaae3){return function(_0x47b637){try{jsonpatch['apply'](_0x47b637,_0x3eaae3,!![]);}catch(_0x7fb9ae){return BPromise['reject'](_0x7fb9ae);}return _0x47b637[_0xfcdf('0x1e')]();};}function saveUpdates(_0x1dd98a,_0xd6d9e5){return function(_0x402901){if(_0x402901){return _0x402901[_0xfcdf('0x1f')](_0x1dd98a)['then'](function(_0x10931f){return _0x10931f;});}return null;};}function removeEntity(_0x736b90,_0x149d2e){return function(_0x34c9f6){if(_0x34c9f6){return _0x34c9f6[_0xfcdf('0x20')]()[_0xfcdf('0x21')](function(){_0x736b90[_0xfcdf('0x15')](0xcc)[_0xfcdf('0x16')]();});}};}function handleEntityNotFound(_0x52c73e,_0x2310c0){return function(_0x4f7a09){if(!_0x4f7a09){_0x52c73e['sendStatus'](0x194);}return _0x4f7a09;};}function handleError(_0x5dfb60,_0xdcc0fb){_0xdcc0fb=_0xdcc0fb||0x1f4;return function(_0xa0eb54){logger[_0xfcdf('0x22')](_0xa0eb54[_0xfcdf('0x23')]);if(_0xa0eb54[_0xfcdf('0x24')]){delete _0xa0eb54[_0xfcdf('0x24')];}_0x5dfb60[_0xfcdf('0x15')](_0xdcc0fb)[_0xfcdf('0x25')](_0xa0eb54);};}exports[_0xfcdf('0x26')]=function(_0x2be6a5,_0xbded0b){var _0x58a35d={},_0xa79134={},_0x3166db={'count':0x0,'rows':[]};var _0x2d0733=_['map'](db['MailServerOut'][_0xfcdf('0x27')],function(_0x28207d){return{'name':_0x28207d['fieldName'],'type':_0x28207d['type'][_0xfcdf('0x28')]};});_0xa79134[_0xfcdf('0x29')]=_[_0xfcdf('0x2a')](_0x2d0733,_0xfcdf('0x24'));_0xa79134[_0xfcdf('0x2b')]=_[_0xfcdf('0x2c')](_0x2be6a5[_0xfcdf('0x2b')]);_0xa79134[_0xfcdf('0x2d')]=_['intersection'](_0xa79134[_0xfcdf('0x29')],_0xa79134[_0xfcdf('0x2b')]);_0x58a35d[_0xfcdf('0x2e')]=_[_0xfcdf('0x2f')](_0xa79134[_0xfcdf('0x29')],qs[_0xfcdf('0x30')](_0x2be6a5[_0xfcdf('0x2b')]['fields']));_0x58a35d[_0xfcdf('0x2e')]=_0x58a35d[_0xfcdf('0x2e')][_0xfcdf('0x31')]?_0x58a35d['attributes']:_0xa79134['model'];if(!_0x2be6a5[_0xfcdf('0x2b')][_0xfcdf('0x32')](_0xfcdf('0x33'))){_0x58a35d[_0xfcdf('0x19')]=qs[_0xfcdf('0x19')](_0x2be6a5[_0xfcdf('0x2b')]['limit']);_0x58a35d['offset']=qs[_0xfcdf('0x18')](_0x2be6a5['query']['offset']);}_0x58a35d['order']=qs[_0xfcdf('0x34')](_0x2be6a5['query'][_0xfcdf('0x34')]);_0x58a35d[_0xfcdf('0x35')]=qs['filters'](_['pick'](_0x2be6a5[_0xfcdf('0x2b')],_0xa79134[_0xfcdf('0x2d')]),_0x2d0733);if(_0x2be6a5[_0xfcdf('0x2b')][_0xfcdf('0x36')]){_0x58a35d[_0xfcdf('0x35')]=_['merge'](_0x58a35d[_0xfcdf('0x35')],{'$or':_[_0xfcdf('0x2a')](_0x2d0733,function(_0x43e19d){if(_0x43e19d['type']!=='VIRTUAL'){var _0x55db30={};_0x55db30[_0x43e19d[_0xfcdf('0x24')]]={'$like':'%'+_0x2be6a5[_0xfcdf('0x2b')][_0xfcdf('0x36')]+'%'};return _0x55db30;}})});}_0x58a35d=_[_0xfcdf('0x37')]({},_0x58a35d,_0x2be6a5[_0xfcdf('0x38')]);var _0x567ba8={'where':_0x58a35d[_0xfcdf('0x35')]};return db['MailServerOut']['count'](_0x567ba8)[_0xfcdf('0x21')](function(_0xd1b638){_0x3166db[_0xfcdf('0x1b')]=_0xd1b638;if(_0x2be6a5[_0xfcdf('0x2b')][_0xfcdf('0x39')]){_0x58a35d[_0xfcdf('0x3a')]=[{'all':!![]}];}return db['MailServerOut'][_0xfcdf('0x3b')](_0x58a35d);})[_0xfcdf('0x21')](function(_0x347db5){_0x3166db[_0xfcdf('0x3c')]=_0x347db5;return _0x3166db;})[_0xfcdf('0x21')](respondWithFilteredResult(_0xbded0b,_0x58a35d))[_0xfcdf('0x3d')](handleError(_0xbded0b,null));};exports[_0xfcdf('0x3e')]=function(_0x40982d,_0x562f7c){var _0x180cbb={'raw':!![],'where':{'id':_0x40982d[_0xfcdf('0x3f')]['id']}},_0x1356e2={};_0x1356e2[_0xfcdf('0x29')]=_['keys'](db[_0xfcdf('0x40')][_0xfcdf('0x27')]);_0x1356e2[_0xfcdf('0x2b')]=_[_0xfcdf('0x2c')](_0x40982d['query']);_0x1356e2[_0xfcdf('0x2d')]=_['intersection'](_0x1356e2[_0xfcdf('0x29')],_0x1356e2[_0xfcdf('0x2b')]);_0x180cbb[_0xfcdf('0x2e')]=_[_0xfcdf('0x2f')](_0x1356e2[_0xfcdf('0x29')],qs[_0xfcdf('0x30')](_0x40982d['query'][_0xfcdf('0x30')]));_0x180cbb[_0xfcdf('0x2e')]=_0x180cbb[_0xfcdf('0x2e')][_0xfcdf('0x31')]?_0x180cbb[_0xfcdf('0x2e')]:_0x1356e2[_0xfcdf('0x29')];if(_0x40982d[_0xfcdf('0x2b')][_0xfcdf('0x39')]){_0x180cbb[_0xfcdf('0x3a')]=[{'all':!![]}];}_0x180cbb=_[_0xfcdf('0x37')]({},_0x180cbb,_0x40982d['options']);return db[_0xfcdf('0x40')]['find'](_0x180cbb)[_0xfcdf('0x21')](handleEntityNotFound(_0x562f7c,null))['then'](respondWithResult(_0x562f7c,null))[_0xfcdf('0x3d')](handleError(_0x562f7c,null));};exports[_0xfcdf('0x41')]=function(_0x5b2a16,_0x36a882){return db['MailServerOut'][_0xfcdf('0x41')](_0x5b2a16[_0xfcdf('0x42')],{})['then'](respondWithResult(_0x36a882,0xc9))[_0xfcdf('0x3d')](handleError(_0x36a882,null));};exports[_0xfcdf('0x1f')]=function(_0x33322c,_0x4725e2){if(_0x33322c['body']['id']){delete _0x33322c[_0xfcdf('0x42')]['id'];}return db[_0xfcdf('0x40')][_0xfcdf('0x43')]({'where':{'id':_0x33322c[_0xfcdf('0x3f')]['id']}})[_0xfcdf('0x21')](handleEntityNotFound(_0x4725e2,null))[_0xfcdf('0x21')](saveUpdates(_0x33322c[_0xfcdf('0x42')],null))[_0xfcdf('0x21')](respondWithResult(_0x4725e2,null))[_0xfcdf('0x3d')](handleError(_0x4725e2,null));};exports[_0xfcdf('0x20')]=function(_0x3177a1,_0x25fd39){return db['MailServerOut']['find']({'where':{'id':_0x3177a1[_0xfcdf('0x3f')]['id']}})[_0xfcdf('0x21')](handleEntityNotFound(_0x25fd39,null))[_0xfcdf('0x21')](removeEntity(_0x25fd39,null))[_0xfcdf('0x3d')](handleError(_0x25fd39,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index afac53a..c878f11 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 _0x07f2=['util','../../config/logger','moment','request-promise','./mailServerOut.attributes','define','MailServerOut','lodash'];(function(_0x219bdc,_0x2db0d9){var _0x2abdb6=function(_0x409467){while(--_0x409467){_0x219bdc['push'](_0x219bdc['shift']());}};_0x2abdb6(++_0x2db0d9);}(_0x07f2,0xf7));var _0x207f=function(_0x5b2876,_0x4bfde3){_0x5b2876=_0x5b2876-0x0;var _0x245d8f=_0x07f2[_0x5b2876];return _0x245d8f;};'use strict';var _=require(_0x207f('0x0'));var util=require(_0x207f('0x1'));var logger=require(_0x207f('0x2'))('api');var moment=require(_0x207f('0x3'));var BPromise=require('bluebird');var rp=require(_0x207f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x207f('0x5'));module['exports']=function(_0x5f108c,_0x502057){return _0x5f108c[_0x207f('0x6')](_0x207f('0x7'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf605=['lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x5a07b8,_0xd276e9){var _0x7fdf64=function(_0x2b9d17){while(--_0x2b9d17){_0x5a07b8['push'](_0x5a07b8['shift']());}};_0x7fdf64(++_0xd276e9);}(_0xf605,0x14a));var _0x5f60=function(_0x3a37df,_0x46c381){_0x3a37df=_0x3a37df-0x0;var _0x33845c=_0xf605[_0x3a37df];return _0x33845c;};'use strict';var _=require(_0x5f60('0x0'));var util=require('util');var logger=require(_0x5f60('0x1'))('api');var moment=require(_0x5f60('0x2'));var BPromise=require(_0x5f60('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f60('0x4'));var rimraf=require(_0x5f60('0x5'));var config=require(_0x5f60('0x6'));var attributes=require(_0x5f60('0x7'));module[_0x5f60('0x8')]=function(_0x578bf8,_0x4458fd){return _0x578bf8[_0x5f60('0x9')](_0x5f60('0xa'),attributes,{'tableName':'mail_servers_out','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 f3dadff..7951d2f 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x597646,_0x3b7fa5){var _0x3d2ee8=function(_0x8fe622){while(--_0x8fe622){_0x597646['push'](_0x597646['shift']());}};_0x3d2ee8(++_0x3b7fa5);}(_0xadb5,0xad));var _0x5adb=function(_0x564b11,_0x4a9530){_0x564b11=_0x564b11-0x0;var _0x30678f=_0xadb5[_0x564b11];return _0x30678f;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x501900,_0x192e75){var _0x52ed0d=function(_0x2fab46){while(--_0x2fab46){_0x501900['push'](_0x501900['shift']());}};_0x52ed0d(++_0x192e75);}(_0xdb28,0x106));var _0x8db2=function(_0x306cbf,_0x3fb272){_0x306cbf=_0x306cbf-0x0;var _0x4f0166=_0xdb28[_0x306cbf];return _0x4f0166;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 9ab9f64..edeeffb 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 _0xaf5b=['put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','show','post','create'];(function(_0x1bb6aa,_0x40fe82){var _0x2ef28e=function(_0x32b4eb){while(--_0x32b4eb){_0x1bb6aa['push'](_0x1bb6aa['shift']());}};_0x2ef28e(++_0x40fe82);}(_0xaf5b,0x91));var _0xbaf5=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xaf5b[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0xbaf5('0x0'));var path=require(_0xbaf5('0x1'));var timeout=require(_0xbaf5('0x2'));var express=require(_0xbaf5('0x3'));var router=express[_0xbaf5('0x4')]();var fs_extra=require(_0xbaf5('0x5'));var auth=require(_0xbaf5('0x6'));var interaction=require(_0xbaf5('0x7'));var config=require(_0xbaf5('0x8'));var controller=require('./mailSubstatus.controller');router[_0xbaf5('0x9')]('/',auth[_0xbaf5('0xa')](),controller['index']);router[_0xbaf5('0x9')]('/describe',auth[_0xbaf5('0xa')](),controller[_0xbaf5('0xb')]);router[_0xbaf5('0x9')]('/:id',auth[_0xbaf5('0xa')](),controller[_0xbaf5('0xc')]);router[_0xbaf5('0xd')]('/',auth['isAuthenticated'](),controller[_0xbaf5('0xe')]);router[_0xbaf5('0xf')](_0xbaf5('0x10'),auth['isAuthenticated'](),controller[_0xbaf5('0x11')]);router[_0xbaf5('0x12')](_0xbaf5('0x10'),auth[_0xbaf5('0xa')](),controller[_0xbaf5('0x13')]);module['exports']=router; \ No newline at end of file +var _0x9c08=['/:id','show','post','update','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c08,0xa6));var _0x89c0=function(_0x138c7d,_0x3960fe){_0x138c7d=_0x138c7d-0x0;var _0x50d843=_0x9c08[_0x138c7d];return _0x50d843;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x89c0('0x0'));var express=require(_0x89c0('0x1'));var router=express[_0x89c0('0x2')]();var fs_extra=require(_0x89c0('0x3'));var auth=require(_0x89c0('0x4'));var interaction=require(_0x89c0('0x5'));var config=require('../../config/environment');var controller=require(_0x89c0('0x6'));router[_0x89c0('0x7')]('/',auth[_0x89c0('0x8')](),controller[_0x89c0('0x9')]);router[_0x89c0('0x7')]('/describe',auth[_0x89c0('0x8')](),controller['describe']);router[_0x89c0('0x7')](_0x89c0('0xa'),auth[_0x89c0('0x8')](),controller[_0x89c0('0xb')]);router[_0x89c0('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x89c0('0xa'),auth[_0x89c0('0x8')](),controller[_0x89c0('0xd')]);router['delete'](_0x89c0('0xa'),auth['isAuthenticated'](),controller[_0x89c0('0xe')]);module[_0x89c0('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 351ec0f..1530967 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 _0x39e6=['sequelize','STRING'];(function(_0x48bc2f,_0x149e3a){var _0x2336a0=function(_0x59acc3){while(--_0x59acc3){_0x48bc2f['push'](_0x48bc2f['shift']());}};_0x2336a0(++_0x149e3a);}(_0x39e6,0x9e));var _0x639e=function(_0x3bddad,_0x813d42){_0x3bddad=_0x3bddad-0x0;var _0x2272b1=_0x39e6[_0x3bddad];return _0x2272b1;};'use strict';var Sequelize=require(_0x639e('0x0'));module['exports']={'name':{'type':Sequelize[_0x639e('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb091=['exports','STRING','name'];(function(_0xffd1b5,_0x1ede18){var _0x3176d6=function(_0xe9ba48){while(--_0xe9ba48){_0xffd1b5['push'](_0xffd1b5['shift']());}};_0x3176d6(++_0x1ede18);}(_0xb091,0x16e));var _0x1b09=function(_0x51edc5,_0x27f723){_0x51edc5=_0x51edc5-0x0;var _0x399ce6=_0xb091[_0x51edc5];return _0x399ce6;};'use strict';var Sequelize=require('sequelize');module[_0x1b09('0x0')]={'name':{'type':Sequelize[_0x1b09('0x1')],'unique':_0x1b09('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1b09('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 29caf19..217f21d 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 _0xde2d=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','update','destroy','then','error','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','catch','params','length','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4ddbec,_0x5406e4){var _0x37cf7b=function(_0x4683ed){while(--_0x4683ed){_0x4ddbec['push'](_0x4ddbec['shift']());}};_0x37cf7b(++_0x5406e4);}(_0xde2d,0x16e));var _0xdde2=function(_0x3fec22,_0x2b4645){_0x3fec22=_0x3fec22-0x0;var _0x402df5=_0xde2d[_0x3fec22];return _0x402df5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdde2('0x0'));var zipdir=require(_0xdde2('0x1'));var jsonpatch=require(_0xdde2('0x2'));var rp=require(_0xdde2('0x3'));var moment=require(_0xdde2('0x4'));var BPromise=require(_0xdde2('0x5'));var Mustache=require('mustache');var util=require(_0xdde2('0x6'));var path=require('path');var sox=require(_0xdde2('0x7'));var csv=require('to-csv');var ejs=require(_0xdde2('0x8'));var fs=require('fs');var fs_extra=require(_0xdde2('0x9'));var _=require('lodash');var squel=require(_0xdde2('0xa'));var crypto=require(_0xdde2('0xb'));var jsforce=require(_0xdde2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdde2('0xd'));var querystring=require('querystring');var Papa=require(_0xdde2('0xe'));var Redis=require('ioredis');var authService=require(_0xdde2('0xf'));var qs=require(_0xdde2('0x10'));var as=require(_0xdde2('0x11'));var hardwareService=require(_0xdde2('0x12'));var logger=require(_0xdde2('0x13'))(_0xdde2('0x14'));var utils=require(_0xdde2('0x15'));var config=require(_0xdde2('0x16'));var licenseUtil=require(_0xdde2('0x17'));var db=require(_0xdde2('0x18'))['db'];function respondWithStatusCode(_0x216bea,_0x1170b0){_0x1170b0=_0x1170b0||0xcc;return function(_0x101d99){if(_0x101d99){return _0x216bea[_0xdde2('0x19')](_0x1170b0);}return _0x216bea['status'](_0x1170b0)[_0xdde2('0x1a')]();};}function respondWithResult(_0x1f796f,_0x4b6e83){_0x4b6e83=_0x4b6e83||0xc8;return function(_0x1af9b6){if(_0x1af9b6){return _0x1f796f['status'](_0x4b6e83)['json'](_0x1af9b6);}};}function respondWithFilteredResult(_0x2d0eb2,_0x4c2147){return function(_0x1a6439){if(_0x1a6439){var _0x1a2981=typeof _0x4c2147[_0xdde2('0x1b')]===_0xdde2('0x1c')&&typeof _0x4c2147[_0xdde2('0x1d')]==='undefined';var _0x129464=_0x1a6439[_0xdde2('0x1e')];var _0x54fdb5=_0x1a2981?0x0:_0x4c2147[_0xdde2('0x1b')];var _0x17d997=_0x1a2981?_0x1a6439[_0xdde2('0x1e')]:_0x4c2147['offset']+_0x4c2147[_0xdde2('0x1d')];var _0x401a33;if(_0x17d997>=_0x129464){_0x17d997=_0x129464;_0x401a33=0xc8;}else{_0x401a33=0xce;}_0x2d0eb2[_0xdde2('0x1f')](_0x401a33);return _0x2d0eb2[_0xdde2('0x20')](_0xdde2('0x21'),_0x54fdb5+'-'+_0x17d997+'/'+_0x129464)[_0xdde2('0x22')](_0x1a6439);}return null;};}function patchUpdates(_0x34e268){return function(_0xce8b0e){try{jsonpatch[_0xdde2('0x23')](_0xce8b0e,_0x34e268,!![]);}catch(_0x530065){return BPromise[_0xdde2('0x24')](_0x530065);}return _0xce8b0e[_0xdde2('0x25')]();};}function saveUpdates(_0x4dc255,_0x22e694){return function(_0x27edc2){if(_0x27edc2){return _0x27edc2[_0xdde2('0x26')](_0x4dc255)['then'](function(_0x528c41){return _0x528c41;});}return null;};}function removeEntity(_0xdd1e12,_0x371bfa){return function(_0x39fec9){if(_0x39fec9){return _0x39fec9[_0xdde2('0x27')]()[_0xdde2('0x28')](function(){_0xdd1e12[_0xdde2('0x1f')](0xcc)[_0xdde2('0x1a')]();});}};}function handleEntityNotFound(_0x557f9e,_0x49cde3){return function(_0x1c8052){if(!_0x1c8052){_0x557f9e[_0xdde2('0x19')](0x194);}return _0x1c8052;};}function handleError(_0x18e6f3,_0x172541){_0x172541=_0x172541||0x1f4;return function(_0x11b74b){logger[_0xdde2('0x29')](_0x11b74b['stack']);if(_0x11b74b[_0xdde2('0x2a')]){delete _0x11b74b[_0xdde2('0x2a')];}_0x18e6f3[_0xdde2('0x1f')](_0x172541)[_0xdde2('0x2b')](_0x11b74b);};}exports[_0xdde2('0x2c')]=function(_0x5ea784,_0x500791){var _0x14de37={},_0x18d680={},_0x407737={'count':0x0,'rows':[]};var _0x52dda2=_[_0xdde2('0x2d')](db[_0xdde2('0x2e')][_0xdde2('0x2f')],function(_0xf26305){return{'name':_0xf26305[_0xdde2('0x30')],'type':_0xf26305[_0xdde2('0x31')][_0xdde2('0x32')]};});_0x18d680['model']=_[_0xdde2('0x2d')](_0x52dda2,_0xdde2('0x2a'));_0x18d680['query']=_[_0xdde2('0x33')](_0x5ea784[_0xdde2('0x34')]);_0x18d680[_0xdde2('0x35')]=_['intersection'](_0x18d680[_0xdde2('0x36')],_0x18d680[_0xdde2('0x34')]);_0x14de37[_0xdde2('0x37')]=_[_0xdde2('0x38')](_0x18d680[_0xdde2('0x36')],qs[_0xdde2('0x39')](_0x5ea784['query']['fields']));_0x14de37[_0xdde2('0x37')]=_0x14de37[_0xdde2('0x37')]['length']?_0x14de37[_0xdde2('0x37')]:_0x18d680[_0xdde2('0x36')];if(!_0x5ea784[_0xdde2('0x34')][_0xdde2('0x3a')](_0xdde2('0x3b'))){_0x14de37[_0xdde2('0x1d')]=qs[_0xdde2('0x1d')](_0x5ea784[_0xdde2('0x34')][_0xdde2('0x1d')]);_0x14de37[_0xdde2('0x1b')]=qs[_0xdde2('0x1b')](_0x5ea784[_0xdde2('0x34')][_0xdde2('0x1b')]);}_0x14de37['order']=qs[_0xdde2('0x3c')](_0x5ea784[_0xdde2('0x34')][_0xdde2('0x3c')]);_0x14de37['where']=qs['filters'](_[_0xdde2('0x3d')](_0x5ea784[_0xdde2('0x34')],_0x18d680[_0xdde2('0x35')]),_0x52dda2);if(_0x5ea784['query'][_0xdde2('0x3e')]){_0x14de37['where']=_[_0xdde2('0x3f')](_0x14de37[_0xdde2('0x40')],{'$or':_[_0xdde2('0x2d')](_0x52dda2,function(_0x4a909a){if(_0x4a909a[_0xdde2('0x31')]!==_0xdde2('0x41')){var _0x2b26a6={};_0x2b26a6[_0x4a909a[_0xdde2('0x2a')]]={'$like':'%'+_0x5ea784['query'][_0xdde2('0x3e')]+'%'};return _0x2b26a6;}})});}_0x14de37=_[_0xdde2('0x3f')]({},_0x14de37,_0x5ea784[_0xdde2('0x42')]);var _0x454bb4={'where':_0x14de37[_0xdde2('0x40')]};return db[_0xdde2('0x2e')][_0xdde2('0x1e')](_0x454bb4)[_0xdde2('0x28')](function(_0x3a89ad){_0x407737[_0xdde2('0x1e')]=_0x3a89ad;if(_0x5ea784['query'][_0xdde2('0x43')]){_0x14de37[_0xdde2('0x44')]=[{'all':!![]}];}return db[_0xdde2('0x2e')][_0xdde2('0x45')](_0x14de37);})[_0xdde2('0x28')](function(_0x107db7){_0x407737['rows']=_0x107db7;return _0x407737;})[_0xdde2('0x28')](respondWithFilteredResult(_0x500791,_0x14de37))[_0xdde2('0x46')](handleError(_0x500791,null));};exports['show']=function(_0x300d3c,_0x341b59){var _0x3b9234={'raw':!![],'where':{'id':_0x300d3c[_0xdde2('0x47')]['id']}},_0xccc2b4={};_0xccc2b4['model']=_[_0xdde2('0x33')](db[_0xdde2('0x2e')][_0xdde2('0x2f')]);_0xccc2b4[_0xdde2('0x34')]=_['keys'](_0x300d3c[_0xdde2('0x34')]);_0xccc2b4[_0xdde2('0x35')]=_[_0xdde2('0x38')](_0xccc2b4[_0xdde2('0x36')],_0xccc2b4[_0xdde2('0x34')]);_0x3b9234[_0xdde2('0x37')]=_[_0xdde2('0x38')](_0xccc2b4[_0xdde2('0x36')],qs[_0xdde2('0x39')](_0x300d3c['query'][_0xdde2('0x39')]));_0x3b9234[_0xdde2('0x37')]=_0x3b9234[_0xdde2('0x37')][_0xdde2('0x48')]?_0x3b9234[_0xdde2('0x37')]:_0xccc2b4[_0xdde2('0x36')];if(_0x300d3c[_0xdde2('0x34')]['includeAll']){_0x3b9234['include']=[{'all':!![]}];}_0x3b9234=_[_0xdde2('0x3f')]({},_0x3b9234,_0x300d3c[_0xdde2('0x42')]);return db[_0xdde2('0x2e')][_0xdde2('0x49')](_0x3b9234)[_0xdde2('0x28')](handleEntityNotFound(_0x341b59,null))['then'](respondWithResult(_0x341b59,null))[_0xdde2('0x46')](handleError(_0x341b59,null));};exports[_0xdde2('0x4a')]=function(_0x833f4d,_0x1208f1){return db[_0xdde2('0x2e')][_0xdde2('0x4a')](_0x833f4d[_0xdde2('0x4b')],{})[_0xdde2('0x28')](respondWithResult(_0x1208f1,0xc9))[_0xdde2('0x46')](handleError(_0x1208f1,null));};exports[_0xdde2('0x26')]=function(_0xccaf77,_0x537835){if(_0xccaf77[_0xdde2('0x4b')]['id']){delete _0xccaf77[_0xdde2('0x4b')]['id'];}return db['MailSubstatus'][_0xdde2('0x49')]({'where':{'id':_0xccaf77[_0xdde2('0x47')]['id']}})[_0xdde2('0x28')](handleEntityNotFound(_0x537835,null))[_0xdde2('0x28')](saveUpdates(_0xccaf77[_0xdde2('0x4b')],null))[_0xdde2('0x28')](respondWithResult(_0x537835,null))[_0xdde2('0x46')](handleError(_0x537835,null));};exports['destroy']=function(_0x288de5,_0x5d0e67){return db[_0xdde2('0x2e')]['find']({'where':{'id':_0x288de5[_0xdde2('0x47')]['id']}})[_0xdde2('0x28')](handleEntityNotFound(_0x5d0e67,null))['then'](removeEntity(_0x5d0e67,null))[_0xdde2('0x46')](handleError(_0x5d0e67,null));};exports[_0xdde2('0x4c')]=function(_0x835523,_0x5a9b1e){return db['MailSubstatus']['describe']()[_0xdde2('0x28')](respondWithResult(_0x5a9b1e,null))[_0xdde2('0x46')](handleError(_0x5a9b1e,null));}; \ No newline at end of file +var _0x7d69=['../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x9b4cda,_0x206ec1){var _0x1ac6c5=function(_0x4ba0a3){while(--_0x4ba0a3){_0x9b4cda['push'](_0x9b4cda['shift']());}};_0x1ac6c5(++_0x206ec1);}(_0x7d69,0x80));var _0x97d6=function(_0xfa4f6b,_0x5c6f62){_0xfa4f6b=_0xfa4f6b-0x0;var _0x2751aa=_0x7d69[_0xfa4f6b];return _0x2751aa;};'use strict';var emlformat=require(_0x97d6('0x0'));var rimraf=require(_0x97d6('0x1'));var zipdir=require(_0x97d6('0x2'));var jsonpatch=require(_0x97d6('0x3'));var rp=require('request-promise');var moment=require(_0x97d6('0x4'));var BPromise=require(_0x97d6('0x5'));var Mustache=require(_0x97d6('0x6'));var util=require('util');var path=require(_0x97d6('0x7'));var sox=require(_0x97d6('0x8'));var csv=require(_0x97d6('0x9'));var ejs=require(_0x97d6('0xa'));var fs=require('fs');var fs_extra=require(_0x97d6('0xb'));var _=require(_0x97d6('0xc'));var squel=require(_0x97d6('0xd'));var crypto=require(_0x97d6('0xe'));var jsforce=require(_0x97d6('0xf'));var deskjs=require(_0x97d6('0x10'));var toCsv=require(_0x97d6('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x97d6('0x11'));var as=require(_0x97d6('0x12'));var hardwareService=require(_0x97d6('0x13'));var logger=require(_0x97d6('0x14'))('api');var utils=require(_0x97d6('0x15'));var config=require(_0x97d6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x97d6('0x17'))['db'];function respondWithStatusCode(_0x39c588,_0x5a8c1e){_0x5a8c1e=_0x5a8c1e||0xcc;return function(_0x188c80){if(_0x188c80){return _0x39c588[_0x97d6('0x18')](_0x5a8c1e);}return _0x39c588[_0x97d6('0x19')](_0x5a8c1e)[_0x97d6('0x1a')]();};}function respondWithResult(_0x131f09,_0x28fc80){_0x28fc80=_0x28fc80||0xc8;return function(_0x3e6437){if(_0x3e6437){return _0x131f09[_0x97d6('0x19')](_0x28fc80)[_0x97d6('0x1b')](_0x3e6437);}};}function respondWithFilteredResult(_0x4d93b0,_0x5e575c){return function(_0x392ed6){if(_0x392ed6){var _0x4ba51e=typeof _0x5e575c['offset']==='undefined'&&typeof _0x5e575c[_0x97d6('0x1c')]===_0x97d6('0x1d');var _0x111f82=_0x392ed6[_0x97d6('0x1e')];var _0x352dee=_0x4ba51e?0x0:_0x5e575c[_0x97d6('0x1f')];var _0x1497c5=_0x4ba51e?_0x392ed6[_0x97d6('0x1e')]:_0x5e575c['offset']+_0x5e575c[_0x97d6('0x1c')];var _0x3302fb;if(_0x1497c5>=_0x111f82){_0x1497c5=_0x111f82;_0x3302fb=0xc8;}else{_0x3302fb=0xce;}_0x4d93b0[_0x97d6('0x19')](_0x3302fb);return _0x4d93b0[_0x97d6('0x20')](_0x97d6('0x21'),_0x352dee+'-'+_0x1497c5+'/'+_0x111f82)['json'](_0x392ed6);}return null;};}function patchUpdates(_0x59d99c){return function(_0x24d4d1){try{jsonpatch[_0x97d6('0x22')](_0x24d4d1,_0x59d99c,!![]);}catch(_0x2fb9c5){return BPromise[_0x97d6('0x23')](_0x2fb9c5);}return _0x24d4d1[_0x97d6('0x24')]();};}function saveUpdates(_0xf98084,_0x47f205){return function(_0x2a5d05){if(_0x2a5d05){return _0x2a5d05['update'](_0xf98084)[_0x97d6('0x25')](function(_0x57513a){return _0x57513a;});}return null;};}function removeEntity(_0x125009,_0x28a2d5){return function(_0x176f51){if(_0x176f51){return _0x176f51['destroy']()[_0x97d6('0x25')](function(){_0x125009[_0x97d6('0x19')](0xcc)[_0x97d6('0x1a')]();});}};}function handleEntityNotFound(_0x1eac82,_0xd7cad7){return function(_0x420523){if(!_0x420523){_0x1eac82['sendStatus'](0x194);}return _0x420523;};}function handleError(_0x3d609f,_0x3ff6a1){_0x3ff6a1=_0x3ff6a1||0x1f4;return function(_0x14614f){logger['error'](_0x14614f[_0x97d6('0x26')]);if(_0x14614f[_0x97d6('0x27')]){delete _0x14614f[_0x97d6('0x27')];}_0x3d609f[_0x97d6('0x19')](_0x3ff6a1)[_0x97d6('0x28')](_0x14614f);};}exports[_0x97d6('0x29')]=function(_0x5987b0,_0x5d4301){var _0x3cab51={},_0x7292b3={},_0xf86427={'count':0x0,'rows':[]};var _0x38a903=_[_0x97d6('0x2a')](db[_0x97d6('0x2b')][_0x97d6('0x2c')],function(_0x3a4845){return{'name':_0x3a4845[_0x97d6('0x2d')],'type':_0x3a4845[_0x97d6('0x2e')]['key']};});_0x7292b3[_0x97d6('0x2f')]=_['map'](_0x38a903,'name');_0x7292b3[_0x97d6('0x30')]=_[_0x97d6('0x31')](_0x5987b0[_0x97d6('0x30')]);_0x7292b3['filters']=_[_0x97d6('0x32')](_0x7292b3[_0x97d6('0x2f')],_0x7292b3[_0x97d6('0x30')]);_0x3cab51['attributes']=_[_0x97d6('0x32')](_0x7292b3['model'],qs[_0x97d6('0x33')](_0x5987b0[_0x97d6('0x30')][_0x97d6('0x33')]));_0x3cab51[_0x97d6('0x34')]=_0x3cab51[_0x97d6('0x34')][_0x97d6('0x35')]?_0x3cab51['attributes']:_0x7292b3[_0x97d6('0x2f')];if(!_0x5987b0[_0x97d6('0x30')][_0x97d6('0x36')](_0x97d6('0x37'))){_0x3cab51[_0x97d6('0x1c')]=qs[_0x97d6('0x1c')](_0x5987b0['query'][_0x97d6('0x1c')]);_0x3cab51[_0x97d6('0x1f')]=qs[_0x97d6('0x1f')](_0x5987b0[_0x97d6('0x30')][_0x97d6('0x1f')]);}_0x3cab51[_0x97d6('0x38')]=qs[_0x97d6('0x39')](_0x5987b0[_0x97d6('0x30')]['sort']);_0x3cab51[_0x97d6('0x3a')]=qs[_0x97d6('0x3b')](_['pick'](_0x5987b0[_0x97d6('0x30')],_0x7292b3[_0x97d6('0x3b')]),_0x38a903);if(_0x5987b0['query'][_0x97d6('0x3c')]){_0x3cab51[_0x97d6('0x3a')]=_[_0x97d6('0x3d')](_0x3cab51[_0x97d6('0x3a')],{'$or':_[_0x97d6('0x2a')](_0x38a903,function(_0x582d79){if(_0x582d79[_0x97d6('0x2e')]!==_0x97d6('0x3e')){var _0x4cadda={};_0x4cadda[_0x582d79[_0x97d6('0x27')]]={'$like':'%'+_0x5987b0[_0x97d6('0x30')][_0x97d6('0x3c')]+'%'};return _0x4cadda;}})});}_0x3cab51=_[_0x97d6('0x3d')]({},_0x3cab51,_0x5987b0[_0x97d6('0x3f')]);var _0xfa42df={'where':_0x3cab51[_0x97d6('0x3a')]};return db[_0x97d6('0x2b')][_0x97d6('0x1e')](_0xfa42df)[_0x97d6('0x25')](function(_0x4562b7){_0xf86427[_0x97d6('0x1e')]=_0x4562b7;if(_0x5987b0[_0x97d6('0x30')][_0x97d6('0x40')]){_0x3cab51[_0x97d6('0x41')]=[{'all':!![]}];}return db[_0x97d6('0x2b')][_0x97d6('0x42')](_0x3cab51);})[_0x97d6('0x25')](function(_0x38e26f){_0xf86427[_0x97d6('0x43')]=_0x38e26f;return _0xf86427;})[_0x97d6('0x25')](respondWithFilteredResult(_0x5d4301,_0x3cab51))[_0x97d6('0x44')](handleError(_0x5d4301,null));};exports[_0x97d6('0x45')]=function(_0x41db41,_0x8321e1){var _0x409c94={'raw':!![],'where':{'id':_0x41db41[_0x97d6('0x46')]['id']}},_0x199777={};_0x199777[_0x97d6('0x2f')]=_['keys'](db['MailSubstatus']['rawAttributes']);_0x199777[_0x97d6('0x30')]=_[_0x97d6('0x31')](_0x41db41[_0x97d6('0x30')]);_0x199777['filters']=_['intersection'](_0x199777[_0x97d6('0x2f')],_0x199777[_0x97d6('0x30')]);_0x409c94[_0x97d6('0x34')]=_[_0x97d6('0x32')](_0x199777[_0x97d6('0x2f')],qs[_0x97d6('0x33')](_0x41db41[_0x97d6('0x30')]['fields']));_0x409c94[_0x97d6('0x34')]=_0x409c94[_0x97d6('0x34')][_0x97d6('0x35')]?_0x409c94['attributes']:_0x199777[_0x97d6('0x2f')];if(_0x41db41['query'][_0x97d6('0x40')]){_0x409c94[_0x97d6('0x41')]=[{'all':!![]}];}_0x409c94=_['merge']({},_0x409c94,_0x41db41[_0x97d6('0x3f')]);return db[_0x97d6('0x2b')][_0x97d6('0x47')](_0x409c94)[_0x97d6('0x25')](handleEntityNotFound(_0x8321e1,null))['then'](respondWithResult(_0x8321e1,null))[_0x97d6('0x44')](handleError(_0x8321e1,null));};exports['create']=function(_0x49bc23,_0x3af6ab){return db[_0x97d6('0x2b')]['create'](_0x49bc23['body'],{})[_0x97d6('0x25')](respondWithResult(_0x3af6ab,0xc9))[_0x97d6('0x44')](handleError(_0x3af6ab,null));};exports[_0x97d6('0x48')]=function(_0xe1f5e5,_0x133fa9){if(_0xe1f5e5[_0x97d6('0x49')]['id']){delete _0xe1f5e5[_0x97d6('0x49')]['id'];}return db['MailSubstatus'][_0x97d6('0x47')]({'where':{'id':_0xe1f5e5[_0x97d6('0x46')]['id']}})['then'](handleEntityNotFound(_0x133fa9,null))['then'](saveUpdates(_0xe1f5e5[_0x97d6('0x49')],null))['then'](respondWithResult(_0x133fa9,null))[_0x97d6('0x44')](handleError(_0x133fa9,null));};exports['destroy']=function(_0x422e8c,_0x2caefa){return db[_0x97d6('0x2b')][_0x97d6('0x47')]({'where':{'id':_0x422e8c[_0x97d6('0x46')]['id']}})[_0x97d6('0x25')](handleEntityNotFound(_0x2caefa,null))['then'](removeEntity(_0x2caefa,null))['catch'](handleError(_0x2caefa,null));};exports[_0x97d6('0x4a')]=function(_0x28f1e3,_0x354b08){return db[_0x97d6('0x2b')][_0x97d6('0x4a')]()[_0x97d6('0x25')](respondWithResult(_0x354b08,null))[_0x97d6('0x44')](handleError(_0x354b08,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index cb0e856..a8522c7 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 _0x0ae2=['hook','exports','events','../../mysqldb','MailSubstatus','update','emit'];(function(_0x8080cb,_0x48ae3c){var _0x1a0c0e=function(_0x163fe0){while(--_0x163fe0){_0x8080cb['push'](_0x8080cb['shift']());}};_0x1a0c0e(++_0x48ae3c);}(_0x0ae2,0x1ad));var _0x20ae=function(_0x3b87f4,_0x112243){_0x3b87f4=_0x3b87f4-0x0;var _0x63d16e=_0x0ae2[_0x3b87f4];return _0x63d16e;};'use strict';var EventEmitter=require(_0x20ae('0x0'));var MailSubstatus=require(_0x20ae('0x1'))['db'][_0x20ae('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x20ae('0x3')};function emitEvent(_0x3f6d37){return function(_0x4c4eb7,_0xdb0104,_0xa79b7b){MailSubstatusEvents['emit'](_0x3f6d37+':'+_0x4c4eb7['id'],_0x4c4eb7);MailSubstatusEvents[_0x20ae('0x4')](_0x3f6d37,_0x4c4eb7);_0xa79b7b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x20ae('0x5')](e,emitEvent(event));}}module[_0x20ae('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0xa0ab=['update','emit','hook','events','../../mysqldb','MailSubstatus','setMaxListeners'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa0ab,0x184));var _0xba0a=function(_0x3f087a,_0x394fec){_0x3f087a=_0x3f087a-0x0;var _0x442662=_0xa0ab[_0x3f087a];return _0x442662;};'use strict';var EventEmitter=require(_0xba0a('0x0'));var MailSubstatus=require(_0xba0a('0x1'))['db'][_0xba0a('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xba0a('0x3')](0x0);var events={'afterUpdate':_0xba0a('0x4')};function emitEvent(_0x3ad7d2){return function(_0x4a39b4,_0x24f458,_0x250ae4){MailSubstatusEvents['emit'](_0x3ad7d2+':'+_0x4a39b4['id'],_0x4a39b4);MailSubstatusEvents[_0xba0a('0x5')](_0x3ad7d2,_0x4a39b4);_0x250ae4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xba0a('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 65e9179..d5af196 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 _0x85bf=['define','MailSubstatus','mail_substatuses','Condition','name','mailSubstatus','then','catch','./mailSubstatus.attributes'];(function(_0x42d21e,_0x15d5f3){var _0x4e17fa=function(_0x1ac67f){while(--_0x1ac67f){_0x42d21e['push'](_0x42d21e['shift']());}};_0x4e17fa(++_0x15d5f3);}(_0x85bf,0xce));var _0xf85b=function(_0x3da7ab,_0x2e00dc){_0x3da7ab=_0x3da7ab-0x0;var _0x4819ed=_0x85bf[_0x3da7ab];return _0x4819ed;};'use strict';var attributes=require(_0xf85b('0x0'));module['exports']=function(_0x36896d){var _0x53c63f=_0x36896d['models'];return _0x36896d[_0xf85b('0x1')](_0xf85b('0x2'),attributes,{'tableName':_0xf85b('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2e6d5e,_0x34b9e7,_0x4c66a6){return _0x53c63f[_0xf85b('0x4')]['update']({'value':_0x2e6d5e[_0xf85b('0x5')]},{'where':{'field':_0xf85b('0x6'),'value':_0x2e6d5e['_previousDataValues']['name']}})[_0xf85b('0x7')](function(){_0x4c66a6();})[_0xf85b('0x8')](function(_0x418632){_0x4c66a6(_0x418632);});}}});}; \ No newline at end of file +var _0xa3c0=['update','name','mailSubstatus','_previousDataValues','catch','MailSubstatus'];(function(_0x58494e,_0x541fc9){var _0xb6cc65=function(_0x312336){while(--_0x312336){_0x58494e['push'](_0x58494e['shift']());}};_0xb6cc65(++_0x541fc9);}(_0xa3c0,0x11f));var _0x0a3c=function(_0x55ff3e,_0x41077f){_0x55ff3e=_0x55ff3e-0x0;var _0x2709eb=_0xa3c0[_0x55ff3e];return _0x2709eb;};'use strict';var attributes=require('./mailSubstatus.attributes');module['exports']=function(_0x53e452){var _0x1b6e93=_0x53e452['models'];return _0x53e452['define'](_0x0a3c('0x0'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x26b8e1,_0x1748d2,_0x12a995){return _0x1b6e93['Condition'][_0x0a3c('0x1')]({'value':_0x26b8e1[_0x0a3c('0x2')]},{'where':{'field':_0x0a3c('0x3'),'value':_0x26b8e1[_0x0a3c('0x4')][_0x0a3c('0x2')]}})['then'](function(){_0x12a995();})[_0x0a3c('0x5')](function(_0x17b537){_0x12a995(_0x17b537);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index c873b24..c884794 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 _0x2a9b=['message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x23d132,_0x458f58){var _0x1d3c87=function(_0x473850){while(--_0x473850){_0x23d132['push'](_0x23d132['shift']());}};_0x1d3c87(++_0x458f58);}(_0x2a9b,0xbf));var _0xb2a9=function(_0x570714,_0x4dd898){_0x570714=_0x570714-0x0;var _0x354cc3=_0x2a9b[_0x570714];return _0x354cc3;};'use strict';var _=require(_0xb2a9('0x0'));var util=require(_0xb2a9('0x1'));var moment=require(_0xb2a9('0x2'));var BPromise=require(_0xb2a9('0x3'));var rs=require(_0xb2a9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2a9('0x5'))['db'];var utils=require(_0xb2a9('0x6'));var logger=require('../../config/logger')(_0xb2a9('0x7'));var config=require('../../config/environment');var jayson=require(_0xb2a9('0x8'));var client=jayson[_0xb2a9('0x9')][_0xb2a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d7b65,_0x20e08c,_0x4470cc){return new BPromise(function(_0x1a3a0c,_0x3974d0){return client['request'](_0x3d7b65,_0x4470cc)[_0xb2a9('0xb')](function(_0x5c8fa4){logger[_0xb2a9('0xc')](_0xb2a9('0xd'),_0x20e08c,_0xb2a9('0xe'));logger[_0xb2a9('0xf')](_0xb2a9('0x10'),_0x20e08c,_0xb2a9('0xe'),JSON['stringify'](_0x5c8fa4));if(_0x5c8fa4['error']){if(_0x5c8fa4[_0xb2a9('0x11')][_0xb2a9('0x12')]===0x1f4){logger[_0xb2a9('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x20e08c,_0x5c8fa4[_0xb2a9('0x11')][_0xb2a9('0x13')]);return _0x3974d0(_0x5c8fa4[_0xb2a9('0x11')][_0xb2a9('0x13')]);}logger[_0xb2a9('0x11')](_0xb2a9('0xd'),_0x20e08c,_0x5c8fa4[_0xb2a9('0x11')][_0xb2a9('0x13')]);return _0x1a3a0c(_0x5c8fa4['error'][_0xb2a9('0x13')]);}else{logger['info'](_0xb2a9('0xd'),_0x20e08c,_0xb2a9('0xe'));_0x1a3a0c(_0x5c8fa4[_0xb2a9('0x14')][_0xb2a9('0x13')]);}})['catch'](function(_0xf927be){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x20e08c,_0xf927be);_0x3974d0(_0xf927be);});});} \ No newline at end of file +var _0xa230=['catch','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x2dc343,_0xf015a2){var _0x51eac5=function(_0x1adfef){while(--_0x1adfef){_0x2dc343['push'](_0x2dc343['shift']());}};_0x51eac5(++_0xf015a2);}(_0xa230,0xbe));var _0x0a23=function(_0x5f4505,_0x4ae2ac){_0x5f4505=_0x5f4505-0x0;var _0x40bf1b=_0xa230[_0x5f4505];return _0x40bf1b;};'use strict';var _=require('lodash');var util=require(_0x0a23('0x0'));var moment=require('moment');var BPromise=require(_0x0a23('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a23('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0a23('0x3'))(_0x0a23('0x4'));var config=require(_0x0a23('0x5'));var jayson=require(_0x0a23('0x6'));var client=jayson[_0x0a23('0x7')][_0x0a23('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x265e3c,_0x1aefed,_0x59e7a7){return new BPromise(function(_0x161f7c,_0x6f97b5){return client[_0x0a23('0x9')](_0x265e3c,_0x59e7a7)['then'](function(_0x43e288){logger[_0x0a23('0xa')](_0x0a23('0xb'),_0x1aefed,'request\x20sent');logger[_0x0a23('0xc')](_0x0a23('0xd'),_0x1aefed,_0x0a23('0xe'),JSON[_0x0a23('0xf')](_0x43e288));if(_0x43e288[_0x0a23('0x10')]){if(_0x43e288[_0x0a23('0x10')][_0x0a23('0x11')]===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x1aefed,_0x43e288[_0x0a23('0x10')][_0x0a23('0x12')]);return _0x6f97b5(_0x43e288[_0x0a23('0x10')][_0x0a23('0x12')]);}logger[_0x0a23('0x10')](_0x0a23('0xb'),_0x1aefed,_0x43e288[_0x0a23('0x10')][_0x0a23('0x12')]);return _0x161f7c(_0x43e288[_0x0a23('0x10')][_0x0a23('0x12')]);}else{logger[_0x0a23('0xa')](_0x0a23('0xb'),_0x1aefed,_0x0a23('0xe'));_0x161f7c(_0x43e288[_0x0a23('0x13')][_0x0a23('0x12')]);}})[_0x0a23('0x14')](function(_0x1b410a){logger['error'](_0x0a23('0xb'),_0x1aefed,_0x1b410a);_0x6f97b5(_0x1b410a);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 77c58a1..06bcd0a 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 _0xf686=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./mailTransferReport.controller','get','isAuthenticated','index','describe','/:id','post','update'];(function(_0x14d896,_0x53578b){var _0x28679a=function(_0x14921f){while(--_0x14921f){_0x14d896['push'](_0x14d896['shift']());}};_0x28679a(++_0x53578b);}(_0xf686,0x18f));var _0x6f68=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf686[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x6f68('0x0'));var util=require(_0x6f68('0x1'));var path=require(_0x6f68('0x2'));var timeout=require(_0x6f68('0x3'));var express=require(_0x6f68('0x4'));var router=express['Router']();var fs_extra=require(_0x6f68('0x5'));var auth=require(_0x6f68('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6f68('0x7'));router[_0x6f68('0x8')]('/',auth[_0x6f68('0x9')](),controller[_0x6f68('0xa')]);router[_0x6f68('0x8')]('/describe',auth[_0x6f68('0x9')](),controller[_0x6f68('0xb')]);router[_0x6f68('0x8')](_0x6f68('0xc'),auth[_0x6f68('0x9')](),controller['show']);router[_0x6f68('0xd')]('/',auth[_0x6f68('0x9')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6f68('0xe')]);router[_0x6f68('0xf')](_0x6f68('0xc'),auth[_0x6f68('0x9')](),controller[_0x6f68('0x10')]);module[_0x6f68('0x11')]=router; \ No newline at end of file +var _0xd404=['put','delete','/:id','multer','path','connect-timeout','express','fs-extra','./mailTransferReport.controller','/describe','isAuthenticated','describe','get','show','post'];(function(_0x3f3998,_0x26cbb7){var _0x40e0c1=function(_0x2def78){while(--_0x2def78){_0x3f3998['push'](_0x3f3998['shift']());}};_0x40e0c1(++_0x26cbb7);}(_0xd404,0xc6));var _0x4d40=function(_0x2fe44f,_0x86bba1){_0x2fe44f=_0x2fe44f-0x0;var _0x1623b2=_0xd404[_0x2fe44f];return _0x1623b2;};'use strict';var multer=require(_0x4d40('0x0'));var util=require('util');var path=require(_0x4d40('0x1'));var timeout=require(_0x4d40('0x2'));var express=require(_0x4d40('0x3'));var router=express['Router']();var fs_extra=require(_0x4d40('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4d40('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4d40('0x6'),auth[_0x4d40('0x7')](),controller[_0x4d40('0x8')]);router[_0x4d40('0x9')]('/:id',auth[_0x4d40('0x7')](),controller[_0x4d40('0xa')]);router[_0x4d40('0xb')]('/',auth[_0x4d40('0x7')](),controller['create']);router[_0x4d40('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4d40('0xd')](_0x4d40('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index f9a2d01..2b6b1b9 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x571c8e,_0x18546d){var _0x1fe343=function(_0x34e91c){while(--_0x34e91c){_0x571c8e['push'](_0x571c8e['shift']());}};_0x1fe343(++_0x18546d);}(_0x34e8,0x12c));var _0x834e=function(_0x3dd874,_0x3c205c){_0x3dd874=_0x3dd874-0x0;var _0x4733c5=_0x34e8[_0x3dd874];return _0x4733c5;};'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 +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x1d0e07,_0x2037e9){var _0x8912e0=function(_0x3b1c66){while(--_0x3b1c66){_0x1d0e07['push'](_0x1d0e07['shift']());}};_0x8912e0(++_0x2037e9);}(_0x34e8,0x12c));var _0x834e=function(_0xf441e1,_0x4dbd55){_0xf441e1=_0xf441e1-0x0;var _0x2f63b4=_0x34e8[_0xf441e1];return _0x2f63b4;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index ef8525c..432a0b5 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 _0xe75d=['save','update','then','end','sendStatus','stack','name','send','index','MailTransferReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','rows','catch','params','keys','fields','options','create','body','destroy','describe','eml-format','rimraf','zip-dir','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/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','status','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x2a0503,_0x5a4b2f){var _0x2c1e6c=function(_0x32101f){while(--_0x32101f){_0x2a0503['push'](_0x2a0503['shift']());}};_0x2c1e6c(++_0x5a4b2f);}(_0xe75d,0x6e));var _0xde75=function(_0x4bc513,_0xcce352){_0x4bc513=_0x4bc513-0x0;var _0x5254db=_0xe75d[_0x4bc513];return _0x5254db;};'use strict';var emlformat=require(_0xde75('0x0'));var rimraf=require(_0xde75('0x1'));var zipdir=require(_0xde75('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xde75('0x3'));var moment=require(_0xde75('0x4'));var BPromise=require(_0xde75('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xde75('0x6'));var sox=require(_0xde75('0x7'));var csv=require(_0xde75('0x8'));var ejs=require(_0xde75('0x9'));var fs=require('fs');var fs_extra=require(_0xde75('0xa'));var _=require(_0xde75('0xb'));var squel=require(_0xde75('0xc'));var crypto=require(_0xde75('0xd'));var jsforce=require(_0xde75('0xe'));var deskjs=require(_0xde75('0xf'));var toCsv=require(_0xde75('0x8'));var querystring=require(_0xde75('0x10'));var Papa=require(_0xde75('0x11'));var Redis=require(_0xde75('0x12'));var authService=require(_0xde75('0x13'));var qs=require(_0xde75('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xde75('0x15'));var logger=require(_0xde75('0x16'))(_0xde75('0x17'));var utils=require('../../config/utils');var config=require(_0xde75('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a91c9,_0x124dae){_0x124dae=_0x124dae||0xcc;return function(_0x2d25bf){if(_0x2d25bf){return _0x1a91c9['sendStatus'](_0x124dae);}return _0x1a91c9[_0xde75('0x19')](_0x124dae)['end']();};}function respondWithResult(_0x17a9fd,_0x1b1a22){_0x1b1a22=_0x1b1a22||0xc8;return function(_0x17a261){if(_0x17a261){return _0x17a9fd[_0xde75('0x19')](_0x1b1a22)[_0xde75('0x1a')](_0x17a261);}};}function respondWithFilteredResult(_0x139f38,_0x2bd7a3){return function(_0x112d0d){if(_0x112d0d){var _0x50c845=typeof _0x2bd7a3[_0xde75('0x1b')]===_0xde75('0x1c')&&typeof _0x2bd7a3['limit']===_0xde75('0x1c');var _0x304f27=_0x112d0d['count'];var _0x20114d=_0x50c845?0x0:_0x2bd7a3[_0xde75('0x1b')];var _0x4b8d3e=_0x50c845?_0x112d0d[_0xde75('0x1d')]:_0x2bd7a3[_0xde75('0x1b')]+_0x2bd7a3[_0xde75('0x1e')];var _0x3ab954;if(_0x4b8d3e>=_0x304f27){_0x4b8d3e=_0x304f27;_0x3ab954=0xc8;}else{_0x3ab954=0xce;}_0x139f38[_0xde75('0x19')](_0x3ab954);return _0x139f38[_0xde75('0x1f')](_0xde75('0x20'),_0x20114d+'-'+_0x4b8d3e+'/'+_0x304f27)[_0xde75('0x1a')](_0x112d0d);}return null;};}function patchUpdates(_0x5b6b4e){return function(_0x7dc1d4){try{jsonpatch[_0xde75('0x21')](_0x7dc1d4,_0x5b6b4e,!![]);}catch(_0x224b80){return BPromise['reject'](_0x224b80);}return _0x7dc1d4[_0xde75('0x22')]();};}function saveUpdates(_0x24d7e4,_0x426b46){return function(_0x20d65f){if(_0x20d65f){return _0x20d65f[_0xde75('0x23')](_0x24d7e4)[_0xde75('0x24')](function(_0x2d3c7d){return _0x2d3c7d;});}return null;};}function removeEntity(_0x2a73d8,_0x532f3e){return function(_0xe35936){if(_0xe35936){return _0xe35936['destroy']()['then'](function(){_0x2a73d8[_0xde75('0x19')](0xcc)[_0xde75('0x25')]();});}};}function handleEntityNotFound(_0x3bc696,_0x1d384e){return function(_0x4efce8){if(!_0x4efce8){_0x3bc696[_0xde75('0x26')](0x194);}return _0x4efce8;};}function handleError(_0xe2a0cb,_0x2e334d){_0x2e334d=_0x2e334d||0x1f4;return function(_0x224f98){logger['error'](_0x224f98[_0xde75('0x27')]);if(_0x224f98[_0xde75('0x28')]){delete _0x224f98[_0xde75('0x28')];}_0xe2a0cb[_0xde75('0x19')](_0x2e334d)[_0xde75('0x29')](_0x224f98);};}exports[_0xde75('0x2a')]=function(_0x353533,_0x1087f1){var _0x165e14={},_0x21d611={},_0x48c628={'count':0x0,'rows':[]};var _0x9bb028=_['map'](db[_0xde75('0x2b')][_0xde75('0x2c')],function(_0x553b68){return{'name':_0x553b68[_0xde75('0x2d')],'type':_0x553b68[_0xde75('0x2e')]['key']};});_0x21d611[_0xde75('0x2f')]=_[_0xde75('0x30')](_0x9bb028,_0xde75('0x28'));_0x21d611['query']=_['keys'](_0x353533[_0xde75('0x31')]);_0x21d611[_0xde75('0x32')]=_['intersection'](_0x21d611[_0xde75('0x2f')],_0x21d611['query']);_0x165e14['attributes']=_[_0xde75('0x33')](_0x21d611[_0xde75('0x2f')],qs['fields'](_0x353533[_0xde75('0x31')]['fields']));_0x165e14[_0xde75('0x34')]=_0x165e14[_0xde75('0x34')][_0xde75('0x35')]?_0x165e14[_0xde75('0x34')]:_0x21d611[_0xde75('0x2f')];if(!_0x353533[_0xde75('0x31')][_0xde75('0x36')](_0xde75('0x37'))){_0x165e14[_0xde75('0x1e')]=qs[_0xde75('0x1e')](_0x353533[_0xde75('0x31')]['limit']);_0x165e14['offset']=qs[_0xde75('0x1b')](_0x353533[_0xde75('0x31')][_0xde75('0x1b')]);}_0x165e14[_0xde75('0x38')]=qs[_0xde75('0x39')](_0x353533[_0xde75('0x31')]['sort']);_0x165e14[_0xde75('0x3a')]=qs[_0xde75('0x32')](_['pick'](_0x353533['query'],_0x21d611['filters']),_0x9bb028);if(_0x353533[_0xde75('0x31')][_0xde75('0x3b')]){_0x165e14[_0xde75('0x3a')]=_[_0xde75('0x3c')](_0x165e14['where'],{'$or':_[_0xde75('0x30')](_0x9bb028,function(_0x4ca0c7){if(_0x4ca0c7['type']!=='VIRTUAL'){var _0x1164eb={};_0x1164eb[_0x4ca0c7[_0xde75('0x28')]]={'$like':'%'+_0x353533[_0xde75('0x31')][_0xde75('0x3b')]+'%'};return _0x1164eb;}})});}_0x165e14=_[_0xde75('0x3c')]({},_0x165e14,_0x353533['options']);var _0x63120f={'where':_0x165e14[_0xde75('0x3a')]};return db['MailTransferReport'][_0xde75('0x1d')](_0x63120f)[_0xde75('0x24')](function(_0x217b70){_0x48c628[_0xde75('0x1d')]=_0x217b70;if(_0x353533[_0xde75('0x31')][_0xde75('0x3d')]){_0x165e14['include']=[{'all':!![]}];}return db[_0xde75('0x2b')]['findAll'](_0x165e14);})['then'](function(_0x128b74){_0x48c628[_0xde75('0x3e')]=_0x128b74;return _0x48c628;})[_0xde75('0x24')](respondWithFilteredResult(_0x1087f1,_0x165e14))[_0xde75('0x3f')](handleError(_0x1087f1,null));};exports['show']=function(_0x284001,_0x26c741){var _0x43fbd0={'raw':!![],'where':{'id':_0x284001[_0xde75('0x40')]['id']}},_0x549cdb={};_0x549cdb['model']=_['keys'](db[_0xde75('0x2b')]['rawAttributes']);_0x549cdb[_0xde75('0x31')]=_[_0xde75('0x41')](_0x284001[_0xde75('0x31')]);_0x549cdb[_0xde75('0x32')]=_['intersection'](_0x549cdb['model'],_0x549cdb[_0xde75('0x31')]);_0x43fbd0[_0xde75('0x34')]=_[_0xde75('0x33')](_0x549cdb[_0xde75('0x2f')],qs[_0xde75('0x42')](_0x284001[_0xde75('0x31')][_0xde75('0x42')]));_0x43fbd0[_0xde75('0x34')]=_0x43fbd0[_0xde75('0x34')][_0xde75('0x35')]?_0x43fbd0['attributes']:_0x549cdb['model'];if(_0x284001[_0xde75('0x31')][_0xde75('0x3d')]){_0x43fbd0['include']=[{'all':!![]}];}_0x43fbd0=_['merge']({},_0x43fbd0,_0x284001[_0xde75('0x43')]);return db[_0xde75('0x2b')]['find'](_0x43fbd0)[_0xde75('0x24')](handleEntityNotFound(_0x26c741,null))[_0xde75('0x24')](respondWithResult(_0x26c741,null))[_0xde75('0x3f')](handleError(_0x26c741,null));};exports[_0xde75('0x44')]=function(_0x365941,_0x5ee0ad){return db[_0xde75('0x2b')][_0xde75('0x44')](_0x365941['body'],{})[_0xde75('0x24')](respondWithResult(_0x5ee0ad,0xc9))['catch'](handleError(_0x5ee0ad,null));};exports['update']=function(_0x4e22a6,_0x3c93e4){if(_0x4e22a6[_0xde75('0x45')]['id']){delete _0x4e22a6[_0xde75('0x45')]['id'];}return db[_0xde75('0x2b')]['find']({'where':{'id':_0x4e22a6[_0xde75('0x40')]['id']}})[_0xde75('0x24')](handleEntityNotFound(_0x3c93e4,null))['then'](saveUpdates(_0x4e22a6[_0xde75('0x45')],null))[_0xde75('0x24')](respondWithResult(_0x3c93e4,null))[_0xde75('0x3f')](handleError(_0x3c93e4,null));};exports[_0xde75('0x46')]=function(_0x13b355,_0x3b971c){return db['MailTransferReport']['find']({'where':{'id':_0x13b355[_0xde75('0x40')]['id']}})[_0xde75('0x24')](handleEntityNotFound(_0x3b971c,null))[_0xde75('0x24')](removeEntity(_0x3b971c,null))[_0xde75('0x3f')](handleError(_0x3b971c,null));};exports[_0xde75('0x47')]=function(_0x25b0e5,_0x2c8e7e){return db['MailTransferReport'][_0xde75('0x47')]()[_0xde75('0x24')](respondWithResult(_0x2c8e7e,null))[_0xde75('0x3f')](handleError(_0x2c8e7e,null));}; \ No newline at end of file +var _0xbd01=['MailTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','request-promise','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','index','map'];(function(_0x389fe6,_0x159923){var _0x36564d=function(_0x5a1a74){while(--_0x5a1a74){_0x389fe6['push'](_0x389fe6['shift']());}};_0x36564d(++_0x159923);}(_0xbd01,0x1f4));var _0x1bd0=function(_0x3b9e4e,_0x3db369){_0x3b9e4e=_0x3b9e4e-0x0;var _0x14e6f9=_0xbd01[_0x3b9e4e];return _0x14e6f9;};'use strict';var emlformat=require(_0x1bd0('0x0'));var rimraf=require(_0x1bd0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1bd0('0x2'));var moment=require('moment');var BPromise=require(_0x1bd0('0x3'));var Mustache=require(_0x1bd0('0x4'));var util=require(_0x1bd0('0x5'));var path=require(_0x1bd0('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1bd0('0x7'));var fs=require('fs');var fs_extra=require(_0x1bd0('0x8'));var _=require(_0x1bd0('0x9'));var squel=require(_0x1bd0('0xa'));var crypto=require(_0x1bd0('0xb'));var jsforce=require(_0x1bd0('0xc'));var deskjs=require(_0x1bd0('0xd'));var toCsv=require(_0x1bd0('0xe'));var querystring=require(_0x1bd0('0xf'));var Papa=require('papaparse');var Redis=require(_0x1bd0('0x10'));var authService=require(_0x1bd0('0x11'));var qs=require(_0x1bd0('0x12'));var as=require(_0x1bd0('0x13'));var hardwareService=require(_0x1bd0('0x14'));var logger=require(_0x1bd0('0x15'))(_0x1bd0('0x16'));var utils=require(_0x1bd0('0x17'));var config=require(_0x1bd0('0x18'));var licenseUtil=require(_0x1bd0('0x19'));var db=require(_0x1bd0('0x1a'))['db'];function respondWithStatusCode(_0x271f4a,_0xd948c6){_0xd948c6=_0xd948c6||0xcc;return function(_0x7c25f4){if(_0x7c25f4){return _0x271f4a[_0x1bd0('0x1b')](_0xd948c6);}return _0x271f4a[_0x1bd0('0x1c')](_0xd948c6)['end']();};}function respondWithResult(_0x169975,_0x5d1009){_0x5d1009=_0x5d1009||0xc8;return function(_0x2ef34c){if(_0x2ef34c){return _0x169975[_0x1bd0('0x1c')](_0x5d1009)[_0x1bd0('0x1d')](_0x2ef34c);}};}function respondWithFilteredResult(_0x5f2c4d,_0x283dbc){return function(_0x438bf4){if(_0x438bf4){var _0x4cf6b3=typeof _0x283dbc[_0x1bd0('0x1e')]===_0x1bd0('0x1f')&&typeof _0x283dbc[_0x1bd0('0x20')]===_0x1bd0('0x1f');var _0x2dbab9=_0x438bf4[_0x1bd0('0x21')];var _0x42ec63=_0x4cf6b3?0x0:_0x283dbc[_0x1bd0('0x1e')];var _0x125684=_0x4cf6b3?_0x438bf4[_0x1bd0('0x21')]:_0x283dbc[_0x1bd0('0x1e')]+_0x283dbc[_0x1bd0('0x20')];var _0x3eabd9;if(_0x125684>=_0x2dbab9){_0x125684=_0x2dbab9;_0x3eabd9=0xc8;}else{_0x3eabd9=0xce;}_0x5f2c4d['status'](_0x3eabd9);return _0x5f2c4d['set'](_0x1bd0('0x22'),_0x42ec63+'-'+_0x125684+'/'+_0x2dbab9)[_0x1bd0('0x1d')](_0x438bf4);}return null;};}function patchUpdates(_0x267efb){return function(_0x152e4e){try{jsonpatch[_0x1bd0('0x23')](_0x152e4e,_0x267efb,!![]);}catch(_0x8b3a16){return BPromise[_0x1bd0('0x24')](_0x8b3a16);}return _0x152e4e['save']();};}function saveUpdates(_0x5b4985,_0x3d32fb){return function(_0x5b51b6){if(_0x5b51b6){return _0x5b51b6[_0x1bd0('0x25')](_0x5b4985)[_0x1bd0('0x26')](function(_0xbd8fb8){return _0xbd8fb8;});}return null;};}function removeEntity(_0x5e3970,_0x575524){return function(_0x3db1e2){if(_0x3db1e2){return _0x3db1e2[_0x1bd0('0x27')]()[_0x1bd0('0x26')](function(){_0x5e3970[_0x1bd0('0x1c')](0xcc)[_0x1bd0('0x28')]();});}};}function handleEntityNotFound(_0xc13e15,_0x2003be){return function(_0x2c87fc){if(!_0x2c87fc){_0xc13e15[_0x1bd0('0x1b')](0x194);}return _0x2c87fc;};}function handleError(_0x234b60,_0x31e40e){_0x31e40e=_0x31e40e||0x1f4;return function(_0x2635a1){logger['error'](_0x2635a1[_0x1bd0('0x29')]);if(_0x2635a1['name']){delete _0x2635a1[_0x1bd0('0x2a')];}_0x234b60[_0x1bd0('0x1c')](_0x31e40e)[_0x1bd0('0x2b')](_0x2635a1);};}exports[_0x1bd0('0x2c')]=function(_0x3b1fec,_0x73fded){var _0x3fe094={},_0xa0393d={},_0xcfeb8e={'count':0x0,'rows':[]};var _0x22566e=_[_0x1bd0('0x2d')](db[_0x1bd0('0x2e')]['rawAttributes'],function(_0x3c6f13){return{'name':_0x3c6f13[_0x1bd0('0x2f')],'type':_0x3c6f13[_0x1bd0('0x30')][_0x1bd0('0x31')]};});_0xa0393d[_0x1bd0('0x32')]=_[_0x1bd0('0x2d')](_0x22566e,_0x1bd0('0x2a'));_0xa0393d[_0x1bd0('0x33')]=_[_0x1bd0('0x34')](_0x3b1fec['query']);_0xa0393d[_0x1bd0('0x35')]=_[_0x1bd0('0x36')](_0xa0393d[_0x1bd0('0x32')],_0xa0393d['query']);_0x3fe094[_0x1bd0('0x37')]=_[_0x1bd0('0x36')](_0xa0393d[_0x1bd0('0x32')],qs[_0x1bd0('0x38')](_0x3b1fec[_0x1bd0('0x33')]['fields']));_0x3fe094['attributes']=_0x3fe094[_0x1bd0('0x37')][_0x1bd0('0x39')]?_0x3fe094[_0x1bd0('0x37')]:_0xa0393d[_0x1bd0('0x32')];if(!_0x3b1fec[_0x1bd0('0x33')][_0x1bd0('0x3a')](_0x1bd0('0x3b'))){_0x3fe094[_0x1bd0('0x20')]=qs[_0x1bd0('0x20')](_0x3b1fec[_0x1bd0('0x33')]['limit']);_0x3fe094[_0x1bd0('0x1e')]=qs[_0x1bd0('0x1e')](_0x3b1fec[_0x1bd0('0x33')]['offset']);}_0x3fe094[_0x1bd0('0x3c')]=qs['sort'](_0x3b1fec[_0x1bd0('0x33')][_0x1bd0('0x3d')]);_0x3fe094[_0x1bd0('0x3e')]=qs[_0x1bd0('0x35')](_['pick'](_0x3b1fec[_0x1bd0('0x33')],_0xa0393d[_0x1bd0('0x35')]),_0x22566e);if(_0x3b1fec[_0x1bd0('0x33')][_0x1bd0('0x3f')]){_0x3fe094[_0x1bd0('0x3e')]=_[_0x1bd0('0x40')](_0x3fe094[_0x1bd0('0x3e')],{'$or':_[_0x1bd0('0x2d')](_0x22566e,function(_0x119ec3){if(_0x119ec3[_0x1bd0('0x30')]!==_0x1bd0('0x41')){var _0x2389a2={};_0x2389a2[_0x119ec3['name']]={'$like':'%'+_0x3b1fec['query']['filter']+'%'};return _0x2389a2;}})});}_0x3fe094=_['merge']({},_0x3fe094,_0x3b1fec[_0x1bd0('0x42')]);var _0x5165ce={'where':_0x3fe094[_0x1bd0('0x3e')]};return db[_0x1bd0('0x2e')][_0x1bd0('0x21')](_0x5165ce)[_0x1bd0('0x26')](function(_0x39b6f9){_0xcfeb8e[_0x1bd0('0x21')]=_0x39b6f9;if(_0x3b1fec[_0x1bd0('0x33')][_0x1bd0('0x43')]){_0x3fe094[_0x1bd0('0x44')]=[{'all':!![]}];}return db[_0x1bd0('0x2e')][_0x1bd0('0x45')](_0x3fe094);})[_0x1bd0('0x26')](function(_0xf6543d){_0xcfeb8e[_0x1bd0('0x46')]=_0xf6543d;return _0xcfeb8e;})['then'](respondWithFilteredResult(_0x73fded,_0x3fe094))['catch'](handleError(_0x73fded,null));};exports['show']=function(_0x5d928e,_0x52e0bc){var _0x42ff12={'raw':!![],'where':{'id':_0x5d928e[_0x1bd0('0x47')]['id']}},_0x5a1994={};_0x5a1994[_0x1bd0('0x32')]=_[_0x1bd0('0x34')](db[_0x1bd0('0x2e')][_0x1bd0('0x48')]);_0x5a1994['query']=_[_0x1bd0('0x34')](_0x5d928e[_0x1bd0('0x33')]);_0x5a1994[_0x1bd0('0x35')]=_[_0x1bd0('0x36')](_0x5a1994[_0x1bd0('0x32')],_0x5a1994[_0x1bd0('0x33')]);_0x42ff12[_0x1bd0('0x37')]=_[_0x1bd0('0x36')](_0x5a1994[_0x1bd0('0x32')],qs[_0x1bd0('0x38')](_0x5d928e[_0x1bd0('0x33')][_0x1bd0('0x38')]));_0x42ff12['attributes']=_0x42ff12['attributes'][_0x1bd0('0x39')]?_0x42ff12['attributes']:_0x5a1994[_0x1bd0('0x32')];if(_0x5d928e['query']['includeAll']){_0x42ff12[_0x1bd0('0x44')]=[{'all':!![]}];}_0x42ff12=_[_0x1bd0('0x40')]({},_0x42ff12,_0x5d928e['options']);return db[_0x1bd0('0x2e')][_0x1bd0('0x49')](_0x42ff12)[_0x1bd0('0x26')](handleEntityNotFound(_0x52e0bc,null))[_0x1bd0('0x26')](respondWithResult(_0x52e0bc,null))[_0x1bd0('0x4a')](handleError(_0x52e0bc,null));};exports['create']=function(_0x320b35,_0xc18e4){return db['MailTransferReport'][_0x1bd0('0x4b')](_0x320b35['body'],{})[_0x1bd0('0x26')](respondWithResult(_0xc18e4,0xc9))[_0x1bd0('0x4a')](handleError(_0xc18e4,null));};exports[_0x1bd0('0x25')]=function(_0x494186,_0x56859b){if(_0x494186[_0x1bd0('0x4c')]['id']){delete _0x494186[_0x1bd0('0x4c')]['id'];}return db[_0x1bd0('0x2e')][_0x1bd0('0x49')]({'where':{'id':_0x494186[_0x1bd0('0x47')]['id']}})[_0x1bd0('0x26')](handleEntityNotFound(_0x56859b,null))[_0x1bd0('0x26')](saveUpdates(_0x494186[_0x1bd0('0x4c')],null))[_0x1bd0('0x26')](respondWithResult(_0x56859b,null))['catch'](handleError(_0x56859b,null));};exports[_0x1bd0('0x27')]=function(_0x27d667,_0x5e835e){return db['MailTransferReport'][_0x1bd0('0x49')]({'where':{'id':_0x27d667[_0x1bd0('0x47')]['id']}})[_0x1bd0('0x26')](handleEntityNotFound(_0x5e835e,null))[_0x1bd0('0x26')](removeEntity(_0x5e835e,null))[_0x1bd0('0x4a')](handleError(_0x5e835e,null));};exports[_0x1bd0('0x4d')]=function(_0x25ed5b,_0x1e089f){return db[_0x1bd0('0x2e')][_0x1bd0('0x4d')]()[_0x1bd0('0x26')](respondWithResult(_0x1e089f,null))[_0x1bd0('0x4a')](handleError(_0x1e089f,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 2f57b16..425ea19 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 _0xfa12=['./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment'];(function(_0x536502,_0x1eb50d){var _0x3e9eab=function(_0x1fc441){while(--_0x1fc441){_0x536502['push'](_0x536502['shift']());}};_0x3e9eab(++_0x1eb50d);}(_0xfa12,0x1bd));var _0x2fa1=function(_0x50418e,_0x230c8c){_0x50418e=_0x50418e-0x0;var _0x14f0b6=_0xfa12[_0x50418e];return _0x14f0b6;};'use strict';var _=require(_0x2fa1('0x0'));var util=require(_0x2fa1('0x1'));var logger=require(_0x2fa1('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2fa1('0x3'));var rp=require(_0x2fa1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2fa1('0x5'));var attributes=require(_0x2fa1('0x6'));module[_0x2fa1('0x7')]=function(_0x4dfb6e,_0x19a57a){return _0x4dfb6e['define'](_0x2fa1('0x8'),attributes,{'tableName':_0x2fa1('0x9'),'paranoid':![],'indexes':[{'name':_0x2fa1('0xa'),'fields':[_0x2fa1('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c4d=['MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','request-promise','path','rimraf','./mailTransferReport.attributes','exports','define'];(function(_0x1476fb,_0x467d01){var _0x44f57e=function(_0x4d7771){while(--_0x4d7771){_0x1476fb['push'](_0x1476fb['shift']());}};_0x44f57e(++_0x467d01);}(_0x5c4d,0x18f));var _0xd5c4=function(_0xcf6d0d,_0x490049){_0xcf6d0d=_0xcf6d0d-0x0;var _0x4bc54e=_0x5c4d[_0xcf6d0d];return _0x4bc54e;};'use strict';var _=require(_0xd5c4('0x0'));var util=require('util');var logger=require(_0xd5c4('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd5c4('0x2'));var fs=require('fs');var path=require(_0xd5c4('0x3'));var rimraf=require(_0xd5c4('0x4'));var config=require('../../config/environment');var attributes=require(_0xd5c4('0x5'));module[_0xd5c4('0x6')]=function(_0x204a6f,_0x422cd8){return _0x204a6f[_0xd5c4('0x7')](_0xd5c4('0x8'),attributes,{'tableName':_0xd5c4('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd5c4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 259859c..4b1f32a 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 _0x18fd=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x4afac5,_0x1ab4ed){var _0x2404b3=function(_0x5c700b){while(--_0x5c700b){_0x4afac5['push'](_0x4afac5['shift']());}};_0x2404b3(++_0x1ab4ed);}(_0x18fd,0x9a));var _0xd18f=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x18fd[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0xd18f('0x0'));var util=require(_0xd18f('0x1'));var moment=require(_0xd18f('0x2'));var BPromise=require(_0xd18f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd18f('0x4'));var db=require(_0xd18f('0x5'))['db'];var utils=require(_0xd18f('0x6'));var logger=require('../../config/logger')(_0xd18f('0x7'));var config=require(_0xd18f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd18f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e9fa6,_0x5d5c07,_0x5327e5){return new BPromise(function(_0x2f9dfe,_0x337ffa){return client[_0xd18f('0xa')](_0x1e9fa6,_0x5327e5)[_0xd18f('0xb')](function(_0x4e5913){logger[_0xd18f('0xc')](_0xd18f('0xd'),_0x5d5c07,_0xd18f('0xe'));logger[_0xd18f('0xf')](_0xd18f('0x10'),_0x5d5c07,_0xd18f('0xe'),JSON['stringify'](_0x4e5913));if(_0x4e5913[_0xd18f('0x11')]){if(_0x4e5913[_0xd18f('0x11')][_0xd18f('0x12')]===0x1f4){logger[_0xd18f('0x11')](_0xd18f('0xd'),_0x5d5c07,_0x4e5913[_0xd18f('0x11')]['message']);return _0x337ffa(_0x4e5913['error'][_0xd18f('0x13')]);}logger['error'](_0xd18f('0xd'),_0x5d5c07,_0x4e5913[_0xd18f('0x11')][_0xd18f('0x13')]);return _0x2f9dfe(_0x4e5913[_0xd18f('0x11')][_0xd18f('0x13')]);}else{logger[_0xd18f('0xc')](_0xd18f('0xd'),_0x5d5c07,_0xd18f('0xe'));_0x2f9dfe(_0x4e5913[_0xd18f('0x14')][_0xd18f('0x13')]);}})[_0xd18f('0x15')](function(_0x8ef08f){logger[_0xd18f('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x5d5c07,_0x8ef08f);_0x337ffa(_0x8ef08f);});});} \ No newline at end of file +var _0xd106=['jayson/promise','client','http','then','info','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd106,0x167));var _0x6d10=function(_0x1c751a,_0x46b708){_0x1c751a=_0x1c751a-0x0;var _0x4f97e4=_0xd106[_0x1c751a];return _0x4f97e4;};'use strict';var _=require(_0x6d10('0x0'));var util=require(_0x6d10('0x1'));var moment=require('moment');var BPromise=require(_0x6d10('0x2'));var rs=require(_0x6d10('0x3'));var fs=require('fs');var Redis=require(_0x6d10('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d10('0x5'));var logger=require(_0x6d10('0x6'))(_0x6d10('0x7'));var config=require(_0x6d10('0x8'));var jayson=require(_0x6d10('0x9'));var client=jayson[_0x6d10('0xa')][_0x6d10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b0d69,_0x4aeeef,_0x562a24){return new BPromise(function(_0x5d81ea,_0x46a22c){return client['request'](_0x4b0d69,_0x562a24)[_0x6d10('0xc')](function(_0x5486c0){logger[_0x6d10('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x4aeeef,'request\x20sent');logger[_0x6d10('0xe')](_0x6d10('0xf'),_0x4aeeef,_0x6d10('0x10'),JSON[_0x6d10('0x11')](_0x5486c0));if(_0x5486c0[_0x6d10('0x12')]){if(_0x5486c0[_0x6d10('0x12')][_0x6d10('0x13')]===0x1f4){logger[_0x6d10('0x12')](_0x6d10('0x14'),_0x4aeeef,_0x5486c0['error']['message']);return _0x46a22c(_0x5486c0['error'][_0x6d10('0x15')]);}logger[_0x6d10('0x12')](_0x6d10('0x14'),_0x4aeeef,_0x5486c0[_0x6d10('0x12')][_0x6d10('0x15')]);return _0x5d81ea(_0x5486c0[_0x6d10('0x12')][_0x6d10('0x15')]);}else{logger[_0x6d10('0xd')](_0x6d10('0x14'),_0x4aeeef,_0x6d10('0x10'));_0x5d81ea(_0x5486c0[_0x6d10('0x16')][_0x6d10('0x15')]);}})['catch'](function(_0x11c991){logger[_0x6d10('0x12')](_0x6d10('0x14'),_0x4aeeef,_0x11c991);_0x46a22c(_0x11c991);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 2bf388b..b796ed3 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 _0x9a57=['index','/describe','isAuthenticated','describe','/:id','show','put','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x9a57,0x87));var _0x79a5=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x9a57[_0x11c573];return _0x6b72de;};'use strict';var multer=require(_0x79a5('0x0'));var util=require(_0x79a5('0x1'));var path=require(_0x79a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x79a5('0x3'));var router=express[_0x79a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x79a5('0x5'));var interaction=require(_0x79a5('0x6'));var config=require(_0x79a5('0x7'));var controller=require('./memberReport.controller');router[_0x79a5('0x8')]('/',auth['isAuthenticated'](),controller[_0x79a5('0x9')]);router[_0x79a5('0x8')](_0x79a5('0xa'),auth[_0x79a5('0xb')](),controller[_0x79a5('0xc')]);router['get'](_0x79a5('0xd'),auth['isAuthenticated'](),controller[_0x79a5('0xe')]);router['post']('/',auth[_0x79a5('0xb')](),controller['create']);router[_0x79a5('0xf')](_0x79a5('0xd'),auth[_0x79a5('0xb')](),controller['update']);router['delete']('/:id',auth[_0x79a5('0xb')](),controller[_0x79a5('0x10')]);module[_0x79a5('0x11')]=router; \ No newline at end of file +var _0x8fda=['describe','/:id','show','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated'];(function(_0x456890,_0x15ed18){var _0xe7865d=function(_0xb7eb2a){while(--_0xb7eb2a){_0x456890['push'](_0x456890['shift']());}};_0xe7865d(++_0x15ed18);}(_0x8fda,0x1d1));var _0xa8fd=function(_0x2bd319,_0xc2b28d){_0x2bd319=_0x2bd319-0x0;var _0x511871=_0x8fda[_0x2bd319];return _0x511871;};'use strict';var multer=require('multer');var util=require(_0xa8fd('0x0'));var path=require(_0xa8fd('0x1'));var timeout=require(_0xa8fd('0x2'));var express=require(_0xa8fd('0x3'));var router=express[_0xa8fd('0x4')]();var fs_extra=require(_0xa8fd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa8fd('0x6'));var config=require(_0xa8fd('0x7'));var controller=require(_0xa8fd('0x8'));router[_0xa8fd('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa8fd('0x9')]('/describe',auth[_0xa8fd('0xa')](),controller[_0xa8fd('0xb')]);router[_0xa8fd('0x9')](_0xa8fd('0xc'),auth[_0xa8fd('0xa')](),controller[_0xa8fd('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa8fd('0xc'),auth[_0xa8fd('0xa')](),controller[_0xa8fd('0xe')]);router['delete'](_0xa8fd('0xc'),auth[_0xa8fd('0xa')](),controller[_0xa8fd('0xf')]);module[_0xa8fd('0x10')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 004e050..0b60a2b 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 _0xf102=['seconds','setDataValue','duration','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff'];(function(_0x149657,_0xbb8f3f){var _0x26e48c=function(_0x23bfcf){while(--_0x23bfcf){_0x149657['push'](_0x149657['shift']());}};_0x26e48c(++_0xbb8f3f);}(_0xf102,0x148));var _0x2f10=function(_0x912d27,_0x28e0e3){_0x912d27=_0x912d27-0x0;var _0x31b918=_0xf102[_0x912d27];return _0x31b918;};'use strict';var Sequelize=require(_0x2f10('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0x2f10('0x1')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x2f10('0x1')]},'type':{'type':Sequelize[_0x2f10('0x1')],'defaultValue':_0x2f10('0x2'),'comment':_0x2f10('0x3')},'duration':{'type':Sequelize[_0x2f10('0x4')]},'enterAt':{'type':Sequelize[_0x2f10('0x5')]},'exitAt':{'type':Sequelize[_0x2f10('0x5')],'set':function(_0x289a03){var _0x3d7bc2=moment(_0x289a03);var _0x185977=moment(this['getDataValue'](_0x2f10('0x6')));var _0x1b5c2d=_0x3d7bc2[_0x2f10('0x7')](_0x185977,_0x2f10('0x8'));this[_0x2f10('0x9')]('exitAt',_0x289a03);this[_0x2f10('0x9')](_0x2f10('0xa'),_0x1b5c2d>=0x0?_0x1b5c2d:null);}},'data1':{'type':Sequelize[_0x2f10('0x1')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x2f10('0x1')],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0x2f10('0xb')},'data4':{'type':Sequelize['STRING'],'comment':_0x2f10('0xc')},'data5':{'type':Sequelize[_0x2f10('0x1')],'comment':_0x2f10('0xd')},'role':{'type':Sequelize[_0x2f10('0x1')]},'internal':{'type':Sequelize[_0x2f10('0x4')]},'uniqueid':{'type':Sequelize[_0x2f10('0x1')]}}; \ No newline at end of file +var _0x0c79=['DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x0c79,0x10a));var _0x90c7=function(_0x10a991,_0x4fc79c){_0x10a991=_0x10a991-0x0;var _0x4c0cbe=_0x0c79[_0x10a991];return _0x4c0cbe;};'use strict';var Sequelize=require(_0x90c7('0x0'));var moment=require(_0x90c7('0x1'));module[_0x90c7('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x90c7('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x90c7('0x4')},'duration':{'type':Sequelize[_0x90c7('0x5')]},'enterAt':{'type':Sequelize[_0x90c7('0x6')]},'exitAt':{'type':Sequelize[_0x90c7('0x6')],'set':function(_0x22fbf9){var _0x3e2f52=moment(_0x22fbf9);var _0x56bc9e=moment(this[_0x90c7('0x7')](_0x90c7('0x8')));var _0x201171=_0x3e2f52[_0x90c7('0x9')](_0x56bc9e,_0x90c7('0xa'));this[_0x90c7('0xb')](_0x90c7('0xc'),_0x22fbf9);this[_0x90c7('0xb')]('duration',_0x201171>=0x0?_0x201171:null);}},'data1':{'type':Sequelize[_0x90c7('0x3')],'comment':_0x90c7('0xd')},'data2':{'type':Sequelize[_0x90c7('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x90c7('0x3')],'comment':_0x90c7('0xe')},'data4':{'type':Sequelize[_0x90c7('0x3')],'comment':_0x90c7('0xf')},'data5':{'type':Sequelize[_0x90c7('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x90c7('0x3')]},'internal':{'type':Sequelize[_0x90c7('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 9c5429c..2885897 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x3f1aa9,_0x54983f){var _0x5d11b7=function(_0x5997b0){while(--_0x5997b0){_0x3f1aa9['push'](_0x3f1aa9['shift']());}};_0x5d11b7(++_0x54983f);}(_0x008c,0x188));var _0xc008=function(_0x19e38e,_0xb15cc7){_0x19e38e=_0x19e38e-0x0;var _0x14bec3=_0x008c[_0x19e38e];return _0x14bec3;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file +var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x2cf37f,_0x2217b7){var _0x1bd369=function(_0x12d071){while(--_0x12d071){_0x2cf37f['push'](_0x2cf37f['shift']());}};_0x1bd369(++_0x2217b7);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 3b83688..da968d8 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 _0x18e9=['MemberReport','report_member','membername','interface','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x18e9,0x1e5));var _0x918e=function(_0x33c9f8,_0x5aedbb){_0x33c9f8=_0x33c9f8-0x0;var _0x2d7004=_0x18e9[_0x33c9f8];return _0x2d7004;};'use strict';var _=require(_0x918e('0x0'));var util=require(_0x918e('0x1'));var logger=require(_0x918e('0x2'))(_0x918e('0x3'));var moment=require(_0x918e('0x4'));var BPromise=require('bluebird');var rp=require(_0x918e('0x5'));var fs=require('fs');var path=require(_0x918e('0x6'));var rimraf=require('rimraf');var config=require(_0x918e('0x7'));var attributes=require('./memberReport.attributes');module[_0x918e('0x8')]=function(_0x683f8,_0x194473){return _0x683f8['define'](_0x918e('0x9'),attributes,{'tableName':_0x918e('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x918e('0xb'),_0x918e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb30f=['request-promise','path','rimraf','./memberReport.attributes','exports','define','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment'];(function(_0x2ae373,_0x1adf9a){var _0x2c2ce9=function(_0x320217){while(--_0x320217){_0x2ae373['push'](_0x2ae373['shift']());}};_0x2c2ce9(++_0x1adf9a);}(_0xb30f,0x109));var _0xfb30=function(_0x3ebc80,_0x2b219b){_0x3ebc80=_0x3ebc80-0x0;var _0x96963c=_0xb30f[_0x3ebc80];return _0x96963c;};'use strict';var _=require(_0xfb30('0x0'));var util=require(_0xfb30('0x1'));var logger=require(_0xfb30('0x2'))(_0xfb30('0x3'));var moment=require(_0xfb30('0x4'));var BPromise=require('bluebird');var rp=require(_0xfb30('0x5'));var fs=require('fs');var path=require(_0xfb30('0x6'));var rimraf=require(_0xfb30('0x7'));var config=require('../../config/environment');var attributes=require(_0xfb30('0x8'));module[_0xfb30('0x9')]=function(_0x3aed60,_0x2ce236){return _0x3aed60[_0xfb30('0xa')]('MemberReport',attributes,{'tableName':_0xfb30('0xb'),'paranoid':![],'indexes':[{'name':_0xfb30('0xc'),'fields':[_0xfb30('0xd'),_0xfb30('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 5ab30e7..92c27c6 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 _0x9f7a=['ioredis','rpc','../../config/environment','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetMemberReport','MemberReport','findAll','options','raw','where','include','map','model','attributes','CreateMemberReport','debug','UpdateMemberReport','update','body','limit','lodash','util','moment','bluebird'];(function(_0x409deb,_0x2b731){var _0x15a4f7=function(_0x556510){while(--_0x556510){_0x409deb['push'](_0x409deb['shift']());}};_0x15a4f7(++_0x2b731);}(_0x9f7a,0xf1));var _0xa9f7=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x9f7a[_0x1203f];return _0x365f0a;};'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')]('MemberReport,\x20%s,\x20%s',_0x48e791,_0x287478[_0xa9f7('0xe')]['message']);return _0x58a3f3(_0x287478[_0xa9f7('0xe')][_0xa9f7('0x10')]);}logger[_0xa9f7('0xe')]('MemberReport,\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);});});}exports[_0xa9f7('0x13')]=function(_0x230904){var _0x11652b=this;return new Promise(function(_0x8da225,_0xf01914){return db[_0xa9f7('0x14')][_0xa9f7('0x15')]({'raw':_0x230904[_0xa9f7('0x16')]?_0x230904['options'][_0xa9f7('0x17')]===undefined?!![]:![]:!![],'where':_0x230904[_0xa9f7('0x16')]?_0x230904[_0xa9f7('0x16')][_0xa9f7('0x18')]||null:null,'attributes':_0x230904[_0xa9f7('0x16')]?_0x230904['options']['attributes']||null:null,'limit':_0x230904['options']?_0x230904['options']['limit']||null:null,'include':_0x230904[_0xa9f7('0x16')]?_0x230904['options'][_0xa9f7('0x19')]?_['map'](_0x230904['options'][_0xa9f7('0x19')],function(_0x530992){return{'model':db[_0x530992['model']],'as':_0x530992['as'],'attributes':_0x530992['attributes'],'include':_0x530992[_0xa9f7('0x19')]?_[_0xa9f7('0x1a')](_0x530992[_0xa9f7('0x19')],function(_0x537d55){return{'model':db[_0x537d55[_0xa9f7('0x1b')]],'as':_0x537d55['as'],'attributes':_0x537d55[_0xa9f7('0x1c')],'include':_0x537d55[_0xa9f7('0x19')]?_['map'](_0x537d55[_0xa9f7('0x19')],function(_0x52bb0a){return{'model':db[_0x52bb0a[_0xa9f7('0x1b')]],'as':_0x52bb0a['as'],'attributes':_0x52bb0a['attributes']};}):[]};}):[]};}):[]:[]})[_0xa9f7('0x9')](function(_0x425a99){logger[_0xa9f7('0x11')](_0xa9f7('0x13'),_0x230904);logger['debug'](_0xa9f7('0x13'),_0x230904,JSON[_0xa9f7('0xd')](_0x425a99));_0x8da225(_0x425a99);})[_0xa9f7('0x12')](function(_0x312084){logger[_0xa9f7('0xe')](_0xa9f7('0x13'),_0x312084[_0xa9f7('0x10')],_0x230904);_0xf01914(_0x11652b[_0xa9f7('0xe')](0x1f4,_0x312084['message']));});});};exports['CreateMemberReport']=function(_0x519aea){var _0x224f2e=this;return new Promise(function(_0x1b04d5,_0x510a06){return db[_0xa9f7('0x14')]['create'](_0x519aea['body'],{'raw':_0x519aea['options']?_0x519aea[_0xa9f7('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xa9f7('0x9')](function(_0x10c393){logger[_0xa9f7('0x11')](_0xa9f7('0x1d'),_0x519aea);logger[_0xa9f7('0x1e')]('CreateMemberReport',_0x519aea,JSON[_0xa9f7('0xd')](_0x10c393));_0x1b04d5(_0x10c393);})[_0xa9f7('0x12')](function(_0x484e51){logger[_0xa9f7('0xe')](_0xa9f7('0x1d'),_0x484e51['message'],_0x519aea);_0x510a06(_0x224f2e[_0xa9f7('0xe')](0x1f4,_0x484e51[_0xa9f7('0x10')]));});});};exports[_0xa9f7('0x1f')]=function(_0x55f85f){var _0x58f401=this;return new Promise(function(_0x28283c,_0x3c79b2){return db[_0xa9f7('0x14')][_0xa9f7('0x20')](_0x55f85f[_0xa9f7('0x21')],{'raw':_0x55f85f['options']?_0x55f85f[_0xa9f7('0x16')][_0xa9f7('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55f85f[_0xa9f7('0x16')]?_0x55f85f['options']['where']||null:null,'attributes':_0x55f85f[_0xa9f7('0x16')]?_0x55f85f['options'][_0xa9f7('0x1c')]||null:null,'limit':_0x55f85f[_0xa9f7('0x16')]?_0x55f85f[_0xa9f7('0x16')][_0xa9f7('0x22')]||null:null})['then'](function(_0x3bc8c8){logger[_0xa9f7('0x11')](_0xa9f7('0x1f'),_0x55f85f);logger[_0xa9f7('0x1e')](_0xa9f7('0x1f'),_0x55f85f,JSON[_0xa9f7('0xd')](_0x3bc8c8));_0x28283c(_0x3bc8c8);})[_0xa9f7('0x12')](function(_0x492b73){logger[_0xa9f7('0xe')](_0xa9f7('0x1f'),_0x492b73['message'],_0x55f85f);_0x3c79b2(_0x58f401[_0xa9f7('0xe')](0x1f4,_0x492b73[_0xa9f7('0x10')]));});});}; \ No newline at end of file +var _0xd101=['request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','raw','options','attributes','include','map','model','CreateMemberReport','create','body','stringify','UpdateMemberReport','update','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd101,0xc1));var _0x1d10=function(_0x5f2ed3,_0x5ceda6){_0x5f2ed3=_0x5f2ed3-0x0;var _0x46437b=_0xd101[_0x5f2ed3];return _0x46437b;};'use strict';var _=require(_0x1d10('0x0'));var util=require('util');var moment=require(_0x1d10('0x1'));var BPromise=require(_0x1d10('0x2'));var rs=require(_0x1d10('0x3'));var fs=require('fs');var Redis=require(_0x1d10('0x4'));var db=require(_0x1d10('0x5'))['db'];var utils=require(_0x1d10('0x6'));var logger=require(_0x1d10('0x7'))(_0x1d10('0x8'));var config=require('../../config/environment');var jayson=require(_0x1d10('0x9'));var client=jayson[_0x1d10('0xa')][_0x1d10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27d569,_0xb9e08,_0x36335e){return new BPromise(function(_0x6d6def,_0x43df2c){return client[_0x1d10('0xc')](_0x27d569,_0x36335e)[_0x1d10('0xd')](function(_0xf7926b){logger[_0x1d10('0xe')](_0x1d10('0xf'),_0xb9e08,_0x1d10('0x10'));logger[_0x1d10('0x11')](_0x1d10('0x12'),_0xb9e08,_0x1d10('0x10'),JSON['stringify'](_0xf7926b));if(_0xf7926b[_0x1d10('0x13')]){if(_0xf7926b[_0x1d10('0x13')][_0x1d10('0x14')]===0x1f4){logger[_0x1d10('0x13')](_0x1d10('0xf'),_0xb9e08,_0xf7926b['error'][_0x1d10('0x15')]);return _0x43df2c(_0xf7926b[_0x1d10('0x13')][_0x1d10('0x15')]);}logger[_0x1d10('0x13')](_0x1d10('0xf'),_0xb9e08,_0xf7926b[_0x1d10('0x13')]['message']);return _0x6d6def(_0xf7926b[_0x1d10('0x13')][_0x1d10('0x15')]);}else{logger[_0x1d10('0xe')](_0x1d10('0xf'),_0xb9e08,'request\x20sent');_0x6d6def(_0xf7926b[_0x1d10('0x16')][_0x1d10('0x15')]);}})[_0x1d10('0x17')](function(_0x3f2f2b){logger[_0x1d10('0x13')](_0x1d10('0xf'),_0xb9e08,_0x3f2f2b);_0x43df2c(_0x3f2f2b);});});}exports[_0x1d10('0x18')]=function(_0x4f3e2a){var _0x23d604=this;return new Promise(function(_0x1163dd,_0x4ca1e8){return db[_0x1d10('0x19')][_0x1d10('0x1a')]({'raw':_0x4f3e2a['options']?_0x4f3e2a['options'][_0x1d10('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f3e2a['options']?_0x4f3e2a['options']['where']||null:null,'attributes':_0x4f3e2a[_0x1d10('0x1c')]?_0x4f3e2a[_0x1d10('0x1c')][_0x1d10('0x1d')]||null:null,'limit':_0x4f3e2a[_0x1d10('0x1c')]?_0x4f3e2a['options']['limit']||null:null,'include':_0x4f3e2a[_0x1d10('0x1c')]?_0x4f3e2a['options'][_0x1d10('0x1e')]?_[_0x1d10('0x1f')](_0x4f3e2a[_0x1d10('0x1c')][_0x1d10('0x1e')],function(_0x127b37){return{'model':db[_0x127b37[_0x1d10('0x20')]],'as':_0x127b37['as'],'attributes':_0x127b37[_0x1d10('0x1d')],'include':_0x127b37[_0x1d10('0x1e')]?_[_0x1d10('0x1f')](_0x127b37[_0x1d10('0x1e')],function(_0xf1e4c8){return{'model':db[_0xf1e4c8['model']],'as':_0xf1e4c8['as'],'attributes':_0xf1e4c8[_0x1d10('0x1d')],'include':_0xf1e4c8[_0x1d10('0x1e')]?_[_0x1d10('0x1f')](_0xf1e4c8[_0x1d10('0x1e')],function(_0x18e7d9){return{'model':db[_0x18e7d9[_0x1d10('0x20')]],'as':_0x18e7d9['as'],'attributes':_0x18e7d9[_0x1d10('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1d10('0xd')](function(_0x4f7837){logger[_0x1d10('0xe')](_0x1d10('0x18'),_0x4f3e2a);logger['debug'](_0x1d10('0x18'),_0x4f3e2a,JSON['stringify'](_0x4f7837));_0x1163dd(_0x4f7837);})['catch'](function(_0x41b5b8){logger['error'](_0x1d10('0x18'),_0x41b5b8[_0x1d10('0x15')],_0x4f3e2a);_0x4ca1e8(_0x23d604[_0x1d10('0x13')](0x1f4,_0x41b5b8[_0x1d10('0x15')]));});});};exports[_0x1d10('0x21')]=function(_0x9c6cb9){var _0x4b5400=this;return new Promise(function(_0x4e30b2,_0x1ada44){return db[_0x1d10('0x19')][_0x1d10('0x22')](_0x9c6cb9[_0x1d10('0x23')],{'raw':_0x9c6cb9[_0x1d10('0x1c')]?_0x9c6cb9[_0x1d10('0x1c')][_0x1d10('0x1b')]===undefined?!![]:![]:!![]})[_0x1d10('0xd')](function(_0x8f4818){logger[_0x1d10('0xe')]('CreateMemberReport',_0x9c6cb9);logger[_0x1d10('0x11')]('CreateMemberReport',_0x9c6cb9,JSON[_0x1d10('0x24')](_0x8f4818));_0x4e30b2(_0x8f4818);})[_0x1d10('0x17')](function(_0x5d446b){logger[_0x1d10('0x13')]('CreateMemberReport',_0x5d446b[_0x1d10('0x15')],_0x9c6cb9);_0x1ada44(_0x4b5400[_0x1d10('0x13')](0x1f4,_0x5d446b[_0x1d10('0x15')]));});});};exports[_0x1d10('0x25')]=function(_0xd50250){var _0x5eb413=this;return new Promise(function(_0x4c3ef6,_0x35025e){return db[_0x1d10('0x19')][_0x1d10('0x26')](_0xd50250['body'],{'raw':_0xd50250['options']?_0xd50250['options'][_0x1d10('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd50250['options']?_0xd50250[_0x1d10('0x1c')][_0x1d10('0x27')]||null:null,'attributes':_0xd50250[_0x1d10('0x1c')]?_0xd50250[_0x1d10('0x1c')]['attributes']||null:null,'limit':_0xd50250['options']?_0xd50250[_0x1d10('0x1c')][_0x1d10('0x28')]||null:null})[_0x1d10('0xd')](function(_0x230c19){logger['info'](_0x1d10('0x25'),_0xd50250);logger['debug'](_0x1d10('0x25'),_0xd50250,JSON[_0x1d10('0x24')](_0x230c19));_0x4c3ef6(_0x230c19);})[_0x1d10('0x17')](function(_0x8d8405){logger[_0x1d10('0x13')](_0x1d10('0x25'),_0x8d8405[_0x1d10('0x15')],_0xd50250);_0x35025e(_0x5eb413[_0x1d10('0x13')](0x1f4,_0x8d8405[_0x1d10('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 0c87b0f..4b1640d 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 _0xffaa=['util','path','connect-timeout','express','Router','../../config/environment','get','index','exports'];(function(_0x2e78d0,_0x37a4a5){var _0x561ae3=function(_0x4755de){while(--_0x4755de){_0x2e78d0['push'](_0x2e78d0['shift']());}};_0x561ae3(++_0x37a4a5);}(_0xffaa,0xe1));var _0xaffa=function(_0x5b3c13,_0x2ab2ae){_0x5b3c13=_0x5b3c13-0x0;var _0x4536e5=_0xffaa[_0x5b3c13];return _0x4536e5;};'use strict';var multer=require('multer');var util=require(_0xaffa('0x0'));var path=require(_0xaffa('0x1'));var timeout=require(_0xaffa('0x2'));var express=require(_0xaffa('0x3'));var router=express[_0xaffa('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaffa('0x5'));var controller=require('./migration.controller');router[_0xaffa('0x6')]('/',controller[_0xaffa('0x7')]);module[_0xaffa('0x8')]=router; \ No newline at end of file +var _0x49fe=['../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','exports','multer','util','path','Router'];(function(_0x284d8f,_0x1afc9e){var _0x6acf64=function(_0x1f62fa){while(--_0x1f62fa){_0x284d8f['push'](_0x284d8f['shift']());}};_0x6acf64(++_0x1afc9e);}(_0x49fe,0x100));var _0xe49f=function(_0x494419,_0x163d46){_0x494419=_0x494419-0x0;var _0x188f66=_0x49fe[_0x494419];return _0x188f66;};'use strict';var multer=require(_0xe49f('0x0'));var util=require(_0xe49f('0x1'));var path=require(_0xe49f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe49f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe49f('0x4'));var interaction=require(_0xe49f('0x5'));var config=require(_0xe49f('0x6'));var controller=require(_0xe49f('0x7'));router['get']('/',controller[_0xe49f('0x8')]);module[_0xe49f('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 0d7c971..684903a 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 _0x5e1c=['exports','sequelize'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0x5e1c,0x1cb));var _0xc5e1=function(_0x10803f,_0x225c0d){_0x10803f=_0x10803f-0x0;var _0x525d86=_0x5e1c[_0x10803f];return _0x525d86;};'use strict';var Sequelize=require(_0xc5e1('0x0'));module[_0xc5e1('0x1')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0xd33c=['version','STRING'];(function(_0x11f249,_0x4ca4a8){var _0x5c3656=function(_0x27c9f8){while(--_0x27c9f8){_0x11f249['push'](_0x11f249['shift']());}};_0x5c3656(++_0x4ca4a8);}(_0xd33c,0xc5));var _0xcd33=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xd33c[_0x3de8a4];return _0x4635cf;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize[_0xcd33('0x0')],'unique':_0xcd33('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 888a16a..7d15974 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 _0xe740=['type','key','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','then','destroy','error','name','send','index','map','Migration'];(function(_0x35d483,_0x28b4a0){var _0x99edb7=function(_0x57ce32){while(--_0x57ce32){_0x35d483['push'](_0x35d483['shift']());}};_0x99edb7(++_0x28b4a0);}(_0xe740,0x14b));var _0x0e74=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0xe740[_0x2e2681];return _0x368a64;};'use strict';var emlformat=require(_0x0e74('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0e74('0x1'));var jsonpatch=require(_0x0e74('0x2'));var rp=require('request-promise');var moment=require(_0x0e74('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0e74('0x4'));var util=require('util');var path=require(_0x0e74('0x5'));var sox=require(_0x0e74('0x6'));var csv=require('to-csv');var ejs=require(_0x0e74('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e74('0x8'));var squel=require(_0x0e74('0x9'));var crypto=require(_0x0e74('0xa'));var jsforce=require(_0x0e74('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0e74('0xc'));var querystring=require(_0x0e74('0xd'));var Papa=require(_0x0e74('0xe'));var Redis=require(_0x0e74('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0e74('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e74('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x0e74('0x12'));var config=require(_0x0e74('0x13'));var licenseUtil=require(_0x0e74('0x14'));var db=require(_0x0e74('0x15'))['db'];function respondWithStatusCode(_0x4b45f0,_0x3dc1b4){_0x3dc1b4=_0x3dc1b4||0xcc;return function(_0x4882f0){if(_0x4882f0){return _0x4b45f0[_0x0e74('0x16')](_0x3dc1b4);}return _0x4b45f0[_0x0e74('0x17')](_0x3dc1b4)[_0x0e74('0x18')]();};}function respondWithResult(_0x3784b3,_0x1b0a50){_0x1b0a50=_0x1b0a50||0xc8;return function(_0x2acc44){if(_0x2acc44){return _0x3784b3[_0x0e74('0x17')](_0x1b0a50)[_0x0e74('0x19')](_0x2acc44);}};}function respondWithFilteredResult(_0x3fee34,_0x276f92){return function(_0x1c9156){if(_0x1c9156){var _0x205272=typeof _0x276f92[_0x0e74('0x1a')]==='undefined'&&typeof _0x276f92['limit']===_0x0e74('0x1b');var _0x472a49=_0x1c9156[_0x0e74('0x1c')];var _0x244a51=_0x205272?0x0:_0x276f92[_0x0e74('0x1a')];var _0x1bccf4=_0x205272?_0x1c9156[_0x0e74('0x1c')]:_0x276f92[_0x0e74('0x1a')]+_0x276f92[_0x0e74('0x1d')];var _0x3c7f30;if(_0x1bccf4>=_0x472a49){_0x1bccf4=_0x472a49;_0x3c7f30=0xc8;}else{_0x3c7f30=0xce;}_0x3fee34[_0x0e74('0x17')](_0x3c7f30);return _0x3fee34['set'](_0x0e74('0x1e'),_0x244a51+'-'+_0x1bccf4+'/'+_0x472a49)[_0x0e74('0x19')](_0x1c9156);}return null;};}function patchUpdates(_0x3cf369){return function(_0x24df6b){try{jsonpatch[_0x0e74('0x1f')](_0x24df6b,_0x3cf369,!![]);}catch(_0x44ef8a){return BPromise['reject'](_0x44ef8a);}return _0x24df6b[_0x0e74('0x20')]();};}function saveUpdates(_0x2497a9,_0x5a676c){return function(_0x461db8){if(_0x461db8){return _0x461db8['update'](_0x2497a9)[_0x0e74('0x21')](function(_0x904ad0){return _0x904ad0;});}return null;};}function removeEntity(_0x369cc8,_0x281f75){return function(_0x115ac4){if(_0x115ac4){return _0x115ac4[_0x0e74('0x22')]()[_0x0e74('0x21')](function(){_0x369cc8[_0x0e74('0x17')](0xcc)[_0x0e74('0x18')]();});}};}function handleEntityNotFound(_0x12de91,_0x41fb43){return function(_0x285a32){if(!_0x285a32){_0x12de91[_0x0e74('0x16')](0x194);}return _0x285a32;};}function handleError(_0x536143,_0x2709be){_0x2709be=_0x2709be||0x1f4;return function(_0x190a72){logger[_0x0e74('0x23')](_0x190a72['stack']);if(_0x190a72[_0x0e74('0x24')]){delete _0x190a72[_0x0e74('0x24')];}_0x536143[_0x0e74('0x17')](_0x2709be)[_0x0e74('0x25')](_0x190a72);};}exports[_0x0e74('0x26')]=function(_0x4a895d,_0x100950){var _0x172870={},_0x18064a={},_0x45aae8={'count':0x0,'rows':[]};var _0x499b9a=_[_0x0e74('0x27')](db[_0x0e74('0x28')]['rawAttributes'],function(_0x66d22d){return{'name':_0x66d22d['fieldName'],'type':_0x66d22d[_0x0e74('0x29')][_0x0e74('0x2a')]};});_0x18064a['model']=_[_0x0e74('0x27')](_0x499b9a,_0x0e74('0x24'));_0x18064a[_0x0e74('0x2b')]=_[_0x0e74('0x2c')](_0x4a895d[_0x0e74('0x2b')]);_0x18064a[_0x0e74('0x2d')]=_['intersection'](_0x18064a['model'],_0x18064a[_0x0e74('0x2b')]);_0x172870[_0x0e74('0x2e')]=_['intersection'](_0x18064a['model'],qs[_0x0e74('0x2f')](_0x4a895d['query'][_0x0e74('0x2f')]));_0x172870[_0x0e74('0x2e')]=_0x172870[_0x0e74('0x2e')][_0x0e74('0x30')]?_0x172870[_0x0e74('0x2e')]:_0x18064a['model'];if(!_0x4a895d['query'][_0x0e74('0x31')](_0x0e74('0x32'))){_0x172870[_0x0e74('0x1d')]=qs[_0x0e74('0x1d')](_0x4a895d['query'][_0x0e74('0x1d')]);_0x172870['offset']=qs['offset'](_0x4a895d['query']['offset']);}_0x172870[_0x0e74('0x33')]=qs[_0x0e74('0x34')](_0x4a895d[_0x0e74('0x2b')][_0x0e74('0x34')]);_0x172870[_0x0e74('0x35')]=qs[_0x0e74('0x2d')](_[_0x0e74('0x36')](_0x4a895d[_0x0e74('0x2b')],_0x18064a[_0x0e74('0x2d')]),_0x499b9a);if(_0x4a895d['query'][_0x0e74('0x37')]){_0x172870['where']=_[_0x0e74('0x38')](_0x172870[_0x0e74('0x35')],{'$or':_[_0x0e74('0x27')](_0x499b9a,function(_0xed6a32){if(_0xed6a32[_0x0e74('0x29')]!==_0x0e74('0x39')){var _0x3b46da={};_0x3b46da[_0xed6a32[_0x0e74('0x24')]]={'$like':'%'+_0x4a895d[_0x0e74('0x2b')]['filter']+'%'};return _0x3b46da;}})});}_0x172870=_[_0x0e74('0x38')]({},_0x172870,_0x4a895d[_0x0e74('0x3a')]);var _0x1e1dd2={'where':_0x172870[_0x0e74('0x35')]};return db[_0x0e74('0x28')][_0x0e74('0x1c')](_0x1e1dd2)[_0x0e74('0x21')](function(_0xcf3ca4){_0x45aae8[_0x0e74('0x1c')]=_0xcf3ca4;if(_0x4a895d['query']['includeAll']){_0x172870[_0x0e74('0x3b')]=[{'all':!![]}];}return db['Migration']['findAll'](_0x172870);})[_0x0e74('0x21')](function(_0x30e90b){_0x45aae8[_0x0e74('0x3c')]=_0x30e90b;return _0x45aae8;})[_0x0e74('0x21')](respondWithFilteredResult(_0x100950,_0x172870))[_0x0e74('0x3d')](handleError(_0x100950,null));}; \ No newline at end of file +var _0x8e6b=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x198635,_0x526ff0){var _0x5a9525=function(_0x284122){while(--_0x284122){_0x198635['push'](_0x198635['shift']());}};_0x5a9525(++_0x526ff0);}(_0x8e6b,0x112));var _0xb8e6=function(_0x56609c,_0x2417b0){_0x56609c=_0x56609c-0x0;var _0x5fed8=_0x8e6b[_0x56609c];return _0x5fed8;};'use strict';var emlformat=require(_0xb8e6('0x0'));var rimraf=require(_0xb8e6('0x1'));var zipdir=require(_0xb8e6('0x2'));var jsonpatch=require(_0xb8e6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb8e6('0x4'));var Mustache=require('mustache');var util=require(_0xb8e6('0x5'));var path=require(_0xb8e6('0x6'));var sox=require(_0xb8e6('0x7'));var csv=require('to-csv');var ejs=require(_0xb8e6('0x8'));var fs=require('fs');var fs_extra=require(_0xb8e6('0x9'));var _=require(_0xb8e6('0xa'));var squel=require(_0xb8e6('0xb'));var crypto=require(_0xb8e6('0xc'));var jsforce=require(_0xb8e6('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb8e6('0xe'));var authService=require(_0xb8e6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb8e6('0x10'));var hardwareService=require(_0xb8e6('0x11'));var logger=require(_0xb8e6('0x12'))(_0xb8e6('0x13'));var utils=require(_0xb8e6('0x14'));var config=require(_0xb8e6('0x15'));var licenseUtil=require(_0xb8e6('0x16'));var db=require(_0xb8e6('0x17'))['db'];function respondWithStatusCode(_0x467f30,_0x405722){_0x405722=_0x405722||0xcc;return function(_0x4cf89d){if(_0x4cf89d){return _0x467f30[_0xb8e6('0x18')](_0x405722);}return _0x467f30[_0xb8e6('0x19')](_0x405722)[_0xb8e6('0x1a')]();};}function respondWithResult(_0x300740,_0x9b8e0d){_0x9b8e0d=_0x9b8e0d||0xc8;return function(_0x15bec8){if(_0x15bec8){return _0x300740[_0xb8e6('0x19')](_0x9b8e0d)['json'](_0x15bec8);}};}function respondWithFilteredResult(_0xfec780,_0x2b6fc7){return function(_0x1a4f83){if(_0x1a4f83){var _0x1fb8bb=typeof _0x2b6fc7[_0xb8e6('0x1b')]===_0xb8e6('0x1c')&&typeof _0x2b6fc7[_0xb8e6('0x1d')]===_0xb8e6('0x1c');var _0x1a9b80=_0x1a4f83['count'];var _0x1bf270=_0x1fb8bb?0x0:_0x2b6fc7[_0xb8e6('0x1b')];var _0xd47c7a=_0x1fb8bb?_0x1a4f83[_0xb8e6('0x1e')]:_0x2b6fc7['offset']+_0x2b6fc7[_0xb8e6('0x1d')];var _0x3b5211;if(_0xd47c7a>=_0x1a9b80){_0xd47c7a=_0x1a9b80;_0x3b5211=0xc8;}else{_0x3b5211=0xce;}_0xfec780[_0xb8e6('0x19')](_0x3b5211);return _0xfec780[_0xb8e6('0x1f')]('Content-Range',_0x1bf270+'-'+_0xd47c7a+'/'+_0x1a9b80)[_0xb8e6('0x20')](_0x1a4f83);}return null;};}function patchUpdates(_0x80e433){return function(_0x466777){try{jsonpatch[_0xb8e6('0x21')](_0x466777,_0x80e433,!![]);}catch(_0x28a1a6){return BPromise[_0xb8e6('0x22')](_0x28a1a6);}return _0x466777[_0xb8e6('0x23')]();};}function saveUpdates(_0x54716a,_0x3366a9){return function(_0x1b854f){if(_0x1b854f){return _0x1b854f[_0xb8e6('0x24')](_0x54716a)[_0xb8e6('0x25')](function(_0x30a4cf){return _0x30a4cf;});}return null;};}function removeEntity(_0x1c8830,_0x625460){return function(_0x271edf){if(_0x271edf){return _0x271edf[_0xb8e6('0x26')]()['then'](function(){_0x1c8830[_0xb8e6('0x19')](0xcc)[_0xb8e6('0x1a')]();});}};}function handleEntityNotFound(_0x2b7314,_0x28304b){return function(_0x29bb88){if(!_0x29bb88){_0x2b7314[_0xb8e6('0x18')](0x194);}return _0x29bb88;};}function handleError(_0x339719,_0x134cd7){_0x134cd7=_0x134cd7||0x1f4;return function(_0x1c1697){logger[_0xb8e6('0x27')](_0x1c1697['stack']);if(_0x1c1697[_0xb8e6('0x28')]){delete _0x1c1697[_0xb8e6('0x28')];}_0x339719['status'](_0x134cd7)[_0xb8e6('0x29')](_0x1c1697);};}exports[_0xb8e6('0x2a')]=function(_0x3c6810,_0x23e20a){var _0x5f8c02={},_0x9aeb8e={},_0x1dc971={'count':0x0,'rows':[]};var _0x52276d=_[_0xb8e6('0x2b')](db[_0xb8e6('0x2c')][_0xb8e6('0x2d')],function(_0x3116b7){return{'name':_0x3116b7[_0xb8e6('0x2e')],'type':_0x3116b7[_0xb8e6('0x2f')][_0xb8e6('0x30')]};});_0x9aeb8e[_0xb8e6('0x31')]=_[_0xb8e6('0x2b')](_0x52276d,_0xb8e6('0x28'));_0x9aeb8e[_0xb8e6('0x32')]=_[_0xb8e6('0x33')](_0x3c6810['query']);_0x9aeb8e['filters']=_[_0xb8e6('0x34')](_0x9aeb8e['model'],_0x9aeb8e[_0xb8e6('0x32')]);_0x5f8c02[_0xb8e6('0x35')]=_['intersection'](_0x9aeb8e['model'],qs['fields'](_0x3c6810[_0xb8e6('0x32')][_0xb8e6('0x36')]));_0x5f8c02[_0xb8e6('0x35')]=_0x5f8c02[_0xb8e6('0x35')][_0xb8e6('0x37')]?_0x5f8c02[_0xb8e6('0x35')]:_0x9aeb8e[_0xb8e6('0x31')];if(!_0x3c6810[_0xb8e6('0x32')][_0xb8e6('0x38')](_0xb8e6('0x39'))){_0x5f8c02['limit']=qs[_0xb8e6('0x1d')](_0x3c6810[_0xb8e6('0x32')][_0xb8e6('0x1d')]);_0x5f8c02['offset']=qs[_0xb8e6('0x1b')](_0x3c6810[_0xb8e6('0x32')][_0xb8e6('0x1b')]);}_0x5f8c02[_0xb8e6('0x3a')]=qs[_0xb8e6('0x3b')](_0x3c6810[_0xb8e6('0x32')][_0xb8e6('0x3b')]);_0x5f8c02[_0xb8e6('0x3c')]=qs[_0xb8e6('0x3d')](_[_0xb8e6('0x3e')](_0x3c6810[_0xb8e6('0x32')],_0x9aeb8e[_0xb8e6('0x3d')]),_0x52276d);if(_0x3c6810[_0xb8e6('0x32')]['filter']){_0x5f8c02[_0xb8e6('0x3c')]=_['merge'](_0x5f8c02[_0xb8e6('0x3c')],{'$or':_[_0xb8e6('0x2b')](_0x52276d,function(_0x16424b){if(_0x16424b[_0xb8e6('0x2f')]!==_0xb8e6('0x3f')){var _0x2a1915={};_0x2a1915[_0x16424b['name']]={'$like':'%'+_0x3c6810[_0xb8e6('0x32')][_0xb8e6('0x40')]+'%'};return _0x2a1915;}})});}_0x5f8c02=_[_0xb8e6('0x41')]({},_0x5f8c02,_0x3c6810[_0xb8e6('0x42')]);var _0xb930dd={'where':_0x5f8c02[_0xb8e6('0x3c')]};return db[_0xb8e6('0x2c')][_0xb8e6('0x1e')](_0xb930dd)[_0xb8e6('0x25')](function(_0x4dd696){_0x1dc971[_0xb8e6('0x1e')]=_0x4dd696;if(_0x3c6810[_0xb8e6('0x32')][_0xb8e6('0x43')]){_0x5f8c02[_0xb8e6('0x44')]=[{'all':!![]}];}return db[_0xb8e6('0x2c')][_0xb8e6('0x45')](_0x5f8c02);})['then'](function(_0x5e42b6){_0x1dc971[_0xb8e6('0x46')]=_0x5e42b6;return _0x1dc971;})['then'](respondWithFilteredResult(_0x23e20a,_0x5f8c02))[_0xb8e6('0x47')](handleError(_0x23e20a,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 0b9673d..252d084 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 _0xbed6=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','define','migrations','lodash'];(function(_0x494cff,_0x291bc8){var _0x10b905=function(_0x19a790){while(--_0x19a790){_0x494cff['push'](_0x494cff['shift']());}};_0x10b905(++_0x291bc8);}(_0xbed6,0x1ac));var _0x6bed=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xbed6[_0x13ce0c];return _0x4388fb;};'use strict';var _=require(_0x6bed('0x0'));var util=require(_0x6bed('0x1'));var logger=require(_0x6bed('0x2'))(_0x6bed('0x3'));var moment=require(_0x6bed('0x4'));var BPromise=require(_0x6bed('0x5'));var rp=require(_0x6bed('0x6'));var fs=require('fs');var path=require(_0x6bed('0x7'));var rimraf=require(_0x6bed('0x8'));var config=require(_0x6bed('0x9'));var attributes=require(_0x6bed('0xa'));module['exports']=function(_0x5c912e,_0x1b0474){return _0x5c912e[_0x6bed('0xb')]('Migration',attributes,{'tableName':_0x6bed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b04=['migrations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','Migration'];(function(_0x83aeb2,_0x271f37){var _0x2063a8=function(_0x4a48f6){while(--_0x4a48f6){_0x83aeb2['push'](_0x83aeb2['shift']());}};_0x2063a8(++_0x271f37);}(_0x9b04,0x85));var _0x49b0=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0x9b04[_0xbeb808];return _0x5d6909;};'use strict';var _=require(_0x49b0('0x0'));var util=require('util');var logger=require(_0x49b0('0x1'))(_0x49b0('0x2'));var moment=require(_0x49b0('0x3'));var BPromise=require(_0x49b0('0x4'));var rp=require(_0x49b0('0x5'));var fs=require('fs');var path=require(_0x49b0('0x6'));var rimraf=require(_0x49b0('0x7'));var config=require(_0x49b0('0x8'));var attributes=require(_0x49b0('0x9'));module['exports']=function(_0x35724f,_0xe10d67){return _0x35724f['define'](_0x49b0('0xa'),attributes,{'tableName':_0x49b0('0xb'),'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 5c257b1..f09d18c 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 _0xdb76=['Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info'];(function(_0x2e6783,_0x956a43){var _0x24e993=function(_0x21868f){while(--_0x21868f){_0x2e6783['push'](_0x2e6783['shift']());}};_0x24e993(++_0x956a43);}(_0xdb76,0x1be));var _0x6db7=function(_0x5b85ea,_0x129fac){_0x5b85ea=_0x5b85ea-0x0;var _0x18b962=_0xdb76[_0x5b85ea];return _0x18b962;};'use strict';var _=require(_0x6db7('0x0'));var util=require(_0x6db7('0x1'));var moment=require(_0x6db7('0x2'));var BPromise=require(_0x6db7('0x3'));var rs=require(_0x6db7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6db7('0x5'))['db'];var utils=require(_0x6db7('0x6'));var logger=require(_0x6db7('0x7'))(_0x6db7('0x8'));var config=require('../../config/environment');var jayson=require(_0x6db7('0x9'));var client=jayson[_0x6db7('0xa')][_0x6db7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x417e71,_0x3b7b8a,_0x58f6e4){return new BPromise(function(_0x1c7f92,_0x3df405){return client['request'](_0x417e71,_0x58f6e4)[_0x6db7('0xc')](function(_0x40735e){logger[_0x6db7('0xd')](_0x6db7('0xe'),_0x3b7b8a,_0x6db7('0xf'));logger[_0x6db7('0x10')]('Migration,\x20%s,\x20%s,\x20%s',_0x3b7b8a,'request\x20sent',JSON[_0x6db7('0x11')](_0x40735e));if(_0x40735e[_0x6db7('0x12')]){if(_0x40735e['error'][_0x6db7('0x13')]===0x1f4){logger[_0x6db7('0x12')](_0x6db7('0xe'),_0x3b7b8a,_0x40735e[_0x6db7('0x12')][_0x6db7('0x14')]);return _0x3df405(_0x40735e[_0x6db7('0x12')]['message']);}logger['error'](_0x6db7('0xe'),_0x3b7b8a,_0x40735e[_0x6db7('0x12')][_0x6db7('0x14')]);return _0x1c7f92(_0x40735e[_0x6db7('0x12')][_0x6db7('0x14')]);}else{logger[_0x6db7('0xd')](_0x6db7('0xe'),_0x3b7b8a,_0x6db7('0xf'));_0x1c7f92(_0x40735e[_0x6db7('0x15')][_0x6db7('0x14')]);}})[_0x6db7('0x16')](function(_0x3ba044){logger['error'](_0x6db7('0xe'),_0x3b7b8a,_0x3ba044);_0x3df405(_0x3ba044);});});} \ No newline at end of file +var _0x8efc=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8efc,0xb3));var _0xc8ef=function(_0x554047,_0x46ec41){_0x554047=_0x554047-0x0;var _0x5d11e4=_0x8efc[_0x554047];return _0x5d11e4;};'use strict';var _=require('lodash');var util=require(_0xc8ef('0x0'));var moment=require(_0xc8ef('0x1'));var BPromise=require(_0xc8ef('0x2'));var rs=require(_0xc8ef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc8ef('0x4'))['db'];var utils=require(_0xc8ef('0x5'));var logger=require(_0xc8ef('0x6'))('rpc');var config=require(_0xc8ef('0x7'));var jayson=require(_0xc8ef('0x8'));var client=jayson[_0xc8ef('0x9')][_0xc8ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x576ff9,_0x1fa519,_0x3d06cd){return new BPromise(function(_0x1c8931,_0x489778){return client[_0xc8ef('0xb')](_0x576ff9,_0x3d06cd)[_0xc8ef('0xc')](function(_0x1a9a5f){logger[_0xc8ef('0xd')]('Migration,\x20%s,\x20%s',_0x1fa519,_0xc8ef('0xe'));logger['debug'](_0xc8ef('0xf'),_0x1fa519,_0xc8ef('0xe'),JSON[_0xc8ef('0x10')](_0x1a9a5f));if(_0x1a9a5f[_0xc8ef('0x11')]){if(_0x1a9a5f[_0xc8ef('0x11')][_0xc8ef('0x12')]===0x1f4){logger[_0xc8ef('0x11')](_0xc8ef('0x13'),_0x1fa519,_0x1a9a5f[_0xc8ef('0x11')][_0xc8ef('0x14')]);return _0x489778(_0x1a9a5f[_0xc8ef('0x11')][_0xc8ef('0x14')]);}logger[_0xc8ef('0x11')](_0xc8ef('0x13'),_0x1fa519,_0x1a9a5f[_0xc8ef('0x11')][_0xc8ef('0x14')]);return _0x1c8931(_0x1a9a5f[_0xc8ef('0x11')][_0xc8ef('0x14')]);}else{logger[_0xc8ef('0xd')](_0xc8ef('0x13'),_0x1fa519,_0xc8ef('0xe'));_0x1c8931(_0x1a9a5f[_0xc8ef('0x15')]['message']);}})[_0xc8ef('0x16')](function(_0x332e70){logger[_0xc8ef('0x11')](_0xc8ef('0x13'),_0x1fa519,_0x332e70);_0x489778(_0x332e70);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index d6e010b..ea8d8a6 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 _0x1329=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id','post','isAuthenticated','create','put','destroy'];(function(_0x2129b3,_0x28b48d){var _0x17238a=function(_0x53e43e){while(--_0x53e43e){_0x2129b3['push'](_0x2129b3['shift']());}};_0x17238a(++_0x28b48d);}(_0x1329,0x199));var _0x9132=function(_0x345b60,_0x5d7ec4){_0x345b60=_0x345b60-0x0;var _0x3308c2=_0x1329[_0x345b60];return _0x3308c2;};'use strict';var multer=require(_0x9132('0x0'));var util=require(_0x9132('0x1'));var path=require(_0x9132('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9132('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9132('0x4'));var interaction=require(_0x9132('0x5'));var config=require(_0x9132('0x6'));var controller=require(_0x9132('0x7'));router[_0x9132('0x8')]('/',auth['isAuthenticated'](),controller[_0x9132('0x9')]);router[_0x9132('0x8')](_0x9132('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x9132('0xb')]('/',auth[_0x9132('0xc')](),controller[_0x9132('0xd')]);router[_0x9132('0xe')]('/:id',auth[_0x9132('0xc')](),controller['update']);router['delete'](_0x9132('0xa'),auth[_0x9132('0xc')](),controller[_0x9132('0xf')]);module[_0x9132('0x10')]=router; \ No newline at end of file +var _0x58ea=['show','post','create','put','update','destroy','exports','multer','path','Router','fs-extra','../../components/interaction/service','get','index','/:id','isAuthenticated'];(function(_0x37009b,_0x4d845c){var _0x26a238=function(_0x36f546){while(--_0x36f546){_0x37009b['push'](_0x37009b['shift']());}};_0x26a238(++_0x4d845c);}(_0x58ea,0xe7));var _0xa58e=function(_0x29e9c3,_0x3700a6){_0x29e9c3=_0x29e9c3-0x0;var _0x247e9d=_0x58ea[_0x29e9c3];return _0x247e9d;};'use strict';var multer=require(_0xa58e('0x0'));var util=require('util');var path=require(_0xa58e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa58e('0x2')]();var fs_extra=require(_0xa58e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa58e('0x4'));var config=require('../../config/environment');var controller=require('./network.controller');router[_0xa58e('0x5')]('/',auth['isAuthenticated'](),controller[_0xa58e('0x6')]);router[_0xa58e('0x5')](_0xa58e('0x7'),auth[_0xa58e('0x8')](),controller[_0xa58e('0x9')]);router[_0xa58e('0xa')]('/',auth[_0xa58e('0x8')](),controller[_0xa58e('0xb')]);router[_0xa58e('0xc')](_0xa58e('0x7'),auth[_0xa58e('0x8')](),controller[_0xa58e('0xd')]);router['delete']('/:id',auth[_0xa58e('0x8')](),controller[_0xa58e('0xe')]);module[_0xa58e('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 686b3ca..ba377cd 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 _0x21ef=['turn','STRING','sequelize','exports','localnet','externip'];(function(_0x3a1e23,_0x1f4ede){var _0x1d6846=function(_0x34938f){while(--_0x34938f){_0x3a1e23['push'](_0x3a1e23['shift']());}};_0x1d6846(++_0x1f4ede);}(_0x21ef,0x1ee));var _0xf21e=function(_0x28241f,_0x51716e){_0x28241f=_0x28241f-0x0;var _0x1efe6c=_0x21ef[_0x28241f];return _0x1efe6c;};'use strict';var Sequelize=require(_0xf21e('0x0'));module[_0xf21e('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf21e('0x2'),_0xf21e('0x3'),'stun',_0xf21e('0x4'))},'value':{'type':Sequelize[_0xf21e('0x5')]},'username':{'type':Sequelize[_0xf21e('0x5')]},'password':{'type':Sequelize[_0xf21e('0x5')]}}; \ No newline at end of file +var _0xe0ea=['STRING','sequelize','ENUM','externip','stun','turn'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe0ea,0x1bd));var _0xae0e=function(_0x400788,_0x594e5f){_0x400788=_0x400788-0x0;var _0x21bf3e=_0xe0ea[_0x400788];return _0x21bf3e;};'use strict';var Sequelize=require(_0xae0e('0x0'));module['exports']={'type':{'type':Sequelize[_0xae0e('0x1')]('localnet',_0xae0e('0x2'),_0xae0e('0x3'),_0xae0e('0x4'))},'value':{'type':Sequelize[_0xae0e('0x5')]},'username':{'type':Sequelize[_0xae0e('0x5')]},'password':{'type':Sequelize[_0xae0e('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index b24bee5..b377bce 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 _0x1ec1=['index','map','Network','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','findAll','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','toUpperCase','TURN','readFileSync','server/files/templates/turn_multiple.ejs','Reload','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','update','/etc/asterisk/turn_xcally.conf','format','chan_sip.so','util','path','ejs','../../config/environment','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','message','catch','status','json','undefined','limit','count','offset','Content-Range','then','destroy','sendStatus','stack','name'];(function(_0x4167d8,_0x2db8e3){var _0x21c805=function(_0x396068){while(--_0x396068){_0x4167d8['push'](_0x4167d8['shift']());}};_0x21c805(++_0x2db8e3);}(_0x1ec1,0x17e));var _0x11ec=function(_0x115d7c,_0x5aba2a){_0x115d7c=_0x115d7c-0x0;var _0x4ace70=_0x1ec1[_0x115d7c];return _0x4ace70;};'use strict';var util=require(_0x11ec('0x0'));var path=require(_0x11ec('0x1'));var ejs=require(_0x11ec('0x2'));var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0x11ec('0x3'));var db=require('../../mysqldb')['db'];var jayson=require(_0x11ec('0x4'));var client=jayson[_0x11ec('0x5')][_0x11ec('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4d8ae3,_0x21d998,_0x15ff59,_0x36b61d){return new Promise(function(_0xf632ba,_0x3e1e73){var _0xe7fcc6=_0x36b61d||client;return _0xe7fcc6[_0x11ec('0x7')](_0x4d8ae3,_0x15ff59)['then'](function(_0x563309){logger[_0x11ec('0x8')](_0x11ec('0x9'),_0x21d998,_0x11ec('0xa'));logger[_0x11ec('0xb')](_0x11ec('0xc'),_0x21d998,_0x11ec('0xa'),JSON['stringify'](_0x563309));if(_0x563309[_0x11ec('0xd')]){if(_0x563309[_0x11ec('0xd')]['code']===0x1f4){logger[_0x11ec('0xd')](_0x11ec('0x9'),_0x21d998,_0x563309[_0x11ec('0xd')][_0x11ec('0xe')]);return _0x3e1e73(_0x563309['error']['message']);}logger[_0x11ec('0xd')](_0x11ec('0x9'),_0x21d998,_0x563309[_0x11ec('0xd')][_0x11ec('0xe')]);return _0xf632ba(_0x563309[_0x11ec('0xd')][_0x11ec('0xe')]);}else{logger[_0x11ec('0x8')]('Network,\x20%s,\x20%s',_0x21d998,_0x11ec('0xa'));_0xf632ba(_0x563309['result'][_0x11ec('0xe')]);}})[_0x11ec('0xf')](function(_0x18bbca){logger['error'](_0x11ec('0x9'),_0x21d998,_0x18bbca);_0x3e1e73(_0x18bbca);});});}function respondWithResult(_0x91e4fe,_0x444557){_0x444557=_0x444557||0xc8;return function(_0x56b930){if(_0x56b930){return _0x91e4fe[_0x11ec('0x10')](_0x444557)[_0x11ec('0x11')](_0x56b930);}};}function respondWithFilteredResult(_0xe207ea,_0x2e054e){return function(_0x16c076){if(_0x16c076){var _0x2a6b23=typeof _0x2e054e['offset']===_0x11ec('0x12')&&typeof _0x2e054e[_0x11ec('0x13')]===_0x11ec('0x12');var _0x34c966=_0x16c076[_0x11ec('0x14')];var _0x1d94c7=_0x2a6b23?0x0:_0x2e054e[_0x11ec('0x15')];var _0x1d9202=_0x2a6b23?_0x16c076['count']:_0x2e054e[_0x11ec('0x15')]+_0x2e054e[_0x11ec('0x13')];var _0x5869a1;if(_0x1d9202>=_0x34c966){_0x1d9202=_0x34c966;_0x5869a1=0xc8;}else{_0x5869a1=0xce;}_0xe207ea[_0x11ec('0x10')](_0x5869a1);return _0xe207ea['set'](_0x11ec('0x16'),_0x1d94c7+'-'+_0x1d9202+'/'+_0x34c966)['json'](_0x16c076);}return null;};}function saveUpdates(_0x1e822f){return function(_0x52bfaa){if(_0x52bfaa){return _0x52bfaa['update'](_0x1e822f)[_0x11ec('0x17')](function(_0x2923b0){return _0x2923b0;});}return null;};}function removeEntity(_0x22a67e){return function(_0x423795){if(_0x423795){return _0x423795[_0x11ec('0x18')]()[_0x11ec('0x17')](function(){_0x22a67e[_0x11ec('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19b50e){return function(_0x6b0d0f){if(!_0x6b0d0f){_0x19b50e[_0x11ec('0x19')](0x194);}return _0x6b0d0f;};}function handleError(_0x199891,_0x5787c4){_0x5787c4=_0x5787c4||0x1f4;return function(_0x43e054){logger[_0x11ec('0xd')](_0x43e054[_0x11ec('0x1a')]);if(_0x43e054[_0x11ec('0x1b')]){delete _0x43e054['name'];}_0x199891[_0x11ec('0x10')](_0x5787c4)['send'](_0x43e054);};}exports[_0x11ec('0x1c')]=function(_0x4a7753,_0x382262){var _0x5da910={},_0x24c1ea={},_0x670906={'count':0x0,'rows':[]};var _0x52d55f=_[_0x11ec('0x1d')](db[_0x11ec('0x1e')][_0x11ec('0x1f')],function(_0x5a53dc){return{'name':_0x5a53dc[_0x11ec('0x20')],'type':_0x5a53dc[_0x11ec('0x21')][_0x11ec('0x22')]};});_0x24c1ea[_0x11ec('0x23')]=_[_0x11ec('0x1d')](_0x52d55f,_0x11ec('0x1b'));_0x24c1ea[_0x11ec('0x24')]=_[_0x11ec('0x25')](_0x4a7753[_0x11ec('0x24')]);_0x24c1ea[_0x11ec('0x26')]=_[_0x11ec('0x27')](_0x24c1ea[_0x11ec('0x23')],_0x24c1ea[_0x11ec('0x24')]);_0x5da910[_0x11ec('0x28')]=_['intersection'](_0x24c1ea[_0x11ec('0x23')],qs[_0x11ec('0x29')](_0x4a7753[_0x11ec('0x24')]['fields']));_0x5da910[_0x11ec('0x28')]=_0x5da910['attributes'][_0x11ec('0x2a')]?_0x5da910[_0x11ec('0x28')]:_0x24c1ea['model'];if(!_0x4a7753[_0x11ec('0x24')][_0x11ec('0x2b')](_0x11ec('0x2c'))){_0x5da910[_0x11ec('0x13')]=qs[_0x11ec('0x13')](_0x4a7753[_0x11ec('0x24')]['limit']);_0x5da910[_0x11ec('0x15')]=qs[_0x11ec('0x15')](_0x4a7753[_0x11ec('0x24')][_0x11ec('0x15')]);}_0x5da910[_0x11ec('0x2d')]=qs['sort'](_0x4a7753['query']['sort']);_0x5da910[_0x11ec('0x2e')]=qs[_0x11ec('0x26')](_[_0x11ec('0x2f')](_0x4a7753[_0x11ec('0x24')],_0x24c1ea[_0x11ec('0x26')]),_0x52d55f);if(_0x4a7753[_0x11ec('0x24')][_0x11ec('0x30')]){_0x5da910[_0x11ec('0x2e')]=_[_0x11ec('0x31')](_0x5da910[_0x11ec('0x2e')],{'$or':_[_0x11ec('0x1d')](_0x52d55f,function(_0x419efe){if(_0x419efe[_0x11ec('0x21')]!==_0x11ec('0x32')){var _0xe58568={};_0xe58568[_0x419efe['name']]={'$like':'%'+_0x4a7753[_0x11ec('0x24')][_0x11ec('0x30')]+'%'};return _0xe58568;}})});}_0x5da910=_[_0x11ec('0x31')]({},_0x5da910,_0x4a7753[_0x11ec('0x33')]);var _0x41ad3a={'where':_0x5da910[_0x11ec('0x2e')]};return db[_0x11ec('0x1e')][_0x11ec('0x14')](_0x41ad3a)['then'](function(_0x3cc569){_0x670906['count']=_0x3cc569;if(_0x4a7753[_0x11ec('0x24')][_0x11ec('0x34')]){_0x5da910[_0x11ec('0x35')]=[{'all':!![]}];}return db[_0x11ec('0x1e')]['findAll'](_0x5da910);})[_0x11ec('0x17')](function(_0x53dbed){_0x670906[_0x11ec('0x36')]=_0x53dbed;return _0x670906;})[_0x11ec('0x17')](respondWithFilteredResult(_0x382262,_0x5da910))[_0x11ec('0xf')](handleError(_0x382262,null));};exports[_0x11ec('0x37')]=function(_0x7d00d1,_0x3449e9){var _0x555218={'raw':!![],'where':{'id':_0x7d00d1[_0x11ec('0x38')]['id']}},_0x4fbc52={};_0x4fbc52[_0x11ec('0x23')]=_['keys'](db['Network']['rawAttributes']);_0x4fbc52[_0x11ec('0x24')]=_['keys'](_0x7d00d1[_0x11ec('0x24')]);_0x4fbc52[_0x11ec('0x26')]=_['intersection'](_0x4fbc52[_0x11ec('0x23')],_0x4fbc52[_0x11ec('0x24')]);_0x555218['attributes']=_[_0x11ec('0x27')](_0x4fbc52[_0x11ec('0x23')],qs[_0x11ec('0x29')](_0x7d00d1['query']['fields']));_0x555218[_0x11ec('0x28')]=_0x555218[_0x11ec('0x28')][_0x11ec('0x2a')]?_0x555218['attributes']:_0x4fbc52[_0x11ec('0x23')];if(_0x7d00d1[_0x11ec('0x24')]['includeAll']){_0x555218[_0x11ec('0x35')]=[{'all':!![]}];}_0x555218=_[_0x11ec('0x31')]({},_0x555218,_0x7d00d1[_0x11ec('0x33')]);return db[_0x11ec('0x1e')][_0x11ec('0x39')](_0x555218)[_0x11ec('0x17')](handleEntityNotFound(_0x3449e9,null))[_0x11ec('0x17')](respondWithResult(_0x3449e9,null))[_0x11ec('0xf')](handleError(_0x3449e9,null));};exports[_0x11ec('0x3a')]=function(_0x49d0e5,_0x3c92f2){var _0x4f0aad;return db['Network'][_0x11ec('0x3a')](_0x49d0e5[_0x11ec('0x3b')],{'raw':!![]})[_0x11ec('0x17')](function(_0x33405f){_0x4f0aad=_0x33405f;return db[_0x11ec('0x1e')][_0x11ec('0x3c')]({'where':{'type':_0x49d0e5['body'][_0x11ec('0x21')]},'raw':!![]});})['then'](function(_0x3c514f){if(_0x4f0aad[_0x11ec('0x21')]['toUpperCase']()==_0x11ec('0x3d')){var _0x4d534a=fs['readFileSync'](path[_0x11ec('0x3e')](config[_0x11ec('0x3f')],_0x11ec('0x40')),_0x11ec('0x41'));var _0xcd1a82=ejs[_0x11ec('0x42')](_0x4d534a,{'networks':_0x3c514f||[]});fs[_0x11ec('0x43')](_0x11ec('0x44'),_0xcd1a82);return respondWithRpcPromise('Reload',_0x11ec('0x3a'),{'module':_0x11ec('0x45')});}else if(_0x4f0aad[_0x11ec('0x21')][_0x11ec('0x46')]()==_0x11ec('0x47')){var _0x5b6f10=fs[_0x11ec('0x48')](path[_0x11ec('0x3e')](config[_0x11ec('0x3f')],_0x11ec('0x49')),_0x11ec('0x41'));var _0x4f1822=ejs[_0x11ec('0x42')](_0x5b6f10,{'networks':_0x3c514f||[]});fs[_0x11ec('0x43')]('/etc/asterisk/turn_xcally.conf',_0x4f1822);return respondWithRpcPromise(_0x11ec('0x4a'),'create',{'module':_0x11ec('0x45')});}else{var _0x52dad0=fs[_0x11ec('0x48')](path['join'](config[_0x11ec('0x3f')],_0x11ec('0x4b')),'utf8');var _0x1c5a9d=ejs['render'](_0x52dad0,{'networks':_0x3c514f||[]});fs['writeFileSync'](util['format'](_0x11ec('0x4c'),_0x49d0e5[_0x11ec('0x3b')][_0x11ec('0x21')][_0x11ec('0x4d')]()),_0x1c5a9d);return respondWithRpcPromise(_0x11ec('0x4a'),_0x11ec('0x3a'),{'module':'chan_sip.so'});}})[_0x11ec('0x17')](function(){return _0x4f0aad;})['then'](respondWithResult(_0x3c92f2,0xc9))[_0x11ec('0xf')](handleError(_0x3c92f2,null));};exports[_0x11ec('0x4e')]=function(_0x42b70d,_0x5a9744){var _0x2c5122;return db[_0x11ec('0x1e')][_0x11ec('0x39')]({'where':{'id':_0x42b70d[_0x11ec('0x38')]['id']}})[_0x11ec('0x17')](handleEntityNotFound(_0x5a9744,null))[_0x11ec('0x17')](saveUpdates(_0x42b70d[_0x11ec('0x3b')],null))[_0x11ec('0x17')](function(_0x1f33a4){if(_0x1f33a4){_0x2c5122=_0x1f33a4;return db[_0x11ec('0x1e')][_0x11ec('0x3c')]({'where':{'type':_0x2c5122[_0x11ec('0x21')]},'raw':!![]});}return null;})[_0x11ec('0x17')](function(_0x4bc1fb){if(_0x2c5122[_0x11ec('0x21')]['toUpperCase']()=='STUN'){var _0x21d052=fs[_0x11ec('0x48')](path[_0x11ec('0x3e')](config['root'],_0x11ec('0x40')),'utf8');var _0x3dd01f=ejs['render'](_0x21d052,{'networks':_0x4bc1fb||[]});fs[_0x11ec('0x43')](_0x11ec('0x44'),_0x3dd01f);return respondWithRpcPromise(_0x11ec('0x4a'),_0x11ec('0x4e'),{'module':_0x11ec('0x45')});}else if(_0x2c5122[_0x11ec('0x21')][_0x11ec('0x46')]()==_0x11ec('0x47')){var _0x14ed4e=fs[_0x11ec('0x48')](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),_0x11ec('0x41'));var _0x510270=ejs[_0x11ec('0x42')](_0x14ed4e,{'networks':_0x4bc1fb||[]});fs[_0x11ec('0x43')](_0x11ec('0x4f'),_0x510270);return respondWithRpcPromise('Reload',_0x11ec('0x4e'),{'module':'res_stun_monitor.so'});}else{var _0x96e204=fs[_0x11ec('0x48')](path[_0x11ec('0x3e')](config[_0x11ec('0x3f')],'server/files/templates/network.ejs'),_0x11ec('0x41'));var _0x20ff3a=ejs[_0x11ec('0x42')](_0x96e204,{'networks':_0x4bc1fb||[]});fs[_0x11ec('0x43')](util[_0x11ec('0x50')](_0x11ec('0x4c'),_0x42b70d[_0x11ec('0x3b')][_0x11ec('0x21')][_0x11ec('0x4d')]()),_0x20ff3a);return respondWithRpcPromise(_0x11ec('0x4a'),'update',{'module':_0x11ec('0x51')});}})['then'](function(_0x548a21){if(_0x548a21){return _0x2c5122;}return null;})[_0x11ec('0x17')](respondWithResult(_0x5a9744,null))[_0x11ec('0xf')](handleError(_0x5a9744,null));};exports[_0x11ec('0x18')]=function(_0x4229c6,_0x4d3561){var _0xba6b3b;return db[_0x11ec('0x1e')][_0x11ec('0x39')]({'where':{'id':_0x4229c6[_0x11ec('0x38')]['id']}})[_0x11ec('0x17')](function(_0x37702a){_0xba6b3b=_0x37702a;return _0x37702a;})['then'](handleEntityNotFound(_0x4d3561,null))[_0x11ec('0x17')](removeEntity(_0x4d3561,null))[_0x11ec('0x17')](function(){if(_0xba6b3b){return db[_0x11ec('0x1e')]['findAll']({'where':{'type':_0xba6b3b[_0x11ec('0x21')]},'raw':!![]});}})[_0x11ec('0x17')](function(_0x3e36a1){if(_0xba6b3b[_0x11ec('0x21')][_0x11ec('0x46')]()==_0x11ec('0x3d')){var _0x3daf35=fs[_0x11ec('0x48')](path[_0x11ec('0x3e')](config[_0x11ec('0x3f')],_0x11ec('0x40')),'utf8');var _0x5bcd06=ejs['render'](_0x3daf35,{'networks':_0x3e36a1||[]});fs[_0x11ec('0x43')](_0x11ec('0x44'),_0x5bcd06);return respondWithRpcPromise('Reload',_0x11ec('0x18'),{'module':_0x11ec('0x45')});}else if(_0xba6b3b[_0x11ec('0x21')][_0x11ec('0x46')]()=='TURN'){var _0x2f39af=fs['readFileSync'](path[_0x11ec('0x3e')](config[_0x11ec('0x3f')],'server/files/templates/turn_multiple.ejs'),_0x11ec('0x41'));var _0x38ed66=ejs[_0x11ec('0x42')](_0x2f39af,{'networks':_0x3e36a1||[]});fs['writeFileSync'](_0x11ec('0x4f'),_0x38ed66);return respondWithRpcPromise(_0x11ec('0x4a'),_0x11ec('0x18'),{'module':_0x11ec('0x45')});}else{var _0x4d0775=fs['readFileSync'](path['join'](config[_0x11ec('0x3f')],_0x11ec('0x4b')),_0x11ec('0x41'));var _0x3b6cf7=ejs[_0x11ec('0x42')](_0x4d0775,{'networks':_0x3e36a1||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0xba6b3b['type'][_0x11ec('0x4d')]()),_0x3b6cf7);return respondWithRpcPromise(_0x11ec('0x4a'),_0x11ec('0x18'),{'module':_0x11ec('0x51')});}})[_0x11ec('0xf')](handleError(_0x4d3561,null));}; \ No newline at end of file +var _0x12f9=['readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','server/files/templates/network.ejs','format','path','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','undefined','limit','offset','set','Content-Range','update','destroy','end','sendStatus','stack','map','Network','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','params','length','options','find','create','body','toUpperCase','STUN'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x12f9,0x1bb));var _0x912f=function(_0x4febb9,_0x5109bb){_0x4febb9=_0x4febb9-0x0;var _0x4c4ccc=_0x12f9[_0x4febb9];return _0x4c4ccc;};'use strict';var util=require('util');var path=require(_0x912f('0x0'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var qs=require(_0x912f('0x1'));var logger=require(_0x912f('0x2'))(_0x912f('0x3'));var config=require(_0x912f('0x4'));var db=require(_0x912f('0x5'))['db'];var jayson=require(_0x912f('0x6'));var client=jayson[_0x912f('0x7')][_0x912f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa9d276,_0x354bb9,_0x4c9ff0,_0x24bbd2){return new Promise(function(_0x32b309,_0x4741e6){var _0x17dcb1=_0x24bbd2||client;return _0x17dcb1[_0x912f('0x9')](_0xa9d276,_0x4c9ff0)[_0x912f('0xa')](function(_0x99eace){logger[_0x912f('0xb')](_0x912f('0xc'),_0x354bb9,_0x912f('0xd'));logger[_0x912f('0xe')](_0x912f('0xf'),_0x354bb9,_0x912f('0xd'),JSON[_0x912f('0x10')](_0x99eace));if(_0x99eace[_0x912f('0x11')]){if(_0x99eace['error']['code']===0x1f4){logger[_0x912f('0x11')](_0x912f('0xc'),_0x354bb9,_0x99eace['error'][_0x912f('0x12')]);return _0x4741e6(_0x99eace[_0x912f('0x11')][_0x912f('0x12')]);}logger[_0x912f('0x11')](_0x912f('0xc'),_0x354bb9,_0x99eace[_0x912f('0x11')][_0x912f('0x12')]);return _0x32b309(_0x99eace[_0x912f('0x11')][_0x912f('0x12')]);}else{logger[_0x912f('0xb')](_0x912f('0xc'),_0x354bb9,_0x912f('0xd'));_0x32b309(_0x99eace[_0x912f('0x13')]['message']);}})[_0x912f('0x14')](function(_0x5b39e1){logger[_0x912f('0x11')](_0x912f('0xc'),_0x354bb9,_0x5b39e1);_0x4741e6(_0x5b39e1);});});}function respondWithResult(_0x4e873c,_0x1b8e40){_0x1b8e40=_0x1b8e40||0xc8;return function(_0x3c6c65){if(_0x3c6c65){return _0x4e873c[_0x912f('0x15')](_0x1b8e40)[_0x912f('0x16')](_0x3c6c65);}};}function respondWithFilteredResult(_0xf9409d,_0x12a6c6){return function(_0x5a6790){if(_0x5a6790){var _0xffb2fe=typeof _0x12a6c6['offset']===_0x912f('0x17')&&typeof _0x12a6c6[_0x912f('0x18')]===_0x912f('0x17');var _0x2b098f=_0x5a6790['count'];var _0x1a946f=_0xffb2fe?0x0:_0x12a6c6[_0x912f('0x19')];var _0x4534b1=_0xffb2fe?_0x5a6790['count']:_0x12a6c6[_0x912f('0x19')]+_0x12a6c6['limit'];var _0x27996d;if(_0x4534b1>=_0x2b098f){_0x4534b1=_0x2b098f;_0x27996d=0xc8;}else{_0x27996d=0xce;}_0xf9409d[_0x912f('0x15')](_0x27996d);return _0xf9409d[_0x912f('0x1a')](_0x912f('0x1b'),_0x1a946f+'-'+_0x4534b1+'/'+_0x2b098f)['json'](_0x5a6790);}return null;};}function saveUpdates(_0x1a82b5){return function(_0x4b2880){if(_0x4b2880){return _0x4b2880[_0x912f('0x1c')](_0x1a82b5)[_0x912f('0xa')](function(_0x39ca17){return _0x39ca17;});}return null;};}function removeEntity(_0x19707e){return function(_0x1de2ab){if(_0x1de2ab){return _0x1de2ab[_0x912f('0x1d')]()['then'](function(){_0x19707e[_0x912f('0x15')](0xcc)[_0x912f('0x1e')]();});}};}function handleEntityNotFound(_0x1ca2ab){return function(_0x170655){if(!_0x170655){_0x1ca2ab[_0x912f('0x1f')](0x194);}return _0x170655;};}function handleError(_0x2bc7e7,_0x1f42a6){_0x1f42a6=_0x1f42a6||0x1f4;return function(_0x28295a){logger[_0x912f('0x11')](_0x28295a[_0x912f('0x20')]);if(_0x28295a['name']){delete _0x28295a['name'];}_0x2bc7e7[_0x912f('0x15')](_0x1f42a6)['send'](_0x28295a);};}exports['index']=function(_0x711d5b,_0x13e1ba){var _0x315164={},_0x312ba1={},_0x22f5da={'count':0x0,'rows':[]};var _0x5a3b63=_[_0x912f('0x21')](db[_0x912f('0x22')][_0x912f('0x23')],function(_0x4c1952){return{'name':_0x4c1952['fieldName'],'type':_0x4c1952[_0x912f('0x24')][_0x912f('0x25')]};});_0x312ba1[_0x912f('0x26')]=_[_0x912f('0x21')](_0x5a3b63,_0x912f('0x27'));_0x312ba1[_0x912f('0x28')]=_[_0x912f('0x29')](_0x711d5b[_0x912f('0x28')]);_0x312ba1[_0x912f('0x2a')]=_[_0x912f('0x2b')](_0x312ba1[_0x912f('0x26')],_0x312ba1[_0x912f('0x28')]);_0x315164[_0x912f('0x2c')]=_['intersection'](_0x312ba1[_0x912f('0x26')],qs[_0x912f('0x2d')](_0x711d5b[_0x912f('0x28')][_0x912f('0x2d')]));_0x315164[_0x912f('0x2c')]=_0x315164[_0x912f('0x2c')]['length']?_0x315164['attributes']:_0x312ba1['model'];if(!_0x711d5b[_0x912f('0x28')][_0x912f('0x2e')](_0x912f('0x2f'))){_0x315164[_0x912f('0x18')]=qs[_0x912f('0x18')](_0x711d5b[_0x912f('0x28')][_0x912f('0x18')]);_0x315164[_0x912f('0x19')]=qs[_0x912f('0x19')](_0x711d5b[_0x912f('0x28')][_0x912f('0x19')]);}_0x315164[_0x912f('0x30')]=qs[_0x912f('0x31')](_0x711d5b[_0x912f('0x28')]['sort']);_0x315164[_0x912f('0x32')]=qs['filters'](_[_0x912f('0x33')](_0x711d5b['query'],_0x312ba1['filters']),_0x5a3b63);if(_0x711d5b['query']['filter']){_0x315164[_0x912f('0x32')]=_[_0x912f('0x34')](_0x315164[_0x912f('0x32')],{'$or':_[_0x912f('0x21')](_0x5a3b63,function(_0x3e57d9){if(_0x3e57d9['type']!==_0x912f('0x35')){var _0x4da613={};_0x4da613[_0x3e57d9['name']]={'$like':'%'+_0x711d5b[_0x912f('0x28')][_0x912f('0x36')]+'%'};return _0x4da613;}})});}_0x315164=_['merge']({},_0x315164,_0x711d5b['options']);var _0x1e216a={'where':_0x315164[_0x912f('0x32')]};return db[_0x912f('0x22')][_0x912f('0x37')](_0x1e216a)[_0x912f('0xa')](function(_0xcf1d16){_0x22f5da[_0x912f('0x37')]=_0xcf1d16;if(_0x711d5b[_0x912f('0x28')][_0x912f('0x38')]){_0x315164[_0x912f('0x39')]=[{'all':!![]}];}return db[_0x912f('0x22')][_0x912f('0x3a')](_0x315164);})[_0x912f('0xa')](function(_0x12e4e2){_0x22f5da['rows']=_0x12e4e2;return _0x22f5da;})['then'](respondWithFilteredResult(_0x13e1ba,_0x315164))[_0x912f('0x14')](handleError(_0x13e1ba,null));};exports['show']=function(_0x884cd7,_0x524264){var _0x175db6={'raw':!![],'where':{'id':_0x884cd7[_0x912f('0x3b')]['id']}},_0x503b30={};_0x503b30[_0x912f('0x26')]=_[_0x912f('0x29')](db[_0x912f('0x22')][_0x912f('0x23')]);_0x503b30[_0x912f('0x28')]=_[_0x912f('0x29')](_0x884cd7['query']);_0x503b30[_0x912f('0x2a')]=_['intersection'](_0x503b30['model'],_0x503b30[_0x912f('0x28')]);_0x175db6['attributes']=_[_0x912f('0x2b')](_0x503b30[_0x912f('0x26')],qs[_0x912f('0x2d')](_0x884cd7[_0x912f('0x28')]['fields']));_0x175db6[_0x912f('0x2c')]=_0x175db6['attributes'][_0x912f('0x3c')]?_0x175db6[_0x912f('0x2c')]:_0x503b30['model'];if(_0x884cd7[_0x912f('0x28')][_0x912f('0x38')]){_0x175db6[_0x912f('0x39')]=[{'all':!![]}];}_0x175db6=_[_0x912f('0x34')]({},_0x175db6,_0x884cd7[_0x912f('0x3d')]);return db['Network'][_0x912f('0x3e')](_0x175db6)[_0x912f('0xa')](handleEntityNotFound(_0x524264,null))[_0x912f('0xa')](respondWithResult(_0x524264,null))['catch'](handleError(_0x524264,null));};exports[_0x912f('0x3f')]=function(_0x96cf07,_0x1f8cb0){var _0x597b12;return db['Network'][_0x912f('0x3f')](_0x96cf07[_0x912f('0x40')],{'raw':!![]})[_0x912f('0xa')](function(_0x9a0a51){_0x597b12=_0x9a0a51;return db[_0x912f('0x22')][_0x912f('0x3a')]({'where':{'type':_0x96cf07[_0x912f('0x40')][_0x912f('0x24')]},'raw':!![]});})['then'](function(_0x115fbb){if(_0x597b12[_0x912f('0x24')][_0x912f('0x41')]()==_0x912f('0x42')){var _0x100ea4=fs[_0x912f('0x43')](path[_0x912f('0x44')](config[_0x912f('0x45')],_0x912f('0x46')),_0x912f('0x47'));var _0x33b39d=ejs['render'](_0x100ea4,{'networks':_0x115fbb||[]});fs[_0x912f('0x48')](_0x912f('0x49'),_0x33b39d);return respondWithRpcPromise(_0x912f('0x4a'),_0x912f('0x3f'),{'module':_0x912f('0x4b')});}else if(_0x597b12['type'][_0x912f('0x41')]()==_0x912f('0x4c')){var _0x5b6204=fs[_0x912f('0x43')](path[_0x912f('0x44')](config[_0x912f('0x45')],_0x912f('0x4d')),'utf8');var _0x621adf=ejs[_0x912f('0x4e')](_0x5b6204,{'networks':_0x115fbb||[]});fs[_0x912f('0x48')](_0x912f('0x4f'),_0x621adf);return respondWithRpcPromise(_0x912f('0x4a'),'create',{'module':_0x912f('0x4b')});}else{var _0x5d3593=fs[_0x912f('0x43')](path[_0x912f('0x44')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x55d162=ejs['render'](_0x5d3593,{'networks':_0x115fbb||[]});fs[_0x912f('0x48')](util['format'](_0x912f('0x50'),_0x96cf07['body'][_0x912f('0x24')][_0x912f('0x51')]()),_0x55d162);return respondWithRpcPromise(_0x912f('0x4a'),_0x912f('0x3f'),{'module':_0x912f('0x52')});}})[_0x912f('0xa')](function(){return _0x597b12;})[_0x912f('0xa')](respondWithResult(_0x1f8cb0,0xc9))[_0x912f('0x14')](handleError(_0x1f8cb0,null));};exports[_0x912f('0x1c')]=function(_0x3402f6,_0x2b9d62){var _0x108d4a;return db[_0x912f('0x22')][_0x912f('0x3e')]({'where':{'id':_0x3402f6[_0x912f('0x3b')]['id']}})[_0x912f('0xa')](handleEntityNotFound(_0x2b9d62,null))[_0x912f('0xa')](saveUpdates(_0x3402f6[_0x912f('0x40')],null))[_0x912f('0xa')](function(_0x2753a2){if(_0x2753a2){_0x108d4a=_0x2753a2;return db[_0x912f('0x22')][_0x912f('0x3a')]({'where':{'type':_0x108d4a[_0x912f('0x24')]},'raw':!![]});}return null;})[_0x912f('0xa')](function(_0x1f745a){if(_0x108d4a[_0x912f('0x24')]['toUpperCase']()==_0x912f('0x42')){var _0x5d9bbe=fs[_0x912f('0x43')](path[_0x912f('0x44')](config[_0x912f('0x45')],_0x912f('0x46')),_0x912f('0x47'));var _0x2dc740=ejs[_0x912f('0x4e')](_0x5d9bbe,{'networks':_0x1f745a||[]});fs[_0x912f('0x48')](_0x912f('0x49'),_0x2dc740);return respondWithRpcPromise(_0x912f('0x4a'),'update',{'module':'res_stun_monitor.so'});}else if(_0x108d4a['type'][_0x912f('0x41')]()==_0x912f('0x4c')){var _0x32a37c=fs['readFileSync'](path[_0x912f('0x44')](config[_0x912f('0x45')],'server/files/templates/turn_multiple.ejs'),_0x912f('0x47'));var _0x5e823b=ejs[_0x912f('0x4e')](_0x32a37c,{'networks':_0x1f745a||[]});fs['writeFileSync'](_0x912f('0x4f'),_0x5e823b);return respondWithRpcPromise(_0x912f('0x4a'),_0x912f('0x1c'),{'module':'res_stun_monitor.so'});}else{var _0x2aaadb=fs[_0x912f('0x43')](path[_0x912f('0x44')](config[_0x912f('0x45')],_0x912f('0x53')),'utf8');var _0x45f0a9=ejs[_0x912f('0x4e')](_0x2aaadb,{'networks':_0x1f745a||[]});fs[_0x912f('0x48')](util[_0x912f('0x54')](_0x912f('0x50'),_0x3402f6[_0x912f('0x40')][_0x912f('0x24')][_0x912f('0x51')]()),_0x45f0a9);return respondWithRpcPromise(_0x912f('0x4a'),_0x912f('0x1c'),{'module':_0x912f('0x52')});}})[_0x912f('0xa')](function(_0x283c44){if(_0x283c44){return _0x108d4a;}return null;})['then'](respondWithResult(_0x2b9d62,null))['catch'](handleError(_0x2b9d62,null));};exports['destroy']=function(_0x202fa0,_0x9190c4){var _0x3b89ad;return db[_0x912f('0x22')][_0x912f('0x3e')]({'where':{'id':_0x202fa0[_0x912f('0x3b')]['id']}})[_0x912f('0xa')](function(_0x47c80f){_0x3b89ad=_0x47c80f;return _0x47c80f;})['then'](handleEntityNotFound(_0x9190c4,null))[_0x912f('0xa')](removeEntity(_0x9190c4,null))['then'](function(){if(_0x3b89ad){return db[_0x912f('0x22')][_0x912f('0x3a')]({'where':{'type':_0x3b89ad[_0x912f('0x24')]},'raw':!![]});}})[_0x912f('0xa')](function(_0x2df152){if(_0x3b89ad[_0x912f('0x24')][_0x912f('0x41')]()==_0x912f('0x42')){var _0x5d7d36=fs[_0x912f('0x43')](path[_0x912f('0x44')](config[_0x912f('0x45')],_0x912f('0x46')),_0x912f('0x47'));var _0xf5e3d7=ejs[_0x912f('0x4e')](_0x5d7d36,{'networks':_0x2df152||[]});fs[_0x912f('0x48')](_0x912f('0x49'),_0xf5e3d7);return respondWithRpcPromise(_0x912f('0x4a'),'destroy',{'module':_0x912f('0x4b')});}else if(_0x3b89ad[_0x912f('0x24')]['toUpperCase']()==_0x912f('0x4c')){var _0x9e70a6=fs[_0x912f('0x43')](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),_0x912f('0x47'));var _0x116291=ejs[_0x912f('0x4e')](_0x9e70a6,{'networks':_0x2df152||[]});fs[_0x912f('0x48')](_0x912f('0x4f'),_0x116291);return respondWithRpcPromise(_0x912f('0x4a'),_0x912f('0x1d'),{'module':_0x912f('0x4b')});}else{var _0xc4b32=fs[_0x912f('0x43')](path['join'](config[_0x912f('0x45')],'server/files/templates/network.ejs'),_0x912f('0x47'));var _0x3b4843=ejs[_0x912f('0x4e')](_0xc4b32,{'networks':_0x2df152||[]});fs[_0x912f('0x48')](util[_0x912f('0x54')]('/etc/asterisk/sip_xcally_%s.conf',_0x3b89ad['type'][_0x912f('0x51')]()),_0x3b4843);return respondWithRpcPromise(_0x912f('0x4a'),_0x912f('0x1d'),{'module':_0x912f('0x52')});}})[_0x912f('0x14')](handleError(_0x9190c4,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 71d7d31..18359e0 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 _0x44a3=['moment','bluebird','request-promise','path','../../config/environment','./network.attributes','exports','lodash','util','../../config/logger','api'];(function(_0x5017af,_0x300c05){var _0x521a1a=function(_0x5dcb30){while(--_0x5dcb30){_0x5017af['push'](_0x5017af['shift']());}};_0x521a1a(++_0x300c05);}(_0x44a3,0x1a9));var _0x344a=function(_0x51bdda,_0x5666ca){_0x51bdda=_0x51bdda-0x0;var _0x998aab=_0x44a3[_0x51bdda];return _0x998aab;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var logger=require(_0x344a('0x2'))(_0x344a('0x3'));var moment=require(_0x344a('0x4'));var BPromise=require(_0x344a('0x5'));var rp=require(_0x344a('0x6'));var fs=require('fs');var path=require(_0x344a('0x7'));var rimraf=require('rimraf');var config=require(_0x344a('0x8'));var attributes=require(_0x344a('0x9'));module[_0x344a('0xa')]=function(_0x28b51e,_0x39984a){return _0x28b51e['define']('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2547=['rimraf','./network.attributes','exports','Network','network','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2e6ab8,_0x4ea85c){var _0x16cba0=function(_0x4b3776){while(--_0x4b3776){_0x2e6ab8['push'](_0x2e6ab8['shift']());}};_0x16cba0(++_0x4ea85c);}(_0x2547,0x1cd));var _0x7254=function(_0x35741f,_0x47726f){_0x35741f=_0x35741f-0x0;var _0x166e01=_0x2547[_0x35741f];return _0x166e01;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var logger=require(_0x7254('0x1'))(_0x7254('0x2'));var moment=require(_0x7254('0x3'));var BPromise=require(_0x7254('0x4'));var rp=require(_0x7254('0x5'));var fs=require('fs');var path=require(_0x7254('0x6'));var rimraf=require(_0x7254('0x7'));var config=require('../../config/environment');var attributes=require(_0x7254('0x8'));module[_0x7254('0x9')]=function(_0x67f427,_0x119f66){return _0x67f427['define'](_0x7254('0xa'),attributes,{'tableName':_0x7254('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 36c62eb..3be6cb6 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(_0x5866d1,_0xa6dc72){var _0x30071f=function(_0x482390){while(--_0x482390){_0x5866d1['push'](_0x5866d1['shift']());}};_0x30071f(++_0xa6dc72);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +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(_0x32f2c6,_0x300ad6){var _0x27484d=function(_0xd15d26){while(--_0xd15d26){_0x32f2c6['push'](_0x32f2c6['shift']());}};_0x27484d(++_0x300ad6);}(_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 moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 6c3b305..19e05d1 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 _0x748d=['removeAnswers','removeAgents','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/notify','/:id/applications','addApplications','addAgents','/:id/send','send','put','delete','destroy','removeDispositions'];(function(_0x4316a2,_0x1854d3){var _0x8e2a94=function(_0x38e4dd){while(--_0x38e4dd){_0x4316a2['push'](_0x4316a2['shift']());}};_0x8e2a94(++_0x1854d3);}(_0x748d,0x1a6));var _0xd748=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x748d[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xd748('0x0'));var util=require('util');var path=require(_0xd748('0x1'));var timeout=require(_0xd748('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd748('0x3'));var interaction=require(_0xd748('0x4'));var config=require(_0xd748('0x5'));var controller=require(_0xd748('0x6'));router[_0xd748('0x7')]('/',auth[_0xd748('0x8')](),controller[_0xd748('0x9')]);router[_0xd748('0x7')](_0xd748('0xa'),auth['isAuthenticated'](),controller[_0xd748('0xb')]);router[_0xd748('0x7')](_0xd748('0xc'),auth[_0xd748('0x8')](),controller['show']);router[_0xd748('0x7')](_0xd748('0xd'),auth[_0xd748('0x8')](),controller[_0xd748('0xe')]);router[_0xd748('0x7')](_0xd748('0xf'),auth[_0xd748('0x8')](),controller['getAnswers']);router[_0xd748('0x7')]('/:id/applications',auth[_0xd748('0x8')](),controller['getApplications']);router['get'](_0xd748('0x10'),auth[_0xd748('0x8')](),controller[_0xd748('0x11')]);router[_0xd748('0x7')](_0xd748('0x12'),auth[_0xd748('0x8')](),controller[_0xd748('0x13')]);router[_0xd748('0x14')]('/',auth[_0xd748('0x8')](),controller['create']);router['post'](_0xd748('0xd'),auth['isAuthenticated'](),controller[_0xd748('0x15')]);router[_0xd748('0x14')](_0xd748('0xf'),auth[_0xd748('0x8')](),controller[_0xd748('0x16')]);router[_0xd748('0x14')](_0xd748('0x17'),controller['notify']);router[_0xd748('0x14')](_0xd748('0x18'),auth[_0xd748('0x8')](),controller[_0xd748('0x19')]);router['post'](_0xd748('0x12'),auth[_0xd748('0x8')](),controller[_0xd748('0x1a')]);router[_0xd748('0x14')](_0xd748('0x1b'),auth[_0xd748('0x8')](),controller[_0xd748('0x1c')]);router[_0xd748('0x1d')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd748('0x1e')](_0xd748('0xc'),auth[_0xd748('0x8')](),controller[_0xd748('0x1f')]);router[_0xd748('0x1e')]('/:id/dispositions',auth[_0xd748('0x8')](),controller[_0xd748('0x20')]);router['delete'](_0xd748('0xf'),auth['isAuthenticated'](),controller[_0xd748('0x21')]);router[_0xd748('0x1e')](_0xd748('0x12'),auth[_0xd748('0x8')](),controller[_0xd748('0x22')]);module['exports']=router; \ No newline at end of file +var _0xd684=['delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','index','/describe','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','/:id/notify','notify','/:id/users','addAgents','send','update'];(function(_0x4ac81c,_0x22b4b3){var _0x325c77=function(_0x443164){while(--_0x443164){_0x4ac81c['push'](_0x4ac81c['shift']());}};_0x325c77(++_0x22b4b3);}(_0xd684,0x1f1));var _0x4d68=function(_0x4ccad7,_0x2daf62){_0x4ccad7=_0x4ccad7-0x0;var _0x3a1bc0=_0xd684[_0x4ccad7];return _0x3a1bc0;};'use strict';var multer=require('multer');var util=require(_0x4d68('0x0'));var path=require(_0x4d68('0x1'));var timeout=require('connect-timeout');var express=require(_0x4d68('0x2'));var router=express['Router']();var fs_extra=require(_0x4d68('0x3'));var auth=require(_0x4d68('0x4'));var interaction=require(_0x4d68('0x5'));var config=require('../../config/environment');var controller=require(_0x4d68('0x6'));router[_0x4d68('0x7')]('/',auth['isAuthenticated'](),controller[_0x4d68('0x8')]);router['get'](_0x4d68('0x9'),auth[_0x4d68('0xa')](),controller['describe']);router['get']('/:id',auth[_0x4d68('0xa')](),controller[_0x4d68('0xb')]);router[_0x4d68('0x7')](_0x4d68('0xc'),auth[_0x4d68('0xa')](),controller[_0x4d68('0xd')]);router[_0x4d68('0x7')](_0x4d68('0xe'),auth['isAuthenticated'](),controller[_0x4d68('0xf')]);router[_0x4d68('0x7')](_0x4d68('0x10'),auth[_0x4d68('0xa')](),controller[_0x4d68('0x11')]);router[_0x4d68('0x7')](_0x4d68('0x12'),auth['isAuthenticated'](),controller[_0x4d68('0x13')]);router[_0x4d68('0x7')]('/:id/users',auth[_0x4d68('0xa')](),controller[_0x4d68('0x14')]);router['post']('/',auth[_0x4d68('0xa')](),controller['create']);router[_0x4d68('0x15')]('/:id/dispositions',auth[_0x4d68('0xa')](),controller['addDisposition']);router[_0x4d68('0x15')](_0x4d68('0xe'),auth[_0x4d68('0xa')](),controller['addAnswer']);router[_0x4d68('0x15')](_0x4d68('0x16'),controller[_0x4d68('0x17')]);router[_0x4d68('0x15')]('/:id/applications',auth[_0x4d68('0xa')](),controller['addApplications']);router[_0x4d68('0x15')](_0x4d68('0x18'),auth[_0x4d68('0xa')](),controller[_0x4d68('0x19')]);router['post']('/:id/send',auth[_0x4d68('0xa')](),controller[_0x4d68('0x1a')]);router['put']('/:id',auth[_0x4d68('0xa')](),controller[_0x4d68('0x1b')]);router[_0x4d68('0x1c')](_0x4d68('0x1d'),auth[_0x4d68('0xa')](),controller[_0x4d68('0x1e')]);router['delete'](_0x4d68('0xc'),auth['isAuthenticated'](),controller[_0x4d68('0x1f')]);router['delete'](_0x4d68('0xe'),auth[_0x4d68('0xa')](),controller[_0x4d68('0x20')]);router[_0x4d68('0x1c')](_0x4d68('0x18'),auth['isAuthenticated'](),controller[_0x4d68('0x21')]);module[_0x4d68('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 97447c6..d0af8c9 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 _0x9f4f=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x4aaaa2,_0x53be38){var _0x5a6287=function(_0x358124){while(--_0x358124){_0x4aaaa2['push'](_0x4aaaa2['shift']());}};_0x5a6287(++_0x53be38);}(_0x9f4f,0xe9));var _0xf9f4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9f4f[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require(_0xf9f4('0x0'));var rs=require(_0xf9f4('0x1'));module['exports']={'name':{'type':Sequelize[_0xf9f4('0x2')],'unique':_0xf9f4('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xf9f4('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xf9f4('0x4')]();}},'replyUri':{'type':Sequelize[_0xf9f4('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf9f4('0x5');}},'notificationSound':{'type':Sequelize[_0xf9f4('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf9f4('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf9f4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xf9f4('0x2')]},'queueTransfer':{'type':Sequelize[_0xf9f4('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf9f4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf9f4('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf9f4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf9f4('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf9f4('0x8'),'set':function(_0x45053f){if(!_0x45053f)this[_0xf9f4('0x9')](_0xf9f4('0xa'),null);this[_0xf9f4('0x9')](_0xf9f4('0xb'),_0x45053f);}}}; \ No newline at end of file +var _0xb50b=['mandatoryDisposition','sequelize','randomstring','STRING','name','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','setDataValue','mandatoryDispositionPauseId'];(function(_0x357e37,_0x231149){var _0x1b36c1=function(_0x2553f5){while(--_0x2553f5){_0x357e37['push'](_0x357e37['shift']());}};_0x1b36c1(++_0x231149);}(_0xb50b,0x83));var _0xbb50=function(_0x328534,_0x33b41e){_0x328534=_0x328534-0x0;var _0x2796c0=_0xb50b[_0x328534];return _0x2796c0;};'use strict';var Sequelize=require(_0xbb50('0x0'));var rs=require(_0xbb50('0x1'));module['exports']={'name':{'type':Sequelize[_0xbb50('0x2')],'unique':_0xbb50('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xbb50('0x2')]},'token':{'type':Sequelize[_0xbb50('0x2')],'defaultValue':function(){return rs[_0xbb50('0x4')]();}},'replyUri':{'type':Sequelize[_0xbb50('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xbb50('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbb50('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbb50('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xbb50('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbb50('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbb50('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xbb50('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xbb50('0x6')],'defaultValue':![],'comment':_0xbb50('0x9'),'set':function(_0x1a60c1){if(!_0x1a60c1)this[_0xbb50('0xa')](_0xbb50('0xb'),null);this[_0xbb50('0xa')](_0xbb50('0xc'),_0x1a60c1);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index ae09359..530e737 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 _0x4953=['no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','list','applications','orderBy','priority','asc','account','contact','firstName','threadId','OpenchannelInteraction','ContactId','spread','lastName','interaction','created','close','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','EventManager','addApplications','sequelize','transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','send','getApplications','getInteractions','Contact','Owner','internal','Tags','tag','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','json','undefined','count','offset','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','name','query','keys','filters','intersection','model','attributes','fields','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','length','include','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','rawAttributes','hasOwnProperty','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact'];(function(_0x1ffc79,_0xf36254){var _0x7fba98=function(_0x5b44ae){while(--_0x5b44ae){_0x1ffc79['push'](_0x1ffc79['shift']());}};_0x7fba98(++_0xf36254);}(_0x4953,0x10a));var _0x3495=function(_0x4165d4,_0x4d5d66){_0x4165d4=_0x4165d4-0x0;var _0x11ec4e=_0x4953[_0x4165d4];return _0x11ec4e;};'use strict';var emlformat=require(_0x3495('0x0'));var rimraf=require(_0x3495('0x1'));var zipdir=require(_0x3495('0x2'));var jsonpatch=require(_0x3495('0x3'));var rp=require(_0x3495('0x4'));var moment=require(_0x3495('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3495('0x6'));var util=require('util');var path=require(_0x3495('0x7'));var sox=require(_0x3495('0x8'));var csv=require(_0x3495('0x9'));var ejs=require(_0x3495('0xa'));var fs=require('fs');var fs_extra=require(_0x3495('0xb'));var _=require(_0x3495('0xc'));var squel=require(_0x3495('0xd'));var crypto=require(_0x3495('0xe'));var jsforce=require(_0x3495('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3495('0x9'));var querystring=require(_0x3495('0x10'));var Papa=require('papaparse');var Redis=require(_0x3495('0x11'));var authService=require(_0x3495('0x12'));var qs=require(_0x3495('0x13'));var as=require(_0x3495('0x14'));var hardwareService=require(_0x3495('0x15'));var logger=require(_0x3495('0x16'))(_0x3495('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3495('0x18'));var db=require(_0x3495('0x19'))['db'];config[_0x3495('0x1a')]=_[_0x3495('0x1b')](config[_0x3495('0x1a')],{'host':_0x3495('0x1c'),'port':0x18eb});var socket=require(_0x3495('0x1d'))(new Redis(config[_0x3495('0x1a')]));require(_0x3495('0x1e'))[_0x3495('0x1f')](socket);var jayson=require(_0x3495('0x20'));var client=jayson[_0x3495('0x21')][_0x3495('0x22')]({'port':0x232c});var client9002=jayson[_0x3495('0x21')][_0x3495('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x490139,_0x4d253a,_0x50a905,_0x17b296){return new BPromise(function(_0x460f74,_0x294c34){var _0x57a736=_0x17b296||client;return _0x57a736['request'](_0x490139,_0x50a905)[_0x3495('0x23')](function(_0x15a171){logger[_0x3495('0x24')](_0x3495('0x25'),_0x4d253a,'request\x20sent');logger[_0x3495('0x26')](_0x3495('0x27'),_0x4d253a,_0x3495('0x28'),JSON['stringify'](_0x15a171));if(_0x15a171['error']){if(_0x15a171[_0x3495('0x29')][_0x3495('0x2a')]===0x1f4){logger[_0x3495('0x29')](_0x3495('0x25'),_0x4d253a,_0x15a171[_0x3495('0x29')][_0x3495('0x2b')]);return _0x294c34(_0x15a171[_0x3495('0x29')][_0x3495('0x2b')]);}logger[_0x3495('0x29')](_0x3495('0x25'),_0x4d253a,_0x15a171[_0x3495('0x29')]['message']);return _0x460f74(_0x15a171[_0x3495('0x29')]['message']);}else{logger['info'](_0x3495('0x25'),_0x4d253a,_0x3495('0x28'));_0x460f74(_0x15a171['result'][_0x3495('0x2b')]);}})[_0x3495('0x2c')](function(_0x19b1ea){logger[_0x3495('0x29')](_0x3495('0x25'),_0x4d253a,_0x19b1ea);_0x294c34(_0x19b1ea);});});}function respondWithStatusCode(_0x22bcc8,_0x56353a){_0x56353a=_0x56353a||0xcc;return function(_0x25aa2b){if(_0x25aa2b){return _0x22bcc8[_0x3495('0x2d')](_0x56353a);}return _0x22bcc8[_0x3495('0x2e')](_0x56353a)[_0x3495('0x2f')]();};}function respondWithResult(_0x140ac1,_0x599f37){_0x599f37=_0x599f37||0xc8;return function(_0x3bcdcd){if(_0x3bcdcd){return _0x140ac1['status'](_0x599f37)[_0x3495('0x30')](_0x3bcdcd);}};}function respondWithFilteredResult(_0x24038e,_0x1364e1){return function(_0x4eb5d1){if(_0x4eb5d1){var _0x111f3f=typeof _0x1364e1['offset']===_0x3495('0x31')&&typeof _0x1364e1['limit']===_0x3495('0x31');var _0x21997f=_0x4eb5d1[_0x3495('0x32')];var _0x2defe5=_0x111f3f?0x0:_0x1364e1[_0x3495('0x33')];var _0x3a203b=_0x111f3f?_0x4eb5d1['count']:_0x1364e1['offset']+_0x1364e1['limit'];var _0x341a87;if(_0x3a203b>=_0x21997f){_0x3a203b=_0x21997f;_0x341a87=0xc8;}else{_0x341a87=0xce;}_0x24038e[_0x3495('0x2e')](_0x341a87);return _0x24038e['set']('Content-Range',_0x2defe5+'-'+_0x3a203b+'/'+_0x21997f)[_0x3495('0x30')](_0x4eb5d1);}return null;};}function patchUpdates(_0x34b91d){return function(_0x539723){try{jsonpatch[_0x3495('0x34')](_0x539723,_0x34b91d,!![]);}catch(_0x527688){return BPromise[_0x3495('0x35')](_0x527688);}return _0x539723[_0x3495('0x36')]();};}function saveUpdates(_0xb67a62,_0x242236){return function(_0x5bfb90){if(_0x5bfb90){return _0x5bfb90[_0x3495('0x37')](_0xb67a62)[_0x3495('0x23')](function(_0x40e6b3){return _0x40e6b3;});}return null;};}function removeEntity(_0x504acd,_0x37dc3b){return function(_0x156a18){if(_0x156a18){return _0x156a18[_0x3495('0x38')]()['then'](function(){var _0x332a81=_0x156a18[_0x3495('0x39')]({'plain':!![]});var _0x3c42ba=_0x3495('0x3a');return db[_0x3495('0x3b')][_0x3495('0x38')]({'where':{'type':_0x3c42ba,'resourceId':_0x332a81['id']}})[_0x3495('0x23')](function(){return _0x156a18;});})[_0x3495('0x23')](function(){_0x504acd[_0x3495('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc10a94,_0x17dc67){return function(_0xd73033){if(!_0xd73033){_0xc10a94[_0x3495('0x2d')](0x194);}return _0xd73033;};}function handleError(_0xfd0a6f,_0x35eed6){_0x35eed6=_0x35eed6||0x1f4;return function(_0x577bf8){logger[_0x3495('0x29')](_0x577bf8['stack']);if(_0x577bf8['name']){delete _0x577bf8['name'];}_0xfd0a6f['status'](_0x35eed6)['send'](_0x577bf8);};}exports[_0x3495('0x3c')]=function(_0x18f30d,_0x41a784){var _0x1e592d={'include':[{'model':db[_0x3495('0x3d')],'as':_0x3495('0x3e')}]},_0x4244f8={},_0x51dd2e={'count':0x0,'rows':[]};var _0xa4344d=_[_0x3495('0x3f')](db[_0x3495('0x40')]['rawAttributes'],function(_0x21269a){return{'name':_0x21269a[_0x3495('0x41')],'type':_0x21269a['type']['key']};});_0x4244f8['model']=_[_0x3495('0x3f')](_0xa4344d,_0x3495('0x42'));_0x4244f8[_0x3495('0x43')]=_[_0x3495('0x44')](_0x18f30d[_0x3495('0x43')]);_0x4244f8[_0x3495('0x45')]=_[_0x3495('0x46')](_0x4244f8[_0x3495('0x47')],_0x4244f8['query']);_0x1e592d[_0x3495('0x48')]=_['intersection'](_0x4244f8[_0x3495('0x47')],qs[_0x3495('0x49')](_0x18f30d[_0x3495('0x43')]['fields']));_0x1e592d['attributes']=_0x1e592d[_0x3495('0x48')]['length']?_0x1e592d[_0x3495('0x48')]:_0x4244f8[_0x3495('0x47')];if(!_0x18f30d[_0x3495('0x43')]['hasOwnProperty'](_0x3495('0x4a'))){_0x1e592d['limit']=qs[_0x3495('0x4b')](_0x18f30d[_0x3495('0x43')]['limit']);_0x1e592d[_0x3495('0x33')]=qs[_0x3495('0x33')](_0x18f30d[_0x3495('0x43')]['offset']);}_0x1e592d[_0x3495('0x4c')]=qs[_0x3495('0x4d')](_0x18f30d[_0x3495('0x43')][_0x3495('0x4d')]);_0x1e592d[_0x3495('0x4e')]=qs[_0x3495('0x45')](_['pick'](_0x18f30d[_0x3495('0x43')],_0x4244f8[_0x3495('0x45')]),_0xa4344d);if(_0x18f30d[_0x3495('0x43')][_0x3495('0x4f')]){_0x1e592d[_0x3495('0x4e')]=_[_0x3495('0x50')](_0x1e592d[_0x3495('0x4e')],{'$or':_[_0x3495('0x3f')](_0xa4344d,function(_0x5d4bca){if(_0x5d4bca[_0x3495('0x51')]!==_0x3495('0x52')){var _0x75bcf3={};_0x75bcf3[_0x5d4bca[_0x3495('0x42')]]={'$like':'%'+_0x18f30d[_0x3495('0x43')][_0x3495('0x4f')]+'%'};return _0x75bcf3;}})});}_0x1e592d=_['merge']({},_0x1e592d,_0x18f30d[_0x3495('0x53')]);var _0xe5bf87={'where':_0x1e592d[_0x3495('0x4e')]};return db[_0x3495('0x40')][_0x3495('0x32')](_0xe5bf87)[_0x3495('0x23')](function(_0x5bd142){_0x51dd2e[_0x3495('0x32')]=_0x5bd142;if(_0x18f30d[_0x3495('0x43')][_0x3495('0x54')]){_0x1e592d['include']=[{'all':!![]}];}return db['OpenchannelAccount'][_0x3495('0x55')](_0x1e592d);})[_0x3495('0x23')](function(_0x9feec9){_0x51dd2e[_0x3495('0x56')]=_0x9feec9;return _0x51dd2e;})[_0x3495('0x23')](respondWithFilteredResult(_0x41a784,_0x1e592d))[_0x3495('0x2c')](handleError(_0x41a784,null));};exports[_0x3495('0x57')]=function(_0x3dbfb4,_0x12a5a5){var _0x88d69d={'raw':![],'where':{'id':_0x3dbfb4[_0x3495('0x58')]['id']},'include':[{'model':db[_0x3495('0x3d')],'as':_0x3495('0x3e')}]},_0x51a0b1={};_0x51a0b1['model']=_['keys'](db[_0x3495('0x40')]['rawAttributes']);_0x51a0b1[_0x3495('0x43')]=_['keys'](_0x3dbfb4[_0x3495('0x43')]);_0x51a0b1[_0x3495('0x45')]=_[_0x3495('0x46')](_0x51a0b1['model'],_0x51a0b1['query']);_0x88d69d[_0x3495('0x48')]=_[_0x3495('0x46')](_0x51a0b1[_0x3495('0x47')],qs[_0x3495('0x49')](_0x3dbfb4[_0x3495('0x43')][_0x3495('0x49')]));_0x88d69d[_0x3495('0x48')]=_0x88d69d['attributes'][_0x3495('0x59')]?_0x88d69d[_0x3495('0x48')]:_0x51a0b1[_0x3495('0x47')];if(_0x3dbfb4[_0x3495('0x43')][_0x3495('0x54')]){_0x88d69d[_0x3495('0x5a')]=[{'all':!![]}];}_0x88d69d=_[_0x3495('0x50')]({},_0x88d69d,_0x3dbfb4[_0x3495('0x53')]);return db['OpenchannelAccount'][_0x3495('0x5b')](_0x88d69d)[_0x3495('0x23')](handleEntityNotFound(_0x12a5a5,null))[_0x3495('0x23')](respondWithResult(_0x12a5a5,null))[_0x3495('0x2c')](handleError(_0x12a5a5,null));};exports[_0x3495('0x5c')]=function(_0xd29017,_0x9b7cac){return db['OpenchannelAccount'][_0x3495('0x5c')](_0xd29017[_0x3495('0x5d')],{})[_0x3495('0x23')](function(_0x44a824){var _0x3ba8e9=_0xd29017['user']['get']({'plain':!![]});if(!_0x3ba8e9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ba8e9[_0x3495('0x5e')]===_0x3495('0x5f')){var _0x399a9c=_0x44a824[_0x3495('0x39')]({'plain':!![]});var _0x44832b='OpenchannelAccounts';return db[_0x3495('0x60')][_0x3495('0x5b')]({'where':{'name':_0x44832b,'userProfileId':_0x3ba8e9[_0x3495('0x61')]},'raw':!![]})[_0x3495('0x23')](function(_0x185057){if(_0x185057&&_0x185057[_0x3495('0x62')]===0x0){return db[_0x3495('0x3b')][_0x3495('0x5c')]({'name':_0x399a9c[_0x3495('0x42')],'resourceId':_0x399a9c['id'],'type':_0x185057[_0x3495('0x42')],'sectionId':_0x185057['id']},{})[_0x3495('0x23')](function(){return _0x44a824;});}else{return _0x44a824;}})['catch'](function(_0x3f7fc4){logger[_0x3495('0x29')](_0x3495('0x63'),_0x3f7fc4);throw _0x3f7fc4;});}return _0x44a824;})['then'](respondWithResult(_0x9b7cac,0xc9))[_0x3495('0x2c')](handleError(_0x9b7cac,null));};exports[_0x3495('0x37')]=function(_0x28ca5f,_0xac70){if(_0x28ca5f[_0x3495('0x5d')]['id']){delete _0x28ca5f['body']['id'];}return db[_0x3495('0x40')][_0x3495('0x5b')]({'where':{'id':_0x28ca5f[_0x3495('0x58')]['id']},'include':[{'model':db[_0x3495('0x3d')],'as':_0x3495('0x3e')}]})[_0x3495('0x23')](handleEntityNotFound(_0xac70,null))[_0x3495('0x23')](saveUpdates(_0x28ca5f[_0x3495('0x5d')],null))['then'](respondWithResult(_0xac70,null))[_0x3495('0x2c')](handleError(_0xac70,null));};exports[_0x3495('0x38')]=function(_0x419957,_0x33e851){return db[_0x3495('0x40')][_0x3495('0x5b')]({'where':{'id':_0x419957[_0x3495('0x58')]['id']}})[_0x3495('0x23')](handleEntityNotFound(_0x33e851,null))[_0x3495('0x23')](removeEntity(_0x33e851,null))[_0x3495('0x2c')](handleError(_0x33e851,null));};exports[_0x3495('0x64')]=function(_0x54308f,_0x5d54f1){return db['OpenchannelAccount']['describe']()[_0x3495('0x23')](respondWithResult(_0x5d54f1,null))[_0x3495('0x2c')](handleError(_0x5d54f1,null));};exports[_0x3495('0x65')]=function(_0x58e08d,_0x43aeda,_0x3e25dc){if(_0x58e08d[_0x3495('0x5d')]['id']){delete _0x58e08d['body']['id'];}return db[_0x3495('0x40')]['find']({'where':{'id':_0x58e08d[_0x3495('0x58')]['id']}})['then'](handleEntityNotFound(_0x43aeda,null))[_0x3495('0x23')](function(_0x4281e8){if(_0x4281e8){_0x58e08d['body'][_0x3495('0x66')]=_0x4281e8['id'];return db['Disposition'][_0x3495('0x5c')](_0x58e08d[_0x3495('0x5d')]);}})[_0x3495('0x23')](respondWithResult(_0x43aeda,null))['catch'](handleError(_0x43aeda,null));};exports[_0x3495('0x67')]=function(_0x1ed6ef,_0x208c3e,_0x28d702){var _0x360091={'raw':![],'where':{}};var _0x17944f={};var _0x46c32f={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x3495('0x68')]({'where':{'id':_0x1ed6ef[_0x3495('0x58')]['id']}})['then'](handleEntityNotFound(_0x208c3e,null))[_0x3495('0x23')](function(_0x305798){if(_0x305798){_0x17944f['model']=_['keys'](db[_0x3495('0x69')][_0x3495('0x6a')]);_0x17944f[_0x3495('0x43')]=_[_0x3495('0x44')](_0x1ed6ef['query']);_0x17944f[_0x3495('0x45')]=_[_0x3495('0x46')](_0x17944f[_0x3495('0x47')],_0x17944f[_0x3495('0x43')]);_0x360091[_0x3495('0x48')]=_[_0x3495('0x46')](_0x17944f[_0x3495('0x47')],qs[_0x3495('0x49')](_0x1ed6ef['query']['fields']));_0x360091[_0x3495('0x48')]=_0x360091[_0x3495('0x48')][_0x3495('0x59')]?_0x360091[_0x3495('0x48')]:_0x17944f[_0x3495('0x47')];if(!_0x1ed6ef[_0x3495('0x43')][_0x3495('0x6b')](_0x3495('0x4a'))){_0x360091[_0x3495('0x4b')]=qs['limit'](_0x1ed6ef[_0x3495('0x43')][_0x3495('0x4b')]);_0x360091['offset']=qs['offset'](_0x1ed6ef[_0x3495('0x43')]['offset']);}_0x360091['order']=qs['sort'](_0x1ed6ef[_0x3495('0x43')][_0x3495('0x4d')]);_0x360091[_0x3495('0x4e')]=qs[_0x3495('0x45')](_[_0x3495('0x6c')](_0x1ed6ef[_0x3495('0x43')],_0x17944f[_0x3495('0x45')]));_0x360091[_0x3495('0x4e')][_0x3495('0x66')]=_0x305798['id'];if(_0x1ed6ef[_0x3495('0x43')][_0x3495('0x4f')]){_0x360091[_0x3495('0x4e')]=_[_0x3495('0x50')](_0x360091['where'],{'$or':_[_0x3495('0x3f')](_0x360091[_0x3495('0x48')],function(_0x6cd3fe){var _0x493979={};_0x493979[_0x6cd3fe]={'$like':'%'+_0x1ed6ef['query'][_0x3495('0x4f')]+'%'};return _0x493979;})});}_0x360091=_[_0x3495('0x50')]({},_0x360091,_0x1ed6ef[_0x3495('0x53')]);return db[_0x3495('0x69')][_0x3495('0x32')]({'where':_0x360091[_0x3495('0x4e')]})['then'](function(_0x133ea6){_0x46c32f['count']=_0x133ea6;if(_0x1ed6ef['query'][_0x3495('0x54')]){_0x360091[_0x3495('0x5a')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x360091);})[_0x3495('0x23')](function(_0x5942be){_0x46c32f['rows']=_0x5942be;return _0x46c32f;});}})['then'](respondWithFilteredResult(_0x208c3e,_0x360091))[_0x3495('0x2c')](handleError(_0x208c3e,null));};exports[_0x3495('0x6d')]=function(_0x2637ff,_0x32ee33,_0x12a2cb){return db['OpenchannelAccount'][_0x3495('0x5b')]({'where':{'id':_0x2637ff['params']['id']}})[_0x3495('0x23')](handleEntityNotFound(_0x32ee33,null))[_0x3495('0x23')](function(_0x27a62b){if(_0x27a62b){return _0x27a62b[_0x3495('0x6d')](_0x2637ff[_0x3495('0x43')][_0x3495('0x6e')]);}})['then'](respondWithStatusCode(_0x32ee33,null))[_0x3495('0x2c')](handleError(_0x32ee33,null));};exports[_0x3495('0x6f')]=function(_0x513260,_0xf96db9,_0x5b7789){if(_0x513260['body']['id']){delete _0x513260[_0x3495('0x5d')]['id'];}return db[_0x3495('0x40')]['find']({'where':{'id':_0x513260[_0x3495('0x58')]['id']}})['then'](handleEntityNotFound(_0xf96db9,null))[_0x3495('0x23')](function(_0x554e72){if(_0x554e72){_0x513260[_0x3495('0x5d')]['OpenchannelAccountId']=_0x554e72['id'];return db[_0x3495('0x70')][_0x3495('0x5c')](_0x513260[_0x3495('0x5d')]);}})[_0x3495('0x23')](respondWithResult(_0xf96db9,null))['catch'](handleError(_0xf96db9,null));};exports[_0x3495('0x71')]=function(_0x1f023d,_0x9875dd,_0x490ba2){var _0xbc711d={'raw':![],'where':{}};var _0x2cfa1a={};var _0x20c53a={'count':0x0,'rows':[]};return db[_0x3495('0x40')][_0x3495('0x68')]({'where':{'id':_0x1f023d[_0x3495('0x58')]['id']}})['then'](handleEntityNotFound(_0x9875dd,null))[_0x3495('0x23')](function(_0x5e774a){if(_0x5e774a){_0x2cfa1a[_0x3495('0x47')]=_[_0x3495('0x44')](db[_0x3495('0x70')][_0x3495('0x6a')]);_0x2cfa1a[_0x3495('0x43')]=_[_0x3495('0x44')](_0x1f023d['query']);_0x2cfa1a[_0x3495('0x45')]=_[_0x3495('0x46')](_0x2cfa1a[_0x3495('0x47')],_0x2cfa1a[_0x3495('0x43')]);_0xbc711d[_0x3495('0x48')]=_[_0x3495('0x46')](_0x2cfa1a[_0x3495('0x47')],qs['fields'](_0x1f023d['query'][_0x3495('0x49')]));_0xbc711d[_0x3495('0x48')]=_0xbc711d[_0x3495('0x48')][_0x3495('0x59')]?_0xbc711d[_0x3495('0x48')]:_0x2cfa1a['model'];if(!_0x1f023d[_0x3495('0x43')][_0x3495('0x6b')](_0x3495('0x4a'))){_0xbc711d[_0x3495('0x4b')]=qs['limit'](_0x1f023d[_0x3495('0x43')][_0x3495('0x4b')]);_0xbc711d[_0x3495('0x33')]=qs['offset'](_0x1f023d[_0x3495('0x43')][_0x3495('0x33')]);}_0xbc711d[_0x3495('0x4c')]=qs[_0x3495('0x4d')](_0x1f023d[_0x3495('0x43')][_0x3495('0x4d')]);_0xbc711d[_0x3495('0x4e')]=qs[_0x3495('0x45')](_['pick'](_0x1f023d['query'],_0x2cfa1a[_0x3495('0x45')]));_0xbc711d[_0x3495('0x4e')]['OpenchannelAccountId']=_0x5e774a['id'];if(_0x1f023d[_0x3495('0x43')][_0x3495('0x4f')]){_0xbc711d[_0x3495('0x4e')]=_['merge'](_0xbc711d['where'],{'$or':_[_0x3495('0x3f')](_0xbc711d[_0x3495('0x48')],function(_0x36d115){var _0x41298d={};_0x41298d[_0x36d115]={'$like':'%'+_0x1f023d[_0x3495('0x43')][_0x3495('0x4f')]+'%'};return _0x41298d;})});}_0xbc711d=_[_0x3495('0x50')]({},_0xbc711d,_0x1f023d[_0x3495('0x53')]);return db[_0x3495('0x70')][_0x3495('0x32')]({'where':_0xbc711d[_0x3495('0x4e')]})[_0x3495('0x23')](function(_0x233508){_0x20c53a['count']=_0x233508;if(_0x1f023d['query'][_0x3495('0x54')]){_0xbc711d[_0x3495('0x5a')]=[{'all':!![]}];}return db[_0x3495('0x70')][_0x3495('0x55')](_0xbc711d);})[_0x3495('0x23')](function(_0x14812a){_0x20c53a[_0x3495('0x56')]=_0x14812a;return _0x20c53a;});}})[_0x3495('0x23')](respondWithFilteredResult(_0x9875dd,_0xbc711d))[_0x3495('0x2c')](handleError(_0x9875dd,null));};exports[_0x3495('0x72')]=function(_0x3b7da4,_0x38f984,_0x1d1993){return db[_0x3495('0x40')][_0x3495('0x5b')]({'where':{'id':_0x3b7da4[_0x3495('0x58')]['id']}})[_0x3495('0x23')](handleEntityNotFound(_0x38f984,null))[_0x3495('0x23')](function(_0x3c49b3){if(_0x3c49b3){return _0x3c49b3[_0x3495('0x72')](_0x3b7da4['query'][_0x3495('0x6e')]);}})[_0x3495('0x23')](respondWithStatusCode(_0x38f984,null))['catch'](handleError(_0x38f984,null));};exports[_0x3495('0x73')]=function(_0x5f27b1,_0x16d303,_0x2d2648){var _0x23909f={'body':_0x5f27b1['body'],'channel':_0x3495('0x74')};var _0x2c7fa1=[];var _0x5ae298=[];var _0x221f4a={};var _0x548f12=![];return db[_0x3495('0x75')]['describe']()[_0x3495('0x23')](function(_0x3f8acd){if(!_0x3f8acd){throw new db['Sequelize']['ValidationError'](_0x3495('0x76'));}_0x2c7fa1=_[_0x3495('0x77')](_[_0x3495('0x44')](_0x3f8acd),[_0x3495('0x78'),'updatedAt']);_0x5ae298=_[_0x3495('0x77')](_[_0x3495('0x44')](_0x3f8acd),['createdAt',_0x3495('0x79'),_0x3495('0x7a'),_0x3495('0x7b')]);if(_0x5f27b1[_0x3495('0x5d')]['id']){delete _0x5f27b1[_0x3495('0x5d')]['id'];}if(_[_0x3495('0x7c')](_0x5f27b1['body'][_0x3495('0x7d')])){throw new db[(_0x3495('0x7e'))][(_0x3495('0x7f'))](_0x3495('0x80'));}if(_['isNil'](_0x5f27b1[_0x3495('0x5d')][_0x3495('0x5d')])||_0x5f27b1[_0x3495('0x5d')][_0x3495('0x5d')]===''){throw new db[(_0x3495('0x7e'))][(_0x3495('0x7f'))](_0x3495('0x81'));}if(_[_0x3495('0x7c')](_0x5f27b1[_0x3495('0x5d')]['mapKey'])){throw new db[(_0x3495('0x7e'))][(_0x3495('0x7f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5ae298);}if(!_['includes'](_0x5ae298,_0x5f27b1[_0x3495('0x5d')][_0x3495('0x82')])){throw new db[(_0x3495('0x7e'))][(_0x3495('0x7f'))](_0x3495('0x83')+_0x5ae298);}_0x221f4a[_0x5f27b1['body'][_0x3495('0x82')]]=_0x5f27b1['body']['from'];})['then'](function(){return db[_0x3495('0x40')][_0x3495('0x5b')]({'where':{'id':_0x5f27b1[_0x3495('0x58')]['id']},'include':[{'model':db[_0x3495('0x84')],'as':_0x3495('0x85'),'include':[{'model':db[_0x3495('0x75')],'as':_0x3495('0x86'),'where':_0x221f4a,'limit':0x1,'order':[['updatedAt',_0x3495('0x87')]]}]},{'model':db[_0x3495('0x88')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x16d303,null))[_0x3495('0x23')](function(_0x3f2370){if(_0x3f2370&&_0x3f2370[_0x3495('0x85')]){_0x23909f['account']=_0x3f2370;_0x23909f['applications']=_0x3f2370[_0x3495('0x89')];_0x23909f[_0x3495('0x8a')]=_0x3f2370[_0x3495('0x85')];_0x23909f[_0x3495('0x8b')]=_[_0x3495('0x8c')](_0x23909f['applications'],[_0x3495('0x8d')],[_0x3495('0x8e')]);if(_0x23909f['account']['Applications']){delete _0x23909f[_0x3495('0x8f')]['Applications'];}if(_0x23909f[_0x3495('0x8f')][_0x3495('0x85')]&&_0x23909f[_0x3495('0x8f')]['List'][_0x3495('0x86')][_0x3495('0x59')]){return _0x23909f[_0x3495('0x8f')][_0x3495('0x85')]['Contacts'][0x0];}var _0x470b49=_[_0x3495('0x1b')](_0x5f27b1['body'],{'firstName':_0x5f27b1[_0x3495('0x5d')][_0x3495('0x7d')],'ListId':_0x3f2370[_0x3495('0x7b')]});_0x470b49[_0x5f27b1['body'][_0x3495('0x82')]]=_0x5f27b1[_0x3495('0x5d')][_0x3495('0x7d')];return db[_0x3495('0x75')]['create'](_0x470b49,{'fields':_0x2c7fa1,'raw':!![]});}})['then'](handleEntityNotFound(_0x16d303,null))[_0x3495('0x23')](function(_0x120884){_0x23909f[_0x3495('0x90')]=_0x120884;if(_0x120884){var _0x476a09={'ContactId':_0x120884['id'],'OpenchannelAccountId':_0x5f27b1[_0x3495('0x58')]['id'],'from':(_0x120884[_0x3495('0x91')]||'')+'\x20'+(_0x120884['lastName']||'')};var _0xc98bfd={'OpenchannelAccountId':_0x5f27b1[_0x3495('0x58')]['id'],'closed':![]};if(_0x5f27b1['body'][_0x3495('0x92')]){_0xc98bfd[_0x3495('0x92')]=_0x5f27b1[_0x3495('0x5d')]['threadId'];return db['OpenchannelInteraction'][_0x3495('0x5b')]({'where':_0xc98bfd})[_0x3495('0x23')](function(_0x581576){if(_0x581576){return[_0x581576,![]];}_0x476a09[_0x3495('0x92')]=_0x5f27b1[_0x3495('0x5d')]['threadId'];_0x476a09['externalUrl']=_0x5f27b1['body']['externalUrl'];return db[_0x3495('0x93')][_0x3495('0x5c')](_0x476a09)[_0x3495('0x23')](function(_0x38ec0c){return[_0x38ec0c,!![]];});});}else{_0xc98bfd[_0x3495('0x92')]=null;}_0xc98bfd[_0x3495('0x94')]=_0x120884['id'];return db['OpenchannelInteraction'][_0x3495('0x5b')]({'where':_0xc98bfd})['then'](function(_0x54755c){if(_0x54755c){return[_0x54755c,![]];}return db[_0x3495('0x93')][_0x3495('0x5c')](_0x476a09)[_0x3495('0x23')](function(_0x38aaac){return[_0x38aaac,!![]];});});}})[_0x3495('0x95')](function(_0x17ed25,_0x208664){if(_0x17ed25){_0x548f12=_0x208664;if(!_0x208664){var _0x17f5ad={'from':(_0x23909f['contact'][_0x3495('0x91')]||'')+'\x20'+(_0x23909f[_0x3495('0x90')][_0x3495('0x96')]||'')};if(_0x5f27b1[_0x3495('0x5d')]['threadId']&&_0x5f27b1[_0x3495('0x5d')]['messageId']&&_0x5f27b1[_0x3495('0x5d')]['threadId']!=_0x5f27b1['body']['messageId']){_0x17f5ad[_0x3495('0x92')]=_0x5f27b1[_0x3495('0x5d')]['messageId'];}return _0x17ed25[_0x3495('0x37')](_0x17f5ad);}else{return _0x17ed25;}}})[_0x3495('0x23')](function(_0x489f11){_0x23909f['interaction']=_0x489f11[_0x3495('0x39')]({'plain':!![]});_0x23909f[_0x3495('0x97')][_0x3495('0x98')]=_0x548f12;if(_0x23909f[_0x3495('0x97')]['created']){if(_0x23909f[_0x3495('0x8f')]['autoclose']){_0x23909f[_0x3495('0x8b')]['push']({'id':0x0,'priority':_0x23909f[_0x3495('0x8b')][_0x3495('0x59')]+0x1,'app':_0x3495('0x99'),'appdata':_0x3495('0x9a'),'interval':'*,*,*,*'});}}return db[_0x3495('0x9b')][_0x3495('0x5c')]({'body':_0x5f27b1[_0x3495('0x5d')][_0x3495('0x5d')],'OpenchannelAccountId':_0x5f27b1[_0x3495('0x58')]['id'],'OpenchannelInteractionId':_0x489f11['id'],'direction':'in','ContactId':_0x23909f[_0x3495('0x90')]['id'],'AttachmentId':_0x5f27b1['body'][_0x3495('0x9c')]});})[_0x3495('0x23')](function(_0x4da579){_0x23909f[_0x3495('0x2b')]=_0x4da579;if(_0x23909f[_0x3495('0x97')][_0x3495('0x9d')]){return db[_0x3495('0x9e')]['find']({'attributes':['id',_0x3495('0x42')],'where':{'id':_0x23909f[_0x3495('0x97')][_0x3495('0x9d')]}})[_0x3495('0x23')](function(_0x3214b3){if(_0x3214b3){_0x23909f['applications'][_0x3495('0x9f')]({'id':0x0,'priority':0x0,'app':_0x3495('0xa0'),'appdata':_0x3214b3['name']+','+(_0x23909f['account'][_0x3495('0xa1')]||0xa),'interval':_0x3495('0xa2')});_0x23909f[_0x3495('0xa3')]=![];}return respondWithRpcPromise(_0x3495('0xa4'),'startRouting',_0x23909f);});}return respondWithRpcPromise(_0x3495('0xa4'),'startRouting',_0x23909f);})[_0x3495('0x23')](function(_0x18919c){respondWithRpcPromise('EventManager',_0x3495('0xa5'),{'event':_0x3495('0x73'),'message':_0x18919c},client9002);return _0x18919c;})['then'](respondWithResult(_0x16d303,null))[_0x3495('0x2c')](handleError(_0x16d303,null));};exports[_0x3495('0xa6')]=function(_0x3800b9,_0x11fba9){var _0x81d9eb=_0x3800b9['params']['id'];var _0x33c31a=_0x3800b9[_0x3495('0x5d')];var _0x6034d0=0xc8;var _0x391a4b=null;return db[_0x3495('0xa7')][_0x3495('0xa8')]({'isolationLevel':db[_0x3495('0xa7')]['Transaction']['ISOLATION_LEVELS'][_0x3495('0xa9')]},function(_0x4a30af){return db[_0x3495('0x40')][_0x3495('0x68')]({'where':{'id':_0x81d9eb},'transaction':_0x4a30af})['then'](function(_0x406920){if(_0x406920){return db[_0x3495('0x88')][_0x3495('0x38')]({'where':{'OpenchannelAccountId':_0x81d9eb},'transaction':_0x4a30af})[_0x3495('0x23')](function(){var _0x3bbc3d=_[_0x3495('0x3f')](_0x33c31a,function(_0x30cafa){_0x30cafa['OpenchannelAccountId']=_0x81d9eb;return _0x30cafa;});return db['OpenchannelApplication'][_0x3495('0xaa')](_0x3bbc3d,{'transaction':_0x4a30af});});}else{_0x6034d0=0x194;_0x391a4b=[];}});})[_0x3495('0x23')](function(){if(_0x6034d0!==0x194){return db[_0x3495('0x88')][_0x3495('0xab')]({'where':{'OpenchannelAccountId':_0x81d9eb},'order':'priority'})['then'](function(_0x134f68){_0x391a4b=_0x134f68;});}})[_0x3495('0x2c')](function(_0x1436eb){_0x6034d0=0x1f4;logger[_0x3495('0x29')](_0x1436eb['stack']);if(_0x1436eb[_0x3495('0x42')]){delete _0x1436eb[_0x3495('0x42')];}_0x391a4b=_0x1436eb;})[_0x3495('0xac')](function(){if(_0x391a4b===null){_0x11fba9[_0x3495('0x2d')](_0x6034d0);}else{if(_0x6034d0===0x1f4){_0x11fba9[_0x3495('0x2e')](_0x6034d0)[_0x3495('0xad')](_0x391a4b);}else{_0x11fba9[_0x3495('0x2e')](_0x6034d0)[_0x3495('0x30')](_0x391a4b);}}});};exports[_0x3495('0xae')]=function(_0x488fe3,_0x251eb7,_0x45b600){var _0x277418={};var _0x4e8844={};var _0x1dce15;var _0x29c943;return db[_0x3495('0x40')][_0x3495('0x68')]({'where':{'id':_0x488fe3[_0x3495('0x58')]['id']}})[_0x3495('0x23')](handleEntityNotFound(_0x251eb7,null))[_0x3495('0x23')](function(_0x441457){if(_0x441457){_0x1dce15=_0x441457;_0x4e8844['model']=_[_0x3495('0x44')](db['OpenchannelApplication'][_0x3495('0x6a')]);_0x4e8844[_0x3495('0x43')]=_['keys'](_0x488fe3[_0x3495('0x43')]);_0x4e8844[_0x3495('0x45')]=_['intersection'](_0x4e8844[_0x3495('0x47')],_0x4e8844[_0x3495('0x43')]);_0x277418[_0x3495('0x48')]=_['intersection'](_0x4e8844[_0x3495('0x47')],qs[_0x3495('0x49')](_0x488fe3['query']['fields']));_0x277418['attributes']=_0x277418[_0x3495('0x48')][_0x3495('0x59')]?_0x277418[_0x3495('0x48')]:_0x4e8844[_0x3495('0x47')];_0x277418[_0x3495('0x4c')]=qs[_0x3495('0x4d')](_0x488fe3[_0x3495('0x43')][_0x3495('0x4d')]);_0x277418['where']=qs[_0x3495('0x45')](_[_0x3495('0x6c')](_0x488fe3['query'],_0x4e8844['filters']));if(_0x488fe3[_0x3495('0x43')][_0x3495('0x4f')]){_0x277418[_0x3495('0x4e')]=_[_0x3495('0x50')](_0x277418[_0x3495('0x4e')],{'$or':_[_0x3495('0x3f')](_0x277418[_0x3495('0x48')],function(_0x454f16){var _0x1df148={};_0x1df148[_0x454f16]={'$like':'%'+_0x488fe3['query'][_0x3495('0x4f')]+'%'};return _0x1df148;})});}_0x277418=_[_0x3495('0x50')]({},_0x277418,_0x488fe3[_0x3495('0x53')]);return _0x1dce15['getApplications'](_0x277418);}})[_0x3495('0x23')](function(_0x46b645){if(_0x46b645){_0x29c943=_0x46b645[_0x3495('0x59')];if(!_0x488fe3[_0x3495('0x43')][_0x3495('0x6b')](_0x3495('0x4a'))){_0x277418[_0x3495('0x4b')]=qs['limit'](_0x488fe3['query'][_0x3495('0x4b')]);_0x277418[_0x3495('0x33')]=qs[_0x3495('0x33')](_0x488fe3[_0x3495('0x43')]['offset']);}return _0x1dce15[_0x3495('0xae')](_0x277418);}})[_0x3495('0x23')](function(_0x35ced3){if(_0x35ced3){return _0x35ced3?{'count':_0x29c943,'rows':_0x35ced3}:null;}})[_0x3495('0x23')](respondWithResult(_0x251eb7,null))[_0x3495('0x2c')](handleError(_0x251eb7,null));};exports[_0x3495('0xaf')]=function(_0x8f890,_0x3b22bf,_0x189b23){var _0x1939f0={'raw':![],'where':{}};var _0x1c23cb={};var _0x27e7c7={'count':0x0,'rows':[]};return db[_0x3495('0x40')]['findOne']({'where':{'id':_0x8f890[_0x3495('0x58')]['id']}})[_0x3495('0x23')](handleEntityNotFound(_0x3b22bf,null))['then'](function(_0x21050d){if(_0x21050d){_0x1c23cb[_0x3495('0x47')]=_[_0x3495('0x44')](db[_0x3495('0x93')][_0x3495('0x6a')]);_0x1c23cb[_0x3495('0x43')]=_[_0x3495('0x44')](_0x8f890[_0x3495('0x43')]);_0x1c23cb[_0x3495('0x45')]=_[_0x3495('0x46')](_0x1c23cb[_0x3495('0x47')],_0x1c23cb[_0x3495('0x43')]);_0x1939f0[_0x3495('0x48')]=_['intersection'](_0x1c23cb[_0x3495('0x47')],qs[_0x3495('0x49')](_0x8f890[_0x3495('0x43')][_0x3495('0x49')]));_0x1939f0[_0x3495('0x48')]=_0x1939f0['attributes'][_0x3495('0x59')]?_0x1939f0[_0x3495('0x48')]:_0x1c23cb['model'];if(!_0x8f890['query'][_0x3495('0x6b')](_0x3495('0x4a'))){_0x1939f0[_0x3495('0x4b')]=qs[_0x3495('0x4b')](_0x8f890[_0x3495('0x43')][_0x3495('0x4b')]);_0x1939f0[_0x3495('0x33')]=qs[_0x3495('0x33')](_0x8f890[_0x3495('0x43')][_0x3495('0x33')]);}_0x1939f0['order']=qs[_0x3495('0x4d')](_0x8f890[_0x3495('0x43')][_0x3495('0x4d')]);_0x1939f0['where']=qs['filters'](_['pick'](_0x8f890[_0x3495('0x43')],_0x1c23cb[_0x3495('0x45')]));_0x1939f0[_0x3495('0x4e')][_0x3495('0x66')]=_0x21050d['id'];if(_0x8f890[_0x3495('0x43')][_0x3495('0x4f')]){_0x1939f0[_0x3495('0x4e')]=_[_0x3495('0x50')](_0x1939f0[_0x3495('0x4e')],{'$or':_[_0x3495('0x3f')](_0x1939f0[_0x3495('0x48')],function(_0x1b8e57){var _0x5c9998={};_0x5c9998[_0x1b8e57]={'$like':'%'+_0x8f890[_0x3495('0x43')]['filter']+'%'};return _0x5c9998;})});}_0x1939f0=_[_0x3495('0x50')]({},_0x1939f0,_0x8f890[_0x3495('0x53')]);return db[_0x3495('0x93')][_0x3495('0x32')]({'where':_0x1939f0[_0x3495('0x4e')]})['then'](function(_0x2f3b58){_0x27e7c7[_0x3495('0x32')]=_0x2f3b58;if(_0x8f890['query']['includeAll']){_0x1939f0[_0x3495('0x5a')]=[{'model':db['CmContact'],'as':_0x3495('0xb0'),'required':![]},{'model':db[_0x3495('0x9e')],'as':_0x3495('0xb1'),'attributes':['name','fullname',_0x3495('0xb2')],'required':![]},{'model':db['Tag'],'as':_0x3495('0xb3'),'attributes':['id',_0x3495('0x42'),'color'],'where':_0x8f890[_0x3495('0x43')][_0x3495('0xb4')]?{'id':_0x8f890[_0x3495('0x43')][_0x3495('0xb4')]}:undefined,'required':_0x8f890['query'][_0x3495('0xb4')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x1939f0);})[_0x3495('0x23')](function(_0x59ac75){_0x27e7c7[_0x3495('0x56')]=_0x59ac75;return _0x27e7c7;});}})[_0x3495('0x23')](respondWithFilteredResult(_0x3b22bf,_0x1939f0))[_0x3495('0x2c')](handleError(_0x3b22bf,null));};exports['addAgents']=function(_0x43ac55,_0x405b62,_0x41cae4){return db['OpenchannelAccount'][_0x3495('0x5b')]({'where':{'id':_0x43ac55['params']['id']}})[_0x3495('0x23')](handleEntityNotFound(_0x405b62,null))[_0x3495('0x23')](function(_0xb717bd){if(_0xb717bd){return _0xb717bd['addAgents'](_0x43ac55[_0x3495('0x5d')]['ids'],_[_0x3495('0xb5')](_0x43ac55['body'],['ids','id'])||{})[_0x3495('0x95')](function(_0x5ec383){for(var _0x46f271=0x0;_0x46f271<_0x43ac55[_0x3495('0x5d')][_0x3495('0x6e')][_0x3495('0x59')];_0x46f271+=0x1){socket['emit'](_0x3495('0xb6'),{'UserId':Number(_0x43ac55[_0x3495('0x5d')]['ids'][_0x46f271]),'OpenchannelAccountId':Number(_0x43ac55[_0x3495('0x58')]['id'])});}return _0x5ec383;});}})[_0x3495('0x23')](respondWithResult(_0x405b62,null))['catch'](handleError(_0x405b62,null));};exports[_0x3495('0xb7')]=function(_0x14cc4a,_0x1d8352,_0x4a2292){return db['OpenchannelAccount'][_0x3495('0x5b')]({'where':{'id':_0x14cc4a[_0x3495('0x58')]['id']}})[_0x3495('0x23')](handleEntityNotFound(_0x1d8352,null))['then'](function(_0x8dd675){if(_0x8dd675){return _0x8dd675[_0x3495('0xb7')](_0x14cc4a['query'][_0x3495('0x6e')])[_0x3495('0x23')](function(){if(_[_0x3495('0xb8')](_0x14cc4a[_0x3495('0x43')][_0x3495('0x6e')])){for(var _0x18c050=0x0;_0x18c050<_0x14cc4a[_0x3495('0x43')][_0x3495('0x6e')]['length'];_0x18c050+=0x1){socket[_0x3495('0xb9')](_0x3495('0xba'),{'UserId':Number(_0x14cc4a[_0x3495('0x43')][_0x3495('0x6e')][_0x18c050]),'OpenchannelAccountId':Number(_0x14cc4a['params']['id'])});}}else{socket[_0x3495('0xb9')](_0x3495('0xba'),{'UserId':Number(_0x14cc4a[_0x3495('0x43')][_0x3495('0x6e')]),'OpenchannelAccountId':Number(_0x14cc4a['params']['id'])});}});}})[_0x3495('0x23')](respondWithStatusCode(_0x1d8352,null))['catch'](handleError(_0x1d8352,null));};exports['getAgents']=function(_0x3aef4f,_0x477752,_0x147060){var _0x4fb243={};var _0x1372b9={};var _0x1e359b;var _0x2409fa;return db[_0x3495('0x40')]['findOne']({'where':{'id':_0x3aef4f[_0x3495('0x58')]['id']}})[_0x3495('0x23')](handleEntityNotFound(_0x477752,null))['then'](function(_0x58c19b){if(_0x58c19b){_0x1e359b=_0x58c19b;_0x1372b9[_0x3495('0x47')]=_['keys'](db[_0x3495('0x9e')][_0x3495('0x6a')]);_0x1372b9['query']=_[_0x3495('0x44')](_0x3aef4f[_0x3495('0x43')]);_0x1372b9[_0x3495('0x45')]=_[_0x3495('0x46')](_0x1372b9['model'],_0x1372b9[_0x3495('0x43')]);_0x4fb243[_0x3495('0x48')]=_['intersection'](_0x1372b9[_0x3495('0x47')],qs['fields'](_0x3aef4f['query'][_0x3495('0x49')]));_0x4fb243[_0x3495('0x48')]=_0x4fb243[_0x3495('0x48')][_0x3495('0x59')]?_0x4fb243[_0x3495('0x48')]:_0x1372b9[_0x3495('0x47')];_0x4fb243[_0x3495('0x4c')]=qs[_0x3495('0x4d')](_0x3aef4f['query'][_0x3495('0x4d')]);_0x4fb243[_0x3495('0x4e')]=qs[_0x3495('0x45')](_[_0x3495('0x6c')](_0x3aef4f['query'],_0x1372b9['filters']));if(_0x3aef4f['query'][_0x3495('0x4f')]){_0x4fb243[_0x3495('0x4e')]=_[_0x3495('0x50')](_0x4fb243[_0x3495('0x4e')],{'$or':_[_0x3495('0x3f')](_0x4fb243[_0x3495('0x48')],function(_0x23497f){var _0x51dea2={};_0x51dea2[_0x23497f]={'$like':'%'+_0x3aef4f[_0x3495('0x43')][_0x3495('0x4f')]+'%'};return _0x51dea2;})});}_0x4fb243=_[_0x3495('0x50')]({},_0x4fb243,_0x3aef4f[_0x3495('0x53')]);return _0x1e359b['getAgents'](_0x4fb243);}})[_0x3495('0x23')](function(_0x5adbb3){if(_0x5adbb3){_0x2409fa=_0x5adbb3[_0x3495('0x59')];if(!_0x3aef4f['query'][_0x3495('0x6b')](_0x3495('0x4a'))){_0x4fb243[_0x3495('0x4b')]=qs[_0x3495('0x4b')](_0x3aef4f[_0x3495('0x43')][_0x3495('0x4b')]);_0x4fb243[_0x3495('0x33')]=qs[_0x3495('0x33')](_0x3aef4f[_0x3495('0x43')][_0x3495('0x33')]);}return _0x1e359b[_0x3495('0xbb')](_0x4fb243);}})[_0x3495('0x23')](function(_0x582616){if(_0x582616){return _0x582616?{'count':_0x2409fa,'rows':_0x582616}:null;}})[_0x3495('0x23')](respondWithResult(_0x477752,null))[_0x3495('0x2c')](handleError(_0x477752,null));};exports[_0x3495('0xad')]=function(_0x5b7332,_0x1c5c8b,_0x5e4125){var _0x3ab4ef,_0x14d6a9,_0x407059;if(_[_0x3495('0x7c')](_0x5b7332[_0x3495('0x5d')][_0x3495('0x5d')])||_0x5b7332[_0x3495('0x5d')][_0x3495('0x5d')]===''){throw new db[(_0x3495('0x7e'))][(_0x3495('0x7f'))](_0x3495('0x81'));}if(_['isNil'](_0x5b7332[_0x3495('0x5d')]['to'])){}_0x3ab4ef=_0x5b7332[_0x3495('0x5d')]['to'];return db[_0x3495('0x40')]['findOne']({'where':{'id':_0x5b7332['params']['id']}})['then'](handleEntityNotFound(_0x1c5c8b,null))[_0x3495('0x23')](function(_0x43bc1a){if(_0x43bc1a){return db[_0x3495('0x40')][_0x3495('0x5b')]({'where':{'id':_0x43bc1a['id']},'include':[{'model':db[_0x3495('0x84')],'as':_0x3495('0x85'),'include':[{'model':db[_0x3495('0x75')],'as':'Contacts','where':{[_0x43bc1a['mapKey']]:_0x3ab4ef},'limit':0x1,'order':[[_0x3495('0x79'),'DESC']]}]}]})[_0x3495('0x23')](handleEntityNotFound(_0x1c5c8b,null))[_0x3495('0x23')](function(_0x3fb6f1){if(_0x3fb6f1&&_0x3fb6f1[_0x3495('0x85')]){_0x14d6a9=_0x3fb6f1['get']({'plain':!![]});if(_0x14d6a9[_0x3495('0x85')]&&_0x14d6a9[_0x3495('0x85')][_0x3495('0x86')]['length']){return _0x14d6a9[_0x3495('0x85')][_0x3495('0x86')][0x0];}return db[_0x3495('0x75')][_0x3495('0x5c')](_[_0x3495('0x1b')](_0x5b7332[_0x3495('0x5d')],{'firstName':_0x3ab4ef,[_0x3fb6f1[_0x3495('0x82')]]:_0x3ab4ef,'phone':_0x3ab4ef,'ListId':_0x14d6a9[_0x3495('0x7b')]}));}})[_0x3495('0x23')](handleEntityNotFound(_0x1c5c8b,null))[_0x3495('0x23')](function(_0x49b890){if(_0x49b890){_0x407059=_0x49b890;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x407059['id'],'closed':![],'OpenchannelAccountId':_0x14d6a9['id']}})[_0x3495('0x23')](function(_0x16f718){if(_0x16f718){return[_0x16f718,![]];}return db[_0x3495('0x93')]['create']({'UserId':_0x5b7332[_0x3495('0x5f')]['id'],'ContactId':_0x407059['id'],'OpenchannelAccountId':_0x14d6a9['id'],'lastMsgDirection':_0x3495('0xbc'),'firstMsgDirection':'out','Messages':[_[_0x3495('0x50')](_0x5b7332[_0x3495('0x5d')],{'read':![],'body':_0x5b7332['body']['body'],'OpenchannelAccountId':_0x14d6a9['id'],'UserId':_0x5b7332['user']['id'],'ContactId':_0x407059['id']})]},{'include':[{'model':db[_0x3495('0x9b')],'as':_0x3495('0xbd')}]})[_0x3495('0x23')](function(_0x13c0c4){return[_0x13c0c4,!![]];});});}})[_0x3495('0x95')](function(_0x14886c,_0x2fd79c){if(_0x2fd79c){return _0x14886c;}return db[_0x3495('0x9b')][_0x3495('0x5c')](_[_0x3495('0x50')](_0x5b7332[_0x3495('0x5d')],{'read':![],'body':_0x5b7332['body'][_0x3495('0x5d')],'OpenchannelAccountId':_0x14d6a9['id'],'OpenchannelInteractionId':_0x14886c['id'],'UserId':_0x5b7332[_0x3495('0x5f')]['id'],'ContactId':_0x407059['id']}))['then'](function(_0x408235){_0x14886c[_0x3495('0xbe')]['Messages']=[];_0x14886c[_0x3495('0xbe')][_0x3495('0xbd')][_0x3495('0xbf')](_0x408235['dataValues']);return _0x14886c;});});}})['then'](respondWithResult(_0x1c5c8b,null))[_0x3495('0x2c')](handleError(_0x1c5c8b,null));}; \ No newline at end of file +var _0xd2ea=['redis','socket.io-emitter','client','http','request','then','info','request\x20sent','debug','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','status','json','offset','limit','undefined','count','set','apply','save','update','destroy','OpenchannelAccounts','end','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','params','OpenchannelAccountId','getDispositions','findOne','Disposition','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','defaults','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Owner','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x3264fa,_0x259a95){var _0x32e57f=function(_0x8dd3d8){while(--_0x8dd3d8){_0x3264fa['push'](_0x3264fa['shift']());}};_0x32e57f(++_0x259a95);}(_0xd2ea,0x15f));var _0xad2e=function(_0x2b6f64,_0xfdce45){_0x2b6f64=_0x2b6f64-0x0;var _0x5ece01=_0xd2ea[_0x2b6f64];return _0x5ece01;};'use strict';var emlformat=require(_0xad2e('0x0'));var rimraf=require(_0xad2e('0x1'));var zipdir=require(_0xad2e('0x2'));var jsonpatch=require(_0xad2e('0x3'));var rp=require(_0xad2e('0x4'));var moment=require('moment');var BPromise=require(_0xad2e('0x5'));var Mustache=require(_0xad2e('0x6'));var util=require(_0xad2e('0x7'));var path=require(_0xad2e('0x8'));var sox=require(_0xad2e('0x9'));var csv=require(_0xad2e('0xa'));var ejs=require(_0xad2e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xad2e('0xc'));var squel=require(_0xad2e('0xd'));var crypto=require(_0xad2e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xad2e('0xf'));var toCsv=require(_0xad2e('0xa'));var querystring=require('querystring');var Papa=require(_0xad2e('0x10'));var Redis=require('ioredis');var authService=require(_0xad2e('0x11'));var qs=require(_0xad2e('0x12'));var as=require(_0xad2e('0x13'));var hardwareService=require(_0xad2e('0x14'));var logger=require('../../config/logger')(_0xad2e('0x15'));var utils=require('../../config/utils');var config=require(_0xad2e('0x16'));var licenseUtil=require(_0xad2e('0x17'));var db=require(_0xad2e('0x18'))['db'];config[_0xad2e('0x19')]=_['defaults'](config[_0xad2e('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xad2e('0x1a'))(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xad2e('0x1b')][_0xad2e('0x1c')]({'port':0x232c});var client9002=jayson[_0xad2e('0x1b')][_0xad2e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x17e6ac,_0x4180aa,_0x2546e2,_0x5941c5){return new BPromise(function(_0xd40b31,_0xbc6df0){var _0x2af208=_0x5941c5||client;return _0x2af208[_0xad2e('0x1d')](_0x17e6ac,_0x2546e2)[_0xad2e('0x1e')](function(_0x1b4889){logger[_0xad2e('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0x4180aa,_0xad2e('0x20'));logger[_0xad2e('0x21')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x4180aa,'request\x20sent',JSON['stringify'](_0x1b4889));if(_0x1b4889['error']){if(_0x1b4889[_0xad2e('0x22')][_0xad2e('0x23')]===0x1f4){logger[_0xad2e('0x22')](_0xad2e('0x24'),_0x4180aa,_0x1b4889[_0xad2e('0x22')][_0xad2e('0x25')]);return _0xbc6df0(_0x1b4889[_0xad2e('0x22')][_0xad2e('0x25')]);}logger[_0xad2e('0x22')](_0xad2e('0x24'),_0x4180aa,_0x1b4889[_0xad2e('0x22')][_0xad2e('0x25')]);return _0xd40b31(_0x1b4889[_0xad2e('0x22')][_0xad2e('0x25')]);}else{logger[_0xad2e('0x1f')](_0xad2e('0x24'),_0x4180aa,'request\x20sent');_0xd40b31(_0x1b4889[_0xad2e('0x26')][_0xad2e('0x25')]);}})[_0xad2e('0x27')](function(_0x350c66){logger[_0xad2e('0x22')](_0xad2e('0x24'),_0x4180aa,_0x350c66);_0xbc6df0(_0x350c66);});});}function respondWithStatusCode(_0x1161d5,_0x175055){_0x175055=_0x175055||0xcc;return function(_0xfd90a4){if(_0xfd90a4){return _0x1161d5['sendStatus'](_0x175055);}return _0x1161d5[_0xad2e('0x28')](_0x175055)['end']();};}function respondWithResult(_0x2b2bc2,_0x28ef72){_0x28ef72=_0x28ef72||0xc8;return function(_0x22bc9b){if(_0x22bc9b){return _0x2b2bc2[_0xad2e('0x28')](_0x28ef72)[_0xad2e('0x29')](_0x22bc9b);}};}function respondWithFilteredResult(_0x1676e5,_0xb3171a){return function(_0x454c04){if(_0x454c04){var _0x52fdda=typeof _0xb3171a[_0xad2e('0x2a')]==='undefined'&&typeof _0xb3171a[_0xad2e('0x2b')]===_0xad2e('0x2c');var _0x2a0dc7=_0x454c04[_0xad2e('0x2d')];var _0x42fe6c=_0x52fdda?0x0:_0xb3171a[_0xad2e('0x2a')];var _0x409f58=_0x52fdda?_0x454c04[_0xad2e('0x2d')]:_0xb3171a[_0xad2e('0x2a')]+_0xb3171a[_0xad2e('0x2b')];var _0xcc4c66;if(_0x409f58>=_0x2a0dc7){_0x409f58=_0x2a0dc7;_0xcc4c66=0xc8;}else{_0xcc4c66=0xce;}_0x1676e5['status'](_0xcc4c66);return _0x1676e5[_0xad2e('0x2e')]('Content-Range',_0x42fe6c+'-'+_0x409f58+'/'+_0x2a0dc7)[_0xad2e('0x29')](_0x454c04);}return null;};}function patchUpdates(_0x3a6419){return function(_0x5ac436){try{jsonpatch[_0xad2e('0x2f')](_0x5ac436,_0x3a6419,!![]);}catch(_0x26b4c5){return BPromise['reject'](_0x26b4c5);}return _0x5ac436[_0xad2e('0x30')]();};}function saveUpdates(_0x27fdf0,_0x54b4d3){return function(_0x2d6b35){if(_0x2d6b35){return _0x2d6b35[_0xad2e('0x31')](_0x27fdf0)['then'](function(_0x38e7e2){return _0x38e7e2;});}return null;};}function removeEntity(_0x19fd12,_0x3efac5){return function(_0x3de92c){if(_0x3de92c){return _0x3de92c[_0xad2e('0x32')]()[_0xad2e('0x1e')](function(){var _0x2c480c=_0x3de92c['get']({'plain':!![]});var _0x41a022=_0xad2e('0x33');return db['UserProfileResource'][_0xad2e('0x32')]({'where':{'type':_0x41a022,'resourceId':_0x2c480c['id']}})[_0xad2e('0x1e')](function(){return _0x3de92c;});})[_0xad2e('0x1e')](function(){_0x19fd12[_0xad2e('0x28')](0xcc)[_0xad2e('0x34')]();});}};}function handleEntityNotFound(_0xf4ae70,_0x4fe4f6){return function(_0x5d6ac1){if(!_0x5d6ac1){_0xf4ae70[_0xad2e('0x35')](0x194);}return _0x5d6ac1;};}function handleError(_0x4b53d6,_0x1bf1da){_0x1bf1da=_0x1bf1da||0x1f4;return function(_0x33c2a8){logger[_0xad2e('0x22')](_0x33c2a8[_0xad2e('0x36')]);if(_0x33c2a8[_0xad2e('0x37')]){delete _0x33c2a8['name'];}_0x4b53d6[_0xad2e('0x28')](_0x1bf1da)[_0xad2e('0x38')](_0x33c2a8);};}exports['index']=function(_0x596eee,_0x5ba338){var _0x274fd8={'include':[{'model':db[_0xad2e('0x39')],'as':_0xad2e('0x3a')}]},_0x54dac3={},_0x5f29a5={'count':0x0,'rows':[]};var _0x271a49=_[_0xad2e('0x3b')](db[_0xad2e('0x3c')][_0xad2e('0x3d')],function(_0x382665){return{'name':_0x382665['fieldName'],'type':_0x382665[_0xad2e('0x3e')][_0xad2e('0x3f')]};});_0x54dac3[_0xad2e('0x40')]=_[_0xad2e('0x3b')](_0x271a49,_0xad2e('0x37'));_0x54dac3['query']=_[_0xad2e('0x41')](_0x596eee['query']);_0x54dac3[_0xad2e('0x42')]=_[_0xad2e('0x43')](_0x54dac3[_0xad2e('0x40')],_0x54dac3[_0xad2e('0x44')]);_0x274fd8[_0xad2e('0x45')]=_[_0xad2e('0x43')](_0x54dac3[_0xad2e('0x40')],qs[_0xad2e('0x46')](_0x596eee[_0xad2e('0x44')][_0xad2e('0x46')]));_0x274fd8[_0xad2e('0x45')]=_0x274fd8[_0xad2e('0x45')][_0xad2e('0x47')]?_0x274fd8[_0xad2e('0x45')]:_0x54dac3[_0xad2e('0x40')];if(!_0x596eee[_0xad2e('0x44')][_0xad2e('0x48')](_0xad2e('0x49'))){_0x274fd8[_0xad2e('0x2b')]=qs[_0xad2e('0x2b')](_0x596eee['query'][_0xad2e('0x2b')]);_0x274fd8[_0xad2e('0x2a')]=qs[_0xad2e('0x2a')](_0x596eee[_0xad2e('0x44')][_0xad2e('0x2a')]);}_0x274fd8[_0xad2e('0x4a')]=qs[_0xad2e('0x4b')](_0x596eee['query'][_0xad2e('0x4b')]);_0x274fd8['where']=qs[_0xad2e('0x42')](_[_0xad2e('0x4c')](_0x596eee[_0xad2e('0x44')],_0x54dac3[_0xad2e('0x42')]),_0x271a49);if(_0x596eee[_0xad2e('0x44')]['filter']){_0x274fd8[_0xad2e('0x4d')]=_[_0xad2e('0x4e')](_0x274fd8[_0xad2e('0x4d')],{'$or':_[_0xad2e('0x3b')](_0x271a49,function(_0x3236f1){if(_0x3236f1['type']!==_0xad2e('0x4f')){var _0x120069={};_0x120069[_0x3236f1[_0xad2e('0x37')]]={'$like':'%'+_0x596eee[_0xad2e('0x44')]['filter']+'%'};return _0x120069;}})});}_0x274fd8=_['merge']({},_0x274fd8,_0x596eee[_0xad2e('0x50')]);var _0x343e4f={'where':_0x274fd8['where']};return db['OpenchannelAccount'][_0xad2e('0x2d')](_0x343e4f)['then'](function(_0x37db2d){_0x5f29a5[_0xad2e('0x2d')]=_0x37db2d;if(_0x596eee['query'][_0xad2e('0x51')]){_0x274fd8[_0xad2e('0x52')]=[{'all':!![]}];}return db[_0xad2e('0x3c')][_0xad2e('0x53')](_0x274fd8);})['then'](function(_0x527c93){_0x5f29a5[_0xad2e('0x54')]=_0x527c93;return _0x5f29a5;})[_0xad2e('0x1e')](respondWithFilteredResult(_0x5ba338,_0x274fd8))[_0xad2e('0x27')](handleError(_0x5ba338,null));};exports[_0xad2e('0x55')]=function(_0x296b67,_0x2300e6){var _0x18f036={'raw':![],'where':{'id':_0x296b67['params']['id']},'include':[{'model':db[_0xad2e('0x39')],'as':'mandatoryDispositionPause'}]},_0x3e90d0={};_0x3e90d0[_0xad2e('0x40')]=_[_0xad2e('0x41')](db[_0xad2e('0x3c')][_0xad2e('0x3d')]);_0x3e90d0[_0xad2e('0x44')]=_[_0xad2e('0x41')](_0x296b67[_0xad2e('0x44')]);_0x3e90d0['filters']=_[_0xad2e('0x43')](_0x3e90d0['model'],_0x3e90d0[_0xad2e('0x44')]);_0x18f036[_0xad2e('0x45')]=_[_0xad2e('0x43')](_0x3e90d0[_0xad2e('0x40')],qs['fields'](_0x296b67[_0xad2e('0x44')][_0xad2e('0x46')]));_0x18f036['attributes']=_0x18f036[_0xad2e('0x45')]['length']?_0x18f036[_0xad2e('0x45')]:_0x3e90d0[_0xad2e('0x40')];if(_0x296b67[_0xad2e('0x44')][_0xad2e('0x51')]){_0x18f036[_0xad2e('0x52')]=[{'all':!![]}];}_0x18f036=_[_0xad2e('0x4e')]({},_0x18f036,_0x296b67[_0xad2e('0x50')]);return db[_0xad2e('0x3c')][_0xad2e('0x56')](_0x18f036)['then'](handleEntityNotFound(_0x2300e6,null))[_0xad2e('0x1e')](respondWithResult(_0x2300e6,null))[_0xad2e('0x27')](handleError(_0x2300e6,null));};exports[_0xad2e('0x57')]=function(_0x243add,_0x519971){return db['OpenchannelAccount'][_0xad2e('0x57')](_0x243add[_0xad2e('0x58')],{})[_0xad2e('0x1e')](function(_0xd3b75e){var _0x450803=_0x243add[_0xad2e('0x59')]['get']({'plain':!![]});if(!_0x450803)throw new Error(_0xad2e('0x5a'));if(_0x450803[_0xad2e('0x5b')]==='user'){var _0x45f3e7=_0xd3b75e[_0xad2e('0x5c')]({'plain':!![]});var _0x1a8346=_0xad2e('0x33');return db[_0xad2e('0x5d')][_0xad2e('0x56')]({'where':{'name':_0x1a8346,'userProfileId':_0x450803[_0xad2e('0x5e')]},'raw':!![]})[_0xad2e('0x1e')](function(_0x745c47){if(_0x745c47&&_0x745c47[_0xad2e('0x5f')]===0x0){return db['UserProfileResource']['create']({'name':_0x45f3e7[_0xad2e('0x37')],'resourceId':_0x45f3e7['id'],'type':_0x745c47['name'],'sectionId':_0x745c47['id']},{})['then'](function(){return _0xd3b75e;});}else{return _0xd3b75e;}})[_0xad2e('0x27')](function(_0x3c3f96){logger[_0xad2e('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c3f96);throw _0x3c3f96;});}return _0xd3b75e;})[_0xad2e('0x1e')](respondWithResult(_0x519971,0xc9))[_0xad2e('0x27')](handleError(_0x519971,null));};exports[_0xad2e('0x31')]=function(_0x470bda,_0x1cc9ce){if(_0x470bda['body']['id']){delete _0x470bda[_0xad2e('0x58')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x470bda['params']['id']},'include':[{'model':db['Pause'],'as':_0xad2e('0x3a')}]})[_0xad2e('0x1e')](handleEntityNotFound(_0x1cc9ce,null))[_0xad2e('0x1e')](saveUpdates(_0x470bda[_0xad2e('0x58')],null))[_0xad2e('0x1e')](respondWithResult(_0x1cc9ce,null))[_0xad2e('0x27')](handleError(_0x1cc9ce,null));};exports[_0xad2e('0x32')]=function(_0x322b8d,_0x1a7d47){return db[_0xad2e('0x3c')][_0xad2e('0x56')]({'where':{'id':_0x322b8d['params']['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x1a7d47,null))[_0xad2e('0x1e')](removeEntity(_0x1a7d47,null))['catch'](handleError(_0x1a7d47,null));};exports['describe']=function(_0x1010fd,_0x49a7d9){return db[_0xad2e('0x3c')][_0xad2e('0x60')]()[_0xad2e('0x1e')](respondWithResult(_0x49a7d9,null))[_0xad2e('0x27')](handleError(_0x49a7d9,null));};exports[_0xad2e('0x61')]=function(_0x401417,_0x10d465,_0x21bd0d){if(_0x401417['body']['id']){delete _0x401417[_0xad2e('0x58')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x401417[_0xad2e('0x62')]['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x10d465,null))['then'](function(_0x33846a){if(_0x33846a){_0x401417[_0xad2e('0x58')][_0xad2e('0x63')]=_0x33846a['id'];return db['Disposition'][_0xad2e('0x57')](_0x401417['body']);}})[_0xad2e('0x1e')](respondWithResult(_0x10d465,null))['catch'](handleError(_0x10d465,null));};exports[_0xad2e('0x64')]=function(_0x45cff3,_0x38b136,_0x19f896){var _0x3adb7f={'raw':![],'where':{}};var _0x18a7d6={};var _0x59981c={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xad2e('0x65')]({'where':{'id':_0x45cff3[_0xad2e('0x62')]['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x38b136,null))[_0xad2e('0x1e')](function(_0x57e1a9){if(_0x57e1a9){_0x18a7d6[_0xad2e('0x40')]=_[_0xad2e('0x41')](db[_0xad2e('0x66')][_0xad2e('0x3d')]);_0x18a7d6[_0xad2e('0x44')]=_[_0xad2e('0x41')](_0x45cff3[_0xad2e('0x44')]);_0x18a7d6[_0xad2e('0x42')]=_[_0xad2e('0x43')](_0x18a7d6['model'],_0x18a7d6[_0xad2e('0x44')]);_0x3adb7f[_0xad2e('0x45')]=_[_0xad2e('0x43')](_0x18a7d6['model'],qs[_0xad2e('0x46')](_0x45cff3[_0xad2e('0x44')][_0xad2e('0x46')]));_0x3adb7f[_0xad2e('0x45')]=_0x3adb7f[_0xad2e('0x45')][_0xad2e('0x47')]?_0x3adb7f['attributes']:_0x18a7d6['model'];if(!_0x45cff3['query']['hasOwnProperty'](_0xad2e('0x49'))){_0x3adb7f[_0xad2e('0x2b')]=qs['limit'](_0x45cff3[_0xad2e('0x44')][_0xad2e('0x2b')]);_0x3adb7f[_0xad2e('0x2a')]=qs[_0xad2e('0x2a')](_0x45cff3[_0xad2e('0x44')][_0xad2e('0x2a')]);}_0x3adb7f[_0xad2e('0x4a')]=qs[_0xad2e('0x4b')](_0x45cff3['query']['sort']);_0x3adb7f['where']=qs['filters'](_['pick'](_0x45cff3[_0xad2e('0x44')],_0x18a7d6['filters']));_0x3adb7f[_0xad2e('0x4d')][_0xad2e('0x63')]=_0x57e1a9['id'];if(_0x45cff3[_0xad2e('0x44')]['filter']){_0x3adb7f['where']=_[_0xad2e('0x4e')](_0x3adb7f['where'],{'$or':_['map'](_0x3adb7f[_0xad2e('0x45')],function(_0xc1ef25){var _0x35fce1={};_0x35fce1[_0xc1ef25]={'$like':'%'+_0x45cff3[_0xad2e('0x44')][_0xad2e('0x67')]+'%'};return _0x35fce1;})});}_0x3adb7f=_[_0xad2e('0x4e')]({},_0x3adb7f,_0x45cff3[_0xad2e('0x50')]);return db[_0xad2e('0x66')][_0xad2e('0x2d')]({'where':_0x3adb7f[_0xad2e('0x4d')]})['then'](function(_0x4b582d){_0x59981c[_0xad2e('0x2d')]=_0x4b582d;if(_0x45cff3[_0xad2e('0x44')]['includeAll']){_0x3adb7f[_0xad2e('0x52')]=[{'all':!![]}];}return db[_0xad2e('0x66')]['findAll'](_0x3adb7f);})['then'](function(_0x2f65a2){_0x59981c[_0xad2e('0x54')]=_0x2f65a2;return _0x59981c;});}})[_0xad2e('0x1e')](respondWithFilteredResult(_0x38b136,_0x3adb7f))[_0xad2e('0x27')](handleError(_0x38b136,null));};exports[_0xad2e('0x68')]=function(_0x5ac3bb,_0x36b3f6,_0x5e2007){return db[_0xad2e('0x3c')][_0xad2e('0x56')]({'where':{'id':_0x5ac3bb['params']['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x36b3f6,null))[_0xad2e('0x1e')](function(_0x28a588){if(_0x28a588){return _0x28a588['removeDispositions'](_0x5ac3bb[_0xad2e('0x44')][_0xad2e('0x69')]);}})[_0xad2e('0x1e')](respondWithStatusCode(_0x36b3f6,null))[_0xad2e('0x27')](handleError(_0x36b3f6,null));};exports[_0xad2e('0x6a')]=function(_0x5b0f77,_0x2ea2d8,_0x584c8c){if(_0x5b0f77[_0xad2e('0x58')]['id']){delete _0x5b0f77[_0xad2e('0x58')]['id'];}return db[_0xad2e('0x3c')][_0xad2e('0x56')]({'where':{'id':_0x5b0f77[_0xad2e('0x62')]['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x2ea2d8,null))[_0xad2e('0x1e')](function(_0xd342e4){if(_0xd342e4){_0x5b0f77[_0xad2e('0x58')][_0xad2e('0x63')]=_0xd342e4['id'];return db[_0xad2e('0x6b')][_0xad2e('0x57')](_0x5b0f77[_0xad2e('0x58')]);}})[_0xad2e('0x1e')](respondWithResult(_0x2ea2d8,null))[_0xad2e('0x27')](handleError(_0x2ea2d8,null));};exports[_0xad2e('0x6c')]=function(_0x1cc308,_0x54e8ac,_0x34dd8e){var _0x475d6c={'raw':![],'where':{}};var _0x1bdd1f={};var _0x1fa253={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xad2e('0x65')]({'where':{'id':_0x1cc308[_0xad2e('0x62')]['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x54e8ac,null))['then'](function(_0x1c49e6){if(_0x1c49e6){_0x1bdd1f[_0xad2e('0x40')]=_[_0xad2e('0x41')](db[_0xad2e('0x6b')]['rawAttributes']);_0x1bdd1f[_0xad2e('0x44')]=_[_0xad2e('0x41')](_0x1cc308[_0xad2e('0x44')]);_0x1bdd1f[_0xad2e('0x42')]=_[_0xad2e('0x43')](_0x1bdd1f[_0xad2e('0x40')],_0x1bdd1f[_0xad2e('0x44')]);_0x475d6c[_0xad2e('0x45')]=_['intersection'](_0x1bdd1f[_0xad2e('0x40')],qs['fields'](_0x1cc308['query'][_0xad2e('0x46')]));_0x475d6c[_0xad2e('0x45')]=_0x475d6c[_0xad2e('0x45')][_0xad2e('0x47')]?_0x475d6c[_0xad2e('0x45')]:_0x1bdd1f[_0xad2e('0x40')];if(!_0x1cc308[_0xad2e('0x44')][_0xad2e('0x48')](_0xad2e('0x49'))){_0x475d6c[_0xad2e('0x2b')]=qs[_0xad2e('0x2b')](_0x1cc308[_0xad2e('0x44')]['limit']);_0x475d6c[_0xad2e('0x2a')]=qs[_0xad2e('0x2a')](_0x1cc308[_0xad2e('0x44')][_0xad2e('0x2a')]);}_0x475d6c[_0xad2e('0x4a')]=qs[_0xad2e('0x4b')](_0x1cc308[_0xad2e('0x44')][_0xad2e('0x4b')]);_0x475d6c[_0xad2e('0x4d')]=qs[_0xad2e('0x42')](_['pick'](_0x1cc308[_0xad2e('0x44')],_0x1bdd1f[_0xad2e('0x42')]));_0x475d6c[_0xad2e('0x4d')][_0xad2e('0x63')]=_0x1c49e6['id'];if(_0x1cc308['query'][_0xad2e('0x67')]){_0x475d6c['where']=_[_0xad2e('0x4e')](_0x475d6c[_0xad2e('0x4d')],{'$or':_[_0xad2e('0x3b')](_0x475d6c[_0xad2e('0x45')],function(_0x16ebe6){var _0x126f34={};_0x126f34[_0x16ebe6]={'$like':'%'+_0x1cc308[_0xad2e('0x44')]['filter']+'%'};return _0x126f34;})});}_0x475d6c=_[_0xad2e('0x4e')]({},_0x475d6c,_0x1cc308[_0xad2e('0x50')]);return db['CannedAnswer']['count']({'where':_0x475d6c[_0xad2e('0x4d')]})['then'](function(_0x42909c){_0x1fa253[_0xad2e('0x2d')]=_0x42909c;if(_0x1cc308['query']['includeAll']){_0x475d6c[_0xad2e('0x52')]=[{'all':!![]}];}return db['CannedAnswer'][_0xad2e('0x53')](_0x475d6c);})[_0xad2e('0x1e')](function(_0x5ad612){_0x1fa253[_0xad2e('0x54')]=_0x5ad612;return _0x1fa253;});}})['then'](respondWithFilteredResult(_0x54e8ac,_0x475d6c))[_0xad2e('0x27')](handleError(_0x54e8ac,null));};exports[_0xad2e('0x6d')]=function(_0x5c81a3,_0x4ce1c8,_0x3cfd53){return db[_0xad2e('0x3c')]['find']({'where':{'id':_0x5c81a3[_0xad2e('0x62')]['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x4ce1c8,null))['then'](function(_0x3ffc2a){if(_0x3ffc2a){return _0x3ffc2a[_0xad2e('0x6d')](_0x5c81a3[_0xad2e('0x44')][_0xad2e('0x69')]);}})[_0xad2e('0x1e')](respondWithStatusCode(_0x4ce1c8,null))['catch'](handleError(_0x4ce1c8,null));};exports[_0xad2e('0x6e')]=function(_0x1fda13,_0x26519d,_0x88eb33){var _0x55caee={'body':_0x1fda13[_0xad2e('0x58')],'channel':'openchannel'};var _0x2eae58=[];var _0x5372fb=[];var _0x24fdd6={};var _0x3692ec=![];return db[_0xad2e('0x6f')][_0xad2e('0x60')]()['then'](function(_0xa9dcd5){if(!_0xa9dcd5){throw new db[(_0xad2e('0x70'))][(_0xad2e('0x71'))](_0xad2e('0x72'));}_0x2eae58=_['difference'](_[_0xad2e('0x41')](_0xa9dcd5),[_0xad2e('0x73'),_0xad2e('0x74')]);_0x5372fb=_['difference'](_[_0xad2e('0x41')](_0xa9dcd5),[_0xad2e('0x73'),_0xad2e('0x74'),'CompanyId',_0xad2e('0x75')]);if(_0x1fda13[_0xad2e('0x58')]['id']){delete _0x1fda13[_0xad2e('0x58')]['id'];}if(_[_0xad2e('0x76')](_0x1fda13[_0xad2e('0x58')][_0xad2e('0x77')])){throw new db['Sequelize']['ValidationError'](_0xad2e('0x78'));}if(_[_0xad2e('0x76')](_0x1fda13[_0xad2e('0x58')]['body'])||_0x1fda13[_0xad2e('0x58')][_0xad2e('0x58')]===''){throw new db[(_0xad2e('0x70'))][(_0xad2e('0x71'))](_0xad2e('0x79'));}if(_[_0xad2e('0x76')](_0x1fda13['body']['mapKey'])){throw new db[(_0xad2e('0x70'))][(_0xad2e('0x71'))](_0xad2e('0x7a')+_0x5372fb);}if(!_['includes'](_0x5372fb,_0x1fda13[_0xad2e('0x58')][_0xad2e('0x7b')])){throw new db[(_0xad2e('0x70'))]['ValidationError'](_0xad2e('0x7c')+_0x5372fb);}_0x24fdd6[_0x1fda13['body'][_0xad2e('0x7b')]]=_0x1fda13[_0xad2e('0x58')][_0xad2e('0x77')];})[_0xad2e('0x1e')](function(){return db[_0xad2e('0x3c')]['find']({'where':{'id':_0x1fda13['params']['id']},'include':[{'model':db['CmList'],'as':_0xad2e('0x7d'),'include':[{'model':db[_0xad2e('0x6f')],'as':_0xad2e('0x7e'),'where':_0x24fdd6,'limit':0x1,'order':[[_0xad2e('0x74'),'DESC']]}]},{'model':db[_0xad2e('0x7f')],'as':_0xad2e('0x80')}]});})[_0xad2e('0x1e')](handleEntityNotFound(_0x26519d,null))[_0xad2e('0x1e')](function(_0x8d5b1){if(_0x8d5b1&&_0x8d5b1['List']){_0x55caee[_0xad2e('0x81')]=_0x8d5b1;_0x55caee[_0xad2e('0x82')]=_0x8d5b1[_0xad2e('0x80')];_0x55caee[_0xad2e('0x83')]=_0x8d5b1[_0xad2e('0x7d')];_0x55caee[_0xad2e('0x82')]=_[_0xad2e('0x84')](_0x55caee[_0xad2e('0x82')],[_0xad2e('0x85')],[_0xad2e('0x86')]);if(_0x55caee[_0xad2e('0x81')][_0xad2e('0x80')]){delete _0x55caee[_0xad2e('0x81')][_0xad2e('0x80')];}if(_0x55caee[_0xad2e('0x81')][_0xad2e('0x7d')]&&_0x55caee['account'][_0xad2e('0x7d')][_0xad2e('0x7e')]['length']){return _0x55caee[_0xad2e('0x81')]['List'][_0xad2e('0x7e')][0x0];}var _0x3a6ec6=_[_0xad2e('0x87')](_0x1fda13['body'],{'firstName':_0x1fda13['body'][_0xad2e('0x77')],'ListId':_0x8d5b1['ListId']});_0x3a6ec6[_0x1fda13[_0xad2e('0x58')][_0xad2e('0x7b')]]=_0x1fda13['body'][_0xad2e('0x77')];return db[_0xad2e('0x6f')][_0xad2e('0x57')](_0x3a6ec6,{'fields':_0x2eae58,'raw':!![]});}})[_0xad2e('0x1e')](handleEntityNotFound(_0x26519d,null))['then'](function(_0x574f67){_0x55caee['contact']=_0x574f67;if(_0x574f67){var _0x843547={'ContactId':_0x574f67['id'],'OpenchannelAccountId':_0x1fda13[_0xad2e('0x62')]['id'],'from':(_0x574f67[_0xad2e('0x88')]||'')+'\x20'+(_0x574f67[_0xad2e('0x89')]||'')};var _0x3a70de={'OpenchannelAccountId':_0x1fda13[_0xad2e('0x62')]['id'],'closed':![]};if(_0x1fda13['body'][_0xad2e('0x8a')]){_0x3a70de['threadId']=_0x1fda13[_0xad2e('0x58')][_0xad2e('0x8a')];return db[_0xad2e('0x8b')][_0xad2e('0x56')]({'where':_0x3a70de})[_0xad2e('0x1e')](function(_0x2fe953){if(_0x2fe953){return[_0x2fe953,![]];}_0x843547[_0xad2e('0x8a')]=_0x1fda13[_0xad2e('0x58')]['threadId'];_0x843547['externalUrl']=_0x1fda13[_0xad2e('0x58')][_0xad2e('0x8c')];return db['OpenchannelInteraction'][_0xad2e('0x57')](_0x843547)[_0xad2e('0x1e')](function(_0x423871){return[_0x423871,!![]];});});}else{_0x3a70de[_0xad2e('0x8a')]=null;}_0x3a70de[_0xad2e('0x8d')]=_0x574f67['id'];return db[_0xad2e('0x8b')]['find']({'where':_0x3a70de})['then'](function(_0x163c57){if(_0x163c57){return[_0x163c57,![]];}return db[_0xad2e('0x8b')][_0xad2e('0x57')](_0x843547)['then'](function(_0x522021){return[_0x522021,!![]];});});}})[_0xad2e('0x8e')](function(_0x1e5a79,_0x6db0ee){if(_0x1e5a79){_0x3692ec=_0x6db0ee;if(!_0x6db0ee){var _0x2fd877={'from':(_0x55caee[_0xad2e('0x8f')][_0xad2e('0x88')]||'')+'\x20'+(_0x55caee[_0xad2e('0x8f')][_0xad2e('0x89')]||'')};if(_0x1fda13[_0xad2e('0x58')][_0xad2e('0x8a')]&&_0x1fda13['body']['messageId']&&_0x1fda13[_0xad2e('0x58')][_0xad2e('0x8a')]!=_0x1fda13[_0xad2e('0x58')][_0xad2e('0x90')]){_0x2fd877[_0xad2e('0x8a')]=_0x1fda13['body'][_0xad2e('0x90')];}return _0x1e5a79['update'](_0x2fd877);}else{return _0x1e5a79;}}})['then'](function(_0x529069){_0x55caee[_0xad2e('0x91')]=_0x529069[_0xad2e('0x5c')]({'plain':!![]});_0x55caee['interaction']['created']=_0x3692ec;if(_0x55caee[_0xad2e('0x91')][_0xad2e('0x92')]){if(_0x55caee['account'][_0xad2e('0x93')]){_0x55caee[_0xad2e('0x82')][_0xad2e('0x94')]({'id':0x0,'priority':_0x55caee[_0xad2e('0x82')][_0xad2e('0x47')]+0x1,'app':'close','appdata':_0xad2e('0x95'),'interval':_0xad2e('0x96')});}}return db[_0xad2e('0x97')][_0xad2e('0x57')]({'body':_0x1fda13[_0xad2e('0x58')][_0xad2e('0x58')],'OpenchannelAccountId':_0x1fda13['params']['id'],'OpenchannelInteractionId':_0x529069['id'],'direction':'in','ContactId':_0x55caee[_0xad2e('0x8f')]['id'],'AttachmentId':_0x1fda13[_0xad2e('0x58')]['AttachmentId']});})[_0xad2e('0x1e')](function(_0x5777f5){_0x55caee[_0xad2e('0x25')]=_0x5777f5;if(_0x55caee[_0xad2e('0x91')][_0xad2e('0x98')]){return db[_0xad2e('0x99')]['find']({'attributes':['id',_0xad2e('0x37')],'where':{'id':_0x55caee[_0xad2e('0x91')][_0xad2e('0x98')]}})[_0xad2e('0x1e')](function(_0x48f509){if(_0x48f509){_0x55caee[_0xad2e('0x82')][_0xad2e('0x9a')]({'id':0x0,'priority':0x0,'app':_0xad2e('0x9b'),'appdata':_0x48f509[_0xad2e('0x37')]+','+(_0x55caee[_0xad2e('0x81')][_0xad2e('0x9c')]||0xa),'interval':_0xad2e('0x96')});_0x55caee[_0xad2e('0x9d')]=![];}return respondWithRpcPromise(_0xad2e('0x9e'),_0xad2e('0x9f'),_0x55caee);});}return respondWithRpcPromise(_0xad2e('0x9e'),_0xad2e('0x9f'),_0x55caee);})[_0xad2e('0x1e')](function(_0x5f1aaf){respondWithRpcPromise(_0xad2e('0xa0'),_0xad2e('0xa0'),{'event':_0xad2e('0x6e'),'message':_0x5f1aaf},client9002);return _0x5f1aaf;})['then'](respondWithResult(_0x26519d,null))['catch'](handleError(_0x26519d,null));};exports[_0xad2e('0xa1')]=function(_0x55b7de,_0x2764b8){var _0x514090=_0x55b7de['params']['id'];var _0xf4c429=_0x55b7de[_0xad2e('0x58')];var _0x281853=0xc8;var _0x346a14=null;return db[_0xad2e('0xa2')][_0xad2e('0xa3')]({'isolationLevel':db['sequelize']['Transaction'][_0xad2e('0xa4')][_0xad2e('0xa5')]},function(_0x1d2988){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x514090},'transaction':_0x1d2988})[_0xad2e('0x1e')](function(_0x1d2174){if(_0x1d2174){return db['OpenchannelApplication'][_0xad2e('0x32')]({'where':{'OpenchannelAccountId':_0x514090},'transaction':_0x1d2988})['then'](function(){var _0x3da872=_[_0xad2e('0x3b')](_0xf4c429,function(_0x241e01){_0x241e01[_0xad2e('0x63')]=_0x514090;return _0x241e01;});return db[_0xad2e('0x7f')][_0xad2e('0xa6')](_0x3da872,{'transaction':_0x1d2988});});}else{_0x281853=0x194;_0x346a14=[];}});})['then'](function(){if(_0x281853!==0x194){return db[_0xad2e('0x7f')][_0xad2e('0xa7')]({'where':{'OpenchannelAccountId':_0x514090},'order':'priority'})[_0xad2e('0x1e')](function(_0x232403){_0x346a14=_0x232403;});}})[_0xad2e('0x27')](function(_0x360d04){_0x281853=0x1f4;logger[_0xad2e('0x22')](_0x360d04[_0xad2e('0x36')]);if(_0x360d04[_0xad2e('0x37')]){delete _0x360d04['name'];}_0x346a14=_0x360d04;})[_0xad2e('0xa8')](function(){if(_0x346a14===null){_0x2764b8['sendStatus'](_0x281853);}else{if(_0x281853===0x1f4){_0x2764b8[_0xad2e('0x28')](_0x281853)[_0xad2e('0x38')](_0x346a14);}else{_0x2764b8[_0xad2e('0x28')](_0x281853)[_0xad2e('0x29')](_0x346a14);}}});};exports[_0xad2e('0xa9')]=function(_0x9b10b,_0x16c3fe,_0x4f546b){var _0x5eeebd={};var _0x476b0a={};var _0x40d8d7;var _0x30a217;return db[_0xad2e('0x3c')][_0xad2e('0x65')]({'where':{'id':_0x9b10b[_0xad2e('0x62')]['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x16c3fe,null))[_0xad2e('0x1e')](function(_0x571702){if(_0x571702){_0x40d8d7=_0x571702;_0x476b0a['model']=_[_0xad2e('0x41')](db[_0xad2e('0x7f')]['rawAttributes']);_0x476b0a[_0xad2e('0x44')]=_[_0xad2e('0x41')](_0x9b10b[_0xad2e('0x44')]);_0x476b0a[_0xad2e('0x42')]=_[_0xad2e('0x43')](_0x476b0a[_0xad2e('0x40')],_0x476b0a[_0xad2e('0x44')]);_0x5eeebd[_0xad2e('0x45')]=_[_0xad2e('0x43')](_0x476b0a[_0xad2e('0x40')],qs['fields'](_0x9b10b[_0xad2e('0x44')][_0xad2e('0x46')]));_0x5eeebd[_0xad2e('0x45')]=_0x5eeebd[_0xad2e('0x45')][_0xad2e('0x47')]?_0x5eeebd[_0xad2e('0x45')]:_0x476b0a['model'];_0x5eeebd['order']=qs['sort'](_0x9b10b[_0xad2e('0x44')][_0xad2e('0x4b')]);_0x5eeebd['where']=qs['filters'](_['pick'](_0x9b10b[_0xad2e('0x44')],_0x476b0a['filters']));if(_0x9b10b[_0xad2e('0x44')][_0xad2e('0x67')]){_0x5eeebd['where']=_[_0xad2e('0x4e')](_0x5eeebd[_0xad2e('0x4d')],{'$or':_[_0xad2e('0x3b')](_0x5eeebd[_0xad2e('0x45')],function(_0x46535f){var _0x2a9579={};_0x2a9579[_0x46535f]={'$like':'%'+_0x9b10b[_0xad2e('0x44')]['filter']+'%'};return _0x2a9579;})});}_0x5eeebd=_['merge']({},_0x5eeebd,_0x9b10b[_0xad2e('0x50')]);return _0x40d8d7[_0xad2e('0xa9')](_0x5eeebd);}})[_0xad2e('0x1e')](function(_0x50758e){if(_0x50758e){_0x30a217=_0x50758e[_0xad2e('0x47')];if(!_0x9b10b[_0xad2e('0x44')][_0xad2e('0x48')](_0xad2e('0x49'))){_0x5eeebd['limit']=qs[_0xad2e('0x2b')](_0x9b10b[_0xad2e('0x44')][_0xad2e('0x2b')]);_0x5eeebd[_0xad2e('0x2a')]=qs[_0xad2e('0x2a')](_0x9b10b[_0xad2e('0x44')][_0xad2e('0x2a')]);}return _0x40d8d7[_0xad2e('0xa9')](_0x5eeebd);}})[_0xad2e('0x1e')](function(_0x3afce8){if(_0x3afce8){return _0x3afce8?{'count':_0x30a217,'rows':_0x3afce8}:null;}})[_0xad2e('0x1e')](respondWithResult(_0x16c3fe,null))[_0xad2e('0x27')](handleError(_0x16c3fe,null));};exports[_0xad2e('0xaa')]=function(_0x4bbe9f,_0x12e027,_0xa49de1){var _0x3d0f8b={'raw':![],'where':{}};var _0xd5f999={};var _0xdbb0a1={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xad2e('0x65')]({'where':{'id':_0x4bbe9f[_0xad2e('0x62')]['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x12e027,null))[_0xad2e('0x1e')](function(_0x51df55){if(_0x51df55){_0xd5f999[_0xad2e('0x40')]=_[_0xad2e('0x41')](db[_0xad2e('0x8b')][_0xad2e('0x3d')]);_0xd5f999['query']=_['keys'](_0x4bbe9f[_0xad2e('0x44')]);_0xd5f999[_0xad2e('0x42')]=_[_0xad2e('0x43')](_0xd5f999['model'],_0xd5f999[_0xad2e('0x44')]);_0x3d0f8b[_0xad2e('0x45')]=_[_0xad2e('0x43')](_0xd5f999[_0xad2e('0x40')],qs[_0xad2e('0x46')](_0x4bbe9f[_0xad2e('0x44')][_0xad2e('0x46')]));_0x3d0f8b[_0xad2e('0x45')]=_0x3d0f8b[_0xad2e('0x45')][_0xad2e('0x47')]?_0x3d0f8b[_0xad2e('0x45')]:_0xd5f999[_0xad2e('0x40')];if(!_0x4bbe9f['query'][_0xad2e('0x48')](_0xad2e('0x49'))){_0x3d0f8b[_0xad2e('0x2b')]=qs[_0xad2e('0x2b')](_0x4bbe9f[_0xad2e('0x44')][_0xad2e('0x2b')]);_0x3d0f8b['offset']=qs[_0xad2e('0x2a')](_0x4bbe9f[_0xad2e('0x44')][_0xad2e('0x2a')]);}_0x3d0f8b[_0xad2e('0x4a')]=qs[_0xad2e('0x4b')](_0x4bbe9f[_0xad2e('0x44')][_0xad2e('0x4b')]);_0x3d0f8b[_0xad2e('0x4d')]=qs[_0xad2e('0x42')](_['pick'](_0x4bbe9f['query'],_0xd5f999[_0xad2e('0x42')]));_0x3d0f8b[_0xad2e('0x4d')]['OpenchannelAccountId']=_0x51df55['id'];if(_0x4bbe9f[_0xad2e('0x44')]['filter']){_0x3d0f8b[_0xad2e('0x4d')]=_[_0xad2e('0x4e')](_0x3d0f8b['where'],{'$or':_['map'](_0x3d0f8b['attributes'],function(_0x3de06a){var _0x55947c={};_0x55947c[_0x3de06a]={'$like':'%'+_0x4bbe9f[_0xad2e('0x44')][_0xad2e('0x67')]+'%'};return _0x55947c;})});}_0x3d0f8b=_[_0xad2e('0x4e')]({},_0x3d0f8b,_0x4bbe9f['options']);return db['OpenchannelInteraction']['count']({'where':_0x3d0f8b[_0xad2e('0x4d')]})['then'](function(_0x3d2f35){_0xdbb0a1[_0xad2e('0x2d')]=_0x3d2f35;if(_0x4bbe9f[_0xad2e('0x44')]['includeAll']){_0x3d0f8b[_0xad2e('0x52')]=[{'model':db[_0xad2e('0x6f')],'as':'Contact','required':![]},{'model':db[_0xad2e('0x99')],'as':_0xad2e('0xab'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0xad2e('0xac')],'as':_0xad2e('0xad'),'attributes':['id',_0xad2e('0x37'),_0xad2e('0xae')],'where':_0x4bbe9f[_0xad2e('0x44')][_0xad2e('0xaf')]?{'id':_0x4bbe9f[_0xad2e('0x44')][_0xad2e('0xaf')]}:undefined,'required':_0x4bbe9f[_0xad2e('0x44')][_0xad2e('0xaf')]?!![]:![]}];}return db[_0xad2e('0x8b')][_0xad2e('0x53')](_0x3d0f8b);})[_0xad2e('0x1e')](function(_0x51d053){_0xdbb0a1[_0xad2e('0x54')]=_0x51d053;return _0xdbb0a1;});}})[_0xad2e('0x1e')](respondWithFilteredResult(_0x12e027,_0x3d0f8b))['catch'](handleError(_0x12e027,null));};exports[_0xad2e('0xb0')]=function(_0x505b58,_0x4758d2,_0x547e0a){return db[_0xad2e('0x3c')]['find']({'where':{'id':_0x505b58[_0xad2e('0x62')]['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x4758d2,null))[_0xad2e('0x1e')](function(_0xcba9){if(_0xcba9){return _0xcba9[_0xad2e('0xb0')](_0x505b58[_0xad2e('0x58')]['ids'],_[_0xad2e('0xb1')](_0x505b58[_0xad2e('0x58')],[_0xad2e('0x69'),'id'])||{})[_0xad2e('0x8e')](function(_0x53d428){for(var _0x5d2208=0x0;_0x5d2208<_0x505b58['body']['ids'][_0xad2e('0x47')];_0x5d2208+=0x1){socket['emit'](_0xad2e('0xb2'),{'UserId':Number(_0x505b58[_0xad2e('0x58')]['ids'][_0x5d2208]),'OpenchannelAccountId':Number(_0x505b58[_0xad2e('0x62')]['id'])});}return _0x53d428;});}})[_0xad2e('0x1e')](respondWithResult(_0x4758d2,null))[_0xad2e('0x27')](handleError(_0x4758d2,null));};exports[_0xad2e('0xb3')]=function(_0x3e55f1,_0x53385e,_0x21c1d1){return db[_0xad2e('0x3c')]['find']({'where':{'id':_0x3e55f1['params']['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x53385e,null))[_0xad2e('0x1e')](function(_0x2ed9f4){if(_0x2ed9f4){return _0x2ed9f4[_0xad2e('0xb3')](_0x3e55f1[_0xad2e('0x44')]['ids'])['then'](function(){if(_[_0xad2e('0xb4')](_0x3e55f1[_0xad2e('0x44')]['ids'])){for(var _0x3e5a2b=0x0;_0x3e5a2b<_0x3e55f1['query'][_0xad2e('0x69')][_0xad2e('0x47')];_0x3e5a2b+=0x1){socket[_0xad2e('0xb5')](_0xad2e('0xb6'),{'UserId':Number(_0x3e55f1[_0xad2e('0x44')]['ids'][_0x3e5a2b]),'OpenchannelAccountId':Number(_0x3e55f1[_0xad2e('0x62')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x3e55f1[_0xad2e('0x44')][_0xad2e('0x69')]),'OpenchannelAccountId':Number(_0x3e55f1[_0xad2e('0x62')]['id'])});}});}})[_0xad2e('0x1e')](respondWithStatusCode(_0x53385e,null))[_0xad2e('0x27')](handleError(_0x53385e,null));};exports[_0xad2e('0xb7')]=function(_0x14b851,_0x48c791,_0x313966){var _0x5da69c={};var _0x4d3232={};var _0x5b0aed;var _0xf134d;return db[_0xad2e('0x3c')]['findOne']({'where':{'id':_0x14b851['params']['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x48c791,null))[_0xad2e('0x1e')](function(_0x15aa26){if(_0x15aa26){_0x5b0aed=_0x15aa26;_0x4d3232['model']=_[_0xad2e('0x41')](db['User']['rawAttributes']);_0x4d3232['query']=_['keys'](_0x14b851[_0xad2e('0x44')]);_0x4d3232['filters']=_['intersection'](_0x4d3232[_0xad2e('0x40')],_0x4d3232[_0xad2e('0x44')]);_0x5da69c[_0xad2e('0x45')]=_['intersection'](_0x4d3232['model'],qs[_0xad2e('0x46')](_0x14b851[_0xad2e('0x44')][_0xad2e('0x46')]));_0x5da69c['attributes']=_0x5da69c[_0xad2e('0x45')][_0xad2e('0x47')]?_0x5da69c['attributes']:_0x4d3232[_0xad2e('0x40')];_0x5da69c[_0xad2e('0x4a')]=qs[_0xad2e('0x4b')](_0x14b851[_0xad2e('0x44')][_0xad2e('0x4b')]);_0x5da69c[_0xad2e('0x4d')]=qs[_0xad2e('0x42')](_[_0xad2e('0x4c')](_0x14b851['query'],_0x4d3232[_0xad2e('0x42')]));if(_0x14b851['query'][_0xad2e('0x67')]){_0x5da69c[_0xad2e('0x4d')]=_['merge'](_0x5da69c['where'],{'$or':_[_0xad2e('0x3b')](_0x5da69c[_0xad2e('0x45')],function(_0x417911){var _0x45cb43={};_0x45cb43[_0x417911]={'$like':'%'+_0x14b851['query'][_0xad2e('0x67')]+'%'};return _0x45cb43;})});}_0x5da69c=_['merge']({},_0x5da69c,_0x14b851[_0xad2e('0x50')]);return _0x5b0aed[_0xad2e('0xb7')](_0x5da69c);}})[_0xad2e('0x1e')](function(_0x44aa0a){if(_0x44aa0a){_0xf134d=_0x44aa0a[_0xad2e('0x47')];if(!_0x14b851[_0xad2e('0x44')][_0xad2e('0x48')](_0xad2e('0x49'))){_0x5da69c[_0xad2e('0x2b')]=qs[_0xad2e('0x2b')](_0x14b851[_0xad2e('0x44')][_0xad2e('0x2b')]);_0x5da69c['offset']=qs[_0xad2e('0x2a')](_0x14b851[_0xad2e('0x44')]['offset']);}return _0x5b0aed[_0xad2e('0xb7')](_0x5da69c);}})[_0xad2e('0x1e')](function(_0x380fef){if(_0x380fef){return _0x380fef?{'count':_0xf134d,'rows':_0x380fef}:null;}})['then'](respondWithResult(_0x48c791,null))[_0xad2e('0x27')](handleError(_0x48c791,null));};exports[_0xad2e('0x38')]=function(_0x4943ac,_0x2f711c,_0x186159){var _0xa9c180,_0x1d0202,_0x1a3f76;if(_[_0xad2e('0x76')](_0x4943ac[_0xad2e('0x58')]['body'])||_0x4943ac['body']['body']===''){throw new db[(_0xad2e('0x70'))][(_0xad2e('0x71'))](_0xad2e('0x79'));}if(_[_0xad2e('0x76')](_0x4943ac['body']['to'])){}_0xa9c180=_0x4943ac['body']['to'];return db[_0xad2e('0x3c')][_0xad2e('0x65')]({'where':{'id':_0x4943ac['params']['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x2f711c,null))[_0xad2e('0x1e')](function(_0x5a6603){if(_0x5a6603){return db[_0xad2e('0x3c')]['find']({'where':{'id':_0x5a6603['id']},'include':[{'model':db[_0xad2e('0xb8')],'as':_0xad2e('0x7d'),'include':[{'model':db['CmContact'],'as':_0xad2e('0x7e'),'where':{[_0x5a6603[_0xad2e('0x7b')]]:_0xa9c180},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xad2e('0x1e')](handleEntityNotFound(_0x2f711c,null))[_0xad2e('0x1e')](function(_0x492b7e){if(_0x492b7e&&_0x492b7e[_0xad2e('0x7d')]){_0x1d0202=_0x492b7e['get']({'plain':!![]});if(_0x1d0202[_0xad2e('0x7d')]&&_0x1d0202[_0xad2e('0x7d')][_0xad2e('0x7e')][_0xad2e('0x47')]){return _0x1d0202[_0xad2e('0x7d')]['Contacts'][0x0];}return db['CmContact'][_0xad2e('0x57')](_[_0xad2e('0x87')](_0x4943ac[_0xad2e('0x58')],{'firstName':_0xa9c180,[_0x492b7e['mapKey']]:_0xa9c180,'phone':_0xa9c180,'ListId':_0x1d0202[_0xad2e('0x75')]}));}})[_0xad2e('0x1e')](handleEntityNotFound(_0x2f711c,null))[_0xad2e('0x1e')](function(_0x64cf3e){if(_0x64cf3e){_0x1a3f76=_0x64cf3e;return db[_0xad2e('0x8b')][_0xad2e('0x56')]({'where':{'ContactId':_0x1a3f76['id'],'closed':![],'OpenchannelAccountId':_0x1d0202['id']}})[_0xad2e('0x1e')](function(_0xa2fb80){if(_0xa2fb80){return[_0xa2fb80,![]];}return db[_0xad2e('0x8b')][_0xad2e('0x57')]({'UserId':_0x4943ac[_0xad2e('0x59')]['id'],'ContactId':_0x1a3f76['id'],'OpenchannelAccountId':_0x1d0202['id'],'lastMsgDirection':'out','firstMsgDirection':_0xad2e('0xb9'),'Messages':[_[_0xad2e('0x4e')](_0x4943ac['body'],{'read':![],'body':_0x4943ac[_0xad2e('0x58')][_0xad2e('0x58')],'OpenchannelAccountId':_0x1d0202['id'],'UserId':_0x4943ac[_0xad2e('0x59')]['id'],'ContactId':_0x1a3f76['id']})]},{'include':[{'model':db[_0xad2e('0x97')],'as':_0xad2e('0xba')}]})['then'](function(_0x2a26c2){return[_0x2a26c2,!![]];});});}})[_0xad2e('0x8e')](function(_0x27ad41,_0x23834d){if(_0x23834d){return _0x27ad41;}return db[_0xad2e('0x97')][_0xad2e('0x57')](_[_0xad2e('0x4e')](_0x4943ac[_0xad2e('0x58')],{'read':![],'body':_0x4943ac[_0xad2e('0x58')][_0xad2e('0x58')],'OpenchannelAccountId':_0x1d0202['id'],'OpenchannelInteractionId':_0x27ad41['id'],'UserId':_0x4943ac['user']['id'],'ContactId':_0x1a3f76['id']}))[_0xad2e('0x1e')](function(_0x506922){_0x27ad41[_0xad2e('0xbb')][_0xad2e('0xba')]=[];_0x27ad41[_0xad2e('0xbb')][_0xad2e('0xba')][_0xad2e('0x94')](_0x506922['dataValues']);return _0x27ad41;});});}})[_0xad2e('0x1e')](respondWithResult(_0x2f711c,null))[_0xad2e('0x27')](handleError(_0x2f711c,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index b49c943..12b1c48 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 _0x55e0=['remove','emit','hook','events','../../mysqldb','OpenchannelAccount','setMaxListeners'];(function(_0x1b81b9,_0x1d314a){var _0x27a94d=function(_0x3f2916){while(--_0x3f2916){_0x1b81b9['push'](_0x1b81b9['shift']());}};_0x27a94d(++_0x1d314a);}(_0x55e0,0xdc));var _0x055e=function(_0x47e3c5,_0x439129){_0x47e3c5=_0x47e3c5-0x0;var _0x202798=_0x55e0[_0x47e3c5];return _0x202798;};'use strict';var EventEmitter=require(_0x055e('0x0'));var OpenchannelAccount=require(_0x055e('0x1'))['db'][_0x055e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x055e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x055e('0x4')};function emitEvent(_0x2d9bd5){return function(_0x33cd7b,_0x2773e4,_0x157473){OpenchannelAccountEvents[_0x055e('0x5')](_0x2d9bd5+':'+_0x33cd7b['id'],_0x33cd7b);OpenchannelAccountEvents['emit'](_0x2d9bd5,_0x33cd7b);_0x157473(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x055e('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x4483=['../../mysqldb','OpenchannelAccount','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4483,0x1a3));var _0x3448=function(_0x1e7776,_0x38f6ec){_0x1e7776=_0x1e7776-0x0;var _0x5c8641=_0x4483[_0x1e7776];return _0x5c8641;};'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 diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index eb6a0ab..d4fac92 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(_0x47f582,_0x21b057){var _0xc5b81=function(_0x38fb87){while(--_0x38fb87){_0x47f582['push'](_0x47f582['shift']());}};_0xc5b81(++_0x21b057);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0x1115ed,_0x3dc0a0){var _0x4be0ac=function(_0x3a7057){while(--_0x3a7057){_0x1115ed['push'](_0x1115ed['shift']());}};_0x4be0ac(++_0x3dc0a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 a41e0f8..008bc8f 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 _0x9e6b=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','register','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','../../mysqldb'];(function(_0x2de643,_0x395eb6){var _0x18d842=function(_0x5108b9){while(--_0x5108b9){_0x2de643['push'](_0x2de643['shift']());}};_0x18d842(++_0x395eb6);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9e6b[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xb9e6('0x0'));var util=require(_0xb9e6('0x1'));var moment=require('moment');var BPromise=require(_0xb9e6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9e6('0x3'))['db'];var utils=require(_0xb9e6('0x4'));var logger=require(_0xb9e6('0x5'))(_0xb9e6('0x6'));var config=require('../../config/environment');var jayson=require(_0xb9e6('0x7'));var client=jayson[_0xb9e6('0x8')][_0xb9e6('0x9')]({'port':0x232a});config['redis']=_[_0xb9e6('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb9e6('0xb')]));require('./openchannelAccount.socket')[_0xb9e6('0xc')](socket);function respondWithRpcPromise(_0x216b1a,_0x477b52,_0x3e18bf){return new BPromise(function(_0x40d57b,_0x43e8c8){return client[_0xb9e6('0xd')](_0x216b1a,_0x3e18bf)[_0xb9e6('0xe')](function(_0x165903){logger[_0xb9e6('0xf')]('OpenchannelAccount,\x20%s,\x20%s',_0x477b52,_0xb9e6('0x10'));logger[_0xb9e6('0x11')](_0xb9e6('0x12'),_0x477b52,_0xb9e6('0x10'),JSON['stringify'](_0x165903));if(_0x165903[_0xb9e6('0x13')]){if(_0x165903[_0xb9e6('0x13')]['code']===0x1f4){logger['error'](_0xb9e6('0x14'),_0x477b52,_0x165903[_0xb9e6('0x13')][_0xb9e6('0x15')]);return _0x43e8c8(_0x165903[_0xb9e6('0x13')]['message']);}logger[_0xb9e6('0x13')](_0xb9e6('0x14'),_0x477b52,_0x165903[_0xb9e6('0x13')][_0xb9e6('0x15')]);return _0x40d57b(_0x165903[_0xb9e6('0x13')][_0xb9e6('0x15')]);}else{logger[_0xb9e6('0xf')](_0xb9e6('0x14'),_0x477b52,_0xb9e6('0x10'));_0x40d57b(_0x165903[_0xb9e6('0x16')]['message']);}})[_0xb9e6('0x17')](function(_0x53a357){logger[_0xb9e6('0x13')](_0xb9e6('0x14'),_0x477b52,_0x53a357);_0x43e8c8(_0x53a357);});});} \ No newline at end of file +var _0x6c76=['error','code','message','result','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x6c76,0x184));var _0x66c7=function(_0x4fef7e,_0x12e0a5){_0x4fef7e=_0x4fef7e-0x0;var _0x37aa0a=_0x6c76[_0x4fef7e];return _0x37aa0a;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var moment=require(_0x66c7('0x2'));var BPromise=require('bluebird');var rs=require(_0x66c7('0x3'));var fs=require('fs');var Redis=require(_0x66c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x66c7('0x5'))(_0x66c7('0x6'));var config=require('../../config/environment');var jayson=require(_0x66c7('0x7'));var client=jayson[_0x66c7('0x8')]['http']({'port':0x232a});config[_0x66c7('0x9')]=_['defaults'](config['redis'],{'host':_0x66c7('0xa'),'port':0x18eb});var socket=require(_0x66c7('0xb'))(new Redis(config[_0x66c7('0x9')]));require('./openchannelAccount.socket')[_0x66c7('0xc')](socket);function respondWithRpcPromise(_0xbc35d9,_0xf44e2,_0x2fff5e){return new BPromise(function(_0x492634,_0x464085){return client[_0x66c7('0xd')](_0xbc35d9,_0x2fff5e)[_0x66c7('0xe')](function(_0x187e00){logger[_0x66c7('0xf')](_0x66c7('0x10'),_0xf44e2,_0x66c7('0x11'));logger['debug'](_0x66c7('0x12'),_0xf44e2,_0x66c7('0x11'),JSON[_0x66c7('0x13')](_0x187e00));if(_0x187e00[_0x66c7('0x14')]){if(_0x187e00[_0x66c7('0x14')][_0x66c7('0x15')]===0x1f4){logger[_0x66c7('0x14')](_0x66c7('0x10'),_0xf44e2,_0x187e00[_0x66c7('0x14')]['message']);return _0x464085(_0x187e00[_0x66c7('0x14')]['message']);}logger[_0x66c7('0x14')](_0x66c7('0x10'),_0xf44e2,_0x187e00[_0x66c7('0x14')][_0x66c7('0x16')]);return _0x492634(_0x187e00[_0x66c7('0x14')]['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0xf44e2,'request\x20sent');_0x492634(_0x187e00[_0x66c7('0x17')][_0x66c7('0x16')]);}})['catch'](function(_0x524e87){logger[_0x66c7('0x14')](_0x66c7('0x10'),_0xf44e2,_0x524e87);_0x464085(_0x524e87);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 4f8c742..4c4145a 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 _0x1542=['save','remove','update','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x23f3ea,_0x2cab2a){var _0x490a40=function(_0x1d46f8){while(--_0x1d46f8){_0x23f3ea['push'](_0x23f3ea['shift']());}};_0x490a40(++_0x2cab2a);}(_0x1542,0x116));var _0x2154=function(_0x10942c,_0x2969cb){_0x10942c=_0x10942c-0x0;var _0x5530b0=_0x1542[_0x10942c];return _0x5530b0;};'use strict';var OpenchannelAccountEvents=require(_0x2154('0x0'));var events=[_0x2154('0x1'),_0x2154('0x2'),_0x2154('0x3')];function createListener(_0x229bed,_0x4faf69){return function(_0x42644b){_0x4faf69[_0x2154('0x4')](_0x229bed,_0x42644b);};}function removeListener(_0x13e41b,_0x4ded8a){return function(){OpenchannelAccountEvents[_0x2154('0x5')](_0x13e41b,_0x4ded8a);};}exports[_0x2154('0x6')]=function(_0x5406f9){for(var _0x13d9c2=0x0,_0x23abb5=events[_0x2154('0x7')];_0x13d9c2<_0x23abb5;_0x13d9c2++){var _0x791345=events[_0x13d9c2];var _0x2e6295=createListener(_0x2154('0x8')+_0x791345,_0x5406f9);OpenchannelAccountEvents['on'](_0x791345,_0x2e6295);}}; \ No newline at end of file +var _0x81d5=['register','length','openchannelAccount:','./openchannelAccount.events','save','update','emit','removeListener'];(function(_0x4409e7,_0x307f17){var _0x24c751=function(_0x3a7d33){while(--_0x3a7d33){_0x4409e7['push'](_0x4409e7['shift']());}};_0x24c751(++_0x307f17);}(_0x81d5,0x1ab));var _0x581d=function(_0x319671,_0x35d082){_0x319671=_0x319671-0x0;var _0x452c6a=_0x81d5[_0x319671];return _0x452c6a;};'use strict';var OpenchannelAccountEvents=require(_0x581d('0x0'));var events=[_0x581d('0x1'),'remove',_0x581d('0x2')];function createListener(_0x20d1a8,_0x2fe463){return function(_0x9fb336){_0x2fe463[_0x581d('0x3')](_0x20d1a8,_0x9fb336);};}function removeListener(_0x553617,_0x4801bc){return function(){OpenchannelAccountEvents[_0x581d('0x4')](_0x553617,_0x4801bc);};}exports[_0x581d('0x5')]=function(_0x1895d2){for(var _0x4bb545=0x0,_0x16067b=events[_0x581d('0x6')];_0x4bb545<_0x16067b;_0x4bb545++){var _0x43124c=events[_0x4bb545];var _0x497368=createListener(_0x581d('0x7')+_0x43124c,_0x1895d2);OpenchannelAccountEvents['on'](_0x43124c,_0x497368);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 31a0bfb..a885a4b 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 _0xca20=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','path','connect-timeout'];(function(_0x316c03,_0x467833){var _0x3f07a2=function(_0x1fe03a){while(--_0x1fe03a){_0x316c03['push'](_0x316c03['shift']());}};_0x3f07a2(++_0x467833);}(_0xca20,0x8a));var _0x0ca2=function(_0x274638,_0x578968){_0x274638=_0x274638-0x0;var _0x5755df=_0xca20[_0x274638];return _0x5755df;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0ca2('0x0'));var timeout=require(_0x0ca2('0x1'));var express=require(_0x0ca2('0x2'));var router=express[_0x0ca2('0x3')]();var fs_extra=require(_0x0ca2('0x4'));var auth=require(_0x0ca2('0x5'));var interaction=require(_0x0ca2('0x6'));var config=require(_0x0ca2('0x7'));var controller=require(_0x0ca2('0x8'));router[_0x0ca2('0x9')]('/',auth[_0x0ca2('0xa')](),controller[_0x0ca2('0xb')]);router[_0x0ca2('0x9')](_0x0ca2('0xc'),auth[_0x0ca2('0xa')](),controller[_0x0ca2('0xd')]);router[_0x0ca2('0xe')]('/',auth[_0x0ca2('0xa')](),controller[_0x0ca2('0xf')]);router[_0x0ca2('0x10')](_0x0ca2('0xc'),auth[_0x0ca2('0xa')](),controller[_0x0ca2('0x11')]);router[_0x0ca2('0x12')](_0x0ca2('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x0ca2('0x13')]=router; \ No newline at end of file +var _0xef70=['../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x455b5d,_0x427262){var _0x460edc=function(_0x4d7b43){while(--_0x4d7b43){_0x455b5d['push'](_0x455b5d['shift']());}};_0x460edc(++_0x427262);}(_0xef70,0xb5));var _0x0ef7=function(_0xf5cf8b,_0x4698bd){_0xf5cf8b=_0xf5cf8b-0x0;var _0x38216e=_0xef70[_0xf5cf8b];return _0x38216e;};'use strict';var multer=require(_0x0ef7('0x0'));var util=require(_0x0ef7('0x1'));var path=require(_0x0ef7('0x2'));var timeout=require(_0x0ef7('0x3'));var express=require(_0x0ef7('0x4'));var router=express[_0x0ef7('0x5')]();var fs_extra=require(_0x0ef7('0x6'));var auth=require(_0x0ef7('0x7'));var interaction=require(_0x0ef7('0x8'));var config=require(_0x0ef7('0x9'));var controller=require(_0x0ef7('0xa'));router[_0x0ef7('0xb')]('/',auth[_0x0ef7('0xc')](),controller[_0x0ef7('0xd')]);router[_0x0ef7('0xb')]('/:id',auth[_0x0ef7('0xc')](),controller[_0x0ef7('0xe')]);router['post']('/',auth[_0x0ef7('0xc')](),controller[_0x0ef7('0xf')]);router[_0x0ef7('0x10')](_0x0ef7('0x11'),auth[_0x0ef7('0xc')](),controller[_0x0ef7('0x12')]);router['delete']('/:id',auth[_0x0ef7('0xc')](),controller[_0x0ef7('0x13')]);module[_0x0ef7('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 3928287..3f25c88 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 _0xdb8d=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x45afb5,_0x402bd9){var _0x29884a=function(_0x5abbc0){while(--_0x5abbc0){_0x45afb5['push'](_0x45afb5['shift']());}};_0x29884a(++_0x402bd9);}(_0xdb8d,0x88));var _0xddb8=function(_0x42e694,_0x2bda04){_0x42e694=_0x42e694-0x0;var _0x16a539=_0xdb8d[_0x42e694];return _0x16a539;};'use strict';var Sequelize=require(_0xddb8('0x0'));module[_0xddb8('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xddb8('0x2')],'allowNull':![],'defaultValue':_0xddb8('0x3')},'appdata':{'type':Sequelize[_0xddb8('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xddb8('0x2')],'defaultValue':_0xddb8('0x5')}}; \ No newline at end of file +var _0x8cdf=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x2a04d4,_0xa57830){var _0x40b2f9=function(_0x44f8cf){while(--_0x44f8cf){_0x2a04d4['push'](_0x2a04d4['shift']());}};_0x40b2f9(++_0xa57830);}(_0x8cdf,0x14e));var _0xf8cd=function(_0x39d0d5,_0xcd43b4){_0x39d0d5=_0x39d0d5-0x0;var _0x4e4d18=_0x8cdf[_0x39d0d5];return _0x4e4d18;};'use strict';var Sequelize=require(_0xf8cd('0x0'));module[_0xf8cd('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf8cd('0x2')],'allowNull':![],'defaultValue':_0xf8cd('0x3')},'appdata':{'type':Sequelize[_0xf8cd('0x4')]()},'description':{'type':Sequelize[_0xf8cd('0x2')]},'interval':{'type':Sequelize[_0xf8cd('0x2')],'defaultValue':_0xf8cd('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 180266c..815a973 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 _0x8f7a=['path','sox','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','then','end','error','stack','send','index','rawAttributes','type','map','name','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','OpenchannelApplication','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x590407,_0x25f834){var _0x1b8b2d=function(_0x13be4c){while(--_0x13be4c){_0x590407['push'](_0x590407['shift']());}};_0x1b8b2d(++_0x25f834);}(_0x8f7a,0x128));var _0xa8f7=function(_0x3b95ac,_0x58738b){_0x3b95ac=_0x3b95ac-0x0;var _0x4a777b=_0x8f7a[_0x3b95ac];return _0x4a777b;};'use strict';var emlformat=require(_0xa8f7('0x0'));var rimraf=require(_0xa8f7('0x1'));var zipdir=require(_0xa8f7('0x2'));var jsonpatch=require(_0xa8f7('0x3'));var rp=require('request-promise');var moment=require(_0xa8f7('0x4'));var BPromise=require(_0xa8f7('0x5'));var Mustache=require(_0xa8f7('0x6'));var util=require(_0xa8f7('0x7'));var path=require(_0xa8f7('0x8'));var sox=require(_0xa8f7('0x9'));var csv=require('to-csv');var ejs=require(_0xa8f7('0xa'));var fs=require('fs');var fs_extra=require(_0xa8f7('0xb'));var _=require('lodash');var squel=require(_0xa8f7('0xc'));var crypto=require('crypto');var jsforce=require(_0xa8f7('0xd'));var deskjs=require(_0xa8f7('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa8f7('0xf'));var Papa=require(_0xa8f7('0x10'));var Redis=require(_0xa8f7('0x11'));var authService=require(_0xa8f7('0x12'));var qs=require(_0xa8f7('0x13'));var as=require(_0xa8f7('0x14'));var hardwareService=require(_0xa8f7('0x15'));var logger=require('../../config/logger')(_0xa8f7('0x16'));var utils=require(_0xa8f7('0x17'));var config=require(_0xa8f7('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa8f7('0x19'))['db'];function respondWithStatusCode(_0x5ce272,_0x3c9b38){_0x3c9b38=_0x3c9b38||0xcc;return function(_0x2ebd99){if(_0x2ebd99){return _0x5ce272[_0xa8f7('0x1a')](_0x3c9b38);}return _0x5ce272['status'](_0x3c9b38)['end']();};}function respondWithResult(_0x39ac29,_0xf3b0a3){_0xf3b0a3=_0xf3b0a3||0xc8;return function(_0x5dc8b4){if(_0x5dc8b4){return _0x39ac29[_0xa8f7('0x1b')](_0xf3b0a3)[_0xa8f7('0x1c')](_0x5dc8b4);}};}function respondWithFilteredResult(_0x27423c,_0x57f4bd){return function(_0x46aaff){if(_0x46aaff){var _0x23cc7d=typeof _0x57f4bd['offset']===_0xa8f7('0x1d')&&typeof _0x57f4bd['limit']===_0xa8f7('0x1d');var _0x2f4b94=_0x46aaff[_0xa8f7('0x1e')];var _0x313a67=_0x23cc7d?0x0:_0x57f4bd[_0xa8f7('0x1f')];var _0x338357=_0x23cc7d?_0x46aaff[_0xa8f7('0x1e')]:_0x57f4bd[_0xa8f7('0x1f')]+_0x57f4bd[_0xa8f7('0x20')];var _0x195124;if(_0x338357>=_0x2f4b94){_0x338357=_0x2f4b94;_0x195124=0xc8;}else{_0x195124=0xce;}_0x27423c[_0xa8f7('0x1b')](_0x195124);return _0x27423c[_0xa8f7('0x21')](_0xa8f7('0x22'),_0x313a67+'-'+_0x338357+'/'+_0x2f4b94)['json'](_0x46aaff);}return null;};}function patchUpdates(_0x327bdb){return function(_0x464ad0){try{jsonpatch[_0xa8f7('0x23')](_0x464ad0,_0x327bdb,!![]);}catch(_0x56e079){return BPromise[_0xa8f7('0x24')](_0x56e079);}return _0x464ad0['save']();};}function saveUpdates(_0x166c21,_0x1d94f8){return function(_0x251e66){if(_0x251e66){return _0x251e66['update'](_0x166c21)[_0xa8f7('0x25')](function(_0x13add0){return _0x13add0;});}return null;};}function removeEntity(_0xdb2fc5,_0x3d97c9){return function(_0x16ee51){if(_0x16ee51){return _0x16ee51['destroy']()[_0xa8f7('0x25')](function(){_0xdb2fc5[_0xa8f7('0x1b')](0xcc)[_0xa8f7('0x26')]();});}};}function handleEntityNotFound(_0x153344,_0x1c5bb2){return function(_0x37a2d7){if(!_0x37a2d7){_0x153344['sendStatus'](0x194);}return _0x37a2d7;};}function handleError(_0x3b3dc9,_0x4bd8a9){_0x4bd8a9=_0x4bd8a9||0x1f4;return function(_0x40fda6){logger[_0xa8f7('0x27')](_0x40fda6[_0xa8f7('0x28')]);if(_0x40fda6['name']){delete _0x40fda6['name'];}_0x3b3dc9['status'](_0x4bd8a9)[_0xa8f7('0x29')](_0x40fda6);};}exports[_0xa8f7('0x2a')]=function(_0xaff541,_0x222457){var _0x16687e={},_0x46b854={},_0x13efac={'count':0x0,'rows':[]};var _0xb49356=_['map'](db['OpenchannelApplication'][_0xa8f7('0x2b')],function(_0x32871d){return{'name':_0x32871d['fieldName'],'type':_0x32871d[_0xa8f7('0x2c')]['key']};});_0x46b854['model']=_[_0xa8f7('0x2d')](_0xb49356,_0xa8f7('0x2e'));_0x46b854['query']=_[_0xa8f7('0x2f')](_0xaff541[_0xa8f7('0x30')]);_0x46b854[_0xa8f7('0x31')]=_['intersection'](_0x46b854['model'],_0x46b854[_0xa8f7('0x30')]);_0x16687e['attributes']=_[_0xa8f7('0x32')](_0x46b854[_0xa8f7('0x33')],qs[_0xa8f7('0x34')](_0xaff541[_0xa8f7('0x30')][_0xa8f7('0x34')]));_0x16687e[_0xa8f7('0x35')]=_0x16687e[_0xa8f7('0x35')][_0xa8f7('0x36')]?_0x16687e[_0xa8f7('0x35')]:_0x46b854[_0xa8f7('0x33')];if(!_0xaff541[_0xa8f7('0x30')][_0xa8f7('0x37')](_0xa8f7('0x38'))){_0x16687e[_0xa8f7('0x20')]=qs[_0xa8f7('0x20')](_0xaff541['query'][_0xa8f7('0x20')]);_0x16687e[_0xa8f7('0x1f')]=qs['offset'](_0xaff541[_0xa8f7('0x30')]['offset']);}_0x16687e[_0xa8f7('0x39')]=qs[_0xa8f7('0x3a')](_0xaff541[_0xa8f7('0x30')][_0xa8f7('0x3a')]);_0x16687e[_0xa8f7('0x3b')]=qs['filters'](_[_0xa8f7('0x3c')](_0xaff541[_0xa8f7('0x30')],_0x46b854[_0xa8f7('0x31')]),_0xb49356);if(_0xaff541[_0xa8f7('0x30')][_0xa8f7('0x3d')]){_0x16687e['where']=_[_0xa8f7('0x3e')](_0x16687e[_0xa8f7('0x3b')],{'$or':_[_0xa8f7('0x2d')](_0xb49356,function(_0x2588ce){if(_0x2588ce[_0xa8f7('0x2c')]!=='VIRTUAL'){var _0x20897e={};_0x20897e[_0x2588ce[_0xa8f7('0x2e')]]={'$like':'%'+_0xaff541['query'][_0xa8f7('0x3d')]+'%'};return _0x20897e;}})});}_0x16687e=_[_0xa8f7('0x3e')]({},_0x16687e,_0xaff541[_0xa8f7('0x3f')]);var _0x42caec={'where':_0x16687e[_0xa8f7('0x3b')]};return db[_0xa8f7('0x40')][_0xa8f7('0x1e')](_0x42caec)['then'](function(_0xe5ddb8){_0x13efac[_0xa8f7('0x1e')]=_0xe5ddb8;if(_0xaff541[_0xa8f7('0x30')][_0xa8f7('0x41')]){_0x16687e[_0xa8f7('0x42')]=[{'all':!![]}];}return db[_0xa8f7('0x40')][_0xa8f7('0x43')](_0x16687e);})[_0xa8f7('0x25')](function(_0x4922a2){_0x13efac[_0xa8f7('0x44')]=_0x4922a2;return _0x13efac;})[_0xa8f7('0x25')](respondWithFilteredResult(_0x222457,_0x16687e))[_0xa8f7('0x45')](handleError(_0x222457,null));};exports[_0xa8f7('0x46')]=function(_0x14c63e,_0x522611){var _0x3e0672={'raw':!![],'where':{'id':_0x14c63e[_0xa8f7('0x47')]['id']}},_0x5eb7e1={};_0x5eb7e1[_0xa8f7('0x33')]=_[_0xa8f7('0x2f')](db['OpenchannelApplication'][_0xa8f7('0x2b')]);_0x5eb7e1['query']=_[_0xa8f7('0x2f')](_0x14c63e['query']);_0x5eb7e1[_0xa8f7('0x31')]=_[_0xa8f7('0x32')](_0x5eb7e1[_0xa8f7('0x33')],_0x5eb7e1[_0xa8f7('0x30')]);_0x3e0672[_0xa8f7('0x35')]=_['intersection'](_0x5eb7e1[_0xa8f7('0x33')],qs[_0xa8f7('0x34')](_0x14c63e[_0xa8f7('0x30')][_0xa8f7('0x34')]));_0x3e0672[_0xa8f7('0x35')]=_0x3e0672[_0xa8f7('0x35')][_0xa8f7('0x36')]?_0x3e0672[_0xa8f7('0x35')]:_0x5eb7e1[_0xa8f7('0x33')];if(_0x14c63e[_0xa8f7('0x30')][_0xa8f7('0x41')]){_0x3e0672[_0xa8f7('0x42')]=[{'all':!![]}];}_0x3e0672=_['merge']({},_0x3e0672,_0x14c63e['options']);return db['OpenchannelApplication'][_0xa8f7('0x48')](_0x3e0672)[_0xa8f7('0x25')](handleEntityNotFound(_0x522611,null))[_0xa8f7('0x25')](respondWithResult(_0x522611,null))[_0xa8f7('0x45')](handleError(_0x522611,null));};exports[_0xa8f7('0x49')]=function(_0x2c3b64,_0x2ca967){return db['OpenchannelApplication'][_0xa8f7('0x49')](_0x2c3b64['body'],{})[_0xa8f7('0x25')](respondWithResult(_0x2ca967,0xc9))[_0xa8f7('0x45')](handleError(_0x2ca967,null));};exports[_0xa8f7('0x4a')]=function(_0x31cdd8,_0x43eee6){if(_0x31cdd8[_0xa8f7('0x4b')]['id']){delete _0x31cdd8[_0xa8f7('0x4b')]['id'];}return db[_0xa8f7('0x40')]['find']({'where':{'id':_0x31cdd8[_0xa8f7('0x47')]['id']}})[_0xa8f7('0x25')](handleEntityNotFound(_0x43eee6,null))[_0xa8f7('0x25')](saveUpdates(_0x31cdd8[_0xa8f7('0x4b')],null))[_0xa8f7('0x25')](respondWithResult(_0x43eee6,null))[_0xa8f7('0x45')](handleError(_0x43eee6,null));};exports['destroy']=function(_0x367bce,_0x85e6cb){return db['OpenchannelApplication']['find']({'where':{'id':_0x367bce[_0xa8f7('0x47')]['id']}})['then'](handleEntityNotFound(_0x85e6cb,null))[_0xa8f7('0x25')](removeEntity(_0x85e6cb,null))['catch'](handleError(_0x85e6cb,null));}; \ No newline at end of file +var _0x7a52=['fieldName','type','model','map','query','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','show','params','keys','rawAttributes','fields','include','find','create','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','offset','count','set','json','reject','save','update','then','end','error','name','send','OpenchannelApplication'];(function(_0x1d1dd7,_0x5adaeb){var _0x22f7da=function(_0x27da18){while(--_0x27da18){_0x1d1dd7['push'](_0x1d1dd7['shift']());}};_0x22f7da(++_0x5adaeb);}(_0x7a52,0x1d3));var _0x27a5=function(_0x25e527,_0x2a333a){_0x25e527=_0x25e527-0x0;var _0x4f258a=_0x7a52[_0x25e527];return _0x4f258a;};'use strict';var emlformat=require(_0x27a5('0x0'));var rimraf=require(_0x27a5('0x1'));var zipdir=require(_0x27a5('0x2'));var jsonpatch=require(_0x27a5('0x3'));var rp=require(_0x27a5('0x4'));var moment=require(_0x27a5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x27a5('0x6'));var util=require(_0x27a5('0x7'));var path=require(_0x27a5('0x8'));var sox=require(_0x27a5('0x9'));var csv=require(_0x27a5('0xa'));var ejs=require(_0x27a5('0xb'));var fs=require('fs');var fs_extra=require(_0x27a5('0xc'));var _=require(_0x27a5('0xd'));var squel=require(_0x27a5('0xe'));var crypto=require(_0x27a5('0xf'));var jsforce=require(_0x27a5('0x10'));var deskjs=require(_0x27a5('0x11'));var toCsv=require(_0x27a5('0xa'));var querystring=require(_0x27a5('0x12'));var Papa=require(_0x27a5('0x13'));var Redis=require(_0x27a5('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x27a5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x27a5('0x16'));var logger=require(_0x27a5('0x17'))('api');var utils=require(_0x27a5('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x27a5('0x19'));var db=require(_0x27a5('0x1a'))['db'];function respondWithStatusCode(_0x346cb5,_0x47f038){_0x47f038=_0x47f038||0xcc;return function(_0x4b59d7){if(_0x4b59d7){return _0x346cb5[_0x27a5('0x1b')](_0x47f038);}return _0x346cb5[_0x27a5('0x1c')](_0x47f038)['end']();};}function respondWithResult(_0x46afc5,_0x5fdbe3){_0x5fdbe3=_0x5fdbe3||0xc8;return function(_0x207963){if(_0x207963){return _0x46afc5[_0x27a5('0x1c')](_0x5fdbe3)['json'](_0x207963);}};}function respondWithFilteredResult(_0x2c6e97,_0x1368be){return function(_0x279aff){if(_0x279aff){var _0x51e129=typeof _0x1368be['offset']===_0x27a5('0x1d')&&typeof _0x1368be[_0x27a5('0x1e')]===_0x27a5('0x1d');var _0x26f534=_0x279aff['count'];var _0x2f4690=_0x51e129?0x0:_0x1368be[_0x27a5('0x1f')];var _0x2b8a27=_0x51e129?_0x279aff[_0x27a5('0x20')]:_0x1368be['offset']+_0x1368be[_0x27a5('0x1e')];var _0xc2d7dc;if(_0x2b8a27>=_0x26f534){_0x2b8a27=_0x26f534;_0xc2d7dc=0xc8;}else{_0xc2d7dc=0xce;}_0x2c6e97['status'](_0xc2d7dc);return _0x2c6e97[_0x27a5('0x21')]('Content-Range',_0x2f4690+'-'+_0x2b8a27+'/'+_0x26f534)[_0x27a5('0x22')](_0x279aff);}return null;};}function patchUpdates(_0x4ee469){return function(_0x3658bb){try{jsonpatch['apply'](_0x3658bb,_0x4ee469,!![]);}catch(_0x1479bf){return BPromise[_0x27a5('0x23')](_0x1479bf);}return _0x3658bb[_0x27a5('0x24')]();};}function saveUpdates(_0x18bfe4,_0x4d6022){return function(_0x489516){if(_0x489516){return _0x489516[_0x27a5('0x25')](_0x18bfe4)[_0x27a5('0x26')](function(_0x10c7d6){return _0x10c7d6;});}return null;};}function removeEntity(_0x5d4c06,_0x3e461a){return function(_0x35cc53){if(_0x35cc53){return _0x35cc53['destroy']()[_0x27a5('0x26')](function(){_0x5d4c06[_0x27a5('0x1c')](0xcc)[_0x27a5('0x27')]();});}};}function handleEntityNotFound(_0x1fc144,_0x26fcdb){return function(_0x535edb){if(!_0x535edb){_0x1fc144[_0x27a5('0x1b')](0x194);}return _0x535edb;};}function handleError(_0x147907,_0x3f1100){_0x3f1100=_0x3f1100||0x1f4;return function(_0x4d2156){logger[_0x27a5('0x28')](_0x4d2156['stack']);if(_0x4d2156[_0x27a5('0x29')]){delete _0x4d2156[_0x27a5('0x29')];}_0x147907[_0x27a5('0x1c')](_0x3f1100)[_0x27a5('0x2a')](_0x4d2156);};}exports['index']=function(_0x393fab,_0x437671){var _0x140644={},_0x2c8f22={},_0x247397={'count':0x0,'rows':[]};var _0x3f4ca7=_['map'](db[_0x27a5('0x2b')]['rawAttributes'],function(_0x38b5f5){return{'name':_0x38b5f5[_0x27a5('0x2c')],'type':_0x38b5f5[_0x27a5('0x2d')]['key']};});_0x2c8f22[_0x27a5('0x2e')]=_[_0x27a5('0x2f')](_0x3f4ca7,_0x27a5('0x29'));_0x2c8f22[_0x27a5('0x30')]=_['keys'](_0x393fab['query']);_0x2c8f22[_0x27a5('0x31')]=_[_0x27a5('0x32')](_0x2c8f22['model'],_0x2c8f22[_0x27a5('0x30')]);_0x140644[_0x27a5('0x33')]=_[_0x27a5('0x32')](_0x2c8f22[_0x27a5('0x2e')],qs['fields'](_0x393fab[_0x27a5('0x30')]['fields']));_0x140644['attributes']=_0x140644[_0x27a5('0x33')]['length']?_0x140644[_0x27a5('0x33')]:_0x2c8f22['model'];if(!_0x393fab[_0x27a5('0x30')][_0x27a5('0x34')](_0x27a5('0x35'))){_0x140644[_0x27a5('0x1e')]=qs['limit'](_0x393fab['query']['limit']);_0x140644[_0x27a5('0x1f')]=qs[_0x27a5('0x1f')](_0x393fab[_0x27a5('0x30')]['offset']);}_0x140644['order']=qs[_0x27a5('0x36')](_0x393fab[_0x27a5('0x30')]['sort']);_0x140644[_0x27a5('0x37')]=qs[_0x27a5('0x31')](_[_0x27a5('0x38')](_0x393fab['query'],_0x2c8f22[_0x27a5('0x31')]),_0x3f4ca7);if(_0x393fab[_0x27a5('0x30')][_0x27a5('0x39')]){_0x140644[_0x27a5('0x37')]=_[_0x27a5('0x3a')](_0x140644[_0x27a5('0x37')],{'$or':_['map'](_0x3f4ca7,function(_0xa2def8){if(_0xa2def8[_0x27a5('0x2d')]!==_0x27a5('0x3b')){var _0x2fd3e7={};_0x2fd3e7[_0xa2def8[_0x27a5('0x29')]]={'$like':'%'+_0x393fab[_0x27a5('0x30')]['filter']+'%'};return _0x2fd3e7;}})});}_0x140644=_['merge']({},_0x140644,_0x393fab[_0x27a5('0x3c')]);var _0x1514cb={'where':_0x140644[_0x27a5('0x37')]};return db['OpenchannelApplication']['count'](_0x1514cb)['then'](function(_0x138cec){_0x247397[_0x27a5('0x20')]=_0x138cec;if(_0x393fab[_0x27a5('0x30')][_0x27a5('0x3d')]){_0x140644['include']=[{'all':!![]}];}return db[_0x27a5('0x2b')]['findAll'](_0x140644);})['then'](function(_0x4777cb){_0x247397['rows']=_0x4777cb;return _0x247397;})['then'](respondWithFilteredResult(_0x437671,_0x140644))['catch'](handleError(_0x437671,null));};exports[_0x27a5('0x3e')]=function(_0x3ed8e8,_0x82aaf2){var _0x37ed53={'raw':!![],'where':{'id':_0x3ed8e8[_0x27a5('0x3f')]['id']}},_0x4e9f41={};_0x4e9f41[_0x27a5('0x2e')]=_[_0x27a5('0x40')](db[_0x27a5('0x2b')][_0x27a5('0x41')]);_0x4e9f41[_0x27a5('0x30')]=_[_0x27a5('0x40')](_0x3ed8e8[_0x27a5('0x30')]);_0x4e9f41[_0x27a5('0x31')]=_[_0x27a5('0x32')](_0x4e9f41[_0x27a5('0x2e')],_0x4e9f41[_0x27a5('0x30')]);_0x37ed53[_0x27a5('0x33')]=_['intersection'](_0x4e9f41['model'],qs[_0x27a5('0x42')](_0x3ed8e8[_0x27a5('0x30')][_0x27a5('0x42')]));_0x37ed53[_0x27a5('0x33')]=_0x37ed53['attributes']['length']?_0x37ed53[_0x27a5('0x33')]:_0x4e9f41[_0x27a5('0x2e')];if(_0x3ed8e8[_0x27a5('0x30')][_0x27a5('0x3d')]){_0x37ed53[_0x27a5('0x43')]=[{'all':!![]}];}_0x37ed53=_[_0x27a5('0x3a')]({},_0x37ed53,_0x3ed8e8[_0x27a5('0x3c')]);return db[_0x27a5('0x2b')][_0x27a5('0x44')](_0x37ed53)[_0x27a5('0x26')](handleEntityNotFound(_0x82aaf2,null))[_0x27a5('0x26')](respondWithResult(_0x82aaf2,null))['catch'](handleError(_0x82aaf2,null));};exports[_0x27a5('0x45')]=function(_0x2dcfa3,_0x5d920a){return db['OpenchannelApplication'][_0x27a5('0x45')](_0x2dcfa3[_0x27a5('0x46')],{})[_0x27a5('0x26')](respondWithResult(_0x5d920a,0xc9))[_0x27a5('0x47')](handleError(_0x5d920a,null));};exports[_0x27a5('0x25')]=function(_0x2d607e,_0x5cecfc){if(_0x2d607e[_0x27a5('0x46')]['id']){delete _0x2d607e[_0x27a5('0x46')]['id'];}return db[_0x27a5('0x2b')][_0x27a5('0x44')]({'where':{'id':_0x2d607e[_0x27a5('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5cecfc,null))[_0x27a5('0x26')](saveUpdates(_0x2d607e[_0x27a5('0x46')],null))[_0x27a5('0x26')](respondWithResult(_0x5cecfc,null))[_0x27a5('0x47')](handleError(_0x5cecfc,null));};exports[_0x27a5('0x48')]=function(_0x22b9cf,_0x2df814){return db[_0x27a5('0x2b')][_0x27a5('0x44')]({'where':{'id':_0x22b9cf[_0x27a5('0x3f')]['id']}})[_0x27a5('0x26')](handleEntityNotFound(_0x2df814,null))[_0x27a5('0x26')](removeEntity(_0x2df814,null))[_0x27a5('0x47')](handleError(_0x2df814,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 9efe1a8..9660bfb 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 _0x7e20=['path','rimraf','../../config/environment','./openchannelApplication.attributes','define','openchannel_applications','utf8mb4','lodash','util','../../config/logger','api','request-promise'];(function(_0x4fc80b,_0xfe1b3d){var _0x119dba=function(_0x16ed12){while(--_0x16ed12){_0x4fc80b['push'](_0x4fc80b['shift']());}};_0x119dba(++_0xfe1b3d);}(_0x7e20,0x163));var _0x07e2=function(_0x332e90,_0x26efbd){_0x332e90=_0x332e90-0x0;var _0x3c5684=_0x7e20[_0x332e90];return _0x3c5684;};'use strict';var _=require(_0x07e2('0x0'));var util=require(_0x07e2('0x1'));var logger=require(_0x07e2('0x2'))(_0x07e2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x07e2('0x4'));var fs=require('fs');var path=require(_0x07e2('0x5'));var rimraf=require(_0x07e2('0x6'));var config=require(_0x07e2('0x7'));var attributes=require(_0x07e2('0x8'));module['exports']=function(_0x408653,_0x230ede){return _0x408653[_0x07e2('0x9')]('OpenchannelApplication',attributes,{'tableName':_0x07e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x07e2('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x16fa=['./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x16fa,0x65));var _0xa16f=function(_0x5eca50,_0xc1e3f8){_0x5eca50=_0x5eca50-0x0;var _0x41fb84=_0x16fa[_0x5eca50];return _0x41fb84;};'use strict';var _=require(_0xa16f('0x0'));var util=require(_0xa16f('0x1'));var logger=require(_0xa16f('0x2'))(_0xa16f('0x3'));var moment=require(_0xa16f('0x4'));var BPromise=require('bluebird');var rp=require(_0xa16f('0x5'));var fs=require('fs');var path=require(_0xa16f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa16f('0x7'));module[_0xa16f('0x8')]=function(_0xd25a6b,_0x37a334){return _0xd25a6b[_0xa16f('0x9')]('OpenchannelApplication',attributes,{'tableName':_0xa16f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa16f('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 0bdb64a..f9c0274 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 _0x6734=['result','catch','UpdateOpenchannelApplication','body','raw','options','where','attributes','limit','then','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6734,0x166));var _0x4673=function(_0x7a2a2f,_0x26057a){_0x7a2a2f=_0x7a2a2f-0x0;var _0x4fbb2a=_0x6734[_0x7a2a2f];return _0x4fbb2a;};'use strict';var _=require(_0x4673('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4673('0x1'));var rs=require(_0x4673('0x2'));var fs=require('fs');var Redis=require(_0x4673('0x3'));var db=require(_0x4673('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4673('0x5'))(_0x4673('0x6'));var config=require(_0x4673('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4673('0x8')][_0x4673('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x572494,_0x5552f2,_0x5e9bc6){return new BPromise(function(_0xb2a2dc,_0x532a92){return client['request'](_0x572494,_0x5e9bc6)['then'](function(_0x24c3b4){logger[_0x4673('0xa')](_0x4673('0xb'),_0x5552f2,_0x4673('0xc'));logger[_0x4673('0xd')](_0x4673('0xe'),_0x5552f2,'request\x20sent',JSON[_0x4673('0xf')](_0x24c3b4));if(_0x24c3b4[_0x4673('0x10')]){if(_0x24c3b4[_0x4673('0x10')][_0x4673('0x11')]===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x5552f2,_0x24c3b4['error'][_0x4673('0x12')]);return _0x532a92(_0x24c3b4[_0x4673('0x10')]['message']);}logger[_0x4673('0x10')](_0x4673('0xb'),_0x5552f2,_0x24c3b4[_0x4673('0x10')]['message']);return _0xb2a2dc(_0x24c3b4[_0x4673('0x10')][_0x4673('0x12')]);}else{logger[_0x4673('0xa')]('OpenchannelApplication,\x20%s,\x20%s',_0x5552f2,_0x4673('0xc'));_0xb2a2dc(_0x24c3b4[_0x4673('0x13')]['message']);}})[_0x4673('0x14')](function(_0xe6c8d7){logger[_0x4673('0x10')](_0x4673('0xb'),_0x5552f2,_0xe6c8d7);_0x532a92(_0xe6c8d7);});});}exports[_0x4673('0x15')]=function(_0x180f1f){var _0x1c7ac5=this;return new Promise(function(_0x381343,_0x473702){return db['OpenchannelApplication']['update'](_0x180f1f[_0x4673('0x16')],{'raw':_0x180f1f['options']?_0x180f1f['options'][_0x4673('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x180f1f[_0x4673('0x18')]?_0x180f1f[_0x4673('0x18')][_0x4673('0x19')]||null:null,'attributes':_0x180f1f[_0x4673('0x18')]?_0x180f1f[_0x4673('0x18')][_0x4673('0x1a')]||null:null,'limit':_0x180f1f['options']?_0x180f1f[_0x4673('0x18')][_0x4673('0x1b')]||null:null})[_0x4673('0x1c')](function(_0x2b0202){logger[_0x4673('0xa')](_0x4673('0x15'),_0x180f1f);logger[_0x4673('0xd')]('UpdateOpenchannelApplication',_0x180f1f,JSON[_0x4673('0xf')](_0x2b0202));_0x381343(_0x2b0202);})['catch'](function(_0x81bc5a){logger[_0x4673('0x10')]('UpdateOpenchannelApplication',_0x81bc5a[_0x4673('0x12')],_0x180f1f);_0x473702(_0x1c7ac5[_0x4673('0x10')](0x1f4,_0x81bc5a[_0x4673('0x12')]));});});}; \ No newline at end of file +var _0x1967=['stringify','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','where','attributes'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1967,0x12e));var _0x7196=function(_0x162082,_0x5d3494){_0x162082=_0x162082-0x0;var _0x4d1fb4=_0x1967[_0x162082];return _0x4d1fb4;};'use strict';var _=require(_0x7196('0x0'));var util=require(_0x7196('0x1'));var moment=require(_0x7196('0x2'));var BPromise=require(_0x7196('0x3'));var rs=require(_0x7196('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7196('0x9')][_0x7196('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b1a12,_0x50c7ba,_0x2b8ed4){return new BPromise(function(_0x257e08,_0x3bc531){return client[_0x7196('0xb')](_0x4b1a12,_0x2b8ed4)[_0x7196('0xc')](function(_0x7fce54){logger[_0x7196('0xd')](_0x7196('0xe'),_0x50c7ba,_0x7196('0xf'));logger[_0x7196('0x10')](_0x7196('0x11'),_0x50c7ba,_0x7196('0xf'),JSON['stringify'](_0x7fce54));if(_0x7fce54[_0x7196('0x12')]){if(_0x7fce54['error'][_0x7196('0x13')]===0x1f4){logger[_0x7196('0x12')](_0x7196('0xe'),_0x50c7ba,_0x7fce54[_0x7196('0x12')][_0x7196('0x14')]);return _0x3bc531(_0x7fce54['error'][_0x7196('0x14')]);}logger[_0x7196('0x12')](_0x7196('0xe'),_0x50c7ba,_0x7fce54['error'][_0x7196('0x14')]);return _0x257e08(_0x7fce54[_0x7196('0x12')][_0x7196('0x14')]);}else{logger[_0x7196('0xd')](_0x7196('0xe'),_0x50c7ba,_0x7196('0xf'));_0x257e08(_0x7fce54['result'][_0x7196('0x14')]);}})['catch'](function(_0x1227a3){logger[_0x7196('0x12')](_0x7196('0xe'),_0x50c7ba,_0x1227a3);_0x3bc531(_0x1227a3);});});}exports[_0x7196('0x15')]=function(_0x58d180){var _0xa18f1=this;return new Promise(function(_0x572f48,_0x948bf5){return db[_0x7196('0x16')]['update'](_0x58d180[_0x7196('0x17')],{'raw':_0x58d180[_0x7196('0x18')]?_0x58d180['options'][_0x7196('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58d180[_0x7196('0x18')]?_0x58d180[_0x7196('0x18')][_0x7196('0x1a')]||null:null,'attributes':_0x58d180[_0x7196('0x18')]?_0x58d180[_0x7196('0x18')][_0x7196('0x1b')]||null:null,'limit':_0x58d180['options']?_0x58d180[_0x7196('0x18')]['limit']||null:null})['then'](function(_0x46d13a){logger[_0x7196('0xd')](_0x7196('0x15'),_0x58d180);logger[_0x7196('0x10')](_0x7196('0x15'),_0x58d180,JSON[_0x7196('0x1c')](_0x46d13a));_0x572f48(_0x46d13a);})[_0x7196('0x1d')](function(_0x3f1317){logger[_0x7196('0x12')](_0x7196('0x15'),_0x3f1317[_0x7196('0x14')],_0x58d180);_0x948bf5(_0xa18f1[_0x7196('0x12')](0x1f4,_0x3f1317['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index f4d4842..b13e6a8 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 _0xca2d=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id/messages','getMessages','/:id/download','download','post','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','/:id','openchannelinteraction:update','destroy','delete','removeTags','exports'];(function(_0x56d072,_0x21534c){var _0x2c92d9=function(_0x275f2c){while(--_0x275f2c){_0x56d072['push'](_0x56d072['shift']());}};_0x2c92d9(++_0x21534c);}(_0xca2d,0x1f0));var _0xdca2=function(_0x350796,_0x1bf21f){_0x350796=_0x350796-0x0;var _0x126f19=_0xca2d[_0x350796];return _0x126f19;};'use strict';var multer=require(_0xdca2('0x0'));var util=require(_0xdca2('0x1'));var path=require(_0xdca2('0x2'));var timeout=require(_0xdca2('0x3'));var express=require('express');var router=express[_0xdca2('0x4')]();var fs_extra=require(_0xdca2('0x5'));var auth=require(_0xdca2('0x6'));var interaction=require(_0xdca2('0x7'));var config=require('../../config/environment');var controller=require(_0xdca2('0x8'));router[_0xdca2('0x9')]('/',auth[_0xdca2('0xa')](),controller[_0xdca2('0xb')]);router['get'](_0xdca2('0xc'),auth['isAuthenticated'](),controller[_0xdca2('0xd')]);router[_0xdca2('0x9')]('/:id',auth[_0xdca2('0xa')](),controller['show']);router[_0xdca2('0x9')](_0xdca2('0xe'),auth['isAuthenticated'](),controller[_0xdca2('0xf')]);router[_0xdca2('0x9')](_0xdca2('0x10'),auth[_0xdca2('0xa')](),controller[_0xdca2('0x11')]);router[_0xdca2('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xdca2('0xe'),auth['isAuthenticated'](),controller['addMessage']);router['post'](_0xdca2('0x13'),auth['isAuthenticated'](),interaction[_0xdca2('0x14')](_0xdca2('0x15'),_0xdca2('0x16')),controller[_0xdca2('0x17')]);router[_0xdca2('0x18')](_0xdca2('0x19'),auth[_0xdca2('0xa')](),interaction[_0xdca2('0x14')](_0xdca2('0x15'),_0xdca2('0x1a')),controller['update']);router['delete']('/:id',auth[_0xdca2('0xa')](),interaction['tracked'](_0xdca2('0x15'),'openchannelinteraction:destroy'),controller[_0xdca2('0x1b')]);router[_0xdca2('0x1c')]('/:id/tags',auth[_0xdca2('0xa')](),controller[_0xdca2('0x1d')]);module[_0xdca2('0x1e')]=router; \ No newline at end of file +var _0x1d8c=['openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','update'];(function(_0x425036,_0x39bebc){var _0x7fc880=function(_0x54493c){while(--_0x54493c){_0x425036['push'](_0x425036['shift']());}};_0x7fc880(++_0x39bebc);}(_0x1d8c,0xa0));var _0xc1d8=function(_0x2208e3,_0x241116){_0x2208e3=_0x2208e3-0x0;var _0x20fbc0=_0x1d8c[_0x2208e3];return _0x20fbc0;};'use strict';var multer=require(_0xc1d8('0x0'));var util=require(_0xc1d8('0x1'));var path=require('path');var timeout=require(_0xc1d8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc1d8('0x3'));var auth=require(_0xc1d8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc1d8('0x5'));var controller=require(_0xc1d8('0x6'));router[_0xc1d8('0x7')]('/',auth[_0xc1d8('0x8')](),controller['index']);router[_0xc1d8('0x7')]('/describe',auth[_0xc1d8('0x8')](),controller[_0xc1d8('0x9')]);router[_0xc1d8('0x7')](_0xc1d8('0xa'),auth[_0xc1d8('0x8')](),controller[_0xc1d8('0xb')]);router[_0xc1d8('0x7')](_0xc1d8('0xc'),auth[_0xc1d8('0x8')](),controller['getMessages']);router[_0xc1d8('0x7')]('/:id/download',auth[_0xc1d8('0x8')](),controller['download']);router[_0xc1d8('0xd')]('/',auth[_0xc1d8('0x8')](),controller['create']);router['post'](_0xc1d8('0xc'),auth[_0xc1d8('0x8')](),controller[_0xc1d8('0xe')]);router[_0xc1d8('0xd')](_0xc1d8('0xf'),auth[_0xc1d8('0x8')](),interaction[_0xc1d8('0x10')](_0xc1d8('0x11'),_0xc1d8('0x12')),controller[_0xc1d8('0x13')]);router['put']('/:id',auth[_0xc1d8('0x8')](),interaction[_0xc1d8('0x10')](_0xc1d8('0x11'),_0xc1d8('0x14')),controller[_0xc1d8('0x15')]);router['delete'](_0xc1d8('0xa'),auth['isAuthenticated'](),interaction[_0xc1d8('0x10')](_0xc1d8('0x11'),_0xc1d8('0x16')),controller[_0xc1d8('0x17')]);router['delete'](_0xc1d8('0xf'),auth[_0xc1d8('0x8')](),controller[_0xc1d8('0x18')]);module[_0xc1d8('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 4d41c4b..6cccb99 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 _0xb575=['ENUM','out','sequelize','exports','DATE','STRING'];(function(_0x5a947d,_0x2f4101){var _0x4b82c2=function(_0x309740){while(--_0x309740){_0x5a947d['push'](_0x5a947d['shift']());}};_0x4b82c2(++_0x2f4101);}(_0xb575,0xda));var _0x5b57=function(_0xb911de,_0x42f910){_0xb911de=_0xb911de-0x0;var _0x663d33=_0xb575[_0xb911de];return _0x663d33;};'use strict';var Sequelize=require(_0x5b57('0x0'));module[_0x5b57('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5b57('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5b57('0x3')]},'read1stAt':{'type':Sequelize[_0x5b57('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x5b57('0x3')]},'lastMsgAt':{'type':Sequelize[_0x5b57('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x5b57('0x4')]('in',_0x5b57('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x5b57('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x5b57('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd846=['exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x229128,_0x273558){var _0x1875b9=function(_0x275e35){while(--_0x275e35){_0x229128['push'](_0x229128['shift']());}};_0x1875b9(++_0x273558);}(_0xd846,0x195));var _0x6d84=function(_0x153cf2,_0x2e332c){_0x153cf2=_0x153cf2-0x0;var _0x46f5fc=_0xd846[_0x153cf2];return _0x46f5fc;};'use strict';var Sequelize=require(_0x6d84('0x0'));module[_0x6d84('0x1')]={'closed':{'type':Sequelize[_0x6d84('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6d84('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x6d84('0x4')]},'threadId':{'type':Sequelize[_0x6d84('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x6d84('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x6d84('0x5')]('in',_0x6d84('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x6d84('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x6d84('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 8590d7f..5727343 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 _0xb07a=['ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','defaults','redis','localhost','./openchannelInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query','user','catch','show','from','params','model','keys','filters','intersection','fields','attributes','length','merge','options','find','create','body','destroy','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','nolimit','sort','where','pick','OpenchannelInteractionId','$gte','split','includeAll','include','rows','addTags','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments','format','transcript-%d-%s.zip','User','fullname','Contact','firstName','lastName','push','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Owner','get','mkdirSync','Openchannel','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Public','Private','filter','basename','existsSync','createReadStream','createWriteStream','System','out','value','renderFile','views','transcript-','.pdf','unlinkSync','rimraf','moment','path','ejs','lodash'];(function(_0x54735a,_0x12ca3c){var _0x3ba241=function(_0x385f87){while(--_0x385f87){_0x54735a['push'](_0x54735a['shift']());}};_0x3ba241(++_0x12ca3c);}(_0xb07a,0x80));var _0xab07=function(_0x5effcf,_0x47af59){_0x5effcf=_0x5effcf-0x0;var _0x4d123c=_0xb07a[_0x5effcf];return _0x4d123c;};'use strict';var rimraf=require(_0xab07('0x0'));var zipdir=require('zip-dir');var moment=require(_0xab07('0x1'));var util=require('util');var path=require(_0xab07('0x2'));var ejs=require(_0xab07('0x3'));var fs=require('fs');var _=require(_0xab07('0x4'));var Redis=require(_0xab07('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0xab07('0x6'));var pdf=require(_0xab07('0x7'));var logger=require(_0xab07('0x8'))(_0xab07('0x9'));var config=require(_0xab07('0xa'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xab07('0xb')](config[_0xab07('0xc')],{'host':_0xab07('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xab07('0xc')]));require(_0xab07('0xe'))[_0xab07('0xf')](socket);function respondWithStatusCode(_0x440393,_0x106529){_0x106529=_0x106529||0xcc;return function(_0x290560){if(_0x290560){return _0x440393['sendStatus'](_0x106529);}return _0x440393[_0xab07('0x10')](_0x106529)[_0xab07('0x11')]();};}function respondWithResult(_0x3922ac,_0x6432d9){_0x6432d9=_0x6432d9||0xc8;return function(_0x2178b1){if(_0x2178b1){return _0x3922ac[_0xab07('0x10')](_0x6432d9)[_0xab07('0x12')](_0x2178b1);}};}function respondWithFilteredResult(_0x30a3e8,_0x3540b){return function(_0x19bd3f){if(_0x19bd3f){var _0x287120=typeof _0x3540b[_0xab07('0x13')]===_0xab07('0x14')&&typeof _0x3540b[_0xab07('0x15')]===_0xab07('0x14');var _0x2d64f1=_0x19bd3f[_0xab07('0x16')];var _0x329991=_0x287120?0x0:_0x3540b[_0xab07('0x13')];var _0x50d3ff=_0x287120?_0x19bd3f['count']:_0x3540b[_0xab07('0x13')]+_0x3540b['limit'];var _0x46972a;if(_0x50d3ff>=_0x2d64f1){_0x50d3ff=_0x2d64f1;_0x46972a=0xc8;}else{_0x46972a=0xce;}_0x30a3e8['status'](_0x46972a);return _0x30a3e8[_0xab07('0x17')](_0xab07('0x18'),_0x329991+'-'+_0x50d3ff+'/'+_0x2d64f1)[_0xab07('0x12')](_0x19bd3f);}return null;};}function saveUpdates(_0x4b5dca){return function(_0x82b3cc){if(_0x82b3cc){return _0x82b3cc[_0xab07('0x19')](_0x4b5dca)[_0xab07('0x1a')](function(_0x124d80){return _0x124d80;});}return null;};}function removeEntity(_0x5e43bd){return function(_0x97753a){if(_0x97753a){return _0x97753a['destroy']()[_0xab07('0x1a')](function(){_0x5e43bd[_0xab07('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x480b2c){return function(_0x52913){if(!_0x52913){_0x480b2c[_0xab07('0x1b')](0x194);}return _0x52913;};}function handleError(_0x452c86,_0x191998){_0x191998=_0x191998||0x1f4;return function(_0x24224e){logger[_0xab07('0x1c')](_0x24224e[_0xab07('0x1d')]);if(_0x24224e[_0xab07('0x1e')]){delete _0x24224e[_0xab07('0x1e')];}_0x452c86[_0xab07('0x10')](_0x191998)[_0xab07('0x1f')](_0x24224e);};}exports[_0xab07('0x20')]=function(_0x17c2dc,_0x24a8a0){var _0xecbbee={};var _0x166735=_[_0xab07('0x21')](db[_0xab07('0x22')][_0xab07('0x23')],function(_0x91076b){return{'name':_0x91076b[_0xab07('0x24')],'type':_0x91076b[_0xab07('0x25')][_0xab07('0x26')]};});_0xecbbee=qs[_0xab07('0x27')](_0x166735,_0x17c2dc);return interaction[_0xab07('0x28')](_0xab07('0x29'),_0x17c2dc[_0xab07('0x2a')],_0x17c2dc[_0xab07('0x2b')],_0xecbbee,_0x166735)[_0xab07('0x1a')](respondWithFilteredResult(_0x24a8a0,_0xecbbee))[_0xab07('0x2c')](handleError(_0x24a8a0,null));};exports[_0xab07('0x2d')]=function(_0x27ee4c,_0x531118){var _0x48f6ec={};if(_0x27ee4c['query'][_0xab07('0x25')]&&_0x27ee4c['query'][_0xab07('0x25')]==='from'){_0x48f6ec[_0xab07('0x2e')]=_0x27ee4c[_0xab07('0x2f')]['id'];}else{_0x48f6ec['id']=_0x27ee4c[_0xab07('0x2f')]['id'];}var _0x4089fb={'raw':![],'where':_0x48f6ec},_0xc475d4={};_0xc475d4[_0xab07('0x30')]=_[_0xab07('0x31')](db['OpenchannelInteraction'][_0xab07('0x23')]);_0xc475d4[_0xab07('0x2a')]=_[_0xab07('0x31')](_0x27ee4c['query']);_0xc475d4[_0xab07('0x32')]=_[_0xab07('0x33')](_0xc475d4['model'],_0xc475d4['query']);_0x4089fb['attributes']=_[_0xab07('0x33')](_0xc475d4[_0xab07('0x30')],qs[_0xab07('0x34')](_0x27ee4c[_0xab07('0x2a')][_0xab07('0x34')]));_0x4089fb[_0xab07('0x35')]=_0x4089fb[_0xab07('0x35')][_0xab07('0x36')]?_0x4089fb[_0xab07('0x35')]:_0xc475d4[_0xab07('0x30')];if(_0x27ee4c[_0xab07('0x2a')]['includeAll']){_0x4089fb['include']=[{'all':!![]}];}_0x4089fb=_[_0xab07('0x37')]({},_0x4089fb,_0x27ee4c[_0xab07('0x38')]);return db[_0xab07('0x22')][_0xab07('0x39')](_0x4089fb)[_0xab07('0x1a')](handleEntityNotFound(_0x531118,null))['then'](respondWithResult(_0x531118,null))[_0xab07('0x2c')](handleError(_0x531118,null));};exports[_0xab07('0x3a')]=function(_0x175ca6,_0x57af74){return db[_0xab07('0x22')][_0xab07('0x3a')](_0x175ca6[_0xab07('0x3b')],{})[_0xab07('0x1a')](respondWithResult(_0x57af74,0xc9))[_0xab07('0x2c')](handleError(_0x57af74,null));};exports['update']=function(_0x30130b,_0x360811){if(_0x30130b['body']['id']){delete _0x30130b['body']['id'];}return db[_0xab07('0x22')][_0xab07('0x39')]({'where':{'id':_0x30130b[_0xab07('0x2f')]['id']}})['then'](handleEntityNotFound(_0x360811,null))[_0xab07('0x1a')](saveUpdates(_0x30130b[_0xab07('0x3b')],null))['then'](respondWithResult(_0x360811,null))[_0xab07('0x2c')](handleError(_0x360811,null));};exports[_0xab07('0x3c')]=function(_0x5212f3,_0x13378b){return db['OpenchannelInteraction'][_0xab07('0x39')]({'where':{'id':_0x5212f3[_0xab07('0x2f')]['id']}})[_0xab07('0x1a')](handleEntityNotFound(_0x13378b,null))['then'](removeEntity(_0x13378b,null))[_0xab07('0x2c')](handleError(_0x13378b,null));};exports[_0xab07('0x3d')]=function(_0x1c0d6b,_0x446244){return db[_0xab07('0x22')]['describe']()['then'](respondWithResult(_0x446244,null))['catch'](handleError(_0x446244,null));};exports[_0xab07('0x3e')]=function(_0x5d9eaf,_0x256140){return db[_0xab07('0x3f')][_0xab07('0x39')]({'where':{'id':_0x5d9eaf[_0xab07('0x2f')]['id']}})['then'](handleEntityNotFound(_0x256140,null))[_0xab07('0x1a')](function(_0x426f17){if(_0x426f17){return _0x426f17['addMessage'](_0x5d9eaf['body'][_0xab07('0x40')],_[_0xab07('0x41')](_0x5d9eaf[_0xab07('0x3b')],[_0xab07('0x40'),'id'])||{});}})[_0xab07('0x1a')](respondWithResult(_0x256140,null))['catch'](handleError(_0x256140,null));};exports[_0xab07('0x42')]=function(_0x8df069,_0x1c6ffa){var _0x8919bc={'raw':![],'where':{}};var _0x1ea879={};var _0x521bbb={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xab07('0x43')]({'where':{'id':_0x8df069[_0xab07('0x2f')]['id']}})[_0xab07('0x1a')](handleEntityNotFound(_0x1c6ffa,null))[_0xab07('0x1a')](function(_0x4f096f){if(_0x4f096f){_0x1ea879[_0xab07('0x30')]=_[_0xab07('0x31')](db[_0xab07('0x3f')]['rawAttributes']);_0x1ea879[_0xab07('0x2a')]=_[_0xab07('0x31')](_0x8df069[_0xab07('0x2a')]);_0x1ea879[_0xab07('0x32')]=_[_0xab07('0x33')](_0x1ea879['model'],_0x1ea879[_0xab07('0x2a')]);_0x8919bc['attributes']=_[_0xab07('0x33')](_0x1ea879['model'],qs[_0xab07('0x34')](_0x8df069[_0xab07('0x2a')]['fields']));_0x8919bc[_0xab07('0x35')]=_0x8919bc['attributes'][_0xab07('0x36')]?_0x8919bc[_0xab07('0x35')]:_0x1ea879[_0xab07('0x30')];if(!_0x8df069[_0xab07('0x2a')]['hasOwnProperty'](_0xab07('0x44'))){_0x8919bc['limit']=qs[_0xab07('0x15')](_0x8df069[_0xab07('0x2a')][_0xab07('0x15')]);_0x8919bc['offset']=qs[_0xab07('0x13')](_0x8df069['query']['offset']);}_0x8919bc['order']=qs[_0xab07('0x45')](_0x8df069[_0xab07('0x2a')][_0xab07('0x45')]);_0x8919bc[_0xab07('0x46')]=qs[_0xab07('0x32')](_[_0xab07('0x47')](_0x8df069[_0xab07('0x2a')],_0x1ea879[_0xab07('0x32')]));_0x8919bc['where'][_0xab07('0x48')]=_0x4f096f['id'];if(_0x8df069[_0xab07('0x2a')]['filter']){_0x8919bc[_0xab07('0x46')]=_[_0xab07('0x37')](_0x8919bc[_0xab07('0x46')],{'$or':_[_0xab07('0x21')](_0x8919bc[_0xab07('0x35')],function(_0x42369b){var _0x3bddd0={};_0x3bddd0[_0x42369b]={'$like':'%'+_0x8df069['query']['filter']+'%'};return _0x3bddd0;})});}if(_0x8df069['query'][_0xab07('0x49')]){var _0x4b3b8c=_0x8df069[_0xab07('0x2a')][_0xab07('0x49')][_0xab07('0x4a')](',');var _0x72f9dc={};_0x72f9dc[_0x4b3b8c[0x0]]={'$gte':moment(_0x4b3b8c[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x8919bc[_0xab07('0x46')]=_[_0xab07('0x37')](_0x8919bc[_0xab07('0x46')],_0x72f9dc);}_0x8919bc=_['merge']({},_0x8919bc,_0x8df069[_0xab07('0x38')]);return db[_0xab07('0x3f')][_0xab07('0x16')]({'where':_0x8919bc['where']})[_0xab07('0x1a')](function(_0x5d6a97){_0x521bbb[_0xab07('0x16')]=_0x5d6a97;if(_0x8df069[_0xab07('0x2a')][_0xab07('0x4b')]){_0x8919bc[_0xab07('0x4c')]=[{'all':!![]}];}return db[_0xab07('0x3f')][_0xab07('0x28')](_0x8919bc);})['then'](function(_0x6b7766){_0x521bbb[_0xab07('0x4d')]=_0x6b7766;return _0x521bbb;});}})[_0xab07('0x1a')](respondWithFilteredResult(_0x1c6ffa,_0x8919bc))[_0xab07('0x2c')](handleError(_0x1c6ffa,null));};exports[_0xab07('0x4e')]=function(_0x3707b6,_0x5e7ee9){return db['OpenchannelInteraction'][_0xab07('0x39')]({'where':{'id':_0x3707b6[_0xab07('0x2f')]['id']}})[_0xab07('0x1a')](handleEntityNotFound(_0x5e7ee9,null))[_0xab07('0x1a')](function(_0x49e955){if(_0x49e955){return _0x49e955[_0xab07('0x4f')](_0x3707b6[_0xab07('0x3b')]['ids'],_['omit'](_0x3707b6['body'],[_0xab07('0x40'),'id'])||{})[_0xab07('0x50')](function(){return db['Tag'][_0xab07('0x28')]({'attributes':['id',_0xab07('0x1e'),_0xab07('0x51')],'where':{'id':_0x3707b6['body'][_0xab07('0x40')]}});})[_0xab07('0x1a')](function(_0x3bffb7){socket[_0xab07('0x52')](_0xab07('0x53'),{'id':Number(_0x3707b6[_0xab07('0x2f')]['id']),'tags':_0x3bffb7||[]});return{'id':Number(_0x3707b6[_0xab07('0x2f')]['id']),'tags':_0x3bffb7||[]};});}})[_0xab07('0x1a')](respondWithResult(_0x5e7ee9,null))[_0xab07('0x2c')](handleError(_0x5e7ee9,null));};exports[_0xab07('0x54')]=function(_0x4fbfd4,_0x392dc8){return db[_0xab07('0x22')][_0xab07('0x39')]({'where':{'id':_0x4fbfd4[_0xab07('0x2f')]['id']}})[_0xab07('0x1a')](handleEntityNotFound(_0x392dc8,null))['then'](function(_0x2c2e2e){if(_0x2c2e2e){return _0x2c2e2e[_0xab07('0x54')](_0x4fbfd4[_0xab07('0x2a')]['ids']);}})[_0xab07('0x1a')](respondWithStatusCode(_0x392dc8,null))[_0xab07('0x2c')](handleError(_0x392dc8,null));};exports[_0xab07('0x55')]=function(_0x4f9a59,_0x1a8e09){var _0xbd113c=moment()[_0xab07('0x56')]()[_0xab07('0x57')]();var _0xea9762=path[_0xab07('0x58')](config[_0xab07('0x59')],_0xab07('0x5a'),_0xab07('0x5b'),'tmp');var _0x555916=path[_0xab07('0x58')](config['root'],'server','files',_0xab07('0x5c'));var _0x26902a=path['join'](_0xea9762,_0xbd113c);var _0x3fca7c=util[_0xab07('0x5d')](_0xab07('0x5e'),_0x4f9a59[_0xab07('0x2f')]['id'],_0xbd113c);var _0xaf4f6a=path[_0xab07('0x58')](_0xea9762,_0x3fca7c);var _0xcd61e7=[];_0xcd61e7['push']({'model':db[_0xab07('0x5f')],'as':_0xab07('0x5f'),'attributes':['id',_0xab07('0x60')],'raw':!![]});_0xcd61e7['push']({'model':db['CmContact'],'as':_0xab07('0x61'),'attributes':['id',_0xab07('0x62'),_0xab07('0x63')],'raw':!![]});if(_0x4f9a59[_0xab07('0x2a')][_0xab07('0x5c')]){_0xcd61e7[_0xab07('0x64')]({'model':db['Attachment'],'as':_0xab07('0x65'),'raw':!![]});}var _0x48eb1e=[{'model':db[_0xab07('0x3f')],'as':_0xab07('0x66'),'attributes':['id',_0xab07('0x3b'),_0xab07('0x67'),_0xab07('0x68'),_0xab07('0x69'),_0xab07('0x6a')],'include':_0xcd61e7}];_0x48eb1e[_0xab07('0x64')]({'model':db[_0xab07('0x6b')],'as':'Account','attributes':['id',_0xab07('0x1e')]});_0x48eb1e[_0xab07('0x64')]({'model':db[_0xab07('0x5f')],'as':_0xab07('0x6c'),'attributes':['id','fullname']});return db[_0xab07('0x22')][_0xab07('0x39')]({'where':{'id':_0x4f9a59[_0xab07('0x2f')]['id']},'include':_0x48eb1e})['then'](handleEntityNotFound(_0x1a8e09,null))[_0xab07('0x1a')](function(_0x30c953){if(_0x30c953){var _0x2eb3ed=_0x30c953[_0xab07('0x6d')]({'plain':!![]});fs[_0xab07('0x6e')](_0x26902a);var _0x18c2ed={'channel':_0xab07('0x6f'),'account':_0x2eb3ed['Account'][_0xab07('0x1e')],'agent':_0x2eb3ed['Owner']?_0x2eb3ed[_0xab07('0x6c')][_0xab07('0x60')]:_0xab07('0x70'),'createdAt':moment(_0x2eb3ed[_0xab07('0x67')])[_0xab07('0x5d')](_0xab07('0x71'))['toString'](),'closedAt':_0x2eb3ed[_0xab07('0x72')]?moment(_0x2eb3ed[_0xab07('0x73')])['format'](_0xab07('0x71'))[_0xab07('0x57')]():'','disposition':_0x2eb3ed[_0xab07('0x74')],'visibility':_0x2eb3ed[_0xab07('0x75')]?_0xab07('0x76'):_0xab07('0x77'),'messages':_(_0x2eb3ed['Messages'])[_0xab07('0x78')]({'secret':![]})[_0xab07('0x21')](function(_0x47fdf6){if(_0x47fdf6[_0xab07('0x65')]){var _0xb641c=path[_0xab07('0x58')](_0x555916,_0x47fdf6[_0xab07('0x65')][_0xab07('0x79')]);if(fs[_0xab07('0x7a')](_0xb641c)){fs[_0xab07('0x7b')](_0xb641c)['pipe'](fs[_0xab07('0x7c')](path[_0xab07('0x58')](_0x26902a,_0x47fdf6['Attachment']['basename'])));}}return{'date':moment(_0x47fdf6[_0xab07('0x67')])[_0xab07('0x5d')]('YYYY-MM-DD\x20HH:mm:ss')[_0xab07('0x57')](),'sender':_0x47fdf6[_0xab07('0x68')]==='out'?_0x47fdf6[_0xab07('0x5f')]?_0x47fdf6[_0xab07('0x5f')][_0xab07('0x60')]:_0xab07('0x7d'):_0x47fdf6['Contact']['firstName']+(_0x47fdf6[_0xab07('0x61')][_0xab07('0x63')]?'\x20'+_0x47fdf6['Contact']['lastName']:''),'body':_0x47fdf6[_0xab07('0x65')]?_0x47fdf6['Attachment'][_0xab07('0x79')]:_0x47fdf6[_0xab07('0x3b')],'direction':_0x47fdf6[_0xab07('0x68')]===_0xab07('0x7e')?'A':'C','secret':_0x47fdf6[_0xab07('0x69')],'read':_0x47fdf6['read'],'attachment':_0x47fdf6[_0xab07('0x65')]};})[_0xab07('0x7f')]()};return ejs[_0xab07('0x80')](path[_0xab07('0x58')](config[_0xab07('0x59')],_0xab07('0x5a'),_0xab07('0x81'),'downloadInteraction.ejs'),{'interaction':_0x18c2ed})[_0xab07('0x1a')](function(_0x21099a){var _0x412ea2=path['join'](_0x26902a,_0xab07('0x82')+_0x2eb3ed['id']+'-'+_0xbd113c+_0xab07('0x83'));var _0x412f0a={'path':_0x412ea2,'channel':_0xab07('0x6f'),'interactionId':_0x2eb3ed['id']};return pdf['createPdfFromHTML'](_0x21099a,_0x412f0a);})[_0xab07('0x1a')](function(){return new Promise(function(_0x4610d4,_0x31b5b5){zipdir(_0x26902a,{'saveTo':_0xaf4f6a},function(_0x451baf,_0xc98728){if(_0x451baf)return _0x31b5b5(_0x451baf);return _0x4610d4(_0xc98728);});})['then'](function(){return new Promise(function(_0x422a6d,_0x422fcd){rimraf(_0x26902a,function(_0x2d584d){if(_0x2d584d)_0x422fcd(_0x2d584d);return _0x422a6d();});});})['then'](function(){return _0x1a8e09['download'](_0xaf4f6a,_0x3fca7c,function(_0x179dc7){if(_0x179dc7){logger[_0xab07('0x1c')]('Unable\x20to\x20delete\x20zip\x20file',_0x179dc7);}else{fs[_0xab07('0x84')](_0xaf4f6a);}});});});}else{return _0x1a8e09[_0xab07('0x1b')](0xc8);}})[_0xab07('0x2c')](handleError(_0x1a8e09,null));}; \ No newline at end of file +var _0x6455=['undefined','count','set','Content-Range','update','destroy','then','error','stack','name','index','rawAttributes','fieldName','openchannel','query','user','catch','show','type','from','params','model','OpenchannelInteraction','filters','intersection','attributes','fields','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','omit','ids','findOne','keys','length','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','rows','addTags','setTags','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','User','fullname','push','Contact','firstName','Attachment','Messages','createdAt','direction','OpenchannelAccount','Account','get','mkdirSync','Openchannel','Owner','N.A.','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','out','System','lastName','secret','read','value','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit'];(function(_0x2f9bb4,_0x38044c){var _0x209169=function(_0x113334){while(--_0x113334){_0x2f9bb4['push'](_0x2f9bb4['shift']());}};_0x209169(++_0x38044c);}(_0x6455,0xed));var _0x5645=function(_0x19ed77,_0x277e2c){_0x19ed77=_0x19ed77-0x0;var _0x2d558a=_0x6455[_0x19ed77];return _0x2d558a;};'use strict';var rimraf=require(_0x5645('0x0'));var zipdir=require(_0x5645('0x1'));var moment=require(_0x5645('0x2'));var util=require(_0x5645('0x3'));var path=require(_0x5645('0x4'));var ejs=require(_0x5645('0x5'));var fs=require('fs');var _=require(_0x5645('0x6'));var Redis=require('ioredis');var interaction=require(_0x5645('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x5645('0x8'));var logger=require(_0x5645('0x9'))('api');var config=require(_0x5645('0xa'));var db=require('../../mysqldb')['db'];config[_0x5645('0xb')]=_[_0x5645('0xc')](config[_0x5645('0xb')],{'host':_0x5645('0xd'),'port':0x18eb});var socket=require(_0x5645('0xe'))(new Redis(config[_0x5645('0xb')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x5dc19b,_0x226b8c){_0x226b8c=_0x226b8c||0xcc;return function(_0x565e19){if(_0x565e19){return _0x5dc19b[_0x5645('0xf')](_0x226b8c);}return _0x5dc19b[_0x5645('0x10')](_0x226b8c)[_0x5645('0x11')]();};}function respondWithResult(_0x3db483,_0x3b63a4){_0x3b63a4=_0x3b63a4||0xc8;return function(_0xd0442){if(_0xd0442){return _0x3db483[_0x5645('0x10')](_0x3b63a4)[_0x5645('0x12')](_0xd0442);}};}function respondWithFilteredResult(_0x413d1,_0xe147d4){return function(_0x33e109){if(_0x33e109){var _0x43c6c6=typeof _0xe147d4[_0x5645('0x13')]==='undefined'&&typeof _0xe147d4[_0x5645('0x14')]===_0x5645('0x15');var _0x54dbc1=_0x33e109[_0x5645('0x16')];var _0x4a9b24=_0x43c6c6?0x0:_0xe147d4[_0x5645('0x13')];var _0x52b0c6=_0x43c6c6?_0x33e109[_0x5645('0x16')]:_0xe147d4[_0x5645('0x13')]+_0xe147d4[_0x5645('0x14')];var _0x5638cb;if(_0x52b0c6>=_0x54dbc1){_0x52b0c6=_0x54dbc1;_0x5638cb=0xc8;}else{_0x5638cb=0xce;}_0x413d1[_0x5645('0x10')](_0x5638cb);return _0x413d1[_0x5645('0x17')](_0x5645('0x18'),_0x4a9b24+'-'+_0x52b0c6+'/'+_0x54dbc1)[_0x5645('0x12')](_0x33e109);}return null;};}function saveUpdates(_0x4c3375){return function(_0x2e5764){if(_0x2e5764){return _0x2e5764[_0x5645('0x19')](_0x4c3375)['then'](function(_0x20fd08){return _0x20fd08;});}return null;};}function removeEntity(_0x1e97bc){return function(_0x3de1be){if(_0x3de1be){return _0x3de1be[_0x5645('0x1a')]()[_0x5645('0x1b')](function(){_0x1e97bc[_0x5645('0x10')](0xcc)[_0x5645('0x11')]();});}};}function handleEntityNotFound(_0xcad68b){return function(_0x1cddbb){if(!_0x1cddbb){_0xcad68b[_0x5645('0xf')](0x194);}return _0x1cddbb;};}function handleError(_0x4e337a,_0x86d51a){_0x86d51a=_0x86d51a||0x1f4;return function(_0x34bbbd){logger[_0x5645('0x1c')](_0x34bbbd[_0x5645('0x1d')]);if(_0x34bbbd[_0x5645('0x1e')]){delete _0x34bbbd[_0x5645('0x1e')];}_0x4e337a[_0x5645('0x10')](_0x86d51a)['send'](_0x34bbbd);};}exports[_0x5645('0x1f')]=function(_0xdae9d9,_0x11815e){var _0x50e5de={};var _0x1243bc=_['map'](db['OpenchannelInteraction'][_0x5645('0x20')],function(_0x3b6ef8){return{'name':_0x3b6ef8[_0x5645('0x21')],'type':_0x3b6ef8['type']['key']};});_0x50e5de=qs['getOptions'](_0x1243bc,_0xdae9d9);return interaction['findAll'](_0x5645('0x22'),_0xdae9d9[_0x5645('0x23')],_0xdae9d9[_0x5645('0x24')],_0x50e5de,_0x1243bc)[_0x5645('0x1b')](respondWithFilteredResult(_0x11815e,_0x50e5de))[_0x5645('0x25')](handleError(_0x11815e,null));};exports[_0x5645('0x26')]=function(_0x222077,_0x4e2aad){var _0xb951c9={};if(_0x222077[_0x5645('0x23')][_0x5645('0x27')]&&_0x222077[_0x5645('0x23')][_0x5645('0x27')]===_0x5645('0x28')){_0xb951c9[_0x5645('0x28')]=_0x222077[_0x5645('0x29')]['id'];}else{_0xb951c9['id']=_0x222077['params']['id'];}var _0x2df296={'raw':![],'where':_0xb951c9},_0x3b665a={};_0x3b665a[_0x5645('0x2a')]=_['keys'](db[_0x5645('0x2b')][_0x5645('0x20')]);_0x3b665a[_0x5645('0x23')]=_['keys'](_0x222077[_0x5645('0x23')]);_0x3b665a[_0x5645('0x2c')]=_[_0x5645('0x2d')](_0x3b665a[_0x5645('0x2a')],_0x3b665a['query']);_0x2df296[_0x5645('0x2e')]=_[_0x5645('0x2d')](_0x3b665a[_0x5645('0x2a')],qs[_0x5645('0x2f')](_0x222077[_0x5645('0x23')][_0x5645('0x2f')]));_0x2df296[_0x5645('0x2e')]=_0x2df296[_0x5645('0x2e')]['length']?_0x2df296[_0x5645('0x2e')]:_0x3b665a[_0x5645('0x2a')];if(_0x222077['query']['includeAll']){_0x2df296['include']=[{'all':!![]}];}_0x2df296=_[_0x5645('0x30')]({},_0x2df296,_0x222077[_0x5645('0x31')]);return db[_0x5645('0x2b')][_0x5645('0x32')](_0x2df296)[_0x5645('0x1b')](handleEntityNotFound(_0x4e2aad,null))[_0x5645('0x1b')](respondWithResult(_0x4e2aad,null))[_0x5645('0x25')](handleError(_0x4e2aad,null));};exports[_0x5645('0x33')]=function(_0xa27321,_0x3858ab){return db['OpenchannelInteraction'][_0x5645('0x33')](_0xa27321[_0x5645('0x34')],{})[_0x5645('0x1b')](respondWithResult(_0x3858ab,0xc9))[_0x5645('0x25')](handleError(_0x3858ab,null));};exports[_0x5645('0x19')]=function(_0x5e03c6,_0x2f9c23){if(_0x5e03c6['body']['id']){delete _0x5e03c6[_0x5645('0x34')]['id'];}return db[_0x5645('0x2b')]['find']({'where':{'id':_0x5e03c6[_0x5645('0x29')]['id']}})['then'](handleEntityNotFound(_0x2f9c23,null))['then'](saveUpdates(_0x5e03c6[_0x5645('0x34')],null))[_0x5645('0x1b')](respondWithResult(_0x2f9c23,null))['catch'](handleError(_0x2f9c23,null));};exports[_0x5645('0x1a')]=function(_0x25f41e,_0x19a9fd){return db[_0x5645('0x2b')][_0x5645('0x32')]({'where':{'id':_0x25f41e[_0x5645('0x29')]['id']}})[_0x5645('0x1b')](handleEntityNotFound(_0x19a9fd,null))[_0x5645('0x1b')](removeEntity(_0x19a9fd,null))[_0x5645('0x25')](handleError(_0x19a9fd,null));};exports[_0x5645('0x35')]=function(_0x14dcf4,_0x2c20a4){return db[_0x5645('0x2b')][_0x5645('0x35')]()['then'](respondWithResult(_0x2c20a4,null))[_0x5645('0x25')](handleError(_0x2c20a4,null));};exports[_0x5645('0x36')]=function(_0x137e53,_0x46572b){return db[_0x5645('0x37')][_0x5645('0x32')]({'where':{'id':_0x137e53[_0x5645('0x29')]['id']}})['then'](handleEntityNotFound(_0x46572b,null))[_0x5645('0x1b')](function(_0x33516f){if(_0x33516f){return _0x33516f[_0x5645('0x36')](_0x137e53[_0x5645('0x34')]['ids'],_[_0x5645('0x38')](_0x137e53[_0x5645('0x34')],[_0x5645('0x39'),'id'])||{});}})[_0x5645('0x1b')](respondWithResult(_0x46572b,null))[_0x5645('0x25')](handleError(_0x46572b,null));};exports['getMessages']=function(_0x3d47c5,_0x1e93f1){var _0x596fa1={'raw':![],'where':{}};var _0x35cc02={};var _0x466711={'count':0x0,'rows':[]};return db[_0x5645('0x2b')][_0x5645('0x3a')]({'where':{'id':_0x3d47c5[_0x5645('0x29')]['id']}})['then'](handleEntityNotFound(_0x1e93f1,null))[_0x5645('0x1b')](function(_0x13a60b){if(_0x13a60b){_0x35cc02[_0x5645('0x2a')]=_[_0x5645('0x3b')](db[_0x5645('0x37')][_0x5645('0x20')]);_0x35cc02[_0x5645('0x23')]=_[_0x5645('0x3b')](_0x3d47c5['query']);_0x35cc02[_0x5645('0x2c')]=_[_0x5645('0x2d')](_0x35cc02[_0x5645('0x2a')],_0x35cc02[_0x5645('0x23')]);_0x596fa1[_0x5645('0x2e')]=_[_0x5645('0x2d')](_0x35cc02[_0x5645('0x2a')],qs['fields'](_0x3d47c5[_0x5645('0x23')][_0x5645('0x2f')]));_0x596fa1['attributes']=_0x596fa1['attributes'][_0x5645('0x3c')]?_0x596fa1[_0x5645('0x2e')]:_0x35cc02[_0x5645('0x2a')];if(!_0x3d47c5['query'][_0x5645('0x3d')](_0x5645('0x3e'))){_0x596fa1['limit']=qs[_0x5645('0x14')](_0x3d47c5[_0x5645('0x23')][_0x5645('0x14')]);_0x596fa1['offset']=qs['offset'](_0x3d47c5['query'][_0x5645('0x13')]);}_0x596fa1[_0x5645('0x3f')]=qs[_0x5645('0x40')](_0x3d47c5[_0x5645('0x23')][_0x5645('0x40')]);_0x596fa1[_0x5645('0x41')]=qs[_0x5645('0x2c')](_[_0x5645('0x42')](_0x3d47c5['query'],_0x35cc02[_0x5645('0x2c')]));_0x596fa1[_0x5645('0x41')][_0x5645('0x43')]=_0x13a60b['id'];if(_0x3d47c5['query'][_0x5645('0x44')]){_0x596fa1['where']=_[_0x5645('0x30')](_0x596fa1['where'],{'$or':_['map'](_0x596fa1[_0x5645('0x2e')],function(_0x518eba){var _0x11c4c7={};_0x11c4c7[_0x518eba]={'$like':'%'+_0x3d47c5['query'][_0x5645('0x44')]+'%'};return _0x11c4c7;})});}if(_0x3d47c5[_0x5645('0x23')][_0x5645('0x45')]){var _0x3bad29=_0x3d47c5[_0x5645('0x23')][_0x5645('0x45')]['split'](',');var _0x21e09b={};_0x21e09b[_0x3bad29[0x0]]={'$gte':moment(_0x3bad29[0x1])[_0x5645('0x46')](_0x5645('0x47'))};_0x596fa1['where']=_[_0x5645('0x30')](_0x596fa1['where'],_0x21e09b);}_0x596fa1=_[_0x5645('0x30')]({},_0x596fa1,_0x3d47c5[_0x5645('0x31')]);return db[_0x5645('0x37')][_0x5645('0x16')]({'where':_0x596fa1['where']})['then'](function(_0x208384){_0x466711[_0x5645('0x16')]=_0x208384;if(_0x3d47c5['query'][_0x5645('0x48')]){_0x596fa1[_0x5645('0x49')]=[{'all':!![]}];}return db[_0x5645('0x37')][_0x5645('0x4a')](_0x596fa1);})[_0x5645('0x1b')](function(_0x1b8f20){_0x466711[_0x5645('0x4b')]=_0x1b8f20;return _0x466711;});}})[_0x5645('0x1b')](respondWithFilteredResult(_0x1e93f1,_0x596fa1))[_0x5645('0x25')](handleError(_0x1e93f1,null));};exports[_0x5645('0x4c')]=function(_0xed5745,_0x1d5a99){return db[_0x5645('0x2b')][_0x5645('0x32')]({'where':{'id':_0xed5745[_0x5645('0x29')]['id']}})['then'](handleEntityNotFound(_0x1d5a99,null))['then'](function(_0xf771df){if(_0xf771df){return _0xf771df[_0x5645('0x4d')](_0xed5745[_0x5645('0x34')][_0x5645('0x39')],_[_0x5645('0x38')](_0xed5745[_0x5645('0x34')],[_0x5645('0x39'),'id'])||{})['spread'](function(){return db[_0x5645('0x4e')][_0x5645('0x4a')]({'attributes':['id',_0x5645('0x1e'),_0x5645('0x4f')],'where':{'id':_0xed5745[_0x5645('0x34')]['ids']}});})['then'](function(_0xeccf59){socket[_0x5645('0x50')](_0x5645('0x51'),{'id':Number(_0xed5745['params']['id']),'tags':_0xeccf59||[]});return{'id':Number(_0xed5745[_0x5645('0x29')]['id']),'tags':_0xeccf59||[]};});}})[_0x5645('0x1b')](respondWithResult(_0x1d5a99,null))[_0x5645('0x25')](handleError(_0x1d5a99,null));};exports[_0x5645('0x52')]=function(_0x1f3616,_0x4d6390){return db['OpenchannelInteraction'][_0x5645('0x32')]({'where':{'id':_0x1f3616[_0x5645('0x29')]['id']}})['then'](handleEntityNotFound(_0x4d6390,null))[_0x5645('0x1b')](function(_0x33bfd9){if(_0x33bfd9){return _0x33bfd9[_0x5645('0x52')](_0x1f3616[_0x5645('0x23')]['ids']);}})[_0x5645('0x1b')](respondWithStatusCode(_0x4d6390,null))[_0x5645('0x25')](handleError(_0x4d6390,null));};exports[_0x5645('0x53')]=function(_0x467afb,_0x3dcb78){var _0x1b893a=moment()['unix']()[_0x5645('0x54')]();var _0x3b6c48=path[_0x5645('0x55')](config[_0x5645('0x56')],'server',_0x5645('0x57'),_0x5645('0x58'));var _0x1fad87=path['join'](config[_0x5645('0x56')],_0x5645('0x59'),_0x5645('0x57'),_0x5645('0x5a'));var _0x588e38=path['join'](_0x3b6c48,_0x1b893a);var _0x114e02=util[_0x5645('0x46')](_0x5645('0x5b'),_0x467afb[_0x5645('0x29')]['id'],_0x1b893a);var _0x37876a=path[_0x5645('0x55')](_0x3b6c48,_0x114e02);var _0x616cb6=[];_0x616cb6['push']({'model':db['User'],'as':_0x5645('0x5c'),'attributes':['id',_0x5645('0x5d')],'raw':!![]});_0x616cb6[_0x5645('0x5e')]({'model':db['CmContact'],'as':_0x5645('0x5f'),'attributes':['id',_0x5645('0x60'),'lastName'],'raw':!![]});if(_0x467afb['query']['attachments']){_0x616cb6['push']({'model':db[_0x5645('0x61')],'as':_0x5645('0x61'),'raw':!![]});}var _0x3a47b5=[{'model':db[_0x5645('0x37')],'as':_0x5645('0x62'),'attributes':['id',_0x5645('0x34'),_0x5645('0x63'),_0x5645('0x64'),'secret','read'],'include':_0x616cb6}];_0x3a47b5[_0x5645('0x5e')]({'model':db[_0x5645('0x65')],'as':_0x5645('0x66'),'attributes':['id',_0x5645('0x1e')]});_0x3a47b5[_0x5645('0x5e')]({'model':db[_0x5645('0x5c')],'as':'Owner','attributes':['id','fullname']});return db[_0x5645('0x2b')][_0x5645('0x32')]({'where':{'id':_0x467afb['params']['id']},'include':_0x3a47b5})[_0x5645('0x1b')](handleEntityNotFound(_0x3dcb78,null))[_0x5645('0x1b')](function(_0x25a4c6){if(_0x25a4c6){var _0x569dc1=_0x25a4c6[_0x5645('0x67')]({'plain':!![]});fs[_0x5645('0x68')](_0x588e38);var _0x4ab4f9={'channel':_0x5645('0x69'),'account':_0x569dc1[_0x5645('0x66')]['name'],'agent':_0x569dc1[_0x5645('0x6a')]?_0x569dc1[_0x5645('0x6a')][_0x5645('0x5d')]:_0x5645('0x6b'),'createdAt':moment(_0x569dc1[_0x5645('0x63')])[_0x5645('0x46')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5645('0x54')](),'closedAt':_0x569dc1[_0x5645('0x6c')]?moment(_0x569dc1[_0x5645('0x6d')])[_0x5645('0x46')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5645('0x54')]():'','disposition':_0x569dc1[_0x5645('0x6e')],'visibility':_0x569dc1[_0x5645('0x6f')]?_0x5645('0x70'):_0x5645('0x71'),'messages':_(_0x569dc1[_0x5645('0x62')])[_0x5645('0x44')]({'secret':![]})['map'](function(_0x4ccfbb){if(_0x4ccfbb[_0x5645('0x61')]){var _0x2cea4c=path[_0x5645('0x55')](_0x1fad87,_0x4ccfbb[_0x5645('0x61')][_0x5645('0x72')]);if(fs[_0x5645('0x73')](_0x2cea4c)){fs[_0x5645('0x74')](_0x2cea4c)[_0x5645('0x75')](fs['createWriteStream'](path[_0x5645('0x55')](_0x588e38,_0x4ccfbb[_0x5645('0x61')][_0x5645('0x72')])));}}return{'date':moment(_0x4ccfbb['createdAt'])['format'](_0x5645('0x47'))[_0x5645('0x54')](),'sender':_0x4ccfbb[_0x5645('0x64')]===_0x5645('0x76')?_0x4ccfbb[_0x5645('0x5c')]?_0x4ccfbb[_0x5645('0x5c')]['fullname']:_0x5645('0x77'):_0x4ccfbb[_0x5645('0x5f')][_0x5645('0x60')]+(_0x4ccfbb['Contact'][_0x5645('0x78')]?'\x20'+_0x4ccfbb[_0x5645('0x5f')]['lastName']:''),'body':_0x4ccfbb[_0x5645('0x61')]?_0x4ccfbb[_0x5645('0x61')][_0x5645('0x72')]:_0x4ccfbb[_0x5645('0x34')],'direction':_0x4ccfbb[_0x5645('0x64')]==='out'?'A':'C','secret':_0x4ccfbb[_0x5645('0x79')],'read':_0x4ccfbb[_0x5645('0x7a')],'attachment':_0x4ccfbb[_0x5645('0x61')]};})[_0x5645('0x7b')]()};return ejs[_0x5645('0x7c')](path[_0x5645('0x55')](config['root'],_0x5645('0x59'),_0x5645('0x7d'),_0x5645('0x7e')),{'interaction':_0x4ab4f9})['then'](function(_0x199513){var _0x55a0f7=path[_0x5645('0x55')](_0x588e38,'transcript-'+_0x569dc1['id']+'-'+_0x1b893a+'.pdf');var _0x55496a={'path':_0x55a0f7,'channel':_0x5645('0x69'),'interactionId':_0x569dc1['id']};return pdf[_0x5645('0x7f')](_0x199513,_0x55496a);})['then'](function(){return new Promise(function(_0x2e1b46,_0x267b81){zipdir(_0x588e38,{'saveTo':_0x37876a},function(_0x3fe4f8,_0x56f9f0){if(_0x3fe4f8)return _0x267b81(_0x3fe4f8);return _0x2e1b46(_0x56f9f0);});})['then'](function(){return new Promise(function(_0x4e7f46,_0x1bd100){rimraf(_0x588e38,function(_0x54d2ca){if(_0x54d2ca)_0x1bd100(_0x54d2ca);return _0x4e7f46();});});})[_0x5645('0x1b')](function(){return _0x3dcb78[_0x5645('0x53')](_0x37876a,_0x114e02,function(_0x367630){if(_0x367630){logger['error']('Unable\x20to\x20delete\x20zip\x20file',_0x367630);}else{fs[_0x5645('0x80')](_0x37876a);}});});});}else{return _0x3dcb78[_0x5645('0xf')](0xc8);}})[_0x5645('0x25')](handleError(_0x3dcb78,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 70a69c7..17f1099 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 _0x7016=['events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports'];(function(_0x26db9c,_0x454d51){var _0x7ced1d=function(_0x52474a){while(--_0x52474a){_0x26db9c['push'](_0x26db9c['shift']());}};_0x7ced1d(++_0x454d51);}(_0x7016,0xc6));var _0x6701=function(_0xca8072,_0x33733b){_0xca8072=_0xca8072-0x0;var _0xb85575=_0x7016[_0xca8072];return _0xb85575;};'use strict';var EventEmitter=require(_0x6701('0x0'));var OpenchannelInteraction=require(_0x6701('0x1'))['db'][_0x6701('0x2')];var OpenchannelMessage=require(_0x6701('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x6701('0x3')](0x0);var events={'afterCreate':_0x6701('0x4'),'afterUpdate':_0x6701('0x5'),'afterDestroy':_0x6701('0x6')};function emitEvent(_0x532fb5){return function(_0xab78cb,_0x42d492,_0x22059e){_0xab78cb[_0x6701('0x7')]({'attributes':['id'],'raw':!![]})[_0x6701('0x8')](function(_0x2f0e24){_0xab78cb[_0x6701('0x9')](_0x6701('0xa'),_0x2f0e24['map'](function(_0x501b30){return{'id':_0x501b30['id']};}));return OpenchannelMessage[_0x6701('0xb')]({'where':{'OpenchannelInteractionId':_0xab78cb['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x57979f){_0xab78cb[_0x6701('0x9')](_0x6701('0xc'),_0x57979f[_0x6701('0xd')]);OpenchannelInteractionEvents[_0x6701('0xe')](_0x532fb5+':'+_0xab78cb['id'],_0xab78cb);OpenchannelInteractionEvents[_0x6701('0xe')](_0x532fb5,_0xab78cb);_0x22059e(null);})['catch'](_0x22059e(null));};}for(var e in events){if(events[_0x6701('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x6701('0x10')](e,emitEvent(event));}}module[_0x6701('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x87ac=['findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','save','update','remove','then','Users','map'];(function(_0x830fb0,_0x2c1567){var _0x36a91e=function(_0x3e2ad1){while(--_0x3e2ad1){_0x830fb0['push'](_0x830fb0['shift']());}};_0x36a91e(++_0x2c1567);}(_0x87ac,0x16d));var _0xc87a=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0x87ac[_0x4bd06e];return _0x85ebb;};'use strict';var EventEmitter=require(_0xc87a('0x0'));var OpenchannelInteraction=require(_0xc87a('0x1'))['db'][_0xc87a('0x2')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc87a('0x3'),'afterUpdate':_0xc87a('0x4'),'afterDestroy':_0xc87a('0x5')};function emitEvent(_0x4f8467){return function(_0x10171f,_0x7adb66,_0x391396){_0x10171f['getUsers']({'attributes':['id'],'raw':!![]})[_0xc87a('0x6')](function(_0x386657){_0x10171f['setDataValue'](_0xc87a('0x7'),_0x386657[_0xc87a('0x8')](function(_0x48884e){return{'id':_0x48884e['id']};}));return OpenchannelMessage[_0xc87a('0x9')]({'where':{'OpenchannelInteractionId':_0x10171f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc87a('0x6')](function(_0x5716a3){_0x10171f[_0xc87a('0xa')](_0xc87a('0xb'),_0x5716a3[_0xc87a('0xc')]);OpenchannelInteractionEvents[_0xc87a('0xd')](_0x4f8467+':'+_0x10171f['id'],_0x10171f);OpenchannelInteractionEvents['emit'](_0x4f8467,_0x10171f);_0x391396(null);})['catch'](_0x391396(null));};}for(var e in events){if(events[_0xc87a('0xe')](e)){var event=events[e];OpenchannelInteraction[_0xc87a('0xf')](e,emitEvent(event));}}module[_0xc87a('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index a2db8df..645c429 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 _0x4655=['../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x44383f,_0x1a2522){var _0x4b9b48=function(_0x4e5f12){while(--_0x4e5f12){_0x44383f['push'](_0x44383f['shift']());}};_0x4b9b48(++_0x1a2522);}(_0x4655,0x70));var _0x5465=function(_0x2f66a8,_0x281a9d){_0x2f66a8=_0x2f66a8-0x0;var _0x389b4f=_0x4655[_0x2f66a8];return _0x389b4f;};'use strict';var _=require(_0x5465('0x0'));var util=require(_0x5465('0x1'));var logger=require('../../config/logger')(_0x5465('0x2'));var moment=require(_0x5465('0x3'));var BPromise=require(_0x5465('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5465('0x5'));var rimraf=require(_0x5465('0x6'));var config=require(_0x5465('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0x5465('0x8')]=function(_0x5dfb6d,_0x2472ab){return _0x5dfb6d[_0x5465('0x9')](_0x5465('0xa'),attributes,{'tableName':_0x5465('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x42f294,_0x372692,_0x47794c){if(_0x42f294[_0x5465('0xc')](_0x5465('0xd'))){_0x42f294[_0x5465('0xe')]=moment()[_0x5465('0xf')](_0x5465('0x10'));}_0x47794c(null,_0x42f294);}}});}; \ No newline at end of file +var _0xfc9b=['define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./openchannelInteraction.attributes','exports'];(function(_0x54684f,_0x4af790){var _0x5d31aa=function(_0x35fd57){while(--_0x35fd57){_0x54684f['push'](_0x54684f['shift']());}};_0x5d31aa(++_0x4af790);}(_0xfc9b,0x74));var _0xbfc9=function(_0x388a56,_0x4ec231){_0x388a56=_0x388a56-0x0;var _0x2109b0=_0xfc9b[_0x388a56];return _0x2109b0;};'use strict';var _=require(_0xbfc9('0x0'));var util=require(_0xbfc9('0x1'));var logger=require(_0xbfc9('0x2'))(_0xbfc9('0x3'));var moment=require(_0xbfc9('0x4'));var BPromise=require(_0xbfc9('0x5'));var rp=require(_0xbfc9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbfc9('0x7'));var config=require('../../config/environment');var attributes=require(_0xbfc9('0x8'));module[_0xbfc9('0x9')]=function(_0x523ff1,_0x1dbece){return _0x523ff1[_0xbfc9('0xa')](_0xbfc9('0xb'),attributes,{'tableName':_0xbfc9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xbfc9('0xd'),'hooks':{'beforeUpdate':function(_0x57a087,_0x32bee5,_0x5073cf){if(_0x57a087[_0xbfc9('0xe')]('closed')){_0x57a087[_0xbfc9('0xf')]=moment()[_0xbfc9('0x10')](_0xbfc9('0x11'));}_0x5073cf(null,_0x57a087);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index db616c7..6181ce6 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 _0xbaac=['AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','info','catch','AddTagsToOpenchannelInteraction','find','ids','omit','spread'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xbaac,0x1da));var _0xcbaa=function(_0x1e3b29,_0x3fe8e7){_0x1e3b29=_0x1e3b29-0x0;var _0x4c7eb7=_0xbaac[_0x1e3b29];return _0x4c7eb7;};'use strict';var _=require(_0xcbaa('0x0'));var util=require(_0xcbaa('0x1'));var moment=require(_0xcbaa('0x2'));var BPromise=require(_0xcbaa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcbaa('0x4'));var db=require(_0xcbaa('0x5'))['db'];var utils=require(_0xcbaa('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xcbaa('0x7'));var jayson=require(_0xcbaa('0x8'));var client=jayson[_0xcbaa('0x9')][_0xcbaa('0xa')]({'port':0x232a});config['redis']=_[_0xcbaa('0xb')](config[_0xcbaa('0xc')],{'host':_0xcbaa('0xd'),'port':0x18eb});var socket=require(_0xcbaa('0xe'))(new Redis(config['redis']));require(_0xcbaa('0xf'))[_0xcbaa('0x10')](socket);function respondWithRpcPromise(_0x52f6a4,_0x5f5330,_0x5edf23){return new BPromise(function(_0x512f29,_0x189ad5){return client[_0xcbaa('0x11')](_0x52f6a4,_0x5edf23)[_0xcbaa('0x12')](function(_0x55395f){logger['info'](_0xcbaa('0x13'),_0x5f5330,_0xcbaa('0x14'));logger[_0xcbaa('0x15')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x5f5330,'request\x20sent',JSON[_0xcbaa('0x16')](_0x55395f));if(_0x55395f[_0xcbaa('0x17')]){if(_0x55395f[_0xcbaa('0x17')]['code']===0x1f4){logger[_0xcbaa('0x17')](_0xcbaa('0x13'),_0x5f5330,_0x55395f[_0xcbaa('0x17')][_0xcbaa('0x18')]);return _0x189ad5(_0x55395f['error']['message']);}logger[_0xcbaa('0x17')](_0xcbaa('0x13'),_0x5f5330,_0x55395f[_0xcbaa('0x17')]['message']);return _0x512f29(_0x55395f[_0xcbaa('0x17')][_0xcbaa('0x18')]);}else{logger['info'](_0xcbaa('0x13'),_0x5f5330,_0xcbaa('0x14'));_0x512f29(_0x55395f[_0xcbaa('0x19')][_0xcbaa('0x18')]);}})['catch'](function(_0x15cdf8){logger[_0xcbaa('0x17')](_0xcbaa('0x13'),_0x5f5330,_0x15cdf8);_0x189ad5(_0x15cdf8);});});}exports[_0xcbaa('0x1a')]=function(_0x471f75){var _0x532373=this;return new Promise(function(_0x170214,_0x5c4e2d){return db[_0xcbaa('0x1b')][_0xcbaa('0x1c')](_0x471f75[_0xcbaa('0x1d')],{'raw':_0x471f75['options']?_0x471f75[_0xcbaa('0x1e')][_0xcbaa('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x471f75['options']?_0x471f75[_0xcbaa('0x1e')][_0xcbaa('0x20')]||null:null,'attributes':_0x471f75[_0xcbaa('0x1e')]?_0x471f75[_0xcbaa('0x1e')][_0xcbaa('0x21')]||null:null,'limit':_0x471f75[_0xcbaa('0x1e')]?_0x471f75[_0xcbaa('0x1e')][_0xcbaa('0x22')]||null:null})[_0xcbaa('0x12')](function(_0x58f33c){logger[_0xcbaa('0x23')](_0xcbaa('0x1a'),_0x471f75);logger[_0xcbaa('0x15')](_0xcbaa('0x1a'),_0x471f75,JSON['stringify'](_0x58f33c));_0x170214(_0x58f33c);})[_0xcbaa('0x24')](function(_0xfa1b65){logger[_0xcbaa('0x17')](_0xcbaa('0x1a'),_0xfa1b65[_0xcbaa('0x18')],_0x471f75);_0x5c4e2d(_0x532373['error'](0x1f4,_0xfa1b65['message']));});});};exports[_0xcbaa('0x25')]=function(_0x770a31){return new Promise(function(_0x1f0f17,_0x3a2d08){return db[_0xcbaa('0x1b')][_0xcbaa('0x26')]({'where':_0x770a31[_0xcbaa('0x1e')]?_0x770a31[_0xcbaa('0x1e')][_0xcbaa('0x20')]||null:null})[_0xcbaa('0x12')](function(_0x48cd51){if(_0x48cd51){return _0x48cd51['addTags'](_0x770a31[_0xcbaa('0x1d')][_0xcbaa('0x27')],_[_0xcbaa('0x28')](_0x770a31[_0xcbaa('0x1d')],[_0xcbaa('0x27'),'id'])||{});}})[_0xcbaa('0x29')](function(_0x2b6d14){logger[_0xcbaa('0x23')](_0xcbaa('0x2a'),_0x770a31);logger[_0xcbaa('0x15')]('AddTags',_0x770a31,JSON[_0xcbaa('0x16')](_0x2b6d14));_0x1f0f17(_0x2b6d14);})[_0xcbaa('0x24')](function(_0x37ebf9){logger[_0xcbaa('0x17')]('AddTags',_0x37ebf9['message'],_0x770a31);_0x3a2d08(_this[_0xcbaa('0x17')](0x1f4,_0x37ebf9[_0xcbaa('0x18')]));});});}; \ No newline at end of file +var _0x3d6f=['ids','spread','AddTags','lodash','util','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','limit','AddTagsToOpenchannelInteraction','addTags'];(function(_0x1620e0,_0x120daf){var _0x4414e5=function(_0x567c3d){while(--_0x567c3d){_0x1620e0['push'](_0x1620e0['shift']());}};_0x4414e5(++_0x120daf);}(_0x3d6f,0xdb));var _0xf3d6=function(_0x3bc3b4,_0x5acff4){_0x3bc3b4=_0x3bc3b4-0x0;var _0x4c546b=_0x3d6f[_0x3bc3b4];return _0x4c546b;};'use strict';var _=require(_0xf3d6('0x0'));var util=require(_0xf3d6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf3d6('0x2'))(_0xf3d6('0x3'));var config=require(_0xf3d6('0x4'));var jayson=require(_0xf3d6('0x5'));var client=jayson['client'][_0xf3d6('0x6')]({'port':0x232a});config[_0xf3d6('0x7')]=_[_0xf3d6('0x8')](config[_0xf3d6('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xf3d6('0x9'))(new Redis(config['redis']));require(_0xf3d6('0xa'))[_0xf3d6('0xb')](socket);function respondWithRpcPromise(_0x403b10,_0x15b12c,_0x3e0c28){return new BPromise(function(_0x32d100,_0xa09f99){return client[_0xf3d6('0xc')](_0x403b10,_0x3e0c28)[_0xf3d6('0xd')](function(_0x57bf51){logger[_0xf3d6('0xe')]('OpenchannelInteraction,\x20%s,\x20%s',_0x15b12c,_0xf3d6('0xf'));logger[_0xf3d6('0x10')](_0xf3d6('0x11'),_0x15b12c,_0xf3d6('0xf'),JSON['stringify'](_0x57bf51));if(_0x57bf51[_0xf3d6('0x12')]){if(_0x57bf51['error'][_0xf3d6('0x13')]===0x1f4){logger['error'](_0xf3d6('0x14'),_0x15b12c,_0x57bf51[_0xf3d6('0x12')][_0xf3d6('0x15')]);return _0xa09f99(_0x57bf51[_0xf3d6('0x12')]['message']);}logger[_0xf3d6('0x12')](_0xf3d6('0x14'),_0x15b12c,_0x57bf51[_0xf3d6('0x12')][_0xf3d6('0x15')]);return _0x32d100(_0x57bf51['error']['message']);}else{logger[_0xf3d6('0xe')](_0xf3d6('0x14'),_0x15b12c,_0xf3d6('0xf'));_0x32d100(_0x57bf51['result'][_0xf3d6('0x15')]);}})[_0xf3d6('0x16')](function(_0x5e41b8){logger[_0xf3d6('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x15b12c,_0x5e41b8);_0xa09f99(_0x5e41b8);});});}exports[_0xf3d6('0x17')]=function(_0x34eda0){var _0x4ffdf7=this;return new Promise(function(_0x2229d0,_0x544cc9){return db[_0xf3d6('0x18')][_0xf3d6('0x19')](_0x34eda0[_0xf3d6('0x1a')],{'raw':_0x34eda0[_0xf3d6('0x1b')]?_0x34eda0[_0xf3d6('0x1b')][_0xf3d6('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34eda0[_0xf3d6('0x1b')]?_0x34eda0[_0xf3d6('0x1b')][_0xf3d6('0x1d')]||null:null,'attributes':_0x34eda0[_0xf3d6('0x1b')]?_0x34eda0[_0xf3d6('0x1b')]['attributes']||null:null,'limit':_0x34eda0[_0xf3d6('0x1b')]?_0x34eda0[_0xf3d6('0x1b')][_0xf3d6('0x1e')]||null:null})[_0xf3d6('0xd')](function(_0x19f599){logger['info'](_0xf3d6('0x17'),_0x34eda0);logger[_0xf3d6('0x10')](_0xf3d6('0x17'),_0x34eda0,JSON['stringify'](_0x19f599));_0x2229d0(_0x19f599);})[_0xf3d6('0x16')](function(_0x525a12){logger['error'](_0xf3d6('0x17'),_0x525a12['message'],_0x34eda0);_0x544cc9(_0x4ffdf7[_0xf3d6('0x12')](0x1f4,_0x525a12[_0xf3d6('0x15')]));});});};exports[_0xf3d6('0x1f')]=function(_0x285b68){return new Promise(function(_0x5c50d9,_0x5d09f2){return db[_0xf3d6('0x18')]['find']({'where':_0x285b68[_0xf3d6('0x1b')]?_0x285b68[_0xf3d6('0x1b')][_0xf3d6('0x1d')]||null:null})['then'](function(_0x3b64e5){if(_0x3b64e5){return _0x3b64e5[_0xf3d6('0x20')](_0x285b68[_0xf3d6('0x1a')][_0xf3d6('0x21')],_['omit'](_0x285b68[_0xf3d6('0x1a')],[_0xf3d6('0x21'),'id'])||{});}})[_0xf3d6('0x22')](function(_0x312bcc){logger[_0xf3d6('0xe')](_0xf3d6('0x23'),_0x285b68);logger[_0xf3d6('0x10')]('AddTags',_0x285b68,JSON['stringify'](_0x312bcc));_0x5c50d9(_0x312bcc);})[_0xf3d6('0x16')](function(_0x2e76da){logger[_0xf3d6('0x12')]('AddTags',_0x2e76da[_0xf3d6('0x15')],_0x285b68);_0x5d09f2(_this[_0xf3d6('0x12')](0x1f4,_0x2e76da[_0xf3d6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 69e78ac..46cf6e9 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 _0xdb9a=['emit','removeListener','length','./openchannelInteraction.events','remove','update'];(function(_0x3663ef,_0x5259d4){var _0x5d93a2=function(_0x3d4f16){while(--_0x3d4f16){_0x3663ef['push'](_0x3663ef['shift']());}};_0x5d93a2(++_0x5259d4);}(_0xdb9a,0x93));var _0xadb9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xdb9a[_0x19e35c];return _0x3e1fe8;};'use strict';var OpenchannelInteractionEvents=require(_0xadb9('0x0'));var events=['save',_0xadb9('0x1'),_0xadb9('0x2')];function createListener(_0x5d81c0,_0x546f87){return function(_0x4ef3db){_0x546f87[_0xadb9('0x3')](_0x5d81c0,_0x4ef3db);};}function removeListener(_0x6555de,_0x1774b3){return function(){OpenchannelInteractionEvents[_0xadb9('0x4')](_0x6555de,_0x1774b3);};}exports['register']=function(_0x3c6f92){for(var _0x4e972e=0x0,_0x3c9c32=events[_0xadb9('0x5')];_0x4e972e<_0x3c9c32;_0x4e972e++){var _0xdfc148=events[_0x4e972e];var _0x15d282=createListener('openchannelInteraction:'+_0xdfc148,_0x3c6f92);OpenchannelInteractionEvents['on'](_0xdfc148,_0x15d282);}}; \ No newline at end of file +var _0x78ea=['save','remove','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x4c7537,_0x4eb9f0){var _0x5f54a2=function(_0x459c12){while(--_0x459c12){_0x4c7537['push'](_0x4c7537['shift']());}};_0x5f54a2(++_0x4eb9f0);}(_0x78ea,0x1d7));var _0xa78e=function(_0x5ca5d3,_0x532add){_0x5ca5d3=_0x5ca5d3-0x0;var _0xb1712d=_0x78ea[_0x5ca5d3];return _0xb1712d;};'use strict';var OpenchannelInteractionEvents=require(_0xa78e('0x0'));var events=[_0xa78e('0x1'),_0xa78e('0x2'),'update'];function createListener(_0x40322f,_0x14314c){return function(_0x2caa4f){_0x14314c[_0xa78e('0x3')](_0x40322f,_0x2caa4f);};}function removeListener(_0x1e669a,_0x20f5ae){return function(){OpenchannelInteractionEvents[_0xa78e('0x4')](_0x1e669a,_0x20f5ae);};}exports[_0xa78e('0x5')]=function(_0x3d4e07){for(var _0x51a619=0x0,_0x67e4d3=events[_0xa78e('0x6')];_0x51a619<_0x67e4d3;_0x51a619++){var _0x4bcd62=events[_0x51a619];var _0x54df41=createListener(_0xa78e('0x7')+_0x4bcd62,_0x3d4e07);OpenchannelInteractionEvents['on'](_0x4bcd62,_0x54df41);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index e9430fd..f861114 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x3c0d9e,_0x194553){var _0x248ccc=function(_0x184fd2){while(--_0x184fd2){_0x3c0d9e['push'](_0x3c0d9e['shift']());}};_0x248ccc(++_0x194553);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index c116b43..6b79b23 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 _0xc2da=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','TEXT'];(function(_0x6f3945,_0x3f1a6d){var _0x2bf1dd=function(_0x872475){while(--_0x872475){_0x6f3945['push'](_0x6f3945['shift']());}};_0x2bf1dd(++_0x3f1a6d);}(_0xc2da,0x124));var _0xac2d=function(_0x5c4585,_0x3d0eab){_0x5c4585=_0x5c4585-0x0;var _0x21dede=_0xc2da[_0x5c4585];return _0x21dede;};'use strict';var Sequelize=require(_0xac2d('0x0'));module['exports']={'body':{'type':Sequelize[_0xac2d('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xac2d('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xac2d('0x3')]('in',_0xac2d('0x4')),'defaultValue':_0xac2d('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xac2d('0x5')]},'providerName':{'type':Sequelize[_0xac2d('0x6')]},'providerResponse':{'type':Sequelize[_0xac2d('0x1')]}}; \ No newline at end of file +var _0xdc9b=['TEXT','BOOLEAN','out','DATE','sequelize','exports'];(function(_0x5d0459,_0x5a5be9){var _0x5b7907=function(_0x39d005){while(--_0x39d005){_0x5d0459['push'](_0x5d0459['shift']());}};_0x5b7907(++_0x5a5be9);}(_0xdc9b,0x70));var _0xbdc9=function(_0x1997e6,_0x53a2da){_0x1997e6=_0x1997e6-0x0;var _0x45ed17=_0xdc9b[_0x1997e6];return _0x45ed17;};'use strict';var Sequelize=require(_0xbdc9('0x0'));module[_0xbdc9('0x1')]={'body':{'type':Sequelize[_0xbdc9('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xbdc9('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xbdc9('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xbdc9('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbdc9('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xbdc9('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 991cb17..b88b321 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 _0xdae6=['keys','fields','includeAll','merge','find','create','body','destroy','describe','openchannel-interactions','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','isNil','format','interaction','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','agent','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','reject','OpenchannelInteraction','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','ContactId','User','fullname','email','interface','rejectmessage','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','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','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','count','limit','apply','save','update','then','name','map','OpenchannelMessage','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','include','rows','catch','show','params'];(function(_0x490cf9,_0x6b1495){var _0x4b245d=function(_0x5926b0){while(--_0x5926b0){_0x490cf9['push'](_0x490cf9['shift']());}};_0x4b245d(++_0x6b1495);}(_0xdae6,0x1a8));var _0x6dae=function(_0x4919be,_0x2658a1){_0x4919be=_0x4919be-0x0;var _0xf48634=_0xdae6[_0x4919be];return _0xf48634;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6dae('0x0'));var zipdir=require(_0x6dae('0x1'));var jsonpatch=require(_0x6dae('0x2'));var rp=require('request-promise');var moment=require(_0x6dae('0x3'));var BPromise=require(_0x6dae('0x4'));var Mustache=require('mustache');var util=require(_0x6dae('0x5'));var path=require(_0x6dae('0x6'));var sox=require(_0x6dae('0x7'));var csv=require(_0x6dae('0x8'));var ejs=require(_0x6dae('0x9'));var fs=require('fs');var fs_extra=require(_0x6dae('0xa'));var _=require('lodash');var squel=require(_0x6dae('0xb'));var crypto=require('crypto');var jsforce=require(_0x6dae('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6dae('0x8'));var querystring=require(_0x6dae('0xd'));var Papa=require(_0x6dae('0xe'));var Redis=require('ioredis');var authService=require(_0x6dae('0xf'));var qs=require(_0x6dae('0x10'));var as=require(_0x6dae('0x11'));var hardwareService=require(_0x6dae('0x12'));var logger=require(_0x6dae('0x13'))('api');var utils=require(_0x6dae('0x14'));var config=require(_0x6dae('0x15'));var licenseUtil=require(_0x6dae('0x16'));var db=require(_0x6dae('0x17'))['db'];config[_0x6dae('0x18')]=_[_0x6dae('0x19')](config[_0x6dae('0x18')],{'host':_0x6dae('0x1a'),'port':0x18eb});var socket=require(_0x6dae('0x1b'))(new Redis(config[_0x6dae('0x18')]));require(_0x6dae('0x1c'))[_0x6dae('0x1d')](socket);var jayson=require(_0x6dae('0x1e'));var client=jayson[_0x6dae('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x6dae('0x1f')][_0x6dae('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2da89b,_0x5b4f42,_0x1593d0,_0x3a200b){return new BPromise(function(_0x37f817,_0xb06858){var _0x40202f=_0x3a200b||client;return _0x40202f[_0x6dae('0x21')](_0x2da89b,_0x1593d0)['then'](function(_0x95af21){logger[_0x6dae('0x22')](_0x6dae('0x23'),_0x5b4f42,_0x6dae('0x24'));logger[_0x6dae('0x25')](_0x6dae('0x26'),_0x5b4f42,'request\x20sent',JSON[_0x6dae('0x27')](_0x95af21));if(_0x95af21[_0x6dae('0x28')]){if(_0x95af21[_0x6dae('0x28')][_0x6dae('0x29')]===0x1f4){logger['error'](_0x6dae('0x23'),_0x5b4f42,_0x95af21[_0x6dae('0x28')][_0x6dae('0x2a')]);return _0xb06858(_0x95af21['error']['message']);}logger[_0x6dae('0x28')](_0x6dae('0x23'),_0x5b4f42,_0x95af21['error']['message']);return _0x37f817(_0x95af21['error']['message']);}else{logger[_0x6dae('0x22')](_0x6dae('0x23'),_0x5b4f42,_0x6dae('0x24'));_0x37f817(_0x95af21[_0x6dae('0x2b')][_0x6dae('0x2a')]);}})['catch'](function(_0x5cd63b){logger[_0x6dae('0x28')](_0x6dae('0x23'),_0x5b4f42,_0x5cd63b);_0xb06858(_0x5cd63b);});});}function respondWithStatusCode(_0x48b7e4,_0x1c8db6){_0x1c8db6=_0x1c8db6||0xcc;return function(_0xa75a0c){if(_0xa75a0c){return _0x48b7e4[_0x6dae('0x2c')](_0x1c8db6);}return _0x48b7e4[_0x6dae('0x2d')](_0x1c8db6)[_0x6dae('0x2e')]();};}function respondWithResult(_0x3bba90,_0x13467a){_0x13467a=_0x13467a||0xc8;return function(_0x4df957){if(_0x4df957){return _0x3bba90[_0x6dae('0x2d')](_0x13467a)[_0x6dae('0x2f')](_0x4df957);}};}function respondWithFilteredResult(_0x47db6f,_0x47ef80){return function(_0x1a678c){if(_0x1a678c){var _0x23f0a9=typeof _0x47ef80[_0x6dae('0x30')]===_0x6dae('0x31')&&typeof _0x47ef80['limit']===_0x6dae('0x31');var _0x3c69a0=_0x1a678c[_0x6dae('0x32')];var _0x608513=_0x23f0a9?0x0:_0x47ef80[_0x6dae('0x30')];var _0x35a2fa=_0x23f0a9?_0x1a678c[_0x6dae('0x32')]:_0x47ef80[_0x6dae('0x30')]+_0x47ef80[_0x6dae('0x33')];var _0x2935a2;if(_0x35a2fa>=_0x3c69a0){_0x35a2fa=_0x3c69a0;_0x2935a2=0xc8;}else{_0x2935a2=0xce;}_0x47db6f[_0x6dae('0x2d')](_0x2935a2);return _0x47db6f['set']('Content-Range',_0x608513+'-'+_0x35a2fa+'/'+_0x3c69a0)[_0x6dae('0x2f')](_0x1a678c);}return null;};}function patchUpdates(_0x3733ff){return function(_0x5358d5){try{jsonpatch[_0x6dae('0x34')](_0x5358d5,_0x3733ff,!![]);}catch(_0x2b1393){return BPromise['reject'](_0x2b1393);}return _0x5358d5[_0x6dae('0x35')]();};}function saveUpdates(_0x33a1df,_0x2f4b08){return function(_0x1ff3df){if(_0x1ff3df){return _0x1ff3df[_0x6dae('0x36')](_0x33a1df)[_0x6dae('0x37')](function(_0x562ac9){return _0x562ac9;});}return null;};}function removeEntity(_0x494066,_0x51bbc6){return function(_0x52d4d3){if(_0x52d4d3){return _0x52d4d3['destroy']()[_0x6dae('0x37')](function(){_0x494066[_0x6dae('0x2d')](0xcc)[_0x6dae('0x2e')]();});}};}function handleEntityNotFound(_0x218bac,_0xcb4190){return function(_0x218446){if(!_0x218446){_0x218bac['sendStatus'](0x194);}return _0x218446;};}function handleError(_0x39a852,_0x2a7eb9){_0x2a7eb9=_0x2a7eb9||0x1f4;return function(_0x4d2053){logger[_0x6dae('0x28')](_0x4d2053['stack']);if(_0x4d2053[_0x6dae('0x38')]){delete _0x4d2053[_0x6dae('0x38')];}_0x39a852['status'](_0x2a7eb9)['send'](_0x4d2053);};}exports['index']=function(_0x4f437e,_0xe8d371){var _0x1b0403={},_0x245dd2={},_0x443086={'count':0x0,'rows':[]};var _0x214e91=_[_0x6dae('0x39')](db[_0x6dae('0x3a')][_0x6dae('0x3b')],function(_0x127a0f){return{'name':_0x127a0f[_0x6dae('0x3c')],'type':_0x127a0f[_0x6dae('0x3d')]['key']};});_0x245dd2['model']=_[_0x6dae('0x39')](_0x214e91,_0x6dae('0x38'));_0x245dd2[_0x6dae('0x3e')]=_['keys'](_0x4f437e['query']);_0x245dd2[_0x6dae('0x3f')]=_['intersection'](_0x245dd2['model'],_0x245dd2[_0x6dae('0x3e')]);_0x1b0403['attributes']=_[_0x6dae('0x40')](_0x245dd2[_0x6dae('0x41')],qs['fields'](_0x4f437e[_0x6dae('0x3e')]['fields']));_0x1b0403[_0x6dae('0x42')]=_0x1b0403[_0x6dae('0x42')]['length']?_0x1b0403[_0x6dae('0x42')]:_0x245dd2[_0x6dae('0x41')];if(!_0x4f437e[_0x6dae('0x3e')][_0x6dae('0x43')](_0x6dae('0x44'))){_0x1b0403[_0x6dae('0x33')]=qs[_0x6dae('0x33')](_0x4f437e[_0x6dae('0x3e')][_0x6dae('0x33')]);_0x1b0403[_0x6dae('0x30')]=qs[_0x6dae('0x30')](_0x4f437e[_0x6dae('0x3e')][_0x6dae('0x30')]);}_0x1b0403[_0x6dae('0x45')]=qs[_0x6dae('0x46')](_0x4f437e[_0x6dae('0x3e')][_0x6dae('0x46')]);_0x1b0403[_0x6dae('0x47')]=qs[_0x6dae('0x3f')](_['pick'](_0x4f437e[_0x6dae('0x3e')],_0x245dd2[_0x6dae('0x3f')]),_0x214e91);if(_0x4f437e[_0x6dae('0x3e')][_0x6dae('0x48')]){_0x1b0403['where']=_['merge'](_0x1b0403['where'],{'$or':_[_0x6dae('0x39')](_0x214e91,function(_0x281891){if(_0x281891[_0x6dae('0x3d')]!==_0x6dae('0x49')){var _0x3f6faa={};_0x3f6faa[_0x281891['name']]={'$like':'%'+_0x4f437e[_0x6dae('0x3e')][_0x6dae('0x48')]+'%'};return _0x3f6faa;}})});}_0x1b0403=_['merge']({},_0x1b0403,_0x4f437e[_0x6dae('0x4a')]);var _0x3033cf={'where':_0x1b0403[_0x6dae('0x47')]};return db[_0x6dae('0x3a')]['count'](_0x3033cf)[_0x6dae('0x37')](function(_0x35661d){_0x443086[_0x6dae('0x32')]=_0x35661d;if(_0x4f437e[_0x6dae('0x3e')]['includeAll']){_0x1b0403[_0x6dae('0x4b')]=[{'all':!![]}];}return db[_0x6dae('0x3a')]['findAll'](_0x1b0403);})['then'](function(_0x3d9e04){_0x443086[_0x6dae('0x4c')]=_0x3d9e04;return _0x443086;})[_0x6dae('0x37')](respondWithFilteredResult(_0xe8d371,_0x1b0403))[_0x6dae('0x4d')](handleError(_0xe8d371,null));};exports[_0x6dae('0x4e')]=function(_0x43a991,_0x1867d9){var _0x3b405a={'raw':!![],'where':{'id':_0x43a991[_0x6dae('0x4f')]['id']}},_0x4cdebd={};_0x4cdebd[_0x6dae('0x41')]=_[_0x6dae('0x50')](db['OpenchannelMessage'][_0x6dae('0x3b')]);_0x4cdebd[_0x6dae('0x3e')]=_[_0x6dae('0x50')](_0x43a991['query']);_0x4cdebd[_0x6dae('0x3f')]=_[_0x6dae('0x40')](_0x4cdebd['model'],_0x4cdebd[_0x6dae('0x3e')]);_0x3b405a[_0x6dae('0x42')]=_['intersection'](_0x4cdebd[_0x6dae('0x41')],qs[_0x6dae('0x51')](_0x43a991[_0x6dae('0x3e')]['fields']));_0x3b405a[_0x6dae('0x42')]=_0x3b405a[_0x6dae('0x42')]['length']?_0x3b405a[_0x6dae('0x42')]:_0x4cdebd['model'];if(_0x43a991[_0x6dae('0x3e')][_0x6dae('0x52')]){_0x3b405a[_0x6dae('0x4b')]=[{'all':!![]}];}_0x3b405a=_[_0x6dae('0x53')]({},_0x3b405a,_0x43a991[_0x6dae('0x4a')]);return db[_0x6dae('0x3a')][_0x6dae('0x54')](_0x3b405a)[_0x6dae('0x37')](handleEntityNotFound(_0x1867d9,null))[_0x6dae('0x37')](respondWithResult(_0x1867d9,null))[_0x6dae('0x4d')](handleError(_0x1867d9,null));};exports[_0x6dae('0x55')]=function(_0x173dea,_0xfcb4cb){return db[_0x6dae('0x3a')]['create'](_0x173dea[_0x6dae('0x56')],{})[_0x6dae('0x37')](respondWithResult(_0xfcb4cb,0xc9))[_0x6dae('0x4d')](handleError(_0xfcb4cb,null));};exports[_0x6dae('0x36')]=function(_0x506d84,_0xb1801){if(_0x506d84['body']['id']){delete _0x506d84['body']['id'];}return db['OpenchannelMessage'][_0x6dae('0x54')]({'where':{'id':_0x506d84[_0x6dae('0x4f')]['id']}})['then'](handleEntityNotFound(_0xb1801,null))[_0x6dae('0x37')](saveUpdates(_0x506d84[_0x6dae('0x56')],null))[_0x6dae('0x37')](respondWithResult(_0xb1801,null))[_0x6dae('0x4d')](handleError(_0xb1801,null));};exports[_0x6dae('0x57')]=function(_0x59616a,_0x54b6f5){return db[_0x6dae('0x3a')]['find']({'where':{'id':_0x59616a['params']['id']}})[_0x6dae('0x37')](handleEntityNotFound(_0x54b6f5,null))[_0x6dae('0x37')](removeEntity(_0x54b6f5,null))[_0x6dae('0x4d')](handleError(_0x54b6f5,null));};exports[_0x6dae('0x58')]=function(_0x5a4952,_0x274999){return db[_0x6dae('0x3a')][_0x6dae('0x58')]()['then'](respondWithResult(_0x274999,null))[_0x6dae('0x4d')](handleError(_0x274999,null));};var interaction_log=require(_0x6dae('0x13'))(_0x6dae('0x59'));exports[_0x6dae('0x5a')]=function(_0x3b77de,_0x3d28a6,_0x2b1a87){var _0x5a65da={'agent':{},'channel':_0x6dae('0x5b')};if(_0x3b77de['body']['id']){delete _0x3b77de['body']['id'];}_0x3b77de[_0x6dae('0x56')][_0x6dae('0x5c')]=!![];_0x3b77de[_0x6dae('0x56')][_0x6dae('0x5d')]=moment()['format'](_0x6dae('0x5e'));_0x3b77de[_0x6dae('0x56')]['UserId']=_0x3b77de[_0x6dae('0x56')][_0x6dae('0x5f')]||_0x3b77de[_0x6dae('0x60')]['id'];_0x5a65da['agent']['id']=_0x3b77de[_0x6dae('0x56')][_0x6dae('0x5f')];return db[_0x6dae('0x3a')][_0x6dae('0x54')]({'where':{'id':_0x3b77de[_0x6dae('0x4f')]['id'],'UserId':null}})[_0x6dae('0x37')](handleEntityNotFound(_0x3d28a6,null))[_0x6dae('0x37')](saveUpdates(_0x3b77de['body'],null))[_0x6dae('0x37')](function(_0xd5deb8){if(_0xd5deb8){_0x5a65da[_0x6dae('0x2a')]=_0xd5deb8[_0x6dae('0x61')]({'plain':!![]});return db['OpenchannelInteraction'][_0x6dae('0x54')]({'where':{'id':_0xd5deb8['OpenchannelInteractionId']}});}return null;})[_0x6dae('0x37')](handleEntityNotFound(_0x3d28a6,null))['then'](function(_0x390364){if(_0x390364){return _0x390364[_0x6dae('0x36')]({'UserId':_0x3b77de[_0x6dae('0x56')][_0x6dae('0x5f')],'read1stAt':_[_0x6dae('0x62')](_0x390364['read1stAt'])?moment()[_0x6dae('0x63')](_0x6dae('0x5e')):undefined});}return null;})[_0x6dae('0x37')](function(_0x1fd98b){if(_0x1fd98b){_0x5a65da[_0x6dae('0x64')]=_0x1fd98b[_0x6dae('0x61')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3b77de[_0x6dae('0x60')]['id'],_0x3b77de[_0x6dae('0x60')][_0x6dae('0x38')],_0x3b77de[_0x6dae('0x60')][_0x6dae('0x65')],_0x5a65da[_0x6dae('0x64')]['id'],_0x3b77de[_0x6dae('0x56')]?JSON[_0x6dae('0x27')](_0x3b77de[_0x6dae('0x56')]):'null');return respondWithRpcPromise(_0x6dae('0x66'),'acceptMessage',_0x5a65da);}return null;})[_0x6dae('0x37')](function(_0x30e5d0){var _0x7b17a0=_0x6dae('0x67')+_0x30e5d0['message']['ContactId'];return db['sequelize']['query'](_0x7b17a0,{'type':db[_0x6dae('0x68')][_0x6dae('0x69')][_0x6dae('0x6a')],'raw':!![]})[_0x6dae('0x37')](function(_0x2f9ada){return _0x2f9ada;});})[_0x6dae('0x37')](function(_0x4f470){if(_0x4f470){_0x5a65da['message'][_0x6dae('0x6b')]=_0x4f470[0x0];if(!_0x3b77de[_0x6dae('0x56')][_0x6dae('0x5f')])return;return db['User'][_0x6dae('0x54')]({'where':{'id':_0x3b77de[_0x6dae('0x56')][_0x6dae('0x5f')],'role':_0x6dae('0x6c')},'attributes':['id',_0x6dae('0x38'),'fullname','email',_0x6dae('0x6d')],'raw':!![]});}return null;})['then'](function(_0x430859){if(!_0x430859)return null;_0x5a65da[_0x6dae('0x2a')][_0x6dae('0x6c')]=_0x430859;return _0x5a65da;})[_0x6dae('0x37')](function(_0x3568bc){if(_0x3568bc){if(_0x3b77de[_0x6dae('0x56')][_0x6dae('0x6e')]){_0x5a65da[_0x6dae('0x2a')]['interface']=util[_0x6dae('0x63')](_0x6dae('0x6f'),_0x3b77de[_0x6dae('0x60')][_0x6dae('0x38')]);_0x5a65da[_0x6dae('0x2a')][_0x6dae('0x70')]=_0x5a65da[_0x6dae('0x70')];_0x5a65da[_0x6dae('0x2a')][_0x6dae('0x71')]=_0x5a65da['channel'];_0x5a65da['message'][_0x6dae('0x72')]=_0x6dae('0x5a');return respondWithRpcPromise(_0x6dae('0x73'),_0x6dae('0x73'),{'event':'acceptmessage','message':_0x5a65da['message']},client9002)[_0x6dae('0x37')](function(){return _0x5a65da;});}return _0x5a65da;}return null;})[_0x6dae('0x37')](respondWithResult(_0x3d28a6,null))[_0x6dae('0x4d')](handleError(_0x3d28a6,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0x6dae('0x74')]=function(_0x22adc5,_0x120fcf,_0x55ca02){var _0x2af6cd={'agent':{},'channel':_0x6dae('0x5b')};if(_0x22adc5[_0x6dae('0x56')]['id']){delete _0x22adc5[_0x6dae('0x56')]['id'];}_0x22adc5[_0x6dae('0x56')][_0x6dae('0x5f')]=_0x22adc5['body']['UserId']||_0x22adc5[_0x6dae('0x60')]['id'];_0x2af6cd[_0x6dae('0x6c')]['id']=_0x22adc5[_0x6dae('0x56')]['UserId'];return db[_0x6dae('0x3a')][_0x6dae('0x54')]({'where':{'id':_0x22adc5[_0x6dae('0x4f')]['id'],'UserId':null}})[_0x6dae('0x37')](handleEntityNotFound(_0x120fcf,null))[_0x6dae('0x37')](function(_0x2d9e7d){if(_0x2d9e7d){_0x2af6cd['message']=_0x2d9e7d[_0x6dae('0x61')]({'plain':!![]});return db[_0x6dae('0x75')]['find']({'where':{'id':_0x2d9e7d[_0x6dae('0x76')]}});}return null;})[_0x6dae('0x37')](handleEntityNotFound(_0x120fcf,null))[_0x6dae('0x37')](function(_0x557324){if(_0x557324){_0x2af6cd[_0x6dae('0x64')]=_0x557324[_0x6dae('0x61')]({'plain':!![]});interaction_log[_0x6dae('0x22')](_0x6dae('0x77'),_0x22adc5[_0x6dae('0x60')]['id'],_0x22adc5[_0x6dae('0x60')][_0x6dae('0x38')],_0x22adc5[_0x6dae('0x60')][_0x6dae('0x65')],_0x2af6cd[_0x6dae('0x64')]['id'],_0x22adc5[_0x6dae('0x56')]?JSON['stringify'](_0x22adc5[_0x6dae('0x56')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x2af6cd);}return null;})[_0x6dae('0x37')](function(_0x464a3e){var _0x5db8ee=_0x6dae('0x67')+_0x464a3e[_0x6dae('0x2a')][_0x6dae('0x78')];return db['sequelize'][_0x6dae('0x3e')](_0x5db8ee,{'type':db[_0x6dae('0x68')][_0x6dae('0x69')][_0x6dae('0x6a')],'raw':!![]})[_0x6dae('0x37')](function(_0x51378c){return _0x51378c;});})[_0x6dae('0x37')](function(_0xeb092b){if(_0xeb092b){_0x2af6cd[_0x6dae('0x2a')][_0x6dae('0x6b')]=_0xeb092b[0x0];if(!_0x22adc5[_0x6dae('0x56')]['UserId'])return;return db[_0x6dae('0x79')][_0x6dae('0x54')]({'where':{'id':_0x22adc5[_0x6dae('0x56')][_0x6dae('0x5f')],'role':_0x6dae('0x6c')},'attributes':['id','name',_0x6dae('0x7a'),_0x6dae('0x7b'),_0x6dae('0x6d')],'raw':!![]});}return null;})['then'](function(_0x46d518){if(!_0x46d518)return null;_0x2af6cd[_0x6dae('0x2a')]['agent']=_0x46d518;return _0x2af6cd;})['then'](function(_0x531abc){if(_0x531abc){_0x531abc[_0x6dae('0x2a')][_0x6dae('0x7c')]=util['format'](_0x6dae('0x6f'),_0x22adc5['user']['name']);_0x531abc[_0x6dae('0x2a')][_0x6dae('0x70')]=_0x2af6cd[_0x6dae('0x70')];_0x531abc[_0x6dae('0x2a')][_0x6dae('0x71')]=_0x2af6cd[_0x6dae('0x70')];_0x531abc[_0x6dae('0x2a')]['event']=_0x6dae('0x74');respondWithRpcPromise(_0x6dae('0x73'),_0x6dae('0x73'),{'event':_0x6dae('0x7d'),'message':_0x531abc[_0x6dae('0x2a')]},client9002);return _0x2af6cd;}return null;})[_0x6dae('0x37')](respondWithResult(_0x120fcf,null))[_0x6dae('0x4d')](handleError(_0x120fcf,null));}; \ No newline at end of file +var _0x0958=['moment','util','path','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','VIRTUAL','merge','options','OpenchannelMessage','includeAll','include','findAll','rows','params','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','reject','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','fullname','email','internal','SIP/%s','rejectmessage','eml-format','rimraf','zip-dir','request-promise'];(function(_0x1c5663,_0x4c0905){var _0x126319=function(_0x3ebbce){while(--_0x3ebbce){_0x1c5663['push'](_0x1c5663['shift']());}};_0x126319(++_0x4c0905);}(_0x0958,0x7c));var _0x8095=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0958[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x8095('0x0'));var rimraf=require(_0x8095('0x1'));var zipdir=require(_0x8095('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8095('0x3'));var moment=require(_0x8095('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8095('0x5'));var path=require(_0x8095('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8095('0x7'));var fs=require('fs');var fs_extra=require(_0x8095('0x8'));var _=require(_0x8095('0x9'));var squel=require(_0x8095('0xa'));var crypto=require(_0x8095('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8095('0xc'));var querystring=require(_0x8095('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8095('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8095('0xf'));var hardwareService=require(_0x8095('0x10'));var logger=require(_0x8095('0x11'))(_0x8095('0x12'));var utils=require(_0x8095('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x8095('0x14'));var db=require('../../mysqldb')['db'];config[_0x8095('0x15')]=_[_0x8095('0x16')](config[_0x8095('0x15')],{'host':_0x8095('0x17'),'port':0x18eb});var socket=require(_0x8095('0x18'))(new Redis(config[_0x8095('0x15')]));require('./openchannelMessage.socket')[_0x8095('0x19')](socket);var jayson=require(_0x8095('0x1a'));var client=jayson[_0x8095('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x8095('0x1b')][_0x8095('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x42a59a,_0xb7c487,_0x466ac9,_0x5ae78f){return new BPromise(function(_0x1b1ca3,_0x463d6e){var _0x4a1d27=_0x5ae78f||client;return _0x4a1d27['request'](_0x42a59a,_0x466ac9)[_0x8095('0x1d')](function(_0x51c65a){logger[_0x8095('0x1e')](_0x8095('0x1f'),_0xb7c487,_0x8095('0x20'));logger['debug'](_0x8095('0x21'),_0xb7c487,_0x8095('0x20'),JSON[_0x8095('0x22')](_0x51c65a));if(_0x51c65a['error']){if(_0x51c65a[_0x8095('0x23')][_0x8095('0x24')]===0x1f4){logger[_0x8095('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0xb7c487,_0x51c65a[_0x8095('0x23')]['message']);return _0x463d6e(_0x51c65a[_0x8095('0x23')][_0x8095('0x25')]);}logger[_0x8095('0x23')](_0x8095('0x1f'),_0xb7c487,_0x51c65a[_0x8095('0x23')][_0x8095('0x25')]);return _0x1b1ca3(_0x51c65a[_0x8095('0x23')][_0x8095('0x25')]);}else{logger[_0x8095('0x1e')](_0x8095('0x1f'),_0xb7c487,_0x8095('0x20'));_0x1b1ca3(_0x51c65a[_0x8095('0x26')][_0x8095('0x25')]);}})[_0x8095('0x27')](function(_0x5896f4){logger['error'](_0x8095('0x1f'),_0xb7c487,_0x5896f4);_0x463d6e(_0x5896f4);});});}function respondWithStatusCode(_0x190b0a,_0x2552b9){_0x2552b9=_0x2552b9||0xcc;return function(_0x39cde9){if(_0x39cde9){return _0x190b0a[_0x8095('0x28')](_0x2552b9);}return _0x190b0a[_0x8095('0x29')](_0x2552b9)[_0x8095('0x2a')]();};}function respondWithResult(_0xe39b50,_0x440975){_0x440975=_0x440975||0xc8;return function(_0x165fee){if(_0x165fee){return _0xe39b50[_0x8095('0x29')](_0x440975)[_0x8095('0x2b')](_0x165fee);}};}function respondWithFilteredResult(_0x223ade,_0x38d932){return function(_0xd4ff7d){if(_0xd4ff7d){var _0x22fc6c=typeof _0x38d932[_0x8095('0x2c')]===_0x8095('0x2d')&&typeof _0x38d932['limit']===_0x8095('0x2d');var _0x24caa2=_0xd4ff7d[_0x8095('0x2e')];var _0x3cba01=_0x22fc6c?0x0:_0x38d932[_0x8095('0x2c')];var _0x3806cd=_0x22fc6c?_0xd4ff7d[_0x8095('0x2e')]:_0x38d932['offset']+_0x38d932['limit'];var _0x4bf45e;if(_0x3806cd>=_0x24caa2){_0x3806cd=_0x24caa2;_0x4bf45e=0xc8;}else{_0x4bf45e=0xce;}_0x223ade[_0x8095('0x29')](_0x4bf45e);return _0x223ade['set'](_0x8095('0x2f'),_0x3cba01+'-'+_0x3806cd+'/'+_0x24caa2)[_0x8095('0x2b')](_0xd4ff7d);}return null;};}function patchUpdates(_0x6a7188){return function(_0x2a5599){try{jsonpatch[_0x8095('0x30')](_0x2a5599,_0x6a7188,!![]);}catch(_0x4f6b55){return BPromise['reject'](_0x4f6b55);}return _0x2a5599['save']();};}function saveUpdates(_0x407eb4,_0x3c68a2){return function(_0x167828){if(_0x167828){return _0x167828[_0x8095('0x31')](_0x407eb4)[_0x8095('0x1d')](function(_0x5f28a6){return _0x5f28a6;});}return null;};}function removeEntity(_0xf83cdc,_0x2a8183){return function(_0x5b6ca9){if(_0x5b6ca9){return _0x5b6ca9[_0x8095('0x32')]()[_0x8095('0x1d')](function(){_0xf83cdc['status'](0xcc)[_0x8095('0x2a')]();});}};}function handleEntityNotFound(_0x461cf0,_0xf1ac9a){return function(_0x4389c2){if(!_0x4389c2){_0x461cf0['sendStatus'](0x194);}return _0x4389c2;};}function handleError(_0x3eacd8,_0x261393){_0x261393=_0x261393||0x1f4;return function(_0x26004e){logger[_0x8095('0x23')](_0x26004e[_0x8095('0x33')]);if(_0x26004e[_0x8095('0x34')]){delete _0x26004e[_0x8095('0x34')];}_0x3eacd8['status'](_0x261393)[_0x8095('0x35')](_0x26004e);};}exports[_0x8095('0x36')]=function(_0x5510a6,_0xce269d){var _0x45b187={},_0x3b2339={},_0x4bf4d0={'count':0x0,'rows':[]};var _0x19de8e=_[_0x8095('0x37')](db['OpenchannelMessage'][_0x8095('0x38')],function(_0x1b12fe){return{'name':_0x1b12fe[_0x8095('0x39')],'type':_0x1b12fe[_0x8095('0x3a')]['key']};});_0x3b2339[_0x8095('0x3b')]=_[_0x8095('0x37')](_0x19de8e,_0x8095('0x34'));_0x3b2339[_0x8095('0x3c')]=_[_0x8095('0x3d')](_0x5510a6[_0x8095('0x3c')]);_0x3b2339[_0x8095('0x3e')]=_['intersection'](_0x3b2339[_0x8095('0x3b')],_0x3b2339[_0x8095('0x3c')]);_0x45b187[_0x8095('0x3f')]=_[_0x8095('0x40')](_0x3b2339['model'],qs[_0x8095('0x41')](_0x5510a6[_0x8095('0x3c')]['fields']));_0x45b187[_0x8095('0x3f')]=_0x45b187['attributes'][_0x8095('0x42')]?_0x45b187[_0x8095('0x3f')]:_0x3b2339[_0x8095('0x3b')];if(!_0x5510a6[_0x8095('0x3c')][_0x8095('0x43')]('nolimit')){_0x45b187['limit']=qs['limit'](_0x5510a6[_0x8095('0x3c')][_0x8095('0x44')]);_0x45b187[_0x8095('0x2c')]=qs[_0x8095('0x2c')](_0x5510a6[_0x8095('0x3c')][_0x8095('0x2c')]);}_0x45b187[_0x8095('0x45')]=qs[_0x8095('0x46')](_0x5510a6[_0x8095('0x3c')][_0x8095('0x46')]);_0x45b187[_0x8095('0x47')]=qs[_0x8095('0x3e')](_[_0x8095('0x48')](_0x5510a6['query'],_0x3b2339[_0x8095('0x3e')]),_0x19de8e);if(_0x5510a6[_0x8095('0x3c')]['filter']){_0x45b187[_0x8095('0x47')]=_['merge'](_0x45b187[_0x8095('0x47')],{'$or':_[_0x8095('0x37')](_0x19de8e,function(_0x125017){if(_0x125017[_0x8095('0x3a')]!==_0x8095('0x49')){var _0x205a2c={};_0x205a2c[_0x125017[_0x8095('0x34')]]={'$like':'%'+_0x5510a6[_0x8095('0x3c')]['filter']+'%'};return _0x205a2c;}})});}_0x45b187=_[_0x8095('0x4a')]({},_0x45b187,_0x5510a6[_0x8095('0x4b')]);var _0x27d78f={'where':_0x45b187[_0x8095('0x47')]};return db[_0x8095('0x4c')][_0x8095('0x2e')](_0x27d78f)[_0x8095('0x1d')](function(_0x3f06b6){_0x4bf4d0[_0x8095('0x2e')]=_0x3f06b6;if(_0x5510a6[_0x8095('0x3c')][_0x8095('0x4d')]){_0x45b187[_0x8095('0x4e')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x8095('0x4f')](_0x45b187);})['then'](function(_0x5ae2a0){_0x4bf4d0[_0x8095('0x50')]=_0x5ae2a0;return _0x4bf4d0;})[_0x8095('0x1d')](respondWithFilteredResult(_0xce269d,_0x45b187))['catch'](handleError(_0xce269d,null));};exports['show']=function(_0x18ef15,_0x36456f){var _0x47addc={'raw':!![],'where':{'id':_0x18ef15[_0x8095('0x51')]['id']}},_0x313db0={};_0x313db0[_0x8095('0x3b')]=_[_0x8095('0x3d')](db[_0x8095('0x4c')][_0x8095('0x38')]);_0x313db0[_0x8095('0x3c')]=_['keys'](_0x18ef15['query']);_0x313db0[_0x8095('0x3e')]=_['intersection'](_0x313db0[_0x8095('0x3b')],_0x313db0['query']);_0x47addc[_0x8095('0x3f')]=_[_0x8095('0x40')](_0x313db0['model'],qs[_0x8095('0x41')](_0x18ef15[_0x8095('0x3c')]['fields']));_0x47addc[_0x8095('0x3f')]=_0x47addc['attributes'][_0x8095('0x42')]?_0x47addc['attributes']:_0x313db0[_0x8095('0x3b')];if(_0x18ef15[_0x8095('0x3c')][_0x8095('0x4d')]){_0x47addc[_0x8095('0x4e')]=[{'all':!![]}];}_0x47addc=_[_0x8095('0x4a')]({},_0x47addc,_0x18ef15[_0x8095('0x4b')]);return db['OpenchannelMessage'][_0x8095('0x52')](_0x47addc)[_0x8095('0x1d')](handleEntityNotFound(_0x36456f,null))[_0x8095('0x1d')](respondWithResult(_0x36456f,null))[_0x8095('0x27')](handleError(_0x36456f,null));};exports[_0x8095('0x53')]=function(_0x4bb5c3,_0x283722){return db[_0x8095('0x4c')][_0x8095('0x53')](_0x4bb5c3[_0x8095('0x54')],{})[_0x8095('0x1d')](respondWithResult(_0x283722,0xc9))['catch'](handleError(_0x283722,null));};exports[_0x8095('0x31')]=function(_0x479cfd,_0xd81d69){if(_0x479cfd['body']['id']){delete _0x479cfd['body']['id'];}return db[_0x8095('0x4c')][_0x8095('0x52')]({'where':{'id':_0x479cfd[_0x8095('0x51')]['id']}})[_0x8095('0x1d')](handleEntityNotFound(_0xd81d69,null))[_0x8095('0x1d')](saveUpdates(_0x479cfd[_0x8095('0x54')],null))['then'](respondWithResult(_0xd81d69,null))[_0x8095('0x27')](handleError(_0xd81d69,null));};exports[_0x8095('0x32')]=function(_0x1e7d7d,_0x27fc7b){return db['OpenchannelMessage'][_0x8095('0x52')]({'where':{'id':_0x1e7d7d[_0x8095('0x51')]['id']}})['then'](handleEntityNotFound(_0x27fc7b,null))[_0x8095('0x1d')](removeEntity(_0x27fc7b,null))[_0x8095('0x27')](handleError(_0x27fc7b,null));};exports[_0x8095('0x55')]=function(_0xe43dde,_0x41bf8e){return db[_0x8095('0x4c')][_0x8095('0x55')]()[_0x8095('0x1d')](respondWithResult(_0x41bf8e,null))[_0x8095('0x27')](handleError(_0x41bf8e,null));};var interaction_log=require(_0x8095('0x11'))(_0x8095('0x56'));exports[_0x8095('0x57')]=function(_0x19acde,_0x8f3a36,_0x426ece){var _0x166f8d={'agent':{},'channel':_0x8095('0x58')};if(_0x19acde[_0x8095('0x54')]['id']){delete _0x19acde[_0x8095('0x54')]['id'];}_0x19acde[_0x8095('0x54')][_0x8095('0x59')]=!![];_0x19acde[_0x8095('0x54')][_0x8095('0x5a')]=moment()[_0x8095('0x5b')](_0x8095('0x5c'));_0x19acde['body'][_0x8095('0x5d')]=_0x19acde['body'][_0x8095('0x5d')]||_0x19acde[_0x8095('0x5e')]['id'];_0x166f8d[_0x8095('0x5f')]['id']=_0x19acde['body'][_0x8095('0x5d')];return db[_0x8095('0x4c')]['find']({'where':{'id':_0x19acde[_0x8095('0x51')]['id'],'UserId':null}})[_0x8095('0x1d')](handleEntityNotFound(_0x8f3a36,null))[_0x8095('0x1d')](saveUpdates(_0x19acde[_0x8095('0x54')],null))['then'](function(_0x2c4eaa){if(_0x2c4eaa){_0x166f8d[_0x8095('0x25')]=_0x2c4eaa['get']({'plain':!![]});return db[_0x8095('0x60')][_0x8095('0x52')]({'where':{'id':_0x2c4eaa[_0x8095('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x8f3a36,null))['then'](function(_0x5a5e4d){if(_0x5a5e4d){return _0x5a5e4d[_0x8095('0x31')]({'UserId':_0x19acde[_0x8095('0x54')][_0x8095('0x5d')],'read1stAt':_['isNil'](_0x5a5e4d[_0x8095('0x62')])?moment()[_0x8095('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x8095('0x1d')](function(_0x180742){if(_0x180742){_0x166f8d['interaction']=_0x180742[_0x8095('0x63')]({'plain':!![]});interaction_log['info'](_0x8095('0x64'),_0x19acde[_0x8095('0x5e')]['id'],_0x19acde[_0x8095('0x5e')][_0x8095('0x34')],_0x19acde[_0x8095('0x5e')][_0x8095('0x65')],_0x166f8d['interaction']['id'],_0x19acde['body']?JSON[_0x8095('0x22')](_0x19acde[_0x8095('0x54')]):_0x8095('0x66'));return respondWithRpcPromise(_0x8095('0x67'),_0x8095('0x68'),_0x166f8d);}return null;})['then'](function(_0x24d858){var _0x521851='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x24d858[_0x8095('0x25')]['ContactId'];return db[_0x8095('0x69')]['query'](_0x521851,{'type':db[_0x8095('0x6a')][_0x8095('0x6b')][_0x8095('0x6c')],'raw':!![]})[_0x8095('0x1d')](function(_0x4befad){return _0x4befad;});})['then'](function(_0x38d15c){if(_0x38d15c){_0x166f8d[_0x8095('0x25')][_0x8095('0x6d')]=_0x38d15c[0x0];if(!_0x19acde['body'][_0x8095('0x5d')])return;return db[_0x8095('0x6e')][_0x8095('0x52')]({'where':{'id':_0x19acde['body'][_0x8095('0x5d')],'role':'agent'},'attributes':['id',_0x8095('0x34'),'fullname','email','internal'],'raw':!![]});}return null;})['then'](function(_0x11ceb2){if(!_0x11ceb2)return null;_0x166f8d[_0x8095('0x25')][_0x8095('0x5f')]=_0x11ceb2;return _0x166f8d;})[_0x8095('0x1d')](function(_0x9a2240){if(_0x9a2240){if(_0x19acde[_0x8095('0x54')][_0x8095('0x6f')]){_0x166f8d[_0x8095('0x25')][_0x8095('0x70')]=util['format']('SIP/%s',_0x19acde['user'][_0x8095('0x34')]);_0x166f8d['message'][_0x8095('0x71')]=_0x166f8d[_0x8095('0x71')];_0x166f8d[_0x8095('0x25')][_0x8095('0x72')]=_0x166f8d[_0x8095('0x71')];_0x166f8d[_0x8095('0x25')][_0x8095('0x73')]=_0x8095('0x57');return respondWithRpcPromise(_0x8095('0x74'),'EventManager',{'event':_0x8095('0x75'),'message':_0x166f8d[_0x8095('0x25')]},client9002)['then'](function(){return _0x166f8d;});}return _0x166f8d;}return null;})[_0x8095('0x1d')](respondWithResult(_0x8f3a36,null))[_0x8095('0x27')](handleError(_0x8f3a36,null));};var interaction_log=require(_0x8095('0x11'))('openchannel-interactions');exports[_0x8095('0x76')]=function(_0x2542ef,_0x970194,_0xbd1aa8){var _0x5cb6af={'agent':{},'channel':_0x8095('0x58')};if(_0x2542ef['body']['id']){delete _0x2542ef['body']['id'];}_0x2542ef[_0x8095('0x54')][_0x8095('0x5d')]=_0x2542ef[_0x8095('0x54')]['UserId']||_0x2542ef[_0x8095('0x5e')]['id'];_0x5cb6af[_0x8095('0x5f')]['id']=_0x2542ef[_0x8095('0x54')][_0x8095('0x5d')];return db[_0x8095('0x4c')][_0x8095('0x52')]({'where':{'id':_0x2542ef[_0x8095('0x51')]['id'],'UserId':null}})[_0x8095('0x1d')](handleEntityNotFound(_0x970194,null))[_0x8095('0x1d')](function(_0x33a376){if(_0x33a376){_0x5cb6af[_0x8095('0x25')]=_0x33a376[_0x8095('0x63')]({'plain':!![]});return db[_0x8095('0x60')]['find']({'where':{'id':_0x33a376[_0x8095('0x61')]}});}return null;})[_0x8095('0x1d')](handleEntityNotFound(_0x970194,null))[_0x8095('0x1d')](function(_0x19cb04){if(_0x19cb04){_0x5cb6af[_0x8095('0x77')]=_0x19cb04['get']({'plain':!![]});interaction_log[_0x8095('0x1e')](_0x8095('0x78'),_0x2542ef[_0x8095('0x5e')]['id'],_0x2542ef[_0x8095('0x5e')]['name'],_0x2542ef[_0x8095('0x5e')][_0x8095('0x65')],_0x5cb6af[_0x8095('0x77')]['id'],_0x2542ef[_0x8095('0x54')]?JSON[_0x8095('0x22')](_0x2542ef[_0x8095('0x54')]):_0x8095('0x66'));return respondWithRpcPromise(_0x8095('0x79'),'rejectMessage',_0x5cb6af);}return null;})[_0x8095('0x1d')](function(_0x2ad4e0){var _0x678a15='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2ad4e0['message'][_0x8095('0x7a')];return db[_0x8095('0x69')][_0x8095('0x3c')](_0x678a15,{'type':db[_0x8095('0x6a')][_0x8095('0x6b')]['SELECT'],'raw':!![]})[_0x8095('0x1d')](function(_0x1ee5b2){return _0x1ee5b2;});})[_0x8095('0x1d')](function(_0x5085ca){if(_0x5085ca){_0x5cb6af['message']['contact']=_0x5085ca[0x0];if(!_0x2542ef[_0x8095('0x54')][_0x8095('0x5d')])return;return db['User'][_0x8095('0x52')]({'where':{'id':_0x2542ef['body'][_0x8095('0x5d')],'role':_0x8095('0x5f')},'attributes':['id',_0x8095('0x34'),_0x8095('0x7b'),_0x8095('0x7c'),_0x8095('0x7d')],'raw':!![]});}return null;})['then'](function(_0x13d197){if(!_0x13d197)return null;_0x5cb6af['message'][_0x8095('0x5f')]=_0x13d197;return _0x5cb6af;})[_0x8095('0x1d')](function(_0x3462ee){if(_0x3462ee){_0x3462ee[_0x8095('0x25')][_0x8095('0x70')]=util[_0x8095('0x5b')](_0x8095('0x7e'),_0x2542ef[_0x8095('0x5e')][_0x8095('0x34')]);_0x3462ee[_0x8095('0x25')]['channel']=_0x5cb6af['channel'];_0x3462ee[_0x8095('0x25')]['motionChannel']=_0x5cb6af['channel'];_0x3462ee['message'][_0x8095('0x73')]=_0x8095('0x76');respondWithRpcPromise('EventManager',_0x8095('0x74'),{'event':_0x8095('0x7f'),'message':_0x3462ee[_0x8095('0x25')]},client9002);return _0x5cb6af;}return null;})['then'](respondWithResult(_0x970194,null))[_0x8095('0x27')](handleError(_0x970194,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index acb0cc5..f9777cc 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 _0x66be=['hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','save','update','remove','emit'];(function(_0x5ad0c6,_0x56ee17){var _0x167958=function(_0x32dd81){while(--_0x32dd81){_0x5ad0c6['push'](_0x5ad0c6['shift']());}};_0x167958(++_0x56ee17);}(_0x66be,0xec));var _0xe66b=function(_0x21d078,_0x55bbbf){_0x21d078=_0x21d078-0x0;var _0x5c7c7f=_0x66be[_0x21d078];return _0x5c7c7f;};'use strict';var EventEmitter=require(_0xe66b('0x0'));var OpenchannelMessage=require(_0xe66b('0x1'))['db'][_0xe66b('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe66b('0x3'),'afterUpdate':_0xe66b('0x4'),'afterDestroy':_0xe66b('0x5')};function emitEvent(_0x536b33){return function(_0x4e2653,_0x363082,_0x4f2e8a){OpenchannelMessageEvents[_0xe66b('0x6')](_0x536b33+':'+_0x4e2653['id'],_0x4e2653);OpenchannelMessageEvents[_0xe66b('0x6')](_0x536b33,_0x4e2653);_0x4f2e8a(null);};}for(var e in events){if(events[_0xe66b('0x7')](e)){var event=events[e];OpenchannelMessage[_0xe66b('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xc599=['../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','emit','hook','exports','events'];(function(_0x259145,_0x37b1af){var _0x2a1560=function(_0x52ab00){while(--_0x52ab00){_0x259145['push'](_0x259145['shift']());}};_0x2a1560(++_0x37b1af);}(_0xc599,0x131));var _0x9c59=function(_0xe8b9c7,_0x534838){_0xe8b9c7=_0xe8b9c7-0x0;var _0x4b606f=_0xc599[_0xe8b9c7];return _0x4b606f;};'use strict';var EventEmitter=require(_0x9c59('0x0'));var OpenchannelMessage=require(_0x9c59('0x1'))['db'][_0x9c59('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x9c59('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9c59('0x4'),'afterDestroy':_0x9c59('0x5')};function emitEvent(_0x5442ba){return function(_0x1a7c8,_0x3fcd3f,_0x36127d){OpenchannelMessageEvents[_0x9c59('0x6')](_0x5442ba+':'+_0x1a7c8['id'],_0x1a7c8);OpenchannelMessageEvents[_0x9c59('0x6')](_0x5442ba,_0x1a7c8);_0x36127d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x9c59('0x7')](e,emitEvent(event));}}module[_0x9c59('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 6a14c85..11cf8c1 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 _0x9df9=['OpenchannelAccountId','Interactions','Contact','keys','get','replyUri','format','length','method','GET','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','Interaction','catch','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','createdAt','error','CmContact','describe','OpenchannelAccount','find'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9df9,0x145));var _0x99df=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9df9[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x99df('0x0'));var util=require(_0x99df('0x1'));var logger=require(_0x99df('0x2'))(_0x99df('0x3'));var moment=require(_0x99df('0x4'));var BPromise=require(_0x99df('0x5'));var rp=require(_0x99df('0x6'));var fs=require('fs');var path=require(_0x99df('0x7'));var rimraf=require(_0x99df('0x8'));var config=require(_0x99df('0x9'));var attributes=require(_0x99df('0xa'));module['exports']=function(_0x38a67b,_0x432e50){return _0x38a67b[_0x99df('0xb')](_0x99df('0xc'),attributes,{'tableName':_0x99df('0xd'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x99df('0xe')],'type':_0x99df('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x10e42f,_0x1ca101,_0x5e42a0){var _0x847841=_0x38a67b[_0x99df('0x10')];var _0x15330a=_0x10e42f['get']({'plain':!![]});if(_0x15330a[_0x99df('0x11')]['toLowerCase']()==='in'||_0x15330a[_0x99df('0x11')][_0x99df('0x12')]()===_0x99df('0x13')&&!_0x15330a[_0x99df('0x14')]&&!_[_0x99df('0x15')](_0x15330a['UserId'])){_0x847841[_0x99df('0x16')][_0x99df('0x17')]({'where':{'id':_0x15330a[_0x99df('0x18')]}})[_0x99df('0x19')](function(_0x3a02f3){if(_0x3a02f3){_0x3a02f3['update']({'lastMsgAt':_0x15330a[_0x99df('0x1a')],'lastMsgDirection':_0x15330a['direction'][_0x99df('0x12')]()});}})['catch'](function(_0x45aa53){console[_0x99df('0x1b')](_0x45aa53);});}if(_0x15330a['direction']===_0x99df('0x13')&&!_0x15330a['secret']){var _0x27f261;_0x847841[_0x99df('0x1c')][_0x99df('0x1d')]()[_0x99df('0x19')](function(_0xbd8099){return _0x847841[_0x99df('0x1e')][_0x99df('0x1f')]({'where':{'id':_0x15330a[_0x99df('0x20')]},'include':[{'model':_0x847841[_0x99df('0x16')],'as':_0x99df('0x21'),'where':{'id':_0x15330a[_0x99df('0x18')]},'limit':0x1,'include':[{'model':_0x847841[_0x99df('0x1c')],'as':_0x99df('0x22'),'attributes':_[_0x99df('0x23')](_0xbd8099)}]}]});})[_0x99df('0x19')](function(_0x5dc4ad){_0x27f261=_0x5dc4ad[_0x99df('0x24')]({'plain':!![]});if(_0x27f261&&_0x27f261[_0x99df('0x25')]){logger['info']('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x99df('0x26')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x15330a['id'],_0x27f261['replyUri']));if(_0x27f261[_0x99df('0x21')]&&_0x27f261[_0x99df('0x21')][_0x99df('0x27')]){_0x15330a['Interaction']=_['omit'](_0x27f261[_0x99df('0x21')][0x0],_0x99df('0x22'));_0x15330a[_0x99df('0x22')]=_0x27f261[_0x99df('0x21')][0x0][_0x99df('0x22')];}var _0x1ca101={'method':'POST','uri':encodeURI(_0x27f261[_0x99df('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1ca101[_0x99df('0x28')]){case _0x99df('0x29'):_0x1ca101['qs']=_0x15330a;break;case'POST':_0x1ca101['body']=_0x15330a;break;}return rp(_0x1ca101)['then'](function(_0x34c836){logger['info'](_0x99df('0x2a'),_0x99df('0x2b'),util[_0x99df('0x26')](_0x99df('0x2c'),_0x15330a['id'],_0x27f261[_0x99df('0x25')]));if(_0x34c836[_0x99df('0xe')][_0x99df('0x2d')]&&_0x34c836[_0x99df('0xe')][_0x99df('0x2d')]!=_0x15330a['Interaction'][_0x99df('0x2d')]){return _0x847841['OpenchannelInteraction'][_0x99df('0x2e')]({'threadId':_0x34c836[_0x99df('0xe')][_0x99df('0x2d')]},{'where':{'id':_0x15330a[_0x99df('0x2f')]['id']}});}else{return;}})[_0x99df('0x19')](function(){return _0x10e42f[_0x99df('0x2e')]({'read':!![]});})[_0x99df('0x30')](function(_0xd74386){logger['error']('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util['inspect'](_0xd74386,{'showHidden':![],'depth':null}));_0x5e42a0();});}else{_0x5e42a0();}})[_0x99df('0x31')](function(){_0x5e42a0();});}else{_0x5e42a0();}}},'charset':'utf8mb4','collate':_0x99df('0x32')});}; \ No newline at end of file +var _0x6aba=['OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','error','then','OpenchannelAccount','find','OpenchannelAccountId','CmContact','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','Interaction','omit','POST','GET','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','inspect','finally','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0x3aff6f,_0x23c8d8){var _0x4c37b5=function(_0x414a76){while(--_0x414a76){_0x3aff6f['push'](_0x3aff6f['shift']());}};_0x4c37b5(++_0x23c8d8);}(_0x6aba,0xe5));var _0xa6ab=function(_0xf8ef36,_0x587316){_0xf8ef36=_0xf8ef36-0x0;var _0x5eefb3=_0x6aba[_0xf8ef36];return _0x5eefb3;};'use strict';var _=require(_0xa6ab('0x0'));var util=require(_0xa6ab('0x1'));var logger=require(_0xa6ab('0x2'))('api');var moment=require(_0xa6ab('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa6ab('0x4'));var config=require(_0xa6ab('0x5'));var attributes=require(_0xa6ab('0x6'));module[_0xa6ab('0x7')]=function(_0x307783,_0x5a1ac6){return _0x307783[_0xa6ab('0x8')](_0xa6ab('0x9'),attributes,{'tableName':_0xa6ab('0xa'),'paranoid':![],'indexes':[{'name':_0xa6ab('0xb'),'fields':[_0xa6ab('0xc')],'type':_0xa6ab('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xd800bd,_0x324499,_0x242a19){var _0x52b9dc=_0x307783['models'];var _0xe1e5d5=_0xd800bd[_0xa6ab('0xe')]({'plain':!![]});if(_0xe1e5d5[_0xa6ab('0xf')][_0xa6ab('0x10')]()==='in'||_0xe1e5d5[_0xa6ab('0xf')]['toLowerCase']()===_0xa6ab('0x11')&&!_0xe1e5d5[_0xa6ab('0x12')]&&!_[_0xa6ab('0x13')](_0xe1e5d5[_0xa6ab('0x14')])){_0x52b9dc[_0xa6ab('0x15')][_0xa6ab('0x16')]({'where':{'id':_0xe1e5d5[_0xa6ab('0x17')]}})['then'](function(_0x3e886a){if(_0x3e886a){_0x3e886a[_0xa6ab('0x18')]({'lastMsgAt':_0xe1e5d5[_0xa6ab('0x19')],'lastMsgDirection':_0xe1e5d5['direction'][_0xa6ab('0x10')]()});}})['catch'](function(_0x191cce){console[_0xa6ab('0x1a')](_0x191cce);});}if(_0xe1e5d5[_0xa6ab('0xf')]==='out'&&!_0xe1e5d5[_0xa6ab('0x12')]){var _0xebf042;_0x52b9dc['CmContact']['describe']()[_0xa6ab('0x1b')](function(_0x5f37c3){return _0x52b9dc[_0xa6ab('0x1c')][_0xa6ab('0x1d')]({'where':{'id':_0xe1e5d5[_0xa6ab('0x1e')]},'include':[{'model':_0x52b9dc[_0xa6ab('0x15')],'as':'Interactions','where':{'id':_0xe1e5d5[_0xa6ab('0x17')]},'limit':0x1,'include':[{'model':_0x52b9dc[_0xa6ab('0x1f')],'as':_0xa6ab('0x20'),'attributes':_[_0xa6ab('0x21')](_0x5f37c3)}]}]});})['then'](function(_0x2ef886){_0xebf042=_0x2ef886[_0xa6ab('0xe')]({'plain':!![]});if(_0xebf042&&_0xebf042[_0xa6ab('0x22')]){logger[_0xa6ab('0x23')](_0xa6ab('0x24'),'afterCreate',util[_0xa6ab('0x25')](_0xa6ab('0x26'),_0xe1e5d5['id'],_0xebf042['replyUri']));if(_0xebf042[_0xa6ab('0x27')]&&_0xebf042[_0xa6ab('0x27')]['length']){_0xe1e5d5[_0xa6ab('0x28')]=_[_0xa6ab('0x29')](_0xebf042[_0xa6ab('0x27')][0x0],_0xa6ab('0x20'));_0xe1e5d5[_0xa6ab('0x20')]=_0xebf042[_0xa6ab('0x27')][0x0][_0xa6ab('0x20')];}var _0x324499={'method':_0xa6ab('0x2a'),'uri':encodeURI(_0xebf042[_0xa6ab('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x324499['method']){case _0xa6ab('0x2b'):_0x324499['qs']=_0xe1e5d5;break;case _0xa6ab('0x2a'):_0x324499[_0xa6ab('0xc')]=_0xe1e5d5;break;}return rp(_0x324499)[_0xa6ab('0x1b')](function(_0x505d58){logger[_0xa6ab('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0xa6ab('0x2c'),util[_0xa6ab('0x25')](_0xa6ab('0x2d'),_0xe1e5d5['id'],_0xebf042['replyUri']));if(_0x505d58[_0xa6ab('0xc')][_0xa6ab('0x2e')]&&_0x505d58['body']['threadId']!=_0xe1e5d5[_0xa6ab('0x28')][_0xa6ab('0x2e')]){return _0x52b9dc[_0xa6ab('0x15')][_0xa6ab('0x18')]({'threadId':_0x505d58['body'][_0xa6ab('0x2e')]},{'where':{'id':_0xe1e5d5[_0xa6ab('0x28')]['id']}});}else{return;}})[_0xa6ab('0x1b')](function(){return _0xd800bd[_0xa6ab('0x18')]({'read':!![]});})[_0xa6ab('0x2f')](function(_0x5d938b){logger['error']('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xa6ab('0x30')](_0x5d938b,{'showHidden':![],'depth':null}));_0x242a19();});}else{_0x242a19();}})[_0xa6ab('0x31')](function(){_0x242a19();});}else{_0x242a19();}}},'charset':'utf8mb4','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 fc946d2..c77c6f2 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 _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x24f0af,_0x16df82){var _0xee9541=function(_0x5644c6){while(--_0x5644c6){_0x24f0af['push'](_0x24f0af['shift']());}};_0xee9541(++_0x16df82);}(_0xadb5,0xad));var _0x5adb=function(_0x3414e2,_0x638f41){_0x3414e2=_0x3414e2-0x0;var _0x4f4f79=_0xadb5[_0x3414e2];return _0x4f4f79;};'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});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file +var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2ce76a,_0x2462f2){var _0x538e7e=function(_0x19dc75){while(--_0x19dc75){_0x2ce76a['push'](_0x2ce76a['shift']());}};_0x538e7e(++_0x2462f2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2d9d59,_0x2e383e){_0x2d9d59=_0x2d9d59-0x0;var _0x4ee6a6=_0x5f2f[_0x2d9d59];return _0x4ee6a6;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 0934401..390779a 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 _0x33ac=['save','emit','removeListener','register','length','openchannelMessage:'];(function(_0x19ade7,_0x1f1252){var _0x2a99fa=function(_0xad1895){while(--_0xad1895){_0x19ade7['push'](_0x19ade7['shift']());}};_0x2a99fa(++_0x1f1252);}(_0x33ac,0x1f2));var _0xc33a=function(_0x1dfe51,_0x21524d){_0x1dfe51=_0x1dfe51-0x0;var _0x1a9ca8=_0x33ac[_0x1dfe51];return _0x1a9ca8;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xc33a('0x0'),'remove','update'];function createListener(_0x22ceee,_0x24d82c){return function(_0x3c58e){_0x24d82c[_0xc33a('0x1')](_0x22ceee,_0x3c58e);};}function removeListener(_0x380461,_0xf33498){return function(){OpenchannelMessageEvents[_0xc33a('0x2')](_0x380461,_0xf33498);};}exports[_0xc33a('0x3')]=function(_0x322368){for(var _0x554de7=0x0,_0x5aa2fc=events[_0xc33a('0x4')];_0x554de7<_0x5aa2fc;_0x554de7++){var _0xf2e092=events[_0x554de7];var _0x5bdf4a=createListener(_0xc33a('0x5')+_0xf2e092,_0x322368);OpenchannelMessageEvents['on'](_0xf2e092,_0x5bdf4a);}}; \ No newline at end of file +var _0xde81=['save','remove','update','removeListener','register','length','./openchannelMessage.events'];(function(_0x251fa8,_0x438d42){var _0x3d89e9=function(_0x5f91dc){while(--_0x5f91dc){_0x251fa8['push'](_0x251fa8['shift']());}};_0x3d89e9(++_0x438d42);}(_0xde81,0x109));var _0x1de8=function(_0x455f19,_0x4f8f3a){_0x455f19=_0x455f19-0x0;var _0x422f21=_0xde81[_0x455f19];return _0x422f21;};'use strict';var OpenchannelMessageEvents=require(_0x1de8('0x0'));var events=[_0x1de8('0x1'),_0x1de8('0x2'),_0x1de8('0x3')];function createListener(_0x16911a,_0x21db66){return function(_0x52a51a){_0x21db66['emit'](_0x16911a,_0x52a51a);};}function removeListener(_0xebfcf9,_0x5953a6){return function(){OpenchannelMessageEvents[_0x1de8('0x4')](_0xebfcf9,_0x5953a6);};}exports[_0x1de8('0x5')]=function(_0x42801a){for(var _0x3ae723=0x0,_0x22918e=events[_0x1de8('0x6')];_0x3ae723<_0x22918e;_0x3ae723++){var _0x435404=events[_0x3ae723];var _0x5ae9ca=createListener('openchannelMessage:'+_0x435404,_0x42801a);OpenchannelMessageEvents['on'](_0x435404,_0x5ae9ca);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index a1e018c..5616ec5 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 _0xd638=['getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','delete','destroy','removeAgents','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd638,0x172));var _0x8d63=function(_0x1d7827,_0x42b0db){_0x1d7827=_0x1d7827-0x0;var _0xb449f1=_0xd638[_0x1d7827];return _0xb449f1;};'use strict';var multer=require(_0x8d63('0x0'));var util=require('util');var path=require(_0x8d63('0x1'));var timeout=require('connect-timeout');var express=require(_0x8d63('0x2'));var router=express[_0x8d63('0x3')]();var fs_extra=require(_0x8d63('0x4'));var auth=require(_0x8d63('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8d63('0x6'));var controller=require(_0x8d63('0x7'));router[_0x8d63('0x8')]('/',auth[_0x8d63('0x9')](),controller[_0x8d63('0xa')]);router[_0x8d63('0x8')](_0x8d63('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x8d63('0x8')](_0x8d63('0xc'),auth[_0x8d63('0x9')](),controller[_0x8d63('0xd')]);router[_0x8d63('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0x8d63('0xe')]);router[_0x8d63('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0x8d63('0xf')]);router['get'](_0x8d63('0x10'),auth[_0x8d63('0x9')](),controller[_0x8d63('0x11')]);router[_0x8d63('0x12')]('/',auth[_0x8d63('0x9')](),controller[_0x8d63('0x13')]);router['post']('/:id/teams',auth[_0x8d63('0x9')](),controller[_0x8d63('0x14')]);router[_0x8d63('0x12')](_0x8d63('0x10'),auth[_0x8d63('0x9')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8d63('0x15')]('/:id',auth[_0x8d63('0x9')](),controller[_0x8d63('0x16')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x8d63('0x10'),auth['isAuthenticated'](),controller[_0x8d63('0x17')]);module['exports']=router; \ No newline at end of file +var _0x139a=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getTeams','/:id/users','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x139a,0x1a4));var _0xa139=function(_0x4ddd99,_0x40627a){_0x4ddd99=_0x4ddd99-0x0;var _0x35b9b4=_0x139a[_0x4ddd99];return _0x35b9b4;};'use strict';var multer=require(_0xa139('0x0'));var util=require('util');var path=require(_0xa139('0x1'));var timeout=require(_0xa139('0x2'));var express=require(_0xa139('0x3'));var router=express[_0xa139('0x4')]();var fs_extra=require(_0xa139('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa139('0x6'));var config=require(_0xa139('0x7'));var controller=require(_0xa139('0x8'));router[_0xa139('0x9')]('/',auth[_0xa139('0xa')](),controller[_0xa139('0xb')]);router[_0xa139('0x9')](_0xa139('0xc'),auth[_0xa139('0xa')](),controller['describe']);router[_0xa139('0x9')](_0xa139('0xd'),auth['isAuthenticated'](),controller[_0xa139('0xe')]);router['get'](_0xa139('0xf'),auth['isAuthenticated'](),controller['getMembers']);router[_0xa139('0x9')]('/:id/teams',auth[_0xa139('0xa')](),controller[_0xa139('0x10')]);router[_0xa139('0x9')](_0xa139('0x11'),auth[_0xa139('0xa')](),controller['getAgents']);router[_0xa139('0x12')]('/',auth[_0xa139('0xa')](),controller[_0xa139('0x13')]);router[_0xa139('0x12')](_0xa139('0x14'),auth[_0xa139('0xa')](),controller[_0xa139('0x15')]);router[_0xa139('0x12')](_0xa139('0x11'),auth[_0xa139('0xa')](),controller[_0xa139('0x16')]);router[_0xa139('0x17')]('/:id',auth[_0xa139('0xa')](),controller[_0xa139('0x18')]);router[_0xa139('0x19')](_0xa139('0xd'),auth[_0xa139('0xa')](),controller[_0xa139('0x1a')]);router['delete'](_0xa139('0x14'),auth[_0xa139('0xa')](),controller[_0xa139('0x1b')]);router['delete']('/:id/users',auth[_0xa139('0xa')](),controller[_0xa139('0x1c')]);module[_0xa139('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index f5a63e0..7d5f31a 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 _0x2339=['roundrobin','sequelize','exports','STRING','name','ENUM','rrmemory','beepall'];(function(_0x1639bf,_0x467fb5){var _0x1ecc09=function(_0x1b61dd){while(--_0x1b61dd){_0x1639bf['push'](_0x1639bf['shift']());}};_0x1ecc09(++_0x467fb5);}(_0x2339,0x151));var _0x9233=function(_0x343e57,_0x5bcb1a){_0x343e57=_0x343e57-0x0;var _0x241c72=_0x2339[_0x343e57];return _0x241c72;};'use strict';var Sequelize=require(_0x9233('0x0'));module[_0x9233('0x1')]={'name':{'type':Sequelize[_0x9233('0x2')],'unique':_0x9233('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9233('0x4')](_0x9233('0x5'),_0x9233('0x6'),_0x9233('0x7'))}}; \ No newline at end of file +var _0xadc8=['roundrobin','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x9c8b4a,_0x2387ff){var _0x198bef=function(_0x2eb4e8){while(--_0x2eb4e8){_0x9c8b4a['push'](_0x9c8b4a['shift']());}};_0x198bef(++_0x2387ff);}(_0xadc8,0xf1));var _0x8adc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xadc8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8adc('0x0'));module['exports']={'name':{'type':Sequelize[_0x8adc('0x1')],'unique':_0x8adc('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8adc('0x1')]},'timeout':{'type':Sequelize[_0x8adc('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8adc('0x4')]('rrmemory','beepall',_0x8adc('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 185e3fe..542d968 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 _0x3eeb=['all','union','compact','value','transaction','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','eml-format','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','OpenchannelQueue','includeAll','findAll','rows','catch','show','params','include','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OpenchannelQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue','pick','OpenchannelQueueId','filter','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','each','findOrCreate','forEach','emit','removeTeams','select','field','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','sequelize','toString','every','includes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3eeb,0x11e));var _0xb3ee=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x3eeb[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0xb3ee('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb3ee('0x1'));var rp=require('request-promise');var moment=require(_0xb3ee('0x2'));var BPromise=require(_0xb3ee('0x3'));var Mustache=require(_0xb3ee('0x4'));var util=require('util');var path=require('path');var sox=require(_0xb3ee('0x5'));var csv=require(_0xb3ee('0x6'));var ejs=require(_0xb3ee('0x7'));var fs=require('fs');var fs_extra=require(_0xb3ee('0x8'));var _=require(_0xb3ee('0x9'));var squel=require('squel');var crypto=require(_0xb3ee('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb3ee('0x6'));var querystring=require('querystring');var Papa=require(_0xb3ee('0xb'));var Redis=require('ioredis');var authService=require(_0xb3ee('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xb3ee('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb3ee('0xe'))(_0xb3ee('0xf'));var utils=require(_0xb3ee('0x10'));var config=require(_0xb3ee('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xb3ee('0x12'))['db'];config['redis']=_[_0xb3ee('0x13')](config[_0xb3ee('0x14')],{'host':_0xb3ee('0x15'),'port':0x18eb});var socket=require(_0xb3ee('0x16'))(new Redis(config[_0xb3ee('0x14')]));require(_0xb3ee('0x17'))[_0xb3ee('0x18')](socket);function respondWithStatusCode(_0x17ae41,_0x44207d){_0x44207d=_0x44207d||0xcc;return function(_0x26cf53){if(_0x26cf53){return _0x17ae41['sendStatus'](_0x44207d);}return _0x17ae41[_0xb3ee('0x19')](_0x44207d)[_0xb3ee('0x1a')]();};}function respondWithResult(_0x405b6e,_0x10b443){_0x10b443=_0x10b443||0xc8;return function(_0x377d40){if(_0x377d40){return _0x405b6e[_0xb3ee('0x19')](_0x10b443)['json'](_0x377d40);}};}function respondWithFilteredResult(_0x45eb09,_0x1f52a3){return function(_0x14a9e3){if(_0x14a9e3){var _0x2930a5=typeof _0x1f52a3['offset']===_0xb3ee('0x1b')&&typeof _0x1f52a3[_0xb3ee('0x1c')]===_0xb3ee('0x1b');var _0x4b65c3=_0x14a9e3[_0xb3ee('0x1d')];var _0xd4ed78=_0x2930a5?0x0:_0x1f52a3[_0xb3ee('0x1e')];var _0x1c6d95=_0x2930a5?_0x14a9e3[_0xb3ee('0x1d')]:_0x1f52a3[_0xb3ee('0x1e')]+_0x1f52a3[_0xb3ee('0x1c')];var _0x26995b;if(_0x1c6d95>=_0x4b65c3){_0x1c6d95=_0x4b65c3;_0x26995b=0xc8;}else{_0x26995b=0xce;}_0x45eb09[_0xb3ee('0x19')](_0x26995b);return _0x45eb09[_0xb3ee('0x1f')](_0xb3ee('0x20'),_0xd4ed78+'-'+_0x1c6d95+'/'+_0x4b65c3)['json'](_0x14a9e3);}return null;};}function patchUpdates(_0x4e47bb){return function(_0x56f1e2){try{jsonpatch['apply'](_0x56f1e2,_0x4e47bb,!![]);}catch(_0x22827d){return BPromise[_0xb3ee('0x21')](_0x22827d);}return _0x56f1e2[_0xb3ee('0x22')]();};}function saveUpdates(_0x5f2d01,_0x4b5d78){return function(_0x34eefe){if(_0x34eefe){return _0x34eefe[_0xb3ee('0x23')](_0x5f2d01)[_0xb3ee('0x24')](function(_0xd4c12a){return _0xd4c12a;});}return null;};}function removeEntity(_0x279725,_0x39e69f){return function(_0x2818e4){if(_0x2818e4){return _0x2818e4[_0xb3ee('0x25')]()[_0xb3ee('0x24')](function(){var _0x39a5a3=_0x2818e4[_0xb3ee('0x26')]({'plain':!![]});var _0x45dab9='OpenchannelQueues';return db[_0xb3ee('0x27')][_0xb3ee('0x25')]({'where':{'type':_0x45dab9,'resourceId':_0x39a5a3['id']}})[_0xb3ee('0x24')](function(){return _0x2818e4;});})[_0xb3ee('0x24')](function(){_0x279725[_0xb3ee('0x19')](0xcc)[_0xb3ee('0x1a')]();});}};}function handleEntityNotFound(_0x51ca99,_0x497b20){return function(_0x54d486){if(!_0x54d486){_0x51ca99['sendStatus'](0x194);}return _0x54d486;};}function handleError(_0x479d98,_0x4c859b){_0x4c859b=_0x4c859b||0x1f4;return function(_0x21861b){logger[_0xb3ee('0x28')](_0x21861b['stack']);if(_0x21861b[_0xb3ee('0x29')]){delete _0x21861b['name'];}_0x479d98[_0xb3ee('0x19')](_0x4c859b)[_0xb3ee('0x2a')](_0x21861b);};}exports['index']=function(_0x43d379,_0x1d4992){var _0x505101={},_0x3999a4={},_0x57b537={'count':0x0,'rows':[]};var _0x45d913=_[_0xb3ee('0x2b')](db['OpenchannelQueue'][_0xb3ee('0x2c')],function(_0x495972){return{'name':_0x495972[_0xb3ee('0x2d')],'type':_0x495972[_0xb3ee('0x2e')]['key']};});_0x3999a4['model']=_[_0xb3ee('0x2b')](_0x45d913,'name');_0x3999a4[_0xb3ee('0x2f')]=_[_0xb3ee('0x30')](_0x43d379[_0xb3ee('0x2f')]);_0x3999a4[_0xb3ee('0x31')]=_[_0xb3ee('0x32')](_0x3999a4[_0xb3ee('0x33')],_0x3999a4[_0xb3ee('0x2f')]);_0x505101['attributes']=_['intersection'](_0x3999a4['model'],qs[_0xb3ee('0x34')](_0x43d379[_0xb3ee('0x2f')][_0xb3ee('0x34')]));_0x505101[_0xb3ee('0x35')]=_0x505101[_0xb3ee('0x35')][_0xb3ee('0x36')]?_0x505101['attributes']:_0x3999a4['model'];if(!_0x43d379[_0xb3ee('0x2f')][_0xb3ee('0x37')](_0xb3ee('0x38'))){_0x505101[_0xb3ee('0x1c')]=qs[_0xb3ee('0x1c')](_0x43d379[_0xb3ee('0x2f')][_0xb3ee('0x1c')]);_0x505101['offset']=qs['offset'](_0x43d379['query']['offset']);}_0x505101[_0xb3ee('0x39')]=qs[_0xb3ee('0x3a')](_0x43d379[_0xb3ee('0x2f')]['sort']);_0x505101[_0xb3ee('0x3b')]=qs[_0xb3ee('0x31')](_['pick'](_0x43d379['query'],_0x3999a4[_0xb3ee('0x31')]),_0x45d913);if(_0x43d379[_0xb3ee('0x2f')]['filter']){_0x505101['where']=_[_0xb3ee('0x3c')](_0x505101['where'],{'$or':_['map'](_0x45d913,function(_0x31c043){if(_0x31c043[_0xb3ee('0x2e')]!=='VIRTUAL'){var _0x440716={};_0x440716[_0x31c043[_0xb3ee('0x29')]]={'$like':'%'+_0x43d379[_0xb3ee('0x2f')]['filter']+'%'};return _0x440716;}})});}_0x505101=_[_0xb3ee('0x3c')]({},_0x505101,_0x43d379['options']);var _0x161b92={'where':_0x505101['where']};return db[_0xb3ee('0x3d')][_0xb3ee('0x1d')](_0x161b92)[_0xb3ee('0x24')](function(_0x309d97){_0x57b537[_0xb3ee('0x1d')]=_0x309d97;if(_0x43d379[_0xb3ee('0x2f')][_0xb3ee('0x3e')]){_0x505101['include']=[{'all':!![]}];}return db[_0xb3ee('0x3d')][_0xb3ee('0x3f')](_0x505101);})[_0xb3ee('0x24')](function(_0x205a02){_0x57b537[_0xb3ee('0x40')]=_0x205a02;return _0x57b537;})[_0xb3ee('0x24')](respondWithFilteredResult(_0x1d4992,_0x505101))[_0xb3ee('0x41')](handleError(_0x1d4992,null));};exports[_0xb3ee('0x42')]=function(_0x4ed1ee,_0x454ebe){var _0x2bec74={'raw':!![],'where':{'id':_0x4ed1ee[_0xb3ee('0x43')]['id']}},_0x42a7a5={};_0x42a7a5[_0xb3ee('0x33')]=_[_0xb3ee('0x30')](db[_0xb3ee('0x3d')][_0xb3ee('0x2c')]);_0x42a7a5[_0xb3ee('0x2f')]=_[_0xb3ee('0x30')](_0x4ed1ee['query']);_0x42a7a5[_0xb3ee('0x31')]=_[_0xb3ee('0x32')](_0x42a7a5['model'],_0x42a7a5[_0xb3ee('0x2f')]);_0x2bec74[_0xb3ee('0x35')]=_[_0xb3ee('0x32')](_0x42a7a5[_0xb3ee('0x33')],qs['fields'](_0x4ed1ee['query'][_0xb3ee('0x34')]));_0x2bec74[_0xb3ee('0x35')]=_0x2bec74[_0xb3ee('0x35')][_0xb3ee('0x36')]?_0x2bec74[_0xb3ee('0x35')]:_0x42a7a5[_0xb3ee('0x33')];if(_0x4ed1ee['query']['includeAll']){_0x2bec74[_0xb3ee('0x44')]=[{'all':!![]}];}_0x2bec74=_[_0xb3ee('0x3c')]({},_0x2bec74,_0x4ed1ee[_0xb3ee('0x45')]);return db['OpenchannelQueue'][_0xb3ee('0x46')](_0x2bec74)[_0xb3ee('0x24')](handleEntityNotFound(_0x454ebe,null))[_0xb3ee('0x24')](respondWithResult(_0x454ebe,null))[_0xb3ee('0x41')](handleError(_0x454ebe,null));};exports[_0xb3ee('0x47')]=function(_0x46233e,_0x7543c7){return db['OpenchannelQueue']['create'](_0x46233e['body'],{})['then'](function(_0x43a7c1){var _0x4ff190=_0x46233e['user'][_0xb3ee('0x26')]({'plain':!![]});if(!_0x4ff190)throw new Error(_0xb3ee('0x48'));if(_0x4ff190[_0xb3ee('0x49')]===_0xb3ee('0x4a')){var _0xe38f3a=_0x43a7c1[_0xb3ee('0x26')]({'plain':!![]});var _0x32f5de=_0xb3ee('0x4b');return db[_0xb3ee('0x4c')][_0xb3ee('0x46')]({'where':{'name':_0x32f5de,'userProfileId':_0x4ff190['userProfileId']},'raw':!![]})[_0xb3ee('0x24')](function(_0x522807){if(_0x522807&&_0x522807[_0xb3ee('0x4d')]===0x0){return db['UserProfileResource'][_0xb3ee('0x47')]({'name':_0xe38f3a['name'],'resourceId':_0xe38f3a['id'],'type':_0x522807[_0xb3ee('0x29')],'sectionId':_0x522807['id']},{})[_0xb3ee('0x24')](function(){return _0x43a7c1;});}else{return _0x43a7c1;}})[_0xb3ee('0x41')](function(_0x25573a){logger[_0xb3ee('0x28')](_0xb3ee('0x4e'),_0x25573a);throw _0x25573a;});}return _0x43a7c1;})[_0xb3ee('0x24')](respondWithResult(_0x7543c7,0xc9))[_0xb3ee('0x41')](handleError(_0x7543c7,null));};exports[_0xb3ee('0x23')]=function(_0x25974e,_0x510371){if(_0x25974e[_0xb3ee('0x4f')]['id']){delete _0x25974e['body']['id'];}return db[_0xb3ee('0x3d')][_0xb3ee('0x46')]({'where':{'id':_0x25974e[_0xb3ee('0x43')]['id']}})[_0xb3ee('0x24')](handleEntityNotFound(_0x510371,null))[_0xb3ee('0x24')](saveUpdates(_0x25974e[_0xb3ee('0x4f')],null))[_0xb3ee('0x24')](respondWithResult(_0x510371,null))[_0xb3ee('0x41')](handleError(_0x510371,null));};exports[_0xb3ee('0x25')]=function(_0x180e49,_0x4c34d4){return db[_0xb3ee('0x3d')][_0xb3ee('0x46')]({'where':{'id':_0x180e49[_0xb3ee('0x43')]['id']}})[_0xb3ee('0x24')](handleEntityNotFound(_0x4c34d4,null))['then'](removeEntity(_0x4c34d4,null))['catch'](handleError(_0x4c34d4,null));};exports[_0xb3ee('0x50')]=function(_0x376f02,_0x253085){return db[_0xb3ee('0x3d')][_0xb3ee('0x50')]()['then'](respondWithResult(_0x253085,null))[_0xb3ee('0x41')](handleError(_0x253085,null));};exports[_0xb3ee('0x51')]=function(_0xc1a2ea,_0xa9afd4,_0x591804){var _0x268808={'raw':!![],'where':{}},_0x3b94d3={},_0x33a98e;return db[_0xb3ee('0x3d')][_0xb3ee('0x52')]({'where':{'id':_0xc1a2ea[_0xb3ee('0x43')]['id']}})[_0xb3ee('0x24')](handleEntityNotFound(_0xa9afd4,null))[_0xb3ee('0x24')](function(_0x3aae19){if(_0x3aae19){_0x33a98e=_0x3aae19[_0xb3ee('0x26')]({'plain':!![]});_0x3b94d3[_0xb3ee('0x33')]=_[_0xb3ee('0x30')](db[_0xb3ee('0x53')]['rawAttributes']);_0x3b94d3[_0xb3ee('0x2f')]=_[_0xb3ee('0x30')](_0xc1a2ea[_0xb3ee('0x2f')]);_0x3b94d3['filters']=_[_0xb3ee('0x32')](_0x3b94d3[_0xb3ee('0x33')],_0x3b94d3[_0xb3ee('0x2f')]);_0x268808[_0xb3ee('0x35')]=_[_0xb3ee('0x32')](_0x3b94d3['model'],qs[_0xb3ee('0x34')](_0xc1a2ea[_0xb3ee('0x2f')][_0xb3ee('0x34')]));_0x268808[_0xb3ee('0x35')]=_0x268808[_0xb3ee('0x35')][_0xb3ee('0x36')]?_0x268808[_0xb3ee('0x35')]:_0x3b94d3['model'];if(!_0xc1a2ea[_0xb3ee('0x2f')][_0xb3ee('0x37')](_0xb3ee('0x38'))){_0x268808[_0xb3ee('0x1c')]=qs[_0xb3ee('0x1c')](_0xc1a2ea[_0xb3ee('0x2f')][_0xb3ee('0x1c')]);_0x268808[_0xb3ee('0x1e')]=qs['offset'](_0xc1a2ea[_0xb3ee('0x2f')][_0xb3ee('0x1e')]);}_0x268808[_0xb3ee('0x39')]=qs['sort'](_0xc1a2ea[_0xb3ee('0x2f')][_0xb3ee('0x3a')]);_0x268808[_0xb3ee('0x3b')]=qs['filters'](_[_0xb3ee('0x54')](_0xc1a2ea['query'],_0x3b94d3[_0xb3ee('0x31')]));_0x268808['where'][_0xb3ee('0x55')]=_0x3aae19['id'];if(_0xc1a2ea[_0xb3ee('0x2f')]['filter']){_0x268808[_0xb3ee('0x3b')]=_[_0xb3ee('0x3c')](_0x268808[_0xb3ee('0x3b')],{'$or':_[_0xb3ee('0x2b')](_0x268808[_0xb3ee('0x35')],function(_0x5f1932){var _0xa37481={};_0xa37481[_0x5f1932]={'$like':'%'+_0xc1a2ea['query'][_0xb3ee('0x56')]+'%'};return _0xa37481;})});}_0x268808=_['merge']({},_0x268808,_0xc1a2ea[_0xb3ee('0x45')]);return db[_0xb3ee('0x53')][_0xb3ee('0x3f')](_0x268808);}})[_0xb3ee('0x24')](function(_0x2515e4){if(_0x2515e4){return db[_0xb3ee('0x57')][_0xb3ee('0x58')]({'where':{'id':_[_0xb3ee('0x2b')](_0x2515e4,_0xb3ee('0x59')),'role':_0xb3ee('0x5a')},'attributes':['id',_0xb3ee('0x29'),_0xb3ee('0x5b'),_0xb3ee('0x5c'),_0xb3ee('0x5d')]});}})['then'](function(_0x3359ce){if(_0x3359ce){return{'count':_0x3359ce['count'],'rows':_['map'](_0x3359ce['rows'],function(_0xa0c3be){return{'membername':_0xa0c3be[_0xb3ee('0x29')],'UserId':_0xa0c3be['id'],'queue_name':_0x33a98e['name'],'OpenchannelQueueId':_0x33a98e['id'],'interface':util['format'](_0xb3ee('0x5e'),_0xb3ee('0x5f'),_0xa0c3be[_0xb3ee('0x29')]),'penalty':0x0,'paused':_0xa0c3be[_0xb3ee('0x5b')],'createdAt':_0xa0c3be[_0xb3ee('0x5d')],'updatedAt':_0xa0c3be[_0xb3ee('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb3ee('0x24')](respondWithFilteredResult(_0xa9afd4,_0x268808))[_0xb3ee('0x41')](handleError(_0xa9afd4,null));};exports[_0xb3ee('0x60')]=function(_0x4dc3f4,_0x91a82c,_0x262f9e){var _0x29cc04={};var _0x1a04ce={};var _0x5c86d7;var _0x398af7;return db['OpenchannelQueue'][_0xb3ee('0x52')]({'where':{'id':_0x4dc3f4[_0xb3ee('0x43')]['id']}})[_0xb3ee('0x24')](handleEntityNotFound(_0x91a82c,null))[_0xb3ee('0x24')](function(_0x20930f){if(_0x20930f){_0x5c86d7=_0x20930f;_0x1a04ce['model']=_[_0xb3ee('0x30')](db[_0xb3ee('0x61')][_0xb3ee('0x2c')]);_0x1a04ce[_0xb3ee('0x2f')]=_['keys'](_0x4dc3f4[_0xb3ee('0x2f')]);_0x1a04ce[_0xb3ee('0x31')]=_[_0xb3ee('0x32')](_0x1a04ce[_0xb3ee('0x33')],_0x1a04ce['query']);_0x29cc04[_0xb3ee('0x35')]=_[_0xb3ee('0x32')](_0x1a04ce[_0xb3ee('0x33')],qs['fields'](_0x4dc3f4[_0xb3ee('0x2f')]['fields']));_0x29cc04[_0xb3ee('0x35')]=_0x29cc04['attributes'][_0xb3ee('0x36')]?_0x29cc04[_0xb3ee('0x35')]:_0x1a04ce[_0xb3ee('0x33')];_0x29cc04[_0xb3ee('0x39')]=qs[_0xb3ee('0x3a')](_0x4dc3f4['query'][_0xb3ee('0x3a')]);_0x29cc04['where']=qs['filters'](_[_0xb3ee('0x54')](_0x4dc3f4[_0xb3ee('0x2f')],_0x1a04ce[_0xb3ee('0x31')]));if(_0x4dc3f4[_0xb3ee('0x2f')][_0xb3ee('0x56')]){_0x29cc04[_0xb3ee('0x3b')]=_['merge'](_0x29cc04[_0xb3ee('0x3b')],{'$or':_[_0xb3ee('0x2b')](_0x29cc04[_0xb3ee('0x35')],function(_0x4213ee){var _0xbdfde5={};_0xbdfde5[_0x4213ee]={'$like':'%'+_0x4dc3f4[_0xb3ee('0x2f')][_0xb3ee('0x56')]+'%'};return _0xbdfde5;})});}_0x29cc04=_[_0xb3ee('0x3c')]({},_0x29cc04,_0x4dc3f4[_0xb3ee('0x45')]);return _0x5c86d7[_0xb3ee('0x60')](_0x29cc04);}})[_0xb3ee('0x24')](function(_0x25e62b){if(_0x25e62b){_0x398af7=_0x25e62b[_0xb3ee('0x36')];if(!_0x4dc3f4[_0xb3ee('0x2f')][_0xb3ee('0x37')]('nolimit')){_0x29cc04['limit']=qs[_0xb3ee('0x1c')](_0x4dc3f4[_0xb3ee('0x2f')][_0xb3ee('0x1c')]);_0x29cc04[_0xb3ee('0x1e')]=qs[_0xb3ee('0x1e')](_0x4dc3f4[_0xb3ee('0x2f')][_0xb3ee('0x1e')]);}return _0x5c86d7['getTeams'](_0x29cc04);}})[_0xb3ee('0x24')](function(_0x56792a){if(_0x56792a){return _0x56792a?{'count':_0x398af7,'rows':_0x56792a}:null;}})[_0xb3ee('0x24')](respondWithResult(_0x91a82c,null))[_0xb3ee('0x41')](handleError(_0x91a82c,null));};exports[_0xb3ee('0x62')]=function(_0x4e6c38,_0x350f6d,_0x577c3a){var _0x28c01b=_0x4e6c38['body'][_0xb3ee('0x63')];return db[_0xb3ee('0x61')]['findAll']({'where':{'id':_0x28c01b},'attributes':['id'],'include':[{'model':db[_0xb3ee('0x57')],'as':_0xb3ee('0x64'),'attributes':['id',_0xb3ee('0x29'),_0xb3ee('0x65'),_0xb3ee('0x66'),_0xb3ee('0x67')],'raw':!![]}]})[_0xb3ee('0x24')](function(_0x3453d0){if(_0x3453d0){var _0x53e384=_[_0xb3ee('0x68')](_0x3453d0,function(_0x36f0cc){var _0x1f766d=_0x36f0cc['get']({'plain':!![]});return _0x1f766d[_0xb3ee('0x64')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x4e6c38[_0xb3ee('0x43')]['id']}})['then'](function(_0x4df68d){return db['sequelize']['transaction'](function(_0x5d169c){return _0x4df68d['addTeams'](_0x28c01b,{'transaction':_0x5d169c})[_0xb3ee('0x24')](function(){return BPromise[_0xb3ee('0x69')](_0x53e384,function(_0x48b642){return db['UserOpenchannelQueue'][_0xb3ee('0x6a')]({'where':{'UserId':_0x48b642['id'],'OpenchannelQueueId':_0x4e6c38[_0xb3ee('0x43')]['id']},'transaction':_0x5d169c});});})[_0xb3ee('0x24')](function(){_0x53e384[_0xb3ee('0x6b')](function(_0xfdcb96){socket[_0xb3ee('0x6c')]('userOpenchannelQueue:save',{'UserId':_0xfdcb96['id'],'OpenchannelQueueId':_0x4df68d['id']});});});});});}})['then'](respondWithStatusCode(_0x350f6d,null))['catch'](handleError(_0x350f6d,null));};exports[_0xb3ee('0x6d')]=function(_0x21d547,_0x12c5d2,_0x23dde7){return db[_0xb3ee('0x61')][_0xb3ee('0x3f')]({'where':{'id':_0x21d547['query'][_0xb3ee('0x63')]},'attributes':['id'],'include':[{'model':db[_0xb3ee('0x57')],'as':_0xb3ee('0x64'),'attributes':['id'],'raw':!![]}]})[_0xb3ee('0x24')](handleEntityNotFound(_0x12c5d2,null))[_0xb3ee('0x24')](function(_0x5cbe81){var _0x2df5fe=_[_0xb3ee('0x2b')](_0x5cbe81,'id');var _0x3397c7=[];var _0x2a2157=[];var _0x58fc75=squel[_0xb3ee('0x6e')]();_0x58fc75[_0xb3ee('0x6f')]('tq.TeamId')[_0xb3ee('0x70')](_0xb3ee('0x71'),'tq')[_0xb3ee('0x72')](_0xb3ee('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xb3ee('0x3b')](_0xb3ee('0x74'),_0x21d547[_0xb3ee('0x43')]['id']);for(var _0x295c4a=0x0;_0x295c4a<_0x5cbe81[_0xb3ee('0x36')];_0x295c4a+=0x1){let _0x129d12=_0x5cbe81[_0x295c4a];for(var _0x59db7f=0x0;_0x59db7f<_0x129d12[_0xb3ee('0x64')][_0xb3ee('0x36')];_0x59db7f+=0x1){let _0x1c2d3a=_0x129d12['Agents'][_0x59db7f];var _0x1775f8=_0x58fc75[_0xb3ee('0x75')]();_0x1775f8['where']('ut.UserId\x20=\x20?',_0x1c2d3a['id']);_0x2a2157['push'](db[_0xb3ee('0x76')][_0xb3ee('0x2f')](_0x1775f8[_0xb3ee('0x77')](),{'type':db[_0xb3ee('0x76')]['QueryTypes']['SELECT']})[_0xb3ee('0x24')](function(_0x58c52e){if(_0x58c52e[_0xb3ee('0x36')]===0x1){return _0x1c2d3a['id'];}else{var _0x2754fc=_[_0xb3ee('0x78')](_[_0xb3ee('0x2b')](_0x58c52e,'TeamId'),function(_0x14fb79){return _[_0xb3ee('0x79')](_0x2df5fe,_0x14fb79);});if(_0x2754fc){return _0x1c2d3a['id'];}}}));}}return BPromise[_0xb3ee('0x7a')](_0x2a2157)[_0xb3ee('0x24')](function(_0x658383){_0x3397c7=_(_0x3397c7)[_0xb3ee('0x7b')](_0x658383)[_0xb3ee('0x7c')]()[_0xb3ee('0x7d')]();return db[_0xb3ee('0x3d')]['find']({'where':{'id':_0x21d547[_0xb3ee('0x43')]['id']}})[_0xb3ee('0x24')](function(_0x4e6db2){return db[_0xb3ee('0x76')][_0xb3ee('0x7e')](function(_0x139eda){return _0x4e6db2[_0xb3ee('0x6d')](_0x21d547[_0xb3ee('0x2f')]['ids'],{'transaction':_0x139eda})[_0xb3ee('0x24')](function(){if(!_[_0xb3ee('0x7f')](_0x3397c7)){return _0x4e6db2[_0xb3ee('0x80')](_0x3397c7,{'transaction':_0x139eda});}})[_0xb3ee('0x24')](function(){_0x3397c7[_0xb3ee('0x6b')](function(_0x1682a8){socket[_0xb3ee('0x6c')](_0xb3ee('0x81'),{'UserId':_0x1682a8,'OpenchannelQueueId':_0x4e6db2['id']});});});});});});})[_0xb3ee('0x24')](respondWithStatusCode(_0x12c5d2,null))[_0xb3ee('0x41')](handleError(_0x12c5d2,null));};exports[_0xb3ee('0x82')]=function(_0x597b1c,_0xff5f06,_0x5ac7aa){return db['OpenchannelQueue'][_0xb3ee('0x46')]({'where':{'id':_0x597b1c[_0xb3ee('0x43')]['id']}})[_0xb3ee('0x24')](handleEntityNotFound(_0xff5f06,null))[_0xb3ee('0x24')](function(_0x46f148){if(_0x46f148){return _0x46f148['addAgents'](_0x597b1c[_0xb3ee('0x4f')][_0xb3ee('0x63')],_[_0xb3ee('0x83')](_0x597b1c[_0xb3ee('0x4f')],[_0xb3ee('0x63'),'id'])||{})[_0xb3ee('0x84')](function(_0x393972){for(var _0x117e1a=0x0;_0x117e1a<_0x597b1c[_0xb3ee('0x4f')][_0xb3ee('0x63')][_0xb3ee('0x36')];_0x117e1a+=0x1){socket[_0xb3ee('0x6c')](_0xb3ee('0x85'),{'UserId':Number(_0x597b1c['body'][_0xb3ee('0x63')][_0x117e1a]),'OpenchannelQueueId':Number(_0x597b1c['params']['id'])});}return _0x393972;});}})[_0xb3ee('0x24')](respondWithResult(_0xff5f06,null))['catch'](handleError(_0xff5f06,null));};exports[_0xb3ee('0x80')]=function(_0x31f737,_0x199bfa,_0x2438e2){return db[_0xb3ee('0x3d')]['find']({'where':{'id':_0x31f737['params']['id']}})[_0xb3ee('0x24')](handleEntityNotFound(_0x199bfa,null))['then'](function(_0x120321){if(_0x120321){return _0x120321[_0xb3ee('0x80')](_0x31f737[_0xb3ee('0x2f')][_0xb3ee('0x63')])[_0xb3ee('0x24')](function(){if(_[_0xb3ee('0x86')](_0x31f737[_0xb3ee('0x2f')][_0xb3ee('0x63')])){for(var _0x2e4819=0x0;_0x2e4819<_0x31f737[_0xb3ee('0x2f')][_0xb3ee('0x63')]['length'];_0x2e4819+=0x1){socket['emit'](_0xb3ee('0x81'),{'UserId':Number(_0x31f737[_0xb3ee('0x2f')][_0xb3ee('0x63')][_0x2e4819]),'OpenchannelQueueId':Number(_0x31f737[_0xb3ee('0x43')]['id'])});}}else{socket[_0xb3ee('0x6c')]('userOpenchannelQueue:remove',{'UserId':Number(_0x31f737[_0xb3ee('0x2f')][_0xb3ee('0x63')]),'OpenchannelQueueId':Number(_0x31f737[_0xb3ee('0x43')]['id'])});}});}})[_0xb3ee('0x24')](respondWithStatusCode(_0x199bfa,null))[_0xb3ee('0x41')](handleError(_0x199bfa,null));};exports[_0xb3ee('0x87')]=function(_0x509ac1,_0x823411,_0x54e813){var _0x3d3dc0={};var _0x1aec4b={};var _0x5c9a3a;var _0x4edcb6;return db[_0xb3ee('0x3d')][_0xb3ee('0x52')]({'where':{'id':_0x509ac1[_0xb3ee('0x43')]['id']}})[_0xb3ee('0x24')](handleEntityNotFound(_0x823411,null))[_0xb3ee('0x24')](function(_0x57b286){if(_0x57b286){_0x5c9a3a=_0x57b286;_0x1aec4b[_0xb3ee('0x33')]=_[_0xb3ee('0x30')](db[_0xb3ee('0x57')][_0xb3ee('0x2c')]);_0x1aec4b[_0xb3ee('0x2f')]=_[_0xb3ee('0x30')](_0x509ac1[_0xb3ee('0x2f')]);_0x1aec4b[_0xb3ee('0x31')]=_[_0xb3ee('0x32')](_0x1aec4b['model'],_0x1aec4b['query']);_0x3d3dc0[_0xb3ee('0x35')]=_['intersection'](_0x1aec4b[_0xb3ee('0x33')],qs[_0xb3ee('0x34')](_0x509ac1[_0xb3ee('0x2f')][_0xb3ee('0x34')]));_0x3d3dc0[_0xb3ee('0x35')]=_0x3d3dc0['attributes'][_0xb3ee('0x36')]?_0x3d3dc0[_0xb3ee('0x35')]:_0x1aec4b[_0xb3ee('0x33')];_0x3d3dc0[_0xb3ee('0x39')]=qs['sort'](_0x509ac1[_0xb3ee('0x2f')]['sort']);_0x3d3dc0[_0xb3ee('0x3b')]=qs[_0xb3ee('0x31')](_['pick'](_0x509ac1[_0xb3ee('0x2f')],_0x1aec4b[_0xb3ee('0x31')]));if(_0x509ac1['query'][_0xb3ee('0x56')]){_0x3d3dc0[_0xb3ee('0x3b')]=_[_0xb3ee('0x3c')](_0x3d3dc0['where'],{'$or':_['map'](_0x3d3dc0[_0xb3ee('0x35')],function(_0x5f1968){var _0x38c56d={};_0x38c56d[_0x5f1968]={'$like':'%'+_0x509ac1[_0xb3ee('0x2f')][_0xb3ee('0x56')]+'%'};return _0x38c56d;})});}_0x3d3dc0=_[_0xb3ee('0x3c')]({},_0x3d3dc0,_0x509ac1[_0xb3ee('0x45')]);return _0x5c9a3a[_0xb3ee('0x87')](_0x3d3dc0);}})[_0xb3ee('0x24')](function(_0x5e5142){if(_0x5e5142){_0x4edcb6=_0x5e5142['length'];if(!_0x509ac1[_0xb3ee('0x2f')][_0xb3ee('0x37')](_0xb3ee('0x38'))){_0x3d3dc0[_0xb3ee('0x1c')]=qs[_0xb3ee('0x1c')](_0x509ac1[_0xb3ee('0x2f')][_0xb3ee('0x1c')]);_0x3d3dc0[_0xb3ee('0x1e')]=qs['offset'](_0x509ac1[_0xb3ee('0x2f')][_0xb3ee('0x1e')]);}return _0x5c9a3a[_0xb3ee('0x87')](_0x3d3dc0);}})[_0xb3ee('0x24')](function(_0x493f89){if(_0x493f89){return _0x493f89?{'count':_0x4edcb6,'rows':_0x493f89}:null;}})[_0xb3ee('0x24')](respondWithResult(_0x823411,null))[_0xb3ee('0x41')](handleError(_0x823411,null));}; \ No newline at end of file +var _0x62a7=['userOpenchannelQueue:remove','getAgents','eml-format','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./openchannelQueue.socket','sendStatus','end','status','offset','count','limit','set','json','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','map','OpenchannelQueue','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','include','find','create','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue','order','OpenchannelQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','openchannelPause','getTeams','Team','rawAttributes','ids','voicePause','interface','flatMap','Agents','sequelize','addTeams','each','forEach','userOpenchannelQueue:save','findAll','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','compact','removeAgents','emit','addAgents','omit','spread'];(function(_0x2c39b4,_0x1875ca){var _0x25dc5e=function(_0x34b8fd){while(--_0x34b8fd){_0x2c39b4['push'](_0x2c39b4['shift']());}};_0x25dc5e(++_0x1875ca);}(_0x62a7,0x191));var _0x762a=function(_0x337216,_0x4184e2){_0x337216=_0x337216-0x0;var _0x113fdb=_0x62a7[_0x337216];return _0x113fdb;};'use strict';var emlformat=require(_0x762a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x762a('0x1'));var Mustache=require('mustache');var util=require(_0x762a('0x2'));var path=require(_0x762a('0x3'));var sox=require('sox');var csv=require(_0x762a('0x4'));var ejs=require(_0x762a('0x5'));var fs=require('fs');var fs_extra=require(_0x762a('0x6'));var _=require('lodash');var squel=require(_0x762a('0x7'));var crypto=require(_0x762a('0x8'));var jsforce=require(_0x762a('0x9'));var deskjs=require(_0x762a('0xa'));var toCsv=require(_0x762a('0x4'));var querystring=require(_0x762a('0xb'));var Papa=require(_0x762a('0xc'));var Redis=require('ioredis');var authService=require(_0x762a('0xd'));var qs=require(_0x762a('0xe'));var as=require(_0x762a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x762a('0x10'))(_0x762a('0x11'));var utils=require(_0x762a('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x762a('0x13'));var db=require('../../mysqldb')['db'];config[_0x762a('0x14')]=_[_0x762a('0x15')](config[_0x762a('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x762a('0x16'))(new Redis(config[_0x762a('0x14')]));require(_0x762a('0x17'))['register'](socket);function respondWithStatusCode(_0x2e010e,_0x18a5e7){_0x18a5e7=_0x18a5e7||0xcc;return function(_0x5dae47){if(_0x5dae47){return _0x2e010e[_0x762a('0x18')](_0x18a5e7);}return _0x2e010e['status'](_0x18a5e7)[_0x762a('0x19')]();};}function respondWithResult(_0x3351af,_0x5944d0){_0x5944d0=_0x5944d0||0xc8;return function(_0x4a0091){if(_0x4a0091){return _0x3351af[_0x762a('0x1a')](_0x5944d0)['json'](_0x4a0091);}};}function respondWithFilteredResult(_0x3efe17,_0x156b46){return function(_0x451e98){if(_0x451e98){var _0x1a27e2=typeof _0x156b46[_0x762a('0x1b')]==='undefined'&&typeof _0x156b46['limit']==='undefined';var _0x578cbc=_0x451e98[_0x762a('0x1c')];var _0x5b8e5a=_0x1a27e2?0x0:_0x156b46[_0x762a('0x1b')];var _0x4003a2=_0x1a27e2?_0x451e98[_0x762a('0x1c')]:_0x156b46[_0x762a('0x1b')]+_0x156b46[_0x762a('0x1d')];var _0x1d8854;if(_0x4003a2>=_0x578cbc){_0x4003a2=_0x578cbc;_0x1d8854=0xc8;}else{_0x1d8854=0xce;}_0x3efe17[_0x762a('0x1a')](_0x1d8854);return _0x3efe17[_0x762a('0x1e')]('Content-Range',_0x5b8e5a+'-'+_0x4003a2+'/'+_0x578cbc)[_0x762a('0x1f')](_0x451e98);}return null;};}function patchUpdates(_0x4e8555){return function(_0x4762e4){try{jsonpatch['apply'](_0x4762e4,_0x4e8555,!![]);}catch(_0x368441){return BPromise[_0x762a('0x20')](_0x368441);}return _0x4762e4[_0x762a('0x21')]();};}function saveUpdates(_0x615572,_0x436b48){return function(_0x42bcdf){if(_0x42bcdf){return _0x42bcdf[_0x762a('0x22')](_0x615572)[_0x762a('0x23')](function(_0x3da667){return _0x3da667;});}return null;};}function removeEntity(_0x1b660f,_0x3a80f1){return function(_0x13e8b6){if(_0x13e8b6){return _0x13e8b6[_0x762a('0x24')]()[_0x762a('0x23')](function(){var _0x479c5b=_0x13e8b6[_0x762a('0x25')]({'plain':!![]});var _0x1b0a6e=_0x762a('0x26');return db[_0x762a('0x27')][_0x762a('0x24')]({'where':{'type':_0x1b0a6e,'resourceId':_0x479c5b['id']}})[_0x762a('0x23')](function(){return _0x13e8b6;});})['then'](function(){_0x1b660f[_0x762a('0x1a')](0xcc)[_0x762a('0x19')]();});}};}function handleEntityNotFound(_0x1fe2c1,_0x6cc057){return function(_0x12d486){if(!_0x12d486){_0x1fe2c1[_0x762a('0x18')](0x194);}return _0x12d486;};}function handleError(_0x575066,_0x4fa0ad){_0x4fa0ad=_0x4fa0ad||0x1f4;return function(_0x5f22b7){logger[_0x762a('0x28')](_0x5f22b7[_0x762a('0x29')]);if(_0x5f22b7[_0x762a('0x2a')]){delete _0x5f22b7[_0x762a('0x2a')];}_0x575066[_0x762a('0x1a')](_0x4fa0ad)[_0x762a('0x2b')](_0x5f22b7);};}exports['index']=function(_0x1d2f35,_0x5cce4c){var _0x3b721d={},_0x46084c={},_0x5e4321={'count':0x0,'rows':[]};var _0x3306a0=_[_0x762a('0x2c')](db[_0x762a('0x2d')]['rawAttributes'],function(_0x5b2626){return{'name':_0x5b2626[_0x762a('0x2e')],'type':_0x5b2626[_0x762a('0x2f')][_0x762a('0x30')]};});_0x46084c[_0x762a('0x31')]=_['map'](_0x3306a0,_0x762a('0x2a'));_0x46084c[_0x762a('0x32')]=_[_0x762a('0x33')](_0x1d2f35[_0x762a('0x32')]);_0x46084c['filters']=_[_0x762a('0x34')](_0x46084c[_0x762a('0x31')],_0x46084c[_0x762a('0x32')]);_0x3b721d[_0x762a('0x35')]=_[_0x762a('0x34')](_0x46084c[_0x762a('0x31')],qs['fields'](_0x1d2f35[_0x762a('0x32')][_0x762a('0x36')]));_0x3b721d['attributes']=_0x3b721d[_0x762a('0x35')][_0x762a('0x37')]?_0x3b721d[_0x762a('0x35')]:_0x46084c['model'];if(!_0x1d2f35['query'][_0x762a('0x38')](_0x762a('0x39'))){_0x3b721d[_0x762a('0x1d')]=qs[_0x762a('0x1d')](_0x1d2f35[_0x762a('0x32')][_0x762a('0x1d')]);_0x3b721d[_0x762a('0x1b')]=qs[_0x762a('0x1b')](_0x1d2f35[_0x762a('0x32')]['offset']);}_0x3b721d['order']=qs[_0x762a('0x3a')](_0x1d2f35[_0x762a('0x32')][_0x762a('0x3a')]);_0x3b721d[_0x762a('0x3b')]=qs['filters'](_[_0x762a('0x3c')](_0x1d2f35[_0x762a('0x32')],_0x46084c[_0x762a('0x3d')]),_0x3306a0);if(_0x1d2f35[_0x762a('0x32')]['filter']){_0x3b721d[_0x762a('0x3b')]=_[_0x762a('0x3e')](_0x3b721d[_0x762a('0x3b')],{'$or':_[_0x762a('0x2c')](_0x3306a0,function(_0x23b452){if(_0x23b452[_0x762a('0x2f')]!==_0x762a('0x3f')){var _0x80a14c={};_0x80a14c[_0x23b452[_0x762a('0x2a')]]={'$like':'%'+_0x1d2f35['query'][_0x762a('0x40')]+'%'};return _0x80a14c;}})});}_0x3b721d=_[_0x762a('0x3e')]({},_0x3b721d,_0x1d2f35[_0x762a('0x41')]);var _0xc41f17={'where':_0x3b721d[_0x762a('0x3b')]};return db[_0x762a('0x2d')]['count'](_0xc41f17)['then'](function(_0x330c55){_0x5e4321[_0x762a('0x1c')]=_0x330c55;if(_0x1d2f35[_0x762a('0x32')][_0x762a('0x42')]){_0x3b721d['include']=[{'all':!![]}];}return db[_0x762a('0x2d')]['findAll'](_0x3b721d);})[_0x762a('0x23')](function(_0xaffa48){_0x5e4321[_0x762a('0x43')]=_0xaffa48;return _0x5e4321;})[_0x762a('0x23')](respondWithFilteredResult(_0x5cce4c,_0x3b721d))[_0x762a('0x44')](handleError(_0x5cce4c,null));};exports[_0x762a('0x45')]=function(_0x1d8e95,_0x119703){var _0x592c24={'raw':!![],'where':{'id':_0x1d8e95[_0x762a('0x46')]['id']}},_0x18e616={};_0x18e616[_0x762a('0x31')]=_[_0x762a('0x33')](db[_0x762a('0x2d')]['rawAttributes']);_0x18e616['query']=_['keys'](_0x1d8e95[_0x762a('0x32')]);_0x18e616[_0x762a('0x3d')]=_[_0x762a('0x34')](_0x18e616[_0x762a('0x31')],_0x18e616[_0x762a('0x32')]);_0x592c24['attributes']=_[_0x762a('0x34')](_0x18e616[_0x762a('0x31')],qs[_0x762a('0x36')](_0x1d8e95['query'][_0x762a('0x36')]));_0x592c24[_0x762a('0x35')]=_0x592c24[_0x762a('0x35')][_0x762a('0x37')]?_0x592c24['attributes']:_0x18e616['model'];if(_0x1d8e95[_0x762a('0x32')][_0x762a('0x42')]){_0x592c24[_0x762a('0x47')]=[{'all':!![]}];}_0x592c24=_[_0x762a('0x3e')]({},_0x592c24,_0x1d8e95['options']);return db[_0x762a('0x2d')][_0x762a('0x48')](_0x592c24)[_0x762a('0x23')](handleEntityNotFound(_0x119703,null))[_0x762a('0x23')](respondWithResult(_0x119703,null))[_0x762a('0x44')](handleError(_0x119703,null));};exports[_0x762a('0x49')]=function(_0x47dc39,_0x43b5d1){return db[_0x762a('0x2d')][_0x762a('0x49')](_0x47dc39['body'],{})[_0x762a('0x23')](function(_0x4434ad){var _0x36146d=_0x47dc39['user'][_0x762a('0x25')]({'plain':!![]});if(!_0x36146d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36146d[_0x762a('0x4a')]===_0x762a('0x4b')){var _0x31c19c=_0x4434ad[_0x762a('0x25')]({'plain':!![]});var _0x587883=_0x762a('0x26');return db[_0x762a('0x4c')][_0x762a('0x48')]({'where':{'name':_0x587883,'userProfileId':_0x36146d[_0x762a('0x4d')]},'raw':!![]})[_0x762a('0x23')](function(_0x678d80){if(_0x678d80&&_0x678d80[_0x762a('0x4e')]===0x0){return db['UserProfileResource'][_0x762a('0x49')]({'name':_0x31c19c['name'],'resourceId':_0x31c19c['id'],'type':_0x678d80['name'],'sectionId':_0x678d80['id']},{})[_0x762a('0x23')](function(){return _0x4434ad;});}else{return _0x4434ad;}})[_0x762a('0x44')](function(_0x26e934){logger['error'](_0x762a('0x4f'),_0x26e934);throw _0x26e934;});}return _0x4434ad;})['then'](respondWithResult(_0x43b5d1,0xc9))['catch'](handleError(_0x43b5d1,null));};exports[_0x762a('0x22')]=function(_0xcf6897,_0x479beb){if(_0xcf6897['body']['id']){delete _0xcf6897[_0x762a('0x50')]['id'];}return db[_0x762a('0x2d')][_0x762a('0x48')]({'where':{'id':_0xcf6897[_0x762a('0x46')]['id']}})[_0x762a('0x23')](handleEntityNotFound(_0x479beb,null))[_0x762a('0x23')](saveUpdates(_0xcf6897['body'],null))[_0x762a('0x23')](respondWithResult(_0x479beb,null))[_0x762a('0x44')](handleError(_0x479beb,null));};exports[_0x762a('0x24')]=function(_0xeef6b1,_0x255638){return db['OpenchannelQueue'][_0x762a('0x48')]({'where':{'id':_0xeef6b1['params']['id']}})[_0x762a('0x23')](handleEntityNotFound(_0x255638,null))[_0x762a('0x23')](removeEntity(_0x255638,null))[_0x762a('0x44')](handleError(_0x255638,null));};exports['describe']=function(_0x1802a9,_0x4f1196){return db[_0x762a('0x2d')][_0x762a('0x51')]()[_0x762a('0x23')](respondWithResult(_0x4f1196,null))[_0x762a('0x44')](handleError(_0x4f1196,null));};exports[_0x762a('0x52')]=function(_0x398c56,_0x4acbcd,_0x2e7743){var _0x8db0e8={'raw':!![],'where':{}},_0x50844e={},_0x3d2381;return db[_0x762a('0x2d')][_0x762a('0x53')]({'where':{'id':_0x398c56['params']['id']}})[_0x762a('0x23')](handleEntityNotFound(_0x4acbcd,null))[_0x762a('0x23')](function(_0x4d291f){if(_0x4d291f){_0x3d2381=_0x4d291f[_0x762a('0x25')]({'plain':!![]});_0x50844e[_0x762a('0x31')]=_['keys'](db[_0x762a('0x54')]['rawAttributes']);_0x50844e[_0x762a('0x32')]=_[_0x762a('0x33')](_0x398c56[_0x762a('0x32')]);_0x50844e[_0x762a('0x3d')]=_['intersection'](_0x50844e[_0x762a('0x31')],_0x50844e['query']);_0x8db0e8['attributes']=_['intersection'](_0x50844e[_0x762a('0x31')],qs[_0x762a('0x36')](_0x398c56[_0x762a('0x32')]['fields']));_0x8db0e8[_0x762a('0x35')]=_0x8db0e8['attributes']['length']?_0x8db0e8['attributes']:_0x50844e[_0x762a('0x31')];if(!_0x398c56[_0x762a('0x32')][_0x762a('0x38')](_0x762a('0x39'))){_0x8db0e8['limit']=qs['limit'](_0x398c56[_0x762a('0x32')][_0x762a('0x1d')]);_0x8db0e8[_0x762a('0x1b')]=qs[_0x762a('0x1b')](_0x398c56[_0x762a('0x32')][_0x762a('0x1b')]);}_0x8db0e8[_0x762a('0x55')]=qs['sort'](_0x398c56[_0x762a('0x32')][_0x762a('0x3a')]);_0x8db0e8[_0x762a('0x3b')]=qs['filters'](_['pick'](_0x398c56[_0x762a('0x32')],_0x50844e[_0x762a('0x3d')]));_0x8db0e8['where'][_0x762a('0x56')]=_0x4d291f['id'];if(_0x398c56[_0x762a('0x32')][_0x762a('0x40')]){_0x8db0e8[_0x762a('0x3b')]=_[_0x762a('0x3e')](_0x8db0e8[_0x762a('0x3b')],{'$or':_['map'](_0x8db0e8[_0x762a('0x35')],function(_0x32fcb0){var _0x3bc833={};_0x3bc833[_0x32fcb0]={'$like':'%'+_0x398c56['query'][_0x762a('0x40')]+'%'};return _0x3bc833;})});}_0x8db0e8=_[_0x762a('0x3e')]({},_0x8db0e8,_0x398c56[_0x762a('0x41')]);return db[_0x762a('0x54')]['findAll'](_0x8db0e8);}})['then'](function(_0x213f0f){if(_0x213f0f){return db[_0x762a('0x57')][_0x762a('0x58')]({'where':{'id':_[_0x762a('0x2c')](_0x213f0f,_0x762a('0x59')),'role':_0x762a('0x5a')},'attributes':['id',_0x762a('0x2a'),'openchannelPause',_0x762a('0x5b'),_0x762a('0x5c')]});}})[_0x762a('0x23')](function(_0x42037b){if(_0x42037b){return{'count':_0x42037b[_0x762a('0x1c')],'rows':_[_0x762a('0x2c')](_0x42037b['rows'],function(_0x289e33){return{'membername':_0x289e33['name'],'UserId':_0x289e33['id'],'queue_name':_0x3d2381['name'],'OpenchannelQueueId':_0x3d2381['id'],'interface':util[_0x762a('0x5d')](_0x762a('0x5e'),'SIP',_0x289e33[_0x762a('0x2a')]),'penalty':0x0,'paused':_0x289e33[_0x762a('0x5f')],'createdAt':_0x289e33[_0x762a('0x5c')],'updatedAt':_0x289e33[_0x762a('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4acbcd,_0x8db0e8))[_0x762a('0x44')](handleError(_0x4acbcd,null));};exports[_0x762a('0x60')]=function(_0x4d4cba,_0x4bf92d,_0x314acf){var _0x42b3f6={};var _0x2feb9a={};var _0x297960;var _0x1e1210;return db[_0x762a('0x2d')][_0x762a('0x53')]({'where':{'id':_0x4d4cba['params']['id']}})['then'](handleEntityNotFound(_0x4bf92d,null))[_0x762a('0x23')](function(_0x1a9b37){if(_0x1a9b37){_0x297960=_0x1a9b37;_0x2feb9a[_0x762a('0x31')]=_[_0x762a('0x33')](db[_0x762a('0x61')][_0x762a('0x62')]);_0x2feb9a[_0x762a('0x32')]=_[_0x762a('0x33')](_0x4d4cba['query']);_0x2feb9a[_0x762a('0x3d')]=_[_0x762a('0x34')](_0x2feb9a[_0x762a('0x31')],_0x2feb9a[_0x762a('0x32')]);_0x42b3f6[_0x762a('0x35')]=_[_0x762a('0x34')](_0x2feb9a[_0x762a('0x31')],qs[_0x762a('0x36')](_0x4d4cba[_0x762a('0x32')][_0x762a('0x36')]));_0x42b3f6[_0x762a('0x35')]=_0x42b3f6[_0x762a('0x35')]['length']?_0x42b3f6[_0x762a('0x35')]:_0x2feb9a[_0x762a('0x31')];_0x42b3f6[_0x762a('0x55')]=qs[_0x762a('0x3a')](_0x4d4cba['query'][_0x762a('0x3a')]);_0x42b3f6[_0x762a('0x3b')]=qs[_0x762a('0x3d')](_[_0x762a('0x3c')](_0x4d4cba[_0x762a('0x32')],_0x2feb9a[_0x762a('0x3d')]));if(_0x4d4cba[_0x762a('0x32')][_0x762a('0x40')]){_0x42b3f6[_0x762a('0x3b')]=_[_0x762a('0x3e')](_0x42b3f6[_0x762a('0x3b')],{'$or':_['map'](_0x42b3f6[_0x762a('0x35')],function(_0x1b7201){var _0x1d1a3c={};_0x1d1a3c[_0x1b7201]={'$like':'%'+_0x4d4cba[_0x762a('0x32')]['filter']+'%'};return _0x1d1a3c;})});}_0x42b3f6=_[_0x762a('0x3e')]({},_0x42b3f6,_0x4d4cba[_0x762a('0x41')]);return _0x297960['getTeams'](_0x42b3f6);}})[_0x762a('0x23')](function(_0x35d83d){if(_0x35d83d){_0x1e1210=_0x35d83d[_0x762a('0x37')];if(!_0x4d4cba['query'][_0x762a('0x38')](_0x762a('0x39'))){_0x42b3f6[_0x762a('0x1d')]=qs['limit'](_0x4d4cba[_0x762a('0x32')][_0x762a('0x1d')]);_0x42b3f6[_0x762a('0x1b')]=qs[_0x762a('0x1b')](_0x4d4cba[_0x762a('0x32')][_0x762a('0x1b')]);}return _0x297960[_0x762a('0x60')](_0x42b3f6);}})[_0x762a('0x23')](function(_0x35bf8b){if(_0x35bf8b){return _0x35bf8b?{'count':_0x1e1210,'rows':_0x35bf8b}:null;}})[_0x762a('0x23')](respondWithResult(_0x4bf92d,null))[_0x762a('0x44')](handleError(_0x4bf92d,null));};exports['addTeams']=function(_0x2cfd44,_0x513b98,_0x404cab){var _0x16f805=_0x2cfd44[_0x762a('0x50')][_0x762a('0x63')];return db[_0x762a('0x61')]['findAll']({'where':{'id':_0x16f805},'attributes':['id'],'include':[{'model':db[_0x762a('0x57')],'as':'Agents','attributes':['id',_0x762a('0x2a'),'online',_0x762a('0x64'),_0x762a('0x65')],'raw':!![]}]})[_0x762a('0x23')](function(_0x586289){if(_0x586289){var _0x4a08b2=_[_0x762a('0x66')](_0x586289,function(_0x33ec6a){var _0x413060=_0x33ec6a[_0x762a('0x25')]({'plain':!![]});return _0x413060[_0x762a('0x67')];});return db[_0x762a('0x2d')]['find']({'where':{'id':_0x2cfd44['params']['id']}})[_0x762a('0x23')](function(_0x26be1b){return db[_0x762a('0x68')]['transaction'](function(_0x1ebb95){return _0x26be1b[_0x762a('0x69')](_0x16f805,{'transaction':_0x1ebb95})[_0x762a('0x23')](function(){return BPromise[_0x762a('0x6a')](_0x4a08b2,function(_0x36d04f){return db[_0x762a('0x54')]['findOrCreate']({'where':{'UserId':_0x36d04f['id'],'OpenchannelQueueId':_0x2cfd44[_0x762a('0x46')]['id']},'transaction':_0x1ebb95});});})[_0x762a('0x23')](function(){_0x4a08b2[_0x762a('0x6b')](function(_0x2b5227){socket['emit'](_0x762a('0x6c'),{'UserId':_0x2b5227['id'],'OpenchannelQueueId':_0x26be1b['id']});});});});});}})[_0x762a('0x23')](respondWithStatusCode(_0x513b98,null))[_0x762a('0x44')](handleError(_0x513b98,null));};exports['removeTeams']=function(_0x24c66e,_0x49860,_0xca4667){return db[_0x762a('0x61')][_0x762a('0x6d')]({'where':{'id':_0x24c66e[_0x762a('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0x762a('0x57')],'as':_0x762a('0x67'),'attributes':['id'],'raw':!![]}]})[_0x762a('0x23')](handleEntityNotFound(_0x49860,null))[_0x762a('0x23')](function(_0xd64eba){var _0x5c6a56=_[_0x762a('0x2c')](_0xd64eba,'id');var _0x5f39ab=[];var _0x2e0997=[];var _0x358d28=squel[_0x762a('0x6e')]();_0x358d28[_0x762a('0x6f')]('tq.TeamId')[_0x762a('0x70')](_0x762a('0x71'),'tq')[_0x762a('0x72')](_0x762a('0x73'),'ut',_0x762a('0x74'))['where'](_0x762a('0x75'),_0x24c66e[_0x762a('0x46')]['id']);for(var _0x232651=0x0;_0x232651<_0xd64eba[_0x762a('0x37')];_0x232651+=0x1){let _0x2cc853=_0xd64eba[_0x232651];for(var _0x1e0b27=0x0;_0x1e0b27<_0x2cc853[_0x762a('0x67')][_0x762a('0x37')];_0x1e0b27+=0x1){let _0x1abe88=_0x2cc853['Agents'][_0x1e0b27];var _0x27e7ac=_0x358d28['clone']();_0x27e7ac[_0x762a('0x3b')](_0x762a('0x76'),_0x1abe88['id']);_0x2e0997[_0x762a('0x77')](db['sequelize'][_0x762a('0x32')](_0x27e7ac[_0x762a('0x78')](),{'type':db[_0x762a('0x68')][_0x762a('0x79')][_0x762a('0x7a')]})[_0x762a('0x23')](function(_0x5b6dc9){if(_0x5b6dc9[_0x762a('0x37')]===0x1){return _0x1abe88['id'];}else{var _0x3315a8=_['every'](_[_0x762a('0x2c')](_0x5b6dc9,_0x762a('0x7b')),function(_0x4ba472){return _[_0x762a('0x7c')](_0x5c6a56,_0x4ba472);});if(_0x3315a8){return _0x1abe88['id'];}}}));}}return BPromise['all'](_0x2e0997)[_0x762a('0x23')](function(_0x2ea529){_0x5f39ab=_(_0x5f39ab)['union'](_0x2ea529)[_0x762a('0x7d')]()['value']();return db[_0x762a('0x2d')][_0x762a('0x48')]({'where':{'id':_0x24c66e[_0x762a('0x46')]['id']}})[_0x762a('0x23')](function(_0x4f81ec){return db[_0x762a('0x68')]['transaction'](function(_0x148044){return _0x4f81ec['removeTeams'](_0x24c66e[_0x762a('0x32')][_0x762a('0x63')],{'transaction':_0x148044})[_0x762a('0x23')](function(){if(!_['isEmpty'](_0x5f39ab)){return _0x4f81ec[_0x762a('0x7e')](_0x5f39ab,{'transaction':_0x148044});}})[_0x762a('0x23')](function(){_0x5f39ab['forEach'](function(_0x3faf67){socket[_0x762a('0x7f')]('userOpenchannelQueue:remove',{'UserId':_0x3faf67,'OpenchannelQueueId':_0x4f81ec['id']});});});});});});})[_0x762a('0x23')](respondWithStatusCode(_0x49860,null))[_0x762a('0x44')](handleError(_0x49860,null));};exports[_0x762a('0x80')]=function(_0x5ca9ae,_0x27d9be,_0x778f3e){return db[_0x762a('0x2d')][_0x762a('0x48')]({'where':{'id':_0x5ca9ae['params']['id']}})['then'](handleEntityNotFound(_0x27d9be,null))[_0x762a('0x23')](function(_0x2bbaba){if(_0x2bbaba){return _0x2bbaba[_0x762a('0x80')](_0x5ca9ae['body']['ids'],_[_0x762a('0x81')](_0x5ca9ae[_0x762a('0x50')],['ids','id'])||{})[_0x762a('0x82')](function(_0x4b6bc8){for(var _0x2b452d=0x0;_0x2b452d<_0x5ca9ae[_0x762a('0x50')]['ids']['length'];_0x2b452d+=0x1){socket[_0x762a('0x7f')](_0x762a('0x6c'),{'UserId':Number(_0x5ca9ae[_0x762a('0x50')][_0x762a('0x63')][_0x2b452d]),'OpenchannelQueueId':Number(_0x5ca9ae['params']['id'])});}return _0x4b6bc8;});}})[_0x762a('0x23')](respondWithResult(_0x27d9be,null))['catch'](handleError(_0x27d9be,null));};exports[_0x762a('0x7e')]=function(_0x807d21,_0x2b1578,_0x725518){return db[_0x762a('0x2d')][_0x762a('0x48')]({'where':{'id':_0x807d21[_0x762a('0x46')]['id']}})[_0x762a('0x23')](handleEntityNotFound(_0x2b1578,null))['then'](function(_0x4100ac){if(_0x4100ac){return _0x4100ac[_0x762a('0x7e')](_0x807d21[_0x762a('0x32')]['ids'])[_0x762a('0x23')](function(){if(_['isArray'](_0x807d21[_0x762a('0x32')]['ids'])){for(var _0x2a7ce1=0x0;_0x2a7ce1<_0x807d21[_0x762a('0x32')]['ids'][_0x762a('0x37')];_0x2a7ce1+=0x1){socket['emit'](_0x762a('0x83'),{'UserId':Number(_0x807d21[_0x762a('0x32')][_0x762a('0x63')][_0x2a7ce1]),'OpenchannelQueueId':Number(_0x807d21['params']['id'])});}}else{socket[_0x762a('0x7f')]('userOpenchannelQueue:remove',{'UserId':Number(_0x807d21[_0x762a('0x32')][_0x762a('0x63')]),'OpenchannelQueueId':Number(_0x807d21[_0x762a('0x46')]['id'])});}});}})[_0x762a('0x23')](respondWithStatusCode(_0x2b1578,null))[_0x762a('0x44')](handleError(_0x2b1578,null));};exports[_0x762a('0x84')]=function(_0x5a06d3,_0x6b34a5,_0x22062a){var _0xa6db08={};var _0x453dfa={};var _0x2f45ea;var _0x28040e;return db[_0x762a('0x2d')][_0x762a('0x53')]({'where':{'id':_0x5a06d3[_0x762a('0x46')]['id']}})[_0x762a('0x23')](handleEntityNotFound(_0x6b34a5,null))[_0x762a('0x23')](function(_0x55007b){if(_0x55007b){_0x2f45ea=_0x55007b;_0x453dfa[_0x762a('0x31')]=_['keys'](db[_0x762a('0x57')][_0x762a('0x62')]);_0x453dfa[_0x762a('0x32')]=_[_0x762a('0x33')](_0x5a06d3['query']);_0x453dfa['filters']=_['intersection'](_0x453dfa['model'],_0x453dfa[_0x762a('0x32')]);_0xa6db08[_0x762a('0x35')]=_['intersection'](_0x453dfa[_0x762a('0x31')],qs[_0x762a('0x36')](_0x5a06d3[_0x762a('0x32')][_0x762a('0x36')]));_0xa6db08[_0x762a('0x35')]=_0xa6db08['attributes'][_0x762a('0x37')]?_0xa6db08['attributes']:_0x453dfa['model'];_0xa6db08['order']=qs[_0x762a('0x3a')](_0x5a06d3[_0x762a('0x32')]['sort']);_0xa6db08[_0x762a('0x3b')]=qs['filters'](_[_0x762a('0x3c')](_0x5a06d3['query'],_0x453dfa[_0x762a('0x3d')]));if(_0x5a06d3['query']['filter']){_0xa6db08[_0x762a('0x3b')]=_[_0x762a('0x3e')](_0xa6db08[_0x762a('0x3b')],{'$or':_[_0x762a('0x2c')](_0xa6db08[_0x762a('0x35')],function(_0x3a815d){var _0x7a798e={};_0x7a798e[_0x3a815d]={'$like':'%'+_0x5a06d3['query'][_0x762a('0x40')]+'%'};return _0x7a798e;})});}_0xa6db08=_[_0x762a('0x3e')]({},_0xa6db08,_0x5a06d3[_0x762a('0x41')]);return _0x2f45ea['getAgents'](_0xa6db08);}})[_0x762a('0x23')](function(_0x595b8f){if(_0x595b8f){_0x28040e=_0x595b8f['length'];if(!_0x5a06d3[_0x762a('0x32')][_0x762a('0x38')](_0x762a('0x39'))){_0xa6db08[_0x762a('0x1d')]=qs[_0x762a('0x1d')](_0x5a06d3[_0x762a('0x32')]['limit']);_0xa6db08[_0x762a('0x1b')]=qs['offset'](_0x5a06d3[_0x762a('0x32')][_0x762a('0x1b')]);}return _0x2f45ea['getAgents'](_0xa6db08);}})[_0x762a('0x23')](function(_0x25b68e){if(_0x25b68e){return _0x25b68e?{'count':_0x28040e,'rows':_0x25b68e}:null;}})[_0x762a('0x23')](respondWithResult(_0x6b34a5,null))[_0x762a('0x44')](handleError(_0x6b34a5,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 3643e42..c984522 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 _0x8fb5=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','OpenchannelQueue'];(function(_0x14fe43,_0x5c3e2f){var _0x585e66=function(_0x444c2b){while(--_0x444c2b){_0x14fe43['push'](_0x14fe43['shift']());}};_0x585e66(++_0x5c3e2f);}(_0x8fb5,0x1dd));var _0x58fb=function(_0x29ca3a,_0x118266){_0x29ca3a=_0x29ca3a-0x0;var _0x45371e=_0x8fb5[_0x29ca3a];return _0x45371e;};'use strict';var EventEmitter=require(_0x58fb('0x0'));var OpenchannelQueue=require(_0x58fb('0x1'))['db'][_0x58fb('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x58fb('0x3')](0x0);var events={'afterCreate':_0x58fb('0x4'),'afterUpdate':_0x58fb('0x5'),'afterDestroy':_0x58fb('0x6')};function emitEvent(_0x5be530){return function(_0x100f12,_0x3cd73e,_0x4a0056){OpenchannelQueueEvents[_0x58fb('0x7')](_0x5be530+':'+_0x100f12['id'],_0x100f12);OpenchannelQueueEvents[_0x58fb('0x7')](_0x5be530,_0x100f12);_0x4a0056(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x58fb('0x8')](e,emitEvent(event));}}module[_0x58fb('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xd349=['OpenchannelQueue','setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x58c008,_0x222f08){var _0x9804b7=function(_0x56d01a){while(--_0x56d01a){_0x58c008['push'](_0x58c008['shift']());}};_0x9804b7(++_0x222f08);}(_0xd349,0x139));var _0x9d34=function(_0x5f2de8,_0x124dfe){_0x5f2de8=_0x5f2de8-0x0;var _0x11e267=_0xd349[_0x5f2de8];return _0x11e267;};'use strict';var EventEmitter=require(_0x9d34('0x0'));var OpenchannelQueue=require(_0x9d34('0x1'))['db'][_0x9d34('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x9d34('0x3')](0x0);var events={'afterCreate':_0x9d34('0x4'),'afterUpdate':_0x9d34('0x5'),'afterDestroy':_0x9d34('0x6')};function emitEvent(_0x4c4265){return function(_0x537318,_0x2d21b1,_0x379a0b){OpenchannelQueueEvents[_0x9d34('0x7')](_0x4c4265+':'+_0x537318['id'],_0x537318);OpenchannelQueueEvents[_0x9d34('0x7')](_0x4c4265,_0x537318);_0x379a0b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x9d34('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index fe5516d..924876d 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 _0x7da2=['define','OpenchannelQueue','openchannel_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7da2,0x1a7));var _0x27da=function(_0x3081da,_0x234eac){_0x3081da=_0x3081da-0x0;var _0x242b8c=_0x7da2[_0x3081da];return _0x242b8c;};'use strict';var _=require(_0x27da('0x0'));var util=require('util');var logger=require(_0x27da('0x1'))(_0x27da('0x2'));var moment=require(_0x27da('0x3'));var BPromise=require(_0x27da('0x4'));var rp=require(_0x27da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x27da('0x6'));var config=require(_0x27da('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0x27da('0x8')]=function(_0x16cf76,_0x27ef79){return _0x16cf76[_0x27da('0x9')](_0x27da('0xa'),attributes,{'tableName':_0x27da('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd391=['api','bluebird','path','rimraf','../../config/environment','./openchannelQueue.attributes','define','openchannel_queues','lodash','util'];(function(_0x3f7af5,_0x2147a0){var _0x55ad46=function(_0x4a2084){while(--_0x4a2084){_0x3f7af5['push'](_0x3f7af5['shift']());}};_0x55ad46(++_0x2147a0);}(_0xd391,0xf8));var _0x1d39=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xd391[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x1d39('0x0'));var util=require(_0x1d39('0x1'));var logger=require('../../config/logger')(_0x1d39('0x2'));var moment=require('moment');var BPromise=require(_0x1d39('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1d39('0x4'));var rimraf=require(_0x1d39('0x5'));var config=require(_0x1d39('0x6'));var attributes=require(_0x1d39('0x7'));module['exports']=function(_0x253326,_0xf2a50f){return _0x253326[_0x1d39('0x8')]('OpenchannelQueue',attributes,{'tableName':_0x1d39('0x9'),'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 5f3822a..e3a7350 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 _0x28bf=['debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','attributes','limit','map','include','model','raw','where','ShowOpenchannelQueue','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x513e7b,_0x52f267){var _0x49566c=function(_0x527d9f){while(--_0x527d9f){_0x513e7b['push'](_0x513e7b['shift']());}};_0x49566c(++_0x52f267);}(_0x28bf,0x1dc));var _0xf28b=function(_0x15320b,_0x4e4af0){_0x15320b=_0x15320b-0x0;var _0x243266=_0x28bf[_0x15320b];return _0x243266;};'use strict';var _=require(_0xf28b('0x0'));var util=require(_0xf28b('0x1'));var moment=require('moment');var BPromise=require(_0xf28b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf28b('0x3'))['db'];var utils=require(_0xf28b('0x4'));var logger=require(_0xf28b('0x5'))(_0xf28b('0x6'));var config=require(_0xf28b('0x7'));var jayson=require(_0xf28b('0x8'));var client=jayson[_0xf28b('0x9')]['http']({'port':0x232a});config[_0xf28b('0xa')]=_[_0xf28b('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf28b('0xa')]));require(_0xf28b('0xc'))[_0xf28b('0xd')](socket);function respondWithRpcPromise(_0x52d6af,_0x131c4a,_0x3f4ac3){return new BPromise(function(_0x549940,_0x573989){return client[_0xf28b('0xe')](_0x52d6af,_0x3f4ac3)[_0xf28b('0xf')](function(_0x24b13c){logger['info'](_0xf28b('0x10'),_0x131c4a,_0xf28b('0x11'));logger[_0xf28b('0x12')](_0xf28b('0x13'),_0x131c4a,_0xf28b('0x11'),JSON[_0xf28b('0x14')](_0x24b13c));if(_0x24b13c[_0xf28b('0x15')]){if(_0x24b13c[_0xf28b('0x15')][_0xf28b('0x16')]===0x1f4){logger['error'](_0xf28b('0x10'),_0x131c4a,_0x24b13c[_0xf28b('0x15')]['message']);return _0x573989(_0x24b13c[_0xf28b('0x15')][_0xf28b('0x17')]);}logger[_0xf28b('0x15')](_0xf28b('0x10'),_0x131c4a,_0x24b13c[_0xf28b('0x15')][_0xf28b('0x17')]);return _0x549940(_0x24b13c[_0xf28b('0x15')][_0xf28b('0x17')]);}else{logger['info'](_0xf28b('0x10'),_0x131c4a,_0xf28b('0x11'));_0x549940(_0x24b13c[_0xf28b('0x18')][_0xf28b('0x17')]);}})[_0xf28b('0x19')](function(_0x3adde8){logger[_0xf28b('0x15')](_0xf28b('0x10'),_0x131c4a,_0x3adde8);_0x573989(_0x3adde8);});});}exports[_0xf28b('0x1a')]=function(_0x486c90){var _0x5e376f=this;return new Promise(function(_0xbea408,_0x40a60e){return db[_0xf28b('0x1b')][_0xf28b('0x1c')]({'raw':_0x486c90[_0xf28b('0x1d')]?_0x486c90[_0xf28b('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x486c90[_0xf28b('0x1d')]?_0x486c90[_0xf28b('0x1d')]['where']||null:null,'attributes':_0x486c90[_0xf28b('0x1d')]?_0x486c90['options'][_0xf28b('0x1e')]||null:null,'limit':_0x486c90[_0xf28b('0x1d')]?_0x486c90['options'][_0xf28b('0x1f')]||null:null,'include':_0x486c90[_0xf28b('0x1d')]?_0x486c90[_0xf28b('0x1d')]['include']?_[_0xf28b('0x20')](_0x486c90[_0xf28b('0x1d')][_0xf28b('0x21')],function(_0x44d448){return{'model':db[_0x44d448['model']],'as':_0x44d448['as'],'attributes':_0x44d448[_0xf28b('0x1e')],'include':_0x44d448[_0xf28b('0x21')]?_['map'](_0x44d448['include'],function(_0x4d8795){return{'model':db[_0x4d8795[_0xf28b('0x22')]],'as':_0x4d8795['as'],'attributes':_0x4d8795[_0xf28b('0x1e')],'include':_0x4d8795[_0xf28b('0x21')]?_['map'](_0x4d8795[_0xf28b('0x21')],function(_0x209771){return{'model':db[_0x209771[_0xf28b('0x22')]],'as':_0x209771['as'],'attributes':_0x209771[_0xf28b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf28b('0xf')](function(_0x560969){logger['info']('GetOpenchannelQueue',_0x486c90);logger[_0xf28b('0x12')](_0xf28b('0x1a'),_0x486c90,JSON[_0xf28b('0x14')](_0x560969));_0xbea408(_0x560969);})[_0xf28b('0x19')](function(_0x5f0757){logger[_0xf28b('0x15')](_0xf28b('0x1a'),_0x5f0757[_0xf28b('0x17')],_0x486c90);_0x40a60e(_0x5e376f[_0xf28b('0x15')](0x1f4,_0x5f0757['message']));});});};exports['ShowOpenchannelQueue']=function(_0xb381fa){var _0x3df44a=this;return new Promise(function(_0x26c357,_0x444625){return db[_0xf28b('0x1b')]['find']({'raw':_0xb381fa[_0xf28b('0x1d')]?_0xb381fa[_0xf28b('0x1d')][_0xf28b('0x23')]===undefined?!![]:![]:!![],'where':_0xb381fa[_0xf28b('0x1d')]?_0xb381fa['options'][_0xf28b('0x24')]||null:null,'attributes':_0xb381fa[_0xf28b('0x1d')]?_0xb381fa[_0xf28b('0x1d')][_0xf28b('0x1e')]||null:null,'include':_0xb381fa['options']?_0xb381fa[_0xf28b('0x1d')]['include']?_['map'](_0xb381fa[_0xf28b('0x1d')][_0xf28b('0x21')],function(_0x47b9f6){return{'model':db[_0x47b9f6[_0xf28b('0x22')]],'as':_0x47b9f6['as'],'attributes':_0x47b9f6[_0xf28b('0x1e')],'include':_0x47b9f6[_0xf28b('0x21')]?_[_0xf28b('0x20')](_0x47b9f6[_0xf28b('0x21')],function(_0x511838){return{'model':db[_0x511838[_0xf28b('0x22')]],'as':_0x511838['as'],'attributes':_0x511838[_0xf28b('0x1e')],'include':_0x511838['include']?_['map'](_0x511838[_0xf28b('0x21')],function(_0x5a2bfc){return{'model':db[_0x5a2bfc[_0xf28b('0x22')]],'as':_0x5a2bfc['as'],'attributes':_0x5a2bfc['attributes']};}):[]};}):[]};}):[]:[]})[_0xf28b('0xf')](function(_0x244a33){logger['info'](_0xf28b('0x25'),_0xb381fa);logger[_0xf28b('0x12')](_0xf28b('0x25'),_0xb381fa,JSON[_0xf28b('0x14')](_0x244a33));_0x26c357(_0x244a33);})[_0xf28b('0x19')](function(_0x34f9fa){logger[_0xf28b('0x15')]('ShowOpenchannelQueue',_0x34f9fa[_0xf28b('0x17')],_0xb381fa);_0x444625(_0x3df44a[_0xf28b('0x15')](0x1f4,_0x34f9fa[_0xf28b('0x17')]));});});}; \ No newline at end of file +var _0xd12c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetOpenchannelQueue','findAll','options','where','attributes','limit','map','include','model','debug','catch','ShowOpenchannelQueue','OpenchannelQueue','raw','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0xd12c,0xea));var _0xcd12=function(_0x47554d,_0x36ac72){_0x47554d=_0x47554d-0x0;var _0x4554b1=_0xd12c[_0x47554d];return _0x4554b1;};'use strict';var _=require('lodash');var util=require(_0xcd12('0x0'));var moment=require(_0xcd12('0x1'));var BPromise=require(_0xcd12('0x2'));var rs=require(_0xcd12('0x3'));var fs=require('fs');var Redis=require(_0xcd12('0x4'));var db=require(_0xcd12('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd12('0x6'))(_0xcd12('0x7'));var config=require(_0xcd12('0x8'));var jayson=require(_0xcd12('0x9'));var client=jayson[_0xcd12('0xa')]['http']({'port':0x232a});config[_0xcd12('0xb')]=_[_0xcd12('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcd12('0xd'))(new Redis(config[_0xcd12('0xb')]));require(_0xcd12('0xe'))[_0xcd12('0xf')](socket);function respondWithRpcPromise(_0x22283b,_0x4336d3,_0x4dee44){return new BPromise(function(_0x58d786,_0xacaf54){return client[_0xcd12('0x10')](_0x22283b,_0x4dee44)['then'](function(_0x4d970e){logger[_0xcd12('0x11')](_0xcd12('0x12'),_0x4336d3,_0xcd12('0x13'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4336d3,_0xcd12('0x13'),JSON[_0xcd12('0x14')](_0x4d970e));if(_0x4d970e['error']){if(_0x4d970e[_0xcd12('0x15')][_0xcd12('0x16')]===0x1f4){logger['error'](_0xcd12('0x12'),_0x4336d3,_0x4d970e[_0xcd12('0x15')][_0xcd12('0x17')]);return _0xacaf54(_0x4d970e[_0xcd12('0x15')][_0xcd12('0x17')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x4336d3,_0x4d970e[_0xcd12('0x15')][_0xcd12('0x17')]);return _0x58d786(_0x4d970e['error'][_0xcd12('0x17')]);}else{logger[_0xcd12('0x11')](_0xcd12('0x12'),_0x4336d3,'request\x20sent');_0x58d786(_0x4d970e[_0xcd12('0x18')][_0xcd12('0x17')]);}})['catch'](function(_0x89c548){logger[_0xcd12('0x15')](_0xcd12('0x12'),_0x4336d3,_0x89c548);_0xacaf54(_0x89c548);});});}exports[_0xcd12('0x19')]=function(_0x532c00){var _0x430e18=this;return new Promise(function(_0x23dc50,_0x429907){return db['OpenchannelQueue'][_0xcd12('0x1a')]({'raw':_0x532c00['options']?_0x532c00[_0xcd12('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x532c00[_0xcd12('0x1b')]?_0x532c00[_0xcd12('0x1b')][_0xcd12('0x1c')]||null:null,'attributes':_0x532c00['options']?_0x532c00[_0xcd12('0x1b')][_0xcd12('0x1d')]||null:null,'limit':_0x532c00[_0xcd12('0x1b')]?_0x532c00['options'][_0xcd12('0x1e')]||null:null,'include':_0x532c00[_0xcd12('0x1b')]?_0x532c00[_0xcd12('0x1b')]['include']?_[_0xcd12('0x1f')](_0x532c00['options'][_0xcd12('0x20')],function(_0x47a40f){return{'model':db[_0x47a40f[_0xcd12('0x21')]],'as':_0x47a40f['as'],'attributes':_0x47a40f[_0xcd12('0x1d')],'include':_0x47a40f['include']?_[_0xcd12('0x1f')](_0x47a40f[_0xcd12('0x20')],function(_0x12cc99){return{'model':db[_0x12cc99[_0xcd12('0x21')]],'as':_0x12cc99['as'],'attributes':_0x12cc99[_0xcd12('0x1d')],'include':_0x12cc99[_0xcd12('0x20')]?_[_0xcd12('0x1f')](_0x12cc99[_0xcd12('0x20')],function(_0x1afd33){return{'model':db[_0x1afd33[_0xcd12('0x21')]],'as':_0x1afd33['as'],'attributes':_0x1afd33['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d7ce4){logger[_0xcd12('0x11')](_0xcd12('0x19'),_0x532c00);logger[_0xcd12('0x22')](_0xcd12('0x19'),_0x532c00,JSON[_0xcd12('0x14')](_0x5d7ce4));_0x23dc50(_0x5d7ce4);})[_0xcd12('0x23')](function(_0x5a789b){logger[_0xcd12('0x15')](_0xcd12('0x19'),_0x5a789b[_0xcd12('0x17')],_0x532c00);_0x429907(_0x430e18['error'](0x1f4,_0x5a789b[_0xcd12('0x17')]));});});};exports[_0xcd12('0x24')]=function(_0x4f1007){var _0x1c5be7=this;return new Promise(function(_0x3844f3,_0x46daa9){return db[_0xcd12('0x25')]['find']({'raw':_0x4f1007[_0xcd12('0x1b')]?_0x4f1007[_0xcd12('0x1b')][_0xcd12('0x26')]===undefined?!![]:![]:!![],'where':_0x4f1007['options']?_0x4f1007[_0xcd12('0x1b')][_0xcd12('0x1c')]||null:null,'attributes':_0x4f1007['options']?_0x4f1007['options']['attributes']||null:null,'include':_0x4f1007[_0xcd12('0x1b')]?_0x4f1007[_0xcd12('0x1b')][_0xcd12('0x20')]?_[_0xcd12('0x1f')](_0x4f1007[_0xcd12('0x1b')][_0xcd12('0x20')],function(_0x3b2f4f){return{'model':db[_0x3b2f4f['model']],'as':_0x3b2f4f['as'],'attributes':_0x3b2f4f[_0xcd12('0x1d')],'include':_0x3b2f4f['include']?_[_0xcd12('0x1f')](_0x3b2f4f[_0xcd12('0x20')],function(_0x348d37){return{'model':db[_0x348d37[_0xcd12('0x21')]],'as':_0x348d37['as'],'attributes':_0x348d37[_0xcd12('0x1d')],'include':_0x348d37[_0xcd12('0x20')]?_[_0xcd12('0x1f')](_0x348d37[_0xcd12('0x20')],function(_0x5cb90b){return{'model':db[_0x5cb90b[_0xcd12('0x21')]],'as':_0x5cb90b['as'],'attributes':_0x5cb90b['attributes']};}):[]};}):[]};}):[]:[]})[_0xcd12('0x27')](function(_0x8b24cf){logger['info'](_0xcd12('0x24'),_0x4f1007);logger['debug'](_0xcd12('0x24'),_0x4f1007,JSON[_0xcd12('0x14')](_0x8b24cf));_0x3844f3(_0x8b24cf);})[_0xcd12('0x23')](function(_0x28292f){logger[_0xcd12('0x15')](_0xcd12('0x24'),_0x28292f[_0xcd12('0x17')],_0x4f1007);_0x46daa9(_0x1c5be7[_0xcd12('0x15')](0x1f4,_0x28292f[_0xcd12('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 438a5d3..aaebab5 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 _0x4819=['remove','update','emit','removeListener','register','openchannelQueue:','./openchannelQueue.events','save'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x4819,0x1d6));var _0x9481=function(_0x48b00c,_0x16690b){_0x48b00c=_0x48b00c-0x0;var _0x55d181=_0x4819[_0x48b00c];return _0x55d181;};'use strict';var OpenchannelQueueEvents=require(_0x9481('0x0'));var events=[_0x9481('0x1'),_0x9481('0x2'),_0x9481('0x3')];function createListener(_0x1d0ec8,_0x4c266a){return function(_0x37706c){_0x4c266a[_0x9481('0x4')](_0x1d0ec8,_0x37706c);};}function removeListener(_0x2199a3,_0x1fb414){return function(){OpenchannelQueueEvents[_0x9481('0x5')](_0x2199a3,_0x1fb414);};}exports[_0x9481('0x6')]=function(_0x440409){for(var _0x40406a=0x0,_0x37205b=events['length'];_0x40406a<_0x37205b;_0x40406a++){var _0x4493ee=events[_0x40406a];var _0x1930f9=createListener(_0x9481('0x7')+_0x4493ee,_0x440409);OpenchannelQueueEvents['on'](_0x4493ee,_0x1930f9);}}; \ No newline at end of file +var _0x9478=['emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update'];(function(_0x2d2b63,_0x277d0a){var _0x5d18f8=function(_0x4eca54){while(--_0x4eca54){_0x2d2b63['push'](_0x2d2b63['shift']());}};_0x5d18f8(++_0x277d0a);}(_0x9478,0x15b));var _0x8947=function(_0x533da3,_0x2b6fc4){_0x533da3=_0x533da3-0x0;var _0x2b4350=_0x9478[_0x533da3];return _0x2b4350;};'use strict';var OpenchannelQueueEvents=require(_0x8947('0x0'));var events=[_0x8947('0x1'),_0x8947('0x2'),_0x8947('0x3')];function createListener(_0x24e328,_0x2c431b){return function(_0x5b0c61){_0x2c431b[_0x8947('0x4')](_0x24e328,_0x5b0c61);};}function removeListener(_0x535070,_0x2db57c){return function(){OpenchannelQueueEvents[_0x8947('0x5')](_0x535070,_0x2db57c);};}exports[_0x8947('0x6')]=function(_0x4388f1){for(var _0x676147=0x0,_0x39f454=events[_0x8947('0x7')];_0x676147<_0x39f454;_0x676147++){var _0xdcc559=events[_0x676147];var _0x549dda=createListener(_0x8947('0x8')+_0xdcc559,_0x4388f1);OpenchannelQueueEvents['on'](_0xdcc559,_0x549dda);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 82e7d71..69b6e34 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 _0xcc23=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer','util','path','express'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0xcc23,0x96));var _0x3cc2=function(_0x4ed32d,_0x327695){_0x4ed32d=_0x4ed32d-0x0;var _0xf624df=_0xcc23[_0x4ed32d];return _0xf624df;};'use strict';var multer=require(_0x3cc2('0x0'));var util=require(_0x3cc2('0x1'));var path=require(_0x3cc2('0x2'));var timeout=require('connect-timeout');var express=require(_0x3cc2('0x3'));var router=express[_0x3cc2('0x4')]();var fs_extra=require(_0x3cc2('0x5'));var auth=require(_0x3cc2('0x6'));var interaction=require(_0x3cc2('0x7'));var config=require(_0x3cc2('0x8'));var controller=require(_0x3cc2('0x9'));router[_0x3cc2('0xa')]('/',auth[_0x3cc2('0xb')](),controller[_0x3cc2('0xc')]);router[_0x3cc2('0xa')](_0x3cc2('0xd'),auth[_0x3cc2('0xb')](),controller[_0x3cc2('0xe')]);router[_0x3cc2('0xa')](_0x3cc2('0xf'),auth[_0x3cc2('0xb')](),controller[_0x3cc2('0x10')]);router[_0x3cc2('0x11')]('/',auth[_0x3cc2('0xb')](),controller['create']);router['put']('/:id',auth[_0x3cc2('0xb')](),controller[_0x3cc2('0x12')]);router[_0x3cc2('0x13')](_0x3cc2('0xf'),auth[_0x3cc2('0xb')](),controller[_0x3cc2('0x14')]);module[_0x3cc2('0x15')]=router; \ No newline at end of file +var _0xa289=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','destroy','exports','multer'];(function(_0x2c87d2,_0x21b9bd){var _0x9bfbf7=function(_0x144af3){while(--_0x144af3){_0x2c87d2['push'](_0x2c87d2['shift']());}};_0x9bfbf7(++_0x21b9bd);}(_0xa289,0x7d));var _0x9a28=function(_0x5006a8,_0x1433a2){_0x5006a8=_0x5006a8-0x0;var _0x381ee6=_0xa289[_0x5006a8];return _0x381ee6;};'use strict';var multer=require(_0x9a28('0x0'));var util=require('util');var path=require(_0x9a28('0x1'));var timeout=require(_0x9a28('0x2'));var express=require(_0x9a28('0x3'));var router=express[_0x9a28('0x4')]();var fs_extra=require(_0x9a28('0x5'));var auth=require(_0x9a28('0x6'));var interaction=require(_0x9a28('0x7'));var config=require(_0x9a28('0x8'));var controller=require(_0x9a28('0x9'));router[_0x9a28('0xa')]('/',auth[_0x9a28('0xb')](),controller[_0x9a28('0xc')]);router['get'](_0x9a28('0xd'),auth[_0x9a28('0xb')](),controller['describe']);router[_0x9a28('0xa')](_0x9a28('0xe'),auth[_0x9a28('0xb')](),controller[_0x9a28('0xf')]);router['post']('/',auth[_0x9a28('0xb')](),controller[_0x9a28('0x10')]);router[_0x9a28('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x9a28('0x12')]);router['delete']('/:id',auth[_0x9a28('0xb')](),controller[_0x9a28('0x13')]);module[_0x9a28('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 e3c344b..338f998 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 _0x6360=['STRING','DATE','moment','sequelize','exports'];(function(_0x542d80,_0x150561){var _0x1f4492=function(_0x542215){while(--_0x542215){_0x542d80['push'](_0x542d80['shift']());}};_0x1f4492(++_0x150561);}(_0x6360,0x106));var _0x0636=function(_0x70a507,_0x34b3a8){_0x70a507=_0x70a507-0x0;var _0x9d4780=_0x6360[_0x70a507];return _0x9d4780;};'use strict';var moment=require(_0x0636('0x0'));var Sequelize=require(_0x0636('0x1'));module[_0x0636('0x2')]={'uniqueid':{'type':Sequelize[_0x0636('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x0636('0x3')]},'joinAt':{'type':Sequelize[_0x0636('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x0636('0x4')]},'exitAt':{'type':Sequelize[_0x0636('0x4')]},'reason':{'type':Sequelize[_0x0636('0x3')]}}; \ No newline at end of file +var _0xfa39=['STRING','DATE','exports'];(function(_0x1b72b2,_0x302840){var _0x1230b1=function(_0x4f9c13){while(--_0x4f9c13){_0x1b72b2['push'](_0x1b72b2['shift']());}};_0x1230b1(++_0x302840);}(_0xfa39,0x197));var _0x9fa3=function(_0x4ce1b9,_0x397a4b){_0x4ce1b9=_0x4ce1b9-0x0;var _0x2bb15d=_0xfa39[_0x4ce1b9];return _0x2bb15d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x9fa3('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x9fa3('0x1')]},'joinAt':{'type':Sequelize[_0x9fa3('0x2')]},'leaveAt':{'type':Sequelize[_0x9fa3('0x2')]},'acceptAt':{'type':Sequelize[_0x9fa3('0x2')]},'exitAt':{'type':Sequelize[_0x9fa3('0x2')]},'reason':{'type':Sequelize[_0x9fa3('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index f47e8bd..5f5e46a 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 _0x3d2d=['undefined','limit','count','status','Content-Range','save','update','then','end','name','send','index','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','OpenchannelQueueReport','includeAll','include','rows','catch','show','options','create','body','find','params','describe','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','json','offset'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0x3d2d,0x17a));var _0xd3d2=function(_0x2bf888,_0x374f0b){_0x2bf888=_0x2bf888-0x0;var _0x3038d6=_0x3d2d[_0x2bf888];return _0x3038d6;};'use strict';var emlformat=require(_0xd3d2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd3d2('0x1'));var rp=require(_0xd3d2('0x2'));var moment=require(_0xd3d2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd3d2('0x4'));var csv=require(_0xd3d2('0x5'));var ejs=require(_0xd3d2('0x6'));var fs=require('fs');var fs_extra=require(_0xd3d2('0x7'));var _=require(_0xd3d2('0x8'));var squel=require(_0xd3d2('0x9'));var crypto=require('crypto');var jsforce=require(_0xd3d2('0xa'));var deskjs=require(_0xd3d2('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd3d2('0xc'));var Redis=require(_0xd3d2('0xd'));var authService=require(_0xd3d2('0xe'));var qs=require(_0xd3d2('0xf'));var as=require(_0xd3d2('0x10'));var hardwareService=require(_0xd3d2('0x11'));var logger=require(_0xd3d2('0x12'))('api');var utils=require(_0xd3d2('0x13'));var config=require(_0xd3d2('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd3d2('0x15'))['db'];function respondWithStatusCode(_0x581ba1,_0x1e6862){_0x1e6862=_0x1e6862||0xcc;return function(_0x412a70){if(_0x412a70){return _0x581ba1['sendStatus'](_0x1e6862);}return _0x581ba1['status'](_0x1e6862)['end']();};}function respondWithResult(_0x2e879c,_0x4bf96b){_0x4bf96b=_0x4bf96b||0xc8;return function(_0x29790d){if(_0x29790d){return _0x2e879c['status'](_0x4bf96b)[_0xd3d2('0x16')](_0x29790d);}};}function respondWithFilteredResult(_0x164fc9,_0x25650b){return function(_0x2dd9a0){if(_0x2dd9a0){var _0x5d7cca=typeof _0x25650b[_0xd3d2('0x17')]===_0xd3d2('0x18')&&typeof _0x25650b[_0xd3d2('0x19')]==='undefined';var _0x3e0054=_0x2dd9a0[_0xd3d2('0x1a')];var _0xbf3f6a=_0x5d7cca?0x0:_0x25650b['offset'];var _0x12d5ea=_0x5d7cca?_0x2dd9a0[_0xd3d2('0x1a')]:_0x25650b[_0xd3d2('0x17')]+_0x25650b[_0xd3d2('0x19')];var _0x3e299d;if(_0x12d5ea>=_0x3e0054){_0x12d5ea=_0x3e0054;_0x3e299d=0xc8;}else{_0x3e299d=0xce;}_0x164fc9[_0xd3d2('0x1b')](_0x3e299d);return _0x164fc9['set'](_0xd3d2('0x1c'),_0xbf3f6a+'-'+_0x12d5ea+'/'+_0x3e0054)[_0xd3d2('0x16')](_0x2dd9a0);}return null;};}function patchUpdates(_0x5b606e){return function(_0x8300d7){try{jsonpatch['apply'](_0x8300d7,_0x5b606e,!![]);}catch(_0x49d104){return BPromise['reject'](_0x49d104);}return _0x8300d7[_0xd3d2('0x1d')]();};}function saveUpdates(_0x1bfa0e,_0x470f99){return function(_0x4f7c07){if(_0x4f7c07){return _0x4f7c07[_0xd3d2('0x1e')](_0x1bfa0e)[_0xd3d2('0x1f')](function(_0x2318d1){return _0x2318d1;});}return null;};}function removeEntity(_0x1bd7c5,_0x416d44){return function(_0x24c452){if(_0x24c452){return _0x24c452['destroy']()['then'](function(){_0x1bd7c5[_0xd3d2('0x1b')](0xcc)[_0xd3d2('0x20')]();});}};}function handleEntityNotFound(_0x14d493,_0x14dc40){return function(_0x22fcc6){if(!_0x22fcc6){_0x14d493['sendStatus'](0x194);}return _0x22fcc6;};}function handleError(_0x58e4df,_0x4f18cb){_0x4f18cb=_0x4f18cb||0x1f4;return function(_0x425f9b){logger['error'](_0x425f9b['stack']);if(_0x425f9b[_0xd3d2('0x21')]){delete _0x425f9b[_0xd3d2('0x21')];}_0x58e4df[_0xd3d2('0x1b')](_0x4f18cb)[_0xd3d2('0x22')](_0x425f9b);};}exports[_0xd3d2('0x23')]=function(_0x50a638,_0x130819){var _0x34a23a={},_0x157da9={},_0x196dbd={'count':0x0,'rows':[]};var _0x4c7aa8=_['map'](db['OpenchannelQueueReport'][_0xd3d2('0x24')],function(_0x410fa7){return{'name':_0x410fa7[_0xd3d2('0x25')],'type':_0x410fa7[_0xd3d2('0x26')]['key']};});_0x157da9['model']=_[_0xd3d2('0x27')](_0x4c7aa8,'name');_0x157da9[_0xd3d2('0x28')]=_[_0xd3d2('0x29')](_0x50a638[_0xd3d2('0x28')]);_0x157da9[_0xd3d2('0x2a')]=_[_0xd3d2('0x2b')](_0x157da9[_0xd3d2('0x2c')],_0x157da9['query']);_0x34a23a[_0xd3d2('0x2d')]=_['intersection'](_0x157da9[_0xd3d2('0x2c')],qs[_0xd3d2('0x2e')](_0x50a638[_0xd3d2('0x28')][_0xd3d2('0x2e')]));_0x34a23a[_0xd3d2('0x2d')]=_0x34a23a[_0xd3d2('0x2d')][_0xd3d2('0x2f')]?_0x34a23a[_0xd3d2('0x2d')]:_0x157da9[_0xd3d2('0x2c')];if(!_0x50a638[_0xd3d2('0x28')][_0xd3d2('0x30')]('nolimit')){_0x34a23a['limit']=qs[_0xd3d2('0x19')](_0x50a638[_0xd3d2('0x28')][_0xd3d2('0x19')]);_0x34a23a['offset']=qs[_0xd3d2('0x17')](_0x50a638[_0xd3d2('0x28')]['offset']);}_0x34a23a['order']=qs[_0xd3d2('0x31')](_0x50a638['query'][_0xd3d2('0x31')]);_0x34a23a[_0xd3d2('0x32')]=qs[_0xd3d2('0x2a')](_[_0xd3d2('0x33')](_0x50a638[_0xd3d2('0x28')],_0x157da9[_0xd3d2('0x2a')]),_0x4c7aa8);if(_0x50a638[_0xd3d2('0x28')][_0xd3d2('0x34')]){_0x34a23a['where']=_[_0xd3d2('0x35')](_0x34a23a[_0xd3d2('0x32')],{'$or':_['map'](_0x4c7aa8,function(_0x34581d){if(_0x34581d[_0xd3d2('0x26')]!==_0xd3d2('0x36')){var _0x481181={};_0x481181[_0x34581d['name']]={'$like':'%'+_0x50a638[_0xd3d2('0x28')][_0xd3d2('0x34')]+'%'};return _0x481181;}})});}_0x34a23a=_['merge']({},_0x34a23a,_0x50a638['options']);var _0x26f888={'where':_0x34a23a[_0xd3d2('0x32')]};return db[_0xd3d2('0x37')]['count'](_0x26f888)[_0xd3d2('0x1f')](function(_0x2c7900){_0x196dbd[_0xd3d2('0x1a')]=_0x2c7900;if(_0x50a638[_0xd3d2('0x28')][_0xd3d2('0x38')]){_0x34a23a[_0xd3d2('0x39')]=[{'all':!![]}];}return db[_0xd3d2('0x37')]['findAll'](_0x34a23a);})[_0xd3d2('0x1f')](function(_0x24c920){_0x196dbd[_0xd3d2('0x3a')]=_0x24c920;return _0x196dbd;})['then'](respondWithFilteredResult(_0x130819,_0x34a23a))[_0xd3d2('0x3b')](handleError(_0x130819,null));};exports[_0xd3d2('0x3c')]=function(_0x376bc6,_0x163cc5){var _0x2d94e7={'raw':!![],'where':{'id':_0x376bc6['params']['id']}},_0x3ec484={};_0x3ec484[_0xd3d2('0x2c')]=_[_0xd3d2('0x29')](db[_0xd3d2('0x37')]['rawAttributes']);_0x3ec484[_0xd3d2('0x28')]=_[_0xd3d2('0x29')](_0x376bc6['query']);_0x3ec484['filters']=_[_0xd3d2('0x2b')](_0x3ec484[_0xd3d2('0x2c')],_0x3ec484[_0xd3d2('0x28')]);_0x2d94e7[_0xd3d2('0x2d')]=_[_0xd3d2('0x2b')](_0x3ec484[_0xd3d2('0x2c')],qs['fields'](_0x376bc6[_0xd3d2('0x28')][_0xd3d2('0x2e')]));_0x2d94e7[_0xd3d2('0x2d')]=_0x2d94e7[_0xd3d2('0x2d')][_0xd3d2('0x2f')]?_0x2d94e7['attributes']:_0x3ec484[_0xd3d2('0x2c')];if(_0x376bc6['query'][_0xd3d2('0x38')]){_0x2d94e7[_0xd3d2('0x39')]=[{'all':!![]}];}_0x2d94e7=_['merge']({},_0x2d94e7,_0x376bc6[_0xd3d2('0x3d')]);return db[_0xd3d2('0x37')]['find'](_0x2d94e7)[_0xd3d2('0x1f')](handleEntityNotFound(_0x163cc5,null))[_0xd3d2('0x1f')](respondWithResult(_0x163cc5,null))[_0xd3d2('0x3b')](handleError(_0x163cc5,null));};exports[_0xd3d2('0x3e')]=function(_0x2b3e30,_0x3631c7){return db[_0xd3d2('0x37')]['create'](_0x2b3e30[_0xd3d2('0x3f')],{})[_0xd3d2('0x1f')](respondWithResult(_0x3631c7,0xc9))[_0xd3d2('0x3b')](handleError(_0x3631c7,null));};exports[_0xd3d2('0x1e')]=function(_0x2d2445,_0x5217b9){if(_0x2d2445[_0xd3d2('0x3f')]['id']){delete _0x2d2445['body']['id'];}return db[_0xd3d2('0x37')][_0xd3d2('0x40')]({'where':{'id':_0x2d2445[_0xd3d2('0x41')]['id']}})[_0xd3d2('0x1f')](handleEntityNotFound(_0x5217b9,null))['then'](saveUpdates(_0x2d2445[_0xd3d2('0x3f')],null))[_0xd3d2('0x1f')](respondWithResult(_0x5217b9,null))[_0xd3d2('0x3b')](handleError(_0x5217b9,null));};exports['destroy']=function(_0x276c55,_0x43b3e3){return db['OpenchannelQueueReport'][_0xd3d2('0x40')]({'where':{'id':_0x276c55[_0xd3d2('0x41')]['id']}})['then'](handleEntityNotFound(_0x43b3e3,null))[_0xd3d2('0x1f')](removeEntity(_0x43b3e3,null))['catch'](handleError(_0x43b3e3,null));};exports[_0xd3d2('0x42')]=function(_0x2f3928,_0x36a747){return db[_0xd3d2('0x37')]['describe']()[_0xd3d2('0x1f')](respondWithResult(_0x36a747,null))[_0xd3d2('0x3b')](handleError(_0x36a747,null));}; \ No newline at end of file +var _0xba6f=['set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','key','map','keys','query','filters','model','attributes','intersection','fields','order','sort','pick','filter','where','merge','type','includeAll','include','catch','show','params','length','options','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count'];(function(_0x316904,_0x1e8b77){var _0xfa9a21=function(_0x2b75ae){while(--_0x2b75ae){_0x316904['push'](_0x316904['shift']());}};_0xfa9a21(++_0x1e8b77);}(_0xba6f,0x106));var _0xfba6=function(_0x5b2c50,_0x4db66b){_0x5b2c50=_0x5b2c50-0x0;var _0x47f2f9=_0xba6f[_0x5b2c50];return _0x47f2f9;};'use strict';var emlformat=require(_0xfba6('0x0'));var rimraf=require(_0xfba6('0x1'));var zipdir=require(_0xfba6('0x2'));var jsonpatch=require(_0xfba6('0x3'));var rp=require(_0xfba6('0x4'));var moment=require(_0xfba6('0x5'));var BPromise=require(_0xfba6('0x6'));var Mustache=require(_0xfba6('0x7'));var util=require('util');var path=require(_0xfba6('0x8'));var sox=require(_0xfba6('0x9'));var csv=require(_0xfba6('0xa'));var ejs=require(_0xfba6('0xb'));var fs=require('fs');var fs_extra=require(_0xfba6('0xc'));var _=require('lodash');var squel=require(_0xfba6('0xd'));var crypto=require('crypto');var jsforce=require(_0xfba6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xfba6('0xa'));var querystring=require('querystring');var Papa=require(_0xfba6('0xf'));var Redis=require(_0xfba6('0x10'));var authService=require(_0xfba6('0x11'));var qs=require(_0xfba6('0x12'));var as=require(_0xfba6('0x13'));var hardwareService=require(_0xfba6('0x14'));var logger=require(_0xfba6('0x15'))(_0xfba6('0x16'));var utils=require(_0xfba6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfba6('0x18'));var db=require(_0xfba6('0x19'))['db'];function respondWithStatusCode(_0x21d095,_0x48fbd9){_0x48fbd9=_0x48fbd9||0xcc;return function(_0xe3f2c3){if(_0xe3f2c3){return _0x21d095[_0xfba6('0x1a')](_0x48fbd9);}return _0x21d095['status'](_0x48fbd9)[_0xfba6('0x1b')]();};}function respondWithResult(_0x562a89,_0x4f2101){_0x4f2101=_0x4f2101||0xc8;return function(_0x127d68){if(_0x127d68){return _0x562a89[_0xfba6('0x1c')](_0x4f2101)[_0xfba6('0x1d')](_0x127d68);}};}function respondWithFilteredResult(_0x29e11b,_0x1b1ad2){return function(_0x345bbd){if(_0x345bbd){var _0xf808c2=typeof _0x1b1ad2[_0xfba6('0x1e')]===_0xfba6('0x1f')&&typeof _0x1b1ad2[_0xfba6('0x20')]===_0xfba6('0x1f');var _0x3caf43=_0x345bbd[_0xfba6('0x21')];var _0x94fc4f=_0xf808c2?0x0:_0x1b1ad2[_0xfba6('0x1e')];var _0x1eb59b=_0xf808c2?_0x345bbd['count']:_0x1b1ad2[_0xfba6('0x1e')]+_0x1b1ad2[_0xfba6('0x20')];var _0x1cb052;if(_0x1eb59b>=_0x3caf43){_0x1eb59b=_0x3caf43;_0x1cb052=0xc8;}else{_0x1cb052=0xce;}_0x29e11b['status'](_0x1cb052);return _0x29e11b[_0xfba6('0x22')](_0xfba6('0x23'),_0x94fc4f+'-'+_0x1eb59b+'/'+_0x3caf43)[_0xfba6('0x1d')](_0x345bbd);}return null;};}function patchUpdates(_0x1ce3a1){return function(_0x87a36){try{jsonpatch[_0xfba6('0x24')](_0x87a36,_0x1ce3a1,!![]);}catch(_0x3ea1af){return BPromise[_0xfba6('0x25')](_0x3ea1af);}return _0x87a36[_0xfba6('0x26')]();};}function saveUpdates(_0x509fed,_0x556c10){return function(_0x443d64){if(_0x443d64){return _0x443d64[_0xfba6('0x27')](_0x509fed)[_0xfba6('0x28')](function(_0x338f4a){return _0x338f4a;});}return null;};}function removeEntity(_0x9779bd,_0x5402bc){return function(_0x4f5e69){if(_0x4f5e69){return _0x4f5e69[_0xfba6('0x29')]()[_0xfba6('0x28')](function(){_0x9779bd[_0xfba6('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13d462,_0x3ccc96){return function(_0x126fe5){if(!_0x126fe5){_0x13d462[_0xfba6('0x1a')](0x194);}return _0x126fe5;};}function handleError(_0x532124,_0x18263f){_0x18263f=_0x18263f||0x1f4;return function(_0x3002bc){logger['error'](_0x3002bc[_0xfba6('0x2a')]);if(_0x3002bc[_0xfba6('0x2b')]){delete _0x3002bc[_0xfba6('0x2b')];}_0x532124['status'](_0x18263f)[_0xfba6('0x2c')](_0x3002bc);};}exports[_0xfba6('0x2d')]=function(_0x536f99,_0x478586){var _0xc2ed26={},_0xe9b545={},_0x38891d={'count':0x0,'rows':[]};var _0x2d572f=_['map'](db[_0xfba6('0x2e')][_0xfba6('0x2f')],function(_0x1904a3){return{'name':_0x1904a3[_0xfba6('0x30')],'type':_0x1904a3['type'][_0xfba6('0x31')]};});_0xe9b545['model']=_[_0xfba6('0x32')](_0x2d572f,_0xfba6('0x2b'));_0xe9b545['query']=_[_0xfba6('0x33')](_0x536f99[_0xfba6('0x34')]);_0xe9b545[_0xfba6('0x35')]=_['intersection'](_0xe9b545[_0xfba6('0x36')],_0xe9b545['query']);_0xc2ed26[_0xfba6('0x37')]=_[_0xfba6('0x38')](_0xe9b545[_0xfba6('0x36')],qs[_0xfba6('0x39')](_0x536f99['query']['fields']));_0xc2ed26[_0xfba6('0x37')]=_0xc2ed26[_0xfba6('0x37')]['length']?_0xc2ed26[_0xfba6('0x37')]:_0xe9b545[_0xfba6('0x36')];if(!_0x536f99[_0xfba6('0x34')]['hasOwnProperty']('nolimit')){_0xc2ed26[_0xfba6('0x20')]=qs[_0xfba6('0x20')](_0x536f99[_0xfba6('0x34')][_0xfba6('0x20')]);_0xc2ed26['offset']=qs[_0xfba6('0x1e')](_0x536f99[_0xfba6('0x34')][_0xfba6('0x1e')]);}_0xc2ed26[_0xfba6('0x3a')]=qs['sort'](_0x536f99['query'][_0xfba6('0x3b')]);_0xc2ed26['where']=qs['filters'](_[_0xfba6('0x3c')](_0x536f99[_0xfba6('0x34')],_0xe9b545['filters']),_0x2d572f);if(_0x536f99[_0xfba6('0x34')][_0xfba6('0x3d')]){_0xc2ed26[_0xfba6('0x3e')]=_[_0xfba6('0x3f')](_0xc2ed26[_0xfba6('0x3e')],{'$or':_[_0xfba6('0x32')](_0x2d572f,function(_0x64f6ea){if(_0x64f6ea[_0xfba6('0x40')]!=='VIRTUAL'){var _0x2a53d2={};_0x2a53d2[_0x64f6ea[_0xfba6('0x2b')]]={'$like':'%'+_0x536f99[_0xfba6('0x34')][_0xfba6('0x3d')]+'%'};return _0x2a53d2;}})});}_0xc2ed26=_[_0xfba6('0x3f')]({},_0xc2ed26,_0x536f99['options']);var _0x144f4b={'where':_0xc2ed26[_0xfba6('0x3e')]};return db['OpenchannelQueueReport']['count'](_0x144f4b)[_0xfba6('0x28')](function(_0x24d6fd){_0x38891d[_0xfba6('0x21')]=_0x24d6fd;if(_0x536f99[_0xfba6('0x34')][_0xfba6('0x41')]){_0xc2ed26[_0xfba6('0x42')]=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0xc2ed26);})['then'](function(_0x3842b9){_0x38891d['rows']=_0x3842b9;return _0x38891d;})[_0xfba6('0x28')](respondWithFilteredResult(_0x478586,_0xc2ed26))[_0xfba6('0x43')](handleError(_0x478586,null));};exports[_0xfba6('0x44')]=function(_0x449510,_0x144a70){var _0x35eb40={'raw':!![],'where':{'id':_0x449510[_0xfba6('0x45')]['id']}},_0x2ad036={};_0x2ad036[_0xfba6('0x36')]=_[_0xfba6('0x33')](db[_0xfba6('0x2e')][_0xfba6('0x2f')]);_0x2ad036['query']=_[_0xfba6('0x33')](_0x449510[_0xfba6('0x34')]);_0x2ad036[_0xfba6('0x35')]=_['intersection'](_0x2ad036['model'],_0x2ad036[_0xfba6('0x34')]);_0x35eb40[_0xfba6('0x37')]=_['intersection'](_0x2ad036[_0xfba6('0x36')],qs[_0xfba6('0x39')](_0x449510[_0xfba6('0x34')][_0xfba6('0x39')]));_0x35eb40[_0xfba6('0x37')]=_0x35eb40[_0xfba6('0x37')][_0xfba6('0x46')]?_0x35eb40['attributes']:_0x2ad036[_0xfba6('0x36')];if(_0x449510['query'][_0xfba6('0x41')]){_0x35eb40[_0xfba6('0x42')]=[{'all':!![]}];}_0x35eb40=_[_0xfba6('0x3f')]({},_0x35eb40,_0x449510[_0xfba6('0x47')]);return db[_0xfba6('0x2e')]['find'](_0x35eb40)[_0xfba6('0x28')](handleEntityNotFound(_0x144a70,null))[_0xfba6('0x28')](respondWithResult(_0x144a70,null))['catch'](handleError(_0x144a70,null));};exports[_0xfba6('0x48')]=function(_0x428742,_0xde948){return db[_0xfba6('0x2e')][_0xfba6('0x48')](_0x428742[_0xfba6('0x49')],{})['then'](respondWithResult(_0xde948,0xc9))['catch'](handleError(_0xde948,null));};exports[_0xfba6('0x27')]=function(_0x59a231,_0x11ea5d){if(_0x59a231[_0xfba6('0x49')]['id']){delete _0x59a231[_0xfba6('0x49')]['id'];}return db[_0xfba6('0x2e')]['find']({'where':{'id':_0x59a231['params']['id']}})['then'](handleEntityNotFound(_0x11ea5d,null))[_0xfba6('0x28')](saveUpdates(_0x59a231[_0xfba6('0x49')],null))[_0xfba6('0x28')](respondWithResult(_0x11ea5d,null))['catch'](handleError(_0x11ea5d,null));};exports[_0xfba6('0x29')]=function(_0x30df68,_0x410e42){return db[_0xfba6('0x2e')]['find']({'where':{'id':_0x30df68[_0xfba6('0x45')]['id']}})[_0xfba6('0x28')](handleEntityNotFound(_0x410e42,null))['then'](removeEntity(_0x410e42,null))[_0xfba6('0x43')](handleError(_0x410e42,null));};exports['describe']=function(_0x48d475,_0x1463f4){return db[_0xfba6('0x2e')]['describe']()['then'](respondWithResult(_0x1463f4,null))[_0xfba6('0x43')](handleError(_0x1463f4,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 4a6bdab..7a3163b 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 _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0xe53a71,_0x56ba57){var _0x4713fb=function(_0x1f624a){while(--_0x1f624a){_0xe53a71['push'](_0xe53a71['shift']());}};_0x4713fb(++_0x56ba57);}(_0x2ef3,0xba));var _0x32ef=function(_0x305464,_0x305ead){_0x305464=_0x305464-0x0;var _0x10ca46=_0x2ef3[_0x305464];return _0x10ca46;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'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(_0x476f21,_0x1167e4){var _0xa50928=function(_0x1f3211){while(--_0x1f3211){_0x476f21['push'](_0x476f21['shift']());}};_0xa50928(++_0x1167e4);}(_0x7a54,0x106));var _0x47a5=function(_0x209587,_0x3e4e82){_0x209587=_0x209587-0x0;var _0x2e701f=_0x7a54[_0x209587];return _0x2e701f;};'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 64922f0..207fcd9 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 _0xaa64=['attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','then','UpdateOpenchannelQueueReport','update','where'];(function(_0x5b5f25,_0x409a33){var _0x52015e=function(_0x42ea22){while(--_0x42ea22){_0x5b5f25['push'](_0x5b5f25['shift']());}};_0x52015e(++_0x409a33);}(_0xaa64,0xf7));var _0x4aa6=function(_0x15ee7d,_0x17dc09){_0x15ee7d=_0x15ee7d-0x0;var _0x36ebfa=_0xaa64[_0x15ee7d];return _0x36ebfa;};'use strict';var _=require(_0x4aa6('0x0'));var util=require(_0x4aa6('0x1'));var moment=require('moment');var BPromise=require(_0x4aa6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4aa6('0x3'));var db=require(_0x4aa6('0x4'))['db'];var utils=require(_0x4aa6('0x5'));var logger=require('../../config/logger')(_0x4aa6('0x6'));var config=require(_0x4aa6('0x7'));var jayson=require(_0x4aa6('0x8'));var client=jayson[_0x4aa6('0x9')][_0x4aa6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7dd83d,_0x39c4b5,_0x49e174){return new BPromise(function(_0x529c89,_0xee21ba){return client[_0x4aa6('0xb')](_0x7dd83d,_0x49e174)['then'](function(_0x26619c){logger['info'](_0x4aa6('0xc'),_0x39c4b5,_0x4aa6('0xd'));logger[_0x4aa6('0xe')](_0x4aa6('0xf'),_0x39c4b5,'request\x20sent',JSON[_0x4aa6('0x10')](_0x26619c));if(_0x26619c[_0x4aa6('0x11')]){if(_0x26619c[_0x4aa6('0x11')][_0x4aa6('0x12')]===0x1f4){logger[_0x4aa6('0x11')](_0x4aa6('0xc'),_0x39c4b5,_0x26619c[_0x4aa6('0x11')][_0x4aa6('0x13')]);return _0xee21ba(_0x26619c[_0x4aa6('0x11')][_0x4aa6('0x13')]);}logger['error'](_0x4aa6('0xc'),_0x39c4b5,_0x26619c['error']['message']);return _0x529c89(_0x26619c[_0x4aa6('0x11')][_0x4aa6('0x13')]);}else{logger[_0x4aa6('0x14')](_0x4aa6('0xc'),_0x39c4b5,_0x4aa6('0xd'));_0x529c89(_0x26619c[_0x4aa6('0x15')][_0x4aa6('0x13')]);}})[_0x4aa6('0x16')](function(_0x530ed0){logger[_0x4aa6('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x39c4b5,_0x530ed0);_0xee21ba(_0x530ed0);});});}exports[_0x4aa6('0x17')]=function(_0x5c6d3c){var _0x54a6d8=this;return new Promise(function(_0x266707,_0x15f5e6){return db[_0x4aa6('0x18')][_0x4aa6('0x19')](_0x5c6d3c[_0x4aa6('0x1a')],{'raw':_0x5c6d3c[_0x4aa6('0x1b')]?_0x5c6d3c[_0x4aa6('0x1b')][_0x4aa6('0x1c')]===undefined?!![]:![]:!![]})[_0x4aa6('0x1d')](function(_0x4c9159){logger[_0x4aa6('0x14')](_0x4aa6('0x17'),_0x5c6d3c);logger[_0x4aa6('0xe')](_0x4aa6('0x17'),_0x5c6d3c,JSON[_0x4aa6('0x10')](_0x4c9159));_0x266707(_0x4c9159);})[_0x4aa6('0x16')](function(_0x594665){logger[_0x4aa6('0x11')](_0x4aa6('0x17'),_0x594665[_0x4aa6('0x13')],_0x5c6d3c);_0x15f5e6(_0x54a6d8[_0x4aa6('0x11')](0x1f4,_0x594665[_0x4aa6('0x13')]));});});};exports[_0x4aa6('0x1e')]=function(_0x568a5c){var _0x2f4943=this;return new Promise(function(_0x91373f,_0x47b285){return db['OpenchannelQueueReport'][_0x4aa6('0x1f')](_0x568a5c[_0x4aa6('0x1a')],{'raw':_0x568a5c[_0x4aa6('0x1b')]?_0x568a5c[_0x4aa6('0x1b')][_0x4aa6('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x568a5c['options']?_0x568a5c[_0x4aa6('0x1b')][_0x4aa6('0x20')]||null:null,'attributes':_0x568a5c[_0x4aa6('0x1b')]?_0x568a5c[_0x4aa6('0x1b')][_0x4aa6('0x21')]||null:null,'limit':_0x568a5c[_0x4aa6('0x1b')]?_0x568a5c['options'][_0x4aa6('0x22')]||null:null})[_0x4aa6('0x1d')](function(_0x5bc756){logger[_0x4aa6('0x14')](_0x4aa6('0x1e'),_0x568a5c);logger[_0x4aa6('0xe')](_0x4aa6('0x1e'),_0x568a5c,JSON['stringify'](_0x5bc756));_0x91373f(_0x5bc756);})[_0x4aa6('0x16')](function(_0x625df8){logger[_0x4aa6('0x11')]('UpdateOpenchannelQueueReport',_0x625df8[_0x4aa6('0x13')],_0x568a5c);_0x47b285(_0x2f4943[_0x4aa6('0x11')](0x1f4,_0x625df8[_0x4aa6('0x13')]));});});}; \ No newline at end of file +var _0xb62e=['attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','then','UpdateOpenchannelQueueReport','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb62e,0x1de));var _0xeb62=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb62e[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var moment=require(_0xeb62('0x2'));var BPromise=require(_0xeb62('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb62('0x4'));var db=require(_0xeb62('0x5'))['db'];var utils=require(_0xeb62('0x6'));var logger=require(_0xeb62('0x7'))(_0xeb62('0x8'));var config=require(_0xeb62('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb62('0xa')][_0xeb62('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31f5ea,_0x5e0dc4,_0x2065a0){return new BPromise(function(_0xab7049,_0x1e10ae){return client[_0xeb62('0xc')](_0x31f5ea,_0x2065a0)['then'](function(_0x5cdef3){logger[_0xeb62('0xd')](_0xeb62('0xe'),_0x5e0dc4,_0xeb62('0xf'));logger[_0xeb62('0x10')](_0xeb62('0x11'),_0x5e0dc4,_0xeb62('0xf'),JSON[_0xeb62('0x12')](_0x5cdef3));if(_0x5cdef3[_0xeb62('0x13')]){if(_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x14')]===0x1f4){logger['error'](_0xeb62('0xe'),_0x5e0dc4,_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x15')]);return _0x1e10ae(_0x5cdef3[_0xeb62('0x13')]['message']);}logger[_0xeb62('0x13')](_0xeb62('0xe'),_0x5e0dc4,_0x5cdef3[_0xeb62('0x13')]['message']);return _0xab7049(_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x15')]);}else{logger[_0xeb62('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5e0dc4,_0xeb62('0xf'));_0xab7049(_0x5cdef3[_0xeb62('0x16')][_0xeb62('0x15')]);}})[_0xeb62('0x17')](function(_0x3fb280){logger[_0xeb62('0x13')](_0xeb62('0xe'),_0x5e0dc4,_0x3fb280);_0x1e10ae(_0x3fb280);});});}exports[_0xeb62('0x18')]=function(_0x39b138){var _0x27fd84=this;return new Promise(function(_0x27efc8,_0x11d516){return db[_0xeb62('0x19')]['create'](_0x39b138[_0xeb62('0x1a')],{'raw':_0x39b138[_0xeb62('0x1b')]?_0x39b138[_0xeb62('0x1b')][_0xeb62('0x1c')]===undefined?!![]:![]:!![]})[_0xeb62('0x1d')](function(_0x24cbf3){logger[_0xeb62('0xd')]('CreateOpenchannelQueueReport',_0x39b138);logger['debug'](_0xeb62('0x18'),_0x39b138,JSON[_0xeb62('0x12')](_0x24cbf3));_0x27efc8(_0x24cbf3);})[_0xeb62('0x17')](function(_0x13243f){logger[_0xeb62('0x13')]('CreateOpenchannelQueueReport',_0x13243f['message'],_0x39b138);_0x11d516(_0x27fd84[_0xeb62('0x13')](0x1f4,_0x13243f[_0xeb62('0x15')]));});});};exports[_0xeb62('0x1e')]=function(_0x395b70){var _0x55a169=this;return new Promise(function(_0x4e92f5,_0x3ef988){return db['OpenchannelQueueReport'][_0xeb62('0x1f')](_0x395b70['body'],{'raw':_0x395b70[_0xeb62('0x1b')]?_0x395b70['options'][_0xeb62('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x395b70[_0xeb62('0x1b')]?_0x395b70[_0xeb62('0x1b')]['where']||null:null,'attributes':_0x395b70[_0xeb62('0x1b')]?_0x395b70[_0xeb62('0x1b')][_0xeb62('0x20')]||null:null,'limit':_0x395b70[_0xeb62('0x1b')]?_0x395b70[_0xeb62('0x1b')][_0xeb62('0x21')]||null:null})['then'](function(_0x192517){logger[_0xeb62('0xd')]('UpdateOpenchannelQueueReport',_0x395b70);logger[_0xeb62('0x10')](_0xeb62('0x1e'),_0x395b70,JSON[_0xeb62('0x12')](_0x192517));_0x4e92f5(_0x192517);})[_0xeb62('0x17')](function(_0x235448){logger['error']('UpdateOpenchannelQueueReport',_0x235448[_0xeb62('0x15')],_0x395b70);_0x3ef988(_0x55a169[_0xeb62('0x13')](0x1f4,_0x235448[_0xeb62('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 20d585a..fe1fa4f 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 _0xf991=['../../components/interaction/service','./openchannelTransferReport.controller','get','index','/describe','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x323c52,_0x4f8577){var _0x4d9878=function(_0x4ee728){while(--_0x4ee728){_0x323c52['push'](_0x323c52['shift']());}};_0x4d9878(++_0x4f8577);}(_0xf991,0x1cf));var _0x1f99=function(_0x205a12,_0x5d1d07){_0x205a12=_0x205a12-0x0;var _0x2ae9cc=_0xf991[_0x205a12];return _0x2ae9cc;};'use strict';var multer=require(_0x1f99('0x0'));var util=require(_0x1f99('0x1'));var path=require(_0x1f99('0x2'));var timeout=require(_0x1f99('0x3'));var express=require('express');var router=express[_0x1f99('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1f99('0x5'));var config=require('../../config/environment');var controller=require(_0x1f99('0x6'));router[_0x1f99('0x7')]('/',auth['isAuthenticated'](),controller[_0x1f99('0x8')]);router[_0x1f99('0x7')](_0x1f99('0x9'),auth[_0x1f99('0xa')](),controller['describe']);router[_0x1f99('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x1f99('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1f99('0xc')]);router[_0x1f99('0xd')]('/:id',auth[_0x1f99('0xa')](),controller[_0x1f99('0xe')]);router[_0x1f99('0xf')]('/:id',auth[_0x1f99('0xa')](),controller[_0x1f99('0x10')]);module[_0x1f99('0x11')]=router; \ No newline at end of file +var _0xf76f=['/:id','show','post','create','put','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x594245,_0x37fa88){var _0x538195=function(_0x96af1){while(--_0x96af1){_0x594245['push'](_0x594245['shift']());}};_0x538195(++_0x37fa88);}(_0xf76f,0x1bf));var _0xff76=function(_0x3e9b78,_0x4ecc13){_0x3e9b78=_0x3e9b78-0x0;var _0xcc94a3=_0xf76f[_0x3e9b78];return _0xcc94a3;};'use strict';var multer=require(_0xff76('0x0'));var util=require(_0xff76('0x1'));var path=require(_0xff76('0x2'));var timeout=require('connect-timeout');var express=require(_0xff76('0x3'));var router=express[_0xff76('0x4')]();var fs_extra=require(_0xff76('0x5'));var auth=require(_0xff76('0x6'));var interaction=require(_0xff76('0x7'));var config=require(_0xff76('0x8'));var controller=require(_0xff76('0x9'));router[_0xff76('0xa')]('/',auth[_0xff76('0xb')](),controller[_0xff76('0xc')]);router[_0xff76('0xa')](_0xff76('0xd'),auth[_0xff76('0xb')](),controller[_0xff76('0xe')]);router[_0xff76('0xa')](_0xff76('0xf'),auth[_0xff76('0xb')](),controller[_0xff76('0x10')]);router[_0xff76('0x11')]('/',auth[_0xff76('0xb')](),controller[_0xff76('0x12')]);router[_0xff76('0x13')](_0xff76('0xf'),auth[_0xff76('0xb')](),controller[_0xff76('0x14')]);router['delete'](_0xff76('0xf'),auth[_0xff76('0xb')](),controller[_0xff76('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index d7d0999..87bfe69 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x52e093,_0x31b6e5){var _0x49a49d=function(_0x173837){while(--_0x173837){_0x52e093['push'](_0x52e093['shift']());}};_0x49a49d(++_0x31b6e5);}(_0x70e0,0x17b));var _0x070e=function(_0x5b83c2,_0x340a36){_0x5b83c2=_0x5b83c2-0x0;var _0x5b3f7d=_0x70e0[_0x5b83c2];return _0x5b3f7d;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0xbd2601,_0x393b2a){var _0x34de0a=function(_0x536346){while(--_0x536346){_0xbd2601['push'](_0xbd2601['shift']());}};_0x34de0a(++_0x393b2a);}(_0x70e0,0x17b));var _0x070e=function(_0x1acb77,_0x460b09){_0x1acb77=_0x1acb77-0x0;var _0x2054bb=_0x70e0[_0x1acb77];return _0x2054bb;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 27c7c09..ab35a17 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 _0xea45=['include','options','create','update','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','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/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','key','map','query','filters','model','attributes','intersection','fields','nolimit','sort','pick','filter','where','type','merge','includeAll','findAll','rows','catch','show','keys','length'];(function(_0x13bdb5,_0x2644c9){var _0x1229a2=function(_0x3e9859){while(--_0x3e9859){_0x13bdb5['push'](_0x13bdb5['shift']());}};_0x1229a2(++_0x2644c9);}(_0xea45,0xa4));var _0x5ea4=function(_0x476558,_0x32d07f){_0x476558=_0x476558-0x0;var _0x565cca=_0xea45[_0x476558];return _0x565cca;};'use strict';var emlformat=require(_0x5ea4('0x0'));var rimraf=require(_0x5ea4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5ea4('0x2'));var rp=require(_0x5ea4('0x3'));var moment=require('moment');var BPromise=require(_0x5ea4('0x4'));var Mustache=require('mustache');var util=require(_0x5ea4('0x5'));var path=require(_0x5ea4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5ea4('0x7'));var fs=require('fs');var fs_extra=require(_0x5ea4('0x8'));var _=require(_0x5ea4('0x9'));var squel=require(_0x5ea4('0xa'));var crypto=require(_0x5ea4('0xb'));var jsforce=require(_0x5ea4('0xc'));var deskjs=require(_0x5ea4('0xd'));var toCsv=require(_0x5ea4('0xe'));var querystring=require(_0x5ea4('0xf'));var Papa=require('papaparse');var Redis=require(_0x5ea4('0x10'));var authService=require(_0x5ea4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5ea4('0x12'));var hardwareService=require(_0x5ea4('0x13'));var logger=require(_0x5ea4('0x14'))(_0x5ea4('0x15'));var utils=require(_0x5ea4('0x16'));var config=require(_0x5ea4('0x17'));var licenseUtil=require(_0x5ea4('0x18'));var db=require(_0x5ea4('0x19'))['db'];function respondWithStatusCode(_0xf95339,_0x57a825){_0x57a825=_0x57a825||0xcc;return function(_0x115281){if(_0x115281){return _0xf95339['sendStatus'](_0x57a825);}return _0xf95339[_0x5ea4('0x1a')](_0x57a825)[_0x5ea4('0x1b')]();};}function respondWithResult(_0x44673c,_0x39cee5){_0x39cee5=_0x39cee5||0xc8;return function(_0x4f13){if(_0x4f13){return _0x44673c[_0x5ea4('0x1a')](_0x39cee5)[_0x5ea4('0x1c')](_0x4f13);}};}function respondWithFilteredResult(_0x153a7f,_0x369883){return function(_0x220d4a){if(_0x220d4a){var _0x5dd43f=typeof _0x369883['offset']==='undefined'&&typeof _0x369883['limit']===_0x5ea4('0x1d');var _0x4f9ca9=_0x220d4a[_0x5ea4('0x1e')];var _0x1c87b0=_0x5dd43f?0x0:_0x369883[_0x5ea4('0x1f')];var _0x4386d2=_0x5dd43f?_0x220d4a[_0x5ea4('0x1e')]:_0x369883[_0x5ea4('0x1f')]+_0x369883[_0x5ea4('0x20')];var _0x444c55;if(_0x4386d2>=_0x4f9ca9){_0x4386d2=_0x4f9ca9;_0x444c55=0xc8;}else{_0x444c55=0xce;}_0x153a7f['status'](_0x444c55);return _0x153a7f[_0x5ea4('0x21')](_0x5ea4('0x22'),_0x1c87b0+'-'+_0x4386d2+'/'+_0x4f9ca9)['json'](_0x220d4a);}return null;};}function patchUpdates(_0x2a2c71){return function(_0x52b21e){try{jsonpatch[_0x5ea4('0x23')](_0x52b21e,_0x2a2c71,!![]);}catch(_0x2e4db0){return BPromise[_0x5ea4('0x24')](_0x2e4db0);}return _0x52b21e[_0x5ea4('0x25')]();};}function saveUpdates(_0x1eeb09,_0x39fb07){return function(_0x25760c){if(_0x25760c){return _0x25760c['update'](_0x1eeb09)[_0x5ea4('0x26')](function(_0x21bd00){return _0x21bd00;});}return null;};}function removeEntity(_0x5232da,_0x2b2fdb){return function(_0x67eb71){if(_0x67eb71){return _0x67eb71[_0x5ea4('0x27')]()['then'](function(){_0x5232da['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x354f0a,_0x23aeb9){return function(_0xb638c9){if(!_0xb638c9){_0x354f0a[_0x5ea4('0x28')](0x194);}return _0xb638c9;};}function handleError(_0x4e68c7,_0x374135){_0x374135=_0x374135||0x1f4;return function(_0x35c618){logger[_0x5ea4('0x29')](_0x35c618[_0x5ea4('0x2a')]);if(_0x35c618['name']){delete _0x35c618[_0x5ea4('0x2b')];}_0x4e68c7[_0x5ea4('0x1a')](_0x374135)[_0x5ea4('0x2c')](_0x35c618);};}exports[_0x5ea4('0x2d')]=function(_0x40079e,_0x223ad3){var _0x461275={},_0x49a94d={},_0x360ae2={'count':0x0,'rows':[]};var _0x29f23f=_['map'](db[_0x5ea4('0x2e')][_0x5ea4('0x2f')],function(_0x31ed2b){return{'name':_0x31ed2b['fieldName'],'type':_0x31ed2b['type'][_0x5ea4('0x30')]};});_0x49a94d['model']=_[_0x5ea4('0x31')](_0x29f23f,_0x5ea4('0x2b'));_0x49a94d[_0x5ea4('0x32')]=_['keys'](_0x40079e[_0x5ea4('0x32')]);_0x49a94d[_0x5ea4('0x33')]=_['intersection'](_0x49a94d[_0x5ea4('0x34')],_0x49a94d[_0x5ea4('0x32')]);_0x461275[_0x5ea4('0x35')]=_[_0x5ea4('0x36')](_0x49a94d['model'],qs[_0x5ea4('0x37')](_0x40079e[_0x5ea4('0x32')][_0x5ea4('0x37')]));_0x461275[_0x5ea4('0x35')]=_0x461275[_0x5ea4('0x35')]['length']?_0x461275[_0x5ea4('0x35')]:_0x49a94d['model'];if(!_0x40079e[_0x5ea4('0x32')]['hasOwnProperty'](_0x5ea4('0x38'))){_0x461275[_0x5ea4('0x20')]=qs['limit'](_0x40079e[_0x5ea4('0x32')][_0x5ea4('0x20')]);_0x461275[_0x5ea4('0x1f')]=qs[_0x5ea4('0x1f')](_0x40079e[_0x5ea4('0x32')][_0x5ea4('0x1f')]);}_0x461275['order']=qs[_0x5ea4('0x39')](_0x40079e['query']['sort']);_0x461275['where']=qs[_0x5ea4('0x33')](_[_0x5ea4('0x3a')](_0x40079e['query'],_0x49a94d['filters']),_0x29f23f);if(_0x40079e[_0x5ea4('0x32')][_0x5ea4('0x3b')]){_0x461275[_0x5ea4('0x3c')]=_['merge'](_0x461275[_0x5ea4('0x3c')],{'$or':_[_0x5ea4('0x31')](_0x29f23f,function(_0x268e2d){if(_0x268e2d[_0x5ea4('0x3d')]!=='VIRTUAL'){var _0x26ecf4={};_0x26ecf4[_0x268e2d[_0x5ea4('0x2b')]]={'$like':'%'+_0x40079e[_0x5ea4('0x32')]['filter']+'%'};return _0x26ecf4;}})});}_0x461275=_[_0x5ea4('0x3e')]({},_0x461275,_0x40079e['options']);var _0x428f13={'where':_0x461275[_0x5ea4('0x3c')]};return db[_0x5ea4('0x2e')][_0x5ea4('0x1e')](_0x428f13)[_0x5ea4('0x26')](function(_0x59dd64){_0x360ae2[_0x5ea4('0x1e')]=_0x59dd64;if(_0x40079e[_0x5ea4('0x32')][_0x5ea4('0x3f')]){_0x461275['include']=[{'all':!![]}];}return db[_0x5ea4('0x2e')][_0x5ea4('0x40')](_0x461275);})['then'](function(_0x2435ef){_0x360ae2[_0x5ea4('0x41')]=_0x2435ef;return _0x360ae2;})[_0x5ea4('0x26')](respondWithFilteredResult(_0x223ad3,_0x461275))[_0x5ea4('0x42')](handleError(_0x223ad3,null));};exports[_0x5ea4('0x43')]=function(_0x4e0075,_0x29bc6e){var _0x33a60e={'raw':!![],'where':{'id':_0x4e0075['params']['id']}},_0x483718={};_0x483718[_0x5ea4('0x34')]=_[_0x5ea4('0x44')](db[_0x5ea4('0x2e')][_0x5ea4('0x2f')]);_0x483718[_0x5ea4('0x32')]=_[_0x5ea4('0x44')](_0x4e0075['query']);_0x483718[_0x5ea4('0x33')]=_[_0x5ea4('0x36')](_0x483718[_0x5ea4('0x34')],_0x483718[_0x5ea4('0x32')]);_0x33a60e['attributes']=_['intersection'](_0x483718[_0x5ea4('0x34')],qs[_0x5ea4('0x37')](_0x4e0075[_0x5ea4('0x32')][_0x5ea4('0x37')]));_0x33a60e['attributes']=_0x33a60e[_0x5ea4('0x35')][_0x5ea4('0x45')]?_0x33a60e[_0x5ea4('0x35')]:_0x483718['model'];if(_0x4e0075[_0x5ea4('0x32')][_0x5ea4('0x3f')]){_0x33a60e[_0x5ea4('0x46')]=[{'all':!![]}];}_0x33a60e=_[_0x5ea4('0x3e')]({},_0x33a60e,_0x4e0075[_0x5ea4('0x47')]);return db[_0x5ea4('0x2e')]['find'](_0x33a60e)[_0x5ea4('0x26')](handleEntityNotFound(_0x29bc6e,null))[_0x5ea4('0x26')](respondWithResult(_0x29bc6e,null))[_0x5ea4('0x42')](handleError(_0x29bc6e,null));};exports[_0x5ea4('0x48')]=function(_0x1af6fc,_0x3f9150){return db[_0x5ea4('0x2e')][_0x5ea4('0x48')](_0x1af6fc['body'],{})[_0x5ea4('0x26')](respondWithResult(_0x3f9150,0xc9))[_0x5ea4('0x42')](handleError(_0x3f9150,null));};exports[_0x5ea4('0x49')]=function(_0x718607,_0x9da73a){if(_0x718607[_0x5ea4('0x4a')]['id']){delete _0x718607['body']['id'];}return db[_0x5ea4('0x2e')][_0x5ea4('0x4b')]({'where':{'id':_0x718607[_0x5ea4('0x4c')]['id']}})[_0x5ea4('0x26')](handleEntityNotFound(_0x9da73a,null))[_0x5ea4('0x26')](saveUpdates(_0x718607[_0x5ea4('0x4a')],null))[_0x5ea4('0x26')](respondWithResult(_0x9da73a,null))[_0x5ea4('0x42')](handleError(_0x9da73a,null));};exports['destroy']=function(_0x597ebd,_0x34d6c9){return db[_0x5ea4('0x2e')][_0x5ea4('0x4b')]({'where':{'id':_0x597ebd[_0x5ea4('0x4c')]['id']}})['then'](handleEntityNotFound(_0x34d6c9,null))['then'](removeEntity(_0x34d6c9,null))['catch'](handleError(_0x34d6c9,null));};exports['describe']=function(_0x2490f1,_0x374253){return db['OpenchannelTransferReport'][_0x5ea4('0x4d')]()[_0x5ea4('0x26')](respondWithResult(_0x374253,null))['catch'](handleError(_0x374253,null));}; \ No newline at end of file +var _0xf829=['stack','name','index','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','show','params','include','find','catch','create','body','update','describe','eml-format','rimraf','fast-json-patch','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xf829,0x14f));var _0x9f82=function(_0x3776b4,_0x19a1e3){_0x3776b4=_0x3776b4-0x0;var _0x1636d9=_0xf829[_0x3776b4];return _0x1636d9;};'use strict';var emlformat=require(_0x9f82('0x0'));var rimraf=require(_0x9f82('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f82('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9f82('0x3'));var util=require(_0x9f82('0x4'));var path=require(_0x9f82('0x5'));var sox=require('sox');var csv=require(_0x9f82('0x6'));var ejs=require(_0x9f82('0x7'));var fs=require('fs');var fs_extra=require(_0x9f82('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9f82('0x9'));var jsforce=require(_0x9f82('0xa'));var deskjs=require(_0x9f82('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9f82('0xc'));var Papa=require(_0x9f82('0xd'));var Redis=require(_0x9f82('0xe'));var authService=require(_0x9f82('0xf'));var qs=require(_0x9f82('0x10'));var as=require(_0x9f82('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f82('0x12'))(_0x9f82('0x13'));var utils=require(_0x9f82('0x14'));var config=require(_0x9f82('0x15'));var licenseUtil=require(_0x9f82('0x16'));var db=require(_0x9f82('0x17'))['db'];function respondWithStatusCode(_0x1f1806,_0x297be9){_0x297be9=_0x297be9||0xcc;return function(_0xed5961){if(_0xed5961){return _0x1f1806[_0x9f82('0x18')](_0x297be9);}return _0x1f1806[_0x9f82('0x19')](_0x297be9)[_0x9f82('0x1a')]();};}function respondWithResult(_0x3349b8,_0x10fa75){_0x10fa75=_0x10fa75||0xc8;return function(_0x38c0e1){if(_0x38c0e1){return _0x3349b8['status'](_0x10fa75)[_0x9f82('0x1b')](_0x38c0e1);}};}function respondWithFilteredResult(_0x1b23bb,_0x53be35){return function(_0x1fcd0b){if(_0x1fcd0b){var _0x3f0fb1=typeof _0x53be35[_0x9f82('0x1c')]===_0x9f82('0x1d')&&typeof _0x53be35[_0x9f82('0x1e')]===_0x9f82('0x1d');var _0x5a6487=_0x1fcd0b[_0x9f82('0x1f')];var _0x47e6d2=_0x3f0fb1?0x0:_0x53be35[_0x9f82('0x1c')];var _0x3178e5=_0x3f0fb1?_0x1fcd0b[_0x9f82('0x1f')]:_0x53be35['offset']+_0x53be35[_0x9f82('0x1e')];var _0x43ca1c;if(_0x3178e5>=_0x5a6487){_0x3178e5=_0x5a6487;_0x43ca1c=0xc8;}else{_0x43ca1c=0xce;}_0x1b23bb[_0x9f82('0x19')](_0x43ca1c);return _0x1b23bb[_0x9f82('0x20')](_0x9f82('0x21'),_0x47e6d2+'-'+_0x3178e5+'/'+_0x5a6487)[_0x9f82('0x1b')](_0x1fcd0b);}return null;};}function patchUpdates(_0x2ac49f){return function(_0x149b5a){try{jsonpatch[_0x9f82('0x22')](_0x149b5a,_0x2ac49f,!![]);}catch(_0x86fb13){return BPromise[_0x9f82('0x23')](_0x86fb13);}return _0x149b5a[_0x9f82('0x24')]();};}function saveUpdates(_0x569419,_0x4873fe){return function(_0x3d0fe9){if(_0x3d0fe9){return _0x3d0fe9['update'](_0x569419)['then'](function(_0xb90b88){return _0xb90b88;});}return null;};}function removeEntity(_0x4614df,_0x10d258){return function(_0x5338ac){if(_0x5338ac){return _0x5338ac[_0x9f82('0x25')]()[_0x9f82('0x26')](function(){_0x4614df[_0x9f82('0x19')](0xcc)[_0x9f82('0x1a')]();});}};}function handleEntityNotFound(_0x57d8a4,_0x4d1dbb){return function(_0xd35b57){if(!_0xd35b57){_0x57d8a4['sendStatus'](0x194);}return _0xd35b57;};}function handleError(_0xa95afa,_0x575204){_0x575204=_0x575204||0x1f4;return function(_0x505c74){logger[_0x9f82('0x27')](_0x505c74[_0x9f82('0x28')]);if(_0x505c74[_0x9f82('0x29')]){delete _0x505c74['name'];}_0xa95afa[_0x9f82('0x19')](_0x575204)['send'](_0x505c74);};}exports[_0x9f82('0x2a')]=function(_0x401df4,_0x4100c3){var _0x3f9d19={},_0x357aa0={},_0x49f62a={'count':0x0,'rows':[]};var _0x123839=_['map'](db[_0x9f82('0x2b')][_0x9f82('0x2c')],function(_0x3efb37){return{'name':_0x3efb37[_0x9f82('0x2d')],'type':_0x3efb37[_0x9f82('0x2e')][_0x9f82('0x2f')]};});_0x357aa0[_0x9f82('0x30')]=_['map'](_0x123839,_0x9f82('0x29'));_0x357aa0['query']=_[_0x9f82('0x31')](_0x401df4[_0x9f82('0x32')]);_0x357aa0[_0x9f82('0x33')]=_[_0x9f82('0x34')](_0x357aa0[_0x9f82('0x30')],_0x357aa0[_0x9f82('0x32')]);_0x3f9d19[_0x9f82('0x35')]=_[_0x9f82('0x34')](_0x357aa0[_0x9f82('0x30')],qs[_0x9f82('0x36')](_0x401df4[_0x9f82('0x32')]['fields']));_0x3f9d19[_0x9f82('0x35')]=_0x3f9d19[_0x9f82('0x35')][_0x9f82('0x37')]?_0x3f9d19['attributes']:_0x357aa0[_0x9f82('0x30')];if(!_0x401df4[_0x9f82('0x32')][_0x9f82('0x38')]('nolimit')){_0x3f9d19[_0x9f82('0x1e')]=qs[_0x9f82('0x1e')](_0x401df4[_0x9f82('0x32')]['limit']);_0x3f9d19['offset']=qs[_0x9f82('0x1c')](_0x401df4[_0x9f82('0x32')][_0x9f82('0x1c')]);}_0x3f9d19[_0x9f82('0x39')]=qs[_0x9f82('0x3a')](_0x401df4['query'][_0x9f82('0x3a')]);_0x3f9d19[_0x9f82('0x3b')]=qs[_0x9f82('0x33')](_['pick'](_0x401df4[_0x9f82('0x32')],_0x357aa0[_0x9f82('0x33')]),_0x123839);if(_0x401df4[_0x9f82('0x32')][_0x9f82('0x3c')]){_0x3f9d19[_0x9f82('0x3b')]=_[_0x9f82('0x3d')](_0x3f9d19[_0x9f82('0x3b')],{'$or':_[_0x9f82('0x3e')](_0x123839,function(_0x57e4f5){if(_0x57e4f5['type']!==_0x9f82('0x3f')){var _0x179260={};_0x179260[_0x57e4f5['name']]={'$like':'%'+_0x401df4[_0x9f82('0x32')][_0x9f82('0x3c')]+'%'};return _0x179260;}})});}_0x3f9d19=_[_0x9f82('0x3d')]({},_0x3f9d19,_0x401df4[_0x9f82('0x40')]);var _0x1c2d43={'where':_0x3f9d19[_0x9f82('0x3b')]};return db[_0x9f82('0x2b')][_0x9f82('0x1f')](_0x1c2d43)[_0x9f82('0x26')](function(_0xd746fe){_0x49f62a[_0x9f82('0x1f')]=_0xd746fe;if(_0x401df4[_0x9f82('0x32')][_0x9f82('0x41')]){_0x3f9d19['include']=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x3f9d19);})[_0x9f82('0x26')](function(_0x19d742){_0x49f62a['rows']=_0x19d742;return _0x49f62a;})[_0x9f82('0x26')](respondWithFilteredResult(_0x4100c3,_0x3f9d19))['catch'](handleError(_0x4100c3,null));};exports[_0x9f82('0x42')]=function(_0x670d5f,_0x315629){var _0x584fc8={'raw':!![],'where':{'id':_0x670d5f[_0x9f82('0x43')]['id']}},_0x4b0b8c={};_0x4b0b8c['model']=_[_0x9f82('0x31')](db[_0x9f82('0x2b')][_0x9f82('0x2c')]);_0x4b0b8c[_0x9f82('0x32')]=_[_0x9f82('0x31')](_0x670d5f['query']);_0x4b0b8c['filters']=_[_0x9f82('0x34')](_0x4b0b8c[_0x9f82('0x30')],_0x4b0b8c['query']);_0x584fc8[_0x9f82('0x35')]=_[_0x9f82('0x34')](_0x4b0b8c[_0x9f82('0x30')],qs[_0x9f82('0x36')](_0x670d5f[_0x9f82('0x32')][_0x9f82('0x36')]));_0x584fc8[_0x9f82('0x35')]=_0x584fc8[_0x9f82('0x35')][_0x9f82('0x37')]?_0x584fc8['attributes']:_0x4b0b8c[_0x9f82('0x30')];if(_0x670d5f[_0x9f82('0x32')]['includeAll']){_0x584fc8[_0x9f82('0x44')]=[{'all':!![]}];}_0x584fc8=_[_0x9f82('0x3d')]({},_0x584fc8,_0x670d5f[_0x9f82('0x40')]);return db[_0x9f82('0x2b')][_0x9f82('0x45')](_0x584fc8)['then'](handleEntityNotFound(_0x315629,null))[_0x9f82('0x26')](respondWithResult(_0x315629,null))[_0x9f82('0x46')](handleError(_0x315629,null));};exports[_0x9f82('0x47')]=function(_0x456b40,_0x21ee84){return db[_0x9f82('0x2b')][_0x9f82('0x47')](_0x456b40[_0x9f82('0x48')],{})[_0x9f82('0x26')](respondWithResult(_0x21ee84,0xc9))[_0x9f82('0x46')](handleError(_0x21ee84,null));};exports[_0x9f82('0x49')]=function(_0x465a54,_0x44ab3c){if(_0x465a54['body']['id']){delete _0x465a54[_0x9f82('0x48')]['id'];}return db[_0x9f82('0x2b')][_0x9f82('0x45')]({'where':{'id':_0x465a54[_0x9f82('0x43')]['id']}})[_0x9f82('0x26')](handleEntityNotFound(_0x44ab3c,null))[_0x9f82('0x26')](saveUpdates(_0x465a54[_0x9f82('0x48')],null))[_0x9f82('0x26')](respondWithResult(_0x44ab3c,null))[_0x9f82('0x46')](handleError(_0x44ab3c,null));};exports[_0x9f82('0x25')]=function(_0xd2feb6,_0x5d3428){return db[_0x9f82('0x2b')][_0x9f82('0x45')]({'where':{'id':_0xd2feb6[_0x9f82('0x43')]['id']}})[_0x9f82('0x26')](handleEntityNotFound(_0x5d3428,null))[_0x9f82('0x26')](removeEntity(_0x5d3428,null))[_0x9f82('0x46')](handleError(_0x5d3428,null));};exports['describe']=function(_0x5ca2b2,_0x384a58){return db[_0x9f82('0x2b')][_0x9f82('0x4a')]()[_0x9f82('0x26')](respondWithResult(_0x384a58,null))[_0x9f82('0x46')](handleError(_0x384a58,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 909ba97..1aace88 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 _0xd24d=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define'];(function(_0x14188a,_0x64944a){var _0x55eccb=function(_0x278ed7){while(--_0x278ed7){_0x14188a['push'](_0x14188a['shift']());}};_0x55eccb(++_0x64944a);}(_0xd24d,0x198));var _0xdd24=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd24d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xdd24('0x0'));var util=require(_0xdd24('0x1'));var logger=require(_0xdd24('0x2'))(_0xdd24('0x3'));var moment=require('moment');var BPromise=require(_0xdd24('0x4'));var rp=require(_0xdd24('0x5'));var fs=require('fs');var path=require(_0xdd24('0x6'));var rimraf=require(_0xdd24('0x7'));var config=require(_0xdd24('0x8'));var attributes=require(_0xdd24('0x9'));module[_0xdd24('0xa')]=function(_0x5ae0a9,_0x480664){return _0x5ae0a9[_0xdd24('0xb')](_0xdd24('0xc'),attributes,{'tableName':_0xdd24('0xd'),'paranoid':![],'indexes':[{'name':_0xdd24('0xe'),'fields':[_0xdd24('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x71b3=['request-promise','path','rimraf','./openchannelTransferReport.attributes','exports','define','uniqueid','lodash','api','moment','bluebird'];(function(_0x149c7f,_0x47ea83){var _0x408125=function(_0x23355f){while(--_0x23355f){_0x149c7f['push'](_0x149c7f['shift']());}};_0x408125(++_0x47ea83);}(_0x71b3,0x13b));var _0x371b=function(_0xd606cf,_0x26083a){_0xd606cf=_0xd606cf-0x0;var _0x2445d8=_0x71b3[_0xd606cf];return _0x2445d8;};'use strict';var _=require(_0x371b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x371b('0x1'));var moment=require(_0x371b('0x2'));var BPromise=require(_0x371b('0x3'));var rp=require(_0x371b('0x4'));var fs=require('fs');var path=require(_0x371b('0x5'));var rimraf=require(_0x371b('0x6'));var config=require('../../config/environment');var attributes=require(_0x371b('0x7'));module[_0x371b('0x8')]=function(_0x51fde2,_0x4c3870){return _0x51fde2[_0x371b('0x9')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x371b('0xa'),'fields':[_0x371b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 47297b1..4f70742 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 _0x8ce1=['http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2c2d60,_0x1f7ee9){var _0x3eee5d=function(_0x500842){while(--_0x500842){_0x2c2d60['push'](_0x2c2d60['shift']());}};_0x3eee5d(++_0x1f7ee9);}(_0x8ce1,0x183));var _0x18ce=function(_0x5200bc,_0x4c6a7f){_0x5200bc=_0x5200bc-0x0;var _0x407b67=_0x8ce1[_0x5200bc];return _0x407b67;};'use strict';var _=require(_0x18ce('0x0'));var util=require(_0x18ce('0x1'));var moment=require(_0x18ce('0x2'));var BPromise=require(_0x18ce('0x3'));var rs=require(_0x18ce('0x4'));var fs=require('fs');var Redis=require(_0x18ce('0x5'));var db=require(_0x18ce('0x6'))['db'];var utils=require(_0x18ce('0x7'));var logger=require(_0x18ce('0x8'))(_0x18ce('0x9'));var config=require(_0x18ce('0xa'));var jayson=require(_0x18ce('0xb'));var client=jayson[_0x18ce('0xc')][_0x18ce('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x682d4b,_0x359094,_0x4ebf82){return new BPromise(function(_0x1a60c5,_0x197a64){return client[_0x18ce('0xe')](_0x682d4b,_0x4ebf82)[_0x18ce('0xf')](function(_0x4db2af){logger[_0x18ce('0x10')](_0x18ce('0x11'),_0x359094,_0x18ce('0x12'));logger[_0x18ce('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x359094,'request\x20sent',JSON[_0x18ce('0x14')](_0x4db2af));if(_0x4db2af[_0x18ce('0x15')]){if(_0x4db2af[_0x18ce('0x15')][_0x18ce('0x16')]===0x1f4){logger[_0x18ce('0x15')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x359094,_0x4db2af[_0x18ce('0x15')][_0x18ce('0x17')]);return _0x197a64(_0x4db2af[_0x18ce('0x15')][_0x18ce('0x17')]);}logger[_0x18ce('0x15')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x359094,_0x4db2af[_0x18ce('0x15')][_0x18ce('0x17')]);return _0x1a60c5(_0x4db2af[_0x18ce('0x15')][_0x18ce('0x17')]);}else{logger[_0x18ce('0x10')](_0x18ce('0x11'),_0x359094,_0x18ce('0x12'));_0x1a60c5(_0x4db2af['result'][_0x18ce('0x17')]);}})[_0x18ce('0x18')](function(_0x204d1a){logger[_0x18ce('0x15')](_0x18ce('0x11'),_0x359094,_0x204d1a);_0x197a64(_0x204d1a);});});} \ No newline at end of file +var _0x3148=['then','info','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x46974b,_0x23a4dd){var _0x50fd7a=function(_0x5862ea){while(--_0x5862ea){_0x46974b['push'](_0x46974b['shift']());}};_0x50fd7a(++_0x23a4dd);}(_0x3148,0x1d3));var _0x8314=function(_0x206192,_0x111bb2){_0x206192=_0x206192-0x0;var _0x27e778=_0x3148[_0x206192];return _0x27e778;};'use strict';var _=require(_0x8314('0x0'));var util=require(_0x8314('0x1'));var moment=require('moment');var BPromise=require(_0x8314('0x2'));var rs=require(_0x8314('0x3'));var fs=require('fs');var Redis=require(_0x8314('0x4'));var db=require(_0x8314('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8314('0x6'))(_0x8314('0x7'));var config=require(_0x8314('0x8'));var jayson=require(_0x8314('0x9'));var client=jayson[_0x8314('0xa')][_0x8314('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bd913,_0x4dd36d,_0x837c1f){return new BPromise(function(_0x4df2b0,_0x35b464){return client[_0x8314('0xc')](_0x1bd913,_0x837c1f)[_0x8314('0xd')](function(_0x357031){logger[_0x8314('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4dd36d,'request\x20sent');logger[_0x8314('0xf')](_0x8314('0x10'),_0x4dd36d,_0x8314('0x11'),JSON[_0x8314('0x12')](_0x357031));if(_0x357031['error']){if(_0x357031[_0x8314('0x13')][_0x8314('0x14')]===0x1f4){logger['error'](_0x8314('0x15'),_0x4dd36d,_0x357031['error']['message']);return _0x35b464(_0x357031[_0x8314('0x13')][_0x8314('0x16')]);}logger[_0x8314('0x13')](_0x8314('0x15'),_0x4dd36d,_0x357031['error'][_0x8314('0x16')]);return _0x4df2b0(_0x357031[_0x8314('0x13')][_0x8314('0x16')]);}else{logger[_0x8314('0xe')](_0x8314('0x15'),_0x4dd36d,_0x8314('0x11'));_0x4df2b0(_0x357031['result']['message']);}})[_0x8314('0x17')](function(_0xf0ad31){logger[_0x8314('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4dd36d,_0xf0ad31);_0x35b464(_0xf0ad31);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index dbcf5ec..e2fc9dd 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 _0xf8fe=['get','isAuthenticated','index','/:id','show','post','update','delete','exports','util','Router','fs-extra','../../components/auth/service','../../config/environment','./pause.controller'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xf8fe,0xea));var _0xef8f=function(_0x19cc16,_0xdbc31){_0x19cc16=_0x19cc16-0x0;var _0x5c91bc=_0xf8fe[_0x19cc16];return _0x5c91bc;};'use strict';var multer=require('multer');var util=require(_0xef8f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xef8f('0x1')]();var fs_extra=require(_0xef8f('0x2'));var auth=require(_0xef8f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xef8f('0x4'));var controller=require(_0xef8f('0x5'));router[_0xef8f('0x6')]('/',auth[_0xef8f('0x7')](),controller[_0xef8f('0x8')]);router['get'](_0xef8f('0x9'),auth['isAuthenticated'](),controller[_0xef8f('0xa')]);router[_0xef8f('0xb')]('/',auth[_0xef8f('0x7')](),controller['create']);router['put'](_0xef8f('0x9'),auth[_0xef8f('0x7')](),controller[_0xef8f('0xc')]);router[_0xef8f('0xd')](_0xef8f('0x9'),auth[_0xef8f('0x7')](),controller['destroy']);module[_0xef8f('0xe')]=router; \ No newline at end of file +var _0xa053=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util'];(function(_0x115dba,_0x41bdf8){var _0x4e32a4=function(_0xa13a32){while(--_0xa13a32){_0x115dba['push'](_0x115dba['shift']());}};_0x4e32a4(++_0x41bdf8);}(_0xa053,0xee));var _0x3a05=function(_0x5b25cd,_0xcb4a6d){_0x5b25cd=_0x5b25cd-0x0;var _0x572478=_0xa053[_0x5b25cd];return _0x572478;};'use strict';var multer=require(_0x3a05('0x0'));var util=require(_0x3a05('0x1'));var path=require('path');var timeout=require(_0x3a05('0x2'));var express=require(_0x3a05('0x3'));var router=express[_0x3a05('0x4')]();var fs_extra=require(_0x3a05('0x5'));var auth=require(_0x3a05('0x6'));var interaction=require(_0x3a05('0x7'));var config=require(_0x3a05('0x8'));var controller=require(_0x3a05('0x9'));router[_0x3a05('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3a05('0xb'),auth[_0x3a05('0xc')](),controller[_0x3a05('0xd')]);router[_0x3a05('0xe')]('/',auth[_0x3a05('0xc')](),controller[_0x3a05('0xf')]);router['put'](_0x3a05('0xb'),auth['isAuthenticated'](),controller[_0x3a05('0x10')]);router[_0x3a05('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3a05('0x12')]);module[_0x3a05('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 70e5efd..4658b37 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 _0xd095=['STRING','sequelize','name'];(function(_0x5ad190,_0xd39c9e){var _0x518ed3=function(_0x57f03a){while(--_0x57f03a){_0x5ad190['push'](_0x5ad190['shift']());}};_0x518ed3(++_0xd39c9e);}(_0xd095,0xe8));var _0x5d09=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xd095[_0x5a776b];return _0xbbef59;};'use strict';var Sequelize=require(_0x5d09('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5d09('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x5d09('0x2')]}}; \ No newline at end of file +var _0x0b2f=['exports','STRING','name'];(function(_0x3b1702,_0x2cdf95){var _0x1cebd5=function(_0x49718d){while(--_0x49718d){_0x3b1702['push'](_0x3b1702['shift']());}};_0x1cebd5(++_0x2cdf95);}(_0x0b2f,0x1e3));var _0xf0b2=function(_0x4c885c,_0x3f3696){_0x4c885c=_0x4c885c-0x0;var _0x1797cd=_0x0b2f[_0x4c885c];return _0x1797cd;};'use strict';var Sequelize=require('sequelize');module[_0xf0b2('0x0')]={'name':{'type':Sequelize[_0xf0b2('0x1')],'unique':_0xf0b2('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xf0b2('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index ca4e831..6f8df19 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 _0x0438=['merge','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','Pauses','UserProfileResource','sendStatus','error','stack','name','Pause','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0438,0x1a6));var _0x8043=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x0438[_0x5627e1];return _0x2f013f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8043('0x0'));var jsonpatch=require(_0x8043('0x1'));var rp=require(_0x8043('0x2'));var moment=require(_0x8043('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8043('0x4'));var util=require(_0x8043('0x5'));var path=require(_0x8043('0x6'));var sox=require(_0x8043('0x7'));var csv=require('to-csv');var ejs=require(_0x8043('0x8'));var fs=require('fs');var fs_extra=require(_0x8043('0x9'));var _=require(_0x8043('0xa'));var squel=require('squel');var crypto=require(_0x8043('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8043('0xc'));var toCsv=require(_0x8043('0xd'));var querystring=require(_0x8043('0xe'));var Papa=require(_0x8043('0xf'));var Redis=require(_0x8043('0x10'));var authService=require(_0x8043('0x11'));var qs=require(_0x8043('0x12'));var as=require(_0x8043('0x13'));var hardwareService=require(_0x8043('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x8043('0x15'));var config=require(_0x8043('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8043('0x17'))['db'];function respondWithStatusCode(_0x4937b8,_0x3138d3){_0x3138d3=_0x3138d3||0xcc;return function(_0x50476e){if(_0x50476e){return _0x4937b8['sendStatus'](_0x3138d3);}return _0x4937b8[_0x8043('0x18')](_0x3138d3)[_0x8043('0x19')]();};}function respondWithResult(_0x592efc,_0x40e35c){_0x40e35c=_0x40e35c||0xc8;return function(_0x2d17d0){if(_0x2d17d0){return _0x592efc[_0x8043('0x18')](_0x40e35c)[_0x8043('0x1a')](_0x2d17d0);}};}function respondWithFilteredResult(_0x34ba19,_0x3cd840){return function(_0x3f8608){if(_0x3f8608){var _0x342e89=typeof _0x3cd840[_0x8043('0x1b')]===_0x8043('0x1c')&&typeof _0x3cd840[_0x8043('0x1d')]==='undefined';var _0x5875c6=_0x3f8608[_0x8043('0x1e')];var _0x31a520=_0x342e89?0x0:_0x3cd840['offset'];var _0x481e5a=_0x342e89?_0x3f8608['count']:_0x3cd840[_0x8043('0x1b')]+_0x3cd840[_0x8043('0x1d')];var _0x31d974;if(_0x481e5a>=_0x5875c6){_0x481e5a=_0x5875c6;_0x31d974=0xc8;}else{_0x31d974=0xce;}_0x34ba19[_0x8043('0x18')](_0x31d974);return _0x34ba19[_0x8043('0x1f')](_0x8043('0x20'),_0x31a520+'-'+_0x481e5a+'/'+_0x5875c6)[_0x8043('0x1a')](_0x3f8608);}return null;};}function patchUpdates(_0x3a878b){return function(_0x2899a3){try{jsonpatch[_0x8043('0x21')](_0x2899a3,_0x3a878b,!![]);}catch(_0x5687be){return BPromise[_0x8043('0x22')](_0x5687be);}return _0x2899a3['save']();};}function saveUpdates(_0x815270,_0x557dd3){return function(_0x6e7317){if(_0x6e7317){return _0x6e7317[_0x8043('0x23')](_0x815270)[_0x8043('0x24')](function(_0x3d26e6){return _0x3d26e6;});}return null;};}function removeEntity(_0x288e3e,_0xfe4f8){return function(_0x4cde38){if(_0x4cde38){return _0x4cde38[_0x8043('0x25')]()['then'](function(){var _0x4ad8df=_0x4cde38['get']({'plain':!![]});var _0x1caf81=_0x8043('0x26');return db[_0x8043('0x27')][_0x8043('0x25')]({'where':{'type':_0x1caf81,'resourceId':_0x4ad8df['id']}})['then'](function(){return _0x4cde38;});})['then'](function(){_0x288e3e[_0x8043('0x18')](0xcc)[_0x8043('0x19')]();});}};}function handleEntityNotFound(_0x16f682,_0x2aa3d5){return function(_0xd66061){if(!_0xd66061){_0x16f682[_0x8043('0x28')](0x194);}return _0xd66061;};}function handleError(_0x32ca38,_0x56ffcc){_0x56ffcc=_0x56ffcc||0x1f4;return function(_0x420fc2){logger[_0x8043('0x29')](_0x420fc2[_0x8043('0x2a')]);if(_0x420fc2[_0x8043('0x2b')]){delete _0x420fc2['name'];}_0x32ca38[_0x8043('0x18')](_0x56ffcc)['send'](_0x420fc2);};}exports['index']=function(_0x5558d2,_0x5ca3b1){var _0x176fc8={},_0x1dc480={},_0x19c114={'count':0x0,'rows':[]};var _0x2a333b=_['map'](db[_0x8043('0x2c')]['rawAttributes'],function(_0x27356a){return{'name':_0x27356a['fieldName'],'type':_0x27356a[_0x8043('0x2d')][_0x8043('0x2e')]};});_0x1dc480[_0x8043('0x2f')]=_['map'](_0x2a333b,_0x8043('0x2b'));_0x1dc480[_0x8043('0x30')]=_[_0x8043('0x31')](_0x5558d2[_0x8043('0x30')]);_0x1dc480['filters']=_[_0x8043('0x32')](_0x1dc480[_0x8043('0x2f')],_0x1dc480[_0x8043('0x30')]);_0x176fc8[_0x8043('0x33')]=_['intersection'](_0x1dc480[_0x8043('0x2f')],qs[_0x8043('0x34')](_0x5558d2[_0x8043('0x30')][_0x8043('0x34')]));_0x176fc8[_0x8043('0x33')]=_0x176fc8[_0x8043('0x33')]['length']?_0x176fc8['attributes']:_0x1dc480['model'];if(!_0x5558d2[_0x8043('0x30')]['hasOwnProperty'](_0x8043('0x35'))){_0x176fc8[_0x8043('0x1d')]=qs[_0x8043('0x1d')](_0x5558d2['query'][_0x8043('0x1d')]);_0x176fc8[_0x8043('0x1b')]=qs[_0x8043('0x1b')](_0x5558d2[_0x8043('0x30')][_0x8043('0x1b')]);}_0x176fc8[_0x8043('0x36')]=qs[_0x8043('0x37')](_0x5558d2[_0x8043('0x30')][_0x8043('0x37')]);_0x176fc8[_0x8043('0x38')]=qs[_0x8043('0x39')](_['pick'](_0x5558d2[_0x8043('0x30')],_0x1dc480[_0x8043('0x39')]),_0x2a333b);if(_0x5558d2['query']['filter']){_0x176fc8[_0x8043('0x38')]=_[_0x8043('0x3a')](_0x176fc8[_0x8043('0x38')],{'$or':_['map'](_0x2a333b,function(_0x2b498c){if(_0x2b498c[_0x8043('0x2d')]!=='VIRTUAL'){var _0x5a674f={};_0x5a674f[_0x2b498c[_0x8043('0x2b')]]={'$like':'%'+_0x5558d2[_0x8043('0x30')][_0x8043('0x3b')]+'%'};return _0x5a674f;}})});}_0x176fc8=_[_0x8043('0x3a')]({},_0x176fc8,_0x5558d2[_0x8043('0x3c')]);var _0x1d5a93={'where':_0x176fc8[_0x8043('0x38')]};return db['Pause'][_0x8043('0x1e')](_0x1d5a93)['then'](function(_0xd19da4){_0x19c114['count']=_0xd19da4;if(_0x5558d2['query'][_0x8043('0x3d')]){_0x176fc8[_0x8043('0x3e')]=[{'all':!![]}];}return db['Pause'][_0x8043('0x3f')](_0x176fc8);})[_0x8043('0x24')](function(_0x1c9ef0){_0x19c114[_0x8043('0x40')]=_0x1c9ef0;return _0x19c114;})[_0x8043('0x24')](respondWithFilteredResult(_0x5ca3b1,_0x176fc8))[_0x8043('0x41')](handleError(_0x5ca3b1,null));};exports[_0x8043('0x42')]=function(_0x1dab5b,_0x36083f){var _0x2cd3f6={'raw':!![],'where':{'id':_0x1dab5b['params']['id']}},_0x3e5e79={};_0x3e5e79['model']=_['keys'](db[_0x8043('0x2c')][_0x8043('0x43')]);_0x3e5e79[_0x8043('0x30')]=_['keys'](_0x1dab5b[_0x8043('0x30')]);_0x3e5e79[_0x8043('0x39')]=_[_0x8043('0x32')](_0x3e5e79[_0x8043('0x2f')],_0x3e5e79[_0x8043('0x30')]);_0x2cd3f6[_0x8043('0x33')]=_[_0x8043('0x32')](_0x3e5e79[_0x8043('0x2f')],qs['fields'](_0x1dab5b['query'][_0x8043('0x34')]));_0x2cd3f6[_0x8043('0x33')]=_0x2cd3f6['attributes']['length']?_0x2cd3f6[_0x8043('0x33')]:_0x3e5e79[_0x8043('0x2f')];if(_0x1dab5b[_0x8043('0x30')][_0x8043('0x3d')]){_0x2cd3f6[_0x8043('0x3e')]=[{'all':!![]}];}_0x2cd3f6=_[_0x8043('0x3a')]({},_0x2cd3f6,_0x1dab5b[_0x8043('0x3c')]);return db['Pause'][_0x8043('0x44')](_0x2cd3f6)[_0x8043('0x24')](handleEntityNotFound(_0x36083f,null))[_0x8043('0x24')](respondWithResult(_0x36083f,null))['catch'](handleError(_0x36083f,null));};exports[_0x8043('0x45')]=function(_0x416e97,_0x5b1e9f){return db[_0x8043('0x2c')][_0x8043('0x45')](_0x416e97['body'],{})[_0x8043('0x24')](function(_0xc97dae){var _0x53a611=_0x416e97[_0x8043('0x46')]['get']({'plain':!![]});if(!_0x53a611)throw new Error(_0x8043('0x47'));if(_0x53a611[_0x8043('0x48')]==='user'){var _0x5d09c1=_0xc97dae[_0x8043('0x49')]({'plain':!![]});var _0x3c22f4='Pauses';return db[_0x8043('0x4a')][_0x8043('0x44')]({'where':{'name':_0x3c22f4,'userProfileId':_0x53a611[_0x8043('0x4b')]},'raw':!![]})[_0x8043('0x24')](function(_0x434a75){if(_0x434a75&&_0x434a75[_0x8043('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x5d09c1[_0x8043('0x2b')],'resourceId':_0x5d09c1['id'],'type':_0x434a75[_0x8043('0x2b')],'sectionId':_0x434a75['id']},{})[_0x8043('0x24')](function(){return _0xc97dae;});}else{return _0xc97dae;}})['catch'](function(_0x106981){logger[_0x8043('0x29')](_0x8043('0x4d'),_0x106981);throw _0x106981;});}return _0xc97dae;})[_0x8043('0x24')](respondWithResult(_0x5b1e9f,0xc9))[_0x8043('0x41')](handleError(_0x5b1e9f,null));};exports[_0x8043('0x23')]=function(_0x3c3831,_0x22d8d4){if(_0x3c3831[_0x8043('0x4e')]['id']){delete _0x3c3831['body']['id'];}return db['Pause']['find']({'where':{'id':_0x3c3831[_0x8043('0x4f')]['id']}})[_0x8043('0x24')](handleEntityNotFound(_0x22d8d4,null))[_0x8043('0x24')](saveUpdates(_0x3c3831['body'],null))['then'](respondWithResult(_0x22d8d4,null))[_0x8043('0x41')](handleError(_0x22d8d4,null));};exports[_0x8043('0x25')]=function(_0x559bb2,_0x47e3a0){return db[_0x8043('0x2c')]['find']({'where':{'id':_0x559bb2[_0x8043('0x4f')]['id']}})[_0x8043('0x24')](handleEntityNotFound(_0x47e3a0,null))['then'](removeEntity(_0x47e3a0,null))[_0x8043('0x41')](handleError(_0x47e3a0,null));}; \ No newline at end of file +var _0x24ca=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','set','save','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','options','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format'];(function(_0x4f6fdc,_0x4c4e51){var _0x143c4f=function(_0x4cc08a){while(--_0x4cc08a){_0x4f6fdc['push'](_0x4f6fdc['shift']());}};_0x143c4f(++_0x4c4e51);}(_0x24ca,0x9d));var _0xa24c=function(_0x2c0ded,_0x3de22c){_0x2c0ded=_0x2c0ded-0x0;var _0x4473e5=_0x24ca[_0x2c0ded];return _0x4473e5;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require(_0xa24c('0x1'));var zipdir=require(_0xa24c('0x2'));var jsonpatch=require(_0xa24c('0x3'));var rp=require(_0xa24c('0x4'));var moment=require(_0xa24c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa24c('0x6'));var util=require(_0xa24c('0x7'));var path=require(_0xa24c('0x8'));var sox=require(_0xa24c('0x9'));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(_0xa24c('0xa'));var jsforce=require(_0xa24c('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa24c('0xc'));var Papa=require(_0xa24c('0xd'));var Redis=require(_0xa24c('0xe'));var authService=require(_0xa24c('0xf'));var qs=require(_0xa24c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa24c('0x11'));var logger=require(_0xa24c('0x12'))(_0xa24c('0x13'));var utils=require('../../config/utils');var config=require(_0xa24c('0x14'));var licenseUtil=require(_0xa24c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47fcd6,_0x53a9f6){_0x53a9f6=_0x53a9f6||0xcc;return function(_0x52f505){if(_0x52f505){return _0x47fcd6['sendStatus'](_0x53a9f6);}return _0x47fcd6[_0xa24c('0x16')](_0x53a9f6)[_0xa24c('0x17')]();};}function respondWithResult(_0x250e8d,_0x1bf237){_0x1bf237=_0x1bf237||0xc8;return function(_0x9b7757){if(_0x9b7757){return _0x250e8d[_0xa24c('0x16')](_0x1bf237)['json'](_0x9b7757);}};}function respondWithFilteredResult(_0x85b97d,_0x1fa127){return function(_0x1dea40){if(_0x1dea40){var _0x18b3a8=typeof _0x1fa127['offset']===_0xa24c('0x18')&&typeof _0x1fa127[_0xa24c('0x19')]==='undefined';var _0xf8ad17=_0x1dea40[_0xa24c('0x1a')];var _0x20f872=_0x18b3a8?0x0:_0x1fa127['offset'];var _0x4ffa6c=_0x18b3a8?_0x1dea40[_0xa24c('0x1a')]:_0x1fa127[_0xa24c('0x1b')]+_0x1fa127['limit'];var _0x1da7be;if(_0x4ffa6c>=_0xf8ad17){_0x4ffa6c=_0xf8ad17;_0x1da7be=0xc8;}else{_0x1da7be=0xce;}_0x85b97d['status'](_0x1da7be);return _0x85b97d[_0xa24c('0x1c')]('Content-Range',_0x20f872+'-'+_0x4ffa6c+'/'+_0xf8ad17)['json'](_0x1dea40);}return null;};}function patchUpdates(_0x500f39){return function(_0x5ab118){try{jsonpatch['apply'](_0x5ab118,_0x500f39,!![]);}catch(_0x5448b6){return BPromise['reject'](_0x5448b6);}return _0x5ab118[_0xa24c('0x1d')]();};}function saveUpdates(_0xd23393,_0x1c971e){return function(_0x4b94f3){if(_0x4b94f3){return _0x4b94f3['update'](_0xd23393)[_0xa24c('0x1e')](function(_0x22a6fe){return _0x22a6fe;});}return null;};}function removeEntity(_0x19ee42,_0x80166e){return function(_0x23853a){if(_0x23853a){return _0x23853a[_0xa24c('0x1f')]()[_0xa24c('0x1e')](function(){var _0x2eac9d=_0x23853a[_0xa24c('0x20')]({'plain':!![]});var _0x27f0ae=_0xa24c('0x21');return db[_0xa24c('0x22')][_0xa24c('0x1f')]({'where':{'type':_0x27f0ae,'resourceId':_0x2eac9d['id']}})['then'](function(){return _0x23853a;});})[_0xa24c('0x1e')](function(){_0x19ee42[_0xa24c('0x16')](0xcc)[_0xa24c('0x17')]();});}};}function handleEntityNotFound(_0x3c242b,_0x559857){return function(_0x595654){if(!_0x595654){_0x3c242b['sendStatus'](0x194);}return _0x595654;};}function handleError(_0x4bd73f,_0x1ff154){_0x1ff154=_0x1ff154||0x1f4;return function(_0x3d0849){logger[_0xa24c('0x23')](_0x3d0849[_0xa24c('0x24')]);if(_0x3d0849[_0xa24c('0x25')]){delete _0x3d0849[_0xa24c('0x25')];}_0x4bd73f[_0xa24c('0x16')](_0x1ff154)[_0xa24c('0x26')](_0x3d0849);};}exports[_0xa24c('0x27')]=function(_0x41fcdb,_0x1cd7f8){var _0x322909={},_0x51d047={},_0x58853c={'count':0x0,'rows':[]};var _0xb22768=_[_0xa24c('0x28')](db[_0xa24c('0x29')]['rawAttributes'],function(_0x3764c9){return{'name':_0x3764c9[_0xa24c('0x2a')],'type':_0x3764c9[_0xa24c('0x2b')][_0xa24c('0x2c')]};});_0x51d047['model']=_[_0xa24c('0x28')](_0xb22768,_0xa24c('0x25'));_0x51d047['query']=_['keys'](_0x41fcdb['query']);_0x51d047['filters']=_['intersection'](_0x51d047[_0xa24c('0x2d')],_0x51d047[_0xa24c('0x2e')]);_0x322909[_0xa24c('0x2f')]=_[_0xa24c('0x30')](_0x51d047[_0xa24c('0x2d')],qs[_0xa24c('0x31')](_0x41fcdb[_0xa24c('0x2e')]['fields']));_0x322909[_0xa24c('0x2f')]=_0x322909[_0xa24c('0x2f')][_0xa24c('0x32')]?_0x322909[_0xa24c('0x2f')]:_0x51d047['model'];if(!_0x41fcdb[_0xa24c('0x2e')][_0xa24c('0x33')](_0xa24c('0x34'))){_0x322909['limit']=qs['limit'](_0x41fcdb['query']['limit']);_0x322909[_0xa24c('0x1b')]=qs[_0xa24c('0x1b')](_0x41fcdb[_0xa24c('0x2e')][_0xa24c('0x1b')]);}_0x322909[_0xa24c('0x35')]=qs['sort'](_0x41fcdb[_0xa24c('0x2e')]['sort']);_0x322909[_0xa24c('0x36')]=qs[_0xa24c('0x37')](_['pick'](_0x41fcdb[_0xa24c('0x2e')],_0x51d047[_0xa24c('0x37')]),_0xb22768);if(_0x41fcdb[_0xa24c('0x2e')]['filter']){_0x322909['where']=_[_0xa24c('0x38')](_0x322909[_0xa24c('0x36')],{'$or':_[_0xa24c('0x28')](_0xb22768,function(_0x4faf37){if(_0x4faf37['type']!==_0xa24c('0x39')){var _0x3511b0={};_0x3511b0[_0x4faf37[_0xa24c('0x25')]]={'$like':'%'+_0x41fcdb[_0xa24c('0x2e')][_0xa24c('0x3a')]+'%'};return _0x3511b0;}})});}_0x322909=_[_0xa24c('0x38')]({},_0x322909,_0x41fcdb['options']);var _0x144147={'where':_0x322909[_0xa24c('0x36')]};return db[_0xa24c('0x29')][_0xa24c('0x1a')](_0x144147)[_0xa24c('0x1e')](function(_0x4ee41f){_0x58853c['count']=_0x4ee41f;if(_0x41fcdb[_0xa24c('0x2e')][_0xa24c('0x3b')]){_0x322909[_0xa24c('0x3c')]=[{'all':!![]}];}return db[_0xa24c('0x29')][_0xa24c('0x3d')](_0x322909);})[_0xa24c('0x1e')](function(_0x2efd86){_0x58853c[_0xa24c('0x3e')]=_0x2efd86;return _0x58853c;})['then'](respondWithFilteredResult(_0x1cd7f8,_0x322909))['catch'](handleError(_0x1cd7f8,null));};exports[_0xa24c('0x3f')]=function(_0x10a625,_0x233260){var _0x51e25a={'raw':!![],'where':{'id':_0x10a625[_0xa24c('0x40')]['id']}},_0x30b0fc={};_0x30b0fc[_0xa24c('0x2d')]=_['keys'](db[_0xa24c('0x29')]['rawAttributes']);_0x30b0fc[_0xa24c('0x2e')]=_[_0xa24c('0x41')](_0x10a625['query']);_0x30b0fc[_0xa24c('0x37')]=_[_0xa24c('0x30')](_0x30b0fc[_0xa24c('0x2d')],_0x30b0fc[_0xa24c('0x2e')]);_0x51e25a[_0xa24c('0x2f')]=_[_0xa24c('0x30')](_0x30b0fc[_0xa24c('0x2d')],qs[_0xa24c('0x31')](_0x10a625['query']['fields']));_0x51e25a[_0xa24c('0x2f')]=_0x51e25a[_0xa24c('0x2f')][_0xa24c('0x32')]?_0x51e25a[_0xa24c('0x2f')]:_0x30b0fc[_0xa24c('0x2d')];if(_0x10a625[_0xa24c('0x2e')]['includeAll']){_0x51e25a[_0xa24c('0x3c')]=[{'all':!![]}];}_0x51e25a=_[_0xa24c('0x38')]({},_0x51e25a,_0x10a625[_0xa24c('0x42')]);return db[_0xa24c('0x29')][_0xa24c('0x43')](_0x51e25a)[_0xa24c('0x1e')](handleEntityNotFound(_0x233260,null))[_0xa24c('0x1e')](respondWithResult(_0x233260,null))[_0xa24c('0x44')](handleError(_0x233260,null));};exports['create']=function(_0xb0fa22,_0x37ac7b){return db[_0xa24c('0x29')]['create'](_0xb0fa22[_0xa24c('0x45')],{})[_0xa24c('0x1e')](function(_0x44c43b){var _0x184b8c=_0xb0fa22[_0xa24c('0x46')][_0xa24c('0x20')]({'plain':!![]});if(!_0x184b8c)throw new Error(_0xa24c('0x47'));if(_0x184b8c[_0xa24c('0x48')]===_0xa24c('0x46')){var _0xa96de4=_0x44c43b[_0xa24c('0x20')]({'plain':!![]});var _0x2da061='Pauses';return db[_0xa24c('0x49')][_0xa24c('0x43')]({'where':{'name':_0x2da061,'userProfileId':_0x184b8c[_0xa24c('0x4a')]},'raw':!![]})['then'](function(_0xdb19ca){if(_0xdb19ca&&_0xdb19ca[_0xa24c('0x4b')]===0x0){return db['UserProfileResource'][_0xa24c('0x4c')]({'name':_0xa96de4[_0xa24c('0x25')],'resourceId':_0xa96de4['id'],'type':_0xdb19ca[_0xa24c('0x25')],'sectionId':_0xdb19ca['id']},{})[_0xa24c('0x1e')](function(){return _0x44c43b;});}else{return _0x44c43b;}})[_0xa24c('0x44')](function(_0x23e154){logger[_0xa24c('0x23')](_0xa24c('0x4d'),_0x23e154);throw _0x23e154;});}return _0x44c43b;})['then'](respondWithResult(_0x37ac7b,0xc9))[_0xa24c('0x44')](handleError(_0x37ac7b,null));};exports[_0xa24c('0x4e')]=function(_0xa0392b,_0x3a17cf){if(_0xa0392b[_0xa24c('0x45')]['id']){delete _0xa0392b['body']['id'];}return db[_0xa24c('0x29')][_0xa24c('0x43')]({'where':{'id':_0xa0392b[_0xa24c('0x40')]['id']}})[_0xa24c('0x1e')](handleEntityNotFound(_0x3a17cf,null))[_0xa24c('0x1e')](saveUpdates(_0xa0392b[_0xa24c('0x45')],null))['then'](respondWithResult(_0x3a17cf,null))[_0xa24c('0x44')](handleError(_0x3a17cf,null));};exports[_0xa24c('0x1f')]=function(_0x8ecfba,_0x158df6){return db[_0xa24c('0x29')][_0xa24c('0x43')]({'where':{'id':_0x8ecfba['params']['id']}})[_0xa24c('0x1e')](handleEntityNotFound(_0x158df6,null))[_0xa24c('0x1e')](removeEntity(_0x158df6,null))['catch'](handleError(_0x158df6,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 78a365b..10ca729 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 _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','lodash','util'];(function(_0x1a33d7,_0x450c42){var _0x50f3e1=function(_0x198736){while(--_0x198736){_0x1a33d7['push'](_0x1a33d7['shift']());}};_0x50f3e1(++_0x450c42);}(_0xf494,0x1c6));var _0x4f49=function(_0x5a0736,_0xef4b9d){_0x5a0736=_0x5a0736-0x0;var _0x136f18=_0xf494[_0x5a0736];return _0x136f18;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('Pause',attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_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':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 84a7edf..3ad23ff 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x9264c4,_0x2a1027){var _0x195e5a=function(_0x43ea3a){while(--_0x43ea3a){_0x9264c4['push'](_0x9264c4['shift']());}};_0x195e5a(++_0x2a1027);}(_0x7a54,0x106));var _0x47a5=function(_0x1afeba,_0x4697e7){_0x1afeba=_0x1afeba-0x0;var _0xa21058=_0x7a54[_0x1afeba];return _0xa21058;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0xc270ac,_0x1ab826){var _0xf847=function(_0x55ca14){while(--_0x55ca14){_0xc270ac['push'](_0xc270ac['shift']());}};_0xf847(++_0x1ab826);}(_0x7a54,0x106));var _0x47a5=function(_0x4aa413,_0x1aba48){_0x4aa413=_0x4aa413-0x0;var _0x3fd63d=_0x7a54[_0x4aa413];return _0x3fd63d;};'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 13f11e7..803da5c 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 _0x4b84=['exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/webhook','get','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','basename','now','extname','upload','webhookPost','/:id','isAuthenticated','delete'];(function(_0x3ed25d,_0x6c37b2){var _0x5e0998=function(_0x3e53a4){while(--_0x3e53a4){_0x3ed25d['push'](_0x3ed25d['shift']());}};_0x5e0998(++_0x6c37b2);}(_0x4b84,0x1cc));var _0x44b8=function(_0x592d48,_0x23f1ba){_0x592d48=_0x592d48-0x0;var _0x5d789e=_0x4b84[_0x592d48];return _0x5d789e;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x44b8('0x3'));var interaction=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var controller=require('./plugin.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x44b8('0x6')]);router['get'](_0x44b8('0x7'),controller['webhookGet']);router[_0x44b8('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x44b8('0x9')]);router[_0x44b8('0x8')](_0x44b8('0xa'),auth['isAuthenticated'](),controller[_0x44b8('0xb')]);var upload=multer({'storage':multer[_0x44b8('0xc')]({'destination':function(_0x4315f6,_0x9b6048,_0x24dd10){_0x24dd10(null,path[_0x44b8('0xd')](config[_0x44b8('0xe')],'server/files/plugins'));},'filename':function(_0x147529,_0x4301a6,_0x4bcc43){_0x4301a6[_0x44b8('0xf')]=_0x4301a6['originalname'][_0x44b8('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4bcc43(null,util[_0x44b8('0x11')]('%s-%s%s',path[_0x44b8('0x12')](_0x4301a6['originalname'],path['extname'](_0x4301a6[_0x44b8('0xf')])),Date[_0x44b8('0x13')](),path[_0x44b8('0x14')](_0x4301a6[_0x44b8('0xf')])));}})});router['post']('/',upload['single']('file'),controller[_0x44b8('0x15')]);router['post'](_0x44b8('0x7'),controller[_0x44b8('0x16')]);router['put'](_0x44b8('0x17'),auth[_0x44b8('0x18')](),controller['update']);router[_0x44b8('0x19')](_0x44b8('0x17'),auth['isAuthenticated'](),controller[_0x44b8('0x19')]);module[_0x44b8('0x1a')]=router; \ No newline at end of file +var _0x81bd=['diskStorage','join','root','server/files/plugins','originalname','format','basename','extname','now','post','file','upload','/webhook','webhookPost','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','show','/:id/download','download'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x81bd,0x7c));var _0xd81b=function(_0x5a4257,_0x3ae34d){_0x5a4257=_0x5a4257-0x0;var _0x3746a7=_0x81bd[_0x5a4257];return _0x3746a7;};'use strict';var multer=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var path=require(_0xd81b('0x2'));var timeout=require(_0xd81b('0x3'));var express=require(_0xd81b('0x4'));var router=express[_0xd81b('0x5')]();var fs_extra=require(_0xd81b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd81b('0x7'));var config=require(_0xd81b('0x8'));var controller=require(_0xd81b('0x9'));router['get']('/',auth[_0xd81b('0xa')](),controller[_0xd81b('0xb')]);router[_0xd81b('0xc')]('/webhook',controller['webhookGet']);router[_0xd81b('0xc')]('/:id',auth[_0xd81b('0xa')](),controller[_0xd81b('0xd')]);router[_0xd81b('0xc')](_0xd81b('0xe'),auth[_0xd81b('0xa')](),controller[_0xd81b('0xf')]);var upload=multer({'storage':multer[_0xd81b('0x10')]({'destination':function(_0x17e09f,_0x2090e1,_0x23c789){_0x23c789(null,path[_0xd81b('0x11')](config[_0xd81b('0x12')],_0xd81b('0x13')));},'filename':function(_0x560530,_0x21dfff,_0x57f71d){_0x21dfff[_0xd81b('0x14')]=_0x21dfff[_0xd81b('0x14')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57f71d(null,util[_0xd81b('0x15')]('%s-%s%s',path[_0xd81b('0x16')](_0x21dfff[_0xd81b('0x14')],path[_0xd81b('0x17')](_0x21dfff[_0xd81b('0x14')])),Date[_0xd81b('0x18')](),path['extname'](_0x21dfff[_0xd81b('0x14')])));}})});router[_0xd81b('0x19')]('/',upload['single'](_0xd81b('0x1a')),controller[_0xd81b('0x1b')]);router[_0xd81b('0x19')](_0xd81b('0x1c'),controller[_0xd81b('0x1d')]);router[_0xd81b('0x1e')](_0xd81b('0x1f'),auth[_0xd81b('0xa')](),controller[_0xd81b('0x20')]);router[_0xd81b('0x21')](_0xd81b('0x1f'),auth[_0xd81b('0xa')](),controller[_0xd81b('0x21')]);module[_0xd81b('0x22')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index a32f7ba..8e78a1e 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 _0x150d=['adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT','BOOLEAN'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x150d,0x1d9));var _0xd150=function(_0x208d75,_0x92d742){_0x208d75=_0x208d75-0x0;var _0x382d27=_0x150d[_0x208d75];return _0x382d27;};'use strict';var Sequelize=require(_0xd150('0x0'));module[_0xd150('0x1')]={'name':{'type':Sequelize[_0xd150('0x2')]},'type':{'type':Sequelize[_0xd150('0x3')](_0xd150('0x4'),_0xd150('0x5'))},'description':{'type':Sequelize[_0xd150('0x6')]},'version':{'type':Sequelize[_0xd150('0x6')]},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xd150('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0xd150('0x8'),_0xd150('0x9'),_0xd150('0xa'),_0xd150('0xb')),'defaultValue':'always','comment':_0xd150('0xc')},'icon':{'type':Sequelize[_0xd150('0x2')]},'adminUrl':{'type':Sequelize[_0xd150('0x2')]},'agentUrl':{'type':Sequelize[_0xd150('0x2')]},'scriptName':{'type':Sequelize[_0xd150('0x2')]},'scriptPath':{'type':Sequelize[_0xd150('0x2')]}}; \ No newline at end of file +var _0x3d2d=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','html','TEXT','STRING','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never'];(function(_0x4877ee,_0x36ea12){var _0x49558a=function(_0x3c9af9){while(--_0x3c9af9){_0x4877ee['push'](_0x4877ee['shift']());}};_0x49558a(++_0x36ea12);}(_0x3d2d,0xcd));var _0xd3d2=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x3d2d[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require(_0xd3d2('0x0'));module[_0xd3d2('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd3d2('0x2')](_0xd3d2('0x3'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xd3d2('0x4')]},'path':{'type':Sequelize[_0xd3d2('0x5')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xd3d2('0x6')},'sidebar':{'type':Sequelize[_0xd3d2('0x2')](_0xd3d2('0x7'),_0xd3d2('0x8'),_0xd3d2('0x9'),_0xd3d2('0xa')),'defaultValue':_0xd3d2('0x9'),'comment':_0xd3d2('0xb')},'icon':{'type':Sequelize[_0xd3d2('0x5')]},'adminUrl':{'type':Sequelize[_0xd3d2('0x5')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 367f182..8a42989 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 _0x5c14=['stack','send','index','map','Plugin','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','includeAll','include','findAll','rows','params','options','find','catch','download','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','glob','**/*','node_modules/**/*','attachments/**/*','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20views\x20missing','views','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','html','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','script','create','role','userProfileId','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','body','delete','dirname','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','method','set','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','extract-zip','rimraf','archiver','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','get','Plugins','UserProfileResource','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c14,0x7d));var _0x45c1=function(_0x1fa48e,_0x9d8448){_0x1fa48e=_0x1fa48e-0x0;var _0x5cc93f=_0x5c14[_0x1fa48e];return _0x5cc93f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x45c1('0x0'));var rp=require(_0x45c1('0x1'));var moment=require(_0x45c1('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x45c1('0x3'));var util=require(_0x45c1('0x4'));var path=require(_0x45c1('0x5'));var sox=require(_0x45c1('0x6'));var csv=require('to-csv');var ejs=require(_0x45c1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x45c1('0x8'));var crypto=require(_0x45c1('0x9'));var jsforce=require(_0x45c1('0xa'));var deskjs=require(_0x45c1('0xb'));var toCsv=require(_0x45c1('0xc'));var querystring=require(_0x45c1('0xd'));var Papa=require(_0x45c1('0xe'));var extract=require(_0x45c1('0xf'));var rimraf=require(_0x45c1('0x10'));var archiver=require(_0x45c1('0x11'));var Redis=require('ioredis');var authService=require(_0x45c1('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x45c1('0x13'));var logger=require('../../config/logger')(_0x45c1('0x14'));var utils=require(_0x45c1('0x15'));var config=require(_0x45c1('0x16'));var licenseUtil=require(_0x45c1('0x17'));var db=require(_0x45c1('0x18'))['db'];config['redis']=_['defaults'](config[_0x45c1('0x19')],{'host':_0x45c1('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x45c1('0x1b'))[_0x45c1('0x1c')](socket);function respondWithStatusCode(_0x4b80ee,_0x1d738d){_0x1d738d=_0x1d738d||0xcc;return function(_0x2de60a){if(_0x2de60a){return _0x4b80ee[_0x45c1('0x1d')](_0x1d738d);}return _0x4b80ee[_0x45c1('0x1e')](_0x1d738d)[_0x45c1('0x1f')]();};}function respondWithResult(_0x1381c1,_0x422e7f){_0x422e7f=_0x422e7f||0xc8;return function(_0x264071){if(_0x264071){return _0x1381c1['status'](_0x422e7f)[_0x45c1('0x20')](_0x264071);}};}function respondWithFilteredResult(_0x5638ed,_0x17e255){return function(_0x580dac){if(_0x580dac){var _0x19b4aa=typeof _0x17e255[_0x45c1('0x21')]===_0x45c1('0x22')&&typeof _0x17e255['limit']==='undefined';var _0x322928=_0x580dac[_0x45c1('0x23')];var _0x490930=_0x19b4aa?0x0:_0x17e255['offset'];var _0x326a0e=_0x19b4aa?_0x580dac[_0x45c1('0x23')]:_0x17e255[_0x45c1('0x21')]+_0x17e255[_0x45c1('0x24')];var _0x5c9d2b;if(_0x326a0e>=_0x322928){_0x326a0e=_0x322928;_0x5c9d2b=0xc8;}else{_0x5c9d2b=0xce;}_0x5638ed[_0x45c1('0x1e')](_0x5c9d2b);return _0x5638ed['set'](_0x45c1('0x25'),_0x490930+'-'+_0x326a0e+'/'+_0x322928)[_0x45c1('0x20')](_0x580dac);}return null;};}function patchUpdates(_0x527208){return function(_0x23d657){try{jsonpatch[_0x45c1('0x26')](_0x23d657,_0x527208,!![]);}catch(_0x1820e6){return BPromise[_0x45c1('0x27')](_0x1820e6);}return _0x23d657[_0x45c1('0x28')]();};}function saveUpdates(_0x5e55df,_0x326b97){return function(_0x182242){if(_0x182242){return _0x182242['update'](_0x5e55df)[_0x45c1('0x29')](function(_0x30ad04){return _0x30ad04;});}return null;};}function removeEntity(_0x470eb3,_0x4d1144){return function(_0x258e58){if(_0x258e58){return _0x258e58[_0x45c1('0x2a')]()[_0x45c1('0x29')](function(){var _0x1eb0f0=_0x258e58[_0x45c1('0x2b')]({'plain':!![]});var _0x1e1908=_0x45c1('0x2c');return db[_0x45c1('0x2d')][_0x45c1('0x2a')]({'where':{'type':_0x1e1908,'resourceId':_0x1eb0f0['id']}})['then'](function(){return _0x258e58;});})[_0x45c1('0x29')](function(){_0x470eb3[_0x45c1('0x1e')](0xcc)[_0x45c1('0x1f')]();});}};}function handleEntityNotFound(_0x34c426,_0x4555d1){return function(_0x3645a6){if(!_0x3645a6){_0x34c426[_0x45c1('0x1d')](0x194);}return _0x3645a6;};}function handleError(_0x2b6d11,_0x3bc5fc){_0x3bc5fc=_0x3bc5fc||0x1f4;return function(_0x50016a){logger[_0x45c1('0x2e')](_0x50016a[_0x45c1('0x2f')]);if(_0x50016a['name']){delete _0x50016a['name'];}_0x2b6d11[_0x45c1('0x1e')](_0x3bc5fc)[_0x45c1('0x30')](_0x50016a);};}exports[_0x45c1('0x31')]=function(_0x2da601,_0x2949ec){var _0x318291={},_0x3afc11={},_0x269670={'count':0x0,'rows':[]};var _0x2dc88e=_[_0x45c1('0x32')](db[_0x45c1('0x33')][_0x45c1('0x34')],function(_0x1c2349){return{'name':_0x1c2349[_0x45c1('0x35')],'type':_0x1c2349['type'][_0x45c1('0x36')]};});_0x3afc11[_0x45c1('0x37')]=_[_0x45c1('0x32')](_0x2dc88e,_0x45c1('0x38'));_0x3afc11[_0x45c1('0x39')]=_[_0x45c1('0x3a')](_0x2da601[_0x45c1('0x39')]);_0x3afc11[_0x45c1('0x3b')]=_[_0x45c1('0x3c')](_0x3afc11[_0x45c1('0x37')],_0x3afc11[_0x45c1('0x39')]);_0x318291[_0x45c1('0x3d')]=_[_0x45c1('0x3c')](_0x3afc11[_0x45c1('0x37')],qs[_0x45c1('0x3e')](_0x2da601['query'][_0x45c1('0x3e')]));_0x318291[_0x45c1('0x3d')]=_0x318291[_0x45c1('0x3d')][_0x45c1('0x3f')]?_0x318291['attributes']:_0x3afc11['model'];if(!_0x2da601[_0x45c1('0x39')][_0x45c1('0x40')](_0x45c1('0x41'))){_0x318291[_0x45c1('0x24')]=qs[_0x45c1('0x24')](_0x2da601['query'][_0x45c1('0x24')]);_0x318291[_0x45c1('0x21')]=qs[_0x45c1('0x21')](_0x2da601[_0x45c1('0x39')][_0x45c1('0x21')]);}_0x318291[_0x45c1('0x42')]=qs[_0x45c1('0x43')](_0x2da601[_0x45c1('0x39')][_0x45c1('0x43')]);_0x318291[_0x45c1('0x44')]=qs[_0x45c1('0x3b')](_['pick'](_0x2da601[_0x45c1('0x39')],_0x3afc11[_0x45c1('0x3b')]),_0x2dc88e);if(_0x2da601[_0x45c1('0x39')][_0x45c1('0x45')]){_0x318291[_0x45c1('0x44')]=_[_0x45c1('0x46')](_0x318291[_0x45c1('0x44')],{'$or':_[_0x45c1('0x32')](_0x2dc88e,function(_0x4d794d){if(_0x4d794d[_0x45c1('0x47')]!=='VIRTUAL'){var _0x128203={};_0x128203[_0x4d794d[_0x45c1('0x38')]]={'$like':'%'+_0x2da601[_0x45c1('0x39')][_0x45c1('0x45')]+'%'};return _0x128203;}})});}_0x318291=_['merge']({},_0x318291,_0x2da601['options']);var _0x2912eb={'where':_0x318291[_0x45c1('0x44')]};return db[_0x45c1('0x33')][_0x45c1('0x23')](_0x2912eb)[_0x45c1('0x29')](function(_0x281b68){_0x269670[_0x45c1('0x23')]=_0x281b68;if(_0x2da601[_0x45c1('0x39')][_0x45c1('0x48')]){_0x318291[_0x45c1('0x49')]=[{'all':!![]}];}return db[_0x45c1('0x33')][_0x45c1('0x4a')](_0x318291);})['then'](function(_0x1cd71e){_0x269670[_0x45c1('0x4b')]=_0x1cd71e;return _0x269670;})['then'](respondWithFilteredResult(_0x2949ec,_0x318291))['catch'](handleError(_0x2949ec,null));};exports['show']=function(_0x1b7626,_0x280d16){var _0x289356={'raw':!![],'where':{'id':_0x1b7626[_0x45c1('0x4c')]['id']}},_0xbe1b46={};_0xbe1b46[_0x45c1('0x37')]=_['keys'](db[_0x45c1('0x33')][_0x45c1('0x34')]);_0xbe1b46[_0x45c1('0x39')]=_['keys'](_0x1b7626[_0x45c1('0x39')]);_0xbe1b46[_0x45c1('0x3b')]=_['intersection'](_0xbe1b46['model'],_0xbe1b46[_0x45c1('0x39')]);_0x289356[_0x45c1('0x3d')]=_[_0x45c1('0x3c')](_0xbe1b46[_0x45c1('0x37')],qs[_0x45c1('0x3e')](_0x1b7626['query']['fields']));_0x289356['attributes']=_0x289356[_0x45c1('0x3d')][_0x45c1('0x3f')]?_0x289356[_0x45c1('0x3d')]:_0xbe1b46[_0x45c1('0x37')];if(_0x1b7626[_0x45c1('0x39')][_0x45c1('0x48')]){_0x289356[_0x45c1('0x49')]=[{'all':!![]}];}_0x289356=_[_0x45c1('0x46')]({},_0x289356,_0x1b7626[_0x45c1('0x4d')]);return db['Plugin'][_0x45c1('0x4e')](_0x289356)[_0x45c1('0x29')](handleEntityNotFound(_0x280d16,null))[_0x45c1('0x29')](respondWithResult(_0x280d16,null))[_0x45c1('0x4f')](handleError(_0x280d16,null));};exports[_0x45c1('0x50')]=function(_0xfd8978,_0x47e1fc,_0x58ba59){return db[_0x45c1('0x33')][_0x45c1('0x4e')]({'where':{'id':_0xfd8978[_0x45c1('0x4c')]['id']},'attributes':[_0x45c1('0x38'),_0x45c1('0x5')],'raw':!![]})[_0x45c1('0x29')](handleEntityNotFound(_0x47e1fc,null))[_0x45c1('0x29')](function(_0x3e4c6b){if(_0x3e4c6b){var _0x2e11e2=path[_0x45c1('0x51')](config[_0x45c1('0x52')],_0x45c1('0x53'),util[_0x45c1('0x54')](_0x45c1('0x55'),path[_0x45c1('0x56')](_0x3e4c6b['path'])));var _0xee7f89=fs[_0x45c1('0x57')](_0x2e11e2);var _0x334e9a=archiver(_0x45c1('0x58'),{'zlib':{'level':0x9}});_0x334e9a['on'](_0x45c1('0x59'),function(_0x15f83e){if(_0x15f83e[_0x45c1('0x5a')]===_0x45c1('0x5b')){logger[_0x45c1('0x2e')](_0x15f83e);}else{throw new db['Sequelize'][(_0x45c1('0x5c'))](_0x45c1('0x5d'));}});_0x334e9a['on']('error',function(_0x22c0fc){throw new db[(_0x45c1('0x5e'))]['Error'](_0x45c1('0x5d'));});_0x334e9a['pipe'](_0xee7f89);_0x334e9a[_0x45c1('0x5f')](_0x45c1('0x60'),{'cwd':path['join'](config[_0x45c1('0x52')],'server/files/plugins',path['dirname'](_0x3e4c6b[_0x45c1('0x5')])),'ignore':[path[_0x45c1('0x51')](path[_0x45c1('0x56')](_0x3e4c6b['path']),_0x45c1('0x61')),path['join'](path[_0x45c1('0x56')](_0x3e4c6b[_0x45c1('0x5')]),_0x45c1('0x62'))],'nodir':!![]})['finalize']();_0xee7f89['on'](_0x45c1('0x63'),function(){if(!fs[_0x45c1('0x64')](_0x2e11e2)){throw new db['Sequelize'][(_0x45c1('0x5c'))]('Plugin\x20not\x20found');}return _0x47e1fc[_0x45c1('0x50')](_0x2e11e2,util[_0x45c1('0x54')](_0x45c1('0x55'),path['basename'](_0x3e4c6b['path'])),function(_0x7e4523){if(_0x7e4523){throw new db[(_0x45c1('0x5e'))][(_0x45c1('0x5c'))](_0x45c1('0x65'));}fs[_0x45c1('0x66')](_0x2e11e2);logger['info']('Download\x20completed');logger[_0x45c1('0x67')](_0x45c1('0x68'));});});}return null;})[_0x45c1('0x4f')](handleError(_0x47e1fc,null));};exports[_0x45c1('0x69')]=function(_0x517029,_0x53d440,_0x435c12){var _0xe0ee4a=path[_0x45c1('0x56')](_0x517029[_0x45c1('0x6a')][_0x45c1('0x6b')],path['extname'](_0x517029[_0x45c1('0x6a')][_0x45c1('0x6b')]));var _0x179d4e=path[_0x45c1('0x51')](config['root'],_0x45c1('0x53'),_0x517029['file'][_0x45c1('0x6b')]);var _0x67efe7=path[_0x45c1('0x51')](config['root'],_0x45c1('0x53'),_0xe0ee4a);logger['info'](_0x45c1('0x6c'),_0x179d4e);logger['info'](_0x45c1('0x6d'),_0x67efe7);try{fs[_0x45c1('0x6e')](_0x179d4e,parseInt(_0x45c1('0x6f'),0x8));extract(_0x179d4e,{'dir':_0x67efe7},function(_0x24e263){if(_0x24e263){logger['error'](_0x24e263);handleError(_0x24e263,!![]);};var _0x311d21=fs[_0x45c1('0x70')](_0x67efe7);if(_0x311d21[_0x45c1('0x3f')]>0x1){removeReferences(_0x179d4e,_0x67efe7);logger[_0x45c1('0x2e')](_0x45c1('0x71'));return _0x435c12(new Error('Invalid\x20plugin\x20structure'));}var _0x242207=fs[_0x45c1('0x72')](path[_0x45c1('0x51')](_0x67efe7,_0x311d21[0x0]));if(_0x242207[_0x45c1('0x73')]()){removeReferences(_0x179d4e,_0x67efe7);logger['error']('Invalid\x20plugin\x20structure');return _0x435c12(new Error(_0x45c1('0x71')));}if(_0x242207[_0x45c1('0x74')]()){var _0x18d4ea=fs[_0x45c1('0x70')](path[_0x45c1('0x51')](_0x67efe7,_0x311d21[0x0]));if(_0x18d4ea[_0x45c1('0x3f')]===0x0){removeReferences(_0x179d4e,_0x67efe7);logger[_0x45c1('0x2e')](_0x45c1('0x71'));return _0x435c12(new Error('Invalid\x20plugin\x20structure'));}var _0x321c7b=_0x18d4ea[_0x45c1('0x75')](function(_0x23c9ee){return _0x23c9ee===_0x45c1('0x76');});if(!_0x321c7b){return _0x435c12(new Error('Plugin\x20manifest\x20missing'));}var _0x1ff7f6=fs[_0x45c1('0x77')](path[_0x45c1('0x51')](_0x67efe7,_0x311d21[0x0],'manifest.json'));var _0x28a185=JSON[_0x45c1('0x78')](_0x1ff7f6);if(_0x45c1('0x22')==typeof _0x28a185[_0x45c1('0x38')]){return _0x435c12(new Error(_0x45c1('0x79')));}if(_0x45c1('0x22')==typeof _0x28a185['type']){return _0x435c12(new Error(_0x45c1('0x7a')));}if(_0x45c1('0x22')==typeof _0x28a185[_0x45c1('0x7b')]){return _0x435c12(new Error(_0x45c1('0x7c')));}if(_0x45c1('0x22')==typeof _0x28a185[_0x45c1('0x7d')]){return _0x435c12(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x28a185['type']==='html'){if(_0x45c1('0x22')==typeof _0x28a185[_0x45c1('0x7d')]['views']){return _0x435c12(new Error(_0x45c1('0x7e')));}if(_0x45c1('0x22')==typeof _0x28a185['parameters'][_0x45c1('0x7f')]['admin']&&'undefined'==typeof _0x28a185[_0x45c1('0x7d')][_0x45c1('0x7f')]['agent']){return _0x435c12(new Error(_0x45c1('0x80')));}}else if(_0x28a185[_0x45c1('0x47')]==='script'){if(_0x45c1('0x22')==typeof _0x28a185[_0x45c1('0x7d')][_0x45c1('0x81')]){return _0x435c12(new Error(_0x45c1('0x82')));}if(_0x45c1('0x22')==typeof _0x28a185[_0x45c1('0x7d')][_0x45c1('0x83')]){return _0x435c12(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x435c12(new Error(_0x45c1('0x84')));}var _0x1dd4e0=_0x28a185[_0x45c1('0x38')];var _0x891be4=_0x28a185[_0x45c1('0x85')];var _0x59248c=_0x28a185[_0x45c1('0x47')];var _0x2d02c7=_0x28a185['sidebar']?_0x28a185[_0x45c1('0x86')]:'always';var _0x2d3475=_0x28a185[_0x45c1('0x87')]?_0x28a185[_0x45c1('0x87')]:'icon-apps';var _0x589647='';var _0x4c0cdb='';var _0x1e631f='';var _0x24007a='';var _0x3c2651=_0x28a185['version'];if(_0x59248c===_0x45c1('0x88')){if('undefined'!=typeof _0x28a185[_0x45c1('0x7d')][_0x45c1('0x7f')]['admin']){var _0x24c226=_0x28a185[_0x45c1('0x7d')][_0x45c1('0x7f')][_0x45c1('0x89')];if(!/^(f|ht)tps?:\/\//i[_0x45c1('0x8a')](_0x24c226)){_0x589647=path[_0x45c1('0x51')](_0x45c1('0x8b'),_0xe0ee4a,_0x311d21[0x0],_0x24c226);}else{_0x589647=_0x24c226;}}else{logger[_0x45c1('0x67')](_0x45c1('0x8c'));}if(_0x45c1('0x22')!=typeof _0x28a185[_0x45c1('0x7d')][_0x45c1('0x7f')][_0x45c1('0x8d')]){var _0x23fdfe=_0x28a185[_0x45c1('0x7d')]['views'][_0x45c1('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0x45c1('0x8a')](_0x23fdfe)){_0x4c0cdb=path[_0x45c1('0x51')](_0x45c1('0x8b'),_0xe0ee4a,_0x311d21[0x0],_0x23fdfe);}else{_0x4c0cdb=_0x23fdfe;}}else{logger[_0x45c1('0x67')](_0x45c1('0x8e'));}}else if(_0x59248c===_0x45c1('0x8f')){_0x1e631f=_0x28a185['parameters'][_0x45c1('0x81')];_0x24007a=_0x28a185['parameters'][_0x45c1('0x83')];if(_0x45c1('0x22')!=typeof _0x28a185[_0x45c1('0x7d')][_0x45c1('0x7f')]){if('undefined'!=typeof _0x28a185[_0x45c1('0x7d')][_0x45c1('0x7f')][_0x45c1('0x89')]){var _0x24c226=_0x28a185[_0x45c1('0x7d')][_0x45c1('0x7f')][_0x45c1('0x89')];if(!/^(f|ht)tps?:\/\//i[_0x45c1('0x8a')](_0x24c226)){_0x589647=path[_0x45c1('0x51')](_0x45c1('0x8b'),_0xe0ee4a,_0x311d21[0x0],_0x24c226);}else{_0x589647=_0x24c226;}}if(_0x45c1('0x22')!=typeof _0x28a185[_0x45c1('0x7d')][_0x45c1('0x7f')][_0x45c1('0x8d')]){var _0x23fdfe=_0x28a185[_0x45c1('0x7d')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x45c1('0x8a')](_0x23fdfe)){_0x4c0cdb=path['join'](_0x45c1('0x8b'),_0xe0ee4a,_0x311d21[0x0],_0x23fdfe);}else{_0x4c0cdb=_0x23fdfe;}}}}var _0x48d0fd={'name':_0x1dd4e0,'description':_0x891be4,'path':path[_0x45c1('0x51')](_0xe0ee4a,_0x311d21[0x0]),'type':_0x59248c,'sidebar':_0x2d02c7,'icon':_0x2d3475,'adminUrl':_0x589647,'agentUrl':_0x4c0cdb,'scriptName':_0x1e631f,'scriptPath':_0x24007a,'version':_0x3c2651};removeReferences(_0x179d4e,null);return db[_0x45c1('0x33')][_0x45c1('0x90')](_0x48d0fd)[_0x45c1('0x29')](function(_0x3f5aeb){var _0x2b45f8={'role':_0x517029['body'][_0x45c1('0x91')],'userProfileId':_0x517029['body'][_0x45c1('0x92')]};if(!_0x2b45f8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b45f8[_0x45c1('0x91')]===_0x45c1('0x93')){var _0x3656c4=_0x3f5aeb[_0x45c1('0x2b')]({'plain':!![]});return db['UserProfileSection'][_0x45c1('0x4e')]({'where':{'name':_0x45c1('0x2c'),'userProfileId':_0x2b45f8['userProfileId']},'raw':!![]})[_0x45c1('0x29')](function(_0x193923){if(_0x193923&&_0x193923[_0x45c1('0x94')]===0x0){return db[_0x45c1('0x2d')][_0x45c1('0x90')]({'name':_0x3656c4[_0x45c1('0x38')],'resourceId':_0x3656c4['id'],'type':_0x193923[_0x45c1('0x38')],'sectionId':_0x193923['id']},{})[_0x45c1('0x29')](function(){return _0x3f5aeb;});}else{return _0x3f5aeb;}})[_0x45c1('0x4f')](function(_0x430894){logger[_0x45c1('0x2e')](_0x45c1('0x95'),_0x430894);throw _0x430894;});}return _0x3f5aeb;})[_0x45c1('0x29')](respondWithResult(_0x53d440,null))[_0x45c1('0x4f')](handleError(_0x53d440,null));}});}catch(_0x30104a){_0x53d440[_0x45c1('0x1e')](0x1f4)[_0x45c1('0x30')](_0x30104a);}};function removeReferences(_0x224d50,_0x12c3f0){try{if(_0x224d50){fs[_0x45c1('0x66')](_0x224d50);logger[_0x45c1('0x67')](_0x45c1('0x96'));}if(_0x12c3f0){rimraf(_0x12c3f0,function(){});logger['info'](_0x45c1('0x97'));}}catch(_0x3166c9){logger['error'](_0x3166c9);}}exports['update']=function(_0x89149a,_0x4394d3,_0x4dbeb7){return db[_0x45c1('0x33')][_0x45c1('0x4e')]({'where':{'id':_0x89149a[_0x45c1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4394d3,null))[_0x45c1('0x29')](saveUpdates(_0x89149a[_0x45c1('0x98')],null))[_0x45c1('0x29')](respondWithResult(_0x4394d3,null))[_0x45c1('0x4f')](handleError(_0x4394d3,null));};exports[_0x45c1('0x99')]=function(_0x4e707a,_0x2bcb9a,_0x4602c8){return db['Plugin'][_0x45c1('0x4e')]({'where':{'id':_0x4e707a[_0x45c1('0x4c')]['id']}})['then'](function(_0x54036d){if(_0x54036d){return _0x54036d[_0x45c1('0x2a')]();}})['then'](function(_0x6de03f){rimraf(path[_0x45c1('0x51')](config[_0x45c1('0x52')],'server/files/plugins',path[_0x45c1('0x9a')](_0x6de03f[_0x45c1('0x5')])),function(){});return _0x6de03f;})[_0x45c1('0x29')](handleEntityNotFound(_0x2bcb9a,null))[_0x45c1('0x29')](respondWithStatusCode(_0x2bcb9a,null))['catch'](handleError(_0x2bcb9a,null));};exports[_0x45c1('0x9b')]=function(_0xcf3fb6,_0x52987f,_0x384205){return BPromise['resolve']()['then'](function(){if(!_0xcf3fb6[_0x45c1('0x39')]['path']){throw new Error(_0x45c1('0x9c'));}if(!_0xcf3fb6['query'][_0x45c1('0x9d')]){throw new Error(_0x45c1('0x9e'));}var _0x5da0cc=_0xcf3fb6[_0x45c1('0x39')][_0x45c1('0x9f')]?_0xcf3fb6[_0x45c1('0x39')][_0x45c1('0x9f')]+':'+_0xcf3fb6[_0x45c1('0x39')][_0x45c1('0x9d')]:_0x45c1('0xa0')+_0xcf3fb6[_0x45c1('0x39')]['port'];var _0x382117=_0xcf3fb6[_0x45c1('0x39')][_0x45c1('0x20')]?_0xcf3fb6[_0x45c1('0x39')][_0x45c1('0x20')]:!![];var _0x6d3bfd=_0xcf3fb6[_0x45c1('0x39')][_0x45c1('0xa1')]?_0xcf3fb6[_0x45c1('0x39')][_0x45c1('0xa1')]:null;var _0x4a5f91={'method':_0xcf3fb6['method'],'uri':util[_0x45c1('0x54')](_0x45c1('0xa2'),_0x5da0cc,_0xcf3fb6['query'][_0x45c1('0x5')]),'json':_0x382117,'resolveWithFullResponse':!![],'encoding':_0x6d3bfd,'qs':_0xcf3fb6[_0x45c1('0x39')]};if(_0xcf3fb6[_0x45c1('0xa3')]){_0x4a5f91[_0x45c1('0xa3')]=_0xcf3fb6['headers'];if(_0x4a5f91[_0x45c1('0xa3')][_0x45c1('0xa4')]){delete _0x4a5f91[_0x45c1('0xa3')][_0x45c1('0xa4')];}}if(_0x4a5f91['headers'][_0x45c1('0xa5')]){delete _0x4a5f91[_0x45c1('0xa3')][_0x45c1('0xa5')];}return rp(_0x4a5f91);})[_0x45c1('0x29')](function(_0x5a40c2){if(_0x5a40c2){_0x52987f['set'](_0x5a40c2[_0x45c1('0xa3')]);logger[_0x45c1('0x67')](_0x5a40c2['body']);if(_[_0x45c1('0xa6')](_0xcf3fb6[_0x45c1('0x39')]['path'],'download')&&_0x5a40c2[_0x45c1('0xa7')]==0x1f4){return _0x52987f[_0x45c1('0x1d')](_0x5a40c2[_0x45c1('0xa7')]);}else{return _0x52987f[_0x45c1('0x1e')](_0x5a40c2[_0x45c1('0xa7')])[_0x45c1('0x30')](_0x5a40c2['body']);}}else{return _0x52987f[_0x45c1('0x1d')](0xc8);}})[_0x45c1('0x4f')](handleError(_0x52987f,null));};exports[_0x45c1('0xa8')]=function(_0x285821,_0x8aa7f9,_0x515eef){return BPromise[_0x45c1('0xa9')]()[_0x45c1('0x29')](function(){if(!_0x285821[_0x45c1('0x39')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x285821[_0x45c1('0x39')][_0x45c1('0x9d')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x1b03c=_0x285821[_0x45c1('0x39')][_0x45c1('0x9f')]?_0x285821[_0x45c1('0x39')][_0x45c1('0x9f')]+':'+_0x285821[_0x45c1('0x39')][_0x45c1('0x9d')]:_0x45c1('0xa0')+_0x285821['query']['port'];var _0x33c4b9=_0x285821[_0x45c1('0x39')][_0x45c1('0x20')]?_0x285821['query'][_0x45c1('0x20')]:!![];var _0xda86c4=_0x285821['query'][_0x45c1('0xa1')]?_0x285821[_0x45c1('0x39')]['encoding']:null;var _0xf4c4b8={'method':_0x285821[_0x45c1('0xaa')],'uri':util[_0x45c1('0x54')](_0x45c1('0xa2'),_0x1b03c,_0x285821[_0x45c1('0x39')][_0x45c1('0x5')]),'json':_0x33c4b9,'resolveWithFullResponse':!![],'encoding':_0xda86c4,'body':_0x285821[_0x45c1('0x98')]};if(_0x285821[_0x45c1('0xa3')]){_0xf4c4b8['headers']=_0x285821[_0x45c1('0xa3')];if(_0xf4c4b8[_0x45c1('0xa3')]['content-length']){delete _0xf4c4b8[_0x45c1('0xa3')][_0x45c1('0xa4')];}}if(_0xf4c4b8[_0x45c1('0xa3')][_0x45c1('0xa5')]){delete _0xf4c4b8[_0x45c1('0xa3')][_0x45c1('0xa5')];}return rp(_0xf4c4b8);})[_0x45c1('0x29')](function(_0x19be3b){if(_0x19be3b){_0x8aa7f9[_0x45c1('0xab')](_0x19be3b[_0x45c1('0xa3')]);logger[_0x45c1('0x67')](_0x19be3b[_0x45c1('0x98')]);return _0x8aa7f9['status'](_0x19be3b[_0x45c1('0xa7')])[_0x45c1('0x30')](_0x19be3b[_0x45c1('0x98')]);}else{return _0x8aa7f9[_0x45c1('0x1d')](0xc8);}})[_0x45c1('0x4f')](handleError(_0x8aa7f9,null));}; \ No newline at end of file +var _0xc60a=['status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','Plugins','destroy','end','error','name','send','index','Plugin','rawAttributes','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','join','root','server/files/plugins','format','%s.zip','createWriteStream','zip','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','dirname','basename','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','some','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','always','icon','icon-apps','version','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','download','statusCode','webhookPost','resolve','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','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','./plugin.socket','register','sendStatus'];(function(_0x201aca,_0x21c20d){var _0xd08049=function(_0x3498bb){while(--_0x3498bb){_0x201aca['push'](_0x201aca['shift']());}};_0xd08049(++_0x21c20d);}(_0xc60a,0x13d));var _0xac60=function(_0x493ebc,_0x15ee5b){_0x493ebc=_0x493ebc-0x0;var _0x43ce87=_0xc60a[_0x493ebc];return _0x43ce87;};'use strict';var emlformat=require(_0xac60('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xac60('0x1'));var jsonpatch=require(_0xac60('0x2'));var rp=require(_0xac60('0x3'));var moment=require(_0xac60('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xac60('0x5'));var util=require('util');var path=require(_0xac60('0x6'));var sox=require(_0xac60('0x7'));var csv=require(_0xac60('0x8'));var ejs=require(_0xac60('0x9'));var fs=require('fs');var fs_extra=require(_0xac60('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xac60('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xac60('0xc'));var toCsv=require(_0xac60('0x8'));var querystring=require(_0xac60('0xd'));var Papa=require(_0xac60('0xe'));var extract=require(_0xac60('0xf'));var rimraf=require(_0xac60('0x10'));var archiver=require(_0xac60('0x11'));var Redis=require(_0xac60('0x12'));var authService=require(_0xac60('0x13'));var qs=require(_0xac60('0x14'));var as=require(_0xac60('0x15'));var hardwareService=require(_0xac60('0x16'));var logger=require(_0xac60('0x17'))('api');var utils=require(_0xac60('0x18'));var config=require(_0xac60('0x19'));var licenseUtil=require(_0xac60('0x1a'));var db=require(_0xac60('0x1b'))['db'];config[_0xac60('0x1c')]=_[_0xac60('0x1d')](config[_0xac60('0x1c')],{'host':_0xac60('0x1e'),'port':0x18eb});var socket=require(_0xac60('0x1f'))(new Redis(config[_0xac60('0x1c')]));require(_0xac60('0x20'))[_0xac60('0x21')](socket);function respondWithStatusCode(_0x3ca805,_0x293016){_0x293016=_0x293016||0xcc;return function(_0x39cbca){if(_0x39cbca){return _0x3ca805[_0xac60('0x22')](_0x293016);}return _0x3ca805[_0xac60('0x23')](_0x293016)['end']();};}function respondWithResult(_0x4a2bb8,_0x5aacff){_0x5aacff=_0x5aacff||0xc8;return function(_0x4abc9a){if(_0x4abc9a){return _0x4a2bb8[_0xac60('0x23')](_0x5aacff)[_0xac60('0x24')](_0x4abc9a);}};}function respondWithFilteredResult(_0x21e684,_0x48818b){return function(_0x21c0c6){if(_0x21c0c6){var _0x2af69d=typeof _0x48818b[_0xac60('0x25')]===_0xac60('0x26')&&typeof _0x48818b[_0xac60('0x27')]===_0xac60('0x26');var _0x144045=_0x21c0c6[_0xac60('0x28')];var _0x53d16e=_0x2af69d?0x0:_0x48818b['offset'];var _0x242f55=_0x2af69d?_0x21c0c6['count']:_0x48818b[_0xac60('0x25')]+_0x48818b[_0xac60('0x27')];var _0x5d865c;if(_0x242f55>=_0x144045){_0x242f55=_0x144045;_0x5d865c=0xc8;}else{_0x5d865c=0xce;}_0x21e684[_0xac60('0x23')](_0x5d865c);return _0x21e684['set'](_0xac60('0x29'),_0x53d16e+'-'+_0x242f55+'/'+_0x144045)[_0xac60('0x24')](_0x21c0c6);}return null;};}function patchUpdates(_0x575f8c){return function(_0x32020a){try{jsonpatch[_0xac60('0x2a')](_0x32020a,_0x575f8c,!![]);}catch(_0x453706){return BPromise['reject'](_0x453706);}return _0x32020a[_0xac60('0x2b')]();};}function saveUpdates(_0x1b460c,_0x4e104a){return function(_0x20bf9e){if(_0x20bf9e){return _0x20bf9e[_0xac60('0x2c')](_0x1b460c)[_0xac60('0x2d')](function(_0x4c816f){return _0x4c816f;});}return null;};}function removeEntity(_0x3529e8,_0x248ffc){return function(_0x1b11e3){if(_0x1b11e3){return _0x1b11e3['destroy']()['then'](function(){var _0x34e83c=_0x1b11e3['get']({'plain':!![]});var _0x20c007=_0xac60('0x2e');return db['UserProfileResource'][_0xac60('0x2f')]({'where':{'type':_0x20c007,'resourceId':_0x34e83c['id']}})[_0xac60('0x2d')](function(){return _0x1b11e3;});})[_0xac60('0x2d')](function(){_0x3529e8[_0xac60('0x23')](0xcc)[_0xac60('0x30')]();});}};}function handleEntityNotFound(_0x1a6371,_0x53ad01){return function(_0x2a5562){if(!_0x2a5562){_0x1a6371[_0xac60('0x22')](0x194);}return _0x2a5562;};}function handleError(_0x58ea73,_0x2c3fea){_0x2c3fea=_0x2c3fea||0x1f4;return function(_0x4f11d7){logger[_0xac60('0x31')](_0x4f11d7['stack']);if(_0x4f11d7[_0xac60('0x32')]){delete _0x4f11d7['name'];}_0x58ea73[_0xac60('0x23')](_0x2c3fea)[_0xac60('0x33')](_0x4f11d7);};}exports[_0xac60('0x34')]=function(_0x1b920a,_0x451d82){var _0x4710f4={},_0x89d887={},_0x4155fb={'count':0x0,'rows':[]};var _0x56eb6e=_['map'](db[_0xac60('0x35')][_0xac60('0x36')],function(_0x4fc889){return{'name':_0x4fc889['fieldName'],'type':_0x4fc889['type'][_0xac60('0x37')]};});_0x89d887[_0xac60('0x38')]=_['map'](_0x56eb6e,_0xac60('0x32'));_0x89d887[_0xac60('0x39')]=_['keys'](_0x1b920a['query']);_0x89d887['filters']=_[_0xac60('0x3a')](_0x89d887[_0xac60('0x38')],_0x89d887[_0xac60('0x39')]);_0x4710f4['attributes']=_[_0xac60('0x3a')](_0x89d887['model'],qs[_0xac60('0x3b')](_0x1b920a['query'][_0xac60('0x3b')]));_0x4710f4[_0xac60('0x3c')]=_0x4710f4[_0xac60('0x3c')][_0xac60('0x3d')]?_0x4710f4['attributes']:_0x89d887[_0xac60('0x38')];if(!_0x1b920a[_0xac60('0x39')][_0xac60('0x3e')](_0xac60('0x3f'))){_0x4710f4[_0xac60('0x27')]=qs[_0xac60('0x27')](_0x1b920a['query'][_0xac60('0x27')]);_0x4710f4[_0xac60('0x25')]=qs[_0xac60('0x25')](_0x1b920a['query'][_0xac60('0x25')]);}_0x4710f4[_0xac60('0x40')]=qs[_0xac60('0x41')](_0x1b920a[_0xac60('0x39')][_0xac60('0x41')]);_0x4710f4[_0xac60('0x42')]=qs[_0xac60('0x43')](_[_0xac60('0x44')](_0x1b920a[_0xac60('0x39')],_0x89d887['filters']),_0x56eb6e);if(_0x1b920a[_0xac60('0x39')]['filter']){_0x4710f4['where']=_[_0xac60('0x45')](_0x4710f4[_0xac60('0x42')],{'$or':_[_0xac60('0x46')](_0x56eb6e,function(_0x45d192){if(_0x45d192[_0xac60('0x47')]!==_0xac60('0x48')){var _0x435a93={};_0x435a93[_0x45d192[_0xac60('0x32')]]={'$like':'%'+_0x1b920a[_0xac60('0x39')][_0xac60('0x49')]+'%'};return _0x435a93;}})});}_0x4710f4=_['merge']({},_0x4710f4,_0x1b920a[_0xac60('0x4a')]);var _0x2fab5c={'where':_0x4710f4[_0xac60('0x42')]};return db['Plugin']['count'](_0x2fab5c)[_0xac60('0x2d')](function(_0x4bb8df){_0x4155fb['count']=_0x4bb8df;if(_0x1b920a[_0xac60('0x39')][_0xac60('0x4b')]){_0x4710f4[_0xac60('0x4c')]=[{'all':!![]}];}return db['Plugin'][_0xac60('0x4d')](_0x4710f4);})[_0xac60('0x2d')](function(_0x549db5){_0x4155fb[_0xac60('0x4e')]=_0x549db5;return _0x4155fb;})[_0xac60('0x2d')](respondWithFilteredResult(_0x451d82,_0x4710f4))[_0xac60('0x4f')](handleError(_0x451d82,null));};exports[_0xac60('0x50')]=function(_0x43be01,_0x46a590){var _0x4692a5={'raw':!![],'where':{'id':_0x43be01[_0xac60('0x51')]['id']}},_0x5528f8={};_0x5528f8['model']=_[_0xac60('0x52')](db[_0xac60('0x35')]['rawAttributes']);_0x5528f8[_0xac60('0x39')]=_[_0xac60('0x52')](_0x43be01[_0xac60('0x39')]);_0x5528f8[_0xac60('0x43')]=_[_0xac60('0x3a')](_0x5528f8[_0xac60('0x38')],_0x5528f8[_0xac60('0x39')]);_0x4692a5[_0xac60('0x3c')]=_[_0xac60('0x3a')](_0x5528f8[_0xac60('0x38')],qs['fields'](_0x43be01[_0xac60('0x39')]['fields']));_0x4692a5[_0xac60('0x3c')]=_0x4692a5[_0xac60('0x3c')][_0xac60('0x3d')]?_0x4692a5[_0xac60('0x3c')]:_0x5528f8[_0xac60('0x38')];if(_0x43be01[_0xac60('0x39')][_0xac60('0x4b')]){_0x4692a5[_0xac60('0x4c')]=[{'all':!![]}];}_0x4692a5=_['merge']({},_0x4692a5,_0x43be01['options']);return db[_0xac60('0x35')]['find'](_0x4692a5)['then'](handleEntityNotFound(_0x46a590,null))[_0xac60('0x2d')](respondWithResult(_0x46a590,null))[_0xac60('0x4f')](handleError(_0x46a590,null));};exports['download']=function(_0x2a1733,_0x31a6d5,_0x493b6f){return db[_0xac60('0x35')][_0xac60('0x53')]({'where':{'id':_0x2a1733[_0xac60('0x51')]['id']},'attributes':[_0xac60('0x32'),'path'],'raw':!![]})[_0xac60('0x2d')](handleEntityNotFound(_0x31a6d5,null))[_0xac60('0x2d')](function(_0x6a3681){if(_0x6a3681){var _0x37f9bc=path[_0xac60('0x54')](config[_0xac60('0x55')],_0xac60('0x56'),util[_0xac60('0x57')](_0xac60('0x58'),path['basename'](_0x6a3681[_0xac60('0x6')])));var _0x3e406b=fs[_0xac60('0x59')](_0x37f9bc);var _0x46ba67=archiver(_0xac60('0x5a'),{'zlib':{'level':0x9}});_0x46ba67['on']('warning',function(_0x4a3b8f){if(_0x4a3b8f[_0xac60('0x5b')]===_0xac60('0x5c')){logger['error'](_0x4a3b8f);}else{throw new db['Sequelize'][(_0xac60('0x5d'))](_0xac60('0x5e'));}});_0x46ba67['on'](_0xac60('0x31'),function(_0x25cb19){throw new db[(_0xac60('0x5f'))][(_0xac60('0x5d'))](_0xac60('0x5e'));});_0x46ba67[_0xac60('0x60')](_0x3e406b);_0x46ba67[_0xac60('0x61')](_0xac60('0x62'),{'cwd':path[_0xac60('0x54')](config[_0xac60('0x55')],_0xac60('0x56'),path[_0xac60('0x63')](_0x6a3681[_0xac60('0x6')])),'ignore':[path[_0xac60('0x54')](path[_0xac60('0x64')](_0x6a3681[_0xac60('0x6')]),'node_modules/**/*'),path[_0xac60('0x54')](path['basename'](_0x6a3681['path']),_0xac60('0x65'))],'nodir':!![]})[_0xac60('0x66')]();_0x3e406b['on'](_0xac60('0x67'),function(){if(!fs[_0xac60('0x68')](_0x37f9bc)){throw new db['Sequelize'][(_0xac60('0x5d'))](_0xac60('0x69'));}return _0x31a6d5['download'](_0x37f9bc,util[_0xac60('0x57')](_0xac60('0x58'),path[_0xac60('0x64')](_0x6a3681[_0xac60('0x6')])),function(_0x258aac){if(_0x258aac){throw new db[(_0xac60('0x5f'))][(_0xac60('0x5d'))](_0xac60('0x6a'));}fs[_0xac60('0x6b')](_0x37f9bc);logger['info'](_0xac60('0x6c'));logger[_0xac60('0x6d')](_0xac60('0x6e'));});});}return null;})['catch'](handleError(_0x31a6d5,null));};exports[_0xac60('0x6f')]=function(_0x526036,_0x11c016,_0x2432d0){var _0x2b02f9=path[_0xac60('0x64')](_0x526036[_0xac60('0x70')][_0xac60('0x71')],path[_0xac60('0x72')](_0x526036[_0xac60('0x70')][_0xac60('0x71')]));var _0xb57272=path[_0xac60('0x54')](config[_0xac60('0x55')],'server/files/plugins',_0x526036[_0xac60('0x70')]['filename']);var _0x18e37c=path[_0xac60('0x54')](config[_0xac60('0x55')],'server/files/plugins',_0x2b02f9);logger[_0xac60('0x6d')](_0xac60('0x73'),_0xb57272);logger[_0xac60('0x6d')](_0xac60('0x74'),_0x18e37c);try{fs[_0xac60('0x75')](_0xb57272,parseInt(_0xac60('0x76'),0x8));extract(_0xb57272,{'dir':_0x18e37c},function(_0x13a8ac){if(_0x13a8ac){logger['error'](_0x13a8ac);handleError(_0x13a8ac,!![]);};var _0x479180=fs['readdirSync'](_0x18e37c);if(_0x479180[_0xac60('0x3d')]>0x1){removeReferences(_0xb57272,_0x18e37c);logger[_0xac60('0x31')](_0xac60('0x77'));return _0x2432d0(new Error('Invalid\x20plugin\x20structure'));}var _0x5ab9fa=fs[_0xac60('0x78')](path[_0xac60('0x54')](_0x18e37c,_0x479180[0x0]));if(_0x5ab9fa[_0xac60('0x79')]()){removeReferences(_0xb57272,_0x18e37c);logger[_0xac60('0x31')]('Invalid\x20plugin\x20structure');return _0x2432d0(new Error(_0xac60('0x77')));}if(_0x5ab9fa['isDirectory']()){var _0x230318=fs['readdirSync'](path[_0xac60('0x54')](_0x18e37c,_0x479180[0x0]));if(_0x230318[_0xac60('0x3d')]===0x0){removeReferences(_0xb57272,_0x18e37c);logger[_0xac60('0x31')](_0xac60('0x77'));return _0x2432d0(new Error(_0xac60('0x77')));}var _0x260ebc=_0x230318[_0xac60('0x7a')](function(_0x564f6b){return _0x564f6b==='manifest.json';});if(!_0x260ebc){return _0x2432d0(new Error(_0xac60('0x7b')));}var _0x5ea468=fs[_0xac60('0x7c')](path[_0xac60('0x54')](_0x18e37c,_0x479180[0x0],'manifest.json'));var _0x276626=JSON[_0xac60('0x7d')](_0x5ea468);if(_0xac60('0x26')==typeof _0x276626[_0xac60('0x32')]){return _0x2432d0(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x276626[_0xac60('0x47')]){return _0x2432d0(new Error(_0xac60('0x7e')));}if(_0xac60('0x26')==typeof _0x276626['version']){return _0x2432d0(new Error(_0xac60('0x7f')));}if(_0xac60('0x26')==typeof _0x276626[_0xac60('0x80')]){return _0x2432d0(new Error(_0xac60('0x81')));}if(_0x276626[_0xac60('0x47')]===_0xac60('0x82')){if(_0xac60('0x26')==typeof _0x276626[_0xac60('0x80')][_0xac60('0x83')]){return _0x2432d0(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x276626[_0xac60('0x80')][_0xac60('0x83')][_0xac60('0x84')]&&_0xac60('0x26')==typeof _0x276626[_0xac60('0x80')]['views'][_0xac60('0x85')]){return _0x2432d0(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x276626[_0xac60('0x47')]===_0xac60('0x86')){if(_0xac60('0x26')==typeof _0x276626[_0xac60('0x80')][_0xac60('0x87')]){return _0x2432d0(new Error(_0xac60('0x88')));}if(_0xac60('0x26')==typeof _0x276626[_0xac60('0x80')]['scriptPath']){return _0x2432d0(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x2432d0(new Error(_0xac60('0x89')));}var _0x3d3b5a=_0x276626[_0xac60('0x32')];var _0x3c0a6d=_0x276626[_0xac60('0x8a')];var _0x6b7c9c=_0x276626[_0xac60('0x47')];var _0x54db0c=_0x276626['sidebar']?_0x276626['sidebar']:_0xac60('0x8b');var _0x27944a=_0x276626[_0xac60('0x8c')]?_0x276626[_0xac60('0x8c')]:_0xac60('0x8d');var _0x4595d6='';var _0x30ecd5='';var _0xd90484='';var _0x4fdab7='';var _0x3b44ba=_0x276626[_0xac60('0x8e')];if(_0x6b7c9c===_0xac60('0x82')){if(_0xac60('0x26')!=typeof _0x276626['parameters']['views']['admin']){var _0x2e6cae=_0x276626[_0xac60('0x80')][_0xac60('0x83')][_0xac60('0x84')];if(!/^(f|ht)tps?:\/\//i[_0xac60('0x8f')](_0x2e6cae)){_0x4595d6=path[_0xac60('0x54')](_0xac60('0x90'),_0x2b02f9,_0x479180[0x0],_0x2e6cae);}else{_0x4595d6=_0x2e6cae;}}else{logger[_0xac60('0x6d')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xac60('0x26')!=typeof _0x276626[_0xac60('0x80')][_0xac60('0x83')][_0xac60('0x85')]){var _0x2110b6=_0x276626[_0xac60('0x80')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0xac60('0x8f')](_0x2110b6)){_0x30ecd5=path['join'](_0xac60('0x90'),_0x2b02f9,_0x479180[0x0],_0x2110b6);}else{_0x30ecd5=_0x2110b6;}}else{logger[_0xac60('0x6d')](_0xac60('0x91'));}}else if(_0x6b7c9c===_0xac60('0x86')){_0xd90484=_0x276626['parameters'][_0xac60('0x87')];_0x4fdab7=_0x276626[_0xac60('0x80')]['scriptPath'];if(_0xac60('0x26')!=typeof _0x276626[_0xac60('0x80')][_0xac60('0x83')]){if(_0xac60('0x26')!=typeof _0x276626[_0xac60('0x80')][_0xac60('0x83')][_0xac60('0x84')]){var _0x2e6cae=_0x276626['parameters'][_0xac60('0x83')][_0xac60('0x84')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2e6cae)){_0x4595d6=path[_0xac60('0x54')]('plugins',_0x2b02f9,_0x479180[0x0],_0x2e6cae);}else{_0x4595d6=_0x2e6cae;}}if(_0xac60('0x26')!=typeof _0x276626[_0xac60('0x80')][_0xac60('0x83')][_0xac60('0x85')]){var _0x2110b6=_0x276626[_0xac60('0x80')]['views'][_0xac60('0x85')];if(!/^(f|ht)tps?:\/\//i[_0xac60('0x8f')](_0x2110b6)){_0x30ecd5=path[_0xac60('0x54')]('plugins',_0x2b02f9,_0x479180[0x0],_0x2110b6);}else{_0x30ecd5=_0x2110b6;}}}}var _0xeb2e4a={'name':_0x3d3b5a,'description':_0x3c0a6d,'path':path[_0xac60('0x54')](_0x2b02f9,_0x479180[0x0]),'type':_0x6b7c9c,'sidebar':_0x54db0c,'icon':_0x27944a,'adminUrl':_0x4595d6,'agentUrl':_0x30ecd5,'scriptName':_0xd90484,'scriptPath':_0x4fdab7,'version':_0x3b44ba};removeReferences(_0xb57272,null);return db[_0xac60('0x35')][_0xac60('0x92')](_0xeb2e4a)[_0xac60('0x2d')](function(_0x2de283){var _0x10c87c={'role':_0x526036[_0xac60('0x93')][_0xac60('0x94')],'userProfileId':_0x526036[_0xac60('0x93')][_0xac60('0x95')]};if(!_0x10c87c)throw new Error(_0xac60('0x96'));if(_0x10c87c[_0xac60('0x94')]===_0xac60('0x97')){var _0x4c983a=_0x2de283[_0xac60('0x98')]({'plain':!![]});return db['UserProfileSection'][_0xac60('0x53')]({'where':{'name':_0xac60('0x2e'),'userProfileId':_0x10c87c[_0xac60('0x95')]},'raw':!![]})['then'](function(_0x19432a){if(_0x19432a&&_0x19432a[_0xac60('0x99')]===0x0){return db[_0xac60('0x9a')][_0xac60('0x92')]({'name':_0x4c983a[_0xac60('0x32')],'resourceId':_0x4c983a['id'],'type':_0x19432a[_0xac60('0x32')],'sectionId':_0x19432a['id']},{})[_0xac60('0x2d')](function(){return _0x2de283;});}else{return _0x2de283;}})[_0xac60('0x4f')](function(_0x5015d9){logger[_0xac60('0x31')](_0xac60('0x9b'),_0x5015d9);throw _0x5015d9;});}return _0x2de283;})['then'](respondWithResult(_0x11c016,null))[_0xac60('0x4f')](handleError(_0x11c016,null));}});}catch(_0x9ab1e8){_0x11c016['status'](0x1f4)[_0xac60('0x33')](_0x9ab1e8);}};function removeReferences(_0xf48d6b,_0x27ab0e){try{if(_0xf48d6b){fs['unlinkSync'](_0xf48d6b);logger[_0xac60('0x6d')](_0xac60('0x9c'));}if(_0x27ab0e){rimraf(_0x27ab0e,function(){});logger[_0xac60('0x6d')](_0xac60('0x9d'));}}catch(_0x5da03f){logger[_0xac60('0x31')](_0x5da03f);}}exports[_0xac60('0x2c')]=function(_0x4c06b2,_0xf22dee,_0x1d6f9f){return db[_0xac60('0x35')]['find']({'where':{'id':_0x4c06b2[_0xac60('0x51')]['id']}})[_0xac60('0x2d')](handleEntityNotFound(_0xf22dee,null))[_0xac60('0x2d')](saveUpdates(_0x4c06b2['body'],null))['then'](respondWithResult(_0xf22dee,null))[_0xac60('0x4f')](handleError(_0xf22dee,null));};exports[_0xac60('0x9e')]=function(_0x317519,_0x2ff0e0,_0x7862b2){return db['Plugin'][_0xac60('0x53')]({'where':{'id':_0x317519[_0xac60('0x51')]['id']}})['then'](function(_0xf8131c){if(_0xf8131c){return _0xf8131c['destroy']();}})[_0xac60('0x2d')](function(_0x4b5b45){rimraf(path[_0xac60('0x54')](config[_0xac60('0x55')],_0xac60('0x56'),path[_0xac60('0x63')](_0x4b5b45[_0xac60('0x6')])),function(){});return _0x4b5b45;})[_0xac60('0x2d')](handleEntityNotFound(_0x2ff0e0,null))[_0xac60('0x2d')](respondWithStatusCode(_0x2ff0e0,null))[_0xac60('0x4f')](handleError(_0x2ff0e0,null));};exports[_0xac60('0x9f')]=function(_0xa561ba,_0x55c7ae,_0xb813f7){return BPromise['resolve']()[_0xac60('0x2d')](function(){if(!_0xa561ba[_0xac60('0x39')][_0xac60('0x6')]){throw new Error(_0xac60('0xa0'));}if(!_0xa561ba['query'][_0xac60('0xa1')]){throw new Error(_0xac60('0xa2'));}var _0x4aef7d=_0xa561ba[_0xac60('0x39')]['hostname']?_0xa561ba['query'][_0xac60('0xa3')]+':'+_0xa561ba[_0xac60('0x39')][_0xac60('0xa1')]:_0xac60('0xa4')+_0xa561ba['query'][_0xac60('0xa1')];var _0x17c403=_0xa561ba['query'][_0xac60('0x24')]?_0xa561ba[_0xac60('0x39')]['json']:!![];var _0x28d5ad=_0xa561ba[_0xac60('0x39')][_0xac60('0xa5')]?_0xa561ba[_0xac60('0x39')][_0xac60('0xa5')]:null;var _0x8f5fe3={'method':_0xa561ba[_0xac60('0xa6')],'uri':util[_0xac60('0x57')](_0xac60('0xa7'),_0x4aef7d,_0xa561ba[_0xac60('0x39')][_0xac60('0x6')]),'json':_0x17c403,'resolveWithFullResponse':!![],'encoding':_0x28d5ad,'qs':_0xa561ba[_0xac60('0x39')]};if(_0xa561ba[_0xac60('0xa8')]){_0x8f5fe3[_0xac60('0xa8')]=_0xa561ba[_0xac60('0xa8')];if(_0x8f5fe3[_0xac60('0xa8')]['content-length']){delete _0x8f5fe3['headers'][_0xac60('0xa9')];}}if(_0x8f5fe3['headers']['content-type']){delete _0x8f5fe3['headers'][_0xac60('0xaa')];}return rp(_0x8f5fe3);})[_0xac60('0x2d')](function(_0x4fb749){if(_0x4fb749){_0x55c7ae['set'](_0x4fb749['headers']);logger[_0xac60('0x6d')](_0x4fb749[_0xac60('0x93')]);if(_[_0xac60('0xab')](_0xa561ba[_0xac60('0x39')]['path'],_0xac60('0xac'))&&_0x4fb749['statusCode']==0x1f4){return _0x55c7ae['sendStatus'](_0x4fb749['statusCode']);}else{return _0x55c7ae[_0xac60('0x23')](_0x4fb749[_0xac60('0xad')])[_0xac60('0x33')](_0x4fb749[_0xac60('0x93')]);}}else{return _0x55c7ae['sendStatus'](0xc8);}})[_0xac60('0x4f')](handleError(_0x55c7ae,null));};exports[_0xac60('0xae')]=function(_0x287a19,_0x4802cd,_0x2b65c0){return BPromise[_0xac60('0xaf')]()[_0xac60('0x2d')](function(){if(!_0x287a19['query'][_0xac60('0x6')]){throw new Error(_0xac60('0xa0'));}if(!_0x287a19[_0xac60('0x39')][_0xac60('0xa1')]){throw new Error(_0xac60('0xa2'));}var _0x5cc04d=_0x287a19[_0xac60('0x39')][_0xac60('0xa3')]?_0x287a19[_0xac60('0x39')]['hostname']+':'+_0x287a19[_0xac60('0x39')][_0xac60('0xa1')]:_0xac60('0xa4')+_0x287a19[_0xac60('0x39')][_0xac60('0xa1')];var _0x3122c6=_0x287a19[_0xac60('0x39')][_0xac60('0x24')]?_0x287a19['query'][_0xac60('0x24')]:!![];var _0xed469b=_0x287a19['query']['encoding']?_0x287a19[_0xac60('0x39')][_0xac60('0xa5')]:null;var _0x52ebad={'method':_0x287a19[_0xac60('0xa6')],'uri':util['format'](_0xac60('0xa7'),_0x5cc04d,_0x287a19[_0xac60('0x39')][_0xac60('0x6')]),'json':_0x3122c6,'resolveWithFullResponse':!![],'encoding':_0xed469b,'body':_0x287a19[_0xac60('0x93')]};if(_0x287a19[_0xac60('0xa8')]){_0x52ebad[_0xac60('0xa8')]=_0x287a19[_0xac60('0xa8')];if(_0x52ebad['headers'][_0xac60('0xa9')]){delete _0x52ebad[_0xac60('0xa8')][_0xac60('0xa9')];}}if(_0x52ebad['headers'][_0xac60('0xaa')]){delete _0x52ebad[_0xac60('0xa8')]['content-type'];}return rp(_0x52ebad);})[_0xac60('0x2d')](function(_0x21dab6){if(_0x21dab6){_0x4802cd['set'](_0x21dab6['headers']);logger[_0xac60('0x6d')](_0x21dab6['body']);return _0x4802cd[_0xac60('0x23')](_0x21dab6['statusCode'])['send'](_0x21dab6[_0xac60('0x93')]);}else{return _0x4802cd[_0xac60('0x22')](0xc8);}})[_0xac60('0x4f')](handleError(_0x4802cd,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index a129ad6..e6d0207 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 _0xe015=['update','emit','hasOwnProperty','events','../../mysqldb','Plugin'];(function(_0x55d391,_0x335662){var _0x1dce88=function(_0x2ba7b2){while(--_0x2ba7b2){_0x55d391['push'](_0x55d391['shift']());}};_0x1dce88(++_0x335662);}(_0xe015,0x13b));var _0x5e01=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xe015[_0x2be8c2];return _0x97f531;};'use strict';var EventEmitter=require(_0x5e01('0x0'));var Plugin=require(_0x5e01('0x1'))['db'][_0x5e01('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5e01('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2136cf){return function(_0x420f00,_0x7ce4b9,_0x241c0e){PluginEvents['emit'](_0x2136cf+':'+_0x420f00['id'],_0x420f00);PluginEvents[_0x5e01('0x4')](_0x2136cf,_0x420f00);_0x241c0e(null);};}for(var e in events){if(events[_0x5e01('0x5')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0xe700=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners'];(function(_0x351974,_0x4007d2){var _0x5649f4=function(_0x19e854){while(--_0x19e854){_0x351974['push'](_0x351974['shift']());}};_0x5649f4(++_0x4007d2);}(_0xe700,0x75));var _0x0e70=function(_0x3bfcbe,_0xd4935e){_0x3bfcbe=_0x3bfcbe-0x0;var _0x1eb8da=_0xe700[_0x3bfcbe];return _0x1eb8da;};'use strict';var EventEmitter=require(_0x0e70('0x0'));var Plugin=require(_0x0e70('0x1'))['db'][_0x0e70('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x0e70('0x3')](0x0);var events={'afterCreate':_0x0e70('0x4'),'afterUpdate':_0x0e70('0x5'),'afterDestroy':_0x0e70('0x6')};function emitEvent(_0x34f087){return function(_0x27ba59,_0xb9349a,_0x55e41f){PluginEvents[_0x0e70('0x7')](_0x34f087+':'+_0x27ba59['id'],_0x27ba59);PluginEvents['emit'](_0x34f087,_0x27ba59);_0x55e41f(null);};}for(var e in events){if(events[_0x0e70('0x8')](e)){var event=events[e];Plugin[_0x0e70('0x9')](e,emitEvent(event));}}module[_0x0e70('0xa')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 751a1eb..7c59483 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 _0xc7e2=['lodash','util','bluebird','path','rimraf','../../config/environment','./plugin.attributes','exports','define'];(function(_0x5f3b46,_0x260c4e){var _0x4a14d4=function(_0x29b2f6){while(--_0x29b2f6){_0x5f3b46['push'](_0x5f3b46['shift']());}};_0x4a14d4(++_0x260c4e);}(_0xc7e2,0x1d4));var _0x2c7e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7e2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2c7e('0x0'));var util=require(_0x2c7e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2c7e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c7e('0x3'));var rimraf=require(_0x2c7e('0x4'));var config=require(_0x2c7e('0x5'));var attributes=require(_0x2c7e('0x6'));module[_0x2c7e('0x7')]=function(_0x39a24c,_0x2e4651){return _0x39a24c[_0x2c7e('0x8')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e20=['Plugin','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x3a5c6c,_0x5b8ba1){var _0x62d29c=function(_0x1c8a2b){while(--_0x1c8a2b){_0x3a5c6c['push'](_0x3a5c6c['shift']());}};_0x62d29c(++_0x5b8ba1);}(_0x4e20,0x121));var _0x04e2=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x4e20[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0x04e2('0x0'));var util=require(_0x04e2('0x1'));var logger=require(_0x04e2('0x2'))(_0x04e2('0x3'));var moment=require(_0x04e2('0x4'));var BPromise=require(_0x04e2('0x5'));var rp=require(_0x04e2('0x6'));var fs=require('fs');var path=require(_0x04e2('0x7'));var rimraf=require(_0x04e2('0x8'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0x04e2('0x9')]=function(_0x143381,_0x5e62e4){return _0x143381[_0x04e2('0xa')](_0x04e2('0xb'),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 30ec755..62a85fd 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 _0xe931=['client','http','redis','defaults','localhost','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','Plugin','options','raw','debug','CreatePlugin','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0xa7cf3,_0x561cb2){var _0x1de1eb=function(_0xe00b39){while(--_0xe00b39){_0xa7cf3['push'](_0xa7cf3['shift']());}};_0x1de1eb(++_0x561cb2);}(_0xe931,0x1e6));var _0x1e93=function(_0x34439d,_0x40fd9d){_0x34439d=_0x34439d-0x0;var _0x26b8a1=_0xe931[_0x34439d];return _0x26b8a1;};'use strict';var _=require('lodash');var util=require(_0x1e93('0x0'));var moment=require('moment');var BPromise=require(_0x1e93('0x1'));var rs=require(_0x1e93('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1e93('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e93('0x4'))(_0x1e93('0x5'));var config=require('../../config/environment');var jayson=require(_0x1e93('0x6'));var client=jayson[_0x1e93('0x7')][_0x1e93('0x8')]({'port':0x232a});config[_0x1e93('0x9')]=_[_0x1e93('0xa')](config['redis'],{'host':_0x1e93('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1e93('0x9')]));require('./plugin.socket')[_0x1e93('0xc')](socket);function respondWithRpcPromise(_0x40e87d,_0x20a63b,_0x5c6ef5){return new BPromise(function(_0x51554a,_0x51c372){return client[_0x1e93('0xd')](_0x40e87d,_0x5c6ef5)[_0x1e93('0xe')](function(_0x18a3ea){logger[_0x1e93('0xf')](_0x1e93('0x10'),_0x20a63b,_0x1e93('0x11'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x20a63b,_0x1e93('0x11'),JSON[_0x1e93('0x12')](_0x18a3ea));if(_0x18a3ea['error']){if(_0x18a3ea['error'][_0x1e93('0x13')]===0x1f4){logger['error'](_0x1e93('0x10'),_0x20a63b,_0x18a3ea[_0x1e93('0x14')][_0x1e93('0x15')]);return _0x51c372(_0x18a3ea['error'][_0x1e93('0x15')]);}logger['error']('Plugin,\x20%s,\x20%s',_0x20a63b,_0x18a3ea[_0x1e93('0x14')][_0x1e93('0x15')]);return _0x51554a(_0x18a3ea['error']['message']);}else{logger[_0x1e93('0xf')](_0x1e93('0x10'),_0x20a63b,_0x1e93('0x11'));_0x51554a(_0x18a3ea[_0x1e93('0x16')][_0x1e93('0x15')]);}})[_0x1e93('0x17')](function(_0x437a18){logger[_0x1e93('0x14')]('Plugin,\x20%s,\x20%s',_0x20a63b,_0x437a18);_0x51c372(_0x437a18);});});}exports['CreatePlugin']=function(_0x4405e2){var _0x35185e=this;return new Promise(function(_0x19244c,_0x34704b){return db[_0x1e93('0x18')]['create'](_0x4405e2['body'],{'raw':_0x4405e2[_0x1e93('0x19')]?_0x4405e2[_0x1e93('0x19')][_0x1e93('0x1a')]===undefined?!![]:![]:!![]})[_0x1e93('0xe')](function(_0x32ab6d){logger['info']('CreatePlugin',_0x4405e2);logger[_0x1e93('0x1b')](_0x1e93('0x1c'),_0x4405e2,JSON[_0x1e93('0x12')](_0x32ab6d));_0x19244c(_0x32ab6d);})[_0x1e93('0x17')](function(_0x16e9c0){logger[_0x1e93('0x14')](_0x1e93('0x1c'),_0x16e9c0[_0x1e93('0x15')],_0x4405e2);_0x34704b(_0x35185e[_0x1e93('0x14')](0x1f4,_0x16e9c0[_0x1e93('0x15')]));});});}; \ No newline at end of file +var _0x069d=['body','options','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreatePlugin','create'];(function(_0x4d3d1f,_0x5eddf8){var _0x2dbb2e=function(_0x1c350e){while(--_0x1c350e){_0x4d3d1f['push'](_0x4d3d1f['shift']());}};_0x2dbb2e(++_0x5eddf8);}(_0x069d,0x11a));var _0xd069=function(_0x109348,_0x333600){_0x109348=_0x109348-0x0;var _0x4b1c61=_0x069d[_0x109348];return _0x4b1c61;};'use strict';var _=require(_0xd069('0x0'));var util=require('util');var moment=require(_0xd069('0x1'));var BPromise=require('bluebird');var rs=require(_0xd069('0x2'));var fs=require('fs');var Redis=require(_0xd069('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd069('0x4'));var logger=require(_0xd069('0x5'))('rpc');var config=require(_0xd069('0x6'));var jayson=require(_0xd069('0x7'));var client=jayson['client'][_0xd069('0x8')]({'port':0x232a});config[_0xd069('0x9')]=_['defaults'](config[_0xd069('0x9')],{'host':_0xd069('0xa'),'port':0x18eb});var socket=require(_0xd069('0xb'))(new Redis(config['redis']));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x24b3d7,_0x3e0233,_0x439bfa){return new BPromise(function(_0x339852,_0x217d2c){return client[_0xd069('0xc')](_0x24b3d7,_0x439bfa)[_0xd069('0xd')](function(_0xddefd7){logger[_0xd069('0xe')](_0xd069('0xf'),_0x3e0233,_0xd069('0x10'));logger[_0xd069('0x11')](_0xd069('0x12'),_0x3e0233,'request\x20sent',JSON[_0xd069('0x13')](_0xddefd7));if(_0xddefd7['error']){if(_0xddefd7[_0xd069('0x14')][_0xd069('0x15')]===0x1f4){logger[_0xd069('0x14')](_0xd069('0xf'),_0x3e0233,_0xddefd7[_0xd069('0x14')][_0xd069('0x16')]);return _0x217d2c(_0xddefd7['error'][_0xd069('0x16')]);}logger['error'](_0xd069('0xf'),_0x3e0233,_0xddefd7[_0xd069('0x14')]['message']);return _0x339852(_0xddefd7[_0xd069('0x14')][_0xd069('0x16')]);}else{logger[_0xd069('0xe')](_0xd069('0xf'),_0x3e0233,_0xd069('0x10'));_0x339852(_0xddefd7[_0xd069('0x17')][_0xd069('0x16')]);}})['catch'](function(_0x2e30a0){logger['error']('Plugin,\x20%s,\x20%s',_0x3e0233,_0x2e30a0);_0x217d2c(_0x2e30a0);});});}exports[_0xd069('0x18')]=function(_0x286181){var _0x1db98a=this;return new Promise(function(_0x58963b,_0x141e06){return db['Plugin'][_0xd069('0x19')](_0x286181[_0xd069('0x1a')],{'raw':_0x286181[_0xd069('0x1b')]?_0x286181[_0xd069('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1667fb){logger['info'](_0xd069('0x18'),_0x286181);logger[_0xd069('0x11')](_0xd069('0x18'),_0x286181,JSON[_0xd069('0x13')](_0x1667fb));_0x58963b(_0x1667fb);})['catch'](function(_0x3df557){logger['error'](_0xd069('0x18'),_0x3df557[_0xd069('0x16')],_0x286181);_0x141e06(_0x1db98a[_0xd069('0x14')](0x1f4,_0x3df557[_0xd069('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index c59383f..ade3c73 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 _0x908b=['./plugin.events','save','remove','update','emit','register','length','plugin:'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x908b,0xa8));var _0xb908=function(_0x5b97cd,_0x4ae13d){_0x5b97cd=_0x5b97cd-0x0;var _0x542b3d=_0x908b[_0x5b97cd];return _0x542b3d;};'use strict';var PluginEvents=require(_0xb908('0x0'));var events=[_0xb908('0x1'),_0xb908('0x2'),_0xb908('0x3')];function createListener(_0x5bbaf2,_0x492272){return function(_0x1bf4e9){_0x492272[_0xb908('0x4')](_0x5bbaf2,_0x1bf4e9);};}function removeListener(_0x35516b,_0x28b5a3){return function(){PluginEvents['removeListener'](_0x35516b,_0x28b5a3);};}exports[_0xb908('0x5')]=function(_0x41ace4){for(var _0x23f373=0x0,_0xd43707=events[_0xb908('0x6')];_0x23f373<_0xd43707;_0x23f373++){var _0x23a6d6=events[_0x23f373];var _0x87c2d0=createListener(_0xb908('0x7')+_0x23a6d6,_0x41ace4);PluginEvents['on'](_0x23a6d6,_0x87c2d0);}}; \ No newline at end of file +var _0x9eef=['emit','removeListener','register','plugin:','./plugin.events','save','remove','update'];(function(_0x48799b,_0x75e289){var _0x12a22f=function(_0x29d1ca){while(--_0x29d1ca){_0x48799b['push'](_0x48799b['shift']());}};_0x12a22f(++_0x75e289);}(_0x9eef,0x1f4));var _0xf9ee=function(_0x4629ed,_0x59ef85){_0x4629ed=_0x4629ed-0x0;var _0x52ca04=_0x9eef[_0x4629ed];return _0x52ca04;};'use strict';var PluginEvents=require(_0xf9ee('0x0'));var events=[_0xf9ee('0x1'),_0xf9ee('0x2'),_0xf9ee('0x3')];function createListener(_0x58822e,_0x5a3fd4){return function(_0x14e8f2){_0x5a3fd4[_0xf9ee('0x4')](_0x58822e,_0x14e8f2);};}function removeListener(_0x27db36,_0x346350){return function(){PluginEvents[_0xf9ee('0x5')](_0x27db36,_0x346350);};}exports[_0xf9ee('0x6')]=function(_0x58ecef){for(var _0x1d911f=0x0,_0x1d2b8f=events['length'];_0x1d911f<_0x1d2b8f;_0x1d911f++){var _0x5c75c1=events[_0x1d911f];var _0xf46bb7=createListener(_0xf9ee('0x7')+_0x5c75c1,_0x58ecef);PluginEvents['on'](_0x5c75c1,_0xf46bb7);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 4760846..cca0188 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(_0x35e7f5,_0x505458){var _0x21327e=function(_0x24ee98){while(--_0x24ee98){_0x35e7f5['push'](_0x35e7f5['shift']());}};_0x21327e(++_0x505458);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x4dcb03,_0x40c348){var _0x36d490=function(_0x26f9b2){while(--_0x26f9b2){_0x4dcb03['push'](_0x4dcb03['shift']());}};_0x36d490(++_0x40c348);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 eddf883..7156ce0 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 _0x2547=['express','length','catch','show','describe','create','body','script','join','../../files/plugins','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','params','Unknown\x20status','delete','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','name','send','npm\x20install','info','error','index','list','then','reject'];(function(_0x53756d,_0x3dba74){var _0x12a440=function(_0x13790b){while(--_0x13790b){_0x53756d['push'](_0x53756d['shift']());}};_0x12a440(++_0x3dba74);}(_0x2547,0x1cd));var _0x7254=function(_0x4234ed,_0x970851){_0x4234ed=_0x4234ed-0x0;var _0x4d3cfb=_0x2547[_0x4234ed];return _0x4d3cfb;};'use strict';var _=require('lodash');var pm2=require(_0x7254('0x0'));var logger=require(_0x7254('0x1'))(_0x7254('0x2'));var path=require(_0x7254('0x3'));var exec=require(_0x7254('0x4'))[_0x7254('0x5')];var BPromise=require(_0x7254('0x6'));function handleEntityNotFound(_0x265ebf,_0x53a02f){return function(_0x2ddeae){if(!_0x2ddeae){_0x265ebf[_0x7254('0x7')](0x194);;}return _0x2ddeae;};}function respondWithResult(_0x67f427,_0x119f66){_0x119f66=_0x119f66||0xc8;return function(_0x4b845f){if(_0x4b845f){return _0x67f427[_0x7254('0x8')](_0x119f66)[_0x7254('0x9')](_0x4b845f);}return null;};}function handleError(_0x395913,_0x5da1ec){_0x5da1ec=_0x5da1ec||0x1f4;return function(_0x2a2f82){logger['error'](_0x2a2f82['stack']);if(_0x2a2f82['name']){delete _0x2a2f82[_0x7254('0xa')];}_0x395913[_0x7254('0x8')](_0x5da1ec)[_0x7254('0xb')](_0x2a2f82);};}function execChildProcess(){return new BPromise(function(_0x310c21,_0x6828b6){exec(_0x7254('0xc'),function(_0x4d19e8,_0x3275bd,_0x5ec311){logger[_0x7254('0xd')](_0x3275bd);logger['info'](_0x5ec311);if(_0x4d19e8){logger[_0x7254('0xe')](_0x4d19e8);return _0x6828b6(_0x4d19e8);}return _0x310c21(_0x3275bd);});});}exports[_0x7254('0xf')]=function(_0x348d4e,_0x120780){return pm2[_0x7254('0x10')]()[_0x7254('0x11')](function(_0x124192){if(_0x124192){var _0x21cecc=_[_0x7254('0x12')](_0x124192,function(_0x362a1){return _0x362a1[_0x7254('0xa')]===_0x7254('0x13')||_0x362a1[_0x7254('0xa')]==='motion2';});return{'rows':_0x21cecc,'count':_0x21cecc[_0x7254('0x14')]};}return null;})[_0x7254('0x11')](respondWithResult(_0x120780,null))[_0x7254('0x15')](handleError(_0x120780,null));};exports[_0x7254('0x16')]=function(_0x3b5f06,_0x1e4aff){return pm2[_0x7254('0x17')](_0x3b5f06['params']['id'])[_0x7254('0x11')](respondWithResult(_0x1e4aff,null))[_0x7254('0x11')](handleEntityNotFound(_0x1e4aff,null))[_0x7254('0x15')](handleError(_0x1e4aff,null));};exports[_0x7254('0x18')]=function(_0x2a1ddc,_0x301f00){if(_0x2a1ddc[_0x7254('0x19')][_0x7254('0xa')]&&_0x2a1ddc[_0x7254('0x19')][_0x7254('0x1a')]){var _0x2594b8=path[_0x7254('0x1b')](__dirname,_0x7254('0x1c'),_0x2a1ddc[_0x7254('0x19')][_0x7254('0x1a')]);var _0x95ceaa=process[_0x7254('0x1d')]();process[_0x7254('0x1e')](path[_0x7254('0x1f')](_0x2594b8));return execChildProcess()[_0x7254('0x11')](function(_0x1be69b){process['chdir'](_0x95ceaa);return pm2['start']({'name':_0x2a1ddc[_0x7254('0x19')][_0x7254('0xa')],'script':_0x2594b8});})[_0x7254('0x11')](function(_0x54dace){pm2[_0x7254('0x20')]();return _0x54dace[0x0];})[_0x7254('0x11')](respondWithResult(_0x301f00,0xc9))[_0x7254('0x15')](handleError(_0x301f00,null));}else{return _0x301f00['status'](0x1f4)[_0x7254('0xb')]({'message':_0x7254('0x21')});}};exports[_0x7254('0x22')]=function(_0x494cdb,_0x3c22d0){if(_0x494cdb['body']['id']){delete _0x494cdb[_0x7254('0x19')]['id'];}var _0x134a9e={'online':'restart','stopped':_0x7254('0x23')};if(_0x134a9e[_0x7254('0x24')](_0x494cdb['body'][_0x7254('0x8')])){return pm2[_0x134a9e[_0x494cdb[_0x7254('0x19')][_0x7254('0x8')]]](_0x494cdb[_0x7254('0x25')]['id'])[_0x7254('0x11')](respondWithResult(_0x3c22d0,0xc8))[_0x7254('0x15')](handleError(_0x3c22d0,null));}else{return _0x3c22d0['status'](0x1f4)[_0x7254('0xb')]({'message':_0x7254('0x26')});}};exports['destroy']=function(_0x2f75ea,_0x1279cd){if(_0x2f75ea[_0x7254('0x19')]['id']){delete _0x2f75ea['body']['id'];}if(_0x2f75ea[_0x7254('0x25')]['id']){return pm2[_0x7254('0x27')](_0x2f75ea[_0x7254('0x25')]['id'])[_0x7254('0x11')](function(_0x40a137){pm2[_0x7254('0x20')]();return _0x40a137[0x0];})[_0x7254('0x11')](respondWithResult(_0x1279cd,null))['catch'](handleError(_0x1279cd,null));}else{return _0x1279cd[_0x7254('0x8')](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xb9a7=['name','npm\x20install','info','error','index','list','reject','express','motion2','length','catch','describe','params','then','create','body','../../files/plugins','script','cwd','dirname','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','Unknown\x20status','destroy','Unknown\x20id','../../config/pm2','child_process','bluebird','sendStatus','status','json'];(function(_0x30e41d,_0x141592){var _0xa6c0e3=function(_0xbfa7c){while(--_0xbfa7c){_0x30e41d['push'](_0x30e41d['shift']());}};_0xa6c0e3(++_0x141592);}(_0xb9a7,0x112));var _0x7b9a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb9a7[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var pm2=require(_0x7b9a('0x0'));var logger=require('../../config/logger')('api');var path=require('path');var exec=require(_0x7b9a('0x1'))['exec'];var BPromise=require(_0x7b9a('0x2'));function handleEntityNotFound(_0x40ef7d,_0x37b25b){return function(_0x24cae3){if(!_0x24cae3){_0x40ef7d[_0x7b9a('0x3')](0x194);;}return _0x24cae3;};}function respondWithResult(_0xf6dae2,_0x22764f){_0x22764f=_0x22764f||0xc8;return function(_0x7019fd){if(_0x7019fd){return _0xf6dae2[_0x7b9a('0x4')](_0x22764f)[_0x7b9a('0x5')](_0x7019fd);}return null;};}function handleError(_0x4d3f20,_0x43d8e2){_0x43d8e2=_0x43d8e2||0x1f4;return function(_0x3e84f1){logger['error'](_0x3e84f1['stack']);if(_0x3e84f1['name']){delete _0x3e84f1[_0x7b9a('0x6')];}_0x4d3f20[_0x7b9a('0x4')](_0x43d8e2)['send'](_0x3e84f1);};}function execChildProcess(){return new BPromise(function(_0x32c85d,_0x5b13f3){exec(_0x7b9a('0x7'),function(_0x597732,_0x3af176,_0x1584a2){logger[_0x7b9a('0x8')](_0x3af176);logger['info'](_0x1584a2);if(_0x597732){logger[_0x7b9a('0x9')](_0x597732);return _0x5b13f3(_0x597732);}return _0x32c85d(_0x3af176);});});}exports[_0x7b9a('0xa')]=function(_0x5e3875,_0x67553c){return pm2[_0x7b9a('0xb')]()['then'](function(_0xb157e5){if(_0xb157e5){var _0xde180d=_[_0x7b9a('0xc')](_0xb157e5,function(_0x2853f2){return _0x2853f2[_0x7b9a('0x6')]===_0x7b9a('0xd')||_0x2853f2[_0x7b9a('0x6')]===_0x7b9a('0xe');});return{'rows':_0xde180d,'count':_0xde180d[_0x7b9a('0xf')]};}return null;})['then'](respondWithResult(_0x67553c,null))[_0x7b9a('0x10')](handleError(_0x67553c,null));};exports['show']=function(_0x123921,_0xa217cb){return pm2[_0x7b9a('0x11')](_0x123921[_0x7b9a('0x12')]['id'])[_0x7b9a('0x13')](respondWithResult(_0xa217cb,null))[_0x7b9a('0x13')](handleEntityNotFound(_0xa217cb,null))[_0x7b9a('0x10')](handleError(_0xa217cb,null));};exports[_0x7b9a('0x14')]=function(_0x2064a0,_0x588c48){if(_0x2064a0[_0x7b9a('0x15')][_0x7b9a('0x6')]&&_0x2064a0[_0x7b9a('0x15')]['script']){var _0x993048=path['join'](__dirname,_0x7b9a('0x16'),_0x2064a0['body'][_0x7b9a('0x17')]);var _0x331ae6=process[_0x7b9a('0x18')]();process['chdir'](path[_0x7b9a('0x19')](_0x993048));return execChildProcess()[_0x7b9a('0x13')](function(_0x5705b2){process[_0x7b9a('0x1a')](_0x331ae6);return pm2[_0x7b9a('0x1b')]({'name':_0x2064a0[_0x7b9a('0x15')][_0x7b9a('0x6')],'script':_0x993048});})[_0x7b9a('0x13')](function(_0x5b2f52){pm2[_0x7b9a('0x1c')]();return _0x5b2f52[0x0];})[_0x7b9a('0x13')](respondWithResult(_0x588c48,0xc9))['catch'](handleError(_0x588c48,null));}else{return _0x588c48[_0x7b9a('0x4')](0x1f4)['send']({'message':_0x7b9a('0x1d')});}};exports[_0x7b9a('0x1e')]=function(_0x4c2271,_0x55d01c){if(_0x4c2271[_0x7b9a('0x15')]['id']){delete _0x4c2271['body']['id'];}var _0x54df8a={'online':_0x7b9a('0x1f'),'stopped':'stop'};if(_0x54df8a['hasOwnProperty'](_0x4c2271[_0x7b9a('0x15')]['status'])){return pm2[_0x54df8a[_0x4c2271[_0x7b9a('0x15')][_0x7b9a('0x4')]]](_0x4c2271['params']['id'])[_0x7b9a('0x13')](respondWithResult(_0x55d01c,0xc8))[_0x7b9a('0x10')](handleError(_0x55d01c,null));}else{return _0x55d01c[_0x7b9a('0x4')](0x1f4)['send']({'message':_0x7b9a('0x20')});}};exports[_0x7b9a('0x21')]=function(_0x181e9c,_0x6c8b1f){if(_0x181e9c[_0x7b9a('0x15')]['id']){delete _0x181e9c[_0x7b9a('0x15')]['id'];}if(_0x181e9c['params']['id']){return pm2['delete'](_0x181e9c[_0x7b9a('0x12')]['id'])[_0x7b9a('0x13')](function(_0x6daf3c){pm2['dump']();return _0x6daf3c[0x0];})[_0x7b9a('0x13')](respondWithResult(_0x6c8b1f,null))[_0x7b9a('0x10')](handleError(_0x6c8b1f,null));}else{return _0x6c8b1f['status'](0x1f4)['send']({'message':_0x7b9a('0x22')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 324f800..5c8e37c 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 _0xec13=['getQueues','express','Router','../../components/auth/service','get','/agents','isAuthenticated','getAgents'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xec13,0x119));var _0x3ec1=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xec13[_0x6c993a];return _0x27f547;};'use strict';var express=require(_0x3ec1('0x0'));var router=express[_0x3ec1('0x1')]();var auth=require(_0x3ec1('0x2'));var controller=require('./realtime.controller');router[_0x3ec1('0x3')](_0x3ec1('0x4'),auth[_0x3ec1('0x5')](),controller[_0x3ec1('0x6')]);router[_0x3ec1('0x3')]('/queues',auth[_0x3ec1('0x5')](),controller[_0x3ec1('0x7')]);module['exports']=router; \ No newline at end of file +var _0xb837=['/queues','getQueues','exports','express','Router','../../components/auth/service','get','/agents','isAuthenticated','getAgents'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0xb837,0x7b));var _0x7b83=function(_0x494ce2,_0x397591){_0x494ce2=_0x494ce2-0x0;var _0x52ec77=_0xb837[_0x494ce2];return _0x52ec77;};'use strict';var express=require(_0x7b83('0x0'));var router=express[_0x7b83('0x1')]();var auth=require(_0x7b83('0x2'));var controller=require('./realtime.controller');router[_0x7b83('0x3')](_0x7b83('0x4'),auth[_0x7b83('0x5')](),controller[_0x7b83('0x6')]);router[_0x7b83('0x3')](_0x7b83('0x7'),auth['isAuthenticated'](),controller[_0x7b83('0x8')]);module[_0x7b83('0x9')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 68c3f28..4e26504 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 _0xe4d8=['getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','rawAttributes','fieldName','key','role','agent','online','getOptions','raw','push','sequelize','literal','FIELD(id,','forEach','Pause','where','user','Agents','extraQueryConditions','UserProfile','getResources','User','findAndCountAll','filterAgentAttributes','merge','getAgentStatus','Status','sortAgentsByStatus','split','pick','rows','catch','getQueues','Channel\x20parameter\x20%s\x20is\x20invalid','startCase','Queue','type','dialActive','join','userProfileId','voice','outbound','QueueCampaigns','Queues','name','getRealtimeQueues','initializeQueues','util','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','set','Content-Range','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','isValidChannel','format','toLowerCase','includes','globalStatus','sort','validateSortParameter','getUpdatedSortOptions','fields','order','getRealtimeAgents'];(function(_0xf75894,_0x1a456a){var _0x362a66=function(_0x3d6023){while(--_0x3d6023){_0xf75894['push'](_0xf75894['shift']());}};_0x362a66(++_0x1a456a);}(_0xe4d8,0x134));var _0x8e4d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xe4d8[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x8e4d('0x0'));var rta=require('../../components/realtime/agents');var rtq=require(_0x8e4d('0x1'));var qs=require(_0x8e4d('0x2'));var utils=require(_0x8e4d('0x3'));var db=require(_0x8e4d('0x4'))['db'];var APIBadRequestError=require(_0x8e4d('0x5'))[_0x8e4d('0x6')];var APIHandleError=require('../../errors/api')[_0x8e4d('0x7')];function respondWithFilteredResult(_0xfcce6e,_0x4c201b){return function(_0x99eb10){if(_0x99eb10){var _0x3ea31e=typeof _0x4c201b[_0x8e4d('0x8')]===_0x8e4d('0x9')&&typeof _0x4c201b[_0x8e4d('0xa')]===_0x8e4d('0x9');var _0x4387c3=_0x99eb10[_0x8e4d('0xb')];var _0x739bde=_0x3ea31e?0x0:_0x4c201b['offset'];var _0x5643e4=_0x3ea31e?_0x99eb10[_0x8e4d('0xb')]:_0x4c201b[_0x8e4d('0x8')]+_0x4c201b[_0x8e4d('0xa')];var _0x57e2c4;if(_0x5643e4>=_0x4387c3){_0x5643e4=_0x4387c3;_0x57e2c4=0xc8;}else{_0x57e2c4=0xce;}_0xfcce6e['status'](_0x57e2c4);return _0xfcce6e[_0x8e4d('0xc')](_0x8e4d('0xd'),_0x739bde+'-'+_0x5643e4+'/'+_0x4387c3)['json'](_0x99eb10);}return null;};}exports[_0x8e4d('0xe')]=function(_0x272e8c,_0x4d0f4a){var _0x246ed0={'count':0x0,'rows':[]};var _0x505589={};var _0x505a1e;var _0x3a4cfc=utils[_0x8e4d('0xf')]();var _0x1f8817;var _0x20348e;var _0x591639=_0x272e8c[_0x8e4d('0x10')][_0x8e4d('0x11')];var _0x156edd=_0x272e8c['query'][_0x8e4d('0x12')];var _0x1a0dd3=_0x272e8c[_0x8e4d('0x10')][_0x8e4d('0x13')];var _0x382895=_0x156edd===_0x8e4d('0x14')||_0x156edd===_0x8e4d('0x15')?!![]:![];var _0x1dae7c=[];var _0x55d831;var _0x44479e;Promise[_0x8e4d('0x16')]()[_0x8e4d('0x17')](function(){if(_0x272e8c[_0x8e4d('0x10')][_0x8e4d('0x18')]){if(!utils[_0x8e4d('0x19')](_0x272e8c[_0x8e4d('0x10')]['channel'])){throw new APIBadRequestError(util[_0x8e4d('0x1a')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x272e8c['query'][_0x8e4d('0x18')]));}_0x505a1e=_0x272e8c[_0x8e4d('0x10')][_0x8e4d('0x18')][_0x8e4d('0x1b')]();}if(!_0x272e8c['query']['sort']||!_0x272e8c[_0x8e4d('0x10')]['sort'][_0x8e4d('0x1c')](_0x8e4d('0x1d'))){_0x272e8c['query'][_0x8e4d('0x1e')]=rta[_0x8e4d('0x1f')](_0x272e8c[_0x8e4d('0x10')][_0x8e4d('0x1e')]);return;}var _0x4fd750=rta[_0x8e4d('0x20')](_0x272e8c[_0x8e4d('0x10')][_0x8e4d('0x1e')]);_0x272e8c[_0x8e4d('0x10')][_0x8e4d('0x1e')]=_0x4fd750[_0x8e4d('0x21')]['join'](',');_0x55d831=_0x4fd750[_0x8e4d('0x22')];})[_0x8e4d('0x17')](function(){if(!_0x591639){return[];}return rta['getAgentIdsByQueues'](_0x591639,_0x505a1e);})[_0x8e4d('0x17')](function(_0x4bc315){_0x1dae7c=_0x4bc315;return rta[_0x8e4d('0x23')]();})['then'](function(_0x4f83a6){_0x20348e=_0x4f83a6['rows'];if((!_0x156edd||_0x382895)&&!_0x55d831){return _0x1dae7c;}if(_0x55d831&&!_0x156edd){return rta[_0x8e4d('0x24')](_0x20348e,_0x1dae7c,_0x55d831);}else{return rta[_0x8e4d('0x25')](_0x20348e,_0x1dae7c,_0x156edd);}})[_0x8e4d('0x17')](function(_0x1874bb){_0x1dae7c=_0x1874bb;var _0xb7a5fa=![];if(_0x1dae7c[_0x8e4d('0x26')]===0x0){if(_0x591639||_0x156edd){_0xb7a5fa=!![];}if(_0x382895){_0xb7a5fa=![];}}if(_0xb7a5fa){return _0x246ed0;}var _0x2320b6=_[_0x8e4d('0x27')](db['User'][_0x8e4d('0x28')],function(_0x450cb4){return{'name':_0x450cb4[_0x8e4d('0x29')],'type':_0x450cb4['type'][_0x8e4d('0x2a')]};});_0x272e8c[_0x8e4d('0x10')][_0x8e4d('0x2b')]=_0x8e4d('0x2c');_0x272e8c[_0x8e4d('0x10')][_0x8e4d('0x2d')]=!![];_0x505589=qs[_0x8e4d('0x2e')](_0x2320b6,_0x272e8c);_0x505589[_0x8e4d('0x2f')]=!![];var _0x13f6c8=[];if(_0x1dae7c['length']>0x0){_0x13f6c8[_0x8e4d('0x30')]({'id':{'$in':_0x1dae7c}});if(_0x55d831&&!_0x156edd){_0x44479e=[db[_0x8e4d('0x31')][_0x8e4d('0x32')](_0x8e4d('0x33')+_0x1dae7c+')')];_0x505589[_0x8e4d('0x22')]=_0x44479e;}}if(_0x382895){_0x3a4cfc[_0x8e4d('0x34')](function(_0x17e3e5){var _0x3c9461=!![];if(_0x156edd==='*pause'&&_0x505a1e!==_0x17e3e5){_0x3c9461=![];}_0x13f6c8[_0x8e4d('0x30')]({[_0x17e3e5+_0x8e4d('0x35')]:_0x3c9461});});if(_0x1a0dd3){_0x13f6c8[_0x8e4d('0x30')]({'pauseType':_0x1a0dd3});}}else if(_0x156edd){_0x3a4cfc[_0x8e4d('0x34')](function(_0x75a492){_0x13f6c8[_0x8e4d('0x30')]({[_0x75a492+_0x8e4d('0x35')]:![]});});}_0x505589[_0x8e4d('0x36')]=_['merge'](_0x505589['where'],{'$and':_0x13f6c8});if(_0x272e8c['user'][_0x8e4d('0x2b')]==='user'){var _0x1cfe03={'params':{'id':_0x272e8c[_0x8e4d('0x37')]['userProfileId']},'query':{'section':_0x8e4d('0x38'),'role':_0x8e4d('0x2c'),'online':!![],'raw':!![],'ids':_0x1dae7c,'customSorting':_0x44479e}};if(_0x382895){_0x1cfe03[_0x8e4d('0x10')][_0x8e4d('0x39')]=_0x13f6c8;}_0x1cfe03[_0x8e4d('0x10')]=Object['assign'](_0x1cfe03['query'],_0x272e8c[_0x8e4d('0x10')]);delete _0x1cfe03['query']['id'];return db[_0x8e4d('0x3a')][_0x8e4d('0x3b')](_0x1cfe03);}return db[_0x8e4d('0x3c')][_0x8e4d('0x3d')](_0x505589);})[_0x8e4d('0x17')](function(_0x1dfe09){_0x246ed0[_0x8e4d('0xb')]=_0x1dfe09[_0x8e4d('0xb')];_0x1f8817=_0x1dfe09['rows'];return _0x1f8817[_0x8e4d('0x27')](function(_0xe6569a){var _0x24fe9=_['find'](_0x20348e,['id',_0xe6569a['id']]);if(_0x24fe9){var _0x460e22=rta[_0x8e4d('0x3e')](_0x24fe9);_[_0x8e4d('0x3f')](_0xe6569a,_0x460e22);}_0xe6569a[_0x8e4d('0x1d')]=rta[_0x8e4d('0x40')](_0xe6569a);if(_0xe6569a[_0x8e4d('0x1d')][_0x8e4d('0x1c')]('pause')){_0x3a4cfc[_0x8e4d('0x34')](function(_0x3d8dee){if(_0xe6569a[_0x3d8dee+_0x8e4d('0x35')]){_0xe6569a[_0x3d8dee+_0x8e4d('0x41')]=_0x8e4d('0x14');}});}return _0xe6569a;});})[_0x8e4d('0x17')](function(_0x576178){if(!_0x55d831||_0x44479e){return _0x576178;}return rta[_0x8e4d('0x42')](_0x576178,_0x55d831);})[_0x8e4d('0x17')](function(_0x35873e){var _0x485fff=null;if(_0x272e8c[_0x8e4d('0x10')]['fields']){var _0x371ec=_0x272e8c['query'][_0x8e4d('0x21')][_0x8e4d('0x43')](',');_0x485fff=_0x35873e['map'](function(_0x2945bc){return _[_0x8e4d('0x44')](_0x2945bc,_0x371ec);});}_0x246ed0[_0x8e4d('0x45')]=_0x485fff||_0x35873e;return _0x246ed0;})[_0x8e4d('0x17')](respondWithFilteredResult(_0x4d0f4a,_0x505589))[_0x8e4d('0x46')](APIHandleError(_0x4d0f4a));};exports[_0x8e4d('0x47')]=function(_0x5788b4,_0x537e76){var _0x3f79dc={'count':0x0,'rows':[]};var _0x2b2390={};var _0x1d3e1f;var _0x3d8359;var _0x3d09bd;Promise[_0x8e4d('0x16')]()[_0x8e4d('0x17')](function(){if(_0x5788b4[_0x8e4d('0x10')][_0x8e4d('0x18')]){if(!utils[_0x8e4d('0x19')](_0x5788b4['query'][_0x8e4d('0x18')])){throw new APIBadRequestError(util[_0x8e4d('0x1a')](_0x8e4d('0x48'),_0x5788b4[_0x8e4d('0x10')][_0x8e4d('0x18')]));}_0x1d3e1f=_0x5788b4[_0x8e4d('0x10')]['channel']['toLowerCase']();}var _0x12b970=_[_0x8e4d('0x49')](_0x1d3e1f)+_0x8e4d('0x4a');var _0x1034bf=_['map'](db[_0x12b970][_0x8e4d('0x28')],function(_0x2c4aa3){return{'name':_0x2c4aa3[_0x8e4d('0x29')],'type':_0x2c4aa3[_0x8e4d('0x4b')][_0x8e4d('0x2a')]};});if(!_0x5788b4[_0x8e4d('0x10')]['fields']){var _0x374d52=['id','name'];if(_0x1d3e1f==='voice'){_0x374d52['push']('type');if(_0x5788b4[_0x8e4d('0x10')][_0x8e4d('0x4b')]==='outbound'){_0x374d52[_0x8e4d('0x30')]([_0x8e4d('0x4c'),'dialMethod']);}}_0x5788b4[_0x8e4d('0x10')][_0x8e4d('0x21')]=_0x374d52[_0x8e4d('0x4d')](',');}_0x2b2390=qs['getOptions'](_0x1034bf,_0x5788b4);if(_0x5788b4[_0x8e4d('0x37')][_0x8e4d('0x2b')]===_0x8e4d('0x37')){var _0x2cf928={'params':{'id':_0x5788b4[_0x8e4d('0x37')][_0x8e4d('0x4e')]},'query':{'section':_0x1d3e1f===_0x8e4d('0x4f')&&_0x5788b4[_0x8e4d('0x10')][_0x8e4d('0x4b')]===_0x8e4d('0x50')?_0x8e4d('0x51'):_[_0x8e4d('0x49')](_0x1d3e1f)+_0x8e4d('0x52'),'type':_0x5788b4['query'][_0x8e4d('0x4b')],'nolimit':!![],'sort':_0x8e4d('0x53'),'filter':_0x5788b4[_0x8e4d('0x10')]['filter']}};return db[_0x8e4d('0x3a')]['getResources'](_0x2cf928);}return db[_0x12b970][_0x8e4d('0x3d')](_0x2b2390);})[_0x8e4d('0x17')](function(_0x4862c8){_0x3f79dc[_0x8e4d('0xb')]=_0x4862c8[_0x8e4d('0xb')];_0x3d8359=_0x4862c8[_0x8e4d('0x45')];return rtq[_0x8e4d('0x54')](_0x5788b4,_0x1d3e1f);})[_0x8e4d('0x17')](function(_0x4709d5){_0x3d09bd=_0x4709d5[_0x8e4d('0x45')];return rtq[_0x8e4d('0x55')](_0x3d8359,_0x3d09bd,_0x1d3e1f,_0x5788b4[_0x8e4d('0x10')][_0x8e4d('0x4b')]);})['then'](function(_0x46f983){_0x3f79dc[_0x8e4d('0x45')]=_0x46f983;return _0x3f79dc;})[_0x8e4d('0x17')](respondWithFilteredResult(_0x537e76,_0x2b2390))[_0x8e4d('0x46')](APIHandleError(_0x537e76));}; \ No newline at end of file +var _0xfd04=['length','map','rawAttributes','fieldName','type','key','online','raw','push','forEach','Pause','merge','where','user','userProfileId','Agents','agent','extraQueryConditions','assign','UserProfile','User','findAndCountAll','getAgentStatus','pause','Status','sortAgentsByStatus','split','catch','getQueues','resolve','format','startCase','name','outbound','dialActive','dialMethod','getOptions','role','voice','filter','getResources','initializeQueues','lodash','../../components/realtime/queues','../../components/parsers/qs','../../errors/api','APIBadRequestError','offset','undefined','limit','count','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','*pause','then','isValidChannel','channel','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus'];(function(_0x5e62aa,_0x48b6c4){var _0x48724d=function(_0xb2062c){while(--_0xb2062c){_0x5e62aa['push'](_0x5e62aa['shift']());}};_0x48724d(++_0x48b6c4);}(_0xfd04,0x114));var _0x4fd0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfd04[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4fd0('0x0'));var util=require('util');var rta=require('../../components/realtime/agents');var rtq=require(_0x4fd0('0x1'));var qs=require(_0x4fd0('0x2'));var utils=require('../../config/utils');var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x4fd0('0x3'))[_0x4fd0('0x4')];var APIHandleError=require(_0x4fd0('0x3'))['handleError'];function respondWithFilteredResult(_0x38b9ff,_0x55e29a){return function(_0x1bfef0){if(_0x1bfef0){var _0x4d578c=typeof _0x55e29a[_0x4fd0('0x5')]===_0x4fd0('0x6')&&typeof _0x55e29a[_0x4fd0('0x7')]===_0x4fd0('0x6');var _0xa4c49a=_0x1bfef0[_0x4fd0('0x8')];var _0x3b2851=_0x4d578c?0x0:_0x55e29a['offset'];var _0x567418=_0x4d578c?_0x1bfef0['count']:_0x55e29a[_0x4fd0('0x5')]+_0x55e29a[_0x4fd0('0x7')];var _0x3beae0;if(_0x567418>=_0xa4c49a){_0x567418=_0xa4c49a;_0x3beae0=0xc8;}else{_0x3beae0=0xce;}_0x38b9ff[_0x4fd0('0x9')](_0x3beae0);return _0x38b9ff[_0x4fd0('0xa')](_0x4fd0('0xb'),_0x3b2851+'-'+_0x567418+'/'+_0xa4c49a)[_0x4fd0('0xc')](_0x1bfef0);}return null;};}exports[_0x4fd0('0xd')]=function(_0x297c92,_0x1a6f58){var _0x54eac7={'count':0x0,'rows':[]};var _0x3b6b80={};var _0x53d2d1;var _0x24e134=utils[_0x4fd0('0xe')]();var _0x46c3e5;var _0x29a756;var _0x45daa3=_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x10')];var _0x2b02f4=_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x11')];var _0x317a1c=_0x297c92['query'][_0x4fd0('0x12')];var _0x5599de=_0x2b02f4==='pause'||_0x2b02f4===_0x4fd0('0x13')?!![]:![];var _0xdcec0e=[];var _0x487318;var _0x5ec0f3;Promise['resolve']()[_0x4fd0('0x14')](function(){if(_0x297c92[_0x4fd0('0xf')]['channel']){if(!utils[_0x4fd0('0x15')](_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x16')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x16')]));}_0x53d2d1=_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x16')][_0x4fd0('0x17')]();}if(!_0x297c92['query'][_0x4fd0('0x18')]||!_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x18')][_0x4fd0('0x19')](_0x4fd0('0x1a'))){_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x18')]=rta[_0x4fd0('0x1b')](_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x18')]);return;}var _0xa9b755=rta[_0x4fd0('0x1c')](_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x18')]);_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x18')]=_0xa9b755[_0x4fd0('0x1d')][_0x4fd0('0x1e')](',');_0x487318=_0xa9b755[_0x4fd0('0x1f')];})[_0x4fd0('0x14')](function(){if(!_0x45daa3){return[];}return rta[_0x4fd0('0x20')](_0x45daa3,_0x53d2d1);})[_0x4fd0('0x14')](function(_0x24be6e){_0xdcec0e=_0x24be6e;return rta[_0x4fd0('0x21')]();})[_0x4fd0('0x14')](function(_0x59b7a1){_0x29a756=_0x59b7a1[_0x4fd0('0x22')];if((!_0x2b02f4||_0x5599de)&&!_0x487318){return _0xdcec0e;}if(_0x487318&&!_0x2b02f4){return rta[_0x4fd0('0x23')](_0x29a756,_0xdcec0e,_0x487318);}else{return rta['getAgentIdsByStatus'](_0x29a756,_0xdcec0e,_0x2b02f4);}})[_0x4fd0('0x14')](function(_0x59d053){_0xdcec0e=_0x59d053;var _0x2cf8e4=![];if(_0xdcec0e[_0x4fd0('0x24')]===0x0){if(_0x45daa3||_0x2b02f4){_0x2cf8e4=!![];}if(_0x5599de){_0x2cf8e4=![];}}if(_0x2cf8e4){return _0x54eac7;}var _0x2239a0=_[_0x4fd0('0x25')](db['User'][_0x4fd0('0x26')],function(_0x37a09f){return{'name':_0x37a09f[_0x4fd0('0x27')],'type':_0x37a09f[_0x4fd0('0x28')][_0x4fd0('0x29')]};});_0x297c92['query']['role']='agent';_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x2a')]=!![];_0x3b6b80=qs['getOptions'](_0x2239a0,_0x297c92);_0x3b6b80[_0x4fd0('0x2b')]=!![];var _0x5b2283=[];if(_0xdcec0e[_0x4fd0('0x24')]>0x0){_0x5b2283[_0x4fd0('0x2c')]({'id':{'$in':_0xdcec0e}});if(_0x487318&&!_0x2b02f4){_0x5ec0f3=[db['sequelize']['literal']('FIELD(id,'+_0xdcec0e+')')];_0x3b6b80['order']=_0x5ec0f3;}}if(_0x5599de){_0x24e134[_0x4fd0('0x2d')](function(_0x33f619){var _0x4fc085=!![];if(_0x2b02f4===_0x4fd0('0x13')&&_0x53d2d1!==_0x33f619){_0x4fc085=![];}_0x5b2283[_0x4fd0('0x2c')]({[_0x33f619+_0x4fd0('0x2e')]:_0x4fc085});});if(_0x317a1c){_0x5b2283[_0x4fd0('0x2c')]({'pauseType':_0x317a1c});}}else if(_0x2b02f4){_0x24e134['forEach'](function(_0x28475c){_0x5b2283[_0x4fd0('0x2c')]({[_0x28475c+'Pause']:![]});});}_0x3b6b80['where']=_[_0x4fd0('0x2f')](_0x3b6b80[_0x4fd0('0x30')],{'$and':_0x5b2283});if(_0x297c92[_0x4fd0('0x31')]['role']===_0x4fd0('0x31')){var _0x53152e={'params':{'id':_0x297c92[_0x4fd0('0x31')][_0x4fd0('0x32')]},'query':{'section':_0x4fd0('0x33'),'role':_0x4fd0('0x34'),'online':!![],'raw':!![],'ids':_0xdcec0e,'customSorting':_0x5ec0f3}};if(_0x5599de){_0x53152e['query'][_0x4fd0('0x35')]=_0x5b2283;}_0x53152e[_0x4fd0('0xf')]=Object[_0x4fd0('0x36')](_0x53152e[_0x4fd0('0xf')],_0x297c92[_0x4fd0('0xf')]);delete _0x53152e[_0x4fd0('0xf')]['id'];return db[_0x4fd0('0x37')]['getResources'](_0x53152e);}return db[_0x4fd0('0x38')][_0x4fd0('0x39')](_0x3b6b80);})[_0x4fd0('0x14')](function(_0x492678){_0x54eac7[_0x4fd0('0x8')]=_0x492678[_0x4fd0('0x8')];_0x46c3e5=_0x492678[_0x4fd0('0x22')];return _0x46c3e5[_0x4fd0('0x25')](function(_0x428b04){var _0x845fe3=_['find'](_0x29a756,['id',_0x428b04['id']]);if(_0x845fe3){var _0x397f7b=rta['filterAgentAttributes'](_0x845fe3);_[_0x4fd0('0x2f')](_0x428b04,_0x397f7b);}_0x428b04[_0x4fd0('0x1a')]=rta[_0x4fd0('0x3a')](_0x428b04);if(_0x428b04[_0x4fd0('0x1a')][_0x4fd0('0x19')](_0x4fd0('0x3b'))){_0x24e134['forEach'](function(_0x241bce){if(_0x428b04[_0x241bce+_0x4fd0('0x2e')]){_0x428b04[_0x241bce+_0x4fd0('0x3c')]=_0x4fd0('0x3b');}});}return _0x428b04;});})[_0x4fd0('0x14')](function(_0x41008f){if(!_0x487318||_0x5ec0f3){return _0x41008f;}return rta[_0x4fd0('0x3d')](_0x41008f,_0x487318);})['then'](function(_0x11930b){var _0x68671c=null;if(_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x1d')]){var _0x4812a1=_0x297c92['query'][_0x4fd0('0x1d')][_0x4fd0('0x3e')](',');_0x68671c=_0x11930b['map'](function(_0x125280){return _['pick'](_0x125280,_0x4812a1);});}_0x54eac7['rows']=_0x68671c||_0x11930b;return _0x54eac7;})[_0x4fd0('0x14')](respondWithFilteredResult(_0x1a6f58,_0x3b6b80))[_0x4fd0('0x3f')](APIHandleError(_0x1a6f58));};exports[_0x4fd0('0x40')]=function(_0x426287,_0x3d4e74){var _0x55ce14={'count':0x0,'rows':[]};var _0x10ed99={};var _0x1132b4;var _0x16ada0;var _0x4e33b6;Promise[_0x4fd0('0x41')]()[_0x4fd0('0x14')](function(){if(_0x426287[_0x4fd0('0xf')][_0x4fd0('0x16')]){if(!utils[_0x4fd0('0x15')](_0x426287[_0x4fd0('0xf')][_0x4fd0('0x16')])){throw new APIBadRequestError(util[_0x4fd0('0x42')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x426287[_0x4fd0('0xf')][_0x4fd0('0x16')]));}_0x1132b4=_0x426287['query'][_0x4fd0('0x16')][_0x4fd0('0x17')]();}var _0x291367=_[_0x4fd0('0x43')](_0x1132b4)+'Queue';var _0x443abb=_['map'](db[_0x291367][_0x4fd0('0x26')],function(_0x46b8f8){return{'name':_0x46b8f8[_0x4fd0('0x27')],'type':_0x46b8f8[_0x4fd0('0x28')][_0x4fd0('0x29')]};});if(!_0x426287[_0x4fd0('0xf')][_0x4fd0('0x1d')]){var _0xe4fd71=['id',_0x4fd0('0x44')];if(_0x1132b4==='voice'){_0xe4fd71['push'](_0x4fd0('0x28'));if(_0x426287[_0x4fd0('0xf')][_0x4fd0('0x28')]===_0x4fd0('0x45')){_0xe4fd71[_0x4fd0('0x2c')]([_0x4fd0('0x46'),_0x4fd0('0x47')]);}}_0x426287['query']['fields']=_0xe4fd71[_0x4fd0('0x1e')](',');}_0x10ed99=qs[_0x4fd0('0x48')](_0x443abb,_0x426287);if(_0x426287[_0x4fd0('0x31')][_0x4fd0('0x49')]==='user'){var _0x3dfe0a={'params':{'id':_0x426287[_0x4fd0('0x31')]['userProfileId']},'query':{'section':_0x1132b4===_0x4fd0('0x4a')&&_0x426287['query'][_0x4fd0('0x28')]===_0x4fd0('0x45')?'QueueCampaigns':_[_0x4fd0('0x43')](_0x1132b4)+'Queues','type':_0x426287[_0x4fd0('0xf')][_0x4fd0('0x28')],'nolimit':!![],'sort':_0x4fd0('0x44'),'filter':_0x426287[_0x4fd0('0xf')][_0x4fd0('0x4b')]}};return db[_0x4fd0('0x37')][_0x4fd0('0x4c')](_0x3dfe0a);}return db[_0x291367]['findAndCountAll'](_0x10ed99);})[_0x4fd0('0x14')](function(_0x488427){_0x55ce14[_0x4fd0('0x8')]=_0x488427[_0x4fd0('0x8')];_0x16ada0=_0x488427[_0x4fd0('0x22')];return rtq['getRealtimeQueues'](_0x426287,_0x1132b4);})['then'](function(_0x4d8131){_0x4e33b6=_0x4d8131[_0x4fd0('0x22')];return rtq[_0x4fd0('0x4d')](_0x16ada0,_0x4e33b6,_0x1132b4,_0x426287[_0x4fd0('0xf')]['type']);})[_0x4fd0('0x14')](function(_0x317278){_0x55ce14[_0x4fd0('0x22')]=_0x317278;return _0x55ce14;})[_0x4fd0('0x14')](respondWithFilteredResult(_0x3d4e74,_0x10ed99))[_0x4fd0('0x3f')](APIHandleError(_0x3d4e74));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 6732c7f..f049b47 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(_0x400b2b,_0x363b3c){var _0x1cd468=function(_0x56ea0e){while(--_0x56ea0e){_0x400b2b['push'](_0x400b2b['shift']());}};_0x1cd468(++_0x363b3c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xcb91[_0xef8146];return _0x5a6cb0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x667c6a,_0x2155cd){var _0x36396a=function(_0x29d602){while(--_0x29d602){_0x667c6a['push'](_0x667c6a['shift']());}};_0x36396a(++_0x2155cd);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 5a4b358..0738f48 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 _0x6eed=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x1ad9b4,_0x5df9ed){var _0xbbee74=function(_0x39c75f){while(--_0x39c75f){_0x1ad9b4['push'](_0x1ad9b4['shift']());}};_0xbbee74(++_0x5df9ed);}(_0x6eed,0xff));var _0xd6ee=function(_0x48ae85,_0x4f6363){_0x48ae85=_0x48ae85-0x0;var _0x2257bc=_0x6eed[_0x48ae85];return _0x2257bc;};'use strict';var Sequelize=require(_0xd6ee('0x0'));module[_0xd6ee('0x1')]={'state':{'type':Sequelize[_0xd6ee('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xd6ee('0x3')]},'scheduledat':{'type':Sequelize[_0xd6ee('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd6ee('0x4')]},'responsetime':{'type':Sequelize[_0xd6ee('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xd6ee('0x3')]},'membername':{'type':Sequelize[_0xd6ee('0x3')]}}; \ No newline at end of file +var _0x2bd8=['sequelize','INTEGER','STRING','DATE'];(function(_0x274e7f,_0x139c43){var _0x3eba3f=function(_0x4a64bc){while(--_0x4a64bc){_0x274e7f['push'](_0x274e7f['shift']());}};_0x3eba3f(++_0x139c43);}(_0x2bd8,0x130));var _0x82bd=function(_0x4fb244,_0x30321d){_0x4fb244=_0x4fb244-0x0;var _0x385b31=_0x2bd8[_0x4fb244];return _0x385b31;};'use strict';var Sequelize=require(_0x82bd('0x0'));module['exports']={'state':{'type':Sequelize[_0x82bd('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x82bd('0x2')]},'scheduledat':{'type':Sequelize[_0x82bd('0x3')]},'uniqueid':{'type':Sequelize[_0x82bd('0x2')]},'starttime':{'type':Sequelize[_0x82bd('0x3')]},'responsetime':{'type':Sequelize[_0x82bd('0x3')]},'ringtime':{'type':Sequelize[_0x82bd('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x82bd('0x2')]},'membername':{'type':Sequelize[_0x82bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 50c1dff..a78e484 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 _0xc168=['path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','api','bluebird'];(function(_0x2a1b0a,_0xc2c19f){var _0x26123a=function(_0x5214a1){while(--_0x5214a1){_0x2a1b0a['push'](_0x2a1b0a['shift']());}};_0x26123a(++_0xc2c19f);}(_0xc168,0xd4));var _0x8c16=function(_0x555d69,_0x5127ec){_0x555d69=_0x555d69-0x0;var _0xd85022=_0xc168[_0x555d69];return _0xd85022;};'use strict';var _=require(_0x8c16('0x0'));var util=require(_0x8c16('0x1'));var logger=require('../../config/logger')(_0x8c16('0x2'));var moment=require('moment');var BPromise=require(_0x8c16('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c16('0x4'));var rimraf=require(_0x8c16('0x5'));var config=require(_0x8c16('0x6'));var attributes=require(_0x8c16('0x7'));module[_0x8c16('0x8')]=function(_0x5d2063,_0xe03df){return _0x5d2063[_0x8c16('0x9')](_0x8c16('0xa'),attributes,{'tableName':_0x8c16('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcdc=['api','moment','bluebird','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','lodash','util','../../config/logger'];(function(_0x13c90a,_0x182cea){var _0x47bc14=function(_0x236eca){while(--_0x236eca){_0x13c90a['push'](_0x13c90a['shift']());}};_0x47bc14(++_0x182cea);}(_0xfcdc,0x179));var _0xcfcd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfcdc[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xcfcd('0x0'));var util=require(_0xcfcd('0x1'));var logger=require(_0xcfcd('0x2'))(_0xcfcd('0x3'));var moment=require(_0xcfcd('0x4'));var BPromise=require(_0xcfcd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcfcd('0x6'));var config=require(_0xcfcd('0x7'));var attributes=require(_0xcfcd('0x8'));module[_0xcfcd('0x9')]=function(_0x3247b4,_0x1dd79a){return _0x3247b4['define']('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index e5fdf52..c605da9 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 _0x480a=['error','code','message','info','CreateReportAgentPreview','ReportAgentPreview','body','options','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4c6389,_0x523c40){var _0x2850b2=function(_0x3a8180){while(--_0x3a8180){_0x4c6389['push'](_0x4c6389['shift']());}};_0x2850b2(++_0x523c40);}(_0x480a,0x10d));var _0xa480=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x480a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa480('0x0'));var util=require(_0xa480('0x1'));var moment=require(_0xa480('0x2'));var BPromise=require(_0xa480('0x3'));var rs=require(_0xa480('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa480('0x5'));var logger=require('../../config/logger')(_0xa480('0x6'));var config=require(_0xa480('0x7'));var jayson=require(_0xa480('0x8'));var client=jayson[_0xa480('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdff886,_0x3a2fbb,_0x1df521){return new BPromise(function(_0x58ecc7,_0x5c5dc7){return client[_0xa480('0xa')](_0xdff886,_0x1df521)[_0xa480('0xb')](function(_0x4763b0){logger['info'](_0xa480('0xc'),_0x3a2fbb,_0xa480('0xd'));logger[_0xa480('0xe')](_0xa480('0xf'),_0x3a2fbb,_0xa480('0xd'),JSON[_0xa480('0x10')](_0x4763b0));if(_0x4763b0[_0xa480('0x11')]){if(_0x4763b0[_0xa480('0x11')][_0xa480('0x12')]===0x1f4){logger[_0xa480('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x3a2fbb,_0x4763b0[_0xa480('0x11')][_0xa480('0x13')]);return _0x5c5dc7(_0x4763b0[_0xa480('0x11')][_0xa480('0x13')]);}logger[_0xa480('0x11')](_0xa480('0xc'),_0x3a2fbb,_0x4763b0[_0xa480('0x11')][_0xa480('0x13')]);return _0x58ecc7(_0x4763b0[_0xa480('0x11')][_0xa480('0x13')]);}else{logger[_0xa480('0x14')](_0xa480('0xc'),_0x3a2fbb,_0xa480('0xd'));_0x58ecc7(_0x4763b0['result']['message']);}})['catch'](function(_0x39b8da){logger[_0xa480('0x11')](_0xa480('0xc'),_0x3a2fbb,_0x39b8da);_0x5c5dc7(_0x39b8da);});});}exports[_0xa480('0x15')]=function(_0x3612d4){var _0x16cd18=this;return new Promise(function(_0x44316f,_0x41ad7b){return db[_0xa480('0x16')]['create'](_0x3612d4[_0xa480('0x17')],{'raw':_0x3612d4[_0xa480('0x18')]?_0x3612d4[_0xa480('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xa480('0xb')](function(_0x4f3d0f){logger[_0xa480('0x14')]('CreateReportAgentPreview',_0x3612d4);logger[_0xa480('0xe')](_0xa480('0x15'),_0x3612d4,JSON[_0xa480('0x10')](_0x4f3d0f));_0x44316f(_0x4f3d0f);})[_0xa480('0x19')](function(_0x42da6e){logger[_0xa480('0x11')]('CreateReportAgentPreview',_0x42da6e[_0xa480('0x13')],_0x3612d4);_0x41ad7b(_0x16cd18[_0xa480('0x11')](0x1f4,_0x42da6e[_0xa480('0x13')]));});});}; \ No newline at end of file +var _0xaa18=['options','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateReportAgentPreview','create','body'];(function(_0x49aab7,_0x1d6397){var _0x587b6f=function(_0x2346ac){while(--_0x2346ac){_0x49aab7['push'](_0x49aab7['shift']());}};_0x587b6f(++_0x1d6397);}(_0xaa18,0x16d));var _0x8aa1=function(_0x541d36,_0x19842a){_0x541d36=_0x541d36-0x0;var _0x4ab56e=_0xaa18[_0x541d36];return _0x4ab56e;};'use strict';var _=require(_0x8aa1('0x0'));var util=require(_0x8aa1('0x1'));var moment=require('moment');var BPromise=require(_0x8aa1('0x2'));var rs=require(_0x8aa1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8aa1('0x4'))['db'];var utils=require(_0x8aa1('0x5'));var logger=require(_0x8aa1('0x6'))(_0x8aa1('0x7'));var config=require(_0x8aa1('0x8'));var jayson=require(_0x8aa1('0x9'));var client=jayson['client'][_0x8aa1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e2b6a,_0x5b2a06,_0x5f4723){return new BPromise(function(_0xa7e272,_0x1f290f){return client[_0x8aa1('0xb')](_0x4e2b6a,_0x5f4723)[_0x8aa1('0xc')](function(_0x4d3ddf){logger['info'](_0x8aa1('0xd'),_0x5b2a06,'request\x20sent');logger[_0x8aa1('0xe')](_0x8aa1('0xf'),_0x5b2a06,_0x8aa1('0x10'),JSON[_0x8aa1('0x11')](_0x4d3ddf));if(_0x4d3ddf['error']){if(_0x4d3ddf[_0x8aa1('0x12')][_0x8aa1('0x13')]===0x1f4){logger['error'](_0x8aa1('0xd'),_0x5b2a06,_0x4d3ddf['error'][_0x8aa1('0x14')]);return _0x1f290f(_0x4d3ddf[_0x8aa1('0x12')][_0x8aa1('0x14')]);}logger[_0x8aa1('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x5b2a06,_0x4d3ddf[_0x8aa1('0x12')][_0x8aa1('0x14')]);return _0xa7e272(_0x4d3ddf[_0x8aa1('0x12')][_0x8aa1('0x14')]);}else{logger[_0x8aa1('0x15')](_0x8aa1('0xd'),_0x5b2a06,'request\x20sent');_0xa7e272(_0x4d3ddf[_0x8aa1('0x16')][_0x8aa1('0x14')]);}})[_0x8aa1('0x17')](function(_0x2a387e){logger[_0x8aa1('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x5b2a06,_0x2a387e);_0x1f290f(_0x2a387e);});});}exports[_0x8aa1('0x18')]=function(_0x1ec06e){var _0x5b499d=this;return new Promise(function(_0x26fe2d,_0x4b821b){return db['ReportAgentPreview'][_0x8aa1('0x19')](_0x1ec06e[_0x8aa1('0x1a')],{'raw':_0x1ec06e[_0x8aa1('0x1b')]?_0x1ec06e['options']['raw']===undefined?!![]:![]:!![]})[_0x8aa1('0xc')](function(_0x3b818a){logger['info'](_0x8aa1('0x18'),_0x1ec06e);logger[_0x8aa1('0xe')]('CreateReportAgentPreview',_0x1ec06e,JSON[_0x8aa1('0x11')](_0x3b818a));_0x26fe2d(_0x3b818a);})[_0x8aa1('0x17')](function(_0xb38f9a){logger[_0x8aa1('0x12')](_0x8aa1('0x18'),_0xb38f9a['message'],_0x1ec06e);_0x4b821b(_0x5b499d['error'](0x1f4,_0xb38f9a[_0x8aa1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 6ba93a8..fd07fc8 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 _0xe85b=['voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','put','/voice/queues/:id','updateVoiceQueue','outbound','/outbound/channels','outboundChannels','/agents','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','mail','showMailQueues','/chat/queues/:id/notify','queueNotify','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showWhatsappQueues','/agents/:id/notify','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','chatQueues','mailQueues','/openchannel/queues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel'];(function(_0x307176,_0x75c5c2){var _0x2c35d5=function(_0xa2b526){while(--_0xa2b526){_0x307176['push'](_0x307176['shift']());}};_0x2c35d5(++_0x75c5c2);}(_0xe85b,0x6f));var _0xbe85=function(_0x124ca2,_0x5d5659){_0x124ca2=_0x124ca2-0x0;var _0x329cda=_0xe85b[_0x124ca2];return _0x329cda;};'use strict';var multer=require(_0xbe85('0x0'));var util=require(_0xbe85('0x1'));var path=require(_0xbe85('0x2'));var express=require('express');var router=express[_0xbe85('0x3')]();var auth=require(_0xbe85('0x4'));var controller=require(_0xbe85('0x5'));router[_0xbe85('0x6')](_0xbe85('0x7'),auth[_0xbe85('0x8')](),controller[_0xbe85('0x9')]);router[_0xbe85('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xbe85('0x8')](),controller[_0xbe85('0xa')]);router[_0xbe85('0x6')](_0xbe85('0xb'),auth[_0xbe85('0x8')](),controller['voiceChannelStopMixMonitor']);router['get']('/voice/queues',auth[_0xbe85('0x8')](),controller['voiceQueues']);router[_0xbe85('0x6')]('/chat/queues',auth[_0xbe85('0x8')](),controller[_0xbe85('0xc')]);router[_0xbe85('0x6')]('/mail/queues',auth[_0xbe85('0x8')](),controller[_0xbe85('0xd')]);router[_0xbe85('0x6')]('/mail/accounts',auth[_0xbe85('0x8')](),controller['mailAccounts']);router['get'](_0xbe85('0xe'),auth['isAuthenticated'](),controller['openchannelQueues']);router[_0xbe85('0x6')](_0xbe85('0xf'),auth[_0xbe85('0x8')](),controller['smsQueues']);router[_0xbe85('0x6')](_0xbe85('0x10'),auth[_0xbe85('0x8')](),controller[_0xbe85('0x11')]);router['get'](_0xbe85('0x12'),auth[_0xbe85('0x8')](),controller[_0xbe85('0x13')]);router['get'](_0xbe85('0x14'),auth[_0xbe85('0x8')](),controller[_0xbe85('0x15')]);router['get']('/voice/queues/channels',auth[_0xbe85('0x8')](),controller[_0xbe85('0x16')]);router[_0xbe85('0x6')](_0xbe85('0x17'),auth[_0xbe85('0x8')](),controller[_0xbe85('0x18')]);router[_0xbe85('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xbe85('0x8')](),controller[_0xbe85('0x19')]);router[_0xbe85('0x6')](_0xbe85('0x1a'),auth[_0xbe85('0x8')](),controller['voiceQueuesChannelRedirect']);router['get']('/voice/queues/:id',auth[_0xbe85('0x8')](),controller['showVoiceQueues']);router[_0xbe85('0x1b')](_0xbe85('0x1c'),auth[_0xbe85('0x8')](),controller[_0xbe85('0x1d')]);router[_0xbe85('0x6')]('/outbound',auth[_0xbe85('0x8')](),controller[_0xbe85('0x1e')]);router[_0xbe85('0x6')](_0xbe85('0x1f'),auth[_0xbe85('0x8')](),controller[_0xbe85('0x20')]);router[_0xbe85('0x6')](_0xbe85('0x21'),auth[_0xbe85('0x8')](),controller['agents']);router['put']('/agents/:id/capacity',auth[_0xbe85('0x8')](),controller[_0xbe85('0x22')]);router['get'](_0xbe85('0x23'),auth[_0xbe85('0x8')](),controller[_0xbe85('0x24')]);router['get'](_0xbe85('0x25'),auth['isAuthenticated'](),controller[_0xbe85('0x26')]);router['get'](_0xbe85('0x27'),auth['isAuthenticated'](),controller['campaigns']);router[_0xbe85('0x6')](_0xbe85('0x28'),auth[_0xbe85('0x8')](),controller[_0xbe85('0x29')]);router['get'](_0xbe85('0x2a'),auth[_0xbe85('0x8')](),controller[_0xbe85('0x2b')]);router[_0xbe85('0x6')](_0xbe85('0x2c'),auth[_0xbe85('0x8')](),controller[_0xbe85('0x2d')]);router[_0xbe85('0x6')]('/openchannel/queues/waitinginteractions',auth[_0xbe85('0x8')](),controller['openchannelQueuesWaitingInteractions']);router[_0xbe85('0x6')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller[_0xbe85('0x2e')]);router[_0xbe85('0x6')]('/sms/queues/waitinginteractions',auth[_0xbe85('0x8')](),controller[_0xbe85('0x2f')]);router[_0xbe85('0x6')](_0xbe85('0x30'),auth[_0xbe85('0x8')](),controller[_0xbe85('0x31')]);router[_0xbe85('0x6')](_0xbe85('0x32'),auth[_0xbe85('0x8')](),controller[_0xbe85('0x33')]);router[_0xbe85('0x34')]('/mail/queues/:id/notify',auth[_0xbe85('0x8')](),controller['queueNotify'](_0xbe85('0x35')));router[_0xbe85('0x6')]('/mail/queues/:id',auth[_0xbe85('0x8')](),controller[_0xbe85('0x36')]);router['post'](_0xbe85('0x37'),auth[_0xbe85('0x8')](),controller[_0xbe85('0x38')]('chat'));router[_0xbe85('0x6')]('/chat/queues/:id',auth[_0xbe85('0x8')](),controller[_0xbe85('0x39')]);router[_0xbe85('0x34')](_0xbe85('0x3a'),auth[_0xbe85('0x8')](),controller[_0xbe85('0x38')](_0xbe85('0x3b')));router['get'](_0xbe85('0x3c'),auth[_0xbe85('0x8')](),controller['showFaxQueues']);router[_0xbe85('0x34')](_0xbe85('0x3d'),auth[_0xbe85('0x8')](),controller[_0xbe85('0x38')]('openchannel'));router['get']('/openchannel/queues/:id',auth[_0xbe85('0x8')](),controller['showOpenchannelQueues']);router[_0xbe85('0x34')](_0xbe85('0x3e'),auth[_0xbe85('0x8')](),controller[_0xbe85('0x38')](_0xbe85('0x3f')));router[_0xbe85('0x34')](_0xbe85('0x40'),auth['isAuthenticated'](),controller[_0xbe85('0x38')]('whatsapp'));router[_0xbe85('0x6')](_0xbe85('0x41'),auth[_0xbe85('0x8')](),controller['showSmsQueues']);router['get']('/whatsapp/queues/:id',auth[_0xbe85('0x8')](),controller[_0xbe85('0x42')]);router[_0xbe85('0x34')](_0xbe85('0x43'),auth[_0xbe85('0x8')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0xe53d=['faxQueuesWaitingInteractions','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','showChatQueues','/fax/queues/:id','showFaxQueues','post','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','path','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','get','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions'];(function(_0x460e8b,_0x3f17dd){var _0x78d336=function(_0x417c09){while(--_0x417c09){_0x460e8b['push'](_0x460e8b['shift']());}};_0x78d336(++_0x3f17dd);}(_0xe53d,0x1a7));var _0xde53=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xe53d[_0x47aa64];return _0x549c7a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xde53('0x0'));var express=require(_0xde53('0x1'));var router=express[_0xde53('0x2')]();var auth=require(_0xde53('0x3'));var controller=require(_0xde53('0x4'));router['get'](_0xde53('0x5'),auth[_0xde53('0x6')](),controller['voiceChannels']);router[_0xde53('0x7')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xde53('0x6')](),controller[_0xde53('0x8')]);router['get'](_0xde53('0x9'),auth['isAuthenticated'](),controller[_0xde53('0xa')]);router[_0xde53('0x7')](_0xde53('0xb'),auth[_0xde53('0x6')](),controller[_0xde53('0xc')]);router[_0xde53('0x7')](_0xde53('0xd'),auth['isAuthenticated'](),controller[_0xde53('0xe')]);router[_0xde53('0x7')](_0xde53('0xf'),auth[_0xde53('0x6')](),controller[_0xde53('0x10')]);router[_0xde53('0x7')]('/mail/accounts',auth[_0xde53('0x6')](),controller[_0xde53('0x11')]);router[_0xde53('0x7')](_0xde53('0x12'),auth['isAuthenticated'](),controller[_0xde53('0x13')]);router[_0xde53('0x7')]('/sms/queues',auth['isAuthenticated'](),controller['smsQueues']);router[_0xde53('0x7')]('/whatsapp/queues',auth[_0xde53('0x6')](),controller[_0xde53('0x14')]);router[_0xde53('0x7')]('/fax/queues',auth['isAuthenticated'](),controller[_0xde53('0x15')]);router[_0xde53('0x7')](_0xde53('0x16'),auth[_0xde53('0x6')](),controller[_0xde53('0x17')]);router[_0xde53('0x7')]('/voice/queues/channels',auth['isAuthenticated'](),controller['voiceQueuesChannels']);router[_0xde53('0x7')](_0xde53('0x18'),auth[_0xde53('0x6')](),controller[_0xde53('0x19')]);router[_0xde53('0x7')](_0xde53('0x1a'),auth[_0xde53('0x6')](),controller[_0xde53('0x1b')]);router[_0xde53('0x7')](_0xde53('0x1c'),auth['isAuthenticated'](),controller[_0xde53('0x1d')]);router[_0xde53('0x7')]('/voice/queues/:id',auth[_0xde53('0x6')](),controller[_0xde53('0x1e')]);router[_0xde53('0x1f')]('/voice/queues/:id',auth[_0xde53('0x6')](),controller[_0xde53('0x20')]);router[_0xde53('0x7')](_0xde53('0x21'),auth['isAuthenticated'](),controller[_0xde53('0x22')]);router['get']('/outbound/channels',auth[_0xde53('0x6')](),controller[_0xde53('0x23')]);router['get'](_0xde53('0x24'),auth['isAuthenticated'](),controller[_0xde53('0x25')]);router[_0xde53('0x1f')](_0xde53('0x26'),auth[_0xde53('0x6')](),controller[_0xde53('0x27')]);router[_0xde53('0x7')](_0xde53('0x28'),auth[_0xde53('0x6')](),controller[_0xde53('0x29')]);router[_0xde53('0x7')]('/trunks',auth[_0xde53('0x6')](),controller[_0xde53('0x2a')]);router[_0xde53('0x7')](_0xde53('0x2b'),auth[_0xde53('0x6')](),controller[_0xde53('0x2c')]);router[_0xde53('0x7')](_0xde53('0x2d'),auth[_0xde53('0x6')](),controller[_0xde53('0x2e')]);router[_0xde53('0x7')]('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xde53('0x2f')]);router[_0xde53('0x7')]('/mail/queues/waitinginteractions',auth[_0xde53('0x6')](),controller[_0xde53('0x30')]);router[_0xde53('0x7')]('/openchannel/queues/waitinginteractions',auth[_0xde53('0x6')](),controller[_0xde53('0x31')]);router[_0xde53('0x7')](_0xde53('0x32'),auth[_0xde53('0x6')](),controller[_0xde53('0x33')]);router[_0xde53('0x7')](_0xde53('0x34'),auth['isAuthenticated'](),controller[_0xde53('0x35')]);router[_0xde53('0x7')](_0xde53('0x36'),auth[_0xde53('0x6')](),controller[_0xde53('0x37')]);router[_0xde53('0x7')](_0xde53('0x38'),auth[_0xde53('0x6')](),controller[_0xde53('0x39')]);router['post'](_0xde53('0x3a'),auth[_0xde53('0x6')](),controller['queueNotify'](_0xde53('0x3b')));router['get'](_0xde53('0x3c'),auth[_0xde53('0x6')](),controller[_0xde53('0x3d')]);router['post'](_0xde53('0x3e'),auth['isAuthenticated'](),controller[_0xde53('0x3f')]('chat'));router[_0xde53('0x7')]('/chat/queues/:id',auth['isAuthenticated'](),controller[_0xde53('0x40')]);router['post']('/fax/queues/:id/notify',auth[_0xde53('0x6')](),controller['queueNotify']('fax'));router[_0xde53('0x7')](_0xde53('0x41'),auth['isAuthenticated'](),controller[_0xde53('0x42')]);router[_0xde53('0x43')](_0xde53('0x44'),auth[_0xde53('0x6')](),controller[_0xde53('0x3f')]('openchannel'));router[_0xde53('0x7')](_0xde53('0x45'),auth[_0xde53('0x6')](),controller[_0xde53('0x46')]);router[_0xde53('0x43')]('/sms/queues/:id/notify',auth[_0xde53('0x6')](),controller['queueNotify'](_0xde53('0x47')));router[_0xde53('0x43')](_0xde53('0x48'),auth[_0xde53('0x6')](),controller['queueNotify'](_0xde53('0x49')));router[_0xde53('0x7')](_0xde53('0x4a'),auth[_0xde53('0x6')](),controller[_0xde53('0x4b')]);router['get']('/whatsapp/queues/:id',auth[_0xde53('0x6')](),controller[_0xde53('0x4c')]);router['post'](_0xde53('0x4d'),auth[_0xde53('0x6')](),controller[_0xde53('0x4e')]);module[_0xde53('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 78ae744..df9585b 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 _0xae24=['InteractionId','From','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Agent\x20not\x20found','bluebird','lodash','../../mysqldb','../../config/logger','client','http','then','error','code','message','result','catch','status','json','sendStatus','name','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','params','voiceQueuesPreview','VoiceQueuesPreview','merge','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','format','length','updateAttributes','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','OpenchannelQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId'];(function(_0x30a3c9,_0x30533f){var _0x747afc=function(_0x1e1e54){while(--_0x1e1e54){_0x30a3c9['push'](_0x30a3c9['shift']());}};_0x747afc(++_0x30533f);}(_0xae24,0x182));var _0x4ae2=function(_0x3e9e2e,_0x5a5e49){_0x3e9e2e=_0x3e9e2e-0x0;var _0x128ed6=_0xae24[_0x3e9e2e];return _0x128ed6;};'use strict';var BPromise=require(_0x4ae2('0x0'));var moment=require('moment');var _=require(_0x4ae2('0x1'));var util=require('util');var db=require(_0x4ae2('0x2'))['db'];var logger=require(_0x4ae2('0x3'))('api');var jayson=require('jayson/promise');var amiClient=jayson[_0x4ae2('0x4')]['http']({'port':0x232a});var mailClient=jayson[_0x4ae2('0x4')][_0x4ae2('0x5')]({'port':0x232b});var routingClient=jayson[_0x4ae2('0x4')][_0x4ae2('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x428054,_0x307247,_0x4f2e84){return new BPromise(function(_0x5f589a,_0x41cdf1){var _0x4d3d8a=_0x4f2e84?_0x4f2e84:amiClient;return _0x4d3d8a['request'](_0x428054,_0x307247)[_0x4ae2('0x6')](function(_0xb01e8e){if(_0xb01e8e['error']){if(_0xb01e8e[_0x4ae2('0x7')][_0x4ae2('0x8')]===0x1f4){return _0x41cdf1(_0xb01e8e[_0x4ae2('0x7')][_0x4ae2('0x9')]);}return _0x5f589a(_0xb01e8e['error'][_0x4ae2('0x9')]);}else{_0x5f589a(_0xb01e8e[_0x4ae2('0xa')]);}})[_0x4ae2('0xb')](function(_0x4d7dc3){_0x41cdf1(_0x4d7dc3);});});}function respondWithResult(_0x25d2b4,_0x22ac1e){_0x22ac1e=_0x22ac1e||0xc8;return function(_0x30d6c4){if(_0x30d6c4){return _0x25d2b4[_0x4ae2('0xc')](_0x22ac1e)[_0x4ae2('0xd')](_0x30d6c4);}return _0x25d2b4[_0x4ae2('0xe')](0x194);};}function handleError(_0x145287,_0x3cabc9){_0x3cabc9=_0x3cabc9||0x1f4;return function(_0xd527a0){logger['error'](_0xd527a0['stack']);if(_0xd527a0['name']){delete _0xd527a0[_0x4ae2('0xf')];}_0x145287[_0x4ae2('0xc')](_0x3cabc9)['send'](_0xd527a0);};}function findById(_0x463765){return function(_0x9fb8db){if(!_[_0x4ae2('0x10')](_0x463765)&&!_[_0x4ae2('0x10')](_0x9fb8db)&&!_[_0x4ae2('0x10')](_0x9fb8db[_0x4ae2('0x11')])){return _[_0x4ae2('0x12')](_0x9fb8db[_0x4ae2('0x11')],function(_0x41b672){return _0x41b672['id']==_0x463765;});}return null;};}exports[_0x4ae2('0x13')]=function(_0x4d5071,_0x4a97af){return respondWithRpcPromise(_0x4ae2('0x14'),_0x4d5071[_0x4ae2('0x15')])['then'](respondWithResult(_0x4a97af,null))[_0x4ae2('0xb')](handleError(_0x4a97af,null));};exports[_0x4ae2('0x16')]=function(_0xccb3b,_0x2ad222){return respondWithRpcPromise(_0x4ae2('0x17'),_['merge'](_0xccb3b[_0x4ae2('0x15')],_0xccb3b['params']))['then'](respondWithResult(_0x2ad222,null))[_0x4ae2('0xb')](handleError(_0x2ad222,null));};exports[_0x4ae2('0x18')]=function(_0x802bf0,_0x17041e){return respondWithRpcPromise(_0x4ae2('0x19'),_['merge'](_0x802bf0[_0x4ae2('0x15')],_0x802bf0['params']))[_0x4ae2('0x6')](respondWithResult(_0x17041e,null))[_0x4ae2('0xb')](handleError(_0x17041e,null));};exports[_0x4ae2('0x1a')]=function(_0x57933b,_0x43f112){return respondWithRpcPromise(_0x4ae2('0x1b'),_0x57933b[_0x4ae2('0x15')])[_0x4ae2('0x6')](respondWithResult(_0x43f112,null))[_0x4ae2('0xb')](handleError(_0x43f112,null));};exports[_0x4ae2('0x1c')]=function(_0x5b2e65,_0x5962b0){return respondWithRpcPromise(_0x4ae2('0x1b'),_0x5b2e65[_0x4ae2('0x15')])[_0x4ae2('0x6')](findById(_0x5b2e65[_0x4ae2('0x1d')]['id']))[_0x4ae2('0x6')](respondWithResult(_0x5962b0,null))[_0x4ae2('0xb')](handleError(_0x5962b0,null));};exports['updateVoiceQueue']=function(_0x5ec1fd,_0x3e2666){return respondWithRpcPromise('UpdateVoiceQueue',_['merge'](_0x5ec1fd['body'],_0x5ec1fd[_0x4ae2('0x1d')]))[_0x4ae2('0x6')](respondWithResult(_0x3e2666,null))['catch'](handleError(_0x3e2666,null));};exports[_0x4ae2('0x1e')]=function(_0x37e3e5,_0x3d56ea){return respondWithRpcPromise(_0x4ae2('0x1f'),_[_0x4ae2('0x20')](_0x37e3e5[_0x4ae2('0x15')],_0x37e3e5[_0x4ae2('0x1d')]))[_0x4ae2('0x6')](respondWithResult(_0x3d56ea,null))[_0x4ae2('0xb')](handleError(_0x3d56ea,null));};exports[_0x4ae2('0x21')]=function(_0x386687,_0x12815f){return respondWithRpcPromise(_0x4ae2('0x22'),_0x386687[_0x4ae2('0x15')])[_0x4ae2('0x6')](respondWithResult(_0x12815f,null))[_0x4ae2('0xb')](handleError(_0x12815f,null));};exports[_0x4ae2('0x23')]=function(_0x4bd47f,_0xdcd11e){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x4ae2('0x20')](_0x4bd47f[_0x4ae2('0x15')],_0x4bd47f['params']))[_0x4ae2('0x6')](respondWithResult(_0xdcd11e,null))[_0x4ae2('0xb')](handleError(_0xdcd11e,null));};exports[_0x4ae2('0x24')]=function(_0x2dde26,_0x5256d3){return respondWithRpcPromise(_0x4ae2('0x25'),_[_0x4ae2('0x20')](_0x2dde26[_0x4ae2('0x15')],_0x2dde26[_0x4ae2('0x1d')]))[_0x4ae2('0x6')](respondWithResult(_0x5256d3,null))[_0x4ae2('0xb')](handleError(_0x5256d3,null));};exports[_0x4ae2('0x26')]=function(_0x46f3a2,_0xe99f9d){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x4ae2('0x20')](_0x46f3a2['query'],_0x46f3a2[_0x4ae2('0x1d')]))[_0x4ae2('0x6')](respondWithResult(_0xe99f9d,null))[_0x4ae2('0xb')](handleError(_0xe99f9d,null));};exports[_0x4ae2('0x27')]=function(_0x771c14,_0x129adf){return respondWithRpcPromise('Outbound',_0x771c14[_0x4ae2('0x15')])[_0x4ae2('0x6')](respondWithResult(_0x129adf,null))[_0x4ae2('0xb')](handleError(_0x129adf,null));};exports[_0x4ae2('0x28')]=function(_0x49baf9,_0x2d4737){return respondWithRpcPromise(_0x4ae2('0x29'),_0x49baf9[_0x4ae2('0x15')])[_0x4ae2('0x6')](respondWithResult(_0x2d4737,null))[_0x4ae2('0xb')](handleError(_0x2d4737,null));};exports[_0x4ae2('0x2a')]=function(_0x1fdc61,_0x1b04ee){var _0x1d5888;return respondWithRpcPromise(_0x4ae2('0x2b'),_0x1fdc61[_0x4ae2('0x15')])['then'](function(_0x2c3676){_0x1d5888=_0x2c3676;return respondWithRpcPromise(_0x4ae2('0x2b'),_0x1fdc61[_0x4ae2('0x15')],routingClient);})[_0x4ae2('0x6')](function(_0x5bade3){return _['merge']({},_0x5bade3,_0x1d5888);})[_0x4ae2('0x6')](respondWithResult(_0x1b04ee,null))[_0x4ae2('0xb')](handleError(_0x1b04ee,null));};exports[_0x4ae2('0x2c')]=function(_0x3cdf23,_0x567371){if(_0x3cdf23[_0x4ae2('0x2d')]&&_0x3cdf23[_0x4ae2('0x2d')]['interaction']&&_0x3cdf23[_0x4ae2('0x2e')]&&_0x3cdf23[_0x4ae2('0x2e')][_0x4ae2('0xf')]){for(var _0x5a9126 in _0x3cdf23[_0x4ae2('0x2d')][_0x4ae2('0x2f')]){if(_0x3cdf23[_0x4ae2('0x2d')][_0x4ae2('0x2f')][_0x4ae2('0x30')](_0x5a9126)){db[_0x4ae2('0x31')][_0x4ae2('0x32')]({'where':{'channel':_0x5a9126,'membername':_0x3cdf23[_0x4ae2('0x2e')]['name'],'type':_0x4ae2('0x33'),'exitAt':null,'uniqueid':_0x3cdf23[_0x4ae2('0x2d')]['interaction'][_0x5a9126]&&_0x3cdf23[_0x4ae2('0x2d')][_0x4ae2('0x2f')][_0x5a9126]['length']?{'$notIn':_0x3cdf23[_0x4ae2('0x2d')][_0x4ae2('0x2f')][_0x5a9126]}:{'$ne':null}}})['then'](function(_0x21baf4){var _0x2ab00f=moment()[_0x4ae2('0x34')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4fc82f=0x0,_0x26681b=_0x21baf4[_0x4ae2('0x35')];_0x4fc82f<_0x26681b;_0x4fc82f+=0x1){_0x21baf4[_0x4fc82f][_0x4ae2('0x36')]({'exitAt':_0x2ab00f});}});for(var _0x8a17a4=0x0;_0x8a17a4<_0x3cdf23['body'][_0x4ae2('0x2f')][_0x5a9126][_0x4ae2('0x35')];_0x8a17a4+=0x1){db[_0x4ae2('0x31')]['findOrCreate']({'where':{'channel':_0x5a9126,'membername':_0x3cdf23[_0x4ae2('0x2e')][_0x4ae2('0xf')],'type':_0x4ae2('0x33'),'uniqueid':_0x3cdf23['body'][_0x4ae2('0x2f')][_0x5a9126][_0x8a17a4],'exitAt':null},'defaults':{'channel':_0x5a9126,'membername':_0x3cdf23[_0x4ae2('0x2e')][_0x4ae2('0xf')],'interface':_[_0x4ae2('0x10')](_0x3cdf23[_0x4ae2('0x2e')][_0x4ae2('0x37')])?util[_0x4ae2('0x34')](_0x4ae2('0x38'),_0x3cdf23[_0x4ae2('0x2e')][_0x4ae2('0xf')]):_0x3cdf23['user'][_0x4ae2('0x37')],'type':_0x4ae2('0x33'),'enterAt':moment()[_0x4ae2('0x34')](_0x4ae2('0x39')),'role':_0x4ae2('0x3a'),'internal':_0x3cdf23[_0x4ae2('0x2e')][_0x4ae2('0x3b')],'uniqueid':_0x3cdf23[_0x4ae2('0x2d')]['interaction'][_0x5a9126][_0x8a17a4]}});}}}}return respondWithRpcPromise(_0x4ae2('0x3c'),{'id':_0x3cdf23[_0x4ae2('0x1d')]['id'],'capacity':_0x3cdf23['body'][_0x4ae2('0x3d')]},routingClient)[_0x4ae2('0x6')](respondWithResult(_0x567371,null))['catch'](handleError(_0x567371,null));};exports[_0x4ae2('0x3e')]=function(_0x4d6560,_0x426d29){return respondWithRpcPromise('Telephones',_0x4d6560[_0x4ae2('0x15')])[_0x4ae2('0x6')](respondWithResult(_0x426d29,null))[_0x4ae2('0xb')](handleError(_0x426d29,null));};exports[_0x4ae2('0x3f')]=function(_0x8525c4,_0x153673){return respondWithRpcPromise(_0x4ae2('0x40'),_0x8525c4[_0x4ae2('0x15')])[_0x4ae2('0x6')](respondWithResult(_0x153673,null))['catch'](handleError(_0x153673,null));};exports[_0x4ae2('0x41')]=function(_0x4284b4,_0x825c3a){return respondWithRpcPromise(_0x4ae2('0x42'),_0x4284b4['query'])[_0x4ae2('0x6')](respondWithResult(_0x825c3a,null))[_0x4ae2('0xb')](handleError(_0x825c3a,null));};exports[_0x4ae2('0x43')]=function(_0x49029e,_0x51f845){return respondWithRpcPromise(_0x4ae2('0x44'),_0x49029e[_0x4ae2('0x15')],routingClient)[_0x4ae2('0x6')](respondWithResult(_0x51f845,null))[_0x4ae2('0xb')](handleError(_0x51f845,null));};exports[_0x4ae2('0x45')]=function(_0x28d68e,_0x18a8e6){return respondWithRpcPromise(_0x4ae2('0x44'),_0x28d68e[_0x4ae2('0x15')],routingClient)['then'](findById(_0x28d68e[_0x4ae2('0x1d')]['id']))['then'](respondWithResult(_0x18a8e6,null))[_0x4ae2('0xb')](handleError(_0x18a8e6,null));};exports[_0x4ae2('0x46')]=function(_0x28e7a8,_0x2143fe){return respondWithRpcPromise(_0x4ae2('0x47'),_0x28e7a8[_0x4ae2('0x15')],routingClient)[_0x4ae2('0x6')](respondWithResult(_0x2143fe,null))[_0x4ae2('0xb')](handleError(_0x2143fe,null));};exports['showMailQueues']=function(_0x496f98,_0x33fb77){return respondWithRpcPromise(_0x4ae2('0x47'),_0x496f98[_0x4ae2('0x15')],routingClient)['then'](findById(_0x496f98['params']['id']))[_0x4ae2('0x6')](respondWithResult(_0x33fb77,null))[_0x4ae2('0xb')](handleError(_0x33fb77,null));};exports[_0x4ae2('0x48')]=function(_0x201b25,_0x41601d){return respondWithRpcPromise('MailAccounts',_0x201b25['query'],mailClient)['then'](respondWithResult(_0x41601d,null))[_0x4ae2('0xb')](handleError(_0x41601d,null));};exports['openchannelQueues']=function(_0x4e54d1,_0x17f023){return respondWithRpcPromise('OpenchannelQueues',_0x4e54d1[_0x4ae2('0x15')],routingClient)['then'](respondWithResult(_0x17f023,null))[_0x4ae2('0xb')](handleError(_0x17f023,null));};exports['showOpenchannelQueues']=function(_0xf417c0,_0x51141d){return respondWithRpcPromise(_0x4ae2('0x49'),_0xf417c0[_0x4ae2('0x15')],routingClient)[_0x4ae2('0x6')](findById(_0xf417c0[_0x4ae2('0x1d')]['id']))[_0x4ae2('0x6')](respondWithResult(_0x51141d,null))['catch'](handleError(_0x51141d,null));};exports['smsQueues']=function(_0x344963,_0x256d2f){return respondWithRpcPromise('SmsQueues',_0x344963[_0x4ae2('0x15')],routingClient)[_0x4ae2('0x6')](respondWithResult(_0x256d2f,null))['catch'](handleError(_0x256d2f,null));};exports[_0x4ae2('0x4a')]=function(_0xefd494,_0x49c58c){return respondWithRpcPromise('SmsQueues',_0xefd494[_0x4ae2('0x15')],routingClient)[_0x4ae2('0x6')](findById(_0xefd494['params']['id']))[_0x4ae2('0x6')](respondWithResult(_0x49c58c,null))[_0x4ae2('0xb')](handleError(_0x49c58c,null));};exports[_0x4ae2('0x4b')]=function(_0x30003b,_0x5af418){return respondWithRpcPromise(_0x4ae2('0x4c'),_0x30003b[_0x4ae2('0x15')],routingClient)['then'](respondWithResult(_0x5af418,null))[_0x4ae2('0xb')](handleError(_0x5af418,null));};exports[_0x4ae2('0x4d')]=function(_0x3412a1,_0x525cc5){return respondWithRpcPromise('WhatsappQueues',_0x3412a1[_0x4ae2('0x15')],routingClient)['then'](findById(_0x3412a1[_0x4ae2('0x1d')]['id']))['then'](respondWithResult(_0x525cc5,null))[_0x4ae2('0xb')](handleError(_0x525cc5,null));};exports['faxQueues']=function(_0x2758c0,_0x519763){return respondWithRpcPromise(_0x4ae2('0x4e'),_0x2758c0['query'],routingClient)['then'](respondWithResult(_0x519763,null))[_0x4ae2('0xb')](handleError(_0x519763,null));};exports[_0x4ae2('0x4f')]=function(_0x1a603b,_0xde3aac){return respondWithRpcPromise(_0x4ae2('0x4e'),_0x1a603b[_0x4ae2('0x15')],routingClient)[_0x4ae2('0x6')](findById(_0x1a603b[_0x4ae2('0x1d')]['id']))[_0x4ae2('0x6')](respondWithResult(_0xde3aac,null))[_0x4ae2('0xb')](handleError(_0xde3aac,null));};exports[_0x4ae2('0x50')]=function(_0x4403ed,_0x55f1fe){return respondWithRpcPromise(_0x4ae2('0x51'),_0x4403ed[_0x4ae2('0x15')])[_0x4ae2('0x6')](respondWithResult(_0x55f1fe,null))[_0x4ae2('0xb')](handleError(_0x55f1fe,null));};exports['chatQueuesWaitingInteractions']=function(_0x18f568,_0x5add54){return respondWithRpcPromise(_0x4ae2('0x52'),_0x18f568[_0x4ae2('0x15')],routingClient)[_0x4ae2('0x6')](respondWithResult(_0x5add54,null))[_0x4ae2('0xb')](handleError(_0x5add54,null));};exports[_0x4ae2('0x53')]=function(_0x318b4a,_0x4ed285){return respondWithRpcPromise(_0x4ae2('0x54'),_0x318b4a[_0x4ae2('0x15')],routingClient)[_0x4ae2('0x6')](respondWithResult(_0x4ed285,null))['catch'](handleError(_0x4ed285,null));};exports[_0x4ae2('0x55')]=function(_0x36f5c4,_0x4082d4){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x36f5c4[_0x4ae2('0x15')],routingClient)[_0x4ae2('0x6')](respondWithResult(_0x4082d4,null))[_0x4ae2('0xb')](handleError(_0x4082d4,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x2bb165,_0x278c5e){return respondWithRpcPromise(_0x4ae2('0x56'),_0x2bb165[_0x4ae2('0x15')],routingClient)['then'](function(_0x390c71){if(_0x2bb165[_0x4ae2('0x15')][_0x4ae2('0x57')]!==undefined){var _0x98272b=_(_0x390c71[_0x4ae2('0x11')])[_0x4ae2('0x58')]([_0x2bb165[_0x4ae2('0x15')]['type'],_0x2bb165['params']['id']])[_0x4ae2('0x59')](_0x4ae2('0x5a'))[_0x4ae2('0x5b')]()[_0x4ae2('0x5c')]();return _0x390c71[_0x4ae2('0x11')][_0x4ae2('0x58')](function(_0x4b0606){return _0x98272b[_0x4ae2('0x5d')](_0x4b0606[_0x4ae2('0x5a')])>-0x1;});}else{return _0x390c71[_0x4ae2('0x11')][_0x4ae2('0x58')](function(_0x22a880){return _0x22a880[_0x4ae2('0x5a')]===parseInt(_0x2bb165['params']['id']);});}})[_0x4ae2('0x6')](respondWithResult(_0x278c5e,null))[_0x4ae2('0xb')](handleError(_0x278c5e,null));};exports[_0x4ae2('0x5e')]=function(_0x3a84d7,_0x1bf2a4){return respondWithRpcPromise(_0x4ae2('0x5f'),_0x3a84d7['query'],routingClient)['then'](respondWithResult(_0x1bf2a4,null))[_0x4ae2('0xb')](handleError(_0x1bf2a4,null));};exports[_0x4ae2('0x60')]=function(_0x517ecb,_0x9320c1){return respondWithRpcPromise(_0x4ae2('0x61'),_0x517ecb[_0x4ae2('0x15')],routingClient)[_0x4ae2('0x6')](respondWithResult(_0x9320c1,null))[_0x4ae2('0xb')](handleError(_0x9320c1,null));};exports[_0x4ae2('0x62')]=function(_0xc4748b,_0x51cbf9){return respondWithRpcPromise(_0x4ae2('0x63'),_0xc4748b[_0x4ae2('0x15')],routingClient)[_0x4ae2('0x6')](respondWithResult(_0x51cbf9,null))[_0x4ae2('0xb')](handleError(_0x51cbf9,null));};exports[_0x4ae2('0x64')]=function(_0x29b0d0){return function(_0x555d17,_0x2cba96){var _0x417774,_0x17f398;var _0x58474e=_[_0x4ae2('0x65')](_0x29b0d0);var _0x49da03=_0x29b0d0===_0x4ae2('0x66')?_0x4ae2('0x67'):_0x4ae2('0x68');return db[_0x58474e+_0x4ae2('0x69')][_0x4ae2('0x6a')]({'raw':!![],'where':{'id':_0x555d17['params']['id']}})[_0x4ae2('0x6')](function(_0x384c7e){if(_[_0x4ae2('0x10')](_0x384c7e)){throw new Error(_0x58474e+_0x4ae2('0x6b'));}_0x417774=_0x384c7e;return db[_0x58474e+'Message'][_0x4ae2('0x6a')]({'where':{'id':_0x555d17['body'][_0x4ae2('0x6c')]},'include':[{'model':db[_0x58474e+_0x4ae2('0x6d')],'as':'Interaction'},{'model':db[_0x58474e+_0x49da03],'as':_0x4ae2('0x68')}]});})[_0x4ae2('0x6')](function(_0x29eaf4){if(_[_0x4ae2('0x10')](_0x29eaf4)){throw new Error(_0x58474e+_0x4ae2('0x6e'));}_0x17f398=_0x29eaf4;return _0x29eaf4[_0x4ae2('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2f97d7={'uniqueid':_0x29b0d0+'.'+_0x17f398['id']+'.'+_0x17f398['Interaction']['id'],'FromUserId':_0x555d17[_0x4ae2('0x2e')]['id'],'type':_0x4ae2('0x70')};_0x2f97d7[_0x58474e+_0x4ae2('0x71')]=_0x17f398['id'];_0x2f97d7[_0x58474e+_0x4ae2('0x72')]=_0x17f398[_0x4ae2('0x6d')]['id'];_0x2f97d7[_0x4ae2('0x73')+_0x58474e+_0x49da03+'Id']=_0x17f398['Account']['id'];_0x2f97d7['To'+_0x58474e+'QueueId']=_0x417774['id'];return db[_0x58474e+_0x4ae2('0x74')][_0x4ae2('0x75')](_0x2f97d7);})[_0x4ae2('0x6')](function(){return respondWithRpcPromise(_0x4ae2('0x76'),{'channel':_0x29b0d0,'interaction':_0x17f398[_0x4ae2('0x6d')],'message':_0x17f398,'account':_0x17f398[_0x4ae2('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4ae2('0x70'),'appdata':_0x417774[_0x4ae2('0xf')]+','+(_0x17f398['Account'][_0x4ae2('0x77')]||0x12c),'interval':_0x4ae2('0x78')}]},routingClient);})[_0x4ae2('0x6')](respondWithResult(_0x2cba96,null))[_0x4ae2('0xb')](handleError(_0x2cba96,null));};};exports[_0x4ae2('0x79')]=function(_0xa79171,_0xa42e4d){var _0x1deb7d,_0x8d0217;if(_[_0x4ae2('0x10')](_0xa79171[_0x4ae2('0x2d')][_0x4ae2('0x7a')])){throw new Error(_0x4ae2('0x7b'));}var _0x310f93=_0xa79171[_0x4ae2('0x2d')][_0x4ae2('0x7a')];var _0x31c1f7=_['capitalize'](_0x310f93);var _0x3de590=_0x310f93===_0x4ae2('0x66')?_0x4ae2('0x67'):'Account';return db['User'][_0x4ae2('0x6a')]({'raw':!![],'where':{'id':_0xa79171[_0x4ae2('0x1d')]['id'],'role':'agent'}})[_0x4ae2('0x6')](function(_0x21c4ec){if(_['isNil'](_0x21c4ec)){throw new Error(_0x4ae2('0x7c'));}_0x1deb7d=_0x21c4ec;return db[_0x31c1f7+'Message']['findOne']({'where':{'id':_0xa79171['body'][_0x4ae2('0x6c')]},'include':[{'model':db[_0x31c1f7+'Interaction'],'as':_0x4ae2('0x6d')},{'model':db[_0x31c1f7+_0x3de590],'as':_0x4ae2('0x68')}]});})[_0x4ae2('0x6')](function(_0x232e64){if(_[_0x4ae2('0x10')](_0x232e64)){throw new Error(_0x31c1f7+_0x4ae2('0x6e'));}_0x8d0217=_0x232e64;return _0x232e64[_0x4ae2('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4ae2('0x6')](function(){var _0x386c80={'uniqueid':_0x310f93+'.'+_0x8d0217['id']+'.'+_0x8d0217['Interaction']['id'],'FromUserId':_0xa79171[_0x4ae2('0x2e')]['id'],'type':_0x4ae2('0x70'),'ToUserId':_0x1deb7d['id']};_0x386c80[_0x31c1f7+_0x4ae2('0x71')]=_0x8d0217['id'];_0x386c80[_0x31c1f7+_0x4ae2('0x72')]=_0x8d0217['Interaction']['id'];_0x386c80[_0x4ae2('0x73')+_0x31c1f7+_0x3de590+'Id']=_0x8d0217[_0x4ae2('0x68')]['id'];return db[_0x31c1f7+_0x4ae2('0x74')]['create'](_0x386c80);})[_0x4ae2('0x6')](function(){return respondWithRpcPromise(_0x4ae2('0x76'),{'channel':_0x310f93,'interaction':_0x8d0217[_0x4ae2('0x6d')],'message':_0x8d0217,'account':_0x8d0217[_0x4ae2('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4ae2('0x3a'),'appdata':_0x1deb7d[_0x4ae2('0xf')]+','+(_0x8d0217[_0x4ae2('0x68')]['agentTransferTimeout']||0x12c),'interval':_0x4ae2('0x78')}]},routingClient);})[_0x4ae2('0x6')](respondWithResult(_0xa42e4d,null))[_0x4ae2('0xb')](handleError(_0xa42e4d,null));}; \ No newline at end of file +var _0x81bd=['client','http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','interface','SIP/%s','internal','AgentCapacity','capacity','telephones','Telephones','Trunks','campaigns','Campaigns','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','findOne','Message','Interaction','update','queue','InteractionId','From','QueueId','TransferReport','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','agent','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','MessageId','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api'];(function(_0xa3e76a,_0x424feb){var _0x519095=function(_0x5d4502){while(--_0x5d4502){_0xa3e76a['push'](_0xa3e76a['shift']());}};_0x519095(++_0x424feb);}(_0x81bd,0x7c));var _0xd81b=function(_0x3e3bed,_0x28cdc0){_0x3e3bed=_0x3e3bed-0x0;var _0x30595b=_0x81bd[_0x3e3bed];return _0x30595b;};'use strict';var BPromise=require(_0xd81b('0x0'));var moment=require(_0xd81b('0x1'));var _=require(_0xd81b('0x2'));var util=require(_0xd81b('0x3'));var db=require(_0xd81b('0x4'))['db'];var logger=require(_0xd81b('0x5'))(_0xd81b('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0xd81b('0x7')][_0xd81b('0x8')]({'port':0x232a});var mailClient=jayson[_0xd81b('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0xd81b('0x7')][_0xd81b('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x1f3f2c,_0x562084,_0x5e14e8){return new BPromise(function(_0xa4cf97,_0x5468d5){var _0x223515=_0x5e14e8?_0x5e14e8:amiClient;return _0x223515[_0xd81b('0x9')](_0x1f3f2c,_0x562084)[_0xd81b('0xa')](function(_0x86dab6){if(_0x86dab6[_0xd81b('0xb')]){if(_0x86dab6[_0xd81b('0xb')][_0xd81b('0xc')]===0x1f4){return _0x5468d5(_0x86dab6[_0xd81b('0xb')][_0xd81b('0xd')]);}return _0xa4cf97(_0x86dab6[_0xd81b('0xb')][_0xd81b('0xd')]);}else{_0xa4cf97(_0x86dab6[_0xd81b('0xe')]);}})[_0xd81b('0xf')](function(_0x560530){_0x5468d5(_0x560530);});});}function respondWithResult(_0x21dfff,_0x57f71d){_0x57f71d=_0x57f71d||0xc8;return function(_0x3f2405){if(_0x3f2405){return _0x21dfff[_0xd81b('0x10')](_0x57f71d)['json'](_0x3f2405);}return _0x21dfff[_0xd81b('0x11')](0x194);};}function handleError(_0x47dd04,_0x13dd00){_0x13dd00=_0x13dd00||0x1f4;return function(_0x41bf7a){logger[_0xd81b('0xb')](_0x41bf7a[_0xd81b('0x12')]);if(_0x41bf7a[_0xd81b('0x13')]){delete _0x41bf7a['name'];}_0x47dd04[_0xd81b('0x10')](_0x13dd00)[_0xd81b('0x14')](_0x41bf7a);};}function findById(_0x5c2863){return function(_0x2abef4){if(!_[_0xd81b('0x15')](_0x5c2863)&&!_[_0xd81b('0x15')](_0x2abef4)&&!_[_0xd81b('0x15')](_0x2abef4[_0xd81b('0x16')])){return _[_0xd81b('0x17')](_0x2abef4[_0xd81b('0x16')],function(_0x3d4d34){return _0x3d4d34['id']==_0x5c2863;});}return null;};}exports[_0xd81b('0x18')]=function(_0x285164,_0x1ff3c6){return respondWithRpcPromise(_0xd81b('0x19'),_0x285164[_0xd81b('0x1a')])[_0xd81b('0xa')](respondWithResult(_0x1ff3c6,null))[_0xd81b('0xf')](handleError(_0x1ff3c6,null));};exports[_0xd81b('0x1b')]=function(_0x5f101a,_0x4d566e){return respondWithRpcPromise(_0xd81b('0x1c'),_[_0xd81b('0x1d')](_0x5f101a[_0xd81b('0x1a')],_0x5f101a['params']))[_0xd81b('0xa')](respondWithResult(_0x4d566e,null))[_0xd81b('0xf')](handleError(_0x4d566e,null));};exports['voiceChannelStopMixMonitor']=function(_0xcd6474,_0x13d687){return respondWithRpcPromise(_0xd81b('0x1e'),_[_0xd81b('0x1d')](_0xcd6474[_0xd81b('0x1a')],_0xcd6474[_0xd81b('0x1f')]))[_0xd81b('0xa')](respondWithResult(_0x13d687,null))[_0xd81b('0xf')](handleError(_0x13d687,null));};exports[_0xd81b('0x20')]=function(_0x212c4e,_0x2ccedf){return respondWithRpcPromise(_0xd81b('0x21'),_0x212c4e['query'])[_0xd81b('0xa')](respondWithResult(_0x2ccedf,null))[_0xd81b('0xf')](handleError(_0x2ccedf,null));};exports[_0xd81b('0x22')]=function(_0x31b9fd,_0x3266c2){return respondWithRpcPromise(_0xd81b('0x21'),_0x31b9fd[_0xd81b('0x1a')])[_0xd81b('0xa')](findById(_0x31b9fd[_0xd81b('0x1f')]['id']))['then'](respondWithResult(_0x3266c2,null))[_0xd81b('0xf')](handleError(_0x3266c2,null));};exports['updateVoiceQueue']=function(_0x5c8aee,_0xb9ff9f){return respondWithRpcPromise(_0xd81b('0x23'),_['merge'](_0x5c8aee['body'],_0x5c8aee[_0xd81b('0x1f')]))[_0xd81b('0xa')](respondWithResult(_0xb9ff9f,null))[_0xd81b('0xf')](handleError(_0xb9ff9f,null));};exports[_0xd81b('0x24')]=function(_0x1a1572,_0x4654ba){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xd81b('0x1d')](_0x1a1572[_0xd81b('0x1a')],_0x1a1572['params']))['then'](respondWithResult(_0x4654ba,null))[_0xd81b('0xf')](handleError(_0x4654ba,null));};exports[_0xd81b('0x25')]=function(_0x50472a,_0x50ce25){return respondWithRpcPromise('VoiceQueuesChannels',_0x50472a[_0xd81b('0x1a')])[_0xd81b('0xa')](respondWithResult(_0x50ce25,null))[_0xd81b('0xf')](handleError(_0x50ce25,null));};exports[_0xd81b('0x26')]=function(_0xa56339,_0x12ee8f){return respondWithRpcPromise(_0xd81b('0x27'),_['merge'](_0xa56339[_0xd81b('0x1a')],_0xa56339['params']))[_0xd81b('0xa')](respondWithResult(_0x12ee8f,null))[_0xd81b('0xf')](handleError(_0x12ee8f,null));};exports[_0xd81b('0x28')]=function(_0xcd9e86,_0x36c69f){return respondWithRpcPromise(_0xd81b('0x29'),_[_0xd81b('0x1d')](_0xcd9e86[_0xd81b('0x1a')],_0xcd9e86[_0xd81b('0x1f')]))[_0xd81b('0xa')](respondWithResult(_0x36c69f,null))[_0xd81b('0xf')](handleError(_0x36c69f,null));};exports[_0xd81b('0x2a')]=function(_0x346038,_0x57bc0c){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xd81b('0x1d')](_0x346038[_0xd81b('0x1a')],_0x346038[_0xd81b('0x1f')]))['then'](respondWithResult(_0x57bc0c,null))[_0xd81b('0xf')](handleError(_0x57bc0c,null));};exports[_0xd81b('0x2b')]=function(_0x5a236a,_0x46f058){return respondWithRpcPromise(_0xd81b('0x2c'),_0x5a236a['query'])[_0xd81b('0xa')](respondWithResult(_0x46f058,null))['catch'](handleError(_0x46f058,null));};exports[_0xd81b('0x2d')]=function(_0x2502d1,_0x203365){return respondWithRpcPromise(_0xd81b('0x2e'),_0x2502d1['query'])[_0xd81b('0xa')](respondWithResult(_0x203365,null))[_0xd81b('0xf')](handleError(_0x203365,null));};exports[_0xd81b('0x2f')]=function(_0x67fbe5,_0x3abd60){var _0x466e98;return respondWithRpcPromise(_0xd81b('0x30'),_0x67fbe5['query'])[_0xd81b('0xa')](function(_0x35a295){_0x466e98=_0x35a295;return respondWithRpcPromise(_0xd81b('0x30'),_0x67fbe5['query'],routingClient);})[_0xd81b('0xa')](function(_0x3a05f4){return _[_0xd81b('0x1d')]({},_0x3a05f4,_0x466e98);})[_0xd81b('0xa')](respondWithResult(_0x3abd60,null))[_0xd81b('0xf')](handleError(_0x3abd60,null));};exports['agentCapacity']=function(_0x3dfba7,_0x11d617){if(_0x3dfba7[_0xd81b('0x31')]&&_0x3dfba7[_0xd81b('0x31')][_0xd81b('0x32')]&&_0x3dfba7[_0xd81b('0x33')]&&_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x13')]){for(var _0x4405a8 in _0x3dfba7[_0xd81b('0x31')][_0xd81b('0x32')]){if(_0x3dfba7['body'][_0xd81b('0x32')][_0xd81b('0x34')](_0x4405a8)){db[_0xd81b('0x35')][_0xd81b('0x36')]({'where':{'channel':_0x4405a8,'membername':_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x13')],'type':_0xd81b('0x37'),'exitAt':null,'uniqueid':_0x3dfba7[_0xd81b('0x31')]['interaction'][_0x4405a8]&&_0x3dfba7['body'][_0xd81b('0x32')][_0x4405a8][_0xd81b('0x38')]?{'$notIn':_0x3dfba7[_0xd81b('0x31')][_0xd81b('0x32')][_0x4405a8]}:{'$ne':null}}})[_0xd81b('0xa')](function(_0x37031b){var _0x334bd0=moment()[_0xd81b('0x39')](_0xd81b('0x3a'));for(var _0xcfbbc2=0x0,_0x41e2e6=_0x37031b[_0xd81b('0x38')];_0xcfbbc2<_0x41e2e6;_0xcfbbc2+=0x1){_0x37031b[_0xcfbbc2]['updateAttributes']({'exitAt':_0x334bd0});}});for(var _0x27d18a=0x0;_0x27d18a<_0x3dfba7[_0xd81b('0x31')][_0xd81b('0x32')][_0x4405a8][_0xd81b('0x38')];_0x27d18a+=0x1){db[_0xd81b('0x35')][_0xd81b('0x3b')]({'where':{'channel':_0x4405a8,'membername':_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x13')],'type':_0xd81b('0x37'),'uniqueid':_0x3dfba7['body'][_0xd81b('0x32')][_0x4405a8][_0x27d18a],'exitAt':null},'defaults':{'channel':_0x4405a8,'membername':_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x13')],'interface':_[_0xd81b('0x15')](_0x3dfba7['user'][_0xd81b('0x3c')])?util[_0xd81b('0x39')](_0xd81b('0x3d'),_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x13')]):_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x3c')],'type':_0xd81b('0x37'),'enterAt':moment()[_0xd81b('0x39')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x3e')],'uniqueid':_0x3dfba7[_0xd81b('0x31')][_0xd81b('0x32')][_0x4405a8][_0x27d18a]}});}}}}return respondWithRpcPromise(_0xd81b('0x3f'),{'id':_0x3dfba7[_0xd81b('0x1f')]['id'],'capacity':_0x3dfba7[_0xd81b('0x31')][_0xd81b('0x40')]},routingClient)['then'](respondWithResult(_0x11d617,null))[_0xd81b('0xf')](handleError(_0x11d617,null));};exports[_0xd81b('0x41')]=function(_0x1b523c,_0x3d171a){return respondWithRpcPromise(_0xd81b('0x42'),_0x1b523c['query'])[_0xd81b('0xa')](respondWithResult(_0x3d171a,null))[_0xd81b('0xf')](handleError(_0x3d171a,null));};exports['trunks']=function(_0x1f13c3,_0x315bd5){return respondWithRpcPromise(_0xd81b('0x43'),_0x1f13c3[_0xd81b('0x1a')])[_0xd81b('0xa')](respondWithResult(_0x315bd5,null))[_0xd81b('0xf')](handleError(_0x315bd5,null));};exports[_0xd81b('0x44')]=function(_0x22f588,_0x3ed626){return respondWithRpcPromise(_0xd81b('0x45'),_0x22f588[_0xd81b('0x1a')])['then'](respondWithResult(_0x3ed626,null))[_0xd81b('0xf')](handleError(_0x3ed626,null));};exports['chatQueues']=function(_0x1800fa,_0x7b438c){return respondWithRpcPromise(_0xd81b('0x46'),_0x1800fa[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x7b438c,null))[_0xd81b('0xf')](handleError(_0x7b438c,null));};exports['showChatQueues']=function(_0x2d978d,_0xe0c9c6){return respondWithRpcPromise('ChatQueues',_0x2d978d['query'],routingClient)[_0xd81b('0xa')](findById(_0x2d978d['params']['id']))[_0xd81b('0xa')](respondWithResult(_0xe0c9c6,null))['catch'](handleError(_0xe0c9c6,null));};exports[_0xd81b('0x47')]=function(_0x315a66,_0x3d97ba){return respondWithRpcPromise('MailQueues',_0x315a66[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x3d97ba,null))['catch'](handleError(_0x3d97ba,null));};exports[_0xd81b('0x48')]=function(_0x108aaf,_0x5951ec){return respondWithRpcPromise(_0xd81b('0x49'),_0x108aaf['query'],routingClient)[_0xd81b('0xa')](findById(_0x108aaf[_0xd81b('0x1f')]['id']))[_0xd81b('0xa')](respondWithResult(_0x5951ec,null))[_0xd81b('0xf')](handleError(_0x5951ec,null));};exports[_0xd81b('0x4a')]=function(_0x32eab4,_0x2f2afe){return respondWithRpcPromise(_0xd81b('0x4b'),_0x32eab4[_0xd81b('0x1a')],mailClient)[_0xd81b('0xa')](respondWithResult(_0x2f2afe,null))['catch'](handleError(_0x2f2afe,null));};exports[_0xd81b('0x4c')]=function(_0x434434,_0x385841){return respondWithRpcPromise(_0xd81b('0x4d'),_0x434434[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x385841,null))[_0xd81b('0xf')](handleError(_0x385841,null));};exports['showOpenchannelQueues']=function(_0x57f0fb,_0x5de22d){return respondWithRpcPromise(_0xd81b('0x4d'),_0x57f0fb[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](findById(_0x57f0fb[_0xd81b('0x1f')]['id']))[_0xd81b('0xa')](respondWithResult(_0x5de22d,null))[_0xd81b('0xf')](handleError(_0x5de22d,null));};exports[_0xd81b('0x4e')]=function(_0x5afecf,_0x3fcd8c){return respondWithRpcPromise(_0xd81b('0x4f'),_0x5afecf[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x3fcd8c,null))[_0xd81b('0xf')](handleError(_0x3fcd8c,null));};exports[_0xd81b('0x50')]=function(_0xb5fca8,_0x4ed17d){return respondWithRpcPromise(_0xd81b('0x4f'),_0xb5fca8[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](findById(_0xb5fca8[_0xd81b('0x1f')]['id']))[_0xd81b('0xa')](respondWithResult(_0x4ed17d,null))[_0xd81b('0xf')](handleError(_0x4ed17d,null));};exports[_0xd81b('0x51')]=function(_0x19d4f0,_0x8fa8cd){return respondWithRpcPromise(_0xd81b('0x52'),_0x19d4f0[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x8fa8cd,null))['catch'](handleError(_0x8fa8cd,null));};exports[_0xd81b('0x53')]=function(_0x5358a6,_0x2e7141){return respondWithRpcPromise(_0xd81b('0x52'),_0x5358a6[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](findById(_0x5358a6[_0xd81b('0x1f')]['id']))[_0xd81b('0xa')](respondWithResult(_0x2e7141,null))[_0xd81b('0xf')](handleError(_0x2e7141,null));};exports[_0xd81b('0x54')]=function(_0x10d6d2,_0x36fb7a){return respondWithRpcPromise('FaxQueues',_0x10d6d2[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x36fb7a,null))[_0xd81b('0xf')](handleError(_0x36fb7a,null));};exports[_0xd81b('0x55')]=function(_0x7720d3,_0x5abbb4){return respondWithRpcPromise('FaxQueues',_0x7720d3[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](findById(_0x7720d3[_0xd81b('0x1f')]['id']))[_0xd81b('0xa')](respondWithResult(_0x5abbb4,null))[_0xd81b('0xf')](handleError(_0x5abbb4,null));};exports[_0xd81b('0x56')]=function(_0xaee7e3,_0x539132){return respondWithRpcPromise(_0xd81b('0x57'),_0xaee7e3[_0xd81b('0x1a')])[_0xd81b('0xa')](respondWithResult(_0x539132,null))[_0xd81b('0xf')](handleError(_0x539132,null));};exports[_0xd81b('0x58')]=function(_0x21d039,_0x1e0da3){return respondWithRpcPromise(_0xd81b('0x59'),_0x21d039[_0xd81b('0x1a')],routingClient)['then'](respondWithResult(_0x1e0da3,null))[_0xd81b('0xf')](handleError(_0x1e0da3,null));};exports[_0xd81b('0x5a')]=function(_0x3858eb,_0x9c30e7){return respondWithRpcPromise(_0xd81b('0x5b'),_0x3858eb['query'],routingClient)[_0xd81b('0xa')](respondWithResult(_0x9c30e7,null))[_0xd81b('0xf')](handleError(_0x9c30e7,null));};exports['openchannelQueuesWaitingInteractions']=function(_0xa00645,_0x43e593){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0xa00645[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x43e593,null))[_0xd81b('0xf')](handleError(_0x43e593,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x2aff4b,_0x3db4d7){return respondWithRpcPromise(_0xd81b('0x5c'),_0x2aff4b['query'],routingClient)['then'](function(_0xdd970d){if(_0x2aff4b[_0xd81b('0x1a')][_0xd81b('0x5d')]!==undefined){var _0x5d601d=_(_0xdd970d[_0xd81b('0x16')])[_0xd81b('0x5e')]([_0x2aff4b[_0xd81b('0x1a')][_0xd81b('0x5d')],_0x2aff4b['params']['id']])['map'](_0xd81b('0x5f'))[_0xd81b('0x60')]()[_0xd81b('0x61')]();return _0xdd970d[_0xd81b('0x16')]['filter'](function(_0x1b8b17){return _0x5d601d[_0xd81b('0x62')](_0x1b8b17['queue_id'])>-0x1;});}else{return _0xdd970d[_0xd81b('0x16')]['filter'](function(_0x32a8f4){return _0x32a8f4[_0xd81b('0x5f')]===parseInt(_0x2aff4b['params']['id']);});}})[_0xd81b('0xa')](respondWithResult(_0x3db4d7,null))[_0xd81b('0xf')](handleError(_0x3db4d7,null));};exports[_0xd81b('0x63')]=function(_0x2490f1,_0x2b0fe4){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2490f1[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x2b0fe4,null))[_0xd81b('0xf')](handleError(_0x2b0fe4,null));};exports[_0xd81b('0x64')]=function(_0x1919b2,_0x2b1d96){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x1919b2['query'],routingClient)[_0xd81b('0xa')](respondWithResult(_0x2b1d96,null))[_0xd81b('0xf')](handleError(_0x2b1d96,null));};exports[_0xd81b('0x65')]=function(_0x15aed5,_0x4dd8ac){return respondWithRpcPromise(_0xd81b('0x66'),_0x15aed5[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x4dd8ac,null))[_0xd81b('0xf')](handleError(_0x4dd8ac,null));};exports[_0xd81b('0x67')]=function(_0x589882){return function(_0x3744bf,_0x374ac0){var _0x159b28,_0x40b468;var _0x1d596c=_[_0xd81b('0x68')](_0x589882);var _0x402eb9=_0x589882==='chat'?_0xd81b('0x69'):_0xd81b('0x6a');return db[_0x1d596c+_0xd81b('0x6b')][_0xd81b('0x6c')]({'raw':!![],'where':{'id':_0x3744bf[_0xd81b('0x1f')]['id']}})[_0xd81b('0xa')](function(_0x59bee6){if(_[_0xd81b('0x15')](_0x59bee6)){throw new Error(_0x1d596c+'\x20Queue\x20not\x20found');}_0x159b28=_0x59bee6;return db[_0x1d596c+_0xd81b('0x6d')][_0xd81b('0x6c')]({'where':{'id':_0x3744bf[_0xd81b('0x31')]['messageId']},'include':[{'model':db[_0x1d596c+_0xd81b('0x6e')],'as':_0xd81b('0x6e')},{'model':db[_0x1d596c+_0x402eb9],'as':_0xd81b('0x6a')}]});})[_0xd81b('0xa')](function(_0x254105){if(_[_0xd81b('0x15')](_0x254105)){throw new Error(_0x1d596c+'\x20Message\x20not\x20found');}_0x40b468=_0x254105;return _0x254105[_0xd81b('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5f5514={'uniqueid':_0x589882+'.'+_0x40b468['id']+'.'+_0x40b468[_0xd81b('0x6e')]['id'],'FromUserId':_0x3744bf[_0xd81b('0x33')]['id'],'type':_0xd81b('0x70')};_0x5f5514[_0x1d596c+'MessageId']=_0x40b468['id'];_0x5f5514[_0x1d596c+_0xd81b('0x71')]=_0x40b468[_0xd81b('0x6e')]['id'];_0x5f5514[_0xd81b('0x72')+_0x1d596c+_0x402eb9+'Id']=_0x40b468[_0xd81b('0x6a')]['id'];_0x5f5514['To'+_0x1d596c+_0xd81b('0x73')]=_0x159b28['id'];return db[_0x1d596c+_0xd81b('0x74')]['create'](_0x5f5514);})[_0xd81b('0xa')](function(){return respondWithRpcPromise(_0xd81b('0x75'),{'channel':_0x589882,'interaction':_0x40b468[_0xd81b('0x6e')],'message':_0x40b468,'account':_0x40b468[_0xd81b('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd81b('0x70'),'appdata':_0x159b28[_0xd81b('0x13')]+','+(_0x40b468[_0xd81b('0x6a')][_0xd81b('0x76')]||0x12c),'interval':_0xd81b('0x77')}]},routingClient);})[_0xd81b('0xa')](respondWithResult(_0x374ac0,null))[_0xd81b('0xf')](handleError(_0x374ac0,null));};};exports[_0xd81b('0x78')]=function(_0x42eb62,_0x2c19fd){var _0x36d8fd,_0x5adfe4;if(_[_0xd81b('0x15')](_0x42eb62['body'][_0xd81b('0x79')])){throw new Error(_0xd81b('0x7a'));}var _0x1ca94b=_0x42eb62[_0xd81b('0x31')][_0xd81b('0x79')];var _0x115805=_['capitalize'](_0x1ca94b);var _0x3a41e6=_0x1ca94b===_0xd81b('0x7b')?_0xd81b('0x69'):_0xd81b('0x6a');return db[_0xd81b('0x7c')][_0xd81b('0x6c')]({'raw':!![],'where':{'id':_0x42eb62[_0xd81b('0x1f')]['id'],'role':_0xd81b('0x7d')}})[_0xd81b('0xa')](function(_0xfacc8f){if(_[_0xd81b('0x15')](_0xfacc8f)){throw new Error(_0xd81b('0x7e'));}_0x36d8fd=_0xfacc8f;return db[_0x115805+'Message'][_0xd81b('0x6c')]({'where':{'id':_0x42eb62[_0xd81b('0x31')][_0xd81b('0x7f')]},'include':[{'model':db[_0x115805+_0xd81b('0x6e')],'as':_0xd81b('0x6e')},{'model':db[_0x115805+_0x3a41e6],'as':'Account'}]});})[_0xd81b('0xa')](function(_0x1e61d8){if(_[_0xd81b('0x15')](_0x1e61d8)){throw new Error(_0x115805+_0xd81b('0x80'));}_0x5adfe4=_0x1e61d8;return _0x1e61d8[_0xd81b('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd81b('0xa')](function(){var _0x4e4919={'uniqueid':_0x1ca94b+'.'+_0x5adfe4['id']+'.'+_0x5adfe4[_0xd81b('0x6e')]['id'],'FromUserId':_0x42eb62['user']['id'],'type':_0xd81b('0x70'),'ToUserId':_0x36d8fd['id']};_0x4e4919[_0x115805+_0xd81b('0x81')]=_0x5adfe4['id'];_0x4e4919[_0x115805+_0xd81b('0x71')]=_0x5adfe4[_0xd81b('0x6e')]['id'];_0x4e4919['From'+_0x115805+_0x3a41e6+'Id']=_0x5adfe4[_0xd81b('0x6a')]['id'];return db[_0x115805+_0xd81b('0x74')]['create'](_0x4e4919);})[_0xd81b('0xa')](function(){return respondWithRpcPromise(_0xd81b('0x75'),{'channel':_0x1ca94b,'interaction':_0x5adfe4[_0xd81b('0x6e')],'message':_0x5adfe4,'account':_0x5adfe4[_0xd81b('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd81b('0x7d'),'appdata':_0x36d8fd['name']+','+(_0x5adfe4['Account'][_0xd81b('0x82')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xd81b('0xa')](respondWithResult(_0x2c19fd,null))['catch'](handleError(_0x2c19fd,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 60f3ca1..4c92f5f 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 _0xc5e0=['run','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id','show','/:id/run'];(function(_0x44a86d,_0x4ec2cf){var _0x51a150=function(_0x5e01ef){while(--_0x5e01ef){_0x44a86d['push'](_0x44a86d['shift']());}};_0x51a150(++_0x4ec2cf);}(_0xc5e0,0x1a5));var _0x0c5e=function(_0x12f9c2,_0x4eb207){_0x12f9c2=_0x12f9c2-0x0;var _0x249ba7=_0xc5e0[_0x12f9c2];return _0x249ba7;};'use strict';var multer=require(_0x0c5e('0x0'));var util=require(_0x0c5e('0x1'));var path=require(_0x0c5e('0x2'));var timeout=require(_0x0c5e('0x3'));var express=require('express');var router=express[_0x0c5e('0x4')]();var fs_extra=require(_0x0c5e('0x5'));var auth=require(_0x0c5e('0x6'));var interaction=require(_0x0c5e('0x7'));var config=require(_0x0c5e('0x8'));var controller=require(_0x0c5e('0x9'));router['get']('/',auth[_0x0c5e('0xa')](),controller[_0x0c5e('0xb')]);router[_0x0c5e('0xc')](_0x0c5e('0xd'),auth[_0x0c5e('0xa')](),controller[_0x0c5e('0xe')]);router[_0x0c5e('0xc')](_0x0c5e('0xf'),auth[_0x0c5e('0xa')](),controller[_0x0c5e('0x10')]);router[_0x0c5e('0x11')]('/',auth[_0x0c5e('0xa')](),controller[_0x0c5e('0x12')]);router['put'](_0x0c5e('0xd'),auth[_0x0c5e('0xa')](),controller[_0x0c5e('0x13')]);router[_0x0c5e('0x14')](_0x0c5e('0xd'),auth[_0x0c5e('0xa')](),controller[_0x0c5e('0x15')]);module[_0x0c5e('0x16')]=router; \ No newline at end of file +var _0xe4a0=['destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id','show','run','post','create','put','update','delete'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0xe4a0,0x152));var _0x0e4a=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xe4a0[_0x1035c1];return _0x308d67;};'use strict';var multer=require('multer');var util=require(_0x0e4a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0e4a('0x1'));var router=express[_0x0e4a('0x2')]();var fs_extra=require(_0x0e4a('0x3'));var auth=require(_0x0e4a('0x4'));var interaction=require(_0x0e4a('0x5'));var config=require(_0x0e4a('0x6'));var controller=require(_0x0e4a('0x7'));router['get']('/',auth[_0x0e4a('0x8')](),controller[_0x0e4a('0x9')]);router[_0x0e4a('0xa')](_0x0e4a('0xb'),auth[_0x0e4a('0x8')](),controller[_0x0e4a('0xc')]);router[_0x0e4a('0xa')]('/:id/run',auth[_0x0e4a('0x8')](),controller[_0x0e4a('0xd')]);router[_0x0e4a('0xe')]('/',auth[_0x0e4a('0x8')](),controller[_0x0e4a('0xf')]);router[_0x0e4a('0x10')]('/:id',auth[_0x0e4a('0x8')](),controller[_0x0e4a('0x11')]);router[_0x0e4a('0x12')](_0x0e4a('0xb'),auth[_0x0e4a('0x8')](),controller[_0x0e4a('0x13')]);module[_0x0e4a('0x14')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index c8c4615..09b2879 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 _0xca5d=['ENUM','years','quarters','months','hours','minutes','days','csv','xlsx','custom','default','BOOLEAN','TEXT','STRING','DATE'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xca5d,0x166));var _0xdca5=function(_0x35d7c0,_0x7ec082){_0x35d7c0=_0x35d7c0-0x0;var _0x28a6e4=_0xca5d[_0x35d7c0];return _0x28a6e4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xdca5('0x0')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xdca5('0x0')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xdca5('0x1')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xdca5('0x2')](_0xdca5('0x3'),_0xdca5('0x4'),_0xdca5('0x5'),'weeks','days',_0xdca5('0x6'),_0xdca5('0x7')),'allowNull':![],'defaultValue':_0xdca5('0x8')},'output':{'type':Sequelize['ENUM'](_0xdca5('0x9'),'pdf',_0xdca5('0xa')),'allowNull':![],'defaultValue':_0xdca5('0x9')},'type':{'type':Sequelize[_0xdca5('0x2')](_0xdca5('0xb'),_0xdca5('0xc')),'allowNull':![],'defaultValue':_0xdca5('0xb')},'sendMail':{'type':Sequelize[_0xdca5('0xd')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xdca5('0xe')]},'bcc':{'type':Sequelize[_0xdca5('0xe')]},'sendIfEmpty':{'type':Sequelize[_0xdca5('0xd')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6dc7=['BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','ENUM','quarters','weeks','minutes','csv','pdf','custom'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0x6dc7,0xd4));var _0x76dc=function(_0x573010,_0x2923c4){_0x573010=_0x573010-0x0;var _0x84c43d=_0x6dc7[_0x573010];return _0x84c43d;};'use strict';var Sequelize=require(_0x76dc('0x0'));module[_0x76dc('0x1')]={'name':{'type':Sequelize[_0x76dc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x76dc('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x76dc('0x2')],'allowNull':![],'defaultValue':_0x76dc('0x3')},'startAt':{'type':Sequelize[_0x76dc('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x76dc('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x76dc('0x5')]('years',_0x76dc('0x6'),'months',_0x76dc('0x7'),'days','hours',_0x76dc('0x8')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x76dc('0x5')](_0x76dc('0x9'),_0x76dc('0xa'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x76dc('0x5')]('custom','default'),'allowNull':![],'defaultValue':_0x76dc('0xb')},'sendMail':{'type':Sequelize[_0x76dc('0xc')],'defaultValue':![]},'email':{'type':Sequelize[_0x76dc('0x2')]},'cc':{'type':Sequelize[_0x76dc('0xd')]},'bcc':{'type':Sequelize[_0x76dc('0xd')]},'sendIfEmpty':{'type':Sequelize[_0x76dc('0xc')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index c2b99bc..57b4cf7 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 _0xce13=['where','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','Scheduler','UserProfileResource','destroy','end','error','stack','index','map','Schedule','rawAttributes','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter'];(function(_0x10de99,_0xdd42d){var _0x8550e5=function(_0x3c1aae){while(--_0x3c1aae){_0x10de99['push'](_0x10de99['shift']());}};_0x8550e5(++_0xdd42d);}(_0xce13,0x1c9));var _0x3ce1=function(_0x26c217,_0x12373a){_0x26c217=_0x26c217-0x0;var _0x28154f=_0xce13[_0x26c217];return _0x28154f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ce1('0x0'));var zipdir=require(_0x3ce1('0x1'));var jsonpatch=require(_0x3ce1('0x2'));var rp=require('request-promise');var moment=require(_0x3ce1('0x3'));var BPromise=require(_0x3ce1('0x4'));var Mustache=require(_0x3ce1('0x5'));var util=require(_0x3ce1('0x6'));var path=require(_0x3ce1('0x7'));var sox=require('sox');var csv=require(_0x3ce1('0x8'));var ejs=require(_0x3ce1('0x9'));var fs=require('fs');var fs_extra=require(_0x3ce1('0xa'));var _=require(_0x3ce1('0xb'));var squel=require(_0x3ce1('0xc'));var crypto=require(_0x3ce1('0xd'));var jsforce=require(_0x3ce1('0xe'));var deskjs=require(_0x3ce1('0xf'));var toCsv=require(_0x3ce1('0x8'));var querystring=require('querystring');var Papa=require(_0x3ce1('0x10'));var Redis=require(_0x3ce1('0x11'));var authService=require(_0x3ce1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3ce1('0x13'));var hardwareService=require(_0x3ce1('0x14'));var logger=require(_0x3ce1('0x15'))('api');var utils=require(_0x3ce1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3ce1('0x17'));var db=require(_0x3ce1('0x18'))['db'];function respondWithStatusCode(_0x1e2570,_0xb30b48){_0xb30b48=_0xb30b48||0xcc;return function(_0x4c439a){if(_0x4c439a){return _0x1e2570[_0x3ce1('0x19')](_0xb30b48);}return _0x1e2570[_0x3ce1('0x1a')](_0xb30b48)['end']();};}function respondWithResult(_0x13798c,_0x1d6f28){_0x1d6f28=_0x1d6f28||0xc8;return function(_0x3a2217){if(_0x3a2217){return _0x13798c[_0x3ce1('0x1a')](_0x1d6f28)[_0x3ce1('0x1b')](_0x3a2217);}};}function respondWithFilteredResult(_0xe5ffc5,_0x7e2253){return function(_0x406e57){if(_0x406e57){var _0x8d3035=typeof _0x7e2253[_0x3ce1('0x1c')]===_0x3ce1('0x1d')&&typeof _0x7e2253[_0x3ce1('0x1e')]===_0x3ce1('0x1d');var _0x523a74=_0x406e57[_0x3ce1('0x1f')];var _0x57b785=_0x8d3035?0x0:_0x7e2253[_0x3ce1('0x1c')];var _0x42e72e=_0x8d3035?_0x406e57[_0x3ce1('0x1f')]:_0x7e2253['offset']+_0x7e2253[_0x3ce1('0x1e')];var _0x21bbe9;if(_0x42e72e>=_0x523a74){_0x42e72e=_0x523a74;_0x21bbe9=0xc8;}else{_0x21bbe9=0xce;}_0xe5ffc5[_0x3ce1('0x1a')](_0x21bbe9);return _0xe5ffc5['set'](_0x3ce1('0x20'),_0x57b785+'-'+_0x42e72e+'/'+_0x523a74)[_0x3ce1('0x1b')](_0x406e57);}return null;};}function patchUpdates(_0x4256a5){return function(_0x3c0faa){try{jsonpatch[_0x3ce1('0x21')](_0x3c0faa,_0x4256a5,!![]);}catch(_0x4356d1){return BPromise[_0x3ce1('0x22')](_0x4356d1);}return _0x3c0faa[_0x3ce1('0x23')]();};}function saveUpdates(_0x192cef,_0x4ebad4){return function(_0x3aa5ab){if(_0x3aa5ab){return _0x3aa5ab[_0x3ce1('0x24')](_0x192cef)[_0x3ce1('0x25')](function(_0x2f4fc9){return _0x2f4fc9;});}return null;};}function removeEntity(_0x2d7e14,_0x21dd8f){return function(_0x5cf23a){if(_0x5cf23a){return _0x5cf23a['destroy']()['then'](function(){var _0x2bfced=_0x5cf23a[_0x3ce1('0x26')]({'plain':!![]});var _0x77ae62=_0x3ce1('0x27');return db[_0x3ce1('0x28')][_0x3ce1('0x29')]({'where':{'type':_0x77ae62,'resourceId':_0x2bfced['id']}})['then'](function(){return _0x5cf23a;});})[_0x3ce1('0x25')](function(){_0x2d7e14['status'](0xcc)[_0x3ce1('0x2a')]();});}};}function handleEntityNotFound(_0x712f27,_0x2d1fea){return function(_0x206747){if(!_0x206747){_0x712f27[_0x3ce1('0x19')](0x194);}return _0x206747;};}function handleError(_0x7f3f72,_0x34c6f8){_0x34c6f8=_0x34c6f8||0x1f4;return function(_0x4f1615){logger[_0x3ce1('0x2b')](_0x4f1615[_0x3ce1('0x2c')]);if(_0x4f1615['name']){delete _0x4f1615['name'];}_0x7f3f72[_0x3ce1('0x1a')](_0x34c6f8)['send'](_0x4f1615);};}exports[_0x3ce1('0x2d')]=function(_0x417744,_0x32507a){var _0x2bc1f7={},_0x469d57={},_0x34087b={'count':0x0,'rows':[]};var _0x55c14c=_[_0x3ce1('0x2e')](db[_0x3ce1('0x2f')][_0x3ce1('0x30')],function(_0x51f706){return{'name':_0x51f706['fieldName'],'type':_0x51f706[_0x3ce1('0x31')][_0x3ce1('0x32')]};});_0x469d57[_0x3ce1('0x33')]=_['map'](_0x55c14c,_0x3ce1('0x34'));_0x469d57[_0x3ce1('0x35')]=_[_0x3ce1('0x36')](_0x417744[_0x3ce1('0x35')]);_0x469d57[_0x3ce1('0x37')]=_['intersection'](_0x469d57[_0x3ce1('0x33')],_0x469d57[_0x3ce1('0x35')]);_0x2bc1f7['attributes']=_[_0x3ce1('0x38')](_0x469d57[_0x3ce1('0x33')],qs[_0x3ce1('0x39')](_0x417744[_0x3ce1('0x35')][_0x3ce1('0x39')]));_0x2bc1f7[_0x3ce1('0x3a')]=_0x2bc1f7[_0x3ce1('0x3a')][_0x3ce1('0x3b')]?_0x2bc1f7[_0x3ce1('0x3a')]:_0x469d57[_0x3ce1('0x33')];if(!_0x417744[_0x3ce1('0x35')][_0x3ce1('0x3c')]('nolimit')){_0x2bc1f7['limit']=qs[_0x3ce1('0x1e')](_0x417744[_0x3ce1('0x35')][_0x3ce1('0x1e')]);_0x2bc1f7[_0x3ce1('0x1c')]=qs[_0x3ce1('0x1c')](_0x417744['query'][_0x3ce1('0x1c')]);}_0x2bc1f7[_0x3ce1('0x3d')]=qs[_0x3ce1('0x3e')](_0x417744[_0x3ce1('0x35')][_0x3ce1('0x3e')]);_0x2bc1f7['where']=qs['filters'](_[_0x3ce1('0x3f')](_0x417744[_0x3ce1('0x35')],_0x469d57[_0x3ce1('0x37')]),_0x55c14c);if(_0x417744[_0x3ce1('0x35')][_0x3ce1('0x40')]){_0x2bc1f7[_0x3ce1('0x41')]=_[_0x3ce1('0x42')](_0x2bc1f7[_0x3ce1('0x41')],{'$or':_['map'](_0x55c14c,function(_0x44badf){if(_0x44badf[_0x3ce1('0x31')]!==_0x3ce1('0x43')){var _0x52fb65={};_0x52fb65[_0x44badf['name']]={'$like':'%'+_0x417744[_0x3ce1('0x35')][_0x3ce1('0x40')]+'%'};return _0x52fb65;}})});}_0x2bc1f7=_[_0x3ce1('0x42')]({},_0x2bc1f7,_0x417744[_0x3ce1('0x44')]);var _0x36c507={'where':_0x2bc1f7[_0x3ce1('0x41')]};return db[_0x3ce1('0x2f')]['count'](_0x36c507)['then'](function(_0x2a51e0){_0x34087b[_0x3ce1('0x1f')]=_0x2a51e0;if(_0x417744[_0x3ce1('0x35')]['includeAll']){_0x2bc1f7[_0x3ce1('0x45')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x2bc1f7);})[_0x3ce1('0x25')](function(_0x262539){_0x34087b[_0x3ce1('0x46')]=_0x262539;return _0x34087b;})[_0x3ce1('0x25')](respondWithFilteredResult(_0x32507a,_0x2bc1f7))[_0x3ce1('0x47')](handleError(_0x32507a,null));};exports[_0x3ce1('0x48')]=function(_0x331069,_0x116581){var _0x2c9f8e={'raw':![],'where':{'id':_0x331069[_0x3ce1('0x49')]['id']}},_0x125dd0={};_0x125dd0[_0x3ce1('0x33')]=_['keys'](db[_0x3ce1('0x2f')][_0x3ce1('0x30')]);_0x125dd0[_0x3ce1('0x35')]=_[_0x3ce1('0x36')](_0x331069[_0x3ce1('0x35')]);_0x125dd0['filters']=_[_0x3ce1('0x38')](_0x125dd0['model'],_0x125dd0[_0x3ce1('0x35')]);_0x2c9f8e[_0x3ce1('0x3a')]=_[_0x3ce1('0x38')](_0x125dd0[_0x3ce1('0x33')],qs[_0x3ce1('0x39')](_0x331069[_0x3ce1('0x35')][_0x3ce1('0x39')]));_0x2c9f8e[_0x3ce1('0x3a')]=_0x2c9f8e[_0x3ce1('0x3a')][_0x3ce1('0x3b')]?_0x2c9f8e[_0x3ce1('0x3a')]:_0x125dd0[_0x3ce1('0x33')];if(_0x331069[_0x3ce1('0x35')][_0x3ce1('0x4a')]){_0x2c9f8e[_0x3ce1('0x45')]=[{'all':!![]}];}_0x2c9f8e=_[_0x3ce1('0x42')]({},_0x2c9f8e,_0x331069['options']);return db['Schedule'][_0x3ce1('0x4b')](_0x2c9f8e)['then'](handleEntityNotFound(_0x116581,null))[_0x3ce1('0x25')](respondWithResult(_0x116581,null))[_0x3ce1('0x47')](handleError(_0x116581,null));};exports[_0x3ce1('0x4c')]=function(_0x5c3df1,_0x3f6cd5){return db[_0x3ce1('0x2f')][_0x3ce1('0x4c')](_0x5c3df1['body'],{})[_0x3ce1('0x25')](function(_0x5d0502){var _0x1ddae4=_0x5c3df1[_0x3ce1('0x4d')][_0x3ce1('0x26')]({'plain':!![]});if(!_0x1ddae4)throw new Error(_0x3ce1('0x4e'));if(_0x1ddae4[_0x3ce1('0x4f')]==='user'){var _0x2a0379=_0x5d0502[_0x3ce1('0x26')]({'plain':!![]});var _0x370ca0=_0x3ce1('0x27');return db[_0x3ce1('0x50')][_0x3ce1('0x4b')]({'where':{'name':_0x370ca0,'userProfileId':_0x1ddae4[_0x3ce1('0x51')]},'raw':!![]})[_0x3ce1('0x25')](function(_0x51ef1f){if(_0x51ef1f&&_0x51ef1f[_0x3ce1('0x52')]===0x0){return db[_0x3ce1('0x28')][_0x3ce1('0x4c')]({'name':_0x2a0379[_0x3ce1('0x34')],'resourceId':_0x2a0379['id'],'type':_0x51ef1f[_0x3ce1('0x34')],'sectionId':_0x51ef1f['id']},{})['then'](function(){return _0x5d0502;});}else{return _0x5d0502;}})[_0x3ce1('0x47')](function(_0x32b79d){logger[_0x3ce1('0x2b')](_0x3ce1('0x53'),_0x32b79d);throw _0x32b79d;});}return _0x5d0502;})[_0x3ce1('0x25')](respondWithResult(_0x3f6cd5,0xc9))[_0x3ce1('0x47')](handleError(_0x3f6cd5,null));};exports['update']=function(_0x5af647,_0x23508e){if(_0x5af647[_0x3ce1('0x54')]['id']){delete _0x5af647['body']['id'];}return db['Schedule']['find']({'where':{'id':_0x5af647['params']['id']}})[_0x3ce1('0x25')](handleEntityNotFound(_0x23508e,null))[_0x3ce1('0x25')](saveUpdates(_0x5af647['body'],null))['then'](respondWithResult(_0x23508e,null))[_0x3ce1('0x47')](handleError(_0x23508e,null));};exports[_0x3ce1('0x29')]=function(_0x140a77,_0x377bd3){return db[_0x3ce1('0x2f')][_0x3ce1('0x4b')]({'where':{'id':_0x140a77[_0x3ce1('0x49')]['id']}})[_0x3ce1('0x25')](handleEntityNotFound(_0x377bd3,null))['then'](removeEntity(_0x377bd3,null))[_0x3ce1('0x47')](handleError(_0x377bd3,null));};exports[_0x3ce1('0x55')]=function(_0x5c6c9c,_0x15b1ee,_0x2ca620){var _0x410dda=require(_0x3ce1('0x56'));return db[_0x3ce1('0x2f')][_0x3ce1('0x4b')]({'where':{'id':_0x5c6c9c[_0x3ce1('0x49')]['id']},'raw':!![]})[_0x3ce1('0x25')](handleEntityNotFound(_0x15b1ee,null))['then'](function(){_0x410dda[_0x3ce1('0x55')](_0x5c6c9c[_0x3ce1('0x49')]['id']);})[_0x3ce1('0x25')](respondWithStatusCode(_0x15b1ee,null))['catch'](handleError(_0x15b1ee,null));}; \ No newline at end of file +var _0x6d23=['options','Schedule','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','update','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','get','Scheduler','UserProfileResource','error','index','map','rawAttributes','fieldName','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','name'];(function(_0x30bcc0,_0x311904){var _0x2cf768=function(_0x28dbd2){while(--_0x28dbd2){_0x30bcc0['push'](_0x30bcc0['shift']());}};_0x2cf768(++_0x311904);}(_0x6d23,0x68));var _0x36d2=function(_0x216cb4,_0x26e051){_0x216cb4=_0x216cb4-0x0;var _0x303c7b=_0x6d23[_0x216cb4];return _0x303c7b;};'use strict';var emlformat=require(_0x36d2('0x0'));var rimraf=require(_0x36d2('0x1'));var zipdir=require(_0x36d2('0x2'));var jsonpatch=require(_0x36d2('0x3'));var rp=require('request-promise');var moment=require(_0x36d2('0x4'));var BPromise=require(_0x36d2('0x5'));var Mustache=require(_0x36d2('0x6'));var util=require(_0x36d2('0x7'));var path=require(_0x36d2('0x8'));var sox=require(_0x36d2('0x9'));var csv=require(_0x36d2('0xa'));var ejs=require(_0x36d2('0xb'));var fs=require('fs');var fs_extra=require(_0x36d2('0xc'));var _=require(_0x36d2('0xd'));var squel=require(_0x36d2('0xe'));var crypto=require(_0x36d2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x36d2('0x10'));var toCsv=require(_0x36d2('0xa'));var querystring=require(_0x36d2('0x11'));var Papa=require(_0x36d2('0x12'));var Redis=require(_0x36d2('0x13'));var authService=require(_0x36d2('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x36d2('0x15'));var hardwareService=require(_0x36d2('0x16'));var logger=require(_0x36d2('0x17'))(_0x36d2('0x18'));var utils=require('../../config/utils');var config=require(_0x36d2('0x19'));var licenseUtil=require(_0x36d2('0x1a'));var db=require(_0x36d2('0x1b'))['db'];function respondWithStatusCode(_0x422e2b,_0x4d4fe9){_0x4d4fe9=_0x4d4fe9||0xcc;return function(_0x7a0de1){if(_0x7a0de1){return _0x422e2b[_0x36d2('0x1c')](_0x4d4fe9);}return _0x422e2b[_0x36d2('0x1d')](_0x4d4fe9)[_0x36d2('0x1e')]();};}function respondWithResult(_0x23c071,_0x5573b6){_0x5573b6=_0x5573b6||0xc8;return function(_0x2fa0cc){if(_0x2fa0cc){return _0x23c071[_0x36d2('0x1d')](_0x5573b6)[_0x36d2('0x1f')](_0x2fa0cc);}};}function respondWithFilteredResult(_0x140c3e,_0x2f27ce){return function(_0x315464){if(_0x315464){var _0x2df13e=typeof _0x2f27ce[_0x36d2('0x20')]===_0x36d2('0x21')&&typeof _0x2f27ce[_0x36d2('0x22')]===_0x36d2('0x21');var _0x54e511=_0x315464['count'];var _0x21840b=_0x2df13e?0x0:_0x2f27ce[_0x36d2('0x20')];var _0x1e4767=_0x2df13e?_0x315464[_0x36d2('0x23')]:_0x2f27ce[_0x36d2('0x20')]+_0x2f27ce[_0x36d2('0x22')];var _0xe173b7;if(_0x1e4767>=_0x54e511){_0x1e4767=_0x54e511;_0xe173b7=0xc8;}else{_0xe173b7=0xce;}_0x140c3e[_0x36d2('0x1d')](_0xe173b7);return _0x140c3e[_0x36d2('0x24')](_0x36d2('0x25'),_0x21840b+'-'+_0x1e4767+'/'+_0x54e511)['json'](_0x315464);}return null;};}function patchUpdates(_0x1c8be3){return function(_0x1e9ad1){try{jsonpatch['apply'](_0x1e9ad1,_0x1c8be3,!![]);}catch(_0x1ccd6f){return BPromise[_0x36d2('0x26')](_0x1ccd6f);}return _0x1e9ad1[_0x36d2('0x27')]();};}function saveUpdates(_0xc33cb5,_0x38a141){return function(_0x1d520d){if(_0x1d520d){return _0x1d520d['update'](_0xc33cb5)[_0x36d2('0x28')](function(_0x201a02){return _0x201a02;});}return null;};}function removeEntity(_0x50729e,_0x164495){return function(_0x22ee6e){if(_0x22ee6e){return _0x22ee6e[_0x36d2('0x29')]()[_0x36d2('0x28')](function(){var _0xfc59db=_0x22ee6e[_0x36d2('0x2a')]({'plain':!![]});var _0x5e8c4a=_0x36d2('0x2b');return db[_0x36d2('0x2c')]['destroy']({'where':{'type':_0x5e8c4a,'resourceId':_0xfc59db['id']}})[_0x36d2('0x28')](function(){return _0x22ee6e;});})[_0x36d2('0x28')](function(){_0x50729e[_0x36d2('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x517f31,_0x47d142){return function(_0x55eb14){if(!_0x55eb14){_0x517f31[_0x36d2('0x1c')](0x194);}return _0x55eb14;};}function handleError(_0x5ebfc6,_0x1a76ce){_0x1a76ce=_0x1a76ce||0x1f4;return function(_0x2f9e9f){logger[_0x36d2('0x2d')](_0x2f9e9f['stack']);if(_0x2f9e9f['name']){delete _0x2f9e9f['name'];}_0x5ebfc6[_0x36d2('0x1d')](_0x1a76ce)['send'](_0x2f9e9f);};}exports[_0x36d2('0x2e')]=function(_0x1fc430,_0x152170){var _0x4c4fba={},_0x2215cc={},_0x718d73={'count':0x0,'rows':[]};var _0x5891c3=_[_0x36d2('0x2f')](db['Schedule'][_0x36d2('0x30')],function(_0x3f7493){return{'name':_0x3f7493[_0x36d2('0x31')],'type':_0x3f7493['type']['key']};});_0x2215cc['model']=_['map'](_0x5891c3,'name');_0x2215cc[_0x36d2('0x32')]=_[_0x36d2('0x33')](_0x1fc430[_0x36d2('0x32')]);_0x2215cc[_0x36d2('0x34')]=_['intersection'](_0x2215cc[_0x36d2('0x35')],_0x2215cc[_0x36d2('0x32')]);_0x4c4fba[_0x36d2('0x36')]=_[_0x36d2('0x37')](_0x2215cc['model'],qs[_0x36d2('0x38')](_0x1fc430['query'][_0x36d2('0x38')]));_0x4c4fba[_0x36d2('0x36')]=_0x4c4fba[_0x36d2('0x36')][_0x36d2('0x39')]?_0x4c4fba[_0x36d2('0x36')]:_0x2215cc[_0x36d2('0x35')];if(!_0x1fc430['query'][_0x36d2('0x3a')]('nolimit')){_0x4c4fba[_0x36d2('0x22')]=qs['limit'](_0x1fc430['query']['limit']);_0x4c4fba[_0x36d2('0x20')]=qs[_0x36d2('0x20')](_0x1fc430[_0x36d2('0x32')][_0x36d2('0x20')]);}_0x4c4fba[_0x36d2('0x3b')]=qs[_0x36d2('0x3c')](_0x1fc430[_0x36d2('0x32')][_0x36d2('0x3c')]);_0x4c4fba['where']=qs[_0x36d2('0x34')](_['pick'](_0x1fc430[_0x36d2('0x32')],_0x2215cc['filters']),_0x5891c3);if(_0x1fc430[_0x36d2('0x32')][_0x36d2('0x3d')]){_0x4c4fba['where']=_[_0x36d2('0x3e')](_0x4c4fba[_0x36d2('0x3f')],{'$or':_[_0x36d2('0x2f')](_0x5891c3,function(_0x542da2){if(_0x542da2['type']!==_0x36d2('0x40')){var _0x991451={};_0x991451[_0x542da2[_0x36d2('0x41')]]={'$like':'%'+_0x1fc430['query'][_0x36d2('0x3d')]+'%'};return _0x991451;}})});}_0x4c4fba=_[_0x36d2('0x3e')]({},_0x4c4fba,_0x1fc430[_0x36d2('0x42')]);var _0x1fb5d2={'where':_0x4c4fba[_0x36d2('0x3f')]};return db[_0x36d2('0x43')]['count'](_0x1fb5d2)[_0x36d2('0x28')](function(_0x538433){_0x718d73[_0x36d2('0x23')]=_0x538433;if(_0x1fc430[_0x36d2('0x32')][_0x36d2('0x44')]){_0x4c4fba[_0x36d2('0x45')]=[{'all':!![]}];}return db[_0x36d2('0x43')][_0x36d2('0x46')](_0x4c4fba);})[_0x36d2('0x28')](function(_0x1f2d12){_0x718d73[_0x36d2('0x47')]=_0x1f2d12;return _0x718d73;})[_0x36d2('0x28')](respondWithFilteredResult(_0x152170,_0x4c4fba))[_0x36d2('0x48')](handleError(_0x152170,null));};exports[_0x36d2('0x49')]=function(_0x4501da,_0x318552){var _0x41e7e3={'raw':![],'where':{'id':_0x4501da[_0x36d2('0x4a')]['id']}},_0x224fc9={};_0x224fc9[_0x36d2('0x35')]=_[_0x36d2('0x33')](db['Schedule'][_0x36d2('0x30')]);_0x224fc9[_0x36d2('0x32')]=_[_0x36d2('0x33')](_0x4501da[_0x36d2('0x32')]);_0x224fc9['filters']=_[_0x36d2('0x37')](_0x224fc9['model'],_0x224fc9[_0x36d2('0x32')]);_0x41e7e3[_0x36d2('0x36')]=_[_0x36d2('0x37')](_0x224fc9[_0x36d2('0x35')],qs[_0x36d2('0x38')](_0x4501da[_0x36d2('0x32')][_0x36d2('0x38')]));_0x41e7e3['attributes']=_0x41e7e3[_0x36d2('0x36')]['length']?_0x41e7e3[_0x36d2('0x36')]:_0x224fc9[_0x36d2('0x35')];if(_0x4501da[_0x36d2('0x32')][_0x36d2('0x44')]){_0x41e7e3[_0x36d2('0x45')]=[{'all':!![]}];}_0x41e7e3=_[_0x36d2('0x3e')]({},_0x41e7e3,_0x4501da['options']);return db['Schedule'][_0x36d2('0x4b')](_0x41e7e3)[_0x36d2('0x28')](handleEntityNotFound(_0x318552,null))['then'](respondWithResult(_0x318552,null))[_0x36d2('0x48')](handleError(_0x318552,null));};exports[_0x36d2('0x4c')]=function(_0x5c7daf,_0x5088e){return db[_0x36d2('0x43')][_0x36d2('0x4c')](_0x5c7daf[_0x36d2('0x4d')],{})['then'](function(_0x5d2d0d){var _0x3eafbc=_0x5c7daf[_0x36d2('0x4e')][_0x36d2('0x2a')]({'plain':!![]});if(!_0x3eafbc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3eafbc[_0x36d2('0x4f')]==='user'){var _0x4faa5d=_0x5d2d0d[_0x36d2('0x2a')]({'plain':!![]});var _0x4e5a55=_0x36d2('0x2b');return db[_0x36d2('0x50')][_0x36d2('0x4b')]({'where':{'name':_0x4e5a55,'userProfileId':_0x3eafbc['userProfileId']},'raw':!![]})[_0x36d2('0x28')](function(_0x5766e1){if(_0x5766e1&&_0x5766e1[_0x36d2('0x51')]===0x0){return db[_0x36d2('0x2c')]['create']({'name':_0x4faa5d[_0x36d2('0x41')],'resourceId':_0x4faa5d['id'],'type':_0x5766e1[_0x36d2('0x41')],'sectionId':_0x5766e1['id']},{})['then'](function(){return _0x5d2d0d;});}else{return _0x5d2d0d;}})[_0x36d2('0x48')](function(_0x32db4f){logger[_0x36d2('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32db4f);throw _0x32db4f;});}return _0x5d2d0d;})[_0x36d2('0x28')](respondWithResult(_0x5088e,0xc9))[_0x36d2('0x48')](handleError(_0x5088e,null));};exports[_0x36d2('0x52')]=function(_0x3af162,_0x1f5153){if(_0x3af162[_0x36d2('0x4d')]['id']){delete _0x3af162[_0x36d2('0x4d')]['id'];}return db[_0x36d2('0x43')][_0x36d2('0x4b')]({'where':{'id':_0x3af162[_0x36d2('0x4a')]['id']}})[_0x36d2('0x28')](handleEntityNotFound(_0x1f5153,null))['then'](saveUpdates(_0x3af162[_0x36d2('0x4d')],null))[_0x36d2('0x28')](respondWithResult(_0x1f5153,null))['catch'](handleError(_0x1f5153,null));};exports[_0x36d2('0x29')]=function(_0x113c52,_0x4af8e6){return db['Schedule'][_0x36d2('0x4b')]({'where':{'id':_0x113c52[_0x36d2('0x4a')]['id']}})[_0x36d2('0x28')](handleEntityNotFound(_0x4af8e6,null))['then'](removeEntity(_0x4af8e6,null))[_0x36d2('0x48')](handleError(_0x4af8e6,null));};exports[_0x36d2('0x53')]=function(_0xd13185,_0x4604f8,_0x47e7b6){var _0x21bc12=require(_0x36d2('0x54'));return db[_0x36d2('0x43')][_0x36d2('0x4b')]({'where':{'id':_0xd13185[_0x36d2('0x4a')]['id']},'raw':!![]})[_0x36d2('0x28')](handleEntityNotFound(_0x4604f8,null))[_0x36d2('0x28')](function(){_0x21bc12[_0x36d2('0x53')](_0xd13185['params']['id']);})[_0x36d2('0x28')](respondWithStatusCode(_0x4604f8,null))['catch'](handleError(_0x4604f8,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 97b383e..a434022 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 _0x32ca=['util','../../config/logger','request-promise','path','rimraf','../../config/environment','define','Schedule','tools_schedules'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x32ca,0x1e6));var _0xa32c=function(_0x4ad90a,_0x1130ce){_0x4ad90a=_0x4ad90a-0x0;var _0x3c1570=_0x32ca[_0x4ad90a];return _0x3c1570;};'use strict';var _=require('lodash');var util=require(_0xa32c('0x0'));var logger=require(_0xa32c('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa32c('0x2'));var fs=require('fs');var path=require(_0xa32c('0x3'));var rimraf=require(_0xa32c('0x4'));var config=require(_0xa32c('0x5'));var attributes=require('./schedule.attributes');module['exports']=function(_0x4d6c91,_0x41534c){return _0x4d6c91[_0xa32c('0x6')](_0xa32c('0x7'),attributes,{'tableName':_0xa32c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8f9=['path','rimraf','../../config/environment','./schedule.attributes','exports','Schedule','../../config/logger','api','bluebird'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xd8f9,0x10b));var _0x9d8f=function(_0xa9e95e,_0x384135){_0xa9e95e=_0xa9e95e-0x0;var _0xee0cc=_0xd8f9[_0xa9e95e];return _0xee0cc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9d8f('0x0'))(_0x9d8f('0x1'));var moment=require('moment');var BPromise=require(_0x9d8f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d8f('0x3'));var rimraf=require(_0x9d8f('0x4'));var config=require(_0x9d8f('0x5'));var attributes=require(_0x9d8f('0x6'));module[_0x9d8f('0x7')]=function(_0x429677,_0x5cdf66){return _0x429677['define'](_0x9d8f('0x8'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index c2f9801..795358c 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 _0xc972=['error','code','Schedule,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s'];(function(_0x390846,_0x3eb289){var _0x4e7977=function(_0x23f0e4){while(--_0x23f0e4){_0x390846['push'](_0x390846['shift']());}};_0x4e7977(++_0x3eb289);}(_0xc972,0x195));var _0x2c97=function(_0x6c29da,_0x19914b){_0x6c29da=_0x6c29da-0x0;var _0x5d4e37=_0xc972[_0x6c29da];return _0x5d4e37;};'use strict';var _=require('lodash');var util=require(_0x2c97('0x0'));var moment=require(_0x2c97('0x1'));var BPromise=require(_0x2c97('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c97('0x3'));var db=require(_0x2c97('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2c97('0x5'));var config=require(_0x2c97('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2c97('0x7')][_0x2c97('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3efaf2,_0x5bc9c7,_0x5542b6){return new BPromise(function(_0x3217ae,_0x4e98db){return client[_0x2c97('0x9')](_0x3efaf2,_0x5542b6)[_0x2c97('0xa')](function(_0x5ca4b7){logger['info']('Schedule,\x20%s,\x20%s',_0x5bc9c7,_0x2c97('0xb'));logger['debug'](_0x2c97('0xc'),_0x5bc9c7,_0x2c97('0xb'),JSON['stringify'](_0x5ca4b7));if(_0x5ca4b7[_0x2c97('0xd')]){if(_0x5ca4b7[_0x2c97('0xd')][_0x2c97('0xe')]===0x1f4){logger[_0x2c97('0xd')](_0x2c97('0xf'),_0x5bc9c7,_0x5ca4b7[_0x2c97('0xd')][_0x2c97('0x10')]);return _0x4e98db(_0x5ca4b7[_0x2c97('0xd')][_0x2c97('0x10')]);}logger[_0x2c97('0xd')](_0x2c97('0xf'),_0x5bc9c7,_0x5ca4b7[_0x2c97('0xd')][_0x2c97('0x10')]);return _0x3217ae(_0x5ca4b7[_0x2c97('0xd')][_0x2c97('0x10')]);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x5bc9c7,'request\x20sent');_0x3217ae(_0x5ca4b7[_0x2c97('0x11')][_0x2c97('0x10')]);}})[_0x2c97('0x12')](function(_0xfd39ec){logger[_0x2c97('0xd')](_0x2c97('0xf'),_0x5bc9c7,_0xfd39ec);_0x4e98db(_0xfd39ec);});});} \ No newline at end of file +var _0xa51a=['Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa51a,0x1ec));var _0xaa51=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xa51a[_0x2f1762];return _0x8ab21;};'use strict';var _=require(_0xaa51('0x0'));var util=require(_0xaa51('0x1'));var moment=require(_0xaa51('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa51('0x3'));var fs=require('fs');var Redis=require(_0xaa51('0x4'));var db=require(_0xaa51('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa51('0x6'))(_0xaa51('0x7'));var config=require(_0xaa51('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaa51('0x9')][_0xaa51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18c81f,_0x3d58ae,_0x507c37){return new BPromise(function(_0x3d5964,_0x21591d){return client[_0xaa51('0xb')](_0x18c81f,_0x507c37)[_0xaa51('0xc')](function(_0x2e6ba2){logger[_0xaa51('0xd')](_0xaa51('0xe'),_0x3d58ae,'request\x20sent');logger[_0xaa51('0xf')](_0xaa51('0x10'),_0x3d58ae,'request\x20sent',JSON[_0xaa51('0x11')](_0x2e6ba2));if(_0x2e6ba2[_0xaa51('0x12')]){if(_0x2e6ba2[_0xaa51('0x12')][_0xaa51('0x13')]===0x1f4){logger[_0xaa51('0x12')](_0xaa51('0xe'),_0x3d58ae,_0x2e6ba2[_0xaa51('0x12')]['message']);return _0x21591d(_0x2e6ba2[_0xaa51('0x12')][_0xaa51('0x14')]);}logger[_0xaa51('0x12')]('Schedule,\x20%s,\x20%s',_0x3d58ae,_0x2e6ba2[_0xaa51('0x12')][_0xaa51('0x14')]);return _0x3d5964(_0x2e6ba2[_0xaa51('0x12')][_0xaa51('0x14')]);}else{logger[_0xaa51('0xd')](_0xaa51('0xe'),_0x3d58ae,_0xaa51('0x15'));_0x3d5964(_0x2e6ba2[_0xaa51('0x16')]['message']);}})['catch'](function(_0x3c2675){logger['error'](_0xaa51('0xe'),_0x3d58ae,_0x3c2675);_0x21591d(_0x3c2675);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 036688b..f71a761 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 _0xe2a6=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','/:id','/:id/download','download','put'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xe2a6,0x17e));var _0x6e2a=function(_0x3e21f4,_0x43d310){_0x3e21f4=_0x3e21f4-0x0;var _0x40fc49=_0xe2a6[_0x3e21f4];return _0x40fc49;};'use strict';var multer=require(_0x6e2a('0x0'));var util=require(_0x6e2a('0x1'));var path=require('path');var timeout=require(_0x6e2a('0x2'));var express=require(_0x6e2a('0x3'));var router=express[_0x6e2a('0x4')]();var fs_extra=require(_0x6e2a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6e2a('0x6'));var config=require(_0x6e2a('0x7'));var controller=require(_0x6e2a('0x8'));router[_0x6e2a('0x9')]('/',auth[_0x6e2a('0xa')](),controller[_0x6e2a('0xb')]);router['get'](_0x6e2a('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x6e2a('0x9')](_0x6e2a('0xd'),auth[_0x6e2a('0xa')](),controller['show']);router[_0x6e2a('0x9')](_0x6e2a('0xe'),auth[_0x6e2a('0xa')](),controller[_0x6e2a('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6e2a('0x10')](_0x6e2a('0xd'),auth[_0x6e2a('0xa')](),controller[_0x6e2a('0x11')]);router[_0x6e2a('0x12')]('/:id',auth[_0x6e2a('0xa')](),controller[_0x6e2a('0x13')]);module[_0x6e2a('0x14')]=router; \ No newline at end of file +var _0xea55=['show','/:id/download','download','post','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x1546c2,_0x22e822){var _0x24583c=function(_0x3906f8){while(--_0x3906f8){_0x1546c2['push'](_0x1546c2['shift']());}};_0x24583c(++_0x22e822);}(_0xea55,0x105));var _0x5ea5=function(_0x197080,_0xe79f73){_0x197080=_0x197080-0x0;var _0x1b3669=_0xea55[_0x197080];return _0x1b3669;};'use strict';var multer=require(_0x5ea5('0x0'));var util=require(_0x5ea5('0x1'));var path=require(_0x5ea5('0x2'));var timeout=require('connect-timeout');var express=require(_0x5ea5('0x3'));var router=express['Router']();var fs_extra=require(_0x5ea5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5ea5('0x5'));var controller=require('./screenRecording.controller');router[_0x5ea5('0x6')]('/',auth['isAuthenticated'](),controller[_0x5ea5('0x7')]);router[_0x5ea5('0x6')](_0x5ea5('0x8'),auth[_0x5ea5('0x9')](),controller[_0x5ea5('0xa')]);router['get'](_0x5ea5('0xb'),auth[_0x5ea5('0x9')](),controller[_0x5ea5('0xc')]);router[_0x5ea5('0x6')](_0x5ea5('0xd'),auth['isAuthenticated'](),controller[_0x5ea5('0xe')]);router[_0x5ea5('0xf')]('/',auth[_0x5ea5('0x9')](),controller['create']);router[_0x5ea5('0x10')]('/:id',auth[_0x5ea5('0x9')](),controller[_0x5ea5('0x11')]);router[_0x5ea5('0x12')](_0x5ea5('0xb'),auth[_0x5ea5('0x9')](),controller[_0x5ea5('0x13')]);module[_0x5ea5('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 4bac59c..0b19dcb 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 _0xa064=['createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','value','getDataValue','STRING','replace','INTEGER','setDataValue','subtract','closedAt','duration','DATE','format','toString','MM-DD-YYYY\x20HH:mm'];(function(_0x1f4984,_0x55cefc){var _0x17696a=function(_0xde42a4){while(--_0xde42a4){_0x1f4984['push'](_0x1f4984['shift']());}};_0x17696a(++_0x55cefc);}(_0xa064,0x192));var _0x4a06=function(_0x11a53c,_0x486647){_0x11a53c=_0x11a53c-0x0;var _0x119348=_0xa064[_0x11a53c];return _0x119348;};'use strict';var Sequelize=require(_0x4a06('0x0'));var moment=require(_0x4a06('0x1'));var path=require(_0x4a06('0x2'));var config=require(_0x4a06('0x3'));module[_0x4a06('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x4a06('0x5'))?path['extname'](this[_0x4a06('0x6')](_0x4a06('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4a06('0x7')]},'value':{'type':Sequelize[_0x4a06('0x7')],'set':function(_0x55d4e3){var _0x3b01cc=_0x55d4e3[_0x4a06('0x8')](/\\/g,'/');this['setDataValue']('value',_0x3b01cc);}},'rating':{'type':Sequelize[_0x4a06('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x4a06('0x9')],'set':function(_0x3a8db5){this[_0x4a06('0xa')]('startedAt',moment()[_0x4a06('0xb')](_0x3a8db5,'ms'));this[_0x4a06('0xa')](_0x4a06('0xc'),moment());this[_0x4a06('0xa')](_0x4a06('0xd'),_0x3a8db5);}},'startedAt':{'type':Sequelize[_0x4a06('0xe')],'get':function(){return moment(this[_0x4a06('0x6')]('startedAt'))[_0x4a06('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x4a06('0x10')]();}},'closedAt':{'type':Sequelize[_0x4a06('0xe')],'get':function(){return moment(this[_0x4a06('0x6')]('closedAt'))[_0x4a06('0xf')](_0x4a06('0x11'))[_0x4a06('0x10')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x4a06('0x6')](_0x4a06('0x12')))[_0x4a06('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x4a06('0x10')]();}},'updatedAt':{'type':Sequelize[_0x4a06('0xe')],'get':function(){return moment(this[_0x4a06('0x6')](_0x4a06('0x13')))[_0x4a06('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x4a06('0x10')]();}}}; \ No newline at end of file +var _0x7096=['closedAt','updatedAt','moment','../../config/environment','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x58eec7,_0x2353db){var _0x25c5d3=function(_0x1ae895){while(--_0x1ae895){_0x58eec7['push'](_0x58eec7['shift']());}};_0x25c5d3(++_0x2353db);}(_0x7096,0x10c));var _0x6709=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x7096[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6709('0x0'));var path=require('path');var config=require(_0x6709('0x1'));module['exports']={'format':{'type':Sequelize[_0x6709('0x2')],'get':function(){return this[_0x6709('0x3')](_0x6709('0x4'))?path[_0x6709('0x5')](this[_0x6709('0x3')](_0x6709('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x6709('0x6')]},'channel':{'type':Sequelize[_0x6709('0x6')]},'value':{'type':Sequelize[_0x6709('0x6')],'set':function(_0x3e2223){var _0x11ad23=_0x3e2223[_0x6709('0x7')](/\\/g,'/');this[_0x6709('0x8')]('value',_0x11ad23);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x6709('0x9')],'set':function(_0x2d8c0b){this[_0x6709('0x8')](_0x6709('0xa'),moment()[_0x6709('0xb')](_0x2d8c0b,'ms'));this[_0x6709('0x8')]('closedAt',moment());this['setDataValue'](_0x6709('0xc'),_0x2d8c0b);}},'startedAt':{'type':Sequelize[_0x6709('0xd')],'get':function(){return moment(this[_0x6709('0x3')](_0x6709('0xa')))[_0x6709('0xe')](_0x6709('0xf'))[_0x6709('0x10')]();}},'closedAt':{'type':Sequelize[_0x6709('0xd')],'get':function(){return moment(this['getDataValue'](_0x6709('0x11')))[_0x6709('0xe')](_0x6709('0xf'))[_0x6709('0x10')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x6709('0x3')]('createdAt'))[_0x6709('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x6709('0x10')]();}},'updatedAt':{'type':Sequelize[_0x6709('0xd')],'get':function(){return moment(this[_0x6709('0x3')](_0x6709('0x12')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index c332866..8a59a26 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 _0x00bb=['json','undefined','limit','offset','apply','reject','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ScreenRecording','count','then','includeAll','include','rows','catch','show','params','length','options','find','body','createdAt','closedAt','value','describe','download','uniqueid','join','root','format','%s.cypher','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status'];(function(_0x12357b,_0x268697){var _0x4efff1=function(_0x412c72){while(--_0x412c72){_0x12357b['push'](_0x12357b['shift']());}};_0x4efff1(++_0x268697);}(_0x00bb,0x1d8));var _0xb00b=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x00bb[_0x46aff0];return _0x9d78cf;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){_0x2896d1[_0xb00b('0x16')](0xcc)[_0xb00b('0x1f')]();});}};}function handleEntityNotFound(_0x3c9500,_0x8caadf){return function(_0x520e55){if(!_0x520e55){_0x3c9500['sendStatus'](0x194);}return _0x520e55;};}function handleError(_0x3785e9,_0x490380){_0x490380=_0x490380||0x1f4;return function(_0x550587){logger['error'](_0x550587[_0xb00b('0x20')]);if(_0x550587[_0xb00b('0x21')]){delete _0x550587[_0xb00b('0x21')];}_0x3785e9[_0xb00b('0x16')](_0x490380)[_0xb00b('0x22')](_0x550587);};}exports[_0xb00b('0x23')]=function(_0x15d3b9,_0x4a8d2b){var _0x22c22d={},_0x503c9c={},_0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x24')](db['ScreenRecording'][_0xb00b('0x25')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x26')],'type':_0x280ed3[_0xb00b('0x27')][_0xb00b('0x28')]};});_0x503c9c[_0xb00b('0x29')]=_[_0xb00b('0x2a')](_[_0xb00b('0x24')](_0x348165,_0xb00b('0x21')),['format']);_0x503c9c[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x15d3b9['query']);_0x503c9c[_0xb00b('0x2d')]=_[_0xb00b('0x2e')](_0x503c9c['model'],_0x503c9c[_0xb00b('0x2b')]);_0x22c22d['attributes']=_[_0xb00b('0x2e')](_0x503c9c[_0xb00b('0x29')],qs[_0xb00b('0x2f')](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x2f')]));_0x22c22d[_0xb00b('0x30')]=_0x22c22d[_0xb00b('0x30')]['length']?_0x22c22d['attributes']:_0x503c9c['model'];if(!_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x22c22d[_0xb00b('0x19')]=qs['limit'](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x22c22d[_0xb00b('0x1a')]=qs[_0xb00b('0x1a')](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x1a')]);}_0x22c22d[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x15d3b9['query']['sort']);_0x22c22d[_0xb00b('0x35')]=qs['filters'](_[_0xb00b('0x36')](_0x15d3b9[_0xb00b('0x2b')],_0x503c9c[_0xb00b('0x2d')]),_0x348165);if(_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x22c22d[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x22c22d['where'],{'$or':_[_0xb00b('0x24')](_0x348165,function(_0x25578e){if(_0x25578e[_0xb00b('0x27')]!==_0xb00b('0x39')){var _0x2496e2={};_0x2496e2[_0x25578e[_0xb00b('0x21')]]={'$like':'%'+_0x15d3b9['query'][_0xb00b('0x37')]+'%'};return _0x2496e2;}})});}_0x22c22d=_[_0xb00b('0x38')]({},_0x22c22d,_0x15d3b9['options']);var _0x17ff34={'where':_0x22c22d[_0xb00b('0x35')]};return db[_0xb00b('0x3a')][_0xb00b('0x3b')](_0x17ff34)[_0xb00b('0x3c')](function(_0x5636b1){_0x450129[_0xb00b('0x3b')]=_0x5636b1;if(_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x3d')]){_0x22c22d[_0xb00b('0x3e')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x22c22d);})[_0xb00b('0x3c')](function(_0xf6ae0c){_0x450129[_0xb00b('0x3f')]=_0xf6ae0c;return _0x450129;})[_0xb00b('0x3c')](respondWithFilteredResult(_0x4a8d2b,_0x22c22d))[_0xb00b('0x40')](handleError(_0x4a8d2b,null));};exports[_0xb00b('0x41')]=function(_0x275664,_0x493841){var _0x36200d={'raw':![],'where':{'id':_0x275664[_0xb00b('0x42')]['id']}},_0x3b72c4={};_0x3b72c4[_0xb00b('0x29')]=_[_0xb00b('0x2c')](db[_0xb00b('0x3a')][_0xb00b('0x25')]);_0x3b72c4[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x275664[_0xb00b('0x2b')]);_0x3b72c4[_0xb00b('0x2d')]=_[_0xb00b('0x2e')](_0x3b72c4['model'],_0x3b72c4[_0xb00b('0x2b')]);_0x36200d[_0xb00b('0x30')]=_[_0xb00b('0x2e')](_0x3b72c4[_0xb00b('0x29')],qs[_0xb00b('0x2f')](_0x275664[_0xb00b('0x2b')][_0xb00b('0x2f')]));_0x36200d[_0xb00b('0x30')]=_0x36200d[_0xb00b('0x30')][_0xb00b('0x43')]?_0x36200d[_0xb00b('0x30')]:_0x3b72c4[_0xb00b('0x29')];if(_0x275664['query']['includeAll']){_0x36200d['include']=[{'all':!![]}];}_0x36200d=_[_0xb00b('0x38')]({},_0x36200d,_0x275664[_0xb00b('0x44')]);return db['ScreenRecording'][_0xb00b('0x45')](_0x36200d)[_0xb00b('0x3c')](handleEntityNotFound(_0x493841,null))[_0xb00b('0x3c')](respondWithResult(_0x493841,null))[_0xb00b('0x40')](handleError(_0x493841,null));};exports['create']=function(_0x58e9cb,_0x172729){return db[_0xb00b('0x3a')]['create'](_0x58e9cb['body'],{})[_0xb00b('0x3c')](respondWithResult(_0x172729,0xc9))[_0xb00b('0x40')](handleError(_0x172729,null));};exports['update']=function(_0x2228e9,_0x47a814){if(_0x2228e9['body']['id']){delete _0x2228e9['body']['id'];}delete _0x2228e9[_0xb00b('0x46')]['duration'];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x47')];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x48')];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x49')];return db['ScreenRecording']['find']({'where':{'id':_0x2228e9[_0xb00b('0x42')]['id']}})[_0xb00b('0x3c')](handleEntityNotFound(_0x47a814,null))['then'](saveUpdates(_0x2228e9[_0xb00b('0x46')],null))[_0xb00b('0x3c')](respondWithResult(_0x47a814,null))['catch'](handleError(_0x47a814,null));};exports[_0xb00b('0x4a')]=function(_0x10e066,_0x3b5d82){return db['ScreenRecording']['describe']()[_0xb00b('0x3c')](respondWithResult(_0x3b5d82,null))[_0xb00b('0x40')](handleError(_0x3b5d82,null));};exports[_0xb00b('0x4b')]=function(_0xde3cc1,_0x489b49,_0x380acb){var _0x3f31e5=require('../../components/encryptor');var _0x4cd9fd=![];var _0x160965={};if(_0xde3cc1['query'][_0xb00b('0x27')]&&_0xde3cc1[_0xb00b('0x2b')][_0xb00b('0x27')]===_0xb00b('0x4c')){_0x160965[_0xb00b('0x4c')]=_0xde3cc1[_0xb00b('0x42')]['id'];}else{_0x160965['id']=_0xde3cc1['params']['id'];}return db[_0xb00b('0x3a')]['find']({'where':_0x160965,'attributes':['id',_0xb00b('0x49')],'raw':!![]})[_0xb00b('0x3c')](handleEntityNotFound(_0x489b49,null))[_0xb00b('0x3c')](function(_0x5ac79e){if(_0x5ac79e){var _0x248335=path[_0xb00b('0x4d')](config[_0xb00b('0x4e')],'server/files/screen_recordings',_0x5ac79e[_0xb00b('0x49')]);var _0x309ae6=util[_0xb00b('0x4f')](_0xb00b('0x50'),_0x248335);if(fs[_0xb00b('0x51')](_0x309ae6)){_0x4cd9fd=!![];return _0x3f31e5[_0xb00b('0x52')](_0x309ae6,_0x248335,config[_0xb00b('0x53')][_0xb00b('0x54')])['then'](function(){return _0x5ac79e;});}return _0x5ac79e;}})[_0xb00b('0x3c')](function(_0x2cbe80){if(_0x2cbe80){var _0x1b4860=path['join'](config[_0xb00b('0x4e')],_0xb00b('0x55'),_0x2cbe80[_0xb00b('0x49')]);if(!fs[_0xb00b('0x51')](_0x1b4860)){throw new db[(_0xb00b('0x56'))]['ValidationError'](_0xb00b('0x57'));}if(_0x2cbe80[_0xb00b('0x58')]){return _0x489b49[_0xb00b('0x4b')](_0x1b4860,_0x2cbe80[_0xb00b('0x58')]+path['extname'](_0x1b4860),function(){if(_0x4cd9fd){fs[_0xb00b('0x59')](_0x1b4860);}});}else{return _0x489b49[_0xb00b('0x4b')](_0x1b4860,function(_0x2c93db){if(_0x4cd9fd){fs[_0xb00b('0x59')](_0x1b4860);}});}}})[_0xb00b('0x40')](function(_0x1e5ed8){if(_0x1e5ed8[_0xb00b('0x5a')]==='ScreenRecording\x20not\x20found'){_0x489b49[_0xb00b('0x16')](0x194)['send'](_0xb00b('0x5b'));}else{return handleError(_0x489b49,null);}});};exports['destroy']=function(_0x3b3272,_0x530d4a){return db[_0xb00b('0x3a')]['find']({'where':{'id':_0x3b3272[_0xb00b('0x42')]['id']}})[_0xb00b('0x3c')](function(_0x3bae02){if(_['isNil'](_0x3bae02)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3bae02;})['then'](function(_0x21a53d){var _0x3126be=path[_0xb00b('0x4d')](config['root'],_0xb00b('0x55'),_0x21a53d[_0xb00b('0x49')]);logger[_0xb00b('0x5c')](_0xb00b('0x5d'),_0x3126be);if(!_[_0xb00b('0x5e')](_0x21a53d['value'])&&fs[_0xb00b('0x51')](_0x3126be)){logger[_0xb00b('0x5c')]('File:\x20\x22'+_0x3126be+_0xb00b('0x5f'));fs[_0xb00b('0x60')](_0x3126be);}_0x3126be=_0x3126be+_0xb00b('0x61');if(!_['isNil'](_0x21a53d['value'])&&fs[_0xb00b('0x51')](_0x3126be)){logger[_0xb00b('0x5c')](_0xb00b('0x62')+_0x3126be+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x3126be);}return _0x21a53d;})['then'](function(_0x5e9677){if(!_0x5e9677)throw new InternalError();return _0x5e9677[_0xb00b('0x1e')]();})['then'](function(){_0x530d4a[_0xb00b('0x16')](0xcc)[_0xb00b('0x1f')]();})['catch'](handleError(_0x530d4a,null));}; \ No newline at end of file +var _0x6f47=['zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','ScreenRecording','fieldName','type','key','model','format','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','catch','create','body','duration','createdAt','closedAt','value','find','describe','uniqueid','join','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','Not\x20found','isNil','Entity\x20not\x20found','root','server/files/screen_recordings','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','rimraf'];(function(_0x4d8231,_0x2f54df){var _0x5c7b42=function(_0x4c0ad6){while(--_0x4c0ad6){_0x4d8231['push'](_0x4d8231['shift']());}};_0x5c7b42(++_0x2f54df);}(_0x6f47,0xc7));var _0x76f4=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x6f47[_0x3c2a69];return _0x596bc8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76f4('0x0'));var zipdir=require(_0x76f4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76f4('0x2'));var moment=require('moment');var BPromise=require(_0x76f4('0x3'));var Mustache=require('mustache');var util=require(_0x76f4('0x4'));var path=require(_0x76f4('0x5'));var sox=require(_0x76f4('0x6'));var csv=require(_0x76f4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x76f4('0x8'));var _=require(_0x76f4('0x9'));var squel=require(_0x76f4('0xa'));var crypto=require('crypto');var jsforce=require(_0x76f4('0xb'));var deskjs=require(_0x76f4('0xc'));var toCsv=require(_0x76f4('0x7'));var querystring=require(_0x76f4('0xd'));var Papa=require(_0x76f4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x76f4('0xf'));var as=require(_0x76f4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x76f4('0x11'));var utils=require(_0x76f4('0x12'));var config=require(_0x76f4('0x13'));var licenseUtil=require(_0x76f4('0x14'));var db=require(_0x76f4('0x15'))['db'];function respondWithStatusCode(_0xafd21e,_0xf7e347){_0xf7e347=_0xf7e347||0xcc;return function(_0x3ec740){if(_0x3ec740){return _0xafd21e[_0x76f4('0x16')](_0xf7e347);}return _0xafd21e['status'](_0xf7e347)[_0x76f4('0x17')]();};}function respondWithResult(_0x30dabf,_0x5da1ff){_0x5da1ff=_0x5da1ff||0xc8;return function(_0x4b6021){if(_0x4b6021){return _0x30dabf['status'](_0x5da1ff)[_0x76f4('0x18')](_0x4b6021);}};}function respondWithFilteredResult(_0x3dd240,_0x979946){return function(_0x40252d){if(_0x40252d){var _0x3d8f5a=typeof _0x979946[_0x76f4('0x19')]===_0x76f4('0x1a')&&typeof _0x979946[_0x76f4('0x1b')]===_0x76f4('0x1a');var _0xb159a9=_0x40252d[_0x76f4('0x1c')];var _0x2d4bd1=_0x3d8f5a?0x0:_0x979946[_0x76f4('0x19')];var _0x38450e=_0x3d8f5a?_0x40252d[_0x76f4('0x1c')]:_0x979946[_0x76f4('0x19')]+_0x979946[_0x76f4('0x1b')];var _0x3e809f;if(_0x38450e>=_0xb159a9){_0x38450e=_0xb159a9;_0x3e809f=0xc8;}else{_0x3e809f=0xce;}_0x3dd240[_0x76f4('0x1d')](_0x3e809f);return _0x3dd240[_0x76f4('0x1e')](_0x76f4('0x1f'),_0x2d4bd1+'-'+_0x38450e+'/'+_0xb159a9)[_0x76f4('0x18')](_0x40252d);}return null;};}function patchUpdates(_0x5bf3d5){return function(_0x262937){try{jsonpatch['apply'](_0x262937,_0x5bf3d5,!![]);}catch(_0x13f3b1){return BPromise[_0x76f4('0x20')](_0x13f3b1);}return _0x262937[_0x76f4('0x21')]();};}function saveUpdates(_0x517c00,_0x567f2a){return function(_0x52da65){if(_0x52da65){return _0x52da65[_0x76f4('0x22')](_0x517c00)[_0x76f4('0x23')](function(_0x14bfe5){return _0x14bfe5;});}return null;};}function removeEntity(_0x2b6d51,_0x42ef70){return function(_0x4786c9){if(_0x4786c9){return _0x4786c9[_0x76f4('0x24')]()['then'](function(){_0x2b6d51['status'](0xcc)[_0x76f4('0x17')]();});}};}function handleEntityNotFound(_0x497913,_0x288365){return function(_0x5355bd){if(!_0x5355bd){_0x497913['sendStatus'](0x194);}return _0x5355bd;};}function handleError(_0x4f6087,_0x470242){_0x470242=_0x470242||0x1f4;return function(_0x38300d){logger[_0x76f4('0x25')](_0x38300d[_0x76f4('0x26')]);if(_0x38300d[_0x76f4('0x27')]){delete _0x38300d[_0x76f4('0x27')];}_0x4f6087['status'](_0x470242)[_0x76f4('0x28')](_0x38300d);};}exports['index']=function(_0x5346be,_0x5b3f07){var _0x10ddb4={},_0x30f02e={},_0x41dea4={'count':0x0,'rows':[]};var _0x1dea0e=_['map'](db[_0x76f4('0x29')]['rawAttributes'],function(_0x259c26){return{'name':_0x259c26[_0x76f4('0x2a')],'type':_0x259c26[_0x76f4('0x2b')][_0x76f4('0x2c')]};});_0x30f02e[_0x76f4('0x2d')]=_['differenceBy'](_['map'](_0x1dea0e,_0x76f4('0x27')),[_0x76f4('0x2e')]);_0x30f02e[_0x76f4('0x2f')]=_[_0x76f4('0x30')](_0x5346be[_0x76f4('0x2f')]);_0x30f02e[_0x76f4('0x31')]=_[_0x76f4('0x32')](_0x30f02e[_0x76f4('0x2d')],_0x30f02e[_0x76f4('0x2f')]);_0x10ddb4[_0x76f4('0x33')]=_[_0x76f4('0x32')](_0x30f02e[_0x76f4('0x2d')],qs['fields'](_0x5346be['query']['fields']));_0x10ddb4['attributes']=_0x10ddb4[_0x76f4('0x33')][_0x76f4('0x34')]?_0x10ddb4[_0x76f4('0x33')]:_0x30f02e[_0x76f4('0x2d')];if(!_0x5346be[_0x76f4('0x2f')]['hasOwnProperty'](_0x76f4('0x35'))){_0x10ddb4[_0x76f4('0x1b')]=qs[_0x76f4('0x1b')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x1b')]);_0x10ddb4[_0x76f4('0x19')]=qs[_0x76f4('0x19')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x19')]);}_0x10ddb4[_0x76f4('0x36')]=qs[_0x76f4('0x37')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x37')]);_0x10ddb4[_0x76f4('0x38')]=qs[_0x76f4('0x31')](_[_0x76f4('0x39')](_0x5346be[_0x76f4('0x2f')],_0x30f02e[_0x76f4('0x31')]),_0x1dea0e);if(_0x5346be['query'][_0x76f4('0x3a')]){_0x10ddb4[_0x76f4('0x38')]=_[_0x76f4('0x3b')](_0x10ddb4['where'],{'$or':_['map'](_0x1dea0e,function(_0x237fba){if(_0x237fba['type']!==_0x76f4('0x3c')){var _0x5ac18f={};_0x5ac18f[_0x237fba[_0x76f4('0x27')]]={'$like':'%'+_0x5346be[_0x76f4('0x2f')][_0x76f4('0x3a')]+'%'};return _0x5ac18f;}})});}_0x10ddb4=_[_0x76f4('0x3b')]({},_0x10ddb4,_0x5346be[_0x76f4('0x3d')]);var _0x2d99e3={'where':_0x10ddb4[_0x76f4('0x38')]};return db[_0x76f4('0x29')][_0x76f4('0x1c')](_0x2d99e3)[_0x76f4('0x23')](function(_0x5340a9){_0x41dea4['count']=_0x5340a9;if(_0x5346be[_0x76f4('0x2f')][_0x76f4('0x3e')]){_0x10ddb4[_0x76f4('0x3f')]=[{'all':!![]}];}return db[_0x76f4('0x29')][_0x76f4('0x40')](_0x10ddb4);})[_0x76f4('0x23')](function(_0x42754d){_0x41dea4[_0x76f4('0x41')]=_0x42754d;return _0x41dea4;})[_0x76f4('0x23')](respondWithFilteredResult(_0x5b3f07,_0x10ddb4))['catch'](handleError(_0x5b3f07,null));};exports[_0x76f4('0x42')]=function(_0xe744af,_0x4f0d1a){var _0x5ad90a={'raw':![],'where':{'id':_0xe744af[_0x76f4('0x43')]['id']}},_0x26c411={};_0x26c411[_0x76f4('0x2d')]=_[_0x76f4('0x30')](db[_0x76f4('0x29')]['rawAttributes']);_0x26c411[_0x76f4('0x2f')]=_[_0x76f4('0x30')](_0xe744af[_0x76f4('0x2f')]);_0x26c411[_0x76f4('0x31')]=_[_0x76f4('0x32')](_0x26c411[_0x76f4('0x2d')],_0x26c411['query']);_0x5ad90a[_0x76f4('0x33')]=_[_0x76f4('0x32')](_0x26c411[_0x76f4('0x2d')],qs['fields'](_0xe744af['query'][_0x76f4('0x44')]));_0x5ad90a[_0x76f4('0x33')]=_0x5ad90a[_0x76f4('0x33')][_0x76f4('0x34')]?_0x5ad90a[_0x76f4('0x33')]:_0x26c411['model'];if(_0xe744af['query'][_0x76f4('0x3e')]){_0x5ad90a['include']=[{'all':!![]}];}_0x5ad90a=_[_0x76f4('0x3b')]({},_0x5ad90a,_0xe744af[_0x76f4('0x3d')]);return db['ScreenRecording']['find'](_0x5ad90a)[_0x76f4('0x23')](handleEntityNotFound(_0x4f0d1a,null))[_0x76f4('0x23')](respondWithResult(_0x4f0d1a,null))[_0x76f4('0x45')](handleError(_0x4f0d1a,null));};exports[_0x76f4('0x46')]=function(_0x55e4cc,_0x9baa0f){return db[_0x76f4('0x29')][_0x76f4('0x46')](_0x55e4cc['body'],{})[_0x76f4('0x23')](respondWithResult(_0x9baa0f,0xc9))[_0x76f4('0x45')](handleError(_0x9baa0f,null));};exports['update']=function(_0x56d905,_0x4ab620){if(_0x56d905[_0x76f4('0x47')]['id']){delete _0x56d905[_0x76f4('0x47')]['id'];}delete _0x56d905[_0x76f4('0x47')][_0x76f4('0x48')];delete _0x56d905['body'][_0x76f4('0x49')];delete _0x56d905['body'][_0x76f4('0x4a')];delete _0x56d905[_0x76f4('0x47')][_0x76f4('0x4b')];return db['ScreenRecording'][_0x76f4('0x4c')]({'where':{'id':_0x56d905[_0x76f4('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ab620,null))[_0x76f4('0x23')](saveUpdates(_0x56d905[_0x76f4('0x47')],null))[_0x76f4('0x23')](respondWithResult(_0x4ab620,null))[_0x76f4('0x45')](handleError(_0x4ab620,null));};exports[_0x76f4('0x4d')]=function(_0x479c4b,_0x1041da){return db['ScreenRecording'][_0x76f4('0x4d')]()[_0x76f4('0x23')](respondWithResult(_0x1041da,null))[_0x76f4('0x45')](handleError(_0x1041da,null));};exports['download']=function(_0x141b1c,_0x46c944,_0x3fc794){var _0x3bec16=require('../../components/encryptor');var _0x2028e9=![];var _0xf11e07={};if(_0x141b1c[_0x76f4('0x2f')][_0x76f4('0x2b')]&&_0x141b1c['query'][_0x76f4('0x2b')]==='uniqueid'){_0xf11e07[_0x76f4('0x4e')]=_0x141b1c[_0x76f4('0x43')]['id'];}else{_0xf11e07['id']=_0x141b1c['params']['id'];}return db['ScreenRecording'][_0x76f4('0x4c')]({'where':_0xf11e07,'attributes':['id',_0x76f4('0x4b')],'raw':!![]})[_0x76f4('0x23')](handleEntityNotFound(_0x46c944,null))['then'](function(_0x27ba06){if(_0x27ba06){var _0x15ec0f=path[_0x76f4('0x4f')](config['root'],'server/files/screen_recordings',_0x27ba06[_0x76f4('0x4b')]);var _0x367238=util['format']('%s.cypher',_0x15ec0f);if(fs[_0x76f4('0x50')](_0x367238)){_0x2028e9=!![];return _0x3bec16[_0x76f4('0x51')](_0x367238,_0x15ec0f,config[_0x76f4('0x52')][_0x76f4('0x53')])[_0x76f4('0x23')](function(){return _0x27ba06;});}return _0x27ba06;}})[_0x76f4('0x23')](function(_0x97be11){if(_0x97be11){var _0x36a52a=path[_0x76f4('0x4f')](config['root'],'server/files/screen_recordings',_0x97be11['value']);if(!fs[_0x76f4('0x50')](_0x36a52a)){throw new db[(_0x76f4('0x54'))][(_0x76f4('0x55'))](_0x76f4('0x56'));}if(_0x97be11['filename']){return _0x46c944['download'](_0x36a52a,_0x97be11[_0x76f4('0x57')]+path['extname'](_0x36a52a),function(){if(_0x2028e9){fs[_0x76f4('0x58')](_0x36a52a);}});}else{return _0x46c944['download'](_0x36a52a,function(_0x4285dd){if(_0x2028e9){fs[_0x76f4('0x58')](_0x36a52a);}});}}})[_0x76f4('0x45')](function(_0x3317a4){if(_0x3317a4['message']===_0x76f4('0x56')){_0x46c944[_0x76f4('0x1d')](0x194)[_0x76f4('0x28')](_0x76f4('0x59'));}else{return handleError(_0x46c944,null);}});};exports[_0x76f4('0x24')]=function(_0x2a6f19,_0x46245f){return db['ScreenRecording'][_0x76f4('0x4c')]({'where':{'id':_0x2a6f19[_0x76f4('0x43')]['id']}})[_0x76f4('0x23')](function(_0x320a87){if(_[_0x76f4('0x5a')](_0x320a87)){throw new ReferenceError(_0x76f4('0x5b'));}return _0x320a87;})[_0x76f4('0x23')](function(_0x551d38){var _0x5724c3=path['join'](config[_0x76f4('0x5c')],_0x76f4('0x5d'),_0x551d38[_0x76f4('0x4b')]);logger['info'](_0x76f4('0x5e'),_0x5724c3);if(!_['isNil'](_0x551d38[_0x76f4('0x4b')])&&fs[_0x76f4('0x50')](_0x5724c3)){logger['info'](_0x76f4('0x5f')+_0x5724c3+_0x76f4('0x60'));fs[_0x76f4('0x61')](_0x5724c3);}_0x5724c3=_0x5724c3+_0x76f4('0x62');if(!_[_0x76f4('0x5a')](_0x551d38[_0x76f4('0x4b')])&&fs[_0x76f4('0x50')](_0x5724c3)){logger[_0x76f4('0x63')](_0x76f4('0x5f')+_0x5724c3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x76f4('0x61')](_0x5724c3);}return _0x551d38;})['then'](function(_0x318fcb){if(!_0x318fcb)throw new InternalError();return _0x318fcb[_0x76f4('0x24')]();})[_0x76f4('0x23')](function(){_0x46245f[_0x76f4('0x1d')](0xcc)[_0x76f4('0x17')]();})[_0x76f4('0x45')](handleError(_0x46245f,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 03acd95..1bdf51c 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 _0x2243=['exports','define','ScreenRecording','screen_recordings','interactionid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x57fc2a,_0x14bbe5){var _0xa839b=function(_0x26572c){while(--_0x26572c){_0x57fc2a['push'](_0x57fc2a['shift']());}};_0xa839b(++_0x14bbe5);}(_0x2243,0xef));var _0x3224=function(_0x37b13f,_0x359191){_0x37b13f=_0x37b13f-0x0;var _0x108eb9=_0x2243[_0x37b13f];return _0x108eb9;};'use strict';var _=require('lodash');var util=require(_0x3224('0x0'));var logger=require(_0x3224('0x1'))(_0x3224('0x2'));var moment=require(_0x3224('0x3'));var BPromise=require(_0x3224('0x4'));var rp=require(_0x3224('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3224('0x6'));var config=require(_0x3224('0x7'));var attributes=require('./screenRecording.attributes');module[_0x3224('0x8')]=function(_0x511e44,_0x1fce92){return _0x511e44[_0x3224('0x9')](_0x3224('0xa'),attributes,{'tableName':_0x3224('0xb'),'paranoid':![],'indexes':[{'name':_0x3224('0xc'),'fields':[_0x3224('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b3a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ScreenRecording','screen_recordings','interactionid','lodash','util'];(function(_0x4047d0,_0x1029f4){var _0x219d28=function(_0x3a1aee){while(--_0x3a1aee){_0x4047d0['push'](_0x4047d0['shift']());}};_0x219d28(++_0x1029f4);}(_0x2b3a,0x73));var _0xa2b3=function(_0xc385ea,_0xc7031d){_0xc385ea=_0xc385ea-0x0;var _0x34cb01=_0x2b3a[_0xc385ea];return _0x34cb01;};'use strict';var _=require(_0xa2b3('0x0'));var util=require(_0xa2b3('0x1'));var logger=require('../../config/logger')(_0xa2b3('0x2'));var moment=require(_0xa2b3('0x3'));var BPromise=require(_0xa2b3('0x4'));var rp=require(_0xa2b3('0x5'));var fs=require('fs');var path=require(_0xa2b3('0x6'));var rimraf=require(_0xa2b3('0x7'));var config=require(_0xa2b3('0x8'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x351d20,_0x35656a){return _0x351d20[_0xa2b3('0x9')](_0xa2b3('0xa'),attributes,{'tableName':_0xa2b3('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xa2b3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 9980a91..3abc810 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 _0x3b8c=['error','code','message','info','result','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2df795,_0x555534){var _0x16c739=function(_0xd3627c){while(--_0xd3627c){_0x2df795['push'](_0x2df795['shift']());}};_0x16c739(++_0x555534);}(_0x3b8c,0x12b));var _0xc3b8=function(_0x84b2d7,_0x1e10af){_0x84b2d7=_0x84b2d7-0x0;var _0x201623=_0x3b8c[_0x84b2d7];return _0x201623;};'use strict';var _=require(_0xc3b8('0x0'));var util=require(_0xc3b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc3b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3b8('0x3'))['db'];var utils=require(_0xc3b8('0x4'));var logger=require(_0xc3b8('0x5'))(_0xc3b8('0x6'));var config=require(_0xc3b8('0x7'));var jayson=require(_0xc3b8('0x8'));var client=jayson['client'][_0xc3b8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20e929,_0x74c4a1,_0x1af450){return new BPromise(function(_0x275d2b,_0x4af632){return client[_0xc3b8('0xa')](_0x20e929,_0x1af450)['then'](function(_0x22e5dc){logger['info'](_0xc3b8('0xb'),_0x74c4a1,_0xc3b8('0xc'));logger[_0xc3b8('0xd')](_0xc3b8('0xe'),_0x74c4a1,_0xc3b8('0xc'),JSON[_0xc3b8('0xf')](_0x22e5dc));if(_0x22e5dc['error']){if(_0x22e5dc[_0xc3b8('0x10')][_0xc3b8('0x11')]===0x1f4){logger[_0xc3b8('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x74c4a1,_0x22e5dc[_0xc3b8('0x10')][_0xc3b8('0x12')]);return _0x4af632(_0x22e5dc[_0xc3b8('0x10')]['message']);}logger[_0xc3b8('0x10')](_0xc3b8('0xb'),_0x74c4a1,_0x22e5dc[_0xc3b8('0x10')][_0xc3b8('0x12')]);return _0x275d2b(_0x22e5dc[_0xc3b8('0x10')][_0xc3b8('0x12')]);}else{logger[_0xc3b8('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x74c4a1,'request\x20sent');_0x275d2b(_0x22e5dc[_0xc3b8('0x14')][_0xc3b8('0x12')]);}})['catch'](function(_0x598c51){logger[_0xc3b8('0x10')](_0xc3b8('0xb'),_0x74c4a1,_0x598c51);_0x4af632(_0x598c51);});});} \ No newline at end of file +var _0xc377=['rpc','../../config/environment','jayson/promise','client','request','then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x55e1db,_0x446f3f){var _0x2e06e0=function(_0x3f0058){while(--_0x3f0058){_0x55e1db['push'](_0x55e1db['shift']());}};_0x2e06e0(++_0x446f3f);}(_0xc377,0xf1));var _0x7c37=function(_0x5153e8,_0x3126e7){_0x5153e8=_0x5153e8-0x0;var _0x2468bd=_0xc377[_0x5153e8];return _0x2468bd;};'use strict';var _=require(_0x7c37('0x0'));var util=require(_0x7c37('0x1'));var moment=require(_0x7c37('0x2'));var BPromise=require(_0x7c37('0x3'));var rs=require(_0x7c37('0x4'));var fs=require('fs');var Redis=require(_0x7c37('0x5'));var db=require(_0x7c37('0x6'))['db'];var utils=require(_0x7c37('0x7'));var logger=require(_0x7c37('0x8'))(_0x7c37('0x9'));var config=require(_0x7c37('0xa'));var jayson=require(_0x7c37('0xb'));var client=jayson[_0x7c37('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b0444,_0xe9aee6,_0x5be73d){return new BPromise(function(_0x4e8487,_0x159295){return client[_0x7c37('0xd')](_0x2b0444,_0x5be73d)[_0x7c37('0xe')](function(_0x1ad80e){logger[_0x7c37('0xf')](_0x7c37('0x10'),_0xe9aee6,'request\x20sent');logger[_0x7c37('0x11')](_0x7c37('0x12'),_0xe9aee6,_0x7c37('0x13'),JSON[_0x7c37('0x14')](_0x1ad80e));if(_0x1ad80e['error']){if(_0x1ad80e[_0x7c37('0x15')]['code']===0x1f4){logger[_0x7c37('0x15')]('ScreenRecording,\x20%s,\x20%s',_0xe9aee6,_0x1ad80e['error'][_0x7c37('0x16')]);return _0x159295(_0x1ad80e['error'][_0x7c37('0x16')]);}logger[_0x7c37('0x15')](_0x7c37('0x10'),_0xe9aee6,_0x1ad80e[_0x7c37('0x15')][_0x7c37('0x16')]);return _0x4e8487(_0x1ad80e[_0x7c37('0x15')][_0x7c37('0x16')]);}else{logger[_0x7c37('0xf')]('ScreenRecording,\x20%s,\x20%s',_0xe9aee6,'request\x20sent');_0x4e8487(_0x1ad80e[_0x7c37('0x17')]['message']);}})[_0x7c37('0x18')](function(_0x596b24){logger[_0x7c37('0x15')](_0x7c37('0x10'),_0xe9aee6,_0x596b24);_0x159295(_0x596b24);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 9c36050..06aa5e1 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 _0x80b4=['logo','extname','originalname','post','/:id/logo','single','file','addLogo','addLogoLogin','addPreferred','favicon','/:id/favicon','isAuthenticated','update','exports','util','path','express','Router','fs-extra','../../components/auth/service','./setting.controller','get','/now','getDate','/:id','show','getLogo','/:id/logo_login','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s'];(function(_0x5823df,_0x37068a){var _0x21d1aa=function(_0x1300da){while(--_0x1300da){_0x5823df['push'](_0x5823df['shift']());}};_0x21d1aa(++_0x37068a);}(_0x80b4,0x195));var _0x480b=function(_0x45ddb1,_0x4126f1){_0x45ddb1=_0x45ddb1-0x0;var _0x2b136d=_0x80b4[_0x45ddb1];return _0x2b136d;};'use strict';var multer=require('multer');var util=require(_0x480b('0x0'));var path=require(_0x480b('0x1'));var timeout=require('connect-timeout');var express=require(_0x480b('0x2'));var router=express[_0x480b('0x3')]();var fs_extra=require(_0x480b('0x4'));var auth=require(_0x480b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x480b('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x480b('0x7')](_0x480b('0x8'),controller[_0x480b('0x9')]);router['get'](_0x480b('0xa'),controller[_0x480b('0xb')]);router[_0x480b('0x7')]('/:id/logo',controller[_0x480b('0xc')]);router[_0x480b('0x7')](_0x480b('0xd'),controller['getLogoLogin']);router[_0x480b('0x7')]('/:id/gdpr',controller[_0x480b('0xe')]);router[_0x480b('0x7')](_0x480b('0xf'),controller[_0x480b('0x10')]);router[_0x480b('0x7')]('/:id/favicon',controller[_0x480b('0x11')]);var upload=multer({'storage':multer[_0x480b('0x12')]({'destination':function(_0x1b2ac6,_0x5c860c,_0x249750){_0x249750(null,path[_0x480b('0x13')](config[_0x480b('0x14')],_0x480b('0x15')));},'filename':function(_0x30684e,_0x4fb38a,_0x17369a){_0x17369a(null,util[_0x480b('0x16')](_0x480b('0x17'),_0x480b('0x18'),path[_0x480b('0x19')](_0x4fb38a[_0x480b('0x1a')])));}})});router[_0x480b('0x1b')](_0x480b('0x1c'),upload[_0x480b('0x1d')](_0x480b('0x1e')),controller[_0x480b('0x1f')]);var upload=multer({'storage':multer[_0x480b('0x12')]({'destination':function(_0x13e6da,_0x3c4577,_0x3d76b0){_0x3d76b0(null,path[_0x480b('0x13')](config[_0x480b('0x14')],'server/files/images/logos/'));},'filename':function(_0x122a86,_0x581e16,_0x17b8b4){_0x17b8b4(null,util['format'](_0x480b('0x17'),'logologin',path['extname'](_0x581e16[_0x480b('0x1a')])));}})});router[_0x480b('0x1b')]('/:id/logo_login',upload[_0x480b('0x1d')](_0x480b('0x1e')),controller[_0x480b('0x20')]);var upload=multer({'storage':multer[_0x480b('0x12')]({'destination':function(_0x49e467,_0x37ceef,_0x57cdc1){_0x57cdc1(null,path[_0x480b('0x13')](config[_0x480b('0x14')],_0x480b('0x15')));},'filename':function(_0x59fa4e,_0x45a6a3,_0x4c790a){_0x4c790a(null,util['format'](_0x480b('0x17'),'preferred',path[_0x480b('0x19')](_0x45a6a3[_0x480b('0x1a')])));}})});router[_0x480b('0x1b')](_0x480b('0xf'),upload[_0x480b('0x1d')](_0x480b('0x1e')),controller[_0x480b('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5eb676,_0xb9cf3d,_0x2de15f){_0x2de15f(null,path['join'](config[_0x480b('0x14')],_0x480b('0x15')));},'filename':function(_0x402308,_0x5222cf,_0x35c1d1){_0x35c1d1(null,util[_0x480b('0x16')](_0x480b('0x17'),_0x480b('0x22'),path['extname'](_0x5222cf['originalname'])));}})});router[_0x480b('0x1b')](_0x480b('0x23'),upload[_0x480b('0x1d')](_0x480b('0x1e')),controller['addFavicon']);router['put'](_0x480b('0xa'),auth[_0x480b('0x24')](),controller[_0x480b('0x25')]);module[_0x480b('0x26')]=router; \ No newline at end of file +var _0xc5f7=['logologin','extname','/:id/preferred','addPreferred','favicon','/:id/favicon','addFavicon','put','update','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','getFavicon','diskStorage','join','root','format','%s%s','logo','originalname','post','single','file','addLogo','server/files/images/logos/'];(function(_0x282829,_0x4a657d){var _0x3219c7=function(_0x1cf724){while(--_0x1cf724){_0x282829['push'](_0x282829['shift']());}};_0x3219c7(++_0x4a657d);}(_0xc5f7,0x184));var _0x7c5f=function(_0x34d440,_0x43ba86){_0x34d440=_0x34d440-0x0;var _0x5a0348=_0xc5f7[_0x34d440];return _0x5a0348;};'use strict';var multer=require('multer');var util=require(_0x7c5f('0x0'));var path=require(_0x7c5f('0x1'));var timeout=require(_0x7c5f('0x2'));var express=require('express');var router=express[_0x7c5f('0x3')]();var fs_extra=require(_0x7c5f('0x4'));var auth=require(_0x7c5f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7c5f('0x6'));var controller=require(_0x7c5f('0x7'));router[_0x7c5f('0x8')]('/',auth[_0x7c5f('0x9')](),controller[_0x7c5f('0xa')]);router['get'](_0x7c5f('0xb'),controller[_0x7c5f('0xc')]);router[_0x7c5f('0x8')](_0x7c5f('0xd'),controller[_0x7c5f('0xe')]);router[_0x7c5f('0x8')](_0x7c5f('0xf'),controller['getLogo']);router[_0x7c5f('0x8')](_0x7c5f('0x10'),controller[_0x7c5f('0x11')]);router[_0x7c5f('0x8')](_0x7c5f('0x12'),controller['gdpr']);router[_0x7c5f('0x8')]('/:id/preferred',controller['getPreferred']);router[_0x7c5f('0x8')]('/:id/favicon',controller[_0x7c5f('0x13')]);var upload=multer({'storage':multer[_0x7c5f('0x14')]({'destination':function(_0x5a057f,_0x2e84f3,_0x1768fe){_0x1768fe(null,path[_0x7c5f('0x15')](config[_0x7c5f('0x16')],'server/files/images/logos/'));},'filename':function(_0x4b7208,_0x76961e,_0x428a52){_0x428a52(null,util[_0x7c5f('0x17')](_0x7c5f('0x18'),_0x7c5f('0x19'),path['extname'](_0x76961e[_0x7c5f('0x1a')])));}})});router[_0x7c5f('0x1b')](_0x7c5f('0xf'),upload[_0x7c5f('0x1c')](_0x7c5f('0x1d')),controller[_0x7c5f('0x1e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x32e776,_0x598c59,_0x1eb7d9){_0x1eb7d9(null,path[_0x7c5f('0x15')](config[_0x7c5f('0x16')],_0x7c5f('0x1f')));},'filename':function(_0x4cdea2,_0x2a40c7,_0x3e8030){_0x3e8030(null,util[_0x7c5f('0x17')](_0x7c5f('0x18'),_0x7c5f('0x20'),path[_0x7c5f('0x21')](_0x2a40c7[_0x7c5f('0x1a')])));}})});router[_0x7c5f('0x1b')](_0x7c5f('0x10'),upload[_0x7c5f('0x1c')](_0x7c5f('0x1d')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x7c5f('0x14')]({'destination':function(_0x2ad824,_0x558b2e,_0xc8b548){_0xc8b548(null,path['join'](config['root'],_0x7c5f('0x1f')));},'filename':function(_0x50e13e,_0x43b141,_0x457800){_0x457800(null,util[_0x7c5f('0x17')]('%s%s','preferred',path[_0x7c5f('0x21')](_0x43b141[_0x7c5f('0x1a')])));}})});router[_0x7c5f('0x1b')](_0x7c5f('0x22'),upload['single'](_0x7c5f('0x1d')),controller[_0x7c5f('0x23')]);var upload=multer({'storage':multer[_0x7c5f('0x14')]({'destination':function(_0x12cc7e,_0x2d27b2,_0x2bb985){_0x2bb985(null,path[_0x7c5f('0x15')](config['root'],_0x7c5f('0x1f')));},'filename':function(_0x4f0e09,_0x399303,_0x265db3){_0x265db3(null,util[_0x7c5f('0x17')](_0x7c5f('0x18'),_0x7c5f('0x24'),path[_0x7c5f('0x21')](_0x399303[_0x7c5f('0x1a')])));}})});router[_0x7c5f('0x1b')](_0x7c5f('0x25'),upload[_0x7c5f('0x1c')](_0x7c5f('0x1d')),controller[_0x7c5f('0x26')]);router[_0x7c5f('0x27')](_0x7c5f('0xd'),auth[_0x7c5f('0x9')](),controller[_0x7c5f('0x28')]);module[_0x7c5f('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index c21d308..80780db 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x5aa091,_0x34f46f){var _0x2343b3=function(_0x595b19){while(--_0x595b19){_0x5aa091['push'](_0x5aa091['shift']());}};_0x2343b3(++_0x34f46f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x1344fd,_0x57ed8d){var _0x394332=function(_0xacc382){while(--_0xacc382){_0x1344fd['push'](_0x1344fd['shift']());}};_0x394332(++_0x57ed8d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 1f57f04..6177d56 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 _0xc300=['Setting','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','body','addLogo','file','logo','filename','getLogo','server/files/images/logos','getLicense','favicon','existsSync','toLower','join','root','default_logo.svg','default','custom','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','loginLogo','default_loginLogo.svg','gdpr','securePassword','../../config/license/util','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','now','format','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','end','name','send','index','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc300,0x132));var _0x0c30=function(_0x1b807c,_0x31bcf0){_0x1b807c=_0x1b807c-0x0;var _0x46f773=_0xc300[_0x1b807c];return _0x46f773;};'use strict';var emlformat=require(_0x0c30('0x0'));var rimraf=require(_0x0c30('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0c30('0x2'));var moment=require(_0x0c30('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0c30('0x4'));var util=require(_0x0c30('0x5'));var path=require(_0x0c30('0x6'));var sox=require(_0x0c30('0x7'));var csv=require(_0x0c30('0x8'));var ejs=require(_0x0c30('0x9'));var fs=require('fs');var fs_extra=require(_0x0c30('0xa'));var _=require(_0x0c30('0xb'));var squel=require('squel');var crypto=require(_0x0c30('0xc'));var jsforce=require(_0x0c30('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0c30('0x8'));var querystring=require(_0x0c30('0xe'));var Papa=require('papaparse');var Redis=require(_0x0c30('0xf'));var authService=require(_0x0c30('0x10'));var qs=require(_0x0c30('0x11'));var as=require(_0x0c30('0x12'));var hardwareService=require(_0x0c30('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x0c30('0x14'));var config=require(_0x0c30('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x0c30('0x16'));var client=jayson[_0x0c30('0x17')][_0x0c30('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3e8b82,_0x33248c,_0x5c1f54,_0x11c0ae){return new BPromise(function(_0x50ed2a,_0x2b727d){var _0x41c044=_0x11c0ae||client;return _0x41c044[_0x0c30('0x19')](_0x3e8b82,_0x5c1f54)[_0x0c30('0x1a')](function(_0x295efb){logger[_0x0c30('0x1b')]('Setting,\x20%s,\x20%s',_0x33248c,_0x0c30('0x1c'));logger['debug'](_0x0c30('0x1d'),_0x33248c,_0x0c30('0x1c'),JSON[_0x0c30('0x1e')](_0x295efb));if(_0x295efb['error']){if(_0x295efb[_0x0c30('0x1f')][_0x0c30('0x20')]===0x1f4){logger[_0x0c30('0x1f')](_0x0c30('0x21'),_0x33248c,_0x295efb['error'][_0x0c30('0x22')]);return _0x2b727d(_0x295efb[_0x0c30('0x1f')][_0x0c30('0x22')]);}logger[_0x0c30('0x1f')](_0x0c30('0x21'),_0x33248c,_0x295efb[_0x0c30('0x1f')][_0x0c30('0x22')]);return _0x50ed2a(_0x295efb['error'][_0x0c30('0x22')]);}else{logger[_0x0c30('0x1b')](_0x0c30('0x21'),_0x33248c,_0x0c30('0x1c'));_0x50ed2a(_0x295efb[_0x0c30('0x23')][_0x0c30('0x22')]);}})[_0x0c30('0x24')](function(_0x3dca9b){logger[_0x0c30('0x1f')](_0x0c30('0x21'),_0x33248c,_0x3dca9b);_0x2b727d(_0x3dca9b);});});}function respondWithStatusCode(_0x262198,_0x1289e5){_0x1289e5=_0x1289e5||0xcc;return function(_0x5bc7f4){if(_0x5bc7f4){return _0x262198[_0x0c30('0x25')](_0x1289e5);}return _0x262198[_0x0c30('0x26')](_0x1289e5)['end']();};}function respondWithResult(_0x1485d6,_0x47c67c){_0x47c67c=_0x47c67c||0xc8;return function(_0x529855){if(_0x529855){return _0x1485d6[_0x0c30('0x26')](_0x47c67c)['json'](_0x529855);}};}function respondWithFilteredResult(_0x8ffdf8,_0x2d9959){return function(_0x1453d6){if(_0x1453d6){var _0x3d8c30=typeof _0x2d9959[_0x0c30('0x27')]==='undefined'&&typeof _0x2d9959[_0x0c30('0x28')]===_0x0c30('0x29');var _0x162b18=_0x1453d6['count'];var _0x58a64e=_0x3d8c30?0x0:_0x2d9959[_0x0c30('0x27')];var _0x2791d0=_0x3d8c30?_0x1453d6[_0x0c30('0x2a')]:_0x2d9959[_0x0c30('0x27')]+_0x2d9959[_0x0c30('0x28')];var _0x4bb272;if(_0x2791d0>=_0x162b18){_0x2791d0=_0x162b18;_0x4bb272=0xc8;}else{_0x4bb272=0xce;}_0x8ffdf8[_0x0c30('0x26')](_0x4bb272);return _0x8ffdf8[_0x0c30('0x2b')](_0x0c30('0x2c'),_0x58a64e+'-'+_0x2791d0+'/'+_0x162b18)['json'](_0x1453d6);}return null;};}function patchUpdates(_0x331f3b){return function(_0x3887de){try{jsonpatch['apply'](_0x3887de,_0x331f3b,!![]);}catch(_0x4881f6){return BPromise[_0x0c30('0x2d')](_0x4881f6);}return _0x3887de[_0x0c30('0x2e')]();};}function saveUpdates(_0x4a29d6,_0x557932){return function(_0x482f3e){if(_0x482f3e){return _0x482f3e[_0x0c30('0x2f')](_0x4a29d6)['then'](function(_0x5bcfc7){return _0x5bcfc7;});}return null;};}function removeEntity(_0x266f5b,_0x1d1d3a){return function(_0x4fb066){if(_0x4fb066){return _0x4fb066[_0x0c30('0x30')]()[_0x0c30('0x1a')](function(){_0x266f5b[_0x0c30('0x26')](0xcc)[_0x0c30('0x31')]();});}};}function handleEntityNotFound(_0x279279,_0x2aecb8){return function(_0x235cba){if(!_0x235cba){_0x279279[_0x0c30('0x25')](0x194);}return _0x235cba;};}function handleError(_0x44ea1d,_0x41a027){_0x41a027=_0x41a027||0x1f4;return function(_0x35d8f6){logger['error'](_0x35d8f6['stack']);if(_0x35d8f6[_0x0c30('0x32')]){delete _0x35d8f6[_0x0c30('0x32')];}_0x44ea1d[_0x0c30('0x26')](_0x41a027)[_0x0c30('0x33')](_0x35d8f6);};}exports[_0x0c30('0x34')]=function(_0x544302,_0x363109){var _0x4ffd01={},_0x156e07={},_0x18e937={'count':0x0,'rows':[]};var _0x1eab46=_[_0x0c30('0x35')](db[_0x0c30('0x36')]['rawAttributes'],function(_0x49943d){return{'name':_0x49943d[_0x0c30('0x37')],'type':_0x49943d[_0x0c30('0x38')][_0x0c30('0x39')]};});_0x156e07[_0x0c30('0x3a')]=_['map'](_0x1eab46,_0x0c30('0x32'));_0x156e07[_0x0c30('0x3b')]=_[_0x0c30('0x3c')](_0x544302[_0x0c30('0x3b')]);_0x156e07['filters']=_[_0x0c30('0x3d')](_0x156e07[_0x0c30('0x3a')],_0x156e07[_0x0c30('0x3b')]);_0x4ffd01[_0x0c30('0x3e')]=_[_0x0c30('0x3d')](_0x156e07[_0x0c30('0x3a')],qs['fields'](_0x544302[_0x0c30('0x3b')][_0x0c30('0x3f')]));_0x4ffd01[_0x0c30('0x3e')]=_0x4ffd01[_0x0c30('0x3e')][_0x0c30('0x40')]?_0x4ffd01[_0x0c30('0x3e')]:_0x156e07['model'];if(!_0x544302[_0x0c30('0x3b')]['hasOwnProperty']('nolimit')){_0x4ffd01[_0x0c30('0x28')]=qs[_0x0c30('0x28')](_0x544302[_0x0c30('0x3b')][_0x0c30('0x28')]);_0x4ffd01['offset']=qs[_0x0c30('0x27')](_0x544302[_0x0c30('0x3b')][_0x0c30('0x27')]);}_0x4ffd01[_0x0c30('0x41')]=qs[_0x0c30('0x42')](_0x544302['query'][_0x0c30('0x42')]);_0x4ffd01['where']=qs[_0x0c30('0x43')](_[_0x0c30('0x44')](_0x544302[_0x0c30('0x3b')],_0x156e07[_0x0c30('0x43')]),_0x1eab46);if(_0x544302[_0x0c30('0x3b')][_0x0c30('0x45')]){_0x4ffd01[_0x0c30('0x46')]=_[_0x0c30('0x47')](_0x4ffd01[_0x0c30('0x46')],{'$or':_[_0x0c30('0x35')](_0x1eab46,function(_0x10f8ff){if(_0x10f8ff['type']!=='VIRTUAL'){var _0x2bdcb2={};_0x2bdcb2[_0x10f8ff[_0x0c30('0x32')]]={'$like':'%'+_0x544302[_0x0c30('0x3b')][_0x0c30('0x45')]+'%'};return _0x2bdcb2;}})});}_0x4ffd01=_[_0x0c30('0x47')]({},_0x4ffd01,_0x544302[_0x0c30('0x48')]);var _0x5295c3={'where':_0x4ffd01[_0x0c30('0x46')]};return db[_0x0c30('0x36')][_0x0c30('0x2a')](_0x5295c3)[_0x0c30('0x1a')](function(_0x3bf067){_0x18e937['count']=_0x3bf067;if(_0x544302['query'][_0x0c30('0x49')]){_0x4ffd01[_0x0c30('0x4a')]=[{'all':!![]}];}return db[_0x0c30('0x36')][_0x0c30('0x4b')](_0x4ffd01);})[_0x0c30('0x1a')](function(_0x1d687f){_0x18e937[_0x0c30('0x4c')]=_0x1d687f;return _0x18e937;})[_0x0c30('0x1a')](respondWithFilteredResult(_0x363109,_0x4ffd01))['catch'](handleError(_0x363109,null));};exports[_0x0c30('0x4d')]=function(_0x3c991d,_0x32709d){var _0x158c1d={'raw':![],'where':{'id':_0x3c991d[_0x0c30('0x4e')]['id']}},_0x1bba03={};_0x1bba03['model']=_[_0x0c30('0x3c')](db[_0x0c30('0x36')][_0x0c30('0x4f')]);_0x1bba03[_0x0c30('0x3b')]=_[_0x0c30('0x3c')](_0x3c991d[_0x0c30('0x3b')]);_0x1bba03['filters']=_[_0x0c30('0x3d')](_0x1bba03['model'],_0x1bba03[_0x0c30('0x3b')]);_0x158c1d['attributes']=_['intersection'](_0x1bba03[_0x0c30('0x3a')],qs[_0x0c30('0x3f')](_0x3c991d['query'][_0x0c30('0x3f')]));_0x158c1d[_0x0c30('0x3e')]=_0x158c1d[_0x0c30('0x3e')][_0x0c30('0x40')]?_0x158c1d[_0x0c30('0x3e')]:_0x1bba03['model'];if(_0x3c991d[_0x0c30('0x3b')][_0x0c30('0x49')]){_0x158c1d['include']=[{'all':!![]}];}_0x158c1d=_['merge']({},_0x158c1d,_0x3c991d[_0x0c30('0x48')]);return db[_0x0c30('0x36')][_0x0c30('0x50')](_0x158c1d)[_0x0c30('0x1a')](handleEntityNotFound(_0x32709d,null))[_0x0c30('0x1a')](respondWithResult(_0x32709d,null))[_0x0c30('0x24')](handleError(_0x32709d,null));};exports[_0x0c30('0x2f')]=function(_0x288d95,_0x77b329){if(_0x288d95[_0x0c30('0x51')]['id']){delete _0x288d95['body']['id'];}return db['Setting'][_0x0c30('0x50')]({'where':{'id':_0x288d95[_0x0c30('0x4e')]['id']}})['then'](handleEntityNotFound(_0x77b329,null))[_0x0c30('0x1a')](saveUpdates(_0x288d95[_0x0c30('0x51')],null))[_0x0c30('0x1a')](respondWithResult(_0x77b329,null))[_0x0c30('0x24')](handleError(_0x77b329,null));};exports[_0x0c30('0x52')]=function(_0x53f797,_0x593de0,_0x5892f0){if(_0x53f797[_0x0c30('0x53')]&&_0x53f797[_0x0c30('0x53')]['filename']){_0x53f797[_0x0c30('0x51')][_0x0c30('0x54')]=_0x53f797[_0x0c30('0x53')][_0x0c30('0x55')];}return db[_0x0c30('0x36')][_0x0c30('0x50')]({'where':{'id':_0x53f797['params']['id']}})[_0x0c30('0x1a')](handleEntityNotFound(_0x593de0,null))[_0x0c30('0x1a')](saveUpdates(_0x53f797[_0x0c30('0x51')],null))[_0x0c30('0x1a')](respondWithResult(_0x593de0,null))[_0x0c30('0x24')](handleError(_0x593de0,null));};exports['addLogoLogin']=function(_0x4b8971,_0x42b60b,_0x4bc42c){if(_0x4b8971[_0x0c30('0x53')]&&_0x4b8971[_0x0c30('0x53')][_0x0c30('0x55')]){_0x4b8971['body']['loginLogo']=_0x4b8971['file'][_0x0c30('0x55')];}return db['Setting'][_0x0c30('0x50')]({'where':{'id':_0x4b8971[_0x0c30('0x4e')]['id']}})['then'](handleEntityNotFound(_0x42b60b,null))[_0x0c30('0x1a')](saveUpdates(_0x4b8971[_0x0c30('0x51')],null))[_0x0c30('0x1a')](respondWithResult(_0x42b60b,null))[_0x0c30('0x24')](handleError(_0x42b60b,null));};var utilLicense=require('../../config/license/util');exports[_0x0c30('0x56')]=function(_0x3c2a36,_0x5b5616,_0x233254){var _0x4a5916=_0x0c30('0x57');var _0xd211a1={'custom':![]};return utilLicense[_0x0c30('0x58')]()[_0x0c30('0x1a')](function(_0x5e6621){if(_0x5e6621){_0xd211a1=_0x5e6621;}return db[_0x0c30('0x36')][_0x0c30('0x50')]({'where':{'id':_0x3c2a36[_0x0c30('0x4e')]['id']},'attributes':['logo','loginLogo','preferred',_0x0c30('0x59'),'defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x0c30('0x1a')](handleEntityNotFound(_0x5b5616,null))[_0x0c30('0x1a')](function(_0x4ceca3){if(_0x4ceca3){var _0x5f76e8=_0x4ceca3[_0x0c30('0x54')]&&fs[_0x0c30('0x5a')](path['join'](config['root'],_0x4a5916,_[_0x0c30('0x5b')](_0x4ceca3[_0x0c30('0x54')])))?path[_0x0c30('0x5c')](config[_0x0c30('0x5d')],_0x4a5916,_[_0x0c30('0x5b')](_0x4ceca3[_0x0c30('0x54')])):path['join'](config[_0x0c30('0x5d')],_0x4a5916,_['toLower'](_0x0c30('0x5e')));var _0x4d1fc7=_0x0c30('0x5f')+_['upperFirst'](_0x0c30('0x54'));if(_0x4ceca3[_0x4d1fc7]||!_0xd211a1[_0x0c30('0x60')]){_0x5f76e8=path[_0x0c30('0x5c')](config[_0x0c30('0x5d')],_0x4a5916,_[_0x0c30('0x5b')](_0x0c30('0x5e')));}if(!fs[_0x0c30('0x5a')](_0x5f76e8)){throw new db[(_0x0c30('0x61'))][(_0x0c30('0x62'))](_[_0x0c30('0x63')](_0x0c30('0x54'))+_0x0c30('0x64'));}return _0x5b5616[_0x0c30('0x65')](_0x5f76e8);}})[_0x0c30('0x24')](handleError(_0x5b5616,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x3e72f8,_0x3295c0,_0x23e5eb){var _0x698b5c=_0x0c30('0x57');var _0xdc188e={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x5c80e9){if(_0x5c80e9){_0xdc188e=_0x5c80e9;}return db['Setting'][_0x0c30('0x50')]({'where':{'id':_0x3e72f8[_0x0c30('0x4e')]['id']},'attributes':[_0x0c30('0x54'),'loginLogo',_0x0c30('0x66'),_0x0c30('0x59'),_0x0c30('0x67'),_0x0c30('0x68'),_0x0c30('0x69'),_0x0c30('0x6a')],'raw':!![]});})[_0x0c30('0x1a')](handleEntityNotFound(_0x3295c0,null))[_0x0c30('0x1a')](function(_0xc94340){if(_0xc94340){var _0x545c76=_0xc94340[_0x0c30('0x6b')]&&fs[_0x0c30('0x5a')](path[_0x0c30('0x5c')](config[_0x0c30('0x5d')],_0x698b5c,_[_0x0c30('0x5b')](_0xc94340[_0x0c30('0x6b')])))?path[_0x0c30('0x5c')](config[_0x0c30('0x5d')],_0x698b5c,_[_0x0c30('0x5b')](_0xc94340['loginLogo'])):path['join'](config[_0x0c30('0x5d')],_0x698b5c,_[_0x0c30('0x5b')](_0x0c30('0x6c')));var _0x2b0506=_0x0c30('0x5f')+_[_0x0c30('0x63')](_0x0c30('0x6b'));if(_0xc94340[_0x2b0506]||!_0xdc188e[_0x0c30('0x60')]){_0x545c76=path['join'](config[_0x0c30('0x5d')],_0x698b5c,_[_0x0c30('0x5b')](_0x0c30('0x6c')));}if(!fs[_0x0c30('0x5a')](_0x545c76)){throw new db[(_0x0c30('0x61'))][(_0x0c30('0x62'))](_[_0x0c30('0x63')](_0x0c30('0x6b'))+_0x0c30('0x64'));}return _0x3295c0[_0x0c30('0x65')](_0x545c76);}})[_0x0c30('0x24')](handleError(_0x3295c0,null));};exports[_0x0c30('0x6d')]=function(_0x34e889,_0x1feaf6){return db[_0x0c30('0x36')]['find']({'where':{'id':_0x34e889[_0x0c30('0x4e')]['id']},'attributes':[_0x0c30('0x6e')]})[_0x0c30('0x1a')](respondWithResult(_0x1feaf6,null))[_0x0c30('0x24')](handleError(_0x1feaf6,null));};exports['addPreferred']=function(_0x4b0fb2,_0x342e4b,_0x30e269){if(_0x4b0fb2[_0x0c30('0x53')]&&_0x4b0fb2[_0x0c30('0x53')][_0x0c30('0x55')]){_0x4b0fb2[_0x0c30('0x51')][_0x0c30('0x66')]=_0x4b0fb2[_0x0c30('0x53')][_0x0c30('0x55')];}return db[_0x0c30('0x36')][_0x0c30('0x50')]({'where':{'id':_0x4b0fb2[_0x0c30('0x4e')]['id']}})[_0x0c30('0x1a')](handleEntityNotFound(_0x342e4b,null))[_0x0c30('0x1a')](saveUpdates(_0x4b0fb2[_0x0c30('0x51')],null))['then'](respondWithResult(_0x342e4b,null))[_0x0c30('0x24')](handleError(_0x342e4b,null));};var utilLicense=require(_0x0c30('0x6f'));exports[_0x0c30('0x70')]=function(_0x1fc973,_0x5dc3c4,_0x1363ff){var _0x13b00a=_0x0c30('0x57');var _0x1d86fb={'custom':![]};return utilLicense[_0x0c30('0x58')]()['then'](function(_0x448bd4){if(_0x448bd4){_0x1d86fb=_0x448bd4;}return db['Setting'][_0x0c30('0x50')]({'where':{'id':_0x1fc973[_0x0c30('0x4e')]['id']},'attributes':[_0x0c30('0x54'),'loginLogo',_0x0c30('0x66'),_0x0c30('0x59'),_0x0c30('0x67'),_0x0c30('0x68'),'defaultPreferred',_0x0c30('0x6a')],'raw':!![]});})['then'](handleEntityNotFound(_0x5dc3c4,null))[_0x0c30('0x1a')](function(_0x254e30){if(_0x254e30){var _0x2a4c0d=_0x254e30[_0x0c30('0x66')]&&fs[_0x0c30('0x5a')](path[_0x0c30('0x5c')](config['root'],_0x13b00a,_['toLower'](_0x254e30['preferred'])))?path[_0x0c30('0x5c')](config[_0x0c30('0x5d')],_0x13b00a,_['toLower'](_0x254e30[_0x0c30('0x66')])):path['join'](config[_0x0c30('0x5d')],_0x13b00a,_[_0x0c30('0x5b')](_0x0c30('0x71')));var _0x21c67d=_0x0c30('0x5f')+_['upperFirst'](_0x0c30('0x66'));if(_0x254e30[_0x21c67d]||!_0x1d86fb['custom']||!_0x1d86fb['preferred']){_0x2a4c0d=path['join'](config['root'],_0x13b00a,_[_0x0c30('0x5b')](_0x0c30('0x71')));}if(!fs[_0x0c30('0x5a')](_0x2a4c0d)){throw new db['Sequelize'][(_0x0c30('0x62'))](_[_0x0c30('0x63')](_0x0c30('0x66'))+_0x0c30('0x64'));}return _0x5dc3c4[_0x0c30('0x65')](_0x2a4c0d);}})['catch'](handleError(_0x5dc3c4,null));};exports[_0x0c30('0x72')]=function(_0x177d66,_0x75920f,_0x15415c){if(_0x177d66[_0x0c30('0x53')]&&_0x177d66[_0x0c30('0x53')][_0x0c30('0x55')]){_0x177d66[_0x0c30('0x51')]['favicon']=_0x177d66[_0x0c30('0x53')][_0x0c30('0x55')];}return db[_0x0c30('0x36')][_0x0c30('0x50')]({'where':{'id':_0x177d66[_0x0c30('0x4e')]['id']}})[_0x0c30('0x1a')](handleEntityNotFound(_0x75920f,null))['then'](saveUpdates(_0x177d66[_0x0c30('0x51')],null))[_0x0c30('0x1a')](respondWithResult(_0x75920f,null))[_0x0c30('0x24')](handleError(_0x75920f,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x2fd781,_0x3996a2,_0x54bc3f){var _0x176d44='server/files/images/logos';var _0x45e84b={'custom':![]};return utilLicense[_0x0c30('0x58')]()['then'](function(_0x24da00){if(_0x24da00){_0x45e84b=_0x24da00;}return db['Setting'][_0x0c30('0x50')]({'where':{'id':_0x2fd781['params']['id']},'attributes':[_0x0c30('0x54'),_0x0c30('0x6b'),_0x0c30('0x66'),_0x0c30('0x59'),_0x0c30('0x67'),_0x0c30('0x68'),'defaultPreferred',_0x0c30('0x6a')],'raw':!![]});})[_0x0c30('0x1a')](handleEntityNotFound(_0x3996a2,null))['then'](function(_0x296ba3){if(_0x296ba3){var _0x1f196e=_0x296ba3['favicon']&&fs[_0x0c30('0x5a')](path[_0x0c30('0x5c')](config[_0x0c30('0x5d')],_0x176d44,_[_0x0c30('0x5b')](_0x296ba3[_0x0c30('0x59')])))?path[_0x0c30('0x5c')](config['root'],_0x176d44,_[_0x0c30('0x5b')](_0x296ba3[_0x0c30('0x59')])):path[_0x0c30('0x5c')](config[_0x0c30('0x5d')],_0x176d44,_[_0x0c30('0x5b')](_0x0c30('0x73')));var _0x1f8551=_0x0c30('0x5f')+_[_0x0c30('0x63')]('favicon');if(_0x296ba3[_0x1f8551]||!_0x45e84b[_0x0c30('0x60')]){_0x1f196e=path[_0x0c30('0x5c')](config['root'],_0x176d44,_[_0x0c30('0x5b')](_0x0c30('0x73')));}if(!fs[_0x0c30('0x5a')](_0x1f196e)){throw new db[(_0x0c30('0x61'))][(_0x0c30('0x62'))](_[_0x0c30('0x63')]('favicon')+'\x20not\x20found');}return _0x3996a2[_0x0c30('0x65')](_0x1f196e);}})['catch'](handleError(_0x3996a2,null));};exports[_0x0c30('0x74')]=function(_0x117f42,_0x13791a){var _0xa0f824={'offset':moment()[_0x0c30('0x75')]()};_0xa0f824[_0x0c30('0x76')]=moment()[_0x0c30('0x75')](_0xa0f824[_0x0c30('0x27')])[_0x0c30('0x77')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x13791a[_0x0c30('0x26')](0xc8)[_0x0c30('0x33')](_0xa0f824);}; \ No newline at end of file +var _0x99e9=['pick','filter','merge','map','type','includeAll','include','Setting','params','rawAttributes','length','options','find','update','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','Sequelize','\x20not\x20found','defaultLogo','defaultLoginLogo','default_loginLogo.svg','custom','download','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','ValidationError','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','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','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','then','destroy','stack','name','index','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where'];(function(_0x1b326c,_0x49a702){var _0x458067=function(_0x3c0d26){while(--_0x3c0d26){_0x1b326c['push'](_0x1b326c['shift']());}};_0x458067(++_0x49a702);}(_0x99e9,0xb4));var _0x999e=function(_0x154940,_0x4a448a){_0x154940=_0x154940-0x0;var _0x401409=_0x99e9[_0x154940];return _0x401409;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x999e('0x0'));var zipdir=require(_0x999e('0x1'));var jsonpatch=require(_0x999e('0x2'));var rp=require(_0x999e('0x3'));var moment=require('moment');var BPromise=require(_0x999e('0x4'));var Mustache=require(_0x999e('0x5'));var util=require(_0x999e('0x6'));var path=require('path');var sox=require(_0x999e('0x7'));var csv=require('to-csv');var ejs=require(_0x999e('0x8'));var fs=require('fs');var fs_extra=require(_0x999e('0x9'));var _=require(_0x999e('0xa'));var squel=require(_0x999e('0xb'));var crypto=require('crypto');var jsforce=require(_0x999e('0xc'));var deskjs=require(_0x999e('0xd'));var toCsv=require(_0x999e('0xe'));var querystring=require(_0x999e('0xf'));var Papa=require(_0x999e('0x10'));var Redis=require(_0x999e('0x11'));var authService=require(_0x999e('0x12'));var qs=require(_0x999e('0x13'));var as=require(_0x999e('0x14'));var hardwareService=require(_0x999e('0x15'));var logger=require(_0x999e('0x16'))(_0x999e('0x17'));var utils=require(_0x999e('0x18'));var config=require(_0x999e('0x19'));var licenseUtil=require(_0x999e('0x1a'));var db=require(_0x999e('0x1b'))['db'];var jayson=require(_0x999e('0x1c'));var client=jayson['client'][_0x999e('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x54afad,_0x3e6f5a,_0x387924,_0x2fbc3e){return new BPromise(function(_0x538a92,_0x28bdd1){var _0x4d1716=_0x2fbc3e||client;return _0x4d1716[_0x999e('0x1e')](_0x54afad,_0x387924)['then'](function(_0x549ad4){logger[_0x999e('0x1f')](_0x999e('0x20'),_0x3e6f5a,_0x999e('0x21'));logger[_0x999e('0x22')](_0x999e('0x23'),_0x3e6f5a,_0x999e('0x21'),JSON['stringify'](_0x549ad4));if(_0x549ad4['error']){if(_0x549ad4['error'][_0x999e('0x24')]===0x1f4){logger[_0x999e('0x25')](_0x999e('0x20'),_0x3e6f5a,_0x549ad4[_0x999e('0x25')][_0x999e('0x26')]);return _0x28bdd1(_0x549ad4[_0x999e('0x25')]['message']);}logger['error'](_0x999e('0x20'),_0x3e6f5a,_0x549ad4[_0x999e('0x25')][_0x999e('0x26')]);return _0x538a92(_0x549ad4['error'][_0x999e('0x26')]);}else{logger[_0x999e('0x1f')](_0x999e('0x20'),_0x3e6f5a,_0x999e('0x21'));_0x538a92(_0x549ad4[_0x999e('0x27')][_0x999e('0x26')]);}})[_0x999e('0x28')](function(_0x4d4474){logger['error'](_0x999e('0x20'),_0x3e6f5a,_0x4d4474);_0x28bdd1(_0x4d4474);});});}function respondWithStatusCode(_0x4f0091,_0x4c5491){_0x4c5491=_0x4c5491||0xcc;return function(_0x452acd){if(_0x452acd){return _0x4f0091[_0x999e('0x29')](_0x4c5491);}return _0x4f0091[_0x999e('0x2a')](_0x4c5491)[_0x999e('0x2b')]();};}function respondWithResult(_0x3f2bbf,_0x320634){_0x320634=_0x320634||0xc8;return function(_0x4f8406){if(_0x4f8406){return _0x3f2bbf[_0x999e('0x2a')](_0x320634)[_0x999e('0x2c')](_0x4f8406);}};}function respondWithFilteredResult(_0x11068e,_0x12b9ad){return function(_0x1b7adb){if(_0x1b7adb){var _0x1d2dc6=typeof _0x12b9ad[_0x999e('0x2d')]==='undefined'&&typeof _0x12b9ad[_0x999e('0x2e')]==='undefined';var _0x4fed13=_0x1b7adb[_0x999e('0x2f')];var _0x1059bd=_0x1d2dc6?0x0:_0x12b9ad[_0x999e('0x2d')];var _0x555ca0=_0x1d2dc6?_0x1b7adb[_0x999e('0x2f')]:_0x12b9ad[_0x999e('0x2d')]+_0x12b9ad[_0x999e('0x2e')];var _0x4339bf;if(_0x555ca0>=_0x4fed13){_0x555ca0=_0x4fed13;_0x4339bf=0xc8;}else{_0x4339bf=0xce;}_0x11068e[_0x999e('0x2a')](_0x4339bf);return _0x11068e[_0x999e('0x30')](_0x999e('0x31'),_0x1059bd+'-'+_0x555ca0+'/'+_0x4fed13)[_0x999e('0x2c')](_0x1b7adb);}return null;};}function patchUpdates(_0x27102b){return function(_0x3ddacb){try{jsonpatch['apply'](_0x3ddacb,_0x27102b,!![]);}catch(_0x1c8feb){return BPromise[_0x999e('0x32')](_0x1c8feb);}return _0x3ddacb[_0x999e('0x33')]();};}function saveUpdates(_0x4c2ce8,_0x2ca5b8){return function(_0x5af72c){if(_0x5af72c){return _0x5af72c['update'](_0x4c2ce8)[_0x999e('0x34')](function(_0x332195){return _0x332195;});}return null;};}function removeEntity(_0x5aa206,_0x53ebb2){return function(_0x5def61){if(_0x5def61){return _0x5def61[_0x999e('0x35')]()[_0x999e('0x34')](function(){_0x5aa206[_0x999e('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2724be,_0x41d6f1){return function(_0x37f662){if(!_0x37f662){_0x2724be[_0x999e('0x29')](0x194);}return _0x37f662;};}function handleError(_0x4f861f,_0x4ebcb7){_0x4ebcb7=_0x4ebcb7||0x1f4;return function(_0x44fb32){logger['error'](_0x44fb32[_0x999e('0x36')]);if(_0x44fb32[_0x999e('0x37')]){delete _0x44fb32[_0x999e('0x37')];}_0x4f861f[_0x999e('0x2a')](_0x4ebcb7)['send'](_0x44fb32);};}exports[_0x999e('0x38')]=function(_0x28df26,_0x5bd468){var _0x4808d1={},_0x327866={},_0x4aa98c={'count':0x0,'rows':[]};var _0xa0c150=_['map'](db['Setting']['rawAttributes'],function(_0x5360a3){return{'name':_0x5360a3[_0x999e('0x39')],'type':_0x5360a3['type'][_0x999e('0x3a')]};});_0x327866['model']=_['map'](_0xa0c150,'name');_0x327866[_0x999e('0x3b')]=_[_0x999e('0x3c')](_0x28df26[_0x999e('0x3b')]);_0x327866[_0x999e('0x3d')]=_[_0x999e('0x3e')](_0x327866[_0x999e('0x3f')],_0x327866[_0x999e('0x3b')]);_0x4808d1[_0x999e('0x40')]=_['intersection'](_0x327866[_0x999e('0x3f')],qs[_0x999e('0x41')](_0x28df26[_0x999e('0x3b')][_0x999e('0x41')]));_0x4808d1['attributes']=_0x4808d1[_0x999e('0x40')]['length']?_0x4808d1[_0x999e('0x40')]:_0x327866[_0x999e('0x3f')];if(!_0x28df26[_0x999e('0x3b')][_0x999e('0x42')]('nolimit')){_0x4808d1[_0x999e('0x2e')]=qs[_0x999e('0x2e')](_0x28df26[_0x999e('0x3b')]['limit']);_0x4808d1['offset']=qs[_0x999e('0x2d')](_0x28df26[_0x999e('0x3b')][_0x999e('0x2d')]);}_0x4808d1[_0x999e('0x43')]=qs[_0x999e('0x44')](_0x28df26[_0x999e('0x3b')][_0x999e('0x44')]);_0x4808d1[_0x999e('0x45')]=qs[_0x999e('0x3d')](_[_0x999e('0x46')](_0x28df26['query'],_0x327866['filters']),_0xa0c150);if(_0x28df26[_0x999e('0x3b')][_0x999e('0x47')]){_0x4808d1[_0x999e('0x45')]=_[_0x999e('0x48')](_0x4808d1[_0x999e('0x45')],{'$or':_[_0x999e('0x49')](_0xa0c150,function(_0x528547){if(_0x528547[_0x999e('0x4a')]!=='VIRTUAL'){var _0x4caf56={};_0x4caf56[_0x528547[_0x999e('0x37')]]={'$like':'%'+_0x28df26['query']['filter']+'%'};return _0x4caf56;}})});}_0x4808d1=_['merge']({},_0x4808d1,_0x28df26['options']);var _0xc89b1={'where':_0x4808d1[_0x999e('0x45')]};return db['Setting'][_0x999e('0x2f')](_0xc89b1)[_0x999e('0x34')](function(_0x2aa9ca){_0x4aa98c['count']=_0x2aa9ca;if(_0x28df26['query'][_0x999e('0x4b')]){_0x4808d1[_0x999e('0x4c')]=[{'all':!![]}];}return db[_0x999e('0x4d')]['findAll'](_0x4808d1);})['then'](function(_0x4d0358){_0x4aa98c['rows']=_0x4d0358;return _0x4aa98c;})[_0x999e('0x34')](respondWithFilteredResult(_0x5bd468,_0x4808d1))['catch'](handleError(_0x5bd468,null));};exports['show']=function(_0x45e2c2,_0x29a27f){var _0x5843f1={'raw':![],'where':{'id':_0x45e2c2[_0x999e('0x4e')]['id']}},_0xa50dc6={};_0xa50dc6['model']=_[_0x999e('0x3c')](db['Setting'][_0x999e('0x4f')]);_0xa50dc6[_0x999e('0x3b')]=_['keys'](_0x45e2c2[_0x999e('0x3b')]);_0xa50dc6[_0x999e('0x3d')]=_['intersection'](_0xa50dc6['model'],_0xa50dc6[_0x999e('0x3b')]);_0x5843f1['attributes']=_['intersection'](_0xa50dc6['model'],qs[_0x999e('0x41')](_0x45e2c2[_0x999e('0x3b')][_0x999e('0x41')]));_0x5843f1[_0x999e('0x40')]=_0x5843f1[_0x999e('0x40')][_0x999e('0x50')]?_0x5843f1['attributes']:_0xa50dc6[_0x999e('0x3f')];if(_0x45e2c2[_0x999e('0x3b')]['includeAll']){_0x5843f1[_0x999e('0x4c')]=[{'all':!![]}];}_0x5843f1=_[_0x999e('0x48')]({},_0x5843f1,_0x45e2c2[_0x999e('0x51')]);return db[_0x999e('0x4d')][_0x999e('0x52')](_0x5843f1)[_0x999e('0x34')](handleEntityNotFound(_0x29a27f,null))[_0x999e('0x34')](respondWithResult(_0x29a27f,null))[_0x999e('0x28')](handleError(_0x29a27f,null));};exports[_0x999e('0x53')]=function(_0x53932a,_0x9f3f7a){if(_0x53932a[_0x999e('0x54')]['id']){delete _0x53932a[_0x999e('0x54')]['id'];}return db[_0x999e('0x4d')]['find']({'where':{'id':_0x53932a[_0x999e('0x4e')]['id']}})[_0x999e('0x34')](handleEntityNotFound(_0x9f3f7a,null))[_0x999e('0x34')](saveUpdates(_0x53932a[_0x999e('0x54')],null))[_0x999e('0x34')](respondWithResult(_0x9f3f7a,null))[_0x999e('0x28')](handleError(_0x9f3f7a,null));};exports[_0x999e('0x55')]=function(_0x1a6925,_0x4ecb26,_0x56368e){if(_0x1a6925[_0x999e('0x56')]&&_0x1a6925[_0x999e('0x56')][_0x999e('0x57')]){_0x1a6925[_0x999e('0x54')][_0x999e('0x58')]=_0x1a6925[_0x999e('0x56')][_0x999e('0x57')];}return db['Setting']['find']({'where':{'id':_0x1a6925[_0x999e('0x4e')]['id']}})[_0x999e('0x34')](handleEntityNotFound(_0x4ecb26,null))[_0x999e('0x34')](saveUpdates(_0x1a6925[_0x999e('0x54')],null))[_0x999e('0x34')](respondWithResult(_0x4ecb26,null))['catch'](handleError(_0x4ecb26,null));};exports[_0x999e('0x59')]=function(_0x1e7ad2,_0x30a49d,_0x3c8ecf){if(_0x1e7ad2[_0x999e('0x56')]&&_0x1e7ad2[_0x999e('0x56')][_0x999e('0x57')]){_0x1e7ad2['body'][_0x999e('0x5a')]=_0x1e7ad2['file'][_0x999e('0x57')];}return db[_0x999e('0x4d')][_0x999e('0x52')]({'where':{'id':_0x1e7ad2[_0x999e('0x4e')]['id']}})[_0x999e('0x34')](handleEntityNotFound(_0x30a49d,null))[_0x999e('0x34')](saveUpdates(_0x1e7ad2['body'],null))[_0x999e('0x34')](respondWithResult(_0x30a49d,null))[_0x999e('0x28')](handleError(_0x30a49d,null));};var utilLicense=require(_0x999e('0x1a'));exports[_0x999e('0x5b')]=function(_0x470e51,_0x121110,_0x23fd58){var _0x3d398c=_0x999e('0x5c');var _0x7f9dfe={'custom':![]};return utilLicense[_0x999e('0x5d')]()[_0x999e('0x34')](function(_0x77a387){if(_0x77a387){_0x7f9dfe=_0x77a387;}return db[_0x999e('0x4d')][_0x999e('0x52')]({'where':{'id':_0x470e51['params']['id']},'attributes':[_0x999e('0x58'),_0x999e('0x5a'),_0x999e('0x5e'),_0x999e('0x5f'),'defaultLogo','defaultLoginLogo',_0x999e('0x60'),_0x999e('0x61')],'raw':!![]});})[_0x999e('0x34')](handleEntityNotFound(_0x121110,null))[_0x999e('0x34')](function(_0x1c9b64){if(_0x1c9b64){var _0x19d934=_0x1c9b64[_0x999e('0x58')]&&fs[_0x999e('0x62')](path[_0x999e('0x63')](config['root'],_0x3d398c,_[_0x999e('0x64')](_0x1c9b64['logo'])))?path[_0x999e('0x63')](config[_0x999e('0x65')],_0x3d398c,_['toLower'](_0x1c9b64[_0x999e('0x58')])):path[_0x999e('0x63')](config[_0x999e('0x65')],_0x3d398c,_[_0x999e('0x64')](_0x999e('0x66')));var _0x4ba9cd=_0x999e('0x67')+_[_0x999e('0x68')]('logo');if(_0x1c9b64[_0x4ba9cd]||!_0x7f9dfe['custom']){_0x19d934=path['join'](config[_0x999e('0x65')],_0x3d398c,_[_0x999e('0x64')](_0x999e('0x66')));}if(!fs[_0x999e('0x62')](_0x19d934)){throw new db[(_0x999e('0x69'))]['ValidationError'](_['upperFirst']('logo')+_0x999e('0x6a'));}return _0x121110['download'](_0x19d934);}})['catch'](handleError(_0x121110,null));};var utilLicense=require(_0x999e('0x1a'));exports['getLogoLogin']=function(_0x294f2a,_0x3131c7,_0xb5ac06){var _0x5b8a0d=_0x999e('0x5c');var _0x3c2bce={'custom':![]};return utilLicense[_0x999e('0x5d')]()[_0x999e('0x34')](function(_0x3f0baa){if(_0x3f0baa){_0x3c2bce=_0x3f0baa;}return db[_0x999e('0x4d')][_0x999e('0x52')]({'where':{'id':_0x294f2a['params']['id']},'attributes':[_0x999e('0x58'),_0x999e('0x5a'),_0x999e('0x5e'),'favicon',_0x999e('0x6b'),_0x999e('0x6c'),'defaultPreferred',_0x999e('0x61')],'raw':!![]});})[_0x999e('0x34')](handleEntityNotFound(_0x3131c7,null))[_0x999e('0x34')](function(_0x1f0dc3){if(_0x1f0dc3){var _0xc02339=_0x1f0dc3[_0x999e('0x5a')]&&fs[_0x999e('0x62')](path[_0x999e('0x63')](config[_0x999e('0x65')],_0x5b8a0d,_['toLower'](_0x1f0dc3[_0x999e('0x5a')])))?path[_0x999e('0x63')](config[_0x999e('0x65')],_0x5b8a0d,_['toLower'](_0x1f0dc3[_0x999e('0x5a')])):path['join'](config[_0x999e('0x65')],_0x5b8a0d,_[_0x999e('0x64')](_0x999e('0x6d')));var _0x4e6c30=_0x999e('0x67')+_[_0x999e('0x68')](_0x999e('0x5a'));if(_0x1f0dc3[_0x4e6c30]||!_0x3c2bce[_0x999e('0x6e')]){_0xc02339=path[_0x999e('0x63')](config[_0x999e('0x65')],_0x5b8a0d,_['toLower'](_0x999e('0x6d')));}if(!fs['existsSync'](_0xc02339)){throw new db[(_0x999e('0x69'))]['ValidationError'](_['upperFirst'](_0x999e('0x5a'))+'\x20not\x20found');}return _0x3131c7[_0x999e('0x6f')](_0xc02339);}})[_0x999e('0x28')](handleError(_0x3131c7,null));};exports['gdpr']=function(_0x15c83f,_0x2d064e){return db['Setting'][_0x999e('0x52')]({'where':{'id':_0x15c83f[_0x999e('0x4e')]['id']},'attributes':[_0x999e('0x70')]})[_0x999e('0x34')](respondWithResult(_0x2d064e,null))[_0x999e('0x28')](handleError(_0x2d064e,null));};exports[_0x999e('0x71')]=function(_0x4f22a6,_0x25b243,_0x5cdf6d){if(_0x4f22a6['file']&&_0x4f22a6[_0x999e('0x56')][_0x999e('0x57')]){_0x4f22a6[_0x999e('0x54')][_0x999e('0x5e')]=_0x4f22a6[_0x999e('0x56')][_0x999e('0x57')];}return db['Setting'][_0x999e('0x52')]({'where':{'id':_0x4f22a6[_0x999e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x25b243,null))[_0x999e('0x34')](saveUpdates(_0x4f22a6[_0x999e('0x54')],null))[_0x999e('0x34')](respondWithResult(_0x25b243,null))['catch'](handleError(_0x25b243,null));};var utilLicense=require(_0x999e('0x1a'));exports[_0x999e('0x72')]=function(_0x328c2d,_0x47eac1,_0x216040){var _0x372316=_0x999e('0x5c');var _0x53cf4d={'custom':![]};return utilLicense['getLicense']()[_0x999e('0x34')](function(_0x47e5ce){if(_0x47e5ce){_0x53cf4d=_0x47e5ce;}return db[_0x999e('0x4d')][_0x999e('0x52')]({'where':{'id':_0x328c2d[_0x999e('0x4e')]['id']},'attributes':[_0x999e('0x58'),_0x999e('0x5a'),_0x999e('0x5e'),_0x999e('0x5f'),'defaultLogo',_0x999e('0x6c'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x999e('0x34')](handleEntityNotFound(_0x47eac1,null))[_0x999e('0x34')](function(_0xa0a5de){if(_0xa0a5de){var _0x302e73=_0xa0a5de[_0x999e('0x5e')]&&fs[_0x999e('0x62')](path['join'](config[_0x999e('0x65')],_0x372316,_['toLower'](_0xa0a5de[_0x999e('0x5e')])))?path[_0x999e('0x63')](config[_0x999e('0x65')],_0x372316,_['toLower'](_0xa0a5de[_0x999e('0x5e')])):path['join'](config[_0x999e('0x65')],_0x372316,_[_0x999e('0x64')](_0x999e('0x73')));var _0xe7f809=_0x999e('0x67')+_['upperFirst']('preferred');if(_0xa0a5de[_0xe7f809]||!_0x53cf4d[_0x999e('0x6e')]||!_0x53cf4d[_0x999e('0x5e')]){_0x302e73=path[_0x999e('0x63')](config[_0x999e('0x65')],_0x372316,_[_0x999e('0x64')](_0x999e('0x73')));}if(!fs[_0x999e('0x62')](_0x302e73)){throw new db[(_0x999e('0x69'))]['ValidationError'](_[_0x999e('0x68')](_0x999e('0x5e'))+_0x999e('0x6a'));}return _0x47eac1[_0x999e('0x6f')](_0x302e73);}})[_0x999e('0x28')](handleError(_0x47eac1,null));};exports[_0x999e('0x74')]=function(_0x38b48b,_0x16d552,_0x4c6d18){if(_0x38b48b[_0x999e('0x56')]&&_0x38b48b[_0x999e('0x56')][_0x999e('0x57')]){_0x38b48b[_0x999e('0x54')][_0x999e('0x5f')]=_0x38b48b[_0x999e('0x56')][_0x999e('0x57')];}return db[_0x999e('0x4d')]['find']({'where':{'id':_0x38b48b[_0x999e('0x4e')]['id']}})[_0x999e('0x34')](handleEntityNotFound(_0x16d552,null))[_0x999e('0x34')](saveUpdates(_0x38b48b['body'],null))[_0x999e('0x34')](respondWithResult(_0x16d552,null))[_0x999e('0x28')](handleError(_0x16d552,null));};var utilLicense=require(_0x999e('0x1a'));exports[_0x999e('0x75')]=function(_0x35fcd5,_0x4f6f0f,_0x1004eb){var _0x228d46=_0x999e('0x5c');var _0x4ee1d4={'custom':![]};return utilLicense[_0x999e('0x5d')]()[_0x999e('0x34')](function(_0x412d20){if(_0x412d20){_0x4ee1d4=_0x412d20;}return db['Setting']['find']({'where':{'id':_0x35fcd5[_0x999e('0x4e')]['id']},'attributes':[_0x999e('0x58'),_0x999e('0x5a'),'preferred',_0x999e('0x5f'),_0x999e('0x6b'),_0x999e('0x6c'),'defaultPreferred',_0x999e('0x61')],'raw':!![]});})[_0x999e('0x34')](handleEntityNotFound(_0x4f6f0f,null))['then'](function(_0x45c6fc){if(_0x45c6fc){var _0x5ac17e=_0x45c6fc['favicon']&&fs[_0x999e('0x62')](path[_0x999e('0x63')](config[_0x999e('0x65')],_0x228d46,_[_0x999e('0x64')](_0x45c6fc['favicon'])))?path[_0x999e('0x63')](config[_0x999e('0x65')],_0x228d46,_[_0x999e('0x64')](_0x45c6fc[_0x999e('0x5f')])):path[_0x999e('0x63')](config['root'],_0x228d46,_[_0x999e('0x64')](_0x999e('0x76')));var _0x3b1a00='default'+_[_0x999e('0x68')](_0x999e('0x5f'));if(_0x45c6fc[_0x3b1a00]||!_0x4ee1d4[_0x999e('0x6e')]){_0x5ac17e=path[_0x999e('0x63')](config[_0x999e('0x65')],_0x228d46,_[_0x999e('0x64')](_0x999e('0x76')));}if(!fs[_0x999e('0x62')](_0x5ac17e)){throw new db['Sequelize'][(_0x999e('0x77'))](_[_0x999e('0x68')](_0x999e('0x5f'))+_0x999e('0x6a'));}return _0x4f6f0f['download'](_0x5ac17e);}})[_0x999e('0x28')](handleError(_0x4f6f0f,null));};exports[_0x999e('0x78')]=function(_0xada3ee,_0x411a6b){var _0x1bca25={'offset':moment()['utcOffset']()};_0x1bca25[_0x999e('0x79')]=moment()[_0x999e('0x7a')](_0x1bca25[_0x999e('0x2d')])[_0x999e('0x7b')](_0x999e('0x7c'));return _0x411a6b[_0x999e('0x2a')](0xc8)['send'](_0x1bca25);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 71f9526..383297a 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x314d35,_0x4b19b6){var _0x2c2771=function(_0x24191e){while(--_0x24191e){_0x314d35['push'](_0x314d35['shift']());}};_0x2c2771(++_0x4b19b6);}(_0xedd9,0xfc));var _0x9edd=function(_0x18472,_0x409787){_0x18472=_0x18472-0x0;var _0xdef8d5=_0xedd9[_0x18472];return _0xdef8d5;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x58ceb9,_0x5601df){var _0x3d0ff5=function(_0x3a79d0){while(--_0x3a79d0){_0x58ceb9['push'](_0x58ceb9['shift']());}};_0x3d0ff5(++_0x5601df);}(_0x7217,0x19e));var _0x7721=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x7217[_0x102e37];return _0x35a07c;};'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/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 1249947..6bbbf7b 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 _0xa866=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','ShowSetting','Setting','options','raw','where','attributes','include','map','model','debug','lodash','util'];(function(_0x2c5ce4,_0x1b4766){var _0x4060a3=function(_0x3d4b86){while(--_0x3d4b86){_0x2c5ce4['push'](_0x2c5ce4['shift']());}};_0x4060a3(++_0x1b4766);}(_0xa866,0x94));var _0x6a86=function(_0xd4a139,_0x281cc1){_0xd4a139=_0xd4a139-0x0;var _0x177cd4=_0xa866[_0xd4a139];return _0x177cd4;};'use strict';var _=require(_0x6a86('0x0'));var util=require(_0x6a86('0x1'));var moment=require(_0x6a86('0x2'));var BPromise=require(_0x6a86('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a86('0x4'))['db'];var utils=require(_0x6a86('0x5'));var logger=require(_0x6a86('0x6'))('rpc');var config=require(_0x6a86('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6a86('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a0905,_0x57c9b3,_0xd1ffe4){return new BPromise(function(_0x1da77a,_0x56e111){return client[_0x6a86('0x9')](_0x2a0905,_0xd1ffe4)['then'](function(_0x4bc2c7){logger[_0x6a86('0xa')](_0x6a86('0xb'),_0x57c9b3,'request\x20sent');logger['debug'](_0x6a86('0xc'),_0x57c9b3,'request\x20sent',JSON[_0x6a86('0xd')](_0x4bc2c7));if(_0x4bc2c7['error']){if(_0x4bc2c7[_0x6a86('0xe')][_0x6a86('0xf')]===0x1f4){logger[_0x6a86('0xe')]('Setting,\x20%s,\x20%s',_0x57c9b3,_0x4bc2c7[_0x6a86('0xe')][_0x6a86('0x10')]);return _0x56e111(_0x4bc2c7[_0x6a86('0xe')][_0x6a86('0x10')]);}logger[_0x6a86('0xe')]('Setting,\x20%s,\x20%s',_0x57c9b3,_0x4bc2c7[_0x6a86('0xe')][_0x6a86('0x10')]);return _0x1da77a(_0x4bc2c7['error'][_0x6a86('0x10')]);}else{logger[_0x6a86('0xa')]('Setting,\x20%s,\x20%s',_0x57c9b3,_0x6a86('0x11'));_0x1da77a(_0x4bc2c7[_0x6a86('0x12')][_0x6a86('0x10')]);}})[_0x6a86('0x13')](function(_0xaa9734){logger[_0x6a86('0xe')]('Setting,\x20%s,\x20%s',_0x57c9b3,_0xaa9734);_0x56e111(_0xaa9734);});});}exports[_0x6a86('0x14')]=function(_0x307975){var _0x7a7875=this;return new Promise(function(_0x2f95fa,_0xb3a136){return db[_0x6a86('0x15')]['find']({'raw':_0x307975['options']?_0x307975[_0x6a86('0x16')][_0x6a86('0x17')]===undefined?!![]:![]:!![],'where':_0x307975['options']?_0x307975['options'][_0x6a86('0x18')]||null:null,'attributes':_0x307975[_0x6a86('0x16')]?_0x307975['options'][_0x6a86('0x19')]||null:null,'include':_0x307975[_0x6a86('0x16')]?_0x307975[_0x6a86('0x16')][_0x6a86('0x1a')]?_[_0x6a86('0x1b')](_0x307975[_0x6a86('0x16')][_0x6a86('0x1a')],function(_0x2a4b90){return{'model':db[_0x2a4b90['model']],'as':_0x2a4b90['as'],'attributes':_0x2a4b90['attributes'],'include':_0x2a4b90[_0x6a86('0x1a')]?_[_0x6a86('0x1b')](_0x2a4b90['include'],function(_0x432377){return{'model':db[_0x432377[_0x6a86('0x1c')]],'as':_0x432377['as'],'attributes':_0x432377['attributes'],'include':_0x432377[_0x6a86('0x1a')]?_[_0x6a86('0x1b')](_0x432377['include'],function(_0x2f9ac0){return{'model':db[_0x2f9ac0['model']],'as':_0x2f9ac0['as'],'attributes':_0x2f9ac0[_0x6a86('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b42d8){logger['info'](_0x6a86('0x14'),_0x307975);logger[_0x6a86('0x1d')]('ShowSetting',_0x307975,JSON['stringify'](_0x1b42d8));_0x2f95fa(_0x1b42d8);})[_0x6a86('0x13')](function(_0x34bdb4){logger[_0x6a86('0xe')]('ShowSetting',_0x34bdb4[_0x6a86('0x10')],_0x307975);_0xb3a136(_0x7a7875['error'](0x1f4,_0x34bdb4[_0x6a86('0x10')]));});});}; \ No newline at end of file +var _0xc1f4=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Setting','find','raw','options','where','attributes','include','map','model','then','ShowSetting','stringify'];(function(_0x4c5804,_0x1d76e1){var _0x680109=function(_0x3f57fc){while(--_0x3f57fc){_0x4c5804['push'](_0x4c5804['shift']());}};_0x680109(++_0x1d76e1);}(_0xc1f4,0x176));var _0x4c1f=function(_0x3b826d,_0x1d0b68){_0x3b826d=_0x3b826d-0x0;var _0x38e1b3=_0xc1f4[_0x3b826d];return _0x38e1b3;};'use strict';var _=require(_0x4c1f('0x0'));var util=require(_0x4c1f('0x1'));var moment=require('moment');var BPromise=require(_0x4c1f('0x2'));var rs=require(_0x4c1f('0x3'));var fs=require('fs');var Redis=require(_0x4c1f('0x4'));var db=require(_0x4c1f('0x5'))['db'];var utils=require(_0x4c1f('0x6'));var logger=require('../../config/logger')(_0x4c1f('0x7'));var config=require(_0x4c1f('0x8'));var jayson=require(_0x4c1f('0x9'));var client=jayson[_0x4c1f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28ed01,_0x38b2b1,_0x1a3fb7){return new BPromise(function(_0x3801ea,_0x1b7b6e){return client[_0x4c1f('0xb')](_0x28ed01,_0x1a3fb7)['then'](function(_0xba7d2d){logger[_0x4c1f('0xc')](_0x4c1f('0xd'),_0x38b2b1,_0x4c1f('0xe'));logger[_0x4c1f('0xf')](_0x4c1f('0x10'),_0x38b2b1,_0x4c1f('0xe'),JSON['stringify'](_0xba7d2d));if(_0xba7d2d[_0x4c1f('0x11')]){if(_0xba7d2d[_0x4c1f('0x11')][_0x4c1f('0x12')]===0x1f4){logger[_0x4c1f('0x11')]('Setting,\x20%s,\x20%s',_0x38b2b1,_0xba7d2d['error'][_0x4c1f('0x13')]);return _0x1b7b6e(_0xba7d2d[_0x4c1f('0x11')][_0x4c1f('0x13')]);}logger[_0x4c1f('0x11')](_0x4c1f('0xd'),_0x38b2b1,_0xba7d2d[_0x4c1f('0x11')][_0x4c1f('0x13')]);return _0x3801ea(_0xba7d2d[_0x4c1f('0x11')][_0x4c1f('0x13')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x38b2b1,_0x4c1f('0xe'));_0x3801ea(_0xba7d2d[_0x4c1f('0x14')][_0x4c1f('0x13')]);}})[_0x4c1f('0x15')](function(_0x3474f2){logger[_0x4c1f('0x11')](_0x4c1f('0xd'),_0x38b2b1,_0x3474f2);_0x1b7b6e(_0x3474f2);});});}exports['ShowSetting']=function(_0x219fbf){var _0x2373c7=this;return new Promise(function(_0x7f4677,_0x2c65db){return db[_0x4c1f('0x16')][_0x4c1f('0x17')]({'raw':_0x219fbf['options']?_0x219fbf['options'][_0x4c1f('0x18')]===undefined?!![]:![]:!![],'where':_0x219fbf['options']?_0x219fbf[_0x4c1f('0x19')][_0x4c1f('0x1a')]||null:null,'attributes':_0x219fbf['options']?_0x219fbf['options'][_0x4c1f('0x1b')]||null:null,'include':_0x219fbf[_0x4c1f('0x19')]?_0x219fbf['options'][_0x4c1f('0x1c')]?_[_0x4c1f('0x1d')](_0x219fbf['options'][_0x4c1f('0x1c')],function(_0x188e54){return{'model':db[_0x188e54[_0x4c1f('0x1e')]],'as':_0x188e54['as'],'attributes':_0x188e54['attributes'],'include':_0x188e54[_0x4c1f('0x1c')]?_[_0x4c1f('0x1d')](_0x188e54[_0x4c1f('0x1c')],function(_0x272e7a){return{'model':db[_0x272e7a['model']],'as':_0x272e7a['as'],'attributes':_0x272e7a[_0x4c1f('0x1b')],'include':_0x272e7a[_0x4c1f('0x1c')]?_[_0x4c1f('0x1d')](_0x272e7a['include'],function(_0x9e5227){return{'model':db[_0x9e5227['model']],'as':_0x9e5227['as'],'attributes':_0x9e5227['attributes']};}):[]};}):[]};}):[]:[]})[_0x4c1f('0x1f')](function(_0x5a65b0){logger['info'](_0x4c1f('0x20'),_0x219fbf);logger[_0x4c1f('0xf')](_0x4c1f('0x20'),_0x219fbf,JSON[_0x4c1f('0x21')](_0x5a65b0));_0x7f4677(_0x5a65b0);})['catch'](function(_0x27bbf8){logger[_0x4c1f('0x11')](_0x4c1f('0x20'),_0x27bbf8[_0x4c1f('0x13')],_0x219fbf);_0x2c65db(_0x2373c7[_0x4c1f('0x11')](0x1f4,_0x27bbf8[_0x4c1f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index d359fc4..e04238f 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 _0x53ec=['send','status','update','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/send'];(function(_0x5812aa,_0x54bcc4){var _0x803a45=function(_0x485dfc){while(--_0x485dfc){_0x5812aa['push'](_0x5812aa['shift']());}};_0x803a45(++_0x54bcc4);}(_0x53ec,0x192));var _0xc53e=function(_0x450f09,_0x59561d){_0x450f09=_0x450f09-0x0;var _0x4e22ec=_0x53ec[_0x450f09];return _0x4e22ec;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xa')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['get']('/:id/canned_answers',auth[_0xc53e('0x9')](),controller['getAnswers']);router['get'](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x12')]);router[_0xc53e('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xc53e('0x13')]);router[_0xc53e('0xa')](_0xc53e('0x14'),controller[_0xc53e('0x15')]);router[_0xc53e('0xa')](_0xc53e('0x16'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x17')]);router[_0xc53e('0x18')]('/',auth[_0xc53e('0x9')](),controller['create']);router[_0xc53e('0x18')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x19')]);router[_0xc53e('0x18')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1b')]);router[_0xc53e('0x18')]('/:id/notify',controller['notify']);router[_0xc53e('0x18')](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1c')]);router[_0xc53e('0x18')](_0xc53e('0x1d'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1e')]);router[_0xc53e('0x18')](_0xc53e('0x14'),controller[_0xc53e('0x1f')]);router[_0xc53e('0x18')](_0xc53e('0x16'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x20')]);router[_0xc53e('0x21')](_0xc53e('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xc53e('0x21')]('/:id/dispositions',auth[_0xc53e('0x9')](),controller[_0xc53e('0x22')]);router[_0xc53e('0x21')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller['removeAnswers']);router[_0xc53e('0x21')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xc53e('0x23')]=router; \ No newline at end of file +var _0x7217=['/:id/send','status','put','update','delete','removeDispositions','removeAnswers','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','create','post','/:id/notify','notify','addApplications'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7217,0x19e));var _0x7721=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x7217[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getApplications']);router[_0x7721('0x8')](_0x7721('0x14'),auth['isAuthenticated'](),controller[_0x7721('0x15')]);router[_0x7721('0x8')](_0x7721('0x16'),controller[_0x7721('0x17')]);router['get'](_0x7721('0x18'),auth[_0x7721('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x1a')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller['addDisposition']);router[_0x7721('0x1a')]('/:id/canned_answers',auth[_0x7721('0x9')](),controller['addAnswer']);router[_0x7721('0x1a')](_0x7721('0x1b'),controller[_0x7721('0x1c')]);router[_0x7721('0x1a')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1d')]);router[_0x7721('0x1a')](_0x7721('0x1e'),auth[_0x7721('0x9')](),controller['send']);router[_0x7721('0x1a')](_0x7721('0x16'),controller[_0x7721('0x1f')]);router[_0x7721('0x1a')]('/:id/users',auth[_0x7721('0x9')](),controller['addAgents']);router[_0x7721('0x20')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x21')]);router[_0x7721('0x22')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller['destroy']);router[_0x7721('0x22')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller[_0x7721('0x23')]);router[_0x7721('0x22')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x24')]);router[_0x7721('0x22')]('/:id/users',auth[_0x7721('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 2772c14..f08c881 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 _0xb3e1=['mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','ENUM','twilio','skebby','clicksend','plivo','bandwidth','csc','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue'];(function(_0x978b95,_0x18c01c){var _0x17d68b=function(_0x3ece78){while(--_0x3ece78){_0x978b95['push'](_0x978b95['shift']());}};_0x17d68b(++_0x18c01c);}(_0xb3e1,0x151));var _0x1b3e=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0xb3e1[_0x602ca8];return _0x26e8ab;};'use strict';var Sequelize=require(_0x1b3e('0x0'));var rs=require(_0x1b3e('0x1'));module[_0x1b3e('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x1b3e('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x1b3e('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x1b3e('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x1b3e('0x4')],'defaultValue':function(){return rs[_0x1b3e('0x5')]();}},'phone':{'type':Sequelize[_0x1b3e('0x4')]},'type':{'type':Sequelize[_0x1b3e('0x6')](_0x1b3e('0x7'),_0x1b3e('0x8'),'connectel',_0x1b3e('0x9'),_0x1b3e('0xa'),'clickatell',_0x1b3e('0xb'),_0x1b3e('0xc'),_0x1b3e('0xd'),_0x1b3e('0xe'))},'accountSid':{'type':Sequelize[_0x1b3e('0x4')]},'authId':{'type':Sequelize[_0x1b3e('0x4')]},'authToken':{'type':Sequelize[_0x1b3e('0x4')]},'smsMethod':{'type':Sequelize[_0x1b3e('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x1b3e('0x4')]},'password':{'type':Sequelize[_0x1b3e('0x4')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x1b3e('0x4')]},'senderString':{'type':Sequelize[_0x1b3e('0x4')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x1b3e('0x4')]},'notificationTemplate':{'type':Sequelize[_0x1b3e('0xf')],'defaultValue':function(){return _0x1b3e('0x10');}},'notificationSound':{'type':Sequelize[_0x1b3e('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1b3e('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1b3e('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1b3e('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1b3e('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1b3e('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x1b3e('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1b3e('0x12')],'comment':_0x1b3e('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x1b3e('0x11')],'defaultValue':![],'comment':_0x1b3e('0x14'),'set':function(_0x366400){if(!_0x366400)this['setDataValue'](_0x1b3e('0x15'),null);this[_0x1b3e('0x16')](_0x1b3e('0x17'),_0x366400);}}}; \ No newline at end of file +var _0x7891=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','twilio','clicksend','plivo','clickatell','bandwidth','csc','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'];(function(_0x5eb36a,_0x57a984){var _0x25605c=function(_0x52a5b2){while(--_0x52a5b2){_0x5eb36a['push'](_0x5eb36a['shift']());}};_0x25605c(++_0x57a984);}(_0x7891,0xca));var _0x1789=function(_0x51e772,_0x495c25){_0x51e772=_0x51e772-0x0;var _0x49fa1f=_0x7891[_0x51e772];return _0x49fa1f;};'use strict';var Sequelize=require(_0x1789('0x0'));var rs=require(_0x1789('0x1'));module['exports']={'name':{'type':Sequelize[_0x1789('0x2')],'unique':_0x1789('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x1789('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x1789('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x1789('0x2')]},'type':{'type':Sequelize['ENUM'](_0x1789('0x4'),'skebby','connectel',_0x1789('0x5'),_0x1789('0x6'),_0x1789('0x7'),_0x1789('0x8'),_0x1789('0x9'),'infobip',_0x1789('0xa'))},'accountSid':{'type':Sequelize[_0x1789('0x2')]},'authId':{'type':Sequelize[_0x1789('0x2')]},'authToken':{'type':Sequelize[_0x1789('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x1789('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x1789('0x2')]},'senderString':{'type':Sequelize[_0x1789('0x2')]},'deliveryReport':{'type':Sequelize[_0x1789('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0x1789('0x2')]},'notificationTemplate':{'type':Sequelize[_0x1789('0xc')],'defaultValue':function(){return _0x1789('0xd');}},'notificationSound':{'type':Sequelize[_0x1789('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1789('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1789('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1789('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1789('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1789('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1789('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x1789('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1789('0xe')],'comment':_0x1789('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1789('0x10'),'set':function(_0x48ca6a){if(!_0x48ca6a)this[_0x1789('0x11')](_0x1789('0x12'),null);this[_0x1789('0x11')](_0x1789('0x13'),_0x48ca6a);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 2e5e0e4..2b463bc 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 _0x87e8=['create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','sms','Applications','account','applications','orderBy','asc','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','mobile','type','from','From','Body','messageId','MessageSid','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','results','csc','originatingAddress','segmentedMessage','clickatell','bandwidth','refid','isNil','Sequelize','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','omit','contact','spread','interaction','created','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','receiveMessage','info','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','sequelize','transaction','Transaction','SmsApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getInteractions','SmsInteraction','Owner','fullname','Tag','Tags','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','ListId','Messages','dataValues','inspect','skebby','skebby_dispatch_id','statusInt','status_code','infobip','groupName','DELIVERED','intelepeer','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','zip-dir','request-promise','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','http','request','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','show','options','find'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x87e8,0x171));var _0x887e=function(_0x8ab643,_0x1876fd){_0x8ab643=_0x8ab643-0x0;var _0x208493=_0x87e8[_0x8ab643];return _0x208493;};'use strict';var emlformat=require(_0x887e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x887e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x887e('0x2'));var moment=require('moment');var BPromise=require(_0x887e('0x3'));var Mustache=require(_0x887e('0x4'));var util=require('util');var path=require('path');var sox=require(_0x887e('0x5'));var csv=require('to-csv');var ejs=require(_0x887e('0x6'));var fs=require('fs');var fs_extra=require(_0x887e('0x7'));var _=require(_0x887e('0x8'));var squel=require(_0x887e('0x9'));var crypto=require(_0x887e('0xa'));var jsforce=require(_0x887e('0xb'));var deskjs=require(_0x887e('0xc'));var toCsv=require(_0x887e('0xd'));var querystring=require(_0x887e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x887e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x887e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x887e('0x11'))(_0x887e('0x12'));var utils=require(_0x887e('0x13'));var config=require(_0x887e('0x14'));var licenseUtil=require(_0x887e('0x15'));var db=require('../../mysqldb')['db'];config[_0x887e('0x16')]=_[_0x887e('0x17')](config[_0x887e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x887e('0x18'))(new Redis(config[_0x887e('0x16')]));require('./smsAccount.socket')[_0x887e('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x887e('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x5188b2,_0x42f9a7,_0x5710dd,_0x298d5e){return new BPromise(function(_0x29cf5a,_0x111f26){var _0x41c174=_0x298d5e||client;return _0x41c174[_0x887e('0x1b')](_0x5188b2,_0x5710dd)['then'](function(_0x7eb47d){logger['info'](_0x887e('0x1c'),_0x42f9a7,_0x887e('0x1d'));logger[_0x887e('0x1e')](_0x887e('0x1f'),_0x42f9a7,_0x887e('0x1d'),JSON[_0x887e('0x20')](_0x7eb47d));if(_0x7eb47d['error']){if(_0x7eb47d[_0x887e('0x21')][_0x887e('0x22')]===0x1f4){logger[_0x887e('0x21')](_0x887e('0x1c'),_0x42f9a7,_0x7eb47d[_0x887e('0x21')][_0x887e('0x23')]);return _0x111f26(_0x7eb47d[_0x887e('0x21')][_0x887e('0x23')]);}logger[_0x887e('0x21')]('SmsAccount,\x20%s,\x20%s',_0x42f9a7,_0x7eb47d['error'][_0x887e('0x23')]);return _0x29cf5a(_0x7eb47d[_0x887e('0x21')][_0x887e('0x23')]);}else{logger['info'](_0x887e('0x1c'),_0x42f9a7,_0x887e('0x1d'));_0x29cf5a(_0x7eb47d[_0x887e('0x24')][_0x887e('0x23')]);}})[_0x887e('0x25')](function(_0x155f92){logger[_0x887e('0x21')]('SmsAccount,\x20%s,\x20%s',_0x42f9a7,_0x155f92);_0x111f26(_0x155f92);});});}function respondWithStatusCode(_0x149cca,_0xc979b7){_0xc979b7=_0xc979b7||0xcc;return function(_0x3cf533){if(_0x3cf533){return _0x149cca[_0x887e('0x26')](_0xc979b7);}return _0x149cca['status'](_0xc979b7)['end']();};}function respondWithResult(_0x19bd79,_0x30d536){_0x30d536=_0x30d536||0xc8;return function(_0x2fb625){if(_0x2fb625){return _0x19bd79[_0x887e('0x27')](_0x30d536)[_0x887e('0x28')](_0x2fb625);}};}function respondWithFilteredResult(_0x4705ff,_0x449910){return function(_0x9dbd82){if(_0x9dbd82){var _0x547b9a=typeof _0x449910[_0x887e('0x29')]===_0x887e('0x2a')&&typeof _0x449910[_0x887e('0x2b')]===_0x887e('0x2a');var _0x1df335=_0x9dbd82[_0x887e('0x2c')];var _0x587199=_0x547b9a?0x0:_0x449910[_0x887e('0x29')];var _0x31d9d3=_0x547b9a?_0x9dbd82[_0x887e('0x2c')]:_0x449910['offset']+_0x449910['limit'];var _0xda9be3;if(_0x31d9d3>=_0x1df335){_0x31d9d3=_0x1df335;_0xda9be3=0xc8;}else{_0xda9be3=0xce;}_0x4705ff[_0x887e('0x27')](_0xda9be3);return _0x4705ff[_0x887e('0x2d')](_0x887e('0x2e'),_0x587199+'-'+_0x31d9d3+'/'+_0x1df335)[_0x887e('0x28')](_0x9dbd82);}return null;};}function patchUpdates(_0x38b71f){return function(_0x5f38ef){try{jsonpatch[_0x887e('0x2f')](_0x5f38ef,_0x38b71f,!![]);}catch(_0x48c956){return BPromise[_0x887e('0x30')](_0x48c956);}return _0x5f38ef[_0x887e('0x31')]();};}function saveUpdates(_0x544490,_0x246815){return function(_0x58cb24){if(_0x58cb24){return _0x58cb24[_0x887e('0x32')](_0x544490)[_0x887e('0x33')](function(_0x5f49ef){return _0x5f49ef;});}return null;};}function removeEntity(_0x2254a7,_0x1f38c9){return function(_0x20b21e){if(_0x20b21e){return _0x20b21e[_0x887e('0x34')]()[_0x887e('0x33')](function(){var _0x49076a=_0x20b21e[_0x887e('0x35')]({'plain':!![]});var _0x2abca8=_0x887e('0x36');return db[_0x887e('0x37')][_0x887e('0x34')]({'where':{'type':_0x2abca8,'resourceId':_0x49076a['id']}})[_0x887e('0x33')](function(){return _0x20b21e;});})[_0x887e('0x33')](function(){_0x2254a7[_0x887e('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f009e,_0x737e51){return function(_0x22fa10){if(!_0x22fa10){_0x4f009e[_0x887e('0x26')](0x194);}return _0x22fa10;};}function handleError(_0x116b10,_0x435ca7){_0x435ca7=_0x435ca7||0x1f4;return function(_0x5d79e9){logger[_0x887e('0x21')](_0x5d79e9[_0x887e('0x38')]);if(_0x5d79e9[_0x887e('0x39')]){delete _0x5d79e9[_0x887e('0x39')];}_0x116b10[_0x887e('0x27')](_0x435ca7)[_0x887e('0x3a')](_0x5d79e9);};}exports[_0x887e('0x3b')]=function(_0x54e41f,_0x1c3f3d){var _0x4b848d={'include':[{'model':db[_0x887e('0x3c')],'as':_0x887e('0x3d')}]},_0x3bd9f1={},_0x241d65={'count':0x0,'rows':[]};var _0x5e733d=_[_0x887e('0x3e')](db[_0x887e('0x3f')][_0x887e('0x40')],function(_0x249f00){return{'name':_0x249f00[_0x887e('0x41')],'type':_0x249f00['type']['key']};});_0x3bd9f1['model']=_[_0x887e('0x3e')](_0x5e733d,'name');_0x3bd9f1[_0x887e('0x42')]=_[_0x887e('0x43')](_0x54e41f[_0x887e('0x42')]);_0x3bd9f1['filters']=_[_0x887e('0x44')](_0x3bd9f1['model'],_0x3bd9f1['query']);_0x4b848d[_0x887e('0x45')]=_[_0x887e('0x44')](_0x3bd9f1[_0x887e('0x46')],qs[_0x887e('0x47')](_0x54e41f[_0x887e('0x42')][_0x887e('0x47')]));_0x4b848d['attributes']=_0x4b848d[_0x887e('0x45')][_0x887e('0x48')]?_0x4b848d['attributes']:_0x3bd9f1['model'];if(!_0x54e41f[_0x887e('0x42')][_0x887e('0x49')](_0x887e('0x4a'))){_0x4b848d[_0x887e('0x2b')]=qs[_0x887e('0x2b')](_0x54e41f[_0x887e('0x42')][_0x887e('0x2b')]);_0x4b848d[_0x887e('0x29')]=qs['offset'](_0x54e41f[_0x887e('0x42')][_0x887e('0x29')]);}_0x4b848d[_0x887e('0x4b')]=qs[_0x887e('0x4c')](_0x54e41f[_0x887e('0x42')][_0x887e('0x4c')]);_0x4b848d[_0x887e('0x4d')]=qs[_0x887e('0x4e')](_[_0x887e('0x4f')](_0x54e41f[_0x887e('0x42')],_0x3bd9f1[_0x887e('0x4e')]),_0x5e733d);if(_0x54e41f[_0x887e('0x42')][_0x887e('0x50')]){_0x4b848d['where']=_[_0x887e('0x51')](_0x4b848d[_0x887e('0x4d')],{'$or':_[_0x887e('0x3e')](_0x5e733d,function(_0x5bfc76){if(_0x5bfc76['type']!=='VIRTUAL'){var _0x23b5f3={};_0x23b5f3[_0x5bfc76[_0x887e('0x39')]]={'$like':'%'+_0x54e41f[_0x887e('0x42')]['filter']+'%'};return _0x23b5f3;}})});}_0x4b848d=_[_0x887e('0x51')]({},_0x4b848d,_0x54e41f['options']);var _0x223f0f={'where':_0x4b848d[_0x887e('0x4d')]};return db[_0x887e('0x3f')]['count'](_0x223f0f)['then'](function(_0x3e90f6){_0x241d65['count']=_0x3e90f6;if(_0x54e41f[_0x887e('0x42')][_0x887e('0x52')]){_0x4b848d[_0x887e('0x53')]=[{'all':!![]}];}return db[_0x887e('0x3f')][_0x887e('0x54')](_0x4b848d);})[_0x887e('0x33')](function(_0x32a5df){_0x241d65[_0x887e('0x55')]=_0x32a5df;return _0x241d65;})[_0x887e('0x33')](respondWithFilteredResult(_0x1c3f3d,_0x4b848d))[_0x887e('0x25')](handleError(_0x1c3f3d,null));};exports[_0x887e('0x56')]=function(_0x1f6f91,_0x4a153a){var _0x8cae6e={'raw':![],'where':{'id':_0x1f6f91['params']['id']},'include':[{'model':db[_0x887e('0x3c')],'as':_0x887e('0x3d')}]},_0x210287={};_0x210287['model']=_[_0x887e('0x43')](db[_0x887e('0x3f')]['rawAttributes']);_0x210287[_0x887e('0x42')]=_[_0x887e('0x43')](_0x1f6f91[_0x887e('0x42')]);_0x210287[_0x887e('0x4e')]=_['intersection'](_0x210287[_0x887e('0x46')],_0x210287['query']);_0x8cae6e[_0x887e('0x45')]=_[_0x887e('0x44')](_0x210287[_0x887e('0x46')],qs[_0x887e('0x47')](_0x1f6f91['query']['fields']));_0x8cae6e['attributes']=_0x8cae6e[_0x887e('0x45')][_0x887e('0x48')]?_0x8cae6e['attributes']:_0x210287[_0x887e('0x46')];if(_0x1f6f91[_0x887e('0x42')]['includeAll']){_0x8cae6e[_0x887e('0x53')]=[{'all':!![]}];}_0x8cae6e=_[_0x887e('0x51')]({},_0x8cae6e,_0x1f6f91[_0x887e('0x57')]);return db[_0x887e('0x3f')][_0x887e('0x58')](_0x8cae6e)['then'](handleEntityNotFound(_0x4a153a,null))[_0x887e('0x33')](respondWithResult(_0x4a153a,null))['catch'](handleError(_0x4a153a,null));};exports[_0x887e('0x59')]=function(_0x317bb7,_0x176b1c){return db['SmsAccount'][_0x887e('0x59')](_0x317bb7[_0x887e('0x5a')],{})[_0x887e('0x33')](function(_0x4ae682){var _0x3ee288=_0x317bb7['user'][_0x887e('0x35')]({'plain':!![]});if(!_0x3ee288)throw new Error(_0x887e('0x5b'));if(_0x3ee288[_0x887e('0x5c')]===_0x887e('0x5d')){var _0x218af8=_0x4ae682['get']({'plain':!![]});var _0x3760bc=_0x887e('0x36');return db[_0x887e('0x5e')][_0x887e('0x58')]({'where':{'name':_0x3760bc,'userProfileId':_0x3ee288[_0x887e('0x5f')]},'raw':!![]})[_0x887e('0x33')](function(_0x55ff2b){if(_0x55ff2b&&_0x55ff2b[_0x887e('0x60')]===0x0){return db[_0x887e('0x37')][_0x887e('0x59')]({'name':_0x218af8[_0x887e('0x39')],'resourceId':_0x218af8['id'],'type':_0x55ff2b['name'],'sectionId':_0x55ff2b['id']},{})[_0x887e('0x33')](function(){return _0x4ae682;});}else{return _0x4ae682;}})[_0x887e('0x25')](function(_0x323fdc){logger['error'](_0x887e('0x61'),_0x323fdc);throw _0x323fdc;});}return _0x4ae682;})['then'](respondWithResult(_0x176b1c,0xc9))[_0x887e('0x25')](handleError(_0x176b1c,null));};exports['update']=function(_0x4634d5,_0x5c5cb1){if(_0x4634d5[_0x887e('0x5a')]['id']){delete _0x4634d5['body']['id'];}return db[_0x887e('0x3f')]['find']({'where':{'id':_0x4634d5[_0x887e('0x62')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x887e('0x33')](handleEntityNotFound(_0x5c5cb1,null))['then'](saveUpdates(_0x4634d5[_0x887e('0x5a')],null))[_0x887e('0x33')](respondWithResult(_0x5c5cb1,null))[_0x887e('0x25')](handleError(_0x5c5cb1,null));};exports[_0x887e('0x34')]=function(_0x28949e,_0x221581){return db[_0x887e('0x3f')][_0x887e('0x58')]({'where':{'id':_0x28949e[_0x887e('0x62')]['id']}})[_0x887e('0x33')](handleEntityNotFound(_0x221581,null))[_0x887e('0x33')](removeEntity(_0x221581,null))[_0x887e('0x25')](handleError(_0x221581,null));};exports[_0x887e('0x63')]=function(_0x97f9e2,_0x4ff75){return db[_0x887e('0x3f')][_0x887e('0x63')]()['then'](respondWithResult(_0x4ff75,null))['catch'](handleError(_0x4ff75,null));};exports[_0x887e('0x64')]=function(_0x41bbd5,_0x1a5488,_0x193d18){if(_0x41bbd5[_0x887e('0x5a')]['id']){delete _0x41bbd5[_0x887e('0x5a')]['id'];}return db[_0x887e('0x3f')][_0x887e('0x58')]({'where':{'id':_0x41bbd5[_0x887e('0x62')]['id']}})[_0x887e('0x33')](handleEntityNotFound(_0x1a5488,null))['then'](function(_0x40a869){if(_0x40a869){_0x41bbd5['body'][_0x887e('0x65')]=_0x40a869['id'];return db[_0x887e('0x66')]['create'](_0x41bbd5[_0x887e('0x5a')]);}})[_0x887e('0x33')](respondWithResult(_0x1a5488,null))[_0x887e('0x25')](handleError(_0x1a5488,null));};exports[_0x887e('0x67')]=function(_0x13f78c,_0x4f5b9d,_0x323d70){var _0x19c2b8={'raw':![],'where':{}};var _0x294f9e={};var _0x47d5c7={'count':0x0,'rows':[]};return db['SmsAccount'][_0x887e('0x68')]({'where':{'id':_0x13f78c[_0x887e('0x62')]['id']}})[_0x887e('0x33')](handleEntityNotFound(_0x4f5b9d,null))[_0x887e('0x33')](function(_0x17c22d){if(_0x17c22d){_0x294f9e[_0x887e('0x46')]=_[_0x887e('0x43')](db['Disposition'][_0x887e('0x40')]);_0x294f9e[_0x887e('0x42')]=_['keys'](_0x13f78c[_0x887e('0x42')]);_0x294f9e[_0x887e('0x4e')]=_[_0x887e('0x44')](_0x294f9e['model'],_0x294f9e[_0x887e('0x42')]);_0x19c2b8[_0x887e('0x45')]=_[_0x887e('0x44')](_0x294f9e[_0x887e('0x46')],qs[_0x887e('0x47')](_0x13f78c['query'][_0x887e('0x47')]));_0x19c2b8[_0x887e('0x45')]=_0x19c2b8[_0x887e('0x45')][_0x887e('0x48')]?_0x19c2b8['attributes']:_0x294f9e[_0x887e('0x46')];if(!_0x13f78c['query']['hasOwnProperty'](_0x887e('0x4a'))){_0x19c2b8['limit']=qs[_0x887e('0x2b')](_0x13f78c['query'][_0x887e('0x2b')]);_0x19c2b8['offset']=qs['offset'](_0x13f78c[_0x887e('0x42')]['offset']);}_0x19c2b8['order']=qs[_0x887e('0x4c')](_0x13f78c[_0x887e('0x42')]['sort']);_0x19c2b8['where']=qs[_0x887e('0x4e')](_['pick'](_0x13f78c[_0x887e('0x42')],_0x294f9e[_0x887e('0x4e')]));_0x19c2b8[_0x887e('0x4d')]['SmsAccountId']=_0x17c22d['id'];if(_0x13f78c[_0x887e('0x42')][_0x887e('0x50')]){_0x19c2b8[_0x887e('0x4d')]=_[_0x887e('0x51')](_0x19c2b8['where'],{'$or':_[_0x887e('0x3e')](_0x19c2b8['attributes'],function(_0x4ca098){var _0x240192={};_0x240192[_0x4ca098]={'$like':'%'+_0x13f78c[_0x887e('0x42')]['filter']+'%'};return _0x240192;})});}_0x19c2b8=_[_0x887e('0x51')]({},_0x19c2b8,_0x13f78c[_0x887e('0x57')]);return db[_0x887e('0x66')][_0x887e('0x2c')]({'where':_0x19c2b8[_0x887e('0x4d')]})[_0x887e('0x33')](function(_0x4014b7){_0x47d5c7['count']=_0x4014b7;if(_0x13f78c['query']['includeAll']){_0x19c2b8[_0x887e('0x53')]=[{'all':!![]}];}return db['Disposition'][_0x887e('0x54')](_0x19c2b8);})[_0x887e('0x33')](function(_0x4e5156){_0x47d5c7['rows']=_0x4e5156;return _0x47d5c7;});}})['then'](respondWithFilteredResult(_0x4f5b9d,_0x19c2b8))['catch'](handleError(_0x4f5b9d,null));};exports['removeDispositions']=function(_0x33f88b,_0x12d1e7,_0x355df4){return db[_0x887e('0x3f')][_0x887e('0x58')]({'where':{'id':_0x33f88b[_0x887e('0x62')]['id']}})[_0x887e('0x33')](handleEntityNotFound(_0x12d1e7,null))[_0x887e('0x33')](function(_0xeb8949){if(_0xeb8949){return _0xeb8949[_0x887e('0x69')](_0x33f88b[_0x887e('0x42')][_0x887e('0x6a')]);}})[_0x887e('0x33')](respondWithStatusCode(_0x12d1e7,null))[_0x887e('0x25')](handleError(_0x12d1e7,null));};exports[_0x887e('0x6b')]=function(_0x7b5f3c,_0x129348,_0x4462d5){if(_0x7b5f3c[_0x887e('0x5a')]['id']){delete _0x7b5f3c[_0x887e('0x5a')]['id'];}return db['SmsAccount'][_0x887e('0x58')]({'where':{'id':_0x7b5f3c[_0x887e('0x62')]['id']}})[_0x887e('0x33')](handleEntityNotFound(_0x129348,null))[_0x887e('0x33')](function(_0x22b79){if(_0x22b79){_0x7b5f3c[_0x887e('0x5a')][_0x887e('0x65')]=_0x22b79['id'];return db[_0x887e('0x6c')][_0x887e('0x59')](_0x7b5f3c[_0x887e('0x5a')]);}})[_0x887e('0x33')](respondWithResult(_0x129348,null))['catch'](handleError(_0x129348,null));};exports[_0x887e('0x6d')]=function(_0x4ba848,_0x105c53,_0x52a72d){var _0x27094d={'raw':![],'where':{}};var _0x10136b={};var _0x1558d8={'count':0x0,'rows':[]};return db[_0x887e('0x3f')][_0x887e('0x68')]({'where':{'id':_0x4ba848[_0x887e('0x62')]['id']}})[_0x887e('0x33')](handleEntityNotFound(_0x105c53,null))[_0x887e('0x33')](function(_0x2d9a8b){if(_0x2d9a8b){_0x10136b[_0x887e('0x46')]=_['keys'](db['CannedAnswer'][_0x887e('0x40')]);_0x10136b[_0x887e('0x42')]=_[_0x887e('0x43')](_0x4ba848['query']);_0x10136b[_0x887e('0x4e')]=_['intersection'](_0x10136b[_0x887e('0x46')],_0x10136b[_0x887e('0x42')]);_0x27094d[_0x887e('0x45')]=_[_0x887e('0x44')](_0x10136b[_0x887e('0x46')],qs[_0x887e('0x47')](_0x4ba848['query'][_0x887e('0x47')]));_0x27094d[_0x887e('0x45')]=_0x27094d[_0x887e('0x45')][_0x887e('0x48')]?_0x27094d[_0x887e('0x45')]:_0x10136b[_0x887e('0x46')];if(!_0x4ba848[_0x887e('0x42')][_0x887e('0x49')](_0x887e('0x4a'))){_0x27094d[_0x887e('0x2b')]=qs[_0x887e('0x2b')](_0x4ba848['query'][_0x887e('0x2b')]);_0x27094d[_0x887e('0x29')]=qs[_0x887e('0x29')](_0x4ba848[_0x887e('0x42')]['offset']);}_0x27094d[_0x887e('0x4b')]=qs[_0x887e('0x4c')](_0x4ba848[_0x887e('0x42')][_0x887e('0x4c')]);_0x27094d[_0x887e('0x4d')]=qs[_0x887e('0x4e')](_[_0x887e('0x4f')](_0x4ba848[_0x887e('0x42')],_0x10136b['filters']));_0x27094d[_0x887e('0x4d')][_0x887e('0x65')]=_0x2d9a8b['id'];if(_0x4ba848[_0x887e('0x42')][_0x887e('0x50')]){_0x27094d[_0x887e('0x4d')]=_['merge'](_0x27094d['where'],{'$or':_['map'](_0x27094d[_0x887e('0x45')],function(_0x4dd286){var _0xa0f101={};_0xa0f101[_0x4dd286]={'$like':'%'+_0x4ba848[_0x887e('0x42')][_0x887e('0x50')]+'%'};return _0xa0f101;})});}_0x27094d=_[_0x887e('0x51')]({},_0x27094d,_0x4ba848[_0x887e('0x57')]);return db['CannedAnswer'][_0x887e('0x2c')]({'where':_0x27094d['where']})[_0x887e('0x33')](function(_0x35244f){_0x1558d8[_0x887e('0x2c')]=_0x35244f;if(_0x4ba848[_0x887e('0x42')]['includeAll']){_0x27094d['include']=[{'all':!![]}];}return db[_0x887e('0x6c')][_0x887e('0x54')](_0x27094d);})['then'](function(_0x34ce3e){_0x1558d8['rows']=_0x34ce3e;return _0x1558d8;});}})[_0x887e('0x33')](respondWithFilteredResult(_0x105c53,_0x27094d))['catch'](handleError(_0x105c53,null));};exports[_0x887e('0x6e')]=function(_0x336412,_0x42b4e8,_0x434fdb){return db[_0x887e('0x3f')][_0x887e('0x58')]({'where':{'id':_0x336412[_0x887e('0x62')]['id']}})['then'](handleEntityNotFound(_0x42b4e8,null))[_0x887e('0x33')](function(_0x2ac995){if(_0x2ac995){return _0x2ac995[_0x887e('0x6e')](_0x336412[_0x887e('0x42')][_0x887e('0x6a')]);}})['then'](respondWithStatusCode(_0x42b4e8,null))[_0x887e('0x25')](handleError(_0x42b4e8,null));};exports['notify']=function(_0x309cc9,_0x4080b2,_0x180d1b){var _0x1b44a6={'channel':_0x887e('0x6f')};var _0x26f89e=[];var _0x46f618=[];var _0x1d7e19={};return db[_0x887e('0x3f')][_0x887e('0x58')]({'where':{'id':_0x309cc9[_0x887e('0x62')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x887e('0x70')}]})[_0x887e('0x33')](handleEntityNotFound(_0x4080b2,null))[_0x887e('0x33')](function(_0x1dcd66){_0x1b44a6[_0x887e('0x71')]=_0x1dcd66;_0x1b44a6[_0x887e('0x72')]=_[_0x887e('0x73')](_0x1dcd66[_0x887e('0x70')],['priority'],[_0x887e('0x74')]);if(_0x1b44a6[_0x887e('0x71')][_0x887e('0x70')]){delete _0x1b44a6[_0x887e('0x71')][_0x887e('0x70')];}return db[_0x887e('0x75')]['describe']();})['then'](function(_0x427d83){if(!_0x427d83){throw new db['Sequelize'][(_0x887e('0x76'))](_0x887e('0x77'));}_0x26f89e=_['difference'](_[_0x887e('0x43')](_0x427d83),[_0x887e('0x78'),_0x887e('0x79')]);_0x46f618=_[_0x887e('0x7a')](_[_0x887e('0x43')](_0x427d83),[_0x887e('0x78'),_0x887e('0x79'),_0x887e('0x7b'),'ListId']);_0x1b44a6[_0x887e('0x5a')]={'mapKey':_0x887e('0x7c')};if(_0x1b44a6[_0x887e('0x71')]['type']){switch(_0x1b44a6[_0x887e('0x71')][_0x887e('0x7d')]){case'twilio':_0x1b44a6[_0x887e('0x5a')][_0x887e('0x7e')]=_0x309cc9[_0x887e('0x5a')][_0x887e('0x7f')];_0x1b44a6[_0x887e('0x5a')][_0x887e('0x5a')]=_0x309cc9['body'][_0x887e('0x80')];_0x1b44a6[_0x887e('0x5a')][_0x887e('0x81')]=_0x309cc9[_0x887e('0x5a')][_0x887e('0x82')];break;case'skebby':_0x1b44a6[_0x887e('0x5a')][_0x887e('0x7e')]='+'+_0x309cc9[_0x887e('0x5a')][_0x887e('0x83')];_0x1b44a6[_0x887e('0x5a')]['body']=_0x309cc9[_0x887e('0x5a')][_0x887e('0x84')];break;case _0x887e('0x85'):_0x1b44a6[_0x887e('0x5a')][_0x887e('0x7e')]=_0x309cc9[_0x887e('0x5a')][_0x887e('0x7e')];_0x1b44a6[_0x887e('0x5a')][_0x887e('0x5a')]=_0x309cc9[_0x887e('0x5a')][_0x887e('0x23')];break;case _0x887e('0x86'):_0x1b44a6[_0x887e('0x5a')]['from']=_0x309cc9[_0x887e('0x5a')][_0x887e('0x7e')];_0x1b44a6[_0x887e('0x5a')][_0x887e('0x5a')]=_0x309cc9[_0x887e('0x5a')][_0x887e('0x5a')];_0x1b44a6[_0x887e('0x5a')][_0x887e('0x81')]=_0x309cc9[_0x887e('0x5a')][_0x887e('0x87')];break;case _0x887e('0x88'):_0x1b44a6[_0x887e('0x5a')][_0x887e('0x7e')]=_0x309cc9[_0x887e('0x5a')]['From'];_0x1b44a6[_0x887e('0x5a')][_0x887e('0x5a')]=_0x309cc9[_0x887e('0x5a')][_0x887e('0x89')];_0x1b44a6[_0x887e('0x5a')][_0x887e('0x81')]=_0x309cc9['body'][_0x887e('0x8a')];break;case'infobip':_0x1b44a6[_0x887e('0x5a')][_0x887e('0x7e')]='+'+_0x309cc9[_0x887e('0x5a')][_0x887e('0x8b')][0x0][_0x887e('0x7e')];_0x1b44a6[_0x887e('0x5a')][_0x887e('0x5a')]=_0x309cc9[_0x887e('0x5a')][_0x887e('0x8b')][0x0]['text'];_0x1b44a6['body'][_0x887e('0x81')]=_0x309cc9['body'][_0x887e('0x8b')][0x0]['messageId'];break;case _0x887e('0x8c'):_0x1b44a6[_0x887e('0x5a')]['from']=_0x309cc9[_0x887e('0x5a')][_0x887e('0x8d')];_0x1b44a6[_0x887e('0x5a')][_0x887e('0x5a')]=_0x309cc9[_0x887e('0x5a')][_0x887e('0x8e')][_0x887e('0x23')];break;case _0x887e('0x8f'):_0x1b44a6[_0x887e('0x5a')][_0x887e('0x7e')]=_0x309cc9[_0x887e('0x5a')]['fromNumber'];_0x1b44a6[_0x887e('0x5a')][_0x887e('0x5a')]=_0x309cc9[_0x887e('0x5a')]['text'];_0x1b44a6[_0x887e('0x5a')][_0x887e('0x81')]=_0x309cc9[_0x887e('0x5a')]['replyMessageId'];break;case _0x887e('0x90'):_0x1b44a6[_0x887e('0x5a')][_0x887e('0x81')]=_0x309cc9[_0x887e('0x5a')][0x0]['message']['id'];_0x1b44a6[_0x887e('0x5a')][_0x887e('0x7e')]=_0x309cc9[_0x887e('0x5a')][0x0][_0x887e('0x23')]['from'];_0x1b44a6[_0x887e('0x5a')][_0x887e('0x5a')]=_0x309cc9[_0x887e('0x5a')][0x0]['message'][_0x887e('0x84')];break;case'intelepeer':_0x1b44a6[_0x887e('0x5a')]['from']=_0x309cc9['body']['from'];_0x1b44a6[_0x887e('0x5a')][_0x887e('0x5a')]=_0x309cc9['body']['message'];_0x1b44a6[_0x887e('0x5a')]['messageId']=_0x309cc9[_0x887e('0x5a')][_0x887e('0x91')];break;}}if(_0x1b44a6[_0x887e('0x5a')]['id']){delete _0x1b44a6['body']['id'];}if(_[_0x887e('0x92')](_0x1b44a6['body'][_0x887e('0x7e')])){throw new db[(_0x887e('0x93'))][(_0x887e('0x76'))](_0x887e('0x94'));}if(_['isNil'](_0x1b44a6[_0x887e('0x5a')][_0x887e('0x5a')])||_0x1b44a6[_0x887e('0x5a')][_0x887e('0x5a')]===''){throw new db[(_0x887e('0x93'))][(_0x887e('0x76'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x887e('0x92')](_0x1b44a6['body'][_0x887e('0x95')])){throw new db[(_0x887e('0x93'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x46f618);}if(!_[_0x887e('0x96')](_0x46f618,_0x1b44a6[_0x887e('0x5a')][_0x887e('0x95')])){throw new db['Sequelize'][(_0x887e('0x76'))](_0x887e('0x97')+_0x46f618);}_0x1d7e19[_0x1b44a6[_0x887e('0x5a')][_0x887e('0x95')]]=_0x1b44a6[_0x887e('0x5a')]['from'];return db['CmList']['find']({'where':{'id':_0x1b44a6['account']['ListId']},'include':[{'model':db[_0x887e('0x75')],'as':_0x887e('0x98'),'where':_0x1d7e19,'limit':0x1,'order':[[_0x887e('0x79'),_0x887e('0x99')]]}]});})[_0x887e('0x33')](handleEntityNotFound(_0x4080b2,null))[_0x887e('0x33')](function(_0x316446){if(_0x316446){_0x1b44a6[_0x887e('0x9a')]=_[_0x887e('0x9b')](_0x316446,[_0x887e('0x98')]);if(_0x316446[_0x887e('0x98')][_0x887e('0x48')]){return _0x316446[_0x887e('0x98')][0x0];}var _0x2b3cc8=_['defaults'](_0x1b44a6['body'],{'firstName':_0x1b44a6[_0x887e('0x5a')]['from'],'ListId':_0x316446['id']});_0x2b3cc8[_0x1b44a6[_0x887e('0x5a')][_0x887e('0x95')]]=_0x1b44a6[_0x887e('0x5a')][_0x887e('0x7e')];return db[_0x887e('0x75')]['create'](_0x2b3cc8,{'fields':_0x26f89e,'raw':!![]});}})[_0x887e('0x33')](handleEntityNotFound(_0x4080b2,null))[_0x887e('0x33')](function(_0x283ab7){if(_0x283ab7){_0x1b44a6[_0x887e('0x9c')]=_0x283ab7;var _0x35af7a={'ContactId':_0x283ab7['id'],'phone':_0x1b44a6[_0x887e('0x5a')]['from'],'SmsAccountId':_0x309cc9[_0x887e('0x62')]['id']};var _0x7c1713={'ContactId':_0x283ab7['id'],'SmsAccountId':_0x309cc9['params']['id'],'closed':![]};return db['SmsInteraction'][_0x887e('0x58')]({'where':_0x7c1713})[_0x887e('0x33')](function(_0x986eb){if(_0x986eb){return[_0x986eb,![]];}return db['SmsInteraction'][_0x887e('0x59')](_0x35af7a)[_0x887e('0x33')](function(_0x198f10){return[_0x198f10,!![]];});});}})[_0x887e('0x9d')](function(_0x143481,_0x7666e1){_0x1b44a6[_0x887e('0x9e')]=_0x143481[_0x887e('0x35')]({'plain':!![]});_0x1b44a6[_0x887e('0x9e')][_0x887e('0x9f')]=![];if(_0x7666e1){if(_0x1b44a6['account']['autoclose']){_0x1b44a6[_0x887e('0x72')][_0x887e('0xa0')]({'id':0x0,'priority':_0x1b44a6[_0x887e('0x72')][_0x887e('0x48')]+0x1,'app':_0x887e('0xa1'),'appdata':_0x887e('0xa2'),'interval':_0x887e('0xa3')});}_0x1b44a6[_0x887e('0x9e')][_0x887e('0x9f')]=!![];}return db[_0x887e('0xa4')][_0x887e('0x59')]({'phone':_0x1b44a6[_0x887e('0x5a')]['from'],'messageId':_0x1b44a6[_0x887e('0x5a')][_0x887e('0x81')],'body':_0x1b44a6[_0x887e('0x5a')]['body'],'SmsAccountId':_0x309cc9['params']['id'],'SmsInteractionId':_0x143481['id'],'direction':'in','ContactId':_0x143481[_0x887e('0xa5')],'AttachmentId':_0x1b44a6[_0x887e('0x5a')][_0x887e('0xa6')]});})[_0x887e('0x33')](function(_0x22cb85){_0x1b44a6[_0x887e('0x23')]=_0x22cb85;if(_0x1b44a6[_0x887e('0x9e')][_0x887e('0xa7')]){return db[_0x887e('0xa8')][_0x887e('0x58')]({'attributes':['id','name'],'where':{'id':_0x1b44a6[_0x887e('0x9e')]['UserId']}})[_0x887e('0x33')](function(_0x28f45e){if(_0x28f45e){_0x1b44a6[_0x887e('0x72')]['unshift']({'id':0x0,'priority':0x0,'app':_0x887e('0xa9'),'appdata':_0x28f45e[_0x887e('0x39')]+','+(_0x1b44a6[_0x887e('0x71')][_0x887e('0xaa')]||0xa),'interval':_0x887e('0xa3')});}return respondWithRpcPromise(_0x887e('0xab'),'startRouting',_0x1b44a6);});}return respondWithRpcPromise(_0x887e('0xab'),'startRouting',_0x1b44a6);})['then'](function(_0x407603){if(_0x407603){var _0x2302b8=0xc8;var _0xf5f74f=_0x887e('0xac');logger[_0x887e('0xad')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf5f74f,_0x2302b8,_0x887e('0xae'));logger['debug'](_0x887e('0xaf'),_0xf5f74f,_0x2302b8,'entity\x20found',JSON[_0x887e('0x20')](_0x407603));if(_0x1b44a6[_0x887e('0x71')][_0x887e('0x7d')]===_0x887e('0xb0')){return _0x4080b2['status'](_0x2302b8)[_0x887e('0x2d')](_0x887e('0xb1'),_0x887e('0xb2'))['send'](_0x887e('0xb3'));}else{return _0x4080b2['status'](_0x2302b8)[_0x887e('0x28')](_0x407603);}}})[_0x887e('0x25')](handleError(_0x4080b2,null));};exports['addApplications']=function(_0x4e319c,_0x3c8006){var _0x2b2f6d=_0x4e319c[_0x887e('0x62')]['id'];var _0x5ca3e4=_0x4e319c[_0x887e('0x5a')];var _0x220fbc=0xc8;var _0xb761d8=null;return db[_0x887e('0xb4')][_0x887e('0xb5')]({'isolationLevel':db['sequelize'][_0x887e('0xb6')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0xa9694f){return db[_0x887e('0x3f')][_0x887e('0x68')]({'where':{'id':_0x2b2f6d},'transaction':_0xa9694f})[_0x887e('0x33')](function(_0x9aa750){if(_0x9aa750){return db[_0x887e('0xb7')]['destroy']({'where':{'SmsAccountId':_0x2b2f6d},'transaction':_0xa9694f})[_0x887e('0x33')](function(){var _0x3c5b8c=_[_0x887e('0x3e')](_0x5ca3e4,function(_0x195929){_0x195929['SmsAccountId']=_0x2b2f6d;return _0x195929;});return db[_0x887e('0xb7')][_0x887e('0xb8')](_0x3c5b8c,{'transaction':_0xa9694f});});}else{_0x220fbc=0x194;_0xb761d8=[];}});})[_0x887e('0x33')](function(){if(_0x220fbc!==0x194){return db[_0x887e('0xb7')][_0x887e('0xb9')]({'where':{'SmsAccountId':_0x2b2f6d},'order':_0x887e('0xba')})[_0x887e('0x33')](function(_0x2ed5e1){_0xb761d8=_0x2ed5e1;});}})[_0x887e('0x25')](function(_0x5ca50e){_0x220fbc=0x1f4;logger['error'](_0x5ca50e[_0x887e('0x38')]);if(_0x5ca50e[_0x887e('0x39')]){delete _0x5ca50e['name'];}_0xb761d8=_0x5ca50e;})[_0x887e('0xbb')](function(){if(_0xb761d8===null){_0x3c8006[_0x887e('0x26')](_0x220fbc);}else{if(_0x220fbc===0x1f4){_0x3c8006[_0x887e('0x27')](_0x220fbc)[_0x887e('0x3a')](_0xb761d8);}else{_0x3c8006[_0x887e('0x27')](_0x220fbc)[_0x887e('0x28')](_0xb761d8);}}});};exports[_0x887e('0xbc')]=function(_0x41d8f9,_0x310b17,_0x4501d3){var _0x179f3f={};var _0x47b700={};var _0xaf7750;var _0x296439;return db[_0x887e('0x3f')][_0x887e('0x68')]({'where':{'id':_0x41d8f9[_0x887e('0x62')]['id']}})[_0x887e('0x33')](handleEntityNotFound(_0x310b17,null))[_0x887e('0x33')](function(_0x52a28d){if(_0x52a28d){_0xaf7750=_0x52a28d;_0x47b700[_0x887e('0x46')]=_[_0x887e('0x43')](db[_0x887e('0xb7')][_0x887e('0x40')]);_0x47b700[_0x887e('0x42')]=_[_0x887e('0x43')](_0x41d8f9[_0x887e('0x42')]);_0x47b700[_0x887e('0x4e')]=_[_0x887e('0x44')](_0x47b700[_0x887e('0x46')],_0x47b700[_0x887e('0x42')]);_0x179f3f['attributes']=_[_0x887e('0x44')](_0x47b700[_0x887e('0x46')],qs[_0x887e('0x47')](_0x41d8f9['query']['fields']));_0x179f3f[_0x887e('0x45')]=_0x179f3f['attributes'][_0x887e('0x48')]?_0x179f3f[_0x887e('0x45')]:_0x47b700[_0x887e('0x46')];_0x179f3f['order']=qs[_0x887e('0x4c')](_0x41d8f9[_0x887e('0x42')][_0x887e('0x4c')]);_0x179f3f[_0x887e('0x4d')]=qs[_0x887e('0x4e')](_[_0x887e('0x4f')](_0x41d8f9['query'],_0x47b700['filters']));if(_0x41d8f9[_0x887e('0x42')]['filter']){_0x179f3f[_0x887e('0x4d')]=_[_0x887e('0x51')](_0x179f3f['where'],{'$or':_[_0x887e('0x3e')](_0x179f3f[_0x887e('0x45')],function(_0x18b136){var _0x4f1344={};_0x4f1344[_0x18b136]={'$like':'%'+_0x41d8f9[_0x887e('0x42')][_0x887e('0x50')]+'%'};return _0x4f1344;})});}_0x179f3f=_[_0x887e('0x51')]({},_0x179f3f,_0x41d8f9[_0x887e('0x57')]);return _0xaf7750[_0x887e('0xbc')](_0x179f3f);}})[_0x887e('0x33')](function(_0x4b211a){if(_0x4b211a){_0x296439=_0x4b211a['length'];if(!_0x41d8f9[_0x887e('0x42')][_0x887e('0x49')](_0x887e('0x4a'))){_0x179f3f['limit']=qs[_0x887e('0x2b')](_0x41d8f9[_0x887e('0x42')][_0x887e('0x2b')]);_0x179f3f[_0x887e('0x29')]=qs[_0x887e('0x29')](_0x41d8f9[_0x887e('0x42')]['offset']);}return _0xaf7750[_0x887e('0xbc')](_0x179f3f);}})[_0x887e('0x33')](function(_0x5e3c08){if(_0x5e3c08){return _0x5e3c08?{'count':_0x296439,'rows':_0x5e3c08}:null;}})['then'](respondWithResult(_0x310b17,null))[_0x887e('0x25')](handleError(_0x310b17,null));};exports[_0x887e('0xbd')]=function(_0x5cc4a6,_0x1c8411,_0x99ad63){var _0x5ae703={'raw':![],'where':{}};var _0x3a63dd={};var _0x577766={'count':0x0,'rows':[]};return db[_0x887e('0x3f')][_0x887e('0x68')]({'where':{'id':_0x5cc4a6[_0x887e('0x62')]['id']}})['then'](handleEntityNotFound(_0x1c8411,null))[_0x887e('0x33')](function(_0x3cdf5a){if(_0x3cdf5a){_0x3a63dd['model']=_[_0x887e('0x43')](db[_0x887e('0xbe')][_0x887e('0x40')]);_0x3a63dd[_0x887e('0x42')]=_[_0x887e('0x43')](_0x5cc4a6[_0x887e('0x42')]);_0x3a63dd[_0x887e('0x4e')]=_[_0x887e('0x44')](_0x3a63dd[_0x887e('0x46')],_0x3a63dd['query']);_0x5ae703[_0x887e('0x45')]=_[_0x887e('0x44')](_0x3a63dd['model'],qs[_0x887e('0x47')](_0x5cc4a6[_0x887e('0x42')][_0x887e('0x47')]));_0x5ae703['attributes']=_0x5ae703[_0x887e('0x45')][_0x887e('0x48')]?_0x5ae703[_0x887e('0x45')]:_0x3a63dd[_0x887e('0x46')];if(!_0x5cc4a6[_0x887e('0x42')][_0x887e('0x49')](_0x887e('0x4a'))){_0x5ae703[_0x887e('0x2b')]=qs['limit'](_0x5cc4a6[_0x887e('0x42')]['limit']);_0x5ae703[_0x887e('0x29')]=qs[_0x887e('0x29')](_0x5cc4a6[_0x887e('0x42')][_0x887e('0x29')]);}_0x5ae703[_0x887e('0x4b')]=qs[_0x887e('0x4c')](_0x5cc4a6['query'][_0x887e('0x4c')]);_0x5ae703[_0x887e('0x4d')]=qs[_0x887e('0x4e')](_[_0x887e('0x4f')](_0x5cc4a6['query'],_0x3a63dd[_0x887e('0x4e')]));_0x5ae703[_0x887e('0x4d')][_0x887e('0x65')]=_0x3cdf5a['id'];if(_0x5cc4a6['query'][_0x887e('0x50')]){_0x5ae703['where']=_[_0x887e('0x51')](_0x5ae703['where'],{'$or':_[_0x887e('0x3e')](_0x5ae703[_0x887e('0x45')],function(_0x341a79){var _0x3d209b={};_0x3d209b[_0x341a79]={'$like':'%'+_0x5cc4a6[_0x887e('0x42')][_0x887e('0x50')]+'%'};return _0x3d209b;})});}_0x5ae703=_[_0x887e('0x51')]({},_0x5ae703,_0x5cc4a6['options']);return db['SmsInteraction']['count']({'where':_0x5ae703['where']})[_0x887e('0x33')](function(_0x38087f){_0x577766[_0x887e('0x2c')]=_0x38087f;if(_0x5cc4a6[_0x887e('0x42')][_0x887e('0x52')]){_0x5ae703[_0x887e('0x53')]=[{'model':db[_0x887e('0x75')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x887e('0xbf'),'attributes':['name',_0x887e('0xc0'),'internal'],'required':![]},{'model':db[_0x887e('0xc1')],'as':_0x887e('0xc2'),'attributes':['id',_0x887e('0x39'),'color'],'where':_0x5cc4a6[_0x887e('0x42')]['tag']?{'id':_0x5cc4a6[_0x887e('0x42')][_0x887e('0xc3')]}:undefined,'required':_0x5cc4a6[_0x887e('0x42')][_0x887e('0xc3')]?!![]:![]}];}return db[_0x887e('0xbe')][_0x887e('0x54')](_0x5ae703);})[_0x887e('0x33')](function(_0xa91e1d){_0x577766[_0x887e('0x55')]=_0xa91e1d;return _0x577766;});}})[_0x887e('0x33')](respondWithFilteredResult(_0x1c8411,_0x5ae703))[_0x887e('0x25')](handleError(_0x1c8411,null));};exports[_0x887e('0x3a')]=function(_0x3c9f15,_0x459282,_0x349f2c){var _0x1a0cf3,_0x3e829e,_0x5cf329;if(_[_0x887e('0x92')](_0x3c9f15['body'][_0x887e('0x5a')])||_0x3c9f15[_0x887e('0x5a')]['body']===''){throw new db[(_0x887e('0x93'))][(_0x887e('0x76'))](_0x887e('0xc4'));}if(_[_0x887e('0x92')](_0x3c9f15[_0x887e('0x5a')]['to'])){throw new db[(_0x887e('0x93'))][(_0x887e('0x76'))](_0x887e('0xc5'));}_0x1a0cf3=_0x3c9f15[_0x887e('0x5a')]['to'];return db['SmsAccount'][_0x887e('0x58')]({'where':{'id':_0x3c9f15[_0x887e('0x62')]['id']},'include':[{'model':db['CmList'],'as':_0x887e('0xc6'),'include':[{'model':db[_0x887e('0x75')],'as':_0x887e('0x98'),'where':{'mobile':_0x1a0cf3},'limit':0x1,'order':[['updatedAt',_0x887e('0x99')]]}]}]})[_0x887e('0x33')](handleEntityNotFound(_0x459282,null))[_0x887e('0x33')](function(_0x49b1d2){if(_0x49b1d2&&_0x49b1d2[_0x887e('0xc6')]){_0x3e829e=_0x49b1d2['get']({'plain':!![]});if(_0x3e829e[_0x887e('0xc6')]&&_0x3e829e[_0x887e('0xc6')][_0x887e('0x98')][_0x887e('0x48')]){return _0x3e829e[_0x887e('0xc6')]['Contacts'][0x0];}return db[_0x887e('0x75')][_0x887e('0x59')](_['defaults'](_0x3c9f15[_0x887e('0x5a')],{'firstName':_0x1a0cf3,'mobile':_0x1a0cf3,'phone':_0x1a0cf3,'ListId':_0x3e829e[_0x887e('0xc7')]}));}})['then'](handleEntityNotFound(_0x459282,null))[_0x887e('0x33')](function(_0x108191){if(_0x108191){_0x5cf329=_0x108191;return db['SmsInteraction'][_0x887e('0x58')]({'where':{'ContactId':_0x5cf329['id'],'closed':![],'SmsAccountId':_0x3e829e['id']}})[_0x887e('0x33')](function(_0x444197){if(_0x444197){return[_0x444197,![]];}return db['SmsInteraction'][_0x887e('0x59')]({'UserId':_0x3c9f15[_0x887e('0x5d')]['id'],'ContactId':_0x5cf329['id'],'SmsAccountId':_0x3e829e['id'],'phone':_0x1a0cf3,'firstMsgDirection':'out','Messages':[_['merge'](_0x3c9f15[_0x887e('0x5a')],{'read':![],'body':_0x3c9f15[_0x887e('0x5a')][_0x887e('0x5a')],'phone':_0x1a0cf3,'SmsAccountId':_0x3e829e['id'],'UserId':_0x3c9f15[_0x887e('0x5d')]['id'],'ContactId':_0x5cf329['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x887e('0xc8')}]})[_0x887e('0x33')](function(_0x3d94fb){return[_0x3d94fb,!![]];});});}})[_0x887e('0x9d')](function(_0x45cf2d,_0x54b265){if(_0x54b265){return _0x45cf2d;}return db['SmsMessage'][_0x887e('0x59')](_[_0x887e('0x51')](_0x3c9f15[_0x887e('0x5a')],{'read':![],'body':_0x3c9f15[_0x887e('0x5a')][_0x887e('0x5a')],'phone':_0x1a0cf3,'SmsAccountId':_0x3e829e['id'],'SmsInteractionId':_0x45cf2d['id'],'UserId':_0x3c9f15[_0x887e('0x5d')]['id'],'ContactId':_0x5cf329['id']}))[_0x887e('0x33')](function(_0x266a41){_0x45cf2d[_0x887e('0xc9')][_0x887e('0xc8')]=[];_0x45cf2d['dataValues'][_0x887e('0xc8')]['push'](_0x266a41[_0x887e('0xc9')]);return _0x45cf2d;});})[_0x887e('0x33')](respondWithResult(_0x459282,null))[_0x887e('0x25')](handleError(_0x459282,null));};exports[_0x887e('0x27')]=function(_0xa8740,_0x39b067,_0x2527b7){if(_0xa8740[_0x887e('0x5a')]['id']){delete _0xa8740['body']['id'];}var _0xdf0942,_0x1877fe,_0x2b05fb;return db[_0x887e('0x3f')][_0x887e('0x58')]({'where':{'id':_0xa8740['params']['id']}})[_0x887e('0x33')](handleEntityNotFound(_0x39b067,null))[_0x887e('0x33')](function(_0x367cdd){if(_0x367cdd){_0x2b05fb=_0x367cdd;logger[_0x887e('0x1e')](_0x887e('0x1f'),'status','received\x20delivery\x20report\x20from',_0x367cdd[_0x887e('0x7d')],util[_0x887e('0xca')](_0xa8740['body'],{'showHidden':![],'depth':null}));switch(_0x367cdd[_0x887e('0x7d')]){case _0x887e('0xcb'):if(_0xa8740['body']['skebby_dispatch_id']&&_0xa8740[_0x887e('0x5a')][_0x887e('0x27')]){_0x1877fe=_0xa8740[_0x887e('0x5a')]['status'];return db[_0x887e('0xa4')][_0x887e('0x58')]({'where':{'messageId':_0xa8740[_0x887e('0x5a')][_0x887e('0xcc')]}});}break;case _0x887e('0x85'):if(_0xa8740['body']['requestid']&&_0xa8740[_0x887e('0x5a')][_0x887e('0xcd')]){_0x1877fe=_0xa8740['body']['statusInt'];return db['SmsMessage']['find']({'where':{'messageId':_0xa8740[_0x887e('0x5a')]['requestid']}});}break;case'clicksend':if(_0xa8740[_0x887e('0x5a')]['message_id']&&_0xa8740[_0x887e('0x5a')][_0x887e('0xce')]){_0x1877fe=_0xa8740[_0x887e('0x5a')][_0x887e('0xce')];return db['SmsMessage'][_0x887e('0x58')]({'where':{'messageId':_0xa8740[_0x887e('0x5a')][_0x887e('0x87')]}});}break;case _0x887e('0xcf'):var _0x362202=_0xa8740['body']['results'][0x0];if(_0x362202[_0x887e('0x81')]&&_0x362202[_0x887e('0x27')][_0x887e('0xd0')]===_0x887e('0xd1')){_0x1877fe=_0x362202[_0x887e('0x27')][_0x887e('0xd0')];return db[_0x887e('0xa4')][_0x887e('0x58')]({'where':{'messageId':_0x362202[_0x887e('0x81')]}});}break;case'clickatell':if(_0xa8740[_0x887e('0x5a')][_0x887e('0x81')]&&_0xa8740[_0x887e('0x5a')]['status']){_0x1877fe=_0xa8740[_0x887e('0x5a')][_0x887e('0x27')];return db[_0x887e('0xa4')][_0x887e('0x58')]({'where':{'messageId':_0xa8740[_0x887e('0x5a')]['messageId']}});}break;case _0x887e('0x90'):if(_0xa8740[_0x887e('0x5a')][0x0][_0x887e('0x23')]['id']){_0x1877fe=_0xa8740[_0x887e('0x5a')][0x0][_0x887e('0x7d')];return db['SmsMessage'][_0x887e('0x58')]({'where':{'messageId':_0xa8740[_0x887e('0x5a')][0x0]['message']['id']}});}break;case _0x887e('0xd2'):if(_0xa8740[_0x887e('0x5a')][_0x887e('0xd3')]&&_0xa8740[_0x887e('0x5a')][_0x887e('0x27')]){_0x1877fe=_0xa8740[_0x887e('0x5a')]['status'];return db['SmsMessage'][_0x887e('0x58')]({'where':{'messageId':_0xa8740['body']['redif']}});}break;}}})[_0x887e('0x33')](handleEntityNotFound(_0x39b067,null))[_0x887e('0x33')](function(_0xfe23d){if(_0xfe23d){_0xdf0942=_0xfe23d;switch(_0x2b05fb[_0x887e('0x7d')]){case _0x887e('0xcb'):if(_0x1877fe===_0x887e('0xd1')){return _0xdf0942['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x887e('0x27'),_0x887e('0xcb'),util['inspect'](_0xa8740[_0x887e('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x887e('0x85'):if(_0x1877fe==='1'){return _0xdf0942[_0x887e('0x32')]({'read':!![]});}else{logger[_0x887e('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x887e('0x27'),_0x887e('0xcb'),util[_0x887e('0xca')](_0xa8740['body'],{'showHidden':![],'depth':null}));}break;case _0x887e('0x86'):if(!_0xa8740[_0x887e('0x5a')][_0x887e('0xd4')]&&_0x1877fe>=0xc8&&_0x1877fe<=0xce){return _0xdf0942[_0x887e('0x32')]({'read':!![]});}else{logger[_0x887e('0x21')](_0x887e('0x1f'),_0x887e('0x27'),_0x887e('0x86'),util[_0x887e('0xca')](_0xa8740[_0x887e('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x887e('0xcf'):var _0x5c573c=_0xa8740[_0x887e('0x5a')][_0x887e('0x8b')][0x0];if(_0x5c573c[_0x887e('0x27')][_0x887e('0xd0')]===_0x887e('0xd1')){return _0xdf0942[_0x887e('0x32')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x887e('0x27'),_0x887e('0xcf'),util[_0x887e('0xca')](_0xa8740[_0x887e('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x887e('0x8f'):if(_0x1877fe==_0x887e('0xd5')||_0x1877fe==_0x887e('0xd6')){return _0xdf0942[_0x887e('0x32')]({'read':!![]});}else{logger[_0x887e('0x21')](_0x887e('0x1f'),_0x887e('0x27'),_0x887e('0x8f'),util[_0x887e('0xca')](_0xa8740[_0x887e('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x887e('0x90'):if(_0x1877fe==_0x887e('0xd7')){return _0xdf0942[_0x887e('0x32')]({'read':!![]});}else{logger[_0x887e('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x887e('0x27'),_0x887e('0x90'),util[_0x887e('0xca')](_0xa8740[_0x887e('0x5a')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x1877fe===_0x887e('0xd8')||_0x1877fe===_0x887e('0xd9')){return _0xdf0942['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x887e('0x27'),_0x887e('0xd2'),util[_0x887e('0xca')](_0xa8740['body'],{'showHidden':![],'depth':null}));}break;}return _0xdf0942;}})['then'](respondWithResult(_0x39b067,null))[_0x887e('0x25')](handleError(_0x39b067,null));};exports[_0x887e('0xda')]=function(_0x3b970d,_0x89470a,_0x3f083f){var _0x3076eb,_0xb81413,_0x348c66;return db[_0x887e('0x3f')][_0x887e('0x58')]({'where':{'id':_0x3b970d['params']['id']}})[_0x887e('0x33')](handleEntityNotFound(_0x89470a,null))[_0x887e('0x33')](function(_0x1c11f0){if(_0x1c11f0){_0x348c66=_0x1c11f0;logger[_0x887e('0x1e')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x887e('0x27'),_0x887e('0xdb'),_0x1c11f0[_0x887e('0x7d')],util[_0x887e('0xca')](_0x3b970d[_0x887e('0x42')],{'showHidden':![],'depth':null}));switch(_0x1c11f0[_0x887e('0x7d')]){case _0x887e('0x8c'):if(_0x3b970d[_0x887e('0x42')][_0x887e('0xdc')]&&_0x3b970d[_0x887e('0x42')][_0x887e('0xdd')]){_0xb81413=_0x3b970d['query'][_0x887e('0xdd')];return db[_0x887e('0xa4')][_0x887e('0x58')]({'where':{'messageId':_0x3b970d[_0x887e('0x42')]['message-id']}});}break;}}})[_0x887e('0x33')](handleEntityNotFound(_0x89470a,null))[_0x887e('0x33')](function(_0x52ae5a){if(_0x52ae5a){_0x3076eb=_0x52ae5a;switch(_0x348c66[_0x887e('0x7d')]){case _0x887e('0x8c'):if(_0xb81413==='2'||_0xb81413==='6'){return _0x3076eb[_0x887e('0x32')]({'read':!![]});}else{logger[_0x887e('0x21')](_0x887e('0x1f'),_0x887e('0x27'),_0x887e('0x8c'),util[_0x887e('0xca')](_0x3b970d[_0x887e('0x42')],{'showHidden':![],'depth':null}));};break;}return _0x3076eb;}})[_0x887e('0x33')](respondWithResult(_0x89470a,null))[_0x887e('0x25')](handleError(_0x89470a,null));};exports['addAgents']=function(_0x3f1131,_0x47af22,_0x2037b9){return db['SmsAccount'][_0x887e('0x58')]({'where':{'id':_0x3f1131[_0x887e('0x62')]['id']}})[_0x887e('0x33')](handleEntityNotFound(_0x47af22,null))[_0x887e('0x33')](function(_0x5615d5){if(_0x5615d5){return _0x5615d5[_0x887e('0xde')](_0x3f1131[_0x887e('0x5a')][_0x887e('0x6a')],_[_0x887e('0x9b')](_0x3f1131['body'],[_0x887e('0x6a'),'id'])||{})[_0x887e('0x9d')](function(_0x4e35e9){for(var _0x1be092=0x0;_0x1be092<_0x3f1131[_0x887e('0x5a')][_0x887e('0x6a')]['length'];_0x1be092+=0x1){socket['emit'](_0x887e('0xdf'),{'UserId':Number(_0x3f1131[_0x887e('0x5a')][_0x887e('0x6a')][_0x1be092]),'SmsAccountId':Number(_0x3f1131[_0x887e('0x62')]['id'])});}return _0x4e35e9;});}})[_0x887e('0x33')](respondWithResult(_0x47af22,null))[_0x887e('0x25')](handleError(_0x47af22,null));};exports[_0x887e('0xe0')]=function(_0x4faaf2,_0x2c20d3,_0x2d707b){return db['SmsAccount'][_0x887e('0x58')]({'where':{'id':_0x4faaf2['params']['id']}})[_0x887e('0x33')](handleEntityNotFound(_0x2c20d3,null))[_0x887e('0x33')](function(_0x2c4a00){if(_0x2c4a00){return _0x2c4a00[_0x887e('0xe0')](_0x4faaf2[_0x887e('0x42')][_0x887e('0x6a')])[_0x887e('0x33')](function(){if(_[_0x887e('0xe1')](_0x4faaf2[_0x887e('0x42')]['ids'])){for(var _0x33e739=0x0;_0x33e739<_0x4faaf2[_0x887e('0x42')][_0x887e('0x6a')]['length'];_0x33e739+=0x1){socket[_0x887e('0xe2')](_0x887e('0xe3'),{'UserId':Number(_0x4faaf2[_0x887e('0x42')][_0x887e('0x6a')][_0x33e739]),'SmsAccountId':Number(_0x4faaf2[_0x887e('0x62')]['id'])});}}else{socket[_0x887e('0xe2')](_0x887e('0xe3'),{'UserId':Number(_0x4faaf2[_0x887e('0x42')][_0x887e('0x6a')]),'SmsAccountId':Number(_0x4faaf2[_0x887e('0x62')]['id'])});}});}})['then'](respondWithStatusCode(_0x2c20d3,null))[_0x887e('0x25')](handleError(_0x2c20d3,null));};exports[_0x887e('0xe4')]=function(_0x5d3b3a,_0x2922d2,_0x3c8001){var _0x5d0ead={};var _0x3eca85={};var _0x5b37ac;var _0x138c4c;return db[_0x887e('0x3f')][_0x887e('0x68')]({'where':{'id':_0x5d3b3a[_0x887e('0x62')]['id']}})[_0x887e('0x33')](handleEntityNotFound(_0x2922d2,null))['then'](function(_0x1f45d4){if(_0x1f45d4){_0x5b37ac=_0x1f45d4;_0x3eca85[_0x887e('0x46')]=_[_0x887e('0x43')](db[_0x887e('0xa8')][_0x887e('0x40')]);_0x3eca85['query']=_['keys'](_0x5d3b3a[_0x887e('0x42')]);_0x3eca85['filters']=_['intersection'](_0x3eca85[_0x887e('0x46')],_0x3eca85[_0x887e('0x42')]);_0x5d0ead[_0x887e('0x45')]=_[_0x887e('0x44')](_0x3eca85[_0x887e('0x46')],qs['fields'](_0x5d3b3a['query'][_0x887e('0x47')]));_0x5d0ead[_0x887e('0x45')]=_0x5d0ead[_0x887e('0x45')][_0x887e('0x48')]?_0x5d0ead[_0x887e('0x45')]:_0x3eca85[_0x887e('0x46')];_0x5d0ead[_0x887e('0x4b')]=qs[_0x887e('0x4c')](_0x5d3b3a[_0x887e('0x42')]['sort']);_0x5d0ead[_0x887e('0x4d')]=qs[_0x887e('0x4e')](_[_0x887e('0x4f')](_0x5d3b3a[_0x887e('0x42')],_0x3eca85['filters']));if(_0x5d3b3a[_0x887e('0x42')]['filter']){_0x5d0ead[_0x887e('0x4d')]=_[_0x887e('0x51')](_0x5d0ead[_0x887e('0x4d')],{'$or':_[_0x887e('0x3e')](_0x5d0ead[_0x887e('0x45')],function(_0x35110a){var _0x5d261c={};_0x5d261c[_0x35110a]={'$like':'%'+_0x5d3b3a['query'][_0x887e('0x50')]+'%'};return _0x5d261c;})});}_0x5d0ead=_[_0x887e('0x51')]({},_0x5d0ead,_0x5d3b3a[_0x887e('0x57')]);return _0x5b37ac[_0x887e('0xe4')](_0x5d0ead);}})['then'](function(_0xf5da3c){if(_0xf5da3c){_0x138c4c=_0xf5da3c[_0x887e('0x48')];if(!_0x5d3b3a['query'][_0x887e('0x49')](_0x887e('0x4a'))){_0x5d0ead[_0x887e('0x2b')]=qs[_0x887e('0x2b')](_0x5d3b3a[_0x887e('0x42')]['limit']);_0x5d0ead[_0x887e('0x29')]=qs[_0x887e('0x29')](_0x5d3b3a[_0x887e('0x42')][_0x887e('0x29')]);}return _0x5b37ac['getAgents'](_0x5d0ead);}})[_0x887e('0x33')](function(_0x37715f){if(_0x37715f){return _0x37715f?{'count':_0x138c4c,'rows':_0x37715f}:null;}})[_0x887e('0x33')](respondWithResult(_0x2922d2,null))['catch'](handleError(_0x2922d2,null));}; \ No newline at end of file +var _0xb5e1=['MessageSid','skebby','sender','text','clicksend','messageId','plivo','From','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','refid','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','twilio','Content-Type','text/xml','send','addApplications','sequelize','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','getInteractions','Owner','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','List','user','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','status_code','message_id','groupName','DELIVERED','intelepeer','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','message-id','state','addAgents','omit','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','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','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','SmsAccounts','name','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','Pause','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','SmsAccountId','getDispositions','findOne','Disposition','length','nolimit','pick','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','Body'];(function(_0x4dde73,_0x281a14){var _0x100b55=function(_0x13c96c){while(--_0x13c96c){_0x4dde73['push'](_0x4dde73['shift']());}};_0x100b55(++_0x281a14);}(_0xb5e1,0x65));var _0x1b5e=function(_0x26ab0c,_0x1d1d76){_0x26ab0c=_0x26ab0c-0x0;var _0x39292c=_0xb5e1[_0x26ab0c];return _0x39292c;};'use strict';var emlformat=require(_0x1b5e('0x0'));var rimraf=require(_0x1b5e('0x1'));var zipdir=require(_0x1b5e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1b5e('0x3'));var moment=require('moment');var BPromise=require(_0x1b5e('0x4'));var Mustache=require(_0x1b5e('0x5'));var util=require(_0x1b5e('0x6'));var path=require(_0x1b5e('0x7'));var sox=require(_0x1b5e('0x8'));var csv=require(_0x1b5e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b5e('0xa'));var _=require('lodash');var squel=require(_0x1b5e('0xb'));var crypto=require('crypto');var jsforce=require(_0x1b5e('0xc'));var deskjs=require(_0x1b5e('0xd'));var toCsv=require(_0x1b5e('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1b5e('0xe'));var authService=require(_0x1b5e('0xf'));var qs=require(_0x1b5e('0x10'));var as=require(_0x1b5e('0x11'));var hardwareService=require(_0x1b5e('0x12'));var logger=require(_0x1b5e('0x13'))(_0x1b5e('0x14'));var utils=require(_0x1b5e('0x15'));var config=require(_0x1b5e('0x16'));var licenseUtil=require(_0x1b5e('0x17'));var db=require(_0x1b5e('0x18'))['db'];config[_0x1b5e('0x19')]=_[_0x1b5e('0x1a')](config[_0x1b5e('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x1b5e('0x1b'))(new Redis(config[_0x1b5e('0x19')]));require(_0x1b5e('0x1c'))[_0x1b5e('0x1d')](socket);var jayson=require(_0x1b5e('0x1e'));var client=jayson[_0x1b5e('0x1f')][_0x1b5e('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x5a644d,_0x51284d,_0x3b611e,_0x2eb9cc){return new BPromise(function(_0x2f5227,_0x9f2af7){var _0x212d6b=_0x2eb9cc||client;return _0x212d6b[_0x1b5e('0x21')](_0x5a644d,_0x3b611e)['then'](function(_0x5be474){logger[_0x1b5e('0x22')](_0x1b5e('0x23'),_0x51284d,_0x1b5e('0x24'));logger[_0x1b5e('0x25')](_0x1b5e('0x26'),_0x51284d,_0x1b5e('0x24'),JSON['stringify'](_0x5be474));if(_0x5be474[_0x1b5e('0x27')]){if(_0x5be474[_0x1b5e('0x27')]['code']===0x1f4){logger[_0x1b5e('0x27')](_0x1b5e('0x23'),_0x51284d,_0x5be474[_0x1b5e('0x27')][_0x1b5e('0x28')]);return _0x9f2af7(_0x5be474['error']['message']);}logger[_0x1b5e('0x27')](_0x1b5e('0x23'),_0x51284d,_0x5be474['error'][_0x1b5e('0x28')]);return _0x2f5227(_0x5be474['error'][_0x1b5e('0x28')]);}else{logger[_0x1b5e('0x22')](_0x1b5e('0x23'),_0x51284d,_0x1b5e('0x24'));_0x2f5227(_0x5be474['result'][_0x1b5e('0x28')]);}})[_0x1b5e('0x29')](function(_0x564582){logger[_0x1b5e('0x27')]('SmsAccount,\x20%s,\x20%s',_0x51284d,_0x564582);_0x9f2af7(_0x564582);});});}function respondWithStatusCode(_0x1fca39,_0x4be338){_0x4be338=_0x4be338||0xcc;return function(_0x4071c0){if(_0x4071c0){return _0x1fca39[_0x1b5e('0x2a')](_0x4be338);}return _0x1fca39[_0x1b5e('0x2b')](_0x4be338)[_0x1b5e('0x2c')]();};}function respondWithResult(_0x4c1da1,_0x1f7ee0){_0x1f7ee0=_0x1f7ee0||0xc8;return function(_0x405961){if(_0x405961){return _0x4c1da1[_0x1b5e('0x2b')](_0x1f7ee0)['json'](_0x405961);}};}function respondWithFilteredResult(_0x27ff52,_0x569835){return function(_0x315792){if(_0x315792){var _0x16fe9a=typeof _0x569835[_0x1b5e('0x2d')]===_0x1b5e('0x2e')&&typeof _0x569835[_0x1b5e('0x2f')]===_0x1b5e('0x2e');var _0x970dc7=_0x315792[_0x1b5e('0x30')];var _0x512c7e=_0x16fe9a?0x0:_0x569835[_0x1b5e('0x2d')];var _0x4a6c90=_0x16fe9a?_0x315792[_0x1b5e('0x30')]:_0x569835['offset']+_0x569835[_0x1b5e('0x2f')];var _0x1b168d;if(_0x4a6c90>=_0x970dc7){_0x4a6c90=_0x970dc7;_0x1b168d=0xc8;}else{_0x1b168d=0xce;}_0x27ff52['status'](_0x1b168d);return _0x27ff52[_0x1b5e('0x31')](_0x1b5e('0x32'),_0x512c7e+'-'+_0x4a6c90+'/'+_0x970dc7)[_0x1b5e('0x33')](_0x315792);}return null;};}function patchUpdates(_0x5b2722){return function(_0x28513d){try{jsonpatch[_0x1b5e('0x34')](_0x28513d,_0x5b2722,!![]);}catch(_0x145a8f){return BPromise[_0x1b5e('0x35')](_0x145a8f);}return _0x28513d[_0x1b5e('0x36')]();};}function saveUpdates(_0x1a047e,_0x386289){return function(_0x120aeb){if(_0x120aeb){return _0x120aeb[_0x1b5e('0x37')](_0x1a047e)[_0x1b5e('0x38')](function(_0x2432ec){return _0x2432ec;});}return null;};}function removeEntity(_0x99a506,_0x2ea8ce){return function(_0x194ea2){if(_0x194ea2){return _0x194ea2[_0x1b5e('0x39')]()[_0x1b5e('0x38')](function(){var _0x27d894=_0x194ea2[_0x1b5e('0x3a')]({'plain':!![]});var _0xd90a53=_0x1b5e('0x3b');return db['UserProfileResource'][_0x1b5e('0x39')]({'where':{'type':_0xd90a53,'resourceId':_0x27d894['id']}})['then'](function(){return _0x194ea2;});})[_0x1b5e('0x38')](function(){_0x99a506[_0x1b5e('0x2b')](0xcc)[_0x1b5e('0x2c')]();});}};}function handleEntityNotFound(_0x5d4dad,_0x220e27){return function(_0x7fbef9){if(!_0x7fbef9){_0x5d4dad[_0x1b5e('0x2a')](0x194);}return _0x7fbef9;};}function handleError(_0x925a5e,_0x59904d){_0x59904d=_0x59904d||0x1f4;return function(_0x27f696){logger['error'](_0x27f696['stack']);if(_0x27f696[_0x1b5e('0x3c')]){delete _0x27f696[_0x1b5e('0x3c')];}_0x925a5e['status'](_0x59904d)['send'](_0x27f696);};}exports['index']=function(_0x7ce5a2,_0x4e7593){var _0x5072d6={'include':[{'model':db['Pause'],'as':_0x1b5e('0x3d')}]},_0x1e8975={},_0x408b85={'count':0x0,'rows':[]};var _0x54eae7=_[_0x1b5e('0x3e')](db[_0x1b5e('0x3f')][_0x1b5e('0x40')],function(_0x161c6d){return{'name':_0x161c6d[_0x1b5e('0x41')],'type':_0x161c6d[_0x1b5e('0x42')]['key']};});_0x1e8975[_0x1b5e('0x43')]=_[_0x1b5e('0x3e')](_0x54eae7,_0x1b5e('0x3c'));_0x1e8975['query']=_[_0x1b5e('0x44')](_0x7ce5a2[_0x1b5e('0x45')]);_0x1e8975[_0x1b5e('0x46')]=_['intersection'](_0x1e8975[_0x1b5e('0x43')],_0x1e8975[_0x1b5e('0x45')]);_0x5072d6[_0x1b5e('0x47')]=_[_0x1b5e('0x48')](_0x1e8975['model'],qs[_0x1b5e('0x49')](_0x7ce5a2['query'][_0x1b5e('0x49')]));_0x5072d6[_0x1b5e('0x47')]=_0x5072d6[_0x1b5e('0x47')]['length']?_0x5072d6[_0x1b5e('0x47')]:_0x1e8975['model'];if(!_0x7ce5a2[_0x1b5e('0x45')][_0x1b5e('0x4a')]('nolimit')){_0x5072d6[_0x1b5e('0x2f')]=qs[_0x1b5e('0x2f')](_0x7ce5a2['query'][_0x1b5e('0x2f')]);_0x5072d6['offset']=qs['offset'](_0x7ce5a2[_0x1b5e('0x45')][_0x1b5e('0x2d')]);}_0x5072d6[_0x1b5e('0x4b')]=qs[_0x1b5e('0x4c')](_0x7ce5a2[_0x1b5e('0x45')][_0x1b5e('0x4c')]);_0x5072d6[_0x1b5e('0x4d')]=qs['filters'](_['pick'](_0x7ce5a2[_0x1b5e('0x45')],_0x1e8975['filters']),_0x54eae7);if(_0x7ce5a2[_0x1b5e('0x45')][_0x1b5e('0x4e')]){_0x5072d6[_0x1b5e('0x4d')]=_['merge'](_0x5072d6[_0x1b5e('0x4d')],{'$or':_[_0x1b5e('0x3e')](_0x54eae7,function(_0x3aac51){if(_0x3aac51[_0x1b5e('0x42')]!==_0x1b5e('0x4f')){var _0x26b590={};_0x26b590[_0x3aac51[_0x1b5e('0x3c')]]={'$like':'%'+_0x7ce5a2[_0x1b5e('0x45')][_0x1b5e('0x4e')]+'%'};return _0x26b590;}})});}_0x5072d6=_[_0x1b5e('0x50')]({},_0x5072d6,_0x7ce5a2[_0x1b5e('0x51')]);var _0x2f972e={'where':_0x5072d6[_0x1b5e('0x4d')]};return db[_0x1b5e('0x3f')]['count'](_0x2f972e)[_0x1b5e('0x38')](function(_0x305689){_0x408b85['count']=_0x305689;if(_0x7ce5a2[_0x1b5e('0x45')][_0x1b5e('0x52')]){_0x5072d6[_0x1b5e('0x53')]=[{'all':!![]}];}return db['SmsAccount'][_0x1b5e('0x54')](_0x5072d6);})['then'](function(_0x393dcc){_0x408b85[_0x1b5e('0x55')]=_0x393dcc;return _0x408b85;})[_0x1b5e('0x38')](respondWithFilteredResult(_0x4e7593,_0x5072d6))['catch'](handleError(_0x4e7593,null));};exports[_0x1b5e('0x56')]=function(_0x5b06b1,_0x5d152e){var _0x200895={'raw':![],'where':{'id':_0x5b06b1[_0x1b5e('0x57')]['id']},'include':[{'model':db[_0x1b5e('0x58')],'as':_0x1b5e('0x3d')}]},_0x1a8352={};_0x1a8352[_0x1b5e('0x43')]=_['keys'](db[_0x1b5e('0x3f')][_0x1b5e('0x40')]);_0x1a8352[_0x1b5e('0x45')]=_[_0x1b5e('0x44')](_0x5b06b1[_0x1b5e('0x45')]);_0x1a8352[_0x1b5e('0x46')]=_[_0x1b5e('0x48')](_0x1a8352[_0x1b5e('0x43')],_0x1a8352['query']);_0x200895['attributes']=_[_0x1b5e('0x48')](_0x1a8352[_0x1b5e('0x43')],qs[_0x1b5e('0x49')](_0x5b06b1[_0x1b5e('0x45')][_0x1b5e('0x49')]));_0x200895['attributes']=_0x200895[_0x1b5e('0x47')]['length']?_0x200895[_0x1b5e('0x47')]:_0x1a8352['model'];if(_0x5b06b1['query'][_0x1b5e('0x52')]){_0x200895['include']=[{'all':!![]}];}_0x200895=_['merge']({},_0x200895,_0x5b06b1[_0x1b5e('0x51')]);return db[_0x1b5e('0x3f')]['find'](_0x200895)[_0x1b5e('0x38')](handleEntityNotFound(_0x5d152e,null))[_0x1b5e('0x38')](respondWithResult(_0x5d152e,null))[_0x1b5e('0x29')](handleError(_0x5d152e,null));};exports[_0x1b5e('0x59')]=function(_0x2deeb5,_0xb1a19){return db[_0x1b5e('0x3f')]['create'](_0x2deeb5['body'],{})['then'](function(_0x59e512){var _0xeadaa0=_0x2deeb5['user'][_0x1b5e('0x3a')]({'plain':!![]});if(!_0xeadaa0)throw new Error(_0x1b5e('0x5a'));if(_0xeadaa0[_0x1b5e('0x5b')]==='user'){var _0x222476=_0x59e512['get']({'plain':!![]});var _0xcc68f4='SmsAccounts';return db[_0x1b5e('0x5c')]['find']({'where':{'name':_0xcc68f4,'userProfileId':_0xeadaa0[_0x1b5e('0x5d')]},'raw':!![]})[_0x1b5e('0x38')](function(_0x216690){if(_0x216690&&_0x216690[_0x1b5e('0x5e')]===0x0){return db[_0x1b5e('0x5f')][_0x1b5e('0x59')]({'name':_0x222476['name'],'resourceId':_0x222476['id'],'type':_0x216690['name'],'sectionId':_0x216690['id']},{})[_0x1b5e('0x38')](function(){return _0x59e512;});}else{return _0x59e512;}})['catch'](function(_0x133ddc){logger[_0x1b5e('0x27')](_0x1b5e('0x60'),_0x133ddc);throw _0x133ddc;});}return _0x59e512;})[_0x1b5e('0x38')](respondWithResult(_0xb1a19,0xc9))[_0x1b5e('0x29')](handleError(_0xb1a19,null));};exports[_0x1b5e('0x37')]=function(_0x4d6d3a,_0x5a712b){if(_0x4d6d3a[_0x1b5e('0x61')]['id']){delete _0x4d6d3a['body']['id'];}return db['SmsAccount'][_0x1b5e('0x62')]({'where':{'id':_0x4d6d3a[_0x1b5e('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x1b5e('0x3d')}]})[_0x1b5e('0x38')](handleEntityNotFound(_0x5a712b,null))[_0x1b5e('0x38')](saveUpdates(_0x4d6d3a[_0x1b5e('0x61')],null))[_0x1b5e('0x38')](respondWithResult(_0x5a712b,null))[_0x1b5e('0x29')](handleError(_0x5a712b,null));};exports['destroy']=function(_0x49cf8a,_0x8f2859){return db[_0x1b5e('0x3f')][_0x1b5e('0x62')]({'where':{'id':_0x49cf8a[_0x1b5e('0x57')]['id']}})[_0x1b5e('0x38')](handleEntityNotFound(_0x8f2859,null))[_0x1b5e('0x38')](removeEntity(_0x8f2859,null))[_0x1b5e('0x29')](handleError(_0x8f2859,null));};exports[_0x1b5e('0x63')]=function(_0x1b0f62,_0x2d46df){return db[_0x1b5e('0x3f')][_0x1b5e('0x63')]()[_0x1b5e('0x38')](respondWithResult(_0x2d46df,null))[_0x1b5e('0x29')](handleError(_0x2d46df,null));};exports['addDisposition']=function(_0x3bdd57,_0x1ac388,_0xb5eaef){if(_0x3bdd57[_0x1b5e('0x61')]['id']){delete _0x3bdd57[_0x1b5e('0x61')]['id'];}return db[_0x1b5e('0x3f')][_0x1b5e('0x62')]({'where':{'id':_0x3bdd57[_0x1b5e('0x57')]['id']}})[_0x1b5e('0x38')](handleEntityNotFound(_0x1ac388,null))['then'](function(_0x3f62ca){if(_0x3f62ca){_0x3bdd57[_0x1b5e('0x61')][_0x1b5e('0x64')]=_0x3f62ca['id'];return db['Disposition'][_0x1b5e('0x59')](_0x3bdd57[_0x1b5e('0x61')]);}})[_0x1b5e('0x38')](respondWithResult(_0x1ac388,null))[_0x1b5e('0x29')](handleError(_0x1ac388,null));};exports[_0x1b5e('0x65')]=function(_0x3b5b49,_0x2d8ebc,_0x3b51b1){var _0x5e7f58={'raw':![],'where':{}};var _0x30a89d={};var _0x17c6bd={'count':0x0,'rows':[]};return db[_0x1b5e('0x3f')][_0x1b5e('0x66')]({'where':{'id':_0x3b5b49[_0x1b5e('0x57')]['id']}})['then'](handleEntityNotFound(_0x2d8ebc,null))[_0x1b5e('0x38')](function(_0x5e52d7){if(_0x5e52d7){_0x30a89d[_0x1b5e('0x43')]=_['keys'](db[_0x1b5e('0x67')]['rawAttributes']);_0x30a89d[_0x1b5e('0x45')]=_['keys'](_0x3b5b49[_0x1b5e('0x45')]);_0x30a89d['filters']=_[_0x1b5e('0x48')](_0x30a89d[_0x1b5e('0x43')],_0x30a89d['query']);_0x5e7f58[_0x1b5e('0x47')]=_[_0x1b5e('0x48')](_0x30a89d[_0x1b5e('0x43')],qs[_0x1b5e('0x49')](_0x3b5b49[_0x1b5e('0x45')][_0x1b5e('0x49')]));_0x5e7f58['attributes']=_0x5e7f58[_0x1b5e('0x47')][_0x1b5e('0x68')]?_0x5e7f58['attributes']:_0x30a89d[_0x1b5e('0x43')];if(!_0x3b5b49['query'][_0x1b5e('0x4a')](_0x1b5e('0x69'))){_0x5e7f58[_0x1b5e('0x2f')]=qs[_0x1b5e('0x2f')](_0x3b5b49[_0x1b5e('0x45')][_0x1b5e('0x2f')]);_0x5e7f58['offset']=qs[_0x1b5e('0x2d')](_0x3b5b49[_0x1b5e('0x45')][_0x1b5e('0x2d')]);}_0x5e7f58[_0x1b5e('0x4b')]=qs[_0x1b5e('0x4c')](_0x3b5b49[_0x1b5e('0x45')]['sort']);_0x5e7f58[_0x1b5e('0x4d')]=qs[_0x1b5e('0x46')](_[_0x1b5e('0x6a')](_0x3b5b49[_0x1b5e('0x45')],_0x30a89d['filters']));_0x5e7f58[_0x1b5e('0x4d')][_0x1b5e('0x64')]=_0x5e52d7['id'];if(_0x3b5b49[_0x1b5e('0x45')][_0x1b5e('0x4e')]){_0x5e7f58['where']=_[_0x1b5e('0x50')](_0x5e7f58[_0x1b5e('0x4d')],{'$or':_[_0x1b5e('0x3e')](_0x5e7f58[_0x1b5e('0x47')],function(_0x195912){var _0xcc3a50={};_0xcc3a50[_0x195912]={'$like':'%'+_0x3b5b49[_0x1b5e('0x45')][_0x1b5e('0x4e')]+'%'};return _0xcc3a50;})});}_0x5e7f58=_[_0x1b5e('0x50')]({},_0x5e7f58,_0x3b5b49[_0x1b5e('0x51')]);return db['Disposition']['count']({'where':_0x5e7f58[_0x1b5e('0x4d')]})[_0x1b5e('0x38')](function(_0x39bc7c){_0x17c6bd['count']=_0x39bc7c;if(_0x3b5b49['query']['includeAll']){_0x5e7f58[_0x1b5e('0x53')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x5e7f58);})[_0x1b5e('0x38')](function(_0x3243d4){_0x17c6bd[_0x1b5e('0x55')]=_0x3243d4;return _0x17c6bd;});}})[_0x1b5e('0x38')](respondWithFilteredResult(_0x2d8ebc,_0x5e7f58))[_0x1b5e('0x29')](handleError(_0x2d8ebc,null));};exports[_0x1b5e('0x6b')]=function(_0x1970f4,_0xfd1ce8,_0x3363fc){return db[_0x1b5e('0x3f')][_0x1b5e('0x62')]({'where':{'id':_0x1970f4[_0x1b5e('0x57')]['id']}})[_0x1b5e('0x38')](handleEntityNotFound(_0xfd1ce8,null))['then'](function(_0x55acc8){if(_0x55acc8){return _0x55acc8[_0x1b5e('0x6b')](_0x1970f4['query'][_0x1b5e('0x6c')]);}})[_0x1b5e('0x38')](respondWithStatusCode(_0xfd1ce8,null))['catch'](handleError(_0xfd1ce8,null));};exports[_0x1b5e('0x6d')]=function(_0x119fdb,_0xc67392,_0xc5d100){if(_0x119fdb[_0x1b5e('0x61')]['id']){delete _0x119fdb[_0x1b5e('0x61')]['id'];}return db[_0x1b5e('0x3f')]['find']({'where':{'id':_0x119fdb[_0x1b5e('0x57')]['id']}})[_0x1b5e('0x38')](handleEntityNotFound(_0xc67392,null))[_0x1b5e('0x38')](function(_0x599361){if(_0x599361){_0x119fdb[_0x1b5e('0x61')][_0x1b5e('0x64')]=_0x599361['id'];return db[_0x1b5e('0x6e')][_0x1b5e('0x59')](_0x119fdb[_0x1b5e('0x61')]);}})[_0x1b5e('0x38')](respondWithResult(_0xc67392,null))[_0x1b5e('0x29')](handleError(_0xc67392,null));};exports['getAnswers']=function(_0xc5d3e4,_0x477b08,_0x44a8d7){var _0x1ff21c={'raw':![],'where':{}};var _0x38482e={};var _0x461481={'count':0x0,'rows':[]};return db[_0x1b5e('0x3f')][_0x1b5e('0x66')]({'where':{'id':_0xc5d3e4[_0x1b5e('0x57')]['id']}})[_0x1b5e('0x38')](handleEntityNotFound(_0x477b08,null))[_0x1b5e('0x38')](function(_0x46df5d){if(_0x46df5d){_0x38482e[_0x1b5e('0x43')]=_[_0x1b5e('0x44')](db['CannedAnswer'][_0x1b5e('0x40')]);_0x38482e[_0x1b5e('0x45')]=_[_0x1b5e('0x44')](_0xc5d3e4[_0x1b5e('0x45')]);_0x38482e['filters']=_[_0x1b5e('0x48')](_0x38482e[_0x1b5e('0x43')],_0x38482e[_0x1b5e('0x45')]);_0x1ff21c[_0x1b5e('0x47')]=_['intersection'](_0x38482e['model'],qs[_0x1b5e('0x49')](_0xc5d3e4[_0x1b5e('0x45')][_0x1b5e('0x49')]));_0x1ff21c[_0x1b5e('0x47')]=_0x1ff21c[_0x1b5e('0x47')][_0x1b5e('0x68')]?_0x1ff21c[_0x1b5e('0x47')]:_0x38482e['model'];if(!_0xc5d3e4[_0x1b5e('0x45')]['hasOwnProperty'](_0x1b5e('0x69'))){_0x1ff21c['limit']=qs[_0x1b5e('0x2f')](_0xc5d3e4['query'][_0x1b5e('0x2f')]);_0x1ff21c['offset']=qs[_0x1b5e('0x2d')](_0xc5d3e4['query']['offset']);}_0x1ff21c[_0x1b5e('0x4b')]=qs[_0x1b5e('0x4c')](_0xc5d3e4[_0x1b5e('0x45')][_0x1b5e('0x4c')]);_0x1ff21c[_0x1b5e('0x4d')]=qs[_0x1b5e('0x46')](_[_0x1b5e('0x6a')](_0xc5d3e4[_0x1b5e('0x45')],_0x38482e['filters']));_0x1ff21c[_0x1b5e('0x4d')]['SmsAccountId']=_0x46df5d['id'];if(_0xc5d3e4[_0x1b5e('0x45')][_0x1b5e('0x4e')]){_0x1ff21c[_0x1b5e('0x4d')]=_[_0x1b5e('0x50')](_0x1ff21c['where'],{'$or':_['map'](_0x1ff21c[_0x1b5e('0x47')],function(_0x38d017){var _0x10d99f={};_0x10d99f[_0x38d017]={'$like':'%'+_0xc5d3e4[_0x1b5e('0x45')][_0x1b5e('0x4e')]+'%'};return _0x10d99f;})});}_0x1ff21c=_[_0x1b5e('0x50')]({},_0x1ff21c,_0xc5d3e4[_0x1b5e('0x51')]);return db[_0x1b5e('0x6e')][_0x1b5e('0x30')]({'where':_0x1ff21c['where']})[_0x1b5e('0x38')](function(_0x181362){_0x461481[_0x1b5e('0x30')]=_0x181362;if(_0xc5d3e4[_0x1b5e('0x45')][_0x1b5e('0x52')]){_0x1ff21c['include']=[{'all':!![]}];}return db[_0x1b5e('0x6e')][_0x1b5e('0x54')](_0x1ff21c);})[_0x1b5e('0x38')](function(_0x4896c4){_0x461481[_0x1b5e('0x55')]=_0x4896c4;return _0x461481;});}})[_0x1b5e('0x38')](respondWithFilteredResult(_0x477b08,_0x1ff21c))[_0x1b5e('0x29')](handleError(_0x477b08,null));};exports[_0x1b5e('0x6f')]=function(_0x48ecbc,_0x44405a,_0x4607e6){return db['SmsAccount']['find']({'where':{'id':_0x48ecbc[_0x1b5e('0x57')]['id']}})[_0x1b5e('0x38')](handleEntityNotFound(_0x44405a,null))['then'](function(_0x8b83c9){if(_0x8b83c9){return _0x8b83c9['removeAnswers'](_0x48ecbc[_0x1b5e('0x45')][_0x1b5e('0x6c')]);}})[_0x1b5e('0x38')](respondWithStatusCode(_0x44405a,null))['catch'](handleError(_0x44405a,null));};exports['notify']=function(_0x279df,_0x1d6c36,_0x213aa8){var _0x1913cc={'channel':_0x1b5e('0x70')};var _0x49b06e=[];var _0x755093=[];var _0x2f8ea4={};return db[_0x1b5e('0x3f')]['find']({'where':{'id':_0x279df['params']['id']},'include':[{'model':db[_0x1b5e('0x71')],'as':_0x1b5e('0x72')}]})[_0x1b5e('0x38')](handleEntityNotFound(_0x1d6c36,null))['then'](function(_0x27c7c7){_0x1913cc[_0x1b5e('0x73')]=_0x27c7c7;_0x1913cc[_0x1b5e('0x74')]=_[_0x1b5e('0x75')](_0x27c7c7[_0x1b5e('0x72')],[_0x1b5e('0x76')],[_0x1b5e('0x77')]);if(_0x1913cc[_0x1b5e('0x73')][_0x1b5e('0x72')]){delete _0x1913cc[_0x1b5e('0x73')][_0x1b5e('0x72')];}return db['CmContact']['describe']();})[_0x1b5e('0x38')](function(_0x3831c2){if(!_0x3831c2){throw new db[(_0x1b5e('0x78'))]['ValidationError'](_0x1b5e('0x79'));}_0x49b06e=_[_0x1b5e('0x7a')](_[_0x1b5e('0x44')](_0x3831c2),[_0x1b5e('0x7b'),_0x1b5e('0x7c')]);_0x755093=_[_0x1b5e('0x7a')](_[_0x1b5e('0x44')](_0x3831c2),[_0x1b5e('0x7b'),_0x1b5e('0x7c'),_0x1b5e('0x7d'),_0x1b5e('0x7e')]);_0x1913cc[_0x1b5e('0x61')]={'mapKey':_0x1b5e('0x7f')};if(_0x1913cc[_0x1b5e('0x73')][_0x1b5e('0x42')]){switch(_0x1913cc[_0x1b5e('0x73')]['type']){case'twilio':_0x1913cc['body'][_0x1b5e('0x80')]=_0x279df[_0x1b5e('0x61')]['From'];_0x1913cc[_0x1b5e('0x61')]['body']=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x81')];_0x1913cc['body']['messageId']=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x82')];break;case _0x1b5e('0x83'):_0x1913cc[_0x1b5e('0x61')]['from']='+'+_0x279df[_0x1b5e('0x61')][_0x1b5e('0x84')];_0x1913cc['body'][_0x1b5e('0x61')]=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x85')];break;case'connectel':_0x1913cc[_0x1b5e('0x61')]['from']=_0x279df['body'][_0x1b5e('0x80')];_0x1913cc[_0x1b5e('0x61')]['body']=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x28')];break;case _0x1b5e('0x86'):_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x80')]=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x80')];_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x61')]=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x61')];_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x87')]=_0x279df['body']['message_id'];break;case _0x1b5e('0x88'):_0x1913cc['body']['from']=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x89')];_0x1913cc['body'][_0x1b5e('0x61')]=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x8a')];_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x87')]=_0x279df['body'][_0x1b5e('0x8b')];break;case _0x1b5e('0x8c'):_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x80')]='+'+_0x279df[_0x1b5e('0x61')][_0x1b5e('0x8d')][0x0][_0x1b5e('0x80')];_0x1913cc[_0x1b5e('0x61')]['body']=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x8d')][0x0]['text'];_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x87')]=_0x279df['body']['results'][0x0][_0x1b5e('0x87')];break;case _0x1b5e('0x8e'):_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x80')]=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x8f')];_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x61')]=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x90')][_0x1b5e('0x28')];break;case _0x1b5e('0x91'):_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x80')]=_0x279df['body'][_0x1b5e('0x92')];_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x61')]=_0x279df['body']['text'];_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x87')]=_0x279df['body'][_0x1b5e('0x93')];break;case _0x1b5e('0x94'):_0x1913cc[_0x1b5e('0x61')]['messageId']=_0x279df['body'][0x0][_0x1b5e('0x28')]['id'];_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x80')]=_0x279df[_0x1b5e('0x61')][0x0][_0x1b5e('0x28')][_0x1b5e('0x80')];_0x1913cc['body']['body']=_0x279df['body'][0x0][_0x1b5e('0x28')][_0x1b5e('0x85')];break;case'intelepeer':_0x1913cc['body'][_0x1b5e('0x80')]=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x80')];_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x61')]=_0x279df[_0x1b5e('0x61')]['message'];_0x1913cc[_0x1b5e('0x61')]['messageId']=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x95')];break;}}if(_0x1913cc[_0x1b5e('0x61')]['id']){delete _0x1913cc[_0x1b5e('0x61')]['id'];}if(_['isNil'](_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x80')])){throw new db['Sequelize'][(_0x1b5e('0x96'))](_0x1b5e('0x97'));}if(_[_0x1b5e('0x98')](_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x61')])||_0x1913cc[_0x1b5e('0x61')]['body']===''){throw new db[(_0x1b5e('0x78'))][(_0x1b5e('0x96'))](_0x1b5e('0x99'));}if(_[_0x1b5e('0x98')](_0x1913cc[_0x1b5e('0x61')]['mapKey'])){throw new db[(_0x1b5e('0x78'))][(_0x1b5e('0x96'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x755093);}if(!_[_0x1b5e('0x9a')](_0x755093,_0x1913cc['body'][_0x1b5e('0x9b')])){throw new db[(_0x1b5e('0x78'))]['ValidationError'](_0x1b5e('0x9c')+_0x755093);}_0x2f8ea4[_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x9b')]]=_0x1913cc['body'][_0x1b5e('0x80')];return db[_0x1b5e('0x9d')][_0x1b5e('0x62')]({'where':{'id':_0x1913cc[_0x1b5e('0x73')]['ListId']},'include':[{'model':db[_0x1b5e('0x9e')],'as':_0x1b5e('0x9f'),'where':_0x2f8ea4,'limit':0x1,'order':[['updatedAt',_0x1b5e('0xa0')]]}]});})[_0x1b5e('0x38')](handleEntityNotFound(_0x1d6c36,null))[_0x1b5e('0x38')](function(_0x506036){if(_0x506036){_0x1913cc[_0x1b5e('0xa1')]=_['omit'](_0x506036,[_0x1b5e('0x9f')]);if(_0x506036[_0x1b5e('0x9f')][_0x1b5e('0x68')]){return _0x506036[_0x1b5e('0x9f')][0x0];}var _0x2fa9d2=_['defaults'](_0x1913cc[_0x1b5e('0x61')],{'firstName':_0x1913cc['body']['from'],'ListId':_0x506036['id']});_0x2fa9d2[_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x9b')]]=_0x1913cc[_0x1b5e('0x61')]['from'];return db[_0x1b5e('0x9e')]['create'](_0x2fa9d2,{'fields':_0x49b06e,'raw':!![]});}})[_0x1b5e('0x38')](handleEntityNotFound(_0x1d6c36,null))['then'](function(_0x8dfd70){if(_0x8dfd70){_0x1913cc[_0x1b5e('0xa2')]=_0x8dfd70;var _0x4337ad={'ContactId':_0x8dfd70['id'],'phone':_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x80')],'SmsAccountId':_0x279df[_0x1b5e('0x57')]['id']};var _0x452e0d={'ContactId':_0x8dfd70['id'],'SmsAccountId':_0x279df[_0x1b5e('0x57')]['id'],'closed':![]};return db[_0x1b5e('0xa3')][_0x1b5e('0x62')]({'where':_0x452e0d})[_0x1b5e('0x38')](function(_0x33c834){if(_0x33c834){return[_0x33c834,![]];}return db[_0x1b5e('0xa3')][_0x1b5e('0x59')](_0x4337ad)['then'](function(_0x31ccc1){return[_0x31ccc1,!![]];});});}})[_0x1b5e('0xa4')](function(_0x5ec791,_0x255d5b){_0x1913cc['interaction']=_0x5ec791[_0x1b5e('0x3a')]({'plain':!![]});_0x1913cc[_0x1b5e('0xa5')]['created']=![];if(_0x255d5b){if(_0x1913cc[_0x1b5e('0x73')][_0x1b5e('0xa6')]){_0x1913cc[_0x1b5e('0x74')][_0x1b5e('0xa7')]({'id':0x0,'priority':_0x1913cc['applications'][_0x1b5e('0x68')]+0x1,'app':_0x1b5e('0xa8'),'appdata':_0x1b5e('0xa9'),'interval':_0x1b5e('0xaa')});}_0x1913cc[_0x1b5e('0xa5')]['created']=!![];}return db['SmsMessage']['create']({'phone':_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x80')],'messageId':_0x1913cc['body'][_0x1b5e('0x87')],'body':_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x61')],'SmsAccountId':_0x279df[_0x1b5e('0x57')]['id'],'SmsInteractionId':_0x5ec791['id'],'direction':'in','ContactId':_0x5ec791['ContactId'],'AttachmentId':_0x1913cc['body']['AttachmentId']});})['then'](function(_0x4160a1){_0x1913cc['message']=_0x4160a1;if(_0x1913cc['interaction'][_0x1b5e('0xab')]){return db[_0x1b5e('0xac')][_0x1b5e('0x62')]({'attributes':['id','name'],'where':{'id':_0x1913cc[_0x1b5e('0xa5')][_0x1b5e('0xab')]}})[_0x1b5e('0x38')](function(_0x3177d3){if(_0x3177d3){_0x1913cc['applications'][_0x1b5e('0xad')]({'id':0x0,'priority':0x0,'app':_0x1b5e('0xae'),'appdata':_0x3177d3[_0x1b5e('0x3c')]+','+(_0x1913cc['account'][_0x1b5e('0xaf')]||0xa),'interval':_0x1b5e('0xaa')});}return respondWithRpcPromise(_0x1b5e('0xb0'),_0x1b5e('0xb1'),_0x1913cc);});}return respondWithRpcPromise(_0x1b5e('0xb0'),_0x1b5e('0xb1'),_0x1913cc);})[_0x1b5e('0x38')](function(_0x2ca019){if(_0x2ca019){var _0x2affc2=0xc8;var _0x26496a=_0x1b5e('0xb2');logger[_0x1b5e('0x22')](_0x1b5e('0x26'),_0x26496a,_0x2affc2,_0x1b5e('0xb3'));logger[_0x1b5e('0x25')](_0x1b5e('0xb4'),_0x26496a,_0x2affc2,'entity\x20found',JSON[_0x1b5e('0xb5')](_0x2ca019));if(_0x1913cc[_0x1b5e('0x73')]['type']===_0x1b5e('0xb6')){return _0x1d6c36['status'](_0x2affc2)[_0x1b5e('0x31')](_0x1b5e('0xb7'),_0x1b5e('0xb8'))[_0x1b5e('0xb9')]('\x0a');}else{return _0x1d6c36[_0x1b5e('0x2b')](_0x2affc2)[_0x1b5e('0x33')](_0x2ca019);}}})['catch'](handleError(_0x1d6c36,null));};exports[_0x1b5e('0xba')]=function(_0x4bc29d,_0x48bebe){var _0x1ddfb8=_0x4bc29d['params']['id'];var _0x5800ca=_0x4bc29d[_0x1b5e('0x61')];var _0x5656f7=0xc8;var _0x5cb821=null;return db[_0x1b5e('0xbb')]['transaction']({'isolationLevel':db[_0x1b5e('0xbb')]['Transaction']['ISOLATION_LEVELS'][_0x1b5e('0xbc')]},function(_0x132e32){return db[_0x1b5e('0x3f')][_0x1b5e('0x66')]({'where':{'id':_0x1ddfb8},'transaction':_0x132e32})[_0x1b5e('0x38')](function(_0x298364){if(_0x298364){return db['SmsApplication'][_0x1b5e('0x39')]({'where':{'SmsAccountId':_0x1ddfb8},'transaction':_0x132e32})[_0x1b5e('0x38')](function(){var _0x521142=_[_0x1b5e('0x3e')](_0x5800ca,function(_0x7443d3){_0x7443d3[_0x1b5e('0x64')]=_0x1ddfb8;return _0x7443d3;});return db[_0x1b5e('0x71')]['bulkCreate'](_0x521142,{'transaction':_0x132e32});});}else{_0x5656f7=0x194;_0x5cb821=[];}});})[_0x1b5e('0x38')](function(){if(_0x5656f7!==0x194){return db[_0x1b5e('0x71')][_0x1b5e('0xbd')]({'where':{'SmsAccountId':_0x1ddfb8},'order':_0x1b5e('0x76')})[_0x1b5e('0x38')](function(_0x3851cb){_0x5cb821=_0x3851cb;});}})[_0x1b5e('0x29')](function(_0x1f244d){_0x5656f7=0x1f4;logger['error'](_0x1f244d[_0x1b5e('0xbe')]);if(_0x1f244d[_0x1b5e('0x3c')]){delete _0x1f244d[_0x1b5e('0x3c')];}_0x5cb821=_0x1f244d;})[_0x1b5e('0xbf')](function(){if(_0x5cb821===null){_0x48bebe[_0x1b5e('0x2a')](_0x5656f7);}else{if(_0x5656f7===0x1f4){_0x48bebe['status'](_0x5656f7)[_0x1b5e('0xb9')](_0x5cb821);}else{_0x48bebe[_0x1b5e('0x2b')](_0x5656f7)[_0x1b5e('0x33')](_0x5cb821);}}});};exports[_0x1b5e('0xc0')]=function(_0x4ce1aa,_0xa06c20,_0x2339ee){var _0x347364={};var _0x251e30={};var _0x45c1e6;var _0x6bd873;return db[_0x1b5e('0x3f')][_0x1b5e('0x66')]({'where':{'id':_0x4ce1aa[_0x1b5e('0x57')]['id']}})['then'](handleEntityNotFound(_0xa06c20,null))[_0x1b5e('0x38')](function(_0x1412dd){if(_0x1412dd){_0x45c1e6=_0x1412dd;_0x251e30[_0x1b5e('0x43')]=_['keys'](db[_0x1b5e('0x71')][_0x1b5e('0x40')]);_0x251e30[_0x1b5e('0x45')]=_[_0x1b5e('0x44')](_0x4ce1aa[_0x1b5e('0x45')]);_0x251e30['filters']=_[_0x1b5e('0x48')](_0x251e30[_0x1b5e('0x43')],_0x251e30[_0x1b5e('0x45')]);_0x347364['attributes']=_['intersection'](_0x251e30[_0x1b5e('0x43')],qs[_0x1b5e('0x49')](_0x4ce1aa[_0x1b5e('0x45')][_0x1b5e('0x49')]));_0x347364[_0x1b5e('0x47')]=_0x347364['attributes']['length']?_0x347364[_0x1b5e('0x47')]:_0x251e30[_0x1b5e('0x43')];_0x347364[_0x1b5e('0x4b')]=qs[_0x1b5e('0x4c')](_0x4ce1aa[_0x1b5e('0x45')][_0x1b5e('0x4c')]);_0x347364[_0x1b5e('0x4d')]=qs[_0x1b5e('0x46')](_[_0x1b5e('0x6a')](_0x4ce1aa['query'],_0x251e30[_0x1b5e('0x46')]));if(_0x4ce1aa[_0x1b5e('0x45')][_0x1b5e('0x4e')]){_0x347364[_0x1b5e('0x4d')]=_[_0x1b5e('0x50')](_0x347364[_0x1b5e('0x4d')],{'$or':_[_0x1b5e('0x3e')](_0x347364[_0x1b5e('0x47')],function(_0x4312d2){var _0x1246ed={};_0x1246ed[_0x4312d2]={'$like':'%'+_0x4ce1aa[_0x1b5e('0x45')][_0x1b5e('0x4e')]+'%'};return _0x1246ed;})});}_0x347364=_[_0x1b5e('0x50')]({},_0x347364,_0x4ce1aa[_0x1b5e('0x51')]);return _0x45c1e6['getApplications'](_0x347364);}})[_0x1b5e('0x38')](function(_0x5ba07c){if(_0x5ba07c){_0x6bd873=_0x5ba07c['length'];if(!_0x4ce1aa[_0x1b5e('0x45')][_0x1b5e('0x4a')](_0x1b5e('0x69'))){_0x347364[_0x1b5e('0x2f')]=qs[_0x1b5e('0x2f')](_0x4ce1aa[_0x1b5e('0x45')]['limit']);_0x347364[_0x1b5e('0x2d')]=qs[_0x1b5e('0x2d')](_0x4ce1aa[_0x1b5e('0x45')]['offset']);}return _0x45c1e6[_0x1b5e('0xc0')](_0x347364);}})[_0x1b5e('0x38')](function(_0x3aded9){if(_0x3aded9){return _0x3aded9?{'count':_0x6bd873,'rows':_0x3aded9}:null;}})[_0x1b5e('0x38')](respondWithResult(_0xa06c20,null))['catch'](handleError(_0xa06c20,null));};exports[_0x1b5e('0xc1')]=function(_0x11d963,_0x1ee1ed,_0x37f93b){var _0xb385db={'raw':![],'where':{}};var _0x40813e={};var _0x1344c5={'count':0x0,'rows':[]};return db[_0x1b5e('0x3f')][_0x1b5e('0x66')]({'where':{'id':_0x11d963['params']['id']}})[_0x1b5e('0x38')](handleEntityNotFound(_0x1ee1ed,null))[_0x1b5e('0x38')](function(_0x180ec1){if(_0x180ec1){_0x40813e[_0x1b5e('0x43')]=_[_0x1b5e('0x44')](db['SmsInteraction'][_0x1b5e('0x40')]);_0x40813e[_0x1b5e('0x45')]=_[_0x1b5e('0x44')](_0x11d963[_0x1b5e('0x45')]);_0x40813e[_0x1b5e('0x46')]=_[_0x1b5e('0x48')](_0x40813e[_0x1b5e('0x43')],_0x40813e[_0x1b5e('0x45')]);_0xb385db[_0x1b5e('0x47')]=_['intersection'](_0x40813e[_0x1b5e('0x43')],qs[_0x1b5e('0x49')](_0x11d963['query'][_0x1b5e('0x49')]));_0xb385db['attributes']=_0xb385db[_0x1b5e('0x47')]['length']?_0xb385db[_0x1b5e('0x47')]:_0x40813e[_0x1b5e('0x43')];if(!_0x11d963[_0x1b5e('0x45')][_0x1b5e('0x4a')]('nolimit')){_0xb385db[_0x1b5e('0x2f')]=qs[_0x1b5e('0x2f')](_0x11d963[_0x1b5e('0x45')]['limit']);_0xb385db[_0x1b5e('0x2d')]=qs[_0x1b5e('0x2d')](_0x11d963[_0x1b5e('0x45')]['offset']);}_0xb385db['order']=qs['sort'](_0x11d963[_0x1b5e('0x45')][_0x1b5e('0x4c')]);_0xb385db[_0x1b5e('0x4d')]=qs[_0x1b5e('0x46')](_[_0x1b5e('0x6a')](_0x11d963['query'],_0x40813e[_0x1b5e('0x46')]));_0xb385db[_0x1b5e('0x4d')][_0x1b5e('0x64')]=_0x180ec1['id'];if(_0x11d963[_0x1b5e('0x45')][_0x1b5e('0x4e')]){_0xb385db[_0x1b5e('0x4d')]=_[_0x1b5e('0x50')](_0xb385db['where'],{'$or':_['map'](_0xb385db[_0x1b5e('0x47')],function(_0x3aa316){var _0x26951b={};_0x26951b[_0x3aa316]={'$like':'%'+_0x11d963[_0x1b5e('0x45')]['filter']+'%'};return _0x26951b;})});}_0xb385db=_['merge']({},_0xb385db,_0x11d963['options']);return db[_0x1b5e('0xa3')]['count']({'where':_0xb385db[_0x1b5e('0x4d')]})['then'](function(_0xd7069e){_0x1344c5['count']=_0xd7069e;if(_0x11d963[_0x1b5e('0x45')][_0x1b5e('0x52')]){_0xb385db['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0x1b5e('0xc2'),'attributes':[_0x1b5e('0x3c'),_0x1b5e('0xc3'),_0x1b5e('0xc4')],'required':![]},{'model':db[_0x1b5e('0xc5')],'as':'Tags','attributes':['id','name',_0x1b5e('0xc6')],'where':_0x11d963[_0x1b5e('0x45')][_0x1b5e('0xc7')]?{'id':_0x11d963['query'][_0x1b5e('0xc7')]}:undefined,'required':_0x11d963[_0x1b5e('0x45')][_0x1b5e('0xc7')]?!![]:![]}];}return db['SmsInteraction'][_0x1b5e('0x54')](_0xb385db);})[_0x1b5e('0x38')](function(_0x59321d){_0x1344c5[_0x1b5e('0x55')]=_0x59321d;return _0x1344c5;});}})[_0x1b5e('0x38')](respondWithFilteredResult(_0x1ee1ed,_0xb385db))[_0x1b5e('0x29')](handleError(_0x1ee1ed,null));};exports['send']=function(_0x5a9198,_0x460f1f,_0x4a770f){var _0xe89575,_0x4853f6,_0x334af9;if(_['isNil'](_0x5a9198[_0x1b5e('0x61')][_0x1b5e('0x61')])||_0x5a9198[_0x1b5e('0x61')][_0x1b5e('0x61')]===''){throw new db['Sequelize'][(_0x1b5e('0x96'))](_0x1b5e('0x99'));}if(_[_0x1b5e('0x98')](_0x5a9198[_0x1b5e('0x61')]['to'])){throw new db[(_0x1b5e('0x78'))]['ValidationError'](_0x1b5e('0xc8'));}_0xe89575=_0x5a9198['body']['to'];return db[_0x1b5e('0x3f')][_0x1b5e('0x62')]({'where':{'id':_0x5a9198[_0x1b5e('0x57')]['id']},'include':[{'model':db[_0x1b5e('0x9d')],'as':_0x1b5e('0xc9'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0xe89575},'limit':0x1,'order':[[_0x1b5e('0x7c'),_0x1b5e('0xa0')]]}]}]})[_0x1b5e('0x38')](handleEntityNotFound(_0x460f1f,null))['then'](function(_0xe4c3d2){if(_0xe4c3d2&&_0xe4c3d2['List']){_0x4853f6=_0xe4c3d2[_0x1b5e('0x3a')]({'plain':!![]});if(_0x4853f6[_0x1b5e('0xc9')]&&_0x4853f6[_0x1b5e('0xc9')]['Contacts'][_0x1b5e('0x68')]){return _0x4853f6[_0x1b5e('0xc9')][_0x1b5e('0x9f')][0x0];}return db[_0x1b5e('0x9e')][_0x1b5e('0x59')](_['defaults'](_0x5a9198[_0x1b5e('0x61')],{'firstName':_0xe89575,'mobile':_0xe89575,'phone':_0xe89575,'ListId':_0x4853f6['ListId']}));}})[_0x1b5e('0x38')](handleEntityNotFound(_0x460f1f,null))['then'](function(_0x2c449a){if(_0x2c449a){_0x334af9=_0x2c449a;return db[_0x1b5e('0xa3')][_0x1b5e('0x62')]({'where':{'ContactId':_0x334af9['id'],'closed':![],'SmsAccountId':_0x4853f6['id']}})['then'](function(_0x10a239){if(_0x10a239){return[_0x10a239,![]];}return db[_0x1b5e('0xa3')][_0x1b5e('0x59')]({'UserId':_0x5a9198['user']['id'],'ContactId':_0x334af9['id'],'SmsAccountId':_0x4853f6['id'],'phone':_0xe89575,'firstMsgDirection':'out','Messages':[_['merge'](_0x5a9198['body'],{'read':![],'body':_0x5a9198['body']['body'],'phone':_0xe89575,'SmsAccountId':_0x4853f6['id'],'UserId':_0x5a9198[_0x1b5e('0xca')]['id'],'ContactId':_0x334af9['id']})]},{'include':[{'model':db[_0x1b5e('0xcb')],'as':_0x1b5e('0xcc')}]})[_0x1b5e('0x38')](function(_0x1cc955){return[_0x1cc955,!![]];});});}})[_0x1b5e('0xa4')](function(_0x37bfe2,_0x205a4a){if(_0x205a4a){return _0x37bfe2;}return db['SmsMessage'][_0x1b5e('0x59')](_[_0x1b5e('0x50')](_0x5a9198[_0x1b5e('0x61')],{'read':![],'body':_0x5a9198[_0x1b5e('0x61')][_0x1b5e('0x61')],'phone':_0xe89575,'SmsAccountId':_0x4853f6['id'],'SmsInteractionId':_0x37bfe2['id'],'UserId':_0x5a9198[_0x1b5e('0xca')]['id'],'ContactId':_0x334af9['id']}))[_0x1b5e('0x38')](function(_0x31f519){_0x37bfe2['dataValues'][_0x1b5e('0xcc')]=[];_0x37bfe2['dataValues'][_0x1b5e('0xcc')]['push'](_0x31f519[_0x1b5e('0xcd')]);return _0x37bfe2;});})[_0x1b5e('0x38')](respondWithResult(_0x460f1f,null))['catch'](handleError(_0x460f1f,null));};exports['status']=function(_0x1d262f,_0x4f7c71,_0x302145){if(_0x1d262f[_0x1b5e('0x61')]['id']){delete _0x1d262f[_0x1b5e('0x61')]['id'];}var _0x1f52e4,_0x4a9036,_0x496ad7;return db[_0x1b5e('0x3f')][_0x1b5e('0x62')]({'where':{'id':_0x1d262f[_0x1b5e('0x57')]['id']}})[_0x1b5e('0x38')](handleEntityNotFound(_0x4f7c71,null))[_0x1b5e('0x38')](function(_0x1f8197){if(_0x1f8197){_0x496ad7=_0x1f8197;logger[_0x1b5e('0x25')](_0x1b5e('0x26'),_0x1b5e('0x2b'),_0x1b5e('0xce'),_0x1f8197[_0x1b5e('0x42')],util[_0x1b5e('0xcf')](_0x1d262f[_0x1b5e('0x61')],{'showHidden':![],'depth':null}));switch(_0x1f8197[_0x1b5e('0x42')]){case _0x1b5e('0x83'):if(_0x1d262f[_0x1b5e('0x61')][_0x1b5e('0xd0')]&&_0x1d262f[_0x1b5e('0x61')]['status']){_0x4a9036=_0x1d262f[_0x1b5e('0x61')][_0x1b5e('0x2b')];return db[_0x1b5e('0xcb')][_0x1b5e('0x62')]({'where':{'messageId':_0x1d262f[_0x1b5e('0x61')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x1d262f['body']['requestid']&&_0x1d262f[_0x1b5e('0x61')]['statusInt']){_0x4a9036=_0x1d262f[_0x1b5e('0x61')][_0x1b5e('0xd1')];return db[_0x1b5e('0xcb')][_0x1b5e('0x62')]({'where':{'messageId':_0x1d262f[_0x1b5e('0x61')]['requestid']}});}break;case _0x1b5e('0x86'):if(_0x1d262f[_0x1b5e('0x61')]['message_id']&&_0x1d262f[_0x1b5e('0x61')][_0x1b5e('0xd2')]){_0x4a9036=_0x1d262f['body'][_0x1b5e('0xd2')];return db[_0x1b5e('0xcb')][_0x1b5e('0x62')]({'where':{'messageId':_0x1d262f[_0x1b5e('0x61')][_0x1b5e('0xd3')]}});}break;case _0x1b5e('0x8c'):var _0x58cecb=_0x1d262f['body'][_0x1b5e('0x8d')][0x0];if(_0x58cecb[_0x1b5e('0x87')]&&_0x58cecb['status'][_0x1b5e('0xd4')]===_0x1b5e('0xd5')){_0x4a9036=_0x58cecb['status'][_0x1b5e('0xd4')];return db['SmsMessage']['find']({'where':{'messageId':_0x58cecb[_0x1b5e('0x87')]}});}break;case _0x1b5e('0x91'):if(_0x1d262f['body'][_0x1b5e('0x87')]&&_0x1d262f[_0x1b5e('0x61')][_0x1b5e('0x2b')]){_0x4a9036=_0x1d262f['body'][_0x1b5e('0x2b')];return db[_0x1b5e('0xcb')][_0x1b5e('0x62')]({'where':{'messageId':_0x1d262f[_0x1b5e('0x61')]['messageId']}});}break;case'bandwidth':if(_0x1d262f[_0x1b5e('0x61')][0x0][_0x1b5e('0x28')]['id']){_0x4a9036=_0x1d262f[_0x1b5e('0x61')][0x0][_0x1b5e('0x42')];return db[_0x1b5e('0xcb')][_0x1b5e('0x62')]({'where':{'messageId':_0x1d262f[_0x1b5e('0x61')][0x0][_0x1b5e('0x28')]['id']}});}break;case _0x1b5e('0xd6'):if(_0x1d262f[_0x1b5e('0x61')]['redif']&&_0x1d262f['body'][_0x1b5e('0x2b')]){_0x4a9036=_0x1d262f[_0x1b5e('0x61')]['status'];return db[_0x1b5e('0xcb')]['find']({'where':{'messageId':_0x1d262f[_0x1b5e('0x61')][_0x1b5e('0xd7')]}});}break;}}})['then'](handleEntityNotFound(_0x4f7c71,null))[_0x1b5e('0x38')](function(_0x98d54a){if(_0x98d54a){_0x1f52e4=_0x98d54a;switch(_0x496ad7[_0x1b5e('0x42')]){case _0x1b5e('0x83'):if(_0x4a9036===_0x1b5e('0xd5')){return _0x1f52e4['update']({'read':!![]});}else{logger[_0x1b5e('0x27')](_0x1b5e('0x26'),_0x1b5e('0x2b'),_0x1b5e('0x83'),util[_0x1b5e('0xcf')](_0x1d262f[_0x1b5e('0x61')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x4a9036==='1'){return _0x1f52e4[_0x1b5e('0x37')]({'read':!![]});}else{logger[_0x1b5e('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','skebby',util['inspect'](_0x1d262f[_0x1b5e('0x61')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x1d262f[_0x1b5e('0x61')][_0x1b5e('0xd8')]&&_0x4a9036>=0xc8&&_0x4a9036<=0xce){return _0x1f52e4[_0x1b5e('0x37')]({'read':!![]});}else{logger[_0x1b5e('0x27')](_0x1b5e('0x26'),_0x1b5e('0x2b'),_0x1b5e('0x86'),util[_0x1b5e('0xcf')](_0x1d262f['body'],{'showHidden':![],'depth':null}));}break;case _0x1b5e('0x8c'):var _0x409ef1=_0x1d262f[_0x1b5e('0x61')][_0x1b5e('0x8d')][0x0];if(_0x409ef1[_0x1b5e('0x2b')][_0x1b5e('0xd4')]===_0x1b5e('0xd5')){return _0x1f52e4[_0x1b5e('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1b5e('0x2b'),'infobip',util['inspect'](_0x1d262f[_0x1b5e('0x61')],{'showHidden':![],'depth':null}));}break;case _0x1b5e('0x91'):if(_0x4a9036==_0x1b5e('0xd9')||_0x4a9036==_0x1b5e('0xda')){return _0x1f52e4['update']({'read':!![]});}else{logger[_0x1b5e('0x27')](_0x1b5e('0x26'),_0x1b5e('0x2b'),_0x1b5e('0x91'),util[_0x1b5e('0xcf')](_0x1d262f[_0x1b5e('0x61')],{'showHidden':![],'depth':null}));}break;case _0x1b5e('0x94'):if(_0x4a9036==_0x1b5e('0xdb')){return _0x1f52e4[_0x1b5e('0x37')]({'read':!![]});}else{logger[_0x1b5e('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1b5e('0x2b'),_0x1b5e('0x94'),util[_0x1b5e('0xcf')](_0x1d262f[_0x1b5e('0x61')],{'showHidden':![],'depth':null}));}break;case _0x1b5e('0xd6'):if(_0x4a9036==='DELIVRD'||_0x4a9036===_0x1b5e('0xdc')){return _0x1f52e4[_0x1b5e('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x1b5e('0xd6'),util[_0x1b5e('0xcf')](_0x1d262f[_0x1b5e('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x1f52e4;}})[_0x1b5e('0x38')](respondWithResult(_0x4f7c71,null))[_0x1b5e('0x29')](handleError(_0x4f7c71,null));};exports['statusGet']=function(_0x4c7237,_0x115ccf,_0x3ed2b7){var _0x437cc3,_0x282ff7,_0x2d6e17;return db[_0x1b5e('0x3f')][_0x1b5e('0x62')]({'where':{'id':_0x4c7237['params']['id']}})[_0x1b5e('0x38')](handleEntityNotFound(_0x115ccf,null))[_0x1b5e('0x38')](function(_0x2ac390){if(_0x2ac390){_0x2d6e17=_0x2ac390;logger[_0x1b5e('0x25')](_0x1b5e('0x26'),'status','received\x20delivery\x20report\x20from',_0x2ac390[_0x1b5e('0x42')],util['inspect'](_0x4c7237[_0x1b5e('0x45')],{'showHidden':![],'depth':null}));switch(_0x2ac390[_0x1b5e('0x42')]){case _0x1b5e('0x8e'):if(_0x4c7237['query'][_0x1b5e('0xdd')]&&_0x4c7237['query'][_0x1b5e('0xde')]){_0x282ff7=_0x4c7237[_0x1b5e('0x45')][_0x1b5e('0xde')];return db[_0x1b5e('0xcb')][_0x1b5e('0x62')]({'where':{'messageId':_0x4c7237[_0x1b5e('0x45')][_0x1b5e('0xdd')]}});}break;}}})[_0x1b5e('0x38')](handleEntityNotFound(_0x115ccf,null))[_0x1b5e('0x38')](function(_0x116a72){if(_0x116a72){_0x437cc3=_0x116a72;switch(_0x2d6e17[_0x1b5e('0x42')]){case _0x1b5e('0x8e'):if(_0x282ff7==='2'||_0x282ff7==='6'){return _0x437cc3['update']({'read':!![]});}else{logger[_0x1b5e('0x27')](_0x1b5e('0x26'),_0x1b5e('0x2b'),_0x1b5e('0x8e'),util[_0x1b5e('0xcf')](_0x4c7237[_0x1b5e('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x437cc3;}})[_0x1b5e('0x38')](respondWithResult(_0x115ccf,null))[_0x1b5e('0x29')](handleError(_0x115ccf,null));};exports['addAgents']=function(_0x5ecadf,_0xb395c,_0x35de28){return db[_0x1b5e('0x3f')][_0x1b5e('0x62')]({'where':{'id':_0x5ecadf[_0x1b5e('0x57')]['id']}})['then'](handleEntityNotFound(_0xb395c,null))['then'](function(_0x1010e0){if(_0x1010e0){return _0x1010e0[_0x1b5e('0xdf')](_0x5ecadf[_0x1b5e('0x61')]['ids'],_[_0x1b5e('0xe0')](_0x5ecadf[_0x1b5e('0x61')],[_0x1b5e('0x6c'),'id'])||{})[_0x1b5e('0xa4')](function(_0x279bbe){for(var _0x2d4479=0x0;_0x2d4479<_0x5ecadf[_0x1b5e('0x61')]['ids'][_0x1b5e('0x68')];_0x2d4479+=0x1){socket['emit'](_0x1b5e('0xe1'),{'UserId':Number(_0x5ecadf[_0x1b5e('0x61')][_0x1b5e('0x6c')][_0x2d4479]),'SmsAccountId':Number(_0x5ecadf[_0x1b5e('0x57')]['id'])});}return _0x279bbe;});}})[_0x1b5e('0x38')](respondWithResult(_0xb395c,null))[_0x1b5e('0x29')](handleError(_0xb395c,null));};exports[_0x1b5e('0xe2')]=function(_0x36878a,_0x197187,_0x473ae3){return db[_0x1b5e('0x3f')][_0x1b5e('0x62')]({'where':{'id':_0x36878a[_0x1b5e('0x57')]['id']}})[_0x1b5e('0x38')](handleEntityNotFound(_0x197187,null))[_0x1b5e('0x38')](function(_0x24f8ac){if(_0x24f8ac){return _0x24f8ac[_0x1b5e('0xe2')](_0x36878a[_0x1b5e('0x45')][_0x1b5e('0x6c')])[_0x1b5e('0x38')](function(){if(_[_0x1b5e('0xe3')](_0x36878a['query'][_0x1b5e('0x6c')])){for(var _0x4852bd=0x0;_0x4852bd<_0x36878a[_0x1b5e('0x45')]['ids'][_0x1b5e('0x68')];_0x4852bd+=0x1){socket[_0x1b5e('0xe4')]('userSmsAccount:remove',{'UserId':Number(_0x36878a[_0x1b5e('0x45')][_0x1b5e('0x6c')][_0x4852bd]),'SmsAccountId':Number(_0x36878a[_0x1b5e('0x57')]['id'])});}}else{socket[_0x1b5e('0xe4')](_0x1b5e('0xe5'),{'UserId':Number(_0x36878a[_0x1b5e('0x45')][_0x1b5e('0x6c')]),'SmsAccountId':Number(_0x36878a[_0x1b5e('0x57')]['id'])});}});}})[_0x1b5e('0x38')](respondWithStatusCode(_0x197187,null))[_0x1b5e('0x29')](handleError(_0x197187,null));};exports[_0x1b5e('0xe6')]=function(_0x48709a,_0x34d54a,_0x41d890){var _0xa84da9={};var _0x1d4c6b={};var _0x52bd46;var _0x331805;return db[_0x1b5e('0x3f')][_0x1b5e('0x66')]({'where':{'id':_0x48709a[_0x1b5e('0x57')]['id']}})[_0x1b5e('0x38')](handleEntityNotFound(_0x34d54a,null))[_0x1b5e('0x38')](function(_0xc6d1c9){if(_0xc6d1c9){_0x52bd46=_0xc6d1c9;_0x1d4c6b['model']=_[_0x1b5e('0x44')](db[_0x1b5e('0xac')][_0x1b5e('0x40')]);_0x1d4c6b[_0x1b5e('0x45')]=_[_0x1b5e('0x44')](_0x48709a[_0x1b5e('0x45')]);_0x1d4c6b[_0x1b5e('0x46')]=_['intersection'](_0x1d4c6b[_0x1b5e('0x43')],_0x1d4c6b[_0x1b5e('0x45')]);_0xa84da9[_0x1b5e('0x47')]=_[_0x1b5e('0x48')](_0x1d4c6b[_0x1b5e('0x43')],qs[_0x1b5e('0x49')](_0x48709a['query'][_0x1b5e('0x49')]));_0xa84da9[_0x1b5e('0x47')]=_0xa84da9['attributes']['length']?_0xa84da9[_0x1b5e('0x47')]:_0x1d4c6b[_0x1b5e('0x43')];_0xa84da9[_0x1b5e('0x4b')]=qs[_0x1b5e('0x4c')](_0x48709a[_0x1b5e('0x45')][_0x1b5e('0x4c')]);_0xa84da9[_0x1b5e('0x4d')]=qs['filters'](_[_0x1b5e('0x6a')](_0x48709a[_0x1b5e('0x45')],_0x1d4c6b[_0x1b5e('0x46')]));if(_0x48709a[_0x1b5e('0x45')][_0x1b5e('0x4e')]){_0xa84da9['where']=_[_0x1b5e('0x50')](_0xa84da9['where'],{'$or':_[_0x1b5e('0x3e')](_0xa84da9[_0x1b5e('0x47')],function(_0x2ff7f9){var _0x3949f9={};_0x3949f9[_0x2ff7f9]={'$like':'%'+_0x48709a[_0x1b5e('0x45')][_0x1b5e('0x4e')]+'%'};return _0x3949f9;})});}_0xa84da9=_[_0x1b5e('0x50')]({},_0xa84da9,_0x48709a['options']);return _0x52bd46[_0x1b5e('0xe6')](_0xa84da9);}})[_0x1b5e('0x38')](function(_0x53a10f){if(_0x53a10f){_0x331805=_0x53a10f[_0x1b5e('0x68')];if(!_0x48709a['query'][_0x1b5e('0x4a')](_0x1b5e('0x69'))){_0xa84da9['limit']=qs[_0x1b5e('0x2f')](_0x48709a[_0x1b5e('0x45')]['limit']);_0xa84da9[_0x1b5e('0x2d')]=qs[_0x1b5e('0x2d')](_0x48709a[_0x1b5e('0x45')]['offset']);}return _0x52bd46['getAgents'](_0xa84da9);}})[_0x1b5e('0x38')](function(_0x8be25e){if(_0x8be25e){return _0x8be25e?{'count':_0x331805,'rows':_0x8be25e}:null;}})[_0x1b5e('0x38')](respondWithResult(_0x34d54a,null))[_0x1b5e('0x29')](handleError(_0x34d54a,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index b8f3a23..1f3255a 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 _0x4caa=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xc743f4,_0xa1e2b4){var _0x5b9749=function(_0x1f1dea){while(--_0x1f1dea){_0xc743f4['push'](_0xc743f4['shift']());}};_0x5b9749(++_0xa1e2b4);}(_0x4caa,0xa9));var _0xa4ca=function(_0x55d829,_0x43f06c){_0x55d829=_0x55d829-0x0;var _0x52163b=_0x4caa[_0x55d829];return _0x52163b;};'use strict';var EventEmitter=require(_0xa4ca('0x0'));var SmsAccount=require(_0xa4ca('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xa4ca('0x2')](0x0);var events={'afterCreate':_0xa4ca('0x3'),'afterUpdate':_0xa4ca('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4d5a28){return function(_0xe130dd,_0x5ca31f,_0x9d8cd0){SmsAccountEvents[_0xa4ca('0x5')](_0x4d5a28+':'+_0xe130dd['id'],_0xe130dd);SmsAccountEvents['emit'](_0x4d5a28,_0xe130dd);_0x9d8cd0(null);};}for(var e in events){if(events[_0xa4ca('0x6')](e)){var event=events[e];SmsAccount[_0xa4ca('0x7')](e,emitEvent(event));}}module[_0xa4ca('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0xb9bd=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','SmsAccount','setMaxListeners','update'];(function(_0x2f0c5b,_0x36c6a5){var _0x28a304=function(_0x1caf6a){while(--_0x1caf6a){_0x2f0c5b['push'](_0x2f0c5b['shift']());}};_0x28a304(++_0x36c6a5);}(_0xb9bd,0x136));var _0xdb9b=function(_0xa9b7c,_0x4a8e29){_0xa9b7c=_0xa9b7c-0x0;var _0x423bce=_0xb9bd[_0xa9b7c];return _0x423bce;};'use strict';var EventEmitter=require(_0xdb9b('0x0'));var SmsAccount=require(_0xdb9b('0x1'))['db'][_0xdb9b('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xdb9b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdb9b('0x4'),'afterDestroy':_0xdb9b('0x5')};function emitEvent(_0x4a6eb0){return function(_0x504e9f,_0x2010b2,_0xcc0a27){SmsAccountEvents[_0xdb9b('0x6')](_0x4a6eb0+':'+_0x504e9f['id'],_0x504e9f);SmsAccountEvents[_0xdb9b('0x6')](_0x4a6eb0,_0x504e9f);_0xcc0a27(null);};}for(var e in events){if(events[_0xdb9b('0x7')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xdb9b('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 898b026..a78828b 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 _0x6519=['../../config/environment','exports','define','SmsAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4ba2c7,_0x5b3928){var _0x1a4b1d=function(_0x420ae8){while(--_0x420ae8){_0x4ba2c7['push'](_0x4ba2c7['shift']());}};_0x1a4b1d(++_0x5b3928);}(_0x6519,0x163));var _0x9651=function(_0x6465b0,_0x45653a){_0x6465b0=_0x6465b0-0x0;var _0x4884fe=_0x6519[_0x6465b0];return _0x4884fe;};'use strict';var _=require(_0x9651('0x0'));var util=require(_0x9651('0x1'));var logger=require(_0x9651('0x2'))(_0x9651('0x3'));var moment=require(_0x9651('0x4'));var BPromise=require(_0x9651('0x5'));var rp=require(_0x9651('0x6'));var fs=require('fs');var path=require(_0x9651('0x7'));var rimraf=require(_0x9651('0x8'));var config=require(_0x9651('0x9'));var attributes=require('./smsAccount.attributes');module[_0x9651('0xa')]=function(_0x54891a,_0x298278){return _0x54891a[_0x9651('0xb')](_0x9651('0xc'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72a0=['lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes','SmsAccount','sms_accounts'];(function(_0x7b5cdd,_0x8c88d8){var _0x3a29ae=function(_0x17859a){while(--_0x17859a){_0x7b5cdd['push'](_0x7b5cdd['shift']());}};_0x3a29ae(++_0x8c88d8);}(_0x72a0,0x1b8));var _0x072a=function(_0x2fc2df,_0x14b59b){_0x2fc2df=_0x2fc2df-0x0;var _0x521bf5=_0x72a0[_0x2fc2df];return _0x521bf5;};'use strict';var _=require(_0x072a('0x0'));var util=require(_0x072a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x072a('0x2'));var BPromise=require(_0x072a('0x3'));var rp=require(_0x072a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x072a('0x5'));var config=require(_0x072a('0x6'));var attributes=require(_0x072a('0x7'));module['exports']=function(_0x3dad5a,_0x401e56){return _0x3dad5a['define'](_0x072a('0x8'),attributes,{'tableName':_0x072a('0x9'),'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 bdc7f4b..b02e192 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 _0xae94=['map','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./smsAccount.socket','then','info','SmsAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','ShowSmsAccount','SmsAccount','options','raw','where','attributes','include','model'];(function(_0x3f6618,_0x11837b){var _0x3b4ee7=function(_0x457e20){while(--_0x457e20){_0x3f6618['push'](_0x3f6618['shift']());}};_0x3b4ee7(++_0x11837b);}(_0xae94,0x112));var _0x4ae9=function(_0x4db066,_0x544e78){_0x4db066=_0x4db066-0x0;var _0x4ca40f=_0xae94[_0x4db066];return _0x4ca40f;};'use strict';var _=require('lodash');var util=require(_0x4ae9('0x0'));var moment=require(_0x4ae9('0x1'));var BPromise=require(_0x4ae9('0x2'));var rs=require(_0x4ae9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ae9('0x4'))['db'];var utils=require(_0x4ae9('0x5'));var logger=require(_0x4ae9('0x6'))(_0x4ae9('0x7'));var config=require(_0x4ae9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4ae9('0x9')][_0x4ae9('0xa')]({'port':0x232a});config[_0x4ae9('0xb')]=_[_0x4ae9('0xc')](config[_0x4ae9('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4ae9('0xb')]));require(_0x4ae9('0xd'))['register'](socket);function respondWithRpcPromise(_0x3947a1,_0x2d4ee1,_0x2c1e06){return new BPromise(function(_0x3a3325,_0x424989){return client['request'](_0x3947a1,_0x2c1e06)[_0x4ae9('0xe')](function(_0x2115d3){logger[_0x4ae9('0xf')](_0x4ae9('0x10'),_0x2d4ee1,'request\x20sent');logger[_0x4ae9('0x11')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2d4ee1,_0x4ae9('0x12'),JSON['stringify'](_0x2115d3));if(_0x2115d3[_0x4ae9('0x13')]){if(_0x2115d3[_0x4ae9('0x13')][_0x4ae9('0x14')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x2d4ee1,_0x2115d3[_0x4ae9('0x13')][_0x4ae9('0x15')]);return _0x424989(_0x2115d3[_0x4ae9('0x13')][_0x4ae9('0x15')]);}logger[_0x4ae9('0x13')](_0x4ae9('0x10'),_0x2d4ee1,_0x2115d3[_0x4ae9('0x13')][_0x4ae9('0x15')]);return _0x3a3325(_0x2115d3[_0x4ae9('0x13')][_0x4ae9('0x15')]);}else{logger[_0x4ae9('0xf')]('SmsAccount,\x20%s,\x20%s',_0x2d4ee1,_0x4ae9('0x12'));_0x3a3325(_0x2115d3[_0x4ae9('0x16')][_0x4ae9('0x15')]);}})[_0x4ae9('0x17')](function(_0x4d9f0a){logger['error']('SmsAccount,\x20%s,\x20%s',_0x2d4ee1,_0x4d9f0a);_0x424989(_0x4d9f0a);});});}exports[_0x4ae9('0x18')]=function(_0x315d28){var _0x160f07=this;return new Promise(function(_0x50c4b7,_0x2c544f){return db[_0x4ae9('0x19')]['find']({'raw':_0x315d28[_0x4ae9('0x1a')]?_0x315d28[_0x4ae9('0x1a')][_0x4ae9('0x1b')]===undefined?!![]:![]:!![],'where':_0x315d28[_0x4ae9('0x1a')]?_0x315d28[_0x4ae9('0x1a')][_0x4ae9('0x1c')]||null:null,'attributes':_0x315d28[_0x4ae9('0x1a')]?_0x315d28[_0x4ae9('0x1a')][_0x4ae9('0x1d')]||null:null,'include':_0x315d28[_0x4ae9('0x1a')]?_0x315d28[_0x4ae9('0x1a')][_0x4ae9('0x1e')]?_['map'](_0x315d28[_0x4ae9('0x1a')][_0x4ae9('0x1e')],function(_0x2703fe){return{'model':db[_0x2703fe[_0x4ae9('0x1f')]],'as':_0x2703fe['as'],'attributes':_0x2703fe[_0x4ae9('0x1d')],'include':_0x2703fe[_0x4ae9('0x1e')]?_[_0x4ae9('0x20')](_0x2703fe[_0x4ae9('0x1e')],function(_0x55544a){return{'model':db[_0x55544a[_0x4ae9('0x1f')]],'as':_0x55544a['as'],'attributes':_0x55544a[_0x4ae9('0x1d')],'include':_0x55544a[_0x4ae9('0x1e')]?_[_0x4ae9('0x20')](_0x55544a['include'],function(_0x3ff393){return{'model':db[_0x3ff393['model']],'as':_0x3ff393['as'],'attributes':_0x3ff393[_0x4ae9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4ae9('0xe')](function(_0x598a3c){logger[_0x4ae9('0xf')](_0x4ae9('0x18'),_0x315d28);logger[_0x4ae9('0x11')](_0x4ae9('0x18'),_0x315d28,JSON[_0x4ae9('0x21')](_0x598a3c));_0x50c4b7(_0x598a3c);})['catch'](function(_0x540f66){logger[_0x4ae9('0x13')]('ShowSmsAccount',_0x540f66[_0x4ae9('0x15')],_0x315d28);_0x2c544f(_0x160f07['error'](0x1f4,_0x540f66[_0x4ae9('0x15')]));});});}; \ No newline at end of file +var _0x9a62=['jayson/promise','client','http','redis','socket.io-emitter','register','request','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x4b6db3,_0x4bfef8){var _0x5797ff=function(_0x574adf){while(--_0x574adf){_0x4b6db3['push'](_0x4b6db3['shift']());}};_0x5797ff(++_0x4bfef8);}(_0x9a62,0x1a8));var _0x29a6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9a62[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x29a6('0x0'));var util=require(_0x29a6('0x1'));var moment=require(_0x29a6('0x2'));var BPromise=require(_0x29a6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x29a6('0x4'));var db=require(_0x29a6('0x5'))['db'];var utils=require(_0x29a6('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x29a6('0x7'));var jayson=require(_0x29a6('0x8'));var client=jayson[_0x29a6('0x9')][_0x29a6('0xa')]({'port':0x232a});config[_0x29a6('0xb')]=_['defaults'](config[_0x29a6('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x29a6('0xc'))(new Redis(config[_0x29a6('0xb')]));require('./smsAccount.socket')[_0x29a6('0xd')](socket);function respondWithRpcPromise(_0x3a5d8b,_0x1e7395,_0x38f074){return new BPromise(function(_0x36ae76,_0x21a16c){return client[_0x29a6('0xe')](_0x3a5d8b,_0x38f074)[_0x29a6('0xf')](function(_0x594662){logger[_0x29a6('0x10')](_0x29a6('0x11'),_0x1e7395,'request\x20sent');logger['debug'](_0x29a6('0x12'),_0x1e7395,_0x29a6('0x13'),JSON[_0x29a6('0x14')](_0x594662));if(_0x594662[_0x29a6('0x15')]){if(_0x594662[_0x29a6('0x15')][_0x29a6('0x16')]===0x1f4){logger['error'](_0x29a6('0x11'),_0x1e7395,_0x594662[_0x29a6('0x15')][_0x29a6('0x17')]);return _0x21a16c(_0x594662['error']['message']);}logger[_0x29a6('0x15')](_0x29a6('0x11'),_0x1e7395,_0x594662[_0x29a6('0x15')][_0x29a6('0x17')]);return _0x36ae76(_0x594662[_0x29a6('0x15')][_0x29a6('0x17')]);}else{logger[_0x29a6('0x10')](_0x29a6('0x11'),_0x1e7395,'request\x20sent');_0x36ae76(_0x594662[_0x29a6('0x18')][_0x29a6('0x17')]);}})[_0x29a6('0x19')](function(_0x22ab8b){logger[_0x29a6('0x15')](_0x29a6('0x11'),_0x1e7395,_0x22ab8b);_0x21a16c(_0x22ab8b);});});}exports[_0x29a6('0x1a')]=function(_0x3e9e16){var _0x54ecd4=this;return new Promise(function(_0x7c9baf,_0x3cea11){return db[_0x29a6('0x1b')][_0x29a6('0x1c')]({'raw':_0x3e9e16[_0x29a6('0x1d')]?_0x3e9e16[_0x29a6('0x1d')][_0x29a6('0x1e')]===undefined?!![]:![]:!![],'where':_0x3e9e16['options']?_0x3e9e16[_0x29a6('0x1d')][_0x29a6('0x1f')]||null:null,'attributes':_0x3e9e16[_0x29a6('0x1d')]?_0x3e9e16[_0x29a6('0x1d')][_0x29a6('0x20')]||null:null,'include':_0x3e9e16[_0x29a6('0x1d')]?_0x3e9e16['options'][_0x29a6('0x21')]?_[_0x29a6('0x22')](_0x3e9e16['options'][_0x29a6('0x21')],function(_0x2e5c8c){return{'model':db[_0x2e5c8c[_0x29a6('0x23')]],'as':_0x2e5c8c['as'],'attributes':_0x2e5c8c[_0x29a6('0x20')],'include':_0x2e5c8c['include']?_[_0x29a6('0x22')](_0x2e5c8c[_0x29a6('0x21')],function(_0x14abc1){return{'model':db[_0x14abc1[_0x29a6('0x23')]],'as':_0x14abc1['as'],'attributes':_0x14abc1[_0x29a6('0x20')],'include':_0x14abc1['include']?_['map'](_0x14abc1['include'],function(_0x3bdbcf){return{'model':db[_0x3bdbcf['model']],'as':_0x3bdbcf['as'],'attributes':_0x3bdbcf[_0x29a6('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30d98f){logger[_0x29a6('0x10')](_0x29a6('0x1a'),_0x3e9e16);logger['debug'](_0x29a6('0x1a'),_0x3e9e16,JSON[_0x29a6('0x14')](_0x30d98f));_0x7c9baf(_0x30d98f);})[_0x29a6('0x19')](function(_0x1fc82f){logger[_0x29a6('0x15')]('ShowSmsAccount',_0x1fc82f[_0x29a6('0x17')],_0x3e9e16);_0x3cea11(_0x54ecd4[_0x29a6('0x15')](0x1f4,_0x1fc82f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index fd55d88..e002386 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 3dfd9c3..02fbc7a 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(_0x1ca5f6,_0xf2c82c){var _0x3935c4=function(_0x290058){while(--_0x290058){_0x1ca5f6['push'](_0x1ca5f6['shift']());}};_0x3935c4(++_0xf2c82c);}(_0x55ca,0x126));var _0xa55c=function(_0xf273f9,_0x486198){_0xf273f9=_0xf273f9-0x0;var _0xb4abcc=_0x55ca[_0xf273f9];return _0xb4abcc;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file +var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x430207,_0x56998c){var _0x202b7d=function(_0x559e81){while(--_0x559e81){_0x430207['push'](_0x430207['shift']());}};_0x202b7d(++_0x56998c);}(_0xedd9,0xfc));var _0x9edd=function(_0x2c35ee,_0x50630c){_0x2c35ee=_0x2c35ee-0x0;var _0x2bb24f=_0xedd9[_0x2c35ee];return _0x2bb24f;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 7cec92c..237efa7 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 _0x553e=['STRING','*,*,*,*','exports','noop'];(function(_0x3c5816,_0x2c76cd){var _0x4bc006=function(_0x36d006){while(--_0x36d006){_0x3c5816['push'](_0x3c5816['shift']());}};_0x4bc006(++_0x2c76cd);}(_0x553e,0x11a));var _0xe553=function(_0x459a5c,_0x5988fa){_0x459a5c=_0x459a5c-0x0;var _0x5b6688=_0x553e[_0x459a5c];return _0x5b6688;};'use strict';var Sequelize=require('sequelize');module[_0xe553('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe553('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe553('0x2')]},'interval':{'type':Sequelize[_0xe553('0x2')],'defaultValue':_0xe553('0x3')}}; \ No newline at end of file +var _0x1a90=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x52c076,_0x3adfa7){var _0x10fb4a=function(_0x5e324e){while(--_0x5e324e){_0x52c076['push'](_0x52c076['shift']());}};_0x10fb4a(++_0x3adfa7);}(_0x1a90,0xe7));var _0x01a9=function(_0x1ac278,_0x516547){_0x1ac278=_0x1ac278-0x0;var _0x4773de=_0x1a90[_0x1ac278];return _0x4773de;};'use strict';var Sequelize=require(_0x01a9('0x0'));module[_0x01a9('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x01a9('0x2')],'allowNull':![],'defaultValue':_0x01a9('0x3')},'appdata':{'type':Sequelize[_0x01a9('0x4')]()},'description':{'type':Sequelize[_0x01a9('0x2')]},'interval':{'type':Sequelize[_0x01a9('0x2')],'defaultValue':_0x01a9('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index dde3854..491618c 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 _0x338a=['../../config/license/util','../../mysqldb','end','json','offset','undefined','count','status','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','SmsApplication','rawAttributes','type','key','query','keys','filters','attributes','intersection','fields','length','model','nolimit','limit','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','create','body','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x55c979,_0x36c5f0){var _0x690107=function(_0xa61dad){while(--_0xa61dad){_0x55c979['push'](_0x55c979['shift']());}};_0x690107(++_0x36c5f0);}(_0x338a,0x199));var _0xa338=function(_0x19d8db,_0x35d6bc){_0x19d8db=_0x19d8db-0x0;var _0x31f242=_0x338a[_0x19d8db];return _0x31f242;};'use strict';var emlformat=require(_0xa338('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa338('0x1'));var rp=require(_0xa338('0x2'));var moment=require(_0xa338('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa338('0x4'));var util=require(_0xa338('0x5'));var path=require(_0xa338('0x6'));var sox=require(_0xa338('0x7'));var csv=require('to-csv');var ejs=require(_0xa338('0x8'));var fs=require('fs');var fs_extra=require(_0xa338('0x9'));var _=require('lodash');var squel=require(_0xa338('0xa'));var crypto=require(_0xa338('0xb'));var jsforce=require(_0xa338('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa338('0xd'));var querystring=require(_0xa338('0xe'));var Papa=require(_0xa338('0xf'));var Redis=require(_0xa338('0x10'));var authService=require(_0xa338('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa338('0x12'));var hardwareService=require(_0xa338('0x13'));var logger=require(_0xa338('0x14'))(_0xa338('0x15'));var utils=require(_0xa338('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa338('0x17'));var db=require(_0xa338('0x18'))['db'];function respondWithStatusCode(_0x3cfc45,_0x13a4a3){_0x13a4a3=_0x13a4a3||0xcc;return function(_0x374b45){if(_0x374b45){return _0x3cfc45['sendStatus'](_0x13a4a3);}return _0x3cfc45['status'](_0x13a4a3)[_0xa338('0x19')]();};}function respondWithResult(_0x9f655a,_0x32133c){_0x32133c=_0x32133c||0xc8;return function(_0x4ef7c5){if(_0x4ef7c5){return _0x9f655a['status'](_0x32133c)[_0xa338('0x1a')](_0x4ef7c5);}};}function respondWithFilteredResult(_0x5364c0,_0x50c045){return function(_0x552eeb){if(_0x552eeb){var _0x1b3eb9=typeof _0x50c045[_0xa338('0x1b')]===_0xa338('0x1c')&&typeof _0x50c045['limit']===_0xa338('0x1c');var _0x3be8b7=_0x552eeb[_0xa338('0x1d')];var _0x79943b=_0x1b3eb9?0x0:_0x50c045[_0xa338('0x1b')];var _0x19a967=_0x1b3eb9?_0x552eeb[_0xa338('0x1d')]:_0x50c045[_0xa338('0x1b')]+_0x50c045['limit'];var _0x305eb3;if(_0x19a967>=_0x3be8b7){_0x19a967=_0x3be8b7;_0x305eb3=0xc8;}else{_0x305eb3=0xce;}_0x5364c0[_0xa338('0x1e')](_0x305eb3);return _0x5364c0[_0xa338('0x1f')](_0xa338('0x20'),_0x79943b+'-'+_0x19a967+'/'+_0x3be8b7)['json'](_0x552eeb);}return null;};}function patchUpdates(_0x9f7c78){return function(_0x26efed){try{jsonpatch['apply'](_0x26efed,_0x9f7c78,!![]);}catch(_0x16499c){return BPromise[_0xa338('0x21')](_0x16499c);}return _0x26efed[_0xa338('0x22')]();};}function saveUpdates(_0x44bca6,_0x3c982e){return function(_0x2145c3){if(_0x2145c3){return _0x2145c3[_0xa338('0x23')](_0x44bca6)['then'](function(_0x41ca83){return _0x41ca83;});}return null;};}function removeEntity(_0x85f7b0,_0x2c1fc0){return function(_0x3cf2e3){if(_0x3cf2e3){return _0x3cf2e3[_0xa338('0x24')]()[_0xa338('0x25')](function(){_0x85f7b0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x53d0f7,_0x3c0449){return function(_0x29ef94){if(!_0x29ef94){_0x53d0f7[_0xa338('0x26')](0x194);}return _0x29ef94;};}function handleError(_0x430241,_0x2131d6){_0x2131d6=_0x2131d6||0x1f4;return function(_0x3d30ec){logger[_0xa338('0x27')](_0x3d30ec[_0xa338('0x28')]);if(_0x3d30ec[_0xa338('0x29')]){delete _0x3d30ec['name'];}_0x430241[_0xa338('0x1e')](_0x2131d6)[_0xa338('0x2a')](_0x3d30ec);};}exports[_0xa338('0x2b')]=function(_0x57e5d6,_0x1b9214){var _0x1a87bd={},_0x5e8e75={},_0x5ad676={'count':0x0,'rows':[]};var _0x321e38=_[_0xa338('0x2c')](db[_0xa338('0x2d')][_0xa338('0x2e')],function(_0x45295a){return{'name':_0x45295a['fieldName'],'type':_0x45295a[_0xa338('0x2f')][_0xa338('0x30')]};});_0x5e8e75['model']=_[_0xa338('0x2c')](_0x321e38,_0xa338('0x29'));_0x5e8e75[_0xa338('0x31')]=_[_0xa338('0x32')](_0x57e5d6[_0xa338('0x31')]);_0x5e8e75[_0xa338('0x33')]=_['intersection'](_0x5e8e75['model'],_0x5e8e75[_0xa338('0x31')]);_0x1a87bd[_0xa338('0x34')]=_[_0xa338('0x35')](_0x5e8e75['model'],qs[_0xa338('0x36')](_0x57e5d6[_0xa338('0x31')]['fields']));_0x1a87bd['attributes']=_0x1a87bd['attributes'][_0xa338('0x37')]?_0x1a87bd[_0xa338('0x34')]:_0x5e8e75[_0xa338('0x38')];if(!_0x57e5d6['query']['hasOwnProperty'](_0xa338('0x39'))){_0x1a87bd[_0xa338('0x3a')]=qs[_0xa338('0x3a')](_0x57e5d6['query'][_0xa338('0x3a')]);_0x1a87bd[_0xa338('0x1b')]=qs[_0xa338('0x1b')](_0x57e5d6['query'][_0xa338('0x1b')]);}_0x1a87bd['order']=qs['sort'](_0x57e5d6[_0xa338('0x31')]['sort']);_0x1a87bd['where']=qs[_0xa338('0x33')](_['pick'](_0x57e5d6['query'],_0x5e8e75[_0xa338('0x33')]),_0x321e38);if(_0x57e5d6[_0xa338('0x31')][_0xa338('0x3b')]){_0x1a87bd[_0xa338('0x3c')]=_[_0xa338('0x3d')](_0x1a87bd[_0xa338('0x3c')],{'$or':_[_0xa338('0x2c')](_0x321e38,function(_0x53219e){if(_0x53219e[_0xa338('0x2f')]!==_0xa338('0x3e')){var _0x4eca83={};_0x4eca83[_0x53219e['name']]={'$like':'%'+_0x57e5d6[_0xa338('0x31')][_0xa338('0x3b')]+'%'};return _0x4eca83;}})});}_0x1a87bd=_[_0xa338('0x3d')]({},_0x1a87bd,_0x57e5d6[_0xa338('0x3f')]);var _0x162fa1={'where':_0x1a87bd[_0xa338('0x3c')]};return db['SmsApplication'][_0xa338('0x1d')](_0x162fa1)[_0xa338('0x25')](function(_0x5cf934){_0x5ad676[_0xa338('0x1d')]=_0x5cf934;if(_0x57e5d6['query'][_0xa338('0x40')]){_0x1a87bd['include']=[{'all':!![]}];}return db[_0xa338('0x2d')]['findAll'](_0x1a87bd);})[_0xa338('0x25')](function(_0x127060){_0x5ad676[_0xa338('0x41')]=_0x127060;return _0x5ad676;})[_0xa338('0x25')](respondWithFilteredResult(_0x1b9214,_0x1a87bd))[_0xa338('0x42')](handleError(_0x1b9214,null));};exports[_0xa338('0x43')]=function(_0x2d1da0,_0x2df3b8){var _0x5df8e7={'raw':!![],'where':{'id':_0x2d1da0[_0xa338('0x44')]['id']}},_0x3a7d6e={};_0x3a7d6e['model']=_['keys'](db['SmsApplication']['rawAttributes']);_0x3a7d6e[_0xa338('0x31')]=_[_0xa338('0x32')](_0x2d1da0[_0xa338('0x31')]);_0x3a7d6e[_0xa338('0x33')]=_[_0xa338('0x35')](_0x3a7d6e[_0xa338('0x38')],_0x3a7d6e[_0xa338('0x31')]);_0x5df8e7['attributes']=_[_0xa338('0x35')](_0x3a7d6e[_0xa338('0x38')],qs[_0xa338('0x36')](_0x2d1da0[_0xa338('0x31')][_0xa338('0x36')]));_0x5df8e7[_0xa338('0x34')]=_0x5df8e7[_0xa338('0x34')]['length']?_0x5df8e7[_0xa338('0x34')]:_0x3a7d6e[_0xa338('0x38')];if(_0x2d1da0[_0xa338('0x31')][_0xa338('0x40')]){_0x5df8e7[_0xa338('0x45')]=[{'all':!![]}];}_0x5df8e7=_[_0xa338('0x3d')]({},_0x5df8e7,_0x2d1da0[_0xa338('0x3f')]);return db[_0xa338('0x2d')]['find'](_0x5df8e7)[_0xa338('0x25')](handleEntityNotFound(_0x2df3b8,null))[_0xa338('0x25')](respondWithResult(_0x2df3b8,null))[_0xa338('0x42')](handleError(_0x2df3b8,null));};exports[_0xa338('0x46')]=function(_0x3f3ad6,_0x485ffb){return db['SmsApplication'][_0xa338('0x46')](_0x3f3ad6[_0xa338('0x47')],{})[_0xa338('0x25')](respondWithResult(_0x485ffb,0xc9))['catch'](handleError(_0x485ffb,null));};exports['update']=function(_0x5cf0f5,_0x2302b7){if(_0x5cf0f5[_0xa338('0x47')]['id']){delete _0x5cf0f5[_0xa338('0x47')]['id'];}return db['SmsApplication']['find']({'where':{'id':_0x5cf0f5[_0xa338('0x44')]['id']}})['then'](handleEntityNotFound(_0x2302b7,null))[_0xa338('0x25')](saveUpdates(_0x5cf0f5[_0xa338('0x47')],null))[_0xa338('0x25')](respondWithResult(_0x2302b7,null))[_0xa338('0x42')](handleError(_0x2302b7,null));};exports['destroy']=function(_0xddb11b,_0x4cd56f){return db[_0xa338('0x2d')]['find']({'where':{'id':_0xddb11b[_0xa338('0x44')]['id']}})[_0xa338('0x25')](handleEntityNotFound(_0x4cd56f,null))[_0xa338('0x25')](removeEntity(_0x4cd56f,null))[_0xa338('0x42')](handleError(_0x4cd56f,null));}; \ No newline at end of file +var _0xce17=['findAll','show','params','find','create','body','catch','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','key','keys','query','filters','model','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xce17,0x1d5));var _0x7ce1=function(_0x1b8d87,_0x4168fb){_0x1b8d87=_0x1b8d87-0x0;var _0x182b74=_0xce17[_0x1b8d87];return _0x182b74;};'use strict';var emlformat=require(_0x7ce1('0x0'));var rimraf=require(_0x7ce1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7ce1('0x2'));var moment=require('moment');var BPromise=require(_0x7ce1('0x3'));var Mustache=require(_0x7ce1('0x4'));var util=require(_0x7ce1('0x5'));var path=require(_0x7ce1('0x6'));var sox=require(_0x7ce1('0x7'));var csv=require(_0x7ce1('0x8'));var ejs=require(_0x7ce1('0x9'));var fs=require('fs');var fs_extra=require(_0x7ce1('0xa'));var _=require(_0x7ce1('0xb'));var squel=require('squel');var crypto=require(_0x7ce1('0xc'));var jsforce=require(_0x7ce1('0xd'));var deskjs=require(_0x7ce1('0xe'));var toCsv=require(_0x7ce1('0x8'));var querystring=require(_0x7ce1('0xf'));var Papa=require(_0x7ce1('0x10'));var Redis=require(_0x7ce1('0x11'));var authService=require(_0x7ce1('0x12'));var qs=require(_0x7ce1('0x13'));var as=require(_0x7ce1('0x14'));var hardwareService=require(_0x7ce1('0x15'));var logger=require(_0x7ce1('0x16'))(_0x7ce1('0x17'));var utils=require('../../config/utils');var config=require(_0x7ce1('0x18'));var licenseUtil=require(_0x7ce1('0x19'));var db=require(_0x7ce1('0x1a'))['db'];function respondWithStatusCode(_0x537c65,_0x4f132f){_0x4f132f=_0x4f132f||0xcc;return function(_0x4f19fd){if(_0x4f19fd){return _0x537c65[_0x7ce1('0x1b')](_0x4f132f);}return _0x537c65[_0x7ce1('0x1c')](_0x4f132f)[_0x7ce1('0x1d')]();};}function respondWithResult(_0x5b5bda,_0x39a44d){_0x39a44d=_0x39a44d||0xc8;return function(_0x285cf9){if(_0x285cf9){return _0x5b5bda[_0x7ce1('0x1c')](_0x39a44d)[_0x7ce1('0x1e')](_0x285cf9);}};}function respondWithFilteredResult(_0x425197,_0x4421de){return function(_0x15723d){if(_0x15723d){var _0x109249=typeof _0x4421de[_0x7ce1('0x1f')]===_0x7ce1('0x20')&&typeof _0x4421de[_0x7ce1('0x21')]===_0x7ce1('0x20');var _0x391975=_0x15723d['count'];var _0x170d99=_0x109249?0x0:_0x4421de['offset'];var _0x26d417=_0x109249?_0x15723d[_0x7ce1('0x22')]:_0x4421de[_0x7ce1('0x1f')]+_0x4421de['limit'];var _0x18b01f;if(_0x26d417>=_0x391975){_0x26d417=_0x391975;_0x18b01f=0xc8;}else{_0x18b01f=0xce;}_0x425197[_0x7ce1('0x1c')](_0x18b01f);return _0x425197[_0x7ce1('0x23')]('Content-Range',_0x170d99+'-'+_0x26d417+'/'+_0x391975)[_0x7ce1('0x1e')](_0x15723d);}return null;};}function patchUpdates(_0x424b03){return function(_0x3245cc){try{jsonpatch[_0x7ce1('0x24')](_0x3245cc,_0x424b03,!![]);}catch(_0x5314bb){return BPromise['reject'](_0x5314bb);}return _0x3245cc[_0x7ce1('0x25')]();};}function saveUpdates(_0x96936a,_0x3fc265){return function(_0x2cc6bc){if(_0x2cc6bc){return _0x2cc6bc[_0x7ce1('0x26')](_0x96936a)[_0x7ce1('0x27')](function(_0x12c7ae){return _0x12c7ae;});}return null;};}function removeEntity(_0x3b2273,_0x3cf280){return function(_0x1da67f){if(_0x1da67f){return _0x1da67f[_0x7ce1('0x28')]()[_0x7ce1('0x27')](function(){_0x3b2273[_0x7ce1('0x1c')](0xcc)[_0x7ce1('0x1d')]();});}};}function handleEntityNotFound(_0x481c55,_0x1ca99c){return function(_0x400cd5){if(!_0x400cd5){_0x481c55['sendStatus'](0x194);}return _0x400cd5;};}function handleError(_0x2a9b57,_0x58bbed){_0x58bbed=_0x58bbed||0x1f4;return function(_0x39a2fc){logger[_0x7ce1('0x29')](_0x39a2fc[_0x7ce1('0x2a')]);if(_0x39a2fc[_0x7ce1('0x2b')]){delete _0x39a2fc[_0x7ce1('0x2b')];}_0x2a9b57[_0x7ce1('0x1c')](_0x58bbed)[_0x7ce1('0x2c')](_0x39a2fc);};}exports[_0x7ce1('0x2d')]=function(_0x1778ff,_0x1fe603){var _0x203ece={},_0x3ca2fa={},_0x25c508={'count':0x0,'rows':[]};var _0x6f64d4=_[_0x7ce1('0x2e')](db[_0x7ce1('0x2f')][_0x7ce1('0x30')],function(_0x111c53){return{'name':_0x111c53[_0x7ce1('0x31')],'type':_0x111c53['type'][_0x7ce1('0x32')]};});_0x3ca2fa['model']=_['map'](_0x6f64d4,_0x7ce1('0x2b'));_0x3ca2fa['query']=_[_0x7ce1('0x33')](_0x1778ff[_0x7ce1('0x34')]);_0x3ca2fa[_0x7ce1('0x35')]=_['intersection'](_0x3ca2fa[_0x7ce1('0x36')],_0x3ca2fa['query']);_0x203ece['attributes']=_[_0x7ce1('0x37')](_0x3ca2fa[_0x7ce1('0x36')],qs[_0x7ce1('0x38')](_0x1778ff[_0x7ce1('0x34')][_0x7ce1('0x38')]));_0x203ece[_0x7ce1('0x39')]=_0x203ece['attributes'][_0x7ce1('0x3a')]?_0x203ece[_0x7ce1('0x39')]:_0x3ca2fa['model'];if(!_0x1778ff[_0x7ce1('0x34')]['hasOwnProperty'](_0x7ce1('0x3b'))){_0x203ece[_0x7ce1('0x21')]=qs[_0x7ce1('0x21')](_0x1778ff['query'][_0x7ce1('0x21')]);_0x203ece[_0x7ce1('0x1f')]=qs[_0x7ce1('0x1f')](_0x1778ff[_0x7ce1('0x34')][_0x7ce1('0x1f')]);}_0x203ece[_0x7ce1('0x3c')]=qs[_0x7ce1('0x3d')](_0x1778ff[_0x7ce1('0x34')][_0x7ce1('0x3d')]);_0x203ece[_0x7ce1('0x3e')]=qs[_0x7ce1('0x35')](_[_0x7ce1('0x3f')](_0x1778ff[_0x7ce1('0x34')],_0x3ca2fa[_0x7ce1('0x35')]),_0x6f64d4);if(_0x1778ff[_0x7ce1('0x34')][_0x7ce1('0x40')]){_0x203ece[_0x7ce1('0x3e')]=_[_0x7ce1('0x41')](_0x203ece[_0x7ce1('0x3e')],{'$or':_['map'](_0x6f64d4,function(_0x4a00c0){if(_0x4a00c0[_0x7ce1('0x42')]!=='VIRTUAL'){var _0x47f17b={};_0x47f17b[_0x4a00c0[_0x7ce1('0x2b')]]={'$like':'%'+_0x1778ff[_0x7ce1('0x34')][_0x7ce1('0x40')]+'%'};return _0x47f17b;}})});}_0x203ece=_[_0x7ce1('0x41')]({},_0x203ece,_0x1778ff[_0x7ce1('0x43')]);var _0x557670={'where':_0x203ece['where']};return db[_0x7ce1('0x2f')][_0x7ce1('0x22')](_0x557670)[_0x7ce1('0x27')](function(_0x22274d){_0x25c508[_0x7ce1('0x22')]=_0x22274d;if(_0x1778ff[_0x7ce1('0x34')][_0x7ce1('0x44')]){_0x203ece[_0x7ce1('0x45')]=[{'all':!![]}];}return db['SmsApplication'][_0x7ce1('0x46')](_0x203ece);})['then'](function(_0x58279e){_0x25c508['rows']=_0x58279e;return _0x25c508;})['then'](respondWithFilteredResult(_0x1fe603,_0x203ece))['catch'](handleError(_0x1fe603,null));};exports[_0x7ce1('0x47')]=function(_0x5097e9,_0x1410de){var _0x10fff0={'raw':!![],'where':{'id':_0x5097e9[_0x7ce1('0x48')]['id']}},_0x42a2d8={};_0x42a2d8[_0x7ce1('0x36')]=_[_0x7ce1('0x33')](db[_0x7ce1('0x2f')][_0x7ce1('0x30')]);_0x42a2d8[_0x7ce1('0x34')]=_[_0x7ce1('0x33')](_0x5097e9['query']);_0x42a2d8['filters']=_[_0x7ce1('0x37')](_0x42a2d8[_0x7ce1('0x36')],_0x42a2d8['query']);_0x10fff0['attributes']=_['intersection'](_0x42a2d8[_0x7ce1('0x36')],qs[_0x7ce1('0x38')](_0x5097e9[_0x7ce1('0x34')][_0x7ce1('0x38')]));_0x10fff0[_0x7ce1('0x39')]=_0x10fff0['attributes'][_0x7ce1('0x3a')]?_0x10fff0[_0x7ce1('0x39')]:_0x42a2d8[_0x7ce1('0x36')];if(_0x5097e9[_0x7ce1('0x34')][_0x7ce1('0x44')]){_0x10fff0[_0x7ce1('0x45')]=[{'all':!![]}];}_0x10fff0=_[_0x7ce1('0x41')]({},_0x10fff0,_0x5097e9[_0x7ce1('0x43')]);return db[_0x7ce1('0x2f')][_0x7ce1('0x49')](_0x10fff0)[_0x7ce1('0x27')](handleEntityNotFound(_0x1410de,null))[_0x7ce1('0x27')](respondWithResult(_0x1410de,null))['catch'](handleError(_0x1410de,null));};exports[_0x7ce1('0x4a')]=function(_0x31965a,_0x212b21){return db[_0x7ce1('0x2f')][_0x7ce1('0x4a')](_0x31965a[_0x7ce1('0x4b')],{})['then'](respondWithResult(_0x212b21,0xc9))[_0x7ce1('0x4c')](handleError(_0x212b21,null));};exports['update']=function(_0x59dcb0,_0x4f4c65){if(_0x59dcb0[_0x7ce1('0x4b')]['id']){delete _0x59dcb0[_0x7ce1('0x4b')]['id'];}return db[_0x7ce1('0x2f')][_0x7ce1('0x49')]({'where':{'id':_0x59dcb0[_0x7ce1('0x48')]['id']}})[_0x7ce1('0x27')](handleEntityNotFound(_0x4f4c65,null))['then'](saveUpdates(_0x59dcb0[_0x7ce1('0x4b')],null))['then'](respondWithResult(_0x4f4c65,null))[_0x7ce1('0x4c')](handleError(_0x4f4c65,null));};exports[_0x7ce1('0x28')]=function(_0x337780,_0x5c91d1){return db[_0x7ce1('0x2f')][_0x7ce1('0x49')]({'where':{'id':_0x337780[_0x7ce1('0x48')]['id']}})[_0x7ce1('0x27')](handleEntityNotFound(_0x5c91d1,null))[_0x7ce1('0x27')](removeEntity(_0x5c91d1,null))[_0x7ce1('0x4c')](handleError(_0x5c91d1,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 3b6a147..ab51799 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 _0xc622=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','sms_applications'];(function(_0x5dc8a3,_0x2adf97){var _0x60fc5a=function(_0x474ad5){while(--_0x474ad5){_0x5dc8a3['push'](_0x5dc8a3['shift']());}};_0x60fc5a(++_0x2adf97);}(_0xc622,0xb2));var _0x2c62=function(_0x4ee9cd,_0xd375b0){_0x4ee9cd=_0x4ee9cd-0x0;var _0x328a5b=_0xc622[_0x4ee9cd];return _0x328a5b;};'use strict';var _=require(_0x2c62('0x0'));var util=require('util');var logger=require(_0x2c62('0x1'))(_0x2c62('0x2'));var moment=require(_0x2c62('0x3'));var BPromise=require('bluebird');var rp=require(_0x2c62('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2c62('0x5'));var config=require(_0x2c62('0x6'));var attributes=require('./smsApplication.attributes');module[_0x2c62('0x7')]=function(_0x3ba052,_0x19ee18){return _0x3ba052['define']('SmsApplication',attributes,{'tableName':_0x2c62('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2c62('0x9'),'collate':_0x2c62('0xa')});}; \ No newline at end of file +var _0xe570=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','util','api'];(function(_0x40d3dd,_0x4087e9){var _0x340823=function(_0x15b6c9){while(--_0x15b6c9){_0x40d3dd['push'](_0x40d3dd['shift']());}};_0x340823(++_0x4087e9);}(_0xe570,0x1ab));var _0x0e57=function(_0x514e5d,_0x5ddd58){_0x514e5d=_0x514e5d-0x0;var _0xd419df=_0xe570[_0x514e5d];return _0xd419df;};'use strict';var _=require('lodash');var util=require(_0x0e57('0x0'));var logger=require('../../config/logger')(_0x0e57('0x1'));var moment=require(_0x0e57('0x2'));var BPromise=require(_0x0e57('0x3'));var rp=require(_0x0e57('0x4'));var fs=require('fs');var path=require(_0x0e57('0x5'));var rimraf=require(_0x0e57('0x6'));var config=require(_0x0e57('0x7'));var attributes=require(_0x0e57('0x8'));module['exports']=function(_0x5baf45,_0x26111d){return _0x5baf45[_0x0e57('0x9')](_0x0e57('0xa'),attributes,{'tableName':_0x0e57('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0e57('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 6346dfd..c79c7f2 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 _0x2cf5=['rpc','../../config/environment','jayson/promise','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x463683,_0x403c60){var _0x1c7fa1=function(_0x224c11){while(--_0x224c11){_0x463683['push'](_0x463683['shift']());}};_0x1c7fa1(++_0x403c60);}(_0x2cf5,0x19f));var _0x52cf=function(_0x2528ba,_0x5f2e79){_0x2528ba=_0x2528ba-0x0;var _0x5250aa=_0x2cf5[_0x2528ba];return _0x5250aa;};'use strict';var _=require(_0x52cf('0x0'));var util=require(_0x52cf('0x1'));var moment=require('moment');var BPromise=require(_0x52cf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x52cf('0x3'));var db=require(_0x52cf('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x52cf('0x5'));var config=require(_0x52cf('0x6'));var jayson=require(_0x52cf('0x7'));var client=jayson[_0x52cf('0x8')][_0x52cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13d2fe,_0x1ab7cd,_0x390162){return new BPromise(function(_0x41d874,_0x23b2ab){return client[_0x52cf('0xa')](_0x13d2fe,_0x390162)['then'](function(_0x46d7ac){logger[_0x52cf('0xb')](_0x52cf('0xc'),_0x1ab7cd,_0x52cf('0xd'));logger['debug'](_0x52cf('0xe'),_0x1ab7cd,_0x52cf('0xd'),JSON[_0x52cf('0xf')](_0x46d7ac));if(_0x46d7ac['error']){if(_0x46d7ac[_0x52cf('0x10')][_0x52cf('0x11')]===0x1f4){logger[_0x52cf('0x10')](_0x52cf('0xc'),_0x1ab7cd,_0x46d7ac[_0x52cf('0x10')][_0x52cf('0x12')]);return _0x23b2ab(_0x46d7ac['error']['message']);}logger[_0x52cf('0x10')](_0x52cf('0xc'),_0x1ab7cd,_0x46d7ac[_0x52cf('0x10')][_0x52cf('0x12')]);return _0x41d874(_0x46d7ac[_0x52cf('0x10')][_0x52cf('0x12')]);}else{logger[_0x52cf('0xb')](_0x52cf('0xc'),_0x1ab7cd,'request\x20sent');_0x41d874(_0x46d7ac[_0x52cf('0x13')][_0x52cf('0x12')]);}})[_0x52cf('0x14')](function(_0x580154){logger[_0x52cf('0x10')]('SmsApplication,\x20%s,\x20%s',_0x1ab7cd,_0x580154);_0x23b2ab(_0x580154);});});} \ No newline at end of file +var _0xa5c1=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xa5c1,0x19f));var _0x1a5c=function(_0x5b2152,_0x523a7c){_0x5b2152=_0x5b2152-0x0;var _0x29af49=_0xa5c1[_0x5b2152];return _0x29af49;};'use strict';var _=require(_0x1a5c('0x0'));var util=require(_0x1a5c('0x1'));var moment=require(_0x1a5c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a5c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a5c('0x4'));var logger=require(_0x1a5c('0x5'))(_0x1a5c('0x6'));var config=require(_0x1a5c('0x7'));var jayson=require(_0x1a5c('0x8'));var client=jayson[_0x1a5c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9853,_0x580a2e,_0x438f8f){return new BPromise(function(_0x43a2ed,_0x1702ce){return client['request'](_0x9853,_0x438f8f)[_0x1a5c('0xa')](function(_0x4c0bd2){logger[_0x1a5c('0xb')](_0x1a5c('0xc'),_0x580a2e,'request\x20sent');logger[_0x1a5c('0xd')](_0x1a5c('0xe'),_0x580a2e,'request\x20sent',JSON[_0x1a5c('0xf')](_0x4c0bd2));if(_0x4c0bd2[_0x1a5c('0x10')]){if(_0x4c0bd2[_0x1a5c('0x10')][_0x1a5c('0x11')]===0x1f4){logger[_0x1a5c('0x10')](_0x1a5c('0xc'),_0x580a2e,_0x4c0bd2[_0x1a5c('0x10')]['message']);return _0x1702ce(_0x4c0bd2[_0x1a5c('0x10')][_0x1a5c('0x12')]);}logger['error'](_0x1a5c('0xc'),_0x580a2e,_0x4c0bd2[_0x1a5c('0x10')]['message']);return _0x43a2ed(_0x4c0bd2[_0x1a5c('0x10')][_0x1a5c('0x12')]);}else{logger[_0x1a5c('0xb')](_0x1a5c('0xc'),_0x580a2e,'request\x20sent');_0x43a2ed(_0x4c0bd2[_0x1a5c('0x13')]['message']);}})[_0x1a5c('0x14')](function(_0x44648a){logger[_0x1a5c('0x10')]('SmsApplication,\x20%s,\x20%s',_0x580a2e,_0x44648a);_0x1702ce(_0x44648a);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 544bf31..c23b8d3 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 _0xbaf0=['sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked'];(function(_0x4c583a,_0x223960){var _0x21c504=function(_0x35ecde){while(--_0x35ecde){_0x4c583a['push'](_0x4c583a['shift']());}};_0x21c504(++_0x223960);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0x9')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x9')](_0x0baf('0x10'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x11')]);router[_0x0baf('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0baf('0x12')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x13')]);router['post'](_0x0baf('0x14'),auth['isAuthenticated'](),interaction[_0x0baf('0x15')](_0x0baf('0x16'),_0x0baf('0x17')),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')](_0x0baf('0x1a'),auth['isAuthenticated'](),interaction['tracked'](_0x0baf('0x16'),_0x0baf('0x1b')),controller[_0x0baf('0x1c')]);router[_0x0baf('0x1d')](_0x0baf('0x1a'),auth[_0x0baf('0xa')](),interaction['tracked'](_0x0baf('0x16'),_0x0baf('0x1e')),controller[_0x0baf('0x1f')]);router[_0x0baf('0x1d')](_0x0baf('0x14'),auth[_0x0baf('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xd8b0=['util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer'];(function(_0x4f986d,_0x1b176a){var _0x57609c=function(_0x3946bf){while(--_0x3946bf){_0x4f986d['push'](_0x4f986d['shift']());}};_0x57609c(++_0x1b176a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./smsInteraction.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('0x9')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x9')]('/:id/download',auth[_0x0d8b('0x7')](),controller['download']);router[_0x0d8b('0xf')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0xf')](_0x0d8b('0x12'),auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0x13')](_0x0d8b('0x14'),_0x0d8b('0x15')),controller[_0x0d8b('0x16')]);router['put'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0x13')](_0x0d8b('0x14'),_0x0d8b('0x17')),controller['update']);router[_0x0d8b('0x18')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0x13')](_0x0d8b('0x14'),_0x0d8b('0x19')),controller[_0x0d8b('0x1a')]);router[_0x0d8b('0x18')]('/:id/tags',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x1b')]);module[_0x0d8b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 9b9dcab..269c023 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 _0xf50b=['DATE','STRING','ENUM','out','sequelize','moment','BOOLEAN'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0xf50b,0xc8));var _0xbf50=function(_0x2a5a6f,_0x4f5b8c){_0x2a5a6f=_0x2a5a6f-0x0;var _0x4095cd=_0xf50b[_0x2a5a6f];return _0x4095cd;};'use strict';var Sequelize=require(_0xbf50('0x0'));var moment=require(_0xbf50('0x1'));module['exports']={'closed':{'type':Sequelize[_0xbf50('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbf50('0x3')]},'disposition':{'type':Sequelize[_0xbf50('0x4')]},'secondDisposition':{'type':Sequelize[_0xbf50('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbf50('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xbf50('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xbf50('0x5')]('in',_0xbf50('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbf50('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xbf50('0x5')]('in',_0xbf50('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xbf50('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x8d0a=['STRING','out','ENUM','sequelize','exports','BOOLEAN','DATE'];(function(_0x595734,_0x2880c7){var _0x14e1a4=function(_0x38320d){while(--_0x38320d){_0x595734['push'](_0x595734['shift']());}};_0x14e1a4(++_0x2880c7);}(_0x8d0a,0x65));var _0xa8d0=function(_0x3b0242,_0x29d44b){_0x3b0242=_0x3b0242-0x0;var _0xd10fd4=_0x8d0a[_0x3b0242];return _0xd10fd4;};'use strict';var Sequelize=require(_0xa8d0('0x0'));var moment=require('moment');module[_0xa8d0('0x1')]={'closed':{'type':Sequelize[_0xa8d0('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa8d0('0x3')]},'disposition':{'type':Sequelize[_0xa8d0('0x4')]},'secondDisposition':{'type':Sequelize[_0xa8d0('0x4')]},'thirdDisposition':{'type':Sequelize[_0xa8d0('0x4')]},'note':{'type':Sequelize[_0xa8d0('0x4')]},'phone':{'type':Sequelize[_0xa8d0('0x4')]},'read1stAt':{'type':Sequelize[_0xa8d0('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xa8d0('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa8d0('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xa8d0('0x6')]('in',_0xa8d0('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa8d0('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 111581c..715719b 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 _0x4956=['get','mkdirSync','Owner','N.A.','createdAt','toString','closed','closedAt','disposition','out','System','firstName','read','value','root','server','views','.pdf','Sms','createPdfFromHTML','download','log','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','then','destroy','error','stack','name','map','SmsInteraction','rawAttributes','fieldName','type','getOptions','findAll','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','update','body','describe','addMessage','ids','getMessages','findOne','hasOwnProperty','sort','where','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','SmsMessage','rows','setTags','omit','spread','Tag','emit','smsInteractionTags:save','removeTags','unix','join','files','tmp','transcript-%d-%s.zip','push','User','Contact','lastName','Messages','direction','Account','fullname'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4956,0x8c));var _0x6495=function(_0x3c389a,_0x1e280f){_0x3c389a=_0x3c389a-0x0;var _0x77f6b9=_0x4956[_0x3c389a];return _0x77f6b9;};'use strict';var rimraf=require(_0x6495('0x0'));var zipdir=require(_0x6495('0x1'));var moment=require(_0x6495('0x2'));var BPromise=require(_0x6495('0x3'));var util=require(_0x6495('0x4'));var path=require(_0x6495('0x5'));var ejs=require(_0x6495('0x6'));var fs=require('fs');var _=require(_0x6495('0x7'));var Redis=require(_0x6495('0x8'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0x6495('0x9'));var logger=require(_0x6495('0xa'))(_0x6495('0xb'));var config=require('../../config/environment');var db=require(_0x6495('0xc'))['db'];config[_0x6495('0xd')]=_['defaults'](config[_0x6495('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x6495('0xe'))(new Redis(config[_0x6495('0xd')]));require('./smsInteraction.socket')[_0x6495('0xf')](socket);function respondWithStatusCode(_0x27fb42,_0x3dd3b9){_0x3dd3b9=_0x3dd3b9||0xcc;return function(_0x194f72){if(_0x194f72){return _0x27fb42[_0x6495('0x10')](_0x3dd3b9);}return _0x27fb42['status'](_0x3dd3b9)[_0x6495('0x11')]();};}function respondWithResult(_0xdfd3b6,_0x1fcc59){_0x1fcc59=_0x1fcc59||0xc8;return function(_0x595a15){if(_0x595a15){return _0xdfd3b6[_0x6495('0x12')](_0x1fcc59)[_0x6495('0x13')](_0x595a15);}};}function respondWithFilteredResult(_0x5e3190,_0x2357a8){return function(_0x43b59a){if(_0x43b59a){var _0x1904dc=typeof _0x2357a8['offset']===_0x6495('0x14')&&typeof _0x2357a8[_0x6495('0x15')]===_0x6495('0x14');var _0x334dca=_0x43b59a[_0x6495('0x16')];var _0x37e8e4=_0x1904dc?0x0:_0x2357a8[_0x6495('0x17')];var _0x212c0b=_0x1904dc?_0x43b59a[_0x6495('0x16')]:_0x2357a8[_0x6495('0x17')]+_0x2357a8[_0x6495('0x15')];var _0x33a288;if(_0x212c0b>=_0x334dca){_0x212c0b=_0x334dca;_0x33a288=0xc8;}else{_0x33a288=0xce;}_0x5e3190[_0x6495('0x12')](_0x33a288);return _0x5e3190[_0x6495('0x18')](_0x6495('0x19'),_0x37e8e4+'-'+_0x212c0b+'/'+_0x334dca)[_0x6495('0x13')](_0x43b59a);}return null;};}function saveUpdates(_0x2d0970){return function(_0x5501cb){if(_0x5501cb){return _0x5501cb['update'](_0x2d0970)[_0x6495('0x1a')](function(_0x357854){return _0x357854;});}return null;};}function removeEntity(_0x30b8c8){return function(_0x5ccf55){if(_0x5ccf55){return _0x5ccf55[_0x6495('0x1b')]()['then'](function(){_0x30b8c8[_0x6495('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b99b1){return function(_0x30bb11){if(!_0x30bb11){_0x3b99b1[_0x6495('0x10')](0x194);}return _0x30bb11;};}function handleError(_0x5a3576,_0x451acc){_0x451acc=_0x451acc||0x1f4;return function(_0x2b77dd){logger[_0x6495('0x1c')](_0x2b77dd[_0x6495('0x1d')]);if(_0x2b77dd[_0x6495('0x1e')]){delete _0x2b77dd[_0x6495('0x1e')];}_0x5a3576[_0x6495('0x12')](_0x451acc)['send'](_0x2b77dd);};}exports['index']=function(_0xd8a0c8,_0x157737){var _0x47b7bb={};var _0x307403=_[_0x6495('0x1f')](db[_0x6495('0x20')][_0x6495('0x21')],function(_0xb7c205){return{'name':_0xb7c205[_0x6495('0x22')],'type':_0xb7c205[_0x6495('0x23')]['key']};});_0x47b7bb=qs[_0x6495('0x24')](_0x307403,_0xd8a0c8);return interaction[_0x6495('0x25')]('sms',_0xd8a0c8[_0x6495('0x26')],_0xd8a0c8[_0x6495('0x27')],_0x47b7bb,_0x307403)[_0x6495('0x1a')](respondWithFilteredResult(_0x157737,_0x47b7bb))[_0x6495('0x28')](handleError(_0x157737,null));};exports[_0x6495('0x29')]=function(_0xffab58,_0x2fda71){var _0x455433={'raw':![],'where':{'id':_0xffab58[_0x6495('0x2a')]['id']}},_0x141165={};_0x141165[_0x6495('0x2b')]=_['keys'](db['SmsInteraction'][_0x6495('0x21')]);_0x141165[_0x6495('0x26')]=_[_0x6495('0x2c')](_0xffab58[_0x6495('0x26')]);_0x141165[_0x6495('0x2d')]=_[_0x6495('0x2e')](_0x141165['model'],_0x141165['query']);_0x455433[_0x6495('0x2f')]=_['intersection'](_0x141165[_0x6495('0x2b')],qs[_0x6495('0x30')](_0xffab58[_0x6495('0x26')]['fields']));_0x455433[_0x6495('0x2f')]=_0x455433[_0x6495('0x2f')][_0x6495('0x31')]?_0x455433[_0x6495('0x2f')]:_0x141165[_0x6495('0x2b')];if(_0xffab58['query'][_0x6495('0x32')]){_0x455433[_0x6495('0x33')]=[{'all':!![]}];}_0x455433=_[_0x6495('0x34')]({},_0x455433,_0xffab58[_0x6495('0x35')]);return db[_0x6495('0x20')][_0x6495('0x36')](_0x455433)[_0x6495('0x1a')](handleEntityNotFound(_0x2fda71,null))['then'](respondWithResult(_0x2fda71,null))[_0x6495('0x28')](handleError(_0x2fda71,null));};exports[_0x6495('0x37')]=function(_0x2bc8f2,_0x359301){return db[_0x6495('0x20')][_0x6495('0x37')](_0x2bc8f2['body'],{})[_0x6495('0x1a')](respondWithResult(_0x359301,0xc9))[_0x6495('0x28')](handleError(_0x359301,null));};exports[_0x6495('0x38')]=function(_0x46e5e4,_0x974178){if(_0x46e5e4[_0x6495('0x39')]['id']){delete _0x46e5e4[_0x6495('0x39')]['id'];}return db[_0x6495('0x20')][_0x6495('0x36')]({'where':{'id':_0x46e5e4['params']['id']}})[_0x6495('0x1a')](handleEntityNotFound(_0x974178,null))[_0x6495('0x1a')](saveUpdates(_0x46e5e4['body'],null))[_0x6495('0x1a')](respondWithResult(_0x974178,null))[_0x6495('0x28')](handleError(_0x974178,null));};exports['destroy']=function(_0x410f73,_0x13fa9f){return db['SmsInteraction'][_0x6495('0x36')]({'where':{'id':_0x410f73['params']['id']}})[_0x6495('0x1a')](handleEntityNotFound(_0x13fa9f,null))[_0x6495('0x1a')](removeEntity(_0x13fa9f,null))[_0x6495('0x28')](handleError(_0x13fa9f,null));};exports['describe']=function(_0x42605b,_0x1d78a8){return db[_0x6495('0x20')][_0x6495('0x3a')]()['then'](respondWithResult(_0x1d78a8,null))[_0x6495('0x28')](handleError(_0x1d78a8,null));};exports[_0x6495('0x3b')]=function(_0xcc34ad,_0x30f82e){return db['SmsMessage']['find']({'where':{'id':_0xcc34ad[_0x6495('0x2a')]['id']}})[_0x6495('0x1a')](handleEntityNotFound(_0x30f82e,null))[_0x6495('0x1a')](function(_0x26b7a9){if(_0x26b7a9){return _0x26b7a9[_0x6495('0x3b')](_0xcc34ad['body'][_0x6495('0x3c')],_['omit'](_0xcc34ad[_0x6495('0x39')],['ids','id'])||{});}})[_0x6495('0x1a')](respondWithResult(_0x30f82e,null))[_0x6495('0x28')](handleError(_0x30f82e,null));};exports[_0x6495('0x3d')]=function(_0x51f240,_0x60610){var _0x23f868={'raw':![],'where':{}};var _0x796cc1={};var _0x55039f={'count':0x0,'rows':[]};return db[_0x6495('0x20')][_0x6495('0x3e')]({'where':{'id':_0x51f240[_0x6495('0x2a')]['id']}})[_0x6495('0x1a')](handleEntityNotFound(_0x60610,null))[_0x6495('0x1a')](function(_0x28f2e7){if(_0x28f2e7){_0x796cc1['model']=_['keys'](db['SmsMessage'][_0x6495('0x21')]);_0x796cc1[_0x6495('0x26')]=_[_0x6495('0x2c')](_0x51f240[_0x6495('0x26')]);_0x796cc1[_0x6495('0x2d')]=_['intersection'](_0x796cc1[_0x6495('0x2b')],_0x796cc1[_0x6495('0x26')]);_0x23f868[_0x6495('0x2f')]=_[_0x6495('0x2e')](_0x796cc1[_0x6495('0x2b')],qs[_0x6495('0x30')](_0x51f240['query'][_0x6495('0x30')]));_0x23f868[_0x6495('0x2f')]=_0x23f868[_0x6495('0x2f')][_0x6495('0x31')]?_0x23f868[_0x6495('0x2f')]:_0x796cc1[_0x6495('0x2b')];if(!_0x51f240[_0x6495('0x26')][_0x6495('0x3f')]('nolimit')){_0x23f868['limit']=qs['limit'](_0x51f240['query'][_0x6495('0x15')]);_0x23f868['offset']=qs['offset'](_0x51f240[_0x6495('0x26')][_0x6495('0x17')]);}_0x23f868['order']=qs[_0x6495('0x40')](_0x51f240[_0x6495('0x26')][_0x6495('0x40')]);_0x23f868[_0x6495('0x41')]=qs[_0x6495('0x2d')](_['pick'](_0x51f240[_0x6495('0x26')],_0x796cc1[_0x6495('0x2d')]));_0x23f868[_0x6495('0x41')][_0x6495('0x42')]=_0x28f2e7['id'];if(_0x51f240[_0x6495('0x26')][_0x6495('0x43')]){_0x23f868[_0x6495('0x41')]=_['merge'](_0x23f868[_0x6495('0x41')],{'$or':_[_0x6495('0x1f')](_0x23f868[_0x6495('0x2f')],function(_0xb58c86){var _0x754075={};_0x754075[_0xb58c86]={'$like':'%'+_0x51f240[_0x6495('0x26')][_0x6495('0x43')]+'%'};return _0x754075;})});}if(_0x51f240[_0x6495('0x26')][_0x6495('0x44')]){var _0x2ad5e1=_0x51f240[_0x6495('0x26')][_0x6495('0x44')][_0x6495('0x45')](',');var _0x1ebcb2={};_0x1ebcb2[_0x2ad5e1[0x0]]={'$gte':moment(_0x2ad5e1[0x1])[_0x6495('0x46')](_0x6495('0x47'))};_0x23f868[_0x6495('0x41')]=_[_0x6495('0x34')](_0x23f868['where'],_0x1ebcb2);}_0x23f868=_[_0x6495('0x34')]({},_0x23f868,_0x51f240[_0x6495('0x35')]);return db[_0x6495('0x48')][_0x6495('0x16')]({'where':_0x23f868['where']})['then'](function(_0x3d605f){_0x55039f['count']=_0x3d605f;if(_0x51f240[_0x6495('0x26')]['includeAll']){_0x23f868[_0x6495('0x33')]=[{'all':!![]}];}return db['SmsMessage'][_0x6495('0x25')](_0x23f868);})[_0x6495('0x1a')](function(_0x4c4262){_0x55039f[_0x6495('0x49')]=_0x4c4262;return _0x55039f;});}})[_0x6495('0x1a')](respondWithFilteredResult(_0x60610,_0x23f868))[_0x6495('0x28')](handleError(_0x60610,null));};exports['addTags']=function(_0x55ea88,_0x1f3fb9){return db['SmsInteraction'][_0x6495('0x36')]({'where':{'id':_0x55ea88[_0x6495('0x2a')]['id']}})[_0x6495('0x1a')](handleEntityNotFound(_0x1f3fb9,null))[_0x6495('0x1a')](function(_0x356350){if(_0x356350){return _0x356350[_0x6495('0x4a')](_0x55ea88[_0x6495('0x39')][_0x6495('0x3c')],_[_0x6495('0x4b')](_0x55ea88[_0x6495('0x39')],[_0x6495('0x3c'),'id'])||{})[_0x6495('0x4c')](function(){return db[_0x6495('0x4d')]['findAll']({'attributes':['id',_0x6495('0x1e'),'color'],'where':{'id':_0x55ea88['body'][_0x6495('0x3c')]}});})[_0x6495('0x1a')](function(_0x2bfcc1){socket[_0x6495('0x4e')](_0x6495('0x4f'),{'id':Number(_0x55ea88[_0x6495('0x2a')]['id']),'tags':_0x2bfcc1||[]});return{'id':Number(_0x55ea88['params']['id']),'tags':_0x2bfcc1||[]};});}})[_0x6495('0x1a')](respondWithResult(_0x1f3fb9,null))[_0x6495('0x28')](handleError(_0x1f3fb9,null));};exports[_0x6495('0x50')]=function(_0x30ba51,_0x1ff8fd){return db[_0x6495('0x20')][_0x6495('0x36')]({'where':{'id':_0x30ba51['params']['id']}})[_0x6495('0x1a')](handleEntityNotFound(_0x1ff8fd,null))[_0x6495('0x1a')](function(_0x437e1c){if(_0x437e1c){return _0x437e1c['removeTags'](_0x30ba51['query'][_0x6495('0x3c')]);}})[_0x6495('0x1a')](respondWithStatusCode(_0x1ff8fd,null))[_0x6495('0x28')](handleError(_0x1ff8fd,null));};exports['download']=function(_0x1796cd,_0x5ebec0){var _0x126ee1=moment()[_0x6495('0x51')]()['toString']();var _0x36e034=path[_0x6495('0x52')](config['root'],'server',_0x6495('0x53'),_0x6495('0x54'));var _0x5ab6fa=path['join'](_0x36e034,_0x126ee1);var _0x666143=util['format'](_0x6495('0x55'),_0x1796cd[_0x6495('0x2a')]['id'],_0x126ee1);var _0x1b7fbb=path[_0x6495('0x52')](_0x36e034,_0x666143);var _0x73b74b=[];_0x73b74b[_0x6495('0x56')]({'model':db[_0x6495('0x57')],'as':_0x6495('0x57'),'attributes':['id','fullname'],'raw':!![]});_0x73b74b['push']({'model':db['CmContact'],'as':_0x6495('0x58'),'attributes':['id','firstName',_0x6495('0x59')],'raw':!![]});var _0x4f691f=[{'model':db[_0x6495('0x48')],'as':_0x6495('0x5a'),'attributes':['id',_0x6495('0x39'),'createdAt',_0x6495('0x5b'),'secret','read'],'include':_0x73b74b}];_0x4f691f[_0x6495('0x56')]({'model':db['SmsAccount'],'as':_0x6495('0x5c'),'attributes':['id','name']});_0x4f691f[_0x6495('0x56')]({'model':db[_0x6495('0x57')],'as':'Owner','attributes':['id',_0x6495('0x5d')]});return db[_0x6495('0x20')][_0x6495('0x36')]({'where':{'id':_0x1796cd['params']['id']},'include':_0x4f691f})[_0x6495('0x1a')](handleEntityNotFound(_0x5ebec0,null))[_0x6495('0x1a')](function(_0x5cc253){if(_0x5cc253){var _0x1e1ee1=_0x5cc253[_0x6495('0x5e')]({'plain':!![]});fs[_0x6495('0x5f')](_0x5ab6fa);var _0x1cbf89={'channel':'Sms','account':_0x1e1ee1[_0x6495('0x5c')][_0x6495('0x1e')],'agent':_0x1e1ee1['Owner']?_0x1e1ee1[_0x6495('0x60')][_0x6495('0x5d')]:_0x6495('0x61'),'createdAt':moment(_0x1e1ee1[_0x6495('0x62')])['format'](_0x6495('0x47'))[_0x6495('0x63')](),'closedAt':_0x1e1ee1[_0x6495('0x64')]?moment(_0x1e1ee1[_0x6495('0x65')])[_0x6495('0x46')](_0x6495('0x47'))[_0x6495('0x63')]():'','disposition':_0x1e1ee1[_0x6495('0x66')],'messages':_(_0x1e1ee1[_0x6495('0x5a')])[_0x6495('0x43')]({'secret':![]})['map'](function(_0x55789b){return{'date':moment(_0x55789b['createdAt'])[_0x6495('0x46')](_0x6495('0x47'))[_0x6495('0x63')](),'sender':_0x55789b['direction']===_0x6495('0x67')?_0x55789b[_0x6495('0x57')]?_0x55789b[_0x6495('0x57')]['fullname']:_0x6495('0x68'):_0x55789b['Contact'][_0x6495('0x69')]+(_0x55789b['Contact'][_0x6495('0x59')]?'\x20'+_0x55789b['Contact']['lastName']:''),'body':_0x55789b['body'],'direction':_0x55789b[_0x6495('0x5b')]===_0x6495('0x67')?'A':'C','secret':_0x55789b['secret'],'read':_0x55789b[_0x6495('0x6a')]};})[_0x6495('0x6b')]()};return ejs['renderFile'](path['join'](config[_0x6495('0x6c')],_0x6495('0x6d'),_0x6495('0x6e'),'downloadInteraction.ejs'),{'interaction':_0x1cbf89})[_0x6495('0x1a')](function(_0x333d18){var _0x1e38a5=path[_0x6495('0x52')](_0x5ab6fa,'transcript-'+_0x1e1ee1['id']+'-'+_0x126ee1+_0x6495('0x6f'));var _0x3de66b={'path':_0x1e38a5,'channel':_0x6495('0x70'),'interactionId':_0x1e1ee1['id']};return pdf[_0x6495('0x71')](_0x333d18,_0x3de66b);})[_0x6495('0x1a')](function(){return new BPromise(function(_0x5be31c,_0x424688){zipdir(_0x5ab6fa,{'saveTo':_0x1b7fbb},function(_0x57e950,_0xd3f7d){if(_0x57e950)return _0x424688(_0x57e950);return _0x5be31c(_0xd3f7d);});})[_0x6495('0x1a')](function(){return new BPromise(function(_0xfe5e6f,_0x485fe6){rimraf(_0x5ab6fa,function(_0x2644bb){if(_0x2644bb)_0x485fe6(_0x2644bb);return _0xfe5e6f();});});})['then'](function(){return _0x5ebec0[_0x6495('0x72')](_0x1b7fbb,_0x666143,function(_0x1ab227){if(_0x1ab227){console[_0x6495('0x73')]('err',_0x1ab227);}else{fs[_0x6495('0x74')](_0x1b7fbb);}});});});}else{return _0x5ebec0['sendStatus'](0xc8);}})[_0x6495('0x28')](handleError(_0x5ebec0,null));}; \ No newline at end of file +var _0xc353=['ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','json','offset','undefined','count','limit','set','update','then','destroy','sendStatus','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','findAll','query','user','catch','params','model','keys','filters','intersection','fields','attributes','includeAll','include','create','body','find','describe','addMessage','SmsMessage','ids','omit','length','hasOwnProperty','nolimit','order','sort','pick','where','SmsInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','merge','rows','addTags','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','tmp','format','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','Messages','createdAt','direction','read','SmsAccount','Owner','mkdirSync','Account','closed','closedAt','disposition','System','lastName','value','renderFile','views','transcript-','.pdf','Sms','createPdfFromHTML','log','err','unlinkSync','moment','bluebird','path'];(function(_0x20d3b7,_0x417e95){var _0x2a81e4=function(_0xe38caf){while(--_0xe38caf){_0x20d3b7['push'](_0x20d3b7['shift']());}};_0x2a81e4(++_0x417e95);}(_0xc353,0x75));var _0x3c35=function(_0x2f26a3,_0x36da6d){_0x2f26a3=_0x2f26a3-0x0;var _0x169e9=_0xc353[_0x2f26a3];return _0x169e9;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x3c35('0x0'));var BPromise=require(_0x3c35('0x1'));var util=require('util');var path=require(_0x3c35('0x2'));var ejs=require(_0x3c35('0x3'));var fs=require('fs');var _=require(_0x3c35('0x4'));var Redis=require(_0x3c35('0x5'));var interaction=require(_0x3c35('0x6'));var qs=require(_0x3c35('0x7'));var pdf=require(_0x3c35('0x8'));var logger=require(_0x3c35('0x9'))(_0x3c35('0xa'));var config=require(_0x3c35('0xb'));var db=require(_0x3c35('0xc'))['db'];config['redis']=_[_0x3c35('0xd')](config[_0x3c35('0xe')],{'host':_0x3c35('0xf'),'port':0x18eb});var socket=require(_0x3c35('0x10'))(new Redis(config['redis']));require(_0x3c35('0x11'))[_0x3c35('0x12')](socket);function respondWithStatusCode(_0x2f5bcb,_0x1f64d0){_0x1f64d0=_0x1f64d0||0xcc;return function(_0x2ee9da){if(_0x2ee9da){return _0x2f5bcb['sendStatus'](_0x1f64d0);}return _0x2f5bcb[_0x3c35('0x13')](_0x1f64d0)[_0x3c35('0x14')]();};}function respondWithResult(_0x5f15ab,_0x37cb46){_0x37cb46=_0x37cb46||0xc8;return function(_0x5e78f3){if(_0x5e78f3){return _0x5f15ab['status'](_0x37cb46)[_0x3c35('0x15')](_0x5e78f3);}};}function respondWithFilteredResult(_0xd051f3,_0x148aaf){return function(_0x41dc38){if(_0x41dc38){var _0x2df9db=typeof _0x148aaf[_0x3c35('0x16')]===_0x3c35('0x17')&&typeof _0x148aaf['limit']===_0x3c35('0x17');var _0x4c359a=_0x41dc38[_0x3c35('0x18')];var _0x282cea=_0x2df9db?0x0:_0x148aaf[_0x3c35('0x16')];var _0x3e9d61=_0x2df9db?_0x41dc38[_0x3c35('0x18')]:_0x148aaf['offset']+_0x148aaf[_0x3c35('0x19')];var _0x1911f9;if(_0x3e9d61>=_0x4c359a){_0x3e9d61=_0x4c359a;_0x1911f9=0xc8;}else{_0x1911f9=0xce;}_0xd051f3[_0x3c35('0x13')](_0x1911f9);return _0xd051f3[_0x3c35('0x1a')]('Content-Range',_0x282cea+'-'+_0x3e9d61+'/'+_0x4c359a)['json'](_0x41dc38);}return null;};}function saveUpdates(_0x11d373){return function(_0x468994){if(_0x468994){return _0x468994[_0x3c35('0x1b')](_0x11d373)[_0x3c35('0x1c')](function(_0x4f12df){return _0x4f12df;});}return null;};}function removeEntity(_0xa1ce80){return function(_0x1d1c87){if(_0x1d1c87){return _0x1d1c87[_0x3c35('0x1d')]()[_0x3c35('0x1c')](function(){_0xa1ce80[_0x3c35('0x13')](0xcc)[_0x3c35('0x14')]();});}};}function handleEntityNotFound(_0x1bb1ee){return function(_0x4b232a){if(!_0x4b232a){_0x1bb1ee[_0x3c35('0x1e')](0x194);}return _0x4b232a;};}function handleError(_0x2a71a6,_0xdcac1c){_0xdcac1c=_0xdcac1c||0x1f4;return function(_0x3e3ad0){logger[_0x3c35('0x1f')](_0x3e3ad0[_0x3c35('0x20')]);if(_0x3e3ad0[_0x3c35('0x21')]){delete _0x3e3ad0[_0x3c35('0x21')];}_0x2a71a6[_0x3c35('0x13')](_0xdcac1c)[_0x3c35('0x22')](_0x3e3ad0);};}exports[_0x3c35('0x23')]=function(_0xd6e826,_0x3140ae){var _0x179cfe={};var _0x56d1c6=_[_0x3c35('0x24')](db[_0x3c35('0x25')][_0x3c35('0x26')],function(_0x5da06b){return{'name':_0x5da06b[_0x3c35('0x27')],'type':_0x5da06b[_0x3c35('0x28')]['key']};});_0x179cfe=qs['getOptions'](_0x56d1c6,_0xd6e826);return interaction[_0x3c35('0x29')]('sms',_0xd6e826[_0x3c35('0x2a')],_0xd6e826[_0x3c35('0x2b')],_0x179cfe,_0x56d1c6)[_0x3c35('0x1c')](respondWithFilteredResult(_0x3140ae,_0x179cfe))[_0x3c35('0x2c')](handleError(_0x3140ae,null));};exports['show']=function(_0x3b9f5b,_0xc57a25){var _0x1ee32c={'raw':![],'where':{'id':_0x3b9f5b[_0x3c35('0x2d')]['id']}},_0x41e575={};_0x41e575[_0x3c35('0x2e')]=_[_0x3c35('0x2f')](db['SmsInteraction'][_0x3c35('0x26')]);_0x41e575[_0x3c35('0x2a')]=_[_0x3c35('0x2f')](_0x3b9f5b[_0x3c35('0x2a')]);_0x41e575[_0x3c35('0x30')]=_[_0x3c35('0x31')](_0x41e575[_0x3c35('0x2e')],_0x41e575[_0x3c35('0x2a')]);_0x1ee32c['attributes']=_[_0x3c35('0x31')](_0x41e575[_0x3c35('0x2e')],qs[_0x3c35('0x32')](_0x3b9f5b[_0x3c35('0x2a')][_0x3c35('0x32')]));_0x1ee32c[_0x3c35('0x33')]=_0x1ee32c[_0x3c35('0x33')]['length']?_0x1ee32c[_0x3c35('0x33')]:_0x41e575[_0x3c35('0x2e')];if(_0x3b9f5b[_0x3c35('0x2a')][_0x3c35('0x34')]){_0x1ee32c[_0x3c35('0x35')]=[{'all':!![]}];}_0x1ee32c=_['merge']({},_0x1ee32c,_0x3b9f5b['options']);return db[_0x3c35('0x25')]['find'](_0x1ee32c)[_0x3c35('0x1c')](handleEntityNotFound(_0xc57a25,null))[_0x3c35('0x1c')](respondWithResult(_0xc57a25,null))[_0x3c35('0x2c')](handleError(_0xc57a25,null));};exports[_0x3c35('0x36')]=function(_0x4284a1,_0x313065){return db['SmsInteraction'][_0x3c35('0x36')](_0x4284a1[_0x3c35('0x37')],{})['then'](respondWithResult(_0x313065,0xc9))[_0x3c35('0x2c')](handleError(_0x313065,null));};exports['update']=function(_0x15baf7,_0x10b251){if(_0x15baf7[_0x3c35('0x37')]['id']){delete _0x15baf7['body']['id'];}return db[_0x3c35('0x25')][_0x3c35('0x38')]({'where':{'id':_0x15baf7['params']['id']}})[_0x3c35('0x1c')](handleEntityNotFound(_0x10b251,null))[_0x3c35('0x1c')](saveUpdates(_0x15baf7['body'],null))[_0x3c35('0x1c')](respondWithResult(_0x10b251,null))[_0x3c35('0x2c')](handleError(_0x10b251,null));};exports[_0x3c35('0x1d')]=function(_0x5bf27d,_0x46679e){return db[_0x3c35('0x25')][_0x3c35('0x38')]({'where':{'id':_0x5bf27d[_0x3c35('0x2d')]['id']}})['then'](handleEntityNotFound(_0x46679e,null))[_0x3c35('0x1c')](removeEntity(_0x46679e,null))[_0x3c35('0x2c')](handleError(_0x46679e,null));};exports[_0x3c35('0x39')]=function(_0x23fced,_0x339639){return db[_0x3c35('0x25')]['describe']()['then'](respondWithResult(_0x339639,null))[_0x3c35('0x2c')](handleError(_0x339639,null));};exports[_0x3c35('0x3a')]=function(_0x2e49d7,_0x360d36){return db[_0x3c35('0x3b')]['find']({'where':{'id':_0x2e49d7[_0x3c35('0x2d')]['id']}})[_0x3c35('0x1c')](handleEntityNotFound(_0x360d36,null))[_0x3c35('0x1c')](function(_0x36887c){if(_0x36887c){return _0x36887c[_0x3c35('0x3a')](_0x2e49d7[_0x3c35('0x37')][_0x3c35('0x3c')],_[_0x3c35('0x3d')](_0x2e49d7['body'],[_0x3c35('0x3c'),'id'])||{});}})[_0x3c35('0x1c')](respondWithResult(_0x360d36,null))['catch'](handleError(_0x360d36,null));};exports['getMessages']=function(_0x5db29f,_0x4a619d){var _0x3c92eb={'raw':![],'where':{}};var _0x4db3c1={};var _0x3c1c13={'count':0x0,'rows':[]};return db[_0x3c35('0x25')]['findOne']({'where':{'id':_0x5db29f['params']['id']}})[_0x3c35('0x1c')](handleEntityNotFound(_0x4a619d,null))[_0x3c35('0x1c')](function(_0x2c71ee){if(_0x2c71ee){_0x4db3c1[_0x3c35('0x2e')]=_['keys'](db['SmsMessage'][_0x3c35('0x26')]);_0x4db3c1['query']=_[_0x3c35('0x2f')](_0x5db29f[_0x3c35('0x2a')]);_0x4db3c1[_0x3c35('0x30')]=_[_0x3c35('0x31')](_0x4db3c1['model'],_0x4db3c1[_0x3c35('0x2a')]);_0x3c92eb[_0x3c35('0x33')]=_[_0x3c35('0x31')](_0x4db3c1[_0x3c35('0x2e')],qs[_0x3c35('0x32')](_0x5db29f[_0x3c35('0x2a')]['fields']));_0x3c92eb[_0x3c35('0x33')]=_0x3c92eb[_0x3c35('0x33')][_0x3c35('0x3e')]?_0x3c92eb[_0x3c35('0x33')]:_0x4db3c1['model'];if(!_0x5db29f[_0x3c35('0x2a')][_0x3c35('0x3f')](_0x3c35('0x40'))){_0x3c92eb[_0x3c35('0x19')]=qs[_0x3c35('0x19')](_0x5db29f['query'][_0x3c35('0x19')]);_0x3c92eb['offset']=qs['offset'](_0x5db29f['query'][_0x3c35('0x16')]);}_0x3c92eb[_0x3c35('0x41')]=qs[_0x3c35('0x42')](_0x5db29f[_0x3c35('0x2a')][_0x3c35('0x42')]);_0x3c92eb['where']=qs['filters'](_[_0x3c35('0x43')](_0x5db29f[_0x3c35('0x2a')],_0x4db3c1[_0x3c35('0x30')]));_0x3c92eb[_0x3c35('0x44')][_0x3c35('0x45')]=_0x2c71ee['id'];if(_0x5db29f[_0x3c35('0x2a')]['filter']){_0x3c92eb[_0x3c35('0x44')]=_['merge'](_0x3c92eb[_0x3c35('0x44')],{'$or':_[_0x3c35('0x24')](_0x3c92eb['attributes'],function(_0x40b4fd){var _0x3c7490={};_0x3c7490[_0x40b4fd]={'$like':'%'+_0x5db29f[_0x3c35('0x2a')][_0x3c35('0x46')]+'%'};return _0x3c7490;})});}if(_0x5db29f[_0x3c35('0x2a')][_0x3c35('0x47')]){var _0x5e554d=_0x5db29f[_0x3c35('0x2a')]['$gte'][_0x3c35('0x48')](',');var _0x29c9ce={};_0x29c9ce[_0x5e554d[0x0]]={'$gte':moment(_0x5e554d[0x1])['format'](_0x3c35('0x49'))};_0x3c92eb[_0x3c35('0x44')]=_[_0x3c35('0x4a')](_0x3c92eb[_0x3c35('0x44')],_0x29c9ce);}_0x3c92eb=_[_0x3c35('0x4a')]({},_0x3c92eb,_0x5db29f['options']);return db['SmsMessage'][_0x3c35('0x18')]({'where':_0x3c92eb['where']})[_0x3c35('0x1c')](function(_0x2711a3){_0x3c1c13['count']=_0x2711a3;if(_0x5db29f[_0x3c35('0x2a')][_0x3c35('0x34')]){_0x3c92eb[_0x3c35('0x35')]=[{'all':!![]}];}return db[_0x3c35('0x3b')]['findAll'](_0x3c92eb);})['then'](function(_0x54bbce){_0x3c1c13[_0x3c35('0x4b')]=_0x54bbce;return _0x3c1c13;});}})[_0x3c35('0x1c')](respondWithFilteredResult(_0x4a619d,_0x3c92eb))[_0x3c35('0x2c')](handleError(_0x4a619d,null));};exports[_0x3c35('0x4c')]=function(_0x973c87,_0x20616c){return db[_0x3c35('0x25')][_0x3c35('0x38')]({'where':{'id':_0x973c87['params']['id']}})[_0x3c35('0x1c')](handleEntityNotFound(_0x20616c,null))[_0x3c35('0x1c')](function(_0x27ee86){if(_0x27ee86){return _0x27ee86['setTags'](_0x973c87[_0x3c35('0x37')]['ids'],_[_0x3c35('0x3d')](_0x973c87[_0x3c35('0x37')],[_0x3c35('0x3c'),'id'])||{})['spread'](function(){return db[_0x3c35('0x4d')][_0x3c35('0x29')]({'attributes':['id','name',_0x3c35('0x4e')],'where':{'id':_0x973c87[_0x3c35('0x37')][_0x3c35('0x3c')]}});})[_0x3c35('0x1c')](function(_0x4da18d){socket[_0x3c35('0x4f')](_0x3c35('0x50'),{'id':Number(_0x973c87[_0x3c35('0x2d')]['id']),'tags':_0x4da18d||[]});return{'id':Number(_0x973c87[_0x3c35('0x2d')]['id']),'tags':_0x4da18d||[]};});}})[_0x3c35('0x1c')](respondWithResult(_0x20616c,null))[_0x3c35('0x2c')](handleError(_0x20616c,null));};exports[_0x3c35('0x51')]=function(_0x416856,_0x3c06a7){return db['SmsInteraction'][_0x3c35('0x38')]({'where':{'id':_0x416856[_0x3c35('0x2d')]['id']}})[_0x3c35('0x1c')](handleEntityNotFound(_0x3c06a7,null))[_0x3c35('0x1c')](function(_0x5726f9){if(_0x5726f9){return _0x5726f9[_0x3c35('0x51')](_0x416856[_0x3c35('0x2a')][_0x3c35('0x3c')]);}})[_0x3c35('0x1c')](respondWithStatusCode(_0x3c06a7,null))['catch'](handleError(_0x3c06a7,null));};exports[_0x3c35('0x52')]=function(_0x3ebfd2,_0x185fb3){var _0x32329b=moment()[_0x3c35('0x53')]()[_0x3c35('0x54')]();var _0x5a7106=path[_0x3c35('0x55')](config[_0x3c35('0x56')],_0x3c35('0x57'),'files',_0x3c35('0x58'));var _0xdb0955=path['join'](_0x5a7106,_0x32329b);var _0x2a6b66=util[_0x3c35('0x59')](_0x3c35('0x5a'),_0x3ebfd2['params']['id'],_0x32329b);var _0x5e9c14=path[_0x3c35('0x55')](_0x5a7106,_0x2a6b66);var _0x163936=[];_0x163936['push']({'model':db[_0x3c35('0x5b')],'as':_0x3c35('0x5b'),'attributes':['id',_0x3c35('0x5c')],'raw':!![]});_0x163936[_0x3c35('0x5d')]({'model':db[_0x3c35('0x5e')],'as':_0x3c35('0x5f'),'attributes':['id',_0x3c35('0x60'),'lastName'],'raw':!![]});var _0x10908b=[{'model':db[_0x3c35('0x3b')],'as':_0x3c35('0x61'),'attributes':['id',_0x3c35('0x37'),_0x3c35('0x62'),_0x3c35('0x63'),'secret',_0x3c35('0x64')],'include':_0x163936}];_0x10908b[_0x3c35('0x5d')]({'model':db[_0x3c35('0x65')],'as':'Account','attributes':['id',_0x3c35('0x21')]});_0x10908b[_0x3c35('0x5d')]({'model':db[_0x3c35('0x5b')],'as':_0x3c35('0x66'),'attributes':['id',_0x3c35('0x5c')]});return db[_0x3c35('0x25')][_0x3c35('0x38')]({'where':{'id':_0x3ebfd2['params']['id']},'include':_0x10908b})[_0x3c35('0x1c')](handleEntityNotFound(_0x185fb3,null))[_0x3c35('0x1c')](function(_0x4b3230){if(_0x4b3230){var _0x2b104c=_0x4b3230['get']({'plain':!![]});fs[_0x3c35('0x67')](_0xdb0955);var _0x148d2f={'channel':'Sms','account':_0x2b104c[_0x3c35('0x68')][_0x3c35('0x21')],'agent':_0x2b104c[_0x3c35('0x66')]?_0x2b104c['Owner']['fullname']:'N.A.','createdAt':moment(_0x2b104c[_0x3c35('0x62')])[_0x3c35('0x59')](_0x3c35('0x49'))[_0x3c35('0x54')](),'closedAt':_0x2b104c[_0x3c35('0x69')]?moment(_0x2b104c[_0x3c35('0x6a')])[_0x3c35('0x59')](_0x3c35('0x49'))['toString']():'','disposition':_0x2b104c[_0x3c35('0x6b')],'messages':_(_0x2b104c[_0x3c35('0x61')])['filter']({'secret':![]})['map'](function(_0x27a2b4){return{'date':moment(_0x27a2b4[_0x3c35('0x62')])[_0x3c35('0x59')](_0x3c35('0x49'))[_0x3c35('0x54')](),'sender':_0x27a2b4[_0x3c35('0x63')]==='out'?_0x27a2b4[_0x3c35('0x5b')]?_0x27a2b4['User'][_0x3c35('0x5c')]:_0x3c35('0x6c'):_0x27a2b4['Contact'][_0x3c35('0x60')]+(_0x27a2b4['Contact']['lastName']?'\x20'+_0x27a2b4[_0x3c35('0x5f')][_0x3c35('0x6d')]:''),'body':_0x27a2b4[_0x3c35('0x37')],'direction':_0x27a2b4[_0x3c35('0x63')]==='out'?'A':'C','secret':_0x27a2b4['secret'],'read':_0x27a2b4[_0x3c35('0x64')]};})[_0x3c35('0x6e')]()};return ejs[_0x3c35('0x6f')](path[_0x3c35('0x55')](config['root'],_0x3c35('0x57'),_0x3c35('0x70'),'downloadInteraction.ejs'),{'interaction':_0x148d2f})['then'](function(_0x1a585a){var _0x41c94f=path[_0x3c35('0x55')](_0xdb0955,_0x3c35('0x71')+_0x2b104c['id']+'-'+_0x32329b+_0x3c35('0x72'));var _0x54d6d3={'path':_0x41c94f,'channel':_0x3c35('0x73'),'interactionId':_0x2b104c['id']};return pdf[_0x3c35('0x74')](_0x1a585a,_0x54d6d3);})[_0x3c35('0x1c')](function(){return new BPromise(function(_0x333344,_0x17eb4a){zipdir(_0xdb0955,{'saveTo':_0x5e9c14},function(_0x576126,_0x592e00){if(_0x576126)return _0x17eb4a(_0x576126);return _0x333344(_0x592e00);});})[_0x3c35('0x1c')](function(){return new BPromise(function(_0x1cbfd4,_0x4b28d9){rimraf(_0xdb0955,function(_0x1611f5){if(_0x1611f5)_0x4b28d9(_0x1611f5);return _0x1cbfd4();});});})['then'](function(){return _0x185fb3['download'](_0x5e9c14,_0x2a6b66,function(_0x4989f9){if(_0x4989f9){console[_0x3c35('0x75')](_0x3c35('0x76'),_0x4989f9);}else{fs[_0x3c35('0x77')](_0x5e9c14);}});});});}else{return _0x185fb3['sendStatus'](0xc8);}})['catch'](handleError(_0x185fb3,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 6418787..8681a62 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 _0x7334=['setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hook','exports','events','../../mysqldb','SmsInteraction'];(function(_0x54e55e,_0x3ad3de){var _0x4f0e1e=function(_0xc0c299){while(--_0xc0c299){_0x54e55e['push'](_0x54e55e['shift']());}};_0x4f0e1e(++_0x3ad3de);}(_0x7334,0x184));var _0x4733=function(_0x2cc855,_0x43c137){_0x2cc855=_0x2cc855-0x0;var _0x53519d=_0x7334[_0x2cc855];return _0x53519d;};'use strict';var EventEmitter=require(_0x4733('0x0'));var SmsInteraction=require(_0x4733('0x1'))['db'][_0x4733('0x2')];var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x4733('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4733('0x4'),'afterDestroy':_0x4733('0x5')};function emitEvent(_0x3645a2){return function(_0x29d7da,_0x2b146d,_0x449ead){_0x29d7da[_0x4733('0x6')]({'attributes':['id'],'raw':!![]})[_0x4733('0x7')](function(_0x12cafa){_0x29d7da[_0x4733('0x8')](_0x4733('0x9'),_0x12cafa[_0x4733('0xa')](function(_0x4c5c0){return{'id':_0x4c5c0['id']};}));return SmsMessage[_0x4733('0xb')]({'where':{'SmsInteractionId':_0x29d7da['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4733('0x7')](function(_0x1bc511){_0x29d7da[_0x4733('0x8')]('unreadMessages',_0x1bc511[_0x4733('0xc')]);SmsInteractionEvents[_0x4733('0xd')](_0x3645a2+':'+_0x29d7da['id'],_0x29d7da);SmsInteractionEvents['emit'](_0x3645a2,_0x29d7da);_0x449ead(null);})[_0x4733('0xe')](_0x449ead(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x4733('0xf')](e,emitEvent(event));}}module[_0x4733('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0xe5af=['findAll','unreadMessages','emit','catch','hasOwnProperty','hook','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','remove','setDataValue','Users','map'];(function(_0x52c949,_0x34f4ae){var _0x1fc429=function(_0x36a351){while(--_0x36a351){_0x52c949['push'](_0x52c949['shift']());}};_0x1fc429(++_0x34f4ae);}(_0xe5af,0x9c));var _0xfe5a=function(_0xdc815e,_0x10ac44){_0xdc815e=_0xdc815e-0x0;var _0x19285c=_0xe5af[_0xdc815e];return _0x19285c;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xfe5a('0x0'))['db'][_0xfe5a('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0xfe5a('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xfe5a('0x3')](0x0);var events={'afterCreate':_0xfe5a('0x4'),'afterUpdate':'update','afterDestroy':_0xfe5a('0x5')};function emitEvent(_0x48e3a7){return function(_0x526677,_0x37455d,_0x2039cd){_0x526677['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x356c69){_0x526677[_0xfe5a('0x6')](_0xfe5a('0x7'),_0x356c69[_0xfe5a('0x8')](function(_0x5cd100){return{'id':_0x5cd100['id']};}));return SmsMessage[_0xfe5a('0x9')]({'where':{'SmsInteractionId':_0x526677['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x51718e){_0x526677[_0xfe5a('0x6')](_0xfe5a('0xa'),_0x51718e['length']);SmsInteractionEvents[_0xfe5a('0xb')](_0x48e3a7+':'+_0x526677['id'],_0x526677);SmsInteractionEvents[_0xfe5a('0xb')](_0x48e3a7,_0x526677);_0x2039cd(null);})[_0xfe5a('0xc')](_0x2039cd(null));};}for(var e in events){if(events[_0xfe5a('0xd')](e)){var event=events[e];SmsInteraction[_0xfe5a('0xe')](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 310bbbd..20e3a36 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 _0x3a84=['sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','../../config/environment','define','SmsInteraction'];(function(_0x2e0b7b,_0x1325f1){var _0x439cd6=function(_0x2b876d){while(--_0x2b876d){_0x2e0b7b['push'](_0x2e0b7b['shift']());}};_0x439cd6(++_0x1325f1);}(_0x3a84,0xca));var _0x43a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a84[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x43a8('0x0'));var util=require(_0x43a8('0x1'));var logger=require(_0x43a8('0x2'))('api');var moment=require(_0x43a8('0x3'));var BPromise=require(_0x43a8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x43a8('0x5'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x26611f,_0xd94a75){return _0x26611f[_0x43a8('0x6')](_0x43a8('0x7'),attributes,{'tableName':_0x43a8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4c32cb,_0x521fc6,_0x480a2a){if(_0x4c32cb[_0x43a8('0x9')](_0x43a8('0xa'))){_0x4c32cb[_0x43a8('0xb')]=moment()[_0x43a8('0xc')](_0x43a8('0xd'));}_0x480a2a(null,_0x4c32cb);}}});}; \ No newline at end of file +var _0xf34c=['SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xf34c,0x196));var _0xcf34=function(_0x46a896,_0x1d31f4){_0x46a896=_0x46a896-0x0;var _0xd4f86c=_0xf34c[_0x46a896];return _0xd4f86c;};'use strict';var _=require(_0xcf34('0x0'));var util=require('util');var logger=require(_0xcf34('0x1'))(_0xcf34('0x2'));var moment=require(_0xcf34('0x3'));var BPromise=require(_0xcf34('0x4'));var rp=require(_0xcf34('0x5'));var fs=require('fs');var path=require(_0xcf34('0x6'));var rimraf=require(_0xcf34('0x7'));var config=require(_0xcf34('0x8'));var attributes=require(_0xcf34('0x9'));module[_0xcf34('0xa')]=function(_0x165002,_0x5b1c3f){return _0x165002[_0xcf34('0xb')](_0xcf34('0xc'),attributes,{'tableName':_0xcf34('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x476596,_0x477013,_0x494053){if(_0x476596[_0xcf34('0xe')](_0xcf34('0xf'))){_0x476596[_0xcf34('0x10')]=moment()[_0xcf34('0x11')](_0xcf34('0x12'));}_0x494053(null,_0x476596);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 579f5a3..032c972 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 _0x6eba=['SmsInteraction','update','body','options','raw','where','limit','AddTagsToSmsInteraction','find','ids','omit','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','UpdateSmsInteraction'];(function(_0x11017d,_0x2f50bc){var _0x4b1d71=function(_0x4b5ef2){while(--_0x4b5ef2){_0x11017d['push'](_0x11017d['shift']());}};_0x4b1d71(++_0x2f50bc);}(_0x6eba,0xd5));var _0xa6eb=function(_0x32fca5,_0x25a682){_0x32fca5=_0x32fca5-0x0;var _0x22e54a=_0x6eba[_0x32fca5];return _0x22e54a;};'use strict';var _=require(_0xa6eb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa6eb('0x1'));var rs=require(_0xa6eb('0x2'));var fs=require('fs');var Redis=require(_0xa6eb('0x3'));var db=require(_0xa6eb('0x4'))['db'];var utils=require(_0xa6eb('0x5'));var logger=require(_0xa6eb('0x6'))(_0xa6eb('0x7'));var config=require(_0xa6eb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa6eb('0x9')][_0xa6eb('0xa')]({'port':0x232a});config[_0xa6eb('0xb')]=_[_0xa6eb('0xc')](config['redis'],{'host':_0xa6eb('0xd'),'port':0x18eb});var socket=require(_0xa6eb('0xe'))(new Redis(config[_0xa6eb('0xb')]));require('./smsInteraction.socket')[_0xa6eb('0xf')](socket);function respondWithRpcPromise(_0x5cf0e2,_0x2b599f,_0x4819cf){return new BPromise(function(_0x1e55bd,_0x3e0389){return client['request'](_0x5cf0e2,_0x4819cf)[_0xa6eb('0x10')](function(_0x4b0f47){logger['info'](_0xa6eb('0x11'),_0x2b599f,_0xa6eb('0x12'));logger[_0xa6eb('0x13')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x2b599f,_0xa6eb('0x12'),JSON[_0xa6eb('0x14')](_0x4b0f47));if(_0x4b0f47[_0xa6eb('0x15')]){if(_0x4b0f47[_0xa6eb('0x15')]['code']===0x1f4){logger[_0xa6eb('0x15')](_0xa6eb('0x11'),_0x2b599f,_0x4b0f47[_0xa6eb('0x15')][_0xa6eb('0x16')]);return _0x3e0389(_0x4b0f47[_0xa6eb('0x15')][_0xa6eb('0x16')]);}logger[_0xa6eb('0x15')](_0xa6eb('0x11'),_0x2b599f,_0x4b0f47[_0xa6eb('0x15')][_0xa6eb('0x16')]);return _0x1e55bd(_0x4b0f47[_0xa6eb('0x15')][_0xa6eb('0x16')]);}else{logger[_0xa6eb('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x2b599f,_0xa6eb('0x12'));_0x1e55bd(_0x4b0f47[_0xa6eb('0x18')][_0xa6eb('0x16')]);}})[_0xa6eb('0x19')](function(_0x2a6906){logger[_0xa6eb('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x2b599f,_0x2a6906);_0x3e0389(_0x2a6906);});});}exports[_0xa6eb('0x1a')]=function(_0x4e42a8){var _0x2dbf0e=this;return new Promise(function(_0x481596,_0x4cf5fa){return db[_0xa6eb('0x1b')][_0xa6eb('0x1c')](_0x4e42a8[_0xa6eb('0x1d')],{'raw':_0x4e42a8[_0xa6eb('0x1e')]?_0x4e42a8['options'][_0xa6eb('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e42a8[_0xa6eb('0x1e')]?_0x4e42a8[_0xa6eb('0x1e')][_0xa6eb('0x20')]||null:null,'attributes':_0x4e42a8[_0xa6eb('0x1e')]?_0x4e42a8[_0xa6eb('0x1e')]['attributes']||null:null,'limit':_0x4e42a8[_0xa6eb('0x1e')]?_0x4e42a8['options'][_0xa6eb('0x21')]||null:null})[_0xa6eb('0x10')](function(_0x438389){logger[_0xa6eb('0x17')](_0xa6eb('0x1a'),_0x4e42a8);logger[_0xa6eb('0x13')](_0xa6eb('0x1a'),_0x4e42a8,JSON[_0xa6eb('0x14')](_0x438389));_0x481596(_0x438389);})[_0xa6eb('0x19')](function(_0x56fa61){logger[_0xa6eb('0x15')]('UpdateSmsInteraction',_0x56fa61['message'],_0x4e42a8);_0x4cf5fa(_0x2dbf0e[_0xa6eb('0x15')](0x1f4,_0x56fa61['message']));});});};exports[_0xa6eb('0x22')]=function(_0x4c158c){return new Promise(function(_0xda3d01,_0x99b468){return db[_0xa6eb('0x1b')][_0xa6eb('0x23')]({'where':_0x4c158c['options']?_0x4c158c['options'][_0xa6eb('0x20')]||null:null})[_0xa6eb('0x10')](function(_0xe9d71b){if(_0xe9d71b){return _0xe9d71b['addTags'](_0x4c158c[_0xa6eb('0x1d')][_0xa6eb('0x24')],_[_0xa6eb('0x25')](_0x4c158c[_0xa6eb('0x1d')],[_0xa6eb('0x24'),'id'])||{});}})[_0xa6eb('0x26')](function(_0x398893){logger[_0xa6eb('0x17')](_0xa6eb('0x27'),_0x4c158c);logger[_0xa6eb('0x13')](_0xa6eb('0x27'),_0x4c158c,JSON[_0xa6eb('0x14')](_0x398893));_0xda3d01(_0x398893);})[_0xa6eb('0x19')](function(_0x40fa38){logger['error']('AddTags',_0x40fa38['message'],_0x4c158c);_0x99b468(_this[_0xa6eb('0x15')](0x1f4,_0x40fa38[_0xa6eb('0x16')]));});});}; \ No newline at end of file +var _0x70e7=['redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','update','body','options','where','limit','UpdateSmsInteraction','debug','stringify','AddTagsToSmsInteraction','SmsInteraction','find','addTags','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x33e9dc,_0x5809b9){var _0x121fa5=function(_0x543b87){while(--_0x543b87){_0x33e9dc['push'](_0x33e9dc['shift']());}};_0x121fa5(++_0x5809b9);}(_0x70e7,0xca));var _0x770e=function(_0x478d7b,_0x55f7d2){_0x478d7b=_0x478d7b-0x0;var _0x5c460f=_0x70e7[_0x478d7b];return _0x5c460f;};'use strict';var _=require(_0x770e('0x0'));var util=require('util');var moment=require(_0x770e('0x1'));var BPromise=require(_0x770e('0x2'));var rs=require(_0x770e('0x3'));var fs=require('fs');var Redis=require(_0x770e('0x4'));var db=require(_0x770e('0x5'))['db'];var utils=require(_0x770e('0x6'));var logger=require('../../config/logger')(_0x770e('0x7'));var config=require(_0x770e('0x8'));var jayson=require(_0x770e('0x9'));var client=jayson[_0x770e('0xa')][_0x770e('0xb')]({'port':0x232a});config['redis']=_[_0x770e('0xc')](config[_0x770e('0xd')],{'host':_0x770e('0xe'),'port':0x18eb});var socket=require(_0x770e('0xf'))(new Redis(config[_0x770e('0xd')]));require(_0x770e('0x10'))[_0x770e('0x11')](socket);function respondWithRpcPromise(_0x4711f6,_0x9a9362,_0x47c041){return new BPromise(function(_0x3f7d06,_0x4f8d6e){return client[_0x770e('0x12')](_0x4711f6,_0x47c041)[_0x770e('0x13')](function(_0x27ce39){logger[_0x770e('0x14')](_0x770e('0x15'),_0x9a9362,'request\x20sent');logger['debug'](_0x770e('0x16'),_0x9a9362,_0x770e('0x17'),JSON['stringify'](_0x27ce39));if(_0x27ce39[_0x770e('0x18')]){if(_0x27ce39[_0x770e('0x18')][_0x770e('0x19')]===0x1f4){logger[_0x770e('0x18')](_0x770e('0x15'),_0x9a9362,_0x27ce39[_0x770e('0x18')][_0x770e('0x1a')]);return _0x4f8d6e(_0x27ce39[_0x770e('0x18')][_0x770e('0x1a')]);}logger[_0x770e('0x18')](_0x770e('0x15'),_0x9a9362,_0x27ce39[_0x770e('0x18')][_0x770e('0x1a')]);return _0x3f7d06(_0x27ce39[_0x770e('0x18')]['message']);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x9a9362,_0x770e('0x17'));_0x3f7d06(_0x27ce39['result'][_0x770e('0x1a')]);}})[_0x770e('0x1b')](function(_0x3db866){logger[_0x770e('0x18')]('SmsInteraction,\x20%s,\x20%s',_0x9a9362,_0x3db866);_0x4f8d6e(_0x3db866);});});}exports['UpdateSmsInteraction']=function(_0x1c0c7c){var _0x502eb9=this;return new Promise(function(_0x3dbeb3,_0x149bf1){return db['SmsInteraction'][_0x770e('0x1c')](_0x1c0c7c[_0x770e('0x1d')],{'raw':_0x1c0c7c[_0x770e('0x1e')]?_0x1c0c7c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c0c7c[_0x770e('0x1e')]?_0x1c0c7c[_0x770e('0x1e')][_0x770e('0x1f')]||null:null,'attributes':_0x1c0c7c['options']?_0x1c0c7c[_0x770e('0x1e')]['attributes']||null:null,'limit':_0x1c0c7c[_0x770e('0x1e')]?_0x1c0c7c[_0x770e('0x1e')][_0x770e('0x20')]||null:null})[_0x770e('0x13')](function(_0x1bab14){logger[_0x770e('0x14')](_0x770e('0x21'),_0x1c0c7c);logger[_0x770e('0x22')]('UpdateSmsInteraction',_0x1c0c7c,JSON[_0x770e('0x23')](_0x1bab14));_0x3dbeb3(_0x1bab14);})[_0x770e('0x1b')](function(_0x547ac4){logger[_0x770e('0x18')](_0x770e('0x21'),_0x547ac4[_0x770e('0x1a')],_0x1c0c7c);_0x149bf1(_0x502eb9[_0x770e('0x18')](0x1f4,_0x547ac4[_0x770e('0x1a')]));});});};exports[_0x770e('0x24')]=function(_0x2fa49a){return new Promise(function(_0x6cb035,_0x46e2d1){return db[_0x770e('0x25')][_0x770e('0x26')]({'where':_0x2fa49a['options']?_0x2fa49a[_0x770e('0x1e')][_0x770e('0x1f')]||null:null})['then'](function(_0x3f440f){if(_0x3f440f){return _0x3f440f[_0x770e('0x27')](_0x2fa49a[_0x770e('0x1d')][_0x770e('0x28')],_[_0x770e('0x29')](_0x2fa49a[_0x770e('0x1d')],['ids','id'])||{});}})['spread'](function(_0x4bdf45){logger['info'](_0x770e('0x2a'),_0x2fa49a);logger[_0x770e('0x22')](_0x770e('0x2a'),_0x2fa49a,JSON['stringify'](_0x4bdf45));_0x6cb035(_0x4bdf45);})['catch'](function(_0x1d1f58){logger[_0x770e('0x18')](_0x770e('0x2a'),_0x1d1f58[_0x770e('0x1a')],_0x2fa49a);_0x46e2d1(_this[_0x770e('0x18')](0x1f4,_0x1d1f58['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 092d4db..9ee9977 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 _0xe79a=['removeListener','register','smsInteraction:','./smsInteraction.events','save','remove','update'];(function(_0x2c2289,_0x1ddd5e){var _0xc2d91d=function(_0x36221f){while(--_0x36221f){_0x2c2289['push'](_0x2c2289['shift']());}};_0xc2d91d(++_0x1ddd5e);}(_0xe79a,0x10d));var _0xae79=function(_0x485b7f,_0x53f048){_0x485b7f=_0x485b7f-0x0;var _0x5ab9bd=_0xe79a[_0x485b7f];return _0x5ab9bd;};'use strict';var SmsInteractionEvents=require(_0xae79('0x0'));var events=[_0xae79('0x1'),_0xae79('0x2'),_0xae79('0x3')];function createListener(_0x520319,_0xee3a18){return function(_0x255b1b){_0xee3a18['emit'](_0x520319,_0x255b1b);};}function removeListener(_0x5643ea,_0x4cda63){return function(){SmsInteractionEvents[_0xae79('0x4')](_0x5643ea,_0x4cda63);};}exports[_0xae79('0x5')]=function(_0x3e0281){for(var _0x8c8438=0x0,_0x2a1f35=events['length'];_0x8c8438<_0x2a1f35;_0x8c8438++){var _0x5e9974=events[_0x8c8438];var _0xdee10=createListener(_0xae79('0x6')+_0x5e9974,_0x3e0281);SmsInteractionEvents['on'](_0x5e9974,_0xdee10);}}; \ No newline at end of file +var _0x7022=['removeListener','length','smsInteraction:','./smsInteraction.events','emit'];(function(_0x524a13,_0x22668c){var _0x8a623e=function(_0x4bacd5){while(--_0x4bacd5){_0x524a13['push'](_0x524a13['shift']());}};_0x8a623e(++_0x22668c);}(_0x7022,0xa3));var _0x2702=function(_0x407df3,_0x1c37da){_0x407df3=_0x407df3-0x0;var _0xce2cfd=_0x7022[_0x407df3];return _0xce2cfd;};'use strict';var SmsInteractionEvents=require(_0x2702('0x0'));var events=['save','remove','update'];function createListener(_0x8b165b,_0x43a313){return function(_0x4883cb){_0x43a313[_0x2702('0x1')](_0x8b165b,_0x4883cb);};}function removeListener(_0x489ef1,_0x2d8216){return function(){SmsInteractionEvents[_0x2702('0x2')](_0x489ef1,_0x2d8216);};}exports['register']=function(_0x2672d7){for(var _0x4c90ab=0x0,_0xe5021a=events[_0x2702('0x3')];_0x4c90ab<_0xe5021a;_0x4c90ab++){var _0x1b37c8=events[_0x4c90ab];var _0x4e0a9e=createListener(_0x2702('0x4')+_0x1b37c8,_0x2672d7);SmsInteractionEvents['on'](_0x1b37c8,_0x4e0a9e);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 1328730..48edc3b 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 _0x51c5=['accept','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','sms','create','post','/:id/status','status','put','update','/:id/accept'];(function(_0x12cb53,_0x3c2f70){var _0x5dbe80=function(_0x1325f5){while(--_0x1325f5){_0x12cb53['push'](_0x12cb53['shift']());}};_0x5dbe80(++_0x3c2f70);}(_0x51c5,0x8f));var _0x551c=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x51c5[_0x1928c9];return _0x51b5fb;};'use strict';var multer=require(_0x551c('0x0'));var util=require(_0x551c('0x1'));var path=require(_0x551c('0x2'));var timeout=require(_0x551c('0x3'));var express=require(_0x551c('0x4'));var router=express[_0x551c('0x5')]();var fs_extra=require(_0x551c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x551c('0x7'));var config=require(_0x551c('0x8'));var controller=require(_0x551c('0x9'));router[_0x551c('0xa')]('/',auth[_0x551c('0xb')](),controller[_0x551c('0xc')]);router[_0x551c('0xa')](_0x551c('0xd'),auth['isAuthenticated'](),controller[_0x551c('0xe')]);router[_0x551c('0xa')](_0x551c('0xf'),auth['isAuthenticated'](),controller[_0x551c('0x10')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0x551c('0x11'),'smsmessage:create'),controller[_0x551c('0x12')]);router[_0x551c('0x13')](_0x551c('0x14'),controller[_0x551c('0x15')]);router[_0x551c('0x16')](_0x551c('0xf'),auth['isAuthenticated'](),controller[_0x551c('0x17')]);router[_0x551c('0x16')](_0x551c('0x18'),auth['isAuthenticated'](),controller[_0x551c('0x19')]);router[_0x551c('0x16')]('/:id/reject',auth[_0x551c('0xb')](),controller['reject']);router[_0x551c('0x1a')](_0x551c('0xf'),auth[_0x551c('0xb')](),controller[_0x551c('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xca21=['/:id/status','put','/:id/accept','accept','reject','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','describe','/:id','show','post','tracked','sms','create'];(function(_0x1b522b,_0x33332b){var _0x1a57b5=function(_0x11cb07){while(--_0x11cb07){_0x1b522b['push'](_0x1b522b['shift']());}};_0x1a57b5(++_0x33332b);}(_0xca21,0xcf));var _0x1ca2=function(_0x5ef660,_0x773bde){_0x5ef660=_0x5ef660-0x0;var _0x219718=_0xca21[_0x5ef660];return _0x219718;};'use strict';var multer=require(_0x1ca2('0x0'));var util=require(_0x1ca2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1ca2('0x2'));var router=express[_0x1ca2('0x3')]();var fs_extra=require(_0x1ca2('0x4'));var auth=require(_0x1ca2('0x5'));var interaction=require(_0x1ca2('0x6'));var config=require(_0x1ca2('0x7'));var controller=require(_0x1ca2('0x8'));router[_0x1ca2('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1ca2('0x9')]('/describe',auth[_0x1ca2('0xa')](),controller[_0x1ca2('0xb')]);router['get'](_0x1ca2('0xc'),auth['isAuthenticated'](),controller[_0x1ca2('0xd')]);router[_0x1ca2('0xe')]('/',auth[_0x1ca2('0xa')](),interaction[_0x1ca2('0xf')](_0x1ca2('0x10'),'smsmessage:create'),controller[_0x1ca2('0x11')]);router['post'](_0x1ca2('0x12'),controller['status']);router[_0x1ca2('0x13')]('/:id',auth[_0x1ca2('0xa')](),controller['update']);router['put'](_0x1ca2('0x14'),auth[_0x1ca2('0xa')](),controller[_0x1ca2('0x15')]);router['put']('/:id/reject',auth[_0x1ca2('0xa')](),controller[_0x1ca2('0x16')]);router['delete'](_0x1ca2('0xc'),auth[_0x1ca2('0xa')](),controller[_0x1ca2('0x17')]);module[_0x1ca2('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 464f32d..236eb80 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 _0x89c9=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x216f4d,_0xfa6106){var _0x528c38=function(_0x5da061){while(--_0x5da061){_0x216f4d['push'](_0x216f4d['shift']());}};_0x528c38(++_0xfa6106);}(_0x89c9,0xb0));var _0x989c=function(_0x45c61e,_0x59694d){_0x45c61e=_0x45c61e-0x0;var _0x19033c=_0x89c9[_0x45c61e];return _0x19033c;};'use strict';var Sequelize=require(_0x989c('0x0'));module[_0x989c('0x1')]={'body':{'type':Sequelize[_0x989c('0x2')](_0x989c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x989c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x989c('0x5')]('in',_0x989c('0x6')),'defaultValue':_0x989c('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x989c('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x989c('0x7')]},'providerResponse':{'type':Sequelize[_0x989c('0x2')]}}; \ No newline at end of file +var _0x2a96=['sequelize','exports','TEXT','medium','BOOLEAN','out','STRING','DATE'];(function(_0x17764a,_0x1cabab){var _0x1a4bf1=function(_0x10227b){while(--_0x10227b){_0x17764a['push'](_0x17764a['shift']());}};_0x1a4bf1(++_0x1cabab);}(_0x2a96,0xb8));var _0x62a9=function(_0x549d57,_0x6b8598){_0x549d57=_0x549d57-0x0;var _0x330291=_0x2a96[_0x549d57];return _0x330291;};'use strict';var Sequelize=require(_0x62a9('0x0'));module[_0x62a9('0x1')]={'body':{'type':Sequelize[_0x62a9('0x2')](_0x62a9('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x62a9('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x62a9('0x5')),'defaultValue':_0x62a9('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x62a9('0x6')](0xbe)},'phone':{'type':Sequelize[_0x62a9('0x6')]},'readAt':{'type':Sequelize[_0x62a9('0x7')]},'secret':{'type':Sequelize[_0x62a9('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x62a9('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 4b025b7..3992a35 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 _0x2dd8=['contact','User','agent','fullname','email','internal','SIP/%s','motionChannel','channel','event','accept','EventManager','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','interface','rejectmessage','SmsAccount','SmsAccountId','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./smsMessage.socket','register','jayson/promise','client','http','request','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','json','offset','undefined','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','map','SmsMessage','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','count','includeAll','include','rows','params','find','create','body','update','describe','sms','readAt','format','UserId','get','SmsInteraction','SmsInteractionId','isNil','user','interaction','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT'];(function(_0x343dfb,_0xed8587){var _0x297fe2=function(_0x19cbbd){while(--_0x19cbbd){_0x343dfb['push'](_0x343dfb['shift']());}};_0x297fe2(++_0xed8587);}(_0x2dd8,0x143));var _0x82dd=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2dd8[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x82dd('0x0'));var rimraf=require(_0x82dd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x82dd('0x2'));var moment=require(_0x82dd('0x3'));var BPromise=require(_0x82dd('0x4'));var Mustache=require(_0x82dd('0x5'));var util=require(_0x82dd('0x6'));var path=require(_0x82dd('0x7'));var sox=require(_0x82dd('0x8'));var csv=require('to-csv');var ejs=require(_0x82dd('0x9'));var fs=require('fs');var fs_extra=require(_0x82dd('0xa'));var _=require(_0x82dd('0xb'));var squel=require(_0x82dd('0xc'));var crypto=require('crypto');var jsforce=require(_0x82dd('0xd'));var deskjs=require(_0x82dd('0xe'));var toCsv=require(_0x82dd('0xf'));var querystring=require(_0x82dd('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x82dd('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x82dd('0x12'));var hardwareService=require(_0x82dd('0x13'));var logger=require(_0x82dd('0x14'))(_0x82dd('0x15'));var utils=require(_0x82dd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x82dd('0x17'));var db=require(_0x82dd('0x18'))['db'];config[_0x82dd('0x19')]=_[_0x82dd('0x1a')](config[_0x82dd('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x82dd('0x19')]));require(_0x82dd('0x1b'))[_0x82dd('0x1c')](socket);var jayson=require(_0x82dd('0x1d'));var client=jayson[_0x82dd('0x1e')][_0x82dd('0x1f')]({'port':0x232c});var client9002=jayson[_0x82dd('0x1e')][_0x82dd('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x101eb7,_0x1b90e0,_0x3d7664,_0x466fd3){return new BPromise(function(_0x1bdd14,_0x51d2a9){var _0x352400=_0x466fd3||client;return _0x352400[_0x82dd('0x20')](_0x101eb7,_0x3d7664)[_0x82dd('0x21')](function(_0x40a47a){logger[_0x82dd('0x22')](_0x82dd('0x23'),_0x1b90e0,_0x82dd('0x24'));logger[_0x82dd('0x25')](_0x82dd('0x26'),_0x1b90e0,_0x82dd('0x24'),JSON[_0x82dd('0x27')](_0x40a47a));if(_0x40a47a[_0x82dd('0x28')]){if(_0x40a47a[_0x82dd('0x28')]['code']===0x1f4){logger[_0x82dd('0x28')](_0x82dd('0x23'),_0x1b90e0,_0x40a47a[_0x82dd('0x28')][_0x82dd('0x29')]);return _0x51d2a9(_0x40a47a[_0x82dd('0x28')][_0x82dd('0x29')]);}logger[_0x82dd('0x28')](_0x82dd('0x23'),_0x1b90e0,_0x40a47a['error']['message']);return _0x1bdd14(_0x40a47a[_0x82dd('0x28')][_0x82dd('0x29')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x1b90e0,_0x82dd('0x24'));_0x1bdd14(_0x40a47a[_0x82dd('0x2a')][_0x82dd('0x29')]);}})[_0x82dd('0x2b')](function(_0x4609c1){logger[_0x82dd('0x28')](_0x82dd('0x23'),_0x1b90e0,_0x4609c1);_0x51d2a9(_0x4609c1);});});}function respondWithStatusCode(_0x1374e3,_0x1ae382){_0x1ae382=_0x1ae382||0xcc;return function(_0x1d27f1){if(_0x1d27f1){return _0x1374e3[_0x82dd('0x2c')](_0x1ae382);}return _0x1374e3[_0x82dd('0x2d')](_0x1ae382)[_0x82dd('0x2e')]();};}function respondWithResult(_0x242e59,_0x5543c2){_0x5543c2=_0x5543c2||0xc8;return function(_0x17531e){if(_0x17531e){return _0x242e59[_0x82dd('0x2d')](_0x5543c2)[_0x82dd('0x2f')](_0x17531e);}};}function respondWithFilteredResult(_0x53965f,_0x15da13){return function(_0x5238a2){if(_0x5238a2){var _0x15f31f=typeof _0x15da13[_0x82dd('0x30')]===_0x82dd('0x31')&&typeof _0x15da13['limit']===_0x82dd('0x31');var _0x212720=_0x5238a2['count'];var _0x5cfdee=_0x15f31f?0x0:_0x15da13[_0x82dd('0x30')];var _0x3ae12a=_0x15f31f?_0x5238a2['count']:_0x15da13[_0x82dd('0x30')]+_0x15da13[_0x82dd('0x32')];var _0x2d2b7b;if(_0x3ae12a>=_0x212720){_0x3ae12a=_0x212720;_0x2d2b7b=0xc8;}else{_0x2d2b7b=0xce;}_0x53965f['status'](_0x2d2b7b);return _0x53965f[_0x82dd('0x33')](_0x82dd('0x34'),_0x5cfdee+'-'+_0x3ae12a+'/'+_0x212720)['json'](_0x5238a2);}return null;};}function patchUpdates(_0x571cfb){return function(_0x1b3c04){try{jsonpatch[_0x82dd('0x35')](_0x1b3c04,_0x571cfb,!![]);}catch(_0x50d230){return BPromise[_0x82dd('0x36')](_0x50d230);}return _0x1b3c04[_0x82dd('0x37')]();};}function saveUpdates(_0xac506c,_0x5af437){return function(_0x31e34c){if(_0x31e34c){return _0x31e34c['update'](_0xac506c)[_0x82dd('0x21')](function(_0x140d7b){return _0x140d7b;});}return null;};}function removeEntity(_0x4bec1e,_0x304284){return function(_0x40998a){if(_0x40998a){return _0x40998a[_0x82dd('0x38')]()[_0x82dd('0x21')](function(){_0x4bec1e['status'](0xcc)[_0x82dd('0x2e')]();});}};}function handleEntityNotFound(_0x2605f6,_0x38bbc9){return function(_0x2f57d9){if(!_0x2f57d9){_0x2605f6[_0x82dd('0x2c')](0x194);}return _0x2f57d9;};}function handleError(_0x24e0c5,_0x2b9c94){_0x2b9c94=_0x2b9c94||0x1f4;return function(_0x9173c8){logger['error'](_0x9173c8[_0x82dd('0x39')]);if(_0x9173c8['name']){delete _0x9173c8[_0x82dd('0x3a')];}_0x24e0c5[_0x82dd('0x2d')](_0x2b9c94)[_0x82dd('0x3b')](_0x9173c8);};}exports['index']=function(_0x26f682,_0x457d44){var _0x1517d8={},_0x2608ef={},_0x47dcb3={'count':0x0,'rows':[]};var _0x5e6d7e=_[_0x82dd('0x3c')](db[_0x82dd('0x3d')][_0x82dd('0x3e')],function(_0x19c736){return{'name':_0x19c736['fieldName'],'type':_0x19c736['type'][_0x82dd('0x3f')]};});_0x2608ef[_0x82dd('0x40')]=_['map'](_0x5e6d7e,_0x82dd('0x3a'));_0x2608ef[_0x82dd('0x41')]=_[_0x82dd('0x42')](_0x26f682[_0x82dd('0x41')]);_0x2608ef[_0x82dd('0x43')]=_[_0x82dd('0x44')](_0x2608ef[_0x82dd('0x40')],_0x2608ef[_0x82dd('0x41')]);_0x1517d8[_0x82dd('0x45')]=_[_0x82dd('0x44')](_0x2608ef[_0x82dd('0x40')],qs[_0x82dd('0x46')](_0x26f682[_0x82dd('0x41')][_0x82dd('0x46')]));_0x1517d8[_0x82dd('0x45')]=_0x1517d8[_0x82dd('0x45')][_0x82dd('0x47')]?_0x1517d8[_0x82dd('0x45')]:_0x2608ef[_0x82dd('0x40')];if(!_0x26f682['query'][_0x82dd('0x48')]('nolimit')){_0x1517d8['limit']=qs[_0x82dd('0x32')](_0x26f682[_0x82dd('0x41')][_0x82dd('0x32')]);_0x1517d8['offset']=qs[_0x82dd('0x30')](_0x26f682[_0x82dd('0x41')][_0x82dd('0x30')]);}_0x1517d8[_0x82dd('0x49')]=qs[_0x82dd('0x4a')](_0x26f682[_0x82dd('0x41')]['sort']);_0x1517d8[_0x82dd('0x4b')]=qs[_0x82dd('0x43')](_[_0x82dd('0x4c')](_0x26f682[_0x82dd('0x41')],_0x2608ef[_0x82dd('0x43')]),_0x5e6d7e);if(_0x26f682['query'][_0x82dd('0x4d')]){_0x1517d8[_0x82dd('0x4b')]=_['merge'](_0x1517d8[_0x82dd('0x4b')],{'$or':_[_0x82dd('0x3c')](_0x5e6d7e,function(_0x1ed29a){if(_0x1ed29a[_0x82dd('0x4e')]!==_0x82dd('0x4f')){var _0x3d5606={};_0x3d5606[_0x1ed29a['name']]={'$like':'%'+_0x26f682[_0x82dd('0x41')][_0x82dd('0x4d')]+'%'};return _0x3d5606;}})});}_0x1517d8=_[_0x82dd('0x50')]({},_0x1517d8,_0x26f682[_0x82dd('0x51')]);var _0x4de57f={'where':_0x1517d8[_0x82dd('0x4b')]};return db[_0x82dd('0x3d')][_0x82dd('0x52')](_0x4de57f)['then'](function(_0x5e8a07){_0x47dcb3[_0x82dd('0x52')]=_0x5e8a07;if(_0x26f682[_0x82dd('0x41')][_0x82dd('0x53')]){_0x1517d8[_0x82dd('0x54')]=[{'all':!![]}];}return db[_0x82dd('0x3d')]['findAll'](_0x1517d8);})['then'](function(_0x47389c){_0x47dcb3[_0x82dd('0x55')]=_0x47389c;return _0x47dcb3;})['then'](respondWithFilteredResult(_0x457d44,_0x1517d8))['catch'](handleError(_0x457d44,null));};exports['show']=function(_0x676ebd,_0x489f38){var _0x2805a0={'raw':!![],'where':{'id':_0x676ebd[_0x82dd('0x56')]['id']}},_0x4b269f={};_0x4b269f[_0x82dd('0x40')]=_[_0x82dd('0x42')](db[_0x82dd('0x3d')][_0x82dd('0x3e')]);_0x4b269f[_0x82dd('0x41')]=_[_0x82dd('0x42')](_0x676ebd['query']);_0x4b269f[_0x82dd('0x43')]=_[_0x82dd('0x44')](_0x4b269f[_0x82dd('0x40')],_0x4b269f[_0x82dd('0x41')]);_0x2805a0[_0x82dd('0x45')]=_[_0x82dd('0x44')](_0x4b269f[_0x82dd('0x40')],qs[_0x82dd('0x46')](_0x676ebd['query'][_0x82dd('0x46')]));_0x2805a0[_0x82dd('0x45')]=_0x2805a0[_0x82dd('0x45')][_0x82dd('0x47')]?_0x2805a0[_0x82dd('0x45')]:_0x4b269f[_0x82dd('0x40')];if(_0x676ebd[_0x82dd('0x41')]['includeAll']){_0x2805a0[_0x82dd('0x54')]=[{'all':!![]}];}_0x2805a0=_[_0x82dd('0x50')]({},_0x2805a0,_0x676ebd['options']);return db[_0x82dd('0x3d')][_0x82dd('0x57')](_0x2805a0)[_0x82dd('0x21')](handleEntityNotFound(_0x489f38,null))['then'](respondWithResult(_0x489f38,null))[_0x82dd('0x2b')](handleError(_0x489f38,null));};exports['create']=function(_0x4707a1,_0x12b7a0){return db[_0x82dd('0x3d')][_0x82dd('0x58')](_0x4707a1[_0x82dd('0x59')],{})[_0x82dd('0x21')](respondWithResult(_0x12b7a0,0xc9))[_0x82dd('0x2b')](handleError(_0x12b7a0,null));};exports[_0x82dd('0x5a')]=function(_0x186db4,_0x4d00e5){if(_0x186db4[_0x82dd('0x59')]['id']){delete _0x186db4[_0x82dd('0x59')]['id'];}return db[_0x82dd('0x3d')]['find']({'where':{'id':_0x186db4[_0x82dd('0x56')]['id']}})[_0x82dd('0x21')](handleEntityNotFound(_0x4d00e5,null))[_0x82dd('0x21')](saveUpdates(_0x186db4[_0x82dd('0x59')],null))['then'](respondWithResult(_0x4d00e5,null))[_0x82dd('0x2b')](handleError(_0x4d00e5,null));};exports[_0x82dd('0x38')]=function(_0x20110c,_0x249272){return db[_0x82dd('0x3d')][_0x82dd('0x57')]({'where':{'id':_0x20110c['params']['id']}})[_0x82dd('0x21')](handleEntityNotFound(_0x249272,null))[_0x82dd('0x21')](removeEntity(_0x249272,null))[_0x82dd('0x2b')](handleError(_0x249272,null));};exports[_0x82dd('0x5b')]=function(_0x493000,_0x29afdf){return db['SmsMessage'][_0x82dd('0x5b')]()[_0x82dd('0x21')](respondWithResult(_0x29afdf,null))['catch'](handleError(_0x29afdf,null));};var interaction_log=require(_0x82dd('0x14'))('sms-interactions');exports['accept']=function(_0x33854f,_0x48d67c,_0x3265f7){var _0x5b3581={'agent':{},'channel':_0x82dd('0x5c')};if(_0x33854f[_0x82dd('0x59')]['id']){delete _0x33854f['body']['id'];}_0x33854f['body']['read']=!![];_0x33854f[_0x82dd('0x59')][_0x82dd('0x5d')]=moment()[_0x82dd('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x33854f[_0x82dd('0x59')][_0x82dd('0x5f')]=_0x33854f['body'][_0x82dd('0x5f')]||_0x33854f['user']['id'];_0x5b3581['agent']['id']=_0x33854f[_0x82dd('0x59')]['UserId'];return db[_0x82dd('0x3d')]['find']({'where':{'id':_0x33854f[_0x82dd('0x56')]['id'],'UserId':null}})[_0x82dd('0x21')](handleEntityNotFound(_0x48d67c,null))['then'](saveUpdates(_0x33854f[_0x82dd('0x59')],null))['then'](function(_0x1d22a9){if(_0x1d22a9){_0x5b3581[_0x82dd('0x29')]=_0x1d22a9[_0x82dd('0x60')]({'plain':!![]});return db[_0x82dd('0x61')][_0x82dd('0x57')]({'where':{'id':_0x1d22a9[_0x82dd('0x62')]}});}return null;})[_0x82dd('0x21')](handleEntityNotFound(_0x48d67c,null))[_0x82dd('0x21')](function(_0x403c52){if(_0x403c52){return _0x403c52['update']({'UserId':_0x33854f['body'][_0x82dd('0x5f')],'read1stAt':_[_0x82dd('0x63')](_0x403c52['read1stAt'])?moment()[_0x82dd('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x82dd('0x21')](function(_0x13b0be){if(_0x13b0be){_0x5b3581['interaction']=_0x13b0be[_0x82dd('0x60')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x33854f[_0x82dd('0x64')]['id'],_0x33854f[_0x82dd('0x64')][_0x82dd('0x3a')],_0x33854f[_0x82dd('0x64')]['role'],_0x5b3581[_0x82dd('0x65')]['id'],_0x33854f[_0x82dd('0x59')]?JSON['stringify'](_0x33854f[_0x82dd('0x59')]):_0x82dd('0x66'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5b3581);}return null;})[_0x82dd('0x21')](function(_0x559404){var _0x22f52f=_0x82dd('0x67')+_0x559404[_0x82dd('0x29')][_0x82dd('0x68')];return db[_0x82dd('0x69')][_0x82dd('0x41')](_0x22f52f,{'type':db[_0x82dd('0x6a')][_0x82dd('0x6b')][_0x82dd('0x6c')],'raw':!![]})[_0x82dd('0x21')](function(_0x2683c9){return _0x2683c9;});})[_0x82dd('0x21')](function(_0xb7d43e){if(_0xb7d43e){_0x5b3581[_0x82dd('0x29')][_0x82dd('0x6d')]=_0xb7d43e[0x0];if(!_0x33854f[_0x82dd('0x59')][_0x82dd('0x5f')])return;return db[_0x82dd('0x6e')][_0x82dd('0x57')]({'where':{'id':_0x33854f[_0x82dd('0x59')][_0x82dd('0x5f')],'role':_0x82dd('0x6f')},'attributes':['id','name',_0x82dd('0x70'),_0x82dd('0x71'),_0x82dd('0x72')],'raw':!![]});}return null;})[_0x82dd('0x21')](function(_0x24c8e0){if(!_0x24c8e0)return null;_0x5b3581['message'][_0x82dd('0x6f')]=_0x24c8e0;return _0x5b3581;})[_0x82dd('0x21')](function(_0x42abd2){if(_0x42abd2){if(_0x33854f[_0x82dd('0x59')]['manual']){_0x5b3581['message']['interface']=util[_0x82dd('0x5e')](_0x82dd('0x73'),_0x33854f[_0x82dd('0x64')][_0x82dd('0x3a')]);_0x5b3581[_0x82dd('0x29')]['channel']=_0x5b3581['channel'];_0x5b3581[_0x82dd('0x29')][_0x82dd('0x74')]=_0x5b3581[_0x82dd('0x75')];_0x5b3581['message'][_0x82dd('0x76')]=_0x82dd('0x77');return respondWithRpcPromise(_0x82dd('0x78'),_0x82dd('0x78'),{'event':'acceptmessage','message':_0x5b3581[_0x82dd('0x29')]},client9002)[_0x82dd('0x21')](function(){return _0x5b3581;});}return _0x5b3581;}return null;})[_0x82dd('0x21')](respondWithResult(_0x48d67c,null))[_0x82dd('0x2b')](handleError(_0x48d67c,null));};var interaction_log=require(_0x82dd('0x14'))(_0x82dd('0x79'));exports['reject']=function(_0x2d7aec,_0x5398da,_0x356954){var _0x586160={'agent':{},'channel':_0x82dd('0x5c')};if(_0x2d7aec[_0x82dd('0x59')]['id']){delete _0x2d7aec['body']['id'];}_0x2d7aec['body'][_0x82dd('0x5f')]=_0x2d7aec[_0x82dd('0x59')]['UserId']||_0x2d7aec[_0x82dd('0x64')]['id'];_0x586160[_0x82dd('0x6f')]['id']=_0x2d7aec['body'][_0x82dd('0x5f')];return db[_0x82dd('0x3d')][_0x82dd('0x57')]({'where':{'id':_0x2d7aec[_0x82dd('0x56')]['id'],'UserId':null}})[_0x82dd('0x21')](handleEntityNotFound(_0x5398da,null))[_0x82dd('0x21')](function(_0x37c65b){if(_0x37c65b){_0x586160[_0x82dd('0x29')]=_0x37c65b[_0x82dd('0x60')]({'plain':!![]});return db[_0x82dd('0x61')][_0x82dd('0x57')]({'where':{'id':_0x37c65b[_0x82dd('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x5398da,null))[_0x82dd('0x21')](function(_0xc39215){if(_0xc39215){_0x586160['interaction']=_0xc39215['get']({'plain':!![]});interaction_log['info'](_0x82dd('0x7a'),_0x2d7aec[_0x82dd('0x64')]['id'],_0x2d7aec[_0x82dd('0x64')][_0x82dd('0x3a')],_0x2d7aec[_0x82dd('0x64')]['role'],_0x586160[_0x82dd('0x65')]['id'],_0x2d7aec[_0x82dd('0x59')]?JSON['stringify'](_0x2d7aec['body']):_0x82dd('0x66'));return respondWithRpcPromise('RejectMessage',_0x82dd('0x7b'),_0x586160);}return null;})['then'](function(_0x4bd420){var _0x5b4613='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4bd420[_0x82dd('0x29')][_0x82dd('0x68')];return db['sequelize']['query'](_0x5b4613,{'type':db[_0x82dd('0x6a')][_0x82dd('0x6b')][_0x82dd('0x6c')],'raw':!![]})['then'](function(_0x2770eb){return _0x2770eb;});})[_0x82dd('0x21')](function(_0x183d04){if(_0x183d04){_0x586160[_0x82dd('0x29')][_0x82dd('0x6d')]=_0x183d04[0x0];if(!_0x2d7aec[_0x82dd('0x59')][_0x82dd('0x5f')])return;return db[_0x82dd('0x6e')]['find']({'where':{'id':_0x2d7aec['body'][_0x82dd('0x5f')],'role':_0x82dd('0x6f')},'attributes':['id',_0x82dd('0x3a'),_0x82dd('0x70'),_0x82dd('0x71'),'internal'],'raw':!![]});}return null;})[_0x82dd('0x21')](function(_0x33c16a){if(!_0x33c16a)return null;_0x586160[_0x82dd('0x29')]['agent']=_0x33c16a;return _0x586160;})['then'](function(_0x49360b){if(_0x49360b){_0x49360b[_0x82dd('0x29')][_0x82dd('0x7c')]=util[_0x82dd('0x5e')]('SIP/%s',_0x2d7aec[_0x82dd('0x64')]['name']);_0x49360b[_0x82dd('0x29')][_0x82dd('0x75')]=_0x586160['channel'];_0x49360b[_0x82dd('0x29')][_0x82dd('0x74')]=_0x586160[_0x82dd('0x75')];_0x49360b[_0x82dd('0x29')]['event']='reject';respondWithRpcPromise('EventManager',_0x82dd('0x78'),{'event':_0x82dd('0x7d'),'message':_0x49360b[_0x82dd('0x29')]},client9002);return _0x586160;}return null;})[_0x82dd('0x21')](respondWithResult(_0x5398da,null))[_0x82dd('0x2b')](handleError(_0x5398da,null));};exports[_0x82dd('0x2d')]=function(_0x4a1599,_0x30db33,_0x3f1f41){if(_0x4a1599[_0x82dd('0x59')]['id']){delete _0x4a1599[_0x82dd('0x59')]['id'];}var _0x4db1b9;return db[_0x82dd('0x3d')][_0x82dd('0x57')]({'where':{'id':_0x4a1599[_0x82dd('0x56')]['id']}})[_0x82dd('0x21')](handleEntityNotFound(_0x30db33,null))['then'](function(_0x1f4781){if(_0x1f4781){_0x4db1b9=_0x1f4781;return db[_0x82dd('0x7e')]['find']({'where':{'id':_0x1f4781[_0x82dd('0x7f')]}});}})[_0x82dd('0x21')](handleEntityNotFound(_0x30db33,null))[_0x82dd('0x21')](function(_0x1e4dd0){if(_0x1e4dd0){logger[_0x82dd('0x25')](_0x82dd('0x26'),'status','received\x20delivery\x20report\x20from',_0x1e4dd0['type'],util['inspect'](_0x4a1599['body'],{'showHidden':![],'depth':null}));switch(_0x1e4dd0['type']){case _0x82dd('0x80'):if(_0x4a1599[_0x82dd('0x59')][_0x82dd('0x81')]&&_0x4a1599['body'][_0x82dd('0x81')]===_0x4db1b9[_0x82dd('0x82')]){return _0x4db1b9[_0x82dd('0x5a')]({'read':!![]});}else{logger[_0x82dd('0x28')](_0x82dd('0x83'),_0x82dd('0x2d'),_0x82dd('0x80'),util[_0x82dd('0x84')](_0x4a1599[_0x82dd('0x59')],{'showHidden':![],'depth':null}));}break;case _0x82dd('0x85'):if(_0x4a1599[_0x82dd('0x59')][_0x82dd('0x86')]&&_0x4a1599['body'][_0x82dd('0x86')]===_0x4db1b9[_0x82dd('0x82')]&&_[_0x82dd('0x87')]([_0x82dd('0x88'),_0x82dd('0x89')],_0x4a1599['body'][_0x82dd('0x8a')])>=0x0){return _0x4db1b9[_0x82dd('0x5a')]({'read':!![]});}else{logger[_0x82dd('0x28')](_0x82dd('0x83'),_0x82dd('0x2d'),_0x82dd('0x8b'),util[_0x82dd('0x84')](_0x4a1599[_0x82dd('0x59')],{'showHidden':![],'depth':null}));}break;case _0x82dd('0x8c'):var _0x21fcf9=_0x4a1599[_0x82dd('0x59')][_0x82dd('0x8d')][0x0];if(_0x21fcf9[_0x82dd('0x2d')][_0x82dd('0x8e')]===_0x82dd('0x8f')){return _0x4db1b9[_0x82dd('0x5a')]({'read':!![]});}else{logger[_0x82dd('0x28')](_0x82dd('0x83'),_0x82dd('0x2d'),_0x82dd('0x8c'),util[_0x82dd('0x84')](_0x4a1599[_0x82dd('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x4db1b9;}})[_0x82dd('0x21')](respondWithResult(_0x30db33,null))[_0x82dd('0x2b')](handleError(_0x30db33,null));}; \ No newline at end of file +var _0x29b6=['fields','length','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','rawAttributes','keys','includeAll','create','body','find','params','destroy','describe','sms-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','User','agent','fullname','email','internal','manual','SIP/%s','channel','event','EventManager','acceptmessage','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','SELECT','contact','interface','motionChannel','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','delivered','Status','infobip','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./smsMessage.socket','register','client','http','then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','stack','name','index','map','SmsMessage','fieldName','key','model','query','filters','intersection'];(function(_0x13455,_0x19d50d){var _0x11ea17=function(_0x436b6a){while(--_0x436b6a){_0x13455['push'](_0x13455['shift']());}};_0x11ea17(++_0x19d50d);}(_0x29b6,0x17e));var _0x629b=function(_0x42a23e,_0x1e62a9){_0x42a23e=_0x42a23e-0x0;var _0x33d3f3=_0x29b6[_0x42a23e];return _0x33d3f3;};'use strict';var emlformat=require(_0x629b('0x0'));var rimraf=require(_0x629b('0x1'));var zipdir=require(_0x629b('0x2'));var jsonpatch=require(_0x629b('0x3'));var rp=require(_0x629b('0x4'));var moment=require(_0x629b('0x5'));var BPromise=require(_0x629b('0x6'));var Mustache=require(_0x629b('0x7'));var util=require(_0x629b('0x8'));var path=require(_0x629b('0x9'));var sox=require('sox');var csv=require(_0x629b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x629b('0xb'));var _=require(_0x629b('0xc'));var squel=require(_0x629b('0xd'));var crypto=require(_0x629b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x629b('0xf'));var toCsv=require(_0x629b('0xa'));var querystring=require('querystring');var Papa=require(_0x629b('0x10'));var Redis=require(_0x629b('0x11'));var authService=require(_0x629b('0x12'));var qs=require(_0x629b('0x13'));var as=require(_0x629b('0x14'));var hardwareService=require(_0x629b('0x15'));var logger=require(_0x629b('0x16'))(_0x629b('0x17'));var utils=require(_0x629b('0x18'));var config=require(_0x629b('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x629b('0x1a')]=_[_0x629b('0x1b')](config[_0x629b('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x629b('0x1c'))(new Redis(config[_0x629b('0x1a')]));require(_0x629b('0x1d'))[_0x629b('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x629b('0x1f')][_0x629b('0x20')]({'port':0x232c});var client9002=jayson[_0x629b('0x1f')][_0x629b('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2c1f4f,_0x4ba9ae,_0x2a4d96,_0x4b0cfb){return new BPromise(function(_0x151b93,_0x2b0a74){var _0x204bb4=_0x4b0cfb||client;return _0x204bb4['request'](_0x2c1f4f,_0x2a4d96)[_0x629b('0x21')](function(_0x58f5a8){logger[_0x629b('0x22')]('SmsMessage,\x20%s,\x20%s',_0x4ba9ae,_0x629b('0x23'));logger['debug'](_0x629b('0x24'),_0x4ba9ae,_0x629b('0x23'),JSON[_0x629b('0x25')](_0x58f5a8));if(_0x58f5a8['error']){if(_0x58f5a8[_0x629b('0x26')]['code']===0x1f4){logger[_0x629b('0x26')](_0x629b('0x27'),_0x4ba9ae,_0x58f5a8[_0x629b('0x26')][_0x629b('0x28')]);return _0x2b0a74(_0x58f5a8['error'][_0x629b('0x28')]);}logger['error'](_0x629b('0x27'),_0x4ba9ae,_0x58f5a8[_0x629b('0x26')][_0x629b('0x28')]);return _0x151b93(_0x58f5a8['error'][_0x629b('0x28')]);}else{logger[_0x629b('0x22')](_0x629b('0x27'),_0x4ba9ae,_0x629b('0x23'));_0x151b93(_0x58f5a8[_0x629b('0x29')][_0x629b('0x28')]);}})[_0x629b('0x2a')](function(_0x547b3c){logger['error']('SmsMessage,\x20%s,\x20%s',_0x4ba9ae,_0x547b3c);_0x2b0a74(_0x547b3c);});});}function respondWithStatusCode(_0x58b320,_0x3e1e25){_0x3e1e25=_0x3e1e25||0xcc;return function(_0x31c0b3){if(_0x31c0b3){return _0x58b320[_0x629b('0x2b')](_0x3e1e25);}return _0x58b320[_0x629b('0x2c')](_0x3e1e25)[_0x629b('0x2d')]();};}function respondWithResult(_0x40ae3c,_0x4c1f21){_0x4c1f21=_0x4c1f21||0xc8;return function(_0x43bc04){if(_0x43bc04){return _0x40ae3c[_0x629b('0x2c')](_0x4c1f21)[_0x629b('0x2e')](_0x43bc04);}};}function respondWithFilteredResult(_0x12d5fc,_0x12cc51){return function(_0x16c365){if(_0x16c365){var _0x3ef549=typeof _0x12cc51[_0x629b('0x2f')]==='undefined'&&typeof _0x12cc51['limit']===_0x629b('0x30');var _0x2fb97d=_0x16c365['count'];var _0x1628cb=_0x3ef549?0x0:_0x12cc51['offset'];var _0x86ee7c=_0x3ef549?_0x16c365[_0x629b('0x31')]:_0x12cc51['offset']+_0x12cc51[_0x629b('0x32')];var _0x16d968;if(_0x86ee7c>=_0x2fb97d){_0x86ee7c=_0x2fb97d;_0x16d968=0xc8;}else{_0x16d968=0xce;}_0x12d5fc[_0x629b('0x2c')](_0x16d968);return _0x12d5fc[_0x629b('0x33')](_0x629b('0x34'),_0x1628cb+'-'+_0x86ee7c+'/'+_0x2fb97d)[_0x629b('0x2e')](_0x16c365);}return null;};}function patchUpdates(_0x5550bd){return function(_0x269c0a){try{jsonpatch[_0x629b('0x35')](_0x269c0a,_0x5550bd,!![]);}catch(_0x2b21a3){return BPromise[_0x629b('0x36')](_0x2b21a3);}return _0x269c0a[_0x629b('0x37')]();};}function saveUpdates(_0x3c75cb,_0x198729){return function(_0x1f4cf6){if(_0x1f4cf6){return _0x1f4cf6[_0x629b('0x38')](_0x3c75cb)[_0x629b('0x21')](function(_0x229c50){return _0x229c50;});}return null;};}function removeEntity(_0x1dcc06,_0x2f8b21){return function(_0x4f2e44){if(_0x4f2e44){return _0x4f2e44['destroy']()[_0x629b('0x21')](function(){_0x1dcc06[_0x629b('0x2c')](0xcc)[_0x629b('0x2d')]();});}};}function handleEntityNotFound(_0x25ee68,_0x564590){return function(_0x311e82){if(!_0x311e82){_0x25ee68[_0x629b('0x2b')](0x194);}return _0x311e82;};}function handleError(_0x15ce4c,_0x46f403){_0x46f403=_0x46f403||0x1f4;return function(_0x4c1a34){logger[_0x629b('0x26')](_0x4c1a34[_0x629b('0x39')]);if(_0x4c1a34[_0x629b('0x3a')]){delete _0x4c1a34[_0x629b('0x3a')];}_0x15ce4c[_0x629b('0x2c')](_0x46f403)['send'](_0x4c1a34);};}exports[_0x629b('0x3b')]=function(_0x4024c7,_0x20c488){var _0x37daad={},_0x3b8100={},_0x36f47e={'count':0x0,'rows':[]};var _0x384783=_[_0x629b('0x3c')](db[_0x629b('0x3d')]['rawAttributes'],function(_0x3b2506){return{'name':_0x3b2506[_0x629b('0x3e')],'type':_0x3b2506['type'][_0x629b('0x3f')]};});_0x3b8100[_0x629b('0x40')]=_[_0x629b('0x3c')](_0x384783,_0x629b('0x3a'));_0x3b8100['query']=_['keys'](_0x4024c7[_0x629b('0x41')]);_0x3b8100[_0x629b('0x42')]=_[_0x629b('0x43')](_0x3b8100[_0x629b('0x40')],_0x3b8100[_0x629b('0x41')]);_0x37daad['attributes']=_[_0x629b('0x43')](_0x3b8100[_0x629b('0x40')],qs[_0x629b('0x44')](_0x4024c7[_0x629b('0x41')][_0x629b('0x44')]));_0x37daad['attributes']=_0x37daad['attributes'][_0x629b('0x45')]?_0x37daad[_0x629b('0x46')]:_0x3b8100[_0x629b('0x40')];if(!_0x4024c7[_0x629b('0x41')][_0x629b('0x47')](_0x629b('0x48'))){_0x37daad[_0x629b('0x32')]=qs[_0x629b('0x32')](_0x4024c7['query'][_0x629b('0x32')]);_0x37daad[_0x629b('0x2f')]=qs[_0x629b('0x2f')](_0x4024c7[_0x629b('0x41')][_0x629b('0x2f')]);}_0x37daad['order']=qs['sort'](_0x4024c7[_0x629b('0x41')][_0x629b('0x49')]);_0x37daad[_0x629b('0x4a')]=qs[_0x629b('0x42')](_['pick'](_0x4024c7[_0x629b('0x41')],_0x3b8100['filters']),_0x384783);if(_0x4024c7[_0x629b('0x41')][_0x629b('0x4b')]){_0x37daad['where']=_[_0x629b('0x4c')](_0x37daad[_0x629b('0x4a')],{'$or':_[_0x629b('0x3c')](_0x384783,function(_0x309665){if(_0x309665[_0x629b('0x4d')]!==_0x629b('0x4e')){var _0x4f8a5b={};_0x4f8a5b[_0x309665['name']]={'$like':'%'+_0x4024c7[_0x629b('0x41')][_0x629b('0x4b')]+'%'};return _0x4f8a5b;}})});}_0x37daad=_[_0x629b('0x4c')]({},_0x37daad,_0x4024c7[_0x629b('0x4f')]);var _0x23df71={'where':_0x37daad[_0x629b('0x4a')]};return db[_0x629b('0x3d')]['count'](_0x23df71)['then'](function(_0x4143fe){_0x36f47e['count']=_0x4143fe;if(_0x4024c7[_0x629b('0x41')]['includeAll']){_0x37daad[_0x629b('0x50')]=[{'all':!![]}];}return db[_0x629b('0x3d')][_0x629b('0x51')](_0x37daad);})[_0x629b('0x21')](function(_0x1422dd){_0x36f47e[_0x629b('0x52')]=_0x1422dd;return _0x36f47e;})[_0x629b('0x21')](respondWithFilteredResult(_0x20c488,_0x37daad))[_0x629b('0x2a')](handleError(_0x20c488,null));};exports['show']=function(_0x12cf74,_0x581da4){var _0x34d1bd={'raw':!![],'where':{'id':_0x12cf74['params']['id']}},_0x1ceb2a={};_0x1ceb2a[_0x629b('0x40')]=_['keys'](db['SmsMessage'][_0x629b('0x53')]);_0x1ceb2a[_0x629b('0x41')]=_[_0x629b('0x54')](_0x12cf74[_0x629b('0x41')]);_0x1ceb2a['filters']=_[_0x629b('0x43')](_0x1ceb2a[_0x629b('0x40')],_0x1ceb2a['query']);_0x34d1bd[_0x629b('0x46')]=_[_0x629b('0x43')](_0x1ceb2a[_0x629b('0x40')],qs['fields'](_0x12cf74[_0x629b('0x41')][_0x629b('0x44')]));_0x34d1bd[_0x629b('0x46')]=_0x34d1bd[_0x629b('0x46')][_0x629b('0x45')]?_0x34d1bd['attributes']:_0x1ceb2a['model'];if(_0x12cf74[_0x629b('0x41')][_0x629b('0x55')]){_0x34d1bd[_0x629b('0x50')]=[{'all':!![]}];}_0x34d1bd=_[_0x629b('0x4c')]({},_0x34d1bd,_0x12cf74[_0x629b('0x4f')]);return db[_0x629b('0x3d')]['find'](_0x34d1bd)['then'](handleEntityNotFound(_0x581da4,null))[_0x629b('0x21')](respondWithResult(_0x581da4,null))[_0x629b('0x2a')](handleError(_0x581da4,null));};exports[_0x629b('0x56')]=function(_0x3f819e,_0x264c6f){return db[_0x629b('0x3d')]['create'](_0x3f819e['body'],{})[_0x629b('0x21')](respondWithResult(_0x264c6f,0xc9))[_0x629b('0x2a')](handleError(_0x264c6f,null));};exports['update']=function(_0x4a71c0,_0xc1f151){if(_0x4a71c0[_0x629b('0x57')]['id']){delete _0x4a71c0[_0x629b('0x57')]['id'];}return db[_0x629b('0x3d')][_0x629b('0x58')]({'where':{'id':_0x4a71c0[_0x629b('0x59')]['id']}})['then'](handleEntityNotFound(_0xc1f151,null))[_0x629b('0x21')](saveUpdates(_0x4a71c0[_0x629b('0x57')],null))[_0x629b('0x21')](respondWithResult(_0xc1f151,null))['catch'](handleError(_0xc1f151,null));};exports[_0x629b('0x5a')]=function(_0x26cf93,_0x21bdf8){return db['SmsMessage']['find']({'where':{'id':_0x26cf93[_0x629b('0x59')]['id']}})[_0x629b('0x21')](handleEntityNotFound(_0x21bdf8,null))[_0x629b('0x21')](removeEntity(_0x21bdf8,null))['catch'](handleError(_0x21bdf8,null));};exports[_0x629b('0x5b')]=function(_0x228710,_0x137ed5){return db[_0x629b('0x3d')][_0x629b('0x5b')]()[_0x629b('0x21')](respondWithResult(_0x137ed5,null))['catch'](handleError(_0x137ed5,null));};var interaction_log=require(_0x629b('0x16'))(_0x629b('0x5c'));exports[_0x629b('0x5d')]=function(_0x169f2f,_0x25d9e9,_0x5ea044){var _0x528d33={'agent':{},'channel':'sms'};if(_0x169f2f[_0x629b('0x57')]['id']){delete _0x169f2f[_0x629b('0x57')]['id'];}_0x169f2f[_0x629b('0x57')][_0x629b('0x5e')]=!![];_0x169f2f[_0x629b('0x57')][_0x629b('0x5f')]=moment()[_0x629b('0x60')](_0x629b('0x61'));_0x169f2f[_0x629b('0x57')][_0x629b('0x62')]=_0x169f2f[_0x629b('0x57')][_0x629b('0x62')]||_0x169f2f[_0x629b('0x63')]['id'];_0x528d33['agent']['id']=_0x169f2f[_0x629b('0x57')]['UserId'];return db[_0x629b('0x3d')]['find']({'where':{'id':_0x169f2f['params']['id'],'UserId':null}})[_0x629b('0x21')](handleEntityNotFound(_0x25d9e9,null))['then'](saveUpdates(_0x169f2f['body'],null))['then'](function(_0x5c56e6){if(_0x5c56e6){_0x528d33[_0x629b('0x28')]=_0x5c56e6[_0x629b('0x64')]({'plain':!![]});return db[_0x629b('0x65')][_0x629b('0x58')]({'where':{'id':_0x5c56e6[_0x629b('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x25d9e9,null))[_0x629b('0x21')](function(_0x2532d5){if(_0x2532d5){return _0x2532d5[_0x629b('0x38')]({'UserId':_0x169f2f['body']['UserId'],'read1stAt':_[_0x629b('0x67')](_0x2532d5[_0x629b('0x68')])?moment()[_0x629b('0x60')](_0x629b('0x61')):undefined});}return null;})[_0x629b('0x21')](function(_0x150a8c){if(_0x150a8c){_0x528d33[_0x629b('0x69')]=_0x150a8c[_0x629b('0x64')]({'plain':!![]});interaction_log[_0x629b('0x22')](_0x629b('0x6a'),_0x169f2f[_0x629b('0x63')]['id'],_0x169f2f['user']['name'],_0x169f2f['user'][_0x629b('0x6b')],_0x528d33[_0x629b('0x69')]['id'],_0x169f2f[_0x629b('0x57')]?JSON[_0x629b('0x25')](_0x169f2f[_0x629b('0x57')]):_0x629b('0x6c'));return respondWithRpcPromise(_0x629b('0x6d'),_0x629b('0x6e'),_0x528d33);}return null;})[_0x629b('0x21')](function(_0x1ef3ef){var _0x1fa5c6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1ef3ef[_0x629b('0x28')]['ContactId'];return db[_0x629b('0x6f')]['query'](_0x1fa5c6,{'type':db[_0x629b('0x70')][_0x629b('0x71')]['SELECT'],'raw':!![]})[_0x629b('0x21')](function(_0x5a1f6c){return _0x5a1f6c;});})[_0x629b('0x21')](function(_0x2576ac){if(_0x2576ac){_0x528d33[_0x629b('0x28')]['contact']=_0x2576ac[0x0];if(!_0x169f2f[_0x629b('0x57')][_0x629b('0x62')])return;return db[_0x629b('0x72')][_0x629b('0x58')]({'where':{'id':_0x169f2f[_0x629b('0x57')]['UserId'],'role':_0x629b('0x73')},'attributes':['id',_0x629b('0x3a'),_0x629b('0x74'),_0x629b('0x75'),_0x629b('0x76')],'raw':!![]});}return null;})[_0x629b('0x21')](function(_0x477c5a){if(!_0x477c5a)return null;_0x528d33[_0x629b('0x28')][_0x629b('0x73')]=_0x477c5a;return _0x528d33;})[_0x629b('0x21')](function(_0x3045df){if(_0x3045df){if(_0x169f2f[_0x629b('0x57')][_0x629b('0x77')]){_0x528d33[_0x629b('0x28')]['interface']=util[_0x629b('0x60')](_0x629b('0x78'),_0x169f2f['user']['name']);_0x528d33[_0x629b('0x28')][_0x629b('0x79')]=_0x528d33[_0x629b('0x79')];_0x528d33['message']['motionChannel']=_0x528d33[_0x629b('0x79')];_0x528d33[_0x629b('0x28')][_0x629b('0x7a')]=_0x629b('0x5d');return respondWithRpcPromise(_0x629b('0x7b'),_0x629b('0x7b'),{'event':_0x629b('0x7c'),'message':_0x528d33[_0x629b('0x28')]},client9002)[_0x629b('0x21')](function(){return _0x528d33;});}return _0x528d33;}return null;})['then'](respondWithResult(_0x25d9e9,null))['catch'](handleError(_0x25d9e9,null));};var interaction_log=require(_0x629b('0x16'))('sms-interactions');exports[_0x629b('0x36')]=function(_0x120632,_0x37acc8,_0x15f072){var _0x523fc4={'agent':{},'channel':_0x629b('0x7d')};if(_0x120632[_0x629b('0x57')]['id']){delete _0x120632[_0x629b('0x57')]['id'];}_0x120632[_0x629b('0x57')][_0x629b('0x62')]=_0x120632[_0x629b('0x57')][_0x629b('0x62')]||_0x120632[_0x629b('0x63')]['id'];_0x523fc4[_0x629b('0x73')]['id']=_0x120632[_0x629b('0x57')][_0x629b('0x62')];return db['SmsMessage']['find']({'where':{'id':_0x120632[_0x629b('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x37acc8,null))[_0x629b('0x21')](function(_0x557aa0){if(_0x557aa0){_0x523fc4['message']=_0x557aa0[_0x629b('0x64')]({'plain':!![]});return db[_0x629b('0x65')][_0x629b('0x58')]({'where':{'id':_0x557aa0[_0x629b('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x37acc8,null))[_0x629b('0x21')](function(_0x48e31e){if(_0x48e31e){_0x523fc4['interaction']=_0x48e31e['get']({'plain':!![]});interaction_log[_0x629b('0x22')](_0x629b('0x7e'),_0x120632[_0x629b('0x63')]['id'],_0x120632[_0x629b('0x63')][_0x629b('0x3a')],_0x120632['user'][_0x629b('0x6b')],_0x523fc4[_0x629b('0x69')]['id'],_0x120632[_0x629b('0x57')]?JSON[_0x629b('0x25')](_0x120632['body']):'null');return respondWithRpcPromise(_0x629b('0x7f'),_0x629b('0x80'),_0x523fc4);}return null;})[_0x629b('0x21')](function(_0x4f51cb){var _0x14585f=_0x629b('0x81')+_0x4f51cb['message'][_0x629b('0x82')];return db['sequelize'][_0x629b('0x41')](_0x14585f,{'type':db[_0x629b('0x70')][_0x629b('0x71')][_0x629b('0x83')],'raw':!![]})[_0x629b('0x21')](function(_0x1f5496){return _0x1f5496;});})[_0x629b('0x21')](function(_0x429485){if(_0x429485){_0x523fc4[_0x629b('0x28')][_0x629b('0x84')]=_0x429485[0x0];if(!_0x120632['body'][_0x629b('0x62')])return;return db[_0x629b('0x72')][_0x629b('0x58')]({'where':{'id':_0x120632[_0x629b('0x57')][_0x629b('0x62')],'role':_0x629b('0x73')},'attributes':['id',_0x629b('0x3a'),_0x629b('0x74'),_0x629b('0x75'),'internal'],'raw':!![]});}return null;})[_0x629b('0x21')](function(_0x14cf48){if(!_0x14cf48)return null;_0x523fc4[_0x629b('0x28')][_0x629b('0x73')]=_0x14cf48;return _0x523fc4;})['then'](function(_0x4e4339){if(_0x4e4339){_0x4e4339['message'][_0x629b('0x85')]=util[_0x629b('0x60')]('SIP/%s',_0x120632[_0x629b('0x63')][_0x629b('0x3a')]);_0x4e4339[_0x629b('0x28')][_0x629b('0x79')]=_0x523fc4[_0x629b('0x79')];_0x4e4339[_0x629b('0x28')][_0x629b('0x86')]=_0x523fc4['channel'];_0x4e4339[_0x629b('0x28')][_0x629b('0x7a')]=_0x629b('0x36');respondWithRpcPromise(_0x629b('0x7b'),'EventManager',{'event':_0x629b('0x87'),'message':_0x4e4339[_0x629b('0x28')]},client9002);return _0x523fc4;}return null;})[_0x629b('0x21')](respondWithResult(_0x37acc8,null))['catch'](handleError(_0x37acc8,null));};exports['status']=function(_0x1c1948,_0x410fa8,_0x3f8bc0){if(_0x1c1948[_0x629b('0x57')]['id']){delete _0x1c1948[_0x629b('0x57')]['id'];}var _0x4dfe08;return db[_0x629b('0x3d')][_0x629b('0x58')]({'where':{'id':_0x1c1948[_0x629b('0x59')]['id']}})['then'](handleEntityNotFound(_0x410fa8,null))[_0x629b('0x21')](function(_0x28f494){if(_0x28f494){_0x4dfe08=_0x28f494;return db[_0x629b('0x88')][_0x629b('0x58')]({'where':{'id':_0x28f494[_0x629b('0x89')]}});}})[_0x629b('0x21')](handleEntityNotFound(_0x410fa8,null))['then'](function(_0x5d0cdd){if(_0x5d0cdd){logger['debug'](_0x629b('0x24'),_0x629b('0x2c'),_0x629b('0x8a'),_0x5d0cdd[_0x629b('0x4d')],util[_0x629b('0x8b')](_0x1c1948[_0x629b('0x57')],{'showHidden':![],'depth':null}));switch(_0x5d0cdd['type']){case _0x629b('0x8c'):if(_0x1c1948[_0x629b('0x57')][_0x629b('0x8d')]&&_0x1c1948[_0x629b('0x57')][_0x629b('0x8d')]===_0x4dfe08[_0x629b('0x8e')]){return _0x4dfe08['update']({'read':!![]});}else{logger[_0x629b('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x629b('0x2c'),_0x629b('0x8c'),util['inspect'](_0x1c1948['body'],{'showHidden':![],'depth':null}));}break;case _0x629b('0x8f'):if(_0x1c1948[_0x629b('0x57')][_0x629b('0x90')]&&_0x1c1948[_0x629b('0x57')][_0x629b('0x90')]===_0x4dfe08[_0x629b('0x8e')]&&_[_0x629b('0x91')](['sent',_0x629b('0x92')],_0x1c1948[_0x629b('0x57')][_0x629b('0x93')])>=0x0){return _0x4dfe08[_0x629b('0x38')]({'read':!![]});}else{logger[_0x629b('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x629b('0x2c'),'plivio',util[_0x629b('0x8b')](_0x1c1948[_0x629b('0x57')],{'showHidden':![],'depth':null}));}break;case _0x629b('0x94'):var _0x1a1007=_0x1c1948[_0x629b('0x57')]['results'][0x0];if(_0x1a1007[_0x629b('0x2c')]['groupName']===_0x629b('0x95')){return _0x4dfe08['update']({'read':!![]});}else{logger[_0x629b('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x629b('0x2c'),'infobip',util[_0x629b('0x8b')](_0x1c1948[_0x629b('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x4dfe08;}})[_0x629b('0x21')](respondWithResult(_0x410fa8,null))['catch'](handleError(_0x410fa8,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 5c14ba7..4044c80 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 _0x0b76=['setMaxListeners','save','update','remove','hook','exports','events'];(function(_0x207d4e,_0x5158dc){var _0x24b6f4=function(_0x96ce36){while(--_0x96ce36){_0x207d4e['push'](_0x207d4e['shift']());}};_0x24b6f4(++_0x5158dc);}(_0x0b76,0x148));var _0x60b7=function(_0x59d0ff,_0x3ab313){_0x59d0ff=_0x59d0ff-0x0;var _0xb1a161=_0x0b76[_0x59d0ff];return _0xb1a161;};'use strict';var EventEmitter=require(_0x60b7('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x60b7('0x1')](0x0);var events={'afterCreate':_0x60b7('0x2'),'afterUpdate':_0x60b7('0x3'),'afterDestroy':_0x60b7('0x4')};function emitEvent(_0x4bfcf4){return function(_0x426156,_0x191fa5,_0x1d56f1){SmsMessageEvents['emit'](_0x4bfcf4+':'+_0x426156['id'],_0x426156);SmsMessageEvents['emit'](_0x4bfcf4,_0x426156);_0x1d56f1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x60b7('0x5')](e,emitEvent(event));}}module[_0x60b7('0x6')]=SmsMessageEvents; \ No newline at end of file +var _0x8ff6=['../../mysqldb','setMaxListeners','save','remove','emit','hook','exports','events'];(function(_0x4b2037,_0x41055c){var _0x48599b=function(_0x251da3){while(--_0x251da3){_0x4b2037['push'](_0x4b2037['shift']());}};_0x48599b(++_0x41055c);}(_0x8ff6,0x1df));var _0x68ff=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x8ff6[_0x42245d];return _0x4b211a;};'use strict';var EventEmitter=require(_0x68ff('0x0'));var SmsMessage=require(_0x68ff('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x68ff('0x2')](0x0);var events={'afterCreate':_0x68ff('0x3'),'afterUpdate':'update','afterDestroy':_0x68ff('0x4')};function emitEvent(_0x9802cc){return function(_0x3f305a,_0x4001f5,_0x5553e4){SmsMessageEvents[_0x68ff('0x5')](_0x9802cc+':'+_0x3f305a['id'],_0x3f305a);SmsMessageEvents['emit'](_0x9802cc,_0x3f305a);_0x5553e4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x68ff('0x6')](e,emitEvent(event));}}module[_0x68ff('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 2aeb37e..bf1c903 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 _0xdadb=['/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','status','refid','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','then','update','createdAt','catch','find','type','authToken','phone','accountSid','messages','create','body','remote','/status?token=','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','split','sms','total_sent','deliveryReport','read','skebby','connectel','POST','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','http_code','data','queued_count','head','clickSend','Missing\x20parameters:\x20username,\x20password','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','base64','message_uuid','plivo','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','token','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','login','text','timestamp','keys','length','apiKey','createHash','signature=','GET'];(function(_0x53309a,_0x4fc4f2){var _0x44b63f=function(_0x498832){while(--_0x498832){_0x53309a['push'](_0x53309a['shift']());}};_0x44b63f(++_0x4fc4f2);}(_0xdadb,0x8f));var _0xbdad=function(_0x2fb7b2,_0x9f61a4){_0x2fb7b2=_0x2fb7b2-0x0;var _0x4db80e=_0xdadb[_0x2fb7b2];return _0x4db80e;};'use strict';var _=require(_0xbdad('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbdad('0x1'));var moment=require('moment');var BPromise=require(_0xbdad('0x2'));var rp=require(_0xbdad('0x3'));var fs=require('fs');var path=require(_0xbdad('0x4'));var rimraf=require(_0xbdad('0x5'));var config=require(_0xbdad('0x6'));var attributes=require(_0xbdad('0x7'));module[_0xbdad('0x8')]=function(_0x3df916,_0x12f161){return _0x3df916[_0xbdad('0x9')](_0xbdad('0xa'),attributes,{'tableName':_0xbdad('0xb'),'paranoid':![],'indexes':[{'name':_0xbdad('0xc'),'fields':[_0xbdad('0xc')]},{'name':_0xbdad('0xd'),'fields':['body'],'type':_0xbdad('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x55a4b1,_0x7a47a8,_0x5f1808){var _0x12aeda=_0x3df916[_0xbdad('0xf')];var _0x17c88a=_0x55a4b1['get']({'plain':!![]});if(_0x17c88a[_0xbdad('0x10')][_0xbdad('0x11')]()==='in'||_0x17c88a[_0xbdad('0x10')][_0xbdad('0x11')]()===_0xbdad('0x12')&&!_0x17c88a[_0xbdad('0x13')]&&!_[_0xbdad('0x14')](_0x17c88a[_0xbdad('0x15')])&&!_[_0xbdad('0x14')](_0x17c88a[_0xbdad('0x16')])){_0x12aeda[_0xbdad('0x17')]['findOne']({'where':{'id':_0x17c88a[_0xbdad('0x16')]}})[_0xbdad('0x18')](function(_0x27647d){if(_0x27647d){_0x27647d[_0xbdad('0x19')]({'lastMsgAt':_0x17c88a[_0xbdad('0x1a')],'lastMsgDirection':_0x17c88a['direction'][_0xbdad('0x11')]()});}})[_0xbdad('0x1b')](function(_0x3a2f4a){console['error'](_0x3a2f4a);});}if(_0x17c88a[_0xbdad('0x10')]===_0xbdad('0x12')&&!_0x17c88a['secret']){var _0x32bfe0;_0x12aeda['SmsAccount'][_0xbdad('0x1c')]({'where':{'id':_0x17c88a['SmsAccountId']},'raw':!![]})['then'](function(_0x3c4722){_0x32bfe0=_0x3c4722;if(_0x32bfe0&&_0x32bfe0[_0xbdad('0x1d')]){switch(_0x32bfe0[_0xbdad('0x1d')]){case'twilio':var _0x38feb4=require('twilio');if(_0x32bfe0['accountSid']&&_0x32bfe0[_0xbdad('0x1e')]&&_0x32bfe0[_0xbdad('0x1f')]){var _0x229c53=new _0x38feb4(_0x32bfe0[_0xbdad('0x20')],_0x32bfe0[_0xbdad('0x1e')]);_0x229c53[_0xbdad('0x21')][_0xbdad('0x22')]({'body':_0x17c88a[_0xbdad('0x23')],'to':_0x17c88a['phone'],'from':_0x32bfe0['phone'],'statusCallback':_0x32bfe0[_0xbdad('0x24')]+'/api/sms/messages/'+_0x17c88a['id']+_0xbdad('0x25')+_0x32bfe0['token']})['then'](function(_0x4556af){if(_0x4556af[_0xbdad('0x26')]){return _0x55a4b1[_0xbdad('0x19')]({'messageId':_0x4556af['sid']});}})[_0xbdad('0x1b')](function(_0x4d5a71){logger[_0xbdad('0x27')](_0xbdad('0x28'),_0xbdad('0x29'),_0xbdad('0x2a'),util[_0xbdad('0x2b')](_0x4d5a71,{'showHidden':![],'depth':null}));});}else{logger[_0xbdad('0x27')](_0xbdad('0x28'),_0xbdad('0x29'),_0xbdad('0x2a'),_0xbdad('0x2c'));}break;case'skebby':var _0x17aa6b=_0xbdad('0x2d');if(_0x32bfe0[_0xbdad('0x2e')]&&_0x32bfe0[_0xbdad('0x2f')]){var _0x5e4f0c={'recipient':[_0x17c88a[_0xbdad('0x1f')]],'message':_0x17c88a[_0xbdad('0x23')],'message_type':_0x32bfe0[_0xbdad('0x30')]};if(_0x32bfe0['smsMethod']&&_0x32bfe0['smsMethod']!=='SI'){_0x5e4f0c[_0xbdad('0x31')]=_0x32bfe0[_0xbdad('0x1f')];}var _0x232296={'url':_0x17aa6b+_0xbdad('0x32')+_0x32bfe0['username']+'&password='+_0x32bfe0[_0xbdad('0x2f')],'method':'GET'};rp(_0x232296)[_0xbdad('0x18')](function(_0x469588){var _0xc442e9=_0x469588[_0xbdad('0x33')](';');var _0x2de7db={'user_key':_0xc442e9[0x0],'session_key':_0xc442e9[0x1]};_0x232296={'url':_0x17aa6b+_0xbdad('0x34'),'method':'POST','headers':{'user_key':_0x2de7db['user_key'],'Session_key':_0x2de7db['session_key']},'json':!![],'body':_0x5e4f0c};return rp(_0x232296);})[_0xbdad('0x18')](function(_0x2565d1){if(_0x2565d1[_0xbdad('0x35')]>=0x1){var _0x33c068={'messageId':_0x2565d1['internal_order_id']};if(_0x32bfe0[_0xbdad('0x30')]!=='GP'||!_0x32bfe0[_0xbdad('0x36')]){_0x33c068[_0xbdad('0x37')]=!![];}return _0x55a4b1[_0xbdad('0x19')](_0x33c068);}else{return logger[_0xbdad('0x27')](_0xbdad('0x28'),'afterCreate',_0xbdad('0x38'),util[_0xbdad('0x2b')](_0x2565d1,{'showHidden':![],'depth':null}));}})[_0xbdad('0x1b')](function(_0x334775){return logger[_0xbdad('0x27')](_0xbdad('0x28'),_0xbdad('0x29'),_0xbdad('0x38'),util[_0xbdad('0x2b')](_0x334775,{'showHidden':![],'depth':null}));});}else{logger[_0xbdad('0x27')](_0xbdad('0x28'),_0xbdad('0x29'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0xbdad('0x39'):if(_0x32bfe0[_0xbdad('0x1e')]){var _0x5030bd={'recipient':_0x17c88a['phone'],'message':_0x17c88a[_0xbdad('0x23')],'sender':_0x32bfe0['senderString']||_0x32bfe0[_0xbdad('0x1f')],'authorization':_0x32bfe0['authToken']};var _0x7a47a8={'method':_0xbdad('0x3a'),'uri':_0xbdad('0x3b'),'body':_0x5030bd,'json':!![]};rp(_0x7a47a8)[_0xbdad('0x18')](function(_0x5b00e7){var _0x435947={'messageId':_0x5b00e7[_0xbdad('0x3c')]};if(!_0x32bfe0[_0xbdad('0x36')]){_0x435947[_0xbdad('0x37')]=!![];}return _0x55a4b1['update'](_0x435947);})[_0xbdad('0x1b')](function(_0x3ede84){logger[_0xbdad('0x27')](_0xbdad('0x28'),'afterCreate','connectel',util[_0xbdad('0x2b')](_0x3ede84,{'showHidden':![],'depth':null}));});}else{logger[_0xbdad('0x27')](_0xbdad('0x28'),_0xbdad('0x29'),_0xbdad('0x39'),_0xbdad('0x3d'));}break;case'clicksend':if(_0x32bfe0[_0xbdad('0x2e')]&&_0x32bfe0[_0xbdad('0x2f')]){var _0x5030bd={'messages':[{'source':_0xbdad('0x3e'),'to':_0x17c88a[_0xbdad('0x1f')],'body':_0x17c88a['body'],'from':_0x32bfe0[_0xbdad('0x3f')]||_0x32bfe0[_0xbdad('0x1f')]}]};var _0x28a278=util[_0xbdad('0x40')](_0xbdad('0x41'),_0x32bfe0[_0xbdad('0x2e')],_0x32bfe0[_0xbdad('0x2f')]);var _0x7a47a8={'method':_0xbdad('0x3a'),'uri':_0xbdad('0x42'),'body':_0x5030bd,'headers':{'Authorization':util[_0xbdad('0x40')]('Basic\x20%s',new Buffer(_0x28a278)[_0xbdad('0x43')]('base64'))},'json':!![]};rp(_0x7a47a8)[_0xbdad('0x18')](function(_0x12c3a0){if(_0x12c3a0[_0xbdad('0x44')]>=0xc8&&_0x12c3a0[_0xbdad('0x44')]<=0xce){if(_0x12c3a0[_0xbdad('0x45')]&&_0x12c3a0[_0xbdad('0x45')][_0xbdad('0x46')]>0x0){var _0x4a7d3b=_[_0xbdad('0x47')](_0x12c3a0[_0xbdad('0x45')][_0xbdad('0x21')]);var _0x10e57d={'messageId':_0x4a7d3b['message_id']};if(!_0x32bfe0[_0xbdad('0x36')]){_0x10e57d[_0xbdad('0x37')]=!![];}return _0x55a4b1['update'](_0x10e57d);}else{logger[_0xbdad('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbdad('0x29'),_0xbdad('0x48'),util['inspect'](_0x12c3a0,{'showHidden':![],'depth':null}));}}else{logger[_0xbdad('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbdad('0x29'),_0xbdad('0x48'),util[_0xbdad('0x2b')](_0x12c3a0,{'showHidden':![],'depth':null}));}})[_0xbdad('0x1b')](function(_0xf468f){logger[_0xbdad('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbdad('0x29'),'clickSend',util['inspect'](_0xf468f,{'showHidden':![],'depth':null}));});}else{logger[_0xbdad('0x27')](_0xbdad('0x28'),_0xbdad('0x29'),_0xbdad('0x48'),_0xbdad('0x49'));}break;case'plivo':if(_0x32bfe0[_0xbdad('0x4a')]&&_0x32bfe0[_0xbdad('0x1e')]){var _0x5030bd={'dst':_0x17c88a[_0xbdad('0x1f')],'text':_0x17c88a['body'],'src':_0x32bfe0['senderString']||_0x32bfe0[_0xbdad('0x1f')],'url':_0x32bfe0['remote']+_0xbdad('0x4b')+_0x17c88a['id']+_0xbdad('0x25')+_0x32bfe0['token']};var _0x28a278=util[_0xbdad('0x40')](_0xbdad('0x41'),_0x32bfe0[_0xbdad('0x4a')],_0x32bfe0[_0xbdad('0x1e')]);var _0x7a47a8={'method':_0xbdad('0x3a'),'uri':util['format'](_0xbdad('0x4c'),_0x32bfe0[_0xbdad('0x4a')]),'body':_0x5030bd,'headers':{'Authorization':util[_0xbdad('0x40')](_0xbdad('0x4d'),new Buffer(_0x28a278)['toString'](_0xbdad('0x4e')))},'json':!![]};rp(_0x7a47a8)[_0xbdad('0x18')](function(_0x48360f){var _0x568b4a={'messageId':_0x48360f[_0xbdad('0x4f')][0x0]};return _0x55a4b1[_0xbdad('0x19')](_0x568b4a);})[_0xbdad('0x1b')](function(_0x61cac0){logger[_0xbdad('0x27')](_0xbdad('0x28'),_0xbdad('0x29'),_0xbdad('0x50'),util[_0xbdad('0x2b')](_0x61cac0,{'showHidden':![],'depth':null}));});}else{logger[_0xbdad('0x27')](_0xbdad('0x28'),'afterCreate',_0xbdad('0x50'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xbdad('0x51'):if(_0x32bfe0[_0xbdad('0x2e')]&&_0x32bfe0['password']){if(_0x32bfe0['baseUrl']){var _0x2d046b={'method':_0xbdad('0x3a'),'uri':_0x32bfe0[_0xbdad('0x52')]+_0xbdad('0x53'),'body':{'username':_0x32bfe0[_0xbdad('0x2e')],'password':_0x32bfe0['password']},'json':!![]};return rp(_0x2d046b)[_0xbdad('0x18')](function(_0x4572c3){var _0x8d0b83={'method':_0xbdad('0x3a'),'uri':_0x32bfe0['baseUrl']+_0xbdad('0x54'),'body':{'messages':[{'from':_0x32bfe0['phone'],'destinations':[{'to':_0x17c88a['phone']}],'text':_0x17c88a[_0xbdad('0x23')],'notifyUrl':_0x32bfe0[_0xbdad('0x24')]+_0xbdad('0x4b')+_0x17c88a['id']+_0xbdad('0x25')+_0x32bfe0[_0xbdad('0x55')],'notifyContentType':_0xbdad('0x56'),'callbackData':_0x32bfe0[_0xbdad('0x1f')]+';'+_0x17c88a[_0xbdad('0x23')]}]},'headers':{'Authorization':_0xbdad('0x57')+_0x4572c3['token']},'json':!![]};return rp(_0x8d0b83)['then'](function(_0xb35e66){if(_0xb35e66[_0xbdad('0x21')]){var _0x20074d={'messageId':_0xb35e66[_0xbdad('0x21')][0x0][_0xbdad('0xc')]};if(!_0x32bfe0[_0xbdad('0x36')]){_0x20074d[_0xbdad('0x37')]=!![];}return _0x55a4b1[_0xbdad('0x19')](_0x20074d);}else{return logger[_0xbdad('0x27')](_0xbdad('0x28'),'afterCreate',_0xbdad('0x51'),util[_0xbdad('0x2b')](_0xb35e66,{'showHidden':![],'depth':null}));}});})[_0xbdad('0x1b')](function(_0x2a2b6f){return logger[_0xbdad('0x27')](_0xbdad('0x28'),_0xbdad('0x29'),'infobip',util[_0xbdad('0x2b')](_0x2a2b6f,{'showHidden':![],'depth':null}));});}else{logger[_0xbdad('0x27')](_0xbdad('0x28'),'afterCreate',_0xbdad('0x51'),_0xbdad('0x58'));}}else{logger[_0xbdad('0x27')](_0xbdad('0x28'),_0xbdad('0x29'),_0xbdad('0x51'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xbdad('0x59'):var _0x401524=require('crypto');if(_0x32bfe0['apiKey']){var _0x28133b={};_0x28133b[_0xbdad('0x5a')]=_0x32bfe0[_0xbdad('0x2e')];_0x28133b['phone']=_0x17c88a[_0xbdad('0x1f')];_0x28133b['sender']=_0x32bfe0['phone'];_0x28133b[_0xbdad('0x5b')]=_0x17c88a[_0xbdad('0x23')];_0x28133b[_0xbdad('0x5c')]=+new Date();var _0x574d7e='';var _0x3f713f='';var _0x1a858f=Object[_0xbdad('0x5d')](_0x28133b);_0x1a858f['sort']();for(var _0x55ec34=0x0;_0x55ec34<_0x1a858f[_0xbdad('0x5e')];_0x55ec34++){if(_0x574d7e!=''){_0x574d7e+='&';}_0x574d7e+=_0x1a858f[_0x55ec34]+'='+encodeURIComponent(_0x28133b[_0x1a858f[_0x55ec34]]);_0x3f713f+=_0x28133b[_0x1a858f[_0x55ec34]];}_0x3f713f+=_0x32bfe0[_0xbdad('0x5f')];_0x3f713f=_0x401524[_0xbdad('0x60')]('md5')['update'](_0x3f713f)['digest']('hex');if(_0x574d7e!==''){_0x574d7e+='&';}_0x574d7e+=_0xbdad('0x61')+_0x3f713f;var _0x232296={'method':_0xbdad('0x62'),'uri':_0x32bfe0[_0xbdad('0x52')]+_0xbdad('0x63')+_0x574d7e,'json':!![]};return rp(_0x232296)[_0xbdad('0x18')](function(_0x1332c0){var _0x131144=Object[_0xbdad('0x5d')](_0x1332c0);if(_0x1332c0[_0x131144[0x0]][_0xbdad('0x27')]&&parseInt(_0x1332c0[_0x131144[0x0]][_0xbdad('0x27')])===0x0){var _0x2d4a59={'messageId':_0x1332c0[_0x131144[0x0]][_0xbdad('0x64')]};if(!_0x32bfe0[_0xbdad('0x36')]){_0x2d4a59['read']=!![];}return _0x55a4b1[_0xbdad('0x19')](_0x2d4a59);}else{return logger[_0xbdad('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xbdad('0x59'),util[_0xbdad('0x2b')](_0x1332c0['error'],{'showHidden':![],'depth':null}));}})[_0xbdad('0x1b')](function(_0x5b33a2){return logger[_0xbdad('0x27')](_0xbdad('0x28'),_0xbdad('0x29'),_0xbdad('0x59'),util[_0xbdad('0x2b')](_0x5b33a2,{'showHidden':![],'depth':null}));});}else{logger[_0xbdad('0x27')](_0xbdad('0x28'),_0xbdad('0x29'),_0xbdad('0x59'),_0xbdad('0x65'));}break;case'clickatell':if(_0x32bfe0[_0xbdad('0x5f')]){var _0x3ce21c={'method':_0xbdad('0x3a'),'uri':_0xbdad('0x66'),'headers':{'Authorization':_0x32bfe0['apiKey']},'body':{'content':_0x17c88a['body'],'to':[_0x17c88a[_0xbdad('0x1f')]],'from':_0x32bfe0[_0xbdad('0x1f')],'binary':![],'clientMessageId':_0xbdad('0x67'),'charset':'UTF-8'},'json':!![]};rp(_0x3ce21c)[_0xbdad('0x18')](function(_0x3f2203){if(!_0x3f2203[_0xbdad('0x27')]){var _0x147a34={'messageId':_0x3f2203[_0xbdad('0x21')][0x0][_0xbdad('0x68')]};if(!_0x32bfe0[_0xbdad('0x36')]){_0x147a34[_0xbdad('0x37')]=!![];}return _0x55a4b1[_0xbdad('0x19')](_0x147a34);}else{return logger['error'](_0xbdad('0x28'),_0xbdad('0x29'),_0xbdad('0x69'),util['inspect'](_0x3f2203[_0xbdad('0x27')],{'showHidden':![],'depth':null}));}})[_0xbdad('0x1b')](function(_0x829b9c){return logger['error'](_0xbdad('0x28'),'afterCreate','clickatell',util['inspect'](_0x829b9c,{'showHidden':![],'depth':null}));});}else{logger[_0xbdad('0x27')](_0xbdad('0x28'),'afterCreate',_0xbdad('0x69'),'Missing\x20parameters:\x20apiKey');}break;case _0xbdad('0x6a'):if(_0x32bfe0['username']&&_0x32bfe0[_0xbdad('0x2f')]){var _0x28a278=util['format'](_0xbdad('0x41'),_0x32bfe0[_0xbdad('0x2e')],_0x32bfe0[_0xbdad('0x2f')]);var _0x7a47a8={'method':_0xbdad('0x3a'),'uri':_0xbdad('0x6b')+_0x32bfe0[_0xbdad('0x6c')]+_0xbdad('0x6d'),'body':{'to':[_0x17c88a[_0xbdad('0x1f')]],'text':_0x17c88a[_0xbdad('0x23')],'from':_0x32bfe0['phone'],'applicationId':_0x32bfe0[_0xbdad('0x6e')]},'headers':{'Authorization':util['format'](_0xbdad('0x4d'),new Buffer(_0x28a278)[_0xbdad('0x43')](_0xbdad('0x4e')))},'json':!![]};rp(_0x7a47a8)[_0xbdad('0x18')](function(_0x5251ba){if(_0x5251ba['id']){var _0xbceeac={'messageId':_0x5251ba['id']};return _0x55a4b1[_0xbdad('0x19')](_0xbceeac);}else{logger['error'](_0xbdad('0x28'),_0xbdad('0x29'),_0xbdad('0x6a'),util[_0xbdad('0x2b')](_0x5251ba,{'showHidden':![],'depth':null}));}})[_0xbdad('0x1b')](function(_0xe2d6d){logger[_0xbdad('0x27')](_0xbdad('0x28'),'afterCreate',_0xbdad('0x6a'),util[_0xbdad('0x2b')](_0xe2d6d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbdad('0x28'),'afterCreate','bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0xbdad('0x6f'):if(_0x32bfe0[_0xbdad('0x5f')]){var _0x488ce1={};var _0x232296={'method':_0xbdad('0x3a'),'uri':_0xbdad('0x70'),'headers':{'Authorization':_0xbdad('0x71')+_0x32bfe0['apiKey'],'Content-Type':_0xbdad('0x56')},'body':{'from':_0x32bfe0['phone'],'to':_0x17c88a['phone'],'text':_0x17c88a['body']},'json':!![]};return rp(_0x232296)[_0xbdad('0x18')](function(_0x412ecf){if(_0x412ecf[_0xbdad('0x72')]==0xca){_0x488ce1['message']=_0x412ecf;var _0x3bc5d8={'method':_0xbdad('0x3a'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xbdad('0x71')+_0x32bfe0[_0xbdad('0x5f')],'Content-Type':_0xbdad('0x56')},'body':{'refid':_0x488ce1[_0xbdad('0x73')]['refid']},'json':!![]};return rp(_0x3bc5d8)[_0xbdad('0x18')](function(_0x41f53d){_0x488ce1[_0xbdad('0x74')]=_0x41f53d;var _0x14bf8f={'messageId':_0x488ce1[_0xbdad('0x73')][_0xbdad('0x75')],'read':!![]};return _0x55a4b1[_0xbdad('0x19')](_0x14bf8f);});}else{return logger['error'](_0xbdad('0x28'),_0xbdad('0x29'),_0xbdad('0x6f'),util[_0xbdad('0x2b')](_0x412ecf,{'showHidden':![],'depth':null}));}})[_0xbdad('0x1b')](function(_0x324a95){return logger[_0xbdad('0x27')](_0xbdad('0x28'),'afterCreate',_0xbdad('0x6f'),util['inspect'](_0x324a95,{'showHidden':![],'depth':null}));});}else{return logger[_0xbdad('0x27')](_0xbdad('0x28'),'afterCreate','intelepeer',_0xbdad('0x76'));}break;}}})[_0xbdad('0x77')](function(){_0x5f1808();});}else{_0x5f1808();}}},'charset':'utf8mb4','collate':_0xbdad('0x78')});}; \ No newline at end of file +var _0x9a05=['POST','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','connectel','Missing\x20parameters:\x20authToken','clicksend','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','token','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','csc','crypto','apiKey','login','text','keys','length','md5','digest','hex','signature=','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','%s:%s','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./smsMessage.attributes','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase','out','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','direction','error','secret','find','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','username','GET','split','session_key','internal_order_id','read','inspect','catch','Missing\x20parameters:\x20username,\x20password','senderString'];(function(_0x79c44,_0x69b694){var _0x2df76c=function(_0xbdf830){while(--_0xbdf830){_0x79c44['push'](_0x79c44['shift']());}};_0x2df76c(++_0x69b694);}(_0x9a05,0x126));var _0x59a0=function(_0x2f5d8f,_0x2224c6){_0x2f5d8f=_0x2f5d8f-0x0;var _0x2b3bd7=_0x9a05[_0x2f5d8f];return _0x2b3bd7;};'use strict';var _=require('lodash');var util=require(_0x59a0('0x0'));var logger=require(_0x59a0('0x1'))(_0x59a0('0x2'));var moment=require(_0x59a0('0x3'));var BPromise=require(_0x59a0('0x4'));var rp=require(_0x59a0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x59a0('0x6'));var attributes=require(_0x59a0('0x7'));module['exports']=function(_0x1cc052,_0x4f362e){return _0x1cc052[_0x59a0('0x8')](_0x59a0('0x9'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x59a0('0xa'),'fields':['messageId']},{'name':_0x59a0('0xb'),'fields':[_0x59a0('0xc')],'type':_0x59a0('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x34668e,_0x185f8e,_0x1b54b3){var _0x135d96=_0x1cc052[_0x59a0('0xe')];var _0x12701a=_0x34668e[_0x59a0('0xf')]({'plain':!![]});if(_0x12701a['direction']['toLowerCase']()==='in'||_0x12701a['direction'][_0x59a0('0x10')]()===_0x59a0('0x11')&&!_0x12701a['secret']&&!_[_0x59a0('0x12')](_0x12701a[_0x59a0('0x13')])&&!_[_0x59a0('0x12')](_0x12701a[_0x59a0('0x14')])){_0x135d96[_0x59a0('0x15')][_0x59a0('0x16')]({'where':{'id':_0x12701a['SmsInteractionId']}})[_0x59a0('0x17')](function(_0x50351e){if(_0x50351e){_0x50351e[_0x59a0('0x18')]({'lastMsgAt':_0x12701a['createdAt'],'lastMsgDirection':_0x12701a[_0x59a0('0x19')]['toLowerCase']()});}})['catch'](function(_0x56f9cf){console[_0x59a0('0x1a')](_0x56f9cf);});}if(_0x12701a[_0x59a0('0x19')]===_0x59a0('0x11')&&!_0x12701a[_0x59a0('0x1b')]){var _0x5dd177;_0x135d96['SmsAccount'][_0x59a0('0x1c')]({'where':{'id':_0x12701a['SmsAccountId']},'raw':!![]})['then'](function(_0x1a6a90){_0x5dd177=_0x1a6a90;if(_0x5dd177&&_0x5dd177[_0x59a0('0x1d')]){switch(_0x5dd177[_0x59a0('0x1d')]){case _0x59a0('0x1e'):var _0x4b1669=require('twilio');if(_0x5dd177[_0x59a0('0x1f')]&&_0x5dd177[_0x59a0('0x20')]&&_0x5dd177[_0x59a0('0x21')]){var _0x1be65f=new _0x4b1669(_0x5dd177[_0x59a0('0x1f')],_0x5dd177[_0x59a0('0x20')]);_0x1be65f[_0x59a0('0x22')][_0x59a0('0x23')]({'body':_0x12701a[_0x59a0('0xc')],'to':_0x12701a[_0x59a0('0x21')],'from':_0x5dd177[_0x59a0('0x21')],'statusCallback':_0x5dd177[_0x59a0('0x24')]+_0x59a0('0x25')+_0x12701a['id']+_0x59a0('0x26')+_0x5dd177['token']})['then'](function(_0x4cf065){if(_0x4cf065[_0x59a0('0x27')]){return _0x34668e[_0x59a0('0x18')]({'messageId':_0x4cf065[_0x59a0('0x27')]});}})['catch'](function(_0x5c472d){logger['error'](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x1e'),util['inspect'](_0x5c472d,{'showHidden':![],'depth':null}));});}else{logger[_0x59a0('0x1a')](_0x59a0('0x28'),'afterCreate',_0x59a0('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x59a0('0x2a'):var _0x34c18a=_0x59a0('0x2b');if(_0x5dd177['username']&&_0x5dd177[_0x59a0('0x2c')]){var _0x5a233a={'recipient':[_0x12701a['phone']],'message':_0x12701a[_0x59a0('0xc')],'message_type':_0x5dd177[_0x59a0('0x2d')]};if(_0x5dd177[_0x59a0('0x2d')]&&_0x5dd177['smsMethod']!=='SI'){_0x5a233a[_0x59a0('0x2e')]=_0x5dd177['phone'];}var _0x3a7599={'url':_0x34c18a+'login?username='+_0x5dd177[_0x59a0('0x2f')]+'&password='+_0x5dd177[_0x59a0('0x2c')],'method':_0x59a0('0x30')};rp(_0x3a7599)[_0x59a0('0x17')](function(_0x5a4c7f){var _0x2b797f=_0x5a4c7f[_0x59a0('0x31')](';');var _0xd49dce={'user_key':_0x2b797f[0x0],'session_key':_0x2b797f[0x1]};_0x3a7599={'url':_0x34c18a+'sms','method':'POST','headers':{'user_key':_0xd49dce['user_key'],'Session_key':_0xd49dce[_0x59a0('0x32')]},'json':!![],'body':_0x5a233a};return rp(_0x3a7599);})[_0x59a0('0x17')](function(_0x18acd5){if(_0x18acd5['total_sent']>=0x1){var _0x22c587={'messageId':_0x18acd5[_0x59a0('0x33')]};if(_0x5dd177['smsMethod']!=='GP'||!_0x5dd177['deliveryReport']){_0x22c587[_0x59a0('0x34')]=!![];}return _0x34668e['update'](_0x22c587);}else{return logger['error'](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x2a'),util[_0x59a0('0x35')](_0x18acd5,{'showHidden':![],'depth':null}));}})[_0x59a0('0x36')](function(_0xfc7ccb){return logger[_0x59a0('0x1a')](_0x59a0('0x28'),'afterCreate','skebby',util[_0x59a0('0x35')](_0xfc7ccb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x2a'),_0x59a0('0x37'));}break;case'connectel':if(_0x5dd177[_0x59a0('0x20')]){var _0x1141a4={'recipient':_0x12701a[_0x59a0('0x21')],'message':_0x12701a[_0x59a0('0xc')],'sender':_0x5dd177[_0x59a0('0x38')]||_0x5dd177[_0x59a0('0x21')],'authorization':_0x5dd177[_0x59a0('0x20')]};var _0x185f8e={'method':_0x59a0('0x39'),'uri':_0x59a0('0x3a'),'body':_0x1141a4,'json':!![]};rp(_0x185f8e)[_0x59a0('0x17')](function(_0x340d8d){var _0x273d4b={'messageId':_0x340d8d[_0x59a0('0x3b')]};if(!_0x5dd177[_0x59a0('0x3c')]){_0x273d4b[_0x59a0('0x34')]=!![];}return _0x34668e[_0x59a0('0x18')](_0x273d4b);})[_0x59a0('0x36')](function(_0x2322ab){logger[_0x59a0('0x1a')](_0x59a0('0x28'),'afterCreate','connectel',util['inspect'](_0x2322ab,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x3d'),_0x59a0('0x3e'));}break;case _0x59a0('0x3f'):if(_0x5dd177[_0x59a0('0x2f')]&&_0x5dd177[_0x59a0('0x2c')]){var _0x1141a4={'messages':[{'source':'xCALLY\x20Motion','to':_0x12701a['phone'],'body':_0x12701a[_0x59a0('0xc')],'from':_0x5dd177[_0x59a0('0x38')]||_0x5dd177[_0x59a0('0x21')]}]};var _0x1b8bd0=util[_0x59a0('0x40')]('%s:%s',_0x5dd177[_0x59a0('0x2f')],_0x5dd177[_0x59a0('0x2c')]);var _0x185f8e={'method':'POST','uri':_0x59a0('0x41'),'body':_0x1141a4,'headers':{'Authorization':util['format'](_0x59a0('0x42'),new Buffer(_0x1b8bd0)[_0x59a0('0x43')]('base64'))},'json':!![]};rp(_0x185f8e)[_0x59a0('0x17')](function(_0x51206d){if(_0x51206d[_0x59a0('0x44')]>=0xc8&&_0x51206d[_0x59a0('0x44')]<=0xce){if(_0x51206d[_0x59a0('0x45')]&&_0x51206d[_0x59a0('0x45')][_0x59a0('0x46')]>0x0){var _0x23adc8=_[_0x59a0('0x47')](_0x51206d[_0x59a0('0x45')][_0x59a0('0x22')]);var _0x43da82={'messageId':_0x23adc8[_0x59a0('0x48')]};if(!_0x5dd177[_0x59a0('0x3c')]){_0x43da82[_0x59a0('0x34')]=!![];}return _0x34668e[_0x59a0('0x18')](_0x43da82);}else{logger[_0x59a0('0x1a')](_0x59a0('0x28'),_0x59a0('0x29'),'clickSend',util['inspect'](_0x51206d,{'showHidden':![],'depth':null}));}}else{logger[_0x59a0('0x1a')](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x49'),util[_0x59a0('0x35')](_0x51206d,{'showHidden':![],'depth':null}));}})[_0x59a0('0x36')](function(_0x4cf2cc){logger[_0x59a0('0x1a')](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x49'),util[_0x59a0('0x35')](_0x4cf2cc,{'showHidden':![],'depth':null}));});}else{logger[_0x59a0('0x1a')](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x49'),_0x59a0('0x37'));}break;case _0x59a0('0x4a'):if(_0x5dd177[_0x59a0('0x4b')]&&_0x5dd177['authToken']){var _0x1141a4={'dst':_0x12701a[_0x59a0('0x21')],'text':_0x12701a[_0x59a0('0xc')],'src':_0x5dd177[_0x59a0('0x38')]||_0x5dd177[_0x59a0('0x21')],'url':_0x5dd177[_0x59a0('0x24')]+_0x59a0('0x25')+_0x12701a['id']+_0x59a0('0x26')+_0x5dd177[_0x59a0('0x4c')]};var _0x1b8bd0=util[_0x59a0('0x40')]('%s:%s',_0x5dd177['authId'],_0x5dd177['authToken']);var _0x185f8e={'method':_0x59a0('0x39'),'uri':util[_0x59a0('0x40')](_0x59a0('0x4d'),_0x5dd177[_0x59a0('0x4b')]),'body':_0x1141a4,'headers':{'Authorization':util['format'](_0x59a0('0x42'),new Buffer(_0x1b8bd0)[_0x59a0('0x43')](_0x59a0('0x4e')))},'json':!![]};rp(_0x185f8e)[_0x59a0('0x17')](function(_0x58d38d){var _0x9f6c7d={'messageId':_0x58d38d[_0x59a0('0x4f')][0x0]};return _0x34668e[_0x59a0('0x18')](_0x9f6c7d);})[_0x59a0('0x36')](function(_0x51b798){logger['error'](_0x59a0('0x28'),'afterCreate',_0x59a0('0x4a'),util[_0x59a0('0x35')](_0x51b798,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x59a0('0x29'),_0x59a0('0x4a'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x5dd177[_0x59a0('0x2f')]&&_0x5dd177[_0x59a0('0x2c')]){if(_0x5dd177[_0x59a0('0x50')]){var _0x2a180b={'method':_0x59a0('0x39'),'uri':_0x5dd177['baseUrl']+_0x59a0('0x51'),'body':{'username':_0x5dd177['username'],'password':_0x5dd177[_0x59a0('0x2c')]},'json':!![]};return rp(_0x2a180b)[_0x59a0('0x17')](function(_0x22f877){var _0x280061={'method':_0x59a0('0x39'),'uri':_0x5dd177['baseUrl']+_0x59a0('0x52'),'body':{'messages':[{'from':_0x5dd177[_0x59a0('0x21')],'destinations':[{'to':_0x12701a[_0x59a0('0x21')]}],'text':_0x12701a[_0x59a0('0xc')],'notifyUrl':_0x5dd177[_0x59a0('0x24')]+_0x59a0('0x25')+_0x12701a['id']+_0x59a0('0x26')+_0x5dd177[_0x59a0('0x4c')],'notifyContentType':_0x59a0('0x53'),'callbackData':_0x5dd177['phone']+';'+_0x12701a[_0x59a0('0xc')]}]},'headers':{'Authorization':_0x59a0('0x54')+_0x22f877[_0x59a0('0x4c')]},'json':!![]};return rp(_0x280061)['then'](function(_0x290ff1){if(_0x290ff1[_0x59a0('0x22')]){var _0x58c415={'messageId':_0x290ff1[_0x59a0('0x22')][0x0]['messageId']};if(!_0x5dd177[_0x59a0('0x3c')]){_0x58c415[_0x59a0('0x34')]=!![];}return _0x34668e[_0x59a0('0x18')](_0x58c415);}else{return logger[_0x59a0('0x1a')](_0x59a0('0x28'),'afterCreate','infobip',util['inspect'](_0x290ff1,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x790c08){return logger[_0x59a0('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x59a0('0x29'),_0x59a0('0x55'),util['inspect'](_0x790c08,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x55'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x59a0('0x1a')](_0x59a0('0x28'),_0x59a0('0x29'),'infobip',_0x59a0('0x37'));}break;case _0x59a0('0x56'):var _0x3c5b23=require(_0x59a0('0x57'));if(_0x5dd177[_0x59a0('0x58')]){var _0x2d998a={};_0x2d998a[_0x59a0('0x59')]=_0x5dd177[_0x59a0('0x2f')];_0x2d998a['phone']=_0x12701a[_0x59a0('0x21')];_0x2d998a[_0x59a0('0x2e')]=_0x5dd177['phone'];_0x2d998a[_0x59a0('0x5a')]=_0x12701a[_0x59a0('0xc')];_0x2d998a['timestamp']=+new Date();var _0x4f57fa='';var _0x3b7937='';var _0x2adf9c=Object[_0x59a0('0x5b')](_0x2d998a);_0x2adf9c['sort']();for(var _0x1b166b=0x0;_0x1b166b<_0x2adf9c[_0x59a0('0x5c')];_0x1b166b++){if(_0x4f57fa!=''){_0x4f57fa+='&';}_0x4f57fa+=_0x2adf9c[_0x1b166b]+'='+encodeURIComponent(_0x2d998a[_0x2adf9c[_0x1b166b]]);_0x3b7937+=_0x2d998a[_0x2adf9c[_0x1b166b]];}_0x3b7937+=_0x5dd177[_0x59a0('0x58')];_0x3b7937=_0x3c5b23['createHash'](_0x59a0('0x5d'))[_0x59a0('0x18')](_0x3b7937)[_0x59a0('0x5e')](_0x59a0('0x5f'));if(_0x4f57fa!==''){_0x4f57fa+='&';}_0x4f57fa+=_0x59a0('0x60')+_0x3b7937;var _0x3a7599={'method':'GET','uri':_0x5dd177[_0x59a0('0x50')]+'/external/get/send.php?'+_0x4f57fa,'json':!![]};return rp(_0x3a7599)[_0x59a0('0x17')](function(_0x4bd8e5){var _0x17a507=Object[_0x59a0('0x5b')](_0x4bd8e5);if(_0x4bd8e5[_0x17a507[0x0]]['error']&&parseInt(_0x4bd8e5[_0x17a507[0x0]][_0x59a0('0x1a')])===0x0){var _0xa029c9={'messageId':_0x4bd8e5[_0x17a507[0x0]][_0x59a0('0x61')]};if(!_0x5dd177[_0x59a0('0x3c')]){_0xa029c9['read']=!![];}return _0x34668e[_0x59a0('0x18')](_0xa029c9);}else{return logger[_0x59a0('0x1a')](_0x59a0('0x28'),'afterCreate','csc',util[_0x59a0('0x35')](_0x4bd8e5[_0x59a0('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x63fd97){return logger['error'](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x56'),util[_0x59a0('0x35')](_0x63fd97,{'showHidden':![],'depth':null}));});}else{logger[_0x59a0('0x1a')](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x56'),_0x59a0('0x62'));}break;case _0x59a0('0x63'):if(_0x5dd177[_0x59a0('0x58')]){var _0x528ed4={'method':'POST','uri':_0x59a0('0x64'),'headers':{'Authorization':_0x5dd177[_0x59a0('0x58')]},'body':{'content':_0x12701a[_0x59a0('0xc')],'to':[_0x12701a[_0x59a0('0x21')]],'from':_0x5dd177[_0x59a0('0x21')],'binary':![],'clientMessageId':_0x59a0('0x65'),'charset':'UTF-8'},'json':!![]};rp(_0x528ed4)[_0x59a0('0x17')](function(_0x11e294){if(!_0x11e294['error']){var _0x7ab5de={'messageId':_0x11e294[_0x59a0('0x22')][0x0][_0x59a0('0x66')]};if(!_0x5dd177[_0x59a0('0x3c')]){_0x7ab5de[_0x59a0('0x34')]=!![];}return _0x34668e[_0x59a0('0x18')](_0x7ab5de);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x59a0('0x63'),util[_0x59a0('0x35')](_0x11e294[_0x59a0('0x1a')],{'showHidden':![],'depth':null}));}})[_0x59a0('0x36')](function(_0x1d4e51){return logger['error'](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x63'),util[_0x59a0('0x35')](_0x1d4e51,{'showHidden':![],'depth':null}));});}else{logger[_0x59a0('0x1a')](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x63'),_0x59a0('0x62'));}break;case _0x59a0('0x67'):if(_0x5dd177[_0x59a0('0x2f')]&&_0x5dd177[_0x59a0('0x2c')]){var _0x1b8bd0=util[_0x59a0('0x40')](_0x59a0('0x68'),_0x5dd177[_0x59a0('0x2f')],_0x5dd177[_0x59a0('0x2c')]);var _0x185f8e={'method':_0x59a0('0x39'),'uri':_0x59a0('0x69')+_0x5dd177[_0x59a0('0x6a')]+_0x59a0('0x6b'),'body':{'to':[_0x12701a[_0x59a0('0x21')]],'text':_0x12701a[_0x59a0('0xc')],'from':_0x5dd177['phone'],'applicationId':_0x5dd177[_0x59a0('0x6c')]},'headers':{'Authorization':util[_0x59a0('0x40')](_0x59a0('0x42'),new Buffer(_0x1b8bd0)[_0x59a0('0x43')](_0x59a0('0x4e')))},'json':!![]};rp(_0x185f8e)['then'](function(_0x1944be){if(_0x1944be['id']){var _0x1d5b8b={'messageId':_0x1944be['id']};return _0x34668e[_0x59a0('0x18')](_0x1d5b8b);}else{logger[_0x59a0('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x59a0('0x29'),_0x59a0('0x67'),util[_0x59a0('0x35')](_0x1944be,{'showHidden':![],'depth':null}));}})[_0x59a0('0x36')](function(_0x5dd0ba){logger[_0x59a0('0x1a')](_0x59a0('0x28'),'afterCreate','bandwidth',util[_0x59a0('0x35')](_0x5dd0ba,{'showHidden':![],'depth':null}));});}else{logger[_0x59a0('0x1a')](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x67'),_0x59a0('0x37'));}break;case _0x59a0('0x6d'):if(_0x5dd177[_0x59a0('0x58')]){var _0x49765b={};var _0x3a7599={'method':_0x59a0('0x39'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x59a0('0x6e')+_0x5dd177[_0x59a0('0x58')],'Content-Type':'application/json'},'body':{'from':_0x5dd177[_0x59a0('0x21')],'to':_0x12701a[_0x59a0('0x21')],'text':_0x12701a['body']},'json':!![]};return rp(_0x3a7599)[_0x59a0('0x17')](function(_0x550e88){if(_0x550e88['code']==0xca){_0x49765b[_0x59a0('0x6f')]=_0x550e88;var _0x4999b7={'method':_0x59a0('0x39'),'uri':_0x59a0('0x70'),'headers':{'Authorization':'Bearer\x20'+_0x5dd177[_0x59a0('0x58')],'Content-Type':'application/json'},'body':{'refid':_0x49765b[_0x59a0('0x6f')][_0x59a0('0x71')]},'json':!![]};return rp(_0x4999b7)['then'](function(_0x2e3223){_0x49765b[_0x59a0('0x72')]=_0x2e3223;var _0x4748d3={'messageId':_0x49765b[_0x59a0('0x6f')][_0x59a0('0x71')],'read':!![]};return _0x34668e[_0x59a0('0x18')](_0x4748d3);});}else{return logger[_0x59a0('0x1a')](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x6d'),util[_0x59a0('0x35')](_0x550e88,{'showHidden':![],'depth':null}));}})[_0x59a0('0x36')](function(_0x14bb19){return logger[_0x59a0('0x1a')](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x6d'),util[_0x59a0('0x35')](_0x14bb19,{'showHidden':![],'depth':null}));});}else{return logger[_0x59a0('0x1a')](_0x59a0('0x28'),_0x59a0('0x29'),'intelepeer',_0x59a0('0x73'));}break;}}})['finally'](function(){_0x1b54b3();});}else{_0x1b54b3();}}},'charset':'utf8mb4','collate':_0x59a0('0x74')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index d504354..f681e58 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 _0xfd4f=['../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','./smsMessage.socket','then','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateSmsMessage','SmsMessage','body','options','util','bluebird','randomstring','ioredis'];(function(_0x5eeba5,_0x402b70){var _0x362413=function(_0x1b7e54){while(--_0x1b7e54){_0x5eeba5['push'](_0x5eeba5['shift']());}};_0x362413(++_0x402b70);}(_0xfd4f,0x11a));var _0xffd4=function(_0x2cb576,_0xdc4bc1){_0x2cb576=_0x2cb576-0x0;var _0x199d50=_0xfd4f[_0x2cb576];return _0x199d50;};'use strict';var _=require('lodash');var util=require(_0xffd4('0x0'));var moment=require('moment');var BPromise=require(_0xffd4('0x1'));var rs=require(_0xffd4('0x2'));var fs=require('fs');var Redis=require(_0xffd4('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xffd4('0x4'))('rpc');var config=require(_0xffd4('0x5'));var jayson=require(_0xffd4('0x6'));var client=jayson[_0xffd4('0x7')][_0xffd4('0x8')]({'port':0x232a});config['redis']=_[_0xffd4('0x9')](config[_0xffd4('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xffd4('0xa')]));require(_0xffd4('0xb'))['register'](socket);function respondWithRpcPromise(_0xcc028b,_0x4c9129,_0x13aebf){return new BPromise(function(_0x2b5a85,_0xf39c60){return client['request'](_0xcc028b,_0x13aebf)[_0xffd4('0xc')](function(_0x3dd9cf){logger['info'](_0xffd4('0xd'),_0x4c9129,_0xffd4('0xe'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4c9129,_0xffd4('0xe'),JSON[_0xffd4('0xf')](_0x3dd9cf));if(_0x3dd9cf['error']){if(_0x3dd9cf[_0xffd4('0x10')][_0xffd4('0x11')]===0x1f4){logger['error'](_0xffd4('0xd'),_0x4c9129,_0x3dd9cf[_0xffd4('0x10')][_0xffd4('0x12')]);return _0xf39c60(_0x3dd9cf[_0xffd4('0x10')][_0xffd4('0x12')]);}logger[_0xffd4('0x10')]('SmsMessage,\x20%s,\x20%s',_0x4c9129,_0x3dd9cf[_0xffd4('0x10')][_0xffd4('0x12')]);return _0x2b5a85(_0x3dd9cf[_0xffd4('0x10')][_0xffd4('0x12')]);}else{logger[_0xffd4('0x13')](_0xffd4('0xd'),_0x4c9129,_0xffd4('0xe'));_0x2b5a85(_0x3dd9cf[_0xffd4('0x14')][_0xffd4('0x12')]);}})[_0xffd4('0x15')](function(_0x5c6fc8){logger[_0xffd4('0x10')](_0xffd4('0xd'),_0x4c9129,_0x5c6fc8);_0xf39c60(_0x5c6fc8);});});}exports[_0xffd4('0x16')]=function(_0x2c8a09){var _0x4529ba=this;return new Promise(function(_0x389f4d,_0x1a0ad6){return db[_0xffd4('0x17')]['create'](_0x2c8a09[_0xffd4('0x18')],{'raw':_0x2c8a09[_0xffd4('0x19')]?_0x2c8a09[_0xffd4('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x38b5b9){logger[_0xffd4('0x13')]('CreateSmsMessage',_0x2c8a09);logger['debug'](_0xffd4('0x16'),_0x2c8a09,JSON['stringify'](_0x38b5b9));_0x389f4d(_0x38b5b9);})[_0xffd4('0x15')](function(_0x4b696e){logger[_0xffd4('0x10')](_0xffd4('0x16'),_0x4b696e[_0xffd4('0x12')],_0x2c8a09);_0x1a0ad6(_0x4529ba[_0xffd4('0x10')](0x1f4,_0x4b696e['message']));});});}; \ No newline at end of file +var _0x7efd=['error','code','message','info','request\x20sent','catch','CreateSmsMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','socket.io-emitter','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1486e5,_0x39684f){var _0x29d89b=function(_0x4a0a80){while(--_0x4a0a80){_0x1486e5['push'](_0x1486e5['shift']());}};_0x29d89b(++_0x39684f);}(_0x7efd,0x103));var _0xd7ef=function(_0x2e33d3,_0x4375d2){_0x2e33d3=_0x2e33d3-0x0;var _0x5cd87d=_0x7efd[_0x2e33d3];return _0x5cd87d;};'use strict';var _=require(_0xd7ef('0x0'));var util=require(_0xd7ef('0x1'));var moment=require(_0xd7ef('0x2'));var BPromise=require(_0xd7ef('0x3'));var rs=require(_0xd7ef('0x4'));var fs=require('fs');var Redis=require(_0xd7ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd7ef('0x6'));var logger=require('../../config/logger')(_0xd7ef('0x7'));var config=require(_0xd7ef('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd7ef('0x9')][_0xd7ef('0xa')]({'port':0x232a});config[_0xd7ef('0xb')]=_['defaults'](config[_0xd7ef('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd7ef('0xc'))(new Redis(config[_0xd7ef('0xb')]));require(_0xd7ef('0xd'))[_0xd7ef('0xe')](socket);function respondWithRpcPromise(_0x48fc83,_0x4b3c26,_0x512cc2){return new BPromise(function(_0x5e208c,_0x296bbc){return client[_0xd7ef('0xf')](_0x48fc83,_0x512cc2)[_0xd7ef('0x10')](function(_0x51a4a1){logger['info'](_0xd7ef('0x11'),_0x4b3c26,'request\x20sent');logger['debug'](_0xd7ef('0x12'),_0x4b3c26,'request\x20sent',JSON[_0xd7ef('0x13')](_0x51a4a1));if(_0x51a4a1[_0xd7ef('0x14')]){if(_0x51a4a1['error'][_0xd7ef('0x15')]===0x1f4){logger[_0xd7ef('0x14')](_0xd7ef('0x11'),_0x4b3c26,_0x51a4a1[_0xd7ef('0x14')][_0xd7ef('0x16')]);return _0x296bbc(_0x51a4a1[_0xd7ef('0x14')]['message']);}logger[_0xd7ef('0x14')]('SmsMessage,\x20%s,\x20%s',_0x4b3c26,_0x51a4a1[_0xd7ef('0x14')][_0xd7ef('0x16')]);return _0x5e208c(_0x51a4a1[_0xd7ef('0x14')][_0xd7ef('0x16')]);}else{logger[_0xd7ef('0x17')](_0xd7ef('0x11'),_0x4b3c26,_0xd7ef('0x18'));_0x5e208c(_0x51a4a1['result']['message']);}})[_0xd7ef('0x19')](function(_0x19d59e){logger[_0xd7ef('0x14')]('SmsMessage,\x20%s,\x20%s',_0x4b3c26,_0x19d59e);_0x296bbc(_0x19d59e);});});}exports[_0xd7ef('0x1a')]=function(_0x1d09ec){var _0x35d97b=this;return new Promise(function(_0x2fdbcf,_0x4465a0){return db['SmsMessage'][_0xd7ef('0x1b')](_0x1d09ec[_0xd7ef('0x1c')],{'raw':_0x1d09ec['options']?_0x1d09ec[_0xd7ef('0x1d')][_0xd7ef('0x1e')]===undefined?!![]:![]:!![]})[_0xd7ef('0x10')](function(_0x258cb3){logger[_0xd7ef('0x17')](_0xd7ef('0x1a'),_0x1d09ec);logger['debug']('CreateSmsMessage',_0x1d09ec,JSON[_0xd7ef('0x13')](_0x258cb3));_0x2fdbcf(_0x258cb3);})[_0xd7ef('0x19')](function(_0xb16580){logger['error'](_0xd7ef('0x1a'),_0xb16580['message'],_0x1d09ec);_0x4465a0(_0x35d97b[_0xd7ef('0x14')](0x1f4,_0xb16580['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 273fbff..78f0760 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 _0xdfcb=['update','removeListener','register','length','smsMessage:','./smsMessage.events','save'];(function(_0x4a9293,_0x319a95){var _0xb0c568=function(_0x498414){while(--_0x498414){_0x4a9293['push'](_0x4a9293['shift']());}};_0xb0c568(++_0x319a95);}(_0xdfcb,0x1e1));var _0xbdfc=function(_0x179e11,_0xf65436){_0x179e11=_0x179e11-0x0;var _0x549f04=_0xdfcb[_0x179e11];return _0x549f04;};'use strict';var SmsMessageEvents=require(_0xbdfc('0x0'));var events=[_0xbdfc('0x1'),'remove',_0xbdfc('0x2')];function createListener(_0x454b53,_0x1083c6){return function(_0x3e20fa){_0x1083c6['emit'](_0x454b53,_0x3e20fa);};}function removeListener(_0x23b564,_0x588b14){return function(){SmsMessageEvents[_0xbdfc('0x3')](_0x23b564,_0x588b14);};}exports[_0xbdfc('0x4')]=function(_0x5cd4b6){for(var _0xf52e91=0x0,_0x566bca=events[_0xbdfc('0x5')];_0xf52e91<_0x566bca;_0xf52e91++){var _0x33b356=events[_0xf52e91];var _0x16a297=createListener(_0xbdfc('0x6')+_0x33b356,_0x5cd4b6);SmsMessageEvents['on'](_0x33b356,_0x16a297);}}; \ No newline at end of file +var _0x1d60=['smsMessage:','./smsMessage.events','save','remove','update','emit','removeListener','length'];(function(_0x49a4e3,_0x1cc52e){var _0x1e96be=function(_0x184bdd){while(--_0x184bdd){_0x49a4e3['push'](_0x49a4e3['shift']());}};_0x1e96be(++_0x1cc52e);}(_0x1d60,0xf1));var _0x01d6=function(_0x43fac0,_0x345c86){_0x43fac0=_0x43fac0-0x0;var _0xf1a226=_0x1d60[_0x43fac0];return _0xf1a226;};'use strict';var SmsMessageEvents=require(_0x01d6('0x0'));var events=[_0x01d6('0x1'),_0x01d6('0x2'),_0x01d6('0x3')];function createListener(_0x47076b,_0x59f92a){return function(_0x149977){_0x59f92a[_0x01d6('0x4')](_0x47076b,_0x149977);};}function removeListener(_0x3de778,_0x5bcd7a){return function(){SmsMessageEvents[_0x01d6('0x5')](_0x3de778,_0x5bcd7a);};}exports['register']=function(_0x34ecf5){for(var _0x2e7af2=0x0,_0x2381cf=events[_0x01d6('0x6')];_0x2e7af2<_0x2381cf;_0x2e7af2++){var _0x3f29d2=events[_0x2e7af2];var _0x4aca5c=createListener(_0x01d6('0x7')+_0x3f29d2,_0x34ecf5);SmsMessageEvents['on'](_0x3f29d2,_0x4aca5c);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 63dc999..f0a5bf1 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 _0xb92a=['../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','create','post','addTeams','update','destroy','delete','exports','multer','util','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1d9ab4,_0x56c27d){var _0x283f2e=function(_0x1edd5d){while(--_0x1edd5d){_0x1d9ab4['push'](_0x1d9ab4['shift']());}};_0x283f2e(++_0x56c27d);}(_0xb92a,0x166));var _0xab92=function(_0xe60b19,_0x1efc54){_0xe60b19=_0xe60b19-0x0;var _0x45f3fc=_0xb92a[_0xe60b19];return _0x45f3fc;};'use strict';var multer=require(_0xab92('0x0'));var util=require(_0xab92('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xab92('0x2'));var router=express[_0xab92('0x3')]();var fs_extra=require(_0xab92('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xab92('0x5'));var config=require(_0xab92('0x6'));var controller=require(_0xab92('0x7'));router[_0xab92('0x8')]('/',auth[_0xab92('0x9')](),controller[_0xab92('0xa')]);router[_0xab92('0x8')](_0xab92('0xb'),auth[_0xab92('0x9')](),controller[_0xab92('0xc')]);router[_0xab92('0x8')](_0xab92('0xd'),auth[_0xab92('0x9')](),controller[_0xab92('0xe')]);router[_0xab92('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0xab92('0xf')]);router['get'](_0xab92('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0xab92('0x8')](_0xab92('0x11'),auth[_0xab92('0x9')](),controller[_0xab92('0x12')]);router['post']('/',auth[_0xab92('0x9')](),controller[_0xab92('0x13')]);router[_0xab92('0x14')](_0xab92('0x10'),auth[_0xab92('0x9')](),controller[_0xab92('0x15')]);router[_0xab92('0x14')](_0xab92('0x11'),auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0xab92('0x9')](),controller[_0xab92('0x16')]);router['delete'](_0xab92('0xd'),auth[_0xab92('0x9')](),controller[_0xab92('0x17')]);router[_0xab92('0x18')](_0xab92('0x10'),auth[_0xab92('0x9')](),controller['removeTeams']);router[_0xab92('0x18')]('/:id/users',auth[_0xab92('0x9')](),controller['removeAgents']);module[_0xab92('0x19')]=router; \ No newline at end of file +var _0x8320=['/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x3ea960,_0x1259b1){var _0x1eeba2=function(_0xed08db){while(--_0xed08db){_0x3ea960['push'](_0x3ea960['shift']());}};_0x1eeba2(++_0x1259b1);}(_0x8320,0x1b3));var _0x0832=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0x8320[_0x454165];return _0x56db53;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0832('0x0'));var timeout=require('connect-timeout');var express=require(_0x0832('0x1'));var router=express[_0x0832('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0832('0x3'));var interaction=require(_0x0832('0x4'));var config=require(_0x0832('0x5'));var controller=require(_0x0832('0x6'));router[_0x0832('0x7')]('/',auth['isAuthenticated'](),controller[_0x0832('0x8')]);router[_0x0832('0x7')](_0x0832('0x9'),auth[_0x0832('0xa')](),controller[_0x0832('0xb')]);router[_0x0832('0x7')](_0x0832('0xc'),auth[_0x0832('0xa')](),controller['show']);router[_0x0832('0x7')](_0x0832('0xd'),auth[_0x0832('0xa')](),controller['getMembers']);router[_0x0832('0x7')](_0x0832('0xe'),auth[_0x0832('0xa')](),controller[_0x0832('0xf')]);router[_0x0832('0x7')](_0x0832('0x10'),auth[_0x0832('0xa')](),controller[_0x0832('0x11')]);router[_0x0832('0x12')]('/',auth[_0x0832('0xa')](),controller[_0x0832('0x13')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x0832('0x14')]);router['post']('/:id/users',auth[_0x0832('0xa')](),controller[_0x0832('0x15')]);router[_0x0832('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x0832('0x17')]);router[_0x0832('0x18')](_0x0832('0xc'),auth[_0x0832('0xa')](),controller[_0x0832('0x19')]);router[_0x0832('0x18')]('/:id/teams',auth[_0x0832('0xa')](),controller['removeTeams']);router[_0x0832('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x0832('0x1a')]);module[_0x0832('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 240216b..6240c8a 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 _0x6c65=['STRING','name','INTEGER','ENUM','roundrobin'];(function(_0x2eebfa,_0x2b23fd){var _0xdb8044=function(_0x3f11e0){while(--_0x3f11e0){_0x2eebfa['push'](_0x2eebfa['shift']());}};_0xdb8044(++_0x2b23fd);}(_0x6c65,0xf0));var _0x56c6=function(_0x4ce744,_0x36748d){_0x4ce744=_0x4ce744-0x0;var _0x28637b=_0x6c65[_0x4ce744];return _0x28637b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x56c6('0x0')],'unique':_0x56c6('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x56c6('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x56c6('0x3')]('rrmemory','beepall',_0x56c6('0x4'))}}; \ No newline at end of file +var _0xd567=['INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x5f47e1,_0x4205b8){var _0x36b14c=function(_0xf1de12){while(--_0xf1de12){_0x5f47e1['push'](_0x5f47e1['shift']());}};_0x36b14c(++_0x4205b8);}(_0xd567,0xc1));var _0x7d56=function(_0x2e4f5c,_0x3a04f1){_0x2e4f5c=_0x2e4f5c-0x0;var _0x11d4af=_0xd567[_0x2e4f5c];return _0x11d4af;};'use strict';var Sequelize=require(_0x7d56('0x0'));module[_0x7d56('0x1')]={'name':{'type':Sequelize[_0x7d56('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7d56('0x2')]},'timeout':{'type':Sequelize[_0x7d56('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7d56('0x4')](_0x7d56('0x5'),_0x7d56('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 6f3793b..aee9c44 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 _0x3832=['toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','getAgents','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','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsQueue.socket','sendStatus','status','end','undefined','count','offset','set','apply','reject','save','update','then','destroy','get','SmsQueues','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','SmsQueue','includeAll','include','findAll','rows','params','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','UserProfileResource','body','describe','getMembers','findOne','UserSmsQueue','hasOwnProperty','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize'];(function(_0x34bc94,_0x74f0fd){var _0xee41e7=function(_0x424111){while(--_0x424111){_0x34bc94['push'](_0x34bc94['shift']());}};_0xee41e7(++_0x74f0fd);}(_0x3832,0x9d));var _0x2383=function(_0x483f0,_0x329df8){_0x483f0=_0x483f0-0x0;var _0x59a8eb=_0x3832[_0x483f0];return _0x59a8eb;};'use strict';var emlformat=require(_0x2383('0x0'));var rimraf=require(_0x2383('0x1'));var zipdir=require(_0x2383('0x2'));var jsonpatch=require(_0x2383('0x3'));var rp=require(_0x2383('0x4'));var moment=require(_0x2383('0x5'));var BPromise=require(_0x2383('0x6'));var Mustache=require(_0x2383('0x7'));var util=require('util');var path=require(_0x2383('0x8'));var sox=require(_0x2383('0x9'));var csv=require(_0x2383('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2383('0xb'));var _=require(_0x2383('0xc'));var squel=require(_0x2383('0xd'));var crypto=require('crypto');var jsforce=require(_0x2383('0xe'));var deskjs=require(_0x2383('0xf'));var toCsv=require(_0x2383('0xa'));var querystring=require(_0x2383('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2383('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2383('0x12'));var hardwareService=require(_0x2383('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2383('0x14'));var config=require(_0x2383('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2383('0x16'))['db'];config[_0x2383('0x17')]=_[_0x2383('0x18')](config[_0x2383('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x2383('0x19'))(new Redis(config[_0x2383('0x17')]));require(_0x2383('0x1a'))['register'](socket);function respondWithStatusCode(_0x1b354f,_0x24d949){_0x24d949=_0x24d949||0xcc;return function(_0x18fb56){if(_0x18fb56){return _0x1b354f[_0x2383('0x1b')](_0x24d949);}return _0x1b354f[_0x2383('0x1c')](_0x24d949)[_0x2383('0x1d')]();};}function respondWithResult(_0x5e7f1f,_0x1ac456){_0x1ac456=_0x1ac456||0xc8;return function(_0xd565b9){if(_0xd565b9){return _0x5e7f1f['status'](_0x1ac456)['json'](_0xd565b9);}};}function respondWithFilteredResult(_0x345e05,_0x4ec767){return function(_0x46b952){if(_0x46b952){var _0x5f579a=typeof _0x4ec767['offset']===_0x2383('0x1e')&&typeof _0x4ec767['limit']==='undefined';var _0x578c8d=_0x46b952[_0x2383('0x1f')];var _0x1260ba=_0x5f579a?0x0:_0x4ec767[_0x2383('0x20')];var _0x22435a=_0x5f579a?_0x46b952[_0x2383('0x1f')]:_0x4ec767[_0x2383('0x20')]+_0x4ec767['limit'];var _0x645c7;if(_0x22435a>=_0x578c8d){_0x22435a=_0x578c8d;_0x645c7=0xc8;}else{_0x645c7=0xce;}_0x345e05[_0x2383('0x1c')](_0x645c7);return _0x345e05[_0x2383('0x21')]('Content-Range',_0x1260ba+'-'+_0x22435a+'/'+_0x578c8d)['json'](_0x46b952);}return null;};}function patchUpdates(_0x13c679){return function(_0x598d7e){try{jsonpatch[_0x2383('0x22')](_0x598d7e,_0x13c679,!![]);}catch(_0x30979b){return BPromise[_0x2383('0x23')](_0x30979b);}return _0x598d7e[_0x2383('0x24')]();};}function saveUpdates(_0x4e73fb,_0x3aa195){return function(_0x32a3fb){if(_0x32a3fb){return _0x32a3fb[_0x2383('0x25')](_0x4e73fb)[_0x2383('0x26')](function(_0x3ffb59){return _0x3ffb59;});}return null;};}function removeEntity(_0x4cd92c,_0x437524){return function(_0x4f7610){if(_0x4f7610){return _0x4f7610[_0x2383('0x27')]()[_0x2383('0x26')](function(){var _0xaaaab6=_0x4f7610[_0x2383('0x28')]({'plain':!![]});var _0x359c9b=_0x2383('0x29');return db['UserProfileResource'][_0x2383('0x27')]({'where':{'type':_0x359c9b,'resourceId':_0xaaaab6['id']}})[_0x2383('0x26')](function(){return _0x4f7610;});})[_0x2383('0x26')](function(){_0x4cd92c['status'](0xcc)[_0x2383('0x1d')]();});}};}function handleEntityNotFound(_0x5239af,_0x288d0a){return function(_0x4537cf){if(!_0x4537cf){_0x5239af[_0x2383('0x1b')](0x194);}return _0x4537cf;};}function handleError(_0xc39f2e,_0x24563d){_0x24563d=_0x24563d||0x1f4;return function(_0x45e5ff){logger[_0x2383('0x2a')](_0x45e5ff[_0x2383('0x2b')]);if(_0x45e5ff[_0x2383('0x2c')]){delete _0x45e5ff[_0x2383('0x2c')];}_0xc39f2e[_0x2383('0x1c')](_0x24563d)[_0x2383('0x2d')](_0x45e5ff);};}exports[_0x2383('0x2e')]=function(_0x4f8cee,_0x1e70f8){var _0x36dfbe={},_0xd30667={},_0x479686={'count':0x0,'rows':[]};var _0x469fe1=_[_0x2383('0x2f')](db['SmsQueue'][_0x2383('0x30')],function(_0x574c37){return{'name':_0x574c37['fieldName'],'type':_0x574c37[_0x2383('0x31')]['key']};});_0xd30667[_0x2383('0x32')]=_[_0x2383('0x2f')](_0x469fe1,_0x2383('0x2c'));_0xd30667[_0x2383('0x33')]=_[_0x2383('0x34')](_0x4f8cee['query']);_0xd30667[_0x2383('0x35')]=_[_0x2383('0x36')](_0xd30667['model'],_0xd30667['query']);_0x36dfbe[_0x2383('0x37')]=_[_0x2383('0x36')](_0xd30667['model'],qs[_0x2383('0x38')](_0x4f8cee['query'][_0x2383('0x38')]));_0x36dfbe[_0x2383('0x37')]=_0x36dfbe[_0x2383('0x37')][_0x2383('0x39')]?_0x36dfbe[_0x2383('0x37')]:_0xd30667['model'];if(!_0x4f8cee[_0x2383('0x33')]['hasOwnProperty'](_0x2383('0x3a'))){_0x36dfbe[_0x2383('0x3b')]=qs[_0x2383('0x3b')](_0x4f8cee[_0x2383('0x33')][_0x2383('0x3b')]);_0x36dfbe['offset']=qs[_0x2383('0x20')](_0x4f8cee[_0x2383('0x33')][_0x2383('0x20')]);}_0x36dfbe[_0x2383('0x3c')]=qs[_0x2383('0x3d')](_0x4f8cee[_0x2383('0x33')][_0x2383('0x3d')]);_0x36dfbe[_0x2383('0x3e')]=qs[_0x2383('0x35')](_[_0x2383('0x3f')](_0x4f8cee[_0x2383('0x33')],_0xd30667[_0x2383('0x35')]),_0x469fe1);if(_0x4f8cee['query'][_0x2383('0x40')]){_0x36dfbe[_0x2383('0x3e')]=_[_0x2383('0x41')](_0x36dfbe[_0x2383('0x3e')],{'$or':_['map'](_0x469fe1,function(_0x43642e){if(_0x43642e[_0x2383('0x31')]!==_0x2383('0x42')){var _0x11a2dc={};_0x11a2dc[_0x43642e[_0x2383('0x2c')]]={'$like':'%'+_0x4f8cee[_0x2383('0x33')]['filter']+'%'};return _0x11a2dc;}})});}_0x36dfbe=_[_0x2383('0x41')]({},_0x36dfbe,_0x4f8cee[_0x2383('0x43')]);var _0x3c0932={'where':_0x36dfbe[_0x2383('0x3e')]};return db[_0x2383('0x44')]['count'](_0x3c0932)[_0x2383('0x26')](function(_0x4b1e0f){_0x479686['count']=_0x4b1e0f;if(_0x4f8cee[_0x2383('0x33')][_0x2383('0x45')]){_0x36dfbe[_0x2383('0x46')]=[{'all':!![]}];}return db[_0x2383('0x44')][_0x2383('0x47')](_0x36dfbe);})[_0x2383('0x26')](function(_0x3f45fb){_0x479686[_0x2383('0x48')]=_0x3f45fb;return _0x479686;})[_0x2383('0x26')](respondWithFilteredResult(_0x1e70f8,_0x36dfbe))['catch'](handleError(_0x1e70f8,null));};exports['show']=function(_0x771544,_0x5d2ea0){var _0x55cad3={'raw':!![],'where':{'id':_0x771544[_0x2383('0x49')]['id']}},_0x23f292={};_0x23f292[_0x2383('0x32')]=_[_0x2383('0x34')](db[_0x2383('0x44')]['rawAttributes']);_0x23f292['query']=_['keys'](_0x771544[_0x2383('0x33')]);_0x23f292[_0x2383('0x35')]=_[_0x2383('0x36')](_0x23f292[_0x2383('0x32')],_0x23f292[_0x2383('0x33')]);_0x55cad3[_0x2383('0x37')]=_['intersection'](_0x23f292['model'],qs[_0x2383('0x38')](_0x771544[_0x2383('0x33')][_0x2383('0x38')]));_0x55cad3[_0x2383('0x37')]=_0x55cad3[_0x2383('0x37')][_0x2383('0x39')]?_0x55cad3['attributes']:_0x23f292['model'];if(_0x771544[_0x2383('0x33')][_0x2383('0x45')]){_0x55cad3['include']=[{'all':!![]}];}_0x55cad3=_[_0x2383('0x41')]({},_0x55cad3,_0x771544['options']);return db[_0x2383('0x44')]['find'](_0x55cad3)[_0x2383('0x26')](handleEntityNotFound(_0x5d2ea0,null))[_0x2383('0x26')](respondWithResult(_0x5d2ea0,null))[_0x2383('0x4a')](handleError(_0x5d2ea0,null));};exports[_0x2383('0x4b')]=function(_0x2c4996,_0x14e928){return db['SmsQueue'][_0x2383('0x4b')](_0x2c4996['body'],{})['then'](function(_0x52c02e){var _0x19b760=_0x2c4996[_0x2383('0x4c')][_0x2383('0x28')]({'plain':!![]});if(!_0x19b760)throw new Error(_0x2383('0x4d'));if(_0x19b760[_0x2383('0x4e')]==='user'){var _0x534f92=_0x52c02e[_0x2383('0x28')]({'plain':!![]});var _0x8ccabb=_0x2383('0x29');return db['UserProfileSection'][_0x2383('0x4f')]({'where':{'name':_0x8ccabb,'userProfileId':_0x19b760[_0x2383('0x50')]},'raw':!![]})['then'](function(_0xa3c802){if(_0xa3c802&&_0xa3c802['autoAssociation']===0x0){return db[_0x2383('0x51')][_0x2383('0x4b')]({'name':_0x534f92[_0x2383('0x2c')],'resourceId':_0x534f92['id'],'type':_0xa3c802[_0x2383('0x2c')],'sectionId':_0xa3c802['id']},{})['then'](function(){return _0x52c02e;});}else{return _0x52c02e;}})[_0x2383('0x4a')](function(_0x39a67f){logger[_0x2383('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39a67f);throw _0x39a67f;});}return _0x52c02e;})[_0x2383('0x26')](respondWithResult(_0x14e928,0xc9))[_0x2383('0x4a')](handleError(_0x14e928,null));};exports[_0x2383('0x25')]=function(_0x133f0f,_0x296bfe){if(_0x133f0f[_0x2383('0x52')]['id']){delete _0x133f0f['body']['id'];}return db[_0x2383('0x44')][_0x2383('0x4f')]({'where':{'id':_0x133f0f['params']['id']}})[_0x2383('0x26')](handleEntityNotFound(_0x296bfe,null))[_0x2383('0x26')](saveUpdates(_0x133f0f['body'],null))[_0x2383('0x26')](respondWithResult(_0x296bfe,null))['catch'](handleError(_0x296bfe,null));};exports[_0x2383('0x27')]=function(_0x157597,_0x4322a3){return db[_0x2383('0x44')][_0x2383('0x4f')]({'where':{'id':_0x157597[_0x2383('0x49')]['id']}})['then'](handleEntityNotFound(_0x4322a3,null))[_0x2383('0x26')](removeEntity(_0x4322a3,null))['catch'](handleError(_0x4322a3,null));};exports[_0x2383('0x53')]=function(_0x2d1601,_0x4e1bcc){return db[_0x2383('0x44')]['describe']()[_0x2383('0x26')](respondWithResult(_0x4e1bcc,null))[_0x2383('0x4a')](handleError(_0x4e1bcc,null));};exports[_0x2383('0x54')]=function(_0x414dea,_0x3967e1,_0x3ecd16){var _0x4297ab={'raw':!![],'where':{}},_0x1887ef={},_0x32429b;return db[_0x2383('0x44')][_0x2383('0x55')]({'where':{'id':_0x414dea[_0x2383('0x49')]['id']}})[_0x2383('0x26')](handleEntityNotFound(_0x3967e1,null))[_0x2383('0x26')](function(_0x434669){if(_0x434669){_0x32429b=_0x434669[_0x2383('0x28')]({'plain':!![]});_0x1887ef[_0x2383('0x32')]=_[_0x2383('0x34')](db[_0x2383('0x56')][_0x2383('0x30')]);_0x1887ef[_0x2383('0x33')]=_[_0x2383('0x34')](_0x414dea[_0x2383('0x33')]);_0x1887ef['filters']=_[_0x2383('0x36')](_0x1887ef[_0x2383('0x32')],_0x1887ef['query']);_0x4297ab['attributes']=_['intersection'](_0x1887ef[_0x2383('0x32')],qs[_0x2383('0x38')](_0x414dea['query'][_0x2383('0x38')]));_0x4297ab[_0x2383('0x37')]=_0x4297ab[_0x2383('0x37')]['length']?_0x4297ab[_0x2383('0x37')]:_0x1887ef[_0x2383('0x32')];if(!_0x414dea[_0x2383('0x33')][_0x2383('0x57')]('nolimit')){_0x4297ab['limit']=qs[_0x2383('0x3b')](_0x414dea[_0x2383('0x33')][_0x2383('0x3b')]);_0x4297ab[_0x2383('0x20')]=qs[_0x2383('0x20')](_0x414dea['query'][_0x2383('0x20')]);}_0x4297ab[_0x2383('0x3c')]=qs[_0x2383('0x3d')](_0x414dea[_0x2383('0x33')][_0x2383('0x3d')]);_0x4297ab[_0x2383('0x3e')]=qs['filters'](_['pick'](_0x414dea[_0x2383('0x33')],_0x1887ef[_0x2383('0x35')]));_0x4297ab['where'][_0x2383('0x58')]=_0x434669['id'];if(_0x414dea[_0x2383('0x33')][_0x2383('0x40')]){_0x4297ab[_0x2383('0x3e')]=_[_0x2383('0x41')](_0x4297ab[_0x2383('0x3e')],{'$or':_[_0x2383('0x2f')](_0x4297ab[_0x2383('0x37')],function(_0x58223a){var _0x4edd3b={};_0x4edd3b[_0x58223a]={'$like':'%'+_0x414dea[_0x2383('0x33')][_0x2383('0x40')]+'%'};return _0x4edd3b;})});}_0x4297ab=_['merge']({},_0x4297ab,_0x414dea[_0x2383('0x43')]);return db[_0x2383('0x56')][_0x2383('0x47')](_0x4297ab);}})[_0x2383('0x26')](function(_0x1ceecd){if(_0x1ceecd){return db[_0x2383('0x59')][_0x2383('0x5a')]({'where':{'id':_[_0x2383('0x2f')](_0x1ceecd,_0x2383('0x5b')),'role':_0x2383('0x5c')},'attributes':['id',_0x2383('0x2c'),_0x2383('0x5d'),_0x2383('0x5e'),_0x2383('0x5f')]});}})[_0x2383('0x26')](function(_0x2b4766){if(_0x2b4766){return{'count':_0x2b4766[_0x2383('0x1f')],'rows':_['map'](_0x2b4766[_0x2383('0x48')],function(_0x50559c){return{'membername':_0x50559c[_0x2383('0x2c')],'UserId':_0x50559c['id'],'queue_name':_0x32429b[_0x2383('0x2c')],'SmsQueueId':_0x32429b['id'],'interface':util[_0x2383('0x60')](_0x2383('0x61'),'SIP',_0x50559c[_0x2383('0x2c')]),'penalty':0x0,'paused':_0x50559c[_0x2383('0x5d')],'createdAt':_0x50559c[_0x2383('0x5f')],'updatedAt':_0x50559c[_0x2383('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2383('0x26')](respondWithFilteredResult(_0x3967e1,_0x4297ab))['catch'](handleError(_0x3967e1,null));};exports[_0x2383('0x62')]=function(_0x24c0a4,_0xd16e83,_0x411d4e){var _0x59ba8c={};var _0x1985f7={};var _0x1eb5c4;var _0x20ecb0;return db[_0x2383('0x44')]['findOne']({'where':{'id':_0x24c0a4[_0x2383('0x49')]['id']}})[_0x2383('0x26')](handleEntityNotFound(_0xd16e83,null))['then'](function(_0x8a76d4){if(_0x8a76d4){_0x1eb5c4=_0x8a76d4;_0x1985f7[_0x2383('0x32')]=_['keys'](db[_0x2383('0x63')]['rawAttributes']);_0x1985f7['query']=_[_0x2383('0x34')](_0x24c0a4[_0x2383('0x33')]);_0x1985f7['filters']=_[_0x2383('0x36')](_0x1985f7['model'],_0x1985f7[_0x2383('0x33')]);_0x59ba8c['attributes']=_[_0x2383('0x36')](_0x1985f7['model'],qs[_0x2383('0x38')](_0x24c0a4[_0x2383('0x33')][_0x2383('0x38')]));_0x59ba8c[_0x2383('0x37')]=_0x59ba8c[_0x2383('0x37')]['length']?_0x59ba8c[_0x2383('0x37')]:_0x1985f7[_0x2383('0x32')];_0x59ba8c['order']=qs['sort'](_0x24c0a4['query'][_0x2383('0x3d')]);_0x59ba8c[_0x2383('0x3e')]=qs[_0x2383('0x35')](_[_0x2383('0x3f')](_0x24c0a4[_0x2383('0x33')],_0x1985f7[_0x2383('0x35')]));if(_0x24c0a4[_0x2383('0x33')][_0x2383('0x40')]){_0x59ba8c[_0x2383('0x3e')]=_[_0x2383('0x41')](_0x59ba8c['where'],{'$or':_['map'](_0x59ba8c[_0x2383('0x37')],function(_0x5b0a29){var _0x22b480={};_0x22b480[_0x5b0a29]={'$like':'%'+_0x24c0a4[_0x2383('0x33')]['filter']+'%'};return _0x22b480;})});}_0x59ba8c=_['merge']({},_0x59ba8c,_0x24c0a4[_0x2383('0x43')]);return _0x1eb5c4[_0x2383('0x62')](_0x59ba8c);}})['then'](function(_0xd1e3d2){if(_0xd1e3d2){_0x20ecb0=_0xd1e3d2[_0x2383('0x39')];if(!_0x24c0a4[_0x2383('0x33')][_0x2383('0x57')]('nolimit')){_0x59ba8c['limit']=qs[_0x2383('0x3b')](_0x24c0a4[_0x2383('0x33')][_0x2383('0x3b')]);_0x59ba8c[_0x2383('0x20')]=qs[_0x2383('0x20')](_0x24c0a4[_0x2383('0x33')]['offset']);}return _0x1eb5c4[_0x2383('0x62')](_0x59ba8c);}})['then'](function(_0x17fcb3){if(_0x17fcb3){return _0x17fcb3?{'count':_0x20ecb0,'rows':_0x17fcb3}:null;}})['then'](respondWithResult(_0xd16e83,null))['catch'](handleError(_0xd16e83,null));};exports[_0x2383('0x64')]=function(_0x2f6337,_0x1fe70e,_0x3809e3){var _0x12c254=_0x2f6337[_0x2383('0x52')][_0x2383('0x65')];return db[_0x2383('0x63')][_0x2383('0x47')]({'where':{'id':_0x12c254},'attributes':['id'],'include':[{'model':db[_0x2383('0x59')],'as':_0x2383('0x66'),'attributes':['id',_0x2383('0x2c'),_0x2383('0x67'),_0x2383('0x68'),'interface'],'raw':!![]}]})[_0x2383('0x26')](function(_0x2e2951){if(_0x2e2951){var _0x24229a=_[_0x2383('0x69')](_0x2e2951,function(_0x4a1b97){var _0x17cd52=_0x4a1b97[_0x2383('0x28')]({'plain':!![]});return _0x17cd52[_0x2383('0x66')];});return db['SmsQueue'][_0x2383('0x4f')]({'where':{'id':_0x2f6337[_0x2383('0x49')]['id']}})[_0x2383('0x26')](function(_0x3843ed){return db['sequelize'][_0x2383('0x6a')](function(_0x4d09ec){return _0x3843ed[_0x2383('0x64')](_0x12c254,{'transaction':_0x4d09ec})['then'](function(){return BPromise[_0x2383('0x6b')](_0x24229a,function(_0x361040){return db[_0x2383('0x56')][_0x2383('0x6c')]({'where':{'UserId':_0x361040['id'],'SmsQueueId':_0x2f6337[_0x2383('0x49')]['id']},'transaction':_0x4d09ec});});})[_0x2383('0x26')](function(){_0x24229a[_0x2383('0x6d')](function(_0x1dcc72){socket[_0x2383('0x6e')](_0x2383('0x6f'),{'UserId':_0x1dcc72['id'],'SmsQueueId':_0x3843ed['id']});});});});});}})[_0x2383('0x26')](respondWithStatusCode(_0x1fe70e,null))[_0x2383('0x4a')](handleError(_0x1fe70e,null));};exports[_0x2383('0x70')]=function(_0x4efb28,_0x4261c9,_0x14488b){return db[_0x2383('0x63')]['findAll']({'where':{'id':_0x4efb28['query'][_0x2383('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4261c9,null))[_0x2383('0x26')](function(_0x3a8f90){var _0x1c4d81=_['map'](_0x3a8f90,'id');var _0xe98bd9=[];var _0x51c33b=[];var _0x4d44ba=squel[_0x2383('0x71')]();_0x4d44ba[_0x2383('0x72')](_0x2383('0x73'))[_0x2383('0x74')](_0x2383('0x75'),'tq')[_0x2383('0x76')](_0x2383('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x2383('0x78'),_0x4efb28[_0x2383('0x49')]['id']);for(var _0x28257b=0x0;_0x28257b<_0x3a8f90[_0x2383('0x39')];_0x28257b+=0x1){let _0x527df9=_0x3a8f90[_0x28257b];for(var _0x23356b=0x0;_0x23356b<_0x527df9[_0x2383('0x66')]['length'];_0x23356b+=0x1){let _0x4a7193=_0x527df9[_0x2383('0x66')][_0x23356b];var _0x46e5cb=_0x4d44ba[_0x2383('0x79')]();_0x46e5cb[_0x2383('0x3e')](_0x2383('0x7a'),_0x4a7193['id']);_0x51c33b[_0x2383('0x7b')](db[_0x2383('0x7c')][_0x2383('0x33')](_0x46e5cb[_0x2383('0x7d')](),{'type':db[_0x2383('0x7c')][_0x2383('0x7e')][_0x2383('0x7f')]})[_0x2383('0x26')](function(_0x3ad7df){if(_0x3ad7df['length']===0x1){return _0x4a7193['id'];}else{var _0xf2e5d6=_[_0x2383('0x80')](_[_0x2383('0x2f')](_0x3ad7df,_0x2383('0x81')),function(_0x5f3e81){return _['includes'](_0x1c4d81,_0x5f3e81);});if(_0xf2e5d6){return _0x4a7193['id'];}}}));}}return BPromise[_0x2383('0x82')](_0x51c33b)[_0x2383('0x26')](function(_0x59f99a){_0xe98bd9=_(_0xe98bd9)[_0x2383('0x83')](_0x59f99a)[_0x2383('0x84')]()[_0x2383('0x85')]();return db[_0x2383('0x44')]['find']({'where':{'id':_0x4efb28['params']['id']}})['then'](function(_0x3bd299){return db[_0x2383('0x7c')][_0x2383('0x6a')](function(_0xd6b541){return _0x3bd299['removeTeams'](_0x4efb28[_0x2383('0x33')][_0x2383('0x65')],{'transaction':_0xd6b541})[_0x2383('0x26')](function(){if(!_[_0x2383('0x86')](_0xe98bd9)){return _0x3bd299[_0x2383('0x87')](_0xe98bd9,{'transaction':_0xd6b541});}})[_0x2383('0x26')](function(){_0xe98bd9[_0x2383('0x6d')](function(_0x3b0b9a){socket[_0x2383('0x6e')](_0x2383('0x88'),{'UserId':_0x3b0b9a,'SmsQueueId':_0x3bd299['id']});});});});});});})[_0x2383('0x26')](respondWithStatusCode(_0x4261c9,null))[_0x2383('0x4a')](handleError(_0x4261c9,null));};exports[_0x2383('0x89')]=function(_0x59eb78,_0xb9262e,_0x425c77){return db[_0x2383('0x44')]['find']({'where':{'id':_0x59eb78[_0x2383('0x49')]['id']}})[_0x2383('0x26')](handleEntityNotFound(_0xb9262e,null))[_0x2383('0x26')](function(_0x506bd8){if(_0x506bd8){return _0x506bd8[_0x2383('0x89')](_0x59eb78[_0x2383('0x52')][_0x2383('0x65')],_['omit'](_0x59eb78[_0x2383('0x52')],[_0x2383('0x65'),'id'])||{})[_0x2383('0x8a')](function(_0x4aaae4){for(var _0x2c5551=0x0;_0x2c5551<_0x59eb78[_0x2383('0x52')][_0x2383('0x65')][_0x2383('0x39')];_0x2c5551+=0x1){socket['emit'](_0x2383('0x6f'),{'UserId':Number(_0x59eb78[_0x2383('0x52')]['ids'][_0x2c5551]),'SmsQueueId':Number(_0x59eb78[_0x2383('0x49')]['id'])});}return _0x4aaae4;});}})['then'](respondWithResult(_0xb9262e,null))['catch'](handleError(_0xb9262e,null));};exports[_0x2383('0x87')]=function(_0x46b9da,_0x22f747,_0x4a85da){return db['SmsQueue']['find']({'where':{'id':_0x46b9da[_0x2383('0x49')]['id']}})[_0x2383('0x26')](handleEntityNotFound(_0x22f747,null))[_0x2383('0x26')](function(_0x16a8b6){if(_0x16a8b6){return _0x16a8b6[_0x2383('0x87')](_0x46b9da[_0x2383('0x33')][_0x2383('0x65')])[_0x2383('0x26')](function(){if(_[_0x2383('0x8b')](_0x46b9da[_0x2383('0x33')][_0x2383('0x65')])){for(var _0x2a1160=0x0;_0x2a1160<_0x46b9da['query'][_0x2383('0x65')][_0x2383('0x39')];_0x2a1160+=0x1){socket[_0x2383('0x6e')](_0x2383('0x88'),{'UserId':Number(_0x46b9da[_0x2383('0x33')][_0x2383('0x65')][_0x2a1160]),'SmsQueueId':Number(_0x46b9da[_0x2383('0x49')]['id'])});}}else{socket[_0x2383('0x6e')](_0x2383('0x88'),{'UserId':Number(_0x46b9da[_0x2383('0x33')][_0x2383('0x65')]),'SmsQueueId':Number(_0x46b9da[_0x2383('0x49')]['id'])});}});}})[_0x2383('0x26')](respondWithStatusCode(_0x22f747,null))['catch'](handleError(_0x22f747,null));};exports[_0x2383('0x8c')]=function(_0x361d1f,_0x44e47c,_0x343ee3){var _0x290bd8={};var _0x3df993={};var _0x1ba604;var _0x5c1d2a;return db['SmsQueue'][_0x2383('0x55')]({'where':{'id':_0x361d1f[_0x2383('0x49')]['id']}})['then'](handleEntityNotFound(_0x44e47c,null))[_0x2383('0x26')](function(_0x41f9e3){if(_0x41f9e3){_0x1ba604=_0x41f9e3;_0x3df993[_0x2383('0x32')]=_[_0x2383('0x34')](db[_0x2383('0x59')][_0x2383('0x30')]);_0x3df993[_0x2383('0x33')]=_[_0x2383('0x34')](_0x361d1f[_0x2383('0x33')]);_0x3df993[_0x2383('0x35')]=_[_0x2383('0x36')](_0x3df993[_0x2383('0x32')],_0x3df993['query']);_0x290bd8[_0x2383('0x37')]=_[_0x2383('0x36')](_0x3df993[_0x2383('0x32')],qs[_0x2383('0x38')](_0x361d1f[_0x2383('0x33')][_0x2383('0x38')]));_0x290bd8['attributes']=_0x290bd8[_0x2383('0x37')][_0x2383('0x39')]?_0x290bd8[_0x2383('0x37')]:_0x3df993[_0x2383('0x32')];_0x290bd8[_0x2383('0x3c')]=qs[_0x2383('0x3d')](_0x361d1f['query'][_0x2383('0x3d')]);_0x290bd8[_0x2383('0x3e')]=qs['filters'](_['pick'](_0x361d1f[_0x2383('0x33')],_0x3df993['filters']));if(_0x361d1f['query'][_0x2383('0x40')]){_0x290bd8[_0x2383('0x3e')]=_[_0x2383('0x41')](_0x290bd8[_0x2383('0x3e')],{'$or':_[_0x2383('0x2f')](_0x290bd8['attributes'],function(_0x405816){var _0x131f79={};_0x131f79[_0x405816]={'$like':'%'+_0x361d1f[_0x2383('0x33')]['filter']+'%'};return _0x131f79;})});}_0x290bd8=_[_0x2383('0x41')]({},_0x290bd8,_0x361d1f['options']);return _0x1ba604['getAgents'](_0x290bd8);}})['then'](function(_0x576c65){if(_0x576c65){_0x5c1d2a=_0x576c65[_0x2383('0x39')];if(!_0x361d1f[_0x2383('0x33')][_0x2383('0x57')](_0x2383('0x3a'))){_0x290bd8[_0x2383('0x3b')]=qs['limit'](_0x361d1f[_0x2383('0x33')]['limit']);_0x290bd8[_0x2383('0x20')]=qs[_0x2383('0x20')](_0x361d1f[_0x2383('0x33')]['offset']);}return _0x1ba604[_0x2383('0x8c')](_0x290bd8);}})[_0x2383('0x26')](function(_0xf3417e){if(_0xf3417e){return _0xf3417e?{'count':_0x5c1d2a,'rows':_0xf3417e}:null;}})[_0x2383('0x26')](respondWithResult(_0x44e47c,null))['catch'](handleError(_0x44e47c,null));}; \ No newline at end of file +var _0xf094=['get','SmsQueues','sendStatus','error','stack','name','index','map','rawAttributes','type','key','model','keys','query','filters','attributes','fields','length','order','sort','pick','filter','where','merge','options','findAll','catch','show','SmsQueue','intersection','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','params','describe','getMembers','findOne','UserSmsQueue','hasOwnProperty','nolimit','UserId','agent','smsPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','addTeams','Team','User','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','ids','select','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','value','transaction','removeAgents','userSmsQueue:remove','addAgents','omit','spread','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','status','end','json','offset','undefined','limit','count','set','apply','update','destroy','then'];(function(_0x5ac4b6,_0x4d9360){var _0x29ced8=function(_0x4fdcb6){while(--_0x4fdcb6){_0x5ac4b6['push'](_0x5ac4b6['shift']());}};_0x29ced8(++_0x4d9360);}(_0xf094,0x1ee));var _0x4f09=function(_0x565c4e,_0x1e77f9){_0x565c4e=_0x565c4e-0x0;var _0x4a167f=_0xf094[_0x565c4e];return _0x4a167f;};'use strict';var emlformat=require(_0x4f09('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4f09('0x1'));var jsonpatch=require(_0x4f09('0x2'));var rp=require('request-promise');var moment=require(_0x4f09('0x3'));var BPromise=require(_0x4f09('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4f09('0x5'));var csv=require(_0x4f09('0x6'));var ejs=require(_0x4f09('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4f09('0x8'));var crypto=require(_0x4f09('0x9'));var jsforce=require(_0x4f09('0xa'));var deskjs=require(_0x4f09('0xb'));var toCsv=require(_0x4f09('0x6'));var querystring=require(_0x4f09('0xc'));var Papa=require(_0x4f09('0xd'));var Redis=require(_0x4f09('0xe'));var authService=require(_0x4f09('0xf'));var qs=require(_0x4f09('0x10'));var as=require(_0x4f09('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f09('0x12'))(_0x4f09('0x13'));var utils=require(_0x4f09('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f09('0x15'))['db'];config[_0x4f09('0x16')]=_[_0x4f09('0x17')](config['redis'],{'host':_0x4f09('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f09('0x16')]));require(_0x4f09('0x19'))['register'](socket);function respondWithStatusCode(_0x2d7abd,_0x5c57e5){_0x5c57e5=_0x5c57e5||0xcc;return function(_0x475334){if(_0x475334){return _0x2d7abd['sendStatus'](_0x5c57e5);}return _0x2d7abd[_0x4f09('0x1a')](_0x5c57e5)[_0x4f09('0x1b')]();};}function respondWithResult(_0x131b91,_0x105621){_0x105621=_0x105621||0xc8;return function(_0x2ddadf){if(_0x2ddadf){return _0x131b91[_0x4f09('0x1a')](_0x105621)[_0x4f09('0x1c')](_0x2ddadf);}};}function respondWithFilteredResult(_0x4b891c,_0x2dcc00){return function(_0x295609){if(_0x295609){var _0x5739ca=typeof _0x2dcc00[_0x4f09('0x1d')]===_0x4f09('0x1e')&&typeof _0x2dcc00[_0x4f09('0x1f')]===_0x4f09('0x1e');var _0x185437=_0x295609[_0x4f09('0x20')];var _0x31d36d=_0x5739ca?0x0:_0x2dcc00[_0x4f09('0x1d')];var _0x4bd9a5=_0x5739ca?_0x295609[_0x4f09('0x20')]:_0x2dcc00[_0x4f09('0x1d')]+_0x2dcc00[_0x4f09('0x1f')];var _0x60586e;if(_0x4bd9a5>=_0x185437){_0x4bd9a5=_0x185437;_0x60586e=0xc8;}else{_0x60586e=0xce;}_0x4b891c[_0x4f09('0x1a')](_0x60586e);return _0x4b891c[_0x4f09('0x21')]('Content-Range',_0x31d36d+'-'+_0x4bd9a5+'/'+_0x185437)['json'](_0x295609);}return null;};}function patchUpdates(_0xf30ee3){return function(_0x342f30){try{jsonpatch[_0x4f09('0x22')](_0x342f30,_0xf30ee3,!![]);}catch(_0x3b483f){return BPromise['reject'](_0x3b483f);}return _0x342f30['save']();};}function saveUpdates(_0x4967c6,_0x2b16ec){return function(_0x49be67){if(_0x49be67){return _0x49be67[_0x4f09('0x23')](_0x4967c6)['then'](function(_0x11026e){return _0x11026e;});}return null;};}function removeEntity(_0x2c8d05,_0x47d9a2){return function(_0x1c8726){if(_0x1c8726){return _0x1c8726[_0x4f09('0x24')]()[_0x4f09('0x25')](function(){var _0x15329e=_0x1c8726[_0x4f09('0x26')]({'plain':!![]});var _0x20153a=_0x4f09('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x20153a,'resourceId':_0x15329e['id']}})[_0x4f09('0x25')](function(){return _0x1c8726;});})['then'](function(){_0x2c8d05['status'](0xcc)[_0x4f09('0x1b')]();});}};}function handleEntityNotFound(_0xb193d3,_0x557c11){return function(_0x48e424){if(!_0x48e424){_0xb193d3[_0x4f09('0x28')](0x194);}return _0x48e424;};}function handleError(_0x175f4d,_0x14ffc1){_0x14ffc1=_0x14ffc1||0x1f4;return function(_0x515eb3){logger[_0x4f09('0x29')](_0x515eb3[_0x4f09('0x2a')]);if(_0x515eb3[_0x4f09('0x2b')]){delete _0x515eb3[_0x4f09('0x2b')];}_0x175f4d[_0x4f09('0x1a')](_0x14ffc1)['send'](_0x515eb3);};}exports[_0x4f09('0x2c')]=function(_0x36da47,_0x3db93e){var _0x2fe57c={},_0x3d004f={},_0x4acb26={'count':0x0,'rows':[]};var _0x49b704=_[_0x4f09('0x2d')](db['SmsQueue'][_0x4f09('0x2e')],function(_0x10e2b6){return{'name':_0x10e2b6['fieldName'],'type':_0x10e2b6[_0x4f09('0x2f')][_0x4f09('0x30')]};});_0x3d004f[_0x4f09('0x31')]=_[_0x4f09('0x2d')](_0x49b704,'name');_0x3d004f['query']=_[_0x4f09('0x32')](_0x36da47[_0x4f09('0x33')]);_0x3d004f[_0x4f09('0x34')]=_['intersection'](_0x3d004f[_0x4f09('0x31')],_0x3d004f[_0x4f09('0x33')]);_0x2fe57c[_0x4f09('0x35')]=_['intersection'](_0x3d004f[_0x4f09('0x31')],qs[_0x4f09('0x36')](_0x36da47[_0x4f09('0x33')][_0x4f09('0x36')]));_0x2fe57c[_0x4f09('0x35')]=_0x2fe57c['attributes'][_0x4f09('0x37')]?_0x2fe57c['attributes']:_0x3d004f[_0x4f09('0x31')];if(!_0x36da47['query']['hasOwnProperty']('nolimit')){_0x2fe57c[_0x4f09('0x1f')]=qs[_0x4f09('0x1f')](_0x36da47[_0x4f09('0x33')][_0x4f09('0x1f')]);_0x2fe57c['offset']=qs[_0x4f09('0x1d')](_0x36da47[_0x4f09('0x33')][_0x4f09('0x1d')]);}_0x2fe57c[_0x4f09('0x38')]=qs[_0x4f09('0x39')](_0x36da47['query'][_0x4f09('0x39')]);_0x2fe57c['where']=qs[_0x4f09('0x34')](_[_0x4f09('0x3a')](_0x36da47[_0x4f09('0x33')],_0x3d004f[_0x4f09('0x34')]),_0x49b704);if(_0x36da47[_0x4f09('0x33')][_0x4f09('0x3b')]){_0x2fe57c[_0x4f09('0x3c')]=_['merge'](_0x2fe57c[_0x4f09('0x3c')],{'$or':_[_0x4f09('0x2d')](_0x49b704,function(_0x521bb4){if(_0x521bb4[_0x4f09('0x2f')]!=='VIRTUAL'){var _0xd04751={};_0xd04751[_0x521bb4[_0x4f09('0x2b')]]={'$like':'%'+_0x36da47['query'][_0x4f09('0x3b')]+'%'};return _0xd04751;}})});}_0x2fe57c=_[_0x4f09('0x3d')]({},_0x2fe57c,_0x36da47[_0x4f09('0x3e')]);var _0x2a14da={'where':_0x2fe57c[_0x4f09('0x3c')]};return db['SmsQueue'][_0x4f09('0x20')](_0x2a14da)[_0x4f09('0x25')](function(_0x4477dc){_0x4acb26[_0x4f09('0x20')]=_0x4477dc;if(_0x36da47[_0x4f09('0x33')]['includeAll']){_0x2fe57c['include']=[{'all':!![]}];}return db['SmsQueue'][_0x4f09('0x3f')](_0x2fe57c);})[_0x4f09('0x25')](function(_0x3bc7ab){_0x4acb26['rows']=_0x3bc7ab;return _0x4acb26;})[_0x4f09('0x25')](respondWithFilteredResult(_0x3db93e,_0x2fe57c))[_0x4f09('0x40')](handleError(_0x3db93e,null));};exports[_0x4f09('0x41')]=function(_0x1eac0c,_0x1f5a51){var _0x435a1f={'raw':!![],'where':{'id':_0x1eac0c['params']['id']}},_0x4429c1={};_0x4429c1[_0x4f09('0x31')]=_[_0x4f09('0x32')](db[_0x4f09('0x42')]['rawAttributes']);_0x4429c1['query']=_['keys'](_0x1eac0c[_0x4f09('0x33')]);_0x4429c1[_0x4f09('0x34')]=_[_0x4f09('0x43')](_0x4429c1[_0x4f09('0x31')],_0x4429c1[_0x4f09('0x33')]);_0x435a1f[_0x4f09('0x35')]=_[_0x4f09('0x43')](_0x4429c1[_0x4f09('0x31')],qs[_0x4f09('0x36')](_0x1eac0c[_0x4f09('0x33')]['fields']));_0x435a1f[_0x4f09('0x35')]=_0x435a1f[_0x4f09('0x35')][_0x4f09('0x37')]?_0x435a1f['attributes']:_0x4429c1[_0x4f09('0x31')];if(_0x1eac0c[_0x4f09('0x33')]['includeAll']){_0x435a1f[_0x4f09('0x44')]=[{'all':!![]}];}_0x435a1f=_[_0x4f09('0x3d')]({},_0x435a1f,_0x1eac0c['options']);return db['SmsQueue']['find'](_0x435a1f)[_0x4f09('0x25')](handleEntityNotFound(_0x1f5a51,null))[_0x4f09('0x25')](respondWithResult(_0x1f5a51,null))['catch'](handleError(_0x1f5a51,null));};exports[_0x4f09('0x45')]=function(_0x28f55c,_0x210a3b){return db[_0x4f09('0x42')][_0x4f09('0x45')](_0x28f55c[_0x4f09('0x46')],{})[_0x4f09('0x25')](function(_0x42e43a){var _0x563c84=_0x28f55c[_0x4f09('0x47')][_0x4f09('0x26')]({'plain':!![]});if(!_0x563c84)throw new Error(_0x4f09('0x48'));if(_0x563c84[_0x4f09('0x49')]===_0x4f09('0x47')){var _0x363552=_0x42e43a[_0x4f09('0x26')]({'plain':!![]});var _0x32d472=_0x4f09('0x27');return db[_0x4f09('0x4a')]['find']({'where':{'name':_0x32d472,'userProfileId':_0x563c84['userProfileId']},'raw':!![]})[_0x4f09('0x25')](function(_0x50a3a8){if(_0x50a3a8&&_0x50a3a8['autoAssociation']===0x0){return db['UserProfileResource'][_0x4f09('0x45')]({'name':_0x363552['name'],'resourceId':_0x363552['id'],'type':_0x50a3a8[_0x4f09('0x2b')],'sectionId':_0x50a3a8['id']},{})[_0x4f09('0x25')](function(){return _0x42e43a;});}else{return _0x42e43a;}})[_0x4f09('0x40')](function(_0x54de37){logger[_0x4f09('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54de37);throw _0x54de37;});}return _0x42e43a;})[_0x4f09('0x25')](respondWithResult(_0x210a3b,0xc9))[_0x4f09('0x40')](handleError(_0x210a3b,null));};exports[_0x4f09('0x23')]=function(_0x292ec3,_0x57b3d8){if(_0x292ec3[_0x4f09('0x46')]['id']){delete _0x292ec3['body']['id'];}return db[_0x4f09('0x42')][_0x4f09('0x4b')]({'where':{'id':_0x292ec3[_0x4f09('0x4c')]['id']}})[_0x4f09('0x25')](handleEntityNotFound(_0x57b3d8,null))['then'](saveUpdates(_0x292ec3[_0x4f09('0x46')],null))[_0x4f09('0x25')](respondWithResult(_0x57b3d8,null))[_0x4f09('0x40')](handleError(_0x57b3d8,null));};exports[_0x4f09('0x24')]=function(_0x2d8d82,_0xdb8f97){return db[_0x4f09('0x42')][_0x4f09('0x4b')]({'where':{'id':_0x2d8d82['params']['id']}})[_0x4f09('0x25')](handleEntityNotFound(_0xdb8f97,null))[_0x4f09('0x25')](removeEntity(_0xdb8f97,null))[_0x4f09('0x40')](handleError(_0xdb8f97,null));};exports[_0x4f09('0x4d')]=function(_0x2e3e5a,_0x365159){return db[_0x4f09('0x42')][_0x4f09('0x4d')]()[_0x4f09('0x25')](respondWithResult(_0x365159,null))['catch'](handleError(_0x365159,null));};exports[_0x4f09('0x4e')]=function(_0x2ddb2b,_0x47f768,_0xab96cf){var _0x20ba0d={'raw':!![],'where':{}},_0x2db2ad={},_0xb7251f;return db[_0x4f09('0x42')][_0x4f09('0x4f')]({'where':{'id':_0x2ddb2b[_0x4f09('0x4c')]['id']}})[_0x4f09('0x25')](handleEntityNotFound(_0x47f768,null))[_0x4f09('0x25')](function(_0xcfc037){if(_0xcfc037){_0xb7251f=_0xcfc037['get']({'plain':!![]});_0x2db2ad[_0x4f09('0x31')]=_[_0x4f09('0x32')](db[_0x4f09('0x50')][_0x4f09('0x2e')]);_0x2db2ad[_0x4f09('0x33')]=_['keys'](_0x2ddb2b[_0x4f09('0x33')]);_0x2db2ad['filters']=_[_0x4f09('0x43')](_0x2db2ad[_0x4f09('0x31')],_0x2db2ad['query']);_0x20ba0d[_0x4f09('0x35')]=_['intersection'](_0x2db2ad[_0x4f09('0x31')],qs[_0x4f09('0x36')](_0x2ddb2b[_0x4f09('0x33')][_0x4f09('0x36')]));_0x20ba0d[_0x4f09('0x35')]=_0x20ba0d[_0x4f09('0x35')][_0x4f09('0x37')]?_0x20ba0d[_0x4f09('0x35')]:_0x2db2ad[_0x4f09('0x31')];if(!_0x2ddb2b[_0x4f09('0x33')][_0x4f09('0x51')](_0x4f09('0x52'))){_0x20ba0d[_0x4f09('0x1f')]=qs[_0x4f09('0x1f')](_0x2ddb2b['query']['limit']);_0x20ba0d[_0x4f09('0x1d')]=qs[_0x4f09('0x1d')](_0x2ddb2b[_0x4f09('0x33')]['offset']);}_0x20ba0d[_0x4f09('0x38')]=qs['sort'](_0x2ddb2b[_0x4f09('0x33')]['sort']);_0x20ba0d[_0x4f09('0x3c')]=qs[_0x4f09('0x34')](_['pick'](_0x2ddb2b[_0x4f09('0x33')],_0x2db2ad['filters']));_0x20ba0d['where']['SmsQueueId']=_0xcfc037['id'];if(_0x2ddb2b[_0x4f09('0x33')][_0x4f09('0x3b')]){_0x20ba0d['where']=_[_0x4f09('0x3d')](_0x20ba0d[_0x4f09('0x3c')],{'$or':_['map'](_0x20ba0d[_0x4f09('0x35')],function(_0x19654c){var _0x467cd5={};_0x467cd5[_0x19654c]={'$like':'%'+_0x2ddb2b[_0x4f09('0x33')]['filter']+'%'};return _0x467cd5;})});}_0x20ba0d=_['merge']({},_0x20ba0d,_0x2ddb2b['options']);return db[_0x4f09('0x50')][_0x4f09('0x3f')](_0x20ba0d);}})[_0x4f09('0x25')](function(_0x3d08b6){if(_0x3d08b6){return db['User']['findAndCountAll']({'where':{'id':_[_0x4f09('0x2d')](_0x3d08b6,_0x4f09('0x53')),'role':_0x4f09('0x54')},'attributes':['id',_0x4f09('0x2b'),_0x4f09('0x55'),_0x4f09('0x56'),_0x4f09('0x57')]});}})[_0x4f09('0x25')](function(_0x5771c4){if(_0x5771c4){return{'count':_0x5771c4['count'],'rows':_[_0x4f09('0x2d')](_0x5771c4[_0x4f09('0x58')],function(_0x5b2f56){return{'membername':_0x5b2f56['name'],'UserId':_0x5b2f56['id'],'queue_name':_0xb7251f[_0x4f09('0x2b')],'SmsQueueId':_0xb7251f['id'],'interface':util[_0x4f09('0x59')](_0x4f09('0x5a'),_0x4f09('0x5b'),_0x5b2f56['name']),'penalty':0x0,'paused':_0x5b2f56[_0x4f09('0x55')],'createdAt':_0x5b2f56[_0x4f09('0x57')],'updatedAt':_0x5b2f56['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x47f768,_0x20ba0d))[_0x4f09('0x40')](handleError(_0x47f768,null));};exports[_0x4f09('0x5c')]=function(_0x1d0aaf,_0x5c1165,_0x4116cd){var _0x555b3f={};var _0x13b1fb={};var _0x5582cf;var _0x1620ef;return db[_0x4f09('0x42')][_0x4f09('0x4f')]({'where':{'id':_0x1d0aaf[_0x4f09('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5c1165,null))[_0x4f09('0x25')](function(_0x29fefd){if(_0x29fefd){_0x5582cf=_0x29fefd;_0x13b1fb[_0x4f09('0x31')]=_[_0x4f09('0x32')](db['Team'][_0x4f09('0x2e')]);_0x13b1fb['query']=_[_0x4f09('0x32')](_0x1d0aaf[_0x4f09('0x33')]);_0x13b1fb['filters']=_[_0x4f09('0x43')](_0x13b1fb[_0x4f09('0x31')],_0x13b1fb[_0x4f09('0x33')]);_0x555b3f['attributes']=_[_0x4f09('0x43')](_0x13b1fb[_0x4f09('0x31')],qs[_0x4f09('0x36')](_0x1d0aaf[_0x4f09('0x33')][_0x4f09('0x36')]));_0x555b3f[_0x4f09('0x35')]=_0x555b3f[_0x4f09('0x35')]['length']?_0x555b3f[_0x4f09('0x35')]:_0x13b1fb[_0x4f09('0x31')];_0x555b3f['order']=qs['sort'](_0x1d0aaf['query']['sort']);_0x555b3f[_0x4f09('0x3c')]=qs[_0x4f09('0x34')](_['pick'](_0x1d0aaf[_0x4f09('0x33')],_0x13b1fb[_0x4f09('0x34')]));if(_0x1d0aaf[_0x4f09('0x33')][_0x4f09('0x3b')]){_0x555b3f['where']=_[_0x4f09('0x3d')](_0x555b3f['where'],{'$or':_[_0x4f09('0x2d')](_0x555b3f[_0x4f09('0x35')],function(_0x41708c){var _0x1b602e={};_0x1b602e[_0x41708c]={'$like':'%'+_0x1d0aaf[_0x4f09('0x33')][_0x4f09('0x3b')]+'%'};return _0x1b602e;})});}_0x555b3f=_[_0x4f09('0x3d')]({},_0x555b3f,_0x1d0aaf[_0x4f09('0x3e')]);return _0x5582cf[_0x4f09('0x5c')](_0x555b3f);}})[_0x4f09('0x25')](function(_0x9bd8fc){if(_0x9bd8fc){_0x1620ef=_0x9bd8fc['length'];if(!_0x1d0aaf['query']['hasOwnProperty'](_0x4f09('0x52'))){_0x555b3f[_0x4f09('0x1f')]=qs[_0x4f09('0x1f')](_0x1d0aaf['query'][_0x4f09('0x1f')]);_0x555b3f['offset']=qs[_0x4f09('0x1d')](_0x1d0aaf[_0x4f09('0x33')][_0x4f09('0x1d')]);}return _0x5582cf['getTeams'](_0x555b3f);}})['then'](function(_0x8eeb82){if(_0x8eeb82){return _0x8eeb82?{'count':_0x1620ef,'rows':_0x8eeb82}:null;}})[_0x4f09('0x25')](respondWithResult(_0x5c1165,null))['catch'](handleError(_0x5c1165,null));};exports[_0x4f09('0x5d')]=function(_0x384ca9,_0x3c0848,_0x4f4891){var _0x18f3ca=_0x384ca9[_0x4f09('0x46')]['ids'];return db[_0x4f09('0x5e')][_0x4f09('0x3f')]({'where':{'id':_0x18f3ca},'attributes':['id'],'include':[{'model':db[_0x4f09('0x5f')],'as':_0x4f09('0x60'),'attributes':['id','name',_0x4f09('0x61'),_0x4f09('0x62'),_0x4f09('0x63')],'raw':!![]}]})['then'](function(_0x34de57){if(_0x34de57){var _0x25b0bd=_[_0x4f09('0x64')](_0x34de57,function(_0x3002f6){var _0x4d29b8=_0x3002f6[_0x4f09('0x26')]({'plain':!![]});return _0x4d29b8[_0x4f09('0x60')];});return db[_0x4f09('0x42')]['find']({'where':{'id':_0x384ca9[_0x4f09('0x4c')]['id']}})[_0x4f09('0x25')](function(_0x5c5a7a){return db[_0x4f09('0x65')]['transaction'](function(_0x6782c2){return _0x5c5a7a[_0x4f09('0x5d')](_0x18f3ca,{'transaction':_0x6782c2})[_0x4f09('0x25')](function(){return BPromise[_0x4f09('0x66')](_0x25b0bd,function(_0x36c470){return db['UserSmsQueue'][_0x4f09('0x67')]({'where':{'UserId':_0x36c470['id'],'SmsQueueId':_0x384ca9[_0x4f09('0x4c')]['id']},'transaction':_0x6782c2});});})[_0x4f09('0x25')](function(){_0x25b0bd[_0x4f09('0x68')](function(_0x4db292){socket[_0x4f09('0x69')](_0x4f09('0x6a'),{'UserId':_0x4db292['id'],'SmsQueueId':_0x5c5a7a['id']});});});});});}})[_0x4f09('0x25')](respondWithStatusCode(_0x3c0848,null))[_0x4f09('0x40')](handleError(_0x3c0848,null));};exports[_0x4f09('0x6b')]=function(_0x14df5d,_0x4b29ac,_0x44a1c5){return db[_0x4f09('0x5e')]['findAll']({'where':{'id':_0x14df5d[_0x4f09('0x33')][_0x4f09('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x4f09('0x25')](handleEntityNotFound(_0x4b29ac,null))[_0x4f09('0x25')](function(_0x4a5a10){var _0x282331=_[_0x4f09('0x2d')](_0x4a5a10,'id');var _0x25a7d8=[];var _0x16ce8e=[];var _0x2441f5=squel[_0x4f09('0x6d')]();_0x2441f5['field'](_0x4f09('0x6e'))[_0x4f09('0x6f')]('team_has_sms_queues','tq')[_0x4f09('0x70')]('user_has_teams','ut',_0x4f09('0x71'))['where'](_0x4f09('0x72'),_0x14df5d[_0x4f09('0x4c')]['id']);for(var _0x48ee7b=0x0;_0x48ee7b<_0x4a5a10['length'];_0x48ee7b+=0x1){let _0x35098d=_0x4a5a10[_0x48ee7b];for(var _0x833275=0x0;_0x833275<_0x35098d['Agents'][_0x4f09('0x37')];_0x833275+=0x1){let _0x47fd29=_0x35098d[_0x4f09('0x60')][_0x833275];var _0x216ee4=_0x2441f5[_0x4f09('0x73')]();_0x216ee4[_0x4f09('0x3c')](_0x4f09('0x74'),_0x47fd29['id']);_0x16ce8e[_0x4f09('0x75')](db[_0x4f09('0x65')]['query'](_0x216ee4[_0x4f09('0x76')](),{'type':db['sequelize'][_0x4f09('0x77')][_0x4f09('0x78')]})['then'](function(_0x1b4ddb){if(_0x1b4ddb[_0x4f09('0x37')]===0x1){return _0x47fd29['id'];}else{var _0x14f0ff=_[_0x4f09('0x79')](_[_0x4f09('0x2d')](_0x1b4ddb,'TeamId'),function(_0xaec80f){return _[_0x4f09('0x7a')](_0x282331,_0xaec80f);});if(_0x14f0ff){return _0x47fd29['id'];}}}));}}return BPromise[_0x4f09('0x7b')](_0x16ce8e)[_0x4f09('0x25')](function(_0x1a833f){_0x25a7d8=_(_0x25a7d8)[_0x4f09('0x7c')](_0x1a833f)['compact']()[_0x4f09('0x7d')]();return db[_0x4f09('0x42')][_0x4f09('0x4b')]({'where':{'id':_0x14df5d[_0x4f09('0x4c')]['id']}})[_0x4f09('0x25')](function(_0x50411d){return db[_0x4f09('0x65')][_0x4f09('0x7e')](function(_0x15726b){return _0x50411d[_0x4f09('0x6b')](_0x14df5d[_0x4f09('0x33')][_0x4f09('0x6c')],{'transaction':_0x15726b})[_0x4f09('0x25')](function(){if(!_['isEmpty'](_0x25a7d8)){return _0x50411d[_0x4f09('0x7f')](_0x25a7d8,{'transaction':_0x15726b});}})[_0x4f09('0x25')](function(){_0x25a7d8[_0x4f09('0x68')](function(_0x51e760){socket[_0x4f09('0x69')](_0x4f09('0x80'),{'UserId':_0x51e760,'SmsQueueId':_0x50411d['id']});});});});});});})[_0x4f09('0x25')](respondWithStatusCode(_0x4b29ac,null))[_0x4f09('0x40')](handleError(_0x4b29ac,null));};exports['addAgents']=function(_0x2651d1,_0x218672,_0x249e5a){return db[_0x4f09('0x42')][_0x4f09('0x4b')]({'where':{'id':_0x2651d1['params']['id']}})['then'](handleEntityNotFound(_0x218672,null))[_0x4f09('0x25')](function(_0x1b5ea8){if(_0x1b5ea8){return _0x1b5ea8[_0x4f09('0x81')](_0x2651d1['body']['ids'],_[_0x4f09('0x82')](_0x2651d1[_0x4f09('0x46')],[_0x4f09('0x6c'),'id'])||{})[_0x4f09('0x83')](function(_0x29f73a){for(var _0x26f6c4=0x0;_0x26f6c4<_0x2651d1[_0x4f09('0x46')]['ids'][_0x4f09('0x37')];_0x26f6c4+=0x1){socket['emit'](_0x4f09('0x6a'),{'UserId':Number(_0x2651d1[_0x4f09('0x46')][_0x4f09('0x6c')][_0x26f6c4]),'SmsQueueId':Number(_0x2651d1[_0x4f09('0x4c')]['id'])});}return _0x29f73a;});}})[_0x4f09('0x25')](respondWithResult(_0x218672,null))[_0x4f09('0x40')](handleError(_0x218672,null));};exports[_0x4f09('0x7f')]=function(_0x91e0ba,_0x471917,_0x209c46){return db['SmsQueue'][_0x4f09('0x4b')]({'where':{'id':_0x91e0ba[_0x4f09('0x4c')]['id']}})[_0x4f09('0x25')](handleEntityNotFound(_0x471917,null))['then'](function(_0x516dae){if(_0x516dae){return _0x516dae[_0x4f09('0x7f')](_0x91e0ba[_0x4f09('0x33')]['ids'])[_0x4f09('0x25')](function(){if(_['isArray'](_0x91e0ba['query']['ids'])){for(var _0x874f17=0x0;_0x874f17<_0x91e0ba[_0x4f09('0x33')]['ids']['length'];_0x874f17+=0x1){socket[_0x4f09('0x69')]('userSmsQueue:remove',{'UserId':Number(_0x91e0ba['query']['ids'][_0x874f17]),'SmsQueueId':Number(_0x91e0ba['params']['id'])});}}else{socket[_0x4f09('0x69')](_0x4f09('0x80'),{'UserId':Number(_0x91e0ba[_0x4f09('0x33')]['ids']),'SmsQueueId':Number(_0x91e0ba['params']['id'])});}});}})['then'](respondWithStatusCode(_0x471917,null))[_0x4f09('0x40')](handleError(_0x471917,null));};exports[_0x4f09('0x84')]=function(_0x33b2c0,_0x30a274,_0x1f4e00){var _0x263977={};var _0x1432dc={};var _0x5ab8dd;var _0x40affe;return db['SmsQueue'][_0x4f09('0x4f')]({'where':{'id':_0x33b2c0[_0x4f09('0x4c')]['id']}})['then'](handleEntityNotFound(_0x30a274,null))[_0x4f09('0x25')](function(_0x2a918b){if(_0x2a918b){_0x5ab8dd=_0x2a918b;_0x1432dc[_0x4f09('0x31')]=_[_0x4f09('0x32')](db[_0x4f09('0x5f')][_0x4f09('0x2e')]);_0x1432dc[_0x4f09('0x33')]=_[_0x4f09('0x32')](_0x33b2c0[_0x4f09('0x33')]);_0x1432dc[_0x4f09('0x34')]=_[_0x4f09('0x43')](_0x1432dc[_0x4f09('0x31')],_0x1432dc['query']);_0x263977[_0x4f09('0x35')]=_[_0x4f09('0x43')](_0x1432dc[_0x4f09('0x31')],qs[_0x4f09('0x36')](_0x33b2c0[_0x4f09('0x33')][_0x4f09('0x36')]));_0x263977[_0x4f09('0x35')]=_0x263977[_0x4f09('0x35')][_0x4f09('0x37')]?_0x263977[_0x4f09('0x35')]:_0x1432dc[_0x4f09('0x31')];_0x263977[_0x4f09('0x38')]=qs[_0x4f09('0x39')](_0x33b2c0[_0x4f09('0x33')][_0x4f09('0x39')]);_0x263977[_0x4f09('0x3c')]=qs[_0x4f09('0x34')](_[_0x4f09('0x3a')](_0x33b2c0[_0x4f09('0x33')],_0x1432dc['filters']));if(_0x33b2c0[_0x4f09('0x33')]['filter']){_0x263977[_0x4f09('0x3c')]=_[_0x4f09('0x3d')](_0x263977[_0x4f09('0x3c')],{'$or':_[_0x4f09('0x2d')](_0x263977[_0x4f09('0x35')],function(_0x3fc9a5){var _0xe675c2={};_0xe675c2[_0x3fc9a5]={'$like':'%'+_0x33b2c0[_0x4f09('0x33')][_0x4f09('0x3b')]+'%'};return _0xe675c2;})});}_0x263977=_[_0x4f09('0x3d')]({},_0x263977,_0x33b2c0[_0x4f09('0x3e')]);return _0x5ab8dd['getAgents'](_0x263977);}})[_0x4f09('0x25')](function(_0xf0a853){if(_0xf0a853){_0x40affe=_0xf0a853['length'];if(!_0x33b2c0[_0x4f09('0x33')][_0x4f09('0x51')](_0x4f09('0x52'))){_0x263977[_0x4f09('0x1f')]=qs['limit'](_0x33b2c0[_0x4f09('0x33')][_0x4f09('0x1f')]);_0x263977[_0x4f09('0x1d')]=qs[_0x4f09('0x1d')](_0x33b2c0[_0x4f09('0x33')][_0x4f09('0x1d')]);}return _0x5ab8dd[_0x4f09('0x84')](_0x263977);}})[_0x4f09('0x25')](function(_0xac922c){if(_0xac922c){return _0xac922c?{'count':_0x40affe,'rows':_0xac922c}:null;}})[_0x4f09('0x25')](respondWithResult(_0x30a274,null))[_0x4f09('0x40')](handleError(_0x30a274,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 9f4b66e..a2224e3 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 _0x989d=['emit','hasOwnProperty','hook','SmsQueue','setMaxListeners','save','update'];(function(_0x578cb5,_0x5c2d43){var _0x440ffd=function(_0x316960){while(--_0x316960){_0x578cb5['push'](_0x578cb5['shift']());}};_0x440ffd(++_0x5c2d43);}(_0x989d,0x122));var _0xd989=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x989d[_0x2070da];return _0x4f9fe1;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0xd989('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xd989('0x1')](0x0);var events={'afterCreate':_0xd989('0x2'),'afterUpdate':_0xd989('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4de202){return function(_0x27ea93,_0xbc1d5c,_0x4d59b7){SmsQueueEvents[_0xd989('0x4')](_0x4de202+':'+_0x27ea93['id'],_0x27ea93);SmsQueueEvents[_0xd989('0x4')](_0x4de202,_0x27ea93);_0x4d59b7(null);};}for(var e in events){if(events[_0xd989('0x5')](e)){var event=events[e];SmsQueue[_0xd989('0x6')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x6e5a=['../../mysqldb','SmsQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x306898,_0x19b59b){var _0x299817=function(_0x3c5669){while(--_0x3c5669){_0x306898['push'](_0x306898['shift']());}};_0x299817(++_0x19b59b);}(_0x6e5a,0x13a));var _0xa6e5=function(_0x21ac6d,_0x5757dc){_0x21ac6d=_0x21ac6d-0x0;var _0x2ae901=_0x6e5a[_0x21ac6d];return _0x2ae901;};'use strict';var EventEmitter=require(_0xa6e5('0x0'));var SmsQueue=require(_0xa6e5('0x1'))['db'][_0xa6e5('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa6e5('0x3'),'afterUpdate':_0xa6e5('0x4'),'afterDestroy':_0xa6e5('0x5')};function emitEvent(_0x2b9f01){return function(_0x28a2d3,_0x5e8d5b,_0x1b173f){SmsQueueEvents[_0xa6e5('0x6')](_0x2b9f01+':'+_0x28a2d3['id'],_0x28a2d3);SmsQueueEvents[_0xa6e5('0x6')](_0x2b9f01,_0x28a2d3);_0x1b173f(null);};}for(var e in events){if(events[_0xa6e5('0x7')](e)){var event=events[e];SmsQueue[_0xa6e5('0x8')](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 7f11ee6..8b7ea5a 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 _0x3a81=['sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsQueue'];(function(_0x4abe25,_0x3d2379){var _0x472ebf=function(_0x592f0d){while(--_0x592f0d){_0x4abe25['push'](_0x4abe25['shift']());}};_0x472ebf(++_0x3d2379);}(_0x3a81,0x1c8));var _0x13a8=function(_0x59a294,_0x17dde5){_0x59a294=_0x59a294-0x0;var _0x175f9b=_0x3a81[_0x59a294];return _0x175f9b;};'use strict';var _=require(_0x13a8('0x0'));var util=require(_0x13a8('0x1'));var logger=require(_0x13a8('0x2'))('api');var moment=require(_0x13a8('0x3'));var BPromise=require(_0x13a8('0x4'));var rp=require(_0x13a8('0x5'));var fs=require('fs');var path=require(_0x13a8('0x6'));var rimraf=require(_0x13a8('0x7'));var config=require(_0x13a8('0x8'));var attributes=require('./smsQueue.attributes');module[_0x13a8('0x9')]=function(_0x1e2866,_0x224e85){return _0x1e2866[_0x13a8('0xa')](_0x13a8('0xb'),attributes,{'tableName':_0x13a8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ce6=['rimraf','../../config/environment','./smsQueue.attributes','define','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x5b878b,_0x5e5a75){var _0x18ac65=function(_0x2b870c){while(--_0x2b870c){_0x5b878b['push'](_0x5b878b['shift']());}};_0x18ac65(++_0x5e5a75);}(_0x1ce6,0x65));var _0x61ce=function(_0x5bd909,_0x543760){_0x5bd909=_0x5bd909-0x0;var _0x27d6ba=_0x1ce6[_0x5bd909];return _0x27d6ba;};'use strict';var _=require(_0x61ce('0x0'));var util=require(_0x61ce('0x1'));var logger=require(_0x61ce('0x2'))(_0x61ce('0x3'));var moment=require(_0x61ce('0x4'));var BPromise=require(_0x61ce('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x61ce('0x6'));var rimraf=require(_0x61ce('0x7'));var config=require(_0x61ce('0x8'));var attributes=require(_0x61ce('0x9'));module['exports']=function(_0x38f72d,_0x2de674){return _0x38f72d[_0x61ce('0xa')]('SmsQueue',attributes,{'tableName':_0x61ce('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 989a880..839a2ac 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 _0x9fda=['SmsQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowSmsQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsQueue.socket','register','then','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','SmsQueue,\x20%s,\x20%s','message','result','catch','GetSmsQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9fda,0xab));var _0xa9fd=function(_0x1568f8,_0xac30fe){_0x1568f8=_0x1568f8-0x0;var _0x40836e=_0x9fda[_0x1568f8];return _0x40836e;};'use strict';var _=require('lodash');var util=require(_0xa9fd('0x0'));var moment=require(_0xa9fd('0x1'));var BPromise=require(_0xa9fd('0x2'));var rs=require(_0xa9fd('0x3'));var fs=require('fs');var Redis=require(_0xa9fd('0x4'));var db=require(_0xa9fd('0x5'))['db'];var utils=require(_0xa9fd('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa9fd('0x7'));var jayson=require(_0xa9fd('0x8'));var client=jayson[_0xa9fd('0x9')][_0xa9fd('0xa')]({'port':0x232a});config[_0xa9fd('0xb')]=_[_0xa9fd('0xc')](config['redis'],{'host':_0xa9fd('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa9fd('0xb')]));require(_0xa9fd('0xe'))[_0xa9fd('0xf')](socket);function respondWithRpcPromise(_0x12ae3b,_0x15ceb5,_0x15aa44){return new BPromise(function(_0xf1b04c,_0x2a73f7){return client['request'](_0x12ae3b,_0x15aa44)[_0xa9fd('0x10')](function(_0xe294a){logger[_0xa9fd('0x11')]('SmsQueue,\x20%s,\x20%s',_0x15ceb5,'request\x20sent');logger[_0xa9fd('0x12')](_0xa9fd('0x13'),_0x15ceb5,_0xa9fd('0x14'),JSON[_0xa9fd('0x15')](_0xe294a));if(_0xe294a['error']){if(_0xe294a['error'][_0xa9fd('0x16')]===0x1f4){logger[_0xa9fd('0x17')](_0xa9fd('0x18'),_0x15ceb5,_0xe294a[_0xa9fd('0x17')][_0xa9fd('0x19')]);return _0x2a73f7(_0xe294a[_0xa9fd('0x17')]['message']);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x15ceb5,_0xe294a[_0xa9fd('0x17')][_0xa9fd('0x19')]);return _0xf1b04c(_0xe294a[_0xa9fd('0x17')][_0xa9fd('0x19')]);}else{logger[_0xa9fd('0x11')](_0xa9fd('0x18'),_0x15ceb5,_0xa9fd('0x14'));_0xf1b04c(_0xe294a[_0xa9fd('0x1a')][_0xa9fd('0x19')]);}})[_0xa9fd('0x1b')](function(_0x264f90){logger[_0xa9fd('0x17')](_0xa9fd('0x18'),_0x15ceb5,_0x264f90);_0x2a73f7(_0x264f90);});});}exports[_0xa9fd('0x1c')]=function(_0x3fdcb6){var _0x2b403b=this;return new Promise(function(_0x462f03,_0x2f0e5c){return db[_0xa9fd('0x1d')][_0xa9fd('0x1e')]({'raw':_0x3fdcb6[_0xa9fd('0x1f')]?_0x3fdcb6[_0xa9fd('0x1f')][_0xa9fd('0x20')]===undefined?!![]:![]:!![],'where':_0x3fdcb6[_0xa9fd('0x1f')]?_0x3fdcb6[_0xa9fd('0x1f')][_0xa9fd('0x21')]||null:null,'attributes':_0x3fdcb6[_0xa9fd('0x1f')]?_0x3fdcb6['options'][_0xa9fd('0x22')]||null:null,'limit':_0x3fdcb6[_0xa9fd('0x1f')]?_0x3fdcb6[_0xa9fd('0x1f')][_0xa9fd('0x23')]||null:null,'include':_0x3fdcb6['options']?_0x3fdcb6['options'][_0xa9fd('0x24')]?_['map'](_0x3fdcb6[_0xa9fd('0x1f')][_0xa9fd('0x24')],function(_0x451eb3){return{'model':db[_0x451eb3[_0xa9fd('0x25')]],'as':_0x451eb3['as'],'attributes':_0x451eb3['attributes'],'include':_0x451eb3[_0xa9fd('0x24')]?_[_0xa9fd('0x26')](_0x451eb3[_0xa9fd('0x24')],function(_0x4d34a9){return{'model':db[_0x4d34a9[_0xa9fd('0x25')]],'as':_0x4d34a9['as'],'attributes':_0x4d34a9[_0xa9fd('0x22')],'include':_0x4d34a9[_0xa9fd('0x24')]?_[_0xa9fd('0x26')](_0x4d34a9[_0xa9fd('0x24')],function(_0x20009a){return{'model':db[_0x20009a[_0xa9fd('0x25')]],'as':_0x20009a['as'],'attributes':_0x20009a['attributes']};}):[]};}):[]};}):[]:[]})[_0xa9fd('0x10')](function(_0x92ae23){logger[_0xa9fd('0x11')](_0xa9fd('0x1c'),_0x3fdcb6);logger[_0xa9fd('0x12')](_0xa9fd('0x1c'),_0x3fdcb6,JSON[_0xa9fd('0x15')](_0x92ae23));_0x462f03(_0x92ae23);})[_0xa9fd('0x1b')](function(_0x1a80f5){logger[_0xa9fd('0x17')](_0xa9fd('0x1c'),_0x1a80f5[_0xa9fd('0x19')],_0x3fdcb6);_0x2f0e5c(_0x2b403b[_0xa9fd('0x17')](0x1f4,_0x1a80f5[_0xa9fd('0x19')]));});});};exports[_0xa9fd('0x27')]=function(_0x4d555f){var _0x389410=this;return new Promise(function(_0x283724,_0x3d01f3){return db[_0xa9fd('0x1d')]['find']({'raw':_0x4d555f[_0xa9fd('0x1f')]?_0x4d555f[_0xa9fd('0x1f')][_0xa9fd('0x20')]===undefined?!![]:![]:!![],'where':_0x4d555f[_0xa9fd('0x1f')]?_0x4d555f[_0xa9fd('0x1f')][_0xa9fd('0x21')]||null:null,'attributes':_0x4d555f[_0xa9fd('0x1f')]?_0x4d555f[_0xa9fd('0x1f')][_0xa9fd('0x22')]||null:null,'include':_0x4d555f[_0xa9fd('0x1f')]?_0x4d555f[_0xa9fd('0x1f')][_0xa9fd('0x24')]?_[_0xa9fd('0x26')](_0x4d555f['options'][_0xa9fd('0x24')],function(_0x3287c0){return{'model':db[_0x3287c0[_0xa9fd('0x25')]],'as':_0x3287c0['as'],'attributes':_0x3287c0[_0xa9fd('0x22')],'include':_0x3287c0[_0xa9fd('0x24')]?_[_0xa9fd('0x26')](_0x3287c0[_0xa9fd('0x24')],function(_0x179218){return{'model':db[_0x179218[_0xa9fd('0x25')]],'as':_0x179218['as'],'attributes':_0x179218[_0xa9fd('0x22')],'include':_0x179218['include']?_['map'](_0x179218[_0xa9fd('0x24')],function(_0xf0c3b5){return{'model':db[_0xf0c3b5['model']],'as':_0xf0c3b5['as'],'attributes':_0xf0c3b5[_0xa9fd('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa9fd('0x10')](function(_0x5f095b){logger[_0xa9fd('0x11')](_0xa9fd('0x27'),_0x4d555f);logger['debug'](_0xa9fd('0x27'),_0x4d555f,JSON['stringify'](_0x5f095b));_0x283724(_0x5f095b);})['catch'](function(_0x2392ab){logger['error'](_0xa9fd('0x27'),_0x2392ab[_0xa9fd('0x19')],_0x4d555f);_0x3d01f3(_0x389410[_0xa9fd('0x17')](0x1f4,_0x2392ab[_0xa9fd('0x19')]));});});}; \ No newline at end of file +var _0x0df3=['../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','then','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','SmsQueue,\x20%s,\x20%s','message','info','result','catch','GetSmsQueue','findAll','options','raw','attributes','limit','include','model','map','debug','stringify','ShowSmsQueue','SmsQueue','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x0df3,0x98));var _0x30df=function(_0x440917,_0x20ea7b){_0x440917=_0x440917-0x0;var _0x5e906b=_0x0df3[_0x440917];return _0x5e906b;};'use strict';var _=require(_0x30df('0x0'));var util=require('util');var moment=require(_0x30df('0x1'));var BPromise=require('bluebird');var rs=require(_0x30df('0x2'));var fs=require('fs');var Redis=require(_0x30df('0x3'));var db=require(_0x30df('0x4'))['db'];var utils=require(_0x30df('0x5'));var logger=require(_0x30df('0x6'))(_0x30df('0x7'));var config=require(_0x30df('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x30df('0x9')][_0x30df('0xa')]({'port':0x232a});config[_0x30df('0xb')]=_[_0x30df('0xc')](config['redis'],{'host':_0x30df('0xd'),'port':0x18eb});var socket=require(_0x30df('0xe'))(new Redis(config[_0x30df('0xb')]));require(_0x30df('0xf'))[_0x30df('0x10')](socket);function respondWithRpcPromise(_0x56cdfd,_0x19c670,_0x543003){return new BPromise(function(_0x5530a5,_0x5c7158){return client['request'](_0x56cdfd,_0x543003)[_0x30df('0x11')](function(_0x3cf8fa){logger['info']('SmsQueue,\x20%s,\x20%s',_0x19c670,_0x30df('0x12'));logger['debug'](_0x30df('0x13'),_0x19c670,_0x30df('0x12'),JSON['stringify'](_0x3cf8fa));if(_0x3cf8fa[_0x30df('0x14')]){if(_0x3cf8fa[_0x30df('0x14')][_0x30df('0x15')]===0x1f4){logger['error'](_0x30df('0x16'),_0x19c670,_0x3cf8fa['error'][_0x30df('0x17')]);return _0x5c7158(_0x3cf8fa['error'][_0x30df('0x17')]);}logger['error'](_0x30df('0x16'),_0x19c670,_0x3cf8fa[_0x30df('0x14')]['message']);return _0x5530a5(_0x3cf8fa[_0x30df('0x14')][_0x30df('0x17')]);}else{logger[_0x30df('0x18')]('SmsQueue,\x20%s,\x20%s',_0x19c670,_0x30df('0x12'));_0x5530a5(_0x3cf8fa[_0x30df('0x19')][_0x30df('0x17')]);}})[_0x30df('0x1a')](function(_0x307aa6){logger['error'](_0x30df('0x16'),_0x19c670,_0x307aa6);_0x5c7158(_0x307aa6);});});}exports[_0x30df('0x1b')]=function(_0x44be1f){var _0x132f47=this;return new Promise(function(_0xe59bea,_0x17dc77){return db['SmsQueue'][_0x30df('0x1c')]({'raw':_0x44be1f[_0x30df('0x1d')]?_0x44be1f[_0x30df('0x1d')][_0x30df('0x1e')]===undefined?!![]:![]:!![],'where':_0x44be1f['options']?_0x44be1f[_0x30df('0x1d')]['where']||null:null,'attributes':_0x44be1f['options']?_0x44be1f[_0x30df('0x1d')][_0x30df('0x1f')]||null:null,'limit':_0x44be1f[_0x30df('0x1d')]?_0x44be1f[_0x30df('0x1d')][_0x30df('0x20')]||null:null,'include':_0x44be1f['options']?_0x44be1f[_0x30df('0x1d')][_0x30df('0x21')]?_['map'](_0x44be1f['options'][_0x30df('0x21')],function(_0x5db860){return{'model':db[_0x5db860['model']],'as':_0x5db860['as'],'attributes':_0x5db860[_0x30df('0x1f')],'include':_0x5db860['include']?_['map'](_0x5db860['include'],function(_0x15f907){return{'model':db[_0x15f907[_0x30df('0x22')]],'as':_0x15f907['as'],'attributes':_0x15f907[_0x30df('0x1f')],'include':_0x15f907[_0x30df('0x21')]?_[_0x30df('0x23')](_0x15f907[_0x30df('0x21')],function(_0x35f800){return{'model':db[_0x35f800[_0x30df('0x22')]],'as':_0x35f800['as'],'attributes':_0x35f800[_0x30df('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1950d6){logger['info'](_0x30df('0x1b'),_0x44be1f);logger[_0x30df('0x24')](_0x30df('0x1b'),_0x44be1f,JSON[_0x30df('0x25')](_0x1950d6));_0xe59bea(_0x1950d6);})[_0x30df('0x1a')](function(_0x6ae2c2){logger[_0x30df('0x14')](_0x30df('0x1b'),_0x6ae2c2[_0x30df('0x17')],_0x44be1f);_0x17dc77(_0x132f47[_0x30df('0x14')](0x1f4,_0x6ae2c2['message']));});});};exports[_0x30df('0x26')]=function(_0x5d4375){var _0x2a2cac=this;return new Promise(function(_0x24bbd3,_0x39b1a8){return db[_0x30df('0x27')]['find']({'raw':_0x5d4375[_0x30df('0x1d')]?_0x5d4375['options']['raw']===undefined?!![]:![]:!![],'where':_0x5d4375['options']?_0x5d4375[_0x30df('0x1d')]['where']||null:null,'attributes':_0x5d4375[_0x30df('0x1d')]?_0x5d4375[_0x30df('0x1d')]['attributes']||null:null,'include':_0x5d4375[_0x30df('0x1d')]?_0x5d4375['options'][_0x30df('0x21')]?_['map'](_0x5d4375[_0x30df('0x1d')][_0x30df('0x21')],function(_0x4f9088){return{'model':db[_0x4f9088[_0x30df('0x22')]],'as':_0x4f9088['as'],'attributes':_0x4f9088[_0x30df('0x1f')],'include':_0x4f9088[_0x30df('0x21')]?_[_0x30df('0x23')](_0x4f9088['include'],function(_0x141de1){return{'model':db[_0x141de1[_0x30df('0x22')]],'as':_0x141de1['as'],'attributes':_0x141de1['attributes'],'include':_0x141de1[_0x30df('0x21')]?_['map'](_0x141de1[_0x30df('0x21')],function(_0x73ec71){return{'model':db[_0x73ec71[_0x30df('0x22')]],'as':_0x73ec71['as'],'attributes':_0x73ec71[_0x30df('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x30df('0x11')](function(_0x297f6f){logger[_0x30df('0x18')](_0x30df('0x26'),_0x5d4375);logger[_0x30df('0x24')](_0x30df('0x26'),_0x5d4375,JSON[_0x30df('0x25')](_0x297f6f));_0x24bbd3(_0x297f6f);})[_0x30df('0x1a')](function(_0x474c22){logger['error']('ShowSmsQueue',_0x474c22[_0x30df('0x17')],_0x5d4375);_0x39b1a8(_0x2a2cac['error'](0x1f4,_0x474c22[_0x30df('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index e57ae3c..eb3affc 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 _0x1b6c=['remove','emit','register','length','smsQueue:'];(function(_0x2feaa8,_0x257fef){var _0xb2144a=function(_0x419749){while(--_0x419749){_0x2feaa8['push'](_0x2feaa8['shift']());}};_0xb2144a(++_0x257fef);}(_0x1b6c,0x13b));var _0xc1b6=function(_0x2150d9,_0x23c4aa){_0x2150d9=_0x2150d9-0x0;var _0x54fa94=_0x1b6c[_0x2150d9];return _0x54fa94;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save',_0xc1b6('0x0'),'update'];function createListener(_0x181587,_0x2a2bd2){return function(_0x98b7a2){_0x2a2bd2[_0xc1b6('0x1')](_0x181587,_0x98b7a2);};}function removeListener(_0xd017b6,_0x3d75be){return function(){SmsQueueEvents['removeListener'](_0xd017b6,_0x3d75be);};}exports[_0xc1b6('0x2')]=function(_0x8d2e0f){for(var _0x3a147f=0x0,_0x6684c9=events[_0xc1b6('0x3')];_0x3a147f<_0x6684c9;_0x3a147f++){var _0x595d75=events[_0x3a147f];var _0x45879d=createListener(_0xc1b6('0x4')+_0x595d75,_0x8d2e0f);SmsQueueEvents['on'](_0x595d75,_0x45879d);}}; \ No newline at end of file +var _0xec51=['remove','update','emit','removeListener','register','smsQueue:','./smsQueue.events','save'];(function(_0x1fc915,_0x4e8623){var _0x2c6ebd=function(_0x1a36ae){while(--_0x1a36ae){_0x1fc915['push'](_0x1fc915['shift']());}};_0x2c6ebd(++_0x4e8623);}(_0xec51,0xc6));var _0x1ec5=function(_0x418330,_0x4c8c2d){_0x418330=_0x418330-0x0;var _0x503c9a=_0xec51[_0x418330];return _0x503c9a;};'use strict';var SmsQueueEvents=require(_0x1ec5('0x0'));var events=[_0x1ec5('0x1'),_0x1ec5('0x2'),_0x1ec5('0x3')];function createListener(_0x38fa4d,_0x41eb6a){return function(_0x24624d){_0x41eb6a[_0x1ec5('0x4')](_0x38fa4d,_0x24624d);};}function removeListener(_0x5d50c3,_0xed50e6){return function(){SmsQueueEvents[_0x1ec5('0x5')](_0x5d50c3,_0xed50e6);};}exports[_0x1ec5('0x6')]=function(_0x2535c3){for(var _0x3f4aef=0x0,_0x295500=events['length'];_0x3f4aef<_0x295500;_0x3f4aef++){var _0xcdd486=events[_0x3f4aef];var _0x404205=createListener(_0x1ec5('0x7')+_0xcdd486,_0x2535c3);SmsQueueEvents['on'](_0xcdd486,_0x404205);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 0ce48cc..f8e4334 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 _0xd965=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','delete','exports','multer','util','path','express'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xd965,0x128));var _0x5d96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd965[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5d96('0x0'));var util=require(_0x5d96('0x1'));var path=require(_0x5d96('0x2'));var timeout=require('connect-timeout');var express=require(_0x5d96('0x3'));var router=express[_0x5d96('0x4')]();var fs_extra=require(_0x5d96('0x5'));var auth=require(_0x5d96('0x6'));var interaction=require(_0x5d96('0x7'));var config=require(_0x5d96('0x8'));var controller=require(_0x5d96('0x9'));router[_0x5d96('0xa')]('/',auth[_0x5d96('0xb')](),controller[_0x5d96('0xc')]);router[_0x5d96('0xa')](_0x5d96('0xd'),auth['isAuthenticated'](),controller[_0x5d96('0xe')]);router[_0x5d96('0xa')](_0x5d96('0xf'),auth[_0x5d96('0xb')](),controller['show']);router[_0x5d96('0x10')]('/',auth[_0x5d96('0xb')](),controller['create']);router[_0x5d96('0x11')](_0x5d96('0xf'),auth[_0x5d96('0xb')](),controller['update']);router[_0x5d96('0x12')](_0x5d96('0xf'),auth[_0x5d96('0xb')](),controller['destroy']);module[_0x5d96('0x13')]=router; \ No newline at end of file +var _0x55fd=['./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x3cc092,_0x370778){var _0x58be9e=function(_0x5de5f7){while(--_0x5de5f7){_0x3cc092['push'](_0x3cc092['shift']());}};_0x58be9e(++_0x370778);}(_0x55fd,0xbf));var _0xd55f=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x55fd[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require(_0xd55f('0x0'));var util=require(_0xd55f('0x1'));var path=require(_0xd55f('0x2'));var timeout=require(_0xd55f('0x3'));var express=require('express');var router=express[_0xd55f('0x4')]();var fs_extra=require(_0xd55f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd55f('0x6'));var config=require('../../config/environment');var controller=require(_0xd55f('0x7'));router[_0xd55f('0x8')]('/',auth[_0xd55f('0x9')](),controller[_0xd55f('0xa')]);router[_0xd55f('0x8')]('/describe',auth[_0xd55f('0x9')](),controller[_0xd55f('0xb')]);router[_0xd55f('0x8')](_0xd55f('0xc'),auth[_0xd55f('0x9')](),controller['show']);router[_0xd55f('0xd')]('/',auth[_0xd55f('0x9')](),controller['create']);router[_0xd55f('0xe')](_0xd55f('0xc'),auth[_0xd55f('0x9')](),controller[_0xd55f('0xf')]);router['delete'](_0xd55f('0xc'),auth[_0xd55f('0x9')](),controller[_0xd55f('0x10')]);module[_0xd55f('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index a0273a5..0727687 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 _0x78f4=['DATE','exports','STRING'];(function(_0x2a332d,_0x3d5865){var _0x5d24c4=function(_0x255e6c){while(--_0x255e6c){_0x2a332d['push'](_0x2a332d['shift']());}};_0x5d24c4(++_0x3d5865);}(_0x78f4,0x193));var _0x478f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78f4[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x478f('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x478f('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x478f('0x2')]},'acceptAt':{'type':Sequelize[_0x478f('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdc0d=['DATE','moment','sequelize','STRING'];(function(_0x22eb5d,_0x2e519d){var _0x4a39ad=function(_0x4a1206){while(--_0x4a1206){_0x22eb5d['push'](_0x22eb5d['shift']());}};_0x4a39ad(++_0x2e519d);}(_0xdc0d,0xc1));var _0xddc0=function(_0x14c7fb,_0x3a23f4){_0x14c7fb=_0x14c7fb-0x0;var _0x435dce=_0xdc0d[_0x14c7fb];return _0x435dce;};'use strict';var moment=require(_0xddc0('0x0'));var Sequelize=require(_0xddc0('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xddc0('0x2')]},'joinAt':{'type':Sequelize[_0xddc0('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xddc0('0x3')]},'exitAt':{'type':Sequelize[_0xddc0('0x3')]},'reason':{'type':Sequelize[_0xddc0('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 630b39e..0d592d7 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 _0x01cc=['fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','SmsQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','util','path','sox','to-csv','ejs'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x01cc,0x95));var _0xc01c=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x01cc[_0xaa0309];return _0x5de7ce;};'use strict';var emlformat=require(_0xc01c('0x0'));var rimraf=require(_0xc01c('0x1'));var zipdir=require(_0xc01c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc01c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc01c('0x4'));var path=require(_0xc01c('0x5'));var sox=require(_0xc01c('0x6'));var csv=require(_0xc01c('0x7'));var ejs=require(_0xc01c('0x8'));var fs=require('fs');var fs_extra=require(_0xc01c('0x9'));var _=require(_0xc01c('0xa'));var squel=require(_0xc01c('0xb'));var crypto=require(_0xc01c('0xc'));var jsforce=require(_0xc01c('0xd'));var deskjs=require(_0xc01c('0xe'));var toCsv=require(_0xc01c('0x7'));var querystring=require('querystring');var Papa=require(_0xc01c('0xf'));var Redis=require(_0xc01c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc01c('0x11'));var as=require(_0xc01c('0x12'));var hardwareService=require(_0xc01c('0x13'));var logger=require(_0xc01c('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xc01c('0x15'));var licenseUtil=require(_0xc01c('0x16'));var db=require(_0xc01c('0x17'))['db'];function respondWithStatusCode(_0x284158,_0x8791fc){_0x8791fc=_0x8791fc||0xcc;return function(_0x34215f){if(_0x34215f){return _0x284158[_0xc01c('0x18')](_0x8791fc);}return _0x284158[_0xc01c('0x19')](_0x8791fc)[_0xc01c('0x1a')]();};}function respondWithResult(_0x13cdef,_0x4e6f25){_0x4e6f25=_0x4e6f25||0xc8;return function(_0xcfd5fa){if(_0xcfd5fa){return _0x13cdef['status'](_0x4e6f25)[_0xc01c('0x1b')](_0xcfd5fa);}};}function respondWithFilteredResult(_0x3f3d48,_0x38a350){return function(_0x58658f){if(_0x58658f){var _0x595f41=typeof _0x38a350['offset']==='undefined'&&typeof _0x38a350[_0xc01c('0x1c')]===_0xc01c('0x1d');var _0x3003a2=_0x58658f[_0xc01c('0x1e')];var _0x731f51=_0x595f41?0x0:_0x38a350[_0xc01c('0x1f')];var _0x2d2ec3=_0x595f41?_0x58658f[_0xc01c('0x1e')]:_0x38a350['offset']+_0x38a350[_0xc01c('0x1c')];var _0x409d7c;if(_0x2d2ec3>=_0x3003a2){_0x2d2ec3=_0x3003a2;_0x409d7c=0xc8;}else{_0x409d7c=0xce;}_0x3f3d48[_0xc01c('0x19')](_0x409d7c);return _0x3f3d48[_0xc01c('0x20')](_0xc01c('0x21'),_0x731f51+'-'+_0x2d2ec3+'/'+_0x3003a2)[_0xc01c('0x1b')](_0x58658f);}return null;};}function patchUpdates(_0x1299ee){return function(_0x435785){try{jsonpatch[_0xc01c('0x22')](_0x435785,_0x1299ee,!![]);}catch(_0x556b8c){return BPromise[_0xc01c('0x23')](_0x556b8c);}return _0x435785[_0xc01c('0x24')]();};}function saveUpdates(_0x4ea752,_0x3a596c){return function(_0x4d18b0){if(_0x4d18b0){return _0x4d18b0[_0xc01c('0x25')](_0x4ea752)['then'](function(_0x54c9a6){return _0x54c9a6;});}return null;};}function removeEntity(_0x1ae1a6,_0x1f763f){return function(_0xb2fcc2){if(_0xb2fcc2){return _0xb2fcc2[_0xc01c('0x26')]()[_0xc01c('0x27')](function(){_0x1ae1a6['status'](0xcc)[_0xc01c('0x1a')]();});}};}function handleEntityNotFound(_0x254805,_0x4606ef){return function(_0x498972){if(!_0x498972){_0x254805[_0xc01c('0x18')](0x194);}return _0x498972;};}function handleError(_0x4bfdc6,_0x3202f8){_0x3202f8=_0x3202f8||0x1f4;return function(_0x8b1fe8){logger[_0xc01c('0x28')](_0x8b1fe8[_0xc01c('0x29')]);if(_0x8b1fe8[_0xc01c('0x2a')]){delete _0x8b1fe8[_0xc01c('0x2a')];}_0x4bfdc6[_0xc01c('0x19')](_0x3202f8)[_0xc01c('0x2b')](_0x8b1fe8);};}exports['index']=function(_0x17d0db,_0x52ad6b){var _0x460523={},_0xbf271={},_0x2358e0={'count':0x0,'rows':[]};var _0x40c927=_['map'](db[_0xc01c('0x2c')][_0xc01c('0x2d')],function(_0x484967){return{'name':_0x484967[_0xc01c('0x2e')],'type':_0x484967[_0xc01c('0x2f')][_0xc01c('0x30')]};});_0xbf271[_0xc01c('0x31')]=_[_0xc01c('0x32')](_0x40c927,_0xc01c('0x2a'));_0xbf271[_0xc01c('0x33')]=_[_0xc01c('0x34')](_0x17d0db[_0xc01c('0x33')]);_0xbf271[_0xc01c('0x35')]=_[_0xc01c('0x36')](_0xbf271[_0xc01c('0x31')],_0xbf271[_0xc01c('0x33')]);_0x460523[_0xc01c('0x37')]=_[_0xc01c('0x36')](_0xbf271[_0xc01c('0x31')],qs[_0xc01c('0x38')](_0x17d0db[_0xc01c('0x33')][_0xc01c('0x38')]));_0x460523[_0xc01c('0x37')]=_0x460523[_0xc01c('0x37')][_0xc01c('0x39')]?_0x460523[_0xc01c('0x37')]:_0xbf271[_0xc01c('0x31')];if(!_0x17d0db[_0xc01c('0x33')][_0xc01c('0x3a')](_0xc01c('0x3b'))){_0x460523['limit']=qs[_0xc01c('0x1c')](_0x17d0db[_0xc01c('0x33')][_0xc01c('0x1c')]);_0x460523[_0xc01c('0x1f')]=qs['offset'](_0x17d0db['query'][_0xc01c('0x1f')]);}_0x460523[_0xc01c('0x3c')]=qs[_0xc01c('0x3d')](_0x17d0db['query'][_0xc01c('0x3d')]);_0x460523[_0xc01c('0x3e')]=qs[_0xc01c('0x35')](_[_0xc01c('0x3f')](_0x17d0db['query'],_0xbf271[_0xc01c('0x35')]),_0x40c927);if(_0x17d0db[_0xc01c('0x33')]['filter']){_0x460523[_0xc01c('0x3e')]=_[_0xc01c('0x40')](_0x460523[_0xc01c('0x3e')],{'$or':_[_0xc01c('0x32')](_0x40c927,function(_0xf46d8d){if(_0xf46d8d[_0xc01c('0x2f')]!==_0xc01c('0x41')){var _0x3f9ae3={};_0x3f9ae3[_0xf46d8d['name']]={'$like':'%'+_0x17d0db[_0xc01c('0x33')][_0xc01c('0x42')]+'%'};return _0x3f9ae3;}})});}_0x460523=_['merge']({},_0x460523,_0x17d0db[_0xc01c('0x43')]);var _0x136c27={'where':_0x460523[_0xc01c('0x3e')]};return db[_0xc01c('0x2c')]['count'](_0x136c27)[_0xc01c('0x27')](function(_0x4ac6dd){_0x2358e0[_0xc01c('0x1e')]=_0x4ac6dd;if(_0x17d0db['query'][_0xc01c('0x44')]){_0x460523[_0xc01c('0x45')]=[{'all':!![]}];}return db[_0xc01c('0x2c')][_0xc01c('0x46')](_0x460523);})['then'](function(_0x461440){_0x2358e0[_0xc01c('0x47')]=_0x461440;return _0x2358e0;})['then'](respondWithFilteredResult(_0x52ad6b,_0x460523))[_0xc01c('0x48')](handleError(_0x52ad6b,null));};exports[_0xc01c('0x49')]=function(_0x9ac547,_0x4cc85d){var _0x382dd7={'raw':!![],'where':{'id':_0x9ac547['params']['id']}},_0x56f07c={};_0x56f07c['model']=_[_0xc01c('0x34')](db[_0xc01c('0x2c')][_0xc01c('0x2d')]);_0x56f07c[_0xc01c('0x33')]=_[_0xc01c('0x34')](_0x9ac547[_0xc01c('0x33')]);_0x56f07c[_0xc01c('0x35')]=_['intersection'](_0x56f07c[_0xc01c('0x31')],_0x56f07c[_0xc01c('0x33')]);_0x382dd7[_0xc01c('0x37')]=_[_0xc01c('0x36')](_0x56f07c[_0xc01c('0x31')],qs[_0xc01c('0x38')](_0x9ac547[_0xc01c('0x33')][_0xc01c('0x38')]));_0x382dd7['attributes']=_0x382dd7['attributes'][_0xc01c('0x39')]?_0x382dd7['attributes']:_0x56f07c[_0xc01c('0x31')];if(_0x9ac547[_0xc01c('0x33')][_0xc01c('0x44')]){_0x382dd7[_0xc01c('0x45')]=[{'all':!![]}];}_0x382dd7=_['merge']({},_0x382dd7,_0x9ac547[_0xc01c('0x43')]);return db['SmsQueueReport'][_0xc01c('0x4a')](_0x382dd7)[_0xc01c('0x27')](handleEntityNotFound(_0x4cc85d,null))[_0xc01c('0x27')](respondWithResult(_0x4cc85d,null))[_0xc01c('0x48')](handleError(_0x4cc85d,null));};exports[_0xc01c('0x4b')]=function(_0x358bec,_0xdaeb28){return db['SmsQueueReport'][_0xc01c('0x4b')](_0x358bec[_0xc01c('0x4c')],{})[_0xc01c('0x27')](respondWithResult(_0xdaeb28,0xc9))[_0xc01c('0x48')](handleError(_0xdaeb28,null));};exports[_0xc01c('0x25')]=function(_0x1a4a09,_0x5ef36c){if(_0x1a4a09['body']['id']){delete _0x1a4a09[_0xc01c('0x4c')]['id'];}return db[_0xc01c('0x2c')][_0xc01c('0x4a')]({'where':{'id':_0x1a4a09[_0xc01c('0x4d')]['id']}})[_0xc01c('0x27')](handleEntityNotFound(_0x5ef36c,null))['then'](saveUpdates(_0x1a4a09['body'],null))[_0xc01c('0x27')](respondWithResult(_0x5ef36c,null))['catch'](handleError(_0x5ef36c,null));};exports[_0xc01c('0x26')]=function(_0x418468,_0x5433ae){return db[_0xc01c('0x2c')][_0xc01c('0x4a')]({'where':{'id':_0x418468[_0xc01c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5433ae,null))['then'](removeEntity(_0x5433ae,null))[_0xc01c('0x48')](handleError(_0x5433ae,null));};exports[_0xc01c('0x4e')]=function(_0x43f359,_0x2ad4e1){return db[_0xc01c('0x2c')][_0xc01c('0x4e')]()[_0xc01c('0x27')](respondWithResult(_0x2ad4e1,null))[_0xc01c('0x48')](handleError(_0x2ad4e1,null));}; \ No newline at end of file +var _0xd98f=['pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','intersection','length','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','error','name','send','index','SmsQueueReport','fieldName','type','key','model','map','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x248bc5,_0x407855){var _0x4fbb0d=function(_0x2e96d9){while(--_0x2e96d9){_0x248bc5['push'](_0x248bc5['shift']());}};_0x4fbb0d(++_0x407855);}(_0xd98f,0x199));var _0xfd98=function(_0x31117e,_0x55d446){_0x31117e=_0x31117e-0x0;var _0x54934b=_0xd98f[_0x31117e];return _0x54934b;};'use strict';var emlformat=require(_0xfd98('0x0'));var rimraf=require(_0xfd98('0x1'));var zipdir=require(_0xfd98('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfd98('0x3'));var moment=require(_0xfd98('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfd98('0x5'));var util=require(_0xfd98('0x6'));var path=require(_0xfd98('0x7'));var sox=require(_0xfd98('0x8'));var csv=require('to-csv');var ejs=require(_0xfd98('0x9'));var fs=require('fs');var fs_extra=require(_0xfd98('0xa'));var _=require(_0xfd98('0xb'));var squel=require(_0xfd98('0xc'));var crypto=require(_0xfd98('0xd'));var jsforce=require(_0xfd98('0xe'));var deskjs=require(_0xfd98('0xf'));var toCsv=require(_0xfd98('0x10'));var querystring=require(_0xfd98('0x11'));var Papa=require('papaparse');var Redis=require(_0xfd98('0x12'));var authService=require(_0xfd98('0x13'));var qs=require(_0xfd98('0x14'));var as=require(_0xfd98('0x15'));var hardwareService=require(_0xfd98('0x16'));var logger=require(_0xfd98('0x17'))(_0xfd98('0x18'));var utils=require(_0xfd98('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xfd98('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x514378,_0x5bd7f0){_0x5bd7f0=_0x5bd7f0||0xcc;return function(_0x28ad07){if(_0x28ad07){return _0x514378[_0xfd98('0x1b')](_0x5bd7f0);}return _0x514378[_0xfd98('0x1c')](_0x5bd7f0)[_0xfd98('0x1d')]();};}function respondWithResult(_0xdc6e1f,_0x588246){_0x588246=_0x588246||0xc8;return function(_0x26e1a5){if(_0x26e1a5){return _0xdc6e1f[_0xfd98('0x1c')](_0x588246)[_0xfd98('0x1e')](_0x26e1a5);}};}function respondWithFilteredResult(_0x29f357,_0x393e4d){return function(_0x4ae6d0){if(_0x4ae6d0){var _0x2efac4=typeof _0x393e4d[_0xfd98('0x1f')]==='undefined'&&typeof _0x393e4d[_0xfd98('0x20')]===_0xfd98('0x21');var _0x248eff=_0x4ae6d0[_0xfd98('0x22')];var _0x37d938=_0x2efac4?0x0:_0x393e4d['offset'];var _0x28d329=_0x2efac4?_0x4ae6d0[_0xfd98('0x22')]:_0x393e4d[_0xfd98('0x1f')]+_0x393e4d[_0xfd98('0x20')];var _0xe0e84b;if(_0x28d329>=_0x248eff){_0x28d329=_0x248eff;_0xe0e84b=0xc8;}else{_0xe0e84b=0xce;}_0x29f357[_0xfd98('0x1c')](_0xe0e84b);return _0x29f357['set'](_0xfd98('0x23'),_0x37d938+'-'+_0x28d329+'/'+_0x248eff)['json'](_0x4ae6d0);}return null;};}function patchUpdates(_0x4e8134){return function(_0x4972c1){try{jsonpatch['apply'](_0x4972c1,_0x4e8134,!![]);}catch(_0x4b1d16){return BPromise[_0xfd98('0x24')](_0x4b1d16);}return _0x4972c1[_0xfd98('0x25')]();};}function saveUpdates(_0x1c8ccd,_0x3ed869){return function(_0x572c9d){if(_0x572c9d){return _0x572c9d[_0xfd98('0x26')](_0x1c8ccd)[_0xfd98('0x27')](function(_0x558d9c){return _0x558d9c;});}return null;};}function removeEntity(_0x8b4c69,_0x5b4093){return function(_0x26f0d7){if(_0x26f0d7){return _0x26f0d7[_0xfd98('0x28')]()[_0xfd98('0x27')](function(){_0x8b4c69[_0xfd98('0x1c')](0xcc)[_0xfd98('0x1d')]();});}};}function handleEntityNotFound(_0x436bb9,_0x415813){return function(_0x1d7799){if(!_0x1d7799){_0x436bb9[_0xfd98('0x1b')](0x194);}return _0x1d7799;};}function handleError(_0x42e42b,_0x120369){_0x120369=_0x120369||0x1f4;return function(_0x2b66b7){logger[_0xfd98('0x29')](_0x2b66b7['stack']);if(_0x2b66b7[_0xfd98('0x2a')]){delete _0x2b66b7[_0xfd98('0x2a')];}_0x42e42b[_0xfd98('0x1c')](_0x120369)[_0xfd98('0x2b')](_0x2b66b7);};}exports[_0xfd98('0x2c')]=function(_0xe7134a,_0x39ac79){var _0x47730b={},_0x11e705={},_0x2b8139={'count':0x0,'rows':[]};var _0x66fb81=_['map'](db[_0xfd98('0x2d')]['rawAttributes'],function(_0x2dbe4a){return{'name':_0x2dbe4a[_0xfd98('0x2e')],'type':_0x2dbe4a[_0xfd98('0x2f')][_0xfd98('0x30')]};});_0x11e705[_0xfd98('0x31')]=_[_0xfd98('0x32')](_0x66fb81,'name');_0x11e705['query']=_['keys'](_0xe7134a[_0xfd98('0x33')]);_0x11e705[_0xfd98('0x34')]=_['intersection'](_0x11e705[_0xfd98('0x31')],_0x11e705['query']);_0x47730b[_0xfd98('0x35')]=_['intersection'](_0x11e705['model'],qs[_0xfd98('0x36')](_0xe7134a[_0xfd98('0x33')][_0xfd98('0x36')]));_0x47730b['attributes']=_0x47730b[_0xfd98('0x35')]['length']?_0x47730b[_0xfd98('0x35')]:_0x11e705[_0xfd98('0x31')];if(!_0xe7134a[_0xfd98('0x33')][_0xfd98('0x37')](_0xfd98('0x38'))){_0x47730b[_0xfd98('0x20')]=qs[_0xfd98('0x20')](_0xe7134a[_0xfd98('0x33')][_0xfd98('0x20')]);_0x47730b['offset']=qs[_0xfd98('0x1f')](_0xe7134a['query'][_0xfd98('0x1f')]);}_0x47730b[_0xfd98('0x39')]=qs[_0xfd98('0x3a')](_0xe7134a[_0xfd98('0x33')][_0xfd98('0x3a')]);_0x47730b['where']=qs[_0xfd98('0x34')](_[_0xfd98('0x3b')](_0xe7134a[_0xfd98('0x33')],_0x11e705['filters']),_0x66fb81);if(_0xe7134a[_0xfd98('0x33')][_0xfd98('0x3c')]){_0x47730b[_0xfd98('0x3d')]=_[_0xfd98('0x3e')](_0x47730b['where'],{'$or':_[_0xfd98('0x32')](_0x66fb81,function(_0x525343){if(_0x525343[_0xfd98('0x2f')]!==_0xfd98('0x3f')){var _0x4c672d={};_0x4c672d[_0x525343[_0xfd98('0x2a')]]={'$like':'%'+_0xe7134a['query'][_0xfd98('0x3c')]+'%'};return _0x4c672d;}})});}_0x47730b=_[_0xfd98('0x3e')]({},_0x47730b,_0xe7134a['options']);var _0x26cf6f={'where':_0x47730b[_0xfd98('0x3d')]};return db['SmsQueueReport'][_0xfd98('0x22')](_0x26cf6f)[_0xfd98('0x27')](function(_0x2be8e5){_0x2b8139[_0xfd98('0x22')]=_0x2be8e5;if(_0xe7134a[_0xfd98('0x33')]['includeAll']){_0x47730b[_0xfd98('0x40')]=[{'all':!![]}];}return db[_0xfd98('0x2d')][_0xfd98('0x41')](_0x47730b);})[_0xfd98('0x27')](function(_0x10e3ae){_0x2b8139[_0xfd98('0x42')]=_0x10e3ae;return _0x2b8139;})[_0xfd98('0x27')](respondWithFilteredResult(_0x39ac79,_0x47730b))[_0xfd98('0x43')](handleError(_0x39ac79,null));};exports[_0xfd98('0x44')]=function(_0x4ab063,_0x2bc4c9){var _0x31cbc6={'raw':!![],'where':{'id':_0x4ab063[_0xfd98('0x45')]['id']}},_0x308243={};_0x308243[_0xfd98('0x31')]=_[_0xfd98('0x46')](db[_0xfd98('0x2d')]['rawAttributes']);_0x308243[_0xfd98('0x33')]=_[_0xfd98('0x46')](_0x4ab063[_0xfd98('0x33')]);_0x308243[_0xfd98('0x34')]=_[_0xfd98('0x47')](_0x308243[_0xfd98('0x31')],_0x308243[_0xfd98('0x33')]);_0x31cbc6[_0xfd98('0x35')]=_['intersection'](_0x308243[_0xfd98('0x31')],qs[_0xfd98('0x36')](_0x4ab063[_0xfd98('0x33')][_0xfd98('0x36')]));_0x31cbc6[_0xfd98('0x35')]=_0x31cbc6[_0xfd98('0x35')][_0xfd98('0x48')]?_0x31cbc6['attributes']:_0x308243['model'];if(_0x4ab063[_0xfd98('0x33')][_0xfd98('0x49')]){_0x31cbc6[_0xfd98('0x40')]=[{'all':!![]}];}_0x31cbc6=_['merge']({},_0x31cbc6,_0x4ab063['options']);return db[_0xfd98('0x2d')]['find'](_0x31cbc6)[_0xfd98('0x27')](handleEntityNotFound(_0x2bc4c9,null))[_0xfd98('0x27')](respondWithResult(_0x2bc4c9,null))[_0xfd98('0x43')](handleError(_0x2bc4c9,null));};exports['create']=function(_0x211469,_0x2f8eb2){return db['SmsQueueReport'][_0xfd98('0x4a')](_0x211469[_0xfd98('0x4b')],{})[_0xfd98('0x27')](respondWithResult(_0x2f8eb2,0xc9))[_0xfd98('0x43')](handleError(_0x2f8eb2,null));};exports[_0xfd98('0x26')]=function(_0x1f40ce,_0x3a1e84){if(_0x1f40ce['body']['id']){delete _0x1f40ce[_0xfd98('0x4b')]['id'];}return db[_0xfd98('0x2d')][_0xfd98('0x4c')]({'where':{'id':_0x1f40ce[_0xfd98('0x45')]['id']}})['then'](handleEntityNotFound(_0x3a1e84,null))[_0xfd98('0x27')](saveUpdates(_0x1f40ce[_0xfd98('0x4b')],null))[_0xfd98('0x27')](respondWithResult(_0x3a1e84,null))[_0xfd98('0x43')](handleError(_0x3a1e84,null));};exports[_0xfd98('0x28')]=function(_0x2c4762,_0x5388d5){return db[_0xfd98('0x2d')]['find']({'where':{'id':_0x2c4762['params']['id']}})[_0xfd98('0x27')](handleEntityNotFound(_0x5388d5,null))[_0xfd98('0x27')](removeEntity(_0x5388d5,null))[_0xfd98('0x43')](handleError(_0x5388d5,null));};exports[_0xfd98('0x4d')]=function(_0x454f61,_0xb740b8){return db[_0xfd98('0x2d')]['describe']()[_0xfd98('0x27')](respondWithResult(_0xb740b8,null))[_0xfd98('0x43')](handleError(_0xb740b8,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index b048797..bcd1633 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 _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x4746bd,_0x504982){var _0x202543=function(_0xfaca6b){while(--_0xfaca6b){_0x4746bd['push'](_0x4746bd['shift']());}};_0x202543(++_0x504982);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4b6830,_0x2bf6fb){_0x4b6830=_0x4b6830-0x0;var _0x239e4a=_0xcb91[_0x4b6830];return _0x239e4a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x4fa166,_0x58b7fb){var _0x5dd974=function(_0x342886){while(--_0x342886){_0x4fa166['push'](_0x4fa166['shift']());}};_0x5dd974(++_0x58b7fb);}(_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 diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 207b74c..3079f1f 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 _0x5498=['http','request','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','UpdateSmsQueueReport','update','body','where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x416566,_0x52da5f){var _0x15c8af=function(_0x1639ce){while(--_0x1639ce){_0x416566['push'](_0x416566['shift']());}};_0x15c8af(++_0x52da5f);}(_0x5498,0x1b0));var _0x8549=function(_0x15a569,_0x4ad6a1){_0x15a569=_0x15a569-0x0;var _0x536d3b=_0x5498[_0x15a569];return _0x536d3b;};'use strict';var _=require(_0x8549('0x0'));var util=require('util');var moment=require(_0x8549('0x1'));var BPromise=require('bluebird');var rs=require(_0x8549('0x2'));var fs=require('fs');var Redis=require(_0x8549('0x3'));var db=require(_0x8549('0x4'))['db'];var utils=require(_0x8549('0x5'));var logger=require(_0x8549('0x6'))(_0x8549('0x7'));var config=require('../../config/environment');var jayson=require(_0x8549('0x8'));var client=jayson[_0x8549('0x9')][_0x8549('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4333a9,_0x4f3f59,_0x16c655){return new BPromise(function(_0x98fa99,_0x18ce8c){return client[_0x8549('0xb')](_0x4333a9,_0x16c655)[_0x8549('0xc')](function(_0x4e6ff2){logger[_0x8549('0xd')](_0x8549('0xe'),_0x4f3f59,'request\x20sent');logger[_0x8549('0xf')](_0x8549('0x10'),_0x4f3f59,_0x8549('0x11'),JSON[_0x8549('0x12')](_0x4e6ff2));if(_0x4e6ff2[_0x8549('0x13')]){if(_0x4e6ff2['error']['code']===0x1f4){logger[_0x8549('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x4f3f59,_0x4e6ff2[_0x8549('0x13')][_0x8549('0x14')]);return _0x18ce8c(_0x4e6ff2[_0x8549('0x13')][_0x8549('0x14')]);}logger[_0x8549('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x4f3f59,_0x4e6ff2[_0x8549('0x13')]['message']);return _0x98fa99(_0x4e6ff2['error'][_0x8549('0x14')]);}else{logger[_0x8549('0xd')](_0x8549('0xe'),_0x4f3f59,_0x8549('0x11'));_0x98fa99(_0x4e6ff2[_0x8549('0x15')][_0x8549('0x14')]);}})[_0x8549('0x16')](function(_0x1761b1){logger[_0x8549('0x13')](_0x8549('0xe'),_0x4f3f59,_0x1761b1);_0x18ce8c(_0x1761b1);});});}exports[_0x8549('0x17')]=function(_0x5c491e){var _0x44b025=this;return new Promise(function(_0x4858ec,_0xa4c0df){return db[_0x8549('0x18')][_0x8549('0x19')](_0x5c491e['body'],{'raw':_0x5c491e[_0x8549('0x1a')]?_0x5c491e[_0x8549('0x1a')][_0x8549('0x1b')]===undefined?!![]:![]:!![]})[_0x8549('0xc')](function(_0x2b6e9c){logger[_0x8549('0xd')](_0x8549('0x17'),_0x5c491e);logger['debug'](_0x8549('0x17'),_0x5c491e,JSON[_0x8549('0x12')](_0x2b6e9c));_0x4858ec(_0x2b6e9c);})[_0x8549('0x16')](function(_0x14aad8){logger[_0x8549('0x13')]('CreateSmsQueueReport',_0x14aad8[_0x8549('0x14')],_0x5c491e);_0xa4c0df(_0x44b025['error'](0x1f4,_0x14aad8[_0x8549('0x14')]));});});};exports[_0x8549('0x1c')]=function(_0x2bca45){var _0x3ca3c4=this;return new Promise(function(_0x32fd3c,_0x40ea8f){return db[_0x8549('0x18')][_0x8549('0x1d')](_0x2bca45[_0x8549('0x1e')],{'raw':_0x2bca45[_0x8549('0x1a')]?_0x2bca45[_0x8549('0x1a')][_0x8549('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bca45['options']?_0x2bca45['options'][_0x8549('0x1f')]||null:null,'attributes':_0x2bca45[_0x8549('0x1a')]?_0x2bca45[_0x8549('0x1a')][_0x8549('0x20')]||null:null,'limit':_0x2bca45[_0x8549('0x1a')]?_0x2bca45[_0x8549('0x1a')][_0x8549('0x21')]||null:null})[_0x8549('0xc')](function(_0x19562c){logger[_0x8549('0xd')]('UpdateSmsQueueReport',_0x2bca45);logger[_0x8549('0xf')]('UpdateSmsQueueReport',_0x2bca45,JSON['stringify'](_0x19562c));_0x32fd3c(_0x19562c);})[_0x8549('0x16')](function(_0x391984){logger[_0x8549('0x13')](_0x8549('0x1c'),_0x391984['message'],_0x2bca45);_0x40ea8f(_0x3ca3c4[_0x8549('0x13')](0x1f4,_0x391984[_0x8549('0x14')]));});});}; \ No newline at end of file +var _0x3dba=['attributes','limit','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','SmsQueueReport','update','where'];(function(_0x25bf48,_0xe4466f){var _0x31f138=function(_0x535c1d){while(--_0x535c1d){_0x25bf48['push'](_0x25bf48['shift']());}};_0x31f138(++_0xe4466f);}(_0x3dba,0x66));var _0xa3db=function(_0x4dd0a7,_0xb4399f){_0x4dd0a7=_0x4dd0a7-0x0;var _0x487e9b=_0x3dba[_0x4dd0a7];return _0x487e9b;};'use strict';var _=require('lodash');var util=require(_0xa3db('0x0'));var moment=require(_0xa3db('0x1'));var BPromise=require(_0xa3db('0x2'));var rs=require(_0xa3db('0x3'));var fs=require('fs');var Redis=require(_0xa3db('0x4'));var db=require(_0xa3db('0x5'))['db'];var utils=require(_0xa3db('0x6'));var logger=require(_0xa3db('0x7'))(_0xa3db('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa3db('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ea76c,_0xf4b29a,_0x281409){return new BPromise(function(_0x2cc439,_0x414d81){return client[_0xa3db('0xa')](_0x3ea76c,_0x281409)[_0xa3db('0xb')](function(_0x1ddaa2){logger[_0xa3db('0xc')](_0xa3db('0xd'),_0xf4b29a,_0xa3db('0xe'));logger['debug'](_0xa3db('0xf'),_0xf4b29a,_0xa3db('0xe'),JSON[_0xa3db('0x10')](_0x1ddaa2));if(_0x1ddaa2[_0xa3db('0x11')]){if(_0x1ddaa2[_0xa3db('0x11')]['code']===0x1f4){logger[_0xa3db('0x11')](_0xa3db('0xd'),_0xf4b29a,_0x1ddaa2[_0xa3db('0x11')][_0xa3db('0x12')]);return _0x414d81(_0x1ddaa2[_0xa3db('0x11')]['message']);}logger[_0xa3db('0x11')](_0xa3db('0xd'),_0xf4b29a,_0x1ddaa2[_0xa3db('0x11')][_0xa3db('0x12')]);return _0x2cc439(_0x1ddaa2['error'][_0xa3db('0x12')]);}else{logger[_0xa3db('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0xf4b29a,_0xa3db('0xe'));_0x2cc439(_0x1ddaa2[_0xa3db('0x13')]['message']);}})[_0xa3db('0x14')](function(_0x42f62f){logger[_0xa3db('0x11')](_0xa3db('0xd'),_0xf4b29a,_0x42f62f);_0x414d81(_0x42f62f);});});}exports[_0xa3db('0x15')]=function(_0xf19636){var _0x2fe5ff=this;return new Promise(function(_0x14443c,_0x39c462){return db['SmsQueueReport'][_0xa3db('0x16')](_0xf19636[_0xa3db('0x17')],{'raw':_0xf19636['options']?_0xf19636[_0xa3db('0x18')][_0xa3db('0x19')]===undefined?!![]:![]:!![]})[_0xa3db('0xb')](function(_0x1ffcf9){logger['info'](_0xa3db('0x15'),_0xf19636);logger['debug'](_0xa3db('0x15'),_0xf19636,JSON[_0xa3db('0x10')](_0x1ffcf9));_0x14443c(_0x1ffcf9);})[_0xa3db('0x14')](function(_0x37f332){logger[_0xa3db('0x11')](_0xa3db('0x15'),_0x37f332[_0xa3db('0x12')],_0xf19636);_0x39c462(_0x2fe5ff[_0xa3db('0x11')](0x1f4,_0x37f332[_0xa3db('0x12')]));});});};exports[_0xa3db('0x1a')]=function(_0x3120f8){var _0x3bb49f=this;return new Promise(function(_0x505bc1,_0x60eb7d){return db[_0xa3db('0x1b')][_0xa3db('0x1c')](_0x3120f8[_0xa3db('0x17')],{'raw':_0x3120f8[_0xa3db('0x18')]?_0x3120f8[_0xa3db('0x18')][_0xa3db('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3120f8['options']?_0x3120f8[_0xa3db('0x18')][_0xa3db('0x1d')]||null:null,'attributes':_0x3120f8['options']?_0x3120f8['options'][_0xa3db('0x1e')]||null:null,'limit':_0x3120f8[_0xa3db('0x18')]?_0x3120f8[_0xa3db('0x18')][_0xa3db('0x1f')]||null:null})[_0xa3db('0xb')](function(_0x9d1e44){logger[_0xa3db('0xc')](_0xa3db('0x1a'),_0x3120f8);logger[_0xa3db('0x20')]('UpdateSmsQueueReport',_0x3120f8,JSON['stringify'](_0x9d1e44));_0x505bc1(_0x9d1e44);})[_0xa3db('0x14')](function(_0x411dc3){logger[_0xa3db('0x11')](_0xa3db('0x1a'),_0x411dc3[_0xa3db('0x12')],_0x3120f8);_0x60eb7d(_0x3bb49f[_0xa3db('0x11')](0x1f4,_0x411dc3['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 52c430c..f74353d 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 _0x5c12=['./smsTransferReport.controller','isAuthenticated','index','get','describe','/:id','show','create','put','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2d3ab3,_0x47d90b){var _0x321f9e=function(_0x50a53d){while(--_0x50a53d){_0x2d3ab3['push'](_0x2d3ab3['shift']());}};_0x321f9e(++_0x47d90b);}(_0x5c12,0x188));var _0x25c1=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x5c12[_0x5a6644];return _0x3a2a5d;};'use strict';var multer=require('multer');var util=require(_0x25c1('0x0'));var path=require(_0x25c1('0x1'));var timeout=require('connect-timeout');var express=require(_0x25c1('0x2'));var router=express[_0x25c1('0x3')]();var fs_extra=require(_0x25c1('0x4'));var auth=require(_0x25c1('0x5'));var interaction=require(_0x25c1('0x6'));var config=require(_0x25c1('0x7'));var controller=require(_0x25c1('0x8'));router['get']('/',auth[_0x25c1('0x9')](),controller[_0x25c1('0xa')]);router[_0x25c1('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x25c1('0xc')]);router[_0x25c1('0xb')](_0x25c1('0xd'),auth[_0x25c1('0x9')](),controller[_0x25c1('0xe')]);router['post']('/',auth[_0x25c1('0x9')](),controller[_0x25c1('0xf')]);router[_0x25c1('0x10')](_0x25c1('0xd'),auth[_0x25c1('0x9')](),controller['update']);router[_0x25c1('0x11')](_0x25c1('0xd'),auth['isAuthenticated'](),controller[_0x25c1('0x12')]);module[_0x25c1('0x13')]=router; \ No newline at end of file +var _0x02a7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','get','/describe','describe','/:id','post','put','update','destroy','exports','util','express','Router','fs-extra'];(function(_0x43f59f,_0x78de62){var _0x5f36fc=function(_0x10df26){while(--_0x10df26){_0x43f59f['push'](_0x43f59f['shift']());}};_0x5f36fc(++_0x78de62);}(_0x02a7,0x7a));var _0x702a=function(_0x56a345,_0x5e8ab6){_0x56a345=_0x56a345-0x0;var _0xe4c560=_0x02a7[_0x56a345];return _0xe4c560;};'use strict';var multer=require('multer');var util=require(_0x702a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x702a('0x1'));var router=express[_0x702a('0x2')]();var fs_extra=require(_0x702a('0x3'));var auth=require(_0x702a('0x4'));var interaction=require(_0x702a('0x5'));var config=require(_0x702a('0x6'));var controller=require(_0x702a('0x7'));router['get']('/',auth[_0x702a('0x8')](),controller['index']);router[_0x702a('0x9')](_0x702a('0xa'),auth[_0x702a('0x8')](),controller[_0x702a('0xb')]);router[_0x702a('0x9')](_0x702a('0xc'),auth[_0x702a('0x8')](),controller['show']);router[_0x702a('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x702a('0xe')](_0x702a('0xc'),auth[_0x702a('0x8')](),controller[_0x702a('0xf')]);router['delete'](_0x702a('0xc'),auth[_0x702a('0x8')](),controller[_0x702a('0x10')]);module[_0x702a('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 364ecd4..e76395f 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x3a7490,_0x265112){var _0x4209ab=function(_0x1e230c){while(--_0x1e230c){_0x3a7490['push'](_0x3a7490['shift']());}};_0x4209ab(++_0x265112);}(_0x34e8,0x12c));var _0x834e=function(_0xe74487,_0x336996){_0xe74487=_0xe74487-0x0;var _0x23d708=_0x34e8[_0xe74487];return _0x23d708;};'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 +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x6d1c65,_0x22df6e){var _0x1e96b4=function(_0xc1aac4){while(--_0xc1aac4){_0x6d1c65['push'](_0x6d1c65['shift']());}};_0x1e96b4(++_0x22df6e);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 696f38b..f885923 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 _0xa436=['error','stack','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end'];(function(_0x81293b,_0x495127){var _0x3377ed=function(_0x130c92){while(--_0x130c92){_0x81293b['push'](_0x81293b['shift']());}};_0x3377ed(++_0x495127);}(_0xa436,0x1ad));var _0x6a43=function(_0x47eb1a,_0x14ad62){_0x47eb1a=_0x47eb1a-0x0;var _0x5a8239=_0xa436[_0x47eb1a];return _0x5a8239;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6a43('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6a43('0x1'));var moment=require(_0x6a43('0x2'));var BPromise=require(_0x6a43('0x3'));var Mustache=require(_0x6a43('0x4'));var util=require(_0x6a43('0x5'));var path=require(_0x6a43('0x6'));var sox=require(_0x6a43('0x7'));var csv=require(_0x6a43('0x8'));var ejs=require(_0x6a43('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a43('0xa'));var squel=require(_0x6a43('0xb'));var crypto=require(_0x6a43('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6a43('0xd'));var toCsv=require(_0x6a43('0x8'));var querystring=require(_0x6a43('0xe'));var Papa=require(_0x6a43('0xf'));var Redis=require(_0x6a43('0x10'));var authService=require(_0x6a43('0x11'));var qs=require(_0x6a43('0x12'));var as=require(_0x6a43('0x13'));var hardwareService=require(_0x6a43('0x14'));var logger=require(_0x6a43('0x15'))(_0x6a43('0x16'));var utils=require(_0x6a43('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18d745,_0x26eb11){_0x26eb11=_0x26eb11||0xcc;return function(_0x3710a7){if(_0x3710a7){return _0x18d745[_0x6a43('0x18')](_0x26eb11);}return _0x18d745[_0x6a43('0x19')](_0x26eb11)['end']();};}function respondWithResult(_0x55dc73,_0x268fe5){_0x268fe5=_0x268fe5||0xc8;return function(_0x4a9910){if(_0x4a9910){return _0x55dc73['status'](_0x268fe5)[_0x6a43('0x1a')](_0x4a9910);}};}function respondWithFilteredResult(_0x4948b2,_0x49644a){return function(_0x256de5){if(_0x256de5){var _0x43e849=typeof _0x49644a[_0x6a43('0x1b')]===_0x6a43('0x1c')&&typeof _0x49644a[_0x6a43('0x1d')]===_0x6a43('0x1c');var _0x447240=_0x256de5[_0x6a43('0x1e')];var _0x501e51=_0x43e849?0x0:_0x49644a['offset'];var _0x2d0834=_0x43e849?_0x256de5['count']:_0x49644a[_0x6a43('0x1b')]+_0x49644a[_0x6a43('0x1d')];var _0x1cb004;if(_0x2d0834>=_0x447240){_0x2d0834=_0x447240;_0x1cb004=0xc8;}else{_0x1cb004=0xce;}_0x4948b2['status'](_0x1cb004);return _0x4948b2[_0x6a43('0x1f')](_0x6a43('0x20'),_0x501e51+'-'+_0x2d0834+'/'+_0x447240)[_0x6a43('0x1a')](_0x256de5);}return null;};}function patchUpdates(_0x5cebbe){return function(_0x7b79f1){try{jsonpatch[_0x6a43('0x21')](_0x7b79f1,_0x5cebbe,!![]);}catch(_0x2cf07f){return BPromise[_0x6a43('0x22')](_0x2cf07f);}return _0x7b79f1['save']();};}function saveUpdates(_0x1fd1d8,_0x545d6c){return function(_0x5f01ac){if(_0x5f01ac){return _0x5f01ac[_0x6a43('0x23')](_0x1fd1d8)[_0x6a43('0x24')](function(_0x18a361){return _0x18a361;});}return null;};}function removeEntity(_0x460df4,_0x55bbed){return function(_0x11722b){if(_0x11722b){return _0x11722b[_0x6a43('0x25')]()[_0x6a43('0x24')](function(){_0x460df4[_0x6a43('0x19')](0xcc)[_0x6a43('0x26')]();});}};}function handleEntityNotFound(_0x24f202,_0x3c4717){return function(_0x4021fb){if(!_0x4021fb){_0x24f202[_0x6a43('0x18')](0x194);}return _0x4021fb;};}function handleError(_0x30e870,_0xca634e){_0xca634e=_0xca634e||0x1f4;return function(_0x30266a){logger[_0x6a43('0x27')](_0x30266a[_0x6a43('0x28')]);if(_0x30266a['name']){delete _0x30266a['name'];}_0x30e870[_0x6a43('0x19')](_0xca634e)['send'](_0x30266a);};}exports[_0x6a43('0x29')]=function(_0x3a5e60,_0x13855d){var _0x35b23f={},_0x5f3554={},_0xfb3f8a={'count':0x0,'rows':[]};var _0xd740b9=_[_0x6a43('0x2a')](db[_0x6a43('0x2b')][_0x6a43('0x2c')],function(_0x1492a9){return{'name':_0x1492a9[_0x6a43('0x2d')],'type':_0x1492a9[_0x6a43('0x2e')][_0x6a43('0x2f')]};});_0x5f3554[_0x6a43('0x30')]=_[_0x6a43('0x2a')](_0xd740b9,'name');_0x5f3554[_0x6a43('0x31')]=_[_0x6a43('0x32')](_0x3a5e60[_0x6a43('0x31')]);_0x5f3554[_0x6a43('0x33')]=_[_0x6a43('0x34')](_0x5f3554['model'],_0x5f3554['query']);_0x35b23f['attributes']=_[_0x6a43('0x34')](_0x5f3554[_0x6a43('0x30')],qs[_0x6a43('0x35')](_0x3a5e60[_0x6a43('0x31')]['fields']));_0x35b23f[_0x6a43('0x36')]=_0x35b23f['attributes']['length']?_0x35b23f[_0x6a43('0x36')]:_0x5f3554[_0x6a43('0x30')];if(!_0x3a5e60[_0x6a43('0x31')][_0x6a43('0x37')](_0x6a43('0x38'))){_0x35b23f['limit']=qs[_0x6a43('0x1d')](_0x3a5e60['query']['limit']);_0x35b23f[_0x6a43('0x1b')]=qs[_0x6a43('0x1b')](_0x3a5e60['query'][_0x6a43('0x1b')]);}_0x35b23f[_0x6a43('0x39')]=qs[_0x6a43('0x3a')](_0x3a5e60[_0x6a43('0x31')]['sort']);_0x35b23f[_0x6a43('0x3b')]=qs['filters'](_[_0x6a43('0x3c')](_0x3a5e60['query'],_0x5f3554[_0x6a43('0x33')]),_0xd740b9);if(_0x3a5e60[_0x6a43('0x31')][_0x6a43('0x3d')]){_0x35b23f[_0x6a43('0x3b')]=_[_0x6a43('0x3e')](_0x35b23f[_0x6a43('0x3b')],{'$or':_[_0x6a43('0x2a')](_0xd740b9,function(_0x5a7b3c){if(_0x5a7b3c[_0x6a43('0x2e')]!==_0x6a43('0x3f')){var _0x360da1={};_0x360da1[_0x5a7b3c[_0x6a43('0x40')]]={'$like':'%'+_0x3a5e60['query']['filter']+'%'};return _0x360da1;}})});}_0x35b23f=_[_0x6a43('0x3e')]({},_0x35b23f,_0x3a5e60[_0x6a43('0x41')]);var _0x3b3c30={'where':_0x35b23f['where']};return db[_0x6a43('0x2b')][_0x6a43('0x1e')](_0x3b3c30)[_0x6a43('0x24')](function(_0x149a08){_0xfb3f8a[_0x6a43('0x1e')]=_0x149a08;if(_0x3a5e60[_0x6a43('0x31')]['includeAll']){_0x35b23f[_0x6a43('0x42')]=[{'all':!![]}];}return db[_0x6a43('0x2b')][_0x6a43('0x43')](_0x35b23f);})['then'](function(_0x57c4f7){_0xfb3f8a[_0x6a43('0x44')]=_0x57c4f7;return _0xfb3f8a;})[_0x6a43('0x24')](respondWithFilteredResult(_0x13855d,_0x35b23f))[_0x6a43('0x45')](handleError(_0x13855d,null));};exports[_0x6a43('0x46')]=function(_0x211397,_0x39df10){var _0x2f6290={'raw':!![],'where':{'id':_0x211397[_0x6a43('0x47')]['id']}},_0x42f9fa={};_0x42f9fa[_0x6a43('0x30')]=_[_0x6a43('0x32')](db[_0x6a43('0x2b')][_0x6a43('0x2c')]);_0x42f9fa[_0x6a43('0x31')]=_[_0x6a43('0x32')](_0x211397['query']);_0x42f9fa['filters']=_[_0x6a43('0x34')](_0x42f9fa[_0x6a43('0x30')],_0x42f9fa[_0x6a43('0x31')]);_0x2f6290[_0x6a43('0x36')]=_['intersection'](_0x42f9fa['model'],qs['fields'](_0x211397[_0x6a43('0x31')][_0x6a43('0x35')]));_0x2f6290[_0x6a43('0x36')]=_0x2f6290[_0x6a43('0x36')][_0x6a43('0x48')]?_0x2f6290[_0x6a43('0x36')]:_0x42f9fa['model'];if(_0x211397[_0x6a43('0x31')][_0x6a43('0x49')]){_0x2f6290[_0x6a43('0x42')]=[{'all':!![]}];}_0x2f6290=_[_0x6a43('0x3e')]({},_0x2f6290,_0x211397['options']);return db[_0x6a43('0x2b')][_0x6a43('0x4a')](_0x2f6290)['then'](handleEntityNotFound(_0x39df10,null))[_0x6a43('0x24')](respondWithResult(_0x39df10,null))['catch'](handleError(_0x39df10,null));};exports[_0x6a43('0x4b')]=function(_0x4a059c,_0x131a2e){return db[_0x6a43('0x2b')][_0x6a43('0x4b')](_0x4a059c[_0x6a43('0x4c')],{})[_0x6a43('0x24')](respondWithResult(_0x131a2e,0xc9))[_0x6a43('0x45')](handleError(_0x131a2e,null));};exports[_0x6a43('0x23')]=function(_0x520c47,_0x5bb480){if(_0x520c47[_0x6a43('0x4c')]['id']){delete _0x520c47[_0x6a43('0x4c')]['id'];}return db[_0x6a43('0x2b')]['find']({'where':{'id':_0x520c47['params']['id']}})[_0x6a43('0x24')](handleEntityNotFound(_0x5bb480,null))[_0x6a43('0x24')](saveUpdates(_0x520c47[_0x6a43('0x4c')],null))[_0x6a43('0x24')](respondWithResult(_0x5bb480,null))[_0x6a43('0x45')](handleError(_0x5bb480,null));};exports['destroy']=function(_0x91e2a6,_0x2f3aba){return db[_0x6a43('0x2b')][_0x6a43('0x4a')]({'where':{'id':_0x91e2a6['params']['id']}})[_0x6a43('0x24')](handleEntityNotFound(_0x2f3aba,null))[_0x6a43('0x24')](removeEntity(_0x2f3aba,null))[_0x6a43('0x45')](handleError(_0x2f3aba,null));};exports[_0x6a43('0x4d')]=function(_0x367a36,_0x1383b7){return db[_0x6a43('0x2b')][_0x6a43('0x4d')]()[_0x6a43('0x24')](respondWithResult(_0x1383b7,null))[_0x6a43('0x45')](handleError(_0x1383b7,null));}; \ No newline at end of file +var _0x81ed=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','status','json','offset','undefined','count','limit','apply','reject','update','then','destroy','end','sendStatus','stack','name','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','rows','show','params','fields','includeAll','options','create','body','find','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x2aaa60,_0x22258f){var _0x2e3fa5=function(_0x335589){while(--_0x335589){_0x2aaa60['push'](_0x2aaa60['shift']());}};_0x2e3fa5(++_0x22258f);}(_0x81ed,0xd2));var _0xd81e=function(_0x509dad,_0x1f995f){_0x509dad=_0x509dad-0x0;var _0x21e122=_0x81ed[_0x509dad];return _0x21e122;};'use strict';var emlformat=require(_0xd81e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd81e('0x1'));var jsonpatch=require(_0xd81e('0x2'));var rp=require(_0xd81e('0x3'));var moment=require(_0xd81e('0x4'));var BPromise=require(_0xd81e('0x5'));var Mustache=require(_0xd81e('0x6'));var util=require(_0xd81e('0x7'));var path=require(_0xd81e('0x8'));var sox=require(_0xd81e('0x9'));var csv=require(_0xd81e('0xa'));var ejs=require(_0xd81e('0xb'));var fs=require('fs');var fs_extra=require(_0xd81e('0xc'));var _=require(_0xd81e('0xd'));var squel=require(_0xd81e('0xe'));var crypto=require(_0xd81e('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xd81e('0x10'));var toCsv=require(_0xd81e('0xa'));var querystring=require(_0xd81e('0x11'));var Papa=require(_0xd81e('0x12'));var Redis=require(_0xd81e('0x13'));var authService=require(_0xd81e('0x14'));var qs=require(_0xd81e('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd81e('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xd81e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd81e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44b9f7,_0x11fb87){_0x11fb87=_0x11fb87||0xcc;return function(_0x409b85){if(_0x409b85){return _0x44b9f7['sendStatus'](_0x11fb87);}return _0x44b9f7[_0xd81e('0x19')](_0x11fb87)['end']();};}function respondWithResult(_0x4b8caa,_0x3000be){_0x3000be=_0x3000be||0xc8;return function(_0xd6d16b){if(_0xd6d16b){return _0x4b8caa[_0xd81e('0x19')](_0x3000be)[_0xd81e('0x1a')](_0xd6d16b);}};}function respondWithFilteredResult(_0x148a3b,_0x59684d){return function(_0x570a45){if(_0x570a45){var _0x5441df=typeof _0x59684d[_0xd81e('0x1b')]==='undefined'&&typeof _0x59684d['limit']===_0xd81e('0x1c');var _0x4354e5=_0x570a45[_0xd81e('0x1d')];var _0x2ac325=_0x5441df?0x0:_0x59684d[_0xd81e('0x1b')];var _0xdcb4e0=_0x5441df?_0x570a45[_0xd81e('0x1d')]:_0x59684d['offset']+_0x59684d[_0xd81e('0x1e')];var _0x297d88;if(_0xdcb4e0>=_0x4354e5){_0xdcb4e0=_0x4354e5;_0x297d88=0xc8;}else{_0x297d88=0xce;}_0x148a3b[_0xd81e('0x19')](_0x297d88);return _0x148a3b['set']('Content-Range',_0x2ac325+'-'+_0xdcb4e0+'/'+_0x4354e5)[_0xd81e('0x1a')](_0x570a45);}return null;};}function patchUpdates(_0x1b4eb9){return function(_0x125ee3){try{jsonpatch[_0xd81e('0x1f')](_0x125ee3,_0x1b4eb9,!![]);}catch(_0x4e74e9){return BPromise[_0xd81e('0x20')](_0x4e74e9);}return _0x125ee3['save']();};}function saveUpdates(_0x1c23ee,_0x1b252e){return function(_0x407704){if(_0x407704){return _0x407704[_0xd81e('0x21')](_0x1c23ee)[_0xd81e('0x22')](function(_0x449321){return _0x449321;});}return null;};}function removeEntity(_0x36d6ea,_0x436903){return function(_0x1aa9da){if(_0x1aa9da){return _0x1aa9da[_0xd81e('0x23')]()[_0xd81e('0x22')](function(){_0x36d6ea['status'](0xcc)[_0xd81e('0x24')]();});}};}function handleEntityNotFound(_0x46955d,_0x52c839){return function(_0x242014){if(!_0x242014){_0x46955d[_0xd81e('0x25')](0x194);}return _0x242014;};}function handleError(_0x24cfe1,_0x30cb78){_0x30cb78=_0x30cb78||0x1f4;return function(_0x5246d8){logger['error'](_0x5246d8[_0xd81e('0x26')]);if(_0x5246d8['name']){delete _0x5246d8[_0xd81e('0x27')];}_0x24cfe1['status'](_0x30cb78)['send'](_0x5246d8);};}exports[_0xd81e('0x28')]=function(_0x5c7ffe,_0x11a8de){var _0x1f4699={},_0x3d77fd={},_0x50a4cb={'count':0x0,'rows':[]};var _0x502d65=_[_0xd81e('0x29')](db[_0xd81e('0x2a')][_0xd81e('0x2b')],function(_0x2883d4){return{'name':_0x2883d4[_0xd81e('0x2c')],'type':_0x2883d4[_0xd81e('0x2d')][_0xd81e('0x2e')]};});_0x3d77fd[_0xd81e('0x2f')]=_[_0xd81e('0x29')](_0x502d65,_0xd81e('0x27'));_0x3d77fd[_0xd81e('0x30')]=_[_0xd81e('0x31')](_0x5c7ffe['query']);_0x3d77fd[_0xd81e('0x32')]=_[_0xd81e('0x33')](_0x3d77fd[_0xd81e('0x2f')],_0x3d77fd[_0xd81e('0x30')]);_0x1f4699[_0xd81e('0x34')]=_[_0xd81e('0x33')](_0x3d77fd[_0xd81e('0x2f')],qs['fields'](_0x5c7ffe[_0xd81e('0x30')]['fields']));_0x1f4699['attributes']=_0x1f4699[_0xd81e('0x34')][_0xd81e('0x35')]?_0x1f4699[_0xd81e('0x34')]:_0x3d77fd[_0xd81e('0x2f')];if(!_0x5c7ffe[_0xd81e('0x30')][_0xd81e('0x36')](_0xd81e('0x37'))){_0x1f4699['limit']=qs[_0xd81e('0x1e')](_0x5c7ffe[_0xd81e('0x30')][_0xd81e('0x1e')]);_0x1f4699[_0xd81e('0x1b')]=qs[_0xd81e('0x1b')](_0x5c7ffe[_0xd81e('0x30')][_0xd81e('0x1b')]);}_0x1f4699[_0xd81e('0x38')]=qs['sort'](_0x5c7ffe[_0xd81e('0x30')][_0xd81e('0x39')]);_0x1f4699[_0xd81e('0x3a')]=qs['filters'](_[_0xd81e('0x3b')](_0x5c7ffe[_0xd81e('0x30')],_0x3d77fd[_0xd81e('0x32')]),_0x502d65);if(_0x5c7ffe[_0xd81e('0x30')]['filter']){_0x1f4699[_0xd81e('0x3a')]=_[_0xd81e('0x3c')](_0x1f4699['where'],{'$or':_[_0xd81e('0x29')](_0x502d65,function(_0x1889a0){if(_0x1889a0[_0xd81e('0x2d')]!==_0xd81e('0x3d')){var _0x1c0ce6={};_0x1c0ce6[_0x1889a0[_0xd81e('0x27')]]={'$like':'%'+_0x5c7ffe[_0xd81e('0x30')][_0xd81e('0x3e')]+'%'};return _0x1c0ce6;}})});}_0x1f4699=_[_0xd81e('0x3c')]({},_0x1f4699,_0x5c7ffe['options']);var _0x48a212={'where':_0x1f4699[_0xd81e('0x3a')]};return db[_0xd81e('0x2a')][_0xd81e('0x1d')](_0x48a212)[_0xd81e('0x22')](function(_0x5d4aba){_0x50a4cb['count']=_0x5d4aba;if(_0x5c7ffe['query']['includeAll']){_0x1f4699[_0xd81e('0x3f')]=[{'all':!![]}];}return db[_0xd81e('0x2a')]['findAll'](_0x1f4699);})[_0xd81e('0x22')](function(_0x789586){_0x50a4cb[_0xd81e('0x40')]=_0x789586;return _0x50a4cb;})[_0xd81e('0x22')](respondWithFilteredResult(_0x11a8de,_0x1f4699))['catch'](handleError(_0x11a8de,null));};exports[_0xd81e('0x41')]=function(_0x55797e,_0x2e15f1){var _0x49d2af={'raw':!![],'where':{'id':_0x55797e[_0xd81e('0x42')]['id']}},_0x1379d4={};_0x1379d4[_0xd81e('0x2f')]=_[_0xd81e('0x31')](db['SmsTransferReport'][_0xd81e('0x2b')]);_0x1379d4[_0xd81e('0x30')]=_[_0xd81e('0x31')](_0x55797e[_0xd81e('0x30')]);_0x1379d4[_0xd81e('0x32')]=_['intersection'](_0x1379d4['model'],_0x1379d4[_0xd81e('0x30')]);_0x49d2af[_0xd81e('0x34')]=_[_0xd81e('0x33')](_0x1379d4[_0xd81e('0x2f')],qs[_0xd81e('0x43')](_0x55797e[_0xd81e('0x30')][_0xd81e('0x43')]));_0x49d2af[_0xd81e('0x34')]=_0x49d2af[_0xd81e('0x34')][_0xd81e('0x35')]?_0x49d2af['attributes']:_0x1379d4[_0xd81e('0x2f')];if(_0x55797e['query'][_0xd81e('0x44')]){_0x49d2af[_0xd81e('0x3f')]=[{'all':!![]}];}_0x49d2af=_[_0xd81e('0x3c')]({},_0x49d2af,_0x55797e[_0xd81e('0x45')]);return db[_0xd81e('0x2a')]['find'](_0x49d2af)['then'](handleEntityNotFound(_0x2e15f1,null))[_0xd81e('0x22')](respondWithResult(_0x2e15f1,null))['catch'](handleError(_0x2e15f1,null));};exports[_0xd81e('0x46')]=function(_0x5d74d3,_0x1c4148){return db[_0xd81e('0x2a')][_0xd81e('0x46')](_0x5d74d3[_0xd81e('0x47')],{})[_0xd81e('0x22')](respondWithResult(_0x1c4148,0xc9))['catch'](handleError(_0x1c4148,null));};exports['update']=function(_0x419b4f,_0x30a9dd){if(_0x419b4f[_0xd81e('0x47')]['id']){delete _0x419b4f['body']['id'];}return db[_0xd81e('0x2a')][_0xd81e('0x48')]({'where':{'id':_0x419b4f[_0xd81e('0x42')]['id']}})[_0xd81e('0x22')](handleEntityNotFound(_0x30a9dd,null))[_0xd81e('0x22')](saveUpdates(_0x419b4f[_0xd81e('0x47')],null))[_0xd81e('0x22')](respondWithResult(_0x30a9dd,null))['catch'](handleError(_0x30a9dd,null));};exports[_0xd81e('0x23')]=function(_0x2d11c1,_0x1619c8){return db[_0xd81e('0x2a')][_0xd81e('0x48')]({'where':{'id':_0x2d11c1[_0xd81e('0x42')]['id']}})[_0xd81e('0x22')](handleEntityNotFound(_0x1619c8,null))[_0xd81e('0x22')](removeEntity(_0x1619c8,null))[_0xd81e('0x49')](handleError(_0x1619c8,null));};exports[_0xd81e('0x4a')]=function(_0x5549ac,_0x5227e0){return db[_0xd81e('0x2a')][_0xd81e('0x4a')]()[_0xd81e('0x22')](respondWithResult(_0x5227e0,null))[_0xd81e('0x49')](handleError(_0x5227e0,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index c2b2498..bfa82f1 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 _0xd6d6=['request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x4558a,_0x5648b3){var _0x15df35=function(_0x2bc9f7){while(--_0x2bc9f7){_0x4558a['push'](_0x4558a['shift']());}};_0x15df35(++_0x5648b3);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x7be88a,_0x5d27e1){_0x7be88a=_0x7be88a-0x0;var _0x3e298c=_0xd6d6[_0x7be88a];return _0x3e298c;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'paranoid':![],'indexes':[{'name':_0x6d6d('0xe'),'fields':[_0x6d6d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5b47=['../../config/logger','api','moment','bluebird','path','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','util'];(function(_0x141c05,_0x319076){var _0x25fa28=function(_0x56f1c0){while(--_0x56f1c0){_0x141c05['push'](_0x141c05['shift']());}};_0x25fa28(++_0x319076);}(_0x5b47,0x11d));var _0x75b4=function(_0x44e652,_0x4af87d){_0x44e652=_0x44e652-0x0;var _0x53237a=_0x5b47[_0x44e652];return _0x53237a;};'use strict';var _=require('lodash');var util=require(_0x75b4('0x0'));var logger=require(_0x75b4('0x1'))(_0x75b4('0x2'));var moment=require(_0x75b4('0x3'));var BPromise=require(_0x75b4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x75b4('0x5'));var rimraf=require('rimraf');var config=require(_0x75b4('0x6'));var attributes=require(_0x75b4('0x7'));module[_0x75b4('0x8')]=function(_0x405744,_0x51dc44){return _0x405744[_0x75b4('0x9')](_0x75b4('0xa'),attributes,{'tableName':_0x75b4('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x75b4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index f5ad495..e5bf212 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 _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(_0x236cee,_0x59c80c){var _0x329269=function(_0x5c4224){while(--_0x5c4224){_0x236cee['push'](_0x236cee['shift']());}};_0x329269(++_0x59c80c);}(_0x2a9a,0x64));var _0xa2a9=function(_0x16d160,_0x2a5070){_0x16d160=_0x16d160-0x0;var _0x4f1f9e=_0x2a9a[_0x16d160];return _0x4f1f9e;};'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 +var _0xf185=['SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x584683,_0x46a0a4){var _0x57bbf4=function(_0x3180c6){while(--_0x3180c6){_0x584683['push'](_0x584683['shift']());}};_0x57bbf4(++_0x46a0a4);}(_0xf185,0x1be));var _0x5f18=function(_0x4dc157,_0x14ec7e){_0x4dc157=_0x4dc157-0x0;var _0x14739b=_0xf185[_0x4dc157];return _0x14739b;};'use strict';var _=require(_0x5f18('0x0'));var util=require('util');var moment=require(_0x5f18('0x1'));var BPromise=require(_0x5f18('0x2'));var rs=require(_0x5f18('0x3'));var fs=require('fs');var Redis=require(_0x5f18('0x4'));var db=require(_0x5f18('0x5'))['db'];var utils=require(_0x5f18('0x6'));var logger=require('../../config/logger')(_0x5f18('0x7'));var config=require(_0x5f18('0x8'));var jayson=require(_0x5f18('0x9'));var client=jayson[_0x5f18('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2982d6,_0x3c69ee,_0x47e05a){return new BPromise(function(_0x15b931,_0x4f7c62){return client[_0x5f18('0xb')](_0x2982d6,_0x47e05a)[_0x5f18('0xc')](function(_0x5d84b3){logger[_0x5f18('0xd')](_0x5f18('0xe'),_0x3c69ee,'request\x20sent');logger[_0x5f18('0xf')](_0x5f18('0x10'),_0x3c69ee,'request\x20sent',JSON['stringify'](_0x5d84b3));if(_0x5d84b3[_0x5f18('0x11')]){if(_0x5d84b3[_0x5f18('0x11')][_0x5f18('0x12')]===0x1f4){logger['error'](_0x5f18('0xe'),_0x3c69ee,_0x5d84b3[_0x5f18('0x11')][_0x5f18('0x13')]);return _0x4f7c62(_0x5d84b3[_0x5f18('0x11')][_0x5f18('0x13')]);}logger[_0x5f18('0x11')](_0x5f18('0xe'),_0x3c69ee,_0x5d84b3[_0x5f18('0x11')][_0x5f18('0x13')]);return _0x15b931(_0x5d84b3['error'][_0x5f18('0x13')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x3c69ee,_0x5f18('0x14'));_0x15b931(_0x5d84b3[_0x5f18('0x15')][_0x5f18('0x13')]);}})[_0x5f18('0x16')](function(_0x337ec1){logger['error'](_0x5f18('0xe'),_0x3c69ee,_0x337ec1);_0x4f7c62(_0x337ec1);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index cc4b5a2..fad7d24 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 _0x0a5f=['get','isAuthenticated','index','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller'];(function(_0x102144,_0x13846f){var _0x470515=function(_0x37d03a){while(--_0x37d03a){_0x102144['push'](_0x102144['shift']());}};_0x470515(++_0x13846f);}(_0x0a5f,0x11f));var _0xf0a5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a5f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf0a5('0x0'));var util=require(_0xf0a5('0x1'));var path=require(_0xf0a5('0x2'));var timeout=require(_0xf0a5('0x3'));var express=require(_0xf0a5('0x4'));var router=express[_0xf0a5('0x5')]();var fs_extra=require(_0xf0a5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf0a5('0x7'));var config=require(_0xf0a5('0x8'));var controller=require(_0xf0a5('0x9'));router[_0xf0a5('0xa')]('/',auth[_0xf0a5('0xb')](),controller[_0xf0a5('0xc')]);router[_0xf0a5('0xa')]('/:id',auth[_0xf0a5('0xb')](),controller[_0xf0a5('0xd')]);router['get'](_0xf0a5('0xe'),auth[_0xf0a5('0xb')](),controller[_0xf0a5('0xf')]);var upload=multer({'storage':multer[_0xf0a5('0x10')]({'destination':function(_0x3e80c2,_0x5a4531,_0x2e981a){_0x2e981a(null,path[_0xf0a5('0x11')](config[_0xf0a5('0x12')],'server/files/sounds/original/'));},'filename':function(_0xa90ed8,_0x61cf7a,_0x305341){_0x61cf7a[_0xf0a5('0x13')]=_0x61cf7a['originalname'][_0xf0a5('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x305341(null,util[_0xf0a5('0x15')](_0xf0a5('0x16'),path[_0xf0a5('0x17')](_0x61cf7a[_0xf0a5('0x13')],path[_0xf0a5('0x18')](_0x61cf7a[_0xf0a5('0x13')])),Date[_0xf0a5('0x19')](),path[_0xf0a5('0x18')](_0x61cf7a[_0xf0a5('0x13')])));}})});router[_0xf0a5('0x1a')]('/',upload[_0xf0a5('0x1b')](_0xf0a5('0x1c')),controller['create']);router[_0xf0a5('0x1d')](_0xf0a5('0x1e'),auth['isAuthenticated'](),controller[_0xf0a5('0x1f')]);router[_0xf0a5('0x20')](_0xf0a5('0x1e'),auth['isAuthenticated'](),controller[_0xf0a5('0x20')]);module['exports']=router; \ No newline at end of file +var _0x73cf=['isAuthenticated','index','/:id','/:id/download','diskStorage','join','originalname','basename','extname','now','post','single','file','create','put','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get'];(function(_0x18d244,_0x5d93e4){var _0x21a20f=function(_0x4a29d0){while(--_0x4a29d0){_0x18d244['push'](_0x18d244['shift']());}};_0x21a20f(++_0x5d93e4);}(_0x73cf,0x7d));var _0xf73c=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x73cf[_0x4e9628];return _0x27bc8c;};'use strict';var multer=require(_0xf73c('0x0'));var util=require(_0xf73c('0x1'));var path=require(_0xf73c('0x2'));var timeout=require('connect-timeout');var express=require(_0xf73c('0x3'));var router=express['Router']();var fs_extra=require(_0xf73c('0x4'));var auth=require(_0xf73c('0x5'));var interaction=require(_0xf73c('0x6'));var config=require(_0xf73c('0x7'));var controller=require(_0xf73c('0x8'));router[_0xf73c('0x9')]('/',auth[_0xf73c('0xa')](),controller[_0xf73c('0xb')]);router[_0xf73c('0x9')](_0xf73c('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf73c('0x9')](_0xf73c('0xd'),auth[_0xf73c('0xa')](),controller['download']);var upload=multer({'storage':multer[_0xf73c('0xe')]({'destination':function(_0x15fd8f,_0x1e74f7,_0x43f57f){_0x43f57f(null,path[_0xf73c('0xf')](config['root'],'server/files/sounds/original/'));},'filename':function(_0x9e5740,_0x22e137,_0x57a4c3){_0x22e137[_0xf73c('0x10')]=_0x22e137[_0xf73c('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57a4c3(null,util['format']('%s-%s%s',path[_0xf73c('0x11')](_0x22e137['originalname'],path[_0xf73c('0x12')](_0x22e137[_0xf73c('0x10')])),Date[_0xf73c('0x13')](),path['extname'](_0x22e137[_0xf73c('0x10')])));}})});router[_0xf73c('0x14')]('/',upload[_0xf73c('0x15')](_0xf73c('0x16')),controller[_0xf73c('0x17')]);router[_0xf73c('0x18')](_0xf73c('0xc'),auth[_0xf73c('0xa')](),controller['update']);router[_0xf73c('0x19')](_0xf73c('0xc'),auth[_0xf73c('0xa')](),controller['delete']);module[_0xf73c('0x1a')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index bed16af..6ba7cab 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 _0x5329=['INTEGER','exports','STRING','name','BIGINT'];(function(_0x1c16fb,_0x53ab76){var _0x42eefd=function(_0x1ce237){while(--_0x1ce237){_0x1c16fb['push'](_0x1c16fb['shift']());}};_0x42eefd(++_0x53ab76);}(_0x5329,0xab));var _0x9532=function(_0x5568c7,_0x51859c){_0x5568c7=_0x5568c7-0x0;var _0x4f9a51=_0x5329[_0x5568c7];return _0x4f9a51;};'use strict';var Sequelize=require('sequelize');module[_0x9532('0x0')]={'name':{'type':Sequelize[_0x9532('0x1')],'unique':_0x9532('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x9532('0x1')]},'display_name':{'type':Sequelize[_0x9532('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x9532('0x1')]},'original_format':{'type':Sequelize[_0x9532('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x9532('0x3')]},'original_channelCount':{'type':Sequelize[_0x9532('0x4')]},'original_bitRate':{'type':Sequelize[_0x9532('0x3')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x9532('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x9532('0x3')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x9532('0x4')]}}; \ No newline at end of file +var _0x4104=['sequelize','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x3e030b,_0x459975){var _0x34267c=function(_0x44d37f){while(--_0x44d37f){_0x3e030b['push'](_0x3e030b['shift']());}};_0x34267c(++_0x459975);}(_0x4104,0x1ae));var _0x4410=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x4104[_0x39e84d];return _0x1991bc;};'use strict';var Sequelize=require(_0x4410('0x0'));module['exports']={'name':{'type':Sequelize[_0x4410('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x4410('0x1')]},'display_name':{'type':Sequelize[_0x4410('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x4410('0x1')]},'original_format':{'type':Sequelize[_0x4410('0x1')]},'original_duration':{'type':Sequelize[_0x4410('0x2')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x4410('0x3')]},'original_sampleRate':{'type':Sequelize[_0x4410('0x4')]},'converted_format':{'type':Sequelize[_0x4410('0x1')]},'converted_duration':{'type':Sequelize[_0x4410('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x4410('0x3')]},'converted_channelCount':{'type':Sequelize[_0x4410('0x4')]},'converted_bitRate':{'type':Sequelize[_0x4410('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x4410('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 49b428b..8912a2c 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 _0x8cc0=['type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','findAll','catch','show','include','find','params','save_name','converted_format','existsSync','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','download','join','root','format','%s.%s','create','basename','file','originalname','extname','filename','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','original_duration','duration','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','save','update','then','destroy','Sounds','end','name','send','index','map','Sound','rawAttributes','fieldName'];(function(_0x5e4a29,_0x583698){var _0xb9bc4b=function(_0x66b777){while(--_0x66b777){_0x5e4a29['push'](_0x5e4a29['shift']());}};_0xb9bc4b(++_0x583698);}(_0x8cc0,0xc5));var _0x08cc=function(_0x53210d,_0x77cd02){_0x53210d=_0x53210d-0x0;var _0x34b950=_0x8cc0[_0x53210d];return _0x34b950;};'use strict';var emlformat=require(_0x08cc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x08cc('0x1'));var jsonpatch=require(_0x08cc('0x2'));var rp=require(_0x08cc('0x3'));var moment=require(_0x08cc('0x4'));var BPromise=require(_0x08cc('0x5'));var Mustache=require(_0x08cc('0x6'));var util=require('util');var path=require(_0x08cc('0x7'));var sox=require(_0x08cc('0x8'));var csv=require(_0x08cc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x08cc('0xa'));var _=require(_0x08cc('0xb'));var squel=require('squel');var crypto=require(_0x08cc('0xc'));var jsforce=require(_0x08cc('0xd'));var deskjs=require(_0x08cc('0xe'));var toCsv=require('to-csv');var querystring=require(_0x08cc('0xf'));var Papa=require(_0x08cc('0x10'));var Redis=require(_0x08cc('0x11'));var authService=require(_0x08cc('0x12'));var qs=require(_0x08cc('0x13'));var as=require(_0x08cc('0x14'));var hardwareService=require(_0x08cc('0x15'));var logger=require(_0x08cc('0x16'))(_0x08cc('0x17'));var utils=require('../../config/utils');var config=require(_0x08cc('0x18'));var licenseUtil=require(_0x08cc('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c7915,_0x25b452){_0x25b452=_0x25b452||0xcc;return function(_0xbbc623){if(_0xbbc623){return _0x2c7915[_0x08cc('0x1a')](_0x25b452);}return _0x2c7915[_0x08cc('0x1b')](_0x25b452)['end']();};}function respondWithResult(_0x1cd451,_0x4ef8ad){_0x4ef8ad=_0x4ef8ad||0xc8;return function(_0x3a2554){if(_0x3a2554){return _0x1cd451['status'](_0x4ef8ad)[_0x08cc('0x1c')](_0x3a2554);}};}function respondWithFilteredResult(_0x535031,_0x218f7e){return function(_0x5e3e2d){if(_0x5e3e2d){var _0x41a172=typeof _0x218f7e[_0x08cc('0x1d')]==='undefined'&&typeof _0x218f7e[_0x08cc('0x1e')]===_0x08cc('0x1f');var _0x596af8=_0x5e3e2d[_0x08cc('0x20')];var _0x44112e=_0x41a172?0x0:_0x218f7e['offset'];var _0xcf96de=_0x41a172?_0x5e3e2d[_0x08cc('0x20')]:_0x218f7e[_0x08cc('0x1d')]+_0x218f7e[_0x08cc('0x1e')];var _0x48d051;if(_0xcf96de>=_0x596af8){_0xcf96de=_0x596af8;_0x48d051=0xc8;}else{_0x48d051=0xce;}_0x535031[_0x08cc('0x1b')](_0x48d051);return _0x535031[_0x08cc('0x21')]('Content-Range',_0x44112e+'-'+_0xcf96de+'/'+_0x596af8)[_0x08cc('0x1c')](_0x5e3e2d);}return null;};}function patchUpdates(_0x314c86){return function(_0x594019){try{jsonpatch['apply'](_0x594019,_0x314c86,!![]);}catch(_0x2181fa){return BPromise['reject'](_0x2181fa);}return _0x594019[_0x08cc('0x22')]();};}function saveUpdates(_0x58a516,_0x4a7248){return function(_0xa0b53){if(_0xa0b53){return _0xa0b53[_0x08cc('0x23')](_0x58a516)[_0x08cc('0x24')](function(_0x3263ca){return _0x3263ca;});}return null;};}function removeEntity(_0x4c6557,_0x3d39ac){return function(_0x2543a6){if(_0x2543a6){return _0x2543a6[_0x08cc('0x25')]()[_0x08cc('0x24')](function(){var _0x3df833=_0x2543a6['get']({'plain':!![]});var _0x1b9964=_0x08cc('0x26');return db['UserProfileResource'][_0x08cc('0x25')]({'where':{'type':_0x1b9964,'resourceId':_0x3df833['id']}})[_0x08cc('0x24')](function(){return _0x2543a6;});})[_0x08cc('0x24')](function(){_0x4c6557['status'](0xcc)[_0x08cc('0x27')]();});}};}function handleEntityNotFound(_0x58195f,_0x23b82c){return function(_0x2fcc01){if(!_0x2fcc01){_0x58195f[_0x08cc('0x1a')](0x194);}return _0x2fcc01;};}function handleError(_0x1ae187,_0x4ff3eb){_0x4ff3eb=_0x4ff3eb||0x1f4;return function(_0x1a6608){logger['error'](_0x1a6608['stack']);if(_0x1a6608['name']){delete _0x1a6608[_0x08cc('0x28')];}_0x1ae187['status'](_0x4ff3eb)[_0x08cc('0x29')](_0x1a6608);};}exports[_0x08cc('0x2a')]=function(_0xa6105e,_0x136437){var _0x4b6e50={},_0x4824d8={},_0x34b0fd={'count':0x0,'rows':[]};var _0x2e5275=_[_0x08cc('0x2b')](db[_0x08cc('0x2c')][_0x08cc('0x2d')],function(_0x8db7d2){return{'name':_0x8db7d2[_0x08cc('0x2e')],'type':_0x8db7d2[_0x08cc('0x2f')][_0x08cc('0x30')]};});_0x4824d8[_0x08cc('0x31')]=_[_0x08cc('0x2b')](_0x2e5275,_0x08cc('0x28'));_0x4824d8['query']=_['keys'](_0xa6105e[_0x08cc('0x32')]);_0x4824d8[_0x08cc('0x33')]=_[_0x08cc('0x34')](_0x4824d8['model'],_0x4824d8[_0x08cc('0x32')]);_0x4b6e50[_0x08cc('0x35')]=_[_0x08cc('0x34')](_0x4824d8[_0x08cc('0x31')],qs[_0x08cc('0x36')](_0xa6105e[_0x08cc('0x32')][_0x08cc('0x36')]));_0x4b6e50['attributes']=_0x4b6e50['attributes'][_0x08cc('0x37')]?_0x4b6e50[_0x08cc('0x35')]:_0x4824d8[_0x08cc('0x31')];if(!_0xa6105e[_0x08cc('0x32')]['hasOwnProperty'](_0x08cc('0x38'))){_0x4b6e50[_0x08cc('0x1e')]=qs[_0x08cc('0x1e')](_0xa6105e[_0x08cc('0x32')]['limit']);_0x4b6e50[_0x08cc('0x1d')]=qs[_0x08cc('0x1d')](_0xa6105e[_0x08cc('0x32')]['offset']);}_0x4b6e50[_0x08cc('0x39')]=qs[_0x08cc('0x3a')](_0xa6105e[_0x08cc('0x32')]['sort']);_0x4b6e50[_0x08cc('0x3b')]=qs[_0x08cc('0x33')](_[_0x08cc('0x3c')](_0xa6105e[_0x08cc('0x32')],_0x4824d8[_0x08cc('0x33')]),_0x2e5275);if(_0xa6105e[_0x08cc('0x32')][_0x08cc('0x3d')]){_0x4b6e50[_0x08cc('0x3b')]=_['merge'](_0x4b6e50[_0x08cc('0x3b')],{'$or':_[_0x08cc('0x2b')](_0x2e5275,function(_0x163c09){if(_0x163c09['type']!==_0x08cc('0x3e')){var _0x5c6557={};_0x5c6557[_0x163c09[_0x08cc('0x28')]]={'$like':'%'+_0xa6105e[_0x08cc('0x32')]['filter']+'%'};return _0x5c6557;}})});}_0x4b6e50=_['merge']({},_0x4b6e50,_0xa6105e[_0x08cc('0x3f')]);var _0xe910={'where':_0x4b6e50[_0x08cc('0x3b')]};return db['Sound'][_0x08cc('0x20')](_0xe910)[_0x08cc('0x24')](function(_0x88c716){_0x34b0fd[_0x08cc('0x20')]=_0x88c716;if(_0xa6105e[_0x08cc('0x32')]['includeAll']){_0x4b6e50['include']=[{'all':!![]}];}return db[_0x08cc('0x2c')][_0x08cc('0x40')](_0x4b6e50);})[_0x08cc('0x24')](function(_0x1018dc){_0x34b0fd['rows']=_0x1018dc;return _0x34b0fd;})[_0x08cc('0x24')](respondWithFilteredResult(_0x136437,_0x4b6e50))[_0x08cc('0x41')](handleError(_0x136437,null));};exports[_0x08cc('0x42')]=function(_0xa7211b,_0x399591){var _0x598a17={'raw':!![],'where':{'id':_0xa7211b['params']['id']}},_0x49fcef={};_0x49fcef[_0x08cc('0x31')]=_['keys'](db[_0x08cc('0x2c')]['rawAttributes']);_0x49fcef[_0x08cc('0x32')]=_['keys'](_0xa7211b[_0x08cc('0x32')]);_0x49fcef[_0x08cc('0x33')]=_[_0x08cc('0x34')](_0x49fcef[_0x08cc('0x31')],_0x49fcef['query']);_0x598a17[_0x08cc('0x35')]=_[_0x08cc('0x34')](_0x49fcef[_0x08cc('0x31')],qs[_0x08cc('0x36')](_0xa7211b['query']['fields']));_0x598a17[_0x08cc('0x35')]=_0x598a17[_0x08cc('0x35')]['length']?_0x598a17[_0x08cc('0x35')]:_0x49fcef[_0x08cc('0x31')];if(_0xa7211b[_0x08cc('0x32')]['includeAll']){_0x598a17[_0x08cc('0x43')]=[{'all':!![]}];}_0x598a17=_['merge']({},_0x598a17,_0xa7211b[_0x08cc('0x3f')]);return db[_0x08cc('0x2c')][_0x08cc('0x44')](_0x598a17)[_0x08cc('0x24')](handleEntityNotFound(_0x399591,null))[_0x08cc('0x24')](respondWithResult(_0x399591,null))[_0x08cc('0x41')](handleError(_0x399591,null));};exports['download']=function(_0x2c62e9,_0x2134f3,_0x163170){return db['Sound'][_0x08cc('0x44')]({'where':{'id':_0x2c62e9[_0x08cc('0x45')]['id']},'attributes':[_0x08cc('0x28'),_0x08cc('0x46'),_0x08cc('0x47')],'raw':!![]})['then'](handleEntityNotFound(_0x2134f3,null))['then'](function(_0x35133e){if(_0x35133e){if(!fs[_0x08cc('0x48')](path['join'](config['root'],_0x08cc('0x49'),_0x35133e['save_name']+'.'+_0x35133e[_0x08cc('0x47')]))){throw new db[(_0x08cc('0x4a'))]['ValidationError'](_0x08cc('0x4b'));}return _0x2134f3[_0x08cc('0x4c')](path[_0x08cc('0x4d')](config[_0x08cc('0x4e')],'server/files/sounds/converted',util[_0x08cc('0x4f')]('%s.%s',_0x35133e[_0x08cc('0x46')],_0x35133e[_0x08cc('0x47')])),util['format'](_0x08cc('0x50'),_0x35133e[_0x08cc('0x28')],_0x35133e[_0x08cc('0x47')]));}return null;})[_0x08cc('0x41')](handleError(_0x2134f3,null));};exports[_0x08cc('0x51')]=function(_0x33d1eb,_0x307f9a,_0x3bfe1f){var _0x46dc6d={'name':path[_0x08cc('0x52')](_0x33d1eb[_0x08cc('0x53')][_0x08cc('0x54')],path[_0x08cc('0x55')](_0x33d1eb[_0x08cc('0x53')][_0x08cc('0x54')])),'save_name':path[_0x08cc('0x52')](_0x33d1eb[_0x08cc('0x53')][_0x08cc('0x56')],path[_0x08cc('0x55')](_0x33d1eb[_0x08cc('0x53')][_0x08cc('0x56')])),'original_format':path['extname'](_0x33d1eb[_0x08cc('0x53')][_0x08cc('0x54')])['substring'](0x1),'converted_format':_0x08cc('0x57')};var _0x14240e=path['join'](config[_0x08cc('0x4e')],_0x08cc('0x58'),_0x33d1eb[_0x08cc('0x53')][_0x08cc('0x56')]);var _0x3fa220=path[_0x08cc('0x4d')](config[_0x08cc('0x4e')],_0x08cc('0x49'),util[_0x08cc('0x4f')](_0x08cc('0x50'),path[_0x08cc('0x52')](_0x33d1eb[_0x08cc('0x53')][_0x08cc('0x56')],path['extname'](_0x33d1eb[_0x08cc('0x53')][_0x08cc('0x56')])),_0x46dc6d[_0x08cc('0x47')]));logger[_0x08cc('0x59')](_0x08cc('0x5a'),_0x14240e);logger[_0x08cc('0x59')](_0x08cc('0x5b'),_0x3fa220);try{fs[_0x08cc('0x5c')](_0x14240e,parseInt(_0x08cc('0x5d'),0x8));var _0xabac6c=sox[_0x08cc('0x5e')](_0x14240e,_0x3fa220,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xabac6c['on'](_0x08cc('0x5f'),function(_0x575d17){fs[_0x08cc('0x60')](_0x14240e);_0x307f9a[_0x08cc('0x1b')](0x1f4)[_0x08cc('0x29')](_0x575d17);});_0xabac6c['on']('src',function(_0x186cc8){_0x46dc6d[_0x08cc('0x61')]=isNaN(_0x186cc8[_0x08cc('0x62')])?null:_0x186cc8[_0x08cc('0x62')]*0x3e8;_0x46dc6d['original_sampleCount']=isNaN(_0x186cc8[_0x08cc('0x63')])?null:_0x186cc8[_0x08cc('0x63')];_0x46dc6d['original_channelCount']=isNaN(_0x186cc8['channelCount'])?null:_0x186cc8[_0x08cc('0x64')];_0x46dc6d[_0x08cc('0x65')]=isNaN(_0x186cc8[_0x08cc('0x66')])?null:_0x186cc8[_0x08cc('0x66')];_0x46dc6d[_0x08cc('0x67')]=isNaN(_0x186cc8[_0x08cc('0x68')])?null:_0x186cc8[_0x08cc('0x68')];});_0xabac6c['on']('dest',function(_0x21cae0){_0x46dc6d[_0x08cc('0x69')]=isNaN(_0x21cae0[_0x08cc('0x62')])?null:_0x21cae0['duration']*0x3e8;_0x46dc6d[_0x08cc('0x6a')]=isNaN(_0x21cae0[_0x08cc('0x63')])?null:_0x21cae0['sampleCount'];_0x46dc6d[_0x08cc('0x6b')]=isNaN(_0x21cae0[_0x08cc('0x64')])?null:_0x21cae0[_0x08cc('0x64')];_0x46dc6d[_0x08cc('0x6c')]=isNaN(_0x21cae0[_0x08cc('0x66')])?null:_0x21cae0[_0x08cc('0x66')];_0x46dc6d[_0x08cc('0x6d')]=isNaN(_0x21cae0[_0x08cc('0x68')])?null:_0x21cae0[_0x08cc('0x68')];});_0xabac6c['on'](_0x08cc('0x27'),function(){fs[_0x08cc('0x5c')](_0x3fa220,parseInt(_0x08cc('0x5d'),0x8));return db[_0x08cc('0x2c')][_0x08cc('0x51')](_0x46dc6d)['then'](function(_0x3e268f){var _0x1abef1={'role':_0x33d1eb[_0x08cc('0x6e')][_0x08cc('0x6f')],'userProfileId':_0x33d1eb[_0x08cc('0x6e')][_0x08cc('0x70')]};if(!_0x1abef1)throw new Error(_0x08cc('0x71'));if(_0x1abef1[_0x08cc('0x6f')]===_0x08cc('0x72')){var _0x174215=_0x3e268f['get']({'plain':!![]});return db[_0x08cc('0x73')][_0x08cc('0x44')]({'where':{'name':_0x08cc('0x26'),'userProfileId':_0x1abef1['userProfileId']},'raw':!![]})[_0x08cc('0x24')](function(_0x1c61ba){if(_0x1c61ba&&_0x1c61ba[_0x08cc('0x74')]===0x0){return db[_0x08cc('0x75')]['create']({'name':_0x174215[_0x08cc('0x28')],'resourceId':_0x174215['id'],'type':_0x1c61ba[_0x08cc('0x28')],'sectionId':_0x1c61ba['id']},{})['then'](function(){return _0x3e268f;});}else{return _0x3e268f;}})[_0x08cc('0x41')](function(_0x14250f){logger[_0x08cc('0x5f')](_0x08cc('0x76'),_0x14250f);throw _0x14250f;});}return _0x3e268f;})[_0x08cc('0x24')](respondWithResult(_0x307f9a,null))['catch'](handleError(_0x307f9a,null));});_0xabac6c[_0x08cc('0x77')]();}catch(_0x548be4){_0x307f9a[_0x08cc('0x1b')](0x1f4)['send'](_0x548be4);}};exports[_0x08cc('0x23')]=function(_0x3ca1e7,_0x1e391f,_0x41eee4){return db[_0x08cc('0x2c')][_0x08cc('0x44')]({'where':{'id':_0x3ca1e7[_0x08cc('0x45')]['id']}})['then'](handleEntityNotFound(_0x1e391f,null))[_0x08cc('0x24')](saveUpdates(_['pick'](_0x3ca1e7[_0x08cc('0x6e')],['name','description']),null))[_0x08cc('0x24')](respondWithResult(_0x1e391f,null))['catch'](handleError(_0x1e391f,null));};exports[_0x08cc('0x78')]=function(_0x31e168,_0xab3a56,_0x47b38f){return db[_0x08cc('0x2c')][_0x08cc('0x44')]({'where':{'id':_0x31e168[_0x08cc('0x45')]['id']}})[_0x08cc('0x24')](function(_0x848153){if(_0x848153){return _0x848153['destroy']();}})['then'](function(_0x51d2d9){var _0x2e4a6f=path['join'](config[_0x08cc('0x4e')],_0x08cc('0x58'),util[_0x08cc('0x4f')](_0x08cc('0x50'),_0x51d2d9[_0x08cc('0x46')],_0x51d2d9[_0x08cc('0x79')]));var _0x109ea8=path[_0x08cc('0x4d')](config[_0x08cc('0x4e')],_0x08cc('0x49'),util[_0x08cc('0x4f')](_0x08cc('0x50'),_0x51d2d9[_0x08cc('0x46')],_0x51d2d9['converted_format']));fs[_0x08cc('0x60')](_0x2e4a6f);fs[_0x08cc('0x60')](_0x109ea8);return _0x51d2d9;})['then'](function(_0x28da33){if(_0x28da33){return _0xab3a56['status'](0xcc)[_0x08cc('0x27')]();}})['then'](handleEntityNotFound(_0xab3a56,null))[_0x08cc('0x41')](handleError(_0xab3a56,null));}; \ No newline at end of file +var _0x4fd4=['info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','wav','error','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_bitRate','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','delete','original_format','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','Sounds','UserProfileResource','sendStatus','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','save_name','converted_format','existsSync','join','root','ValidationError','server/files/sounds/converted','format','%s.%s','create','file','originalname','extname','basename','filename','server/files/sounds/original'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4fd4,0x121));var _0x44fd=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4fd4[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x44fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x44fd('0x1'));var jsonpatch=require(_0x44fd('0x2'));var rp=require(_0x44fd('0x3'));var moment=require('moment');var BPromise=require(_0x44fd('0x4'));var Mustache=require(_0x44fd('0x5'));var util=require(_0x44fd('0x6'));var path=require(_0x44fd('0x7'));var sox=require(_0x44fd('0x8'));var csv=require(_0x44fd('0x9'));var ejs=require(_0x44fd('0xa'));var fs=require('fs');var fs_extra=require(_0x44fd('0xb'));var _=require(_0x44fd('0xc'));var squel=require('squel');var crypto=require(_0x44fd('0xd'));var jsforce=require(_0x44fd('0xe'));var deskjs=require(_0x44fd('0xf'));var toCsv=require(_0x44fd('0x9'));var querystring=require(_0x44fd('0x10'));var Papa=require(_0x44fd('0x11'));var Redis=require(_0x44fd('0x12'));var authService=require(_0x44fd('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x44fd('0x14'));var logger=require(_0x44fd('0x15'))(_0x44fd('0x16'));var utils=require(_0x44fd('0x17'));var config=require(_0x44fd('0x18'));var licenseUtil=require(_0x44fd('0x19'));var db=require(_0x44fd('0x1a'))['db'];function respondWithStatusCode(_0x42b80a,_0x1db3e0){_0x1db3e0=_0x1db3e0||0xcc;return function(_0xc0a5b0){if(_0xc0a5b0){return _0x42b80a['sendStatus'](_0x1db3e0);}return _0x42b80a[_0x44fd('0x1b')](_0x1db3e0)[_0x44fd('0x1c')]();};}function respondWithResult(_0x414a74,_0x4da777){_0x4da777=_0x4da777||0xc8;return function(_0x332fe5){if(_0x332fe5){return _0x414a74['status'](_0x4da777)[_0x44fd('0x1d')](_0x332fe5);}};}function respondWithFilteredResult(_0x2460cd,_0x3c0029){return function(_0x3f1124){if(_0x3f1124){var _0xef160a=typeof _0x3c0029[_0x44fd('0x1e')]===_0x44fd('0x1f')&&typeof _0x3c0029[_0x44fd('0x20')]===_0x44fd('0x1f');var _0x46f275=_0x3f1124[_0x44fd('0x21')];var _0x24dbff=_0xef160a?0x0:_0x3c0029[_0x44fd('0x1e')];var _0x2c1d4a=_0xef160a?_0x3f1124[_0x44fd('0x21')]:_0x3c0029[_0x44fd('0x1e')]+_0x3c0029[_0x44fd('0x20')];var _0x207b3e;if(_0x2c1d4a>=_0x46f275){_0x2c1d4a=_0x46f275;_0x207b3e=0xc8;}else{_0x207b3e=0xce;}_0x2460cd[_0x44fd('0x1b')](_0x207b3e);return _0x2460cd['set'](_0x44fd('0x22'),_0x24dbff+'-'+_0x2c1d4a+'/'+_0x46f275)[_0x44fd('0x1d')](_0x3f1124);}return null;};}function patchUpdates(_0x29f555){return function(_0x6076d7){try{jsonpatch['apply'](_0x6076d7,_0x29f555,!![]);}catch(_0x5ed32e){return BPromise[_0x44fd('0x23')](_0x5ed32e);}return _0x6076d7[_0x44fd('0x24')]();};}function saveUpdates(_0x212553,_0x3dc01f){return function(_0x4caedc){if(_0x4caedc){return _0x4caedc['update'](_0x212553)[_0x44fd('0x25')](function(_0x2845b3){return _0x2845b3;});}return null;};}function removeEntity(_0x56a488,_0x33abd6){return function(_0x441313){if(_0x441313){return _0x441313[_0x44fd('0x26')]()[_0x44fd('0x25')](function(){var _0x1fce30=_0x441313['get']({'plain':!![]});var _0x558a6a=_0x44fd('0x27');return db[_0x44fd('0x28')][_0x44fd('0x26')]({'where':{'type':_0x558a6a,'resourceId':_0x1fce30['id']}})[_0x44fd('0x25')](function(){return _0x441313;});})[_0x44fd('0x25')](function(){_0x56a488['status'](0xcc)[_0x44fd('0x1c')]();});}};}function handleEntityNotFound(_0x1def66,_0x42b343){return function(_0x100741){if(!_0x100741){_0x1def66[_0x44fd('0x29')](0x194);}return _0x100741;};}function handleError(_0x400023,_0x43cf62){_0x43cf62=_0x43cf62||0x1f4;return function(_0x5530eb){logger['error'](_0x5530eb[_0x44fd('0x2a')]);if(_0x5530eb['name']){delete _0x5530eb[_0x44fd('0x2b')];}_0x400023[_0x44fd('0x1b')](_0x43cf62)[_0x44fd('0x2c')](_0x5530eb);};}exports[_0x44fd('0x2d')]=function(_0xa0404d,_0x1c7023){var _0x33d387={},_0x58ef3c={},_0x42dcf9={'count':0x0,'rows':[]};var _0x341389=_[_0x44fd('0x2e')](db[_0x44fd('0x2f')][_0x44fd('0x30')],function(_0x418cc9){return{'name':_0x418cc9[_0x44fd('0x31')],'type':_0x418cc9[_0x44fd('0x32')][_0x44fd('0x33')]};});_0x58ef3c[_0x44fd('0x34')]=_['map'](_0x341389,_0x44fd('0x2b'));_0x58ef3c[_0x44fd('0x35')]=_[_0x44fd('0x36')](_0xa0404d[_0x44fd('0x35')]);_0x58ef3c['filters']=_[_0x44fd('0x37')](_0x58ef3c[_0x44fd('0x34')],_0x58ef3c['query']);_0x33d387[_0x44fd('0x38')]=_[_0x44fd('0x37')](_0x58ef3c[_0x44fd('0x34')],qs[_0x44fd('0x39')](_0xa0404d[_0x44fd('0x35')][_0x44fd('0x39')]));_0x33d387['attributes']=_0x33d387[_0x44fd('0x38')][_0x44fd('0x3a')]?_0x33d387[_0x44fd('0x38')]:_0x58ef3c['model'];if(!_0xa0404d['query']['hasOwnProperty'](_0x44fd('0x3b'))){_0x33d387[_0x44fd('0x20')]=qs[_0x44fd('0x20')](_0xa0404d[_0x44fd('0x35')][_0x44fd('0x20')]);_0x33d387['offset']=qs[_0x44fd('0x1e')](_0xa0404d['query'][_0x44fd('0x1e')]);}_0x33d387[_0x44fd('0x3c')]=qs[_0x44fd('0x3d')](_0xa0404d[_0x44fd('0x35')][_0x44fd('0x3d')]);_0x33d387[_0x44fd('0x3e')]=qs[_0x44fd('0x3f')](_[_0x44fd('0x40')](_0xa0404d['query'],_0x58ef3c[_0x44fd('0x3f')]),_0x341389);if(_0xa0404d[_0x44fd('0x35')]['filter']){_0x33d387[_0x44fd('0x3e')]=_[_0x44fd('0x41')](_0x33d387[_0x44fd('0x3e')],{'$or':_[_0x44fd('0x2e')](_0x341389,function(_0xbf7bd3){if(_0xbf7bd3[_0x44fd('0x32')]!==_0x44fd('0x42')){var _0x24122e={};_0x24122e[_0xbf7bd3[_0x44fd('0x2b')]]={'$like':'%'+_0xa0404d[_0x44fd('0x35')]['filter']+'%'};return _0x24122e;}})});}_0x33d387=_['merge']({},_0x33d387,_0xa0404d[_0x44fd('0x43')]);var _0x1188af={'where':_0x33d387[_0x44fd('0x3e')]};return db[_0x44fd('0x2f')]['count'](_0x1188af)['then'](function(_0x5f0dba){_0x42dcf9[_0x44fd('0x21')]=_0x5f0dba;if(_0xa0404d[_0x44fd('0x35')][_0x44fd('0x44')]){_0x33d387[_0x44fd('0x45')]=[{'all':!![]}];}return db['Sound'][_0x44fd('0x46')](_0x33d387);})[_0x44fd('0x25')](function(_0x5914a8){_0x42dcf9[_0x44fd('0x47')]=_0x5914a8;return _0x42dcf9;})[_0x44fd('0x25')](respondWithFilteredResult(_0x1c7023,_0x33d387))['catch'](handleError(_0x1c7023,null));};exports[_0x44fd('0x48')]=function(_0x1fdd9c,_0x1e8fea){var _0xf7fc5f={'raw':!![],'where':{'id':_0x1fdd9c[_0x44fd('0x49')]['id']}},_0x14157d={};_0x14157d[_0x44fd('0x34')]=_[_0x44fd('0x36')](db[_0x44fd('0x2f')][_0x44fd('0x30')]);_0x14157d[_0x44fd('0x35')]=_[_0x44fd('0x36')](_0x1fdd9c[_0x44fd('0x35')]);_0x14157d[_0x44fd('0x3f')]=_[_0x44fd('0x37')](_0x14157d[_0x44fd('0x34')],_0x14157d[_0x44fd('0x35')]);_0xf7fc5f[_0x44fd('0x38')]=_[_0x44fd('0x37')](_0x14157d[_0x44fd('0x34')],qs[_0x44fd('0x39')](_0x1fdd9c[_0x44fd('0x35')]['fields']));_0xf7fc5f[_0x44fd('0x38')]=_0xf7fc5f[_0x44fd('0x38')]['length']?_0xf7fc5f[_0x44fd('0x38')]:_0x14157d[_0x44fd('0x34')];if(_0x1fdd9c[_0x44fd('0x35')]['includeAll']){_0xf7fc5f[_0x44fd('0x45')]=[{'all':!![]}];}_0xf7fc5f=_[_0x44fd('0x41')]({},_0xf7fc5f,_0x1fdd9c[_0x44fd('0x43')]);return db['Sound'][_0x44fd('0x4a')](_0xf7fc5f)['then'](handleEntityNotFound(_0x1e8fea,null))[_0x44fd('0x25')](respondWithResult(_0x1e8fea,null))[_0x44fd('0x4b')](handleError(_0x1e8fea,null));};exports['download']=function(_0x43914f,_0x3367c1,_0x4a948c){return db['Sound'][_0x44fd('0x4a')]({'where':{'id':_0x43914f[_0x44fd('0x49')]['id']},'attributes':[_0x44fd('0x2b'),_0x44fd('0x4c'),_0x44fd('0x4d')],'raw':!![]})[_0x44fd('0x25')](handleEntityNotFound(_0x3367c1,null))[_0x44fd('0x25')](function(_0x4f4911){if(_0x4f4911){if(!fs[_0x44fd('0x4e')](path[_0x44fd('0x4f')](config[_0x44fd('0x50')],'server/files/sounds/converted',_0x4f4911['save_name']+'.'+_0x4f4911['converted_format']))){throw new db['Sequelize'][(_0x44fd('0x51'))]('Sound\x20not\x20found');}return _0x3367c1['download'](path[_0x44fd('0x4f')](config[_0x44fd('0x50')],_0x44fd('0x52'),util[_0x44fd('0x53')](_0x44fd('0x54'),_0x4f4911['save_name'],_0x4f4911['converted_format'])),util[_0x44fd('0x53')](_0x44fd('0x54'),_0x4f4911[_0x44fd('0x2b')],_0x4f4911[_0x44fd('0x4d')]));}return null;})[_0x44fd('0x4b')](handleError(_0x3367c1,null));};exports[_0x44fd('0x55')]=function(_0x3942dd,_0x208651,_0x3d9a39){var _0xdf19a9={'name':path['basename'](_0x3942dd[_0x44fd('0x56')][_0x44fd('0x57')],path[_0x44fd('0x58')](_0x3942dd[_0x44fd('0x56')]['originalname'])),'save_name':path[_0x44fd('0x59')](_0x3942dd[_0x44fd('0x56')][_0x44fd('0x5a')],path[_0x44fd('0x58')](_0x3942dd[_0x44fd('0x56')][_0x44fd('0x5a')])),'original_format':path['extname'](_0x3942dd['file'][_0x44fd('0x57')])['substring'](0x1),'converted_format':'wav'};var _0x198605=path[_0x44fd('0x4f')](config['root'],_0x44fd('0x5b'),_0x3942dd[_0x44fd('0x56')]['filename']);var _0x29875b=path[_0x44fd('0x4f')](config[_0x44fd('0x50')],'server/files/sounds/converted',util[_0x44fd('0x53')]('%s.%s',path[_0x44fd('0x59')](_0x3942dd['file'][_0x44fd('0x5a')],path[_0x44fd('0x58')](_0x3942dd[_0x44fd('0x56')][_0x44fd('0x5a')])),_0xdf19a9[_0x44fd('0x4d')]));logger[_0x44fd('0x5c')](_0x44fd('0x5d'),_0x198605);logger[_0x44fd('0x5c')](_0x44fd('0x5e'),_0x29875b);try{fs[_0x44fd('0x5f')](_0x198605,parseInt('0777',0x8));var _0x6f0a12=sox[_0x44fd('0x60')](_0x198605,_0x29875b,{'sampleRate':0x1f40,'format':_0x44fd('0x61'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x6f0a12['on'](_0x44fd('0x62'),function(_0x29471d){fs[_0x44fd('0x63')](_0x198605);_0x208651[_0x44fd('0x1b')](0x1f4)[_0x44fd('0x2c')](_0x29471d);});_0x6f0a12['on'](_0x44fd('0x64'),function(_0x4710f0){_0xdf19a9[_0x44fd('0x65')]=isNaN(_0x4710f0[_0x44fd('0x66')])?null:_0x4710f0[_0x44fd('0x66')]*0x3e8;_0xdf19a9[_0x44fd('0x67')]=isNaN(_0x4710f0[_0x44fd('0x68')])?null:_0x4710f0[_0x44fd('0x68')];_0xdf19a9['original_channelCount']=isNaN(_0x4710f0[_0x44fd('0x69')])?null:_0x4710f0[_0x44fd('0x69')];_0xdf19a9[_0x44fd('0x6a')]=isNaN(_0x4710f0['bitRate'])?null:_0x4710f0[_0x44fd('0x6b')];_0xdf19a9[_0x44fd('0x6c')]=isNaN(_0x4710f0['sampleRate'])?null:_0x4710f0[_0x44fd('0x6d')];});_0x6f0a12['on']('dest',function(_0x366994){_0xdf19a9[_0x44fd('0x6e')]=isNaN(_0x366994[_0x44fd('0x66')])?null:_0x366994[_0x44fd('0x66')]*0x3e8;_0xdf19a9[_0x44fd('0x6f')]=isNaN(_0x366994[_0x44fd('0x68')])?null:_0x366994[_0x44fd('0x68')];_0xdf19a9['converted_channelCount']=isNaN(_0x366994[_0x44fd('0x69')])?null:_0x366994[_0x44fd('0x69')];_0xdf19a9[_0x44fd('0x70')]=isNaN(_0x366994[_0x44fd('0x6b')])?null:_0x366994[_0x44fd('0x6b')];_0xdf19a9['converted_sampleRate']=isNaN(_0x366994[_0x44fd('0x6d')])?null:_0x366994[_0x44fd('0x6d')];});_0x6f0a12['on'](_0x44fd('0x1c'),function(){fs[_0x44fd('0x5f')](_0x29875b,parseInt(_0x44fd('0x71'),0x8));return db[_0x44fd('0x2f')][_0x44fd('0x55')](_0xdf19a9)['then'](function(_0x460e3b){var _0x2e3ef4={'role':_0x3942dd[_0x44fd('0x72')][_0x44fd('0x73')],'userProfileId':_0x3942dd[_0x44fd('0x72')][_0x44fd('0x74')]};if(!_0x2e3ef4)throw new Error(_0x44fd('0x75'));if(_0x2e3ef4[_0x44fd('0x73')]===_0x44fd('0x76')){var _0x2c2ba9=_0x460e3b[_0x44fd('0x77')]({'plain':!![]});return db[_0x44fd('0x78')]['find']({'where':{'name':_0x44fd('0x27'),'userProfileId':_0x2e3ef4[_0x44fd('0x74')]},'raw':!![]})[_0x44fd('0x25')](function(_0x3e6b51){if(_0x3e6b51&&_0x3e6b51[_0x44fd('0x79')]===0x0){return db[_0x44fd('0x28')]['create']({'name':_0x2c2ba9[_0x44fd('0x2b')],'resourceId':_0x2c2ba9['id'],'type':_0x3e6b51[_0x44fd('0x2b')],'sectionId':_0x3e6b51['id']},{})['then'](function(){return _0x460e3b;});}else{return _0x460e3b;}})[_0x44fd('0x4b')](function(_0x4eb837){logger[_0x44fd('0x62')](_0x44fd('0x7a'),_0x4eb837);throw _0x4eb837;});}return _0x460e3b;})[_0x44fd('0x25')](respondWithResult(_0x208651,null))[_0x44fd('0x4b')](handleError(_0x208651,null));});_0x6f0a12[_0x44fd('0x7b')]();}catch(_0x301749){_0x208651[_0x44fd('0x1b')](0x1f4)[_0x44fd('0x2c')](_0x301749);}};exports[_0x44fd('0x7c')]=function(_0x15e1ae,_0x2164bd,_0x191cf2){return db['Sound'][_0x44fd('0x4a')]({'where':{'id':_0x15e1ae[_0x44fd('0x49')]['id']}})[_0x44fd('0x25')](handleEntityNotFound(_0x2164bd,null))['then'](saveUpdates(_[_0x44fd('0x40')](_0x15e1ae['body'],[_0x44fd('0x2b'),'description']),null))['then'](respondWithResult(_0x2164bd,null))[_0x44fd('0x4b')](handleError(_0x2164bd,null));};exports[_0x44fd('0x7d')]=function(_0x2ad4e3,_0x35559f,_0x5062a4){return db['Sound'][_0x44fd('0x4a')]({'where':{'id':_0x2ad4e3[_0x44fd('0x49')]['id']}})[_0x44fd('0x25')](function(_0xb7a6d7){if(_0xb7a6d7){return _0xb7a6d7[_0x44fd('0x26')]();}})[_0x44fd('0x25')](function(_0x33bdf0){var _0x3cfd29=path[_0x44fd('0x4f')](config[_0x44fd('0x50')],'server/files/sounds/original',util[_0x44fd('0x53')](_0x44fd('0x54'),_0x33bdf0[_0x44fd('0x4c')],_0x33bdf0[_0x44fd('0x7e')]));var _0x326f95=path[_0x44fd('0x4f')](config[_0x44fd('0x50')],'server/files/sounds/converted',util[_0x44fd('0x53')](_0x44fd('0x54'),_0x33bdf0['save_name'],_0x33bdf0[_0x44fd('0x4d')]));fs[_0x44fd('0x63')](_0x3cfd29);fs[_0x44fd('0x63')](_0x326f95);return _0x33bdf0;})['then'](function(_0x3e6dfc){if(_0x3e6dfc){return _0x35559f['status'](0xcc)[_0x44fd('0x1c')]();}})[_0x44fd('0x25')](handleEntityNotFound(_0x35559f,null))[_0x44fd('0x4b')](handleError(_0x35559f,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index e01a5f2..8767b62 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 _0x1bb1=['moment','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger'];(function(_0x455dde,_0x58cc0d){var _0x2de320=function(_0x4ba9c0){while(--_0x4ba9c0){_0x455dde['push'](_0x455dde['shift']());}};_0x2de320(++_0x58cc0d);}(_0x1bb1,0x14f));var _0x11bb=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1bb1[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x11bb('0x0'));var util=require(_0x11bb('0x1'));var logger=require(_0x11bb('0x2'))('api');var moment=require(_0x11bb('0x3'));var BPromise=require('bluebird');var rp=require(_0x11bb('0x4'));var fs=require('fs');var path=require(_0x11bb('0x5'));var rimraf=require(_0x11bb('0x6'));var config=require(_0x11bb('0x7'));var attributes=require(_0x11bb('0x8'));module[_0x11bb('0x9')]=function(_0x2614af,_0x286167){return _0x2614af[_0x11bb('0xa')](_0x11bb('0xb'),attributes,{'tableName':_0x11bb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6124=['tools_sounds','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports'];(function(_0x5522b6,_0x1aad4d){var _0xba4a4c=function(_0x31d39e){while(--_0x31d39e){_0x5522b6['push'](_0x5522b6['shift']());}};_0xba4a4c(++_0x1aad4d);}(_0x6124,0xcd));var _0x4612=function(_0x1ed04d,_0x3b091e){_0x1ed04d=_0x1ed04d-0x0;var _0x5a17c1=_0x6124[_0x1ed04d];return _0x5a17c1;};'use strict';var _=require(_0x4612('0x0'));var util=require(_0x4612('0x1'));var logger=require(_0x4612('0x2'))('api');var moment=require(_0x4612('0x3'));var BPromise=require(_0x4612('0x4'));var rp=require(_0x4612('0x5'));var fs=require('fs');var path=require(_0x4612('0x6'));var rimraf=require(_0x4612('0x7'));var config=require(_0x4612('0x8'));var attributes=require(_0x4612('0x9'));module[_0x4612('0xa')]=function(_0x20bb2c,_0x5af7fc){return _0x20bb2c['define']('Sound',attributes,{'tableName':_0x4612('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 28fe000..1128ae0 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 _0x620c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Sound','options','raw','where','attributes','include','map','model','ShowSound','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x437348,_0x255669){var _0x3317f7=function(_0x5a0fee){while(--_0x5a0fee){_0x437348['push'](_0x437348['shift']());}};_0x3317f7(++_0x255669);}(_0x620c,0xcb));var _0xc620=function(_0x5bbfb8,_0x310c98){_0x5bbfb8=_0x5bbfb8-0x0;var _0x249782=_0x620c[_0x5bbfb8];return _0x249782;};'use strict';var _=require(_0xc620('0x0'));var util=require(_0xc620('0x1'));var moment=require(_0xc620('0x2'));var BPromise=require(_0xc620('0x3'));var rs=require(_0xc620('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc620('0x5'))['db'];var utils=require(_0xc620('0x6'));var logger=require(_0xc620('0x7'))(_0xc620('0x8'));var config=require(_0xc620('0x9'));var jayson=require(_0xc620('0xa'));var client=jayson[_0xc620('0xb')][_0xc620('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32edc8,_0x2360c5,_0x558737){return new BPromise(function(_0x22efe2,_0xbff8e6){return client[_0xc620('0xd')](_0x32edc8,_0x558737)[_0xc620('0xe')](function(_0x292a0f){logger[_0xc620('0xf')](_0xc620('0x10'),_0x2360c5,_0xc620('0x11'));logger[_0xc620('0x12')](_0xc620('0x13'),_0x2360c5,_0xc620('0x11'),JSON[_0xc620('0x14')](_0x292a0f));if(_0x292a0f[_0xc620('0x15')]){if(_0x292a0f[_0xc620('0x15')][_0xc620('0x16')]===0x1f4){logger['error'](_0xc620('0x10'),_0x2360c5,_0x292a0f[_0xc620('0x15')][_0xc620('0x17')]);return _0xbff8e6(_0x292a0f['error'][_0xc620('0x17')]);}logger[_0xc620('0x15')](_0xc620('0x10'),_0x2360c5,_0x292a0f[_0xc620('0x15')][_0xc620('0x17')]);return _0x22efe2(_0x292a0f[_0xc620('0x15')][_0xc620('0x17')]);}else{logger[_0xc620('0xf')](_0xc620('0x10'),_0x2360c5,_0xc620('0x11'));_0x22efe2(_0x292a0f[_0xc620('0x18')][_0xc620('0x17')]);}})['catch'](function(_0x446266){logger[_0xc620('0x15')]('Sound,\x20%s,\x20%s',_0x2360c5,_0x446266);_0xbff8e6(_0x446266);});});}exports['ShowSound']=function(_0x322ef8){var _0xbbb5f3=this;return new Promise(function(_0x4a2143,_0x2c57a3){return db[_0xc620('0x19')]['find']({'raw':_0x322ef8[_0xc620('0x1a')]?_0x322ef8[_0xc620('0x1a')][_0xc620('0x1b')]===undefined?!![]:![]:!![],'where':_0x322ef8['options']?_0x322ef8[_0xc620('0x1a')][_0xc620('0x1c')]||null:null,'attributes':_0x322ef8['options']?_0x322ef8[_0xc620('0x1a')][_0xc620('0x1d')]||null:null,'include':_0x322ef8['options']?_0x322ef8[_0xc620('0x1a')][_0xc620('0x1e')]?_[_0xc620('0x1f')](_0x322ef8[_0xc620('0x1a')]['include'],function(_0x233d53){return{'model':db[_0x233d53['model']],'as':_0x233d53['as'],'attributes':_0x233d53['attributes'],'include':_0x233d53[_0xc620('0x1e')]?_['map'](_0x233d53[_0xc620('0x1e')],function(_0x436e4d){return{'model':db[_0x436e4d[_0xc620('0x20')]],'as':_0x436e4d['as'],'attributes':_0x436e4d[_0xc620('0x1d')],'include':_0x436e4d[_0xc620('0x1e')]?_['map'](_0x436e4d[_0xc620('0x1e')],function(_0x42d458){return{'model':db[_0x42d458[_0xc620('0x20')]],'as':_0x42d458['as'],'attributes':_0x42d458[_0xc620('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc620('0xe')](function(_0x1e45ac){logger[_0xc620('0xf')](_0xc620('0x21'),_0x322ef8);logger[_0xc620('0x12')](_0xc620('0x21'),_0x322ef8,JSON['stringify'](_0x1e45ac));_0x4a2143(_0x1e45ac);})[_0xc620('0x22')](function(_0x1b75b6){logger[_0xc620('0x15')]('ShowSound',_0x1b75b6[_0xc620('0x17')],_0x322ef8);_0x2c57a3(_0xbbb5f3['error'](0x1f4,_0x1b75b6['message']));});});}; \ No newline at end of file +var _0x529d=['model','attributes','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','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','options','raw','where','include','map'];(function(_0x4505b8,_0x4ac0d7){var _0x4b3368=function(_0x2fd5cf){while(--_0x2fd5cf){_0x4505b8['push'](_0x4505b8['shift']());}};_0x4b3368(++_0x4ac0d7);}(_0x529d,0x176));var _0xd529=function(_0x1a35bd,_0x287613){_0x1a35bd=_0x1a35bd-0x0;var _0x31d554=_0x529d[_0x1a35bd];return _0x31d554;};'use strict';var _=require('lodash');var util=require(_0xd529('0x0'));var moment=require(_0xd529('0x1'));var BPromise=require(_0xd529('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd529('0x3'))['db'];var utils=require(_0xd529('0x4'));var logger=require(_0xd529('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd529('0x6'));var client=jayson['client'][_0xd529('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x49ad3b,_0x2b2b24,_0x263d55){return new BPromise(function(_0x196463,_0x537eb9){return client[_0xd529('0x8')](_0x49ad3b,_0x263d55)[_0xd529('0x9')](function(_0x33b32b){logger[_0xd529('0xa')]('Sound,\x20%s,\x20%s',_0x2b2b24,_0xd529('0xb'));logger[_0xd529('0xc')](_0xd529('0xd'),_0x2b2b24,'request\x20sent',JSON[_0xd529('0xe')](_0x33b32b));if(_0x33b32b['error']){if(_0x33b32b[_0xd529('0xf')][_0xd529('0x10')]===0x1f4){logger[_0xd529('0xf')](_0xd529('0x11'),_0x2b2b24,_0x33b32b['error'][_0xd529('0x12')]);return _0x537eb9(_0x33b32b[_0xd529('0xf')]['message']);}logger[_0xd529('0xf')]('Sound,\x20%s,\x20%s',_0x2b2b24,_0x33b32b[_0xd529('0xf')][_0xd529('0x12')]);return _0x196463(_0x33b32b['error']['message']);}else{logger['info'](_0xd529('0x11'),_0x2b2b24,_0xd529('0xb'));_0x196463(_0x33b32b[_0xd529('0x13')]['message']);}})[_0xd529('0x14')](function(_0x50bc6f){logger['error']('Sound,\x20%s,\x20%s',_0x2b2b24,_0x50bc6f);_0x537eb9(_0x50bc6f);});});}exports[_0xd529('0x15')]=function(_0x22e282){var _0x219afe=this;return new Promise(function(_0x50dac3,_0x15bfcf){return db[_0xd529('0x16')][_0xd529('0x17')]({'raw':_0x22e282[_0xd529('0x18')]?_0x22e282[_0xd529('0x18')][_0xd529('0x19')]===undefined?!![]:![]:!![],'where':_0x22e282['options']?_0x22e282[_0xd529('0x18')][_0xd529('0x1a')]||null:null,'attributes':_0x22e282['options']?_0x22e282[_0xd529('0x18')]['attributes']||null:null,'include':_0x22e282[_0xd529('0x18')]?_0x22e282[_0xd529('0x18')][_0xd529('0x1b')]?_['map'](_0x22e282[_0xd529('0x18')][_0xd529('0x1b')],function(_0x3614a4){return{'model':db[_0x3614a4['model']],'as':_0x3614a4['as'],'attributes':_0x3614a4['attributes'],'include':_0x3614a4[_0xd529('0x1b')]?_[_0xd529('0x1c')](_0x3614a4['include'],function(_0x4130ba){return{'model':db[_0x4130ba['model']],'as':_0x4130ba['as'],'attributes':_0x4130ba['attributes'],'include':_0x4130ba['include']?_['map'](_0x4130ba['include'],function(_0x1f8d53){return{'model':db[_0x1f8d53[_0xd529('0x1d')]],'as':_0x1f8d53['as'],'attributes':_0x1f8d53[_0xd529('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x546032){logger[_0xd529('0xa')]('ShowSound',_0x22e282);logger[_0xd529('0xc')](_0xd529('0x15'),_0x22e282,JSON[_0xd529('0xe')](_0x546032));_0x50dac3(_0x546032);})[_0xd529('0x14')](function(_0x16b6ed){logger[_0xd529('0xf')](_0xd529('0x15'),_0x16b6ed[_0xd529('0x12')],_0x22e282);_0x15bfcf(_0x219afe[_0xd529('0xf')](0x1f4,_0x16b6ed[_0xd529('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index b7a5689..1778689 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 _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x4782ac,_0x47975f){var _0x51f823=function(_0x229dd4){while(--_0x229dd4){_0x4782ac['push'](_0x4782ac['shift']());}};_0x51f823(++_0x47975f);}(_0x2032,0xd9));var _0x2203=function(_0x29da51,_0x49560b){_0x29da51=_0x29da51-0x0;var _0x19ca17=_0x2032[_0x29da51];return _0x19ca17;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file +var _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x38da37,_0x55b675){var _0x1e3a85=function(_0x15f63e){while(--_0x15f63e){_0x38da37['push'](_0x38da37['shift']());}};_0x1e3a85(++_0x55b675);}(_0xda3f,0xec));var _0xfda3=function(_0x43351b,_0x5b23ea){_0x43351b=_0x43351b-0x0;var _0x6feb92=_0xda3f[_0x43351b];return _0x6feb92;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./squareMessage.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 7ae6caf..dc8bbc4 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 _0x01ee=['out','sequelize','exports','STRING','TEXT','medium','ENUM'];(function(_0x29a0c6,_0x65843b){var _0x4b71ba=function(_0x2c7710){while(--_0x2c7710){_0x29a0c6['push'](_0x29a0c6['shift']());}};_0x4b71ba(++_0x65843b);}(_0x01ee,0x78));var _0xe01e=function(_0x496c0c,_0x1497aa){_0x496c0c=_0x496c0c-0x0;var _0x2f673b=_0x01ee[_0x496c0c];return _0x2f673b;};'use strict';var Sequelize=require(_0xe01e('0x0'));module[_0xe01e('0x1')]={'uniqueid':{'type':Sequelize[_0xe01e('0x2')]},'body':{'type':Sequelize[_0xe01e('0x3')](_0xe01e('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xe01e('0x5')]('in',_0xe01e('0x6')),'defaultValue':_0xe01e('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe01e('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xf3a8=['sequelize','exports','STRING','TEXT','ENUM','out'];(function(_0x4ab99,_0x219ed2){var _0x29e39c=function(_0x2dd986){while(--_0x2dd986){_0x4ab99['push'](_0x4ab99['shift']());}};_0x29e39c(++_0x219ed2);}(_0xf3a8,0x66));var _0x8f3a=function(_0xadbd68,_0x9b8cc7){_0xadbd68=_0xadbd68-0x0;var _0x41f007=_0xf3a8[_0xadbd68];return _0x41f007;};'use strict';var Sequelize=require(_0x8f3a('0x0'));module[_0x8f3a('0x1')]={'uniqueid':{'type':Sequelize[_0x8f3a('0x2')]},'body':{'type':Sequelize[_0x8f3a('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x8f3a('0x4')]('in',_0x8f3a('0x5')),'defaultValue':_0x8f3a('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x8f3a('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 18e531f..4f5b933 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 _0xeef8=['update','then','error','stack','index','map','SquareMessage','rawAttributes','fieldName','key','model','name','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','catch','show','params','length','body','destroy','find','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save'];(function(_0xdd8feb,_0x48cc45){var _0x87ea75=function(_0x2256f5){while(--_0x2256f5){_0xdd8feb['push'](_0xdd8feb['shift']());}};_0x87ea75(++_0x48cc45);}(_0xeef8,0x197));var _0x8eef=function(_0x1661b9,_0x3fe066){_0x1661b9=_0x1661b9-0x0;var _0x1a6cc=_0xeef8[_0x1661b9];return _0x1a6cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8eef('0x0'));var zipdir=require(_0x8eef('0x1'));var jsonpatch=require(_0x8eef('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8eef('0x3'));var util=require(_0x8eef('0x4'));var path=require(_0x8eef('0x5'));var sox=require(_0x8eef('0x6'));var csv=require(_0x8eef('0x7'));var ejs=require(_0x8eef('0x8'));var fs=require('fs');var fs_extra=require(_0x8eef('0x9'));var _=require(_0x8eef('0xa'));var squel=require(_0x8eef('0xb'));var crypto=require(_0x8eef('0xc'));var jsforce=require(_0x8eef('0xd'));var deskjs=require(_0x8eef('0xe'));var toCsv=require(_0x8eef('0x7'));var querystring=require(_0x8eef('0xf'));var Papa=require(_0x8eef('0x10'));var Redis=require(_0x8eef('0x11'));var authService=require(_0x8eef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8eef('0x13'));var logger=require(_0x8eef('0x14'))('api');var utils=require(_0x8eef('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8eef('0x16'));var db=require(_0x8eef('0x17'))['db'];function respondWithStatusCode(_0x523e87,_0x55a0a3){_0x55a0a3=_0x55a0a3||0xcc;return function(_0x28a4c9){if(_0x28a4c9){return _0x523e87[_0x8eef('0x18')](_0x55a0a3);}return _0x523e87[_0x8eef('0x19')](_0x55a0a3)[_0x8eef('0x1a')]();};}function respondWithResult(_0x898bd,_0x4f27f9){_0x4f27f9=_0x4f27f9||0xc8;return function(_0x435194){if(_0x435194){return _0x898bd[_0x8eef('0x19')](_0x4f27f9)[_0x8eef('0x1b')](_0x435194);}};}function respondWithFilteredResult(_0x3b7e02,_0x5d7bbb){return function(_0x1846c){if(_0x1846c){var _0x51e789=typeof _0x5d7bbb[_0x8eef('0x1c')]===_0x8eef('0x1d')&&typeof _0x5d7bbb['limit']===_0x8eef('0x1d');var _0x489bdb=_0x1846c['count'];var _0x5d9188=_0x51e789?0x0:_0x5d7bbb[_0x8eef('0x1c')];var _0x330e5f=_0x51e789?_0x1846c[_0x8eef('0x1e')]:_0x5d7bbb[_0x8eef('0x1c')]+_0x5d7bbb[_0x8eef('0x1f')];var _0x48537a;if(_0x330e5f>=_0x489bdb){_0x330e5f=_0x489bdb;_0x48537a=0xc8;}else{_0x48537a=0xce;}_0x3b7e02[_0x8eef('0x19')](_0x48537a);return _0x3b7e02[_0x8eef('0x20')](_0x8eef('0x21'),_0x5d9188+'-'+_0x330e5f+'/'+_0x489bdb)['json'](_0x1846c);}return null;};}function patchUpdates(_0x14a043){return function(_0x3eca18){try{jsonpatch[_0x8eef('0x22')](_0x3eca18,_0x14a043,!![]);}catch(_0x10ee5d){return BPromise[_0x8eef('0x23')](_0x10ee5d);}return _0x3eca18[_0x8eef('0x24')]();};}function saveUpdates(_0x1ef739,_0x2d31ba){return function(_0x534f9c){if(_0x534f9c){return _0x534f9c[_0x8eef('0x25')](_0x1ef739)['then'](function(_0x4cc9bc){return _0x4cc9bc;});}return null;};}function removeEntity(_0xf3fd6a,_0x4a0f4f){return function(_0x1dca68){if(_0x1dca68){return _0x1dca68['destroy']()[_0x8eef('0x26')](function(){_0xf3fd6a[_0x8eef('0x19')](0xcc)[_0x8eef('0x1a')]();});}};}function handleEntityNotFound(_0x4dd541,_0x4a9c7f){return function(_0x347d23){if(!_0x347d23){_0x4dd541[_0x8eef('0x18')](0x194);}return _0x347d23;};}function handleError(_0x493d28,_0x46be8e){_0x46be8e=_0x46be8e||0x1f4;return function(_0x31b2a5){logger[_0x8eef('0x27')](_0x31b2a5[_0x8eef('0x28')]);if(_0x31b2a5['name']){delete _0x31b2a5['name'];}_0x493d28['status'](_0x46be8e)['send'](_0x31b2a5);};}exports[_0x8eef('0x29')]=function(_0x2aa7e1,_0x3b323d){var _0x14d283={},_0x5daeec={},_0x4b5efa={'count':0x0,'rows':[]};var _0x401e73=_[_0x8eef('0x2a')](db[_0x8eef('0x2b')][_0x8eef('0x2c')],function(_0x19fd38){return{'name':_0x19fd38[_0x8eef('0x2d')],'type':_0x19fd38['type'][_0x8eef('0x2e')]};});_0x5daeec[_0x8eef('0x2f')]=_[_0x8eef('0x2a')](_0x401e73,_0x8eef('0x30'));_0x5daeec['query']=_[_0x8eef('0x31')](_0x2aa7e1['query']);_0x5daeec[_0x8eef('0x32')]=_[_0x8eef('0x33')](_0x5daeec[_0x8eef('0x2f')],_0x5daeec['query']);_0x14d283[_0x8eef('0x34')]=_[_0x8eef('0x33')](_0x5daeec[_0x8eef('0x2f')],qs[_0x8eef('0x35')](_0x2aa7e1[_0x8eef('0x36')]['fields']));_0x14d283[_0x8eef('0x34')]=_0x14d283['attributes']['length']?_0x14d283['attributes']:_0x5daeec[_0x8eef('0x2f')];if(!_0x2aa7e1[_0x8eef('0x36')][_0x8eef('0x37')](_0x8eef('0x38'))){_0x14d283[_0x8eef('0x1f')]=qs[_0x8eef('0x1f')](_0x2aa7e1['query'][_0x8eef('0x1f')]);_0x14d283[_0x8eef('0x1c')]=qs[_0x8eef('0x1c')](_0x2aa7e1[_0x8eef('0x36')]['offset']);}_0x14d283['order']=qs[_0x8eef('0x39')](_0x2aa7e1[_0x8eef('0x36')][_0x8eef('0x39')]);_0x14d283[_0x8eef('0x3a')]=qs[_0x8eef('0x32')](_[_0x8eef('0x3b')](_0x2aa7e1[_0x8eef('0x36')],_0x5daeec[_0x8eef('0x32')]),_0x401e73);if(_0x2aa7e1[_0x8eef('0x36')][_0x8eef('0x3c')]){_0x14d283['where']=_[_0x8eef('0x3d')](_0x14d283[_0x8eef('0x3a')],{'$or':_['map'](_0x401e73,function(_0x227e89){if(_0x227e89[_0x8eef('0x3e')]!==_0x8eef('0x3f')){var _0x53497d={};_0x53497d[_0x227e89[_0x8eef('0x30')]]={'$like':'%'+_0x2aa7e1[_0x8eef('0x36')]['filter']+'%'};return _0x53497d;}})});}_0x14d283=_[_0x8eef('0x3d')]({},_0x14d283,_0x2aa7e1[_0x8eef('0x40')]);var _0x47758d={'where':_0x14d283[_0x8eef('0x3a')]};return db[_0x8eef('0x2b')]['count'](_0x47758d)['then'](function(_0x511ad0){_0x4b5efa[_0x8eef('0x1e')]=_0x511ad0;if(_0x2aa7e1[_0x8eef('0x36')]['includeAll']){_0x14d283[_0x8eef('0x41')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x14d283);})[_0x8eef('0x26')](function(_0x48a874){_0x4b5efa[_0x8eef('0x42')]=_0x48a874;return _0x4b5efa;})[_0x8eef('0x26')](respondWithFilteredResult(_0x3b323d,_0x14d283))[_0x8eef('0x43')](handleError(_0x3b323d,null));};exports[_0x8eef('0x44')]=function(_0x2ea734,_0x2ceb5c){var _0x312ec9={'raw':!![],'where':{'id':_0x2ea734[_0x8eef('0x45')]['id']}},_0x3b1290={};_0x3b1290[_0x8eef('0x2f')]=_[_0x8eef('0x31')](db[_0x8eef('0x2b')]['rawAttributes']);_0x3b1290[_0x8eef('0x36')]=_[_0x8eef('0x31')](_0x2ea734[_0x8eef('0x36')]);_0x3b1290['filters']=_[_0x8eef('0x33')](_0x3b1290[_0x8eef('0x2f')],_0x3b1290[_0x8eef('0x36')]);_0x312ec9[_0x8eef('0x34')]=_[_0x8eef('0x33')](_0x3b1290[_0x8eef('0x2f')],qs['fields'](_0x2ea734['query'][_0x8eef('0x35')]));_0x312ec9[_0x8eef('0x34')]=_0x312ec9[_0x8eef('0x34')][_0x8eef('0x46')]?_0x312ec9[_0x8eef('0x34')]:_0x3b1290['model'];if(_0x2ea734[_0x8eef('0x36')]['includeAll']){_0x312ec9[_0x8eef('0x41')]=[{'all':!![]}];}_0x312ec9=_[_0x8eef('0x3d')]({},_0x312ec9,_0x2ea734['options']);return db[_0x8eef('0x2b')]['find'](_0x312ec9)[_0x8eef('0x26')](handleEntityNotFound(_0x2ceb5c,null))[_0x8eef('0x26')](respondWithResult(_0x2ceb5c,null))['catch'](handleError(_0x2ceb5c,null));};exports['create']=function(_0x533568,_0x5bae6a){return db[_0x8eef('0x2b')]['create'](_0x533568[_0x8eef('0x47')],{})[_0x8eef('0x26')](respondWithResult(_0x5bae6a,0xc9))[_0x8eef('0x43')](handleError(_0x5bae6a,null));};exports['update']=function(_0x20ecb7,_0x4fbcf4){if(_0x20ecb7[_0x8eef('0x47')]['id']){delete _0x20ecb7[_0x8eef('0x47')]['id'];}return db[_0x8eef('0x2b')]['find']({'where':{'id':_0x20ecb7[_0x8eef('0x45')]['id']}})[_0x8eef('0x26')](handleEntityNotFound(_0x4fbcf4,null))[_0x8eef('0x26')](saveUpdates(_0x20ecb7['body'],null))[_0x8eef('0x26')](respondWithResult(_0x4fbcf4,null))[_0x8eef('0x43')](handleError(_0x4fbcf4,null));};exports[_0x8eef('0x48')]=function(_0x1d588a,_0x1bed4f){return db[_0x8eef('0x2b')][_0x8eef('0x49')]({'where':{'id':_0x1d588a[_0x8eef('0x45')]['id']}})[_0x8eef('0x26')](handleEntityNotFound(_0x1bed4f,null))['then'](removeEntity(_0x1bed4f,null))['catch'](handleError(_0x1bed4f,null));}; \ No newline at end of file +var _0x0fda=['show','params','keys','find','create','body','zip-dir','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x176e96,_0x6f2e74){var _0x9ea112=function(_0x1a549e){while(--_0x1a549e){_0x176e96['push'](_0x176e96['shift']());}};_0x9ea112(++_0x6f2e74);}(_0x0fda,0x96));var _0xa0fd=function(_0x567496,_0x3fafb6){_0x567496=_0x567496-0x0;var _0x28735a=_0x0fda[_0x567496];return _0x28735a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa0fd('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa0fd('0x1'));var BPromise=require(_0xa0fd('0x2'));var Mustache=require(_0xa0fd('0x3'));var util=require(_0xa0fd('0x4'));var path=require('path');var sox=require(_0xa0fd('0x5'));var csv=require(_0xa0fd('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa0fd('0x7'));var _=require(_0xa0fd('0x8'));var squel=require(_0xa0fd('0x9'));var crypto=require(_0xa0fd('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa0fd('0xb'));var toCsv=require(_0xa0fd('0x6'));var querystring=require(_0xa0fd('0xc'));var Papa=require('papaparse');var Redis=require(_0xa0fd('0xd'));var authService=require(_0xa0fd('0xe'));var qs=require(_0xa0fd('0xf'));var as=require(_0xa0fd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0fd('0x11'))(_0xa0fd('0x12'));var utils=require(_0xa0fd('0x13'));var config=require(_0xa0fd('0x14'));var licenseUtil=require(_0xa0fd('0x15'));var db=require(_0xa0fd('0x16'))['db'];function respondWithStatusCode(_0x497995,_0x1830b8){_0x1830b8=_0x1830b8||0xcc;return function(_0x369dfd){if(_0x369dfd){return _0x497995[_0xa0fd('0x17')](_0x1830b8);}return _0x497995['status'](_0x1830b8)[_0xa0fd('0x18')]();};}function respondWithResult(_0x404514,_0x1a9d4a){_0x1a9d4a=_0x1a9d4a||0xc8;return function(_0x5f4139){if(_0x5f4139){return _0x404514[_0xa0fd('0x19')](_0x1a9d4a)[_0xa0fd('0x1a')](_0x5f4139);}};}function respondWithFilteredResult(_0x2914f6,_0x5abe9c){return function(_0x341dea){if(_0x341dea){var _0x4a5841=typeof _0x5abe9c[_0xa0fd('0x1b')]===_0xa0fd('0x1c')&&typeof _0x5abe9c[_0xa0fd('0x1d')]==='undefined';var _0x521c9e=_0x341dea[_0xa0fd('0x1e')];var _0x411989=_0x4a5841?0x0:_0x5abe9c[_0xa0fd('0x1b')];var _0x421734=_0x4a5841?_0x341dea['count']:_0x5abe9c['offset']+_0x5abe9c[_0xa0fd('0x1d')];var _0xe5fc2d;if(_0x421734>=_0x521c9e){_0x421734=_0x521c9e;_0xe5fc2d=0xc8;}else{_0xe5fc2d=0xce;}_0x2914f6[_0xa0fd('0x19')](_0xe5fc2d);return _0x2914f6[_0xa0fd('0x1f')](_0xa0fd('0x20'),_0x411989+'-'+_0x421734+'/'+_0x521c9e)['json'](_0x341dea);}return null;};}function patchUpdates(_0x1cca79){return function(_0x4da05e){try{jsonpatch[_0xa0fd('0x21')](_0x4da05e,_0x1cca79,!![]);}catch(_0x5549b1){return BPromise[_0xa0fd('0x22')](_0x5549b1);}return _0x4da05e[_0xa0fd('0x23')]();};}function saveUpdates(_0x46fba1,_0x577acf){return function(_0x2e9d7d){if(_0x2e9d7d){return _0x2e9d7d[_0xa0fd('0x24')](_0x46fba1)[_0xa0fd('0x25')](function(_0x151b0e){return _0x151b0e;});}return null;};}function removeEntity(_0x579a31,_0x283905){return function(_0x317132){if(_0x317132){return _0x317132['destroy']()[_0xa0fd('0x25')](function(){_0x579a31[_0xa0fd('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dba80,_0x188c4e){return function(_0x3e68c6){if(!_0x3e68c6){_0x1dba80[_0xa0fd('0x17')](0x194);}return _0x3e68c6;};}function handleError(_0x1ece6b,_0x562ddc){_0x562ddc=_0x562ddc||0x1f4;return function(_0x110855){logger['error'](_0x110855[_0xa0fd('0x26')]);if(_0x110855['name']){delete _0x110855[_0xa0fd('0x27')];}_0x1ece6b[_0xa0fd('0x19')](_0x562ddc)['send'](_0x110855);};}exports['index']=function(_0x2a43a3,_0x4a7c39){var _0x5d63a7={},_0x4200ae={},_0x44054b={'count':0x0,'rows':[]};var _0x5892bb=_[_0xa0fd('0x28')](db[_0xa0fd('0x29')][_0xa0fd('0x2a')],function(_0x309ae9){return{'name':_0x309ae9[_0xa0fd('0x2b')],'type':_0x309ae9[_0xa0fd('0x2c')][_0xa0fd('0x2d')]};});_0x4200ae[_0xa0fd('0x2e')]=_[_0xa0fd('0x28')](_0x5892bb,'name');_0x4200ae[_0xa0fd('0x2f')]=_['keys'](_0x2a43a3['query']);_0x4200ae['filters']=_[_0xa0fd('0x30')](_0x4200ae[_0xa0fd('0x2e')],_0x4200ae[_0xa0fd('0x2f')]);_0x5d63a7[_0xa0fd('0x31')]=_[_0xa0fd('0x30')](_0x4200ae[_0xa0fd('0x2e')],qs[_0xa0fd('0x32')](_0x2a43a3['query']['fields']));_0x5d63a7['attributes']=_0x5d63a7[_0xa0fd('0x31')][_0xa0fd('0x33')]?_0x5d63a7[_0xa0fd('0x31')]:_0x4200ae[_0xa0fd('0x2e')];if(!_0x2a43a3[_0xa0fd('0x2f')]['hasOwnProperty'](_0xa0fd('0x34'))){_0x5d63a7[_0xa0fd('0x1d')]=qs[_0xa0fd('0x1d')](_0x2a43a3[_0xa0fd('0x2f')][_0xa0fd('0x1d')]);_0x5d63a7[_0xa0fd('0x1b')]=qs[_0xa0fd('0x1b')](_0x2a43a3[_0xa0fd('0x2f')][_0xa0fd('0x1b')]);}_0x5d63a7['order']=qs[_0xa0fd('0x35')](_0x2a43a3['query'][_0xa0fd('0x35')]);_0x5d63a7[_0xa0fd('0x36')]=qs[_0xa0fd('0x37')](_[_0xa0fd('0x38')](_0x2a43a3[_0xa0fd('0x2f')],_0x4200ae['filters']),_0x5892bb);if(_0x2a43a3['query'][_0xa0fd('0x39')]){_0x5d63a7[_0xa0fd('0x36')]=_[_0xa0fd('0x3a')](_0x5d63a7[_0xa0fd('0x36')],{'$or':_[_0xa0fd('0x28')](_0x5892bb,function(_0x306824){if(_0x306824['type']!==_0xa0fd('0x3b')){var _0x5ba381={};_0x5ba381[_0x306824[_0xa0fd('0x27')]]={'$like':'%'+_0x2a43a3[_0xa0fd('0x2f')][_0xa0fd('0x39')]+'%'};return _0x5ba381;}})});}_0x5d63a7=_[_0xa0fd('0x3a')]({},_0x5d63a7,_0x2a43a3[_0xa0fd('0x3c')]);var _0x3b79b5={'where':_0x5d63a7[_0xa0fd('0x36')]};return db[_0xa0fd('0x29')][_0xa0fd('0x1e')](_0x3b79b5)[_0xa0fd('0x25')](function(_0x3b0a48){_0x44054b[_0xa0fd('0x1e')]=_0x3b0a48;if(_0x2a43a3['query'][_0xa0fd('0x3d')]){_0x5d63a7[_0xa0fd('0x3e')]=[{'all':!![]}];}return db[_0xa0fd('0x29')][_0xa0fd('0x3f')](_0x5d63a7);})[_0xa0fd('0x25')](function(_0xf674f5){_0x44054b[_0xa0fd('0x40')]=_0xf674f5;return _0x44054b;})['then'](respondWithFilteredResult(_0x4a7c39,_0x5d63a7))[_0xa0fd('0x41')](handleError(_0x4a7c39,null));};exports[_0xa0fd('0x42')]=function(_0x3a6d16,_0x24df1b){var _0x255cf3={'raw':!![],'where':{'id':_0x3a6d16[_0xa0fd('0x43')]['id']}},_0xb7882b={};_0xb7882b[_0xa0fd('0x2e')]=_['keys'](db[_0xa0fd('0x29')][_0xa0fd('0x2a')]);_0xb7882b[_0xa0fd('0x2f')]=_[_0xa0fd('0x44')](_0x3a6d16['query']);_0xb7882b['filters']=_[_0xa0fd('0x30')](_0xb7882b[_0xa0fd('0x2e')],_0xb7882b[_0xa0fd('0x2f')]);_0x255cf3['attributes']=_[_0xa0fd('0x30')](_0xb7882b[_0xa0fd('0x2e')],qs[_0xa0fd('0x32')](_0x3a6d16[_0xa0fd('0x2f')][_0xa0fd('0x32')]));_0x255cf3['attributes']=_0x255cf3[_0xa0fd('0x31')]['length']?_0x255cf3[_0xa0fd('0x31')]:_0xb7882b[_0xa0fd('0x2e')];if(_0x3a6d16[_0xa0fd('0x2f')][_0xa0fd('0x3d')]){_0x255cf3['include']=[{'all':!![]}];}_0x255cf3=_[_0xa0fd('0x3a')]({},_0x255cf3,_0x3a6d16[_0xa0fd('0x3c')]);return db[_0xa0fd('0x29')][_0xa0fd('0x45')](_0x255cf3)[_0xa0fd('0x25')](handleEntityNotFound(_0x24df1b,null))['then'](respondWithResult(_0x24df1b,null))[_0xa0fd('0x41')](handleError(_0x24df1b,null));};exports[_0xa0fd('0x46')]=function(_0x1e7b80,_0x572e19){return db[_0xa0fd('0x29')][_0xa0fd('0x46')](_0x1e7b80[_0xa0fd('0x47')],{})[_0xa0fd('0x25')](respondWithResult(_0x572e19,0xc9))[_0xa0fd('0x41')](handleError(_0x572e19,null));};exports[_0xa0fd('0x24')]=function(_0x422445,_0x3704c7){if(_0x422445[_0xa0fd('0x47')]['id']){delete _0x422445[_0xa0fd('0x47')]['id'];}return db[_0xa0fd('0x29')][_0xa0fd('0x45')]({'where':{'id':_0x422445[_0xa0fd('0x43')]['id']}})['then'](handleEntityNotFound(_0x3704c7,null))[_0xa0fd('0x25')](saveUpdates(_0x422445[_0xa0fd('0x47')],null))['then'](respondWithResult(_0x3704c7,null))['catch'](handleError(_0x3704c7,null));};exports['destroy']=function(_0x3156a9,_0x1befc6){return db['SquareMessage'][_0xa0fd('0x45')]({'where':{'id':_0x3156a9['params']['id']}})['then'](handleEntityNotFound(_0x1befc6,null))[_0xa0fd('0x25')](removeEntity(_0x1befc6,null))[_0xa0fd('0x41')](handleError(_0x1befc6,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 7a91025..1135601 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 _0x16eb=['moment','bluebird','request-promise','rimraf','exports','define','SquareMessage','square_messages','lodash','../../config/logger','api'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x16eb,0xb8));var _0xb16e=function(_0x115480,_0x2a41b9){_0x115480=_0x115480-0x0;var _0x5d3fbd=_0x16eb[_0x115480];return _0x5d3fbd;};'use strict';var _=require(_0xb16e('0x0'));var util=require('util');var logger=require(_0xb16e('0x1'))(_0xb16e('0x2'));var moment=require(_0xb16e('0x3'));var BPromise=require(_0xb16e('0x4'));var rp=require(_0xb16e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb16e('0x6'));var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module[_0xb16e('0x7')]=function(_0x3d0886,_0x50828a){return _0x3d0886[_0xb16e('0x8')](_0xb16e('0x9'),attributes,{'tableName':_0xb16e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3786=['../../config/logger','api','moment','bluebird','rimraf','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util'];(function(_0x3b4408,_0x14b65e){var _0x4be83c=function(_0x3ed670){while(--_0x3ed670){_0x3b4408['push'](_0x3b4408['shift']());}};_0x4be83c(++_0x14b65e);}(_0x3786,0x196));var _0x6378=function(_0x458bcc,_0x2d385d){_0x458bcc=_0x458bcc-0x0;var _0x55c157=_0x3786[_0x458bcc];return _0x55c157;};'use strict';var _=require(_0x6378('0x0'));var util=require(_0x6378('0x1'));var logger=require(_0x6378('0x2'))(_0x6378('0x3'));var moment=require(_0x6378('0x4'));var BPromise=require(_0x6378('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6378('0x6'));var config=require('../../config/environment');var attributes=require(_0x6378('0x7'));module[_0x6378('0x8')]=function(_0x14188a,_0x1e91c2){return _0x14188a[_0x6378('0x9')](_0x6378('0xa'),attributes,{'tableName':_0x6378('0xb'),'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 01dead9..ce5caac 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 _0x8feb=['info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','then','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request'];(function(_0x3d37e0,_0x5dbbd3){var _0x2e8762=function(_0x18c1c3){while(--_0x18c1c3){_0x3d37e0['push'](_0x3d37e0['shift']());}};_0x2e8762(++_0x5dbbd3);}(_0x8feb,0x12e));var _0xb8fe=function(_0x114d86,_0x157211){_0x114d86=_0x114d86-0x0;var _0x44f382=_0x8feb[_0x114d86];return _0x44f382;};'use strict';var _=require(_0xb8fe('0x0'));var util=require(_0xb8fe('0x1'));var moment=require('moment');var BPromise=require(_0xb8fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb8fe('0x3'));var db=require(_0xb8fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb8fe('0x5'))(_0xb8fe('0x6'));var config=require('../../config/environment');var jayson=require(_0xb8fe('0x7'));var client=jayson['client'][_0xb8fe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5bf179,_0xf3327c,_0x10e5d5){return new BPromise(function(_0x9f1076,_0x4ff160){return client[_0xb8fe('0x9')](_0x5bf179,_0x10e5d5)['then'](function(_0x400e49){logger[_0xb8fe('0xa')](_0xb8fe('0xb'),_0xf3327c,_0xb8fe('0xc'));logger[_0xb8fe('0xd')](_0xb8fe('0xe'),_0xf3327c,_0xb8fe('0xc'),JSON['stringify'](_0x400e49));if(_0x400e49['error']){if(_0x400e49['error']['code']===0x1f4){logger[_0xb8fe('0xf')](_0xb8fe('0xb'),_0xf3327c,_0x400e49['error']['message']);return _0x4ff160(_0x400e49[_0xb8fe('0xf')][_0xb8fe('0x10')]);}logger[_0xb8fe('0xf')](_0xb8fe('0xb'),_0xf3327c,_0x400e49['error'][_0xb8fe('0x10')]);return _0x9f1076(_0x400e49[_0xb8fe('0xf')][_0xb8fe('0x10')]);}else{logger[_0xb8fe('0xa')]('SquareMessage,\x20%s,\x20%s',_0xf3327c,_0xb8fe('0xc'));_0x9f1076(_0x400e49[_0xb8fe('0x11')][_0xb8fe('0x10')]);}})[_0xb8fe('0x12')](function(_0x5f290e){logger[_0xb8fe('0xf')](_0xb8fe('0xb'),_0xf3327c,_0x5f290e);_0x4ff160(_0x5f290e);});});}exports[_0xb8fe('0x13')]=function(_0xec9afe){var _0x2d0a69=this;return new Promise(function(_0x3caf2c,_0x57d435){return db[_0xb8fe('0x14')][_0xb8fe('0x15')](_0xec9afe[_0xb8fe('0x16')],{'raw':_0xec9afe[_0xb8fe('0x17')]?_0xec9afe[_0xb8fe('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xb8fe('0x18')](function(_0x3bf641){logger['info'](_0xb8fe('0x13'),_0xec9afe);logger[_0xb8fe('0xd')](_0xb8fe('0x13'),_0xec9afe,JSON[_0xb8fe('0x19')](_0x3bf641));_0x3caf2c(_0x3bf641);})['catch'](function(_0x5850b1){logger[_0xb8fe('0xf')]('CreateSquareMessage',_0x5850b1['message'],_0xec9afe);_0x57d435(_0x2d0a69[_0xb8fe('0xf')](0x1f4,_0x5850b1['message']));});});}; \ No newline at end of file +var _0x82f5=['../../config/utils','../../config/logger','jayson/promise','client','http','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSquareMessage','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x1f3b0c,_0x3fce85){var _0x11f18f=function(_0x2b0476){while(--_0x2b0476){_0x1f3b0c['push'](_0x1f3b0c['shift']());}};_0x11f18f(++_0x3fce85);}(_0x82f5,0xdc));var _0x582f=function(_0x49361a,_0x3e9b3a){_0x49361a=_0x49361a-0x0;var _0x289cb3=_0x82f5[_0x49361a];return _0x289cb3;};'use strict';var _=require(_0x582f('0x0'));var util=require(_0x582f('0x1'));var moment=require(_0x582f('0x2'));var BPromise=require(_0x582f('0x3'));var rs=require(_0x582f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x582f('0x5'));var logger=require(_0x582f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x582f('0x7'));var client=jayson[_0x582f('0x8')][_0x582f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e402b,_0x477dc0,_0x23120d){return new BPromise(function(_0x48c58a,_0x2880e8){return client['request'](_0x3e402b,_0x23120d)[_0x582f('0xa')](function(_0x23368c){logger[_0x582f('0xb')](_0x582f('0xc'),_0x477dc0,_0x582f('0xd'));logger[_0x582f('0xe')](_0x582f('0xf'),_0x477dc0,'request\x20sent',JSON['stringify'](_0x23368c));if(_0x23368c[_0x582f('0x10')]){if(_0x23368c[_0x582f('0x10')][_0x582f('0x11')]===0x1f4){logger[_0x582f('0x10')]('SquareMessage,\x20%s,\x20%s',_0x477dc0,_0x23368c[_0x582f('0x10')][_0x582f('0x12')]);return _0x2880e8(_0x23368c[_0x582f('0x10')]['message']);}logger[_0x582f('0x10')](_0x582f('0xc'),_0x477dc0,_0x23368c[_0x582f('0x10')][_0x582f('0x12')]);return _0x48c58a(_0x23368c[_0x582f('0x10')][_0x582f('0x12')]);}else{logger['info'](_0x582f('0xc'),_0x477dc0,_0x582f('0xd'));_0x48c58a(_0x23368c['result']['message']);}})[_0x582f('0x13')](function(_0xf8e3bb){logger[_0x582f('0x10')](_0x582f('0xc'),_0x477dc0,_0xf8e3bb);_0x2880e8(_0xf8e3bb);});});}exports[_0x582f('0x14')]=function(_0x31086e){var _0x5c358a=this;return new Promise(function(_0x3adb2a,_0x5269e5){return db['SquareMessage']['create'](_0x31086e[_0x582f('0x15')],{'raw':_0x31086e[_0x582f('0x16')]?_0x31086e[_0x582f('0x16')][_0x582f('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x5e7497){logger[_0x582f('0xb')](_0x582f('0x14'),_0x31086e);logger[_0x582f('0xe')](_0x582f('0x14'),_0x31086e,JSON[_0x582f('0x18')](_0x5e7497));_0x3adb2a(_0x5e7497);})['catch'](function(_0x4169c4){logger[_0x582f('0x10')](_0x582f('0x14'),_0x4169c4[_0x582f('0x12')],_0x31086e);_0x5269e5(_0x5c358a[_0x582f('0x10')](0x1f4,_0x4169c4[_0x582f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 45ae66e..badc849 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 _0xdf4b=['get','isAuthenticated','index','/:id','show','15s','test','post','create','put','update','delete','destroy','exports','multer','path','../../components/auth/service','../../config/environment','./squareOdbc.controller'];(function(_0x55c185,_0x3f2173){var _0x2bb576=function(_0x3b3c77){while(--_0x3b3c77){_0x55c185['push'](_0x55c185['shift']());}};_0x2bb576(++_0x3f2173);}(_0xdf4b,0xf2));var _0xbdf4=function(_0x5ad9a4,_0x59fd88){_0x5ad9a4=_0x5ad9a4-0x0;var _0x293417=_0xdf4b[_0x5ad9a4];return _0x293417;};'use strict';var multer=require(_0xbdf4('0x0'));var util=require('util');var path=require(_0xbdf4('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbdf4('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xbdf4('0x3'));var controller=require(_0xbdf4('0x4'));router[_0xbdf4('0x5')]('/',auth[_0xbdf4('0x6')](),controller[_0xbdf4('0x7')]);router[_0xbdf4('0x5')](_0xbdf4('0x8'),auth[_0xbdf4('0x6')](),controller[_0xbdf4('0x9')]);router[_0xbdf4('0x5')]('/:id/test',auth['isAuthenticated'](),timeout(_0xbdf4('0xa')),controller[_0xbdf4('0xb')]);router[_0xbdf4('0xc')]('/',auth[_0xbdf4('0x6')](),controller[_0xbdf4('0xd')]);router[_0xbdf4('0xe')](_0xbdf4('0x8'),auth[_0xbdf4('0x6')](),controller[_0xbdf4('0xf')]);router[_0xbdf4('0x10')](_0xbdf4('0x8'),auth['isAuthenticated'](),controller[_0xbdf4('0x11')]);module[_0xbdf4('0x12')]=router; \ No newline at end of file +var _0x9e36=['/:id','show','/:id/test','test','post','put','update','delete','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x9e36,0xa1));var _0x69e3=function(_0x4cc588,_0x4a9bc4){_0x4cc588=_0x4cc588-0x0;var _0x36619d=_0x9e36[_0x4cc588];return _0x36619d;};'use strict';var multer=require(_0x69e3('0x0'));var util=require(_0x69e3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x69e3('0x2'));var router=express[_0x69e3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x69e3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x69e3('0x5'));var controller=require(_0x69e3('0x6'));router[_0x69e3('0x7')]('/',auth[_0x69e3('0x8')](),controller[_0x69e3('0x9')]);router[_0x69e3('0x7')](_0x69e3('0xa'),auth[_0x69e3('0x8')](),controller[_0x69e3('0xb')]);router[_0x69e3('0x7')](_0x69e3('0xc'),auth[_0x69e3('0x8')](),timeout('15s'),controller[_0x69e3('0xd')]);router[_0x69e3('0xe')]('/',auth[_0x69e3('0x8')](),controller['create']);router[_0x69e3('0xf')](_0x69e3('0xa'),auth['isAuthenticated'](),controller[_0x69e3('0x10')]);router[_0x69e3('0x11')](_0x69e3('0xa'),auth[_0x69e3('0x8')](),controller['destroy']);module[_0x69e3('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 6e8840c..87c0e45 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 _0x8ac5=['STRING','sequelize','name'];(function(_0x2440b7,_0x2d8c0e){var _0x26287c=function(_0x24e679){while(--_0x24e679){_0x2440b7['push'](_0x2440b7['shift']());}};_0x26287c(++_0x2d8c0e);}(_0x8ac5,0xfa));var _0x58ac=function(_0x28f9a2,_0x34354b){_0x28f9a2=_0x28f9a2-0x0;var _0x3deb3a=_0x8ac5[_0x28f9a2];return _0x3deb3a;};'use strict';var Sequelize=require(_0x58ac('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x58ac('0x1'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x58ac('0x2')]}}; \ No newline at end of file +var _0xe85e=['STRING','name','sequelize','exports'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xe85e,0x1ae));var _0xee85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xee85('0x0'));module[_0xee85('0x1')]={'name':{'type':Sequelize[_0xee85('0x2')],'unique':_0xee85('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xee85('0x2')]},'description':{'type':Sequelize[_0xee85('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index cf56c20..e908f06 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 _0xd685=['dsn','closeSync','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','update','then','get','ODBC','UserProfileResource','destroy','end','stack','send','index','map','SquareOdbc','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','filter','merge','where','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','create','body','user','UserProfileSection','userProfileId','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','odbc','openSync'];(function(_0x1999f8,_0x533cd9){var _0x565134=function(_0xf6e6df){while(--_0xf6e6df){_0x1999f8['push'](_0x1999f8['shift']());}};_0x565134(++_0x533cd9);}(_0xd685,0x14e));var _0x5d68=function(_0x4b766c,_0x4ef76c){_0x4b766c=_0x4b766c-0x0;var _0x2f3283=_0xd685[_0x4b766c];return _0x2f3283;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5d68('0x0'));var zipdir=require(_0x5d68('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5d68('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5d68('0x3'));var util=require(_0x5d68('0x4'));var path=require(_0x5d68('0x5'));var sox=require(_0x5d68('0x6'));var csv=require('to-csv');var ejs=require(_0x5d68('0x7'));var fs=require('fs');var fs_extra=require(_0x5d68('0x8'));var _=require('lodash');var squel=require(_0x5d68('0x9'));var crypto=require(_0x5d68('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5d68('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5d68('0xc'));var Papa=require(_0x5d68('0xd'));var Redis=require(_0x5d68('0xe'));var authService=require(_0x5d68('0xf'));var qs=require(_0x5d68('0x10'));var as=require(_0x5d68('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d68('0x12'))(_0x5d68('0x13'));var utils=require(_0x5d68('0x14'));var config=require(_0x5d68('0x15'));var licenseUtil=require(_0x5d68('0x16'));var db=require(_0x5d68('0x17'))['db'];function respondWithStatusCode(_0x53f9c0,_0x47e66b){_0x47e66b=_0x47e66b||0xcc;return function(_0x2fe901){if(_0x2fe901){return _0x53f9c0[_0x5d68('0x18')](_0x47e66b);}return _0x53f9c0[_0x5d68('0x19')](_0x47e66b)['end']();};}function respondWithResult(_0x43fcc2,_0x14904f){_0x14904f=_0x14904f||0xc8;return function(_0x30e5a3){if(_0x30e5a3){return _0x43fcc2['status'](_0x14904f)['json'](_0x30e5a3);}};}function respondWithFilteredResult(_0x20f430,_0x166fa5){return function(_0x420088){if(_0x420088){var _0x5a9ddb=typeof _0x166fa5[_0x5d68('0x1a')]===_0x5d68('0x1b')&&typeof _0x166fa5[_0x5d68('0x1c')]==='undefined';var _0xcb4bff=_0x420088[_0x5d68('0x1d')];var _0xfe5dde=_0x5a9ddb?0x0:_0x166fa5['offset'];var _0x1c40a6=_0x5a9ddb?_0x420088['count']:_0x166fa5[_0x5d68('0x1a')]+_0x166fa5[_0x5d68('0x1c')];var _0x587880;if(_0x1c40a6>=_0xcb4bff){_0x1c40a6=_0xcb4bff;_0x587880=0xc8;}else{_0x587880=0xce;}_0x20f430[_0x5d68('0x19')](_0x587880);return _0x20f430[_0x5d68('0x1e')](_0x5d68('0x1f'),_0xfe5dde+'-'+_0x1c40a6+'/'+_0xcb4bff)[_0x5d68('0x20')](_0x420088);}return null;};}function patchUpdates(_0x12498a){return function(_0x5820eb){try{jsonpatch['apply'](_0x5820eb,_0x12498a,!![]);}catch(_0x6d9e4e){return BPromise['reject'](_0x6d9e4e);}return _0x5820eb['save']();};}function saveUpdates(_0x35a7d8,_0x3d50a3){return function(_0xf20be4){if(_0xf20be4){return _0xf20be4[_0x5d68('0x21')](_0x35a7d8)['then'](function(_0x5c4afa){return _0x5c4afa;});}return null;};}function removeEntity(_0x1cf0a9,_0x14f1fb){return function(_0x44b587){if(_0x44b587){return _0x44b587['destroy']()[_0x5d68('0x22')](function(){var _0x59ef1d=_0x44b587[_0x5d68('0x23')]({'plain':!![]});var _0xbce545=_0x5d68('0x24');return db[_0x5d68('0x25')][_0x5d68('0x26')]({'where':{'type':_0xbce545,'resourceId':_0x59ef1d['id']}})[_0x5d68('0x22')](function(){return _0x44b587;});})['then'](function(){_0x1cf0a9[_0x5d68('0x19')](0xcc)[_0x5d68('0x27')]();});}};}function handleEntityNotFound(_0x148471,_0x15c2b7){return function(_0x26a611){if(!_0x26a611){_0x148471['sendStatus'](0x194);}return _0x26a611;};}function handleError(_0x3cc5b3,_0x5c8d32){_0x5c8d32=_0x5c8d32||0x1f4;return function(_0x2b6559){logger['error'](_0x2b6559[_0x5d68('0x28')]);if(_0x2b6559['name']){delete _0x2b6559['name'];}_0x3cc5b3[_0x5d68('0x19')](_0x5c8d32)[_0x5d68('0x29')](_0x2b6559);};}exports[_0x5d68('0x2a')]=function(_0x15313d,_0x442834){var _0x180f2f={},_0x55fa35={},_0x423b33={'count':0x0,'rows':[]};var _0x3b6456=_[_0x5d68('0x2b')](db[_0x5d68('0x2c')][_0x5d68('0x2d')],function(_0x3e9e7b){return{'name':_0x3e9e7b['fieldName'],'type':_0x3e9e7b[_0x5d68('0x2e')][_0x5d68('0x2f')]};});_0x55fa35[_0x5d68('0x30')]=_[_0x5d68('0x2b')](_0x3b6456,_0x5d68('0x31'));_0x55fa35[_0x5d68('0x32')]=_[_0x5d68('0x33')](_0x15313d[_0x5d68('0x32')]);_0x55fa35[_0x5d68('0x34')]=_[_0x5d68('0x35')](_0x55fa35['model'],_0x55fa35['query']);_0x180f2f[_0x5d68('0x36')]=_['intersection'](_0x55fa35[_0x5d68('0x30')],qs[_0x5d68('0x37')](_0x15313d[_0x5d68('0x32')][_0x5d68('0x37')]));_0x180f2f['attributes']=_0x180f2f[_0x5d68('0x36')][_0x5d68('0x38')]?_0x180f2f[_0x5d68('0x36')]:_0x55fa35[_0x5d68('0x30')];if(!_0x15313d[_0x5d68('0x32')]['hasOwnProperty'](_0x5d68('0x39'))){_0x180f2f['limit']=qs[_0x5d68('0x1c')](_0x15313d[_0x5d68('0x32')][_0x5d68('0x1c')]);_0x180f2f[_0x5d68('0x1a')]=qs['offset'](_0x15313d[_0x5d68('0x32')][_0x5d68('0x1a')]);}_0x180f2f['order']=qs[_0x5d68('0x3a')](_0x15313d[_0x5d68('0x32')][_0x5d68('0x3a')]);_0x180f2f['where']=qs[_0x5d68('0x34')](_['pick'](_0x15313d['query'],_0x55fa35[_0x5d68('0x34')]),_0x3b6456);if(_0x15313d[_0x5d68('0x32')][_0x5d68('0x3b')]){_0x180f2f['where']=_[_0x5d68('0x3c')](_0x180f2f[_0x5d68('0x3d')],{'$or':_['map'](_0x3b6456,function(_0x483e59){if(_0x483e59[_0x5d68('0x2e')]!==_0x5d68('0x3e')){var _0x339165={};_0x339165[_0x483e59[_0x5d68('0x31')]]={'$like':'%'+_0x15313d[_0x5d68('0x32')][_0x5d68('0x3b')]+'%'};return _0x339165;}})});}_0x180f2f=_[_0x5d68('0x3c')]({},_0x180f2f,_0x15313d[_0x5d68('0x3f')]);var _0xb3727d={'where':_0x180f2f[_0x5d68('0x3d')]};return db[_0x5d68('0x2c')][_0x5d68('0x1d')](_0xb3727d)['then'](function(_0x45783e){_0x423b33[_0x5d68('0x1d')]=_0x45783e;if(_0x15313d[_0x5d68('0x32')]['includeAll']){_0x180f2f['include']=[{'all':!![]}];}return db[_0x5d68('0x2c')][_0x5d68('0x40')](_0x180f2f);})[_0x5d68('0x22')](function(_0x31e7cf){_0x423b33[_0x5d68('0x41')]=_0x31e7cf;return _0x423b33;})[_0x5d68('0x22')](respondWithFilteredResult(_0x442834,_0x180f2f))['catch'](handleError(_0x442834,null));};exports[_0x5d68('0x42')]=function(_0x35d663,_0x12f738){var _0x5075d8={'raw':!![],'where':{'id':_0x35d663[_0x5d68('0x43')]['id']}},_0x388213={};_0x388213[_0x5d68('0x30')]=_['keys'](db['SquareOdbc'][_0x5d68('0x2d')]);_0x388213[_0x5d68('0x32')]=_[_0x5d68('0x33')](_0x35d663[_0x5d68('0x32')]);_0x388213[_0x5d68('0x34')]=_['intersection'](_0x388213[_0x5d68('0x30')],_0x388213[_0x5d68('0x32')]);_0x5075d8[_0x5d68('0x36')]=_[_0x5d68('0x35')](_0x388213[_0x5d68('0x30')],qs[_0x5d68('0x37')](_0x35d663[_0x5d68('0x32')][_0x5d68('0x37')]));_0x5075d8[_0x5d68('0x36')]=_0x5075d8[_0x5d68('0x36')]['length']?_0x5075d8[_0x5d68('0x36')]:_0x388213[_0x5d68('0x30')];if(_0x35d663[_0x5d68('0x32')][_0x5d68('0x44')]){_0x5075d8[_0x5d68('0x45')]=[{'all':!![]}];}_0x5075d8=_[_0x5d68('0x3c')]({},_0x5075d8,_0x35d663['options']);return db[_0x5d68('0x2c')][_0x5d68('0x46')](_0x5075d8)[_0x5d68('0x22')](handleEntityNotFound(_0x12f738,null))[_0x5d68('0x22')](respondWithResult(_0x12f738,null))['catch'](handleError(_0x12f738,null));};exports[_0x5d68('0x47')]=function(_0x859eeb,_0x20e65c){return db[_0x5d68('0x2c')][_0x5d68('0x47')](_0x859eeb[_0x5d68('0x48')],{})[_0x5d68('0x22')](function(_0x1f42c0){var _0x48d705=_0x859eeb[_0x5d68('0x49')][_0x5d68('0x23')]({'plain':!![]});if(!_0x48d705)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x48d705['role']===_0x5d68('0x49')){var _0x2fe405=_0x1f42c0[_0x5d68('0x23')]({'plain':!![]});var _0x4d38d9='ODBC';return db[_0x5d68('0x4a')][_0x5d68('0x46')]({'where':{'name':_0x4d38d9,'userProfileId':_0x48d705[_0x5d68('0x4b')]},'raw':!![]})['then'](function(_0x1be5dd){if(_0x1be5dd&&_0x1be5dd['autoAssociation']===0x0){return db[_0x5d68('0x25')][_0x5d68('0x47')]({'name':_0x2fe405[_0x5d68('0x31')],'resourceId':_0x2fe405['id'],'type':_0x1be5dd['name'],'sectionId':_0x1be5dd['id']},{})[_0x5d68('0x22')](function(){return _0x1f42c0;});}else{return _0x1f42c0;}})[_0x5d68('0x4c')](function(_0xea759){logger[_0x5d68('0x4d')](_0x5d68('0x4e'),_0xea759);throw _0xea759;});}return _0x1f42c0;})[_0x5d68('0x22')](respondWithResult(_0x20e65c,0xc9))[_0x5d68('0x4c')](handleError(_0x20e65c,null));};exports[_0x5d68('0x21')]=function(_0x5d30af,_0x363adf){if(_0x5d30af[_0x5d68('0x48')]['id']){delete _0x5d30af['body']['id'];}return db[_0x5d68('0x2c')]['find']({'where':{'id':_0x5d30af['params']['id']}})[_0x5d68('0x22')](handleEntityNotFound(_0x363adf,null))[_0x5d68('0x22')](saveUpdates(_0x5d30af[_0x5d68('0x48')],null))[_0x5d68('0x22')](respondWithResult(_0x363adf,null))[_0x5d68('0x4c')](handleError(_0x363adf,null));};exports[_0x5d68('0x26')]=function(_0x3f4d46,_0x381e4b){return db[_0x5d68('0x2c')][_0x5d68('0x46')]({'where':{'id':_0x3f4d46['params']['id']}})[_0x5d68('0x22')](handleEntityNotFound(_0x381e4b,null))['then'](removeEntity(_0x381e4b,null))[_0x5d68('0x4c')](handleError(_0x381e4b,null));};exports['test']=function(_0x7f62b0,_0x4c6e45,_0x2cff64){var _0x3a894d;return db[_0x5d68('0x2c')][_0x5d68('0x46')]({'where':{'id':_0x7f62b0[_0x5d68('0x43')]['id']},'attributes':['id','dsn']})[_0x5d68('0x22')](handleEntityNotFound(_0x4c6e45,null))[_0x5d68('0x22')](function(_0x2adbe5){if(_0x2adbe5){var _0x3b65b0=require(_0x5d68('0x4f'))();_0x3b65b0[_0x5d68('0x50')](_0x2adbe5[_0x5d68('0x51')]);_0x3b65b0[_0x5d68('0x52')]();return _0x2adbe5;}})[_0x5d68('0x22')](respondWithResult(_0x4c6e45,null))['catch'](handleError(_0x4c6e45,null));}; \ No newline at end of file +var _0xdb9c=['sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','ODBC','UserProfileResource','error','stack','name','index','map','SquareOdbc','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','params','rawAttributes','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','catch','body','test','dsn','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x1e30fe,_0x33c422){var _0x378089=function(_0xa08c87){while(--_0xa08c87){_0x1e30fe['push'](_0x1e30fe['shift']());}};_0x378089(++_0x33c422);}(_0xdb9c,0xff));var _0xcdb9=function(_0x32c315,_0x4ab541){_0x32c315=_0x32c315-0x0;var _0x469e07=_0xdb9c[_0x32c315];return _0x469e07;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdb9('0x0'));var zipdir=require(_0xcdb9('0x1'));var jsonpatch=require(_0xcdb9('0x2'));var rp=require(_0xcdb9('0x3'));var moment=require(_0xcdb9('0x4'));var BPromise=require(_0xcdb9('0x5'));var Mustache=require(_0xcdb9('0x6'));var util=require(_0xcdb9('0x7'));var path=require(_0xcdb9('0x8'));var sox=require(_0xcdb9('0x9'));var csv=require(_0xcdb9('0xa'));var ejs=require(_0xcdb9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcdb9('0xc'));var squel=require('squel');var crypto=require(_0xcdb9('0xd'));var jsforce=require(_0xcdb9('0xe'));var deskjs=require(_0xcdb9('0xf'));var toCsv=require(_0xcdb9('0xa'));var querystring=require('querystring');var Papa=require(_0xcdb9('0x10'));var Redis=require(_0xcdb9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcdb9('0x12'));var as=require(_0xcdb9('0x13'));var hardwareService=require(_0xcdb9('0x14'));var logger=require(_0xcdb9('0x15'))('api');var utils=require(_0xcdb9('0x16'));var config=require(_0xcdb9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcdb9('0x18'))['db'];function respondWithStatusCode(_0x1453ba,_0x23a682){_0x23a682=_0x23a682||0xcc;return function(_0x1fa2d1){if(_0x1fa2d1){return _0x1453ba[_0xcdb9('0x19')](_0x23a682);}return _0x1453ba[_0xcdb9('0x1a')](_0x23a682)[_0xcdb9('0x1b')]();};}function respondWithResult(_0x51ad38,_0xabffb9){_0xabffb9=_0xabffb9||0xc8;return function(_0x19be29){if(_0x19be29){return _0x51ad38['status'](_0xabffb9)[_0xcdb9('0x1c')](_0x19be29);}};}function respondWithFilteredResult(_0x3b767b,_0x569547){return function(_0x3a2f09){if(_0x3a2f09){var _0x7538e2=typeof _0x569547[_0xcdb9('0x1d')]==='undefined'&&typeof _0x569547[_0xcdb9('0x1e')]===_0xcdb9('0x1f');var _0x1501be=_0x3a2f09[_0xcdb9('0x20')];var _0x1475ba=_0x7538e2?0x0:_0x569547[_0xcdb9('0x1d')];var _0x8c4a6d=_0x7538e2?_0x3a2f09['count']:_0x569547[_0xcdb9('0x1d')]+_0x569547[_0xcdb9('0x1e')];var _0x535962;if(_0x8c4a6d>=_0x1501be){_0x8c4a6d=_0x1501be;_0x535962=0xc8;}else{_0x535962=0xce;}_0x3b767b['status'](_0x535962);return _0x3b767b[_0xcdb9('0x21')](_0xcdb9('0x22'),_0x1475ba+'-'+_0x8c4a6d+'/'+_0x1501be)['json'](_0x3a2f09);}return null;};}function patchUpdates(_0x976ff1){return function(_0x4d7dba){try{jsonpatch[_0xcdb9('0x23')](_0x4d7dba,_0x976ff1,!![]);}catch(_0x2452d0){return BPromise[_0xcdb9('0x24')](_0x2452d0);}return _0x4d7dba['save']();};}function saveUpdates(_0x65841,_0x15ed90){return function(_0x539305){if(_0x539305){return _0x539305[_0xcdb9('0x25')](_0x65841)[_0xcdb9('0x26')](function(_0x2b3eca){return _0x2b3eca;});}return null;};}function removeEntity(_0x37fff1,_0x1cc606){return function(_0x1db345){if(_0x1db345){return _0x1db345[_0xcdb9('0x27')]()[_0xcdb9('0x26')](function(){var _0x4db3b0=_0x1db345['get']({'plain':!![]});var _0x45139e=_0xcdb9('0x28');return db[_0xcdb9('0x29')][_0xcdb9('0x27')]({'where':{'type':_0x45139e,'resourceId':_0x4db3b0['id']}})['then'](function(){return _0x1db345;});})['then'](function(){_0x37fff1['status'](0xcc)[_0xcdb9('0x1b')]();});}};}function handleEntityNotFound(_0x1d2ef2,_0x2cad92){return function(_0x357cd1){if(!_0x357cd1){_0x1d2ef2[_0xcdb9('0x19')](0x194);}return _0x357cd1;};}function handleError(_0x1dcb43,_0x1b5a74){_0x1b5a74=_0x1b5a74||0x1f4;return function(_0x3299a7){logger[_0xcdb9('0x2a')](_0x3299a7[_0xcdb9('0x2b')]);if(_0x3299a7['name']){delete _0x3299a7[_0xcdb9('0x2c')];}_0x1dcb43[_0xcdb9('0x1a')](_0x1b5a74)['send'](_0x3299a7);};}exports[_0xcdb9('0x2d')]=function(_0xf52c57,_0x53698f){var _0x348fb4={},_0x4828cf={},_0x2e3b10={'count':0x0,'rows':[]};var _0x5e0562=_[_0xcdb9('0x2e')](db[_0xcdb9('0x2f')]['rawAttributes'],function(_0x312784){return{'name':_0x312784[_0xcdb9('0x30')],'type':_0x312784[_0xcdb9('0x31')][_0xcdb9('0x32')]};});_0x4828cf['model']=_[_0xcdb9('0x2e')](_0x5e0562,_0xcdb9('0x2c'));_0x4828cf[_0xcdb9('0x33')]=_[_0xcdb9('0x34')](_0xf52c57[_0xcdb9('0x33')]);_0x4828cf['filters']=_[_0xcdb9('0x35')](_0x4828cf[_0xcdb9('0x36')],_0x4828cf['query']);_0x348fb4[_0xcdb9('0x37')]=_[_0xcdb9('0x35')](_0x4828cf[_0xcdb9('0x36')],qs[_0xcdb9('0x38')](_0xf52c57['query'][_0xcdb9('0x38')]));_0x348fb4[_0xcdb9('0x37')]=_0x348fb4[_0xcdb9('0x37')][_0xcdb9('0x39')]?_0x348fb4[_0xcdb9('0x37')]:_0x4828cf[_0xcdb9('0x36')];if(!_0xf52c57[_0xcdb9('0x33')][_0xcdb9('0x3a')](_0xcdb9('0x3b'))){_0x348fb4[_0xcdb9('0x1e')]=qs[_0xcdb9('0x1e')](_0xf52c57[_0xcdb9('0x33')][_0xcdb9('0x1e')]);_0x348fb4['offset']=qs[_0xcdb9('0x1d')](_0xf52c57[_0xcdb9('0x33')][_0xcdb9('0x1d')]);}_0x348fb4[_0xcdb9('0x3c')]=qs[_0xcdb9('0x3d')](_0xf52c57[_0xcdb9('0x33')][_0xcdb9('0x3d')]);_0x348fb4['where']=qs[_0xcdb9('0x3e')](_[_0xcdb9('0x3f')](_0xf52c57[_0xcdb9('0x33')],_0x4828cf[_0xcdb9('0x3e')]),_0x5e0562);if(_0xf52c57[_0xcdb9('0x33')][_0xcdb9('0x40')]){_0x348fb4[_0xcdb9('0x41')]=_[_0xcdb9('0x42')](_0x348fb4[_0xcdb9('0x41')],{'$or':_[_0xcdb9('0x2e')](_0x5e0562,function(_0x1ebc1e){if(_0x1ebc1e['type']!==_0xcdb9('0x43')){var _0x1ed6d9={};_0x1ed6d9[_0x1ebc1e[_0xcdb9('0x2c')]]={'$like':'%'+_0xf52c57[_0xcdb9('0x33')]['filter']+'%'};return _0x1ed6d9;}})});}_0x348fb4=_[_0xcdb9('0x42')]({},_0x348fb4,_0xf52c57[_0xcdb9('0x44')]);var _0x312592={'where':_0x348fb4[_0xcdb9('0x41')]};return db[_0xcdb9('0x2f')][_0xcdb9('0x20')](_0x312592)[_0xcdb9('0x26')](function(_0x4402b0){_0x2e3b10[_0xcdb9('0x20')]=_0x4402b0;if(_0xf52c57[_0xcdb9('0x33')][_0xcdb9('0x45')]){_0x348fb4[_0xcdb9('0x46')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x348fb4);})[_0xcdb9('0x26')](function(_0x27c6e1){_0x2e3b10[_0xcdb9('0x47')]=_0x27c6e1;return _0x2e3b10;})[_0xcdb9('0x26')](respondWithFilteredResult(_0x53698f,_0x348fb4))['catch'](handleError(_0x53698f,null));};exports['show']=function(_0x20c3f2,_0x46b57c){var _0x45988d={'raw':!![],'where':{'id':_0x20c3f2[_0xcdb9('0x48')]['id']}},_0x55e7b8={};_0x55e7b8[_0xcdb9('0x36')]=_[_0xcdb9('0x34')](db[_0xcdb9('0x2f')][_0xcdb9('0x49')]);_0x55e7b8['query']=_[_0xcdb9('0x34')](_0x20c3f2['query']);_0x55e7b8['filters']=_[_0xcdb9('0x35')](_0x55e7b8[_0xcdb9('0x36')],_0x55e7b8[_0xcdb9('0x33')]);_0x45988d[_0xcdb9('0x37')]=_[_0xcdb9('0x35')](_0x55e7b8[_0xcdb9('0x36')],qs[_0xcdb9('0x38')](_0x20c3f2[_0xcdb9('0x33')][_0xcdb9('0x38')]));_0x45988d[_0xcdb9('0x37')]=_0x45988d[_0xcdb9('0x37')][_0xcdb9('0x39')]?_0x45988d[_0xcdb9('0x37')]:_0x55e7b8[_0xcdb9('0x36')];if(_0x20c3f2[_0xcdb9('0x33')]['includeAll']){_0x45988d['include']=[{'all':!![]}];}_0x45988d=_[_0xcdb9('0x42')]({},_0x45988d,_0x20c3f2[_0xcdb9('0x44')]);return db[_0xcdb9('0x2f')][_0xcdb9('0x4a')](_0x45988d)['then'](handleEntityNotFound(_0x46b57c,null))[_0xcdb9('0x26')](respondWithResult(_0x46b57c,null))['catch'](handleError(_0x46b57c,null));};exports['create']=function(_0x3961da,_0x18498c){return db[_0xcdb9('0x2f')]['create'](_0x3961da['body'],{})['then'](function(_0x37073c){var _0x24d878=_0x3961da[_0xcdb9('0x4b')][_0xcdb9('0x4c')]({'plain':!![]});if(!_0x24d878)throw new Error(_0xcdb9('0x4d'));if(_0x24d878[_0xcdb9('0x4e')]===_0xcdb9('0x4b')){var _0x1b1e55=_0x37073c['get']({'plain':!![]});var _0xe8fa48=_0xcdb9('0x28');return db[_0xcdb9('0x4f')]['find']({'where':{'name':_0xe8fa48,'userProfileId':_0x24d878['userProfileId']},'raw':!![]})['then'](function(_0x1ea6c7){if(_0x1ea6c7&&_0x1ea6c7[_0xcdb9('0x50')]===0x0){return db['UserProfileResource'][_0xcdb9('0x51')]({'name':_0x1b1e55['name'],'resourceId':_0x1b1e55['id'],'type':_0x1ea6c7[_0xcdb9('0x2c')],'sectionId':_0x1ea6c7['id']},{})[_0xcdb9('0x26')](function(){return _0x37073c;});}else{return _0x37073c;}})['catch'](function(_0xe1a0e1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe1a0e1);throw _0xe1a0e1;});}return _0x37073c;})[_0xcdb9('0x26')](respondWithResult(_0x18498c,0xc9))[_0xcdb9('0x52')](handleError(_0x18498c,null));};exports[_0xcdb9('0x25')]=function(_0xd5b8f6,_0x1ce559){if(_0xd5b8f6[_0xcdb9('0x53')]['id']){delete _0xd5b8f6[_0xcdb9('0x53')]['id'];}return db[_0xcdb9('0x2f')][_0xcdb9('0x4a')]({'where':{'id':_0xd5b8f6[_0xcdb9('0x48')]['id']}})[_0xcdb9('0x26')](handleEntityNotFound(_0x1ce559,null))[_0xcdb9('0x26')](saveUpdates(_0xd5b8f6[_0xcdb9('0x53')],null))['then'](respondWithResult(_0x1ce559,null))[_0xcdb9('0x52')](handleError(_0x1ce559,null));};exports['destroy']=function(_0xe335c5,_0x4aad5e){return db[_0xcdb9('0x2f')][_0xcdb9('0x4a')]({'where':{'id':_0xe335c5[_0xcdb9('0x48')]['id']}})[_0xcdb9('0x26')](handleEntityNotFound(_0x4aad5e,null))[_0xcdb9('0x26')](removeEntity(_0x4aad5e,null))['catch'](handleError(_0x4aad5e,null));};exports[_0xcdb9('0x54')]=function(_0x23a486,_0x1d5f46,_0x4006c2){var _0x4ee9df;return db[_0xcdb9('0x2f')]['find']({'where':{'id':_0x23a486[_0xcdb9('0x48')]['id']},'attributes':['id',_0xcdb9('0x55')]})['then'](handleEntityNotFound(_0x1d5f46,null))[_0xcdb9('0x26')](function(_0xcb90aa){if(_0xcb90aa){var _0x106579=require('odbc')();_0x106579[_0xcdb9('0x56')](_0xcb90aa[_0xcdb9('0x55')]);_0x106579[_0xcdb9('0x57')]();return _0xcb90aa;}})[_0xcdb9('0x26')](respondWithResult(_0x1d5f46,null))[_0xcdb9('0x52')](handleError(_0x1d5f46,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index edfe887..ff60bef 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 _0x5074=['SquareOdbc','square_odbc','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define'];(function(_0x1502ee,_0x546d3c){var _0x45c0af=function(_0x5b66d){while(--_0x5b66d){_0x1502ee['push'](_0x1502ee['shift']());}};_0x45c0af(++_0x546d3c);}(_0x5074,0x6e));var _0x4507=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x5074[_0x4e676e];return _0x336a3c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4507('0x0'))(_0x4507('0x1'));var moment=require(_0x4507('0x2'));var BPromise=require(_0x4507('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4507('0x4'));var rimraf=require(_0x4507('0x5'));var config=require(_0x4507('0x6'));var attributes=require(_0x4507('0x7'));module[_0x4507('0x8')]=function(_0x47fbcd,_0x7b7939){return _0x47fbcd[_0x4507('0x9')](_0x4507('0xa'),attributes,{'tableName':_0x4507('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc897=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareOdbc.attributes','exports','define','SquareOdbc','lodash','util'];(function(_0x4f152a,_0x1888f5){var _0x41552f=function(_0x10596b){while(--_0x10596b){_0x4f152a['push'](_0x4f152a['shift']());}};_0x41552f(++_0x1888f5);}(_0xc897,0xc1));var _0x7c89=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xc897[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0x7c89('0x0'));var util=require(_0x7c89('0x1'));var logger=require(_0x7c89('0x2'))(_0x7c89('0x3'));var moment=require(_0x7c89('0x4'));var BPromise=require(_0x7c89('0x5'));var rp=require(_0x7c89('0x6'));var fs=require('fs');var path=require(_0x7c89('0x7'));var rimraf=require(_0x7c89('0x8'));var config=require('../../config/environment');var attributes=require(_0x7c89('0x9'));module[_0x7c89('0xa')]=function(_0x5bff64,_0xa3acd7){return _0x5bff64[_0x7c89('0xb')](_0x7c89('0xc'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 7f25c3c..113cbd3 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 _0xd12d=['request','then','info','request\x20sent','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','result','catch','SquareOdbc','find','options','raw','attributes','include','map','model','ShowSquareOdbc','debug','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd12d,0x17d));var _0xdd12=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xd12d[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdd12('0x0'));var fs=require('fs');var Redis=require(_0xdd12('0x1'));var db=require(_0xdd12('0x2'))['db'];var utils=require(_0xdd12('0x3'));var logger=require('../../config/logger')(_0xdd12('0x4'));var config=require(_0xdd12('0x5'));var jayson=require(_0xdd12('0x6'));var client=jayson[_0xdd12('0x7')][_0xdd12('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x133d52,_0x9efbad,_0x1bb551){return new BPromise(function(_0x16e175,_0x5933b8){return client[_0xdd12('0x9')](_0x133d52,_0x1bb551)[_0xdd12('0xa')](function(_0x57b4eb){logger[_0xdd12('0xb')]('SquareOdbc,\x20%s,\x20%s',_0x9efbad,_0xdd12('0xc'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x9efbad,_0xdd12('0xc'),JSON[_0xdd12('0xd')](_0x57b4eb));if(_0x57b4eb[_0xdd12('0xe')]){if(_0x57b4eb[_0xdd12('0xe')][_0xdd12('0xf')]===0x1f4){logger[_0xdd12('0xe')](_0xdd12('0x10'),_0x9efbad,_0x57b4eb[_0xdd12('0xe')][_0xdd12('0x11')]);return _0x5933b8(_0x57b4eb[_0xdd12('0xe')]['message']);}logger['error'](_0xdd12('0x10'),_0x9efbad,_0x57b4eb[_0xdd12('0xe')][_0xdd12('0x11')]);return _0x16e175(_0x57b4eb['error'][_0xdd12('0x11')]);}else{logger[_0xdd12('0xb')]('SquareOdbc,\x20%s,\x20%s',_0x9efbad,_0xdd12('0xc'));_0x16e175(_0x57b4eb[_0xdd12('0x12')][_0xdd12('0x11')]);}})[_0xdd12('0x13')](function(_0x3b55b6){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x9efbad,_0x3b55b6);_0x5933b8(_0x3b55b6);});});}exports['ShowSquareOdbc']=function(_0x140910){var _0x33a5a1=this;return new Promise(function(_0xcd88c5,_0x3dc1f4){return db[_0xdd12('0x14')][_0xdd12('0x15')]({'raw':_0x140910['options']?_0x140910[_0xdd12('0x16')][_0xdd12('0x17')]===undefined?!![]:![]:!![],'where':_0x140910['options']?_0x140910[_0xdd12('0x16')]['where']||null:null,'attributes':_0x140910['options']?_0x140910[_0xdd12('0x16')][_0xdd12('0x18')]||null:null,'include':_0x140910[_0xdd12('0x16')]?_0x140910[_0xdd12('0x16')][_0xdd12('0x19')]?_[_0xdd12('0x1a')](_0x140910[_0xdd12('0x16')][_0xdd12('0x19')],function(_0x64f71b){return{'model':db[_0x64f71b[_0xdd12('0x1b')]],'as':_0x64f71b['as'],'attributes':_0x64f71b[_0xdd12('0x18')],'include':_0x64f71b[_0xdd12('0x19')]?_[_0xdd12('0x1a')](_0x64f71b[_0xdd12('0x19')],function(_0x4372ae){return{'model':db[_0x4372ae[_0xdd12('0x1b')]],'as':_0x4372ae['as'],'attributes':_0x4372ae['attributes'],'include':_0x4372ae[_0xdd12('0x19')]?_[_0xdd12('0x1a')](_0x4372ae[_0xdd12('0x19')],function(_0x1b2aed){return{'model':db[_0x1b2aed[_0xdd12('0x1b')]],'as':_0x1b2aed['as'],'attributes':_0x1b2aed[_0xdd12('0x18')]};}):[]};}):[]};}):[]:[]})[_0xdd12('0xa')](function(_0x5d8874){logger[_0xdd12('0xb')](_0xdd12('0x1c'),_0x140910);logger[_0xdd12('0x1d')](_0xdd12('0x1c'),_0x140910,JSON['stringify'](_0x5d8874));_0xcd88c5(_0x5d8874);})[_0xdd12('0x13')](function(_0xcfaefb){logger[_0xdd12('0xe')](_0xdd12('0x1c'),_0xcfaefb[_0xdd12('0x11')],_0x140910);_0x3dc1f4(_0x33a5a1[_0xdd12('0xe')](0x1f4,_0xcfaefb[_0xdd12('0x11')]));});});}; \ No newline at end of file +var _0x42c5=['../../config/logger','request','then','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','options','raw','where','include','model','attributes','map','catch','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x514aa1,_0x189c7a){var _0x5375aa=function(_0x3ed9d2){while(--_0x3ed9d2){_0x514aa1['push'](_0x514aa1['shift']());}};_0x5375aa(++_0x189c7a);}(_0x42c5,0x1c8));var _0x542c=function(_0x18b87b,_0x5e5757){_0x18b87b=_0x18b87b-0x0;var _0x53195a=_0x42c5[_0x18b87b];return _0x53195a;};'use strict';var _=require(_0x542c('0x0'));var util=require(_0x542c('0x1'));var moment=require(_0x542c('0x2'));var BPromise=require(_0x542c('0x3'));var rs=require(_0x542c('0x4'));var fs=require('fs');var Redis=require(_0x542c('0x5'));var db=require(_0x542c('0x6'))['db'];var utils=require(_0x542c('0x7'));var logger=require(_0x542c('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x170baf,_0x1707dd,_0x3817be){return new BPromise(function(_0x4bb498,_0xe13145){return client[_0x542c('0x9')](_0x170baf,_0x3817be)[_0x542c('0xa')](function(_0x3ec98c){logger['info'](_0x542c('0xb'),_0x1707dd,'request\x20sent');logger[_0x542c('0xc')](_0x542c('0xd'),_0x1707dd,_0x542c('0xe'),JSON[_0x542c('0xf')](_0x3ec98c));if(_0x3ec98c['error']){if(_0x3ec98c[_0x542c('0x10')][_0x542c('0x11')]===0x1f4){logger[_0x542c('0x10')](_0x542c('0xb'),_0x1707dd,_0x3ec98c[_0x542c('0x10')][_0x542c('0x12')]);return _0xe13145(_0x3ec98c['error']['message']);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x1707dd,_0x3ec98c['error'][_0x542c('0x12')]);return _0x4bb498(_0x3ec98c[_0x542c('0x10')][_0x542c('0x12')]);}else{logger[_0x542c('0x13')](_0x542c('0xb'),_0x1707dd,_0x542c('0xe'));_0x4bb498(_0x3ec98c['result'][_0x542c('0x12')]);}})['catch'](function(_0xaf42b5){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x1707dd,_0xaf42b5);_0xe13145(_0xaf42b5);});});}exports['ShowSquareOdbc']=function(_0x3b602b){var _0x3c99fb=this;return new Promise(function(_0x5722d4,_0x2cac4b){return db['SquareOdbc']['find']({'raw':_0x3b602b['options']?_0x3b602b[_0x542c('0x14')][_0x542c('0x15')]===undefined?!![]:![]:!![],'where':_0x3b602b[_0x542c('0x14')]?_0x3b602b['options'][_0x542c('0x16')]||null:null,'attributes':_0x3b602b[_0x542c('0x14')]?_0x3b602b[_0x542c('0x14')]['attributes']||null:null,'include':_0x3b602b[_0x542c('0x14')]?_0x3b602b[_0x542c('0x14')][_0x542c('0x17')]?_['map'](_0x3b602b[_0x542c('0x14')][_0x542c('0x17')],function(_0xa75f3e){return{'model':db[_0xa75f3e[_0x542c('0x18')]],'as':_0xa75f3e['as'],'attributes':_0xa75f3e['attributes'],'include':_0xa75f3e[_0x542c('0x17')]?_['map'](_0xa75f3e['include'],function(_0x209a10){return{'model':db[_0x209a10[_0x542c('0x18')]],'as':_0x209a10['as'],'attributes':_0x209a10[_0x542c('0x19')],'include':_0x209a10[_0x542c('0x17')]?_[_0x542c('0x1a')](_0x209a10['include'],function(_0x23b4b0){return{'model':db[_0x23b4b0['model']],'as':_0x23b4b0['as'],'attributes':_0x23b4b0['attributes']};}):[]};}):[]};}):[]:[]})[_0x542c('0xa')](function(_0x2a3d41){logger[_0x542c('0x13')]('ShowSquareOdbc',_0x3b602b);logger[_0x542c('0xc')]('ShowSquareOdbc',_0x3b602b,JSON['stringify'](_0x2a3d41));_0x5722d4(_0x2a3d41);})[_0x542c('0x1b')](function(_0x1cd14c){logger['error'](_0x542c('0x1c'),_0x1cd14c['message'],_0x3b602b);_0x2cac4b(_0x3c99fb['error'](0x1f4,_0x1cd14c[_0x542c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 02f4c65..156bab4 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 _0xaa2f=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x493a51,_0x45128c){var _0xc85756=function(_0x2c39a8){while(--_0x2c39a8){_0x493a51['push'](_0x493a51['shift']());}};_0xc85756(++_0x45128c);}(_0xaa2f,0x15f));var _0xfaa2=function(_0x37a40c,_0xb8c51d){_0x37a40c=_0x37a40c-0x0;var _0x484731=_0xaa2f[_0x37a40c];return _0x484731;};'use strict';var multer=require(_0xfaa2('0x0'));var util=require(_0xfaa2('0x1'));var path=require(_0xfaa2('0x2'));var timeout=require('connect-timeout');var express=require(_0xfaa2('0x3'));var router=express['Router']();var fs_extra=require(_0xfaa2('0x4'));var auth=require(_0xfaa2('0x5'));var interaction=require(_0xfaa2('0x6'));var config=require(_0xfaa2('0x7'));var controller=require('./squareProject.controller');router[_0xfaa2('0x8')]('/',auth[_0xfaa2('0x9')](),controller[_0xfaa2('0xa')]);router[_0xfaa2('0x8')](_0xfaa2('0xb'),auth[_0xfaa2('0x9')](),controller['show']);router[_0xfaa2('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xfaa2('0xb'),auth['isAuthenticated'](),controller[_0xfaa2('0xd')]);router[_0xfaa2('0xe')](_0xfaa2('0xb'),auth[_0xfaa2('0x9')](),controller[_0xfaa2('0xf')]);module[_0xfaa2('0x10')]=router; \ No newline at end of file +var _0x534f=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','post','create','put','update','destroy','multer'];(function(_0x3c3684,_0x3ce718){var _0x1dbe6a=function(_0x439c10){while(--_0x439c10){_0x3c3684['push'](_0x3c3684['shift']());}};_0x1dbe6a(++_0x3ce718);}(_0x534f,0xed));var _0xf534=function(_0x3d3592,_0x5c19ad){_0x3d3592=_0x3d3592-0x0;var _0xd0652d=_0x534f[_0x3d3592];return _0xd0652d;};'use strict';var multer=require(_0xf534('0x0'));var util=require(_0xf534('0x1'));var path=require(_0xf534('0x2'));var timeout=require(_0xf534('0x3'));var express=require(_0xf534('0x4'));var router=express['Router']();var fs_extra=require(_0xf534('0x5'));var auth=require(_0xf534('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf534('0x7'));var controller=require(_0xf534('0x8'));router[_0xf534('0x9')]('/',auth[_0xf534('0xa')](),controller['index']);router[_0xf534('0x9')](_0xf534('0xb'),auth[_0xf534('0xa')](),controller['show']);router[_0xf534('0xc')]('/',auth[_0xf534('0xa')](),controller[_0xf534('0xd')]);router[_0xf534('0xe')](_0xf534('0xb'),auth[_0xf534('0xa')](),controller[_0xf534('0xf')]);router['delete'](_0xf534('0xb'),auth['isAuthenticated'](),controller[_0xf534('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 4f1a0aa..3bb2c66 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 _0xb912=['TEXT','getDataValue','preproduction','toString','utf8','BLOB','production','DATE','sequelize','exports','name'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb912,0xb8));var _0x2b91=function(_0x274e5d,_0x316f5b){_0x274e5d=_0x274e5d-0x0;var _0x49686c=_0xb912[_0x274e5d];return _0x49686c;};'use strict';var Sequelize=require(_0x2b91('0x0'));module[_0x2b91('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2b91('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x2b91('0x3')]},'preproduction':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x2b91('0x4')](_0x2b91('0x5'))){return this['getDataValue'](_0x2b91('0x5'))[_0x2b91('0x6')](_0x2b91('0x7'));}}},'production':{'type':Sequelize[_0x2b91('0x8')]('long'),'get':function(){if(this['getDataValue'](_0x2b91('0x9'))){return this[_0x2b91('0x4')](_0x2b91('0x9'))['toString'](_0x2b91('0x7'));}}},'savedAt':{'type':Sequelize[_0x2b91('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xf935=['BLOB','production','DATE','sequelize','exports','STRING','name','TEXT','long','preproduction','toString','utf8'];(function(_0x3ccc44,_0x207b0c){var _0x5d74bb=function(_0x59989a){while(--_0x59989a){_0x3ccc44['push'](_0x3ccc44['shift']());}};_0x5d74bb(++_0x207b0c);}(_0xf935,0x1ef));var _0x5f93=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf935[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x5f93('0x0'));module[_0x5f93('0x1')]={'name':{'type':Sequelize[_0x5f93('0x2')],'unique':_0x5f93('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x5f93('0x2')]},'notes':{'type':Sequelize[_0x5f93('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x5f93('0x5')),'get':function(){if(this['getDataValue'](_0x5f93('0x6'))){return this['getDataValue'](_0x5f93('0x6'))[_0x5f93('0x7')](_0x5f93('0x8'));}}},'production':{'type':Sequelize[_0x5f93('0x9')](_0x5f93('0x5')),'get':function(){if(this['getDataValue'](_0x5f93('0xa'))){return this['getDataValue']('production')[_0x5f93('0x7')](_0x5f93('0x8'));}}},'savedAt':{'type':Sequelize[_0x5f93('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index bd6bbf3..1911624 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 _0xe9fc=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','status','json','undefined','limit','count','offset','set','update','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','stringify','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','SquareProject','includeAll','include','rows','catch','params','find'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xe9fc,0x199));var _0xce9f=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0xe9fc[_0x580647];return _0x5f0792;};'use strict';var _=require('lodash');var Redis=require(_0xce9f('0x0'));var qs=require(_0xce9f('0x1'));var logger=require(_0xce9f('0x2'))(_0xce9f('0x3'));var config=require('../../config/environment');var db=require(_0xce9f('0x4'))['db'];config[_0xce9f('0x5')]=_['defaults'](config[_0xce9f('0x5')],{'host':_0xce9f('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xce9f('0x5')]));require('./squareProject.socket')['register'](socket);function respondWithResult(_0x486dbe,_0x4127be){_0x4127be=_0x4127be||0xc8;return function(_0x225efe){if(_0x225efe){return _0x486dbe[_0xce9f('0x7')](_0x4127be)[_0xce9f('0x8')](_0x225efe);}};}function respondWithFilteredResult(_0x66f8e9,_0x337c4e){return function(_0xad6fa6){if(_0xad6fa6){var _0x379f6a=typeof _0x337c4e['offset']===_0xce9f('0x9')&&typeof _0x337c4e[_0xce9f('0xa')]===_0xce9f('0x9');var _0xf2588=_0xad6fa6[_0xce9f('0xb')];var _0xce99b1=_0x379f6a?0x0:_0x337c4e[_0xce9f('0xc')];var _0x10d45c=_0x379f6a?_0xad6fa6['count']:_0x337c4e[_0xce9f('0xc')]+_0x337c4e[_0xce9f('0xa')];var _0x3dd589;if(_0x10d45c>=_0xf2588){_0x10d45c=_0xf2588;_0x3dd589=0xc8;}else{_0x3dd589=0xce;}_0x66f8e9[_0xce9f('0x7')](_0x3dd589);return _0x66f8e9[_0xce9f('0xd')]('Content-Range',_0xce99b1+'-'+_0x10d45c+'/'+_0xf2588)[_0xce9f('0x8')](_0xad6fa6);}return null;};}function saveUpdates(_0xb613fa){return function(_0x33328b){if(_0x33328b){return _0x33328b[_0xce9f('0xe')](_0xb613fa)[_0xce9f('0xf')](function(_0x1281bc){return _0x1281bc;});}return null;};}function removeEntity(_0x4d86e7){return function(_0x161537){if(_0x161537){return _0x161537[_0xce9f('0x10')]()[_0xce9f('0xf')](function(){var _0x49ea9a=_0x161537[_0xce9f('0x11')]({'plain':!![]});var _0x3fe09e=_0xce9f('0x12');return db[_0xce9f('0x13')][_0xce9f('0x10')]({'where':{'type':_0x3fe09e,'resourceId':_0x49ea9a['id']}})[_0xce9f('0xf')](function(){return _0x161537;});})['then'](function(){var _0x159dbb=new Redis(config[_0xce9f('0x5')]);_0x159dbb[_0xce9f('0x14')](_0xce9f('0x15'),JSON[_0xce9f('0x16')]({'id':_0x161537['id'],'deleted':!![]}));})[_0xce9f('0xf')](function(){_0x4d86e7[_0xce9f('0x7')](0xcc)[_0xce9f('0x17')]();});}};}function handleEntityNotFound(_0x373d64){return function(_0x2ae304){if(!_0x2ae304){_0x373d64[_0xce9f('0x18')](0x194);}return _0x2ae304;};}function handleError(_0x125fb4,_0x42701c){_0x42701c=_0x42701c||0x1f4;return function(_0x593841){logger[_0xce9f('0x19')](_0x593841[_0xce9f('0x1a')]);if(_0x593841['name']){delete _0x593841[_0xce9f('0x1b')];}_0x125fb4[_0xce9f('0x7')](_0x42701c)[_0xce9f('0x1c')](_0x593841);};}exports[_0xce9f('0x1d')]=function(_0x30c4a2,_0x1c0951){var _0x43b1e1={},_0x3c37b7={},_0x41250c={'count':0x0,'rows':[]};var _0xbb77f8=_[_0xce9f('0x1e')](db['SquareProject'][_0xce9f('0x1f')],function(_0x5811c8){return{'name':_0x5811c8[_0xce9f('0x20')],'type':_0x5811c8[_0xce9f('0x21')][_0xce9f('0x22')]};});_0x3c37b7[_0xce9f('0x23')]=_[_0xce9f('0x1e')](_0xbb77f8,'name');_0x3c37b7['query']=_[_0xce9f('0x24')](_0x30c4a2[_0xce9f('0x25')]);_0x3c37b7['filters']=_[_0xce9f('0x26')](_0x3c37b7['model'],_0x3c37b7[_0xce9f('0x25')]);_0x43b1e1['attributes']=_[_0xce9f('0x26')](_0x3c37b7[_0xce9f('0x23')],qs['fields'](_0x30c4a2[_0xce9f('0x25')][_0xce9f('0x27')]));_0x43b1e1[_0xce9f('0x28')]=_0x43b1e1[_0xce9f('0x28')][_0xce9f('0x29')]?_0x43b1e1[_0xce9f('0x28')]:_0x3c37b7['model'];if(!_0x30c4a2[_0xce9f('0x25')][_0xce9f('0x2a')](_0xce9f('0x2b'))){_0x43b1e1['limit']=qs[_0xce9f('0xa')](_0x30c4a2[_0xce9f('0x25')][_0xce9f('0xa')]);_0x43b1e1[_0xce9f('0xc')]=qs[_0xce9f('0xc')](_0x30c4a2[_0xce9f('0x25')][_0xce9f('0xc')]);}_0x43b1e1[_0xce9f('0x2c')]=qs[_0xce9f('0x2d')](_0x30c4a2[_0xce9f('0x25')][_0xce9f('0x2d')]);_0x43b1e1[_0xce9f('0x2e')]=qs[_0xce9f('0x2f')](_[_0xce9f('0x30')](_0x30c4a2['query'],_0x3c37b7[_0xce9f('0x2f')]),_0xbb77f8);if(_0x30c4a2[_0xce9f('0x25')][_0xce9f('0x31')]){_0x43b1e1[_0xce9f('0x2e')]=_['merge'](_0x43b1e1[_0xce9f('0x2e')],{'$or':_[_0xce9f('0x1e')](_0xbb77f8,function(_0x363a3b){if(_0x363a3b['type']!==_0xce9f('0x32')){var _0x49ab77={};_0x49ab77[_0x363a3b[_0xce9f('0x1b')]]={'$like':'%'+_0x30c4a2[_0xce9f('0x25')][_0xce9f('0x31')]+'%'};return _0x49ab77;}})});}_0x43b1e1=_[_0xce9f('0x33')]({},_0x43b1e1,_0x30c4a2[_0xce9f('0x34')]);var _0x1795ae={'where':_0x43b1e1['where']};return db[_0xce9f('0x35')][_0xce9f('0xb')](_0x1795ae)[_0xce9f('0xf')](function(_0x48b8a5){_0x41250c[_0xce9f('0xb')]=_0x48b8a5;if(_0x30c4a2[_0xce9f('0x25')][_0xce9f('0x36')]){_0x43b1e1[_0xce9f('0x37')]=[{'all':!![]}];}return db[_0xce9f('0x35')]['findAll'](_0x43b1e1);})['then'](function(_0x497ebe){_0x41250c[_0xce9f('0x38')]=_0x497ebe;return _0x41250c;})['then'](respondWithFilteredResult(_0x1c0951,_0x43b1e1))[_0xce9f('0x39')](handleError(_0x1c0951,null));};exports['show']=function(_0x1610e2,_0x20aa0a){var _0xc0241e={'raw':![],'where':{'id':_0x1610e2[_0xce9f('0x3a')]['id']}},_0x2f04c5={};_0x2f04c5[_0xce9f('0x23')]=_[_0xce9f('0x24')](db[_0xce9f('0x35')][_0xce9f('0x1f')]);_0x2f04c5[_0xce9f('0x25')]=_['keys'](_0x1610e2['query']);_0x2f04c5[_0xce9f('0x2f')]=_[_0xce9f('0x26')](_0x2f04c5[_0xce9f('0x23')],_0x2f04c5[_0xce9f('0x25')]);_0xc0241e[_0xce9f('0x28')]=_[_0xce9f('0x26')](_0x2f04c5[_0xce9f('0x23')],qs[_0xce9f('0x27')](_0x1610e2[_0xce9f('0x25')][_0xce9f('0x27')]));_0xc0241e[_0xce9f('0x28')]=_0xc0241e[_0xce9f('0x28')][_0xce9f('0x29')]?_0xc0241e[_0xce9f('0x28')]:_0x2f04c5['model'];if(_0x1610e2[_0xce9f('0x25')][_0xce9f('0x36')]){_0xc0241e[_0xce9f('0x37')]=[{'all':!![]}];}_0xc0241e=_['merge']({},_0xc0241e,_0x1610e2[_0xce9f('0x34')]);return db[_0xce9f('0x35')][_0xce9f('0x3b')](_0xc0241e)[_0xce9f('0xf')](handleEntityNotFound(_0x20aa0a,null))['then'](respondWithResult(_0x20aa0a,null))[_0xce9f('0x39')](handleError(_0x20aa0a,null));};exports[_0xce9f('0x3c')]=function(_0x17b773,_0x50dc80){return db[_0xce9f('0x35')]['create'](_0x17b773[_0xce9f('0x3d')],{})[_0xce9f('0xf')](function(_0x3afd52){var _0x5e0e98=_0x17b773[_0xce9f('0x3e')][_0xce9f('0x11')]({'plain':!![]});if(!_0x5e0e98)throw new Error(_0xce9f('0x3f'));if(_0x5e0e98[_0xce9f('0x40')]===_0xce9f('0x3e')){var _0x161c8d=_0x3afd52[_0xce9f('0x11')]({'plain':!![]});var _0x247930=_0xce9f('0x12');return db[_0xce9f('0x41')][_0xce9f('0x3b')]({'where':{'name':_0x247930,'userProfileId':_0x5e0e98['userProfileId']},'raw':!![]})[_0xce9f('0xf')](function(_0x35b12b){if(_0x35b12b&&_0x35b12b[_0xce9f('0x42')]===0x0){return db[_0xce9f('0x13')]['create']({'name':_0x161c8d['name'],'resourceId':_0x161c8d['id'],'type':_0x35b12b['name'],'sectionId':_0x35b12b['id']},{})[_0xce9f('0xf')](function(){return _0x3afd52;});}else{return _0x3afd52;}})['catch'](function(_0x37a7cc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37a7cc);throw _0x37a7cc;});}return _0x3afd52;})[_0xce9f('0xf')](respondWithResult(_0x50dc80,0xc9))[_0xce9f('0x39')](handleError(_0x50dc80,null));};exports[_0xce9f('0xe')]=function(_0x545eae,_0x453947){if(_0x545eae['body']['id']){delete _0x545eae[_0xce9f('0x3d')]['id'];}return db[_0xce9f('0x35')][_0xce9f('0x3b')]({'where':{'id':_0x545eae[_0xce9f('0x3a')]['id']}})['then'](handleEntityNotFound(_0x453947,null))[_0xce9f('0xf')](saveUpdates(_0x545eae[_0xce9f('0x3d')],null))[_0xce9f('0xf')](function(_0xe798c7){if(!_0xe798c7)return;var _0xfbb6d1=_0xe798c7[_0xce9f('0x11')]({'plain':!![]});return _0xfbb6d1;})['then'](function(_0x583e14){var _0x26b625=new Redis(config[_0xce9f('0x5')]);_0x26b625[_0xce9f('0x14')](_0xce9f('0x15'),JSON[_0xce9f('0x16')](_[_0xce9f('0x30')](_0x583e14,['id',_0xce9f('0x1b'),'production'])));return _0x583e14;})[_0xce9f('0xf')](respondWithResult(_0x453947,null))['catch'](handleError(_0x453947,null));};exports[_0xce9f('0x10')]=function(_0x4a6b97,_0x3309bd){return db['SquareProject']['find']({'where':{'id':_0x4a6b97[_0xce9f('0x3a')]['id']}})[_0xce9f('0xf')](handleEntityNotFound(_0x3309bd,null))[_0xce9f('0xf')](removeEntity(_0x3309bd,null))['catch'](handleError(_0x3309bd,null));}; \ No newline at end of file +var _0xf960=['send','index','map','SquareProject','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','stringify','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','register','json','undefined','limit','count','offset','status','set','Content-Range','update','then','destroy','get','SquareProjects','publish','agi','sendStatus','error','stack','name'];(function(_0x5d4586,_0x2fc2dd){var _0x44f1e2=function(_0x54e1c4){while(--_0x54e1c4){_0x5d4586['push'](_0x5d4586['shift']());}};_0x44f1e2(++_0x2fc2dd);}(_0xf960,0x142));var _0x0f96=function(_0x272638,_0x42b993){_0x272638=_0x272638-0x0;var _0x19d027=_0xf960[_0x272638];return _0x19d027;};'use strict';var _=require(_0x0f96('0x0'));var Redis=require(_0x0f96('0x1'));var qs=require(_0x0f96('0x2'));var logger=require(_0x0f96('0x3'))('api');var config=require(_0x0f96('0x4'));var db=require(_0x0f96('0x5'))['db'];config[_0x0f96('0x6')]=_['defaults'](config[_0x0f96('0x6')],{'host':_0x0f96('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0f96('0x6')]));require('./squareProject.socket')[_0x0f96('0x8')](socket);function respondWithResult(_0x1c3d8e,_0x5a2d14){_0x5a2d14=_0x5a2d14||0xc8;return function(_0x187a5a){if(_0x187a5a){return _0x1c3d8e['status'](_0x5a2d14)[_0x0f96('0x9')](_0x187a5a);}};}function respondWithFilteredResult(_0x3f68a4,_0x171d4b){return function(_0x57066f){if(_0x57066f){var _0x85d667=typeof _0x171d4b['offset']===_0x0f96('0xa')&&typeof _0x171d4b[_0x0f96('0xb')]===_0x0f96('0xa');var _0x1876a3=_0x57066f[_0x0f96('0xc')];var _0x139337=_0x85d667?0x0:_0x171d4b[_0x0f96('0xd')];var _0x116a70=_0x85d667?_0x57066f[_0x0f96('0xc')]:_0x171d4b['offset']+_0x171d4b[_0x0f96('0xb')];var _0x3f4731;if(_0x116a70>=_0x1876a3){_0x116a70=_0x1876a3;_0x3f4731=0xc8;}else{_0x3f4731=0xce;}_0x3f68a4[_0x0f96('0xe')](_0x3f4731);return _0x3f68a4[_0x0f96('0xf')](_0x0f96('0x10'),_0x139337+'-'+_0x116a70+'/'+_0x1876a3)['json'](_0x57066f);}return null;};}function saveUpdates(_0xee70ab){return function(_0x2279a2){if(_0x2279a2){return _0x2279a2[_0x0f96('0x11')](_0xee70ab)[_0x0f96('0x12')](function(_0x340454){return _0x340454;});}return null;};}function removeEntity(_0x44f764){return function(_0x1bb640){if(_0x1bb640){return _0x1bb640[_0x0f96('0x13')]()[_0x0f96('0x12')](function(){var _0x35a754=_0x1bb640[_0x0f96('0x14')]({'plain':!![]});var _0x55a54a=_0x0f96('0x15');return db['UserProfileResource']['destroy']({'where':{'type':_0x55a54a,'resourceId':_0x35a754['id']}})[_0x0f96('0x12')](function(){return _0x1bb640;});})[_0x0f96('0x12')](function(){var _0x45d9f5=new Redis(config[_0x0f96('0x6')]);_0x45d9f5[_0x0f96('0x16')](_0x0f96('0x17'),JSON['stringify']({'id':_0x1bb640['id'],'deleted':!![]}));})[_0x0f96('0x12')](function(){_0x44f764[_0x0f96('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50f244){return function(_0x17d5ce){if(!_0x17d5ce){_0x50f244[_0x0f96('0x18')](0x194);}return _0x17d5ce;};}function handleError(_0x3800c6,_0x27c2e6){_0x27c2e6=_0x27c2e6||0x1f4;return function(_0x157b16){logger[_0x0f96('0x19')](_0x157b16[_0x0f96('0x1a')]);if(_0x157b16[_0x0f96('0x1b')]){delete _0x157b16[_0x0f96('0x1b')];}_0x3800c6['status'](_0x27c2e6)[_0x0f96('0x1c')](_0x157b16);};}exports[_0x0f96('0x1d')]=function(_0xd73b2c,_0xfc729b){var _0x319f5f={},_0x5eaf1={},_0x3ba75b={'count':0x0,'rows':[]};var _0x3953c2=_[_0x0f96('0x1e')](db[_0x0f96('0x1f')][_0x0f96('0x20')],function(_0xa7c3e1){return{'name':_0xa7c3e1[_0x0f96('0x21')],'type':_0xa7c3e1['type'][_0x0f96('0x22')]};});_0x5eaf1[_0x0f96('0x23')]=_[_0x0f96('0x1e')](_0x3953c2,_0x0f96('0x1b'));_0x5eaf1[_0x0f96('0x24')]=_[_0x0f96('0x25')](_0xd73b2c['query']);_0x5eaf1[_0x0f96('0x26')]=_[_0x0f96('0x27')](_0x5eaf1[_0x0f96('0x23')],_0x5eaf1['query']);_0x319f5f[_0x0f96('0x28')]=_[_0x0f96('0x27')](_0x5eaf1[_0x0f96('0x23')],qs[_0x0f96('0x29')](_0xd73b2c[_0x0f96('0x24')]['fields']));_0x319f5f[_0x0f96('0x28')]=_0x319f5f[_0x0f96('0x28')]['length']?_0x319f5f[_0x0f96('0x28')]:_0x5eaf1[_0x0f96('0x23')];if(!_0xd73b2c[_0x0f96('0x24')][_0x0f96('0x2a')]('nolimit')){_0x319f5f[_0x0f96('0xb')]=qs[_0x0f96('0xb')](_0xd73b2c['query'][_0x0f96('0xb')]);_0x319f5f[_0x0f96('0xd')]=qs[_0x0f96('0xd')](_0xd73b2c[_0x0f96('0x24')][_0x0f96('0xd')]);}_0x319f5f[_0x0f96('0x2b')]=qs['sort'](_0xd73b2c[_0x0f96('0x24')]['sort']);_0x319f5f[_0x0f96('0x2c')]=qs['filters'](_[_0x0f96('0x2d')](_0xd73b2c[_0x0f96('0x24')],_0x5eaf1[_0x0f96('0x26')]),_0x3953c2);if(_0xd73b2c[_0x0f96('0x24')][_0x0f96('0x2e')]){_0x319f5f['where']=_[_0x0f96('0x2f')](_0x319f5f[_0x0f96('0x2c')],{'$or':_[_0x0f96('0x1e')](_0x3953c2,function(_0x45d13a){if(_0x45d13a[_0x0f96('0x30')]!=='VIRTUAL'){var _0x1a33d2={};_0x1a33d2[_0x45d13a[_0x0f96('0x1b')]]={'$like':'%'+_0xd73b2c['query'][_0x0f96('0x2e')]+'%'};return _0x1a33d2;}})});}_0x319f5f=_['merge']({},_0x319f5f,_0xd73b2c[_0x0f96('0x31')]);var _0x2a3db5={'where':_0x319f5f[_0x0f96('0x2c')]};return db[_0x0f96('0x1f')][_0x0f96('0xc')](_0x2a3db5)[_0x0f96('0x12')](function(_0x541c96){_0x3ba75b['count']=_0x541c96;if(_0xd73b2c[_0x0f96('0x24')][_0x0f96('0x32')]){_0x319f5f[_0x0f96('0x33')]=[{'all':!![]}];}return db['SquareProject'][_0x0f96('0x34')](_0x319f5f);})[_0x0f96('0x12')](function(_0x2bf1b0){_0x3ba75b[_0x0f96('0x35')]=_0x2bf1b0;return _0x3ba75b;})['then'](respondWithFilteredResult(_0xfc729b,_0x319f5f))[_0x0f96('0x36')](handleError(_0xfc729b,null));};exports[_0x0f96('0x37')]=function(_0x47e756,_0xb292a9){var _0x13d0e6={'raw':![],'where':{'id':_0x47e756[_0x0f96('0x38')]['id']}},_0x565838={};_0x565838[_0x0f96('0x23')]=_[_0x0f96('0x25')](db['SquareProject'][_0x0f96('0x20')]);_0x565838[_0x0f96('0x24')]=_[_0x0f96('0x25')](_0x47e756['query']);_0x565838[_0x0f96('0x26')]=_[_0x0f96('0x27')](_0x565838[_0x0f96('0x23')],_0x565838[_0x0f96('0x24')]);_0x13d0e6[_0x0f96('0x28')]=_[_0x0f96('0x27')](_0x565838[_0x0f96('0x23')],qs[_0x0f96('0x29')](_0x47e756['query'][_0x0f96('0x29')]));_0x13d0e6[_0x0f96('0x28')]=_0x13d0e6[_0x0f96('0x28')][_0x0f96('0x39')]?_0x13d0e6['attributes']:_0x565838['model'];if(_0x47e756[_0x0f96('0x24')][_0x0f96('0x32')]){_0x13d0e6[_0x0f96('0x33')]=[{'all':!![]}];}_0x13d0e6=_[_0x0f96('0x2f')]({},_0x13d0e6,_0x47e756[_0x0f96('0x31')]);return db['SquareProject']['find'](_0x13d0e6)['then'](handleEntityNotFound(_0xb292a9,null))[_0x0f96('0x12')](respondWithResult(_0xb292a9,null))[_0x0f96('0x36')](handleError(_0xb292a9,null));};exports[_0x0f96('0x3a')]=function(_0x17a647,_0x31c657){return db[_0x0f96('0x1f')]['create'](_0x17a647[_0x0f96('0x3b')],{})[_0x0f96('0x12')](function(_0x4b127d){var _0x516b78=_0x17a647[_0x0f96('0x3c')][_0x0f96('0x14')]({'plain':!![]});if(!_0x516b78)throw new Error(_0x0f96('0x3d'));if(_0x516b78[_0x0f96('0x3e')]===_0x0f96('0x3c')){var _0x2b762e=_0x4b127d[_0x0f96('0x14')]({'plain':!![]});var _0x473875=_0x0f96('0x15');return db[_0x0f96('0x3f')][_0x0f96('0x40')]({'where':{'name':_0x473875,'userProfileId':_0x516b78[_0x0f96('0x41')]},'raw':!![]})[_0x0f96('0x12')](function(_0x5a04a1){if(_0x5a04a1&&_0x5a04a1[_0x0f96('0x42')]===0x0){return db['UserProfileResource'][_0x0f96('0x3a')]({'name':_0x2b762e[_0x0f96('0x1b')],'resourceId':_0x2b762e['id'],'type':_0x5a04a1[_0x0f96('0x1b')],'sectionId':_0x5a04a1['id']},{})[_0x0f96('0x12')](function(){return _0x4b127d;});}else{return _0x4b127d;}})['catch'](function(_0x28032e){logger[_0x0f96('0x19')](_0x0f96('0x43'),_0x28032e);throw _0x28032e;});}return _0x4b127d;})['then'](respondWithResult(_0x31c657,0xc9))[_0x0f96('0x36')](handleError(_0x31c657,null));};exports[_0x0f96('0x11')]=function(_0x6fa584,_0x54257f){if(_0x6fa584[_0x0f96('0x3b')]['id']){delete _0x6fa584[_0x0f96('0x3b')]['id'];}return db[_0x0f96('0x1f')][_0x0f96('0x40')]({'where':{'id':_0x6fa584[_0x0f96('0x38')]['id']}})['then'](handleEntityNotFound(_0x54257f,null))[_0x0f96('0x12')](saveUpdates(_0x6fa584[_0x0f96('0x3b')],null))['then'](function(_0x5e1a6e){if(!_0x5e1a6e)return;var _0x1062a9=_0x5e1a6e['get']({'plain':!![]});return _0x1062a9;})[_0x0f96('0x12')](function(_0x3bd9a0){var _0x3ecff1=new Redis(config[_0x0f96('0x6')]);_0x3ecff1[_0x0f96('0x16')](_0x0f96('0x17'),JSON[_0x0f96('0x44')](_[_0x0f96('0x2d')](_0x3bd9a0,['id',_0x0f96('0x1b'),_0x0f96('0x45')])));return _0x3bd9a0;})[_0x0f96('0x12')](respondWithResult(_0x54257f,null))[_0x0f96('0x36')](handleError(_0x54257f,null));};exports[_0x0f96('0x13')]=function(_0x5ba784,_0x15a06d){return db[_0x0f96('0x1f')]['find']({'where':{'id':_0x5ba784[_0x0f96('0x38')]['id']}})[_0x0f96('0x12')](handleEntityNotFound(_0x15a06d,null))[_0x0f96('0x12')](removeEntity(_0x15a06d,null))[_0x0f96('0x36')](handleError(_0x15a06d,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index e8e6094..9535c74 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 _0xf104=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save'];(function(_0x522fb0,_0x38b2ff){var _0xa92879=function(_0x438380){while(--_0x438380){_0x522fb0['push'](_0x522fb0['shift']());}};_0xa92879(++_0x38b2ff);}(_0xf104,0x1c9));var _0x4f10=function(_0x4d0cac,_0x5c93be){_0x4d0cac=_0x4d0cac-0x0;var _0x19dcf1=_0xf104[_0x4d0cac];return _0x19dcf1;};'use strict';var EventEmitter=require(_0x4f10('0x0'));var SquareProject=require(_0x4f10('0x1'))['db'][_0x4f10('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x4f10('0x3')](0x0);var events={'afterCreate':_0x4f10('0x4'),'afterUpdate':_0x4f10('0x5'),'afterDestroy':_0x4f10('0x6')};function emitEvent(_0x5c861c){return function(_0x4a1cb7,_0x53254b,_0x2b758c){SquareProjectEvents['emit'](_0x5c861c+':'+_0x4a1cb7['id'],_0x4a1cb7);SquareProjectEvents[_0x4f10('0x7')](_0x5c861c,_0x4a1cb7);_0x2b758c(null);};}for(var e in events){if(events[_0x4f10('0x8')](e)){var event=events[e];SquareProject[_0x4f10('0x9')](e,emitEvent(event));}}module[_0x4f10('0xa')]=SquareProjectEvents; \ No newline at end of file +var _0xe933=['SquareProject','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xb99421,_0xaab133){var _0x4b3ec7=function(_0x591d1a){while(--_0x591d1a){_0xb99421['push'](_0xb99421['shift']());}};_0x4b3ec7(++_0xaab133);}(_0xe933,0xc4));var _0x3e93=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xe933[_0x1deb03];return _0x189fe7;};'use strict';var EventEmitter=require(_0x3e93('0x0'));var SquareProject=require(_0x3e93('0x1'))['db'][_0x3e93('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3e93('0x3'),'afterUpdate':'update','afterDestroy':_0x3e93('0x4')};function emitEvent(_0x4a3121){return function(_0x4952a6,_0x1b2d52,_0x4b85df){SquareProjectEvents[_0x3e93('0x5')](_0x4a3121+':'+_0x4952a6['id'],_0x4952a6);SquareProjectEvents[_0x3e93('0x5')](_0x4a3121,_0x4952a6);_0x4b85df(null);};}for(var e in events){if(events[_0x3e93('0x6')](e)){var event=events[e];SquareProject[_0x3e93('0x7')](e,emitEvent(event));}}module[_0x3e93('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 c9be2fb..f03a9c7 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 _0xd264=['production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','savedAt','format'];(function(_0x3fb354,_0x523e06){var _0x17589d=function(_0x255cbb){while(--_0x255cbb){_0x3fb354['push'](_0x3fb354['shift']());}};_0x17589d(++_0x523e06);}(_0xd264,0x67));var _0x4d26=function(_0x5d8f44,_0x460e14){_0x5d8f44=_0x5d8f44-0x0;var _0x3790a2=_0xd264[_0x5d8f44];return _0x3790a2;};'use strict';var _=require(_0x4d26('0x0'));var util=require(_0x4d26('0x1'));var logger=require(_0x4d26('0x2'))(_0x4d26('0x3'));var moment=require('moment');var BPromise=require(_0x4d26('0x4'));var rp=require(_0x4d26('0x5'));var fs=require('fs');var path=require(_0x4d26('0x6'));var rimraf=require(_0x4d26('0x7'));var config=require(_0x4d26('0x8'));var attributes=require(_0x4d26('0x9'));module[_0x4d26('0xa')]=function(_0x590a80,_0x1ef873){return _0x590a80[_0x4d26('0xb')](_0x4d26('0xc'),attributes,{'tableName':_0x4d26('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x13e121,_0x188276,_0xe05124){if(_0x13e121[_0x4d26('0xe')]('preproduction')){_0x13e121[_0x4d26('0xf')]=moment()[_0x4d26('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x13e121[_0x4d26('0xe')](_0x4d26('0x11'))){_0x13e121[_0x4d26('0x12')]=moment()[_0x4d26('0x10')](_0x4d26('0x13'));}_0xe05124(null,_0x13e121);}}});}; \ No newline at end of file +var _0xeb3a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./squareProject.attributes','exports','SquareProject','square_projects','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt'];(function(_0x99bd01,_0x279ec8){var _0x228949=function(_0x3d6afe){while(--_0x3d6afe){_0x99bd01['push'](_0x99bd01['shift']());}};_0x228949(++_0x279ec8);}(_0xeb3a,0x77));var _0xaeb3=function(_0x25fd2,_0x26b9b7){_0x25fd2=_0x25fd2-0x0;var _0x239af1=_0xeb3a[_0x25fd2];return _0x239af1;};'use strict';var _=require(_0xaeb3('0x0'));var util=require(_0xaeb3('0x1'));var logger=require(_0xaeb3('0x2'))(_0xaeb3('0x3'));var moment=require(_0xaeb3('0x4'));var BPromise=require(_0xaeb3('0x5'));var rp=require(_0xaeb3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaeb3('0x7'));var config=require('../../config/environment');var attributes=require(_0xaeb3('0x8'));module[_0xaeb3('0x9')]=function(_0x3fef76,_0x93e78b){return _0x3fef76['define'](_0xaeb3('0xa'),attributes,{'tableName':_0xaeb3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e1f14,_0x89d3b3,_0x222766){if(_0x2e1f14['changed'](_0xaeb3('0xc'))){_0x2e1f14['savedAt']=moment()[_0xaeb3('0xd')](_0xaeb3('0xe'));}if(_0x2e1f14['changed'](_0xaeb3('0xf'))){_0x2e1f14[_0xaeb3('0x10')]=moment()[_0xaeb3('0xd')](_0xaeb3('0xe'));}_0x222766(null,_0x2e1f14);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index baf5f10..e7ea3e2 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 _0x9f84=['info','debug','stringify','catch','message','error','ShowSquareProject','SquareProject','find','raw','ioredis','../../config/logger','../../config/environment','redis','localhost','./squareProject.socket','register','GetSquareProjects','findAll','options','where','attributes','limit','include','map','model','then'];(function(_0x23832b,_0x6a777){var _0x583750=function(_0xe4425b){while(--_0xe4425b){_0x23832b['push'](_0x23832b['shift']());}};_0x583750(++_0x6a777);}(_0x9f84,0x118));var _0x49f8=function(_0x1005d4,_0x5199ab){_0x1005d4=_0x1005d4-0x0;var _0x421977=_0x9f84[_0x1005d4];return _0x421977;};'use strict';var _=require('lodash');var Redis=require(_0x49f8('0x0'));var db=require('../../mysqldb')['db'];var logger=require(_0x49f8('0x1'))('rpc');var config=require(_0x49f8('0x2'));config[_0x49f8('0x3')]=_['defaults'](config[_0x49f8('0x3')],{'host':_0x49f8('0x4'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x49f8('0x3')]));require(_0x49f8('0x5'))[_0x49f8('0x6')](socket);exports[_0x49f8('0x7')]=function(_0x3071ab){var _0x302f75=this;return new Promise(function(_0x808b59,_0x507311){return db['SquareProject'][_0x49f8('0x8')]({'raw':_0x3071ab[_0x49f8('0x9')]?_0x3071ab[_0x49f8('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x3071ab['options']?_0x3071ab[_0x49f8('0x9')][_0x49f8('0xa')]||null:null,'attributes':_0x3071ab[_0x49f8('0x9')]?_0x3071ab[_0x49f8('0x9')][_0x49f8('0xb')]||null:null,'limit':_0x3071ab['options']?_0x3071ab[_0x49f8('0x9')][_0x49f8('0xc')]||null:null,'include':_0x3071ab['options']?_0x3071ab[_0x49f8('0x9')][_0x49f8('0xd')]?_[_0x49f8('0xe')](_0x3071ab['options'][_0x49f8('0xd')],function(_0x4333e2){return{'model':db[_0x4333e2[_0x49f8('0xf')]],'as':_0x4333e2['as'],'attributes':_0x4333e2[_0x49f8('0xb')],'include':_0x4333e2[_0x49f8('0xd')]?_[_0x49f8('0xe')](_0x4333e2[_0x49f8('0xd')],function(_0x3739aa){return{'model':db[_0x3739aa[_0x49f8('0xf')]],'as':_0x3739aa['as'],'attributes':_0x3739aa['attributes'],'include':_0x3739aa[_0x49f8('0xd')]?_[_0x49f8('0xe')](_0x3739aa[_0x49f8('0xd')],function(_0x28a38f){return{'model':db[_0x28a38f[_0x49f8('0xf')]],'as':_0x28a38f['as'],'attributes':_0x28a38f[_0x49f8('0xb')]};}):[]};}):[]};}):[]:[]})[_0x49f8('0x10')](function(_0x40a779){logger[_0x49f8('0x11')]('GetSquareProjects',_0x3071ab);logger[_0x49f8('0x12')](_0x49f8('0x7'),_0x3071ab,JSON[_0x49f8('0x13')](_0x40a779));_0x808b59(_0x40a779);})[_0x49f8('0x14')](function(_0x243022){logger['error'](_0x49f8('0x7'),_0x243022[_0x49f8('0x15')],_0x3071ab);_0x507311(_0x302f75[_0x49f8('0x16')](0x1f4,_0x243022[_0x49f8('0x15')]));});});};exports[_0x49f8('0x17')]=function(_0x36cd8d){var _0x507323=this;return new Promise(function(_0x1222db,_0x10a922){return db[_0x49f8('0x18')][_0x49f8('0x19')]({'raw':_0x36cd8d[_0x49f8('0x9')]?_0x36cd8d[_0x49f8('0x9')][_0x49f8('0x1a')]===undefined?!![]:![]:!![],'where':_0x36cd8d[_0x49f8('0x9')]?_0x36cd8d[_0x49f8('0x9')]['where']||null:null,'attributes':_0x36cd8d[_0x49f8('0x9')]?_0x36cd8d[_0x49f8('0x9')][_0x49f8('0xb')]||null:null,'include':_0x36cd8d[_0x49f8('0x9')]?_0x36cd8d[_0x49f8('0x9')][_0x49f8('0xd')]?_[_0x49f8('0xe')](_0x36cd8d[_0x49f8('0x9')][_0x49f8('0xd')],function(_0x42fe0){return{'model':db[_0x42fe0['model']],'as':_0x42fe0['as'],'attributes':_0x42fe0['attributes'],'include':_0x42fe0[_0x49f8('0xd')]?_[_0x49f8('0xe')](_0x42fe0[_0x49f8('0xd')],function(_0xbaffe0){return{'model':db[_0xbaffe0[_0x49f8('0xf')]],'as':_0xbaffe0['as'],'attributes':_0xbaffe0[_0x49f8('0xb')],'include':_0xbaffe0['include']?_['map'](_0xbaffe0['include'],function(_0x7109d8){return{'model':db[_0x7109d8['model']],'as':_0x7109d8['as'],'attributes':_0x7109d8[_0x49f8('0xb')]};}):[]};}):[]};}):[]:[]})[_0x49f8('0x10')](function(_0xdd7bd6){logger[_0x49f8('0x11')](_0x49f8('0x17'),_0x36cd8d);logger['debug'](_0x49f8('0x17'),_0x36cd8d,JSON['stringify'](_0xdd7bd6));_0x1222db(_0xdd7bd6);})['catch'](function(_0x317547){logger[_0x49f8('0x16')]('ShowSquareProject',_0x317547[_0x49f8('0x15')],_0x36cd8d);_0x10a922(_0x507323[_0x49f8('0x16')](0x1f4,_0x317547[_0x49f8('0x15')]));});});}; \ No newline at end of file +var _0xe256=['where','attributes','limit','include','model','map','then','info','debug','stringify','catch','error','message','ShowSquareProject','find','lodash','ioredis','rpc','redis','defaults','localhost','./squareProject.socket','GetSquareProjects','SquareProject','findAll','raw','options'];(function(_0x57333f,_0x48685d){var _0x25e4d2=function(_0x39d525){while(--_0x39d525){_0x57333f['push'](_0x57333f['shift']());}};_0x25e4d2(++_0x48685d);}(_0xe256,0x96));var _0x6e25=function(_0x290129,_0x3bb647){_0x290129=_0x290129-0x0;var _0x1e7e52=_0xe256[_0x290129];return _0x1e7e52;};'use strict';var _=require(_0x6e25('0x0'));var Redis=require(_0x6e25('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x6e25('0x2'));var config=require('../../config/environment');config[_0x6e25('0x3')]=_[_0x6e25('0x4')](config[_0x6e25('0x3')],{'host':_0x6e25('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6e25('0x6'))['register'](socket);exports[_0x6e25('0x7')]=function(_0x66b2dd){var _0x551739=this;return new Promise(function(_0x3d1d99,_0x22a157){return db[_0x6e25('0x8')][_0x6e25('0x9')]({'raw':_0x66b2dd['options']?_0x66b2dd['options'][_0x6e25('0xa')]===undefined?!![]:![]:!![],'where':_0x66b2dd['options']?_0x66b2dd[_0x6e25('0xb')][_0x6e25('0xc')]||null:null,'attributes':_0x66b2dd[_0x6e25('0xb')]?_0x66b2dd[_0x6e25('0xb')][_0x6e25('0xd')]||null:null,'limit':_0x66b2dd['options']?_0x66b2dd[_0x6e25('0xb')][_0x6e25('0xe')]||null:null,'include':_0x66b2dd['options']?_0x66b2dd[_0x6e25('0xb')]['include']?_['map'](_0x66b2dd[_0x6e25('0xb')][_0x6e25('0xf')],function(_0x5f2951){return{'model':db[_0x5f2951[_0x6e25('0x10')]],'as':_0x5f2951['as'],'attributes':_0x5f2951['attributes'],'include':_0x5f2951['include']?_[_0x6e25('0x11')](_0x5f2951[_0x6e25('0xf')],function(_0x4ec379){return{'model':db[_0x4ec379[_0x6e25('0x10')]],'as':_0x4ec379['as'],'attributes':_0x4ec379[_0x6e25('0xd')],'include':_0x4ec379[_0x6e25('0xf')]?_[_0x6e25('0x11')](_0x4ec379[_0x6e25('0xf')],function(_0x4fac77){return{'model':db[_0x4fac77[_0x6e25('0x10')]],'as':_0x4fac77['as'],'attributes':_0x4fac77[_0x6e25('0xd')]};}):[]};}):[]};}):[]:[]})[_0x6e25('0x12')](function(_0x939245){logger[_0x6e25('0x13')](_0x6e25('0x7'),_0x66b2dd);logger[_0x6e25('0x14')]('GetSquareProjects',_0x66b2dd,JSON[_0x6e25('0x15')](_0x939245));_0x3d1d99(_0x939245);})[_0x6e25('0x16')](function(_0x52c6c7){logger[_0x6e25('0x17')](_0x6e25('0x7'),_0x52c6c7[_0x6e25('0x18')],_0x66b2dd);_0x22a157(_0x551739[_0x6e25('0x17')](0x1f4,_0x52c6c7[_0x6e25('0x18')]));});});};exports[_0x6e25('0x19')]=function(_0x2a60c1){var _0x6780bc=this;return new Promise(function(_0x8f568f,_0xd2f141){return db['SquareProject'][_0x6e25('0x1a')]({'raw':_0x2a60c1['options']?_0x2a60c1[_0x6e25('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x2a60c1['options']?_0x2a60c1[_0x6e25('0xb')]['where']||null:null,'attributes':_0x2a60c1[_0x6e25('0xb')]?_0x2a60c1[_0x6e25('0xb')][_0x6e25('0xd')]||null:null,'include':_0x2a60c1[_0x6e25('0xb')]?_0x2a60c1[_0x6e25('0xb')][_0x6e25('0xf')]?_['map'](_0x2a60c1[_0x6e25('0xb')][_0x6e25('0xf')],function(_0x2424be){return{'model':db[_0x2424be[_0x6e25('0x10')]],'as':_0x2424be['as'],'attributes':_0x2424be[_0x6e25('0xd')],'include':_0x2424be['include']?_[_0x6e25('0x11')](_0x2424be[_0x6e25('0xf')],function(_0x231123){return{'model':db[_0x231123[_0x6e25('0x10')]],'as':_0x231123['as'],'attributes':_0x231123[_0x6e25('0xd')],'include':_0x231123[_0x6e25('0xf')]?_[_0x6e25('0x11')](_0x231123[_0x6e25('0xf')],function(_0x285fcf){return{'model':db[_0x285fcf[_0x6e25('0x10')]],'as':_0x285fcf['as'],'attributes':_0x285fcf['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e25('0x12')](function(_0x4f4a30){logger[_0x6e25('0x13')](_0x6e25('0x19'),_0x2a60c1);logger[_0x6e25('0x14')]('ShowSquareProject',_0x2a60c1,JSON[_0x6e25('0x15')](_0x4f4a30));_0x8f568f(_0x4f4a30);})[_0x6e25('0x16')](function(_0x4f01f7){logger['error']('ShowSquareProject',_0x4f01f7['message'],_0x2a60c1);_0xd2f141(_0x6780bc[_0x6e25('0x17')](0x1f4,_0x4f01f7[_0x6e25('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 8ec5340..7834d7c 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 _0xa048=['save','remove','emit','removeListener','register','squareProject:','./squareProject.events'];(function(_0x5c2c87,_0x37721c){var _0x34ee83=function(_0x36c1a7){while(--_0x36c1a7){_0x5c2c87['push'](_0x5c2c87['shift']());}};_0x34ee83(++_0x37721c);}(_0xa048,0xfb));var _0x8a04=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa048[_0x122ef9];return _0x42fba0;};'use strict';var SquareProjectEvents=require(_0x8a04('0x0'));var events=[_0x8a04('0x1'),_0x8a04('0x2'),'update'];function createListener(_0x22b602,_0x335ac8){return function(_0x47b4f4){_0x335ac8[_0x8a04('0x3')](_0x22b602,_0x47b4f4);};}function removeListener(_0xd12ce0,_0x390bc2){return function(){SquareProjectEvents[_0x8a04('0x4')](_0xd12ce0,_0x390bc2);};}exports[_0x8a04('0x5')]=function(_0x11f306){for(var _0x3c7552=0x0,_0x3f1a95=events['length'];_0x3c7552<_0x3f1a95;_0x3c7552++){var _0x286d51=events[_0x3c7552];var _0x3ac73e=createListener(_0x8a04('0x6')+_0x286d51,_0x11f306);SquareProjectEvents['on'](_0x286d51,_0x3ac73e);}}; \ No newline at end of file +var _0xde6c=['remove','removeListener','register','length','squareProject:','./squareProject.events'];(function(_0x31b4aa,_0x9a6429){var _0x1bb3dd=function(_0x310869){while(--_0x310869){_0x31b4aa['push'](_0x31b4aa['shift']());}};_0x1bb3dd(++_0x9a6429);}(_0xde6c,0x1eb));var _0xcde6=function(_0x3bea4,_0x56a1a5){_0x3bea4=_0x3bea4-0x0;var _0xf8e956=_0xde6c[_0x3bea4];return _0xf8e956;};'use strict';var SquareProjectEvents=require(_0xcde6('0x0'));var events=['save',_0xcde6('0x1'),'update'];function createListener(_0x9f9c29,_0x164a15){return function(_0x400136){_0x164a15['emit'](_0x9f9c29,_0x400136);};}function removeListener(_0x656b17,_0x2b2d5c){return function(){SquareProjectEvents[_0xcde6('0x2')](_0x656b17,_0x2b2d5c);};}exports[_0xcde6('0x3')]=function(_0x1faeab){for(var _0x1a499b=0x0,_0x59f268=events[_0xcde6('0x4')];_0x1a499b<_0x59f268;_0x1a499b++){var _0x1807f=events[_0x1a499b];var _0x3c7f3b=createListener(_0xcde6('0x5')+_0x1807f,_0x1faeab);SquareProjectEvents['on'](_0x1807f,_0x3c7f3b);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 85319a6..e0426bb 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 _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0x16d589,_0x3acf51){var _0x37560d=function(_0x372f05){while(--_0x372f05){_0x16d589['push'](_0x16d589['shift']());}};_0x37560d(++_0x3acf51);}(_0x53ec,0x192));var _0xc53e=function(_0x57d5c1,_0x55a5ef){_0x57d5c1=_0x57d5c1-0x0;var _0x4347c1=_0x53ec[_0x57d5c1];return _0x4347c1;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file +var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x588e63,_0x1081db){var _0x5b9b23=function(_0x5ac9d3){while(--_0x5ac9d3){_0x588e63['push'](_0x588e63['shift']());}};_0x5b9b23(++_0x1081db);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc4aa[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 0edeafa..56fd927 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 _0xdbf5=['lastIndexOf','exports','STRING','VIRTUAL','savePath'];(function(_0x14d350,_0x521500){var _0x2086dd=function(_0x1e2ebe){while(--_0x1e2ebe){_0x14d350['push'](_0x14d350['shift']());}};_0x2086dd(++_0x521500);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x4f84b2,_0xf946b){_0x4f84b2=_0x4f84b2-0x0;var _0x1c869c=_0xdbf5[_0x4f84b2];return _0x1c869c;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5dbf('0x1')]},'context':{'type':Sequelize[_0x5dbf('0x1')]},'extension':{'type':Sequelize[_0x5dbf('0x1')]},'priority':{'type':Sequelize[_0x5dbf('0x1')]},'accountcode':{'type':Sequelize[_0x5dbf('0x1')]},'dnid':{'type':Sequelize[_0x5dbf('0x1')]},'projectName':{'type':Sequelize[_0x5dbf('0x1')]},'saveName':{'type':Sequelize[_0x5dbf('0x1')]},'filename':{'type':Sequelize[_0x5dbf('0x1')]},'savePath':{'type':Sequelize[_0x5dbf('0x1')]},'format':{'type':Sequelize[_0x5dbf('0x2')],'get':function(){var _0x88128e='';var _0x93e657=this['getDataValue'](_0x5dbf('0x3'));if(_0x93e657){_0x88128e=_0x93e657['substring'](_0x93e657[_0x5dbf('0x4')]('.'));}return _0x88128e;}}}; \ No newline at end of file +var _0xb4c7=['sequelize','exports','STRING','VIRTUAL','getDataValue','substring','lastIndexOf'];(function(_0x364d80,_0x189614){var _0x463988=function(_0x14911d){while(--_0x14911d){_0x364d80['push'](_0x364d80['shift']());}};_0x463988(++_0x189614);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x1ecde7,_0x3b8440){_0x1ecde7=_0x1ecde7-0x0;var _0xd38f8e=_0xb4c7[_0x1ecde7];return _0xd38f8e;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'uniqueid':{'type':Sequelize[_0x7b4c('0x2')]},'callerid':{'type':Sequelize[_0x7b4c('0x2')]},'calleridname':{'type':Sequelize[_0x7b4c('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x7b4c('0x2')]},'priority':{'type':Sequelize[_0x7b4c('0x2')]},'accountcode':{'type':Sequelize[_0x7b4c('0x2')]},'dnid':{'type':Sequelize[_0x7b4c('0x2')]},'projectName':{'type':Sequelize[_0x7b4c('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x7b4c('0x2')]},'savePath':{'type':Sequelize[_0x7b4c('0x2')]},'format':{'type':Sequelize[_0x7b4c('0x3')],'get':function(){var _0x4bf85d='';var _0x2d7b7e=this[_0x7b4c('0x4')]('savePath');if(_0x2d7b7e){_0x4bf85d=_0x2d7b7e[_0x7b4c('0x5')](_0x2d7b7e[_0x7b4c('0x6')]('.'));}return _0x4bf85d;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index da7961f..8bb11cc 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 _0x77ff=['info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','save','update','then','error','stack','name','send','index','map','SquareRecording','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','../../components/encryptor','uniqueid','savePath','format','%s.cypher','decryptFile','secrets','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s'];(function(_0x318869,_0x210798){var _0x19cb56=function(_0x5c0322){while(--_0x5c0322){_0x318869['push'](_0x318869['shift']());}};_0x19cb56(++_0x210798);}(_0x77ff,0x65));var _0xf77f=function(_0x14f977,_0x53eb0d){_0x14f977=_0x14f977-0x0;var _0x3b470d=_0x77ff[_0x14f977];return _0x3b470d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf77f('0x0'));var zipdir=require(_0xf77f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf77f('0x2'));var moment=require('moment');var BPromise=require(_0xf77f('0x3'));var Mustache=require(_0xf77f('0x4'));var util=require(_0xf77f('0x5'));var path=require(_0xf77f('0x6'));var sox=require(_0xf77f('0x7'));var csv=require(_0xf77f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf77f('0x9'));var _=require(_0xf77f('0xa'));var squel=require(_0xf77f('0xb'));var crypto=require(_0xf77f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf77f('0xd'));var toCsv=require(_0xf77f('0x8'));var querystring=require(_0xf77f('0xe'));var Papa=require('papaparse');var Redis=require(_0xf77f('0xf'));var authService=require(_0xf77f('0x10'));var qs=require(_0xf77f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf77f('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xf77f('0x13'));var config=require(_0xf77f('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20d7a5,_0x2df96a){_0x2df96a=_0x2df96a||0xcc;return function(_0x844363){if(_0x844363){return _0x20d7a5[_0xf77f('0x15')](_0x2df96a);}return _0x20d7a5[_0xf77f('0x16')](_0x2df96a)[_0xf77f('0x17')]();};}function respondWithResult(_0x227276,_0x1ecdda){_0x1ecdda=_0x1ecdda||0xc8;return function(_0x40944f){if(_0x40944f){return _0x227276[_0xf77f('0x16')](_0x1ecdda)['json'](_0x40944f);}};}function respondWithFilteredResult(_0x518ca3,_0x45d0e7){return function(_0x40b486){if(_0x40b486){var _0x24a7f9=typeof _0x45d0e7[_0xf77f('0x18')]===_0xf77f('0x19')&&typeof _0x45d0e7['limit']==='undefined';var _0x1b5230=_0x40b486[_0xf77f('0x1a')];var _0x168845=_0x24a7f9?0x0:_0x45d0e7[_0xf77f('0x18')];var _0x463c2d=_0x24a7f9?_0x40b486['count']:_0x45d0e7[_0xf77f('0x18')]+_0x45d0e7[_0xf77f('0x1b')];var _0x4518b0;if(_0x463c2d>=_0x1b5230){_0x463c2d=_0x1b5230;_0x4518b0=0xc8;}else{_0x4518b0=0xce;}_0x518ca3[_0xf77f('0x16')](_0x4518b0);return _0x518ca3['set'](_0xf77f('0x1c'),_0x168845+'-'+_0x463c2d+'/'+_0x1b5230)['json'](_0x40b486);}return null;};}function patchUpdates(_0x47d7f0){return function(_0x62a80e){try{jsonpatch[_0xf77f('0x1d')](_0x62a80e,_0x47d7f0,!![]);}catch(_0x29858d){return BPromise['reject'](_0x29858d);}return _0x62a80e[_0xf77f('0x1e')]();};}function saveUpdates(_0xe44477,_0x4c00c2){return function(_0x54fc4a){if(_0x54fc4a){return _0x54fc4a[_0xf77f('0x1f')](_0xe44477)[_0xf77f('0x20')](function(_0x24019f){return _0x24019f;});}return null;};}function removeEntity(_0x5b169b,_0x40eb87){return function(_0x2e86ad){if(_0x2e86ad){return _0x2e86ad['destroy']()[_0xf77f('0x20')](function(){_0x5b169b[_0xf77f('0x16')](0xcc)[_0xf77f('0x17')]();});}};}function handleEntityNotFound(_0x1ae82b,_0x36d4de){return function(_0x2fd4ae){if(!_0x2fd4ae){_0x1ae82b[_0xf77f('0x15')](0x194);}return _0x2fd4ae;};}function handleError(_0x3c7c31,_0x4b8b0d){_0x4b8b0d=_0x4b8b0d||0x1f4;return function(_0x24537f){logger[_0xf77f('0x21')](_0x24537f[_0xf77f('0x22')]);if(_0x24537f[_0xf77f('0x23')]){delete _0x24537f[_0xf77f('0x23')];}_0x3c7c31[_0xf77f('0x16')](_0x4b8b0d)[_0xf77f('0x24')](_0x24537f);};}exports[_0xf77f('0x25')]=function(_0x2faa8f,_0x1a4694){var _0x128767={},_0x269fd8={},_0x3fa651={'count':0x0,'rows':[]};var _0x3f47a3=_[_0xf77f('0x26')](db[_0xf77f('0x27')][_0xf77f('0x28')],function(_0x3622a0){return{'name':_0x3622a0['fieldName'],'type':_0x3622a0[_0xf77f('0x29')][_0xf77f('0x2a')]};});_0x269fd8['model']=_['map'](_0x3f47a3,_0xf77f('0x23'));_0x269fd8[_0xf77f('0x2b')]=_[_0xf77f('0x2c')](_0x2faa8f[_0xf77f('0x2b')]);_0x269fd8[_0xf77f('0x2d')]=_[_0xf77f('0x2e')](_0x269fd8['model'],_0x269fd8[_0xf77f('0x2b')]);_0x128767[_0xf77f('0x2f')]=_[_0xf77f('0x2e')](_0x269fd8[_0xf77f('0x30')],qs[_0xf77f('0x31')](_0x2faa8f['query'][_0xf77f('0x31')]));_0x128767[_0xf77f('0x2f')]=_0x128767[_0xf77f('0x2f')]['length']?_0x128767[_0xf77f('0x2f')]:_0x269fd8['model'];if(!_0x2faa8f[_0xf77f('0x2b')][_0xf77f('0x32')](_0xf77f('0x33'))){_0x128767[_0xf77f('0x1b')]=qs[_0xf77f('0x1b')](_0x2faa8f[_0xf77f('0x2b')][_0xf77f('0x1b')]);_0x128767[_0xf77f('0x18')]=qs['offset'](_0x2faa8f[_0xf77f('0x2b')][_0xf77f('0x18')]);}_0x128767[_0xf77f('0x34')]=qs[_0xf77f('0x35')](_0x2faa8f['query'][_0xf77f('0x35')]);_0x128767[_0xf77f('0x36')]=qs[_0xf77f('0x2d')](_[_0xf77f('0x37')](_0x2faa8f[_0xf77f('0x2b')],_0x269fd8[_0xf77f('0x2d')]),_0x3f47a3);if(_0x2faa8f[_0xf77f('0x2b')]['filter']){_0x128767[_0xf77f('0x36')]=_[_0xf77f('0x38')](_0x128767[_0xf77f('0x36')],{'$or':_['map'](_0x3f47a3,function(_0x50f5de){if(_0x50f5de[_0xf77f('0x29')]!=='VIRTUAL'){var _0x452ec6={};_0x452ec6[_0x50f5de[_0xf77f('0x23')]]={'$like':'%'+_0x2faa8f[_0xf77f('0x2b')][_0xf77f('0x39')]+'%'};return _0x452ec6;}})});}_0x128767=_[_0xf77f('0x38')]({},_0x128767,_0x2faa8f[_0xf77f('0x3a')]);var _0xea51a5={'where':_0x128767[_0xf77f('0x36')]};return db[_0xf77f('0x27')][_0xf77f('0x1a')](_0xea51a5)[_0xf77f('0x20')](function(_0x578251){_0x3fa651[_0xf77f('0x1a')]=_0x578251;if(_0x2faa8f[_0xf77f('0x2b')][_0xf77f('0x3b')]){_0x128767['include']=[{'all':!![]}];}return db[_0xf77f('0x27')][_0xf77f('0x3c')](_0x128767);})[_0xf77f('0x20')](function(_0x5a0ad5){_0x3fa651[_0xf77f('0x3d')]=_0x5a0ad5;return _0x3fa651;})['then'](respondWithFilteredResult(_0x1a4694,_0x128767))[_0xf77f('0x3e')](handleError(_0x1a4694,null));};exports[_0xf77f('0x3f')]=function(_0x195ee6,_0x2f5e36){var _0x5d794e={'raw':!![],'where':{'id':_0x195ee6[_0xf77f('0x40')]['id']}},_0x5464ac={};_0x5464ac['model']=_[_0xf77f('0x2c')](db['SquareRecording']['rawAttributes']);_0x5464ac['query']=_[_0xf77f('0x2c')](_0x195ee6[_0xf77f('0x2b')]);_0x5464ac[_0xf77f('0x2d')]=_['intersection'](_0x5464ac['model'],_0x5464ac[_0xf77f('0x2b')]);_0x5d794e['attributes']=_[_0xf77f('0x2e')](_0x5464ac['model'],qs['fields'](_0x195ee6[_0xf77f('0x2b')][_0xf77f('0x31')]));_0x5d794e[_0xf77f('0x2f')]=_0x5d794e['attributes'][_0xf77f('0x41')]?_0x5d794e[_0xf77f('0x2f')]:_0x5464ac[_0xf77f('0x30')];if(_0x195ee6[_0xf77f('0x2b')]['includeAll']){_0x5d794e[_0xf77f('0x42')]=[{'all':!![]}];}_0x5d794e=_[_0xf77f('0x38')]({},_0x5d794e,_0x195ee6[_0xf77f('0x3a')]);return db[_0xf77f('0x27')][_0xf77f('0x43')](_0x5d794e)[_0xf77f('0x20')](handleEntityNotFound(_0x2f5e36,null))[_0xf77f('0x20')](respondWithResult(_0x2f5e36,null))[_0xf77f('0x3e')](handleError(_0x2f5e36,null));};exports['create']=function(_0x5a55ed,_0xf747d6){return db[_0xf77f('0x27')][_0xf77f('0x44')](_0x5a55ed[_0xf77f('0x45')],{})[_0xf77f('0x20')](respondWithResult(_0xf747d6,0xc9))[_0xf77f('0x3e')](handleError(_0xf747d6,null));};exports[_0xf77f('0x1f')]=function(_0x461809,_0x2e0ab7){if(_0x461809['body']['id']){delete _0x461809[_0xf77f('0x45')]['id'];}return db[_0xf77f('0x27')][_0xf77f('0x43')]({'where':{'id':_0x461809['params']['id']}})['then'](handleEntityNotFound(_0x2e0ab7,null))[_0xf77f('0x20')](saveUpdates(_0x461809[_0xf77f('0x45')],null))[_0xf77f('0x20')](respondWithResult(_0x2e0ab7,null))[_0xf77f('0x3e')](handleError(_0x2e0ab7,null));};exports['download']=function(_0x565d7d,_0xf37636,_0x9c7c26){var _0x4debf5=require(_0xf77f('0x46'));var _0x225bc9=![];var _0x28535c={};if(_0x565d7d[_0xf77f('0x2b')][_0xf77f('0x29')]&&_0x565d7d[_0xf77f('0x2b')][_0xf77f('0x29')]==='uniqueid'){_0x28535c[_0xf77f('0x47')]=_0x565d7d['params']['id'];}else{_0x28535c['id']=_0x565d7d[_0xf77f('0x40')]['id'];}return db[_0xf77f('0x27')][_0xf77f('0x43')]({'where':_0x28535c,'attributes':['id',_0xf77f('0x48'),'filename'],'raw':!![]})[_0xf77f('0x20')](handleEntityNotFound(_0xf37636,null))[_0xf77f('0x20')](function(_0xf726de){if(_0xf726de){var _0x2b9d76=_0xf726de[_0xf77f('0x48')];var _0x12ac81=util[_0xf77f('0x49')](_0xf77f('0x4a'),_0x2b9d76);if(fs['existsSync'](_0x12ac81)){_0x225bc9=!![];return _0x4debf5[_0xf77f('0x4b')](_0x12ac81,_0x2b9d76,config[_0xf77f('0x4c')]['recording'])[_0xf77f('0x20')](function(){return _0xf726de;});}return _0xf726de;}})['then'](function(_0x3ead45){if(_0x3ead45){var _0x2371df=_0x3ead45[_0xf77f('0x48')];if(!fs[_0xf77f('0x4d')](_0x2371df)){throw new db[(_0xf77f('0x4e'))][(_0xf77f('0x4f'))](_0xf77f('0x50'));}if(_0x3ead45[_0xf77f('0x51')]){return _0xf37636[_0xf77f('0x52')](_0x2371df,_0x3ead45[_0xf77f('0x51')]+path[_0xf77f('0x53')](_0x2371df),function(){if(_0x225bc9){fs['unlink'](_0x2371df);}});}else{return _0xf37636[_0xf77f('0x52')](_0x2371df,function(_0x3a73a0){if(_0x225bc9){fs[_0xf77f('0x54')](_0x2371df);}});}}})[_0xf77f('0x3e')](function(_0x16e44c){if(_0x16e44c[_0xf77f('0x55')]===_0xf77f('0x50')){_0xf37636[_0xf77f('0x16')](0x194)[_0xf77f('0x24')](_0xf77f('0x56'));}else{return handleError(_0xf37636,null);}});};exports[_0xf77f('0x57')]=function(_0x6e6955,_0x545ce0){return db[_0xf77f('0x27')][_0xf77f('0x43')]({'where':{'id':_0x6e6955['params']['id']}})[_0xf77f('0x20')](function(_0x53e02e){if(_[_0xf77f('0x58')](_0x53e02e)){throw new ReferenceError(_0xf77f('0x59'));}return _0x53e02e;})[_0xf77f('0x20')](function(_0x54b9d6){var _0x3bed43=_0x54b9d6[_0xf77f('0x48')];logger['info'](_0xf77f('0x5a'),_0x3bed43);if(!_[_0xf77f('0x58')](_0x54b9d6[_0xf77f('0x48')])&&fs['existsSync'](_0x3bed43)){logger[_0xf77f('0x5b')](_0xf77f('0x5c')+_0x3bed43+_0xf77f('0x5d'));fs['unlinkSync'](_0x3bed43);}_0x3bed43=_0x3bed43+_0xf77f('0x5e');if(!_['isNil'](_0x54b9d6[_0xf77f('0x48')])&&fs[_0xf77f('0x4d')](_0x3bed43)){logger[_0xf77f('0x5b')](_0xf77f('0x5c')+_0x3bed43+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xf77f('0x5f')](_0x3bed43);}return _0x54b9d6;})[_0xf77f('0x20')](function(_0x5318b4){if(!_0x5318b4)throw new InternalError();return _0x5318b4[_0xf77f('0x57')]();})[_0xf77f('0x20')](function(){_0x545ce0[_0xf77f('0x16')](0xcc)[_0xf77f('0x17')]();})[_0xf77f('0x3e')](handleError(_0x545ce0,null));}; \ No newline at end of file +var _0x71bb=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','type','VIRTUAL','options','SquareRecording','includeAll','include','findAll','catch','show','params','keys','find','create','body','download','../../components/encryptor','uniqueid','filename','savePath','%s.cypher','decryptFile','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','message','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','isNil','unlinkSync','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment'];(function(_0x2c3458,_0x1f7efd){var _0x3f7e02=function(_0x261040){while(--_0x261040){_0x2c3458['push'](_0x2c3458['shift']());}};_0x3f7e02(++_0x1f7efd);}(_0x71bb,0x16f));var _0xb71b=function(_0x1f48c7,_0x3c01b1){_0x1f48c7=_0x1f48c7-0x0;var _0x659e6b=_0x71bb[_0x1f48c7];return _0x659e6b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb71b('0x0'));var zipdir=require(_0xb71b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb71b('0x2'));var moment=require(_0xb71b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb71b('0x4'));var util=require(_0xb71b('0x5'));var path=require(_0xb71b('0x6'));var sox=require(_0xb71b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb71b('0x8'));var _=require(_0xb71b('0x9'));var squel=require(_0xb71b('0xa'));var crypto=require('crypto');var jsforce=require(_0xb71b('0xb'));var deskjs=require(_0xb71b('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb71b('0xd'));var Papa=require(_0xb71b('0xe'));var Redis=require(_0xb71b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb71b('0x10'));var as=require(_0xb71b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb71b('0x12'));var utils=require(_0xb71b('0x13'));var config=require(_0xb71b('0x14'));var licenseUtil=require(_0xb71b('0x15'));var db=require(_0xb71b('0x16'))['db'];function respondWithStatusCode(_0x293c62,_0x83adac){_0x83adac=_0x83adac||0xcc;return function(_0x3ddbc5){if(_0x3ddbc5){return _0x293c62[_0xb71b('0x17')](_0x83adac);}return _0x293c62[_0xb71b('0x18')](_0x83adac)[_0xb71b('0x19')]();};}function respondWithResult(_0x3fa368,_0x2e78f3){_0x2e78f3=_0x2e78f3||0xc8;return function(_0x2548af){if(_0x2548af){return _0x3fa368['status'](_0x2e78f3)[_0xb71b('0x1a')](_0x2548af);}};}function respondWithFilteredResult(_0x1a06b1,_0x11b704){return function(_0x5c0c0f){if(_0x5c0c0f){var _0xf4c385=typeof _0x11b704['offset']===_0xb71b('0x1b')&&typeof _0x11b704['limit']==='undefined';var _0xc9187a=_0x5c0c0f[_0xb71b('0x1c')];var _0x337da7=_0xf4c385?0x0:_0x11b704[_0xb71b('0x1d')];var _0x13c149=_0xf4c385?_0x5c0c0f[_0xb71b('0x1c')]:_0x11b704[_0xb71b('0x1d')]+_0x11b704[_0xb71b('0x1e')];var _0x184969;if(_0x13c149>=_0xc9187a){_0x13c149=_0xc9187a;_0x184969=0xc8;}else{_0x184969=0xce;}_0x1a06b1[_0xb71b('0x18')](_0x184969);return _0x1a06b1[_0xb71b('0x1f')](_0xb71b('0x20'),_0x337da7+'-'+_0x13c149+'/'+_0xc9187a)['json'](_0x5c0c0f);}return null;};}function patchUpdates(_0x2026cd){return function(_0x11adf8){try{jsonpatch[_0xb71b('0x21')](_0x11adf8,_0x2026cd,!![]);}catch(_0x14c9ec){return BPromise[_0xb71b('0x22')](_0x14c9ec);}return _0x11adf8[_0xb71b('0x23')]();};}function saveUpdates(_0x4e1349,_0x2f9db2){return function(_0x575c63){if(_0x575c63){return _0x575c63[_0xb71b('0x24')](_0x4e1349)['then'](function(_0x3ff2ee){return _0x3ff2ee;});}return null;};}function removeEntity(_0x233528,_0x41f196){return function(_0x61fe1e){if(_0x61fe1e){return _0x61fe1e['destroy']()[_0xb71b('0x25')](function(){_0x233528[_0xb71b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17d5ff,_0x31b0e9){return function(_0x3bd5f0){if(!_0x3bd5f0){_0x17d5ff[_0xb71b('0x17')](0x194);}return _0x3bd5f0;};}function handleError(_0x1def7e,_0x126167){_0x126167=_0x126167||0x1f4;return function(_0x54e587){logger['error'](_0x54e587[_0xb71b('0x26')]);if(_0x54e587[_0xb71b('0x27')]){delete _0x54e587['name'];}_0x1def7e[_0xb71b('0x18')](_0x126167)[_0xb71b('0x28')](_0x54e587);};}exports[_0xb71b('0x29')]=function(_0x1778ac,_0x37793f){var _0x1243a9={},_0x2f2253={},_0x286e7a={'count':0x0,'rows':[]};var _0xff1058=_[_0xb71b('0x2a')](db['SquareRecording'][_0xb71b('0x2b')],function(_0x54827a){return{'name':_0x54827a[_0xb71b('0x2c')],'type':_0x54827a['type'][_0xb71b('0x2d')]};});_0x2f2253[_0xb71b('0x2e')]=_[_0xb71b('0x2a')](_0xff1058,_0xb71b('0x27'));_0x2f2253[_0xb71b('0x2f')]=_['keys'](_0x1778ac[_0xb71b('0x2f')]);_0x2f2253[_0xb71b('0x30')]=_['intersection'](_0x2f2253[_0xb71b('0x2e')],_0x2f2253[_0xb71b('0x2f')]);_0x1243a9['attributes']=_[_0xb71b('0x31')](_0x2f2253[_0xb71b('0x2e')],qs['fields'](_0x1778ac[_0xb71b('0x2f')][_0xb71b('0x32')]));_0x1243a9[_0xb71b('0x33')]=_0x1243a9[_0xb71b('0x33')][_0xb71b('0x34')]?_0x1243a9[_0xb71b('0x33')]:_0x2f2253[_0xb71b('0x2e')];if(!_0x1778ac[_0xb71b('0x2f')][_0xb71b('0x35')]('nolimit')){_0x1243a9[_0xb71b('0x1e')]=qs[_0xb71b('0x1e')](_0x1778ac[_0xb71b('0x2f')][_0xb71b('0x1e')]);_0x1243a9['offset']=qs['offset'](_0x1778ac[_0xb71b('0x2f')]['offset']);}_0x1243a9['order']=qs['sort'](_0x1778ac['query'][_0xb71b('0x36')]);_0x1243a9['where']=qs[_0xb71b('0x30')](_[_0xb71b('0x37')](_0x1778ac[_0xb71b('0x2f')],_0x2f2253[_0xb71b('0x30')]),_0xff1058);if(_0x1778ac[_0xb71b('0x2f')][_0xb71b('0x38')]){_0x1243a9[_0xb71b('0x39')]=_[_0xb71b('0x3a')](_0x1243a9[_0xb71b('0x39')],{'$or':_['map'](_0xff1058,function(_0x243d53){if(_0x243d53[_0xb71b('0x3b')]!==_0xb71b('0x3c')){var _0x52312b={};_0x52312b[_0x243d53[_0xb71b('0x27')]]={'$like':'%'+_0x1778ac[_0xb71b('0x2f')][_0xb71b('0x38')]+'%'};return _0x52312b;}})});}_0x1243a9=_['merge']({},_0x1243a9,_0x1778ac[_0xb71b('0x3d')]);var _0x64d0c9={'where':_0x1243a9[_0xb71b('0x39')]};return db[_0xb71b('0x3e')][_0xb71b('0x1c')](_0x64d0c9)[_0xb71b('0x25')](function(_0x4de5df){_0x286e7a[_0xb71b('0x1c')]=_0x4de5df;if(_0x1778ac['query'][_0xb71b('0x3f')]){_0x1243a9[_0xb71b('0x40')]=[{'all':!![]}];}return db['SquareRecording'][_0xb71b('0x41')](_0x1243a9);})[_0xb71b('0x25')](function(_0xe9a419){_0x286e7a['rows']=_0xe9a419;return _0x286e7a;})[_0xb71b('0x25')](respondWithFilteredResult(_0x37793f,_0x1243a9))[_0xb71b('0x42')](handleError(_0x37793f,null));};exports[_0xb71b('0x43')]=function(_0x56cea5,_0x71fae7){var _0x46f050={'raw':!![],'where':{'id':_0x56cea5[_0xb71b('0x44')]['id']}},_0x19f3a8={};_0x19f3a8[_0xb71b('0x2e')]=_[_0xb71b('0x45')](db['SquareRecording'][_0xb71b('0x2b')]);_0x19f3a8['query']=_['keys'](_0x56cea5[_0xb71b('0x2f')]);_0x19f3a8[_0xb71b('0x30')]=_[_0xb71b('0x31')](_0x19f3a8['model'],_0x19f3a8[_0xb71b('0x2f')]);_0x46f050[_0xb71b('0x33')]=_['intersection'](_0x19f3a8['model'],qs['fields'](_0x56cea5['query'][_0xb71b('0x32')]));_0x46f050[_0xb71b('0x33')]=_0x46f050['attributes'][_0xb71b('0x34')]?_0x46f050[_0xb71b('0x33')]:_0x19f3a8['model'];if(_0x56cea5[_0xb71b('0x2f')][_0xb71b('0x3f')]){_0x46f050[_0xb71b('0x40')]=[{'all':!![]}];}_0x46f050=_[_0xb71b('0x3a')]({},_0x46f050,_0x56cea5[_0xb71b('0x3d')]);return db[_0xb71b('0x3e')][_0xb71b('0x46')](_0x46f050)[_0xb71b('0x25')](handleEntityNotFound(_0x71fae7,null))['then'](respondWithResult(_0x71fae7,null))[_0xb71b('0x42')](handleError(_0x71fae7,null));};exports[_0xb71b('0x47')]=function(_0x230e87,_0x34a8cc){return db['SquareRecording']['create'](_0x230e87[_0xb71b('0x48')],{})[_0xb71b('0x25')](respondWithResult(_0x34a8cc,0xc9))[_0xb71b('0x42')](handleError(_0x34a8cc,null));};exports['update']=function(_0x40cf0d,_0x3ffa7f){if(_0x40cf0d[_0xb71b('0x48')]['id']){delete _0x40cf0d[_0xb71b('0x48')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x40cf0d[_0xb71b('0x44')]['id']}})[_0xb71b('0x25')](handleEntityNotFound(_0x3ffa7f,null))[_0xb71b('0x25')](saveUpdates(_0x40cf0d['body'],null))[_0xb71b('0x25')](respondWithResult(_0x3ffa7f,null))[_0xb71b('0x42')](handleError(_0x3ffa7f,null));};exports[_0xb71b('0x49')]=function(_0x3c8fe1,_0x23e452,_0x5b0032){var _0x5dbcaa=require(_0xb71b('0x4a'));var _0x4cfe0e=![];var _0x1e5b4e={};if(_0x3c8fe1[_0xb71b('0x2f')][_0xb71b('0x3b')]&&_0x3c8fe1['query'][_0xb71b('0x3b')]==='uniqueid'){_0x1e5b4e[_0xb71b('0x4b')]=_0x3c8fe1[_0xb71b('0x44')]['id'];}else{_0x1e5b4e['id']=_0x3c8fe1[_0xb71b('0x44')]['id'];}return db[_0xb71b('0x3e')][_0xb71b('0x46')]({'where':_0x1e5b4e,'attributes':['id','savePath',_0xb71b('0x4c')],'raw':!![]})[_0xb71b('0x25')](handleEntityNotFound(_0x23e452,null))['then'](function(_0x57f0af){if(_0x57f0af){var _0x10653f=_0x57f0af[_0xb71b('0x4d')];var _0x528984=util['format'](_0xb71b('0x4e'),_0x10653f);if(fs['existsSync'](_0x528984)){_0x4cfe0e=!![];return _0x5dbcaa[_0xb71b('0x4f')](_0x528984,_0x10653f,config['secrets'][_0xb71b('0x50')])['then'](function(){return _0x57f0af;});}return _0x57f0af;}})[_0xb71b('0x25')](function(_0x395f77){if(_0x395f77){var _0x224094=_0x395f77[_0xb71b('0x4d')];if(!fs[_0xb71b('0x51')](_0x224094)){throw new db[(_0xb71b('0x52'))][(_0xb71b('0x53'))](_0xb71b('0x54'));}if(_0x395f77[_0xb71b('0x4c')]){return _0x23e452[_0xb71b('0x49')](_0x224094,_0x395f77[_0xb71b('0x4c')]+path[_0xb71b('0x55')](_0x224094),function(){if(_0x4cfe0e){fs['unlink'](_0x224094);}});}else{return _0x23e452[_0xb71b('0x49')](_0x224094,function(_0xee2baf){if(_0x4cfe0e){fs['unlink'](_0x224094);}});}}})[_0xb71b('0x42')](function(_0x42994a){if(_0x42994a[_0xb71b('0x56')]===_0xb71b('0x54')){_0x23e452[_0xb71b('0x18')](0x194)[_0xb71b('0x28')](_0xb71b('0x57'));}else{return handleError(_0x23e452,null);}});};exports[_0xb71b('0x58')]=function(_0x1727d9,_0x1d190f){return db[_0xb71b('0x3e')][_0xb71b('0x46')]({'where':{'id':_0x1727d9[_0xb71b('0x44')]['id']}})[_0xb71b('0x25')](function(_0x1000e6){if(_['isNil'](_0x1000e6)){throw new ReferenceError(_0xb71b('0x59'));}return _0x1000e6;})[_0xb71b('0x25')](function(_0x554693){var _0x32fc05=_0x554693[_0xb71b('0x4d')];logger[_0xb71b('0x5a')](_0xb71b('0x5b'),_0x32fc05);if(!_['isNil'](_0x554693['savePath'])&&fs[_0xb71b('0x51')](_0x32fc05)){logger[_0xb71b('0x5a')](_0xb71b('0x5c')+_0x32fc05+_0xb71b('0x5d'));fs['unlinkSync'](_0x32fc05);}_0x32fc05=_0x32fc05+_0xb71b('0x5e');if(!_[_0xb71b('0x5f')](_0x554693[_0xb71b('0x4d')])&&fs[_0xb71b('0x51')](_0x32fc05)){logger[_0xb71b('0x5a')]('File:\x20\x22'+_0x32fc05+_0xb71b('0x5d'));fs[_0xb71b('0x60')](_0x32fc05);}return _0x554693;})[_0xb71b('0x25')](function(_0x2bfa44){if(!_0x2bfa44)throw new InternalError();return _0x2bfa44[_0xb71b('0x58')]();})[_0xb71b('0x25')](function(){_0x1d190f[_0xb71b('0x18')](0xcc)[_0xb71b('0x19')]();})['catch'](handleError(_0x1d190f,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 4149421..feebf50 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 _0xa467=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','SquareRecording','lodash'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa467,0x143));var _0x7a46=function(_0x68b439,_0x45b859){_0x68b439=_0x68b439-0x0;var _0x1f897b=_0xa467[_0x68b439];return _0x1f897b;};'use strict';var _=require(_0x7a46('0x0'));var util=require(_0x7a46('0x1'));var logger=require(_0x7a46('0x2'))(_0x7a46('0x3'));var moment=require(_0x7a46('0x4'));var BPromise=require(_0x7a46('0x5'));var rp=require(_0x7a46('0x6'));var fs=require('fs');var path=require(_0x7a46('0x7'));var rimraf=require(_0x7a46('0x8'));var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module[_0x7a46('0x9')]=function(_0x1940e6,_0x3bfa2c){return _0x1940e6[_0x7a46('0xa')](_0x7a46('0xb'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f2d=['exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes'];(function(_0x49e734,_0xc04f4f){var _0x2a2d42=function(_0x564e55){while(--_0x564e55){_0x49e734['push'](_0x49e734['shift']());}};_0x2a2d42(++_0xc04f4f);}(_0x1f2d,0x1c4));var _0xd1f2=function(_0x1a3243,_0x201872){_0x1a3243=_0x1a3243-0x0;var _0x33f2ca=_0x1f2d[_0x1a3243];return _0x33f2ca;};'use strict';var _=require(_0xd1f2('0x0'));var util=require(_0xd1f2('0x1'));var logger=require(_0xd1f2('0x2'))(_0xd1f2('0x3'));var moment=require('moment');var BPromise=require(_0xd1f2('0x4'));var rp=require(_0xd1f2('0x5'));var fs=require('fs');var path=require(_0xd1f2('0x6'));var rimraf=require(_0xd1f2('0x7'));var config=require(_0xd1f2('0x8'));var attributes=require(_0xd1f2('0x9'));module[_0xd1f2('0xa')]=function(_0x185be2,_0x3e318d){return _0x185be2[_0xd1f2('0xb')](_0xd1f2('0xc'),attributes,{'tableName':_0xd1f2('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 78933fa..96bc839 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 _0x00af=['catch','CreateSquareRecording','SquareRecording','create','body','options','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../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','result'];(function(_0x2bda71,_0x1bffdb){var _0x23172d=function(_0xb619a9){while(--_0xb619a9){_0x2bda71['push'](_0x2bda71['shift']());}};_0x23172d(++_0x1bffdb);}(_0x00af,0x9d));var _0xf00a=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x00af[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0xf00a('0x0'));var moment=require('moment');var BPromise=require(_0xf00a('0x1'));var rs=require(_0xf00a('0x2'));var fs=require('fs');var Redis=require(_0xf00a('0x3'));var db=require(_0xf00a('0x4'))['db'];var utils=require(_0xf00a('0x5'));var logger=require(_0xf00a('0x6'))(_0xf00a('0x7'));var config=require(_0xf00a('0x8'));var jayson=require(_0xf00a('0x9'));var client=jayson[_0xf00a('0xa')][_0xf00a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45e9d9,_0x25837c,_0x11d5f8){return new BPromise(function(_0x361df8,_0x4d29d2){return client[_0xf00a('0xc')](_0x45e9d9,_0x11d5f8)[_0xf00a('0xd')](function(_0xdfb074){logger[_0xf00a('0xe')](_0xf00a('0xf'),_0x25837c,'request\x20sent');logger[_0xf00a('0x10')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x25837c,_0xf00a('0x11'),JSON[_0xf00a('0x12')](_0xdfb074));if(_0xdfb074['error']){if(_0xdfb074[_0xf00a('0x13')][_0xf00a('0x14')]===0x1f4){logger[_0xf00a('0x13')](_0xf00a('0xf'),_0x25837c,_0xdfb074[_0xf00a('0x13')]['message']);return _0x4d29d2(_0xdfb074[_0xf00a('0x13')][_0xf00a('0x15')]);}logger[_0xf00a('0x13')](_0xf00a('0xf'),_0x25837c,_0xdfb074[_0xf00a('0x13')][_0xf00a('0x15')]);return _0x361df8(_0xdfb074[_0xf00a('0x13')]['message']);}else{logger[_0xf00a('0xe')](_0xf00a('0xf'),_0x25837c,_0xf00a('0x11'));_0x361df8(_0xdfb074[_0xf00a('0x16')][_0xf00a('0x15')]);}})[_0xf00a('0x17')](function(_0x127d7a){logger[_0xf00a('0x13')]('SquareRecording,\x20%s,\x20%s',_0x25837c,_0x127d7a);_0x4d29d2(_0x127d7a);});});}exports[_0xf00a('0x18')]=function(_0x317535){var _0x57f357=this;return new Promise(function(_0x40ba3c,_0x3b1140){return db[_0xf00a('0x19')][_0xf00a('0x1a')](_0x317535[_0xf00a('0x1b')],{'raw':_0x317535['options']?_0x317535[_0xf00a('0x1c')][_0xf00a('0x1d')]===undefined?!![]:![]:!![]})[_0xf00a('0xd')](function(_0x33038d){logger[_0xf00a('0xe')]('CreateSquareRecording',_0x317535);logger[_0xf00a('0x10')](_0xf00a('0x18'),_0x317535,JSON[_0xf00a('0x12')](_0x33038d));_0x40ba3c(_0x33038d);})[_0xf00a('0x17')](function(_0x55740e){logger[_0xf00a('0x13')](_0xf00a('0x18'),_0x55740e[_0xf00a('0x15')],_0x317535);_0x3b1140(_0x57f357[_0xf00a('0x13')](0x1f4,_0x55740e[_0xf00a('0x15')]));});});}; \ No newline at end of file +var _0x8c6b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','then','util','ioredis'];(function(_0x270141,_0x570788){var _0x32167e=function(_0x2d0587){while(--_0x2d0587){_0x270141['push'](_0x270141['shift']());}};_0x32167e(++_0x570788);}(_0x8c6b,0x19e));var _0xb8c6=function(_0x4a339c,_0x4eab70){_0x4a339c=_0x4a339c-0x0;var _0x3ddd0e=_0x8c6b[_0x4a339c];return _0x3ddd0e;};'use strict';var _=require('lodash');var util=require(_0xb8c6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb8c6('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb8c6('0x2'))(_0xb8c6('0x3'));var config=require(_0xb8c6('0x4'));var jayson=require(_0xb8c6('0x5'));var client=jayson[_0xb8c6('0x6')][_0xb8c6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f8493,_0x233fb0,_0x4ede72){return new BPromise(function(_0x43522a,_0xa50639){return client[_0xb8c6('0x8')](_0x3f8493,_0x4ede72)['then'](function(_0x5a0912){logger[_0xb8c6('0x9')]('SquareRecording,\x20%s,\x20%s',_0x233fb0,_0xb8c6('0xa'));logger[_0xb8c6('0xb')](_0xb8c6('0xc'),_0x233fb0,_0xb8c6('0xa'),JSON[_0xb8c6('0xd')](_0x5a0912));if(_0x5a0912['error']){if(_0x5a0912[_0xb8c6('0xe')][_0xb8c6('0xf')]===0x1f4){logger[_0xb8c6('0xe')](_0xb8c6('0x10'),_0x233fb0,_0x5a0912[_0xb8c6('0xe')][_0xb8c6('0x11')]);return _0xa50639(_0x5a0912[_0xb8c6('0xe')]['message']);}logger['error'](_0xb8c6('0x10'),_0x233fb0,_0x5a0912[_0xb8c6('0xe')][_0xb8c6('0x11')]);return _0x43522a(_0x5a0912['error'][_0xb8c6('0x11')]);}else{logger[_0xb8c6('0x9')](_0xb8c6('0x10'),_0x233fb0,_0xb8c6('0xa'));_0x43522a(_0x5a0912['result'][_0xb8c6('0x11')]);}})[_0xb8c6('0x12')](function(_0x44c436){logger[_0xb8c6('0xe')](_0xb8c6('0x10'),_0x233fb0,_0x44c436);_0xa50639(_0x44c436);});});}exports[_0xb8c6('0x13')]=function(_0x2dece7){var _0x17ee50=this;return new Promise(function(_0x17eb4c,_0xc72ed3){return db[_0xb8c6('0x14')][_0xb8c6('0x15')](_0x2dece7[_0xb8c6('0x16')],{'raw':_0x2dece7[_0xb8c6('0x17')]?_0x2dece7['options'][_0xb8c6('0x18')]===undefined?!![]:![]:!![]})[_0xb8c6('0x19')](function(_0x3db728){logger[_0xb8c6('0x9')](_0xb8c6('0x13'),_0x2dece7);logger[_0xb8c6('0xb')]('CreateSquareRecording',_0x2dece7,JSON[_0xb8c6('0xd')](_0x3db728));_0x17eb4c(_0x3db728);})['catch'](function(_0x17e9b5){logger[_0xb8c6('0xe')](_0xb8c6('0x13'),_0x17e9b5[_0xb8c6('0x11')],_0x2dece7);_0xc72ed3(_0x17ee50[_0xb8c6('0xe')](0x1f4,_0x17e9b5['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 66ebf6d..d1346e5 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 0c4d1f5..da0803e 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 _0x0e58=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x40e7d1,_0x8f4019){var _0xcf5f88=function(_0x4e582a){while(--_0x4e582a){_0x40e7d1['push'](_0x40e7d1['shift']());}};_0xcf5f88(++_0x8f4019);}(_0x0e58,0x1e9));var _0x80e5=function(_0x437abe,_0x3e33a8){_0x437abe=_0x437abe-0x0;var _0x51189b=_0x0e58[_0x437abe];return _0x51189b;};'use strict';var Sequelize=require(_0x80e5('0x0'));module[_0x80e5('0x1')]={'network':{'type':Sequelize[_0x80e5('0x2')]},'network_script':{'type':Sequelize[_0x80e5('0x2')]},'request':{'type':Sequelize[_0x80e5('0x2')]},'channel':{'type':Sequelize[_0x80e5('0x2')]},'language':{'type':Sequelize[_0x80e5('0x2')]},'type':{'type':Sequelize[_0x80e5('0x2')]},'uniqueid':{'type':Sequelize[_0x80e5('0x2')]},'version':{'type':Sequelize[_0x80e5('0x2')]},'callerid':{'type':Sequelize[_0x80e5('0x2')]},'calleridname':{'type':Sequelize[_0x80e5('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x80e5('0x2')]},'callington':{'type':Sequelize[_0x80e5('0x2')]},'callingtns':{'type':Sequelize[_0x80e5('0x2')]},'dnid':{'type':Sequelize[_0x80e5('0x2')]},'rdnis':{'type':Sequelize[_0x80e5('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x80e5('0x2')]},'priority':{'type':Sequelize[_0x80e5('0x2')]},'enhanced':{'type':Sequelize[_0x80e5('0x2')]},'accountcode':{'type':Sequelize[_0x80e5('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x80e5('0x2')]},'joinAt':{'type':Sequelize[_0x80e5('0x3')]},'leaveAt':{'type':Sequelize[_0x80e5('0x3')]},'bot':{'type':Sequelize[_0x80e5('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xd175=['BOOLEAN','sequelize','STRING','DATE'];(function(_0x26a57f,_0x1cef6c){var _0x26757e=function(_0x334918){while(--_0x334918){_0x26a57f['push'](_0x26a57f['shift']());}};_0x26757e(++_0x1cef6c);}(_0xd175,0x1ed));var _0x5d17=function(_0x5a0a90,_0x57bb44){_0x5a0a90=_0x5a0a90-0x0;var _0x5acabc=_0xd175[_0x5a0a90];return _0x5acabc;};'use strict';var Sequelize=require(_0x5d17('0x0'));module['exports']={'network':{'type':Sequelize[_0x5d17('0x1')]},'network_script':{'type':Sequelize[_0x5d17('0x1')]},'request':{'type':Sequelize[_0x5d17('0x1')]},'channel':{'type':Sequelize[_0x5d17('0x1')]},'language':{'type':Sequelize[_0x5d17('0x1')]},'type':{'type':Sequelize[_0x5d17('0x1')]},'uniqueid':{'type':Sequelize[_0x5d17('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x5d17('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x5d17('0x1')]},'callington':{'type':Sequelize[_0x5d17('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x5d17('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5d17('0x1')]},'threadid':{'type':Sequelize[_0x5d17('0x1')]},'project_name':{'type':Sequelize[_0x5d17('0x1')]},'joinAt':{'type':Sequelize[_0x5d17('0x2')]},'leaveAt':{'type':Sequelize[_0x5d17('0x2')]},'bot':{'type':Sequelize[_0x5d17('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index d9c00f4..51dc4ca 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 _0x466f=['params','rawAttributes','attributes','length','include','find','create','body','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','apply','update','destroy','end','error','stack','name','index','map','SquareReport','fieldName','type','model','query','keys','filters','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','rows','catch','show'];(function(_0x510ea6,_0x15e280){var _0x3afe9c=function(_0x1149e8){while(--_0x1149e8){_0x510ea6['push'](_0x510ea6['shift']());}};_0x3afe9c(++_0x15e280);}(_0x466f,0x9f));var _0xf466=function(_0x2366ed,_0x454970){_0x2366ed=_0x2366ed-0x0;var _0x5dd399=_0x466f[_0x2366ed];return _0x5dd399;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf466('0x0'));var jsonpatch=require(_0xf466('0x1'));var rp=require(_0xf466('0x2'));var moment=require('moment');var BPromise=require(_0xf466('0x3'));var Mustache=require(_0xf466('0x4'));var util=require(_0xf466('0x5'));var path=require(_0xf466('0x6'));var sox=require(_0xf466('0x7'));var csv=require(_0xf466('0x8'));var ejs=require(_0xf466('0x9'));var fs=require('fs');var fs_extra=require(_0xf466('0xa'));var _=require(_0xf466('0xb'));var squel=require('squel');var crypto=require(_0xf466('0xc'));var jsforce=require(_0xf466('0xd'));var deskjs=require(_0xf466('0xe'));var toCsv=require(_0xf466('0x8'));var querystring=require(_0xf466('0xf'));var Papa=require(_0xf466('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf466('0x11'));var as=require(_0xf466('0x12'));var hardwareService=require(_0xf466('0x13'));var logger=require(_0xf466('0x14'))(_0xf466('0x15'));var utils=require(_0xf466('0x16'));var config=require(_0xf466('0x17'));var licenseUtil=require(_0xf466('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe2dd64,_0x4b4f66){_0x4b4f66=_0x4b4f66||0xcc;return function(_0x44947d){if(_0x44947d){return _0xe2dd64[_0xf466('0x19')](_0x4b4f66);}return _0xe2dd64[_0xf466('0x1a')](_0x4b4f66)['end']();};}function respondWithResult(_0x35a42a,_0x17b4a9){_0x17b4a9=_0x17b4a9||0xc8;return function(_0x3f8205){if(_0x3f8205){return _0x35a42a[_0xf466('0x1a')](_0x17b4a9)[_0xf466('0x1b')](_0x3f8205);}};}function respondWithFilteredResult(_0x97b4dd,_0x195fd8){return function(_0x9b091f){if(_0x9b091f){var _0xaf2a96=typeof _0x195fd8[_0xf466('0x1c')]===_0xf466('0x1d')&&typeof _0x195fd8['limit']===_0xf466('0x1d');var _0x345fb3=_0x9b091f[_0xf466('0x1e')];var _0x3aba11=_0xaf2a96?0x0:_0x195fd8['offset'];var _0x5deca2=_0xaf2a96?_0x9b091f[_0xf466('0x1e')]:_0x195fd8[_0xf466('0x1c')]+_0x195fd8[_0xf466('0x1f')];var _0x57b988;if(_0x5deca2>=_0x345fb3){_0x5deca2=_0x345fb3;_0x57b988=0xc8;}else{_0x57b988=0xce;}_0x97b4dd['status'](_0x57b988);return _0x97b4dd[_0xf466('0x20')]('Content-Range',_0x3aba11+'-'+_0x5deca2+'/'+_0x345fb3)[_0xf466('0x1b')](_0x9b091f);}return null;};}function patchUpdates(_0x2af627){return function(_0x4e2d6b){try{jsonpatch[_0xf466('0x21')](_0x4e2d6b,_0x2af627,!![]);}catch(_0x1b66b8){return BPromise['reject'](_0x1b66b8);}return _0x4e2d6b['save']();};}function saveUpdates(_0x2a680b,_0x12e14a){return function(_0x49a3df){if(_0x49a3df){return _0x49a3df[_0xf466('0x22')](_0x2a680b)['then'](function(_0x2706fb){return _0x2706fb;});}return null;};}function removeEntity(_0x3dc1b4,_0x529522){return function(_0x19c790){if(_0x19c790){return _0x19c790[_0xf466('0x23')]()['then'](function(){_0x3dc1b4[_0xf466('0x1a')](0xcc)[_0xf466('0x24')]();});}};}function handleEntityNotFound(_0x38f7c5,_0x2817c1){return function(_0x560ee7){if(!_0x560ee7){_0x38f7c5['sendStatus'](0x194);}return _0x560ee7;};}function handleError(_0x50af4a,_0x88dfe1){_0x88dfe1=_0x88dfe1||0x1f4;return function(_0x21320c){logger[_0xf466('0x25')](_0x21320c[_0xf466('0x26')]);if(_0x21320c[_0xf466('0x27')]){delete _0x21320c[_0xf466('0x27')];}_0x50af4a['status'](_0x88dfe1)['send'](_0x21320c);};}exports[_0xf466('0x28')]=function(_0x2cf192,_0x628065){var _0x56513e={},_0x216db8={},_0xfa8184={'count':0x0,'rows':[]};var _0x7fd848=_[_0xf466('0x29')](db[_0xf466('0x2a')]['rawAttributes'],function(_0x6f09f1){return{'name':_0x6f09f1[_0xf466('0x2b')],'type':_0x6f09f1[_0xf466('0x2c')]['key']};});_0x216db8[_0xf466('0x2d')]=_[_0xf466('0x29')](_0x7fd848,_0xf466('0x27'));_0x216db8[_0xf466('0x2e')]=_[_0xf466('0x2f')](_0x2cf192[_0xf466('0x2e')]);_0x216db8[_0xf466('0x30')]=_[_0xf466('0x31')](_0x216db8['model'],_0x216db8['query']);_0x56513e['attributes']=_['intersection'](_0x216db8[_0xf466('0x2d')],qs[_0xf466('0x32')](_0x2cf192[_0xf466('0x2e')][_0xf466('0x32')]));_0x56513e['attributes']=_0x56513e['attributes']['length']?_0x56513e['attributes']:_0x216db8[_0xf466('0x2d')];if(!_0x2cf192['query'][_0xf466('0x33')](_0xf466('0x34'))){_0x56513e[_0xf466('0x1f')]=qs[_0xf466('0x1f')](_0x2cf192[_0xf466('0x2e')]['limit']);_0x56513e[_0xf466('0x1c')]=qs['offset'](_0x2cf192[_0xf466('0x2e')]['offset']);}_0x56513e[_0xf466('0x35')]=qs[_0xf466('0x36')](_0x2cf192[_0xf466('0x2e')][_0xf466('0x36')]);_0x56513e['where']=qs['filters'](_[_0xf466('0x37')](_0x2cf192[_0xf466('0x2e')],_0x216db8[_0xf466('0x30')]),_0x7fd848);if(_0x2cf192['query'][_0xf466('0x38')]){_0x56513e[_0xf466('0x39')]=_[_0xf466('0x3a')](_0x56513e[_0xf466('0x39')],{'$or':_['map'](_0x7fd848,function(_0x5756a3){if(_0x5756a3[_0xf466('0x2c')]!==_0xf466('0x3b')){var _0x46aa4c={};_0x46aa4c[_0x5756a3[_0xf466('0x27')]]={'$like':'%'+_0x2cf192[_0xf466('0x2e')][_0xf466('0x38')]+'%'};return _0x46aa4c;}})});}_0x56513e=_[_0xf466('0x3a')]({},_0x56513e,_0x2cf192[_0xf466('0x3c')]);var _0x175e51={'where':_0x56513e['where']};return db['SquareReport'][_0xf466('0x1e')](_0x175e51)[_0xf466('0x3d')](function(_0x229219){_0xfa8184[_0xf466('0x1e')]=_0x229219;if(_0x2cf192['query'][_0xf466('0x3e')]){_0x56513e['include']=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x56513e);})['then'](function(_0x5ce2a4){_0xfa8184[_0xf466('0x3f')]=_0x5ce2a4;return _0xfa8184;})[_0xf466('0x3d')](respondWithFilteredResult(_0x628065,_0x56513e))[_0xf466('0x40')](handleError(_0x628065,null));};exports[_0xf466('0x41')]=function(_0x5224b1,_0x1a6a4b){var _0x40c44b={'raw':!![],'where':{'id':_0x5224b1[_0xf466('0x42')]['id']}},_0x2beb62={};_0x2beb62[_0xf466('0x2d')]=_[_0xf466('0x2f')](db[_0xf466('0x2a')][_0xf466('0x43')]);_0x2beb62[_0xf466('0x2e')]=_[_0xf466('0x2f')](_0x5224b1['query']);_0x2beb62['filters']=_[_0xf466('0x31')](_0x2beb62[_0xf466('0x2d')],_0x2beb62[_0xf466('0x2e')]);_0x40c44b['attributes']=_[_0xf466('0x31')](_0x2beb62[_0xf466('0x2d')],qs[_0xf466('0x32')](_0x5224b1[_0xf466('0x2e')]['fields']));_0x40c44b[_0xf466('0x44')]=_0x40c44b[_0xf466('0x44')][_0xf466('0x45')]?_0x40c44b['attributes']:_0x2beb62['model'];if(_0x5224b1[_0xf466('0x2e')][_0xf466('0x3e')]){_0x40c44b[_0xf466('0x46')]=[{'all':!![]}];}_0x40c44b=_[_0xf466('0x3a')]({},_0x40c44b,_0x5224b1['options']);return db[_0xf466('0x2a')][_0xf466('0x47')](_0x40c44b)[_0xf466('0x3d')](handleEntityNotFound(_0x1a6a4b,null))[_0xf466('0x3d')](respondWithResult(_0x1a6a4b,null))['catch'](handleError(_0x1a6a4b,null));};exports[_0xf466('0x48')]=function(_0x575056,_0x29f227){return db[_0xf466('0x2a')][_0xf466('0x48')](_0x575056[_0xf466('0x49')],{})['then'](respondWithResult(_0x29f227,0xc9))[_0xf466('0x40')](handleError(_0x29f227,null));};exports[_0xf466('0x22')]=function(_0x3dae9f,_0x514c9a){if(_0x3dae9f[_0xf466('0x49')]['id']){delete _0x3dae9f[_0xf466('0x49')]['id'];}return db[_0xf466('0x2a')][_0xf466('0x47')]({'where':{'id':_0x3dae9f[_0xf466('0x42')]['id']}})[_0xf466('0x3d')](handleEntityNotFound(_0x514c9a,null))[_0xf466('0x3d')](saveUpdates(_0x3dae9f[_0xf466('0x49')],null))[_0xf466('0x3d')](respondWithResult(_0x514c9a,null))[_0xf466('0x40')](handleError(_0x514c9a,null));};exports['destroy']=function(_0x781a83,_0x4ac352){return db[_0xf466('0x2a')][_0xf466('0x47')]({'where':{'id':_0x781a83[_0xf466('0x42')]['id']}})[_0xf466('0x3d')](handleEntityNotFound(_0x4ac352,null))['then'](removeEntity(_0x4ac352,null))[_0xf466('0x40')](handleError(_0x4ac352,null));};exports[_0xf466('0x4a')]=function(_0x38080f,_0x1f1770){return db[_0xf466('0x2a')][_0xf466('0x4a')]()[_0xf466('0x3d')](respondWithResult(_0x1f1770,null))[_0xf466('0x40')](handleError(_0x1f1770,null));}; \ No newline at end of file +var _0x45a2=['path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','set','Content-Range','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','SquareReport','includeAll','include','findAll','rows','show','params','keys','filters','options','find','catch','update','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x67e7e3,_0x4b126c){var _0x24bbde=function(_0x4bbc90){while(--_0x4bbc90){_0x67e7e3['push'](_0x67e7e3['shift']());}};_0x24bbde(++_0x4b126c);}(_0x45a2,0x1c6));var _0x245a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x45a2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x245a('0x0'));var zipdir=require(_0x245a('0x1'));var jsonpatch=require(_0x245a('0x2'));var rp=require(_0x245a('0x3'));var moment=require(_0x245a('0x4'));var BPromise=require(_0x245a('0x5'));var Mustache=require(_0x245a('0x6'));var util=require(_0x245a('0x7'));var path=require(_0x245a('0x8'));var sox=require(_0x245a('0x9'));var csv=require(_0x245a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x245a('0xb'));var _=require('lodash');var squel=require(_0x245a('0xc'));var crypto=require(_0x245a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x245a('0xe'));var toCsv=require(_0x245a('0xa'));var querystring=require(_0x245a('0xf'));var Papa=require(_0x245a('0x10'));var Redis=require(_0x245a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x245a('0x12'));var as=require(_0x245a('0x13'));var hardwareService=require(_0x245a('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x245a('0x15'));var config=require(_0x245a('0x16'));var licenseUtil=require(_0x245a('0x17'));var db=require(_0x245a('0x18'))['db'];function respondWithStatusCode(_0x111b05,_0x1b970c){_0x1b970c=_0x1b970c||0xcc;return function(_0x164608){if(_0x164608){return _0x111b05[_0x245a('0x19')](_0x1b970c);}return _0x111b05['status'](_0x1b970c)[_0x245a('0x1a')]();};}function respondWithResult(_0x2a316f,_0x1d997f){_0x1d997f=_0x1d997f||0xc8;return function(_0xba2247){if(_0xba2247){return _0x2a316f['status'](_0x1d997f)[_0x245a('0x1b')](_0xba2247);}};}function respondWithFilteredResult(_0x44b882,_0x41328d){return function(_0x42de1e){if(_0x42de1e){var _0xf3d2ca=typeof _0x41328d[_0x245a('0x1c')]===_0x245a('0x1d')&&typeof _0x41328d['limit']===_0x245a('0x1d');var _0x4bd205=_0x42de1e['count'];var _0x104306=_0xf3d2ca?0x0:_0x41328d[_0x245a('0x1c')];var _0x23aee5=_0xf3d2ca?_0x42de1e[_0x245a('0x1e')]:_0x41328d[_0x245a('0x1c')]+_0x41328d['limit'];var _0x1b7b72;if(_0x23aee5>=_0x4bd205){_0x23aee5=_0x4bd205;_0x1b7b72=0xc8;}else{_0x1b7b72=0xce;}_0x44b882[_0x245a('0x1f')](_0x1b7b72);return _0x44b882[_0x245a('0x20')](_0x245a('0x21'),_0x104306+'-'+_0x23aee5+'/'+_0x4bd205)[_0x245a('0x1b')](_0x42de1e);}return null;};}function patchUpdates(_0x4b4679){return function(_0x34c953){try{jsonpatch['apply'](_0x34c953,_0x4b4679,!![]);}catch(_0x129fab){return BPromise[_0x245a('0x22')](_0x129fab);}return _0x34c953[_0x245a('0x23')]();};}function saveUpdates(_0x28cd2a,_0x58fdda){return function(_0x3b24a3){if(_0x3b24a3){return _0x3b24a3['update'](_0x28cd2a)[_0x245a('0x24')](function(_0x24e437){return _0x24e437;});}return null;};}function removeEntity(_0x1d664b,_0x354c3f){return function(_0x20a7e7){if(_0x20a7e7){return _0x20a7e7[_0x245a('0x25')]()[_0x245a('0x24')](function(){_0x1d664b[_0x245a('0x1f')](0xcc)[_0x245a('0x1a')]();});}};}function handleEntityNotFound(_0x4d04c9,_0x101b43){return function(_0x168df5){if(!_0x168df5){_0x4d04c9[_0x245a('0x19')](0x194);}return _0x168df5;};}function handleError(_0x10b47f,_0x474fbc){_0x474fbc=_0x474fbc||0x1f4;return function(_0x24e167){logger[_0x245a('0x26')](_0x24e167[_0x245a('0x27')]);if(_0x24e167[_0x245a('0x28')]){delete _0x24e167[_0x245a('0x28')];}_0x10b47f[_0x245a('0x1f')](_0x474fbc)['send'](_0x24e167);};}exports[_0x245a('0x29')]=function(_0x52f2fe,_0x21cb93){var _0x32d761={},_0x27d704={},_0x26db95={'count':0x0,'rows':[]};var _0x24d30e=_[_0x245a('0x2a')](db['SquareReport'][_0x245a('0x2b')],function(_0x15ee4a){return{'name':_0x15ee4a[_0x245a('0x2c')],'type':_0x15ee4a[_0x245a('0x2d')][_0x245a('0x2e')]};});_0x27d704[_0x245a('0x2f')]=_[_0x245a('0x2a')](_0x24d30e,'name');_0x27d704[_0x245a('0x30')]=_['keys'](_0x52f2fe['query']);_0x27d704['filters']=_[_0x245a('0x31')](_0x27d704['model'],_0x27d704['query']);_0x32d761[_0x245a('0x32')]=_[_0x245a('0x31')](_0x27d704[_0x245a('0x2f')],qs[_0x245a('0x33')](_0x52f2fe[_0x245a('0x30')][_0x245a('0x33')]));_0x32d761['attributes']=_0x32d761[_0x245a('0x32')][_0x245a('0x34')]?_0x32d761['attributes']:_0x27d704['model'];if(!_0x52f2fe['query']['hasOwnProperty'](_0x245a('0x35'))){_0x32d761[_0x245a('0x36')]=qs[_0x245a('0x36')](_0x52f2fe[_0x245a('0x30')][_0x245a('0x36')]);_0x32d761[_0x245a('0x1c')]=qs[_0x245a('0x1c')](_0x52f2fe['query'][_0x245a('0x1c')]);}_0x32d761[_0x245a('0x37')]=qs['sort'](_0x52f2fe[_0x245a('0x30')][_0x245a('0x38')]);_0x32d761['where']=qs['filters'](_[_0x245a('0x39')](_0x52f2fe[_0x245a('0x30')],_0x27d704['filters']),_0x24d30e);if(_0x52f2fe[_0x245a('0x30')][_0x245a('0x3a')]){_0x32d761[_0x245a('0x3b')]=_[_0x245a('0x3c')](_0x32d761[_0x245a('0x3b')],{'$or':_['map'](_0x24d30e,function(_0x45405c){if(_0x45405c[_0x245a('0x2d')]!==_0x245a('0x3d')){var _0x29fbd8={};_0x29fbd8[_0x45405c[_0x245a('0x28')]]={'$like':'%'+_0x52f2fe[_0x245a('0x30')]['filter']+'%'};return _0x29fbd8;}})});}_0x32d761=_[_0x245a('0x3c')]({},_0x32d761,_0x52f2fe['options']);var _0x55e093={'where':_0x32d761['where']};return db[_0x245a('0x3e')][_0x245a('0x1e')](_0x55e093)[_0x245a('0x24')](function(_0x6f7b46){_0x26db95[_0x245a('0x1e')]=_0x6f7b46;if(_0x52f2fe['query'][_0x245a('0x3f')]){_0x32d761[_0x245a('0x40')]=[{'all':!![]}];}return db['SquareReport'][_0x245a('0x41')](_0x32d761);})[_0x245a('0x24')](function(_0x4ae525){_0x26db95[_0x245a('0x42')]=_0x4ae525;return _0x26db95;})['then'](respondWithFilteredResult(_0x21cb93,_0x32d761))['catch'](handleError(_0x21cb93,null));};exports[_0x245a('0x43')]=function(_0x1e6a37,_0x5ad5e8){var _0x904940={'raw':!![],'where':{'id':_0x1e6a37[_0x245a('0x44')]['id']}},_0x59231b={};_0x59231b['model']=_[_0x245a('0x45')](db[_0x245a('0x3e')]['rawAttributes']);_0x59231b[_0x245a('0x30')]=_[_0x245a('0x45')](_0x1e6a37[_0x245a('0x30')]);_0x59231b[_0x245a('0x46')]=_[_0x245a('0x31')](_0x59231b[_0x245a('0x2f')],_0x59231b[_0x245a('0x30')]);_0x904940[_0x245a('0x32')]=_['intersection'](_0x59231b[_0x245a('0x2f')],qs[_0x245a('0x33')](_0x1e6a37[_0x245a('0x30')][_0x245a('0x33')]));_0x904940[_0x245a('0x32')]=_0x904940[_0x245a('0x32')][_0x245a('0x34')]?_0x904940['attributes']:_0x59231b['model'];if(_0x1e6a37[_0x245a('0x30')][_0x245a('0x3f')]){_0x904940[_0x245a('0x40')]=[{'all':!![]}];}_0x904940=_[_0x245a('0x3c')]({},_0x904940,_0x1e6a37[_0x245a('0x47')]);return db[_0x245a('0x3e')][_0x245a('0x48')](_0x904940)[_0x245a('0x24')](handleEntityNotFound(_0x5ad5e8,null))['then'](respondWithResult(_0x5ad5e8,null))['catch'](handleError(_0x5ad5e8,null));};exports['create']=function(_0x255086,_0xfa0bfb){return db[_0x245a('0x3e')]['create'](_0x255086['body'],{})[_0x245a('0x24')](respondWithResult(_0xfa0bfb,0xc9))[_0x245a('0x49')](handleError(_0xfa0bfb,null));};exports[_0x245a('0x4a')]=function(_0x3699d6,_0x5a41cc){if(_0x3699d6[_0x245a('0x4b')]['id']){delete _0x3699d6[_0x245a('0x4b')]['id'];}return db[_0x245a('0x3e')]['find']({'where':{'id':_0x3699d6[_0x245a('0x44')]['id']}})['then'](handleEntityNotFound(_0x5a41cc,null))[_0x245a('0x24')](saveUpdates(_0x3699d6[_0x245a('0x4b')],null))['then'](respondWithResult(_0x5a41cc,null))['catch'](handleError(_0x5a41cc,null));};exports['destroy']=function(_0x32eb50,_0x330ae7){return db[_0x245a('0x3e')][_0x245a('0x48')]({'where':{'id':_0x32eb50[_0x245a('0x44')]['id']}})[_0x245a('0x24')](handleEntityNotFound(_0x330ae7,null))[_0x245a('0x24')](removeEntity(_0x330ae7,null))['catch'](handleError(_0x330ae7,null));};exports[_0x245a('0x4c')]=function(_0x12ecc2,_0x1353a5){return db[_0x245a('0x3e')][_0x245a('0x4c')]()['then'](respondWithResult(_0x1353a5,null))[_0x245a('0x49')](handleError(_0x1353a5,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 788ba36..06fef03 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 _0x2e5f=['define','SquareReport','report_square','uid_pname','uniqueid','leaveAt','lodash','../../config/logger','api','moment','request-promise','./squareReport.attributes','exports'];(function(_0x5e9d35,_0x382c91){var _0x3beb2e=function(_0x4242cf){while(--_0x4242cf){_0x5e9d35['push'](_0x5e9d35['shift']());}};_0x3beb2e(++_0x382c91);}(_0x2e5f,0x124));var _0xf2e5=function(_0x243c40,_0x248424){_0x243c40=_0x243c40-0x0;var _0x5caff3=_0x2e5f[_0x243c40];return _0x5caff3;};'use strict';var _=require(_0xf2e5('0x0'));var util=require('util');var logger=require(_0xf2e5('0x1'))(_0xf2e5('0x2'));var moment=require(_0xf2e5('0x3'));var BPromise=require('bluebird');var rp=require(_0xf2e5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf2e5('0x5'));module[_0xf2e5('0x6')]=function(_0x1ebf83,_0x1a61fb){return _0x1ebf83[_0xf2e5('0x7')](_0xf2e5('0x8'),attributes,{'tableName':_0xf2e5('0x9'),'paranoid':![],'indexes':[{'name':_0xf2e5('0xa'),'fields':[_0xf2e5('0xb'),'project_name']},{'name':'leaveAt','fields':[_0xf2e5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf0a2=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf0a2,0x168));var _0x2f0a=function(_0x58fa7d,_0x111070){_0x58fa7d=_0x58fa7d-0x0;var _0x29b308=_0xf0a2[_0x58fa7d];return _0x29b308;};'use strict';var _=require(_0x2f0a('0x0'));var util=require(_0x2f0a('0x1'));var logger=require(_0x2f0a('0x2'))(_0x2f0a('0x3'));var moment=require(_0x2f0a('0x4'));var BPromise=require(_0x2f0a('0x5'));var rp=require(_0x2f0a('0x6'));var fs=require('fs');var path=require(_0x2f0a('0x7'));var rimraf=require(_0x2f0a('0x8'));var config=require(_0x2f0a('0x9'));var attributes=require(_0x2f0a('0xa'));module[_0x2f0a('0xb')]=function(_0x48a041,_0x55e914){return _0x48a041['define'](_0x2f0a('0xc'),attributes,{'tableName':_0x2f0a('0xd'),'paranoid':![],'indexes':[{'name':_0x2f0a('0xe'),'fields':[_0x2f0a('0xf'),_0x2f0a('0x10')]},{'name':_0x2f0a('0x11'),'fields':[_0x2f0a('0x11')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index c7bbfd1..83ce248 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 _0x1719=['result','catch','SquareReport','create','body','options','raw','CreateSquareReport','UpdateSquareReport','update','attributes','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0x1719,0x1eb));var _0x9171=function(_0x1ce8ef,_0x203740){_0x1ce8ef=_0x1ce8ef-0x0;var _0x1edecb=_0x1719[_0x1ce8ef];return _0x1edecb;};'use strict';var _=require('lodash');var util=require(_0x9171('0x0'));var moment=require(_0x9171('0x1'));var BPromise=require('bluebird');var rs=require(_0x9171('0x2'));var fs=require('fs');var Redis=require(_0x9171('0x3'));var db=require(_0x9171('0x4'))['db'];var utils=require(_0x9171('0x5'));var logger=require(_0x9171('0x6'))(_0x9171('0x7'));var config=require(_0x9171('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9171('0x9')][_0x9171('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x166bae,_0x59203b,_0x21f0ca){return new BPromise(function(_0x77f462,_0x512484){return client[_0x9171('0xb')](_0x166bae,_0x21f0ca)[_0x9171('0xc')](function(_0x31a7f6){logger['info'](_0x9171('0xd'),_0x59203b,_0x9171('0xe'));logger[_0x9171('0xf')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x59203b,'request\x20sent',JSON[_0x9171('0x10')](_0x31a7f6));if(_0x31a7f6[_0x9171('0x11')]){if(_0x31a7f6['error'][_0x9171('0x12')]===0x1f4){logger[_0x9171('0x11')](_0x9171('0xd'),_0x59203b,_0x31a7f6[_0x9171('0x11')][_0x9171('0x13')]);return _0x512484(_0x31a7f6[_0x9171('0x11')][_0x9171('0x13')]);}logger['error'](_0x9171('0xd'),_0x59203b,_0x31a7f6[_0x9171('0x11')][_0x9171('0x13')]);return _0x77f462(_0x31a7f6[_0x9171('0x11')][_0x9171('0x13')]);}else{logger[_0x9171('0x14')](_0x9171('0xd'),_0x59203b,'request\x20sent');_0x77f462(_0x31a7f6[_0x9171('0x15')][_0x9171('0x13')]);}})[_0x9171('0x16')](function(_0x234249){logger[_0x9171('0x11')](_0x9171('0xd'),_0x59203b,_0x234249);_0x512484(_0x234249);});});}exports['CreateSquareReport']=function(_0x1c46d5){var _0x4e2dce=this;return new Promise(function(_0x58cab7,_0xb30b3c){return db[_0x9171('0x17')][_0x9171('0x18')](_0x1c46d5[_0x9171('0x19')],{'raw':_0x1c46d5[_0x9171('0x1a')]?_0x1c46d5[_0x9171('0x1a')][_0x9171('0x1b')]===undefined?!![]:![]:!![]})[_0x9171('0xc')](function(_0x14e8eb){logger[_0x9171('0x14')](_0x9171('0x1c'),_0x1c46d5);logger[_0x9171('0xf')](_0x9171('0x1c'),_0x1c46d5,JSON['stringify'](_0x14e8eb));_0x58cab7(_0x14e8eb);})[_0x9171('0x16')](function(_0x3ba3fd){logger['error'](_0x9171('0x1c'),_0x3ba3fd['message'],_0x1c46d5);_0xb30b3c(_0x4e2dce['error'](0x1f4,_0x3ba3fd['message']));});});};exports[_0x9171('0x1d')]=function(_0x11d221){var _0xc2d890=this;return new Promise(function(_0x361763,_0x1514f3){return db[_0x9171('0x17')][_0x9171('0x1e')](_0x11d221[_0x9171('0x19')],{'raw':_0x11d221['options']?_0x11d221['options'][_0x9171('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11d221[_0x9171('0x1a')]?_0x11d221['options']['where']||null:null,'attributes':_0x11d221['options']?_0x11d221[_0x9171('0x1a')][_0x9171('0x1f')]||null:null,'limit':_0x11d221[_0x9171('0x1a')]?_0x11d221[_0x9171('0x1a')]['limit']||null:null})['then'](function(_0x29a00a){logger[_0x9171('0x14')](_0x9171('0x1d'),_0x11d221);logger[_0x9171('0xf')]('UpdateSquareReport',_0x11d221,JSON[_0x9171('0x10')](_0x29a00a));_0x361763(_0x29a00a);})[_0x9171('0x16')](function(_0x587526){logger[_0x9171('0x11')]('UpdateSquareReport',_0x587526['message'],_0x11d221);_0x1514f3(_0xc2d890[_0x9171('0x11')](0x1f4,_0x587526[_0x9171('0x13')]));});});}; \ No newline at end of file +var _0x16e7=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateSquareReport','SquareReport','create','body','options','UpdateSquareReport','update','raw','where','attributes','limit','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x16e7,0x17c));var _0x716e=function(_0x2ff44b,_0x7e8762){_0x2ff44b=_0x2ff44b-0x0;var _0x18dbb0=_0x16e7[_0x2ff44b];return _0x18dbb0;};'use strict';var _=require('lodash');var util=require(_0x716e('0x0'));var moment=require(_0x716e('0x1'));var BPromise=require(_0x716e('0x2'));var rs=require(_0x716e('0x3'));var fs=require('fs');var Redis=require(_0x716e('0x4'));var db=require(_0x716e('0x5'))['db'];var utils=require(_0x716e('0x6'));var logger=require('../../config/logger')(_0x716e('0x7'));var config=require(_0x716e('0x8'));var jayson=require(_0x716e('0x9'));var client=jayson[_0x716e('0xa')][_0x716e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x344bc0,_0x5ee1ac,_0x25fa84){return new BPromise(function(_0x26cfe5,_0x404a9e){return client[_0x716e('0xc')](_0x344bc0,_0x25fa84)[_0x716e('0xd')](function(_0x187987){logger[_0x716e('0xe')](_0x716e('0xf'),_0x5ee1ac,_0x716e('0x10'));logger[_0x716e('0x11')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x5ee1ac,'request\x20sent',JSON[_0x716e('0x12')](_0x187987));if(_0x187987[_0x716e('0x13')]){if(_0x187987[_0x716e('0x13')][_0x716e('0x14')]===0x1f4){logger['error'](_0x716e('0xf'),_0x5ee1ac,_0x187987[_0x716e('0x13')]['message']);return _0x404a9e(_0x187987[_0x716e('0x13')][_0x716e('0x15')]);}logger['error'](_0x716e('0xf'),_0x5ee1ac,_0x187987[_0x716e('0x13')][_0x716e('0x15')]);return _0x26cfe5(_0x187987['error'][_0x716e('0x15')]);}else{logger['info'](_0x716e('0xf'),_0x5ee1ac,'request\x20sent');_0x26cfe5(_0x187987[_0x716e('0x16')][_0x716e('0x15')]);}})['catch'](function(_0x53b74b){logger[_0x716e('0x13')](_0x716e('0xf'),_0x5ee1ac,_0x53b74b);_0x404a9e(_0x53b74b);});});}exports[_0x716e('0x17')]=function(_0x51b3bb){var _0x1ca97a=this;return new Promise(function(_0x3d0590,_0x243604){return db[_0x716e('0x18')][_0x716e('0x19')](_0x51b3bb[_0x716e('0x1a')],{'raw':_0x51b3bb[_0x716e('0x1b')]?_0x51b3bb['options']['raw']===undefined?!![]:![]:!![]})[_0x716e('0xd')](function(_0x265133){logger[_0x716e('0xe')](_0x716e('0x17'),_0x51b3bb);logger['debug']('CreateSquareReport',_0x51b3bb,JSON['stringify'](_0x265133));_0x3d0590(_0x265133);})['catch'](function(_0x33de92){logger[_0x716e('0x13')]('CreateSquareReport',_0x33de92[_0x716e('0x15')],_0x51b3bb);_0x243604(_0x1ca97a[_0x716e('0x13')](0x1f4,_0x33de92['message']));});});};exports[_0x716e('0x1c')]=function(_0x570dcc){var _0x21a57a=this;return new Promise(function(_0x6b1319,_0x2edcf4){return db[_0x716e('0x18')][_0x716e('0x1d')](_0x570dcc[_0x716e('0x1a')],{'raw':_0x570dcc[_0x716e('0x1b')]?_0x570dcc[_0x716e('0x1b')][_0x716e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x570dcc[_0x716e('0x1b')]?_0x570dcc[_0x716e('0x1b')][_0x716e('0x1f')]||null:null,'attributes':_0x570dcc[_0x716e('0x1b')]?_0x570dcc[_0x716e('0x1b')][_0x716e('0x20')]||null:null,'limit':_0x570dcc[_0x716e('0x1b')]?_0x570dcc['options'][_0x716e('0x21')]||null:null})[_0x716e('0xd')](function(_0x239da8){logger['info'](_0x716e('0x1c'),_0x570dcc);logger['debug'](_0x716e('0x1c'),_0x570dcc,JSON[_0x716e('0x12')](_0x239da8));_0x6b1319(_0x239da8);})[_0x716e('0x22')](function(_0x28f3c0){logger[_0x716e('0x13')](_0x716e('0x1c'),_0x28f3c0[_0x716e('0x15')],_0x570dcc);_0x2edcf4(_0x21a57a[_0x716e('0x13')](0x1f4,_0x28f3c0[_0x716e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 9d09ab8..8fbdb22 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 _0x6ee1=['update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put'];(function(_0x4eed74,_0x2de584){var _0x8dfe4b=function(_0x2dc8dd){while(--_0x2dc8dd){_0x4eed74['push'](_0x4eed74['shift']());}};_0x8dfe4b(++_0x2de584);}(_0x6ee1,0x74));var _0x16ee=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x6ee1[_0x2dadb9];return _0x2f0097;};'use strict';var multer=require('multer');var util=require(_0x16ee('0x0'));var path=require(_0x16ee('0x1'));var timeout=require(_0x16ee('0x2'));var express=require(_0x16ee('0x3'));var router=express[_0x16ee('0x4')]();var fs_extra=require(_0x16ee('0x5'));var auth=require(_0x16ee('0x6'));var interaction=require(_0x16ee('0x7'));var config=require('../../config/environment');var controller=require(_0x16ee('0x8'));router[_0x16ee('0x9')]('/',auth[_0x16ee('0xa')](),controller['index']);router['get'](_0x16ee('0xb'),auth[_0x16ee('0xa')](),controller[_0x16ee('0xc')]);router[_0x16ee('0x9')](_0x16ee('0xd'),auth[_0x16ee('0xa')](),controller[_0x16ee('0xe')]);router[_0x16ee('0xf')]('/',auth[_0x16ee('0xa')](),controller['create']);router[_0x16ee('0x10')](_0x16ee('0xd'),auth['isAuthenticated'](),controller[_0x16ee('0x11')]);router[_0x16ee('0x12')](_0x16ee('0xd'),auth[_0x16ee('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4895=['put','update','delete','exports','multer','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create'];(function(_0x41d364,_0xdfdc1a){var _0x5ace98=function(_0x5f1194){while(--_0x5f1194){_0x41d364['push'](_0x41d364['shift']());}};_0x5ace98(++_0xdfdc1a);}(_0x4895,0x90));var _0x5489=function(_0x52cc1e,_0x51160e){_0x52cc1e=_0x52cc1e-0x0;var _0x3a0902=_0x4895[_0x52cc1e];return _0x3a0902;};'use strict';var multer=require(_0x5489('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5489('0x1'));var router=express[_0x5489('0x2')]();var fs_extra=require(_0x5489('0x3'));var auth=require(_0x5489('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5489('0x5'));var controller=require(_0x5489('0x6'));router[_0x5489('0x7')]('/',auth['isAuthenticated'](),controller[_0x5489('0x8')]);router[_0x5489('0x7')](_0x5489('0x9'),auth[_0x5489('0xa')](),controller[_0x5489('0xb')]);router['get'](_0x5489('0xc'),auth[_0x5489('0xa')](),controller[_0x5489('0xd')]);router[_0x5489('0xe')]('/',auth['isAuthenticated'](),controller[_0x5489('0xf')]);router[_0x5489('0x10')](_0x5489('0xc'),auth[_0x5489('0xa')](),controller[_0x5489('0x11')]);router[_0x5489('0x12')]('/:id',auth[_0x5489('0xa')](),controller['destroy']);module[_0x5489('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 3d6054e..dc5f42f 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 _0x6df4=['sequelize','exports','STRING','TEXT'];(function(_0x379746,_0x4f834f){var _0x41701a=function(_0x4d3965){while(--_0x4d3965){_0x379746['push'](_0x379746['shift']());}};_0x41701a(++_0x4f834f);}(_0x6df4,0x150));var _0x46df=function(_0x28e2cd,_0x153b42){_0x28e2cd=_0x28e2cd-0x0;var _0x11fd46=_0x6df4[_0x28e2cd];return _0x11fd46;};'use strict';var Sequelize=require(_0x46df('0x0'));module[_0x46df('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x46df('0x2')]},'application':{'type':Sequelize[_0x46df('0x2')]},'data':{'type':Sequelize[_0x46df('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x46df('0x2')]}}; \ No newline at end of file +var _0x0c0c=['STRING','exports'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x0c0c,0x159));var _0xc0c0=function(_0x892efd,_0x44075e){_0x892efd=_0x892efd-0x0;var _0x1f6a80=_0x0c0c[_0x892efd];return _0x1f6a80;};'use strict';var Sequelize=require('sequelize');module[_0xc0c0('0x0')]={'uniqueid':{'type':Sequelize[_0xc0c0('0x1')]},'node':{'type':Sequelize[_0xc0c0('0x1')]},'application':{'type':Sequelize[_0xc0c0('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xc0c0('0x1')]},'callerid':{'type':Sequelize[_0xc0c0('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 90ef129..00e0ed2 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 _0xd462=['send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','rows','catch','show','include','options','create','body','update','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','end','stack','name'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd462,0x157));var _0x2d46=function(_0x20eacd,_0x2394e2){_0x20eacd=_0x20eacd-0x0;var _0x57942a=_0xd462[_0x20eacd];return _0x57942a;};'use strict';var emlformat=require(_0x2d46('0x0'));var rimraf=require(_0x2d46('0x1'));var zipdir=require(_0x2d46('0x2'));var jsonpatch=require(_0x2d46('0x3'));var rp=require(_0x2d46('0x4'));var moment=require(_0x2d46('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2d46('0x6'));var util=require(_0x2d46('0x7'));var path=require(_0x2d46('0x8'));var sox=require(_0x2d46('0x9'));var csv=require(_0x2d46('0xa'));var ejs=require(_0x2d46('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d46('0xc'));var squel=require(_0x2d46('0xd'));var crypto=require(_0x2d46('0xe'));var jsforce=require(_0x2d46('0xf'));var deskjs=require(_0x2d46('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2d46('0x11'));var Papa=require(_0x2d46('0x12'));var Redis=require('ioredis');var authService=require(_0x2d46('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2d46('0x14'));var hardwareService=require(_0x2d46('0x15'));var logger=require(_0x2d46('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x2d46('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2d46('0x18'))['db'];function respondWithStatusCode(_0x12aa11,_0x169376){_0x169376=_0x169376||0xcc;return function(_0x57935c){if(_0x57935c){return _0x12aa11[_0x2d46('0x19')](_0x169376);}return _0x12aa11[_0x2d46('0x1a')](_0x169376)['end']();};}function respondWithResult(_0x3e14b2,_0x550764){_0x550764=_0x550764||0xc8;return function(_0x2be5ad){if(_0x2be5ad){return _0x3e14b2[_0x2d46('0x1a')](_0x550764)['json'](_0x2be5ad);}};}function respondWithFilteredResult(_0x54d352,_0xaabb3e){return function(_0x5b28d2){if(_0x5b28d2){var _0x4ca9d6=typeof _0xaabb3e[_0x2d46('0x1b')]===_0x2d46('0x1c')&&typeof _0xaabb3e[_0x2d46('0x1d')]===_0x2d46('0x1c');var _0x482382=_0x5b28d2[_0x2d46('0x1e')];var _0x579e90=_0x4ca9d6?0x0:_0xaabb3e[_0x2d46('0x1b')];var _0x728af9=_0x4ca9d6?_0x5b28d2['count']:_0xaabb3e[_0x2d46('0x1b')]+_0xaabb3e['limit'];var _0x51946e;if(_0x728af9>=_0x482382){_0x728af9=_0x482382;_0x51946e=0xc8;}else{_0x51946e=0xce;}_0x54d352['status'](_0x51946e);return _0x54d352[_0x2d46('0x1f')](_0x2d46('0x20'),_0x579e90+'-'+_0x728af9+'/'+_0x482382)[_0x2d46('0x21')](_0x5b28d2);}return null;};}function patchUpdates(_0x1f8410){return function(_0x499c02){try{jsonpatch[_0x2d46('0x22')](_0x499c02,_0x1f8410,!![]);}catch(_0x1caa48){return BPromise[_0x2d46('0x23')](_0x1caa48);}return _0x499c02[_0x2d46('0x24')]();};}function saveUpdates(_0x404728,_0xab749d){return function(_0x3ce27e){if(_0x3ce27e){return _0x3ce27e['update'](_0x404728)[_0x2d46('0x25')](function(_0x3dd1c4){return _0x3dd1c4;});}return null;};}function removeEntity(_0x111511,_0x241895){return function(_0x17e8f4){if(_0x17e8f4){return _0x17e8f4[_0x2d46('0x26')]()[_0x2d46('0x25')](function(){_0x111511[_0x2d46('0x1a')](0xcc)[_0x2d46('0x27')]();});}};}function handleEntityNotFound(_0x362c00,_0x5b95b5){return function(_0x88d397){if(!_0x88d397){_0x362c00[_0x2d46('0x19')](0x194);}return _0x88d397;};}function handleError(_0x47f3eb,_0x2ac8c2){_0x2ac8c2=_0x2ac8c2||0x1f4;return function(_0x27e1d5){logger['error'](_0x27e1d5[_0x2d46('0x28')]);if(_0x27e1d5[_0x2d46('0x29')]){delete _0x27e1d5[_0x2d46('0x29')];}_0x47f3eb['status'](_0x2ac8c2)[_0x2d46('0x2a')](_0x27e1d5);};}exports[_0x2d46('0x2b')]=function(_0x2eb609,_0x2cfef5){var _0x127274={},_0x14002e={},_0x3f8b9a={'count':0x0,'rows':[]};var _0x487ce7=_[_0x2d46('0x2c')](db[_0x2d46('0x2d')][_0x2d46('0x2e')],function(_0x5bee97){return{'name':_0x5bee97[_0x2d46('0x2f')],'type':_0x5bee97[_0x2d46('0x30')]['key']};});_0x14002e[_0x2d46('0x31')]=_['map'](_0x487ce7,_0x2d46('0x29'));_0x14002e[_0x2d46('0x32')]=_[_0x2d46('0x33')](_0x2eb609[_0x2d46('0x32')]);_0x14002e[_0x2d46('0x34')]=_[_0x2d46('0x35')](_0x14002e['model'],_0x14002e[_0x2d46('0x32')]);_0x127274[_0x2d46('0x36')]=_['intersection'](_0x14002e[_0x2d46('0x31')],qs[_0x2d46('0x37')](_0x2eb609[_0x2d46('0x32')]['fields']));_0x127274[_0x2d46('0x36')]=_0x127274[_0x2d46('0x36')][_0x2d46('0x38')]?_0x127274['attributes']:_0x14002e[_0x2d46('0x31')];if(!_0x2eb609['query'][_0x2d46('0x39')]('nolimit')){_0x127274[_0x2d46('0x1d')]=qs[_0x2d46('0x1d')](_0x2eb609[_0x2d46('0x32')][_0x2d46('0x1d')]);_0x127274[_0x2d46('0x1b')]=qs[_0x2d46('0x1b')](_0x2eb609[_0x2d46('0x32')][_0x2d46('0x1b')]);}_0x127274[_0x2d46('0x3a')]=qs[_0x2d46('0x3b')](_0x2eb609[_0x2d46('0x32')][_0x2d46('0x3b')]);_0x127274[_0x2d46('0x3c')]=qs[_0x2d46('0x34')](_[_0x2d46('0x3d')](_0x2eb609[_0x2d46('0x32')],_0x14002e[_0x2d46('0x34')]),_0x487ce7);if(_0x2eb609[_0x2d46('0x32')]['filter']){_0x127274[_0x2d46('0x3c')]=_[_0x2d46('0x3e')](_0x127274['where'],{'$or':_[_0x2d46('0x2c')](_0x487ce7,function(_0x2dc42b){if(_0x2dc42b[_0x2d46('0x30')]!==_0x2d46('0x3f')){var _0x15dbee={};_0x15dbee[_0x2dc42b[_0x2d46('0x29')]]={'$like':'%'+_0x2eb609[_0x2d46('0x32')][_0x2d46('0x40')]+'%'};return _0x15dbee;}})});}_0x127274=_[_0x2d46('0x3e')]({},_0x127274,_0x2eb609['options']);var _0x2186ab={'where':_0x127274['where']};return db[_0x2d46('0x2d')][_0x2d46('0x1e')](_0x2186ab)['then'](function(_0x39ecb7){_0x3f8b9a[_0x2d46('0x1e')]=_0x39ecb7;if(_0x2eb609[_0x2d46('0x32')][_0x2d46('0x41')]){_0x127274['include']=[{'all':!![]}];}return db[_0x2d46('0x2d')]['findAll'](_0x127274);})['then'](function(_0x41ec63){_0x3f8b9a[_0x2d46('0x42')]=_0x41ec63;return _0x3f8b9a;})[_0x2d46('0x25')](respondWithFilteredResult(_0x2cfef5,_0x127274))[_0x2d46('0x43')](handleError(_0x2cfef5,null));};exports[_0x2d46('0x44')]=function(_0x25bb55,_0x3e446b){var _0x2bfcff={'raw':!![],'where':{'id':_0x25bb55['params']['id']}},_0x431705={};_0x431705[_0x2d46('0x31')]=_[_0x2d46('0x33')](db[_0x2d46('0x2d')][_0x2d46('0x2e')]);_0x431705[_0x2d46('0x32')]=_[_0x2d46('0x33')](_0x25bb55[_0x2d46('0x32')]);_0x431705['filters']=_[_0x2d46('0x35')](_0x431705[_0x2d46('0x31')],_0x431705[_0x2d46('0x32')]);_0x2bfcff[_0x2d46('0x36')]=_[_0x2d46('0x35')](_0x431705['model'],qs['fields'](_0x25bb55[_0x2d46('0x32')][_0x2d46('0x37')]));_0x2bfcff[_0x2d46('0x36')]=_0x2bfcff[_0x2d46('0x36')]['length']?_0x2bfcff[_0x2d46('0x36')]:_0x431705[_0x2d46('0x31')];if(_0x25bb55['query'][_0x2d46('0x41')]){_0x2bfcff[_0x2d46('0x45')]=[{'all':!![]}];}_0x2bfcff=_[_0x2d46('0x3e')]({},_0x2bfcff,_0x25bb55[_0x2d46('0x46')]);return db['SquareDetailsReport']['find'](_0x2bfcff)['then'](handleEntityNotFound(_0x3e446b,null))[_0x2d46('0x25')](respondWithResult(_0x3e446b,null))[_0x2d46('0x43')](handleError(_0x3e446b,null));};exports[_0x2d46('0x47')]=function(_0x2cc4c6,_0x48069a){return db[_0x2d46('0x2d')][_0x2d46('0x47')](_0x2cc4c6[_0x2d46('0x48')],{})[_0x2d46('0x25')](respondWithResult(_0x48069a,0xc9))[_0x2d46('0x43')](handleError(_0x48069a,null));};exports[_0x2d46('0x49')]=function(_0xd746ee,_0x166664){if(_0xd746ee[_0x2d46('0x48')]['id']){delete _0xd746ee[_0x2d46('0x48')]['id'];}return db[_0x2d46('0x2d')][_0x2d46('0x4a')]({'where':{'id':_0xd746ee['params']['id']}})[_0x2d46('0x25')](handleEntityNotFound(_0x166664,null))['then'](saveUpdates(_0xd746ee['body'],null))['then'](respondWithResult(_0x166664,null))['catch'](handleError(_0x166664,null));};exports[_0x2d46('0x26')]=function(_0x4ac700,_0x393dff){return db[_0x2d46('0x2d')]['find']({'where':{'id':_0x4ac700[_0x2d46('0x4b')]['id']}})['then'](handleEntityNotFound(_0x393dff,null))[_0x2d46('0x25')](removeEntity(_0x393dff,null))[_0x2d46('0x43')](handleError(_0x393dff,null));};exports[_0x2d46('0x4c')]=function(_0x200b28,_0x94f4ca){return db['SquareDetailsReport'][_0x2d46('0x4c')]()[_0x2d46('0x25')](respondWithResult(_0x94f4ca,null))[_0x2d46('0x43')](handleError(_0x94f4ca,null));}; \ No newline at end of file +var _0x8a34=['options','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','json','undefined','count','offset','limit','status','set','Content-Range','reject','save','then','sendStatus','error','name','index','map','fieldName','type','key','keys','query','model','attributes','intersection','fields','hasOwnProperty','order','sort','filters','pick','where','VIRTUAL','SquareDetailsReport','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','merge'];(function(_0x3b731f,_0x4b89c6){var _0x414d85=function(_0x3291f8){while(--_0x3291f8){_0x3b731f['push'](_0x3b731f['shift']());}};_0x414d85(++_0x4b89c6);}(_0x8a34,0x9b));var _0x48a3=function(_0x54faff,_0x9a3b5e){_0x54faff=_0x54faff-0x0;var _0x5a784c=_0x8a34[_0x54faff];return _0x5a784c;};'use strict';var emlformat=require(_0x48a3('0x0'));var rimraf=require(_0x48a3('0x1'));var zipdir=require(_0x48a3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x48a3('0x3'));var moment=require(_0x48a3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x48a3('0x5'));var util=require(_0x48a3('0x6'));var path=require(_0x48a3('0x7'));var sox=require(_0x48a3('0x8'));var csv=require(_0x48a3('0x9'));var ejs=require(_0x48a3('0xa'));var fs=require('fs');var fs_extra=require(_0x48a3('0xb'));var _=require(_0x48a3('0xc'));var squel=require('squel');var crypto=require(_0x48a3('0xd'));var jsforce=require(_0x48a3('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x48a3('0x9'));var querystring=require(_0x48a3('0xf'));var Papa=require(_0x48a3('0x10'));var Redis=require(_0x48a3('0x11'));var authService=require(_0x48a3('0x12'));var qs=require(_0x48a3('0x13'));var as=require(_0x48a3('0x14'));var hardwareService=require(_0x48a3('0x15'));var logger=require(_0x48a3('0x16'))('api');var utils=require(_0x48a3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x48a3('0x18'));var db=require(_0x48a3('0x19'))['db'];function respondWithStatusCode(_0x555048,_0x4d9975){_0x4d9975=_0x4d9975||0xcc;return function(_0x53f4fe){if(_0x53f4fe){return _0x555048['sendStatus'](_0x4d9975);}return _0x555048['status'](_0x4d9975)[_0x48a3('0x1a')]();};}function respondWithResult(_0x47af42,_0x552653){_0x552653=_0x552653||0xc8;return function(_0x13c963){if(_0x13c963){return _0x47af42['status'](_0x552653)[_0x48a3('0x1b')](_0x13c963);}};}function respondWithFilteredResult(_0x202e53,_0x1997ce){return function(_0x9f129d){if(_0x9f129d){var _0x527480=typeof _0x1997ce['offset']===_0x48a3('0x1c')&&typeof _0x1997ce['limit']===_0x48a3('0x1c');var _0x186ad1=_0x9f129d[_0x48a3('0x1d')];var _0x47a8cc=_0x527480?0x0:_0x1997ce[_0x48a3('0x1e')];var _0x7c7cbf=_0x527480?_0x9f129d[_0x48a3('0x1d')]:_0x1997ce[_0x48a3('0x1e')]+_0x1997ce[_0x48a3('0x1f')];var _0x512c14;if(_0x7c7cbf>=_0x186ad1){_0x7c7cbf=_0x186ad1;_0x512c14=0xc8;}else{_0x512c14=0xce;}_0x202e53[_0x48a3('0x20')](_0x512c14);return _0x202e53[_0x48a3('0x21')](_0x48a3('0x22'),_0x47a8cc+'-'+_0x7c7cbf+'/'+_0x186ad1)[_0x48a3('0x1b')](_0x9f129d);}return null;};}function patchUpdates(_0x2f30a9){return function(_0x27e1be){try{jsonpatch['apply'](_0x27e1be,_0x2f30a9,!![]);}catch(_0xba8d5e){return BPromise[_0x48a3('0x23')](_0xba8d5e);}return _0x27e1be[_0x48a3('0x24')]();};}function saveUpdates(_0x2b3400,_0x40d4e8){return function(_0x8276e6){if(_0x8276e6){return _0x8276e6['update'](_0x2b3400)[_0x48a3('0x25')](function(_0x3cd8dc){return _0x3cd8dc;});}return null;};}function removeEntity(_0xd9746b,_0x418548){return function(_0x4b3167){if(_0x4b3167){return _0x4b3167['destroy']()[_0x48a3('0x25')](function(){_0xd9746b[_0x48a3('0x20')](0xcc)[_0x48a3('0x1a')]();});}};}function handleEntityNotFound(_0x297c0f,_0x30c1cf){return function(_0x24ab66){if(!_0x24ab66){_0x297c0f[_0x48a3('0x26')](0x194);}return _0x24ab66;};}function handleError(_0x28cdbf,_0x21e52c){_0x21e52c=_0x21e52c||0x1f4;return function(_0x346d4a){logger[_0x48a3('0x27')](_0x346d4a['stack']);if(_0x346d4a[_0x48a3('0x28')]){delete _0x346d4a[_0x48a3('0x28')];}_0x28cdbf['status'](_0x21e52c)['send'](_0x346d4a);};}exports[_0x48a3('0x29')]=function(_0x19df91,_0x1dd5b1){var _0x1a303a={},_0x3b99d0={},_0x38e9d3={'count':0x0,'rows':[]};var _0x48a953=_[_0x48a3('0x2a')](db['SquareDetailsReport']['rawAttributes'],function(_0x46f07e){return{'name':_0x46f07e[_0x48a3('0x2b')],'type':_0x46f07e[_0x48a3('0x2c')][_0x48a3('0x2d')]};});_0x3b99d0['model']=_[_0x48a3('0x2a')](_0x48a953,'name');_0x3b99d0['query']=_[_0x48a3('0x2e')](_0x19df91[_0x48a3('0x2f')]);_0x3b99d0['filters']=_['intersection'](_0x3b99d0[_0x48a3('0x30')],_0x3b99d0[_0x48a3('0x2f')]);_0x1a303a[_0x48a3('0x31')]=_[_0x48a3('0x32')](_0x3b99d0['model'],qs[_0x48a3('0x33')](_0x19df91[_0x48a3('0x2f')][_0x48a3('0x33')]));_0x1a303a[_0x48a3('0x31')]=_0x1a303a['attributes']['length']?_0x1a303a[_0x48a3('0x31')]:_0x3b99d0[_0x48a3('0x30')];if(!_0x19df91[_0x48a3('0x2f')][_0x48a3('0x34')]('nolimit')){_0x1a303a[_0x48a3('0x1f')]=qs[_0x48a3('0x1f')](_0x19df91[_0x48a3('0x2f')][_0x48a3('0x1f')]);_0x1a303a[_0x48a3('0x1e')]=qs[_0x48a3('0x1e')](_0x19df91[_0x48a3('0x2f')][_0x48a3('0x1e')]);}_0x1a303a[_0x48a3('0x35')]=qs[_0x48a3('0x36')](_0x19df91['query'][_0x48a3('0x36')]);_0x1a303a['where']=qs[_0x48a3('0x37')](_[_0x48a3('0x38')](_0x19df91[_0x48a3('0x2f')],_0x3b99d0[_0x48a3('0x37')]),_0x48a953);if(_0x19df91[_0x48a3('0x2f')]['filter']){_0x1a303a[_0x48a3('0x39')]=_['merge'](_0x1a303a[_0x48a3('0x39')],{'$or':_[_0x48a3('0x2a')](_0x48a953,function(_0x409320){if(_0x409320[_0x48a3('0x2c')]!==_0x48a3('0x3a')){var _0x56bd7a={};_0x56bd7a[_0x409320[_0x48a3('0x28')]]={'$like':'%'+_0x19df91['query']['filter']+'%'};return _0x56bd7a;}})});}_0x1a303a=_['merge']({},_0x1a303a,_0x19df91['options']);var _0x4693ed={'where':_0x1a303a[_0x48a3('0x39')]};return db[_0x48a3('0x3b')][_0x48a3('0x1d')](_0x4693ed)[_0x48a3('0x25')](function(_0x2b2117){_0x38e9d3[_0x48a3('0x1d')]=_0x2b2117;if(_0x19df91[_0x48a3('0x2f')][_0x48a3('0x3c')]){_0x1a303a['include']=[{'all':!![]}];}return db[_0x48a3('0x3b')][_0x48a3('0x3d')](_0x1a303a);})[_0x48a3('0x25')](function(_0x213b66){_0x38e9d3[_0x48a3('0x3e')]=_0x213b66;return _0x38e9d3;})[_0x48a3('0x25')](respondWithFilteredResult(_0x1dd5b1,_0x1a303a))[_0x48a3('0x3f')](handleError(_0x1dd5b1,null));};exports[_0x48a3('0x40')]=function(_0x6510b9,_0x24cb29){var _0x31d95a={'raw':!![],'where':{'id':_0x6510b9[_0x48a3('0x41')]['id']}},_0x4535a3={};_0x4535a3['model']=_[_0x48a3('0x2e')](db[_0x48a3('0x3b')][_0x48a3('0x42')]);_0x4535a3['query']=_[_0x48a3('0x2e')](_0x6510b9[_0x48a3('0x2f')]);_0x4535a3[_0x48a3('0x37')]=_['intersection'](_0x4535a3[_0x48a3('0x30')],_0x4535a3[_0x48a3('0x2f')]);_0x31d95a[_0x48a3('0x31')]=_[_0x48a3('0x32')](_0x4535a3[_0x48a3('0x30')],qs[_0x48a3('0x33')](_0x6510b9[_0x48a3('0x2f')][_0x48a3('0x33')]));_0x31d95a[_0x48a3('0x31')]=_0x31d95a[_0x48a3('0x31')][_0x48a3('0x43')]?_0x31d95a['attributes']:_0x4535a3['model'];if(_0x6510b9['query'][_0x48a3('0x3c')]){_0x31d95a[_0x48a3('0x44')]=[{'all':!![]}];}_0x31d95a=_[_0x48a3('0x45')]({},_0x31d95a,_0x6510b9[_0x48a3('0x46')]);return db[_0x48a3('0x3b')]['find'](_0x31d95a)[_0x48a3('0x25')](handleEntityNotFound(_0x24cb29,null))[_0x48a3('0x25')](respondWithResult(_0x24cb29,null))[_0x48a3('0x3f')](handleError(_0x24cb29,null));};exports[_0x48a3('0x47')]=function(_0x3540f9,_0x1cd22e){return db['SquareDetailsReport'][_0x48a3('0x47')](_0x3540f9['body'],{})['then'](respondWithResult(_0x1cd22e,0xc9))['catch'](handleError(_0x1cd22e,null));};exports['update']=function(_0x49e0e4,_0x4f5c1d){if(_0x49e0e4[_0x48a3('0x48')]['id']){delete _0x49e0e4[_0x48a3('0x48')]['id'];}return db['SquareDetailsReport'][_0x48a3('0x49')]({'where':{'id':_0x49e0e4[_0x48a3('0x41')]['id']}})[_0x48a3('0x25')](handleEntityNotFound(_0x4f5c1d,null))[_0x48a3('0x25')](saveUpdates(_0x49e0e4['body'],null))[_0x48a3('0x25')](respondWithResult(_0x4f5c1d,null))['catch'](handleError(_0x4f5c1d,null));};exports['destroy']=function(_0x447a5e,_0x25f4c7){return db[_0x48a3('0x3b')][_0x48a3('0x49')]({'where':{'id':_0x447a5e['params']['id']}})[_0x48a3('0x25')](handleEntityNotFound(_0x25f4c7,null))[_0x48a3('0x25')](removeEntity(_0x25f4c7,null))[_0x48a3('0x3f')](handleError(_0x25f4c7,null));};exports[_0x48a3('0x4a')]=function(_0x3ca81c,_0x567fcc){return db[_0x48a3('0x3b')][_0x48a3('0x4a')]()[_0x48a3('0x25')](respondWithResult(_0x567fcc,null))[_0x48a3('0x3f')](handleError(_0x567fcc,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 2b0b999..1c05214 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 _0xcbc2=['exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./squareReportDetail.attributes'];(function(_0x3f1dd4,_0x378d9b){var _0x5e0eb7=function(_0x284460){while(--_0x284460){_0x3f1dd4['push'](_0x3f1dd4['shift']());}};_0x5e0eb7(++_0x378d9b);}(_0xcbc2,0xc7));var _0x2cbc=function(_0x517586,_0xc97d01){_0x517586=_0x517586-0x0;var _0x4d7494=_0xcbc2[_0x517586];return _0x4d7494;};'use strict';var _=require(_0x2cbc('0x0'));var util=require(_0x2cbc('0x1'));var logger=require(_0x2cbc('0x2'))(_0x2cbc('0x3'));var moment=require(_0x2cbc('0x4'));var BPromise=require(_0x2cbc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2cbc('0x6'));var rimraf=require(_0x2cbc('0x7'));var config=require('../../config/environment');var attributes=require(_0x2cbc('0x8'));module[_0x2cbc('0x9')]=function(_0x57d7f5,_0x2d51d3){return _0x57d7f5[_0x2cbc('0xa')](_0x2cbc('0xb'),attributes,{'tableName':_0x2cbc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d76=['../../config/logger','api','path','../../config/environment','./squareReportDetail.attributes','exports','define','lodash','util'];(function(_0x3013a3,_0x4c0944){var _0x1a191c=function(_0x58cdbf){while(--_0x58cdbf){_0x3013a3['push'](_0x3013a3['shift']());}};_0x1a191c(++_0x4c0944);}(_0x4d76,0x103));var _0x64d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d76[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x64d7('0x0'));var util=require(_0x64d7('0x1'));var logger=require(_0x64d7('0x2'))(_0x64d7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x64d7('0x4'));var rimraf=require('rimraf');var config=require(_0x64d7('0x5'));var attributes=require(_0x64d7('0x6'));module[_0x64d7('0x7')]=function(_0x3e8b83,_0x9fe017){return _0x3e8b83[_0x64d7('0x8')]('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 117f20a..53c49dc 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 _0x1eba=['SquareDetailsReport','create','body','options','raw','debug','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','result','CreateSquareDetailsReport'];(function(_0x56f9c8,_0x1d3e59){var _0x2244e5=function(_0x39f359){while(--_0x39f359){_0x56f9c8['push'](_0x56f9c8['shift']());}};_0x2244e5(++_0x1d3e59);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x450bf9,_0x1895de){_0x450bf9=_0x450bf9-0x0;var _0x268350=_0x1eba[_0x450bf9];return _0x268350;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var moment=require(_0xa1eb('0x2'));var BPromise=require(_0xa1eb('0x3'));var rs=require(_0xa1eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa1eb('0x5'));var logger=require(_0xa1eb('0x6'))(_0xa1eb('0x7'));var config=require(_0xa1eb('0x8'));var jayson=require(_0xa1eb('0x9'));var client=jayson[_0xa1eb('0xa')][_0xa1eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bfbb0,_0x39a5a3,_0x7d2982){return new BPromise(function(_0x2aebb6,_0x9d7113){return client['request'](_0x2bfbb0,_0x7d2982)[_0xa1eb('0xc')](function(_0x4d4aaf){logger[_0xa1eb('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x39a5a3,_0xa1eb('0xe'));logger['debug'](_0xa1eb('0xf'),_0x39a5a3,'request\x20sent',JSON[_0xa1eb('0x10')](_0x4d4aaf));if(_0x4d4aaf[_0xa1eb('0x11')]){if(_0x4d4aaf[_0xa1eb('0x11')]['code']===0x1f4){logger[_0xa1eb('0x11')](_0xa1eb('0x12'),_0x39a5a3,_0x4d4aaf['error'][_0xa1eb('0x13')]);return _0x9d7113(_0x4d4aaf['error']['message']);}logger[_0xa1eb('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x39a5a3,_0x4d4aaf[_0xa1eb('0x11')][_0xa1eb('0x13')]);return _0x2aebb6(_0x4d4aaf[_0xa1eb('0x11')][_0xa1eb('0x13')]);}else{logger[_0xa1eb('0xd')](_0xa1eb('0x12'),_0x39a5a3,_0xa1eb('0xe'));_0x2aebb6(_0x4d4aaf[_0xa1eb('0x14')][_0xa1eb('0x13')]);}})['catch'](function(_0xbd6a6b){logger['error'](_0xa1eb('0x12'),_0x39a5a3,_0xbd6a6b);_0x9d7113(_0xbd6a6b);});});}exports[_0xa1eb('0x15')]=function(_0x33c4e3){var _0x1a5d2c=this;return new Promise(function(_0x49bfaa,_0x1dd621){return db[_0xa1eb('0x16')][_0xa1eb('0x17')](_0x33c4e3[_0xa1eb('0x18')],{'raw':_0x33c4e3[_0xa1eb('0x19')]?_0x33c4e3[_0xa1eb('0x19')][_0xa1eb('0x1a')]===undefined?!![]:![]:!![]})[_0xa1eb('0xc')](function(_0x4fc14a){logger[_0xa1eb('0xd')]('CreateSquareDetailsReport',_0x33c4e3);logger[_0xa1eb('0x1b')](_0xa1eb('0x15'),_0x33c4e3,JSON[_0xa1eb('0x10')](_0x4fc14a));_0x49bfaa(_0x4fc14a);})[_0xa1eb('0x1c')](function(_0x5e7a34){logger['error'](_0xa1eb('0x15'),_0x5e7a34[_0xa1eb('0x13')],_0x33c4e3);_0x1dd621(_0x1a5d2c['error'](0x1f4,_0x5e7a34[_0xa1eb('0x13')]));});});}; \ No newline at end of file +var _0xa571=['create','body','options','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSquareDetailsReport','SquareDetailsReport'];(function(_0x236023,_0xa7f6b6){var _0x5ef19f=function(_0x4e3dfa){while(--_0x4e3dfa){_0x236023['push'](_0x236023['shift']());}};_0x5ef19f(++_0xa7f6b6);}(_0xa571,0x107));var _0x1a57=function(_0x2f19c1,_0x309c36){_0x2f19c1=_0x2f19c1-0x0;var _0x33aeac=_0xa571[_0x2f19c1];return _0x33aeac;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var moment=require(_0x1a57('0x2'));var BPromise=require(_0x1a57('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a57('0x4'));var db=require(_0x1a57('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a57('0x6'));var config=require('../../config/environment');var jayson=require(_0x1a57('0x7'));var client=jayson[_0x1a57('0x8')][_0x1a57('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5352,_0x2492f5,_0x924873){return new BPromise(function(_0x5d9f45,_0x3edb40){return client[_0x1a57('0xa')](_0x3c5352,_0x924873)[_0x1a57('0xb')](function(_0x58e266){logger[_0x1a57('0xc')](_0x1a57('0xd'),_0x2492f5,_0x1a57('0xe'));logger[_0x1a57('0xf')](_0x1a57('0x10'),_0x2492f5,_0x1a57('0xe'),JSON[_0x1a57('0x11')](_0x58e266));if(_0x58e266[_0x1a57('0x12')]){if(_0x58e266['error']['code']===0x1f4){logger[_0x1a57('0x12')](_0x1a57('0xd'),_0x2492f5,_0x58e266[_0x1a57('0x12')]['message']);return _0x3edb40(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}logger['error'](_0x1a57('0xd'),_0x2492f5,_0x58e266['error'][_0x1a57('0x13')]);return _0x5d9f45(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}else{logger[_0x1a57('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x2492f5,_0x1a57('0xe'));_0x5d9f45(_0x58e266['result']['message']);}})[_0x1a57('0x14')](function(_0x1c537f){logger[_0x1a57('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x2492f5,_0x1c537f);_0x3edb40(_0x1c537f);});});}exports[_0x1a57('0x15')]=function(_0x1662a3){var _0x80f8c1=this;return new Promise(function(_0x53bb20,_0x3daa66){return db[_0x1a57('0x16')][_0x1a57('0x17')](_0x1662a3[_0x1a57('0x18')],{'raw':_0x1662a3[_0x1a57('0x19')]?_0x1662a3['options']['raw']===undefined?!![]:![]:!![]})[_0x1a57('0xb')](function(_0x21e811){logger[_0x1a57('0xc')]('CreateSquareDetailsReport',_0x1662a3);logger['debug']('CreateSquareDetailsReport',_0x1662a3,JSON[_0x1a57('0x11')](_0x21e811));_0x53bb20(_0x21e811);})[_0x1a57('0x14')](function(_0x3f52b9){logger[_0x1a57('0x12')](_0x1a57('0x15'),_0x3f52b9[_0x1a57('0x13')],_0x1662a3);_0x3daa66(_0x80f8c1[_0x1a57('0x12')](0x1f4,_0x3f52b9[_0x1a57('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 1e03837..afd7c5a 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 _0xe15d=['get','/process/:pid/kill','killProcess','express'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0xe15d,0xfb));var _0xde15=function(_0x4dea22,_0x94a013){_0x4dea22=_0x4dea22-0x0;var _0x3a7a1a=_0xe15d[_0x4dea22];return _0x3a7a1a;};'use strict';var express=require(_0xde15('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0xde15('0x1')]('/',auth['isAuthenticated'](),controller['index']);router[_0xde15('0x1')](_0xde15('0x2'),auth['isAuthenticated'](),controller[_0xde15('0x3')]);module['exports']=router; \ No newline at end of file +var _0x0d4a=['express','../../components/auth/service','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports'];(function(_0x388086,_0x544674){var _0x2e6130=function(_0x1c4828){while(--_0x1c4828){_0x388086['push'](_0x388086['shift']());}};_0x2e6130(++_0x544674);}(_0x0d4a,0xb8));var _0xa0d4=function(_0x97e12d,_0x1c0501){_0x97e12d=_0x97e12d-0x0;var _0x1359ca=_0x0d4a[_0x97e12d];return _0x1359ca;};'use strict';var express=require(_0xa0d4('0x0'));var router=express['Router']();var auth=require(_0xa0d4('0x1'));var controller=require('./system.controller');router[_0xa0d4('0x2')]('/',auth[_0xa0d4('0x3')](),controller[_0xa0d4('0x4')]);router[_0xa0d4('0x2')](_0xa0d4('0x5'),auth[_0xa0d4('0x3')](),controller[_0xa0d4('0x6')]);module[_0xa0d4('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index e449139..f1ffe91 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 _0x8303=['components/import/cm','format','params','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','index','getAllData','then','status','json','catch','killProcess'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0x8303,0xd2));var _0x3830=function(_0x11d468,_0x561573){_0x11d468=_0x11d468-0x0;var _0x36cd90=_0x8303[_0x11d468];return _0x36cd90;};'use strict';var info=require(_0x3830('0x0'));var exec=require('child_process')[_0x3830('0x1')];var logger=require('../../config/logger')('api');var util=require(_0x3830('0x2'));var BPromise=require(_0x3830('0x3'));var _=require('lodash');function handleError(_0x2f0e27,_0x40a42d,_0x1aca6b){_0x40a42d=_0x40a42d||0x1f4;return function(_0x18ec68){logger[_0x3830('0x4')](_0x3830('0x5'),_0x1aca6b,_0x40a42d,util[_0x3830('0x6')](_0x18ec68,{'showHidden':![],'depth':null}));delete _0x18ec68[_0x3830('0x7')];_0x2f0e27['status'](_0x40a42d)['send'](_0x18ec68);};}exports[_0x3830('0x8')]=function(_0x47adcb,_0x43e665){return info[_0x3830('0x9')]()[_0x3830('0xa')](function(_0x12e5ef){return _0x43e665[_0x3830('0xb')](0xc8)[_0x3830('0xc')](_0x12e5ef);})[_0x3830('0xd')](function(_0x4dbd06){return _0x43e665[_0x3830('0xb')](0x1f4)[_0x3830('0xc')](_0x4dbd06);});};exports[_0x3830('0xe')]=function(_0x232d16,_0x57a38c){var _0x5b651e=[_0x3830('0xf')];return new BPromise(function(_0x3f9182,_0x27b5c7){return exec(util[_0x3830('0x10')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x232d16[_0x3830('0x11')][_0x3830('0x12')]),function(_0x460bcd,_0x52e427,_0x4922df){if(_0x460bcd){return _0x27b5c7(_0x460bcd);}return _0x3f9182(_0x52e427);});})['then'](function(_0x1f6b34){var _0x2205af=![];var _0x2fce33=_0x1f6b34[_0x3830('0x13')](/\n/);for(var _0x239c87=0x0,_0x528082=_0x5b651e[_0x3830('0x14')];_0x239c87<_0x528082,_0x2205af===![];_0x239c87+=0x1){if(_0x1f6b34['indexOf'](_0x5b651e[_0x239c87])>=0x0){_0x2205af=!![];}}if(!_0x2205af){throw new Error(util[_0x3830('0x10')](_0x3830('0x15'),_0x232d16[_0x3830('0x11')][_0x3830('0x12')]));}process[_0x3830('0x16')](_0x232d16[_0x3830('0x11')][_0x3830('0x12')],_0x3830('0x17'));return _0x57a38c['status'](0xc8)[_0x3830('0xc')]({'message':util['format'](_0x3830('0x18'),_0x232d16[_0x3830('0x11')][_0x3830('0x12')])});})['catch'](handleError(_0x57a38c,null,_0x3830('0xe')));}; \ No newline at end of file +var _0xae21=['util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','../../config/logger','api'];(function(_0x2417c8,_0x416064){var _0x22ed17=function(_0x5b19fe){while(--_0x5b19fe){_0x2417c8['push'](_0x2417c8['shift']());}};_0x22ed17(++_0x416064);}(_0xae21,0x142));var _0x1ae2=function(_0x2dd973,_0x27b85d){_0x2dd973=_0x2dd973-0x0;var _0x363a49=_0xae21[_0x2dd973];return _0x363a49;};'use strict';var info=require('systeminformation');var exec=require(_0x1ae2('0x0'))['exec'];var logger=require(_0x1ae2('0x1'))(_0x1ae2('0x2'));var util=require(_0x1ae2('0x3'));var BPromise=require(_0x1ae2('0x4'));var _=require(_0x1ae2('0x5'));function handleError(_0x15287a,_0x5e5fe7,_0x327346){_0x5e5fe7=_0x5e5fe7||0x1f4;return function(_0x3e1c2a){logger['error'](_0x1ae2('0x6'),_0x327346,_0x5e5fe7,util[_0x1ae2('0x7')](_0x3e1c2a,{'showHidden':![],'depth':null}));delete _0x3e1c2a[_0x1ae2('0x8')];_0x15287a[_0x1ae2('0x9')](_0x5e5fe7)[_0x1ae2('0xa')](_0x3e1c2a);};}exports[_0x1ae2('0xb')]=function(_0x429112,_0x9204c5){return info[_0x1ae2('0xc')]()[_0x1ae2('0xd')](function(_0x212ae3){return _0x9204c5[_0x1ae2('0x9')](0xc8)[_0x1ae2('0xe')](_0x212ae3);})[_0x1ae2('0xf')](function(_0xb18ff8){return _0x9204c5[_0x1ae2('0x9')](0x1f4)[_0x1ae2('0xe')](_0xb18ff8);});};exports['killProcess']=function(_0x330030,_0x254662){var _0x3dab9f=[_0x1ae2('0x10')];return new BPromise(function(_0x2539c3,_0x5a1340){return exec(util['format'](_0x1ae2('0x11'),_0x330030[_0x1ae2('0x12')][_0x1ae2('0x13')]),function(_0x239e75,_0x1c67ad,_0x4de23c){if(_0x239e75){return _0x5a1340(_0x239e75);}return _0x2539c3(_0x1c67ad);});})[_0x1ae2('0xd')](function(_0x53a6fe){var _0x560db7=![];var _0x2e2e3d=_0x53a6fe['split'](/\n/);for(var _0x23cf24=0x0,_0x1d824d=_0x3dab9f['length'];_0x23cf24<_0x1d824d,_0x560db7===![];_0x23cf24+=0x1){if(_0x53a6fe['indexOf'](_0x3dab9f[_0x23cf24])>=0x0){_0x560db7=!![];}}if(!_0x560db7){throw new Error(util[_0x1ae2('0x14')](_0x1ae2('0x15'),_0x330030[_0x1ae2('0x12')][_0x1ae2('0x13')]));}process[_0x1ae2('0x16')](_0x330030[_0x1ae2('0x12')][_0x1ae2('0x13')],_0x1ae2('0x17'));return _0x254662[_0x1ae2('0x9')](0xc8)['json']({'message':util[_0x1ae2('0x14')](_0x1ae2('0x18'),_0x330030['params'][_0x1ae2('0x13')])});})[_0x1ae2('0xf')](handleError(_0x254662,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 183f746..b86ecc6 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 _0xd07e=['util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd07e,0x80));var _0xed07=function(_0x31a3d5,_0x18a3ec){_0x31a3d5=_0x31a3d5-0x0;var _0x236379=_0xd07e[_0x31a3d5];return _0x236379;};'use strict';var multer=require('multer');var util=require(_0xed07('0x0'));var path=require('path');var timeout=require(_0xed07('0x1'));var express=require('express');var router=express[_0xed07('0x2')]();var fs_extra=require(_0xed07('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xed07('0x4'));var config=require(_0xed07('0x5'));var controller=require(_0xed07('0x6'));router[_0xed07('0x7')]('/',auth[_0xed07('0x8')](),controller['index']);router[_0xed07('0x7')](_0xed07('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xed07('0xa')]('/',auth[_0xed07('0x8')](),controller[_0xed07('0xb')]);router[_0xed07('0xc')](_0xed07('0x9'),auth[_0xed07('0x8')](),controller[_0xed07('0xd')]);router[_0xed07('0xe')](_0xed07('0x9'),auth[_0xed07('0x8')](),controller[_0xed07('0xf')]);module['exports']=router; \ No newline at end of file +var _0xadab=['show','post','update','delete','destroy','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./tag.controller','index','get','/:id','isAuthenticated'];(function(_0x504c8b,_0x1187f4){var _0x3e0083=function(_0x5dfb0e){while(--_0x5dfb0e){_0x504c8b['push'](_0x504c8b['shift']());}};_0x3e0083(++_0x1187f4);}(_0xadab,0x115));var _0xbada=function(_0x1f54d7,_0xafc682){_0x1f54d7=_0x1f54d7-0x0;var _0x355fc0=_0xadab[_0x1f54d7];return _0x355fc0;};'use strict';var multer=require('multer');var util=require(_0xbada('0x0'));var path=require(_0xbada('0x1'));var timeout=require(_0xbada('0x2'));var express=require('express');var router=express[_0xbada('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbada('0x4'));var config=require(_0xbada('0x5'));var controller=require(_0xbada('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xbada('0x7')]);router[_0xbada('0x8')](_0xbada('0x9'),auth[_0xbada('0xa')](),controller[_0xbada('0xb')]);router[_0xbada('0xc')]('/',auth[_0xbada('0xa')](),controller['create']);router['put'](_0xbada('0x9'),auth[_0xbada('0xa')](),controller[_0xbada('0xd')]);router[_0xbada('0xe')](_0xbada('0x9'),auth[_0xbada('0xa')](),controller[_0xbada('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 79b9345..c3bfd09 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 _0x9158=['sequelize','exports','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9158,0x16e));var _0x8915=function(_0x465394,_0x1e71aa){_0x465394=_0x465394-0x0;var _0x43ea58=_0x9158[_0x465394];return _0x43ea58;};'use strict';var Sequelize=require(_0x8915('0x0'));module[_0x8915('0x1')]={'name':{'type':Sequelize[_0x8915('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x8915('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x8915('0x2')]}}; \ No newline at end of file +var _0x9354=['exports','STRING','#0091EA'];(function(_0x300915,_0x320ae4){var _0x5887ed=function(_0x211c35){while(--_0x211c35){_0x300915['push'](_0x300915['shift']());}};_0x5887ed(++_0x320ae4);}(_0x9354,0x96));var _0x4935=function(_0xd8f7bd,_0x45dc8c){_0xd8f7bd=_0xd8f7bd-0x0;var _0x1bd5ee=_0x9354[_0xd8f7bd];return _0x1bd5ee;};'use strict';var Sequelize=require('sequelize');module[_0x4935('0x0')]={'name':{'type':Sequelize[_0x4935('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x4935('0x1')],'defaultValue':_0x4935('0x2')},'description':{'type':Sequelize[_0x4935('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 8d9fc31..6cfefd6 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 _0x50a6=['Tag','show','params','includeAll','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','apply','reject','save','then','destroy','get','Tags','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','filters','merge','VIRTUAL','filter','options'];(function(_0x384be5,_0x30583f){var _0x56fe2f=function(_0x44be70){while(--_0x44be70){_0x384be5['push'](_0x384be5['shift']());}};_0x56fe2f(++_0x30583f);}(_0x50a6,0xa4));var _0x650a=function(_0x9c607a,_0x1cb2c6){_0x9c607a=_0x9c607a-0x0;var _0x3b1311=_0x50a6[_0x9c607a];return _0x3b1311;};'use strict';var emlformat=require(_0x650a('0x0'));var rimraf=require(_0x650a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x650a('0x2'));var moment=require('moment');var BPromise=require(_0x650a('0x3'));var Mustache=require(_0x650a('0x4'));var util=require(_0x650a('0x5'));var path=require('path');var sox=require(_0x650a('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x650a('0x7'));var _=require(_0x650a('0x8'));var squel=require(_0x650a('0x9'));var crypto=require(_0x650a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x650a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x650a('0xc'));var Papa=require(_0x650a('0xd'));var Redis=require('ioredis');var authService=require(_0x650a('0xe'));var qs=require(_0x650a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x650a('0x10'));var logger=require('../../config/logger')(_0x650a('0x11'));var utils=require('../../config/utils');var config=require(_0x650a('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x650a('0x13'))['db'];function respondWithStatusCode(_0x48077a,_0x33e73d){_0x33e73d=_0x33e73d||0xcc;return function(_0x163e5f){if(_0x163e5f){return _0x48077a[_0x650a('0x14')](_0x33e73d);}return _0x48077a['status'](_0x33e73d)[_0x650a('0x15')]();};}function respondWithResult(_0x3919a7,_0x2f727d){_0x2f727d=_0x2f727d||0xc8;return function(_0x15f2fd){if(_0x15f2fd){return _0x3919a7[_0x650a('0x16')](_0x2f727d)[_0x650a('0x17')](_0x15f2fd);}};}function respondWithFilteredResult(_0x5b7c74,_0x2460a3){return function(_0x4fdd82){if(_0x4fdd82){var _0x1f94ab=typeof _0x2460a3[_0x650a('0x18')]===_0x650a('0x19')&&typeof _0x2460a3['limit']==='undefined';var _0x5285e0=_0x4fdd82['count'];var _0x2ad2d7=_0x1f94ab?0x0:_0x2460a3[_0x650a('0x18')];var _0x41d2fa=_0x1f94ab?_0x4fdd82[_0x650a('0x1a')]:_0x2460a3[_0x650a('0x18')]+_0x2460a3['limit'];var _0x4eba86;if(_0x41d2fa>=_0x5285e0){_0x41d2fa=_0x5285e0;_0x4eba86=0xc8;}else{_0x4eba86=0xce;}_0x5b7c74[_0x650a('0x16')](_0x4eba86);return _0x5b7c74[_0x650a('0x1b')]('Content-Range',_0x2ad2d7+'-'+_0x41d2fa+'/'+_0x5285e0)[_0x650a('0x17')](_0x4fdd82);}return null;};}function patchUpdates(_0x385ecd){return function(_0x59b5e4){try{jsonpatch[_0x650a('0x1c')](_0x59b5e4,_0x385ecd,!![]);}catch(_0x1ceedd){return BPromise[_0x650a('0x1d')](_0x1ceedd);}return _0x59b5e4[_0x650a('0x1e')]();};}function saveUpdates(_0x5163fe,_0x489a5f){return function(_0x88531d){if(_0x88531d){return _0x88531d['update'](_0x5163fe)[_0x650a('0x1f')](function(_0x1d471d){return _0x1d471d;});}return null;};}function removeEntity(_0xb12c52,_0x469e53){return function(_0x2ed256){if(_0x2ed256){return _0x2ed256[_0x650a('0x20')]()[_0x650a('0x1f')](function(){var _0x322eba=_0x2ed256[_0x650a('0x21')]({'plain':!![]});var _0x2761a8=_0x650a('0x22');return db[_0x650a('0x23')][_0x650a('0x20')]({'where':{'type':_0x2761a8,'resourceId':_0x322eba['id']}})[_0x650a('0x1f')](function(){return _0x2ed256;});})[_0x650a('0x1f')](function(){_0xb12c52[_0x650a('0x16')](0xcc)[_0x650a('0x15')]();});}};}function handleEntityNotFound(_0x12fdb4,_0x4c1df6){return function(_0x2290a7){if(!_0x2290a7){_0x12fdb4[_0x650a('0x14')](0x194);}return _0x2290a7;};}function handleError(_0x558002,_0x5dee27){_0x5dee27=_0x5dee27||0x1f4;return function(_0x1c6845){logger[_0x650a('0x24')](_0x1c6845[_0x650a('0x25')]);if(_0x1c6845[_0x650a('0x26')]){delete _0x1c6845[_0x650a('0x26')];}_0x558002[_0x650a('0x16')](_0x5dee27)['send'](_0x1c6845);};}exports[_0x650a('0x27')]=function(_0x1c8621,_0x199c86){var _0x18c197={},_0x25a47c={},_0x3e15ba={'count':0x0,'rows':[]};var _0x436e28=_[_0x650a('0x28')](db['Tag'][_0x650a('0x29')],function(_0x3c2eda){return{'name':_0x3c2eda[_0x650a('0x2a')],'type':_0x3c2eda['type'][_0x650a('0x2b')]};});_0x25a47c[_0x650a('0x2c')]=_['map'](_0x436e28,_0x650a('0x26'));_0x25a47c[_0x650a('0x2d')]=_[_0x650a('0x2e')](_0x1c8621['query']);_0x25a47c['filters']=_['intersection'](_0x25a47c[_0x650a('0x2c')],_0x25a47c[_0x650a('0x2d')]);_0x18c197[_0x650a('0x2f')]=_[_0x650a('0x30')](_0x25a47c['model'],qs[_0x650a('0x31')](_0x1c8621[_0x650a('0x2d')]['fields']));_0x18c197[_0x650a('0x2f')]=_0x18c197[_0x650a('0x2f')][_0x650a('0x32')]?_0x18c197[_0x650a('0x2f')]:_0x25a47c[_0x650a('0x2c')];if(!_0x1c8621['query'][_0x650a('0x33')]('nolimit')){_0x18c197[_0x650a('0x34')]=qs[_0x650a('0x34')](_0x1c8621['query'][_0x650a('0x34')]);_0x18c197[_0x650a('0x18')]=qs['offset'](_0x1c8621[_0x650a('0x2d')][_0x650a('0x18')]);}_0x18c197[_0x650a('0x35')]=qs['sort'](_0x1c8621[_0x650a('0x2d')][_0x650a('0x36')]);_0x18c197[_0x650a('0x37')]=qs[_0x650a('0x38')](_['pick'](_0x1c8621[_0x650a('0x2d')],_0x25a47c[_0x650a('0x38')]),_0x436e28);if(_0x1c8621[_0x650a('0x2d')]['filter']){_0x18c197['where']=_[_0x650a('0x39')](_0x18c197[_0x650a('0x37')],{'$or':_['map'](_0x436e28,function(_0x1acbe5){if(_0x1acbe5['type']!==_0x650a('0x3a')){var _0x39b00b={};_0x39b00b[_0x1acbe5[_0x650a('0x26')]]={'$like':'%'+_0x1c8621[_0x650a('0x2d')][_0x650a('0x3b')]+'%'};return _0x39b00b;}})});}_0x18c197=_['merge']({},_0x18c197,_0x1c8621[_0x650a('0x3c')]);var _0x5ba502={'where':_0x18c197[_0x650a('0x37')]};return db[_0x650a('0x3d')][_0x650a('0x1a')](_0x5ba502)[_0x650a('0x1f')](function(_0x1c5c6c){_0x3e15ba[_0x650a('0x1a')]=_0x1c5c6c;if(_0x1c8621[_0x650a('0x2d')]['includeAll']){_0x18c197['include']=[{'all':!![]}];}return db[_0x650a('0x3d')]['findAll'](_0x18c197);})['then'](function(_0x1e0868){_0x3e15ba['rows']=_0x1e0868;return _0x3e15ba;})[_0x650a('0x1f')](respondWithFilteredResult(_0x199c86,_0x18c197))['catch'](handleError(_0x199c86,null));};exports[_0x650a('0x3e')]=function(_0x9a53ec,_0x1855c9){var _0x233a5f={'raw':!![],'where':{'id':_0x9a53ec[_0x650a('0x3f')]['id']}},_0x409495={};_0x409495[_0x650a('0x2c')]=_[_0x650a('0x2e')](db[_0x650a('0x3d')][_0x650a('0x29')]);_0x409495[_0x650a('0x2d')]=_[_0x650a('0x2e')](_0x9a53ec['query']);_0x409495[_0x650a('0x38')]=_[_0x650a('0x30')](_0x409495[_0x650a('0x2c')],_0x409495[_0x650a('0x2d')]);_0x233a5f[_0x650a('0x2f')]=_[_0x650a('0x30')](_0x409495['model'],qs[_0x650a('0x31')](_0x9a53ec[_0x650a('0x2d')][_0x650a('0x31')]));_0x233a5f[_0x650a('0x2f')]=_0x233a5f[_0x650a('0x2f')][_0x650a('0x32')]?_0x233a5f['attributes']:_0x409495['model'];if(_0x9a53ec[_0x650a('0x2d')][_0x650a('0x40')]){_0x233a5f[_0x650a('0x41')]=[{'all':!![]}];}_0x233a5f=_['merge']({},_0x233a5f,_0x9a53ec[_0x650a('0x3c')]);return db['Tag'][_0x650a('0x42')](_0x233a5f)[_0x650a('0x1f')](handleEntityNotFound(_0x1855c9,null))['then'](respondWithResult(_0x1855c9,null))[_0x650a('0x43')](handleError(_0x1855c9,null));};exports[_0x650a('0x44')]=function(_0x39e8e6,_0x47ec0d){return db[_0x650a('0x3d')][_0x650a('0x44')](_0x39e8e6[_0x650a('0x45')],{})['then'](function(_0x17a40d){var _0x3f2151=_0x39e8e6[_0x650a('0x46')][_0x650a('0x21')]({'plain':!![]});if(!_0x3f2151)throw new Error(_0x650a('0x47'));if(_0x3f2151['role']==='user'){var _0x215f2e=_0x17a40d[_0x650a('0x21')]({'plain':!![]});var _0x5b2907=_0x650a('0x22');return db[_0x650a('0x48')][_0x650a('0x42')]({'where':{'name':_0x5b2907,'userProfileId':_0x3f2151[_0x650a('0x49')]},'raw':!![]})[_0x650a('0x1f')](function(_0x8bef2c){if(_0x8bef2c&&_0x8bef2c['autoAssociation']===0x0){return db[_0x650a('0x23')][_0x650a('0x44')]({'name':_0x215f2e[_0x650a('0x26')],'resourceId':_0x215f2e['id'],'type':_0x8bef2c[_0x650a('0x26')],'sectionId':_0x8bef2c['id']},{})[_0x650a('0x1f')](function(){return _0x17a40d;});}else{return _0x17a40d;}})['catch'](function(_0x45346f){logger[_0x650a('0x24')](_0x650a('0x4a'),_0x45346f);throw _0x45346f;});}return _0x17a40d;})[_0x650a('0x1f')](respondWithResult(_0x47ec0d,0xc9))['catch'](handleError(_0x47ec0d,null));};exports['update']=function(_0xd782e9,_0x225fd6){if(_0xd782e9['body']['id']){delete _0xd782e9[_0x650a('0x45')]['id'];}return db[_0x650a('0x3d')][_0x650a('0x42')]({'where':{'id':_0xd782e9[_0x650a('0x3f')]['id']}})[_0x650a('0x1f')](handleEntityNotFound(_0x225fd6,null))[_0x650a('0x1f')](saveUpdates(_0xd782e9[_0x650a('0x45')],null))[_0x650a('0x1f')](respondWithResult(_0x225fd6,null))[_0x650a('0x43')](handleError(_0x225fd6,null));};exports[_0x650a('0x20')]=function(_0x304e50,_0x15db69){return db[_0x650a('0x3d')][_0x650a('0x42')]({'where':{'id':_0x304e50[_0x650a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x15db69,null))['then'](removeEntity(_0x15db69,null))[_0x650a('0x43')](handleError(_0x15db69,null));}; \ No newline at end of file +var _0xb248=['keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','Tag','findAll','rows','catch','params','rawAttributes','includeAll','options','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','sendStatus','error','name','send','index','fieldName','type','key','model','map','query'];(function(_0x3b6128,_0x5a4a41){var _0x4254e8=function(_0x151397){while(--_0x151397){_0x3b6128['push'](_0x3b6128['shift']());}};_0x4254e8(++_0x5a4a41);}(_0xb248,0xc6));var _0x8b24=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xb248[_0x17b6e3];return _0x3906f3;};'use strict';var emlformat=require(_0x8b24('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b24('0x1'));var jsonpatch=require(_0x8b24('0x2'));var rp=require(_0x8b24('0x3'));var moment=require(_0x8b24('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8b24('0x5'));var util=require(_0x8b24('0x6'));var path=require('path');var sox=require(_0x8b24('0x7'));var csv=require(_0x8b24('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b24('0x9'));var _=require(_0x8b24('0xa'));var squel=require('squel');var crypto=require(_0x8b24('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8b24('0xc'));var toCsv=require(_0x8b24('0x8'));var querystring=require(_0x8b24('0xd'));var Papa=require('papaparse');var Redis=require(_0x8b24('0xe'));var authService=require(_0x8b24('0xf'));var qs=require(_0x8b24('0x10'));var as=require(_0x8b24('0x11'));var hardwareService=require(_0x8b24('0x12'));var logger=require(_0x8b24('0x13'))(_0x8b24('0x14'));var utils=require(_0x8b24('0x15'));var config=require(_0x8b24('0x16'));var licenseUtil=require(_0x8b24('0x17'));var db=require(_0x8b24('0x18'))['db'];function respondWithStatusCode(_0x3d3450,_0x40c1e6){_0x40c1e6=_0x40c1e6||0xcc;return function(_0x40ea49){if(_0x40ea49){return _0x3d3450['sendStatus'](_0x40c1e6);}return _0x3d3450['status'](_0x40c1e6)[_0x8b24('0x19')]();};}function respondWithResult(_0x4433c0,_0xf92148){_0xf92148=_0xf92148||0xc8;return function(_0x32a451){if(_0x32a451){return _0x4433c0[_0x8b24('0x1a')](_0xf92148)[_0x8b24('0x1b')](_0x32a451);}};}function respondWithFilteredResult(_0x11d2ee,_0x3cd934){return function(_0x4e66ae){if(_0x4e66ae){var _0x5a5745=typeof _0x3cd934['offset']===_0x8b24('0x1c')&&typeof _0x3cd934['limit']==='undefined';var _0xafc423=_0x4e66ae[_0x8b24('0x1d')];var _0x527af7=_0x5a5745?0x0:_0x3cd934[_0x8b24('0x1e')];var _0x5e3c52=_0x5a5745?_0x4e66ae[_0x8b24('0x1d')]:_0x3cd934['offset']+_0x3cd934[_0x8b24('0x1f')];var _0x521f5c;if(_0x5e3c52>=_0xafc423){_0x5e3c52=_0xafc423;_0x521f5c=0xc8;}else{_0x521f5c=0xce;}_0x11d2ee[_0x8b24('0x1a')](_0x521f5c);return _0x11d2ee[_0x8b24('0x20')](_0x8b24('0x21'),_0x527af7+'-'+_0x5e3c52+'/'+_0xafc423)[_0x8b24('0x1b')](_0x4e66ae);}return null;};}function patchUpdates(_0x2a4f2d){return function(_0x44aae9){try{jsonpatch[_0x8b24('0x22')](_0x44aae9,_0x2a4f2d,!![]);}catch(_0x5c9c38){return BPromise[_0x8b24('0x23')](_0x5c9c38);}return _0x44aae9[_0x8b24('0x24')]();};}function saveUpdates(_0x4fff3c,_0xd9b96){return function(_0x13dd68){if(_0x13dd68){return _0x13dd68[_0x8b24('0x25')](_0x4fff3c)[_0x8b24('0x26')](function(_0x12a9f4){return _0x12a9f4;});}return null;};}function removeEntity(_0x10b721,_0x347591){return function(_0x3fddf8){if(_0x3fddf8){return _0x3fddf8[_0x8b24('0x27')]()[_0x8b24('0x26')](function(){var _0x2dd44b=_0x3fddf8[_0x8b24('0x28')]({'plain':!![]});var _0x2cfb27=_0x8b24('0x29');return db[_0x8b24('0x2a')][_0x8b24('0x27')]({'where':{'type':_0x2cfb27,'resourceId':_0x2dd44b['id']}})[_0x8b24('0x26')](function(){return _0x3fddf8;});})[_0x8b24('0x26')](function(){_0x10b721[_0x8b24('0x1a')](0xcc)[_0x8b24('0x19')]();});}};}function handleEntityNotFound(_0x1adcb4,_0xa6f06b){return function(_0x2be377){if(!_0x2be377){_0x1adcb4[_0x8b24('0x2b')](0x194);}return _0x2be377;};}function handleError(_0x1934d2,_0x364f3a){_0x364f3a=_0x364f3a||0x1f4;return function(_0x267f1e){logger[_0x8b24('0x2c')](_0x267f1e['stack']);if(_0x267f1e[_0x8b24('0x2d')]){delete _0x267f1e[_0x8b24('0x2d')];}_0x1934d2[_0x8b24('0x1a')](_0x364f3a)[_0x8b24('0x2e')](_0x267f1e);};}exports[_0x8b24('0x2f')]=function(_0x25b664,_0x1ab949){var _0x4de1cf={},_0xa37fe3={},_0x28d351={'count':0x0,'rows':[]};var _0x2ff6d7=_['map'](db['Tag']['rawAttributes'],function(_0x27cc28){return{'name':_0x27cc28[_0x8b24('0x30')],'type':_0x27cc28[_0x8b24('0x31')][_0x8b24('0x32')]};});_0xa37fe3[_0x8b24('0x33')]=_[_0x8b24('0x34')](_0x2ff6d7,_0x8b24('0x2d'));_0xa37fe3[_0x8b24('0x35')]=_[_0x8b24('0x36')](_0x25b664['query']);_0xa37fe3[_0x8b24('0x37')]=_[_0x8b24('0x38')](_0xa37fe3[_0x8b24('0x33')],_0xa37fe3['query']);_0x4de1cf[_0x8b24('0x39')]=_[_0x8b24('0x38')](_0xa37fe3[_0x8b24('0x33')],qs[_0x8b24('0x3a')](_0x25b664[_0x8b24('0x35')][_0x8b24('0x3a')]));_0x4de1cf[_0x8b24('0x39')]=_0x4de1cf[_0x8b24('0x39')][_0x8b24('0x3b')]?_0x4de1cf['attributes']:_0xa37fe3[_0x8b24('0x33')];if(!_0x25b664[_0x8b24('0x35')]['hasOwnProperty'](_0x8b24('0x3c'))){_0x4de1cf[_0x8b24('0x1f')]=qs['limit'](_0x25b664[_0x8b24('0x35')][_0x8b24('0x1f')]);_0x4de1cf[_0x8b24('0x1e')]=qs[_0x8b24('0x1e')](_0x25b664['query'][_0x8b24('0x1e')]);}_0x4de1cf[_0x8b24('0x3d')]=qs[_0x8b24('0x3e')](_0x25b664[_0x8b24('0x35')][_0x8b24('0x3e')]);_0x4de1cf[_0x8b24('0x3f')]=qs['filters'](_[_0x8b24('0x40')](_0x25b664[_0x8b24('0x35')],_0xa37fe3[_0x8b24('0x37')]),_0x2ff6d7);if(_0x25b664[_0x8b24('0x35')][_0x8b24('0x41')]){_0x4de1cf[_0x8b24('0x3f')]=_[_0x8b24('0x42')](_0x4de1cf[_0x8b24('0x3f')],{'$or':_[_0x8b24('0x34')](_0x2ff6d7,function(_0x261e0f){if(_0x261e0f[_0x8b24('0x31')]!=='VIRTUAL'){var _0x1d319e={};_0x1d319e[_0x261e0f['name']]={'$like':'%'+_0x25b664[_0x8b24('0x35')][_0x8b24('0x41')]+'%'};return _0x1d319e;}})});}_0x4de1cf=_[_0x8b24('0x42')]({},_0x4de1cf,_0x25b664['options']);var _0x8a41d0={'where':_0x4de1cf[_0x8b24('0x3f')]};return db[_0x8b24('0x43')]['count'](_0x8a41d0)[_0x8b24('0x26')](function(_0x4f8da5){_0x28d351['count']=_0x4f8da5;if(_0x25b664[_0x8b24('0x35')]['includeAll']){_0x4de1cf['include']=[{'all':!![]}];}return db[_0x8b24('0x43')][_0x8b24('0x44')](_0x4de1cf);})[_0x8b24('0x26')](function(_0x3c6dc2){_0x28d351[_0x8b24('0x45')]=_0x3c6dc2;return _0x28d351;})[_0x8b24('0x26')](respondWithFilteredResult(_0x1ab949,_0x4de1cf))[_0x8b24('0x46')](handleError(_0x1ab949,null));};exports['show']=function(_0x58cd75,_0x39a9e8){var _0x38f78a={'raw':!![],'where':{'id':_0x58cd75[_0x8b24('0x47')]['id']}},_0x1752b0={};_0x1752b0['model']=_[_0x8b24('0x36')](db[_0x8b24('0x43')][_0x8b24('0x48')]);_0x1752b0['query']=_[_0x8b24('0x36')](_0x58cd75['query']);_0x1752b0[_0x8b24('0x37')]=_[_0x8b24('0x38')](_0x1752b0['model'],_0x1752b0[_0x8b24('0x35')]);_0x38f78a[_0x8b24('0x39')]=_[_0x8b24('0x38')](_0x1752b0[_0x8b24('0x33')],qs[_0x8b24('0x3a')](_0x58cd75[_0x8b24('0x35')][_0x8b24('0x3a')]));_0x38f78a[_0x8b24('0x39')]=_0x38f78a[_0x8b24('0x39')][_0x8b24('0x3b')]?_0x38f78a[_0x8b24('0x39')]:_0x1752b0[_0x8b24('0x33')];if(_0x58cd75['query'][_0x8b24('0x49')]){_0x38f78a['include']=[{'all':!![]}];}_0x38f78a=_[_0x8b24('0x42')]({},_0x38f78a,_0x58cd75[_0x8b24('0x4a')]);return db['Tag']['find'](_0x38f78a)[_0x8b24('0x26')](handleEntityNotFound(_0x39a9e8,null))[_0x8b24('0x26')](respondWithResult(_0x39a9e8,null))[_0x8b24('0x46')](handleError(_0x39a9e8,null));};exports[_0x8b24('0x4b')]=function(_0x407b2f,_0x22619e){return db[_0x8b24('0x43')][_0x8b24('0x4b')](_0x407b2f['body'],{})['then'](function(_0x4b274c){var _0x3cacf8=_0x407b2f['user'][_0x8b24('0x28')]({'plain':!![]});if(!_0x3cacf8)throw new Error(_0x8b24('0x4c'));if(_0x3cacf8[_0x8b24('0x4d')]===_0x8b24('0x4e')){var _0x58a26d=_0x4b274c[_0x8b24('0x28')]({'plain':!![]});var _0x3df397=_0x8b24('0x29');return db[_0x8b24('0x4f')][_0x8b24('0x50')]({'where':{'name':_0x3df397,'userProfileId':_0x3cacf8[_0x8b24('0x51')]},'raw':!![]})[_0x8b24('0x26')](function(_0x1c208f){if(_0x1c208f&&_0x1c208f[_0x8b24('0x52')]===0x0){return db[_0x8b24('0x2a')][_0x8b24('0x4b')]({'name':_0x58a26d[_0x8b24('0x2d')],'resourceId':_0x58a26d['id'],'type':_0x1c208f[_0x8b24('0x2d')],'sectionId':_0x1c208f['id']},{})[_0x8b24('0x26')](function(){return _0x4b274c;});}else{return _0x4b274c;}})[_0x8b24('0x46')](function(_0x19bf6f){logger[_0x8b24('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19bf6f);throw _0x19bf6f;});}return _0x4b274c;})[_0x8b24('0x26')](respondWithResult(_0x22619e,0xc9))[_0x8b24('0x46')](handleError(_0x22619e,null));};exports[_0x8b24('0x25')]=function(_0x3dcec6,_0x4bac9f){if(_0x3dcec6[_0x8b24('0x53')]['id']){delete _0x3dcec6[_0x8b24('0x53')]['id'];}return db[_0x8b24('0x43')][_0x8b24('0x50')]({'where':{'id':_0x3dcec6[_0x8b24('0x47')]['id']}})[_0x8b24('0x26')](handleEntityNotFound(_0x4bac9f,null))[_0x8b24('0x26')](saveUpdates(_0x3dcec6[_0x8b24('0x53')],null))[_0x8b24('0x26')](respondWithResult(_0x4bac9f,null))[_0x8b24('0x46')](handleError(_0x4bac9f,null));};exports[_0x8b24('0x27')]=function(_0x324222,_0x3ee4e2){return db[_0x8b24('0x43')][_0x8b24('0x50')]({'where':{'id':_0x324222[_0x8b24('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ee4e2,null))['then'](removeEntity(_0x3ee4e2,null))['catch'](handleError(_0x3ee4e2,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 4d07c11..49d0479 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 _0x6d26=['moment','bluebird','request-promise','path','./tag.attributes','exports','define','Tag','lodash','util','../../config/logger'];(function(_0x4aba15,_0x4e90aa){var _0x1c8122=function(_0x568dba){while(--_0x568dba){_0x4aba15['push'](_0x4aba15['shift']());}};_0x1c8122(++_0x4e90aa);}(_0x6d26,0x1e1));var _0x66d2=function(_0x41b324,_0x50622d){_0x41b324=_0x41b324-0x0;var _0x39b07e=_0x6d26[_0x41b324];return _0x39b07e;};'use strict';var _=require(_0x66d2('0x0'));var util=require(_0x66d2('0x1'));var logger=require(_0x66d2('0x2'))('api');var moment=require(_0x66d2('0x3'));var BPromise=require(_0x66d2('0x4'));var rp=require(_0x66d2('0x5'));var fs=require('fs');var path=require(_0x66d2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x66d2('0x7'));module[_0x66d2('0x8')]=function(_0x57c150,_0x410099){return _0x57c150[_0x66d2('0x9')](_0x66d2('0xa'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe50e=['request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','moment','bluebird'];(function(_0x150af2,_0x3dadbc){var _0x14961d=function(_0xfe44de){while(--_0xfe44de){_0x150af2['push'](_0x150af2['shift']());}};_0x14961d(++_0x3dadbc);}(_0xe50e,0xf9));var _0xee50=function(_0x3ffe5f,_0x2944ab){_0x3ffe5f=_0x3ffe5f-0x0;var _0x4adbdd=_0xe50e[_0x3ffe5f];return _0x4adbdd;};'use strict';var _=require(_0xee50('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xee50('0x1'));var BPromise=require(_0xee50('0x2'));var rp=require(_0xee50('0x3'));var fs=require('fs');var path=require(_0xee50('0x4'));var rimraf=require(_0xee50('0x5'));var config=require(_0xee50('0x6'));var attributes=require(_0xee50('0x7'));module[_0xee50('0x8')]=function(_0x3fe965,_0x3b0585){return _0x3fe965[_0xee50('0x9')](_0xee50('0xa'),attributes,{'tableName':_0xee50('0xb'),'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 f46cc72..ceb3e14 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 _0x4b19=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s'];(function(_0x429088,_0x436852){var _0x2a38eb=function(_0x263fc4){while(--_0x263fc4){_0x429088['push'](_0x429088['shift']());}};_0x2a38eb(++_0x436852);}(_0x4b19,0x195));var _0x94b1=function(_0x1df028,_0x1f0ac8){_0x1df028=_0x1df028-0x0;var _0x1fa40b=_0x4b19[_0x1df028];return _0x1fa40b;};'use strict';var _=require(_0x94b1('0x0'));var util=require('util');var moment=require(_0x94b1('0x1'));var BPromise=require(_0x94b1('0x2'));var rs=require(_0x94b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94b1('0x4'))['db'];var utils=require(_0x94b1('0x5'));var logger=require(_0x94b1('0x6'))('rpc');var config=require(_0x94b1('0x7'));var jayson=require(_0x94b1('0x8'));var client=jayson['client'][_0x94b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x110a52,_0x4ea1f9,_0x40c69c){return new BPromise(function(_0x201a02,_0xad0a85){return client['request'](_0x110a52,_0x40c69c)[_0x94b1('0xa')](function(_0x4f948b){logger['info'](_0x94b1('0xb'),_0x4ea1f9,_0x94b1('0xc'));logger[_0x94b1('0xd')](_0x94b1('0xe'),_0x4ea1f9,_0x94b1('0xc'),JSON[_0x94b1('0xf')](_0x4f948b));if(_0x4f948b['error']){if(_0x4f948b[_0x94b1('0x10')][_0x94b1('0x11')]===0x1f4){logger[_0x94b1('0x10')](_0x94b1('0xb'),_0x4ea1f9,_0x4f948b['error']['message']);return _0xad0a85(_0x4f948b[_0x94b1('0x10')][_0x94b1('0x12')]);}logger['error']('Tag,\x20%s,\x20%s',_0x4ea1f9,_0x4f948b[_0x94b1('0x10')][_0x94b1('0x12')]);return _0x201a02(_0x4f948b['error'][_0x94b1('0x12')]);}else{logger['info']('Tag,\x20%s,\x20%s',_0x4ea1f9,_0x94b1('0xc'));_0x201a02(_0x4f948b[_0x94b1('0x13')][_0x94b1('0x12')]);}})[_0x94b1('0x14')](function(_0x494138){logger[_0x94b1('0x10')](_0x94b1('0xb'),_0x4ea1f9,_0x494138);_0xad0a85(_0x494138);});});} \ No newline at end of file +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','Tag,\x20%s,\x20%s','message','catch','util'];(function(_0x2c68b8,_0x202e6a){var _0x14c7bf=function(_0x448186){while(--_0x448186){_0x2c68b8['push'](_0x2c68b8['shift']());}};_0x14c7bf(++_0x202e6a);}(_0xedd9,0xfc));var _0x9edd=function(_0x1cd85d,_0x539be1){_0x1cd85d=_0x1cd85d-0x0;var _0x49aa01=_0xedd9[_0x1cd85d];return _0x49aa01;};'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')]('Tag,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('Tag,\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 diff --git a/server/api/team/index.js b/server/api/team/index.js index f9fce4c..f71aade 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 f6e474f..147900b 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 _0xd8b0=['exports','sequelize'];(function(_0x2bc735,_0x2e5e62){var _0x171679=function(_0x55c3d0){while(--_0x55c3d0){_0x2bc735['push'](_0x2bc735['shift']());}};_0x171679(++_0x2e5e62);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x463769,_0x5f4720){var _0x5e8753=function(_0x28f004){while(--_0x28f004){_0x463769['push'](_0x463769['shift']());}};_0x5e8753(++_0x5f4720);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 2779cb0..d3abbad 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 _0x08d1=['count','set','Content-Range','apply','reject','then','sendStatus','error','stack','name','send','index','map','Team','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','params','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','catch','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','VoiceQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','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','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','findOne','channel','ValidationError','Unknown\x20channel','toLowerCase','capitalize','Queues','addQueues','add','removeQueues','remove','ids','addAgents','isArray','Voice','Chat','Mail','Fax','Openchannel','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','Queue:save','online','voicePause','isNil','interface','SIP/%s','all','TeamVoicePrefix','upsert','spread','removeAgents','Sms','emit','Queue:remove','UserVoiceQueueRt','getAgents','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','./team.socket','register','status','end','json','offset','undefined','limit'];(function(_0x2ec68b,_0xb19ce2){var _0x5b81fe=function(_0x69e9d7){while(--_0x69e9d7){_0x2ec68b['push'](_0x2ec68b['shift']());}};_0x5b81fe(++_0xb19ce2);}(_0x08d1,0x1af));var _0x108d=function(_0x2536b9,_0x3c672e){_0x2536b9=_0x2536b9-0x0;var _0x27a3c6=_0x08d1[_0x2536b9];return _0x27a3c6;};'use strict';var emlformat=require(_0x108d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x108d('0x1'));var jsonpatch=require(_0x108d('0x2'));var rp=require(_0x108d('0x3'));var moment=require(_0x108d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x108d('0x5'));var path=require(_0x108d('0x6'));var sox=require(_0x108d('0x7'));var csv=require('to-csv');var ejs=require(_0x108d('0x8'));var fs=require('fs');var fs_extra=require(_0x108d('0x9'));var _=require(_0x108d('0xa'));var squel=require(_0x108d('0xb'));var crypto=require(_0x108d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x108d('0xd'));var toCsv=require(_0x108d('0xe'));var querystring=require(_0x108d('0xf'));var Papa=require(_0x108d('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x108d('0x11'));var as=require(_0x108d('0x12'));var hardwareService=require(_0x108d('0x13'));var logger=require(_0x108d('0x14'))(_0x108d('0x15'));var utils=require(_0x108d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x108d('0x17'));var db=require(_0x108d('0x18'))['db'];config[_0x108d('0x19')]=_['defaults'](config[_0x108d('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x108d('0x19')]));require(_0x108d('0x1a'))[_0x108d('0x1b')](socket);function respondWithStatusCode(_0x5f57e2,_0x4472e4){_0x4472e4=_0x4472e4||0xcc;return function(_0x57a16e){if(_0x57a16e){return _0x5f57e2['sendStatus'](_0x4472e4);}return _0x5f57e2[_0x108d('0x1c')](_0x4472e4)[_0x108d('0x1d')]();};}function respondWithResult(_0x3cebc8,_0x1889c1){_0x1889c1=_0x1889c1||0xc8;return function(_0x2f26e7){if(_0x2f26e7){return _0x3cebc8[_0x108d('0x1c')](_0x1889c1)[_0x108d('0x1e')](_0x2f26e7);}};}function respondWithFilteredResult(_0x59fabd,_0x162b8b){return function(_0x29f7c2){if(_0x29f7c2){var _0x5aa7ca=typeof _0x162b8b[_0x108d('0x1f')]===_0x108d('0x20')&&typeof _0x162b8b[_0x108d('0x21')]===_0x108d('0x20');var _0x3340a0=_0x29f7c2[_0x108d('0x22')];var _0x213219=_0x5aa7ca?0x0:_0x162b8b[_0x108d('0x1f')];var _0x27d136=_0x5aa7ca?_0x29f7c2[_0x108d('0x22')]:_0x162b8b['offset']+_0x162b8b[_0x108d('0x21')];var _0x1ebde4;if(_0x27d136>=_0x3340a0){_0x27d136=_0x3340a0;_0x1ebde4=0xc8;}else{_0x1ebde4=0xce;}_0x59fabd[_0x108d('0x1c')](_0x1ebde4);return _0x59fabd[_0x108d('0x23')](_0x108d('0x24'),_0x213219+'-'+_0x27d136+'/'+_0x3340a0)[_0x108d('0x1e')](_0x29f7c2);}return null;};}function patchUpdates(_0x3666fd){return function(_0x5f4e27){try{jsonpatch[_0x108d('0x25')](_0x5f4e27,_0x3666fd,!![]);}catch(_0x3b7f75){return BPromise[_0x108d('0x26')](_0x3b7f75);}return _0x5f4e27['save']();};}function saveUpdates(_0x102ae7,_0x1bef95){return function(_0x3e3a15){if(_0x3e3a15){return _0x3e3a15['update'](_0x102ae7)[_0x108d('0x27')](function(_0x33e715){return _0x33e715;});}return null;};}function handleEntityNotFound(_0x29dcd9,_0xb98f65){return function(_0x56e356){if(!_0x56e356){_0x29dcd9[_0x108d('0x28')](0x194);}return _0x56e356;};}function handleError(_0x20893d,_0x270e02){_0x270e02=_0x270e02||0x1f4;return function(_0x3f6075){logger[_0x108d('0x29')](_0x3f6075[_0x108d('0x2a')]);if(_0x3f6075[_0x108d('0x2b')]){delete _0x3f6075['name'];}_0x20893d[_0x108d('0x1c')](_0x270e02)[_0x108d('0x2c')](_0x3f6075);};}exports[_0x108d('0x2d')]=function(_0xf02720,_0x2fe7ed){var _0x395e1c={},_0x47f1dc={},_0x42c0ec={'count':0x0,'rows':[]};var _0x4f7a8f=_[_0x108d('0x2e')](db[_0x108d('0x2f')][_0x108d('0x30')],function(_0x491ef6){return{'name':_0x491ef6[_0x108d('0x31')],'type':_0x491ef6['type'][_0x108d('0x32')]};});_0x47f1dc[_0x108d('0x33')]=_[_0x108d('0x2e')](_0x4f7a8f,'name');_0x47f1dc['query']=_[_0x108d('0x34')](_0xf02720[_0x108d('0x35')]);_0x47f1dc[_0x108d('0x36')]=_[_0x108d('0x37')](_0x47f1dc[_0x108d('0x33')],_0x47f1dc['query']);_0x395e1c[_0x108d('0x38')]=_[_0x108d('0x37')](_0x47f1dc[_0x108d('0x33')],qs[_0x108d('0x39')](_0xf02720['query']['fields']));_0x395e1c[_0x108d('0x38')]=_0x395e1c['attributes'][_0x108d('0x3a')]?_0x395e1c[_0x108d('0x38')]:_0x47f1dc[_0x108d('0x33')];if(!_0xf02720[_0x108d('0x35')]['hasOwnProperty']('nolimit')){_0x395e1c['limit']=qs[_0x108d('0x21')](_0xf02720[_0x108d('0x35')][_0x108d('0x21')]);_0x395e1c[_0x108d('0x1f')]=qs[_0x108d('0x1f')](_0xf02720[_0x108d('0x35')][_0x108d('0x1f')]);}_0x395e1c[_0x108d('0x3b')]=qs[_0x108d('0x3c')](_0xf02720[_0x108d('0x35')][_0x108d('0x3c')]);_0x395e1c[_0x108d('0x3d')]=qs[_0x108d('0x36')](_[_0x108d('0x3e')](_0xf02720[_0x108d('0x35')],_0x47f1dc[_0x108d('0x36')]),_0x4f7a8f);if(_0xf02720['query'][_0x108d('0x3f')]){_0x395e1c['where']=_['merge'](_0x395e1c['where'],{'$or':_[_0x108d('0x2e')](_0x4f7a8f,function(_0x129628){if(_0x129628[_0x108d('0x40')]!=='VIRTUAL'){var _0x21f48f={};_0x21f48f[_0x129628[_0x108d('0x2b')]]={'$like':'%'+_0xf02720[_0x108d('0x35')][_0x108d('0x3f')]+'%'};return _0x21f48f;}})});}_0x395e1c=_[_0x108d('0x41')]({},_0x395e1c,_0xf02720[_0x108d('0x42')]);var _0x44b1eb={'where':_0x395e1c[_0x108d('0x3d')]};return db[_0x108d('0x2f')]['count'](_0x44b1eb)[_0x108d('0x27')](function(_0x19b2c0){_0x42c0ec[_0x108d('0x22')]=_0x19b2c0;if(_0xf02720['query'][_0x108d('0x43')]){_0x395e1c[_0x108d('0x44')]=[{'all':!![]}];}return db[_0x108d('0x2f')][_0x108d('0x45')](_0x395e1c);})['then'](function(_0x3aad97){_0x42c0ec['rows']=_0x3aad97;return _0x42c0ec;})[_0x108d('0x27')](respondWithFilteredResult(_0x2fe7ed,_0x395e1c))['catch'](handleError(_0x2fe7ed,null));};exports['show']=function(_0x4e8370,_0x5ebb60){var _0x528c1a={'raw':![],'where':{'id':_0x4e8370[_0x108d('0x46')]['id']}},_0x59705f={};_0x59705f[_0x108d('0x33')]=_[_0x108d('0x34')](db[_0x108d('0x2f')]['rawAttributes']);_0x59705f[_0x108d('0x35')]=_[_0x108d('0x34')](_0x4e8370[_0x108d('0x35')]);_0x59705f[_0x108d('0x36')]=_[_0x108d('0x37')](_0x59705f[_0x108d('0x33')],_0x59705f['query']);_0x528c1a['attributes']=_[_0x108d('0x37')](_0x59705f[_0x108d('0x33')],qs['fields'](_0x4e8370['query']['fields']));_0x528c1a[_0x108d('0x38')]=_0x528c1a[_0x108d('0x38')]['length']?_0x528c1a[_0x108d('0x38')]:_0x59705f[_0x108d('0x33')];if(_0x4e8370[_0x108d('0x35')][_0x108d('0x43')]){_0x528c1a[_0x108d('0x44')]=[{'all':!![]}];}_0x528c1a=_[_0x108d('0x41')]({},_0x528c1a,_0x4e8370[_0x108d('0x42')]);return db[_0x108d('0x2f')][_0x108d('0x47')](_0x528c1a)[_0x108d('0x27')](handleEntityNotFound(_0x5ebb60,null))['then'](respondWithResult(_0x5ebb60,null))['catch'](handleError(_0x5ebb60,null));};exports['create']=function(_0x14eb63,_0x9edf96){return db[_0x108d('0x2f')]['create'](_0x14eb63['body'],{})['then'](function(_0x1d849e){var _0x1d6997=_0x14eb63[_0x108d('0x48')][_0x108d('0x49')]({'plain':!![]});if(!_0x1d6997)throw new Error(_0x108d('0x4a'));if(_0x1d6997[_0x108d('0x4b')]===_0x108d('0x48')){var _0x2d6d44=_0x1d849e[_0x108d('0x49')]({'plain':!![]});var _0x515334=_0x108d('0x4c');return db[_0x108d('0x4d')][_0x108d('0x47')]({'where':{'name':_0x515334,'userProfileId':_0x1d6997[_0x108d('0x4e')]},'raw':!![]})[_0x108d('0x27')](function(_0x235e86){if(_0x235e86&&_0x235e86[_0x108d('0x4f')]===0x0){return db[_0x108d('0x50')][_0x108d('0x51')]({'name':_0x2d6d44[_0x108d('0x2b')],'resourceId':_0x2d6d44['id'],'type':_0x235e86['name'],'sectionId':_0x235e86['id']},{})[_0x108d('0x27')](function(){return _0x1d849e;});}else{return _0x1d849e;}})['catch'](function(_0x4e48a2){logger[_0x108d('0x29')](_0x108d('0x52'),_0x4e48a2);throw _0x4e48a2;});}return _0x1d849e;})[_0x108d('0x27')](respondWithResult(_0x9edf96,0xc9))['catch'](handleError(_0x9edf96,null));};exports[_0x108d('0x53')]=function(_0x1cb799,_0x2a58ed){if(_0x1cb799['body']['id']){delete _0x1cb799['body']['id'];}return db['Team'][_0x108d('0x47')]({'where':{'id':_0x1cb799[_0x108d('0x46')]['id']}})[_0x108d('0x27')](handleEntityNotFound(_0x2a58ed,null))[_0x108d('0x27')](saveUpdates(_0x1cb799[_0x108d('0x54')],null))[_0x108d('0x27')](respondWithResult(_0x2a58ed,null))[_0x108d('0x55')](handleError(_0x2a58ed,null));};exports[_0x108d('0x56')]=function(_0x4fdf78,_0x239213){var _0x456694=_0x4fdf78['params']['id'];var _0x2b893f=[];return db[_0x108d('0x57')][_0x108d('0x58')](function(_0x50bebc){var _0x4018cd=_0x108d('0x59')+_0x456694;return db[_0x108d('0x57')]['query'](_0x4018cd,{'type':db[_0x108d('0x5a')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x50bebc})[_0x108d('0x27')](function(_0x5a8fcd){_0x2b893f=_['map'](_0x5a8fcd,function(_0x13b6d4){return Number(_0x13b6d4[_0x108d('0x5b')]);});})[_0x108d('0x27')](function(){var _0x589f83=_0x108d('0x5c')+_0x456694;return db[_0x108d('0x57')][_0x108d('0x35')](_0x589f83,{'type':db[_0x108d('0x5a')][_0x108d('0x5d')][_0x108d('0x5e')],'raw':!![],'transaction':_0x50bebc});})[_0x108d('0x27')](function(_0x2c8a2c){var _0x2be168=_['map'](_0x2c8a2c,function(_0x43beda){return Number(_0x43beda[_0x108d('0x5f')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x2b893f},'VoiceQueueId':{'$in':_0x2be168}},'transaction':_0x50bebc});})[_0x108d('0x27')](function(){var _0xd83932='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x456694;return db[_0x108d('0x57')][_0x108d('0x35')](_0xd83932,{'type':db['Sequelize']['QueryTypes'][_0x108d('0x5e')],'raw':!![],'transaction':_0x50bebc});})['then'](function(_0x3e0935){var _0x4ba397=_[_0x108d('0x2e')](_0x3e0935,function(_0xe0f268){return Number(_0xe0f268['MailQueueId']);});return db[_0x108d('0x60')][_0x108d('0x56')]({'where':{'UserId':{'$in':_0x2b893f},'MailQueueId':{'$in':_0x4ba397}},'transaction':_0x50bebc});})['then'](function(){var _0x100fe9=_0x108d('0x61')+_0x456694;return db[_0x108d('0x57')]['query'](_0x100fe9,{'type':db['Sequelize']['QueryTypes'][_0x108d('0x5e')],'raw':!![],'transaction':_0x50bebc});})['then'](function(_0x48682c){var _0x1d099f=_['map'](_0x48682c,function(_0x2bb3be){return Number(_0x2bb3be[_0x108d('0x62')]);});return db[_0x108d('0x63')]['destroy']({'where':{'UserId':{'$in':_0x2b893f},'SmsQueueId':{'$in':_0x1d099f}},'transaction':_0x50bebc});})[_0x108d('0x27')](function(){var _0x1f5ddc='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x456694;return db[_0x108d('0x57')][_0x108d('0x35')](_0x1f5ddc,{'type':db[_0x108d('0x5a')][_0x108d('0x5d')][_0x108d('0x5e')],'raw':!![],'transaction':_0x50bebc});})[_0x108d('0x27')](function(_0x387c4d){var _0x3b13f3=_[_0x108d('0x2e')](_0x387c4d,function(_0x50f188){return Number(_0x50f188[_0x108d('0x64')]);});return db[_0x108d('0x65')][_0x108d('0x56')]({'where':{'UserId':{'$in':_0x2b893f},'ChatQueueId':{'$in':_0x3b13f3}},'transaction':_0x50bebc});})[_0x108d('0x27')](function(){var _0x591f23='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x456694;return db[_0x108d('0x57')]['query'](_0x591f23,{'type':db[_0x108d('0x5a')][_0x108d('0x5d')][_0x108d('0x5e')],'raw':!![],'transaction':_0x50bebc});})[_0x108d('0x27')](function(_0x38b816){var _0x23a34c=_[_0x108d('0x2e')](_0x38b816,function(_0x1fd68e){return Number(_0x1fd68e[_0x108d('0x66')]);});return db[_0x108d('0x67')][_0x108d('0x56')]({'where':{'UserId':{'$in':_0x2b893f},'FaxQueueId':{'$in':_0x23a34c}},'transaction':_0x50bebc});})['then'](function(){var _0x2bbaed=_0x108d('0x68')+_0x456694;return db[_0x108d('0x57')][_0x108d('0x35')](_0x2bbaed,{'type':db[_0x108d('0x5a')][_0x108d('0x5d')][_0x108d('0x5e')],'raw':!![],'transaction':_0x50bebc});})[_0x108d('0x27')](function(_0x296bd6){var _0x163b42=_[_0x108d('0x2e')](_0x296bd6,function(_0x4fdd25){return Number(_0x4fdd25[_0x108d('0x69')]);});return db[_0x108d('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x2b893f},'OpenchannelQueueId':{'$in':_0x163b42}},'transaction':_0x50bebc});})[_0x108d('0x27')](function(){var _0x354d9f=_0x108d('0x6b')+_0x456694;return db[_0x108d('0x57')][_0x108d('0x35')](_0x354d9f,{'type':db[_0x108d('0x5a')][_0x108d('0x5d')][_0x108d('0x5e')],'raw':!![],'transaction':_0x50bebc});})['then'](function(_0x2b5f4f){var _0x3ebf99=_['map'](_0x2b5f4f,function(_0x3627d9){return Number(_0x3627d9[_0x108d('0x6c')]);});return db[_0x108d('0x6d')][_0x108d('0x56')]({'where':{'UserId':{'$in':_0x2b893f},'WhatsappQueueId':{'$in':_0x3ebf99}},'transaction':_0x50bebc});})[_0x108d('0x27')](function(){return db['TeamVoicePrefix'][_0x108d('0x47')]({'where':{'TeamId':_0x456694}});})[_0x108d('0x27')](function(_0x3def00){if(_0x3def00===null){return;}return db[_0x108d('0x6e')][_0x108d('0x56')]({'where':{'UserId':{'$in':_0x2b893f},'VoicePrefixId':_0x3def00[_0x108d('0x6f')]},'transaction':_0x50bebc});})[_0x108d('0x27')](function(){return db[_0x108d('0x2f')][_0x108d('0x56')]({'where':{'id':_0x456694},'cascade':!![],'transaction':_0x50bebc});})[_0x108d('0x27')](function(_0xb029a8){if(_0xb029a8===0x0){_0x239213['sendStatus'](0x194);}else{return db['UserProfileResource']['destroy']({'where':{'type':'Teams','resourceId':_0x456694},'cascade':!![],'transaction':_0x50bebc})[_0x108d('0x27')](function(){_0x239213[_0x108d('0x1c')](0xcc)[_0x108d('0x1d')]();});}})['catch'](function(_0x1b03e2){_0x239213[_0x108d('0x1c')](0x1f4)[_0x108d('0x2c')](_0x1b03e2);});});};exports['getQueues']=function(_0x38f576,_0x430c66,_0x1ef9dd){return db[_0x108d('0x2f')][_0x108d('0x70')]({'where':{'id':_0x38f576['params']['id']}})[_0x108d('0x27')](handleEntityNotFound(_0x430c66,null))['then'](function(_0x1c5533){if(!_0x38f576[_0x108d('0x35')][_0x108d('0x71')]||!utils['isValidChannel'](_0x38f576['query'][_0x108d('0x71')])){throw new db[(_0x108d('0x5a'))][(_0x108d('0x72'))](_0x108d('0x73'));}var _0x20b665={};var _0x510480={};_0x510480[_0x108d('0x33')]=_['keys'](db[_['capitalize'](_0x38f576[_0x108d('0x35')][_0x108d('0x71')][_0x108d('0x74')]())+'Queue']['rawAttributes']);_0x510480[_0x108d('0x35')]=_[_0x108d('0x34')](_0x38f576[_0x108d('0x35')]);_0x510480[_0x108d('0x36')]=_[_0x108d('0x37')](_0x510480[_0x108d('0x33')],_0x510480[_0x108d('0x35')]);_0x20b665[_0x108d('0x38')]=_[_0x108d('0x37')](_0x510480[_0x108d('0x33')],qs[_0x108d('0x39')](_0x38f576[_0x108d('0x35')]['fields']));_0x20b665[_0x108d('0x38')]=_0x20b665[_0x108d('0x38')][_0x108d('0x3a')]?_0x20b665['attributes']:_0x510480[_0x108d('0x33')];_0x20b665[_0x108d('0x21')]=qs['limit'](_0x38f576[_0x108d('0x35')]['limit']);_0x20b665[_0x108d('0x1f')]=qs[_0x108d('0x1f')](_0x38f576['query'][_0x108d('0x1f')]);_0x20b665[_0x108d('0x3b')]=qs[_0x108d('0x3c')](_0x38f576['query'][_0x108d('0x3c')]);_0x20b665[_0x108d('0x3d')]=qs[_0x108d('0x36')](_[_0x108d('0x3e')](_0x38f576[_0x108d('0x35')],_0x510480['filters']));_0x20b665=_['merge']({},_0x20b665,_0x38f576['options']);return _0x1c5533[_0x108d('0x49')+_[_0x108d('0x75')](_0x38f576['query'][_0x108d('0x71')][_0x108d('0x74')]())+_0x108d('0x76')](_0x20b665);})['then'](respondWithResult(_0x430c66,null))[_0x108d('0x55')](handleError(_0x430c66,null));};exports[_0x108d('0x77')]=function(_0x20b2a8,_0x1f769d,_0x5a50b5){return db['Team'][_0x108d('0x70')]({'where':{'id':_0x20b2a8['params']['id']}})[_0x108d('0x27')](function(_0xed6ee6){if(_0xed6ee6){if(!_0x20b2a8[_0x108d('0x54')][_0x108d('0x71')]||!utils['isValidChannel'](_0x20b2a8[_0x108d('0x54')][_0x108d('0x71')])){throw new db['Sequelize']['ValidationError'](_0x108d('0x73'));}return _0xed6ee6[_0x108d('0x78')+_[_0x108d('0x75')](_0x20b2a8[_0x108d('0x54')][_0x108d('0x71')][_0x108d('0x74')]())+_0x108d('0x76')](_0x20b2a8[_0x108d('0x54')]['ids']);}return null;})[_0x108d('0x27')](handleEntityNotFound(_0x1f769d,null))['then'](respondWithStatusCode(_0x1f769d,null))['catch'](handleError(_0x1f769d,null));};exports[_0x108d('0x79')]=function(_0x411e7d,_0x1e8ed0,_0x55c029){return db[_0x108d('0x2f')][_0x108d('0x70')]({'where':{'id':_0x411e7d[_0x108d('0x46')]['id']}})['then'](function(_0x3da93b){if(_0x3da93b){if(!_0x411e7d['query']['channel']||!utils['isValidChannel'](_0x411e7d[_0x108d('0x35')][_0x108d('0x71')])){throw new db['Sequelize']['ValidationError'](_0x108d('0x73'));}return _0x3da93b[_0x108d('0x7a')+_[_0x108d('0x75')](_0x411e7d['query'][_0x108d('0x71')][_0x108d('0x74')]())+_0x108d('0x76')](_0x411e7d[_0x108d('0x35')][_0x108d('0x7b')]);}return null;})[_0x108d('0x27')](handleEntityNotFound(_0x1e8ed0,null))['then'](respondWithStatusCode(_0x1e8ed0,null))[_0x108d('0x55')](handleError(_0x1e8ed0,null));};exports[_0x108d('0x7c')]=function(_0x2cda2a,_0x51602f){var _0x4fb75e=_[_0x108d('0x7d')](_0x2cda2a[_0x108d('0x54')]['ids'])?_0x2cda2a[_0x108d('0x54')][_0x108d('0x7b')]:[_0x2cda2a[_0x108d('0x54')][_0x108d('0x7b')]];var _0x23b434=_0x2cda2a[_0x108d('0x46')]['id'];return db[_0x108d('0x2f')][_0x108d('0x47')]({'where':{'id':_0x23b434}})[_0x108d('0x27')](handleEntityNotFound(_0x51602f,null))[_0x108d('0x27')](function(_0x44cc5e){if(_0x44cc5e){var _0x15071f=[_0x108d('0x7e'),_0x108d('0x7f'),_0x108d('0x80'),'Sms',_0x108d('0x81'),_0x108d('0x82'),_0x108d('0x83')];return db[_0x108d('0x57')][_0x108d('0x58')](function(_0x3491bd){var _0x4fdd4f=_[_0x108d('0x2e')](_0x15071f,function(_0x5287a7){var _0x33f11d={'attributes':['id','name']};if(_0x5287a7===_0x108d('0x7e')){_0x33f11d[_0x108d('0x84')]={'attributes':[_0x108d('0x85')]};}return _0x44cc5e['get'+_0x5287a7+_0x108d('0x76')](_0x33f11d)['then'](function(_0x42918f){var _0x277fd4=_[_0x108d('0x2e')](_0x42918f,function(_0xe9bbc9){var _0x36f5d0=_[_0x108d('0x2e')](_0x4fb75e,function(_0x46ee51){var _0x4b4a4e={'where':{'UserId':_0x46ee51,[_0x5287a7+_0x108d('0x86')]:_0xe9bbc9['id']},'transaction':_0x3491bd};if(_0x5287a7==='Voice'){_0x4b4a4e['defaults']={'penalty':_0xe9bbc9[_0x108d('0x87')][_0x108d('0x85')]};}return db[_0x108d('0x88')+_0x5287a7+'Queue'][_0x108d('0x89')](_0x4b4a4e)[_0x108d('0x27')](function(){socket['emit']('user'+_0x5287a7+_0x108d('0x8a'),{'UserId':_0x46ee51,[_0x5287a7+_0x108d('0x86')]:_0xe9bbc9['id']});if(_0x5287a7!==_0x108d('0x7e')){return;}return db[_0x108d('0x88')][_0x108d('0x45')]({'where':{'id':_0x4fb75e,'online':0x1},'attributes':['id','name',_0x108d('0x8b'),_0x108d('0x8c'),'interface'],'raw':!![]})[_0x108d('0x27')](function(_0x11ba87){var _0x4e1c45=_[_0x108d('0x2e')](_0x11ba87,function(_0x166367){return db['UserVoiceQueueRt']['upsert']({'membername':_0x166367[_0x108d('0x2b')],'UserId':_0x166367['id'],'queue_name':_0xe9bbc9[_0x108d('0x2b')],'VoiceQueueId':_0xe9bbc9['id'],'interface':_[_0x108d('0x8d')](_0x166367[_0x108d('0x8e')])?util['format'](_0x108d('0x8f'),_0x166367[_0x108d('0x2b')]):_0x166367[_0x108d('0x8e')],'paused':_0x166367[_0x108d('0x8c')]||![],'penalty':_0xe9bbc9[_0x108d('0x87')]['penalty']},{'transaction':_0x3491bd});});return Promise['all'](_0x4e1c45);});});});return Promise['all'](_0x36f5d0);});return Promise[_0x108d('0x90')](_0x277fd4);})[_0x108d('0x27')](function(){return db[_0x108d('0x91')]['findOne']({'where':{'teamId':_0x23b434}})[_0x108d('0x27')](function(_0x66904d){if(_0x66904d){var _0x1b8777=_[_0x108d('0x2e')](_0x4fb75e,function(_0x3eff4c){db[_0x108d('0x6e')][_0x108d('0x92')]({'UserId':_0x3eff4c,'VoicePrefixId':_0x66904d['VoicePrefixId']});});return Promise[_0x108d('0x90')](_0x1b8777);}});});});return Promise[_0x108d('0x90')](_0x4fdd4f)['then'](function(){return _0x44cc5e['addAgents'](_0x4fb75e,{'transaction':_0x3491bd})[_0x108d('0x93')](function(_0x39f7d5){return _0x39f7d5;});});});}})['then'](respondWithResult(_0x51602f,null))['catch'](handleError(_0x51602f,null));};exports[_0x108d('0x94')]=function(_0x2d21cc,_0x572811){var _0x2b7d51=_['isArray'](_0x2d21cc[_0x108d('0x35')][_0x108d('0x7b')])?_0x2d21cc[_0x108d('0x35')][_0x108d('0x7b')]:[_0x2d21cc['query'][_0x108d('0x7b')]];var _0x1f6eb8=_0x2d21cc[_0x108d('0x46')]['id'];return db[_0x108d('0x2f')]['find']({'where':{'id':_0x1f6eb8}})[_0x108d('0x27')](handleEntityNotFound(_0x572811,null))[_0x108d('0x27')](function(_0x1ab305){if(_0x1ab305){var _0x24619a=[_0x108d('0x7e'),'Chat','Mail',_0x108d('0x95'),'Fax',_0x108d('0x82'),_0x108d('0x83')];return db[_0x108d('0x57')][_0x108d('0x58')](function(_0x3fda4f){var _0x195abc=_[_0x108d('0x2e')](_0x24619a,function(_0xff650d){var _0x553aa2={'attributes':['id',_0x108d('0x2b')]};return _0x1ab305[_0x108d('0x49')+_0xff650d+_0x108d('0x76')](_0x553aa2)[_0x108d('0x27')](function(_0x4f3bf7){var _0x199071=_[_0x108d('0x2e')](_0x4f3bf7,function(_0x1d7a1d){return _0x1d7a1d[_0x108d('0x94')](_0x2b7d51,{'transaction':_0x3fda4f})[_0x108d('0x27')](function(){var _0x3b7d0b=_['map'](_0x2b7d51,function(_0x283686){socket[_0x108d('0x96')](_0x108d('0x48')+_0xff650d+_0x108d('0x97'),{'UserId':Number(_0x283686),[_0xff650d+'QueueId']:_0x1d7a1d['id']});if(_0xff650d!=='Voice'){return;}return db[_0x108d('0x98')][_0x108d('0x56')]({'where':{'VoiceQueueId':_0x1d7a1d['id'],'UserId':_0x283686},'transaction':_0x3fda4f});});return Promise['all'](_0x3b7d0b);});});return Promise[_0x108d('0x90')](_0x199071);});});return Promise[_0x108d('0x90')](_0x195abc)[_0x108d('0x27')](function(){return _0x1ab305[_0x108d('0x94')](_0x2b7d51,{'transaction':_0x3fda4f});})[_0x108d('0x27')](function(){return db[_0x108d('0x91')][_0x108d('0x70')]({'where':{'teamId':_0x1f6eb8}})[_0x108d('0x27')](function(_0x2dcd71){if(_0x2dcd71){var _0x2b4602=_[_0x108d('0x2e')](_0x2b7d51,function(_0x56b78a){db[_0x108d('0x6e')][_0x108d('0x56')]({'where':{'UserId':_0x56b78a,'VoicePrefixId':_0x2dcd71[_0x108d('0x6f')]}});});return Promise['all'](_0x2b4602);}});});});}})[_0x108d('0x27')](respondWithStatusCode(_0x572811,null))[_0x108d('0x55')](handleError(_0x572811,null));};exports['getAgents']=function(_0xbea05f,_0x2148d3,_0x56cfbc){var _0x5b26ed={};var _0x57d9ad={};var _0x4d5984;var _0x23ffce;return db[_0x108d('0x2f')][_0x108d('0x70')]({'where':{'id':_0xbea05f[_0x108d('0x46')]['id']}})[_0x108d('0x27')](handleEntityNotFound(_0x2148d3,null))[_0x108d('0x27')](function(_0x38c940){if(_0x38c940){_0x4d5984=_0x38c940;_0x57d9ad[_0x108d('0x33')]=_[_0x108d('0x34')](db['User'][_0x108d('0x30')]);_0x57d9ad[_0x108d('0x35')]=_[_0x108d('0x34')](_0xbea05f[_0x108d('0x35')]);_0x57d9ad[_0x108d('0x36')]=_['intersection'](_0x57d9ad['model'],_0x57d9ad['query']);_0x5b26ed['attributes']=_[_0x108d('0x37')](_0x57d9ad[_0x108d('0x33')],qs[_0x108d('0x39')](_0xbea05f[_0x108d('0x35')][_0x108d('0x39')]));_0x5b26ed[_0x108d('0x38')]=_0x5b26ed[_0x108d('0x38')][_0x108d('0x3a')]?_0x5b26ed[_0x108d('0x38')]:_0x57d9ad[_0x108d('0x33')];_0x5b26ed[_0x108d('0x3b')]=qs[_0x108d('0x3c')](_0xbea05f[_0x108d('0x35')][_0x108d('0x3c')]);_0x5b26ed[_0x108d('0x3d')]=qs['filters'](_['pick'](_0xbea05f[_0x108d('0x35')],_0x57d9ad[_0x108d('0x36')]));if(_0xbea05f[_0x108d('0x35')][_0x108d('0x3f')]){_0x5b26ed[_0x108d('0x3d')]=_[_0x108d('0x41')](_0x5b26ed[_0x108d('0x3d')],{'$or':_[_0x108d('0x2e')](_0x5b26ed[_0x108d('0x38')],function(_0x1e0477){var _0x28cf03={};_0x28cf03[_0x1e0477]={'$like':'%'+_0xbea05f[_0x108d('0x35')][_0x108d('0x3f')]+'%'};return _0x28cf03;})});}_0x5b26ed=_[_0x108d('0x41')]({},_0x5b26ed,_0xbea05f[_0x108d('0x42')]);return _0x4d5984[_0x108d('0x99')](_0x5b26ed);}})['then'](function(_0x286877){if(_0x286877){_0x23ffce=_0x286877['length'];if(!_0xbea05f[_0x108d('0x35')]['hasOwnProperty'](_0x108d('0x9a'))){_0x5b26ed['limit']=qs['limit'](_0xbea05f['query'][_0x108d('0x21')]);_0x5b26ed['offset']=qs[_0x108d('0x1f')](_0xbea05f['query'][_0x108d('0x1f')]);}return _0x4d5984[_0x108d('0x99')](_0x5b26ed);}})[_0x108d('0x27')](function(_0x4f81d7){if(_0x4f81d7){return _0x4f81d7?{'count':_0x23ffce,'rows':_0x4f81d7}:null;}})[_0x108d('0x27')](respondWithResult(_0x2148d3,null))[_0x108d('0x55')](handleError(_0x2148d3,null));}; \ No newline at end of file +var _0x52ab=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','filter','where','merge','map','VIRTUAL','options','include','rows','catch','show','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','params','sequelize','transaction','Sequelize','UserId','QueryTypes','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','MailQueueId','SmsQueueId','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','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','capitalize','toLowerCase','sort','addQueues','add','Queues','ids','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','through','penalty','QueueId','User','Queue','findOrCreate','emit','Queue:save','findAll','online','voicePause','interface','UserVoiceQueueRt','upsert','all','removeAgents','Openchannel','getAgents','nolimit','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2a7917,_0x5a4b5a){var _0x5bfa26=function(_0x39987e){while(--_0x39987e){_0x2a7917['push'](_0x2a7917['shift']());}};_0x5bfa26(++_0x5a4b5a);}(_0x52ab,0x113));var _0xb52a=function(_0x484e01,_0x177d93){_0x484e01=_0x484e01-0x0;var _0x2746d3=_0x52ab[_0x484e01];return _0x2746d3;};'use strict';var emlformat=require(_0xb52a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb52a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb52a('0x2'));var moment=require('moment');var BPromise=require(_0xb52a('0x3'));var Mustache=require(_0xb52a('0x4'));var util=require(_0xb52a('0x5'));var path=require(_0xb52a('0x6'));var sox=require(_0xb52a('0x7'));var csv=require('to-csv');var ejs=require(_0xb52a('0x8'));var fs=require('fs');var fs_extra=require(_0xb52a('0x9'));var _=require(_0xb52a('0xa'));var squel=require('squel');var crypto=require(_0xb52a('0xb'));var jsforce=require(_0xb52a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb52a('0xd'));var Papa=require(_0xb52a('0xe'));var Redis=require(_0xb52a('0xf'));var authService=require(_0xb52a('0x10'));var qs=require(_0xb52a('0x11'));var as=require(_0xb52a('0x12'));var hardwareService=require(_0xb52a('0x13'));var logger=require(_0xb52a('0x14'))(_0xb52a('0x15'));var utils=require(_0xb52a('0x16'));var config=require(_0xb52a('0x17'));var licenseUtil=require(_0xb52a('0x18'));var db=require(_0xb52a('0x19'))['db'];config[_0xb52a('0x1a')]=_[_0xb52a('0x1b')](config[_0xb52a('0x1a')],{'host':_0xb52a('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb52a('0x1a')]));require('./team.socket')[_0xb52a('0x1d')](socket);function respondWithStatusCode(_0x358a15,_0x4ad137){_0x4ad137=_0x4ad137||0xcc;return function(_0x21093a){if(_0x21093a){return _0x358a15[_0xb52a('0x1e')](_0x4ad137);}return _0x358a15[_0xb52a('0x1f')](_0x4ad137)[_0xb52a('0x20')]();};}function respondWithResult(_0x130d2e,_0x471314){_0x471314=_0x471314||0xc8;return function(_0x4f4e72){if(_0x4f4e72){return _0x130d2e[_0xb52a('0x1f')](_0x471314)[_0xb52a('0x21')](_0x4f4e72);}};}function respondWithFilteredResult(_0x260052,_0x24f9eb){return function(_0x2ce896){if(_0x2ce896){var _0x4e6f25=typeof _0x24f9eb[_0xb52a('0x22')]===_0xb52a('0x23')&&typeof _0x24f9eb[_0xb52a('0x24')]===_0xb52a('0x23');var _0x286168=_0x2ce896[_0xb52a('0x25')];var _0x3b9c2b=_0x4e6f25?0x0:_0x24f9eb[_0xb52a('0x22')];var _0x2b1977=_0x4e6f25?_0x2ce896[_0xb52a('0x25')]:_0x24f9eb[_0xb52a('0x22')]+_0x24f9eb['limit'];var _0x2c500e;if(_0x2b1977>=_0x286168){_0x2b1977=_0x286168;_0x2c500e=0xc8;}else{_0x2c500e=0xce;}_0x260052[_0xb52a('0x1f')](_0x2c500e);return _0x260052[_0xb52a('0x26')](_0xb52a('0x27'),_0x3b9c2b+'-'+_0x2b1977+'/'+_0x286168)[_0xb52a('0x21')](_0x2ce896);}return null;};}function patchUpdates(_0x48c1e8){return function(_0x5db94b){try{jsonpatch[_0xb52a('0x28')](_0x5db94b,_0x48c1e8,!![]);}catch(_0x21c049){return BPromise[_0xb52a('0x29')](_0x21c049);}return _0x5db94b[_0xb52a('0x2a')]();};}function saveUpdates(_0x56866c,_0x41ef2c){return function(_0x39ed4f){if(_0x39ed4f){return _0x39ed4f['update'](_0x56866c)[_0xb52a('0x2b')](function(_0x4a44a8){return _0x4a44a8;});}return null;};}function handleEntityNotFound(_0x5be38f,_0x2c3a55){return function(_0xca5333){if(!_0xca5333){_0x5be38f[_0xb52a('0x1e')](0x194);}return _0xca5333;};}function handleError(_0x3f87b7,_0x5a74d1){_0x5a74d1=_0x5a74d1||0x1f4;return function(_0x57bedb){logger[_0xb52a('0x2c')](_0x57bedb[_0xb52a('0x2d')]);if(_0x57bedb['name']){delete _0x57bedb[_0xb52a('0x2e')];}_0x3f87b7[_0xb52a('0x1f')](_0x5a74d1)[_0xb52a('0x2f')](_0x57bedb);};}exports['index']=function(_0x381dcb,_0x590668){var _0x12e0cf={},_0x509cb5={},_0x596a7a={'count':0x0,'rows':[]};var _0xa3df40=_['map'](db[_0xb52a('0x30')][_0xb52a('0x31')],function(_0xe06f83){return{'name':_0xe06f83[_0xb52a('0x32')],'type':_0xe06f83[_0xb52a('0x33')][_0xb52a('0x34')]};});_0x509cb5[_0xb52a('0x35')]=_['map'](_0xa3df40,'name');_0x509cb5[_0xb52a('0x36')]=_[_0xb52a('0x37')](_0x381dcb['query']);_0x509cb5[_0xb52a('0x38')]=_[_0xb52a('0x39')](_0x509cb5[_0xb52a('0x35')],_0x509cb5['query']);_0x12e0cf[_0xb52a('0x3a')]=_[_0xb52a('0x39')](_0x509cb5[_0xb52a('0x35')],qs[_0xb52a('0x3b')](_0x381dcb[_0xb52a('0x36')][_0xb52a('0x3b')]));_0x12e0cf[_0xb52a('0x3a')]=_0x12e0cf[_0xb52a('0x3a')][_0xb52a('0x3c')]?_0x12e0cf['attributes']:_0x509cb5[_0xb52a('0x35')];if(!_0x381dcb[_0xb52a('0x36')][_0xb52a('0x3d')]('nolimit')){_0x12e0cf[_0xb52a('0x24')]=qs[_0xb52a('0x24')](_0x381dcb['query'][_0xb52a('0x24')]);_0x12e0cf[_0xb52a('0x22')]=qs[_0xb52a('0x22')](_0x381dcb[_0xb52a('0x36')][_0xb52a('0x22')]);}_0x12e0cf[_0xb52a('0x3e')]=qs['sort'](_0x381dcb['query']['sort']);_0x12e0cf['where']=qs['filters'](_['pick'](_0x381dcb[_0xb52a('0x36')],_0x509cb5[_0xb52a('0x38')]),_0xa3df40);if(_0x381dcb[_0xb52a('0x36')][_0xb52a('0x3f')]){_0x12e0cf[_0xb52a('0x40')]=_[_0xb52a('0x41')](_0x12e0cf['where'],{'$or':_[_0xb52a('0x42')](_0xa3df40,function(_0x4739ec){if(_0x4739ec[_0xb52a('0x33')]!==_0xb52a('0x43')){var _0x577079={};_0x577079[_0x4739ec[_0xb52a('0x2e')]]={'$like':'%'+_0x381dcb['query'][_0xb52a('0x3f')]+'%'};return _0x577079;}})});}_0x12e0cf=_[_0xb52a('0x41')]({},_0x12e0cf,_0x381dcb[_0xb52a('0x44')]);var _0x44a79d={'where':_0x12e0cf['where']};return db[_0xb52a('0x30')][_0xb52a('0x25')](_0x44a79d)[_0xb52a('0x2b')](function(_0x4788bf){_0x596a7a['count']=_0x4788bf;if(_0x381dcb[_0xb52a('0x36')]['includeAll']){_0x12e0cf[_0xb52a('0x45')]=[{'all':!![]}];}return db[_0xb52a('0x30')]['findAll'](_0x12e0cf);})[_0xb52a('0x2b')](function(_0x16fb3d){_0x596a7a[_0xb52a('0x46')]=_0x16fb3d;return _0x596a7a;})[_0xb52a('0x2b')](respondWithFilteredResult(_0x590668,_0x12e0cf))[_0xb52a('0x47')](handleError(_0x590668,null));};exports[_0xb52a('0x48')]=function(_0x293431,_0x53684f){var _0x2569a5={'raw':![],'where':{'id':_0x293431['params']['id']}},_0x127ef7={};_0x127ef7[_0xb52a('0x35')]=_[_0xb52a('0x37')](db[_0xb52a('0x30')]['rawAttributes']);_0x127ef7[_0xb52a('0x36')]=_[_0xb52a('0x37')](_0x293431[_0xb52a('0x36')]);_0x127ef7['filters']=_[_0xb52a('0x39')](_0x127ef7[_0xb52a('0x35')],_0x127ef7[_0xb52a('0x36')]);_0x2569a5[_0xb52a('0x3a')]=_[_0xb52a('0x39')](_0x127ef7[_0xb52a('0x35')],qs[_0xb52a('0x3b')](_0x293431[_0xb52a('0x36')][_0xb52a('0x3b')]));_0x2569a5[_0xb52a('0x3a')]=_0x2569a5['attributes'][_0xb52a('0x3c')]?_0x2569a5[_0xb52a('0x3a')]:_0x127ef7[_0xb52a('0x35')];if(_0x293431[_0xb52a('0x36')][_0xb52a('0x49')]){_0x2569a5['include']=[{'all':!![]}];}_0x2569a5=_['merge']({},_0x2569a5,_0x293431[_0xb52a('0x44')]);return db[_0xb52a('0x30')]['find'](_0x2569a5)[_0xb52a('0x2b')](handleEntityNotFound(_0x53684f,null))[_0xb52a('0x2b')](respondWithResult(_0x53684f,null))[_0xb52a('0x47')](handleError(_0x53684f,null));};exports[_0xb52a('0x4a')]=function(_0x66afe1,_0x15736e){return db[_0xb52a('0x30')][_0xb52a('0x4a')](_0x66afe1[_0xb52a('0x4b')],{})[_0xb52a('0x2b')](function(_0x1f51b9){var _0x2599b9=_0x66afe1[_0xb52a('0x4c')][_0xb52a('0x4d')]({'plain':!![]});if(!_0x2599b9)throw new Error(_0xb52a('0x4e'));if(_0x2599b9[_0xb52a('0x4f')]===_0xb52a('0x4c')){var _0x353f38=_0x1f51b9[_0xb52a('0x4d')]({'plain':!![]});var _0x1cebcd=_0xb52a('0x50');return db['UserProfileSection'][_0xb52a('0x51')]({'where':{'name':_0x1cebcd,'userProfileId':_0x2599b9[_0xb52a('0x52')]},'raw':!![]})['then'](function(_0x2b27ef){if(_0x2b27ef&&_0x2b27ef['autoAssociation']===0x0){return db[_0xb52a('0x53')][_0xb52a('0x4a')]({'name':_0x353f38[_0xb52a('0x2e')],'resourceId':_0x353f38['id'],'type':_0x2b27ef[_0xb52a('0x2e')],'sectionId':_0x2b27ef['id']},{})[_0xb52a('0x2b')](function(){return _0x1f51b9;});}else{return _0x1f51b9;}})[_0xb52a('0x47')](function(_0x1688e2){logger[_0xb52a('0x2c')](_0xb52a('0x54'),_0x1688e2);throw _0x1688e2;});}return _0x1f51b9;})[_0xb52a('0x2b')](respondWithResult(_0x15736e,0xc9))[_0xb52a('0x47')](handleError(_0x15736e,null));};exports['update']=function(_0x2b98b6,_0x13fc94){if(_0x2b98b6[_0xb52a('0x4b')]['id']){delete _0x2b98b6[_0xb52a('0x4b')]['id'];}return db[_0xb52a('0x30')][_0xb52a('0x51')]({'where':{'id':_0x2b98b6['params']['id']}})[_0xb52a('0x2b')](handleEntityNotFound(_0x13fc94,null))[_0xb52a('0x2b')](saveUpdates(_0x2b98b6[_0xb52a('0x4b')],null))['then'](respondWithResult(_0x13fc94,null))[_0xb52a('0x47')](handleError(_0x13fc94,null));};exports[_0xb52a('0x55')]=function(_0x2151be,_0x5c3a42){var _0x1d365d=_0x2151be[_0xb52a('0x56')]['id'];var _0x5dde9d=[];return db[_0xb52a('0x57')][_0xb52a('0x58')](function(_0x266106){var _0x31e0ef='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x1d365d;return db[_0xb52a('0x57')][_0xb52a('0x36')](_0x31e0ef,{'type':db[_0xb52a('0x59')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x266106})[_0xb52a('0x2b')](function(_0x10d641){_0x5dde9d=_[_0xb52a('0x42')](_0x10d641,function(_0x2535d2){return Number(_0x2535d2[_0xb52a('0x5a')]);});})[_0xb52a('0x2b')](function(){var _0x274490='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1d365d;return db['sequelize'][_0xb52a('0x36')](_0x274490,{'type':db[_0xb52a('0x59')][_0xb52a('0x5b')]['SELECT'],'raw':!![],'transaction':_0x266106});})[_0xb52a('0x2b')](function(_0x471829){var _0x5d7787=_[_0xb52a('0x42')](_0x471829,function(_0x285720){return Number(_0x285720[_0xb52a('0x5c')]);});return db[_0xb52a('0x5d')][_0xb52a('0x55')]({'where':{'UserId':{'$in':_0x5dde9d},'VoiceQueueId':{'$in':_0x5d7787}},'transaction':_0x266106});})[_0xb52a('0x2b')](function(){var _0x5d498b=_0xb52a('0x5e')+_0x1d365d;return db['sequelize'][_0xb52a('0x36')](_0x5d498b,{'type':db[_0xb52a('0x59')][_0xb52a('0x5b')][_0xb52a('0x5f')],'raw':!![],'transaction':_0x266106});})[_0xb52a('0x2b')](function(_0x1ab487){var _0x1e401b=_[_0xb52a('0x42')](_0x1ab487,function(_0x3a9aba){return Number(_0x3a9aba[_0xb52a('0x60')]);});return db['UserMailQueue']['destroy']({'where':{'UserId':{'$in':_0x5dde9d},'MailQueueId':{'$in':_0x1e401b}},'transaction':_0x266106});})[_0xb52a('0x2b')](function(){var _0x1aeb7f='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1d365d;return db['sequelize'][_0xb52a('0x36')](_0x1aeb7f,{'type':db[_0xb52a('0x59')]['QueryTypes'][_0xb52a('0x5f')],'raw':!![],'transaction':_0x266106});})[_0xb52a('0x2b')](function(_0x47249f){var _0x3e4427=_[_0xb52a('0x42')](_0x47249f,function(_0x35b311){return Number(_0x35b311[_0xb52a('0x61')]);});return db['UserSmsQueue'][_0xb52a('0x55')]({'where':{'UserId':{'$in':_0x5dde9d},'SmsQueueId':{'$in':_0x3e4427}},'transaction':_0x266106});})[_0xb52a('0x2b')](function(){var _0x398485=_0xb52a('0x62')+_0x1d365d;return db['sequelize'][_0xb52a('0x36')](_0x398485,{'type':db[_0xb52a('0x59')]['QueryTypes'][_0xb52a('0x5f')],'raw':!![],'transaction':_0x266106});})[_0xb52a('0x2b')](function(_0x4f64a0){var _0x516098=_[_0xb52a('0x42')](_0x4f64a0,function(_0x24b88f){return Number(_0x24b88f[_0xb52a('0x63')]);});return db[_0xb52a('0x64')][_0xb52a('0x55')]({'where':{'UserId':{'$in':_0x5dde9d},'ChatQueueId':{'$in':_0x516098}},'transaction':_0x266106});})[_0xb52a('0x2b')](function(){var _0x229524='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1d365d;return db['sequelize'][_0xb52a('0x36')](_0x229524,{'type':db[_0xb52a('0x59')][_0xb52a('0x5b')][_0xb52a('0x5f')],'raw':!![],'transaction':_0x266106});})[_0xb52a('0x2b')](function(_0x4782da){var _0x5019d7=_['map'](_0x4782da,function(_0x3ebfc0){return Number(_0x3ebfc0[_0xb52a('0x65')]);});return db[_0xb52a('0x66')][_0xb52a('0x55')]({'where':{'UserId':{'$in':_0x5dde9d},'FaxQueueId':{'$in':_0x5019d7}},'transaction':_0x266106});})[_0xb52a('0x2b')](function(){var _0x19bf02=_0xb52a('0x67')+_0x1d365d;return db[_0xb52a('0x57')][_0xb52a('0x36')](_0x19bf02,{'type':db['Sequelize']['QueryTypes'][_0xb52a('0x5f')],'raw':!![],'transaction':_0x266106});})[_0xb52a('0x2b')](function(_0x439b20){var _0x1b2e6c=_[_0xb52a('0x42')](_0x439b20,function(_0x4a1cb7){return Number(_0x4a1cb7[_0xb52a('0x68')]);});return db['UserOpenchannelQueue'][_0xb52a('0x55')]({'where':{'UserId':{'$in':_0x5dde9d},'OpenchannelQueueId':{'$in':_0x1b2e6c}},'transaction':_0x266106});})[_0xb52a('0x2b')](function(){var _0xb30da1='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1d365d;return db[_0xb52a('0x57')]['query'](_0xb30da1,{'type':db[_0xb52a('0x59')][_0xb52a('0x5b')][_0xb52a('0x5f')],'raw':!![],'transaction':_0x266106});})[_0xb52a('0x2b')](function(_0x5b5927){var _0x57e4f4=_[_0xb52a('0x42')](_0x5b5927,function(_0x1053e5){return Number(_0x1053e5[_0xb52a('0x69')]);});return db[_0xb52a('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x5dde9d},'WhatsappQueueId':{'$in':_0x57e4f4}},'transaction':_0x266106});})['then'](function(){return db[_0xb52a('0x6b')]['find']({'where':{'TeamId':_0x1d365d}});})[_0xb52a('0x2b')](function(_0x3db747){if(_0x3db747===null){return;}return db[_0xb52a('0x6c')][_0xb52a('0x55')]({'where':{'UserId':{'$in':_0x5dde9d},'VoicePrefixId':_0x3db747[_0xb52a('0x6d')]},'transaction':_0x266106});})[_0xb52a('0x2b')](function(){return db['Team'][_0xb52a('0x55')]({'where':{'id':_0x1d365d},'cascade':!![],'transaction':_0x266106});})[_0xb52a('0x2b')](function(_0xe0ca9c){if(_0xe0ca9c===0x0){_0x5c3a42[_0xb52a('0x1e')](0x194);}else{return db['UserProfileResource']['destroy']({'where':{'type':_0xb52a('0x50'),'resourceId':_0x1d365d},'cascade':!![],'transaction':_0x266106})[_0xb52a('0x2b')](function(){_0x5c3a42[_0xb52a('0x1f')](0xcc)[_0xb52a('0x20')]();});}})['catch'](function(_0x5edd45){_0x5c3a42[_0xb52a('0x1f')](0x1f4)[_0xb52a('0x2f')](_0x5edd45);});});};exports[_0xb52a('0x6e')]=function(_0x54d823,_0x10d145,_0x59ef8b){return db[_0xb52a('0x30')][_0xb52a('0x6f')]({'where':{'id':_0x54d823[_0xb52a('0x56')]['id']}})[_0xb52a('0x2b')](handleEntityNotFound(_0x10d145,null))[_0xb52a('0x2b')](function(_0x4d50e1){if(!_0x54d823['query'][_0xb52a('0x70')]||!utils[_0xb52a('0x71')](_0x54d823[_0xb52a('0x36')][_0xb52a('0x70')])){throw new db['Sequelize'][(_0xb52a('0x72'))]('Unknown\x20channel');}var _0x3a4ff7={};var _0x2b3b4b={};_0x2b3b4b[_0xb52a('0x35')]=_['keys'](db[_[_0xb52a('0x73')](_0x54d823[_0xb52a('0x36')][_0xb52a('0x70')][_0xb52a('0x74')]())+'Queue'][_0xb52a('0x31')]);_0x2b3b4b[_0xb52a('0x36')]=_[_0xb52a('0x37')](_0x54d823[_0xb52a('0x36')]);_0x2b3b4b[_0xb52a('0x38')]=_[_0xb52a('0x39')](_0x2b3b4b[_0xb52a('0x35')],_0x2b3b4b['query']);_0x3a4ff7[_0xb52a('0x3a')]=_[_0xb52a('0x39')](_0x2b3b4b[_0xb52a('0x35')],qs[_0xb52a('0x3b')](_0x54d823[_0xb52a('0x36')][_0xb52a('0x3b')]));_0x3a4ff7[_0xb52a('0x3a')]=_0x3a4ff7[_0xb52a('0x3a')][_0xb52a('0x3c')]?_0x3a4ff7[_0xb52a('0x3a')]:_0x2b3b4b[_0xb52a('0x35')];_0x3a4ff7[_0xb52a('0x24')]=qs[_0xb52a('0x24')](_0x54d823[_0xb52a('0x36')][_0xb52a('0x24')]);_0x3a4ff7[_0xb52a('0x22')]=qs['offset'](_0x54d823[_0xb52a('0x36')][_0xb52a('0x22')]);_0x3a4ff7['order']=qs[_0xb52a('0x75')](_0x54d823[_0xb52a('0x36')][_0xb52a('0x75')]);_0x3a4ff7['where']=qs['filters'](_['pick'](_0x54d823[_0xb52a('0x36')],_0x2b3b4b[_0xb52a('0x38')]));_0x3a4ff7=_['merge']({},_0x3a4ff7,_0x54d823[_0xb52a('0x44')]);return _0x4d50e1[_0xb52a('0x4d')+_[_0xb52a('0x73')](_0x54d823[_0xb52a('0x36')][_0xb52a('0x70')][_0xb52a('0x74')]())+'Queues'](_0x3a4ff7);})[_0xb52a('0x2b')](respondWithResult(_0x10d145,null))[_0xb52a('0x47')](handleError(_0x10d145,null));};exports[_0xb52a('0x76')]=function(_0x2c0fa1,_0x45732c,_0x4d25c3){return db[_0xb52a('0x30')][_0xb52a('0x6f')]({'where':{'id':_0x2c0fa1[_0xb52a('0x56')]['id']}})[_0xb52a('0x2b')](function(_0x2fe77b){if(_0x2fe77b){if(!_0x2c0fa1[_0xb52a('0x4b')][_0xb52a('0x70')]||!utils[_0xb52a('0x71')](_0x2c0fa1[_0xb52a('0x4b')][_0xb52a('0x70')])){throw new db[(_0xb52a('0x59'))][(_0xb52a('0x72'))]('Unknown\x20channel');}return _0x2fe77b[_0xb52a('0x77')+_[_0xb52a('0x73')](_0x2c0fa1[_0xb52a('0x4b')][_0xb52a('0x70')]['toLowerCase']())+_0xb52a('0x78')](_0x2c0fa1[_0xb52a('0x4b')][_0xb52a('0x79')]);}return null;})[_0xb52a('0x2b')](handleEntityNotFound(_0x45732c,null))['then'](respondWithStatusCode(_0x45732c,null))[_0xb52a('0x47')](handleError(_0x45732c,null));};exports['removeQueues']=function(_0x192fa7,_0x2e4e20,_0x16ceba){return db['Team'][_0xb52a('0x6f')]({'where':{'id':_0x192fa7['params']['id']}})['then'](function(_0x5939bf){if(_0x5939bf){if(!_0x192fa7[_0xb52a('0x36')]['channel']||!utils[_0xb52a('0x71')](_0x192fa7['query'][_0xb52a('0x70')])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0x5939bf[_0xb52a('0x7a')+_[_0xb52a('0x73')](_0x192fa7[_0xb52a('0x36')]['channel'][_0xb52a('0x74')]())+_0xb52a('0x78')](_0x192fa7[_0xb52a('0x36')][_0xb52a('0x79')]);}return null;})[_0xb52a('0x2b')](handleEntityNotFound(_0x2e4e20,null))[_0xb52a('0x2b')](respondWithStatusCode(_0x2e4e20,null))[_0xb52a('0x47')](handleError(_0x2e4e20,null));};exports[_0xb52a('0x7b')]=function(_0x4f7170,_0x2e8628){var _0x42e547=_[_0xb52a('0x7c')](_0x4f7170['body'][_0xb52a('0x79')])?_0x4f7170[_0xb52a('0x4b')][_0xb52a('0x79')]:[_0x4f7170['body'][_0xb52a('0x79')]];var _0x4fb67a=_0x4f7170['params']['id'];return db[_0xb52a('0x30')][_0xb52a('0x51')]({'where':{'id':_0x4fb67a}})[_0xb52a('0x2b')](handleEntityNotFound(_0x2e8628,null))[_0xb52a('0x2b')](function(_0x39965b){if(_0x39965b){var _0x513ff2=[_0xb52a('0x7d'),_0xb52a('0x7e'),_0xb52a('0x7f'),_0xb52a('0x80'),_0xb52a('0x81'),'Openchannel','Whatsapp'];return db[_0xb52a('0x57')]['transaction'](function(_0x2ba03e){var _0x1296be=_[_0xb52a('0x42')](_0x513ff2,function(_0x3a78e8){var _0x55b61c={'attributes':['id',_0xb52a('0x2e')]};if(_0x3a78e8===_0xb52a('0x7d')){_0x55b61c[_0xb52a('0x82')]={'attributes':[_0xb52a('0x83')]};}return _0x39965b['get'+_0x3a78e8+_0xb52a('0x78')](_0x55b61c)[_0xb52a('0x2b')](function(_0x1d9425){var _0x250cac=_['map'](_0x1d9425,function(_0x4e68ff){var _0x1b77c1=_[_0xb52a('0x42')](_0x42e547,function(_0x3ef03d){var _0x54a58d={'where':{'UserId':_0x3ef03d,[_0x3a78e8+_0xb52a('0x84')]:_0x4e68ff['id']},'transaction':_0x2ba03e};if(_0x3a78e8===_0xb52a('0x7d')){_0x54a58d[_0xb52a('0x1b')]={'penalty':_0x4e68ff['TeamVoiceQueue'][_0xb52a('0x83')]};}return db[_0xb52a('0x85')+_0x3a78e8+_0xb52a('0x86')][_0xb52a('0x87')](_0x54a58d)['then'](function(){socket[_0xb52a('0x88')](_0xb52a('0x4c')+_0x3a78e8+_0xb52a('0x89'),{'UserId':_0x3ef03d,[_0x3a78e8+_0xb52a('0x84')]:_0x4e68ff['id']});if(_0x3a78e8!=='Voice'){return;}return db[_0xb52a('0x85')][_0xb52a('0x8a')]({'where':{'id':_0x42e547,'online':0x1},'attributes':['id',_0xb52a('0x2e'),_0xb52a('0x8b'),_0xb52a('0x8c'),_0xb52a('0x8d')],'raw':!![]})[_0xb52a('0x2b')](function(_0x2ef232){var _0x5ba662=_[_0xb52a('0x42')](_0x2ef232,function(_0x3d1400){return db[_0xb52a('0x8e')][_0xb52a('0x8f')]({'membername':_0x3d1400['name'],'UserId':_0x3d1400['id'],'queue_name':_0x4e68ff['name'],'VoiceQueueId':_0x4e68ff['id'],'interface':_['isNil'](_0x3d1400[_0xb52a('0x8d')])?util['format']('SIP/%s',_0x3d1400['name']):_0x3d1400[_0xb52a('0x8d')],'paused':_0x3d1400['voicePause']||![],'penalty':_0x4e68ff['TeamVoiceQueue'][_0xb52a('0x83')]},{'transaction':_0x2ba03e});});return Promise[_0xb52a('0x90')](_0x5ba662);});});});return Promise[_0xb52a('0x90')](_0x1b77c1);});return Promise['all'](_0x250cac);})[_0xb52a('0x2b')](function(){return db[_0xb52a('0x6b')][_0xb52a('0x6f')]({'where':{'teamId':_0x4fb67a}})[_0xb52a('0x2b')](function(_0x2c7c10){if(_0x2c7c10){var _0x5668c4=_['map'](_0x42e547,function(_0x550298){db[_0xb52a('0x6c')]['upsert']({'UserId':_0x550298,'VoicePrefixId':_0x2c7c10[_0xb52a('0x6d')]});});return Promise[_0xb52a('0x90')](_0x5668c4);}});});});return Promise[_0xb52a('0x90')](_0x1296be)['then'](function(){return _0x39965b[_0xb52a('0x7b')](_0x42e547,{'transaction':_0x2ba03e})['spread'](function(_0x56ce8b){return _0x56ce8b;});});});}})[_0xb52a('0x2b')](respondWithResult(_0x2e8628,null))['catch'](handleError(_0x2e8628,null));};exports[_0xb52a('0x91')]=function(_0x44ca7e,_0x52caa0){var _0x35b92d=_[_0xb52a('0x7c')](_0x44ca7e[_0xb52a('0x36')][_0xb52a('0x79')])?_0x44ca7e[_0xb52a('0x36')]['ids']:[_0x44ca7e[_0xb52a('0x36')][_0xb52a('0x79')]];var _0x155651=_0x44ca7e['params']['id'];return db['Team'][_0xb52a('0x51')]({'where':{'id':_0x155651}})[_0xb52a('0x2b')](handleEntityNotFound(_0x52caa0,null))['then'](function(_0x1ddaa5){if(_0x1ddaa5){var _0x43909a=[_0xb52a('0x7d'),_0xb52a('0x7e'),_0xb52a('0x7f'),'Sms',_0xb52a('0x81'),_0xb52a('0x92'),'Whatsapp'];return db['sequelize']['transaction'](function(_0x5d9718){var _0x31d72f=_[_0xb52a('0x42')](_0x43909a,function(_0x5874bd){var _0x4bfe95={'attributes':['id',_0xb52a('0x2e')]};return _0x1ddaa5[_0xb52a('0x4d')+_0x5874bd+_0xb52a('0x78')](_0x4bfe95)[_0xb52a('0x2b')](function(_0x4df53f){var _0x4a48fc=_[_0xb52a('0x42')](_0x4df53f,function(_0x111ff6){return _0x111ff6[_0xb52a('0x91')](_0x35b92d,{'transaction':_0x5d9718})['then'](function(){var _0x3eae19=_[_0xb52a('0x42')](_0x35b92d,function(_0x1453e4){socket[_0xb52a('0x88')](_0xb52a('0x4c')+_0x5874bd+'Queue:remove',{'UserId':Number(_0x1453e4),[_0x5874bd+_0xb52a('0x84')]:_0x111ff6['id']});if(_0x5874bd!=='Voice'){return;}return db[_0xb52a('0x8e')][_0xb52a('0x55')]({'where':{'VoiceQueueId':_0x111ff6['id'],'UserId':_0x1453e4},'transaction':_0x5d9718});});return Promise['all'](_0x3eae19);});});return Promise['all'](_0x4a48fc);});});return Promise[_0xb52a('0x90')](_0x31d72f)[_0xb52a('0x2b')](function(){return _0x1ddaa5[_0xb52a('0x91')](_0x35b92d,{'transaction':_0x5d9718});})['then'](function(){return db[_0xb52a('0x6b')][_0xb52a('0x6f')]({'where':{'teamId':_0x155651}})[_0xb52a('0x2b')](function(_0x4e12bf){if(_0x4e12bf){var _0x8b6228=_[_0xb52a('0x42')](_0x35b92d,function(_0x3bda36){db['UserVoicePrefix'][_0xb52a('0x55')]({'where':{'UserId':_0x3bda36,'VoicePrefixId':_0x4e12bf[_0xb52a('0x6d')]}});});return Promise[_0xb52a('0x90')](_0x8b6228);}});});});}})['then'](respondWithStatusCode(_0x52caa0,null))['catch'](handleError(_0x52caa0,null));};exports[_0xb52a('0x93')]=function(_0xff14e7,_0x153706,_0x500b0d){var _0x13f15a={};var _0x1d97de={};var _0x22127f;var _0x248939;return db['Team'][_0xb52a('0x6f')]({'where':{'id':_0xff14e7[_0xb52a('0x56')]['id']}})[_0xb52a('0x2b')](handleEntityNotFound(_0x153706,null))[_0xb52a('0x2b')](function(_0x2b9364){if(_0x2b9364){_0x22127f=_0x2b9364;_0x1d97de[_0xb52a('0x35')]=_[_0xb52a('0x37')](db[_0xb52a('0x85')][_0xb52a('0x31')]);_0x1d97de['query']=_['keys'](_0xff14e7[_0xb52a('0x36')]);_0x1d97de[_0xb52a('0x38')]=_[_0xb52a('0x39')](_0x1d97de[_0xb52a('0x35')],_0x1d97de[_0xb52a('0x36')]);_0x13f15a[_0xb52a('0x3a')]=_[_0xb52a('0x39')](_0x1d97de[_0xb52a('0x35')],qs[_0xb52a('0x3b')](_0xff14e7['query']['fields']));_0x13f15a[_0xb52a('0x3a')]=_0x13f15a[_0xb52a('0x3a')]['length']?_0x13f15a['attributes']:_0x1d97de['model'];_0x13f15a[_0xb52a('0x3e')]=qs[_0xb52a('0x75')](_0xff14e7[_0xb52a('0x36')][_0xb52a('0x75')]);_0x13f15a['where']=qs['filters'](_['pick'](_0xff14e7[_0xb52a('0x36')],_0x1d97de[_0xb52a('0x38')]));if(_0xff14e7['query'][_0xb52a('0x3f')]){_0x13f15a[_0xb52a('0x40')]=_[_0xb52a('0x41')](_0x13f15a['where'],{'$or':_['map'](_0x13f15a[_0xb52a('0x3a')],function(_0x2d59c4){var _0x199e9f={};_0x199e9f[_0x2d59c4]={'$like':'%'+_0xff14e7[_0xb52a('0x36')][_0xb52a('0x3f')]+'%'};return _0x199e9f;})});}_0x13f15a=_[_0xb52a('0x41')]({},_0x13f15a,_0xff14e7['options']);return _0x22127f[_0xb52a('0x93')](_0x13f15a);}})['then'](function(_0x56d5b9){if(_0x56d5b9){_0x248939=_0x56d5b9[_0xb52a('0x3c')];if(!_0xff14e7[_0xb52a('0x36')][_0xb52a('0x3d')](_0xb52a('0x94'))){_0x13f15a[_0xb52a('0x24')]=qs[_0xb52a('0x24')](_0xff14e7[_0xb52a('0x36')][_0xb52a('0x24')]);_0x13f15a['offset']=qs[_0xb52a('0x22')](_0xff14e7['query'][_0xb52a('0x22')]);}return _0x22127f[_0xb52a('0x93')](_0x13f15a);}})[_0xb52a('0x2b')](function(_0x20e556){if(_0x20e556){return _0x20e556?{'count':_0x248939,'rows':_0x20e556}:null;}})['then'](respondWithResult(_0x153706,null))['catch'](handleError(_0x153706,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 32d8c0d..9f432c3 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 _0x68c8=['update','remove','emit','hasOwnProperty','events','Team','setMaxListeners','save'];(function(_0x29ced0,_0x152d0b){var _0x1b068e=function(_0x2ff695){while(--_0x2ff695){_0x29ced0['push'](_0x29ced0['shift']());}};_0x1b068e(++_0x152d0b);}(_0x68c8,0x194));var _0x868c=function(_0x18587a,_0x59fc22){_0x18587a=_0x18587a-0x0;var _0x5a1d29=_0x68c8[_0x18587a];return _0x5a1d29;};'use strict';var EventEmitter=require(_0x868c('0x0'));var Team=require('../../mysqldb')['db'][_0x868c('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x868c('0x2')](0x0);var events={'afterCreate':_0x868c('0x3'),'afterUpdate':_0x868c('0x4'),'afterDestroy':_0x868c('0x5')};function emitEvent(_0x329809){return function(_0x1842ff,_0x5d3fd3,_0xc32854){TeamEvents[_0x868c('0x6')](_0x329809+':'+_0x1842ff['id'],_0x1842ff);TeamEvents[_0x868c('0x6')](_0x329809,_0x1842ff);_0xc32854(null);};}for(var e in events){if(events[_0x868c('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x3f89=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team'];(function(_0x52f159,_0x419d8a){var _0x156799=function(_0xf168e8){while(--_0xf168e8){_0x52f159['push'](_0x52f159['shift']());}};_0x156799(++_0x419d8a);}(_0x3f89,0x192));var _0x93f8=function(_0x2a12f7,_0x3439fc){_0x2a12f7=_0x2a12f7-0x0;var _0x4767eb=_0x3f89[_0x2a12f7];return _0x4767eb;};'use strict';var EventEmitter=require(_0x93f8('0x0'));var Team=require(_0x93f8('0x1'))['db'][_0x93f8('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x93f8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x93f8('0x4')};function emitEvent(_0x803cf4){return function(_0x5d2a90,_0x4ebdc4,_0x56a205){TeamEvents[_0x93f8('0x5')](_0x803cf4+':'+_0x5d2a90['id'],_0x5d2a90);TeamEvents[_0x93f8('0x5')](_0x803cf4,_0x5d2a90);_0x56a205(null);};}for(var e in events){if(events[_0x93f8('0x6')](e)){var event=events[e];Team[_0x93f8('0x7')](e,emitEvent(event));}}module[_0x93f8('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 d2693e6..3743e2b 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 _0x8d00=['teams','Chat','Fax','Sms','Whatsapp','resolve','all','catch','./team.attributes','get','Queues','then','map','setDataValue','channel','exports','define','Team'];(function(_0x8ebc5a,_0x3b01c2){var _0x20d39f=function(_0x520b19){while(--_0x520b19){_0x8ebc5a['push'](_0x8ebc5a['shift']());}};_0x20d39f(++_0x3b01c2);}(_0x8d00,0x170));var _0x08d0=function(_0x34a620,_0x27f68c){_0x34a620=_0x34a620-0x0;var _0xe13e96=_0x8d00[_0x34a620];return _0xe13e96;};'use strict';var _=require('lodash');var attributes=require(_0x08d0('0x0'));function getQueuesByChannel(_0x236b6b,_0x3eb078){var _0x4013cc=_0x08d0('0x1')+_0x3eb078+_0x08d0('0x2');return _0x236b6b[_0x4013cc]()[_0x08d0('0x3')](function(_0xab3705){return _[_0x08d0('0x4')](_0xab3705,function(_0x4fe57c){_0x4fe57c[_0x08d0('0x5')](_0x08d0('0x6'),_0x3eb078);return _0x4fe57c;});})['catch'](function(_0x4ed9b7){throw _0x4ed9b7;});}module[_0x08d0('0x7')]=function(_0x447c9b){return _0x447c9b[_0x08d0('0x8')](_0x08d0('0x9'),attributes,{'tableName':_0x08d0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x3f06b2=this;var _0x2f05a9=[_0x08d0('0xb'),_0x08d0('0xc'),'Mail','Openchannel',_0x08d0('0xd'),'Voice',_0x08d0('0xe')];return Promise[_0x08d0('0xf')]()['then'](function(){var _0x2eb7a8=_[_0x08d0('0x4')](_0x2f05a9,function(_0xbea021){return getQueuesByChannel(_0x3f06b2,_0xbea021);});return Promise[_0x08d0('0x10')](_0x2eb7a8);})[_0x08d0('0x11')](function(_0x5d9473){throw _0x5d9473;});}}});}; \ No newline at end of file +var _0x8828=['define','Team','teams','Chat','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','then','all','lodash','Queues','map','setDataValue','catch','exports'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x8828,0x1e8));var _0x8882=function(_0x1e78a2,_0x2ce9e5){_0x1e78a2=_0x1e78a2-0x0;var _0x277401=_0x8828[_0x1e78a2];return _0x277401;};'use strict';var _=require(_0x8882('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x56f0ba,_0x17a8fe){var _0x488989='get'+_0x17a8fe+_0x8882('0x1');return _0x56f0ba[_0x488989]()['then'](function(_0x13c2ab){return _[_0x8882('0x2')](_0x13c2ab,function(_0x38b4f7){_0x38b4f7[_0x8882('0x3')]('channel',_0x17a8fe);return _0x38b4f7;});})[_0x8882('0x4')](function(_0x3d10eb){throw _0x3d10eb;});}module[_0x8882('0x5')]=function(_0xfe3da){return _0xfe3da[_0x8882('0x6')](_0x8882('0x7'),attributes,{'tableName':_0x8882('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x4a1274=this;var _0x4c2c9b=[_0x8882('0x9'),_0x8882('0xa'),_0x8882('0xb'),_0x8882('0xc'),_0x8882('0xd'),_0x8882('0xe'),_0x8882('0xf')];return Promise[_0x8882('0x10')]()[_0x8882('0x11')](function(){var _0x407459=_[_0x8882('0x2')](_0x4c2c9b,function(_0x31c128){return getQueuesByChannel(_0x4a1274,_0x31c128);});return Promise[_0x8882('0x12')](_0x407459);})[_0x8882('0x4')](function(_0x53b87c){throw _0x53b87c;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 8ef4ec2..2453f98 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 _0x3934=['redis','localhost','socket.io-emitter','./team.socket','register','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http'];(function(_0xb04462,_0x2472b1){var _0x589afa=function(_0x38af08){while(--_0x38af08){_0xb04462['push'](_0xb04462['shift']());}};_0x589afa(++_0x2472b1);}(_0x3934,0x116));var _0x4393=function(_0x588e07,_0x2f456b){_0x588e07=_0x588e07-0x0;var _0x17b2ff=_0x3934[_0x588e07];return _0x17b2ff;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4393('0x0'));var BPromise=require(_0x4393('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4393('0x2'));var db=require(_0x4393('0x3'))['db'];var utils=require(_0x4393('0x4'));var logger=require('../../config/logger')(_0x4393('0x5'));var config=require(_0x4393('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4393('0x7')]({'port':0x232a});config[_0x4393('0x8')]=_['defaults'](config[_0x4393('0x8')],{'host':_0x4393('0x9'),'port':0x18eb});var socket=require(_0x4393('0xa'))(new Redis(config[_0x4393('0x8')]));require(_0x4393('0xb'))[_0x4393('0xc')](socket);function respondWithRpcPromise(_0x3e143f,_0x1c2fd6,_0xbda3a5){return new BPromise(function(_0x198f9e,_0x5aca21){return client['request'](_0x3e143f,_0xbda3a5)['then'](function(_0x4c6f7a){logger['info'](_0x4393('0xd'),_0x1c2fd6,_0x4393('0xe'));logger[_0x4393('0xf')](_0x4393('0x10'),_0x1c2fd6,_0x4393('0xe'),JSON['stringify'](_0x4c6f7a));if(_0x4c6f7a[_0x4393('0x11')]){if(_0x4c6f7a['error'][_0x4393('0x12')]===0x1f4){logger[_0x4393('0x11')](_0x4393('0xd'),_0x1c2fd6,_0x4c6f7a[_0x4393('0x11')][_0x4393('0x13')]);return _0x5aca21(_0x4c6f7a[_0x4393('0x11')][_0x4393('0x13')]);}logger[_0x4393('0x11')](_0x4393('0xd'),_0x1c2fd6,_0x4c6f7a[_0x4393('0x11')][_0x4393('0x13')]);return _0x198f9e(_0x4c6f7a[_0x4393('0x11')]['message']);}else{logger[_0x4393('0x14')](_0x4393('0xd'),_0x1c2fd6,'request\x20sent');_0x198f9e(_0x4c6f7a['result']['message']);}})[_0x4393('0x15')](function(_0x1f1cd4){logger[_0x4393('0x11')](_0x4393('0xd'),_0x1c2fd6,_0x1f1cd4);_0x5aca21(_0x1f1cd4);});});} \ No newline at end of file +var _0x0610=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','Team,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x57839e,_0x3d950d){var _0x1c8b4e=function(_0x3144a6){while(--_0x3144a6){_0x57839e['push'](_0x57839e['shift']());}};_0x1c8b4e(++_0x3d950d);}(_0x0610,0xfe));var _0x0061=function(_0x3582be,_0x109548){_0x3582be=_0x3582be-0x0;var _0x84b2de=_0x0610[_0x3582be];return _0x84b2de;};'use strict';var _=require(_0x0061('0x0'));var util=require(_0x0061('0x1'));var moment=require('moment');var BPromise=require(_0x0061('0x2'));var rs=require(_0x0061('0x3'));var fs=require('fs');var Redis=require(_0x0061('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0061('0x5'));var logger=require(_0x0061('0x6'))(_0x0061('0x7'));var config=require(_0x0061('0x8'));var jayson=require(_0x0061('0x9'));var client=jayson[_0x0061('0xa')]['http']({'port':0x232a});config[_0x0061('0xb')]=_['defaults'](config[_0x0061('0xb')],{'host':_0x0061('0xc'),'port':0x18eb});var socket=require(_0x0061('0xd'))(new Redis(config[_0x0061('0xb')]));require('./team.socket')[_0x0061('0xe')](socket);function respondWithRpcPromise(_0x26bd5f,_0x4912fa,_0x393f44){return new BPromise(function(_0x3efa6b,_0x2ce377){return client[_0x0061('0xf')](_0x26bd5f,_0x393f44)[_0x0061('0x10')](function(_0x35f785){logger['info'](_0x0061('0x11'),_0x4912fa,'request\x20sent');logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x4912fa,_0x0061('0x12'),JSON[_0x0061('0x13')](_0x35f785));if(_0x35f785[_0x0061('0x14')]){if(_0x35f785[_0x0061('0x14')][_0x0061('0x15')]===0x1f4){logger[_0x0061('0x14')](_0x0061('0x11'),_0x4912fa,_0x35f785[_0x0061('0x14')][_0x0061('0x16')]);return _0x2ce377(_0x35f785[_0x0061('0x14')][_0x0061('0x16')]);}logger['error'](_0x0061('0x11'),_0x4912fa,_0x35f785[_0x0061('0x14')]['message']);return _0x3efa6b(_0x35f785[_0x0061('0x14')][_0x0061('0x16')]);}else{logger['info'](_0x0061('0x11'),_0x4912fa,_0x0061('0x12'));_0x3efa6b(_0x35f785[_0x0061('0x17')][_0x0061('0x16')]);}})[_0x0061('0x18')](function(_0x11a0c2){logger['error'](_0x0061('0x11'),_0x4912fa,_0x11a0c2);_0x2ce377(_0x11a0c2);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index b2ed33f..fdceeba 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 _0x1fda=['register','team:','./team.events','save','emit','removeListener'];(function(_0x2c2e40,_0x49e0ee){var _0x3414b2=function(_0x41702a){while(--_0x41702a){_0x2c2e40['push'](_0x2c2e40['shift']());}};_0x3414b2(++_0x49e0ee);}(_0x1fda,0x74));var _0xa1fd=function(_0x2b6918,_0x6fcc9e){_0x2b6918=_0x2b6918-0x0;var _0x44e7ab=_0x1fda[_0x2b6918];return _0x44e7ab;};'use strict';var TeamEvents=require(_0xa1fd('0x0'));var events=[_0xa1fd('0x1'),'remove','update'];function createListener(_0x1d6c61,_0x501881){return function(_0x124a1d){_0x501881[_0xa1fd('0x2')](_0x1d6c61,_0x124a1d);};}function removeListener(_0x5efd57,_0x32d310){return function(){TeamEvents[_0xa1fd('0x3')](_0x5efd57,_0x32d310);};}exports[_0xa1fd('0x4')]=function(_0xe894f9){for(var _0x4f5adb=0x0,_0x242a20=events['length'];_0x4f5adb<_0x242a20;_0x4f5adb++){var _0x216c5a=events[_0x4f5adb];var _0x8e84e=createListener(_0xa1fd('0x5')+_0x216c5a,_0xe894f9);TeamEvents['on'](_0x216c5a,_0x8e84e);}}; \ No newline at end of file +var _0xc263=['remove','emit','length','team:','./team.events'];(function(_0x49453e,_0x56009b){var _0x26d4a6=function(_0x9907a7){while(--_0x9907a7){_0x49453e['push'](_0x49453e['shift']());}};_0x26d4a6(++_0x56009b);}(_0xc263,0x171));var _0x3c26=function(_0x2e9d48,_0x292251){_0x2e9d48=_0x2e9d48-0x0;var _0x4e7c4d=_0xc263[_0x2e9d48];return _0x4e7c4d;};'use strict';var TeamEvents=require(_0x3c26('0x0'));var events=['save',_0x3c26('0x1'),'update'];function createListener(_0x141ff1,_0x4566c9){return function(_0xf33dc2){_0x4566c9[_0x3c26('0x2')](_0x141ff1,_0xf33dc2);};}function removeListener(_0x25328a,_0x5c4c3b){return function(){TeamEvents['removeListener'](_0x25328a,_0x5c4c3b);};}exports['register']=function(_0x5ce0e0){for(var _0x3a438b=0x0,_0x1f5ede=events[_0x3c26('0x3')];_0x3a438b<_0x1f5ede;_0x3a438b++){var _0x3cb3b4=events[_0x3a438b];var _0x11ee6f=createListener(_0x3c26('0x4')+_0x3cb3b4,_0x5ce0e0);TeamEvents['on'](_0x3cb3b4,_0x11ee6f);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 08f1227..45c431a 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 _0x0bb5=['sequelize','exports'];(function(_0x1ea310,_0x558f9){var _0x31ac2d=function(_0x4cf6af){while(--_0x4cf6af){_0x1ea310['push'](_0x1ea310['shift']());}};_0x31ac2d(++_0x558f9);}(_0x0bb5,0x148));var _0x50bb=function(_0x575c3d,_0x51ecf5){_0x575c3d=_0x575c3d-0x0;var _0x5a3a2f=_0x0bb5[_0x575c3d];return _0x5a3a2f;};'use strict';var Sequelize=require(_0x50bb('0x0'));module[_0x50bb('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xe2cc=['exports','sequelize'];(function(_0x1b6767,_0x11c00c){var _0x3e3b62=function(_0x108102){while(--_0x108102){_0x1b6767['push'](_0x1b6767['shift']());}};_0x3e3b62(++_0x11c00c);}(_0xe2cc,0x69));var _0xce2c=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xe2cc[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require(_0xce2c('0x0'));module[_0xce2c('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'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 a415443..0fe2812 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 _0x530f=['path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','util','moment','bluebird','request-promise'];(function(_0x439a35,_0x568884){var _0x4e59e0=function(_0x755e7b){while(--_0x755e7b){_0x439a35['push'](_0x439a35['shift']());}};_0x4e59e0(++_0x568884);}(_0x530f,0x167));var _0xf530=function(_0x117417,_0x214c67){_0x117417=_0x117417-0x0;var _0x5ba86d=_0x530f[_0x117417];return _0x5ba86d;};'use strict';var _=require('lodash');var util=require(_0xf530('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf530('0x1'));var BPromise=require(_0xf530('0x2'));var rp=require(_0xf530('0x3'));var fs=require('fs');var path=require(_0xf530('0x4'));var rimraf=require(_0xf530('0x5'));var config=require(_0xf530('0x6'));var attributes=require(_0xf530('0x7'));module[_0xf530('0x8')]=function(_0x58f5f8,_0x3a0301){return _0x58f5f8[_0xf530('0x9')](_0xf530('0xa'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd914=['util','api','moment','bluebird','request-promise','path','rimraf','./teamVoicePrefix.attributes','define','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x21ec7b,_0x54811f){var _0x37253a=function(_0x14d7f5){while(--_0x14d7f5){_0x21ec7b['push'](_0x21ec7b['shift']());}};_0x37253a(++_0x54811f);}(_0xd914,0x17f));var _0x4d91=function(_0x218994,_0x2cf487){_0x218994=_0x218994-0x0;var _0x3f350b=_0xd914[_0x218994];return _0x3f350b;};'use strict';var _=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var logger=require('../../config/logger')(_0x4d91('0x2'));var moment=require(_0x4d91('0x3'));var BPromise=require(_0x4d91('0x4'));var rp=require(_0x4d91('0x5'));var fs=require('fs');var path=require(_0x4d91('0x6'));var rimraf=require(_0x4d91('0x7'));var config=require('../../config/environment');var attributes=require(_0x4d91('0x8'));module['exports']=function(_0x3ab6f8,_0x42d7ae){return _0x3ab6f8[_0x4d91('0x9')](_0x4d91('0xa'),attributes,{'tableName':_0x4d91('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 6abd97a..ed95204 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4144ef,_0x5e61b1){var _0x23e5f5=function(_0x23b1d3){while(--_0x23b1d3){_0x4144ef['push'](_0x4144ef['shift']());}};_0x23e5f5(++_0x5e61b1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0xcb91[_0x2ae2ad];return _0x26dbd7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x934605,_0x1773c5){var _0x3594b4=function(_0xaf130e){while(--_0xaf130e){_0x934605['push'](_0x934605['shift']());}};_0x3594b4(++_0x1773c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index f79d638..df2b4af 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 _0x88fa=['INTEGER','sequelize','exports'];(function(_0x4e960c,_0x4e4e21){var _0xe457b8=function(_0x167255){while(--_0x167255){_0x4e960c['push'](_0x4e960c['shift']());}};_0xe457b8(++_0x4e4e21);}(_0x88fa,0x19f));var _0xa88f=function(_0x3bb954,_0x5173dd){_0x3bb954=_0x3bb954-0x0;var _0x3d96a3=_0x88fa[_0x3bb954];return _0x3d96a3;};'use strict';var Sequelize=require(_0xa88f('0x0'));module[_0xa88f('0x1')]={'penalty':{'type':Sequelize[_0xa88f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x702c=['INTEGER','sequelize','exports'];(function(_0x1076d0,_0x1d20fc){var _0x2d8fb9=function(_0x216d1e){while(--_0x216d1e){_0x1076d0['push'](_0x1076d0['shift']());}};_0x2d8fb9(++_0x1d20fc);}(_0x702c,0x1e4));var _0xc702=function(_0x9a515a,_0x1634be){_0x9a515a=_0x9a515a-0x0;var _0x4723d1=_0x702c[_0x9a515a];return _0x4723d1;};'use strict';var Sequelize=require(_0xc702('0x0'));module[_0xc702('0x1')]={'penalty':{'type':Sequelize[_0xc702('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 7791b91..5a424c1 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 _0x3351=['exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x434634,_0x2b232d){var _0x5d866b=function(_0x5d2691){while(--_0x5d2691){_0x434634['push'](_0x434634['shift']());}};_0x5d866b(++_0x2b232d);}(_0x3351,0x1b4));var _0x1335=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x3351[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x1335('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1335('0x1'));var moment=require(_0x1335('0x2'));var BPromise=require(_0x1335('0x3'));var rp=require(_0x1335('0x4'));var fs=require('fs');var path=require(_0x1335('0x5'));var rimraf=require(_0x1335('0x6'));var config=require(_0x1335('0x7'));var attributes=require('./teamVoiceQueue.attributes');module[_0x1335('0x8')]=function(_0x1b951c,_0x2ee73b){return _0x1b951c[_0x1335('0x9')](_0x1335('0xa'),attributes,{'tableName':_0x1335('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf873=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','TeamVoiceQueue','team_has_voice_queues','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf873,0xb2));var _0x3f87=function(_0x3923e5,_0xbc9164){_0x3923e5=_0x3923e5-0x0;var _0xad60b7=_0xf873[_0x3923e5];return _0xad60b7;};'use strict';var _=require('lodash');var util=require(_0x3f87('0x0'));var logger=require(_0x3f87('0x1'))(_0x3f87('0x2'));var moment=require(_0x3f87('0x3'));var BPromise=require(_0x3f87('0x4'));var rp=require(_0x3f87('0x5'));var fs=require('fs');var path=require(_0x3f87('0x6'));var rimraf=require(_0x3f87('0x7'));var config=require(_0x3f87('0x8'));var attributes=require('./teamVoiceQueue.attributes');module[_0x3f87('0x9')]=function(_0x43c8e4,_0x27c03e){return _0x43c8e4['define'](_0x3f87('0xa'),attributes,{'tableName':_0x3f87('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 bc9b149..73bcf54 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 _0x4584=['result','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0xc8023,_0xd1912){var _0x448b50=function(_0x4b8a6f){while(--_0x4b8a6f){_0xc8023['push'](_0xc8023['shift']());}};_0x448b50(++_0xd1912);}(_0x4584,0x1cf));var _0x4458=function(_0x44e6fd,_0x25a37a){_0x44e6fd=_0x44e6fd-0x0;var _0x11e582=_0x4584[_0x44e6fd];return _0x11e582;};'use strict';var _=require(_0x4458('0x0'));var util=require('util');var moment=require(_0x4458('0x1'));var BPromise=require(_0x4458('0x2'));var rs=require(_0x4458('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4458('0x4'));var logger=require(_0x4458('0x5'))(_0x4458('0x6'));var config=require(_0x4458('0x7'));var jayson=require(_0x4458('0x8'));var client=jayson[_0x4458('0x9')][_0x4458('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x215b2d,_0x102b5f,_0x51da14){return new BPromise(function(_0x14bb0f,_0x83fb96){return client[_0x4458('0xb')](_0x215b2d,_0x51da14)[_0x4458('0xc')](function(_0x1ab8c3){logger[_0x4458('0xd')](_0x4458('0xe'),_0x102b5f,_0x4458('0xf'));logger[_0x4458('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x102b5f,_0x4458('0xf'),JSON[_0x4458('0x11')](_0x1ab8c3));if(_0x1ab8c3[_0x4458('0x12')]){if(_0x1ab8c3[_0x4458('0x12')][_0x4458('0x13')]===0x1f4){logger['error'](_0x4458('0xe'),_0x102b5f,_0x1ab8c3['error'][_0x4458('0x14')]);return _0x83fb96(_0x1ab8c3['error'][_0x4458('0x14')]);}logger[_0x4458('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x102b5f,_0x1ab8c3['error'][_0x4458('0x14')]);return _0x14bb0f(_0x1ab8c3[_0x4458('0x12')][_0x4458('0x14')]);}else{logger[_0x4458('0xd')](_0x4458('0xe'),_0x102b5f,_0x4458('0xf'));_0x14bb0f(_0x1ab8c3[_0x4458('0x15')][_0x4458('0x14')]);}})['catch'](function(_0x31e500){logger['error'](_0x4458('0xe'),_0x102b5f,_0x31e500);_0x83fb96(_0x31e500);});});} \ No newline at end of file +var _0x6326=['error','code','TeamVoiceQueue,\x20%s,\x20%s','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','request\x20sent','stringify'];(function(_0x25199e,_0x482245){var _0x58350b=function(_0x58d500){while(--_0x58d500){_0x25199e['push'](_0x25199e['shift']());}};_0x58350b(++_0x482245);}(_0x6326,0x101));var _0x6632=function(_0x36d5b7,_0x2378a5){_0x36d5b7=_0x36d5b7-0x0;var _0x14922b=_0x6326[_0x36d5b7];return _0x14922b;};'use strict';var _=require('lodash');var util=require(_0x6632('0x0'));var moment=require('moment');var BPromise=require(_0x6632('0x1'));var rs=require(_0x6632('0x2'));var fs=require('fs');var Redis=require(_0x6632('0x3'));var db=require(_0x6632('0x4'))['db'];var utils=require(_0x6632('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6632('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6632('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58c561,_0x1703db,_0x4795fd){return new BPromise(function(_0x3756cc,_0x49b0e3){return client[_0x6632('0x8')](_0x58c561,_0x4795fd)[_0x6632('0x9')](function(_0x538531){logger[_0x6632('0xa')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1703db,_0x6632('0xb'));logger['debug']('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x1703db,_0x6632('0xb'),JSON[_0x6632('0xc')](_0x538531));if(_0x538531[_0x6632('0xd')]){if(_0x538531[_0x6632('0xd')][_0x6632('0xe')]===0x1f4){logger[_0x6632('0xd')](_0x6632('0xf'),_0x1703db,_0x538531[_0x6632('0xd')]['message']);return _0x49b0e3(_0x538531[_0x6632('0xd')][_0x6632('0x10')]);}logger['error'](_0x6632('0xf'),_0x1703db,_0x538531[_0x6632('0xd')][_0x6632('0x10')]);return _0x3756cc(_0x538531[_0x6632('0xd')][_0x6632('0x10')]);}else{logger[_0x6632('0xa')](_0x6632('0xf'),_0x1703db,_0x6632('0xb'));_0x3756cc(_0x538531['result'][_0x6632('0x10')]);}})[_0x6632('0x11')](function(_0x28969a){logger[_0x6632('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1703db,_0x28969a);_0x49b0e3(_0x28969a);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 80e38f1..0e0c3df 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 _0x4d68=['get','isAuthenticated','index','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x1f896a,_0x467c45){var _0x40f3f8=function(_0x2a7fec){while(--_0x2a7fec){_0x1f896a['push'](_0x1f896a['shift']());}};_0x40f3f8(++_0x467c45);}(_0x4d68,0x1c3));var _0x84d6=function(_0x3074f3,_0x4f2c03){_0x3074f3=_0x3074f3-0x0;var _0x53f112=_0x4d68[_0x3074f3];return _0x53f112;};'use strict';var multer=require(_0x84d6('0x0'));var util=require(_0x84d6('0x1'));var path=require(_0x84d6('0x2'));var timeout=require(_0x84d6('0x3'));var express=require(_0x84d6('0x4'));var router=express[_0x84d6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x84d6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x84d6('0x7'));var controller=require('./template.controller');router[_0x84d6('0x8')]('/',auth[_0x84d6('0x9')](),controller[_0x84d6('0xa')]);router['get']('/:id',auth[_0x84d6('0x9')](),controller[_0x84d6('0xb')]);router[_0x84d6('0xc')]('/',auth[_0x84d6('0x9')](),controller['create']);router[_0x84d6('0xd')]('/:id',auth[_0x84d6('0x9')](),controller[_0x84d6('0xe')]);router[_0x84d6('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x84d6('0x10')]);module['exports']=router; \ No newline at end of file +var _0xbcae=['isAuthenticated','/:id','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1c7fce,_0x573c15){var _0x177238=function(_0x183524){while(--_0x183524){_0x1c7fce['push'](_0x1c7fce['shift']());}};_0x177238(++_0x573c15);}(_0xbcae,0xa9));var _0xebca=function(_0x9bc98d,_0x12d721){_0x9bc98d=_0x9bc98d-0x0;var _0x2f4b5c=_0xbcae[_0x9bc98d];return _0x2f4b5c;};'use strict';var multer=require(_0xebca('0x0'));var util=require(_0xebca('0x1'));var path=require(_0xebca('0x2'));var timeout=require(_0xebca('0x3'));var express=require(_0xebca('0x4'));var router=express[_0xebca('0x5')]();var fs_extra=require(_0xebca('0x6'));var auth=require(_0xebca('0x7'));var interaction=require(_0xebca('0x8'));var config=require(_0xebca('0x9'));var controller=require('./template.controller');router[_0xebca('0xa')]('/',auth[_0xebca('0xb')](),controller['index']);router[_0xebca('0xa')](_0xebca('0xc'),auth[_0xebca('0xb')](),controller['show']);router[_0xebca('0xd')]('/',auth[_0xebca('0xb')](),controller[_0xebca('0xe')]);router[_0xebca('0xf')](_0xebca('0xc'),auth[_0xebca('0xb')](),controller['update']);router['delete']('/:id',auth[_0xebca('0xb')](),controller[_0xebca('0x10')]);module[_0xebca('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index a89bf44..95887b4 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 _0x456c=['STRING','sequelize'];(function(_0x3d51ce,_0x353930){var _0xd5323d=function(_0xda9294){while(--_0xda9294){_0x3d51ce['push'](_0x3d51ce['shift']());}};_0xd5323d(++_0x353930);}(_0x456c,0x131));var _0xc456=function(_0x5e3396,_0x205213){_0x5e3396=_0x5e3396-0x0;var _0x3c418a=_0x456c[_0x5e3396];return _0x3c418a;};'use strict';var Sequelize=require(_0xc456('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc456('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xf4d1=['STRING','sequelize'];(function(_0x212780,_0x5a61d1){var _0x4f7c9e=function(_0x322083){while(--_0x322083){_0x212780['push'](_0x212780['shift']());}};_0x4f7c9e(++_0x5a61d1);}(_0xf4d1,0xe9));var _0x1f4d=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xf4d1[_0x16d10f];return _0x50c823;};'use strict';var Sequelize=require(_0x1f4d('0x0'));module['exports']={'name':{'type':Sequelize[_0x1f4d('0x1')]},'description':{'type':Sequelize[_0x1f4d('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index d3e828a..31a09cd 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 _0xe794=['Templates','UserProfileResource','destroy','error','stack','name','index','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','Template','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get'];(function(_0x441131,_0x5a790a){var _0x2665fb=function(_0x279615){while(--_0x279615){_0x441131['push'](_0x441131['shift']());}};_0x2665fb(++_0x5a790a);}(_0xe794,0x1dd));var _0x4e79=function(_0x39e0b5,_0x14755b){_0x39e0b5=_0x39e0b5-0x0;var _0x43e091=_0xe794[_0x39e0b5];return _0x43e091;};'use strict';var emlformat=require(_0x4e79('0x0'));var rimraf=require(_0x4e79('0x1'));var zipdir=require(_0x4e79('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e79('0x3'));var moment=require(_0x4e79('0x4'));var BPromise=require(_0x4e79('0x5'));var Mustache=require(_0x4e79('0x6'));var util=require(_0x4e79('0x7'));var path=require(_0x4e79('0x8'));var sox=require(_0x4e79('0x9'));var csv=require(_0x4e79('0xa'));var ejs=require(_0x4e79('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4e79('0xc'));var squel=require(_0x4e79('0xd'));var crypto=require('crypto');var jsforce=require(_0x4e79('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4e79('0xa'));var querystring=require(_0x4e79('0xf'));var Papa=require(_0x4e79('0x10'));var Redis=require(_0x4e79('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4e79('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4e79('0x13'));var utils=require(_0x4e79('0x14'));var config=require(_0x4e79('0x15'));var licenseUtil=require(_0x4e79('0x16'));var db=require(_0x4e79('0x17'))['db'];function respondWithStatusCode(_0x299323,_0x167137){_0x167137=_0x167137||0xcc;return function(_0x1ff839){if(_0x1ff839){return _0x299323[_0x4e79('0x18')](_0x167137);}return _0x299323[_0x4e79('0x19')](_0x167137)[_0x4e79('0x1a')]();};}function respondWithResult(_0x3d685b,_0x23617b){_0x23617b=_0x23617b||0xc8;return function(_0x2423df){if(_0x2423df){return _0x3d685b['status'](_0x23617b)[_0x4e79('0x1b')](_0x2423df);}};}function respondWithFilteredResult(_0x1da253,_0x28404a){return function(_0x36f7e7){if(_0x36f7e7){var _0x59c5ce=typeof _0x28404a[_0x4e79('0x1c')]===_0x4e79('0x1d')&&typeof _0x28404a[_0x4e79('0x1e')]===_0x4e79('0x1d');var _0xf264ca=_0x36f7e7[_0x4e79('0x1f')];var _0x4c4681=_0x59c5ce?0x0:_0x28404a[_0x4e79('0x1c')];var _0x52915d=_0x59c5ce?_0x36f7e7[_0x4e79('0x1f')]:_0x28404a[_0x4e79('0x1c')]+_0x28404a['limit'];var _0x59de7e;if(_0x52915d>=_0xf264ca){_0x52915d=_0xf264ca;_0x59de7e=0xc8;}else{_0x59de7e=0xce;}_0x1da253[_0x4e79('0x19')](_0x59de7e);return _0x1da253[_0x4e79('0x20')]('Content-Range',_0x4c4681+'-'+_0x52915d+'/'+_0xf264ca)[_0x4e79('0x1b')](_0x36f7e7);}return null;};}function patchUpdates(_0x2c4e91){return function(_0x2f6ad2){try{jsonpatch[_0x4e79('0x21')](_0x2f6ad2,_0x2c4e91,!![]);}catch(_0x4fa3dc){return BPromise[_0x4e79('0x22')](_0x4fa3dc);}return _0x2f6ad2[_0x4e79('0x23')]();};}function saveUpdates(_0x21f3bf,_0x52782a){return function(_0xc8898e){if(_0xc8898e){return _0xc8898e[_0x4e79('0x24')](_0x21f3bf)[_0x4e79('0x25')](function(_0x34902a){return _0x34902a;});}return null;};}function removeEntity(_0x3900c9,_0x20e04e){return function(_0x4fe70a){if(_0x4fe70a){return _0x4fe70a['destroy']()['then'](function(){var _0x2fc562=_0x4fe70a[_0x4e79('0x26')]({'plain':!![]});var _0x312d50=_0x4e79('0x27');return db[_0x4e79('0x28')][_0x4e79('0x29')]({'where':{'type':_0x312d50,'resourceId':_0x2fc562['id']}})[_0x4e79('0x25')](function(){return _0x4fe70a;});})[_0x4e79('0x25')](function(){_0x3900c9[_0x4e79('0x19')](0xcc)[_0x4e79('0x1a')]();});}};}function handleEntityNotFound(_0x421f4f,_0x3686a4){return function(_0x12fa86){if(!_0x12fa86){_0x421f4f['sendStatus'](0x194);}return _0x12fa86;};}function handleError(_0x38f2aa,_0x247684){_0x247684=_0x247684||0x1f4;return function(_0x9b7d20){logger[_0x4e79('0x2a')](_0x9b7d20[_0x4e79('0x2b')]);if(_0x9b7d20[_0x4e79('0x2c')]){delete _0x9b7d20[_0x4e79('0x2c')];}_0x38f2aa[_0x4e79('0x19')](_0x247684)['send'](_0x9b7d20);};}exports[_0x4e79('0x2d')]=function(_0x1034a6,_0x1789f3){var _0x1e2534={},_0x580d5c={},_0x3b15e1={'count':0x0,'rows':[]};var _0x5176c8=_['map'](db['Template'][_0x4e79('0x2e')],function(_0x247d6f){return{'name':_0x247d6f[_0x4e79('0x2f')],'type':_0x247d6f['type'][_0x4e79('0x30')]};});_0x580d5c[_0x4e79('0x31')]=_[_0x4e79('0x32')](_0x5176c8,_0x4e79('0x2c'));_0x580d5c[_0x4e79('0x33')]=_['keys'](_0x1034a6[_0x4e79('0x33')]);_0x580d5c[_0x4e79('0x34')]=_[_0x4e79('0x35')](_0x580d5c[_0x4e79('0x31')],_0x580d5c[_0x4e79('0x33')]);_0x1e2534[_0x4e79('0x36')]=_[_0x4e79('0x35')](_0x580d5c[_0x4e79('0x31')],qs[_0x4e79('0x37')](_0x1034a6[_0x4e79('0x33')]['fields']));_0x1e2534['attributes']=_0x1e2534[_0x4e79('0x36')]['length']?_0x1e2534['attributes']:_0x580d5c['model'];if(!_0x1034a6['query'][_0x4e79('0x38')](_0x4e79('0x39'))){_0x1e2534[_0x4e79('0x1e')]=qs[_0x4e79('0x1e')](_0x1034a6['query'][_0x4e79('0x1e')]);_0x1e2534[_0x4e79('0x1c')]=qs[_0x4e79('0x1c')](_0x1034a6[_0x4e79('0x33')][_0x4e79('0x1c')]);}_0x1e2534[_0x4e79('0x3a')]=qs['sort'](_0x1034a6[_0x4e79('0x33')][_0x4e79('0x3b')]);_0x1e2534['where']=qs[_0x4e79('0x34')](_['pick'](_0x1034a6[_0x4e79('0x33')],_0x580d5c[_0x4e79('0x34')]),_0x5176c8);if(_0x1034a6[_0x4e79('0x33')][_0x4e79('0x3c')]){_0x1e2534[_0x4e79('0x3d')]=_[_0x4e79('0x3e')](_0x1e2534[_0x4e79('0x3d')],{'$or':_[_0x4e79('0x32')](_0x5176c8,function(_0x3e90c3){if(_0x3e90c3[_0x4e79('0x3f')]!==_0x4e79('0x40')){var _0x5d2399={};_0x5d2399[_0x3e90c3['name']]={'$like':'%'+_0x1034a6[_0x4e79('0x33')][_0x4e79('0x3c')]+'%'};return _0x5d2399;}})});}_0x1e2534=_[_0x4e79('0x3e')]({},_0x1e2534,_0x1034a6[_0x4e79('0x41')]);var _0x98c504={'where':_0x1e2534[_0x4e79('0x3d')]};return db[_0x4e79('0x42')]['count'](_0x98c504)[_0x4e79('0x25')](function(_0xaa73a){_0x3b15e1['count']=_0xaa73a;if(_0x1034a6[_0x4e79('0x33')][_0x4e79('0x43')]){_0x1e2534[_0x4e79('0x44')]=[{'all':!![]}];}return db[_0x4e79('0x42')][_0x4e79('0x45')](_0x1e2534);})['then'](function(_0x2088d4){_0x3b15e1[_0x4e79('0x46')]=_0x2088d4;return _0x3b15e1;})['then'](respondWithFilteredResult(_0x1789f3,_0x1e2534))[_0x4e79('0x47')](handleError(_0x1789f3,null));};exports[_0x4e79('0x48')]=function(_0x4771c5,_0x3a1e28){var _0x40e664={'raw':!![],'where':{'id':_0x4771c5[_0x4e79('0x49')]['id']}},_0x464b1e={};_0x464b1e['model']=_[_0x4e79('0x4a')](db[_0x4e79('0x42')][_0x4e79('0x2e')]);_0x464b1e['query']=_[_0x4e79('0x4a')](_0x4771c5[_0x4e79('0x33')]);_0x464b1e[_0x4e79('0x34')]=_[_0x4e79('0x35')](_0x464b1e[_0x4e79('0x31')],_0x464b1e[_0x4e79('0x33')]);_0x40e664[_0x4e79('0x36')]=_['intersection'](_0x464b1e[_0x4e79('0x31')],qs[_0x4e79('0x37')](_0x4771c5[_0x4e79('0x33')][_0x4e79('0x37')]));_0x40e664[_0x4e79('0x36')]=_0x40e664[_0x4e79('0x36')][_0x4e79('0x4b')]?_0x40e664['attributes']:_0x464b1e[_0x4e79('0x31')];if(_0x4771c5[_0x4e79('0x33')]['includeAll']){_0x40e664[_0x4e79('0x44')]=[{'all':!![]}];}_0x40e664=_['merge']({},_0x40e664,_0x4771c5[_0x4e79('0x41')]);return db[_0x4e79('0x42')]['find'](_0x40e664)[_0x4e79('0x25')](handleEntityNotFound(_0x3a1e28,null))[_0x4e79('0x25')](respondWithResult(_0x3a1e28,null))[_0x4e79('0x47')](handleError(_0x3a1e28,null));};exports['create']=function(_0x3975fa,_0x4bf6be){return db[_0x4e79('0x42')][_0x4e79('0x4c')](_0x3975fa[_0x4e79('0x4d')],{})[_0x4e79('0x25')](function(_0x5dc048){var _0x2c881c=_0x3975fa[_0x4e79('0x4e')][_0x4e79('0x26')]({'plain':!![]});if(!_0x2c881c)throw new Error(_0x4e79('0x4f'));if(_0x2c881c[_0x4e79('0x50')]===_0x4e79('0x4e')){var _0x445940=_0x5dc048[_0x4e79('0x26')]({'plain':!![]});var _0x327f53=_0x4e79('0x27');return db[_0x4e79('0x51')]['find']({'where':{'name':_0x327f53,'userProfileId':_0x2c881c[_0x4e79('0x52')]},'raw':!![]})[_0x4e79('0x25')](function(_0x4d1b59){if(_0x4d1b59&&_0x4d1b59[_0x4e79('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x445940['name'],'resourceId':_0x445940['id'],'type':_0x4d1b59[_0x4e79('0x2c')],'sectionId':_0x4d1b59['id']},{})['then'](function(){return _0x5dc048;});}else{return _0x5dc048;}})['catch'](function(_0x312935){logger[_0x4e79('0x2a')](_0x4e79('0x54'),_0x312935);throw _0x312935;});}return _0x5dc048;})[_0x4e79('0x25')](respondWithResult(_0x4bf6be,0xc9))[_0x4e79('0x47')](handleError(_0x4bf6be,null));};exports[_0x4e79('0x24')]=function(_0x46c5a5,_0x29ea23){if(_0x46c5a5[_0x4e79('0x4d')]['id']){delete _0x46c5a5[_0x4e79('0x4d')]['id'];}return db[_0x4e79('0x42')][_0x4e79('0x55')]({'where':{'id':_0x46c5a5['params']['id']}})['then'](handleEntityNotFound(_0x29ea23,null))[_0x4e79('0x25')](saveUpdates(_0x46c5a5[_0x4e79('0x4d')],null))[_0x4e79('0x25')](respondWithResult(_0x29ea23,null))[_0x4e79('0x47')](handleError(_0x29ea23,null));};exports[_0x4e79('0x29')]=function(_0x1bd84b,_0x128ba0){return db[_0x4e79('0x42')][_0x4e79('0x55')]({'where':{'id':_0x1bd84b['params']['id']}})[_0x4e79('0x25')](handleEntityNotFound(_0x128ba0,null))[_0x4e79('0x25')](removeEntity(_0x128ba0,null))['catch'](handleError(_0x128ba0,null));}; \ No newline at end of file +var _0x2017=['../../config/environment','sendStatus','end','status','json','undefined','limit','count','offset','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','map','Template','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','include','find','create','user','UserProfileSection','userProfileId','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x5b327d,_0x570af7){var _0x4ac585=function(_0x203fc0){while(--_0x203fc0){_0x5b327d['push'](_0x5b327d['shift']());}};_0x4ac585(++_0x570af7);}(_0x2017,0x83));var _0x7201=function(_0x38c699,_0x56fea7){_0x38c699=_0x38c699-0x0;var _0x3b1ded=_0x2017[_0x38c699];return _0x3b1ded;};'use strict';var emlformat=require(_0x7201('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7201('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7201('0x2'));var moment=require(_0x7201('0x3'));var BPromise=require(_0x7201('0x4'));var Mustache=require(_0x7201('0x5'));var util=require(_0x7201('0x6'));var path=require(_0x7201('0x7'));var sox=require('sox');var csv=require(_0x7201('0x8'));var ejs=require(_0x7201('0x9'));var fs=require('fs');var fs_extra=require(_0x7201('0xa'));var _=require(_0x7201('0xb'));var squel=require(_0x7201('0xc'));var crypto=require(_0x7201('0xd'));var jsforce=require(_0x7201('0xe'));var deskjs=require(_0x7201('0xf'));var toCsv=require(_0x7201('0x8'));var querystring=require(_0x7201('0x10'));var Papa=require(_0x7201('0x11'));var Redis=require(_0x7201('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7201('0x13'));var as=require(_0x7201('0x14'));var hardwareService=require(_0x7201('0x15'));var logger=require(_0x7201('0x16'))(_0x7201('0x17'));var utils=require(_0x7201('0x18'));var config=require(_0x7201('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f94d3,_0x3152d3){_0x3152d3=_0x3152d3||0xcc;return function(_0x1657f0){if(_0x1657f0){return _0x2f94d3[_0x7201('0x1a')](_0x3152d3);}return _0x2f94d3['status'](_0x3152d3)[_0x7201('0x1b')]();};}function respondWithResult(_0x13d69a,_0x3870d3){_0x3870d3=_0x3870d3||0xc8;return function(_0x5f0ab7){if(_0x5f0ab7){return _0x13d69a[_0x7201('0x1c')](_0x3870d3)[_0x7201('0x1d')](_0x5f0ab7);}};}function respondWithFilteredResult(_0x586ae5,_0x50ab15){return function(_0x5e3b89){if(_0x5e3b89){var _0x350940=typeof _0x50ab15['offset']===_0x7201('0x1e')&&typeof _0x50ab15[_0x7201('0x1f')]==='undefined';var _0x7ceee1=_0x5e3b89[_0x7201('0x20')];var _0x7f9ad3=_0x350940?0x0:_0x50ab15[_0x7201('0x21')];var _0x5ae146=_0x350940?_0x5e3b89[_0x7201('0x20')]:_0x50ab15[_0x7201('0x21')]+_0x50ab15[_0x7201('0x1f')];var _0x224ae9;if(_0x5ae146>=_0x7ceee1){_0x5ae146=_0x7ceee1;_0x224ae9=0xc8;}else{_0x224ae9=0xce;}_0x586ae5[_0x7201('0x1c')](_0x224ae9);return _0x586ae5['set']('Content-Range',_0x7f9ad3+'-'+_0x5ae146+'/'+_0x7ceee1)[_0x7201('0x1d')](_0x5e3b89);}return null;};}function patchUpdates(_0x4c231e){return function(_0x206197){try{jsonpatch['apply'](_0x206197,_0x4c231e,!![]);}catch(_0x4538a9){return BPromise['reject'](_0x4538a9);}return _0x206197[_0x7201('0x22')]();};}function saveUpdates(_0xc1dcff,_0x3eacbf){return function(_0x24cb04){if(_0x24cb04){return _0x24cb04[_0x7201('0x23')](_0xc1dcff)[_0x7201('0x24')](function(_0x2f33ee){return _0x2f33ee;});}return null;};}function removeEntity(_0x2ad767,_0x3b12aa){return function(_0x3f740a){if(_0x3f740a){return _0x3f740a[_0x7201('0x25')]()[_0x7201('0x24')](function(){var _0x3e68a4=_0x3f740a[_0x7201('0x26')]({'plain':!![]});var _0x199710=_0x7201('0x27');return db[_0x7201('0x28')][_0x7201('0x25')]({'where':{'type':_0x199710,'resourceId':_0x3e68a4['id']}})[_0x7201('0x24')](function(){return _0x3f740a;});})[_0x7201('0x24')](function(){_0x2ad767[_0x7201('0x1c')](0xcc)[_0x7201('0x1b')]();});}};}function handleEntityNotFound(_0x5ea78e,_0x55d8e5){return function(_0x4d5814){if(!_0x4d5814){_0x5ea78e['sendStatus'](0x194);}return _0x4d5814;};}function handleError(_0x560e9d,_0x424b2d){_0x424b2d=_0x424b2d||0x1f4;return function(_0x1f810b){logger[_0x7201('0x29')](_0x1f810b[_0x7201('0x2a')]);if(_0x1f810b['name']){delete _0x1f810b[_0x7201('0x2b')];}_0x560e9d[_0x7201('0x1c')](_0x424b2d)['send'](_0x1f810b);};}exports['index']=function(_0x5ca386,_0x5c8eef){var _0x49519e={},_0x3cf2ac={},_0x1291cb={'count':0x0,'rows':[]};var _0x2be168=_[_0x7201('0x2c')](db[_0x7201('0x2d')][_0x7201('0x2e')],function(_0x5f01ca){return{'name':_0x5f01ca[_0x7201('0x2f')],'type':_0x5f01ca[_0x7201('0x30')]['key']};});_0x3cf2ac['model']=_[_0x7201('0x2c')](_0x2be168,_0x7201('0x2b'));_0x3cf2ac[_0x7201('0x31')]=_[_0x7201('0x32')](_0x5ca386[_0x7201('0x31')]);_0x3cf2ac[_0x7201('0x33')]=_[_0x7201('0x34')](_0x3cf2ac['model'],_0x3cf2ac[_0x7201('0x31')]);_0x49519e[_0x7201('0x35')]=_[_0x7201('0x34')](_0x3cf2ac[_0x7201('0x36')],qs[_0x7201('0x37')](_0x5ca386[_0x7201('0x31')][_0x7201('0x37')]));_0x49519e['attributes']=_0x49519e['attributes'][_0x7201('0x38')]?_0x49519e['attributes']:_0x3cf2ac['model'];if(!_0x5ca386[_0x7201('0x31')][_0x7201('0x39')](_0x7201('0x3a'))){_0x49519e[_0x7201('0x1f')]=qs['limit'](_0x5ca386[_0x7201('0x31')]['limit']);_0x49519e[_0x7201('0x21')]=qs[_0x7201('0x21')](_0x5ca386[_0x7201('0x31')][_0x7201('0x21')]);}_0x49519e[_0x7201('0x3b')]=qs[_0x7201('0x3c')](_0x5ca386['query']['sort']);_0x49519e[_0x7201('0x3d')]=qs['filters'](_['pick'](_0x5ca386['query'],_0x3cf2ac[_0x7201('0x33')]),_0x2be168);if(_0x5ca386[_0x7201('0x31')][_0x7201('0x3e')]){_0x49519e[_0x7201('0x3d')]=_['merge'](_0x49519e[_0x7201('0x3d')],{'$or':_[_0x7201('0x2c')](_0x2be168,function(_0x50f445){if(_0x50f445['type']!==_0x7201('0x3f')){var _0x4133ef={};_0x4133ef[_0x50f445[_0x7201('0x2b')]]={'$like':'%'+_0x5ca386['query'][_0x7201('0x3e')]+'%'};return _0x4133ef;}})});}_0x49519e=_[_0x7201('0x40')]({},_0x49519e,_0x5ca386[_0x7201('0x41')]);var _0x47d2ef={'where':_0x49519e[_0x7201('0x3d')]};return db[_0x7201('0x2d')][_0x7201('0x20')](_0x47d2ef)['then'](function(_0x5e30b8){_0x1291cb[_0x7201('0x20')]=_0x5e30b8;if(_0x5ca386['query'][_0x7201('0x42')]){_0x49519e['include']=[{'all':!![]}];}return db[_0x7201('0x2d')][_0x7201('0x43')](_0x49519e);})[_0x7201('0x24')](function(_0x1f5bb0){_0x1291cb[_0x7201('0x44')]=_0x1f5bb0;return _0x1291cb;})[_0x7201('0x24')](respondWithFilteredResult(_0x5c8eef,_0x49519e))[_0x7201('0x45')](handleError(_0x5c8eef,null));};exports['show']=function(_0x532dc8,_0x2937e8){var _0x3bd721={'raw':!![],'where':{'id':_0x532dc8[_0x7201('0x46')]['id']}},_0x793a43={};_0x793a43['model']=_[_0x7201('0x32')](db['Template']['rawAttributes']);_0x793a43['query']=_['keys'](_0x532dc8[_0x7201('0x31')]);_0x793a43[_0x7201('0x33')]=_['intersection'](_0x793a43[_0x7201('0x36')],_0x793a43['query']);_0x3bd721['attributes']=_['intersection'](_0x793a43['model'],qs['fields'](_0x532dc8[_0x7201('0x31')][_0x7201('0x37')]));_0x3bd721[_0x7201('0x35')]=_0x3bd721['attributes'][_0x7201('0x38')]?_0x3bd721[_0x7201('0x35')]:_0x793a43['model'];if(_0x532dc8[_0x7201('0x31')][_0x7201('0x42')]){_0x3bd721[_0x7201('0x47')]=[{'all':!![]}];}_0x3bd721=_['merge']({},_0x3bd721,_0x532dc8['options']);return db['Template'][_0x7201('0x48')](_0x3bd721)[_0x7201('0x24')](handleEntityNotFound(_0x2937e8,null))[_0x7201('0x24')](respondWithResult(_0x2937e8,null))[_0x7201('0x45')](handleError(_0x2937e8,null));};exports[_0x7201('0x49')]=function(_0x3135bb,_0x393fb2){return db[_0x7201('0x2d')][_0x7201('0x49')](_0x3135bb['body'],{})['then'](function(_0x4c9a3b){var _0x467562=_0x3135bb[_0x7201('0x4a')][_0x7201('0x26')]({'plain':!![]});if(!_0x467562)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x467562['role']===_0x7201('0x4a')){var _0x366fa5=_0x4c9a3b[_0x7201('0x26')]({'plain':!![]});var _0x4133ec=_0x7201('0x27');return db[_0x7201('0x4b')][_0x7201('0x48')]({'where':{'name':_0x4133ec,'userProfileId':_0x467562[_0x7201('0x4c')]},'raw':!![]})['then'](function(_0x31df2b){if(_0x31df2b&&_0x31df2b['autoAssociation']===0x0){return db[_0x7201('0x28')][_0x7201('0x49')]({'name':_0x366fa5['name'],'resourceId':_0x366fa5['id'],'type':_0x31df2b[_0x7201('0x2b')],'sectionId':_0x31df2b['id']},{})[_0x7201('0x24')](function(){return _0x4c9a3b;});}else{return _0x4c9a3b;}})['catch'](function(_0x37d486){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37d486);throw _0x37d486;});}return _0x4c9a3b;})[_0x7201('0x24')](respondWithResult(_0x393fb2,0xc9))[_0x7201('0x45')](handleError(_0x393fb2,null));};exports[_0x7201('0x23')]=function(_0x2b4bb2,_0x344349){if(_0x2b4bb2[_0x7201('0x4d')]['id']){delete _0x2b4bb2[_0x7201('0x4d')]['id'];}return db[_0x7201('0x2d')]['find']({'where':{'id':_0x2b4bb2['params']['id']}})['then'](handleEntityNotFound(_0x344349,null))[_0x7201('0x24')](saveUpdates(_0x2b4bb2[_0x7201('0x4d')],null))[_0x7201('0x24')](respondWithResult(_0x344349,null))[_0x7201('0x45')](handleError(_0x344349,null));};exports[_0x7201('0x25')]=function(_0xce7db2,_0x9c0954){return db[_0x7201('0x2d')][_0x7201('0x48')]({'where':{'id':_0xce7db2[_0x7201('0x46')]['id']}})[_0x7201('0x24')](handleEntityNotFound(_0x9c0954,null))[_0x7201('0x24')](removeEntity(_0x9c0954,null))[_0x7201('0x45')](handleError(_0x9c0954,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index ad36e81..d91a480 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 _0x4824=['rimraf','./template.attributes','exports','Template','tools_templates','lodash','util','moment','bluebird','request-promise'];(function(_0xd2f149,_0x51a1c7){var _0x5d1db0=function(_0x8c0166){while(--_0x8c0166){_0xd2f149['push'](_0xd2f149['shift']());}};_0x5d1db0(++_0x51a1c7);}(_0x4824,0xf5));var _0x4482=function(_0x171670,_0x17c8cc){_0x171670=_0x171670-0x0;var _0x5ea507=_0x4824[_0x171670];return _0x5ea507;};'use strict';var _=require(_0x4482('0x0'));var util=require(_0x4482('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4482('0x2'));var BPromise=require(_0x4482('0x3'));var rp=require(_0x4482('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4482('0x5'));var config=require('../../config/environment');var attributes=require(_0x4482('0x6'));module[_0x4482('0x7')]=function(_0x24b847,_0x1bba38){return _0x24b847['define'](_0x4482('0x8'),attributes,{'tableName':_0x4482('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5bf6=['exports','define','Template','lodash','util','../../config/logger','api','moment','request-promise','path','./template.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5bf6,0xc9));var _0x65bf=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0x5bf6[_0x16de68];return _0x1c277e;};'use strict';var _=require(_0x65bf('0x0'));var util=require(_0x65bf('0x1'));var logger=require(_0x65bf('0x2'))(_0x65bf('0x3'));var moment=require(_0x65bf('0x4'));var BPromise=require('bluebird');var rp=require(_0x65bf('0x5'));var fs=require('fs');var path=require(_0x65bf('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x65bf('0x7'));module[_0x65bf('0x8')]=function(_0x25b2df,_0x3f3c83){return _0x25b2df[_0x65bf('0x9')](_0x65bf('0xa'),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 c859a2f..3c25ffa 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 _0x88ef=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','GetTemplate','Template','findAll','options','raw','attributes','limit','include','map','model','util','moment','bluebird','ioredis'];(function(_0x31c7dd,_0x4cc77a){var _0x558858=function(_0x3817a8){while(--_0x3817a8){_0x31c7dd['push'](_0x31c7dd['shift']());}};_0x558858(++_0x4cc77a);}(_0x88ef,0xea));var _0xf88e=function(_0x56d01f,_0x1e8a55){_0x56d01f=_0x56d01f-0x0;var _0x48bbce=_0x88ef[_0x56d01f];return _0x48bbce;};'use strict';var _=require('lodash');var util=require(_0xf88e('0x0'));var moment=require(_0xf88e('0x1'));var BPromise=require(_0xf88e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf88e('0x3'));var db=require(_0xf88e('0x4'))['db'];var utils=require(_0xf88e('0x5'));var logger=require(_0xf88e('0x6'))(_0xf88e('0x7'));var config=require(_0xf88e('0x8'));var jayson=require(_0xf88e('0x9'));var client=jayson[_0xf88e('0xa')][_0xf88e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31fd93,_0x21f3fd,_0xfca89d){return new BPromise(function(_0x33d312,_0x4908f){return client[_0xf88e('0xc')](_0x31fd93,_0xfca89d)[_0xf88e('0xd')](function(_0x29fd05){logger['info'](_0xf88e('0xe'),_0x21f3fd,'request\x20sent');logger[_0xf88e('0xf')]('Template,\x20%s,\x20%s,\x20%s',_0x21f3fd,_0xf88e('0x10'),JSON[_0xf88e('0x11')](_0x29fd05));if(_0x29fd05['error']){if(_0x29fd05[_0xf88e('0x12')][_0xf88e('0x13')]===0x1f4){logger[_0xf88e('0x12')](_0xf88e('0xe'),_0x21f3fd,_0x29fd05[_0xf88e('0x12')][_0xf88e('0x14')]);return _0x4908f(_0x29fd05['error']['message']);}logger['error'](_0xf88e('0xe'),_0x21f3fd,_0x29fd05[_0xf88e('0x12')][_0xf88e('0x14')]);return _0x33d312(_0x29fd05[_0xf88e('0x12')][_0xf88e('0x14')]);}else{logger[_0xf88e('0x15')]('Template,\x20%s,\x20%s',_0x21f3fd,_0xf88e('0x10'));_0x33d312(_0x29fd05[_0xf88e('0x16')][_0xf88e('0x14')]);}})[_0xf88e('0x17')](function(_0x4ecd51){logger['error'](_0xf88e('0xe'),_0x21f3fd,_0x4ecd51);_0x4908f(_0x4ecd51);});});}exports[_0xf88e('0x18')]=function(_0x590cb2){var _0x543796=this;return new Promise(function(_0x1509f1,_0x83da9b){return db[_0xf88e('0x19')][_0xf88e('0x1a')]({'raw':_0x590cb2[_0xf88e('0x1b')]?_0x590cb2['options'][_0xf88e('0x1c')]===undefined?!![]:![]:!![],'where':_0x590cb2['options']?_0x590cb2['options']['where']||null:null,'attributes':_0x590cb2['options']?_0x590cb2[_0xf88e('0x1b')][_0xf88e('0x1d')]||null:null,'limit':_0x590cb2['options']?_0x590cb2[_0xf88e('0x1b')][_0xf88e('0x1e')]||null:null,'include':_0x590cb2['options']?_0x590cb2[_0xf88e('0x1b')][_0xf88e('0x1f')]?_[_0xf88e('0x20')](_0x590cb2['options']['include'],function(_0xdc536a){return{'model':db[_0xdc536a[_0xf88e('0x21')]],'as':_0xdc536a['as'],'attributes':_0xdc536a[_0xf88e('0x1d')],'include':_0xdc536a[_0xf88e('0x1f')]?_[_0xf88e('0x20')](_0xdc536a[_0xf88e('0x1f')],function(_0x5b94e6){return{'model':db[_0x5b94e6['model']],'as':_0x5b94e6['as'],'attributes':_0x5b94e6[_0xf88e('0x1d')],'include':_0x5b94e6[_0xf88e('0x1f')]?_['map'](_0x5b94e6[_0xf88e('0x1f')],function(_0x2bf1b7){return{'model':db[_0x2bf1b7[_0xf88e('0x21')]],'as':_0x2bf1b7['as'],'attributes':_0x2bf1b7[_0xf88e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf88e('0xd')](function(_0x31c03b){logger[_0xf88e('0x15')](_0xf88e('0x18'),_0x590cb2);logger[_0xf88e('0xf')](_0xf88e('0x18'),_0x590cb2,JSON[_0xf88e('0x11')](_0x31c03b));_0x1509f1(_0x31c03b);})[_0xf88e('0x17')](function(_0x12dbfc){logger[_0xf88e('0x12')]('GetTemplate',_0x12dbfc[_0xf88e('0x14')],_0x590cb2);_0x83da9b(_0x543796['error'](0x1f4,_0x12dbfc['message']));});});}; \ No newline at end of file +var _0x280b=['Template','findAll','options','raw','attributes','limit','include','map','model','then','GetTemplate','stringify','util','moment','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request','info','debug','request\x20sent','error','code','Template,\x20%s,\x20%s','message','result','catch'];(function(_0x1a6e4e,_0x42d8f1){var _0x45bca1=function(_0x54e442){while(--_0x54e442){_0x1a6e4e['push'](_0x1a6e4e['shift']());}};_0x45bca1(++_0x42d8f1);}(_0x280b,0x1bf));var _0xb280=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x280b[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0xb280('0x0'));var moment=require(_0xb280('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb280('0x2'));var db=require(_0xb280('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb280('0x4'));var jayson=require(_0xb280('0x5'));var client=jayson['client'][_0xb280('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4b343c,_0x5af817,_0x5db570){return new BPromise(function(_0xd044e8,_0x4f79cd){return client[_0xb280('0x7')](_0x4b343c,_0x5db570)['then'](function(_0x10eed9){logger[_0xb280('0x8')]('Template,\x20%s,\x20%s',_0x5af817,'request\x20sent');logger[_0xb280('0x9')]('Template,\x20%s,\x20%s,\x20%s',_0x5af817,_0xb280('0xa'),JSON['stringify'](_0x10eed9));if(_0x10eed9[_0xb280('0xb')]){if(_0x10eed9['error'][_0xb280('0xc')]===0x1f4){logger[_0xb280('0xb')](_0xb280('0xd'),_0x5af817,_0x10eed9[_0xb280('0xb')]['message']);return _0x4f79cd(_0x10eed9['error'][_0xb280('0xe')]);}logger[_0xb280('0xb')]('Template,\x20%s,\x20%s',_0x5af817,_0x10eed9[_0xb280('0xb')][_0xb280('0xe')]);return _0xd044e8(_0x10eed9[_0xb280('0xb')][_0xb280('0xe')]);}else{logger[_0xb280('0x8')](_0xb280('0xd'),_0x5af817,_0xb280('0xa'));_0xd044e8(_0x10eed9[_0xb280('0xf')]['message']);}})[_0xb280('0x10')](function(_0xc8d56a){logger[_0xb280('0xb')]('Template,\x20%s,\x20%s',_0x5af817,_0xc8d56a);_0x4f79cd(_0xc8d56a);});});}exports['GetTemplate']=function(_0x53a82c){var _0xa7bb4b=this;return new Promise(function(_0x1a7cc1,_0x421e32){return db[_0xb280('0x11')][_0xb280('0x12')]({'raw':_0x53a82c[_0xb280('0x13')]?_0x53a82c[_0xb280('0x13')][_0xb280('0x14')]===undefined?!![]:![]:!![],'where':_0x53a82c[_0xb280('0x13')]?_0x53a82c[_0xb280('0x13')]['where']||null:null,'attributes':_0x53a82c[_0xb280('0x13')]?_0x53a82c[_0xb280('0x13')][_0xb280('0x15')]||null:null,'limit':_0x53a82c['options']?_0x53a82c[_0xb280('0x13')][_0xb280('0x16')]||null:null,'include':_0x53a82c[_0xb280('0x13')]?_0x53a82c[_0xb280('0x13')][_0xb280('0x17')]?_[_0xb280('0x18')](_0x53a82c[_0xb280('0x13')][_0xb280('0x17')],function(_0xd7a11d){return{'model':db[_0xd7a11d[_0xb280('0x19')]],'as':_0xd7a11d['as'],'attributes':_0xd7a11d[_0xb280('0x15')],'include':_0xd7a11d[_0xb280('0x17')]?_[_0xb280('0x18')](_0xd7a11d[_0xb280('0x17')],function(_0x4d01d1){return{'model':db[_0x4d01d1['model']],'as':_0x4d01d1['as'],'attributes':_0x4d01d1[_0xb280('0x15')],'include':_0x4d01d1[_0xb280('0x17')]?_[_0xb280('0x18')](_0x4d01d1['include'],function(_0x55bb93){return{'model':db[_0x55bb93[_0xb280('0x19')]],'as':_0x55bb93['as'],'attributes':_0x55bb93[_0xb280('0x15')]};}):[]};}):[]};}):[]:[]})[_0xb280('0x1a')](function(_0x19e8f4){logger[_0xb280('0x8')](_0xb280('0x1b'),_0x53a82c);logger[_0xb280('0x9')]('GetTemplate',_0x53a82c,JSON[_0xb280('0x1c')](_0x19e8f4));_0x1a7cc1(_0x19e8f4);})[_0xb280('0x10')](function(_0x1d1e9a){logger[_0xb280('0xb')](_0xb280('0x1b'),_0x1d1e9a[_0xb280('0xe')],_0x53a82c);_0x421e32(_0xa7bb4b[_0xb280('0xb')](0x1f4,_0x1d1e9a[_0xb280('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 08d677b..cca0ede 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 _0x1730=['show','getAllConditions','getAnyConditions','/:id/actions','post','create','/:id/all_conditions','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id'];(function(_0x490eab,_0x589a78){var _0xede349=function(_0x341ee3){while(--_0x341ee3){_0x490eab['push'](_0x490eab['shift']());}};_0xede349(++_0x589a78);}(_0x1730,0xda));var _0x0173=function(_0x3426b1,_0x4efe1c){_0x3426b1=_0x3426b1-0x0;var _0x5534a0=_0x1730[_0x3426b1];return _0x5534a0;};'use strict';var multer=require('multer');var util=require(_0x0173('0x0'));var path=require(_0x0173('0x1'));var timeout=require(_0x0173('0x2'));var express=require(_0x0173('0x3'));var router=express[_0x0173('0x4')]();var fs_extra=require(_0x0173('0x5'));var auth=require(_0x0173('0x6'));var interaction=require(_0x0173('0x7'));var config=require(_0x0173('0x8'));var controller=require(_0x0173('0x9'));router[_0x0173('0xa')]('/',auth[_0x0173('0xb')](),controller[_0x0173('0xc')]);router[_0x0173('0xa')](_0x0173('0xd'),auth[_0x0173('0xb')](),controller[_0x0173('0xe')]);router[_0x0173('0xa')]('/:id/all_conditions',auth[_0x0173('0xb')](),controller[_0x0173('0xf')]);router[_0x0173('0xa')]('/:id/any_conditions',auth[_0x0173('0xb')](),controller[_0x0173('0x10')]);router[_0x0173('0xa')](_0x0173('0x11'),auth[_0x0173('0xb')](),controller['getActions']);router[_0x0173('0x12')]('/',auth['isAuthenticated'](),controller[_0x0173('0x13')]);router[_0x0173('0x12')](_0x0173('0x14'),auth['isAuthenticated'](),controller[_0x0173('0x15')]);router[_0x0173('0x12')](_0x0173('0x16'),auth[_0x0173('0xb')](),controller[_0x0173('0x17')]);router[_0x0173('0x12')](_0x0173('0x11'),auth[_0x0173('0xb')](),controller[_0x0173('0x18')]);router[_0x0173('0x19')](_0x0173('0xd'),auth['isAuthenticated'](),controller[_0x0173('0x1a')]);router['delete'](_0x0173('0xd'),auth[_0x0173('0xb')](),controller[_0x0173('0x1b')]);module[_0x0173('0x1c')]=router; \ No newline at end of file +var _0x59fe=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','index','show','get','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','create','post','addAllCondition','addAnyCondition','addAction','update','delete','/:id'];(function(_0x173505,_0x56e45a){var _0x2b8950=function(_0x3ba0bb){while(--_0x3ba0bb){_0x173505['push'](_0x173505['shift']());}};_0x2b8950(++_0x56e45a);}(_0x59fe,0x146));var _0xe59f=function(_0x3415dd,_0x524865){_0x3415dd=_0x3415dd-0x0;var _0x3ddf4e=_0x59fe[_0x3415dd];return _0x3ddf4e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe59f('0x0'));var timeout=require(_0xe59f('0x1'));var express=require(_0xe59f('0x2'));var router=express[_0xe59f('0x3')]();var fs_extra=require(_0xe59f('0x4'));var auth=require(_0xe59f('0x5'));var interaction=require(_0xe59f('0x6'));var config=require(_0xe59f('0x7'));var controller=require(_0xe59f('0x8'));router['get']('/',auth[_0xe59f('0x9')](),controller[_0xe59f('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe59f('0xb')]);router[_0xe59f('0xc')](_0xe59f('0xd'),auth['isAuthenticated'](),controller[_0xe59f('0xe')]);router['get'](_0xe59f('0xf'),auth[_0xe59f('0x9')](),controller['getAnyConditions']);router[_0xe59f('0xc')](_0xe59f('0x10'),auth['isAuthenticated'](),controller['getActions']);router['post']('/',auth['isAuthenticated'](),controller[_0xe59f('0x11')]);router[_0xe59f('0x12')](_0xe59f('0xd'),auth['isAuthenticated'](),controller[_0xe59f('0x13')]);router[_0xe59f('0x12')](_0xe59f('0xf'),auth['isAuthenticated'](),controller[_0xe59f('0x14')]);router['post'](_0xe59f('0x10'),auth[_0xe59f('0x9')](),controller[_0xe59f('0x15')]);router['put']('/:id',auth[_0xe59f('0x9')](),controller[_0xe59f('0x16')]);router[_0xe59f('0x17')](_0xe59f('0x18'),auth['isAuthenticated'](),controller[_0xe59f('0x19')]);module[_0xe59f('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 6161eac..628dde2 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 _0xbb5a=['sequelize','exports','STRING','BOOLEAN'];(function(_0x5252a1,_0x32b917){var _0x39973f=function(_0x58fc66){while(--_0x58fc66){_0x5252a1['push'](_0x5252a1['shift']());}};_0x39973f(++_0x32b917);}(_0xbb5a,0x1b4));var _0xabb5=function(_0x36fe61,_0x1cd190){_0x36fe61=_0x36fe61-0x0;var _0x4737c9=_0xbb5a[_0x36fe61];return _0x4737c9;};'use strict';var Sequelize=require(_0xabb5('0x0'));module[_0xabb5('0x1')]={'name':{'type':Sequelize[_0xabb5('0x2')]},'channel':{'type':Sequelize[_0xabb5('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xabb5('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x195f=['BOOLEAN','sequelize','STRING'];(function(_0x28c9dc,_0x219142){var _0x1500ad=function(_0x4fc5ec){while(--_0x4fc5ec){_0x28c9dc['push'](_0x28c9dc['shift']());}};_0x1500ad(++_0x219142);}(_0x195f,0xe5));var _0xf195=function(_0x443494,_0x51fc7e){_0x443494=_0x443494-0x0;var _0x4a6794=_0x195f[_0x443494];return _0x4a6794;};'use strict';var Sequelize=require(_0xf195('0x0'));module['exports']={'name':{'type':Sequelize[_0xf195('0x1')]},'channel':{'type':Sequelize[_0xf195('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xf195('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index e47b4bd..11b4835 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 _0xe17a=['getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','get','Triggers','UserProfileResource','error','name','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','catch','show','params','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe17a,0x67));var _0xae17=function(_0x38a5ce,_0xadd10b){_0x38a5ce=_0x38a5ce-0x0;var _0x1e3e7a=_0xe17a[_0x38a5ce];return _0x1e3e7a;};'use strict';var emlformat=require(_0xae17('0x0'));var rimraf=require(_0xae17('0x1'));var zipdir=require(_0xae17('0x2'));var jsonpatch=require(_0xae17('0x3'));var rp=require(_0xae17('0x4'));var moment=require(_0xae17('0x5'));var BPromise=require(_0xae17('0x6'));var Mustache=require(_0xae17('0x7'));var util=require(_0xae17('0x8'));var path=require(_0xae17('0x9'));var sox=require(_0xae17('0xa'));var csv=require('to-csv');var ejs=require(_0xae17('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae17('0xc'));var squel=require(_0xae17('0xd'));var crypto=require(_0xae17('0xe'));var jsforce=require(_0xae17('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xae17('0x10'));var querystring=require('querystring');var Papa=require(_0xae17('0x11'));var Redis=require('ioredis');var authService=require(_0xae17('0x12'));var qs=require(_0xae17('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xae17('0x14'))(_0xae17('0x15'));var utils=require(_0xae17('0x16'));var config=require(_0xae17('0x17'));var licenseUtil=require(_0xae17('0x18'));var db=require(_0xae17('0x19'))['db'];function respondWithStatusCode(_0x2865cb,_0x3aad18){_0x3aad18=_0x3aad18||0xcc;return function(_0x4f3ede){if(_0x4f3ede){return _0x2865cb[_0xae17('0x1a')](_0x3aad18);}return _0x2865cb[_0xae17('0x1b')](_0x3aad18)[_0xae17('0x1c')]();};}function respondWithResult(_0x1d3ea3,_0x235496){_0x235496=_0x235496||0xc8;return function(_0x32c7da){if(_0x32c7da){return _0x1d3ea3[_0xae17('0x1b')](_0x235496)['json'](_0x32c7da);}};}function respondWithFilteredResult(_0x2d393c,_0x2312a4){return function(_0x1b1c62){if(_0x1b1c62){var _0x4cf49e=typeof _0x2312a4[_0xae17('0x1d')]===_0xae17('0x1e')&&typeof _0x2312a4[_0xae17('0x1f')]===_0xae17('0x1e');var _0x45fac7=_0x1b1c62[_0xae17('0x20')];var _0x29c487=_0x4cf49e?0x0:_0x2312a4[_0xae17('0x1d')];var _0x6edd03=_0x4cf49e?_0x1b1c62['count']:_0x2312a4[_0xae17('0x1d')]+_0x2312a4[_0xae17('0x1f')];var _0x185e6e;if(_0x6edd03>=_0x45fac7){_0x6edd03=_0x45fac7;_0x185e6e=0xc8;}else{_0x185e6e=0xce;}_0x2d393c[_0xae17('0x1b')](_0x185e6e);return _0x2d393c[_0xae17('0x21')]('Content-Range',_0x29c487+'-'+_0x6edd03+'/'+_0x45fac7)[_0xae17('0x22')](_0x1b1c62);}return null;};}function patchUpdates(_0xf65a66){return function(_0x43784e){try{jsonpatch[_0xae17('0x23')](_0x43784e,_0xf65a66,!![]);}catch(_0x9606c9){return BPromise['reject'](_0x9606c9);}return _0x43784e[_0xae17('0x24')]();};}function saveUpdates(_0x50687f,_0x5da715){return function(_0x19da00){if(_0x19da00){return _0x19da00[_0xae17('0x25')](_0x50687f)[_0xae17('0x26')](function(_0x3f3c30){return _0x3f3c30;});}return null;};}function removeEntity(_0x2d540c,_0x2cb74f){return function(_0x458777){if(_0x458777){return _0x458777[_0xae17('0x27')]()[_0xae17('0x26')](function(){var _0x4ac24c=_0x458777[_0xae17('0x28')]({'plain':!![]});var _0x1ed5c8=_0xae17('0x29');return db[_0xae17('0x2a')]['destroy']({'where':{'type':_0x1ed5c8,'resourceId':_0x4ac24c['id']}})['then'](function(){return _0x458777;});})['then'](function(){_0x2d540c['status'](0xcc)[_0xae17('0x1c')]();});}};}function handleEntityNotFound(_0x327c9c,_0x577d33){return function(_0x2b68ab){if(!_0x2b68ab){_0x327c9c['sendStatus'](0x194);}return _0x2b68ab;};}function handleError(_0x1a5c31,_0x18d1d4){_0x18d1d4=_0x18d1d4||0x1f4;return function(_0x3fe34c){logger[_0xae17('0x2b')](_0x3fe34c['stack']);if(_0x3fe34c[_0xae17('0x2c')]){delete _0x3fe34c[_0xae17('0x2c')];}_0x1a5c31['status'](_0x18d1d4)['send'](_0x3fe34c);};}exports[_0xae17('0x2d')]=function(_0x11a78b,_0x2dbdc3){var _0x42ea55={},_0x264f61={},_0x21c3b9={'count':0x0,'rows':[]};var _0xe01595=_[_0xae17('0x2e')](db[_0xae17('0x2f')][_0xae17('0x30')],function(_0x578ca9){return{'name':_0x578ca9[_0xae17('0x31')],'type':_0x578ca9[_0xae17('0x32')][_0xae17('0x33')]};});_0x264f61[_0xae17('0x34')]=_[_0xae17('0x2e')](_0xe01595,_0xae17('0x2c'));_0x264f61[_0xae17('0x35')]=_[_0xae17('0x36')](_0x11a78b[_0xae17('0x35')]);_0x264f61['filters']=_[_0xae17('0x37')](_0x264f61[_0xae17('0x34')],_0x264f61[_0xae17('0x35')]);_0x42ea55[_0xae17('0x38')]=_['intersection'](_0x264f61[_0xae17('0x34')],qs[_0xae17('0x39')](_0x11a78b[_0xae17('0x35')][_0xae17('0x39')]));_0x42ea55[_0xae17('0x38')]=_0x42ea55[_0xae17('0x38')][_0xae17('0x3a')]?_0x42ea55['attributes']:_0x264f61[_0xae17('0x34')];if(!_0x11a78b[_0xae17('0x35')][_0xae17('0x3b')](_0xae17('0x3c'))){_0x42ea55[_0xae17('0x1f')]=qs['limit'](_0x11a78b[_0xae17('0x35')][_0xae17('0x1f')]);_0x42ea55[_0xae17('0x1d')]=qs[_0xae17('0x1d')](_0x11a78b[_0xae17('0x35')]['offset']);}_0x42ea55[_0xae17('0x3d')]=qs[_0xae17('0x3e')](_0x11a78b[_0xae17('0x35')]['sort']);_0x42ea55['where']=qs[_0xae17('0x3f')](_[_0xae17('0x40')](_0x11a78b[_0xae17('0x35')],_0x264f61[_0xae17('0x3f')]),_0xe01595);if(_0x11a78b['query'][_0xae17('0x41')]){_0x42ea55[_0xae17('0x42')]=_['merge'](_0x42ea55[_0xae17('0x42')],{'$or':_[_0xae17('0x2e')](_0xe01595,function(_0x896982){if(_0x896982[_0xae17('0x32')]!==_0xae17('0x43')){var _0x21b675={};_0x21b675[_0x896982['name']]={'$like':'%'+_0x11a78b[_0xae17('0x35')][_0xae17('0x41')]+'%'};return _0x21b675;}})});}_0x42ea55=_[_0xae17('0x44')]({},_0x42ea55,_0x11a78b[_0xae17('0x45')]);var _0x30f4dc={'where':_0x42ea55[_0xae17('0x42')]};return db[_0xae17('0x2f')]['count'](_0x30f4dc)['then'](function(_0x12bff2){_0x21c3b9['count']=_0x12bff2;if(_0x11a78b['query'][_0xae17('0x46')]){_0x42ea55['include']=[{'all':!![]}];}return db[_0xae17('0x2f')]['findAll'](_0x42ea55);})[_0xae17('0x26')](function(_0x459705){_0x21c3b9[_0xae17('0x47')]=_0x459705;return _0x21c3b9;})[_0xae17('0x26')](respondWithFilteredResult(_0x2dbdc3,_0x42ea55))[_0xae17('0x48')](handleError(_0x2dbdc3,null));};exports[_0xae17('0x49')]=function(_0x19255f,_0x36be3e){var _0x3880d6={'raw':![],'where':{'id':_0x19255f[_0xae17('0x4a')]['id']}},_0x4f3261={};_0x4f3261[_0xae17('0x34')]=_[_0xae17('0x36')](db[_0xae17('0x2f')][_0xae17('0x30')]);_0x4f3261[_0xae17('0x35')]=_[_0xae17('0x36')](_0x19255f[_0xae17('0x35')]);_0x4f3261[_0xae17('0x3f')]=_[_0xae17('0x37')](_0x4f3261[_0xae17('0x34')],_0x4f3261['query']);_0x3880d6[_0xae17('0x38')]=_[_0xae17('0x37')](_0x4f3261[_0xae17('0x34')],qs['fields'](_0x19255f[_0xae17('0x35')][_0xae17('0x39')]));_0x3880d6[_0xae17('0x38')]=_0x3880d6[_0xae17('0x38')][_0xae17('0x3a')]?_0x3880d6[_0xae17('0x38')]:_0x4f3261[_0xae17('0x34')];if(_0x19255f[_0xae17('0x35')][_0xae17('0x46')]){_0x3880d6[_0xae17('0x4b')]=[{'all':!![]}];}_0x3880d6=_['merge']({},_0x3880d6,_0x19255f[_0xae17('0x45')]);return db[_0xae17('0x2f')]['find'](_0x3880d6)[_0xae17('0x26')](handleEntityNotFound(_0x36be3e,null))[_0xae17('0x26')](respondWithResult(_0x36be3e,null))[_0xae17('0x48')](handleError(_0x36be3e,null));};exports[_0xae17('0x4c')]=function(_0x5f2e46,_0x2112ee){return db[_0xae17('0x2f')]['create'](_0x5f2e46[_0xae17('0x4d')],{})[_0xae17('0x26')](function(_0x5637fe){var _0x2ba728=_0x5f2e46['user'][_0xae17('0x28')]({'plain':!![]});if(!_0x2ba728)throw new Error(_0xae17('0x4e'));if(_0x2ba728[_0xae17('0x4f')]===_0xae17('0x50')){var _0xb489d1=_0x5637fe['get']({'plain':!![]});var _0x13b868=_0xae17('0x29');return db[_0xae17('0x51')][_0xae17('0x52')]({'where':{'name':_0x13b868,'userProfileId':_0x2ba728[_0xae17('0x53')]},'raw':!![]})[_0xae17('0x26')](function(_0x223045){if(_0x223045&&_0x223045[_0xae17('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0xb489d1[_0xae17('0x2c')],'resourceId':_0xb489d1['id'],'type':_0x223045[_0xae17('0x2c')],'sectionId':_0x223045['id']},{})['then'](function(){return _0x5637fe;});}else{return _0x5637fe;}})['catch'](function(_0x3c5010){logger['error'](_0xae17('0x55'),_0x3c5010);throw _0x3c5010;});}return _0x5637fe;})[_0xae17('0x26')](respondWithResult(_0x2112ee,0xc9))[_0xae17('0x48')](handleError(_0x2112ee,null));};exports[_0xae17('0x25')]=function(_0xdc9497,_0x219ccb){if(_0xdc9497[_0xae17('0x4d')]['id']){delete _0xdc9497[_0xae17('0x4d')]['id'];}return db[_0xae17('0x2f')][_0xae17('0x52')]({'where':{'id':_0xdc9497[_0xae17('0x4a')]['id']}})['then'](handleEntityNotFound(_0x219ccb,null))[_0xae17('0x26')](saveUpdates(_0xdc9497[_0xae17('0x4d')],null))['then'](respondWithResult(_0x219ccb,null))[_0xae17('0x48')](handleError(_0x219ccb,null));};exports['destroy']=function(_0x53e801,_0x88efd2){return db['Trigger'][_0xae17('0x52')]({'where':{'id':_0x53e801[_0xae17('0x4a')]['id']}})['then'](handleEntityNotFound(_0x88efd2,null))[_0xae17('0x26')](removeEntity(_0x88efd2,null))[_0xae17('0x48')](handleError(_0x88efd2,null));};exports[_0xae17('0x56')]=function(_0x5d9693,_0xaa0bfe,_0x3ec78f){if(_0x5d9693['body']['id']){delete _0x5d9693[_0xae17('0x4d')]['id'];}return db['Trigger'][_0xae17('0x52')]({'where':{'id':_0x5d9693['params']['id']}})[_0xae17('0x26')](handleEntityNotFound(_0xaa0bfe,null))[_0xae17('0x26')](function(_0x17df88){if(_0x17df88){_0x5d9693['body'][_0xae17('0x57')]=_0x17df88['id'];return db[_0xae17('0x58')][_0xae17('0x4c')](_0x5d9693[_0xae17('0x4d')]);}})['then'](respondWithResult(_0xaa0bfe,null))[_0xae17('0x48')](handleError(_0xaa0bfe,null));};exports[_0xae17('0x59')]=function(_0x1b2d6e,_0x463865,_0xc90654){if(_0x1b2d6e[_0xae17('0x4d')]['id']){delete _0x1b2d6e[_0xae17('0x4d')]['id'];}return db[_0xae17('0x2f')]['find']({'where':{'id':_0x1b2d6e[_0xae17('0x4a')]['id']}})[_0xae17('0x26')](handleEntityNotFound(_0x463865,null))[_0xae17('0x26')](function(_0x23f277){if(_0x23f277){_0x1b2d6e[_0xae17('0x4d')][_0xae17('0x5a')]=_0x23f277['id'];return db[_0xae17('0x58')][_0xae17('0x4c')](_0x1b2d6e['body']);}})['then'](respondWithResult(_0x463865,null))['catch'](handleError(_0x463865,null));};exports[_0xae17('0x5b')]=function(_0x3502b9,_0x46369f,_0x12f560){var _0x405a30={};var _0xaa8c16={};var _0x369014;var _0x1a3ebe;return db[_0xae17('0x2f')][_0xae17('0x5c')]({'where':{'id':_0x3502b9[_0xae17('0x4a')]['id']}})[_0xae17('0x26')](handleEntityNotFound(_0x46369f,null))[_0xae17('0x26')](function(_0x32017d){if(_0x32017d){_0x369014=_0x32017d;_0xaa8c16[_0xae17('0x34')]=_[_0xae17('0x36')](db[_0xae17('0x58')][_0xae17('0x30')]);_0xaa8c16[_0xae17('0x35')]=_['keys'](_0x3502b9['query']);_0xaa8c16['filters']=_['intersection'](_0xaa8c16[_0xae17('0x34')],_0xaa8c16[_0xae17('0x35')]);_0x405a30[_0xae17('0x38')]=_[_0xae17('0x37')](_0xaa8c16[_0xae17('0x34')],qs[_0xae17('0x39')](_0x3502b9[_0xae17('0x35')]['fields']));_0x405a30['attributes']=_0x405a30[_0xae17('0x38')][_0xae17('0x3a')]?_0x405a30[_0xae17('0x38')]:_0xaa8c16[_0xae17('0x34')];_0x405a30[_0xae17('0x3d')]=qs[_0xae17('0x3e')](_0x3502b9[_0xae17('0x35')][_0xae17('0x3e')]);_0x405a30[_0xae17('0x42')]=qs[_0xae17('0x3f')](_[_0xae17('0x40')](_0x3502b9[_0xae17('0x35')],_0xaa8c16[_0xae17('0x3f')]));if(_0x3502b9['query'][_0xae17('0x41')]){_0x405a30[_0xae17('0x42')]=_['merge'](_0x405a30[_0xae17('0x42')],{'$or':_['map'](_0x405a30[_0xae17('0x38')],function(_0x2acb5f){var _0x4cfb0e={};_0x4cfb0e[_0x2acb5f]={'$like':'%'+_0x3502b9['query']['filter']+'%'};return _0x4cfb0e;})});}_0x405a30=_[_0xae17('0x44')]({},_0x405a30,_0x3502b9[_0xae17('0x45')]);return _0x369014['getAllConditions'](_0x405a30);}})[_0xae17('0x26')](function(_0x439a36){if(_0x439a36){_0x1a3ebe=_0x439a36[_0xae17('0x3a')];if(!_0x3502b9[_0xae17('0x35')][_0xae17('0x3b')](_0xae17('0x3c'))){_0x405a30[_0xae17('0x1f')]=qs[_0xae17('0x1f')](_0x3502b9[_0xae17('0x35')][_0xae17('0x1f')]);_0x405a30[_0xae17('0x1d')]=qs[_0xae17('0x1d')](_0x3502b9[_0xae17('0x35')][_0xae17('0x1d')]);}return _0x369014[_0xae17('0x5b')](_0x405a30);}})['then'](function(_0x477cfa){if(_0x477cfa){return _0x477cfa?{'count':_0x1a3ebe,'rows':_0x477cfa}:null;}})['then'](respondWithResult(_0x46369f,null))[_0xae17('0x48')](handleError(_0x46369f,null));};exports[_0xae17('0x5d')]=function(_0xe8dd65,_0xffa3a1,_0x40396b){var _0x4928c4={};var _0x1400f4={};var _0x1b3dfd;var _0xff0f21;return db[_0xae17('0x2f')][_0xae17('0x5c')]({'where':{'id':_0xe8dd65[_0xae17('0x4a')]['id']}})[_0xae17('0x26')](handleEntityNotFound(_0xffa3a1,null))[_0xae17('0x26')](function(_0x549e8f){if(_0x549e8f){_0x1b3dfd=_0x549e8f;_0x1400f4[_0xae17('0x34')]=_[_0xae17('0x36')](db['Condition'][_0xae17('0x30')]);_0x1400f4[_0xae17('0x35')]=_[_0xae17('0x36')](_0xe8dd65[_0xae17('0x35')]);_0x1400f4[_0xae17('0x3f')]=_['intersection'](_0x1400f4[_0xae17('0x34')],_0x1400f4[_0xae17('0x35')]);_0x4928c4[_0xae17('0x38')]=_[_0xae17('0x37')](_0x1400f4['model'],qs[_0xae17('0x39')](_0xe8dd65[_0xae17('0x35')]['fields']));_0x4928c4[_0xae17('0x38')]=_0x4928c4[_0xae17('0x38')][_0xae17('0x3a')]?_0x4928c4[_0xae17('0x38')]:_0x1400f4['model'];_0x4928c4[_0xae17('0x3d')]=qs['sort'](_0xe8dd65[_0xae17('0x35')][_0xae17('0x3e')]);_0x4928c4[_0xae17('0x42')]=qs[_0xae17('0x3f')](_[_0xae17('0x40')](_0xe8dd65[_0xae17('0x35')],_0x1400f4['filters']));if(_0xe8dd65['query'][_0xae17('0x41')]){_0x4928c4[_0xae17('0x42')]=_[_0xae17('0x44')](_0x4928c4['where'],{'$or':_[_0xae17('0x2e')](_0x4928c4[_0xae17('0x38')],function(_0x3ae3c8){var _0xd91f48={};_0xd91f48[_0x3ae3c8]={'$like':'%'+_0xe8dd65[_0xae17('0x35')][_0xae17('0x41')]+'%'};return _0xd91f48;})});}_0x4928c4=_[_0xae17('0x44')]({},_0x4928c4,_0xe8dd65[_0xae17('0x45')]);return _0x1b3dfd[_0xae17('0x5d')](_0x4928c4);}})[_0xae17('0x26')](function(_0x5e4728){if(_0x5e4728){_0xff0f21=_0x5e4728[_0xae17('0x3a')];if(!_0xe8dd65[_0xae17('0x35')]['hasOwnProperty'](_0xae17('0x3c'))){_0x4928c4[_0xae17('0x1f')]=qs[_0xae17('0x1f')](_0xe8dd65[_0xae17('0x35')][_0xae17('0x1f')]);_0x4928c4[_0xae17('0x1d')]=qs[_0xae17('0x1d')](_0xe8dd65[_0xae17('0x35')]['offset']);}return _0x1b3dfd['getAnyConditions'](_0x4928c4);}})[_0xae17('0x26')](function(_0x529215){if(_0x529215){return _0x529215?{'count':_0xff0f21,'rows':_0x529215}:null;}})[_0xae17('0x26')](respondWithResult(_0xffa3a1,null))[_0xae17('0x48')](handleError(_0xffa3a1,null));};exports[_0xae17('0x5e')]=function(_0x31b3b3,_0x41a577,_0x49ee0c){if(_0x31b3b3['body']['id']){delete _0x31b3b3[_0xae17('0x4d')]['id'];}return db[_0xae17('0x2f')][_0xae17('0x52')]({'where':{'id':_0x31b3b3[_0xae17('0x4a')]['id']}})[_0xae17('0x26')](handleEntityNotFound(_0x41a577,null))[_0xae17('0x26')](function(_0x5df950){if(_0x5df950){_0x31b3b3['body'][_0xae17('0x5f')]=_0x5df950['id'];return db[_0xae17('0x60')]['create'](_0x31b3b3[_0xae17('0x4d')]);}})['then'](respondWithResult(_0x41a577,null))[_0xae17('0x48')](handleError(_0x41a577,null));};exports[_0xae17('0x61')]=function(_0x4d0f47,_0x289572,_0x2b6db3){var _0x3e8b49={};var _0x2d094f={};var _0x392d98;var _0x20d6eb;return db[_0xae17('0x2f')]['findOne']({'where':{'id':_0x4d0f47[_0xae17('0x4a')]['id']}})[_0xae17('0x26')](handleEntityNotFound(_0x289572,null))[_0xae17('0x26')](function(_0x40c65d){if(_0x40c65d){_0x392d98=_0x40c65d;_0x2d094f['model']=_[_0xae17('0x36')](db[_0xae17('0x60')]['rawAttributes']);_0x2d094f[_0xae17('0x35')]=_[_0xae17('0x36')](_0x4d0f47[_0xae17('0x35')]);_0x2d094f[_0xae17('0x3f')]=_[_0xae17('0x37')](_0x2d094f[_0xae17('0x34')],_0x2d094f['query']);_0x3e8b49[_0xae17('0x38')]=_[_0xae17('0x37')](_0x2d094f[_0xae17('0x34')],qs[_0xae17('0x39')](_0x4d0f47[_0xae17('0x35')]['fields']));_0x3e8b49['attributes']=_0x3e8b49['attributes']['length']?_0x3e8b49['attributes']:_0x2d094f['model'];_0x3e8b49[_0xae17('0x3d')]=qs[_0xae17('0x3e')](_0x4d0f47[_0xae17('0x35')][_0xae17('0x3e')]);_0x3e8b49[_0xae17('0x42')]=qs[_0xae17('0x3f')](_['pick'](_0x4d0f47[_0xae17('0x35')],_0x2d094f[_0xae17('0x3f')]));if(_0x4d0f47[_0xae17('0x35')][_0xae17('0x41')]){_0x3e8b49[_0xae17('0x42')]=_[_0xae17('0x44')](_0x3e8b49[_0xae17('0x42')],{'$or':_[_0xae17('0x2e')](_0x3e8b49[_0xae17('0x38')],function(_0x107e7b){var _0x578952={};_0x578952[_0x107e7b]={'$like':'%'+_0x4d0f47['query'][_0xae17('0x41')]+'%'};return _0x578952;})});}_0x3e8b49=_[_0xae17('0x44')]({},_0x3e8b49,_0x4d0f47['options']);return _0x392d98[_0xae17('0x61')](_0x3e8b49);}})[_0xae17('0x26')](function(_0x1210d3){if(_0x1210d3){_0x20d6eb=_0x1210d3[_0xae17('0x3a')];if(!_0x4d0f47['query'][_0xae17('0x3b')]('nolimit')){_0x3e8b49[_0xae17('0x1f')]=qs[_0xae17('0x1f')](_0x4d0f47[_0xae17('0x35')][_0xae17('0x1f')]);_0x3e8b49[_0xae17('0x1d')]=qs[_0xae17('0x1d')](_0x4d0f47[_0xae17('0x35')][_0xae17('0x1d')]);}return _0x392d98['getActions'](_0x3e8b49);}})['then'](function(_0x341ca7){if(_0x341ca7){return _0x341ca7?{'count':_0x20d6eb,'rows':_0x341ca7}:null;}})[_0xae17('0x26')](respondWithResult(_0x289572,null))['catch'](handleError(_0x289572,null));}; \ No newline at end of file +var _0xdd2a=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','hasOwnProperty','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','reject','save','update','then','destroy','get','Triggers','UserProfileResource','error','stack','name','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x2b3d6d,_0xb6a71b){var _0x3e2c9f=function(_0x56771a){while(--_0x56771a){_0x2b3d6d['push'](_0x2b3d6d['shift']());}};_0x3e2c9f(++_0xb6a71b);}(_0xdd2a,0x1a5));var _0xadd2=function(_0x13e3b1,_0x524846){_0x13e3b1=_0x13e3b1-0x0;var _0x2ca897=_0xdd2a[_0x13e3b1];return _0x2ca897;};'use strict';var emlformat=require(_0xadd2('0x0'));var rimraf=require(_0xadd2('0x1'));var zipdir=require(_0xadd2('0x2'));var jsonpatch=require(_0xadd2('0x3'));var rp=require(_0xadd2('0x4'));var moment=require(_0xadd2('0x5'));var BPromise=require(_0xadd2('0x6'));var Mustache=require(_0xadd2('0x7'));var util=require(_0xadd2('0x8'));var path=require(_0xadd2('0x9'));var sox=require(_0xadd2('0xa'));var csv=require(_0xadd2('0xb'));var ejs=require(_0xadd2('0xc'));var fs=require('fs');var fs_extra=require(_0xadd2('0xd'));var _=require(_0xadd2('0xe'));var squel=require(_0xadd2('0xf'));var crypto=require(_0xadd2('0x10'));var jsforce=require(_0xadd2('0x11'));var deskjs=require(_0xadd2('0x12'));var toCsv=require(_0xadd2('0xb'));var querystring=require(_0xadd2('0x13'));var Papa=require(_0xadd2('0x14'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xadd2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xadd2('0x16'))(_0xadd2('0x17'));var utils=require(_0xadd2('0x18'));var config=require(_0xadd2('0x19'));var licenseUtil=require(_0xadd2('0x1a'));var db=require(_0xadd2('0x1b'))['db'];function respondWithStatusCode(_0xaeac5e,_0x928fe7){_0x928fe7=_0x928fe7||0xcc;return function(_0x4b0973){if(_0x4b0973){return _0xaeac5e[_0xadd2('0x1c')](_0x928fe7);}return _0xaeac5e['status'](_0x928fe7)[_0xadd2('0x1d')]();};}function respondWithResult(_0x498e71,_0x2d5497){_0x2d5497=_0x2d5497||0xc8;return function(_0x252d04){if(_0x252d04){return _0x498e71['status'](_0x2d5497)['json'](_0x252d04);}};}function respondWithFilteredResult(_0x1e9956,_0x2a8a9b){return function(_0x3dd439){if(_0x3dd439){var _0x305f71=typeof _0x2a8a9b[_0xadd2('0x1e')]===_0xadd2('0x1f')&&typeof _0x2a8a9b['limit']===_0xadd2('0x1f');var _0x23adcc=_0x3dd439[_0xadd2('0x20')];var _0x4c2fdc=_0x305f71?0x0:_0x2a8a9b[_0xadd2('0x1e')];var _0x5b8a0f=_0x305f71?_0x3dd439[_0xadd2('0x20')]:_0x2a8a9b[_0xadd2('0x1e')]+_0x2a8a9b[_0xadd2('0x21')];var _0xa32b8b;if(_0x5b8a0f>=_0x23adcc){_0x5b8a0f=_0x23adcc;_0xa32b8b=0xc8;}else{_0xa32b8b=0xce;}_0x1e9956[_0xadd2('0x22')](_0xa32b8b);return _0x1e9956[_0xadd2('0x23')](_0xadd2('0x24'),_0x4c2fdc+'-'+_0x5b8a0f+'/'+_0x23adcc)[_0xadd2('0x25')](_0x3dd439);}return null;};}function patchUpdates(_0x4010af){return function(_0x207379){try{jsonpatch['apply'](_0x207379,_0x4010af,!![]);}catch(_0x1e0610){return BPromise[_0xadd2('0x26')](_0x1e0610);}return _0x207379[_0xadd2('0x27')]();};}function saveUpdates(_0x1d5003,_0x51ccde){return function(_0x4ca5b9){if(_0x4ca5b9){return _0x4ca5b9[_0xadd2('0x28')](_0x1d5003)[_0xadd2('0x29')](function(_0x5f5bfe){return _0x5f5bfe;});}return null;};}function removeEntity(_0x67efb4,_0x44fdd4){return function(_0x4e6cc7){if(_0x4e6cc7){return _0x4e6cc7[_0xadd2('0x2a')]()[_0xadd2('0x29')](function(){var _0x4c76da=_0x4e6cc7[_0xadd2('0x2b')]({'plain':!![]});var _0x219627=_0xadd2('0x2c');return db[_0xadd2('0x2d')][_0xadd2('0x2a')]({'where':{'type':_0x219627,'resourceId':_0x4c76da['id']}})[_0xadd2('0x29')](function(){return _0x4e6cc7;});})['then'](function(){_0x67efb4[_0xadd2('0x22')](0xcc)[_0xadd2('0x1d')]();});}};}function handleEntityNotFound(_0x2b31d5,_0x7ff63f){return function(_0x3fda19){if(!_0x3fda19){_0x2b31d5[_0xadd2('0x1c')](0x194);}return _0x3fda19;};}function handleError(_0x5342c1,_0x1a0b3d){_0x1a0b3d=_0x1a0b3d||0x1f4;return function(_0x40b5b7){logger[_0xadd2('0x2e')](_0x40b5b7[_0xadd2('0x2f')]);if(_0x40b5b7[_0xadd2('0x30')]){delete _0x40b5b7['name'];}_0x5342c1[_0xadd2('0x22')](_0x1a0b3d)['send'](_0x40b5b7);};}exports[_0xadd2('0x31')]=function(_0x58163f,_0x530194){var _0x306aef={},_0x2db691={},_0x5eed33={'count':0x0,'rows':[]};var _0xf7da79=_[_0xadd2('0x32')](db[_0xadd2('0x33')][_0xadd2('0x34')],function(_0x53f5d2){return{'name':_0x53f5d2[_0xadd2('0x35')],'type':_0x53f5d2[_0xadd2('0x36')][_0xadd2('0x37')]};});_0x2db691[_0xadd2('0x38')]=_[_0xadd2('0x32')](_0xf7da79,_0xadd2('0x30'));_0x2db691[_0xadd2('0x39')]=_['keys'](_0x58163f[_0xadd2('0x39')]);_0x2db691[_0xadd2('0x3a')]=_[_0xadd2('0x3b')](_0x2db691['model'],_0x2db691['query']);_0x306aef[_0xadd2('0x3c')]=_[_0xadd2('0x3b')](_0x2db691['model'],qs[_0xadd2('0x3d')](_0x58163f[_0xadd2('0x39')]['fields']));_0x306aef[_0xadd2('0x3c')]=_0x306aef[_0xadd2('0x3c')]['length']?_0x306aef[_0xadd2('0x3c')]:_0x2db691[_0xadd2('0x38')];if(!_0x58163f[_0xadd2('0x39')]['hasOwnProperty'](_0xadd2('0x3e'))){_0x306aef[_0xadd2('0x21')]=qs['limit'](_0x58163f[_0xadd2('0x39')][_0xadd2('0x21')]);_0x306aef[_0xadd2('0x1e')]=qs['offset'](_0x58163f[_0xadd2('0x39')][_0xadd2('0x1e')]);}_0x306aef[_0xadd2('0x3f')]=qs[_0xadd2('0x40')](_0x58163f[_0xadd2('0x39')]['sort']);_0x306aef[_0xadd2('0x41')]=qs['filters'](_[_0xadd2('0x42')](_0x58163f[_0xadd2('0x39')],_0x2db691[_0xadd2('0x3a')]),_0xf7da79);if(_0x58163f[_0xadd2('0x39')][_0xadd2('0x43')]){_0x306aef['where']=_[_0xadd2('0x44')](_0x306aef[_0xadd2('0x41')],{'$or':_[_0xadd2('0x32')](_0xf7da79,function(_0x520891){if(_0x520891[_0xadd2('0x36')]!=='VIRTUAL'){var _0x180ce3={};_0x180ce3[_0x520891['name']]={'$like':'%'+_0x58163f[_0xadd2('0x39')][_0xadd2('0x43')]+'%'};return _0x180ce3;}})});}_0x306aef=_['merge']({},_0x306aef,_0x58163f[_0xadd2('0x45')]);var _0x21a4ab={'where':_0x306aef[_0xadd2('0x41')]};return db[_0xadd2('0x33')][_0xadd2('0x20')](_0x21a4ab)[_0xadd2('0x29')](function(_0x5746be){_0x5eed33['count']=_0x5746be;if(_0x58163f[_0xadd2('0x39')][_0xadd2('0x46')]){_0x306aef[_0xadd2('0x47')]=[{'all':!![]}];}return db[_0xadd2('0x33')][_0xadd2('0x48')](_0x306aef);})[_0xadd2('0x29')](function(_0x51671d){_0x5eed33[_0xadd2('0x49')]=_0x51671d;return _0x5eed33;})[_0xadd2('0x29')](respondWithFilteredResult(_0x530194,_0x306aef))[_0xadd2('0x4a')](handleError(_0x530194,null));};exports[_0xadd2('0x4b')]=function(_0x1a38aa,_0x52ed23){var _0x9c3719={'raw':![],'where':{'id':_0x1a38aa['params']['id']}},_0x538a1e={};_0x538a1e[_0xadd2('0x38')]=_[_0xadd2('0x4c')](db[_0xadd2('0x33')]['rawAttributes']);_0x538a1e[_0xadd2('0x39')]=_['keys'](_0x1a38aa['query']);_0x538a1e[_0xadd2('0x3a')]=_[_0xadd2('0x3b')](_0x538a1e[_0xadd2('0x38')],_0x538a1e[_0xadd2('0x39')]);_0x9c3719[_0xadd2('0x3c')]=_['intersection'](_0x538a1e[_0xadd2('0x38')],qs[_0xadd2('0x3d')](_0x1a38aa[_0xadd2('0x39')]['fields']));_0x9c3719[_0xadd2('0x3c')]=_0x9c3719['attributes'][_0xadd2('0x4d')]?_0x9c3719[_0xadd2('0x3c')]:_0x538a1e[_0xadd2('0x38')];if(_0x1a38aa['query'][_0xadd2('0x46')]){_0x9c3719[_0xadd2('0x47')]=[{'all':!![]}];}_0x9c3719=_[_0xadd2('0x44')]({},_0x9c3719,_0x1a38aa[_0xadd2('0x45')]);return db[_0xadd2('0x33')][_0xadd2('0x4e')](_0x9c3719)[_0xadd2('0x29')](handleEntityNotFound(_0x52ed23,null))[_0xadd2('0x29')](respondWithResult(_0x52ed23,null))[_0xadd2('0x4a')](handleError(_0x52ed23,null));};exports[_0xadd2('0x4f')]=function(_0x258c79,_0x571636){return db['Trigger'][_0xadd2('0x4f')](_0x258c79['body'],{})[_0xadd2('0x29')](function(_0x38c5aa){var _0x3da059=_0x258c79[_0xadd2('0x50')]['get']({'plain':!![]});if(!_0x3da059)throw new Error(_0xadd2('0x51'));if(_0x3da059[_0xadd2('0x52')]===_0xadd2('0x50')){var _0xb10007=_0x38c5aa[_0xadd2('0x2b')]({'plain':!![]});var _0x4014c7=_0xadd2('0x2c');return db[_0xadd2('0x53')]['find']({'where':{'name':_0x4014c7,'userProfileId':_0x3da059[_0xadd2('0x54')]},'raw':!![]})[_0xadd2('0x29')](function(_0x523c0e){if(_0x523c0e&&_0x523c0e[_0xadd2('0x55')]===0x0){return db['UserProfileResource'][_0xadd2('0x4f')]({'name':_0xb10007[_0xadd2('0x30')],'resourceId':_0xb10007['id'],'type':_0x523c0e[_0xadd2('0x30')],'sectionId':_0x523c0e['id']},{})[_0xadd2('0x29')](function(){return _0x38c5aa;});}else{return _0x38c5aa;}})['catch'](function(_0x3b3346){logger['error'](_0xadd2('0x56'),_0x3b3346);throw _0x3b3346;});}return _0x38c5aa;})[_0xadd2('0x29')](respondWithResult(_0x571636,0xc9))[_0xadd2('0x4a')](handleError(_0x571636,null));};exports['update']=function(_0xd29755,_0x4c5537){if(_0xd29755[_0xadd2('0x57')]['id']){delete _0xd29755[_0xadd2('0x57')]['id'];}return db['Trigger'][_0xadd2('0x4e')]({'where':{'id':_0xd29755[_0xadd2('0x58')]['id']}})[_0xadd2('0x29')](handleEntityNotFound(_0x4c5537,null))['then'](saveUpdates(_0xd29755[_0xadd2('0x57')],null))[_0xadd2('0x29')](respondWithResult(_0x4c5537,null))[_0xadd2('0x4a')](handleError(_0x4c5537,null));};exports[_0xadd2('0x2a')]=function(_0x1a5dc3,_0x3df85d){return db['Trigger'][_0xadd2('0x4e')]({'where':{'id':_0x1a5dc3[_0xadd2('0x58')]['id']}})[_0xadd2('0x29')](handleEntityNotFound(_0x3df85d,null))[_0xadd2('0x29')](removeEntity(_0x3df85d,null))[_0xadd2('0x4a')](handleError(_0x3df85d,null));};exports[_0xadd2('0x59')]=function(_0x301841,_0x1bd125,_0x32e8cd){if(_0x301841['body']['id']){delete _0x301841['body']['id'];}return db['Trigger'][_0xadd2('0x4e')]({'where':{'id':_0x301841['params']['id']}})[_0xadd2('0x29')](handleEntityNotFound(_0x1bd125,null))[_0xadd2('0x29')](function(_0x41c530){if(_0x41c530){_0x301841[_0xadd2('0x57')][_0xadd2('0x5a')]=_0x41c530['id'];return db[_0xadd2('0x5b')]['create'](_0x301841[_0xadd2('0x57')]);}})[_0xadd2('0x29')](respondWithResult(_0x1bd125,null))[_0xadd2('0x4a')](handleError(_0x1bd125,null));};exports[_0xadd2('0x5c')]=function(_0x577753,_0x383b94,_0x44b8e5){if(_0x577753[_0xadd2('0x57')]['id']){delete _0x577753[_0xadd2('0x57')]['id'];}return db[_0xadd2('0x33')][_0xadd2('0x4e')]({'where':{'id':_0x577753[_0xadd2('0x58')]['id']}})[_0xadd2('0x29')](handleEntityNotFound(_0x383b94,null))[_0xadd2('0x29')](function(_0x1d9731){if(_0x1d9731){_0x577753['body'][_0xadd2('0x5d')]=_0x1d9731['id'];return db[_0xadd2('0x5b')]['create'](_0x577753[_0xadd2('0x57')]);}})[_0xadd2('0x29')](respondWithResult(_0x383b94,null))[_0xadd2('0x4a')](handleError(_0x383b94,null));};exports[_0xadd2('0x5e')]=function(_0x1f0df5,_0x362b79,_0x3aad12){var _0x1a451d={};var _0x5dba3a={};var _0x43ee0a;var _0x200323;return db[_0xadd2('0x33')][_0xadd2('0x5f')]({'where':{'id':_0x1f0df5['params']['id']}})[_0xadd2('0x29')](handleEntityNotFound(_0x362b79,null))[_0xadd2('0x29')](function(_0x5a9597){if(_0x5a9597){_0x43ee0a=_0x5a9597;_0x5dba3a[_0xadd2('0x38')]=_['keys'](db['Condition'][_0xadd2('0x34')]);_0x5dba3a[_0xadd2('0x39')]=_['keys'](_0x1f0df5[_0xadd2('0x39')]);_0x5dba3a['filters']=_[_0xadd2('0x3b')](_0x5dba3a[_0xadd2('0x38')],_0x5dba3a['query']);_0x1a451d[_0xadd2('0x3c')]=_[_0xadd2('0x3b')](_0x5dba3a[_0xadd2('0x38')],qs[_0xadd2('0x3d')](_0x1f0df5[_0xadd2('0x39')][_0xadd2('0x3d')]));_0x1a451d[_0xadd2('0x3c')]=_0x1a451d[_0xadd2('0x3c')][_0xadd2('0x4d')]?_0x1a451d[_0xadd2('0x3c')]:_0x5dba3a['model'];_0x1a451d['order']=qs[_0xadd2('0x40')](_0x1f0df5[_0xadd2('0x39')][_0xadd2('0x40')]);_0x1a451d[_0xadd2('0x41')]=qs[_0xadd2('0x3a')](_[_0xadd2('0x42')](_0x1f0df5[_0xadd2('0x39')],_0x5dba3a['filters']));if(_0x1f0df5[_0xadd2('0x39')]['filter']){_0x1a451d['where']=_[_0xadd2('0x44')](_0x1a451d[_0xadd2('0x41')],{'$or':_[_0xadd2('0x32')](_0x1a451d[_0xadd2('0x3c')],function(_0xf1e309){var _0x236f1e={};_0x236f1e[_0xf1e309]={'$like':'%'+_0x1f0df5[_0xadd2('0x39')][_0xadd2('0x43')]+'%'};return _0x236f1e;})});}_0x1a451d=_[_0xadd2('0x44')]({},_0x1a451d,_0x1f0df5[_0xadd2('0x45')]);return _0x43ee0a[_0xadd2('0x5e')](_0x1a451d);}})[_0xadd2('0x29')](function(_0xe094ca){if(_0xe094ca){_0x200323=_0xe094ca[_0xadd2('0x4d')];if(!_0x1f0df5[_0xadd2('0x39')]['hasOwnProperty'](_0xadd2('0x3e'))){_0x1a451d[_0xadd2('0x21')]=qs[_0xadd2('0x21')](_0x1f0df5[_0xadd2('0x39')][_0xadd2('0x21')]);_0x1a451d[_0xadd2('0x1e')]=qs[_0xadd2('0x1e')](_0x1f0df5[_0xadd2('0x39')]['offset']);}return _0x43ee0a[_0xadd2('0x5e')](_0x1a451d);}})[_0xadd2('0x29')](function(_0x3cc9e1){if(_0x3cc9e1){return _0x3cc9e1?{'count':_0x200323,'rows':_0x3cc9e1}:null;}})[_0xadd2('0x29')](respondWithResult(_0x362b79,null))[_0xadd2('0x4a')](handleError(_0x362b79,null));};exports[_0xadd2('0x60')]=function(_0x3e3d4e,_0x3327b4,_0xba94d8){var _0x4f1618={};var _0x5e5639={};var _0x548159;var _0x4c6170;return db[_0xadd2('0x33')]['findOne']({'where':{'id':_0x3e3d4e['params']['id']}})['then'](handleEntityNotFound(_0x3327b4,null))[_0xadd2('0x29')](function(_0x138bf0){if(_0x138bf0){_0x548159=_0x138bf0;_0x5e5639[_0xadd2('0x38')]=_[_0xadd2('0x4c')](db[_0xadd2('0x5b')][_0xadd2('0x34')]);_0x5e5639[_0xadd2('0x39')]=_[_0xadd2('0x4c')](_0x3e3d4e[_0xadd2('0x39')]);_0x5e5639['filters']=_[_0xadd2('0x3b')](_0x5e5639[_0xadd2('0x38')],_0x5e5639[_0xadd2('0x39')]);_0x4f1618[_0xadd2('0x3c')]=_[_0xadd2('0x3b')](_0x5e5639[_0xadd2('0x38')],qs[_0xadd2('0x3d')](_0x3e3d4e[_0xadd2('0x39')][_0xadd2('0x3d')]));_0x4f1618[_0xadd2('0x3c')]=_0x4f1618[_0xadd2('0x3c')][_0xadd2('0x4d')]?_0x4f1618[_0xadd2('0x3c')]:_0x5e5639[_0xadd2('0x38')];_0x4f1618[_0xadd2('0x3f')]=qs[_0xadd2('0x40')](_0x3e3d4e[_0xadd2('0x39')]['sort']);_0x4f1618[_0xadd2('0x41')]=qs[_0xadd2('0x3a')](_[_0xadd2('0x42')](_0x3e3d4e[_0xadd2('0x39')],_0x5e5639[_0xadd2('0x3a')]));if(_0x3e3d4e[_0xadd2('0x39')][_0xadd2('0x43')]){_0x4f1618[_0xadd2('0x41')]=_['merge'](_0x4f1618['where'],{'$or':_[_0xadd2('0x32')](_0x4f1618[_0xadd2('0x3c')],function(_0x273005){var _0x166be3={};_0x166be3[_0x273005]={'$like':'%'+_0x3e3d4e[_0xadd2('0x39')][_0xadd2('0x43')]+'%'};return _0x166be3;})});}_0x4f1618=_[_0xadd2('0x44')]({},_0x4f1618,_0x3e3d4e['options']);return _0x548159[_0xadd2('0x60')](_0x4f1618);}})[_0xadd2('0x29')](function(_0x1aadc6){if(_0x1aadc6){_0x4c6170=_0x1aadc6[_0xadd2('0x4d')];if(!_0x3e3d4e[_0xadd2('0x39')][_0xadd2('0x61')]('nolimit')){_0x4f1618['limit']=qs['limit'](_0x3e3d4e['query']['limit']);_0x4f1618[_0xadd2('0x1e')]=qs['offset'](_0x3e3d4e['query']['offset']);}return _0x548159['getAnyConditions'](_0x4f1618);}})[_0xadd2('0x29')](function(_0x317539){if(_0x317539){return _0x317539?{'count':_0x4c6170,'rows':_0x317539}:null;}})[_0xadd2('0x29')](respondWithResult(_0x3327b4,null))[_0xadd2('0x4a')](handleError(_0x3327b4,null));};exports['addAction']=function(_0x87be57,_0x3f12b9,_0x28880e){if(_0x87be57['body']['id']){delete _0x87be57[_0xadd2('0x57')]['id'];}return db[_0xadd2('0x33')][_0xadd2('0x4e')]({'where':{'id':_0x87be57[_0xadd2('0x58')]['id']}})[_0xadd2('0x29')](handleEntityNotFound(_0x3f12b9,null))[_0xadd2('0x29')](function(_0x3696d8){if(_0x3696d8){_0x87be57[_0xadd2('0x57')][_0xadd2('0x62')]=_0x3696d8['id'];return db[_0xadd2('0x63')][_0xadd2('0x4f')](_0x87be57[_0xadd2('0x57')]);}})[_0xadd2('0x29')](respondWithResult(_0x3f12b9,null))['catch'](handleError(_0x3f12b9,null));};exports[_0xadd2('0x64')]=function(_0x5a3cfa,_0x1c4915,_0x36c17d){var _0x1ec8dd={};var _0x4dab4e={};var _0x336b17;var _0xa0d5b;return db[_0xadd2('0x33')][_0xadd2('0x5f')]({'where':{'id':_0x5a3cfa[_0xadd2('0x58')]['id']}})[_0xadd2('0x29')](handleEntityNotFound(_0x1c4915,null))[_0xadd2('0x29')](function(_0x57f2cd){if(_0x57f2cd){_0x336b17=_0x57f2cd;_0x4dab4e[_0xadd2('0x38')]=_[_0xadd2('0x4c')](db[_0xadd2('0x63')][_0xadd2('0x34')]);_0x4dab4e['query']=_[_0xadd2('0x4c')](_0x5a3cfa[_0xadd2('0x39')]);_0x4dab4e[_0xadd2('0x3a')]=_['intersection'](_0x4dab4e[_0xadd2('0x38')],_0x4dab4e['query']);_0x1ec8dd[_0xadd2('0x3c')]=_[_0xadd2('0x3b')](_0x4dab4e['model'],qs[_0xadd2('0x3d')](_0x5a3cfa[_0xadd2('0x39')][_0xadd2('0x3d')]));_0x1ec8dd[_0xadd2('0x3c')]=_0x1ec8dd[_0xadd2('0x3c')]['length']?_0x1ec8dd['attributes']:_0x4dab4e['model'];_0x1ec8dd[_0xadd2('0x3f')]=qs[_0xadd2('0x40')](_0x5a3cfa[_0xadd2('0x39')]['sort']);_0x1ec8dd['where']=qs[_0xadd2('0x3a')](_['pick'](_0x5a3cfa['query'],_0x4dab4e['filters']));if(_0x5a3cfa[_0xadd2('0x39')][_0xadd2('0x43')]){_0x1ec8dd[_0xadd2('0x41')]=_[_0xadd2('0x44')](_0x1ec8dd[_0xadd2('0x41')],{'$or':_[_0xadd2('0x32')](_0x1ec8dd[_0xadd2('0x3c')],function(_0x35903b){var _0x41f4d1={};_0x41f4d1[_0x35903b]={'$like':'%'+_0x5a3cfa[_0xadd2('0x39')][_0xadd2('0x43')]+'%'};return _0x41f4d1;})});}_0x1ec8dd=_[_0xadd2('0x44')]({},_0x1ec8dd,_0x5a3cfa[_0xadd2('0x45')]);return _0x336b17[_0xadd2('0x64')](_0x1ec8dd);}})['then'](function(_0x9c30b7){if(_0x9c30b7){_0xa0d5b=_0x9c30b7[_0xadd2('0x4d')];if(!_0x5a3cfa[_0xadd2('0x39')][_0xadd2('0x61')](_0xadd2('0x3e'))){_0x1ec8dd[_0xadd2('0x21')]=qs['limit'](_0x5a3cfa[_0xadd2('0x39')][_0xadd2('0x21')]);_0x1ec8dd['offset']=qs[_0xadd2('0x1e')](_0x5a3cfa['query']['offset']);}return _0x336b17['getActions'](_0x1ec8dd);}})[_0xadd2('0x29')](function(_0xe4b12f){if(_0xe4b12f){return _0xe4b12f?{'count':_0xa0d5b,'rows':_0xe4b12f}:null;}})[_0xadd2('0x29')](respondWithResult(_0x1c4915,null))[_0xadd2('0x4a')](handleError(_0x1c4915,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index d825773..29554be 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 _0x8e0f=['exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./trigger.attributes'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x8e0f,0x12f));var _0xf8e0=function(_0x23dfa8,_0x1a0716){_0x23dfa8=_0x23dfa8-0x0;var _0x50301f=_0x8e0f[_0x23dfa8];return _0x50301f;};'use strict';var _=require(_0xf8e0('0x0'));var util=require(_0xf8e0('0x1'));var logger=require(_0xf8e0('0x2'))(_0xf8e0('0x3'));var moment=require(_0xf8e0('0x4'));var BPromise=require(_0xf8e0('0x5'));var rp=require(_0xf8e0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8e0('0x7'));var config=require('../../config/environment');var attributes=require(_0xf8e0('0x8'));module[_0xf8e0('0x9')]=function(_0x4f3b30,_0x2921b3){return _0x4f3b30[_0xf8e0('0xa')](_0xf8e0('0xb'),attributes,{'tableName':_0xf8e0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b7c=['tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./trigger.attributes','exports','define','Trigger'];(function(_0x2af053,_0x4f6d28){var _0x4b4001=function(_0x9200c1){while(--_0x9200c1){_0x2af053['push'](_0x2af053['shift']());}};_0x4b4001(++_0x4f6d28);}(_0x8b7c,0x119));var _0xc8b7=function(_0x4b3f3e,_0x47dfcc){_0x4b3f3e=_0x4b3f3e-0x0;var _0x921fc3=_0x8b7c[_0x4b3f3e];return _0x921fc3;};'use strict';var _=require(_0xc8b7('0x0'));var util=require(_0xc8b7('0x1'));var logger=require(_0xc8b7('0x2'))(_0xc8b7('0x3'));var moment=require(_0xc8b7('0x4'));var BPromise=require(_0xc8b7('0x5'));var rp=require(_0xc8b7('0x6'));var fs=require('fs');var path=require(_0xc8b7('0x7'));var rimraf=require('rimraf');var config=require(_0xc8b7('0x8'));var attributes=require(_0xc8b7('0x9'));module[_0xc8b7('0xa')]=function(_0x4a8b93,_0x256c78){return _0x4a8b93[_0xc8b7('0xb')](_0xc8b7('0xc'),attributes,{'tableName':_0xc8b7('0xd'),'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 1edf2a4..32608df 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 _0xa68c=['Trigger,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetTrigger','options','raw','attributes','include','map','model','stringify','ShowTrigger','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x87b368,_0x1165fb){var _0x5761ae=function(_0x5a6d4f){while(--_0x5a6d4f){_0x87b368['push'](_0x87b368['shift']());}};_0x5761ae(++_0x1165fb);}(_0xa68c,0xef));var _0xca68=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa68c[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0xca68('0x0'));var util=require('util');var moment=require(_0xca68('0x1'));var BPromise=require(_0xca68('0x2'));var rs=require(_0xca68('0x3'));var fs=require('fs');var Redis=require(_0xca68('0x4'));var db=require(_0xca68('0x5'))['db'];var utils=require(_0xca68('0x6'));var logger=require(_0xca68('0x7'))(_0xca68('0x8'));var config=require(_0xca68('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xca68('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc04237,_0x7415d7,_0x5a4564){return new BPromise(function(_0x33aada,_0x4268d9){return client[_0xca68('0xb')](_0xc04237,_0x5a4564)[_0xca68('0xc')](function(_0x28a9e5){logger[_0xca68('0xd')](_0xca68('0xe'),_0x7415d7,_0xca68('0xf'));logger[_0xca68('0x10')](_0xca68('0x11'),_0x7415d7,'request\x20sent',JSON['stringify'](_0x28a9e5));if(_0x28a9e5[_0xca68('0x12')]){if(_0x28a9e5[_0xca68('0x12')]['code']===0x1f4){logger[_0xca68('0x12')](_0xca68('0xe'),_0x7415d7,_0x28a9e5[_0xca68('0x12')][_0xca68('0x13')]);return _0x4268d9(_0x28a9e5['error'][_0xca68('0x13')]);}logger['error'](_0xca68('0xe'),_0x7415d7,_0x28a9e5[_0xca68('0x12')][_0xca68('0x13')]);return _0x33aada(_0x28a9e5['error'][_0xca68('0x13')]);}else{logger[_0xca68('0xd')](_0xca68('0xe'),_0x7415d7,'request\x20sent');_0x33aada(_0x28a9e5[_0xca68('0x14')][_0xca68('0x13')]);}})[_0xca68('0x15')](function(_0x179436){logger['error'](_0xca68('0xe'),_0x7415d7,_0x179436);_0x4268d9(_0x179436);});});}exports[_0xca68('0x16')]=function(_0x3aaace){var _0x369ff8=this;return new Promise(function(_0xc62f09,_0x583cd9){return db['Trigger']['findAll']({'raw':_0x3aaace['options']?_0x3aaace[_0xca68('0x17')][_0xca68('0x18')]===undefined?!![]:![]:!![],'where':_0x3aaace['options']?_0x3aaace[_0xca68('0x17')]['where']||null:null,'attributes':_0x3aaace['options']?_0x3aaace['options'][_0xca68('0x19')]||null:null,'limit':_0x3aaace['options']?_0x3aaace[_0xca68('0x17')]['limit']||null:null,'include':_0x3aaace[_0xca68('0x17')]?_0x3aaace['options']['include']?_['map'](_0x3aaace[_0xca68('0x17')][_0xca68('0x1a')],function(_0x529a1d){return{'model':db[_0x529a1d['model']],'as':_0x529a1d['as'],'attributes':_0x529a1d[_0xca68('0x19')],'include':_0x529a1d[_0xca68('0x1a')]?_[_0xca68('0x1b')](_0x529a1d[_0xca68('0x1a')],function(_0x3ed7a4){return{'model':db[_0x3ed7a4[_0xca68('0x1c')]],'as':_0x3ed7a4['as'],'attributes':_0x3ed7a4[_0xca68('0x19')],'include':_0x3ed7a4[_0xca68('0x1a')]?_[_0xca68('0x1b')](_0x3ed7a4['include'],function(_0x49472e){return{'model':db[_0x49472e[_0xca68('0x1c')]],'as':_0x49472e['as'],'attributes':_0x49472e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fd861){logger[_0xca68('0xd')](_0xca68('0x16'),_0x3aaace);logger[_0xca68('0x10')]('GetTrigger',_0x3aaace,JSON[_0xca68('0x1d')](_0x2fd861));_0xc62f09(_0x2fd861);})[_0xca68('0x15')](function(_0x4f820e){logger[_0xca68('0x12')](_0xca68('0x16'),_0x4f820e[_0xca68('0x13')],_0x3aaace);_0x583cd9(_0x369ff8[_0xca68('0x12')](0x1f4,_0x4f820e[_0xca68('0x13')]));});});};exports[_0xca68('0x1e')]=function(_0x5dd67e){var _0x1e71cd=this;return new Promise(function(_0x28854c,_0x4d4387){return db['Trigger']['find']({'raw':_0x5dd67e[_0xca68('0x17')]?_0x5dd67e[_0xca68('0x17')][_0xca68('0x18')]===undefined?!![]:![]:!![],'where':_0x5dd67e[_0xca68('0x17')]?_0x5dd67e[_0xca68('0x17')][_0xca68('0x1f')]||null:null,'attributes':_0x5dd67e[_0xca68('0x17')]?_0x5dd67e['options'][_0xca68('0x19')]||null:null,'include':_0x5dd67e[_0xca68('0x17')]?_0x5dd67e[_0xca68('0x17')][_0xca68('0x1a')]?_[_0xca68('0x1b')](_0x5dd67e[_0xca68('0x17')][_0xca68('0x1a')],function(_0x50f8ae){return{'model':db[_0x50f8ae[_0xca68('0x1c')]],'as':_0x50f8ae['as'],'attributes':_0x50f8ae[_0xca68('0x19')],'include':_0x50f8ae[_0xca68('0x1a')]?_[_0xca68('0x1b')](_0x50f8ae[_0xca68('0x1a')],function(_0x199fdb){return{'model':db[_0x199fdb[_0xca68('0x1c')]],'as':_0x199fdb['as'],'attributes':_0x199fdb[_0xca68('0x19')],'include':_0x199fdb[_0xca68('0x1a')]?_[_0xca68('0x1b')](_0x199fdb[_0xca68('0x1a')],function(_0xf56c71){return{'model':db[_0xf56c71[_0xca68('0x1c')]],'as':_0xf56c71['as'],'attributes':_0xf56c71[_0xca68('0x19')]};}):[]};}):[]};}):[]:[]})[_0xca68('0xc')](function(_0x4fb37e){logger[_0xca68('0xd')](_0xca68('0x1e'),_0x5dd67e);logger[_0xca68('0x10')](_0xca68('0x1e'),_0x5dd67e,JSON[_0xca68('0x1d')](_0x4fb37e));_0x28854c(_0x4fb37e);})[_0xca68('0x15')](function(_0x3c0501){logger[_0xca68('0x12')](_0xca68('0x1e'),_0x3c0501[_0xca68('0x13')],_0x5dd67e);_0x4d4387(_0x1e71cd[_0xca68('0x12')](0x1f4,_0x3c0501['message']));});});}; \ No newline at end of file +var _0x682f=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','info','Trigger','options','raw','where','attributes','limit','include','model','map','GetTrigger','stringify','catch','ShowTrigger','find','lodash'];(function(_0xc5b4b8,_0x5d3dcb){var _0x5e24d5=function(_0x3416c4){while(--_0x3416c4){_0xc5b4b8['push'](_0xc5b4b8['shift']());}};_0x5e24d5(++_0x5d3dcb);}(_0x682f,0x11f));var _0xf682=function(_0x17598f,_0x5a866a){_0x17598f=_0x17598f-0x0;var _0x2cef9c=_0x682f[_0x17598f];return _0x2cef9c;};'use strict';var _=require(_0xf682('0x0'));var util=require(_0xf682('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf682('0x2'));var fs=require('fs');var Redis=require(_0xf682('0x3'));var db=require(_0xf682('0x4'))['db'];var utils=require(_0xf682('0x5'));var logger=require(_0xf682('0x6'))(_0xf682('0x7'));var config=require(_0xf682('0x8'));var jayson=require(_0xf682('0x9'));var client=jayson[_0xf682('0xa')][_0xf682('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c6985,_0x3f86b1,_0x23def6){return new BPromise(function(_0x1edaf6,_0x119baa){return client[_0xf682('0xc')](_0x3c6985,_0x23def6)[_0xf682('0xd')](function(_0x433af4){logger['info'](_0xf682('0xe'),_0x3f86b1,_0xf682('0xf'));logger[_0xf682('0x10')](_0xf682('0x11'),_0x3f86b1,_0xf682('0xf'),JSON['stringify'](_0x433af4));if(_0x433af4[_0xf682('0x12')]){if(_0x433af4[_0xf682('0x12')][_0xf682('0x13')]===0x1f4){logger[_0xf682('0x12')](_0xf682('0xe'),_0x3f86b1,_0x433af4[_0xf682('0x12')]['message']);return _0x119baa(_0x433af4[_0xf682('0x12')][_0xf682('0x14')]);}logger[_0xf682('0x12')]('Trigger,\x20%s,\x20%s',_0x3f86b1,_0x433af4['error'][_0xf682('0x14')]);return _0x1edaf6(_0x433af4[_0xf682('0x12')]['message']);}else{logger[_0xf682('0x15')](_0xf682('0xe'),_0x3f86b1,_0xf682('0xf'));_0x1edaf6(_0x433af4['result'][_0xf682('0x14')]);}})['catch'](function(_0x983597){logger['error']('Trigger,\x20%s,\x20%s',_0x3f86b1,_0x983597);_0x119baa(_0x983597);});});}exports['GetTrigger']=function(_0x37a681){var _0x92c789=this;return new Promise(function(_0x13a8dd,_0x462b56){return db[_0xf682('0x16')]['findAll']({'raw':_0x37a681[_0xf682('0x17')]?_0x37a681[_0xf682('0x17')][_0xf682('0x18')]===undefined?!![]:![]:!![],'where':_0x37a681['options']?_0x37a681['options'][_0xf682('0x19')]||null:null,'attributes':_0x37a681['options']?_0x37a681[_0xf682('0x17')][_0xf682('0x1a')]||null:null,'limit':_0x37a681[_0xf682('0x17')]?_0x37a681[_0xf682('0x17')][_0xf682('0x1b')]||null:null,'include':_0x37a681[_0xf682('0x17')]?_0x37a681[_0xf682('0x17')][_0xf682('0x1c')]?_['map'](_0x37a681[_0xf682('0x17')][_0xf682('0x1c')],function(_0x5dcfb9){return{'model':db[_0x5dcfb9[_0xf682('0x1d')]],'as':_0x5dcfb9['as'],'attributes':_0x5dcfb9[_0xf682('0x1a')],'include':_0x5dcfb9['include']?_['map'](_0x5dcfb9[_0xf682('0x1c')],function(_0x505249){return{'model':db[_0x505249[_0xf682('0x1d')]],'as':_0x505249['as'],'attributes':_0x505249[_0xf682('0x1a')],'include':_0x505249['include']?_[_0xf682('0x1e')](_0x505249[_0xf682('0x1c')],function(_0x218656){return{'model':db[_0x218656['model']],'as':_0x218656['as'],'attributes':_0x218656[_0xf682('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf682('0xd')](function(_0x1389fc){logger[_0xf682('0x15')](_0xf682('0x1f'),_0x37a681);logger[_0xf682('0x10')](_0xf682('0x1f'),_0x37a681,JSON[_0xf682('0x20')](_0x1389fc));_0x13a8dd(_0x1389fc);})[_0xf682('0x21')](function(_0x5c787f){logger[_0xf682('0x12')](_0xf682('0x1f'),_0x5c787f['message'],_0x37a681);_0x462b56(_0x92c789[_0xf682('0x12')](0x1f4,_0x5c787f['message']));});});};exports[_0xf682('0x22')]=function(_0x1f0059){var _0x43cf22=this;return new Promise(function(_0x1a44cd,_0x1b313a){return db['Trigger'][_0xf682('0x23')]({'raw':_0x1f0059[_0xf682('0x17')]?_0x1f0059[_0xf682('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1f0059[_0xf682('0x17')]?_0x1f0059[_0xf682('0x17')]['where']||null:null,'attributes':_0x1f0059[_0xf682('0x17')]?_0x1f0059['options'][_0xf682('0x1a')]||null:null,'include':_0x1f0059['options']?_0x1f0059[_0xf682('0x17')][_0xf682('0x1c')]?_[_0xf682('0x1e')](_0x1f0059[_0xf682('0x17')]['include'],function(_0x579d5f){return{'model':db[_0x579d5f[_0xf682('0x1d')]],'as':_0x579d5f['as'],'attributes':_0x579d5f[_0xf682('0x1a')],'include':_0x579d5f['include']?_[_0xf682('0x1e')](_0x579d5f[_0xf682('0x1c')],function(_0x5c232e){return{'model':db[_0x5c232e[_0xf682('0x1d')]],'as':_0x5c232e['as'],'attributes':_0x5c232e[_0xf682('0x1a')],'include':_0x5c232e[_0xf682('0x1c')]?_[_0xf682('0x1e')](_0x5c232e[_0xf682('0x1c')],function(_0x466ec8){return{'model':db[_0x466ec8[_0xf682('0x1d')]],'as':_0x466ec8['as'],'attributes':_0x466ec8[_0xf682('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ac41b){logger[_0xf682('0x15')](_0xf682('0x22'),_0x1f0059);logger[_0xf682('0x10')](_0xf682('0x22'),_0x1f0059,JSON[_0xf682('0x20')](_0x2ac41b));_0x1a44cd(_0x2ac41b);})[_0xf682('0x21')](function(_0x2e1735){logger[_0xf682('0x12')](_0xf682('0x22'),_0x2e1735['message'],_0x1f0059);_0x1b313a(_0x43cf22[_0xf682('0x12')](0x1f4,_0x2e1735[_0xf682('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 13dd3e1..5e52f66 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 _0xf7a6=['/:id/clone','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../config/environment','./trunk.controller','get','isAuthenticated','index','show'];(function(_0x13c2cf,_0x568ba5){var _0x237785=function(_0x57095a){while(--_0x57095a){_0x13c2cf['push'](_0x13c2cf['shift']());}};_0x237785(++_0x568ba5);}(_0xf7a6,0x135));var _0x6f7a=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xf7a6[_0x1deb03];return _0x189fe7;};'use strict';var multer=require(_0x6f7a('0x0'));var util=require(_0x6f7a('0x1'));var path=require(_0x6f7a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6f7a('0x3')]();var fs_extra=require(_0x6f7a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6f7a('0x5'));var controller=require(_0x6f7a('0x6'));router[_0x6f7a('0x7')]('/',auth[_0x6f7a('0x8')](),controller[_0x6f7a('0x9')]);router[_0x6f7a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x6f7a('0xa')]);router['post'](_0x6f7a('0xb'),auth[_0x6f7a('0x8')](),controller['clone']);router[_0x6f7a('0xc')]('/',auth['isAuthenticated'](),controller[_0x6f7a('0xd')]);router[_0x6f7a('0xe')](_0x6f7a('0xf'),auth['isAuthenticated'](),controller[_0x6f7a('0x10')]);router[_0x6f7a('0x11')](_0x6f7a('0xf'),auth[_0x6f7a('0x8')](),controller[_0x6f7a('0x12')]);module[_0x6f7a('0x13')]=router; \ No newline at end of file +var _0x9114=['put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','index','get','/:id','post','/:id/clone','create'];(function(_0x34a7ca,_0x3e2363){var _0x2047f2=function(_0x40a989){while(--_0x40a989){_0x34a7ca['push'](_0x34a7ca['shift']());}};_0x2047f2(++_0x3e2363);}(_0x9114,0x17f));var _0x4911=function(_0x5533a3,_0x4325f8){_0x5533a3=_0x5533a3-0x0;var _0x29e227=_0x9114[_0x5533a3];return _0x29e227;};'use strict';var multer=require(_0x4911('0x0'));var util=require(_0x4911('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4911('0x2'));var router=express[_0x4911('0x3')]();var fs_extra=require(_0x4911('0x4'));var auth=require(_0x4911('0x5'));var interaction=require(_0x4911('0x6'));var config=require(_0x4911('0x7'));var controller=require(_0x4911('0x8'));router['get']('/',auth[_0x4911('0x9')](),controller[_0x4911('0xa')]);router[_0x4911('0xb')](_0x4911('0xc'),auth[_0x4911('0x9')](),controller['show']);router[_0x4911('0xd')](_0x4911('0xe'),auth[_0x4911('0x9')](),controller['clone']);router[_0x4911('0xd')]('/',auth[_0x4911('0x9')](),controller[_0x4911('0xf')]);router[_0x4911('0x10')]('/:id',auth[_0x4911('0x9')](),controller[_0x4911('0x11')]);router[_0x4911('0x12')](_0x4911('0xc'),auth[_0x4911('0x9')](),controller[_0x4911('0x13')]);module[_0x4911('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index e972ccf..33532ca 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 _0x6341=['friend','user','peer','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','getDataValue','ENUM','rfc2833','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','setDataValue','nat','join','split','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','never','\x22\x22\x20<>','always','INTEGER','accept','refuse','originate','uac','uas','pai','certificate','active','passive','dynamic','update,nonat','BOOLEAN','exports','STRING','name'];(function(_0x50f6a6,_0x488f1e){var _0x5d3a27=function(_0x50db25){while(--_0x50db25){_0x50f6a6['push'](_0x50f6a6['shift']());}};_0x5d3a27(++_0x488f1e);}(_0x6341,0x162));var _0x1634=function(_0x1ca980,_0x1fe290){_0x1ca980=_0x1ca980-0x0;var _0x5db42a=_0x6341[_0x1ca980];return _0x5db42a;};'use strict';var Sequelize=require('sequelize');module[_0x1634('0x0')]={'name':{'type':Sequelize[_0x1634('0x1')],'allowNull':![],'unique':_0x1634('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x1634('0x3'),_0x1634('0x4'),_0x1634('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x1634('0x1')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x1634('0x6'),_0x1634('0x7'),_0x1634('0x8'),_0x1634('0x9'),_0x1634('0xa'),_0x1634('0xb'),_0x1634('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x1634('0x1')]},'secret':{'type':Sequelize[_0x1634('0x1')]},'md5secret':{'type':Sequelize[_0x1634('0x1')]},'remotesecret':{'type':Sequelize[_0x1634('0x1')]},'transport':{'type':Sequelize[_0x1634('0x1')],'defaultValue':_0x1634('0xd'),'set':function(_0x22451b){this['setDataValue']('transport',_0x22451b?_0x22451b['join'](','):null);},'get':function(){return this[_0x1634('0xe')]('transport')?this[_0x1634('0xe')]('transport')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x1634('0xf')](_0x1634('0x10'),'info','shortinfo',_0x1634('0x11'),_0x1634('0x12')),'defaultValue':_0x1634('0x10')},'directmedia':{'type':Sequelize[_0x1634('0xf')](_0x1634('0x13'),'no',_0x1634('0x14'),_0x1634('0x15'),_0x1634('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1634('0xf')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1634('0x1')]},'directmediadeny':{'type':Sequelize[_0x1634('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x1634('0x17'),'set':function(_0xabe70e){this[_0x1634('0x18')](_0x1634('0x19'),_0xabe70e?_0xabe70e[_0x1634('0x1a')](','):null);},'get':function(){return this[_0x1634('0xe')](_0x1634('0x19'))?this[_0x1634('0xe')](_0x1634('0x19'))[_0x1634('0x1b')](','):null;},'comment':_0x1634('0x1c')},'callgroup':{'type':Sequelize[_0x1634('0x1')]},'namedcallgroup':{'type':Sequelize[_0x1634('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1634('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1634('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x1634('0x1')],'defaultValue':_0x1634('0x1d')},'allow':{'type':Sequelize[_0x1634('0x1')],'allowNull':![],'defaultValue':_0x1634('0x1e'),'set':function(_0x3f9d50){this['setDataValue']('allow',_0x3f9d50?_0x3f9d50[_0x1634('0x1a')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x1634('0x1f'))?this[_0x1634('0xe')](_0x1634('0x1f'))['split'](';'):null;},'comment':_0x1634('0x20')},'autoframing':{'type':Sequelize[_0x1634('0xf')]('yes','no')},'insecure':{'type':Sequelize[_0x1634('0x1')],'defaultValue':_0x1634('0x21'),'set':function(_0x3dcadd){this[_0x1634('0x18')](_0x1634('0x22'),_0x3dcadd?_0x3dcadd[_0x1634('0x1a')](','):null);},'get':function(){return this[_0x1634('0xe')](_0x1634('0x22'))?this['getDataValue'](_0x1634('0x22'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1634('0xf')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x1634('0x23'))},'promiscredir':{'type':Sequelize[_0x1634('0xf')](_0x1634('0x13'),'no')},'useclientcode':{'type':Sequelize[_0x1634('0xf')](_0x1634('0x13'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x1634('0x1')]},'callerid':{'type':Sequelize[_0x1634('0x1')],'defaultValue':_0x1634('0x24')},'amaflags':{'type':Sequelize[_0x1634('0x1')]},'callcounter':{'type':Sequelize[_0x1634('0xf')](_0x1634('0x13'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x1634('0xf')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x1634('0x13'),'no')},'allowtransfer':{'type':Sequelize[_0x1634('0xf')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x1634('0xf')](_0x1634('0x13'),'no')},'subscribecontext':{'type':Sequelize[_0x1634('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x1634('0xf')](_0x1634('0x13'),'no',_0x1634('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1634('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x1634('0xf')](_0x1634('0x13'),'no')},'mailbox':{'type':Sequelize[_0x1634('0x1')]},'session_timers':{'type':Sequelize['ENUM'](_0x1634('0x27'),_0x1634('0x28'),_0x1634('0x29'))},'session_expires':{'type':Sequelize[_0x1634('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x1634('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x1634('0xf')](_0x1634('0x2a'),_0x1634('0x2b')),'defaultValue':_0x1634('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x1634('0x1')]},'regexten':{'type':Sequelize[_0x1634('0x1')]},'fromdomain':{'type':Sequelize[_0x1634('0x1')]},'fromuser':{'type':Sequelize[_0x1634('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x1634('0xf')](_0x1634('0x13'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x1634('0x1')]},'defaultuser':{'type':Sequelize[_0x1634('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x1634('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x1634('0x26')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x1634('0x13'),'no',_0x1634('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1634('0x1')]},'callbackextension':{'type':Sequelize[_0x1634('0x1')]},'timert1':{'type':Sequelize[_0x1634('0x26')](0xb)},'timerb':{'type':Sequelize[_0x1634('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0x1634('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x1634('0x1')]},'contactdeny':{'type':Sequelize[_0x1634('0x1')]},'contactacl':{'type':Sequelize[_0x1634('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x1634('0x1')]},'use_q850_reason':{'type':Sequelize[_0x1634('0x1')]},'maxforwards':{'type':Sequelize[_0x1634('0x26')](0xb)},'encryption':{'type':Sequelize[_0x1634('0xf')](_0x1634('0x13'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x1634('0x13'),'no')},'force_avp':{'type':Sequelize[_0x1634('0xf')](_0x1634('0x13'),'no')},'icesupport':{'type':Sequelize[_0x1634('0xf')](_0x1634('0x13'),'no')},'dtlsenable':{'type':Sequelize[_0x1634('0xf')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x1634('0xf')](_0x1634('0x13'),'no','fingerprint',_0x1634('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x1634('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x1634('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x1634('0x1')]},'dtlscipher':{'type':Sequelize[_0x1634('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x1634('0x1')]},'dtlssetup':{'type':Sequelize[_0x1634('0xf')](_0x1634('0x2e'),_0x1634('0x2f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x1634('0xf')](_0x1634('0x13'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1634('0x1')]},'recordofffeature':{'type':Sequelize[_0x1634('0x1')]},'call_limit':{'type':Sequelize[_0x1634('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x1634('0xf')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x1634('0xf')](_0x1634('0x13'),'no')},'vmexten':{'type':Sequelize[_0x1634('0x1')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x1634('0x1')]},'parkinglot':{'type':Sequelize[_0x1634('0x1')]},'description':{'type':Sequelize[_0x1634('0x1')]},'host':{'type':Sequelize[_0x1634('0x1')],'defaultValue':_0x1634('0x30')},'canreinvite':{'type':Sequelize['ENUM'](_0x1634('0x13'),'no','nonat','update',_0x1634('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x1634('0x1')]},'otherFields':{'type':Sequelize[_0x1634('0x1')]},'active':{'type':Sequelize[_0x1634('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x1634('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x3541=['update','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]','never','INTEGER','always','accept','refuse','uac','uas','pai','fingerprint','certificate','active','actpass','update,nonat','BOOLEAN','STRING','name','friend','peer','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','auto','yes','nonat'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x3541,0x108));var _0x1354=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x3541[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1354('0x0')],'allowNull':![],'unique':_0x1354('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x1354('0x2'),'user',_0x1354('0x3')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x5'),'ALLOWED_PASSED_SCREEN',_0x1354('0x6'),_0x1354('0x7'),_0x1354('0x8'),_0x1354('0x9'),_0x1354('0xa'),_0x1354('0xb'))},'deny':{'type':Sequelize[_0x1354('0x0')]},'permit':{'type':Sequelize[_0x1354('0x0')]},'secret':{'type':Sequelize[_0x1354('0x0')]},'md5secret':{'type':Sequelize[_0x1354('0x0')]},'remotesecret':{'type':Sequelize[_0x1354('0x0')]},'transport':{'type':Sequelize[_0x1354('0x0')],'defaultValue':_0x1354('0xc'),'set':function(_0x39bc4c){this[_0x1354('0xd')]('transport',_0x39bc4c?_0x39bc4c[_0x1354('0xe')](','):null);},'get':function(){return this[_0x1354('0xf')]('transport')?this[_0x1354('0xf')](_0x1354('0x10'))[_0x1354('0x11')](','):null;},'comment':_0x1354('0x12')},'dtmfmode':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x13'),_0x1354('0x14'),'shortinfo','inband',_0x1354('0x15')),'defaultValue':_0x1354('0x13')},'directmedia':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no',_0x1354('0x17'),_0x1354('0x18'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1354('0x0')]},'directmediadeny':{'type':Sequelize[_0x1354('0x0')]},'nat':{'type':Sequelize[_0x1354('0x0')],'defaultValue':'force_rport,comedia','set':function(_0x4b77c1){this[_0x1354('0xd')]('nat',_0x4b77c1?_0x4b77c1[_0x1354('0xe')](','):null);},'get':function(){return this[_0x1354('0xf')](_0x1354('0x19'))?this['getDataValue']('nat')['split'](','):null;},'comment':_0x1354('0x1a')},'callgroup':{'type':Sequelize[_0x1354('0x0')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x1354('0x0')]},'namedpickupgroup':{'type':Sequelize[_0x1354('0x0')]},'language':{'type':Sequelize[_0x1354('0x0')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1354('0x0')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x1354('0x0')],'defaultValue':_0x1354('0x1b')},'allow':{'type':Sequelize[_0x1354('0x0')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x20e712){this[_0x1354('0xd')]('allow',_0x20e712?_0x20e712[_0x1354('0xe')](';'):_0x1354('0x1c'));},'get':function(){return this[_0x1354('0xf')]('allow')?this[_0x1354('0xf')](_0x1354('0x1d'))[_0x1354('0x11')](';'):null;},'comment':_0x1354('0x1e')},'autoframing':{'type':Sequelize['ENUM'](_0x1354('0x16'),'no')},'insecure':{'type':Sequelize[_0x1354('0x0')],'defaultValue':_0x1354('0x1f'),'set':function(_0x423a34){this['setDataValue'](_0x1354('0x20'),_0x423a34?_0x423a34['join'](','):null);},'get':function(){return this['getDataValue'](_0x1354('0x20'))?this[_0x1354('0xf')](_0x1354('0x20'))[_0x1354('0x11')](','):null;},'comment':_0x1354('0x21')},'trustrpid':{'type':Sequelize['ENUM'](_0x1354('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no',_0x1354('0x22'))},'promiscredir':{'type':Sequelize['ENUM'](_0x1354('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x1354('0x4')]('yes','no')},'accountcode':{'type':Sequelize[_0x1354('0x23')](0xb)},'setvar':{'type':Sequelize[_0x1354('0x0')]},'callerid':{'type':Sequelize[_0x1354('0x0')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x1354('0x0')]},'callcounter':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no'),'defaultValue':_0x1354('0x16')},'busylevel':{'type':Sequelize[_0x1354('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x1354('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x1354('0x0')]},'template':{'type':Sequelize[_0x1354('0x0')]},'videosupport':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no',_0x1354('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1354('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no')},'mailbox':{'type':Sequelize[_0x1354('0x0')]},'session_timers':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x25'),_0x1354('0x26'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x1354('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x27'),_0x1354('0x28')),'defaultValue':_0x1354('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x1354('0x0')]},'regexten':{'type':Sequelize[_0x1354('0x0')]},'fromdomain':{'type':Sequelize[_0x1354('0x0')]},'fromuser':{'type':Sequelize[_0x1354('0x0')]},'port':{'type':Sequelize[_0x1354('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x1354('0x16'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x1354('0x0')]},'defaultuser':{'type':Sequelize[_0x1354('0x0')]},'rtptimeout':{'type':Sequelize[_0x1354('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x1354('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0x1354('0x4')]('yes','no',_0x1354('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1354('0x0')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x1354('0x23')](0xb)},'timerb':{'type':Sequelize[_0x1354('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x1354('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x1354('0x0')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x1354('0x0')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x1354('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1354('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no')},'icesupport':{'type':Sequelize[_0x1354('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x1354('0x4')]('yes','no',_0x1354('0x2a'),_0x1354('0x2b'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x1354('0x0')]},'dtlsprivatekey':{'type':Sequelize[_0x1354('0x0')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x1354('0x0')]},'dtlscapath':{'type':Sequelize[_0x1354('0x0')]},'dtlssetup':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x2c'),'passive',_0x1354('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1354('0x0')]},'recordofffeature':{'type':Sequelize[_0x1354('0x0')]},'call_limit':{'type':Sequelize[_0x1354('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no')},'vmexten':{'type':Sequelize[_0x1354('0x0')]},'mohinterpret':{'type':Sequelize[_0x1354('0x0')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x1354('0x0')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no',_0x1354('0x17'),_0x1354('0x18'),_0x1354('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x1354('0x0')]},'otherFields':{'type':Sequelize[_0x1354('0x0')]},'active':{'type':Sequelize[_0x1354('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'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 941aff9..0c4a7bf 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 _0x9bde=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','VIRTUAL','merge','Trunk','includeAll','findAll','rows','show','params','fields','include','options','clone','find','omit','createdAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/registry.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','root','server/files/templates/trunk.ejs','writeFileSync','rimraf'];(function(_0x5e9018,_0x5d3a28){var _0x2062e2=function(_0x4aa0d8){while(--_0x4aa0d8){_0x5e9018['push'](_0x5e9018['shift']());}};_0x2062e2(++_0x5d3a28);}(_0x9bde,0xe1));var _0xe9bd=function(_0x20d9d1,_0x3cb8e9){_0x20d9d1=_0x20d9d1-0x0;var _0x56d38b=_0x9bde[_0x20d9d1];return _0x56d38b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe9bd('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x220d07,_0x429e88,_0x3435b4,_0x51109f){return new BPromise(function(_0x47ba5e,_0x46a95e){var _0x248818=_0x51109f||client;return _0x248818[_0xe9bd('0x1a')](_0x220d07,_0x3435b4)[_0xe9bd('0x1b')](function(_0x3360bd){logger[_0xe9bd('0x1c')](_0xe9bd('0x1d'),_0x429e88,'request\x20sent');logger[_0xe9bd('0x1e')](_0xe9bd('0x1f'),_0x429e88,_0xe9bd('0x20'),JSON['stringify'](_0x3360bd));if(_0x3360bd[_0xe9bd('0x21')]){if(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x22')]===0x1f4){logger[_0xe9bd('0x21')]('Trunk,\x20%s,\x20%s',_0x429e88,_0x3360bd[_0xe9bd('0x21')]['message']);return _0x46a95e(_0x3360bd[_0xe9bd('0x21')]['message']);}logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);return _0x47ba5e(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);}else{logger[_0xe9bd('0x1c')]('Trunk,\x20%s,\x20%s',_0x429e88,_0xe9bd('0x20'));_0x47ba5e(_0x3360bd[_0xe9bd('0x24')]['message']);}})[_0xe9bd('0x25')](function(_0x505c23){logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x505c23);_0x46a95e(_0x505c23);});});}function respondWithStatusCode(_0x36f8c0,_0xf02209){_0xf02209=_0xf02209||0xcc;return function(_0x5bc4bf){if(_0x5bc4bf){return _0x36f8c0[_0xe9bd('0x26')](_0xf02209);}return _0x36f8c0[_0xe9bd('0x27')](_0xf02209)[_0xe9bd('0x28')]();};}function respondWithResult(_0x39b206,_0x2641be){_0x2641be=_0x2641be||0xc8;return function(_0xb52d45){if(_0xb52d45){return _0x39b206[_0xe9bd('0x27')](_0x2641be)[_0xe9bd('0x29')](_0xb52d45);}};}function respondWithFilteredResult(_0x1ae889,_0x5987af){return function(_0x3c211a){if(_0x3c211a){var _0x38fdfa=typeof _0x5987af['offset']===_0xe9bd('0x2a')&&typeof _0x5987af[_0xe9bd('0x2b')]===_0xe9bd('0x2a');var _0x429055=_0x3c211a[_0xe9bd('0x2c')];var _0x183601=_0x38fdfa?0x0:_0x5987af['offset'];var _0x5b7f1d=_0x38fdfa?_0x3c211a[_0xe9bd('0x2c')]:_0x5987af['offset']+_0x5987af[_0xe9bd('0x2b')];var _0x1f2c0e;if(_0x5b7f1d>=_0x429055){_0x5b7f1d=_0x429055;_0x1f2c0e=0xc8;}else{_0x1f2c0e=0xce;}_0x1ae889[_0xe9bd('0x27')](_0x1f2c0e);return _0x1ae889[_0xe9bd('0x2d')](_0xe9bd('0x2e'),_0x183601+'-'+_0x5b7f1d+'/'+_0x429055)['json'](_0x3c211a);}return null;};}function patchUpdates(_0x4b7bc2){return function(_0x7f2c5){try{jsonpatch[_0xe9bd('0x2f')](_0x7f2c5,_0x4b7bc2,!![]);}catch(_0x3f96a0){return BPromise[_0xe9bd('0x30')](_0x3f96a0);}return _0x7f2c5[_0xe9bd('0x31')]();};}function saveUpdates(_0x1f0f9e,_0x3c31ee){return function(_0x66213a){if(_0x66213a){return _0x66213a[_0xe9bd('0x32')](_0x1f0f9e)['then'](function(_0x426004){return _0x426004;});}return null;};}function removeEntity(_0x81a31f,_0x390a43){return function(_0x5117bc){if(_0x5117bc){return _0x5117bc['destroy']()[_0xe9bd('0x1b')](function(){var _0x2e9593=_0x5117bc[_0xe9bd('0x33')]({'plain':!![]});var _0x3ed60a=_0xe9bd('0x34');return db[_0xe9bd('0x35')][_0xe9bd('0x36')]({'where':{'type':_0x3ed60a,'resourceId':_0x2e9593['id']}})[_0xe9bd('0x1b')](function(){return _0x5117bc;});})[_0xe9bd('0x1b')](function(){_0x81a31f[_0xe9bd('0x27')](0xcc)[_0xe9bd('0x28')]();});}};}function handleEntityNotFound(_0x549dd1,_0x2ad46e){return function(_0x199477){if(!_0x199477){_0x549dd1[_0xe9bd('0x26')](0x194);}return _0x199477;};}function handleError(_0x8ff624,_0x264ba0){_0x264ba0=_0x264ba0||0x1f4;return function(_0x147da5){logger['error'](_0x147da5[_0xe9bd('0x37')]);if(_0x147da5[_0xe9bd('0x38')]){delete _0x147da5['name'];}_0x8ff624[_0xe9bd('0x27')](_0x264ba0)[_0xe9bd('0x39')](_0x147da5);};}exports['index']=function(_0x4b1da0,_0x2785e6){var _0xdf43b9={},_0x4d2f3d={},_0x2d1289={'count':0x0,'rows':[]};var _0x3ea705=_[_0xe9bd('0x3a')](db['Trunk'][_0xe9bd('0x3b')],function(_0x4d1945){return{'name':_0x4d1945[_0xe9bd('0x3c')],'type':_0x4d1945[_0xe9bd('0x3d')][_0xe9bd('0x3e')]};});_0x4d2f3d[_0xe9bd('0x3f')]=_['map'](_0x3ea705,_0xe9bd('0x38'));_0x4d2f3d[_0xe9bd('0x40')]=_[_0xe9bd('0x41')](_0x4b1da0[_0xe9bd('0x40')]);_0x4d2f3d[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4d2f3d[_0xe9bd('0x3f')],_0x4d2f3d[_0xe9bd('0x40')]);_0xdf43b9[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x4d2f3d['model'],qs['fields'](_0x4b1da0[_0xe9bd('0x40')]['fields']));_0xdf43b9[_0xe9bd('0x44')]=_0xdf43b9[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xdf43b9['attributes']:_0x4d2f3d[_0xe9bd('0x3f')];if(!_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x46')]('nolimit')){_0xdf43b9[_0xe9bd('0x2b')]=qs[_0xe9bd('0x2b')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x2b')]);_0xdf43b9[_0xe9bd('0x47')]=qs[_0xe9bd('0x47')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x47')]);}_0xdf43b9[_0xe9bd('0x48')]=qs[_0xe9bd('0x49')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x49')]);_0xdf43b9[_0xe9bd('0x4a')]=qs[_0xe9bd('0x42')](_[_0xe9bd('0x4b')](_0x4b1da0['query'],_0x4d2f3d['filters']),_0x3ea705);if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x4c')]){_0xdf43b9[_0xe9bd('0x4a')]=_['merge'](_0xdf43b9['where'],{'$or':_[_0xe9bd('0x3a')](_0x3ea705,function(_0x3f6f22){if(_0x3f6f22[_0xe9bd('0x3d')]!==_0xe9bd('0x4d')){var _0x39fb61={};_0x39fb61[_0x3f6f22[_0xe9bd('0x38')]]={'$like':'%'+_0x4b1da0[_0xe9bd('0x40')]['filter']+'%'};return _0x39fb61;}})});}_0xdf43b9=_[_0xe9bd('0x4e')]({},_0xdf43b9,_0x4b1da0['options']);var _0x36726e={'where':_0xdf43b9[_0xe9bd('0x4a')]};return db[_0xe9bd('0x4f')][_0xe9bd('0x2c')](_0x36726e)[_0xe9bd('0x1b')](function(_0x4b7b67){_0x2d1289[_0xe9bd('0x2c')]=_0x4b7b67;if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xdf43b9['include']=[{'all':!![]}];}return db[_0xe9bd('0x4f')][_0xe9bd('0x51')](_0xdf43b9);})[_0xe9bd('0x1b')](function(_0x5a466b){_0x2d1289[_0xe9bd('0x52')]=_0x5a466b;return _0x2d1289;})[_0xe9bd('0x1b')](respondWithFilteredResult(_0x2785e6,_0xdf43b9))[_0xe9bd('0x25')](handleError(_0x2785e6,null));};exports[_0xe9bd('0x53')]=function(_0x1ee09c,_0x579d26){var _0x3f4833={'raw':![],'where':{'id':_0x1ee09c[_0xe9bd('0x54')]['id']}},_0x4b8ff9={};_0x4b8ff9[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0x4b8ff9['query']=_[_0xe9bd('0x41')](_0x1ee09c['query']);_0x4b8ff9[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4b8ff9['model'],_0x4b8ff9['query']);_0x3f4833[_0xe9bd('0x44')]=_['intersection'](_0x4b8ff9[_0xe9bd('0x3f')],qs['fields'](_0x1ee09c[_0xe9bd('0x40')][_0xe9bd('0x55')]));_0x3f4833['attributes']=_0x3f4833[_0xe9bd('0x44')]['length']?_0x3f4833[_0xe9bd('0x44')]:_0x4b8ff9[_0xe9bd('0x3f')];if(_0x1ee09c[_0xe9bd('0x40')]['includeAll']){_0x3f4833[_0xe9bd('0x56')]=[{'all':!![]}];}_0x3f4833=_[_0xe9bd('0x4e')]({},_0x3f4833,_0x1ee09c[_0xe9bd('0x57')]);return db[_0xe9bd('0x4f')]['find'](_0x3f4833)['then'](handleEntityNotFound(_0x579d26,null))[_0xe9bd('0x1b')](respondWithResult(_0x579d26,null))['catch'](handleError(_0x579d26,null));};exports[_0xe9bd('0x58')]=function(_0x3c33b8,_0xc7dd2f){var _0xc818b4={'where':{'id':_0x3c33b8[_0xe9bd('0x54')]['id']}},_0x159f68={};_0x159f68[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0xc818b4[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x159f68['model'],qs['fields'](_0x3c33b8['query'][_0xe9bd('0x55')]));_0xc818b4['attributes']=_0xc818b4[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xc818b4[_0xe9bd('0x44')]:_0x159f68[_0xe9bd('0x3f')];if(_0x3c33b8[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xc818b4[_0xe9bd('0x56')]=[{'all':!![]}];}_0xc818b4=_[_0xe9bd('0x4e')]({},_0xc818b4,_0x3c33b8[_0xe9bd('0x57')]);return db['Trunk'][_0xe9bd('0x59')](_0xc818b4)[_0xe9bd('0x1b')](handleEntityNotFound(_0xc7dd2f,null))[_0xe9bd('0x1b')](function(_0x3f848d){if(_0x3f848d){var _0x4d58c1=_0x3f848d[_0xe9bd('0x33')]({'plain':!![]});_0x4d58c1=qs[_0xe9bd('0x5a')](_0x4d58c1,['id',_0xe9bd('0x5b'),'updatedAt']);_0x3c33b8[_0xe9bd('0x5c')]=_[_0xe9bd('0x5a')](_0x3c33b8[_0xe9bd('0x5c')],['id',_0xe9bd('0x5b'),'updatedAt']);return db['Trunk'][_0xe9bd('0x5d')](_[_0xe9bd('0x4e')](_0x4d58c1,_0x3c33b8[_0xe9bd('0x5c')]),{'include':_0x3c33b8[_0xe9bd('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x305efa){var _0x20855b=_0x3c33b8[_0xe9bd('0x5e')][_0xe9bd('0x33')]({'plain':!![]});if(!_0x20855b)throw new Error(_0xe9bd('0x5f'));if(_0x20855b[_0xe9bd('0x60')]==='user'){var _0x179c8d=_0x305efa['get']({'plain':!![]});var _0x27e07c=_0xe9bd('0x34');return db[_0xe9bd('0x61')][_0xe9bd('0x59')]({'where':{'name':_0x27e07c,'userProfileId':_0x20855b['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x263ad9){if(_0x263ad9&&_0x263ad9[_0xe9bd('0x62')]===0x0){return db['UserProfileResource'][_0xe9bd('0x5d')]({'name':_0x179c8d[_0xe9bd('0x38')],'resourceId':_0x179c8d['id'],'type':_0x263ad9[_0xe9bd('0x38')],'sectionId':_0x263ad9['id']},{})[_0xe9bd('0x1b')](function(){return _0x305efa;});}else{return _0x305efa;}})[_0xe9bd('0x25')](function(_0x16b66c){logger[_0xe9bd('0x21')](_0xe9bd('0x63'),_0x16b66c);throw _0x16b66c;});}return _0x305efa;});}})[_0xe9bd('0x1b')](respondWithResult(_0xc7dd2f,0xc9))[_0xe9bd('0x25')](handleError(_0xc7dd2f,null));};exports[_0xe9bd('0x5d')]=function(_0x37d07a,_0x5d1e4b,_0x3a12e9){var _0x9d0603;return db['Trunk'][_0xe9bd('0x5d')](_0x37d07a[_0xe9bd('0x5c')],{'raw':!![]})['then'](function(_0x561165){_0x9d0603=_0x561165;return db[_0xe9bd('0x4f')][_0xe9bd('0x51')]({'raw':!![]});})['then'](function(_0x4ec8be){var _0x4a6422=fs[_0xe9bd('0x64')](path['join'](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x1fc88d=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x337284=ejs[_0xe9bd('0x68')](_0x4a6422,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x69'),_0x337284);if(_0x9d0603[_0xe9bd('0x6a')]){var _0x11ebcb=ejs['render'](_0x1fc88d,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x6b'),_0x11ebcb);}})[_0xe9bd('0x1b')](function(){return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x5d'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x1b')](function(){var _0x3fda4c=_0x37d07a[_0xe9bd('0x5e')]['get']({'plain':!![]});if(!_0x3fda4c)throw new Error(_0xe9bd('0x5f'));if(_0x3fda4c[_0xe9bd('0x60')]===_0xe9bd('0x5e')){var _0x3db47a=_0x9d0603[_0xe9bd('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xe9bd('0x59')]({'where':{'name':'Trunks','userProfileId':_0x3fda4c['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x4496e3){if(_0x4496e3&&_0x4496e3['autoAssociation']===0x0){return db[_0xe9bd('0x35')][_0xe9bd('0x5d')]({'name':_0x3db47a[_0xe9bd('0x38')],'resourceId':_0x3db47a['id'],'type':_0x4496e3[_0xe9bd('0x38')],'sectionId':_0x4496e3['id']},{})['then'](function(){return _0x9d0603;});}else{return _0x9d0603;}})[_0xe9bd('0x25')](function(_0x41fb41){logger['error'](_0xe9bd('0x63'),_0x41fb41);throw _0x41fb41;});}return _0x9d0603;})[_0xe9bd('0x1b')](respondWithResult(_0x5d1e4b,0xc9))[_0xe9bd('0x25')](handleError(_0x5d1e4b,null));};exports[_0xe9bd('0x32')]=function(_0x2e63c7,_0x1a36aa,_0x466a89){var _0x5e127b;return db[_0xe9bd('0x4f')][_0xe9bd('0x59')]({'where':{'id':_0x2e63c7[_0xe9bd('0x54')]['id']}})[_0xe9bd('0x1b')](handleEntityNotFound(_0x1a36aa,null))[_0xe9bd('0x1b')](saveUpdates(_0x2e63c7[_0xe9bd('0x5c')],null))[_0xe9bd('0x1b')](function(_0x2adc49){if(_0x2adc49){_0x5e127b=_0x2adc49;return db[_0xe9bd('0x4f')]['findAll']({'raw':!![]});}})[_0xe9bd('0x1b')](function(_0x466952){if(_0x466952){var _0x256890=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),'utf8');var _0x18519d=fs[_0xe9bd('0x64')](path['join'](config[_0xe9bd('0x6e')],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x2083c4=ejs[_0xe9bd('0x68')](_0x256890,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x69'),_0x2083c4);var _0x4f3dc6=ejs['render'](_0x18519d,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x4f3dc6);return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x32'),{'module':_0xe9bd('0x6d')});}return null;})[_0xe9bd('0x1b')](function(_0x1b46f4){if(_0x1b46f4){return _0x5e127b;}})['then'](respondWithResult(_0x1a36aa,null))[_0xe9bd('0x25')](handleError(_0x1a36aa,null));};exports[_0xe9bd('0x36')]=function(_0x29833b,_0x256862,_0x14cdd5){var _0x74063;return db[_0xe9bd('0x4f')]['find']({'where':{'id':_0x29833b['params']['id']}})['then'](handleEntityNotFound(_0x256862,null))[_0xe9bd('0x1b')](removeEntity(_0x256862,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0xe9bd('0x1b')](function(_0x402ab2){var _0xf170d4=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),_0xe9bd('0x67'));var _0x14ec42=fs['readFileSync'](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x22c67f=ejs[_0xe9bd('0x68')](_0xf170d4,{'trunks':_0x402ab2});var _0x416938=ejs['render'](_0x14ec42,{'trunks':_0x402ab2});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x22c67f);fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x416938);return respondWithRpcPromise('Reload',_0xe9bd('0x36'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x25')](handleError(_0x256862,null));}; \ No newline at end of file +var _0x81bd=['/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','update','server/files/templates/trunk.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','UserProfileResource','name','index','Trunk','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','clone','find','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/registry.ejs','utf8','writeFileSync'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x81bd,0x7c));var _0xd81b=function(_0xf1b134,_0xb399dd){_0xf1b134=_0xf1b134-0x0;var _0x139dbb=_0x81bd[_0xf1b134];return _0x139dbb;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd81b('0x1b'));var client=jayson['client'][_0xd81b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xe75568,_0x5f0b6b,_0x35a053,_0x47dd04){return new BPromise(function(_0x13dd00,_0x41bf7a){var _0x6c6041=_0x47dd04||client;return _0x6c6041[_0xd81b('0x1d')](_0xe75568,_0x35a053)[_0xd81b('0x1e')](function(_0x552215){logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');logger[_0xd81b('0x21')](_0xd81b('0x22'),_0x5f0b6b,_0xd81b('0x23'),JSON[_0xd81b('0x24')](_0x552215));if(_0x552215[_0xd81b('0x25')]){if(_0x552215[_0xd81b('0x25')][_0xd81b('0x26')]===0x1f4){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);return _0x41bf7a(_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);}logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')]['message']);return _0x13dd00(_0x552215['error'][_0xd81b('0x27')]);}else{logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');_0x13dd00(_0x552215[_0xd81b('0x28')][_0xd81b('0x27')]);}})['catch'](function(_0xcd6474){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0xcd6474);_0x41bf7a(_0xcd6474);});});}function respondWithStatusCode(_0x1ad65c,_0x279176){_0x279176=_0x279176||0xcc;return function(_0xcb4f91){if(_0xcb4f91){return _0x1ad65c[_0xd81b('0x29')](_0x279176);}return _0x1ad65c[_0xd81b('0x2a')](_0x279176)[_0xd81b('0x2b')]();};}function respondWithResult(_0x212c4e,_0x2ccedf){_0x2ccedf=_0x2ccedf||0xc8;return function(_0x1bf351){if(_0x1bf351){return _0x212c4e['status'](_0x2ccedf)[_0xd81b('0x2c')](_0x1bf351);}};}function respondWithFilteredResult(_0x99dbc9,_0xe3637a){return function(_0x31b9fd){if(_0x31b9fd){var _0x3266c2=typeof _0xe3637a[_0xd81b('0x2d')]===_0xd81b('0x2e')&&typeof _0xe3637a[_0xd81b('0x2f')]===_0xd81b('0x2e');var _0x483a3d=_0x31b9fd[_0xd81b('0x30')];var _0x4e2eff=_0x3266c2?0x0:_0xe3637a['offset'];var _0xb9ff9f=_0x3266c2?_0x31b9fd[_0xd81b('0x30')]:_0xe3637a['offset']+_0xe3637a['limit'];var _0x4093c8;if(_0xb9ff9f>=_0x483a3d){_0xb9ff9f=_0x483a3d;_0x4093c8=0xc8;}else{_0x4093c8=0xce;}_0x99dbc9[_0xd81b('0x2a')](_0x4093c8);return _0x99dbc9[_0xd81b('0x31')](_0xd81b('0x32'),_0x4e2eff+'-'+_0xb9ff9f+'/'+_0x483a3d)[_0xd81b('0x2c')](_0x31b9fd);}return null;};}function patchUpdates(_0x4654ba){return function(_0x5527ed){try{jsonpatch[_0xd81b('0x33')](_0x5527ed,_0x4654ba,!![]);}catch(_0x26f629){return BPromise['reject'](_0x26f629);}return _0x5527ed['save']();};}function saveUpdates(_0x165892,_0x1966b1){return function(_0x50472a){if(_0x50472a){return _0x50472a['update'](_0x165892)['then'](function(_0x322991){return _0x322991;});}return null;};}function removeEntity(_0x3ead68,_0x1d2f46){return function(_0x1c4cf7){if(_0x1c4cf7){return _0x1c4cf7[_0xd81b('0x34')]()[_0xd81b('0x1e')](function(){var _0x29aabf=_0x1c4cf7['get']({'plain':!![]});var _0x28782f='Trunks';return db[_0xd81b('0x35')][_0xd81b('0x34')]({'where':{'type':_0x28782f,'resourceId':_0x29aabf['id']}})[_0xd81b('0x1e')](function(){return _0x1c4cf7;});})[_0xd81b('0x1e')](function(){_0x3ead68[_0xd81b('0x2a')](0xcc)[_0xd81b('0x2b')]();});}};}function handleEntityNotFound(_0x1c20d3,_0x2d23b9){return function(_0xf9d1a5){if(!_0xf9d1a5){_0x1c20d3[_0xd81b('0x29')](0x194);}return _0xf9d1a5;};}function handleError(_0x1be4e2,_0x3c8371){_0x3c8371=_0x3c8371||0x1f4;return function(_0x346038){logger['error'](_0x346038['stack']);if(_0x346038[_0xd81b('0x36')]){delete _0x346038[_0xd81b('0x36')];}_0x1be4e2[_0xd81b('0x2a')](_0x3c8371)['send'](_0x346038);};}exports[_0xd81b('0x37')]=function(_0x37ba34,_0x5a236a){var _0x46f058={},_0xaa9e97={},_0x512e39={'count':0x0,'rows':[]};var _0xed5272=_['map'](db[_0xd81b('0x38')][_0xd81b('0x39')],function(_0x203365){return{'name':_0x203365[_0xd81b('0x3a')],'type':_0x203365['type'][_0xd81b('0x3b')]};});_0xaa9e97[_0xd81b('0x3c')]=_[_0xd81b('0x3d')](_0xed5272,_0xd81b('0x36'));_0xaa9e97[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x37ba34[_0xd81b('0x3e')]);_0xaa9e97['filters']=_[_0xd81b('0x40')](_0xaa9e97[_0xd81b('0x3c')],_0xaa9e97[_0xd81b('0x3e')]);_0x46f058['attributes']=_[_0xd81b('0x40')](_0xaa9e97[_0xd81b('0x3c')],qs[_0xd81b('0x41')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x41')]));_0x46f058['attributes']=_0x46f058[_0xd81b('0x42')][_0xd81b('0x43')]?_0x46f058[_0xd81b('0x42')]:_0xaa9e97[_0xd81b('0x3c')];if(!_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x44')](_0xd81b('0x45'))){_0x46f058[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x2f')]);_0x46f058['offset']=qs[_0xd81b('0x2d')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x2d')]);}_0x46f058[_0xd81b('0x46')]=qs[_0xd81b('0x47')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x47')]);_0x46f058[_0xd81b('0x48')]=qs['filters'](_['pick'](_0x37ba34[_0xd81b('0x3e')],_0xaa9e97[_0xd81b('0x49')]),_0xed5272);if(_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4a')]){_0x46f058[_0xd81b('0x48')]=_[_0xd81b('0x4b')](_0x46f058[_0xd81b('0x48')],{'$or':_[_0xd81b('0x3d')](_0xed5272,function(_0x2fa588){if(_0x2fa588[_0xd81b('0x4c')]!==_0xd81b('0x4d')){var _0x38e436={};_0x38e436[_0x2fa588['name']]={'$like':'%'+_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4a')]+'%'};return _0x38e436;}})});}_0x46f058=_[_0xd81b('0x4b')]({},_0x46f058,_0x37ba34[_0xd81b('0x4e')]);var _0x105a48={'where':_0x46f058[_0xd81b('0x48')]};return db[_0xd81b('0x38')][_0xd81b('0x30')](_0x105a48)[_0xd81b('0x1e')](function(_0x53ea36){_0x512e39[_0xd81b('0x30')]=_0x53ea36;if(_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x46f058[_0xd81b('0x50')]=[{'all':!![]}];}return db['Trunk'][_0xd81b('0x51')](_0x46f058);})[_0xd81b('0x1e')](function(_0x15030b){_0x512e39[_0xd81b('0x52')]=_0x15030b;return _0x512e39;})[_0xd81b('0x1e')](respondWithFilteredResult(_0x5a236a,_0x46f058))[_0xd81b('0x53')](handleError(_0x5a236a,null));};exports[_0xd81b('0x54')]=function(_0x43d7ce,_0x133a76){var _0x49cba6={'raw':![],'where':{'id':_0x43d7ce[_0xd81b('0x55')]['id']}},_0x534d10={};_0x534d10[_0xd81b('0x3c')]=_[_0xd81b('0x3f')](db[_0xd81b('0x38')][_0xd81b('0x39')]);_0x534d10[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x43d7ce[_0xd81b('0x3e')]);_0x534d10['filters']=_[_0xd81b('0x40')](_0x534d10[_0xd81b('0x3c')],_0x534d10[_0xd81b('0x3e')]);_0x49cba6[_0xd81b('0x42')]=_[_0xd81b('0x40')](_0x534d10['model'],qs[_0xd81b('0x41')](_0x43d7ce[_0xd81b('0x3e')]['fields']));_0x49cba6[_0xd81b('0x42')]=_0x49cba6[_0xd81b('0x42')][_0xd81b('0x43')]?_0x49cba6[_0xd81b('0x42')]:_0x534d10[_0xd81b('0x3c')];if(_0x43d7ce[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x49cba6[_0xd81b('0x50')]=[{'all':!![]}];}_0x49cba6=_[_0xd81b('0x4b')]({},_0x49cba6,_0x43d7ce[_0xd81b('0x4e')]);return db[_0xd81b('0x38')]['find'](_0x49cba6)[_0xd81b('0x1e')](handleEntityNotFound(_0x133a76,null))['then'](respondWithResult(_0x133a76,null))[_0xd81b('0x53')](handleError(_0x133a76,null));};exports[_0xd81b('0x56')]=function(_0x390db6,_0x3c2a9f){var _0x34d2a2={'where':{'id':_0x390db6['params']['id']}},_0x1e9f73={};_0x1e9f73[_0xd81b('0x3c')]=_[_0xd81b('0x3f')](db['Trunk']['rawAttributes']);_0x34d2a2[_0xd81b('0x42')]=_['intersection'](_0x1e9f73[_0xd81b('0x3c')],qs['fields'](_0x390db6[_0xd81b('0x3e')][_0xd81b('0x41')]));_0x34d2a2[_0xd81b('0x42')]=_0x34d2a2['attributes'][_0xd81b('0x43')]?_0x34d2a2[_0xd81b('0x42')]:_0x1e9f73['model'];if(_0x390db6[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x34d2a2['include']=[{'all':!![]}];}_0x34d2a2=_[_0xd81b('0x4b')]({},_0x34d2a2,_0x390db6['options']);return db[_0xd81b('0x38')][_0xd81b('0x57')](_0x34d2a2)[_0xd81b('0x1e')](handleEntityNotFound(_0x3c2a9f,null))[_0xd81b('0x1e')](function(_0x4add79){if(_0x4add79){var _0x32eab4=_0x4add79[_0xd81b('0x58')]({'plain':!![]});_0x32eab4=qs[_0xd81b('0x59')](_0x32eab4,['id',_0xd81b('0x5a'),_0xd81b('0x5b')]);_0x390db6['body']=_[_0xd81b('0x59')](_0x390db6[_0xd81b('0x5c')],['id',_0xd81b('0x5a'),_0xd81b('0x5b')]);return db[_0xd81b('0x38')][_0xd81b('0x5d')](_[_0xd81b('0x4b')](_0x32eab4,_0x390db6['body']),{'include':_0x390db6['query']['includeAll']?[{'all':!![]}]:undefined})[_0xd81b('0x1e')](function(_0x12b0bf){var _0x37507e=_0x390db6[_0xd81b('0x5e')][_0xd81b('0x58')]({'plain':!![]});if(!_0x37507e)throw new Error(_0xd81b('0x5f'));if(_0x37507e[_0xd81b('0x60')]==='user'){var _0x3fcd8c=_0x12b0bf[_0xd81b('0x58')]({'plain':!![]});var _0x35c9cf=_0xd81b('0x61');return db[_0xd81b('0x62')][_0xd81b('0x57')]({'where':{'name':_0x35c9cf,'userProfileId':_0x37507e[_0xd81b('0x63')]},'raw':!![]})['then'](function(_0x14b187){if(_0x14b187&&_0x14b187[_0xd81b('0x64')]===0x0){return db[_0xd81b('0x35')][_0xd81b('0x5d')]({'name':_0x3fcd8c[_0xd81b('0x36')],'resourceId':_0x3fcd8c['id'],'type':_0x14b187[_0xd81b('0x36')],'sectionId':_0x14b187['id']},{})[_0xd81b('0x1e')](function(){return _0x12b0bf;});}else{return _0x12b0bf;}})[_0xd81b('0x53')](function(_0x8fa8cd){logger[_0xd81b('0x25')](_0xd81b('0x65'),_0x8fa8cd);throw _0x8fa8cd;});}return _0x12b0bf;});}})[_0xd81b('0x1e')](respondWithResult(_0x3c2a9f,0xc9))['catch'](handleError(_0x3c2a9f,null));};exports[_0xd81b('0x5d')]=function(_0x5358a6,_0x2e7141,_0x6fa974){var _0x414f40;return db[_0xd81b('0x38')][_0xd81b('0x5d')](_0x5358a6[_0xd81b('0x5c')],{'raw':!![]})[_0xd81b('0x1e')](function(_0x18f2ac){_0x414f40=_0x18f2ac;return db[_0xd81b('0x38')][_0xd81b('0x51')]({'raw':!![]});})['then'](function(_0xfa2a13){var _0x344c32=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],'server/files/templates/trunk.ejs'),'utf8');var _0x3274d2=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],_0xd81b('0x69')),_0xd81b('0x6a'));var _0xaee7e3=ejs['render'](_0x344c32,{'trunks':_0xfa2a13||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6c'),_0xaee7e3);if(_0x414f40[_0xd81b('0x6d')]){var _0x1c6ec8=ejs[_0xd81b('0x6e')](_0x3274d2,{'trunks':_0xfa2a13||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x1c6ec8);}})[_0xd81b('0x1e')](function(){return respondWithRpcPromise(_0xd81b('0x70'),'create',{'module':_0xd81b('0x71')});})[_0xd81b('0x1e')](function(){var _0x3858eb=_0x5358a6[_0xd81b('0x5e')][_0xd81b('0x58')]({'plain':!![]});if(!_0x3858eb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3858eb[_0xd81b('0x60')]===_0xd81b('0x5e')){var _0x4cc440=_0x414f40[_0xd81b('0x58')]({'plain':!![]});return db[_0xd81b('0x62')]['find']({'where':{'name':_0xd81b('0x61'),'userProfileId':_0x3858eb[_0xd81b('0x63')]},'raw':!![]})[_0xd81b('0x1e')](function(_0x483026){if(_0x483026&&_0x483026[_0xd81b('0x64')]===0x0){return db[_0xd81b('0x35')][_0xd81b('0x5d')]({'name':_0x4cc440['name'],'resourceId':_0x4cc440['id'],'type':_0x483026['name'],'sectionId':_0x483026['id']},{})[_0xd81b('0x1e')](function(){return _0x414f40;});}else{return _0x414f40;}})[_0xd81b('0x53')](function(_0x36c694){logger['error'](_0xd81b('0x65'),_0x36c694);throw _0x36c694;});}return _0x414f40;})[_0xd81b('0x1e')](respondWithResult(_0x2e7141,0xc9))[_0xd81b('0x53')](handleError(_0x2e7141,null));};exports[_0xd81b('0x72')]=function(_0x524196,_0x4f69a7,_0x42ae01){var _0x256696;return db[_0xd81b('0x38')][_0xd81b('0x57')]({'where':{'id':_0x524196['params']['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x4f69a7,null))[_0xd81b('0x1e')](saveUpdates(_0x524196['body'],null))[_0xd81b('0x1e')](function(_0x4e5bf4){if(_0x4e5bf4){_0x256696=_0x4e5bf4;return db[_0xd81b('0x38')][_0xd81b('0x51')]({'raw':!![]});}})['then'](function(_0x1be0e6){if(_0x1be0e6){var _0x9a9634=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],'server/files/templates/trunk.ejs'),_0xd81b('0x6a'));var _0xc0e137=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],_0xd81b('0x69')),'utf8');var _0x5c8ea0=ejs[_0xd81b('0x6e')](_0x9a9634,{'trunks':_0x1be0e6||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6c'),_0x5c8ea0);var _0x15aed5=ejs['render'](_0xc0e137,{'trunks':_0x1be0e6||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x15aed5);return respondWithRpcPromise(_0xd81b('0x70'),_0xd81b('0x72'),{'module':_0xd81b('0x71')});}return null;})['then'](function(_0x3744bf){if(_0x3744bf){return _0x256696;}})[_0xd81b('0x1e')](respondWithResult(_0x4f69a7,null))[_0xd81b('0x53')](handleError(_0x4f69a7,null));};exports[_0xd81b('0x34')]=function(_0x1d596c,_0x288124,_0x402eb9){var _0x57179a;return db[_0xd81b('0x38')][_0xd81b('0x57')]({'where':{'id':_0x1d596c[_0xd81b('0x55')]['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x288124,null))[_0xd81b('0x1e')](removeEntity(_0x288124,null))[_0xd81b('0x1e')](function(){return db['Trunk'][_0xd81b('0x51')]({'raw':!![]});})['then'](function(_0x11e590){var _0x9e6e05=fs[_0xd81b('0x66')](path['join'](config[_0xd81b('0x68')],_0xd81b('0x73')),_0xd81b('0x6a'));var _0x5060dc=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config['root'],_0xd81b('0x69')),'utf8');var _0x5f5514=ejs[_0xd81b('0x6e')](_0x9e6e05,{'trunks':_0x11e590});var _0x428317=ejs[_0xd81b('0x6e')](_0x5060dc,{'trunks':_0x11e590});fs['writeFileSync'](_0xd81b('0x6c'),_0x5f5514);fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x428317);return respondWithRpcPromise(_0xd81b('0x70'),_0xd81b('0x34'),{'module':_0xd81b('0x71')});})['catch'](handleError(_0x288124,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 558d5d3..0ce7313 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 _0x8a2b=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','Trunk','lodash'];(function(_0x39e740,_0x3a3084){var _0x49d5fc=function(_0x344959){while(--_0x344959){_0x39e740['push'](_0x39e740['shift']());}};_0x49d5fc(++_0x3a3084);}(_0x8a2b,0x112));var _0xb8a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a2b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb8a2('0x0'));var util=require(_0xb8a2('0x1'));var logger=require(_0xb8a2('0x2'))(_0xb8a2('0x3'));var moment=require(_0xb8a2('0x4'));var BPromise=require('bluebird');var rp=require(_0xb8a2('0x5'));var fs=require('fs');var path=require(_0xb8a2('0x6'));var rimraf=require(_0xb8a2('0x7'));var config=require(_0xb8a2('0x8'));var attributes=require('./trunk.attributes');module['exports']=function(_0x235956,_0x111ea0){return _0x235956[_0xb8a2('0x9')](_0xb8a2('0xa'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c0e=['Trunk','tools_trunks','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes'];(function(_0x486008,_0x2b2d05){var _0x2fefc7=function(_0x4177fe){while(--_0x4177fe){_0x486008['push'](_0x486008['shift']());}};_0x2fefc7(++_0x2b2d05);}(_0x9c0e,0xf2));var _0xe9c0=function(_0x463311,_0x6247f0){_0x463311=_0x463311-0x0;var _0x34048f=_0x9c0e[_0x463311];return _0x34048f;};'use strict';var _=require('lodash');var util=require(_0xe9c0('0x0'));var logger=require(_0xe9c0('0x1'))(_0xe9c0('0x2'));var moment=require(_0xe9c0('0x3'));var BPromise=require(_0xe9c0('0x4'));var rp=require(_0xe9c0('0x5'));var fs=require('fs');var path=require(_0xe9c0('0x6'));var rimraf=require(_0xe9c0('0x7'));var config=require(_0xe9c0('0x8'));var attributes=require(_0xe9c0('0x9'));module['exports']=function(_0x5ee5fa,_0x59d499){return _0x5ee5fa['define'](_0xe9c0('0xa'),attributes,{'tableName':_0xe9c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 13df4c0..3c31050 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 _0x8ff8=['jayson/promise','client','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','Trunk','options','raw','where','attributes','limit','include','map','model','stringify','ShowTrunk','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0x8ff8,0x1e8));var _0x88ff=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8ff8[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x88ff('0x0'));var util=require('util');var moment=require(_0x88ff('0x1'));var BPromise=require(_0x88ff('0x2'));var rs=require(_0x88ff('0x3'));var fs=require('fs');var Redis=require(_0x88ff('0x4'));var db=require(_0x88ff('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x88ff('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x88ff('0x7'));var client=jayson[_0x88ff('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c49da,_0x26c57b,_0x36d033){return new BPromise(function(_0x225cb2,_0x3a1587){return client[_0x88ff('0x9')](_0x4c49da,_0x36d033)[_0x88ff('0xa')](function(_0xb695de){logger[_0x88ff('0xb')]('Trunk,\x20%s,\x20%s',_0x26c57b,_0x88ff('0xc'));logger[_0x88ff('0xd')](_0x88ff('0xe'),_0x26c57b,_0x88ff('0xc'),JSON['stringify'](_0xb695de));if(_0xb695de['error']){if(_0xb695de[_0x88ff('0xf')][_0x88ff('0x10')]===0x1f4){logger[_0x88ff('0xf')](_0x88ff('0x11'),_0x26c57b,_0xb695de[_0x88ff('0xf')][_0x88ff('0x12')]);return _0x3a1587(_0xb695de[_0x88ff('0xf')][_0x88ff('0x12')]);}logger[_0x88ff('0xf')](_0x88ff('0x11'),_0x26c57b,_0xb695de[_0x88ff('0xf')][_0x88ff('0x12')]);return _0x225cb2(_0xb695de[_0x88ff('0xf')][_0x88ff('0x12')]);}else{logger['info'](_0x88ff('0x11'),_0x26c57b,'request\x20sent');_0x225cb2(_0xb695de[_0x88ff('0x13')][_0x88ff('0x12')]);}})[_0x88ff('0x14')](function(_0x582e6){logger[_0x88ff('0xf')](_0x88ff('0x11'),_0x26c57b,_0x582e6);_0x3a1587(_0x582e6);});});}exports[_0x88ff('0x15')]=function(_0x40c3b5){var _0x5102e6=this;return new Promise(function(_0x5046a7,_0x276cc7){return db[_0x88ff('0x16')]['findAll']({'raw':_0x40c3b5[_0x88ff('0x17')]?_0x40c3b5[_0x88ff('0x17')][_0x88ff('0x18')]===undefined?!![]:![]:!![],'where':_0x40c3b5[_0x88ff('0x17')]?_0x40c3b5['options'][_0x88ff('0x19')]||null:null,'attributes':_0x40c3b5[_0x88ff('0x17')]?_0x40c3b5[_0x88ff('0x17')][_0x88ff('0x1a')]||null:null,'limit':_0x40c3b5[_0x88ff('0x17')]?_0x40c3b5[_0x88ff('0x17')][_0x88ff('0x1b')]||null:null,'include':_0x40c3b5[_0x88ff('0x17')]?_0x40c3b5[_0x88ff('0x17')][_0x88ff('0x1c')]?_[_0x88ff('0x1d')](_0x40c3b5['options'][_0x88ff('0x1c')],function(_0x5e7367){return{'model':db[_0x5e7367[_0x88ff('0x1e')]],'as':_0x5e7367['as'],'attributes':_0x5e7367[_0x88ff('0x1a')],'include':_0x5e7367['include']?_['map'](_0x5e7367['include'],function(_0x211037){return{'model':db[_0x211037[_0x88ff('0x1e')]],'as':_0x211037['as'],'attributes':_0x211037[_0x88ff('0x1a')],'include':_0x211037[_0x88ff('0x1c')]?_[_0x88ff('0x1d')](_0x211037['include'],function(_0x1e1d8e){return{'model':db[_0x1e1d8e[_0x88ff('0x1e')]],'as':_0x1e1d8e['as'],'attributes':_0x1e1d8e['attributes']};}):[]};}):[]};}):[]:[]})[_0x88ff('0xa')](function(_0x2bc7dc){logger['info'](_0x88ff('0x15'),_0x40c3b5);logger[_0x88ff('0xd')](_0x88ff('0x15'),_0x40c3b5,JSON[_0x88ff('0x1f')](_0x2bc7dc));_0x5046a7(_0x2bc7dc);})[_0x88ff('0x14')](function(_0x22c7f7){logger[_0x88ff('0xf')]('GetTrunk',_0x22c7f7['message'],_0x40c3b5);_0x276cc7(_0x5102e6[_0x88ff('0xf')](0x1f4,_0x22c7f7[_0x88ff('0x12')]));});});};exports['ShowTrunk']=function(_0x305eeb){var _0x4af29d=this;return new Promise(function(_0x1e541b,_0x28c091){return db[_0x88ff('0x16')]['find']({'raw':_0x305eeb['options']?_0x305eeb[_0x88ff('0x17')][_0x88ff('0x18')]===undefined?!![]:![]:!![],'where':_0x305eeb[_0x88ff('0x17')]?_0x305eeb['options']['where']||null:null,'attributes':_0x305eeb['options']?_0x305eeb['options'][_0x88ff('0x1a')]||null:null,'include':_0x305eeb[_0x88ff('0x17')]?_0x305eeb[_0x88ff('0x17')]['include']?_[_0x88ff('0x1d')](_0x305eeb[_0x88ff('0x17')][_0x88ff('0x1c')],function(_0x264280){return{'model':db[_0x264280[_0x88ff('0x1e')]],'as':_0x264280['as'],'attributes':_0x264280[_0x88ff('0x1a')],'include':_0x264280[_0x88ff('0x1c')]?_[_0x88ff('0x1d')](_0x264280[_0x88ff('0x1c')],function(_0x449aad){return{'model':db[_0x449aad[_0x88ff('0x1e')]],'as':_0x449aad['as'],'attributes':_0x449aad[_0x88ff('0x1a')],'include':_0x449aad['include']?_['map'](_0x449aad['include'],function(_0x3081a0){return{'model':db[_0x3081a0[_0x88ff('0x1e')]],'as':_0x3081a0['as'],'attributes':_0x3081a0[_0x88ff('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x88ff('0xa')](function(_0x43f12a){logger[_0x88ff('0xb')](_0x88ff('0x20'),_0x305eeb);logger['debug'](_0x88ff('0x20'),_0x305eeb,JSON['stringify'](_0x43f12a));_0x1e541b(_0x43f12a);})[_0x88ff('0x14')](function(_0x3593ce){logger[_0x88ff('0xf')](_0x88ff('0x20'),_0x3593ce[_0x88ff('0x12')],_0x305eeb);_0x28c091(_0x4af29d[_0x88ff('0xf')](0x1f4,_0x3593ce[_0x88ff('0x12')]));});});}; \ No newline at end of file +var _0xb982=['catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowTrunk','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','Trunk,\x20%s,\x20%s','debug','stringify','error','code','message'];(function(_0x32f185,_0x433de6){var _0x35efad=function(_0x3be548){while(--_0x3be548){_0x32f185['push'](_0x32f185['shift']());}};_0x35efad(++_0x433de6);}(_0xb982,0x117));var _0x2b98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb982[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2b98('0x0'));var util=require(_0x2b98('0x1'));var moment=require(_0x2b98('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b98('0x3'));var db=require(_0x2b98('0x4'))['db'];var utils=require(_0x2b98('0x5'));var logger=require(_0x2b98('0x6'))(_0x2b98('0x7'));var config=require('../../config/environment');var jayson=require(_0x2b98('0x8'));var client=jayson[_0x2b98('0x9')][_0x2b98('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cef9f,_0x1331f,_0x54a066){return new BPromise(function(_0x5c5066,_0x5a951f){return client['request'](_0x2cef9f,_0x54a066)['then'](function(_0x4ee0c3){logger[_0x2b98('0xb')](_0x2b98('0xc'),_0x1331f,'request\x20sent');logger[_0x2b98('0xd')]('Trunk,\x20%s,\x20%s,\x20%s',_0x1331f,'request\x20sent',JSON[_0x2b98('0xe')](_0x4ee0c3));if(_0x4ee0c3[_0x2b98('0xf')]){if(_0x4ee0c3['error'][_0x2b98('0x10')]===0x1f4){logger[_0x2b98('0xf')](_0x2b98('0xc'),_0x1331f,_0x4ee0c3[_0x2b98('0xf')][_0x2b98('0x11')]);return _0x5a951f(_0x4ee0c3[_0x2b98('0xf')][_0x2b98('0x11')]);}logger[_0x2b98('0xf')]('Trunk,\x20%s,\x20%s',_0x1331f,_0x4ee0c3[_0x2b98('0xf')][_0x2b98('0x11')]);return _0x5c5066(_0x4ee0c3[_0x2b98('0xf')][_0x2b98('0x11')]);}else{logger[_0x2b98('0xb')](_0x2b98('0xc'),_0x1331f,'request\x20sent');_0x5c5066(_0x4ee0c3['result'][_0x2b98('0x11')]);}})[_0x2b98('0x12')](function(_0xdf1ff6){logger[_0x2b98('0xf')](_0x2b98('0xc'),_0x1331f,_0xdf1ff6);_0x5a951f(_0xdf1ff6);});});}exports[_0x2b98('0x13')]=function(_0xa6b639){var _0x57f665=this;return new Promise(function(_0x3bc0c9,_0x53a9c7){return db[_0x2b98('0x14')][_0x2b98('0x15')]({'raw':_0xa6b639[_0x2b98('0x16')]?_0xa6b639[_0x2b98('0x16')][_0x2b98('0x17')]===undefined?!![]:![]:!![],'where':_0xa6b639[_0x2b98('0x16')]?_0xa6b639[_0x2b98('0x16')][_0x2b98('0x18')]||null:null,'attributes':_0xa6b639[_0x2b98('0x16')]?_0xa6b639[_0x2b98('0x16')][_0x2b98('0x19')]||null:null,'limit':_0xa6b639['options']?_0xa6b639[_0x2b98('0x16')][_0x2b98('0x1a')]||null:null,'include':_0xa6b639[_0x2b98('0x16')]?_0xa6b639[_0x2b98('0x16')][_0x2b98('0x1b')]?_[_0x2b98('0x1c')](_0xa6b639[_0x2b98('0x16')][_0x2b98('0x1b')],function(_0x22933a){return{'model':db[_0x22933a[_0x2b98('0x1d')]],'as':_0x22933a['as'],'attributes':_0x22933a['attributes'],'include':_0x22933a[_0x2b98('0x1b')]?_[_0x2b98('0x1c')](_0x22933a['include'],function(_0x4cd503){return{'model':db[_0x4cd503[_0x2b98('0x1d')]],'as':_0x4cd503['as'],'attributes':_0x4cd503['attributes'],'include':_0x4cd503[_0x2b98('0x1b')]?_[_0x2b98('0x1c')](_0x4cd503['include'],function(_0x446e4d){return{'model':db[_0x446e4d[_0x2b98('0x1d')]],'as':_0x446e4d['as'],'attributes':_0x446e4d[_0x2b98('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2b98('0x1e')](function(_0x2c2490){logger[_0x2b98('0xb')](_0x2b98('0x13'),_0xa6b639);logger[_0x2b98('0xd')]('GetTrunk',_0xa6b639,JSON[_0x2b98('0xe')](_0x2c2490));_0x3bc0c9(_0x2c2490);})[_0x2b98('0x12')](function(_0x5050d0){logger[_0x2b98('0xf')]('GetTrunk',_0x5050d0[_0x2b98('0x11')],_0xa6b639);_0x53a9c7(_0x57f665[_0x2b98('0xf')](0x1f4,_0x5050d0['message']));});});};exports[_0x2b98('0x1f')]=function(_0x257d3d){var _0x4c5f88=this;return new Promise(function(_0x36009d,_0x403790){return db[_0x2b98('0x14')][_0x2b98('0x20')]({'raw':_0x257d3d[_0x2b98('0x16')]?_0x257d3d[_0x2b98('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x257d3d[_0x2b98('0x16')]?_0x257d3d[_0x2b98('0x16')][_0x2b98('0x18')]||null:null,'attributes':_0x257d3d['options']?_0x257d3d[_0x2b98('0x16')][_0x2b98('0x19')]||null:null,'include':_0x257d3d[_0x2b98('0x16')]?_0x257d3d[_0x2b98('0x16')][_0x2b98('0x1b')]?_['map'](_0x257d3d['options']['include'],function(_0x4ee90f){return{'model':db[_0x4ee90f['model']],'as':_0x4ee90f['as'],'attributes':_0x4ee90f[_0x2b98('0x19')],'include':_0x4ee90f[_0x2b98('0x1b')]?_['map'](_0x4ee90f['include'],function(_0x4991a9){return{'model':db[_0x4991a9[_0x2b98('0x1d')]],'as':_0x4991a9['as'],'attributes':_0x4991a9[_0x2b98('0x19')],'include':_0x4991a9[_0x2b98('0x1b')]?_[_0x2b98('0x1c')](_0x4991a9[_0x2b98('0x1b')],function(_0x226bec){return{'model':db[_0x226bec[_0x2b98('0x1d')]],'as':_0x226bec['as'],'attributes':_0x226bec[_0x2b98('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x386341){logger[_0x2b98('0xb')](_0x2b98('0x1f'),_0x257d3d);logger[_0x2b98('0xd')](_0x2b98('0x1f'),_0x257d3d,JSON[_0x2b98('0xe')](_0x386341));_0x36009d(_0x386341);})[_0x2b98('0x12')](function(_0x5346e6){logger[_0x2b98('0xf')](_0x2b98('0x1f'),_0x5346e6[_0x2b98('0x11')],_0x257d3d);_0x403790(_0x4c5f88[_0x2b98('0xf')](0x1f4,_0x5346e6[_0x2b98('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 753ee30..bf379ac 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 _0xed7d=['exports','express','Router','../../components/auth/service','./user-setting.controller','put','update'];(function(_0x593d56,_0x10d793){var _0xb1c92c=function(_0x25f720){while(--_0x25f720){_0x593d56['push'](_0x593d56['shift']());}};_0xb1c92c(++_0x10d793);}(_0xed7d,0xb0));var _0xded7=function(_0x206453,_0x46c9ec){_0x206453=_0x206453-0x0;var _0xcde5a9=_0xed7d[_0x206453];return _0xcde5a9;};'use strict';var express=require(_0xded7('0x0'));var router=express[_0xded7('0x1')]();var auth=require(_0xded7('0x2'));var controller=require(_0xded7('0x3'));router[_0xded7('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xded7('0x5')]);module[_0xded7('0x6')]=router; \ No newline at end of file +var _0x32c6=['put','/:id','isAuthenticated','update','Router','../../components/auth/service','./user-setting.controller'];(function(_0x4e9f49,_0x5a4a6b){var _0x167d58=function(_0x28d09c){while(--_0x28d09c){_0x4e9f49['push'](_0x4e9f49['shift']());}};_0x167d58(++_0x5a4a6b);}(_0x32c6,0x1ee));var _0x632c=function(_0x1fb802,_0x2aa9e9){_0x1fb802=_0x1fb802-0x0;var _0x34205b=_0x32c6[_0x1fb802];return _0x34205b;};'use strict';var express=require('express');var router=express[_0x632c('0x0')]();var auth=require(_0x632c('0x1'));var controller=require(_0x632c('0x2'));router[_0x632c('0x3')](_0x632c('0x4'),auth[_0x632c('0x5')](),controller[_0x632c('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 5c2927b..00221a2 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 _0x00e8=['ENUM','TEXT','DATE','INTEGER','UserId','sequelize','error','info','debug','exports'];(function(_0x314a6f,_0x3167de){var _0x104695=function(_0x820372){while(--_0x820372){_0x314a6f['push'](_0x314a6f['shift']());}};_0x104695(++_0x3167de);}(_0x00e8,0x181));var _0x800e=function(_0x20fab0,_0x29718e){_0x20fab0=_0x20fab0-0x0;var _0x231504=_0x00e8[_0x20fab0];return _0x231504;};'use strict';var Sequelize=require(_0x800e('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x800e('0x1'),'warning',_0x800e('0x2'),_0x800e('0x3')];module[_0x800e('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x800e('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x800e('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x800e('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x800e('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x800e('0x8')],'unique':_0x800e('0x9')}}; \ No newline at end of file +var _0xe248=['UserId','info','debug','exports','error','TEXT','DATE','INTEGER'];(function(_0x39ecf1,_0x5191bc){var _0x354e58=function(_0x3aff48){while(--_0x3aff48){_0x39ecf1['push'](_0x39ecf1['shift']());}};_0x354e58(++_0x5191bc);}(_0xe248,0x79));var _0x8e24=function(_0x1daf58,_0x5254fc){_0x1daf58=_0x1daf58-0x0;var _0x237a3c=_0xe248[_0x1daf58];return _0x237a3c;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=['error','warning',_0x8e24('0x0'),_0x8e24('0x1')];module[_0x8e24('0x2')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x8e24('0x3'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x8e24('0x4')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x8e24('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x8e24('0x6')],'unique':_0x8e24('0x7')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index de674d0..3545821 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 _0x502a=['lodash','ioredis','api','../../config/environment','redis','register','defaults','localhost','then','sendStatus','error','stack','name','status','update','role','admin','Unauthorized','Invalid\x20user\x20setting\x20id','UserSetting','find','params','body','catch'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x502a,0xd8));var _0xa502=function(_0xff1749,_0x50ee98){_0xff1749=_0xff1749-0x0;var _0x8a9081=_0x502a[_0xff1749];return _0x8a9081;};'use strict';var _=require(_0xa502('0x0'));var Redis=require(_0xa502('0x1'));var logger=require('../../config/logger')(_0xa502('0x2'));var config=require(_0xa502('0x3'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xa502('0x4')]));require('./user-setting.socket')[_0xa502('0x5')](socket);config[_0xa502('0x4')]=_[_0xa502('0x6')](config[_0xa502('0x4')],{'host':_0xa502('0x7'),'port':0x18eb});function respondWithResult(_0x489407,_0x329022){_0x329022=_0x329022||0xc8;return function(_0x29fb03){if(_0x29fb03){return _0x489407['status'](_0x329022)['json'](_0x29fb03);}};}function saveUpdates(_0x13e991){return function(_0x25c147){if(_0x25c147){return _0x25c147['update'](_0x13e991)[_0xa502('0x8')](function(_0x12fb93){return _0x12fb93;});}return null;};}function handleEntityNotFound(_0x385980){return function(_0x50a924){if(!_0x50a924){_0x385980[_0xa502('0x9')](0x194);}return _0x50a924;};}function handleError(_0x9f2ebd,_0x1c2688){_0x1c2688=_0x1c2688||0x1f4;return function(_0x4e37b7){logger[_0xa502('0xa')](_0x4e37b7[_0xa502('0xb')]);if(_0x4e37b7['name']){delete _0x4e37b7[_0xa502('0xc')];}_0x9f2ebd[_0xa502('0xd')](_0x1c2688)['send'](_0x4e37b7);};}exports[_0xa502('0xe')]=function(_0x91d9e2,_0x25ed69){if(_0x91d9e2['user'][_0xa502('0xf')]!==_0xa502('0x10'))throw new Error(_0xa502('0x11'));if(isNaN(Number(_0x91d9e2['params']['id'])))throw new Error(_0xa502('0x12'));return db[_0xa502('0x13')][_0xa502('0x14')]({'where':{'id':_0x91d9e2[_0xa502('0x15')]['id']}})[_0xa502('0x8')](handleEntityNotFound(_0x25ed69,null))[_0xa502('0x8')](saveUpdates(_0x91d9e2[_0xa502('0x16')],null))[_0xa502('0x8')](respondWithResult(_0x25ed69,null))[_0xa502('0x17')](handleError(_0x25ed69,null));}; \ No newline at end of file +var _0xde64=['then','sendStatus','error','name','update','user','admin','Unauthorized','params','UserSetting','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','./user-setting.socket','defaults','status','json'];(function(_0x34b915,_0x1c466d){var _0x5b8701=function(_0x8aa7f2){while(--_0x8aa7f2){_0x34b915['push'](_0x34b915['shift']());}};_0x5b8701(++_0x1c466d);}(_0xde64,0x17c));var _0x4de6=function(_0x34808f,_0x45d902){_0x34808f=_0x34808f-0x0;var _0x588415=_0xde64[_0x34808f];return _0x588415;};'use strict';var _=require(_0x4de6('0x0'));var Redis=require(_0x4de6('0x1'));var logger=require(_0x4de6('0x2'))(_0x4de6('0x3'));var config=require(_0x4de6('0x4'));var db=require(_0x4de6('0x5'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x4de6('0x6')]));require(_0x4de6('0x7'))['register'](socket);config['redis']=_[_0x4de6('0x8')](config[_0x4de6('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x568496,_0x24edef){_0x24edef=_0x24edef||0xc8;return function(_0x35ae72){if(_0x35ae72){return _0x568496[_0x4de6('0x9')](_0x24edef)[_0x4de6('0xa')](_0x35ae72);}};}function saveUpdates(_0x34f7a4){return function(_0x202cdc){if(_0x202cdc){return _0x202cdc['update'](_0x34f7a4)[_0x4de6('0xb')](function(_0x45329b){return _0x45329b;});}return null;};}function handleEntityNotFound(_0x1dbeed){return function(_0x4885e3){if(!_0x4885e3){_0x1dbeed[_0x4de6('0xc')](0x194);}return _0x4885e3;};}function handleError(_0x170183,_0x2e205b){_0x2e205b=_0x2e205b||0x1f4;return function(_0x36f8d4){logger[_0x4de6('0xd')](_0x36f8d4['stack']);if(_0x36f8d4[_0x4de6('0xe')]){delete _0x36f8d4[_0x4de6('0xe')];}_0x170183[_0x4de6('0x9')](_0x2e205b)['send'](_0x36f8d4);};}exports[_0x4de6('0xf')]=function(_0x216a84,_0x27c108){if(_0x216a84[_0x4de6('0x10')]['role']!==_0x4de6('0x11'))throw new Error(_0x4de6('0x12'));if(isNaN(Number(_0x216a84[_0x4de6('0x13')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x4de6('0x14')]['find']({'where':{'id':_0x216a84['params']['id']}})[_0x4de6('0xb')](handleEntityNotFound(_0x27c108,null))[_0x4de6('0xb')](saveUpdates(_0x216a84[_0x4de6('0x15')],null))[_0x4de6('0xb')](respondWithResult(_0x27c108,null))[_0x4de6('0x16')](handleError(_0x27c108,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 f4ec098..fcc3dad 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 _0xb3fb=['events','../../mysqldb','UserSetting','update','remove','emit','hasOwnProperty','hook'];(function(_0x2b0bc2,_0x4331f5){var _0x56e5b9=function(_0x4c1b06){while(--_0x4c1b06){_0x2b0bc2['push'](_0x2b0bc2['shift']());}};_0x56e5b9(++_0x4331f5);}(_0xb3fb,0xf0));var _0xbb3f=function(_0x4db7c1,_0x40baeb){_0x4db7c1=_0x4db7c1-0x0;var _0x41fa35=_0xb3fb[_0x4db7c1];return _0x41fa35;};'use strict';var EventEmitter=require(_0xbb3f('0x0'));var UserSetting=require(_0xbb3f('0x1'))['db'][_0xbb3f('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbb3f('0x3'),'afterDestroy':_0xbb3f('0x4')};function emitEvent(_0x383450){return function(_0x239f89,_0x28df50,_0x5664b2){UserSettingEvents[_0xbb3f('0x5')](_0x383450+':'+_0x239f89['id'],_0x239f89);UserSettingEvents[_0xbb3f('0x5')](_0x383450,_0x239f89);_0x5664b2(null);};}for(var e in events){if(events[_0xbb3f('0x6')](e)){var event=events[e];UserSetting[_0xbb3f('0x7')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x5dfa=['UserSetting','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x621382,_0x12b926){var _0x54a195=function(_0x472e9e){while(--_0x472e9e){_0x621382['push'](_0x621382['shift']());}};_0x54a195(++_0x12b926);}(_0x5dfa,0x85));var _0xa5df=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5dfa[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xa5df('0x0'));var UserSetting=require(_0xa5df('0x1'))['db'][_0xa5df('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa5df('0x3'),'afterUpdate':_0xa5df('0x4'),'afterDestroy':_0xa5df('0x5')};function emitEvent(_0x320e21){return function(_0x596a98,_0x4444a5,_0xfdea5b){UserSettingEvents[_0xa5df('0x6')](_0x320e21+':'+_0x596a98['id'],_0x596a98);UserSettingEvents[_0xa5df('0x6')](_0x320e21,_0x596a98);_0xfdea5b(null);};}for(var e in events){if(events[_0xa5df('0x7')](e)){var event=events[e];UserSetting[_0xa5df('0x8')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 11233d1..d95c82d 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 _0xf6e8=['UserSetting','user_settings','clientSideLoggingEnabledSince','exports','define'];(function(_0x480aae,_0x189b66){var _0x332ac2=function(_0x5c698){while(--_0x5c698){_0x480aae['push'](_0x480aae['shift']());}};_0x332ac2(++_0x189b66);}(_0xf6e8,0xc1));var _0x8f6e=function(_0x267bc4,_0x473324){_0x267bc4=_0x267bc4-0x0;var _0x1f271b=_0xf6e8[_0x267bc4];return _0x1f271b;};'use strict';var attributes=require('./user-setting.attributes');module[_0x8f6e('0x0')]=function(_0x2c1a59){return _0x2c1a59[_0x8f6e('0x1')](_0x8f6e('0x2'),attributes,{'tableName':_0x8f6e('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x24d74f){if(!_0x24d74f['clientSideLoggingEnabled'])_0x24d74f[_0x8f6e('0x4')]=null;else if(_0x24d74f['clientSideLoggingEnabledSince']===null)_0x24d74f[_0x8f6e('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x536f=['./user-setting.attributes','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x115833,_0x3e8497){var _0x3129f6=function(_0x581c1d){while(--_0x581c1d){_0x115833['push'](_0x115833['shift']());}};_0x3129f6(++_0x3e8497);}(_0x536f,0x70));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var attributes=require(_0xf536('0x0'));module['exports']=function(_0x4e4212){return _0x4e4212['define']('UserSetting',attributes,{'tableName':_0xf536('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e5e49){if(!_0x1e5e49[_0xf536('0x2')])_0x1e5e49[_0xf536('0x3')]=null;else if(_0x1e5e49['clientSideLoggingEnabledSince']===null)_0x1e5e49[_0xf536('0x3')]=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 47a5d16..f4a1e6e 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 _0x199d=['emit','user-setting:update:user-','UserId','register','user-setting:','./user-setting.events','save','remove','update'];(function(_0x11dbb2,_0x32d4ef){var _0x1a1fc4=function(_0x4a7992){while(--_0x4a7992){_0x11dbb2['push'](_0x11dbb2['shift']());}};_0x1a1fc4(++_0x32d4ef);}(_0x199d,0x149));var _0xd199=function(_0x58a4ac,_0x43fd42){_0x58a4ac=_0x58a4ac-0x0;var _0x545810=_0x199d[_0x58a4ac];return _0x545810;};'use strict';var UserSettingEvents=require(_0xd199('0x0'));var events=[_0xd199('0x1'),_0xd199('0x2'),_0xd199('0x3')];function createListener(_0x17da78,_0x59a527){return function(_0x32db76){_0x59a527[_0xd199('0x4')](_0x17da78,_0x32db76);if(_0x17da78==='user-setting:update'){_0x59a527['emit'](_0xd199('0x5')+_0x32db76[_0xd199('0x6')],_0x32db76);}};}exports[_0xd199('0x7')]=function(_0x52f8bf){for(var _0x3f13bc=0x0,_0xd67cd0=events['length'];_0x3f13bc<_0xd67cd0;_0x3f13bc++){var _0x98fdf6=events[_0x3f13bc];var _0x28ce43=createListener(_0xd199('0x8')+_0x98fdf6,_0x52f8bf);UserSettingEvents['on'](_0x98fdf6,_0x28ce43);}}; \ No newline at end of file +var _0x22ae=['save','remove','emit','user-setting:update','UserId','register','length','./user-setting.events'];(function(_0x4db4a8,_0x5c90dc){var _0x960c57=function(_0x4f6aac){while(--_0x4f6aac){_0x4db4a8['push'](_0x4db4a8['shift']());}};_0x960c57(++_0x5c90dc);}(_0x22ae,0x1b7));var _0xe22a=function(_0x16c1d9,_0x2a1270){_0x16c1d9=_0x16c1d9-0x0;var _0x85293b=_0x22ae[_0x16c1d9];return _0x85293b;};'use strict';var UserSettingEvents=require(_0xe22a('0x0'));var events=[_0xe22a('0x1'),_0xe22a('0x2'),'update'];function createListener(_0x521b78,_0x3b6e0d){return function(_0x45971c){_0x3b6e0d[_0xe22a('0x3')](_0x521b78,_0x45971c);if(_0x521b78===_0xe22a('0x4')){_0x3b6e0d[_0xe22a('0x3')]('user-setting:update:user-'+_0x45971c[_0xe22a('0x5')],_0x45971c);}};}exports[_0xe22a('0x6')]=function(_0x534ce3){for(var _0xcbcf71=0x0,_0x17dac6=events[_0xe22a('0x7')];_0xcbcf71<_0x17dac6;_0xcbcf71++){var _0x1b8eb3=events[_0xcbcf71];var _0x37b8ba=createListener('user-setting:'+_0x1b8eb3,_0x534ce3);UserSettingEvents['on'](_0x1b8eb3,_0x37b8ba);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index a38db24..0b9fe51 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 _0x7229=['removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','/:id','show','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','root','server/files/images/','format','%s-%s','now','/:id/avatar','single','file','addAvatar','/:id/login','login','/:id/logout','pause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','/:id/password','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeFaxAccounts','removeMailAccounts'];(function(_0x4f5189,_0x25c90d){var _0x25e590=function(_0x1fa5ac){while(--_0x1fa5ac){_0x4f5189['push'](_0x4f5189['shift']());}};_0x25e590(++_0x25c90d);}(_0x7229,0x76));var _0x9722=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x7229[_0x4ae625];return _0x31accf;};'use strict';var multer=require(_0x9722('0x0'));var util=require(_0x9722('0x1'));var path=require(_0x9722('0x2'));var timeout=require(_0x9722('0x3'));var express=require(_0x9722('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9722('0x5'));var interaction=require(_0x9722('0x6'));var config=require(_0x9722('0x7'));var controller=require(_0x9722('0x8'));router[_0x9722('0x9')]('/',auth[_0x9722('0xa')](),controller[_0x9722('0xb')]);router['get'](_0x9722('0xc'),auth['isAuthenticated'](),controller[_0x9722('0xd')]);router[_0x9722('0x9')](_0x9722('0xe'),auth[_0x9722('0xa')](),controller[_0x9722('0xf')]);router[_0x9722('0x9')](_0x9722('0x10'),auth[_0x9722('0xa')](),controller['getPresence']);router['get'](_0x9722('0x11'),auth[_0x9722('0xa')](),controller[_0x9722('0x12')]);router[_0x9722('0x9')]('/:id/avatar',controller[_0x9722('0x13')]);router[_0x9722('0x9')](_0x9722('0x14'),auth[_0x9722('0xa')](),controller['getOpenTabs']);router[_0x9722('0x9')](_0x9722('0x15'),auth[_0x9722('0xa')](),controller[_0x9722('0x16')]);router[_0x9722('0x9')]('/:id/queues',auth[_0x9722('0xa')](),controller[_0x9722('0x17')]);router[_0x9722('0x9')]('/:id/queues_rt',auth[_0x9722('0xa')](),controller[_0x9722('0x18')]);router['get'](_0x9722('0x19'),auth[_0x9722('0xa')](),controller[_0x9722('0x1a')]);router['get'](_0x9722('0x1b'),auth[_0x9722('0xa')](),controller[_0x9722('0x1c')]);router[_0x9722('0x9')](_0x9722('0x1d'),auth[_0x9722('0xa')](),controller[_0x9722('0x1e')]);router[_0x9722('0x9')](_0x9722('0x1f'),auth[_0x9722('0xa')](),controller[_0x9722('0x20')]);router[_0x9722('0x9')](_0x9722('0x21'),auth[_0x9722('0xa')](),controller[_0x9722('0x22')]);router[_0x9722('0x9')]('/:id/mail/interactions',auth[_0x9722('0xa')](),controller[_0x9722('0x23')]);router[_0x9722('0x9')](_0x9722('0x24'),auth[_0x9722('0xa')](),controller[_0x9722('0x25')]);router['get'](_0x9722('0x26'),auth[_0x9722('0xa')](),controller[_0x9722('0x27')]);router[_0x9722('0x9')](_0x9722('0x28'),auth[_0x9722('0xa')](),controller[_0x9722('0x29')]);router[_0x9722('0x9')]('/:id/teams',auth[_0x9722('0xa')](),controller['getTeams']);router[_0x9722('0x9')](_0x9722('0x2a'),auth[_0x9722('0xa')](),controller[_0x9722('0x2b')]);router[_0x9722('0x9')](_0x9722('0x2c'),auth[_0x9722('0xa')](),controller[_0x9722('0x2d')]);router['get'](_0x9722('0x2e'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0x9722('0x9')](_0x9722('0x2f'),auth['isAuthenticated'](),controller[_0x9722('0x30')]);router[_0x9722('0x9')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x9722('0x31')]);router[_0x9722('0x9')](_0x9722('0x32'),auth[_0x9722('0xa')](),controller[_0x9722('0x33')]);router[_0x9722('0x9')]('/:id/sms_accounts',auth[_0x9722('0xa')](),controller[_0x9722('0x34')]);router[_0x9722('0x9')](_0x9722('0x35'),auth['isAuthenticated'](),controller[_0x9722('0x36')]);router[_0x9722('0x9')](_0x9722('0x37'),auth['isAuthenticated'](),controller['getWhatsappAccounts']);router[_0x9722('0x9')]('/:id/scheduled_calls',auth[_0x9722('0xa')](),controller[_0x9722('0x38')]);router[_0x9722('0x9')](_0x9722('0x39'),auth[_0x9722('0xa')](),controller[_0x9722('0x3a')]);router[_0x9722('0x3b')](_0x9722('0x15'),auth[_0x9722('0xa')](),controller[_0x9722('0x3c')]);router[_0x9722('0x3b')]('/',auth[_0x9722('0xa')](),controller['create']);router['post'](_0x9722('0x3d'),auth[_0x9722('0xa')](),controller[_0x9722('0x3e')]);router[_0x9722('0x3b')](_0x9722('0x3f'),auth[_0x9722('0xa')](),controller[_0x9722('0x40')]);var upload=multer({'storage':multer[_0x9722('0x41')]({'destination':function(_0x519368,_0x44b9f4,_0x51b148){_0x51b148(null,path['join'](config[_0x9722('0x42')],_0x9722('0x43')));},'filename':function(_0x33c1d4,_0x57b60e,_0x256554){_0x256554(null,util[_0x9722('0x44')](_0x9722('0x45'),Date[_0x9722('0x46')](),_0x57b60e['originalname']));}})});router['post'](_0x9722('0x47'),upload[_0x9722('0x48')](_0x9722('0x49')),controller[_0x9722('0x4a')]);router[_0x9722('0x3b')](_0x9722('0x4b'),auth[_0x9722('0xa')](),controller[_0x9722('0x4c')]);router[_0x9722('0x3b')](_0x9722('0x4d'),auth['isAuthenticated'](),controller['logout']);router['post']('/:id/pause',auth[_0x9722('0xa')](),controller[_0x9722('0x4e')]);router['post']('/:id/unpause',auth[_0x9722('0xa')](),controller['unpause']);router['post'](_0x9722('0x4f'),auth[_0x9722('0xa')](),controller[_0x9722('0x50')]);router[_0x9722('0x3b')](_0x9722('0x51'),auth[_0x9722('0xa')](),controller[_0x9722('0x52')]);router['post'](_0x9722('0x53'),auth[_0x9722('0xa')](),controller[_0x9722('0x54')]);router['post'](_0x9722('0x55'),auth[_0x9722('0xa')](),controller[_0x9722('0x56')]);router[_0x9722('0x3b')](_0x9722('0x57'),auth[_0x9722('0xa')](),controller['addSmsInteractions']);router[_0x9722('0x3b')](_0x9722('0x58'),auth[_0x9722('0xa')](),controller['addOpenchannelInteractions']);router[_0x9722('0x3b')](_0x9722('0x59'),auth[_0x9722('0xa')](),controller[_0x9722('0x5a')]);router['post'](_0x9722('0x2f'),auth[_0x9722('0xa')](),controller[_0x9722('0x5b')]);router[_0x9722('0x3b')](_0x9722('0x5c'),auth[_0x9722('0xa')](),controller[_0x9722('0x5d')]);router['post'](_0x9722('0x32'),auth[_0x9722('0xa')](),controller[_0x9722('0x5e')]);router[_0x9722('0x3b')](_0x9722('0x5f'),auth[_0x9722('0xa')](),controller['addSmsAccounts']);router[_0x9722('0x3b')](_0x9722('0x35'),auth[_0x9722('0xa')](),controller[_0x9722('0x60')]);router[_0x9722('0x3b')](_0x9722('0x37'),auth[_0x9722('0xa')](),controller[_0x9722('0x61')]);router[_0x9722('0x3b')]('/:id/api_key',auth[_0x9722('0xa')](),controller[_0x9722('0x62')]);router[_0x9722('0x63')](_0x9722('0x11'),auth[_0x9722('0xa')](),controller['update']);router['put'](_0x9722('0x64'),auth[_0x9722('0xa')](),controller['changePassword']);router[_0x9722('0x65')](_0x9722('0x3f'),auth['isAuthenticated'](),controller[_0x9722('0x66')]);router[_0x9722('0x65')]('/:id/teams',auth[_0x9722('0xa')](),controller[_0x9722('0x67')]);router[_0x9722('0x65')](_0x9722('0x11'),auth['isAuthenticated'](),controller[_0x9722('0x68')]);router[_0x9722('0x65')](_0x9722('0x51'),auth['isAuthenticated'](),controller[_0x9722('0x69')]);router[_0x9722('0x65')](_0x9722('0x53'),auth[_0x9722('0xa')](),controller['removeMailInteractions']);router['delete'](_0x9722('0x55'),auth[_0x9722('0xa')](),controller[_0x9722('0x6a')]);router[_0x9722('0x65')](_0x9722('0x57'),auth[_0x9722('0xa')](),controller[_0x9722('0x6b')]);router[_0x9722('0x65')](_0x9722('0x58'),auth[_0x9722('0xa')](),controller['removeOpenchannelInteractions']);router[_0x9722('0x65')](_0x9722('0x59'),auth[_0x9722('0xa')](),controller['removeWhatsappInteractions']);router['delete'](_0x9722('0x2f'),auth[_0x9722('0xa')](),controller[_0x9722('0x6c')]);router[_0x9722('0x65')](_0x9722('0x5c'),auth[_0x9722('0xa')](),controller[_0x9722('0x6d')]);router[_0x9722('0x65')](_0x9722('0x32'),auth[_0x9722('0xa')](),controller[_0x9722('0x6e')]);router[_0x9722('0x65')](_0x9722('0x5f'),auth['isAuthenticated'](),controller['removeSmsAccounts']);router['delete'](_0x9722('0x35'),auth[_0x9722('0xa')](),controller[_0x9722('0x6f')]);router[_0x9722('0x65')](_0x9722('0x37'),auth[_0x9722('0xa')](),controller[_0x9722('0x70')]);router[_0x9722('0x65')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x9722('0x71')]);module['exports']=router; \ No newline at end of file +var _0x1af8=['post','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','now','single','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addSmsAccounts','addChatWebsites','createApiKey','put','/:id/password','removeQueues','delete','removeTeams','removeChatInteractions','/:id/mail_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','whoami','getPresence','/:id','show','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/api_key'];(function(_0x1ded31,_0x1045f2){var _0x468251=function(_0x38ec0f){while(--_0x38ec0f){_0x1ded31['push'](_0x1ded31['shift']());}};_0x468251(++_0x1045f2);}(_0x1af8,0x99));var _0x81af=function(_0x2fe07e,_0x378166){_0x2fe07e=_0x2fe07e-0x0;var _0x2bc9f0=_0x1af8[_0x2fe07e];return _0x2bc9f0;};'use strict';var multer=require(_0x81af('0x0'));var util=require('util');var path=require(_0x81af('0x1'));var timeout=require(_0x81af('0x2'));var express=require(_0x81af('0x3'));var router=express[_0x81af('0x4')]();var fs_extra=require(_0x81af('0x5'));var auth=require(_0x81af('0x6'));var interaction=require(_0x81af('0x7'));var config=require(_0x81af('0x8'));var controller=require('./user.controller');router[_0x81af('0x9')]('/',auth[_0x81af('0xa')](),controller[_0x81af('0xb')]);router[_0x81af('0x9')]('/describe',auth[_0x81af('0xa')](),controller['describe']);router[_0x81af('0x9')]('/whoami',auth[_0x81af('0xa')](),controller[_0x81af('0xc')]);router[_0x81af('0x9')]('/presence',auth[_0x81af('0xa')](),controller[_0x81af('0xd')]);router[_0x81af('0x9')](_0x81af('0xe'),auth[_0x81af('0xa')](),controller[_0x81af('0xf')]);router[_0x81af('0x9')](_0x81af('0x10'),controller[_0x81af('0x11')]);router[_0x81af('0x9')]('/:id/open_tabs',auth[_0x81af('0xa')](),controller[_0x81af('0x12')]);router['get'](_0x81af('0x13'),auth[_0x81af('0xa')](),controller[_0x81af('0x14')]);router[_0x81af('0x9')](_0x81af('0x15'),auth[_0x81af('0xa')](),controller['getQueues']);router['get'](_0x81af('0x16'),auth['isAuthenticated'](),controller[_0x81af('0x17')]);router[_0x81af('0x9')]('/:id/groups',auth[_0x81af('0xa')](),controller[_0x81af('0x18')]);router[_0x81af('0x9')](_0x81af('0x19'),auth['isAuthenticated'](),controller[_0x81af('0x1a')]);router['get'](_0x81af('0x1b'),auth[_0x81af('0xa')](),controller['getScreenRecordings']);router[_0x81af('0x9')](_0x81af('0x1c'),auth[_0x81af('0xa')](),controller[_0x81af('0x1d')]);router[_0x81af('0x9')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router['get'](_0x81af('0x1e'),auth[_0x81af('0xa')](),controller[_0x81af('0x1f')]);router[_0x81af('0x9')](_0x81af('0x20'),auth['isAuthenticated'](),controller[_0x81af('0x21')]);router[_0x81af('0x9')](_0x81af('0x22'),auth[_0x81af('0xa')](),controller['getFaxInteractions']);router[_0x81af('0x9')]('/:id/whatsapp/interactions',auth[_0x81af('0xa')](),controller[_0x81af('0x23')]);router[_0x81af('0x9')](_0x81af('0x24'),auth[_0x81af('0xa')](),controller[_0x81af('0x25')]);router[_0x81af('0x9')]('/:id/lists',auth[_0x81af('0xa')](),controller[_0x81af('0x26')]);router[_0x81af('0x9')](_0x81af('0x27'),auth['isAuthenticated'](),controller[_0x81af('0x28')]);router[_0x81af('0x9')]('/:id/prefixes',auth[_0x81af('0xa')](),controller[_0x81af('0x29')]);router[_0x81af('0x9')](_0x81af('0x2a'),auth[_0x81af('0xa')](),controller[_0x81af('0x2b')]);router['get'](_0x81af('0x2c'),auth[_0x81af('0xa')](),controller[_0x81af('0x2d')]);router[_0x81af('0x9')](_0x81af('0x2e'),auth[_0x81af('0xa')](),controller[_0x81af('0x2f')]);router[_0x81af('0x9')](_0x81af('0x30'),auth[_0x81af('0xa')](),controller['getSmsAccounts']);router[_0x81af('0x9')](_0x81af('0x31'),auth['isAuthenticated'](),controller['getChatWebsites']);router['get'](_0x81af('0x32'),auth[_0x81af('0xa')](),controller[_0x81af('0x33')]);router[_0x81af('0x9')]('/:id/scheduled_calls',auth[_0x81af('0xa')](),controller['getScheduledCalls']);router['get'](_0x81af('0x34'),auth['isAuthenticated'](),controller['getApiKey']);router[_0x81af('0x35')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router[_0x81af('0x35')]('/',auth['isAuthenticated'](),controller[_0x81af('0x36')]);router[_0x81af('0x35')](_0x81af('0x37'),auth[_0x81af('0xa')](),controller[_0x81af('0x38')]);router['post'](_0x81af('0x15'),auth[_0x81af('0xa')](),controller[_0x81af('0x39')]);var upload=multer({'storage':multer[_0x81af('0x3a')]({'destination':function(_0x34040c,_0x126027,_0x22d380){_0x22d380(null,path[_0x81af('0x3b')](config[_0x81af('0x3c')],_0x81af('0x3d')));},'filename':function(_0x46ac71,_0x291c60,_0x1a4e40){_0x1a4e40(null,util[_0x81af('0x3e')]('%s-%s',Date[_0x81af('0x3f')](),_0x291c60['originalname']));}})});router['post']('/:id/avatar',upload[_0x81af('0x40')]('file'),controller[_0x81af('0x41')]);router[_0x81af('0x35')](_0x81af('0x42'),auth[_0x81af('0xa')](),controller[_0x81af('0x43')]);router['post'](_0x81af('0x44'),auth[_0x81af('0xa')](),controller[_0x81af('0x45')]);router['post'](_0x81af('0x46'),auth[_0x81af('0xa')](),controller[_0x81af('0x47')]);router[_0x81af('0x35')]('/:id/unpause',auth[_0x81af('0xa')](),controller[_0x81af('0x48')]);router[_0x81af('0x35')]('/:id/teams',auth[_0x81af('0xa')](),controller[_0x81af('0x49')]);router[_0x81af('0x35')](_0x81af('0x4a'),auth[_0x81af('0xa')](),controller[_0x81af('0x4b')]);router[_0x81af('0x35')]('/:id/mail_interactions',auth[_0x81af('0xa')](),controller[_0x81af('0x4c')]);router[_0x81af('0x35')](_0x81af('0x4d'),auth['isAuthenticated'](),controller['addFaxInteractions']);router[_0x81af('0x35')](_0x81af('0x4e'),auth[_0x81af('0xa')](),controller[_0x81af('0x4f')]);router[_0x81af('0x35')](_0x81af('0x50'),auth[_0x81af('0xa')](),controller[_0x81af('0x51')]);router[_0x81af('0x35')](_0x81af('0x52'),auth[_0x81af('0xa')](),controller[_0x81af('0x53')]);router['post'](_0x81af('0x2a'),auth[_0x81af('0xa')](),controller['addFaxAccounts']);router[_0x81af('0x35')](_0x81af('0x2c'),auth['isAuthenticated'](),controller[_0x81af('0x54')]);router[_0x81af('0x35')]('/:id/openchannel_accounts',auth[_0x81af('0xa')](),controller['addOpenchannelAccounts']);router[_0x81af('0x35')](_0x81af('0x30'),auth[_0x81af('0xa')](),controller[_0x81af('0x55')]);router[_0x81af('0x35')](_0x81af('0x31'),auth[_0x81af('0xa')](),controller[_0x81af('0x56')]);router[_0x81af('0x35')]('/:id/whatsapp_accounts',auth[_0x81af('0xa')](),controller['addWhatsappAccounts']);router[_0x81af('0x35')](_0x81af('0x34'),auth[_0x81af('0xa')](),controller[_0x81af('0x57')]);router[_0x81af('0x58')](_0x81af('0xe'),auth[_0x81af('0xa')](),controller['update']);router[_0x81af('0x58')](_0x81af('0x59'),auth[_0x81af('0xa')](),controller['changePassword']);router['delete']('/:id/queues',auth['isAuthenticated'](),controller[_0x81af('0x5a')]);router[_0x81af('0x5b')](_0x81af('0x24'),auth[_0x81af('0xa')](),controller[_0x81af('0x5c')]);router[_0x81af('0x5b')]('/:id',auth[_0x81af('0xa')](),controller['destroy']);router[_0x81af('0x5b')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x81af('0x5d')]);router[_0x81af('0x5b')](_0x81af('0x5e'),auth[_0x81af('0xa')](),controller['removeMailInteractions']);router['delete'](_0x81af('0x4d'),auth[_0x81af('0xa')](),controller['removeFaxInteractions']);router['delete']('/:id/sms_interactions',auth[_0x81af('0xa')](),controller['removeSmsInteractions']);router[_0x81af('0x5b')]('/:id/openchannel_interactions',auth[_0x81af('0xa')](),controller[_0x81af('0x5f')]);router[_0x81af('0x5b')](_0x81af('0x52'),auth[_0x81af('0xa')](),controller[_0x81af('0x60')]);router[_0x81af('0x5b')]('/:id/fax_accounts',auth[_0x81af('0xa')](),controller[_0x81af('0x61')]);router['delete']('/:id/mail_accounts',auth[_0x81af('0xa')](),controller['removeMailAccounts']);router[_0x81af('0x5b')](_0x81af('0x2e'),auth[_0x81af('0xa')](),controller[_0x81af('0x62')]);router['delete'](_0x81af('0x30'),auth[_0x81af('0xa')](),controller[_0x81af('0x63')]);router[_0x81af('0x5b')](_0x81af('0x31'),auth[_0x81af('0xa')](),controller[_0x81af('0x64')]);router[_0x81af('0x5b')](_0x81af('0x32'),auth[_0x81af('0xa')](),controller[_0x81af('0x65')]);router[_0x81af('0x5b')](_0x81af('0x34'),auth[_0x81af('0xa')](),controller['removeApiKey']);module[_0x81af('0x66')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 6534bc2..83526a1 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 _0xa9e0=['certificate','passive','nonat','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0x2142c8,_0x3001eb){var _0x4286e9=function(_0x43d768){while(--_0x43d768){_0x2142c8['push'](_0x2142c8['shift']());}};_0x4286e9(++_0x3001eb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a9e('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x14')},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x0a9e('0xc'),_0x0a9e('0x17')),'allowNull':!![],'defaultValue':_0x0a9e('0x16')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')]('ALLOWED_NOT_SCREENED',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),'PROHIB_PASSED_SCREEN',_0x0a9e('0x1d'),_0x0a9e('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x540530){this[_0x0a9e('0x4')]('transport',_0x540530?_0x540530[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))['split'](','):null;},'comment':_0x0a9e('0x22')},'dtmfmode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x23'),_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27')),'allowNull':!![],'defaultValue':_0x0a9e('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no','nonat',_0x0a9e('0x29'),_0x0a9e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0x15de0e){this['setDataValue']('nat',_0x15de0e?_0x15de0e[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this[_0x0a9e('0x8')](_0x0a9e('0x2c'))[_0x0a9e('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a9e('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a9e('0x3')]},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a9e('0x2e'),'set':function(_0x40d766){this['setDataValue'](_0x0a9e('0x2f'),_0x40d766?_0x40d766[_0x0a9e('0x20')](';'):_0x0a9e('0x2e'));},'get':function(){return this[_0x0a9e('0x8')]('allow')?this['getDataValue'](_0x0a9e('0x2f'))[_0x0a9e('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x5b4f5e){this[_0x0a9e('0x4')](_0x0a9e('0x30'),_0x5b4f5e?_0x5b4f5e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x30'))?this[_0x0a9e('0x8')](_0x0a9e('0x30'))[_0x0a9e('0x2d')](','):null;},'comment':_0x0a9e('0x31')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x32')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x28')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38')),'allowNull':!![],'defaultValue':_0x0a9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','fingerprint',_0x0a9e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no',_0x0a9e('0x3b'),_0x0a9e('0x29'),_0x0a9e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a9e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3649cc){this['setDataValue'](_0x0a9e('0x3e'),_0x3649cc);var _0x5ba1f9=this['get']({'plain':!![]});switch(_0x3649cc){case 0x0:case 0x1:var _0x5674ee=_0x5ba1f9[_0x0a9e('0x21')]?_['isArray'](_0x5ba1f9[_0x0a9e('0x21')])?_0x5ba1f9[_0x0a9e('0x21')][_0x0a9e('0x20')]():_0x5ba1f9[_0x0a9e('0x21')]:_0x0a9e('0x1f');if(_0x5674ee===_0x0a9e('0x3f')){_0x5674ee='udp';}this[_0x0a9e('0x4')]('transport',_0x5674ee);this[_0x0a9e('0x4')](_0x0a9e('0x40'),'no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x41'),null);this[_0x0a9e('0x4')](_0x0a9e('0x42'),null);this['setDataValue'](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('dtlsverify',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this[_0x0a9e('0x4')]('dtlsprivatekey',null);this[_0x0a9e('0x4')](_0x0a9e('0x46'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x3f'));this['setDataValue']('encryption',_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x47'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x41'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x42'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x49'));this['setDataValue'](_0x0a9e('0x45'),_0x5ba1f9[_0x0a9e('0x45')]||_0x0a9e('0x4a'));this['setDataValue'](_0x0a9e('0x4b'),_0x5ba1f9[_0x0a9e('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0a9e('0x3d')],'set':function(_0x13b5c0){this['setDataValue']('permissions',_0x13b5c0?_0x13b5c0['join'](','):[]);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x4c'))?_[_0x0a9e('0x4d')](this[_0x0a9e('0x8')](_0x0a9e('0x4c'))[_0x0a9e('0x2d')](','),function(_0xeef20){return parseInt(_0xeef20,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x4e')],'get':function(){return this[_0x0a9e('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a9e('0x8')](_0x0a9e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0xdb98ca){if(typeof _0xdb98ca===_0x0a9e('0x50')){var _0x3df0e3=_0xdb98ca==='1'?!![]:_0xdb98ca==='0'?![]:_0xdb98ca===_0x0a9e('0x51')?!![]:_0xdb98ca===_0x0a9e('0x52')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0x3df0e3);}else{this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0xdb98ca);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf4120f){this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0xf4120f);if(_0xf4120f===!![]){this['setDataValue'](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')](_0x0a9e('0x56'),0x0);}else{this[_0x0a9e('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0a9e('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0}}; \ No newline at end of file +var _0x70e0=['refuse','originate','uac','uas','fingerprint','update,nonat','TEXT','showWebBar','get','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','BOOLEAN','DATE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','join','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','accept'];(function(_0x1852aa,_0xb3b15f){var _0xba0dca=function(_0x5d675a){while(--_0x5d675a){_0x1852aa['push'](_0x1852aa['shift']());}};_0xba0dca(++_0xb3b15f);}(_0x70e0,0x17b));var _0x070e=function(_0x19f0d0,_0x91b5cf){_0x19f0d0=_0x19f0d0-0x0;var _0x227c64=_0x70e0[_0x19f0d0];return _0x227c64;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));var util=require(_0x070e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'unique':_0x070e('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x277d32){this[_0x070e('0x5')]('name',_0x277d32);this[_0x070e('0x5')]('defaultuser',_0x277d32);},'comment':_0x070e('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x56e420){this['setDataValue'](_0x070e('0x7'),_0x56e420);this[_0x070e('0x5')](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),_0x56e420,this[_0x070e('0xb')](_0x070e('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x070e('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2e3e5e){if(_0x2e3e5e){this[_0x070e('0x5')](_0x070e('0xd'),_0x2e3e5e[_0x070e('0xe')]());}}},'role':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x10'),_0x070e('0x11'),_0x070e('0x12'),_0x070e('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4a33d2){this['setDataValue'](_0x070e('0xc'),_0x4a33d2);this[_0x070e('0x5')]('accountcode',_0x4a33d2);this['setDataValue'](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),this[_0x070e('0xb')]('fullname'),_0x4a33d2));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x070e('0x3')]},'mobile':{'type':Sequelize[_0x070e('0x3')]},'address':{'type':Sequelize[_0x070e('0x3')]},'zipcode':{'type':Sequelize[_0x070e('0x3')]},'userpic':{'type':Sequelize[_0x070e('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x070e('0x3')]},'online':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x070e('0x16')]},'voicePause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x070e('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x070e('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x17')},'ipaddr':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x070e('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x18'),_0x070e('0x11'),_0x070e('0x19')),'allowNull':!![],'defaultValue':_0x070e('0x18')},'context':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x1a'),_0x070e('0x1b'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x070e('0x1c'),_0x070e('0x1d'),_0x070e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x59c5b4){this[_0x070e('0x5')]('transport',_0x59c5b4?_0x59c5b4[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')]('transport')?this['getDataValue'](_0x070e('0x20'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x070e('0x22'),_0x070e('0x23'),_0x070e('0x24'),_0x070e('0x25'),_0x070e('0x26')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x28'),_0x070e('0x29'),_0x070e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x2b'),'set':function(_0x34746e){this['setDataValue']('nat',_0x34746e?_0x34746e['join'](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2c'))?this[_0x070e('0xb')](_0x070e('0x2c'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x070e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x070e('0x3')]},'pickupgroup':{'type':Sequelize[_0x070e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x070e('0x3')]},'disallow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':_0x070e('0x2d'),'set':function(_0x4800a9){this[_0x070e('0x5')]('allow',_0x4800a9?_0x4800a9[_0x070e('0x1f')](';'):_0x070e('0x2d'));},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2e'))?this[_0x070e('0xb')]('allow')[_0x070e('0x21')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'set':function(_0x38879f){this['setDataValue'](_0x070e('0x2f'),_0x38879f?_0x38879f[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2f'))?this['getDataValue'](_0x070e('0x2f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x30')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x31')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x32'),_0x070e('0x33'),_0x070e('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x35'),'uas'),'allowNull':!![],'defaultValue':_0x070e('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'keepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x37'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x070e('0xf')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x28'),'update',_0x070e('0x38')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x070e('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x070e('0x39')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4cb86f){this['setDataValue'](_0x070e('0x3a'),_0x4cb86f);var _0x1ae5cb=this[_0x070e('0x3b')]({'plain':!![]});switch(_0x4cb86f){case 0x0:case 0x1:var _0x122198=_0x1ae5cb[_0x070e('0x20')]?_[_0x070e('0x3c')](_0x1ae5cb['transport'])?_0x1ae5cb[_0x070e('0x20')]['join']():_0x1ae5cb[_0x070e('0x20')]:'udp';if(_0x122198===_0x070e('0x3d')){_0x122198=_0x070e('0x3e');}this['setDataValue'](_0x070e('0x20'),_0x122198);this['setDataValue'](_0x070e('0x3f'),'no');this[_0x070e('0x5')](_0x070e('0x40'),null);this[_0x070e('0x5')](_0x070e('0x41'),null);this[_0x070e('0x5')](_0x070e('0x42'),null);this[_0x070e('0x5')](_0x070e('0x43'),null);this[_0x070e('0x5')](_0x070e('0x44'),null);this[_0x070e('0x5')](_0x070e('0x45'),null);this[_0x070e('0x5')]('dtlscertfile',null);this[_0x070e('0x5')](_0x070e('0x46'),null);this[_0x070e('0x5')](_0x070e('0x47'),'no');break;case 0x2:this['setDataValue'](_0x070e('0x20'),_0x070e('0x3d'));this[_0x070e('0x5')](_0x070e('0x3f'),_0x070e('0x27'));this[_0x070e('0x5')]('avpf',_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x41'),_0x070e('0x27'));this['setDataValue'](_0x070e('0x42'),'yes');this[_0x070e('0x5')](_0x070e('0x43'),_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x44'),'no');this['setDataValue'](_0x070e('0x45'),_0x070e('0x48'));this[_0x070e('0x5')](_0x070e('0x49'),_0x1ae5cb['dtlscertfile']||_0x070e('0x4a'));this['setDataValue'](_0x070e('0x46'),_0x1ae5cb[_0x070e('0x46')]||_0x070e('0x4b'));this['setDataValue'](_0x070e('0x47'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x070e('0x39')],'set':function(_0x5ce157){this[_0x070e('0x5')](_0x070e('0x4c'),_0x5ce157?_0x5ce157['join'](','):[]);},'get':function(){return this[_0x070e('0xb')]('permissions')?_[_0x070e('0x4d')](this[_0x070e('0xb')]('permissions')['split'](','),function(_0x29ee66){return parseInt(_0x29ee66,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x070e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x070e('0x4e')],'get':function(){return this[_0x070e('0xb')](_0x070e('0x4f'))?this[_0x070e('0xb')](_0x070e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x070e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4f720f){if(typeof _0x4f720f==='string'){var _0x1624cd=_0x4f720f==='1'?!![]:_0x4f720f==='0'?![]:_0x4f720f===_0x070e('0x50')?!![]:_0x4f720f===_0x070e('0x51')?![]:![];this[_0x070e('0x5')]('screenrecording',_0x1624cd);}else{this[_0x070e('0x5')](_0x070e('0x52'),_0x4f720f);}}},'blocked':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![],'set':function(_0xd74f9c){this[_0x070e('0x5')](_0x070e('0x53'),_0xd74f9c);if(_0xd74f9c===!![]){this['setDataValue'](_0x070e('0x54'),moment());this['setDataValue'](_0x070e('0x55'),0x0);}else{this[_0x070e('0x5')](_0x070e('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x070e('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x070e('0x14')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index d15e7e5..2b55731 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 _0x15f3=['user_has_mail_interactions:remove','addFaxInteractions','spread','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','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','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notLike','$iLike','$notILike','$like','$contained','$any','lastName','CmContact','Contact','dialActive','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','token','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','teams','queues','flatten','col','desc','asc','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','voiceStatus','slice','toUpperCase','select','field','ui.','InteractionId','ui.createdAt','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','moment','path','lodash','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','redis','./user.socket','register','defaults','localhost','client','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','update','role','agent','emit','userNotification:recalc:','destroy','admin','Users','user','Agents','telephone','ignore','value','includes','find','sendStatus','index','User','rawAttributes','map','key','filter','password','salt','name','getOptions','where','query','true','include','UserSetting','userSetting','attributes','push','findAll','rows','dataValues','sms','fax','mail','whatsapp','all','model','filters','intersection','fields','length','includeAll','openTabs','chat','openchannel','body','params','describe','addContacts','omit','internal','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','from','VoiceMail','fullname','email','permissions','101','102','103','113','110','105','106','107','108','100','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','UserProfileSection','Telephones','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','isEmpty','compact','changePassword','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','Sequelize','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','validatePasswordHistory','previousPasswords','addQueues','channel','online','loginInPause','voicePause','Unknown\x20channel','add','toLowerCase','Queues','ids','capitalize','QueueId','Queue:save','VoiceQueue','get','voice','format','interface','penalty','UserVoiceQueueRt','upsert','isValidChannel','Queue:remove','addAvatar','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','userpic','download','existsSync','server/files/images/','getOpenTabs','CHAT','createdAt','FaxOpenTabs','OPENCHANNEL','MailOpenTabs','WhatsappOpenTabs','WHATSAPP','concat','getContacts','order','sort','pick','merge','options','hasOwnProperty','List','Tag','Tags','color','tag','nolimit','keys','Queue','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','phone','LOCAL/%s@from-sip/n','intrf','SIP/%s','headers','x-forwarded-for','socket','remoteAddress','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','PAUSE','LOGININPAUSE','resolve','logout','QueuePause','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','getDataValue','Voice','UserVoicePrefix','removeTeams','isArray','Query\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','removeAgent','TeamVoicePrefix','VoicePrefixId','getLists','getAgents','values','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions'];(function(_0x5eec91,_0x2c1d91){var _0x41cacf=function(_0x3b05c1){while(--_0x3b05c1){_0x5eec91['push'](_0x5eec91['shift']());}};_0x41cacf(++_0x2c1d91);}(_0x15f3,0x67));var _0x315f=function(_0xa7543f,_0x5491d2){_0xa7543f=_0xa7543f-0x0;var _0x4f4895=_0x15f3[_0xa7543f];return _0x4f4895;};'use strict';var moment=require(_0x315f('0x0'));var util=require('util');var path=require(_0x315f('0x1'));var fs=require('fs');var _=require(_0x315f('0x2'));var squel=require('squel');var jayson=require(_0x315f('0x3'));var Redis=require(_0x315f('0x4'));var authService=require(_0x315f('0x5'));var qs=require(_0x315f('0x6'));var logger=require(_0x315f('0x7'))('api');var utils=require(_0x315f('0x8'));var config=require(_0x315f('0x9'));var licenseUtil=require(_0x315f('0xa'));var APIBadRequestError=require(_0x315f('0xb'))[_0x315f('0xc')];var APINotFoundError=require('../../errors/api')[_0x315f('0xd')];var APIHandleError=require(_0x315f('0xb'))[_0x315f('0xe')];var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x315f('0xf')]));require(_0x315f('0x10'))[_0x315f('0x11')](socket);config[_0x315f('0xf')]=_[_0x315f('0x12')](config['redis'],{'host':_0x315f('0x13'),'port':0x18eb});var amiClient=jayson[_0x315f('0x14')]['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x51a9db,_0x279b43,_0x17381d,_0x1ad9fd){return new Promise(function(_0x559eb3,_0x3c4bc9){var _0x46ce3b=_0x1ad9fd||amiClient;return _0x46ce3b[_0x315f('0x15')](_0x51a9db,_0x17381d)[_0x315f('0x16')](function(_0x2dd5dd){logger[_0x315f('0x17')](_0x315f('0x18'),_0x279b43,_0x315f('0x19'));logger[_0x315f('0x1a')]('User,\x20%s,\x20%s,\x20%s',_0x279b43,_0x315f('0x19'),JSON['stringify'](_0x2dd5dd));if(_0x2dd5dd[_0x315f('0x1b')]){if(_0x2dd5dd[_0x315f('0x1b')][_0x315f('0x1c')]===0x1f4){logger[_0x315f('0x1b')]('User,\x20%s,\x20%s',_0x279b43,_0x2dd5dd['error']['message']);return _0x3c4bc9(_0x2dd5dd[_0x315f('0x1b')][_0x315f('0x1d')]);}logger[_0x315f('0x1b')](_0x315f('0x18'),_0x279b43,_0x2dd5dd[_0x315f('0x1b')]['message']);return _0x559eb3(_0x2dd5dd[_0x315f('0x1b')][_0x315f('0x1d')]);}else{logger['info'](_0x315f('0x18'),_0x279b43,'request\x20sent');_0x559eb3(_0x2dd5dd[_0x315f('0x1e')][_0x315f('0x1d')]);}})[_0x315f('0x1f')](function(_0x591eb3){logger[_0x315f('0x1b')](_0x315f('0x18'),_0x279b43,_0x591eb3);_0x3c4bc9(_0x591eb3);});});}function respondWithStatusCode(_0x4d7f37,_0x4aeae4){_0x4aeae4=_0x4aeae4||0xcc;return function(_0x27b82c){if(_0x27b82c){return _0x4d7f37['sendStatus'](_0x4aeae4);}return _0x4d7f37[_0x315f('0x20')](_0x4aeae4)[_0x315f('0x21')]();};}function respondWithResult(_0x3b02e7,_0x1eb692){_0x1eb692=_0x1eb692||0xc8;return function(_0x196113){if(_0x196113){return _0x3b02e7[_0x315f('0x20')](_0x1eb692)[_0x315f('0x22')](_0x196113);}};}function respondWithFilteredResult(_0x30069e,_0x264bd3){return function(_0x37408e){if(_0x37408e){var _0x25a794=typeof _0x264bd3[_0x315f('0x23')]===_0x315f('0x24')&&typeof _0x264bd3[_0x315f('0x25')]===_0x315f('0x24');var _0x57e5ea=_0x37408e[_0x315f('0x26')];var _0x2ab00c=_0x25a794?0x0:_0x264bd3[_0x315f('0x23')];var _0x1b9e6a=_0x25a794?_0x37408e['count']:_0x264bd3[_0x315f('0x23')]+_0x264bd3[_0x315f('0x25')];var _0x42da1;if(_0x1b9e6a>=_0x57e5ea){_0x1b9e6a=_0x57e5ea;_0x42da1=0xc8;}else{_0x42da1=0xce;}_0x30069e[_0x315f('0x20')](_0x42da1);return _0x30069e[_0x315f('0x27')](_0x315f('0x28'),_0x2ab00c+'-'+_0x1b9e6a+'/'+_0x57e5ea)['json'](_0x37408e);}return null;};}function saveUpdates(_0x43270c){return function(_0x18717e){if(_0x18717e){return _0x18717e[_0x315f('0x29')](_0x43270c)[_0x315f('0x16')](function(_0x102039){if(_0x102039[_0x315f('0x2a')]===_0x315f('0x2b')){socket[_0x315f('0x2c')](_0x315f('0x2d')+_0x102039['id'],_0x102039);}return _0x102039;});}return null;};}function removeEntity(_0x31240b){return function(_0x32f18f){if(_0x32f18f){return _0x32f18f[_0x315f('0x2e')]()['then'](function(){var _0x2dcb4c=_0x32f18f['get']({'plain':!![]});if(_0x2dcb4c[_0x315f('0x2a')]===_0x315f('0x2f'))return;var _0x404b5c=[{'name':_0x315f('0x30'),'value':_0x315f('0x31'),'ignore':!![]},{'name':_0x315f('0x32'),'value':_0x315f('0x2b'),'ignore':![]},{'name':'Telephones','value':_0x315f('0x33'),'ignore':![]}];var _0x7e1161=_(_0x404b5c)['filter'](_0x315f('0x34'))['map']('value')[_0x315f('0x35')]();if(_[_0x315f('0x36')](_0x7e1161,_0x2dcb4c[_0x315f('0x2a')])){return;}var _0x27b2a6=_[_0x315f('0x37')](_0x404b5c,[_0x315f('0x35'),_0x2dcb4c[_0x315f('0x2a')]])['name'];return db['UserProfileResource'][_0x315f('0x2e')]({'where':{'type':_0x27b2a6,'resourceId':_0x2dcb4c['id']}})[_0x315f('0x16')](function(){return _0x32f18f;});})[_0x315f('0x16')](function(){_0x31240b[_0x315f('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54d41e){return function(_0x4cada3){if(!_0x4cada3){_0x54d41e[_0x315f('0x38')](0x194);}return _0x4cada3;};}function handleError(_0x2e4a1a,_0x569d79){_0x569d79=_0x569d79||0x1f4;return function(_0x14fca7){logger['error'](_0x14fca7['stack']);if(_0x14fca7['name']){delete _0x14fca7['name'];}_0x2e4a1a[_0x315f('0x20')](_0x569d79)['send'](_0x14fca7);};}exports[_0x315f('0x39')]=function(_0x3deab0,_0x58465e){var _0x242ce0={},_0x1c8460={'count':0x0,'rows':[]};var _0x198ae3=_(db[_0x315f('0x3a')][_0x315f('0x3b')])[_0x315f('0x3c')](function(_0x19c41a){return{'name':_0x19c41a['fieldName'],'type':_0x19c41a['type'][_0x315f('0x3d')]};})[_0x315f('0x3e')](function(_0x50d8e3){return!_[_0x315f('0x36')]([_0x315f('0x3f'),_0x315f('0x40')],_0x50d8e3[_0x315f('0x41')]);})[_0x315f('0x35')]();_0x242ce0=qs[_0x315f('0x42')](_0x198ae3,_0x3deab0);var _0x4970c7={'where':_0x242ce0[_0x315f('0x43')]};return db[_0x315f('0x3a')][_0x315f('0x26')](_0x4970c7)[_0x315f('0x16')](function(_0x19b0a5){_0x1c8460[_0x315f('0x26')]=_0x19b0a5;if(_0x3deab0['query']['includeAll']){_0x242ce0['include']=[{'all':!![]}];}if(_0x3deab0[_0x315f('0x44')]['userSetting']===_0x315f('0x45')){_0x242ce0[_0x315f('0x46')]=[{'model':db[_0x315f('0x47')],'as':_0x315f('0x48')}];}if(!_[_0x315f('0x36')](_0x242ce0[_0x315f('0x49')],'id')){_0x242ce0['attributes'][_0x315f('0x4a')]('id');}return db['User'][_0x315f('0x4b')](_0x242ce0);})['then'](function(_0x505a8c){_0x1c8460['rows']=_0x505a8c;if(_0x3deab0[_0x315f('0x44')]['openTabs']==='true'){var _0x251be1=[];for(var _0x42ad9f=0x0;_0x42ad9f<_0x1c8460['rows']['length'];_0x42ad9f++){_0x251be1[_0x315f('0x4a')](get_open_tabs('chat',_0x1c8460[_0x315f('0x4c')][_0x42ad9f][_0x315f('0x4d')]));_0x251be1['push'](get_open_tabs(_0x315f('0x4e'),_0x1c8460[_0x315f('0x4c')][_0x42ad9f]['dataValues']));_0x251be1['push'](get_open_tabs(_0x315f('0x4f'),_0x1c8460[_0x315f('0x4c')][_0x42ad9f][_0x315f('0x4d')]));_0x251be1[_0x315f('0x4a')](get_open_tabs(_0x315f('0x50'),_0x1c8460[_0x315f('0x4c')][_0x42ad9f][_0x315f('0x4d')]));_0x251be1[_0x315f('0x4a')](get_open_tabs('openchannel',_0x1c8460[_0x315f('0x4c')][_0x42ad9f]['dataValues']));_0x251be1[_0x315f('0x4a')](get_open_tabs(_0x315f('0x51'),_0x1c8460[_0x315f('0x4c')][_0x42ad9f][_0x315f('0x4d')]));}return Promise[_0x315f('0x52')](_0x251be1)[_0x315f('0x16')](function(){return _0x1c8460;});}else{return _0x1c8460;}})[_0x315f('0x16')](respondWithFilteredResult(_0x58465e,_0x242ce0))['catch'](handleError(_0x58465e,null));};exports['show']=function(_0x5c43c8,_0x509720){var _0x5e324b={'raw':![],'where':{'id':_0x5c43c8['params']['id']}},_0x42fe93={};_0x42fe93[_0x315f('0x53')]=_['differenceBy'](_['keys'](db[_0x315f('0x3a')][_0x315f('0x3b')]),[_0x315f('0x3f'),_0x315f('0x40')]);_0x42fe93[_0x315f('0x44')]=_['keys'](_0x5c43c8[_0x315f('0x44')]);_0x42fe93[_0x315f('0x54')]=_['intersection'](_0x42fe93[_0x315f('0x53')],_0x42fe93[_0x315f('0x44')]);_0x5e324b[_0x315f('0x49')]=_[_0x315f('0x55')](_0x42fe93[_0x315f('0x53')],qs[_0x315f('0x56')](_0x5c43c8[_0x315f('0x44')][_0x315f('0x56')]));_0x5e324b[_0x315f('0x49')]=_0x5e324b[_0x315f('0x49')][_0x315f('0x57')]?_0x5e324b['attributes']:_0x42fe93['model'];if(_0x5c43c8[_0x315f('0x44')][_0x315f('0x58')]){_0x5e324b['include']=[{'all':!![]}];}if(_0x5c43c8[_0x315f('0x44')]['userSetting']===_0x315f('0x45')){_0x5e324b[_0x315f('0x46')]=[{'model':db['UserSetting'],'as':_0x315f('0x48')}];}_0x5e324b=_['merge']({},_0x5e324b,_0x5c43c8['options']);if(!_[_0x315f('0x36')](_0x5e324b['attributes'],'id')){_0x5e324b[_0x315f('0x49')][_0x315f('0x4a')]('id');}return db[_0x315f('0x3a')][_0x315f('0x37')](_0x5e324b)['then'](handleEntityNotFound(_0x509720,null))[_0x315f('0x16')](function(_0xcb3da1){var _0x2c0671=[];values=_0xcb3da1;if(_0x5c43c8['query'][_0x315f('0x59')]==='true'){_0x2c0671[_0x315f('0x4a')](get_open_tabs(_0x315f('0x5a'),_0xcb3da1[_0x315f('0x4d')]));_0x2c0671['push'](get_open_tabs(_0x315f('0x4e'),_0xcb3da1[_0x315f('0x4d')]));_0x2c0671[_0x315f('0x4a')](get_open_tabs(_0x315f('0x5b'),_0xcb3da1[_0x315f('0x4d')]));_0x2c0671[_0x315f('0x4a')](get_open_tabs('whatsapp',_0xcb3da1['dataValues']));_0x2c0671[_0x315f('0x4a')](get_open_tabs(_0x315f('0x4f'),_0xcb3da1[_0x315f('0x4d')]));_0x2c0671[_0x315f('0x4a')](get_open_tabs(_0x315f('0x50'),_0xcb3da1[_0x315f('0x4d')]));return Promise[_0x315f('0x52')](_0x2c0671);}else{return values;}})[_0x315f('0x16')](function(){return values;})[_0x315f('0x16')](respondWithResult(_0x509720,null))[_0x315f('0x1f')](handleError(_0x509720,null));};exports[_0x315f('0x29')]=function(_0x2435e7,_0x1e2c2c){if(_0x2435e7[_0x315f('0x5c')]['id']){delete _0x2435e7[_0x315f('0x5c')]['id'];}delete _0x2435e7[_0x315f('0x5c')][_0x315f('0x2a')];return db[_0x315f('0x3a')][_0x315f('0x37')]({'where':{'id':_0x2435e7[_0x315f('0x5d')]['id']}})[_0x315f('0x16')](handleEntityNotFound(_0x1e2c2c,null))[_0x315f('0x16')](saveUpdates(_0x2435e7[_0x315f('0x5c')],null))[_0x315f('0x16')](respondWithResult(_0x1e2c2c,null))[_0x315f('0x1f')](handleError(_0x1e2c2c,null));};exports[_0x315f('0x5e')]=function(_0x12e8f5,_0x3709bb){return db[_0x315f('0x3a')][_0x315f('0x5e')]()[_0x315f('0x16')](respondWithResult(_0x3709bb,null))[_0x315f('0x1f')](handleError(_0x3709bb,null));};exports[_0x315f('0x5f')]=function(_0x15cce6,_0x4c880d){return db[_0x315f('0x3a')][_0x315f('0x37')]({'where':{'id':_0x15cce6['params']['id']}})[_0x315f('0x16')](handleEntityNotFound(_0x4c880d,null))[_0x315f('0x16')](function(_0xc459c4){if(_0xc459c4){return _0xc459c4[_0x315f('0x5f')](_0x15cce6['body']['ids'],_[_0x315f('0x60')](_0x15cce6[_0x315f('0x5c')],['ids','id'])||{});}})[_0x315f('0x16')](respondWithResult(_0x4c880d,null))['catch'](handleError(_0x4c880d,null));};function validateUser(_0x4ee210){return new Promise(function(_0x303b33,_0x7d0375){if(_0x4ee210[_0x315f('0x61')])return _0x303b33(_0x4ee210);return db['Setting']['findById'](0x1)[_0x315f('0x16')](function(_0x38f308){if(_0x38f308['securePassword'])authService['validatePasswordPattern'](_0x4ee210['password']);db[_0x315f('0x3a')]['max'](_0x315f('0x61'))['then'](function(_0x5b2d90){if(_[_0x315f('0x62')](_0x5b2d90)){_0x4ee210[_0x315f('0x61')]=_0x38f308[_0x315f('0x63')]||0x1;return;}if(_[_0x315f('0x62')](_0x38f308[_0x315f('0x63')])||_0x38f308[_0x315f('0x63')]===_0x5b2d90){_0x4ee210['internal']=_0x5b2d90+0x1;return;}if(_0x38f308[_0x315f('0x63')]>_0x5b2d90){_0x4ee210['internal']=_0x38f308[_0x315f('0x63')];return;}return db[_0x315f('0x64')][_0x315f('0x44')](_0x315f('0x65'),{'type':db[_0x315f('0x64')][_0x315f('0x66')][_0x315f('0x67')]})[_0x315f('0x16')](function(_0x4a690a){if(_0x4a690a&&_0x4a690a[_0x315f('0x57')]){for(var _0x9dc688=0x0,_0x17431c=_0x4a690a[_0x315f('0x57')];_0x9dc688<_0x17431c&&_['isNil'](_0x4ee210[_0x315f('0x61')]);_0x9dc688++){if(_0x38f308[_0x315f('0x63')]<=_0x4a690a[_0x9dc688][_0x315f('0x68')]){_0x4ee210['internal']=_0x4a690a[_0x9dc688][_0x315f('0x68')];}else if(_0x38f308['min_internal']>_0x4a690a[_0x9dc688]['from']&&_0x38f308['min_internal']<=_0x4a690a[_0x9dc688]['to']){_0x4ee210['internal']=_0x38f308[_0x315f('0x63')];}}}if(_[_0x315f('0x62')](_0x4ee210[_0x315f('0x61')])){_0x4ee210['internal']=_0x5b2d90+0x1;}return _0x303b33(_0x4ee210);});});})[_0x315f('0x1f')](function(_0x51a3d2){_0x7d0375(_0x51a3d2);});});}function updateUser(_0x1aea68){return new Promise(function(_0x5711de,_0x1c09c4){try{if(_0x1aea68['voicemail']){_0x1aea68['mailbox']=_0x1aea68[_0x315f('0x61')];_0x1aea68[_0x315f('0x69')]={'mailbox':_0x1aea68[_0x315f('0x61')],'password':_0x1aea68[_0x315f('0x3f')],'fullname':_0x1aea68[_0x315f('0x6a')],'email':_0x1aea68[_0x315f('0x6b')]};}if(_0x1aea68[_0x315f('0x2a')]===_0x315f('0x2b')){if(!_0x1aea68[_0x315f('0x6c')])_0x1aea68[_0x315f('0x6c')]=[_0x315f('0x6d'),_0x315f('0x6e'),_0x315f('0x6f'),_0x315f('0x70'),_0x315f('0x71'),'104',_0x315f('0x72'),_0x315f('0x73'),_0x315f('0x74'),_0x315f('0x75'),'109',_0x315f('0x76'),'111','114',_0x315f('0x77')];}_0x5711de(_0x1aea68);}catch(_0x294572){_0x1c09c4(_0x294572);}});}exports[_0x315f('0x78')]=function(_0x229849,_0x1976f5){if(_0x229849[_0x315f('0x31')][_0x315f('0x2a')]==='agent')throw new Error(_0x315f('0x79'));if(_0x229849['body'][_0x315f('0x2a')]===_0x315f('0x31')&&_0x229849['user']['role']!==_0x315f('0x2f')){throw new Error(_0x315f('0x7a'));}if(_0x229849[_0x315f('0x5c')][_0x315f('0x2a')]==='admin'&&_0x229849[_0x315f('0x31')][_0x315f('0x2a')]!==_0x315f('0x2f')){throw new Error(_0x315f('0x7b'));}return licenseUtil[_0x315f('0x7c')]([_0x229849['body']])[_0x315f('0x16')](function(){return validateUser(_0x229849[_0x315f('0x5c')]);})[_0x315f('0x16')](function(_0x192a1c){return updateUser(_0x192a1c)['then'](function(_0x247020){if(_0x247020['role']===_0x315f('0x2f')){_0x247020[_0x315f('0x7d')]=_0x229849['user'][_0x315f('0x7d')];delete _0x247020['userProfileId'];}return _0x247020;});})[_0x315f('0x16')](function(_0x581021){return db[_0x315f('0x3a')][_0x315f('0x78')](_0x581021,{'include':[{'model':db[_0x315f('0x69')],'as':_0x315f('0x69')}]});})[_0x315f('0x16')](function(_0x116b0a){if(_0x229849[_0x315f('0x5c')]['role']===_0x315f('0x31'))return _0x116b0a;if(_0x229849[_0x315f('0x31')][_0x315f('0x2a')]!=='user')return _0x116b0a;return db[_0x315f('0x7e')][_0x315f('0x37')]({'where':{'name':_0x116b0a[_0x315f('0x2a')]===_0x315f('0x2b')?_0x315f('0x32'):_0x315f('0x7f'),'userProfileId':_0x229849[_0x315f('0x31')][_0x315f('0x80')]},'raw':!![]})[_0x315f('0x16')](function(_0x3ade3d){if(!_0x3ade3d||_0x3ade3d[_0x315f('0x81')]!=0x0)return _0x116b0a;return db[_0x315f('0x82')]['create']({'name':_0x116b0a[_0x315f('0x41')],'resourceId':_0x116b0a['id'],'type':_0x3ade3d['name'],'sectionId':_0x3ade3d['id']},{})[_0x315f('0x16')](function(){return _0x116b0a;});})[_0x315f('0x1f')](function(_0x15df0e){logger[_0x315f('0x1b')](_0x315f('0x83'),_0x15df0e);throw _0x15df0e;});})[_0x315f('0x16')](respondWithResult(_0x1976f5,0xc9))[_0x315f('0x1f')](handleError(_0x1976f5,null));};exports[_0x315f('0x84')]=function(_0x453d44,_0x5b4f9f){var _0x11e99e=_0x453d44[_0x315f('0x5c')];var _0x21ed75=[];if(_0x453d44[_0x315f('0x31')][_0x315f('0x2a')]===_0x315f('0x2b'))throw new Error(_0x315f('0x79'));if(_['some'](_0x11e99e,[_0x315f('0x2a'),_0x315f('0x31')])&&_0x453d44[_0x315f('0x31')][_0x315f('0x2a')]!==_0x315f('0x2f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x315f('0x85')](_0x11e99e,['role','admin'])&&_0x453d44[_0x315f('0x31')]['role']!==_0x315f('0x2f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x315f('0x7c')](_0x11e99e)['then'](function(){return validateUser(_0x11e99e[0x0]);})['then'](function(){for(var _0x473f56=0x1;_0x473f56<_0x11e99e['length'];_0x473f56++){var _0x262687=_0x11e99e[_0x473f56-0x1][_0x315f('0x61')];if(!_0x11e99e[_0x473f56][_0x315f('0x61')])_0x11e99e[_0x473f56]['internal']=_0x262687+0x1;_0x21ed75['push'](validateUser(_0x11e99e[_0x473f56]));}return Promise['all'](_0x21ed75);})[_0x315f('0x16')](function(){_0x21ed75=[];for(var _0xb1b4a2=0x0;_0xb1b4a2<_0x11e99e['length'];_0xb1b4a2++){_0x21ed75[_0x315f('0x4a')](updateUser(_0x11e99e[_0xb1b4a2]));}return Promise['all'](_0x21ed75);})[_0x315f('0x16')](function(){_0x21ed75=_0x11e99e[_0x315f('0x3c')](function(_0x5bd17a){return db[_0x315f('0x3a')][_0x315f('0x78')](_0x5bd17a,{'include':[{'model':db[_0x315f('0x69')],'as':'VoiceMail'}]})[_0x315f('0x16')](function(_0x3b4307){_0x5bd17a['id']=_0x3b4307['id'];return _0x5bd17a;});});return Promise[_0x315f('0x52')](_0x21ed75);})[_0x315f('0x16')](function(_0x2f4bf9){if(_0x453d44[_0x315f('0x5c')][_0x315f('0x2a')]==='user')return _0x2f4bf9;if(_0x453d44['user'][_0x315f('0x2a')]!=='user')return _0x2f4bf9;var _0x21f7c8=_['some'](_0x2f4bf9,function(_0x2cfa9f){return _0x2cfa9f[_0x315f('0x2a')]==='agent'||_0x2cfa9f[_0x315f('0x2a')]===_0x315f('0x33');});if(!_0x21f7c8)return _0x2f4bf9;return db[_0x315f('0x7e')][_0x315f('0x4b')]({'where':{'name':{'$or':[_0x315f('0x32'),_0x315f('0x7f')]},'userProfileId':_0x453d44[_0x315f('0x31')][_0x315f('0x80')]},'raw':!![]})['then'](function(_0x46360d){if(_[_0x315f('0x86')](_0x46360d)||!_[_0x315f('0x85')](_0x46360d,[_0x315f('0x81'),0x0]))return _0x2f4bf9;_0x21ed75=[];var _0x1566c6=_(_0x46360d)[_0x315f('0x3c')](function(_0x157aa9){if(_0x157aa9['autoAssociation']===0x1)return;return _0x157aa9[_0x315f('0x41')]===_0x315f('0x32')?_0x315f('0x2b'):_0x315f('0x33');})[_0x315f('0x87')]()[_0x315f('0x35')]();for(var _0x372457=0x0;_0x372457<_0x2f4bf9[_0x315f('0x57')];_0x372457++){if(!_[_0x315f('0x36')](_0x1566c6,_0x2f4bf9[_0x372457][_0x315f('0x2a')]))return;var _0x1eecb9=_0x2f4bf9[_0x372457][_0x315f('0x2a')]===_0x315f('0x2b')?'Agents':_0x315f('0x7f');_0x21ed75[_0x315f('0x4a')](db[_0x315f('0x82')][_0x315f('0x78')]({'name':_0x2f4bf9[_0x372457][_0x315f('0x41')],'resourceId':_0x2f4bf9[_0x372457]['id'],'type':_0x1eecb9,'sectionId':_[_0x315f('0x37')](_0x46360d,[_0x315f('0x41'),_0x1eecb9])['id']},{}));}return Promise[_0x315f('0x52')](_0x21ed75);});})['then'](respondWithResult(_0x5b4f9f,0xc9))[_0x315f('0x1f')](handleError(_0x5b4f9f,null));};exports[_0x315f('0x88')]=function(_0x5c12a7,_0x53eb3e){if(_0x5c12a7[_0x315f('0x5c')]['id']){delete _0x5c12a7[_0x315f('0x5c')]['id'];}return db['User'][_0x315f('0x37')]({'where':{'id':_0x5c12a7[_0x315f('0x5d')]['id']}})[_0x315f('0x16')](function(_0x14df78){if(!_0x14df78)return null;if(_0x14df78['id']===_0x5c12a7['user']['id']){if(!_0x5c12a7['body'][_0x315f('0x89')]||!_0x5c12a7[_0x315f('0x5c')][_0x315f('0x8a')]){throw new db['Sequelize'][(_0x315f('0x8b'))](_0x315f('0x8c'));}if(!_0x14df78['authenticate'](_0x5c12a7[_0x315f('0x5c')][_0x315f('0x89')])){throw new db[(_0x315f('0x8d'))]['ValidationError']('Wrong\x20credentials');}if(_0x5c12a7[_0x315f('0x5c')][_0x315f('0x89')]===_0x5c12a7[_0x315f('0x5c')][_0x315f('0x8a')]){throw new db[(_0x315f('0x8d'))]['ValidationError'](_0x315f('0x8e'));}}else if(_0x5c12a7[_0x315f('0x31')][_0x315f('0x2a')]===_0x315f('0x2f')){if(!_0x5c12a7[_0x315f('0x5c')][_0x315f('0x8a')]){throw new db[(_0x315f('0x8d'))][(_0x315f('0x8b'))](_0x315f('0x8f'));}}else if(_0x5c12a7['user']['role']===_0x315f('0x31')){if(!_0x5c12a7['body'][_0x315f('0x8a')]){throw new db[(_0x315f('0x8d'))][(_0x315f('0x8b'))](_0x315f('0x8f'));}if(_0x14df78[_0x315f('0x2a')]!==_0x315f('0x2b')){throw new db[(_0x315f('0x8d'))][(_0x315f('0x8b'))](_0x315f('0x79'));}}else{throw new db['Sequelize']['ValidationError'](_0x315f('0x79'));}return _0x14df78;})[_0x315f('0x16')](handleEntityNotFound(_0x53eb3e,null))[_0x315f('0x16')](function(_0x187419){return db[_0x315f('0x90')][_0x315f('0x91')]({'attributes':['id','securePassword',_0x315f('0x92'),_0x315f('0x93')]})[_0x315f('0x16')](function(_0x297247){if(_0x297247[_0x315f('0x94')])authService[_0x315f('0x95')](_0x5c12a7[_0x315f('0x5c')][_0x315f('0x8a')]);if(!_0x297247[_0x315f('0x92')]||!_0x187419['previousPasswords'])return _0x187419;authService[_0x315f('0x96')](_0x5c12a7['body']['newPassword'],_0x187419[_0x315f('0x97')],_0x297247['passwordHistoryLimit']);return _0x187419;})[_0x315f('0x16')](saveUpdates({'password':_0x5c12a7['body']['newPassword'],'passwordResetAt':_0x5c12a7['user']['id']==_0x5c12a7['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x5c12a7[_0x315f('0x5c')][_0x315f('0x8a')],_0x187419[_0x315f('0x97')])},null));})[_0x315f('0x16')](respondWithResult(_0x53eb3e,null))[_0x315f('0x1f')](handleError(_0x53eb3e,null));};exports[_0x315f('0x98')]=function(_0x141e2d,_0x24a4f3){var _0xd87229=_0x141e2d[_0x315f('0x5c')][_0x315f('0x99')];return db[_0x315f('0x3a')]['find']({'where':{'id':_0x141e2d[_0x315f('0x5d')]['id']},'attributes':['id','name',_0x315f('0x2a'),_0x315f('0x9a'),_0x315f('0x9b'),_0x315f('0x9c'),'interface']})['then'](handleEntityNotFound(_0x24a4f3,null))[_0x315f('0x16')](function(_0x19a08f){if(_0x19a08f){if(!utils['isValidChannel'](_0xd87229)){throw new db[(_0x315f('0x8d'))][(_0x315f('0x8b'))](_0x315f('0x9d'));}return _0x19a08f[_0x315f('0x9e')+_['capitalize'](_0xd87229[_0x315f('0x9f')]())+_0x315f('0xa0')](_0x141e2d['body'][_0x315f('0xa1')],{'penalty':_0x141e2d[_0x315f('0x5c')]['penalty']||0x0})['spread'](function(_0x5d4b92){for(var _0x5bf8ff=0x0;_0x5bf8ff<_0x141e2d[_0x315f('0x5c')][_0x315f('0xa1')][_0x315f('0x57')];_0x5bf8ff+=0x1){var _0x4fe97a={'UserId':Number(_0x141e2d[_0x315f('0x5d')]['id'])};_0x4fe97a[_[_0x315f('0xa2')](_0xd87229[_0x315f('0x9f')]())+_0x315f('0xa3')]=Number(_0x141e2d[_0x315f('0x5c')][_0x315f('0xa1')][_0x5bf8ff]);socket[_0x315f('0x2c')](_0x315f('0x31')+_[_0x315f('0xa2')](_0xd87229[_0x315f('0x9f')]())+_0x315f('0xa4'),_0x4fe97a);}return _0x5d4b92;})[_0x315f('0x16')](function(){if(_0xd87229==='voice'){return db[_0x315f('0xa5')][_0x315f('0x4b')]({'where':{'id':_0x141e2d['body'][_0x315f('0xa1')]||[]},'raw':!![],'attributes':['id',_0x315f('0x41')]});}})[_0x315f('0x16')](function(_0x2303d7){var _0x7fe310=_0x19a08f[_0x315f('0xa6')]({'plain':!![]});var _0x12bd82=[];if(_0xd87229===_0x315f('0xa7')&&_0x7fe310['role']===_0x315f('0x2b')&&_0x7fe310[_0x315f('0x9a')]){for(let _0x1418a4=0x0;_0x1418a4<_0x2303d7[_0x315f('0x57')];_0x1418a4+=0x1){_0x12bd82[_0x315f('0x4a')]({'membername':_0x7fe310[_0x315f('0x41')],'UserId':_0x7fe310['id'],'queue_name':_0x2303d7[_0x1418a4][_0x315f('0x41')],'VoiceQueueId':_0x2303d7[_0x1418a4]['id'],'interface':_['isNil'](_0x7fe310['interface'])?util[_0x315f('0xa8')]('SIP/%s',_0x7fe310[_0x315f('0x41')]):_0x7fe310[_0x315f('0xa9')],'paused':_0x7fe310[_0x315f('0x9c')]||![],'penalty':_0x141e2d[_0x315f('0x5c')][_0x315f('0xaa')]||0x0});}return Promise[_0x315f('0x52')](_0x12bd82[_0x315f('0x3c')](function(_0x5ae108){return db[_0x315f('0xab')][_0x315f('0xac')](_0x5ae108);}));}return _0x19a08f;});}})[_0x315f('0x16')](respondWithStatusCode(_0x24a4f3,null))[_0x315f('0x1f')](handleError(_0x24a4f3,null));};exports['removeQueues']=function(_0x4e3d8c,_0x4c34a3){var _0xd12c2f,_0xcc40f;return db[_0x315f('0x3a')]['find']({'where':{'id':_0x4e3d8c[_0x315f('0x5d')]['id']},'attributes':['id',_0x315f('0x41'),_0x315f('0x2a')]})[_0x315f('0x16')](handleEntityNotFound(_0x4c34a3,null))[_0x315f('0x16')](function(_0x17a802){if(_0x17a802){_0xd12c2f=_0x17a802;if(!_0x4e3d8c['query'][_0x315f('0x99')]||!utils[_0x315f('0xad')](_0x4e3d8c[_0x315f('0x44')][_0x315f('0x99')])){throw new db[(_0x315f('0x8d'))]['ValidationError'](_0x315f('0x9d'));}return _0x17a802['remove'+_[_0x315f('0xa2')](_0x4e3d8c[_0x315f('0x44')]['channel'][_0x315f('0x9f')]())+_0x315f('0xa0')](_0x4e3d8c[_0x315f('0x44')][_0x315f('0xa1')]);}})[_0x315f('0x16')](function(_0x238c4a){if(_['isArray'](_0x4e3d8c[_0x315f('0x44')]['ids'])){for(var _0x504030=0x0;_0x504030<_0x4e3d8c[_0x315f('0x44')]['ids'][_0x315f('0x57')];_0x504030+=0x1){_0xcc40f={'UserId':Number(_0x4e3d8c[_0x315f('0x5d')]['id'])};_0xcc40f[_[_0x315f('0xa2')](_0x4e3d8c[_0x315f('0x44')][_0x315f('0x99')][_0x315f('0x9f')]())+_0x315f('0xa3')]=Number(_0x4e3d8c['query'][_0x315f('0xa1')][_0x504030]);socket[_0x315f('0x2c')](_0x315f('0x31')+_[_0x315f('0xa2')](_0x4e3d8c[_0x315f('0x44')][_0x315f('0x99')][_0x315f('0x9f')]())+_0x315f('0xae'),_0xcc40f);}}else{_0xcc40f={'UserId':Number(_0x4e3d8c['params']['id'])};_0xcc40f[_['capitalize'](_0x4e3d8c[_0x315f('0x44')][_0x315f('0x99')][_0x315f('0x9f')]())+_0x315f('0xa3')]=Number(_0x4e3d8c['query']['ids']);socket[_0x315f('0x2c')](_0x315f('0x31')+_[_0x315f('0xa2')](_0x4e3d8c['query'][_0x315f('0x99')]['toLowerCase']())+_0x315f('0xae'),_0xcc40f);}return _0x238c4a;})[_0x315f('0x16')](function(){if(_0x4e3d8c['query'][_0x315f('0x99')]===_0x315f('0xa7')){return db[_0x315f('0xab')][_0x315f('0x2e')]({'where':{'UserId':_0x4e3d8c[_0x315f('0x5d')]['id'],'VoiceQueueId':_0x4e3d8c['query'][_0x315f('0xa1')]},'individualHooks':!![]})[_0x315f('0x16')](function(){return _0xd12c2f;});}return _0xd12c2f;})['then'](respondWithStatusCode(_0x4c34a3,null))['catch'](handleError(_0x4c34a3,null));};exports[_0x315f('0xaf')]=function(_0x4d307a,_0x23e89a){_0x4d307a['body']['userpic']=_0x4d307a['file'][_0x315f('0xb0')];return db['User']['find']({'where':{'id':_0x4d307a['params']['id']}})[_0x315f('0x16')](handleEntityNotFound(_0x23e89a,null))['then'](saveUpdates(_0x4d307a[_0x315f('0x5c')],null))[_0x315f('0x16')](respondWithResult(_0x23e89a,null))[_0x315f('0x1f')](handleError(_0x23e89a,null));};exports[_0x315f('0xb1')]=function(_0x9adb10,_0x2c1642){var _0x208951=path[_0x315f('0xb2')](config[_0x315f('0xb3')],_0x315f('0xb4'));return db[_0x315f('0x3a')][_0x315f('0x37')]({'where':{'id':_0x9adb10[_0x315f('0x5d')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x315f('0x16')](handleEntityNotFound(_0x2c1642,null))['then'](function(_0x3e93f1){if(_0x3e93f1){if(_[_0x315f('0x62')](_0x3e93f1[_0x315f('0xb5')])){return _0x2c1642[_0x315f('0xb6')](_0x208951);}else{if(!fs[_0x315f('0xb7')](path[_0x315f('0xb2')](config['root'],_0x315f('0xb8'),_0x3e93f1[_0x315f('0xb5')]))){return _0x2c1642[_0x315f('0xb6')](_0x208951);}return _0x2c1642['download'](path[_0x315f('0xb2')](config[_0x315f('0xb3')],_0x315f('0xb8'),_0x3e93f1['userpic']));}}})[_0x315f('0x1f')](handleError(_0x2c1642,null));};exports[_0x315f('0xb9')]=function(_0x2a5e99,_0x21ad77){return db[_0x315f('0x3a')][_0x315f('0x37')]({'where':{'id':_0x2a5e99['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x21ad77,null))[_0x315f('0x16')](function(_0x1ea80b){var _0x1207ac=[];values=_0x1ea80b[_0x315f('0x4d')];_0x1207ac[_0x315f('0x4a')](get_open_tabs(_0x315f('0x5a'),_0x1ea80b[_0x315f('0x4d')]));_0x1207ac[_0x315f('0x4a')](get_open_tabs(_0x315f('0x4e'),_0x1ea80b['dataValues']));_0x1207ac[_0x315f('0x4a')](get_open_tabs(_0x315f('0x5b'),_0x1ea80b['dataValues']));_0x1207ac[_0x315f('0x4a')](get_open_tabs(_0x315f('0x51'),_0x1ea80b['dataValues']));_0x1207ac[_0x315f('0x4a')](get_open_tabs('fax',_0x1ea80b[_0x315f('0x4d')]));_0x1207ac[_0x315f('0x4a')](get_open_tabs(_0x315f('0x50'),_0x1ea80b[_0x315f('0x4d')]));return Promise[_0x315f('0x52')](_0x1207ac);})[_0x315f('0x16')](function(_0x5527c7){if(_0x5527c7){var _0x2c5633=_[_0x315f('0x3c')](values['ChatOpenTabs'],function(_0x2dade4){return{'channel':_0x315f('0xba'),'id':_0x2dade4['id'],'createdAt':_0x2dade4[_0x315f('0xbb')]};});var _0xb53bb=_[_0x315f('0x3c')](values[_0x315f('0xbc')],function(_0x3808f6){return{'channel':'FAX','id':_0x3808f6['id'],'createdAt':_0x3808f6[_0x315f('0xbb')]};});var _0x3c24f3=_[_0x315f('0x3c')](values['OpenchannelOpenTabs'],function(_0x7e6fd0){return{'channel':_0x315f('0xbd'),'id':_0x7e6fd0['id'],'createdAt':_0x7e6fd0[_0x315f('0xbb')]};});var _0x47438b=_[_0x315f('0x3c')](values[_0x315f('0xbe')],function(_0x4e89b1){return{'channel':'MAIL','id':_0x4e89b1['id'],'createdAt':_0x4e89b1['createdAt']};});var _0x17b64d=_[_0x315f('0x3c')](values['SmsOpenTabs'],function(_0x5e9e4f){return{'channel':'SMS','id':_0x5e9e4f['id'],'createdAt':_0x5e9e4f[_0x315f('0xbb')]};});var _0x4fdab6=_[_0x315f('0x3c')](values[_0x315f('0xbf')],function(_0x2cc789){return{'channel':_0x315f('0xc0'),'id':_0x2cc789['id'],'createdAt':_0x2cc789['createdAt']};});var _0x3a05f5=_[_0x315f('0xc1')](_0x2c5633,_0xb53bb,_0x3c24f3,_0x47438b,_0x17b64d,_0x4fdab6);var _0x189b35={'count':_0x3a05f5[_0x315f('0x57')],'rows':_0x3a05f5};return _0x189b35;}else return null;})['then'](respondWithResult(_0x21ad77,null))[_0x315f('0x1f')](handleError(_0x21ad77,null));};exports[_0x315f('0xc2')]=function(_0x32ecdc,_0x3d36ee){var _0x489e60={};var _0x2d4d8a={};var _0x4f4316;var _0x32ea52;return db[_0x315f('0x3a')]['findOne']({'where':{'id':_0x32ecdc[_0x315f('0x5d')]['id']}})[_0x315f('0x16')](handleEntityNotFound(_0x3d36ee,null))[_0x315f('0x16')](function(_0x34df76){if(_0x34df76){_0x4f4316=_0x34df76;_0x2d4d8a[_0x315f('0x53')]=_['keys'](db['CmContact'][_0x315f('0x3b')]);_0x2d4d8a[_0x315f('0x44')]=_['keys'](_0x32ecdc[_0x315f('0x44')]);_0x2d4d8a['filters']=_['intersection'](_0x2d4d8a[_0x315f('0x53')],_0x2d4d8a[_0x315f('0x44')]);_0x489e60['attributes']=_[_0x315f('0x55')](_0x2d4d8a[_0x315f('0x53')],qs['fields'](_0x32ecdc[_0x315f('0x44')][_0x315f('0x56')]));_0x489e60[_0x315f('0x49')]=_0x489e60[_0x315f('0x49')][_0x315f('0x57')]?_0x489e60[_0x315f('0x49')]:_0x2d4d8a[_0x315f('0x53')];_0x489e60[_0x315f('0xc3')]=qs[_0x315f('0xc4')](_0x32ecdc[_0x315f('0x44')][_0x315f('0xc4')]);_0x489e60[_0x315f('0x43')]=qs[_0x315f('0x54')](_[_0x315f('0xc5')](_0x32ecdc[_0x315f('0x44')],_0x2d4d8a[_0x315f('0x54')]));if(_0x32ecdc[_0x315f('0x44')][_0x315f('0x3e')]){_0x489e60[_0x315f('0x43')]=_[_0x315f('0xc6')](_0x489e60[_0x315f('0x43')],{'$or':_[_0x315f('0x3c')](_0x489e60[_0x315f('0x49')],function(_0x3fea63){var _0x120fa7={};_0x120fa7[_0x3fea63]={'$like':'%'+_0x32ecdc[_0x315f('0x44')][_0x315f('0x3e')]+'%'};return _0x120fa7;})});}_0x489e60=_[_0x315f('0xc6')]({},_0x489e60,_0x32ecdc[_0x315f('0xc7')]);return _0x4f4316[_0x315f('0xc2')](_0x489e60);}})[_0x315f('0x16')](function(_0x4ca8bb){if(_0x4ca8bb){_0x32ea52=_0x4ca8bb['length'];if(_0x32ecdc[_0x315f('0x44')][_0x315f('0xc8')](_0x315f('0x58'))){_0x489e60[_0x315f('0x46')]=[{'model':db['CmList'],'as':_0x315f('0xc9'),'required':![]},{'model':db[_0x315f('0xca')],'as':_0x315f('0xcb'),'attributes':['id',_0x315f('0x41'),_0x315f('0xcc')],'where':_0x32ecdc[_0x315f('0x44')][_0x315f('0xcd')]?{'id':_0x32ecdc[_0x315f('0x44')][_0x315f('0xcd')]}:undefined,'required':_0x32ecdc[_0x315f('0x44')][_0x315f('0xcd')]?!![]:![]}];}if(!_0x32ecdc['query'][_0x315f('0xc8')](_0x315f('0xce'))){_0x489e60['limit']=qs[_0x315f('0x25')](_0x32ecdc['query'][_0x315f('0x25')]);_0x489e60[_0x315f('0x23')]=qs[_0x315f('0x23')](_0x32ecdc[_0x315f('0x44')]['offset']);}return _0x4f4316['getContacts'](_0x489e60);}})['then'](function(_0xdd2776){if(_0xdd2776){return _0xdd2776?{'count':_0x32ea52,'rows':_0xdd2776}:null;}})['then'](respondWithResult(_0x3d36ee,null))['catch'](handleError(_0x3d36ee,null));};exports['getQueues']=function(_0x4796ea,_0x3809f5){var _0x57cf1a;var _0x2598ba={};var _0x2948e2;return db[_0x315f('0x3a')][_0x315f('0x91')]({'where':{'id':_0x4796ea[_0x315f('0x5d')]['id']},'attributes':['id',_0x315f('0x41'),'role']})['then'](handleEntityNotFound(_0x3809f5,null))[_0x315f('0x16')](function(_0x32d084){if(!utils[_0x315f('0xad')](_0x4796ea[_0x315f('0x44')][_0x315f('0x99')])){throw new db[(_0x315f('0x8d'))][(_0x315f('0x8b'))]('Unknown\x20channel');}_0x57cf1a=_0x32d084;var _0x15cea6={};_0x15cea6['model']=_[_0x315f('0xcf')](db[_[_0x315f('0xa2')](_0x4796ea[_0x315f('0x44')]['channel'])+_0x315f('0xd0')][_0x315f('0x3b')]);_0x15cea6['query']=_['keys'](_0x4796ea['query']);_0x15cea6['filters']=_['intersection'](_0x15cea6[_0x315f('0x53')],_0x15cea6[_0x315f('0x44')]);_0x2598ba[_0x315f('0x49')]=_[_0x315f('0x55')](_0x15cea6[_0x315f('0x53')],qs['fields'](_0x4796ea[_0x315f('0x44')][_0x315f('0x56')]));_0x2598ba[_0x315f('0x49')]=_0x2598ba['attributes'][_0x315f('0x57')]?_0x2598ba[_0x315f('0x49')]:_0x15cea6[_0x315f('0x53')];_0x2598ba[_0x315f('0xc3')]=qs[_0x315f('0xc4')](_0x4796ea[_0x315f('0x44')][_0x315f('0xc4')]);_0x2598ba['where']=qs['filters'](_['pick'](_0x4796ea[_0x315f('0x44')],_0x15cea6[_0x315f('0x54')]));if(_0x4796ea[_0x315f('0x44')]['filter']){_0x2598ba[_0x315f('0x43')]=_[_0x315f('0xc6')](_0x2598ba[_0x315f('0x43')],{'$or':_[_0x315f('0x3c')](_0x2598ba[_0x315f('0x49')],function(_0x59d0cc){var _0x12fc35={};_0x12fc35[_0x59d0cc]={'$like':'%'+_0x4796ea[_0x315f('0x44')]['filter']+'%'};return _0x12fc35;})});}_0x2598ba=_[_0x315f('0xc6')]({},_0x2598ba,_0x4796ea['options']);switch(_0x57cf1a['role']){case _0x315f('0x2f'):return db[_[_0x315f('0xa2')](_0x4796ea[_0x315f('0x44')]['channel'])+'Queue'][_0x315f('0x4b')](_0x2598ba);case _0x315f('0x31'):case'agent':return _0x57cf1a[_0x315f('0xa6')+_[_0x315f('0xa2')](_0x4796ea[_0x315f('0x44')][_0x315f('0x99')])+'Queues'](_0x2598ba);default:throw new db['Sequelize'][(_0x315f('0x8b'))]('Unknown\x20role');}})['then'](function(_0x51443a){_0x2948e2=_0x51443a['length'];if(!_0x4796ea['query'][_0x315f('0xc8')](_0x315f('0xce'))){_0x2598ba['limit']=qs['limit'](_0x4796ea['query']['limit']);_0x2598ba[_0x315f('0x23')]=qs['offset'](_0x4796ea['query'][_0x315f('0x23')]);}switch(_0x57cf1a[_0x315f('0x2a')]){case'admin':return db[_[_0x315f('0xa2')](_0x4796ea['query'][_0x315f('0x99')])+_0x315f('0xd0')][_0x315f('0x4b')](_0x2598ba);case'user':case _0x315f('0x2b'):return _0x57cf1a['get'+_[_0x315f('0xa2')](_0x4796ea['query'][_0x315f('0x99')])+_0x315f('0xa0')](_0x2598ba);}})[_0x315f('0x16')](function(_0x5b3f68){return{'count':_0x2948e2,'rows':_0x5b3f68};})[_0x315f('0x16')](respondWithResult(_0x3809f5,null))[_0x315f('0x1f')](handleError(_0x3809f5,null));};exports['getVoiceQueuesRt']=function(_0x127f86,_0x1f302f){var _0x8921e4={};var _0xc85a94={};var _0x51427b;var _0x11c5b3;return db[_0x315f('0x3a')]['findOne']({'where':{'id':_0x127f86[_0x315f('0x5d')]['id']}})[_0x315f('0x16')](handleEntityNotFound(_0x1f302f,null))[_0x315f('0x16')](function(_0x3b82f4){if(_0x3b82f4){_0x51427b=_0x3b82f4;_0xc85a94[_0x315f('0x53')]=_[_0x315f('0xcf')](db[_0x315f('0xab')][_0x315f('0x3b')]);_0xc85a94[_0x315f('0x44')]=_['keys'](_0x127f86['query']);_0xc85a94['filters']=_['intersection'](_0xc85a94[_0x315f('0x53')],_0xc85a94[_0x315f('0x44')]);_0x8921e4[_0x315f('0x49')]=_[_0x315f('0x55')](_0xc85a94['model'],qs[_0x315f('0x56')](_0x127f86['query'][_0x315f('0x56')]));_0x8921e4[_0x315f('0x49')]=_0x8921e4[_0x315f('0x49')][_0x315f('0x57')]?_0x8921e4[_0x315f('0x49')]:_0xc85a94[_0x315f('0x53')];_0x8921e4[_0x315f('0xc3')]=qs[_0x315f('0xc4')](_0x127f86[_0x315f('0x44')][_0x315f('0xc4')]);_0x8921e4['where']=qs[_0x315f('0x54')](_['pick'](_0x127f86['query'],_0xc85a94[_0x315f('0x54')]));if(_0x127f86[_0x315f('0x44')]['filter']){_0x8921e4[_0x315f('0x43')]=_['merge'](_0x8921e4[_0x315f('0x43')],{'$or':_[_0x315f('0x3c')](_0x8921e4[_0x315f('0x49')],function(_0x5d41a8){var _0x354cb7={};_0x354cb7[_0x5d41a8]={'$like':'%'+_0x127f86[_0x315f('0x44')][_0x315f('0x3e')]+'%'};return _0x354cb7;})});}_0x8921e4=_[_0x315f('0xc6')]({},_0x8921e4,_0x127f86[_0x315f('0xc7')]);return _0x51427b[_0x315f('0xd1')](_0x8921e4);}})[_0x315f('0x16')](function(_0x311c46){if(_0x311c46){_0x11c5b3=_0x311c46[_0x315f('0x57')];if(!_0x127f86[_0x315f('0x44')]['hasOwnProperty'](_0x315f('0xce'))){_0x8921e4[_0x315f('0x25')]=qs['limit'](_0x127f86[_0x315f('0x44')]['limit']);_0x8921e4[_0x315f('0x23')]=qs['offset'](_0x127f86[_0x315f('0x44')][_0x315f('0x23')]);}return _0x51427b[_0x315f('0xd1')](_0x8921e4);}})[_0x315f('0x16')](function(_0x2080c6){if(_0x2080c6){return _0x2080c6?{'count':_0x11c5b3,'rows':_0x2080c6}:null;}})[_0x315f('0x16')](respondWithResult(_0x1f302f,null))[_0x315f('0x1f')](handleError(_0x1f302f,null));};exports[_0x315f('0xd2')]=function(_0x35592e,_0x4c3258){var _0x4b1463={};var _0x2105e6={};var _0x347626;var _0x45d35c;return db[_0x315f('0x3a')]['findOne']({'where':{'id':_0x35592e[_0x315f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4c3258,null))[_0x315f('0x16')](function(_0x1574e2){if(_0x1574e2){_0x347626=_0x1574e2;_0x2105e6[_0x315f('0x53')]=_[_0x315f('0xcf')](db['ChatGroup'][_0x315f('0x3b')]);_0x2105e6[_0x315f('0x44')]=_['keys'](_0x35592e[_0x315f('0x44')]);_0x2105e6[_0x315f('0x54')]=_['intersection'](_0x2105e6[_0x315f('0x53')],_0x2105e6[_0x315f('0x44')]);_0x4b1463[_0x315f('0x49')]=_[_0x315f('0x55')](_0x2105e6[_0x315f('0x53')],qs[_0x315f('0x56')](_0x35592e[_0x315f('0x44')][_0x315f('0x56')]));_0x4b1463['attributes']=_0x4b1463[_0x315f('0x49')][_0x315f('0x57')]?_0x4b1463['attributes']:_0x2105e6['model'];_0x4b1463[_0x315f('0xc3')]=qs[_0x315f('0xc4')](_0x35592e[_0x315f('0x44')]['sort']);_0x4b1463['where']=qs[_0x315f('0x54')](_[_0x315f('0xc5')](_0x35592e['query'],_0x2105e6['filters']));if(_0x35592e['query'][_0x315f('0x3e')]){_0x4b1463[_0x315f('0x43')]=_['merge'](_0x4b1463[_0x315f('0x43')],{'$or':_[_0x315f('0x3c')](_0x4b1463[_0x315f('0x49')],function(_0x13b7ce){var _0x46d4ec={};_0x46d4ec[_0x13b7ce]={'$like':'%'+_0x35592e[_0x315f('0x44')][_0x315f('0x3e')]+'%'};return _0x46d4ec;})});}_0x4b1463=_[_0x315f('0xc6')]({},_0x4b1463,_0x35592e['options']);return _0x347626[_0x315f('0xd2')](_0x4b1463);}})[_0x315f('0x16')](function(_0x3350b4){if(_0x3350b4){_0x45d35c=_0x3350b4[_0x315f('0x57')];if(!_0x35592e[_0x315f('0x44')][_0x315f('0xc8')](_0x315f('0xce'))){_0x4b1463['limit']=qs['limit'](_0x35592e[_0x315f('0x44')][_0x315f('0x25')]);_0x4b1463[_0x315f('0x23')]=qs['offset'](_0x35592e[_0x315f('0x44')][_0x315f('0x23')]);}return _0x347626[_0x315f('0xd2')](_0x4b1463);}})['then'](function(_0x58c5e2){if(_0x58c5e2){return _0x58c5e2?{'count':_0x45d35c,'rows':_0x58c5e2}:null;}})[_0x315f('0x16')](respondWithResult(_0x4c3258,null))[_0x315f('0x1f')](handleError(_0x4c3258,null));};exports[_0x315f('0xd3')]=function(_0x146761,_0x41598c){var _0x57ecbb={'raw':!![],'where':{}};var _0x33ade1={};var _0x212d54={'count':0x0,'rows':[]};return db[_0x315f('0x3a')][_0x315f('0x91')]({'where':{'id':_0x146761[_0x315f('0x5d')]['id']}})[_0x315f('0x16')](handleEntityNotFound(_0x41598c,null))['then'](function(_0x452759){if(_0x452759){_0x33ade1['model']=_['keys'](db[_0x315f('0xd4')][_0x315f('0x3b')]);_0x33ade1[_0x315f('0x44')]=_[_0x315f('0xcf')](_0x146761['query']);_0x33ade1[_0x315f('0x54')]=_['intersection'](_0x33ade1[_0x315f('0x53')],_0x33ade1[_0x315f('0x44')]);_0x57ecbb[_0x315f('0x49')]=_[_0x315f('0x55')](_0x33ade1[_0x315f('0x53')],qs[_0x315f('0x56')](_0x146761['query'][_0x315f('0x56')]));_0x57ecbb[_0x315f('0x49')]=_0x57ecbb['attributes'][_0x315f('0x57')]?_0x57ecbb['attributes']:_0x33ade1[_0x315f('0x53')];if(!_0x146761[_0x315f('0x44')][_0x315f('0xc8')](_0x315f('0xce'))){_0x57ecbb['limit']=qs['limit'](_0x146761[_0x315f('0x44')][_0x315f('0x25')]);_0x57ecbb['offset']=qs[_0x315f('0x23')](_0x146761[_0x315f('0x44')]['offset']);}_0x57ecbb[_0x315f('0xc3')]=qs['sort'](_0x146761[_0x315f('0x44')][_0x315f('0xc4')]);_0x57ecbb['where']=qs[_0x315f('0x54')](_[_0x315f('0xc5')](_0x146761[_0x315f('0x44')],_0x33ade1[_0x315f('0x54')]));_0x57ecbb['where'][_0x315f('0xd5')]=_0x452759['id'];if(_0x146761[_0x315f('0x44')]['filter']){_0x57ecbb[_0x315f('0x43')]=_[_0x315f('0xc6')](_0x57ecbb['where'],{'$or':_[_0x315f('0x3c')](_0x57ecbb['attributes'],function(_0x37fd6f){var _0xfbbdcc={};_0xfbbdcc[_0x37fd6f]={'$like':'%'+_0x146761[_0x315f('0x44')][_0x315f('0x3e')]+'%'};return _0xfbbdcc;})});}_0x57ecbb=_[_0x315f('0xc6')]({},_0x57ecbb,_0x146761[_0x315f('0xc7')]);return db[_0x315f('0xd4')][_0x315f('0x26')]({'where':_0x57ecbb[_0x315f('0x43')]})[_0x315f('0x16')](function(_0x4e322c){_0x212d54[_0x315f('0x26')]=_0x4e322c;if(_0x146761['query'][_0x315f('0x58')]){_0x57ecbb[_0x315f('0x46')]=[{'all':!![]}];}return db[_0x315f('0xd4')]['findAll'](_0x57ecbb);})[_0x315f('0x16')](function(_0x350452){_0x212d54['rows']=_0x350452;return _0x212d54;});}})['then'](respondWithFilteredResult(_0x41598c,_0x57ecbb))[_0x315f('0x1f')](handleError(_0x41598c,null));};exports['getScreenRecordings']=function(_0x10b7f4,_0x376dac){var _0x220150={'raw':!![],'where':{}};var _0x45e7ec={};var _0x711a62={'count':0x0,'rows':[]};return db[_0x315f('0x3a')]['findOne']({'where':{'id':_0x10b7f4[_0x315f('0x5d')]['id']}})[_0x315f('0x16')](handleEntityNotFound(_0x376dac,null))[_0x315f('0x16')](function(_0x30a864){if(_0x30a864){_0x45e7ec[_0x315f('0x53')]=_['keys'](db['ScreenRecording'][_0x315f('0x3b')]);_0x45e7ec[_0x315f('0x44')]=_[_0x315f('0xcf')](_0x10b7f4[_0x315f('0x44')]);_0x45e7ec['filters']=_['intersection'](_0x45e7ec[_0x315f('0x53')],_0x45e7ec['query']);_0x220150[_0x315f('0x49')]=_[_0x315f('0x55')](_0x45e7ec['model'],qs[_0x315f('0x56')](_0x10b7f4['query'][_0x315f('0x56')]));_0x220150[_0x315f('0x49')]=_0x220150[_0x315f('0x49')]['length']?_0x220150[_0x315f('0x49')]:_0x45e7ec['model'];if(!_0x10b7f4[_0x315f('0x44')][_0x315f('0xc8')](_0x315f('0xce'))){_0x220150[_0x315f('0x25')]=qs[_0x315f('0x25')](_0x10b7f4[_0x315f('0x44')][_0x315f('0x25')]);_0x220150[_0x315f('0x23')]=qs['offset'](_0x10b7f4['query'][_0x315f('0x23')]);}_0x220150['order']=qs[_0x315f('0xc4')](_0x10b7f4[_0x315f('0x44')][_0x315f('0xc4')]);_0x220150[_0x315f('0x43')]=qs['filters'](_['pick'](_0x10b7f4[_0x315f('0x44')],_0x45e7ec[_0x315f('0x54')]));_0x220150[_0x315f('0x43')][_0x315f('0xd5')]=_0x30a864['id'];if(_0x10b7f4[_0x315f('0x44')][_0x315f('0x3e')]){_0x220150[_0x315f('0x43')]=_[_0x315f('0xc6')](_0x220150[_0x315f('0x43')],{'$or':_[_0x315f('0x3c')](_0x220150[_0x315f('0x49')],function(_0x54e62b){var _0x4cb3ff={};_0x4cb3ff[_0x54e62b]={'$like':'%'+_0x10b7f4['query'][_0x315f('0x3e')]+'%'};return _0x4cb3ff;})});}_0x220150=_[_0x315f('0xc6')]({},_0x220150,_0x10b7f4[_0x315f('0xc7')]);return db[_0x315f('0xd6')]['count']({'where':_0x220150['where']})['then'](function(_0x56faff){_0x711a62[_0x315f('0x26')]=_0x56faff;if(_0x10b7f4[_0x315f('0x44')][_0x315f('0x58')]){_0x220150[_0x315f('0x46')]=[{'all':!![]}];}return db[_0x315f('0xd6')]['findAll'](_0x220150);})[_0x315f('0x16')](function(_0x2157ce){_0x711a62[_0x315f('0x4c')]=_0x2157ce;return _0x711a62;});}})[_0x315f('0x16')](respondWithFilteredResult(_0x376dac,_0x220150))['catch'](handleError(_0x376dac,null));};exports[_0x315f('0xd7')]=function(_0xd8123b,_0x41e23b){var _0x35142f={};var _0x54fe1c={};var _0x262b5b;var _0x5bd624;return db[_0x315f('0x3a')][_0x315f('0x91')]({'where':{'id':_0xd8123b[_0x315f('0x5d')]['id']}})[_0x315f('0x16')](handleEntityNotFound(_0x41e23b,null))['then'](function(_0x5c7f2c){if(_0x5c7f2c){_0x262b5b=_0x5c7f2c;_0x54fe1c[_0x315f('0x53')]=_[_0x315f('0xcf')](db[_0x315f('0xd8')][_0x315f('0x3b')]);_0x54fe1c[_0x315f('0x44')]=_[_0x315f('0xcf')](_0xd8123b[_0x315f('0x44')]);_0x54fe1c[_0x315f('0x54')]=_[_0x315f('0x55')](_0x54fe1c[_0x315f('0x53')],_0x54fe1c[_0x315f('0x44')]);_0x35142f['attributes']=_['intersection'](_0x54fe1c[_0x315f('0x53')],qs[_0x315f('0x56')](_0xd8123b['query']['fields']));_0x35142f[_0x315f('0x49')]=_0x35142f[_0x315f('0x49')][_0x315f('0x57')]?_0x35142f['attributes']:_0x54fe1c['model'];_0x35142f[_0x315f('0xc3')]=qs[_0x315f('0xc4')](_0xd8123b[_0x315f('0x44')][_0x315f('0xc4')]);_0x35142f[_0x315f('0x43')]=qs['filters'](_['pick'](_0xd8123b[_0x315f('0x44')],_0x54fe1c[_0x315f('0x54')]));if(_0xd8123b[_0x315f('0x44')][_0x315f('0x3e')]){_0x35142f[_0x315f('0x43')]=_[_0x315f('0xc6')](_0x35142f[_0x315f('0x43')],{'$or':_[_0x315f('0x3c')](_0x35142f['attributes'],function(_0x3272f2){var _0x3f03aa={};_0x3f03aa[_0x3272f2]={'$like':'%'+_0xd8123b[_0x315f('0x44')][_0x315f('0x3e')]+'%'};return _0x3f03aa;})});}_0x35142f=_[_0x315f('0xc6')]({},_0x35142f,_0xd8123b[_0x315f('0xc7')]);return _0x262b5b[_0x315f('0xd7')](_0x35142f);}})[_0x315f('0x16')](function(_0x56fb39){if(_0x56fb39){_0x5bd624=_0x56fb39[_0x315f('0x57')];if(!_0xd8123b[_0x315f('0x44')][_0x315f('0xc8')](_0x315f('0xce'))){_0x35142f[_0x315f('0x25')]=qs['limit'](_0xd8123b['query'][_0x315f('0x25')]);_0x35142f[_0x315f('0x23')]=qs[_0x315f('0x23')](_0xd8123b['query'][_0x315f('0x23')]);}return _0x262b5b[_0x315f('0xd7')](_0x35142f);}})['then'](function(_0x30307c){if(_0x30307c){return _0x30307c?{'count':_0x5bd624,'rows':_0x30307c}:null;}})['then'](respondWithResult(_0x41e23b,null))[_0x315f('0x1f')](handleError(_0x41e23b,null));};exports[_0x315f('0xd9')]=function(_0x25f8ac,_0x604559){var _0x26bf79={};var _0x1fe0fb={};var _0x18a9fe;var _0x5eb0ac;return db[_0x315f('0x3a')][_0x315f('0x91')]({'where':{'id':_0x25f8ac[_0x315f('0x5d')]['id']}})[_0x315f('0x16')](handleEntityNotFound(_0x604559,null))['then'](function(_0x2316e3){if(_0x2316e3){_0x18a9fe=_0x2316e3;_0x1fe0fb['model']=_[_0x315f('0xcf')](db[_0x315f('0xda')][_0x315f('0x3b')]);_0x1fe0fb['query']=_[_0x315f('0xcf')](_0x25f8ac[_0x315f('0x44')]);_0x1fe0fb[_0x315f('0x54')]=_[_0x315f('0x55')](_0x1fe0fb[_0x315f('0x53')],_0x1fe0fb[_0x315f('0x44')]);_0x26bf79['attributes']=_['intersection'](_0x1fe0fb[_0x315f('0x53')],qs[_0x315f('0x56')](_0x25f8ac[_0x315f('0x44')][_0x315f('0x56')]));_0x26bf79[_0x315f('0x49')]=_0x26bf79[_0x315f('0x49')][_0x315f('0x57')]?_0x26bf79[_0x315f('0x49')]:_0x1fe0fb[_0x315f('0x53')];_0x26bf79[_0x315f('0xc3')]=qs[_0x315f('0xc4')](_0x25f8ac[_0x315f('0x44')][_0x315f('0xc4')]);_0x26bf79[_0x315f('0x43')]=qs['filters'](_['pick'](_0x25f8ac['query'],_0x1fe0fb[_0x315f('0x54')]));if(_0x25f8ac[_0x315f('0x44')][_0x315f('0x3e')]){_0x26bf79[_0x315f('0x43')]=_[_0x315f('0xc6')](_0x26bf79[_0x315f('0x43')],{'$or':_[_0x315f('0x3c')](_0x26bf79[_0x315f('0x49')],function(_0x292a5f){var _0x24125d={};_0x24125d[_0x292a5f]={'$like':'%'+_0x25f8ac[_0x315f('0x44')]['filter']+'%'};return _0x24125d;})});}_0x26bf79=_[_0x315f('0xc6')]({},_0x26bf79,_0x25f8ac[_0x315f('0xc7')]);return _0x18a9fe['getOpenchannelInteractions'](_0x26bf79);}})[_0x315f('0x16')](function(_0x2ab284){if(_0x2ab284){_0x5eb0ac=_0x2ab284[_0x315f('0x57')];if(!_0x25f8ac['query'][_0x315f('0xc8')](_0x315f('0xce'))){_0x26bf79[_0x315f('0x25')]=qs[_0x315f('0x25')](_0x25f8ac[_0x315f('0x44')][_0x315f('0x25')]);_0x26bf79[_0x315f('0x23')]=qs[_0x315f('0x23')](_0x25f8ac[_0x315f('0x44')][_0x315f('0x23')]);}return _0x18a9fe[_0x315f('0xd9')](_0x26bf79);}})['then'](function(_0xc5e59f){if(_0xc5e59f){return _0xc5e59f?{'count':_0x5eb0ac,'rows':_0xc5e59f}:null;}})['then'](respondWithResult(_0x604559,null))[_0x315f('0x1f')](handleError(_0x604559,null));};exports['getMailInteractions']=function(_0x32d642,_0x26326a){var _0x2a6bf6={'raw':!![],'where':{}};var _0x1886e0={};var _0x3913a6={'count':0x0,'rows':[]};return db[_0x315f('0x3a')][_0x315f('0x91')]({'where':{'id':_0x32d642[_0x315f('0x5d')]['id']}})[_0x315f('0x16')](handleEntityNotFound(_0x26326a,null))[_0x315f('0x16')](function(_0x3a7c74){if(_0x3a7c74){_0x1886e0[_0x315f('0x53')]=_[_0x315f('0xcf')](db[_0x315f('0xdb')]['rawAttributes']);_0x1886e0[_0x315f('0x44')]=_['keys'](_0x32d642['query']);_0x1886e0[_0x315f('0x54')]=_[_0x315f('0x55')](_0x1886e0['model'],_0x1886e0[_0x315f('0x44')]);_0x2a6bf6[_0x315f('0x49')]=_[_0x315f('0x55')](_0x1886e0[_0x315f('0x53')],qs[_0x315f('0x56')](_0x32d642[_0x315f('0x44')][_0x315f('0x56')]));_0x2a6bf6[_0x315f('0x49')]=_0x2a6bf6[_0x315f('0x49')][_0x315f('0x57')]?_0x2a6bf6[_0x315f('0x49')]:_0x1886e0['model'];if(!_0x32d642[_0x315f('0x44')]['hasOwnProperty'](_0x315f('0xce'))){_0x2a6bf6[_0x315f('0x25')]=qs[_0x315f('0x25')](_0x32d642[_0x315f('0x44')][_0x315f('0x25')]);_0x2a6bf6[_0x315f('0x23')]=qs[_0x315f('0x23')](_0x32d642[_0x315f('0x44')][_0x315f('0x23')]);}_0x2a6bf6[_0x315f('0xc3')]=qs[_0x315f('0xc4')](_0x32d642[_0x315f('0x44')]['sort']);_0x2a6bf6[_0x315f('0x43')]=qs[_0x315f('0x54')](_[_0x315f('0xc5')](_0x32d642[_0x315f('0x44')],_0x1886e0[_0x315f('0x54')]));_0x2a6bf6[_0x315f('0x43')][_0x315f('0xd5')]=_0x3a7c74['id'];if(_0x32d642[_0x315f('0x44')][_0x315f('0x3e')]){_0x2a6bf6[_0x315f('0x43')]=_[_0x315f('0xc6')](_0x2a6bf6[_0x315f('0x43')],{'$or':_[_0x315f('0x3c')](_0x2a6bf6[_0x315f('0x49')],function(_0xa6d455){var _0x1dd579={};_0x1dd579[_0xa6d455]={'$like':'%'+_0x32d642['query'][_0x315f('0x3e')]+'%'};return _0x1dd579;})});}_0x2a6bf6=_[_0x315f('0xc6')]({},_0x2a6bf6,_0x32d642[_0x315f('0xc7')]);return db[_0x315f('0xdb')][_0x315f('0x26')]({'where':_0x2a6bf6[_0x315f('0x43')]})['then'](function(_0x5b84a6){_0x3913a6[_0x315f('0x26')]=_0x5b84a6;if(_0x32d642[_0x315f('0x44')][_0x315f('0x58')]){_0x2a6bf6[_0x315f('0x46')]=[{'all':!![]}];}return db[_0x315f('0xdb')][_0x315f('0x4b')](_0x2a6bf6);})['then'](function(_0x386ee7){_0x3913a6['rows']=_0x386ee7;return _0x3913a6;});}})[_0x315f('0x16')](respondWithFilteredResult(_0x26326a,_0x2a6bf6))[_0x315f('0x1f')](handleError(_0x26326a,null));};exports[_0x315f('0xdc')]=function(_0x51d5c3,_0x1ae355){var _0x11eddd={};var _0x2380aa={};var _0xf2863a;var _0x37ee82;return db['User'][_0x315f('0x91')]({'where':{'id':_0x51d5c3[_0x315f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1ae355,null))[_0x315f('0x16')](function(_0x80b236){if(_0x80b236){_0xf2863a=_0x80b236;_0x2380aa[_0x315f('0x53')]=_['keys'](db[_0x315f('0xdd')][_0x315f('0x3b')]);_0x2380aa['query']=_[_0x315f('0xcf')](_0x51d5c3['query']);_0x2380aa[_0x315f('0x54')]=_[_0x315f('0x55')](_0x2380aa[_0x315f('0x53')],_0x2380aa[_0x315f('0x44')]);_0x11eddd[_0x315f('0x49')]=_['intersection'](_0x2380aa[_0x315f('0x53')],qs['fields'](_0x51d5c3[_0x315f('0x44')][_0x315f('0x56')]));_0x11eddd[_0x315f('0x49')]=_0x11eddd[_0x315f('0x49')]['length']?_0x11eddd[_0x315f('0x49')]:_0x2380aa[_0x315f('0x53')];_0x11eddd[_0x315f('0xc3')]=qs[_0x315f('0xc4')](_0x51d5c3['query'][_0x315f('0xc4')]);_0x11eddd['where']=qs[_0x315f('0x54')](_[_0x315f('0xc5')](_0x51d5c3[_0x315f('0x44')],_0x2380aa[_0x315f('0x54')]));if(_0x51d5c3[_0x315f('0x44')]['filter']){_0x11eddd['where']=_[_0x315f('0xc6')](_0x11eddd[_0x315f('0x43')],{'$or':_[_0x315f('0x3c')](_0x11eddd['attributes'],function(_0x17da54){var _0x2414c3={};_0x2414c3[_0x17da54]={'$like':'%'+_0x51d5c3[_0x315f('0x44')][_0x315f('0x3e')]+'%'};return _0x2414c3;})});}_0x11eddd=_[_0x315f('0xc6')]({},_0x11eddd,_0x51d5c3['options']);return _0xf2863a['getSmsInteractions'](_0x11eddd);}})[_0x315f('0x16')](function(_0x19509c){if(_0x19509c){_0x37ee82=_0x19509c[_0x315f('0x57')];if(!_0x51d5c3[_0x315f('0x44')][_0x315f('0xc8')](_0x315f('0xce'))){_0x11eddd[_0x315f('0x25')]=qs['limit'](_0x51d5c3[_0x315f('0x44')][_0x315f('0x25')]);_0x11eddd[_0x315f('0x23')]=qs[_0x315f('0x23')](_0x51d5c3['query'][_0x315f('0x23')]);}return _0xf2863a[_0x315f('0xdc')](_0x11eddd);}})['then'](function(_0x1792ce){if(_0x1792ce){return _0x1792ce?{'count':_0x37ee82,'rows':_0x1792ce}:null;}})[_0x315f('0x16')](respondWithResult(_0x1ae355,null))['catch'](handleError(_0x1ae355,null));};exports[_0x315f('0xde')]=function(_0x1561a,_0x497018){var _0x16060d={};var _0x2853b4={};var _0x1c8671;var _0x23ae6f;return db['User'][_0x315f('0x91')]({'where':{'id':_0x1561a[_0x315f('0x5d')]['id']}})[_0x315f('0x16')](handleEntityNotFound(_0x497018,null))[_0x315f('0x16')](function(_0x1db7b9){if(_0x1db7b9){_0x1c8671=_0x1db7b9;_0x2853b4['model']=_[_0x315f('0xcf')](db[_0x315f('0xdf')][_0x315f('0x3b')]);_0x2853b4[_0x315f('0x44')]=_[_0x315f('0xcf')](_0x1561a[_0x315f('0x44')]);_0x2853b4[_0x315f('0x54')]=_['intersection'](_0x2853b4[_0x315f('0x53')],_0x2853b4[_0x315f('0x44')]);_0x16060d[_0x315f('0x49')]=_[_0x315f('0x55')](_0x2853b4[_0x315f('0x53')],qs[_0x315f('0x56')](_0x1561a[_0x315f('0x44')][_0x315f('0x56')]));_0x16060d['attributes']=_0x16060d[_0x315f('0x49')]['length']?_0x16060d[_0x315f('0x49')]:_0x2853b4['model'];_0x16060d[_0x315f('0xc3')]=qs['sort'](_0x1561a[_0x315f('0x44')][_0x315f('0xc4')]);_0x16060d[_0x315f('0x43')]=qs[_0x315f('0x54')](_[_0x315f('0xc5')](_0x1561a[_0x315f('0x44')],_0x2853b4[_0x315f('0x54')]));if(_0x1561a[_0x315f('0x44')][_0x315f('0x3e')]){_0x16060d['where']=_['merge'](_0x16060d[_0x315f('0x43')],{'$or':_[_0x315f('0x3c')](_0x16060d['attributes'],function(_0x2a968f){var _0x5a3e69={};_0x5a3e69[_0x2a968f]={'$like':'%'+_0x1561a[_0x315f('0x44')][_0x315f('0x3e')]+'%'};return _0x5a3e69;})});}_0x16060d=_[_0x315f('0xc6')]({},_0x16060d,_0x1561a[_0x315f('0xc7')]);return _0x1c8671[_0x315f('0xde')](_0x16060d);}})[_0x315f('0x16')](function(_0x329e9c){if(_0x329e9c){_0x23ae6f=_0x329e9c[_0x315f('0x57')];if(!_0x1561a[_0x315f('0x44')][_0x315f('0xc8')]('nolimit')){_0x16060d[_0x315f('0x25')]=qs[_0x315f('0x25')](_0x1561a['query']['limit']);_0x16060d['offset']=qs['offset'](_0x1561a[_0x315f('0x44')][_0x315f('0x23')]);}return _0x1c8671['getFaxInteractions'](_0x16060d);}})[_0x315f('0x16')](function(_0x20cfb6){if(_0x20cfb6){return _0x20cfb6?{'count':_0x23ae6f,'rows':_0x20cfb6}:null;}})[_0x315f('0x16')](respondWithResult(_0x497018,null))[_0x315f('0x1f')](handleError(_0x497018,null));};exports['getWhatsappInteractions']=function(_0x4f2993,_0x4d4a65){var _0x57d6b9={};var _0x4bef93={};var _0x2c442d;var _0x25f66e;return db[_0x315f('0x3a')]['findOne']({'where':{'id':_0x4f2993[_0x315f('0x5d')]['id']}})[_0x315f('0x16')](handleEntityNotFound(_0x4d4a65,null))[_0x315f('0x16')](function(_0x401594){if(_0x401594){_0x2c442d=_0x401594;_0x4bef93[_0x315f('0x53')]=_[_0x315f('0xcf')](db[_0x315f('0xe0')][_0x315f('0x3b')]);_0x4bef93[_0x315f('0x44')]=_[_0x315f('0xcf')](_0x4f2993['query']);_0x4bef93[_0x315f('0x54')]=_['intersection'](_0x4bef93[_0x315f('0x53')],_0x4bef93[_0x315f('0x44')]);_0x57d6b9[_0x315f('0x49')]=_[_0x315f('0x55')](_0x4bef93[_0x315f('0x53')],qs[_0x315f('0x56')](_0x4f2993[_0x315f('0x44')][_0x315f('0x56')]));_0x57d6b9[_0x315f('0x49')]=_0x57d6b9[_0x315f('0x49')][_0x315f('0x57')]?_0x57d6b9[_0x315f('0x49')]:_0x4bef93[_0x315f('0x53')];_0x57d6b9[_0x315f('0xc3')]=qs['sort'](_0x4f2993[_0x315f('0x44')][_0x315f('0xc4')]);_0x57d6b9['where']=qs[_0x315f('0x54')](_[_0x315f('0xc5')](_0x4f2993[_0x315f('0x44')],_0x4bef93['filters']));if(_0x4f2993[_0x315f('0x44')][_0x315f('0x3e')]){_0x57d6b9['where']=_[_0x315f('0xc6')](_0x57d6b9[_0x315f('0x43')],{'$or':_['map'](_0x57d6b9['attributes'],function(_0x24e51f){var _0x26830d={};_0x26830d[_0x24e51f]={'$like':'%'+_0x4f2993[_0x315f('0x44')]['filter']+'%'};return _0x26830d;})});}_0x57d6b9=_['merge']({},_0x57d6b9,_0x4f2993[_0x315f('0xc7')]);return _0x2c442d[_0x315f('0xe1')](_0x57d6b9);}})[_0x315f('0x16')](function(_0x20aa0f){if(_0x20aa0f){_0x25f66e=_0x20aa0f[_0x315f('0x57')];if(!_0x4f2993['query'][_0x315f('0xc8')](_0x315f('0xce'))){_0x57d6b9[_0x315f('0x25')]=qs['limit'](_0x4f2993[_0x315f('0x44')][_0x315f('0x25')]);_0x57d6b9['offset']=qs[_0x315f('0x23')](_0x4f2993[_0x315f('0x44')][_0x315f('0x23')]);}return _0x2c442d[_0x315f('0xe1')](_0x57d6b9);}})['then'](function(_0x38b080){if(_0x38b080){return _0x38b080?{'count':_0x25f66e,'rows':_0x38b080}:null;}})[_0x315f('0x16')](respondWithResult(_0x4d4a65,null))[_0x315f('0x1f')](handleError(_0x4d4a65,null));};exports['login']=function(_0x5552d1,_0x4c2faf,_0x59382d){var _0x4007d8;var _0x2a6e42;var _0x1ed399;var _0x558ab4=!_[_0x315f('0x62')](_0x5552d1[_0x315f('0x5d')]['id'])?_0x5552d1[_0x315f('0x5d')]['id']:!_['isNil'](_0x5552d1['user']['id'])?_0x5552d1['user']['id']:null;return db['User'][_0x315f('0x37')]({'where':{'id':_0x558ab4,'role':{'$or':[_0x315f('0x2f'),'user','agent']}},'attributes':['id',_0x315f('0x41'),_0x315f('0xe2'),'mobile',_0x315f('0x2a'),_0x315f('0x61'),'loginInPause']})['then'](function(_0x40c2fd){if(_0x40c2fd){if(_0x40c2fd['role']==='agent'){_0x4007d8=_0x40c2fd;if(_0x5552d1[_0x315f('0x5c')][_0x315f('0xa9')]){_0x1ed399=util[_0x315f('0xa8')](_0x315f('0xe3'),_0x4007d8[_0x5552d1[_0x315f('0x5c')]['interface']]);}else if(_0x5552d1['body'][_0x315f('0xe4')]){_0x1ed399=util[_0x315f('0xa8')](_0x315f('0xe5'),_0x5552d1[_0x315f('0x5c')][_0x315f('0xe4')]);}else{_0x1ed399=util['format'](_0x315f('0xe5'),_0x4007d8[_0x315f('0x41')]);}socket['to'](util[_0x315f('0xa8')]('user:%s',_0x4007d8[_0x315f('0x41')]))[_0x315f('0x2c')]('user:forcelogout',{'user':{'id':_0x4007d8['id'],'name':_0x4007d8[_0x315f('0x41')]},'ip':_0x5552d1[_0x315f('0xe6')][_0x315f('0xe7')]||_0x5552d1['connection']['remoteAddress']||_0x5552d1[_0x315f('0xe8')][_0x315f('0xe9')]||_0x5552d1[_0x315f('0xea')][_0x315f('0xe8')]['remoteAddress']});return db[_0x315f('0xab')][_0x315f('0x2e')]({'where':{'membername':_0x4007d8[_0x315f('0x41')]},'individualHooks':!![]});}}else{throw new db[(_0x315f('0x8d'))][(_0x315f('0x8b'))](_0x315f('0xeb'));}})[_0x315f('0x16')](function(){if(_0x4007d8){return _0x4007d8[_0x315f('0xec')]({'raw':!![]});}})[_0x315f('0x16')](function(_0x244e7d){if(_0x4007d8){if(_0x244e7d){_0x2a6e42=_0x244e7d;if(_0x2a6e42[_0x315f('0x57')]){var _0x75d1fd=_0x2a6e42[_0x315f('0x3c')](function(_0x5e54fe){var _0x3a5bb3={'membername':_0x4007d8[_0x315f('0x41')],'UserId':_0x4007d8['id'],'queue_name':_0x5e54fe['name'],'VoiceQueueId':_0x5e54fe['id'],'interface':_0x1ed399,'paused':_0x4007d8['loginInPause']||![],'penalty':_0x5e54fe[_0x315f('0xed')]||0x0};return db[_0x315f('0xab')]['upsert'](_0x3a5bb3);});return Promise[_0x315f('0x52')](_0x75d1fd);}}}})[_0x315f('0x16')](function(){if(_0x4007d8){return db[_0x315f('0xee')]['findAll']({'where':{'membername':_0x4007d8['name'],'exitAt':null}});}})['then'](function(_0x4e8d3e){if(_0x4007d8){var _0x269d93=[];_0x4e8d3e['forEach'](function(_0x9424a6){_0x269d93[_0x315f('0x4a')](_0x9424a6[_0x315f('0x29')]({'exitAt':moment()[_0x315f('0xa8')](_0x315f('0xef'))}));});return Promise[_0x315f('0x52')](_0x269d93);}})[_0x315f('0x16')](function(){if(_0x4007d8){var _0xd149ae=[];var _0x58fedf=[];var _0x25945d=utils[_0x315f('0xf0')]();var _0x4c2d3b={'membername':_0x4007d8[_0x315f('0x41')],'interface':_0x1ed399,'enterAt':moment()['format'](_0x315f('0xef')),'role':_0x4007d8[_0x315f('0x2a')],'internal':_0x4007d8['internal']};_0x25945d[_0x315f('0xf1')](function(_0x44dc7e){_0xd149ae[_0x315f('0x4a')](_[_0x315f('0xc6')]({'channel':_0x44dc7e,'type':'LOGIN','data1':_0x5552d1[_0x315f('0x5c')]['device'],'data2':_0x1ed399},_0x4c2d3b));if(_0x4007d8['loginInPause']){_0x58fedf[_0x315f('0x4a')](_[_0x315f('0xc6')]({'channel':_0x44dc7e,'type':_0x315f('0xf2'),'data1':_0x315f('0xf3')},_0x4c2d3b));}});return db[_0x315f('0xee')]['bulkCreate'](_0xd149ae[_0x315f('0xc1')](_0x58fedf),{'individualHooks':!![]});}})[_0x315f('0x16')](function(){if(_0x4007d8){return _0x4007d8[_0x315f('0x29')]({'online':!![],'lastLoginAt':moment()[_0x315f('0xa8')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x4007d8[_0x315f('0x9b')]||![],'mailPause':_0x4007d8[_0x315f('0x9b')]||![],'chatPause':_0x4007d8[_0x315f('0x9b')]||![],'faxPause':_0x4007d8[_0x315f('0x9b')]||![],'smsPause':_0x4007d8[_0x315f('0x9b')]||![],'openchannelPause':_0x4007d8['loginInPause']||![],'whatsappPause':_0x4007d8['loginInPause']||![],'pauseType':_0x4007d8[_0x315f('0x9b')]?_0x315f('0xf3'):null,'interface':_0x1ed399,'lastPauseAt':moment()[_0x315f('0xa8')](_0x315f('0xef'))});}})['then'](function(_0x4543d7){if(_0x5552d1['isMiddleware']){return _0x59382d();}else{return Promise[_0x315f('0xf4')](_0x4543d7)[_0x315f('0x16')](respondWithResult(_0x4c2faf,null));}})[_0x315f('0x1f')](handleError(_0x4c2faf,null));};exports[_0x315f('0xf5')]=function(_0x3107e5,_0x3ec7b8){var _0x5c64ab;return db['User'][_0x315f('0x37')]({'where':{'id':_0x3107e5[_0x315f('0x5d')]['id'],'role':_0x315f('0x2b')},'attributes':['id',_0x315f('0x41'),'role']})[_0x315f('0x16')](handleEntityNotFound(_0x3ec7b8,null))[_0x315f('0x16')](function(_0x2a2dcb){if(_0x2a2dcb){_0x5c64ab=_0x2a2dcb;return db[_0x315f('0xab')][_0x315f('0x2e')]({'where':{'membername':_0x5c64ab[_0x315f('0x41')]},'individualHooks':!![]});}})[_0x315f('0x16')](function(){return db['MemberReport'][_0x315f('0x4b')]({'where':{'membername':_0x5c64ab['name'],'exitAt':null}});})[_0x315f('0x16')](function(_0x29f0be){var _0x3083d9=[];_0x29f0be['forEach'](function(_0x3d55c6){_0x3083d9[_0x315f('0x4a')](_0x3d55c6[_0x315f('0x29')]({'exitAt':moment()['format'](_0x315f('0xef'))}));});return Promise[_0x315f('0x52')](_0x3083d9);})[_0x315f('0x16')](function(){return _0x5c64ab['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x315f('0x16')](respondWithResult(_0x3ec7b8,null))['catch'](handleError(_0x3ec7b8,null));};exports['pause']=function(_0x56cbf6,_0x42601f){var _0x1fe2cd;return db[_0x315f('0xab')][_0x315f('0x29')]({'paused':0x1},{'where':{'UserId':_0x56cbf6['params']['id']},'individualHooks':!![]})['then'](function(){return db[_0x315f('0x3a')][_0x315f('0x37')]({'where':{'id':_0x56cbf6['params']['id'],'role':'agent'},'attributes':['id',_0x315f('0x41'),_0x315f('0x2a'),_0x315f('0x61'),_0x315f('0xa9'),_0x315f('0x9a')]});})[_0x315f('0x16')](handleEntityNotFound(_0x42601f,null))[_0x315f('0x16')](function(_0x1ffee0){if(_0x1ffee0){_0x1fe2cd=_0x1ffee0;return respondWithRpcPromise(_0x315f('0xf6'),_0x315f('0xf7'),{'id':_0x1fe2cd['id'],'name':_0x1fe2cd['name'],'pause':!![]});}})['then'](function(){if(_0x1fe2cd){return db[_0x315f('0xee')][_0x315f('0x4b')]({'where':{'membername':_0x1fe2cd['name'],'type':_0x315f('0xf2'),'exitAt':null}});}})[_0x315f('0x16')](function(_0x3438fc){if(_0x3438fc[_0x315f('0x57')]){var _0x591a50=moment()[_0x315f('0xa8')](_0x315f('0xef'));for(var _0x3f4b1d=0x0,_0x24d2eb=_0x3438fc['length'];_0x3f4b1d<_0x24d2eb;_0x3f4b1d++){_0x3438fc[_0x3f4b1d][_0x315f('0xf8')]({'exitAt':_0x591a50});}}})[_0x315f('0x16')](function(){var _0x31e997=[];var _0x1dbd44=utils[_0x315f('0xf0')]();_0x1dbd44[_0x315f('0xf1')](function(_0x38fe21){_0x31e997[_0x315f('0x4a')]({'channel':_0x38fe21,'membername':_0x1fe2cd[_0x315f('0x41')],'interface':_[_0x315f('0x62')](_0x1fe2cd[_0x315f('0xa9')])?util[_0x315f('0xa8')](_0x315f('0xe5'),_0x1fe2cd[_0x315f('0x41')]):_0x1fe2cd['interface'],'type':_0x315f('0xf2'),'enterAt':moment()[_0x315f('0xa8')](_0x315f('0xef')),'data1':_0x56cbf6[_0x315f('0x5c')]['type']||_0x315f('0xf9'),'role':_0x1fe2cd[_0x315f('0x2a')],'internal':_0x1fe2cd['internal']});});return db[_0x315f('0xee')][_0x315f('0x84')](_0x31e997,{'individualHooks':!![]});})['then'](function(){return _0x1fe2cd['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x56cbf6[_0x315f('0x5c')]['type']||_0x315f('0xf9'),'lastPauseAt':moment()[_0x315f('0xa8')](_0x315f('0xef'))});})[_0x315f('0x16')](respondWithResult(_0x42601f,null))[_0x315f('0x1f')](handleError(_0x42601f,null));};exports[_0x315f('0xfa')]=function(_0x20b46d,_0x2aa4ca){if(_0x20b46d['body'][_0x315f('0x99')]&&!utils[_0x315f('0xad')](_0x20b46d['body']['channel'])){throw new APIBadRequestError(util[_0x315f('0xa8')](_0x315f('0xfb'),_0x20b46d['body'][_0x315f('0x99')]));}return db[_0x315f('0x3a')][_0x315f('0x37')]({'where':{'id':_0x20b46d[_0x315f('0x5d')]['id']},'attributes':['id',_0x315f('0x41'),'role',_0x315f('0x61'),'interface',_0x315f('0x9a'),_0x315f('0x9c'),_0x315f('0xfc'),_0x315f('0xfd'),_0x315f('0xfe'),_0x315f('0xff'),_0x315f('0x100'),_0x315f('0x101'),_0x315f('0x102'),_0x315f('0x103')]})[_0x315f('0x16')](function(_0x134d6f){if(!_0x134d6f){throw new APINotFoundError(util[_0x315f('0xa8')](_0x315f('0x104'),_0x20b46d[_0x315f('0x5d')]['id']));}return _0x134d6f[_0x315f('0xfa')](_0x20b46d[_0x315f('0x5c')][_0x315f('0x99')]);})[_0x315f('0x16')](respondWithResult(_0x2aa4ca,null))[_0x315f('0x1f')](APIHandleError(_0x2aa4ca));};exports[_0x315f('0x105')]=function(_0x2c1266,_0x431401){var _0x4f3842={};var _0x46d2b8={};var _0x9f4d49;var _0x4e5db4;return db['User'][_0x315f('0x91')]({'where':{'id':_0x2c1266[_0x315f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x431401,null))['then'](function(_0x46a17a){if(_0x46a17a){_0x9f4d49=_0x46a17a;_0x46d2b8['model']=_[_0x315f('0xcf')](db[_0x315f('0x106')][_0x315f('0x3b')]);_0x46d2b8[_0x315f('0x44')]=_[_0x315f('0xcf')](_0x2c1266['query']);_0x46d2b8[_0x315f('0x54')]=_[_0x315f('0x55')](_0x46d2b8[_0x315f('0x53')],_0x46d2b8[_0x315f('0x44')]);_0x4f3842['attributes']=_[_0x315f('0x55')](_0x46d2b8[_0x315f('0x53')],qs[_0x315f('0x56')](_0x2c1266[_0x315f('0x44')][_0x315f('0x56')]));_0x4f3842['attributes']=_0x4f3842[_0x315f('0x49')][_0x315f('0x57')]?_0x4f3842[_0x315f('0x49')]:_0x46d2b8[_0x315f('0x53')];_0x4f3842[_0x315f('0xc3')]=qs['sort'](_0x2c1266[_0x315f('0x44')][_0x315f('0xc4')]);_0x4f3842[_0x315f('0x43')]=qs['filters'](_[_0x315f('0xc5')](_0x2c1266[_0x315f('0x44')],_0x46d2b8[_0x315f('0x54')]));if(_0x2c1266['query'][_0x315f('0x3e')]){_0x4f3842['where']=_['merge'](_0x4f3842[_0x315f('0x43')],{'$or':_[_0x315f('0x3c')](_0x4f3842[_0x315f('0x49')],function(_0xea4b80){var _0x53e4b5={};_0x53e4b5[_0xea4b80]={'$like':'%'+_0x2c1266[_0x315f('0x44')][_0x315f('0x3e')]+'%'};return _0x53e4b5;})});}_0x4f3842=_[_0x315f('0xc6')]({},_0x4f3842,_0x2c1266[_0x315f('0xc7')]);return _0x9f4d49[_0x315f('0x105')](_0x4f3842);}})['then'](function(_0x21931b){if(_0x21931b){_0x4e5db4=_0x21931b[_0x315f('0x57')];if(!_0x2c1266[_0x315f('0x44')][_0x315f('0xc8')](_0x315f('0xce'))){_0x4f3842[_0x315f('0x25')]=qs['limit'](_0x2c1266[_0x315f('0x44')][_0x315f('0x25')]);_0x4f3842['offset']=qs[_0x315f('0x23')](_0x2c1266[_0x315f('0x44')]['offset']);}return _0x9f4d49[_0x315f('0x105')](_0x4f3842);}})[_0x315f('0x16')](function(_0x1c353e){if(_0x1c353e){return _0x1c353e?{'count':_0x4e5db4,'rows':_0x1c353e}:null;}})['then'](respondWithResult(_0x431401,null))[_0x315f('0x1f')](handleError(_0x431401,null));};exports[_0x315f('0x107')]=function(_0x1a6b77,_0x2a652b){var _0x47c6ab=_0x1a6b77[_0x315f('0x5d')]['id'];var _0x28b6dd=_0x1a6b77[_0x315f('0x5c')]?_0x1a6b77[_0x315f('0x5c')][_0x315f('0xa1')]:null;var _0xe9dfe9=[];return Promise[_0x315f('0xf4')]()['then'](function(){if(!_0x28b6dd)throw new APIBadRequestError(_0x315f('0x108'));})[_0x315f('0x16')](function(){return db['User'][_0x315f('0x91')]({'where':{'id':_0x47c6ab}});})[_0x315f('0x16')](function(_0x17ccc5){if(!_0x17ccc5)throw new APINotFoundError(util['format'](_0x315f('0x104'),_0x1a6b77[_0x315f('0x5d')]['id']));return db[_0x315f('0x64')][_0x315f('0x109')](function(_0x44e4d3){return _0x17ccc5[_0x315f('0x107')](_0x28b6dd,{'transaction':_0x44e4d3})['then'](function(){return db[_0x315f('0x106')][_0x315f('0x4b')]({'where':{'id':{'$in':_0x28b6dd}}});})[_0x315f('0x16')](function(_0x3b2211){var _0x18624d=_['map'](_0x3b2211,function(_0x46d1aa){return _0x46d1aa[_0x315f('0x10a')]();});return Promise[_0x315f('0x52')](_0x18624d);})[_0x315f('0x16')](function(_0x23d267){_0xe9dfe9=_['flattenDeep'](_0x23d267);var _0x265c79=_[_0x315f('0x3c')](_0xe9dfe9,function(_0x315379){return _0x315379['addAgent'](_0x17ccc5['id'],{'transaction':_0x44e4d3});});return Promise[_0x315f('0x52')](_0x265c79);})['then'](function(){if(!_0x17ccc5['online'])return;var _0x554b9a=_[_0x315f('0x3e')](_0xe9dfe9,function(_0x222382){return _0x222382[_0x315f('0x10b')](_0x315f('0x99'))===_0x315f('0x10c');});var _0xbf6ae7=_[_0x315f('0x3c')](_0x554b9a,function(_0x391b3a){return db[_0x315f('0xab')][_0x315f('0xac')]({'membername':_0x17ccc5[_0x315f('0x41')],'UserId':_0x17ccc5['id'],'queue_name':_0x391b3a[_0x315f('0x41')],'VoiceQueueId':_0x391b3a['id'],'interface':_[_0x315f('0x62')](_0x17ccc5[_0x315f('0xa9')])?util['format'](_0x315f('0xe5'),_0x17ccc5[_0x315f('0x41')]):_0x17ccc5[_0x315f('0xa9')],'paused':_0x17ccc5['voicePause']||![],'penalty':_0x17ccc5[_0x315f('0xaa')]},{'transaction':_0x44e4d3});});return Promise[_0x315f('0x52')](_0xbf6ae7);})[_0x315f('0x16')](function(){return db['TeamVoicePrefix'][_0x315f('0x4b')]({'where':{'teamId':{'$in':_0x28b6dd}}});})['then'](function(_0x5e0573){var _0xb64fba=_['map'](_0x5e0573,function(_0x4c5102){return db[_0x315f('0x10d')][_0x315f('0x78')]({'UserId':_0x17ccc5['id'],'VoicePrefixId':_0x4c5102['VoicePrefixId']},{'transaction':_0x44e4d3});});return Promise['all'](_0xb64fba);});});})[_0x315f('0x16')](function(){for(var _0x464cbc=0x0;_0x464cbc<_0xe9dfe9[_0x315f('0x57')];_0x464cbc++){var _0x340922=_0xe9dfe9[_0x464cbc][_0x315f('0x10b')]('channel');var _0x11e6b6=_0x340922+_0x315f('0xa3');socket[_0x315f('0x2c')](_0x315f('0x31')+_0x340922+_0x315f('0xa4'),{'UserId':_0x47c6ab,['queueField']:_0xe9dfe9[_0x464cbc]['id']});}})[_0x315f('0x16')](respondWithStatusCode(_0x2a652b,null))['catch'](APIHandleError(_0x2a652b));};exports[_0x315f('0x10e')]=function(_0x1cf3d7,_0x183e4c){var _0x1050fe=_0x1cf3d7['params']['id'];var _0x3bcaca=null;if(_0x1cf3d7['query'][_0x315f('0xa1')]){_0x3bcaca=_[_0x315f('0x10f')](_0x1cf3d7['query'][_0x315f('0xa1')])?_0x1cf3d7[_0x315f('0x44')]['ids']:[_0x1cf3d7[_0x315f('0x44')]['ids']];}var _0x523221=[];return Promise[_0x315f('0xf4')]()[_0x315f('0x16')](function(){if(!_0x3bcaca)throw new APIBadRequestError(_0x315f('0x110'));})[_0x315f('0x16')](function(){return db[_0x315f('0x3a')][_0x315f('0x91')]({'where':{'id':_0x1050fe}});})[_0x315f('0x16')](function(_0x145395){if(!_0x145395)throw new APINotFoundError(util[_0x315f('0xa8')](_0x315f('0x104'),_0x1cf3d7[_0x315f('0x5d')]['id']));return db['sequelize']['transaction'](function(_0x3602ee){return _0x145395['removeTeams'](_0x3bcaca,{'transaction':_0x3602ee})[_0x315f('0x16')](function(){return db[_0x315f('0x106')]['findAll']({'where':{'id':{'$in':_0x3bcaca}}});})[_0x315f('0x16')](function(_0x37e3a5){var _0x1d4395=_[_0x315f('0x3c')](_0x37e3a5,function(_0x56a9d1){return _0x56a9d1['getAssociatedQueues']();});return Promise[_0x315f('0x52')](_0x1d4395);})['then'](function(_0x205d01){_0x523221=_[_0x315f('0x111')](_0x205d01);var _0x51e26f=_[_0x315f('0x3c')](_0x523221,function(_0x14d6b8){return _0x14d6b8[_0x315f('0x112')](_0x145395['id'],{'transaction':_0x3602ee});});return Promise[_0x315f('0x52')](_0x51e26f);})['then'](function(){if(!_0x145395[_0x315f('0x9a')])return;var _0xb4510d=_['filter'](_0x523221,function(_0x54c956){return _0x54c956[_0x315f('0x10b')]('channel')===_0x315f('0x10c');});var _0x235a4e=_['map'](_0xb4510d,function(_0xad037a){return db[_0x315f('0xab')]['destroy']({'where':{'VoiceQueueId':_0xad037a['id'],'UserId':_0x145395['id']},'transaction':_0x3602ee});});return Promise[_0x315f('0x52')](_0x235a4e);})[_0x315f('0x16')](function(){return db[_0x315f('0x113')][_0x315f('0x4b')]({'where':{'teamId':{'$in':_0x3bcaca}}});})[_0x315f('0x16')](function(_0x44529e){var _0x17032b=_[_0x315f('0x3c')](_0x44529e,function(_0x3ecf7f){return db[_0x315f('0x10d')][_0x315f('0x2e')]({'where':{'UserId':_0x145395['id'],'VoicePrefixId':_0x3ecf7f[_0x315f('0x114')]}},{'transaction':_0x3602ee});});return Promise[_0x315f('0x52')](_0x17032b);});});})[_0x315f('0x16')](function(){for(var _0x5c7a10=0x0;_0x5c7a10<_0x523221[_0x315f('0x57')];_0x5c7a10++){var _0x4b85d9=_0x523221[_0x5c7a10][_0x315f('0x10b')]('channel');var _0x4d44c8=_0x4b85d9+_0x315f('0xa3');socket[_0x315f('0x2c')](_0x315f('0x31')+_0x4b85d9+'Queue:remove',{'UserId':_0x1050fe,['queueField']:_0x523221[_0x5c7a10]['id']});}})['then'](respondWithStatusCode(_0x183e4c,null))[_0x315f('0x1f')](APIHandleError(_0x183e4c));};exports[_0x315f('0x115')]=function(_0x54af00,_0x5ee235){var _0x203e3f={};var _0x482ed2={};var _0x6ac3b1;var _0x8efd1d;return db[_0x315f('0x3a')][_0x315f('0x91')]({'where':{'id':_0x54af00['params']['id']}})['then'](handleEntityNotFound(_0x5ee235,null))['then'](function(_0x89124){if(_0x89124){_0x6ac3b1=_0x89124;_0x482ed2['model']=_[_0x315f('0xcf')](db['CmList'][_0x315f('0x3b')]);_0x482ed2[_0x315f('0x44')]=_['keys'](_0x54af00[_0x315f('0x44')]);_0x482ed2['filters']=_[_0x315f('0x55')](_0x482ed2[_0x315f('0x53')],_0x482ed2['query']);_0x203e3f['attributes']=_[_0x315f('0x55')](_0x482ed2[_0x315f('0x53')],qs[_0x315f('0x56')](_0x54af00['query'][_0x315f('0x56')]));_0x203e3f['attributes']=_0x203e3f[_0x315f('0x49')][_0x315f('0x57')]?_0x203e3f['attributes']:_0x482ed2[_0x315f('0x53')];_0x203e3f['order']=qs['sort'](_0x54af00[_0x315f('0x44')][_0x315f('0xc4')]);_0x203e3f[_0x315f('0x43')]=qs[_0x315f('0x54')](_[_0x315f('0xc5')](_0x54af00[_0x315f('0x44')],_0x482ed2[_0x315f('0x54')]));if(_0x54af00[_0x315f('0x44')]['filter']){_0x203e3f['where']=_[_0x315f('0xc6')](_0x203e3f[_0x315f('0x43')],{'$or':_[_0x315f('0x3c')](_0x203e3f['attributes'],function(_0xb63ba2){var _0x246b1d={};_0x246b1d[_0xb63ba2]={'$like':'%'+_0x54af00[_0x315f('0x44')][_0x315f('0x3e')]+'%'};return _0x246b1d;})});}_0x203e3f=_[_0x315f('0xc6')]({},_0x203e3f,_0x54af00[_0x315f('0xc7')]);return _0x6ac3b1[_0x315f('0x115')](_0x203e3f);}})[_0x315f('0x16')](function(_0x3c21e0){if(_0x3c21e0){_0x8efd1d=_0x3c21e0['length'];if(!_0x54af00[_0x315f('0x44')][_0x315f('0xc8')](_0x315f('0xce'))){_0x203e3f[_0x315f('0x25')]=qs[_0x315f('0x25')](_0x54af00[_0x315f('0x44')][_0x315f('0x25')]);_0x203e3f[_0x315f('0x23')]=qs[_0x315f('0x23')](_0x54af00[_0x315f('0x44')]['offset']);}return _0x6ac3b1['getLists'](_0x203e3f);}})[_0x315f('0x16')](function(_0x57e846){if(_0x57e846){return _0x57e846?{'count':_0x8efd1d,'rows':_0x57e846}:null;}})[_0x315f('0x16')](respondWithResult(_0x5ee235,null))[_0x315f('0x1f')](handleError(_0x5ee235,null));};exports[_0x315f('0x116')]=function(_0x5ebd4c,_0x153cfa){var _0x1b540a={};var _0x1a35fd={};var _0x2d923e;return db[_0x315f('0x3a')][_0x315f('0x91')]({'where':{'id':_0x5ebd4c[_0x315f('0x5d')]['id']}})[_0x315f('0x16')](handleEntityNotFound(_0x153cfa,null))[_0x315f('0x16')](function(_0x4e0e8b){if(_0x4e0e8b){_0x2d923e=_0x4e0e8b;_0x1a35fd[_0x315f('0x53')]=_['keys'](db[_0x315f('0x3a')][_0x315f('0x3b')]);_0x1a35fd[_0x315f('0x44')]=_[_0x315f('0xcf')](_0x5ebd4c[_0x315f('0x44')]);_0x1a35fd[_0x315f('0x54')]=_['intersection'](_0x1a35fd[_0x315f('0x53')],_0x1a35fd[_0x315f('0x44')]);_0x1b540a['attributes']=_['intersection'](_0x1a35fd['model'],qs[_0x315f('0x56')](_0x5ebd4c[_0x315f('0x44')][_0x315f('0x56')]));_0x1b540a[_0x315f('0x49')]=_0x1b540a[_0x315f('0x49')][_0x315f('0x57')]?_0x1b540a[_0x315f('0x49')]:_0x1a35fd[_0x315f('0x53')];_0x1b540a['order']=qs[_0x315f('0xc4')](_0x5ebd4c['query'][_0x315f('0xc4')]);_0x1b540a[_0x315f('0x43')]=qs[_0x315f('0x54')](_[_0x315f('0xc5')](_0x5ebd4c['query'],_0x1a35fd[_0x315f('0x54')]));if(_0x5ebd4c[_0x315f('0x44')][_0x315f('0x3e')]){_0x1b540a['where']=_[_0x315f('0xc6')](_0x1b540a[_0x315f('0x43')],{'$or':_[_0x315f('0x3c')](_0x1b540a[_0x315f('0x49')],function(_0x2041ec){var _0x3c7b5c={};_0x3c7b5c[_0x2041ec]={'$like':'%'+_0x5ebd4c['query']['filter']+'%'};return _0x3c7b5c;})});}_0x1b540a['model']=db['User'];_0x1b540a['as']=_0x315f('0x32');_0x1b540a=_['merge']({},_0x1b540a,_0x5ebd4c['options']);return _0x2d923e[_0x315f('0xec')]({'include':[_0x1b540a]});}})[_0x315f('0x16')](function(_0x2a5887){if(_0x2a5887){var _0x1d7d5a={},_0x37fe2d=[];for(var _0x2cf205=0x0;_0x2cf205<_0x2a5887[_0x315f('0x57')];_0x2cf205+=0x1){for(var _0x148306=0x0,_0x20b4da;_0x148306<_0x2a5887[_0x2cf205][_0x315f('0x32')]['length'];_0x148306+=0x1){_0x20b4da=_0x2a5887[_0x2cf205]['Agents'][_0x148306]['get']({'plain':!![]});_0x1d7d5a[_0x20b4da['id']]=_0x20b4da;}}_0x1d7d5a=_[_0x315f('0x117')](_0x1d7d5a);for(var _0x3d5d3c=qs[_0x315f('0x23')](_0x5ebd4c[_0x315f('0x44')][_0x315f('0x23')]);_0x3d5d3c<_0x1d7d5a[_0x315f('0x57')]&&_0x37fe2d[_0x315f('0x57')]=_0x4c05b3){_0x14cc43=_0x4c05b3;_0x57eb2d=0xc8;}else{_0x57eb2d=0xce;}_0x3082fb[_0x004d('0x1d')](_0x57eb2d);return _0x3082fb[_0x004d('0x24')](_0x004d('0x25'),_0x2d5e6e+'-'+_0x14cc43+'/'+_0x4c05b3)['json'](_0xc41f34);}return null;};}function saveUpdates(_0x1cb6ea){return function(_0x57095d){if(_0x57095d){return _0x57095d['update'](_0x1cb6ea)['then'](function(_0x5875f9){if(_0x5875f9['role']===_0x004d('0x26')){socket['emit'](_0x004d('0x27')+_0x5875f9['id'],_0x5875f9);}return _0x5875f9;});}return null;};}function removeEntity(_0x22ea1e){return function(_0x1282b2){if(_0x1282b2){return _0x1282b2['destroy']()[_0x004d('0x13')](function(){var _0x2ca6a1=_0x1282b2[_0x004d('0x28')]({'plain':!![]});if(_0x2ca6a1[_0x004d('0x29')]===_0x004d('0x2a'))return;var _0x6af8de=[{'name':'Users','value':_0x004d('0x2b'),'ignore':!![]},{'name':'Agents','value':_0x004d('0x26'),'ignore':![]},{'name':_0x004d('0x2c'),'value':_0x004d('0x2d'),'ignore':![]}];var _0x400afe=_(_0x6af8de)[_0x004d('0x2e')]('ignore')[_0x004d('0x2f')](_0x004d('0x30'))['value']();if(_['includes'](_0x400afe,_0x2ca6a1[_0x004d('0x29')])){return;}var _0x5a1968=_[_0x004d('0x31')](_0x6af8de,[_0x004d('0x30'),_0x2ca6a1[_0x004d('0x29')]])[_0x004d('0x32')];return db[_0x004d('0x33')]['destroy']({'where':{'type':_0x5a1968,'resourceId':_0x2ca6a1['id']}})[_0x004d('0x13')](function(){return _0x1282b2;});})[_0x004d('0x13')](function(){_0x22ea1e[_0x004d('0x1d')](0xcc)[_0x004d('0x1e')]();});}};}function handleEntityNotFound(_0x261e76){return function(_0x39f9b0){if(!_0x39f9b0){_0x261e76[_0x004d('0x1c')](0x194);}return _0x39f9b0;};}function handleError(_0x13d841,_0x1aecae){_0x1aecae=_0x1aecae||0x1f4;return function(_0x22ff92){logger['error'](_0x22ff92[_0x004d('0x34')]);if(_0x22ff92[_0x004d('0x32')]){delete _0x22ff92['name'];}_0x13d841[_0x004d('0x1d')](_0x1aecae)[_0x004d('0x35')](_0x22ff92);};}exports[_0x004d('0x36')]=function(_0x901d14,_0x1d750f){var _0x166f37={},_0x34098b={'count':0x0,'rows':[]};var _0x48db86=_(db[_0x004d('0x37')]['rawAttributes'])[_0x004d('0x2f')](function(_0x5381b0){return{'name':_0x5381b0[_0x004d('0x38')],'type':_0x5381b0['type']['key']};})[_0x004d('0x2e')](function(_0x2f1038){return!_[_0x004d('0x39')](['password',_0x004d('0x3a')],_0x2f1038['name']);})[_0x004d('0x30')]();_0x166f37=qs[_0x004d('0x3b')](_0x48db86,_0x901d14);var _0xc7b06a={'where':_0x166f37[_0x004d('0x3c')]};return db[_0x004d('0x37')][_0x004d('0x21')](_0xc7b06a)['then'](function(_0x42bf51){_0x34098b[_0x004d('0x21')]=_0x42bf51;if(_0x901d14[_0x004d('0x3d')][_0x004d('0x3e')]){_0x166f37['include']=[{'all':!![]}];}if(_0x901d14[_0x004d('0x3d')][_0x004d('0x3f')]===_0x004d('0x40')){_0x166f37[_0x004d('0x41')]=[{'model':db[_0x004d('0x42')],'as':'userSetting'}];}if(!_[_0x004d('0x39')](_0x166f37[_0x004d('0x43')],'id')){_0x166f37['attributes'][_0x004d('0x44')]('id');}return db[_0x004d('0x37')][_0x004d('0x45')](_0x166f37);})[_0x004d('0x13')](function(_0x3b4317){_0x34098b[_0x004d('0x46')]=_0x3b4317;if(_0x901d14[_0x004d('0x3d')][_0x004d('0x47')]===_0x004d('0x40')){var _0x3b39da=[];for(var _0x4bf324=0x0;_0x4bf324<_0x34098b[_0x004d('0x46')][_0x004d('0x48')];_0x4bf324++){_0x3b39da['push'](get_open_tabs(_0x004d('0x49'),_0x34098b['rows'][_0x4bf324]['dataValues']));_0x3b39da['push'](get_open_tabs(_0x004d('0x4a'),_0x34098b[_0x004d('0x46')][_0x4bf324][_0x004d('0x4b')]));_0x3b39da['push'](get_open_tabs(_0x004d('0x4c'),_0x34098b[_0x004d('0x46')][_0x4bf324][_0x004d('0x4b')]));_0x3b39da['push'](get_open_tabs(_0x004d('0x4d'),_0x34098b[_0x004d('0x46')][_0x4bf324][_0x004d('0x4b')]));_0x3b39da[_0x004d('0x44')](get_open_tabs(_0x004d('0x4e'),_0x34098b[_0x004d('0x46')][_0x4bf324][_0x004d('0x4b')]));_0x3b39da[_0x004d('0x44')](get_open_tabs(_0x004d('0x4f'),_0x34098b[_0x004d('0x46')][_0x4bf324][_0x004d('0x4b')]));}return Promise[_0x004d('0x50')](_0x3b39da)['then'](function(){return _0x34098b;});}else{return _0x34098b;}})[_0x004d('0x13')](respondWithFilteredResult(_0x1d750f,_0x166f37))[_0x004d('0x51')](handleError(_0x1d750f,null));};exports[_0x004d('0x52')]=function(_0x5472ff,_0x5e97a6){var _0x5b3a42={'raw':![],'where':{'id':_0x5472ff['params']['id']}},_0x11564c={};_0x11564c[_0x004d('0x53')]=_[_0x004d('0x54')](_[_0x004d('0x55')](db[_0x004d('0x37')][_0x004d('0x56')]),[_0x004d('0x57'),'salt']);_0x11564c[_0x004d('0x3d')]=_[_0x004d('0x55')](_0x5472ff[_0x004d('0x3d')]);_0x11564c['filters']=_['intersection'](_0x11564c[_0x004d('0x53')],_0x11564c[_0x004d('0x3d')]);_0x5b3a42[_0x004d('0x43')]=_[_0x004d('0x58')](_0x11564c['model'],qs[_0x004d('0x59')](_0x5472ff[_0x004d('0x3d')]['fields']));_0x5b3a42['attributes']=_0x5b3a42[_0x004d('0x43')][_0x004d('0x48')]?_0x5b3a42[_0x004d('0x43')]:_0x11564c[_0x004d('0x53')];if(_0x5472ff['query'][_0x004d('0x3e')]){_0x5b3a42['include']=[{'all':!![]}];}if(_0x5472ff[_0x004d('0x3d')][_0x004d('0x3f')]==='true'){_0x5b3a42['include']=[{'model':db['UserSetting'],'as':'userSetting'}];}_0x5b3a42=_[_0x004d('0x5a')]({},_0x5b3a42,_0x5472ff[_0x004d('0x5b')]);if(!_['includes'](_0x5b3a42[_0x004d('0x43')],'id')){_0x5b3a42[_0x004d('0x43')][_0x004d('0x44')]('id');}return db[_0x004d('0x37')][_0x004d('0x31')](_0x5b3a42)[_0x004d('0x13')](handleEntityNotFound(_0x5e97a6,null))[_0x004d('0x13')](function(_0x4680e0){var _0x36a9b1=[];values=_0x4680e0;if(_0x5472ff[_0x004d('0x3d')][_0x004d('0x47')]===_0x004d('0x40')){_0x36a9b1['push'](get_open_tabs(_0x004d('0x49'),_0x4680e0['dataValues']));_0x36a9b1[_0x004d('0x44')](get_open_tabs(_0x004d('0x4a'),_0x4680e0['dataValues']));_0x36a9b1[_0x004d('0x44')](get_open_tabs(_0x004d('0x4e'),_0x4680e0[_0x004d('0x4b')]));_0x36a9b1[_0x004d('0x44')](get_open_tabs(_0x004d('0x4f'),_0x4680e0[_0x004d('0x4b')]));_0x36a9b1['push'](get_open_tabs(_0x004d('0x4c'),_0x4680e0['dataValues']));_0x36a9b1[_0x004d('0x44')](get_open_tabs(_0x004d('0x4d'),_0x4680e0['dataValues']));return Promise[_0x004d('0x50')](_0x36a9b1);}else{return values;}})['then'](function(){return values;})['then'](respondWithResult(_0x5e97a6,null))[_0x004d('0x51')](handleError(_0x5e97a6,null));};exports['update']=function(_0xea842a,_0x12ef35){if(_0xea842a[_0x004d('0x5c')]['id']){delete _0xea842a[_0x004d('0x5c')]['id'];}delete _0xea842a[_0x004d('0x5c')][_0x004d('0x29')];return db['User']['find']({'where':{'id':_0xea842a[_0x004d('0x5d')]['id']}})[_0x004d('0x13')](handleEntityNotFound(_0x12ef35,null))[_0x004d('0x13')](saveUpdates(_0xea842a[_0x004d('0x5c')],null))[_0x004d('0x13')](respondWithResult(_0x12ef35,null))[_0x004d('0x51')](handleError(_0x12ef35,null));};exports[_0x004d('0x5e')]=function(_0x399d15,_0x94af84){return db['User']['describe']()['then'](respondWithResult(_0x94af84,null))[_0x004d('0x51')](handleError(_0x94af84,null));};exports[_0x004d('0x5f')]=function(_0x210012,_0x5c4afa){return db[_0x004d('0x37')]['find']({'where':{'id':_0x210012[_0x004d('0x5d')]['id']}})[_0x004d('0x13')](handleEntityNotFound(_0x5c4afa,null))[_0x004d('0x13')](function(_0x59fbb5){if(_0x59fbb5){return _0x59fbb5[_0x004d('0x5f')](_0x210012[_0x004d('0x5c')][_0x004d('0x60')],_[_0x004d('0x61')](_0x210012[_0x004d('0x5c')],['ids','id'])||{});}})[_0x004d('0x13')](respondWithResult(_0x5c4afa,null))['catch'](handleError(_0x5c4afa,null));};function validateUser(_0x1fb1ea){return new Promise(function(_0xf365ad,_0xac51d2){if(_0x1fb1ea[_0x004d('0x62')])return _0xf365ad(_0x1fb1ea);return db[_0x004d('0x63')][_0x004d('0x64')](0x1)[_0x004d('0x13')](function(_0x561e19){if(_0x561e19[_0x004d('0x65')])authService[_0x004d('0x66')](_0x1fb1ea[_0x004d('0x57')]);db['User']['max']('internal')[_0x004d('0x13')](function(_0x30fe6a){if(_[_0x004d('0x67')](_0x30fe6a)){_0x1fb1ea['internal']=_0x561e19[_0x004d('0x68')]||0x1;return;}if(_[_0x004d('0x67')](_0x561e19[_0x004d('0x68')])||_0x561e19['min_internal']===_0x30fe6a){_0x1fb1ea[_0x004d('0x62')]=_0x30fe6a+0x1;return;}if(_0x561e19[_0x004d('0x68')]>_0x30fe6a){_0x1fb1ea[_0x004d('0x62')]=_0x561e19[_0x004d('0x68')];return;}return db[_0x004d('0x69')][_0x004d('0x3d')](_0x004d('0x6a'),{'type':db[_0x004d('0x69')][_0x004d('0x6b')][_0x004d('0x6c')]})[_0x004d('0x13')](function(_0x3d3d81){if(_0x3d3d81&&_0x3d3d81[_0x004d('0x48')]){for(var _0x4f2b38=0x0,_0x123f84=_0x3d3d81[_0x004d('0x48')];_0x4f2b38<_0x123f84&&_['isNil'](_0x1fb1ea[_0x004d('0x62')]);_0x4f2b38++){if(_0x561e19[_0x004d('0x68')]<=_0x3d3d81[_0x4f2b38][_0x004d('0x6d')]){_0x1fb1ea[_0x004d('0x62')]=_0x3d3d81[_0x4f2b38][_0x004d('0x6d')];}else if(_0x561e19[_0x004d('0x68')]>_0x3d3d81[_0x4f2b38][_0x004d('0x6d')]&&_0x561e19[_0x004d('0x68')]<=_0x3d3d81[_0x4f2b38]['to']){_0x1fb1ea[_0x004d('0x62')]=_0x561e19['min_internal'];}}}if(_[_0x004d('0x67')](_0x1fb1ea['internal'])){_0x1fb1ea[_0x004d('0x62')]=_0x30fe6a+0x1;}return _0xf365ad(_0x1fb1ea);});});})[_0x004d('0x51')](function(_0x136ff0){_0xac51d2(_0x136ff0);});});}function updateUser(_0x2e643d){return new Promise(function(_0x133749,_0x10bdc5){try{if(_0x2e643d[_0x004d('0x6e')]){_0x2e643d[_0x004d('0x6f')]=_0x2e643d[_0x004d('0x62')];_0x2e643d[_0x004d('0x70')]={'mailbox':_0x2e643d[_0x004d('0x62')],'password':_0x2e643d[_0x004d('0x57')],'fullname':_0x2e643d[_0x004d('0x71')],'email':_0x2e643d[_0x004d('0x72')]};}if(_0x2e643d[_0x004d('0x29')]===_0x004d('0x26')){if(!_0x2e643d[_0x004d('0x73')])_0x2e643d[_0x004d('0x73')]=[_0x004d('0x74'),_0x004d('0x75'),_0x004d('0x76'),_0x004d('0x77'),_0x004d('0x78'),'104','105','106',_0x004d('0x79'),'108',_0x004d('0x7a'),_0x004d('0x7b'),_0x004d('0x7c'),_0x004d('0x7d'),_0x004d('0x7e')];}_0x133749(_0x2e643d);}catch(_0x2f4edb){_0x10bdc5(_0x2f4edb);}});}exports[_0x004d('0x7f')]=function(_0x51c3b3,_0xce2a5e){if(_0x51c3b3[_0x004d('0x2b')][_0x004d('0x29')]===_0x004d('0x26'))throw new Error('Unauthorized');if(_0x51c3b3[_0x004d('0x5c')][_0x004d('0x29')]==='user'&&_0x51c3b3['user']['role']!==_0x004d('0x2a')){throw new Error(_0x004d('0x80'));}if(_0x51c3b3[_0x004d('0x5c')][_0x004d('0x29')]===_0x004d('0x2a')&&_0x51c3b3[_0x004d('0x2b')]['role']!==_0x004d('0x2a')){throw new Error(_0x004d('0x81'));}return licenseUtil[_0x004d('0x82')]([_0x51c3b3[_0x004d('0x5c')]])[_0x004d('0x13')](function(){return validateUser(_0x51c3b3['body']);})[_0x004d('0x13')](function(_0x42687f){return updateUser(_0x42687f)[_0x004d('0x13')](function(_0x2fbdc3){if(_0x2fbdc3['role']==='admin'){_0x2fbdc3[_0x004d('0x83')]=_0x51c3b3[_0x004d('0x2b')]['settingsEnabled'];delete _0x2fbdc3[_0x004d('0x84')];}return _0x2fbdc3;});})[_0x004d('0x13')](function(_0x45a04d){return db[_0x004d('0x37')]['create'](_0x45a04d,{'include':[{'model':db[_0x004d('0x70')],'as':_0x004d('0x70')}]});})[_0x004d('0x13')](function(_0x3df689){if(_0x51c3b3[_0x004d('0x5c')][_0x004d('0x29')]===_0x004d('0x2b'))return _0x3df689;if(_0x51c3b3[_0x004d('0x2b')]['role']!==_0x004d('0x2b'))return _0x3df689;return db['UserProfileSection'][_0x004d('0x31')]({'where':{'name':_0x3df689['role']===_0x004d('0x26')?_0x004d('0x85'):'Telephones','userProfileId':_0x51c3b3[_0x004d('0x2b')]['userProfileId']},'raw':!![]})[_0x004d('0x13')](function(_0x5a57c2){if(!_0x5a57c2||_0x5a57c2[_0x004d('0x86')]!=0x0)return _0x3df689;return db[_0x004d('0x33')]['create']({'name':_0x3df689[_0x004d('0x32')],'resourceId':_0x3df689['id'],'type':_0x5a57c2[_0x004d('0x32')],'sectionId':_0x5a57c2['id']},{})[_0x004d('0x13')](function(){return _0x3df689;});})[_0x004d('0x51')](function(_0x86d5f7){logger[_0x004d('0x19')](_0x004d('0x87'),_0x86d5f7);throw _0x86d5f7;});})[_0x004d('0x13')](respondWithResult(_0xce2a5e,0xc9))[_0x004d('0x51')](handleError(_0xce2a5e,null));};exports[_0x004d('0x88')]=function(_0x45bb11,_0x59cf96){var _0x31f242=_0x45bb11[_0x004d('0x5c')];var _0x5ddd27=[];if(_0x45bb11[_0x004d('0x2b')][_0x004d('0x29')]===_0x004d('0x26'))throw new Error(_0x004d('0x89'));if(_[_0x004d('0x8a')](_0x31f242,[_0x004d('0x29'),_0x004d('0x2b')])&&_0x45bb11[_0x004d('0x2b')][_0x004d('0x29')]!=='admin'){throw new Error(_0x004d('0x80'));}if(_['some'](_0x31f242,[_0x004d('0x29'),_0x004d('0x2a')])&&_0x45bb11[_0x004d('0x2b')][_0x004d('0x29')]!==_0x004d('0x2a')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x004d('0x82')](_0x31f242)[_0x004d('0x13')](function(){return validateUser(_0x31f242[0x0]);})['then'](function(){for(var _0x59dfe4=0x1;_0x59dfe4<_0x31f242['length'];_0x59dfe4++){var _0x15be80=_0x31f242[_0x59dfe4-0x1]['internal'];if(!_0x31f242[_0x59dfe4][_0x004d('0x62')])_0x31f242[_0x59dfe4][_0x004d('0x62')]=_0x15be80+0x1;_0x5ddd27[_0x004d('0x44')](validateUser(_0x31f242[_0x59dfe4]));}return Promise[_0x004d('0x50')](_0x5ddd27);})['then'](function(){_0x5ddd27=[];for(var _0x1e5ebd=0x0;_0x1e5ebd<_0x31f242[_0x004d('0x48')];_0x1e5ebd++){_0x5ddd27[_0x004d('0x44')](updateUser(_0x31f242[_0x1e5ebd]));}return Promise[_0x004d('0x50')](_0x5ddd27);})[_0x004d('0x13')](function(){_0x5ddd27=_0x31f242[_0x004d('0x2f')](function(_0x42e651){return db[_0x004d('0x37')][_0x004d('0x7f')](_0x42e651,{'include':[{'model':db[_0x004d('0x70')],'as':'VoiceMail'}]})[_0x004d('0x13')](function(_0x14e3ea){_0x42e651['id']=_0x14e3ea['id'];return _0x42e651;});});return Promise['all'](_0x5ddd27);})[_0x004d('0x13')](function(_0x1115ce){if(_0x45bb11[_0x004d('0x5c')][_0x004d('0x29')]===_0x004d('0x2b'))return _0x1115ce;if(_0x45bb11[_0x004d('0x2b')][_0x004d('0x29')]!=='user')return _0x1115ce;var _0x1cfa55=_[_0x004d('0x8a')](_0x1115ce,function(_0x40e966){return _0x40e966[_0x004d('0x29')]==='agent'||_0x40e966[_0x004d('0x29')]===_0x004d('0x2d');});if(!_0x1cfa55)return _0x1115ce;return db['UserProfileSection'][_0x004d('0x45')]({'where':{'name':{'$or':['Agents',_0x004d('0x2c')]},'userProfileId':_0x45bb11[_0x004d('0x2b')]['userProfileId']},'raw':!![]})[_0x004d('0x13')](function(_0x2245a4){if(_['isEmpty'](_0x2245a4)||!_[_0x004d('0x8a')](_0x2245a4,[_0x004d('0x86'),0x0]))return _0x1115ce;_0x5ddd27=[];var _0x14344d=_(_0x2245a4)[_0x004d('0x2f')](function(_0x48fc8d){if(_0x48fc8d['autoAssociation']===0x1)return;return _0x48fc8d[_0x004d('0x32')]===_0x004d('0x85')?_0x004d('0x26'):_0x004d('0x2d');})[_0x004d('0x8b')]()[_0x004d('0x30')]();for(var _0x5a1411=0x0;_0x5a1411<_0x1115ce[_0x004d('0x48')];_0x5a1411++){if(!_[_0x004d('0x39')](_0x14344d,_0x1115ce[_0x5a1411][_0x004d('0x29')]))return;var _0x20f77a=_0x1115ce[_0x5a1411]['role']===_0x004d('0x26')?_0x004d('0x85'):_0x004d('0x2c');_0x5ddd27[_0x004d('0x44')](db[_0x004d('0x33')][_0x004d('0x7f')]({'name':_0x1115ce[_0x5a1411]['name'],'resourceId':_0x1115ce[_0x5a1411]['id'],'type':_0x20f77a,'sectionId':_[_0x004d('0x31')](_0x2245a4,[_0x004d('0x32'),_0x20f77a])['id']},{}));}return Promise['all'](_0x5ddd27);});})['then'](respondWithResult(_0x59cf96,0xc9))[_0x004d('0x51')](handleError(_0x59cf96,null));};exports[_0x004d('0x8c')]=function(_0x24d4bd,_0x1b1bab){if(_0x24d4bd['body']['id']){delete _0x24d4bd[_0x004d('0x5c')]['id'];}return db[_0x004d('0x37')][_0x004d('0x31')]({'where':{'id':_0x24d4bd[_0x004d('0x5d')]['id']}})[_0x004d('0x13')](function(_0x1301f7){if(!_0x1301f7)return null;if(_0x1301f7['id']===_0x24d4bd['user']['id']){if(!_0x24d4bd[_0x004d('0x5c')][_0x004d('0x8d')]||!_0x24d4bd['body'][_0x004d('0x8e')]){throw new db[(_0x004d('0x8f'))][(_0x004d('0x90'))](_0x004d('0x91'));}if(!_0x1301f7[_0x004d('0x92')](_0x24d4bd[_0x004d('0x5c')][_0x004d('0x8d')])){throw new db[(_0x004d('0x8f'))][(_0x004d('0x90'))](_0x004d('0x93'));}if(_0x24d4bd[_0x004d('0x5c')][_0x004d('0x8d')]===_0x24d4bd['body'][_0x004d('0x8e')]){throw new db[(_0x004d('0x8f'))][(_0x004d('0x90'))](_0x004d('0x94'));}}else if(_0x24d4bd['user']['role']===_0x004d('0x2a')){if(!_0x24d4bd[_0x004d('0x5c')][_0x004d('0x8e')]){throw new db[(_0x004d('0x8f'))]['ValidationError'](_0x004d('0x95'));}}else if(_0x24d4bd[_0x004d('0x2b')][_0x004d('0x29')]===_0x004d('0x2b')){if(!_0x24d4bd[_0x004d('0x5c')][_0x004d('0x8e')]){throw new db['Sequelize'][(_0x004d('0x90'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x1301f7[_0x004d('0x29')]!==_0x004d('0x26')){throw new db[(_0x004d('0x8f'))]['ValidationError'](_0x004d('0x89'));}}else{throw new db[(_0x004d('0x8f'))][(_0x004d('0x90'))](_0x004d('0x89'));}return _0x1301f7;})['then'](handleEntityNotFound(_0x1b1bab,null))[_0x004d('0x13')](function(_0x4eb357){return db[_0x004d('0x63')]['findOne']({'attributes':['id',_0x004d('0x65'),_0x004d('0x96'),'passwordHistoryLimit']})['then'](function(_0x6a98e6){if(_0x6a98e6[_0x004d('0x65')])authService[_0x004d('0x66')](_0x24d4bd[_0x004d('0x5c')][_0x004d('0x8e')]);if(!_0x6a98e6['enforcePasswordHistory']||!_0x4eb357[_0x004d('0x97')])return _0x4eb357;authService[_0x004d('0x98')](_0x24d4bd[_0x004d('0x5c')]['newPassword'],_0x4eb357[_0x004d('0x97')],_0x6a98e6[_0x004d('0x99')]);return _0x4eb357;})[_0x004d('0x13')](saveUpdates({'password':_0x24d4bd[_0x004d('0x5c')][_0x004d('0x8e')],'passwordResetAt':_0x24d4bd[_0x004d('0x2b')]['id']==_0x24d4bd['params']['id']?moment():null,'previousPasswords':authService[_0x004d('0x9a')](_0x24d4bd[_0x004d('0x5c')]['newPassword'],_0x4eb357[_0x004d('0x97')])},null));})['then'](respondWithResult(_0x1b1bab,null))[_0x004d('0x51')](handleError(_0x1b1bab,null));};exports[_0x004d('0x9b')]=function(_0x149f4c,_0x42dde0){var _0x5a4238=_0x149f4c['body'][_0x004d('0x9c')];return db[_0x004d('0x37')][_0x004d('0x31')]({'where':{'id':_0x149f4c[_0x004d('0x5d')]['id']},'attributes':['id','name',_0x004d('0x29'),'online','loginInPause','voicePause',_0x004d('0x9d')]})[_0x004d('0x13')](handleEntityNotFound(_0x42dde0,null))['then'](function(_0x2105be){if(_0x2105be){if(!utils[_0x004d('0x9e')](_0x5a4238)){throw new db[(_0x004d('0x8f'))][(_0x004d('0x90'))](_0x004d('0x9f'));}return _0x2105be[_0x004d('0xa0')+_[_0x004d('0xa1')](_0x5a4238[_0x004d('0xa2')]())+_0x004d('0xa3')](_0x149f4c[_0x004d('0x5c')][_0x004d('0x60')],{'penalty':_0x149f4c[_0x004d('0x5c')][_0x004d('0xa4')]||0x0})[_0x004d('0xa5')](function(_0x5bdd20){for(var _0xd991b6=0x0;_0xd991b6<_0x149f4c[_0x004d('0x5c')]['ids'][_0x004d('0x48')];_0xd991b6+=0x1){var _0x59b2f6={'UserId':Number(_0x149f4c[_0x004d('0x5d')]['id'])};_0x59b2f6[_['capitalize'](_0x5a4238[_0x004d('0xa2')]())+'QueueId']=Number(_0x149f4c[_0x004d('0x5c')]['ids'][_0xd991b6]);socket[_0x004d('0xa6')](_0x004d('0x2b')+_[_0x004d('0xa1')](_0x5a4238[_0x004d('0xa2')]())+_0x004d('0xa7'),_0x59b2f6);}return _0x5bdd20;})[_0x004d('0x13')](function(){if(_0x5a4238===_0x004d('0xa8')){return db[_0x004d('0xa9')][_0x004d('0x45')]({'where':{'id':_0x149f4c['body']['ids']||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x1bd59d){var _0x4fdc02=_0x2105be[_0x004d('0x28')]({'plain':!![]});var _0x156f24=[];if(_0x5a4238==='voice'&&_0x4fdc02[_0x004d('0x29')]===_0x004d('0x26')&&_0x4fdc02[_0x004d('0xaa')]){for(let _0x948020=0x0;_0x948020<_0x1bd59d[_0x004d('0x48')];_0x948020+=0x1){_0x156f24[_0x004d('0x44')]({'membername':_0x4fdc02[_0x004d('0x32')],'UserId':_0x4fdc02['id'],'queue_name':_0x1bd59d[_0x948020][_0x004d('0x32')],'VoiceQueueId':_0x1bd59d[_0x948020]['id'],'interface':_[_0x004d('0x67')](_0x4fdc02[_0x004d('0x9d')])?util['format']('SIP/%s',_0x4fdc02[_0x004d('0x32')]):_0x4fdc02[_0x004d('0x9d')],'paused':_0x4fdc02['voicePause']||![],'penalty':_0x149f4c[_0x004d('0x5c')][_0x004d('0xa4')]||0x0});}return Promise[_0x004d('0x50')](_0x156f24[_0x004d('0x2f')](function(_0x6bcc85){return db['UserVoiceQueueRt']['upsert'](_0x6bcc85);}));}return _0x2105be;});}})['then'](respondWithStatusCode(_0x42dde0,null))['catch'](handleError(_0x42dde0,null));};exports[_0x004d('0xab')]=function(_0x2c870f,_0x1f0eb7){var _0x359eec,_0x49734f;return db['User'][_0x004d('0x31')]({'where':{'id':_0x2c870f[_0x004d('0x5d')]['id']},'attributes':['id',_0x004d('0x32'),_0x004d('0x29')]})['then'](handleEntityNotFound(_0x1f0eb7,null))[_0x004d('0x13')](function(_0x2b9af5){if(_0x2b9af5){_0x359eec=_0x2b9af5;if(!_0x2c870f[_0x004d('0x3d')][_0x004d('0x9c')]||!utils[_0x004d('0x9e')](_0x2c870f[_0x004d('0x3d')][_0x004d('0x9c')])){throw new db[(_0x004d('0x8f'))][(_0x004d('0x90'))](_0x004d('0x9f'));}return _0x2b9af5[_0x004d('0xac')+_['capitalize'](_0x2c870f[_0x004d('0x3d')][_0x004d('0x9c')][_0x004d('0xa2')]())+'Queues'](_0x2c870f[_0x004d('0x3d')]['ids']);}})[_0x004d('0x13')](function(_0x3605b0){if(_['isArray'](_0x2c870f['query'][_0x004d('0x60')])){for(var _0x1043ed=0x0;_0x1043ed<_0x2c870f[_0x004d('0x3d')]['ids'][_0x004d('0x48')];_0x1043ed+=0x1){_0x49734f={'UserId':Number(_0x2c870f[_0x004d('0x5d')]['id'])};_0x49734f[_[_0x004d('0xa1')](_0x2c870f[_0x004d('0x3d')]['channel'][_0x004d('0xa2')]())+_0x004d('0xad')]=Number(_0x2c870f[_0x004d('0x3d')]['ids'][_0x1043ed]);socket[_0x004d('0xa6')]('user'+_[_0x004d('0xa1')](_0x2c870f[_0x004d('0x3d')][_0x004d('0x9c')][_0x004d('0xa2')]())+'Queue:remove',_0x49734f);}}else{_0x49734f={'UserId':Number(_0x2c870f[_0x004d('0x5d')]['id'])};_0x49734f[_[_0x004d('0xa1')](_0x2c870f[_0x004d('0x3d')][_0x004d('0x9c')][_0x004d('0xa2')]())+_0x004d('0xad')]=Number(_0x2c870f[_0x004d('0x3d')][_0x004d('0x60')]);socket[_0x004d('0xa6')](_0x004d('0x2b')+_[_0x004d('0xa1')](_0x2c870f['query'][_0x004d('0x9c')][_0x004d('0xa2')]())+_0x004d('0xae'),_0x49734f);}return _0x3605b0;})[_0x004d('0x13')](function(){if(_0x2c870f['query'][_0x004d('0x9c')]===_0x004d('0xa8')){return db[_0x004d('0xaf')][_0x004d('0xb0')]({'where':{'UserId':_0x2c870f[_0x004d('0x5d')]['id'],'VoiceQueueId':_0x2c870f['query']['ids']},'individualHooks':!![]})[_0x004d('0x13')](function(){return _0x359eec;});}return _0x359eec;})[_0x004d('0x13')](respondWithStatusCode(_0x1f0eb7,null))[_0x004d('0x51')](handleError(_0x1f0eb7,null));};exports['addAvatar']=function(_0x4c0ce6,_0x14a626){_0x4c0ce6[_0x004d('0x5c')][_0x004d('0xb1')]=_0x4c0ce6['file']['filename'];return db[_0x004d('0x37')][_0x004d('0x31')]({'where':{'id':_0x4c0ce6[_0x004d('0x5d')]['id']}})[_0x004d('0x13')](handleEntityNotFound(_0x14a626,null))[_0x004d('0x13')](saveUpdates(_0x4c0ce6['body'],null))['then'](respondWithResult(_0x14a626,null))[_0x004d('0x51')](handleError(_0x14a626,null));};exports['getAvatar']=function(_0x3b5e08,_0xc3f03a){var _0x221f58=path[_0x004d('0xb2')](config[_0x004d('0xb3')],'server/files/images/logos/default_profile.png');return db['User']['find']({'where':{'id':_0x3b5e08[_0x004d('0x5d')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0xc3f03a,null))[_0x004d('0x13')](function(_0x562a0e){if(_0x562a0e){if(_[_0x004d('0x67')](_0x562a0e[_0x004d('0xb1')])){return _0xc3f03a['download'](_0x221f58);}else{if(!fs['existsSync'](path['join'](config['root'],'server/files/images/',_0x562a0e[_0x004d('0xb1')]))){return _0xc3f03a[_0x004d('0xb4')](_0x221f58);}return _0xc3f03a[_0x004d('0xb4')](path[_0x004d('0xb2')](config[_0x004d('0xb3')],'server/files/images/',_0x562a0e[_0x004d('0xb1')]));}}})['catch'](handleError(_0xc3f03a,null));};exports['getOpenTabs']=function(_0x5c5ce9,_0x81ac40){return db[_0x004d('0x37')][_0x004d('0x31')]({'where':{'id':_0x5c5ce9['params']['id']},'attributes':['id']})[_0x004d('0x13')](handleEntityNotFound(_0x81ac40,null))[_0x004d('0x13')](function(_0x212d92){var _0x6bfd70=[];values=_0x212d92['dataValues'];_0x6bfd70[_0x004d('0x44')](get_open_tabs(_0x004d('0x49'),_0x212d92[_0x004d('0x4b')]));_0x6bfd70[_0x004d('0x44')](get_open_tabs(_0x004d('0x4a'),_0x212d92[_0x004d('0x4b')]));_0x6bfd70['push'](get_open_tabs('openchannel',_0x212d92['dataValues']));_0x6bfd70['push'](get_open_tabs(_0x004d('0x4f'),_0x212d92[_0x004d('0x4b')]));_0x6bfd70['push'](get_open_tabs('fax',_0x212d92[_0x004d('0x4b')]));_0x6bfd70['push'](get_open_tabs(_0x004d('0x4d'),_0x212d92['dataValues']));return Promise['all'](_0x6bfd70);})[_0x004d('0x13')](function(_0x1c35d8){if(_0x1c35d8){var _0x1c96b8=_[_0x004d('0x2f')](values[_0x004d('0xb5')],function(_0x4ed4c6){return{'channel':_0x004d('0xb6'),'id':_0x4ed4c6['id'],'createdAt':_0x4ed4c6['createdAt']};});var _0x51c681=_[_0x004d('0x2f')](values['FaxOpenTabs'],function(_0x416539){return{'channel':_0x004d('0xb7'),'id':_0x416539['id'],'createdAt':_0x416539[_0x004d('0xb8')]};});var _0x10a699=_[_0x004d('0x2f')](values[_0x004d('0xb9')],function(_0x2f0917){return{'channel':_0x004d('0xba'),'id':_0x2f0917['id'],'createdAt':_0x2f0917['createdAt']};});var _0x492a9d=_[_0x004d('0x2f')](values['MailOpenTabs'],function(_0x54c5bf){return{'channel':_0x004d('0xbb'),'id':_0x54c5bf['id'],'createdAt':_0x54c5bf['createdAt']};});var _0xcdb67a=_[_0x004d('0x2f')](values[_0x004d('0xbc')],function(_0x1b68be){return{'channel':_0x004d('0xbd'),'id':_0x1b68be['id'],'createdAt':_0x1b68be[_0x004d('0xb8')]};});var _0x3d9fd5=_[_0x004d('0x2f')](values[_0x004d('0xbe')],function(_0x444e59){return{'channel':_0x004d('0xbf'),'id':_0x444e59['id'],'createdAt':_0x444e59[_0x004d('0xb8')]};});var _0x1db921=_[_0x004d('0xc0')](_0x1c96b8,_0x51c681,_0x10a699,_0x492a9d,_0xcdb67a,_0x3d9fd5);var _0x54eec8={'count':_0x1db921[_0x004d('0x48')],'rows':_0x1db921};return _0x54eec8;}else return null;})['then'](respondWithResult(_0x81ac40,null))[_0x004d('0x51')](handleError(_0x81ac40,null));};exports[_0x004d('0xc1')]=function(_0x4b1e8f,_0x5a3ae2){var _0x3f00ef={};var _0x100df5={};var _0x4c9b83;var _0x35f025;return db['User'][_0x004d('0xc2')]({'where':{'id':_0x4b1e8f[_0x004d('0x5d')]['id']}})[_0x004d('0x13')](handleEntityNotFound(_0x5a3ae2,null))[_0x004d('0x13')](function(_0x741033){if(_0x741033){_0x4c9b83=_0x741033;_0x100df5[_0x004d('0x53')]=_['keys'](db[_0x004d('0xc3')]['rawAttributes']);_0x100df5[_0x004d('0x3d')]=_[_0x004d('0x55')](_0x4b1e8f[_0x004d('0x3d')]);_0x100df5['filters']=_['intersection'](_0x100df5[_0x004d('0x53')],_0x100df5['query']);_0x3f00ef['attributes']=_[_0x004d('0x58')](_0x100df5['model'],qs[_0x004d('0x59')](_0x4b1e8f[_0x004d('0x3d')][_0x004d('0x59')]));_0x3f00ef[_0x004d('0x43')]=_0x3f00ef[_0x004d('0x43')]['length']?_0x3f00ef[_0x004d('0x43')]:_0x100df5[_0x004d('0x53')];_0x3f00ef[_0x004d('0xc4')]=qs[_0x004d('0xc5')](_0x4b1e8f['query'][_0x004d('0xc5')]);_0x3f00ef[_0x004d('0x3c')]=qs[_0x004d('0xc6')](_[_0x004d('0xc7')](_0x4b1e8f[_0x004d('0x3d')],_0x100df5[_0x004d('0xc6')]));if(_0x4b1e8f[_0x004d('0x3d')][_0x004d('0x2e')]){_0x3f00ef[_0x004d('0x3c')]=_['merge'](_0x3f00ef[_0x004d('0x3c')],{'$or':_[_0x004d('0x2f')](_0x3f00ef[_0x004d('0x43')],function(_0x637db6){var _0x339e10={};_0x339e10[_0x637db6]={'$like':'%'+_0x4b1e8f[_0x004d('0x3d')]['filter']+'%'};return _0x339e10;})});}_0x3f00ef=_[_0x004d('0x5a')]({},_0x3f00ef,_0x4b1e8f[_0x004d('0x5b')]);return _0x4c9b83[_0x004d('0xc1')](_0x3f00ef);}})[_0x004d('0x13')](function(_0x3797b4){if(_0x3797b4){_0x35f025=_0x3797b4[_0x004d('0x48')];if(_0x4b1e8f[_0x004d('0x3d')][_0x004d('0xc8')](_0x004d('0x3e'))){_0x3f00ef[_0x004d('0x41')]=[{'model':db[_0x004d('0xc9')],'as':_0x004d('0xca'),'required':![]},{'model':db[_0x004d('0xcb')],'as':_0x004d('0xcc'),'attributes':['id',_0x004d('0x32'),_0x004d('0xcd')],'where':_0x4b1e8f[_0x004d('0x3d')][_0x004d('0xce')]?{'id':_0x4b1e8f[_0x004d('0x3d')]['tag']}:undefined,'required':_0x4b1e8f[_0x004d('0x3d')]['tag']?!![]:![]}];}if(!_0x4b1e8f[_0x004d('0x3d')]['hasOwnProperty'](_0x004d('0xcf'))){_0x3f00ef[_0x004d('0x23')]=qs[_0x004d('0x23')](_0x4b1e8f[_0x004d('0x3d')]['limit']);_0x3f00ef['offset']=qs[_0x004d('0x22')](_0x4b1e8f[_0x004d('0x3d')][_0x004d('0x22')]);}return _0x4c9b83['getContacts'](_0x3f00ef);}})[_0x004d('0x13')](function(_0x2f60d2){if(_0x2f60d2){return _0x2f60d2?{'count':_0x35f025,'rows':_0x2f60d2}:null;}})[_0x004d('0x13')](respondWithResult(_0x5a3ae2,null))[_0x004d('0x51')](handleError(_0x5a3ae2,null));};exports['getQueues']=function(_0x421595,_0x49c8da){var _0x498083;var _0x1682a0={};var _0x4b8fbc;return db['User'][_0x004d('0xc2')]({'where':{'id':_0x421595[_0x004d('0x5d')]['id']},'attributes':['id',_0x004d('0x32'),'role']})['then'](handleEntityNotFound(_0x49c8da,null))[_0x004d('0x13')](function(_0x2e9e40){if(!utils[_0x004d('0x9e')](_0x421595[_0x004d('0x3d')][_0x004d('0x9c')])){throw new db[(_0x004d('0x8f'))][(_0x004d('0x90'))](_0x004d('0x9f'));}_0x498083=_0x2e9e40;var _0x492309={};_0x492309['model']=_['keys'](db[_[_0x004d('0xa1')](_0x421595[_0x004d('0x3d')][_0x004d('0x9c')])+_0x004d('0xd0')][_0x004d('0x56')]);_0x492309[_0x004d('0x3d')]=_[_0x004d('0x55')](_0x421595[_0x004d('0x3d')]);_0x492309[_0x004d('0xc6')]=_[_0x004d('0x58')](_0x492309[_0x004d('0x53')],_0x492309[_0x004d('0x3d')]);_0x1682a0[_0x004d('0x43')]=_[_0x004d('0x58')](_0x492309[_0x004d('0x53')],qs[_0x004d('0x59')](_0x421595['query'][_0x004d('0x59')]));_0x1682a0[_0x004d('0x43')]=_0x1682a0[_0x004d('0x43')][_0x004d('0x48')]?_0x1682a0[_0x004d('0x43')]:_0x492309['model'];_0x1682a0[_0x004d('0xc4')]=qs[_0x004d('0xc5')](_0x421595[_0x004d('0x3d')][_0x004d('0xc5')]);_0x1682a0[_0x004d('0x3c')]=qs[_0x004d('0xc6')](_['pick'](_0x421595[_0x004d('0x3d')],_0x492309['filters']));if(_0x421595['query'][_0x004d('0x2e')]){_0x1682a0[_0x004d('0x3c')]=_['merge'](_0x1682a0[_0x004d('0x3c')],{'$or':_[_0x004d('0x2f')](_0x1682a0['attributes'],function(_0x3a59eb){var _0x233f0f={};_0x233f0f[_0x3a59eb]={'$like':'%'+_0x421595[_0x004d('0x3d')][_0x004d('0x2e')]+'%'};return _0x233f0f;})});}_0x1682a0=_[_0x004d('0x5a')]({},_0x1682a0,_0x421595[_0x004d('0x5b')]);switch(_0x498083['role']){case'admin':return db[_[_0x004d('0xa1')](_0x421595[_0x004d('0x3d')][_0x004d('0x9c')])+_0x004d('0xd0')][_0x004d('0x45')](_0x1682a0);case _0x004d('0x2b'):case _0x004d('0x26'):return _0x498083['get'+_['capitalize'](_0x421595[_0x004d('0x3d')]['channel'])+'Queues'](_0x1682a0);default:throw new db[(_0x004d('0x8f'))][(_0x004d('0x90'))](_0x004d('0xd1'));}})['then'](function(_0x6c74e9){_0x4b8fbc=_0x6c74e9[_0x004d('0x48')];if(!_0x421595[_0x004d('0x3d')][_0x004d('0xc8')](_0x004d('0xcf'))){_0x1682a0[_0x004d('0x23')]=qs[_0x004d('0x23')](_0x421595['query'][_0x004d('0x23')]);_0x1682a0['offset']=qs[_0x004d('0x22')](_0x421595[_0x004d('0x3d')]['offset']);}switch(_0x498083[_0x004d('0x29')]){case _0x004d('0x2a'):return db[_['capitalize'](_0x421595[_0x004d('0x3d')][_0x004d('0x9c')])+_0x004d('0xd0')][_0x004d('0x45')](_0x1682a0);case _0x004d('0x2b'):case _0x004d('0x26'):return _0x498083[_0x004d('0x28')+_[_0x004d('0xa1')](_0x421595[_0x004d('0x3d')][_0x004d('0x9c')])+_0x004d('0xa3')](_0x1682a0);}})[_0x004d('0x13')](function(_0x481d51){return{'count':_0x4b8fbc,'rows':_0x481d51};})['then'](respondWithResult(_0x49c8da,null))[_0x004d('0x51')](handleError(_0x49c8da,null));};exports[_0x004d('0xd2')]=function(_0x326fe4,_0x5bc097){var _0x93df4e={};var _0x2e06f6={};var _0x36f91b;var _0x477482;return db[_0x004d('0x37')][_0x004d('0xc2')]({'where':{'id':_0x326fe4[_0x004d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5bc097,null))['then'](function(_0x2705fb){if(_0x2705fb){_0x36f91b=_0x2705fb;_0x2e06f6[_0x004d('0x53')]=_[_0x004d('0x55')](db[_0x004d('0xaf')][_0x004d('0x56')]);_0x2e06f6[_0x004d('0x3d')]=_['keys'](_0x326fe4['query']);_0x2e06f6[_0x004d('0xc6')]=_[_0x004d('0x58')](_0x2e06f6[_0x004d('0x53')],_0x2e06f6[_0x004d('0x3d')]);_0x93df4e[_0x004d('0x43')]=_[_0x004d('0x58')](_0x2e06f6[_0x004d('0x53')],qs['fields'](_0x326fe4[_0x004d('0x3d')][_0x004d('0x59')]));_0x93df4e[_0x004d('0x43')]=_0x93df4e[_0x004d('0x43')][_0x004d('0x48')]?_0x93df4e[_0x004d('0x43')]:_0x2e06f6[_0x004d('0x53')];_0x93df4e[_0x004d('0xc4')]=qs[_0x004d('0xc5')](_0x326fe4[_0x004d('0x3d')]['sort']);_0x93df4e[_0x004d('0x3c')]=qs['filters'](_[_0x004d('0xc7')](_0x326fe4['query'],_0x2e06f6[_0x004d('0xc6')]));if(_0x326fe4['query'][_0x004d('0x2e')]){_0x93df4e[_0x004d('0x3c')]=_['merge'](_0x93df4e[_0x004d('0x3c')],{'$or':_[_0x004d('0x2f')](_0x93df4e[_0x004d('0x43')],function(_0x2e12bd){var _0xda25b2={};_0xda25b2[_0x2e12bd]={'$like':'%'+_0x326fe4[_0x004d('0x3d')]['filter']+'%'};return _0xda25b2;})});}_0x93df4e=_[_0x004d('0x5a')]({},_0x93df4e,_0x326fe4[_0x004d('0x5b')]);return _0x36f91b[_0x004d('0xd2')](_0x93df4e);}})['then'](function(_0x347d55){if(_0x347d55){_0x477482=_0x347d55[_0x004d('0x48')];if(!_0x326fe4['query'][_0x004d('0xc8')](_0x004d('0xcf'))){_0x93df4e[_0x004d('0x23')]=qs[_0x004d('0x23')](_0x326fe4[_0x004d('0x3d')][_0x004d('0x23')]);_0x93df4e['offset']=qs[_0x004d('0x22')](_0x326fe4['query'][_0x004d('0x22')]);}return _0x36f91b['getVoiceQueuesRt'](_0x93df4e);}})['then'](function(_0x562d6a){if(_0x562d6a){return _0x562d6a?{'count':_0x477482,'rows':_0x562d6a}:null;}})[_0x004d('0x13')](respondWithResult(_0x5bc097,null))['catch'](handleError(_0x5bc097,null));};exports[_0x004d('0xd3')]=function(_0x5747c4,_0x4359d6){var _0x443e74={};var _0x5039c4={};var _0x5048c1;var _0x527a70;return db['User'][_0x004d('0xc2')]({'where':{'id':_0x5747c4[_0x004d('0x5d')]['id']}})[_0x004d('0x13')](handleEntityNotFound(_0x4359d6,null))[_0x004d('0x13')](function(_0x5ddc0f){if(_0x5ddc0f){_0x5048c1=_0x5ddc0f;_0x5039c4[_0x004d('0x53')]=_['keys'](db[_0x004d('0xd4')][_0x004d('0x56')]);_0x5039c4['query']=_[_0x004d('0x55')](_0x5747c4['query']);_0x5039c4['filters']=_['intersection'](_0x5039c4[_0x004d('0x53')],_0x5039c4[_0x004d('0x3d')]);_0x443e74[_0x004d('0x43')]=_[_0x004d('0x58')](_0x5039c4[_0x004d('0x53')],qs[_0x004d('0x59')](_0x5747c4[_0x004d('0x3d')][_0x004d('0x59')]));_0x443e74['attributes']=_0x443e74[_0x004d('0x43')][_0x004d('0x48')]?_0x443e74['attributes']:_0x5039c4[_0x004d('0x53')];_0x443e74[_0x004d('0xc4')]=qs[_0x004d('0xc5')](_0x5747c4[_0x004d('0x3d')][_0x004d('0xc5')]);_0x443e74[_0x004d('0x3c')]=qs[_0x004d('0xc6')](_[_0x004d('0xc7')](_0x5747c4[_0x004d('0x3d')],_0x5039c4['filters']));if(_0x5747c4[_0x004d('0x3d')][_0x004d('0x2e')]){_0x443e74[_0x004d('0x3c')]=_[_0x004d('0x5a')](_0x443e74[_0x004d('0x3c')],{'$or':_[_0x004d('0x2f')](_0x443e74[_0x004d('0x43')],function(_0x45f0e9){var _0x30b854={};_0x30b854[_0x45f0e9]={'$like':'%'+_0x5747c4[_0x004d('0x3d')]['filter']+'%'};return _0x30b854;})});}_0x443e74=_['merge']({},_0x443e74,_0x5747c4[_0x004d('0x5b')]);return _0x5048c1[_0x004d('0xd3')](_0x443e74);}})[_0x004d('0x13')](function(_0x4e9aa0){if(_0x4e9aa0){_0x527a70=_0x4e9aa0['length'];if(!_0x5747c4['query'][_0x004d('0xc8')]('nolimit')){_0x443e74[_0x004d('0x23')]=qs[_0x004d('0x23')](_0x5747c4['query'][_0x004d('0x23')]);_0x443e74[_0x004d('0x22')]=qs[_0x004d('0x22')](_0x5747c4[_0x004d('0x3d')][_0x004d('0x22')]);}return _0x5048c1[_0x004d('0xd3')](_0x443e74);}})[_0x004d('0x13')](function(_0x5ea072){if(_0x5ea072){return _0x5ea072?{'count':_0x527a70,'rows':_0x5ea072}:null;}})[_0x004d('0x13')](respondWithResult(_0x4359d6,null))[_0x004d('0x51')](handleError(_0x4359d6,null));};exports[_0x004d('0xd5')]=function(_0x501e54,_0x239ae9){var _0x423491={'raw':!![],'where':{}};var _0x533768={};var _0x4a9276={'count':0x0,'rows':[]};return db['User'][_0x004d('0xc2')]({'where':{'id':_0x501e54[_0x004d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x239ae9,null))[_0x004d('0x13')](function(_0x544b5b){if(_0x544b5b){_0x533768[_0x004d('0x53')]=_['keys'](db['VoiceRecording'][_0x004d('0x56')]);_0x533768[_0x004d('0x3d')]=_[_0x004d('0x55')](_0x501e54[_0x004d('0x3d')]);_0x533768[_0x004d('0xc6')]=_['intersection'](_0x533768[_0x004d('0x53')],_0x533768[_0x004d('0x3d')]);_0x423491[_0x004d('0x43')]=_[_0x004d('0x58')](_0x533768[_0x004d('0x53')],qs[_0x004d('0x59')](_0x501e54[_0x004d('0x3d')][_0x004d('0x59')]));_0x423491[_0x004d('0x43')]=_0x423491[_0x004d('0x43')]['length']?_0x423491[_0x004d('0x43')]:_0x533768[_0x004d('0x53')];if(!_0x501e54[_0x004d('0x3d')][_0x004d('0xc8')]('nolimit')){_0x423491[_0x004d('0x23')]=qs[_0x004d('0x23')](_0x501e54[_0x004d('0x3d')][_0x004d('0x23')]);_0x423491['offset']=qs[_0x004d('0x22')](_0x501e54['query'][_0x004d('0x22')]);}_0x423491[_0x004d('0xc4')]=qs[_0x004d('0xc5')](_0x501e54['query']['sort']);_0x423491[_0x004d('0x3c')]=qs[_0x004d('0xc6')](_[_0x004d('0xc7')](_0x501e54[_0x004d('0x3d')],_0x533768[_0x004d('0xc6')]));_0x423491[_0x004d('0x3c')]['UserId']=_0x544b5b['id'];if(_0x501e54[_0x004d('0x3d')][_0x004d('0x2e')]){_0x423491[_0x004d('0x3c')]=_[_0x004d('0x5a')](_0x423491['where'],{'$or':_[_0x004d('0x2f')](_0x423491[_0x004d('0x43')],function(_0x510906){var _0x5b1bd5={};_0x5b1bd5[_0x510906]={'$like':'%'+_0x501e54[_0x004d('0x3d')][_0x004d('0x2e')]+'%'};return _0x5b1bd5;})});}_0x423491=_[_0x004d('0x5a')]({},_0x423491,_0x501e54['options']);return db[_0x004d('0xd6')][_0x004d('0x21')]({'where':_0x423491[_0x004d('0x3c')]})[_0x004d('0x13')](function(_0x226789){_0x4a9276['count']=_0x226789;if(_0x501e54[_0x004d('0x3d')][_0x004d('0x3e')]){_0x423491[_0x004d('0x41')]=[{'all':!![]}];}return db[_0x004d('0xd6')][_0x004d('0x45')](_0x423491);})['then'](function(_0x5d4c29){_0x4a9276[_0x004d('0x46')]=_0x5d4c29;return _0x4a9276;});}})['then'](respondWithFilteredResult(_0x239ae9,_0x423491))['catch'](handleError(_0x239ae9,null));};exports['getScreenRecordings']=function(_0x4414f4,_0x3ef1d8){var _0x2ccbb5={'raw':!![],'where':{}};var _0x592693={};var _0x488a33={'count':0x0,'rows':[]};return db[_0x004d('0x37')][_0x004d('0xc2')]({'where':{'id':_0x4414f4[_0x004d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3ef1d8,null))[_0x004d('0x13')](function(_0x6d493d){if(_0x6d493d){_0x592693['model']=_[_0x004d('0x55')](db[_0x004d('0xd7')]['rawAttributes']);_0x592693[_0x004d('0x3d')]=_['keys'](_0x4414f4[_0x004d('0x3d')]);_0x592693[_0x004d('0xc6')]=_[_0x004d('0x58')](_0x592693[_0x004d('0x53')],_0x592693[_0x004d('0x3d')]);_0x2ccbb5[_0x004d('0x43')]=_[_0x004d('0x58')](_0x592693[_0x004d('0x53')],qs[_0x004d('0x59')](_0x4414f4[_0x004d('0x3d')]['fields']));_0x2ccbb5['attributes']=_0x2ccbb5[_0x004d('0x43')]['length']?_0x2ccbb5[_0x004d('0x43')]:_0x592693[_0x004d('0x53')];if(!_0x4414f4[_0x004d('0x3d')][_0x004d('0xc8')](_0x004d('0xcf'))){_0x2ccbb5[_0x004d('0x23')]=qs[_0x004d('0x23')](_0x4414f4[_0x004d('0x3d')]['limit']);_0x2ccbb5[_0x004d('0x22')]=qs[_0x004d('0x22')](_0x4414f4[_0x004d('0x3d')][_0x004d('0x22')]);}_0x2ccbb5[_0x004d('0xc4')]=qs[_0x004d('0xc5')](_0x4414f4['query'][_0x004d('0xc5')]);_0x2ccbb5[_0x004d('0x3c')]=qs[_0x004d('0xc6')](_['pick'](_0x4414f4[_0x004d('0x3d')],_0x592693['filters']));_0x2ccbb5['where'][_0x004d('0xd8')]=_0x6d493d['id'];if(_0x4414f4[_0x004d('0x3d')][_0x004d('0x2e')]){_0x2ccbb5[_0x004d('0x3c')]=_[_0x004d('0x5a')](_0x2ccbb5[_0x004d('0x3c')],{'$or':_['map'](_0x2ccbb5[_0x004d('0x43')],function(_0x5039e3){var _0x209539={};_0x209539[_0x5039e3]={'$like':'%'+_0x4414f4[_0x004d('0x3d')][_0x004d('0x2e')]+'%'};return _0x209539;})});}_0x2ccbb5=_['merge']({},_0x2ccbb5,_0x4414f4['options']);return db[_0x004d('0xd7')][_0x004d('0x21')]({'where':_0x2ccbb5[_0x004d('0x3c')]})[_0x004d('0x13')](function(_0x356213){_0x488a33[_0x004d('0x21')]=_0x356213;if(_0x4414f4[_0x004d('0x3d')][_0x004d('0x3e')]){_0x2ccbb5[_0x004d('0x41')]=[{'all':!![]}];}return db[_0x004d('0xd7')][_0x004d('0x45')](_0x2ccbb5);})['then'](function(_0x144eba){_0x488a33[_0x004d('0x46')]=_0x144eba;return _0x488a33;});}})[_0x004d('0x13')](respondWithFilteredResult(_0x3ef1d8,_0x2ccbb5))['catch'](handleError(_0x3ef1d8,null));};exports['getChatInteractions']=function(_0x3b4fec,_0x1b49ce){var _0x2881da={};var _0x34d590={};var _0x42d37a;var _0x43fedf;return db[_0x004d('0x37')][_0x004d('0xc2')]({'where':{'id':_0x3b4fec[_0x004d('0x5d')]['id']}})[_0x004d('0x13')](handleEntityNotFound(_0x1b49ce,null))[_0x004d('0x13')](function(_0x44a14b){if(_0x44a14b){_0x42d37a=_0x44a14b;_0x34d590[_0x004d('0x53')]=_[_0x004d('0x55')](db[_0x004d('0xd9')]['rawAttributes']);_0x34d590[_0x004d('0x3d')]=_[_0x004d('0x55')](_0x3b4fec[_0x004d('0x3d')]);_0x34d590[_0x004d('0xc6')]=_['intersection'](_0x34d590[_0x004d('0x53')],_0x34d590[_0x004d('0x3d')]);_0x2881da['attributes']=_[_0x004d('0x58')](_0x34d590[_0x004d('0x53')],qs['fields'](_0x3b4fec[_0x004d('0x3d')][_0x004d('0x59')]));_0x2881da[_0x004d('0x43')]=_0x2881da[_0x004d('0x43')][_0x004d('0x48')]?_0x2881da[_0x004d('0x43')]:_0x34d590[_0x004d('0x53')];_0x2881da[_0x004d('0xc4')]=qs[_0x004d('0xc5')](_0x3b4fec[_0x004d('0x3d')][_0x004d('0xc5')]);_0x2881da[_0x004d('0x3c')]=qs[_0x004d('0xc6')](_[_0x004d('0xc7')](_0x3b4fec[_0x004d('0x3d')],_0x34d590[_0x004d('0xc6')]));if(_0x3b4fec['query'][_0x004d('0x2e')]){_0x2881da['where']=_[_0x004d('0x5a')](_0x2881da['where'],{'$or':_[_0x004d('0x2f')](_0x2881da[_0x004d('0x43')],function(_0x14707b){var _0x5cf78e={};_0x5cf78e[_0x14707b]={'$like':'%'+_0x3b4fec[_0x004d('0x3d')][_0x004d('0x2e')]+'%'};return _0x5cf78e;})});}_0x2881da=_['merge']({},_0x2881da,_0x3b4fec[_0x004d('0x5b')]);return _0x42d37a[_0x004d('0xda')](_0x2881da);}})[_0x004d('0x13')](function(_0x1a7d40){if(_0x1a7d40){_0x43fedf=_0x1a7d40[_0x004d('0x48')];if(!_0x3b4fec[_0x004d('0x3d')]['hasOwnProperty'](_0x004d('0xcf'))){_0x2881da[_0x004d('0x23')]=qs['limit'](_0x3b4fec['query'][_0x004d('0x23')]);_0x2881da[_0x004d('0x22')]=qs[_0x004d('0x22')](_0x3b4fec[_0x004d('0x3d')][_0x004d('0x22')]);}return _0x42d37a[_0x004d('0xda')](_0x2881da);}})[_0x004d('0x13')](function(_0x2a4766){if(_0x2a4766){return _0x2a4766?{'count':_0x43fedf,'rows':_0x2a4766}:null;}})['then'](respondWithResult(_0x1b49ce,null))['catch'](handleError(_0x1b49ce,null));};exports['getOpenchannelInteractions']=function(_0x2cc2ec,_0x2a88ce){var _0x1af681={};var _0x3ce052={};var _0x453c19;var _0x388f5c;return db[_0x004d('0x37')][_0x004d('0xc2')]({'where':{'id':_0x2cc2ec[_0x004d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2a88ce,null))[_0x004d('0x13')](function(_0x43ff3e){if(_0x43ff3e){_0x453c19=_0x43ff3e;_0x3ce052[_0x004d('0x53')]=_[_0x004d('0x55')](db['OpenchannelInteraction'][_0x004d('0x56')]);_0x3ce052['query']=_['keys'](_0x2cc2ec[_0x004d('0x3d')]);_0x3ce052[_0x004d('0xc6')]=_[_0x004d('0x58')](_0x3ce052[_0x004d('0x53')],_0x3ce052[_0x004d('0x3d')]);_0x1af681['attributes']=_['intersection'](_0x3ce052[_0x004d('0x53')],qs[_0x004d('0x59')](_0x2cc2ec[_0x004d('0x3d')]['fields']));_0x1af681['attributes']=_0x1af681[_0x004d('0x43')][_0x004d('0x48')]?_0x1af681[_0x004d('0x43')]:_0x3ce052[_0x004d('0x53')];_0x1af681[_0x004d('0xc4')]=qs[_0x004d('0xc5')](_0x2cc2ec['query'][_0x004d('0xc5')]);_0x1af681[_0x004d('0x3c')]=qs[_0x004d('0xc6')](_[_0x004d('0xc7')](_0x2cc2ec[_0x004d('0x3d')],_0x3ce052[_0x004d('0xc6')]));if(_0x2cc2ec[_0x004d('0x3d')][_0x004d('0x2e')]){_0x1af681['where']=_[_0x004d('0x5a')](_0x1af681[_0x004d('0x3c')],{'$or':_[_0x004d('0x2f')](_0x1af681[_0x004d('0x43')],function(_0x229c00){var _0x3b5cba={};_0x3b5cba[_0x229c00]={'$like':'%'+_0x2cc2ec[_0x004d('0x3d')][_0x004d('0x2e')]+'%'};return _0x3b5cba;})});}_0x1af681=_[_0x004d('0x5a')]({},_0x1af681,_0x2cc2ec[_0x004d('0x5b')]);return _0x453c19[_0x004d('0xdb')](_0x1af681);}})[_0x004d('0x13')](function(_0xcbe74a){if(_0xcbe74a){_0x388f5c=_0xcbe74a['length'];if(!_0x2cc2ec[_0x004d('0x3d')]['hasOwnProperty']('nolimit')){_0x1af681['limit']=qs['limit'](_0x2cc2ec[_0x004d('0x3d')][_0x004d('0x23')]);_0x1af681[_0x004d('0x22')]=qs['offset'](_0x2cc2ec[_0x004d('0x3d')][_0x004d('0x22')]);}return _0x453c19[_0x004d('0xdb')](_0x1af681);}})['then'](function(_0x1357a5){if(_0x1357a5){return _0x1357a5?{'count':_0x388f5c,'rows':_0x1357a5}:null;}})[_0x004d('0x13')](respondWithResult(_0x2a88ce,null))[_0x004d('0x51')](handleError(_0x2a88ce,null));};exports[_0x004d('0xdc')]=function(_0x564e9,_0x453a89){var _0x121ec1={'raw':!![],'where':{}};var _0x21b862={};var _0x916f4e={'count':0x0,'rows':[]};return db[_0x004d('0x37')][_0x004d('0xc2')]({'where':{'id':_0x564e9[_0x004d('0x5d')]['id']}})[_0x004d('0x13')](handleEntityNotFound(_0x453a89,null))['then'](function(_0x4d5f8a){if(_0x4d5f8a){_0x21b862['model']=_[_0x004d('0x55')](db['MailInteraction'][_0x004d('0x56')]);_0x21b862[_0x004d('0x3d')]=_[_0x004d('0x55')](_0x564e9[_0x004d('0x3d')]);_0x21b862['filters']=_[_0x004d('0x58')](_0x21b862[_0x004d('0x53')],_0x21b862[_0x004d('0x3d')]);_0x121ec1['attributes']=_['intersection'](_0x21b862[_0x004d('0x53')],qs[_0x004d('0x59')](_0x564e9[_0x004d('0x3d')][_0x004d('0x59')]));_0x121ec1[_0x004d('0x43')]=_0x121ec1[_0x004d('0x43')]['length']?_0x121ec1[_0x004d('0x43')]:_0x21b862[_0x004d('0x53')];if(!_0x564e9[_0x004d('0x3d')][_0x004d('0xc8')](_0x004d('0xcf'))){_0x121ec1[_0x004d('0x23')]=qs[_0x004d('0x23')](_0x564e9[_0x004d('0x3d')]['limit']);_0x121ec1[_0x004d('0x22')]=qs['offset'](_0x564e9[_0x004d('0x3d')][_0x004d('0x22')]);}_0x121ec1[_0x004d('0xc4')]=qs[_0x004d('0xc5')](_0x564e9['query'][_0x004d('0xc5')]);_0x121ec1[_0x004d('0x3c')]=qs[_0x004d('0xc6')](_[_0x004d('0xc7')](_0x564e9[_0x004d('0x3d')],_0x21b862[_0x004d('0xc6')]));_0x121ec1[_0x004d('0x3c')][_0x004d('0xd8')]=_0x4d5f8a['id'];if(_0x564e9[_0x004d('0x3d')]['filter']){_0x121ec1['where']=_['merge'](_0x121ec1[_0x004d('0x3c')],{'$or':_[_0x004d('0x2f')](_0x121ec1[_0x004d('0x43')],function(_0x2e9b15){var _0x15f6e1={};_0x15f6e1[_0x2e9b15]={'$like':'%'+_0x564e9[_0x004d('0x3d')][_0x004d('0x2e')]+'%'};return _0x15f6e1;})});}_0x121ec1=_[_0x004d('0x5a')]({},_0x121ec1,_0x564e9['options']);return db[_0x004d('0xdd')]['count']({'where':_0x121ec1['where']})[_0x004d('0x13')](function(_0x11780d){_0x916f4e[_0x004d('0x21')]=_0x11780d;if(_0x564e9[_0x004d('0x3d')]['includeAll']){_0x121ec1[_0x004d('0x41')]=[{'all':!![]}];}return db[_0x004d('0xdd')][_0x004d('0x45')](_0x121ec1);})[_0x004d('0x13')](function(_0x323cf7){_0x916f4e[_0x004d('0x46')]=_0x323cf7;return _0x916f4e;});}})[_0x004d('0x13')](respondWithFilteredResult(_0x453a89,_0x121ec1))[_0x004d('0x51')](handleError(_0x453a89,null));};exports[_0x004d('0xde')]=function(_0x43fdef,_0x38701e){var _0x3e8a0e={};var _0x379156={};var _0x7dcc13;var _0xe3f41b;return db[_0x004d('0x37')]['findOne']({'where':{'id':_0x43fdef['params']['id']}})[_0x004d('0x13')](handleEntityNotFound(_0x38701e,null))['then'](function(_0x1c3288){if(_0x1c3288){_0x7dcc13=_0x1c3288;_0x379156['model']=_['keys'](db['SmsInteraction'][_0x004d('0x56')]);_0x379156['query']=_[_0x004d('0x55')](_0x43fdef['query']);_0x379156[_0x004d('0xc6')]=_[_0x004d('0x58')](_0x379156[_0x004d('0x53')],_0x379156[_0x004d('0x3d')]);_0x3e8a0e['attributes']=_['intersection'](_0x379156[_0x004d('0x53')],qs[_0x004d('0x59')](_0x43fdef['query'][_0x004d('0x59')]));_0x3e8a0e[_0x004d('0x43')]=_0x3e8a0e[_0x004d('0x43')][_0x004d('0x48')]?_0x3e8a0e['attributes']:_0x379156[_0x004d('0x53')];_0x3e8a0e['order']=qs[_0x004d('0xc5')](_0x43fdef[_0x004d('0x3d')][_0x004d('0xc5')]);_0x3e8a0e[_0x004d('0x3c')]=qs['filters'](_['pick'](_0x43fdef[_0x004d('0x3d')],_0x379156[_0x004d('0xc6')]));if(_0x43fdef['query'][_0x004d('0x2e')]){_0x3e8a0e[_0x004d('0x3c')]=_[_0x004d('0x5a')](_0x3e8a0e[_0x004d('0x3c')],{'$or':_['map'](_0x3e8a0e[_0x004d('0x43')],function(_0x372ace){var _0x1ba561={};_0x1ba561[_0x372ace]={'$like':'%'+_0x43fdef[_0x004d('0x3d')][_0x004d('0x2e')]+'%'};return _0x1ba561;})});}_0x3e8a0e=_[_0x004d('0x5a')]({},_0x3e8a0e,_0x43fdef['options']);return _0x7dcc13[_0x004d('0xde')](_0x3e8a0e);}})['then'](function(_0x13d8c6){if(_0x13d8c6){_0xe3f41b=_0x13d8c6['length'];if(!_0x43fdef[_0x004d('0x3d')][_0x004d('0xc8')]('nolimit')){_0x3e8a0e[_0x004d('0x23')]=qs[_0x004d('0x23')](_0x43fdef[_0x004d('0x3d')][_0x004d('0x23')]);_0x3e8a0e['offset']=qs[_0x004d('0x22')](_0x43fdef[_0x004d('0x3d')][_0x004d('0x22')]);}return _0x7dcc13['getSmsInteractions'](_0x3e8a0e);}})['then'](function(_0x26afd8){if(_0x26afd8){return _0x26afd8?{'count':_0xe3f41b,'rows':_0x26afd8}:null;}})[_0x004d('0x13')](respondWithResult(_0x38701e,null))[_0x004d('0x51')](handleError(_0x38701e,null));};exports['getFaxInteractions']=function(_0x388d7d,_0x4d7401){var _0x4be94e={};var _0x570cc7={};var _0x1a5853;var _0x5d8678;return db[_0x004d('0x37')]['findOne']({'where':{'id':_0x388d7d['params']['id']}})['then'](handleEntityNotFound(_0x4d7401,null))['then'](function(_0x4506f9){if(_0x4506f9){_0x1a5853=_0x4506f9;_0x570cc7[_0x004d('0x53')]=_[_0x004d('0x55')](db[_0x004d('0xdf')][_0x004d('0x56')]);_0x570cc7[_0x004d('0x3d')]=_[_0x004d('0x55')](_0x388d7d['query']);_0x570cc7['filters']=_['intersection'](_0x570cc7[_0x004d('0x53')],_0x570cc7[_0x004d('0x3d')]);_0x4be94e[_0x004d('0x43')]=_[_0x004d('0x58')](_0x570cc7['model'],qs[_0x004d('0x59')](_0x388d7d[_0x004d('0x3d')][_0x004d('0x59')]));_0x4be94e[_0x004d('0x43')]=_0x4be94e[_0x004d('0x43')][_0x004d('0x48')]?_0x4be94e[_0x004d('0x43')]:_0x570cc7['model'];_0x4be94e['order']=qs[_0x004d('0xc5')](_0x388d7d[_0x004d('0x3d')][_0x004d('0xc5')]);_0x4be94e[_0x004d('0x3c')]=qs[_0x004d('0xc6')](_[_0x004d('0xc7')](_0x388d7d[_0x004d('0x3d')],_0x570cc7[_0x004d('0xc6')]));if(_0x388d7d[_0x004d('0x3d')][_0x004d('0x2e')]){_0x4be94e[_0x004d('0x3c')]=_[_0x004d('0x5a')](_0x4be94e[_0x004d('0x3c')],{'$or':_[_0x004d('0x2f')](_0x4be94e['attributes'],function(_0x5831fb){var _0x45853c={};_0x45853c[_0x5831fb]={'$like':'%'+_0x388d7d[_0x004d('0x3d')][_0x004d('0x2e')]+'%'};return _0x45853c;})});}_0x4be94e=_[_0x004d('0x5a')]({},_0x4be94e,_0x388d7d[_0x004d('0x5b')]);return _0x1a5853['getFaxInteractions'](_0x4be94e);}})[_0x004d('0x13')](function(_0x32ab1c){if(_0x32ab1c){_0x5d8678=_0x32ab1c[_0x004d('0x48')];if(!_0x388d7d['query']['hasOwnProperty']('nolimit')){_0x4be94e['limit']=qs['limit'](_0x388d7d['query'][_0x004d('0x23')]);_0x4be94e[_0x004d('0x22')]=qs[_0x004d('0x22')](_0x388d7d[_0x004d('0x3d')]['offset']);}return _0x1a5853['getFaxInteractions'](_0x4be94e);}})[_0x004d('0x13')](function(_0x16642a){if(_0x16642a){return _0x16642a?{'count':_0x5d8678,'rows':_0x16642a}:null;}})['then'](respondWithResult(_0x4d7401,null))[_0x004d('0x51')](handleError(_0x4d7401,null));};exports[_0x004d('0xe0')]=function(_0x3a4085,_0x29d550){var _0x514f47={};var _0x1f9454={};var _0x183d0e;var _0x5e0483;return db[_0x004d('0x37')][_0x004d('0xc2')]({'where':{'id':_0x3a4085[_0x004d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x29d550,null))['then'](function(_0x485569){if(_0x485569){_0x183d0e=_0x485569;_0x1f9454[_0x004d('0x53')]=_[_0x004d('0x55')](db[_0x004d('0xe1')][_0x004d('0x56')]);_0x1f9454[_0x004d('0x3d')]=_[_0x004d('0x55')](_0x3a4085[_0x004d('0x3d')]);_0x1f9454['filters']=_[_0x004d('0x58')](_0x1f9454[_0x004d('0x53')],_0x1f9454['query']);_0x514f47['attributes']=_['intersection'](_0x1f9454[_0x004d('0x53')],qs[_0x004d('0x59')](_0x3a4085[_0x004d('0x3d')][_0x004d('0x59')]));_0x514f47[_0x004d('0x43')]=_0x514f47[_0x004d('0x43')][_0x004d('0x48')]?_0x514f47['attributes']:_0x1f9454[_0x004d('0x53')];_0x514f47['order']=qs[_0x004d('0xc5')](_0x3a4085['query'][_0x004d('0xc5')]);_0x514f47[_0x004d('0x3c')]=qs['filters'](_[_0x004d('0xc7')](_0x3a4085['query'],_0x1f9454['filters']));if(_0x3a4085[_0x004d('0x3d')][_0x004d('0x2e')]){_0x514f47[_0x004d('0x3c')]=_[_0x004d('0x5a')](_0x514f47[_0x004d('0x3c')],{'$or':_[_0x004d('0x2f')](_0x514f47[_0x004d('0x43')],function(_0x1d1830){var _0x4b4d9a={};_0x4b4d9a[_0x1d1830]={'$like':'%'+_0x3a4085[_0x004d('0x3d')][_0x004d('0x2e')]+'%'};return _0x4b4d9a;})});}_0x514f47=_[_0x004d('0x5a')]({},_0x514f47,_0x3a4085['options']);return _0x183d0e[_0x004d('0xe0')](_0x514f47);}})[_0x004d('0x13')](function(_0x1da578){if(_0x1da578){_0x5e0483=_0x1da578['length'];if(!_0x3a4085[_0x004d('0x3d')][_0x004d('0xc8')](_0x004d('0xcf'))){_0x514f47[_0x004d('0x23')]=qs[_0x004d('0x23')](_0x3a4085[_0x004d('0x3d')]['limit']);_0x514f47[_0x004d('0x22')]=qs[_0x004d('0x22')](_0x3a4085[_0x004d('0x3d')][_0x004d('0x22')]);}return _0x183d0e[_0x004d('0xe0')](_0x514f47);}})['then'](function(_0x569d90){if(_0x569d90){return _0x569d90?{'count':_0x5e0483,'rows':_0x569d90}:null;}})['then'](respondWithResult(_0x29d550,null))['catch'](handleError(_0x29d550,null));};exports[_0x004d('0xe2')]=function(_0x3c28ca,_0x5607a9,_0x38be42){var _0x41fb6a;var _0x2998c4;var _0x4173cb;var _0x3a3126=!_[_0x004d('0x67')](_0x3c28ca[_0x004d('0x5d')]['id'])?_0x3c28ca[_0x004d('0x5d')]['id']:!_[_0x004d('0x67')](_0x3c28ca['user']['id'])?_0x3c28ca[_0x004d('0x2b')]['id']:null;return db[_0x004d('0x37')][_0x004d('0x31')]({'where':{'id':_0x3a3126,'role':{'$or':[_0x004d('0x2a'),_0x004d('0x2b'),'agent']}},'attributes':['id',_0x004d('0x32'),_0x004d('0xe3'),_0x004d('0xe4'),_0x004d('0x29'),_0x004d('0x62'),_0x004d('0xe5')]})[_0x004d('0x13')](function(_0x2355a0){if(_0x2355a0){if(_0x2355a0[_0x004d('0x29')]===_0x004d('0x26')){_0x41fb6a=_0x2355a0;if(_0x3c28ca[_0x004d('0x5c')][_0x004d('0x9d')]){_0x4173cb=util[_0x004d('0xe6')](_0x004d('0xe7'),_0x41fb6a[_0x3c28ca[_0x004d('0x5c')]['interface']]);}else if(_0x3c28ca[_0x004d('0x5c')][_0x004d('0xe8')]){_0x4173cb=util[_0x004d('0xe6')](_0x004d('0xe9'),_0x3c28ca[_0x004d('0x5c')]['intrf']);}else{_0x4173cb=util[_0x004d('0xe6')](_0x004d('0xe9'),_0x41fb6a[_0x004d('0x32')]);}socket['to'](util['format'](_0x004d('0xea'),_0x41fb6a[_0x004d('0x32')]))[_0x004d('0xa6')](_0x004d('0xeb'),{'user':{'id':_0x41fb6a['id'],'name':_0x41fb6a[_0x004d('0x32')]},'ip':_0x3c28ca[_0x004d('0xec')][_0x004d('0xed')]||_0x3c28ca[_0x004d('0xee')][_0x004d('0xef')]||_0x3c28ca['socket']['remoteAddress']||_0x3c28ca[_0x004d('0xee')][_0x004d('0xf0')][_0x004d('0xef')]});return db[_0x004d('0xaf')]['destroy']({'where':{'membername':_0x41fb6a[_0x004d('0x32')]},'individualHooks':!![]});}}else{throw new db[(_0x004d('0x8f'))][(_0x004d('0x90'))](_0x004d('0xf1'));}})[_0x004d('0x13')](function(){if(_0x41fb6a){return _0x41fb6a[_0x004d('0xf2')]({'raw':!![]});}})['then'](function(_0x31e558){if(_0x41fb6a){if(_0x31e558){_0x2998c4=_0x31e558;if(_0x2998c4[_0x004d('0x48')]){var _0x3df8e5=_0x2998c4[_0x004d('0x2f')](function(_0x452051){var _0x167cf8={'membername':_0x41fb6a['name'],'UserId':_0x41fb6a['id'],'queue_name':_0x452051[_0x004d('0x32')],'VoiceQueueId':_0x452051['id'],'interface':_0x4173cb,'paused':_0x41fb6a[_0x004d('0xe5')]||![],'penalty':_0x452051[_0x004d('0xf3')]||0x0};return db[_0x004d('0xaf')][_0x004d('0xf4')](_0x167cf8);});return Promise[_0x004d('0x50')](_0x3df8e5);}}}})[_0x004d('0x13')](function(){if(_0x41fb6a){return db[_0x004d('0xf5')][_0x004d('0x45')]({'where':{'membername':_0x41fb6a['name'],'exitAt':null}});}})[_0x004d('0x13')](function(_0x32884b){if(_0x41fb6a){var _0x1850a9=[];_0x32884b['forEach'](function(_0x1f73f7){_0x1850a9['push'](_0x1f73f7[_0x004d('0xf6')]({'exitAt':moment()[_0x004d('0xe6')](_0x004d('0xf7'))}));});return Promise[_0x004d('0x50')](_0x1850a9);}})[_0x004d('0x13')](function(){if(_0x41fb6a){var _0x488d77=[];var _0x491695=[];var _0x41eb3e=utils['getChannels']();var _0x33f38c={'membername':_0x41fb6a[_0x004d('0x32')],'interface':_0x4173cb,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x41fb6a[_0x004d('0x29')],'internal':_0x41fb6a['internal']};_0x41eb3e[_0x004d('0xf8')](function(_0x11507b){_0x488d77[_0x004d('0x44')](_[_0x004d('0x5a')]({'channel':_0x11507b,'type':'LOGIN','data1':_0x3c28ca[_0x004d('0x5c')][_0x004d('0xf9')],'data2':_0x4173cb},_0x33f38c));if(_0x41fb6a['loginInPause']){_0x491695['push'](_['merge']({'channel':_0x11507b,'type':_0x004d('0xfa'),'data1':_0x004d('0xfb')},_0x33f38c));}});return db[_0x004d('0xf5')][_0x004d('0x88')](_0x488d77[_0x004d('0xc0')](_0x491695),{'individualHooks':!![]});}})[_0x004d('0x13')](function(){if(_0x41fb6a){return _0x41fb6a[_0x004d('0xf6')]({'online':!![],'lastLoginAt':moment()[_0x004d('0xe6')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x41fb6a[_0x004d('0xe5')]||![],'mailPause':_0x41fb6a[_0x004d('0xe5')]||![],'chatPause':_0x41fb6a[_0x004d('0xe5')]||![],'faxPause':_0x41fb6a[_0x004d('0xe5')]||![],'smsPause':_0x41fb6a[_0x004d('0xe5')]||![],'openchannelPause':_0x41fb6a[_0x004d('0xe5')]||![],'whatsappPause':_0x41fb6a[_0x004d('0xe5')]||![],'pauseType':_0x41fb6a[_0x004d('0xe5')]?'LOGININPAUSE':null,'interface':_0x4173cb,'lastPauseAt':moment()[_0x004d('0xe6')](_0x004d('0xf7'))});}})[_0x004d('0x13')](function(_0x56b4d9){if(_0x3c28ca[_0x004d('0xfc')]){return _0x38be42();}else{return Promise[_0x004d('0xfd')](_0x56b4d9)[_0x004d('0x13')](respondWithResult(_0x5607a9,null));}})[_0x004d('0x51')](handleError(_0x5607a9,null));};exports['logout']=function(_0x455848,_0x37b20a){var _0x122956;return db['User']['find']({'where':{'id':_0x455848[_0x004d('0x5d')]['id'],'role':_0x004d('0x26')},'attributes':['id','name',_0x004d('0x29')]})[_0x004d('0x13')](handleEntityNotFound(_0x37b20a,null))[_0x004d('0x13')](function(_0x527cfa){if(_0x527cfa){_0x122956=_0x527cfa;return db[_0x004d('0xaf')][_0x004d('0xb0')]({'where':{'membername':_0x122956['name']},'individualHooks':!![]});}})[_0x004d('0x13')](function(){return db[_0x004d('0xf5')][_0x004d('0x45')]({'where':{'membername':_0x122956['name'],'exitAt':null}});})[_0x004d('0x13')](function(_0xf125c1){var _0x4d0bae=[];_0xf125c1[_0x004d('0xf8')](function(_0x38c57b){_0x4d0bae[_0x004d('0x44')](_0x38c57b['update']({'exitAt':moment()[_0x004d('0xe6')](_0x004d('0xf7'))}));});return Promise[_0x004d('0x50')](_0x4d0bae);})[_0x004d('0x13')](function(){return _0x122956['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x004d('0x13')](respondWithResult(_0x37b20a,null))[_0x004d('0x51')](handleError(_0x37b20a,null));};exports[_0x004d('0xfe')]=function(_0x1b9fe7,_0x3d9eee){var _0x76ef39;return db[_0x004d('0xaf')]['update']({'paused':0x1},{'where':{'UserId':_0x1b9fe7[_0x004d('0x5d')]['id']},'individualHooks':!![]})[_0x004d('0x13')](function(){return db[_0x004d('0x37')][_0x004d('0x31')]({'where':{'id':_0x1b9fe7[_0x004d('0x5d')]['id'],'role':_0x004d('0x26')},'attributes':['id',_0x004d('0x32'),_0x004d('0x29'),_0x004d('0x62'),_0x004d('0x9d'),_0x004d('0xaa')]});})[_0x004d('0x13')](handleEntityNotFound(_0x3d9eee,null))['then'](function(_0x2f0d2b){if(_0x2f0d2b){_0x76ef39=_0x2f0d2b;return respondWithRpcPromise(_0x004d('0xff'),_0x004d('0xfe'),{'id':_0x76ef39['id'],'name':_0x76ef39[_0x004d('0x32')],'pause':!![]});}})[_0x004d('0x13')](function(){if(_0x76ef39){return db[_0x004d('0xf5')][_0x004d('0x45')]({'where':{'membername':_0x76ef39['name'],'type':_0x004d('0xfa'),'exitAt':null}});}})[_0x004d('0x13')](function(_0x55cd0e){if(_0x55cd0e[_0x004d('0x48')]){var _0x498767=moment()[_0x004d('0xe6')](_0x004d('0xf7'));for(var _0x592602=0x0,_0x345e4a=_0x55cd0e[_0x004d('0x48')];_0x592602<_0x345e4a;_0x592602++){_0x55cd0e[_0x592602]['updateAttributes']({'exitAt':_0x498767});}}})[_0x004d('0x13')](function(){var _0x222ebe=[];var _0x21b46c=utils[_0x004d('0x100')]();_0x21b46c[_0x004d('0xf8')](function(_0x3ea8d6){_0x222ebe['push']({'channel':_0x3ea8d6,'membername':_0x76ef39[_0x004d('0x32')],'interface':_[_0x004d('0x67')](_0x76ef39['interface'])?util['format'](_0x004d('0xe9'),_0x76ef39['name']):_0x76ef39[_0x004d('0x9d')],'type':_0x004d('0xfa'),'enterAt':moment()[_0x004d('0xe6')](_0x004d('0xf7')),'data1':_0x1b9fe7[_0x004d('0x5c')][_0x004d('0x101')]||'DEFAULT\x20PAUSE','role':_0x76ef39[_0x004d('0x29')],'internal':_0x76ef39['internal']});});return db[_0x004d('0xf5')]['bulkCreate'](_0x222ebe,{'individualHooks':!![]});})[_0x004d('0x13')](function(){return _0x76ef39[_0x004d('0xf6')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1b9fe7['body']['type']||_0x004d('0x102'),'lastPauseAt':moment()[_0x004d('0xe6')](_0x004d('0xf7'))});})[_0x004d('0x13')](respondWithResult(_0x3d9eee,null))[_0x004d('0x51')](handleError(_0x3d9eee,null));};exports['unpause']=function(_0x3743ed,_0x406a3e){if(_0x3743ed['body'][_0x004d('0x9c')]&&!utils[_0x004d('0x9e')](_0x3743ed[_0x004d('0x5c')][_0x004d('0x9c')])){throw new APIBadRequestError(util[_0x004d('0xe6')](_0x004d('0x103'),_0x3743ed['body'][_0x004d('0x9c')]));}return db[_0x004d('0x37')][_0x004d('0x31')]({'where':{'id':_0x3743ed['params']['id']},'attributes':['id','name',_0x004d('0x29'),'internal',_0x004d('0x9d'),_0x004d('0xaa'),_0x004d('0x104'),_0x004d('0x105'),_0x004d('0x106'),_0x004d('0x107'),_0x004d('0x108'),_0x004d('0x109'),'whatsappPause',_0x004d('0x10a'),_0x004d('0x10b')]})[_0x004d('0x13')](function(_0x117a5f){if(!_0x117a5f){throw new APINotFoundError(util[_0x004d('0xe6')](_0x004d('0x10c'),_0x3743ed[_0x004d('0x5d')]['id']));}return _0x117a5f['unpause'](_0x3743ed[_0x004d('0x5c')][_0x004d('0x9c')]);})[_0x004d('0x13')](respondWithResult(_0x406a3e,null))[_0x004d('0x51')](APIHandleError(_0x406a3e));};exports[_0x004d('0x10d')]=function(_0x540aa3,_0x1aecbd){var _0x44222c={};var _0x445523={};var _0x525483;var _0xa581f1;return db['User']['findOne']({'where':{'id':_0x540aa3['params']['id']}})[_0x004d('0x13')](handleEntityNotFound(_0x1aecbd,null))['then'](function(_0x1ba0d0){if(_0x1ba0d0){_0x525483=_0x1ba0d0;_0x445523[_0x004d('0x53')]=_[_0x004d('0x55')](db[_0x004d('0x10e')]['rawAttributes']);_0x445523[_0x004d('0x3d')]=_['keys'](_0x540aa3[_0x004d('0x3d')]);_0x445523[_0x004d('0xc6')]=_[_0x004d('0x58')](_0x445523[_0x004d('0x53')],_0x445523[_0x004d('0x3d')]);_0x44222c['attributes']=_['intersection'](_0x445523[_0x004d('0x53')],qs[_0x004d('0x59')](_0x540aa3[_0x004d('0x3d')][_0x004d('0x59')]));_0x44222c['attributes']=_0x44222c[_0x004d('0x43')][_0x004d('0x48')]?_0x44222c[_0x004d('0x43')]:_0x445523['model'];_0x44222c['order']=qs[_0x004d('0xc5')](_0x540aa3[_0x004d('0x3d')][_0x004d('0xc5')]);_0x44222c['where']=qs[_0x004d('0xc6')](_[_0x004d('0xc7')](_0x540aa3['query'],_0x445523['filters']));if(_0x540aa3[_0x004d('0x3d')][_0x004d('0x2e')]){_0x44222c[_0x004d('0x3c')]=_[_0x004d('0x5a')](_0x44222c[_0x004d('0x3c')],{'$or':_[_0x004d('0x2f')](_0x44222c['attributes'],function(_0x226455){var _0xf3de6f={};_0xf3de6f[_0x226455]={'$like':'%'+_0x540aa3[_0x004d('0x3d')][_0x004d('0x2e')]+'%'};return _0xf3de6f;})});}_0x44222c=_[_0x004d('0x5a')]({},_0x44222c,_0x540aa3[_0x004d('0x5b')]);return _0x525483[_0x004d('0x10d')](_0x44222c);}})[_0x004d('0x13')](function(_0x19bf7f){if(_0x19bf7f){_0xa581f1=_0x19bf7f[_0x004d('0x48')];if(!_0x540aa3[_0x004d('0x3d')]['hasOwnProperty']('nolimit')){_0x44222c[_0x004d('0x23')]=qs[_0x004d('0x23')](_0x540aa3[_0x004d('0x3d')][_0x004d('0x23')]);_0x44222c['offset']=qs['offset'](_0x540aa3[_0x004d('0x3d')][_0x004d('0x22')]);}return _0x525483[_0x004d('0x10d')](_0x44222c);}})[_0x004d('0x13')](function(_0x43f026){if(_0x43f026){return _0x43f026?{'count':_0xa581f1,'rows':_0x43f026}:null;}})[_0x004d('0x13')](respondWithResult(_0x1aecbd,null))[_0x004d('0x51')](handleError(_0x1aecbd,null));};exports[_0x004d('0x10f')]=function(_0x5b4154,_0x129ae2){var _0x3cbfe2=_0x5b4154[_0x004d('0x5d')]['id'];var _0x24e3f5=_0x5b4154['body']?_0x5b4154[_0x004d('0x5c')][_0x004d('0x60')]:null;var _0x2e9896=[];return Promise['resolve']()[_0x004d('0x13')](function(){if(!_0x24e3f5)throw new APIBadRequestError(_0x004d('0x110'));})[_0x004d('0x13')](function(){return db['User']['findOne']({'where':{'id':_0x3cbfe2}});})[_0x004d('0x13')](function(_0x4505d1){if(!_0x4505d1)throw new APINotFoundError(util[_0x004d('0xe6')]('User\x20with\x20id\x20%s\x20not\x20found',_0x5b4154[_0x004d('0x5d')]['id']));return db[_0x004d('0x69')][_0x004d('0x111')](function(_0x2afd3b){return _0x4505d1['addTeams'](_0x24e3f5,{'transaction':_0x2afd3b})[_0x004d('0x13')](function(){return db[_0x004d('0x10e')][_0x004d('0x45')]({'where':{'id':{'$in':_0x24e3f5}}});})[_0x004d('0x13')](function(_0x34b704){var _0x3fe6b4=_[_0x004d('0x2f')](_0x34b704,function(_0x13f212){return _0x13f212['getAssociatedQueues']();});return Promise[_0x004d('0x50')](_0x3fe6b4);})[_0x004d('0x13')](function(_0x54d8c6){_0x2e9896=_[_0x004d('0x112')](_0x54d8c6);var _0x1cf023=_['map'](_0x2e9896,function(_0x53a749){return _0x53a749[_0x004d('0x113')](_0x4505d1['id'],{'transaction':_0x2afd3b});});return Promise[_0x004d('0x50')](_0x1cf023);})[_0x004d('0x13')](function(){if(!_0x4505d1[_0x004d('0xaa')])return;var _0x2a54f2=_['filter'](_0x2e9896,function(_0x2d9ead){return _0x2d9ead[_0x004d('0x114')](_0x004d('0x9c'))===_0x004d('0x115');});var _0x4f9877=_[_0x004d('0x2f')](_0x2a54f2,function(_0x3e076c){return db[_0x004d('0xaf')][_0x004d('0xf4')]({'membername':_0x4505d1['name'],'UserId':_0x4505d1['id'],'queue_name':_0x3e076c['name'],'VoiceQueueId':_0x3e076c['id'],'interface':_[_0x004d('0x67')](_0x4505d1[_0x004d('0x9d')])?util['format']('SIP/%s',_0x4505d1[_0x004d('0x32')]):_0x4505d1[_0x004d('0x9d')],'paused':_0x4505d1[_0x004d('0x104')]||![],'penalty':_0x4505d1['penalty']},{'transaction':_0x2afd3b});});return Promise[_0x004d('0x50')](_0x4f9877);})[_0x004d('0x13')](function(){return db[_0x004d('0x116')][_0x004d('0x45')]({'where':{'teamId':{'$in':_0x24e3f5}}});})[_0x004d('0x13')](function(_0x30bc86){var _0x147f5b=_['map'](_0x30bc86,function(_0x594ab6){return db[_0x004d('0x117')][_0x004d('0x7f')]({'UserId':_0x4505d1['id'],'VoicePrefixId':_0x594ab6[_0x004d('0x118')]},{'transaction':_0x2afd3b});});return Promise[_0x004d('0x50')](_0x147f5b);});});})[_0x004d('0x13')](function(){for(var _0x303d01=0x0;_0x303d01<_0x2e9896[_0x004d('0x48')];_0x303d01++){var _0x24e114=_0x2e9896[_0x303d01][_0x004d('0x114')](_0x004d('0x9c'));var _0x438fcb=_0x24e114+_0x004d('0xad');socket[_0x004d('0xa6')](_0x004d('0x2b')+_0x24e114+_0x004d('0xa7'),{'UserId':_0x3cbfe2,['queueField']:_0x2e9896[_0x303d01]['id']});}})[_0x004d('0x13')](respondWithStatusCode(_0x129ae2,null))[_0x004d('0x51')](APIHandleError(_0x129ae2));};exports[_0x004d('0x119')]=function(_0x27ea23,_0x18a9b4){var _0x5a4177=_0x27ea23[_0x004d('0x5d')]['id'];var _0x233b55=null;if(_0x27ea23['query'][_0x004d('0x60')]){_0x233b55=_[_0x004d('0x11a')](_0x27ea23[_0x004d('0x3d')][_0x004d('0x60')])?_0x27ea23['query'][_0x004d('0x60')]:[_0x27ea23['query'][_0x004d('0x60')]];}var _0x1253fd=[];return Promise['resolve']()[_0x004d('0x13')](function(){if(!_0x233b55)throw new APIBadRequestError(_0x004d('0x11b'));})[_0x004d('0x13')](function(){return db[_0x004d('0x37')][_0x004d('0xc2')]({'where':{'id':_0x5a4177}});})['then'](function(_0x36756d){if(!_0x36756d)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x27ea23[_0x004d('0x5d')]['id']));return db[_0x004d('0x69')][_0x004d('0x111')](function(_0x3fdbbc){return _0x36756d[_0x004d('0x119')](_0x233b55,{'transaction':_0x3fdbbc})[_0x004d('0x13')](function(){return db[_0x004d('0x10e')][_0x004d('0x45')]({'where':{'id':{'$in':_0x233b55}}});})[_0x004d('0x13')](function(_0x1213d9){var _0x24b584=_['map'](_0x1213d9,function(_0x125360){return _0x125360[_0x004d('0x11c')]();});return Promise[_0x004d('0x50')](_0x24b584);})[_0x004d('0x13')](function(_0x3a5850){_0x1253fd=_[_0x004d('0x112')](_0x3a5850);var _0x5a0020=_[_0x004d('0x2f')](_0x1253fd,function(_0x5be2c5){return _0x5be2c5[_0x004d('0x11d')](_0x36756d['id'],{'transaction':_0x3fdbbc});});return Promise[_0x004d('0x50')](_0x5a0020);})[_0x004d('0x13')](function(){if(!_0x36756d[_0x004d('0xaa')])return;var _0x862f6d=_['filter'](_0x1253fd,function(_0x3bb85c){return _0x3bb85c[_0x004d('0x114')](_0x004d('0x9c'))===_0x004d('0x115');});var _0x44f535=_[_0x004d('0x2f')](_0x862f6d,function(_0x1c8877){return db[_0x004d('0xaf')][_0x004d('0xb0')]({'where':{'VoiceQueueId':_0x1c8877['id'],'UserId':_0x36756d['id']},'transaction':_0x3fdbbc});});return Promise['all'](_0x44f535);})[_0x004d('0x13')](function(){return db[_0x004d('0x116')]['findAll']({'where':{'teamId':{'$in':_0x233b55}}});})[_0x004d('0x13')](function(_0x98fd8e){var _0x315f96=_[_0x004d('0x2f')](_0x98fd8e,function(_0x224962){return db[_0x004d('0x117')][_0x004d('0xb0')]({'where':{'UserId':_0x36756d['id'],'VoicePrefixId':_0x224962['VoicePrefixId']}},{'transaction':_0x3fdbbc});});return Promise[_0x004d('0x50')](_0x315f96);});});})[_0x004d('0x13')](function(){for(var _0x18f5bd=0x0;_0x18f5bd<_0x1253fd[_0x004d('0x48')];_0x18f5bd++){var _0x2c0b0b=_0x1253fd[_0x18f5bd]['getDataValue'](_0x004d('0x9c'));var _0x4b44c2=_0x2c0b0b+_0x004d('0xad');socket[_0x004d('0xa6')](_0x004d('0x2b')+_0x2c0b0b+_0x004d('0xae'),{'UserId':_0x5a4177,['queueField']:_0x1253fd[_0x18f5bd]['id']});}})[_0x004d('0x13')](respondWithStatusCode(_0x18a9b4,null))['catch'](APIHandleError(_0x18a9b4));};exports[_0x004d('0x11e')]=function(_0x4157da,_0xdfb273){var _0x170b86={};var _0x6efc51={};var _0x3da8e7;var _0x1589cc;return db[_0x004d('0x37')]['findOne']({'where':{'id':_0x4157da[_0x004d('0x5d')]['id']}})['then'](handleEntityNotFound(_0xdfb273,null))['then'](function(_0x165dc0){if(_0x165dc0){_0x3da8e7=_0x165dc0;_0x6efc51[_0x004d('0x53')]=_['keys'](db[_0x004d('0xc9')][_0x004d('0x56')]);_0x6efc51['query']=_[_0x004d('0x55')](_0x4157da[_0x004d('0x3d')]);_0x6efc51[_0x004d('0xc6')]=_[_0x004d('0x58')](_0x6efc51[_0x004d('0x53')],_0x6efc51[_0x004d('0x3d')]);_0x170b86['attributes']=_[_0x004d('0x58')](_0x6efc51[_0x004d('0x53')],qs[_0x004d('0x59')](_0x4157da[_0x004d('0x3d')]['fields']));_0x170b86[_0x004d('0x43')]=_0x170b86[_0x004d('0x43')][_0x004d('0x48')]?_0x170b86[_0x004d('0x43')]:_0x6efc51[_0x004d('0x53')];_0x170b86[_0x004d('0xc4')]=qs[_0x004d('0xc5')](_0x4157da[_0x004d('0x3d')][_0x004d('0xc5')]);_0x170b86[_0x004d('0x3c')]=qs[_0x004d('0xc6')](_['pick'](_0x4157da['query'],_0x6efc51[_0x004d('0xc6')]));if(_0x4157da[_0x004d('0x3d')][_0x004d('0x2e')]){_0x170b86[_0x004d('0x3c')]=_[_0x004d('0x5a')](_0x170b86[_0x004d('0x3c')],{'$or':_[_0x004d('0x2f')](_0x170b86['attributes'],function(_0x4ede44){var _0x547b17={};_0x547b17[_0x4ede44]={'$like':'%'+_0x4157da[_0x004d('0x3d')][_0x004d('0x2e')]+'%'};return _0x547b17;})});}_0x170b86=_[_0x004d('0x5a')]({},_0x170b86,_0x4157da[_0x004d('0x5b')]);return _0x3da8e7[_0x004d('0x11e')](_0x170b86);}})['then'](function(_0x2b79dd){if(_0x2b79dd){_0x1589cc=_0x2b79dd['length'];if(!_0x4157da[_0x004d('0x3d')][_0x004d('0xc8')]('nolimit')){_0x170b86['limit']=qs['limit'](_0x4157da[_0x004d('0x3d')][_0x004d('0x23')]);_0x170b86[_0x004d('0x22')]=qs[_0x004d('0x22')](_0x4157da[_0x004d('0x3d')][_0x004d('0x22')]);}return _0x3da8e7[_0x004d('0x11e')](_0x170b86);}})[_0x004d('0x13')](function(_0x258a52){if(_0x258a52){return _0x258a52?{'count':_0x1589cc,'rows':_0x258a52}:null;}})[_0x004d('0x13')](respondWithResult(_0xdfb273,null))['catch'](handleError(_0xdfb273,null));};exports['getAgents']=function(_0x436f60,_0x26efd4){var _0x1e06ff={};var _0x45d766={};var _0x1fdbe8;return db['User'][_0x004d('0xc2')]({'where':{'id':_0x436f60[_0x004d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x26efd4,null))[_0x004d('0x13')](function(_0x2756b5){if(_0x2756b5){_0x1fdbe8=_0x2756b5;_0x45d766[_0x004d('0x53')]=_[_0x004d('0x55')](db[_0x004d('0x37')][_0x004d('0x56')]);_0x45d766[_0x004d('0x3d')]=_[_0x004d('0x55')](_0x436f60[_0x004d('0x3d')]);_0x45d766['filters']=_['intersection'](_0x45d766['model'],_0x45d766[_0x004d('0x3d')]);_0x1e06ff[_0x004d('0x43')]=_['intersection'](_0x45d766[_0x004d('0x53')],qs[_0x004d('0x59')](_0x436f60[_0x004d('0x3d')][_0x004d('0x59')]));_0x1e06ff[_0x004d('0x43')]=_0x1e06ff['attributes'][_0x004d('0x48')]?_0x1e06ff['attributes']:_0x45d766[_0x004d('0x53')];_0x1e06ff[_0x004d('0xc4')]=qs[_0x004d('0xc5')](_0x436f60[_0x004d('0x3d')][_0x004d('0xc5')]);_0x1e06ff[_0x004d('0x3c')]=qs[_0x004d('0xc6')](_['pick'](_0x436f60[_0x004d('0x3d')],_0x45d766[_0x004d('0xc6')]));if(_0x436f60[_0x004d('0x3d')][_0x004d('0x2e')]){_0x1e06ff[_0x004d('0x3c')]=_[_0x004d('0x5a')](_0x1e06ff['where'],{'$or':_['map'](_0x1e06ff['attributes'],function(_0x371f66){var _0x570b40={};_0x570b40[_0x371f66]={'$like':'%'+_0x436f60['query'][_0x004d('0x2e')]+'%'};return _0x570b40;})});}_0x1e06ff['model']=db[_0x004d('0x37')];_0x1e06ff['as']='Agents';_0x1e06ff=_['merge']({},_0x1e06ff,_0x436f60[_0x004d('0x5b')]);return _0x1fdbe8[_0x004d('0xf2')]({'include':[_0x1e06ff]});}})[_0x004d('0x13')](function(_0x11a810){if(_0x11a810){var _0x469e4a={},_0xc60aed=[];for(var _0x3bb4fe=0x0;_0x3bb4fe<_0x11a810[_0x004d('0x48')];_0x3bb4fe+=0x1){for(var _0x2eae3b=0x0,_0x148f2e;_0x2eae3b<_0x11a810[_0x3bb4fe][_0x004d('0x85')][_0x004d('0x48')];_0x2eae3b+=0x1){_0x148f2e=_0x11a810[_0x3bb4fe]['Agents'][_0x2eae3b]['get']({'plain':!![]});_0x469e4a[_0x148f2e['id']]=_0x148f2e;}}_0x469e4a=_[_0x004d('0x11f')](_0x469e4a);for(var _0x4409e0=qs['offset'](_0x436f60['query'][_0x004d('0x22')]);_0x4409e0<_0x469e4a['length']&&_0xc60aed[_0x004d('0x48')]=_0x4ed093[_0x50f2('0x4f')]){throw new Error(_0x50f2('0x50'));}})[_0x50f2('0x17')](function(){if(_0xb5c0a5){return db[_0x50f2('0x26')]['destroy']({'where':{'membername':_0xb5c0a5[_0x50f2('0x21')]},'individualHooks':!![]});}})[_0x50f2('0x17')](function(){if(_0xb5c0a5){return _0xb5c0a5[_0x50f2('0x51')]({'raw':!![]});}})['then'](function(_0xbfd426){if(_0xb5c0a5){if(_0xbfd426){var _0x2d4017=[];_0x3f9a9f=_0xbfd426;if(_0x3f9a9f[_0x50f2('0x2a')]){for(var _0x49ee17=0x0;_0x49ee17<_0x3f9a9f[_0x50f2('0x2a')];_0x49ee17++){_0x2d4017['push'](db[_0x50f2('0x26')][_0x50f2('0x52')]({'membername':_0xb5c0a5[_0x50f2('0x21')],'UserId':_0xb5c0a5['id'],'queue_name':_0x3f9a9f[_0x49ee17][_0x50f2('0x21')],'VoiceQueueId':_0x3f9a9f[_0x49ee17]['id'],'interface':_0x5646b0,'paused':_0xb5c0a5['loginInPause']||![],'penalty':_0x3f9a9f[_0x49ee17][_0x50f2('0x53')]||0x0}));}return BPromise['all'](_0x2d4017);}}}})[_0x50f2('0x17')](function(){if(_0xb5c0a5){return db[_0x50f2('0x28')]['findAll']({'where':{'membername':_0xb5c0a5['name'],'exitAt':null}});}})[_0x50f2('0x17')](function(_0x24e166){if(_0xb5c0a5){if(_0x24e166&&_0x24e166[_0x50f2('0x2a')]){var _0x4423dd=[];_0x24e166[_0x50f2('0x2d')](function(_0x9a36e1){_0x4423dd[_0x50f2('0x2e')](_0x9a36e1[_0x50f2('0x27')]({'exitAt':moment()[_0x50f2('0x24')](_0x50f2('0x2b'))}));});return BPromise[_0x50f2('0x46')](_0x4423dd);}}})['then'](function(){if(_0xb5c0a5){var _0x415263=[];var _0x3a71b2=[];var _0x6ec1d0=utils[_0x50f2('0x54')]();var _0x5c7d87={'membername':_0xb5c0a5[_0x50f2('0x21')],'interface':_0x5646b0,'enterAt':moment()[_0x50f2('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xb5c0a5['role'],'internal':_0xb5c0a5[_0x50f2('0x23')]};_0x6ec1d0[_0x50f2('0x2d')](function(_0x1a1ac2){_0x415263['push'](_[_0x50f2('0x55')]({'channel':_0x1a1ac2,'type':_0x50f2('0x56'),'data1':'callysquare','data2':_0x5646b0},_0x5c7d87));if(_0xb5c0a5['loginInPause']){_0x3a71b2[_0x50f2('0x2e')](_[_0x50f2('0x55')]({'channel':_0x1a1ac2,'type':_0x50f2('0x29'),'data1':'LOGININPAUSE'},_0x5c7d87));}});return db[_0x50f2('0x28')][_0x50f2('0x35')](_0x415263[_0x50f2('0x57')](_0x3a71b2),{'individualHooks':!![]});}})['then'](function(){if(_0xb5c0a5){return _0xb5c0a5['update']({'online':!![],'lastLoginAt':moment()[_0x50f2('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0xb5c0a5['loginInPause']||![],'mailPause':_0xb5c0a5['loginInPause']||![],'chatPause':_0xb5c0a5[_0x50f2('0x4a')]||![],'faxPause':_0xb5c0a5['loginInPause']||![],'smsPause':_0xb5c0a5['loginInPause']||![],'openchannelPause':_0xb5c0a5[_0x50f2('0x4a')]||![],'pauseType':_0xb5c0a5[_0x50f2('0x4a')]?_0x50f2('0x58'):null,'lastPauseAt':moment()[_0x50f2('0x24')](_0x50f2('0x2b')),'interface':_0x5646b0});}})[_0x50f2('0x17')](function(_0x241747){_0xb60360(_0x241747);})[_0x50f2('0x1b')](function(_0x27ecff){_0x1e73f2(_0x2de5b7[_0x50f2('0x1c')](0x1f4,_0x27ecff['message']));});});}; \ No newline at end of file +var _0x30ce=['count','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','all','forEach','callysquare','merge','LOGININPAUSE','concat','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter','./user.socket','register','GetUser','findAll','options','raw','where','attributes','map','include','model','then','info','debug','stringify','error','message','ShowUser','User','find','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','MemberReport','name','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','catch','UnpauseUser','resolve','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','chatPause','faxPause','openchannelPause','whatsappPause','pauseType','lastPauseAt','unpause','system','destroy','push','update','mobile','phone','loginInPause'];(function(_0xa59eb9,_0x39e45e){var _0x2146fd=function(_0x38d767){while(--_0x38d767){_0xa59eb9['push'](_0xa59eb9['shift']());}};_0x2146fd(++_0x39e45e);}(_0x30ce,0x11a));var _0xe30c=function(_0x223461,_0x2bca70){_0x223461=_0x223461-0x0;var _0x4dbe0a=_0x30ce[_0x223461];return _0x4dbe0a;};'use strict';var _=require(_0xe30c('0x0'));var util=require(_0xe30c('0x1'));var moment=require(_0xe30c('0x2'));var BPromise=require(_0xe30c('0x3'));var Redis=require(_0xe30c('0x4'));var db=require(_0xe30c('0x5'))['db'];var utils=require(_0xe30c('0x6'));var logger=require(_0xe30c('0x7'))(_0xe30c('0x8'));var config=require(_0xe30c('0x9'));config['redis']=_[_0xe30c('0xa')](config[_0xe30c('0xb')],{'host':_0xe30c('0xc'),'port':0x18eb});var socket=require(_0xe30c('0xd'))(new Redis(config['redis']));require(_0xe30c('0xe'))[_0xe30c('0xf')](socket);exports[_0xe30c('0x10')]=function(_0x45b3e1){var _0x12fa33=this;return new Promise(function(_0xec2bdc,_0x4f4198){return db['User'][_0xe30c('0x11')]({'raw':_0x45b3e1[_0xe30c('0x12')]?_0x45b3e1[_0xe30c('0x12')][_0xe30c('0x13')]===undefined?!![]:![]:!![],'where':_0x45b3e1[_0xe30c('0x12')]?_0x45b3e1[_0xe30c('0x12')][_0xe30c('0x14')]||null:null,'attributes':_0x45b3e1['options']?_0x45b3e1[_0xe30c('0x12')][_0xe30c('0x15')]||null:null,'limit':_0x45b3e1[_0xe30c('0x12')]?_0x45b3e1['options']['limit']||null:null,'include':_0x45b3e1[_0xe30c('0x12')]?_0x45b3e1[_0xe30c('0x12')]['include']?_[_0xe30c('0x16')](_0x45b3e1[_0xe30c('0x12')][_0xe30c('0x17')],function(_0x59b0b2){return{'model':db[_0x59b0b2[_0xe30c('0x18')]],'as':_0x59b0b2['as'],'attributes':_0x59b0b2[_0xe30c('0x15')],'include':_0x59b0b2['include']?_[_0xe30c('0x16')](_0x59b0b2[_0xe30c('0x17')],function(_0x548110){return{'model':db[_0x548110[_0xe30c('0x18')]],'as':_0x548110['as'],'attributes':_0x548110[_0xe30c('0x15')],'include':_0x548110[_0xe30c('0x17')]?_[_0xe30c('0x16')](_0x548110['include'],function(_0x291901){return{'model':db[_0x291901[_0xe30c('0x18')]],'as':_0x291901['as'],'attributes':_0x291901[_0xe30c('0x15')]};}):[]};}):[]};}):[]:[]})[_0xe30c('0x19')](function(_0x2d785d){logger[_0xe30c('0x1a')](_0xe30c('0x10'),_0x45b3e1);logger[_0xe30c('0x1b')](_0xe30c('0x10'),_0x45b3e1,JSON[_0xe30c('0x1c')](_0x2d785d));_0xec2bdc(_0x2d785d);})['catch'](function(_0x297a25){logger[_0xe30c('0x1d')]('GetUser',_0x297a25[_0xe30c('0x1e')],_0x45b3e1);_0x4f4198(_0x12fa33[_0xe30c('0x1d')](0x1f4,_0x297a25[_0xe30c('0x1e')]));});});};exports[_0xe30c('0x1f')]=function(_0x31c32c){var _0x1d82ec=this;return new Promise(function(_0x4644df,_0x459930){return db[_0xe30c('0x20')][_0xe30c('0x21')]({'raw':_0x31c32c['options']?_0x31c32c[_0xe30c('0x12')][_0xe30c('0x13')]===undefined?!![]:![]:!![],'where':_0x31c32c['options']?_0x31c32c[_0xe30c('0x12')]['where']||null:null,'attributes':_0x31c32c[_0xe30c('0x12')]?_0x31c32c[_0xe30c('0x12')][_0xe30c('0x15')]||null:null,'include':_0x31c32c['options']?_0x31c32c[_0xe30c('0x12')][_0xe30c('0x17')]?_['map'](_0x31c32c[_0xe30c('0x12')]['include'],function(_0x3323e4){return{'model':db[_0x3323e4[_0xe30c('0x18')]],'as':_0x3323e4['as'],'attributes':_0x3323e4[_0xe30c('0x15')],'include':_0x3323e4[_0xe30c('0x17')]?_[_0xe30c('0x16')](_0x3323e4[_0xe30c('0x17')],function(_0x53e1e8){return{'model':db[_0x53e1e8[_0xe30c('0x18')]],'as':_0x53e1e8['as'],'attributes':_0x53e1e8['attributes'],'include':_0x53e1e8[_0xe30c('0x17')]?_[_0xe30c('0x16')](_0x53e1e8[_0xe30c('0x17')],function(_0x170303){return{'model':db[_0x170303[_0xe30c('0x18')]],'as':_0x170303['as'],'attributes':_0x170303[_0xe30c('0x15')]};}):[]};}):[]};}):[]:[]})[_0xe30c('0x19')](function(_0x20cb34){logger[_0xe30c('0x1a')](_0xe30c('0x1f'),_0x31c32c);logger['debug'](_0xe30c('0x1f'),_0x31c32c,JSON['stringify'](_0x20cb34));_0x4644df(_0x20cb34);})['catch'](function(_0x1fa0f4){logger[_0xe30c('0x1d')](_0xe30c('0x1f'),_0x1fa0f4[_0xe30c('0x1e')],_0x31c32c);_0x459930(_0x1d82ec[_0xe30c('0x1d')](0x1f4,_0x1fa0f4['message']));});});};exports['PauseUser']=function(_0x28c972){var _0x468d9d;return db[_0xe30c('0x20')][_0xe30c('0x21')]({'where':_0x28c972[_0xe30c('0x12')][_0xe30c('0x14')]||{},'attributes':['id','name',_0xe30c('0x22'),_0xe30c('0x23'),_0xe30c('0x24')]})[_0xe30c('0x19')](function(_0xa5cced){if(!_0xa5cced){throw new Error(util[_0xe30c('0x25')](_0xe30c('0x26'),_0x28c972[_0xe30c('0x27')]['id']));}_0x468d9d=_0xa5cced;return db[_0xe30c('0x28')]['update']({'paused':0x1},{'where':{'UserId':_0x468d9d['id']},'individualHooks':!![]});})[_0xe30c('0x19')](function(){return db[_0xe30c('0x29')][_0xe30c('0x11')]({'where':{'membername':_0x468d9d[_0xe30c('0x2a')],'type':_0xe30c('0x2b'),'exitAt':null}});})[_0xe30c('0x19')](function(_0x59c6ef){if(_0x59c6ef&&_0x59c6ef[_0xe30c('0x2c')]){var _0x2a54b6=moment()[_0xe30c('0x25')](_0xe30c('0x2d'));for(var _0x479509=0x0,_0x2b20a8=_0x59c6ef['length'];_0x479509<_0x2b20a8;_0x479509++){_0x59c6ef[_0x479509][_0xe30c('0x2e')]({'exitAt':_0x2a54b6});}}})['then'](function(){var _0x29d2bb=[];var _0x3666a6=utils[_0xe30c('0x2f')]();_0x3666a6['forEach'](function(_0x72d3e9){_0x29d2bb['push']({'channel':_0x72d3e9,'membername':_0x468d9d[_0xe30c('0x2a')],'interface':_[_0xe30c('0x30')](_0x468d9d[_0xe30c('0x24')])?util[_0xe30c('0x25')](_0xe30c('0x31'),_0x468d9d[_0xe30c('0x2a')]):_0x468d9d['interface'],'type':'PAUSE','enterAt':moment()[_0xe30c('0x25')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x28c972[_0xe30c('0x32')][_0xe30c('0x33')]||_0xe30c('0x34'),'role':_0x468d9d['role'],'internal':_0x468d9d[_0xe30c('0x23')],'uniqueid':_0x28c972[_0xe30c('0x32')][_0xe30c('0x35')]||null});});return db['MemberReport'][_0xe30c('0x36')](_0x29d2bb,{'individualHooks':!![]});})[_0xe30c('0x19')](function(){return _0x468d9d['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x28c972[_0xe30c('0x32')][_0xe30c('0x33')]||_0xe30c('0x34'),'lastPauseAt':moment()[_0xe30c('0x25')](_0xe30c('0x2d'))});})[_0xe30c('0x37')](function(_0x47bd56){throw _0x47bd56;});};exports[_0xe30c('0x38')]=function(_0x5a5377){return Promise[_0xe30c('0x39')]()[_0xe30c('0x19')](function(){if(_0x5a5377[_0xe30c('0x32')][_0xe30c('0x3a')]&&!utils['isValidChannel'](_0x5a5377[_0xe30c('0x32')][_0xe30c('0x3a')])){throw new Error(util[_0xe30c('0x25')](_0xe30c('0x3b'),_0x5a5377[_0xe30c('0x32')][_0xe30c('0x3a')]));}return db[_0xe30c('0x20')][_0xe30c('0x3c')]({'where':_0x5a5377[_0xe30c('0x12')]['where']||{},'attributes':['id',_0xe30c('0x2a'),_0xe30c('0x22'),_0xe30c('0x23'),_0xe30c('0x24'),_0xe30c('0x3d'),_0xe30c('0x3e'),_0xe30c('0x3f'),_0xe30c('0x40'),_0xe30c('0x41'),_0xe30c('0x42'),'smsPause',_0xe30c('0x43'),_0xe30c('0x44'),_0xe30c('0x45')]});})['then'](function(_0x378ee7){if(!_0x378ee7){throw new Error(util[_0xe30c('0x25')]('User\x20with\x20id\x20%s\x20not\x20found',_0x5a5377['params']['id']));}return _0x378ee7[_0xe30c('0x46')](_0x5a5377['body'][_0xe30c('0x3a')],_0xe30c('0x47'));})[_0xe30c('0x37')](function(_0x78573e){throw _0x78573e;});};exports['LogoutUser']=function(_0x27cf5f){var _0x2488da=this;return new Promise(function(_0x472aa9,_0x341aca){var _0x23b465;return db[_0xe30c('0x20')][_0xe30c('0x3c')]({'where':_0x27cf5f[_0xe30c('0x12')][_0xe30c('0x14')]||{},'attributes':['id',_0xe30c('0x2a')]})['then'](function(_0x5b2307){if(_0x5b2307){_0x23b465=_0x5b2307;return db[_0xe30c('0x28')][_0xe30c('0x48')]({'where':{'membername':_0x23b465[_0xe30c('0x2a')]},'individualHooks':!![]});}})[_0xe30c('0x19')](function(){if(_0x23b465){return db[_0xe30c('0x29')][_0xe30c('0x11')]({'where':{'membername':_0x23b465[_0xe30c('0x2a')],'exitAt':null}});}})['then'](function(_0x303932){if(_0x23b465){if(_0x303932&&_0x303932[_0xe30c('0x2c')]){var _0x3ac0f6=[];_0x303932['forEach'](function(_0x588064){_0x3ac0f6[_0xe30c('0x49')](_0x588064[_0xe30c('0x4a')]({'exitAt':moment()[_0xe30c('0x25')](_0xe30c('0x2d'))}));});return BPromise['all'](_0x3ac0f6);}}})[_0xe30c('0x19')](function(){if(_0x23b465){return _0x23b465[_0xe30c('0x4a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xe30c('0x19')](function(_0x4b9312){_0x472aa9(_0x4b9312);})['catch'](function(_0x5d1099){_0x341aca(_0x2488da[_0xe30c('0x1d')](0x1f4,_0x5d1099[_0xe30c('0x1e')]));});});};exports['LoginUser']=function(_0x43fe52){var _0x2960fe=this;return new Promise(function(_0x575d35,_0x862136){var _0x3df434;var _0x2f39be;var _0x58aa35;var _0x2b587c;return db[_0xe30c('0x20')][_0xe30c('0x3c')]({'where':_0x43fe52[_0xe30c('0x12')][_0xe30c('0x14')]||{},'attributes':['id',_0xe30c('0x2a'),'role',_0xe30c('0x4b'),_0xe30c('0x4c'),_0xe30c('0x23'),_0xe30c('0x4d'),'interface']})[_0xe30c('0x19')](function(_0x24e76d){if(_0x24e76d){_0x3df434=_0x24e76d;_0x2b587c=_0x43fe52['body'][_0xe30c('0x24')]?_0x43fe52['body'][_0xe30c('0x24')]:util[_0xe30c('0x25')](_0xe30c('0x31'),_0x3df434[_0xe30c('0x2a')]);return db[_0xe30c('0x20')][_0xe30c('0x4e')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x3df434['id']}}});}})[_0xe30c('0x19')](function(_0x362518){if(_0x362518){_0x58aa35=_0x362518;return require('../../config/license/util')['getLicense']();}})[_0xe30c('0x19')](function(_0x3b5cb2){if(_0x3b5cb2&&_0x3b5cb2[_0xe30c('0x4f')]&&_0x58aa35>=_0x3b5cb2[_0xe30c('0x4f')]){throw new Error(_0xe30c('0x50'));}})[_0xe30c('0x19')](function(){if(_0x3df434){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x3df434[_0xe30c('0x2a')]},'individualHooks':!![]});}})['then'](function(){if(_0x3df434){return _0x3df434[_0xe30c('0x51')]({'raw':!![]});}})['then'](function(_0x23c3fa){if(_0x3df434){if(_0x23c3fa){var _0x536ab9=[];_0x2f39be=_0x23c3fa;if(_0x2f39be['length']){for(var _0x5764ba=0x0;_0x5764ba<_0x2f39be[_0xe30c('0x2c')];_0x5764ba++){_0x536ab9['push'](db[_0xe30c('0x28')][_0xe30c('0x52')]({'membername':_0x3df434[_0xe30c('0x2a')],'UserId':_0x3df434['id'],'queue_name':_0x2f39be[_0x5764ba][_0xe30c('0x2a')],'VoiceQueueId':_0x2f39be[_0x5764ba]['id'],'interface':_0x2b587c,'paused':_0x3df434[_0xe30c('0x4d')]||![],'penalty':_0x2f39be[_0x5764ba][_0xe30c('0x53')]||0x0}));}return BPromise[_0xe30c('0x54')](_0x536ab9);}}}})[_0xe30c('0x19')](function(){if(_0x3df434){return db[_0xe30c('0x29')]['findAll']({'where':{'membername':_0x3df434[_0xe30c('0x2a')],'exitAt':null}});}})[_0xe30c('0x19')](function(_0x34ad0a){if(_0x3df434){if(_0x34ad0a&&_0x34ad0a[_0xe30c('0x2c')]){var _0x4ac9bf=[];_0x34ad0a[_0xe30c('0x55')](function(_0x4a0023){_0x4ac9bf[_0xe30c('0x49')](_0x4a0023[_0xe30c('0x4a')]({'exitAt':moment()[_0xe30c('0x25')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xe30c('0x54')](_0x4ac9bf);}}})[_0xe30c('0x19')](function(){if(_0x3df434){var _0x15efce=[];var _0x435715=[];var _0x73843=utils['getChannels']();var _0x227d70={'membername':_0x3df434['name'],'interface':_0x2b587c,'enterAt':moment()[_0xe30c('0x25')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x3df434[_0xe30c('0x22')],'internal':_0x3df434[_0xe30c('0x23')]};_0x73843[_0xe30c('0x55')](function(_0xdd98e7){_0x15efce[_0xe30c('0x49')](_['merge']({'channel':_0xdd98e7,'type':'LOGIN','data1':_0xe30c('0x56'),'data2':_0x2b587c},_0x227d70));if(_0x3df434[_0xe30c('0x4d')]){_0x435715[_0xe30c('0x49')](_[_0xe30c('0x57')]({'channel':_0xdd98e7,'type':_0xe30c('0x2b'),'data1':_0xe30c('0x58')},_0x227d70));}});return db[_0xe30c('0x29')][_0xe30c('0x36')](_0x15efce[_0xe30c('0x59')](_0x435715),{'individualHooks':!![]});}})[_0xe30c('0x19')](function(){if(_0x3df434){return _0x3df434[_0xe30c('0x4a')]({'online':!![],'lastLoginAt':moment()[_0xe30c('0x25')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3df434['loginInPause']||![],'mailPause':_0x3df434['loginInPause']||![],'chatPause':_0x3df434[_0xe30c('0x4d')]||![],'faxPause':_0x3df434[_0xe30c('0x4d')]||![],'smsPause':_0x3df434['loginInPause']||![],'openchannelPause':_0x3df434[_0xe30c('0x4d')]||![],'pauseType':_0x3df434[_0xe30c('0x4d')]?_0xe30c('0x58'):null,'lastPauseAt':moment()[_0xe30c('0x25')](_0xe30c('0x2d')),'interface':_0x2b587c});}})[_0xe30c('0x19')](function(_0xebd8e){_0x575d35(_0xebd8e);})[_0xe30c('0x37')](function(_0x3f26d5){_0x862136(_0x2960fe[_0xe30c('0x1d')](0x1f4,_0x3f26d5[_0xe30c('0x1e')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 0a335c2..cbef781 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 _0x4506=['user:','./user.events','save','remove','update','register','length'];(function(_0x422e42,_0x10fb5e){var _0x48fb72=function(_0x22571f){while(--_0x22571f){_0x422e42['push'](_0x422e42['shift']());}};_0x48fb72(++_0x10fb5e);}(_0x4506,0x13c));var _0x6450=function(_0x1a19cd,_0x356285){_0x1a19cd=_0x1a19cd-0x0;var _0x1ec402=_0x4506[_0x1a19cd];return _0x1ec402;};'use strict';var UserEvents=require(_0x6450('0x0'));var events=[_0x6450('0x1'),_0x6450('0x2'),_0x6450('0x3')];function createListener(_0x2deed1,_0x20bded){return function(_0xb78cd7){_0x20bded['emit'](_0x2deed1,_0xb78cd7);};}function removeListener(_0x168618,_0x21b0b8){return function(){UserEvents['removeListener'](_0x168618,_0x21b0b8);};}exports[_0x6450('0x4')]=function(_0x314904){for(var _0x129b60=0x0,_0xc9677=events[_0x6450('0x5')];_0x129b60<_0xc9677;_0x129b60++){var _0x360845=events[_0x129b60];var _0x51ac47=createListener(_0x6450('0x6')+_0x360845,_0x314904);UserEvents['on'](_0x360845,_0x51ac47);}}; \ No newline at end of file +var _0x65ea=['removeListener','register','length','user:','./user.events','save','remove','update'];(function(_0x2972ae,_0xff04b){var _0x2e35b3=function(_0xbddd7){while(--_0xbddd7){_0x2972ae['push'](_0x2972ae['shift']());}};_0x2e35b3(++_0xff04b);}(_0x65ea,0x1c4));var _0xa65e=function(_0x26fb81,_0x4d4d56){_0x26fb81=_0x26fb81-0x0;var _0x4b1aae=_0x65ea[_0x26fb81];return _0x4b1aae;};'use strict';var UserEvents=require(_0xa65e('0x0'));var events=[_0xa65e('0x1'),_0xa65e('0x2'),_0xa65e('0x3')];function createListener(_0x2636c7,_0x42f5c5){return function(_0x22effb){_0x42f5c5['emit'](_0x2636c7,_0x22effb);};}function removeListener(_0x575c2d,_0x1a6e70){return function(){UserEvents[_0xa65e('0x4')](_0x575c2d,_0x1a6e70);};}exports[_0xa65e('0x5')]=function(_0x5f0de4){for(var _0x3c2b03=0x0,_0x4e6adf=events[_0xa65e('0x6')];_0x3c2b03<_0x4e6adf;_0x3c2b03++){var _0xd5b548=events[_0x3c2b03];var _0x3c41d6=createListener(_0xa65e('0x7')+_0xd5b548,_0x5f0de4);UserEvents['on'](_0xd5b548,_0x3c41d6);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index e209320..f3636d5 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4d3c6d,_0x4ea492){var _0x15df71=function(_0x41c0c8){while(--_0x41c0c8){_0x4d3c6d['push'](_0x4d3c6d['shift']());}};_0x15df71(++_0x4ea492);}(_0x70e0,0x17b));var _0x070e=function(_0x4a6cc9,_0x33828b){_0x4a6cc9=_0x4a6cc9-0x0;var _0x41a481=_0x70e0[_0x4a6cc9];return _0x41a481;};'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(_0x10f875,_0x51f8cf){var _0x3accfa=function(_0x1918ea){while(--_0x1918ea){_0x10f875['push'](_0x10f875['shift']());}};_0x3accfa(++_0x51f8cf);}(_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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index b4d9d36..5ef362d 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 _0x5e1e=['exports','sequelize'];(function(_0x435d49,_0xe63b56){var _0x40a43d=function(_0x427d95){while(--_0x427d95){_0x435d49['push'](_0x435d49['shift']());}};_0x40a43d(++_0xe63b56);}(_0x5e1e,0x7f));var _0xe5e1=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x5e1e[_0x16d10f];return _0x50c823;};'use strict';var Sequelize=require(_0xe5e1('0x0'));module[_0xe5e1('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xac29=['sequelize','exports'];(function(_0x1b08fe,_0x3db8a6){var _0x732168=function(_0x352709){while(--_0x352709){_0x1b08fe['push'](_0x1b08fe['shift']());}};_0x732168(++_0x3db8a6);}(_0xac29,0x1b8));var _0x9ac2=function(_0x4fc4ff,_0x4a76e3){_0x4fc4ff=_0x4fc4ff-0x0;var _0x4520ac=_0xac29[_0x4fc4ff];return _0x4520ac;};'use strict';var Sequelize=require(_0x9ac2('0x0'));module[_0x9ac2('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 9e30d4f..cdb9a0f 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 _0xdca0=['moment','request-promise','path','rimraf','user_has_chat_queues','lodash','util','api'];(function(_0x374357,_0x2ed1ab){var _0x1e76bd=function(_0x45ef03){while(--_0x45ef03){_0x374357['push'](_0x374357['shift']());}};_0x1e76bd(++_0x2ed1ab);}(_0xdca0,0x7d));var _0x0dca=function(_0x3bb43c,_0x5e18f3){_0x3bb43c=_0x3bb43c-0x0;var _0x1c5bf9=_0xdca0[_0x3bb43c];return _0x1c5bf9;};'use strict';var _=require(_0x0dca('0x0'));var util=require(_0x0dca('0x1'));var logger=require('../../config/logger')(_0x0dca('0x2'));var moment=require(_0x0dca('0x3'));var BPromise=require('bluebird');var rp=require(_0x0dca('0x4'));var fs=require('fs');var path=require(_0x0dca('0x5'));var rimraf=require(_0x0dca('0x6'));var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module['exports']=function(_0xcb4014,_0x4e427e){return _0xcb4014['define']('UserChatQueue',attributes,{'tableName':_0x0dca('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1722=['bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','util','api'];(function(_0x598cd5,_0x1ee6e7){var _0x40b1ff=function(_0xd09aa7){while(--_0xd09aa7){_0x598cd5['push'](_0x598cd5['shift']());}};_0x40b1ff(++_0x1ee6e7);}(_0x1722,0x1ed));var _0x2172=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1722[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x2172('0x0'));var logger=require('../../config/logger')(_0x2172('0x1'));var moment=require('moment');var BPromise=require(_0x2172('0x2'));var rp=require(_0x2172('0x3'));var fs=require('fs');var path=require(_0x2172('0x4'));var rimraf=require(_0x2172('0x5'));var config=require(_0x2172('0x6'));var attributes=require(_0x2172('0x7'));module[_0x2172('0x8')]=function(_0x51638c,_0xdb2f85){return _0x51638c['define'](_0x2172('0x9'),attributes,{'tableName':_0x2172('0xa'),'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 b382224..8e23a2c 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 _0xcb1d=['error','message','UserChatQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','jayson/promise','client','http','request','then','info','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x248abf,_0x41fc15){var _0x39fdf2=function(_0x53583f){while(--_0x53583f){_0x248abf['push'](_0x248abf['shift']());}};_0x39fdf2(++_0x41fc15);}(_0xcb1d,0xf5));var _0xdcb1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcb1d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xdcb1('0x0'));var util=require(_0xdcb1('0x1'));var moment=require(_0xdcb1('0x2'));var BPromise=require(_0xdcb1('0x3'));var rs=require(_0xdcb1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdcb1('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xdcb1('0x6'));var client=jayson[_0xdcb1('0x7')][_0xdcb1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2467a1,_0x39485c,_0x496e30){return new BPromise(function(_0x5d71d9,_0xe95908){return client[_0xdcb1('0x9')](_0x2467a1,_0x496e30)[_0xdcb1('0xa')](function(_0x1d5f07){logger[_0xdcb1('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x39485c,_0xdcb1('0xc'));logger['debug'](_0xdcb1('0xd'),_0x39485c,_0xdcb1('0xc'),JSON[_0xdcb1('0xe')](_0x1d5f07));if(_0x1d5f07[_0xdcb1('0xf')]){if(_0x1d5f07[_0xdcb1('0xf')]['code']===0x1f4){logger[_0xdcb1('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x39485c,_0x1d5f07[_0xdcb1('0xf')][_0xdcb1('0x10')]);return _0xe95908(_0x1d5f07[_0xdcb1('0xf')][_0xdcb1('0x10')]);}logger[_0xdcb1('0xf')](_0xdcb1('0x11'),_0x39485c,_0x1d5f07[_0xdcb1('0xf')][_0xdcb1('0x10')]);return _0x5d71d9(_0x1d5f07[_0xdcb1('0xf')][_0xdcb1('0x10')]);}else{logger[_0xdcb1('0xb')](_0xdcb1('0x11'),_0x39485c,_0xdcb1('0xc'));_0x5d71d9(_0x1d5f07[_0xdcb1('0x12')][_0xdcb1('0x10')]);}})[_0xdcb1('0x13')](function(_0x47c101){logger[_0xdcb1('0xf')](_0xdcb1('0x11'),_0x39485c,_0x47c101);_0xe95908(_0x47c101);});});} \ No newline at end of file +var _0x3b15=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util'];(function(_0x36de10,_0xfe25e8){var _0x58100f=function(_0x1fee3f){while(--_0x1fee3f){_0x36de10['push'](_0x36de10['shift']());}};_0x58100f(++_0xfe25e8);}(_0x3b15,0x1df));var _0x53b1=function(_0x1f8053,_0x111077){_0x1f8053=_0x1f8053-0x0;var _0x174fd8=_0x3b15[_0x1f8053];return _0x174fd8;};'use strict';var _=require('lodash');var util=require(_0x53b1('0x0'));var moment=require(_0x53b1('0x1'));var BPromise=require(_0x53b1('0x2'));var rs=require(_0x53b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53b1('0x4'))['db'];var utils=require(_0x53b1('0x5'));var logger=require(_0x53b1('0x6'))(_0x53b1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x53b1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32d782,_0x40f998,_0x2badd7){return new BPromise(function(_0xf5c7e5,_0x21d897){return client['request'](_0x32d782,_0x2badd7)['then'](function(_0x55f182){logger[_0x53b1('0x9')](_0x53b1('0xa'),_0x40f998,'request\x20sent');logger[_0x53b1('0xb')](_0x53b1('0xc'),_0x40f998,_0x53b1('0xd'),JSON[_0x53b1('0xe')](_0x55f182));if(_0x55f182[_0x53b1('0xf')]){if(_0x55f182[_0x53b1('0xf')][_0x53b1('0x10')]===0x1f4){logger[_0x53b1('0xf')](_0x53b1('0xa'),_0x40f998,_0x55f182['error'][_0x53b1('0x11')]);return _0x21d897(_0x55f182[_0x53b1('0xf')]['message']);}logger[_0x53b1('0xf')](_0x53b1('0xa'),_0x40f998,_0x55f182[_0x53b1('0xf')][_0x53b1('0x11')]);return _0xf5c7e5(_0x55f182[_0x53b1('0xf')][_0x53b1('0x11')]);}else{logger[_0x53b1('0x9')](_0x53b1('0xa'),_0x40f998,_0x53b1('0xd'));_0xf5c7e5(_0x55f182[_0x53b1('0x12')]['message']);}})[_0x53b1('0x13')](function(_0x406755){logger[_0x53b1('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x40f998,_0x406755);_0x21d897(_0x406755);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index cfab57f..b6bd495 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x4b3d0e,_0x1d19b8){var _0x4aecdc=function(_0x412c2f){while(--_0x412c2f){_0x4b3d0e['push'](_0x4b3d0e['shift']());}};_0x4aecdc(++_0x1d19b8);}(_0xedd9,0xfc));var _0x9edd=function(_0x156792,_0x5c22ca){_0x156792=_0x156792-0x0;var _0xf6a038=_0xedd9[_0x156792];return _0xf6a038;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4a4e6a,_0x72875f){var _0x4b9879=function(_0x5f35bd){while(--_0x5f35bd){_0x4a4e6a['push'](_0x4a4e6a['shift']());}};_0x4b9879(++_0x72875f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 6be2e46..9512625 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 _0x2e9d=['INTEGER','STRING','sequelize'];(function(_0x5813db,_0x30c732){var _0x1ca614=function(_0x150381){while(--_0x150381){_0x5813db['push'](_0x5813db['shift']());}};_0x1ca614(++_0x30c732);}(_0x2e9d,0x125));var _0xd2e9=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x2e9d[_0xdea41a];return _0x15d0d8;};'use strict';var Sequelize=require(_0xd2e9('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd2e9('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xd2e9('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xd2e9('0x2')]}}; \ No newline at end of file +var _0xa468=['INTEGER','sequelize'];(function(_0x1df7b8,_0x2fe5e5){var _0x29d911=function(_0x340121){while(--_0x340121){_0x1df7b8['push'](_0x1df7b8['shift']());}};_0x29d911(++_0x2fe5e5);}(_0xa468,0x13f));var _0x8a46=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa468[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x8a46('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x8a46('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8a46('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 72c4119..5b17742 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 _0x7ad5=['path','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash','util','api','bluebird','request-promise'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7ad5,0x69));var _0x57ad=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x7ad5[_0x5d80de];return _0x1c7556;};'use strict';var _=require(_0x57ad('0x0'));var util=require(_0x57ad('0x1'));var logger=require('../../config/logger')(_0x57ad('0x2'));var moment=require('moment');var BPromise=require(_0x57ad('0x3'));var rp=require(_0x57ad('0x4'));var fs=require('fs');var path=require(_0x57ad('0x5'));var rimraf=require('rimraf');var config=require(_0x57ad('0x6'));var attributes=require(_0x57ad('0x7'));module[_0x57ad('0x8')]=function(_0x1aa3a8,_0x379940){return _0x1aa3a8[_0x57ad('0x9')](_0x57ad('0xa'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xace0=['moment','bluebird','path','./userFaxQueue.attributes','define','UserFaxQueue','lodash','util','../../config/logger','api'];(function(_0x2a0eb8,_0x48affb){var _0x51f8d9=function(_0x1b9875){while(--_0x1b9875){_0x2a0eb8['push'](_0x2a0eb8['shift']());}};_0x51f8d9(++_0x48affb);}(_0xace0,0x164));var _0x0ace=function(_0x171fa7,_0x587eca){_0x171fa7=_0x171fa7-0x0;var _0xc894e1=_0xace0[_0x171fa7];return _0xc894e1;};'use strict';var _=require(_0x0ace('0x0'));var util=require(_0x0ace('0x1'));var logger=require(_0x0ace('0x2'))(_0x0ace('0x3'));var moment=require(_0x0ace('0x4'));var BPromise=require(_0x0ace('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ace('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0ace('0x7'));module['exports']=function(_0x45ba06,_0x52aaf6){return _0x45ba06[_0x0ace('0x8')](_0x0ace('0x9'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 16e9677..0466ae2 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 _0x5c7b=['client','http','request','then','info','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UserFaxQueue,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise'];(function(_0x2fcc88,_0x20dac3){var _0x287ba2=function(_0x54a0e7){while(--_0x54a0e7){_0x2fcc88['push'](_0x2fcc88['shift']());}};_0x287ba2(++_0x20dac3);}(_0x5c7b,0x6a));var _0xb5c7=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x5c7b[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xb5c7('0x0'));var util=require(_0xb5c7('0x1'));var moment=require(_0xb5c7('0x2'));var BPromise=require(_0xb5c7('0x3'));var rs=require(_0xb5c7('0x4'));var fs=require('fs');var Redis=require(_0xb5c7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb5c7('0x6'));var logger=require(_0xb5c7('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb5c7('0x8'));var client=jayson[_0xb5c7('0x9')][_0xb5c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13369c,_0xde504f,_0x5b2d71){return new BPromise(function(_0x75d532,_0x3cc7fc){return client[_0xb5c7('0xb')](_0x13369c,_0x5b2d71)[_0xb5c7('0xc')](function(_0x4a343f){logger[_0xb5c7('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0xde504f,'request\x20sent');logger[_0xb5c7('0xe')](_0xb5c7('0xf'),_0xde504f,_0xb5c7('0x10'),JSON[_0xb5c7('0x11')](_0x4a343f));if(_0x4a343f[_0xb5c7('0x12')]){if(_0x4a343f[_0xb5c7('0x12')][_0xb5c7('0x13')]===0x1f4){logger[_0xb5c7('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0xde504f,_0x4a343f[_0xb5c7('0x12')][_0xb5c7('0x14')]);return _0x3cc7fc(_0x4a343f['error'][_0xb5c7('0x14')]);}logger['error'](_0xb5c7('0x15'),_0xde504f,_0x4a343f['error'][_0xb5c7('0x14')]);return _0x75d532(_0x4a343f[_0xb5c7('0x12')][_0xb5c7('0x14')]);}else{logger['info'](_0xb5c7('0x15'),_0xde504f,'request\x20sent');_0x75d532(_0x4a343f[_0xb5c7('0x16')]['message']);}})['catch'](function(_0x166b6e){logger[_0xb5c7('0x12')](_0xb5c7('0x15'),_0xde504f,_0x166b6e);_0x3cc7fc(_0x166b6e);});});} \ No newline at end of file +var _0x7ad6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message'];(function(_0x431fa5,_0x2a377a){var _0x3cce13=function(_0x3041a7){while(--_0x3041a7){_0x431fa5['push'](_0x431fa5['shift']());}};_0x3cce13(++_0x2a377a);}(_0x7ad6,0x9e));var _0x67ad=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7ad6[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x67ad('0x0'));var util=require(_0x67ad('0x1'));var moment=require(_0x67ad('0x2'));var BPromise=require(_0x67ad('0x3'));var rs=require(_0x67ad('0x4'));var fs=require('fs');var Redis=require(_0x67ad('0x5'));var db=require(_0x67ad('0x6'))['db'];var utils=require(_0x67ad('0x7'));var logger=require(_0x67ad('0x8'))(_0x67ad('0x9'));var config=require(_0x67ad('0xa'));var jayson=require(_0x67ad('0xb'));var client=jayson[_0x67ad('0xc')][_0x67ad('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x143ae5,_0x43d50c,_0x14f023){return new BPromise(function(_0x4ed6d1,_0x3d4ec3){return client['request'](_0x143ae5,_0x14f023)[_0x67ad('0xe')](function(_0x3c9278){logger[_0x67ad('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x43d50c,_0x67ad('0x10'));logger[_0x67ad('0x11')](_0x67ad('0x12'),_0x43d50c,_0x67ad('0x10'),JSON[_0x67ad('0x13')](_0x3c9278));if(_0x3c9278[_0x67ad('0x14')]){if(_0x3c9278[_0x67ad('0x14')][_0x67ad('0x15')]===0x1f4){logger[_0x67ad('0x14')](_0x67ad('0x16'),_0x43d50c,_0x3c9278[_0x67ad('0x14')]['message']);return _0x3d4ec3(_0x3c9278[_0x67ad('0x14')]['message']);}logger[_0x67ad('0x14')](_0x67ad('0x16'),_0x43d50c,_0x3c9278['error']['message']);return _0x4ed6d1(_0x3c9278['error'][_0x67ad('0x17')]);}else{logger[_0x67ad('0xf')](_0x67ad('0x16'),_0x43d50c,_0x67ad('0x10'));_0x4ed6d1(_0x3c9278[_0x67ad('0x18')][_0x67ad('0x17')]);}})[_0x67ad('0x19')](function(_0x2ce7e2){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x43d50c,_0x2ce7e2);_0x3d4ec3(_0x2ce7e2);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index b45375a..8a371fa 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x6047b8,_0x51c757){var _0x52aaa7=function(_0x1936ef){while(--_0x1936ef){_0x6047b8['push'](_0x6047b8['shift']());}};_0x52aaa7(++_0x51c757);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xc657a4,_0xbb39f5){var _0x11e195=function(_0x3bd384){while(--_0x3bd384){_0xc657a4['push'](_0xc657a4['shift']());}};_0x11e195(++_0xbb39f5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1c5142,_0x30ea72){_0x1c5142=_0x1c5142-0x0;var _0x1268cb=_0xcb91[_0x1c5142];return _0x1268cb;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 18ab798..03f2f55 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 _0xb4b5=['sequelize','exports','INTEGER'];(function(_0x7952d6,_0x362a8e){var _0x366faa=function(_0x5264f9){while(--_0x5264f9){_0x7952d6['push'](_0x7952d6['shift']());}};_0x366faa(++_0x362a8e);}(_0xb4b5,0x159));var _0x5b4b=function(_0x18e52b,_0x1fae35){_0x18e52b=_0x18e52b-0x0;var _0x3d3062=_0xb4b5[_0x18e52b];return _0x3d3062;};'use strict';var Sequelize=require(_0x5b4b('0x0'));module[_0x5b4b('0x1')]={'penalty':{'type':Sequelize[_0x5b4b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8a7=['sequelize','INTEGER'];(function(_0x20a8ea,_0x3937d8){var _0x4df51b=function(_0x1c6780){while(--_0x1c6780){_0x20a8ea['push'](_0x20a8ea['shift']());}};_0x4df51b(++_0x3937d8);}(_0xd8a7,0x15e));var _0x7d8a=function(_0x4e1bf7,_0x2e5005){_0x4e1bf7=_0x4e1bf7-0x0;var _0xff3dae=_0xd8a7[_0x4e1bf7];return _0xff3dae;};'use strict';var Sequelize=require(_0x7d8a('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7d8a('0x1')],'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 2c788dd..75f0109 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 _0x9342=['path','../../config/environment','./userMailQueue.attributes','define','UserMailQueue','user_has_mail_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x47a1f2,_0x38e32c){var _0x57f9f5=function(_0x36edcf){while(--_0x36edcf){_0x47a1f2['push'](_0x47a1f2['shift']());}};_0x57f9f5(++_0x38e32c);}(_0x9342,0x1df));var _0x2934=function(_0x48e5bd,_0x58af1c){_0x48e5bd=_0x48e5bd-0x0;var _0x21829f=_0x9342[_0x48e5bd];return _0x21829f;};'use strict';var _=require(_0x2934('0x0'));var util=require('util');var logger=require(_0x2934('0x1'))(_0x2934('0x2'));var moment=require(_0x2934('0x3'));var BPromise=require(_0x2934('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2934('0x5'));var rimraf=require('rimraf');var config=require(_0x2934('0x6'));var attributes=require(_0x2934('0x7'));module['exports']=function(_0x2208dd,_0xb919d1){return _0x2208dd[_0x2934('0x8')](_0x2934('0x9'),attributes,{'tableName':_0x2934('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc89b=['user_has_mail_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue'];(function(_0x44c2ca,_0x115a04){var _0x4bdb20=function(_0x327152){while(--_0x327152){_0x44c2ca['push'](_0x44c2ca['shift']());}};_0x4bdb20(++_0x115a04);}(_0xc89b,0x1b3));var _0xbc89=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xc89b[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0xbc89('0x0'));var util=require(_0xbc89('0x1'));var logger=require(_0xbc89('0x2'))(_0xbc89('0x3'));var moment=require('moment');var BPromise=require(_0xbc89('0x4'));var rp=require(_0xbc89('0x5'));var fs=require('fs');var path=require(_0xbc89('0x6'));var rimraf=require(_0xbc89('0x7'));var config=require(_0xbc89('0x8'));var attributes=require(_0xbc89('0x9'));module[_0xbc89('0xa')]=function(_0x2fd8a8,_0x4a924f){return _0x2fd8a8[_0xbc89('0xb')](_0xbc89('0xc'),attributes,{'tableName':_0xbc89('0xd'),'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 dcea35b..89f6612 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 _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','result'];(function(_0x4346a5,_0x2a8d60){var _0x1c3d40=function(_0x48157a){while(--_0x48157a){_0x4346a5['push'](_0x4346a5['shift']());}};_0x1c3d40(++_0x2a8d60);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x58cbde,_0x4b0f62){_0x58cbde=_0x58cbde-0x0;var _0x5799f3=_0xf3cd[_0x58cbde];return _0x5799f3;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file +var _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x3599bf,_0x12db3d){var _0x34f329=function(_0x1d243d){while(--_0x1d243d){_0x3599bf['push'](_0x3599bf['shift']());}};_0x34f329(++_0x12db3d);}(_0x55ca,0x126));var _0xa55c=function(_0x3407ee,_0xb2e716){_0x3407ee=_0x3407ee-0x0;var _0x1b0b35=_0x55ca[_0x3407ee];return _0x1b0b35;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 169dfcd..a792c7c 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 _0xbcbd=['Router','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendUserNotification','exports','multer','util','path','express'];(function(_0x349c2f,_0x41bd46){var _0x5ef6c6=function(_0x231aba){while(--_0x231aba){_0x349c2f['push'](_0x349c2f['shift']());}};_0x5ef6c6(++_0x41bd46);}(_0xbcbd,0x188));var _0xdbcb=function(_0xdbc93e,_0x4fcd8e){_0xdbc93e=_0xdbc93e-0x0;var _0x29df2c=_0xbcbd[_0xdbc93e];return _0x29df2c;};'use strict';var multer=require(_0xdbcb('0x0'));var util=require(_0xdbcb('0x1'));var path=require(_0xdbcb('0x2'));var timeout=require('connect-timeout');var express=require(_0xdbcb('0x3'));var router=express[_0xdbcb('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdbcb('0x5'));var config=require(_0xdbcb('0x6'));var controller=require('./userNotification.controller');router[_0xdbcb('0x7')]('/',auth[_0xdbcb('0x8')](),controller[_0xdbcb('0x9')]);module[_0xdbcb('0xa')]=router; \ No newline at end of file +var _0x3322=['sendUserNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated'];(function(_0xd08b77,_0x125c19){var _0xfe0936=function(_0x209cc4){while(--_0x209cc4){_0xd08b77['push'](_0xd08b77['shift']());}};_0xfe0936(++_0x125c19);}(_0x3322,0x14c));var _0x2332=function(_0x3a177c,_0xfb1964){_0x3a177c=_0x3a177c-0x0;var _0x291a58=_0x3322[_0x3a177c];return _0x291a58;};'use strict';var multer=require(_0x2332('0x0'));var util=require(_0x2332('0x1'));var path=require(_0x2332('0x2'));var timeout=require(_0x2332('0x3'));var express=require(_0x2332('0x4'));var router=express[_0x2332('0x5')]();var fs_extra=require(_0x2332('0x6'));var auth=require(_0x2332('0x7'));var interaction=require(_0x2332('0x8'));var config=require(_0x2332('0x9'));var controller=require(_0x2332('0xa'));router[_0x2332('0xb')]('/',auth[_0x2332('0xc')](),controller[_0x2332('0xd')]);module[_0x2332('0xe')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 82f32d9..a84ebfd 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 _0x224b=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x154983,_0xc29edf){var _0x3d1243=function(_0x5cb7a4){while(--_0x5cb7a4){_0x154983['push'](_0x154983['shift']());}};_0x3d1243(++_0xc29edf);}(_0x224b,0x159));var _0xb224=function(_0x5b0c55,_0x2fecd5){_0x5b0c55=_0x5b0c55-0x0;var _0x4ae957=_0x224b[_0x5b0c55];return _0x4ae957;};'use strict';var Sequelize=require(_0xb224('0x0'));module[_0xb224('0x1')]={'body':{'type':Sequelize[_0xb224('0x2')]},'senderName':{'type':Sequelize[_0xb224('0x3')]},'recipientsId':{'type':Sequelize[_0xb224('0x2')]},'recipientsDescription':{'type':Sequelize[_0xb224('0x3')]},'beep':{'type':Sequelize[_0xb224('0x4')]}}; \ No newline at end of file +var _0x6108=['TEXT','STRING','BOOLEAN','sequelize'];(function(_0x1103c4,_0x562d1d){var _0x1c19ab=function(_0x10e254){while(--_0x10e254){_0x1103c4['push'](_0x1103c4['shift']());}};_0x1c19ab(++_0x562d1d);}(_0x6108,0xe7));var _0x8610=function(_0x15e117,_0x1e2339){_0x15e117=_0x15e117-0x0;var _0x47420b=_0x6108[_0x15e117];return _0x47420b;};'use strict';var Sequelize=require(_0x8610('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x8610('0x1')]},'recipientsDescription':{'type':Sequelize[_0x8610('0x2')]},'beep':{'type':Sequelize[_0x8610('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index ccd0b84..a1d13aa 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 _0xb186=['user','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','text','Template','findOne','html','render','startCase','User','union','ids','includes','queue','replace','Queue','push','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','hasOwnProperty','body','TemplateId','ValidationError','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId'];(function(_0x56b385,_0x32d951){var _0x3c698e=function(_0x4fcdd3){while(--_0x4fcdd3){_0x56b385['push'](_0x56b385['shift']());}};_0x3c698e(++_0x32d951);}(_0xb186,0x1cb));var _0x6b18=function(_0x4f485f,_0x1db0f7){_0x4f485f=_0x4f485f-0x0;var _0x1e998e=_0xb186[_0x4f485f];return _0x1e998e;};'use strict';var emlformat=require(_0x6b18('0x0'));var rimraf=require(_0x6b18('0x1'));var zipdir=require(_0x6b18('0x2'));var jsonpatch=require(_0x6b18('0x3'));var rp=require(_0x6b18('0x4'));var moment=require(_0x6b18('0x5'));var BPromise=require(_0x6b18('0x6'));var Mustache=require(_0x6b18('0x7'));var util=require(_0x6b18('0x8'));var path=require('path');var sox=require(_0x6b18('0x9'));var csv=require('to-csv');var ejs=require(_0x6b18('0xa'));var fs=require('fs');var fs_extra=require(_0x6b18('0xb'));var _=require(_0x6b18('0xc'));var squel=require(_0x6b18('0xd'));var crypto=require(_0x6b18('0xe'));var jsforce=require(_0x6b18('0xf'));var deskjs=require(_0x6b18('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6b18('0x11'));var Papa=require(_0x6b18('0x12'));var Redis=require(_0x6b18('0x13'));var authService=require(_0x6b18('0x14'));var qs=require(_0x6b18('0x15'));var as=require(_0x6b18('0x16'));var hardwareService=require(_0x6b18('0x17'));var logger=require('../../config/logger')(_0x6b18('0x18'));var utils=require(_0x6b18('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x6b18('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x6b18('0x1b')](config[_0x6b18('0x1c')],{'host':_0x6b18('0x1d'),'port':0x18eb});var socket=require(_0x6b18('0x1e'))(new Redis(config[_0x6b18('0x1c')]));require(_0x6b18('0x1f'))[_0x6b18('0x20')](socket);function respondWithStatusCode(_0x3f3ca0,_0x149847){_0x149847=_0x149847||0xcc;return function(_0x25eddf){if(_0x25eddf){return _0x3f3ca0[_0x6b18('0x21')](_0x149847);}return _0x3f3ca0[_0x6b18('0x22')](_0x149847)['end']();};}function respondWithResult(_0x350e84,_0x2b92c2){_0x2b92c2=_0x2b92c2||0xc8;return function(_0x37b957){if(_0x37b957){return _0x350e84[_0x6b18('0x22')](_0x2b92c2)[_0x6b18('0x23')](_0x37b957);}};}function respondWithFilteredResult(_0x4dcfa3,_0x45e9d0){return function(_0xe32785){if(_0xe32785){var _0x2bc8bf=typeof _0x45e9d0[_0x6b18('0x24')]===_0x6b18('0x25')&&typeof _0x45e9d0['limit']===_0x6b18('0x25');var _0x14228d=_0xe32785['count'];var _0x142e32=_0x2bc8bf?0x0:_0x45e9d0[_0x6b18('0x24')];var _0x59df18=_0x2bc8bf?_0xe32785['count']:_0x45e9d0[_0x6b18('0x24')]+_0x45e9d0[_0x6b18('0x26')];var _0x35037a;if(_0x59df18>=_0x14228d){_0x59df18=_0x14228d;_0x35037a=0xc8;}else{_0x35037a=0xce;}_0x4dcfa3[_0x6b18('0x22')](_0x35037a);return _0x4dcfa3[_0x6b18('0x27')](_0x6b18('0x28'),_0x142e32+'-'+_0x59df18+'/'+_0x14228d)['json'](_0xe32785);}return null;};}function patchUpdates(_0x76ea2c){return function(_0x52e25b){try{jsonpatch[_0x6b18('0x29')](_0x52e25b,_0x76ea2c,!![]);}catch(_0x2e7d40){return BPromise[_0x6b18('0x2a')](_0x2e7d40);}return _0x52e25b[_0x6b18('0x2b')]();};}function saveUpdates(_0xced19d,_0x2c80bf){return function(_0x2c24a2){if(_0x2c24a2){return _0x2c24a2['update'](_0xced19d)[_0x6b18('0x2c')](function(_0x14f714){return _0x14f714;});}return null;};}function removeEntity(_0x5340d4,_0x408a2a){return function(_0x2673f1){if(_0x2673f1){return _0x2673f1[_0x6b18('0x2d')]()[_0x6b18('0x2c')](function(){_0x5340d4[_0x6b18('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x399b36,_0xa9d579){return function(_0xd5c8d6){if(!_0xd5c8d6){_0x399b36['sendStatus'](0x194);}return _0xd5c8d6;};}function handleError(_0x229601,_0x40bc0e){_0x40bc0e=_0x40bc0e||0x1f4;return function(_0x2938d5){logger[_0x6b18('0x2e')](_0x2938d5['stack']);if(_0x2938d5[_0x6b18('0x2f')]){delete _0x2938d5[_0x6b18('0x2f')];}_0x229601['status'](_0x40bc0e)[_0x6b18('0x30')](_0x2938d5);};}exports['sendUserNotification']=function(_0x72e104,_0xe715e4,_0x3a1939){if(!_0x72e104['body'][_0x6b18('0x31')]('text')&&!_0x72e104[_0x6b18('0x32')][_0x6b18('0x31')](_0x6b18('0x33'))){throw new db['Sequelize'][(_0x6b18('0x34'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x72e104[_0x6b18('0x32')]['hasOwnProperty'](_0x6b18('0x33'))&&!_0x72e104[_0x6b18('0x32')][_0x6b18('0x31')](_0x6b18('0x35'))){throw new db[(_0x6b18('0x36'))]['ValidationError'](_0x6b18('0x37'));}if(!_0x72e104['body']['hasOwnProperty'](_0x6b18('0x38'))){throw new db[(_0x6b18('0x36'))]['ValidationError'](_0x6b18('0x39'));}else{try{var _0x18918e=JSON[_0x6b18('0x3a')](_0x72e104[_0x6b18('0x32')][_0x6b18('0x38')]);}catch(_0x5f01e1){logger['error'](_0x5f01e1);throw new db[(_0x6b18('0x36'))][(_0x6b18('0x34'))](_0x6b18('0x3b'));}var _0xd890ff=[_0x6b18('0x3c'),'faxqueue',_0x6b18('0x3d'),_0x6b18('0x3e'),_0x6b18('0x3f'),_0x6b18('0x40'),_0x6b18('0x41'),_0x6b18('0x42'),'user'];if(_[_0x6b18('0x43')](_0x18918e,function(_0x4d817c){return!_['includes'](_0xd890ff,_0x4d817c[_0x6b18('0x44')][_0x6b18('0x45')]());})){throw new db[(_0x6b18('0x36'))][(_0x6b18('0x34'))](_0x6b18('0x46'));}}}var _0x1a5bd1={};_0x1a5bd1[_0x6b18('0x47')]=_0x72e104['body']['hasOwnProperty']('senderName')?_0x72e104[_0x6b18('0x32')][_0x6b18('0x47')]:_0x72e104['user']['fullname'];_0x1a5bd1[_0x6b18('0x48')]=_[_0x6b18('0x49')](_0x72e104[_0x6b18('0x32')][_0x6b18('0x48')])?null:_0x72e104[_0x6b18('0x32')]['recipientsDescription'];_0x1a5bd1[_0x6b18('0x4a')]=_0x72e104['body']['beep']||![];_0x1a5bd1[_0x6b18('0x4b')]=_0x72e104[_0x6b18('0x4c')]['id'];return getContent(_0x72e104[_0x6b18('0x32')])[_0x6b18('0x2c')](function(_0x21d00a){_0x1a5bd1[_0x6b18('0x32')]=_0x21d00a;return getRecipients(_0x18918e);})[_0x6b18('0x2c')](function(_0x410a94){_0x1a5bd1[_0x6b18('0x4d')]=_[_0x6b18('0x4e')](_0x410a94)[_0x6b18('0x4f')](',');return db[_0x6b18('0x50')][_0x6b18('0x51')](function(_0x4167c3){return db[_0x6b18('0x52')][_0x6b18('0x53')](_0x1a5bd1,{'raw':!![],'transaction':_0x4167c3})[_0x6b18('0x2c')](function(_0xcc47ed){var _0x3aa583={'sender':_0x1a5bd1[_0x6b18('0x47')],'description':_0x1a5bd1[_0x6b18('0x48')],'content':_0x1a5bd1['body'],'beep':_0x1a5bd1[_0x6b18('0x4a')]};_0x410a94[_0x6b18('0x54')](function(_0x460fdb){_0x3aa583[_0x6b18('0x55')]=_0x460fdb;socket[_0x6b18('0x56')](_0x6b18('0x57'),_0x3aa583);});return _0xcc47ed;});});})[_0x6b18('0x2c')](respondWithResult(_0xe715e4,0xc9))[_0x6b18('0x58')](handleError(_0xe715e4,null));};function getContent(_0x1f6e39){return new BPromise(function(_0x2fc049,_0x3e1f4c){if(_0x1f6e39[_0x6b18('0x59')]){_0x2fc049(_0x1f6e39[_0x6b18('0x59')]);return;}return db[_0x6b18('0x5a')][_0x6b18('0x5b')]({'attributes':[_0x6b18('0x5c')],'where':{'id':_0x1f6e39['TemplateId']},'raw':!![]})[_0x6b18('0x2c')](function(_0x2d7c1a){if(!_0x2d7c1a)throw new db[(_0x6b18('0x36'))][(_0x6b18('0x34'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x5e77a4=Mustache[_0x6b18('0x5d')](_0x2d7c1a[_0x6b18('0x5c')],_0x1f6e39[_0x6b18('0x35')]);_0x2fc049(_0x5e77a4);})[_0x6b18('0x58')](function(_0x40d1b3){_0x3e1f4c(_0x40d1b3);});});}function getRecipients(_0x272efc){return new BPromise(function(_0x72e750,_0x11c4b4){var _0xb49ca0=[];var _0x3833c5=[];_0x272efc[_0x6b18('0x54')](function(_0x5c6cca){var _0x187400=_[_0x6b18('0x5e')](_0x5c6cca[_0x6b18('0x44')][_0x6b18('0x45')]());if(_0x187400===_0x6b18('0x5f')){_0xb49ca0=_[_0x6b18('0x60')](_0xb49ca0,_0x5c6cca[_0x6b18('0x61')]);}else{if(_[_0x6b18('0x62')](_0x187400,_0x6b18('0x63')))_0x187400=_0x187400[_0x6b18('0x64')](_0x6b18('0x63'),_0x6b18('0x65'));_0x5c6cca['ids'][_0x6b18('0x54')](function(_0x69b565){_0x3833c5[_0x6b18('0x66')](getAgents(_0x187400,_0x69b565));});}});return BPromise[_0x6b18('0x67')](_0x3833c5)['then'](function(_0x442c94){_0xb49ca0=_[_0x6b18('0x60')](_0xb49ca0,_[_0x6b18('0x68')](_0x442c94));_0x72e750(_0xb49ca0);})['catch'](function(_0x13ea8d){_0x11c4b4(_0x13ea8d);});});}function getAgents(_0x13e9a6,_0x550ad2){return new BPromise(function(_0x348d50,_0x5942ed){return db[_0x13e9a6]['findOne']({'where':{'id':_0x550ad2}})[_0x6b18('0x2c')](function(_0x7ffed8){return _0x7ffed8[_0x6b18('0x69')]({'attributes':['id'],'raw':!![]})[_0x6b18('0x2c')](function(_0x50a42d){var _0x5ed068=_[_0x6b18('0x6a')](_0x50a42d,'id');_0x348d50(_0x5ed068);});})[_0x6b18('0x58')](function(_0x1823b6){_0x5942ed(_0x1823b6);});});} \ No newline at end of file +var _0x2ada=['sequelize','transaction','create','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','ids','queue','Queue','push','all','union','flatten','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','ejs','fs-extra','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','offset','undefined','count','limit','apply','reject','then','destroy','end','error','name','send','sendUserNotification','hasOwnProperty','text','body','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27view\x27\x20parameter','ValidationError','Missing\x20\x27recipients\x27\x20parameter','recipients','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','isEmpty','recipientsDescription','beep','recipientsId','sortBy'];(function(_0x3738ad,_0x4e25ae){var _0x253a25=function(_0x31954a){while(--_0x31954a){_0x3738ad['push'](_0x3738ad['shift']());}};_0x253a25(++_0x4e25ae);}(_0x2ada,0xcc));var _0xa2ad=function(_0x5224ba,_0x3fb4e1){_0x5224ba=_0x5224ba-0x0;var _0x459bd2=_0x2ada[_0x5224ba];return _0x459bd2;};'use strict';var emlformat=require(_0xa2ad('0x0'));var rimraf=require(_0xa2ad('0x1'));var zipdir=require(_0xa2ad('0x2'));var jsonpatch=require(_0xa2ad('0x3'));var rp=require(_0xa2ad('0x4'));var moment=require(_0xa2ad('0x5'));var BPromise=require(_0xa2ad('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa2ad('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa2ad('0x8'));var fs=require('fs');var fs_extra=require(_0xa2ad('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa2ad('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa2ad('0xb'));var Redis=require('ioredis');var authService=require(_0xa2ad('0xc'));var qs=require(_0xa2ad('0xd'));var as=require(_0xa2ad('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2ad('0xf'))(_0xa2ad('0x10'));var utils=require(_0xa2ad('0x11'));var config=require(_0xa2ad('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xa2ad('0x13'))['db'];config[_0xa2ad('0x14')]=_['defaults'](config[_0xa2ad('0x14')],{'host':_0xa2ad('0x15'),'port':0x18eb});var socket=require(_0xa2ad('0x16'))(new Redis(config[_0xa2ad('0x14')]));require(_0xa2ad('0x17'))[_0xa2ad('0x18')](socket);function respondWithStatusCode(_0x427f78,_0x4f4c5a){_0x4f4c5a=_0x4f4c5a||0xcc;return function(_0x149adc){if(_0x149adc){return _0x427f78[_0xa2ad('0x19')](_0x4f4c5a);}return _0x427f78[_0xa2ad('0x1a')](_0x4f4c5a)['end']();};}function respondWithResult(_0x1b735f,_0x70a05a){_0x70a05a=_0x70a05a||0xc8;return function(_0x2bda0d){if(_0x2bda0d){return _0x1b735f['status'](_0x70a05a)[_0xa2ad('0x1b')](_0x2bda0d);}};}function respondWithFilteredResult(_0x380346,_0xe9e8a7){return function(_0x3056a9){if(_0x3056a9){var _0x3ff3cc=typeof _0xe9e8a7[_0xa2ad('0x1c')]===_0xa2ad('0x1d')&&typeof _0xe9e8a7['limit']===_0xa2ad('0x1d');var _0x11b06d=_0x3056a9[_0xa2ad('0x1e')];var _0x26c4ad=_0x3ff3cc?0x0:_0xe9e8a7[_0xa2ad('0x1c')];var _0x41a3a5=_0x3ff3cc?_0x3056a9['count']:_0xe9e8a7[_0xa2ad('0x1c')]+_0xe9e8a7[_0xa2ad('0x1f')];var _0x43bdfa;if(_0x41a3a5>=_0x11b06d){_0x41a3a5=_0x11b06d;_0x43bdfa=0xc8;}else{_0x43bdfa=0xce;}_0x380346['status'](_0x43bdfa);return _0x380346['set']('Content-Range',_0x26c4ad+'-'+_0x41a3a5+'/'+_0x11b06d)['json'](_0x3056a9);}return null;};}function patchUpdates(_0x13366c){return function(_0x11fff4){try{jsonpatch[_0xa2ad('0x20')](_0x11fff4,_0x13366c,!![]);}catch(_0x254a7f){return BPromise[_0xa2ad('0x21')](_0x254a7f);}return _0x11fff4['save']();};}function saveUpdates(_0x5922dc,_0x4c9383){return function(_0x4c695b){if(_0x4c695b){return _0x4c695b['update'](_0x5922dc)[_0xa2ad('0x22')](function(_0x77ac47){return _0x77ac47;});}return null;};}function removeEntity(_0x7ac16f,_0x4d5d7d){return function(_0x4ca74c){if(_0x4ca74c){return _0x4ca74c[_0xa2ad('0x23')]()['then'](function(){_0x7ac16f[_0xa2ad('0x1a')](0xcc)[_0xa2ad('0x24')]();});}};}function handleEntityNotFound(_0xc3939f,_0x5de522){return function(_0x2e6c7f){if(!_0x2e6c7f){_0xc3939f[_0xa2ad('0x19')](0x194);}return _0x2e6c7f;};}function handleError(_0x388235,_0x2f04e3){_0x2f04e3=_0x2f04e3||0x1f4;return function(_0x499dfb){logger[_0xa2ad('0x25')](_0x499dfb['stack']);if(_0x499dfb[_0xa2ad('0x26')]){delete _0x499dfb[_0xa2ad('0x26')];}_0x388235[_0xa2ad('0x1a')](_0x2f04e3)[_0xa2ad('0x27')](_0x499dfb);};}exports[_0xa2ad('0x28')]=function(_0x4e1d6e,_0x153a4b,_0x483dae){if(!_0x4e1d6e['body'][_0xa2ad('0x29')](_0xa2ad('0x2a'))&&!_0x4e1d6e[_0xa2ad('0x2b')]['hasOwnProperty']('TemplateId')){throw new db[(_0xa2ad('0x2c'))]['ValidationError'](_0xa2ad('0x2d'));}else{if(_0x4e1d6e['body'][_0xa2ad('0x29')](_0xa2ad('0x2e'))&&!_0x4e1d6e[_0xa2ad('0x2b')][_0xa2ad('0x29')](_0xa2ad('0x2f'))){throw new db['Sequelize']['ValidationError'](_0xa2ad('0x30'));}if(!_0x4e1d6e[_0xa2ad('0x2b')][_0xa2ad('0x29')]('recipients')){throw new db[(_0xa2ad('0x2c'))][(_0xa2ad('0x31'))](_0xa2ad('0x32'));}else{try{var _0xbdcd1a=JSON['parse'](_0x4e1d6e['body'][_0xa2ad('0x33')]);}catch(_0x3ccfdc){logger['error'](_0x3ccfdc);throw new db[(_0xa2ad('0x2c'))][(_0xa2ad('0x31'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x3eb38d=[_0xa2ad('0x34'),_0xa2ad('0x35'),_0xa2ad('0x36'),_0xa2ad('0x37'),'smsqueue',_0xa2ad('0x38'),_0xa2ad('0x39'),_0xa2ad('0x3a'),'user'];if(_[_0xa2ad('0x3b')](_0xbdcd1a,function(_0x38e906){return!_[_0xa2ad('0x3c')](_0x3eb38d,_0x38e906[_0xa2ad('0x3d')][_0xa2ad('0x3e')]());})){throw new db[(_0xa2ad('0x2c'))]['ValidationError'](_0xa2ad('0x3f'));}}}var _0x1a7df2={};_0x1a7df2['senderName']=_0x4e1d6e[_0xa2ad('0x2b')][_0xa2ad('0x29')](_0xa2ad('0x40'))?_0x4e1d6e['body'][_0xa2ad('0x40')]:_0x4e1d6e[_0xa2ad('0x41')][_0xa2ad('0x42')];_0x1a7df2['recipientsDescription']=_[_0xa2ad('0x43')](_0x4e1d6e['body'][_0xa2ad('0x44')])?null:_0x4e1d6e['body'][_0xa2ad('0x44')];_0x1a7df2[_0xa2ad('0x45')]=_0x4e1d6e[_0xa2ad('0x2b')][_0xa2ad('0x45')]||![];_0x1a7df2['SenderId']=_0x4e1d6e[_0xa2ad('0x41')]['id'];return getContent(_0x4e1d6e[_0xa2ad('0x2b')])[_0xa2ad('0x22')](function(_0x1263c6){_0x1a7df2[_0xa2ad('0x2b')]=_0x1263c6;return getRecipients(_0xbdcd1a);})[_0xa2ad('0x22')](function(_0x48feec){_0x1a7df2[_0xa2ad('0x46')]=_[_0xa2ad('0x47')](_0x48feec)['join'](',');return db[_0xa2ad('0x48')][_0xa2ad('0x49')](function(_0x2296d4){return db['UserNotification'][_0xa2ad('0x4a')](_0x1a7df2,{'raw':!![],'transaction':_0x2296d4})[_0xa2ad('0x22')](function(_0x5864d3){var _0x2944be={'sender':_0x1a7df2[_0xa2ad('0x40')],'description':_0x1a7df2[_0xa2ad('0x44')],'content':_0x1a7df2[_0xa2ad('0x2b')],'beep':_0x1a7df2[_0xa2ad('0x45')]};_0x48feec['forEach'](function(_0xfdf834){_0x2944be[_0xa2ad('0x4b')]=_0xfdf834;socket[_0xa2ad('0x4c')](_0xa2ad('0x4d'),_0x2944be);});return _0x5864d3;});});})['then'](respondWithResult(_0x153a4b,0xc9))[_0xa2ad('0x4e')](handleError(_0x153a4b,null));};function getContent(_0x5edcd0){return new BPromise(function(_0x452c33,_0x3726f2){if(_0x5edcd0[_0xa2ad('0x2a')]){_0x452c33(_0x5edcd0[_0xa2ad('0x2a')]);return;}return db[_0xa2ad('0x4f')][_0xa2ad('0x50')]({'attributes':[_0xa2ad('0x51')],'where':{'id':_0x5edcd0[_0xa2ad('0x2e')]},'raw':!![]})[_0xa2ad('0x22')](function(_0x31c5a7){if(!_0x31c5a7)throw new db[(_0xa2ad('0x2c'))][(_0xa2ad('0x31'))](_0xa2ad('0x52'));var _0x426ba9=Mustache['render'](_0x31c5a7[_0xa2ad('0x51')],_0x5edcd0[_0xa2ad('0x2f')]);_0x452c33(_0x426ba9);})[_0xa2ad('0x4e')](function(_0x447609){_0x3726f2(_0x447609);});});}function getRecipients(_0x369add){return new BPromise(function(_0x3e3977,_0x268ec5){var _0x4bdad2=[];var _0x4298b2=[];_0x369add['forEach'](function(_0x314ca3){var _0x1f1298=_[_0xa2ad('0x53')](_0x314ca3['model'][_0xa2ad('0x3e')]());if(_0x1f1298==='User'){_0x4bdad2=_['union'](_0x4bdad2,_0x314ca3[_0xa2ad('0x54')]);}else{if(_[_0xa2ad('0x3c')](_0x1f1298,_0xa2ad('0x55')))_0x1f1298=_0x1f1298['replace'](_0xa2ad('0x55'),_0xa2ad('0x56'));_0x314ca3[_0xa2ad('0x54')]['forEach'](function(_0x4be5fd){_0x4298b2[_0xa2ad('0x57')](getAgents(_0x1f1298,_0x4be5fd));});}});return BPromise[_0xa2ad('0x58')](_0x4298b2)[_0xa2ad('0x22')](function(_0x94b7a9){_0x4bdad2=_[_0xa2ad('0x59')](_0x4bdad2,_[_0xa2ad('0x5a')](_0x94b7a9));_0x3e3977(_0x4bdad2);})[_0xa2ad('0x4e')](function(_0x3dd645){_0x268ec5(_0x3dd645);});});}function getAgents(_0xfb1947,_0xaf2fe2){return new BPromise(function(_0x1d3b39,_0xab45ca){return db[_0xfb1947][_0xa2ad('0x50')]({'where':{'id':_0xaf2fe2}})[_0xa2ad('0x22')](function(_0x4fe609){return _0x4fe609['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x33d9d9){var _0x2efd97=_[_0xa2ad('0x5b')](_0x33d9d9,'id');_0x1d3b39(_0x2efd97);});})[_0xa2ad('0x4e')](function(_0x142394){_0xab45ca(_0x142394);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index b5c2b84..8a328cd 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 _0x7a67=['hook','exports','events','../../mysqldb','UserNotification','remove','emit','hasOwnProperty'];(function(_0x3485f8,_0x1b66cf){var _0x1fbba7=function(_0x135b73){while(--_0x135b73){_0x3485f8['push'](_0x3485f8['shift']());}};_0x1fbba7(++_0x1b66cf);}(_0x7a67,0xb2));var _0x77a6=function(_0x375837,_0x5bf426){_0x375837=_0x375837-0x0;var _0x3603cc=_0x7a67[_0x375837];return _0x3603cc;};'use strict';var EventEmitter=require(_0x77a6('0x0'));var UserNotification=require(_0x77a6('0x1'))['db'][_0x77a6('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x77a6('0x3')};function emitEvent(_0x4e5025){return function(_0x406c25,_0x1a9f46,_0x5e0d17){UserNotificationEvents[_0x77a6('0x4')](_0x4e5025+':'+_0x406c25['id'],_0x406c25);UserNotificationEvents[_0x77a6('0x4')](_0x4e5025,_0x406c25);_0x5e0d17(null);};}for(var e in events){if(events[_0x77a6('0x5')](e)){var event=events[e];UserNotification[_0x77a6('0x6')](e,emitEvent(event));}}module[_0x77a6('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x7609=['exports','events','../../mysqldb','UserNotification','setMaxListeners','update','hasOwnProperty','hook'];(function(_0x2cb702,_0x4d0358){var _0x547a9e=function(_0x212d8a){while(--_0x212d8a){_0x2cb702['push'](_0x2cb702['shift']());}};_0x547a9e(++_0x4d0358);}(_0x7609,0x179));var _0x9760=function(_0x264f48,_0x2c82d8){_0x264f48=_0x264f48-0x0;var _0xb99167=_0x7609[_0x264f48];return _0xb99167;};'use strict';var EventEmitter=require(_0x9760('0x0'));var UserNotification=require(_0x9760('0x1'))['db'][_0x9760('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x9760('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9760('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1096aa){return function(_0x2d47c0,_0x5c80be,_0x35b530){UserNotificationEvents['emit'](_0x1096aa+':'+_0x2d47c0['id'],_0x2d47c0);UserNotificationEvents['emit'](_0x1096aa,_0x2d47c0);_0x35b530(null);};}for(var e in events){if(events[_0x9760('0x5')](e)){var event=events[e];UserNotification[_0x9760('0x6')](e,emitEvent(event));}}module[_0x9760('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index fdb9b7c..742f942 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 _0x6c82=['bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4_unicode_ci','lodash','util','moment'];(function(_0x5aada8,_0x460a35){var _0xf5247e=function(_0x507709){while(--_0x507709){_0x5aada8['push'](_0x5aada8['shift']());}};_0xf5247e(++_0x460a35);}(_0x6c82,0x1af));var _0x26c8=function(_0x2500f8,_0x5555e6){_0x2500f8=_0x2500f8-0x0;var _0x48c522=_0x6c82[_0x2500f8];return _0x48c522;};'use strict';var _=require(_0x26c8('0x0'));var util=require(_0x26c8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x26c8('0x2'));var BPromise=require(_0x26c8('0x3'));var rp=require(_0x26c8('0x4'));var fs=require('fs');var path=require(_0x26c8('0x5'));var rimraf=require(_0x26c8('0x6'));var config=require(_0x26c8('0x7'));var attributes=require(_0x26c8('0x8'));module[_0x26c8('0x9')]=function(_0x365dbf,_0x3d7772){return _0x365dbf[_0x26c8('0xa')](_0x26c8('0xb'),attributes,{'tableName':_0x26c8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x26c8('0xd')});}; \ No newline at end of file +var _0xbc6e=['rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','path'];(function(_0x49a57c,_0x2eb02c){var _0x4e0316=function(_0x37e2e5){while(--_0x37e2e5){_0x49a57c['push'](_0x49a57c['shift']());}};_0x4e0316(++_0x2eb02c);}(_0xbc6e,0x1ad));var _0xebc6=function(_0x5f186e,_0x2c32ef){_0x5f186e=_0x5f186e-0x0;var _0x5afb65=_0xbc6e[_0x5f186e];return _0x5afb65;};'use strict';var _=require(_0xebc6('0x0'));var util=require(_0xebc6('0x1'));var logger=require('../../config/logger')(_0xebc6('0x2'));var moment=require('moment');var BPromise=require(_0xebc6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xebc6('0x4'));var rimraf=require(_0xebc6('0x5'));var config=require(_0xebc6('0x6'));var attributes=require(_0xebc6('0x7'));module[_0xebc6('0x8')]=function(_0x40525e,_0x5d46a8){return _0x40525e[_0xebc6('0x9')](_0xebc6('0xa'),attributes,{'tableName':_0xebc6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xebc6('0xc'),'collate':_0xebc6('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index b3892c0..951a318 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 _0xbff2=['UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','register','request','then','info'];(function(_0x48cce0,_0x366a85){var _0x3fc225=function(_0x2d3012){while(--_0x2d3012){_0x48cce0['push'](_0x48cce0['shift']());}};_0x3fc225(++_0x366a85);}(_0xbff2,0xeb));var _0x2bff=function(_0x33efef,_0x4fac86){_0x33efef=_0x33efef-0x0;var _0x39e1dd=_0xbff2[_0x33efef];return _0x39e1dd;};'use strict';var _=require(_0x2bff('0x0'));var util=require('util');var moment=require(_0x2bff('0x1'));var BPromise=require(_0x2bff('0x2'));var rs=require(_0x2bff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2bff('0x4'));var logger=require(_0x2bff('0x5'))(_0x2bff('0x6'));var config=require('../../config/environment');var jayson=require(_0x2bff('0x7'));var client=jayson[_0x2bff('0x8')]['http']({'port':0x232a});config[_0x2bff('0x9')]=_['defaults'](config[_0x2bff('0x9')],{'host':_0x2bff('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2bff('0x9')]));require('./userNotification.socket')[_0x2bff('0xb')](socket);function respondWithRpcPromise(_0x5a7432,_0x33523c,_0x5c3e6d){return new BPromise(function(_0x42fd22,_0x8a7b79){return client[_0x2bff('0xc')](_0x5a7432,_0x5c3e6d)[_0x2bff('0xd')](function(_0x40cd4b){logger[_0x2bff('0xe')](_0x2bff('0xf'),_0x33523c,'request\x20sent');logger[_0x2bff('0x10')](_0x2bff('0x11'),_0x33523c,_0x2bff('0x12'),JSON[_0x2bff('0x13')](_0x40cd4b));if(_0x40cd4b[_0x2bff('0x14')]){if(_0x40cd4b[_0x2bff('0x14')][_0x2bff('0x15')]===0x1f4){logger['error'](_0x2bff('0xf'),_0x33523c,_0x40cd4b[_0x2bff('0x14')]['message']);return _0x8a7b79(_0x40cd4b['error'][_0x2bff('0x16')]);}logger[_0x2bff('0x14')](_0x2bff('0xf'),_0x33523c,_0x40cd4b[_0x2bff('0x14')][_0x2bff('0x16')]);return _0x42fd22(_0x40cd4b['error'][_0x2bff('0x16')]);}else{logger[_0x2bff('0xe')](_0x2bff('0xf'),_0x33523c,'request\x20sent');_0x42fd22(_0x40cd4b[_0x2bff('0x17')][_0x2bff('0x16')]);}})[_0x2bff('0x18')](function(_0x552101){logger['error'](_0x2bff('0xf'),_0x33523c,_0x552101);_0x8a7b79(_0x552101);});});} \ No newline at end of file +var _0xdbf0=['error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2c24b8,_0x168e0b){var _0x563ed6=function(_0x7c1aa9){while(--_0x7c1aa9){_0x2c24b8['push'](_0x2c24b8['shift']());}};_0x563ed6(++_0x168e0b);}(_0xdbf0,0x127));var _0x0dbf=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xdbf0[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x0dbf('0x0'));var util=require(_0x0dbf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0dbf('0x2'));var fs=require('fs');var Redis=require(_0x0dbf('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0dbf('0x4'))(_0x0dbf('0x5'));var config=require(_0x0dbf('0x6'));var jayson=require(_0x0dbf('0x7'));var client=jayson[_0x0dbf('0x8')][_0x0dbf('0x9')]({'port':0x232a});config[_0x0dbf('0xa')]=_[_0x0dbf('0xb')](config['redis'],{'host':_0x0dbf('0xc'),'port':0x18eb});var socket=require(_0x0dbf('0xd'))(new Redis(config['redis']));require(_0x0dbf('0xe'))[_0x0dbf('0xf')](socket);function respondWithRpcPromise(_0x46f432,_0x24fdd3,_0x4c5147){return new BPromise(function(_0x1b3a9c,_0x51ffb9){return client[_0x0dbf('0x10')](_0x46f432,_0x4c5147)[_0x0dbf('0x11')](function(_0x3b2179){logger[_0x0dbf('0x12')](_0x0dbf('0x13'),_0x24fdd3,'request\x20sent');logger[_0x0dbf('0x14')](_0x0dbf('0x15'),_0x24fdd3,_0x0dbf('0x16'),JSON[_0x0dbf('0x17')](_0x3b2179));if(_0x3b2179[_0x0dbf('0x18')]){if(_0x3b2179[_0x0dbf('0x18')][_0x0dbf('0x19')]===0x1f4){logger[_0x0dbf('0x18')]('UserNotification,\x20%s,\x20%s',_0x24fdd3,_0x3b2179[_0x0dbf('0x18')][_0x0dbf('0x1a')]);return _0x51ffb9(_0x3b2179['error'][_0x0dbf('0x1a')]);}logger['error'](_0x0dbf('0x13'),_0x24fdd3,_0x3b2179['error'][_0x0dbf('0x1a')]);return _0x1b3a9c(_0x3b2179[_0x0dbf('0x18')][_0x0dbf('0x1a')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x24fdd3,_0x0dbf('0x16'));_0x1b3a9c(_0x3b2179[_0x0dbf('0x1b')][_0x0dbf('0x1a')]);}})[_0x0dbf('0x1c')](function(_0x3d84bb){logger[_0x0dbf('0x18')](_0x0dbf('0x13'),_0x24fdd3,_0x3d84bb);_0x51ffb9(_0x3d84bb);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 7fbceac..7993e71 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 _0xa869=['emit','register','userNotification:','./userNotification.events','remove'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0xa869,0xd0));var _0x9a86=function(_0x299685,_0x33ad00){_0x299685=_0x299685-0x0;var _0x2d6872=_0xa869[_0x299685];return _0x2d6872;};'use strict';var UserNotificationEvents=require(_0x9a86('0x0'));var events=['save',_0x9a86('0x1'),'update'];function createListener(_0x4cb87a,_0x1d1e0c){return function(_0x5ce23a){_0x1d1e0c[_0x9a86('0x2')](_0x4cb87a,_0x5ce23a);};}function removeListener(_0x7ffdf3,_0x21ddaa){return function(){UserNotificationEvents['removeListener'](_0x7ffdf3,_0x21ddaa);};}exports[_0x9a86('0x3')]=function(_0x52ddcd){for(var _0x381569=0x0,_0x558feb=events['length'];_0x381569<_0x558feb;_0x381569++){var _0x405d80=events[_0x381569];var _0x1fae81=createListener(_0x9a86('0x4')+_0x405d80,_0x52ddcd);UserNotificationEvents['on'](_0x405d80,_0x1fae81);}}; \ No newline at end of file +var _0xa74a=['save','remove','emit','register','length','userNotification:'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xa74a,0x138));var _0xaa74=function(_0x57170c,_0x11ff52){_0x57170c=_0x57170c-0x0;var _0x1c4470=_0xa74a[_0x57170c];return _0x1c4470;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xaa74('0x0'),_0xaa74('0x1'),'update'];function createListener(_0x5953e2,_0x218a28){return function(_0x1c568d){_0x218a28[_0xaa74('0x2')](_0x5953e2,_0x1c568d);};}function removeListener(_0x20a0f3,_0x4a2595){return function(){UserNotificationEvents['removeListener'](_0x20a0f3,_0x4a2595);};}exports[_0xaa74('0x3')]=function(_0x511f78){for(var _0x50af62=0x0,_0x323827=events[_0xaa74('0x4')];_0x50af62<_0x323827;_0x50af62++){var _0x51e5b4=events[_0x50af62];var _0x39d168=createListener(_0xaa74('0x5')+_0x51e5b4,_0x511f78);UserNotificationEvents['on'](_0x51e5b4,_0x39d168);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 034156f..60705f5 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x721e8b,_0x5e679d){var _0x3a0b53=function(_0x1b3fd3){while(--_0x1b3fd3){_0x721e8b['push'](_0x721e8b['shift']());}};_0x3a0b53(++_0x5e679d);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x19997d,_0x2c92a4){var _0x49be7f=function(_0x2e5d31){while(--_0x2e5d31){_0x19997d['push'](_0x19997d['shift']());}};_0x49be7f(++_0x2c92a4);}(_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');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 8efe094..95bc2c7 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 _0x9ee5=['sequelize','exports','INTEGER'];(function(_0x3da143,_0x71b28b){var _0x299878=function(_0x7a98b1){while(--_0x7a98b1){_0x3da143['push'](_0x3da143['shift']());}};_0x299878(++_0x71b28b);}(_0x9ee5,0x123));var _0x59ee=function(_0x1fa295,_0x401efb){_0x1fa295=_0x1fa295-0x0;var _0x3dff47=_0x9ee5[_0x1fa295];return _0x3dff47;};'use strict';var Sequelize=require(_0x59ee('0x0'));module[_0x59ee('0x1')]={'penalty':{'type':Sequelize[_0x59ee('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6fd5=['sequelize','INTEGER'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x6fd5,0xf0));var _0x56fd=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6fd5[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x56fd('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x56fd('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index ceaa235..ca7856f 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 _0xb6a4=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xb6a4,0x180));var _0x4b6a=function(_0x414d5b,_0x31bb7f){_0x414d5b=_0x414d5b-0x0;var _0x3e20be=_0xb6a4[_0x414d5b];return _0x3e20be;};'use strict';var _=require(_0x4b6a('0x0'));var util=require(_0x4b6a('0x1'));var logger=require(_0x4b6a('0x2'))(_0x4b6a('0x3'));var moment=require(_0x4b6a('0x4'));var BPromise=require('bluebird');var rp=require(_0x4b6a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4b6a('0x6'));var config=require(_0x4b6a('0x7'));var attributes=require(_0x4b6a('0x8'));module[_0x4b6a('0x9')]=function(_0x16fa2c,_0x1800bd){return _0x16fa2c[_0x4b6a('0xa')](_0x4b6a('0xb'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf23=['util','../../config/logger','api','moment','bluebird','request-promise','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','lodash'];(function(_0x2f6d38,_0xb5ec7a){var _0xb4ceb1=function(_0x49b37c){while(--_0x49b37c){_0x2f6d38['push'](_0x2f6d38['shift']());}};_0xb4ceb1(++_0xb5ec7a);}(_0xdf23,0xef));var _0x3df2=function(_0x8aefe0,_0x2fe240){_0x8aefe0=_0x8aefe0-0x0;var _0x23c98d=_0xdf23[_0x8aefe0];return _0x23c98d;};'use strict';var _=require(_0x3df2('0x0'));var util=require(_0x3df2('0x1'));var logger=require(_0x3df2('0x2'))(_0x3df2('0x3'));var moment=require(_0x3df2('0x4'));var BPromise=require(_0x3df2('0x5'));var rp=require(_0x3df2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3df2('0x7'));module[_0x3df2('0x8')]=function(_0x365154,_0x5c1b0d){return _0x365154['define'](_0x3df2('0x9'),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 f94f372..0b006b8 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 _0x8b4b=['request\x20sent','error','code','message','result','catch','util','moment','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8b4b,0x16b));var _0xb8b4=function(_0x275114,_0x41fed3){_0x275114=_0x275114-0x0;var _0x234bb7=_0x8b4b[_0x275114];return _0x234bb7;};'use strict';var _=require('lodash');var util=require(_0xb8b4('0x0'));var moment=require(_0xb8b4('0x1'));var BPromise=require('bluebird');var rs=require(_0xb8b4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb8b4('0x3'))(_0xb8b4('0x4'));var config=require('../../config/environment');var jayson=require(_0xb8b4('0x5'));var client=jayson[_0xb8b4('0x6')][_0xb8b4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x43c26a,_0x13fffb,_0x4e58c4){return new BPromise(function(_0x7a4e7e,_0x26133c){return client[_0xb8b4('0x8')](_0x43c26a,_0x4e58c4)['then'](function(_0xca9687){logger[_0xb8b4('0x9')](_0xb8b4('0xa'),_0x13fffb,'request\x20sent');logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x13fffb,_0xb8b4('0xb'),JSON['stringify'](_0xca9687));if(_0xca9687[_0xb8b4('0xc')]){if(_0xca9687[_0xb8b4('0xc')][_0xb8b4('0xd')]===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x13fffb,_0xca9687['error'][_0xb8b4('0xe')]);return _0x26133c(_0xca9687[_0xb8b4('0xc')][_0xb8b4('0xe')]);}logger[_0xb8b4('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x13fffb,_0xca9687[_0xb8b4('0xc')][_0xb8b4('0xe')]);return _0x7a4e7e(_0xca9687[_0xb8b4('0xc')][_0xb8b4('0xe')]);}else{logger[_0xb8b4('0x9')](_0xb8b4('0xa'),_0x13fffb,'request\x20sent');_0x7a4e7e(_0xca9687[_0xb8b4('0xf')][_0xb8b4('0xe')]);}})[_0xb8b4('0x10')](function(_0x58bfa4){logger[_0xb8b4('0xc')](_0xb8b4('0xa'),_0x13fffb,_0x58bfa4);_0x26133c(_0x58bfa4);});});} \ No newline at end of file +var _0x1619=['rpc','../../config/environment','jayson/promise','then','info','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UserOpenchannelQueue,\x20%s,\x20%s','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x13fc18,_0x19f182){var _0x20a135=function(_0x593524){while(--_0x593524){_0x13fc18['push'](_0x13fc18['shift']());}};_0x20a135(++_0x19f182);}(_0x1619,0x19e));var _0x9161=function(_0x56a387,_0x434fda){_0x56a387=_0x56a387-0x0;var _0x481a29=_0x1619[_0x56a387];return _0x481a29;};'use strict';var _=require(_0x9161('0x0'));var util=require(_0x9161('0x1'));var moment=require('moment');var BPromise=require(_0x9161('0x2'));var rs=require(_0x9161('0x3'));var fs=require('fs');var Redis=require(_0x9161('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9161('0x5'));var logger=require('../../config/logger')(_0x9161('0x6'));var config=require(_0x9161('0x7'));var jayson=require(_0x9161('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d85d2,_0x466879,_0x3a3621){return new BPromise(function(_0x1c0285,_0x4800ae){return client['request'](_0x1d85d2,_0x3a3621)[_0x9161('0x9')](function(_0x4c9b85){logger[_0x9161('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x466879,'request\x20sent');logger[_0x9161('0xb')](_0x9161('0xc'),_0x466879,_0x9161('0xd'),JSON[_0x9161('0xe')](_0x4c9b85));if(_0x4c9b85['error']){if(_0x4c9b85[_0x9161('0xf')][_0x9161('0x10')]===0x1f4){logger[_0x9161('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x466879,_0x4c9b85['error'][_0x9161('0x11')]);return _0x4800ae(_0x4c9b85[_0x9161('0xf')][_0x9161('0x11')]);}logger['error'](_0x9161('0x12'),_0x466879,_0x4c9b85[_0x9161('0xf')]['message']);return _0x1c0285(_0x4c9b85[_0x9161('0xf')]['message']);}else{logger[_0x9161('0xa')](_0x9161('0x12'),_0x466879,_0x9161('0xd'));_0x1c0285(_0x4c9b85[_0x9161('0x13')]['message']);}})['catch'](function(_0x31eea7){logger[_0x9161('0xf')](_0x9161('0x12'),_0x466879,_0x31eea7);_0x4800ae(_0x31eea7);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 6db7b69..1572bce 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 _0xb682=['delete','destroy','removeSections','removeResources','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getSections','/:id/resources','post','create','/:id/clone','clone','/:id/sections','addSections','addResources','put','update'];(function(_0x47449c,_0x489b7c){var _0x3fc32=function(_0x19a380){while(--_0x19a380){_0x47449c['push'](_0x47449c['shift']());}};_0x3fc32(++_0x489b7c);}(_0xb682,0x1c5));var _0x2b68=function(_0x4bd385,_0x3a3e0a){_0x4bd385=_0x4bd385-0x0;var _0x3bbd36=_0xb682[_0x4bd385];return _0x3bbd36;};'use strict';var multer=require(_0x2b68('0x0'));var util=require('util');var path=require(_0x2b68('0x1'));var timeout=require(_0x2b68('0x2'));var express=require('express');var router=express[_0x2b68('0x3')]();var fs_extra=require(_0x2b68('0x4'));var auth=require(_0x2b68('0x5'));var interaction=require(_0x2b68('0x6'));var config=require(_0x2b68('0x7'));var controller=require(_0x2b68('0x8'));router[_0x2b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x2b68('0xa')]);router['get'](_0x2b68('0xb'),auth[_0x2b68('0xc')](),controller[_0x2b68('0xd')]);router[_0x2b68('0x9')](_0x2b68('0xe'),auth[_0x2b68('0xc')](),controller[_0x2b68('0xf')]);router[_0x2b68('0x9')]('/:id/sections',auth[_0x2b68('0xc')](),controller[_0x2b68('0x10')]);router[_0x2b68('0x9')](_0x2b68('0x11'),auth[_0x2b68('0xc')](),controller['getResources']);router[_0x2b68('0x12')]('/',auth[_0x2b68('0xc')](),controller[_0x2b68('0x13')]);router[_0x2b68('0x12')](_0x2b68('0x14'),auth[_0x2b68('0xc')](),controller[_0x2b68('0x15')]);router[_0x2b68('0x12')](_0x2b68('0x16'),auth['isAuthenticated'](),controller[_0x2b68('0x17')]);router[_0x2b68('0x12')](_0x2b68('0x11'),auth[_0x2b68('0xc')](),controller[_0x2b68('0x18')]);router[_0x2b68('0x19')]('/:id',auth[_0x2b68('0xc')](),controller[_0x2b68('0x1a')]);router[_0x2b68('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x2b68('0x1c')]);router[_0x2b68('0x1b')]('/:id/sections',auth[_0x2b68('0xc')](),controller[_0x2b68('0x1d')]);router[_0x2b68('0x1b')](_0x2b68('0x11'),auth[_0x2b68('0xc')](),controller[_0x2b68('0x1e')]);module[_0x2b68('0x1f')]=router; \ No newline at end of file +var _0xabba=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/sections','getSections','/:id/resources','getResources','create','/:id/clone','clone','post','addSections','addResources','update','delete','destroy','removeSections','removeResources','util'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xabba,0x195));var _0xaabb=function(_0x2d009a,_0x243d06){_0x2d009a=_0x2d009a-0x0;var _0x4d8dec=_0xabba[_0x2d009a];return _0x4d8dec;};'use strict';var multer=require('multer');var util=require(_0xaabb('0x0'));var path=require(_0xaabb('0x1'));var timeout=require(_0xaabb('0x2'));var express=require(_0xaabb('0x3'));var router=express[_0xaabb('0x4')]();var fs_extra=require(_0xaabb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaabb('0x6'));var config=require(_0xaabb('0x7'));var controller=require('./userProfile.controller');router[_0xaabb('0x8')]('/',auth[_0xaabb('0x9')](),controller[_0xaabb('0xa')]);router[_0xaabb('0x8')](_0xaabb('0xb'),auth[_0xaabb('0x9')](),controller[_0xaabb('0xc')]);router[_0xaabb('0x8')](_0xaabb('0xd'),auth[_0xaabb('0x9')](),controller['show']);router[_0xaabb('0x8')](_0xaabb('0xe'),auth[_0xaabb('0x9')](),controller[_0xaabb('0xf')]);router[_0xaabb('0x8')](_0xaabb('0x10'),auth['isAuthenticated'](),controller[_0xaabb('0x11')]);router['post']('/',auth[_0xaabb('0x9')](),controller[_0xaabb('0x12')]);router['post'](_0xaabb('0x13'),auth[_0xaabb('0x9')](),controller[_0xaabb('0x14')]);router[_0xaabb('0x15')](_0xaabb('0xe'),auth[_0xaabb('0x9')](),controller[_0xaabb('0x16')]);router[_0xaabb('0x15')](_0xaabb('0x10'),auth['isAuthenticated'](),controller[_0xaabb('0x17')]);router['put'](_0xaabb('0xd'),auth[_0xaabb('0x9')](),controller[_0xaabb('0x18')]);router[_0xaabb('0x19')](_0xaabb('0xd'),auth[_0xaabb('0x9')](),controller[_0xaabb('0x1a')]);router['delete'](_0xaabb('0xe'),auth[_0xaabb('0x9')](),controller[_0xaabb('0x1b')]);router['delete'](_0xaabb('0x10'),auth['isAuthenticated'](),controller[_0xaabb('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index a497f55..9dba77e 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 _0x3821=['STRING','name','setDataValue','crudPermissions','join','getDataValue','BOOLEAN','sequelize','exports'];(function(_0x5e2d82,_0x30f308){var _0x3d0bef=function(_0x54a6a6){while(--_0x54a6a6){_0x5e2d82['push'](_0x5e2d82['shift']());}};_0x3d0bef(++_0x30f308);}(_0x3821,0x14b));var _0x1382=function(_0x4e82e4,_0x46c72a){_0x4e82e4=_0x4e82e4-0x0;var _0x329b0a=_0x3821[_0x4e82e4];return _0x329b0a;};'use strict';var Sequelize=require(_0x1382('0x0'));module[_0x1382('0x1')]={'name':{'type':Sequelize[_0x1382('0x2')],'allowNull':![],'unique':_0x1382('0x3')},'crudPermissions':{'type':Sequelize[_0x1382('0x2')],'set':function(_0x2ef6d2){this[_0x1382('0x4')](_0x1382('0x5'),_0x2ef6d2?_0x2ef6d2[_0x1382('0x6')](''):[]);},'get':function(){return this[_0x1382('0x7')](_0x1382('0x5'))?this[_0x1382('0x7')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x1382('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x1382('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x1382('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1382('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x1382('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1382('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0675=['crudPermissions','getDataValue','split','BOOLEAN','exports','STRING','setDataValue'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x0675,0x185));var _0x5067=function(_0x16e62a,_0x31395a){_0x16e62a=_0x16e62a-0x0;var _0x4ba2a8=_0x0675[_0x16e62a];return _0x4ba2a8;};'use strict';var Sequelize=require('sequelize');module[_0x5067('0x0')]={'name':{'type':Sequelize[_0x5067('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x5067('0x1')],'set':function(_0x1da284){this[_0x5067('0x2')](_0x5067('0x3'),_0x1da284?_0x1da284['join'](''):[]);},'get':function(){return this[_0x5067('0x4')](_0x5067('0x3'))?this[_0x5067('0x4')](_0x5067('0x3'))[_0x5067('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x5067('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x5067('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x5067('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x5067('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x5067('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x5067('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x5067('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x5067('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x5067('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 185c23d..ca4824e 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 _0x7b23=['enabled','includes','subsections','concat','push','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','ids','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','end','status','json','offset','limit','count','set','reject','save','update','then','destroy','sendStatus','stack','name','send','map','rawAttributes','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','UserProfile','includeAll','include','findAll','rows','catch','params','keys','find','create','body','clone','get','omit','createdAt','crudPermissions','sequelize','transaction','each','autoAssociation','UserProfileResource','updatedAt','sectionId','userProfileId','Resources','UserProfileSection','describe','addSections','removeSections','getSections'];(function(_0x175a8c,_0x2d9212){var _0x37b0b0=function(_0x20ef5f){while(--_0x20ef5f){_0x175a8c['push'](_0x175a8c['shift']());}};_0x37b0b0(++_0x2d9212);}(_0x7b23,0xf1));var _0x37b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7b23[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x37b2('0x0'));var jsonpatch=require(_0x37b2('0x1'));var rp=require(_0x37b2('0x2'));var moment=require(_0x37b2('0x3'));var BPromise=require(_0x37b2('0x4'));var Mustache=require('mustache');var util=require(_0x37b2('0x5'));var path=require('path');var sox=require(_0x37b2('0x6'));var csv=require(_0x37b2('0x7'));var ejs=require(_0x37b2('0x8'));var fs=require('fs');var fs_extra=require(_0x37b2('0x9'));var _=require(_0x37b2('0xa'));var squel=require(_0x37b2('0xb'));var crypto=require(_0x37b2('0xc'));var jsforce=require(_0x37b2('0xd'));var deskjs=require(_0x37b2('0xe'));var toCsv=require(_0x37b2('0x7'));var querystring=require(_0x37b2('0xf'));var Papa=require(_0x37b2('0x10'));var Redis=require('ioredis');var authService=require(_0x37b2('0x11'));var qs=require(_0x37b2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x37b2('0x13'));var logger=require(_0x37b2('0x14'))(_0x37b2('0x15'));var utils=require(_0x37b2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x37b2('0x17'));var db=require(_0x37b2('0x18'))['db'];config[_0x37b2('0x19')]=_[_0x37b2('0x1a')](config[_0x37b2('0x19')],{'host':_0x37b2('0x1b'),'port':0x18eb});var socket=require(_0x37b2('0x1c'))(new Redis(config['redis']));require('./userProfile.socket')[_0x37b2('0x1d')](socket);function respondWithStatusCode(_0x490d27,_0x1ac59d){_0x1ac59d=_0x1ac59d||0xcc;return function(_0x25ae32){if(_0x25ae32){return _0x490d27['sendStatus'](_0x1ac59d);}return _0x490d27['status'](_0x1ac59d)[_0x37b2('0x1e')]();};}function respondWithResult(_0x53e3d1,_0x5277b9){_0x5277b9=_0x5277b9||0xc8;return function(_0x37f580){if(_0x37f580){return _0x53e3d1[_0x37b2('0x1f')](_0x5277b9)[_0x37b2('0x20')](_0x37f580);}};}function respondWithFilteredResult(_0x6dc8bc,_0x4b9630){return function(_0x369a88){if(_0x369a88){var _0x59c2b7=typeof _0x4b9630[_0x37b2('0x21')]==='undefined'&&typeof _0x4b9630[_0x37b2('0x22')]==='undefined';var _0x40ed53=_0x369a88[_0x37b2('0x23')];var _0x5c75be=_0x59c2b7?0x0:_0x4b9630['offset'];var _0x451550=_0x59c2b7?_0x369a88[_0x37b2('0x23')]:_0x4b9630[_0x37b2('0x21')]+_0x4b9630[_0x37b2('0x22')];var _0x1dd9a1;if(_0x451550>=_0x40ed53){_0x451550=_0x40ed53;_0x1dd9a1=0xc8;}else{_0x1dd9a1=0xce;}_0x6dc8bc[_0x37b2('0x1f')](_0x1dd9a1);return _0x6dc8bc[_0x37b2('0x24')]('Content-Range',_0x5c75be+'-'+_0x451550+'/'+_0x40ed53)[_0x37b2('0x20')](_0x369a88);}return null;};}function patchUpdates(_0x22cdf7){return function(_0x2f6bb8){try{jsonpatch['apply'](_0x2f6bb8,_0x22cdf7,!![]);}catch(_0x522e04){return BPromise[_0x37b2('0x25')](_0x522e04);}return _0x2f6bb8[_0x37b2('0x26')]();};}function saveUpdates(_0x90c055,_0x190794){return function(_0x48ecdb){if(_0x48ecdb){return _0x48ecdb[_0x37b2('0x27')](_0x90c055)[_0x37b2('0x28')](function(_0x621e51){return _0x621e51;});}return null;};}function removeEntity(_0x1c4779,_0x23de40){return function(_0x4500ce){if(_0x4500ce){return _0x4500ce[_0x37b2('0x29')]()[_0x37b2('0x28')](function(){_0x1c4779[_0x37b2('0x1f')](0xcc)[_0x37b2('0x1e')]();});}};}function handleEntityNotFound(_0x35f4a0,_0x5977a2){return function(_0x4d0ccb){if(!_0x4d0ccb){_0x35f4a0[_0x37b2('0x2a')](0x194);}return _0x4d0ccb;};}function handleError(_0x467619,_0x150fac){_0x150fac=_0x150fac||0x1f4;return function(_0x5a4e6b){logger['error'](_0x5a4e6b[_0x37b2('0x2b')]);if(_0x5a4e6b[_0x37b2('0x2c')]){delete _0x5a4e6b[_0x37b2('0x2c')];}_0x467619[_0x37b2('0x1f')](_0x150fac)[_0x37b2('0x2d')](_0x5a4e6b);};}exports['index']=function(_0x358b2b,_0x1f27e4){var _0x4f6e3b={},_0x498b13={},_0x3062f0={'count':0x0,'rows':[]};var _0x37c6f7=_[_0x37b2('0x2e')](db['UserProfile'][_0x37b2('0x2f')],function(_0x1bbe02){return{'name':_0x1bbe02['fieldName'],'type':_0x1bbe02[_0x37b2('0x30')][_0x37b2('0x31')]};});_0x498b13[_0x37b2('0x32')]=_[_0x37b2('0x2e')](_0x37c6f7,_0x37b2('0x2c'));_0x498b13[_0x37b2('0x33')]=_['keys'](_0x358b2b[_0x37b2('0x33')]);_0x498b13['filters']=_['intersection'](_0x498b13[_0x37b2('0x32')],_0x498b13[_0x37b2('0x33')]);_0x4f6e3b[_0x37b2('0x34')]=_[_0x37b2('0x35')](_0x498b13[_0x37b2('0x32')],qs[_0x37b2('0x36')](_0x358b2b['query'][_0x37b2('0x36')]));_0x4f6e3b['attributes']=_0x4f6e3b[_0x37b2('0x34')][_0x37b2('0x37')]?_0x4f6e3b[_0x37b2('0x34')]:_0x498b13[_0x37b2('0x32')];if(!_0x358b2b[_0x37b2('0x33')][_0x37b2('0x38')](_0x37b2('0x39'))){_0x4f6e3b[_0x37b2('0x22')]=qs[_0x37b2('0x22')](_0x358b2b[_0x37b2('0x33')][_0x37b2('0x22')]);_0x4f6e3b[_0x37b2('0x21')]=qs['offset'](_0x358b2b[_0x37b2('0x33')]['offset']);}_0x4f6e3b[_0x37b2('0x3a')]=qs[_0x37b2('0x3b')](_0x358b2b[_0x37b2('0x33')]['sort']);_0x4f6e3b[_0x37b2('0x3c')]=qs[_0x37b2('0x3d')](_['pick'](_0x358b2b[_0x37b2('0x33')],_0x498b13[_0x37b2('0x3d')]),_0x37c6f7);if(_0x358b2b[_0x37b2('0x33')][_0x37b2('0x3e')]){_0x4f6e3b[_0x37b2('0x3c')]=_[_0x37b2('0x3f')](_0x4f6e3b['where'],{'$or':_[_0x37b2('0x2e')](_0x37c6f7,function(_0x30ca87){if(_0x30ca87['type']!=='VIRTUAL'){var _0x1ab093={};_0x1ab093[_0x30ca87[_0x37b2('0x2c')]]={'$like':'%'+_0x358b2b[_0x37b2('0x33')][_0x37b2('0x3e')]+'%'};return _0x1ab093;}})});}_0x4f6e3b=_[_0x37b2('0x3f')]({},_0x4f6e3b,_0x358b2b[_0x37b2('0x40')]);var _0x450a23={'where':_0x4f6e3b[_0x37b2('0x3c')]};return db[_0x37b2('0x41')]['count'](_0x450a23)[_0x37b2('0x28')](function(_0x3db96c){_0x3062f0['count']=_0x3db96c;if(_0x358b2b[_0x37b2('0x33')][_0x37b2('0x42')]){_0x4f6e3b[_0x37b2('0x43')]=[{'all':!![]}];}return db[_0x37b2('0x41')][_0x37b2('0x44')](_0x4f6e3b);})[_0x37b2('0x28')](function(_0x31b59d){_0x3062f0[_0x37b2('0x45')]=_0x31b59d;return _0x3062f0;})[_0x37b2('0x28')](respondWithFilteredResult(_0x1f27e4,_0x4f6e3b))[_0x37b2('0x46')](handleError(_0x1f27e4,null));};exports['show']=function(_0x3fff41,_0x584f26){var _0x32c5bb={'raw':![],'where':{'id':_0x3fff41[_0x37b2('0x47')]['id']}},_0x58b0c7={};_0x58b0c7[_0x37b2('0x32')]=_[_0x37b2('0x48')](db[_0x37b2('0x41')][_0x37b2('0x2f')]);_0x58b0c7[_0x37b2('0x33')]=_['keys'](_0x3fff41[_0x37b2('0x33')]);_0x58b0c7[_0x37b2('0x3d')]=_[_0x37b2('0x35')](_0x58b0c7[_0x37b2('0x32')],_0x58b0c7['query']);_0x32c5bb[_0x37b2('0x34')]=_[_0x37b2('0x35')](_0x58b0c7[_0x37b2('0x32')],qs[_0x37b2('0x36')](_0x3fff41[_0x37b2('0x33')][_0x37b2('0x36')]));_0x32c5bb[_0x37b2('0x34')]=_0x32c5bb[_0x37b2('0x34')]['length']?_0x32c5bb[_0x37b2('0x34')]:_0x58b0c7[_0x37b2('0x32')];if(_0x3fff41[_0x37b2('0x33')][_0x37b2('0x42')]){_0x32c5bb[_0x37b2('0x43')]=[{'all':!![]}];}_0x32c5bb=_[_0x37b2('0x3f')]({},_0x32c5bb,_0x3fff41[_0x37b2('0x40')]);return db[_0x37b2('0x41')][_0x37b2('0x49')](_0x32c5bb)[_0x37b2('0x28')](handleEntityNotFound(_0x584f26,null))['then'](respondWithResult(_0x584f26,null))[_0x37b2('0x46')](handleError(_0x584f26,null));};exports[_0x37b2('0x4a')]=function(_0x5e9ec4,_0x4ae94d){return db[_0x37b2('0x41')][_0x37b2('0x4a')](_0x5e9ec4[_0x37b2('0x4b')],{})['then'](respondWithResult(_0x4ae94d,0xc9))[_0x37b2('0x46')](handleError(_0x4ae94d,null));};exports[_0x37b2('0x4c')]=function(_0x5e69fb,_0x5c1c4a){var _0x2aa60d={'where':{'id':_0x5e69fb[_0x37b2('0x47')]['id']}},_0x5ddec8={};_0x5ddec8[_0x37b2('0x32')]=_[_0x37b2('0x48')](db[_0x37b2('0x41')]['rawAttributes']);_0x2aa60d[_0x37b2('0x34')]=_[_0x37b2('0x35')](_0x5ddec8[_0x37b2('0x32')],qs[_0x37b2('0x36')](_0x5e69fb[_0x37b2('0x33')][_0x37b2('0x36')]));_0x2aa60d[_0x37b2('0x34')]=_0x2aa60d['attributes']['length']?_0x2aa60d['attributes']:_0x5ddec8[_0x37b2('0x32')];if(_0x5e69fb[_0x37b2('0x33')]['includeAll']){_0x2aa60d['include']=[{'all':!![]}];}_0x2aa60d=_[_0x37b2('0x3f')]({},_0x2aa60d,_0x5e69fb[_0x37b2('0x40')]);return db[_0x37b2('0x41')][_0x37b2('0x49')](_0x2aa60d)[_0x37b2('0x28')](handleEntityNotFound(_0x5c1c4a,null))[_0x37b2('0x28')](function(_0x1245bf){if(_0x1245bf){var _0x1f08bf=_0x1245bf[_0x37b2('0x4d')]({'plain':!![]});_0x1f08bf=qs[_0x37b2('0x4e')](_0x1f08bf,['id',_0x37b2('0x4f'),'updatedAt',_0x37b2('0x50')]);_0x5e69fb[_0x37b2('0x4b')]=_[_0x37b2('0x4e')](_0x5e69fb[_0x37b2('0x4b')],['id',_0x37b2('0x4f'),'updatedAt']);return db[_0x37b2('0x51')][_0x37b2('0x52')](function(_0x51f203){return db[_0x37b2('0x41')][_0x37b2('0x4a')](_[_0x37b2('0x3f')](_0x1f08bf,_0x5e69fb[_0x37b2('0x4b')]),{'include':_0x5e69fb[_0x37b2('0x33')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x51f203})[_0x37b2('0x28')](function(_0x4ed5a4){var _0x2a5b91=_0x4ed5a4[_0x37b2('0x4d')]({'plain':!![]});return db['UserProfileSection'][_0x37b2('0x44')]({'where':{'userProfileId':_0x5e69fb[_0x37b2('0x47')]['id']},'raw':!![]})[_0x37b2('0x28')](function(_0x589dc5){if(_0x589dc5){return BPromise[_0x37b2('0x53')](_0x589dc5,function(_0x1448cd){return new BPromise(function(_0x3414a0,_0x5551fb){if(_0x1448cd[_0x37b2('0x54')]===null||_0x1448cd['autoAssociation']===0x1)_0x3414a0(null);return db[_0x37b2('0x55')][_0x37b2('0x44')]({'where':{'sectionId':_0x1448cd['id']},'raw':!![]})[_0x37b2('0x28')](function(_0x4209d6){var _0x45e17d=_[_0x37b2('0x2e')](_0x4209d6,function(_0x103747){return qs[_0x37b2('0x4e')](_0x103747,['id',_0x37b2('0x4f'),_0x37b2('0x56'),_0x37b2('0x57')]);});_0x3414a0(_0x45e17d);})['catch'](function(_0xa2b4f7){_0x5551fb(_0xa2b4f7);});})[_0x37b2('0x28')](function(_0x2e76c2){var _0x3d174e=qs[_0x37b2('0x4e')](_0x1448cd,['id',_0x37b2('0x4f'),'updatedAt']);_0x3d174e[_0x37b2('0x58')]=_0x2a5b91['id'];if(_0x2e76c2)_0x3d174e[_0x37b2('0x59')]=_0x2e76c2;return _0x3d174e;})[_0x37b2('0x28')](function(_0x4235ce){return db[_0x37b2('0x5a')][_0x37b2('0x4a')](_0x4235ce,{'include':[{'model':db[_0x37b2('0x55')],'as':_0x37b2('0x59')}],'raw':!![],'transaction':_0x51f203});});})[_0x37b2('0x28')](function(){return _0x2a5b91;});}});});});}})[_0x37b2('0x28')](respondWithResult(_0x5c1c4a,0xc9))['catch'](handleError(_0x5c1c4a,null));};exports[_0x37b2('0x27')]=function(_0x5a657b,_0x2d6162){if(_0x5a657b['body']['id']){delete _0x5a657b[_0x37b2('0x4b')]['id'];}return db[_0x37b2('0x41')][_0x37b2('0x49')]({'where':{'id':_0x5a657b[_0x37b2('0x47')]['id']}})['then'](handleEntityNotFound(_0x2d6162,null))[_0x37b2('0x28')](saveUpdates(_0x5a657b[_0x37b2('0x4b')],null))[_0x37b2('0x28')](respondWithResult(_0x2d6162,null))[_0x37b2('0x46')](handleError(_0x2d6162,null));};exports[_0x37b2('0x29')]=function(_0x364247,_0x2da8c3){return db['UserProfile'][_0x37b2('0x49')]({'where':{'id':_0x364247[_0x37b2('0x47')]['id']}})[_0x37b2('0x28')](handleEntityNotFound(_0x2da8c3,null))[_0x37b2('0x28')](removeEntity(_0x2da8c3,null))[_0x37b2('0x46')](handleError(_0x2da8c3,null));};exports[_0x37b2('0x5b')]=function(_0x4eb4e3,_0x4f960d){return db['UserProfile']['describe']()[_0x37b2('0x28')](respondWithResult(_0x4f960d,null))[_0x37b2('0x46')](handleError(_0x4f960d,null));};exports[_0x37b2('0x5c')]=function(_0x51cb3b,_0x29f601){var _0x3e2117=_0x51cb3b[_0x37b2('0x4b')];return db[_0x37b2('0x41')]['find']({'where':{'id':_0x51cb3b[_0x37b2('0x47')]['id']}})[_0x37b2('0x28')](handleEntityNotFound(_0x29f601,null))[_0x37b2('0x28')](function(_0x4ce537){if(_0x4ce537){return db[_0x37b2('0x51')][_0x37b2('0x52')](function(_0x355b62){return db[_0x37b2('0x5a')]['destroy']({'where':{'userProfileId':_0x51cb3b[_0x37b2('0x47')]['id'],'sectionId':_[_0x37b2('0x2e')](_0x3e2117,function(_0x31aab0){return _0x31aab0[_0x37b2('0x57')];})},'transaction':_0x355b62})[_0x37b2('0x28')](function(){var _0x20fbaf=_[_0x37b2('0x2e')](_0x3e2117,function(_0x1361c3){_0x1361c3['userProfileId']=_0x51cb3b['params']['id'];return _0x1361c3;});var _0x3e6a7d=[];return BPromise[_0x37b2('0x53')](_0x20fbaf,function(_0x55f527){return db[_0x37b2('0x5a')][_0x37b2('0x4a')](_0x55f527,{'include':[{'model':db[_0x37b2('0x55')],'as':'Resources'}],'raw':!![],'transaction':_0x355b62})[_0x37b2('0x28')](function(_0x2e86b5){_0x3e6a7d['push'](_0x2e86b5[_0x37b2('0x4d')]({'plain':!![]}));});})[_0x37b2('0x28')](function(){return _0x3e6a7d;});});});}})[_0x37b2('0x28')](function(_0x231bc0){return _0x231bc0;})[_0x37b2('0x28')](respondWithResult(_0x29f601,null))['catch'](handleError(_0x29f601,null));};exports[_0x37b2('0x5d')]=function(_0x1cdfde,_0x13479a){var _0x58a3fd;return db[_0x37b2('0x41')]['find']({'where':{'id':_0x1cdfde[_0x37b2('0x47')]['id']},'attributes':['id',_0x37b2('0x2c')]})[_0x37b2('0x28')](handleEntityNotFound(_0x13479a,null))['then'](function(_0x2533c5){if(_0x2533c5){_0x58a3fd=_0x2533c5;return db[_0x37b2('0x5a')][_0x37b2('0x29')]({'where':{'userProfileId':_0x1cdfde[_0x37b2('0x47')]['id'],'sectionId':_0x1cdfde[_0x37b2('0x33')]['ids']}});}})['then'](function(){return _0x58a3fd;})[_0x37b2('0x28')](respondWithStatusCode(_0x13479a,null))['catch'](handleError(_0x13479a,null));};exports[_0x37b2('0x5e')]=function(_0x55d510,_0x29bc){var _0x53a1cc=[];var _0xdeb77e=[];return db[_0x37b2('0x5a')][_0x37b2('0x44')]({'where':{'userProfileId':_0x55d510['params']['id']},'raw':!![]})[_0x37b2('0x28')](function(_0x2c58e6){_0x53a1cc=_['filter'](_0x2c58e6,function(_0x227766){return _0x227766[_0x37b2('0x5f')]===0x1||_[_0x37b2('0x60')]([0x3eb,0x709],_0x227766[_0x37b2('0x57')]);});if(!_['isEmpty'](_0x53a1cc)){return _[_0x37b2('0x2e')](_0x53a1cc,function(_0x23b0ba){return _0x23b0ba[_0x37b2('0x57')];});}else{return;}})[_0x37b2('0x28')](function(_0x412ed9){if(_0x412ed9)_0xdeb77e=_0x412ed9;if(_['includes'](_0xdeb77e,0x64)){var _0x4c7d1a=_['find'](_0x53a1cc,{'sectionId':0x64});return hasDefaultDashboard(_0x4c7d1a)[_0x37b2('0x28')](function(_0x14ade3){return _[_0x37b2('0x2e')](_0x53a1cc,function(_0x42052c){if(_0x42052c[_0x37b2('0x57')]===0x64){_0x42052c[_0x37b2('0x61')]=_0x14ade3;}return _0x42052c;});});}else{return;}})['then'](function(_0x497364){if(_0x497364)_0x53a1cc=_0x497364;if(_[_0x37b2('0x60')](_0xdeb77e,0x3eb)){var _0x3f73bf=_[_0x37b2('0x49')](_0x53a1cc,{'sectionId':0x3eb});return getCustomDashboards(_0x3f73bf)[_0x37b2('0x28')](function(_0x28e30c){return _['map'](_0x53a1cc,function(_0x1af9d2){if(_0x3f73bf['enabled']){if(_0x1af9d2[_0x37b2('0x57')]===0x3eb){_0x1af9d2[_0x37b2('0x61')]=_0x28e30c;}}else{if(_0x1af9d2[_0x37b2('0x57')]===0x64){if(!_0x1af9d2['subsections']){_0x1af9d2[_0x37b2('0x61')]=[];}_0x1af9d2[_0x37b2('0x61')]=_0x1af9d2[_0x37b2('0x61')][_0x37b2('0x62')](_0x28e30c);}}return _0x1af9d2;});});}else{return;}})['then'](function(_0x37d4a9){if(_0x37d4a9)_0x53a1cc=_0x37d4a9;if(_[_0x37b2('0x60')](_0xdeb77e,0x709)){var _0x54590e=_[_0x37b2('0x49')](_0x53a1cc,{'sectionId':0x709});return getPlugins(_0x54590e)[_0x37b2('0x28')](function(_0x433f33){if(_0x54590e[_0x37b2('0x5f')]){return _[_0x37b2('0x2e')](_0x53a1cc,function(_0xb946d3){if(_0xb946d3['sectionId']===0x709){_0xb946d3[_0x37b2('0x61')]=_0x433f33;}return _0xb946d3;});}else{var _0x41ab39={'sectionId':0x76c,'enabled':0x1,'subsections':_0x433f33};var _0x4a93bc=_[_0x37b2('0x2e')](_0x53a1cc);_0x4a93bc[_0x37b2('0x63')](_0x41ab39);return _0x4a93bc;}});}else{return;}})[_0x37b2('0x28')](function(_0x2d3256){if(_0x2d3256)_0x53a1cc=_0x2d3256;return _['filter'](_0x53a1cc,[_0x37b2('0x5f'),0x1]);})[_0x37b2('0x28')](respondWithResult(_0x29bc,null))[_0x37b2('0x46')](handleError(_0x29bc,null));};function hasDefaultDashboard(_0x32fa26){var _0x5349cb=[0x65];return new BPromise(function(_0x3f7756,_0x543840){try{if(_0x32fa26[_0x37b2('0x54')]){_0x3f7756(_0x5349cb);}else{return db[_0x37b2('0x55')][_0x37b2('0x64')]({'where':{'sectionId':_0x32fa26['id']},'raw':!![]})['then'](function(_0x20ab4b){_0x20ab4b?_0x3f7756(_0x5349cb):_0x3f7756();});}}catch(_0x5450af){_0x543840(_0x5450af);}});}function getCustomDashboards(_0x361e42){var _0x284c18=[];return new BPromise(function(_0x443ad4,_0x3ee40e){try{if(_0x361e42[_0x37b2('0x54')]){return db[_0x37b2('0x65')][_0x37b2('0x44')]({'raw':!![]})[_0x37b2('0x28')](function(_0x1a9588){_0x1a9588[_0x37b2('0x66')](function(_0x3868b0){_0x284c18['push'](_0x3868b0['id']+0x1869f);});_0x443ad4(_0x284c18);});}else{return db[_0x37b2('0x55')][_0x37b2('0x44')]({'where':{'sectionId':_0x361e42['id']},'raw':!![]})[_0x37b2('0x28')](function(_0x1916c9){_0x1916c9['forEach'](function(_0x18355a){_0x284c18['push'](_0x18355a[_0x37b2('0x67')]+0x1869f);});_0x443ad4(_0x284c18);});}}catch(_0x7251c1){_0x3ee40e(_0x7251c1);}});}function getPlugins(_0x1c3fd1){var _0x12a70b=[];return new BPromise(function(_0x1e15d8,_0x55fd3b){try{if(_0x1c3fd1[_0x37b2('0x54')]){return db[_0x37b2('0x68')][_0x37b2('0x44')]({'raw':!![]})[_0x37b2('0x28')](function(_0x51f20b){_0x51f20b['forEach'](function(_0x5b6cdb){_0x12a70b[_0x37b2('0x63')](_0x5b6cdb['id']+0x15b38);});_0x1e15d8(_0x12a70b);});}else{return db[_0x37b2('0x55')][_0x37b2('0x44')]({'where':{'sectionId':_0x1c3fd1['id']},'raw':!![]})[_0x37b2('0x28')](function(_0x1a4730){_0x1a4730[_0x37b2('0x66')](function(_0x2ba4ac){_0x12a70b[_0x37b2('0x63')](_0x2ba4ac[_0x37b2('0x67')]+0x15b38);});_0x1e15d8(_0x12a70b);});}}catch(_0x48e307){_0x55fd3b(_0x48e307);}});}exports['addResources']=function(_0x435ca4,_0x4c681e){return db['UserProfile'][_0x37b2('0x49')]({'where':{'id':_0x435ca4[_0x37b2('0x47')]['id']}})[_0x37b2('0x28')](handleEntityNotFound(_0x4c681e,null))[_0x37b2('0x28')](function(_0x5bb623){if(_0x5bb623){return db['sequelize'][_0x37b2('0x52')](function(_0x59e07e){return db[_0x37b2('0x5a')]['findAll']({'where':{'userProfileId':_0x435ca4['params']['id']},'attributes':['id'],'raw':!![]})[_0x37b2('0x28')](function(_0x5cba59){if(_0x5cba59){return db[_0x37b2('0x5a')][_0x37b2('0x29')]({'where':{'userProfileId':_0x435ca4[_0x37b2('0x47')]['id'],'id':_[_0x37b2('0x2e')](_0x5cba59,function(_0x532e30){return _0x532e30['id'];})},'transaction':_0x59e07e});}})[_0x37b2('0x28')](function(_0x1c1130){var _0x4b3fb2=_[_0x37b2('0x2e')](_0x435ca4[_0x37b2('0x4b')],function(_0x271f90){_0x271f90[_0x37b2('0x58')]=_0x435ca4[_0x37b2('0x47')]['id'];return _0x271f90;});return db[_0x37b2('0x5a')][_0x37b2('0x69')](_0x4b3fb2,{'raw':!![],'transaction':_0x59e07e});})['then'](function(_0xa978fb){var _0x5e6c58=_[_0x37b2('0x3e')](_[_0x37b2('0x2e')](_0xa978fb,function(_0x3caf47){return _0x3caf47[_0x37b2('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x5e6c58){return db['UserProfileSection'][_0x37b2('0x44')]({'where':{'userProfileId':_0x435ca4[_0x37b2('0x47')]['id'],'sectionId':_[_0x37b2('0x2e')](_0x5e6c58,function(_0x3b79ee){return _0x3b79ee['sectionId'];})},'attributes':['id',_0x37b2('0x57')],'raw':!![]})[_0x37b2('0x28')](function(_0x41a051){var _0x529f35=_[_0x37b2('0x2e')](_0x435ca4[_0x37b2('0x4b')],function(_0x39385f){_0x39385f[_0x37b2('0x58')]=_0x435ca4[_0x37b2('0x47')]['id'];return _0x39385f;});return db['UserProfileResource'][_0x37b2('0x69')](_0x529f35,{'raw':!![],'transaction':_0x59e07e});});}})['catch'](handleError(_0x4c681e,null));});}})['then'](function(_0x3e4f4a){var _0x2de71b=_['map'](_0x3e4f4a,function(_0x18fdfe){return _0x18fdfe['get']({'plain':!![]});});})['then'](respondWithResult(_0x4c681e,null))[_0x37b2('0x46')](handleError(_0x4c681e,null));};exports[_0x37b2('0x6a')]=function(_0x18a208,_0x495555,_0x108be4){return db['UserProfile'][_0x37b2('0x49')]({'where':{'id':_0x18a208[_0x37b2('0x47')]['id']}})[_0x37b2('0x28')](handleEntityNotFound(_0x495555,null))[_0x37b2('0x28')](function(_0x4141a4){if(_0x4141a4){return _0x4141a4[_0x37b2('0x6a')](_0x18a208[_0x37b2('0x33')][_0x37b2('0x6b')]);}})['then'](respondWithStatusCode(_0x495555,null))[_0x37b2('0x46')](handleError(_0x495555,null));};exports['getResources']=function(_0x5a42b3,_0x30d912){var _0x54bb55={};if(!_0x5a42b3[_0x37b2('0x33')][_0x37b2('0x6c')])throw new Error(_0x37b2('0x6d'));if(!_0x5a42b3[_0x37b2('0x33')][_0x37b2('0x38')]('nolimit')){_0x54bb55[_0x37b2('0x22')]=qs[_0x37b2('0x22')](_0x5a42b3['query'][_0x37b2('0x22')]);_0x54bb55[_0x37b2('0x21')]=qs[_0x37b2('0x21')](_0x5a42b3[_0x37b2('0x33')][_0x37b2('0x21')]);}return db[_0x37b2('0x41')]['find']({'where':{'id':_0x5a42b3[_0x37b2('0x47')]['id']}})[_0x37b2('0x28')](function(_0x55e814){if(!_0x55e814)throw new Error(_0x37b2('0x6e')+_0x5a42b3['params']['id']);return db['UserProfile'][_0x37b2('0x6f')](_0x5a42b3);})[_0x37b2('0x28')](respondWithFilteredResult(_0x30d912,_0x54bb55))[_0x37b2('0x46')](handleError(_0x30d912,null));}; \ No newline at end of file +var _0xf66f=['localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','UserProfile','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','show','params','options','create','body','catch','clone','find','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','Resources','describe','addSections','sectionId','userProfileId','push','removeSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','removeResources','ids','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf66f,0x13c));var _0xff66=function(_0x1af71a,_0x1d18ee){_0x1af71a=_0x1af71a-0x0;var _0x3acd6a=_0xf66f[_0x1af71a];return _0x3acd6a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff66('0x0'));var zipdir=require(_0xff66('0x1'));var jsonpatch=require(_0xff66('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xff66('0x3'));var Mustache=require(_0xff66('0x4'));var util=require(_0xff66('0x5'));var path=require(_0xff66('0x6'));var sox=require(_0xff66('0x7'));var csv=require('to-csv');var ejs=require(_0xff66('0x8'));var fs=require('fs');var fs_extra=require(_0xff66('0x9'));var _=require(_0xff66('0xa'));var squel=require(_0xff66('0xb'));var crypto=require(_0xff66('0xc'));var jsforce=require(_0xff66('0xd'));var deskjs=require(_0xff66('0xe'));var toCsv=require('to-csv');var querystring=require(_0xff66('0xf'));var Papa=require('papaparse');var Redis=require(_0xff66('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xff66('0x11'));var hardwareService=require(_0xff66('0x12'));var logger=require(_0xff66('0x13'))(_0xff66('0x14'));var utils=require('../../config/utils');var config=require(_0xff66('0x15'));var licenseUtil=require(_0xff66('0x16'));var db=require(_0xff66('0x17'))['db'];config[_0xff66('0x18')]=_[_0xff66('0x19')](config['redis'],{'host':_0xff66('0x1a'),'port':0x18eb});var socket=require(_0xff66('0x1b'))(new Redis(config[_0xff66('0x18')]));require('./userProfile.socket')[_0xff66('0x1c')](socket);function respondWithStatusCode(_0xbe3e77,_0x595271){_0x595271=_0x595271||0xcc;return function(_0x4aa1d7){if(_0x4aa1d7){return _0xbe3e77[_0xff66('0x1d')](_0x595271);}return _0xbe3e77[_0xff66('0x1e')](_0x595271)[_0xff66('0x1f')]();};}function respondWithResult(_0x2bf650,_0x21d148){_0x21d148=_0x21d148||0xc8;return function(_0x895b6b){if(_0x895b6b){return _0x2bf650[_0xff66('0x1e')](_0x21d148)[_0xff66('0x20')](_0x895b6b);}};}function respondWithFilteredResult(_0x1e469e,_0x522979){return function(_0x49db99){if(_0x49db99){var _0x345732=typeof _0x522979[_0xff66('0x21')]===_0xff66('0x22')&&typeof _0x522979[_0xff66('0x23')]===_0xff66('0x22');var _0x21b278=_0x49db99[_0xff66('0x24')];var _0x5d86d8=_0x345732?0x0:_0x522979[_0xff66('0x21')];var _0xd78da7=_0x345732?_0x49db99[_0xff66('0x24')]:_0x522979['offset']+_0x522979['limit'];var _0xd4003d;if(_0xd78da7>=_0x21b278){_0xd78da7=_0x21b278;_0xd4003d=0xc8;}else{_0xd4003d=0xce;}_0x1e469e[_0xff66('0x1e')](_0xd4003d);return _0x1e469e[_0xff66('0x25')]('Content-Range',_0x5d86d8+'-'+_0xd78da7+'/'+_0x21b278)[_0xff66('0x20')](_0x49db99);}return null;};}function patchUpdates(_0x5e6e6d){return function(_0x5acbe3){try{jsonpatch[_0xff66('0x26')](_0x5acbe3,_0x5e6e6d,!![]);}catch(_0x15d11d){return BPromise[_0xff66('0x27')](_0x15d11d);}return _0x5acbe3[_0xff66('0x28')]();};}function saveUpdates(_0x4e50d5,_0x25978a){return function(_0x1dba59){if(_0x1dba59){return _0x1dba59[_0xff66('0x29')](_0x4e50d5)[_0xff66('0x2a')](function(_0x37b16a){return _0x37b16a;});}return null;};}function removeEntity(_0x423b24,_0x25d265){return function(_0x54261f){if(_0x54261f){return _0x54261f[_0xff66('0x2b')]()['then'](function(){_0x423b24['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x235a87,_0x25990b){return function(_0x4cafbd){if(!_0x4cafbd){_0x235a87[_0xff66('0x1d')](0x194);}return _0x4cafbd;};}function handleError(_0x45e3e3,_0x318862){_0x318862=_0x318862||0x1f4;return function(_0x18e8ec){logger[_0xff66('0x2c')](_0x18e8ec[_0xff66('0x2d')]);if(_0x18e8ec[_0xff66('0x2e')]){delete _0x18e8ec[_0xff66('0x2e')];}_0x45e3e3[_0xff66('0x1e')](_0x318862)['send'](_0x18e8ec);};}exports['index']=function(_0x1279f4,_0x5af85e){var _0x48ddb8={},_0x1e1667={},_0x3c3607={'count':0x0,'rows':[]};var _0x5b4940=_['map'](db[_0xff66('0x2f')][_0xff66('0x30')],function(_0x101cf2){return{'name':_0x101cf2[_0xff66('0x31')],'type':_0x101cf2[_0xff66('0x32')][_0xff66('0x33')]};});_0x1e1667[_0xff66('0x34')]=_[_0xff66('0x35')](_0x5b4940,_0xff66('0x2e'));_0x1e1667[_0xff66('0x36')]=_[_0xff66('0x37')](_0x1279f4['query']);_0x1e1667[_0xff66('0x38')]=_['intersection'](_0x1e1667[_0xff66('0x34')],_0x1e1667[_0xff66('0x36')]);_0x48ddb8[_0xff66('0x39')]=_[_0xff66('0x3a')](_0x1e1667[_0xff66('0x34')],qs['fields'](_0x1279f4[_0xff66('0x36')][_0xff66('0x3b')]));_0x48ddb8['attributes']=_0x48ddb8[_0xff66('0x39')][_0xff66('0x3c')]?_0x48ddb8[_0xff66('0x39')]:_0x1e1667[_0xff66('0x34')];if(!_0x1279f4['query'][_0xff66('0x3d')]('nolimit')){_0x48ddb8[_0xff66('0x23')]=qs[_0xff66('0x23')](_0x1279f4[_0xff66('0x36')]['limit']);_0x48ddb8[_0xff66('0x21')]=qs[_0xff66('0x21')](_0x1279f4['query']['offset']);}_0x48ddb8[_0xff66('0x3e')]=qs['sort'](_0x1279f4[_0xff66('0x36')][_0xff66('0x3f')]);_0x48ddb8[_0xff66('0x40')]=qs[_0xff66('0x38')](_[_0xff66('0x41')](_0x1279f4[_0xff66('0x36')],_0x1e1667[_0xff66('0x38')]),_0x5b4940);if(_0x1279f4[_0xff66('0x36')]['filter']){_0x48ddb8[_0xff66('0x40')]=_[_0xff66('0x42')](_0x48ddb8['where'],{'$or':_[_0xff66('0x35')](_0x5b4940,function(_0x40cfd0){if(_0x40cfd0[_0xff66('0x32')]!=='VIRTUAL'){var _0x4e697b={};_0x4e697b[_0x40cfd0[_0xff66('0x2e')]]={'$like':'%'+_0x1279f4[_0xff66('0x36')][_0xff66('0x43')]+'%'};return _0x4e697b;}})});}_0x48ddb8=_[_0xff66('0x42')]({},_0x48ddb8,_0x1279f4['options']);var _0x48bb84={'where':_0x48ddb8[_0xff66('0x40')]};return db['UserProfile']['count'](_0x48bb84)['then'](function(_0xeb6483){_0x3c3607[_0xff66('0x24')]=_0xeb6483;if(_0x1279f4[_0xff66('0x36')][_0xff66('0x44')]){_0x48ddb8[_0xff66('0x45')]=[{'all':!![]}];}return db[_0xff66('0x2f')][_0xff66('0x46')](_0x48ddb8);})['then'](function(_0x473129){_0x3c3607[_0xff66('0x47')]=_0x473129;return _0x3c3607;})['then'](respondWithFilteredResult(_0x5af85e,_0x48ddb8))['catch'](handleError(_0x5af85e,null));};exports[_0xff66('0x48')]=function(_0x14137c,_0x19438a){var _0x272ae1={'raw':![],'where':{'id':_0x14137c[_0xff66('0x49')]['id']}},_0x3d9b2e={};_0x3d9b2e['model']=_[_0xff66('0x37')](db['UserProfile'][_0xff66('0x30')]);_0x3d9b2e[_0xff66('0x36')]=_[_0xff66('0x37')](_0x14137c['query']);_0x3d9b2e[_0xff66('0x38')]=_['intersection'](_0x3d9b2e['model'],_0x3d9b2e['query']);_0x272ae1[_0xff66('0x39')]=_[_0xff66('0x3a')](_0x3d9b2e[_0xff66('0x34')],qs['fields'](_0x14137c['query'][_0xff66('0x3b')]));_0x272ae1[_0xff66('0x39')]=_0x272ae1[_0xff66('0x39')][_0xff66('0x3c')]?_0x272ae1[_0xff66('0x39')]:_0x3d9b2e['model'];if(_0x14137c[_0xff66('0x36')]['includeAll']){_0x272ae1[_0xff66('0x45')]=[{'all':!![]}];}_0x272ae1=_[_0xff66('0x42')]({},_0x272ae1,_0x14137c[_0xff66('0x4a')]);return db['UserProfile']['find'](_0x272ae1)[_0xff66('0x2a')](handleEntityNotFound(_0x19438a,null))['then'](respondWithResult(_0x19438a,null))['catch'](handleError(_0x19438a,null));};exports[_0xff66('0x4b')]=function(_0x1f5779,_0x995faf){return db['UserProfile']['create'](_0x1f5779[_0xff66('0x4c')],{})[_0xff66('0x2a')](respondWithResult(_0x995faf,0xc9))[_0xff66('0x4d')](handleError(_0x995faf,null));};exports[_0xff66('0x4e')]=function(_0x516921,_0x21340b){var _0x4ac1d6={'where':{'id':_0x516921[_0xff66('0x49')]['id']}},_0x2caef9={};_0x2caef9[_0xff66('0x34')]=_[_0xff66('0x37')](db[_0xff66('0x2f')]['rawAttributes']);_0x4ac1d6[_0xff66('0x39')]=_[_0xff66('0x3a')](_0x2caef9[_0xff66('0x34')],qs[_0xff66('0x3b')](_0x516921['query'][_0xff66('0x3b')]));_0x4ac1d6[_0xff66('0x39')]=_0x4ac1d6['attributes'][_0xff66('0x3c')]?_0x4ac1d6[_0xff66('0x39')]:_0x2caef9['model'];if(_0x516921[_0xff66('0x36')][_0xff66('0x44')]){_0x4ac1d6[_0xff66('0x45')]=[{'all':!![]}];}_0x4ac1d6=_[_0xff66('0x42')]({},_0x4ac1d6,_0x516921['options']);return db[_0xff66('0x2f')][_0xff66('0x4f')](_0x4ac1d6)['then'](handleEntityNotFound(_0x21340b,null))[_0xff66('0x2a')](function(_0x23891f){if(_0x23891f){var _0x5d0e71=_0x23891f[_0xff66('0x50')]({'plain':!![]});_0x5d0e71=qs[_0xff66('0x51')](_0x5d0e71,['id',_0xff66('0x52'),_0xff66('0x53'),_0xff66('0x54')]);_0x516921['body']=_[_0xff66('0x51')](_0x516921[_0xff66('0x4c')],['id',_0xff66('0x52'),'updatedAt']);return db[_0xff66('0x55')][_0xff66('0x56')](function(_0x377c98){return db[_0xff66('0x2f')]['create'](_[_0xff66('0x42')](_0x5d0e71,_0x516921[_0xff66('0x4c')]),{'include':_0x516921[_0xff66('0x36')][_0xff66('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x377c98})[_0xff66('0x2a')](function(_0x3fc4ba){var _0x409c89=_0x3fc4ba['get']({'plain':!![]});return db[_0xff66('0x57')][_0xff66('0x46')]({'where':{'userProfileId':_0x516921['params']['id']},'raw':!![]})[_0xff66('0x2a')](function(_0x1c0eab){if(_0x1c0eab){return BPromise['each'](_0x1c0eab,function(_0x348657){return new BPromise(function(_0x2f8944,_0x3e9c18){if(_0x348657[_0xff66('0x58')]===null||_0x348657[_0xff66('0x58')]===0x1)_0x2f8944(null);return db[_0xff66('0x59')][_0xff66('0x46')]({'where':{'sectionId':_0x348657['id']},'raw':!![]})['then'](function(_0x22ce25){var _0x48d588=_[_0xff66('0x35')](_0x22ce25,function(_0x29ac98){return qs[_0xff66('0x51')](_0x29ac98,['id',_0xff66('0x52'),_0xff66('0x53'),'sectionId']);});_0x2f8944(_0x48d588);})['catch'](function(_0x14332f){_0x3e9c18(_0x14332f);});})[_0xff66('0x2a')](function(_0x3c751a){var _0x521a21=qs['omit'](_0x348657,['id','createdAt',_0xff66('0x53')]);_0x521a21['userProfileId']=_0x409c89['id'];if(_0x3c751a)_0x521a21[_0xff66('0x5a')]=_0x3c751a;return _0x521a21;})[_0xff66('0x2a')](function(_0x4f7e61){return db[_0xff66('0x57')][_0xff66('0x4b')](_0x4f7e61,{'include':[{'model':db[_0xff66('0x59')],'as':_0xff66('0x5a')}],'raw':!![],'transaction':_0x377c98});});})[_0xff66('0x2a')](function(){return _0x409c89;});}});});});}})[_0xff66('0x2a')](respondWithResult(_0x21340b,0xc9))['catch'](handleError(_0x21340b,null));};exports[_0xff66('0x29')]=function(_0x3ceb9f,_0x2ff80b){if(_0x3ceb9f[_0xff66('0x4c')]['id']){delete _0x3ceb9f[_0xff66('0x4c')]['id'];}return db[_0xff66('0x2f')]['find']({'where':{'id':_0x3ceb9f[_0xff66('0x49')]['id']}})[_0xff66('0x2a')](handleEntityNotFound(_0x2ff80b,null))[_0xff66('0x2a')](saveUpdates(_0x3ceb9f[_0xff66('0x4c')],null))['then'](respondWithResult(_0x2ff80b,null))[_0xff66('0x4d')](handleError(_0x2ff80b,null));};exports['destroy']=function(_0x30466f,_0x5ec287){return db[_0xff66('0x2f')]['find']({'where':{'id':_0x30466f[_0xff66('0x49')]['id']}})[_0xff66('0x2a')](handleEntityNotFound(_0x5ec287,null))[_0xff66('0x2a')](removeEntity(_0x5ec287,null))['catch'](handleError(_0x5ec287,null));};exports[_0xff66('0x5b')]=function(_0x8b68ed,_0x47bd20){return db[_0xff66('0x2f')]['describe']()[_0xff66('0x2a')](respondWithResult(_0x47bd20,null))[_0xff66('0x4d')](handleError(_0x47bd20,null));};exports[_0xff66('0x5c')]=function(_0x1ef866,_0x13ec2d){var _0x1aa065=_0x1ef866[_0xff66('0x4c')];return db[_0xff66('0x2f')][_0xff66('0x4f')]({'where':{'id':_0x1ef866[_0xff66('0x49')]['id']}})[_0xff66('0x2a')](handleEntityNotFound(_0x13ec2d,null))[_0xff66('0x2a')](function(_0x14968d){if(_0x14968d){return db[_0xff66('0x55')][_0xff66('0x56')](function(_0x4dbbd3){return db['UserProfileSection'][_0xff66('0x2b')]({'where':{'userProfileId':_0x1ef866['params']['id'],'sectionId':_[_0xff66('0x35')](_0x1aa065,function(_0x106609){return _0x106609[_0xff66('0x5d')];})},'transaction':_0x4dbbd3})[_0xff66('0x2a')](function(){var _0x21a56e=_['map'](_0x1aa065,function(_0x35ef50){_0x35ef50[_0xff66('0x5e')]=_0x1ef866[_0xff66('0x49')]['id'];return _0x35ef50;});var _0x56b160=[];return BPromise['each'](_0x21a56e,function(_0x3c0a56){return db['UserProfileSection'][_0xff66('0x4b')](_0x3c0a56,{'include':[{'model':db[_0xff66('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x4dbbd3})[_0xff66('0x2a')](function(_0x1192fc){_0x56b160[_0xff66('0x5f')](_0x1192fc[_0xff66('0x50')]({'plain':!![]}));});})[_0xff66('0x2a')](function(){return _0x56b160;});});});}})['then'](function(_0x41a775){return _0x41a775;})[_0xff66('0x2a')](respondWithResult(_0x13ec2d,null))[_0xff66('0x4d')](handleError(_0x13ec2d,null));};exports[_0xff66('0x60')]=function(_0x12978a,_0x4d7ab4){var _0x381322;return db[_0xff66('0x2f')][_0xff66('0x4f')]({'where':{'id':_0x12978a[_0xff66('0x49')]['id']},'attributes':['id',_0xff66('0x2e')]})[_0xff66('0x2a')](handleEntityNotFound(_0x4d7ab4,null))[_0xff66('0x2a')](function(_0x56753a){if(_0x56753a){_0x381322=_0x56753a;return db[_0xff66('0x57')][_0xff66('0x2b')]({'where':{'userProfileId':_0x12978a[_0xff66('0x49')]['id'],'sectionId':_0x12978a['query']['ids']}});}})['then'](function(){return _0x381322;})[_0xff66('0x2a')](respondWithStatusCode(_0x4d7ab4,null))[_0xff66('0x4d')](handleError(_0x4d7ab4,null));};exports['getSections']=function(_0x46997e,_0x10bcfa){var _0x9528b7=[];var _0x5ceda5=[];return db['UserProfileSection'][_0xff66('0x46')]({'where':{'userProfileId':_0x46997e['params']['id']},'raw':!![]})[_0xff66('0x2a')](function(_0x5eec30){_0x9528b7=_[_0xff66('0x43')](_0x5eec30,function(_0x269b36){return _0x269b36[_0xff66('0x61')]===0x1||_[_0xff66('0x62')]([0x3eb,0x709],_0x269b36[_0xff66('0x5d')]);});if(!_[_0xff66('0x63')](_0x9528b7)){return _['map'](_0x9528b7,function(_0x306012){return _0x306012[_0xff66('0x5d')];});}else{return;}})[_0xff66('0x2a')](function(_0x439fe1){if(_0x439fe1)_0x5ceda5=_0x439fe1;if(_[_0xff66('0x62')](_0x5ceda5,0x64)){var _0x450854=_[_0xff66('0x4f')](_0x9528b7,{'sectionId':0x64});return hasDefaultDashboard(_0x450854)[_0xff66('0x2a')](function(_0x416b45){return _['map'](_0x9528b7,function(_0x2aac34){if(_0x2aac34['sectionId']===0x64){_0x2aac34['subsections']=_0x416b45;}return _0x2aac34;});});}else{return;}})[_0xff66('0x2a')](function(_0x160daf){if(_0x160daf)_0x9528b7=_0x160daf;if(_[_0xff66('0x62')](_0x5ceda5,0x3eb)){var _0x1a82b7=_[_0xff66('0x4f')](_0x9528b7,{'sectionId':0x3eb});return getCustomDashboards(_0x1a82b7)['then'](function(_0x374438){return _['map'](_0x9528b7,function(_0x3a4393){if(_0x1a82b7['enabled']){if(_0x3a4393[_0xff66('0x5d')]===0x3eb){_0x3a4393[_0xff66('0x64')]=_0x374438;}}else{if(_0x3a4393['sectionId']===0x64){if(!_0x3a4393[_0xff66('0x64')]){_0x3a4393[_0xff66('0x64')]=[];}_0x3a4393[_0xff66('0x64')]=_0x3a4393[_0xff66('0x64')]['concat'](_0x374438);}}return _0x3a4393;});});}else{return;}})[_0xff66('0x2a')](function(_0x101d1e){if(_0x101d1e)_0x9528b7=_0x101d1e;if(_['includes'](_0x5ceda5,0x709)){var _0x2c105f=_[_0xff66('0x4f')](_0x9528b7,{'sectionId':0x709});return getPlugins(_0x2c105f)[_0xff66('0x2a')](function(_0x51ae3f){if(_0x2c105f[_0xff66('0x61')]){return _[_0xff66('0x35')](_0x9528b7,function(_0x44beb6){if(_0x44beb6['sectionId']===0x709){_0x44beb6[_0xff66('0x64')]=_0x51ae3f;}return _0x44beb6;});}else{var _0x1d9a41={'sectionId':0x76c,'enabled':0x1,'subsections':_0x51ae3f};var _0x219d16=_[_0xff66('0x35')](_0x9528b7);_0x219d16[_0xff66('0x5f')](_0x1d9a41);return _0x219d16;}});}else{return;}})[_0xff66('0x2a')](function(_0x24065c){if(_0x24065c)_0x9528b7=_0x24065c;return _[_0xff66('0x43')](_0x9528b7,[_0xff66('0x61'),0x1]);})[_0xff66('0x2a')](respondWithResult(_0x10bcfa,null))[_0xff66('0x4d')](handleError(_0x10bcfa,null));};function hasDefaultDashboard(_0xe68ce9){var _0x2012b3=[0x65];return new BPromise(function(_0x3e4cff,_0xcfcb9){try{if(_0xe68ce9[_0xff66('0x58')]){_0x3e4cff(_0x2012b3);}else{return db[_0xff66('0x59')][_0xff66('0x65')]({'where':{'sectionId':_0xe68ce9['id']},'raw':!![]})[_0xff66('0x2a')](function(_0x7a153f){_0x7a153f?_0x3e4cff(_0x2012b3):_0x3e4cff();});}}catch(_0x5c5c37){_0xcfcb9(_0x5c5c37);}});}function getCustomDashboards(_0x425d37){var _0x7451c9=[];return new BPromise(function(_0x811a10,_0x300e1a){try{if(_0x425d37[_0xff66('0x58')]){return db[_0xff66('0x66')]['findAll']({'raw':!![]})[_0xff66('0x2a')](function(_0x39f1ad){_0x39f1ad['forEach'](function(_0x440c5d){_0x7451c9['push'](_0x440c5d['id']+0x1869f);});_0x811a10(_0x7451c9);});}else{return db[_0xff66('0x59')][_0xff66('0x46')]({'where':{'sectionId':_0x425d37['id']},'raw':!![]})[_0xff66('0x2a')](function(_0xcb6d8d){_0xcb6d8d[_0xff66('0x67')](function(_0x302bd5){_0x7451c9[_0xff66('0x5f')](_0x302bd5[_0xff66('0x68')]+0x1869f);});_0x811a10(_0x7451c9);});}}catch(_0x1020a3){_0x300e1a(_0x1020a3);}});}function getPlugins(_0x48fa09){var _0x4ad8d9=[];return new BPromise(function(_0x27ac8d,_0x154f77){try{if(_0x48fa09['autoAssociation']){return db[_0xff66('0x69')][_0xff66('0x46')]({'raw':!![]})['then'](function(_0x3f0eef){_0x3f0eef[_0xff66('0x67')](function(_0x2d0ef9){_0x4ad8d9[_0xff66('0x5f')](_0x2d0ef9['id']+0x15b38);});_0x27ac8d(_0x4ad8d9);});}else{return db[_0xff66('0x59')][_0xff66('0x46')]({'where':{'sectionId':_0x48fa09['id']},'raw':!![]})[_0xff66('0x2a')](function(_0x434b1a){_0x434b1a[_0xff66('0x67')](function(_0x2e5ae9){_0x4ad8d9[_0xff66('0x5f')](_0x2e5ae9[_0xff66('0x68')]+0x15b38);});_0x27ac8d(_0x4ad8d9);});}}catch(_0x4b20e6){_0x154f77(_0x4b20e6);}});}exports[_0xff66('0x6a')]=function(_0x320065,_0x4a94a0){return db[_0xff66('0x2f')][_0xff66('0x4f')]({'where':{'id':_0x320065[_0xff66('0x49')]['id']}})[_0xff66('0x2a')](handleEntityNotFound(_0x4a94a0,null))[_0xff66('0x2a')](function(_0x1a7bfc){if(_0x1a7bfc){return db['sequelize'][_0xff66('0x56')](function(_0x16158e){return db[_0xff66('0x57')][_0xff66('0x46')]({'where':{'userProfileId':_0x320065['params']['id']},'attributes':['id'],'raw':!![]})[_0xff66('0x2a')](function(_0x4f1ecf){if(_0x4f1ecf){return db[_0xff66('0x57')][_0xff66('0x2b')]({'where':{'userProfileId':_0x320065[_0xff66('0x49')]['id'],'id':_['map'](_0x4f1ecf,function(_0x4c8e9c){return _0x4c8e9c['id'];})},'transaction':_0x16158e});}})[_0xff66('0x2a')](function(_0x7fe3aa){var _0xef7d91=_['map'](_0x320065[_0xff66('0x4c')],function(_0x5e69b3){_0x5e69b3['userProfileId']=_0x320065[_0xff66('0x49')]['id'];return _0x5e69b3;});return db[_0xff66('0x57')]['bulkCreate'](_0xef7d91,{'raw':!![],'transaction':_0x16158e});})[_0xff66('0x2a')](function(_0x46eb5b){var _0x51d40d=_[_0xff66('0x43')](_[_0xff66('0x35')](_0x46eb5b,function(_0x50839a){return _0x50839a[_0xff66('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x51d40d){return db[_0xff66('0x57')][_0xff66('0x46')]({'where':{'userProfileId':_0x320065[_0xff66('0x49')]['id'],'sectionId':_['map'](_0x51d40d,function(_0xee6682){return _0xee6682[_0xff66('0x5d')];})},'attributes':['id',_0xff66('0x5d')],'raw':!![]})['then'](function(_0x3f635f){var _0x31f819=_[_0xff66('0x35')](_0x320065[_0xff66('0x4c')],function(_0x34c3c1){_0x34c3c1[_0xff66('0x5e')]=_0x320065[_0xff66('0x49')]['id'];return _0x34c3c1;});return db['UserProfileResource']['bulkCreate'](_0x31f819,{'raw':!![],'transaction':_0x16158e});});}})['catch'](handleError(_0x4a94a0,null));});}})[_0xff66('0x2a')](function(_0x2b2c6e){var _0x40340f=_[_0xff66('0x35')](_0x2b2c6e,function(_0x5ef0c3){return _0x5ef0c3[_0xff66('0x50')]({'plain':!![]});});})[_0xff66('0x2a')](respondWithResult(_0x4a94a0,null))[_0xff66('0x4d')](handleError(_0x4a94a0,null));};exports[_0xff66('0x6b')]=function(_0x4a1dfb,_0x5c38c0,_0x1046a2){return db[_0xff66('0x2f')][_0xff66('0x4f')]({'where':{'id':_0x4a1dfb['params']['id']}})[_0xff66('0x2a')](handleEntityNotFound(_0x5c38c0,null))[_0xff66('0x2a')](function(_0x588130){if(_0x588130){return _0x588130[_0xff66('0x6b')](_0x4a1dfb[_0xff66('0x36')][_0xff66('0x6c')]);}})[_0xff66('0x2a')](respondWithStatusCode(_0x5c38c0,null))['catch'](handleError(_0x5c38c0,null));};exports['getResources']=function(_0x2ea9c4,_0x6ca9a8){var _0xe2f0d2={};if(!_0x2ea9c4[_0xff66('0x36')][_0xff66('0x6d')])throw new Error(_0xff66('0x6e'));if(!_0x2ea9c4[_0xff66('0x36')][_0xff66('0x3d')](_0xff66('0x6f'))){_0xe2f0d2[_0xff66('0x23')]=qs[_0xff66('0x23')](_0x2ea9c4[_0xff66('0x36')][_0xff66('0x23')]);_0xe2f0d2[_0xff66('0x21')]=qs[_0xff66('0x21')](_0x2ea9c4['query'][_0xff66('0x21')]);}return db[_0xff66('0x2f')]['find']({'where':{'id':_0x2ea9c4[_0xff66('0x49')]['id']}})[_0xff66('0x2a')](function(_0x291c42){if(!_0x291c42)throw new Error(_0xff66('0x70')+_0x2ea9c4[_0xff66('0x49')]['id']);return db[_0xff66('0x2f')][_0xff66('0x71')](_0x2ea9c4);})['then'](respondWithFilteredResult(_0x6ca9a8,_0xe2f0d2))[_0xff66('0x4d')](handleError(_0x6ca9a8,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index c7b3c35..8203305 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 _0x7e02=['hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit'];(function(_0x295cf1,_0x2ecefa){var _0x262062=function(_0x4d7199){while(--_0x4d7199){_0x295cf1['push'](_0x295cf1['shift']());}};_0x262062(++_0x2ecefa);}(_0x7e02,0x71));var _0x27e0=function(_0x2584bc,_0x35d9f5){_0x2584bc=_0x2584bc-0x0;var _0x405f2c=_0x7e02[_0x2584bc];return _0x405f2c;};'use strict';var EventEmitter=require(_0x27e0('0x0'));var UserProfile=require(_0x27e0('0x1'))['db'][_0x27e0('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x27e0('0x3')](0x0);var events={'afterCreate':_0x27e0('0x4'),'afterUpdate':_0x27e0('0x5'),'afterDestroy':_0x27e0('0x6')};function emitEvent(_0x57d7fb){return function(_0x4fa613,_0x3d4f41,_0x5abeff){UserProfileEvents[_0x27e0('0x7')](_0x57d7fb+':'+_0x4fa613['id'],_0x4fa613);UserProfileEvents[_0x27e0('0x7')](_0x57d7fb,_0x4fa613);_0x5abeff(null);};}for(var e in events){if(events[_0x27e0('0x8')](e)){var event=events[e];UserProfile[_0x27e0('0x9')](e,emitEvent(event));}}module[_0x27e0('0xa')]=UserProfileEvents; \ No newline at end of file +var _0x6691=['hook','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xa35f5d,_0x14e107){var _0x36a78b=function(_0x134b12){while(--_0x134b12){_0xa35f5d['push'](_0xa35f5d['shift']());}};_0x36a78b(++_0x14e107);}(_0x6691,0x12d));var _0x1669=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x6691[_0x5ddb1c];return _0x354adc;};'use strict';var EventEmitter=require(_0x1669('0x0'));var UserProfile=require(_0x1669('0x1'))['db'][_0x1669('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1669('0x3')](0x0);var events={'afterCreate':_0x1669('0x4'),'afterUpdate':_0x1669('0x5'),'afterDestroy':_0x1669('0x6')};function emitEvent(_0x455cbd){return function(_0x19a3f5,_0x2ad807,_0x4b41a5){UserProfileEvents[_0x1669('0x7')](_0x455cbd+':'+_0x19a3f5['id'],_0x19a3f5);UserProfileEvents[_0x1669('0x7')](_0x455cbd,_0x19a3f5);_0x4b41a5(null);};}for(var e in events){if(events[_0x1669('0x8')](e)){var event=events[e];UserProfile[_0x1669('0x9')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 1a10cd3..f803ef8 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 _0x1ee4=['resourceId','toLowerCase','squareprojects','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','VoicePrefix','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','queuecampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','deskaccounts','zohoaccounts','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','Template','triggers','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','toUpperCase','slice','Sequelize','SELECT','select','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','UserProfile','raw','section','mergeResources','isEmpty','length','push','params','all','ignore','union','find','rawAttributes','keys','filters','attributes','intersection','fields','nolimit','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','DefaultReports','count','rows','ids','customSorting','extraQueryConditions','color','ThroughTags','tag','openTabs','chat','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','filter','field','value','then','associatedResources','catch','model','findAll','map','name','AnalyticExtractedReport','type'];(function(_0x3220bb,_0x342a03){var _0x23415c=function(_0x56cc05){while(--_0x56cc05){_0x3220bb['push'](_0x3220bb['shift']());}};_0x23415c(++_0x342a03);}(_0x1ee4,0xab));var _0x41ee=function(_0xe2ecde,_0x156dd5){_0xe2ecde=_0xe2ecde-0x0;var _0x5ea3a5=_0x1ee4[_0xe2ecde];return _0x5ea3a5;};'use strict';var _=require(_0x41ee('0x0'));var attributes=require(_0x41ee('0x1'));var qs=require(_0x41ee('0x2'));var squel=require(_0x41ee('0x3'));module['exports']=function(_0x5e2e52){var _0x3293bd=_0x5e2e52['models'];function _0x47ed0c(_0x138b68,_0x40405e){return new Promise(function(_0x89a16b,_0x4b64aa){if(!_0x40405e)return _0x89a16b(null);var _0x1f0c6e=_0x40405e[_0x41ee('0x4')]?{[_0x40405e[_0x41ee('0x4')][_0x41ee('0x5')]]:_0x40405e[_0x41ee('0x4')][_0x41ee('0x6')]}:undefined;return _0x3293bd[_0x138b68]['findAll']({'where':_0x1f0c6e,'raw':!![]})[_0x41ee('0x7')](function(_0x1e0797){_0x40405e[_0x41ee('0x8')]=_['map'](_0x1e0797,'id');_0x89a16b(_0x40405e);})[_0x41ee('0x9')](function(_0x1d840d){_0x4b64aa(_0x1d840d);});});}function _0x4a3883(_0x222228,_0x4f2afd){return new Promise(function(_0x4ae752,_0x1e9a73){var _0x4a46d9=_0x222228['filter']?{[_0x222228[_0x41ee('0x4')][_0x41ee('0x5')]]:_0x222228[_0x41ee('0x4')][_0x41ee('0x6')]}:undefined;return _0x3293bd[_0x222228[_0x41ee('0xa')]][_0x41ee('0xb')]({'where':_0x4a46d9,'raw':!![]})['then'](function(_0x48414b){_0x4f2afd[_0x41ee('0x8')]=_[_0x41ee('0xc')](_0x48414b,function(_0x355e47){return _0x355e47[_0x41ee('0xd')];});_0x4ae752(_0x4f2afd);})[_0x41ee('0x9')](function(_0x499c91){_0x1e9a73(_0x499c91);});});}function _0x4bf908(_0x5ee8a1,_0x1b099b,_0x932f95){if(!_0x1b099b)return Promise['resolve'](null);return new Promise(function(_0x579c45,_0x35b75e){return _0x3293bd['UserProfileResource'][_0x41ee('0xb')]({'where':{'sectionId':_0x1b099b['id']},'raw':!![]})[_0x41ee('0x7')](function(_0x49c5b1){if(_0x5ee8a1[_0x41ee('0x5')]&&_0x5ee8a1['field']!=='id'){_0x1b099b[_0x41ee('0x8')]=_[_0x41ee('0xc')](_0x49c5b1,function(_0x436e48){return _0x436e48[_0x5ee8a1[_0x41ee('0x5')]];});}else{if(_0x932f95===_0x41ee('0xe')){_0x1b099b[_0x41ee('0x8')]=_[_0x41ee('0xc')](_0x49c5b1,function(_0x3099d3){return{'id':_0x3099d3['resourceId'],'type':_0x3099d3[_0x41ee('0xf')]};});}else{_0x1b099b[_0x41ee('0x8')]=_['map'](_0x49c5b1,function(_0x32ec06){return _0x32ec06[_0x41ee('0x10')];});}}_0x579c45(_0x1b099b);})[_0x41ee('0x9')](function(_0xac66eb){_0x35b75e(_0xac66eb);});});}function _0x5d699f(_0x59a4e6,_0x10a51d){var _0x505a7a={'parentSections':[]};switch(_0x59a4e6[_0x41ee('0x11')]()){case _0x41ee('0x12'):_0x505a7a[_0x41ee('0x13')]='SquareProject';break;case _0x41ee('0x14'):_0x505a7a['childModel']=_0x41ee('0x15');break;case _0x41ee('0x16'):_0x505a7a['childModel']=_0x41ee('0x17');_0x505a7a[_0x41ee('0x18')]=[{'name':_0x41ee('0x19'),'field':_0x41ee('0xd'),'foreignKey':_0x41ee('0x1a')}];break;case _0x41ee('0x1b'):_0x505a7a['childModel']=_0x41ee('0x1c');break;case _0x41ee('0x1d'):_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x1e');_0x505a7a[_0x41ee('0x18')]=[{'name':_0x41ee('0x1f'),'field':'id','foreignKey':_0x41ee('0x20')}];break;case'lists':_0x505a7a['childModel']=_0x41ee('0x21');break;case _0x41ee('0x22'):_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x23');break;case _0x41ee('0x24'):_0x505a7a['childModel']=_0x41ee('0x25');break;case _0x41ee('0x26'):_0x505a7a['childModel']=_0x41ee('0x27');break;case _0x41ee('0x28'):_0x505a7a['childModel']='ChatWebsite';break;case _0x41ee('0x29'):_0x505a7a['childModel']=_0x41ee('0x2a');break;case'faxaccounts':_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x2b');break;case _0x41ee('0x2c'):case _0x41ee('0x2d'):case'outboundroutes':_0x505a7a['childModel']=_0x41ee('0x2e');break;case _0x41ee('0x2f'):_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x30');break;case _0x41ee('0x31'):_0x505a7a['childModel']=_0x41ee('0x32');break;case'voicerecordings':_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x33');_0x505a7a[_0x41ee('0x18')]=[{'name':_0x41ee('0x34'),'field':_0x41ee('0xd'),'foreignKey':_0x41ee('0x35'),'model':_0x41ee('0x36'),'filter':{'field':_0x41ee('0x37'),'value':[_0x41ee('0x38')]}},{'name':_0x41ee('0x39'),'field':_0x41ee('0xd'),'foreignKey':_0x41ee('0x35'),'model':_0x41ee('0x36'),'filter':{'field':_0x41ee('0x37'),'value':[_0x41ee('0x3a')]}},{'name':_0x41ee('0x3b'),'field':_0x41ee('0xd'),'foreignKey':_0x41ee('0x3c'),'model':_0x41ee('0x3d'),'filter':{'field':_0x41ee('0xf'),'value':[_0x41ee('0x3e')]}},{'name':_0x41ee('0x3f'),'field':_0x41ee('0xd'),'foreignKey':_0x41ee('0x3c'),'model':_0x41ee('0x3d'),'filter':{'field':_0x41ee('0xf'),'value':[_0x41ee('0x40')]}}];break;case _0x41ee('0x41'):_0x505a7a[_0x41ee('0x13')]='VoiceMusicOnHold';break;case _0x41ee('0x42'):_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x43');break;case'voiceprefixes':_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x44');break;case'ivrcampaigns':_0x505a7a[_0x41ee('0x13')]='Campaign';break;case'mailqueues':_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x45');break;case'mailaccounts':_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x46');break;case _0x41ee('0x47'):_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x48');break;case _0x41ee('0x49'):_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x4a');break;case _0x41ee('0x4b'):_0x505a7a[_0x41ee('0x13')]='OpenchannelAccount';break;case _0x41ee('0x4c'):_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x4d');break;case'smsaccounts':_0x505a7a[_0x41ee('0x13')]='SmsAccount';break;case _0x41ee('0x4e'):_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x4f');break;case _0x41ee('0x50'):_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x51');break;case _0x41ee('0x52'):_0x505a7a['childModel']='Team';break;case'voicequeues':case _0x41ee('0x53'):_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x3d');if(_0x10a51d){_0x505a7a[_0x41ee('0x18')]=[{'name':_0x41ee('0x3b')},{'name':_0x41ee('0x3f')}];}break;case _0x41ee('0x54'):case _0x41ee('0x55'):case _0x41ee('0x56'):_0x505a7a[_0x41ee('0x13')]='User';if(_0x10a51d){_0x505a7a[_0x41ee('0x18')]=[{'name':_0x41ee('0x57'),'filter':{'field':_0x41ee('0x37'),'value':[_0x41ee('0x58'),_0x41ee('0x59')]},'ignore':!![]},{'name':_0x41ee('0x34')},{'name':_0x41ee('0x39')}];}break;case _0x41ee('0x5a'):_0x505a7a[_0x41ee('0x13')]='ZendeskAccount';break;case _0x41ee('0x5b'):_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x5c');break;case'freshdeskaccounts':_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x5d');break;case _0x41ee('0x5e'):_0x505a7a[_0x41ee('0x13')]='SugarcrmAccount';break;case _0x41ee('0x5f'):_0x505a7a[_0x41ee('0x13')]='DeskAccount';break;case _0x41ee('0x60'):_0x505a7a[_0x41ee('0x13')]='ZohoAccount';break;case _0x41ee('0x61'):_0x505a7a['childModel']=_0x41ee('0x36');break;case'cannedanswers':_0x505a7a['childModel']=_0x41ee('0x62');break;case _0x41ee('0x63'):_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x64');break;case _0x41ee('0x65'):_0x505a7a[_0x41ee('0x13')]='Dashboard';break;case _0x41ee('0x66'):_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x67');break;case'pauses':_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x68');break;case _0x41ee('0x69'):_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x6a');break;case _0x41ee('0x6b'):_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x6c');break;case _0x41ee('0x6d'):_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x6e');break;case'templates':_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x6f');break;case _0x41ee('0x70'):_0x505a7a[_0x41ee('0x13')]='Trigger';break;case _0x41ee('0x71'):_0x505a7a['childModel']=_0x41ee('0x72');break;case _0x41ee('0x73'):_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x74');break;case _0x41ee('0x75'):_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x76');break;case _0x41ee('0x77'):_0x505a7a[_0x41ee('0x13')]=_0x41ee('0xe');_0x505a7a[_0x41ee('0x18')]=[{'name':_0x41ee('0x78'),'field':'id','foreignKey':_0x41ee('0x79')}];break;case'metrics':_0x505a7a[_0x41ee('0x13')]=_0x41ee('0x7a');break;}return _0x505a7a;}function _0xe843ad(_0x54cc04,_0x27e35d){var _0x1c5905=_0x54cc04['charAt'](0x0)[_0x41ee('0x7b')]()+_0x54cc04[_0x41ee('0x7c')](0x1);var _0x9dc761={'type':_0x3293bd[_0x41ee('0x7d')]['QueryTypes'][_0x41ee('0x7e')],'raw':!![]};return new Promise(function(_0x4699c3,_0x3ccbe3){var _0x5f47dc=squel[_0x41ee('0x7f')]()[_0x41ee('0x5')]('ui.'+_0x1c5905+_0x41ee('0x80'),'id')[_0x41ee('0x5')](_0x41ee('0x81'))[_0x41ee('0x82')](_0x41ee('0x83')+_0x54cc04+_0x41ee('0x84'),'ui')[_0x41ee('0x85')](_0x41ee('0x86'),_0x27e35d['id']);return _0x3293bd[_0x41ee('0x87')][_0x41ee('0x88')](_0x5f47dc[_0x41ee('0x89')](),_0x9dc761)['then'](function(_0x889ef4){_0x27e35d[_0x1c5905+_0x41ee('0x8a')]=_0x889ef4;_0x4699c3(_0x889ef4);})[_0x41ee('0x9')](function(_0x542859){_0x3ccbe3(_0x542859);});});}return _0x5e2e52['define'](_0x41ee('0x8b'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x43785e){var _0xffef8c={'raw':_0x43785e[_0x41ee('0x88')][_0x41ee('0x8c')],'where':{}};var _0xb56f75={};var _0x2c4703={'count':0x0,'rows':[]};var _0x23247d=_0x43785e[_0x41ee('0x88')][_0x41ee('0x8d')];var _0x56ad72=_0x43785e[_0x41ee('0x88')][_0x41ee('0x8e')]||![];var _0x266d35=_0x5d699f(_0x23247d,_0x56ad72);if(!_0x266d35[_0x41ee('0x13')])throw new Error('Invalid\x20section\x20\x27'+_0x23247d+'\x27');var _0x5e22d2=[{'name':_0x23247d}];if(!_[_0x41ee('0x8f')](_0x266d35[_0x41ee('0x18')]))_0x5e22d2=_0x266d35[_0x41ee('0x18')];var _0xea0bc2=[];for(var _0x3c90d4=0x0;_0x3c90d4<_0x5e22d2[_0x41ee('0x90')];_0x3c90d4++){_0xea0bc2[_0x41ee('0x91')](_0x3293bd['UserProfileSection']['find']({'where':{'userProfileId':_0x43785e[_0x41ee('0x92')]['id'],'name':_0x5e22d2[_0x3c90d4][_0x41ee('0xd')]},'raw':!![]}));}return Promise[_0x41ee('0x93')](_0xea0bc2)['then'](function(_0x5defc3){var _0x12bb80=_[_0x41ee('0x4')](_0x5defc3,function(_0x5d1731){return _0x5d1731?_0x5d1731:undefined;});var _0x59ab65=_[_0x41ee('0x4')](_0x5e22d2,[_0x41ee('0x94'),!![]]);var _0x4a9a92=_[_0x41ee('0x8f')](_0x12bb80)&&_[_0x41ee('0x8f')](_0x59ab65)?null:_[_0x41ee('0x95')](_0x59ab65,_0x12bb80);if(!_0x4a9a92)return null;var _0x53e883=[];for(var _0xad764a=0x0;_0xad764a<_0x4a9a92['length'];_0xad764a++){var _0x305e24=_[_0x41ee('0x96')](_0x5e22d2,function(_0x47021b){return _0x4a9a92[_0xad764a]?_0x47021b[_0x41ee('0xd')]===_0x4a9a92[_0xad764a]['name']:null;});if(_0x305e24){if(_0x4a9a92[_0xad764a][_0x41ee('0x94')]){_0x53e883[_0x41ee('0x91')](_0x47ed0c(_0x266d35[_0x41ee('0x13')],_0x4a9a92[_0xad764a]));}else{if(!_0x4a9a92[_0xad764a]['autoAssociation']){_0x53e883['push'](_0x4bf908(_0x305e24,_0x4a9a92[_0xad764a],_0x266d35[_0x41ee('0x13')]));}else{if(_0x305e24['model']){_0x53e883[_0x41ee('0x91')](_0x4a3883(_0x305e24,_0x4a9a92[_0xad764a]));}}}}}return Promise[_0x41ee('0x93')](_0x53e883);})[_0x41ee('0x7')](function(_0x470fd8){var _0x568a3b=_0x470fd8;var _0x1ee38c=null;if(_0x568a3b){_0x1ee38c=_0x568a3b[_0x41ee('0x90')]===0x1?_0x568a3b[0x0]:null;}if(!_0x1ee38c&&!_0x568a3b)return _0x2c4703;var _0x31654d=_0x3293bd[_0x266d35[_0x41ee('0x13')]][_0x41ee('0x97')];_0xb56f75['model']=_[_0x41ee('0x98')](_0x31654d);_0xb56f75[_0x41ee('0x88')]=_[_0x41ee('0x98')](_0x43785e[_0x41ee('0x88')]);_0xb56f75[_0x41ee('0x99')]=_['intersection'](_0xb56f75[_0x41ee('0xa')],_0xb56f75[_0x41ee('0x88')]);_0xffef8c[_0x41ee('0x9a')]=_[_0x41ee('0x9b')](_0xb56f75[_0x41ee('0xa')],qs['fields'](_0x43785e[_0x41ee('0x88')][_0x41ee('0x9c')]));_0xffef8c[_0x41ee('0x9a')]=_0xffef8c['attributes'][_0x41ee('0x90')]?_0xffef8c[_0x41ee('0x9a')]:_0xb56f75[_0x41ee('0xa')];if(!_0x43785e['query']['hasOwnProperty'](_0x41ee('0x9d'))){_0xffef8c[_0x41ee('0x9e')]=qs[_0x41ee('0x9e')](_0x43785e['query'][_0x41ee('0x9e')]);_0xffef8c[_0x41ee('0x9f')]=qs[_0x41ee('0x9f')](_0x43785e['query']['offset']);}_0xffef8c[_0x41ee('0xa0')]=qs[_0x41ee('0xa1')](_0x43785e['query']['sort']);_0xffef8c[_0x41ee('0x85')]=qs[_0x41ee('0x99')](_[_0x41ee('0xa2')](_0x43785e[_0x41ee('0x88')],_0xb56f75[_0x41ee('0x99')]));if(_0x43785e[_0x41ee('0x88')][_0x41ee('0x4')]){_0xffef8c['where']=_[_0x41ee('0xa3')](_0xffef8c[_0x41ee('0x85')],{'$or':_[_0x41ee('0xc')](_0x31654d,function(_0x4da813){if(_0x4da813[_0x41ee('0xf')]['key']!==_0x41ee('0xa4')){var _0x4efd93={};_0x4efd93[_0x4da813['field']]={'$like':'%'+_0x43785e[_0x41ee('0x88')][_0x41ee('0x4')]+'%'};return _0x4efd93;}})});}var _0x4d56d1=[];var _0x149853=null;var _0x37db52={};if(_0x1ee38c){_0x149853=_[_0x41ee('0x96')](_0x5e22d2,[_0x41ee('0xd'),_0x1ee38c[_0x41ee('0xd')]]);if(_0x149853[_0x41ee('0x5')]){_0x37db52={};if(_0x266d35['childModel']===_0x41ee('0xe')){_0x37db52[_0x149853['foreignKey']]=_[_0x41ee('0xc')](_0x1ee38c['associatedResources'],'id');}else{_0x37db52[_0x149853[_0x41ee('0xa5')]]=_0x1ee38c['associatedResources'];}_0x4d56d1[_0x41ee('0x91')](_0x37db52);}else{_0xffef8c[_0x41ee('0x85')]['id']=_0x1ee38c['associatedResources'];}}else{for(var _0x430b7f=0x0;_0x430b7f<_0x568a3b['length'];_0x430b7f++){_0x149853=_[_0x41ee('0x96')](_0x5e22d2,['name',_0x568a3b[_0x430b7f][_0x41ee('0xd')]]);if(_0x149853[_0x41ee('0x5')]){_0x37db52={};_0x37db52[_0x149853[_0x41ee('0xa5')]]=_0x568a3b[_0x430b7f][_0x41ee('0x8')];_0x4d56d1['push'](_0x37db52);}else{if(!_0xffef8c[_0x41ee('0x85')]['id'])_0xffef8c[_0x41ee('0x85')]['id']=[];_0x568a3b[_0x430b7f][_0x41ee('0x8')][_0x41ee('0xa6')](function(_0x3f5298){_0xffef8c[_0x41ee('0x85')]['id'][_0x41ee('0x91')](_0x3f5298);});}}}if(!_[_0x41ee('0x8f')](_0x4d56d1)){_0xffef8c['where']=_[_0x41ee('0xa3')](_0xffef8c[_0x41ee('0x85')],{'$and':{'$or':_0x4d56d1}});}_0xffef8c=_[_0x41ee('0xa3')]({},_0xffef8c,_0x43785e[_0x41ee('0xa7')]);if(_0x1ee38c&&!_0x1ee38c['autoAssociation']&&_0x266d35[_0x41ee('0x13')]==='AnalyticExtractedReport'){if(_0x43785e[_0x41ee('0x88')][_0x41ee('0xa8')]){_0xffef8c[_0x41ee('0xa9')]=[{'all':!![]}];}return _0x3293bd[_0x266d35[_0x41ee('0x13')]][_0x41ee('0xb')](_0xffef8c)['then'](function(_0x94b3e3){var _0x4b0a01=[];_0x94b3e3[_0x41ee('0xa6')](function(_0x4e84ac){var _0x2651e9;switch(_0x4e84ac[_0x41ee('0xaa')]){case'default':_0x2651e9=_['find'](_0x1ee38c[_0x41ee('0x8')],function(_0x242aad){return _0x242aad['id']===_0x4e84ac[_0x41ee('0x79')]&&_0x242aad[_0x41ee('0xf')]===_0x41ee('0xab');});break;case'custom':_0x2651e9=_[_0x41ee('0x96')](_0x1ee38c[_0x41ee('0x8')],function(_0x4e263e){return _0x4e263e['id']===_0x4e84ac[_0x41ee('0x79')]&&_0x4e263e['type']==='CustomReports';});break;}if(_0x2651e9)_0x4b0a01[_0x41ee('0x91')](_0x4e84ac);});_0x2c4703[_0x41ee('0xac')]=_0x4b0a01[_0x41ee('0x90')];_0x2c4703[_0x41ee('0xad')]=_0x4b0a01;return _0x2c4703;});}else{if(!_[_0x41ee('0x8f')](_0x43785e[_0x41ee('0x88')]['ids'])){_0xffef8c[_0x41ee('0x85')]['id']=_0xffef8c[_0x41ee('0x85')]['id']?_[_0x41ee('0x9b')](_0xffef8c['where']['id'],_0x43785e['query'][_0x41ee('0xae')]):_0x43785e[_0x41ee('0x88')][_0x41ee('0xae')];if(_0x43785e[_0x41ee('0x88')]['customSorting']){_0xffef8c[_0x41ee('0xa0')]=_0x43785e[_0x41ee('0x88')][_0x41ee('0xaf')];}}if(_0x43785e['query']['extraQueryConditions']){_0xffef8c['where']=_[_0x41ee('0xa3')](_0xffef8c['where'],{'$and':_0x43785e[_0x41ee('0x88')][_0x41ee('0xb0')]});}return _0x3293bd[_0x266d35['childModel']][_0x41ee('0xac')]({'where':_0xffef8c[_0x41ee('0x85')]})[_0x41ee('0x7')](function(_0x4c3dc0){_0x2c4703['count']=_0x4c3dc0;if(_0x43785e[_0x41ee('0x88')][_0x41ee('0xa8')]){if(_0x266d35['childModel']==='CmContact'){_0xffef8c[_0x41ee('0xa9')]=[{'model':_0x3293bd[_0x41ee('0x6e')],'as':'Tags','attributes':['id',_0x41ee('0xd'),_0x41ee('0xb1')],'required':_0x43785e['query']['tag']?!![]:![]},{'model':_0x3293bd[_0x41ee('0x6e')],'as':_0x41ee('0xb2'),'attributes':['id','name','color'],'through':_0x43785e[_0x41ee('0x88')][_0x41ee('0xb3')]?{'attributes':[],'where':{'TagId':_0x43785e[_0x41ee('0x88')][_0x41ee('0xb3')]||undefined}}:{},'required':_0x43785e[_0x41ee('0x88')][_0x41ee('0xb3')]?!![]:![]}];}else{_0xffef8c['include']=[{'all':!![]}];}}return _0x3293bd[_0x266d35[_0x41ee('0x13')]]['findAll'](_0xffef8c);})[_0x41ee('0x7')](function(_0x2c2235){_0x2c4703[_0x41ee('0xad')]=_0x2c2235;if(_0x23247d===_0x41ee('0x34')&&_0x43785e[_0x41ee('0x88')][_0x41ee('0xb4')]==='true'){var _0x4172fb=[];for(var _0x35b1a1=0x0;_0x35b1a1<_0x2c4703[_0x41ee('0xad')][_0x41ee('0x90')];_0x35b1a1++){_0x4172fb['push'](_0xe843ad(_0x41ee('0xb5'),_0x2c4703[_0x41ee('0xad')][_0x35b1a1][_0x41ee('0xb6')]));_0x4172fb[_0x41ee('0x91')](_0xe843ad('sms',_0x2c4703[_0x41ee('0xad')][_0x35b1a1][_0x41ee('0xb6')]));_0x4172fb[_0x41ee('0x91')](_0xe843ad(_0x41ee('0xb7'),_0x2c4703[_0x41ee('0xad')][_0x35b1a1][_0x41ee('0xb6')]));_0x4172fb[_0x41ee('0x91')](_0xe843ad(_0x41ee('0xb8'),_0x2c4703[_0x41ee('0xad')][_0x35b1a1][_0x41ee('0xb6')]));_0x4172fb['push'](_0xe843ad(_0x41ee('0xb9'),_0x2c4703[_0x41ee('0xad')][_0x35b1a1]['dataValues']));_0x4172fb[_0x41ee('0x91')](_0xe843ad(_0x41ee('0xba'),_0x2c4703[_0x41ee('0xad')][_0x35b1a1][_0x41ee('0xb6')]));}return Promise['all'](_0x4172fb)['then'](function(){return _0x2c4703;});}return _0x2c4703;});}});}}});}; \ No newline at end of file +var _0x5c59=['fax','mail','whatsapp','lodash','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','name','catch','resolve','UserProfileResource','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','JscriptyProject','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','mailqueues','MailQueue','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','QueueCampaigns','users','agents','telephones','Users','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','Pause','Schedule','Sound','tags','Tag','templates','Template','Trigger','trunks','Trunk','variables','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','AnalyticMetric','QueryTypes','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','ignore','union','autoAssociation','model','all','keys','filters','intersection','attributes','fields','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','true','sms','dataValues'];(function(_0x5e28c2,_0x1e48ab){var _0x1a8cc6=function(_0x1218bf){while(--_0x1218bf){_0x5e28c2['push'](_0x5e28c2['shift']());}};_0x1a8cc6(++_0x1e48ab);}(_0x5c59,0x17d));var _0x95c5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5c59[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x95c5('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0x95c5('0x1'));var squel=require(_0x95c5('0x2'));module[_0x95c5('0x3')]=function(_0x3c73d4){var _0x2c90c1=_0x3c73d4[_0x95c5('0x4')];function _0x7f2a40(_0x2d158f,_0x1c66a4){return new Promise(function(_0x547772,_0x5b5030){if(!_0x1c66a4)return _0x547772(null);var _0x109eea=_0x1c66a4[_0x95c5('0x5')]?{[_0x1c66a4[_0x95c5('0x5')][_0x95c5('0x6')]]:_0x1c66a4['filter'][_0x95c5('0x7')]}:undefined;return _0x2c90c1[_0x2d158f][_0x95c5('0x8')]({'where':_0x109eea,'raw':!![]})[_0x95c5('0x9')](function(_0x1fdf0d){_0x1c66a4[_0x95c5('0xa')]=_[_0x95c5('0xb')](_0x1fdf0d,'id');_0x547772(_0x1c66a4);})['catch'](function(_0x50c92a){_0x5b5030(_0x50c92a);});});}function _0x2eb240(_0x5d5ecc,_0x4cc261){return new Promise(function(_0x2a2ddc,_0x51bda1){var _0x5923ad=_0x5d5ecc[_0x95c5('0x5')]?{[_0x5d5ecc[_0x95c5('0x5')]['field']]:_0x5d5ecc[_0x95c5('0x5')][_0x95c5('0x7')]}:undefined;return _0x2c90c1[_0x5d5ecc['model']]['findAll']({'where':_0x5923ad,'raw':!![]})[_0x95c5('0x9')](function(_0x1e3dd5){_0x4cc261['associatedResources']=_[_0x95c5('0xb')](_0x1e3dd5,function(_0x3a16ed){return _0x3a16ed[_0x95c5('0xc')];});_0x2a2ddc(_0x4cc261);})[_0x95c5('0xd')](function(_0x357003){_0x51bda1(_0x357003);});});}function _0x214fd3(_0x174512,_0x244b34,_0x308e40){if(!_0x244b34)return Promise[_0x95c5('0xe')](null);return new Promise(function(_0x2c3b25,_0x1f621e){return _0x2c90c1[_0x95c5('0xf')][_0x95c5('0x8')]({'where':{'sectionId':_0x244b34['id']},'raw':!![]})[_0x95c5('0x9')](function(_0x341bfb){if(_0x174512['field']&&_0x174512[_0x95c5('0x6')]!=='id'){_0x244b34[_0x95c5('0xa')]=_[_0x95c5('0xb')](_0x341bfb,function(_0x25885b){return _0x25885b[_0x174512['field']];});}else{if(_0x308e40==='AnalyticExtractedReport'){_0x244b34['associatedResources']=_[_0x95c5('0xb')](_0x341bfb,function(_0x4f4fe6){return{'id':_0x4f4fe6[_0x95c5('0x10')],'type':_0x4f4fe6[_0x95c5('0x11')]};});}else{_0x244b34[_0x95c5('0xa')]=_[_0x95c5('0xb')](_0x341bfb,function(_0x2a7883){return _0x2a7883[_0x95c5('0x10')];});}}_0x2c3b25(_0x244b34);})[_0x95c5('0xd')](function(_0x50e495){_0x1f621e(_0x50e495);});});}function _0x330ef0(_0x243475,_0x2d11bb){var _0x447e6a={'parentSections':[]};switch(_0x243475[_0x95c5('0x12')]()){case _0x95c5('0x13'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x15');break;case _0x95c5('0x16'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x17');break;case _0x95c5('0x18'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x19');_0x447e6a[_0x95c5('0x1a')]=[{'name':_0x95c5('0x1b'),'field':'name','foreignKey':'projectName'}];break;case'projects':_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x1c');break;case'contacts':_0x447e6a['childModel']='CmContact';_0x447e6a['parentSections']=[{'name':_0x95c5('0x1d'),'field':'id','foreignKey':_0x95c5('0x1e')}];break;case'lists':_0x447e6a['childModel']=_0x95c5('0x1f');break;case _0x95c5('0x20'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x21');break;case _0x95c5('0x22'):_0x447e6a[_0x95c5('0x14')]='CmCustomField';break;case _0x95c5('0x23'):_0x447e6a['childModel']=_0x95c5('0x24');break;case _0x95c5('0x25'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x26');break;case'faxqueues':_0x447e6a['childModel']='FaxQueue';break;case'faxaccounts':_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x27');break;case _0x95c5('0x28'):case _0x95c5('0x29'):case _0x95c5('0x2a'):_0x447e6a['childModel']='VoiceExtension';break;case _0x95c5('0x2b'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x2c');break;case _0x95c5('0x2d'):_0x447e6a['childModel']='VoiceMail';break;case _0x95c5('0x2e'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x2f');_0x447e6a[_0x95c5('0x1a')]=[{'name':_0x95c5('0x30'),'field':'name','foreignKey':_0x95c5('0x31'),'model':_0x95c5('0x32'),'filter':{'field':_0x95c5('0x33'),'value':[_0x95c5('0x34')]}},{'name':_0x95c5('0x35'),'field':_0x95c5('0xc'),'foreignKey':_0x95c5('0x31'),'model':_0x95c5('0x32'),'filter':{'field':_0x95c5('0x33'),'value':[_0x95c5('0x36')]}},{'name':_0x95c5('0x37'),'field':_0x95c5('0xc'),'foreignKey':_0x95c5('0x38'),'model':_0x95c5('0x39'),'filter':{'field':'type','value':[_0x95c5('0x3a')]}},{'name':'QueueCampaigns','field':_0x95c5('0xc'),'foreignKey':_0x95c5('0x38'),'model':_0x95c5('0x39'),'filter':{'field':_0x95c5('0x11'),'value':[_0x95c5('0x3b')]}}];break;case'musiconholds':_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x3c');break;case _0x95c5('0x3d'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x3e');break;case _0x95c5('0x3f'):_0x447e6a[_0x95c5('0x14')]='VoicePrefix';break;case _0x95c5('0x40'):_0x447e6a[_0x95c5('0x14')]='Campaign';break;case _0x95c5('0x41'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x42');break;case'mailaccounts':_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x43');break;case'mailsubstatuses':_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x44');break;case _0x95c5('0x45'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x46');break;case _0x95c5('0x47'):_0x447e6a[_0x95c5('0x14')]='OpenchannelAccount';break;case _0x95c5('0x48'):_0x447e6a['childModel']=_0x95c5('0x49');break;case'smsaccounts':_0x447e6a['childModel']=_0x95c5('0x4a');break;case _0x95c5('0x4b'):_0x447e6a[_0x95c5('0x14')]='WhatsappQueue';break;case _0x95c5('0x4c'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x4d');break;case _0x95c5('0x4e'):_0x447e6a[_0x95c5('0x14')]='Team';break;case'voicequeues':case'queuecampaigns':_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x39');if(_0x2d11bb){_0x447e6a[_0x95c5('0x1a')]=[{'name':_0x95c5('0x37')},{'name':_0x95c5('0x4f')}];}break;case _0x95c5('0x50'):case _0x95c5('0x51'):case _0x95c5('0x52'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x32');if(_0x2d11bb){_0x447e6a[_0x95c5('0x1a')]=[{'name':_0x95c5('0x53'),'filter':{'field':'role','value':['admin',_0x95c5('0x54')]},'ignore':!![]},{'name':_0x95c5('0x30')},{'name':_0x95c5('0x35')}];}break;case _0x95c5('0x55'):_0x447e6a['childModel']=_0x95c5('0x56');break;case _0x95c5('0x57'):_0x447e6a['childModel']='SalesforceAccount';break;case _0x95c5('0x58'):_0x447e6a[_0x95c5('0x14')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x59');break;case _0x95c5('0x5a'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x5b');break;case _0x95c5('0x5c'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x5d');break;case _0x95c5('0x5e'):_0x447e6a[_0x95c5('0x14')]='User';break;case _0x95c5('0x5f'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x60');break;case _0x95c5('0x61'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x62');break;case _0x95c5('0x63'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x64');break;case'intervals':_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x65');break;case _0x95c5('0x66'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x67');break;case'scheduler':_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x68');break;case'sounds':_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x69');break;case _0x95c5('0x6a'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x6b');break;case _0x95c5('0x6c'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x6d');break;case'triggers':_0x447e6a['childModel']=_0x95c5('0x6e');break;case _0x95c5('0x6f'):_0x447e6a['childModel']=_0x95c5('0x70');break;case _0x95c5('0x71'):_0x447e6a[_0x95c5('0x14')]='Variable';break;case _0x95c5('0x72'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x73');break;case _0x95c5('0x74'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x75');_0x447e6a[_0x95c5('0x1a')]=[{'name':_0x95c5('0x76'),'field':'id','foreignKey':_0x95c5('0x77')}];break;case _0x95c5('0x78'):_0x447e6a['childModel']=_0x95c5('0x79');break;}return _0x447e6a;}function _0x1de728(_0x2fd91d,_0x169ecd){var _0x7d1c41=_0x2fd91d['charAt'](0x0)['toUpperCase']()+_0x2fd91d['slice'](0x1);var _0x259a5a={'type':_0x2c90c1['Sequelize'][_0x95c5('0x7a')]['SELECT'],'raw':!![]};return new Promise(function(_0x4fb009,_0x61d23d){var _0x3aafc6=squel[_0x95c5('0x7b')]()[_0x95c5('0x6')](_0x95c5('0x7c')+_0x7d1c41+_0x95c5('0x7d'),'id')['field'](_0x95c5('0x7e'))[_0x95c5('0x7f')](_0x95c5('0x80')+_0x2fd91d+_0x95c5('0x81'),'ui')[_0x95c5('0x82')](_0x95c5('0x83'),_0x169ecd['id']);return _0x2c90c1[_0x95c5('0x84')][_0x95c5('0x85')](_0x3aafc6[_0x95c5('0x86')](),_0x259a5a)[_0x95c5('0x9')](function(_0x33deee){_0x169ecd[_0x7d1c41+_0x95c5('0x87')]=_0x33deee;_0x4fb009(_0x33deee);})[_0x95c5('0xd')](function(_0x5dc69e){_0x61d23d(_0x5dc69e);});});}return _0x3c73d4[_0x95c5('0x88')](_0x95c5('0x89'),attributes,{'tableName':_0x95c5('0x8a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2d783c){var _0x17aee7={'raw':_0x2d783c[_0x95c5('0x85')][_0x95c5('0x8b')],'where':{}};var _0x1e4eba={};var _0x180bba={'count':0x0,'rows':[]};var _0x3417fc=_0x2d783c['query'][_0x95c5('0x8c')];var _0x13d008=_0x2d783c['query'][_0x95c5('0x8d')]||![];var _0xa1e9c0=_0x330ef0(_0x3417fc,_0x13d008);if(!_0xa1e9c0['childModel'])throw new Error(_0x95c5('0x8e')+_0x3417fc+'\x27');var _0xbcb3de=[{'name':_0x3417fc}];if(!_[_0x95c5('0x8f')](_0xa1e9c0['parentSections']))_0xbcb3de=_0xa1e9c0['parentSections'];var _0x4be641=[];for(var _0x5d052=0x0;_0x5d052<_0xbcb3de[_0x95c5('0x90')];_0x5d052++){_0x4be641[_0x95c5('0x91')](_0x2c90c1[_0x95c5('0x92')][_0x95c5('0x93')]({'where':{'userProfileId':_0x2d783c[_0x95c5('0x94')]['id'],'name':_0xbcb3de[_0x5d052]['name']},'raw':!![]}));}return Promise['all'](_0x4be641)['then'](function(_0x46519f){var _0x5366db=_[_0x95c5('0x5')](_0x46519f,function(_0x4ed0d0){return _0x4ed0d0?_0x4ed0d0:undefined;});var _0x3c14a4=_[_0x95c5('0x5')](_0xbcb3de,[_0x95c5('0x95'),!![]]);var _0x53ec69=_[_0x95c5('0x8f')](_0x5366db)&&_['isEmpty'](_0x3c14a4)?null:_[_0x95c5('0x96')](_0x3c14a4,_0x5366db);if(!_0x53ec69)return null;var _0x3e81d5=[];for(var _0x5da8a0=0x0;_0x5da8a0<_0x53ec69[_0x95c5('0x90')];_0x5da8a0++){var _0x4043a7=_[_0x95c5('0x93')](_0xbcb3de,function(_0x472bb3){return _0x53ec69[_0x5da8a0]?_0x472bb3['name']===_0x53ec69[_0x5da8a0]['name']:null;});if(_0x4043a7){if(_0x53ec69[_0x5da8a0][_0x95c5('0x95')]){_0x3e81d5[_0x95c5('0x91')](_0x7f2a40(_0xa1e9c0[_0x95c5('0x14')],_0x53ec69[_0x5da8a0]));}else{if(!_0x53ec69[_0x5da8a0][_0x95c5('0x97')]){_0x3e81d5[_0x95c5('0x91')](_0x214fd3(_0x4043a7,_0x53ec69[_0x5da8a0],_0xa1e9c0['childModel']));}else{if(_0x4043a7[_0x95c5('0x98')]){_0x3e81d5['push'](_0x2eb240(_0x4043a7,_0x53ec69[_0x5da8a0]));}}}}}return Promise[_0x95c5('0x99')](_0x3e81d5);})[_0x95c5('0x9')](function(_0x26d8fe){var _0x56824a=_0x26d8fe;var _0x48ecee=null;if(_0x56824a){_0x48ecee=_0x56824a[_0x95c5('0x90')]===0x1?_0x56824a[0x0]:null;}if(!_0x48ecee&&!_0x56824a)return _0x180bba;var _0x20b6dc=_0x2c90c1[_0xa1e9c0['childModel']]['rawAttributes'];_0x1e4eba[_0x95c5('0x98')]=_[_0x95c5('0x9a')](_0x20b6dc);_0x1e4eba[_0x95c5('0x85')]=_[_0x95c5('0x9a')](_0x2d783c[_0x95c5('0x85')]);_0x1e4eba[_0x95c5('0x9b')]=_[_0x95c5('0x9c')](_0x1e4eba[_0x95c5('0x98')],_0x1e4eba[_0x95c5('0x85')]);_0x17aee7[_0x95c5('0x9d')]=_[_0x95c5('0x9c')](_0x1e4eba[_0x95c5('0x98')],qs[_0x95c5('0x9e')](_0x2d783c[_0x95c5('0x85')]['fields']));_0x17aee7[_0x95c5('0x9d')]=_0x17aee7['attributes'][_0x95c5('0x90')]?_0x17aee7['attributes']:_0x1e4eba[_0x95c5('0x98')];if(!_0x2d783c[_0x95c5('0x85')]['hasOwnProperty']('nolimit')){_0x17aee7[_0x95c5('0x9f')]=qs['limit'](_0x2d783c[_0x95c5('0x85')][_0x95c5('0x9f')]);_0x17aee7['offset']=qs[_0x95c5('0xa0')](_0x2d783c[_0x95c5('0x85')][_0x95c5('0xa0')]);}_0x17aee7[_0x95c5('0xa1')]=qs[_0x95c5('0xa2')](_0x2d783c['query'][_0x95c5('0xa2')]);_0x17aee7[_0x95c5('0x82')]=qs['filters'](_[_0x95c5('0xa3')](_0x2d783c[_0x95c5('0x85')],_0x1e4eba['filters']));if(_0x2d783c[_0x95c5('0x85')][_0x95c5('0x5')]){_0x17aee7[_0x95c5('0x82')]=_[_0x95c5('0xa4')](_0x17aee7[_0x95c5('0x82')],{'$or':_[_0x95c5('0xb')](_0x20b6dc,function(_0x258949){if(_0x258949[_0x95c5('0x11')]['key']!==_0x95c5('0xa5')){var _0xb25e9f={};_0xb25e9f[_0x258949[_0x95c5('0x6')]]={'$like':'%'+_0x2d783c[_0x95c5('0x85')][_0x95c5('0x5')]+'%'};return _0xb25e9f;}})});}var _0x191673=[];var _0x99b051=null;var _0x5aeac2={};if(_0x48ecee){_0x99b051=_[_0x95c5('0x93')](_0xbcb3de,['name',_0x48ecee[_0x95c5('0xc')]]);if(_0x99b051['field']){_0x5aeac2={};if(_0xa1e9c0[_0x95c5('0x14')]==='AnalyticExtractedReport'){_0x5aeac2[_0x99b051[_0x95c5('0xa6')]]=_[_0x95c5('0xb')](_0x48ecee[_0x95c5('0xa')],'id');}else{_0x5aeac2[_0x99b051[_0x95c5('0xa6')]]=_0x48ecee[_0x95c5('0xa')];}_0x191673[_0x95c5('0x91')](_0x5aeac2);}else{_0x17aee7['where']['id']=_0x48ecee['associatedResources'];}}else{for(var _0x56a98d=0x0;_0x56a98d<_0x56824a[_0x95c5('0x90')];_0x56a98d++){_0x99b051=_[_0x95c5('0x93')](_0xbcb3de,[_0x95c5('0xc'),_0x56824a[_0x56a98d][_0x95c5('0xc')]]);if(_0x99b051[_0x95c5('0x6')]){_0x5aeac2={};_0x5aeac2[_0x99b051['foreignKey']]=_0x56824a[_0x56a98d]['associatedResources'];_0x191673[_0x95c5('0x91')](_0x5aeac2);}else{if(!_0x17aee7[_0x95c5('0x82')]['id'])_0x17aee7[_0x95c5('0x82')]['id']=[];_0x56824a[_0x56a98d]['associatedResources']['forEach'](function(_0x427d59){_0x17aee7['where']['id'][_0x95c5('0x91')](_0x427d59);});}}}if(!_[_0x95c5('0x8f')](_0x191673)){_0x17aee7[_0x95c5('0x82')]=_[_0x95c5('0xa4')](_0x17aee7['where'],{'$and':{'$or':_0x191673}});}_0x17aee7=_['merge']({},_0x17aee7,_0x2d783c[_0x95c5('0xa7')]);if(_0x48ecee&&!_0x48ecee[_0x95c5('0x97')]&&_0xa1e9c0[_0x95c5('0x14')]===_0x95c5('0x75')){if(_0x2d783c[_0x95c5('0x85')][_0x95c5('0xa8')]){_0x17aee7[_0x95c5('0xa9')]=[{'all':!![]}];}return _0x2c90c1[_0xa1e9c0[_0x95c5('0x14')]][_0x95c5('0x8')](_0x17aee7)[_0x95c5('0x9')](function(_0x4b4a57){var _0x248150=[];_0x4b4a57['forEach'](function(_0x3bceaa){var _0x37ddda;switch(_0x3bceaa[_0x95c5('0xaa')]){case _0x95c5('0xab'):_0x37ddda=_[_0x95c5('0x93')](_0x48ecee[_0x95c5('0xa')],function(_0x562c28){return _0x562c28['id']===_0x3bceaa[_0x95c5('0x77')]&&_0x562c28[_0x95c5('0x11')]===_0x95c5('0xac');});break;case _0x95c5('0xad'):_0x37ddda=_[_0x95c5('0x93')](_0x48ecee['associatedResources'],function(_0x13b918){return _0x13b918['id']===_0x3bceaa['reportId']&&_0x13b918[_0x95c5('0x11')]===_0x95c5('0xae');});break;}if(_0x37ddda)_0x248150[_0x95c5('0x91')](_0x3bceaa);});_0x180bba[_0x95c5('0xaf')]=_0x248150[_0x95c5('0x90')];_0x180bba[_0x95c5('0xb0')]=_0x248150;return _0x180bba;});}else{if(!_[_0x95c5('0x8f')](_0x2d783c[_0x95c5('0x85')]['ids'])){_0x17aee7[_0x95c5('0x82')]['id']=_0x17aee7[_0x95c5('0x82')]['id']?_[_0x95c5('0x9c')](_0x17aee7[_0x95c5('0x82')]['id'],_0x2d783c['query'][_0x95c5('0xb1')]):_0x2d783c['query'][_0x95c5('0xb1')];if(_0x2d783c[_0x95c5('0x85')]['customSorting']){_0x17aee7[_0x95c5('0xa1')]=_0x2d783c[_0x95c5('0x85')][_0x95c5('0xb2')];}}if(_0x2d783c[_0x95c5('0x85')][_0x95c5('0xb3')]){_0x17aee7['where']=_[_0x95c5('0xa4')](_0x17aee7['where'],{'$and':_0x2d783c['query'][_0x95c5('0xb3')]});}return _0x2c90c1[_0xa1e9c0[_0x95c5('0x14')]][_0x95c5('0xaf')]({'where':_0x17aee7[_0x95c5('0x82')]})['then'](function(_0x572900){_0x180bba[_0x95c5('0xaf')]=_0x572900;if(_0x2d783c[_0x95c5('0x85')]['includeAll']){if(_0xa1e9c0[_0x95c5('0x14')]==='CmContact'){_0x17aee7[_0x95c5('0xa9')]=[{'model':_0x2c90c1[_0x95c5('0x6b')],'as':_0x95c5('0xb4'),'attributes':['id',_0x95c5('0xc'),_0x95c5('0xb5')],'required':_0x2d783c['query']['tag']?!![]:![]},{'model':_0x2c90c1[_0x95c5('0x6b')],'as':'ThroughTags','attributes':['id','name',_0x95c5('0xb5')],'through':_0x2d783c[_0x95c5('0x85')][_0x95c5('0xb6')]?{'attributes':[],'where':{'TagId':_0x2d783c[_0x95c5('0x85')][_0x95c5('0xb6')]||undefined}}:{},'required':_0x2d783c['query']['tag']?!![]:![]}];}else{_0x17aee7[_0x95c5('0xa9')]=[{'all':!![]}];}}return _0x2c90c1[_0xa1e9c0['childModel']][_0x95c5('0x8')](_0x17aee7);})['then'](function(_0x199efa){_0x180bba[_0x95c5('0xb0')]=_0x199efa;if(_0x3417fc===_0x95c5('0x30')&&_0x2d783c[_0x95c5('0x85')]['openTabs']===_0x95c5('0xb7')){var _0x374aee=[];for(var _0x9ec37b=0x0;_0x9ec37b<_0x180bba['rows'][_0x95c5('0x90')];_0x9ec37b++){_0x374aee[_0x95c5('0x91')](_0x1de728('chat',_0x180bba['rows'][_0x9ec37b]['dataValues']));_0x374aee[_0x95c5('0x91')](_0x1de728(_0x95c5('0xb8'),_0x180bba[_0x95c5('0xb0')][_0x9ec37b][_0x95c5('0xb9')]));_0x374aee[_0x95c5('0x91')](_0x1de728(_0x95c5('0xba'),_0x180bba['rows'][_0x9ec37b][_0x95c5('0xb9')]));_0x374aee[_0x95c5('0x91')](_0x1de728(_0x95c5('0xbb'),_0x180bba['rows'][_0x9ec37b][_0x95c5('0xb9')]));_0x374aee['push'](_0x1de728('openchannel',_0x180bba[_0x95c5('0xb0')][_0x9ec37b][_0x95c5('0xb9')]));_0x374aee[_0x95c5('0x91')](_0x1de728(_0x95c5('0xbc'),_0x180bba[_0x95c5('0xb0')][_0x9ec37b]['dataValues']));}return Promise['all'](_0x374aee)['then'](function(){return _0x180bba;});}return _0x180bba;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index dabe149..039ba93 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 _0xa7db=['UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./userProfile.socket','register','then','info'];(function(_0x37ded3,_0x371ebb){var _0x51e49e=function(_0x30cc78){while(--_0x30cc78){_0x37ded3['push'](_0x37ded3['shift']());}};_0x51e49e(++_0x371ebb);}(_0xa7db,0xbf));var _0xba7d=function(_0x45652a,_0x4c5850){_0x45652a=_0x45652a-0x0;var _0x134929=_0xa7db[_0x45652a];return _0x134929;};'use strict';var _=require(_0xba7d('0x0'));var util=require(_0xba7d('0x1'));var moment=require(_0xba7d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba7d('0x3'))['db'];var utils=require(_0xba7d('0x4'));var logger=require(_0xba7d('0x5'))(_0xba7d('0x6'));var config=require(_0xba7d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xba7d('0x8')][_0xba7d('0x9')]({'port':0x232a});config[_0xba7d('0xa')]=_[_0xba7d('0xb')](config[_0xba7d('0xa')],{'host':_0xba7d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba7d('0xa')]));require(_0xba7d('0xd'))[_0xba7d('0xe')](socket);function respondWithRpcPromise(_0x242f4d,_0x7c24b5,_0x557008){return new BPromise(function(_0x142700,_0x3dcea9){return client['request'](_0x242f4d,_0x557008)[_0xba7d('0xf')](function(_0x39c6e0){logger[_0xba7d('0x10')](_0xba7d('0x11'),_0x7c24b5,'request\x20sent');logger[_0xba7d('0x12')](_0xba7d('0x13'),_0x7c24b5,_0xba7d('0x14'),JSON[_0xba7d('0x15')](_0x39c6e0));if(_0x39c6e0['error']){if(_0x39c6e0[_0xba7d('0x16')]['code']===0x1f4){logger[_0xba7d('0x16')](_0xba7d('0x11'),_0x7c24b5,_0x39c6e0[_0xba7d('0x16')][_0xba7d('0x17')]);return _0x3dcea9(_0x39c6e0['error'][_0xba7d('0x17')]);}logger['error']('UserProfile,\x20%s,\x20%s',_0x7c24b5,_0x39c6e0[_0xba7d('0x16')]['message']);return _0x142700(_0x39c6e0[_0xba7d('0x16')][_0xba7d('0x17')]);}else{logger[_0xba7d('0x10')](_0xba7d('0x11'),_0x7c24b5,_0xba7d('0x14'));_0x142700(_0x39c6e0[_0xba7d('0x18')][_0xba7d('0x17')]);}})[_0xba7d('0x19')](function(_0x354430){logger[_0xba7d('0x16')](_0xba7d('0x11'),_0x7c24b5,_0x354430);_0x3dcea9(_0x354430);});});} \ No newline at end of file +var _0xfcf0=['UserProfile,\x20%s,\x20%s','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','stringify','error','code'];(function(_0x34f499,_0xd8ff6e){var _0x2be65b=function(_0x238916){while(--_0x238916){_0x34f499['push'](_0x34f499['shift']());}};_0x2be65b(++_0xd8ff6e);}(_0xfcf0,0x138));var _0x0fcf=function(_0x2af29a,_0x4f44bc){_0x2af29a=_0x2af29a-0x0;var _0x5ef02f=_0xfcf0[_0x2af29a];return _0x5ef02f;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var moment=require('moment');var BPromise=require(_0x0fcf('0x2'));var rs=require(_0x0fcf('0x3'));var fs=require('fs');var Redis=require(_0x0fcf('0x4'));var db=require(_0x0fcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var config=require(_0x0fcf('0x8'));var jayson=require(_0x0fcf('0x9'));var client=jayson[_0x0fcf('0xa')][_0x0fcf('0xb')]({'port':0x232a});config[_0x0fcf('0xc')]=_[_0x0fcf('0xd')](config['redis'],{'host':_0x0fcf('0xe'),'port':0x18eb});var socket=require(_0x0fcf('0xf'))(new Redis(config[_0x0fcf('0xc')]));require('./userProfile.socket')[_0x0fcf('0x10')](socket);function respondWithRpcPromise(_0x7ac7bd,_0x239e5d,_0x4b3923){return new BPromise(function(_0x369959,_0x5c29ed){return client[_0x0fcf('0x11')](_0x7ac7bd,_0x4b3923)[_0x0fcf('0x12')](function(_0x201a58){logger['info']('UserProfile,\x20%s,\x20%s',_0x239e5d,_0x0fcf('0x13'));logger[_0x0fcf('0x14')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x239e5d,_0x0fcf('0x13'),JSON[_0x0fcf('0x15')](_0x201a58));if(_0x201a58[_0x0fcf('0x16')]){if(_0x201a58[_0x0fcf('0x16')][_0x0fcf('0x17')]===0x1f4){logger['error'](_0x0fcf('0x18'),_0x239e5d,_0x201a58[_0x0fcf('0x16')][_0x0fcf('0x19')]);return _0x5c29ed(_0x201a58['error'][_0x0fcf('0x19')]);}logger[_0x0fcf('0x16')](_0x0fcf('0x18'),_0x239e5d,_0x201a58[_0x0fcf('0x16')]['message']);return _0x369959(_0x201a58[_0x0fcf('0x16')][_0x0fcf('0x19')]);}else{logger[_0x0fcf('0x1a')](_0x0fcf('0x18'),_0x239e5d,_0x0fcf('0x13'));_0x369959(_0x201a58['result'][_0x0fcf('0x19')]);}})[_0x0fcf('0x1b')](function(_0x5dad87){logger[_0x0fcf('0x16')](_0x0fcf('0x18'),_0x239e5d,_0x5dad87);_0x5c29ed(_0x5dad87);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 5cb0811..256f742 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 _0x48f6=['remove','update','emit','removeListener','length','./userProfile.events','save'];(function(_0x1c510a,_0x1413a9){var _0x23cedd=function(_0x3f3e43){while(--_0x3f3e43){_0x1c510a['push'](_0x1c510a['shift']());}};_0x23cedd(++_0x1413a9);}(_0x48f6,0x83));var _0x648f=function(_0x22e1e7,_0xb99fc1){_0x22e1e7=_0x22e1e7-0x0;var _0x2cae6a=_0x48f6[_0x22e1e7];return _0x2cae6a;};'use strict';var UserProfileEvents=require(_0x648f('0x0'));var events=[_0x648f('0x1'),_0x648f('0x2'),_0x648f('0x3')];function createListener(_0x493900,_0x5d0352){return function(_0x50bcbb){_0x5d0352[_0x648f('0x4')](_0x493900,_0x50bcbb);};}function removeListener(_0x422d32,_0x255f87){return function(){UserProfileEvents[_0x648f('0x5')](_0x422d32,_0x255f87);};}exports['register']=function(_0x2cb3c){for(var _0xa618d1=0x0,_0xa0e852=events[_0x648f('0x6')];_0xa618d1<_0xa0e852;_0xa618d1++){var _0x4a0b7e=events[_0xa618d1];var _0x4add57=createListener('userProfile:'+_0x4a0b7e,_0x2cb3c);UserProfileEvents['on'](_0x4a0b7e,_0x4add57);}}; \ No newline at end of file +var _0xc862=['./userProfile.events','save','update','register','length','userProfile:'];(function(_0x4cc492,_0x162c85){var _0x1f36b9=function(_0xce4b2){while(--_0xce4b2){_0x4cc492['push'](_0x4cc492['shift']());}};_0x1f36b9(++_0x162c85);}(_0xc862,0x16e));var _0x2c86=function(_0x4a1664,_0x1b408b){_0x4a1664=_0x4a1664-0x0;var _0x502b3f=_0xc862[_0x4a1664];return _0x502b3f;};'use strict';var UserProfileEvents=require(_0x2c86('0x0'));var events=[_0x2c86('0x1'),'remove',_0x2c86('0x2')];function createListener(_0x2241ef,_0x2cece4){return function(_0x3fc4df){_0x2cece4['emit'](_0x2241ef,_0x3fc4df);};}function removeListener(_0x3d1ffb,_0x3639c1){return function(){UserProfileEvents['removeListener'](_0x3d1ffb,_0x3639c1);};}exports[_0x2c86('0x3')]=function(_0x5a1773){for(var _0x44434e=0x0,_0x75dafc=events[_0x2c86('0x4')];_0x44434e<_0x75dafc;_0x44434e++){var _0x588748=events[_0x44434e];var _0x33ae91=createListener(_0x2c86('0x5')+_0x588748,_0x5a1773);UserProfileEvents['on'](_0x588748,_0x33ae91);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 37b17b9..b40c24a 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 _0x7b96=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','describe','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x351acf,_0x5683a2){var _0x350de3=function(_0x16ce85){while(--_0x16ce85){_0x351acf['push'](_0x351acf['shift']());}};_0x350de3(++_0x5683a2);}(_0x7b96,0x9c));var _0x67b9=function(_0x356774,_0x5b2a28){_0x356774=_0x356774-0x0;var _0x3aa3b0=_0x7b96[_0x356774];return _0x3aa3b0;};'use strict';var multer=require(_0x67b9('0x0'));var util=require(_0x67b9('0x1'));var path=require(_0x67b9('0x2'));var timeout=require('connect-timeout');var express=require(_0x67b9('0x3'));var router=express[_0x67b9('0x4')]();var fs_extra=require(_0x67b9('0x5'));var auth=require(_0x67b9('0x6'));var interaction=require(_0x67b9('0x7'));var config=require(_0x67b9('0x8'));var controller=require(_0x67b9('0x9'));router['get']('/',auth[_0x67b9('0xa')](),controller[_0x67b9('0xb')]);router['get']('/describe',auth[_0x67b9('0xa')](),controller[_0x67b9('0xc')]);router[_0x67b9('0xd')](_0x67b9('0xe'),auth[_0x67b9('0xa')](),controller[_0x67b9('0xf')]);router[_0x67b9('0x10')]('/',auth[_0x67b9('0xa')](),controller[_0x67b9('0x11')]);router[_0x67b9('0x12')](_0x67b9('0xe'),auth[_0x67b9('0xa')](),controller[_0x67b9('0x13')]);router[_0x67b9('0x14')]('/:id',auth[_0x67b9('0xa')](),controller[_0x67b9('0x15')]);module[_0x67b9('0x16')]=router; \ No newline at end of file +var _0x6bd0=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x4907de,_0x5bbdc6){var _0x482054=function(_0x39ecf6){while(--_0x39ecf6){_0x4907de['push'](_0x4907de['shift']());}};_0x482054(++_0x5bbdc6);}(_0x6bd0,0xf1));var _0x06bd=function(_0x4a1062,_0x5ab6ab){_0x4a1062=_0x4a1062-0x0;var _0x2a832c=_0x6bd0[_0x4a1062];return _0x2a832c;};'use strict';var multer=require(_0x06bd('0x0'));var util=require('util');var path=require(_0x06bd('0x1'));var timeout=require(_0x06bd('0x2'));var express=require(_0x06bd('0x3'));var router=express[_0x06bd('0x4')]();var fs_extra=require(_0x06bd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x06bd('0x6'));var config=require(_0x06bd('0x7'));var controller=require(_0x06bd('0x8'));router[_0x06bd('0x9')]('/',auth[_0x06bd('0xa')](),controller[_0x06bd('0xb')]);router['get'](_0x06bd('0xc'),auth[_0x06bd('0xa')](),controller[_0x06bd('0xd')]);router[_0x06bd('0x9')](_0x06bd('0xe'),auth['isAuthenticated'](),controller[_0x06bd('0xf')]);router[_0x06bd('0x10')]('/',auth[_0x06bd('0xa')](),controller[_0x06bd('0x11')]);router[_0x06bd('0x12')](_0x06bd('0xe'),auth['isAuthenticated'](),controller[_0x06bd('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x06bd('0x14')]);module[_0x06bd('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 32c4ed1..a2070a6 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 _0xf040=['exports','INTEGER','STRING','sequelize'];(function(_0x301bbd,_0x26426a){var _0x58bcc4=function(_0x2f073b){while(--_0x2f073b){_0x301bbd['push'](_0x301bbd['shift']());}};_0x58bcc4(++_0x26426a);}(_0xf040,0x193));var _0x0f04=function(_0x305cc5,_0x317607){_0x305cc5=_0x305cc5-0x0;var _0x3ef26f=_0xf040[_0x305cc5];return _0x3ef26f;};'use strict';var Sequelize=require(_0x0f04('0x0'));module[_0x0f04('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x0f04('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0f04('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x9cfc=['INTEGER','exports','STRING'];(function(_0x14c00f,_0x11b192){var _0x19fbda=function(_0xf9caa4){while(--_0xf9caa4){_0x14c00f['push'](_0x14c00f['shift']());}};_0x19fbda(++_0x11b192);}(_0x9cfc,0x1ea));var _0xc9cf=function(_0x21c320,_0x159ffa){_0x21c320=_0x21c320-0x0;var _0x58c125=_0x9cfc[_0x21c320];return _0x58c125;};'use strict';var Sequelize=require('sequelize');module[_0xc9cf('0x0')]={'name':{'type':Sequelize[_0xc9cf('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xc9cf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc9cf('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 0728b0c..478b7a6 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 _0xafc4=['update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','UserProfileResource','includeAll','catch','show','params','create','body','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x23e5d9,_0xf3db15){var _0x9f9065=function(_0x5c87d0){while(--_0x5c87d0){_0x23e5d9['push'](_0x23e5d9['shift']());}};_0x9f9065(++_0xf3db15);}(_0xafc4,0x69));var _0x4afc=function(_0x24be72,_0x26e321){_0x24be72=_0x24be72-0x0;var _0xc12b63=_0xafc4[_0x24be72];return _0xc12b63;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['UserProfileResource'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['UserProfileResource']['create'](_0x4772db['body'],{})[_0x4afc('0x25')](respondWithResult(_0x19a0ac,0xc9))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x269c24,_0xb5cca9){if(_0x269c24[_0x4afc('0x43')]['id']){delete _0x269c24[_0x4afc('0x43')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x269c24[_0x4afc('0x41')]['id']}})['then'](handleEntityNotFound(_0xb5cca9,null))[_0x4afc('0x25')](saveUpdates(_0x269c24['body'],null))['then'](respondWithResult(_0xb5cca9,null))[_0x4afc('0x3f')](handleError(_0xb5cca9,null));};exports['destroy']=function(_0x428d78,_0x355198){return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x428d78['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x355198,null))['then'](removeEntity(_0x355198,null))[_0x4afc('0x3f')](handleError(_0x355198,null));};exports[_0x4afc('0x45')]=function(_0x3625c9,_0x387834){return db[_0x4afc('0x3d')][_0x4afc('0x45')]()[_0x4afc('0x25')](respondWithResult(_0x387834,null))[_0x4afc('0x3f')](handleError(_0x387834,null));}; \ No newline at end of file +var _0x781d=['sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','map','UserProfileResource','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','where','filters','filter','merge','VIRTUAL','includeAll','catch','show','params','rawAttributes','options','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x781d,0x14a));var _0xd781=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x781d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){_0x101480[_0xd781('0x1a')](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x10940b,_0x5662db){return function(_0x529ca1){if(!_0x529ca1){_0x10940b[_0xd781('0x19')](0x194);}return _0x529ca1;};}function handleError(_0x849587,_0xdad0b1){_0xdad0b1=_0xdad0b1||0x1f4;return function(_0x57b41e){logger[_0xd781('0x27')](_0x57b41e['stack']);if(_0x57b41e['name']){delete _0x57b41e[_0xd781('0x28')];}_0x849587['status'](_0xdad0b1)[_0xd781('0x29')](_0x57b41e);};}exports[_0xd781('0x2a')]=function(_0x5c3848,_0x5b6b9d){var _0x43cc74={},_0x5b0464={},_0x296a0b={'count':0x0,'rows':[]};var _0x4a3bd3=_[_0xd781('0x2b')](db[_0xd781('0x2c')]['rawAttributes'],function(_0x54521e){return{'name':_0x54521e[_0xd781('0x2d')],'type':_0x54521e[_0xd781('0x2e')][_0xd781('0x2f')]};});_0x5b0464['model']=_['map'](_0x4a3bd3,_0xd781('0x28'));_0x5b0464[_0xd781('0x30')]=_[_0xd781('0x31')](_0x5c3848['query']);_0x5b0464['filters']=_[_0xd781('0x32')](_0x5b0464[_0xd781('0x33')],_0x5b0464['query']);_0x43cc74[_0xd781('0x34')]=_[_0xd781('0x32')](_0x5b0464['model'],qs[_0xd781('0x35')](_0x5c3848[_0xd781('0x30')][_0xd781('0x35')]));_0x43cc74[_0xd781('0x34')]=_0x43cc74['attributes'][_0xd781('0x36')]?_0x43cc74[_0xd781('0x34')]:_0x5b0464[_0xd781('0x33')];if(!_0x5c3848[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x37'))){_0x43cc74[_0xd781('0x1e')]=qs['limit'](_0x5c3848[_0xd781('0x30')]['limit']);_0x43cc74[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x5c3848['query'][_0xd781('0x1c')]);}_0x43cc74[_0xd781('0x38')]=qs['sort'](_0x5c3848[_0xd781('0x30')]['sort']);_0x43cc74[_0xd781('0x39')]=qs[_0xd781('0x3a')](_['pick'](_0x5c3848[_0xd781('0x30')],_0x5b0464[_0xd781('0x3a')]),_0x4a3bd3);if(_0x5c3848['query'][_0xd781('0x3b')]){_0x43cc74[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x43cc74['where'],{'$or':_[_0xd781('0x2b')](_0x4a3bd3,function(_0x22b94e){if(_0x22b94e[_0xd781('0x2e')]!==_0xd781('0x3d')){var _0x2e8218={};_0x2e8218[_0x22b94e[_0xd781('0x28')]]={'$like':'%'+_0x5c3848[_0xd781('0x30')][_0xd781('0x3b')]+'%'};return _0x2e8218;}})});}_0x43cc74=_[_0xd781('0x3c')]({},_0x43cc74,_0x5c3848['options']);var _0x2a60d6={'where':_0x43cc74['where']};return db[_0xd781('0x2c')][_0xd781('0x1f')](_0x2a60d6)['then'](function(_0x1a5833){_0x296a0b[_0xd781('0x1f')]=_0x1a5833;if(_0x5c3848[_0xd781('0x30')][_0xd781('0x3e')]){_0x43cc74['include']=[{'all':!![]}];}return db[_0xd781('0x2c')]['findAll'](_0x43cc74);})[_0xd781('0x26')](function(_0xcdaacf){_0x296a0b['rows']=_0xcdaacf;return _0x296a0b;})['then'](respondWithFilteredResult(_0x5b6b9d,_0x43cc74))[_0xd781('0x3f')](handleError(_0x5b6b9d,null));};exports[_0xd781('0x40')]=function(_0x15b49d,_0x23bbab){var _0x53aba6={'raw':![],'where':{'id':_0x15b49d[_0xd781('0x41')]['id']}},_0x46e7f6={};_0x46e7f6['model']=_['keys'](db[_0xd781('0x2c')][_0xd781('0x42')]);_0x46e7f6[_0xd781('0x30')]=_['keys'](_0x15b49d['query']);_0x46e7f6[_0xd781('0x3a')]=_[_0xd781('0x32')](_0x46e7f6[_0xd781('0x33')],_0x46e7f6[_0xd781('0x30')]);_0x53aba6[_0xd781('0x34')]=_[_0xd781('0x32')](_0x46e7f6['model'],qs['fields'](_0x15b49d[_0xd781('0x30')][_0xd781('0x35')]));_0x53aba6[_0xd781('0x34')]=_0x53aba6[_0xd781('0x34')][_0xd781('0x36')]?_0x53aba6['attributes']:_0x46e7f6[_0xd781('0x33')];if(_0x15b49d[_0xd781('0x30')][_0xd781('0x3e')]){_0x53aba6['include']=[{'all':!![]}];}_0x53aba6=_[_0xd781('0x3c')]({},_0x53aba6,_0x15b49d[_0xd781('0x43')]);return db[_0xd781('0x2c')]['find'](_0x53aba6)[_0xd781('0x26')](handleEntityNotFound(_0x23bbab,null))[_0xd781('0x26')](respondWithResult(_0x23bbab,null))['catch'](handleError(_0x23bbab,null));};exports['create']=function(_0x13a907,_0x16d16e){return db[_0xd781('0x2c')]['create'](_0x13a907[_0xd781('0x44')],{})[_0xd781('0x26')](respondWithResult(_0x16d16e,0xc9))[_0xd781('0x3f')](handleError(_0x16d16e,null));};exports[_0xd781('0x24')]=function(_0x336d30,_0x3828ad){if(_0x336d30[_0xd781('0x44')]['id']){delete _0x336d30['body']['id'];}return db[_0xd781('0x2c')][_0xd781('0x45')]({'where':{'id':_0x336d30[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x3828ad,null))[_0xd781('0x26')](saveUpdates(_0x336d30[_0xd781('0x44')],null))['then'](respondWithResult(_0x3828ad,null))[_0xd781('0x3f')](handleError(_0x3828ad,null));};exports[_0xd781('0x25')]=function(_0x41caac,_0x207546){return db[_0xd781('0x2c')]['find']({'where':{'id':_0x41caac[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x207546,null))[_0xd781('0x26')](removeEntity(_0x207546,null))['catch'](handleError(_0x207546,null));};exports[_0xd781('0x46')]=function(_0x17a46e,_0x4f9e37){return db[_0xd781('0x2c')]['describe']()['then'](respondWithResult(_0x4f9e37,null))['catch'](handleError(_0x4f9e37,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 16ca218..80c0de7 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 _0xf276=['bluebird','request-promise','path','rimraf','./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources','compositeIndex','lodash','util','../../config/logger','api','moment'];(function(_0x2d66d8,_0x2ed651){var _0x5afeaa=function(_0x1c7988){while(--_0x1c7988){_0x2d66d8['push'](_0x2d66d8['shift']());}};_0x5afeaa(++_0x2ed651);}(_0xf276,0x79));var _0x6f27=function(_0x153aae,_0x28cf2c){_0x153aae=_0x153aae-0x0;var _0xb918f7=_0xf276[_0x153aae];return _0xb918f7;};'use strict';var _=require(_0x6f27('0x0'));var util=require(_0x6f27('0x1'));var logger=require(_0x6f27('0x2'))(_0x6f27('0x3'));var moment=require(_0x6f27('0x4'));var BPromise=require(_0x6f27('0x5'));var rp=require(_0x6f27('0x6'));var fs=require('fs');var path=require(_0x6f27('0x7'));var rimraf=require(_0x6f27('0x8'));var config=require('../../config/environment');var attributes=require(_0x6f27('0x9'));module['exports']=function(_0x2cc22f,_0x54d0d4){return _0x2cc22f[_0x6f27('0xa')](_0x6f27('0xb'),attributes,{'tableName':_0x6f27('0xc'),'paranoid':![],'indexes':[{'name':_0x6f27('0xd'),'fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8390=['api','moment','request-promise','path','rimraf','define','user_profile_has_resources','compositeIndex','sectionId','lodash','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8390,0x17f));var _0x0839=function(_0x4d0df6,_0x4634f3){_0x4d0df6=_0x4d0df6-0x0;var _0x4e2615=_0x8390[_0x4d0df6];return _0x4e2615;};'use strict';var _=require(_0x0839('0x0'));var util=require(_0x0839('0x1'));var logger=require('../../config/logger')(_0x0839('0x2'));var moment=require(_0x0839('0x3'));var BPromise=require('bluebird');var rp=require(_0x0839('0x4'));var fs=require('fs');var path=require(_0x0839('0x5'));var rimraf=require(_0x0839('0x6'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x41b9f3,_0x424836){return _0x41b9f3[_0x0839('0x7')]('UserProfileResource',attributes,{'tableName':_0x0839('0x8'),'paranoid':![],'indexes':[{'name':_0x0839('0x9'),'fields':['resourceId',_0x0839('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 3082a1c..9529a0c 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 _0x2f27=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','result','moment','bluebird'];(function(_0x26d7b3,_0x10bd58){var _0x5d8f91=function(_0x53e2ce){while(--_0x53e2ce){_0x26d7b3['push'](_0x26d7b3['shift']());}};_0x5d8f91(++_0x10bd58);}(_0x2f27,0x70));var _0x72f2=function(_0x25d341,_0x5cc429){_0x25d341=_0x25d341-0x0;var _0x380288=_0x2f27[_0x25d341];return _0x380288;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x72f2('0x0'));var BPromise=require(_0x72f2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x72f2('0x2'));var db=require(_0x72f2('0x3'))['db'];var utils=require(_0x72f2('0x4'));var logger=require(_0x72f2('0x5'))('rpc');var config=require(_0x72f2('0x6'));var jayson=require(_0x72f2('0x7'));var client=jayson['client'][_0x72f2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xfd4bcc,_0x4efa6a,_0x41905e){return new BPromise(function(_0x34f898,_0x5b57cc){return client[_0x72f2('0x9')](_0xfd4bcc,_0x41905e)['then'](function(_0x5eec4e){logger[_0x72f2('0xa')](_0x72f2('0xb'),_0x4efa6a,_0x72f2('0xc'));logger[_0x72f2('0xd')](_0x72f2('0xe'),_0x4efa6a,_0x72f2('0xc'),JSON[_0x72f2('0xf')](_0x5eec4e));if(_0x5eec4e['error']){if(_0x5eec4e['error']['code']===0x1f4){logger[_0x72f2('0x10')](_0x72f2('0xb'),_0x4efa6a,_0x5eec4e[_0x72f2('0x10')][_0x72f2('0x11')]);return _0x5b57cc(_0x5eec4e['error'][_0x72f2('0x11')]);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x4efa6a,_0x5eec4e[_0x72f2('0x10')][_0x72f2('0x11')]);return _0x34f898(_0x5eec4e[_0x72f2('0x10')]['message']);}else{logger[_0x72f2('0xa')]('UserProfileResource,\x20%s,\x20%s',_0x4efa6a,'request\x20sent');_0x34f898(_0x5eec4e[_0x72f2('0x12')][_0x72f2('0x11')]);}})['catch'](function(_0x2cc77d){logger[_0x72f2('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x4efa6a,_0x2cc77d);_0x5b57cc(_0x2cc77d);});});} \ No newline at end of file +var _0xbca9=['code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3cfe08,_0x40b70d){var _0x18b5a3=function(_0x333d4b){while(--_0x333d4b){_0x3cfe08['push'](_0x3cfe08['shift']());}};_0x18b5a3(++_0x40b70d);}(_0xbca9,0x16c));var _0x9bca=function(_0x4f47d5,_0x14bac5){_0x4f47d5=_0x4f47d5-0x0;var _0x507cc5=_0xbca9[_0x4f47d5];return _0x507cc5;};'use strict';var _=require(_0x9bca('0x0'));var util=require(_0x9bca('0x1'));var moment=require(_0x9bca('0x2'));var BPromise=require(_0x9bca('0x3'));var rs=require(_0x9bca('0x4'));var fs=require('fs');var Redis=require(_0x9bca('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9bca('0x6'));var logger=require('../../config/logger')(_0x9bca('0x7'));var config=require(_0x9bca('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9bca('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x101f68,_0x2d8fca,_0x99395c){return new BPromise(function(_0x223ada,_0x26a79c){return client['request'](_0x101f68,_0x99395c)[_0x9bca('0xa')](function(_0x2a0916){logger['info'](_0x9bca('0xb'),_0x2d8fca,_0x9bca('0xc'));logger['debug'](_0x9bca('0xd'),_0x2d8fca,_0x9bca('0xc'),JSON[_0x9bca('0xe')](_0x2a0916));if(_0x2a0916[_0x9bca('0xf')]){if(_0x2a0916['error'][_0x9bca('0x10')]===0x1f4){logger[_0x9bca('0xf')](_0x9bca('0xb'),_0x2d8fca,_0x2a0916[_0x9bca('0xf')][_0x9bca('0x11')]);return _0x26a79c(_0x2a0916[_0x9bca('0xf')][_0x9bca('0x11')]);}logger[_0x9bca('0xf')](_0x9bca('0xb'),_0x2d8fca,_0x2a0916['error']['message']);return _0x223ada(_0x2a0916[_0x9bca('0xf')][_0x9bca('0x11')]);}else{logger[_0x9bca('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x2d8fca,_0x9bca('0xc'));_0x223ada(_0x2a0916[_0x9bca('0x13')]['message']);}})['catch'](function(_0x3e2d3d){logger[_0x9bca('0xf')](_0x9bca('0xb'),_0x2d8fca,_0x3e2d3d);_0x26a79c(_0x3e2d3d);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 11c7218..fe457c1 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 _0x7ea0=['show','post','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x12e973,_0x280636){var _0x5cac28=function(_0x2e9a1e){while(--_0x2e9a1e){_0x12e973['push'](_0x12e973['shift']());}};_0x5cac28(++_0x280636);}(_0x7ea0,0x182));var _0x07ea=function(_0x3abf28,_0x4c627a){_0x3abf28=_0x3abf28-0x0;var _0x435e24=_0x7ea0[_0x3abf28];return _0x435e24;};'use strict';var multer=require(_0x07ea('0x0'));var util=require(_0x07ea('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x07ea('0x2'));var router=express['Router']();var fs_extra=require(_0x07ea('0x3'));var auth=require(_0x07ea('0x4'));var interaction=require(_0x07ea('0x5'));var config=require('../../config/environment');var controller=require(_0x07ea('0x6'));router[_0x07ea('0x7')]('/',auth[_0x07ea('0x8')](),controller[_0x07ea('0x9')]);router[_0x07ea('0x7')](_0x07ea('0xa'),auth[_0x07ea('0x8')](),controller[_0x07ea('0xb')]);router[_0x07ea('0x7')](_0x07ea('0xc'),auth[_0x07ea('0x8')](),controller[_0x07ea('0xd')]);router[_0x07ea('0xe')]('/',auth[_0x07ea('0x8')](),controller['create']);router['put'](_0x07ea('0xc'),auth[_0x07ea('0x8')](),controller[_0x07ea('0xf')]);router[_0x07ea('0x10')]('/:id',auth[_0x07ea('0x8')](),controller[_0x07ea('0x11')]);module[_0x07ea('0x12')]=router; \ No newline at end of file +var _0xeb73=['Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy','exports','path','connect-timeout','express'];(function(_0x3975f2,_0x3a0ef1){var _0x1cd51b=function(_0x32fe80){while(--_0x32fe80){_0x3975f2['push'](_0x3975f2['shift']());}};_0x1cd51b(++_0x3a0ef1);}(_0xeb73,0x1bf));var _0x3eb7=function(_0x2254a0,_0x41f33e){_0x2254a0=_0x2254a0-0x0;var _0x35cd31=_0xeb73[_0x2254a0];return _0x35cd31;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3eb7('0x0'));var timeout=require(_0x3eb7('0x1'));var express=require(_0x3eb7('0x2'));var router=express[_0x3eb7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3eb7('0x4'));var interaction=require(_0x3eb7('0x5'));var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0x3eb7('0x6')]('/',auth[_0x3eb7('0x7')](),controller[_0x3eb7('0x8')]);router[_0x3eb7('0x6')](_0x3eb7('0x9'),auth[_0x3eb7('0x7')](),controller[_0x3eb7('0xa')]);router[_0x3eb7('0x6')](_0x3eb7('0xb'),auth[_0x3eb7('0x7')](),controller[_0x3eb7('0xc')]);router[_0x3eb7('0xd')]('/',auth[_0x3eb7('0x7')](),controller['create']);router[_0x3eb7('0xe')](_0x3eb7('0xb'),auth[_0x3eb7('0x7')](),controller[_0x3eb7('0xf')]);router['delete'](_0x3eb7('0xb'),auth[_0x3eb7('0x7')](),controller[_0x3eb7('0x10')]);module[_0x3eb7('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index ecf957f..51a698f 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 _0xb78e=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize','exports'];(function(_0x450153,_0x50180e){var _0x3e33d3=function(_0x3e2589){while(--_0x3e2589){_0x450153['push'](_0x450153['shift']());}};_0x3e33d3(++_0x50180e);}(_0xb78e,0x1c9));var _0xeb78=function(_0x5271d0,_0x3bef9b){_0x5271d0=_0x5271d0-0x0;var _0x4ce381=_0xb78e[_0x5271d0];return _0x4ce381;};'use strict';var Sequelize=require(_0xeb78('0x0'));module[_0xeb78('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xeb78('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xeb78('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xeb78('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xeb78('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xeb78('0x2')],'set':function(_0x308d12){this[_0xeb78('0x5')](_0xeb78('0x6'),_0x308d12?_0x308d12['join'](''):[]);},'get':function(){return this[_0xeb78('0x7')](_0xeb78('0x6'))?this[_0xeb78('0x7')](_0xeb78('0x6'))[_0xeb78('0x8')](''):[];}}}; \ No newline at end of file +var _0xbc9d=['sequelize','exports','STRING','INTEGER','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x59ec0f,_0x59f7f5){var _0x53525b=function(_0x2f9464){while(--_0x2f9464){_0x59ec0f['push'](_0x59ec0f['shift']());}};_0x53525b(++_0x59f7f5);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x9eeb50,_0x4bf715){_0x9eeb50=_0x9eeb50-0x0;var _0x399e30=_0xbc9d[_0x9eeb50];return _0x399e30;};'use strict';var Sequelize=require(_0xdbc9('0x0'));module[_0xdbc9('0x1')]={'name':{'type':Sequelize[_0xdbc9('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xdbc9('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xdbc9('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x2aba48){this[_0xdbc9('0x4')](_0xdbc9('0x5'),_0x2aba48?_0x2aba48[_0xdbc9('0x6')](''):[]);},'get':function(){return this[_0xdbc9('0x7')](_0xdbc9('0x5'))?this[_0xdbc9('0x7')]('crudPermissions')[_0xdbc9('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index c51ad91..a12e6ca 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 _0xed59=['fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','options','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','destroy','then','error','stack','name','send','UserProfileSection'];(function(_0x1ed555,_0x163bb2){var _0x2ade3d=function(_0x26cea2){while(--_0x26cea2){_0x1ed555['push'](_0x1ed555['shift']());}};_0x2ade3d(++_0x163bb2);}(_0xed59,0x10a));var _0x9ed5=function(_0x4e932d,_0x121006){_0x4e932d=_0x4e932d-0x0;var _0x1b8ff2=_0xed59[_0x4e932d];return _0x1b8ff2;};'use strict';var emlformat=require(_0x9ed5('0x0'));var rimraf=require(_0x9ed5('0x1'));var zipdir=require(_0x9ed5('0x2'));var jsonpatch=require(_0x9ed5('0x3'));var rp=require(_0x9ed5('0x4'));var moment=require(_0x9ed5('0x5'));var BPromise=require(_0x9ed5('0x6'));var Mustache=require('mustache');var util=require(_0x9ed5('0x7'));var path=require('path');var sox=require(_0x9ed5('0x8'));var csv=require(_0x9ed5('0x9'));var ejs=require(_0x9ed5('0xa'));var fs=require('fs');var fs_extra=require(_0x9ed5('0xb'));var _=require(_0x9ed5('0xc'));var squel=require(_0x9ed5('0xd'));var crypto=require(_0x9ed5('0xe'));var jsforce=require(_0x9ed5('0xf'));var deskjs=require(_0x9ed5('0x10'));var toCsv=require(_0x9ed5('0x9'));var querystring=require(_0x9ed5('0x11'));var Papa=require('papaparse');var Redis=require(_0x9ed5('0x12'));var authService=require(_0x9ed5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9ed5('0x14'));var hardwareService=require(_0x9ed5('0x15'));var logger=require(_0x9ed5('0x16'))(_0x9ed5('0x17'));var utils=require('../../config/utils');var config=require(_0x9ed5('0x18'));var licenseUtil=require(_0x9ed5('0x19'));var db=require(_0x9ed5('0x1a'))['db'];function respondWithStatusCode(_0x14934a,_0x5ae2ef){_0x5ae2ef=_0x5ae2ef||0xcc;return function(_0x48b0ca){if(_0x48b0ca){return _0x14934a[_0x9ed5('0x1b')](_0x5ae2ef);}return _0x14934a[_0x9ed5('0x1c')](_0x5ae2ef)[_0x9ed5('0x1d')]();};}function respondWithResult(_0x52fbfd,_0x3179f7){_0x3179f7=_0x3179f7||0xc8;return function(_0x16aba6){if(_0x16aba6){return _0x52fbfd[_0x9ed5('0x1c')](_0x3179f7)[_0x9ed5('0x1e')](_0x16aba6);}};}function respondWithFilteredResult(_0x1d10c4,_0x11e0b8){return function(_0x1c4e37){if(_0x1c4e37){var _0x1104b6=typeof _0x11e0b8[_0x9ed5('0x1f')]==='undefined'&&typeof _0x11e0b8[_0x9ed5('0x20')]===_0x9ed5('0x21');var _0x5425fe=_0x1c4e37[_0x9ed5('0x22')];var _0x5ebc3d=_0x1104b6?0x0:_0x11e0b8[_0x9ed5('0x1f')];var _0x1320d=_0x1104b6?_0x1c4e37['count']:_0x11e0b8[_0x9ed5('0x1f')]+_0x11e0b8[_0x9ed5('0x20')];var _0x137310;if(_0x1320d>=_0x5425fe){_0x1320d=_0x5425fe;_0x137310=0xc8;}else{_0x137310=0xce;}_0x1d10c4[_0x9ed5('0x1c')](_0x137310);return _0x1d10c4[_0x9ed5('0x23')]('Content-Range',_0x5ebc3d+'-'+_0x1320d+'/'+_0x5425fe)[_0x9ed5('0x1e')](_0x1c4e37);}return null;};}function patchUpdates(_0x149a00){return function(_0x55b23e){try{jsonpatch[_0x9ed5('0x24')](_0x55b23e,_0x149a00,!![]);}catch(_0x2878bb){return BPromise[_0x9ed5('0x25')](_0x2878bb);}return _0x55b23e[_0x9ed5('0x26')]();};}function saveUpdates(_0x2e9940,_0x5ab7e7){return function(_0x3b8bb6){if(_0x3b8bb6){return _0x3b8bb6['update'](_0x2e9940)['then'](function(_0x52548f){return _0x52548f;});}return null;};}function removeEntity(_0x563f00,_0x262cf7){return function(_0xa816e6){if(_0xa816e6){return _0xa816e6[_0x9ed5('0x27')]()[_0x9ed5('0x28')](function(){_0x563f00[_0x9ed5('0x1c')](0xcc)[_0x9ed5('0x1d')]();});}};}function handleEntityNotFound(_0x175de6,_0x3aa5a0){return function(_0x2846fb){if(!_0x2846fb){_0x175de6[_0x9ed5('0x1b')](0x194);}return _0x2846fb;};}function handleError(_0x27989c,_0x30a9ad){_0x30a9ad=_0x30a9ad||0x1f4;return function(_0x554cc2){logger[_0x9ed5('0x29')](_0x554cc2[_0x9ed5('0x2a')]);if(_0x554cc2[_0x9ed5('0x2b')]){delete _0x554cc2[_0x9ed5('0x2b')];}_0x27989c[_0x9ed5('0x1c')](_0x30a9ad)[_0x9ed5('0x2c')](_0x554cc2);};}exports['index']=function(_0x42a002,_0x38d7e6){var _0x4dbfa4={},_0x59e87c={},_0x59e7d6={'count':0x0,'rows':[]};var _0x456e9f=_['map'](db[_0x9ed5('0x2d')]['rawAttributes'],function(_0x307aca){return{'name':_0x307aca[_0x9ed5('0x2e')],'type':_0x307aca[_0x9ed5('0x2f')][_0x9ed5('0x30')]};});_0x59e87c[_0x9ed5('0x31')]=_[_0x9ed5('0x32')](_0x456e9f,_0x9ed5('0x2b'));_0x59e87c[_0x9ed5('0x33')]=_[_0x9ed5('0x34')](_0x42a002[_0x9ed5('0x33')]);_0x59e87c['filters']=_[_0x9ed5('0x35')](_0x59e87c[_0x9ed5('0x31')],_0x59e87c[_0x9ed5('0x33')]);_0x4dbfa4[_0x9ed5('0x36')]=_[_0x9ed5('0x35')](_0x59e87c['model'],qs[_0x9ed5('0x37')](_0x42a002[_0x9ed5('0x33')][_0x9ed5('0x37')]));_0x4dbfa4['attributes']=_0x4dbfa4[_0x9ed5('0x36')][_0x9ed5('0x38')]?_0x4dbfa4[_0x9ed5('0x36')]:_0x59e87c['model'];if(!_0x42a002['query'][_0x9ed5('0x39')](_0x9ed5('0x3a'))){_0x4dbfa4[_0x9ed5('0x20')]=qs[_0x9ed5('0x20')](_0x42a002[_0x9ed5('0x33')][_0x9ed5('0x20')]);_0x4dbfa4[_0x9ed5('0x1f')]=qs['offset'](_0x42a002[_0x9ed5('0x33')][_0x9ed5('0x1f')]);}_0x4dbfa4[_0x9ed5('0x3b')]=qs[_0x9ed5('0x3c')](_0x42a002[_0x9ed5('0x33')][_0x9ed5('0x3c')]);_0x4dbfa4[_0x9ed5('0x3d')]=qs[_0x9ed5('0x3e')](_[_0x9ed5('0x3f')](_0x42a002[_0x9ed5('0x33')],_0x59e87c[_0x9ed5('0x3e')]),_0x456e9f);if(_0x42a002[_0x9ed5('0x33')][_0x9ed5('0x40')]){_0x4dbfa4['where']=_[_0x9ed5('0x41')](_0x4dbfa4['where'],{'$or':_[_0x9ed5('0x32')](_0x456e9f,function(_0x33b389){if(_0x33b389[_0x9ed5('0x2f')]!==_0x9ed5('0x42')){var _0x1de315={};_0x1de315[_0x33b389[_0x9ed5('0x2b')]]={'$like':'%'+_0x42a002[_0x9ed5('0x33')][_0x9ed5('0x40')]+'%'};return _0x1de315;}})});}_0x4dbfa4=_[_0x9ed5('0x41')]({},_0x4dbfa4,_0x42a002['options']);var _0x11d54f={'where':_0x4dbfa4['where']};return db[_0x9ed5('0x2d')]['count'](_0x11d54f)[_0x9ed5('0x28')](function(_0x1f44c1){_0x59e7d6[_0x9ed5('0x22')]=_0x1f44c1;if(_0x42a002[_0x9ed5('0x33')][_0x9ed5('0x43')]){_0x4dbfa4[_0x9ed5('0x44')]=[{'all':!![]}];}return db[_0x9ed5('0x2d')][_0x9ed5('0x45')](_0x4dbfa4);})['then'](function(_0xf8391b){_0x59e7d6['rows']=_0xf8391b;return _0x59e7d6;})[_0x9ed5('0x28')](respondWithFilteredResult(_0x38d7e6,_0x4dbfa4))[_0x9ed5('0x46')](handleError(_0x38d7e6,null));};exports[_0x9ed5('0x47')]=function(_0x44d22c,_0x3d9adb){var _0xd9b707={'raw':![],'where':{'id':_0x44d22c['params']['id']}},_0x44fa1b={};_0x44fa1b[_0x9ed5('0x31')]=_[_0x9ed5('0x34')](db[_0x9ed5('0x2d')]['rawAttributes']);_0x44fa1b[_0x9ed5('0x33')]=_[_0x9ed5('0x34')](_0x44d22c[_0x9ed5('0x33')]);_0x44fa1b[_0x9ed5('0x3e')]=_[_0x9ed5('0x35')](_0x44fa1b['model'],_0x44fa1b[_0x9ed5('0x33')]);_0xd9b707['attributes']=_[_0x9ed5('0x35')](_0x44fa1b[_0x9ed5('0x31')],qs['fields'](_0x44d22c[_0x9ed5('0x33')][_0x9ed5('0x37')]));_0xd9b707[_0x9ed5('0x36')]=_0xd9b707[_0x9ed5('0x36')][_0x9ed5('0x38')]?_0xd9b707[_0x9ed5('0x36')]:_0x44fa1b[_0x9ed5('0x31')];if(_0x44d22c['query'][_0x9ed5('0x43')]){_0xd9b707[_0x9ed5('0x44')]=[{'all':!![]}];}_0xd9b707=_['merge']({},_0xd9b707,_0x44d22c[_0x9ed5('0x48')]);return db[_0x9ed5('0x2d')]['find'](_0xd9b707)[_0x9ed5('0x28')](handleEntityNotFound(_0x3d9adb,null))[_0x9ed5('0x28')](respondWithResult(_0x3d9adb,null))[_0x9ed5('0x46')](handleError(_0x3d9adb,null));};exports[_0x9ed5('0x49')]=function(_0x53c326,_0x5e04c0){return db[_0x9ed5('0x2d')][_0x9ed5('0x49')](_0x53c326[_0x9ed5('0x4a')],{})[_0x9ed5('0x28')](respondWithResult(_0x5e04c0,0xc9))[_0x9ed5('0x46')](handleError(_0x5e04c0,null));};exports[_0x9ed5('0x4b')]=function(_0x1b79b2,_0x2529bc){if(_0x1b79b2['body']['id']){delete _0x1b79b2[_0x9ed5('0x4a')]['id'];}return db[_0x9ed5('0x2d')][_0x9ed5('0x4c')]({'where':{'id':_0x1b79b2['params']['id']}})[_0x9ed5('0x28')](handleEntityNotFound(_0x2529bc,null))[_0x9ed5('0x28')](saveUpdates(_0x1b79b2[_0x9ed5('0x4a')],null))['then'](respondWithResult(_0x2529bc,null))['catch'](handleError(_0x2529bc,null));};exports[_0x9ed5('0x27')]=function(_0x1e7e7b,_0x237691){return db[_0x9ed5('0x2d')][_0x9ed5('0x4c')]({'where':{'id':_0x1e7e7b['params']['id']}})[_0x9ed5('0x28')](handleEntityNotFound(_0x237691,null))[_0x9ed5('0x28')](removeEntity(_0x237691,null))['catch'](handleError(_0x237691,null));};exports[_0x9ed5('0x4d')]=function(_0x45c1de,_0x4be098){return db[_0x9ed5('0x2d')][_0x9ed5('0x4d')]()[_0x9ed5('0x28')](respondWithResult(_0x4be098,null))[_0x9ed5('0x46')](handleError(_0x4be098,null));}; \ No newline at end of file +var _0x2f88=['key','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','show','model','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','UserProfileSection','type'];(function(_0x320f41,_0x1f6bef){var _0x3206ec=function(_0x59b76d){while(--_0x59b76d){_0x320f41['push'](_0x320f41['shift']());}};_0x3206ec(++_0x1f6bef);}(_0x2f88,0x1d2));var _0x82f8=function(_0x4d45c3,_0x5ef8ef){_0x4d45c3=_0x4d45c3-0x0;var _0x5bf776=_0x2f88[_0x4d45c3];return _0x5bf776;};'use strict';var emlformat=require(_0x82f8('0x0'));var rimraf=require(_0x82f8('0x1'));var zipdir=require(_0x82f8('0x2'));var jsonpatch=require(_0x82f8('0x3'));var rp=require('request-promise');var moment=require(_0x82f8('0x4'));var BPromise=require(_0x82f8('0x5'));var Mustache=require(_0x82f8('0x6'));var util=require(_0x82f8('0x7'));var path=require(_0x82f8('0x8'));var sox=require(_0x82f8('0x9'));var csv=require(_0x82f8('0xa'));var ejs=require(_0x82f8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x82f8('0xc'));var crypto=require('crypto');var jsforce=require(_0x82f8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x82f8('0xa'));var querystring=require(_0x82f8('0xe'));var Papa=require('papaparse');var Redis=require(_0x82f8('0xf'));var authService=require(_0x82f8('0x10'));var qs=require(_0x82f8('0x11'));var as=require(_0x82f8('0x12'));var hardwareService=require(_0x82f8('0x13'));var logger=require(_0x82f8('0x14'))(_0x82f8('0x15'));var utils=require('../../config/utils');var config=require(_0x82f8('0x16'));var licenseUtil=require(_0x82f8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46072a,_0x441e46){_0x441e46=_0x441e46||0xcc;return function(_0xcb12be){if(_0xcb12be){return _0x46072a[_0x82f8('0x18')](_0x441e46);}return _0x46072a['status'](_0x441e46)['end']();};}function respondWithResult(_0x5f4bc0,_0x451ee6){_0x451ee6=_0x451ee6||0xc8;return function(_0x469901){if(_0x469901){return _0x5f4bc0[_0x82f8('0x19')](_0x451ee6)[_0x82f8('0x1a')](_0x469901);}};}function respondWithFilteredResult(_0x2dc19e,_0x5e15c0){return function(_0x28ab17){if(_0x28ab17){var _0x174bcd=typeof _0x5e15c0[_0x82f8('0x1b')]==='undefined'&&typeof _0x5e15c0[_0x82f8('0x1c')]==='undefined';var _0x1ea8c9=_0x28ab17[_0x82f8('0x1d')];var _0x570d52=_0x174bcd?0x0:_0x5e15c0['offset'];var _0xf0fca5=_0x174bcd?_0x28ab17[_0x82f8('0x1d')]:_0x5e15c0[_0x82f8('0x1b')]+_0x5e15c0[_0x82f8('0x1c')];var _0x524be3;if(_0xf0fca5>=_0x1ea8c9){_0xf0fca5=_0x1ea8c9;_0x524be3=0xc8;}else{_0x524be3=0xce;}_0x2dc19e[_0x82f8('0x19')](_0x524be3);return _0x2dc19e[_0x82f8('0x1e')](_0x82f8('0x1f'),_0x570d52+'-'+_0xf0fca5+'/'+_0x1ea8c9)[_0x82f8('0x1a')](_0x28ab17);}return null;};}function patchUpdates(_0x80bb9){return function(_0x38aa1c){try{jsonpatch[_0x82f8('0x20')](_0x38aa1c,_0x80bb9,!![]);}catch(_0x6ca3fe){return BPromise[_0x82f8('0x21')](_0x6ca3fe);}return _0x38aa1c[_0x82f8('0x22')]();};}function saveUpdates(_0x4ad3e5,_0xba6d28){return function(_0x59c2fa){if(_0x59c2fa){return _0x59c2fa[_0x82f8('0x23')](_0x4ad3e5)['then'](function(_0x21edd9){return _0x21edd9;});}return null;};}function removeEntity(_0x2864b5,_0x31ca67){return function(_0x498647){if(_0x498647){return _0x498647[_0x82f8('0x24')]()['then'](function(){_0x2864b5[_0x82f8('0x19')](0xcc)[_0x82f8('0x25')]();});}};}function handleEntityNotFound(_0x3a4b26,_0x35a365){return function(_0xaac7b8){if(!_0xaac7b8){_0x3a4b26['sendStatus'](0x194);}return _0xaac7b8;};}function handleError(_0x28ff17,_0x5e2c09){_0x5e2c09=_0x5e2c09||0x1f4;return function(_0x40fcfb){logger['error'](_0x40fcfb[_0x82f8('0x26')]);if(_0x40fcfb[_0x82f8('0x27')]){delete _0x40fcfb[_0x82f8('0x27')];}_0x28ff17[_0x82f8('0x19')](_0x5e2c09)[_0x82f8('0x28')](_0x40fcfb);};}exports[_0x82f8('0x29')]=function(_0x3b33c0,_0x460a49){var _0x5528b6={},_0x42aee7={},_0x21d09e={'count':0x0,'rows':[]};var _0x355e77=_[_0x82f8('0x2a')](db[_0x82f8('0x2b')]['rawAttributes'],function(_0x4ab2c1){return{'name':_0x4ab2c1['fieldName'],'type':_0x4ab2c1[_0x82f8('0x2c')][_0x82f8('0x2d')]};});_0x42aee7['model']=_['map'](_0x355e77,_0x82f8('0x27'));_0x42aee7[_0x82f8('0x2e')]=_[_0x82f8('0x2f')](_0x3b33c0['query']);_0x42aee7['filters']=_[_0x82f8('0x30')](_0x42aee7['model'],_0x42aee7[_0x82f8('0x2e')]);_0x5528b6['attributes']=_[_0x82f8('0x30')](_0x42aee7['model'],qs[_0x82f8('0x31')](_0x3b33c0[_0x82f8('0x2e')][_0x82f8('0x31')]));_0x5528b6[_0x82f8('0x32')]=_0x5528b6[_0x82f8('0x32')][_0x82f8('0x33')]?_0x5528b6['attributes']:_0x42aee7['model'];if(!_0x3b33c0[_0x82f8('0x2e')]['hasOwnProperty'](_0x82f8('0x34'))){_0x5528b6[_0x82f8('0x1c')]=qs[_0x82f8('0x1c')](_0x3b33c0[_0x82f8('0x2e')][_0x82f8('0x1c')]);_0x5528b6[_0x82f8('0x1b')]=qs['offset'](_0x3b33c0['query']['offset']);}_0x5528b6[_0x82f8('0x35')]=qs['sort'](_0x3b33c0[_0x82f8('0x2e')][_0x82f8('0x36')]);_0x5528b6[_0x82f8('0x37')]=qs[_0x82f8('0x38')](_['pick'](_0x3b33c0[_0x82f8('0x2e')],_0x42aee7['filters']),_0x355e77);if(_0x3b33c0[_0x82f8('0x2e')][_0x82f8('0x39')]){_0x5528b6['where']=_[_0x82f8('0x3a')](_0x5528b6[_0x82f8('0x37')],{'$or':_[_0x82f8('0x2a')](_0x355e77,function(_0x5b6b43){if(_0x5b6b43[_0x82f8('0x2c')]!==_0x82f8('0x3b')){var _0x39f099={};_0x39f099[_0x5b6b43[_0x82f8('0x27')]]={'$like':'%'+_0x3b33c0[_0x82f8('0x2e')]['filter']+'%'};return _0x39f099;}})});}_0x5528b6=_['merge']({},_0x5528b6,_0x3b33c0[_0x82f8('0x3c')]);var _0x253970={'where':_0x5528b6[_0x82f8('0x37')]};return db[_0x82f8('0x2b')][_0x82f8('0x1d')](_0x253970)[_0x82f8('0x3d')](function(_0x5a2c52){_0x21d09e[_0x82f8('0x1d')]=_0x5a2c52;if(_0x3b33c0[_0x82f8('0x2e')][_0x82f8('0x3e')]){_0x5528b6[_0x82f8('0x3f')]=[{'all':!![]}];}return db['UserProfileSection'][_0x82f8('0x40')](_0x5528b6);})[_0x82f8('0x3d')](function(_0x5c31db){_0x21d09e['rows']=_0x5c31db;return _0x21d09e;})['then'](respondWithFilteredResult(_0x460a49,_0x5528b6))[_0x82f8('0x41')](handleError(_0x460a49,null));};exports[_0x82f8('0x42')]=function(_0xfbe442,_0x3df767){var _0x3d19ac={'raw':![],'where':{'id':_0xfbe442['params']['id']}},_0x28131c={};_0x28131c[_0x82f8('0x43')]=_[_0x82f8('0x2f')](db[_0x82f8('0x2b')]['rawAttributes']);_0x28131c[_0x82f8('0x2e')]=_[_0x82f8('0x2f')](_0xfbe442[_0x82f8('0x2e')]);_0x28131c[_0x82f8('0x38')]=_[_0x82f8('0x30')](_0x28131c[_0x82f8('0x43')],_0x28131c[_0x82f8('0x2e')]);_0x3d19ac[_0x82f8('0x32')]=_[_0x82f8('0x30')](_0x28131c[_0x82f8('0x43')],qs[_0x82f8('0x31')](_0xfbe442[_0x82f8('0x2e')]['fields']));_0x3d19ac[_0x82f8('0x32')]=_0x3d19ac['attributes']['length']?_0x3d19ac['attributes']:_0x28131c['model'];if(_0xfbe442[_0x82f8('0x2e')][_0x82f8('0x3e')]){_0x3d19ac[_0x82f8('0x3f')]=[{'all':!![]}];}_0x3d19ac=_[_0x82f8('0x3a')]({},_0x3d19ac,_0xfbe442[_0x82f8('0x3c')]);return db['UserProfileSection'][_0x82f8('0x44')](_0x3d19ac)['then'](handleEntityNotFound(_0x3df767,null))[_0x82f8('0x3d')](respondWithResult(_0x3df767,null))['catch'](handleError(_0x3df767,null));};exports[_0x82f8('0x45')]=function(_0xd28e22,_0x57ffa9){return db[_0x82f8('0x2b')][_0x82f8('0x45')](_0xd28e22['body'],{})[_0x82f8('0x3d')](respondWithResult(_0x57ffa9,0xc9))[_0x82f8('0x41')](handleError(_0x57ffa9,null));};exports[_0x82f8('0x23')]=function(_0x2c7bc7,_0xe3f04){if(_0x2c7bc7[_0x82f8('0x46')]['id']){delete _0x2c7bc7['body']['id'];}return db[_0x82f8('0x2b')]['find']({'where':{'id':_0x2c7bc7[_0x82f8('0x47')]['id']}})['then'](handleEntityNotFound(_0xe3f04,null))['then'](saveUpdates(_0x2c7bc7[_0x82f8('0x46')],null))['then'](respondWithResult(_0xe3f04,null))['catch'](handleError(_0xe3f04,null));};exports[_0x82f8('0x24')]=function(_0x2640d4,_0x4835a2){return db['UserProfileSection'][_0x82f8('0x44')]({'where':{'id':_0x2640d4[_0x82f8('0x47')]['id']}})[_0x82f8('0x3d')](handleEntityNotFound(_0x4835a2,null))[_0x82f8('0x3d')](removeEntity(_0x4835a2,null))[_0x82f8('0x41')](handleError(_0x4835a2,null));};exports[_0x82f8('0x48')]=function(_0x5a8fc3,_0x16dcfe){return db['UserProfileSection']['describe']()[_0x82f8('0x3d')](respondWithResult(_0x16dcfe,null))[_0x82f8('0x41')](handleError(_0x16dcfe,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index fce2d98..6475bd2 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 _0xc505=['path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','compositeIndex','userProfileId','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x5addb8,_0x533646){var _0x21de5b=function(_0x172881){while(--_0x172881){_0x5addb8['push'](_0x5addb8['shift']());}};_0x21de5b(++_0x533646);}(_0xc505,0x175));var _0x5c50=function(_0x12a1b6,_0x34efee){_0x12a1b6=_0x12a1b6-0x0;var _0x42b40e=_0xc505[_0x12a1b6];return _0x42b40e;};'use strict';var _=require(_0x5c50('0x0'));var util=require('util');var logger=require(_0x5c50('0x1'))('api');var moment=require(_0x5c50('0x2'));var BPromise=require(_0x5c50('0x3'));var rp=require(_0x5c50('0x4'));var fs=require('fs');var path=require(_0x5c50('0x5'));var rimraf=require(_0x5c50('0x6'));var config=require(_0x5c50('0x7'));var attributes=require(_0x5c50('0x8'));module[_0x5c50('0x9')]=function(_0x4d3a91,_0x29413e){return _0x4d3a91[_0x5c50('0xa')](_0x5c50('0xb'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x5c50('0xc'),'fields':['sectionId',_0x5c50('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x67f5=['rimraf','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','util','api','moment','bluebird'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x67f5,0x10d));var _0x567f=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0x67f5[_0x1cbcf1];return _0x3a06f0;};'use strict';var _=require('lodash');var util=require(_0x567f('0x0'));var logger=require('../../config/logger')(_0x567f('0x1'));var moment=require(_0x567f('0x2'));var BPromise=require(_0x567f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x567f('0x4'));var config=require(_0x567f('0x5'));var attributes=require(_0x567f('0x6'));module['exports']=function(_0x429696,_0x3db2c8){return _0x429696[_0x567f('0x7')](_0x567f('0x8'),attributes,{'tableName':_0x567f('0x9'),'paranoid':![],'indexes':[{'name':_0x567f('0xa'),'fields':[_0x567f('0xb'),_0x567f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index e02a8b7..0e13f36 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 _0x0fda=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserProfileSection,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring'];(function(_0x386c3e,_0x44a375){var _0x4b8e13=function(_0x583c8f){while(--_0x583c8f){_0x386c3e['push'](_0x386c3e['shift']());}};_0x4b8e13(++_0x44a375);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x2549a7,_0x1ea773){_0x2549a7=_0x2549a7-0x0;var _0x2c7b13=_0x0fda[_0x2549a7];return _0x2c7b13;};'use strict';var _=require(_0xa0fd('0x0'));var util=require('util');var moment=require(_0xa0fd('0x1'));var BPromise=require(_0xa0fd('0x2'));var rs=require(_0xa0fd('0x3'));var fs=require('fs');var Redis=require(_0xa0fd('0x4'));var db=require(_0xa0fd('0x5'))['db'];var utils=require(_0xa0fd('0x6'));var logger=require(_0xa0fd('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa0fd('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x868183,_0x62b109,_0x1aab41){return new BPromise(function(_0x248cca,_0x5d996b){return client[_0xa0fd('0x9')](_0x868183,_0x1aab41)[_0xa0fd('0xa')](function(_0x231ca4){logger[_0xa0fd('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x62b109,_0xa0fd('0xc'));logger[_0xa0fd('0xd')](_0xa0fd('0xe'),_0x62b109,'request\x20sent',JSON[_0xa0fd('0xf')](_0x231ca4));if(_0x231ca4[_0xa0fd('0x10')]){if(_0x231ca4[_0xa0fd('0x10')][_0xa0fd('0x11')]===0x1f4){logger[_0xa0fd('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x62b109,_0x231ca4['error'][_0xa0fd('0x12')]);return _0x5d996b(_0x231ca4[_0xa0fd('0x10')]['message']);}logger[_0xa0fd('0x10')](_0xa0fd('0x13'),_0x62b109,_0x231ca4[_0xa0fd('0x10')][_0xa0fd('0x12')]);return _0x248cca(_0x231ca4[_0xa0fd('0x10')][_0xa0fd('0x12')]);}else{logger[_0xa0fd('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x62b109,_0xa0fd('0xc'));_0x248cca(_0x231ca4[_0xa0fd('0x14')]['message']);}})['catch'](function(_0x205506){logger[_0xa0fd('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x62b109,_0x205506);_0x5d996b(_0x205506);});});} \ No newline at end of file +var _0xd068=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','code','error','UserProfileSection,\x20%s,\x20%s','message','catch','lodash'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0xd068,0xce));var _0x8d06=function(_0x333e17,_0x589bb9){_0x333e17=_0x333e17-0x0;var _0x432dad=_0xd068[_0x333e17];return _0x432dad;};'use strict';var _=require(_0x8d06('0x0'));var util=require(_0x8d06('0x1'));var moment=require(_0x8d06('0x2'));var BPromise=require(_0x8d06('0x3'));var rs=require(_0x8d06('0x4'));var fs=require('fs');var Redis=require(_0x8d06('0x5'));var db=require(_0x8d06('0x6'))['db'];var utils=require(_0x8d06('0x7'));var logger=require(_0x8d06('0x8'))(_0x8d06('0x9'));var config=require(_0x8d06('0xa'));var jayson=require(_0x8d06('0xb'));var client=jayson[_0x8d06('0xc')][_0x8d06('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xb52bab,_0x41b883,_0x3f1a0b){return new BPromise(function(_0x15f26f,_0x50fc05){return client[_0x8d06('0xe')](_0xb52bab,_0x3f1a0b)['then'](function(_0xc29343){logger[_0x8d06('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x41b883,_0x8d06('0x10'));logger['debug'](_0x8d06('0x11'),_0x41b883,_0x8d06('0x10'),JSON['stringify'](_0xc29343));if(_0xc29343['error']){if(_0xc29343['error'][_0x8d06('0x12')]===0x1f4){logger[_0x8d06('0x13')](_0x8d06('0x14'),_0x41b883,_0xc29343['error'][_0x8d06('0x15')]);return _0x50fc05(_0xc29343[_0x8d06('0x13')][_0x8d06('0x15')]);}logger[_0x8d06('0x13')](_0x8d06('0x14'),_0x41b883,_0xc29343[_0x8d06('0x13')][_0x8d06('0x15')]);return _0x15f26f(_0xc29343['error']['message']);}else{logger[_0x8d06('0xf')](_0x8d06('0x14'),_0x41b883,'request\x20sent');_0x15f26f(_0xc29343['result'][_0x8d06('0x15')]);}})[_0x8d06('0x16')](function(_0x5de921){logger[_0x8d06('0x13')](_0x8d06('0x14'),_0x41b883,_0x5de921);_0x50fc05(_0x5de921);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index d7b7612..c736d8e 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x215e2b,_0x1e6249){var _0x537cc1=function(_0x499502){while(--_0x499502){_0x215e2b['push'](_0x215e2b['shift']());}};_0x537cc1(++_0x1e6249);}(_0xedd9,0xfc));var _0x9edd=function(_0x248ae1,_0x3a5e3b){_0x248ae1=_0x248ae1-0x0;var _0x29f1e9=_0xedd9[_0x248ae1];return _0x29f1e9;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xea97c9,_0x20aaef){var _0x213202=function(_0x3d52a3){while(--_0x3d52a3){_0xea97c9['push'](_0xea97c9['shift']());}};_0x213202(++_0x20aaef);}(_0x70e0,0x17b));var _0x070e=function(_0x577533,_0x392fd8){_0x577533=_0x577533-0x0;var _0x437cf1=_0x70e0[_0x577533];return _0x437cf1;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index fecd019..e2a7141 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 _0xbdfc=['sequelize','exports','INTEGER'];(function(_0x5b89c7,_0x22994c){var _0x332b50=function(_0x2afacc){while(--_0x2afacc){_0x5b89c7['push'](_0x5b89c7['shift']());}};_0x332b50(++_0x22994c);}(_0xbdfc,0x1e9));var _0xcbdf=function(_0xa45617,_0x2ad874){_0xa45617=_0xa45617-0x0;var _0x2a74da=_0xbdfc[_0xa45617];return _0x2a74da;};'use strict';var Sequelize=require(_0xcbdf('0x0'));module[_0xcbdf('0x1')]={'penalty':{'type':Sequelize[_0xcbdf('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa780=['INTEGER','sequelize'];(function(_0x2d14dc,_0x58c365){var _0x1af3ee=function(_0x12183c){while(--_0x12183c){_0x2d14dc['push'](_0x2d14dc['shift']());}};_0x1af3ee(++_0x58c365);}(_0xa780,0x139));var _0x0a78=function(_0x13ccaf,_0x4cca45){_0x13ccaf=_0x13ccaf-0x0;var _0xa14269=_0xa780[_0x13ccaf];return _0xa14269;};'use strict';var Sequelize=require(_0x0a78('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x0a78('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 803d8b5..da16a36 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 _0xd8fb=['lodash','util','../../config/logger','api','path','rimraf','./userSmsQueue.attributes','exports','UserSmsQueue'];(function(_0xfd4d9d,_0x3179c1){var _0x27a7bc=function(_0xe59e74){while(--_0xe59e74){_0xfd4d9d['push'](_0xfd4d9d['shift']());}};_0x27a7bc(++_0x3179c1);}(_0xd8fb,0x99));var _0xbd8f=function(_0x4a1b78,_0x4a42df){_0x4a1b78=_0x4a1b78-0x0;var _0x3778c2=_0xd8fb[_0x4a1b78];return _0x3778c2;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8506=['util','api','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x301f5e,_0x562f08){var _0x5cfc0d=function(_0x193684){while(--_0x193684){_0x301f5e['push'](_0x301f5e['shift']());}};_0x5cfc0d(++_0x562f08);}(_0x8506,0xe8));var _0x6850=function(_0x555e8c,_0x1aae85){_0x555e8c=_0x555e8c-0x0;var _0x3dfa7=_0x8506[_0x555e8c];return _0x3dfa7;};'use strict';var _=require('lodash');var util=require(_0x6850('0x0'));var logger=require('../../config/logger')(_0x6850('0x1'));var moment=require('moment');var BPromise=require(_0x6850('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6850('0x3'));var rimraf=require(_0x6850('0x4'));var config=require(_0x6850('0x5'));var attributes=require('./userSmsQueue.attributes');module[_0x6850('0x6')]=function(_0x372f0b,_0x232459){return _0x372f0b[_0x6850('0x7')]('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 54b158b..baebf6f 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 _0x9e71=['then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request'];(function(_0x1f3579,_0x275ae2){var _0x307378=function(_0x1c6929){while(--_0x1c6929){_0x1f3579['push'](_0x1f3579['shift']());}};_0x307378(++_0x275ae2);}(_0x9e71,0xed));var _0x19e7=function(_0x24f373,_0x56d206){_0x24f373=_0x24f373-0x0;var _0x4d2236=_0x9e71[_0x24f373];return _0x4d2236;};'use strict';var _=require('lodash');var util=require(_0x19e7('0x0'));var moment=require(_0x19e7('0x1'));var BPromise=require(_0x19e7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x19e7('0x3'));var db=require(_0x19e7('0x4'))['db'];var utils=require(_0x19e7('0x5'));var logger=require(_0x19e7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x19e7('0x7'));var client=jayson['client'][_0x19e7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x321a14,_0x45979c,_0x574a4e){return new BPromise(function(_0x18e684,_0x2a1fed){return client[_0x19e7('0x9')](_0x321a14,_0x574a4e)[_0x19e7('0xa')](function(_0x408e27){logger[_0x19e7('0xb')](_0x19e7('0xc'),_0x45979c,_0x19e7('0xd'));logger['debug'](_0x19e7('0xe'),_0x45979c,'request\x20sent',JSON['stringify'](_0x408e27));if(_0x408e27['error']){if(_0x408e27[_0x19e7('0xf')][_0x19e7('0x10')]===0x1f4){logger[_0x19e7('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x45979c,_0x408e27[_0x19e7('0xf')][_0x19e7('0x11')]);return _0x2a1fed(_0x408e27['error'][_0x19e7('0x11')]);}logger[_0x19e7('0xf')](_0x19e7('0xc'),_0x45979c,_0x408e27[_0x19e7('0xf')][_0x19e7('0x11')]);return _0x18e684(_0x408e27[_0x19e7('0xf')][_0x19e7('0x11')]);}else{logger[_0x19e7('0xb')](_0x19e7('0xc'),_0x45979c,_0x19e7('0xd'));_0x18e684(_0x408e27['result']['message']);}})[_0x19e7('0x12')](function(_0x313743){logger[_0x19e7('0xf')](_0x19e7('0xc'),_0x45979c,_0x313743);_0x2a1fed(_0x313743);});});} \ No newline at end of file +var _0x943f=['error','code','UserSmsQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x943f,0x119));var _0xf943=function(_0x3034a5,_0x1057ee){_0x3034a5=_0x3034a5-0x0;var _0x2ab136=_0x943f[_0x3034a5];return _0x2ab136;};'use strict';var _=require(_0xf943('0x0'));var util=require(_0xf943('0x1'));var moment=require(_0xf943('0x2'));var BPromise=require(_0xf943('0x3'));var rs=require(_0xf943('0x4'));var fs=require('fs');var Redis=require(_0xf943('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf943('0x6'));var logger=require(_0xf943('0x7'))(_0xf943('0x8'));var config=require(_0xf943('0x9'));var jayson=require(_0xf943('0xa'));var client=jayson[_0xf943('0xb')][_0xf943('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xcf0276,_0x2ba3b5,_0x496169){return new BPromise(function(_0x57c930,_0x2431cc){return client['request'](_0xcf0276,_0x496169)[_0xf943('0xd')](function(_0x43e46a){logger[_0xf943('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x2ba3b5,_0xf943('0xf'));logger[_0xf943('0x10')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x2ba3b5,'request\x20sent',JSON[_0xf943('0x11')](_0x43e46a));if(_0x43e46a[_0xf943('0x12')]){if(_0x43e46a[_0xf943('0x12')][_0xf943('0x13')]===0x1f4){logger[_0xf943('0x12')](_0xf943('0x14'),_0x2ba3b5,_0x43e46a[_0xf943('0x12')][_0xf943('0x15')]);return _0x2431cc(_0x43e46a['error'][_0xf943('0x15')]);}logger[_0xf943('0x12')](_0xf943('0x14'),_0x2ba3b5,_0x43e46a[_0xf943('0x12')][_0xf943('0x15')]);return _0x57c930(_0x43e46a[_0xf943('0x12')][_0xf943('0x15')]);}else{logger[_0xf943('0xe')](_0xf943('0x14'),_0x2ba3b5,_0xf943('0xf'));_0x57c930(_0x43e46a[_0xf943('0x16')]['message']);}})['catch'](function(_0x28fad1){logger[_0xf943('0x12')](_0xf943('0x14'),_0x2ba3b5,_0x28fad1);_0x2431cc(_0x28fad1);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 72fd8c4..110004a 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 _0x352a=['exports','INTEGER'];(function(_0x2bdab5,_0x16db04){var _0x4af44e=function(_0xccb2df){while(--_0xccb2df){_0x2bdab5['push'](_0x2bdab5['shift']());}};_0x4af44e(++_0x16db04);}(_0x352a,0xe6));var _0xa352=function(_0x1e6ca5,_0xfb9d62){_0x1e6ca5=_0x1e6ca5-0x0;var _0xf1e27=_0x352a[_0x1e6ca5];return _0xf1e27;};'use strict';var Sequelize=require('sequelize');module[_0xa352('0x0')]={'UserId':{'type':Sequelize[_0xa352('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xa352('0x1')]}}; \ No newline at end of file +var _0x2623=['exports','INTEGER','sequelize'];(function(_0x121c2d,_0x5077f0){var _0xb9219e=function(_0x4dc4a4){while(--_0x4dc4a4){_0x121c2d['push'](_0x121c2d['shift']());}};_0xb9219e(++_0x5077f0);}(_0x2623,0x1ca));var _0x3262=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0x2623[_0x355ce8];return _0x1db8b8;};'use strict';var Sequelize=require(_0x3262('0x0'));module[_0x3262('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x3262('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 2aa6dd7..1920925 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(_0x4c1abc,_0x5cf54e){var _0x1354c6=function(_0x31569c){while(--_0x31569c){_0x4c1abc['push'](_0x4c1abc['shift']());}};_0x1354c6(++_0x5cf54e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x50861d,_0x5039b7){var _0x10d2a4=function(_0x839db4){while(--_0x839db4){_0x50861d['push'](_0x50861d['shift']());}};_0x10d2a4(++_0x5039b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 a2940f3..8687d30 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(_0x49c381,_0x4a765e){var _0x3d244b=function(_0x394779){while(--_0x394779){_0x49c381['push'](_0x49c381['shift']());}};_0x3d244b(++_0x4a765e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3ed054,_0x4d4f16){_0x3ed054=_0x3ed054-0x0;var _0x16dd95=_0xcb91[_0x3ed054];return _0x16dd95;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xb77d35,_0x291854){var _0x5389a8=function(_0x52b4d2){while(--_0x52b4d2){_0xb77d35['push'](_0xb77d35['shift']());}};_0x5389a8(++_0x291854);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index e96d955..7c81f8e 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 _0x4a87=['INTEGER','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4a87,0x165));var _0x74a8=function(_0x1612b7,_0x4207ff){_0x1612b7=_0x1612b7-0x0;var _0xf4ec7b=_0x4a87[_0x1612b7];return _0xf4ec7b;};'use strict';var Sequelize=require('sequelize');module[_0x74a8('0x0')]={'penalty':{'type':Sequelize[_0x74a8('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x22c4=['sequelize','INTEGER'];(function(_0x13409a,_0x8f949e){var _0x12815b=function(_0x4ee9ab){while(--_0x4ee9ab){_0x13409a['push'](_0x13409a['shift']());}};_0x12815b(++_0x8f949e);}(_0x22c4,0xc4));var _0x422c=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x22c4[_0x1fc122];return _0xa2cb13;};'use strict';var Sequelize=require(_0x422c('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x422c('0x1')],'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 ccaa6f5..9e1ba16 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 _0x3209=['define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports'];(function(_0x2a6704,_0x113bbb){var _0x76dcb6=function(_0x4aac96){while(--_0x4aac96){_0x2a6704['push'](_0x2a6704['shift']());}};_0x76dcb6(++_0x113bbb);}(_0x3209,0x6f));var _0x9320=function(_0x5770c3,_0x1ffad3){_0x5770c3=_0x5770c3-0x0;var _0x21a981=_0x3209[_0x5770c3];return _0x21a981;};'use strict';var _=require(_0x9320('0x0'));var util=require(_0x9320('0x1'));var logger=require(_0x9320('0x2'))(_0x9320('0x3'));var moment=require(_0x9320('0x4'));var BPromise=require(_0x9320('0x5'));var rp=require(_0x9320('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9320('0x7'));var attributes=require('./userVoiceQueue.attributes');module[_0x9320('0x8')]=function(_0x59b783,_0x42c76a){return _0x59b783[_0x9320('0x9')](_0x9320('0xa'),attributes,{'tableName':_0x9320('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1005=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','define','user_has_voice_queues','lodash'];(function(_0x264c54,_0x25191f){var _0x49f3e4=function(_0x2aefd){while(--_0x2aefd){_0x264c54['push'](_0x264c54['shift']());}};_0x49f3e4(++_0x25191f);}(_0x1005,0x167));var _0x5100=function(_0xcf0948,_0x4c76ea){_0xcf0948=_0xcf0948-0x0;var _0x5296e9=_0x1005[_0xcf0948];return _0x5296e9;};'use strict';var _=require(_0x5100('0x0'));var util=require('util');var logger=require(_0x5100('0x1'))(_0x5100('0x2'));var moment=require(_0x5100('0x3'));var BPromise=require(_0x5100('0x4'));var rp=require(_0x5100('0x5'));var fs=require('fs');var path=require(_0x5100('0x6'));var rimraf=require(_0x5100('0x7'));var config=require(_0x5100('0x8'));var attributes=require(_0x5100('0x9'));module['exports']=function(_0x13445d,_0x39b7cf){return _0x13445d[_0x5100('0xa')]('UserVoiceQueue',attributes,{'tableName':_0x5100('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 9678219..c5fc7e2 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 _0xc754=['debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x22c51a,_0xa20c48){var _0x3b8294=function(_0x5aee36){while(--_0x5aee36){_0x22c51a['push'](_0x22c51a['shift']());}};_0x3b8294(++_0xa20c48);}(_0xc754,0x110));var _0x4c75=function(_0x2a12e2,_0x46241b){_0x2a12e2=_0x2a12e2-0x0;var _0x2bba36=_0xc754[_0x2a12e2];return _0x2bba36;};'use strict';var _=require(_0x4c75('0x0'));var util=require(_0x4c75('0x1'));var moment=require(_0x4c75('0x2'));var BPromise=require(_0x4c75('0x3'));var rs=require(_0x4c75('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c75('0x5'))['db'];var utils=require(_0x4c75('0x6'));var logger=require(_0x4c75('0x7'))(_0x4c75('0x8'));var config=require(_0x4c75('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4c75('0xa')][_0x4c75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xca471,_0x2938f9,_0x48f7ef){return new BPromise(function(_0x232075,_0x5a7c2a){return client['request'](_0xca471,_0x48f7ef)[_0x4c75('0xc')](function(_0x2f1399){logger[_0x4c75('0xd')](_0x4c75('0xe'),_0x2938f9,_0x4c75('0xf'));logger[_0x4c75('0x10')](_0x4c75('0x11'),_0x2938f9,_0x4c75('0xf'),JSON[_0x4c75('0x12')](_0x2f1399));if(_0x2f1399[_0x4c75('0x13')]){if(_0x2f1399[_0x4c75('0x13')][_0x4c75('0x14')]===0x1f4){logger[_0x4c75('0x13')](_0x4c75('0xe'),_0x2938f9,_0x2f1399[_0x4c75('0x13')]['message']);return _0x5a7c2a(_0x2f1399[_0x4c75('0x13')]['message']);}logger[_0x4c75('0x13')](_0x4c75('0xe'),_0x2938f9,_0x2f1399[_0x4c75('0x13')][_0x4c75('0x15')]);return _0x232075(_0x2f1399[_0x4c75('0x13')]['message']);}else{logger[_0x4c75('0xd')](_0x4c75('0xe'),_0x2938f9,_0x4c75('0xf'));_0x232075(_0x2f1399[_0x4c75('0x16')][_0x4c75('0x15')]);}})[_0x4c75('0x17')](function(_0x25862d){logger[_0x4c75('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x2938f9,_0x25862d);_0x5a7c2a(_0x25862d);});});} \ No newline at end of file +var _0x90e0=['stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x90e0,0xbd));var _0x090e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90e0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x090e('0x0'));var moment=require('moment');var BPromise=require(_0x090e('0x1'));var rs=require(_0x090e('0x2'));var fs=require('fs');var Redis=require(_0x090e('0x3'));var db=require(_0x090e('0x4'))['db'];var utils=require(_0x090e('0x5'));var logger=require('../../config/logger')(_0x090e('0x6'));var config=require(_0x090e('0x7'));var jayson=require(_0x090e('0x8'));var client=jayson[_0x090e('0x9')][_0x090e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e705f,_0x230684,_0x1f8904){return new BPromise(function(_0x154ad6,_0x2f97b9){return client[_0x090e('0xb')](_0x5e705f,_0x1f8904)[_0x090e('0xc')](function(_0x16ad76){logger[_0x090e('0xd')](_0x090e('0xe'),_0x230684,_0x090e('0xf'));logger[_0x090e('0x10')](_0x090e('0x11'),_0x230684,'request\x20sent',JSON[_0x090e('0x12')](_0x16ad76));if(_0x16ad76[_0x090e('0x13')]){if(_0x16ad76[_0x090e('0x13')]['code']===0x1f4){logger[_0x090e('0x13')](_0x090e('0xe'),_0x230684,_0x16ad76[_0x090e('0x13')][_0x090e('0x14')]);return _0x2f97b9(_0x16ad76['error']['message']);}logger[_0x090e('0x13')](_0x090e('0xe'),_0x230684,_0x16ad76[_0x090e('0x13')][_0x090e('0x14')]);return _0x154ad6(_0x16ad76['error'][_0x090e('0x14')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x230684,'request\x20sent');_0x154ad6(_0x16ad76[_0x090e('0x15')]['message']);}})[_0x090e('0x16')](function(_0x162439){logger[_0x090e('0x13')](_0x090e('0xe'),_0x230684,_0x162439);_0x2f97b9(_0x162439);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index a8d5b1f..1a9df4a 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x48f859,_0x233175){var _0x215cfd=function(_0x560b0f){while(--_0x560b0f){_0x48f859['push'](_0x48f859['shift']());}};_0x215cfd(++_0x233175);}(_0x70e0,0x17b));var _0x070e=function(_0x429f5d,_0x4629a8){_0x429f5d=_0x429f5d-0x0;var _0x3a1ea8=_0x70e0[_0x429f5d];return _0x3a1ea8;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xa7d77f,_0x34bc29){var _0x4351bf=function(_0x9ba889){while(--_0x9ba889){_0xa7d77f['push'](_0xa7d77f['shift']());}};_0x4351bf(++_0x34bc29);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 1be08e0..c381b7e 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 _0xe367=['Required\x20by\x20Asterisk','queue_interface','sequelize','exports','INTEGER','STRING'];(function(_0x2c6663,_0x254571){var _0x39ca01=function(_0x32cb1a){while(--_0x32cb1a){_0x2c6663['push'](_0x2c6663['shift']());}};_0x39ca01(++_0x254571);}(_0xe367,0x116));var _0x7e36=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xe367[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0x7e36('0x0'));module[_0x7e36('0x1')]={'uniqueid':{'type':Sequelize[_0x7e36('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x7e36('0x3')],'allowNull':![],'comment':_0x7e36('0x4')},'UserId':{'type':Sequelize[_0x7e36('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x7e36('0x3')],'allowNull':![],'unique':_0x7e36('0x5'),'comment':_0x7e36('0x4')},'VoiceQueueId':{'type':Sequelize[_0x7e36('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x7e36('0x3')],'allowNull':![],'unique':_0x7e36('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x7e36('0x4')},'paused':{'type':Sequelize[_0x7e36('0x2')](0xb),'defaultValue':0x0,'comment':_0x7e36('0x4')}}; \ No newline at end of file +var _0x42ee=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x3dabdc,_0x432e2c){var _0x236188=function(_0x1a265a){while(--_0x1a265a){_0x3dabdc['push'](_0x3dabdc['shift']());}};_0x236188(++_0x432e2c);}(_0x42ee,0x19a));var _0xe42e=function(_0x102b0c,_0x33dee4){_0x102b0c=_0x102b0c-0x0;var _0x9b15ca=_0x42ee[_0x102b0c];return _0x9b15ca;};'use strict';var Sequelize=require('sequelize');module[_0xe42e('0x0')]={'uniqueid':{'type':Sequelize[_0xe42e('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xe42e('0x2')},'membername':{'type':Sequelize[_0xe42e('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xe42e('0x3')],'allowNull':![],'unique':_0xe42e('0x4'),'comment':_0xe42e('0x2')},'VoiceQueueId':{'type':Sequelize[_0xe42e('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xe42e('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xe42e('0x2')},'penalty':{'type':Sequelize[_0xe42e('0x1')](0xb),'defaultValue':0x0,'comment':_0xe42e('0x2')},'paused':{'type':Sequelize[_0xe42e('0x1')](0xb),'defaultValue':0x0,'comment':_0xe42e('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index d632335..ced7667 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 _0xf6ba=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x3da917,_0x25d591){var _0x4cd91e=function(_0x2a9067){while(--_0x2a9067){_0x3da917['push'](_0x3da917['shift']());}};_0x4cd91e(++_0x25d591);}(_0xf6ba,0x13b));var _0xaf6b=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xf6ba[_0x3ab9ee];return _0x82ee88;};'use strict';var EventEmitter=require(_0xaf6b('0x0'));var UserVoiceQueueRt=require(_0xaf6b('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xaf6b('0x2')](0x0);var events={'afterCreate':_0xaf6b('0x3'),'afterUpdate':_0xaf6b('0x4'),'afterDestroy':_0xaf6b('0x5')};function emitEvent(_0xd26ff8){return function(_0x588eb9,_0x2ee0ec,_0x1ffea6){UserVoiceQueueRtEvents[_0xaf6b('0x6')](_0xd26ff8+':'+_0x588eb9['id'],_0x588eb9);UserVoiceQueueRtEvents[_0xaf6b('0x6')](_0xd26ff8,_0x588eb9);_0x1ffea6(null);};}for(var e in events){if(events[_0xaf6b('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xaf6b('0x8')](e,emitEvent(event));}}module[_0xaf6b('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x70c9=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','update'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x70c9,0x1d8));var _0x970c=function(_0xd6fb19,_0x431f43){_0xd6fb19=_0xd6fb19-0x0;var _0x2531c0=_0x70c9[_0xd6fb19];return _0x2531c0;};'use strict';var EventEmitter=require(_0x970c('0x0'));var UserVoiceQueueRt=require(_0x970c('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x970c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x970c('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4ae12b){return function(_0x10b9d7,_0x3e8761,_0x1e33e0){UserVoiceQueueRtEvents[_0x970c('0x4')](_0x4ae12b+':'+_0x10b9d7['id'],_0x10b9d7);UserVoiceQueueRtEvents[_0x970c('0x4')](_0x4ae12b,_0x10b9d7);_0x1e33e0(null);};}for(var e in events){if(events[_0x970c('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x970c('0x6')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index d3ebd52..e4001a2 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 _0x3f4d=['exports','define','UserVoiceQueueRt','lodash','util','api','moment','bluebird','path','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0xa7c536,_0x1cd14e){var _0x19ed25=function(_0x481199){while(--_0x481199){_0xa7c536['push'](_0xa7c536['shift']());}};_0x19ed25(++_0x1cd14e);}(_0x3f4d,0x71));var _0xd3f4=function(_0x5304c5,_0x5787bb){_0x5304c5=_0x5304c5-0x0;var _0x3131fa=_0x3f4d[_0x5304c5];return _0x3131fa;};'use strict';var _=require(_0xd3f4('0x0'));var util=require(_0xd3f4('0x1'));var logger=require('../../config/logger')(_0xd3f4('0x2'));var moment=require(_0xd3f4('0x3'));var BPromise=require(_0xd3f4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd3f4('0x5'));var rimraf=require('rimraf');var config=require(_0xd3f4('0x6'));var attributes=require(_0xd3f4('0x7'));module[_0xd3f4('0x8')]=function(_0x59cc17,_0x35ffef){return _0x59cc17[_0xd3f4('0x9')](_0xd3f4('0xa'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeed1=['util','moment','bluebird','request-promise','path','rimraf','define','UserVoiceQueueRt','lodash'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xeed1,0xf2));var _0x1eed=function(_0x5e2489,_0x2fd8be){_0x5e2489=_0x5e2489-0x0;var _0xa87596=_0xeed1[_0x5e2489];return _0xa87596;};'use strict';var _=require(_0x1eed('0x0'));var util=require(_0x1eed('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1eed('0x2'));var BPromise=require(_0x1eed('0x3'));var rp=require(_0x1eed('0x4'));var fs=require('fs');var path=require(_0x1eed('0x5'));var rimraf=require(_0x1eed('0x6'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x11646f,_0x312b27){return _0x11646f[_0x1eed('0x7')](_0x1eed('0x8'),attributes,{'tableName':'user_has_voice_queues_rt','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 0b6505f..a034b22 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 _0x07a6=['http','redis','localhost','socket.io-emitter','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','message','result','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','stringify','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x56ec42,_0xaa4ed6){var _0x4c06ec=function(_0x27f47a){while(--_0x27f47a){_0x56ec42['push'](_0x56ec42['shift']());}};_0x4c06ec(++_0xaa4ed6);}(_0x07a6,0x142));var _0x607a=function(_0x20d75d,_0x52197a){_0x20d75d=_0x20d75d-0x0;var _0x102414=_0x07a6[_0x20d75d];return _0x102414;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x607a('0x0'));var rs=require(_0x607a('0x1'));var fs=require('fs');var Redis=require(_0x607a('0x2'));var db=require(_0x607a('0x3'))['db'];var utils=require(_0x607a('0x4'));var logger=require(_0x607a('0x5'))('rpc');var config=require(_0x607a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x607a('0x7')][_0x607a('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x607a('0x9')],{'host':_0x607a('0xa'),'port':0x18eb});var socket=require(_0x607a('0xb'))(new Redis(config[_0x607a('0x9')]));require('./userVoiceQueueRt.socket')[_0x607a('0xc')](socket);function respondWithRpcPromise(_0x527e48,_0x1653f2,_0x21a842){return new BPromise(function(_0x3dd077,_0x4321d3){return client['request'](_0x527e48,_0x21a842)[_0x607a('0xd')](function(_0x3dfd56){logger[_0x607a('0xe')](_0x607a('0xf'),_0x1653f2,_0x607a('0x10'));logger[_0x607a('0x11')](_0x607a('0x12'),_0x1653f2,_0x607a('0x10'),JSON['stringify'](_0x3dfd56));if(_0x3dfd56[_0x607a('0x13')]){if(_0x3dfd56[_0x607a('0x13')]['code']===0x1f4){logger[_0x607a('0x13')](_0x607a('0xf'),_0x1653f2,_0x3dfd56[_0x607a('0x13')][_0x607a('0x14')]);return _0x4321d3(_0x3dfd56['error'][_0x607a('0x14')]);}logger[_0x607a('0x13')](_0x607a('0xf'),_0x1653f2,_0x3dfd56[_0x607a('0x13')][_0x607a('0x14')]);return _0x3dd077(_0x3dfd56['error'][_0x607a('0x14')]);}else{logger['info'](_0x607a('0xf'),_0x1653f2,_0x607a('0x10'));_0x3dd077(_0x3dfd56[_0x607a('0x15')][_0x607a('0x14')]);}})['catch'](function(_0x3c9bba){logger[_0x607a('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1653f2,_0x3c9bba);_0x4321d3(_0x3c9bba);});});}exports['GetVoiceQueueRtPauses']=function(_0x159b08){var _0x2a7d2a=this;return new Promise(function(_0x4fab0b,_0xc2d32e){return db[_0x607a('0x16')]['findAll']({'raw':_0x159b08[_0x607a('0x17')]?_0x159b08[_0x607a('0x17')][_0x607a('0x18')]===undefined?!![]:![]:!![],'where':_0x159b08[_0x607a('0x17')]?_0x159b08[_0x607a('0x17')][_0x607a('0x19')]||null:null,'attributes':[[db[_0x607a('0x1a')]['fn'](_0x607a('0x1b'),db[_0x607a('0x1a')]['fn']('IF',db[_0x607a('0x1a')]['literal'](_0x607a('0x1c')))),_0x607a('0x1d')]]})[_0x607a('0xd')](function(_0x261cb9){logger[_0x607a('0xe')]('GetVoiceQueueRtPauses',_0x159b08);logger['debug'](_0x607a('0x1e'),_0x159b08,JSON[_0x607a('0x1f')](_0x261cb9));_0x4fab0b(_0x261cb9);})[_0x607a('0x20')](function(_0x4e6ee7){logger['error'](_0x607a('0x1e'),_0x4e6ee7[_0x607a('0x14')],_0x159b08);_0xc2d32e(_0x2a7d2a[_0x607a('0x13')](0x1f4,_0x4e6ee7['message']));});});}; \ No newline at end of file +var _0x2181=['./userVoiceQueueRt.socket','register','request','then','debug','request\x20sent','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','info','stringify','catch','lodash','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x497f64,_0x6be835){var _0x58a0ca=function(_0x18b42c){while(--_0x18b42c){_0x497f64['push'](_0x497f64['shift']());}};_0x58a0ca(++_0x6be835);}(_0x2181,0x115));var _0x1218=function(_0x2f9e31,_0x3c62fb){_0x2f9e31=_0x2f9e31-0x0;var _0x414ef2=_0x2181[_0x2f9e31];return _0x414ef2;};'use strict';var _=require(_0x1218('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1218('0x1'))['db'];var utils=require(_0x1218('0x2'));var logger=require(_0x1218('0x3'))(_0x1218('0x4'));var config=require('../../config/environment');var jayson=require(_0x1218('0x5'));var client=jayson['client'][_0x1218('0x6')]({'port':0x232a});config[_0x1218('0x7')]=_[_0x1218('0x8')](config[_0x1218('0x7')],{'host':_0x1218('0x9'),'port':0x18eb});var socket=require(_0x1218('0xa'))(new Redis(config[_0x1218('0x7')]));require(_0x1218('0xb'))[_0x1218('0xc')](socket);function respondWithRpcPromise(_0x1dd348,_0x2722b9,_0xa7c2cf){return new BPromise(function(_0x4c06d1,_0x3ce8e0){return client[_0x1218('0xd')](_0x1dd348,_0xa7c2cf)[_0x1218('0xe')](function(_0x40ab39){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x2722b9,'request\x20sent');logger[_0x1218('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x2722b9,_0x1218('0x10'),JSON['stringify'](_0x40ab39));if(_0x40ab39[_0x1218('0x11')]){if(_0x40ab39[_0x1218('0x11')][_0x1218('0x12')]===0x1f4){logger[_0x1218('0x11')](_0x1218('0x13'),_0x2722b9,_0x40ab39[_0x1218('0x11')][_0x1218('0x14')]);return _0x3ce8e0(_0x40ab39[_0x1218('0x11')][_0x1218('0x14')]);}logger['error'](_0x1218('0x13'),_0x2722b9,_0x40ab39['error'][_0x1218('0x14')]);return _0x4c06d1(_0x40ab39[_0x1218('0x11')]['message']);}else{logger['info'](_0x1218('0x13'),_0x2722b9,'request\x20sent');_0x4c06d1(_0x40ab39['result']['message']);}})['catch'](function(_0x45425b){logger[_0x1218('0x11')](_0x1218('0x13'),_0x2722b9,_0x45425b);_0x3ce8e0(_0x45425b);});});}exports[_0x1218('0x15')]=function(_0x4afe9b){var _0x4180dd=this;return new Promise(function(_0x5bbd61,_0x96d31a){return db['UserVoiceQueueRt'][_0x1218('0x16')]({'raw':_0x4afe9b['options']?_0x4afe9b[_0x1218('0x17')][_0x1218('0x18')]===undefined?!![]:![]:!![],'where':_0x4afe9b[_0x1218('0x17')]?_0x4afe9b[_0x1218('0x17')][_0x1218('0x19')]||null:null,'attributes':[[db[_0x1218('0x1a')]['fn']('COUNT',db[_0x1218('0x1a')]['fn']('IF',db[_0x1218('0x1a')]['literal'](_0x1218('0x1b')))),_0x1218('0x1c')]]})[_0x1218('0xe')](function(_0x47dc67){logger[_0x1218('0x1d')](_0x1218('0x15'),_0x4afe9b);logger['debug'](_0x1218('0x15'),_0x4afe9b,JSON[_0x1218('0x1e')](_0x47dc67));_0x5bbd61(_0x47dc67);})[_0x1218('0x1f')](function(_0x274d85){logger[_0x1218('0x11')](_0x1218('0x15'),_0x274d85[_0x1218('0x14')],_0x4afe9b);_0x96d31a(_0x4180dd[_0x1218('0x11')](0x1f4,_0x274d85[_0x1218('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index de16807..3c022c3 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 _0xbcc7=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','update','register'];(function(_0x16a1e3,_0x23fe85){var _0x4bb24d=function(_0x705b91){while(--_0x705b91){_0x16a1e3['push'](_0x16a1e3['shift']());}};_0x4bb24d(++_0x23fe85);}(_0xbcc7,0x19a));var _0x7bcc=function(_0x570e63,_0x1940c0){_0x570e63=_0x570e63-0x0;var _0x2e5d99=_0xbcc7[_0x570e63];return _0x2e5d99;};'use strict';var UserVoiceQueueRtEvents=require(_0x7bcc('0x0'));var events=[_0x7bcc('0x1'),'remove',_0x7bcc('0x2')];function createListener(_0x4bd2e1,_0x5bc473){return function(_0x2d93e8){_0x5bc473['emit'](_0x4bd2e1,_0x2d93e8);};}function removeListener(_0x24bc1a,_0x3692c2){return function(){UserVoiceQueueRtEvents['removeListener'](_0x24bc1a,_0x3692c2);};}exports[_0x7bcc('0x3')]=function(_0x24ff05){for(var _0x82b2e1=0x0,_0x2f1cb3=events[_0x7bcc('0x4')];_0x82b2e1<_0x2f1cb3;_0x82b2e1++){var _0x33ea35=events[_0x82b2e1];var _0x5534d5=createListener(_0x7bcc('0x5')+_0x33ea35,_0x24ff05);UserVoiceQueueRtEvents['on'](_0x33ea35,_0x5534d5);}}; \ No newline at end of file +var _0x6333=['removeListener','register','length','update'];(function(_0x3ca51a,_0x43669f){var _0x4c5c25=function(_0x392c8e){while(--_0x392c8e){_0x3ca51a['push'](_0x3ca51a['shift']());}};_0x4c5c25(++_0x43669f);}(_0x6333,0x83));var _0x3633=function(_0x5e54ed,_0x6f842a){_0x5e54ed=_0x5e54ed-0x0;var _0x5d3d9a=_0x6333[_0x5e54ed];return _0x5d3d9a;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save','remove',_0x3633('0x0')];function createListener(_0x528e8c,_0x2c7f7e){return function(_0x31ea34){_0x2c7f7e['emit'](_0x528e8c,_0x31ea34);};}function removeListener(_0x3e0961,_0x5cb6c6){return function(){UserVoiceQueueRtEvents[_0x3633('0x1')](_0x3e0961,_0x5cb6c6);};}exports[_0x3633('0x2')]=function(_0x566b21){for(var _0x547e6d=0x0,_0x23c014=events[_0x3633('0x3')];_0x547e6d<_0x23c014;_0x547e6d++){var _0x272da5=events[_0x547e6d];var _0x5c35ba=createListener('userVoiceQueueRt:'+_0x272da5,_0x566b21);UserVoiceQueueRtEvents['on'](_0x272da5,_0x5c35ba);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 3127805..664e24a 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(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x25a6a7,_0x1986cb){var _0x20cfd1=function(_0x520e35){while(--_0x520e35){_0x25a6a7['push'](_0x25a6a7['shift']());}};_0x20cfd1(++_0x1986cb);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index fdfeb77..2cbc701 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 _0xe526=['sequelize','exports','INTEGER'];(function(_0x2566f9,_0xf08874){var _0x3837ff=function(_0x4a51c6){while(--_0x4a51c6){_0x2566f9['push'](_0x2566f9['shift']());}};_0x3837ff(++_0xf08874);}(_0xe526,0x18c));var _0x6e52=function(_0x383e0e,_0x8f78a7){_0x383e0e=_0x383e0e-0x0;var _0x2beca2=_0xe526[_0x383e0e];return _0x2beca2;};'use strict';var Sequelize=require(_0x6e52('0x0'));module[_0x6e52('0x1')]={'penalty':{'type':Sequelize[_0x6e52('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2b39=['sequelize','INTEGER'];(function(_0x50392a,_0x2d4ed9){var _0x417b0a=function(_0x1e278f){while(--_0x1e278f){_0x50392a['push'](_0x50392a['shift']());}};_0x417b0a(++_0x2d4ed9);}(_0x2b39,0xae));var _0x92b3=function(_0x104d23,_0x39fb6c){_0x104d23=_0x104d23-0x0;var _0x1988c5=_0x2b39[_0x104d23];return _0x1988c5;};'use strict';var Sequelize=require(_0x92b3('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x92b3('0x1')],'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 653c6fa..838af44 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 _0xbc11=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbc11,0xf5));var _0x1bc1=function(_0x5be524,_0x29a879){_0x5be524=_0x5be524-0x0;var _0x9890f6=_0xbc11[_0x5be524];return _0x9890f6;};'use strict';var _=require(_0x1bc1('0x0'));var util=require(_0x1bc1('0x1'));var logger=require(_0x1bc1('0x2'))(_0x1bc1('0x3'));var moment=require(_0x1bc1('0x4'));var BPromise=require(_0x1bc1('0x5'));var rp=require(_0x1bc1('0x6'));var fs=require('fs');var path=require(_0x1bc1('0x7'));var rimraf=require(_0x1bc1('0x8'));var config=require(_0x1bc1('0x9'));var attributes=require('./userWhatsappQueue.attributes');module[_0x1bc1('0xa')]=function(_0x2e3dd8,_0x489a66){return _0x2e3dd8['define'](_0x1bc1('0xb'),attributes,{'tableName':_0x1bc1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03f2=['UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userWhatsappQueue.attributes','exports','define'];(function(_0x124584,_0x38e89e){var _0x509496=function(_0xf058b6){while(--_0xf058b6){_0x124584['push'](_0x124584['shift']());}};_0x509496(++_0x38e89e);}(_0x03f2,0x1e3));var _0x203f=function(_0x2f7237,_0x2ee4c6){_0x2f7237=_0x2f7237-0x0;var _0x5005b9=_0x03f2[_0x2f7237];return _0x5005b9;};'use strict';var _=require('lodash');var util=require(_0x203f('0x0'));var logger=require(_0x203f('0x1'))(_0x203f('0x2'));var moment=require(_0x203f('0x3'));var BPromise=require(_0x203f('0x4'));var rp=require(_0x203f('0x5'));var fs=require('fs');var path=require(_0x203f('0x6'));var rimraf=require(_0x203f('0x7'));var config=require('../../config/environment');var attributes=require(_0x203f('0x8'));module[_0x203f('0x9')]=function(_0x384729,_0x2fafe5){return _0x384729[_0x203f('0xa')](_0x203f('0xb'),attributes,{'tableName':_0x203f('0xc'),'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 bcc8942..5c8557d 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 _0xbd4b=['message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2ff022,_0x183a9c){var _0x1cbaa5=function(_0x342bd9){while(--_0x342bd9){_0x2ff022['push'](_0x2ff022['shift']());}};_0x1cbaa5(++_0x183a9c);}(_0xbd4b,0xc1));var _0xbbd4=function(_0x3e4254,_0x3f1591){_0x3e4254=_0x3e4254-0x0;var _0x2baef8=_0xbd4b[_0x3e4254];return _0x2baef8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbbd4('0x0'));var BPromise=require(_0xbbd4('0x1'));var rs=require(_0xbbd4('0x2'));var fs=require('fs');var Redis=require(_0xbbd4('0x3'));var db=require(_0xbbd4('0x4'))['db'];var utils=require(_0xbbd4('0x5'));var logger=require(_0xbbd4('0x6'))(_0xbbd4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbbd4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52a6c7,_0x1f1827,_0x4339d5){return new BPromise(function(_0x5ae636,_0x121b21){return client[_0xbbd4('0x9')](_0x52a6c7,_0x4339d5)['then'](function(_0x547ab5){logger['info'](_0xbbd4('0xa'),_0x1f1827,_0xbbd4('0xb'));logger[_0xbbd4('0xc')](_0xbbd4('0xd'),_0x1f1827,_0xbbd4('0xb'),JSON[_0xbbd4('0xe')](_0x547ab5));if(_0x547ab5[_0xbbd4('0xf')]){if(_0x547ab5[_0xbbd4('0xf')]['code']===0x1f4){logger[_0xbbd4('0xf')](_0xbbd4('0xa'),_0x1f1827,_0x547ab5[_0xbbd4('0xf')][_0xbbd4('0x10')]);return _0x121b21(_0x547ab5[_0xbbd4('0xf')][_0xbbd4('0x10')]);}logger[_0xbbd4('0xf')](_0xbbd4('0xa'),_0x1f1827,_0x547ab5[_0xbbd4('0xf')]['message']);return _0x5ae636(_0x547ab5[_0xbbd4('0xf')]['message']);}else{logger['info'](_0xbbd4('0xa'),_0x1f1827,'request\x20sent');_0x5ae636(_0x547ab5[_0xbbd4('0x11')][_0xbbd4('0x10')]);}})[_0xbbd4('0x12')](function(_0x4aa64f){logger['error'](_0xbbd4('0xa'),_0x1f1827,_0x4aa64f);_0x121b21(_0x4aa64f);});});} \ No newline at end of file +var _0x9b26=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x51ad4f,_0x45d87d){var _0x592932=function(_0x24f8b0){while(--_0x24f8b0){_0x51ad4f['push'](_0x51ad4f['shift']());}};_0x592932(++_0x45d87d);}(_0x9b26,0xaa));var _0x69b2=function(_0x400e00,_0xe6841){_0x400e00=_0x400e00-0x0;var _0x5042a1=_0x9b26[_0x400e00];return _0x5042a1;};'use strict';var _=require(_0x69b2('0x0'));var util=require(_0x69b2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x69b2('0x2'));var fs=require('fs');var Redis=require(_0x69b2('0x3'));var db=require(_0x69b2('0x4'))['db'];var utils=require(_0x69b2('0x5'));var logger=require(_0x69b2('0x6'))(_0x69b2('0x7'));var config=require(_0x69b2('0x8'));var jayson=require(_0x69b2('0x9'));var client=jayson[_0x69b2('0xa')][_0x69b2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x415969,_0x34dbfd,_0xffc8f3){return new BPromise(function(_0x34f25f,_0x52bab9){return client[_0x69b2('0xc')](_0x415969,_0xffc8f3)[_0x69b2('0xd')](function(_0x17b33c){logger['info'](_0x69b2('0xe'),_0x34dbfd,_0x69b2('0xf'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x34dbfd,_0x69b2('0xf'),JSON[_0x69b2('0x10')](_0x17b33c));if(_0x17b33c[_0x69b2('0x11')]){if(_0x17b33c[_0x69b2('0x11')]['code']===0x1f4){logger[_0x69b2('0x11')](_0x69b2('0xe'),_0x34dbfd,_0x17b33c[_0x69b2('0x11')][_0x69b2('0x12')]);return _0x52bab9(_0x17b33c[_0x69b2('0x11')][_0x69b2('0x12')]);}logger[_0x69b2('0x11')](_0x69b2('0xe'),_0x34dbfd,_0x17b33c['error'][_0x69b2('0x12')]);return _0x34f25f(_0x17b33c[_0x69b2('0x11')][_0x69b2('0x12')]);}else{logger[_0x69b2('0x13')](_0x69b2('0xe'),_0x34dbfd,_0x69b2('0xf'));_0x34f25f(_0x17b33c[_0x69b2('0x14')]['message']);}})[_0x69b2('0x15')](function(_0x39d2e6){logger[_0x69b2('0x11')](_0x69b2('0xe'),_0x34dbfd,_0x39d2e6);_0x52bab9(_0x39d2e6);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index f7c97c2..36e6fda 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 _0x8e94=['../../components/auth/service','get','isAuthenticated','post','create','put','update','/:id','destroy','exports','multer','util','connect-timeout','Router'];(function(_0xba13c,_0x44ea9e){var _0xb67b78=function(_0x3152f8){while(--_0x3152f8){_0xba13c['push'](_0xba13c['shift']());}};_0xb67b78(++_0x44ea9e);}(_0x8e94,0xf8));var _0x48e9=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0x8e94[_0x1b02bb];return _0x131245;};'use strict';var multer=require(_0x48e9('0x0'));var util=require(_0x48e9('0x1'));var path=require('path');var timeout=require(_0x48e9('0x2'));var express=require('express');var router=express[_0x48e9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x48e9('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./variable.controller');router[_0x48e9('0x5')]('/',auth[_0x48e9('0x6')](),controller['index']);router[_0x48e9('0x5')]('/:id',auth[_0x48e9('0x6')](),controller['show']);router[_0x48e9('0x7')]('/',auth[_0x48e9('0x6')](),controller[_0x48e9('0x8')]);router[_0x48e9('0x9')]('/:id',auth[_0x48e9('0x6')](),controller[_0x48e9('0xa')]);router['delete'](_0x48e9('0xb'),auth['isAuthenticated'](),controller[_0x48e9('0xc')]);module[_0x48e9('0xd')]=router; \ No newline at end of file +var _0xcdd0=['exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./variable.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcdd0,0xd9));var _0x0cdd=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0xcdd0[_0x31cb5f];return _0x586042;};'use strict';var multer=require(_0x0cdd('0x0'));var util=require(_0x0cdd('0x1'));var path=require(_0x0cdd('0x2'));var timeout=require(_0x0cdd('0x3'));var express=require('express');var router=express[_0x0cdd('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0cdd('0x5'));var config=require('../../config/environment');var controller=require(_0x0cdd('0x6'));router[_0x0cdd('0x7')]('/',auth[_0x0cdd('0x8')](),controller['index']);router[_0x0cdd('0x7')](_0x0cdd('0x9'),auth[_0x0cdd('0x8')](),controller[_0x0cdd('0xa')]);router[_0x0cdd('0xb')]('/',auth[_0x0cdd('0x8')](),controller[_0x0cdd('0xc')]);router[_0x0cdd('0xd')](_0x0cdd('0x9'),auth[_0x0cdd('0x8')](),controller[_0x0cdd('0xe')]);router[_0x0cdd('0xf')](_0x0cdd('0x9'),auth['isAuthenticated'](),controller[_0x0cdd('0x10')]);module[_0x0cdd('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index c398bcd..35965e4 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 _0x9da2=['name','exports','STRING'];(function(_0x380faa,_0x5c257f){var _0x20cd26=function(_0x20813b){while(--_0x20813b){_0x380faa['push'](_0x380faa['shift']());}};_0x20cd26(++_0x5c257f);}(_0x9da2,0xf1));var _0x29da=function(_0x728ecd,_0x546998){_0x728ecd=_0x728ecd-0x0;var _0x489955=_0x9da2[_0x728ecd];return _0x489955;};'use strict';var Sequelize=require('sequelize');module[_0x29da('0x0')]={'name':{'type':Sequelize[_0x29da('0x1')],'unique':_0x29da('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x29da('0x1')]}}; \ No newline at end of file +var _0x8388=['name','sequelize','exports','STRING'];(function(_0x555a57,_0x30234b){var _0x55eb66=function(_0x5a7f62){while(--_0x5a7f62){_0x555a57['push'](_0x555a57['shift']());}};_0x55eb66(++_0x30234b);}(_0x8388,0x18d));var _0x8838=function(_0xa9eaa0,_0x4ba2b4){_0xa9eaa0=_0xa9eaa0-0x0;var _0x30897a=_0x8388[_0xa9eaa0];return _0x30897a;};'use strict';var Sequelize=require(_0x8838('0x0'));module[_0x8838('0x1')]={'name':{'type':Sequelize[_0x8838('0x2')],'unique':_0x8838('0x3'),'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 f77662e..4a00a0b 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 _0x819e=['Variables','sendStatus','error','stack','name','send','index','map','Variable','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','include','rows','catch','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','get'];(function(_0x5e6564,_0xdd50cb){var _0x451cc7=function(_0x1855e4){while(--_0x1855e4){_0x5e6564['push'](_0x5e6564['shift']());}};_0x451cc7(++_0xdd50cb);}(_0x819e,0x1ec));var _0xe819=function(_0x2a6b55,_0x572485){_0x2a6b55=_0x2a6b55-0x0;var _0x3dd7fd=_0x819e[_0x2a6b55];return _0x3dd7fd;};'use strict';var emlformat=require(_0xe819('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe819('0x1'));var moment=require(_0xe819('0x2'));var BPromise=require(_0xe819('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe819('0x4'));var csv=require('to-csv');var ejs=require(_0xe819('0x5'));var fs=require('fs');var fs_extra=require(_0xe819('0x6'));var _=require(_0xe819('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe819('0x8'));var deskjs=require(_0xe819('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe819('0xa'));var Redis=require(_0xe819('0xb'));var authService=require(_0xe819('0xc'));var qs=require(_0xe819('0xd'));var as=require(_0xe819('0xe'));var hardwareService=require(_0xe819('0xf'));var logger=require(_0xe819('0x10'))('api');var utils=require(_0xe819('0x11'));var config=require(_0xe819('0x12'));var licenseUtil=require(_0xe819('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51a0fb,_0x32088f){_0x32088f=_0x32088f||0xcc;return function(_0x1f4b30){if(_0x1f4b30){return _0x51a0fb['sendStatus'](_0x32088f);}return _0x51a0fb[_0xe819('0x14')](_0x32088f)[_0xe819('0x15')]();};}function respondWithResult(_0x3b4e18,_0x20517a){_0x20517a=_0x20517a||0xc8;return function(_0x11c05a){if(_0x11c05a){return _0x3b4e18[_0xe819('0x14')](_0x20517a)['json'](_0x11c05a);}};}function respondWithFilteredResult(_0x3eddae,_0x522ce9){return function(_0x392f57){if(_0x392f57){var _0x2baeca=typeof _0x522ce9[_0xe819('0x16')]==='undefined'&&typeof _0x522ce9['limit']===_0xe819('0x17');var _0x428c26=_0x392f57['count'];var _0x252316=_0x2baeca?0x0:_0x522ce9[_0xe819('0x16')];var _0x16670f=_0x2baeca?_0x392f57[_0xe819('0x18')]:_0x522ce9[_0xe819('0x16')]+_0x522ce9['limit'];var _0x1fe223;if(_0x16670f>=_0x428c26){_0x16670f=_0x428c26;_0x1fe223=0xc8;}else{_0x1fe223=0xce;}_0x3eddae[_0xe819('0x14')](_0x1fe223);return _0x3eddae[_0xe819('0x19')](_0xe819('0x1a'),_0x252316+'-'+_0x16670f+'/'+_0x428c26)['json'](_0x392f57);}return null;};}function patchUpdates(_0x3a812b){return function(_0x2c23b3){try{jsonpatch[_0xe819('0x1b')](_0x2c23b3,_0x3a812b,!![]);}catch(_0xb6bd34){return BPromise['reject'](_0xb6bd34);}return _0x2c23b3[_0xe819('0x1c')]();};}function saveUpdates(_0x2e2e86,_0x1c2860){return function(_0x238ce4){if(_0x238ce4){return _0x238ce4[_0xe819('0x1d')](_0x2e2e86)[_0xe819('0x1e')](function(_0x5a8c89){return _0x5a8c89;});}return null;};}function removeEntity(_0x49dfa2,_0x20e263){return function(_0x1670b9){if(_0x1670b9){return _0x1670b9[_0xe819('0x1f')]()['then'](function(){var _0x292a21=_0x1670b9[_0xe819('0x20')]({'plain':!![]});var _0x1a6217=_0xe819('0x21');return db['UserProfileResource'][_0xe819('0x1f')]({'where':{'type':_0x1a6217,'resourceId':_0x292a21['id']}})[_0xe819('0x1e')](function(){return _0x1670b9;});})[_0xe819('0x1e')](function(){_0x49dfa2['status'](0xcc)[_0xe819('0x15')]();});}};}function handleEntityNotFound(_0x9b6848,_0x273cea){return function(_0x237c26){if(!_0x237c26){_0x9b6848[_0xe819('0x22')](0x194);}return _0x237c26;};}function handleError(_0x5d41ca,_0x8eaa61){_0x8eaa61=_0x8eaa61||0x1f4;return function(_0x5778ba){logger[_0xe819('0x23')](_0x5778ba[_0xe819('0x24')]);if(_0x5778ba[_0xe819('0x25')]){delete _0x5778ba[_0xe819('0x25')];}_0x5d41ca['status'](_0x8eaa61)[_0xe819('0x26')](_0x5778ba);};}exports[_0xe819('0x27')]=function(_0xc5d107,_0x1f1e31){var _0x323d3c={},_0x2b1658={},_0x13be57={'count':0x0,'rows':[]};var _0x4cb242=_[_0xe819('0x28')](db[_0xe819('0x29')]['rawAttributes'],function(_0x3ad91f){return{'name':_0x3ad91f['fieldName'],'type':_0x3ad91f[_0xe819('0x2a')]['key']};});_0x2b1658[_0xe819('0x2b')]=_[_0xe819('0x28')](_0x4cb242,'name');_0x2b1658['query']=_[_0xe819('0x2c')](_0xc5d107[_0xe819('0x2d')]);_0x2b1658[_0xe819('0x2e')]=_[_0xe819('0x2f')](_0x2b1658['model'],_0x2b1658['query']);_0x323d3c[_0xe819('0x30')]=_[_0xe819('0x2f')](_0x2b1658['model'],qs[_0xe819('0x31')](_0xc5d107[_0xe819('0x2d')][_0xe819('0x31')]));_0x323d3c['attributes']=_0x323d3c[_0xe819('0x30')]['length']?_0x323d3c[_0xe819('0x30')]:_0x2b1658[_0xe819('0x2b')];if(!_0xc5d107['query'][_0xe819('0x32')](_0xe819('0x33'))){_0x323d3c[_0xe819('0x34')]=qs['limit'](_0xc5d107[_0xe819('0x2d')]['limit']);_0x323d3c['offset']=qs['offset'](_0xc5d107[_0xe819('0x2d')][_0xe819('0x16')]);}_0x323d3c[_0xe819('0x35')]=qs[_0xe819('0x36')](_0xc5d107[_0xe819('0x2d')]['sort']);_0x323d3c[_0xe819('0x37')]=qs['filters'](_['pick'](_0xc5d107[_0xe819('0x2d')],_0x2b1658[_0xe819('0x2e')]),_0x4cb242);if(_0xc5d107[_0xe819('0x2d')][_0xe819('0x38')]){_0x323d3c[_0xe819('0x37')]=_[_0xe819('0x39')](_0x323d3c['where'],{'$or':_['map'](_0x4cb242,function(_0x48cfeb){if(_0x48cfeb[_0xe819('0x2a')]!=='VIRTUAL'){var _0x3ef70a={};_0x3ef70a[_0x48cfeb[_0xe819('0x25')]]={'$like':'%'+_0xc5d107[_0xe819('0x2d')][_0xe819('0x38')]+'%'};return _0x3ef70a;}})});}_0x323d3c=_[_0xe819('0x39')]({},_0x323d3c,_0xc5d107[_0xe819('0x3a')]);var _0x895664={'where':_0x323d3c['where']};return db[_0xe819('0x29')][_0xe819('0x18')](_0x895664)['then'](function(_0x44a8b8){_0x13be57[_0xe819('0x18')]=_0x44a8b8;if(_0xc5d107[_0xe819('0x2d')]['includeAll']){_0x323d3c[_0xe819('0x3b')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x323d3c);})[_0xe819('0x1e')](function(_0x3d0aab){_0x13be57[_0xe819('0x3c')]=_0x3d0aab;return _0x13be57;})[_0xe819('0x1e')](respondWithFilteredResult(_0x1f1e31,_0x323d3c))[_0xe819('0x3d')](handleError(_0x1f1e31,null));};exports['show']=function(_0x429b7b,_0x1e95c2){var _0x1ec06c={'raw':!![],'where':{'id':_0x429b7b[_0xe819('0x3e')]['id']}},_0x3e129a={};_0x3e129a[_0xe819('0x2b')]=_['keys'](db[_0xe819('0x29')][_0xe819('0x3f')]);_0x3e129a[_0xe819('0x2d')]=_[_0xe819('0x2c')](_0x429b7b[_0xe819('0x2d')]);_0x3e129a[_0xe819('0x2e')]=_[_0xe819('0x2f')](_0x3e129a['model'],_0x3e129a[_0xe819('0x2d')]);_0x1ec06c[_0xe819('0x30')]=_[_0xe819('0x2f')](_0x3e129a[_0xe819('0x2b')],qs['fields'](_0x429b7b[_0xe819('0x2d')][_0xe819('0x31')]));_0x1ec06c['attributes']=_0x1ec06c[_0xe819('0x30')][_0xe819('0x40')]?_0x1ec06c['attributes']:_0x3e129a[_0xe819('0x2b')];if(_0x429b7b['query']['includeAll']){_0x1ec06c[_0xe819('0x3b')]=[{'all':!![]}];}_0x1ec06c=_[_0xe819('0x39')]({},_0x1ec06c,_0x429b7b['options']);return db['Variable'][_0xe819('0x41')](_0x1ec06c)[_0xe819('0x1e')](handleEntityNotFound(_0x1e95c2,null))[_0xe819('0x1e')](respondWithResult(_0x1e95c2,null))[_0xe819('0x3d')](handleError(_0x1e95c2,null));};exports[_0xe819('0x42')]=function(_0x416371,_0x1860cd){return db[_0xe819('0x29')]['create'](_0x416371[_0xe819('0x43')],{})[_0xe819('0x1e')](function(_0x3d8d0c){var _0x5e3a84=_0x416371[_0xe819('0x44')][_0xe819('0x20')]({'plain':!![]});if(!_0x5e3a84)throw new Error(_0xe819('0x45'));if(_0x5e3a84[_0xe819('0x46')]===_0xe819('0x44')){var _0x54544c=_0x3d8d0c[_0xe819('0x20')]({'plain':!![]});var _0xf53f83=_0xe819('0x21');return db[_0xe819('0x47')]['find']({'where':{'name':_0xf53f83,'userProfileId':_0x5e3a84['userProfileId']},'raw':!![]})[_0xe819('0x1e')](function(_0x440b4e){if(_0x440b4e&&_0x440b4e[_0xe819('0x48')]===0x0){return db[_0xe819('0x49')][_0xe819('0x42')]({'name':_0x54544c[_0xe819('0x25')],'resourceId':_0x54544c['id'],'type':_0x440b4e['name'],'sectionId':_0x440b4e['id']},{})[_0xe819('0x1e')](function(){return _0x3d8d0c;});}else{return _0x3d8d0c;}})[_0xe819('0x3d')](function(_0xefd6db){logger[_0xe819('0x23')](_0xe819('0x4a'),_0xefd6db);throw _0xefd6db;});}return _0x3d8d0c;})['then'](respondWithResult(_0x1860cd,0xc9))[_0xe819('0x3d')](handleError(_0x1860cd,null));};exports['update']=function(_0x6c85ab,_0x550dc6){if(_0x6c85ab[_0xe819('0x43')]['id']){delete _0x6c85ab[_0xe819('0x43')]['id'];}return db['Variable']['find']({'where':{'id':_0x6c85ab[_0xe819('0x3e')]['id']}})[_0xe819('0x1e')](handleEntityNotFound(_0x550dc6,null))['then'](saveUpdates(_0x6c85ab[_0xe819('0x43')],null))[_0xe819('0x1e')](respondWithResult(_0x550dc6,null))['catch'](handleError(_0x550dc6,null));};exports[_0xe819('0x1f')]=function(_0x590b79,_0x2a1ca5){return db[_0xe819('0x29')][_0xe819('0x41')]({'where':{'id':_0x590b79[_0xe819('0x3e')]['id']}})[_0xe819('0x1e')](handleEntityNotFound(_0x2a1ca5,null))[_0xe819('0x1e')](removeEntity(_0x2a1ca5,null))[_0xe819('0x3d')](handleError(_0x2a1ca5,null));}; \ No newline at end of file +var _0xc5e4=['undefined','count','set','apply','reject','save','update','then','destroy','get','Variables','stack','name','index','map','rawAttributes','fieldName','key','query','filters','intersection','attributes','model','fields','length','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','Variable','includeAll','include','rows','show','params','keys','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','util','path','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x26cb47,_0x47349d){var _0x51667c=function(_0x5ad668){while(--_0x5ad668){_0x26cb47['push'](_0x26cb47['shift']());}};_0x51667c(++_0x47349d);}(_0xc5e4,0x160));var _0x4c5e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc5e4[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x4c5e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4c5e('0x1'));var jsonpatch=require(_0x4c5e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4c5e('0x3'));var path=require(_0x4c5e('0x4'));var sox=require('sox');var csv=require(_0x4c5e('0x5'));var ejs=require(_0x4c5e('0x6'));var fs=require('fs');var fs_extra=require(_0x4c5e('0x7'));var _=require('lodash');var squel=require(_0x4c5e('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4c5e('0x9'));var toCsv=require(_0x4c5e('0x5'));var querystring=require('querystring');var Papa=require(_0x4c5e('0xa'));var Redis=require(_0x4c5e('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4c5e('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c5e('0xd'))(_0x4c5e('0xe'));var utils=require(_0x4c5e('0xf'));var config=require(_0x4c5e('0x10'));var licenseUtil=require(_0x4c5e('0x11'));var db=require(_0x4c5e('0x12'))['db'];function respondWithStatusCode(_0x2fcc9a,_0x2f7ad1){_0x2f7ad1=_0x2f7ad1||0xcc;return function(_0x2cd9a8){if(_0x2cd9a8){return _0x2fcc9a['sendStatus'](_0x2f7ad1);}return _0x2fcc9a[_0x4c5e('0x13')](_0x2f7ad1)[_0x4c5e('0x14')]();};}function respondWithResult(_0x34808f,_0x4f4634){_0x4f4634=_0x4f4634||0xc8;return function(_0x580bdb){if(_0x580bdb){return _0x34808f['status'](_0x4f4634)[_0x4c5e('0x15')](_0x580bdb);}};}function respondWithFilteredResult(_0x17b14d,_0x4e8bde){return function(_0x4fcecc){if(_0x4fcecc){var _0x581059=typeof _0x4e8bde[_0x4c5e('0x16')]==='undefined'&&typeof _0x4e8bde['limit']===_0x4c5e('0x17');var _0x39dab5=_0x4fcecc['count'];var _0x1f632c=_0x581059?0x0:_0x4e8bde[_0x4c5e('0x16')];var _0x1c2b0a=_0x581059?_0x4fcecc[_0x4c5e('0x18')]:_0x4e8bde[_0x4c5e('0x16')]+_0x4e8bde['limit'];var _0x6c4491;if(_0x1c2b0a>=_0x39dab5){_0x1c2b0a=_0x39dab5;_0x6c4491=0xc8;}else{_0x6c4491=0xce;}_0x17b14d['status'](_0x6c4491);return _0x17b14d[_0x4c5e('0x19')]('Content-Range',_0x1f632c+'-'+_0x1c2b0a+'/'+_0x39dab5)[_0x4c5e('0x15')](_0x4fcecc);}return null;};}function patchUpdates(_0xb0270c){return function(_0x276a18){try{jsonpatch[_0x4c5e('0x1a')](_0x276a18,_0xb0270c,!![]);}catch(_0x813515){return BPromise[_0x4c5e('0x1b')](_0x813515);}return _0x276a18[_0x4c5e('0x1c')]();};}function saveUpdates(_0x568b23,_0x1d05af){return function(_0x1ae43d){if(_0x1ae43d){return _0x1ae43d[_0x4c5e('0x1d')](_0x568b23)[_0x4c5e('0x1e')](function(_0x369547){return _0x369547;});}return null;};}function removeEntity(_0x5d381c,_0x1c3f3a){return function(_0x2b5689){if(_0x2b5689){return _0x2b5689[_0x4c5e('0x1f')]()['then'](function(){var _0x58b0ec=_0x2b5689[_0x4c5e('0x20')]({'plain':!![]});var _0x2f8cf8=_0x4c5e('0x21');return db['UserProfileResource'][_0x4c5e('0x1f')]({'where':{'type':_0x2f8cf8,'resourceId':_0x58b0ec['id']}})[_0x4c5e('0x1e')](function(){return _0x2b5689;});})[_0x4c5e('0x1e')](function(){_0x5d381c['status'](0xcc)[_0x4c5e('0x14')]();});}};}function handleEntityNotFound(_0x36ddd1,_0x19001f){return function(_0x56f16a){if(!_0x56f16a){_0x36ddd1['sendStatus'](0x194);}return _0x56f16a;};}function handleError(_0x49ecd9,_0x45f49b){_0x45f49b=_0x45f49b||0x1f4;return function(_0x549015){logger['error'](_0x549015[_0x4c5e('0x22')]);if(_0x549015['name']){delete _0x549015[_0x4c5e('0x23')];}_0x49ecd9[_0x4c5e('0x13')](_0x45f49b)['send'](_0x549015);};}exports[_0x4c5e('0x24')]=function(_0x1e1e33,_0xb56bdd){var _0x1a7904={},_0x577ad6={},_0x5c8128={'count':0x0,'rows':[]};var _0x4fb80e=_[_0x4c5e('0x25')](db['Variable'][_0x4c5e('0x26')],function(_0x3ffe27){return{'name':_0x3ffe27[_0x4c5e('0x27')],'type':_0x3ffe27['type'][_0x4c5e('0x28')]};});_0x577ad6['model']=_[_0x4c5e('0x25')](_0x4fb80e,_0x4c5e('0x23'));_0x577ad6[_0x4c5e('0x29')]=_['keys'](_0x1e1e33[_0x4c5e('0x29')]);_0x577ad6[_0x4c5e('0x2a')]=_[_0x4c5e('0x2b')](_0x577ad6['model'],_0x577ad6[_0x4c5e('0x29')]);_0x1a7904[_0x4c5e('0x2c')]=_[_0x4c5e('0x2b')](_0x577ad6[_0x4c5e('0x2d')],qs[_0x4c5e('0x2e')](_0x1e1e33[_0x4c5e('0x29')][_0x4c5e('0x2e')]));_0x1a7904[_0x4c5e('0x2c')]=_0x1a7904[_0x4c5e('0x2c')][_0x4c5e('0x2f')]?_0x1a7904[_0x4c5e('0x2c')]:_0x577ad6['model'];if(!_0x1e1e33[_0x4c5e('0x29')]['hasOwnProperty'](_0x4c5e('0x30'))){_0x1a7904[_0x4c5e('0x31')]=qs[_0x4c5e('0x31')](_0x1e1e33[_0x4c5e('0x29')][_0x4c5e('0x31')]);_0x1a7904['offset']=qs[_0x4c5e('0x16')](_0x1e1e33[_0x4c5e('0x29')][_0x4c5e('0x16')]);}_0x1a7904['order']=qs[_0x4c5e('0x32')](_0x1e1e33['query']['sort']);_0x1a7904[_0x4c5e('0x33')]=qs[_0x4c5e('0x2a')](_[_0x4c5e('0x34')](_0x1e1e33[_0x4c5e('0x29')],_0x577ad6[_0x4c5e('0x2a')]),_0x4fb80e);if(_0x1e1e33['query'][_0x4c5e('0x35')]){_0x1a7904[_0x4c5e('0x33')]=_[_0x4c5e('0x36')](_0x1a7904[_0x4c5e('0x33')],{'$or':_[_0x4c5e('0x25')](_0x4fb80e,function(_0x450bf6){if(_0x450bf6[_0x4c5e('0x37')]!==_0x4c5e('0x38')){var _0x5e6173={};_0x5e6173[_0x450bf6['name']]={'$like':'%'+_0x1e1e33['query'][_0x4c5e('0x35')]+'%'};return _0x5e6173;}})});}_0x1a7904=_[_0x4c5e('0x36')]({},_0x1a7904,_0x1e1e33[_0x4c5e('0x39')]);var _0x492131={'where':_0x1a7904[_0x4c5e('0x33')]};return db[_0x4c5e('0x3a')][_0x4c5e('0x18')](_0x492131)[_0x4c5e('0x1e')](function(_0x46d321){_0x5c8128[_0x4c5e('0x18')]=_0x46d321;if(_0x1e1e33['query'][_0x4c5e('0x3b')]){_0x1a7904[_0x4c5e('0x3c')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x1a7904);})[_0x4c5e('0x1e')](function(_0x33ede3){_0x5c8128[_0x4c5e('0x3d')]=_0x33ede3;return _0x5c8128;})['then'](respondWithFilteredResult(_0xb56bdd,_0x1a7904))['catch'](handleError(_0xb56bdd,null));};exports[_0x4c5e('0x3e')]=function(_0x290dc8,_0x2918f3){var _0x3cf245={'raw':!![],'where':{'id':_0x290dc8[_0x4c5e('0x3f')]['id']}},_0x41b1bc={};_0x41b1bc[_0x4c5e('0x2d')]=_[_0x4c5e('0x40')](db[_0x4c5e('0x3a')]['rawAttributes']);_0x41b1bc[_0x4c5e('0x29')]=_[_0x4c5e('0x40')](_0x290dc8[_0x4c5e('0x29')]);_0x41b1bc[_0x4c5e('0x2a')]=_[_0x4c5e('0x2b')](_0x41b1bc[_0x4c5e('0x2d')],_0x41b1bc[_0x4c5e('0x29')]);_0x3cf245[_0x4c5e('0x2c')]=_[_0x4c5e('0x2b')](_0x41b1bc[_0x4c5e('0x2d')],qs[_0x4c5e('0x2e')](_0x290dc8['query'][_0x4c5e('0x2e')]));_0x3cf245[_0x4c5e('0x2c')]=_0x3cf245[_0x4c5e('0x2c')][_0x4c5e('0x2f')]?_0x3cf245['attributes']:_0x41b1bc[_0x4c5e('0x2d')];if(_0x290dc8[_0x4c5e('0x29')][_0x4c5e('0x3b')]){_0x3cf245[_0x4c5e('0x3c')]=[{'all':!![]}];}_0x3cf245=_[_0x4c5e('0x36')]({},_0x3cf245,_0x290dc8['options']);return db['Variable'][_0x4c5e('0x41')](_0x3cf245)['then'](handleEntityNotFound(_0x2918f3,null))[_0x4c5e('0x1e')](respondWithResult(_0x2918f3,null))['catch'](handleError(_0x2918f3,null));};exports[_0x4c5e('0x42')]=function(_0x5087f6,_0x409e22){return db[_0x4c5e('0x3a')][_0x4c5e('0x42')](_0x5087f6['body'],{})[_0x4c5e('0x1e')](function(_0x5e8850){var _0xb87c1b=_0x5087f6['user'][_0x4c5e('0x20')]({'plain':!![]});if(!_0xb87c1b)throw new Error(_0x4c5e('0x43'));if(_0xb87c1b[_0x4c5e('0x44')]==='user'){var _0x5590b7=_0x5e8850['get']({'plain':!![]});var _0x199a12=_0x4c5e('0x21');return db[_0x4c5e('0x45')][_0x4c5e('0x41')]({'where':{'name':_0x199a12,'userProfileId':_0xb87c1b['userProfileId']},'raw':!![]})[_0x4c5e('0x1e')](function(_0x22748d){if(_0x22748d&&_0x22748d[_0x4c5e('0x46')]===0x0){return db['UserProfileResource']['create']({'name':_0x5590b7[_0x4c5e('0x23')],'resourceId':_0x5590b7['id'],'type':_0x22748d[_0x4c5e('0x23')],'sectionId':_0x22748d['id']},{})[_0x4c5e('0x1e')](function(){return _0x5e8850;});}else{return _0x5e8850;}})[_0x4c5e('0x47')](function(_0x231b17){logger[_0x4c5e('0x48')](_0x4c5e('0x49'),_0x231b17);throw _0x231b17;});}return _0x5e8850;})[_0x4c5e('0x1e')](respondWithResult(_0x409e22,0xc9))['catch'](handleError(_0x409e22,null));};exports[_0x4c5e('0x1d')]=function(_0x2103b8,_0x313681){if(_0x2103b8[_0x4c5e('0x4a')]['id']){delete _0x2103b8[_0x4c5e('0x4a')]['id'];}return db['Variable']['find']({'where':{'id':_0x2103b8[_0x4c5e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x313681,null))[_0x4c5e('0x1e')](saveUpdates(_0x2103b8[_0x4c5e('0x4a')],null))['then'](respondWithResult(_0x313681,null))[_0x4c5e('0x47')](handleError(_0x313681,null));};exports[_0x4c5e('0x1f')]=function(_0x2d55ed,_0x53c5d0){return db[_0x4c5e('0x3a')][_0x4c5e('0x41')]({'where':{'id':_0x2d55ed[_0x4c5e('0x3f')]['id']}})[_0x4c5e('0x1e')](handleEntityNotFound(_0x53c5d0,null))['then'](removeEntity(_0x53c5d0,null))['catch'](handleError(_0x53c5d0,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 2aebbac..8ba4019 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 _0xdf71=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./variable.attributes','exports','lodash','../../config/logger'];(function(_0x3e834d,_0x57ea65){var _0x1ce3cc=function(_0x4a7a8c){while(--_0x4a7a8c){_0x3e834d['push'](_0x3e834d['shift']());}};_0x1ce3cc(++_0x57ea65);}(_0xdf71,0x170));var _0x1df7=function(_0x4fd2d1,_0x43f306){_0x4fd2d1=_0x4fd2d1-0x0;var _0x564564=_0xdf71[_0x4fd2d1];return _0x564564;};'use strict';var _=require(_0x1df7('0x0'));var util=require('util');var logger=require(_0x1df7('0x1'))(_0x1df7('0x2'));var moment=require(_0x1df7('0x3'));var BPromise=require(_0x1df7('0x4'));var rp=require(_0x1df7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1df7('0x6'));var config=require(_0x1df7('0x7'));var attributes=require(_0x1df7('0x8'));module[_0x1df7('0x9')]=function(_0x4e95e7,_0x1c17a5){return _0x4e95e7['define']('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa620=['exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2ea087,_0x17f324){var _0x23ebac=function(_0x5575d8){while(--_0x5575d8){_0x2ea087['push'](_0x2ea087['shift']());}};_0x23ebac(++_0x17f324);}(_0xa620,0xe4));var _0x0a62=function(_0x17ebae,_0x7da3){_0x17ebae=_0x17ebae-0x0;var _0x8cbe7d=_0xa620[_0x17ebae];return _0x8cbe7d;};'use strict';var _=require(_0x0a62('0x0'));var util=require(_0x0a62('0x1'));var logger=require(_0x0a62('0x2'))(_0x0a62('0x3'));var moment=require(_0x0a62('0x4'));var BPromise=require(_0x0a62('0x5'));var rp=require(_0x0a62('0x6'));var fs=require('fs');var path=require(_0x0a62('0x7'));var rimraf=require(_0x0a62('0x8'));var config=require(_0x0a62('0x9'));var attributes=require('./variable.attributes');module[_0x0a62('0xa')]=function(_0x4f121d,_0xd4e3fd){return _0x4f121d[_0x0a62('0xb')](_0x0a62('0xc'),attributes,{'tableName':_0x0a62('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 9051245..97a381d 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 _0x4b84=['catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','then','info','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','Variable,\x20%s,\x20%s','message','ShowVariable','Variable','find','options','raw','where','attributes','include','map','model'];(function(_0x2a6193,_0x2ec097){var _0x317a31=function(_0x478fa1){while(--_0x478fa1){_0x2a6193['push'](_0x2a6193['shift']());}};_0x317a31(++_0x2ec097);}(_0x4b84,0x1cc));var _0x44b8=function(_0x378b4,_0x5ca7fa){_0x378b4=_0x378b4-0x0;var _0x11d07b=_0x4b84[_0x378b4];return _0x11d07b;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('Variable,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('Variable,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});}exports[_0x44b8('0x10')]=function(_0x55e258){var _0x36743e=this;return new Promise(function(_0xe3de8f,_0x5103f5){return db[_0x44b8('0x11')][_0x44b8('0x12')]({'raw':_0x55e258['options']?_0x55e258[_0x44b8('0x13')][_0x44b8('0x14')]===undefined?!![]:![]:!![],'where':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x15')]||null:null,'attributes':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x16')]||null:null,'include':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x17')]?_[_0x44b8('0x18')](_0x55e258['options'][_0x44b8('0x17')],function(_0x3a8aa4){return{'model':db[_0x3a8aa4[_0x44b8('0x19')]],'as':_0x3a8aa4['as'],'attributes':_0x3a8aa4[_0x44b8('0x16')],'include':_0x3a8aa4[_0x44b8('0x17')]?_['map'](_0x3a8aa4[_0x44b8('0x17')],function(_0x54677c){return{'model':db[_0x54677c[_0x44b8('0x19')]],'as':_0x54677c['as'],'attributes':_0x54677c[_0x44b8('0x16')],'include':_0x54677c[_0x44b8('0x17')]?_[_0x44b8('0x18')](_0x54677c[_0x44b8('0x17')],function(_0x59acbc){return{'model':db[_0x59acbc[_0x44b8('0x19')]],'as':_0x59acbc['as'],'attributes':_0x59acbc['attributes']};}):[]};}):[]};}):[]:[]})[_0x44b8('0x7')](function(_0x350482){logger['info'](_0x44b8('0x10'),_0x55e258);logger[_0x44b8('0xa')](_0x44b8('0x10'),_0x55e258,JSON['stringify'](_0x350482));_0xe3de8f(_0x350482);})[_0x44b8('0x1a')](function(_0x242342){logger['error'](_0x44b8('0x10'),_0x242342['message'],_0x55e258);_0x5103f5(_0x36743e[_0x44b8('0xd')](0x1f4,_0x242342['message']));});});}; \ No newline at end of file +var _0x3e74=['catch','Variable','find','options','raw','where','attributes','include','map','model','then','ShowVariable','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','Variable,\x20%s,\x20%s','message','info'];(function(_0x4c10fe,_0x19e0b2){var _0x5d4ffe=function(_0x219ac8){while(--_0x219ac8){_0x4c10fe['push'](_0x4c10fe['shift']());}};_0x5d4ffe(++_0x19e0b2);}(_0x3e74,0x175));var _0x43e7=function(_0xec4d22,_0x4395dd){_0xec4d22=_0xec4d22-0x0;var _0x558e82=_0x3e74[_0xec4d22];return _0x558e82;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('Variable,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('Variable,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('Variable,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowVariable']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index d27e70d..3f16d4c 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 _0x9df7=['canUpdate','reset','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','fetch','/reset'];(function(_0x381ede,_0x15e8fb){var _0xb1b954=function(_0x3d6280){while(--_0x3d6280){_0x381ede['push'](_0x381ede['shift']());}};_0xb1b954(++_0x15e8fb);}(_0x9df7,0x74));var _0x79df=function(_0x27dba4,_0x419253){_0x27dba4=_0x27dba4-0x0;var _0x35ec9d=_0x9df7[_0x27dba4];return _0x35ec9d;};'use strict';var express=require(_0x79df('0x0'));var router=express[_0x79df('0x1')]();var auth=require(_0x79df('0x2'));var controller=require(_0x79df('0x3'));router[_0x79df('0x4')]('/',controller[_0x79df('0x5')]);router[_0x79df('0x4')](_0x79df('0x6'),auth[_0x79df('0x7')](),auth['canUpdate'](),controller[_0x79df('0x8')]);router[_0x79df('0x4')](_0x79df('0x9'),auth[_0x79df('0x7')](),auth[_0x79df('0xa')](),controller[_0x79df('0xb')]);router['get']('/pull',auth[_0x79df('0x7')](),auth['canUpdate'](),controller[_0x79df('0xc')]);router[_0x79df('0x4')](_0x79df('0xd'),auth[_0x79df('0x7')](),controller[_0x79df('0xe')]);router[_0x79df('0x4')](_0x79df('0xf'),controller[_0x79df('0x10')]);module[_0x79df('0x11')]=router; \ No newline at end of file +var _0x4dd4=['/fetch','canUpdate','fetch','/reset','isAuthenticated','reset','/pull','pull','/restart','restart','migrations','exports','express','Router','../../components/auth/service','./version.controller','get'];(function(_0x25d6ce,_0x30d64a){var _0x1aef15=function(_0x13aa4f){while(--_0x13aa4f){_0x25d6ce['push'](_0x25d6ce['shift']());}};_0x1aef15(++_0x30d64a);}(_0x4dd4,0xfa));var _0x44dd=function(_0x43fc64,_0x1da87c){_0x43fc64=_0x43fc64-0x0;var _0x2c0d3b=_0x4dd4[_0x43fc64];return _0x2c0d3b;};'use strict';var express=require(_0x44dd('0x0'));var router=express[_0x44dd('0x1')]();var auth=require(_0x44dd('0x2'));var controller=require(_0x44dd('0x3'));router[_0x44dd('0x4')]('/',controller['index']);router[_0x44dd('0x4')](_0x44dd('0x5'),auth['isAuthenticated'](),auth[_0x44dd('0x6')](),controller[_0x44dd('0x7')]);router['get'](_0x44dd('0x8'),auth[_0x44dd('0x9')](),auth[_0x44dd('0x6')](),controller[_0x44dd('0xa')]);router['get'](_0x44dd('0xb'),auth[_0x44dd('0x9')](),auth[_0x44dd('0x6')](),controller[_0x44dd('0xc')]);router['get'](_0x44dd('0xd'),auth['isAuthenticated'](),controller[_0x44dd('0xe')]);router[_0x44dd('0x4')]('/migrations',controller[_0x44dd('0xf')]);module[_0x44dd('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 2a3099f..ae5119d 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 _0x5d31=['../../mysqldb','../../config/environment','update','root','index','exports','version','query','latest','fetch','tags','2.0.0','status','json','origin','master','error','info','git\x20fetch\x20origin\x20master','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','readdirSync','join','migrations','length','replace','.js','push','sort','sequelize','Migration','constructor','server','map','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','compare-versions','child_process','exec'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x5d31,0xca));var _0x15d3=function(_0x2ea9fd,_0x45d80b){_0x2ea9fd=_0x2ea9fd-0x0;var _0x27d18e=_0x5d31[_0x2ea9fd];return _0x27d18e;};'use strict';var Umzug=require(_0x15d3('0x0'));var path=require(_0x15d3('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x15d3('0x2'))(module,'version');var compareVersions=require(_0x15d3('0x3'));var exec=require(_0x15d3('0x4'))[_0x15d3('0x5')];var db=require(_0x15d3('0x6'))['db'];var config=require(_0x15d3('0x7'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x15d3('0x8'));var git=require('simple-git')(config[_0x15d3('0x9')]);exports[_0x15d3('0xa')]=function(_0x5abc4b,_0x203407){var _0xa8c668={'current':module[_0x15d3('0xb')][_0x15d3('0xc')],'phonebar':0x2};if(_0x5abc4b[_0x15d3('0xd')]&&_0x5abc4b[_0x15d3('0xd')][_0x15d3('0xe')]){return git[_0x15d3('0xf')]()[_0x15d3('0x10')](function(_0x275389,_0x92569b){_0xa8c668['latest']=(_0x275389?module[_0x15d3('0xb')][_0x15d3('0xc')]:_0x92569b[_0x15d3('0xe')])||_0x15d3('0x11');return _0x203407[_0x15d3('0x12')](0xc8)[_0x15d3('0x13')](_0xa8c668);});}else{return _0x203407[_0x15d3('0x12')](0xc8)[_0x15d3('0x13')](_0xa8c668);}};exports['fetch']=function(_0x458e41,_0x4aea34){return git[_0x15d3('0xf')]([_0x15d3('0x14'),_0x15d3('0x15')],function(_0x26b564){if(_0x26b564){logger[_0x15d3('0x16')](_0x26b564);return _0x4aea34[_0x15d3('0x12')](0x1f4)[_0x15d3('0x13')](_0x26b564);}logger[_0x15d3('0x17')]('git\x20fetch');return _0x4aea34[_0x15d3('0x12')](0xc8)['json']({'output':_0x15d3('0x18')});});};exports['reset']=function(_0x3946bb,_0x140a15){return git['reset']([_0x15d3('0x19'),_0x15d3('0x1a')],function(_0x5dff8d){if(_0x5dff8d){logger['error'](_0x5dff8d);return _0x140a15['status'](0x1f4)[_0x15d3('0x13')](_0x5dff8d);}logger[_0x15d3('0x17')](_0x15d3('0x1b'));return _0x140a15['status'](0xc8)['json']({'output':_0x15d3('0x1c')});});};exports[_0x15d3('0x1d')]=function(_0x1c878b,_0x277ea5){exec('npm\x20install\x20--production',function(_0x46ec95,_0x48cef6,_0x1f0125){logger[_0x15d3('0x17')](_0x48cef6);logger['info'](_0x1f0125);if(_0x46ec95){logger[_0x15d3('0x16')](_0x46ec95);return _0x277ea5[_0x15d3('0x12')](0x1f4)[_0x15d3('0x13')](_0x46ec95);}return _0x277ea5[_0x15d3('0x12')](0xc8)[_0x15d3('0x13')]({'output':_0x48cef6});});};exports[_0x15d3('0x1e')]=function(_0x1f422f,_0x134f70){return pm2['restart']('motion2')[_0x15d3('0x1f')](function(_0x4e7095){logger[_0x15d3('0x17')](_0x15d3('0x20'),_0x4e7095);return _0x134f70[_0x15d3('0x12')](0xc8)[_0x15d3('0x13')]({'output':_0x15d3('0x21')});})['catch'](function(_0x1fdd7e){logger[_0x15d3('0x16')](_0x1fdd7e);return _0x134f70['status'](0x1f4)[_0x15d3('0x13')](_0x1fdd7e);});};exports['migrations']=function(_0x182efc,_0x5b6794){var _0x5ab298=fs[_0x15d3('0x22')](path[_0x15d3('0x23')](config['root'],'server',_0x15d3('0x24')));var _0x33d358=[];for(var _0x14d20d=0x0;_0x14d20d<_0x5ab298[_0x15d3('0x25')];_0x14d20d++){var _0x5c3781=_0x5ab298[_0x14d20d][_0x15d3('0x26')](_0x15d3('0x27'),'');if(compareVersions(module[_0x15d3('0xb')][_0x15d3('0xc')],_0x5c3781)===-0x1){_0x33d358[_0x15d3('0x28')](_0x5c3781);}}if(_0x33d358[_0x15d3('0x25')]){var _0x14b36a=_0x33d358[_0x15d3('0x29')](compareVersions);var _0x52979a=new Umzug({'storage':_0x15d3('0x2a'),'storageOptions':{'model':db[_0x15d3('0x2b')],'modelName':_0x15d3('0x2b'),'columnName':_0x15d3('0xc')},'migrations':{'params':[db[_0x15d3('0x2a')]['getQueryInterface'](),db[_0x15d3('0x2a')][_0x15d3('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[_0x15d3('0x9')],_0x15d3('0x2d'),_0x15d3('0x24')),'pattern':/\.js$/}});_0x52979a['up']({'migrations':_[_0x15d3('0x2e')](_0x14b36a,function(_0x511212){return _0x511212+_0x15d3('0x27');})})['then'](function(){return _0x5b6794[_0x15d3('0x12')](0xc8)[_0x15d3('0x13')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x15d3('0xb')][_0x15d3('0xc')]+_0x15d3('0x2f')+_[_0x15d3('0x30')](_0x14b36a),'migrations':_[_0x15d3('0x23')](_0x14b36a)});})[_0x15d3('0x31')](function(_0x70dd49){if(_0x70dd49 instanceof db[_0x15d3('0x2a')][_0x15d3('0x32')]){return _0x5b6794['status'](0xc8)[_0x15d3('0x13')]({'output':_0x15d3('0x33')});}else{return _0x5b6794[_0x15d3('0x12')](0x1f4)[_0x15d3('0x13')](_0x70dd49);}});}else{return _0x5b6794[_0x15d3('0x12')](0xc8)[_0x15d3('0x13')]({'output':_0x15d3('0x33')});}}; \ No newline at end of file +var _0x2f0a=['pkginfo','compare-versions','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','exports','version','latest','fetch','status','json','origin','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','error','info','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','join','root','migrations','replace','push','length','sort','Migration','sequelize','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','last','catch','Database\x20already\x20up-to-date','umzug','path','lodash'];(function(_0x1fb70a,_0x3c9bfd){var _0xad13f8=function(_0xa12d6a){while(--_0xa12d6a){_0x1fb70a['push'](_0x1fb70a['shift']());}};_0xad13f8(++_0x3c9bfd);}(_0x2f0a,0xe8));var _0xa2f0=function(_0x289c09,_0x1cf82d){_0x289c09=_0x289c09-0x0;var _0xa6895b=_0x2f0a[_0x289c09];return _0xa6895b;};'use strict';var Umzug=require(_0xa2f0('0x0'));var path=require(_0xa2f0('0x1'));var fs=require('fs');var _=require(_0xa2f0('0x2'));var pkginfo=require(_0xa2f0('0x3'))(module,'version');var compareVersions=require(_0xa2f0('0x4'));var exec=require('child_process')['exec'];var db=require('../../mysqldb')['db'];var config=require(_0xa2f0('0x5'));var pm2=require(_0xa2f0('0x6'));var logger=require(_0xa2f0('0x7'))(_0xa2f0('0x8'));var git=require(_0xa2f0('0x9'))(config['root']);exports[_0xa2f0('0xa')]=function(_0xa2695f,_0x547fea){var _0x156e50={'current':module[_0xa2f0('0xb')][_0xa2f0('0xc')],'phonebar':0x2};if(_0xa2695f['query']&&_0xa2695f['query'][_0xa2f0('0xd')]){return git[_0xa2f0('0xe')]()['tags'](function(_0x43211e,_0x4a8cd6){_0x156e50['latest']=(_0x43211e?module[_0xa2f0('0xb')]['version']:_0x4a8cd6[_0xa2f0('0xd')])||'2.0.0';return _0x547fea[_0xa2f0('0xf')](0xc8)[_0xa2f0('0x10')](_0x156e50);});}else{return _0x547fea[_0xa2f0('0xf')](0xc8)[_0xa2f0('0x10')](_0x156e50);}};exports[_0xa2f0('0xe')]=function(_0x4c4733,_0x51de77){return git[_0xa2f0('0xe')]([_0xa2f0('0x11'),'master'],function(_0x19e35a){if(_0x19e35a){logger['error'](_0x19e35a);return _0x51de77[_0xa2f0('0xf')](0x1f4)['json'](_0x19e35a);}logger['info'](_0xa2f0('0x12'));return _0x51de77[_0xa2f0('0xf')](0xc8)[_0xa2f0('0x10')]({'output':_0xa2f0('0x13')});});};exports[_0xa2f0('0x14')]=function(_0x2d5049,_0x5affc2){return git[_0xa2f0('0x14')]([_0xa2f0('0x15'),'FETCH_HEAD'],function(_0x30383d){if(_0x30383d){logger[_0xa2f0('0x16')](_0x30383d);return _0x5affc2[_0xa2f0('0xf')](0x1f4)[_0xa2f0('0x10')](_0x30383d);}logger[_0xa2f0('0x17')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x5affc2['status'](0xc8)[_0xa2f0('0x10')]({'output':_0xa2f0('0x18')});});};exports[_0xa2f0('0x19')]=function(_0x48164d,_0x4cb17c){exec(_0xa2f0('0x1a'),function(_0x3153c7,_0x5e40e8,_0x3b44f8){logger['info'](_0x5e40e8);logger[_0xa2f0('0x17')](_0x3b44f8);if(_0x3153c7){logger[_0xa2f0('0x16')](_0x3153c7);return _0x4cb17c[_0xa2f0('0xf')](0x1f4)[_0xa2f0('0x10')](_0x3153c7);}return _0x4cb17c['status'](0xc8)[_0xa2f0('0x10')]({'output':_0x5e40e8});});};exports[_0xa2f0('0x1b')]=function(_0x415e52,_0xda0bf9){return pm2[_0xa2f0('0x1b')](_0xa2f0('0x1c'))[_0xa2f0('0x1d')](function(_0xddaf7b){logger[_0xa2f0('0x17')](_0xa2f0('0x1e'),_0xddaf7b);return _0xda0bf9[_0xa2f0('0xf')](0xc8)[_0xa2f0('0x10')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x2b4031){logger[_0xa2f0('0x16')](_0x2b4031);return _0xda0bf9[_0xa2f0('0xf')](0x1f4)[_0xa2f0('0x10')](_0x2b4031);});};exports['migrations']=function(_0x553300,_0x260024){var _0x40836f=fs['readdirSync'](path[_0xa2f0('0x1f')](config[_0xa2f0('0x20')],'server',_0xa2f0('0x21')));var _0x1d6651=[];for(var _0x5eb36c=0x0;_0x5eb36c<_0x40836f['length'];_0x5eb36c++){var _0x343611=_0x40836f[_0x5eb36c][_0xa2f0('0x22')]('.js','');if(compareVersions(module[_0xa2f0('0xb')][_0xa2f0('0xc')],_0x343611)===-0x1){_0x1d6651[_0xa2f0('0x23')](_0x343611);}}if(_0x1d6651[_0xa2f0('0x24')]){var _0x1afa0e=_0x1d6651[_0xa2f0('0x25')](compareVersions);var _0x483aec=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xa2f0('0x26')],'modelName':_0xa2f0('0x26'),'columnName':_0xa2f0('0xc')},'migrations':{'params':[db[_0xa2f0('0x27')]['getQueryInterface'](),db[_0xa2f0('0x27')]['constructor'],function(){throw new Error(_0xa2f0('0x28'));}],'path':path[_0xa2f0('0x1f')](config[_0xa2f0('0x20')],_0xa2f0('0x29'),'migrations'),'pattern':/\.js$/}});_0x483aec['up']({'migrations':_['map'](_0x1afa0e,function(_0x1098aa){return _0x1098aa+_0xa2f0('0x2a');})})['then'](function(){return _0x260024[_0xa2f0('0xf')](0xc8)[_0xa2f0('0x10')]({'output':_0xa2f0('0x2b')+module[_0xa2f0('0xb')][_0xa2f0('0xc')]+'\x20to\x20'+_[_0xa2f0('0x2c')](_0x1afa0e),'migrations':_[_0xa2f0('0x1f')](_0x1afa0e)});})[_0xa2f0('0x2d')](function(_0x5b79a0){if(_0x5b79a0 instanceof db[_0xa2f0('0x27')]['UniqueConstraintError']){return _0x260024[_0xa2f0('0xf')](0xc8)['json']({'output':_0xa2f0('0x2e')});}else{return _0x260024[_0xa2f0('0xf')](0x1f4)[_0xa2f0('0x10')](_0x5b79a0);}});}else{return _0x260024[_0xa2f0('0xf')](0xc8)[_0xa2f0('0x10')]({'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 b0bd65b..7288518 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 _0x4312=['post','put','update','destroy','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x41273f,_0x4dc333){var _0x482089=function(_0x521cce){while(--_0x521cce){_0x41273f['push'](_0x41273f['shift']());}};_0x482089(++_0x4dc333);}(_0x4312,0x164));var _0x2431=function(_0x5a0693,_0x5e80b8){_0x5a0693=_0x5a0693-0x0;var _0x5daa64=_0x4312[_0x5a0693];return _0x5daa64;};'use strict';var multer=require('multer');var util=require(_0x2431('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2431('0x1'));var router=express[_0x2431('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2431('0x3'));var interaction=require(_0x2431('0x4'));var config=require(_0x2431('0x5'));var controller=require(_0x2431('0x6'));router[_0x2431('0x7')]('/',auth[_0x2431('0x8')](),controller['index']);router[_0x2431('0x7')](_0x2431('0x9'),auth[_0x2431('0x8')](),controller[_0x2431('0xa')]);router[_0x2431('0x7')](_0x2431('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x2431('0xc')]('/',auth[_0x2431('0x8')](),controller['create']);router[_0x2431('0xd')](_0x2431('0xb'),auth[_0x2431('0x8')](),controller[_0x2431('0xe')]);router['delete'](_0x2431('0xb'),auth[_0x2431('0x8')](),controller[_0x2431('0xf')]);module['exports']=router; \ No newline at end of file +var _0xb52d=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','describe','/:id','show','post','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb52d,0x162));var _0xdb52=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xb52d[_0x4baae2];return _0x1a2285;};'use strict';var multer=require(_0xdb52('0x0'));var util=require(_0xdb52('0x1'));var path=require(_0xdb52('0x2'));var timeout=require(_0xdb52('0x3'));var express=require(_0xdb52('0x4'));var router=express[_0xdb52('0x5')]();var fs_extra=require(_0xdb52('0x6'));var auth=require(_0xdb52('0x7'));var interaction=require(_0xdb52('0x8'));var config=require(_0xdb52('0x9'));var controller=require(_0xdb52('0xa'));router[_0xdb52('0xb')]('/',auth[_0xdb52('0xc')](),controller[_0xdb52('0xd')]);router['get']('/describe',auth[_0xdb52('0xc')](),controller[_0xdb52('0xe')]);router[_0xdb52('0xb')](_0xdb52('0xf'),auth[_0xdb52('0xc')](),controller[_0xdb52('0x10')]);router[_0xdb52('0x11')]('/',auth[_0xdb52('0xc')](),controller['create']);router[_0xdb52('0x12')](_0xdb52('0xf'),auth[_0xdb52('0xc')](),controller[_0xdb52('0x13')]);router[_0xdb52('0x14')]('/:id',auth[_0xdb52('0xc')](),controller[_0xdb52('0x15')]);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 be474da..f0d9470 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 _0x48bc=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x27ad07,_0x2d3d47){var _0x3148b4=function(_0x3e8f75){while(--_0x3e8f75){_0x27ad07['push'](_0x27ad07['shift']());}};_0x3148b4(++_0x2d3d47);}(_0x48bc,0x1b6));var _0xc48b=function(_0xdaee59,_0x6b9a1f){_0xdaee59=_0xdaee59-0x0;var _0x68ae90=_0x48bc[_0xdaee59];return _0x68ae90;};'use strict';var Sequelize=require(_0xc48b('0x0'));module[_0xc48b('0x1')]={'type':{'type':Sequelize[_0xc48b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc48b('0x2')]},'calleridname':{'type':Sequelize[_0xc48b('0x2')]},'queue':{'type':Sequelize[_0xc48b('0x2')]},'interface':{'type':Sequelize[_0xc48b('0x2')]},'membername':{'type':Sequelize[_0xc48b('0x2')]},'agentcalledAt':{'type':Sequelize[_0xc48b('0x3')]},'agentconnectAt':{'type':Sequelize[_0xc48b('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xc48b('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xc48b('0x4')]},'agentcomplete':{'type':Sequelize[_0xc48b('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xc48b('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xc48b('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc48b('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xc48b('0x2')]},'channel':{'type':Sequelize[_0xc48b('0x2')]},'channelstate':{'type':Sequelize[_0xc48b('0x4')]},'channelstatedesc':{'type':Sequelize[_0xc48b('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc48b('0x2')]},'connectedlinename':{'type':Sequelize[_0xc48b('0x2')]},'language':{'type':Sequelize[_0xc48b('0x2')]},'accountcode':{'type':Sequelize[_0xc48b('0x2')]},'context':{'type':Sequelize[_0xc48b('0x2')]},'exten':{'type':Sequelize[_0xc48b('0x2')]},'priority':{'type':Sequelize[_0xc48b('0x2')]},'destchannel':{'type':Sequelize[_0xc48b('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xc48b('0x2')]},'destcalleridnum':{'type':Sequelize[_0xc48b('0x2')]},'destcalleridname':{'type':Sequelize[_0xc48b('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xc48b('0x2')]},'destlanguage':{'type':Sequelize[_0xc48b('0x2')]},'destaccountcode':{'type':Sequelize[_0xc48b('0x2')]},'destcontext':{'type':Sequelize[_0xc48b('0x2')]},'destexten':{'type':Sequelize[_0xc48b('0x2')]},'destpriority':{'type':Sequelize[_0xc48b('0x2')]},'destuniqueid':{'type':Sequelize[_0xc48b('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xc48b('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xc48b('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xc48b('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xc48b('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xea28=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x4ad17e,_0x4cf44b){var _0x309136=function(_0x676636){while(--_0x676636){_0x4ad17e['push'](_0x4ad17e['shift']());}};_0x309136(++_0x4cf44b);}(_0xea28,0x13a));var _0x8ea2=function(_0xbe6574,_0x1d448c){_0xbe6574=_0xbe6574-0x0;var _0x32a27e=_0xea28[_0xbe6574];return _0x32a27e;};'use strict';var Sequelize=require(_0x8ea2('0x0'));module[_0x8ea2('0x1')]={'type':{'type':Sequelize[_0x8ea2('0x2')]},'uniqueid':{'type':Sequelize[_0x8ea2('0x2')]},'calleridnum':{'type':Sequelize[_0x8ea2('0x2')]},'calleridname':{'type':Sequelize[_0x8ea2('0x2')]},'queue':{'type':Sequelize[_0x8ea2('0x2')]},'interface':{'type':Sequelize[_0x8ea2('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x8ea2('0x3')]},'agentconnectAt':{'type':Sequelize[_0x8ea2('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x8ea2('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x8ea2('0x3')]},'holdtime':{'type':Sequelize[_0x8ea2('0x4')]},'agentcomplete':{'type':Sequelize[_0x8ea2('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x8ea2('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x8ea2('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x8ea2('0x4')]},'agentacw':{'type':Sequelize[_0x8ea2('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8ea2('0x4')]},'reason':{'type':Sequelize[_0x8ea2('0x2')]},'lastevent':{'type':Sequelize[_0x8ea2('0x2')]},'channel':{'type':Sequelize[_0x8ea2('0x2')]},'channelstate':{'type':Sequelize[_0x8ea2('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x8ea2('0x2')]},'language':{'type':Sequelize[_0x8ea2('0x2')]},'accountcode':{'type':Sequelize[_0x8ea2('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x8ea2('0x2')]},'priority':{'type':Sequelize[_0x8ea2('0x2')]},'destchannel':{'type':Sequelize[_0x8ea2('0x2')]},'destchannelstate':{'type':Sequelize[_0x8ea2('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x8ea2('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x8ea2('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x8ea2('0x2')]},'destaccountcode':{'type':Sequelize[_0x8ea2('0x2')]},'destcontext':{'type':Sequelize[_0x8ea2('0x2')]},'destexten':{'type':Sequelize[_0x8ea2('0x2')]},'destpriority':{'type':Sequelize[_0x8ea2('0x2')]},'destuniqueid':{'type':Sequelize[_0x8ea2('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x8ea2('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x8ea2('0x2')]},'transfer':{'type':Sequelize[_0x8ea2('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8ea2('0x2')],'comment':_0x8ea2('0x6')},'transferexten':{'type':Sequelize[_0x8ea2('0x2')]},'transferuniqueid':{'type':Sequelize[_0x8ea2('0x2')]},'agententerreason':{'type':Sequelize[_0x8ea2('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 186c637..1d25f28 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(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 34f9df0..ebcf21e 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 _0xef8b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid','destuniqueid','util','../../config/logger','api'];(function(_0x474e07,_0x223d57){var _0x53f32b=function(_0xbcf040){while(--_0xbcf040){_0x474e07['push'](_0x474e07['shift']());}};_0x53f32b(++_0x223d57);}(_0xef8b,0x192));var _0xbef8=function(_0x15cbce,_0xda8402){_0x15cbce=_0x15cbce-0x0;var _0x257f29=_0xef8b[_0x15cbce];return _0x257f29;};'use strict';var _=require('lodash');var util=require(_0xbef8('0x0'));var logger=require(_0xbef8('0x1'))(_0xbef8('0x2'));var moment=require(_0xbef8('0x3'));var BPromise=require(_0xbef8('0x4'));var rp=require(_0xbef8('0x5'));var fs=require('fs');var path=require(_0xbef8('0x6'));var rimraf=require(_0xbef8('0x7'));var config=require(_0xbef8('0x8'));var attributes=require(_0xbef8('0x9'));module[_0xbef8('0xa')]=function(_0x550cb1,_0x1dd4a3){return _0x550cb1[_0xbef8('0xb')](_0xbef8('0xc'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xbef8('0xd'),_0xbef8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6eed=['define','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','./voiceAgentReport.attributes','exports'];(function(_0x250ce7,_0x502ad3){var _0x416428=function(_0x46564d){while(--_0x46564d){_0x250ce7['push'](_0x250ce7['shift']());}};_0x416428(++_0x502ad3);}(_0x6eed,0xff));var _0xd6ee=function(_0x1d506a,_0x4fc4a0){_0x1d506a=_0x1d506a-0x0;var _0x5edd79=_0x6eed[_0x1d506a];return _0x5edd79;};'use strict';var _=require(_0xd6ee('0x0'));var util=require(_0xd6ee('0x1'));var logger=require(_0xd6ee('0x2'))(_0xd6ee('0x3'));var moment=require(_0xd6ee('0x4'));var BPromise=require('bluebird');var rp=require(_0xd6ee('0x5'));var fs=require('fs');var path=require(_0xd6ee('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd6ee('0x7'));module[_0xd6ee('0x8')]=function(_0x1c4f36,_0x37abca){return _0x1c4f36[_0xd6ee('0x9')]('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xd6ee('0xa'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index e5420dd..0c7f18b 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 _0x6b81=['UpdateVoiceAgentReport','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','update','body','raw','where','limit'];(function(_0x4ae7d4,_0x468b2e){var _0x11a417=function(_0x2d4979){while(--_0x2d4979){_0x4ae7d4['push'](_0x4ae7d4['shift']());}};_0x11a417(++_0x468b2e);}(_0x6b81,0x16d));var _0x16b8=function(_0x1f73c3,_0xa8af11){_0x1f73c3=_0x1f73c3-0x0;var _0x20450e=_0x6b81[_0x1f73c3];return _0x20450e;};'use strict';var _=require('lodash');var util=require(_0x16b8('0x0'));var moment=require('moment');var BPromise=require(_0x16b8('0x1'));var rs=require(_0x16b8('0x2'));var fs=require('fs');var Redis=require(_0x16b8('0x3'));var db=require(_0x16b8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x16b8('0x5'))(_0x16b8('0x6'));var config=require(_0x16b8('0x7'));var jayson=require(_0x16b8('0x8'));var client=jayson[_0x16b8('0x9')][_0x16b8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58e94d,_0x4bcd03,_0x561f8f){return new BPromise(function(_0x5ef822,_0x507bd4){return client[_0x16b8('0xb')](_0x58e94d,_0x561f8f)[_0x16b8('0xc')](function(_0x459120){logger[_0x16b8('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x4bcd03,_0x16b8('0xe'));logger[_0x16b8('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x4bcd03,'request\x20sent',JSON['stringify'](_0x459120));if(_0x459120[_0x16b8('0x10')]){if(_0x459120[_0x16b8('0x10')][_0x16b8('0x11')]===0x1f4){logger[_0x16b8('0x10')](_0x16b8('0x12'),_0x4bcd03,_0x459120[_0x16b8('0x10')][_0x16b8('0x13')]);return _0x507bd4(_0x459120['error']['message']);}logger['error'](_0x16b8('0x12'),_0x4bcd03,_0x459120['error'][_0x16b8('0x13')]);return _0x5ef822(_0x459120[_0x16b8('0x10')][_0x16b8('0x13')]);}else{logger[_0x16b8('0xd')](_0x16b8('0x12'),_0x4bcd03,_0x16b8('0xe'));_0x5ef822(_0x459120[_0x16b8('0x14')][_0x16b8('0x13')]);}})[_0x16b8('0x15')](function(_0x2af7ac){logger[_0x16b8('0x10')](_0x16b8('0x12'),_0x4bcd03,_0x2af7ac);_0x507bd4(_0x2af7ac);});});}exports[_0x16b8('0x16')]=function(_0x3a898a){var _0xa3a9d5=this;return new Promise(function(_0x28cf42,_0x1f03cc){return db[_0x16b8('0x17')][_0x16b8('0x18')](_0x3a898a['body'],{'raw':_0x3a898a[_0x16b8('0x19')]?_0x3a898a[_0x16b8('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x16b8('0xc')](function(_0x1661c6){logger[_0x16b8('0xd')](_0x16b8('0x16'),_0x3a898a);logger[_0x16b8('0xf')](_0x16b8('0x16'),_0x3a898a,JSON['stringify'](_0x1661c6));_0x28cf42(_0x1661c6);})[_0x16b8('0x15')](function(_0xd14216){logger[_0x16b8('0x10')](_0x16b8('0x16'),_0xd14216[_0x16b8('0x13')],_0x3a898a);_0x1f03cc(_0xa3a9d5[_0x16b8('0x10')](0x1f4,_0xd14216[_0x16b8('0x13')]));});});};exports['UpdateVoiceAgentReport']=function(_0x3265af){var _0x420658=this;return new Promise(function(_0x7a2c58,_0x1f8ecd){return db[_0x16b8('0x17')][_0x16b8('0x1a')](_0x3265af[_0x16b8('0x1b')],{'raw':_0x3265af[_0x16b8('0x19')]?_0x3265af[_0x16b8('0x19')][_0x16b8('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3265af['options']?_0x3265af['options'][_0x16b8('0x1d')]||null:null,'attributes':_0x3265af[_0x16b8('0x19')]?_0x3265af['options']['attributes']||null:null,'limit':_0x3265af[_0x16b8('0x19')]?_0x3265af[_0x16b8('0x19')][_0x16b8('0x1e')]||null:null})[_0x16b8('0xc')](function(_0x4161fa){logger['info'](_0x16b8('0x1f'),_0x3265af);logger[_0x16b8('0xf')](_0x16b8('0x1f'),_0x3265af,JSON[_0x16b8('0x20')](_0x4161fa));_0x7a2c58(_0x4161fa);})[_0x16b8('0x15')](function(_0x4a6204){logger[_0x16b8('0x10')](_0x16b8('0x1f'),_0x4a6204['message'],_0x3265af);_0x1f8ecd(_0x420658[_0x16b8('0x10')](0x1f4,_0x4a6204['message']));});});}; \ No newline at end of file +var _0xcb32=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','create','body','options','raw','debug','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring'];(function(_0xbc346f,_0x3db5c0){var _0x9f9260=function(_0x37e6b9){while(--_0x37e6b9){_0xbc346f['push'](_0xbc346f['shift']());}};_0x9f9260(++_0x3db5c0);}(_0xcb32,0x19d));var _0x2cb3=function(_0x7f8abc,_0x85f3ba){_0x7f8abc=_0x7f8abc-0x0;var _0x3d6af8=_0xcb32[_0x7f8abc];return _0x3d6af8;};'use strict';var _=require(_0x2cb3('0x0'));var util=require(_0x2cb3('0x1'));var moment=require(_0x2cb3('0x2'));var BPromise=require(_0x2cb3('0x3'));var rs=require(_0x2cb3('0x4'));var fs=require('fs');var Redis=require(_0x2cb3('0x5'));var db=require(_0x2cb3('0x6'))['db'];var utils=require(_0x2cb3('0x7'));var logger=require(_0x2cb3('0x8'))(_0x2cb3('0x9'));var config=require(_0x2cb3('0xa'));var jayson=require(_0x2cb3('0xb'));var client=jayson[_0x2cb3('0xc')][_0x2cb3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x21bc67,_0x4403d4,_0x1b6590){return new BPromise(function(_0x5ed6ab,_0x17c0af){return client[_0x2cb3('0xe')](_0x21bc67,_0x1b6590)[_0x2cb3('0xf')](function(_0x4f001c){logger[_0x2cb3('0x10')](_0x2cb3('0x11'),_0x4403d4,_0x2cb3('0x12'));logger['debug'](_0x2cb3('0x13'),_0x4403d4,_0x2cb3('0x12'),JSON[_0x2cb3('0x14')](_0x4f001c));if(_0x4f001c[_0x2cb3('0x15')]){if(_0x4f001c[_0x2cb3('0x15')][_0x2cb3('0x16')]===0x1f4){logger[_0x2cb3('0x15')](_0x2cb3('0x11'),_0x4403d4,_0x4f001c[_0x2cb3('0x15')][_0x2cb3('0x17')]);return _0x17c0af(_0x4f001c[_0x2cb3('0x15')][_0x2cb3('0x17')]);}logger[_0x2cb3('0x15')](_0x2cb3('0x11'),_0x4403d4,_0x4f001c[_0x2cb3('0x15')][_0x2cb3('0x17')]);return _0x5ed6ab(_0x4f001c[_0x2cb3('0x15')][_0x2cb3('0x17')]);}else{logger[_0x2cb3('0x10')](_0x2cb3('0x11'),_0x4403d4,_0x2cb3('0x12'));_0x5ed6ab(_0x4f001c[_0x2cb3('0x18')][_0x2cb3('0x17')]);}})[_0x2cb3('0x19')](function(_0x569179){logger[_0x2cb3('0x15')](_0x2cb3('0x11'),_0x4403d4,_0x569179);_0x17c0af(_0x569179);});});}exports[_0x2cb3('0x1a')]=function(_0x196fdd){var _0x58a851=this;return new Promise(function(_0x4285ce,_0x1ba30c){return db['VoiceAgentReport'][_0x2cb3('0x1b')](_0x196fdd[_0x2cb3('0x1c')],{'raw':_0x196fdd[_0x2cb3('0x1d')]?_0x196fdd['options'][_0x2cb3('0x1e')]===undefined?!![]:![]:!![]})[_0x2cb3('0xf')](function(_0x1845d2){logger[_0x2cb3('0x10')](_0x2cb3('0x1a'),_0x196fdd);logger[_0x2cb3('0x1f')](_0x2cb3('0x1a'),_0x196fdd,JSON[_0x2cb3('0x14')](_0x1845d2));_0x4285ce(_0x1845d2);})[_0x2cb3('0x19')](function(_0x460c5b){logger[_0x2cb3('0x15')](_0x2cb3('0x1a'),_0x460c5b['message'],_0x196fdd);_0x1ba30c(_0x58a851['error'](0x1f4,_0x460c5b['message']));});});};exports[_0x2cb3('0x20')]=function(_0x576b6b){var _0x1e816c=this;return new Promise(function(_0xd20b09,_0xc11b6){return db[_0x2cb3('0x21')][_0x2cb3('0x22')](_0x576b6b['body'],{'raw':_0x576b6b[_0x2cb3('0x1d')]?_0x576b6b[_0x2cb3('0x1d')][_0x2cb3('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x576b6b[_0x2cb3('0x1d')]?_0x576b6b[_0x2cb3('0x1d')][_0x2cb3('0x23')]||null:null,'attributes':_0x576b6b[_0x2cb3('0x1d')]?_0x576b6b[_0x2cb3('0x1d')][_0x2cb3('0x24')]||null:null,'limit':_0x576b6b[_0x2cb3('0x1d')]?_0x576b6b['options'][_0x2cb3('0x25')]||null:null})[_0x2cb3('0xf')](function(_0x128086){logger['info']('UpdateVoiceAgentReport',_0x576b6b);logger[_0x2cb3('0x1f')]('UpdateVoiceAgentReport',_0x576b6b,JSON[_0x2cb3('0x14')](_0x128086));_0xd20b09(_0x128086);})[_0x2cb3('0x19')](function(_0x59fbe1){logger['error'](_0x2cb3('0x20'),_0x59fbe1[_0x2cb3('0x17')],_0x576b6b);_0xc11b6(_0x1e816c[_0x2cb3('0x15')](0x1f4,_0x59fbe1[_0x2cb3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 90b5412..aacd84c 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 _0xe107=['/describe','isAuthenticated','describe','create','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','./voiceCallReport.controller','get'];(function(_0x5533eb,_0xb2535b){var _0x3e7d87=function(_0x1a9abf){while(--_0x1a9abf){_0x5533eb['push'](_0x5533eb['shift']());}};_0x3e7d87(++_0xb2535b);}(_0xe107,0xb3));var _0x7e10=function(_0x3ad454,_0x405bd8){_0x3ad454=_0x3ad454-0x0;var _0x17879c=_0xe107[_0x3ad454];return _0x17879c;};'use strict';var multer=require(_0x7e10('0x0'));var util=require('util');var path=require(_0x7e10('0x1'));var timeout=require(_0x7e10('0x2'));var express=require(_0x7e10('0x3'));var router=express['Router']();var fs_extra=require(_0x7e10('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7e10('0x5'));var controller=require(_0x7e10('0x6'));router[_0x7e10('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7e10('0x7')](_0x7e10('0x8'),auth[_0x7e10('0x9')](),controller[_0x7e10('0xa')]);router['get']('/:id',auth[_0x7e10('0x9')](),controller['show']);router['post']('/',auth[_0x7e10('0x9')](),controller[_0x7e10('0xb')]);router[_0x7e10('0xc')](_0x7e10('0xd'),auth[_0x7e10('0x9')](),controller['update']);router[_0x7e10('0xe')]('/:id',auth[_0x7e10('0x9')](),controller[_0x7e10('0xf')]);module[_0x7e10('0x10')]=router; \ No newline at end of file +var _0xe14b=['delete','destroy','exports','multer','util','express','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','show','post','/:id'];(function(_0x4740e9,_0x4729ab){var _0x3acffe=function(_0x28a87b){while(--_0x28a87b){_0x4740e9['push'](_0x4740e9['shift']());}};_0x3acffe(++_0x4729ab);}(_0xe14b,0x93));var _0xbe14=function(_0x357e55,_0x3916a2){_0x357e55=_0x357e55-0x0;var _0x1f0ac4=_0xe14b[_0x357e55];return _0x1f0ac4;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xd')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xe')]);module[_0xbe14('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index dc8abfb..3ce1491 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 _0xe651=['INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','outbound','outbound-fax','dialer','TEXT','DATE'];(function(_0x3d66a5,_0x4ccf66){var _0x1d3d6b=function(_0x1c0b34){while(--_0x1c0b34){_0x3d66a5['push'](_0x3d66a5['shift']());}};_0x1d3d6b(++_0x4ccf66);}(_0xe651,0x1a5));var _0x1e65=function(_0x2bd8cb,_0x29815b){_0x2bd8cb=_0x2bd8cb-0x0;var _0x245b03=_0xe651[_0x2bd8cb];return _0x245b03;};'use strict';var Sequelize=require(_0x1e65('0x0'));module[_0x1e65('0x1')]={'uniqueid':{'type':Sequelize[_0x1e65('0x2')]},'type':{'type':Sequelize[_0x1e65('0x3')](_0x1e65('0x4'),_0x1e65('0x5'),_0x1e65('0x6'),'inbound-fax',_0x1e65('0x7'),_0x1e65('0x8'))},'tag':{'type':Sequelize[_0x1e65('0x2')]},'accountcode':{'type':Sequelize[_0x1e65('0x2')]},'source':{'type':Sequelize[_0x1e65('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x1e65('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x1e65('0x2')]},'lastapplication':{'type':Sequelize[_0x1e65('0x2')]},'lastdata':{'type':Sequelize[_0x1e65('0x9')]},'starttime':{'type':Sequelize[_0x1e65('0xa')]},'systemanswertime':{'type':Sequelize[_0x1e65('0xa')]},'answertime':{'type':Sequelize[_0x1e65('0xa')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x1e65('0xb')]},'billableseconds':{'type':Sequelize[_0x1e65('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1e65('0x2')]},'amaflags':{'type':Sequelize[_0x1e65('0x2')]},'userfield':{'type':Sequelize[_0x1e65('0x2')]},'userDisposition':{'type':Sequelize[_0x1e65('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x1e65('0x2')]},'note':{'type':Sequelize[_0x1e65('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x1e65('0xb')]},'sipcallid':{'type':Sequelize[_0x1e65('0x2')]}}; \ No newline at end of file +var _0xbc87=['STRING','TEXT','DATE','INTEGER','sequelize','ENUM','inbound','internal','outbound-fax','dialer'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xbc87,0x144));var _0x7bc8=function(_0xe86b07,_0x28ad1f){_0xe86b07=_0xe86b07-0x0;var _0x128e88=_0xbc87[_0xe86b07];return _0x128e88;};'use strict';var Sequelize=require(_0x7bc8('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7bc8('0x1')](_0x7bc8('0x2'),_0x7bc8('0x3'),'outbound','inbound-fax',_0x7bc8('0x4'),_0x7bc8('0x5'))},'tag':{'type':Sequelize[_0x7bc8('0x6')]},'accountcode':{'type':Sequelize[_0x7bc8('0x6')]},'source':{'type':Sequelize[_0x7bc8('0x6')]},'destination':{'type':Sequelize[_0x7bc8('0x6')]},'destinationcontext':{'type':Sequelize[_0x7bc8('0x6')]},'callerid':{'type':Sequelize[_0x7bc8('0x6')]},'channel':{'type':Sequelize[_0x7bc8('0x6')]},'destinationchannel':{'type':Sequelize[_0x7bc8('0x6')]},'lastapplication':{'type':Sequelize[_0x7bc8('0x6')]},'lastdata':{'type':Sequelize[_0x7bc8('0x7')]},'starttime':{'type':Sequelize[_0x7bc8('0x8')]},'systemanswertime':{'type':Sequelize[_0x7bc8('0x8')]},'answertime':{'type':Sequelize[_0x7bc8('0x8')]},'endtime':{'type':Sequelize[_0x7bc8('0x8')]},'duration':{'type':Sequelize[_0x7bc8('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x7bc8('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7bc8('0x6')]},'userfield':{'type':Sequelize[_0x7bc8('0x6')]},'userDisposition':{'type':Sequelize[_0x7bc8('0x6')]},'userSecondDisposition':{'type':Sequelize[_0x7bc8('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x7bc8('0x6')]},'note':{'type':Sequelize[_0x7bc8('0x6')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x7bc8('0x9')]},'sipcallid':{'type':Sequelize[_0x7bc8('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 7e04777..bcfcadd 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 _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file +var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x10cf43,_0x39bb82){_0x10cf43=_0x10cf43-0x0;var _0x154ea5=_0x2032[_0x10cf43];return _0x154ea5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 28f4ea1..24d7d65 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 _0xbc9b=['util','api','moment','bluebird','rimraf','../../config/environment','./voiceCallReport.attributes','report_call','lodash'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xbc9b,0x1d3));var _0xbbc9=function(_0x1c6027,_0xf3455c){_0x1c6027=_0x1c6027-0x0;var _0xe896fb=_0xbc9b[_0x1c6027];return _0xe896fb;};'use strict';var _=require(_0xbbc9('0x0'));var util=require(_0xbbc9('0x1'));var logger=require('../../config/logger')(_0xbbc9('0x2'));var moment=require(_0xbbc9('0x3'));var BPromise=require(_0xbbc9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbbc9('0x5'));var config=require(_0xbbc9('0x6'));var attributes=require(_0xbbc9('0x7'));module['exports']=function(_0x59b818,_0xdaa3f5){return _0x59b818['define']('VoiceCallReport',attributes,{'tableName':_0xbbc9('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe444=['request-promise','../../config/environment','exports','define','VoiceCallReport','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x327866,_0x54eded){var _0x17f0e3=function(_0x25b495){while(--_0x25b495){_0x327866['push'](_0x327866['shift']());}};_0x17f0e3(++_0x54eded);}(_0xe444,0x196));var _0x4e44=function(_0x25ba73,_0x151da9){_0x25ba73=_0x25ba73-0x0;var _0x5afaa6=_0xe444[_0x25ba73];return _0x5afaa6;};'use strict';var _=require(_0x4e44('0x0'));var util=require('util');var logger=require(_0x4e44('0x1'))(_0x4e44('0x2'));var moment=require(_0x4e44('0x3'));var BPromise=require('bluebird');var rp=require(_0x4e44('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4e44('0x5'));var attributes=require('./voiceCallReport.attributes');module[_0x4e44('0x6')]=function(_0x2897c0,_0x40a83f){return _0x2897c0[_0x4e44('0x7')](_0x4e44('0x8'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x4e44('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 3d85d1c..7c17416 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 _0x6868=['body','raw','update','UpdateVoiceCallReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','VoiceCallReport,\x20%s,\x20%s','message','result','GetVoiceCallReport','VoiceCallReport','options','where','attributes','limit','include','map','model','stringify','catch','CreateVoiceCallReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6868,0xb8));var _0x8686=function(_0x56b319,_0xab0466){_0x56b319=_0x56b319-0x0;var _0x4dc7c0=_0x6868[_0x56b319];return _0x4dc7c0;};'use strict';var _=require(_0x8686('0x0'));var util=require(_0x8686('0x1'));var moment=require(_0x8686('0x2'));var BPromise=require(_0x8686('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8686('0x4'));var db=require(_0x8686('0x5'))['db'];var utils=require(_0x8686('0x6'));var logger=require('../../config/logger')(_0x8686('0x7'));var config=require(_0x8686('0x8'));var jayson=require(_0x8686('0x9'));var client=jayson[_0x8686('0xa')][_0x8686('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22df68,_0x580754,_0x3acc8f){return new BPromise(function(_0x5e0bd5,_0x8880b3){return client['request'](_0x22df68,_0x3acc8f)[_0x8686('0xc')](function(_0x2964a1){logger[_0x8686('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x580754,_0x8686('0xe'));logger['debug'](_0x8686('0xf'),_0x580754,_0x8686('0xe'),JSON['stringify'](_0x2964a1));if(_0x2964a1[_0x8686('0x10')]){if(_0x2964a1['error']['code']===0x1f4){logger[_0x8686('0x10')](_0x8686('0x11'),_0x580754,_0x2964a1[_0x8686('0x10')][_0x8686('0x12')]);return _0x8880b3(_0x2964a1['error'][_0x8686('0x12')]);}logger[_0x8686('0x10')](_0x8686('0x11'),_0x580754,_0x2964a1[_0x8686('0x10')][_0x8686('0x12')]);return _0x5e0bd5(_0x2964a1['error'][_0x8686('0x12')]);}else{logger[_0x8686('0xd')](_0x8686('0x11'),_0x580754,_0x8686('0xe'));_0x5e0bd5(_0x2964a1[_0x8686('0x13')][_0x8686('0x12')]);}})['catch'](function(_0x2247ea){logger[_0x8686('0x10')](_0x8686('0x11'),_0x580754,_0x2247ea);_0x8880b3(_0x2247ea);});});}exports[_0x8686('0x14')]=function(_0x6e8c11){var _0x2c8661=this;return new Promise(function(_0x54d7c8,_0x4b9c7f){return db[_0x8686('0x15')]['findAll']({'raw':_0x6e8c11[_0x8686('0x16')]?_0x6e8c11['options']['raw']===undefined?!![]:![]:!![],'where':_0x6e8c11['options']?_0x6e8c11[_0x8686('0x16')][_0x8686('0x17')]||null:null,'attributes':_0x6e8c11[_0x8686('0x16')]?_0x6e8c11[_0x8686('0x16')][_0x8686('0x18')]||null:null,'limit':_0x6e8c11['options']?_0x6e8c11[_0x8686('0x16')][_0x8686('0x19')]||null:null,'include':_0x6e8c11[_0x8686('0x16')]?_0x6e8c11[_0x8686('0x16')][_0x8686('0x1a')]?_[_0x8686('0x1b')](_0x6e8c11[_0x8686('0x16')][_0x8686('0x1a')],function(_0x96dd73){return{'model':db[_0x96dd73[_0x8686('0x1c')]],'as':_0x96dd73['as'],'attributes':_0x96dd73['attributes'],'include':_0x96dd73[_0x8686('0x1a')]?_[_0x8686('0x1b')](_0x96dd73[_0x8686('0x1a')],function(_0xbdc1e7){return{'model':db[_0xbdc1e7[_0x8686('0x1c')]],'as':_0xbdc1e7['as'],'attributes':_0xbdc1e7[_0x8686('0x18')],'include':_0xbdc1e7[_0x8686('0x1a')]?_['map'](_0xbdc1e7[_0x8686('0x1a')],function(_0x1d5014){return{'model':db[_0x1d5014[_0x8686('0x1c')]],'as':_0x1d5014['as'],'attributes':_0x1d5014[_0x8686('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8686('0xc')](function(_0x14d55a){logger['info'](_0x8686('0x14'),_0x6e8c11);logger['debug'](_0x8686('0x14'),_0x6e8c11,JSON[_0x8686('0x1d')](_0x14d55a));_0x54d7c8(_0x14d55a);})[_0x8686('0x1e')](function(_0x1f28a4){logger[_0x8686('0x10')]('GetVoiceCallReport',_0x1f28a4[_0x8686('0x12')],_0x6e8c11);_0x4b9c7f(_0x2c8661[_0x8686('0x10')](0x1f4,_0x1f28a4[_0x8686('0x12')]));});});};exports[_0x8686('0x1f')]=function(_0xe8371c){var _0x1fac31=this;return new Promise(function(_0x390745,_0x47cefe){return db[_0x8686('0x15')]['create'](_0xe8371c[_0x8686('0x20')],{'raw':_0xe8371c[_0x8686('0x16')]?_0xe8371c['options'][_0x8686('0x21')]===undefined?!![]:![]:!![]})[_0x8686('0xc')](function(_0x1ea845){logger['info'](_0x8686('0x1f'),_0xe8371c);logger['debug'](_0x8686('0x1f'),_0xe8371c,JSON[_0x8686('0x1d')](_0x1ea845));_0x390745(_0x1ea845);})[_0x8686('0x1e')](function(_0x3f46a6){logger[_0x8686('0x10')]('CreateVoiceCallReport',_0x3f46a6[_0x8686('0x12')],_0xe8371c);_0x47cefe(_0x1fac31[_0x8686('0x10')](0x1f4,_0x3f46a6['message']));});});};exports['UpdateVoiceCallReport']=function(_0x25c472){var _0x4d84be=this;return new Promise(function(_0x24a618,_0x416135){return db['VoiceCallReport'][_0x8686('0x22')](_0x25c472['body'],{'raw':_0x25c472['options']?_0x25c472['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25c472[_0x8686('0x16')]?_0x25c472[_0x8686('0x16')][_0x8686('0x17')]||null:null,'attributes':_0x25c472[_0x8686('0x16')]?_0x25c472[_0x8686('0x16')]['attributes']||null:null,'limit':_0x25c472[_0x8686('0x16')]?_0x25c472[_0x8686('0x16')]['limit']||null:null})[_0x8686('0xc')](function(_0x1c6cad){logger[_0x8686('0xd')](_0x8686('0x23'),_0x25c472);logger['debug'](_0x8686('0x23'),_0x25c472,JSON['stringify'](_0x1c6cad));_0x24a618(_0x1c6cad);})[_0x8686('0x1e')](function(_0x35fb04){logger[_0x8686('0x10')](_0x8686('0x23'),_0x35fb04['message'],_0x25c472);_0x416135(_0x4d84be[_0x8686('0x10')](0x1f4,_0x35fb04['message']));});});}; \ No newline at end of file +var _0x094e=['client','http','request','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceCallReport,\x20%s,\x20%s','result','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','map','model','include','then','catch','create','body','CreateVoiceCallReport','update','UpdateVoiceCallReport','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x511f0b,_0x194864){var _0x4bcb4a=function(_0x4554ed){while(--_0x4554ed){_0x511f0b['push'](_0x511f0b['shift']());}};_0x4bcb4a(++_0x194864);}(_0x094e,0xbe));var _0xe094=function(_0x3cc3b1,_0x5b94e2){_0x3cc3b1=_0x3cc3b1-0x0;var _0x293104=_0x094e[_0x3cc3b1];return _0x293104;};'use strict';var _=require(_0xe094('0x0'));var util=require('util');var moment=require(_0xe094('0x1'));var BPromise=require('bluebird');var rs=require(_0xe094('0x2'));var fs=require('fs');var Redis=require(_0xe094('0x3'));var db=require(_0xe094('0x4'))['db'];var utils=require(_0xe094('0x5'));var logger=require(_0xe094('0x6'))(_0xe094('0x7'));var config=require(_0xe094('0x8'));var jayson=require(_0xe094('0x9'));var client=jayson[_0xe094('0xa')][_0xe094('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16ac99,_0x2ad933,_0x146863){return new BPromise(function(_0x2efd9b,_0x29692f){return client[_0xe094('0xc')](_0x16ac99,_0x146863)['then'](function(_0x3e97aa){logger[_0xe094('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x2ad933,_0xe094('0xe'));logger[_0xe094('0xf')](_0xe094('0x10'),_0x2ad933,_0xe094('0xe'),JSON[_0xe094('0x11')](_0x3e97aa));if(_0x3e97aa['error']){if(_0x3e97aa[_0xe094('0x12')][_0xe094('0x13')]===0x1f4){logger[_0xe094('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x2ad933,_0x3e97aa['error'][_0xe094('0x14')]);return _0x29692f(_0x3e97aa[_0xe094('0x12')][_0xe094('0x14')]);}logger[_0xe094('0x12')](_0xe094('0x15'),_0x2ad933,_0x3e97aa[_0xe094('0x12')][_0xe094('0x14')]);return _0x2efd9b(_0x3e97aa[_0xe094('0x12')][_0xe094('0x14')]);}else{logger['info'](_0xe094('0x15'),_0x2ad933,'request\x20sent');_0x2efd9b(_0x3e97aa[_0xe094('0x16')][_0xe094('0x14')]);}})['catch'](function(_0x1cff2c){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x2ad933,_0x1cff2c);_0x29692f(_0x1cff2c);});});}exports[_0xe094('0x17')]=function(_0x44e468){var _0x36be95=this;return new Promise(function(_0x20601c,_0x59e9bd){return db[_0xe094('0x18')]['findAll']({'raw':_0x44e468[_0xe094('0x19')]?_0x44e468[_0xe094('0x19')][_0xe094('0x1a')]===undefined?!![]:![]:!![],'where':_0x44e468[_0xe094('0x19')]?_0x44e468['options'][_0xe094('0x1b')]||null:null,'attributes':_0x44e468['options']?_0x44e468[_0xe094('0x19')][_0xe094('0x1c')]||null:null,'limit':_0x44e468[_0xe094('0x19')]?_0x44e468[_0xe094('0x19')][_0xe094('0x1d')]||null:null,'include':_0x44e468[_0xe094('0x19')]?_0x44e468[_0xe094('0x19')]['include']?_[_0xe094('0x1e')](_0x44e468['options']['include'],function(_0x394278){return{'model':db[_0x394278[_0xe094('0x1f')]],'as':_0x394278['as'],'attributes':_0x394278[_0xe094('0x1c')],'include':_0x394278[_0xe094('0x20')]?_[_0xe094('0x1e')](_0x394278['include'],function(_0x336d55){return{'model':db[_0x336d55[_0xe094('0x1f')]],'as':_0x336d55['as'],'attributes':_0x336d55[_0xe094('0x1c')],'include':_0x336d55[_0xe094('0x20')]?_[_0xe094('0x1e')](_0x336d55['include'],function(_0x440443){return{'model':db[_0x440443[_0xe094('0x1f')]],'as':_0x440443['as'],'attributes':_0x440443[_0xe094('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe094('0x21')](function(_0x2327a3){logger['info']('GetVoiceCallReport',_0x44e468);logger[_0xe094('0xf')](_0xe094('0x17'),_0x44e468,JSON[_0xe094('0x11')](_0x2327a3));_0x20601c(_0x2327a3);})[_0xe094('0x22')](function(_0x3ede13){logger['error'](_0xe094('0x17'),_0x3ede13[_0xe094('0x14')],_0x44e468);_0x59e9bd(_0x36be95[_0xe094('0x12')](0x1f4,_0x3ede13[_0xe094('0x14')]));});});};exports['CreateVoiceCallReport']=function(_0x1c68f0){var _0x2a7b99=this;return new Promise(function(_0x55d515,_0x559d61){return db[_0xe094('0x18')][_0xe094('0x23')](_0x1c68f0[_0xe094('0x24')],{'raw':_0x1c68f0[_0xe094('0x19')]?_0x1c68f0[_0xe094('0x19')][_0xe094('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x17b275){logger[_0xe094('0xd')](_0xe094('0x25'),_0x1c68f0);logger[_0xe094('0xf')]('CreateVoiceCallReport',_0x1c68f0,JSON[_0xe094('0x11')](_0x17b275));_0x55d515(_0x17b275);})[_0xe094('0x22')](function(_0x1371a1){logger['error']('CreateVoiceCallReport',_0x1371a1[_0xe094('0x14')],_0x1c68f0);_0x559d61(_0x2a7b99[_0xe094('0x12')](0x1f4,_0x1371a1[_0xe094('0x14')]));});});};exports['UpdateVoiceCallReport']=function(_0x63c700){var _0x5c6649=this;return new Promise(function(_0x2ceab9,_0x355333){return db['VoiceCallReport'][_0xe094('0x26')](_0x63c700[_0xe094('0x24')],{'raw':_0x63c700[_0xe094('0x19')]?_0x63c700[_0xe094('0x19')][_0xe094('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x63c700[_0xe094('0x19')]?_0x63c700['options'][_0xe094('0x1b')]||null:null,'attributes':_0x63c700[_0xe094('0x19')]?_0x63c700[_0xe094('0x19')][_0xe094('0x1c')]||null:null,'limit':_0x63c700[_0xe094('0x19')]?_0x63c700['options'][_0xe094('0x1d')]||null:null})[_0xe094('0x21')](function(_0x426379){logger[_0xe094('0xd')](_0xe094('0x27'),_0x63c700);logger[_0xe094('0xf')](_0xe094('0x27'),_0x63c700,JSON['stringify'](_0x426379));_0x2ceab9(_0x426379);})['catch'](function(_0x3b1f01){logger[_0xe094('0x12')]('UpdateVoiceCallReport',_0x3b1f01['message'],_0x63c700);_0x355333(_0x5c6649[_0xe094('0x12')](0x1f4,_0x3b1f01[_0xe094('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 39f2ebe..dc3ce50 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 _0xb879=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer'];(function(_0x5452e,_0x589c19){var _0x53beb2=function(_0x1dbc1c){while(--_0x1dbc1c){_0x5452e['push'](_0x5452e['shift']());}};_0x53beb2(++_0x589c19);}(_0xb879,0x9f));var _0x9b87=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb879[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x9b87('0x0'));var util=require(_0x9b87('0x1'));var path=require(_0x9b87('0x2'));var timeout=require(_0x9b87('0x3'));var express=require(_0x9b87('0x4'));var router=express[_0x9b87('0x5')]();var fs_extra=require(_0x9b87('0x6'));var auth=require(_0x9b87('0x7'));var interaction=require(_0x9b87('0x8'));var config=require('../../config/environment');var controller=require(_0x9b87('0x9'));router[_0x9b87('0xa')]('/',auth['isAuthenticated'](),controller[_0x9b87('0xb')]);router[_0x9b87('0xa')](_0x9b87('0xc'),auth[_0x9b87('0xd')](),controller[_0x9b87('0xe')]);router['post']('/',auth[_0x9b87('0xd')](),controller['create']);router[_0x9b87('0xf')](_0x9b87('0xc'),auth[_0x9b87('0xd')](),controller[_0x9b87('0x10')]);router[_0x9b87('0x11')](_0x9b87('0xc'),auth[_0x9b87('0xd')](),controller[_0x9b87('0x12')]);module[_0x9b87('0x13')]=router; \ No newline at end of file +var _0x247f=['../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','show','post','create','put','delete','/:id','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x5eff3c,_0x1270c3){var _0xaa9aba=function(_0x40478e){while(--_0x40478e){_0x5eff3c['push'](_0x5eff3c['shift']());}};_0xaa9aba(++_0x1270c3);}(_0x247f,0x1a9));var _0xf247=function(_0x4b16a6,_0x33051c){_0x4b16a6=_0x4b16a6-0x0;var _0x4b767b=_0x247f[_0x4b16a6];return _0x4b767b;};'use strict';var multer=require(_0xf247('0x0'));var util=require(_0xf247('0x1'));var path=require(_0xf247('0x2'));var timeout=require(_0xf247('0x3'));var express=require('express');var router=express[_0xf247('0x4')]();var fs_extra=require(_0xf247('0x5'));var auth=require(_0xf247('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf247('0x7'));var controller=require(_0xf247('0x8'));router[_0xf247('0x9')]('/',auth[_0xf247('0xa')](),controller[_0xf247('0xb')]);router[_0xf247('0x9')]('/:id',auth[_0xf247('0xa')](),controller[_0xf247('0xc')]);router[_0xf247('0xd')]('/',auth[_0xf247('0xa')](),controller[_0xf247('0xe')]);router[_0xf247('0xf')]('/:id',auth[_0xf247('0xa')](),controller['update']);router[_0xf247('0x10')](_0xf247('0x11'),auth[_0xf247('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index adf447d..a867922 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 _0x6503=['STRING','name','options','join','getDataValue','split','BOOLEAN','sequelize'];(function(_0x4d12ab,_0x237068){var _0x54d3ef=function(_0x3f92a0){while(--_0x3f92a0){_0x4d12ab['push'](_0x4d12ab['shift']());}};_0x54d3ef(++_0x237068);}(_0x6503,0x16f));var _0x3650=function(_0x49331c,_0x5a0f4d){_0x49331c=_0x49331c-0x0;var _0x200932=_0x6503[_0x49331c];return _0x200932;};'use strict';var Sequelize=require(_0x3650('0x0'));module['exports']={'name':{'type':Sequelize[_0x3650('0x1')]},'prefix':{'type':Sequelize[_0x3650('0x1')],'unique':_0x3650('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x3650('0x1')],'set':function(_0x1b3622){this['setDataValue'](_0x3650('0x3'),_0x1b3622?_0x1b3622[_0x3650('0x4')](''):[]);},'get':function(){return this[_0x3650('0x5')](_0x3650('0x3'))?this[_0x3650('0x5')](_0x3650('0x3'))[_0x3650('0x6')](''):[];}},'auth':{'type':Sequelize[_0x3650('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x3650('0x1')]},'record':{'type':Sequelize[_0x3650('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x3650('0x1')]},'description':{'type':Sequelize[_0x3650('0x1')]}}; \ No newline at end of file +var _0x0dfc=['join','getDataValue','BOOLEAN','exports','name','STRING','setDataValue','options'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x0dfc,0x123));var _0xc0df=function(_0x43a23a,_0x582599){_0x43a23a=_0x43a23a-0x0;var _0x37adad=_0x0dfc[_0x43a23a];return _0x37adad;};'use strict';var Sequelize=require('sequelize');module[_0xc0df('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0xc0df('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0xc0df('0x2')],'set':function(_0x46bed7){this[_0xc0df('0x3')](_0xc0df('0x4'),_0x46bed7?_0x46bed7[_0xc0df('0x5')](''):[]);},'get':function(){return this[_0xc0df('0x6')](_0xc0df('0x4'))?this[_0xc0df('0x6')](_0xc0df('0x4'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xc0df('0x2')]},'record':{'type':Sequelize[_0xc0df('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xc0df('0x2')]},'description':{'type':Sequelize[_0xc0df('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index e62ba26..fd891ef 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 _0xa769=['include','catch','show','params','keys','length','includeAll','find','create','user','role','get','ChanSpies','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xa769,0xfb));var _0x9a76=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa769[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require(_0x9a76('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a76('0x1'));var jsonpatch=require(_0x9a76('0x2'));var rp=require(_0x9a76('0x3'));var moment=require('moment');var BPromise=require(_0x9a76('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9a76('0x5'));var sox=require(_0x9a76('0x6'));var csv=require('to-csv');var ejs=require(_0x9a76('0x7'));var fs=require('fs');var fs_extra=require(_0x9a76('0x8'));var _=require(_0x9a76('0x9'));var squel=require(_0x9a76('0xa'));var crypto=require(_0x9a76('0xb'));var jsforce=require(_0x9a76('0xc'));var deskjs=require(_0x9a76('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9a76('0xe'));var Papa=require(_0x9a76('0xf'));var Redis=require(_0x9a76('0x10'));var authService=require(_0x9a76('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a76('0x12'));var logger=require('../../config/logger')(_0x9a76('0x13'));var utils=require(_0x9a76('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9a76('0x15'));var db=require(_0x9a76('0x16'))['db'];function respondWithStatusCode(_0x5852f9,_0x34b7c9){_0x34b7c9=_0x34b7c9||0xcc;return function(_0x30d1be){if(_0x30d1be){return _0x5852f9[_0x9a76('0x17')](_0x34b7c9);}return _0x5852f9[_0x9a76('0x18')](_0x34b7c9)[_0x9a76('0x19')]();};}function respondWithResult(_0xbb0dda,_0x204e33){_0x204e33=_0x204e33||0xc8;return function(_0x28ebac){if(_0x28ebac){return _0xbb0dda[_0x9a76('0x18')](_0x204e33)[_0x9a76('0x1a')](_0x28ebac);}};}function respondWithFilteredResult(_0x42cd61,_0x259664){return function(_0x1e687a){if(_0x1e687a){var _0x54028e=typeof _0x259664[_0x9a76('0x1b')]==='undefined'&&typeof _0x259664[_0x9a76('0x1c')]===_0x9a76('0x1d');var _0x140b08=_0x1e687a[_0x9a76('0x1e')];var _0x38e509=_0x54028e?0x0:_0x259664[_0x9a76('0x1b')];var _0x58a964=_0x54028e?_0x1e687a['count']:_0x259664[_0x9a76('0x1b')]+_0x259664[_0x9a76('0x1c')];var _0x248dcb;if(_0x58a964>=_0x140b08){_0x58a964=_0x140b08;_0x248dcb=0xc8;}else{_0x248dcb=0xce;}_0x42cd61[_0x9a76('0x18')](_0x248dcb);return _0x42cd61[_0x9a76('0x1f')](_0x9a76('0x20'),_0x38e509+'-'+_0x58a964+'/'+_0x140b08)['json'](_0x1e687a);}return null;};}function patchUpdates(_0x17de93){return function(_0x3ebe6c){try{jsonpatch['apply'](_0x3ebe6c,_0x17de93,!![]);}catch(_0x2e9dcf){return BPromise[_0x9a76('0x21')](_0x2e9dcf);}return _0x3ebe6c['save']();};}function saveUpdates(_0x3adc8e,_0x35b608){return function(_0x3e978f){if(_0x3e978f){return _0x3e978f[_0x9a76('0x22')](_0x3adc8e)[_0x9a76('0x23')](function(_0x4a40bf){return _0x4a40bf;});}return null;};}function removeEntity(_0x1a4667,_0x5c3afa){return function(_0x523727){if(_0x523727){return _0x523727[_0x9a76('0x24')]()[_0x9a76('0x23')](function(){var _0x4c9391=_0x523727['get']({'plain':!![]});var _0x3d7f2b='ChanSpies';return db['UserProfileResource'][_0x9a76('0x24')]({'where':{'type':_0x3d7f2b,'resourceId':_0x4c9391['id']}})['then'](function(){return _0x523727;});})[_0x9a76('0x23')](function(){_0x1a4667[_0x9a76('0x18')](0xcc)[_0x9a76('0x19')]();});}};}function handleEntityNotFound(_0x2d141a,_0x43ffc7){return function(_0x3d228d){if(!_0x3d228d){_0x2d141a[_0x9a76('0x17')](0x194);}return _0x3d228d;};}function handleError(_0x962bc4,_0x57152c){_0x57152c=_0x57152c||0x1f4;return function(_0x42c35b){logger['error'](_0x42c35b[_0x9a76('0x25')]);if(_0x42c35b[_0x9a76('0x26')]){delete _0x42c35b[_0x9a76('0x26')];}_0x962bc4['status'](_0x57152c)[_0x9a76('0x27')](_0x42c35b);};}exports[_0x9a76('0x28')]=function(_0x36ad86,_0x3289b3){var _0x266e54={},_0x26fbaa={},_0x50956f={'count':0x0,'rows':[]};var _0x318d2d=_[_0x9a76('0x29')](db[_0x9a76('0x2a')][_0x9a76('0x2b')],function(_0x4d9f6e){return{'name':_0x4d9f6e[_0x9a76('0x2c')],'type':_0x4d9f6e[_0x9a76('0x2d')][_0x9a76('0x2e')]};});_0x26fbaa['model']=_[_0x9a76('0x29')](_0x318d2d,_0x9a76('0x26'));_0x26fbaa[_0x9a76('0x2f')]=_['keys'](_0x36ad86[_0x9a76('0x2f')]);_0x26fbaa[_0x9a76('0x30')]=_[_0x9a76('0x31')](_0x26fbaa[_0x9a76('0x32')],_0x26fbaa[_0x9a76('0x2f')]);_0x266e54['attributes']=_[_0x9a76('0x31')](_0x26fbaa['model'],qs[_0x9a76('0x33')](_0x36ad86[_0x9a76('0x2f')][_0x9a76('0x33')]));_0x266e54['attributes']=_0x266e54['attributes']['length']?_0x266e54[_0x9a76('0x34')]:_0x26fbaa[_0x9a76('0x32')];if(!_0x36ad86['query'][_0x9a76('0x35')](_0x9a76('0x36'))){_0x266e54[_0x9a76('0x1c')]=qs[_0x9a76('0x1c')](_0x36ad86[_0x9a76('0x2f')][_0x9a76('0x1c')]);_0x266e54['offset']=qs[_0x9a76('0x1b')](_0x36ad86['query'][_0x9a76('0x1b')]);}_0x266e54['order']=qs[_0x9a76('0x37')](_0x36ad86['query'][_0x9a76('0x37')]);_0x266e54[_0x9a76('0x38')]=qs[_0x9a76('0x30')](_['pick'](_0x36ad86['query'],_0x26fbaa[_0x9a76('0x30')]),_0x318d2d);if(_0x36ad86['query'][_0x9a76('0x39')]){_0x266e54[_0x9a76('0x38')]=_[_0x9a76('0x3a')](_0x266e54[_0x9a76('0x38')],{'$or':_['map'](_0x318d2d,function(_0x2ac6ec){if(_0x2ac6ec['type']!==_0x9a76('0x3b')){var _0x4f6970={};_0x4f6970[_0x2ac6ec[_0x9a76('0x26')]]={'$like':'%'+_0x36ad86[_0x9a76('0x2f')][_0x9a76('0x39')]+'%'};return _0x4f6970;}})});}_0x266e54=_[_0x9a76('0x3a')]({},_0x266e54,_0x36ad86[_0x9a76('0x3c')]);var _0x39358c={'where':_0x266e54[_0x9a76('0x38')]};return db[_0x9a76('0x2a')][_0x9a76('0x1e')](_0x39358c)[_0x9a76('0x23')](function(_0x56145d){_0x50956f[_0x9a76('0x1e')]=_0x56145d;if(_0x36ad86['query']['includeAll']){_0x266e54[_0x9a76('0x3d')]=[{'all':!![]}];}return db[_0x9a76('0x2a')]['findAll'](_0x266e54);})[_0x9a76('0x23')](function(_0x4a32ca){_0x50956f['rows']=_0x4a32ca;return _0x50956f;})[_0x9a76('0x23')](respondWithFilteredResult(_0x3289b3,_0x266e54))[_0x9a76('0x3e')](handleError(_0x3289b3,null));};exports[_0x9a76('0x3f')]=function(_0x2d372f,_0x168e2d){var _0x4a750d={'raw':![],'where':{'id':_0x2d372f[_0x9a76('0x40')]['id']}},_0x15f3e6={};_0x15f3e6[_0x9a76('0x32')]=_[_0x9a76('0x41')](db[_0x9a76('0x2a')]['rawAttributes']);_0x15f3e6[_0x9a76('0x2f')]=_[_0x9a76('0x41')](_0x2d372f[_0x9a76('0x2f')]);_0x15f3e6[_0x9a76('0x30')]=_[_0x9a76('0x31')](_0x15f3e6['model'],_0x15f3e6[_0x9a76('0x2f')]);_0x4a750d[_0x9a76('0x34')]=_[_0x9a76('0x31')](_0x15f3e6['model'],qs[_0x9a76('0x33')](_0x2d372f[_0x9a76('0x2f')][_0x9a76('0x33')]));_0x4a750d[_0x9a76('0x34')]=_0x4a750d[_0x9a76('0x34')][_0x9a76('0x42')]?_0x4a750d['attributes']:_0x15f3e6[_0x9a76('0x32')];if(_0x2d372f[_0x9a76('0x2f')][_0x9a76('0x43')]){_0x4a750d[_0x9a76('0x3d')]=[{'all':!![]}];}_0x4a750d=_[_0x9a76('0x3a')]({},_0x4a750d,_0x2d372f['options']);return db['VoiceChanSpy'][_0x9a76('0x44')](_0x4a750d)[_0x9a76('0x23')](handleEntityNotFound(_0x168e2d,null))['then'](respondWithResult(_0x168e2d,null))['catch'](handleError(_0x168e2d,null));};exports[_0x9a76('0x45')]=function(_0x1dd4fd,_0x17cc8f){return db[_0x9a76('0x2a')][_0x9a76('0x45')](_0x1dd4fd['body'],{})[_0x9a76('0x23')](function(_0x5768c8){var _0x547bcb=_0x1dd4fd[_0x9a76('0x46')]['get']({'plain':!![]});if(!_0x547bcb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x547bcb[_0x9a76('0x47')]===_0x9a76('0x46')){var _0x5216b9=_0x5768c8[_0x9a76('0x48')]({'plain':!![]});var _0x95d953=_0x9a76('0x49');return db['UserProfileSection'][_0x9a76('0x44')]({'where':{'name':_0x95d953,'userProfileId':_0x547bcb['userProfileId']},'raw':!![]})[_0x9a76('0x23')](function(_0x5da34d){if(_0x5da34d&&_0x5da34d['autoAssociation']===0x0){return db[_0x9a76('0x4a')][_0x9a76('0x45')]({'name':_0x5216b9[_0x9a76('0x26')],'resourceId':_0x5216b9['id'],'type':_0x5da34d['name'],'sectionId':_0x5da34d['id']},{})['then'](function(){return _0x5768c8;});}else{return _0x5768c8;}})[_0x9a76('0x3e')](function(_0x3d1d86){logger[_0x9a76('0x4b')](_0x9a76('0x4c'),_0x3d1d86);throw _0x3d1d86;});}return _0x5768c8;})[_0x9a76('0x23')](respondWithResult(_0x17cc8f,0xc9))[_0x9a76('0x3e')](handleError(_0x17cc8f,null));};exports['update']=function(_0x1cd9b2,_0x39a2eb){if(_0x1cd9b2[_0x9a76('0x4d')]['id']){delete _0x1cd9b2[_0x9a76('0x4d')]['id'];}return db[_0x9a76('0x2a')][_0x9a76('0x44')]({'where':{'id':_0x1cd9b2[_0x9a76('0x40')]['id']}})['then'](handleEntityNotFound(_0x39a2eb,null))[_0x9a76('0x23')](saveUpdates(_0x1cd9b2[_0x9a76('0x4d')],null))[_0x9a76('0x23')](respondWithResult(_0x39a2eb,null))['catch'](handleError(_0x39a2eb,null));};exports[_0x9a76('0x24')]=function(_0x40383f,_0x47e0d9){return db['VoiceChanSpy']['find']({'where':{'id':_0x40383f['params']['id']}})[_0x9a76('0x23')](handleEntityNotFound(_0x47e0d9,null))[_0x9a76('0x23')](removeEntity(_0x47e0d9,null))[_0x9a76('0x3e')](handleError(_0x47e0d9,null));}; \ No newline at end of file +var _0xb492=['model','attributes','fields','hasOwnProperty','sort','pick','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','length','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','ChanSpies','UserProfileResource','then','error','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','key','query','keys','filters','intersection'];(function(_0x363a5f,_0x1c57ef){var _0x595004=function(_0x26cd51){while(--_0x26cd51){_0x363a5f['push'](_0x363a5f['shift']());}};_0x595004(++_0x1c57ef);}(_0xb492,0x172));var _0x2b49=function(_0x296297,_0x38f373){_0x296297=_0x296297-0x0;var _0x1cce18=_0xb492[_0x296297];return _0x1cce18;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b49('0x0'));var zipdir=require(_0x2b49('0x1'));var jsonpatch=require(_0x2b49('0x2'));var rp=require(_0x2b49('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2b49('0x4'));var util=require(_0x2b49('0x5'));var path=require(_0x2b49('0x6'));var sox=require(_0x2b49('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b49('0x8'));var _=require(_0x2b49('0x9'));var squel=require(_0x2b49('0xa'));var crypto=require(_0x2b49('0xb'));var jsforce=require(_0x2b49('0xc'));var deskjs=require(_0x2b49('0xd'));var toCsv=require(_0x2b49('0xe'));var querystring=require(_0x2b49('0xf'));var Papa=require('papaparse');var Redis=require(_0x2b49('0x10'));var authService=require(_0x2b49('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2b49('0x12'));var hardwareService=require(_0x2b49('0x13'));var logger=require(_0x2b49('0x14'))('api');var utils=require(_0x2b49('0x15'));var config=require(_0x2b49('0x16'));var licenseUtil=require(_0x2b49('0x17'));var db=require(_0x2b49('0x18'))['db'];function respondWithStatusCode(_0x1af731,_0x1bda39){_0x1bda39=_0x1bda39||0xcc;return function(_0x5aad36){if(_0x5aad36){return _0x1af731['sendStatus'](_0x1bda39);}return _0x1af731[_0x2b49('0x19')](_0x1bda39)[_0x2b49('0x1a')]();};}function respondWithResult(_0x5e7361,_0x4dec02){_0x4dec02=_0x4dec02||0xc8;return function(_0x30eb71){if(_0x30eb71){return _0x5e7361[_0x2b49('0x19')](_0x4dec02)[_0x2b49('0x1b')](_0x30eb71);}};}function respondWithFilteredResult(_0x4d114b,_0x14fb17){return function(_0xf92e0d){if(_0xf92e0d){var _0x5ee983=typeof _0x14fb17['offset']===_0x2b49('0x1c')&&typeof _0x14fb17[_0x2b49('0x1d')]===_0x2b49('0x1c');var _0x14359f=_0xf92e0d[_0x2b49('0x1e')];var _0x248de1=_0x5ee983?0x0:_0x14fb17[_0x2b49('0x1f')];var _0x25f0d8=_0x5ee983?_0xf92e0d[_0x2b49('0x1e')]:_0x14fb17[_0x2b49('0x1f')]+_0x14fb17['limit'];var _0x37b4ae;if(_0x25f0d8>=_0x14359f){_0x25f0d8=_0x14359f;_0x37b4ae=0xc8;}else{_0x37b4ae=0xce;}_0x4d114b['status'](_0x37b4ae);return _0x4d114b[_0x2b49('0x20')](_0x2b49('0x21'),_0x248de1+'-'+_0x25f0d8+'/'+_0x14359f)[_0x2b49('0x1b')](_0xf92e0d);}return null;};}function patchUpdates(_0x389ff0){return function(_0x1e54f4){try{jsonpatch[_0x2b49('0x22')](_0x1e54f4,_0x389ff0,!![]);}catch(_0x5d33f8){return BPromise[_0x2b49('0x23')](_0x5d33f8);}return _0x1e54f4[_0x2b49('0x24')]();};}function saveUpdates(_0x38edc3,_0x5840ef){return function(_0x8e4c){if(_0x8e4c){return _0x8e4c['update'](_0x38edc3)['then'](function(_0x3107b1){return _0x3107b1;});}return null;};}function removeEntity(_0x1242bb,_0x744835){return function(_0x509164){if(_0x509164){return _0x509164[_0x2b49('0x25')]()['then'](function(){var _0x79f455=_0x509164['get']({'plain':!![]});var _0x3ea951=_0x2b49('0x26');return db[_0x2b49('0x27')][_0x2b49('0x25')]({'where':{'type':_0x3ea951,'resourceId':_0x79f455['id']}})['then'](function(){return _0x509164;});})[_0x2b49('0x28')](function(){_0x1242bb[_0x2b49('0x19')](0xcc)[_0x2b49('0x1a')]();});}};}function handleEntityNotFound(_0x70fa33,_0x4622e1){return function(_0x14d66b){if(!_0x14d66b){_0x70fa33['sendStatus'](0x194);}return _0x14d66b;};}function handleError(_0x267bad,_0x34cba2){_0x34cba2=_0x34cba2||0x1f4;return function(_0x237233){logger[_0x2b49('0x29')](_0x237233[_0x2b49('0x2a')]);if(_0x237233[_0x2b49('0x2b')]){delete _0x237233[_0x2b49('0x2b')];}_0x267bad[_0x2b49('0x19')](_0x34cba2)[_0x2b49('0x2c')](_0x237233);};}exports['index']=function(_0x117bed,_0x65c004){var _0x298497={},_0x54f74d={},_0x59f8e5={'count':0x0,'rows':[]};var _0x4cd74b=_[_0x2b49('0x2d')](db[_0x2b49('0x2e')][_0x2b49('0x2f')],function(_0x80f27a){return{'name':_0x80f27a[_0x2b49('0x30')],'type':_0x80f27a[_0x2b49('0x31')][_0x2b49('0x32')]};});_0x54f74d['model']=_[_0x2b49('0x2d')](_0x4cd74b,_0x2b49('0x2b'));_0x54f74d[_0x2b49('0x33')]=_[_0x2b49('0x34')](_0x117bed[_0x2b49('0x33')]);_0x54f74d[_0x2b49('0x35')]=_[_0x2b49('0x36')](_0x54f74d[_0x2b49('0x37')],_0x54f74d[_0x2b49('0x33')]);_0x298497[_0x2b49('0x38')]=_[_0x2b49('0x36')](_0x54f74d[_0x2b49('0x37')],qs[_0x2b49('0x39')](_0x117bed[_0x2b49('0x33')]['fields']));_0x298497[_0x2b49('0x38')]=_0x298497['attributes']['length']?_0x298497['attributes']:_0x54f74d[_0x2b49('0x37')];if(!_0x117bed[_0x2b49('0x33')][_0x2b49('0x3a')]('nolimit')){_0x298497['limit']=qs['limit'](_0x117bed[_0x2b49('0x33')][_0x2b49('0x1d')]);_0x298497[_0x2b49('0x1f')]=qs['offset'](_0x117bed[_0x2b49('0x33')]['offset']);}_0x298497['order']=qs['sort'](_0x117bed[_0x2b49('0x33')][_0x2b49('0x3b')]);_0x298497['where']=qs['filters'](_[_0x2b49('0x3c')](_0x117bed[_0x2b49('0x33')],_0x54f74d[_0x2b49('0x35')]),_0x4cd74b);if(_0x117bed[_0x2b49('0x33')]['filter']){_0x298497[_0x2b49('0x3d')]=_[_0x2b49('0x3e')](_0x298497[_0x2b49('0x3d')],{'$or':_[_0x2b49('0x2d')](_0x4cd74b,function(_0x347de6){if(_0x347de6['type']!==_0x2b49('0x3f')){var _0x12df8a={};_0x12df8a[_0x347de6[_0x2b49('0x2b')]]={'$like':'%'+_0x117bed[_0x2b49('0x33')][_0x2b49('0x40')]+'%'};return _0x12df8a;}})});}_0x298497=_['merge']({},_0x298497,_0x117bed['options']);var _0x4106d9={'where':_0x298497[_0x2b49('0x3d')]};return db['VoiceChanSpy'][_0x2b49('0x1e')](_0x4106d9)['then'](function(_0x4521d0){_0x59f8e5[_0x2b49('0x1e')]=_0x4521d0;if(_0x117bed[_0x2b49('0x33')][_0x2b49('0x41')]){_0x298497['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0x2b49('0x42')](_0x298497);})[_0x2b49('0x28')](function(_0x4ff21d){_0x59f8e5[_0x2b49('0x43')]=_0x4ff21d;return _0x59f8e5;})[_0x2b49('0x28')](respondWithFilteredResult(_0x65c004,_0x298497))[_0x2b49('0x44')](handleError(_0x65c004,null));};exports[_0x2b49('0x45')]=function(_0x27a614,_0x452701){var _0x3bb91f={'raw':![],'where':{'id':_0x27a614[_0x2b49('0x46')]['id']}},_0xd3b4f8={};_0xd3b4f8['model']=_['keys'](db['VoiceChanSpy'][_0x2b49('0x2f')]);_0xd3b4f8[_0x2b49('0x33')]=_[_0x2b49('0x34')](_0x27a614[_0x2b49('0x33')]);_0xd3b4f8['filters']=_[_0x2b49('0x36')](_0xd3b4f8[_0x2b49('0x37')],_0xd3b4f8[_0x2b49('0x33')]);_0x3bb91f[_0x2b49('0x38')]=_[_0x2b49('0x36')](_0xd3b4f8[_0x2b49('0x37')],qs[_0x2b49('0x39')](_0x27a614[_0x2b49('0x33')][_0x2b49('0x39')]));_0x3bb91f[_0x2b49('0x38')]=_0x3bb91f['attributes'][_0x2b49('0x47')]?_0x3bb91f['attributes']:_0xd3b4f8[_0x2b49('0x37')];if(_0x27a614[_0x2b49('0x33')]['includeAll']){_0x3bb91f[_0x2b49('0x48')]=[{'all':!![]}];}_0x3bb91f=_[_0x2b49('0x3e')]({},_0x3bb91f,_0x27a614[_0x2b49('0x49')]);return db[_0x2b49('0x2e')][_0x2b49('0x4a')](_0x3bb91f)['then'](handleEntityNotFound(_0x452701,null))[_0x2b49('0x28')](respondWithResult(_0x452701,null))[_0x2b49('0x44')](handleError(_0x452701,null));};exports[_0x2b49('0x4b')]=function(_0x4ff422,_0x4ec660){return db[_0x2b49('0x2e')][_0x2b49('0x4b')](_0x4ff422['body'],{})['then'](function(_0x2f5ea1){var _0x2396bb=_0x4ff422[_0x2b49('0x4c')]['get']({'plain':!![]});if(!_0x2396bb)throw new Error(_0x2b49('0x4d'));if(_0x2396bb[_0x2b49('0x4e')]===_0x2b49('0x4c')){var _0x29dc15=_0x2f5ea1['get']({'plain':!![]});var _0xb197b1='ChanSpies';return db[_0x2b49('0x4f')][_0x2b49('0x4a')]({'where':{'name':_0xb197b1,'userProfileId':_0x2396bb[_0x2b49('0x50')]},'raw':!![]})['then'](function(_0x14dafb){if(_0x14dafb&&_0x14dafb[_0x2b49('0x51')]===0x0){return db[_0x2b49('0x27')][_0x2b49('0x4b')]({'name':_0x29dc15[_0x2b49('0x2b')],'resourceId':_0x29dc15['id'],'type':_0x14dafb[_0x2b49('0x2b')],'sectionId':_0x14dafb['id']},{})[_0x2b49('0x28')](function(){return _0x2f5ea1;});}else{return _0x2f5ea1;}})[_0x2b49('0x44')](function(_0x348720){logger[_0x2b49('0x29')](_0x2b49('0x52'),_0x348720);throw _0x348720;});}return _0x2f5ea1;})[_0x2b49('0x28')](respondWithResult(_0x4ec660,0xc9))[_0x2b49('0x44')](handleError(_0x4ec660,null));};exports[_0x2b49('0x53')]=function(_0x354d2e,_0x3e7085){if(_0x354d2e[_0x2b49('0x54')]['id']){delete _0x354d2e[_0x2b49('0x54')]['id'];}return db[_0x2b49('0x2e')][_0x2b49('0x4a')]({'where':{'id':_0x354d2e[_0x2b49('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e7085,null))[_0x2b49('0x28')](saveUpdates(_0x354d2e['body'],null))['then'](respondWithResult(_0x3e7085,null))[_0x2b49('0x44')](handleError(_0x3e7085,null));};exports[_0x2b49('0x25')]=function(_0x3502f2,_0x197d2f){return db[_0x2b49('0x2e')][_0x2b49('0x4a')]({'where':{'id':_0x3502f2[_0x2b49('0x46')]['id']}})['then'](handleEntityNotFound(_0x197d2f,null))[_0x2b49('0x28')](removeEntity(_0x197d2f,null))[_0x2b49('0x44')](handleError(_0x197d2f,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 5b82057..451f9ee 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 _0xc254=['concat','internal','User','agent','then','catch','exports','define','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system','push','merge','CDR(type)=%s','chanspy','auth','Authenticate','password','SIP/%s,%s','name','options','record','StopMixMonitor','length'];(function(_0x5d245c,_0x858414){var _0x2cfacd=function(_0x3c3f56){while(--_0x3c3f56){_0x5d245c['push'](_0x5d245c['shift']());}};_0x2cfacd(++_0x858414);}(_0xc254,0x134));var _0x4c25=function(_0x51863c,_0x523fa5){_0x51863c=_0x51863c-0x0;var _0x14a0aa=_0xc254[_0x51863c];return _0x14a0aa;};'use strict';var _=require(_0x4c25('0x0'));var util=require(_0x4c25('0x1'));var BPromise=require(_0x4c25('0x2'));var attributes=require(_0x4c25('0x3'));var getUserApplications=function(_0x2856f3,_0x27ad04,_0x302d18){var _0x4b0c5d=0x1;var _0x1e24a3=[];var _0x1f2141={'context':_0x27ad04['context']||_0x4c25('0x4'),'exten':util[_0x4c25('0x5')](_0x4c25('0x6'),_0x2856f3[_0x4c25('0x7')],_0x302d18),'type':_0x4c25('0x8'),'isApp':![],'ChanSpyId':_0x2856f3['id'],'UserId':_0x27ad04['id']};_0x1e24a3[_0x4c25('0x9')](_[_0x4c25('0xa')]({'app':'Set','appdata':util[_0x4c25('0x5')](_0x4c25('0xb'),_0x4c25('0xc')),'priority':_0x4b0c5d++},_0x1f2141));if(_0x2856f3['record']){_0x1e24a3[_0x4c25('0x9')](_['merge']({'app':'MixMonitor','appdata':util['format']('${UNIQUEID}.%s,a',_0x2856f3['recordingFormat']),'priority':_0x4b0c5d++},_0x1f2141));}if(_0x2856f3[_0x4c25('0xd')]){_0x1e24a3[_0x4c25('0x9')](_[_0x4c25('0xa')]({'app':_0x4c25('0xe'),'appdata':_0x2856f3[_0x4c25('0xf')],'priority':_0x4b0c5d++},_0x1f2141));}_0x1e24a3['push'](_['merge']({'app':'ChanSpy','appdata':util['format'](_0x4c25('0x10'),_0x27ad04[_0x4c25('0x11')],_0x2856f3[_0x4c25('0x12')]?_0x2856f3[_0x4c25('0x12')]['join'](''):''),'priority':_0x4b0c5d++},_0x1f2141));if(_0x2856f3[_0x4c25('0x13')]){_0x1e24a3[_0x4c25('0x9')](_[_0x4c25('0xa')]({'app':_0x4c25('0x14'),'priority':_0x4b0c5d++},_0x1f2141));}return _0x1e24a3;};var getChanSpyApplications=function(_0x5930ce,_0x474b35){var _0x2ead3c=[];for(var _0x3dcbf4=0x0,_0x23aca6=0x1;_0x3dcbf4<_0x474b35[_0x4c25('0x15')];_0x3dcbf4++,_0x23aca6=0x1){_0x2ead3c=_0x2ead3c[_0x4c25('0x16')](getUserApplications(_0x5930ce,_0x474b35[_0x3dcbf4],_0x474b35[_0x3dcbf4][_0x4c25('0x17')]));if(_0x474b35[_0x3dcbf4]['internal']!=_0x474b35[_0x3dcbf4]['name']){_0x2ead3c=_0x2ead3c[_0x4c25('0x16')](getUserApplications(_0x5930ce,_0x474b35[_0x3dcbf4],_0x474b35[_0x3dcbf4][_0x4c25('0x11')]));}}return _0x2ead3c;};var getChanSpyPromise=function(_0x801194,_0x144ff1){return new BPromise(function(_0x24aef4,_0x2eb55b){return _0x801194[_0x4c25('0x18')]['findAll']({'attributes':['id','name',_0x4c25('0x17')],'where':{'role':_0x4c25('0x19'),'chanspy':!![]},'raw':!![]})[_0x4c25('0x1a')](function(_0x31fa20){if(_0x31fa20){return _0x24aef4(getChanSpyApplications(_0x144ff1,_0x31fa20));}return _0x24aef4([]);})[_0x4c25('0x1b')](function(_0x1024d5){_0x2eb55b(_0x1024d5);});});};module[_0x4c25('0x1c')]=function(_0x64dcc6,_0x1f5d57){var _0x400b8d=_0x64dcc6['models'];return _0x64dcc6[_0x4c25('0x1d')]('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x299d57,_0x5956d6,_0x160163){return getChanSpyPromise(_0x400b8d,_0x299d57)[_0x4c25('0x1a')](function(_0x299d50){if(_0x299d50&&_0x299d50[_0x4c25('0x15')]){return _0x400b8d[_0x4c25('0x1e')][_0x4c25('0x1f')](_0x299d50);}})['then'](function(){_0x160163();})['catch'](function(_0x50a212){_0x160163(_0x50a212);});},'afterUpdate':function(_0x11c99f,_0x108b88,_0x13064c){return _0x400b8d[_0x4c25('0x1e')][_0x4c25('0x20')]({'where':{'ChanSpyId':_0x11c99f['id']}})[_0x4c25('0x1a')](function(){return getChanSpyPromise(_0x400b8d,_0x11c99f);})[_0x4c25('0x1a')](function(_0x580969){if(_0x580969&&_0x580969['length']){return _0x400b8d[_0x4c25('0x1e')]['bulkCreate'](_0x580969);}})['then'](function(){_0x13064c();})[_0x4c25('0x1b')](function(_0x40f333){_0x13064c(_0x40f333);});},'afterDestroy':function(_0x1459bc,_0x5eba58,_0x5470fc){return _0x400b8d[_0x4c25('0x1e')][_0x4c25('0x20')]({'where':{'ChanSpyId':_0x1459bc['id']}})[_0x4c25('0x1a')](function(){_0x5470fc();})[_0x4c25('0x1b')](function(_0x439821){_0x5470fc(_0x439821);});}}});}; \ No newline at end of file +var _0x7ec4=['ChanSpy','SIP/%s,%s','name','options','join','record','StopMixMonitor','concat','internal','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','length','lodash','util','bluebird','./voiceChanSpy.attributes','context','format','%s%s','prefix','system','merge','Set','CDR(type)=%s','chanspy','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','push','Authenticate'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x7ec4,0x167));var _0x47ec=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7ec4[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x47ec('0x0'));var util=require(_0x47ec('0x1'));var BPromise=require(_0x47ec('0x2'));var attributes=require(_0x47ec('0x3'));var getUserApplications=function(_0x5cadbd,_0x8bb9e2,_0x3b63d4){var _0x3f9234=0x1;var _0x385bd5=[];var _0x39377e={'context':_0x8bb9e2[_0x47ec('0x4')]||'from-sip','exten':util[_0x47ec('0x5')](_0x47ec('0x6'),_0x5cadbd[_0x47ec('0x7')],_0x3b63d4),'type':_0x47ec('0x8'),'isApp':![],'ChanSpyId':_0x5cadbd['id'],'UserId':_0x8bb9e2['id']};_0x385bd5['push'](_[_0x47ec('0x9')]({'app':_0x47ec('0xa'),'appdata':util[_0x47ec('0x5')](_0x47ec('0xb'),_0x47ec('0xc')),'priority':_0x3f9234++},_0x39377e));if(_0x5cadbd['record']){_0x385bd5['push'](_[_0x47ec('0x9')]({'app':_0x47ec('0xd'),'appdata':util[_0x47ec('0x5')](_0x47ec('0xe'),_0x5cadbd[_0x47ec('0xf')]),'priority':_0x3f9234++},_0x39377e));}if(_0x5cadbd[_0x47ec('0x10')]){_0x385bd5[_0x47ec('0x11')](_[_0x47ec('0x9')]({'app':_0x47ec('0x12'),'appdata':_0x5cadbd['password'],'priority':_0x3f9234++},_0x39377e));}_0x385bd5['push'](_[_0x47ec('0x9')]({'app':_0x47ec('0x13'),'appdata':util[_0x47ec('0x5')](_0x47ec('0x14'),_0x8bb9e2[_0x47ec('0x15')],_0x5cadbd[_0x47ec('0x16')]?_0x5cadbd['options'][_0x47ec('0x17')](''):''),'priority':_0x3f9234++},_0x39377e));if(_0x5cadbd[_0x47ec('0x18')]){_0x385bd5[_0x47ec('0x11')](_[_0x47ec('0x9')]({'app':_0x47ec('0x19'),'priority':_0x3f9234++},_0x39377e));}return _0x385bd5;};var getChanSpyApplications=function(_0x2f8631,_0xce0e16){var _0xd56098=[];for(var _0xf50786=0x0,_0x493b85=0x1;_0xf50786<_0xce0e16['length'];_0xf50786++,_0x493b85=0x1){_0xd56098=_0xd56098[_0x47ec('0x1a')](getUserApplications(_0x2f8631,_0xce0e16[_0xf50786],_0xce0e16[_0xf50786][_0x47ec('0x1b')]));if(_0xce0e16[_0xf50786][_0x47ec('0x1b')]!=_0xce0e16[_0xf50786][_0x47ec('0x15')]){_0xd56098=_0xd56098[_0x47ec('0x1a')](getUserApplications(_0x2f8631,_0xce0e16[_0xf50786],_0xce0e16[_0xf50786]['name']));}}return _0xd56098;};var getChanSpyPromise=function(_0x3603cd,_0x7adbb2){return new BPromise(function(_0x1f91f7,_0x1579e6){return _0x3603cd[_0x47ec('0x1c')][_0x47ec('0x1d')]({'attributes':['id',_0x47ec('0x15'),_0x47ec('0x1b')],'where':{'role':_0x47ec('0x1e'),'chanspy':!![]},'raw':!![]})[_0x47ec('0x1f')](function(_0x1e01ca){if(_0x1e01ca){return _0x1f91f7(getChanSpyApplications(_0x7adbb2,_0x1e01ca));}return _0x1f91f7([]);})[_0x47ec('0x20')](function(_0xd647fd){_0x1579e6(_0xd647fd);});});};module[_0x47ec('0x21')]=function(_0x22fd0b,_0x5c8151){var _0x1f1308=_0x22fd0b[_0x47ec('0x22')];return _0x22fd0b[_0x47ec('0x23')](_0x47ec('0x24'),attributes,{'tableName':_0x47ec('0x25'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x7fa6ef,_0x14ceca,_0x1ec259){return getChanSpyPromise(_0x1f1308,_0x7fa6ef)[_0x47ec('0x1f')](function(_0x578ce8){if(_0x578ce8&&_0x578ce8['length']){return _0x1f1308[_0x47ec('0x26')][_0x47ec('0x27')](_0x578ce8);}})[_0x47ec('0x1f')](function(){_0x1ec259();})[_0x47ec('0x20')](function(_0x5c9f34){_0x1ec259(_0x5c9f34);});},'afterUpdate':function(_0xddcb6d,_0x393457,_0x5d222f){return _0x1f1308[_0x47ec('0x26')][_0x47ec('0x28')]({'where':{'ChanSpyId':_0xddcb6d['id']}})[_0x47ec('0x1f')](function(){return getChanSpyPromise(_0x1f1308,_0xddcb6d);})[_0x47ec('0x1f')](function(_0x5139ca){if(_0x5139ca&&_0x5139ca[_0x47ec('0x29')]){return _0x1f1308['VoiceExtension'][_0x47ec('0x27')](_0x5139ca);}})[_0x47ec('0x1f')](function(){_0x5d222f();})[_0x47ec('0x20')](function(_0x4c653b){_0x5d222f(_0x4c653b);});},'afterDestroy':function(_0x21dc43,_0x2800ee,_0x266d55){return _0x1f1308['VoiceExtension'][_0x47ec('0x28')]({'where':{'ChanSpyId':_0x21dc43['id']}})[_0x47ec('0x1f')](function(){_0x266d55();})['catch'](function(_0x18bbe5){_0x266d55(_0x18bbe5);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 99d18b1..6872fd3 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 _0x6953=['catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6953,0x91));var _0x3695=function(_0x522cec,_0x40b6ed){_0x522cec=_0x522cec-0x0;var _0x5b6d5e=_0x6953[_0x522cec];return _0x5b6d5e;};'use strict';var _=require(_0x3695('0x0'));var util=require(_0x3695('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3695('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3695('0x3'));var logger=require(_0x3695('0x4'))(_0x3695('0x5'));var config=require('../../config/environment');var jayson=require(_0x3695('0x6'));var client=jayson['client'][_0x3695('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x14eb32,_0x912099,_0x1a4e75){return new BPromise(function(_0x301e46,_0x4e337b){return client[_0x3695('0x8')](_0x14eb32,_0x1a4e75)['then'](function(_0x1fcd43){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x912099,_0x3695('0x9'));logger['debug'](_0x3695('0xa'),_0x912099,_0x3695('0x9'),JSON[_0x3695('0xb')](_0x1fcd43));if(_0x1fcd43[_0x3695('0xc')]){if(_0x1fcd43[_0x3695('0xc')][_0x3695('0xd')]===0x1f4){logger['error'](_0x3695('0xe'),_0x912099,_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);return _0x4e337b(_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);}logger[_0x3695('0xc')](_0x3695('0xe'),_0x912099,_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);return _0x301e46(_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);}else{logger['info'](_0x3695('0xe'),_0x912099,_0x3695('0x9'));_0x301e46(_0x1fcd43[_0x3695('0x10')][_0x3695('0xf')]);}})[_0x3695('0x11')](function(_0x1973ee){logger[_0x3695('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x912099,_0x1973ee);_0x4e337b(_0x1973ee);});});} \ No newline at end of file +var _0x39cb=['code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x39cb,0x1bd));var _0xb39c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x39cb[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xb39c('0x0'));var moment=require(_0xb39c('0x1'));var BPromise=require('bluebird');var rs=require(_0xb39c('0x2'));var fs=require('fs');var Redis=require(_0xb39c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb39c('0x4'));var logger=require(_0xb39c('0x5'))(_0xb39c('0x6'));var config=require(_0xb39c('0x7'));var jayson=require(_0xb39c('0x8'));var client=jayson['client'][_0xb39c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fc868,_0x40112f,_0x3f2fbe){return new BPromise(function(_0x47d6d7,_0x5ae14a){return client[_0xb39c('0xa')](_0x2fc868,_0x3f2fbe)[_0xb39c('0xb')](function(_0x3ffb94){logger[_0xb39c('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x40112f,'request\x20sent');logger['debug'](_0xb39c('0xd'),_0x40112f,_0xb39c('0xe'),JSON[_0xb39c('0xf')](_0x3ffb94));if(_0x3ffb94[_0xb39c('0x10')]){if(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x11')]===0x1f4){logger[_0xb39c('0x10')](_0xb39c('0x12'),_0x40112f,_0x3ffb94['error'][_0xb39c('0x13')]);return _0x5ae14a(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);}logger['error'](_0xb39c('0x12'),_0x40112f,_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);return _0x47d6d7(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);}else{logger[_0xb39c('0xc')](_0xb39c('0x12'),_0x40112f,'request\x20sent');_0x47d6d7(_0x3ffb94[_0xb39c('0x14')][_0xb39c('0x13')]);}})[_0xb39c('0x15')](function(_0x1c2c5f){logger[_0xb39c('0x10')](_0xb39c('0x12'),_0x40112f,_0x1c2c5f);_0x5ae14a(_0x1c2c5f);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index cca3fbb..27b9f7d 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 _0x28b4=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','show','put','delete','destroy','multer','util'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x28b4,0x163));var _0x428b=function(_0x3d492,_0xab2655){_0x3d492=_0x3d492-0x0;var _0x5d16fb=_0x28b4[_0x3d492];return _0x5d16fb;};'use strict';var multer=require(_0x428b('0x0'));var util=require(_0x428b('0x1'));var path=require(_0x428b('0x2'));var timeout=require(_0x428b('0x3'));var express=require(_0x428b('0x4'));var router=express['Router']();var fs_extra=require(_0x428b('0x5'));var auth=require(_0x428b('0x6'));var interaction=require(_0x428b('0x7'));var config=require(_0x428b('0x8'));var controller=require(_0x428b('0x9'));router[_0x428b('0xa')]('/',auth[_0x428b('0xb')](),controller['index']);router[_0x428b('0xa')](_0x428b('0xc'),auth['isAuthenticated'](),controller[_0x428b('0xd')]);router['post']('/',auth[_0x428b('0xb')](),controller['create']);router[_0x428b('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x428b('0xf')]('/:id',auth[_0x428b('0xb')](),controller[_0x428b('0x10')]);module['exports']=router; \ No newline at end of file +var _0x95fe=['../../components/auth/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','/:id','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x42f85f,_0x58e64e){var _0x4d1417=function(_0x2d98c5){while(--_0x2d98c5){_0x42f85f['push'](_0x42f85f['shift']());}};_0x4d1417(++_0x58e64e);}(_0x95fe,0x70));var _0xe95f=function(_0x4362c4,_0x57b51f){_0x4362c4=_0x4362c4-0x0;var _0x4e2876=_0x95fe[_0x4362c4];return _0x4e2876;};'use strict';var multer=require(_0xe95f('0x0'));var util=require(_0xe95f('0x1'));var path=require(_0xe95f('0x2'));var timeout=require(_0xe95f('0x3'));var express=require(_0xe95f('0x4'));var router=express[_0xe95f('0x5')]();var fs_extra=require(_0xe95f('0x6'));var auth=require(_0xe95f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe95f('0x8'));var controller=require(_0xe95f('0x9'));router['get']('/',auth[_0xe95f('0xa')](),controller[_0xe95f('0xb')]);router['get'](_0xe95f('0xc'),auth[_0xe95f('0xa')](),controller['show']);router['post']('/',auth[_0xe95f('0xa')](),controller['create']);router[_0xe95f('0xd')](_0xe95f('0xc'),auth[_0xe95f('0xa')](),controller[_0xe95f('0xe')]);router['delete'](_0xe95f('0xc'),auth['isAuthenticated'](),controller[_0xe95f('0xf')]);module[_0xe95f('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 68c193f..14a4edb 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 _0xce7a=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x5b3fb8,_0x8bd2f4){var _0x38f7df=function(_0x34ec84){while(--_0x34ec84){_0x5b3fb8['push'](_0x5b3fb8['shift']());}};_0x38f7df(++_0x8bd2f4);}(_0xce7a,0x1bc));var _0xace7=function(_0x560a84,_0x967b7c){_0x560a84=_0x560a84-0x0;var _0x471470=_0xce7a[_0x560a84];return _0x471470;};'use strict';var Sequelize=require(_0xace7('0x0'));module[_0xace7('0x1')]={'name':{'type':Sequelize[_0xace7('0x2')],'unique':_0xace7('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xace7('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc6e3=['STRING','exports'];(function(_0x1305e3,_0x43a724){var _0x1068e9=function(_0x1bc555){while(--_0x1bc555){_0x1305e3['push'](_0x1305e3['shift']());}};_0x1068e9(++_0x43a724);}(_0xc6e3,0x1e3));var _0x3c6e=function(_0x10100,_0x1a7f21){_0x10100=_0x10100-0x0;var _0x38319b=_0xc6e3[_0x10100];return _0x38319b;};'use strict';var Sequelize=require('sequelize');module[_0x3c6e('0x0')]={'name':{'type':Sequelize[_0x3c6e('0x1')],'unique':'name'},'description':{'type':Sequelize[_0x3c6e('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 bc74bf5..fa8828c 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 _0x4ede=['send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceContext','include','rows','catch','params','create','body','findAll','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','role','find','Contexts','userProfileId','UserProfileResource','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','ejs','lodash','squel','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','end','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','destroy','get','sendStatus','stack'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x4ede,0xf6));var _0xe4ed=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4ede[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0xe4ed('0x0'));var rimraf=require(_0xe4ed('0x1'));var zipdir=require(_0xe4ed('0x2'));var jsonpatch=require(_0xe4ed('0x3'));var rp=require(_0xe4ed('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe4ed('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe4ed('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe4ed('0x7'));var squel=require(_0xe4ed('0x8'));var crypto=require('crypto');var jsforce=require(_0xe4ed('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xe4ed('0xa'));var querystring=require('querystring');var Papa=require(_0xe4ed('0xb'));var Redis=require('ioredis');var authService=require(_0xe4ed('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xe4ed('0xd'));var hardwareService=require(_0xe4ed('0xe'));var logger=require(_0xe4ed('0xf'))(_0xe4ed('0x10'));var utils=require(_0xe4ed('0x11'));var config=require(_0xe4ed('0x12'));var licenseUtil=require(_0xe4ed('0x13'));var db=require(_0xe4ed('0x14'))['db'];var jayson=require(_0xe4ed('0x15'));var client=jayson[_0xe4ed('0x16')][_0xe4ed('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x2b12e3,_0x40aeea,_0x484857,_0x5e50d1){return new BPromise(function(_0x413f65,_0x196922){var _0x729fd0=_0x5e50d1||client;return _0x729fd0[_0xe4ed('0x18')](_0x2b12e3,_0x484857)[_0xe4ed('0x19')](function(_0x4f1ad9){logger[_0xe4ed('0x1a')]('VoiceContext,\x20%s,\x20%s',_0x40aeea,_0xe4ed('0x1b'));logger[_0xe4ed('0x1c')](_0xe4ed('0x1d'),_0x40aeea,'request\x20sent',JSON[_0xe4ed('0x1e')](_0x4f1ad9));if(_0x4f1ad9[_0xe4ed('0x1f')]){if(_0x4f1ad9[_0xe4ed('0x1f')][_0xe4ed('0x20')]===0x1f4){logger[_0xe4ed('0x1f')](_0xe4ed('0x21'),_0x40aeea,_0x4f1ad9[_0xe4ed('0x1f')][_0xe4ed('0x22')]);return _0x196922(_0x4f1ad9[_0xe4ed('0x1f')][_0xe4ed('0x22')]);}logger['error'](_0xe4ed('0x21'),_0x40aeea,_0x4f1ad9[_0xe4ed('0x1f')]['message']);return _0x413f65(_0x4f1ad9[_0xe4ed('0x1f')][_0xe4ed('0x22')]);}else{logger[_0xe4ed('0x1a')](_0xe4ed('0x21'),_0x40aeea,_0xe4ed('0x1b'));_0x413f65(_0x4f1ad9['result'][_0xe4ed('0x22')]);}})['catch'](function(_0x51336a){logger[_0xe4ed('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x40aeea,_0x51336a);_0x196922(_0x51336a);});});}function respondWithStatusCode(_0x476a96,_0x115fa6){_0x115fa6=_0x115fa6||0xcc;return function(_0x463a4c){if(_0x463a4c){return _0x476a96['sendStatus'](_0x115fa6);}return _0x476a96['status'](_0x115fa6)[_0xe4ed('0x23')]();};}function respondWithResult(_0x54458e,_0x39d1ca){_0x39d1ca=_0x39d1ca||0xc8;return function(_0x4eb101){if(_0x4eb101){return _0x54458e[_0xe4ed('0x24')](_0x39d1ca)['json'](_0x4eb101);}};}function respondWithFilteredResult(_0x2872bc,_0x14388e){return function(_0x3a7872){if(_0x3a7872){var _0x15d240=typeof _0x14388e[_0xe4ed('0x25')]===_0xe4ed('0x26')&&typeof _0x14388e['limit']==='undefined';var _0x4b787f=_0x3a7872['count'];var _0x13318d=_0x15d240?0x0:_0x14388e[_0xe4ed('0x25')];var _0x5bf939=_0x15d240?_0x3a7872[_0xe4ed('0x27')]:_0x14388e[_0xe4ed('0x25')]+_0x14388e[_0xe4ed('0x28')];var _0x55fc29;if(_0x5bf939>=_0x4b787f){_0x5bf939=_0x4b787f;_0x55fc29=0xc8;}else{_0x55fc29=0xce;}_0x2872bc['status'](_0x55fc29);return _0x2872bc[_0xe4ed('0x29')](_0xe4ed('0x2a'),_0x13318d+'-'+_0x5bf939+'/'+_0x4b787f)[_0xe4ed('0x2b')](_0x3a7872);}return null;};}function patchUpdates(_0x273e2a){return function(_0x396bbb){try{jsonpatch['apply'](_0x396bbb,_0x273e2a,!![]);}catch(_0x5b5d6b){return BPromise[_0xe4ed('0x2c')](_0x5b5d6b);}return _0x396bbb[_0xe4ed('0x2d')]();};}function saveUpdates(_0x5cea20,_0x237357){return function(_0x26ad2f){if(_0x26ad2f){return _0x26ad2f[_0xe4ed('0x2e')](_0x5cea20)[_0xe4ed('0x19')](function(_0x12ba78){return _0x12ba78;});}return null;};}function removeEntity(_0x4f0f86,_0x10670f){return function(_0x479caa){if(_0x479caa){return _0x479caa[_0xe4ed('0x2f')]()[_0xe4ed('0x19')](function(){var _0x3f57d1=_0x479caa[_0xe4ed('0x30')]({'plain':!![]});var _0xd41c08='Contexts';return db['UserProfileResource'][_0xe4ed('0x2f')]({'where':{'type':_0xd41c08,'resourceId':_0x3f57d1['id']}})[_0xe4ed('0x19')](function(){return _0x479caa;});})['then'](function(){_0x4f0f86[_0xe4ed('0x24')](0xcc)[_0xe4ed('0x23')]();});}};}function handleEntityNotFound(_0x168b4a,_0x45e6d7){return function(_0x45a315){if(!_0x45a315){_0x168b4a[_0xe4ed('0x31')](0x194);}return _0x45a315;};}function handleError(_0xc61f5e,_0x5dac31){_0x5dac31=_0x5dac31||0x1f4;return function(_0x14583d){logger['error'](_0x14583d[_0xe4ed('0x32')]);if(_0x14583d['name']){delete _0x14583d['name'];}_0xc61f5e[_0xe4ed('0x24')](_0x5dac31)[_0xe4ed('0x33')](_0x14583d);};}exports[_0xe4ed('0x34')]=function(_0x43a135,_0x145413){var _0x318572={},_0x529e18={},_0x1a3c0d={'count':0x0,'rows':[]};var _0x1f20a2=_[_0xe4ed('0x35')](db['VoiceContext'][_0xe4ed('0x36')],function(_0x15f848){return{'name':_0x15f848[_0xe4ed('0x37')],'type':_0x15f848[_0xe4ed('0x38')][_0xe4ed('0x39')]};});_0x529e18[_0xe4ed('0x3a')]=_['map'](_0x1f20a2,_0xe4ed('0x3b'));_0x529e18[_0xe4ed('0x3c')]=_[_0xe4ed('0x3d')](_0x43a135['query']);_0x529e18[_0xe4ed('0x3e')]=_['intersection'](_0x529e18[_0xe4ed('0x3a')],_0x529e18[_0xe4ed('0x3c')]);_0x318572[_0xe4ed('0x3f')]=_[_0xe4ed('0x40')](_0x529e18['model'],qs[_0xe4ed('0x41')](_0x43a135['query']['fields']));_0x318572['attributes']=_0x318572[_0xe4ed('0x3f')][_0xe4ed('0x42')]?_0x318572[_0xe4ed('0x3f')]:_0x529e18[_0xe4ed('0x3a')];if(!_0x43a135[_0xe4ed('0x3c')]['hasOwnProperty']('nolimit')){_0x318572[_0xe4ed('0x28')]=qs[_0xe4ed('0x28')](_0x43a135['query'][_0xe4ed('0x28')]);_0x318572['offset']=qs['offset'](_0x43a135[_0xe4ed('0x3c')]['offset']);}_0x318572[_0xe4ed('0x43')]=qs['sort'](_0x43a135[_0xe4ed('0x3c')][_0xe4ed('0x44')]);_0x318572[_0xe4ed('0x45')]=qs[_0xe4ed('0x3e')](_[_0xe4ed('0x46')](_0x43a135[_0xe4ed('0x3c')],_0x529e18[_0xe4ed('0x3e')]),_0x1f20a2);if(_0x43a135[_0xe4ed('0x3c')][_0xe4ed('0x47')]){_0x318572[_0xe4ed('0x45')]=_[_0xe4ed('0x48')](_0x318572[_0xe4ed('0x45')],{'$or':_['map'](_0x1f20a2,function(_0x443bf9){if(_0x443bf9[_0xe4ed('0x38')]!==_0xe4ed('0x49')){var _0x527fcf={};_0x527fcf[_0x443bf9[_0xe4ed('0x3b')]]={'$like':'%'+_0x43a135[_0xe4ed('0x3c')][_0xe4ed('0x47')]+'%'};return _0x527fcf;}})});}_0x318572=_[_0xe4ed('0x48')]({},_0x318572,_0x43a135[_0xe4ed('0x4a')]);var _0x51bdbd={'where':_0x318572['where']};return db[_0xe4ed('0x4b')][_0xe4ed('0x27')](_0x51bdbd)['then'](function(_0x2fc7bb){_0x1a3c0d['count']=_0x2fc7bb;if(_0x43a135[_0xe4ed('0x3c')]['includeAll']){_0x318572[_0xe4ed('0x4c')]=[{'all':!![]}];}return db[_0xe4ed('0x4b')]['findAll'](_0x318572);})['then'](function(_0x47f343){_0x1a3c0d[_0xe4ed('0x4d')]=_0x47f343;return _0x1a3c0d;})['then'](respondWithFilteredResult(_0x145413,_0x318572))[_0xe4ed('0x4e')](handleError(_0x145413,null));};exports['show']=function(_0x20b5c9,_0x16f695){var _0x101d17={'raw':![],'where':{'id':_0x20b5c9[_0xe4ed('0x4f')]['id']}},_0x3889ad={};_0x3889ad[_0xe4ed('0x3a')]=_[_0xe4ed('0x3d')](db[_0xe4ed('0x4b')][_0xe4ed('0x36')]);_0x3889ad[_0xe4ed('0x3c')]=_['keys'](_0x20b5c9['query']);_0x3889ad[_0xe4ed('0x3e')]=_['intersection'](_0x3889ad[_0xe4ed('0x3a')],_0x3889ad[_0xe4ed('0x3c')]);_0x101d17[_0xe4ed('0x3f')]=_[_0xe4ed('0x40')](_0x3889ad[_0xe4ed('0x3a')],qs['fields'](_0x20b5c9[_0xe4ed('0x3c')][_0xe4ed('0x41')]));_0x101d17[_0xe4ed('0x3f')]=_0x101d17['attributes'][_0xe4ed('0x42')]?_0x101d17[_0xe4ed('0x3f')]:_0x3889ad['model'];if(_0x20b5c9['query']['includeAll']){_0x101d17[_0xe4ed('0x4c')]=[{'all':!![]}];}_0x101d17=_[_0xe4ed('0x48')]({},_0x101d17,_0x20b5c9['options']);return db[_0xe4ed('0x4b')]['find'](_0x101d17)[_0xe4ed('0x19')](handleEntityNotFound(_0x16f695,null))['then'](respondWithResult(_0x16f695,null))['catch'](handleError(_0x16f695,null));};exports[_0xe4ed('0x50')]=function(_0x93d5da,_0xc8628a,_0x3b67fd){var _0x51d7cd;return db[_0xe4ed('0x4b')]['create'](_0x93d5da[_0xe4ed('0x51')],{'raw':!![]})[_0xe4ed('0x19')](function(_0x14146b){_0x51d7cd=_0x14146b;return db[_0xe4ed('0x4b')][_0xe4ed('0x52')]({'raw':!![]});})[_0xe4ed('0x19')](function(_0x517658){var _0x666de9=fs[_0xe4ed('0x53')](path[_0xe4ed('0x54')](config[_0xe4ed('0x55')],_0xe4ed('0x56')),_0xe4ed('0x57'));var _0x1a3a41=ejs[_0xe4ed('0x58')](_0x666de9,{'contexts':_0x517658||[]});fs[_0xe4ed('0x59')](_0xe4ed('0x5a'),_0x1a3a41);})[_0xe4ed('0x19')](function(){return respondWithRpcPromise(_0xe4ed('0x5b'),'create',{'module':'chan_sip.so'});})[_0xe4ed('0x19')](function(){var _0x5694c1=_0x93d5da[_0xe4ed('0x5c')][_0xe4ed('0x30')]({'plain':!![]});if(!_0x5694c1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5694c1[_0xe4ed('0x5d')]===_0xe4ed('0x5c')){var _0xb0de8c=_0x51d7cd[_0xe4ed('0x30')]({'plain':!![]});return db['UserProfileSection'][_0xe4ed('0x5e')]({'where':{'name':_0xe4ed('0x5f'),'userProfileId':_0x5694c1[_0xe4ed('0x60')]},'raw':!![]})[_0xe4ed('0x19')](function(_0x423122){if(_0x423122&&_0x423122['autoAssociation']===0x0){return db[_0xe4ed('0x61')][_0xe4ed('0x50')]({'name':_0xb0de8c[_0xe4ed('0x3b')],'resourceId':_0xb0de8c['id'],'type':_0x423122[_0xe4ed('0x3b')],'sectionId':_0x423122['id']},{})[_0xe4ed('0x19')](function(){return _0x51d7cd;});}else{return _0x51d7cd;}})[_0xe4ed('0x4e')](function(_0x224e3d){logger[_0xe4ed('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x224e3d);throw _0x224e3d;});}return _0x51d7cd;})[_0xe4ed('0x19')](respondWithResult(_0xc8628a,0xc9))['catch'](handleError(_0xc8628a,null));};exports['update']=function(_0x3c4029,_0x179bde,_0x402597){var _0x766126;return db[_0xe4ed('0x4b')][_0xe4ed('0x5e')]({'where':{'id':_0x3c4029[_0xe4ed('0x4f')]['id']}})['then'](handleEntityNotFound(_0x179bde,null))[_0xe4ed('0x19')](saveUpdates(_0x3c4029[_0xe4ed('0x51')],null))['then'](function(_0x4ceb5d){if(_0x4ceb5d){_0x766126=_0x4ceb5d;return db[_0xe4ed('0x4b')]['findAll']({'raw':!![]});}})['then'](function(_0x12a010){var _0x5c7d11=fs[_0xe4ed('0x53')](path[_0xe4ed('0x54')](config[_0xe4ed('0x55')],_0xe4ed('0x56')),_0xe4ed('0x57'));var _0x3942fc=ejs[_0xe4ed('0x58')](_0x5c7d11,{'contexts':_0x12a010||[]});fs['writeFileSync'](_0xe4ed('0x5a'),_0x3942fc);})[_0xe4ed('0x19')](function(){return respondWithRpcPromise(_0xe4ed('0x5b'),_0xe4ed('0x2e'),{'module':_0xe4ed('0x62')});})[_0xe4ed('0x19')](function(){return _0x766126;})[_0xe4ed('0x19')](respondWithResult(_0x179bde,null))[_0xe4ed('0x4e')](handleError(_0x179bde,null));};exports[_0xe4ed('0x2f')]=function(_0x59a78c,_0x43b7e7,_0x79147a){var _0x2d9d35;return db[_0xe4ed('0x4b')][_0xe4ed('0x5e')]({'where':{'id':_0x59a78c[_0xe4ed('0x4f')]['id']}})[_0xe4ed('0x19')](handleEntityNotFound(_0x43b7e7,null))[_0xe4ed('0x19')](removeEntity(_0x43b7e7,null))['then'](function(){return db[_0xe4ed('0x4b')][_0xe4ed('0x52')]({'raw':!![]});})[_0xe4ed('0x19')](function(_0x209aa2){var _0x15d290=fs['readFileSync'](path[_0xe4ed('0x54')](config[_0xe4ed('0x55')],_0xe4ed('0x56')),_0xe4ed('0x57'));var _0x3791a0=ejs['render'](_0x15d290,{'contexts':_0x209aa2});fs['writeFileSync'](_0xe4ed('0x5a'),_0x3791a0);return respondWithRpcPromise(_0xe4ed('0x5b'),_0xe4ed('0x2f'),{'module':_0xe4ed('0x62')});})[_0xe4ed('0x4e')](handleError(_0x43b7e7,null));}; \ No newline at end of file +var _0x9f7b=['include','show','params','catch','create','readFileSync','root','server/files/templates/context.ejs','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','join','utf8','writeFileSync','findAll','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Contexts','stack','name','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x578a80,_0x412698){var _0x4b4ba8=function(_0x4ff947){while(--_0x4ff947){_0x578a80['push'](_0x578a80['shift']());}};_0x4b4ba8(++_0x412698);}(_0x9f7b,0xf1));var _0xb9f7=function(_0x2030af,_0x1a442d){_0x2030af=_0x2030af-0x0;var _0x2e9f24=_0x9f7b[_0x2030af];return _0x2e9f24;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb9f7('0x0'));var zipdir=require(_0xb9f7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9f7('0x2'));var moment=require(_0xb9f7('0x3'));var BPromise=require(_0xb9f7('0x4'));var Mustache=require(_0xb9f7('0x5'));var util=require(_0xb9f7('0x6'));var path=require(_0xb9f7('0x7'));var sox=require(_0xb9f7('0x8'));var csv=require(_0xb9f7('0x9'));var ejs=require(_0xb9f7('0xa'));var fs=require('fs');var fs_extra=require(_0xb9f7('0xb'));var _=require(_0xb9f7('0xc'));var squel=require(_0xb9f7('0xd'));var crypto=require(_0xb9f7('0xe'));var jsforce=require(_0xb9f7('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb9f7('0x10'));var Papa=require(_0xb9f7('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb9f7('0x12'));var as=require(_0xb9f7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9f7('0x14'))(_0xb9f7('0x15'));var utils=require(_0xb9f7('0x16'));var config=require(_0xb9f7('0x17'));var licenseUtil=require(_0xb9f7('0x18'));var db=require(_0xb9f7('0x19'))['db'];var jayson=require(_0xb9f7('0x1a'));var client=jayson[_0xb9f7('0x1b')][_0xb9f7('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x44e699,_0x59598e,_0x175ede,_0x3acd11){return new BPromise(function(_0x4f9407,_0x5c7cbe){var _0xa29a09=_0x3acd11||client;return _0xa29a09[_0xb9f7('0x1d')](_0x44e699,_0x175ede)[_0xb9f7('0x1e')](function(_0x41d78a){logger[_0xb9f7('0x1f')](_0xb9f7('0x20'),_0x59598e,_0xb9f7('0x21'));logger[_0xb9f7('0x22')](_0xb9f7('0x23'),_0x59598e,_0xb9f7('0x21'),JSON[_0xb9f7('0x24')](_0x41d78a));if(_0x41d78a[_0xb9f7('0x25')]){if(_0x41d78a[_0xb9f7('0x25')][_0xb9f7('0x26')]===0x1f4){logger['error'](_0xb9f7('0x20'),_0x59598e,_0x41d78a['error'][_0xb9f7('0x27')]);return _0x5c7cbe(_0x41d78a['error'][_0xb9f7('0x27')]);}logger['error'](_0xb9f7('0x20'),_0x59598e,_0x41d78a[_0xb9f7('0x25')][_0xb9f7('0x27')]);return _0x4f9407(_0x41d78a[_0xb9f7('0x25')]['message']);}else{logger[_0xb9f7('0x1f')](_0xb9f7('0x20'),_0x59598e,'request\x20sent');_0x4f9407(_0x41d78a[_0xb9f7('0x28')][_0xb9f7('0x27')]);}})['catch'](function(_0x24ecc5){logger[_0xb9f7('0x25')](_0xb9f7('0x20'),_0x59598e,_0x24ecc5);_0x5c7cbe(_0x24ecc5);});});}function respondWithStatusCode(_0x213e4c,_0x23672d){_0x23672d=_0x23672d||0xcc;return function(_0x501dbe){if(_0x501dbe){return _0x213e4c[_0xb9f7('0x29')](_0x23672d);}return _0x213e4c[_0xb9f7('0x2a')](_0x23672d)[_0xb9f7('0x2b')]();};}function respondWithResult(_0x1a82d3,_0x13385d){_0x13385d=_0x13385d||0xc8;return function(_0x47ee58){if(_0x47ee58){return _0x1a82d3[_0xb9f7('0x2a')](_0x13385d)[_0xb9f7('0x2c')](_0x47ee58);}};}function respondWithFilteredResult(_0x1853ba,_0x29e1dd){return function(_0x2c8c46){if(_0x2c8c46){var _0x1e84da=typeof _0x29e1dd['offset']===_0xb9f7('0x2d')&&typeof _0x29e1dd['limit']===_0xb9f7('0x2d');var _0x131c99=_0x2c8c46[_0xb9f7('0x2e')];var _0x43ef82=_0x1e84da?0x0:_0x29e1dd[_0xb9f7('0x2f')];var _0x31073e=_0x1e84da?_0x2c8c46[_0xb9f7('0x2e')]:_0x29e1dd['offset']+_0x29e1dd[_0xb9f7('0x30')];var _0x32ea9a;if(_0x31073e>=_0x131c99){_0x31073e=_0x131c99;_0x32ea9a=0xc8;}else{_0x32ea9a=0xce;}_0x1853ba['status'](_0x32ea9a);return _0x1853ba[_0xb9f7('0x31')](_0xb9f7('0x32'),_0x43ef82+'-'+_0x31073e+'/'+_0x131c99)[_0xb9f7('0x2c')](_0x2c8c46);}return null;};}function patchUpdates(_0x2a8732){return function(_0x1853d4){try{jsonpatch[_0xb9f7('0x33')](_0x1853d4,_0x2a8732,!![]);}catch(_0x50c0d7){return BPromise[_0xb9f7('0x34')](_0x50c0d7);}return _0x1853d4[_0xb9f7('0x35')]();};}function saveUpdates(_0x4414c2,_0x2e594a){return function(_0x470f03){if(_0x470f03){return _0x470f03['update'](_0x4414c2)[_0xb9f7('0x1e')](function(_0x282c02){return _0x282c02;});}return null;};}function removeEntity(_0x2299bd,_0x4605ed){return function(_0x4f4fa5){if(_0x4f4fa5){return _0x4f4fa5[_0xb9f7('0x36')]()[_0xb9f7('0x1e')](function(){var _0x16406c=_0x4f4fa5[_0xb9f7('0x37')]({'plain':!![]});var _0x208cea=_0xb9f7('0x38');return db['UserProfileResource'][_0xb9f7('0x36')]({'where':{'type':_0x208cea,'resourceId':_0x16406c['id']}})[_0xb9f7('0x1e')](function(){return _0x4f4fa5;});})[_0xb9f7('0x1e')](function(){_0x2299bd[_0xb9f7('0x2a')](0xcc)[_0xb9f7('0x2b')]();});}};}function handleEntityNotFound(_0x4d3a84,_0x2662cc){return function(_0x390879){if(!_0x390879){_0x4d3a84[_0xb9f7('0x29')](0x194);}return _0x390879;};}function handleError(_0x117e8e,_0xd9dba6){_0xd9dba6=_0xd9dba6||0x1f4;return function(_0x4537f6){logger[_0xb9f7('0x25')](_0x4537f6[_0xb9f7('0x39')]);if(_0x4537f6[_0xb9f7('0x3a')]){delete _0x4537f6[_0xb9f7('0x3a')];}_0x117e8e[_0xb9f7('0x2a')](_0xd9dba6)['send'](_0x4537f6);};}exports['index']=function(_0x2f4b30,_0x1aafb2){var _0x1ff303={},_0x25ead8={},_0xfea2fc={'count':0x0,'rows':[]};var _0x3ebed2=_['map'](db[_0xb9f7('0x3b')][_0xb9f7('0x3c')],function(_0x450da0){return{'name':_0x450da0[_0xb9f7('0x3d')],'type':_0x450da0[_0xb9f7('0x3e')][_0xb9f7('0x3f')]};});_0x25ead8[_0xb9f7('0x40')]=_[_0xb9f7('0x41')](_0x3ebed2,_0xb9f7('0x3a'));_0x25ead8[_0xb9f7('0x42')]=_[_0xb9f7('0x43')](_0x2f4b30[_0xb9f7('0x42')]);_0x25ead8[_0xb9f7('0x44')]=_[_0xb9f7('0x45')](_0x25ead8['model'],_0x25ead8[_0xb9f7('0x42')]);_0x1ff303[_0xb9f7('0x46')]=_[_0xb9f7('0x45')](_0x25ead8['model'],qs[_0xb9f7('0x47')](_0x2f4b30['query'][_0xb9f7('0x47')]));_0x1ff303[_0xb9f7('0x46')]=_0x1ff303['attributes'][_0xb9f7('0x48')]?_0x1ff303[_0xb9f7('0x46')]:_0x25ead8['model'];if(!_0x2f4b30[_0xb9f7('0x42')][_0xb9f7('0x49')](_0xb9f7('0x4a'))){_0x1ff303[_0xb9f7('0x30')]=qs['limit'](_0x2f4b30[_0xb9f7('0x42')][_0xb9f7('0x30')]);_0x1ff303[_0xb9f7('0x2f')]=qs[_0xb9f7('0x2f')](_0x2f4b30['query']['offset']);}_0x1ff303['order']=qs['sort'](_0x2f4b30[_0xb9f7('0x42')][_0xb9f7('0x4b')]);_0x1ff303[_0xb9f7('0x4c')]=qs[_0xb9f7('0x44')](_[_0xb9f7('0x4d')](_0x2f4b30['query'],_0x25ead8['filters']),_0x3ebed2);if(_0x2f4b30[_0xb9f7('0x42')][_0xb9f7('0x4e')]){_0x1ff303[_0xb9f7('0x4c')]=_[_0xb9f7('0x4f')](_0x1ff303[_0xb9f7('0x4c')],{'$or':_[_0xb9f7('0x41')](_0x3ebed2,function(_0x22932f){if(_0x22932f[_0xb9f7('0x3e')]!==_0xb9f7('0x50')){var _0x55cf55={};_0x55cf55[_0x22932f[_0xb9f7('0x3a')]]={'$like':'%'+_0x2f4b30[_0xb9f7('0x42')]['filter']+'%'};return _0x55cf55;}})});}_0x1ff303=_[_0xb9f7('0x4f')]({},_0x1ff303,_0x2f4b30[_0xb9f7('0x51')]);var _0x508026={'where':_0x1ff303[_0xb9f7('0x4c')]};return db['VoiceContext']['count'](_0x508026)[_0xb9f7('0x1e')](function(_0x2b3413){_0xfea2fc['count']=_0x2b3413;if(_0x2f4b30[_0xb9f7('0x42')][_0xb9f7('0x52')]){_0x1ff303[_0xb9f7('0x53')]=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x1ff303);})['then'](function(_0x127569){_0xfea2fc['rows']=_0x127569;return _0xfea2fc;})[_0xb9f7('0x1e')](respondWithFilteredResult(_0x1aafb2,_0x1ff303))['catch'](handleError(_0x1aafb2,null));};exports[_0xb9f7('0x54')]=function(_0x5574cb,_0x5d3125){var _0x34987f={'raw':![],'where':{'id':_0x5574cb[_0xb9f7('0x55')]['id']}},_0x5fac10={};_0x5fac10[_0xb9f7('0x40')]=_[_0xb9f7('0x43')](db[_0xb9f7('0x3b')][_0xb9f7('0x3c')]);_0x5fac10['query']=_[_0xb9f7('0x43')](_0x5574cb[_0xb9f7('0x42')]);_0x5fac10[_0xb9f7('0x44')]=_[_0xb9f7('0x45')](_0x5fac10[_0xb9f7('0x40')],_0x5fac10[_0xb9f7('0x42')]);_0x34987f[_0xb9f7('0x46')]=_[_0xb9f7('0x45')](_0x5fac10[_0xb9f7('0x40')],qs['fields'](_0x5574cb['query']['fields']));_0x34987f[_0xb9f7('0x46')]=_0x34987f[_0xb9f7('0x46')]['length']?_0x34987f[_0xb9f7('0x46')]:_0x5fac10[_0xb9f7('0x40')];if(_0x5574cb[_0xb9f7('0x42')][_0xb9f7('0x52')]){_0x34987f[_0xb9f7('0x53')]=[{'all':!![]}];}_0x34987f=_[_0xb9f7('0x4f')]({},_0x34987f,_0x5574cb[_0xb9f7('0x51')]);return db[_0xb9f7('0x3b')]['find'](_0x34987f)[_0xb9f7('0x1e')](handleEntityNotFound(_0x5d3125,null))[_0xb9f7('0x1e')](respondWithResult(_0x5d3125,null))[_0xb9f7('0x56')](handleError(_0x5d3125,null));};exports[_0xb9f7('0x57')]=function(_0x598c39,_0x1061c5,_0x5d32cd){var _0x4e5e99;return db[_0xb9f7('0x3b')]['create'](_0x598c39['body'],{'raw':!![]})[_0xb9f7('0x1e')](function(_0xa4bd81){_0x4e5e99=_0xa4bd81;return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x5e32ef){var _0x8fdf63=fs[_0xb9f7('0x58')](path['join'](config[_0xb9f7('0x59')],_0xb9f7('0x5a')),'utf8');var _0x24bc3f=ejs[_0xb9f7('0x5b')](_0x8fdf63,{'contexts':_0x5e32ef||[]});fs['writeFileSync'](_0xb9f7('0x5c'),_0x24bc3f);})['then'](function(){return respondWithRpcPromise(_0xb9f7('0x5d'),_0xb9f7('0x57'),{'module':_0xb9f7('0x5e')});})['then'](function(){var _0x370461=_0x598c39[_0xb9f7('0x5f')][_0xb9f7('0x37')]({'plain':!![]});if(!_0x370461)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x370461['role']===_0xb9f7('0x5f')){var _0x51c673=_0x4e5e99['get']({'plain':!![]});return db[_0xb9f7('0x60')][_0xb9f7('0x61')]({'where':{'name':_0xb9f7('0x38'),'userProfileId':_0x370461[_0xb9f7('0x62')]},'raw':!![]})[_0xb9f7('0x1e')](function(_0x2362a4){if(_0x2362a4&&_0x2362a4[_0xb9f7('0x63')]===0x0){return db[_0xb9f7('0x64')]['create']({'name':_0x51c673[_0xb9f7('0x3a')],'resourceId':_0x51c673['id'],'type':_0x2362a4[_0xb9f7('0x3a')],'sectionId':_0x2362a4['id']},{})[_0xb9f7('0x1e')](function(){return _0x4e5e99;});}else{return _0x4e5e99;}})['catch'](function(_0x3027f1){logger[_0xb9f7('0x25')](_0xb9f7('0x65'),_0x3027f1);throw _0x3027f1;});}return _0x4e5e99;})[_0xb9f7('0x1e')](respondWithResult(_0x1061c5,0xc9))[_0xb9f7('0x56')](handleError(_0x1061c5,null));};exports[_0xb9f7('0x66')]=function(_0x40b34c,_0x21f57d,_0xc5e4c6){var _0x354237;return db[_0xb9f7('0x3b')][_0xb9f7('0x61')]({'where':{'id':_0x40b34c['params']['id']}})[_0xb9f7('0x1e')](handleEntityNotFound(_0x21f57d,null))['then'](saveUpdates(_0x40b34c[_0xb9f7('0x67')],null))[_0xb9f7('0x1e')](function(_0x3c0711){if(_0x3c0711){_0x354237=_0x3c0711;return db[_0xb9f7('0x3b')]['findAll']({'raw':!![]});}})[_0xb9f7('0x1e')](function(_0x73311b){var _0x1b3154=fs['readFileSync'](path[_0xb9f7('0x68')](config[_0xb9f7('0x59')],_0xb9f7('0x5a')),_0xb9f7('0x69'));var _0x3eb55a=ejs[_0xb9f7('0x5b')](_0x1b3154,{'contexts':_0x73311b||[]});fs[_0xb9f7('0x6a')](_0xb9f7('0x5c'),_0x3eb55a);})['then'](function(){return respondWithRpcPromise(_0xb9f7('0x5d'),_0xb9f7('0x66'),{'module':'chan_sip.so'});})['then'](function(){return _0x354237;})['then'](respondWithResult(_0x21f57d,null))[_0xb9f7('0x56')](handleError(_0x21f57d,null));};exports['destroy']=function(_0x55ad1d,_0x1c5d99,_0x2d9c36){var _0x2949b5;return db[_0xb9f7('0x3b')]['find']({'where':{'id':_0x55ad1d[_0xb9f7('0x55')]['id']}})[_0xb9f7('0x1e')](handleEntityNotFound(_0x1c5d99,null))[_0xb9f7('0x1e')](removeEntity(_0x1c5d99,null))[_0xb9f7('0x1e')](function(){return db[_0xb9f7('0x3b')][_0xb9f7('0x6b')]({'raw':!![]});})['then'](function(_0x58e8f2){var _0x459f57=fs['readFileSync'](path['join'](config[_0xb9f7('0x59')],_0xb9f7('0x5a')),'utf8');var _0x434431=ejs[_0xb9f7('0x5b')](_0x459f57,{'contexts':_0x58e8f2});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x434431);return respondWithRpcPromise(_0xb9f7('0x5d'),_0xb9f7('0x36'),{'module':_0xb9f7('0x5e')});})[_0xb9f7('0x56')](handleError(_0x1c5d99,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index e8e2e47..54ed993 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 _0x70e2=['voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext'];(function(_0x349148,_0x31eabb){var _0x2f2b0f=function(_0x44726e){while(--_0x44726e){_0x349148['push'](_0x349148['shift']());}};_0x2f2b0f(++_0x31eabb);}(_0x70e2,0x7f));var _0x270e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x70e2[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x270e('0x0'));var util=require(_0x270e('0x1'));var logger=require(_0x270e('0x2'))(_0x270e('0x3'));var moment=require(_0x270e('0x4'));var BPromise=require(_0x270e('0x5'));var rp=require(_0x270e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x270e('0x7'));var config=require(_0x270e('0x8'));var attributes=require(_0x270e('0x9'));module[_0x270e('0xa')]=function(_0x58fd5d,_0x2cfe8e){return _0x58fd5d[_0x270e('0xb')](_0x270e('0xc'),attributes,{'tableName':_0x270e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ba4=['define','VoiceContext','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceContext.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ba4,0xc2));var _0x43ba=function(_0x2f47c3,_0x1c3015){_0x2f47c3=_0x2f47c3-0x0;var _0x5c8d37=_0x3ba4[_0x2f47c3];return _0x5c8d37;};'use strict';var _=require(_0x43ba('0x0'));var util=require('util');var logger=require(_0x43ba('0x1'))(_0x43ba('0x2'));var moment=require(_0x43ba('0x3'));var BPromise=require(_0x43ba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x43ba('0x5'));var rimraf=require(_0x43ba('0x6'));var config=require(_0x43ba('0x7'));var attributes=require(_0x43ba('0x8'));module[_0x43ba('0x9')]=function(_0x1866e6,_0x3a30a9){return _0x1866e6[_0x43ba('0xa')](_0x43ba('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 364c4a3..9354cff 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 _0x9123=['lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','result','catch'];(function(_0x14b359,_0x571125){var _0x4d6091=function(_0x569324){while(--_0x569324){_0x14b359['push'](_0x14b359['shift']());}};_0x4d6091(++_0x571125);}(_0x9123,0x140));var _0x3912=function(_0x5870dd,_0x4197d1){_0x5870dd=_0x5870dd-0x0;var _0x5d6723=_0x9123[_0x5870dd];return _0x5d6723;};'use strict';var _=require(_0x3912('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3912('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3912('0x2'))['db'];var utils=require(_0x3912('0x3'));var logger=require(_0x3912('0x4'))(_0x3912('0x5'));var config=require('../../config/environment');var jayson=require(_0x3912('0x6'));var client=jayson[_0x3912('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ea5cf,_0x2b3ac0,_0x2d75b6){return new BPromise(function(_0x2325d0,_0x51fb5b){return client[_0x3912('0x8')](_0x4ea5cf,_0x2d75b6)[_0x3912('0x9')](function(_0x2f5910){logger[_0x3912('0xa')]('VoiceContext,\x20%s,\x20%s',_0x2b3ac0,_0x3912('0xb'));logger[_0x3912('0xc')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x2b3ac0,_0x3912('0xb'),JSON[_0x3912('0xd')](_0x2f5910));if(_0x2f5910[_0x3912('0xe')]){if(_0x2f5910[_0x3912('0xe')][_0x3912('0xf')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x2b3ac0,_0x2f5910[_0x3912('0xe')][_0x3912('0x10')]);return _0x51fb5b(_0x2f5910[_0x3912('0xe')]['message']);}logger[_0x3912('0xe')](_0x3912('0x11'),_0x2b3ac0,_0x2f5910['error'][_0x3912('0x10')]);return _0x2325d0(_0x2f5910[_0x3912('0xe')][_0x3912('0x10')]);}else{logger[_0x3912('0xa')]('VoiceContext,\x20%s,\x20%s',_0x2b3ac0,_0x3912('0xb'));_0x2325d0(_0x2f5910[_0x3912('0x12')][_0x3912('0x10')]);}})[_0x3912('0x13')](function(_0x4658b6){logger['error'](_0x3912('0x11'),_0x2b3ac0,_0x4658b6);_0x51fb5b(_0x4658b6);});});} \ No newline at end of file +var _0xa9e8=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xb32f0f,_0x312aa2){var _0x4fcd0e=function(_0x29d0de){while(--_0x29d0de){_0xb32f0f['push'](_0xb32f0f['shift']());}};_0x4fcd0e(++_0x312aa2);}(_0xa9e8,0x78));var _0x8a9e=function(_0x4a8639,_0x5180dd){_0x4a8639=_0x4a8639-0x0;var _0x4919ef=_0xa9e8[_0x4a8639];return _0x4919ef;};'use strict';var _=require(_0x8a9e('0x0'));var util=require(_0x8a9e('0x1'));var moment=require(_0x8a9e('0x2'));var BPromise=require('bluebird');var rs=require(_0x8a9e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8a9e('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8a9e('0x5'));var client=jayson[_0x8a9e('0x6')][_0x8a9e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x254f8a,_0x55b987,_0x43835c){return new BPromise(function(_0x223d67,_0x5211f0){return client[_0x8a9e('0x8')](_0x254f8a,_0x43835c)[_0x8a9e('0x9')](function(_0x43342d){logger['info'](_0x8a9e('0xa'),_0x55b987,'request\x20sent');logger['debug'](_0x8a9e('0xb'),_0x55b987,_0x8a9e('0xc'),JSON[_0x8a9e('0xd')](_0x43342d));if(_0x43342d[_0x8a9e('0xe')]){if(_0x43342d[_0x8a9e('0xe')][_0x8a9e('0xf')]===0x1f4){logger[_0x8a9e('0xe')](_0x8a9e('0xa'),_0x55b987,_0x43342d[_0x8a9e('0xe')][_0x8a9e('0x10')]);return _0x5211f0(_0x43342d['error'][_0x8a9e('0x10')]);}logger['error'](_0x8a9e('0xa'),_0x55b987,_0x43342d[_0x8a9e('0xe')][_0x8a9e('0x10')]);return _0x223d67(_0x43342d[_0x8a9e('0xe')]['message']);}else{logger['info'](_0x8a9e('0xa'),_0x55b987,_0x8a9e('0xc'));_0x223d67(_0x43342d[_0x8a9e('0x11')]['message']);}})[_0x8a9e('0x12')](function(_0x35ca37){logger[_0x8a9e('0xe')](_0x8a9e('0xa'),_0x55b987,_0x35ca37);_0x5211f0(_0x35ca37);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 508f56b..bb2a320 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 _0x9d3d=['describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x4c4101,_0x45a4ab){var _0x37a7f9=function(_0x35299d){while(--_0x35299d){_0x4c4101['push'](_0x4c4101['shift']());}};_0x37a7f9(++_0x45a4ab);}(_0x9d3d,0x96));var _0xd9d3=function(_0x2c4ca4,_0x487a44){_0x2c4ca4=_0x2c4ca4-0x0;var _0x3cfc48=_0x9d3d[_0x2c4ca4];return _0x3cfc48;};'use strict';var multer=require('multer');var util=require(_0xd9d3('0x0'));var path=require(_0xd9d3('0x1'));var timeout=require(_0xd9d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd9d3('0x3'));var auth=require(_0xd9d3('0x4'));var interaction=require(_0xd9d3('0x5'));var config=require(_0xd9d3('0x6'));var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0xd9d3('0x7')](),controller[_0xd9d3('0x8')]);router[_0xd9d3('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xd9d3('0xa')]);router['get'](_0xd9d3('0xb'),auth[_0xd9d3('0x7')](),controller[_0xd9d3('0xc')]);router[_0xd9d3('0xd')]('/',auth[_0xd9d3('0x7')](),controller[_0xd9d3('0xe')]);router[_0xd9d3('0xf')](_0xd9d3('0xb'),auth['isAuthenticated'](),controller[_0xd9d3('0x10')]);router[_0xd9d3('0x11')]('/:id',auth[_0xd9d3('0x7')](),controller[_0xd9d3('0x12')]);module[_0xd9d3('0x13')]=router; \ No newline at end of file +var _0xdcc2=['show','post','create','put','update','exports','multer','path','connect-timeout','express','Router','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x328290,_0x4320d7){var _0x2af434=function(_0x2fb7a3){while(--_0x2fb7a3){_0x328290['push'](_0x328290['shift']());}};_0x2af434(++_0x4320d7);}(_0xdcc2,0x16b));var _0x2dcc=function(_0x27f9e3,_0x5a9ad5){_0x27f9e3=_0x27f9e3-0x0;var _0x79802e=_0xdcc2[_0x27f9e3];return _0x79802e;};'use strict';var multer=require(_0x2dcc('0x0'));var util=require('util');var path=require(_0x2dcc('0x1'));var timeout=require(_0x2dcc('0x2'));var express=require(_0x2dcc('0x3'));var router=express[_0x2dcc('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(_0x2dcc('0x5'));router[_0x2dcc('0x6')]('/',auth[_0x2dcc('0x7')](),controller[_0x2dcc('0x8')]);router[_0x2dcc('0x6')]('/describe',auth[_0x2dcc('0x7')](),controller[_0x2dcc('0x9')]);router[_0x2dcc('0x6')](_0x2dcc('0xa'),auth[_0x2dcc('0x7')](),controller[_0x2dcc('0xb')]);router[_0x2dcc('0xc')]('/',auth[_0x2dcc('0x7')](),controller[_0x2dcc('0xd')]);router[_0x2dcc('0xe')](_0x2dcc('0xa'),auth[_0x2dcc('0x7')](),controller[_0x2dcc('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2dcc('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 6db7f85..ab18088 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 _0x425d=['sequelize','STRING','INTEGER','DATE'];(function(_0x2b5413,_0x2b44fd){var _0x17ae26=function(_0x5ba575){while(--_0x5ba575){_0x2b5413['push'](_0x2b5413['shift']());}};_0x17ae26(++_0x2b44fd);}(_0x425d,0x1e0));var _0xd425=function(_0x3b2bfb,_0x2fabce){_0x3b2bfb=_0x3b2bfb-0x0;var _0x4a3498=_0x425d[_0x3b2bfb];return _0x4a3498;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xd425('0x1')]},'channel':{'type':Sequelize[_0xd425('0x1')]},'channelstate':{'type':Sequelize[_0xd425('0x2')]},'channelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'calleridnum':{'type':Sequelize[_0xd425('0x1')]},'calleridname':{'type':Sequelize[_0xd425('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd425('0x1')]},'accountcode':{'type':Sequelize[_0xd425('0x1')]},'context':{'type':Sequelize[_0xd425('0x1')]},'exten':{'type':Sequelize[_0xd425('0x1')]},'priority':{'type':Sequelize[_0xd425('0x2')]},'uniqueid':{'type':Sequelize[_0xd425('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd425('0x1')]},'destchannelstate':{'type':Sequelize[_0xd425('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd425('0x1')]},'destcalleridname':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd425('0x1')]},'destlanguage':{'type':Sequelize[_0xd425('0x1')]},'destaccountcode':{'type':Sequelize[_0xd425('0x1')]},'destcontext':{'type':Sequelize[_0xd425('0x1')]},'destexten':{'type':Sequelize[_0xd425('0x1')]},'destpriority':{'type':Sequelize[_0xd425('0x2')]},'destuniqueid':{'type':Sequelize[_0xd425('0x1')]},'destlinkedid':{'type':Sequelize[_0xd425('0x1')]},'dialstring':{'type':Sequelize[_0xd425('0x1')]},'dialstatus':{'type':Sequelize[_0xd425('0x1')]},'starttime':{'type':Sequelize[_0xd425('0x3')]},'answertime':{'type':Sequelize[_0xd425('0x3')]},'endtime':{'type':Sequelize[_0xd425('0x3')]},'lastevent':{'type':Sequelize[_0xd425('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xd425('0x2')]},'duration':{'type':Sequelize[_0xd425('0x2')]},'holdtime':{'type':Sequelize[_0xd425('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x84ab=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x311c92,_0x9166a3){var _0x2914d0=function(_0x3476d2){while(--_0x3476d2){_0x311c92['push'](_0x311c92['shift']());}};_0x2914d0(++_0x9166a3);}(_0x84ab,0x12f));var _0xb84a=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0x84ab[_0x2d8d69];return _0x39ae22;};'use strict';var Sequelize=require(_0xb84a('0x0'));module[_0xb84a('0x1')]={'privilege':{'type':Sequelize[_0xb84a('0x2')]},'channel':{'type':Sequelize[_0xb84a('0x2')]},'channelstate':{'type':Sequelize[_0xb84a('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb84a('0x2')]},'calleridname':{'type':Sequelize[_0xb84a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'language':{'type':Sequelize[_0xb84a('0x2')]},'accountcode':{'type':Sequelize[_0xb84a('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xb84a('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xb84a('0x2')]},'destchannelstate':{'type':Sequelize[_0xb84a('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb84a('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb84a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'destlanguage':{'type':Sequelize[_0xb84a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb84a('0x3')]},'destuniqueid':{'type':Sequelize[_0xb84a('0x2')]},'destlinkedid':{'type':Sequelize[_0xb84a('0x2')]},'dialstring':{'type':Sequelize[_0xb84a('0x2')]},'dialstatus':{'type':Sequelize[_0xb84a('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb84a('0x4')]},'endtime':{'type':Sequelize[_0xb84a('0x4')]},'lastevent':{'type':Sequelize[_0xb84a('0x2')],'comment':_0xb84a('0x5')},'routeId':{'type':Sequelize[_0xb84a('0x3')]},'duration':{'type':Sequelize[_0xb84a('0x3')]},'holdtime':{'type':Sequelize[_0xb84a('0x3')]},'billableseconds':{'type':Sequelize[_0xb84a('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 12a9c3e..2ec3265 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 _0x2f6c=['reject','save','then','error','send','index','map','VoiceDialReport','type','key','name','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filters','filter','merge','options','includeAll','findAll','rows','rawAttributes','include','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply'];(function(_0x584da6,_0x37153a){var _0x45a000=function(_0xd62e65){while(--_0xd62e65){_0x584da6['push'](_0x584da6['shift']());}};_0x45a000(++_0x37153a);}(_0x2f6c,0x145));var _0xc2f6=function(_0x522ae8,_0x3b637e){_0x522ae8=_0x522ae8-0x0;var _0x3189b9=_0x2f6c[_0x522ae8];return _0x3189b9;};'use strict';var emlformat=require(_0xc2f6('0x0'));var rimraf=require(_0xc2f6('0x1'));var zipdir=require(_0xc2f6('0x2'));var jsonpatch=require(_0xc2f6('0x3'));var rp=require(_0xc2f6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc2f6('0x5'));var util=require(_0xc2f6('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc2f6('0x7'));var ejs=require(_0xc2f6('0x8'));var fs=require('fs');var fs_extra=require(_0xc2f6('0x9'));var _=require(_0xc2f6('0xa'));var squel=require(_0xc2f6('0xb'));var crypto=require(_0xc2f6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc2f6('0xd'));var toCsv=require(_0xc2f6('0x7'));var querystring=require('querystring');var Papa=require(_0xc2f6('0xe'));var Redis=require(_0xc2f6('0xf'));var authService=require(_0xc2f6('0x10'));var qs=require(_0xc2f6('0x11'));var as=require(_0xc2f6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc2f6('0x13'))(_0xc2f6('0x14'));var utils=require(_0xc2f6('0x15'));var config=require(_0xc2f6('0x16'));var licenseUtil=require(_0xc2f6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x847180,_0x58a8e1){_0x58a8e1=_0x58a8e1||0xcc;return function(_0x3f035e){if(_0x3f035e){return _0x847180[_0xc2f6('0x18')](_0x58a8e1);}return _0x847180[_0xc2f6('0x19')](_0x58a8e1)[_0xc2f6('0x1a')]();};}function respondWithResult(_0x6c3d62,_0x883ef){_0x883ef=_0x883ef||0xc8;return function(_0x34a83b){if(_0x34a83b){return _0x6c3d62[_0xc2f6('0x19')](_0x883ef)[_0xc2f6('0x1b')](_0x34a83b);}};}function respondWithFilteredResult(_0x4d715c,_0x365b1b){return function(_0x121036){if(_0x121036){var _0x1dad5f=typeof _0x365b1b['offset']===_0xc2f6('0x1c')&&typeof _0x365b1b[_0xc2f6('0x1d')]===_0xc2f6('0x1c');var _0x335b2b=_0x121036[_0xc2f6('0x1e')];var _0xb4c1e7=_0x1dad5f?0x0:_0x365b1b[_0xc2f6('0x1f')];var _0x23ccba=_0x1dad5f?_0x121036[_0xc2f6('0x1e')]:_0x365b1b[_0xc2f6('0x1f')]+_0x365b1b[_0xc2f6('0x1d')];var _0x36ffe5;if(_0x23ccba>=_0x335b2b){_0x23ccba=_0x335b2b;_0x36ffe5=0xc8;}else{_0x36ffe5=0xce;}_0x4d715c[_0xc2f6('0x19')](_0x36ffe5);return _0x4d715c[_0xc2f6('0x20')](_0xc2f6('0x21'),_0xb4c1e7+'-'+_0x23ccba+'/'+_0x335b2b)[_0xc2f6('0x1b')](_0x121036);}return null;};}function patchUpdates(_0x28d880){return function(_0x404113){try{jsonpatch[_0xc2f6('0x22')](_0x404113,_0x28d880,!![]);}catch(_0x53c451){return BPromise[_0xc2f6('0x23')](_0x53c451);}return _0x404113[_0xc2f6('0x24')]();};}function saveUpdates(_0x313773,_0x531292){return function(_0x55fe84){if(_0x55fe84){return _0x55fe84['update'](_0x313773)[_0xc2f6('0x25')](function(_0x4ca957){return _0x4ca957;});}return null;};}function removeEntity(_0x466c0a,_0x55b454){return function(_0x50ada0){if(_0x50ada0){return _0x50ada0['destroy']()[_0xc2f6('0x25')](function(){_0x466c0a[_0xc2f6('0x19')](0xcc)[_0xc2f6('0x1a')]();});}};}function handleEntityNotFound(_0x4cc842,_0x57cf94){return function(_0x20ba3e){if(!_0x20ba3e){_0x4cc842[_0xc2f6('0x18')](0x194);}return _0x20ba3e;};}function handleError(_0x4fee45,_0x151300){_0x151300=_0x151300||0x1f4;return function(_0x1f0ec3){logger[_0xc2f6('0x26')](_0x1f0ec3['stack']);if(_0x1f0ec3['name']){delete _0x1f0ec3['name'];}_0x4fee45[_0xc2f6('0x19')](_0x151300)[_0xc2f6('0x27')](_0x1f0ec3);};}exports[_0xc2f6('0x28')]=function(_0x373844,_0x48a013){var _0x4d7964={},_0x174a74={},_0x1592aa={'count':0x0,'rows':[]};var _0x13b0a3=_[_0xc2f6('0x29')](db[_0xc2f6('0x2a')]['rawAttributes'],function(_0x59d20a){return{'name':_0x59d20a['fieldName'],'type':_0x59d20a[_0xc2f6('0x2b')][_0xc2f6('0x2c')]};});_0x174a74['model']=_[_0xc2f6('0x29')](_0x13b0a3,_0xc2f6('0x2d'));_0x174a74[_0xc2f6('0x2e')]=_[_0xc2f6('0x2f')](_0x373844[_0xc2f6('0x2e')]);_0x174a74['filters']=_[_0xc2f6('0x30')](_0x174a74[_0xc2f6('0x31')],_0x174a74[_0xc2f6('0x2e')]);_0x4d7964[_0xc2f6('0x32')]=_['intersection'](_0x174a74['model'],qs[_0xc2f6('0x33')](_0x373844[_0xc2f6('0x2e')]['fields']));_0x4d7964[_0xc2f6('0x32')]=_0x4d7964[_0xc2f6('0x32')][_0xc2f6('0x34')]?_0x4d7964[_0xc2f6('0x32')]:_0x174a74[_0xc2f6('0x31')];if(!_0x373844[_0xc2f6('0x2e')]['hasOwnProperty'](_0xc2f6('0x35'))){_0x4d7964[_0xc2f6('0x1d')]=qs[_0xc2f6('0x1d')](_0x373844[_0xc2f6('0x2e')][_0xc2f6('0x1d')]);_0x4d7964[_0xc2f6('0x1f')]=qs[_0xc2f6('0x1f')](_0x373844[_0xc2f6('0x2e')][_0xc2f6('0x1f')]);}_0x4d7964['order']=qs['sort'](_0x373844[_0xc2f6('0x2e')][_0xc2f6('0x36')]);_0x4d7964[_0xc2f6('0x37')]=qs['filters'](_[_0xc2f6('0x38')](_0x373844[_0xc2f6('0x2e')],_0x174a74[_0xc2f6('0x39')]),_0x13b0a3);if(_0x373844['query'][_0xc2f6('0x3a')]){_0x4d7964[_0xc2f6('0x37')]=_['merge'](_0x4d7964['where'],{'$or':_['map'](_0x13b0a3,function(_0x3c959d){if(_0x3c959d['type']!=='VIRTUAL'){var _0x11947b={};_0x11947b[_0x3c959d['name']]={'$like':'%'+_0x373844['query'][_0xc2f6('0x3a')]+'%'};return _0x11947b;}})});}_0x4d7964=_[_0xc2f6('0x3b')]({},_0x4d7964,_0x373844[_0xc2f6('0x3c')]);var _0x409716={'where':_0x4d7964[_0xc2f6('0x37')]};return db['VoiceDialReport'][_0xc2f6('0x1e')](_0x409716)[_0xc2f6('0x25')](function(_0x569097){_0x1592aa[_0xc2f6('0x1e')]=_0x569097;if(_0x373844['query'][_0xc2f6('0x3d')]){_0x4d7964['include']=[{'all':!![]}];}return db[_0xc2f6('0x2a')][_0xc2f6('0x3e')](_0x4d7964);})[_0xc2f6('0x25')](function(_0x130417){_0x1592aa[_0xc2f6('0x3f')]=_0x130417;return _0x1592aa;})['then'](respondWithFilteredResult(_0x48a013,_0x4d7964))['catch'](handleError(_0x48a013,null));};exports['show']=function(_0x529452,_0x414fe2){var _0x1a2397={'raw':!![],'where':{'id':_0x529452['params']['id']}},_0x1da9a7={};_0x1da9a7[_0xc2f6('0x31')]=_[_0xc2f6('0x2f')](db[_0xc2f6('0x2a')][_0xc2f6('0x40')]);_0x1da9a7[_0xc2f6('0x2e')]=_[_0xc2f6('0x2f')](_0x529452['query']);_0x1da9a7[_0xc2f6('0x39')]=_['intersection'](_0x1da9a7[_0xc2f6('0x31')],_0x1da9a7[_0xc2f6('0x2e')]);_0x1a2397[_0xc2f6('0x32')]=_[_0xc2f6('0x30')](_0x1da9a7[_0xc2f6('0x31')],qs[_0xc2f6('0x33')](_0x529452['query'][_0xc2f6('0x33')]));_0x1a2397[_0xc2f6('0x32')]=_0x1a2397[_0xc2f6('0x32')][_0xc2f6('0x34')]?_0x1a2397[_0xc2f6('0x32')]:_0x1da9a7[_0xc2f6('0x31')];if(_0x529452[_0xc2f6('0x2e')][_0xc2f6('0x3d')]){_0x1a2397[_0xc2f6('0x41')]=[{'all':!![]}];}_0x1a2397=_[_0xc2f6('0x3b')]({},_0x1a2397,_0x529452[_0xc2f6('0x3c')]);return db[_0xc2f6('0x2a')][_0xc2f6('0x42')](_0x1a2397)[_0xc2f6('0x25')](handleEntityNotFound(_0x414fe2,null))[_0xc2f6('0x25')](respondWithResult(_0x414fe2,null))[_0xc2f6('0x43')](handleError(_0x414fe2,null));};exports[_0xc2f6('0x44')]=function(_0x4f53b0,_0x370baf){return db[_0xc2f6('0x2a')]['create'](_0x4f53b0['body'],{})[_0xc2f6('0x25')](respondWithResult(_0x370baf,0xc9))[_0xc2f6('0x43')](handleError(_0x370baf,null));};exports['update']=function(_0x401a9c,_0xb2818a){if(_0x401a9c[_0xc2f6('0x45')]['id']){delete _0x401a9c[_0xc2f6('0x45')]['id'];}return db[_0xc2f6('0x2a')][_0xc2f6('0x42')]({'where':{'id':_0x401a9c[_0xc2f6('0x46')]['id']}})[_0xc2f6('0x25')](handleEntityNotFound(_0xb2818a,null))[_0xc2f6('0x25')](saveUpdates(_0x401a9c['body'],null))[_0xc2f6('0x25')](respondWithResult(_0xb2818a,null))[_0xc2f6('0x43')](handleError(_0xb2818a,null));};exports['destroy']=function(_0x5e5517,_0x1482fe){return db[_0xc2f6('0x2a')][_0xc2f6('0x42')]({'where':{'id':_0x5e5517[_0xc2f6('0x46')]['id']}})['then'](handleEntityNotFound(_0x1482fe,null))[_0xc2f6('0x25')](removeEntity(_0x1482fe,null))[_0xc2f6('0x43')](handleError(_0x1482fe,null));};exports[_0xc2f6('0x47')]=function(_0x1a77f0,_0x2ed4ba){return db[_0xc2f6('0x2a')][_0xc2f6('0x47')]()['then'](respondWithResult(_0x2ed4ba,null))[_0xc2f6('0x43')](handleError(_0x2ed4ba,null));}; \ No newline at end of file +var _0xb2b8=['Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','VoiceDialReport','type','key','model','query','keys','filters','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','rows','show','rawAttributes','intersection','fields','length','find','catch','create','body','params','describe','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set'];(function(_0x3a2ef5,_0x47e4c1){var _0x48d535=function(_0x5e5503){while(--_0x5e5503){_0x3a2ef5['push'](_0x3a2ef5['shift']());}};_0x48d535(++_0x47e4c1);}(_0xb2b8,0xc8));var _0x8b2b=function(_0x2a8f34,_0x3130a6){_0x2a8f34=_0x2a8f34-0x0;var _0x1dd9a9=_0xb2b8[_0x2a8f34];return _0x1dd9a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b2b('0x0'));var zipdir=require(_0x8b2b('0x1'));var jsonpatch=require(_0x8b2b('0x2'));var rp=require(_0x8b2b('0x3'));var moment=require(_0x8b2b('0x4'));var BPromise=require(_0x8b2b('0x5'));var Mustache=require(_0x8b2b('0x6'));var util=require(_0x8b2b('0x7'));var path=require(_0x8b2b('0x8'));var sox=require(_0x8b2b('0x9'));var csv=require(_0x8b2b('0xa'));var ejs=require(_0x8b2b('0xb'));var fs=require('fs');var fs_extra=require(_0x8b2b('0xc'));var _=require(_0x8b2b('0xd'));var squel=require(_0x8b2b('0xe'));var crypto=require(_0x8b2b('0xf'));var jsforce=require(_0x8b2b('0x10'));var deskjs=require(_0x8b2b('0x11'));var toCsv=require(_0x8b2b('0xa'));var querystring=require(_0x8b2b('0x12'));var Papa=require('papaparse');var Redis=require(_0x8b2b('0x13'));var authService=require(_0x8b2b('0x14'));var qs=require(_0x8b2b('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b2b('0x16'));var logger=require(_0x8b2b('0x17'))(_0x8b2b('0x18'));var utils=require(_0x8b2b('0x19'));var config=require(_0x8b2b('0x1a'));var licenseUtil=require(_0x8b2b('0x1b'));var db=require(_0x8b2b('0x1c'))['db'];function respondWithStatusCode(_0x266764,_0x3f2278){_0x3f2278=_0x3f2278||0xcc;return function(_0x51d223){if(_0x51d223){return _0x266764[_0x8b2b('0x1d')](_0x3f2278);}return _0x266764[_0x8b2b('0x1e')](_0x3f2278)['end']();};}function respondWithResult(_0x2cd526,_0x6e0dc6){_0x6e0dc6=_0x6e0dc6||0xc8;return function(_0x860d34){if(_0x860d34){return _0x2cd526['status'](_0x6e0dc6)[_0x8b2b('0x1f')](_0x860d34);}};}function respondWithFilteredResult(_0x48b203,_0x21aa1e){return function(_0x570eb7){if(_0x570eb7){var _0x3f523e=typeof _0x21aa1e[_0x8b2b('0x20')]===_0x8b2b('0x21')&&typeof _0x21aa1e['limit']===_0x8b2b('0x21');var _0x2e8eec=_0x570eb7['count'];var _0xfe57d5=_0x3f523e?0x0:_0x21aa1e[_0x8b2b('0x20')];var _0x54372a=_0x3f523e?_0x570eb7[_0x8b2b('0x22')]:_0x21aa1e[_0x8b2b('0x20')]+_0x21aa1e[_0x8b2b('0x23')];var _0x40807a;if(_0x54372a>=_0x2e8eec){_0x54372a=_0x2e8eec;_0x40807a=0xc8;}else{_0x40807a=0xce;}_0x48b203[_0x8b2b('0x1e')](_0x40807a);return _0x48b203[_0x8b2b('0x24')](_0x8b2b('0x25'),_0xfe57d5+'-'+_0x54372a+'/'+_0x2e8eec)['json'](_0x570eb7);}return null;};}function patchUpdates(_0x528bff){return function(_0x51da74){try{jsonpatch[_0x8b2b('0x26')](_0x51da74,_0x528bff,!![]);}catch(_0x50109a){return BPromise[_0x8b2b('0x27')](_0x50109a);}return _0x51da74[_0x8b2b('0x28')]();};}function saveUpdates(_0x28001f,_0x267490){return function(_0x360339){if(_0x360339){return _0x360339[_0x8b2b('0x29')](_0x28001f)[_0x8b2b('0x2a')](function(_0x14df32){return _0x14df32;});}return null;};}function removeEntity(_0x38b4f2,_0xa22338){return function(_0x3c774a){if(_0x3c774a){return _0x3c774a[_0x8b2b('0x2b')]()['then'](function(){_0x38b4f2[_0x8b2b('0x1e')](0xcc)[_0x8b2b('0x2c')]();});}};}function handleEntityNotFound(_0x63528d,_0x22ea77){return function(_0x328fff){if(!_0x328fff){_0x63528d[_0x8b2b('0x1d')](0x194);}return _0x328fff;};}function handleError(_0x138fe3,_0x2e12bc){_0x2e12bc=_0x2e12bc||0x1f4;return function(_0x562aab){logger[_0x8b2b('0x2d')](_0x562aab[_0x8b2b('0x2e')]);if(_0x562aab['name']){delete _0x562aab[_0x8b2b('0x2f')];}_0x138fe3[_0x8b2b('0x1e')](_0x2e12bc)['send'](_0x562aab);};}exports[_0x8b2b('0x30')]=function(_0x1b8095,_0x521397){var _0x2308b4={},_0x373a88={},_0x4536d3={'count':0x0,'rows':[]};var _0x5aa777=_[_0x8b2b('0x31')](db[_0x8b2b('0x32')]['rawAttributes'],function(_0x4b1df1){return{'name':_0x4b1df1['fieldName'],'type':_0x4b1df1[_0x8b2b('0x33')][_0x8b2b('0x34')]};});_0x373a88[_0x8b2b('0x35')]=_[_0x8b2b('0x31')](_0x5aa777,'name');_0x373a88[_0x8b2b('0x36')]=_[_0x8b2b('0x37')](_0x1b8095[_0x8b2b('0x36')]);_0x373a88[_0x8b2b('0x38')]=_['intersection'](_0x373a88[_0x8b2b('0x35')],_0x373a88[_0x8b2b('0x36')]);_0x2308b4[_0x8b2b('0x39')]=_['intersection'](_0x373a88['model'],qs['fields'](_0x1b8095[_0x8b2b('0x36')]['fields']));_0x2308b4[_0x8b2b('0x39')]=_0x2308b4['attributes']['length']?_0x2308b4[_0x8b2b('0x39')]:_0x373a88[_0x8b2b('0x35')];if(!_0x1b8095[_0x8b2b('0x36')][_0x8b2b('0x3a')]('nolimit')){_0x2308b4[_0x8b2b('0x23')]=qs['limit'](_0x1b8095[_0x8b2b('0x36')][_0x8b2b('0x23')]);_0x2308b4[_0x8b2b('0x20')]=qs[_0x8b2b('0x20')](_0x1b8095[_0x8b2b('0x36')][_0x8b2b('0x20')]);}_0x2308b4[_0x8b2b('0x3b')]=qs[_0x8b2b('0x3c')](_0x1b8095[_0x8b2b('0x36')][_0x8b2b('0x3c')]);_0x2308b4[_0x8b2b('0x3d')]=qs[_0x8b2b('0x38')](_[_0x8b2b('0x3e')](_0x1b8095[_0x8b2b('0x36')],_0x373a88['filters']),_0x5aa777);if(_0x1b8095['query'][_0x8b2b('0x3f')]){_0x2308b4['where']=_['merge'](_0x2308b4[_0x8b2b('0x3d')],{'$or':_[_0x8b2b('0x31')](_0x5aa777,function(_0x5b7253){if(_0x5b7253[_0x8b2b('0x33')]!=='VIRTUAL'){var _0x17dd22={};_0x17dd22[_0x5b7253[_0x8b2b('0x2f')]]={'$like':'%'+_0x1b8095[_0x8b2b('0x36')][_0x8b2b('0x3f')]+'%'};return _0x17dd22;}})});}_0x2308b4=_[_0x8b2b('0x40')]({},_0x2308b4,_0x1b8095['options']);var _0x1d5aed={'where':_0x2308b4[_0x8b2b('0x3d')]};return db[_0x8b2b('0x32')][_0x8b2b('0x22')](_0x1d5aed)[_0x8b2b('0x2a')](function(_0x260fef){_0x4536d3['count']=_0x260fef;if(_0x1b8095[_0x8b2b('0x36')][_0x8b2b('0x41')]){_0x2308b4[_0x8b2b('0x42')]=[{'all':!![]}];}return db[_0x8b2b('0x32')]['findAll'](_0x2308b4);})[_0x8b2b('0x2a')](function(_0xbf41f6){_0x4536d3[_0x8b2b('0x43')]=_0xbf41f6;return _0x4536d3;})['then'](respondWithFilteredResult(_0x521397,_0x2308b4))['catch'](handleError(_0x521397,null));};exports[_0x8b2b('0x44')]=function(_0xd11052,_0x71be16){var _0x323521={'raw':!![],'where':{'id':_0xd11052['params']['id']}},_0x19d25c={};_0x19d25c[_0x8b2b('0x35')]=_[_0x8b2b('0x37')](db[_0x8b2b('0x32')][_0x8b2b('0x45')]);_0x19d25c[_0x8b2b('0x36')]=_[_0x8b2b('0x37')](_0xd11052[_0x8b2b('0x36')]);_0x19d25c[_0x8b2b('0x38')]=_[_0x8b2b('0x46')](_0x19d25c[_0x8b2b('0x35')],_0x19d25c[_0x8b2b('0x36')]);_0x323521[_0x8b2b('0x39')]=_[_0x8b2b('0x46')](_0x19d25c['model'],qs[_0x8b2b('0x47')](_0xd11052[_0x8b2b('0x36')][_0x8b2b('0x47')]));_0x323521[_0x8b2b('0x39')]=_0x323521['attributes'][_0x8b2b('0x48')]?_0x323521[_0x8b2b('0x39')]:_0x19d25c[_0x8b2b('0x35')];if(_0xd11052[_0x8b2b('0x36')]['includeAll']){_0x323521['include']=[{'all':!![]}];}_0x323521=_[_0x8b2b('0x40')]({},_0x323521,_0xd11052['options']);return db[_0x8b2b('0x32')][_0x8b2b('0x49')](_0x323521)[_0x8b2b('0x2a')](handleEntityNotFound(_0x71be16,null))['then'](respondWithResult(_0x71be16,null))[_0x8b2b('0x4a')](handleError(_0x71be16,null));};exports[_0x8b2b('0x4b')]=function(_0x14681a,_0x1d2184){return db[_0x8b2b('0x32')]['create'](_0x14681a['body'],{})[_0x8b2b('0x2a')](respondWithResult(_0x1d2184,0xc9))[_0x8b2b('0x4a')](handleError(_0x1d2184,null));};exports[_0x8b2b('0x29')]=function(_0x30493b,_0x3e3787){if(_0x30493b[_0x8b2b('0x4c')]['id']){delete _0x30493b['body']['id'];}return db['VoiceDialReport'][_0x8b2b('0x49')]({'where':{'id':_0x30493b[_0x8b2b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3e3787,null))[_0x8b2b('0x2a')](saveUpdates(_0x30493b[_0x8b2b('0x4c')],null))['then'](respondWithResult(_0x3e3787,null))[_0x8b2b('0x4a')](handleError(_0x3e3787,null));};exports[_0x8b2b('0x2b')]=function(_0xb677b4,_0x56b88f){return db[_0x8b2b('0x32')][_0x8b2b('0x49')]({'where':{'id':_0xb677b4['params']['id']}})[_0x8b2b('0x2a')](handleEntityNotFound(_0x56b88f,null))[_0x8b2b('0x2a')](removeEntity(_0x56b88f,null))[_0x8b2b('0x4a')](handleError(_0x56b88f,null));};exports[_0x8b2b('0x4e')]=function(_0x4d1e68,_0x318297){return db[_0x8b2b('0x32')][_0x8b2b('0x4e')]()[_0x8b2b('0x2a')](respondWithResult(_0x318297,null))[_0x8b2b('0x4a')](handleError(_0x318297,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 7b780a2..82735ea 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 _0x6666=['lodash','bluebird','request-promise','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x6666,0x6e));var _0x6666=function(_0xfc0976,_0x33776f){_0xfc0976=_0xfc0976-0x0;var _0x23579f=_0x6666[_0xfc0976];return _0x23579f;};'use strict';var _=require(_0x6666('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6666('0x1'));var rp=require(_0x6666('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6666('0x3'));var attributes=require(_0x6666('0x4'));module[_0x6666('0x5')]=function(_0x1cf748,_0xfb7053){return _0x1cf748[_0x6666('0x6')](_0x6666('0x7'),attributes,{'tableName':_0x6666('0x8'),'paranoid':![],'indexes':[{'fields':[_0x6666('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfef9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash','util','../../config/logger','api'];(function(_0x23056e,_0x2256b9){var _0x512c99=function(_0x244965){while(--_0x244965){_0x23056e['push'](_0x23056e['shift']());}};_0x512c99(++_0x2256b9);}(_0xfef9,0x92));var _0x9fef=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0xfef9[_0x725a4c];return _0x37b2cc;};'use strict';var _=require(_0x9fef('0x0'));var util=require(_0x9fef('0x1'));var logger=require(_0x9fef('0x2'))(_0x9fef('0x3'));var moment=require(_0x9fef('0x4'));var BPromise=require(_0x9fef('0x5'));var rp=require(_0x9fef('0x6'));var fs=require('fs');var path=require(_0x9fef('0x7'));var rimraf=require(_0x9fef('0x8'));var config=require(_0x9fef('0x9'));var attributes=require(_0x9fef('0xa'));module[_0x9fef('0xb')]=function(_0x45720d,_0x26ddb6){return _0x45720d[_0x9fef('0xc')](_0x9fef('0xd'),attributes,{'tableName':_0x9fef('0xe'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 4681d21..eb2b972 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 _0x223b=['options','then','CreateVoiceDialReport','UpdateVoiceDialReport','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','VoiceDialReport','create','body'];(function(_0x5ca8be,_0x142c11){var _0x5046fc=function(_0x4c5af4){while(--_0x4c5af4){_0x5ca8be['push'](_0x5ca8be['shift']());}};_0x5046fc(++_0x142c11);}(_0x223b,0x9c));var _0xb223=function(_0x45f8bd,_0x1f5a27){_0x45f8bd=_0x45f8bd-0x0;var _0x5d77ff=_0x223b[_0x45f8bd];return _0x5d77ff;};'use strict';var _=require(_0xb223('0x0'));var util=require(_0xb223('0x1'));var moment=require(_0xb223('0x2'));var BPromise=require(_0xb223('0x3'));var rs=require(_0xb223('0x4'));var fs=require('fs');var Redis=require(_0xb223('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb223('0x6'));var logger=require(_0xb223('0x7'))(_0xb223('0x8'));var config=require(_0xb223('0x9'));var jayson=require(_0xb223('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3d42da,_0x497634,_0x5e6eba){return new BPromise(function(_0x5995d4,_0x3a4bc6){return client['request'](_0x3d42da,_0x5e6eba)['then'](function(_0x12fa9a){logger[_0xb223('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x497634,_0xb223('0xc'));logger[_0xb223('0xd')](_0xb223('0xe'),_0x497634,_0xb223('0xc'),JSON['stringify'](_0x12fa9a));if(_0x12fa9a[_0xb223('0xf')]){if(_0x12fa9a[_0xb223('0xf')][_0xb223('0x10')]===0x1f4){logger[_0xb223('0xf')](_0xb223('0x11'),_0x497634,_0x12fa9a[_0xb223('0xf')]['message']);return _0x3a4bc6(_0x12fa9a['error'][_0xb223('0x12')]);}logger[_0xb223('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x497634,_0x12fa9a[_0xb223('0xf')]['message']);return _0x5995d4(_0x12fa9a['error'][_0xb223('0x12')]);}else{logger[_0xb223('0xb')](_0xb223('0x11'),_0x497634,_0xb223('0xc'));_0x5995d4(_0x12fa9a[_0xb223('0x13')]['message']);}})[_0xb223('0x14')](function(_0x1e37b6){logger[_0xb223('0xf')](_0xb223('0x11'),_0x497634,_0x1e37b6);_0x3a4bc6(_0x1e37b6);});});}exports['CreateVoiceDialReport']=function(_0x21dc98){var _0x11ca74=this;return new Promise(function(_0xf0a2e6,_0x3bd6bc){return db[_0xb223('0x15')][_0xb223('0x16')](_0x21dc98[_0xb223('0x17')],{'raw':_0x21dc98[_0xb223('0x18')]?_0x21dc98[_0xb223('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xb223('0x19')](function(_0x41259b){logger[_0xb223('0xb')](_0xb223('0x1a'),_0x21dc98);logger['debug'](_0xb223('0x1a'),_0x21dc98,JSON['stringify'](_0x41259b));_0xf0a2e6(_0x41259b);})['catch'](function(_0x30099a){logger[_0xb223('0xf')]('CreateVoiceDialReport',_0x30099a[_0xb223('0x12')],_0x21dc98);_0x3bd6bc(_0x11ca74[_0xb223('0xf')](0x1f4,_0x30099a[_0xb223('0x12')]));});});};exports[_0xb223('0x1b')]=function(_0x31140f){var _0x5bd2d3=this;return new Promise(function(_0x17642f,_0x228b59){return db['VoiceDialReport']['update'](_0x31140f[_0xb223('0x17')],{'raw':_0x31140f['options']?_0x31140f['options'][_0xb223('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31140f[_0xb223('0x18')]?_0x31140f[_0xb223('0x18')]['where']||null:null,'attributes':_0x31140f[_0xb223('0x18')]?_0x31140f[_0xb223('0x18')]['attributes']||null:null,'limit':_0x31140f[_0xb223('0x18')]?_0x31140f['options']['limit']||null:null})[_0xb223('0x19')](function(_0x5a28f3){logger[_0xb223('0xb')](_0xb223('0x1b'),_0x31140f);logger[_0xb223('0xd')](_0xb223('0x1b'),_0x31140f,JSON[_0xb223('0x1d')](_0x5a28f3));_0x17642f(_0x5a28f3);})[_0xb223('0x14')](function(_0x4c9a62){logger['error'](_0xb223('0x1b'),_0x4c9a62['message'],_0x31140f);_0x228b59(_0x5bd2d3[_0xb223('0xf')](0x1f4,_0x4c9a62[_0xb223('0x12')]));});});}; \ No newline at end of file +var _0x664b=['create','body','options','raw','CreateVoiceDialReport','where','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceDialReport'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x664b,0xb2));var _0xb664=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x664b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb664('0x0'));var util=require(_0xb664('0x1'));var moment=require(_0xb664('0x2'));var BPromise=require(_0xb664('0x3'));var rs=require(_0xb664('0x4'));var fs=require('fs');var Redis=require(_0xb664('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb664('0x6'));var logger=require(_0xb664('0x7'))(_0xb664('0x8'));var config=require(_0xb664('0x9'));var jayson=require(_0xb664('0xa'));var client=jayson[_0xb664('0xb')][_0xb664('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a2b97,_0x38ac19,_0x3236c0){return new BPromise(function(_0x44bdac,_0x5f3d8d){return client['request'](_0x4a2b97,_0x3236c0)[_0xb664('0xd')](function(_0x8c56b0){logger[_0xb664('0xe')](_0xb664('0xf'),_0x38ac19,_0xb664('0x10'));logger[_0xb664('0x11')](_0xb664('0x12'),_0x38ac19,_0xb664('0x10'),JSON[_0xb664('0x13')](_0x8c56b0));if(_0x8c56b0[_0xb664('0x14')]){if(_0x8c56b0['error'][_0xb664('0x15')]===0x1f4){logger[_0xb664('0x14')](_0xb664('0xf'),_0x38ac19,_0x8c56b0[_0xb664('0x14')][_0xb664('0x16')]);return _0x5f3d8d(_0x8c56b0[_0xb664('0x14')][_0xb664('0x16')]);}logger[_0xb664('0x14')](_0xb664('0xf'),_0x38ac19,_0x8c56b0[_0xb664('0x14')][_0xb664('0x16')]);return _0x44bdac(_0x8c56b0['error']['message']);}else{logger['info'](_0xb664('0xf'),_0x38ac19,_0xb664('0x10'));_0x44bdac(_0x8c56b0[_0xb664('0x17')][_0xb664('0x16')]);}})[_0xb664('0x18')](function(_0x99e7bd){logger[_0xb664('0x14')](_0xb664('0xf'),_0x38ac19,_0x99e7bd);_0x5f3d8d(_0x99e7bd);});});}exports['CreateVoiceDialReport']=function(_0x39aaaf){var _0x54d4b7=this;return new Promise(function(_0x527ba4,_0x13473f){return db[_0xb664('0x19')][_0xb664('0x1a')](_0x39aaaf[_0xb664('0x1b')],{'raw':_0x39aaaf[_0xb664('0x1c')]?_0x39aaaf[_0xb664('0x1c')][_0xb664('0x1d')]===undefined?!![]:![]:!![]})[_0xb664('0xd')](function(_0x43488b){logger[_0xb664('0xe')](_0xb664('0x1e'),_0x39aaaf);logger[_0xb664('0x11')]('CreateVoiceDialReport',_0x39aaaf,JSON[_0xb664('0x13')](_0x43488b));_0x527ba4(_0x43488b);})[_0xb664('0x18')](function(_0x1a12de){logger['error'](_0xb664('0x1e'),_0x1a12de[_0xb664('0x16')],_0x39aaaf);_0x13473f(_0x54d4b7[_0xb664('0x14')](0x1f4,_0x1a12de[_0xb664('0x16')]));});});};exports['UpdateVoiceDialReport']=function(_0x31a834){var _0x81e2b5=this;return new Promise(function(_0x4bbec5,_0x587541){return db[_0xb664('0x19')]['update'](_0x31a834[_0xb664('0x1b')],{'raw':_0x31a834[_0xb664('0x1c')]?_0x31a834[_0xb664('0x1c')][_0xb664('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31a834['options']?_0x31a834[_0xb664('0x1c')][_0xb664('0x1f')]||null:null,'attributes':_0x31a834[_0xb664('0x1c')]?_0x31a834[_0xb664('0x1c')]['attributes']||null:null,'limit':_0x31a834[_0xb664('0x1c')]?_0x31a834[_0xb664('0x1c')][_0xb664('0x20')]||null:null})['then'](function(_0x3ff893){logger['info']('UpdateVoiceDialReport',_0x31a834);logger[_0xb664('0x11')](_0xb664('0x21'),_0x31a834,JSON['stringify'](_0x3ff893));_0x4bbec5(_0x3ff893);})['catch'](function(_0x12d28e){logger[_0xb664('0x14')](_0xb664('0x21'),_0x12d28e[_0xb664('0x16')],_0x31a834);_0x587541(_0x81e2b5[_0xb664('0x14')](0x1f4,_0x12d28e[_0xb664('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 8fc0125..84e6fda 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 _0x6462=['/:id','show','post','create','/:id/applications','addApplications','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index'];(function(_0x580ba5,_0x28285f){var _0x7e801b=function(_0x4c2e92){while(--_0x4c2e92){_0x580ba5['push'](_0x580ba5['shift']());}};_0x7e801b(++_0x28285f);}(_0x6462,0xe6));var _0x2646=function(_0x19331b,_0x175110){_0x19331b=_0x19331b-0x0;var _0x54221b=_0x6462[_0x19331b];return _0x54221b;};'use strict';var multer=require(_0x2646('0x0'));var util=require(_0x2646('0x1'));var path=require(_0x2646('0x2'));var timeout=require(_0x2646('0x3'));var express=require(_0x2646('0x4'));var router=express[_0x2646('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2646('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2646('0x7'));var controller=require(_0x2646('0x8'));router[_0x2646('0x9')]('/',auth[_0x2646('0xa')](),controller[_0x2646('0xb')]);router[_0x2646('0x9')](_0x2646('0xc'),auth['isAuthenticated'](),controller[_0x2646('0xd')]);router[_0x2646('0xe')]('/',auth[_0x2646('0xa')](),controller[_0x2646('0xf')]);router[_0x2646('0xe')](_0x2646('0x10'),auth[_0x2646('0xa')](),controller[_0x2646('0x11')]);router[_0x2646('0x12')](_0x2646('0xc'),auth[_0x2646('0xa')](),controller[_0x2646('0x13')]);router[_0x2646('0x14')]('/:id',auth[_0x2646('0xa')](),controller[_0x2646('0x15')]);module['exports']=router; \ No newline at end of file +var _0xe19c=['path','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','destroy','util'];(function(_0x49f25f,_0x342a75){var _0x227ed0=function(_0xab07e3){while(--_0xab07e3){_0x49f25f['push'](_0x49f25f['shift']());}};_0x227ed0(++_0x342a75);}(_0xe19c,0x175));var _0xce19=function(_0x152c94,_0x1b9c39){_0x152c94=_0x152c94-0x0;var _0x4c46e8=_0xe19c[_0x152c94];return _0x4c46e8;};'use strict';var multer=require('multer');var util=require(_0xce19('0x0'));var path=require(_0xce19('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xce19('0x2'));var interaction=require(_0xce19('0x3'));var config=require(_0xce19('0x4'));var controller=require(_0xce19('0x5'));router[_0xce19('0x6')]('/',auth[_0xce19('0x7')](),controller[_0xce19('0x8')]);router[_0xce19('0x6')](_0xce19('0x9'),auth[_0xce19('0x7')](),controller[_0xce19('0xa')]);router[_0xce19('0xb')]('/',auth['isAuthenticated'](),controller[_0xce19('0xc')]);router['post'](_0xce19('0xd'),auth[_0xce19('0x7')](),controller[_0xce19('0xe')]);router[_0xce19('0xf')]('/:id',auth[_0xce19('0x7')](),controller['update']);router['delete'](_0xce19('0x9'),auth['isAuthenticated'](),controller[_0xce19('0x10')]);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 590b7ae..e43d363 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 _0x68e5=['BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','exports','STRING','compositeIndex','ENUM','inbound','outbound','internal','system','any','*,*,*,*','INTEGER'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x68e5,0x144));var _0x568e=function(_0x30699f,_0x3be6ec){_0x30699f=_0x30699f-0x0;var _0x4aeeba=_0x68e5[_0x30699f];return _0x4aeeba;};'use strict';var Sequelize=require(_0x568e('0x0'));module[_0x568e('0x1')]={'context':{'type':Sequelize[_0x568e('0x2')],'allowNull':![],'unique':_0x568e('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x568e('0x2')],'allowNull':![],'unique':_0x568e('0x3')},'priority':{'type':Sequelize[_0x568e('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x568e('0x3')},'tag':{'type':Sequelize[_0x568e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x568e('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x568e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x568e('0x4')](_0x568e('0x5'),_0x568e('0x6'),_0x568e('0x7'),'inbound-fax','outbound-fax',_0x568e('0x8'),_0x568e('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x568e('0x2')]},'interval':{'type':Sequelize[_0x568e('0x2')],'allowNull':![],'defaultValue':_0x568e('0xa')},'IntervalId':{'type':Sequelize[_0x568e('0xb')]},'isApp':{'type':Sequelize[_0x568e('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x568e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x568e('0xb')]},'recordingFormat':{'type':Sequelize[_0x568e('0x2')],'defaultValue':_0x568e('0xd')},'answer':{'type':Sequelize[_0x568e('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x568e('0xe')],'get':function(_0x14bb86){return this[_0x568e('0xf')]('exten');}},'alias':{'type':Sequelize[_0x568e('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x4fed=['wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','INTEGER','BOOLEAN'];(function(_0x1616ed,_0x226ec1){var _0x515008=function(_0x233b42){while(--_0x233b42){_0x1616ed['push'](_0x1616ed['shift']());}};_0x515008(++_0x226ec1);}(_0x4fed,0x180));var _0xd4fe=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0x4fed[_0x1f1a97];return _0x29fc6a;};'use strict';var Sequelize=require(_0xd4fe('0x0'));module[_0xd4fe('0x1')]={'context':{'type':Sequelize[_0xd4fe('0x2')],'allowNull':![],'unique':_0xd4fe('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xd4fe('0x2')],'allowNull':![],'unique':_0xd4fe('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xd4fe('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xd4fe('0x2')],'allowNull':![],'defaultValue':_0xd4fe('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xd4fe('0x5')](_0xd4fe('0x6'),_0xd4fe('0x7'),_0xd4fe('0x8'),_0xd4fe('0x9'),_0xd4fe('0xa'),_0xd4fe('0xb'),_0xd4fe('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0xd4fe('0x2')]},'interval':{'type':Sequelize[_0xd4fe('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xd4fe('0xd')]},'isApp':{'type':Sequelize[_0xd4fe('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xd4fe('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xd4fe('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xd4fe('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xd4fe('0xd')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xd4fe('0xf')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xd4fe('0x10')],'get':function(_0xefbeb6){return this[_0xd4fe('0x11')](_0xd4fe('0x12'));}},'alias':{'type':Sequelize[_0xd4fe('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 6604d97..87d6dbd 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 _0x44f5=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','status','end','json','offset','undefined','count','limit','Content-Range','destroy','then','get','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','includes','type','find','value','name','UserProfileResource','sendStatus','error','send','rawAttributes','fieldName','key','model','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','VoiceExtension','include','findAll','catch','show','params','keys','includeAll','create','body','exten','concat','user','role','InboundRoutes','inbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','isApp','createRouting','findAndCountAll','stack','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x44f5,0x1cb));var _0x544f=function(_0x2b729a,_0x21945a){_0x2b729a=_0x2b729a-0x0;var _0x4a398d=_0x44f5[_0x2b729a];return _0x4a398d;};'use strict';var _=require(_0x544f('0x0'));var Redis=require(_0x544f('0x1'));var qs=require(_0x544f('0x2'));var logger=require(_0x544f('0x3'))(_0x544f('0x4'));var config=require(_0x544f('0x5'));var db=require(_0x544f('0x6'))['db'];config[_0x544f('0x7')]=_[_0x544f('0x8')](config['redis'],{'host':_0x544f('0x9'),'port':0x18eb});var socket=require(_0x544f('0xa'))(new Redis(config[_0x544f('0x7')]));require(_0x544f('0xb'))[_0x544f('0xc')](socket);function respondWithStatusCode(_0x19e550,_0x1077a6){_0x1077a6=_0x1077a6||0xcc;return function(_0x2a5a71){if(_0x2a5a71){return _0x19e550['sendStatus'](_0x1077a6);}return _0x19e550[_0x544f('0xd')](_0x1077a6)[_0x544f('0xe')]();};}function respondWithResult(_0x37a68a,_0x2dee08){_0x2dee08=_0x2dee08||0xc8;return function(_0x300f2d){if(_0x300f2d){return _0x37a68a[_0x544f('0xd')](_0x2dee08)[_0x544f('0xf')](_0x300f2d);}};}function respondWithFilteredResult(_0x5119e9,_0x50a3ce){return function(_0x2ad994){if(_0x2ad994){var _0x317453=typeof _0x50a3ce[_0x544f('0x10')]===_0x544f('0x11')&&typeof _0x50a3ce['limit']===_0x544f('0x11');var _0x2cc5d1=_0x2ad994[_0x544f('0x12')];var _0x5dd739=_0x317453?0x0:_0x50a3ce[_0x544f('0x10')];var _0x49a7c6=_0x317453?_0x2ad994['count']:_0x50a3ce['offset']+_0x50a3ce[_0x544f('0x13')];var _0x2576f0;if(_0x49a7c6>=_0x2cc5d1){_0x49a7c6=_0x2cc5d1;_0x2576f0=0xc8;}else{_0x2576f0=0xce;}_0x5119e9[_0x544f('0xd')](_0x2576f0);return _0x5119e9['set'](_0x544f('0x14'),_0x5dd739+'-'+_0x49a7c6+'/'+_0x2cc5d1)[_0x544f('0xf')](_0x2ad994);}return null;};}function removeEntity(_0x28651e){return function(_0x4bd775){if(_0x4bd775){return _0x4bd775[_0x544f('0x15')]()[_0x544f('0x16')](function(){var _0x14e2a9=_0x4bd775[_0x544f('0x17')]({'plain':!![]});var _0x50d9bf=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x544f('0x18'),'value':_0x544f('0x19'),'ignore':![]},{'name':_0x544f('0x1a'),'value':_0x544f('0x1b'),'ignore':![]}];var _0x40bafa=_(_0x50d9bf)[_0x544f('0x1c')](_0x544f('0x1d'))[_0x544f('0x1e')]('value')['value']();if(_[_0x544f('0x1f')](_0x40bafa,_0x14e2a9[_0x544f('0x20')])){return;}var _0x552107=_[_0x544f('0x21')](_0x50d9bf,[_0x544f('0x22'),_0x14e2a9['type']])[_0x544f('0x23')];return db[_0x544f('0x24')][_0x544f('0x15')]({'where':{'type':_0x552107,'resourceId':_0x14e2a9['id']}})['then'](function(){return _0x4bd775;});})[_0x544f('0x16')](function(){_0x28651e['status'](0xcc)[_0x544f('0xe')]();});}};}function handleEntityNotFound(_0x2490f8){return function(_0x2ae2d6){if(!_0x2ae2d6){_0x2490f8[_0x544f('0x25')](0x194);}return _0x2ae2d6;};}function handleError(_0x53c5f0,_0x1e6385){_0x1e6385=_0x1e6385||0x1f4;return function(_0x1db103){logger[_0x544f('0x26')](_0x1db103['stack']);if(_0x1db103[_0x544f('0x23')]){delete _0x1db103['name'];}_0x53c5f0[_0x544f('0xd')](_0x1e6385)[_0x544f('0x27')](_0x1db103);};}exports['index']=function(_0x101888,_0x408086){var _0x5b3d48={},_0x523963={},_0xc18c23={'count':0x0,'rows':[]};var _0x54ee66=_['map'](db['VoiceExtension'][_0x544f('0x28')],function(_0x58bade){return{'name':_0x58bade[_0x544f('0x29')],'type':_0x58bade[_0x544f('0x20')][_0x544f('0x2a')]};});_0x523963[_0x544f('0x2b')]=_[_0x544f('0x1e')](_0x54ee66,_0x544f('0x23'));_0x523963['query']=_['keys'](_0x101888['query']);_0x523963['filters']=_[_0x544f('0x2c')](_0x523963['model'],_0x523963[_0x544f('0x2d')]);_0x5b3d48[_0x544f('0x2e')]=_['intersection'](_0x523963[_0x544f('0x2b')],qs[_0x544f('0x2f')](_0x101888[_0x544f('0x2d')][_0x544f('0x2f')]));_0x5b3d48[_0x544f('0x2e')]=_0x5b3d48[_0x544f('0x2e')][_0x544f('0x30')]?_0x5b3d48[_0x544f('0x2e')]:_0x523963[_0x544f('0x2b')];if(!_0x101888[_0x544f('0x2d')][_0x544f('0x31')](_0x544f('0x32'))){_0x5b3d48[_0x544f('0x13')]=qs[_0x544f('0x13')](_0x101888[_0x544f('0x2d')]['limit']);_0x5b3d48[_0x544f('0x10')]=qs[_0x544f('0x10')](_0x101888[_0x544f('0x2d')][_0x544f('0x10')]);}_0x5b3d48[_0x544f('0x33')]=qs[_0x544f('0x34')](_0x101888[_0x544f('0x2d')][_0x544f('0x34')]);_0x5b3d48[_0x544f('0x35')]=qs[_0x544f('0x36')](_[_0x544f('0x37')](_0x101888[_0x544f('0x2d')],_0x523963[_0x544f('0x36')]),_0x54ee66);if(_0x101888[_0x544f('0x2d')]['filter']){_0x5b3d48[_0x544f('0x35')]=_[_0x544f('0x38')](_0x5b3d48[_0x544f('0x35')],{'$or':_[_0x544f('0x1e')](_0x54ee66,function(_0x40bee6){if(_0x40bee6[_0x544f('0x20')]!==_0x544f('0x39')){var _0x46a12e={};_0x46a12e[_0x40bee6[_0x544f('0x23')]]={'$like':'%'+_0x101888['query'][_0x544f('0x1c')]+'%'};return _0x46a12e;}})});}_0x5b3d48=_['merge']({},_0x5b3d48,_0x101888[_0x544f('0x3a')]);var _0x50edcf={'where':_0x5b3d48[_0x544f('0x35')]};return db[_0x544f('0x3b')][_0x544f('0x12')](_0x50edcf)[_0x544f('0x16')](function(_0x388db9){_0xc18c23[_0x544f('0x12')]=_0x388db9;if(_0x101888[_0x544f('0x2d')]['includeAll']){_0x5b3d48[_0x544f('0x3c')]=[{'all':!![]}];}return db[_0x544f('0x3b')][_0x544f('0x3d')](_0x5b3d48);})[_0x544f('0x16')](function(_0x206ccb){_0xc18c23['rows']=_0x206ccb;return _0xc18c23;})[_0x544f('0x16')](respondWithFilteredResult(_0x408086,_0x5b3d48))[_0x544f('0x3e')](handleError(_0x408086,null));};exports[_0x544f('0x3f')]=function(_0x256740,_0x31a74e){var _0x33e9cd={'raw':![],'where':{'id':_0x256740[_0x544f('0x40')]['id']}},_0x395c5d={};_0x395c5d[_0x544f('0x2b')]=_[_0x544f('0x41')](db[_0x544f('0x3b')]['rawAttributes']);_0x395c5d['query']=_['keys'](_0x256740[_0x544f('0x2d')]);_0x395c5d[_0x544f('0x36')]=_['intersection'](_0x395c5d[_0x544f('0x2b')],_0x395c5d[_0x544f('0x2d')]);_0x33e9cd[_0x544f('0x2e')]=_['intersection'](_0x395c5d[_0x544f('0x2b')],qs[_0x544f('0x2f')](_0x256740[_0x544f('0x2d')][_0x544f('0x2f')]));_0x33e9cd['attributes']=_0x33e9cd[_0x544f('0x2e')][_0x544f('0x30')]?_0x33e9cd[_0x544f('0x2e')]:_0x395c5d[_0x544f('0x2b')];if(_0x256740[_0x544f('0x2d')][_0x544f('0x42')]){_0x33e9cd[_0x544f('0x3c')]=[{'all':!![]}];}_0x33e9cd=_['merge']({},_0x33e9cd,_0x256740[_0x544f('0x3a')]);return db[_0x544f('0x3b')][_0x544f('0x21')](_0x33e9cd)[_0x544f('0x16')](handleEntityNotFound(_0x31a74e,null))[_0x544f('0x16')](respondWithResult(_0x31a74e,null))[_0x544f('0x3e')](handleError(_0x31a74e,null));};exports[_0x544f('0x15')]=function(_0x1418ba,_0x4be0c5){return db[_0x544f('0x3b')]['find']({'where':{'id':_0x1418ba[_0x544f('0x40')]['id']}})['then'](handleEntityNotFound(_0x4be0c5,null))[_0x544f('0x16')](removeEntity(_0x4be0c5,null))[_0x544f('0x3e')](handleError(_0x4be0c5,null));};exports[_0x544f('0x43')]=function(_0x5bedb1,_0x43ead7){if(_0x5bedb1[_0x544f('0x44')]['type']===_0x544f('0x19')&&!_['startsWith'](_0x5bedb1['body'][_0x544f('0x45')],'_')){_0x5bedb1['body'][_0x544f('0x45')]='_'[_0x544f('0x46')](_0x5bedb1['body'][_0x544f('0x45')]);}return db[_0x544f('0x3b')][_0x544f('0x43')](_0x5bedb1[_0x544f('0x44')],{'raw':![]})[_0x544f('0x16')](function(_0x1b3a46){var _0x14c7f7=_0x5bedb1[_0x544f('0x47')][_0x544f('0x17')]({'plain':!![]});if(!_0x14c7f7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14c7f7[_0x544f('0x48')]===_0x544f('0x47')){var _0x874dba=_0x1b3a46[_0x544f('0x17')]({'plain':!![]});var _0x37c29b=[{'name':_0x544f('0x49'),'value':_0x544f('0x4a')},{'name':_0x544f('0x18'),'value':_0x544f('0x19')},{'name':_0x544f('0x1a'),'value':'internal'}];var _0x1afcb1=_[_0x544f('0x21')](_0x37c29b,[_0x544f('0x22'),_0x874dba['type']])['name'];return db[_0x544f('0x4b')][_0x544f('0x21')]({'where':{'name':_0x1afcb1,'userProfileId':_0x14c7f7[_0x544f('0x4c')]},'raw':!![]})[_0x544f('0x16')](function(_0x5301d1){if(_0x5301d1&&_0x5301d1['autoAssociation']===0x0){return db['UserProfileResource'][_0x544f('0x43')]({'name':_0x874dba[_0x544f('0x23')],'resourceId':_0x874dba['id'],'type':_0x5301d1[_0x544f('0x23')],'sectionId':_0x5301d1['id']},{})[_0x544f('0x16')](function(){return _0x1b3a46;});}else{return _0x1b3a46;}})['catch'](function(_0x3456d1){logger['error'](_0x544f('0x4d'),_0x3456d1);throw _0x3456d1;});}return _0x1b3a46;})[_0x544f('0x16')](respondWithResult(_0x43ead7,0xc9))[_0x544f('0x3e')](handleError(_0x43ead7,null));};exports[_0x544f('0x4e')]=function(_0x272b92,_0x17108b){if(_0x272b92['body']['id']){delete _0x272b92['body']['id'];}return db[_0x544f('0x3b')]['find']({'where':{'id':_0x272b92[_0x544f('0x40')]['id']}})['then'](handleEntityNotFound(_0x17108b,null))[_0x544f('0x16')](function(_0x59542e){if(_0x59542e){return db[_0x544f('0x3b')][_0x544f('0x4e')](_['pick'](_0x272b92[_0x544f('0x44')],[_0x544f('0x45'),_0x544f('0x4f'),'description','recordingFormat','cutdigits','mandatoryDisposition',_0x544f('0x50')]),{'where':{'context':_0x59542e[_0x544f('0x4f')],'exten':_0x59542e['exten']},'individualHooks':!![]})['then'](function(_0x41ce35){return _0x41ce35;});}return null;})['then'](respondWithStatusCode(_0x17108b,null))['catch'](handleError(_0x17108b,null));};exports[_0x544f('0x51')]=function(_0x178fa3,_0x415454){var _0x287556=_0x178fa3[_0x544f('0x40')]['id'];var _0x4bab96=_0x178fa3[_0x544f('0x44')];var _0x59fbf4=0xc8;var _0x440edf=null;return db[_0x544f('0x52')][_0x544f('0x53')]({'isolationLevel':db[_0x544f('0x52')][_0x544f('0x54')][_0x544f('0x55')][_0x544f('0x56')]},function(_0x36b273){return db[_0x544f('0x3b')][_0x544f('0x57')]({'where':{'id':_0x287556},'transaction':_0x36b273})[_0x544f('0x16')](function(_0x1dade2){if(_0x1dade2){return db[_0x544f('0x3b')][_0x544f('0x15')]({'where':{'VoiceExtensionId':_0x287556},'transaction':_0x36b273})['then'](function(){var _0x2e437b=_[_0x544f('0x1e')](_0x4bab96,function(_0x4f1400){_0x4f1400['VoiceExtensionId']=_0x287556;_0x4f1400[_0x544f('0x58')]=!![];return _0x4f1400;});return _0x1dade2[_0x544f('0x59')](_0x2e437b);})[_0x544f('0x16')](function(_0x5cf97b){return db[_0x544f('0x3b')]['bulkCreate'](_0x5cf97b,{'transaction':_0x36b273});});}else{_0x59fbf4=0x194;_0x440edf=[];}});})['then'](function(){if(_0x59fbf4!==0x194){return db[_0x544f('0x3b')][_0x544f('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x287556},'order':'cast(priority\x20as\x20unsigned)'})['then'](function(_0x3fbc08){_0x440edf=_0x3fbc08;});}})[_0x544f('0x3e')](function(_0x3673cd){_0x59fbf4=0x1f4;logger[_0x544f('0x26')](_0x3673cd[_0x544f('0x5b')]);if(_0x3673cd[_0x544f('0x23')]){delete _0x3673cd[_0x544f('0x23')];}_0x440edf=_0x3673cd;})[_0x544f('0x5c')](function(){if(_0x440edf===null){_0x415454[_0x544f('0x25')](_0x59fbf4);}else{if(_0x59fbf4===0x1f4){_0x415454[_0x544f('0xd')](_0x59fbf4)[_0x544f('0x27')](_0x440edf);}else{_0x415454[_0x544f('0xd')](_0x59fbf4)[_0x544f('0xf')](_0x440edf);}}});}; \ No newline at end of file +var _0x662f=['findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','count','set','json','then','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','includes','find','type','name','destroy','error','send','VoiceExtension','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','limit','order','sort','where','VIRTUAL','merge','include','findAll','rows','catch','params','fields','length','includeAll','create','body','outbound','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','recordingFormat','mandatoryDisposition','alias','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate'];(function(_0x3b16e1,_0x3bda3e){var _0x311d1b=function(_0x2a979b){while(--_0x2a979b){_0x3b16e1['push'](_0x3b16e1['shift']());}};_0x311d1b(++_0x3bda3e);}(_0x662f,0x64));var _0xf662=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x662f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf662('0x0'));var Redis=require(_0xf662('0x1'));var qs=require(_0xf662('0x2'));var logger=require(_0xf662('0x3'))('api');var config=require(_0xf662('0x4'));var db=require(_0xf662('0x5'))['db'];config[_0xf662('0x6')]=_[_0xf662('0x7')](config[_0xf662('0x6')],{'host':_0xf662('0x8'),'port':0x18eb});var socket=require(_0xf662('0x9'))(new Redis(config[_0xf662('0x6')]));require(_0xf662('0xa'))[_0xf662('0xb')](socket);function respondWithStatusCode(_0x3accd6,_0x29d4ab){_0x29d4ab=_0x29d4ab||0xcc;return function(_0x17d05e){if(_0x17d05e){return _0x3accd6[_0xf662('0xc')](_0x29d4ab);}return _0x3accd6[_0xf662('0xd')](_0x29d4ab)[_0xf662('0xe')]();};}function respondWithResult(_0x56ecb1,_0x510f01){_0x510f01=_0x510f01||0xc8;return function(_0x182a17){if(_0x182a17){return _0x56ecb1[_0xf662('0xd')](_0x510f01)['json'](_0x182a17);}};}function respondWithFilteredResult(_0xcbebb3,_0x4045ef){return function(_0x37fb7f){if(_0x37fb7f){var _0x2741db=typeof _0x4045ef[_0xf662('0xf')]==='undefined'&&typeof _0x4045ef['limit']===_0xf662('0x10');var _0x4fe01b=_0x37fb7f['count'];var _0x1a4f71=_0x2741db?0x0:_0x4045ef[_0xf662('0xf')];var _0x3022e4=_0x2741db?_0x37fb7f[_0xf662('0x11')]:_0x4045ef[_0xf662('0xf')]+_0x4045ef['limit'];var _0x276c95;if(_0x3022e4>=_0x4fe01b){_0x3022e4=_0x4fe01b;_0x276c95=0xc8;}else{_0x276c95=0xce;}_0xcbebb3[_0xf662('0xd')](_0x276c95);return _0xcbebb3[_0xf662('0x12')]('Content-Range',_0x1a4f71+'-'+_0x3022e4+'/'+_0x4fe01b)[_0xf662('0x13')](_0x37fb7f);}return null;};}function removeEntity(_0xb68a4c){return function(_0x598fce){if(_0x598fce){return _0x598fce['destroy']()[_0xf662('0x14')](function(){var _0x2bdc30=_0x598fce[_0xf662('0x15')]({'plain':!![]});var _0x37e32e=[{'name':_0xf662('0x16'),'value':_0xf662('0x17'),'ignore':![]},{'name':_0xf662('0x18'),'value':'outbound','ignore':![]},{'name':_0xf662('0x19'),'value':_0xf662('0x1a'),'ignore':![]}];var _0x60b6e7=_(_0x37e32e)[_0xf662('0x1b')](_0xf662('0x1c'))[_0xf662('0x1d')](_0xf662('0x1e'))[_0xf662('0x1e')]();if(_[_0xf662('0x1f')](_0x60b6e7,_0x2bdc30['type'])){return;}var _0x17a629=_[_0xf662('0x20')](_0x37e32e,[_0xf662('0x1e'),_0x2bdc30[_0xf662('0x21')]])[_0xf662('0x22')];return db['UserProfileResource'][_0xf662('0x23')]({'where':{'type':_0x17a629,'resourceId':_0x2bdc30['id']}})[_0xf662('0x14')](function(){return _0x598fce;});})['then'](function(){_0xb68a4c[_0xf662('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55a8c3){return function(_0x2886b6){if(!_0x2886b6){_0x55a8c3[_0xf662('0xc')](0x194);}return _0x2886b6;};}function handleError(_0x5e85df,_0x2e7f5f){_0x2e7f5f=_0x2e7f5f||0x1f4;return function(_0x4f29b9){logger[_0xf662('0x24')](_0x4f29b9['stack']);if(_0x4f29b9[_0xf662('0x22')]){delete _0x4f29b9[_0xf662('0x22')];}_0x5e85df['status'](_0x2e7f5f)[_0xf662('0x25')](_0x4f29b9);};}exports['index']=function(_0x318f45,_0x33be1b){var _0x3ed5cd={},_0x3caf46={},_0x1a61e4={'count':0x0,'rows':[]};var _0x25873f=_[_0xf662('0x1d')](db[_0xf662('0x26')][_0xf662('0x27')],function(_0x4da245){return{'name':_0x4da245[_0xf662('0x28')],'type':_0x4da245['type'][_0xf662('0x29')]};});_0x3caf46['model']=_['map'](_0x25873f,_0xf662('0x22'));_0x3caf46[_0xf662('0x2a')]=_[_0xf662('0x2b')](_0x318f45[_0xf662('0x2a')]);_0x3caf46[_0xf662('0x2c')]=_[_0xf662('0x2d')](_0x3caf46[_0xf662('0x2e')],_0x3caf46[_0xf662('0x2a')]);_0x3ed5cd[_0xf662('0x2f')]=_[_0xf662('0x2d')](_0x3caf46[_0xf662('0x2e')],qs['fields'](_0x318f45[_0xf662('0x2a')]['fields']));_0x3ed5cd[_0xf662('0x2f')]=_0x3ed5cd[_0xf662('0x2f')]['length']?_0x3ed5cd[_0xf662('0x2f')]:_0x3caf46[_0xf662('0x2e')];if(!_0x318f45['query'][_0xf662('0x30')]('nolimit')){_0x3ed5cd['limit']=qs[_0xf662('0x31')](_0x318f45[_0xf662('0x2a')][_0xf662('0x31')]);_0x3ed5cd['offset']=qs[_0xf662('0xf')](_0x318f45[_0xf662('0x2a')][_0xf662('0xf')]);}_0x3ed5cd[_0xf662('0x32')]=qs[_0xf662('0x33')](_0x318f45['query'][_0xf662('0x33')]);_0x3ed5cd['where']=qs[_0xf662('0x2c')](_['pick'](_0x318f45[_0xf662('0x2a')],_0x3caf46[_0xf662('0x2c')]),_0x25873f);if(_0x318f45['query'][_0xf662('0x1b')]){_0x3ed5cd[_0xf662('0x34')]=_['merge'](_0x3ed5cd[_0xf662('0x34')],{'$or':_[_0xf662('0x1d')](_0x25873f,function(_0x50855d){if(_0x50855d['type']!==_0xf662('0x35')){var _0x5e498a={};_0x5e498a[_0x50855d[_0xf662('0x22')]]={'$like':'%'+_0x318f45['query'][_0xf662('0x1b')]+'%'};return _0x5e498a;}})});}_0x3ed5cd=_[_0xf662('0x36')]({},_0x3ed5cd,_0x318f45['options']);var _0x4c8c8a={'where':_0x3ed5cd['where']};return db[_0xf662('0x26')][_0xf662('0x11')](_0x4c8c8a)[_0xf662('0x14')](function(_0x1d0b71){_0x1a61e4[_0xf662('0x11')]=_0x1d0b71;if(_0x318f45[_0xf662('0x2a')]['includeAll']){_0x3ed5cd[_0xf662('0x37')]=[{'all':!![]}];}return db[_0xf662('0x26')][_0xf662('0x38')](_0x3ed5cd);})[_0xf662('0x14')](function(_0x1e4603){_0x1a61e4[_0xf662('0x39')]=_0x1e4603;return _0x1a61e4;})['then'](respondWithFilteredResult(_0x33be1b,_0x3ed5cd))[_0xf662('0x3a')](handleError(_0x33be1b,null));};exports['show']=function(_0x1407aa,_0xf32d4c){var _0x4ff601={'raw':![],'where':{'id':_0x1407aa[_0xf662('0x3b')]['id']}},_0x596157={};_0x596157[_0xf662('0x2e')]=_[_0xf662('0x2b')](db[_0xf662('0x26')][_0xf662('0x27')]);_0x596157[_0xf662('0x2a')]=_[_0xf662('0x2b')](_0x1407aa[_0xf662('0x2a')]);_0x596157['filters']=_[_0xf662('0x2d')](_0x596157[_0xf662('0x2e')],_0x596157[_0xf662('0x2a')]);_0x4ff601['attributes']=_[_0xf662('0x2d')](_0x596157[_0xf662('0x2e')],qs['fields'](_0x1407aa[_0xf662('0x2a')][_0xf662('0x3c')]));_0x4ff601['attributes']=_0x4ff601['attributes'][_0xf662('0x3d')]?_0x4ff601[_0xf662('0x2f')]:_0x596157[_0xf662('0x2e')];if(_0x1407aa['query'][_0xf662('0x3e')]){_0x4ff601['include']=[{'all':!![]}];}_0x4ff601=_['merge']({},_0x4ff601,_0x1407aa['options']);return db[_0xf662('0x26')][_0xf662('0x20')](_0x4ff601)[_0xf662('0x14')](handleEntityNotFound(_0xf32d4c,null))[_0xf662('0x14')](respondWithResult(_0xf32d4c,null))[_0xf662('0x3a')](handleError(_0xf32d4c,null));};exports['destroy']=function(_0x402ace,_0x2c03a3){return db[_0xf662('0x26')][_0xf662('0x20')]({'where':{'id':_0x402ace[_0xf662('0x3b')]['id']}})[_0xf662('0x14')](handleEntityNotFound(_0x2c03a3,null))[_0xf662('0x14')](removeEntity(_0x2c03a3,null))[_0xf662('0x3a')](handleError(_0x2c03a3,null));};exports[_0xf662('0x3f')]=function(_0x1beac1,_0x2d6dc6){if(_0x1beac1[_0xf662('0x40')][_0xf662('0x21')]===_0xf662('0x41')&&!_['startsWith'](_0x1beac1[_0xf662('0x40')]['exten'],'_')){_0x1beac1[_0xf662('0x40')][_0xf662('0x42')]='_'[_0xf662('0x43')](_0x1beac1[_0xf662('0x40')][_0xf662('0x42')]);}return db[_0xf662('0x26')]['create'](_0x1beac1[_0xf662('0x40')],{'raw':![]})['then'](function(_0x4fafba){var _0x34b273=_0x1beac1[_0xf662('0x44')]['get']({'plain':!![]});if(!_0x34b273)throw new Error(_0xf662('0x45'));if(_0x34b273[_0xf662('0x46')]==='user'){var _0x11277b=_0x4fafba[_0xf662('0x15')]({'plain':!![]});var _0x5720c0=[{'name':_0xf662('0x16'),'value':_0xf662('0x17')},{'name':'OutboundRoutes','value':_0xf662('0x41')},{'name':'InternalRoutes','value':'internal'}];var _0x2187a8=_[_0xf662('0x20')](_0x5720c0,['value',_0x11277b[_0xf662('0x21')]])['name'];return db['UserProfileSection'][_0xf662('0x20')]({'where':{'name':_0x2187a8,'userProfileId':_0x34b273[_0xf662('0x47')]},'raw':!![]})[_0xf662('0x14')](function(_0x49c62d){if(_0x49c62d&&_0x49c62d[_0xf662('0x48')]===0x0){return db[_0xf662('0x49')][_0xf662('0x3f')]({'name':_0x11277b[_0xf662('0x22')],'resourceId':_0x11277b['id'],'type':_0x49c62d[_0xf662('0x22')],'sectionId':_0x49c62d['id']},{})['then'](function(){return _0x4fafba;});}else{return _0x4fafba;}})[_0xf662('0x3a')](function(_0x57161a){logger[_0xf662('0x24')](_0xf662('0x4a'),_0x57161a);throw _0x57161a;});}return _0x4fafba;})[_0xf662('0x14')](respondWithResult(_0x2d6dc6,0xc9))['catch'](handleError(_0x2d6dc6,null));};exports[_0xf662('0x4b')]=function(_0x1ebef4,_0x5c509c){if(_0x1ebef4[_0xf662('0x40')]['id']){delete _0x1ebef4[_0xf662('0x40')]['id'];}return db[_0xf662('0x26')]['find']({'where':{'id':_0x1ebef4['params']['id']}})['then'](handleEntityNotFound(_0x5c509c,null))[_0xf662('0x14')](function(_0x507b48){if(_0x507b48){return db['VoiceExtension']['update'](_[_0xf662('0x4c')](_0x1ebef4[_0xf662('0x40')],[_0xf662('0x42'),_0xf662('0x4d'),_0xf662('0x4e'),_0xf662('0x4f'),'cutdigits',_0xf662('0x50'),_0xf662('0x51')]),{'where':{'context':_0x507b48[_0xf662('0x4d')],'exten':_0x507b48[_0xf662('0x42')]},'individualHooks':!![]})[_0xf662('0x14')](function(_0x35ed2a){return _0x35ed2a;});}return null;})[_0xf662('0x14')](respondWithStatusCode(_0x5c509c,null))[_0xf662('0x3a')](handleError(_0x5c509c,null));};exports[_0xf662('0x52')]=function(_0x48398c,_0x9824fc){var _0x2f2bdf=_0x48398c[_0xf662('0x3b')]['id'];var _0x4b6d27=_0x48398c[_0xf662('0x40')];var _0x5b8c38=0xc8;var _0x55570e=null;return db[_0xf662('0x53')][_0xf662('0x54')]({'isolationLevel':db[_0xf662('0x53')]['Transaction'][_0xf662('0x55')][_0xf662('0x56')]},function(_0x4e9c69){return db['VoiceExtension'][_0xf662('0x57')]({'where':{'id':_0x2f2bdf},'transaction':_0x4e9c69})['then'](function(_0x5f314f){if(_0x5f314f){return db[_0xf662('0x26')]['destroy']({'where':{'VoiceExtensionId':_0x2f2bdf},'transaction':_0x4e9c69})['then'](function(){var _0x1f696a=_['map'](_0x4b6d27,function(_0x3b5b46){_0x3b5b46[_0xf662('0x58')]=_0x2f2bdf;_0x3b5b46[_0xf662('0x59')]=!![];return _0x3b5b46;});return _0x5f314f[_0xf662('0x5a')](_0x1f696a);})[_0xf662('0x14')](function(_0x4b96f7){return db['VoiceExtension'][_0xf662('0x5b')](_0x4b96f7,{'transaction':_0x4e9c69});});}else{_0x5b8c38=0x194;_0x55570e=[];}});})[_0xf662('0x14')](function(){if(_0x5b8c38!==0x194){return db[_0xf662('0x26')][_0xf662('0x5c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2f2bdf},'order':_0xf662('0x5d')})[_0xf662('0x14')](function(_0x34600e){_0x55570e=_0x34600e;});}})[_0xf662('0x3a')](function(_0x171db3){_0x5b8c38=0x1f4;logger[_0xf662('0x24')](_0x171db3[_0xf662('0x5e')]);if(_0x171db3['name']){delete _0x171db3[_0xf662('0x22')];}_0x55570e=_0x171db3;})[_0xf662('0x5f')](function(){if(_0x55570e===null){_0x9824fc[_0xf662('0xc')](_0x5b8c38);}else{if(_0x5b8c38===0x1f4){_0x9824fc[_0xf662('0xd')](_0x5b8c38)[_0xf662('0x25')](_0x55570e);}else{_0x9824fc[_0xf662('0xd')](_0x5b8c38)[_0xf662('0x13')](_0x55570e);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index b4cc0b1..32d4f1d 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 _0xaf3d=['hasOwnProperty','hook','../../mysqldb','VoiceExtension','update','remove','emit'];(function(_0x1a850c,_0x2f64b3){var _0x17babe=function(_0x36fee0){while(--_0x36fee0){_0x1a850c['push'](_0x1a850c['shift']());}};_0x17babe(++_0x2f64b3);}(_0xaf3d,0x1c2));var _0xdaf3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaf3d[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xdaf3('0x0'))['db'][_0xdaf3('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xdaf3('0x2'),'afterDestroy':_0xdaf3('0x3')};function emitEvent(_0x3eed4a){return function(_0x37aff7,_0x2fe48a,_0x856b05){VoiceExtensionEvents[_0xdaf3('0x4')](_0x3eed4a+':'+_0x37aff7['id'],_0x37aff7);VoiceExtensionEvents[_0xdaf3('0x4')](_0x3eed4a,_0x37aff7);_0x856b05(null);};}for(var e in events){if(events[_0xdaf3('0x5')](e)){var event=events[e];VoiceExtension[_0xdaf3('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xae21=['save','update','remove','emit','hook','events','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x5131f0,_0x5039ef){var _0x29d526=function(_0x42ff27){while(--_0x42ff27){_0x5131f0['push'](_0x5131f0['shift']());}};_0x29d526(++_0x5039ef);}(_0xae21,0xf8));var _0x1ae2=function(_0x55ed1c,_0x3a7fbf){_0x55ed1c=_0x55ed1c-0x0;var _0x2b2426=_0xae21[_0x55ed1c];return _0x2b2426;};'use strict';var EventEmitter=require(_0x1ae2('0x0'));var VoiceExtension=require(_0x1ae2('0x1'))['db'][_0x1ae2('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x1ae2('0x3')](0x0);var events={'afterCreate':_0x1ae2('0x4'),'afterUpdate':_0x1ae2('0x5'),'afterDestroy':_0x1ae2('0x6')};function emitEvent(_0x33dd10){return function(_0x10bfc0,_0xb5bc05,_0x355d4c){VoiceExtensionEvents[_0x1ae2('0x7')](_0x33dd10+':'+_0x10bfc0['id'],_0x10bfc0);VoiceExtensionEvents['emit'](_0x33dd10,_0x10bfc0);_0x355d4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x1ae2('0x8')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 8adfdcb..cea03f9 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 _0x3981=['Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','includes','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','then','lodash','exports','models','type','Set','CDR(type)=','context','exten','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','url','length','name','trunk','param','split','phone','prefix','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','interval','*,*,*,*','intervals','IntervalId','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3981,0x144));var _0x1398=function(_0x4facb4,_0xa5dc40){_0x4facb4=_0x4facb4-0x0;var _0x130eb5=_0x3981[_0x4facb4];return _0x130eb5;};'use strict';var _=require(_0x1398('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x1398('0x1')]=function(_0x310df7){var _0x8739be=_0x310df7[_0x1398('0x2')];function _0x1d39c3(_0x1a580a){var _0x37fb2f=0x2;var _0x2860af=[{'type':_0x1a580a[_0x1398('0x3')],'app':_0x1398('0x4'),'appdata':_0x1398('0x5')+_0x1a580a['type'],'context':_0x1a580a[_0x1398('0x6')],'exten':_0x1a580a[_0x1398('0x7')],'priority':_0x37fb2f++,'VoiceExtensionId':_0x1a580a['id']},{'type':_0x1a580a[_0x1398('0x3')],'app':_0x1a580a['alias']?_0x1398('0x4'):_0x1398('0x8'),'appdata':_0x1a580a[_0x1398('0x9')]?_0x1398('0xa')+_0x1a580a[_0x1398('0x9')]:_0x1398('0xb'),'context':_0x1a580a['context'],'exten':_0x1a580a[_0x1398('0x7')],'priority':_0x37fb2f++,'VoiceExtensionId':_0x1a580a['id']}];if(_0x1a580a[_0x1398('0x3')]===_0x1398('0xc')){_0x2860af[_0x1398('0xd')]({'type':_0x1398('0xc'),'app':_0x1398('0x4'),'appdata':_0x1398('0xe')+_0x1a580a['id'],'context':_0x1a580a[_0x1398('0x6')],'exten':_0x1a580a[_0x1398('0x7')],'priority':_0x37fb2f++,'VoiceExtensionId':_0x1a580a['id']});}_0x2860af[_0x1398('0xd')]({'type':_0x1a580a['type'],'app':_0x1398('0x4'),'appdata':_0x1398('0xf'),'context':_0x1a580a[_0x1398('0x6')],'exten':_0x1a580a[_0x1398('0x7')],'priority':_0x37fb2f++,'VoiceExtensionId':_0x1a580a['id']},{'type':_0x1a580a['type'],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1a580a[_0x1398('0x6')],'exten':_0x1a580a['exten'],'priority':_0x37fb2f++,'VoiceExtensionId':_0x1a580a['id']},{'type':_0x1a580a['type'],'app':'Set','appdata':_0x1398('0x10'),'context':_0x1a580a['context'],'exten':_0x1a580a[_0x1398('0x7')],'priority':_0x37fb2f++,'VoiceExtensionId':_0x1a580a['id']});return _0x2860af;}function _0x255a40(_0x24252f){var _0x382319=0x2;var _0x3b59f0=[{'type':'outbound','app':_0x1398('0x4'),'appdata':'CDR(type)=outbound','context':_0x24252f['context'],'exten':_0x24252f[_0x1398('0x7')],'priority':_0x382319++,'VoiceExtensionId':_0x24252f['id']},{'type':'outbound','app':_0x24252f['alias']?_0x1398('0x4'):_0x1398('0x8'),'appdata':_0x24252f['alias']?_0x1398('0xa')+_0x24252f[_0x1398('0x9')]:_0x1398('0xb'),'context':_0x24252f[_0x1398('0x6')],'exten':_0x24252f[_0x1398('0x7')],'priority':_0x382319++,'VoiceExtensionId':_0x24252f['id']},{'type':_0x1398('0x11'),'app':'Set','appdata':'CDR(destination)='+(_0x24252f['cutdigits']?'${EXTEN:'+_0x24252f[_0x1398('0x12')]+'}':_0x1398('0x13')),'context':_0x24252f[_0x1398('0x6')],'exten':_0x24252f[_0x1398('0x7')],'priority':_0x382319++,'VoiceExtensionId':_0x24252f['id']},{'type':_0x1398('0x11'),'app':_0x1398('0x4'),'appdata':'CDR(routeid)='+_0x24252f['id'],'context':_0x24252f[_0x1398('0x6')],'exten':_0x24252f[_0x1398('0x7')],'priority':_0x382319++,'VoiceExtensionId':_0x24252f['id']},{'type':'outbound','app':_0x1398('0x14'),'appdata':_0x1398('0x15')+(_0x382319+0x2)+_0x1398('0x16')+(_0x382319+0x1)+')','context':_0x24252f[_0x1398('0x6')],'exten':_0x24252f['exten'],'priority':_0x382319++,'VoiceExtensionId':_0x24252f['id']},{'type':'outbound','app':_0x1398('0x4'),'appdata':_0x24252f['cutdigits']?_0x1398('0x17')+_0x24252f['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x24252f['context'],'exten':_0x24252f[_0x1398('0x7')],'priority':_0x382319++,'VoiceExtensionId':_0x24252f['id']},{'type':_0x1398('0x11'),'app':_0x1398('0x4'),'appdata':_0x1398('0xf'),'context':_0x24252f[_0x1398('0x6')],'exten':_0x24252f[_0x1398('0x7')],'priority':_0x382319++,'VoiceExtensionId':_0x24252f['id']},{'type':'outbound','app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x24252f[_0x1398('0x6')],'exten':_0x24252f[_0x1398('0x7')],'priority':_0x382319++,'VoiceExtensionId':_0x24252f['id']},{'type':_0x1398('0x11'),'app':'Set','appdata':_0x1398('0x10'),'context':_0x24252f[_0x1398('0x6')],'exten':_0x24252f['exten'],'priority':_0x382319++,'VoiceExtensionId':_0x24252f['id']},{'type':'outbound','app':'Set','appdata':_0x1398('0x18')+_0x24252f['id'],'context':_0x24252f['context'],'exten':_0x24252f[_0x1398('0x7')],'priority':_0x382319++,'VoiceExtensionId':_0x24252f['id']}];if(_0x24252f[_0x1398('0x19')](_0x1398('0x1a'))&&_0x24252f[_0x1398('0x1a')]!==_0x1398('0x1b')){_0x3b59f0['push']({'type':_0x1398('0x11'),'app':_0x1398('0x4'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x24252f[_0x1398('0x6')],'exten':_0x24252f['exten'],'priority':_0x382319++,'VoiceExtensionId':_0x24252f['id']},{'type':_0x1398('0x11'),'app':_0x1398('0x4'),'appdata':_0x1398('0x1c')+_0x24252f[_0x1398('0x1a')]||_0x1398('0x1d'),'context':_0x24252f['context'],'exten':_0x24252f['exten'],'priority':_0x382319++,'VoiceExtensionId':_0x24252f['id']});}return _0x3b59f0;}function _0x352245(_0x404bba,_0x511276){var _0x4b9cfa=[{'name':'trunk','param':0x0},{'name':_0x1398('0x1e'),'param':0x1},{'name':'options','param':0x2},{'name':_0x1398('0x1f'),'param':0x3}];var _0x5067e2={};var _0x29d8fc=_0x511276['split'](',');var _0xab4136=[];for(var _0xe1fd72=0x0;_0xe1fd72<_0x4b9cfa[_0x1398('0x20')];_0xe1fd72++){switch(_0x4b9cfa[_0xe1fd72][_0x1398('0x21')]){case _0x1398('0x22'):_0x5067e2[_0x1398('0x22')]=_0x29d8fc[_0x4b9cfa[_0xe1fd72][_0x1398('0x23')]][_0x1398('0x24')]('/')[0x1];_0x5067e2[_0x1398('0x25')]=_0x29d8fc[_0x4b9cfa[_0xe1fd72][_0x1398('0x23')]][_0x1398('0x24')]('/')[0x2];_0x5067e2[_0x1398('0x26')]=_0x5067e2['phone']?_0x5067e2[_0x1398('0x25')][_0x1398('0x24')]('$')[0x0]:undefined;_0x5067e2[_0x1398('0x25')]=_0x404bba['cutdigits']?(_0x5067e2[_0x1398('0x26')]||'')+'${EXTEN:'+_0x404bba[_0x1398('0x12')]+'}':(_0x5067e2[_0x1398('0x26')]||'')+_0x1398('0x13');_0xab4136[_0x4b9cfa[_0xe1fd72][_0x1398('0x23')]]=['SIP',_0x5067e2[_0x1398('0x22')],_0x5067e2[_0x1398('0x25')]][_0x1398('0x27')]('/');break;case _0x1398('0x28'):_0x5067e2[_0x1398('0x28')]=_0x29d8fc[_0x4b9cfa[_0xe1fd72][_0x1398('0x23')]];if(_0x404bba[_0x1398('0x1a')]!==_0x1398('0x1b')){if(_0x5067e2['options'][_0x1398('0x29')]('U(xcally-mixmonitor-context)')<0x0){_0x5067e2[_0x1398('0x28')]+=_0x1398('0x2a');}}else{_0x5067e2[_0x1398('0x28')]=_0x5067e2[_0x1398('0x28')][_0x1398('0x2b')](_0x1398('0x2a'),'');}_0xab4136[_0x4b9cfa[_0xe1fd72][_0x1398('0x23')]]=_0x5067e2[_0x1398('0x28')];break;default:_0xab4136[_0x4b9cfa[_0xe1fd72]['param']]=_0x29d8fc[_0x4b9cfa[_0xe1fd72][_0x1398('0x23')]];}}return _0xab4136[_0x1398('0x27')](',');}function _0x4d69b0(_0x280e10,_0x286b5d,_0xeb0f1d){return new Promise(function(_0x2e39c4,_0x51e0d3){var _0x57fb28=[];if(_[_0x1398('0x2c')](_0x286b5d))return _0x2e39c4(_0x57fb28);_0x8739be[_0x1398('0x2d')]['findAll']({'attributes':['id',_0x1398('0x2e'),'IntervalId'],'raw':!![]})['then'](function(_0x301090){for(var _0x23acf3=0x0,_0x1a2bf0=0x0;_0x23acf3<_0x286b5d[_0x1398('0x20')];_0x23acf3++,_0x1a2bf0=0x0){var _0x433f0f=_0x286b5d[_0x23acf3];var _0x16963c=[];var _0x504067=[];delete _0x433f0f['id'];if(_0x433f0f[_0x1398('0x2e')]!==_0x1398('0x2f')){_0x433f0f[_0x1398('0x30')]=[_0x433f0f[_0x1398('0x2e')]];}else{_0x433f0f['intervals']=_0x433f0f[_0x1398('0x31')]?_['map'](_[_0x1398('0x32')](_0x301090,{'IntervalId':_0x433f0f[_0x1398('0x31')]}),_0x1398('0x2e')):[];}_0x433f0f[_0x1398('0x6')]=_0x280e10['context'];_0x433f0f[_0x1398('0x7')]=_0x280e10[_0x1398('0x7')];if(_0x433f0f[_0x1398('0x3')])_0x433f0f['type']=_0x433f0f[_0x1398('0x3')][_0x1398('0x33')]();if(_0x280e10['type']===_0x1398('0x11')){if(_0x433f0f[_0x1398('0x19')](_0x1398('0x34'))&&_0x433f0f[_0x1398('0x34')]&&_0x433f0f[_0x1398('0x34')]!=='--'){_0x16963c['push']({'type':_0x433f0f[_0x1398('0x3')]['toLowerCase'](),'app':_0x1398('0x4'),'appdata':_0x1398('0x35')+_0x433f0f[_0x1398('0x34')],'context':_0x280e10['context'],'exten':_0x280e10['exten'],'priority':_0x433f0f['intervals']['length']+_0xeb0f1d+_0x1a2bf0++,'VoiceExtensionId':_0x280e10['id']});}_0x16963c[_0x1398('0xd')]({'type':_0x433f0f['type'][_0x1398('0x33')](),'app':_0x1398('0x14'),'appdata':_0x1398('0x36')+(_0x433f0f[_0x1398('0x37')]?_0x1398('0x38')+_0x433f0f[_0x1398('0x37')]+')':_0x1398('0x39')),'context':_0x280e10[_0x1398('0x6')],'exten':_0x280e10[_0x1398('0x7')],'priority':_0x433f0f['intervals'][_0x1398('0x20')]+_0xeb0f1d+_0x1a2bf0++,'VoiceExtensionId':_0x280e10['id']});}else{if(_0x433f0f[_0x1398('0x19')]('answer')){if([_0x1398('0x3a'),'playback'][_0x1398('0x3b')](_0x433f0f[_0x1398('0x3c')]['toLowerCase']())&&_0x433f0f[_0x1398('0x3d')]!==_0x1398('0x3e')){if(_0x433f0f['answer']){_0x16963c[_0x1398('0xd')]({'type':_0x433f0f[_0x1398('0x3')][_0x1398('0x33')](),'app':_0x1398('0x14'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x280e10[_0x1398('0x6')],'exten':_0x280e10[_0x1398('0x7')],'priority':_0x433f0f['intervals']['length']+_0xeb0f1d+_0x1a2bf0++,'VoiceExtensionId':_0x280e10['id']});_0x16963c[_0x1398('0xd')]({'type':_0x433f0f[_0x1398('0x3')][_0x1398('0x33')](),'app':_0x1398('0x4'),'appdata':_0x1398('0x3f'),'context':_0x280e10[_0x1398('0x6')],'exten':_0x280e10[_0x1398('0x7')],'priority':_0x433f0f[_0x1398('0x30')][_0x1398('0x20')]+_0xeb0f1d+_0x1a2bf0++,'VoiceExtensionId':_0x280e10['id']});}else{_0x16963c[_0x1398('0xd')]({'type':_0x433f0f[_0x1398('0x3')]['toLowerCase'](),'app':_0x1398('0x14'),'appdata':_0x1398('0x40'),'context':_0x280e10[_0x1398('0x6')],'exten':_0x280e10[_0x1398('0x7')],'priority':_0x433f0f['intervals']['length']+_0xeb0f1d+_0x1a2bf0++,'VoiceExtensionId':_0x280e10['id']});_0x16963c[_0x1398('0xd')]({'type':_0x433f0f['type'][_0x1398('0x33')](),'app':_0x1398('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x280e10[_0x1398('0x6')],'exten':_0x280e10['exten'],'priority':_0x433f0f[_0x1398('0x30')][_0x1398('0x20')]+_0xeb0f1d+_0x1a2bf0++,'VoiceExtensionId':_0x280e10['id']});}}}}for(var _0x34f39e=0x0;_0x34f39e<_0x433f0f['intervals'][_0x1398('0x20')];_0x34f39e++){var _0x1c2345=_0xeb0f1d+_0x433f0f[_0x1398('0x30')][_0x1398('0x20')];var _0x3e9488=_0x34f39e===_0x433f0f[_0x1398('0x30')][_0x1398('0x20')]-0x1?_0xeb0f1d+_0x16963c[_0x1398('0x20')]+_0x504067['length']+0x2:_0xeb0f1d+_0x34f39e+0x1;_0x16963c[_0x1398('0x41')](_0x34f39e,0x0,{'type':_0x280e10[_0x1398('0x3')],'app':'GotoIfTime','appdata':_0x433f0f[_0x1398('0x30')][_0x34f39e]+'?'+_0x280e10['context']+',${EXTEN},'+_0x1c2345+':'+_0x280e10['context']+_0x1398('0x42')+_0x3e9488,'exten':_0x280e10['exten'],'context':_0x280e10[_0x1398('0x6')],'priority':_0xeb0f1d+_0x34f39e,'VoiceExtensionId':_0x280e10['id']});}if(_0x433f0f[_0x1398('0x3d')]==='outboundDial')_0x433f0f['appdata']=_0x352245(_0x280e10,_0x433f0f['appdata']);_0x433f0f[_0x1398('0x43')]=_0x16963c[_0x1398('0x20')]?_[_0x1398('0x44')](_0x16963c)[_0x1398('0x43')]+0x1:_0xeb0f1d;_0x57fb28=_[_0x1398('0x45')](_0x57fb28,_0x16963c,[_0x433f0f],_0x504067);_0xeb0f1d=_['last'](_0x57fb28)['priority']+0x1;}return _0x2e39c4(_0x57fb28);})[_0x1398('0x46')](function(_0x455a82){_0x51e0d3(_0x455a82);});});}return _0x310df7[_0x1398('0x47')](_0x1398('0x48'),attributes,{'tableName':_0x1398('0x49'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5b0522){var _0x55b4f6=this[_0x1398('0x4a')]({'plain':!![]});var _0x5c7861=_0x55b4f6[_0x1398('0x3')]==='outbound'?_0x255a40(_0x55b4f6):_0x1d39c3(_0x55b4f6);return _0x4d69b0(_0x55b4f6,_0x5b0522,_[_0x1398('0x44')](_0x5c7861)[_0x1398('0x43')]+0x1)[_0x1398('0x4b')](function(_0x4a4488){var _0x4dcbce=_[_0x1398('0x45')](_0x5c7861,_0x4a4488);_0x4dcbce[_0x1398('0xd')]({'type':_0x55b4f6[_0x1398('0x3')],'app':'Hangup','exten':_0x55b4f6[_0x1398('0x7')],'context':_0x55b4f6['context'],'priority':_[_0x1398('0x44')](_0x4dcbce)['priority']+0x1,'VoiceExtensionId':_0x55b4f6['id']});return _0x4dcbce;});}}});}; \ No newline at end of file +var _0xf698=['No\x20alias\x20set','context','push','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','length','name','param','split','prefix','phone','SIP','join','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','catch','define','VoiceExtension','voice_extensions','concat','Hangup','lodash','./voiceExtension.attributes','Set','exten','type','alias','NoOp','CDR(routeAlias)='];(function(_0x588644,_0x27dba7){var _0x1974e0=function(_0x5a3f95){while(--_0x5a3f95){_0x588644['push'](_0x588644['shift']());}};_0x1974e0(++_0x27dba7);}(_0xf698,0x1de));var _0x8f69=function(_0x319cb9,_0x4b8d35){_0x319cb9=_0x319cb9-0x0;var _0x1735fc=_0xf698[_0x319cb9];return _0x1735fc;};'use strict';var _=require(_0x8f69('0x0'));var attributes=require(_0x8f69('0x1'));module['exports']=function(_0x1d6ed2){var _0x1f7a66=_0x1d6ed2['models'];function _0x4321fe(_0x220362){var _0x83c2db=0x2;var _0x355676=[{'type':_0x220362['type'],'app':_0x8f69('0x2'),'appdata':'CDR(type)='+_0x220362['type'],'context':_0x220362['context'],'exten':_0x220362[_0x8f69('0x3')],'priority':_0x83c2db++,'VoiceExtensionId':_0x220362['id']},{'type':_0x220362[_0x8f69('0x4')],'app':_0x220362[_0x8f69('0x5')]?_0x8f69('0x2'):_0x8f69('0x6'),'appdata':_0x220362[_0x8f69('0x5')]?_0x8f69('0x7')+_0x220362[_0x8f69('0x5')]:_0x8f69('0x8'),'context':_0x220362[_0x8f69('0x9')],'exten':_0x220362[_0x8f69('0x3')],'priority':_0x83c2db++,'VoiceExtensionId':_0x220362['id']}];if(_0x220362[_0x8f69('0x4')]==='inbound'){_0x355676[_0x8f69('0xa')]({'type':'inbound','app':_0x8f69('0x2'),'appdata':'CDR(routeid)='+_0x220362['id'],'context':_0x220362[_0x8f69('0x9')],'exten':_0x220362['exten'],'priority':_0x83c2db++,'VoiceExtensionId':_0x220362['id']});}_0x355676[_0x8f69('0xa')]({'type':_0x220362[_0x8f69('0x4')],'app':_0x8f69('0x2'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x220362['context'],'exten':_0x220362[_0x8f69('0x3')],'priority':_0x83c2db++,'VoiceExtensionId':_0x220362['id']},{'type':_0x220362[_0x8f69('0x4')],'app':'Set','appdata':_0x8f69('0xb'),'context':_0x220362[_0x8f69('0x9')],'exten':_0x220362[_0x8f69('0x3')],'priority':_0x83c2db++,'VoiceExtensionId':_0x220362['id']},{'type':_0x220362['type'],'app':_0x8f69('0x2'),'appdata':_0x8f69('0xc'),'context':_0x220362[_0x8f69('0x9')],'exten':_0x220362['exten'],'priority':_0x83c2db++,'VoiceExtensionId':_0x220362['id']});return _0x355676;}function _0x2aa302(_0x143318){var _0x29a6a6=0x2;var _0x35569d=[{'type':_0x8f69('0xd'),'app':_0x8f69('0x2'),'appdata':'CDR(type)=outbound','context':_0x143318[_0x8f69('0x9')],'exten':_0x143318[_0x8f69('0x3')],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']},{'type':_0x8f69('0xd'),'app':_0x143318[_0x8f69('0x5')]?'Set':_0x8f69('0x6'),'appdata':_0x143318[_0x8f69('0x5')]?'CDR(routeAlias)='+_0x143318[_0x8f69('0x5')]:_0x8f69('0x8'),'context':_0x143318['context'],'exten':_0x143318['exten'],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']},{'type':_0x8f69('0xd'),'app':_0x8f69('0x2'),'appdata':_0x8f69('0xe')+(_0x143318[_0x8f69('0xf')]?_0x8f69('0x10')+_0x143318['cutdigits']+'}':_0x8f69('0x11')),'context':_0x143318['context'],'exten':_0x143318['exten'],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']},{'type':'outbound','app':_0x8f69('0x2'),'appdata':'CDR(routeid)='+_0x143318['id'],'context':_0x143318['context'],'exten':_0x143318[_0x8f69('0x3')],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']},{'type':_0x8f69('0xd'),'app':_0x8f69('0x12'),'appdata':_0x8f69('0x13')+(_0x29a6a6+0x2)+'):Goto('+(_0x29a6a6+0x1)+')','context':_0x143318[_0x8f69('0x9')],'exten':_0x143318[_0x8f69('0x3')],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']},{'type':_0x8f69('0xd'),'app':_0x8f69('0x2'),'appdata':_0x143318['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x143318[_0x8f69('0xf')]+'}':_0x8f69('0x14'),'context':_0x143318[_0x8f69('0x9')],'exten':_0x143318[_0x8f69('0x3')],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']},{'type':_0x8f69('0xd'),'app':'Set','appdata':_0x8f69('0x15'),'context':_0x143318[_0x8f69('0x9')],'exten':_0x143318[_0x8f69('0x3')],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']},{'type':_0x8f69('0xd'),'app':_0x8f69('0x2'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x143318[_0x8f69('0x9')],'exten':_0x143318[_0x8f69('0x3')],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']},{'type':_0x8f69('0xd'),'app':_0x8f69('0x2'),'appdata':_0x8f69('0xc'),'context':_0x143318['context'],'exten':_0x143318['exten'],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']},{'type':_0x8f69('0xd'),'app':_0x8f69('0x2'),'appdata':_0x8f69('0x16')+_0x143318['id'],'context':_0x143318[_0x8f69('0x9')],'exten':_0x143318['exten'],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']}];if(_0x143318[_0x8f69('0x17')](_0x8f69('0x18'))&&_0x143318[_0x8f69('0x18')]!==_0x8f69('0x19')){_0x35569d[_0x8f69('0xa')]({'type':'outbound','app':_0x8f69('0x2'),'appdata':_0x8f69('0x1a'),'context':_0x143318[_0x8f69('0x9')],'exten':_0x143318[_0x8f69('0x3')],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']},{'type':'outbound','app':_0x8f69('0x2'),'appdata':_0x8f69('0x1b')+_0x143318[_0x8f69('0x18')]||_0x8f69('0x1c'),'context':_0x143318[_0x8f69('0x9')],'exten':_0x143318[_0x8f69('0x3')],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']});}return _0x35569d;}function _0x510337(_0x276a1b,_0x4c9c40){var _0x363cf2=[{'name':_0x8f69('0x1d'),'param':0x0},{'name':_0x8f69('0x1e'),'param':0x1},{'name':_0x8f69('0x1f'),'param':0x2},{'name':_0x8f69('0x20'),'param':0x3}];var _0x53f7f0={};var _0x50c29c=_0x4c9c40['split'](',');var _0x4d1a84=[];for(var _0x4e7fff=0x0;_0x4e7fff<_0x363cf2[_0x8f69('0x21')];_0x4e7fff++){switch(_0x363cf2[_0x4e7fff][_0x8f69('0x22')]){case _0x8f69('0x1d'):_0x53f7f0[_0x8f69('0x1d')]=_0x50c29c[_0x363cf2[_0x4e7fff][_0x8f69('0x23')]][_0x8f69('0x24')]('/')[0x1];_0x53f7f0['phone']=_0x50c29c[_0x363cf2[_0x4e7fff][_0x8f69('0x23')]][_0x8f69('0x24')]('/')[0x2];_0x53f7f0[_0x8f69('0x25')]=_0x53f7f0[_0x8f69('0x26')]?_0x53f7f0['phone'][_0x8f69('0x24')]('$')[0x0]:undefined;_0x53f7f0[_0x8f69('0x26')]=_0x276a1b[_0x8f69('0xf')]?(_0x53f7f0['prefix']||'')+_0x8f69('0x10')+_0x276a1b['cutdigits']+'}':(_0x53f7f0['prefix']||'')+'${EXTEN}';_0x4d1a84[_0x363cf2[_0x4e7fff][_0x8f69('0x23')]]=[_0x8f69('0x27'),_0x53f7f0[_0x8f69('0x1d')],_0x53f7f0[_0x8f69('0x26')]][_0x8f69('0x28')]('/');break;case _0x8f69('0x1f'):_0x53f7f0[_0x8f69('0x1f')]=_0x50c29c[_0x363cf2[_0x4e7fff][_0x8f69('0x23')]];if(_0x276a1b[_0x8f69('0x18')]!==_0x8f69('0x19')){if(_0x53f7f0[_0x8f69('0x1f')][_0x8f69('0x29')]('U(xcally-mixmonitor-context)')<0x0){_0x53f7f0[_0x8f69('0x1f')]+=_0x8f69('0x2a');}}else{_0x53f7f0[_0x8f69('0x1f')]=_0x53f7f0['options']['replace'](_0x8f69('0x2a'),'');}_0x4d1a84[_0x363cf2[_0x4e7fff][_0x8f69('0x23')]]=_0x53f7f0[_0x8f69('0x1f')];break;default:_0x4d1a84[_0x363cf2[_0x4e7fff][_0x8f69('0x23')]]=_0x50c29c[_0x363cf2[_0x4e7fff][_0x8f69('0x23')]];}}return _0x4d1a84[_0x8f69('0x28')](',');}function _0x4966b0(_0x2efe37,_0x27fc64,_0x577e41){return new Promise(function(_0x4297e1,_0x59fb1c){var _0x3bc5a3=[];if(_[_0x8f69('0x2b')](_0x27fc64))return _0x4297e1(_0x3bc5a3);_0x1f7a66[_0x8f69('0x2c')][_0x8f69('0x2d')]({'attributes':['id',_0x8f69('0x2e'),_0x8f69('0x2f')],'raw':!![]})[_0x8f69('0x30')](function(_0x47ae01){for(var _0x3bf6cc=0x0,_0x3d3866=0x0;_0x3bf6cc<_0x27fc64[_0x8f69('0x21')];_0x3bf6cc++,_0x3d3866=0x0){var _0x284fb5=_0x27fc64[_0x3bf6cc];var _0x2caa41=[];var _0x4d41c5=[];delete _0x284fb5['id'];if(_0x284fb5[_0x8f69('0x2e')]!==_0x8f69('0x31')){_0x284fb5[_0x8f69('0x32')]=[_0x284fb5[_0x8f69('0x2e')]];}else{_0x284fb5[_0x8f69('0x32')]=_0x284fb5['IntervalId']?_[_0x8f69('0x33')](_[_0x8f69('0x34')](_0x47ae01,{'IntervalId':_0x284fb5[_0x8f69('0x2f')]}),_0x8f69('0x2e')):[];}_0x284fb5[_0x8f69('0x9')]=_0x2efe37[_0x8f69('0x9')];_0x284fb5[_0x8f69('0x3')]=_0x2efe37[_0x8f69('0x3')];if(_0x284fb5[_0x8f69('0x4')])_0x284fb5[_0x8f69('0x4')]=_0x284fb5[_0x8f69('0x4')][_0x8f69('0x35')]();if(_0x2efe37[_0x8f69('0x4')]==='outbound'){if(_0x284fb5[_0x8f69('0x17')]('tag')&&_0x284fb5[_0x8f69('0x36')]&&_0x284fb5[_0x8f69('0x36')]!=='--'){_0x2caa41[_0x8f69('0xa')]({'type':_0x284fb5[_0x8f69('0x4')][_0x8f69('0x35')](),'app':'Set','appdata':_0x8f69('0x37')+_0x284fb5[_0x8f69('0x36')],'context':_0x2efe37['context'],'exten':_0x2efe37[_0x8f69('0x3')],'priority':_0x284fb5[_0x8f69('0x32')][_0x8f69('0x21')]+_0x577e41+_0x3d3866++,'VoiceExtensionId':_0x2efe37['id']});}_0x2caa41['push']({'type':_0x284fb5[_0x8f69('0x4')]['toLowerCase'](),'app':_0x8f69('0x12'),'appdata':_0x8f69('0x38')+(_0x284fb5[_0x8f69('0x39')]?_0x8f69('0x3a')+_0x284fb5[_0x8f69('0x39')]+')':'NoOp(No\x20number\x20available)'),'context':_0x2efe37[_0x8f69('0x9')],'exten':_0x2efe37['exten'],'priority':_0x284fb5[_0x8f69('0x32')]['length']+_0x577e41+_0x3d3866++,'VoiceExtensionId':_0x2efe37['id']});}else{if(_0x284fb5[_0x8f69('0x17')](_0x8f69('0x3b'))){if([_0x8f69('0x3c'),_0x8f69('0x3d')][_0x8f69('0x3e')](_0x284fb5[_0x8f69('0x3f')][_0x8f69('0x35')]())&&_0x284fb5[_0x8f69('0x40')]!==_0x8f69('0x41')){if(_0x284fb5[_0x8f69('0x3b')]){_0x2caa41[_0x8f69('0xa')]({'type':_0x284fb5['type']['toLowerCase'](),'app':_0x8f69('0x12'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2efe37[_0x8f69('0x9')],'exten':_0x2efe37['exten'],'priority':_0x284fb5[_0x8f69('0x32')][_0x8f69('0x21')]+_0x577e41+_0x3d3866++,'VoiceExtensionId':_0x2efe37['id']});_0x2caa41[_0x8f69('0xa')]({'type':_0x284fb5[_0x8f69('0x4')][_0x8f69('0x35')](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x2efe37[_0x8f69('0x9')],'exten':_0x2efe37[_0x8f69('0x3')],'priority':_0x284fb5[_0x8f69('0x32')][_0x8f69('0x21')]+_0x577e41+_0x3d3866++,'VoiceExtensionId':_0x2efe37['id']});}else{_0x2caa41['push']({'type':_0x284fb5[_0x8f69('0x4')][_0x8f69('0x35')](),'app':_0x8f69('0x12'),'appdata':_0x8f69('0x42'),'context':_0x2efe37[_0x8f69('0x9')],'exten':_0x2efe37['exten'],'priority':_0x284fb5[_0x8f69('0x32')][_0x8f69('0x21')]+_0x577e41+_0x3d3866++,'VoiceExtensionId':_0x2efe37['id']});_0x2caa41[_0x8f69('0xa')]({'type':_0x284fb5[_0x8f69('0x4')][_0x8f69('0x35')](),'app':'Set','appdata':_0x8f69('0x43'),'context':_0x2efe37['context'],'exten':_0x2efe37['exten'],'priority':_0x284fb5[_0x8f69('0x32')][_0x8f69('0x21')]+_0x577e41+_0x3d3866++,'VoiceExtensionId':_0x2efe37['id']});}}}}for(var _0x12333a=0x0;_0x12333a<_0x284fb5[_0x8f69('0x32')]['length'];_0x12333a++){var _0x40b682=_0x577e41+_0x284fb5[_0x8f69('0x32')]['length'];var _0x172e91=_0x12333a===_0x284fb5[_0x8f69('0x32')]['length']-0x1?_0x577e41+_0x2caa41['length']+_0x4d41c5['length']+0x2:_0x577e41+_0x12333a+0x1;_0x2caa41[_0x8f69('0x44')](_0x12333a,0x0,{'type':_0x2efe37[_0x8f69('0x4')],'app':_0x8f69('0x45'),'appdata':_0x284fb5['intervals'][_0x12333a]+'?'+_0x2efe37['context']+',${EXTEN},'+_0x40b682+':'+_0x2efe37[_0x8f69('0x9')]+_0x8f69('0x46')+_0x172e91,'exten':_0x2efe37[_0x8f69('0x3')],'context':_0x2efe37[_0x8f69('0x9')],'priority':_0x577e41+_0x12333a,'VoiceExtensionId':_0x2efe37['id']});}if(_0x284fb5[_0x8f69('0x40')]===_0x8f69('0x47'))_0x284fb5[_0x8f69('0x48')]=_0x510337(_0x2efe37,_0x284fb5['appdata']);_0x284fb5[_0x8f69('0x49')]=_0x2caa41[_0x8f69('0x21')]?_['last'](_0x2caa41)[_0x8f69('0x49')]+0x1:_0x577e41;_0x3bc5a3=_['concat'](_0x3bc5a3,_0x2caa41,[_0x284fb5],_0x4d41c5);_0x577e41=_[_0x8f69('0x4a')](_0x3bc5a3)[_0x8f69('0x49')]+0x1;}return _0x4297e1(_0x3bc5a3);})[_0x8f69('0x4b')](function(_0x4d8228){_0x59fb1c(_0x4d8228);});});}return _0x1d6ed2[_0x8f69('0x4c')](_0x8f69('0x4d'),attributes,{'tableName':_0x8f69('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x420395){var _0x35511f=this['get']({'plain':!![]});var _0x1fbe53=_0x35511f[_0x8f69('0x4')]===_0x8f69('0xd')?_0x2aa302(_0x35511f):_0x4321fe(_0x35511f);return _0x4966b0(_0x35511f,_0x420395,_['last'](_0x1fbe53)[_0x8f69('0x49')]+0x1)[_0x8f69('0x30')](function(_0xe1c45c){var _0x5c1359=_[_0x8f69('0x4f')](_0x1fbe53,_0xe1c45c);_0x5c1359[_0x8f69('0xa')]({'type':_0x35511f['type'],'app':_0x8f69('0x50'),'exten':_0x35511f[_0x8f69('0x3')],'context':_0x35511f[_0x8f69('0x9')],'priority':_[_0x8f69('0x4a')](_0x5c1359)[_0x8f69('0x49')]+0x1,'VoiceExtensionId':_0x35511f['id']});return _0x5c1359;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 081dd06..e78396c 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 _0x8f6b=['then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','GetVoiceExtension','VoiceExtension','options','raw','where','limit','include','map','model','attributes','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','redis','localhost','./voiceExtension.socket','register','request'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x8f6b,0x146));var _0xb8f6=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x8f6b[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0xb8f6('0x0'));var util=require(_0xb8f6('0x1'));var moment=require(_0xb8f6('0x2'));var BPromise=require('bluebird');var rs=require(_0xb8f6('0x3'));var fs=require('fs');var Redis=require(_0xb8f6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb8f6('0x5'));var logger=require(_0xb8f6('0x6'))('rpc');var config=require(_0xb8f6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb8f6('0x8')]['http']({'port':0x232a});config[_0xb8f6('0x9')]=_['defaults'](config[_0xb8f6('0x9')],{'host':_0xb8f6('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb8f6('0xb'))[_0xb8f6('0xc')](socket);function respondWithRpcPromise(_0x14cc71,_0x379ed5,_0x165d17){return new BPromise(function(_0x3f8e2a,_0x210f71){return client[_0xb8f6('0xd')](_0x14cc71,_0x165d17)[_0xb8f6('0xe')](function(_0x2ef5c1){logger[_0xb8f6('0xf')](_0xb8f6('0x10'),_0x379ed5,'request\x20sent');logger[_0xb8f6('0x11')](_0xb8f6('0x12'),_0x379ed5,'request\x20sent',JSON[_0xb8f6('0x13')](_0x2ef5c1));if(_0x2ef5c1[_0xb8f6('0x14')]){if(_0x2ef5c1[_0xb8f6('0x14')]['code']===0x1f4){logger[_0xb8f6('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x379ed5,_0x2ef5c1[_0xb8f6('0x14')][_0xb8f6('0x15')]);return _0x210f71(_0x2ef5c1['error']['message']);}logger[_0xb8f6('0x14')](_0xb8f6('0x10'),_0x379ed5,_0x2ef5c1[_0xb8f6('0x14')][_0xb8f6('0x15')]);return _0x3f8e2a(_0x2ef5c1[_0xb8f6('0x14')][_0xb8f6('0x15')]);}else{logger[_0xb8f6('0xf')](_0xb8f6('0x10'),_0x379ed5,_0xb8f6('0x16'));_0x3f8e2a(_0x2ef5c1['result']['message']);}})[_0xb8f6('0x17')](function(_0x4566c5){logger[_0xb8f6('0x14')](_0xb8f6('0x10'),_0x379ed5,_0x4566c5);_0x210f71(_0x4566c5);});});}exports[_0xb8f6('0x18')]=function(_0x5c2506){var _0x113cf8=this;return new Promise(function(_0x13f964,_0x44e6a8){return db[_0xb8f6('0x19')]['findAll']({'raw':_0x5c2506[_0xb8f6('0x1a')]?_0x5c2506[_0xb8f6('0x1a')][_0xb8f6('0x1b')]===undefined?!![]:![]:!![],'where':_0x5c2506[_0xb8f6('0x1a')]?_0x5c2506[_0xb8f6('0x1a')][_0xb8f6('0x1c')]||null:null,'attributes':_0x5c2506[_0xb8f6('0x1a')]?_0x5c2506[_0xb8f6('0x1a')]['attributes']||null:null,'limit':_0x5c2506[_0xb8f6('0x1a')]?_0x5c2506[_0xb8f6('0x1a')][_0xb8f6('0x1d')]||null:null,'include':_0x5c2506[_0xb8f6('0x1a')]?_0x5c2506['options'][_0xb8f6('0x1e')]?_[_0xb8f6('0x1f')](_0x5c2506['options'][_0xb8f6('0x1e')],function(_0x4ee750){return{'model':db[_0x4ee750[_0xb8f6('0x20')]],'as':_0x4ee750['as'],'attributes':_0x4ee750[_0xb8f6('0x21')],'include':_0x4ee750[_0xb8f6('0x1e')]?_[_0xb8f6('0x1f')](_0x4ee750['include'],function(_0x36ad7a){return{'model':db[_0x36ad7a[_0xb8f6('0x20')]],'as':_0x36ad7a['as'],'attributes':_0x36ad7a[_0xb8f6('0x21')],'include':_0x36ad7a['include']?_[_0xb8f6('0x1f')](_0x36ad7a[_0xb8f6('0x1e')],function(_0x2c47e7){return{'model':db[_0x2c47e7[_0xb8f6('0x20')]],'as':_0x2c47e7['as'],'attributes':_0x2c47e7[_0xb8f6('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d2895){logger[_0xb8f6('0xf')]('GetVoiceExtension',_0x5c2506);logger[_0xb8f6('0x11')]('GetVoiceExtension',_0x5c2506,JSON[_0xb8f6('0x13')](_0x5d2895));_0x13f964(_0x5d2895);})[_0xb8f6('0x17')](function(_0xb1f317){logger[_0xb8f6('0x14')](_0xb8f6('0x18'),_0xb1f317[_0xb8f6('0x15')],_0x5c2506);_0x44e6a8(_0x113cf8[_0xb8f6('0x14')](0x1f4,_0xb1f317[_0xb8f6('0x15')]));});});}; \ No newline at end of file +var _0x0738=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','VoiceExtension','findAll','options','raw','where','attributes','limit','map','include','model','GetVoiceExtension','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x59eacf,_0x56ec4a){var _0x5d74f2=function(_0x5476ed){while(--_0x5476ed){_0x59eacf['push'](_0x59eacf['shift']());}};_0x5d74f2(++_0x56ec4a);}(_0x0738,0x6e));var _0x8073=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0738[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x8073('0x0'));var util=require('util');var moment=require(_0x8073('0x1'));var BPromise=require(_0x8073('0x2'));var rs=require(_0x8073('0x3'));var fs=require('fs');var Redis=require(_0x8073('0x4'));var db=require(_0x8073('0x5'))['db'];var utils=require(_0x8073('0x6'));var logger=require(_0x8073('0x7'))(_0x8073('0x8'));var config=require(_0x8073('0x9'));var jayson=require(_0x8073('0xa'));var client=jayson[_0x8073('0xb')]['http']({'port':0x232a});config[_0x8073('0xc')]=_[_0x8073('0xd')](config[_0x8073('0xc')],{'host':_0x8073('0xe'),'port':0x18eb});var socket=require(_0x8073('0xf'))(new Redis(config[_0x8073('0xc')]));require(_0x8073('0x10'))[_0x8073('0x11')](socket);function respondWithRpcPromise(_0x3ea58b,_0x518f9f,_0x4a1fec){return new BPromise(function(_0x28e17b,_0x359af2){return client[_0x8073('0x12')](_0x3ea58b,_0x4a1fec)[_0x8073('0x13')](function(_0x513ed2){logger[_0x8073('0x14')](_0x8073('0x15'),_0x518f9f,'request\x20sent');logger[_0x8073('0x16')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x518f9f,_0x8073('0x17'),JSON[_0x8073('0x18')](_0x513ed2));if(_0x513ed2[_0x8073('0x19')]){if(_0x513ed2[_0x8073('0x19')]['code']===0x1f4){logger[_0x8073('0x19')](_0x8073('0x15'),_0x518f9f,_0x513ed2[_0x8073('0x19')][_0x8073('0x1a')]);return _0x359af2(_0x513ed2[_0x8073('0x19')][_0x8073('0x1a')]);}logger[_0x8073('0x19')]('VoiceExtension,\x20%s,\x20%s',_0x518f9f,_0x513ed2[_0x8073('0x19')]['message']);return _0x28e17b(_0x513ed2[_0x8073('0x19')][_0x8073('0x1a')]);}else{logger[_0x8073('0x14')](_0x8073('0x15'),_0x518f9f,_0x8073('0x17'));_0x28e17b(_0x513ed2[_0x8073('0x1b')][_0x8073('0x1a')]);}})[_0x8073('0x1c')](function(_0x7c8cf0){logger[_0x8073('0x19')]('VoiceExtension,\x20%s,\x20%s',_0x518f9f,_0x7c8cf0);_0x359af2(_0x7c8cf0);});});}exports['GetVoiceExtension']=function(_0x18447e){var _0x2fec07=this;return new Promise(function(_0x5baaf9,_0x1c4b9a){return db[_0x8073('0x1d')][_0x8073('0x1e')]({'raw':_0x18447e[_0x8073('0x1f')]?_0x18447e[_0x8073('0x1f')][_0x8073('0x20')]===undefined?!![]:![]:!![],'where':_0x18447e[_0x8073('0x1f')]?_0x18447e['options'][_0x8073('0x21')]||null:null,'attributes':_0x18447e['options']?_0x18447e[_0x8073('0x1f')][_0x8073('0x22')]||null:null,'limit':_0x18447e[_0x8073('0x1f')]?_0x18447e[_0x8073('0x1f')][_0x8073('0x23')]||null:null,'include':_0x18447e[_0x8073('0x1f')]?_0x18447e[_0x8073('0x1f')]['include']?_[_0x8073('0x24')](_0x18447e[_0x8073('0x1f')][_0x8073('0x25')],function(_0x6c49b0){return{'model':db[_0x6c49b0['model']],'as':_0x6c49b0['as'],'attributes':_0x6c49b0[_0x8073('0x22')],'include':_0x6c49b0[_0x8073('0x25')]?_[_0x8073('0x24')](_0x6c49b0[_0x8073('0x25')],function(_0x1d1a4c){return{'model':db[_0x1d1a4c[_0x8073('0x26')]],'as':_0x1d1a4c['as'],'attributes':_0x1d1a4c['attributes'],'include':_0x1d1a4c[_0x8073('0x25')]?_[_0x8073('0x24')](_0x1d1a4c[_0x8073('0x25')],function(_0x33474f){return{'model':db[_0x33474f['model']],'as':_0x33474f['as'],'attributes':_0x33474f[_0x8073('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d0151){logger['info'](_0x8073('0x27'),_0x18447e);logger['debug']('GetVoiceExtension',_0x18447e,JSON['stringify'](_0x4d0151));_0x5baaf9(_0x4d0151);})[_0x8073('0x1c')](function(_0x337135){logger[_0x8073('0x19')]('GetVoiceExtension',_0x337135[_0x8073('0x1a')],_0x18447e);_0x1c4b9a(_0x2fec07[_0x8073('0x19')](0x1f4,_0x337135['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 8a67d7d..bcd53ef 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 _0x814b=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x814b,0x1a2));var _0xb814=function(_0x436849,_0x430b00){_0x436849=_0x436849-0x0;var _0x5c5f73=_0x814b[_0x436849];return _0x5c5f73;};'use strict';var VoiceExtensionEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){VoiceExtensionEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);VoiceExtensionEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x2e4e7e,_0x380410){var _0x40ddb1=function(_0x3e448d){while(--_0x3e448d){_0x2e4e7e['push'](_0x2e4e7e['shift']());}};_0x40ddb1(++_0x380410);}(_0x7a54,0x106));var _0x47a5=function(_0x19e634,_0x385d80){_0x19e634=_0x19e634-0x0;var _0x294252=_0x7a54[_0x19e634];return _0x294252;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index eab1a68..aafc0e7 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 _0x7096=['../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','post','create','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0xba6b88,_0x4f1e92){var _0x575135=function(_0x52cf18){while(--_0x52cf18){_0xba6b88['push'](_0xba6b88['shift']());}};_0x575135(++_0x4f1e92);}(_0x7096,0x10c));var _0x6709=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x7096[_0x618414];return _0x21c19a;};'use strict';var multer=require('multer');var util=require(_0x6709('0x0'));var path=require('path');var timeout=require(_0x6709('0x1'));var express=require('express');var router=express[_0x6709('0x2')]();var fs_extra=require(_0x6709('0x3'));var auth=require(_0x6709('0x4'));var interaction=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var controller=require(_0x6709('0x7'));router[_0x6709('0x8')]('/',auth[_0x6709('0x9')](),controller[_0x6709('0xa')]);router[_0x6709('0x8')](_0x6709('0xb'),auth[_0x6709('0x9')](),controller[_0x6709('0xc')]);router['get']('/:id/messages',auth[_0x6709('0x9')](),controller[_0x6709('0xd')]);router[_0x6709('0xe')]('/',auth[_0x6709('0x9')](),controller[_0x6709('0xf')]);router[_0x6709('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6709('0x11')]);router[_0x6709('0x12')](_0x6709('0xb'),auth[_0x6709('0x9')](),controller[_0x6709('0x13')]);module[_0x6709('0x14')]=router; \ No newline at end of file +var _0x2ef3=['express','Router','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','/:id','isAuthenticated','show','/:id/messages','getMessages','post','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x1a4a89,_0x4abdee){var _0x47229b=function(_0xc5f0f3){while(--_0xc5f0f3){_0x1a4a89['push'](_0x1a4a89['shift']());}};_0x47229b(++_0x4abdee);}(_0x2ef3,0xba));var _0x32ef=function(_0x13726e,_0x15bd32){_0x13726e=_0x13726e-0x0;var _0x5e8c15=_0x2ef3[_0x13726e];return _0x5e8c15;};'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('0xa'),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 diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 0529b81..0cbb22f 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 _0xec64=['ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xec64,0x117));var _0x4ec6=function(_0x4179e2,_0xf2dbb){_0x4179e2=_0x4179e2-0x0;var _0x24cb50=_0xec64[_0x4179e2];return _0x24cb50;};'use strict';var Sequelize=require(_0x4ec6('0x0'));module[_0x4ec6('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4ec6('0x2')],'defaultValue':_0x4ec6('0x3'),'unique':_0x4ec6('0x4')},'mailbox':{'type':Sequelize[_0x4ec6('0x2')],'defaultValue':'','allowNull':![],'unique':_0x4ec6('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x4ec6('0x2')]},'email':{'type':Sequelize[_0x4ec6('0x2')],'validate':{'isEmail':!![]},'set':function(_0x14779e){this[_0x4ec6('0x5')](_0x4ec6('0x6'),typeof _0x14779e===_0x4ec6('0x7')&&_0x14779e['trim']()?_0x14779e[_0x4ec6('0x8')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x4ec6('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x4ec6('0x9')]('yes','no'),'defaultValue':_0x4ec6('0xa'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x4ec6('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x4ec6('0x2')]},'review':{'type':Sequelize[_0x4ec6('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x4ec6('0x9')](_0x4ec6('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x4ec6('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x4ec6('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x4ec6('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x4ec6('0x9')](_0x4ec6('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x4ec6('0x9')](_0x4ec6('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x4ec6('0x9')](_0x4ec6('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x4ec6('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x4ec6('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x4ec6('0x9')](_0x4ec6('0xa'),'no'),'defaultValue':_0x4ec6('0xa'),'allowNull':![]},'stamp':{'type':_0x4ec6('0xc')},'emailsubject':{'type':Sequelize[_0x4ec6('0x2')]},'emailbody':{'type':Sequelize[_0x4ec6('0x2')]},'maxsecs':{'type':Sequelize[_0x4ec6('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x4ec6('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x4ec6('0xe')],'get':function(){return this['getDataValue'](_0x4ec6('0xf'))+'\x20-\x20'+this[_0x4ec6('0x10')](_0x4ec6('0x11'));}}}; \ No newline at end of file +var _0xa220=['ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','central'];(function(_0x5f2327,_0x123bcd){var _0x304698=function(_0x5eb594){while(--_0x5eb594){_0x5f2327['push'](_0x5f2327['shift']());}};_0x304698(++_0x123bcd);}(_0xa220,0x8f));var _0x0a22=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa220[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module[_0x0a22('0x0')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x0a22('0x1')],'defaultValue':_0x0a22('0x2'),'unique':_0x0a22('0x3')},'mailbox':{'type':Sequelize[_0x0a22('0x1')],'defaultValue':'','allowNull':![],'unique':_0x0a22('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x0a22('0x1')]},'email':{'type':Sequelize[_0x0a22('0x1')],'validate':{'isEmail':!![]},'set':function(_0x40d827){this[_0x0a22('0x4')]('email',typeof _0x40d827===_0x0a22('0x5')&&_0x40d827['trim']()?_0x40d827['trim']():null);}},'pager':{'type':Sequelize[_0x0a22('0x1')]},'tz':{'type':Sequelize[_0x0a22('0x1')],'defaultValue':_0x0a22('0x6')},'attach':{'type':Sequelize[_0x0a22('0x7')](_0x0a22('0x8'),'no'),'defaultValue':_0x0a22('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x0a22('0x7')](_0x0a22('0x8'),'no'),'defaultValue':_0x0a22('0x8'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x0a22('0x1')]},'review':{'type':Sequelize[_0x0a22('0x7')](_0x0a22('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x0a22('0x7')](_0x0a22('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0a22('0x7')](_0x0a22('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0a22('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0a22('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0a22('0x7')](_0x0a22('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x0a22('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0a22('0x7')](_0x0a22('0x8'),'no'),'defaultValue':_0x0a22('0x8'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x0a22('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0a22('0x7')]('yes','no'),'defaultValue':_0x0a22('0x8'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x0a22('0x1')]},'emailbody':{'type':Sequelize[_0x0a22('0x1')]},'maxsecs':{'type':Sequelize[_0x0a22('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0a22('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0a22('0xb')],'get':function(){return this[_0x0a22('0xc')](_0x0a22('0xd'))+_0x0a22('0xe')+this[_0x0a22('0xc')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index f68af32..5b191c6 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 _0x351d=['../../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','Voicemails','error','stack','name','send','map','VoiceMail','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','find','params','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis'];(function(_0x49e9e7,_0x49e879){var _0x1d9cf3=function(_0x1ad928){while(--_0x1ad928){_0x49e9e7['push'](_0x49e9e7['shift']());}};_0x1d9cf3(++_0x49e879);}(_0x351d,0x90));var _0xd351=function(_0x35f0fc,_0x358dac){_0x35f0fc=_0x35f0fc-0x0;var _0x42246d=_0x351d[_0x35f0fc];return _0x42246d;};'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['VoiceMail']['count'](_0x1fc216)[_0xd351('0x1f')](function(_0x3935aa){_0x33b43d['count']=_0x3935aa;if(_0x5f07b1['query'][_0xd351('0x3c')]){_0x38c82f[_0xd351('0x3d')]=[{'all':!![]}];}return db['VoiceMail']['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('0x1d')]=function(_0x59ab0f,_0x22394e){if(_0x59ab0f['body']['id']){delete _0x59ab0f[_0xd351('0x42')]['id'];}return db[_0xd351('0x27')][_0xd351('0x49')]({'where':{'id':_0x59ab0f[_0xd351('0x4a')]['id']}})[_0xd351('0x1f')](handleEntityNotFound(_0x22394e,null))[_0xd351('0x1f')](saveUpdates(_0x59ab0f[_0xd351('0x42')],null))['then'](respondWithResult(_0x22394e,null))['catch'](handleError(_0x22394e,null));};exports[_0xd351('0x1e')]=function(_0x624224,_0x53a9da){return db[_0xd351('0x27')][_0xd351('0x49')]({'where':{'id':_0x624224[_0xd351('0x4a')]['id']}})['then'](handleEntityNotFound(_0x53a9da,null))[_0xd351('0x1f')](removeEntity(_0x53a9da,null))['catch'](handleError(_0x53a9da,null));};exports['getMessages']=function(_0x2c0cb1,_0x434465,_0x4d5a60){return db[_0xd351('0x27')][_0xd351('0x4b')]({'where':{'id':_0x2c0cb1[_0xd351('0x4a')]['id']}})[_0xd351('0x1f')](handleEntityNotFound(_0x434465,null))[_0xd351('0x1f')](function(_0x2dc745){var _0x505622;var _0x1e1173={},_0x2a7390={};_0x2a7390[_0xd351('0x2c')]=_[_0xd351('0x2e')](db[_0xd351('0x4c')][_0xd351('0x28')]);_0x2a7390[_0xd351('0x2d')]=_['keys'](_0x2c0cb1[_0xd351('0x2d')]);_0x2a7390['filters']=_[_0xd351('0x31')](_0x2a7390[_0xd351('0x2c')],_0x2a7390[_0xd351('0x2d')]);_0x1e1173[_0xd351('0x30')]=_[_0xd351('0x31')](_0x2a7390['model'],qs[_0xd351('0x32')](_0x2c0cb1['query'][_0xd351('0x32')]));_0x1e1173[_0xd351('0x30')]=_0x1e1173[_0xd351('0x30')][_0xd351('0x41')]?_0x1e1173[_0xd351('0x30')]:_0x2a7390['model'];if(!_0x2c0cb1['query'][_0xd351('0x33')](_0xd351('0x34'))){_0x1e1173['limit']=qs[_0xd351('0x17')](_0x2c0cb1[_0xd351('0x2d')][_0xd351('0x17')]);_0x1e1173['offset']=qs[_0xd351('0x19')](_0x2c0cb1[_0xd351('0x2d')][_0xd351('0x19')]);}_0x1e1173[_0xd351('0x35')]=qs['sort'](_0x2c0cb1['query'][_0xd351('0x36')]);_0x1e1173[_0xd351('0x37')]=qs[_0xd351('0x2f')](_[_0xd351('0x38')](_0x2c0cb1[_0xd351('0x2d')],_0x2a7390[_0xd351('0x2f')]));if(_0x2c0cb1[_0xd351('0x2d')]['filter']){_0x1e1173[_0xd351('0x37')]=_['merge'](_0x1e1173['where'],{'$or':_[_0xd351('0x26')](_0x1e1173[_0xd351('0x30')],function(_0x4799ae){var _0x182bdc={};_0x182bdc[_0x4799ae]={'$like':'%'+_0x2c0cb1['query']['filter']+'%'};return _0x182bdc;})});}_0x1e1173['where']=_[_0xd351('0x39')](_0x1e1173[_0xd351('0x37')],{'mailboxuser':_0x2dc745[_0xd351('0x4d')]});_0x1e1173=_['merge']({},_0x1e1173,_0x2c0cb1[_0xd351('0x3b')]);return db[_0xd351('0x4c')][_0xd351('0x4e')](_0x1e1173)[_0xd351('0x1f')](respondWithFilteredResult(_0x434465,_0x1e1173));})[_0xd351('0x3f')](handleError(_0x434465,null));}; \ No newline at end of file +var _0x80ed=['autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','VoiceMailMessage','mailbox','findAndCountAll','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','end','sendStatus','error','stack','name','send','index','map','VoiceMail','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId'];(function(_0x4e9f29,_0x1bbcbf){var _0x8e1ab3=function(_0x4a4e6b){while(--_0x4a4e6b){_0x4e9f29['push'](_0x4e9f29['shift']());}};_0x8e1ab3(++_0x1bbcbf);}(_0x80ed,0x11c));var _0xd80e=function(_0x54112c,_0xa35623){_0x54112c=_0x54112c-0x0;var _0xf37231=_0x80ed[_0x54112c];return _0xf37231;};'use strict';var emlformat=require(_0xd80e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd80e('0x1'));var jsonpatch=require(_0xd80e('0x2'));var rp=require(_0xd80e('0x3'));var moment=require('moment');var BPromise=require(_0xd80e('0x4'));var Mustache=require(_0xd80e('0x5'));var util=require(_0xd80e('0x6'));var path=require(_0xd80e('0x7'));var sox=require('sox');var csv=require(_0xd80e('0x8'));var ejs=require(_0xd80e('0x9'));var fs=require('fs');var fs_extra=require(_0xd80e('0xa'));var _=require('lodash');var squel=require(_0xd80e('0xb'));var crypto=require(_0xd80e('0xc'));var jsforce=require(_0xd80e('0xd'));var deskjs=require(_0xd80e('0xe'));var toCsv=require(_0xd80e('0x8'));var querystring=require(_0xd80e('0xf'));var Papa=require(_0xd80e('0x10'));var Redis=require(_0xd80e('0x11'));var authService=require(_0xd80e('0x12'));var qs=require(_0xd80e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd80e('0x14'));var logger=require(_0xd80e('0x15'))(_0xd80e('0x16'));var utils=require(_0xd80e('0x17'));var config=require(_0xd80e('0x18'));var licenseUtil=require(_0xd80e('0x19'));var db=require(_0xd80e('0x1a'))['db'];function respondWithStatusCode(_0x118f53,_0x1d3fcf){_0x1d3fcf=_0x1d3fcf||0xcc;return function(_0x4fb01c){if(_0x4fb01c){return _0x118f53['sendStatus'](_0x1d3fcf);}return _0x118f53['status'](_0x1d3fcf)['end']();};}function respondWithResult(_0x145766,_0x3d233b){_0x3d233b=_0x3d233b||0xc8;return function(_0x3096ae){if(_0x3096ae){return _0x145766[_0xd80e('0x1b')](_0x3d233b)[_0xd80e('0x1c')](_0x3096ae);}};}function respondWithFilteredResult(_0x58a17e,_0x595683){return function(_0x2c8c61){if(_0x2c8c61){var _0x3124e8=typeof _0x595683[_0xd80e('0x1d')]===_0xd80e('0x1e')&&typeof _0x595683[_0xd80e('0x1f')]===_0xd80e('0x1e');var _0x22ab67=_0x2c8c61['count'];var _0x21ceec=_0x3124e8?0x0:_0x595683[_0xd80e('0x1d')];var _0x3b543d=_0x3124e8?_0x2c8c61[_0xd80e('0x20')]:_0x595683['offset']+_0x595683[_0xd80e('0x1f')];var _0x175c67;if(_0x3b543d>=_0x22ab67){_0x3b543d=_0x22ab67;_0x175c67=0xc8;}else{_0x175c67=0xce;}_0x58a17e[_0xd80e('0x1b')](_0x175c67);return _0x58a17e['set'](_0xd80e('0x21'),_0x21ceec+'-'+_0x3b543d+'/'+_0x22ab67)[_0xd80e('0x1c')](_0x2c8c61);}return null;};}function patchUpdates(_0x2765ea){return function(_0x147134){try{jsonpatch[_0xd80e('0x22')](_0x147134,_0x2765ea,!![]);}catch(_0x5509d4){return BPromise['reject'](_0x5509d4);}return _0x147134[_0xd80e('0x23')]();};}function saveUpdates(_0x3fa159,_0x3b39bf){return function(_0x2d46e7){if(_0x2d46e7){return _0x2d46e7[_0xd80e('0x24')](_0x3fa159)[_0xd80e('0x25')](function(_0x43152c){return _0x43152c;});}return null;};}function removeEntity(_0x5430b6,_0x1fbf8a){return function(_0x57d70){if(_0x57d70){return _0x57d70[_0xd80e('0x26')]()['then'](function(){var _0x635ce0=_0x57d70[_0xd80e('0x27')]({'plain':!![]});var _0xe9bb59='Voicemails';return db['UserProfileResource']['destroy']({'where':{'type':_0xe9bb59,'resourceId':_0x635ce0['id']}})[_0xd80e('0x25')](function(){return _0x57d70;});})['then'](function(){_0x5430b6[_0xd80e('0x1b')](0xcc)[_0xd80e('0x28')]();});}};}function handleEntityNotFound(_0x4e8ed9,_0x24bafb){return function(_0xe1c04a){if(!_0xe1c04a){_0x4e8ed9[_0xd80e('0x29')](0x194);}return _0xe1c04a;};}function handleError(_0x46c05d,_0x5376eb){_0x5376eb=_0x5376eb||0x1f4;return function(_0x15f317){logger[_0xd80e('0x2a')](_0x15f317[_0xd80e('0x2b')]);if(_0x15f317[_0xd80e('0x2c')]){delete _0x15f317[_0xd80e('0x2c')];}_0x46c05d[_0xd80e('0x1b')](_0x5376eb)[_0xd80e('0x2d')](_0x15f317);};}exports[_0xd80e('0x2e')]=function(_0x5522dd,_0x54504e){var _0x30f9bd={},_0x1303eb={},_0x400220={'count':0x0,'rows':[]};var _0x32360c=_[_0xd80e('0x2f')](db[_0xd80e('0x30')]['rawAttributes'],function(_0x568d82){return{'name':_0x568d82[_0xd80e('0x31')],'type':_0x568d82[_0xd80e('0x32')][_0xd80e('0x33')]};});_0x1303eb[_0xd80e('0x34')]=_[_0xd80e('0x2f')](_0x32360c,_0xd80e('0x2c'));_0x1303eb[_0xd80e('0x35')]=_[_0xd80e('0x36')](_0x5522dd['query']);_0x1303eb['filters']=_[_0xd80e('0x37')](_0x1303eb[_0xd80e('0x34')],_0x1303eb[_0xd80e('0x35')]);_0x30f9bd[_0xd80e('0x38')]=_[_0xd80e('0x37')](_0x1303eb[_0xd80e('0x34')],qs[_0xd80e('0x39')](_0x5522dd[_0xd80e('0x35')][_0xd80e('0x39')]));_0x30f9bd[_0xd80e('0x38')]=_0x30f9bd['attributes'][_0xd80e('0x3a')]?_0x30f9bd['attributes']:_0x1303eb[_0xd80e('0x34')];if(!_0x5522dd[_0xd80e('0x35')][_0xd80e('0x3b')](_0xd80e('0x3c'))){_0x30f9bd['limit']=qs[_0xd80e('0x1f')](_0x5522dd['query'][_0xd80e('0x1f')]);_0x30f9bd['offset']=qs[_0xd80e('0x1d')](_0x5522dd[_0xd80e('0x35')]['offset']);}_0x30f9bd[_0xd80e('0x3d')]=qs[_0xd80e('0x3e')](_0x5522dd[_0xd80e('0x35')]['sort']);_0x30f9bd[_0xd80e('0x3f')]=qs[_0xd80e('0x40')](_[_0xd80e('0x41')](_0x5522dd[_0xd80e('0x35')],_0x1303eb[_0xd80e('0x40')]),_0x32360c);if(_0x5522dd[_0xd80e('0x35')][_0xd80e('0x42')]){_0x30f9bd[_0xd80e('0x3f')]=_[_0xd80e('0x43')](_0x30f9bd['where'],{'$or':_['map'](_0x32360c,function(_0x4e92f6){if(_0x4e92f6[_0xd80e('0x32')]!==_0xd80e('0x44')){var _0x55925e={};_0x55925e[_0x4e92f6[_0xd80e('0x2c')]]={'$like':'%'+_0x5522dd['query'][_0xd80e('0x42')]+'%'};return _0x55925e;}})});}_0x30f9bd=_['merge']({},_0x30f9bd,_0x5522dd[_0xd80e('0x45')]);var _0xae1514={'where':_0x30f9bd['where']};return db['VoiceMail'][_0xd80e('0x20')](_0xae1514)[_0xd80e('0x25')](function(_0x439673){_0x400220[_0xd80e('0x20')]=_0x439673;if(_0x5522dd[_0xd80e('0x35')][_0xd80e('0x46')]){_0x30f9bd[_0xd80e('0x47')]=[{'all':!![]}];}return db[_0xd80e('0x30')][_0xd80e('0x48')](_0x30f9bd);})[_0xd80e('0x25')](function(_0x1bbb36){_0x400220[_0xd80e('0x49')]=_0x1bbb36;return _0x400220;})[_0xd80e('0x25')](respondWithFilteredResult(_0x54504e,_0x30f9bd))[_0xd80e('0x4a')](handleError(_0x54504e,null));};exports[_0xd80e('0x4b')]=function(_0x7f80a,_0x558911){var _0x52213c={'raw':!![],'where':{'id':_0x7f80a[_0xd80e('0x4c')]['id']}},_0x5bdea5={};_0x5bdea5['model']=_[_0xd80e('0x36')](db[_0xd80e('0x30')][_0xd80e('0x4d')]);_0x5bdea5[_0xd80e('0x35')]=_[_0xd80e('0x36')](_0x7f80a[_0xd80e('0x35')]);_0x5bdea5['filters']=_['intersection'](_0x5bdea5['model'],_0x5bdea5[_0xd80e('0x35')]);_0x52213c['attributes']=_[_0xd80e('0x37')](_0x5bdea5[_0xd80e('0x34')],qs[_0xd80e('0x39')](_0x7f80a[_0xd80e('0x35')][_0xd80e('0x39')]));_0x52213c['attributes']=_0x52213c[_0xd80e('0x38')][_0xd80e('0x3a')]?_0x52213c[_0xd80e('0x38')]:_0x5bdea5['model'];if(_0x7f80a[_0xd80e('0x35')][_0xd80e('0x46')]){_0x52213c[_0xd80e('0x47')]=[{'all':!![]}];}_0x52213c=_['merge']({},_0x52213c,_0x7f80a[_0xd80e('0x45')]);return db[_0xd80e('0x30')][_0xd80e('0x4e')](_0x52213c)[_0xd80e('0x25')](handleEntityNotFound(_0x558911,null))[_0xd80e('0x25')](respondWithResult(_0x558911,null))[_0xd80e('0x4a')](handleError(_0x558911,null));};exports['create']=function(_0x5aad1b,_0x275985){return db[_0xd80e('0x30')][_0xd80e('0x4f')](_0x5aad1b['body'],{})['then'](function(_0x1762a8){var _0xff0980=_0x5aad1b[_0xd80e('0x50')][_0xd80e('0x27')]({'plain':!![]});if(!_0xff0980)throw new Error(_0xd80e('0x51'));if(_0xff0980['role']===_0xd80e('0x50')){var _0x5c392d=_0x1762a8[_0xd80e('0x27')]({'plain':!![]});var _0x31107b='Voicemails';return db[_0xd80e('0x52')][_0xd80e('0x4e')]({'where':{'name':_0x31107b,'userProfileId':_0xff0980[_0xd80e('0x53')]},'raw':!![]})[_0xd80e('0x25')](function(_0x44b2f5){if(_0x44b2f5&&_0x44b2f5[_0xd80e('0x54')]===0x0){return db[_0xd80e('0x55')]['create']({'name':_0x5c392d[_0xd80e('0x2c')],'resourceId':_0x5c392d['id'],'type':_0x44b2f5[_0xd80e('0x2c')],'sectionId':_0x44b2f5['id']},{})[_0xd80e('0x25')](function(){return _0x1762a8;});}else{return _0x1762a8;}})['catch'](function(_0x52ab04){logger[_0xd80e('0x2a')](_0xd80e('0x56'),_0x52ab04);throw _0x52ab04;});}return _0x1762a8;})[_0xd80e('0x25')](respondWithResult(_0x275985,0xc9))[_0xd80e('0x4a')](handleError(_0x275985,null));};exports[_0xd80e('0x24')]=function(_0x8b7a70,_0x53b2b8){if(_0x8b7a70[_0xd80e('0x57')]['id']){delete _0x8b7a70['body']['id'];}return db[_0xd80e('0x30')]['find']({'where':{'id':_0x8b7a70[_0xd80e('0x4c')]['id']}})[_0xd80e('0x25')](handleEntityNotFound(_0x53b2b8,null))[_0xd80e('0x25')](saveUpdates(_0x8b7a70[_0xd80e('0x57')],null))[_0xd80e('0x25')](respondWithResult(_0x53b2b8,null))[_0xd80e('0x4a')](handleError(_0x53b2b8,null));};exports['destroy']=function(_0x13270c,_0x4e7edd){return db[_0xd80e('0x30')][_0xd80e('0x4e')]({'where':{'id':_0x13270c['params']['id']}})['then'](handleEntityNotFound(_0x4e7edd,null))[_0xd80e('0x25')](removeEntity(_0x4e7edd,null))[_0xd80e('0x4a')](handleError(_0x4e7edd,null));};exports[_0xd80e('0x58')]=function(_0x570a02,_0x568770,_0x1ba0ed){return db[_0xd80e('0x30')]['findOne']({'where':{'id':_0x570a02[_0xd80e('0x4c')]['id']}})[_0xd80e('0x25')](handleEntityNotFound(_0x568770,null))[_0xd80e('0x25')](function(_0x539390){var _0x41dda0;var _0x589c0b={},_0x720eab={};_0x720eab[_0xd80e('0x34')]=_[_0xd80e('0x36')](db[_0xd80e('0x59')]['rawAttributes']);_0x720eab[_0xd80e('0x35')]=_['keys'](_0x570a02[_0xd80e('0x35')]);_0x720eab['filters']=_[_0xd80e('0x37')](_0x720eab[_0xd80e('0x34')],_0x720eab[_0xd80e('0x35')]);_0x589c0b[_0xd80e('0x38')]=_['intersection'](_0x720eab[_0xd80e('0x34')],qs[_0xd80e('0x39')](_0x570a02['query'][_0xd80e('0x39')]));_0x589c0b[_0xd80e('0x38')]=_0x589c0b[_0xd80e('0x38')][_0xd80e('0x3a')]?_0x589c0b['attributes']:_0x720eab[_0xd80e('0x34')];if(!_0x570a02[_0xd80e('0x35')]['hasOwnProperty'](_0xd80e('0x3c'))){_0x589c0b[_0xd80e('0x1f')]=qs[_0xd80e('0x1f')](_0x570a02['query']['limit']);_0x589c0b['offset']=qs['offset'](_0x570a02[_0xd80e('0x35')]['offset']);}_0x589c0b[_0xd80e('0x3d')]=qs[_0xd80e('0x3e')](_0x570a02[_0xd80e('0x35')]['sort']);_0x589c0b[_0xd80e('0x3f')]=qs[_0xd80e('0x40')](_[_0xd80e('0x41')](_0x570a02[_0xd80e('0x35')],_0x720eab[_0xd80e('0x40')]));if(_0x570a02[_0xd80e('0x35')][_0xd80e('0x42')]){_0x589c0b[_0xd80e('0x3f')]=_[_0xd80e('0x43')](_0x589c0b['where'],{'$or':_['map'](_0x589c0b[_0xd80e('0x38')],function(_0x410ed6){var _0x10104c={};_0x10104c[_0x410ed6]={'$like':'%'+_0x570a02[_0xd80e('0x35')]['filter']+'%'};return _0x10104c;})});}_0x589c0b[_0xd80e('0x3f')]=_[_0xd80e('0x43')](_0x589c0b[_0xd80e('0x3f')],{'mailboxuser':_0x539390[_0xd80e('0x5a')]});_0x589c0b=_[_0xd80e('0x43')]({},_0x589c0b,_0x570a02['options']);return db[_0xd80e('0x59')][_0xd80e('0x5b')](_0x589c0b)[_0xd80e('0x25')](respondWithFilteredResult(_0x568770,_0x589c0b));})[_0xd80e('0x4a')](handleError(_0x568770,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index ae1d5c9..c36b6d8 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 _0x0150=['VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voiceMail.attributes','exports','define'];(function(_0x209bbf,_0x2e2375){var _0x592d4b=function(_0x419947){while(--_0x419947){_0x209bbf['push'](_0x209bbf['shift']());}};_0x592d4b(++_0x2e2375);}(_0x0150,0x66));var _0x0015=function(_0x5b4c07,_0x2a7666){_0x5b4c07=_0x5b4c07-0x0;var _0x5ddd83=_0x0150[_0x5b4c07];return _0x5ddd83;};'use strict';var _=require(_0x0015('0x0'));var util=require('util');var logger=require(_0x0015('0x1'))(_0x0015('0x2'));var moment=require('moment');var BPromise=require(_0x0015('0x3'));var rp=require(_0x0015('0x4'));var fs=require('fs');var path=require(_0x0015('0x5'));var rimraf=require('rimraf');var config=require(_0x0015('0x6'));var attributes=require(_0x0015('0x7'));module[_0x0015('0x8')]=function(_0x27b49b,_0x32ceb9){return _0x27b49b[_0x0015('0x9')](_0x0015('0xa'),attributes,{'tableName':_0x0015('0xb'),'paranoid':![],'indexes':[{'name':_0x0015('0xc'),'fields':[_0x0015('0xd'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xed32=['moment','path','rimraf','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','util','api'];(function(_0x207e4a,_0x5aad4e){var _0x5a4ac9=function(_0x5226d8){while(--_0x5226d8){_0x207e4a['push'](_0x207e4a['shift']());}};_0x5a4ac9(++_0x5aad4e);}(_0xed32,0x129));var _0x2ed3=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xed32[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require(_0x2ed3('0x0'));var logger=require('../../config/logger')(_0x2ed3('0x1'));var moment=require(_0x2ed3('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ed3('0x3'));var rimraf=require(_0x2ed3('0x4'));var config=require(_0x2ed3('0x5'));var attributes=require(_0x2ed3('0x6'));module[_0x2ed3('0x7')]=function(_0x33440a,_0x5d3038){return _0x33440a['define'](_0x2ed3('0x8'),attributes,{'tableName':_0x2ed3('0x9'),'paranoid':![],'indexes':[{'name':_0x2ed3('0xa'),'fields':[_0x2ed3('0xb'),_0x2ed3('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 678abad..934144c 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 _0x7b91=['info','request\x20sent','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x2eb9e9,_0x3dfdd7){var _0x3279aa=function(_0x1ef168){while(--_0x1ef168){_0x2eb9e9['push'](_0x2eb9e9['shift']());}};_0x3279aa(++_0x3dfdd7);}(_0x7b91,0x7a));var _0x17b9=function(_0x225154,_0x3055a4){_0x225154=_0x225154-0x0;var _0x2cff07=_0x7b91[_0x225154];return _0x2cff07;};'use strict';var _=require('lodash');var util=require(_0x17b9('0x0'));var moment=require(_0x17b9('0x1'));var BPromise=require(_0x17b9('0x2'));var rs=require(_0x17b9('0x3'));var fs=require('fs');var Redis=require(_0x17b9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x17b9('0x5'));var logger=require(_0x17b9('0x6'))(_0x17b9('0x7'));var config=require('../../config/environment');var jayson=require(_0x17b9('0x8'));var client=jayson[_0x17b9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b8559,_0x496afa,_0x2e73d1){return new BPromise(function(_0x562a32,_0x91d5cc){return client[_0x17b9('0xa')](_0x4b8559,_0x2e73d1)['then'](function(_0x26acca){logger[_0x17b9('0xb')]('VoiceMail,\x20%s,\x20%s',_0x496afa,'request\x20sent');logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x496afa,_0x17b9('0xc'),JSON[_0x17b9('0xd')](_0x26acca));if(_0x26acca[_0x17b9('0xe')]){if(_0x26acca['error'][_0x17b9('0xf')]===0x1f4){logger[_0x17b9('0xe')](_0x17b9('0x10'),_0x496afa,_0x26acca[_0x17b9('0xe')][_0x17b9('0x11')]);return _0x91d5cc(_0x26acca[_0x17b9('0xe')][_0x17b9('0x11')]);}logger[_0x17b9('0xe')](_0x17b9('0x10'),_0x496afa,_0x26acca[_0x17b9('0xe')][_0x17b9('0x11')]);return _0x562a32(_0x26acca[_0x17b9('0xe')]['message']);}else{logger[_0x17b9('0xb')](_0x17b9('0x10'),_0x496afa,_0x17b9('0xc'));_0x562a32(_0x26acca['result'][_0x17b9('0x11')]);}})[_0x17b9('0x12')](function(_0x3f83e1){logger[_0x17b9('0xe')](_0x17b9('0x10'),_0x496afa,_0x3f83e1);_0x91d5cc(_0x3f83e1);});});} \ No newline at end of file +var _0x04f4=['catch','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','VoiceMail,\x20%s,\x20%s','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result'];(function(_0x3b58c9,_0x1f46c3){var _0x5b653a=function(_0xecac3b){while(--_0xecac3b){_0x3b58c9['push'](_0x3b58c9['shift']());}};_0x5b653a(++_0x1f46c3);}(_0x04f4,0x131));var _0x404f=function(_0x14923d,_0x4bebd4){_0x14923d=_0x14923d-0x0;var _0x50d1af=_0x04f4[_0x14923d];return _0x50d1af;};'use strict';var _=require(_0x404f('0x0'));var util=require(_0x404f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x404f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x404f('0x3'))['db'];var utils=require(_0x404f('0x4'));var logger=require('../../config/logger')(_0x404f('0x5'));var config=require(_0x404f('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x404f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x628a52,_0x4936c6,_0x1da183){return new BPromise(function(_0x2844a4,_0x2017c1){return client[_0x404f('0x8')](_0x628a52,_0x1da183)[_0x404f('0x9')](function(_0x485538){logger['info'](_0x404f('0xa'),_0x4936c6,'request\x20sent');logger['debug'](_0x404f('0xb'),_0x4936c6,_0x404f('0xc'),JSON['stringify'](_0x485538));if(_0x485538[_0x404f('0xd')]){if(_0x485538[_0x404f('0xd')][_0x404f('0xe')]===0x1f4){logger[_0x404f('0xd')]('VoiceMail,\x20%s,\x20%s',_0x4936c6,_0x485538[_0x404f('0xd')][_0x404f('0xf')]);return _0x2017c1(_0x485538['error'][_0x404f('0xf')]);}logger[_0x404f('0xd')](_0x404f('0xa'),_0x4936c6,_0x485538['error'][_0x404f('0xf')]);return _0x2844a4(_0x485538[_0x404f('0xd')][_0x404f('0xf')]);}else{logger[_0x404f('0x10')](_0x404f('0xa'),_0x4936c6,_0x404f('0xc'));_0x2844a4(_0x485538[_0x404f('0x11')][_0x404f('0xf')]);}})[_0x404f('0x12')](function(_0x388b08){logger[_0x404f('0xd')]('VoiceMail,\x20%s,\x20%s',_0x4936c6,_0x388b08);_0x2017c1(_0x388b08);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 1a7874c..af89f51 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 _0xa084=['create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./voiceMailMessage.controller','isAuthenticated','index','get','/:id','show','/:id/download','download','post'];(function(_0x378c39,_0x3ec42e){var _0x520870=function(_0x209a13){while(--_0x209a13){_0x378c39['push'](_0x378c39['shift']());}};_0x520870(++_0x3ec42e);}(_0xa084,0x98));var _0x4a08=function(_0x5c1fc2,_0x26f97d){_0x5c1fc2=_0x5c1fc2-0x0;var _0x4cc454=_0xa084[_0x5c1fc2];return _0x4cc454;};'use strict';var multer=require(_0x4a08('0x0'));var util=require(_0x4a08('0x1'));var path=require(_0x4a08('0x2'));var timeout=require(_0x4a08('0x3'));var express=require(_0x4a08('0x4'));var router=express['Router']();var fs_extra=require(_0x4a08('0x5'));var auth=require(_0x4a08('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4a08('0x7'));router['get']('/',auth[_0x4a08('0x8')](),controller[_0x4a08('0x9')]);router[_0x4a08('0xa')](_0x4a08('0xb'),auth[_0x4a08('0x8')](),controller[_0x4a08('0xc')]);router[_0x4a08('0xa')](_0x4a08('0xd'),auth[_0x4a08('0x8')](),controller[_0x4a08('0xe')]);router[_0x4a08('0xf')]('/',auth[_0x4a08('0x8')](),controller[_0x4a08('0x10')]);router[_0x4a08('0x11')]('/:id',auth[_0x4a08('0x8')](),controller[_0x4a08('0x12')]);router['delete']('/:id',auth[_0x4a08('0x8')](),controller[_0x4a08('0x13')]);module[_0x4a08('0x14')]=router; \ No newline at end of file +var _0x9359=['post','put','/:id','update','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','download'];(function(_0x19d19c,_0x1f05da){var _0x849751=function(_0x11d43a){while(--_0x11d43a){_0x19d19c['push'](_0x19d19c['shift']());}};_0x849751(++_0x1f05da);}(_0x9359,0xe6));var _0x9935=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9359[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0x9935('0x0'));var path=require('path');var timeout=require(_0x9935('0x1'));var express=require(_0x9935('0x2'));var router=express['Router']();var fs_extra=require(_0x9935('0x3'));var auth=require(_0x9935('0x4'));var interaction=require(_0x9935('0x5'));var config=require('../../config/environment');var controller=require(_0x9935('0x6'));router[_0x9935('0x7')]('/',auth[_0x9935('0x8')](),controller['index']);router[_0x9935('0x7')]('/:id',auth[_0x9935('0x8')](),controller['show']);router[_0x9935('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x9935('0x9')]);router[_0x9935('0xa')]('/',auth[_0x9935('0x8')](),controller['create']);router[_0x9935('0xb')](_0x9935('0xc'),auth['isAuthenticated'](),controller[_0x9935('0xd')]);router['delete'](_0x9935('0xc'),auth[_0x9935('0x8')](),controller[_0x9935('0xe')]);module[_0x9935('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index dc0ad61..b9a4af6 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 _0x8f6d=['TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','STRING','BLOB'];(function(_0x1b2667,_0x279eb1){var _0x179ae8=function(_0x119262){while(--_0x119262){_0x1b2667['push'](_0x1b2667['shift']());}};_0x179ae8(++_0x279eb1);}(_0x8f6d,0xf7));var _0xd8f6=function(_0x1fd5c4,_0xc4eec5){_0x1fd5c4=_0x1fd5c4-0x0;var _0x174fe9=_0x8f6d[_0x1fd5c4];return _0x174fe9;};'use strict';var Sequelize=require(_0xd8f6('0x0'));module[_0xd8f6('0x1')]={'name':{'type':Sequelize[_0xd8f6('0x2')],'get':function(_0x34010d){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xd8f6('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xd8f6('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xd8f6('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xd8f6('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xd8f6('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xd8f6('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xd8f6('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xd8f6('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xd8f6('0x3')],'defaultValue':''},'stamp':{'type':_0xd8f6('0x5'),'defaultValue':Sequelize['literal'](_0xd8f6('0x6'))}}; \ No newline at end of file +var _0x00e3=['sequelize','exports','VIRTUAL','INTEGER','STRING','long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x3ac3da,_0x4e467c){var _0x1a7525=function(_0x13c94e){while(--_0x13c94e){_0x3ac3da['push'](_0x3ac3da['shift']());}};_0x1a7525(++_0x4e467c);}(_0x00e3,0x98));var _0x300e=function(_0x40b003,_0x3ae3aa){_0x40b003=_0x40b003-0x0;var _0x3d0edc=_0x00e3[_0x40b003];return _0x3d0edc;};'use strict';var Sequelize=require(_0x300e('0x0'));module[_0x300e('0x1')]={'name':{'type':Sequelize[_0x300e('0x2')],'get':function(_0x34f1e4){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x300e('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x300e('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x300e('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x300e('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x300e('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x300e('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x300e('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x300e('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x300e('0x6')](_0x300e('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 8454f65..04c854a 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 _0x72e6=['options','includeAll','VoiceMailMessage','findAll','rows','catch','show','params','filters','find','create','body','download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','attachment','attachment;\x20filename=\x22','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x72e6,0x106));var _0x672e=function(_0x1b9fb5,_0x2bd6a4){_0x1b9fb5=_0x1b9fb5-0x0;var _0x496adb=_0x72e6[_0x1b9fb5];return _0x496adb;};'use strict';var emlformat=require(_0x672e('0x0'));var rimraf=require(_0x672e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x672e('0x2'));var rp=require(_0x672e('0x3'));var moment=require('moment');var BPromise=require(_0x672e('0x4'));var Mustache=require(_0x672e('0x5'));var util=require(_0x672e('0x6'));var path=require(_0x672e('0x7'));var sox=require(_0x672e('0x8'));var csv=require(_0x672e('0x9'));var ejs=require(_0x672e('0xa'));var fs=require('fs');var fs_extra=require(_0x672e('0xb'));var _=require('lodash');var squel=require(_0x672e('0xc'));var crypto=require(_0x672e('0xd'));var jsforce=require(_0x672e('0xe'));var deskjs=require(_0x672e('0xf'));var toCsv=require(_0x672e('0x9'));var querystring=require(_0x672e('0x10'));var Papa=require(_0x672e('0x11'));var Redis=require('ioredis');var authService=require(_0x672e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x672e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x672e('0x14'))(_0x672e('0x15'));var utils=require(_0x672e('0x16'));var config=require(_0x672e('0x17'));var licenseUtil=require(_0x672e('0x18'));var db=require(_0x672e('0x19'))['db'];function respondWithStatusCode(_0x1bb735,_0x354415){_0x354415=_0x354415||0xcc;return function(_0x468d0f){if(_0x468d0f){return _0x1bb735[_0x672e('0x1a')](_0x354415);}return _0x1bb735[_0x672e('0x1b')](_0x354415)[_0x672e('0x1c')]();};}function respondWithResult(_0x434748,_0x3fcb1a){_0x3fcb1a=_0x3fcb1a||0xc8;return function(_0x5c9c4d){if(_0x5c9c4d){return _0x434748['status'](_0x3fcb1a)[_0x672e('0x1d')](_0x5c9c4d);}};}function respondWithFilteredResult(_0x58a6f6,_0x3cae2e){return function(_0x58f057){if(_0x58f057){var _0x27367f=typeof _0x3cae2e['offset']==='undefined'&&typeof _0x3cae2e[_0x672e('0x1e')]===_0x672e('0x1f');var _0x5286d7=_0x58f057[_0x672e('0x20')];var _0x4596a2=_0x27367f?0x0:_0x3cae2e['offset'];var _0x3619dc=_0x27367f?_0x58f057[_0x672e('0x20')]:_0x3cae2e[_0x672e('0x21')]+_0x3cae2e[_0x672e('0x1e')];var _0x1b56f8;if(_0x3619dc>=_0x5286d7){_0x3619dc=_0x5286d7;_0x1b56f8=0xc8;}else{_0x1b56f8=0xce;}_0x58a6f6[_0x672e('0x1b')](_0x1b56f8);return _0x58a6f6[_0x672e('0x22')](_0x672e('0x23'),_0x4596a2+'-'+_0x3619dc+'/'+_0x5286d7)['json'](_0x58f057);}return null;};}function patchUpdates(_0x2b9dcf){return function(_0x130785){try{jsonpatch[_0x672e('0x24')](_0x130785,_0x2b9dcf,!![]);}catch(_0x25a332){return BPromise['reject'](_0x25a332);}return _0x130785['save']();};}function saveUpdates(_0x51c611,_0x59c78){return function(_0x18fd19){if(_0x18fd19){return _0x18fd19[_0x672e('0x25')](_0x51c611)[_0x672e('0x26')](function(_0x4a481e){return _0x4a481e;});}return null;};}function removeEntity(_0x5e9ce2,_0x5d5c87){return function(_0x2c70c1){if(_0x2c70c1){return _0x2c70c1[_0x672e('0x27')]()[_0x672e('0x26')](function(){_0x5e9ce2[_0x672e('0x1b')](0xcc)[_0x672e('0x1c')]();});}};}function handleEntityNotFound(_0xff0a6f,_0x25ff3b){return function(_0x56c219){if(!_0x56c219){_0xff0a6f[_0x672e('0x1a')](0x194);}return _0x56c219;};}function handleError(_0x31cd5c,_0x2ab233){_0x2ab233=_0x2ab233||0x1f4;return function(_0x172085){logger[_0x672e('0x28')](_0x172085[_0x672e('0x29')]);if(_0x172085[_0x672e('0x2a')]){delete _0x172085[_0x672e('0x2a')];}_0x31cd5c[_0x672e('0x1b')](_0x2ab233)[_0x672e('0x2b')](_0x172085);};}exports[_0x672e('0x2c')]=function(_0x224d9d,_0x349837){var _0x64c1a8={},_0x22b63c={},_0x15c1a1={'count':0x0,'rows':[]};var _0x139d1e=_[_0x672e('0x2d')](db['VoiceMailMessage']['rawAttributes'],function(_0x11d775){return{'name':_0x11d775[_0x672e('0x2e')],'type':_0x11d775[_0x672e('0x2f')][_0x672e('0x30')]};});_0x22b63c[_0x672e('0x31')]=_['differenceBy'](_['map'](_0x139d1e,_0x672e('0x2a')),[_0x672e('0x2a')]);_0x22b63c[_0x672e('0x32')]=_[_0x672e('0x33')](_0x224d9d['query']);_0x22b63c['filters']=_[_0x672e('0x34')](_0x22b63c[_0x672e('0x31')],_0x22b63c[_0x672e('0x32')]);_0x64c1a8[_0x672e('0x35')]=_[_0x672e('0x34')](_0x22b63c[_0x672e('0x31')],qs[_0x672e('0x36')](_0x224d9d[_0x672e('0x32')]['fields']));_0x64c1a8[_0x672e('0x35')]=_0x64c1a8[_0x672e('0x35')]['length']?_0x64c1a8['attributes']:_0x22b63c[_0x672e('0x31')];if(!_0x224d9d['query'][_0x672e('0x37')]('nolimit')){_0x64c1a8[_0x672e('0x1e')]=qs[_0x672e('0x1e')](_0x224d9d[_0x672e('0x32')]['limit']);_0x64c1a8[_0x672e('0x21')]=qs[_0x672e('0x21')](_0x224d9d[_0x672e('0x32')]['offset']);}_0x64c1a8[_0x672e('0x38')]=qs['sort'](_0x224d9d[_0x672e('0x32')][_0x672e('0x39')]);_0x64c1a8[_0x672e('0x3a')]=qs['filters'](_[_0x672e('0x3b')](_0x224d9d[_0x672e('0x32')],_0x22b63c['filters']),_0x139d1e);if(_0x224d9d[_0x672e('0x32')][_0x672e('0x3c')]){_0x64c1a8[_0x672e('0x3a')]=_[_0x672e('0x3d')](_0x64c1a8[_0x672e('0x3a')],{'$or':_[_0x672e('0x2d')](_0x139d1e,function(_0x538c25){if(_0x538c25[_0x672e('0x2f')]!=='VIRTUAL'){var _0x525cc0={};_0x525cc0[_0x538c25[_0x672e('0x2a')]]={'$like':'%'+_0x224d9d[_0x672e('0x32')][_0x672e('0x3c')]+'%'};return _0x525cc0;}})});}_0x64c1a8=_['merge']({},_0x64c1a8,_0x224d9d[_0x672e('0x3e')]);var _0x357541={'where':_0x64c1a8[_0x672e('0x3a')]};return db['VoiceMailMessage'][_0x672e('0x20')](_0x357541)['then'](function(_0x2323c5){_0x15c1a1['count']=_0x2323c5;if(_0x224d9d[_0x672e('0x32')][_0x672e('0x3f')]){_0x64c1a8['include']=[{'all':!![]}];}return db[_0x672e('0x40')][_0x672e('0x41')](_0x64c1a8);})[_0x672e('0x26')](function(_0x23d03b){_0x15c1a1[_0x672e('0x42')]=_0x23d03b;return _0x15c1a1;})[_0x672e('0x26')](respondWithFilteredResult(_0x349837,_0x64c1a8))[_0x672e('0x43')](handleError(_0x349837,null));};exports[_0x672e('0x44')]=function(_0x430f14,_0x3b357a){var _0x3e64f2={'raw':!![],'where':{'id':_0x430f14[_0x672e('0x45')]['id']}},_0x7f778a={};_0x7f778a[_0x672e('0x31')]=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x7f778a[_0x672e('0x32')]=_[_0x672e('0x33')](_0x430f14[_0x672e('0x32')]);_0x7f778a[_0x672e('0x46')]=_[_0x672e('0x34')](_0x7f778a['model'],_0x7f778a[_0x672e('0x32')]);_0x3e64f2[_0x672e('0x35')]=_['intersection'](_0x7f778a[_0x672e('0x31')],qs[_0x672e('0x36')](_0x430f14[_0x672e('0x32')][_0x672e('0x36')]));_0x3e64f2[_0x672e('0x35')]=_0x3e64f2[_0x672e('0x35')]['length']?_0x3e64f2[_0x672e('0x35')]:_0x7f778a[_0x672e('0x31')];if(_0x430f14['query'][_0x672e('0x3f')]){_0x3e64f2['include']=[{'all':!![]}];}_0x3e64f2=_['merge']({},_0x3e64f2,_0x430f14['options']);return db['VoiceMailMessage'][_0x672e('0x47')](_0x3e64f2)['then'](handleEntityNotFound(_0x3b357a,null))[_0x672e('0x26')](respondWithResult(_0x3b357a,null))['catch'](handleError(_0x3b357a,null));};exports[_0x672e('0x48')]=function(_0x136822,_0x5daa16){return db['VoiceMailMessage']['create'](_0x136822[_0x672e('0x49')],{})[_0x672e('0x26')](respondWithResult(_0x5daa16,0xc9))[_0x672e('0x43')](handleError(_0x5daa16,null));};exports[_0x672e('0x25')]=function(_0x2a22cf,_0x2f2fb4){if(_0x2a22cf[_0x672e('0x49')]['id']){delete _0x2a22cf[_0x672e('0x49')]['id'];}return db['VoiceMailMessage'][_0x672e('0x47')]({'where':{'id':_0x2a22cf[_0x672e('0x45')]['id']}})[_0x672e('0x26')](handleEntityNotFound(_0x2f2fb4,null))[_0x672e('0x26')](saveUpdates(_0x2a22cf[_0x672e('0x49')],null))['then'](respondWithResult(_0x2f2fb4,null))[_0x672e('0x43')](handleError(_0x2f2fb4,null));};exports[_0x672e('0x27')]=function(_0x474bc8,_0x45b4f1){return db['VoiceMailMessage'][_0x672e('0x47')]({'where':{'id':_0x474bc8['params']['id']}})[_0x672e('0x26')](handleEntityNotFound(_0x45b4f1,null))['then'](removeEntity(_0x45b4f1,null))[_0x672e('0x43')](handleError(_0x45b4f1,null));};exports[_0x672e('0x4a')]=function(_0x136ed9,_0x4c8aba,_0x3bb187){return db[_0x672e('0x40')][_0x672e('0x47')]({'where':{'id':_0x136ed9[_0x672e('0x45')]['id']},'attributes':['id',_0x672e('0x4b'),_0x672e('0x4c')]})[_0x672e('0x26')](handleEntityNotFound(_0x4c8aba,null))['then'](function(_0x302b93){if(_0x302b93){if(!_0x302b93['recording']){throw new db['Sequelize'][(_0x672e('0x4d'))](_0x672e('0x4e'));}var _0x12f0bb={'Content-Type':'audio/wav','Content-Disposition':_0x672e('0x4f')};if(_0x302b93[_0x672e('0x4c')]){_0x12f0bb['Content-Disposition']=_0x672e('0x50')+_0x302b93[_0x672e('0x4c')]+'.wav\x22';}_0x4c8aba[_0x672e('0x22')](_0x12f0bb);return _0x4c8aba[_0x672e('0x2b')](new Buffer(_0x302b93[_0x672e('0x4b')]));}})['catch'](handleError(_0x4c8aba,null));}; \ No newline at end of file +var _0x714e=['destroy','end','error','stack','name','send','map','VoiceMailMessage','fieldName','type','differenceBy','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','update','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','then'];(function(_0x36ea5d,_0xa75586){var _0x596d87=function(_0x30f674){while(--_0x30f674){_0x36ea5d['push'](_0x36ea5d['shift']());}};_0x596d87(++_0xa75586);}(_0x714e,0x85));var _0xe714=function(_0x3ea5e1,_0x17c486){_0x3ea5e1=_0x3ea5e1-0x0;var _0x1b81d7=_0x714e[_0x3ea5e1];return _0x1b81d7;};'use strict';var emlformat=require(_0xe714('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe714('0x1'));var jsonpatch=require(_0xe714('0x2'));var rp=require(_0xe714('0x3'));var moment=require(_0xe714('0x4'));var BPromise=require(_0xe714('0x5'));var Mustache=require(_0xe714('0x6'));var util=require(_0xe714('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe714('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe714('0x9'));var squel=require(_0xe714('0xa'));var crypto=require('crypto');var jsforce=require(_0xe714('0xb'));var deskjs=require(_0xe714('0xc'));var toCsv=require(_0xe714('0xd'));var querystring=require(_0xe714('0xe'));var Papa=require('papaparse');var Redis=require(_0xe714('0xf'));var authService=require(_0xe714('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe714('0x11'));var logger=require(_0xe714('0x12'))(_0xe714('0x13'));var utils=require('../../config/utils');var config=require(_0xe714('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe714('0x15'))['db'];function respondWithStatusCode(_0x481fa5,_0x4adc69){_0x4adc69=_0x4adc69||0xcc;return function(_0x5b0147){if(_0x5b0147){return _0x481fa5['sendStatus'](_0x4adc69);}return _0x481fa5[_0xe714('0x16')](_0x4adc69)['end']();};}function respondWithResult(_0x4bedb8,_0x30e9b2){_0x30e9b2=_0x30e9b2||0xc8;return function(_0x24058f){if(_0x24058f){return _0x4bedb8[_0xe714('0x16')](_0x30e9b2)['json'](_0x24058f);}};}function respondWithFilteredResult(_0x38e092,_0x2c04ed){return function(_0x316918){if(_0x316918){var _0xdf9ad0=typeof _0x2c04ed[_0xe714('0x17')]===_0xe714('0x18')&&typeof _0x2c04ed[_0xe714('0x19')]===_0xe714('0x18');var _0x21cb0d=_0x316918[_0xe714('0x1a')];var _0x2740bb=_0xdf9ad0?0x0:_0x2c04ed[_0xe714('0x17')];var _0x200d79=_0xdf9ad0?_0x316918[_0xe714('0x1a')]:_0x2c04ed[_0xe714('0x17')]+_0x2c04ed[_0xe714('0x19')];var _0x589802;if(_0x200d79>=_0x21cb0d){_0x200d79=_0x21cb0d;_0x589802=0xc8;}else{_0x589802=0xce;}_0x38e092[_0xe714('0x16')](_0x589802);return _0x38e092[_0xe714('0x1b')](_0xe714('0x1c'),_0x2740bb+'-'+_0x200d79+'/'+_0x21cb0d)[_0xe714('0x1d')](_0x316918);}return null;};}function patchUpdates(_0x57b10e){return function(_0x39a80e){try{jsonpatch[_0xe714('0x1e')](_0x39a80e,_0x57b10e,!![]);}catch(_0x284f9b){return BPromise['reject'](_0x284f9b);}return _0x39a80e[_0xe714('0x1f')]();};}function saveUpdates(_0xd88bb2,_0x53a718){return function(_0x131f62){if(_0x131f62){return _0x131f62['update'](_0xd88bb2)[_0xe714('0x20')](function(_0x4d64ac){return _0x4d64ac;});}return null;};}function removeEntity(_0x537bfd,_0x334bed){return function(_0x5f1e6a){if(_0x5f1e6a){return _0x5f1e6a[_0xe714('0x21')]()[_0xe714('0x20')](function(){_0x537bfd[_0xe714('0x16')](0xcc)[_0xe714('0x22')]();});}};}function handleEntityNotFound(_0x4d2c82,_0x1a2d70){return function(_0x3001a4){if(!_0x3001a4){_0x4d2c82['sendStatus'](0x194);}return _0x3001a4;};}function handleError(_0x20541e,_0x2c3d11){_0x2c3d11=_0x2c3d11||0x1f4;return function(_0x50445f){logger[_0xe714('0x23')](_0x50445f[_0xe714('0x24')]);if(_0x50445f[_0xe714('0x25')]){delete _0x50445f[_0xe714('0x25')];}_0x20541e['status'](_0x2c3d11)[_0xe714('0x26')](_0x50445f);};}exports['index']=function(_0xd040bc,_0x48b5dc){var _0x507ff9={},_0x1d9dbd={},_0x4764a9={'count':0x0,'rows':[]};var _0x23fbd9=_[_0xe714('0x27')](db[_0xe714('0x28')]['rawAttributes'],function(_0xe545aa){return{'name':_0xe545aa[_0xe714('0x29')],'type':_0xe545aa[_0xe714('0x2a')]['key']};});_0x1d9dbd['model']=_[_0xe714('0x2b')](_[_0xe714('0x27')](_0x23fbd9,_0xe714('0x25')),[_0xe714('0x25')]);_0x1d9dbd[_0xe714('0x2c')]=_[_0xe714('0x2d')](_0xd040bc[_0xe714('0x2c')]);_0x1d9dbd['filters']=_['intersection'](_0x1d9dbd[_0xe714('0x2e')],_0x1d9dbd[_0xe714('0x2c')]);_0x507ff9[_0xe714('0x2f')]=_[_0xe714('0x30')](_0x1d9dbd[_0xe714('0x2e')],qs[_0xe714('0x31')](_0xd040bc['query']['fields']));_0x507ff9[_0xe714('0x2f')]=_0x507ff9[_0xe714('0x2f')][_0xe714('0x32')]?_0x507ff9['attributes']:_0x1d9dbd[_0xe714('0x2e')];if(!_0xd040bc[_0xe714('0x2c')][_0xe714('0x33')](_0xe714('0x34'))){_0x507ff9[_0xe714('0x19')]=qs[_0xe714('0x19')](_0xd040bc[_0xe714('0x2c')]['limit']);_0x507ff9[_0xe714('0x17')]=qs[_0xe714('0x17')](_0xd040bc[_0xe714('0x2c')]['offset']);}_0x507ff9['order']=qs[_0xe714('0x35')](_0xd040bc[_0xe714('0x2c')][_0xe714('0x35')]);_0x507ff9[_0xe714('0x36')]=qs[_0xe714('0x37')](_[_0xe714('0x38')](_0xd040bc[_0xe714('0x2c')],_0x1d9dbd[_0xe714('0x37')]),_0x23fbd9);if(_0xd040bc[_0xe714('0x2c')][_0xe714('0x39')]){_0x507ff9['where']=_[_0xe714('0x3a')](_0x507ff9['where'],{'$or':_[_0xe714('0x27')](_0x23fbd9,function(_0x1a8cb2){if(_0x1a8cb2['type']!==_0xe714('0x3b')){var _0x8f4bd0={};_0x8f4bd0[_0x1a8cb2[_0xe714('0x25')]]={'$like':'%'+_0xd040bc[_0xe714('0x2c')]['filter']+'%'};return _0x8f4bd0;}})});}_0x507ff9=_[_0xe714('0x3a')]({},_0x507ff9,_0xd040bc[_0xe714('0x3c')]);var _0x442d05={'where':_0x507ff9[_0xe714('0x36')]};return db['VoiceMailMessage'][_0xe714('0x1a')](_0x442d05)[_0xe714('0x20')](function(_0x793141){_0x4764a9[_0xe714('0x1a')]=_0x793141;if(_0xd040bc['query'][_0xe714('0x3d')]){_0x507ff9[_0xe714('0x3e')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xe714('0x3f')](_0x507ff9);})[_0xe714('0x20')](function(_0x1df752){_0x4764a9['rows']=_0x1df752;return _0x4764a9;})[_0xe714('0x20')](respondWithFilteredResult(_0x48b5dc,_0x507ff9))[_0xe714('0x40')](handleError(_0x48b5dc,null));};exports[_0xe714('0x41')]=function(_0x42ffa2,_0x5251dd){var _0xf79d04={'raw':!![],'where':{'id':_0x42ffa2[_0xe714('0x42')]['id']}},_0x3ce70={};_0x3ce70['model']=_['keys'](db['VoiceMailMessage'][_0xe714('0x43')]);_0x3ce70['query']=_[_0xe714('0x2d')](_0x42ffa2[_0xe714('0x2c')]);_0x3ce70[_0xe714('0x37')]=_['intersection'](_0x3ce70[_0xe714('0x2e')],_0x3ce70['query']);_0xf79d04[_0xe714('0x2f')]=_[_0xe714('0x30')](_0x3ce70['model'],qs['fields'](_0x42ffa2[_0xe714('0x2c')][_0xe714('0x31')]));_0xf79d04[_0xe714('0x2f')]=_0xf79d04[_0xe714('0x2f')][_0xe714('0x32')]?_0xf79d04[_0xe714('0x2f')]:_0x3ce70[_0xe714('0x2e')];if(_0x42ffa2[_0xe714('0x2c')][_0xe714('0x3d')]){_0xf79d04[_0xe714('0x3e')]=[{'all':!![]}];}_0xf79d04=_[_0xe714('0x3a')]({},_0xf79d04,_0x42ffa2[_0xe714('0x3c')]);return db['VoiceMailMessage'][_0xe714('0x44')](_0xf79d04)['then'](handleEntityNotFound(_0x5251dd,null))['then'](respondWithResult(_0x5251dd,null))[_0xe714('0x40')](handleError(_0x5251dd,null));};exports[_0xe714('0x45')]=function(_0x4a5257,_0x108386){return db[_0xe714('0x28')]['create'](_0x4a5257['body'],{})[_0xe714('0x20')](respondWithResult(_0x108386,0xc9))[_0xe714('0x40')](handleError(_0x108386,null));};exports[_0xe714('0x46')]=function(_0x4a1f17,_0x41733c){if(_0x4a1f17[_0xe714('0x47')]['id']){delete _0x4a1f17[_0xe714('0x47')]['id'];}return db[_0xe714('0x28')][_0xe714('0x44')]({'where':{'id':_0x4a1f17[_0xe714('0x42')]['id']}})[_0xe714('0x20')](handleEntityNotFound(_0x41733c,null))[_0xe714('0x20')](saveUpdates(_0x4a1f17['body'],null))[_0xe714('0x20')](respondWithResult(_0x41733c,null))[_0xe714('0x40')](handleError(_0x41733c,null));};exports[_0xe714('0x21')]=function(_0x2ec353,_0x183bc9){return db[_0xe714('0x28')][_0xe714('0x44')]({'where':{'id':_0x2ec353['params']['id']}})['then'](handleEntityNotFound(_0x183bc9,null))[_0xe714('0x20')](removeEntity(_0x183bc9,null))[_0xe714('0x40')](handleError(_0x183bc9,null));};exports[_0xe714('0x48')]=function(_0x43cc25,_0x4043d3,_0x4f6e20){return db[_0xe714('0x28')][_0xe714('0x44')]({'where':{'id':_0x43cc25[_0xe714('0x42')]['id']},'attributes':['id',_0xe714('0x49'),_0xe714('0x4a')]})[_0xe714('0x20')](handleEntityNotFound(_0x4043d3,null))[_0xe714('0x20')](function(_0x2cf36c){if(_0x2cf36c){if(!_0x2cf36c[_0xe714('0x49')]){throw new db[(_0xe714('0x4b'))][(_0xe714('0x4c'))](_0xe714('0x4d'));}var _0x538251={'Content-Type':_0xe714('0x4e'),'Content-Disposition':_0xe714('0x4f')};if(_0x2cf36c[_0xe714('0x4a')]){_0x538251[_0xe714('0x50')]=_0xe714('0x51')+_0x2cf36c[_0xe714('0x4a')]+_0xe714('0x52');}_0x4043d3[_0xe714('0x1b')](_0x538251);return _0x4043d3[_0xe714('0x26')](new Buffer(_0x2cf36c[_0xe714('0x49')]));}})[_0xe714('0x40')](handleError(_0x4043d3,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 8afe63d..c2f048e 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 _0x3338=['api','bluebird','request-promise','path','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger'];(function(_0x3fee23,_0x14879){var _0x89c21=function(_0xae9dbd){while(--_0xae9dbd){_0x3fee23['push'](_0x3fee23['shift']());}};_0x89c21(++_0x14879);}(_0x3338,0x106));var _0x8333=function(_0x3fb214,_0x428d93){_0x3fb214=_0x3fb214-0x0;var _0x38d89c=_0x3338[_0x3fb214];return _0x38d89c;};'use strict';var _=require(_0x8333('0x0'));var util=require('util');var logger=require(_0x8333('0x1'))(_0x8333('0x2'));var moment=require('moment');var BPromise=require(_0x8333('0x3'));var rp=require(_0x8333('0x4'));var fs=require('fs');var path=require(_0x8333('0x5'));var rimraf=require('rimraf');var config=require(_0x8333('0x6'));var attributes=require(_0x8333('0x7'));module['exports']=function(_0x20573b,_0x414a0e){return _0x20573b[_0x8333('0x8')](_0x8333('0x9'),attributes,{'tableName':_0x8333('0xa'),'paranoid':![],'indexes':[{'name':_0x8333('0xb'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0xf998=['voice_voicemail_messages','dir','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','VoiceMailMessage'];(function(_0x295a59,_0x3cf1a9){var _0x4629af=function(_0x367196){while(--_0x367196){_0x295a59['push'](_0x295a59['shift']());}};_0x4629af(++_0x3cf1a9);}(_0xf998,0x10a));var _0x8f99=function(_0x4801bd,_0x368071){_0x4801bd=_0x4801bd-0x0;var _0x3cf6fc=_0xf998[_0x4801bd];return _0x3cf6fc;};'use strict';var _=require(_0x8f99('0x0'));var util=require('util');var logger=require(_0x8f99('0x1'))(_0x8f99('0x2'));var moment=require('moment');var BPromise=require(_0x8f99('0x3'));var rp=require(_0x8f99('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8f99('0x5'));var config=require(_0x8f99('0x6'));var attributes=require(_0x8f99('0x7'));module[_0x8f99('0x8')]=function(_0x1a660c,_0x3bde5b){return _0x1a660c['define'](_0x8f99('0x9'),attributes,{'tableName':_0x8f99('0xa'),'paranoid':![],'indexes':[{'name':_0x8f99('0xb'),'fields':[_0x8f99('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 6304b4a..52b55d4 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 _0x3dff=['client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x3dff,0xda));var _0xf3df=function(_0x455005,_0x1889ab){_0x455005=_0x455005-0x0;var _0x414165=_0x3dff[_0x455005];return _0x414165;};'use strict';var _=require(_0xf3df('0x0'));var util=require(_0xf3df('0x1'));var moment=require(_0xf3df('0x2'));var BPromise=require(_0xf3df('0x3'));var rs=require(_0xf3df('0x4'));var fs=require('fs');var Redis=require(_0xf3df('0x5'));var db=require(_0xf3df('0x6'))['db'];var utils=require(_0xf3df('0x7'));var logger=require(_0xf3df('0x8'))(_0xf3df('0x9'));var config=require(_0xf3df('0xa'));var jayson=require(_0xf3df('0xb'));var client=jayson[_0xf3df('0xc')][_0xf3df('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4c394e,_0x4739ed,_0x598660){return new BPromise(function(_0x521d8a,_0x51d692){return client[_0xf3df('0xe')](_0x4c394e,_0x598660)['then'](function(_0x491af0){logger[_0xf3df('0xf')](_0xf3df('0x10'),_0x4739ed,_0xf3df('0x11'));logger[_0xf3df('0x12')](_0xf3df('0x13'),_0x4739ed,_0xf3df('0x11'),JSON['stringify'](_0x491af0));if(_0x491af0[_0xf3df('0x14')]){if(_0x491af0[_0xf3df('0x14')][_0xf3df('0x15')]===0x1f4){logger[_0xf3df('0x14')](_0xf3df('0x10'),_0x4739ed,_0x491af0[_0xf3df('0x14')]['message']);return _0x51d692(_0x491af0[_0xf3df('0x14')]['message']);}logger[_0xf3df('0x14')](_0xf3df('0x10'),_0x4739ed,_0x491af0[_0xf3df('0x14')]['message']);return _0x521d8a(_0x491af0[_0xf3df('0x14')][_0xf3df('0x16')]);}else{logger[_0xf3df('0xf')](_0xf3df('0x10'),_0x4739ed,_0xf3df('0x11'));_0x521d8a(_0x491af0['result'][_0xf3df('0x16')]);}})['catch'](function(_0x523ccf){logger['error'](_0xf3df('0x10'),_0x4739ed,_0x523ccf);_0x51d692(_0x523ccf);});});} \ No newline at end of file +var _0x83b1=['request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x504c5f,_0x4c9421){var _0x483c8e=function(_0x2a071e){while(--_0x2a071e){_0x504c5f['push'](_0x504c5f['shift']());}};_0x483c8e(++_0x4c9421);}(_0x83b1,0xf1));var _0x183b=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x83b1[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x183b('0x0'));var util=require(_0x183b('0x1'));var moment=require(_0x183b('0x2'));var BPromise=require(_0x183b('0x3'));var rs=require(_0x183b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x183b('0x5'))(_0x183b('0x6'));var config=require(_0x183b('0x7'));var jayson=require(_0x183b('0x8'));var client=jayson[_0x183b('0x9')][_0x183b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ad52c,_0x4e13e6,_0xca0b6c){return new BPromise(function(_0x596bc1,_0x55ff0f){return client[_0x183b('0xb')](_0x3ad52c,_0xca0b6c)['then'](function(_0x4312a3){logger[_0x183b('0xc')](_0x183b('0xd'),_0x4e13e6,_0x183b('0xe'));logger[_0x183b('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x4e13e6,'request\x20sent',JSON[_0x183b('0x10')](_0x4312a3));if(_0x4312a3[_0x183b('0x11')]){if(_0x4312a3[_0x183b('0x11')][_0x183b('0x12')]===0x1f4){logger[_0x183b('0x11')](_0x183b('0xd'),_0x4e13e6,_0x4312a3[_0x183b('0x11')]['message']);return _0x55ff0f(_0x4312a3[_0x183b('0x11')][_0x183b('0x13')]);}logger[_0x183b('0x11')](_0x183b('0xd'),_0x4e13e6,_0x4312a3[_0x183b('0x11')][_0x183b('0x13')]);return _0x596bc1(_0x4312a3[_0x183b('0x11')][_0x183b('0x13')]);}else{logger['info'](_0x183b('0xd'),_0x4e13e6,'request\x20sent');_0x596bc1(_0x4312a3[_0x183b('0x14')][_0x183b('0x13')]);}})['catch'](function(_0x255729){logger[_0x183b('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x4e13e6,_0x255729);_0x55ff0f(_0x255729);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index acf1191..a1be49c 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 _0x0729=['../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','delete','destroy','removeSound','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x142109,_0x2318d7){var _0x178e47=function(_0x2ca409){while(--_0x2ca409){_0x142109['push'](_0x142109['shift']());}};_0x178e47(++_0x2318d7);}(_0x0729,0x13c));var _0x9072=function(_0x1fa9d4,_0xe717e8){_0x1fa9d4=_0x1fa9d4-0x0;var _0x175ff6=_0x0729[_0x1fa9d4];return _0x175ff6;};'use strict';var multer=require('multer');var util=require(_0x9072('0x0'));var path=require(_0x9072('0x1'));var timeout=require(_0x9072('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9072('0x3'));var auth=require(_0x9072('0x4'));var interaction=require(_0x9072('0x5'));var config=require(_0x9072('0x6'));var controller=require(_0x9072('0x7'));router[_0x9072('0x8')]('/',auth[_0x9072('0x9')](),controller[_0x9072('0xa')]);router[_0x9072('0x8')](_0x9072('0xb'),auth[_0x9072('0x9')](),controller[_0x9072('0xc')]);router[_0x9072('0x8')](_0x9072('0xd'),auth['isAuthenticated'](),controller[_0x9072('0xe')]);router[_0x9072('0xf')]('/',auth['isAuthenticated'](),controller[_0x9072('0x10')]);router[_0x9072('0xf')](_0x9072('0xd'),auth[_0x9072('0x9')](),controller[_0x9072('0x11')]);router[_0x9072('0x12')]('/:id',auth[_0x9072('0x9')](),controller['update']);router[_0x9072('0x13')](_0x9072('0xb'),auth[_0x9072('0x9')](),controller[_0x9072('0x14')]);router[_0x9072('0x13')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0x9072('0x15')]);module[_0x9072('0x16')]=router; \ No newline at end of file +var _0xa5af=['put','update','destroy','delete','/:id/sounds/:id2','removeSound','multer','path','connect-timeout','Router','fs-extra','../../config/environment','isAuthenticated','get','/:id','show','/:id/sounds','getSounds','post','create','addSound'];(function(_0x2a8f43,_0x7126e){var _0xec242=function(_0x25e423){while(--_0x25e423){_0x2a8f43['push'](_0x2a8f43['shift']());}};_0xec242(++_0x7126e);}(_0xa5af,0x1d4));var _0xfa5a=function(_0x3e0104,_0x2916c0){_0x3e0104=_0x3e0104-0x0;var _0x5bf813=_0xa5af[_0x3e0104];return _0x5bf813;};'use strict';var multer=require(_0xfa5a('0x0'));var util=require('util');var path=require(_0xfa5a('0x1'));var timeout=require(_0xfa5a('0x2'));var express=require('express');var router=express[_0xfa5a('0x3')]();var fs_extra=require(_0xfa5a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfa5a('0x5'));var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth[_0xfa5a('0x6')](),controller['index']);router[_0xfa5a('0x7')](_0xfa5a('0x8'),auth['isAuthenticated'](),controller[_0xfa5a('0x9')]);router[_0xfa5a('0x7')](_0xfa5a('0xa'),auth['isAuthenticated'](),controller[_0xfa5a('0xb')]);router[_0xfa5a('0xc')]('/',auth[_0xfa5a('0x6')](),controller[_0xfa5a('0xd')]);router[_0xfa5a('0xc')](_0xfa5a('0xa'),auth[_0xfa5a('0x6')](),controller[_0xfa5a('0xe')]);router[_0xfa5a('0xf')](_0xfa5a('0x8'),auth[_0xfa5a('0x6')](),controller[_0xfa5a('0x10')]);router['delete'](_0xfa5a('0x8'),auth[_0xfa5a('0x6')](),controller[_0xfa5a('0x11')]);router[_0xfa5a('0x12')](_0xfa5a('0x13'),auth[_0xfa5a('0x6')](),controller[_0xfa5a('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index db5b59e..8b4b2a7 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 _0xb896=['TIMESTAMP','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0xb896,0x1bd));var _0x6b89=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0xb896[_0x2ca616];return _0x53155f;};'use strict';var Sequelize=require('sequelize');module[_0x6b89('0x0')]={'name':{'type':Sequelize[_0x6b89('0x1')],'allowNull':![],'unique':_0x6b89('0x2')},'mode':{'type':Sequelize[_0x6b89('0x3')](_0x6b89('0x4'),_0x6b89('0x5'),_0x6b89('0x6'),_0x6b89('0x7'),_0x6b89('0x8'),_0x6b89('0x9')),'allowNull':!![],'defaultValue':_0x6b89('0x5')},'directory':{'type':Sequelize[_0x6b89('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x6b89('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x6b89('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x6b89('0x1')],'allowNull':!![],'defaultValue':_0x6b89('0xa')},'format':{'type':Sequelize[_0x6b89('0x1')],'allowNull':!![]},'stamp':{'type':_0x6b89('0xb')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7126=['quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','exports','STRING','ENUM','custom','files','mp3nb','quietmp3nb'];(function(_0x3ed1cc,_0x49a6fd){var _0x6a5053=function(_0x1638b9){while(--_0x1638b9){_0x3ed1cc['push'](_0x3ed1cc['shift']());}};_0x6a5053(++_0x49a6fd);}(_0x7126,0x1c1));var _0x6712=function(_0x4018b8,_0x5bd123){_0x4018b8=_0x4018b8-0x0;var _0x92d7ed=_0x7126[_0x4018b8];return _0x92d7ed;};'use strict';var Sequelize=require('sequelize');module[_0x6712('0x0')]={'name':{'type':Sequelize[_0x6712('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x6712('0x2')](_0x6712('0x3'),_0x6712('0x4'),_0x6712('0x5'),_0x6712('0x6'),_0x6712('0x7'),_0x6712('0x8')),'allowNull':!![],'defaultValue':_0x6712('0x4')},'directory':{'type':Sequelize[_0x6712('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x6712('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x6712('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x6712('0x1')],'allowNull':!![],'defaultValue':_0x6712('0x9')},'format':{'type':Sequelize[_0x6712('0x1')],'allowNull':!![]},'stamp':{'type':_0x6712('0xa')},'defaultEntry':{'type':Sequelize[_0x6712('0xb')],'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 ccfad61..93f4205 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 _0x1f13=['end','status','json','limit','undefined','count','offset','set','reject','update','get','UserProfileResource','destroy','then','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','VoiceMusicOnHold','findAll','rows','catch','show','params','length','body','find','create','transaction','mode','files','directory','join','server/files/moh','0777','user','UserProfileSection','MusicOnHolds','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','addSound','sequelize','Sound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','Sequelize','removeSound','id2','message','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x34d166,_0x27e32a){var _0x8f4f85=function(_0x2f2598){while(--_0x2f2598){_0x34d166['push'](_0x34d166['shift']());}};_0x8f4f85(++_0x27e32a);}(_0x1f13,0x1b1));var _0x31f1=function(_0x4a606b,_0x5c4557){_0x4a606b=_0x4a606b-0x0;var _0x5eb404=_0x1f13[_0x4a606b];return _0x5eb404;};'use strict';var emlformat=require(_0x31f1('0x0'));var rimraf=require(_0x31f1('0x1'));var zipdir=require(_0x31f1('0x2'));var jsonpatch=require(_0x31f1('0x3'));var rp=require('request-promise');var moment=require(_0x31f1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x31f1('0x5'));var util=require(_0x31f1('0x6'));var path=require(_0x31f1('0x7'));var sox=require(_0x31f1('0x8'));var csv=require('to-csv');var ejs=require(_0x31f1('0x9'));var fs=require('fs');var fs_extra=require(_0x31f1('0xa'));var _=require('lodash');var squel=require(_0x31f1('0xb'));var crypto=require(_0x31f1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x31f1('0xd'));var toCsv=require(_0x31f1('0xe'));var querystring=require(_0x31f1('0xf'));var Papa=require(_0x31f1('0x10'));var Redis=require(_0x31f1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x31f1('0x12'));var as=require(_0x31f1('0x13'));var hardwareService=require(_0x31f1('0x14'));var logger=require(_0x31f1('0x15'))(_0x31f1('0x16'));var utils=require(_0x31f1('0x17'));var config=require(_0x31f1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x31f1('0x19'))['db'];function respondWithStatusCode(_0x32ccb5,_0x3a64df){_0x3a64df=_0x3a64df||0xcc;return function(_0x44069f){if(_0x44069f){return _0x32ccb5[_0x31f1('0x1a')](_0x3a64df);}return _0x32ccb5['status'](_0x3a64df)[_0x31f1('0x1b')]();};}function respondWithResult(_0x3ad675,_0x1e7815){_0x1e7815=_0x1e7815||0xc8;return function(_0x49ff9c){if(_0x49ff9c){return _0x3ad675[_0x31f1('0x1c')](_0x1e7815)[_0x31f1('0x1d')](_0x49ff9c);}};}function respondWithFilteredResult(_0x3ca28f,_0x3d0dd1){return function(_0x1dc50b){if(_0x1dc50b){var _0x318deb=typeof _0x3d0dd1['offset']==='undefined'&&typeof _0x3d0dd1[_0x31f1('0x1e')]===_0x31f1('0x1f');var _0x41b58f=_0x1dc50b[_0x31f1('0x20')];var _0x162ea7=_0x318deb?0x0:_0x3d0dd1['offset'];var _0x61f73b=_0x318deb?_0x1dc50b['count']:_0x3d0dd1[_0x31f1('0x21')]+_0x3d0dd1[_0x31f1('0x1e')];var _0x12b312;if(_0x61f73b>=_0x41b58f){_0x61f73b=_0x41b58f;_0x12b312=0xc8;}else{_0x12b312=0xce;}_0x3ca28f[_0x31f1('0x1c')](_0x12b312);return _0x3ca28f[_0x31f1('0x22')]('Content-Range',_0x162ea7+'-'+_0x61f73b+'/'+_0x41b58f)[_0x31f1('0x1d')](_0x1dc50b);}return null;};}function patchUpdates(_0x7a515){return function(_0x226019){try{jsonpatch['apply'](_0x226019,_0x7a515,!![]);}catch(_0x536cea){return BPromise[_0x31f1('0x23')](_0x536cea);}return _0x226019['save']();};}function saveUpdates(_0xc744bd,_0x2369fc){return function(_0x5727c3){if(_0x5727c3){return _0x5727c3[_0x31f1('0x24')](_0xc744bd)['then'](function(_0x2b672c){return _0x2b672c;});}return null;};}function removeEntity(_0x4c0099,_0x182ca8){return function(_0x5dfa0d){if(_0x5dfa0d){return _0x5dfa0d['destroy']()['then'](function(){var _0x353068=_0x5dfa0d[_0x31f1('0x25')]({'plain':!![]});var _0x57f78d='MusicOnHolds';return db[_0x31f1('0x26')][_0x31f1('0x27')]({'where':{'type':_0x57f78d,'resourceId':_0x353068['id']}})['then'](function(){return _0x5dfa0d;});})[_0x31f1('0x28')](function(){_0x4c0099['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7a474c,_0x2bf8ff){return function(_0x11830d){if(!_0x11830d){_0x7a474c['sendStatus'](0x194);}return _0x11830d;};}function handleError(_0x19f46f,_0x35dca7){_0x35dca7=_0x35dca7||0x1f4;return function(_0x587b04){logger[_0x31f1('0x29')](_0x587b04[_0x31f1('0x2a')]);if(_0x587b04[_0x31f1('0x2b')]){delete _0x587b04['name'];}_0x19f46f[_0x31f1('0x1c')](_0x35dca7)[_0x31f1('0x2c')](_0x587b04);};}exports[_0x31f1('0x2d')]=function(_0x4c51c3,_0x303824){var _0x14d846={},_0xd9a063={},_0xeea396={'count':0x0,'rows':[]};var _0x281464=_[_0x31f1('0x2e')](db['VoiceMusicOnHold'][_0x31f1('0x2f')],function(_0x239c95){return{'name':_0x239c95['fieldName'],'type':_0x239c95['type'][_0x31f1('0x30')]};});_0xd9a063[_0x31f1('0x31')]=_[_0x31f1('0x2e')](_0x281464,_0x31f1('0x2b'));_0xd9a063[_0x31f1('0x32')]=_[_0x31f1('0x33')](_0x4c51c3[_0x31f1('0x32')]);_0xd9a063[_0x31f1('0x34')]=_[_0x31f1('0x35')](_0xd9a063[_0x31f1('0x31')],_0xd9a063[_0x31f1('0x32')]);_0x14d846['attributes']=_['intersection'](_0xd9a063['model'],qs['fields'](_0x4c51c3['query'][_0x31f1('0x36')]));_0x14d846[_0x31f1('0x37')]=_0x14d846[_0x31f1('0x37')]['length']?_0x14d846['attributes']:_0xd9a063[_0x31f1('0x31')];if(!_0x4c51c3[_0x31f1('0x32')][_0x31f1('0x38')](_0x31f1('0x39'))){_0x14d846[_0x31f1('0x1e')]=qs[_0x31f1('0x1e')](_0x4c51c3['query']['limit']);_0x14d846[_0x31f1('0x21')]=qs[_0x31f1('0x21')](_0x4c51c3[_0x31f1('0x32')][_0x31f1('0x21')]);}_0x14d846[_0x31f1('0x3a')]=qs['sort'](_0x4c51c3['query'][_0x31f1('0x3b')]);delete _0x4c51c3['query'][_0x31f1('0x3b')];_0x14d846[_0x31f1('0x3c')]=qs['filters'](_[_0x31f1('0x3d')](_0x4c51c3['query'],_0xd9a063[_0x31f1('0x34')]),_0x281464);if(_0x4c51c3['query'][_0x31f1('0x3e')]){_0x14d846[_0x31f1('0x3c')]=_[_0x31f1('0x3f')](_0x14d846[_0x31f1('0x3c')],{'$or':_[_0x31f1('0x2e')](_0x281464,function(_0x29091d){if(_0x29091d[_0x31f1('0x40')]!==_0x31f1('0x41')){var _0x35c937={};_0x35c937[_0x29091d['name']]={'$like':'%'+_0x4c51c3['query'][_0x31f1('0x3e')]+'%'};return _0x35c937;}})});}_0x14d846=_[_0x31f1('0x3f')]({},_0x14d846,_0x4c51c3[_0x31f1('0x42')]);var _0x4b8cf8={'where':_0x14d846[_0x31f1('0x3c')]};return db['VoiceMusicOnHold']['count'](_0x4b8cf8)[_0x31f1('0x28')](function(_0xb6b28b){_0xeea396[_0x31f1('0x20')]=_0xb6b28b;if(_0x4c51c3[_0x31f1('0x32')][_0x31f1('0x43')]){_0x14d846[_0x31f1('0x44')]=[{'all':!![]}];}return db[_0x31f1('0x45')][_0x31f1('0x46')](_0x14d846);})[_0x31f1('0x28')](function(_0x39ddb3){_0xeea396[_0x31f1('0x47')]=_0x39ddb3;return _0xeea396;})[_0x31f1('0x28')](respondWithFilteredResult(_0x303824,_0x14d846))[_0x31f1('0x48')](handleError(_0x303824,null));};exports[_0x31f1('0x49')]=function(_0x334545,_0x3cb70a){var _0x271725={'raw':![],'where':{'id':_0x334545[_0x31f1('0x4a')]['id']}},_0x5e13e3={};_0x5e13e3[_0x31f1('0x31')]=_[_0x31f1('0x33')](db['VoiceMusicOnHold'][_0x31f1('0x2f')]);_0x5e13e3[_0x31f1('0x32')]=_[_0x31f1('0x33')](_0x334545[_0x31f1('0x32')]);_0x5e13e3[_0x31f1('0x34')]=_[_0x31f1('0x35')](_0x5e13e3[_0x31f1('0x31')],_0x5e13e3[_0x31f1('0x32')]);_0x271725[_0x31f1('0x37')]=_['intersection'](_0x5e13e3[_0x31f1('0x31')],qs[_0x31f1('0x36')](_0x334545[_0x31f1('0x32')][_0x31f1('0x36')]));_0x271725['attributes']=_0x271725['attributes'][_0x31f1('0x4b')]?_0x271725[_0x31f1('0x37')]:_0x5e13e3[_0x31f1('0x31')];if(_0x334545['query'][_0x31f1('0x43')]){_0x271725[_0x31f1('0x44')]=[{'all':!![]}];}_0x271725=_[_0x31f1('0x3f')]({},_0x271725,_0x334545[_0x31f1('0x42')]);return db[_0x31f1('0x45')]['find'](_0x271725)['then'](handleEntityNotFound(_0x3cb70a,null))['then'](respondWithResult(_0x3cb70a,null))[_0x31f1('0x48')](handleError(_0x3cb70a,null));};exports[_0x31f1('0x24')]=function(_0x10cc2b,_0x3b5fcb){if(_0x10cc2b['body']['id']){delete _0x10cc2b[_0x31f1('0x4c')]['id'];}return db['VoiceMusicOnHold'][_0x31f1('0x4d')]({'where':{'id':_0x10cc2b['params']['id']}})[_0x31f1('0x28')](handleEntityNotFound(_0x3b5fcb,null))[_0x31f1('0x28')](saveUpdates(_0x10cc2b[_0x31f1('0x4c')],null))['then'](respondWithResult(_0x3b5fcb,null))['catch'](handleError(_0x3b5fcb,null));};exports[_0x31f1('0x4e')]=function(_0x52d81e,_0x518bd6,_0xb63624){return db['sequelize'][_0x31f1('0x4f')](function(_0x206df2){if(_0x52d81e[_0x31f1('0x4c')][_0x31f1('0x50')]===_0x31f1('0x51')){_0x52d81e[_0x31f1('0x4c')][_0x31f1('0x52')]=path[_0x31f1('0x53')](config['root'],_0x31f1('0x54'),_0x52d81e['body'][_0x31f1('0x2b')]);}return db[_0x31f1('0x45')][_0x31f1('0x4e')](_0x52d81e[_0x31f1('0x4c')],{'transaction':_0x206df2})['then'](function(_0x500d20){if(_0x52d81e[_0x31f1('0x4c')][_0x31f1('0x50')]===_0x31f1('0x51')){fs['mkdirSync'](_0x500d20[_0x31f1('0x52')],parseInt(_0x31f1('0x55'),0x8));}var _0x2ee827=_0x52d81e['user'][_0x31f1('0x25')]({'plain':!![]});if(!_0x2ee827)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ee827['role']===_0x31f1('0x56')){var _0x344701=_0x500d20[_0x31f1('0x25')]({'plain':!![]});return db[_0x31f1('0x57')]['find']({'where':{'name':_0x31f1('0x58'),'userProfileId':_0x2ee827[_0x31f1('0x59')]},'raw':!![]})[_0x31f1('0x28')](function(_0x47478d){if(_0x47478d&&_0x47478d['autoAssociation']===0x0){return db['UserProfileResource'][_0x31f1('0x4e')]({'name':_0x344701['name'],'resourceId':_0x344701['id'],'type':_0x47478d['name'],'sectionId':_0x47478d['id']},{})[_0x31f1('0x28')](function(){return _0x500d20;});}else{return _0x500d20;}})['catch'](function(_0x5c4ade){logger[_0x31f1('0x29')](_0x31f1('0x5a'),_0x5c4ade);});}return _0x500d20;});})['then'](respondWithResult(_0x518bd6,0xc9))['catch'](handleError(_0x518bd6,null));};exports[_0x31f1('0x27')]=function(_0x277b33,_0x381d5a,_0x3f8fa5){var _0x4b3a2a;return db[_0x31f1('0x45')]['find']({'where':{'id':_0x277b33[_0x31f1('0x4a')]['id']}})['then'](function(_0x8ab1a2){if(_0x8ab1a2){return db['sequelize'][_0x31f1('0x4f')](function(_0x1535a6){return _0x8ab1a2[_0x31f1('0x27')]({'transaction':_0x1535a6,'raw':!![]})[_0x31f1('0x28')](function(_0x19faa8){if(_0x19faa8[_0x31f1('0x52')]){fs[_0x31f1('0x5b')](_0x19faa8[_0x31f1('0x52')])[_0x31f1('0x5c')](function(_0x1e716b){fs[_0x31f1('0x5d')](path[_0x31f1('0x53')](_0x19faa8[_0x31f1('0x52')],_0x1e716b));});fs[_0x31f1('0x5e')](_0x19faa8['directory']);}return _0x19faa8;});})[_0x31f1('0x48')](function(_0x5bf985){throw new db['Sequelize'][(_0x31f1('0x5f'))](_0x5bf985['message']);});}})[_0x31f1('0x28')](handleEntityNotFound(_0x381d5a,null))['then'](removeEntity(_0x381d5a,null))[_0x31f1('0x48')](handleError(_0x381d5a,null));};exports[_0x31f1('0x60')]=function(_0x331eeb,_0x32fd39,_0x323699){return db[_0x31f1('0x61')][_0x31f1('0x4f')](function(_0x3d2828){var _0x16f26d;return db[_0x31f1('0x45')]['find']({'where':{'id':_0x331eeb[_0x31f1('0x4a')]['id']}})[_0x31f1('0x28')](function(_0x44f3f6){if(_0x44f3f6){_0x16f26d=_0x44f3f6;return _0x44f3f6[_0x31f1('0x60')](_0x331eeb[_0x31f1('0x4c')]['id'],{'transaction':_0x3d2828});}})['then'](function(_0x539ec5){if(_0x539ec5){return db[_0x31f1('0x62')][_0x31f1('0x63')]({'where':{'id':_0x331eeb[_0x31f1('0x4c')]['id']},'attributes':['id','name',_0x31f1('0x64'),_0x31f1('0x65'),_0x31f1('0x66')],'raw':!![]});}})[_0x31f1('0x28')](function(_0x4a8800){if(_0x4a8800){var _0x542eda=path[_0x31f1('0x53')](config[_0x31f1('0x67')],_0x31f1('0x68'),util[_0x31f1('0x69')](_0x31f1('0x6a'),path[_0x31f1('0x6b')](_0x4a8800['save_name'],path[_0x31f1('0x6c')](_0x4a8800['save_name'])),_0x4a8800['converted_format']));var _0x4aa8b5=path['join'](config[_0x31f1('0x67')],_0x31f1('0x54'),_0x16f26d[_0x31f1('0x2b')],util[_0x31f1('0x69')]('%s.%s',_0x4a8800[_0x31f1('0x2b')],_0x4a8800[_0x31f1('0x65')]));fs[_0x31f1('0x6d')](_0x542eda,_0x4aa8b5);return _0x4a8800;}})[_0x31f1('0x48')](function(_0x29645f){throw new db[(_0x31f1('0x6e'))][(_0x31f1('0x5f'))](_0x29645f['message']);});})[_0x31f1('0x28')](handleEntityNotFound(_0x32fd39,null))[_0x31f1('0x28')](respondWithResult(_0x32fd39,0xc9))[_0x31f1('0x48')](handleError(_0x32fd39,null));};exports[_0x31f1('0x6f')]=function(_0x12354f,_0x4a63fa,_0x42ef24){return db[_0x31f1('0x61')][_0x31f1('0x4f')](function(_0x2ef57b){var _0x101792;return db[_0x31f1('0x45')][_0x31f1('0x63')]({'where':{'id':_0x12354f[_0x31f1('0x4a')]['id']}})[_0x31f1('0x28')](handleEntityNotFound(_0x4a63fa,null))[_0x31f1('0x28')](function(_0x36718b){if(_0x36718b){_0x101792=_0x36718b;return _0x36718b['removeSound'](_0x12354f[_0x31f1('0x4a')][_0x31f1('0x70')]);}})[_0x31f1('0x28')](function(_0x40c7cc){if(_0x40c7cc){return db[_0x31f1('0x62')][_0x31f1('0x63')]({'where':{'id':_0x12354f[_0x31f1('0x4a')][_0x31f1('0x70')]},'attributes':['id','name','save_name',_0x31f1('0x65'),_0x31f1('0x66')],'raw':!![]});}})[_0x31f1('0x28')](function(_0x10ef55){if(_0x10ef55){fs['unlinkSync'](path[_0x31f1('0x53')](_0x101792[_0x31f1('0x52')],util['format'](_0x31f1('0x6a'),_0x10ef55[_0x31f1('0x2b')],_0x10ef55[_0x31f1('0x65')])));return _0x10ef55;}})[_0x31f1('0x48')](function(_0x2d1df9){throw new db[(_0x31f1('0x6e'))]['ValidationError'](_0x2d1df9[_0x31f1('0x71')]);});})[_0x31f1('0x28')](handleEntityNotFound(_0x4a63fa,null))[_0x31f1('0x28')](respondWithStatusCode(_0x4a63fa,0xcc))[_0x31f1('0x48')](handleError(_0x4a63fa,null));};exports[_0x31f1('0x72')]=function(_0x958c9,_0x42635b,_0x2d1c93){var _0x32785f={};var _0x5127c1={};var _0x20c2eb;var _0x26ad8d;return db[_0x31f1('0x45')][_0x31f1('0x63')]({'where':{'id':_0x958c9[_0x31f1('0x4a')]['id']}})[_0x31f1('0x28')](handleEntityNotFound(_0x42635b,null))[_0x31f1('0x28')](function(_0x5871c5){if(_0x5871c5){_0x20c2eb=_0x5871c5;_0x5127c1['model']=_[_0x31f1('0x33')](db[_0x31f1('0x62')][_0x31f1('0x2f')]);_0x5127c1[_0x31f1('0x32')]=_['keys'](_0x958c9['query']);_0x5127c1[_0x31f1('0x34')]=_[_0x31f1('0x35')](_0x5127c1[_0x31f1('0x31')],_0x5127c1[_0x31f1('0x32')]);_0x32785f[_0x31f1('0x37')]=_[_0x31f1('0x35')](_0x5127c1[_0x31f1('0x31')],qs[_0x31f1('0x36')](_0x958c9[_0x31f1('0x32')][_0x31f1('0x36')]));_0x32785f[_0x31f1('0x37')]=_0x32785f[_0x31f1('0x37')][_0x31f1('0x4b')]?_0x32785f['attributes']:_0x5127c1[_0x31f1('0x31')];_0x32785f[_0x31f1('0x3a')]=qs['sort'](_0x958c9[_0x31f1('0x32')][_0x31f1('0x3b')]);_0x32785f['where']=qs[_0x31f1('0x34')](_[_0x31f1('0x3d')](_0x958c9[_0x31f1('0x32')],_0x5127c1[_0x31f1('0x34')]));if(_0x958c9['query'][_0x31f1('0x3e')]){_0x32785f['where']=_[_0x31f1('0x3f')](_0x32785f['where'],{'$or':_[_0x31f1('0x2e')](_0x32785f['attributes'],function(_0x57748d){var _0x1a082f={};_0x1a082f[_0x57748d]={'$like':'%'+_0x958c9['query']['filter']+'%'};return _0x1a082f;})});}_0x32785f=_[_0x31f1('0x3f')]({},_0x32785f,_0x958c9[_0x31f1('0x42')]);return _0x20c2eb[_0x31f1('0x72')](_0x32785f);}})[_0x31f1('0x28')](function(_0x2ea11e){if(_0x2ea11e){_0x26ad8d=_0x2ea11e['length'];if(!_0x958c9[_0x31f1('0x32')]['hasOwnProperty']('nolimit')){_0x32785f[_0x31f1('0x1e')]=qs[_0x31f1('0x1e')](_0x958c9[_0x31f1('0x32')][_0x31f1('0x1e')]);_0x32785f[_0x31f1('0x21')]=qs[_0x31f1('0x21')](_0x958c9['query']['offset']);}return _0x20c2eb['getSounds'](_0x32785f);}})['then'](function(_0x4277eb){if(_0x4277eb){return _0x4277eb?{'count':_0x26ad8d,'rows':_0x4277eb}:null;}})[_0x31f1('0x28')](respondWithResult(_0x42635b,null))[_0x31f1('0x48')](handleError(_0x42635b,null));}; \ No newline at end of file +var _0x18e2=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','then','destroy','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','options','findAll','rows','catch','show','params','keys','length','includeAll','find','update','body','create','sequelize','transaction','mode','files','join','root','server/files/moh','mkdirSync','directory','0777','get','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','message','addSound','Sound','findOne','save_name','createdAt','server/files/sounds/converted','format','%s.%s','basename','converted_format','symlinkSync','id2','Sequelize','ValidationError','getSounds','order','filter'];(function(_0x4599b6,_0x40c254){var _0x2e014c=function(_0x3c4d90){while(--_0x3c4d90){_0x4599b6['push'](_0x4599b6['shift']());}};_0x2e014c(++_0x40c254);}(_0x18e2,0x71));var _0x218e=function(_0x3db9b7,_0x1da6eb){_0x3db9b7=_0x3db9b7-0x0;var _0x5e3911=_0x18e2[_0x3db9b7];return _0x5e3911;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x218e('0x0'));var zipdir=require(_0x218e('0x1'));var jsonpatch=require(_0x218e('0x2'));var rp=require(_0x218e('0x3'));var moment=require('moment');var BPromise=require(_0x218e('0x4'));var Mustache=require(_0x218e('0x5'));var util=require(_0x218e('0x6'));var path=require(_0x218e('0x7'));var sox=require('sox');var csv=require(_0x218e('0x8'));var ejs=require(_0x218e('0x9'));var fs=require('fs');var fs_extra=require(_0x218e('0xa'));var _=require(_0x218e('0xb'));var squel=require(_0x218e('0xc'));var crypto=require(_0x218e('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x218e('0x8'));var querystring=require(_0x218e('0xe'));var Papa=require(_0x218e('0xf'));var Redis=require('ioredis');var authService=require(_0x218e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x218e('0x11'));var hardwareService=require(_0x218e('0x12'));var logger=require(_0x218e('0x13'))(_0x218e('0x14'));var utils=require(_0x218e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x218e('0x16'));var db=require(_0x218e('0x17'))['db'];function respondWithStatusCode(_0x5494c7,_0x1f9234){_0x1f9234=_0x1f9234||0xcc;return function(_0x311a88){if(_0x311a88){return _0x5494c7[_0x218e('0x18')](_0x1f9234);}return _0x5494c7[_0x218e('0x19')](_0x1f9234)[_0x218e('0x1a')]();};}function respondWithResult(_0xbbce20,_0x53effc){_0x53effc=_0x53effc||0xc8;return function(_0x40d173){if(_0x40d173){return _0xbbce20[_0x218e('0x19')](_0x53effc)[_0x218e('0x1b')](_0x40d173);}};}function respondWithFilteredResult(_0x3698c0,_0x20bd2a){return function(_0x4e9f74){if(_0x4e9f74){var _0x46c8ee=typeof _0x20bd2a[_0x218e('0x1c')]==='undefined'&&typeof _0x20bd2a[_0x218e('0x1d')]===_0x218e('0x1e');var _0x35da6a=_0x4e9f74[_0x218e('0x1f')];var _0x22e9d0=_0x46c8ee?0x0:_0x20bd2a[_0x218e('0x1c')];var _0xb73503=_0x46c8ee?_0x4e9f74['count']:_0x20bd2a[_0x218e('0x1c')]+_0x20bd2a['limit'];var _0x224696;if(_0xb73503>=_0x35da6a){_0xb73503=_0x35da6a;_0x224696=0xc8;}else{_0x224696=0xce;}_0x3698c0['status'](_0x224696);return _0x3698c0[_0x218e('0x20')](_0x218e('0x21'),_0x22e9d0+'-'+_0xb73503+'/'+_0x35da6a)[_0x218e('0x1b')](_0x4e9f74);}return null;};}function patchUpdates(_0x1ac792){return function(_0x9d06ec){try{jsonpatch['apply'](_0x9d06ec,_0x1ac792,!![]);}catch(_0x1f9b49){return BPromise['reject'](_0x1f9b49);}return _0x9d06ec[_0x218e('0x22')]();};}function saveUpdates(_0x3ccb70,_0x2f5c22){return function(_0x2286e3){if(_0x2286e3){return _0x2286e3['update'](_0x3ccb70)[_0x218e('0x23')](function(_0x3b2ce2){return _0x3b2ce2;});}return null;};}function removeEntity(_0x9b4a84,_0x34c95c){return function(_0x336acf){if(_0x336acf){return _0x336acf[_0x218e('0x24')]()[_0x218e('0x23')](function(){var _0x220b7a=_0x336acf['get']({'plain':!![]});var _0x27435a=_0x218e('0x25');return db[_0x218e('0x26')]['destroy']({'where':{'type':_0x27435a,'resourceId':_0x220b7a['id']}})[_0x218e('0x23')](function(){return _0x336acf;});})[_0x218e('0x23')](function(){_0x9b4a84[_0x218e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58c10b,_0x18f824){return function(_0x21dca5){if(!_0x21dca5){_0x58c10b['sendStatus'](0x194);}return _0x21dca5;};}function handleError(_0x241071,_0x37ef4e){_0x37ef4e=_0x37ef4e||0x1f4;return function(_0x372e8f){logger[_0x218e('0x27')](_0x372e8f[_0x218e('0x28')]);if(_0x372e8f[_0x218e('0x29')]){delete _0x372e8f['name'];}_0x241071[_0x218e('0x19')](_0x37ef4e)[_0x218e('0x2a')](_0x372e8f);};}exports[_0x218e('0x2b')]=function(_0x220f6a,_0x13ab0a){var _0x38da93={},_0x4c79bc={},_0x420740={'count':0x0,'rows':[]};var _0x1e9026=_[_0x218e('0x2c')](db[_0x218e('0x2d')][_0x218e('0x2e')],function(_0x16bd45){return{'name':_0x16bd45[_0x218e('0x2f')],'type':_0x16bd45[_0x218e('0x30')][_0x218e('0x31')]};});_0x4c79bc[_0x218e('0x32')]=_['map'](_0x1e9026,'name');_0x4c79bc[_0x218e('0x33')]=_['keys'](_0x220f6a['query']);_0x4c79bc['filters']=_[_0x218e('0x34')](_0x4c79bc[_0x218e('0x32')],_0x4c79bc[_0x218e('0x33')]);_0x38da93[_0x218e('0x35')]=_[_0x218e('0x34')](_0x4c79bc[_0x218e('0x32')],qs[_0x218e('0x36')](_0x220f6a['query'][_0x218e('0x36')]));_0x38da93[_0x218e('0x35')]=_0x38da93[_0x218e('0x35')]['length']?_0x38da93['attributes']:_0x4c79bc[_0x218e('0x32')];if(!_0x220f6a['query'][_0x218e('0x37')](_0x218e('0x38'))){_0x38da93[_0x218e('0x1d')]=qs[_0x218e('0x1d')](_0x220f6a[_0x218e('0x33')][_0x218e('0x1d')]);_0x38da93[_0x218e('0x1c')]=qs[_0x218e('0x1c')](_0x220f6a[_0x218e('0x33')]['offset']);}_0x38da93['order']=qs[_0x218e('0x39')](_0x220f6a[_0x218e('0x33')]['sort']);delete _0x220f6a[_0x218e('0x33')]['sort'];_0x38da93[_0x218e('0x3a')]=qs[_0x218e('0x3b')](_[_0x218e('0x3c')](_0x220f6a['query'],_0x4c79bc[_0x218e('0x3b')]),_0x1e9026);if(_0x220f6a['query']['filter']){_0x38da93[_0x218e('0x3a')]=_[_0x218e('0x3d')](_0x38da93['where'],{'$or':_['map'](_0x1e9026,function(_0x406a40){if(_0x406a40[_0x218e('0x30')]!=='VIRTUAL'){var _0x147f27={};_0x147f27[_0x406a40['name']]={'$like':'%'+_0x220f6a[_0x218e('0x33')]['filter']+'%'};return _0x147f27;}})});}_0x38da93=_['merge']({},_0x38da93,_0x220f6a[_0x218e('0x3e')]);var _0x22c29c={'where':_0x38da93[_0x218e('0x3a')]};return db[_0x218e('0x2d')][_0x218e('0x1f')](_0x22c29c)[_0x218e('0x23')](function(_0x5c9fa0){_0x420740[_0x218e('0x1f')]=_0x5c9fa0;if(_0x220f6a[_0x218e('0x33')]['includeAll']){_0x38da93['include']=[{'all':!![]}];}return db[_0x218e('0x2d')][_0x218e('0x3f')](_0x38da93);})[_0x218e('0x23')](function(_0x41da36){_0x420740[_0x218e('0x40')]=_0x41da36;return _0x420740;})[_0x218e('0x23')](respondWithFilteredResult(_0x13ab0a,_0x38da93))[_0x218e('0x41')](handleError(_0x13ab0a,null));};exports[_0x218e('0x42')]=function(_0x1bb940,_0x102a1f){var _0x371e7d={'raw':![],'where':{'id':_0x1bb940[_0x218e('0x43')]['id']}},_0x46c67e={};_0x46c67e[_0x218e('0x32')]=_[_0x218e('0x44')](db['VoiceMusicOnHold']['rawAttributes']);_0x46c67e[_0x218e('0x33')]=_[_0x218e('0x44')](_0x1bb940['query']);_0x46c67e[_0x218e('0x3b')]=_[_0x218e('0x34')](_0x46c67e[_0x218e('0x32')],_0x46c67e[_0x218e('0x33')]);_0x371e7d[_0x218e('0x35')]=_[_0x218e('0x34')](_0x46c67e[_0x218e('0x32')],qs[_0x218e('0x36')](_0x1bb940[_0x218e('0x33')][_0x218e('0x36')]));_0x371e7d[_0x218e('0x35')]=_0x371e7d[_0x218e('0x35')][_0x218e('0x45')]?_0x371e7d['attributes']:_0x46c67e[_0x218e('0x32')];if(_0x1bb940[_0x218e('0x33')][_0x218e('0x46')]){_0x371e7d['include']=[{'all':!![]}];}_0x371e7d=_[_0x218e('0x3d')]({},_0x371e7d,_0x1bb940[_0x218e('0x3e')]);return db['VoiceMusicOnHold'][_0x218e('0x47')](_0x371e7d)[_0x218e('0x23')](handleEntityNotFound(_0x102a1f,null))[_0x218e('0x23')](respondWithResult(_0x102a1f,null))[_0x218e('0x41')](handleError(_0x102a1f,null));};exports[_0x218e('0x48')]=function(_0x538b25,_0x292c78){if(_0x538b25[_0x218e('0x49')]['id']){delete _0x538b25[_0x218e('0x49')]['id'];}return db[_0x218e('0x2d')]['find']({'where':{'id':_0x538b25['params']['id']}})[_0x218e('0x23')](handleEntityNotFound(_0x292c78,null))['then'](saveUpdates(_0x538b25['body'],null))[_0x218e('0x23')](respondWithResult(_0x292c78,null))[_0x218e('0x41')](handleError(_0x292c78,null));};exports[_0x218e('0x4a')]=function(_0x52a911,_0x53f1e5,_0x5c92ce){return db[_0x218e('0x4b')][_0x218e('0x4c')](function(_0x4b4299){if(_0x52a911[_0x218e('0x49')][_0x218e('0x4d')]===_0x218e('0x4e')){_0x52a911[_0x218e('0x49')]['directory']=path[_0x218e('0x4f')](config[_0x218e('0x50')],_0x218e('0x51'),_0x52a911[_0x218e('0x49')]['name']);}return db[_0x218e('0x2d')][_0x218e('0x4a')](_0x52a911[_0x218e('0x49')],{'transaction':_0x4b4299})[_0x218e('0x23')](function(_0xd7548c){if(_0x52a911[_0x218e('0x49')][_0x218e('0x4d')]==='files'){fs[_0x218e('0x52')](_0xd7548c[_0x218e('0x53')],parseInt(_0x218e('0x54'),0x8));}var _0x432593=_0x52a911['user'][_0x218e('0x55')]({'plain':!![]});if(!_0x432593)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x432593[_0x218e('0x56')]===_0x218e('0x57')){var _0x5b1646=_0xd7548c[_0x218e('0x55')]({'plain':!![]});return db[_0x218e('0x58')][_0x218e('0x47')]({'where':{'name':'MusicOnHolds','userProfileId':_0x432593['userProfileId']},'raw':!![]})[_0x218e('0x23')](function(_0x501dbe){if(_0x501dbe&&_0x501dbe[_0x218e('0x59')]===0x0){return db['UserProfileResource'][_0x218e('0x4a')]({'name':_0x5b1646[_0x218e('0x29')],'resourceId':_0x5b1646['id'],'type':_0x501dbe[_0x218e('0x29')],'sectionId':_0x501dbe['id']},{})[_0x218e('0x23')](function(){return _0xd7548c;});}else{return _0xd7548c;}})[_0x218e('0x41')](function(_0x1a59c7){logger['error'](_0x218e('0x5a'),_0x1a59c7);});}return _0xd7548c;});})['then'](respondWithResult(_0x53f1e5,0xc9))['catch'](handleError(_0x53f1e5,null));};exports[_0x218e('0x24')]=function(_0x20d462,_0x561675,_0x5e5fc1){var _0x5c3d75;return db[_0x218e('0x2d')]['find']({'where':{'id':_0x20d462['params']['id']}})[_0x218e('0x23')](function(_0x1e91a4){if(_0x1e91a4){return db[_0x218e('0x4b')][_0x218e('0x4c')](function(_0x5c3540){return _0x1e91a4[_0x218e('0x24')]({'transaction':_0x5c3540,'raw':!![]})[_0x218e('0x23')](function(_0x5db0b5){if(_0x5db0b5[_0x218e('0x53')]){fs[_0x218e('0x5b')](_0x5db0b5[_0x218e('0x53')])[_0x218e('0x5c')](function(_0x5399c9){fs[_0x218e('0x5d')](path['join'](_0x5db0b5['directory'],_0x5399c9));});fs[_0x218e('0x5e')](_0x5db0b5['directory']);}return _0x5db0b5;});})[_0x218e('0x41')](function(_0x308ab1){throw new db['Sequelize']['ValidationError'](_0x308ab1[_0x218e('0x5f')]);});}})[_0x218e('0x23')](handleEntityNotFound(_0x561675,null))[_0x218e('0x23')](removeEntity(_0x561675,null))[_0x218e('0x41')](handleError(_0x561675,null));};exports[_0x218e('0x60')]=function(_0x20e918,_0x476d33,_0x281cb6){return db['sequelize'][_0x218e('0x4c')](function(_0x42212f){var _0x24920f;return db[_0x218e('0x2d')][_0x218e('0x47')]({'where':{'id':_0x20e918[_0x218e('0x43')]['id']}})[_0x218e('0x23')](function(_0x4593f9){if(_0x4593f9){_0x24920f=_0x4593f9;return _0x4593f9[_0x218e('0x60')](_0x20e918[_0x218e('0x49')]['id'],{'transaction':_0x42212f});}})[_0x218e('0x23')](function(_0x5d3cb2){if(_0x5d3cb2){return db[_0x218e('0x61')][_0x218e('0x62')]({'where':{'id':_0x20e918['body']['id']},'attributes':['id',_0x218e('0x29'),_0x218e('0x63'),'converted_format',_0x218e('0x64')],'raw':!![]});}})[_0x218e('0x23')](function(_0x1c4d6b){if(_0x1c4d6b){var _0x5e4201=path[_0x218e('0x4f')](config[_0x218e('0x50')],_0x218e('0x65'),util[_0x218e('0x66')](_0x218e('0x67'),path[_0x218e('0x68')](_0x1c4d6b[_0x218e('0x63')],path['extname'](_0x1c4d6b[_0x218e('0x63')])),_0x1c4d6b[_0x218e('0x69')]));var _0x1c940b=path[_0x218e('0x4f')](config[_0x218e('0x50')],_0x218e('0x51'),_0x24920f[_0x218e('0x29')],util[_0x218e('0x66')](_0x218e('0x67'),_0x1c4d6b[_0x218e('0x29')],_0x1c4d6b[_0x218e('0x69')]));fs[_0x218e('0x6a')](_0x5e4201,_0x1c940b);return _0x1c4d6b;}})[_0x218e('0x41')](function(_0x5ccec8){throw new db['Sequelize']['ValidationError'](_0x5ccec8[_0x218e('0x5f')]);});})[_0x218e('0x23')](handleEntityNotFound(_0x476d33,null))[_0x218e('0x23')](respondWithResult(_0x476d33,0xc9))[_0x218e('0x41')](handleError(_0x476d33,null));};exports['removeSound']=function(_0x1d8a0c,_0x150c88,_0xb1106d){return db[_0x218e('0x4b')][_0x218e('0x4c')](function(_0x33aad1){var _0x189e45;return db[_0x218e('0x2d')][_0x218e('0x62')]({'where':{'id':_0x1d8a0c['params']['id']}})[_0x218e('0x23')](handleEntityNotFound(_0x150c88,null))[_0x218e('0x23')](function(_0x49c4f4){if(_0x49c4f4){_0x189e45=_0x49c4f4;return _0x49c4f4['removeSound'](_0x1d8a0c[_0x218e('0x43')]['id2']);}})['then'](function(_0x5d67d6){if(_0x5d67d6){return db[_0x218e('0x61')][_0x218e('0x62')]({'where':{'id':_0x1d8a0c[_0x218e('0x43')][_0x218e('0x6b')]},'attributes':['id',_0x218e('0x29'),_0x218e('0x63'),_0x218e('0x69'),_0x218e('0x64')],'raw':!![]});}})[_0x218e('0x23')](function(_0x7d5d3a){if(_0x7d5d3a){fs[_0x218e('0x5d')](path[_0x218e('0x4f')](_0x189e45['directory'],util[_0x218e('0x66')]('%s.%s',_0x7d5d3a[_0x218e('0x29')],_0x7d5d3a['converted_format'])));return _0x7d5d3a;}})['catch'](function(_0xc8a0a5){throw new db[(_0x218e('0x6c'))][(_0x218e('0x6d'))](_0xc8a0a5[_0x218e('0x5f')]);});})[_0x218e('0x23')](handleEntityNotFound(_0x150c88,null))[_0x218e('0x23')](respondWithStatusCode(_0x150c88,0xcc))[_0x218e('0x41')](handleError(_0x150c88,null));};exports[_0x218e('0x6e')]=function(_0x3ef13b,_0x2b0c05,_0x428d4a){var _0x52a3c7={};var _0x2746ff={};var _0x5e85f1;var _0xb0371f;return db['VoiceMusicOnHold'][_0x218e('0x62')]({'where':{'id':_0x3ef13b[_0x218e('0x43')]['id']}})[_0x218e('0x23')](handleEntityNotFound(_0x2b0c05,null))[_0x218e('0x23')](function(_0x28609f){if(_0x28609f){_0x5e85f1=_0x28609f;_0x2746ff[_0x218e('0x32')]=_['keys'](db[_0x218e('0x61')][_0x218e('0x2e')]);_0x2746ff[_0x218e('0x33')]=_[_0x218e('0x44')](_0x3ef13b[_0x218e('0x33')]);_0x2746ff[_0x218e('0x3b')]=_[_0x218e('0x34')](_0x2746ff['model'],_0x2746ff[_0x218e('0x33')]);_0x52a3c7[_0x218e('0x35')]=_[_0x218e('0x34')](_0x2746ff[_0x218e('0x32')],qs['fields'](_0x3ef13b[_0x218e('0x33')][_0x218e('0x36')]));_0x52a3c7[_0x218e('0x35')]=_0x52a3c7['attributes'][_0x218e('0x45')]?_0x52a3c7[_0x218e('0x35')]:_0x2746ff[_0x218e('0x32')];_0x52a3c7[_0x218e('0x6f')]=qs[_0x218e('0x39')](_0x3ef13b[_0x218e('0x33')]['sort']);_0x52a3c7[_0x218e('0x3a')]=qs['filters'](_[_0x218e('0x3c')](_0x3ef13b[_0x218e('0x33')],_0x2746ff['filters']));if(_0x3ef13b[_0x218e('0x33')][_0x218e('0x70')]){_0x52a3c7[_0x218e('0x3a')]=_[_0x218e('0x3d')](_0x52a3c7[_0x218e('0x3a')],{'$or':_[_0x218e('0x2c')](_0x52a3c7[_0x218e('0x35')],function(_0x4237ee){var _0x2d7cb2={};_0x2d7cb2[_0x4237ee]={'$like':'%'+_0x3ef13b['query'][_0x218e('0x70')]+'%'};return _0x2d7cb2;})});}_0x52a3c7=_[_0x218e('0x3d')]({},_0x52a3c7,_0x3ef13b[_0x218e('0x3e')]);return _0x5e85f1['getSounds'](_0x52a3c7);}})[_0x218e('0x23')](function(_0x53f456){if(_0x53f456){_0xb0371f=_0x53f456[_0x218e('0x45')];if(!_0x3ef13b['query']['hasOwnProperty'](_0x218e('0x38'))){_0x52a3c7[_0x218e('0x1d')]=qs[_0x218e('0x1d')](_0x3ef13b[_0x218e('0x33')][_0x218e('0x1d')]);_0x52a3c7['offset']=qs[_0x218e('0x1c')](_0x3ef13b['query']['offset']);}return _0x5e85f1[_0x218e('0x6e')](_0x52a3c7);}})[_0x218e('0x23')](function(_0x4d72dc){if(_0x4d72dc){return _0x4d72dc?{'count':_0xb0371f,'rows':_0x4d72dc}:null;}})['then'](respondWithResult(_0x2b0c05,null))[_0x218e('0x41')](handleError(_0x2b0c05,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 30c9548..d7b5af4 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 _0x559b=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','exports','voice_musiconhold','util'];(function(_0x19106a,_0x24b42f){var _0x50c4d8=function(_0x14b498){while(--_0x14b498){_0x19106a['push'](_0x19106a['shift']());}};_0x50c4d8(++_0x24b42f);}(_0x559b,0x171));var _0xb559=function(_0x59b760,_0x2f009b){_0x59b760=_0x59b760-0x0;var _0x357ffe=_0x559b[_0x59b760];return _0x357ffe;};'use strict';var _=require('lodash');var util=require(_0xb559('0x0'));var logger=require(_0xb559('0x1'))('api');var moment=require(_0xb559('0x2'));var BPromise=require(_0xb559('0x3'));var rp=require(_0xb559('0x4'));var fs=require('fs');var path=require(_0xb559('0x5'));var rimraf=require('rimraf');var config=require(_0xb559('0x6'));var attributes=require(_0xb559('0x7'));module[_0xb559('0x8')]=function(_0x586147,_0xd80ddc){return _0x586147['define']('VoiceMusicOnHold',attributes,{'tableName':_0xb559('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326b=['util','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','VoiceMusicOnHold','voice_musiconhold','lodash'];(function(_0x631596,_0x3719ee){var _0x4ab5c9=function(_0x4a1c35){while(--_0x4a1c35){_0x631596['push'](_0x631596['shift']());}};_0x4ab5c9(++_0x3719ee);}(_0x326b,0xd7));var _0xb326=function(_0x4f9d26,_0x641341){_0x4f9d26=_0x4f9d26-0x0;var _0x57debc=_0x326b[_0x4f9d26];return _0x57debc;};'use strict';var _=require(_0xb326('0x0'));var util=require(_0xb326('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb326('0x2'));var fs=require('fs');var path=require(_0xb326('0x3'));var rimraf=require(_0xb326('0x4'));var config=require(_0xb326('0x5'));var attributes=require(_0xb326('0x6'));module['exports']=function(_0x178bb7,_0x3d5ddc){return _0x178bb7['define'](_0xb326('0x7'),attributes,{'tableName':_0xb326('0x8'),'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 b51fd25..71f6543 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 _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x330c02,_0x32d146){var _0x572de6=function(_0x4a1644){while(--_0x4a1644){_0x330c02['push'](_0x330c02['shift']());}};_0x572de6(++_0x32d146);}(_0x70e0,0x17b));var _0x070e=function(_0x11246c,_0x138513){_0x11246c=_0x11246c-0x0;var _0x3f7802=_0x70e0[_0x11246c];return _0x3f7802;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5dd3a1,_0xe30ace){var _0x39eff0=function(_0x2d3b54){while(--_0x2d3b54){_0x5dd3a1['push'](_0x5dd3a1['shift']());}};_0x39eff0(++_0xe30ace);}(_0x70e0,0x17b));var _0x070e=function(_0xf11512,_0x5d16ce){_0xf11512=_0xf11512-0x0;var _0x546bc=_0x70e0[_0xf11512];return _0x546bc;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index c3e6a77..8b168c9 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 _0x4d33=['isAuthenticated','/describe','describe','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','update','/:id','destroy','delete','removeAgents','removeTeams','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get'];(function(_0x236a60,_0x51efc2){var _0x3310ff=function(_0x5262a9){while(--_0x5262a9){_0x236a60['push'](_0x236a60['shift']());}};_0x3310ff(++_0x51efc2);}(_0x4d33,0x1cc));var _0x34d3=function(_0x1f7413,_0x3388c3){_0x1f7413=_0x1f7413-0x0;var _0x2d2775=_0x4d33[_0x1f7413];return _0x2d2775;};'use strict';var multer=require('multer');var util=require(_0x34d3('0x0'));var path=require('path');var timeout=require(_0x34d3('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x34d3('0x2'));var auth=require(_0x34d3('0x3'));var interaction=require(_0x34d3('0x4'));var config=require(_0x34d3('0x5'));var controller=require(_0x34d3('0x6'));router[_0x34d3('0x7')]('/',auth[_0x34d3('0x8')](),controller['index']);router[_0x34d3('0x7')](_0x34d3('0x9'),auth[_0x34d3('0x8')](),controller[_0x34d3('0xa')]);router['get']('/:id',auth[_0x34d3('0x8')](),controller['show']);router[_0x34d3('0x7')](_0x34d3('0xb'),auth['isAuthenticated'](),controller[_0x34d3('0xc')]);router[_0x34d3('0x7')](_0x34d3('0xd'),auth[_0x34d3('0x8')](),controller[_0x34d3('0xe')]);router[_0x34d3('0xf')]('/',auth['isAuthenticated'](),controller[_0x34d3('0x10')]);router[_0x34d3('0xf')](_0x34d3('0xb'),auth[_0x34d3('0x8')](),controller[_0x34d3('0x11')]);router[_0x34d3('0xf')]('/:id/teams',auth['isAuthenticated'](),controller[_0x34d3('0x12')]);router['put']('/:id',auth[_0x34d3('0x8')](),controller[_0x34d3('0x13')]);router['delete'](_0x34d3('0x14'),auth['isAuthenticated'](),controller[_0x34d3('0x15')]);router[_0x34d3('0x16')]('/:id/users',auth[_0x34d3('0x8')](),controller[_0x34d3('0x17')]);router[_0x34d3('0x16')](_0x34d3('0xd'),auth['isAuthenticated'](),controller[_0x34d3('0x18')]);module[_0x34d3('0x19')]=router; \ No newline at end of file +var _0x2c46=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addTeams','destroy','delete','removeAgents','removeTeams','exports','util','path','connect-timeout','express','Router'];(function(_0x1c26ea,_0x20eff2){var _0x1aa800=function(_0x39627c){while(--_0x39627c){_0x1c26ea['push'](_0x1c26ea['shift']());}};_0x1aa800(++_0x20eff2);}(_0x2c46,0x6f));var _0x62c4=function(_0x2dde07,_0x41469b){_0x2dde07=_0x2dde07-0x0;var _0x5de09d=_0x2c46[_0x2dde07];return _0x5de09d;};'use strict';var multer=require('multer');var util=require(_0x62c4('0x0'));var path=require(_0x62c4('0x1'));var timeout=require(_0x62c4('0x2'));var express=require(_0x62c4('0x3'));var router=express[_0x62c4('0x4')]();var fs_extra=require(_0x62c4('0x5'));var auth=require(_0x62c4('0x6'));var interaction=require(_0x62c4('0x7'));var config=require(_0x62c4('0x8'));var controller=require(_0x62c4('0x9'));router[_0x62c4('0xa')]('/',auth[_0x62c4('0xb')](),controller[_0x62c4('0xc')]);router[_0x62c4('0xa')](_0x62c4('0xd'),auth[_0x62c4('0xb')](),controller[_0x62c4('0xe')]);router['get'](_0x62c4('0xf'),auth['isAuthenticated'](),controller[_0x62c4('0x10')]);router['get'](_0x62c4('0x11'),auth[_0x62c4('0xb')](),controller[_0x62c4('0x12')]);router[_0x62c4('0xa')](_0x62c4('0x13'),auth[_0x62c4('0xb')](),controller[_0x62c4('0x14')]);router[_0x62c4('0x15')]('/',auth[_0x62c4('0xb')](),controller[_0x62c4('0x16')]);router[_0x62c4('0x15')](_0x62c4('0x11'),auth['isAuthenticated'](),controller['addAgents']);router[_0x62c4('0x15')](_0x62c4('0x13'),auth[_0x62c4('0xb')](),controller[_0x62c4('0x17')]);router['put'](_0x62c4('0xf'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x62c4('0x18')]);router[_0x62c4('0x19')](_0x62c4('0x11'),auth[_0x62c4('0xb')](),controller[_0x62c4('0x1a')]);router[_0x62c4('0x19')](_0x62c4('0x13'),auth[_0x62c4('0xb')](),controller[_0x62c4('0x1b')]);module[_0x62c4('0x1c')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 4df391e..5ff5717 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 _0xb299=['exports','STRING','name','VIRTUAL','system-','getDataValue','INTEGER','sequelize'];(function(_0x4c4af3,_0x254758){var _0x5d1ce9=function(_0x15ad81){while(--_0x15ad81){_0x4c4af3['push'](_0x4c4af3['shift']());}};_0x5d1ce9(++_0x254758);}(_0xb299,0x1b7));var _0x9b29=function(_0x3fb2c2,_0xc568ab){_0x3fb2c2=_0x3fb2c2-0x0;var _0x361f64=_0xb299[_0x3fb2c2];return _0x361f64;};'use strict';var Sequelize=require(_0x9b29('0x0'));module[_0x9b29('0x1')]={'name':{'type':Sequelize[_0x9b29('0x2')],'allowNull':![],'unique':_0x9b29('0x3')},'prefix':{'type':Sequelize[_0x9b29('0x4')],'get':function(_0x5d51c2){return _0x9b29('0x5')+this[_0x9b29('0x6')](_0x9b29('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x9b29('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x9b29('0x7')]}}; \ No newline at end of file +var _0x0ca0=['INTEGER','sequelize','exports','STRING','name','VIRTUAL'];(function(_0x596e76,_0x25d38b){var _0x9829fd=function(_0x3201dd){while(--_0x3201dd){_0x596e76['push'](_0x596e76['shift']());}};_0x9829fd(++_0x25d38b);}(_0x0ca0,0x12d));var _0x00ca=function(_0x274ec1,_0x42da60){_0x274ec1=_0x274ec1-0x0;var _0x3ea453=_0x0ca0[_0x274ec1];return _0x3ea453;};'use strict';var Sequelize=require(_0x00ca('0x0'));module[_0x00ca('0x1')]={'name':{'type':Sequelize[_0x00ca('0x2')],'allowNull':![],'unique':_0x00ca('0x3')},'prefix':{'type':Sequelize[_0x00ca('0x4')],'get':function(_0x2a2206){return'system-'+this['getDataValue'](_0x00ca('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x00ca('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x00ca('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 6b67a5e..1321a4a 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 _0x3266=['index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','describe','create','transaction','body','get','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','context','${EXTEN:','charAt','findById','addAgents','emit','userVoicePrefix:save','ids','removeAgents','isArray','userVoicePrefix:remove','findOne','User','order','getAgents','getTeams','Team','interface','Agents','addTeams','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','VoicePrefixes','UserProfileResource','destroy','error','name'];(function(_0x2e819c,_0x3f99a5){var _0x24e271=function(_0x27d596){while(--_0x27d596){_0x2e819c['push'](_0x2e819c['shift']());}};_0x24e271(++_0x3f99a5);}(_0x3266,0x6a));var _0x6326=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x3266[_0x3511d3];return _0x5d6321;};'use strict';var emlformat=require(_0x6326('0x0'));var rimraf=require(_0x6326('0x1'));var zipdir=require(_0x6326('0x2'));var jsonpatch=require(_0x6326('0x3'));var rp=require(_0x6326('0x4'));var moment=require(_0x6326('0x5'));var BPromise=require(_0x6326('0x6'));var Mustache=require(_0x6326('0x7'));var util=require(_0x6326('0x8'));var path=require('path');var sox=require(_0x6326('0x9'));var csv=require('to-csv');var ejs=require(_0x6326('0xa'));var fs=require('fs');var fs_extra=require(_0x6326('0xb'));var _=require(_0x6326('0xc'));var squel=require('squel');var crypto=require(_0x6326('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6326('0xe'));var toCsv=require(_0x6326('0xf'));var querystring=require(_0x6326('0x10'));var Papa=require(_0x6326('0x11'));var Redis=require(_0x6326('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6326('0x13'));var as=require(_0x6326('0x14'));var hardwareService=require(_0x6326('0x15'));var logger=require(_0x6326('0x16'))(_0x6326('0x17'));var utils=require(_0x6326('0x18'));var config=require(_0x6326('0x19'));var licenseUtil=require(_0x6326('0x1a'));var db=require(_0x6326('0x1b'))['db'];config[_0x6326('0x1c')]=_['defaults'](config['redis'],{'host':_0x6326('0x1d'),'port':0x18eb});var socket=require(_0x6326('0x1e'))(new Redis(config['redis']));require(_0x6326('0x1f'))['register'](socket);function respondWithStatusCode(_0x2d2d9b,_0x20dcc6){_0x20dcc6=_0x20dcc6||0xcc;return function(_0x3d6ac0){if(_0x3d6ac0){return _0x2d2d9b[_0x6326('0x20')](_0x20dcc6);}return _0x2d2d9b[_0x6326('0x21')](_0x20dcc6)[_0x6326('0x22')]();};}function respondWithResult(_0x55923a,_0x1104c5){_0x1104c5=_0x1104c5||0xc8;return function(_0x518e6f){if(_0x518e6f){return _0x55923a['status'](_0x1104c5)['json'](_0x518e6f);}};}function respondWithFilteredResult(_0x51e7b9,_0x5d402d){return function(_0x58e960){if(_0x58e960){var _0xdf5ced=typeof _0x5d402d[_0x6326('0x23')]===_0x6326('0x24')&&typeof _0x5d402d['limit']==='undefined';var _0x954ed5=_0x58e960[_0x6326('0x25')];var _0x272b5c=_0xdf5ced?0x0:_0x5d402d[_0x6326('0x23')];var _0x3c08db=_0xdf5ced?_0x58e960[_0x6326('0x25')]:_0x5d402d[_0x6326('0x23')]+_0x5d402d['limit'];var _0x22307f;if(_0x3c08db>=_0x954ed5){_0x3c08db=_0x954ed5;_0x22307f=0xc8;}else{_0x22307f=0xce;}_0x51e7b9['status'](_0x22307f);return _0x51e7b9[_0x6326('0x26')](_0x6326('0x27'),_0x272b5c+'-'+_0x3c08db+'/'+_0x954ed5)[_0x6326('0x28')](_0x58e960);}return null;};}function patchUpdates(_0x24fb78){return function(_0x43cdfc){try{jsonpatch[_0x6326('0x29')](_0x43cdfc,_0x24fb78,!![]);}catch(_0x225555){return BPromise[_0x6326('0x2a')](_0x225555);}return _0x43cdfc[_0x6326('0x2b')]();};}function saveUpdates(_0x2d0d00,_0x34954b){return function(_0x4933e1){if(_0x4933e1){return _0x4933e1[_0x6326('0x2c')](_0x2d0d00)[_0x6326('0x2d')](function(_0x575701){return _0x575701;});}return null;};}function removeEntity(_0x4e272b,_0x4d28fd){return function(_0x405474){if(_0x405474){return _0x405474['destroy']()[_0x6326('0x2d')](function(){var _0x1a48da=_0x405474['get']({'plain':!![]});var _0x15e33d=_0x6326('0x2e');return db[_0x6326('0x2f')][_0x6326('0x30')]({'where':{'type':_0x15e33d,'resourceId':_0x1a48da['id']}})[_0x6326('0x2d')](function(){return _0x405474;});})[_0x6326('0x2d')](function(){_0x4e272b[_0x6326('0x21')](0xcc)[_0x6326('0x22')]();});}};}function handleEntityNotFound(_0x461e0f,_0x127744){return function(_0x4980f6){if(!_0x4980f6){_0x461e0f[_0x6326('0x20')](0x194);}return _0x4980f6;};}function handleError(_0x331772,_0x134524){_0x134524=_0x134524||0x1f4;return function(_0x2e0445){logger[_0x6326('0x31')](_0x2e0445['stack']);if(_0x2e0445[_0x6326('0x32')]){delete _0x2e0445[_0x6326('0x32')];}_0x331772[_0x6326('0x21')](_0x134524)['send'](_0x2e0445);};}exports[_0x6326('0x33')]=function(_0x4d7807,_0x4e703a){var _0xfb6b62={},_0x7ac8d9={},_0x160a12={'count':0x0,'rows':[]};var _0x103b1c=_[_0x6326('0x34')](db[_0x6326('0x35')][_0x6326('0x36')],function(_0x46c803){return{'name':_0x46c803[_0x6326('0x37')],'type':_0x46c803[_0x6326('0x38')][_0x6326('0x39')]};});_0x7ac8d9[_0x6326('0x3a')]=_['map'](_0x103b1c,_0x6326('0x32'));_0x7ac8d9[_0x6326('0x3b')]=_['keys'](_0x4d7807[_0x6326('0x3b')]);_0x7ac8d9[_0x6326('0x3c')]=_[_0x6326('0x3d')](_0x7ac8d9['model'],_0x7ac8d9[_0x6326('0x3b')]);_0xfb6b62['attributes']=_['intersection'](_0x7ac8d9[_0x6326('0x3a')],qs[_0x6326('0x3e')](_0x4d7807[_0x6326('0x3b')]['fields']));_0xfb6b62[_0x6326('0x3f')]=_0xfb6b62['attributes'][_0x6326('0x40')]?_0xfb6b62['attributes']:_0x7ac8d9[_0x6326('0x3a')];if(!_0x4d7807[_0x6326('0x3b')][_0x6326('0x41')](_0x6326('0x42'))){_0xfb6b62[_0x6326('0x43')]=qs[_0x6326('0x43')](_0x4d7807['query'][_0x6326('0x43')]);_0xfb6b62[_0x6326('0x23')]=qs['offset'](_0x4d7807[_0x6326('0x3b')]['offset']);}_0xfb6b62['order']=qs[_0x6326('0x44')](_0x4d7807[_0x6326('0x3b')][_0x6326('0x44')]);_0xfb6b62[_0x6326('0x45')]=qs[_0x6326('0x3c')](_[_0x6326('0x46')](_0x4d7807['query'],_0x7ac8d9['filters']),_0x103b1c);if(_0x4d7807[_0x6326('0x3b')]['filter']){_0xfb6b62[_0x6326('0x45')]=_['merge'](_0xfb6b62[_0x6326('0x45')],{'$or':_[_0x6326('0x34')](_0x103b1c,function(_0x335feb){if(_0x335feb[_0x6326('0x38')]!==_0x6326('0x47')){var _0x1b754d={};_0x1b754d[_0x335feb[_0x6326('0x32')]]={'$like':'%'+_0x4d7807[_0x6326('0x3b')][_0x6326('0x48')]+'%'};return _0x1b754d;}})});}_0xfb6b62=_[_0x6326('0x49')]({},_0xfb6b62,_0x4d7807[_0x6326('0x4a')]);var _0x5d36b1={'where':_0xfb6b62[_0x6326('0x45')]};return db['VoicePrefix'][_0x6326('0x25')](_0x5d36b1)[_0x6326('0x2d')](function(_0x16fc33){_0x160a12[_0x6326('0x25')]=_0x16fc33;if(_0x4d7807['query'][_0x6326('0x4b')]){_0xfb6b62[_0x6326('0x4c')]=[{'all':!![]}];}return db['VoicePrefix'][_0x6326('0x4d')](_0xfb6b62);})[_0x6326('0x2d')](function(_0x7a5057){_0x160a12[_0x6326('0x4e')]=_0x7a5057;return _0x160a12;})['then'](respondWithFilteredResult(_0x4e703a,_0xfb6b62))[_0x6326('0x4f')](handleError(_0x4e703a,null));};exports[_0x6326('0x50')]=function(_0x231e15,_0x28504f){var _0x44d852={'raw':![],'where':{'id':_0x231e15[_0x6326('0x51')]['id']}},_0x165953={};_0x165953['model']=_[_0x6326('0x52')](db[_0x6326('0x35')][_0x6326('0x36')]);_0x165953[_0x6326('0x3b')]=_['keys'](_0x231e15[_0x6326('0x3b')]);_0x165953['filters']=_[_0x6326('0x3d')](_0x165953[_0x6326('0x3a')],_0x165953[_0x6326('0x3b')]);_0x44d852[_0x6326('0x3f')]=_[_0x6326('0x3d')](_0x165953['model'],qs[_0x6326('0x3e')](_0x231e15['query']['fields']));_0x44d852[_0x6326('0x3f')]=_0x44d852[_0x6326('0x3f')]['length']?_0x44d852[_0x6326('0x3f')]:_0x165953[_0x6326('0x3a')];if(_0x231e15[_0x6326('0x3b')][_0x6326('0x4b')]){_0x44d852[_0x6326('0x4c')]=[{'all':!![]}];}_0x44d852=_['merge']({},_0x44d852,_0x231e15['options']);return db[_0x6326('0x35')][_0x6326('0x53')](_0x44d852)[_0x6326('0x2d')](handleEntityNotFound(_0x28504f,null))[_0x6326('0x2d')](respondWithResult(_0x28504f,null))[_0x6326('0x4f')](handleError(_0x28504f,null));};exports[_0x6326('0x30')]=function(_0xdc4522,_0x55bcd6){return db[_0x6326('0x35')][_0x6326('0x53')]({'where':{'id':_0xdc4522[_0x6326('0x51')]['id']}})[_0x6326('0x2d')](handleEntityNotFound(_0x55bcd6,null))[_0x6326('0x2d')](removeEntity(_0x55bcd6,null))['catch'](handleError(_0x55bcd6,null));};exports[_0x6326('0x54')]=function(_0x55537a,_0x216972){return db[_0x6326('0x35')]['describe']()[_0x6326('0x2d')](respondWithResult(_0x216972,null))['catch'](handleError(_0x216972,null));};exports[_0x6326('0x55')]=function(_0x202fd3,_0x2ee8df){var _0x35400e;return db['sequelize'][_0x6326('0x56')](function(_0xbe6b3e){return db['VoicePrefix'][_0x6326('0x55')](_0x202fd3[_0x6326('0x57')],{'transaction':_0xbe6b3e})[_0x6326('0x2d')](function(_0x4a42ae){_0x35400e=_0x4a42ae[_0x6326('0x58')]({'plain':!![]});return db[_0x6326('0x59')]['find']({'where':{'id':_0x35400e[_0x6326('0x5a')]},'raw':!![]})['then'](function(_0x1f1463){return createVoicePrefixExtensions(_0x35400e,_0x1f1463,_0xbe6b3e);});});})[_0x6326('0x2d')](function(){var _0x3e9825=_0x202fd3[_0x6326('0x5b')][_0x6326('0x58')]({'plain':!![]});if(!_0x3e9825)throw new Error(_0x6326('0x5c'));if(_0x3e9825[_0x6326('0x5d')]==='user'){var _0x51adce=_0x35400e;return db['UserProfileSection'][_0x6326('0x53')]({'where':{'name':'VoicePrefixes','userProfileId':_0x3e9825[_0x6326('0x5e')]},'raw':!![]})[_0x6326('0x2d')](function(_0xcae454){if(_0xcae454&&_0xcae454[_0x6326('0x5f')]===0x0){return db[_0x6326('0x2f')]['create']({'name':_0x51adce[_0x6326('0x32')],'resourceId':_0x51adce['id'],'type':_0xcae454[_0x6326('0x32')],'sectionId':_0xcae454['id']},{})['then'](function(){return _0x35400e;});}else{return _0x35400e;}})[_0x6326('0x4f')](function(_0xdeba28){logger[_0x6326('0x31')](_0x6326('0x60'),_0xdeba28);throw _0xdeba28;});}return _0x35400e;})[_0x6326('0x2d')](respondWithResult(_0x2ee8df,null))[_0x6326('0x4f')](handleError(_0x2ee8df,null));};function Extension(_0x320d43,_0x2f624f,_0x2c7a8d,_0x37506f){this['context']=_0x6326('0x61');this[_0x6326('0x62')]=_0x320d43;this[_0x6326('0x63')]=_0x2c7a8d;this[_0x6326('0x38')]='system';this['description']=_0x6326('0x64');this[_0x6326('0x65')]=_0x2f624f;this[_0x6326('0x66')]=_0x37506f;}function createVoicePrefixExtensions(_0x10f54b,_0x3ac39d,_0x54a9eb){return new BPromise(function(_0x4cec50,_0x13fc10){var _0x447b34=new Extension(formatPrefixName(_0x10f54b[_0x6326('0x67')]),0x1,_0x6326('0x68'),'Voice\x20Prefix');_0x447b34[_0x6326('0x69')]=_0x10f54b['id'];return db[_0x6326('0x59')][_0x6326('0x55')](_0x447b34,{'transaction':_0x54a9eb})[_0x6326('0x2d')](function(_0x4197d6){var _0xc8f404=_0x4197d6['get']({'plain':!![]});var _0x2bc08a=_['map'](addVoicePrefixExtensions(_0x10f54b,_0x3ac39d),function(_0x4877c8){_0x4877c8[_0x6326('0x5a')]=_0xc8f404['id'];_0x4877c8['VoicePrefixId']=_0x10f54b['id'];return _0x4877c8;});return db[_0x6326('0x59')][_0x6326('0x6a')](_0x2bc08a,{'transaction':_0x54a9eb})[_0x6326('0x2d')](function(_0x3b6de7){if(!_0x3b6de7){return _0x13fc10(_0x6326('0x6b'));}else{return _0x4cec50(_0x3b6de7);}})[_0x6326('0x4f')](function(_0x1e8d86){return _0x13fc10(_0x1e8d86);});});;});};function addVoicePrefixExtensions(_0x75e3a7,_0xa2928e){var _0x3f5e2e=[];var _0x53ff60=formatPrefixName(_0x75e3a7[_0x6326('0x67')]);_0x3f5e2e[_0x6326('0x6c')](new Extension(_0x53ff60,0x2,_0x6326('0x6d'),_0x6326('0x6e')+_0x75e3a7[_0x6326('0x32')]));if(_0x75e3a7['callerIdAll']){_0x3f5e2e[_0x6326('0x6c')](new Extension(_0x53ff60,0x3,_0x6326('0x6d'),_0x6326('0x6f')+_0x75e3a7[_0x6326('0x70')]));}else{_0x3f5e2e[_0x6326('0x6c')](new Extension(_0x53ff60,0x3,'NoOp',_0x6326('0x71')));}_0x3f5e2e['push'](new Extension(_0x53ff60,0x4,'goto',_0xa2928e[_0x6326('0x72')]+','+_0x6326('0x73')+(0x8+_0x75e3a7[_0x6326('0x32')][_0x6326('0x40')])+'}'+','+0x1));return _0x3f5e2e;}function formatPrefixName(_0x4fd921){var _0x4fbede='_';for(var _0x5cadb2=0x0;_0x5cadb2<_0x4fd921['length'];_0x5cadb2++){if(_0x4fd921[_0x6326('0x74')](_0x5cadb2)=='-'){_0x4fbede+=_0x4fd921['charAt'](_0x5cadb2);}else{_0x4fbede+='['+_0x4fd921[_0x6326('0x74')](_0x5cadb2)+']';}}_0x4fbede+='.';return _0x4fbede;}exports[_0x6326('0x2c')]=function(_0x54730e,_0x4c1d7e,_0x5401cf){var _0x5e86bc=_0x54730e['body'];_0x5e86bc[_0x6326('0x67')]='system-'+_0x5e86bc['name']+'-';return db['sequelize']['transaction'](function(_0x19916e){return db['VoicePrefix'][_0x6326('0x2c')](_0x5e86bc,{'where':{'id':_0x5e86bc['id']},'transaction':_0x19916e})[_0x6326('0x2d')](function(){return db['VoiceExtension'][_0x6326('0x30')]({'where':{'VoicePrefixId':_0x5e86bc['id']},'transaction':_0x19916e})['then'](function(){return db[_0x6326('0x59')][_0x6326('0x53')]({'where':{'id':_0x5e86bc[_0x6326('0x5a')]},'raw':!![]})[_0x6326('0x2d')](function(_0x339838){return createVoicePrefixExtensions(_0x5e86bc,_0x339838,_0x19916e);});});});})[_0x6326('0x2d')](function(){return db[_0x6326('0x35')][_0x6326('0x75')](_0x5e86bc['id']);})[_0x6326('0x2d')](respondWithResult(_0x4c1d7e,null))[_0x6326('0x4f')](handleError(_0x4c1d7e,null));};exports[_0x6326('0x76')]=function(_0x19cc2b,_0x3bc5f3,_0x27a505){return db[_0x6326('0x35')][_0x6326('0x53')]({'where':{'id':_0x19cc2b[_0x6326('0x51')]['id']}})['then'](handleEntityNotFound(_0x3bc5f3,null))['then'](function(_0x543792){if(_0x543792){return _0x543792['addAgents'](_0x19cc2b[_0x6326('0x57')]['ids'],_['omit'](_0x19cc2b['body'],['ids','id'])||{})['spread'](function(_0x5a1a9f){for(var _0xe845d6=0x0;_0xe845d6<_0x19cc2b[_0x6326('0x57')]['ids'][_0x6326('0x40')];_0xe845d6+=0x1){socket[_0x6326('0x77')](_0x6326('0x78'),{'UserId':Number(_0x19cc2b['body'][_0x6326('0x79')][_0xe845d6]),'VoicePrefixId':Number(_0x19cc2b[_0x6326('0x51')]['id'])});}return _0x5a1a9f;});}})[_0x6326('0x2d')](respondWithResult(_0x3bc5f3,null))[_0x6326('0x4f')](handleError(_0x3bc5f3,null));};exports[_0x6326('0x7a')]=function(_0x483813,_0x3bff09,_0x4aec22){return db['VoicePrefix'][_0x6326('0x53')]({'where':{'id':_0x483813['params']['id']}})['then'](handleEntityNotFound(_0x3bff09,null))['then'](function(_0x491f2e){if(_0x491f2e){return _0x491f2e['removeAgents'](_0x483813['query']['ids'])[_0x6326('0x2d')](function(){if(_[_0x6326('0x7b')](_0x483813[_0x6326('0x3b')][_0x6326('0x79')])){for(var _0x590e06=0x0;_0x590e06<_0x483813['query']['ids'][_0x6326('0x40')];_0x590e06+=0x1){socket[_0x6326('0x77')]('userVoicePrefix:remove',{'UserId':Number(_0x483813[_0x6326('0x3b')]['ids'][_0x590e06]),'VoicePrefixId':Number(_0x483813['params']['id'])});}}else{socket[_0x6326('0x77')](_0x6326('0x7c'),{'UserId':Number(_0x483813[_0x6326('0x3b')][_0x6326('0x79')]),'VoicePrefixId':Number(_0x483813[_0x6326('0x51')]['id'])});}});}})[_0x6326('0x2d')](respondWithStatusCode(_0x3bff09,null))[_0x6326('0x4f')](handleError(_0x3bff09,null));};exports['getAgents']=function(_0x5afd24,_0x4c8bde,_0x1ec0ef){var _0x5223f4={};var _0x48631a={};var _0xaea64f;var _0x429c41;return db['VoicePrefix'][_0x6326('0x7d')]({'where':{'id':_0x5afd24['params']['id']}})['then'](handleEntityNotFound(_0x4c8bde,null))[_0x6326('0x2d')](function(_0xbca686){if(_0xbca686){_0xaea64f=_0xbca686;_0x48631a['model']=_['keys'](db[_0x6326('0x7e')][_0x6326('0x36')]);_0x48631a[_0x6326('0x3b')]=_[_0x6326('0x52')](_0x5afd24['query']);_0x48631a['filters']=_[_0x6326('0x3d')](_0x48631a[_0x6326('0x3a')],_0x48631a[_0x6326('0x3b')]);_0x5223f4[_0x6326('0x3f')]=_[_0x6326('0x3d')](_0x48631a[_0x6326('0x3a')],qs[_0x6326('0x3e')](_0x5afd24[_0x6326('0x3b')]['fields']));_0x5223f4[_0x6326('0x3f')]=_0x5223f4['attributes'][_0x6326('0x40')]?_0x5223f4[_0x6326('0x3f')]:_0x48631a[_0x6326('0x3a')];_0x5223f4[_0x6326('0x7f')]=qs[_0x6326('0x44')](_0x5afd24[_0x6326('0x3b')]['sort']);_0x5223f4[_0x6326('0x45')]=qs[_0x6326('0x3c')](_['pick'](_0x5afd24[_0x6326('0x3b')],_0x48631a[_0x6326('0x3c')]));if(_0x5afd24[_0x6326('0x3b')][_0x6326('0x48')]){_0x5223f4[_0x6326('0x45')]=_[_0x6326('0x49')](_0x5223f4[_0x6326('0x45')],{'$or':_['map'](_0x5223f4[_0x6326('0x3f')],function(_0x21ccbf){var _0x458a7e={};_0x458a7e[_0x21ccbf]={'$like':'%'+_0x5afd24[_0x6326('0x3b')][_0x6326('0x48')]+'%'};return _0x458a7e;})});}_0x5223f4=_['merge']({},_0x5223f4,_0x5afd24[_0x6326('0x4a')]);return _0xaea64f[_0x6326('0x80')](_0x5223f4);}})['then'](function(_0x411fe5){if(_0x411fe5){_0x429c41=_0x411fe5[_0x6326('0x40')];if(!_0x5afd24[_0x6326('0x3b')][_0x6326('0x41')](_0x6326('0x42'))){_0x5223f4[_0x6326('0x43')]=qs[_0x6326('0x43')](_0x5afd24[_0x6326('0x3b')]['limit']);_0x5223f4[_0x6326('0x23')]=qs[_0x6326('0x23')](_0x5afd24[_0x6326('0x3b')][_0x6326('0x23')]);}return _0xaea64f[_0x6326('0x80')](_0x5223f4);}})[_0x6326('0x2d')](function(_0xcb5683){if(_0xcb5683){return _0xcb5683?{'count':_0x429c41,'rows':_0xcb5683}:null;}})['then'](respondWithResult(_0x4c8bde,null))[_0x6326('0x4f')](handleError(_0x4c8bde,null));};exports['getTeams']=function(_0x44cea5,_0x57e6ad,_0x3a9312){var _0x5b251f={};var _0x2b885b={};var _0xda3005;var _0x29682b;return db[_0x6326('0x35')][_0x6326('0x7d')]({'where':{'id':_0x44cea5[_0x6326('0x51')]['id']}})[_0x6326('0x2d')](handleEntityNotFound(_0x57e6ad,null))['then'](function(_0x1da431){if(_0x1da431){_0xda3005=_0x1da431;_0x2b885b[_0x6326('0x3a')]=_[_0x6326('0x52')](db['Team'][_0x6326('0x36')]);_0x2b885b['query']=_[_0x6326('0x52')](_0x44cea5[_0x6326('0x3b')]);_0x2b885b[_0x6326('0x3c')]=_[_0x6326('0x3d')](_0x2b885b[_0x6326('0x3a')],_0x2b885b[_0x6326('0x3b')]);_0x5b251f[_0x6326('0x3f')]=_['intersection'](_0x2b885b[_0x6326('0x3a')],qs['fields'](_0x44cea5[_0x6326('0x3b')][_0x6326('0x3e')]));_0x5b251f[_0x6326('0x3f')]=_0x5b251f[_0x6326('0x3f')]['length']?_0x5b251f['attributes']:_0x2b885b[_0x6326('0x3a')];_0x5b251f[_0x6326('0x7f')]=qs[_0x6326('0x44')](_0x44cea5[_0x6326('0x3b')]['sort']);_0x5b251f[_0x6326('0x45')]=qs['filters'](_['pick'](_0x44cea5[_0x6326('0x3b')],_0x2b885b[_0x6326('0x3c')]));if(_0x44cea5[_0x6326('0x3b')][_0x6326('0x48')]){_0x5b251f[_0x6326('0x45')]=_[_0x6326('0x49')](_0x5b251f[_0x6326('0x45')],{'$or':_[_0x6326('0x34')](_0x5b251f[_0x6326('0x3f')],function(_0x3884db){var _0x5ccb35={};_0x5ccb35[_0x3884db]={'$like':'%'+_0x44cea5['query'][_0x6326('0x48')]+'%'};return _0x5ccb35;})});}_0x5b251f=_['merge']({},_0x5b251f,_0x44cea5[_0x6326('0x4a')]);return _0xda3005['getTeams'](_0x5b251f);}})['then'](function(_0x10d3c6){if(_0x10d3c6){_0x29682b=_0x10d3c6[_0x6326('0x40')];if(!_0x44cea5[_0x6326('0x3b')][_0x6326('0x41')](_0x6326('0x42'))){_0x5b251f[_0x6326('0x43')]=qs[_0x6326('0x43')](_0x44cea5[_0x6326('0x3b')]['limit']);_0x5b251f['offset']=qs[_0x6326('0x23')](_0x44cea5['query'][_0x6326('0x23')]);}return _0xda3005[_0x6326('0x81')](_0x5b251f);}})['then'](function(_0x5c57e5){if(_0x5c57e5){return _0x5c57e5?{'count':_0x29682b,'rows':_0x5c57e5}:null;}})[_0x6326('0x2d')](respondWithResult(_0x57e6ad,null))['catch'](handleError(_0x57e6ad,null));};exports['addTeams']=function(_0x50d766,_0x4f45a6,_0x3a9a9e){var _0x22c60d=_0x50d766[_0x6326('0x57')][_0x6326('0x79')];var _0x26f784;return db[_0x6326('0x82')]['findAll']({'where':{'id':_0x22c60d},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name','online','voicePause',_0x6326('0x83')],'raw':!![]}]})[_0x6326('0x2d')](function(_0x215db1){if(_0x215db1){_0x26f784=_0x215db1;var _0x2a9f5c=_['flatMap'](_0x215db1,function(_0x20f5ea){var _0x293f72=_0x20f5ea['get']({'plain':!![]});return _0x293f72[_0x6326('0x84')];});return db['VoicePrefix'][_0x6326('0x53')]({'where':{'id':_0x50d766[_0x6326('0x51')]['id']}})[_0x6326('0x2d')](function(_0x5d4b0a){return db['sequelize'][_0x6326('0x56')](function(_0xf912fe){return _0x5d4b0a[_0x6326('0x85')](_0x22c60d,{'transaction':_0xf912fe})['then'](function(){return BPromise[_0x6326('0x86')](_0x26f784,function(_0x464914){return db[_0x6326('0x87')]['upsert']({'TeamId':_0x464914['id'],'VoicePrefixId':_0x50d766[_0x6326('0x51')]['id']},{'transaction':_0xf912fe});});})['then'](function(){return BPromise[_0x6326('0x86')](_0x2a9f5c,function(_0x5a7b49){return db[_0x6326('0x88')][_0x6326('0x89')]({'where':{'UserId':_0x5a7b49['id'],'VoicePrefixId':_0x50d766['params']['id']},'transaction':_0xf912fe});});})[_0x6326('0x2d')](function(){_0x2a9f5c[_0x6326('0x8a')](function(_0x38d8c8){socket[_0x6326('0x77')](_0x6326('0x78'),{'UserId':_0x38d8c8['id'],'VoicePrefixId':_0x5d4b0a['id']});});});});});}})[_0x6326('0x2d')](respondWithStatusCode(_0x4f45a6,null))[_0x6326('0x4f')](handleError(_0x4f45a6,null));};exports[_0x6326('0x8b')]=function(_0x43dc1e,_0x26ea69,_0x1a4b94){return db[_0x6326('0x82')][_0x6326('0x4d')]({'where':{'id':_0x43dc1e['query'][_0x6326('0x79')]},'attributes':['id'],'include':[{'model':db[_0x6326('0x7e')],'as':_0x6326('0x84'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x26ea69,null))['then'](function(_0x489226){var _0x5db6b3=_[_0x6326('0x34')](_0x489226,'id');var _0x5135df=[];var _0x4c15d2=[];var _0xd9c385=squel['select']();_0xd9c385['field'](_0x6326('0x8c'))['from'](_0x6326('0x8d'),'tq')[_0x6326('0x8e')](_0x6326('0x8f'),'ut',_0x6326('0x90'))[_0x6326('0x45')](_0x6326('0x91'),_0x43dc1e[_0x6326('0x51')]['id']);for(var _0x26391c=0x0;_0x26391c<_0x489226[_0x6326('0x40')];_0x26391c+=0x1){let _0x1adcbc=_0x489226[_0x26391c];for(var _0x46bece=0x0;_0x46bece<_0x1adcbc[_0x6326('0x84')][_0x6326('0x40')];_0x46bece+=0x1){let _0x30d31a=_0x1adcbc[_0x6326('0x84')][_0x46bece];var _0x3ec241=_0xd9c385[_0x6326('0x92')]();_0x3ec241[_0x6326('0x45')](_0x6326('0x93'),_0x30d31a['id']);_0x4c15d2[_0x6326('0x6c')](db['sequelize'][_0x6326('0x3b')](_0x3ec241[_0x6326('0x94')](),{'type':db[_0x6326('0x95')][_0x6326('0x96')][_0x6326('0x97')]})[_0x6326('0x2d')](function(_0x292657){if(_0x292657[_0x6326('0x40')]===0x1){return _0x30d31a['id'];}else{var _0x909cce=_[_0x6326('0x98')](_['map'](_0x292657,_0x6326('0x99')),function(_0x4b493a){return _[_0x6326('0x9a')](_0x5db6b3,_0x4b493a);});if(_0x909cce){return _0x30d31a['id'];}}}));}}return BPromise[_0x6326('0x9b')](_0x4c15d2)['then'](function(_0x2b98a4){_0x5135df=_(_0x5135df)[_0x6326('0x9c')](_0x2b98a4)['compact']()['value']();return db[_0x6326('0x35')]['find']({'where':{'id':_0x43dc1e[_0x6326('0x51')]['id']}})['then'](function(_0x4a470e){return db[_0x6326('0x95')][_0x6326('0x56')](function(_0x298a11){return _0x4a470e[_0x6326('0x8b')](_0x43dc1e[_0x6326('0x3b')][_0x6326('0x79')],{'transaction':_0x298a11})[_0x6326('0x2d')](function(){if(!_['isEmpty'](_0x5135df)){return _0x4a470e['removeAgents'](_0x5135df,{'transaction':_0x298a11});}})[_0x6326('0x2d')](function(){_0x5135df[_0x6326('0x8a')](function(_0x42d1db){socket[_0x6326('0x77')](_0x6326('0x7c'),{'UserId':_0x42d1db,'VoicePrefixId':_0x4a470e['id']});});});});});});})['then'](respondWithStatusCode(_0x26ea69,null))[_0x6326('0x4f')](handleError(_0x26ea69,null));}; \ No newline at end of file +var _0xaebd=['interface','flatMap','addTeams','TeamVoicePrefix','each','UserVoicePrefix','forEach','removeTeams','User','select','field','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','SELECT','TeamId','includes','all','union','compact','value','isEmpty','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','apply','reject','update','then','destroy','error','stack','name','send','index','VoicePrefix','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','filter','include','findAll','catch','show','params','includeAll','find','describe','sequelize','transaction','create','get','VoiceExtension','user','role','UserProfileSection','VoicePrefixes','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','body','system-','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','order','Team','options','getTeams','Agents','online','voicePause'];(function(_0x3b6b5e,_0x192868){var _0x2b55f9=function(_0x48c564){while(--_0x48c564){_0x3b6b5e['push'](_0x3b6b5e['shift']());}};_0x2b55f9(++_0x192868);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x5e7a14,_0x36594f){_0x5e7a14=_0x5e7a14-0x0;var _0x4b1d7e=_0xaebd[_0x5e7a14];return _0x4b1d7e;};'use strict';var emlformat=require(_0xdaeb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdaeb('0x1'));var jsonpatch=require(_0xdaeb('0x2'));var rp=require(_0xdaeb('0x3'));var moment=require(_0xdaeb('0x4'));var BPromise=require(_0xdaeb('0x5'));var Mustache=require('mustache');var util=require(_0xdaeb('0x6'));var path=require(_0xdaeb('0x7'));var sox=require(_0xdaeb('0x8'));var csv=require(_0xdaeb('0x9'));var ejs=require(_0xdaeb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdaeb('0xb'));var squel=require(_0xdaeb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdaeb('0xd'));var toCsv=require(_0xdaeb('0x9'));var querystring=require(_0xdaeb('0xe'));var Papa=require('papaparse');var Redis=require(_0xdaeb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdaeb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdaeb('0x11'));var logger=require('../../config/logger')(_0xdaeb('0x12'));var utils=require(_0xdaeb('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdaeb('0x14'))['db'];config['redis']=_[_0xdaeb('0x15')](config[_0xdaeb('0x16')],{'host':_0xdaeb('0x17'),'port':0x18eb});var socket=require(_0xdaeb('0x18'))(new Redis(config[_0xdaeb('0x16')]));require(_0xdaeb('0x19'))[_0xdaeb('0x1a')](socket);function respondWithStatusCode(_0x49ba9a,_0x57b091){_0x57b091=_0x57b091||0xcc;return function(_0x96371f){if(_0x96371f){return _0x49ba9a[_0xdaeb('0x1b')](_0x57b091);}return _0x49ba9a[_0xdaeb('0x1c')](_0x57b091)[_0xdaeb('0x1d')]();};}function respondWithResult(_0x538a25,_0x4c3bf3){_0x4c3bf3=_0x4c3bf3||0xc8;return function(_0x24b898){if(_0x24b898){return _0x538a25['status'](_0x4c3bf3)['json'](_0x24b898);}};}function respondWithFilteredResult(_0x42e509,_0x16eb2d){return function(_0x1b5243){if(_0x1b5243){var _0x1fe84e=typeof _0x16eb2d[_0xdaeb('0x1e')]===_0xdaeb('0x1f')&&typeof _0x16eb2d['limit']===_0xdaeb('0x1f');var _0x5ccf66=_0x1b5243[_0xdaeb('0x20')];var _0x13b3f2=_0x1fe84e?0x0:_0x16eb2d[_0xdaeb('0x1e')];var _0x5360ce=_0x1fe84e?_0x1b5243['count']:_0x16eb2d[_0xdaeb('0x1e')]+_0x16eb2d[_0xdaeb('0x21')];var _0x23fccb;if(_0x5360ce>=_0x5ccf66){_0x5360ce=_0x5ccf66;_0x23fccb=0xc8;}else{_0x23fccb=0xce;}_0x42e509[_0xdaeb('0x1c')](_0x23fccb);return _0x42e509[_0xdaeb('0x22')]('Content-Range',_0x13b3f2+'-'+_0x5360ce+'/'+_0x5ccf66)['json'](_0x1b5243);}return null;};}function patchUpdates(_0x2c969d){return function(_0x3cfcaf){try{jsonpatch[_0xdaeb('0x23')](_0x3cfcaf,_0x2c969d,!![]);}catch(_0x1d919a){return BPromise[_0xdaeb('0x24')](_0x1d919a);}return _0x3cfcaf['save']();};}function saveUpdates(_0x254c3b,_0x4dc25f){return function(_0x130c35){if(_0x130c35){return _0x130c35[_0xdaeb('0x25')](_0x254c3b)[_0xdaeb('0x26')](function(_0x3b0770){return _0x3b0770;});}return null;};}function removeEntity(_0x32c2c1,_0x4fc3e2){return function(_0x3a0b9c){if(_0x3a0b9c){return _0x3a0b9c[_0xdaeb('0x27')]()[_0xdaeb('0x26')](function(){var _0x4eb719=_0x3a0b9c['get']({'plain':!![]});var _0x43095f='VoicePrefixes';return db['UserProfileResource'][_0xdaeb('0x27')]({'where':{'type':_0x43095f,'resourceId':_0x4eb719['id']}})[_0xdaeb('0x26')](function(){return _0x3a0b9c;});})[_0xdaeb('0x26')](function(){_0x32c2c1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x32966f,_0x440022){return function(_0x37f468){if(!_0x37f468){_0x32966f['sendStatus'](0x194);}return _0x37f468;};}function handleError(_0x36c933,_0x510607){_0x510607=_0x510607||0x1f4;return function(_0x4da82d){logger[_0xdaeb('0x28')](_0x4da82d[_0xdaeb('0x29')]);if(_0x4da82d[_0xdaeb('0x2a')]){delete _0x4da82d[_0xdaeb('0x2a')];}_0x36c933[_0xdaeb('0x1c')](_0x510607)[_0xdaeb('0x2b')](_0x4da82d);};}exports[_0xdaeb('0x2c')]=function(_0x5f1c84,_0x1c1c7c){var _0x143972={},_0x345982={},_0x40dbaa={'count':0x0,'rows':[]};var _0x2c89ae=_['map'](db[_0xdaeb('0x2d')][_0xdaeb('0x2e')],function(_0x4a7abe){return{'name':_0x4a7abe[_0xdaeb('0x2f')],'type':_0x4a7abe[_0xdaeb('0x30')][_0xdaeb('0x31')]};});_0x345982[_0xdaeb('0x32')]=_[_0xdaeb('0x33')](_0x2c89ae,_0xdaeb('0x2a'));_0x345982[_0xdaeb('0x34')]=_[_0xdaeb('0x35')](_0x5f1c84[_0xdaeb('0x34')]);_0x345982[_0xdaeb('0x36')]=_['intersection'](_0x345982['model'],_0x345982[_0xdaeb('0x34')]);_0x143972['attributes']=_[_0xdaeb('0x37')](_0x345982[_0xdaeb('0x32')],qs[_0xdaeb('0x38')](_0x5f1c84[_0xdaeb('0x34')][_0xdaeb('0x38')]));_0x143972[_0xdaeb('0x39')]=_0x143972['attributes'][_0xdaeb('0x3a')]?_0x143972[_0xdaeb('0x39')]:_0x345982[_0xdaeb('0x32')];if(!_0x5f1c84['query'][_0xdaeb('0x3b')](_0xdaeb('0x3c'))){_0x143972[_0xdaeb('0x21')]=qs[_0xdaeb('0x21')](_0x5f1c84[_0xdaeb('0x34')][_0xdaeb('0x21')]);_0x143972[_0xdaeb('0x1e')]=qs['offset'](_0x5f1c84[_0xdaeb('0x34')][_0xdaeb('0x1e')]);}_0x143972['order']=qs['sort'](_0x5f1c84[_0xdaeb('0x34')][_0xdaeb('0x3d')]);_0x143972['where']=qs[_0xdaeb('0x36')](_[_0xdaeb('0x3e')](_0x5f1c84['query'],_0x345982[_0xdaeb('0x36')]),_0x2c89ae);if(_0x5f1c84[_0xdaeb('0x34')]['filter']){_0x143972['where']=_[_0xdaeb('0x3f')](_0x143972[_0xdaeb('0x40')],{'$or':_[_0xdaeb('0x33')](_0x2c89ae,function(_0x10082c){if(_0x10082c[_0xdaeb('0x30')]!==_0xdaeb('0x41')){var _0x5b705b={};_0x5b705b[_0x10082c[_0xdaeb('0x2a')]]={'$like':'%'+_0x5f1c84['query'][_0xdaeb('0x42')]+'%'};return _0x5b705b;}})});}_0x143972=_['merge']({},_0x143972,_0x5f1c84['options']);var _0x2b47d7={'where':_0x143972['where']};return db[_0xdaeb('0x2d')]['count'](_0x2b47d7)[_0xdaeb('0x26')](function(_0x244369){_0x40dbaa[_0xdaeb('0x20')]=_0x244369;if(_0x5f1c84[_0xdaeb('0x34')]['includeAll']){_0x143972[_0xdaeb('0x43')]=[{'all':!![]}];}return db['VoicePrefix'][_0xdaeb('0x44')](_0x143972);})[_0xdaeb('0x26')](function(_0x447ef0){_0x40dbaa['rows']=_0x447ef0;return _0x40dbaa;})[_0xdaeb('0x26')](respondWithFilteredResult(_0x1c1c7c,_0x143972))[_0xdaeb('0x45')](handleError(_0x1c1c7c,null));};exports[_0xdaeb('0x46')]=function(_0x4715a7,_0x34cf4d){var _0x3debbc={'raw':![],'where':{'id':_0x4715a7[_0xdaeb('0x47')]['id']}},_0x1369f7={};_0x1369f7[_0xdaeb('0x32')]=_[_0xdaeb('0x35')](db[_0xdaeb('0x2d')][_0xdaeb('0x2e')]);_0x1369f7['query']=_[_0xdaeb('0x35')](_0x4715a7[_0xdaeb('0x34')]);_0x1369f7['filters']=_['intersection'](_0x1369f7[_0xdaeb('0x32')],_0x1369f7[_0xdaeb('0x34')]);_0x3debbc[_0xdaeb('0x39')]=_['intersection'](_0x1369f7[_0xdaeb('0x32')],qs[_0xdaeb('0x38')](_0x4715a7[_0xdaeb('0x34')][_0xdaeb('0x38')]));_0x3debbc[_0xdaeb('0x39')]=_0x3debbc[_0xdaeb('0x39')][_0xdaeb('0x3a')]?_0x3debbc[_0xdaeb('0x39')]:_0x1369f7['model'];if(_0x4715a7[_0xdaeb('0x34')][_0xdaeb('0x48')]){_0x3debbc['include']=[{'all':!![]}];}_0x3debbc=_[_0xdaeb('0x3f')]({},_0x3debbc,_0x4715a7['options']);return db[_0xdaeb('0x2d')][_0xdaeb('0x49')](_0x3debbc)[_0xdaeb('0x26')](handleEntityNotFound(_0x34cf4d,null))[_0xdaeb('0x26')](respondWithResult(_0x34cf4d,null))[_0xdaeb('0x45')](handleError(_0x34cf4d,null));};exports[_0xdaeb('0x27')]=function(_0x33a4d7,_0xfe595){return db[_0xdaeb('0x2d')]['find']({'where':{'id':_0x33a4d7['params']['id']}})[_0xdaeb('0x26')](handleEntityNotFound(_0xfe595,null))[_0xdaeb('0x26')](removeEntity(_0xfe595,null))[_0xdaeb('0x45')](handleError(_0xfe595,null));};exports[_0xdaeb('0x4a')]=function(_0xf37729,_0x220edc){return db['VoicePrefix'][_0xdaeb('0x4a')]()[_0xdaeb('0x26')](respondWithResult(_0x220edc,null))[_0xdaeb('0x45')](handleError(_0x220edc,null));};exports['create']=function(_0x428b72,_0x597584){var _0x3fe511;return db[_0xdaeb('0x4b')][_0xdaeb('0x4c')](function(_0x395e2c){return db[_0xdaeb('0x2d')][_0xdaeb('0x4d')](_0x428b72['body'],{'transaction':_0x395e2c})['then'](function(_0x4abd5e){_0x3fe511=_0x4abd5e[_0xdaeb('0x4e')]({'plain':!![]});return db[_0xdaeb('0x4f')]['find']({'where':{'id':_0x3fe511['VoiceExtensionId']},'raw':!![]})['then'](function(_0x3f6030){return createVoicePrefixExtensions(_0x3fe511,_0x3f6030,_0x395e2c);});});})[_0xdaeb('0x26')](function(){var _0x2846f7=_0x428b72[_0xdaeb('0x50')][_0xdaeb('0x4e')]({'plain':!![]});if(!_0x2846f7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2846f7[_0xdaeb('0x51')]==='user'){var _0x25e58f=_0x3fe511;return db[_0xdaeb('0x52')][_0xdaeb('0x49')]({'where':{'name':_0xdaeb('0x53'),'userProfileId':_0x2846f7[_0xdaeb('0x54')]},'raw':!![]})[_0xdaeb('0x26')](function(_0x51b98f){if(_0x51b98f&&_0x51b98f['autoAssociation']===0x0){return db[_0xdaeb('0x55')]['create']({'name':_0x25e58f[_0xdaeb('0x2a')],'resourceId':_0x25e58f['id'],'type':_0x51b98f[_0xdaeb('0x2a')],'sectionId':_0x51b98f['id']},{})[_0xdaeb('0x26')](function(){return _0x3fe511;});}else{return _0x3fe511;}})['catch'](function(_0x1dd297){logger[_0xdaeb('0x28')](_0xdaeb('0x56'),_0x1dd297);throw _0x1dd297;});}return _0x3fe511;})[_0xdaeb('0x26')](respondWithResult(_0x597584,null))[_0xdaeb('0x45')](handleError(_0x597584,null));};function Extension(_0x23a3f7,_0x1241c5,_0x29abaa,_0x2e8bae){this['context']=_0xdaeb('0x57');this[_0xdaeb('0x58')]=_0x23a3f7;this[_0xdaeb('0x59')]=_0x29abaa;this[_0xdaeb('0x30')]='system';this['description']=_0xdaeb('0x5a');this[_0xdaeb('0x5b')]=_0x1241c5;this[_0xdaeb('0x5c')]=_0x2e8bae;}function createVoicePrefixExtensions(_0x207b34,_0x4c734e,_0x3147ec){return new BPromise(function(_0x5e20b4,_0x1ff5b3){var _0x4a0af5=new Extension(formatPrefixName(_0x207b34[_0xdaeb('0x5d')]),0x1,'NoOp',_0xdaeb('0x5e'));_0x4a0af5[_0xdaeb('0x5f')]=_0x207b34['id'];return db[_0xdaeb('0x4f')][_0xdaeb('0x4d')](_0x4a0af5,{'transaction':_0x3147ec})[_0xdaeb('0x26')](function(_0x2e1619){var _0x15ce20=_0x2e1619[_0xdaeb('0x4e')]({'plain':!![]});var _0x40aec7=_[_0xdaeb('0x33')](addVoicePrefixExtensions(_0x207b34,_0x4c734e),function(_0x5abde4){_0x5abde4[_0xdaeb('0x60')]=_0x15ce20['id'];_0x5abde4['VoicePrefixId']=_0x207b34['id'];return _0x5abde4;});return db[_0xdaeb('0x4f')][_0xdaeb('0x61')](_0x40aec7,{'transaction':_0x3147ec})['then'](function(_0x469781){if(!_0x469781){return _0x1ff5b3('Extensions\x20creation\x20failed');}else{return _0x5e20b4(_0x469781);}})[_0xdaeb('0x45')](function(_0x2d6910){return _0x1ff5b3(_0x2d6910);});});;});};function addVoicePrefixExtensions(_0x50bff5,_0x888128){var _0x3f86f4=[];var _0x22981f=formatPrefixName(_0x50bff5[_0xdaeb('0x5d')]);_0x3f86f4[_0xdaeb('0x62')](new Extension(_0x22981f,0x2,_0xdaeb('0x63'),'CDR(prefix)='+_0x50bff5[_0xdaeb('0x2a')]));if(_0x50bff5[_0xdaeb('0x64')]){_0x3f86f4[_0xdaeb('0x62')](new Extension(_0x22981f,0x3,_0xdaeb('0x63'),_0xdaeb('0x65')+_0x50bff5[_0xdaeb('0x64')]));}else{_0x3f86f4[_0xdaeb('0x62')](new Extension(_0x22981f,0x3,'NoOp',_0xdaeb('0x66')));}_0x3f86f4[_0xdaeb('0x62')](new Extension(_0x22981f,0x4,_0xdaeb('0x67'),_0x888128[_0xdaeb('0x68')]+','+_0xdaeb('0x69')+(0x8+_0x50bff5['name'][_0xdaeb('0x3a')])+'}'+','+0x1));return _0x3f86f4;}function formatPrefixName(_0x4292d9){var _0x29a06f='_';for(var _0x2d4d57=0x0;_0x2d4d57<_0x4292d9['length'];_0x2d4d57++){if(_0x4292d9[_0xdaeb('0x6a')](_0x2d4d57)=='-'){_0x29a06f+=_0x4292d9[_0xdaeb('0x6a')](_0x2d4d57);}else{_0x29a06f+='['+_0x4292d9[_0xdaeb('0x6a')](_0x2d4d57)+']';}}_0x29a06f+='.';return _0x29a06f;}exports['update']=function(_0x17c5a8,_0x237f31,_0x5e6c01){var _0x3ac0f0=_0x17c5a8[_0xdaeb('0x6b')];_0x3ac0f0[_0xdaeb('0x5d')]=_0xdaeb('0x6c')+_0x3ac0f0['name']+'-';return db[_0xdaeb('0x4b')]['transaction'](function(_0x12918f){return db[_0xdaeb('0x2d')][_0xdaeb('0x25')](_0x3ac0f0,{'where':{'id':_0x3ac0f0['id']},'transaction':_0x12918f})[_0xdaeb('0x26')](function(){return db[_0xdaeb('0x4f')][_0xdaeb('0x27')]({'where':{'VoicePrefixId':_0x3ac0f0['id']},'transaction':_0x12918f})[_0xdaeb('0x26')](function(){return db[_0xdaeb('0x4f')]['find']({'where':{'id':_0x3ac0f0[_0xdaeb('0x60')]},'raw':!![]})[_0xdaeb('0x26')](function(_0x257e5b){return createVoicePrefixExtensions(_0x3ac0f0,_0x257e5b,_0x12918f);});});});})[_0xdaeb('0x26')](function(){return db[_0xdaeb('0x2d')][_0xdaeb('0x6d')](_0x3ac0f0['id']);})[_0xdaeb('0x26')](respondWithResult(_0x237f31,null))[_0xdaeb('0x45')](handleError(_0x237f31,null));};exports['addAgents']=function(_0x4c979b,_0x3f089f,_0x44c972){return db[_0xdaeb('0x2d')][_0xdaeb('0x49')]({'where':{'id':_0x4c979b[_0xdaeb('0x47')]['id']}})[_0xdaeb('0x26')](handleEntityNotFound(_0x3f089f,null))['then'](function(_0xce453d){if(_0xce453d){return _0xce453d[_0xdaeb('0x6e')](_0x4c979b[_0xdaeb('0x6b')][_0xdaeb('0x6f')],_[_0xdaeb('0x70')](_0x4c979b['body'],['ids','id'])||{})[_0xdaeb('0x71')](function(_0x2a77ce){for(var _0x38d25=0x0;_0x38d25<_0x4c979b['body'][_0xdaeb('0x6f')][_0xdaeb('0x3a')];_0x38d25+=0x1){socket[_0xdaeb('0x72')](_0xdaeb('0x73'),{'UserId':Number(_0x4c979b[_0xdaeb('0x6b')][_0xdaeb('0x6f')][_0x38d25]),'VoicePrefixId':Number(_0x4c979b['params']['id'])});}return _0x2a77ce;});}})[_0xdaeb('0x26')](respondWithResult(_0x3f089f,null))['catch'](handleError(_0x3f089f,null));};exports[_0xdaeb('0x74')]=function(_0x34bbc2,_0x2f9672,_0x13a423){return db['VoicePrefix'][_0xdaeb('0x49')]({'where':{'id':_0x34bbc2[_0xdaeb('0x47')]['id']}})[_0xdaeb('0x26')](handleEntityNotFound(_0x2f9672,null))['then'](function(_0x623520){if(_0x623520){return _0x623520[_0xdaeb('0x74')](_0x34bbc2[_0xdaeb('0x34')][_0xdaeb('0x6f')])[_0xdaeb('0x26')](function(){if(_['isArray'](_0x34bbc2['query']['ids'])){for(var _0x10a29a=0x0;_0x10a29a<_0x34bbc2['query'][_0xdaeb('0x6f')][_0xdaeb('0x3a')];_0x10a29a+=0x1){socket['emit'](_0xdaeb('0x75'),{'UserId':Number(_0x34bbc2['query'][_0xdaeb('0x6f')][_0x10a29a]),'VoicePrefixId':Number(_0x34bbc2[_0xdaeb('0x47')]['id'])});}}else{socket[_0xdaeb('0x72')](_0xdaeb('0x75'),{'UserId':Number(_0x34bbc2[_0xdaeb('0x34')][_0xdaeb('0x6f')]),'VoicePrefixId':Number(_0x34bbc2['params']['id'])});}});}})[_0xdaeb('0x26')](respondWithStatusCode(_0x2f9672,null))[_0xdaeb('0x45')](handleError(_0x2f9672,null));};exports[_0xdaeb('0x76')]=function(_0x52c908,_0x1d31f8,_0x3ecf4e){var _0x4228a6={};var _0x4ce150={};var _0x1fd586;var _0x4eda32;return db[_0xdaeb('0x2d')][_0xdaeb('0x77')]({'where':{'id':_0x52c908[_0xdaeb('0x47')]['id']}})[_0xdaeb('0x26')](handleEntityNotFound(_0x1d31f8,null))['then'](function(_0x4bd7ef){if(_0x4bd7ef){_0x1fd586=_0x4bd7ef;_0x4ce150[_0xdaeb('0x32')]=_[_0xdaeb('0x35')](db['User'][_0xdaeb('0x2e')]);_0x4ce150[_0xdaeb('0x34')]=_[_0xdaeb('0x35')](_0x52c908[_0xdaeb('0x34')]);_0x4ce150[_0xdaeb('0x36')]=_[_0xdaeb('0x37')](_0x4ce150[_0xdaeb('0x32')],_0x4ce150[_0xdaeb('0x34')]);_0x4228a6['attributes']=_[_0xdaeb('0x37')](_0x4ce150[_0xdaeb('0x32')],qs[_0xdaeb('0x38')](_0x52c908[_0xdaeb('0x34')][_0xdaeb('0x38')]));_0x4228a6[_0xdaeb('0x39')]=_0x4228a6[_0xdaeb('0x39')]['length']?_0x4228a6[_0xdaeb('0x39')]:_0x4ce150[_0xdaeb('0x32')];_0x4228a6[_0xdaeb('0x78')]=qs[_0xdaeb('0x3d')](_0x52c908[_0xdaeb('0x34')][_0xdaeb('0x3d')]);_0x4228a6['where']=qs[_0xdaeb('0x36')](_[_0xdaeb('0x3e')](_0x52c908['query'],_0x4ce150['filters']));if(_0x52c908[_0xdaeb('0x34')][_0xdaeb('0x42')]){_0x4228a6[_0xdaeb('0x40')]=_['merge'](_0x4228a6[_0xdaeb('0x40')],{'$or':_[_0xdaeb('0x33')](_0x4228a6[_0xdaeb('0x39')],function(_0x4549ad){var _0x38171d={};_0x38171d[_0x4549ad]={'$like':'%'+_0x52c908['query'][_0xdaeb('0x42')]+'%'};return _0x38171d;})});}_0x4228a6=_[_0xdaeb('0x3f')]({},_0x4228a6,_0x52c908['options']);return _0x1fd586[_0xdaeb('0x76')](_0x4228a6);}})[_0xdaeb('0x26')](function(_0x58b771){if(_0x58b771){_0x4eda32=_0x58b771['length'];if(!_0x52c908[_0xdaeb('0x34')][_0xdaeb('0x3b')](_0xdaeb('0x3c'))){_0x4228a6[_0xdaeb('0x21')]=qs[_0xdaeb('0x21')](_0x52c908[_0xdaeb('0x34')][_0xdaeb('0x21')]);_0x4228a6[_0xdaeb('0x1e')]=qs[_0xdaeb('0x1e')](_0x52c908[_0xdaeb('0x34')][_0xdaeb('0x1e')]);}return _0x1fd586[_0xdaeb('0x76')](_0x4228a6);}})['then'](function(_0x2d5152){if(_0x2d5152){return _0x2d5152?{'count':_0x4eda32,'rows':_0x2d5152}:null;}})[_0xdaeb('0x26')](respondWithResult(_0x1d31f8,null))['catch'](handleError(_0x1d31f8,null));};exports['getTeams']=function(_0x332b3a,_0x3c096d,_0x2a7af6){var _0x1c69b8={};var _0x4790c6={};var _0x3f876c;var _0x124102;return db[_0xdaeb('0x2d')][_0xdaeb('0x77')]({'where':{'id':_0x332b3a[_0xdaeb('0x47')]['id']}})['then'](handleEntityNotFound(_0x3c096d,null))['then'](function(_0x20cc70){if(_0x20cc70){_0x3f876c=_0x20cc70;_0x4790c6[_0xdaeb('0x32')]=_[_0xdaeb('0x35')](db[_0xdaeb('0x79')][_0xdaeb('0x2e')]);_0x4790c6[_0xdaeb('0x34')]=_[_0xdaeb('0x35')](_0x332b3a['query']);_0x4790c6['filters']=_['intersection'](_0x4790c6[_0xdaeb('0x32')],_0x4790c6['query']);_0x1c69b8[_0xdaeb('0x39')]=_['intersection'](_0x4790c6['model'],qs[_0xdaeb('0x38')](_0x332b3a['query'][_0xdaeb('0x38')]));_0x1c69b8[_0xdaeb('0x39')]=_0x1c69b8[_0xdaeb('0x39')][_0xdaeb('0x3a')]?_0x1c69b8[_0xdaeb('0x39')]:_0x4790c6[_0xdaeb('0x32')];_0x1c69b8[_0xdaeb('0x78')]=qs[_0xdaeb('0x3d')](_0x332b3a[_0xdaeb('0x34')][_0xdaeb('0x3d')]);_0x1c69b8[_0xdaeb('0x40')]=qs['filters'](_[_0xdaeb('0x3e')](_0x332b3a['query'],_0x4790c6[_0xdaeb('0x36')]));if(_0x332b3a['query']['filter']){_0x1c69b8[_0xdaeb('0x40')]=_[_0xdaeb('0x3f')](_0x1c69b8[_0xdaeb('0x40')],{'$or':_[_0xdaeb('0x33')](_0x1c69b8[_0xdaeb('0x39')],function(_0x282979){var _0x4616c1={};_0x4616c1[_0x282979]={'$like':'%'+_0x332b3a[_0xdaeb('0x34')][_0xdaeb('0x42')]+'%'};return _0x4616c1;})});}_0x1c69b8=_[_0xdaeb('0x3f')]({},_0x1c69b8,_0x332b3a[_0xdaeb('0x7a')]);return _0x3f876c[_0xdaeb('0x7b')](_0x1c69b8);}})[_0xdaeb('0x26')](function(_0x671eea){if(_0x671eea){_0x124102=_0x671eea[_0xdaeb('0x3a')];if(!_0x332b3a[_0xdaeb('0x34')][_0xdaeb('0x3b')](_0xdaeb('0x3c'))){_0x1c69b8['limit']=qs[_0xdaeb('0x21')](_0x332b3a[_0xdaeb('0x34')][_0xdaeb('0x21')]);_0x1c69b8['offset']=qs[_0xdaeb('0x1e')](_0x332b3a['query'][_0xdaeb('0x1e')]);}return _0x3f876c['getTeams'](_0x1c69b8);}})[_0xdaeb('0x26')](function(_0x397580){if(_0x397580){return _0x397580?{'count':_0x124102,'rows':_0x397580}:null;}})['then'](respondWithResult(_0x3c096d,null))[_0xdaeb('0x45')](handleError(_0x3c096d,null));};exports['addTeams']=function(_0x3e14f8,_0x536eb0,_0x2214f4){var _0x489e90=_0x3e14f8[_0xdaeb('0x6b')][_0xdaeb('0x6f')];var _0x25ee1b;return db['Team'][_0xdaeb('0x44')]({'where':{'id':_0x489e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xdaeb('0x7c'),'attributes':['id',_0xdaeb('0x2a'),_0xdaeb('0x7d'),_0xdaeb('0x7e'),_0xdaeb('0x7f')],'raw':!![]}]})['then'](function(_0x1da7c4){if(_0x1da7c4){_0x25ee1b=_0x1da7c4;var _0x3c83fd=_[_0xdaeb('0x80')](_0x1da7c4,function(_0x51225e){var _0x52a452=_0x51225e[_0xdaeb('0x4e')]({'plain':!![]});return _0x52a452[_0xdaeb('0x7c')];});return db[_0xdaeb('0x2d')]['find']({'where':{'id':_0x3e14f8[_0xdaeb('0x47')]['id']}})['then'](function(_0x3d3c4c){return db[_0xdaeb('0x4b')][_0xdaeb('0x4c')](function(_0x285a3a){return _0x3d3c4c[_0xdaeb('0x81')](_0x489e90,{'transaction':_0x285a3a})[_0xdaeb('0x26')](function(){return BPromise['each'](_0x25ee1b,function(_0x43e54c){return db[_0xdaeb('0x82')]['upsert']({'TeamId':_0x43e54c['id'],'VoicePrefixId':_0x3e14f8[_0xdaeb('0x47')]['id']},{'transaction':_0x285a3a});});})[_0xdaeb('0x26')](function(){return BPromise[_0xdaeb('0x83')](_0x3c83fd,function(_0x50f11f){return db[_0xdaeb('0x84')]['findOrCreate']({'where':{'UserId':_0x50f11f['id'],'VoicePrefixId':_0x3e14f8[_0xdaeb('0x47')]['id']},'transaction':_0x285a3a});});})[_0xdaeb('0x26')](function(){_0x3c83fd[_0xdaeb('0x85')](function(_0x4a8811){socket[_0xdaeb('0x72')](_0xdaeb('0x73'),{'UserId':_0x4a8811['id'],'VoicePrefixId':_0x3d3c4c['id']});});});});});}})[_0xdaeb('0x26')](respondWithStatusCode(_0x536eb0,null))[_0xdaeb('0x45')](handleError(_0x536eb0,null));};exports[_0xdaeb('0x86')]=function(_0x266009,_0x294c17,_0x5596e6){return db[_0xdaeb('0x79')]['findAll']({'where':{'id':_0x266009[_0xdaeb('0x34')][_0xdaeb('0x6f')]},'attributes':['id'],'include':[{'model':db[_0xdaeb('0x87')],'as':_0xdaeb('0x7c'),'attributes':['id'],'raw':!![]}]})[_0xdaeb('0x26')](handleEntityNotFound(_0x294c17,null))[_0xdaeb('0x26')](function(_0x573168){var _0x4c7fce=_['map'](_0x573168,'id');var _0x4146f6=[];var _0x43e9ba=[];var _0x2b4637=squel[_0xdaeb('0x88')]();_0x2b4637[_0xdaeb('0x89')](_0xdaeb('0x8a'))[_0xdaeb('0x8b')](_0xdaeb('0x8c'),'tq')[_0xdaeb('0x8d')]('user_has_teams','ut',_0xdaeb('0x8e'))[_0xdaeb('0x40')]('VoicePrefixId\x20=\x20?',_0x266009[_0xdaeb('0x47')]['id']);for(var _0x161fab=0x0;_0x161fab<_0x573168[_0xdaeb('0x3a')];_0x161fab+=0x1){let _0x4be4e7=_0x573168[_0x161fab];for(var _0x537ffa=0x0;_0x537ffa<_0x4be4e7[_0xdaeb('0x7c')]['length'];_0x537ffa+=0x1){let _0x20a678=_0x4be4e7['Agents'][_0x537ffa];var _0x43dff7=_0x2b4637[_0xdaeb('0x8f')]();_0x43dff7[_0xdaeb('0x40')](_0xdaeb('0x90'),_0x20a678['id']);_0x43e9ba[_0xdaeb('0x62')](db['sequelize'][_0xdaeb('0x34')](_0x43dff7[_0xdaeb('0x91')](),{'type':db['sequelize']['QueryTypes'][_0xdaeb('0x92')]})[_0xdaeb('0x26')](function(_0x373682){if(_0x373682['length']===0x1){return _0x20a678['id'];}else{var _0x418914=_['every'](_[_0xdaeb('0x33')](_0x373682,_0xdaeb('0x93')),function(_0x514928){return _[_0xdaeb('0x94')](_0x4c7fce,_0x514928);});if(_0x418914){return _0x20a678['id'];}}}));}}return BPromise[_0xdaeb('0x95')](_0x43e9ba)[_0xdaeb('0x26')](function(_0x383217){_0x4146f6=_(_0x4146f6)[_0xdaeb('0x96')](_0x383217)[_0xdaeb('0x97')]()[_0xdaeb('0x98')]();return db[_0xdaeb('0x2d')][_0xdaeb('0x49')]({'where':{'id':_0x266009[_0xdaeb('0x47')]['id']}})[_0xdaeb('0x26')](function(_0x3450c9){return db['sequelize'][_0xdaeb('0x4c')](function(_0x7c1d3c){return _0x3450c9[_0xdaeb('0x86')](_0x266009[_0xdaeb('0x34')][_0xdaeb('0x6f')],{'transaction':_0x7c1d3c})[_0xdaeb('0x26')](function(){if(!_[_0xdaeb('0x99')](_0x4146f6)){return _0x3450c9[_0xdaeb('0x74')](_0x4146f6,{'transaction':_0x7c1d3c});}})[_0xdaeb('0x26')](function(){_0x4146f6['forEach'](function(_0x9fcb7d){socket['emit'](_0xdaeb('0x75'),{'UserId':_0x9fcb7d,'VoicePrefixId':_0x3450c9['id']});});});});});});})[_0xdaeb('0x26')](respondWithStatusCode(_0x294c17,null))[_0xdaeb('0x45')](handleError(_0x294c17,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 5b732ef..3de3f73 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 _0x01fd=['hook','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4eeb7,_0x50ad2f){var _0x3f97c2=function(_0x2436b4){while(--_0x2436b4){_0x4eeb7['push'](_0x4eeb7['shift']());}};_0x3f97c2(++_0x50ad2f);}(_0x01fd,0x1de));var _0xd01f=function(_0x4392af,_0xec5afe){_0x4392af=_0x4392af-0x0;var _0x9fa8eb=_0x01fd[_0x4392af];return _0x9fa8eb;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xd01f('0x0'))['db'][_0xd01f('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xd01f('0x2')](0x0);var events={'afterCreate':_0xd01f('0x3'),'afterUpdate':_0xd01f('0x4'),'afterDestroy':_0xd01f('0x5')};function emitEvent(_0xf3b78b){return function(_0x49fe1e,_0x4ccce5,_0x3c2310){VoicePrefixEvents[_0xd01f('0x6')](_0xf3b78b+':'+_0x49fe1e['id'],_0x49fe1e);VoicePrefixEvents[_0xd01f('0x6')](_0xf3b78b,_0x49fe1e);_0x3c2310(null);};}for(var e in events){if(events[_0xd01f('0x7')](e)){var event=events[e];VoicePrefix[_0xd01f('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xfa43=['emit','hook','exports','VoicePrefix','setMaxListeners','save','update'];(function(_0x2dc5b7,_0x3837ba){var _0x4edb5b=function(_0x3ed644){while(--_0x3ed644){_0x2dc5b7['push'](_0x2dc5b7['shift']());}};_0x4edb5b(++_0x3837ba);}(_0xfa43,0xab));var _0x3fa4=function(_0x44f630,_0xcdd7f8){_0x44f630=_0x44f630-0x0;var _0x3633ef=_0xfa43[_0x44f630];return _0x3633ef;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x3fa4('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x3fa4('0x1')](0x0);var events={'afterCreate':_0x3fa4('0x2'),'afterUpdate':_0x3fa4('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3adb05){return function(_0xbce03d,_0x2b4538,_0x53311a){VoicePrefixEvents['emit'](_0x3adb05+':'+_0xbce03d['id'],_0xbce03d);VoicePrefixEvents[_0x3fa4('0x4')](_0x3adb05,_0xbce03d);_0x53311a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x3fa4('0x5')](e,emitEvent(event));}}module[_0x3fa4('0x6')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index b04150b..563f310 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 _0xbe9b=['lodash','api','moment','bluebird','request-promise','../../config/environment','exports','define','voice_prefixes'];(function(_0x3c34c1,_0x22a99f){var _0x399fcf=function(_0xcb88){while(--_0xcb88){_0x3c34c1['push'](_0x3c34c1['shift']());}};_0x399fcf(++_0x22a99f);}(_0xbe9b,0xe1));var _0xbbe9=function(_0xa5d82d,_0x3408f5){_0xa5d82d=_0xa5d82d-0x0;var _0x3f104c=_0xbe9b[_0xa5d82d];return _0x3f104c;};'use strict';var _=require(_0xbbe9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbbe9('0x1'));var moment=require(_0xbbe9('0x2'));var BPromise=require(_0xbbe9('0x3'));var rp=require(_0xbbe9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbbe9('0x5'));var attributes=require('./voicePrefix.attributes');module[_0xbbe9('0x6')]=function(_0x59dad3,_0x27ec27){return _0x59dad3[_0xbbe9('0x7')]('VoicePrefix',attributes,{'tableName':_0xbbe9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6ff=['util','../../config/logger','moment','bluebird','request-promise','rimraf','./voicePrefix.attributes','define','voice_prefixes'];(function(_0x3e191f,_0x3ff864){var _0x195058=function(_0x524218){while(--_0x524218){_0x3e191f['push'](_0x3e191f['shift']());}};_0x195058(++_0x3ff864);}(_0xb6ff,0x14d));var _0xfb6f=function(_0x102f97,_0x5bda2f){_0x102f97=_0x102f97-0x0;var _0xd22058=_0xb6ff[_0x102f97];return _0xd22058;};'use strict';var _=require('lodash');var util=require(_0xfb6f('0x0'));var logger=require(_0xfb6f('0x1'))('api');var moment=require(_0xfb6f('0x2'));var BPromise=require(_0xfb6f('0x3'));var rp=require(_0xfb6f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb6f('0x5'));var config=require('../../config/environment');var attributes=require(_0xfb6f('0x6'));module['exports']=function(_0x4fdd24,_0x249695){return _0x4fdd24[_0xfb6f('0x7')]('VoicePrefix',attributes,{'tableName':_0xfb6f('0x8'),'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 3aa2cb1..813975d 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 _0x341c=['defaults','localhost','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x38edf7,_0x24b17e){var _0x41f4ee=function(_0x453ccc){while(--_0x453ccc){_0x38edf7['push'](_0x38edf7['shift']());}};_0x41f4ee(++_0x24b17e);}(_0x341c,0xcc));var _0xc341=function(_0x5d31ee,_0x183e43){_0x5d31ee=_0x5d31ee-0x0;var _0x21c2e6=_0x341c[_0x5d31ee];return _0x21c2e6;};'use strict';var _=require(_0xc341('0x0'));var util=require('util');var moment=require(_0xc341('0x1'));var BPromise=require('bluebird');var rs=require(_0xc341('0x2'));var fs=require('fs');var Redis=require(_0xc341('0x3'));var db=require(_0xc341('0x4'))['db'];var utils=require(_0xc341('0x5'));var logger=require(_0xc341('0x6'))(_0xc341('0x7'));var config=require(_0xc341('0x8'));var jayson=require(_0xc341('0x9'));var client=jayson['client'][_0xc341('0xa')]({'port':0x232a});config[_0xc341('0xb')]=_[_0xc341('0xc')](config[_0xc341('0xb')],{'host':_0xc341('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc341('0xb')]));require(_0xc341('0xe'))[_0xc341('0xf')](socket);function respondWithRpcPromise(_0x8d2f4c,_0x3d5d26,_0x10a48d){return new BPromise(function(_0x4c5087,_0x2d08da){return client[_0xc341('0x10')](_0x8d2f4c,_0x10a48d)[_0xc341('0x11')](function(_0xa0ae63){logger[_0xc341('0x12')](_0xc341('0x13'),_0x3d5d26,'request\x20sent');logger['debug'](_0xc341('0x14'),_0x3d5d26,_0xc341('0x15'),JSON[_0xc341('0x16')](_0xa0ae63));if(_0xa0ae63[_0xc341('0x17')]){if(_0xa0ae63[_0xc341('0x17')]['code']===0x1f4){logger[_0xc341('0x17')](_0xc341('0x13'),_0x3d5d26,_0xa0ae63[_0xc341('0x17')][_0xc341('0x18')]);return _0x2d08da(_0xa0ae63[_0xc341('0x17')][_0xc341('0x18')]);}logger[_0xc341('0x17')](_0xc341('0x13'),_0x3d5d26,_0xa0ae63[_0xc341('0x17')][_0xc341('0x18')]);return _0x4c5087(_0xa0ae63[_0xc341('0x17')]['message']);}else{logger['info'](_0xc341('0x13'),_0x3d5d26,_0xc341('0x15'));_0x4c5087(_0xa0ae63[_0xc341('0x19')][_0xc341('0x18')]);}})[_0xc341('0x1a')](function(_0x3555c1){logger[_0xc341('0x17')](_0xc341('0x13'),_0x3d5d26,_0x3555c1);_0x2d08da(_0x3555c1);});});} \ No newline at end of file +var _0xab54=['localhost','socket.io-emitter','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','redis'];(function(_0x583453,_0x1ce51c){var _0x4169de=function(_0x1296e5){while(--_0x1296e5){_0x583453['push'](_0x583453['shift']());}};_0x4169de(++_0x1ce51c);}(_0xab54,0x115));var _0x4ab5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xab54[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x4ab5('0x0'));var moment=require(_0x4ab5('0x1'));var BPromise=require(_0x4ab5('0x2'));var rs=require(_0x4ab5('0x3'));var fs=require('fs');var Redis=require(_0x4ab5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4ab5('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4ab5('0x6'));var client=jayson[_0x4ab5('0x7')]['http']({'port':0x232a});config[_0x4ab5('0x8')]=_['defaults'](config[_0x4ab5('0x8')],{'host':_0x4ab5('0x9'),'port':0x18eb});var socket=require(_0x4ab5('0xa'))(new Redis(config[_0x4ab5('0x8')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x5f5209,_0x30ef3d,_0x168817){return new BPromise(function(_0x5326a6,_0x32a206){return client[_0x4ab5('0xb')](_0x5f5209,_0x168817)['then'](function(_0x139648){logger[_0x4ab5('0xc')](_0x4ab5('0xd'),_0x30ef3d,_0x4ab5('0xe'));logger[_0x4ab5('0xf')](_0x4ab5('0x10'),_0x30ef3d,_0x4ab5('0xe'),JSON[_0x4ab5('0x11')](_0x139648));if(_0x139648[_0x4ab5('0x12')]){if(_0x139648[_0x4ab5('0x12')][_0x4ab5('0x13')]===0x1f4){logger[_0x4ab5('0x12')](_0x4ab5('0xd'),_0x30ef3d,_0x139648[_0x4ab5('0x12')]['message']);return _0x32a206(_0x139648[_0x4ab5('0x12')]['message']);}logger[_0x4ab5('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x30ef3d,_0x139648['error'][_0x4ab5('0x14')]);return _0x5326a6(_0x139648[_0x4ab5('0x12')][_0x4ab5('0x14')]);}else{logger[_0x4ab5('0xc')]('VoicePrefix,\x20%s,\x20%s',_0x30ef3d,_0x4ab5('0xe'));_0x5326a6(_0x139648[_0x4ab5('0x15')]['message']);}})['catch'](function(_0x5d0afa){logger[_0x4ab5('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x30ef3d,_0x5d0afa);_0x32a206(_0x5d0afa);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 0d9a45b..72ceb59 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 _0x0901=['removeListener','register','length','voicePrefix:','./voicePrefix.events','save','remove','update'];(function(_0x163742,_0x467e36){var _0x1152ac=function(_0x40a83d){while(--_0x40a83d){_0x163742['push'](_0x163742['shift']());}};_0x1152ac(++_0x467e36);}(_0x0901,0x134));var _0x1090=function(_0x31fd28,_0xc2382a){_0x31fd28=_0x31fd28-0x0;var _0x51773c=_0x0901[_0x31fd28];return _0x51773c;};'use strict';var VoicePrefixEvents=require(_0x1090('0x0'));var events=[_0x1090('0x1'),_0x1090('0x2'),_0x1090('0x3')];function createListener(_0x448052,_0x39d2f1){return function(_0x57800a){_0x39d2f1['emit'](_0x448052,_0x57800a);};}function removeListener(_0x698fbb,_0xf8da8c){return function(){VoicePrefixEvents[_0x1090('0x4')](_0x698fbb,_0xf8da8c);};}exports[_0x1090('0x5')]=function(_0x9a1121){for(var _0x395921=0x0,_0x4c4e89=events[_0x1090('0x6')];_0x395921<_0x4c4e89;_0x395921++){var _0x3c1afe=events[_0x395921];var _0x5cd3f0=createListener(_0x1090('0x7')+_0x3c1afe,_0x9a1121);VoicePrefixEvents['on'](_0x3c1afe,_0x5cd3f0);}}; \ No newline at end of file +var _0xd353=['update','emit','removeListener','register','length','voicePrefix:','./voicePrefix.events','save'];(function(_0x4af4a0,_0x1f1a3b){var _0x3bb9c7=function(_0x16de40){while(--_0x16de40){_0x4af4a0['push'](_0x4af4a0['shift']());}};_0x3bb9c7(++_0x1f1a3b);}(_0xd353,0x7e));var _0x3d35=function(_0x56ecb0,_0x40ece1){_0x56ecb0=_0x56ecb0-0x0;var _0xce5ee7=_0xd353[_0x56ecb0];return _0xce5ee7;};'use strict';var VoicePrefixEvents=require(_0x3d35('0x0'));var events=[_0x3d35('0x1'),'remove',_0x3d35('0x2')];function createListener(_0x408bd9,_0x4e0c68){return function(_0x528f0e){_0x4e0c68[_0x3d35('0x3')](_0x408bd9,_0x528f0e);};}function removeListener(_0x4e0869,_0x3bc47e){return function(){VoicePrefixEvents[_0x3d35('0x4')](_0x4e0869,_0x3bc47e);};}exports[_0x3d35('0x5')]=function(_0xb43971){for(var _0x16965f=0x0,_0x174b6b=events[_0x3d35('0x6')];_0x16965f<_0x174b6b;_0x16965f++){var _0x5db879=events[_0x16965f];var _0x2dd75b=createListener(_0x3d35('0x7')+_0x5db879,_0xb43971);VoicePrefixEvents['on'](_0x5db879,_0x2dd75b);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index fc8e0d6..bdfb86d 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 _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x4486ee,_0x85b039){var _0x2713cb=function(_0x2b67f0){while(--_0x2b67f0){_0x4486ee['push'](_0x4486ee['shift']());}};_0x2713cb(++_0x85b039);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +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(_0x43941d,_0x45fd0d){var _0x27b82a=function(_0x21851e){while(--_0x21851e){_0x43941d['push'](_0x43941d['shift']());}};_0x27b82a(++_0x45fd0d);}(_0xb10b,0x12a));var _0xbb10=function(_0x40a107,_0x5acc82){_0x40a107=_0x40a107-0x0;var _0x4beb59=_0xb10b[_0x40a107];return _0x4beb59;};'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 ae4b3df..9476c01 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 _0x1be7=['type','getDataValue','dialMethod','booked','roundrobin','includes','INTEGER','yes','all','once','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','acw','wrapuptime','BOOLEAN','preview','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','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\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#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)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','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\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','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','STRING','name','ENUM','outbound','inbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy'];(function(_0x1a0f1f,_0x265d11){var _0x44fc63=function(_0x34d1a5){while(--_0x34d1a5){_0x1a0f1f['push'](_0x1a0f1f['shift']());}};_0x44fc63(++_0x265d11);}(_0x1be7,0x197));var _0x71be=function(_0x529185,_0x5f5ef5){_0x529185=_0x529185-0x0;var _0x541314=_0x1be7[_0x529185];return _0x541314;};'use strict';var Sequelize=require(_0x71be('0x0'));module[_0x71be('0x1')]={'name':{'type':Sequelize[_0x71be('0x2')],'allowNull':![],'unique':_0x71be('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x71be('0x4')]('inbound',_0x71be('0x5')),'allowNull':![],'defaultValue':_0x71be('0x6')},'musiconhold':{'type':Sequelize[_0x71be('0x2')],'defaultValue':_0x71be('0x7')},'announce':{'type':Sequelize[_0x71be('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x71be('0x4')]('rr',_0x71be('0x8'),_0x71be('0x9'),_0x71be('0xa'),_0x71be('0xb'),_0x71be('0xc'),_0x71be('0xd'),_0x71be('0xe'),_0x71be('0xf')),'allowNull':![],'defaultValue':_0x71be('0x8'),'set':function(_0x4c213e){this[_0x71be('0x10')](_0x71be('0x11'),_0x4c213e?_0x4c213e:_0x71be('0xc'));},'get':function(){var _0x30bfb6=this['getDataValue'](_0x71be('0x12'));var _0x10460b=this[_0x71be('0x13')](_0x71be('0x14'));var _0x2a92e8=this['getDataValue'](_0x71be('0x11'));if(_0x30bfb6==='outbound'){if(_0x10460b==='preview'){return null;}if(_0x10460b===_0x71be('0x15')&&![_0x71be('0xc'),_0x71be('0x16')][_0x71be('0x17')](_0x2a92e8)){this['setDataValue']('strategy','rrmemory');}}return _0x2a92e8;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x71be('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x71be('0x18')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x71be('0x18')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x71be('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x71be('0x18')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x71be('0x4')](_0x71be('0x19'),'no'),'defaultValue':_0x71be('0x19')},'autopause':{'type':Sequelize[_0x71be('0x4')]('yes','no',_0x71be('0x1a')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x71be('0x18')](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x71be('0x4')](_0x71be('0x19'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x71be('0x18')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x71be('0x4')](_0x71be('0x19'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x71be('0x19'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x71be('0x4')](_0x71be('0x19'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x71be('0x19'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x71be('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x71be('0x18')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x71be('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x71be('0x4')](_0x71be('0x19'),'no'),'defaultValue':_0x71be('0x19')},'announce_holdtime':{'type':Sequelize[_0x71be('0x4')](_0x71be('0x19'),'no',_0x71be('0x1b')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x71be('0x4')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x71be('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x71be('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x71be('0x2')]},'queue_youarenext':{'type':Sequelize[_0x71be('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x71be('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x71be('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x71be('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x71be('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x71be('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x71be('0x2')]},'periodic_announce':{'type':Sequelize[_0x71be('0x1c')],'set':function(_0x56c419){this[_0x71be('0x10')](_0x71be('0x1d'),_0x56c419?_0x56c419[_0x71be('0x1e')](','):[]);},'get':function(){return this['getDataValue'](_0x71be('0x1d'))?this['getDataValue'](_0x71be('0x1d'))['split'](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x71be('0x19'),'set':function(_0x332ff2){this[_0x71be('0x10')](_0x71be('0x1f'),_0x332ff2?_0x332ff2[_0x71be('0x1e')](','):undefined);},'get':function(){return this['getDataValue'](_0x71be('0x1f'))?this[_0x71be('0x13')](_0x71be('0x1f'))[_0x71be('0x20')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x292672){this[_0x71be('0x10')](_0x71be('0x21'),_0x292672?_0x292672[_0x71be('0x1e')](','):undefined);},'get':function(){return this['getDataValue'](_0x71be('0x21'))?this['getDataValue']('leavewhenempty')[_0x71be('0x20')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x71be('0x4')](_0x71be('0x19'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x71be('0x4')](_0x71be('0x19'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x71be('0x18')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x71be('0x19'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x71be('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x5bd08b){this[_0x71be('0x10')](_0x71be('0x22'),_0x5bd08b);if(_0x5bd08b){if(this['getDataValue'](_0x71be('0x23'))<0x2){this[_0x71be('0x10')](_0x71be('0x23'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x71be('0x18')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x71be('0x24')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x71be('0x4')](_0x71be('0x25'),'progressive',_0x71be('0x26'),'predictive','booked'),'defaultValue':'progressive','comment':_0x71be('0x27')},'dialLimitChannel':{'type':Sequelize[_0x71be('0x18')](0x4)[_0x71be('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x71be('0x29')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x71be('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x71be('0x2a')},'dialPowerLevel':{'type':Sequelize[_0x71be('0x2b')](0x2)[_0x71be('0x28')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x71be('0x2c')},'dialPredictiveOptimization':{'type':Sequelize[_0x71be('0x4')](_0x71be('0x2d'),'dropRate'),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x71be('0x2b')](0x2)[_0x71be('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x71be('0x2e')},'dialPredictiveInterval':{'type':Sequelize[_0x71be('0x18')](0x3)[_0x71be('0x28')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x71be('0x2f')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x71be('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x71be('0x18')](0x3)[_0x71be('0x28')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x71be('0x30')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0x71be('0x31')},'dialQueueTimeout':{'type':Sequelize[_0x71be('0x18')](0x3)[_0x71be('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x71be('0x32')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x71be('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x71be('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x71be('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x71be('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x71be('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0x71be('0x18')](0x5)[_0x71be('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x71be('0x18')](0x3)[_0x71be('0x28')],'defaultValue':0x3,'comment':_0x71be('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x71be('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x71be('0x36')},'dialGlobalMaxRetry':{'type':Sequelize[_0x71be('0x18')](0x3)[_0x71be('0x28')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x71be('0x37')},'dialTimezone':{'type':Sequelize[_0x71be('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x71be('0x38')},'dialPrefix':{'type':Sequelize[_0x71be('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x71be('0x39'),_0x71be('0x3a'),_0x71be('0x3b')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x71be('0x24')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x71be('0x18')](0x9)[_0x71be('0x28')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x71be('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0x71be('0x18')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x71be('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x71be('0x18')](0x9)[_0x71be('0x28')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x71be('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x71be('0x18')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x71be('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0x71be('0x18')](0x9)[_0x71be('0x28')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x71be('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x71be('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x71be('0x28')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x71be('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x71be('0x18')](0x5)[_0x71be('0x28')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x71be('0x43')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x71be('0x18')](0x5)[_0x71be('0x28')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x71be('0x44')},'dialRecallInQueue':{'type':Sequelize[_0x71be('0x24')],'defaultValue':0x0,'comment':_0x71be('0x45')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x71be('0x46'),_0x71be('0x47')),'defaultValue':_0x71be('0x46')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x71be('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x71be('0x24')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x71be('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x71be('0x48')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x71be('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x71be('0x49')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x71be('0x18')](0x5)[_0x71be('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x71be('0x4a')},'dialDropMaxRetry':{'type':Sequelize[_0x71be('0x18')](0x3)[_0x71be('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x71be('0x4b')},'dialDropRetryFrequency':{'type':Sequelize[_0x71be('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x71be('0x18')](0x3)[_0x71be('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x71be('0x4c')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x71be('0x4d')},'dialMachineMaxRetry':{'type':Sequelize[_0x71be('0x18')](0x3)[_0x71be('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x71be('0x4e')},'dialMachineRetryFrequency':{'type':Sequelize[_0x71be('0x18')](0x5)[_0x71be('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x71be('0x4f')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x71be('0x18')](0x3)[_0x71be('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x71be('0x50')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x71be('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x71be('0x51')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x71be('0x18')],'allowNull':!![],'comment':_0x71be('0x52')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x71be('0x53'),'set':function(_0x6bf1ae){if(!_0x6bf1ae)this[_0x71be('0x10')](_0x71be('0x54'),null);this['setDataValue']('mandatoryDisposition',_0x6bf1ae);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x71be('0x18')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x71be('0x18')](0x3)[_0x71be('0x28')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x71be('0x24')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x71be('0x18')](0x3)[_0x71be('0x28')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x2a56=['TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','booked','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#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)','always','#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)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','mandatoryDisposition','sequelize','STRING','name','ENUM','inbound','outbound','default','leastrecent','fewestcalls','random','rrmemory','linear','rrordered','ringall','setDataValue','type','getDataValue','includes','strategy','INTEGER','yes','all','once'];(function(_0x279870,_0x178212){var _0x57b140=function(_0x3ef296){while(--_0x3ef296){_0x279870['push'](_0x279870['shift']());}};_0x57b140(++_0x178212);}(_0x2a56,0x174));var _0x62a5=function(_0x329e2f,_0x2a865e){_0x329e2f=_0x329e2f-0x0;var _0x52cd65=_0x2a56[_0x329e2f];return _0x52cd65;};'use strict';var Sequelize=require(_0x62a5('0x0'));module['exports']={'name':{'type':Sequelize[_0x62a5('0x1')],'allowNull':![],'unique':_0x62a5('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x62a5('0x3')](_0x62a5('0x4'),_0x62a5('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x62a5('0x6')},'announce':{'type':Sequelize[_0x62a5('0x1')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall',_0x62a5('0x7'),_0x62a5('0x8'),_0x62a5('0x9'),_0x62a5('0xa'),_0x62a5('0xb'),'wrandom',_0x62a5('0xc')),'allowNull':![],'defaultValue':_0x62a5('0xd'),'set':function(_0x53ff81){this[_0x62a5('0xe')]('strategy',_0x53ff81?_0x53ff81:_0x62a5('0xa'));},'get':function(){var _0x2a3916=this['getDataValue'](_0x62a5('0xf'));var _0x5415d9=this[_0x62a5('0x10')]('dialMethod');var _0x559fed=this[_0x62a5('0x10')]('strategy');if(_0x2a3916===_0x62a5('0x5')){if(_0x5415d9==='preview'){return null;}if(_0x5415d9==='booked'&&![_0x62a5('0xa'),'roundrobin'][_0x62a5('0x11')](_0x559fed)){this[_0x62a5('0xe')](_0x62a5('0x12'),_0x62a5('0xa'));}}return _0x559fed;}},'servicelevel':{'type':Sequelize[_0x62a5('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x62a5('0x13')](0xb)},'timeout':{'type':Sequelize[_0x62a5('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x62a5('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x62a5('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x62a5('0x3')](_0x62a5('0x14'),'no'),'defaultValue':_0x62a5('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x62a5('0x14'),'no',_0x62a5('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x62a5('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x62a5('0x3')](_0x62a5('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x62a5('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x62a5('0x3')](_0x62a5('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x62a5('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x62a5('0x3')](_0x62a5('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x62a5('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x62a5('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x62a5('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x62a5('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x62a5('0x3')](_0x62a5('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x62a5('0x14'),'no'),'defaultValue':_0x62a5('0x14')},'announce_holdtime':{'type':Sequelize[_0x62a5('0x3')](_0x62a5('0x14'),'no',_0x62a5('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x62a5('0x3')](_0x62a5('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0x62a5('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x62a5('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x62a5('0x1')]},'queue_youarenext':{'type':Sequelize[_0x62a5('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x62a5('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x62a5('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x62a5('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x62a5('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x62a5('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x62a5('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x62a5('0x1')]},'queue_quantity1':{'type':Sequelize[_0x62a5('0x1')]},'queue_quantity2':{'type':Sequelize[_0x62a5('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x62a5('0x1')]},'queue_less_than':{'type':Sequelize[_0x62a5('0x1')]},'periodic_announce':{'type':Sequelize[_0x62a5('0x17')],'set':function(_0x5507da){this[_0x62a5('0xe')](_0x62a5('0x18'),_0x5507da?_0x5507da[_0x62a5('0x19')](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this[_0x62a5('0x10')]('periodic_announce')[_0x62a5('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x62a5('0x1')],'defaultValue':_0x62a5('0x14'),'set':function(_0x399423){this[_0x62a5('0xe')](_0x62a5('0x1b'),_0x399423?_0x399423[_0x62a5('0x19')](','):undefined);},'get':function(){return this[_0x62a5('0x10')]('joinempty')?this[_0x62a5('0x10')](_0x62a5('0x1b'))[_0x62a5('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x62a5('0x1')],'defaultValue':'no','set':function(_0x372012){this[_0x62a5('0xe')](_0x62a5('0x1c'),_0x372012?_0x372012['join'](','):undefined);},'get':function(){return this[_0x62a5('0x10')]('leavewhenempty')?this['getDataValue'](_0x62a5('0x1c'))[_0x62a5('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x62a5('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x62a5('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x62a5('0x3')](_0x62a5('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x62a5('0x1')]},'description':{'type':Sequelize[_0x62a5('0x1')]},'acw':{'type':Sequelize[_0x62a5('0x1d')],'defaultValue':0x0,'set':function(_0x2464e4){this['setDataValue'](_0x62a5('0x1e'),_0x2464e4);if(_0x2464e4){if(this[_0x62a5('0x10')](_0x62a5('0x1f'))<0x2){this[_0x62a5('0xe')](_0x62a5('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x62a5('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x62a5('0x1d')],'defaultValue':0x0,'comment':_0x62a5('0x20')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0x62a5('0x21'),_0x62a5('0x22'),_0x62a5('0x23'),_0x62a5('0x24')),'defaultValue':_0x62a5('0x21'),'comment':_0x62a5('0x25')},'dialLimitChannel':{'type':Sequelize[_0x62a5('0x13')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x62a5('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x62a5('0x27')},'dialPowerLevel':{'type':Sequelize[_0x62a5('0x28')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x62a5('0x3')](_0x62a5('0x29'),_0x62a5('0x2a')),'defaultValue':_0x62a5('0x2a'),'comment':_0x62a5('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x62a5('0x28')](0x2)[_0x62a5('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x62a5('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x62a5('0x13')](0x3)[_0x62a5('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x62a5('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0x62a5('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x62a5('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x62a5('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62a5('0x2e')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x62a5('0x2f'),'comment':_0x62a5('0x30')},'dialQueueTimeout':{'type':Sequelize[_0x62a5('0x13')](0x3)[_0x62a5('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62a5('0x31')},'dialQueueProject':{'type':Sequelize[_0x62a5('0x1')],'comment':_0x62a5('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x62a5('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62a5('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x62a5('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x62a5('0x13')](0x3)[_0x62a5('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62a5('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0x62a5('0x13')](0x5)[_0x62a5('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x62a5('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x62a5('0x26')],'defaultValue':0x3,'comment':_0x62a5('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x62a5('0x13')](0x5)[_0x62a5('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x62a5('0x37')},'dialGlobalMaxRetry':{'type':Sequelize[_0x62a5('0x13')](0x3)[_0x62a5('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x62a5('0x38')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x62a5('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x62a5('0x3')](_0x62a5('0x39'),'never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x62a5('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x62a5('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x62a5('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0x62a5('0x13')](0x9)[_0x62a5('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x62a5('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x62a5('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x62a5('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x62a5('0x13')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x62a5('0x3d')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x62a5('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x62a5('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x62a5('0x13')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x62a5('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x62a5('0x13')](0x9)[_0x62a5('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x62a5('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x62a5('0x13')](0x5)[_0x62a5('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x62a5('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x62a5('0x13')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x62a5('0x13')](0x5)[_0x62a5('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x62a5('0x42')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x62a5('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0x62a5('0x3')]('DESC',_0x62a5('0x44')),'defaultValue':_0x62a5('0x45')},'dialQueueProject2':{'type':Sequelize[_0x62a5('0x1')],'comment':_0x62a5('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x62a5('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x62a5('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x62a5('0x13')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x62a5('0x46')},'dialCutDigit':{'type':Sequelize[_0x62a5('0x13')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x62a5('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62a5('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x62a5('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x62a5('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62a5('0x49')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x62a5('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x62a5('0x13')](0x3)[_0x62a5('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62a5('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x62a5('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x62a5('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0x62a5('0x13')](0x3)[_0x62a5('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x62a5('0x13')](0x5)[_0x62a5('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x62a5('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x62a5('0x13')](0x3)[_0x62a5('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62a5('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x62a5('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x62a5('0x13')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x62a5('0x1d')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5e9f04){if(!_0x5e9f04)this[_0x62a5('0xe')]('mandatoryDispositionPauseId',null);this[_0x62a5('0xe')](_0x62a5('0x4e'),_0x5e9f04);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x62a5('0x13')](0x3)[_0x62a5('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x62a5('0x13')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x62a5('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x62a5('0x1d')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 038a403..635c674 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 _0xbff5=['emit','userVoiceQueue:save','removeTeams','ids','select','field','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','all','compact','sequelize','removeAgents','userVoiceQueue:remove','addAgents','spread','isEmpty','push','format','SIP/%s','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','into','fromQuery','phone','ListId','scheduledAt','ContactId','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','cm_hopper','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','insert','CmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','localhost','./voiceQueue.socket','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','QueueCampaigns','outbound','filter','value','includes','type','find','UserProfileResource','error','stack','name','send','index','map','VoiceQueue','rawAttributes','key','model','keys','query','filters','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','catch','show','params','intersection','includeAll','create','body','user','VoiceQueues','inbound','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','update','getHoppers','findOne','CmHopper','VoiceQueueId','rows','hasOwnProperty','CmHopperHistory','getHopperFinals','CmHopperFinal','findAll','CmHopperBlack','getTeams','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','transaction','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil'];(function(_0x253165,_0x32115c){var _0x564756=function(_0x27f0a6){while(--_0x27f0a6){_0x253165['push'](_0x253165['shift']());}};_0x564756(++_0x32115c);}(_0xbff5,0x1bc));var _0x5bff=function(_0x48c33f,_0x23b7c4){_0x48c33f=_0x48c33f-0x0;var _0x27336b=_0xbff5[_0x48c33f];return _0x27336b;};'use strict';var emlformat=require(_0x5bff('0x0'));var rimraf=require(_0x5bff('0x1'));var zipdir=require(_0x5bff('0x2'));var jsonpatch=require(_0x5bff('0x3'));var rp=require(_0x5bff('0x4'));var moment=require(_0x5bff('0x5'));var BPromise=require(_0x5bff('0x6'));var Mustache=require('mustache');var util=require(_0x5bff('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5bff('0x8'));var ejs=require(_0x5bff('0x9'));var fs=require('fs');var fs_extra=require(_0x5bff('0xa'));var _=require(_0x5bff('0xb'));var squel=require(_0x5bff('0xc'));var crypto=require(_0x5bff('0xd'));var jsforce=require(_0x5bff('0xe'));var deskjs=require(_0x5bff('0xf'));var toCsv=require(_0x5bff('0x8'));var querystring=require('querystring');var Papa=require(_0x5bff('0x10'));var Redis=require('ioredis');var authService=require(_0x5bff('0x11'));var qs=require(_0x5bff('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bff('0x13'));var logger=require('../../config/logger')(_0x5bff('0x14'));var utils=require('../../config/utils');var config=require(_0x5bff('0x15'));var licenseUtil=require(_0x5bff('0x16'));var db=require('../../mysqldb')['db'];config[_0x5bff('0x17')]=_['defaults'](config[_0x5bff('0x17')],{'host':_0x5bff('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5bff('0x17')]));require(_0x5bff('0x19'))['register'](socket);function respondWithStatusCode(_0x5f2a55,_0x378eca){_0x378eca=_0x378eca||0xcc;return function(_0x1d300e){if(_0x1d300e){return _0x5f2a55[_0x5bff('0x1a')](_0x378eca);}return _0x5f2a55['status'](_0x378eca)[_0x5bff('0x1b')]();};}function respondWithResult(_0x4612ec,_0xcb8995){_0xcb8995=_0xcb8995||0xc8;return function(_0x56c7b2){if(_0x56c7b2){return _0x4612ec[_0x5bff('0x1c')](_0xcb8995)[_0x5bff('0x1d')](_0x56c7b2);}};}function respondWithFilteredResult(_0x38daa0,_0x546351){return function(_0xc9fbc3){if(_0xc9fbc3){var _0x279c22=typeof _0x546351[_0x5bff('0x1e')]===_0x5bff('0x1f')&&typeof _0x546351['limit']===_0x5bff('0x1f');var _0x5357d4=_0xc9fbc3[_0x5bff('0x20')];var _0x4d0111=_0x279c22?0x0:_0x546351[_0x5bff('0x1e')];var _0x13d5d0=_0x279c22?_0xc9fbc3[_0x5bff('0x20')]:_0x546351[_0x5bff('0x1e')]+_0x546351[_0x5bff('0x21')];var _0x2012e4;if(_0x13d5d0>=_0x5357d4){_0x13d5d0=_0x5357d4;_0x2012e4=0xc8;}else{_0x2012e4=0xce;}_0x38daa0[_0x5bff('0x1c')](_0x2012e4);return _0x38daa0[_0x5bff('0x22')](_0x5bff('0x23'),_0x4d0111+'-'+_0x13d5d0+'/'+_0x5357d4)['json'](_0xc9fbc3);}return null;};}function patchUpdates(_0x5f2593){return function(_0x263cf5){try{jsonpatch[_0x5bff('0x24')](_0x263cf5,_0x5f2593,!![]);}catch(_0x1e7f8a){return BPromise[_0x5bff('0x25')](_0x1e7f8a);}return _0x263cf5[_0x5bff('0x26')]();};}function saveUpdates(_0x3913fd,_0x1ea853){return function(_0x5e2ae8){if(_0x5e2ae8){return _0x5e2ae8['update'](_0x3913fd)[_0x5bff('0x27')](function(_0x53bd97){return _0x53bd97;});}return null;};}function removeEntity(_0x220c8f,_0xcc091d){return function(_0x275246){if(_0x275246){return _0x275246[_0x5bff('0x28')]()[_0x5bff('0x27')](function(){var _0x1140eb=_0x275246[_0x5bff('0x29')]({'plain':!![]});var _0xedba9d=[{'name':'VoiceQueues','value':'inbound','ignore':![]},{'name':_0x5bff('0x2a'),'value':_0x5bff('0x2b'),'ignore':![]}];var _0x4d7640=_(_0xedba9d)[_0x5bff('0x2c')]('ignore')['map'](_0x5bff('0x2d'))['value']();if(_[_0x5bff('0x2e')](_0x4d7640,_0x1140eb[_0x5bff('0x2f')])){return;}var _0x2d692a=_[_0x5bff('0x30')](_0xedba9d,['value',_0x1140eb[_0x5bff('0x2f')]])['name'];return db[_0x5bff('0x31')]['destroy']({'where':{'type':_0x2d692a,'resourceId':_0x1140eb['id']}})[_0x5bff('0x27')](function(){return _0x275246;});})[_0x5bff('0x27')](function(){_0x220c8f[_0x5bff('0x1c')](0xcc)[_0x5bff('0x1b')]();});}};}function handleEntityNotFound(_0x44a970,_0x9894dd){return function(_0x49155d){if(!_0x49155d){_0x44a970[_0x5bff('0x1a')](0x194);}return _0x49155d;};}function handleError(_0x31c33f,_0x3fef83){_0x3fef83=_0x3fef83||0x1f4;return function(_0x42fe4a){logger[_0x5bff('0x32')](_0x42fe4a[_0x5bff('0x33')]);if(_0x42fe4a[_0x5bff('0x34')]){delete _0x42fe4a[_0x5bff('0x34')];}_0x31c33f['status'](_0x3fef83)[_0x5bff('0x35')](_0x42fe4a);};}exports[_0x5bff('0x36')]=function(_0x2f50e1,_0x320ff0){var _0x4fc35f={},_0x19cfc3={},_0x48ed7={'count':0x0,'rows':[]};var _0x5a24be=_[_0x5bff('0x37')](db[_0x5bff('0x38')][_0x5bff('0x39')],function(_0x28006e){return{'name':_0x28006e['fieldName'],'type':_0x28006e[_0x5bff('0x2f')][_0x5bff('0x3a')]};});_0x19cfc3[_0x5bff('0x3b')]=_['map'](_0x5a24be,_0x5bff('0x34'));_0x19cfc3['query']=_[_0x5bff('0x3c')](_0x2f50e1[_0x5bff('0x3d')]);_0x19cfc3[_0x5bff('0x3e')]=_['intersection'](_0x19cfc3[_0x5bff('0x3b')],_0x19cfc3[_0x5bff('0x3d')]);_0x4fc35f[_0x5bff('0x3f')]=_['intersection'](_0x19cfc3[_0x5bff('0x3b')],qs[_0x5bff('0x40')](_0x2f50e1['query'][_0x5bff('0x40')]));_0x4fc35f[_0x5bff('0x3f')]=_0x4fc35f[_0x5bff('0x3f')][_0x5bff('0x41')]?_0x4fc35f[_0x5bff('0x3f')]:_0x19cfc3['model'];if(!_0x2f50e1[_0x5bff('0x3d')]['hasOwnProperty'](_0x5bff('0x42'))){_0x4fc35f[_0x5bff('0x21')]=qs[_0x5bff('0x21')](_0x2f50e1[_0x5bff('0x3d')][_0x5bff('0x21')]);_0x4fc35f[_0x5bff('0x1e')]=qs[_0x5bff('0x1e')](_0x2f50e1['query']['offset']);}_0x4fc35f[_0x5bff('0x43')]=qs[_0x5bff('0x44')](_0x2f50e1[_0x5bff('0x3d')][_0x5bff('0x44')]);_0x4fc35f[_0x5bff('0x45')]=qs[_0x5bff('0x3e')](_[_0x5bff('0x46')](_0x2f50e1[_0x5bff('0x3d')],_0x19cfc3['filters']),_0x5a24be);if(_0x2f50e1[_0x5bff('0x3d')]['filter']){_0x4fc35f[_0x5bff('0x45')]=_[_0x5bff('0x47')](_0x4fc35f['where'],{'$or':_[_0x5bff('0x37')](_0x5a24be,function(_0x463c70){if(_0x463c70['type']!==_0x5bff('0x48')){var _0x11a75b={};_0x11a75b[_0x463c70[_0x5bff('0x34')]]={'$like':'%'+_0x2f50e1['query'][_0x5bff('0x2c')]+'%'};return _0x11a75b;}})});}_0x4fc35f=_[_0x5bff('0x47')]({},_0x4fc35f,_0x2f50e1[_0x5bff('0x49')]);var _0x5c0451={'where':_0x4fc35f[_0x5bff('0x45')]};return db[_0x5bff('0x38')][_0x5bff('0x20')](_0x5c0451)[_0x5bff('0x27')](function(_0x47d56c){_0x48ed7[_0x5bff('0x20')]=_0x47d56c;if(_0x2f50e1['query']['includeAll']){_0x4fc35f[_0x5bff('0x4a')]=[{'all':!![]}];}return db[_0x5bff('0x38')]['findAll'](_0x4fc35f);})[_0x5bff('0x27')](function(_0xbebf66){_0x48ed7['rows']=_0xbebf66;return _0x48ed7;})[_0x5bff('0x27')](respondWithFilteredResult(_0x320ff0,_0x4fc35f))[_0x5bff('0x4b')](handleError(_0x320ff0,null));};exports[_0x5bff('0x4c')]=function(_0x39c90f,_0x4ccf4d){var _0x579a8d={'raw':![],'where':{'id':_0x39c90f[_0x5bff('0x4d')]['id']}},_0x22f0b6={};_0x22f0b6[_0x5bff('0x3b')]=_[_0x5bff('0x3c')](db[_0x5bff('0x38')]['rawAttributes']);_0x22f0b6[_0x5bff('0x3d')]=_[_0x5bff('0x3c')](_0x39c90f['query']);_0x22f0b6[_0x5bff('0x3e')]=_['intersection'](_0x22f0b6['model'],_0x22f0b6['query']);_0x579a8d[_0x5bff('0x3f')]=_[_0x5bff('0x4e')](_0x22f0b6['model'],qs[_0x5bff('0x40')](_0x39c90f[_0x5bff('0x3d')][_0x5bff('0x40')]));_0x579a8d[_0x5bff('0x3f')]=_0x579a8d[_0x5bff('0x3f')]['length']?_0x579a8d[_0x5bff('0x3f')]:_0x22f0b6[_0x5bff('0x3b')];if(_0x39c90f['query'][_0x5bff('0x4f')]){_0x579a8d['include']=[{'all':!![]}];}_0x579a8d=_[_0x5bff('0x47')]({},_0x579a8d,_0x39c90f[_0x5bff('0x49')]);return db[_0x5bff('0x38')][_0x5bff('0x30')](_0x579a8d)[_0x5bff('0x27')](handleEntityNotFound(_0x4ccf4d,null))['then'](respondWithResult(_0x4ccf4d,null))[_0x5bff('0x4b')](handleError(_0x4ccf4d,null));};exports[_0x5bff('0x50')]=function(_0x5b4838,_0x3a7a54){return db[_0x5bff('0x38')]['create'](_0x5b4838[_0x5bff('0x51')],{})[_0x5bff('0x27')](function(_0x2bedd6){var _0x44b57a=_0x5b4838[_0x5bff('0x52')][_0x5bff('0x29')]({'plain':!![]});if(!_0x44b57a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44b57a['role']===_0x5bff('0x52')){var _0x599819=_0x2bedd6[_0x5bff('0x29')]({'plain':!![]});var _0x277b2e=[{'name':_0x5bff('0x53'),'value':_0x5bff('0x54')},{'name':_0x5bff('0x2a'),'value':_0x5bff('0x2b')}];var _0x40303f=_[_0x5bff('0x30')](_0x277b2e,[_0x5bff('0x2d'),_0x599819[_0x5bff('0x2f')]])[_0x5bff('0x34')];return db['UserProfileSection']['find']({'where':{'name':_0x40303f,'userProfileId':_0x44b57a[_0x5bff('0x55')]},'raw':!![]})['then'](function(_0x27e34d){if(_0x27e34d&&_0x27e34d['autoAssociation']===0x0){return db[_0x5bff('0x31')][_0x5bff('0x50')]({'name':_0x599819[_0x5bff('0x34')],'resourceId':_0x599819['id'],'type':_0x27e34d[_0x5bff('0x34')],'sectionId':_0x27e34d['id']},{})[_0x5bff('0x27')](function(){return _0x2bedd6;});}else{return _0x2bedd6;}})[_0x5bff('0x4b')](function(_0x344224){logger[_0x5bff('0x32')](_0x5bff('0x56'),_0x344224);throw _0x344224;});}return _0x2bedd6;})[_0x5bff('0x27')](respondWithResult(_0x3a7a54,0xc9))[_0x5bff('0x4b')](handleError(_0x3a7a54,null));};exports['clone']=function(_0x142854,_0x56eff2){var _0x54faf2={'where':{'id':_0x142854[_0x5bff('0x4d')]['id']}},_0x50e641={};_0x50e641['model']=_[_0x5bff('0x3c')](db[_0x5bff('0x38')][_0x5bff('0x39')]);_0x54faf2[_0x5bff('0x3f')]=_['intersection'](_0x50e641['model'],qs['fields'](_0x142854[_0x5bff('0x3d')][_0x5bff('0x40')]));_0x54faf2['attributes']=_0x54faf2[_0x5bff('0x3f')][_0x5bff('0x41')]?_0x54faf2[_0x5bff('0x3f')]:_0x50e641[_0x5bff('0x3b')];if(_0x142854[_0x5bff('0x3d')][_0x5bff('0x4f')]){_0x54faf2[_0x5bff('0x4a')]=[{'all':!![]}];}_0x54faf2=_[_0x5bff('0x47')]({},_0x54faf2,_0x142854[_0x5bff('0x49')]);return db[_0x5bff('0x38')][_0x5bff('0x30')](_0x54faf2)[_0x5bff('0x27')](handleEntityNotFound(_0x56eff2,null))[_0x5bff('0x27')](function(_0x33464a){if(_0x33464a){var _0x5e145d=_0x33464a[_0x5bff('0x29')]({'plain':!![]});_0x5e145d=qs[_0x5bff('0x57')](_0x5e145d,['id',_0x5bff('0x58'),_0x5bff('0x59')]);_0x142854[_0x5bff('0x51')]=_[_0x5bff('0x57')](_0x142854[_0x5bff('0x51')],['id',_0x5bff('0x58'),_0x5bff('0x59')]);return db[_0x5bff('0x38')][_0x5bff('0x50')](_[_0x5bff('0x47')](_0x5e145d,_0x142854[_0x5bff('0x51')]),{'include':_0x142854['query'][_0x5bff('0x4f')]?[{'all':!![]}]:undefined})[_0x5bff('0x27')](function(_0x24df6b){var _0x449245=_0x142854[_0x5bff('0x52')]['get']({'plain':!![]});if(!_0x449245)throw new Error(_0x5bff('0x5a'));if(_0x449245[_0x5bff('0x5b')]==='user'){var _0x1b35ae=_0x24df6b[_0x5bff('0x29')]({'plain':!![]});var _0x230fab=[{'name':'VoiceQueues','value':_0x5bff('0x54')},{'name':_0x5bff('0x2a'),'value':_0x5bff('0x2b')}];var _0x3bf744=_[_0x5bff('0x30')](_0x230fab,[_0x5bff('0x2d'),_0x1b35ae[_0x5bff('0x2f')]])[_0x5bff('0x34')];return db[_0x5bff('0x5c')][_0x5bff('0x30')]({'where':{'name':_0x3bf744,'userProfileId':_0x449245[_0x5bff('0x55')]},'raw':!![]})[_0x5bff('0x27')](function(_0x539224){if(_0x539224&&_0x539224['autoAssociation']===0x0){return db[_0x5bff('0x31')][_0x5bff('0x50')]({'name':_0x1b35ae[_0x5bff('0x34')],'resourceId':_0x1b35ae['id'],'type':_0x539224['name'],'sectionId':_0x539224['id']},{})[_0x5bff('0x27')](function(){return _0x24df6b;});}else{return _0x24df6b;}})['catch'](function(_0x5b3b25){logger[_0x5bff('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b3b25);throw _0x5b3b25;});}return _0x24df6b;});}})['then'](respondWithResult(_0x56eff2,0xc9))[_0x5bff('0x4b')](handleError(_0x56eff2,null));};exports[_0x5bff('0x5d')]=function(_0x4d6cc5,_0x29ed8d){if(_0x4d6cc5[_0x5bff('0x51')]['id']){delete _0x4d6cc5[_0x5bff('0x51')]['id'];}return db[_0x5bff('0x38')][_0x5bff('0x30')]({'where':{'id':_0x4d6cc5[_0x5bff('0x4d')]['id']}})[_0x5bff('0x27')](handleEntityNotFound(_0x29ed8d,null))[_0x5bff('0x27')](saveUpdates(_0x4d6cc5[_0x5bff('0x51')],null))[_0x5bff('0x27')](respondWithResult(_0x29ed8d,null))[_0x5bff('0x4b')](handleError(_0x29ed8d,null));};exports[_0x5bff('0x28')]=function(_0x2e51a3,_0x164b76){return db[_0x5bff('0x38')][_0x5bff('0x30')]({'where':{'id':_0x2e51a3[_0x5bff('0x4d')]['id']}})[_0x5bff('0x27')](handleEntityNotFound(_0x164b76,null))[_0x5bff('0x27')](removeEntity(_0x164b76,null))[_0x5bff('0x4b')](handleError(_0x164b76,null));};exports[_0x5bff('0x5e')]=function(_0x53c8d5,_0x8ffc8a,_0x36c26c){var _0x5c673e={'raw':![],'where':{}};var _0x29d02a={};var _0x5143cf={'count':0x0,'rows':[]};return db[_0x5bff('0x38')][_0x5bff('0x5f')]({'where':{'id':_0x53c8d5['params']['id']}})[_0x5bff('0x27')](handleEntityNotFound(_0x8ffc8a,null))[_0x5bff('0x27')](function(_0x417e57){if(_0x417e57){_0x29d02a[_0x5bff('0x3b')]=_[_0x5bff('0x3c')](db[_0x5bff('0x60')][_0x5bff('0x39')]);_0x29d02a[_0x5bff('0x3d')]=_[_0x5bff('0x3c')](_0x53c8d5[_0x5bff('0x3d')]);_0x29d02a[_0x5bff('0x3e')]=_['intersection'](_0x29d02a[_0x5bff('0x3b')],_0x29d02a[_0x5bff('0x3d')]);_0x5c673e['attributes']=_[_0x5bff('0x4e')](_0x29d02a[_0x5bff('0x3b')],qs[_0x5bff('0x40')](_0x53c8d5[_0x5bff('0x3d')][_0x5bff('0x40')]));_0x5c673e[_0x5bff('0x3f')]=_0x5c673e[_0x5bff('0x3f')][_0x5bff('0x41')]?_0x5c673e['attributes']:_0x29d02a['model'];if(!_0x53c8d5[_0x5bff('0x3d')]['hasOwnProperty'](_0x5bff('0x42'))){_0x5c673e[_0x5bff('0x21')]=qs[_0x5bff('0x21')](_0x53c8d5['query'][_0x5bff('0x21')]);_0x5c673e[_0x5bff('0x1e')]=qs[_0x5bff('0x1e')](_0x53c8d5[_0x5bff('0x3d')][_0x5bff('0x1e')]);}_0x5c673e[_0x5bff('0x43')]=qs['sort'](_0x53c8d5[_0x5bff('0x3d')][_0x5bff('0x44')]);_0x5c673e[_0x5bff('0x45')]=qs[_0x5bff('0x3e')](_['pick'](_0x53c8d5[_0x5bff('0x3d')],_0x29d02a['filters']));_0x5c673e[_0x5bff('0x45')][_0x5bff('0x61')]=_0x417e57['id'];if(_0x53c8d5[_0x5bff('0x3d')][_0x5bff('0x2c')]){_0x5c673e[_0x5bff('0x45')]=_[_0x5bff('0x47')](_0x5c673e[_0x5bff('0x45')],{'$or':_['map'](_0x5c673e[_0x5bff('0x3f')],function(_0x567816){var _0x4a3816={};_0x4a3816[_0x567816]={'$like':'%'+_0x53c8d5[_0x5bff('0x3d')][_0x5bff('0x2c')]+'%'};return _0x4a3816;})});}_0x5c673e=_['merge']({},_0x5c673e,_0x53c8d5['options']);return db[_0x5bff('0x60')][_0x5bff('0x20')]({'where':_0x5c673e[_0x5bff('0x45')]})[_0x5bff('0x27')](function(_0x4c6b4f){_0x5143cf[_0x5bff('0x20')]=_0x4c6b4f;if(_0x53c8d5['query'][_0x5bff('0x4f')]){_0x5c673e[_0x5bff('0x4a')]=[{'all':!![]}];}return db[_0x5bff('0x60')]['findAll'](_0x5c673e);})[_0x5bff('0x27')](function(_0x5a5e97){_0x5143cf[_0x5bff('0x62')]=_0x5a5e97;return _0x5143cf;});}})[_0x5bff('0x27')](respondWithFilteredResult(_0x8ffc8a,_0x5c673e))[_0x5bff('0x4b')](handleError(_0x8ffc8a,null));};exports['getHopperHistories']=function(_0x520e60,_0x28aee9,_0x3b0bb1){var _0x2b8ec5={'raw':!![],'where':{}};var _0x2bfdbc={};var _0x440c52={'count':0x0,'rows':[]};return db[_0x5bff('0x38')][_0x5bff('0x5f')]({'where':{'id':_0x520e60[_0x5bff('0x4d')]['id']}})[_0x5bff('0x27')](handleEntityNotFound(_0x28aee9,null))['then'](function(_0x435076){if(_0x435076){_0x2bfdbc[_0x5bff('0x3b')]=_[_0x5bff('0x3c')](db['CmHopperHistory']['rawAttributes']);_0x2bfdbc[_0x5bff('0x3d')]=_[_0x5bff('0x3c')](_0x520e60['query']);_0x2bfdbc['filters']=_[_0x5bff('0x4e')](_0x2bfdbc['model'],_0x2bfdbc[_0x5bff('0x3d')]);_0x2b8ec5[_0x5bff('0x3f')]=_[_0x5bff('0x4e')](_0x2bfdbc[_0x5bff('0x3b')],qs['fields'](_0x520e60[_0x5bff('0x3d')]['fields']));_0x2b8ec5[_0x5bff('0x3f')]=_0x2b8ec5[_0x5bff('0x3f')][_0x5bff('0x41')]?_0x2b8ec5[_0x5bff('0x3f')]:_0x2bfdbc[_0x5bff('0x3b')];if(!_0x520e60['query'][_0x5bff('0x63')](_0x5bff('0x42'))){_0x2b8ec5['limit']=qs[_0x5bff('0x21')](_0x520e60[_0x5bff('0x3d')][_0x5bff('0x21')]);_0x2b8ec5[_0x5bff('0x1e')]=qs[_0x5bff('0x1e')](_0x520e60['query'][_0x5bff('0x1e')]);}_0x2b8ec5[_0x5bff('0x43')]=qs[_0x5bff('0x44')](_0x520e60[_0x5bff('0x3d')][_0x5bff('0x44')]);_0x2b8ec5[_0x5bff('0x45')]=qs['filters'](_[_0x5bff('0x46')](_0x520e60['query'],_0x2bfdbc[_0x5bff('0x3e')]));_0x2b8ec5[_0x5bff('0x45')][_0x5bff('0x61')]=_0x435076['id'];if(_0x520e60[_0x5bff('0x3d')][_0x5bff('0x2c')]){_0x2b8ec5[_0x5bff('0x45')]=_[_0x5bff('0x47')](_0x2b8ec5[_0x5bff('0x45')],{'$or':_[_0x5bff('0x37')](_0x2b8ec5[_0x5bff('0x3f')],function(_0x429263){var _0x995f09={};_0x995f09[_0x429263]={'$like':'%'+_0x520e60[_0x5bff('0x3d')]['filter']+'%'};return _0x995f09;})});}_0x2b8ec5=_['merge']({},_0x2b8ec5,_0x520e60[_0x5bff('0x49')]);return db[_0x5bff('0x64')][_0x5bff('0x20')]({'where':_0x2b8ec5[_0x5bff('0x45')]})[_0x5bff('0x27')](function(_0x592024){_0x440c52[_0x5bff('0x20')]=_0x592024;if(_0x520e60[_0x5bff('0x3d')][_0x5bff('0x4f')]){_0x2b8ec5['include']=[{'all':!![]}];}return db[_0x5bff('0x64')]['findAll'](_0x2b8ec5);})[_0x5bff('0x27')](function(_0x51c0a1){_0x440c52[_0x5bff('0x62')]=_0x51c0a1;return _0x440c52;});}})['then'](respondWithFilteredResult(_0x28aee9,_0x2b8ec5))[_0x5bff('0x4b')](handleError(_0x28aee9,null));};exports[_0x5bff('0x65')]=function(_0x2a255e,_0x560d5d,_0x456357){var _0x2e5ac0={'raw':!![],'where':{}};var _0x1b895d={};var _0x3dbb53={'count':0x0,'rows':[]};return db[_0x5bff('0x38')][_0x5bff('0x5f')]({'where':{'id':_0x2a255e[_0x5bff('0x4d')]['id']}})[_0x5bff('0x27')](handleEntityNotFound(_0x560d5d,null))[_0x5bff('0x27')](function(_0x11b49d){if(_0x11b49d){_0x1b895d['model']=_[_0x5bff('0x3c')](db[_0x5bff('0x66')]['rawAttributes']);_0x1b895d[_0x5bff('0x3d')]=_['keys'](_0x2a255e['query']);_0x1b895d[_0x5bff('0x3e')]=_[_0x5bff('0x4e')](_0x1b895d[_0x5bff('0x3b')],_0x1b895d[_0x5bff('0x3d')]);_0x2e5ac0['attributes']=_['intersection'](_0x1b895d[_0x5bff('0x3b')],qs[_0x5bff('0x40')](_0x2a255e[_0x5bff('0x3d')]['fields']));_0x2e5ac0[_0x5bff('0x3f')]=_0x2e5ac0[_0x5bff('0x3f')][_0x5bff('0x41')]?_0x2e5ac0[_0x5bff('0x3f')]:_0x1b895d[_0x5bff('0x3b')];if(!_0x2a255e['query'][_0x5bff('0x63')](_0x5bff('0x42'))){_0x2e5ac0['limit']=qs[_0x5bff('0x21')](_0x2a255e[_0x5bff('0x3d')][_0x5bff('0x21')]);_0x2e5ac0[_0x5bff('0x1e')]=qs['offset'](_0x2a255e['query'][_0x5bff('0x1e')]);}_0x2e5ac0[_0x5bff('0x43')]=qs[_0x5bff('0x44')](_0x2a255e[_0x5bff('0x3d')][_0x5bff('0x44')]);_0x2e5ac0[_0x5bff('0x45')]=qs[_0x5bff('0x3e')](_[_0x5bff('0x46')](_0x2a255e[_0x5bff('0x3d')],_0x1b895d[_0x5bff('0x3e')]));_0x2e5ac0['where'][_0x5bff('0x61')]=_0x11b49d['id'];if(_0x2a255e[_0x5bff('0x3d')][_0x5bff('0x2c')]){_0x2e5ac0[_0x5bff('0x45')]=_['merge'](_0x2e5ac0['where'],{'$or':_[_0x5bff('0x37')](_0x2e5ac0[_0x5bff('0x3f')],function(_0x1ffb3b){var _0x1ab161={};_0x1ab161[_0x1ffb3b]={'$like':'%'+_0x2a255e[_0x5bff('0x3d')][_0x5bff('0x2c')]+'%'};return _0x1ab161;})});}_0x2e5ac0=_[_0x5bff('0x47')]({},_0x2e5ac0,_0x2a255e['options']);return db['CmHopperFinal']['count']({'where':_0x2e5ac0['where']})[_0x5bff('0x27')](function(_0x1ac4f3){_0x3dbb53[_0x5bff('0x20')]=_0x1ac4f3;if(_0x2a255e[_0x5bff('0x3d')]['includeAll']){_0x2e5ac0['include']=[{'all':!![]}];}return db[_0x5bff('0x66')][_0x5bff('0x67')](_0x2e5ac0);})[_0x5bff('0x27')](function(_0x10cf74){_0x3dbb53[_0x5bff('0x62')]=_0x10cf74;return _0x3dbb53;});}})[_0x5bff('0x27')](respondWithFilteredResult(_0x560d5d,_0x2e5ac0))['catch'](handleError(_0x560d5d,null));};exports['getHopperBlacks']=function(_0x56b4a4,_0x4c482e,_0x98350){var _0x260435={'raw':!![],'where':{}};var _0x5f2226={};var _0x437fa3={'count':0x0,'rows':[]};return db[_0x5bff('0x38')][_0x5bff('0x5f')]({'where':{'id':_0x56b4a4['params']['id']}})[_0x5bff('0x27')](handleEntityNotFound(_0x4c482e,null))['then'](function(_0x4f7c78){if(_0x4f7c78){_0x5f2226[_0x5bff('0x3b')]=_[_0x5bff('0x3c')](db[_0x5bff('0x68')][_0x5bff('0x39')]);_0x5f2226['query']=_[_0x5bff('0x3c')](_0x56b4a4[_0x5bff('0x3d')]);_0x5f2226[_0x5bff('0x3e')]=_['intersection'](_0x5f2226[_0x5bff('0x3b')],_0x5f2226[_0x5bff('0x3d')]);_0x260435[_0x5bff('0x3f')]=_[_0x5bff('0x4e')](_0x5f2226[_0x5bff('0x3b')],qs['fields'](_0x56b4a4[_0x5bff('0x3d')]['fields']));_0x260435[_0x5bff('0x3f')]=_0x260435['attributes'][_0x5bff('0x41')]?_0x260435[_0x5bff('0x3f')]:_0x5f2226[_0x5bff('0x3b')];if(!_0x56b4a4[_0x5bff('0x3d')][_0x5bff('0x63')]('nolimit')){_0x260435['limit']=qs['limit'](_0x56b4a4['query'][_0x5bff('0x21')]);_0x260435['offset']=qs['offset'](_0x56b4a4['query'][_0x5bff('0x1e')]);}_0x260435['order']=qs['sort'](_0x56b4a4[_0x5bff('0x3d')][_0x5bff('0x44')]);_0x260435[_0x5bff('0x45')]=qs[_0x5bff('0x3e')](_[_0x5bff('0x46')](_0x56b4a4['query'],_0x5f2226['filters']));_0x260435['where']['VoiceQueueId']=_0x4f7c78['id'];if(_0x56b4a4[_0x5bff('0x3d')][_0x5bff('0x2c')]){_0x260435['where']=_['merge'](_0x260435[_0x5bff('0x45')],{'$or':_[_0x5bff('0x37')](_0x260435['attributes'],function(_0x589db0){var _0x431e58={};_0x431e58[_0x589db0]={'$like':'%'+_0x56b4a4[_0x5bff('0x3d')][_0x5bff('0x2c')]+'%'};return _0x431e58;})});}_0x260435=_[_0x5bff('0x47')]({},_0x260435,_0x56b4a4[_0x5bff('0x49')]);return db[_0x5bff('0x68')]['count']({'where':_0x260435[_0x5bff('0x45')]})['then'](function(_0x2185e3){_0x437fa3['count']=_0x2185e3;if(_0x56b4a4[_0x5bff('0x3d')][_0x5bff('0x4f')]){_0x260435[_0x5bff('0x4a')]=[{'all':!![]}];}return db[_0x5bff('0x68')][_0x5bff('0x67')](_0x260435);})['then'](function(_0x3c518c){_0x437fa3[_0x5bff('0x62')]=_0x3c518c;return _0x437fa3;});}})[_0x5bff('0x27')](respondWithFilteredResult(_0x4c482e,_0x260435))['catch'](handleError(_0x4c482e,null));};exports[_0x5bff('0x69')]=function(_0x3515e8,_0x2fd0ae,_0x13c340){var _0x39636d={};var _0x332879={};var _0x49d553;var _0x5921bc;return db[_0x5bff('0x38')]['findOne']({'where':{'id':_0x3515e8[_0x5bff('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2fd0ae,null))[_0x5bff('0x27')](function(_0x4d5527){if(_0x4d5527){_0x49d553=_0x4d5527;_0x332879[_0x5bff('0x3b')]=_[_0x5bff('0x3c')](db['Team']['rawAttributes']);_0x332879[_0x5bff('0x3d')]=_[_0x5bff('0x3c')](_0x3515e8[_0x5bff('0x3d')]);_0x332879[_0x5bff('0x3e')]=_[_0x5bff('0x4e')](_0x332879[_0x5bff('0x3b')],_0x332879[_0x5bff('0x3d')]);_0x39636d[_0x5bff('0x3f')]=_[_0x5bff('0x4e')](_0x332879[_0x5bff('0x3b')],qs[_0x5bff('0x40')](_0x3515e8[_0x5bff('0x3d')][_0x5bff('0x40')]));_0x39636d[_0x5bff('0x3f')]=_0x39636d[_0x5bff('0x3f')][_0x5bff('0x41')]?_0x39636d['attributes']:_0x332879[_0x5bff('0x3b')];_0x39636d[_0x5bff('0x43')]=qs['sort'](_0x3515e8[_0x5bff('0x3d')][_0x5bff('0x44')]);_0x39636d['where']=qs['filters'](_['pick'](_0x3515e8[_0x5bff('0x3d')],_0x332879['filters']));if(_0x3515e8[_0x5bff('0x3d')]['filter']){_0x39636d[_0x5bff('0x45')]=_[_0x5bff('0x47')](_0x39636d[_0x5bff('0x45')],{'$or':_[_0x5bff('0x37')](_0x39636d[_0x5bff('0x3f')],function(_0x5cdbd9){var _0x1881b2={};_0x1881b2[_0x5cdbd9]={'$like':'%'+_0x3515e8[_0x5bff('0x3d')]['filter']+'%'};return _0x1881b2;})});}_0x39636d=_[_0x5bff('0x47')]({},_0x39636d,_0x3515e8[_0x5bff('0x49')]);return _0x49d553['getTeams'](_0x39636d);}})[_0x5bff('0x27')](function(_0x47f32c){if(_0x47f32c){_0x5921bc=_0x47f32c[_0x5bff('0x41')];if(!_0x3515e8[_0x5bff('0x3d')][_0x5bff('0x63')](_0x5bff('0x42'))){_0x39636d[_0x5bff('0x21')]=qs['limit'](_0x3515e8[_0x5bff('0x3d')][_0x5bff('0x21')]);_0x39636d[_0x5bff('0x1e')]=qs[_0x5bff('0x1e')](_0x3515e8['query']['offset']);}return _0x49d553[_0x5bff('0x69')](_0x39636d);}})['then'](function(_0x482f78){if(_0x482f78){return _0x482f78?{'count':_0x5921bc,'rows':_0x482f78}:null;}})[_0x5bff('0x27')](respondWithResult(_0x2fd0ae,null))['catch'](handleError(_0x2fd0ae,null));};exports[_0x5bff('0x6a')]=function(_0x2ddb7a,_0x12dcda,_0x40ce12){var _0x57c374=_0x2ddb7a[_0x5bff('0x51')][_0x5bff('0x6b')];var _0x5d25ef=_[_0x5bff('0x37')](_0x57c374,'id');return db['Team'][_0x5bff('0x67')]({'where':{'id':_0x5d25ef},'attributes':['id'],'include':[{'model':db[_0x5bff('0x6c')],'as':_0x5bff('0x6d'),'attributes':['id',_0x5bff('0x34'),_0x5bff('0x6e'),_0x5bff('0x6f'),_0x5bff('0x70')],'raw':!![]}]})[_0x5bff('0x27')](function(_0x43e2b2){if(_0x43e2b2){var _0x4f9215=_[_0x5bff('0x71')](_0x43e2b2,function(_0x7848b0){var _0x2e9efb=_0x7848b0[_0x5bff('0x29')]({'plain':!![]});_0x2e9efb[_0x5bff('0x6d')][_0x5bff('0x72')](function(_0x1f1e73){_0x1f1e73[_0x5bff('0x73')]=_['find'](_0x57c374,{'id':_0x2e9efb['id']})[_0x5bff('0x73')];});return _0x2e9efb[_0x5bff('0x6d')];});return db['VoiceQueue']['find']({'where':{'id':_0x2ddb7a[_0x5bff('0x4d')]['id']}})['then'](function(_0x353f26){return db['sequelize'][_0x5bff('0x74')](function(_0x148b6a){return _0x353f26[_0x5bff('0x6a')](_0x5d25ef,{'transaction':_0x148b6a})['then'](function(){return BPromise[_0x5bff('0x75')](_0x57c374,function(_0x12f7b6){return db['TeamVoiceQueue'][_0x5bff('0x76')]({'TeamId':_0x12f7b6['id'],'VoiceQueueId':_0x2ddb7a['params']['id'],'penalty':_0x12f7b6[_0x5bff('0x73')]},{'transaction':_0x148b6a});});})[_0x5bff('0x27')](function(){return BPromise[_0x5bff('0x75')](_0x4f9215,function(_0x57ca82){return db[_0x5bff('0x77')][_0x5bff('0x78')]({'where':{'UserId':_0x57ca82['id'],'VoiceQueueId':_0x2ddb7a['params']['id']},'defaults':{'penalty':_0x57ca82[_0x5bff('0x73')]},'transaction':_0x148b6a});});})[_0x5bff('0x27')](function(){return BPromise['each'](_[_0x5bff('0x2c')](_0x4f9215,{'online':!![]}),function(_0x33d4bb){return db[_0x5bff('0x79')][_0x5bff('0x76')]({'membername':_0x33d4bb['name'],'UserId':_0x33d4bb['id'],'queue_name':_0x353f26[_0x5bff('0x34')],'VoiceQueueId':_0x353f26['id'],'interface':_[_0x5bff('0x7a')](_0x33d4bb[_0x5bff('0x70')])?util['format']('SIP/%s',_0x33d4bb[_0x5bff('0x34')]):_0x33d4bb[_0x5bff('0x70')],'paused':_0x33d4bb['voicePause']||![],'penalty':_0x33d4bb[_0x5bff('0x73')]},{'transaction':_0x148b6a});});})[_0x5bff('0x27')](function(){_0x4f9215[_0x5bff('0x72')](function(_0x5ca677){socket[_0x5bff('0x7b')](_0x5bff('0x7c'),{'UserId':_0x5ca677['id'],'VoiceQueueId':_0x353f26['id']});});});});});}})[_0x5bff('0x27')](respondWithStatusCode(_0x12dcda,null))[_0x5bff('0x4b')](handleError(_0x12dcda,null));};exports[_0x5bff('0x7d')]=function(_0x222ffb,_0x563d93,_0x2fca7b){return db['Team'][_0x5bff('0x67')]({'where':{'id':_0x222ffb[_0x5bff('0x3d')][_0x5bff('0x7e')]},'attributes':['id'],'include':[{'model':db[_0x5bff('0x6c')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x563d93,null))[_0x5bff('0x27')](function(_0x409228){var _0x54aaeb=_[_0x5bff('0x37')](_0x409228,'id');var _0x1b4441=[];var _0x1d1ac6=[];var _0x360fb2=squel[_0x5bff('0x7f')]();_0x360fb2[_0x5bff('0x80')]('tq.TeamId')['from']('team_has_voice_queues','tq')['join'](_0x5bff('0x81'),'ut',_0x5bff('0x82'))[_0x5bff('0x45')](_0x5bff('0x83'),_0x222ffb[_0x5bff('0x4d')]['id']);for(var _0x240b8b=0x0;_0x240b8b<_0x409228['length'];_0x240b8b+=0x1){let _0x3fbb23=_0x409228[_0x240b8b];for(var _0x2787a5=0x0;_0x2787a5<_0x3fbb23[_0x5bff('0x6d')][_0x5bff('0x41')];_0x2787a5+=0x1){let _0x47029f=_0x3fbb23[_0x5bff('0x6d')][_0x2787a5];var _0x1d7f8a=_0x360fb2['clone']();_0x1d7f8a[_0x5bff('0x45')](_0x5bff('0x84'),_0x47029f['id']);_0x1d1ac6['push'](db['sequelize'][_0x5bff('0x3d')](_0x1d7f8a[_0x5bff('0x85')](),{'type':db['sequelize'][_0x5bff('0x86')][_0x5bff('0x87')]})[_0x5bff('0x27')](function(_0x3e5729){if(_0x3e5729[_0x5bff('0x41')]===0x1){return _0x47029f['id'];}else{var _0x9cbe5=_['every'](_['map'](_0x3e5729,_0x5bff('0x88')),function(_0x242b21){return _[_0x5bff('0x2e')](_0x54aaeb,_0x242b21);});if(_0x9cbe5){return _0x47029f['id'];}}}));}}return BPromise[_0x5bff('0x89')](_0x1d1ac6)['then'](function(_0x3b18fc){_0x1b4441=_(_0x1b4441)['union'](_0x3b18fc)[_0x5bff('0x8a')]()[_0x5bff('0x2d')]();return db[_0x5bff('0x38')][_0x5bff('0x30')]({'where':{'id':_0x222ffb[_0x5bff('0x4d')]['id']}})[_0x5bff('0x27')](function(_0xe45d5d){return db[_0x5bff('0x8b')][_0x5bff('0x74')](function(_0x20da17){return _0xe45d5d[_0x5bff('0x7d')](_0x222ffb['query']['ids'],{'transaction':_0x20da17})[_0x5bff('0x27')](function(){if(!_['isEmpty'](_0x1b4441)){return _0xe45d5d[_0x5bff('0x8c')](_0x1b4441,{'transaction':_0x20da17})[_0x5bff('0x27')](function(){return db[_0x5bff('0x79')][_0x5bff('0x28')]({'where':{'VoiceQueueId':_0x222ffb['params']['id'],'UserId':_0x1b4441},'transaction':_0x20da17});});}})[_0x5bff('0x27')](function(){_0x1b4441[_0x5bff('0x72')](function(_0x5d3223){socket['emit'](_0x5bff('0x8d'),{'UserId':_0x5d3223,'VoiceQueueId':_0xe45d5d['id']});});});});});});})[_0x5bff('0x27')](respondWithStatusCode(_0x563d93,null))[_0x5bff('0x4b')](handleError(_0x563d93,null));};exports['addAgents']=function(_0x1a649c,_0x31ea9a,_0x1e887b){var _0x3ac83f,_0x1627cc;return db[_0x5bff('0x38')][_0x5bff('0x30')]({'where':{'id':_0x1a649c[_0x5bff('0x4d')]['id']}})[_0x5bff('0x27')](handleEntityNotFound(_0x31ea9a,null))[_0x5bff('0x27')](function(_0x49f1b1){if(_0x49f1b1){_0x1627cc=_0x49f1b1;return _0x49f1b1[_0x5bff('0x8e')](_0x1a649c[_0x5bff('0x51')][_0x5bff('0x7e')],_['omit'](_0x1a649c[_0x5bff('0x51')],[_0x5bff('0x7e'),'id'])||{})[_0x5bff('0x8f')](function(_0x2c0378){for(var _0x1589e2=0x0;_0x1589e2<_0x1a649c['body'][_0x5bff('0x7e')][_0x5bff('0x41')];_0x1589e2+=0x1){socket['emit'](_0x5bff('0x7c'),{'UserId':Number(_0x1a649c[_0x5bff('0x51')][_0x5bff('0x7e')][_0x1589e2]),'VoiceQueueId':Number(_0x1a649c[_0x5bff('0x4d')]['id'])});}return _0x2c0378;});}})['then'](function(_0x419fcb){_0x3ac83f=_0x419fcb||[];if(_0x1627cc){return db[_0x5bff('0x6c')][_0x5bff('0x67')]({'where':{'id':_0x1a649c['body']['ids']},'attributes':['id',_0x5bff('0x34'),'online',_0x5bff('0x6f'),'interface'],'raw':!![]});}})[_0x5bff('0x27')](function(_0x175f02){if(!_[_0x5bff('0x90')](_0x175f02)){var _0xc623=[];for(var _0xe18289=0x0;_0xe18289<_0x175f02[_0x5bff('0x41')];_0xe18289++){if(_0x175f02[_0xe18289][_0x5bff('0x6e')]){_0xc623[_0x5bff('0x91')](db[_0x5bff('0x79')][_0x5bff('0x76')]({'membername':_0x175f02[_0xe18289][_0x5bff('0x34')],'UserId':_0x175f02[_0xe18289]['id'],'queue_name':_0x1627cc[_0x5bff('0x34')],'VoiceQueueId':_0x1627cc['id'],'interface':_[_0x5bff('0x7a')](_0x175f02[_0xe18289][_0x5bff('0x70')])?util[_0x5bff('0x92')](_0x5bff('0x93'),_0x175f02[_0xe18289]['name']):_0x175f02[_0xe18289][_0x5bff('0x70')],'paused':_0x175f02[_0xe18289][_0x5bff('0x6f')]||![],'penalty':_0x1a649c[_0x5bff('0x51')][_0x5bff('0x73')]||0x0}));}}return BPromise[_0x5bff('0x89')](_0xc623);}})[_0x5bff('0x27')](function(){return _0x3ac83f;})[_0x5bff('0x27')](respondWithResult(_0x31ea9a,null))['catch'](handleError(_0x31ea9a,null));};exports[_0x5bff('0x8c')]=function(_0x19a753,_0x2243d1,_0x5ade56){return db[_0x5bff('0x38')]['find']({'where':{'id':_0x19a753[_0x5bff('0x4d')]['id']}})[_0x5bff('0x27')](handleEntityNotFound(_0x2243d1,null))[_0x5bff('0x27')](function(_0x1f4873){if(_0x1f4873){return _0x1f4873[_0x5bff('0x8c')](_0x19a753[_0x5bff('0x3d')][_0x5bff('0x7e')])[_0x5bff('0x27')](function(){if(_[_0x5bff('0x94')](_0x19a753['query']['ids'])){for(var _0x2fd6d3=0x0;_0x2fd6d3<_0x19a753[_0x5bff('0x3d')]['ids'][_0x5bff('0x41')];_0x2fd6d3+=0x1){socket[_0x5bff('0x7b')](_0x5bff('0x8d'),{'UserId':Number(_0x19a753[_0x5bff('0x3d')][_0x5bff('0x7e')][_0x2fd6d3]),'VoiceQueueId':Number(_0x19a753[_0x5bff('0x4d')]['id'])});}}else{socket[_0x5bff('0x7b')](_0x5bff('0x8d'),{'UserId':Number(_0x19a753[_0x5bff('0x3d')]['ids']),'VoiceQueueId':Number(_0x19a753[_0x5bff('0x4d')]['id'])});}});}})[_0x5bff('0x27')](function(_0x53d4df){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x19a753[_0x5bff('0x4d')]['id'],'UserId':_0x19a753[_0x5bff('0x3d')]['ids']}})[_0x5bff('0x27')](function(){return _0x53d4df;});})[_0x5bff('0x27')](respondWithStatusCode(_0x2243d1,null))[_0x5bff('0x4b')](handleError(_0x2243d1,null));};exports['getAgents']=function(_0x2bc1b2,_0x591f88,_0x320937){var _0x36f3dc={};var _0xcf7234={};var _0x5881a3;var _0x22a10f;return db['VoiceQueue'][_0x5bff('0x5f')]({'where':{'id':_0x2bc1b2['params']['id']}})[_0x5bff('0x27')](handleEntityNotFound(_0x591f88,null))[_0x5bff('0x27')](function(_0xdb4bf1){if(_0xdb4bf1){_0x5881a3=_0xdb4bf1;_0xcf7234['model']=_['keys'](db[_0x5bff('0x6c')]['rawAttributes']);_0xcf7234[_0x5bff('0x3d')]=_[_0x5bff('0x3c')](_0x2bc1b2[_0x5bff('0x3d')]);_0xcf7234['filters']=_[_0x5bff('0x4e')](_0xcf7234[_0x5bff('0x3b')],_0xcf7234[_0x5bff('0x3d')]);_0x36f3dc[_0x5bff('0x3f')]=_[_0x5bff('0x4e')](_0xcf7234['model'],qs[_0x5bff('0x40')](_0x2bc1b2[_0x5bff('0x3d')][_0x5bff('0x40')]));_0x36f3dc[_0x5bff('0x3f')]=_0x36f3dc['attributes']['length']?_0x36f3dc[_0x5bff('0x3f')]:_0xcf7234[_0x5bff('0x3b')];_0x36f3dc[_0x5bff('0x43')]=qs[_0x5bff('0x44')](_0x2bc1b2['query'][_0x5bff('0x44')]);_0x36f3dc[_0x5bff('0x45')]=qs[_0x5bff('0x3e')](_['pick'](_0x2bc1b2[_0x5bff('0x3d')],_0xcf7234[_0x5bff('0x3e')]));if(_0x2bc1b2['query'][_0x5bff('0x2c')]){_0x36f3dc['where']=_[_0x5bff('0x47')](_0x36f3dc[_0x5bff('0x45')],{'$or':_['map'](_0x36f3dc[_0x5bff('0x3f')],function(_0x442065){var _0xf34e27={};_0xf34e27[_0x442065]={'$like':'%'+_0x2bc1b2[_0x5bff('0x3d')][_0x5bff('0x2c')]+'%'};return _0xf34e27;})});}_0x36f3dc=_[_0x5bff('0x47')]({},_0x36f3dc,_0x2bc1b2[_0x5bff('0x49')]);return _0x5881a3[_0x5bff('0x95')](_0x36f3dc);}})[_0x5bff('0x27')](function(_0x4324c1){if(_0x4324c1){_0x22a10f=_0x4324c1[_0x5bff('0x41')];if(!_0x2bc1b2[_0x5bff('0x3d')]['hasOwnProperty'](_0x5bff('0x42'))){_0x36f3dc[_0x5bff('0x21')]=qs[_0x5bff('0x21')](_0x2bc1b2[_0x5bff('0x3d')][_0x5bff('0x21')]);_0x36f3dc['offset']=qs[_0x5bff('0x1e')](_0x2bc1b2[_0x5bff('0x3d')][_0x5bff('0x1e')]);}return _0x5881a3['getAgents'](_0x36f3dc);}})['then'](function(_0xb51e72){if(_0xb51e72){return _0xb51e72?{'count':_0x22a10f,'rows':_0xb51e72}:null;}})[_0x5bff('0x27')](respondWithResult(_0x591f88,null))[_0x5bff('0x4b')](handleError(_0x591f88,null));};exports[_0x5bff('0x96')]=function(_0x7676b7,_0x34e008,_0xcb8662){var _0x255485={};var _0x270b8f={};var _0x15685c;var _0x15a0d8;return db[_0x5bff('0x38')]['findOne']({'where':{'id':_0x7676b7[_0x5bff('0x4d')]['id']}})[_0x5bff('0x27')](handleEntityNotFound(_0x34e008,null))[_0x5bff('0x27')](function(_0x36bd7f){if(_0x36bd7f){_0x15685c=_0x36bd7f;_0x270b8f[_0x5bff('0x3b')]=_[_0x5bff('0x3c')](db[_0x5bff('0x79')][_0x5bff('0x39')]);_0x270b8f[_0x5bff('0x3d')]=_[_0x5bff('0x3c')](_0x7676b7[_0x5bff('0x3d')]);_0x270b8f['filters']=_[_0x5bff('0x4e')](_0x270b8f['model'],_0x270b8f[_0x5bff('0x3d')]);_0x255485[_0x5bff('0x3f')]=_[_0x5bff('0x4e')](_0x270b8f[_0x5bff('0x3b')],qs[_0x5bff('0x40')](_0x7676b7[_0x5bff('0x3d')]['fields']));_0x255485['attributes']=_0x255485[_0x5bff('0x3f')][_0x5bff('0x41')]?_0x255485[_0x5bff('0x3f')]:_0x270b8f[_0x5bff('0x3b')];_0x255485[_0x5bff('0x43')]=qs[_0x5bff('0x44')](_0x7676b7['query'][_0x5bff('0x44')]);_0x255485[_0x5bff('0x45')]=qs[_0x5bff('0x3e')](_[_0x5bff('0x46')](_0x7676b7['query'],_0x270b8f[_0x5bff('0x3e')]));if(_0x7676b7[_0x5bff('0x3d')]['filter']){_0x255485[_0x5bff('0x45')]=_['merge'](_0x255485[_0x5bff('0x45')],{'$or':_[_0x5bff('0x37')](_0x255485[_0x5bff('0x3f')],function(_0x3bac0b){var _0x40e3a8={};_0x40e3a8[_0x3bac0b]={'$like':'%'+_0x7676b7[_0x5bff('0x3d')][_0x5bff('0x2c')]+'%'};return _0x40e3a8;})});}_0x255485=_['merge']({},_0x255485,_0x7676b7[_0x5bff('0x49')]);return _0x15685c[_0x5bff('0x96')](_0x255485);}})[_0x5bff('0x27')](function(_0x2b8d0e){if(_0x2b8d0e){_0x15a0d8=_0x2b8d0e['length'];if(!_0x7676b7[_0x5bff('0x3d')][_0x5bff('0x63')](_0x5bff('0x42'))){_0x255485['limit']=qs[_0x5bff('0x21')](_0x7676b7[_0x5bff('0x3d')][_0x5bff('0x21')]);_0x255485[_0x5bff('0x1e')]=qs['offset'](_0x7676b7['query']['offset']);}return _0x15685c[_0x5bff('0x96')](_0x255485);}})['then'](function(_0x481111){return _0x481111?{'count':_0x15a0d8,'rows':_0x481111}:null;})[_0x5bff('0x27')](respondWithResult(_0x34e008,null))['catch'](handleError(_0x34e008,null));};exports[_0x5bff('0x97')]=function(_0x1bd0fe,_0x232a15,_0x629353){var _0x19b393={};var _0x2f4190={};var _0xc8849d;var _0x237ca9;return db['VoiceQueue']['findOne']({'where':{'id':_0x1bd0fe[_0x5bff('0x4d')]['id']}})[_0x5bff('0x27')](handleEntityNotFound(_0x232a15,null))['then'](function(_0xbe2c4f){if(_0xbe2c4f){_0xc8849d=_0xbe2c4f;_0x2f4190[_0x5bff('0x3b')]=_[_0x5bff('0x3c')](db[_0x5bff('0x98')][_0x5bff('0x39')]);_0x2f4190[_0x5bff('0x3d')]=_[_0x5bff('0x3c')](_0x1bd0fe[_0x5bff('0x3d')]);_0x2f4190[_0x5bff('0x3e')]=_[_0x5bff('0x4e')](_0x2f4190[_0x5bff('0x3b')],_0x2f4190['query']);_0x19b393[_0x5bff('0x3f')]=_[_0x5bff('0x4e')](_0x2f4190[_0x5bff('0x3b')],qs['fields'](_0x1bd0fe[_0x5bff('0x3d')]['fields']));_0x19b393['attributes']=_0x19b393[_0x5bff('0x3f')][_0x5bff('0x41')]?_0x19b393[_0x5bff('0x3f')]:_0x2f4190[_0x5bff('0x3b')];_0x19b393['order']=qs[_0x5bff('0x44')](_0x1bd0fe[_0x5bff('0x3d')]['sort']);_0x19b393[_0x5bff('0x45')]=qs[_0x5bff('0x3e')](_[_0x5bff('0x46')](_0x1bd0fe[_0x5bff('0x3d')],_0x2f4190[_0x5bff('0x3e')]));if(_0x1bd0fe[_0x5bff('0x3d')][_0x5bff('0x2c')]){_0x19b393[_0x5bff('0x45')]=_[_0x5bff('0x47')](_0x19b393[_0x5bff('0x45')],{'$or':_[_0x5bff('0x37')](_0x19b393[_0x5bff('0x3f')],function(_0x2ebaf0){var _0x30063a={};_0x30063a[_0x2ebaf0]={'$like':'%'+_0x1bd0fe[_0x5bff('0x3d')][_0x5bff('0x2c')]+'%'};return _0x30063a;})});}_0x19b393=_[_0x5bff('0x47')]({},_0x19b393,_0x1bd0fe[_0x5bff('0x49')]);return _0xc8849d['getLists'](_0x19b393);}})[_0x5bff('0x27')](function(_0x1168a2){if(_0x1168a2){_0x237ca9=_0x1168a2['length'];if(!_0x1bd0fe[_0x5bff('0x3d')][_0x5bff('0x63')](_0x5bff('0x42'))){_0x19b393['limit']=qs['limit'](_0x1bd0fe[_0x5bff('0x3d')][_0x5bff('0x21')]);_0x19b393[_0x5bff('0x1e')]=qs[_0x5bff('0x1e')](_0x1bd0fe[_0x5bff('0x3d')]['offset']);}return _0xc8849d[_0x5bff('0x97')](_0x19b393);}})[_0x5bff('0x27')](function(_0xe0e85b){if(_0xe0e85b){return _0xe0e85b?{'count':_0x237ca9,'rows':_0xe0e85b}:null;}})[_0x5bff('0x27')](respondWithResult(_0x232a15,null))[_0x5bff('0x4b')](handleError(_0x232a15,null));};exports[_0x5bff('0x99')]=function(_0x3ab58c,_0x4549ac,_0x95cb31){var _0x1211dd=moment()[_0x5bff('0x92')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4349b6,_0x435773;return db[_0x5bff('0x38')][_0x5bff('0x30')]({'where':{'id':_0x3ab58c[_0x5bff('0x4d')]['id']}})[_0x5bff('0x27')](handleEntityNotFound(_0x4549ac,null))[_0x5bff('0x27')](function(_0x278018){if(_0x278018){_0x435773=_0x278018;return _0x278018[_0x5bff('0x99')](_0x3ab58c[_0x5bff('0x51')][_0x5bff('0x7e')],_[_0x5bff('0x57')](_0x3ab58c['body'],[_0x5bff('0x7e'),'id'])||{});}return null;})['spread'](function(_0x4f10f0){var _0x55038b;_0x4349b6=_0x4f10f0||[];var _0x5cb17b=[];if(_0x4f10f0){for(var _0x102e52=0x0;_0x102e52<_0x4f10f0['length'];_0x102e52+=0x1){var _0x5661a3=_0x4f10f0[_0x102e52][_0x5bff('0x29')]({'plain':!![]});_0x435773[_0x5bff('0x9a')]=_0x3ab58c[_0x5bff('0x51')][_0x5bff('0x9a')]?_0x3ab58c[_0x5bff('0x51')]['dialCheckDuplicateType']:_0x435773[_0x5bff('0x9a')];switch(_0x435773[_0x5bff('0x9a')]){case _0x5bff('0x9b'):_0x55038b=squel['insert']()[_0x5bff('0x9c')]('cm_hopper')[_0x5bff('0x9d')]([_0x5bff('0x9e'),'scheduledAt','ContactId',_0x5bff('0x9f'),_0x5bff('0x61'),_0x5bff('0x58'),_0x5bff('0x59')],squel['select']()['field'](_0x5bff('0x9e'),_0x5bff('0x9e'))[_0x5bff('0x80')]('\x27'+_0x1211dd+'\x27',_0x5bff('0xa0'))[_0x5bff('0x80')]('id',_0x5bff('0xa1'))['field'](_0x5661a3[_0x5bff('0xa2')][_0x5bff('0x85')](),_0x5bff('0x9f'))[_0x5bff('0x80')](_0x3ab58c[_0x5bff('0x4d')]['id'][_0x5bff('0x85')](),_0x5bff('0x61'))[_0x5bff('0x80')]('\x27'+_0x1211dd+'\x27',_0x5bff('0x58'))[_0x5bff('0x80')]('\x27'+_0x1211dd+'\x27','updatedAt')[_0x5bff('0xa3')](_0x5bff('0xa4'))[_0x5bff('0x45')](_0x5bff('0xa5'))[_0x5bff('0x45')](_0x5bff('0xa6'),_0x5661a3[_0x5bff('0xa2')][_0x5bff('0x85')]())[_0x5bff('0x45')]('phone\x20IS\x20NOT\x20NULL')[_0x5bff('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0x5bff('0x7f')]()['field'](_0x5bff('0xa7'))[_0x5bff('0xa3')](_0x5bff('0xa8'))['where'](_0x5bff('0x83'),_0x3ab58c[_0x5bff('0x4d')]['id']['toString']()))[_0x5bff('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0x5bff('0x7f')]()['field']('COALESCE(phone,\x27\x27)')[_0x5bff('0xa3')](_0x5bff('0xa9'))[_0x5bff('0x45')](_0x5bff('0x83'),_0x3ab58c[_0x5bff('0x4d')]['id']['toString']())))['toString']();break;case _0x5bff('0xaa'):_0x55038b=squel['insert']()[_0x5bff('0x9c')](_0x5bff('0xa9'))[_0x5bff('0x9d')]([_0x5bff('0x9e'),'scheduledAt',_0x5bff('0xa1'),_0x5bff('0x9f'),'VoiceQueueId',_0x5bff('0x58'),_0x5bff('0x59')],squel['select']()[_0x5bff('0x80')]('phone','phone')[_0x5bff('0x80')]('\x27'+_0x1211dd+'\x27','scheduledAt')['field']('id','ContactId')[_0x5bff('0x80')](_0x5661a3[_0x5bff('0xa2')]['toString'](),_0x5bff('0x9f'))[_0x5bff('0x80')](_0x3ab58c[_0x5bff('0x4d')]['id'][_0x5bff('0x85')](),_0x5bff('0x61'))[_0x5bff('0x80')]('\x27'+_0x1211dd+'\x27',_0x5bff('0x58'))['field']('\x27'+_0x1211dd+'\x27','updatedAt')[_0x5bff('0xa3')](_0x5bff('0xa4'))[_0x5bff('0x45')]('deletedAt\x20IS\x20NULL')[_0x5bff('0x45')](_0x5bff('0xa6'),_0x5661a3[_0x5bff('0xa2')]['toString']())[_0x5bff('0x45')](_0x5bff('0xab'))[_0x5bff('0x45')](_0x5bff('0xac'),squel[_0x5bff('0x7f')]()[_0x5bff('0x80')](_0x5bff('0xad'))[_0x5bff('0xa3')](_0x5bff('0xa9'))[_0x5bff('0x45')](_0x5bff('0x83'),_0x3ab58c[_0x5bff('0x4d')]['id']['toString']())))['toString']();break;default:_0x55038b=squel[_0x5bff('0xae')]()[_0x5bff('0x9c')](_0x5bff('0xa9'))[_0x5bff('0x9d')](['phone','scheduledAt',_0x5bff('0xa1'),_0x5bff('0x9f'),_0x5bff('0x61'),_0x5bff('0x58'),'updatedAt'],squel[_0x5bff('0x7f')]()[_0x5bff('0x80')](_0x5bff('0x9e'),_0x5bff('0x9e'))['field']('\x27'+_0x1211dd+'\x27',_0x5bff('0xa0'))['field']('id',_0x5bff('0xa1'))[_0x5bff('0x80')](_0x5661a3[_0x5bff('0xa2')][_0x5bff('0x85')](),_0x5bff('0x9f'))[_0x5bff('0x80')](_0x3ab58c[_0x5bff('0x4d')]['id']['toString'](),_0x5bff('0x61'))[_0x5bff('0x80')]('\x27'+_0x1211dd+'\x27',_0x5bff('0x58'))[_0x5bff('0x80')]('\x27'+_0x1211dd+'\x27',_0x5bff('0x59'))[_0x5bff('0xa3')](_0x5bff('0xa4'))[_0x5bff('0x45')]('deletedAt\x20IS\x20NULL')['where'](_0x5bff('0xa6'),_0x5661a3[_0x5bff('0xa2')][_0x5bff('0x85')]())[_0x5bff('0x45')](_0x5bff('0xab')))[_0x5bff('0x85')]();}_0x5cb17b[_0x5bff('0x91')](db[_0x5bff('0x8b')]['query'](_0x55038b));}return BPromise[_0x5bff('0x89')](_0x5cb17b);}})[_0x5bff('0x27')](function(){var _0x49fa89=[];var _0x4d0d63=squel[_0x5bff('0xae')]()[_0x5bff('0x9c')]('cm_hopper_additional_phones')[_0x5bff('0x9d')]([_0x5bff('0xaf'),_0x5bff('0x9e'),_0x5bff('0xb0'),_0x5bff('0x58'),_0x5bff('0x59')],squel[_0x5bff('0x7f')]()[_0x5bff('0x80')](_0x5bff('0xb1'))[_0x5bff('0x80')](_0x5bff('0xb2'))[_0x5bff('0x80')]('ci.OrderBy+1')[_0x5bff('0x80')]('\x27'+_0x1211dd+'\x27','createdAt')['field']('\x27'+_0x1211dd+'\x27',_0x5bff('0x59'))['from'](_0x5bff('0xb3'),'ci')['join']('cm_hopper','h',_0x5bff('0xb4'))[_0x5bff('0x45')](_0x5bff('0xb5'),_0x1211dd)[_0x5bff('0x45')](_0x5bff('0xb6'),_0x5bff('0xb7')))[_0x5bff('0x85')]();_0x49fa89['push'](db[_0x5bff('0x8b')][_0x5bff('0x3d')](_0x4d0d63));return BPromise[_0x5bff('0x89')](_0x49fa89);})[_0x5bff('0x27')](function(){return _0x4349b6;})[_0x5bff('0x27')](respondWithResult(_0x4549ac,null))[_0x5bff('0x4b')](handleError(_0x4549ac,null));};exports[_0x5bff('0xb8')]=function(_0x4b2909,_0x1117d4,_0x58fb30){return db[_0x5bff('0x38')]['find']({'where':{'id':_0x4b2909['params']['id']}})[_0x5bff('0x27')](handleEntityNotFound(_0x1117d4,null))[_0x5bff('0x27')](function(_0x25fd9e){if(_0x25fd9e){return _0x25fd9e[_0x5bff('0xb8')](_0x4b2909[_0x5bff('0x3d')][_0x5bff('0x7e')]);}})[_0x5bff('0x27')](function(_0x1c6ae4){if(_0x1c6ae4){return db[_0x5bff('0x60')][_0x5bff('0x28')]({'where':{'ListId':_0x4b2909[_0x5bff('0x3d')][_0x5bff('0x7e')],'VoiceQueueId':_0x4b2909[_0x5bff('0x4d')]['id']}})[_0x5bff('0x27')](function(){return _0x1c6ae4;});}})['then'](respondWithStatusCode(_0x1117d4,null))[_0x5bff('0x4b')](handleError(_0x1117d4,null));};exports['getBlackLists']=function(_0x18006c,_0x1898d2,_0x2e424f){var _0x3024dc={};var _0x475472={};var _0x4851f6;var _0x21f3a3;return db[_0x5bff('0x38')][_0x5bff('0x5f')]({'where':{'id':_0x18006c[_0x5bff('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1898d2,null))[_0x5bff('0x27')](function(_0x4a7fec){if(_0x4a7fec){_0x4851f6=_0x4a7fec;_0x475472[_0x5bff('0x3b')]=_[_0x5bff('0x3c')](db[_0x5bff('0x98')][_0x5bff('0x39')]);_0x475472['query']=_['keys'](_0x18006c[_0x5bff('0x3d')]);_0x475472['filters']=_[_0x5bff('0x4e')](_0x475472[_0x5bff('0x3b')],_0x475472[_0x5bff('0x3d')]);_0x3024dc[_0x5bff('0x3f')]=_[_0x5bff('0x4e')](_0x475472[_0x5bff('0x3b')],qs['fields'](_0x18006c[_0x5bff('0x3d')][_0x5bff('0x40')]));_0x3024dc[_0x5bff('0x3f')]=_0x3024dc['attributes'][_0x5bff('0x41')]?_0x3024dc[_0x5bff('0x3f')]:_0x475472['model'];_0x3024dc[_0x5bff('0x43')]=qs['sort'](_0x18006c[_0x5bff('0x3d')]['sort']);_0x3024dc[_0x5bff('0x45')]=qs[_0x5bff('0x3e')](_['pick'](_0x18006c['query'],_0x475472[_0x5bff('0x3e')]));if(_0x18006c[_0x5bff('0x3d')][_0x5bff('0x2c')]){_0x3024dc[_0x5bff('0x45')]=_[_0x5bff('0x47')](_0x3024dc[_0x5bff('0x45')],{'$or':_[_0x5bff('0x37')](_0x3024dc[_0x5bff('0x3f')],function(_0x2b7bb0){var _0x522b00={};_0x522b00[_0x2b7bb0]={'$like':'%'+_0x18006c[_0x5bff('0x3d')][_0x5bff('0x2c')]+'%'};return _0x522b00;})});}_0x3024dc=_[_0x5bff('0x47')]({},_0x3024dc,_0x18006c[_0x5bff('0x49')]);return _0x4851f6[_0x5bff('0xb9')](_0x3024dc);}})[_0x5bff('0x27')](function(_0x5a4575){if(_0x5a4575){_0x21f3a3=_0x5a4575[_0x5bff('0x41')];if(!_0x18006c[_0x5bff('0x3d')]['hasOwnProperty'](_0x5bff('0x42'))){_0x3024dc[_0x5bff('0x21')]=qs[_0x5bff('0x21')](_0x18006c[_0x5bff('0x3d')]['limit']);_0x3024dc['offset']=qs[_0x5bff('0x1e')](_0x18006c[_0x5bff('0x3d')][_0x5bff('0x1e')]);}return _0x4851f6[_0x5bff('0xb9')](_0x3024dc);}})['then'](function(_0x65d0b9){if(_0x65d0b9){return _0x65d0b9?{'count':_0x21f3a3,'rows':_0x65d0b9}:null;}})['then'](respondWithResult(_0x1898d2,null))[_0x5bff('0x4b')](handleError(_0x1898d2,null));};exports[_0x5bff('0xba')]=function(_0x36d8bf,_0x5cd994,_0x45ad56){var _0x158dcd,_0x2fc03d;return db[_0x5bff('0x38')]['find']({'where':{'id':_0x36d8bf[_0x5bff('0x4d')]['id']}})[_0x5bff('0x27')](handleEntityNotFound(_0x5cd994,null))[_0x5bff('0x27')](function(_0x44a748){if(_0x44a748){_0x2fc03d=_0x44a748;return _0x44a748[_0x5bff('0xba')](_0x36d8bf['body'][_0x5bff('0x7e')],_['omit'](_0x36d8bf[_0x5bff('0x51')],[_0x5bff('0x7e'),'id'])||{});}return null;})[_0x5bff('0x8f')](function(_0x16c7c2){var _0x565543;_0x158dcd=_0x16c7c2||[];var _0x41e374=[];if(_0x16c7c2){for(var _0x1e838a=0x0;_0x1e838a<_0x16c7c2['length'];_0x1e838a+=0x1){var _0x4410cd=_0x16c7c2[_0x1e838a][_0x5bff('0x29')]({'plain':!![]});_0x565543=squel[_0x5bff('0xae')]()[_0x5bff('0x9c')]('cm_hopper_black')['fromQuery']([_0x5bff('0x9e'),'ContactId',_0x5bff('0x9f'),_0x5bff('0x61'),_0x5bff('0x58'),'updatedAt'],squel[_0x5bff('0x7f')]()[_0x5bff('0x80')](_0x5bff('0x9e'),_0x5bff('0x9e'))['field']('id',_0x5bff('0xa1'))[_0x5bff('0x80')](_0x4410cd['CmListId'][_0x5bff('0x85')](),_0x5bff('0x9f'))[_0x5bff('0x80')](_0x36d8bf['params']['id']['toString'](),_0x5bff('0x61'))[_0x5bff('0x80')]('NOW()',_0x5bff('0x58'))['field'](_0x5bff('0xbb'),_0x5bff('0x59'))['from'](_0x5bff('0xa4'))[_0x5bff('0x45')](_0x5bff('0xa5'))[_0x5bff('0x45')](_0x5bff('0xa6'),_0x4410cd['CmListId']['toString']())['where'](_0x5bff('0xab')))[_0x5bff('0x85')]();_0x41e374['push'](db[_0x5bff('0x8b')][_0x5bff('0x3d')](_0x565543));}return BPromise[_0x5bff('0x89')](_0x41e374);}})[_0x5bff('0x27')](function(){return _0x158dcd;})[_0x5bff('0x27')](respondWithResult(_0x5cd994,null))[_0x5bff('0x4b')](handleError(_0x5cd994,null));};exports[_0x5bff('0xbc')]=function(_0x5bda13,_0xe3a6ff,_0x5d5c57){return db['VoiceQueue']['find']({'where':{'id':_0x5bda13['params']['id']}})[_0x5bff('0x27')](handleEntityNotFound(_0xe3a6ff,null))[_0x5bff('0x27')](function(_0x2422cc){if(_0x2422cc){return _0x2422cc['removeBlackLists'](_0x5bda13[_0x5bff('0x3d')][_0x5bff('0x7e')]);}})['then'](function(_0x2c55a9){if(_0x2c55a9){return db[_0x5bff('0x68')][_0x5bff('0x28')]({'where':{'ListId':_0x5bda13[_0x5bff('0x3d')][_0x5bff('0x7e')],'VoiceQueueId':_0x5bda13[_0x5bff('0x4d')]['id']}})[_0x5bff('0x27')](function(){return _0x2c55a9;});}})['then'](respondWithStatusCode(_0xe3a6ff,null))['catch'](handleError(_0xe3a6ff,null));}; \ No newline at end of file +var _0x3e4d=['localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','sendStatus','error','stack','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','VIRTUAL','merge','options','VoiceQueue','includeAll','include','findAll','rows','catch','params','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','VoiceQueues','inbound','QueueCampaigns','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','autoAssociation','getHoppers','CmHopper','sort','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','teams','Team','User','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','interface','format','removeTeams','field','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','compact','ids','isEmpty','removeAgents','UserVoiceQueueRt','emit','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','isNil','SIP/%s','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','select','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','VoiceQueueId\x20=\x20?','onlyIfOpen','cm_contacts','push','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','eml-format','zip-dir','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x420b48,_0x49c12e){var _0x1d49d9=function(_0x28d82e){while(--_0x28d82e){_0x420b48['push'](_0x420b48['shift']());}};_0x1d49d9(++_0x49c12e);}(_0x3e4d,0x16d));var _0xd3e4=function(_0x556d40,_0x268820){_0x556d40=_0x556d40-0x0;var _0x1fbca0=_0x3e4d[_0x556d40];return _0x1fbca0;};'use strict';var emlformat=require(_0xd3e4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd3e4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd3e4('0x2'));var Mustache=require(_0xd3e4('0x3'));var util=require(_0xd3e4('0x4'));var path=require('path');var sox=require(_0xd3e4('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd3e4('0x6'));var _=require(_0xd3e4('0x7'));var squel=require(_0xd3e4('0x8'));var crypto=require(_0xd3e4('0x9'));var jsforce=require(_0xd3e4('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd3e4('0xb'));var querystring=require(_0xd3e4('0xc'));var Papa=require(_0xd3e4('0xd'));var Redis=require('ioredis');var authService=require(_0xd3e4('0xe'));var qs=require(_0xd3e4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3e4('0x10'))(_0xd3e4('0x11'));var utils=require(_0xd3e4('0x12'));var config=require(_0xd3e4('0x13'));var licenseUtil=require(_0xd3e4('0x14'));var db=require(_0xd3e4('0x15'))['db'];config[_0xd3e4('0x16')]=_['defaults'](config[_0xd3e4('0x16')],{'host':_0xd3e4('0x17'),'port':0x18eb});var socket=require(_0xd3e4('0x18'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0xd3e4('0x19')](socket);function respondWithStatusCode(_0x4abd20,_0x33daec){_0x33daec=_0x33daec||0xcc;return function(_0xa878f1){if(_0xa878f1){return _0x4abd20['sendStatus'](_0x33daec);}return _0x4abd20[_0xd3e4('0x1a')](_0x33daec)[_0xd3e4('0x1b')]();};}function respondWithResult(_0x4d5136,_0x4fae0a){_0x4fae0a=_0x4fae0a||0xc8;return function(_0x5acc91){if(_0x5acc91){return _0x4d5136[_0xd3e4('0x1a')](_0x4fae0a)[_0xd3e4('0x1c')](_0x5acc91);}};}function respondWithFilteredResult(_0xd6de64,_0x157658){return function(_0xcf261b){if(_0xcf261b){var _0x48d143=typeof _0x157658[_0xd3e4('0x1d')]===_0xd3e4('0x1e')&&typeof _0x157658[_0xd3e4('0x1f')]==='undefined';var _0x413a10=_0xcf261b[_0xd3e4('0x20')];var _0x3ccba5=_0x48d143?0x0:_0x157658['offset'];var _0x5946a7=_0x48d143?_0xcf261b[_0xd3e4('0x20')]:_0x157658[_0xd3e4('0x1d')]+_0x157658[_0xd3e4('0x1f')];var _0x4386b0;if(_0x5946a7>=_0x413a10){_0x5946a7=_0x413a10;_0x4386b0=0xc8;}else{_0x4386b0=0xce;}_0xd6de64[_0xd3e4('0x1a')](_0x4386b0);return _0xd6de64[_0xd3e4('0x21')](_0xd3e4('0x22'),_0x3ccba5+'-'+_0x5946a7+'/'+_0x413a10)[_0xd3e4('0x1c')](_0xcf261b);}return null;};}function patchUpdates(_0x27019e){return function(_0x522f94){try{jsonpatch[_0xd3e4('0x23')](_0x522f94,_0x27019e,!![]);}catch(_0x5cd1fa){return BPromise[_0xd3e4('0x24')](_0x5cd1fa);}return _0x522f94[_0xd3e4('0x25')]();};}function saveUpdates(_0xe295b6,_0x82d2c5){return function(_0x426aa4){if(_0x426aa4){return _0x426aa4[_0xd3e4('0x26')](_0xe295b6)[_0xd3e4('0x27')](function(_0x4d24ab){return _0x4d24ab;});}return null;};}function removeEntity(_0x512ab8,_0x81b1f5){return function(_0x239763){if(_0x239763){return _0x239763[_0xd3e4('0x28')]()[_0xd3e4('0x27')](function(){var _0x868020=_0x239763[_0xd3e4('0x29')]({'plain':!![]});var _0x462586=[{'name':'VoiceQueues','value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0xd3e4('0x2a'),'ignore':![]}];var _0x5e96fc=_(_0x462586)[_0xd3e4('0x2b')](_0xd3e4('0x2c'))['map'](_0xd3e4('0x2d'))[_0xd3e4('0x2d')]();if(_[_0xd3e4('0x2e')](_0x5e96fc,_0x868020[_0xd3e4('0x2f')])){return;}var _0x49fc85=_[_0xd3e4('0x30')](_0x462586,[_0xd3e4('0x2d'),_0x868020[_0xd3e4('0x2f')]])[_0xd3e4('0x31')];return db[_0xd3e4('0x32')]['destroy']({'where':{'type':_0x49fc85,'resourceId':_0x868020['id']}})[_0xd3e4('0x27')](function(){return _0x239763;});})['then'](function(){_0x512ab8[_0xd3e4('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x594ed3,_0x57446a){return function(_0x2c6cce){if(!_0x2c6cce){_0x594ed3[_0xd3e4('0x33')](0x194);}return _0x2c6cce;};}function handleError(_0x18998a,_0x48534a){_0x48534a=_0x48534a||0x1f4;return function(_0x354772){logger[_0xd3e4('0x34')](_0x354772[_0xd3e4('0x35')]);if(_0x354772[_0xd3e4('0x31')]){delete _0x354772[_0xd3e4('0x31')];}_0x18998a[_0xd3e4('0x1a')](_0x48534a)['send'](_0x354772);};}exports['index']=function(_0x18bc38,_0x479d00){var _0x85379e={},_0x373c99={},_0x42d363={'count':0x0,'rows':[]};var _0x58c9b1=_[_0xd3e4('0x36')](db['VoiceQueue'][_0xd3e4('0x37')],function(_0x361699){return{'name':_0x361699[_0xd3e4('0x38')],'type':_0x361699[_0xd3e4('0x2f')]['key']};});_0x373c99[_0xd3e4('0x39')]=_['map'](_0x58c9b1,_0xd3e4('0x31'));_0x373c99[_0xd3e4('0x3a')]=_[_0xd3e4('0x3b')](_0x18bc38['query']);_0x373c99[_0xd3e4('0x3c')]=_[_0xd3e4('0x3d')](_0x373c99[_0xd3e4('0x39')],_0x373c99[_0xd3e4('0x3a')]);_0x85379e[_0xd3e4('0x3e')]=_[_0xd3e4('0x3d')](_0x373c99[_0xd3e4('0x39')],qs[_0xd3e4('0x3f')](_0x18bc38[_0xd3e4('0x3a')][_0xd3e4('0x3f')]));_0x85379e[_0xd3e4('0x3e')]=_0x85379e[_0xd3e4('0x3e')]['length']?_0x85379e[_0xd3e4('0x3e')]:_0x373c99[_0xd3e4('0x39')];if(!_0x18bc38[_0xd3e4('0x3a')][_0xd3e4('0x40')](_0xd3e4('0x41'))){_0x85379e[_0xd3e4('0x1f')]=qs[_0xd3e4('0x1f')](_0x18bc38[_0xd3e4('0x3a')][_0xd3e4('0x1f')]);_0x85379e['offset']=qs[_0xd3e4('0x1d')](_0x18bc38['query']['offset']);}_0x85379e[_0xd3e4('0x42')]=qs['sort'](_0x18bc38[_0xd3e4('0x3a')]['sort']);_0x85379e[_0xd3e4('0x43')]=qs[_0xd3e4('0x3c')](_[_0xd3e4('0x44')](_0x18bc38[_0xd3e4('0x3a')],_0x373c99[_0xd3e4('0x3c')]),_0x58c9b1);if(_0x18bc38[_0xd3e4('0x3a')][_0xd3e4('0x2b')]){_0x85379e['where']=_['merge'](_0x85379e['where'],{'$or':_[_0xd3e4('0x36')](_0x58c9b1,function(_0x32e5a5){if(_0x32e5a5[_0xd3e4('0x2f')]!==_0xd3e4('0x45')){var _0x15403b={};_0x15403b[_0x32e5a5[_0xd3e4('0x31')]]={'$like':'%'+_0x18bc38[_0xd3e4('0x3a')][_0xd3e4('0x2b')]+'%'};return _0x15403b;}})});}_0x85379e=_[_0xd3e4('0x46')]({},_0x85379e,_0x18bc38[_0xd3e4('0x47')]);var _0x50598d={'where':_0x85379e[_0xd3e4('0x43')]};return db[_0xd3e4('0x48')][_0xd3e4('0x20')](_0x50598d)[_0xd3e4('0x27')](function(_0x1d4cb7){_0x42d363[_0xd3e4('0x20')]=_0x1d4cb7;if(_0x18bc38[_0xd3e4('0x3a')][_0xd3e4('0x49')]){_0x85379e[_0xd3e4('0x4a')]=[{'all':!![]}];}return db[_0xd3e4('0x48')][_0xd3e4('0x4b')](_0x85379e);})[_0xd3e4('0x27')](function(_0x5bb4c8){_0x42d363[_0xd3e4('0x4c')]=_0x5bb4c8;return _0x42d363;})[_0xd3e4('0x27')](respondWithFilteredResult(_0x479d00,_0x85379e))[_0xd3e4('0x4d')](handleError(_0x479d00,null));};exports['show']=function(_0x12df0d,_0x515728){var _0x199354={'raw':![],'where':{'id':_0x12df0d[_0xd3e4('0x4e')]['id']}},_0x13b56d={};_0x13b56d[_0xd3e4('0x39')]=_[_0xd3e4('0x3b')](db['VoiceQueue'][_0xd3e4('0x37')]);_0x13b56d[_0xd3e4('0x3a')]=_['keys'](_0x12df0d[_0xd3e4('0x3a')]);_0x13b56d[_0xd3e4('0x3c')]=_[_0xd3e4('0x3d')](_0x13b56d['model'],_0x13b56d[_0xd3e4('0x3a')]);_0x199354[_0xd3e4('0x3e')]=_[_0xd3e4('0x3d')](_0x13b56d[_0xd3e4('0x39')],qs[_0xd3e4('0x3f')](_0x12df0d[_0xd3e4('0x3a')][_0xd3e4('0x3f')]));_0x199354['attributes']=_0x199354[_0xd3e4('0x3e')][_0xd3e4('0x4f')]?_0x199354[_0xd3e4('0x3e')]:_0x13b56d[_0xd3e4('0x39')];if(_0x12df0d['query'][_0xd3e4('0x49')]){_0x199354[_0xd3e4('0x4a')]=[{'all':!![]}];}_0x199354=_['merge']({},_0x199354,_0x12df0d['options']);return db[_0xd3e4('0x48')][_0xd3e4('0x30')](_0x199354)[_0xd3e4('0x27')](handleEntityNotFound(_0x515728,null))[_0xd3e4('0x27')](respondWithResult(_0x515728,null))['catch'](handleError(_0x515728,null));};exports[_0xd3e4('0x50')]=function(_0x391cef,_0x123607){return db['VoiceQueue'][_0xd3e4('0x50')](_0x391cef[_0xd3e4('0x51')],{})[_0xd3e4('0x27')](function(_0x2df2e7){var _0x2b534f=_0x391cef['user'][_0xd3e4('0x29')]({'plain':!![]});if(!_0x2b534f)throw new Error(_0xd3e4('0x52'));if(_0x2b534f[_0xd3e4('0x53')]===_0xd3e4('0x54')){var _0x4954ec=_0x2df2e7['get']({'plain':!![]});var _0x5e8843=[{'name':_0xd3e4('0x55'),'value':_0xd3e4('0x56')},{'name':_0xd3e4('0x57'),'value':'outbound'}];var _0x51efb9=_[_0xd3e4('0x30')](_0x5e8843,[_0xd3e4('0x2d'),_0x4954ec[_0xd3e4('0x2f')]])[_0xd3e4('0x31')];return db[_0xd3e4('0x58')][_0xd3e4('0x30')]({'where':{'name':_0x51efb9,'userProfileId':_0x2b534f['userProfileId']},'raw':!![]})[_0xd3e4('0x27')](function(_0xc01cf){if(_0xc01cf&&_0xc01cf['autoAssociation']===0x0){return db[_0xd3e4('0x32')]['create']({'name':_0x4954ec['name'],'resourceId':_0x4954ec['id'],'type':_0xc01cf[_0xd3e4('0x31')],'sectionId':_0xc01cf['id']},{})[_0xd3e4('0x27')](function(){return _0x2df2e7;});}else{return _0x2df2e7;}})[_0xd3e4('0x4d')](function(_0x16543a){logger[_0xd3e4('0x34')](_0xd3e4('0x59'),_0x16543a);throw _0x16543a;});}return _0x2df2e7;})[_0xd3e4('0x27')](respondWithResult(_0x123607,0xc9))[_0xd3e4('0x4d')](handleError(_0x123607,null));};exports[_0xd3e4('0x5a')]=function(_0x8f0010,_0x209743){var _0x31ae08={'where':{'id':_0x8f0010[_0xd3e4('0x4e')]['id']}},_0x3197f3={};_0x3197f3[_0xd3e4('0x39')]=_[_0xd3e4('0x3b')](db[_0xd3e4('0x48')][_0xd3e4('0x37')]);_0x31ae08[_0xd3e4('0x3e')]=_[_0xd3e4('0x3d')](_0x3197f3[_0xd3e4('0x39')],qs[_0xd3e4('0x3f')](_0x8f0010['query'][_0xd3e4('0x3f')]));_0x31ae08[_0xd3e4('0x3e')]=_0x31ae08[_0xd3e4('0x3e')]['length']?_0x31ae08[_0xd3e4('0x3e')]:_0x3197f3['model'];if(_0x8f0010['query'][_0xd3e4('0x49')]){_0x31ae08[_0xd3e4('0x4a')]=[{'all':!![]}];}_0x31ae08=_[_0xd3e4('0x46')]({},_0x31ae08,_0x8f0010['options']);return db[_0xd3e4('0x48')]['find'](_0x31ae08)[_0xd3e4('0x27')](handleEntityNotFound(_0x209743,null))[_0xd3e4('0x27')](function(_0x1c6c1a){if(_0x1c6c1a){var _0x5b2a92=_0x1c6c1a[_0xd3e4('0x29')]({'plain':!![]});_0x5b2a92=qs[_0xd3e4('0x5b')](_0x5b2a92,['id',_0xd3e4('0x5c'),_0xd3e4('0x5d')]);_0x8f0010[_0xd3e4('0x51')]=_[_0xd3e4('0x5b')](_0x8f0010[_0xd3e4('0x51')],['id',_0xd3e4('0x5c'),_0xd3e4('0x5d')]);return db['VoiceQueue'][_0xd3e4('0x50')](_[_0xd3e4('0x46')](_0x5b2a92,_0x8f0010[_0xd3e4('0x51')]),{'include':_0x8f0010[_0xd3e4('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0xd3e4('0x27')](function(_0x45174a){var _0x38d348=_0x8f0010[_0xd3e4('0x54')][_0xd3e4('0x29')]({'plain':!![]});if(!_0x38d348)throw new Error(_0xd3e4('0x52'));if(_0x38d348[_0xd3e4('0x53')]===_0xd3e4('0x54')){var _0x1e5be4=_0x45174a['get']({'plain':!![]});var _0x2d46c3=[{'name':_0xd3e4('0x55'),'value':_0xd3e4('0x56')},{'name':'QueueCampaigns','value':_0xd3e4('0x2a')}];var _0x2eef54=_[_0xd3e4('0x30')](_0x2d46c3,['value',_0x1e5be4['type']])[_0xd3e4('0x31')];return db['UserProfileSection']['find']({'where':{'name':_0x2eef54,'userProfileId':_0x38d348[_0xd3e4('0x5e')]},'raw':!![]})[_0xd3e4('0x27')](function(_0x151908){if(_0x151908&&_0x151908[_0xd3e4('0x5f')]===0x0){return db[_0xd3e4('0x32')][_0xd3e4('0x50')]({'name':_0x1e5be4['name'],'resourceId':_0x1e5be4['id'],'type':_0x151908[_0xd3e4('0x31')],'sectionId':_0x151908['id']},{})['then'](function(){return _0x45174a;});}else{return _0x45174a;}})[_0xd3e4('0x4d')](function(_0x5c86da){logger[_0xd3e4('0x34')](_0xd3e4('0x59'),_0x5c86da);throw _0x5c86da;});}return _0x45174a;});}})['then'](respondWithResult(_0x209743,0xc9))[_0xd3e4('0x4d')](handleError(_0x209743,null));};exports[_0xd3e4('0x26')]=function(_0x4604e7,_0x56e4fc){if(_0x4604e7['body']['id']){delete _0x4604e7[_0xd3e4('0x51')]['id'];}return db[_0xd3e4('0x48')][_0xd3e4('0x30')]({'where':{'id':_0x4604e7[_0xd3e4('0x4e')]['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x56e4fc,null))[_0xd3e4('0x27')](saveUpdates(_0x4604e7[_0xd3e4('0x51')],null))['then'](respondWithResult(_0x56e4fc,null))[_0xd3e4('0x4d')](handleError(_0x56e4fc,null));};exports['destroy']=function(_0x1e1036,_0x3f90e5){return db[_0xd3e4('0x48')][_0xd3e4('0x30')]({'where':{'id':_0x1e1036[_0xd3e4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3f90e5,null))[_0xd3e4('0x27')](removeEntity(_0x3f90e5,null))[_0xd3e4('0x4d')](handleError(_0x3f90e5,null));};exports[_0xd3e4('0x60')]=function(_0x5258af,_0x3e9978,_0x408b8b){var _0x4bda17={'raw':![],'where':{}};var _0xa4f05f={};var _0x15f853={'count':0x0,'rows':[]};return db[_0xd3e4('0x48')]['findOne']({'where':{'id':_0x5258af['params']['id']}})['then'](handleEntityNotFound(_0x3e9978,null))[_0xd3e4('0x27')](function(_0x3d36dc){if(_0x3d36dc){_0xa4f05f[_0xd3e4('0x39')]=_[_0xd3e4('0x3b')](db[_0xd3e4('0x61')][_0xd3e4('0x37')]);_0xa4f05f['query']=_['keys'](_0x5258af[_0xd3e4('0x3a')]);_0xa4f05f[_0xd3e4('0x3c')]=_[_0xd3e4('0x3d')](_0xa4f05f[_0xd3e4('0x39')],_0xa4f05f[_0xd3e4('0x3a')]);_0x4bda17[_0xd3e4('0x3e')]=_[_0xd3e4('0x3d')](_0xa4f05f[_0xd3e4('0x39')],qs['fields'](_0x5258af[_0xd3e4('0x3a')]['fields']));_0x4bda17[_0xd3e4('0x3e')]=_0x4bda17['attributes'][_0xd3e4('0x4f')]?_0x4bda17[_0xd3e4('0x3e')]:_0xa4f05f[_0xd3e4('0x39')];if(!_0x5258af[_0xd3e4('0x3a')][_0xd3e4('0x40')](_0xd3e4('0x41'))){_0x4bda17[_0xd3e4('0x1f')]=qs[_0xd3e4('0x1f')](_0x5258af['query'][_0xd3e4('0x1f')]);_0x4bda17['offset']=qs[_0xd3e4('0x1d')](_0x5258af[_0xd3e4('0x3a')][_0xd3e4('0x1d')]);}_0x4bda17['order']=qs[_0xd3e4('0x62')](_0x5258af['query'][_0xd3e4('0x62')]);_0x4bda17['where']=qs[_0xd3e4('0x3c')](_[_0xd3e4('0x44')](_0x5258af[_0xd3e4('0x3a')],_0xa4f05f[_0xd3e4('0x3c')]));_0x4bda17[_0xd3e4('0x43')][_0xd3e4('0x63')]=_0x3d36dc['id'];if(_0x5258af['query']['filter']){_0x4bda17[_0xd3e4('0x43')]=_[_0xd3e4('0x46')](_0x4bda17[_0xd3e4('0x43')],{'$or':_[_0xd3e4('0x36')](_0x4bda17[_0xd3e4('0x3e')],function(_0x3e046b){var _0x7f634e={};_0x7f634e[_0x3e046b]={'$like':'%'+_0x5258af[_0xd3e4('0x3a')][_0xd3e4('0x2b')]+'%'};return _0x7f634e;})});}_0x4bda17=_[_0xd3e4('0x46')]({},_0x4bda17,_0x5258af['options']);return db[_0xd3e4('0x61')]['count']({'where':_0x4bda17[_0xd3e4('0x43')]})['then'](function(_0xdc608d){_0x15f853[_0xd3e4('0x20')]=_0xdc608d;if(_0x5258af['query'][_0xd3e4('0x49')]){_0x4bda17[_0xd3e4('0x4a')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x4bda17);})[_0xd3e4('0x27')](function(_0x484f59){_0x15f853[_0xd3e4('0x4c')]=_0x484f59;return _0x15f853;});}})[_0xd3e4('0x27')](respondWithFilteredResult(_0x3e9978,_0x4bda17))['catch'](handleError(_0x3e9978,null));};exports[_0xd3e4('0x64')]=function(_0x2845fe,_0x19d608,_0x1eeb3a){var _0x1318b4={'raw':!![],'where':{}};var _0x4ab109={};var _0x1f5dfe={'count':0x0,'rows':[]};return db[_0xd3e4('0x48')][_0xd3e4('0x65')]({'where':{'id':_0x2845fe[_0xd3e4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x19d608,null))['then'](function(_0x20fd1c){if(_0x20fd1c){_0x4ab109[_0xd3e4('0x39')]=_['keys'](db[_0xd3e4('0x66')]['rawAttributes']);_0x4ab109[_0xd3e4('0x3a')]=_['keys'](_0x2845fe[_0xd3e4('0x3a')]);_0x4ab109[_0xd3e4('0x3c')]=_[_0xd3e4('0x3d')](_0x4ab109[_0xd3e4('0x39')],_0x4ab109['query']);_0x1318b4['attributes']=_['intersection'](_0x4ab109[_0xd3e4('0x39')],qs[_0xd3e4('0x3f')](_0x2845fe[_0xd3e4('0x3a')][_0xd3e4('0x3f')]));_0x1318b4['attributes']=_0x1318b4['attributes']['length']?_0x1318b4[_0xd3e4('0x3e')]:_0x4ab109[_0xd3e4('0x39')];if(!_0x2845fe[_0xd3e4('0x3a')]['hasOwnProperty'](_0xd3e4('0x41'))){_0x1318b4[_0xd3e4('0x1f')]=qs[_0xd3e4('0x1f')](_0x2845fe['query']['limit']);_0x1318b4[_0xd3e4('0x1d')]=qs['offset'](_0x2845fe[_0xd3e4('0x3a')]['offset']);}_0x1318b4[_0xd3e4('0x42')]=qs[_0xd3e4('0x62')](_0x2845fe['query'][_0xd3e4('0x62')]);_0x1318b4[_0xd3e4('0x43')]=qs['filters'](_[_0xd3e4('0x44')](_0x2845fe[_0xd3e4('0x3a')],_0x4ab109[_0xd3e4('0x3c')]));_0x1318b4[_0xd3e4('0x43')]['VoiceQueueId']=_0x20fd1c['id'];if(_0x2845fe[_0xd3e4('0x3a')][_0xd3e4('0x2b')]){_0x1318b4[_0xd3e4('0x43')]=_[_0xd3e4('0x46')](_0x1318b4['where'],{'$or':_[_0xd3e4('0x36')](_0x1318b4[_0xd3e4('0x3e')],function(_0x3da89e){var _0x468600={};_0x468600[_0x3da89e]={'$like':'%'+_0x2845fe['query'][_0xd3e4('0x2b')]+'%'};return _0x468600;})});}_0x1318b4=_[_0xd3e4('0x46')]({},_0x1318b4,_0x2845fe['options']);return db['CmHopperHistory'][_0xd3e4('0x20')]({'where':_0x1318b4['where']})[_0xd3e4('0x27')](function(_0x8c7183){_0x1f5dfe['count']=_0x8c7183;if(_0x2845fe[_0xd3e4('0x3a')][_0xd3e4('0x49')]){_0x1318b4[_0xd3e4('0x4a')]=[{'all':!![]}];}return db[_0xd3e4('0x66')][_0xd3e4('0x4b')](_0x1318b4);})[_0xd3e4('0x27')](function(_0x547e9f){_0x1f5dfe[_0xd3e4('0x4c')]=_0x547e9f;return _0x1f5dfe;});}})[_0xd3e4('0x27')](respondWithFilteredResult(_0x19d608,_0x1318b4))[_0xd3e4('0x4d')](handleError(_0x19d608,null));};exports['getHopperFinals']=function(_0x13bc44,_0x482d08,_0x5ca1c7){var _0x1ebfe3={'raw':!![],'where':{}};var _0x55a4e4={};var _0x2c5aa6={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x13bc44['params']['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x482d08,null))[_0xd3e4('0x27')](function(_0x1825ea){if(_0x1825ea){_0x55a4e4[_0xd3e4('0x39')]=_[_0xd3e4('0x3b')](db['CmHopperFinal'][_0xd3e4('0x37')]);_0x55a4e4[_0xd3e4('0x3a')]=_[_0xd3e4('0x3b')](_0x13bc44[_0xd3e4('0x3a')]);_0x55a4e4[_0xd3e4('0x3c')]=_['intersection'](_0x55a4e4[_0xd3e4('0x39')],_0x55a4e4[_0xd3e4('0x3a')]);_0x1ebfe3[_0xd3e4('0x3e')]=_[_0xd3e4('0x3d')](_0x55a4e4['model'],qs[_0xd3e4('0x3f')](_0x13bc44[_0xd3e4('0x3a')][_0xd3e4('0x3f')]));_0x1ebfe3[_0xd3e4('0x3e')]=_0x1ebfe3['attributes'][_0xd3e4('0x4f')]?_0x1ebfe3[_0xd3e4('0x3e')]:_0x55a4e4[_0xd3e4('0x39')];if(!_0x13bc44[_0xd3e4('0x3a')][_0xd3e4('0x40')](_0xd3e4('0x41'))){_0x1ebfe3[_0xd3e4('0x1f')]=qs[_0xd3e4('0x1f')](_0x13bc44['query'][_0xd3e4('0x1f')]);_0x1ebfe3[_0xd3e4('0x1d')]=qs['offset'](_0x13bc44[_0xd3e4('0x3a')][_0xd3e4('0x1d')]);}_0x1ebfe3['order']=qs[_0xd3e4('0x62')](_0x13bc44[_0xd3e4('0x3a')][_0xd3e4('0x62')]);_0x1ebfe3['where']=qs[_0xd3e4('0x3c')](_['pick'](_0x13bc44[_0xd3e4('0x3a')],_0x55a4e4['filters']));_0x1ebfe3[_0xd3e4('0x43')][_0xd3e4('0x63')]=_0x1825ea['id'];if(_0x13bc44[_0xd3e4('0x3a')][_0xd3e4('0x2b')]){_0x1ebfe3[_0xd3e4('0x43')]=_[_0xd3e4('0x46')](_0x1ebfe3[_0xd3e4('0x43')],{'$or':_[_0xd3e4('0x36')](_0x1ebfe3[_0xd3e4('0x3e')],function(_0x33495e){var _0x1d8fe8={};_0x1d8fe8[_0x33495e]={'$like':'%'+_0x13bc44[_0xd3e4('0x3a')][_0xd3e4('0x2b')]+'%'};return _0x1d8fe8;})});}_0x1ebfe3=_[_0xd3e4('0x46')]({},_0x1ebfe3,_0x13bc44[_0xd3e4('0x47')]);return db[_0xd3e4('0x67')]['count']({'where':_0x1ebfe3[_0xd3e4('0x43')]})[_0xd3e4('0x27')](function(_0x2a4010){_0x2c5aa6['count']=_0x2a4010;if(_0x13bc44['query'][_0xd3e4('0x49')]){_0x1ebfe3[_0xd3e4('0x4a')]=[{'all':!![]}];}return db[_0xd3e4('0x67')][_0xd3e4('0x4b')](_0x1ebfe3);})[_0xd3e4('0x27')](function(_0x54397b){_0x2c5aa6[_0xd3e4('0x4c')]=_0x54397b;return _0x2c5aa6;});}})[_0xd3e4('0x27')](respondWithFilteredResult(_0x482d08,_0x1ebfe3))[_0xd3e4('0x4d')](handleError(_0x482d08,null));};exports[_0xd3e4('0x68')]=function(_0x4ffa97,_0x8bf0bb,_0x17e4f4){var _0x2b3394={'raw':!![],'where':{}};var _0x463f8c={};var _0x449225={'count':0x0,'rows':[]};return db[_0xd3e4('0x48')][_0xd3e4('0x65')]({'where':{'id':_0x4ffa97[_0xd3e4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x8bf0bb,null))[_0xd3e4('0x27')](function(_0x211ad0){if(_0x211ad0){_0x463f8c[_0xd3e4('0x39')]=_[_0xd3e4('0x3b')](db[_0xd3e4('0x69')][_0xd3e4('0x37')]);_0x463f8c['query']=_[_0xd3e4('0x3b')](_0x4ffa97[_0xd3e4('0x3a')]);_0x463f8c[_0xd3e4('0x3c')]=_[_0xd3e4('0x3d')](_0x463f8c[_0xd3e4('0x39')],_0x463f8c[_0xd3e4('0x3a')]);_0x2b3394[_0xd3e4('0x3e')]=_['intersection'](_0x463f8c['model'],qs[_0xd3e4('0x3f')](_0x4ffa97[_0xd3e4('0x3a')][_0xd3e4('0x3f')]));_0x2b3394[_0xd3e4('0x3e')]=_0x2b3394[_0xd3e4('0x3e')][_0xd3e4('0x4f')]?_0x2b3394['attributes']:_0x463f8c[_0xd3e4('0x39')];if(!_0x4ffa97[_0xd3e4('0x3a')]['hasOwnProperty']('nolimit')){_0x2b3394[_0xd3e4('0x1f')]=qs[_0xd3e4('0x1f')](_0x4ffa97['query']['limit']);_0x2b3394['offset']=qs[_0xd3e4('0x1d')](_0x4ffa97[_0xd3e4('0x3a')][_0xd3e4('0x1d')]);}_0x2b3394[_0xd3e4('0x42')]=qs['sort'](_0x4ffa97['query'][_0xd3e4('0x62')]);_0x2b3394[_0xd3e4('0x43')]=qs[_0xd3e4('0x3c')](_[_0xd3e4('0x44')](_0x4ffa97[_0xd3e4('0x3a')],_0x463f8c[_0xd3e4('0x3c')]));_0x2b3394[_0xd3e4('0x43')][_0xd3e4('0x63')]=_0x211ad0['id'];if(_0x4ffa97[_0xd3e4('0x3a')][_0xd3e4('0x2b')]){_0x2b3394[_0xd3e4('0x43')]=_[_0xd3e4('0x46')](_0x2b3394['where'],{'$or':_[_0xd3e4('0x36')](_0x2b3394[_0xd3e4('0x3e')],function(_0x598875){var _0x4d3905={};_0x4d3905[_0x598875]={'$like':'%'+_0x4ffa97['query'][_0xd3e4('0x2b')]+'%'};return _0x4d3905;})});}_0x2b3394=_[_0xd3e4('0x46')]({},_0x2b3394,_0x4ffa97['options']);return db['CmHopperBlack']['count']({'where':_0x2b3394[_0xd3e4('0x43')]})[_0xd3e4('0x27')](function(_0x3d65bf){_0x449225[_0xd3e4('0x20')]=_0x3d65bf;if(_0x4ffa97[_0xd3e4('0x3a')][_0xd3e4('0x49')]){_0x2b3394[_0xd3e4('0x4a')]=[{'all':!![]}];}return db[_0xd3e4('0x69')][_0xd3e4('0x4b')](_0x2b3394);})['then'](function(_0x8ca022){_0x449225['rows']=_0x8ca022;return _0x449225;});}})['then'](respondWithFilteredResult(_0x8bf0bb,_0x2b3394))[_0xd3e4('0x4d')](handleError(_0x8bf0bb,null));};exports[_0xd3e4('0x6a')]=function(_0x54b894,_0x3e709b,_0x17d957){var _0x487868={};var _0x8082d3={};var _0x17c5d6;var _0x362da4;return db[_0xd3e4('0x48')][_0xd3e4('0x65')]({'where':{'id':_0x54b894[_0xd3e4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3e709b,null))['then'](function(_0x438f5a){if(_0x438f5a){_0x17c5d6=_0x438f5a;_0x8082d3[_0xd3e4('0x39')]=_[_0xd3e4('0x3b')](db['Team']['rawAttributes']);_0x8082d3[_0xd3e4('0x3a')]=_[_0xd3e4('0x3b')](_0x54b894[_0xd3e4('0x3a')]);_0x8082d3['filters']=_[_0xd3e4('0x3d')](_0x8082d3[_0xd3e4('0x39')],_0x8082d3['query']);_0x487868[_0xd3e4('0x3e')]=_['intersection'](_0x8082d3[_0xd3e4('0x39')],qs['fields'](_0x54b894[_0xd3e4('0x3a')][_0xd3e4('0x3f')]));_0x487868[_0xd3e4('0x3e')]=_0x487868[_0xd3e4('0x3e')][_0xd3e4('0x4f')]?_0x487868[_0xd3e4('0x3e')]:_0x8082d3['model'];_0x487868[_0xd3e4('0x42')]=qs[_0xd3e4('0x62')](_0x54b894['query'][_0xd3e4('0x62')]);_0x487868[_0xd3e4('0x43')]=qs[_0xd3e4('0x3c')](_[_0xd3e4('0x44')](_0x54b894[_0xd3e4('0x3a')],_0x8082d3[_0xd3e4('0x3c')]));if(_0x54b894[_0xd3e4('0x3a')][_0xd3e4('0x2b')]){_0x487868['where']=_[_0xd3e4('0x46')](_0x487868['where'],{'$or':_['map'](_0x487868['attributes'],function(_0xb791a2){var _0x2d24c2={};_0x2d24c2[_0xb791a2]={'$like':'%'+_0x54b894['query'][_0xd3e4('0x2b')]+'%'};return _0x2d24c2;})});}_0x487868=_[_0xd3e4('0x46')]({},_0x487868,_0x54b894[_0xd3e4('0x47')]);return _0x17c5d6[_0xd3e4('0x6a')](_0x487868);}})[_0xd3e4('0x27')](function(_0x5c5b81){if(_0x5c5b81){_0x362da4=_0x5c5b81[_0xd3e4('0x4f')];if(!_0x54b894[_0xd3e4('0x3a')][_0xd3e4('0x40')]('nolimit')){_0x487868['limit']=qs['limit'](_0x54b894['query'][_0xd3e4('0x1f')]);_0x487868[_0xd3e4('0x1d')]=qs[_0xd3e4('0x1d')](_0x54b894[_0xd3e4('0x3a')][_0xd3e4('0x1d')]);}return _0x17c5d6[_0xd3e4('0x6a')](_0x487868);}})[_0xd3e4('0x27')](function(_0x2c540c){if(_0x2c540c){return _0x2c540c?{'count':_0x362da4,'rows':_0x2c540c}:null;}})[_0xd3e4('0x27')](respondWithResult(_0x3e709b,null))[_0xd3e4('0x4d')](handleError(_0x3e709b,null));};exports['addTeams']=function(_0x49eeea,_0x4f4acc,_0x155d94){var _0x1bb176=_0x49eeea[_0xd3e4('0x51')][_0xd3e4('0x6b')];var _0x5befdd=_[_0xd3e4('0x36')](_0x1bb176,'id');return db[_0xd3e4('0x6c')][_0xd3e4('0x4b')]({'where':{'id':_0x5befdd},'attributes':['id'],'include':[{'model':db[_0xd3e4('0x6d')],'as':_0xd3e4('0x6e'),'attributes':['id',_0xd3e4('0x31'),_0xd3e4('0x6f'),_0xd3e4('0x70'),'interface'],'raw':!![]}]})['then'](function(_0x4bd920){if(_0x4bd920){var _0x196115=_[_0xd3e4('0x71')](_0x4bd920,function(_0x7d215b){var _0x5cfb3f=_0x7d215b['get']({'plain':!![]});_0x5cfb3f[_0xd3e4('0x6e')][_0xd3e4('0x72')](function(_0x487f74){_0x487f74[_0xd3e4('0x73')]=_[_0xd3e4('0x30')](_0x1bb176,{'id':_0x5cfb3f['id']})[_0xd3e4('0x73')];});return _0x5cfb3f[_0xd3e4('0x6e')];});return db[_0xd3e4('0x48')]['find']({'where':{'id':_0x49eeea[_0xd3e4('0x4e')]['id']}})[_0xd3e4('0x27')](function(_0x4e1a47){return db[_0xd3e4('0x74')][_0xd3e4('0x75')](function(_0x4cf2b1){return _0x4e1a47[_0xd3e4('0x76')](_0x5befdd,{'transaction':_0x4cf2b1})[_0xd3e4('0x27')](function(){return BPromise[_0xd3e4('0x77')](_0x1bb176,function(_0xff1d71){return db[_0xd3e4('0x78')][_0xd3e4('0x79')]({'TeamId':_0xff1d71['id'],'VoiceQueueId':_0x49eeea[_0xd3e4('0x4e')]['id'],'penalty':_0xff1d71[_0xd3e4('0x73')]},{'transaction':_0x4cf2b1});});})[_0xd3e4('0x27')](function(){return BPromise[_0xd3e4('0x77')](_0x196115,function(_0x3e12e7){return db[_0xd3e4('0x7a')]['findOrCreate']({'where':{'UserId':_0x3e12e7['id'],'VoiceQueueId':_0x49eeea[_0xd3e4('0x4e')]['id']},'defaults':{'penalty':_0x3e12e7[_0xd3e4('0x73')]},'transaction':_0x4cf2b1});});})[_0xd3e4('0x27')](function(){return BPromise[_0xd3e4('0x77')](_[_0xd3e4('0x2b')](_0x196115,{'online':!![]}),function(_0xe18bed){return db['UserVoiceQueueRt'][_0xd3e4('0x79')]({'membername':_0xe18bed[_0xd3e4('0x31')],'UserId':_0xe18bed['id'],'queue_name':_0x4e1a47['name'],'VoiceQueueId':_0x4e1a47['id'],'interface':_['isNil'](_0xe18bed[_0xd3e4('0x7b')])?util[_0xd3e4('0x7c')]('SIP/%s',_0xe18bed[_0xd3e4('0x31')]):_0xe18bed[_0xd3e4('0x7b')],'paused':_0xe18bed[_0xd3e4('0x70')]||![],'penalty':_0xe18bed['penalty']},{'transaction':_0x4cf2b1});});})[_0xd3e4('0x27')](function(){_0x196115[_0xd3e4('0x72')](function(_0x42e8fb){socket['emit']('userVoiceQueue:save',{'UserId':_0x42e8fb['id'],'VoiceQueueId':_0x4e1a47['id']});});});});});}})['then'](respondWithStatusCode(_0x4f4acc,null))[_0xd3e4('0x4d')](handleError(_0x4f4acc,null));};exports[_0xd3e4('0x7d')]=function(_0x1d4997,_0xba3397,_0x3324ca){return db['Team'][_0xd3e4('0x4b')]({'where':{'id':_0x1d4997['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xd3e4('0x6d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd3e4('0x27')](handleEntityNotFound(_0xba3397,null))[_0xd3e4('0x27')](function(_0x53fd2f){var _0x22201a=_[_0xd3e4('0x36')](_0x53fd2f,'id');var _0x59b26f=[];var _0x8ec9af=[];var _0x2a5cdd=squel['select']();_0x2a5cdd[_0xd3e4('0x7e')]('tq.TeamId')['from'](_0xd3e4('0x7f'),'tq')[_0xd3e4('0x80')](_0xd3e4('0x81'),'ut',_0xd3e4('0x82'))[_0xd3e4('0x43')]('VoiceQueueId\x20=\x20?',_0x1d4997['params']['id']);for(var _0x5ecd2d=0x0;_0x5ecd2d<_0x53fd2f[_0xd3e4('0x4f')];_0x5ecd2d+=0x1){let _0x1c1d4b=_0x53fd2f[_0x5ecd2d];for(var _0x1a1a07=0x0;_0x1a1a07<_0x1c1d4b[_0xd3e4('0x6e')][_0xd3e4('0x4f')];_0x1a1a07+=0x1){let _0x8a743d=_0x1c1d4b[_0xd3e4('0x6e')][_0x1a1a07];var _0x14f4bc=_0x2a5cdd[_0xd3e4('0x5a')]();_0x14f4bc['where'](_0xd3e4('0x83'),_0x8a743d['id']);_0x8ec9af['push'](db[_0xd3e4('0x74')]['query'](_0x14f4bc[_0xd3e4('0x84')](),{'type':db[_0xd3e4('0x74')][_0xd3e4('0x85')][_0xd3e4('0x86')]})[_0xd3e4('0x27')](function(_0x26e3c9){if(_0x26e3c9['length']===0x1){return _0x8a743d['id'];}else{var _0x22a0bd=_[_0xd3e4('0x87')](_['map'](_0x26e3c9,_0xd3e4('0x88')),function(_0x184fc1){return _[_0xd3e4('0x2e')](_0x22201a,_0x184fc1);});if(_0x22a0bd){return _0x8a743d['id'];}}}));}}return BPromise[_0xd3e4('0x89')](_0x8ec9af)[_0xd3e4('0x27')](function(_0x2ba22b){_0x59b26f=_(_0x59b26f)['union'](_0x2ba22b)[_0xd3e4('0x8a')]()['value']();return db['VoiceQueue'][_0xd3e4('0x30')]({'where':{'id':_0x1d4997[_0xd3e4('0x4e')]['id']}})[_0xd3e4('0x27')](function(_0x27b4a2){return db[_0xd3e4('0x74')]['transaction'](function(_0x3283cf){return _0x27b4a2[_0xd3e4('0x7d')](_0x1d4997['query'][_0xd3e4('0x8b')],{'transaction':_0x3283cf})[_0xd3e4('0x27')](function(){if(!_[_0xd3e4('0x8c')](_0x59b26f)){return _0x27b4a2[_0xd3e4('0x8d')](_0x59b26f,{'transaction':_0x3283cf})[_0xd3e4('0x27')](function(){return db[_0xd3e4('0x8e')]['destroy']({'where':{'VoiceQueueId':_0x1d4997[_0xd3e4('0x4e')]['id'],'UserId':_0x59b26f},'transaction':_0x3283cf});});}})[_0xd3e4('0x27')](function(){_0x59b26f['forEach'](function(_0x5c01c7){socket[_0xd3e4('0x8f')](_0xd3e4('0x90'),{'UserId':_0x5c01c7,'VoiceQueueId':_0x27b4a2['id']});});});});});});})['then'](respondWithStatusCode(_0xba3397,null))[_0xd3e4('0x4d')](handleError(_0xba3397,null));};exports[_0xd3e4('0x91')]=function(_0x8c99b3,_0x27d9b0,_0x2ec18a){var _0x56e2fd,_0x1318ca;return db[_0xd3e4('0x48')]['find']({'where':{'id':_0x8c99b3['params']['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x27d9b0,null))['then'](function(_0x5c5d83){if(_0x5c5d83){_0x1318ca=_0x5c5d83;return _0x5c5d83[_0xd3e4('0x91')](_0x8c99b3[_0xd3e4('0x51')][_0xd3e4('0x8b')],_[_0xd3e4('0x5b')](_0x8c99b3['body'],['ids','id'])||{})[_0xd3e4('0x92')](function(_0x37a567){for(var _0x562075=0x0;_0x562075<_0x8c99b3[_0xd3e4('0x51')][_0xd3e4('0x8b')][_0xd3e4('0x4f')];_0x562075+=0x1){socket[_0xd3e4('0x8f')](_0xd3e4('0x93'),{'UserId':Number(_0x8c99b3['body'][_0xd3e4('0x8b')][_0x562075]),'VoiceQueueId':Number(_0x8c99b3[_0xd3e4('0x4e')]['id'])});}return _0x37a567;});}})[_0xd3e4('0x27')](function(_0x405606){_0x56e2fd=_0x405606||[];if(_0x1318ca){return db[_0xd3e4('0x6d')][_0xd3e4('0x4b')]({'where':{'id':_0x8c99b3[_0xd3e4('0x51')][_0xd3e4('0x8b')]},'attributes':['id',_0xd3e4('0x31'),_0xd3e4('0x6f'),_0xd3e4('0x70'),'interface'],'raw':!![]});}})[_0xd3e4('0x27')](function(_0x232a3d){if(!_[_0xd3e4('0x8c')](_0x232a3d)){var _0x3d1ce9=[];for(var _0x43cec1=0x0;_0x43cec1<_0x232a3d[_0xd3e4('0x4f')];_0x43cec1++){if(_0x232a3d[_0x43cec1]['online']){_0x3d1ce9['push'](db['UserVoiceQueueRt'][_0xd3e4('0x79')]({'membername':_0x232a3d[_0x43cec1][_0xd3e4('0x31')],'UserId':_0x232a3d[_0x43cec1]['id'],'queue_name':_0x1318ca[_0xd3e4('0x31')],'VoiceQueueId':_0x1318ca['id'],'interface':_[_0xd3e4('0x94')](_0x232a3d[_0x43cec1][_0xd3e4('0x7b')])?util['format'](_0xd3e4('0x95'),_0x232a3d[_0x43cec1][_0xd3e4('0x31')]):_0x232a3d[_0x43cec1][_0xd3e4('0x7b')],'paused':_0x232a3d[_0x43cec1]['voicePause']||![],'penalty':_0x8c99b3[_0xd3e4('0x51')]['penalty']||0x0}));}}return BPromise[_0xd3e4('0x89')](_0x3d1ce9);}})['then'](function(){return _0x56e2fd;})[_0xd3e4('0x27')](respondWithResult(_0x27d9b0,null))['catch'](handleError(_0x27d9b0,null));};exports[_0xd3e4('0x8d')]=function(_0x421420,_0x319f7a,_0x539b2f){return db['VoiceQueue']['find']({'where':{'id':_0x421420[_0xd3e4('0x4e')]['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x319f7a,null))[_0xd3e4('0x27')](function(_0x18baf8){if(_0x18baf8){return _0x18baf8[_0xd3e4('0x8d')](_0x421420[_0xd3e4('0x3a')][_0xd3e4('0x8b')])[_0xd3e4('0x27')](function(){if(_['isArray'](_0x421420['query']['ids'])){for(var _0x35f194=0x0;_0x35f194<_0x421420['query'][_0xd3e4('0x8b')]['length'];_0x35f194+=0x1){socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x421420[_0xd3e4('0x3a')]['ids'][_0x35f194]),'VoiceQueueId':Number(_0x421420[_0xd3e4('0x4e')]['id'])});}}else{socket['emit'](_0xd3e4('0x90'),{'UserId':Number(_0x421420[_0xd3e4('0x3a')]['ids']),'VoiceQueueId':Number(_0x421420[_0xd3e4('0x4e')]['id'])});}});}})['then'](function(_0x245bb1){return db[_0xd3e4('0x8e')][_0xd3e4('0x28')]({'where':{'VoiceQueueId':_0x421420['params']['id'],'UserId':_0x421420['query'][_0xd3e4('0x8b')]}})['then'](function(){return _0x245bb1;});})['then'](respondWithStatusCode(_0x319f7a,null))[_0xd3e4('0x4d')](handleError(_0x319f7a,null));};exports[_0xd3e4('0x96')]=function(_0x2101a3,_0x21c133,_0x1600ae){var _0x3add51={};var _0x2320e9={};var _0x419ecd;var _0xf243d8;return db[_0xd3e4('0x48')][_0xd3e4('0x65')]({'where':{'id':_0x2101a3[_0xd3e4('0x4e')]['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x21c133,null))[_0xd3e4('0x27')](function(_0x4e2a1a){if(_0x4e2a1a){_0x419ecd=_0x4e2a1a;_0x2320e9[_0xd3e4('0x39')]=_[_0xd3e4('0x3b')](db['User']['rawAttributes']);_0x2320e9[_0xd3e4('0x3a')]=_[_0xd3e4('0x3b')](_0x2101a3[_0xd3e4('0x3a')]);_0x2320e9[_0xd3e4('0x3c')]=_[_0xd3e4('0x3d')](_0x2320e9['model'],_0x2320e9[_0xd3e4('0x3a')]);_0x3add51['attributes']=_['intersection'](_0x2320e9['model'],qs[_0xd3e4('0x3f')](_0x2101a3[_0xd3e4('0x3a')][_0xd3e4('0x3f')]));_0x3add51[_0xd3e4('0x3e')]=_0x3add51['attributes']['length']?_0x3add51[_0xd3e4('0x3e')]:_0x2320e9[_0xd3e4('0x39')];_0x3add51[_0xd3e4('0x42')]=qs[_0xd3e4('0x62')](_0x2101a3[_0xd3e4('0x3a')][_0xd3e4('0x62')]);_0x3add51[_0xd3e4('0x43')]=qs[_0xd3e4('0x3c')](_[_0xd3e4('0x44')](_0x2101a3['query'],_0x2320e9[_0xd3e4('0x3c')]));if(_0x2101a3[_0xd3e4('0x3a')][_0xd3e4('0x2b')]){_0x3add51[_0xd3e4('0x43')]=_['merge'](_0x3add51[_0xd3e4('0x43')],{'$or':_[_0xd3e4('0x36')](_0x3add51[_0xd3e4('0x3e')],function(_0x52271f){var _0x4340b7={};_0x4340b7[_0x52271f]={'$like':'%'+_0x2101a3['query']['filter']+'%'};return _0x4340b7;})});}_0x3add51=_[_0xd3e4('0x46')]({},_0x3add51,_0x2101a3[_0xd3e4('0x47')]);return _0x419ecd['getAgents'](_0x3add51);}})[_0xd3e4('0x27')](function(_0x54d5c5){if(_0x54d5c5){_0xf243d8=_0x54d5c5[_0xd3e4('0x4f')];if(!_0x2101a3['query'][_0xd3e4('0x40')](_0xd3e4('0x41'))){_0x3add51[_0xd3e4('0x1f')]=qs[_0xd3e4('0x1f')](_0x2101a3[_0xd3e4('0x3a')][_0xd3e4('0x1f')]);_0x3add51[_0xd3e4('0x1d')]=qs[_0xd3e4('0x1d')](_0x2101a3[_0xd3e4('0x3a')][_0xd3e4('0x1d')]);}return _0x419ecd['getAgents'](_0x3add51);}})[_0xd3e4('0x27')](function(_0x407237){if(_0x407237){return _0x407237?{'count':_0xf243d8,'rows':_0x407237}:null;}})['then'](respondWithResult(_0x21c133,null))[_0xd3e4('0x4d')](handleError(_0x21c133,null));};exports[_0xd3e4('0x97')]=function(_0x355300,_0x6e7f8a,_0x4c3b9d){var _0x6a7580={};var _0x1ca6db={};var _0x42138b;var _0x429eed;return db[_0xd3e4('0x48')][_0xd3e4('0x65')]({'where':{'id':_0x355300[_0xd3e4('0x4e')]['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x6e7f8a,null))[_0xd3e4('0x27')](function(_0x16e1bf){if(_0x16e1bf){_0x42138b=_0x16e1bf;_0x1ca6db['model']=_[_0xd3e4('0x3b')](db['UserVoiceQueueRt'][_0xd3e4('0x37')]);_0x1ca6db[_0xd3e4('0x3a')]=_[_0xd3e4('0x3b')](_0x355300[_0xd3e4('0x3a')]);_0x1ca6db[_0xd3e4('0x3c')]=_['intersection'](_0x1ca6db[_0xd3e4('0x39')],_0x1ca6db[_0xd3e4('0x3a')]);_0x6a7580['attributes']=_[_0xd3e4('0x3d')](_0x1ca6db['model'],qs['fields'](_0x355300[_0xd3e4('0x3a')]['fields']));_0x6a7580['attributes']=_0x6a7580['attributes'][_0xd3e4('0x4f')]?_0x6a7580[_0xd3e4('0x3e')]:_0x1ca6db[_0xd3e4('0x39')];_0x6a7580['order']=qs[_0xd3e4('0x62')](_0x355300[_0xd3e4('0x3a')]['sort']);_0x6a7580[_0xd3e4('0x43')]=qs['filters'](_[_0xd3e4('0x44')](_0x355300[_0xd3e4('0x3a')],_0x1ca6db[_0xd3e4('0x3c')]));if(_0x355300['query'][_0xd3e4('0x2b')]){_0x6a7580[_0xd3e4('0x43')]=_['merge'](_0x6a7580[_0xd3e4('0x43')],{'$or':_[_0xd3e4('0x36')](_0x6a7580['attributes'],function(_0x2b9209){var _0x2b3c67={};_0x2b3c67[_0x2b9209]={'$like':'%'+_0x355300[_0xd3e4('0x3a')][_0xd3e4('0x2b')]+'%'};return _0x2b3c67;})});}_0x6a7580=_[_0xd3e4('0x46')]({},_0x6a7580,_0x355300[_0xd3e4('0x47')]);return _0x42138b[_0xd3e4('0x97')](_0x6a7580);}})[_0xd3e4('0x27')](function(_0x1502ed){if(_0x1502ed){_0x429eed=_0x1502ed[_0xd3e4('0x4f')];if(!_0x355300[_0xd3e4('0x3a')][_0xd3e4('0x40')](_0xd3e4('0x41'))){_0x6a7580[_0xd3e4('0x1f')]=qs[_0xd3e4('0x1f')](_0x355300['query'][_0xd3e4('0x1f')]);_0x6a7580[_0xd3e4('0x1d')]=qs['offset'](_0x355300[_0xd3e4('0x3a')][_0xd3e4('0x1d')]);}return _0x42138b[_0xd3e4('0x97')](_0x6a7580);}})[_0xd3e4('0x27')](function(_0x21336c){return _0x21336c?{'count':_0x429eed,'rows':_0x21336c}:null;})['then'](respondWithResult(_0x6e7f8a,null))[_0xd3e4('0x4d')](handleError(_0x6e7f8a,null));};exports[_0xd3e4('0x98')]=function(_0x47a58a,_0x1fb5d1,_0x1afe86){var _0x304c5e={};var _0x555278={};var _0x2a97ee;var _0x121f16;return db[_0xd3e4('0x48')]['findOne']({'where':{'id':_0x47a58a[_0xd3e4('0x4e')]['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x1fb5d1,null))[_0xd3e4('0x27')](function(_0x21d7ea){if(_0x21d7ea){_0x2a97ee=_0x21d7ea;_0x555278[_0xd3e4('0x39')]=_[_0xd3e4('0x3b')](db[_0xd3e4('0x99')]['rawAttributes']);_0x555278[_0xd3e4('0x3a')]=_[_0xd3e4('0x3b')](_0x47a58a['query']);_0x555278['filters']=_[_0xd3e4('0x3d')](_0x555278['model'],_0x555278[_0xd3e4('0x3a')]);_0x304c5e[_0xd3e4('0x3e')]=_[_0xd3e4('0x3d')](_0x555278['model'],qs[_0xd3e4('0x3f')](_0x47a58a['query'][_0xd3e4('0x3f')]));_0x304c5e[_0xd3e4('0x3e')]=_0x304c5e['attributes'][_0xd3e4('0x4f')]?_0x304c5e[_0xd3e4('0x3e')]:_0x555278[_0xd3e4('0x39')];_0x304c5e[_0xd3e4('0x42')]=qs[_0xd3e4('0x62')](_0x47a58a['query'][_0xd3e4('0x62')]);_0x304c5e[_0xd3e4('0x43')]=qs[_0xd3e4('0x3c')](_[_0xd3e4('0x44')](_0x47a58a[_0xd3e4('0x3a')],_0x555278[_0xd3e4('0x3c')]));if(_0x47a58a[_0xd3e4('0x3a')][_0xd3e4('0x2b')]){_0x304c5e['where']=_[_0xd3e4('0x46')](_0x304c5e[_0xd3e4('0x43')],{'$or':_[_0xd3e4('0x36')](_0x304c5e[_0xd3e4('0x3e')],function(_0x14de5f){var _0x5c381e={};_0x5c381e[_0x14de5f]={'$like':'%'+_0x47a58a['query'][_0xd3e4('0x2b')]+'%'};return _0x5c381e;})});}_0x304c5e=_[_0xd3e4('0x46')]({},_0x304c5e,_0x47a58a[_0xd3e4('0x47')]);return _0x2a97ee[_0xd3e4('0x98')](_0x304c5e);}})[_0xd3e4('0x27')](function(_0x286ebf){if(_0x286ebf){_0x121f16=_0x286ebf[_0xd3e4('0x4f')];if(!_0x47a58a[_0xd3e4('0x3a')][_0xd3e4('0x40')](_0xd3e4('0x41'))){_0x304c5e[_0xd3e4('0x1f')]=qs[_0xd3e4('0x1f')](_0x47a58a['query']['limit']);_0x304c5e[_0xd3e4('0x1d')]=qs[_0xd3e4('0x1d')](_0x47a58a[_0xd3e4('0x3a')][_0xd3e4('0x1d')]);}return _0x2a97ee[_0xd3e4('0x98')](_0x304c5e);}})['then'](function(_0x1de8aa){if(_0x1de8aa){return _0x1de8aa?{'count':_0x121f16,'rows':_0x1de8aa}:null;}})['then'](respondWithResult(_0x1fb5d1,null))[_0xd3e4('0x4d')](handleError(_0x1fb5d1,null));};exports[_0xd3e4('0x9a')]=function(_0x456985,_0x23b7ff,_0x39893a){var _0x3f6fd2=moment()['format'](_0xd3e4('0x9b'));var _0x420fe6,_0x377b35;return db[_0xd3e4('0x48')][_0xd3e4('0x30')]({'where':{'id':_0x456985['params']['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x23b7ff,null))[_0xd3e4('0x27')](function(_0x13f41b){if(_0x13f41b){_0x377b35=_0x13f41b;return _0x13f41b[_0xd3e4('0x9a')](_0x456985[_0xd3e4('0x51')][_0xd3e4('0x8b')],_[_0xd3e4('0x5b')](_0x456985[_0xd3e4('0x51')],[_0xd3e4('0x8b'),'id'])||{});}return null;})[_0xd3e4('0x92')](function(_0x187d6a){var _0x30d732;_0x420fe6=_0x187d6a||[];var _0x5949c3=[];if(_0x187d6a){for(var _0x344e76=0x0;_0x344e76<_0x187d6a[_0xd3e4('0x4f')];_0x344e76+=0x1){var _0x3b5363=_0x187d6a[_0x344e76][_0xd3e4('0x29')]({'plain':!![]});_0x377b35[_0xd3e4('0x9c')]=_0x456985[_0xd3e4('0x51')]['dialCheckDuplicateType']?_0x456985[_0xd3e4('0x51')][_0xd3e4('0x9c')]:_0x377b35[_0xd3e4('0x9c')];switch(_0x377b35['dialCheckDuplicateType']){case _0xd3e4('0x9d'):_0x30d732=squel[_0xd3e4('0x9e')]()[_0xd3e4('0x9f')]('cm_hopper')[_0xd3e4('0xa0')]([_0xd3e4('0xa1'),_0xd3e4('0xa2'),_0xd3e4('0xa3'),_0xd3e4('0xa4'),_0xd3e4('0x63'),_0xd3e4('0x5c'),_0xd3e4('0x5d')],squel[_0xd3e4('0xa5')]()['field']('phone','phone')['field']('\x27'+_0x3f6fd2+'\x27',_0xd3e4('0xa2'))[_0xd3e4('0x7e')]('id',_0xd3e4('0xa3'))['field'](_0x3b5363['CmListId'][_0xd3e4('0x84')](),'ListId')[_0xd3e4('0x7e')](_0x456985['params']['id'][_0xd3e4('0x84')](),_0xd3e4('0x63'))['field']('\x27'+_0x3f6fd2+'\x27',_0xd3e4('0x5c'))[_0xd3e4('0x7e')]('\x27'+_0x3f6fd2+'\x27',_0xd3e4('0x5d'))[_0xd3e4('0xa6')]('cm_contacts')[_0xd3e4('0x43')](_0xd3e4('0xa7'))[_0xd3e4('0x43')](_0xd3e4('0xa8'),_0x3b5363[_0xd3e4('0xa9')][_0xd3e4('0x84')]())[_0xd3e4('0x43')](_0xd3e4('0xaa'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xd3e4('0xa5')]()[_0xd3e4('0x7e')](_0xd3e4('0xab'))[_0xd3e4('0xa6')](_0xd3e4('0xac'))[_0xd3e4('0x43')]('VoiceQueueId\x20=\x20?',_0x456985[_0xd3e4('0x4e')]['id']['toString']()))[_0xd3e4('0x43')](_0xd3e4('0xad'),squel[_0xd3e4('0xa5')]()['field'](_0xd3e4('0xae'))[_0xd3e4('0xa6')](_0xd3e4('0xaf'))[_0xd3e4('0x43')](_0xd3e4('0xb0'),_0x456985[_0xd3e4('0x4e')]['id'][_0xd3e4('0x84')]())))[_0xd3e4('0x84')]();break;case _0xd3e4('0xb1'):_0x30d732=squel[_0xd3e4('0x9e')]()['into'](_0xd3e4('0xaf'))[_0xd3e4('0xa0')]([_0xd3e4('0xa1'),_0xd3e4('0xa2'),'ContactId',_0xd3e4('0xa4'),_0xd3e4('0x63'),_0xd3e4('0x5c'),_0xd3e4('0x5d')],squel[_0xd3e4('0xa5')]()['field'](_0xd3e4('0xa1'),_0xd3e4('0xa1'))['field']('\x27'+_0x3f6fd2+'\x27',_0xd3e4('0xa2'))[_0xd3e4('0x7e')]('id',_0xd3e4('0xa3'))[_0xd3e4('0x7e')](_0x3b5363[_0xd3e4('0xa9')][_0xd3e4('0x84')](),_0xd3e4('0xa4'))[_0xd3e4('0x7e')](_0x456985[_0xd3e4('0x4e')]['id']['toString'](),_0xd3e4('0x63'))[_0xd3e4('0x7e')]('\x27'+_0x3f6fd2+'\x27',_0xd3e4('0x5c'))[_0xd3e4('0x7e')]('\x27'+_0x3f6fd2+'\x27','updatedAt')['from'](_0xd3e4('0xb2'))[_0xd3e4('0x43')](_0xd3e4('0xa7'))[_0xd3e4('0x43')](_0xd3e4('0xa8'),_0x3b5363[_0xd3e4('0xa9')][_0xd3e4('0x84')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xd3e4('0x43')](_0xd3e4('0xad'),squel[_0xd3e4('0xa5')]()[_0xd3e4('0x7e')](_0xd3e4('0xae'))[_0xd3e4('0xa6')](_0xd3e4('0xaf'))[_0xd3e4('0x43')](_0xd3e4('0xb0'),_0x456985[_0xd3e4('0x4e')]['id'][_0xd3e4('0x84')]())))['toString']();break;default:_0x30d732=squel[_0xd3e4('0x9e')]()[_0xd3e4('0x9f')](_0xd3e4('0xaf'))['fromQuery']([_0xd3e4('0xa1'),_0xd3e4('0xa2'),_0xd3e4('0xa3'),_0xd3e4('0xa4'),'VoiceQueueId','createdAt','updatedAt'],squel[_0xd3e4('0xa5')]()[_0xd3e4('0x7e')](_0xd3e4('0xa1'),_0xd3e4('0xa1'))['field']('\x27'+_0x3f6fd2+'\x27','scheduledAt')[_0xd3e4('0x7e')]('id',_0xd3e4('0xa3'))[_0xd3e4('0x7e')](_0x3b5363[_0xd3e4('0xa9')][_0xd3e4('0x84')](),'ListId')[_0xd3e4('0x7e')](_0x456985['params']['id'][_0xd3e4('0x84')](),'VoiceQueueId')[_0xd3e4('0x7e')]('\x27'+_0x3f6fd2+'\x27',_0xd3e4('0x5c'))[_0xd3e4('0x7e')]('\x27'+_0x3f6fd2+'\x27',_0xd3e4('0x5d'))[_0xd3e4('0xa6')](_0xd3e4('0xb2'))[_0xd3e4('0x43')]('deletedAt\x20IS\x20NULL')[_0xd3e4('0x43')](_0xd3e4('0xa8'),_0x3b5363[_0xd3e4('0xa9')][_0xd3e4('0x84')]())['where'](_0xd3e4('0xaa')))[_0xd3e4('0x84')]();}_0x5949c3[_0xd3e4('0xb3')](db[_0xd3e4('0x74')]['query'](_0x30d732));}return BPromise[_0xd3e4('0x89')](_0x5949c3);}})[_0xd3e4('0x27')](function(){var _0x8dad=[];var _0x2c4149=squel[_0xd3e4('0x9e')]()[_0xd3e4('0x9f')](_0xd3e4('0xb4'))[_0xd3e4('0xa0')]([_0xd3e4('0xb5'),'phone',_0xd3e4('0xb6'),_0xd3e4('0x5c'),_0xd3e4('0x5d')],squel[_0xd3e4('0xa5')]()[_0xd3e4('0x7e')](_0xd3e4('0xb7'))['field'](_0xd3e4('0xb8'))[_0xd3e4('0x7e')]('ci.OrderBy+1')[_0xd3e4('0x7e')]('\x27'+_0x3f6fd2+'\x27','createdAt')[_0xd3e4('0x7e')]('\x27'+_0x3f6fd2+'\x27',_0xd3e4('0x5d'))[_0xd3e4('0xa6')](_0xd3e4('0xb9'),'ci')[_0xd3e4('0x80')](_0xd3e4('0xaf'),'h',_0xd3e4('0xba'))[_0xd3e4('0x43')]('h.scheduledat=?',_0x3f6fd2)[_0xd3e4('0x43')](_0xd3e4('0xbb'),_0xd3e4('0xbc')))['toString']();_0x8dad['push'](db[_0xd3e4('0x74')]['query'](_0x2c4149));return BPromise[_0xd3e4('0x89')](_0x8dad);})['then'](function(){return _0x420fe6;})[_0xd3e4('0x27')](respondWithResult(_0x23b7ff,null))[_0xd3e4('0x4d')](handleError(_0x23b7ff,null));};exports[_0xd3e4('0xbd')]=function(_0x13722e,_0x39c033,_0x254ac1){return db[_0xd3e4('0x48')][_0xd3e4('0x30')]({'where':{'id':_0x13722e[_0xd3e4('0x4e')]['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x39c033,null))[_0xd3e4('0x27')](function(_0x5093b1){if(_0x5093b1){return _0x5093b1[_0xd3e4('0xbd')](_0x13722e[_0xd3e4('0x3a')][_0xd3e4('0x8b')]);}})[_0xd3e4('0x27')](function(_0x5696d5){if(_0x5696d5){return db['CmHopper'][_0xd3e4('0x28')]({'where':{'ListId':_0x13722e[_0xd3e4('0x3a')][_0xd3e4('0x8b')],'VoiceQueueId':_0x13722e[_0xd3e4('0x4e')]['id']}})[_0xd3e4('0x27')](function(){return _0x5696d5;});}})[_0xd3e4('0x27')](respondWithStatusCode(_0x39c033,null))[_0xd3e4('0x4d')](handleError(_0x39c033,null));};exports[_0xd3e4('0xbe')]=function(_0x697a5f,_0x1d1deb,_0x29aa1b){var _0x4d389a={};var _0x14b15a={};var _0x22fff9;var _0xe442df;return db[_0xd3e4('0x48')][_0xd3e4('0x65')]({'where':{'id':_0x697a5f['params']['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x1d1deb,null))['then'](function(_0x123282){if(_0x123282){_0x22fff9=_0x123282;_0x14b15a[_0xd3e4('0x39')]=_[_0xd3e4('0x3b')](db[_0xd3e4('0x99')][_0xd3e4('0x37')]);_0x14b15a[_0xd3e4('0x3a')]=_['keys'](_0x697a5f[_0xd3e4('0x3a')]);_0x14b15a['filters']=_[_0xd3e4('0x3d')](_0x14b15a[_0xd3e4('0x39')],_0x14b15a[_0xd3e4('0x3a')]);_0x4d389a[_0xd3e4('0x3e')]=_[_0xd3e4('0x3d')](_0x14b15a['model'],qs[_0xd3e4('0x3f')](_0x697a5f[_0xd3e4('0x3a')]['fields']));_0x4d389a[_0xd3e4('0x3e')]=_0x4d389a[_0xd3e4('0x3e')][_0xd3e4('0x4f')]?_0x4d389a[_0xd3e4('0x3e')]:_0x14b15a[_0xd3e4('0x39')];_0x4d389a[_0xd3e4('0x42')]=qs[_0xd3e4('0x62')](_0x697a5f[_0xd3e4('0x3a')][_0xd3e4('0x62')]);_0x4d389a[_0xd3e4('0x43')]=qs['filters'](_[_0xd3e4('0x44')](_0x697a5f['query'],_0x14b15a[_0xd3e4('0x3c')]));if(_0x697a5f[_0xd3e4('0x3a')][_0xd3e4('0x2b')]){_0x4d389a[_0xd3e4('0x43')]=_['merge'](_0x4d389a[_0xd3e4('0x43')],{'$or':_[_0xd3e4('0x36')](_0x4d389a[_0xd3e4('0x3e')],function(_0x16c441){var _0x267ce6={};_0x267ce6[_0x16c441]={'$like':'%'+_0x697a5f[_0xd3e4('0x3a')][_0xd3e4('0x2b')]+'%'};return _0x267ce6;})});}_0x4d389a=_['merge']({},_0x4d389a,_0x697a5f[_0xd3e4('0x47')]);return _0x22fff9[_0xd3e4('0xbe')](_0x4d389a);}})[_0xd3e4('0x27')](function(_0x478442){if(_0x478442){_0xe442df=_0x478442['length'];if(!_0x697a5f[_0xd3e4('0x3a')]['hasOwnProperty'](_0xd3e4('0x41'))){_0x4d389a[_0xd3e4('0x1f')]=qs[_0xd3e4('0x1f')](_0x697a5f[_0xd3e4('0x3a')]['limit']);_0x4d389a[_0xd3e4('0x1d')]=qs['offset'](_0x697a5f['query']['offset']);}return _0x22fff9[_0xd3e4('0xbe')](_0x4d389a);}})[_0xd3e4('0x27')](function(_0x41815f){if(_0x41815f){return _0x41815f?{'count':_0xe442df,'rows':_0x41815f}:null;}})[_0xd3e4('0x27')](respondWithResult(_0x1d1deb,null))[_0xd3e4('0x4d')](handleError(_0x1d1deb,null));};exports[_0xd3e4('0xbf')]=function(_0x12881b,_0x51e846,_0x149f58){var _0x3c6a51,_0x36f804;return db[_0xd3e4('0x48')]['find']({'where':{'id':_0x12881b[_0xd3e4('0x4e')]['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x51e846,null))[_0xd3e4('0x27')](function(_0x15c8b0){if(_0x15c8b0){_0x36f804=_0x15c8b0;return _0x15c8b0['addBlackLists'](_0x12881b['body']['ids'],_[_0xd3e4('0x5b')](_0x12881b[_0xd3e4('0x51')],[_0xd3e4('0x8b'),'id'])||{});}return null;})['spread'](function(_0x2e5674){var _0xd78acf;_0x3c6a51=_0x2e5674||[];var _0x2a51df=[];if(_0x2e5674){for(var _0x235c93=0x0;_0x235c93<_0x2e5674[_0xd3e4('0x4f')];_0x235c93+=0x1){var _0x1e8ae4=_0x2e5674[_0x235c93][_0xd3e4('0x29')]({'plain':!![]});_0xd78acf=squel['insert']()['into']('cm_hopper_black')[_0xd3e4('0xa0')]([_0xd3e4('0xa1'),_0xd3e4('0xa3'),'ListId','VoiceQueueId',_0xd3e4('0x5c'),_0xd3e4('0x5d')],squel[_0xd3e4('0xa5')]()[_0xd3e4('0x7e')]('phone',_0xd3e4('0xa1'))[_0xd3e4('0x7e')]('id',_0xd3e4('0xa3'))[_0xd3e4('0x7e')](_0x1e8ae4[_0xd3e4('0xa9')][_0xd3e4('0x84')](),_0xd3e4('0xa4'))[_0xd3e4('0x7e')](_0x12881b['params']['id'][_0xd3e4('0x84')](),'VoiceQueueId')[_0xd3e4('0x7e')](_0xd3e4('0xc0'),_0xd3e4('0x5c'))[_0xd3e4('0x7e')](_0xd3e4('0xc0'),_0xd3e4('0x5d'))[_0xd3e4('0xa6')]('cm_contacts')[_0xd3e4('0x43')](_0xd3e4('0xa7'))[_0xd3e4('0x43')](_0xd3e4('0xa8'),_0x1e8ae4[_0xd3e4('0xa9')][_0xd3e4('0x84')]())[_0xd3e4('0x43')](_0xd3e4('0xaa')))[_0xd3e4('0x84')]();_0x2a51df[_0xd3e4('0xb3')](db[_0xd3e4('0x74')][_0xd3e4('0x3a')](_0xd78acf));}return BPromise['all'](_0x2a51df);}})[_0xd3e4('0x27')](function(){return _0x3c6a51;})[_0xd3e4('0x27')](respondWithResult(_0x51e846,null))[_0xd3e4('0x4d')](handleError(_0x51e846,null));};exports[_0xd3e4('0xc1')]=function(_0x50d678,_0x407f9b,_0xc773de){return db[_0xd3e4('0x48')][_0xd3e4('0x30')]({'where':{'id':_0x50d678[_0xd3e4('0x4e')]['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x407f9b,null))[_0xd3e4('0x27')](function(_0x284f4d){if(_0x284f4d){return _0x284f4d[_0xd3e4('0xc1')](_0x50d678[_0xd3e4('0x3a')][_0xd3e4('0x8b')]);}})[_0xd3e4('0x27')](function(_0x15fa6b){if(_0x15fa6b){return db[_0xd3e4('0x69')][_0xd3e4('0x28')]({'where':{'ListId':_0x50d678['query'][_0xd3e4('0x8b')],'VoiceQueueId':_0x50d678[_0xd3e4('0x4e')]['id']}})['then'](function(){return _0x15fa6b;});}})[_0xd3e4('0x27')](respondWithStatusCode(_0x407f9b,null))[_0xd3e4('0x4d')](handleError(_0x407f9b,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 333288b..ea6b005 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 _0x4f63=['VoiceQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3507d9,_0x52c298){var _0x184d00=function(_0x208e64){while(--_0x208e64){_0x3507d9['push'](_0x3507d9['shift']());}};_0x184d00(++_0x52c298);}(_0x4f63,0x1f2));var _0x34f6=function(_0x106466,_0xe55a0){_0x106466=_0x106466-0x0;var _0x4ae2aa=_0x4f63[_0x106466];return _0x4ae2aa;};'use strict';var EventEmitter=require(_0x34f6('0x0'));var VoiceQueue=require(_0x34f6('0x1'))['db'][_0x34f6('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x34f6('0x3')](0x0);var events={'afterCreate':_0x34f6('0x4'),'afterUpdate':'update','afterDestroy':_0x34f6('0x5')};function emitEvent(_0x343049){return function(_0x580443,_0x37a5b8,_0x2c67ef){VoiceQueueEvents['emit'](_0x343049+':'+_0x580443['id'],_0x580443);VoiceQueueEvents[_0x34f6('0x6')](_0x343049,_0x580443);_0x2c67ef(null);};}for(var e in events){if(events[_0x34f6('0x7')](e)){var event=events[e];VoiceQueue[_0x34f6('0x8')](e,emitEvent(event));}}module[_0x34f6('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x0715=['emit','hasOwnProperty','exports','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove'];(function(_0x33a1d2,_0x429c58){var _0x5a7178=function(_0x6214ad){while(--_0x6214ad){_0x33a1d2['push'](_0x33a1d2['shift']());}};_0x5a7178(++_0x429c58);}(_0x0715,0xdb));var _0x5071=function(_0x44a6fc,_0x328afe){_0x44a6fc=_0x44a6fc-0x0;var _0x15eae8=_0x0715[_0x44a6fc];return _0x15eae8;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x5071('0x0'))['db'][_0x5071('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x5071('0x2')](0x0);var events={'afterCreate':_0x5071('0x3'),'afterUpdate':_0x5071('0x4'),'afterDestroy':_0x5071('0x5')};function emitEvent(_0x1f0f74){return function(_0x304547,_0x438e05,_0x3948ed){VoiceQueueEvents[_0x5071('0x6')](_0x1f0f74+':'+_0x304547['id'],_0x304547);VoiceQueueEvents[_0x5071('0x6')](_0x1f0f74,_0x304547);_0x3948ed(null);};}for(var e in events){if(events[_0x5071('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x5071('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 8d6ca7b..665876e 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x26881c,_0x43d182){var _0x3e819c=function(_0x3ebb22){while(--_0x3ebb22){_0x26881c['push'](_0x26881c['shift']());}};_0x3e819c(++_0x43d182);}(_0x34e8,0x12c));var _0x834e=function(_0x30e4c7,_0x53c6be){_0x30e4c7=_0x30e4c7-0x0;var _0x8a4b89=_0x34e8[_0x30e4c7];return _0x8a4b89;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x12c4cd,_0xdebe29){var _0x18a029=function(_0x4c4272){while(--_0x4c4272){_0x12c4cd['push'](_0x12c4cd['shift']());}};_0x18a029(++_0xdebe29);}(_0x3e74,0x175));var _0x43e7=function(_0x4ba0f7,_0xc9dffb){_0x4ba0f7=_0x4ba0f7-0x0;var _0x129148=_0x3e74[_0x4ba0f7];return _0x129148;};'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 diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 9308e7f..9e71f92 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 _0xb4b6=['debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetVoiceQueue','findAll','options','attributes','limit','include','model','map','ShowVoiceQueue','VoiceQueue','find','raw','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','VoiceQueue,\x20%s,\x20%s'];(function(_0x585ba8,_0x57380d){var _0x65226d=function(_0x5d5c4f){while(--_0x5d5c4f){_0x585ba8['push'](_0x585ba8['shift']());}};_0x65226d(++_0x57380d);}(_0xb4b6,0x13c));var _0x6b4b=function(_0x52f05b,_0x32fdcf){_0x52f05b=_0x52f05b-0x0;var _0x44a279=_0xb4b6[_0x52f05b];return _0x44a279;};'use strict';var _=require(_0x6b4b('0x0'));var util=require(_0x6b4b('0x1'));var moment=require(_0x6b4b('0x2'));var BPromise=require(_0x6b4b('0x3'));var rs=require(_0x6b4b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6b4b('0x5'))(_0x6b4b('0x6'));var config=require(_0x6b4b('0x7'));var jayson=require(_0x6b4b('0x8'));var client=jayson[_0x6b4b('0x9')][_0x6b4b('0xa')]({'port':0x232a});config[_0x6b4b('0xb')]=_['defaults'](config[_0x6b4b('0xb')],{'host':_0x6b4b('0xc'),'port':0x18eb});var socket=require(_0x6b4b('0xd'))(new Redis(config[_0x6b4b('0xb')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x37d13e,_0x1d8000,_0x142eae){return new BPromise(function(_0xd6830a,_0x49f954){return client[_0x6b4b('0xe')](_0x37d13e,_0x142eae)[_0x6b4b('0xf')](function(_0x589cb8){logger['info'](_0x6b4b('0x10'),_0x1d8000,'request\x20sent');logger[_0x6b4b('0x11')](_0x6b4b('0x12'),_0x1d8000,'request\x20sent',JSON[_0x6b4b('0x13')](_0x589cb8));if(_0x589cb8[_0x6b4b('0x14')]){if(_0x589cb8[_0x6b4b('0x14')][_0x6b4b('0x15')]===0x1f4){logger[_0x6b4b('0x14')](_0x6b4b('0x10'),_0x1d8000,_0x589cb8[_0x6b4b('0x14')][_0x6b4b('0x16')]);return _0x49f954(_0x589cb8[_0x6b4b('0x14')][_0x6b4b('0x16')]);}logger[_0x6b4b('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x1d8000,_0x589cb8[_0x6b4b('0x14')][_0x6b4b('0x16')]);return _0xd6830a(_0x589cb8[_0x6b4b('0x14')]['message']);}else{logger[_0x6b4b('0x17')](_0x6b4b('0x10'),_0x1d8000,'request\x20sent');_0xd6830a(_0x589cb8['result'][_0x6b4b('0x16')]);}})[_0x6b4b('0x18')](function(_0x4de534){logger[_0x6b4b('0x14')](_0x6b4b('0x10'),_0x1d8000,_0x4de534);_0x49f954(_0x4de534);});});}exports[_0x6b4b('0x19')]=function(_0x24d4c2){var _0x5a0d41=this;return new Promise(function(_0x5a9212,_0x118870){return db['VoiceQueue'][_0x6b4b('0x1a')]({'raw':_0x24d4c2[_0x6b4b('0x1b')]?_0x24d4c2[_0x6b4b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x24d4c2[_0x6b4b('0x1b')]?_0x24d4c2[_0x6b4b('0x1b')]['where']||null:null,'attributes':_0x24d4c2[_0x6b4b('0x1b')]?_0x24d4c2[_0x6b4b('0x1b')][_0x6b4b('0x1c')]||null:null,'limit':_0x24d4c2['options']?_0x24d4c2['options'][_0x6b4b('0x1d')]||null:null,'include':_0x24d4c2[_0x6b4b('0x1b')]?_0x24d4c2[_0x6b4b('0x1b')][_0x6b4b('0x1e')]?_['map'](_0x24d4c2[_0x6b4b('0x1b')][_0x6b4b('0x1e')],function(_0x45109c){return{'model':db[_0x45109c[_0x6b4b('0x1f')]],'as':_0x45109c['as'],'attributes':_0x45109c['attributes'],'include':_0x45109c[_0x6b4b('0x1e')]?_['map'](_0x45109c[_0x6b4b('0x1e')],function(_0x4cb25b){return{'model':db[_0x4cb25b[_0x6b4b('0x1f')]],'as':_0x4cb25b['as'],'attributes':_0x4cb25b['attributes'],'include':_0x4cb25b[_0x6b4b('0x1e')]?_[_0x6b4b('0x20')](_0x4cb25b[_0x6b4b('0x1e')],function(_0x3d61de){return{'model':db[_0x3d61de[_0x6b4b('0x1f')]],'as':_0x3d61de['as'],'attributes':_0x3d61de[_0x6b4b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6b4b('0xf')](function(_0x4791ef){logger[_0x6b4b('0x17')]('GetVoiceQueue',_0x24d4c2);logger[_0x6b4b('0x11')](_0x6b4b('0x19'),_0x24d4c2,JSON['stringify'](_0x4791ef));_0x5a9212(_0x4791ef);})[_0x6b4b('0x18')](function(_0x1ad602){logger['error'](_0x6b4b('0x19'),_0x1ad602['message'],_0x24d4c2);_0x118870(_0x5a0d41[_0x6b4b('0x14')](0x1f4,_0x1ad602[_0x6b4b('0x16')]));});});};exports[_0x6b4b('0x21')]=function(_0x327495){var _0x1d2433=this;return new Promise(function(_0x1ca48d,_0x652a94){return db[_0x6b4b('0x22')][_0x6b4b('0x23')]({'raw':_0x327495[_0x6b4b('0x1b')]?_0x327495[_0x6b4b('0x1b')][_0x6b4b('0x24')]===undefined?!![]:![]:!![],'where':_0x327495['options']?_0x327495['options']['where']||null:null,'attributes':_0x327495[_0x6b4b('0x1b')]?_0x327495['options'][_0x6b4b('0x1c')]||null:null,'include':_0x327495[_0x6b4b('0x1b')]?_0x327495['options'][_0x6b4b('0x1e')]?_[_0x6b4b('0x20')](_0x327495[_0x6b4b('0x1b')][_0x6b4b('0x1e')],function(_0x2d6b81){return{'model':db[_0x2d6b81[_0x6b4b('0x1f')]],'as':_0x2d6b81['as'],'attributes':_0x2d6b81[_0x6b4b('0x1c')],'include':_0x2d6b81['include']?_[_0x6b4b('0x20')](_0x2d6b81['include'],function(_0x1ad33a){return{'model':db[_0x1ad33a[_0x6b4b('0x1f')]],'as':_0x1ad33a['as'],'attributes':_0x1ad33a[_0x6b4b('0x1c')],'include':_0x1ad33a[_0x6b4b('0x1e')]?_[_0x6b4b('0x20')](_0x1ad33a[_0x6b4b('0x1e')],function(_0x21a3a6){return{'model':db[_0x21a3a6[_0x6b4b('0x1f')]],'as':_0x21a3a6['as'],'attributes':_0x21a3a6[_0x6b4b('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d5d7a){logger[_0x6b4b('0x17')](_0x6b4b('0x21'),_0x327495);logger['debug'](_0x6b4b('0x21'),_0x327495,JSON[_0x6b4b('0x13')](_0x1d5d7a));_0x1ca48d(_0x1d5d7a);})['catch'](function(_0x1073f9){logger['error'](_0x6b4b('0x21'),_0x1073f9[_0x6b4b('0x16')],_0x327495);_0x652a94(_0x1d2433[_0x6b4b('0x14')](0x1f4,_0x1073f9[_0x6b4b('0x16')]));});});}; \ No newline at end of file +var _0x64a3=['message','info','result','catch','GetVoiceQueue','VoiceQueue','options','where','attributes','include','map','model','ShowVoiceQueue','find','lodash','util','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','then','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2d3825,_0x1b465b){var _0x4be92c=function(_0x2a6a72){while(--_0x2a6a72){_0x2d3825['push'](_0x2d3825['shift']());}};_0x4be92c(++_0x1b465b);}(_0x64a3,0xda));var _0x364a=function(_0x22bb68,_0x5591d5){_0x22bb68=_0x22bb68-0x0;var _0x245e51=_0x64a3[_0x22bb68];return _0x245e51;};'use strict';var _=require(_0x364a('0x0'));var util=require(_0x364a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x364a('0x2'));var fs=require('fs');var Redis=require(_0x364a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x364a('0x4'))(_0x364a('0x5'));var config=require('../../config/environment');var jayson=require(_0x364a('0x6'));var client=jayson[_0x364a('0x7')]['http']({'port':0x232a});config[_0x364a('0x8')]=_[_0x364a('0x9')](config['redis'],{'host':_0x364a('0xa'),'port':0x18eb});var socket=require(_0x364a('0xb'))(new Redis(config[_0x364a('0x8')]));require(_0x364a('0xc'))['register'](socket);function respondWithRpcPromise(_0x26a0fd,_0x109147,_0x4081da){return new BPromise(function(_0x4bba80,_0x6f07e1){return client['request'](_0x26a0fd,_0x4081da)[_0x364a('0xd')](function(_0x3cc04d){logger['info'](_0x364a('0xe'),_0x109147,'request\x20sent');logger[_0x364a('0xf')](_0x364a('0x10'),_0x109147,_0x364a('0x11'),JSON[_0x364a('0x12')](_0x3cc04d));if(_0x3cc04d[_0x364a('0x13')]){if(_0x3cc04d[_0x364a('0x13')]['code']===0x1f4){logger[_0x364a('0x13')](_0x364a('0xe'),_0x109147,_0x3cc04d[_0x364a('0x13')][_0x364a('0x14')]);return _0x6f07e1(_0x3cc04d[_0x364a('0x13')][_0x364a('0x14')]);}logger[_0x364a('0x13')](_0x364a('0xe'),_0x109147,_0x3cc04d['error']['message']);return _0x4bba80(_0x3cc04d[_0x364a('0x13')][_0x364a('0x14')]);}else{logger[_0x364a('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x109147,'request\x20sent');_0x4bba80(_0x3cc04d[_0x364a('0x16')][_0x364a('0x14')]);}})[_0x364a('0x17')](function(_0x365918){logger[_0x364a('0x13')](_0x364a('0xe'),_0x109147,_0x365918);_0x6f07e1(_0x365918);});});}exports[_0x364a('0x18')]=function(_0x5dece1){var _0x4e7477=this;return new Promise(function(_0x1343c0,_0x2ce8bc){return db[_0x364a('0x19')]['findAll']({'raw':_0x5dece1[_0x364a('0x1a')]?_0x5dece1['options']['raw']===undefined?!![]:![]:!![],'where':_0x5dece1[_0x364a('0x1a')]?_0x5dece1[_0x364a('0x1a')][_0x364a('0x1b')]||null:null,'attributes':_0x5dece1[_0x364a('0x1a')]?_0x5dece1['options'][_0x364a('0x1c')]||null:null,'limit':_0x5dece1[_0x364a('0x1a')]?_0x5dece1[_0x364a('0x1a')]['limit']||null:null,'include':_0x5dece1['options']?_0x5dece1['options'][_0x364a('0x1d')]?_[_0x364a('0x1e')](_0x5dece1[_0x364a('0x1a')][_0x364a('0x1d')],function(_0x205730){return{'model':db[_0x205730['model']],'as':_0x205730['as'],'attributes':_0x205730[_0x364a('0x1c')],'include':_0x205730[_0x364a('0x1d')]?_[_0x364a('0x1e')](_0x205730[_0x364a('0x1d')],function(_0x383b09){return{'model':db[_0x383b09[_0x364a('0x1f')]],'as':_0x383b09['as'],'attributes':_0x383b09['attributes'],'include':_0x383b09[_0x364a('0x1d')]?_['map'](_0x383b09[_0x364a('0x1d')],function(_0x30d280){return{'model':db[_0x30d280[_0x364a('0x1f')]],'as':_0x30d280['as'],'attributes':_0x30d280[_0x364a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x364a('0xd')](function(_0x755fc3){logger[_0x364a('0x15')](_0x364a('0x18'),_0x5dece1);logger[_0x364a('0xf')](_0x364a('0x18'),_0x5dece1,JSON[_0x364a('0x12')](_0x755fc3));_0x1343c0(_0x755fc3);})[_0x364a('0x17')](function(_0x271cc2){logger['error'](_0x364a('0x18'),_0x271cc2[_0x364a('0x14')],_0x5dece1);_0x2ce8bc(_0x4e7477['error'](0x1f4,_0x271cc2['message']));});});};exports[_0x364a('0x20')]=function(_0xaace10){var _0x4256b2=this;return new Promise(function(_0x5cf3e3,_0x5527f7){return db[_0x364a('0x19')][_0x364a('0x21')]({'raw':_0xaace10[_0x364a('0x1a')]?_0xaace10[_0x364a('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xaace10['options']?_0xaace10[_0x364a('0x1a')][_0x364a('0x1b')]||null:null,'attributes':_0xaace10[_0x364a('0x1a')]?_0xaace10[_0x364a('0x1a')][_0x364a('0x1c')]||null:null,'include':_0xaace10['options']?_0xaace10[_0x364a('0x1a')][_0x364a('0x1d')]?_[_0x364a('0x1e')](_0xaace10[_0x364a('0x1a')][_0x364a('0x1d')],function(_0x9019ae){return{'model':db[_0x9019ae[_0x364a('0x1f')]],'as':_0x9019ae['as'],'attributes':_0x9019ae[_0x364a('0x1c')],'include':_0x9019ae[_0x364a('0x1d')]?_['map'](_0x9019ae[_0x364a('0x1d')],function(_0x3ec9f3){return{'model':db[_0x3ec9f3['model']],'as':_0x3ec9f3['as'],'attributes':_0x3ec9f3['attributes'],'include':_0x3ec9f3['include']?_[_0x364a('0x1e')](_0x3ec9f3[_0x364a('0x1d')],function(_0x2143f7){return{'model':db[_0x2143f7[_0x364a('0x1f')]],'as':_0x2143f7['as'],'attributes':_0x2143f7['attributes']};}):[]};}):[]};}):[]:[]})[_0x364a('0xd')](function(_0x4131cf){logger['info'](_0x364a('0x20'),_0xaace10);logger['debug'](_0x364a('0x20'),_0xaace10,JSON['stringify'](_0x4131cf));_0x5cf3e3(_0x4131cf);})['catch'](function(_0x2240be){logger[_0x364a('0x13')](_0x364a('0x20'),_0x2240be[_0x364a('0x14')],_0xaace10);_0x5527f7(_0x4256b2[_0x364a('0x13')](0x1f4,_0x2240be['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 34fcee7..bb3b574 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 _0x3323=['voiceQueue:','./voiceQueue.events','save','emit','removeListener','register','length'];(function(_0x23c1c5,_0x341774){var _0x331e9c=function(_0x370e5e){while(--_0x370e5e){_0x23c1c5['push'](_0x23c1c5['shift']());}};_0x331e9c(++_0x341774);}(_0x3323,0x9b));var _0x3332=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x3323[_0x273c39];return _0x46d6b5;};'use strict';var VoiceQueueEvents=require(_0x3332('0x0'));var events=[_0x3332('0x1'),'remove','update'];function createListener(_0x542635,_0x3c365b){return function(_0x46d0a2){_0x3c365b[_0x3332('0x2')](_0x542635,_0x46d0a2);};}function removeListener(_0x3372f7,_0x42a5c5){return function(){VoiceQueueEvents[_0x3332('0x3')](_0x3372f7,_0x42a5c5);};}exports[_0x3332('0x4')]=function(_0x289757){for(var _0x54763c=0x0,_0x3c0fe5=events[_0x3332('0x5')];_0x54763c<_0x3c0fe5;_0x54763c++){var _0x4ee28e=events[_0x54763c];var _0xfb40e7=createListener(_0x3332('0x6')+_0x4ee28e,_0x289757);VoiceQueueEvents['on'](_0x4ee28e,_0xfb40e7);}}; \ No newline at end of file +var _0xc4db=['length','voiceQueue:','./voiceQueue.events','remove','update','emit','removeListener','register'];(function(_0x58e6e7,_0x45812f){var _0x6ca7f=function(_0x28bf9e){while(--_0x28bf9e){_0x58e6e7['push'](_0x58e6e7['shift']());}};_0x6ca7f(++_0x45812f);}(_0xc4db,0x72));var _0xbc4d=function(_0x5508d9,_0x2a6dcc){_0x5508d9=_0x5508d9-0x0;var _0x2dada6=_0xc4db[_0x5508d9];return _0x2dada6;};'use strict';var VoiceQueueEvents=require(_0xbc4d('0x0'));var events=['save',_0xbc4d('0x1'),_0xbc4d('0x2')];function createListener(_0x2e669e,_0x14648a){return function(_0x28a894){_0x14648a[_0xbc4d('0x3')](_0x2e669e,_0x28a894);};}function removeListener(_0x2d6b9c,_0x27e926){return function(){VoiceQueueEvents[_0xbc4d('0x4')](_0x2d6b9c,_0x27e926);};}exports[_0xbc4d('0x5')]=function(_0x88e979){for(var _0x3d3372=0x0,_0x40990f=events[_0xbc4d('0x6')];_0x3d3372<_0x40990f;_0x3d3372++){var _0x3eb765=events[_0x3d3372];var _0x4c1105=createListener(_0xbc4d('0x7')+_0x3eb765,_0x88e979);VoiceQueueEvents['on'](_0x3eb765,_0x4c1105);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 57e42a6..0fd92f8 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 _0x5a70=['create','put','delete','multer','path','express','Router','fs-extra','../../components/auth/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','/:id','show'];(function(_0x16fe9c,_0x4e0b7c){var _0x2fa4db=function(_0x21a4e7){while(--_0x21a4e7){_0x16fe9c['push'](_0x16fe9c['shift']());}};_0x2fa4db(++_0x4e0b7c);}(_0x5a70,0x111));var _0x05a7=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x5a70[_0x1e7b16];return _0x37fadc;};'use strict';var multer=require(_0x05a7('0x0'));var util=require('util');var path=require(_0x05a7('0x1'));var timeout=require('connect-timeout');var express=require(_0x05a7('0x2'));var router=express[_0x05a7('0x3')]();var fs_extra=require(_0x05a7('0x4'));var auth=require(_0x05a7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x05a7('0x6'));router[_0x05a7('0x7')]('/',auth[_0x05a7('0x8')](),controller[_0x05a7('0x9')]);router['get'](_0x05a7('0xa'),auth[_0x05a7('0x8')](),controller[_0x05a7('0xb')]);router[_0x05a7('0x7')](_0x05a7('0xc'),auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0x05a7('0x7')](_0x05a7('0xd'),auth[_0x05a7('0x8')](),controller[_0x05a7('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x05a7('0xf')]);router[_0x05a7('0x10')](_0x05a7('0xd'),auth[_0x05a7('0x8')](),controller['update']);router[_0x05a7('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe157=['../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','/index','getVoiceQueuesReport','show','post','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router'];(function(_0x404174,_0x5624ea){var _0x1783ce=function(_0x245377){while(--_0x245377){_0x404174['push'](_0x404174['shift']());}};_0x1783ce(++_0x5624ea);}(_0xe157,0x127));var _0x7e15=function(_0x1e76f4,_0x522772){_0x1e76f4=_0x1e76f4-0x0;var _0x4170e8=_0xe157[_0x1e76f4];return _0x4170e8;};'use strict';var multer=require('multer');var util=require(_0x7e15('0x0'));var path=require(_0x7e15('0x1'));var timeout=require(_0x7e15('0x2'));var express=require(_0x7e15('0x3'));var router=express[_0x7e15('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7e15('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7e15('0x6'));var controller=require(_0x7e15('0x7'));router[_0x7e15('0x8')]('/',auth[_0x7e15('0x9')](),controller['index']);router[_0x7e15('0x8')](_0x7e15('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x7e15('0x8')](_0x7e15('0xb'),auth['isAuthenticated'](),controller[_0x7e15('0xc')]);router[_0x7e15('0x8')]('/:id',auth[_0x7e15('0x9')](),controller[_0x7e15('0xd')]);router[_0x7e15('0xe')]('/',auth[_0x7e15('0x9')](),controller['create']);router[_0x7e15('0xf')](_0x7e15('0x10'),auth[_0x7e15('0x9')](),controller[_0x7e15('0x11')]);router[_0x7e15('0x12')]('/:id',auth[_0x7e15('0x9')](),controller['destroy']);module[_0x7e15('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 04ae1f8..8616fa3 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 _0x6180=['seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','diff'];(function(_0x19f40a,_0x230899){var _0x5ce522=function(_0x3e262a){while(--_0x3e262a){_0x19f40a['push'](_0x19f40a['shift']());}};_0x5ce522(++_0x230899);}(_0x6180,0xca));var _0x0618=function(_0x3bf925,_0x4dd8e4){_0x3bf925=_0x3bf925-0x0;var _0x2128a1=_0x6180[_0x3bf925];return _0x2128a1;};'use strict';var Sequelize=require(_0x0618('0x0'));var moment=require(_0x0618('0x1'));module[_0x0618('0x2')]={'type':{'type':Sequelize[_0x0618('0x3')]},'uniqueid':{'type':Sequelize[_0x0618('0x3')]},'calleridnum':{'type':Sequelize[_0x0618('0x3')]},'calleridname':{'type':Sequelize[_0x0618('0x3')]},'queue':{'type':Sequelize[_0x0618('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x0618('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x467bde){var _0x53688b=moment(_0x467bde);var _0x5596a0=moment(this['getDataValue']('queuecallerjoinAt'))[_0x0618('0x5')](_0x0618('0x6'));var _0x2a78f6=_0x53688b[_0x0618('0x7')](_0x5596a0,_0x0618('0x8'));this[_0x0618('0x9')](_0x0618('0xa'),_0x467bde);this[_0x0618('0x9')]('holdtime',_0x2a78f6||null);}},'position':{'type':Sequelize[_0x0618('0xb')]},'count':{'type':Sequelize[_0x0618('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x0618('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x0618('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x0618('0x4')]},'queuecallerexit':{'type':Sequelize[_0x0618('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x0618('0xd')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0618('0x3')]},'connectedlinename':{'type':Sequelize[_0x0618('0x3')]},'accountcode':{'type':Sequelize[_0x0618('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x0618('0x3')]},'priority':{'type':Sequelize[_0x0618('0x3')]},'holdtime':{'type':Sequelize[_0x0618('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0618('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0618('0x3')]},'transfer':{'type':Sequelize[_0x0618('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0618('0x3')],'comment':_0x0618('0xe')},'transferexten':{'type':Sequelize[_0x0618('0x3')]},'transferuniqueid':{'type':Sequelize[_0x0618('0x3')]},'disposition':{'type':Sequelize[_0x0618('0x3')]},'secondDisposition':{'type':Sequelize[_0x0618('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0618('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x0618('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0x0618('0x3')]}}; \ No newline at end of file +var _0x3921=['getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','setDataValue','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER','sequelize','moment','exports','STRING','DATE'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3921,0x8a));var _0x1392=function(_0xdc105a,_0xfa41ba){_0xdc105a=_0xdc105a-0x0;var _0x1bca1e=_0x3921[_0xdc105a];return _0x1bca1e;};'use strict';var Sequelize=require(_0x1392('0x0'));var moment=require(_0x1392('0x1'));module[_0x1392('0x2')]={'type':{'type':Sequelize[_0x1392('0x3')]},'uniqueid':{'type':Sequelize[_0x1392('0x3')]},'calleridnum':{'type':Sequelize[_0x1392('0x3')]},'calleridname':{'type':Sequelize[_0x1392('0x3')]},'queue':{'type':Sequelize[_0x1392('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x1392('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x1392('0x4')],'set':function(_0x12fb00){var _0x3ee815=moment(_0x12fb00);var _0x15d2db=moment(this[_0x1392('0x5')](_0x1392('0x6')))[_0x1392('0x7')](_0x1392('0x8'));var _0x33cd05=_0x3ee815['diff'](_0x15d2db,'seconds');this[_0x1392('0x9')]('queuecallerleaveAt',_0x12fb00);this[_0x1392('0x9')]('holdtime',_0x33cd05||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x1392('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x1392('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x1392('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1392('0x4')]},'queuecallerexit':{'type':Sequelize[_0x1392('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x1392('0x3')],'comment':_0x1392('0xb')},'originalposition':{'type':Sequelize[_0x1392('0xc')]},'channel':{'type':Sequelize[_0x1392('0x3')]},'connectedlinenum':{'type':Sequelize[_0x1392('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1392('0x3')]},'exten':{'type':Sequelize[_0x1392('0x3')]},'priority':{'type':Sequelize[_0x1392('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1392('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1392('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x1392('0x3')]},'transferuniqueid':{'type':Sequelize[_0x1392('0x3')]},'disposition':{'type':Sequelize[_0x1392('0x3')]},'secondDisposition':{'type':Sequelize[_0x1392('0x3')]},'thirdDisposition':{'type':Sequelize[_0x1392('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x1392('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0x1392('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 75c9673..0e7e726 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 _0xaa3a=['update','then','destroy','error','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','options','includeAll','catch','length','create','body','find','params','describe','getVoiceQueuesReport','hasOwnProperty','include','findAll','rows','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','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','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save'];(function(_0x4c451,_0xbaa476){var _0x330881=function(_0x5e209e){while(--_0x5e209e){_0x4c451['push'](_0x4c451['shift']());}};_0x330881(++_0xbaa476);}(_0xaa3a,0x1bd));var _0xaaa3=function(_0x4bf814,_0x431c38){_0x4bf814=_0x4bf814-0x0;var _0xd4452c=_0xaa3a[_0x4bf814];return _0xd4452c;};'use strict';var emlformat=require(_0xaaa3('0x0'));var rimraf=require(_0xaaa3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaaa3('0x2'));var rp=require(_0xaaa3('0x3'));var moment=require(_0xaaa3('0x4'));var BPromise=require(_0xaaa3('0x5'));var Mustache=require('mustache');var util=require(_0xaaa3('0x6'));var path=require(_0xaaa3('0x7'));var sox=require(_0xaaa3('0x8'));var csv=require(_0xaaa3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaaa3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaaa3('0xb'));var jsforce=require(_0xaaa3('0xc'));var deskjs=require(_0xaaa3('0xd'));var toCsv=require(_0xaaa3('0x9'));var querystring=require('querystring');var Papa=require(_0xaaa3('0xe'));var Redis=require(_0xaaa3('0xf'));var authService=require(_0xaaa3('0x10'));var qs=require(_0xaaa3('0x11'));var as=require(_0xaaa3('0x12'));var hardwareService=require(_0xaaa3('0x13'));var logger=require(_0xaaa3('0x14'))(_0xaaa3('0x15'));var utils=require(_0xaaa3('0x16'));var config=require(_0xaaa3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xaaa3('0x18'))['db'];config[_0xaaa3('0x19')]=_[_0xaaa3('0x1a')](config[_0xaaa3('0x19')],{'host':_0xaaa3('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xaaa3('0x1c'))['register'](socket);function respondWithStatusCode(_0x25028c,_0x353ec9){_0x353ec9=_0x353ec9||0xcc;return function(_0x449ccf){if(_0x449ccf){return _0x25028c[_0xaaa3('0x1d')](_0x353ec9);}return _0x25028c[_0xaaa3('0x1e')](_0x353ec9)[_0xaaa3('0x1f')]();};}function respondWithResult(_0xd77a0b,_0x315c55){_0x315c55=_0x315c55||0xc8;return function(_0x1aea7e){if(_0x1aea7e){return _0xd77a0b['status'](_0x315c55)[_0xaaa3('0x20')](_0x1aea7e);}};}function respondWithFilteredResult(_0x48be36,_0x2b0db2){return function(_0x5916b0){if(_0x5916b0){var _0x500178=typeof _0x2b0db2[_0xaaa3('0x21')]==='undefined'&&typeof _0x2b0db2[_0xaaa3('0x22')]===_0xaaa3('0x23');var _0x595521=_0x5916b0['count'];var _0x2de45d=_0x500178?0x0:_0x2b0db2['offset'];var _0x18fb21=_0x500178?_0x5916b0[_0xaaa3('0x24')]:_0x2b0db2[_0xaaa3('0x21')]+_0x2b0db2[_0xaaa3('0x22')];var _0x572da0;if(_0x18fb21>=_0x595521){_0x18fb21=_0x595521;_0x572da0=0xc8;}else{_0x572da0=0xce;}_0x48be36[_0xaaa3('0x1e')](_0x572da0);return _0x48be36[_0xaaa3('0x25')](_0xaaa3('0x26'),_0x2de45d+'-'+_0x18fb21+'/'+_0x595521)[_0xaaa3('0x20')](_0x5916b0);}return null;};}function patchUpdates(_0x1cda04){return function(_0xdd09ca){try{jsonpatch[_0xaaa3('0x27')](_0xdd09ca,_0x1cda04,!![]);}catch(_0x94cf40){return BPromise['reject'](_0x94cf40);}return _0xdd09ca[_0xaaa3('0x28')]();};}function saveUpdates(_0x4e5a76,_0x55528e){return function(_0x277bff){if(_0x277bff){return _0x277bff[_0xaaa3('0x29')](_0x4e5a76)[_0xaaa3('0x2a')](function(_0x1ada3c){return _0x1ada3c;});}return null;};}function removeEntity(_0x2dfb78,_0x164315){return function(_0x44f680){if(_0x44f680){return _0x44f680[_0xaaa3('0x2b')]()[_0xaaa3('0x2a')](function(){_0x2dfb78[_0xaaa3('0x1e')](0xcc)[_0xaaa3('0x1f')]();});}};}function handleEntityNotFound(_0x32aaa7,_0x1ff6da){return function(_0x14687a){if(!_0x14687a){_0x32aaa7[_0xaaa3('0x1d')](0x194);}return _0x14687a;};}function handleError(_0x387e9c,_0x1b544b){_0x1b544b=_0x1b544b||0x1f4;return function(_0x221c94){logger[_0xaaa3('0x2c')](_0x221c94['stack']);if(_0x221c94[_0xaaa3('0x2d')]){delete _0x221c94['name'];}_0x387e9c[_0xaaa3('0x1e')](_0x1b544b)[_0xaaa3('0x2e')](_0x221c94);};}exports[_0xaaa3('0x2f')]=function(_0x343fcb,_0xac4d6c){var _0x4378e7={},_0x297082={},_0x21d378={'count':0x0,'rows':[]};var _0x46ab25=_[_0xaaa3('0x30')](db[_0xaaa3('0x31')][_0xaaa3('0x32')],function(_0x2b1598){return{'name':_0x2b1598[_0xaaa3('0x33')],'type':_0x2b1598['type'][_0xaaa3('0x34')]};});_0x297082[_0xaaa3('0x35')]=_[_0xaaa3('0x30')](_0x46ab25,'name');_0x297082[_0xaaa3('0x36')]=_[_0xaaa3('0x37')](_0x343fcb[_0xaaa3('0x36')]);_0x297082[_0xaaa3('0x38')]=_[_0xaaa3('0x39')](_0x297082[_0xaaa3('0x35')],_0x297082[_0xaaa3('0x36')]);_0x4378e7['attributes']=_[_0xaaa3('0x39')](_0x297082['model'],qs['fields'](_0x343fcb['query'][_0xaaa3('0x3a')]));_0x4378e7[_0xaaa3('0x3b')]=_0x4378e7['attributes']['length']?_0x4378e7[_0xaaa3('0x3b')]:_0x297082[_0xaaa3('0x35')];if(!_0x343fcb[_0xaaa3('0x36')]['hasOwnProperty'](_0xaaa3('0x3c'))){_0x4378e7[_0xaaa3('0x22')]=qs[_0xaaa3('0x22')](_0x343fcb[_0xaaa3('0x36')][_0xaaa3('0x22')]);_0x4378e7['offset']=qs[_0xaaa3('0x21')](_0x343fcb[_0xaaa3('0x36')][_0xaaa3('0x21')]);}_0x4378e7[_0xaaa3('0x3d')]=qs[_0xaaa3('0x3e')](_0x343fcb[_0xaaa3('0x36')][_0xaaa3('0x3e')]);_0x4378e7[_0xaaa3('0x3f')]=qs[_0xaaa3('0x38')](_[_0xaaa3('0x40')](_0x343fcb[_0xaaa3('0x36')],_0x297082['filters']),_0x46ab25);if(_0x343fcb[_0xaaa3('0x36')]['filter']){_0x4378e7['where']=_['merge'](_0x4378e7[_0xaaa3('0x3f')],{'$or':_[_0xaaa3('0x30')](_0x46ab25,function(_0x332902){if(_0x332902['type']!=='VIRTUAL'){var _0x3db72d={};_0x3db72d[_0x332902[_0xaaa3('0x2d')]]={'$like':'%'+_0x343fcb[_0xaaa3('0x36')][_0xaaa3('0x41')]+'%'};return _0x3db72d;}})});}_0x4378e7=_[_0xaaa3('0x42')]({},_0x4378e7,_0x343fcb[_0xaaa3('0x43')]);var _0x4f1388={'where':_0x4378e7[_0xaaa3('0x3f')]};return db['VoiceQueueReport'][_0xaaa3('0x24')](_0x4f1388)[_0xaaa3('0x2a')](function(_0x16445a){_0x21d378[_0xaaa3('0x24')]=_0x16445a;if(_0x343fcb[_0xaaa3('0x36')][_0xaaa3('0x44')]){_0x4378e7['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x4378e7);})['then'](function(_0x31828e){_0x21d378['rows']=_0x31828e;return _0x21d378;})[_0xaaa3('0x2a')](respondWithFilteredResult(_0xac4d6c,_0x4378e7))[_0xaaa3('0x45')](handleError(_0xac4d6c,null));};exports['show']=function(_0x2e358f,_0x6b1c13){var _0xb02883={'raw':![],'where':{'id':_0x2e358f['params']['id']}},_0x46ec1a={};_0x46ec1a['model']=_[_0xaaa3('0x37')](db[_0xaaa3('0x31')][_0xaaa3('0x32')]);_0x46ec1a['query']=_[_0xaaa3('0x37')](_0x2e358f[_0xaaa3('0x36')]);_0x46ec1a[_0xaaa3('0x38')]=_['intersection'](_0x46ec1a[_0xaaa3('0x35')],_0x46ec1a[_0xaaa3('0x36')]);_0xb02883[_0xaaa3('0x3b')]=_[_0xaaa3('0x39')](_0x46ec1a[_0xaaa3('0x35')],qs[_0xaaa3('0x3a')](_0x2e358f[_0xaaa3('0x36')]['fields']));_0xb02883[_0xaaa3('0x3b')]=_0xb02883[_0xaaa3('0x3b')][_0xaaa3('0x46')]?_0xb02883[_0xaaa3('0x3b')]:_0x46ec1a['model'];if(_0x2e358f[_0xaaa3('0x36')][_0xaaa3('0x44')]){_0xb02883['include']=[{'all':!![]}];}_0xb02883=_[_0xaaa3('0x42')]({},_0xb02883,_0x2e358f['options']);return db[_0xaaa3('0x31')]['find'](_0xb02883)['then'](handleEntityNotFound(_0x6b1c13,null))[_0xaaa3('0x2a')](respondWithResult(_0x6b1c13,null))['catch'](handleError(_0x6b1c13,null));};exports[_0xaaa3('0x47')]=function(_0x444cdb,_0x1504a4){return db['VoiceQueueReport'][_0xaaa3('0x47')](_0x444cdb[_0xaaa3('0x48')],{})[_0xaaa3('0x2a')](respondWithResult(_0x1504a4,0xc9))[_0xaaa3('0x45')](handleError(_0x1504a4,null));};exports['update']=function(_0x95a856,_0x3e6863){if(_0x95a856[_0xaaa3('0x48')]['id']){delete _0x95a856[_0xaaa3('0x48')]['id'];}return db[_0xaaa3('0x31')][_0xaaa3('0x49')]({'where':{'id':_0x95a856[_0xaaa3('0x4a')]['id']}})[_0xaaa3('0x2a')](handleEntityNotFound(_0x3e6863,null))['then'](saveUpdates(_0x95a856[_0xaaa3('0x48')],null))[_0xaaa3('0x2a')](respondWithResult(_0x3e6863,null))[_0xaaa3('0x45')](handleError(_0x3e6863,null));};exports['destroy']=function(_0x3a0037,_0x16ea4c){return db['VoiceQueueReport'][_0xaaa3('0x49')]({'where':{'id':_0x3a0037[_0xaaa3('0x4a')]['id']}})[_0xaaa3('0x2a')](handleEntityNotFound(_0x16ea4c,null))[_0xaaa3('0x2a')](removeEntity(_0x16ea4c,null))[_0xaaa3('0x45')](handleError(_0x16ea4c,null));};exports[_0xaaa3('0x4b')]=function(_0x324b99,_0x56dadc){return db[_0xaaa3('0x31')][_0xaaa3('0x4b')]()[_0xaaa3('0x2a')](respondWithResult(_0x56dadc,null))[_0xaaa3('0x45')](handleError(_0x56dadc,null));};exports[_0xaaa3('0x4c')]=function(_0x5704b4,_0x50c749){var _0x48a4e4={},_0x37dc52={},_0x34952e={'count':0x0,'rows':[]};_0x37dc52[_0xaaa3('0x35')]=_[_0xaaa3('0x37')](db[_0xaaa3('0x31')]['rawAttributes']);_0x37dc52['query']=_[_0xaaa3('0x37')](_0x5704b4[_0xaaa3('0x36')]);_0x37dc52[_0xaaa3('0x38')]=_[_0xaaa3('0x39')](_0x37dc52['model'],_0x37dc52[_0xaaa3('0x36')]);_0x48a4e4[_0xaaa3('0x3b')]=_[_0xaaa3('0x39')](_0x37dc52[_0xaaa3('0x35')],qs[_0xaaa3('0x3a')](_0x5704b4['query'][_0xaaa3('0x3a')]));_0x48a4e4[_0xaaa3('0x3b')]=_0x48a4e4[_0xaaa3('0x3b')][_0xaaa3('0x46')]?_0x48a4e4[_0xaaa3('0x3b')]:_0x37dc52[_0xaaa3('0x35')];if(!_0x5704b4['query'][_0xaaa3('0x4d')]('nolimit')){_0x48a4e4[_0xaaa3('0x22')]=qs[_0xaaa3('0x22')](_0x5704b4[_0xaaa3('0x36')][_0xaaa3('0x22')]);_0x48a4e4[_0xaaa3('0x21')]=qs[_0xaaa3('0x21')](_0x5704b4[_0xaaa3('0x36')]['offset']);}_0x48a4e4['order']=qs[_0xaaa3('0x3e')](_0x5704b4[_0xaaa3('0x36')][_0xaaa3('0x3e')]);_0x48a4e4[_0xaaa3('0x3f')]=qs['filters'](_['pick'](_0x5704b4['query'],_0x37dc52[_0xaaa3('0x38')]));if(_0x5704b4['query'][_0xaaa3('0x41')]){_0x48a4e4[_0xaaa3('0x3f')]=_[_0xaaa3('0x42')](_0x48a4e4['where'],{'$or':_[_0xaaa3('0x30')](_0x48a4e4[_0xaaa3('0x3b')],function(_0x28308f){var _0x346a15={};_0x346a15[_0x28308f]={'$like':'%'+_0x5704b4['query'][_0xaaa3('0x41')]+'%'};return _0x346a15;})});}_0x48a4e4=_['merge']({},_0x48a4e4,_0x5704b4['options']);var _0x2ef70c={'where':_0x48a4e4[_0xaaa3('0x3f')]};return db[_0xaaa3('0x31')][_0xaaa3('0x24')](_0x2ef70c)[_0xaaa3('0x2a')](function(_0x4bfce1){_0x34952e[_0xaaa3('0x24')]=_0x4bfce1;if(_0x5704b4[_0xaaa3('0x36')][_0xaaa3('0x44')]){_0x48a4e4[_0xaaa3('0x4e')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xaaa3('0x4f')](_0x48a4e4);})['then'](function(_0x36a3b9){_0x34952e[_0xaaa3('0x50')]=_0x36a3b9;return _0x34952e;})['then'](respondWithFilteredResult(_0x50c749,_0x48a4e4,'getVoiceQueuesReport'))[_0xaaa3('0x45')](handleError(_0x50c749,null,_0xaaa3('0x4c')));}; \ No newline at end of file +var _0x9ede=['intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','catch','create','body','update','find','describe','getVoiceQueuesReport','order','rows','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','save','then','destroy','sendStatus','error','stack','name','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','keys','query','filters'];(function(_0xc92184,_0x5b0687){var _0x5d98ef=function(_0x5673ea){while(--_0x5673ea){_0xc92184['push'](_0xc92184['shift']());}};_0x5d98ef(++_0x5b0687);}(_0x9ede,0x1f4));var _0xe9ed=function(_0x62650c,_0x1e481b){_0x62650c=_0x62650c-0x0;var _0x1668ca=_0x9ede[_0x62650c];return _0x1668ca;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe9ed('0x0'));var jsonpatch=require(_0xe9ed('0x1'));var rp=require(_0xe9ed('0x2'));var moment=require(_0xe9ed('0x3'));var BPromise=require(_0xe9ed('0x4'));var Mustache=require(_0xe9ed('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe9ed('0x6'));var ejs=require(_0xe9ed('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9ed('0x8'));var squel=require(_0xe9ed('0x9'));var crypto=require(_0xe9ed('0xa'));var jsforce=require(_0xe9ed('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe9ed('0x6'));var querystring=require(_0xe9ed('0xc'));var Papa=require(_0xe9ed('0xd'));var Redis=require(_0xe9ed('0xe'));var authService=require(_0xe9ed('0xf'));var qs=require(_0xe9ed('0x10'));var as=require(_0xe9ed('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe9ed('0x12'))('api');var utils=require(_0xe9ed('0x13'));var config=require(_0xe9ed('0x14'));var licenseUtil=require(_0xe9ed('0x15'));var db=require(_0xe9ed('0x16'))['db'];config[_0xe9ed('0x17')]=_['defaults'](config['redis'],{'host':_0xe9ed('0x18'),'port':0x18eb});var socket=require(_0xe9ed('0x19'))(new Redis(config[_0xe9ed('0x17')]));require(_0xe9ed('0x1a'))[_0xe9ed('0x1b')](socket);function respondWithStatusCode(_0xe51317,_0x49fdc4){_0x49fdc4=_0x49fdc4||0xcc;return function(_0x18fb1a){if(_0x18fb1a){return _0xe51317['sendStatus'](_0x49fdc4);}return _0xe51317[_0xe9ed('0x1c')](_0x49fdc4)[_0xe9ed('0x1d')]();};}function respondWithResult(_0x4ba9b4,_0x2e7e34){_0x2e7e34=_0x2e7e34||0xc8;return function(_0x1a6e9e){if(_0x1a6e9e){return _0x4ba9b4[_0xe9ed('0x1c')](_0x2e7e34)['json'](_0x1a6e9e);}};}function respondWithFilteredResult(_0x5040cf,_0x577ba2){return function(_0x3644e3){if(_0x3644e3){var _0x166032=typeof _0x577ba2[_0xe9ed('0x1e')]===_0xe9ed('0x1f')&&typeof _0x577ba2[_0xe9ed('0x20')]===_0xe9ed('0x1f');var _0x2f5332=_0x3644e3[_0xe9ed('0x21')];var _0x253270=_0x166032?0x0:_0x577ba2[_0xe9ed('0x1e')];var _0x45ed44=_0x166032?_0x3644e3['count']:_0x577ba2[_0xe9ed('0x1e')]+_0x577ba2[_0xe9ed('0x20')];var _0x6afaa3;if(_0x45ed44>=_0x2f5332){_0x45ed44=_0x2f5332;_0x6afaa3=0xc8;}else{_0x6afaa3=0xce;}_0x5040cf[_0xe9ed('0x1c')](_0x6afaa3);return _0x5040cf[_0xe9ed('0x22')](_0xe9ed('0x23'),_0x253270+'-'+_0x45ed44+'/'+_0x2f5332)['json'](_0x3644e3);}return null;};}function patchUpdates(_0x5a2eb9){return function(_0x489259){try{jsonpatch['apply'](_0x489259,_0x5a2eb9,!![]);}catch(_0x10fb68){return BPromise['reject'](_0x10fb68);}return _0x489259[_0xe9ed('0x24')]();};}function saveUpdates(_0x56aec2,_0xd74de2){return function(_0x25c492){if(_0x25c492){return _0x25c492['update'](_0x56aec2)[_0xe9ed('0x25')](function(_0x40bfaf){return _0x40bfaf;});}return null;};}function removeEntity(_0xfed229,_0x518beb){return function(_0x1abedc){if(_0x1abedc){return _0x1abedc[_0xe9ed('0x26')]()['then'](function(){_0xfed229[_0xe9ed('0x1c')](0xcc)[_0xe9ed('0x1d')]();});}};}function handleEntityNotFound(_0x475084,_0x55eed6){return function(_0x13fc85){if(!_0x13fc85){_0x475084[_0xe9ed('0x27')](0x194);}return _0x13fc85;};}function handleError(_0x208044,_0x392539){_0x392539=_0x392539||0x1f4;return function(_0x384418){logger[_0xe9ed('0x28')](_0x384418[_0xe9ed('0x29')]);if(_0x384418[_0xe9ed('0x2a')]){delete _0x384418[_0xe9ed('0x2a')];}_0x208044['status'](_0x392539)['send'](_0x384418);};}exports[_0xe9ed('0x2b')]=function(_0x15ecd1,_0x4203b2){var _0xf474dc={},_0x117b7c={},_0x1684a4={'count':0x0,'rows':[]};var _0x136b3d=_[_0xe9ed('0x2c')](db[_0xe9ed('0x2d')][_0xe9ed('0x2e')],function(_0x60af32){return{'name':_0x60af32[_0xe9ed('0x2f')],'type':_0x60af32[_0xe9ed('0x30')][_0xe9ed('0x31')]};});_0x117b7c['model']=_[_0xe9ed('0x2c')](_0x136b3d,'name');_0x117b7c['query']=_[_0xe9ed('0x32')](_0x15ecd1[_0xe9ed('0x33')]);_0x117b7c[_0xe9ed('0x34')]=_[_0xe9ed('0x35')](_0x117b7c[_0xe9ed('0x36')],_0x117b7c[_0xe9ed('0x33')]);_0xf474dc[_0xe9ed('0x37')]=_[_0xe9ed('0x35')](_0x117b7c[_0xe9ed('0x36')],qs[_0xe9ed('0x38')](_0x15ecd1['query']['fields']));_0xf474dc[_0xe9ed('0x37')]=_0xf474dc['attributes'][_0xe9ed('0x39')]?_0xf474dc['attributes']:_0x117b7c[_0xe9ed('0x36')];if(!_0x15ecd1[_0xe9ed('0x33')][_0xe9ed('0x3a')]('nolimit')){_0xf474dc[_0xe9ed('0x20')]=qs[_0xe9ed('0x20')](_0x15ecd1[_0xe9ed('0x33')]['limit']);_0xf474dc['offset']=qs[_0xe9ed('0x1e')](_0x15ecd1['query'][_0xe9ed('0x1e')]);}_0xf474dc['order']=qs[_0xe9ed('0x3b')](_0x15ecd1[_0xe9ed('0x33')][_0xe9ed('0x3b')]);_0xf474dc[_0xe9ed('0x3c')]=qs[_0xe9ed('0x34')](_[_0xe9ed('0x3d')](_0x15ecd1[_0xe9ed('0x33')],_0x117b7c[_0xe9ed('0x34')]),_0x136b3d);if(_0x15ecd1[_0xe9ed('0x33')][_0xe9ed('0x3e')]){_0xf474dc[_0xe9ed('0x3c')]=_[_0xe9ed('0x3f')](_0xf474dc[_0xe9ed('0x3c')],{'$or':_[_0xe9ed('0x2c')](_0x136b3d,function(_0x45ade3){if(_0x45ade3[_0xe9ed('0x30')]!=='VIRTUAL'){var _0x3124c5={};_0x3124c5[_0x45ade3[_0xe9ed('0x2a')]]={'$like':'%'+_0x15ecd1[_0xe9ed('0x33')]['filter']+'%'};return _0x3124c5;}})});}_0xf474dc=_['merge']({},_0xf474dc,_0x15ecd1[_0xe9ed('0x40')]);var _0xf3222={'where':_0xf474dc[_0xe9ed('0x3c')]};return db['VoiceQueueReport']['count'](_0xf3222)[_0xe9ed('0x25')](function(_0x470374){_0x1684a4['count']=_0x470374;if(_0x15ecd1['query'][_0xe9ed('0x41')]){_0xf474dc[_0xe9ed('0x42')]=[{'all':!![]}];}return db[_0xe9ed('0x2d')][_0xe9ed('0x43')](_0xf474dc);})['then'](function(_0x179c18){_0x1684a4['rows']=_0x179c18;return _0x1684a4;})[_0xe9ed('0x25')](respondWithFilteredResult(_0x4203b2,_0xf474dc))['catch'](handleError(_0x4203b2,null));};exports[_0xe9ed('0x44')]=function(_0x6b23ab,_0x4d3d2e){var _0x30ee23={'raw':![],'where':{'id':_0x6b23ab[_0xe9ed('0x45')]['id']}},_0x3480ef={};_0x3480ef['model']=_[_0xe9ed('0x32')](db[_0xe9ed('0x2d')][_0xe9ed('0x2e')]);_0x3480ef['query']=_[_0xe9ed('0x32')](_0x6b23ab[_0xe9ed('0x33')]);_0x3480ef[_0xe9ed('0x34')]=_['intersection'](_0x3480ef[_0xe9ed('0x36')],_0x3480ef[_0xe9ed('0x33')]);_0x30ee23['attributes']=_[_0xe9ed('0x35')](_0x3480ef['model'],qs[_0xe9ed('0x38')](_0x6b23ab['query'][_0xe9ed('0x38')]));_0x30ee23[_0xe9ed('0x37')]=_0x30ee23[_0xe9ed('0x37')][_0xe9ed('0x39')]?_0x30ee23[_0xe9ed('0x37')]:_0x3480ef[_0xe9ed('0x36')];if(_0x6b23ab['query']['includeAll']){_0x30ee23[_0xe9ed('0x42')]=[{'all':!![]}];}_0x30ee23=_[_0xe9ed('0x3f')]({},_0x30ee23,_0x6b23ab[_0xe9ed('0x40')]);return db[_0xe9ed('0x2d')]['find'](_0x30ee23)['then'](handleEntityNotFound(_0x4d3d2e,null))[_0xe9ed('0x25')](respondWithResult(_0x4d3d2e,null))[_0xe9ed('0x46')](handleError(_0x4d3d2e,null));};exports[_0xe9ed('0x47')]=function(_0x47286c,_0x4521d5){return db[_0xe9ed('0x2d')]['create'](_0x47286c[_0xe9ed('0x48')],{})[_0xe9ed('0x25')](respondWithResult(_0x4521d5,0xc9))[_0xe9ed('0x46')](handleError(_0x4521d5,null));};exports[_0xe9ed('0x49')]=function(_0x7f1472,_0x19ca94){if(_0x7f1472[_0xe9ed('0x48')]['id']){delete _0x7f1472[_0xe9ed('0x48')]['id'];}return db[_0xe9ed('0x2d')][_0xe9ed('0x4a')]({'where':{'id':_0x7f1472[_0xe9ed('0x45')]['id']}})['then'](handleEntityNotFound(_0x19ca94,null))[_0xe9ed('0x25')](saveUpdates(_0x7f1472['body'],null))[_0xe9ed('0x25')](respondWithResult(_0x19ca94,null))[_0xe9ed('0x46')](handleError(_0x19ca94,null));};exports['destroy']=function(_0x3e68ed,_0x4a72c2){return db[_0xe9ed('0x2d')]['find']({'where':{'id':_0x3e68ed[_0xe9ed('0x45')]['id']}})[_0xe9ed('0x25')](handleEntityNotFound(_0x4a72c2,null))[_0xe9ed('0x25')](removeEntity(_0x4a72c2,null))[_0xe9ed('0x46')](handleError(_0x4a72c2,null));};exports[_0xe9ed('0x4b')]=function(_0x34c160,_0x4e03eb){return db[_0xe9ed('0x2d')][_0xe9ed('0x4b')]()[_0xe9ed('0x25')](respondWithResult(_0x4e03eb,null))['catch'](handleError(_0x4e03eb,null));};exports[_0xe9ed('0x4c')]=function(_0x100769,_0x2037ec){var _0x1501fc={},_0x4fad8d={},_0x41b243={'count':0x0,'rows':[]};_0x4fad8d[_0xe9ed('0x36')]=_[_0xe9ed('0x32')](db[_0xe9ed('0x2d')][_0xe9ed('0x2e')]);_0x4fad8d[_0xe9ed('0x33')]=_['keys'](_0x100769[_0xe9ed('0x33')]);_0x4fad8d['filters']=_[_0xe9ed('0x35')](_0x4fad8d[_0xe9ed('0x36')],_0x4fad8d[_0xe9ed('0x33')]);_0x1501fc[_0xe9ed('0x37')]=_['intersection'](_0x4fad8d[_0xe9ed('0x36')],qs[_0xe9ed('0x38')](_0x100769['query']['fields']));_0x1501fc[_0xe9ed('0x37')]=_0x1501fc[_0xe9ed('0x37')][_0xe9ed('0x39')]?_0x1501fc[_0xe9ed('0x37')]:_0x4fad8d[_0xe9ed('0x36')];if(!_0x100769[_0xe9ed('0x33')][_0xe9ed('0x3a')]('nolimit')){_0x1501fc[_0xe9ed('0x20')]=qs['limit'](_0x100769[_0xe9ed('0x33')][_0xe9ed('0x20')]);_0x1501fc['offset']=qs[_0xe9ed('0x1e')](_0x100769[_0xe9ed('0x33')][_0xe9ed('0x1e')]);}_0x1501fc[_0xe9ed('0x4d')]=qs[_0xe9ed('0x3b')](_0x100769['query'][_0xe9ed('0x3b')]);_0x1501fc['where']=qs[_0xe9ed('0x34')](_['pick'](_0x100769[_0xe9ed('0x33')],_0x4fad8d[_0xe9ed('0x34')]));if(_0x100769[_0xe9ed('0x33')][_0xe9ed('0x3e')]){_0x1501fc[_0xe9ed('0x3c')]=_[_0xe9ed('0x3f')](_0x1501fc[_0xe9ed('0x3c')],{'$or':_[_0xe9ed('0x2c')](_0x1501fc[_0xe9ed('0x37')],function(_0x33545e){var _0x44cece={};_0x44cece[_0x33545e]={'$like':'%'+_0x100769[_0xe9ed('0x33')][_0xe9ed('0x3e')]+'%'};return _0x44cece;})});}_0x1501fc=_[_0xe9ed('0x3f')]({},_0x1501fc,_0x100769[_0xe9ed('0x40')]);var _0x26b6cc={'where':_0x1501fc['where']};return db[_0xe9ed('0x2d')][_0xe9ed('0x21')](_0x26b6cc)[_0xe9ed('0x25')](function(_0x4cd3a9){_0x41b243[_0xe9ed('0x21')]=_0x4cd3a9;if(_0x100769[_0xe9ed('0x33')][_0xe9ed('0x41')]){_0x1501fc['include']=[{'all':!![]}];}return db[_0xe9ed('0x2d')][_0xe9ed('0x43')](_0x1501fc);})[_0xe9ed('0x25')](function(_0x38fa12){_0x41b243[_0xe9ed('0x4e')]=_0x38fa12;return _0x41b243;})['then'](respondWithFilteredResult(_0x2037ec,_0x1501fc,_0xe9ed('0x4c')))['catch'](handleError(_0x2037ec,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index f513510..4cfa056 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 _0x29f7=['update','emit','hasOwnProperty','hook','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x29f7,0x15a));var _0x729f=function(_0x370e12,_0x590972){_0x370e12=_0x370e12-0x0;var _0x423716=_0x29f7[_0x370e12];return _0x423716;};'use strict';var EventEmitter=require(_0x729f('0x0'));var VoiceQueueReport=require(_0x729f('0x1'))['db'][_0x729f('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x729f('0x3')](0x0);var events={'afterCreate':_0x729f('0x4'),'afterUpdate':_0x729f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x272455){return function(_0x86aecf,_0x5647a8,_0x25182c){VoiceQueueReportEvents['emit'](_0x272455+':'+_0x86aecf['id'],_0x86aecf);VoiceQueueReportEvents[_0x729f('0x6')](_0x272455,_0x86aecf);_0x25182c(null);};}for(var e in events){if(events[_0x729f('0x7')](e)){var event=events[e];VoiceQueueReport[_0x729f('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0xb338=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save'];(function(_0x3c0b95,_0x26105c){var _0x3759e0=function(_0x19f11f){while(--_0x19f11f){_0x3c0b95['push'](_0x3c0b95['shift']());}};_0x3759e0(++_0x26105c);}(_0xb338,0x166));var _0x8b33=function(_0x350aeb,_0x3d265a){_0x350aeb=_0x350aeb-0x0;var _0x3c5273=_0xb338[_0x350aeb];return _0x3c5273;};'use strict';var EventEmitter=require(_0x8b33('0x0'));var VoiceQueueReport=require(_0x8b33('0x1'))['db'][_0x8b33('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x8b33('0x3')](0x0);var events={'afterCreate':_0x8b33('0x4'),'afterUpdate':_0x8b33('0x5'),'afterDestroy':_0x8b33('0x6')};function emitEvent(_0x1ee917){return function(_0x4d91e6,_0x497c71,_0x1a5576){VoiceQueueReportEvents['emit'](_0x1ee917+':'+_0x4d91e6['id'],_0x4d91e6);VoiceQueueReportEvents[_0x8b33('0x7')](_0x1ee917,_0x4d91e6);_0x1a5576(null);};}for(var e in events){if(events[_0x8b33('0x8')](e)){var event=events[e];VoiceQueueReport[_0x8b33('0x9')](e,emitEvent(event));}}module[_0x8b33('0xa')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 0583e95..8da59e9 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 _0x990a=['calleridnum','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid'];(function(_0x3f6e7b,_0x54c444){var _0x298019=function(_0x47a7dc){while(--_0x47a7dc){_0x3f6e7b['push'](_0x3f6e7b['shift']());}};_0x298019(++_0x54c444);}(_0x990a,0x114));var _0xa990=function(_0x31c5be,_0x4f9de5){_0x31c5be=_0x31c5be-0x0;var _0x109979=_0x990a[_0x31c5be];return _0x109979;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa990('0x0'));var moment=require(_0xa990('0x1'));var BPromise=require(_0xa990('0x2'));var rp=require(_0xa990('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa990('0x4'));var config=require(_0xa990('0x5'));var attributes=require('./voiceQueueReport.attributes');module[_0xa990('0x6')]=function(_0x309f9a,_0x13eb74){return _0x309f9a['define'](_0xa990('0x7'),attributes,{'tableName':_0xa990('0x8'),'paranoid':![],'indexes':[{'fields':[_0xa990('0x9')]},{'fields':[_0xa990('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x20af=['report_queue','uniqueid','calleridnum','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueueReport.attributes','exports','define','VoiceQueueReport'];(function(_0x582ec9,_0x7ed3e0){var _0x5a63d1=function(_0x5c3ec3){while(--_0x5c3ec3){_0x582ec9['push'](_0x582ec9['shift']());}};_0x5a63d1(++_0x7ed3e0);}(_0x20af,0xb9));var _0xf20a=function(_0x38caf2,_0x4f20de){_0x38caf2=_0x38caf2-0x0;var _0x54a634=_0x20af[_0x38caf2];return _0x54a634;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf20a('0x0'))(_0xf20a('0x1'));var moment=require(_0xf20a('0x2'));var BPromise=require(_0xf20a('0x3'));var rp=require(_0xf20a('0x4'));var fs=require('fs');var path=require(_0xf20a('0x5'));var rimraf=require(_0xf20a('0x6'));var config=require('../../config/environment');var attributes=require(_0xf20a('0x7'));module[_0xf20a('0x8')]=function(_0xbed358,_0x4a80e3){return _0xbed358[_0xf20a('0x9')](_0xf20a('0xa'),attributes,{'tableName':_0xf20a('0xb'),'paranoid':![],'indexes':[{'fields':[_0xf20a('0xc')]},{'fields':[_0xf20a('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 f7ea4b1..301de20 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 _0x1477=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetVoiceQueueReport','findAll','options','attributes','limit','include','map','model','then','debug','CreateVoiceQueueReport','VoiceQueueReport','create','body','UpdateVoiceQueueReport','update','raw','where','util'];(function(_0x55219a,_0x164725){var _0x45ecba=function(_0x2dc7ae){while(--_0x2dc7ae){_0x55219a['push'](_0x55219a['shift']());}};_0x45ecba(++_0x164725);}(_0x1477,0x1cd));var _0x7147=function(_0x3c7f80,_0x4d4d1d){_0x3c7f80=_0x3c7f80-0x0;var _0x2bc49f=_0x1477[_0x3c7f80];return _0x2bc49f;};'use strict';var _=require('lodash');var util=require(_0x7147('0x0'));var moment=require(_0x7147('0x1'));var BPromise=require(_0x7147('0x2'));var rs=require(_0x7147('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7147('0x4'))['db'];var utils=require(_0x7147('0x5'));var logger=require('../../config/logger')(_0x7147('0x6'));var config=require(_0x7147('0x7'));var jayson=require(_0x7147('0x8'));var client=jayson[_0x7147('0x9')][_0x7147('0xa')]({'port':0x232a});config[_0x7147('0xb')]=_[_0x7147('0xc')](config['redis'],{'host':_0x7147('0xd'),'port':0x18eb});var socket=require(_0x7147('0xe'))(new Redis(config[_0x7147('0xb')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x57e515,_0x26d4dc,_0x1c726e){return new BPromise(function(_0x1d3eee,_0x9afcac){return client[_0x7147('0xf')](_0x57e515,_0x1c726e)['then'](function(_0xb9370c){logger['info'](_0x7147('0x10'),_0x26d4dc,_0x7147('0x11'));logger['debug'](_0x7147('0x12'),_0x26d4dc,_0x7147('0x11'),JSON[_0x7147('0x13')](_0xb9370c));if(_0xb9370c['error']){if(_0xb9370c[_0x7147('0x14')][_0x7147('0x15')]===0x1f4){logger[_0x7147('0x14')](_0x7147('0x10'),_0x26d4dc,_0xb9370c[_0x7147('0x14')][_0x7147('0x16')]);return _0x9afcac(_0xb9370c[_0x7147('0x14')]['message']);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x26d4dc,_0xb9370c[_0x7147('0x14')][_0x7147('0x16')]);return _0x1d3eee(_0xb9370c[_0x7147('0x14')][_0x7147('0x16')]);}else{logger[_0x7147('0x17')](_0x7147('0x10'),_0x26d4dc,'request\x20sent');_0x1d3eee(_0xb9370c['result'][_0x7147('0x16')]);}})['catch'](function(_0x3d97ac){logger['error'](_0x7147('0x10'),_0x26d4dc,_0x3d97ac);_0x9afcac(_0x3d97ac);});});}exports[_0x7147('0x18')]=function(_0x242964){var _0x4d4549=this;return new Promise(function(_0x214e4a,_0x5572a6){return db['VoiceQueueReport'][_0x7147('0x19')]({'raw':_0x242964[_0x7147('0x1a')]?_0x242964[_0x7147('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x242964[_0x7147('0x1a')]?_0x242964[_0x7147('0x1a')]['where']||null:null,'attributes':_0x242964[_0x7147('0x1a')]?_0x242964['options'][_0x7147('0x1b')]||null:null,'limit':_0x242964[_0x7147('0x1a')]?_0x242964[_0x7147('0x1a')][_0x7147('0x1c')]||null:null,'include':_0x242964[_0x7147('0x1a')]?_0x242964[_0x7147('0x1a')][_0x7147('0x1d')]?_[_0x7147('0x1e')](_0x242964[_0x7147('0x1a')][_0x7147('0x1d')],function(_0x49b13a){return{'model':db[_0x49b13a[_0x7147('0x1f')]],'as':_0x49b13a['as'],'attributes':_0x49b13a['attributes'],'include':_0x49b13a[_0x7147('0x1d')]?_[_0x7147('0x1e')](_0x49b13a['include'],function(_0x4af29a){return{'model':db[_0x4af29a[_0x7147('0x1f')]],'as':_0x4af29a['as'],'attributes':_0x4af29a[_0x7147('0x1b')],'include':_0x4af29a[_0x7147('0x1d')]?_[_0x7147('0x1e')](_0x4af29a[_0x7147('0x1d')],function(_0x3b03e9){return{'model':db[_0x3b03e9[_0x7147('0x1f')]],'as':_0x3b03e9['as'],'attributes':_0x3b03e9['attributes']};}):[]};}):[]};}):[]:[]})[_0x7147('0x20')](function(_0x517dcb){logger['info'](_0x7147('0x18'),_0x242964);logger[_0x7147('0x21')]('GetVoiceQueueReport',_0x242964,JSON['stringify'](_0x517dcb));_0x214e4a(_0x517dcb);})['catch'](function(_0x17e203){logger[_0x7147('0x14')]('GetVoiceQueueReport',_0x17e203[_0x7147('0x16')],_0x242964);_0x5572a6(_0x4d4549[_0x7147('0x14')](0x1f4,_0x17e203[_0x7147('0x16')]));});});};exports[_0x7147('0x22')]=function(_0x27e5b6){var _0x3a69d1=this;return new Promise(function(_0x32de2a,_0x19f499){return db[_0x7147('0x23')][_0x7147('0x24')](_0x27e5b6[_0x7147('0x25')],{'raw':_0x27e5b6[_0x7147('0x1a')]?_0x27e5b6[_0x7147('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x7147('0x20')](function(_0x5067e6){logger[_0x7147('0x17')]('CreateVoiceQueueReport',_0x27e5b6);logger[_0x7147('0x21')](_0x7147('0x22'),_0x27e5b6,JSON[_0x7147('0x13')](_0x5067e6));_0x32de2a(_0x5067e6);})['catch'](function(_0x52e5d0){logger[_0x7147('0x14')](_0x7147('0x22'),_0x52e5d0[_0x7147('0x16')],_0x27e5b6);_0x19f499(_0x3a69d1[_0x7147('0x14')](0x1f4,_0x52e5d0[_0x7147('0x16')]));});});};exports[_0x7147('0x26')]=function(_0x572ac9){var _0x131223=this;return new Promise(function(_0x130097,_0xb207e3){return db[_0x7147('0x23')][_0x7147('0x27')](_0x572ac9['body'],{'raw':_0x572ac9[_0x7147('0x1a')]?_0x572ac9[_0x7147('0x1a')][_0x7147('0x28')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x572ac9['options']?_0x572ac9[_0x7147('0x1a')][_0x7147('0x29')]||null:null,'attributes':_0x572ac9[_0x7147('0x1a')]?_0x572ac9[_0x7147('0x1a')][_0x7147('0x1b')]||null:null,'limit':_0x572ac9['options']?_0x572ac9[_0x7147('0x1a')][_0x7147('0x1c')]||null:null})[_0x7147('0x20')](function(_0x6be05b){logger[_0x7147('0x17')](_0x7147('0x26'),_0x572ac9);logger[_0x7147('0x21')](_0x7147('0x26'),_0x572ac9,JSON[_0x7147('0x13')](_0x6be05b));_0x130097(_0x6be05b);})['catch'](function(_0x358625){logger['error'](_0x7147('0x26'),_0x358625[_0x7147('0x16')],_0x572ac9);_0xb207e3(_0x131223['error'](0x1f4,_0x358625[_0x7147('0x16')]));});});}; \ No newline at end of file +var _0xb154=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueueReport.socket','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','catch','findAll','options','where','limit','model','attributes','include','map','GetVoiceQueueReport','CreateVoiceQueueReport','VoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','lodash'];(function(_0x59bb79,_0x36e412){var _0x20bc99=function(_0xa74525){while(--_0xa74525){_0x59bb79['push'](_0x59bb79['shift']());}};_0x20bc99(++_0x36e412);}(_0xb154,0xfb));var _0x4b15=function(_0x23172f,_0x11f3e4){_0x23172f=_0x23172f-0x0;var _0x178562=_0xb154[_0x23172f];return _0x178562;};'use strict';var _=require(_0x4b15('0x0'));var util=require(_0x4b15('0x1'));var moment=require(_0x4b15('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b15('0x3'));var db=require(_0x4b15('0x4'))['db'];var utils=require(_0x4b15('0x5'));var logger=require(_0x4b15('0x6'))(_0x4b15('0x7'));var config=require(_0x4b15('0x8'));var jayson=require(_0x4b15('0x9'));var client=jayson[_0x4b15('0xa')][_0x4b15('0xb')]({'port':0x232a});config[_0x4b15('0xc')]=_['defaults'](config[_0x4b15('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4b15('0xd'))(new Redis(config[_0x4b15('0xc')]));require(_0x4b15('0xe'))['register'](socket);function respondWithRpcPromise(_0x20e398,_0x48479,_0x542a92){return new BPromise(function(_0x5b19f2,_0x46c273){return client['request'](_0x20e398,_0x542a92)[_0x4b15('0xf')](function(_0x2a707e){logger[_0x4b15('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x48479,_0x4b15('0x11'));logger[_0x4b15('0x12')](_0x4b15('0x13'),_0x48479,_0x4b15('0x11'),JSON[_0x4b15('0x14')](_0x2a707e));if(_0x2a707e['error']){if(_0x2a707e[_0x4b15('0x15')][_0x4b15('0x16')]===0x1f4){logger[_0x4b15('0x15')](_0x4b15('0x17'),_0x48479,_0x2a707e[_0x4b15('0x15')][_0x4b15('0x18')]);return _0x46c273(_0x2a707e[_0x4b15('0x15')][_0x4b15('0x18')]);}logger[_0x4b15('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x48479,_0x2a707e['error']['message']);return _0x5b19f2(_0x2a707e[_0x4b15('0x15')][_0x4b15('0x18')]);}else{logger[_0x4b15('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x48479,_0x4b15('0x11'));_0x5b19f2(_0x2a707e['result']['message']);}})[_0x4b15('0x19')](function(_0x261c6b){logger[_0x4b15('0x15')](_0x4b15('0x17'),_0x48479,_0x261c6b);_0x46c273(_0x261c6b);});});}exports['GetVoiceQueueReport']=function(_0x869f3c){var _0x82dbba=this;return new Promise(function(_0x3355cc,_0xf5f73d){return db['VoiceQueueReport'][_0x4b15('0x1a')]({'raw':_0x869f3c[_0x4b15('0x1b')]?_0x869f3c[_0x4b15('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x869f3c['options']?_0x869f3c[_0x4b15('0x1b')][_0x4b15('0x1c')]||null:null,'attributes':_0x869f3c[_0x4b15('0x1b')]?_0x869f3c[_0x4b15('0x1b')]['attributes']||null:null,'limit':_0x869f3c[_0x4b15('0x1b')]?_0x869f3c[_0x4b15('0x1b')][_0x4b15('0x1d')]||null:null,'include':_0x869f3c[_0x4b15('0x1b')]?_0x869f3c[_0x4b15('0x1b')]['include']?_['map'](_0x869f3c[_0x4b15('0x1b')]['include'],function(_0x18d7e6){return{'model':db[_0x18d7e6[_0x4b15('0x1e')]],'as':_0x18d7e6['as'],'attributes':_0x18d7e6[_0x4b15('0x1f')],'include':_0x18d7e6[_0x4b15('0x20')]?_[_0x4b15('0x21')](_0x18d7e6[_0x4b15('0x20')],function(_0xca19bd){return{'model':db[_0xca19bd['model']],'as':_0xca19bd['as'],'attributes':_0xca19bd[_0x4b15('0x1f')],'include':_0xca19bd['include']?_[_0x4b15('0x21')](_0xca19bd[_0x4b15('0x20')],function(_0x59e721){return{'model':db[_0x59e721[_0x4b15('0x1e')]],'as':_0x59e721['as'],'attributes':_0x59e721[_0x4b15('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4b15('0xf')](function(_0x375b67){logger[_0x4b15('0x10')](_0x4b15('0x22'),_0x869f3c);logger[_0x4b15('0x12')]('GetVoiceQueueReport',_0x869f3c,JSON[_0x4b15('0x14')](_0x375b67));_0x3355cc(_0x375b67);})[_0x4b15('0x19')](function(_0x19f867){logger[_0x4b15('0x15')](_0x4b15('0x22'),_0x19f867[_0x4b15('0x18')],_0x869f3c);_0xf5f73d(_0x82dbba[_0x4b15('0x15')](0x1f4,_0x19f867['message']));});});};exports[_0x4b15('0x23')]=function(_0x3ead7b){var _0x60ed23=this;return new Promise(function(_0x1cc96d,_0x3900e2){return db[_0x4b15('0x24')][_0x4b15('0x25')](_0x3ead7b[_0x4b15('0x26')],{'raw':_0x3ead7b[_0x4b15('0x1b')]?_0x3ead7b[_0x4b15('0x1b')][_0x4b15('0x27')]===undefined?!![]:![]:!![]})[_0x4b15('0xf')](function(_0x1126be){logger[_0x4b15('0x10')](_0x4b15('0x23'),_0x3ead7b);logger[_0x4b15('0x12')](_0x4b15('0x23'),_0x3ead7b,JSON[_0x4b15('0x14')](_0x1126be));_0x1cc96d(_0x1126be);})[_0x4b15('0x19')](function(_0x19db8b){logger[_0x4b15('0x15')](_0x4b15('0x23'),_0x19db8b[_0x4b15('0x18')],_0x3ead7b);_0x3900e2(_0x60ed23[_0x4b15('0x15')](0x1f4,_0x19db8b[_0x4b15('0x18')]));});});};exports[_0x4b15('0x28')]=function(_0x22df1b){var _0x2231e1=this;return new Promise(function(_0x38801f,_0x4f3239){return db[_0x4b15('0x24')][_0x4b15('0x29')](_0x22df1b['body'],{'raw':_0x22df1b[_0x4b15('0x1b')]?_0x22df1b['options'][_0x4b15('0x27')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22df1b[_0x4b15('0x1b')]?_0x22df1b['options'][_0x4b15('0x1c')]||null:null,'attributes':_0x22df1b[_0x4b15('0x1b')]?_0x22df1b[_0x4b15('0x1b')]['attributes']||null:null,'limit':_0x22df1b[_0x4b15('0x1b')]?_0x22df1b[_0x4b15('0x1b')][_0x4b15('0x1d')]||null:null})[_0x4b15('0xf')](function(_0x5a86a1){logger[_0x4b15('0x10')](_0x4b15('0x28'),_0x22df1b);logger['debug'](_0x4b15('0x28'),_0x22df1b,JSON['stringify'](_0x5a86a1));_0x38801f(_0x5a86a1);})['catch'](function(_0x4bb43f){logger[_0x4b15('0x15')](_0x4b15('0x28'),_0x4bb43f['message'],_0x22df1b);_0x4f3239(_0x2231e1['error'](0x1f4,_0x4bb43f[_0x4b15('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index b8ceed8..848acf4 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 _0x78b7=['removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','update','emit'];(function(_0x1855d6,_0x4a74af){var _0x57d551=function(_0x4553c9){while(--_0x4553c9){_0x1855d6['push'](_0x1855d6['shift']());}};_0x57d551(++_0x4a74af);}(_0x78b7,0x194));var _0x778b=function(_0x1f9537,_0x344bfb){_0x1f9537=_0x1f9537-0x0;var _0x1539a0=_0x78b7[_0x1f9537];return _0x1539a0;};'use strict';var VoiceQueueReportEvents=require(_0x778b('0x0'));var events=[_0x778b('0x1'),'remove',_0x778b('0x2')];function createListener(_0x3072bd,_0x422fff){return function(_0x3221de){_0x422fff[_0x778b('0x3')](_0x3072bd,_0x3221de);};}function removeListener(_0x4d298d,_0x4c91f3){return function(){VoiceQueueReportEvents[_0x778b('0x4')](_0x4d298d,_0x4c91f3);};}exports[_0x778b('0x5')]=function(_0x11b624){for(var _0xb6f0af=0x0,_0x41ca62=events[_0x778b('0x6')];_0xb6f0af<_0x41ca62;_0xb6f0af++){var _0x49a27a=events[_0xb6f0af];var _0x3fba10=createListener(_0x778b('0x7')+_0x49a27a,_0x11b624);VoiceQueueReportEvents['on'](_0x49a27a,_0x3fba10);}}; \ No newline at end of file +var _0x53cf=['./voiceQueueReport.events','save','remove','update','removeListener','register','length','voiceQueueReport:'];(function(_0x4f8886,_0x9be826){var _0x3c49e4=function(_0x3121e1){while(--_0x3121e1){_0x4f8886['push'](_0x4f8886['shift']());}};_0x3c49e4(++_0x9be826);}(_0x53cf,0x1b0));var _0xf53c=function(_0x235d69,_0x5a78ee){_0x235d69=_0x235d69-0x0;var _0x2974de=_0x53cf[_0x235d69];return _0x2974de;};'use strict';var VoiceQueueReportEvents=require(_0xf53c('0x0'));var events=[_0xf53c('0x1'),_0xf53c('0x2'),_0xf53c('0x3')];function createListener(_0x416ec9,_0x8c1cf2){return function(_0x180faa){_0x8c1cf2['emit'](_0x416ec9,_0x180faa);};}function removeListener(_0x1c78e6,_0xfe7b32){return function(){VoiceQueueReportEvents[_0xf53c('0x4')](_0x1c78e6,_0xfe7b32);};}exports[_0xf53c('0x5')]=function(_0x4ce1c9){for(var _0x163377=0x0,_0x33f534=events[_0xf53c('0x6')];_0x163377<_0x33f534;_0x163377++){var _0x50687d=events[_0x163377];var _0x52a320=createListener(_0xf53c('0x7')+_0x50687d,_0x4ce1c9);VoiceQueueReportEvents['on'](_0x50687d,_0x52a320);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 18f9911..6c8af06 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 _0xae7a=['../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','multer','util','Router','fs-extra'];(function(_0x3b865d,_0x11305d){var _0x20b079=function(_0x424b02){while(--_0x424b02){_0x3b865d['push'](_0x3b865d['shift']());}};_0x20b079(++_0x11305d);}(_0xae7a,0x1a0));var _0xaae7=function(_0x3ab32d,_0x633793){_0x3ab32d=_0x3ab32d-0x0;var _0x2cfab5=_0xae7a[_0x3ab32d];return _0x2cfab5;};'use strict';var multer=require(_0xaae7('0x0'));var util=require(_0xaae7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaae7('0x2')]();var fs_extra=require(_0xaae7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xaae7('0x4'));var config=require('../../config/environment');var controller=require(_0xaae7('0x5'));router[_0xaae7('0x6')]('/',auth[_0xaae7('0x7')](),controller[_0xaae7('0x8')]);router[_0xaae7('0x6')](_0xaae7('0x9'),auth[_0xaae7('0x7')](),controller[_0xaae7('0xa')]);router[_0xaae7('0xb')]('/',auth[_0xaae7('0x7')](),controller[_0xaae7('0xc')]);router['put'](_0xaae7('0x9'),auth[_0xaae7('0x7')](),controller[_0xaae7('0xd')]);router[_0xaae7('0xe')]('/:id',auth[_0xaae7('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x43df=['/:id','show','create','put','update','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index'];(function(_0x27881f,_0x4cb469){var _0x20bd21=function(_0x2512d2){while(--_0x2512d2){_0x27881f['push'](_0x27881f['shift']());}};_0x20bd21(++_0x4cb469);}(_0x43df,0x1c8));var _0xf43d=function(_0x546750,_0x4c86d2){_0x546750=_0x546750-0x0;var _0x518b4e=_0x43df[_0x546750];return _0x518b4e;};'use strict';var multer=require('multer');var util=require(_0xf43d('0x0'));var path=require(_0xf43d('0x1'));var timeout=require('connect-timeout');var express=require(_0xf43d('0x2'));var router=express[_0xf43d('0x3')]();var fs_extra=require(_0xf43d('0x4'));var auth=require(_0xf43d('0x5'));var interaction=require(_0xf43d('0x6'));var config=require(_0xf43d('0x7'));var controller=require(_0xf43d('0x8'));router[_0xf43d('0x9')]('/',auth[_0xf43d('0xa')](),controller[_0xf43d('0xb')]);router[_0xf43d('0x9')](_0xf43d('0xc'),auth['isAuthenticated'](),controller[_0xf43d('0xd')]);router['post']('/',auth[_0xf43d('0xa')](),controller[_0xf43d('0xe')]);router[_0xf43d('0xf')]('/:id',auth[_0xf43d('0xa')](),controller[_0xf43d('0x10')]);router['delete']('/:id',auth[_0xf43d('0xa')](),controller[_0xf43d('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 03f4fd8..b3e033b 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 _0x6f18=['STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports'];(function(_0x429b3f,_0x42d8c6){var _0xc44159=function(_0x38b283){while(--_0x38b283){_0x429b3f['push'](_0x429b3f['shift']());}};_0xc44159(++_0x42d8c6);}(_0x6f18,0x1d9));var _0x86f1=function(_0x333a60,_0x201ccf){_0x333a60=_0x333a60-0x0;var _0x21e8c2=_0x6f18[_0x333a60];return _0x21e8c2;};'use strict';var Sequelize=require(_0x86f1('0x0'));var moment=require(_0x86f1('0x1'));module[_0x86f1('0x2')]={'time':{'type':Sequelize[_0x86f1('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x86f1('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x86f1('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x86f1('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x86f1('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x86f1('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x86f1('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x86f1('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x86f1('0x5')](_0x86f1('0x6'))}}; \ No newline at end of file +var _0x9b29=['moment','STRING','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x583031,_0x1d2e2d){var _0x27e7c8=function(_0x3ca200){while(--_0x3ca200){_0x583031['push'](_0x583031['shift']());}};_0x27e7c8(++_0x1d2e2d);}(_0x9b29,0x177));var _0x99b2=function(_0x27bbf8,_0x137d54){_0x27bbf8=_0x27bbf8-0x0;var _0x49b87d=_0x9b29[_0x27bbf8];return _0x49b87d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x99b2('0x0'));module['exports']={'time':{'type':Sequelize[_0x99b2('0x1')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x99b2('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x99b2('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x99b2('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x99b2('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x99b2('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x99b2('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x99b2('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x99b2('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['literal'](_0x99b2('0x2'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 8ee4033..c4d0b1c 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 _0xd784=['json','undefined','count','offset','limit','Content-Range','apply','update','then','sendStatus','error','name','send','index','VoiceQueuesLog','rawAttributes','type','key','model','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','includeAll','include','findAll','rows','catch','show','options','create','body','find','params','eml-format','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','end','status'];(function(_0x2816a9,_0x33e30f){var _0x29f42e=function(_0x4eac24){while(--_0x4eac24){_0x2816a9['push'](_0x2816a9['shift']());}};_0x29f42e(++_0x33e30f);}(_0xd784,0x135));var _0x4d78=function(_0x4f303d,_0x25f17c){_0x4f303d=_0x4f303d-0x0;var _0x195a17=_0xd784[_0x4f303d];return _0x195a17;};'use strict';var emlformat=require(_0x4d78('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4d78('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4d78('0x2'));var BPromise=require(_0x4d78('0x3'));var Mustache=require(_0x4d78('0x4'));var util=require(_0x4d78('0x5'));var path=require('path');var sox=require(_0x4d78('0x6'));var csv=require(_0x4d78('0x7'));var ejs=require(_0x4d78('0x8'));var fs=require('fs');var fs_extra=require(_0x4d78('0x9'));var _=require(_0x4d78('0xa'));var squel=require(_0x4d78('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4d78('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4d78('0xd'));var Papa=require(_0x4d78('0xe'));var Redis=require('ioredis');var authService=require(_0x4d78('0xf'));var qs=require(_0x4d78('0x10'));var as=require(_0x4d78('0x11'));var hardwareService=require(_0x4d78('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e8392,_0x3563c7){_0x3563c7=_0x3563c7||0xcc;return function(_0x108918){if(_0x108918){return _0x1e8392['sendStatus'](_0x3563c7);}return _0x1e8392['status'](_0x3563c7)[_0x4d78('0x13')]();};}function respondWithResult(_0x43771c,_0xa4e1f6){_0xa4e1f6=_0xa4e1f6||0xc8;return function(_0x2dc353){if(_0x2dc353){return _0x43771c[_0x4d78('0x14')](_0xa4e1f6)[_0x4d78('0x15')](_0x2dc353);}};}function respondWithFilteredResult(_0x2035f6,_0x2a3c06){return function(_0x114677){if(_0x114677){var _0xe31d7f=typeof _0x2a3c06['offset']===_0x4d78('0x16')&&typeof _0x2a3c06['limit']===_0x4d78('0x16');var _0x5547f7=_0x114677[_0x4d78('0x17')];var _0x30d2e7=_0xe31d7f?0x0:_0x2a3c06['offset'];var _0x1018bf=_0xe31d7f?_0x114677[_0x4d78('0x17')]:_0x2a3c06[_0x4d78('0x18')]+_0x2a3c06[_0x4d78('0x19')];var _0x426dd4;if(_0x1018bf>=_0x5547f7){_0x1018bf=_0x5547f7;_0x426dd4=0xc8;}else{_0x426dd4=0xce;}_0x2035f6[_0x4d78('0x14')](_0x426dd4);return _0x2035f6['set'](_0x4d78('0x1a'),_0x30d2e7+'-'+_0x1018bf+'/'+_0x5547f7)[_0x4d78('0x15')](_0x114677);}return null;};}function patchUpdates(_0x5f4aa4){return function(_0x1d1b91){try{jsonpatch[_0x4d78('0x1b')](_0x1d1b91,_0x5f4aa4,!![]);}catch(_0x3733e8){return BPromise['reject'](_0x3733e8);}return _0x1d1b91['save']();};}function saveUpdates(_0x1dde4b,_0x5925bb){return function(_0x4aa58a){if(_0x4aa58a){return _0x4aa58a[_0x4d78('0x1c')](_0x1dde4b)[_0x4d78('0x1d')](function(_0x1f2be3){return _0x1f2be3;});}return null;};}function removeEntity(_0xb98767,_0x51fc46){return function(_0x9f6c16){if(_0x9f6c16){return _0x9f6c16['destroy']()[_0x4d78('0x1d')](function(){_0xb98767[_0x4d78('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e28d2,_0x134dd7){return function(_0x5cba87){if(!_0x5cba87){_0x3e28d2[_0x4d78('0x1e')](0x194);}return _0x5cba87;};}function handleError(_0x58fa8a,_0x2fd707){_0x2fd707=_0x2fd707||0x1f4;return function(_0x46e048){logger[_0x4d78('0x1f')](_0x46e048['stack']);if(_0x46e048[_0x4d78('0x20')]){delete _0x46e048[_0x4d78('0x20')];}_0x58fa8a[_0x4d78('0x14')](_0x2fd707)[_0x4d78('0x21')](_0x46e048);};}exports[_0x4d78('0x22')]=function(_0x34bfe2,_0x573efc){var _0x45997b={},_0x5275e1={},_0x221969={'count':0x0,'rows':[]};var _0xf49508=_['map'](db[_0x4d78('0x23')][_0x4d78('0x24')],function(_0x1b85d5){return{'name':_0x1b85d5['fieldName'],'type':_0x1b85d5[_0x4d78('0x25')][_0x4d78('0x26')]};});_0x5275e1[_0x4d78('0x27')]=_[_0x4d78('0x28')](_0xf49508,'name');_0x5275e1['query']=_[_0x4d78('0x29')](_0x34bfe2['query']);_0x5275e1['filters']=_[_0x4d78('0x2a')](_0x5275e1[_0x4d78('0x27')],_0x5275e1[_0x4d78('0x2b')]);_0x45997b[_0x4d78('0x2c')]=_[_0x4d78('0x2a')](_0x5275e1[_0x4d78('0x27')],qs['fields'](_0x34bfe2['query'][_0x4d78('0x2d')]));_0x45997b[_0x4d78('0x2c')]=_0x45997b[_0x4d78('0x2c')][_0x4d78('0x2e')]?_0x45997b[_0x4d78('0x2c')]:_0x5275e1[_0x4d78('0x27')];if(!_0x34bfe2['query'][_0x4d78('0x2f')](_0x4d78('0x30'))){_0x45997b[_0x4d78('0x19')]=qs['limit'](_0x34bfe2['query'][_0x4d78('0x19')]);_0x45997b[_0x4d78('0x18')]=qs['offset'](_0x34bfe2[_0x4d78('0x2b')][_0x4d78('0x18')]);}_0x45997b[_0x4d78('0x31')]=qs['sort'](_0x34bfe2['query'][_0x4d78('0x32')]);_0x45997b[_0x4d78('0x33')]=qs[_0x4d78('0x34')](_['pick'](_0x34bfe2[_0x4d78('0x2b')],_0x5275e1['filters']),_0xf49508);if(_0x34bfe2['query']['filter']){_0x45997b[_0x4d78('0x33')]=_[_0x4d78('0x35')](_0x45997b[_0x4d78('0x33')],{'$or':_[_0x4d78('0x28')](_0xf49508,function(_0x3954a7){if(_0x3954a7['type']!=='VIRTUAL'){var _0x2726d7={};_0x2726d7[_0x3954a7[_0x4d78('0x20')]]={'$like':'%'+_0x34bfe2[_0x4d78('0x2b')][_0x4d78('0x36')]+'%'};return _0x2726d7;}})});}_0x45997b=_[_0x4d78('0x35')]({},_0x45997b,_0x34bfe2['options']);var _0x866839={'where':_0x45997b[_0x4d78('0x33')]};return db[_0x4d78('0x23')][_0x4d78('0x17')](_0x866839)[_0x4d78('0x1d')](function(_0x48eaa8){_0x221969[_0x4d78('0x17')]=_0x48eaa8;if(_0x34bfe2['query'][_0x4d78('0x37')]){_0x45997b[_0x4d78('0x38')]=[{'all':!![]}];}return db[_0x4d78('0x23')][_0x4d78('0x39')](_0x45997b);})[_0x4d78('0x1d')](function(_0x206455){_0x221969[_0x4d78('0x3a')]=_0x206455;return _0x221969;})[_0x4d78('0x1d')](respondWithFilteredResult(_0x573efc,_0x45997b))[_0x4d78('0x3b')](handleError(_0x573efc,null));};exports[_0x4d78('0x3c')]=function(_0x3f64de,_0x5ec882){var _0x55c823={'raw':!![],'where':{'id':_0x3f64de['params']['id']}},_0x5a3b2d={};_0x5a3b2d['model']=_[_0x4d78('0x29')](db[_0x4d78('0x23')]['rawAttributes']);_0x5a3b2d[_0x4d78('0x2b')]=_[_0x4d78('0x29')](_0x3f64de['query']);_0x5a3b2d['filters']=_[_0x4d78('0x2a')](_0x5a3b2d[_0x4d78('0x27')],_0x5a3b2d[_0x4d78('0x2b')]);_0x55c823[_0x4d78('0x2c')]=_[_0x4d78('0x2a')](_0x5a3b2d[_0x4d78('0x27')],qs[_0x4d78('0x2d')](_0x3f64de[_0x4d78('0x2b')][_0x4d78('0x2d')]));_0x55c823['attributes']=_0x55c823['attributes']['length']?_0x55c823[_0x4d78('0x2c')]:_0x5a3b2d[_0x4d78('0x27')];if(_0x3f64de[_0x4d78('0x2b')][_0x4d78('0x37')]){_0x55c823['include']=[{'all':!![]}];}_0x55c823=_['merge']({},_0x55c823,_0x3f64de[_0x4d78('0x3d')]);return db[_0x4d78('0x23')]['find'](_0x55c823)[_0x4d78('0x1d')](handleEntityNotFound(_0x5ec882,null))[_0x4d78('0x1d')](respondWithResult(_0x5ec882,null))['catch'](handleError(_0x5ec882,null));};exports['create']=function(_0x437747,_0x1b6ba3){return db[_0x4d78('0x23')][_0x4d78('0x3e')](_0x437747[_0x4d78('0x3f')],{})[_0x4d78('0x1d')](respondWithResult(_0x1b6ba3,0xc9))[_0x4d78('0x3b')](handleError(_0x1b6ba3,null));};exports[_0x4d78('0x1c')]=function(_0x205cd2,_0x5095e6){if(_0x205cd2['body']['id']){delete _0x205cd2['body']['id'];}return db[_0x4d78('0x23')]['find']({'where':{'id':_0x205cd2['params']['id']}})[_0x4d78('0x1d')](handleEntityNotFound(_0x5095e6,null))['then'](saveUpdates(_0x205cd2[_0x4d78('0x3f')],null))['then'](respondWithResult(_0x5095e6,null))[_0x4d78('0x3b')](handleError(_0x5095e6,null));};exports['destroy']=function(_0x6770e9,_0x23b9c7){return db['VoiceQueuesLog'][_0x4d78('0x40')]({'where':{'id':_0x6770e9[_0x4d78('0x41')]['id']}})[_0x4d78('0x1d')](handleEntityNotFound(_0x23b9c7,null))[_0x4d78('0x1d')](removeEntity(_0x23b9c7,null))[_0x4d78('0x3b')](handleError(_0x23b9c7,null));}; \ No newline at end of file +var _0xe75a=['sort','pick','filter','where','VIRTUAL','name','merge','options','includeAll','include','findAll','rows','catch','show','fields','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','stack','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','hasOwnProperty','order'];(function(_0x387f50,_0x42c20e){var _0x5c360a=function(_0x444e80){while(--_0x444e80){_0x387f50['push'](_0x387f50['shift']());}};_0x5c360a(++_0x42c20e);}(_0xe75a,0x1e7));var _0xae75=function(_0xe89d97,_0x33e5ac){_0xe89d97=_0xe89d97-0x0;var _0x1b6e5d=_0xe75a[_0xe89d97];return _0x1b6e5d;};'use strict';var emlformat=require(_0xae75('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xae75('0x1'));var jsonpatch=require(_0xae75('0x2'));var rp=require(_0xae75('0x3'));var moment=require(_0xae75('0x4'));var BPromise=require(_0xae75('0x5'));var Mustache=require(_0xae75('0x6'));var util=require(_0xae75('0x7'));var path=require('path');var sox=require(_0xae75('0x8'));var csv=require(_0xae75('0x9'));var ejs=require(_0xae75('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae75('0xb'));var squel=require(_0xae75('0xc'));var crypto=require(_0xae75('0xd'));var jsforce=require(_0xae75('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xae75('0x9'));var querystring=require(_0xae75('0xf'));var Papa=require(_0xae75('0x10'));var Redis=require(_0xae75('0x11'));var authService=require(_0xae75('0x12'));var qs=require(_0xae75('0x13'));var as=require(_0xae75('0x14'));var hardwareService=require(_0xae75('0x15'));var logger=require(_0xae75('0x16'))(_0xae75('0x17'));var utils=require(_0xae75('0x18'));var config=require(_0xae75('0x19'));var licenseUtil=require(_0xae75('0x1a'));var db=require(_0xae75('0x1b'))['db'];function respondWithStatusCode(_0xef6d44,_0x33bd43){_0x33bd43=_0x33bd43||0xcc;return function(_0xae359d){if(_0xae359d){return _0xef6d44[_0xae75('0x1c')](_0x33bd43);}return _0xef6d44[_0xae75('0x1d')](_0x33bd43)['end']();};}function respondWithResult(_0x3c0452,_0x18ad72){_0x18ad72=_0x18ad72||0xc8;return function(_0x45e5c7){if(_0x45e5c7){return _0x3c0452[_0xae75('0x1d')](_0x18ad72)[_0xae75('0x1e')](_0x45e5c7);}};}function respondWithFilteredResult(_0x43e4d4,_0x14ed54){return function(_0x14dfc1){if(_0x14dfc1){var _0x1580bc=typeof _0x14ed54[_0xae75('0x1f')]==='undefined'&&typeof _0x14ed54[_0xae75('0x20')]===_0xae75('0x21');var _0x4d0c03=_0x14dfc1['count'];var _0x44881d=_0x1580bc?0x0:_0x14ed54[_0xae75('0x1f')];var _0x1b1665=_0x1580bc?_0x14dfc1[_0xae75('0x22')]:_0x14ed54[_0xae75('0x1f')]+_0x14ed54['limit'];var _0x2123ce;if(_0x1b1665>=_0x4d0c03){_0x1b1665=_0x4d0c03;_0x2123ce=0xc8;}else{_0x2123ce=0xce;}_0x43e4d4[_0xae75('0x1d')](_0x2123ce);return _0x43e4d4[_0xae75('0x23')](_0xae75('0x24'),_0x44881d+'-'+_0x1b1665+'/'+_0x4d0c03)[_0xae75('0x1e')](_0x14dfc1);}return null;};}function patchUpdates(_0x5d8315){return function(_0x34baae){try{jsonpatch[_0xae75('0x25')](_0x34baae,_0x5d8315,!![]);}catch(_0x27fd7a){return BPromise['reject'](_0x27fd7a);}return _0x34baae[_0xae75('0x26')]();};}function saveUpdates(_0x3c6abf,_0x1f5a67){return function(_0x33008e){if(_0x33008e){return _0x33008e[_0xae75('0x27')](_0x3c6abf)[_0xae75('0x28')](function(_0x3b46c5){return _0x3b46c5;});}return null;};}function removeEntity(_0xe78fce,_0x54dba9){return function(_0x1f394d){if(_0x1f394d){return _0x1f394d[_0xae75('0x29')]()[_0xae75('0x28')](function(){_0xe78fce['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4230b9,_0x4352d7){return function(_0x2b3a3e){if(!_0x2b3a3e){_0x4230b9['sendStatus'](0x194);}return _0x2b3a3e;};}function handleError(_0x3b6785,_0x3067a7){_0x3067a7=_0x3067a7||0x1f4;return function(_0x3f6a7d){logger['error'](_0x3f6a7d[_0xae75('0x2a')]);if(_0x3f6a7d['name']){delete _0x3f6a7d['name'];}_0x3b6785[_0xae75('0x1d')](_0x3067a7)[_0xae75('0x2b')](_0x3f6a7d);};}exports[_0xae75('0x2c')]=function(_0xcda0d,_0x41b380){var _0x58cff8={},_0xf3af38={},_0x269493={'count':0x0,'rows':[]};var _0x331299=_[_0xae75('0x2d')](db[_0xae75('0x2e')][_0xae75('0x2f')],function(_0x9c1db6){return{'name':_0x9c1db6[_0xae75('0x30')],'type':_0x9c1db6[_0xae75('0x31')][_0xae75('0x32')]};});_0xf3af38[_0xae75('0x33')]=_[_0xae75('0x2d')](_0x331299,'name');_0xf3af38['query']=_[_0xae75('0x34')](_0xcda0d['query']);_0xf3af38[_0xae75('0x35')]=_[_0xae75('0x36')](_0xf3af38[_0xae75('0x33')],_0xf3af38[_0xae75('0x37')]);_0x58cff8[_0xae75('0x38')]=_[_0xae75('0x36')](_0xf3af38['model'],qs['fields'](_0xcda0d[_0xae75('0x37')]['fields']));_0x58cff8[_0xae75('0x38')]=_0x58cff8[_0xae75('0x38')]['length']?_0x58cff8['attributes']:_0xf3af38[_0xae75('0x33')];if(!_0xcda0d[_0xae75('0x37')][_0xae75('0x39')]('nolimit')){_0x58cff8[_0xae75('0x20')]=qs[_0xae75('0x20')](_0xcda0d[_0xae75('0x37')][_0xae75('0x20')]);_0x58cff8[_0xae75('0x1f')]=qs[_0xae75('0x1f')](_0xcda0d[_0xae75('0x37')][_0xae75('0x1f')]);}_0x58cff8[_0xae75('0x3a')]=qs[_0xae75('0x3b')](_0xcda0d[_0xae75('0x37')][_0xae75('0x3b')]);_0x58cff8['where']=qs[_0xae75('0x35')](_[_0xae75('0x3c')](_0xcda0d[_0xae75('0x37')],_0xf3af38[_0xae75('0x35')]),_0x331299);if(_0xcda0d[_0xae75('0x37')][_0xae75('0x3d')]){_0x58cff8[_0xae75('0x3e')]=_['merge'](_0x58cff8[_0xae75('0x3e')],{'$or':_[_0xae75('0x2d')](_0x331299,function(_0x359a1a){if(_0x359a1a[_0xae75('0x31')]!==_0xae75('0x3f')){var _0x98fbf4={};_0x98fbf4[_0x359a1a[_0xae75('0x40')]]={'$like':'%'+_0xcda0d['query']['filter']+'%'};return _0x98fbf4;}})});}_0x58cff8=_[_0xae75('0x41')]({},_0x58cff8,_0xcda0d[_0xae75('0x42')]);var _0x3ac0e4={'where':_0x58cff8[_0xae75('0x3e')]};return db[_0xae75('0x2e')][_0xae75('0x22')](_0x3ac0e4)['then'](function(_0x32eeed){_0x269493['count']=_0x32eeed;if(_0xcda0d[_0xae75('0x37')][_0xae75('0x43')]){_0x58cff8[_0xae75('0x44')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xae75('0x45')](_0x58cff8);})[_0xae75('0x28')](function(_0x1213ad){_0x269493[_0xae75('0x46')]=_0x1213ad;return _0x269493;})[_0xae75('0x28')](respondWithFilteredResult(_0x41b380,_0x58cff8))[_0xae75('0x47')](handleError(_0x41b380,null));};exports[_0xae75('0x48')]=function(_0x5e02b9,_0x2b534b){var _0x2cc77b={'raw':!![],'where':{'id':_0x5e02b9['params']['id']}},_0x2de434={};_0x2de434[_0xae75('0x33')]=_['keys'](db[_0xae75('0x2e')][_0xae75('0x2f')]);_0x2de434[_0xae75('0x37')]=_['keys'](_0x5e02b9['query']);_0x2de434[_0xae75('0x35')]=_[_0xae75('0x36')](_0x2de434[_0xae75('0x33')],_0x2de434['query']);_0x2cc77b[_0xae75('0x38')]=_['intersection'](_0x2de434[_0xae75('0x33')],qs[_0xae75('0x49')](_0x5e02b9[_0xae75('0x37')][_0xae75('0x49')]));_0x2cc77b[_0xae75('0x38')]=_0x2cc77b[_0xae75('0x38')]['length']?_0x2cc77b[_0xae75('0x38')]:_0x2de434['model'];if(_0x5e02b9['query'][_0xae75('0x43')]){_0x2cc77b[_0xae75('0x44')]=[{'all':!![]}];}_0x2cc77b=_[_0xae75('0x41')]({},_0x2cc77b,_0x5e02b9['options']);return db[_0xae75('0x2e')][_0xae75('0x4a')](_0x2cc77b)[_0xae75('0x28')](handleEntityNotFound(_0x2b534b,null))['then'](respondWithResult(_0x2b534b,null))[_0xae75('0x47')](handleError(_0x2b534b,null));};exports['create']=function(_0x5f3ed8,_0x339571){return db[_0xae75('0x2e')][_0xae75('0x4b')](_0x5f3ed8['body'],{})['then'](respondWithResult(_0x339571,0xc9))[_0xae75('0x47')](handleError(_0x339571,null));};exports[_0xae75('0x27')]=function(_0x442666,_0x10dc98){if(_0x442666[_0xae75('0x4c')]['id']){delete _0x442666['body']['id'];}return db[_0xae75('0x2e')][_0xae75('0x4a')]({'where':{'id':_0x442666['params']['id']}})['then'](handleEntityNotFound(_0x10dc98,null))['then'](saveUpdates(_0x442666[_0xae75('0x4c')],null))[_0xae75('0x28')](respondWithResult(_0x10dc98,null))[_0xae75('0x47')](handleError(_0x10dc98,null));};exports[_0xae75('0x29')]=function(_0x20045d,_0x5552ea){return db[_0xae75('0x2e')][_0xae75('0x4a')]({'where':{'id':_0x20045d[_0xae75('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5552ea,null))[_0xae75('0x28')](removeEntity(_0x5552ea,null))['catch'](handleError(_0x5552ea,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index f925cde..d798501 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 _0xa5b4=['VoiceQueuesLog','voice_queues_log','event','dtm','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define'];(function(_0x506293,_0x5307f3){var _0x4fe15b=function(_0xeb14bd){while(--_0xeb14bd){_0x506293['push'](_0x506293['shift']());}};_0x4fe15b(++_0x5307f3);}(_0xa5b4,0xf4));var _0x4a5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5b4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x4a5b('0x0'));var logger=require(_0x4a5b('0x1'))(_0x4a5b('0x2'));var moment=require(_0x4a5b('0x3'));var BPromise=require(_0x4a5b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a5b('0x5'));var rimraf=require(_0x4a5b('0x6'));var config=require(_0x4a5b('0x7'));var attributes=require(_0x4a5b('0x8'));module[_0x4a5b('0x9')]=function(_0x2adaf3,_0x38cf80){return _0x2adaf3[_0x4a5b('0xa')](_0x4a5b('0xb'),attributes,{'tableName':_0x4a5b('0xc'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x4a5b('0xd'),_0x4a5b('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xe343=['./voiceQueuesLog.attributes','exports','define','voice_queues_log','event_dtm','event','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x561a34,_0x3c02c6){var _0x29bd3f=function(_0x1eb9b2){while(--_0x1eb9b2){_0x561a34['push'](_0x561a34['shift']());}};_0x29bd3f(++_0x3c02c6);}(_0xe343,0x6e));var _0x3e34=function(_0x412818,_0xe8171a){_0x412818=_0x412818-0x0;var _0x2d40d1=_0xe343[_0x412818];return _0x2d40d1;};'use strict';var _=require(_0x3e34('0x0'));var util=require(_0x3e34('0x1'));var logger=require(_0x3e34('0x2'))('api');var moment=require(_0x3e34('0x3'));var BPromise=require(_0x3e34('0x4'));var rp=require(_0x3e34('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3e34('0x6'));var attributes=require(_0x3e34('0x7'));module[_0x3e34('0x8')]=function(_0x2b0223,_0x418c19){return _0x2b0223[_0x3e34('0x9')]('VoiceQueuesLog',attributes,{'tableName':_0x3e34('0xa'),'paranoid':![],'indexes':[{'name':_0x3e34('0xb'),'fields':[_0x3e34('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 9177d7f..49859b7 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 _0xaf80=['result','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceQueuesLog,\x20%s,\x20%s','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x43dfa5,_0x44d92a){var _0x2d51a3=function(_0x36ed9b){while(--_0x36ed9b){_0x43dfa5['push'](_0x43dfa5['shift']());}};_0x2d51a3(++_0x44d92a);}(_0xaf80,0x1ef));var _0x0af8=function(_0x5809fc,_0xf479fb){_0x5809fc=_0x5809fc-0x0;var _0x5950f3=_0xaf80[_0x5809fc];return _0x5950f3;};'use strict';var _=require(_0x0af8('0x0'));var util=require(_0x0af8('0x1'));var moment=require(_0x0af8('0x2'));var BPromise=require(_0x0af8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0af8('0x4'));var logger=require(_0x0af8('0x5'))(_0x0af8('0x6'));var config=require(_0x0af8('0x7'));var jayson=require(_0x0af8('0x8'));var client=jayson[_0x0af8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bce2c,_0x28f555,_0x538c1c){return new BPromise(function(_0x207a9b,_0x430bd4){return client[_0x0af8('0xa')](_0x4bce2c,_0x538c1c)['then'](function(_0xc0d5eb){logger[_0x0af8('0xb')](_0x0af8('0xc'),_0x28f555,'request\x20sent');logger['debug'](_0x0af8('0xd'),_0x28f555,_0x0af8('0xe'),JSON[_0x0af8('0xf')](_0xc0d5eb));if(_0xc0d5eb[_0x0af8('0x10')]){if(_0xc0d5eb[_0x0af8('0x10')]['code']===0x1f4){logger[_0x0af8('0x10')](_0x0af8('0xc'),_0x28f555,_0xc0d5eb[_0x0af8('0x10')][_0x0af8('0x11')]);return _0x430bd4(_0xc0d5eb[_0x0af8('0x10')][_0x0af8('0x11')]);}logger[_0x0af8('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x28f555,_0xc0d5eb['error'][_0x0af8('0x11')]);return _0x207a9b(_0xc0d5eb[_0x0af8('0x10')][_0x0af8('0x11')]);}else{logger[_0x0af8('0xb')](_0x0af8('0xc'),_0x28f555,_0x0af8('0xe'));_0x207a9b(_0xc0d5eb[_0x0af8('0x12')][_0x0af8('0x11')]);}})['catch'](function(_0x5f4275){logger['error'](_0x0af8('0xc'),_0x28f555,_0x5f4275);_0x430bd4(_0x5f4275);});});} \ No newline at end of file +var _0xc1e8=['rpc','../../config/environment','jayson/promise','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3b2bb5,_0x315f28){var _0x5a7973=function(_0x51c96a){while(--_0x51c96a){_0x3b2bb5['push'](_0x3b2bb5['shift']());}};_0x5a7973(++_0x315f28);}(_0xc1e8,0x87));var _0x8c1e=function(_0x127c7b,_0x1f65e7){_0x127c7b=_0x127c7b-0x0;var _0x1708eb=_0xc1e8[_0x127c7b];return _0x1708eb;};'use strict';var _=require(_0x8c1e('0x0'));var util=require(_0x8c1e('0x1'));var moment=require(_0x8c1e('0x2'));var BPromise=require(_0x8c1e('0x3'));var rs=require(_0x8c1e('0x4'));var fs=require('fs');var Redis=require(_0x8c1e('0x5'));var db=require(_0x8c1e('0x6'))['db'];var utils=require(_0x8c1e('0x7'));var logger=require(_0x8c1e('0x8'))(_0x8c1e('0x9'));var config=require(_0x8c1e('0xa'));var jayson=require(_0x8c1e('0xb'));var client=jayson['client'][_0x8c1e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x310103,_0x2b9f52,_0x5e6d1b){return new BPromise(function(_0x3c120a,_0x3d6703){return client[_0x8c1e('0xd')](_0x310103,_0x5e6d1b)[_0x8c1e('0xe')](function(_0x20ded3){logger['info'](_0x8c1e('0xf'),_0x2b9f52,_0x8c1e('0x10'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x2b9f52,'request\x20sent',JSON[_0x8c1e('0x11')](_0x20ded3));if(_0x20ded3['error']){if(_0x20ded3[_0x8c1e('0x12')][_0x8c1e('0x13')]===0x1f4){logger[_0x8c1e('0x12')](_0x8c1e('0xf'),_0x2b9f52,_0x20ded3[_0x8c1e('0x12')]['message']);return _0x3d6703(_0x20ded3[_0x8c1e('0x12')][_0x8c1e('0x14')]);}logger[_0x8c1e('0x12')](_0x8c1e('0xf'),_0x2b9f52,_0x20ded3[_0x8c1e('0x12')][_0x8c1e('0x14')]);return _0x3c120a(_0x20ded3[_0x8c1e('0x12')][_0x8c1e('0x14')]);}else{logger[_0x8c1e('0x15')](_0x8c1e('0xf'),_0x2b9f52,_0x8c1e('0x10'));_0x3c120a(_0x20ded3[_0x8c1e('0x16')]['message']);}})[_0x8c1e('0x17')](function(_0x1a3497){logger[_0x8c1e('0x12')](_0x8c1e('0xf'),_0x2b9f52,_0x1a3497);_0x3d6703(_0x1a3497);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index e95515c..c35697f 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 _0xd766=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','/:id/download','download','/:id/downloads','downloads','post','create','/:id/transcribe','runTranscribe','put','update'];(function(_0x6c9662,_0x25364d){var _0x201be3=function(_0x320269){while(--_0x320269){_0x6c9662['push'](_0x6c9662['shift']());}};_0x201be3(++_0x25364d);}(_0xd766,0x1df));var _0x6d76=function(_0x305c8f,_0xc5f7fb){_0x305c8f=_0x305c8f-0x0;var _0x5ddc30=_0xd766[_0x305c8f];return _0x5ddc30;};'use strict';var multer=require(_0x6d76('0x0'));var util=require(_0x6d76('0x1'));var path=require(_0x6d76('0x2'));var timeout=require(_0x6d76('0x3'));var express=require(_0x6d76('0x4'));var router=express[_0x6d76('0x5')]();var fs_extra=require(_0x6d76('0x6'));var auth=require(_0x6d76('0x7'));var interaction=require(_0x6d76('0x8'));var config=require(_0x6d76('0x9'));var controller=require('./voiceRecording.controller');router['get']('/',auth[_0x6d76('0xa')](),controller[_0x6d76('0xb')]);router[_0x6d76('0xc')]('/describe',auth[_0x6d76('0xa')](),controller[_0x6d76('0xd')]);router[_0x6d76('0xc')](_0x6d76('0xe'),auth[_0x6d76('0xa')](),controller['show']);router[_0x6d76('0xc')](_0x6d76('0xf'),auth[_0x6d76('0xa')](),controller[_0x6d76('0x10')]);router[_0x6d76('0xc')](_0x6d76('0x11'),controller[_0x6d76('0x12')]);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller['downloadTranscribe']);router[_0x6d76('0x13')]('/',auth[_0x6d76('0xa')](),controller[_0x6d76('0x14')]);router[_0x6d76('0x13')](_0x6d76('0x15'),auth[_0x6d76('0xa')](),controller[_0x6d76('0x16')]);router[_0x6d76('0x17')](_0x6d76('0xe'),auth[_0x6d76('0xa')](),controller[_0x6d76('0x18')]);router[_0x6d76('0x19')]('/:id',auth[_0x6d76('0xa')](),controller[_0x6d76('0x1a')]);module[_0x6d76('0x1b')]=router; \ No newline at end of file +var _0x628f=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update'];(function(_0x3a0b8a,_0x50cb91){var _0x204d8a=function(_0x45fcc9){while(--_0x45fcc9){_0x3a0b8a['push'](_0x3a0b8a['shift']());}};_0x204d8a(++_0x50cb91);}(_0x628f,0xab));var _0xf628=function(_0x14e393,_0x5ef7b3){_0x14e393=_0x14e393-0x0;var _0x5b5ffa=_0x628f[_0x14e393];return _0x5b5ffa;};'use strict';var multer=require(_0xf628('0x0'));var util=require(_0xf628('0x1'));var path=require('path');var timeout=require(_0xf628('0x2'));var express=require(_0xf628('0x3'));var router=express[_0xf628('0x4')]();var fs_extra=require(_0xf628('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf628('0x6'));var controller=require(_0xf628('0x7'));router['get']('/',auth[_0xf628('0x8')](),controller[_0xf628('0x9')]);router[_0xf628('0xa')](_0xf628('0xb'),auth[_0xf628('0x8')](),controller[_0xf628('0xc')]);router[_0xf628('0xa')](_0xf628('0xd'),auth[_0xf628('0x8')](),controller['show']);router[_0xf628('0xa')](_0xf628('0xe'),auth['isAuthenticated'](),controller[_0xf628('0xf')]);router[_0xf628('0xa')](_0xf628('0x10'),controller[_0xf628('0x11')]);router[_0xf628('0xa')](_0xf628('0x12'),auth[_0xf628('0x8')](),controller[_0xf628('0x13')]);router[_0xf628('0x14')]('/',auth[_0xf628('0x8')](),controller[_0xf628('0x15')]);router[_0xf628('0x14')](_0xf628('0x12'),auth[_0xf628('0x8')](),controller[_0xf628('0x16')]);router[_0xf628('0x17')](_0xf628('0xd'),auth['isAuthenticated'](),controller[_0xf628('0x18')]);router[_0xf628('0x19')](_0xf628('0xd'),auth[_0xf628('0x8')](),controller[_0xf628('0x1a')]);module[_0xf628('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 9d88169..bc4662f 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(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 7d7d8e9..494b96c 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 _0xcbdb=['info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeRegion','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','update','then','destroy','stack','name','index','map','fieldName','type','key','model','differenceBy','format','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','VoiceRecording','findAll','show','params','rawAttributes','find','body','catch','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','unlink','message','send','Not\x20found','sequelize','col','token','$and','push','ValidationError','filename','extname','isNil','Entity\x20not\x20found'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xcbdb,0xcb));var _0xbcbd=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xcbdb[_0x397cfb];return _0x15fed9;};'use strict';var emlformat=require(_0xbcbd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbcbd('0x1'));var jsonpatch=require(_0xbcbd('0x2'));var rp=require(_0xbcbd('0x3'));var moment=require(_0xbcbd('0x4'));var BPromise=require(_0xbcbd('0x5'));var Mustache=require(_0xbcbd('0x6'));var util=require(_0xbcbd('0x7'));var path=require(_0xbcbd('0x8'));var sox=require(_0xbcbd('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbcbd('0xa'));var _=require(_0xbcbd('0xb'));var squel=require(_0xbcbd('0xc'));var crypto=require(_0xbcbd('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbcbd('0xe'));var toCsv=require(_0xbcbd('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var AWS=require(_0xbcbd('0x10'));var uuidv4=require(_0xbcbd('0x11'));var Redis=require(_0xbcbd('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xbcbd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbcbd('0x14'));var logger=require(_0xbcbd('0x15'))(_0xbcbd('0x16'));var utils=require(_0xbcbd('0x17'));var config=require(_0xbcbd('0x18'));var licenseUtil=require(_0xbcbd('0x19'));var db=require(_0xbcbd('0x1a'))['db'];function respondWithStatusCode(_0x4a873e,_0x53ab1d){_0x53ab1d=_0x53ab1d||0xcc;return function(_0xbfd41a){if(_0xbfd41a){return _0x4a873e[_0xbcbd('0x1b')](_0x53ab1d);}return _0x4a873e['status'](_0x53ab1d)[_0xbcbd('0x1c')]();};}function respondWithResult(_0x31107e,_0x48a094){_0x48a094=_0x48a094||0xc8;return function(_0x4d8d5b){if(_0x4d8d5b){return _0x31107e['status'](_0x48a094)[_0xbcbd('0x1d')](_0x4d8d5b);}};}function respondWithFilteredResult(_0x318cc7,_0x28f7ab){return function(_0x584e59){if(_0x584e59){var _0x3202ca=typeof _0x28f7ab[_0xbcbd('0x1e')]===_0xbcbd('0x1f')&&typeof _0x28f7ab[_0xbcbd('0x20')]===_0xbcbd('0x1f');var _0x409d0d=_0x584e59['count'];var _0x58b67c=_0x3202ca?0x0:_0x28f7ab[_0xbcbd('0x1e')];var _0x561859=_0x3202ca?_0x584e59[_0xbcbd('0x21')]:_0x28f7ab[_0xbcbd('0x1e')]+_0x28f7ab[_0xbcbd('0x20')];var _0x22aef4;if(_0x561859>=_0x409d0d){_0x561859=_0x409d0d;_0x22aef4=0xc8;}else{_0x22aef4=0xce;}_0x318cc7[_0xbcbd('0x22')](_0x22aef4);return _0x318cc7[_0xbcbd('0x23')]('Content-Range',_0x58b67c+'-'+_0x561859+'/'+_0x409d0d)[_0xbcbd('0x1d')](_0x584e59);}return null;};}function patchUpdates(_0x1f8459){return function(_0x5e9d0f){try{jsonpatch[_0xbcbd('0x24')](_0x5e9d0f,_0x1f8459,!![]);}catch(_0x360de5){return BPromise[_0xbcbd('0x25')](_0x360de5);}return _0x5e9d0f['save']();};}function saveUpdates(_0x21fc5e,_0x3fca8f){return function(_0x1eea3b){if(_0x1eea3b){return _0x1eea3b[_0xbcbd('0x26')](_0x21fc5e)[_0xbcbd('0x27')](function(_0x699747){return _0x699747;});}return null;};}function removeEntity(_0x5f4b32,_0x45cea3){return function(_0x2f0221){if(_0x2f0221){return _0x2f0221[_0xbcbd('0x28')]()['then'](function(){_0x5f4b32[_0xbcbd('0x22')](0xcc)[_0xbcbd('0x1c')]();});}};}function handleEntityNotFound(_0x149fb0,_0x4601bb){return function(_0x4b85ec){if(!_0x4b85ec){_0x149fb0[_0xbcbd('0x1b')](0x194);}return _0x4b85ec;};}function handleError(_0x18832b,_0x724182){_0x724182=_0x724182||0x1f4;return function(_0x5a2b66){logger['error'](_0x5a2b66[_0xbcbd('0x29')]);if(_0x5a2b66[_0xbcbd('0x2a')]){delete _0x5a2b66[_0xbcbd('0x2a')];}_0x18832b[_0xbcbd('0x22')](_0x724182)['send'](_0x5a2b66);};}exports[_0xbcbd('0x2b')]=function(_0x4ec65e,_0x551a3a){var _0x2dd7d4={},_0x4b7b4b={},_0xe7fa25={'count':0x0,'rows':[]};var _0xd2787e=_[_0xbcbd('0x2c')](db['VoiceRecording']['rawAttributes'],function(_0x3a55a7){return{'name':_0x3a55a7[_0xbcbd('0x2d')],'type':_0x3a55a7[_0xbcbd('0x2e')][_0xbcbd('0x2f')]};});_0x4b7b4b[_0xbcbd('0x30')]=_[_0xbcbd('0x31')](_[_0xbcbd('0x2c')](_0xd2787e,_0xbcbd('0x2a')),[_0xbcbd('0x32')]);_0x4b7b4b['query']=_[_0xbcbd('0x33')](_0x4ec65e[_0xbcbd('0x34')]);_0x4b7b4b[_0xbcbd('0x35')]=_[_0xbcbd('0x36')](_0x4b7b4b[_0xbcbd('0x30')],_0x4b7b4b['query']);_0x2dd7d4[_0xbcbd('0x37')]=_['intersection'](_0x4b7b4b[_0xbcbd('0x30')],qs[_0xbcbd('0x38')](_0x4ec65e['query'][_0xbcbd('0x38')]));_0x2dd7d4[_0xbcbd('0x37')]=_0x2dd7d4[_0xbcbd('0x37')]['length']?_0x2dd7d4[_0xbcbd('0x37')]:_0x4b7b4b['model'];if(!_0x4ec65e[_0xbcbd('0x34')][_0xbcbd('0x39')](_0xbcbd('0x3a'))){_0x2dd7d4[_0xbcbd('0x20')]=qs['limit'](_0x4ec65e[_0xbcbd('0x34')][_0xbcbd('0x20')]);_0x2dd7d4[_0xbcbd('0x1e')]=qs[_0xbcbd('0x1e')](_0x4ec65e[_0xbcbd('0x34')][_0xbcbd('0x1e')]);}_0x2dd7d4[_0xbcbd('0x3b')]=qs[_0xbcbd('0x3c')](_0x4ec65e[_0xbcbd('0x34')][_0xbcbd('0x3c')]);_0x2dd7d4['where']=qs[_0xbcbd('0x35')](_['pick'](_0x4ec65e[_0xbcbd('0x34')],_0x4b7b4b[_0xbcbd('0x35')]),_0xd2787e);if(_0x4ec65e[_0xbcbd('0x34')][_0xbcbd('0x3d')]){_0x2dd7d4[_0xbcbd('0x3e')]=_[_0xbcbd('0x3f')](_0x2dd7d4['where'],{'$or':_['map'](_0xd2787e,function(_0x38f18e){if(_0x38f18e['type']!==_0xbcbd('0x40')){var _0x242ecf={};_0x242ecf[_0x38f18e[_0xbcbd('0x2a')]]={'$like':'%'+_0x4ec65e[_0xbcbd('0x34')]['filter']+'%'};return _0x242ecf;}})});}_0x2dd7d4=_[_0xbcbd('0x3f')]({},_0x2dd7d4,_0x4ec65e[_0xbcbd('0x41')]);var _0x1d1c21={'where':_0x2dd7d4[_0xbcbd('0x3e')]};return db['VoiceRecording'][_0xbcbd('0x21')](_0x1d1c21)['then'](function(_0x430705){_0xe7fa25[_0xbcbd('0x21')]=_0x430705;if(_0x4ec65e['query'][_0xbcbd('0x42')]){_0x2dd7d4[_0xbcbd('0x43')]=[{'all':!![]}];}return db[_0xbcbd('0x44')][_0xbcbd('0x45')](_0x2dd7d4);})[_0xbcbd('0x27')](function(_0x112b16){_0xe7fa25['rows']=_0x112b16;return _0xe7fa25;})[_0xbcbd('0x27')](respondWithFilteredResult(_0x551a3a,_0x2dd7d4))['catch'](handleError(_0x551a3a,null));};exports[_0xbcbd('0x46')]=function(_0x570109,_0x3fc446){var _0x4e716b={'raw':![],'where':{'id':_0x570109[_0xbcbd('0x47')]['id']}},_0x231ce7={};_0x231ce7[_0xbcbd('0x30')]=_['keys'](db[_0xbcbd('0x44')][_0xbcbd('0x48')]);_0x231ce7['query']=_[_0xbcbd('0x33')](_0x570109['query']);_0x231ce7[_0xbcbd('0x35')]=_[_0xbcbd('0x36')](_0x231ce7[_0xbcbd('0x30')],_0x231ce7[_0xbcbd('0x34')]);_0x4e716b[_0xbcbd('0x37')]=_[_0xbcbd('0x36')](_0x231ce7[_0xbcbd('0x30')],qs[_0xbcbd('0x38')](_0x570109[_0xbcbd('0x34')][_0xbcbd('0x38')]));_0x4e716b['attributes']=_0x4e716b[_0xbcbd('0x37')]['length']?_0x4e716b['attributes']:_0x231ce7['model'];if(_0x570109[_0xbcbd('0x34')][_0xbcbd('0x42')]){_0x4e716b[_0xbcbd('0x43')]=[{'all':!![]}];}_0x4e716b=_[_0xbcbd('0x3f')]({},_0x4e716b,_0x570109[_0xbcbd('0x41')]);return db[_0xbcbd('0x44')][_0xbcbd('0x49')](_0x4e716b)['then'](handleEntityNotFound(_0x3fc446,null))['then'](respondWithResult(_0x3fc446,null))['catch'](handleError(_0x3fc446,null));};exports['create']=function(_0x3c0da6,_0x1262fc){return db[_0xbcbd('0x44')]['create'](_0x3c0da6[_0xbcbd('0x4a')],{})['then'](respondWithResult(_0x1262fc,0xc9))[_0xbcbd('0x4b')](handleError(_0x1262fc,null));};exports[_0xbcbd('0x26')]=function(_0x56fee9,_0x122de2){if(_0x56fee9[_0xbcbd('0x4a')]['id']){delete _0x56fee9[_0xbcbd('0x4a')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x56fee9[_0xbcbd('0x47')]['id']}})[_0xbcbd('0x27')](handleEntityNotFound(_0x122de2,null))['then'](saveUpdates(_0x56fee9['body'],null))[_0xbcbd('0x27')](respondWithResult(_0x122de2,null))[_0xbcbd('0x4b')](handleError(_0x122de2,null));};exports[_0xbcbd('0x4c')]=function(_0xfd2694,_0x18450c){return db[_0xbcbd('0x44')][_0xbcbd('0x4c')]()[_0xbcbd('0x27')](respondWithResult(_0x18450c,null))['catch'](handleError(_0x18450c,null));};exports[_0xbcbd('0x4d')]=function(_0x5172b1,_0x1c4b14,_0xe880ef){var _0x160d44=require(_0xbcbd('0x4e'));var _0xa1e6de=![];var _0x374307={};if(_0x5172b1[_0xbcbd('0x34')]['type']&&_0x5172b1[_0xbcbd('0x34')][_0xbcbd('0x2e')]===_0xbcbd('0x4f')){_0x374307[_0xbcbd('0x4f')]=_0x5172b1[_0xbcbd('0x47')]['id'];}else{_0x374307['id']=_0x5172b1[_0xbcbd('0x47')]['id'];}return db[_0xbcbd('0x44')][_0xbcbd('0x49')]({'where':_0x374307,'attributes':['id','value'],'raw':!![]})[_0xbcbd('0x27')](handleEntityNotFound(_0x1c4b14,null))[_0xbcbd('0x27')](function(_0xbb0358){if(_0xbb0358){var _0x5df6ba=_0xbb0358[_0xbcbd('0x50')];var _0x5af454=util[_0xbcbd('0x32')]('%s.cypher',_0x5df6ba);if(fs[_0xbcbd('0x51')](_0x5af454)){_0xa1e6de=!![];return _0x160d44[_0xbcbd('0x52')](_0x5af454,_0x5df6ba,config[_0xbcbd('0x53')][_0xbcbd('0x54')])[_0xbcbd('0x27')](function(){return _0xbb0358;});}return _0xbb0358;}})['then'](function(_0x50e83b){if(_0x50e83b){var _0x202395=_0x50e83b[_0xbcbd('0x50')];if(!fs['existsSync'](_0x202395)){throw new db[(_0xbcbd('0x55'))]['ValidationError'](_0xbcbd('0x56'));}if(_0x50e83b['filename']){return _0x1c4b14[_0xbcbd('0x4d')](_0x202395,_0x50e83b['filename']+path['extname'](_0x202395),function(){if(_0xa1e6de){fs[_0xbcbd('0x57')](_0x202395);}});}else{return _0x1c4b14[_0xbcbd('0x4d')](_0x202395,function(_0x4f4cab){if(_0xa1e6de){fs['unlink'](_0x202395);}});}}})['catch'](function(_0x5e2be1){if(_0x5e2be1[_0xbcbd('0x58')]==='VoiceRecording\x20not\x20found'){_0x1c4b14[_0xbcbd('0x22')](0x194)[_0xbcbd('0x59')](_0xbcbd('0x5a'));}else{return handleError(_0x1c4b14,null);}});};exports['downloads']=function(_0x49ed4a,_0x28acd1,_0x59eaa5){var _0x165e01=require(_0xbcbd('0x4e'));var _0x5b011a=![];var _0x382f2d={'$and':[db[_0xbcbd('0x5b')]['where'](db[_0xbcbd('0x5b')]['fn']('MD5',db[_0xbcbd('0x5b')][_0xbcbd('0x5c')](_0xbcbd('0x4f'))),_0x49ed4a[_0xbcbd('0x34')][_0xbcbd('0x5d')])]};if(_0x49ed4a[_0xbcbd('0x34')]['type']&&_0x49ed4a[_0xbcbd('0x34')][_0xbcbd('0x2e')]===_0xbcbd('0x4f')){_0x382f2d[_0xbcbd('0x5e')]['push']({'uniqueid':_0x49ed4a[_0xbcbd('0x47')]['id']});}else{_0x382f2d['$and'][_0xbcbd('0x5f')]({'id':_0x49ed4a['params']['id']});}return db['VoiceRecording'][_0xbcbd('0x49')]({'where':_0x382f2d,'attributes':['id','value'],'raw':!![]})[_0xbcbd('0x27')](handleEntityNotFound(_0x28acd1,null))['then'](function(_0x3b5b55){if(_0x3b5b55){var _0x5316b1=util[_0xbcbd('0x32')]('%s.cypher',_0x3b5b55[_0xbcbd('0x50')]);if(fs['existsSync'](_0x5316b1)){_0x5b011a=!![];return _0x165e01['decryptFile'](_0x5316b1,_0x3b5b55[_0xbcbd('0x50')],config[_0xbcbd('0x53')][_0xbcbd('0x54')])[_0xbcbd('0x27')](function(){return _0x3b5b55;});}return _0x3b5b55;}})[_0xbcbd('0x27')](function(_0x44b022){if(_0x44b022){if(!fs[_0xbcbd('0x51')](_0x44b022['value'])){throw new db[(_0xbcbd('0x55'))][(_0xbcbd('0x60'))]('VoiceRecording\x20not\x20found');}if(_0x44b022[_0xbcbd('0x61')]){return _0x28acd1[_0xbcbd('0x4d')](_0x44b022[_0xbcbd('0x50')],_0x44b022[_0xbcbd('0x61')]+path[_0xbcbd('0x62')](_0x44b022[_0xbcbd('0x50')]),function(){if(_0x5b011a){fs['unlink'](_0x44b022[_0xbcbd('0x50')]);}});}else{return _0x28acd1[_0xbcbd('0x4d')](_0x44b022[_0xbcbd('0x50')],function(_0x451161){if(_0x5b011a){fs[_0xbcbd('0x57')](_0x44b022[_0xbcbd('0x50')]);}});}}})['catch'](handleError(_0x28acd1,null));};exports[_0xbcbd('0x28')]=function(_0x22f425,_0x462c32){return db['VoiceRecording'][_0xbcbd('0x49')]({'where':{'id':_0x22f425[_0xbcbd('0x47')]['id']}})['then'](function(_0x32b6e7){if(_[_0xbcbd('0x63')](_0x32b6e7)){throw new ReferenceError(_0xbcbd('0x64'));}return _0x32b6e7;})[_0xbcbd('0x27')](function(_0x381eb2){var _0x4c5565=_0x381eb2[_0xbcbd('0x50')];logger[_0xbcbd('0x65')](_0xbcbd('0x66'),_0x4c5565);if(!_[_0xbcbd('0x63')](_0x381eb2[_0xbcbd('0x50')])&&fs[_0xbcbd('0x51')](_0x4c5565)){logger[_0xbcbd('0x65')](_0xbcbd('0x67')+_0x4c5565+_0xbcbd('0x68'));fs[_0xbcbd('0x69')](_0x4c5565);}_0x4c5565=_0x4c5565+_0xbcbd('0x6a');if(!_['isNil'](_0x381eb2[_0xbcbd('0x50')])&&fs[_0xbcbd('0x51')](_0x4c5565)){logger[_0xbcbd('0x65')](_0xbcbd('0x67')+_0x4c5565+_0xbcbd('0x68'));fs[_0xbcbd('0x69')](_0x4c5565);}return _0x381eb2;})['then'](function(_0x163f0d){if(!_0x163f0d)throw new InternalError();return _0x163f0d[_0xbcbd('0x28')]();})['then'](function(){_0x462c32[_0xbcbd('0x22')](0xcc)[_0xbcbd('0x1c')]();})[_0xbcbd('0x4b')](handleError(_0x462c32,null));};function getBucketslist(_0x10dfbf,_0x2a881c,_0x16b55e){return new Promise(function(_0x4101a9,_0xd216e6){var _0x4c3494=new AWS['S3']({'accessKeyId':_0x2a881c,'secretAccessKey':_0x10dfbf,'region':_0x16b55e});_0x4c3494[_0xbcbd('0x6b')]({},function(_0x41d75d,_0x5ee2f6){if(_0x41d75d){return _0xd216e6(_0x41d75d);}else{return _0x4101a9(_0x5ee2f6);}});});}function createBucket(_0x5e7e26,_0x170512,_0x4f79b1,_0x11bcdd){return new Promise(function(_0x1153b0,_0x11dd71){var _0x31748d=new AWS['S3']({'accessKeyId':_0x170512,'secretAccessKey':_0x5e7e26,'region':_0x4f79b1});_0x31748d['createBucket']({'Bucket':_0x11bcdd},function(_0x9d45d9,_0x1cd169){if(_0x9d45d9){return _0x11dd71(_0x9d45d9);}else{return _0x1153b0(_0x1cd169);}});});}function uploadFile(_0x2b98ab,_0x14ccfc,_0x45e948,_0x43ac0e,_0x29fd74,_0x474102){return new Promise(function(_0x2ae2e6,_0x1be128){var _0x1b00eb=new AWS['S3']({'accessKeyId':_0x14ccfc,'secretAccessKey':_0x2b98ab,'region':_0x45e948});_0x1b00eb[_0xbcbd('0x6c')]({'Bucket':_0x43ac0e,'Key':_0x29fd74,'Body':_0x474102},function(_0xd642a5,_0x17202e){if(_0xd642a5){return _0x1be128(_0xd642a5);}else{return _0x2ae2e6(_0x17202e);}});});}function startTranscribe(_0x53adea,_0x4140e3,_0x4700eb,_0x15805e,_0x1319aa,_0x203704){return new Promise(function(_0x19bd66,_0x220b92){var _0x1d25e8=new AWS[(_0xbcbd('0x6d'))]({'accessKeyId':_0x4140e3,'secretAccessKey':_0x53adea,'region':_0x4700eb});_0x1d25e8['startTranscriptionJob']({'TranscriptionJobName':_0x15805e,'LanguageCode':_0x1319aa,'Media':{'MediaFileUri':_0x203704}},function(_0x230320,_0x5e11b){if(_0x230320){return _0x220b92(_0x230320);}else{return _0x19bd66(_0x5e11b);}});});}function transcribe(_0x5a9784,_0x76afea,_0x46d753,_0x3e7694,_0x3ed7e1,_0x19a8a0,_0x3432eb){return new Promise(function(_0x262abd,_0x2eb1cf){var _0xc4959b={};logger[_0xbcbd('0x65')](util[_0xbcbd('0x32')](_0xbcbd('0x6e'),_0x5a9784,_0x3ed7e1));return uploadFile(_0x76afea,_0x46d753,_0x3e7694,_0x3ed7e1,path[_0xbcbd('0x6f')](_0x19a8a0),fs[_0xbcbd('0x70')](_0x19a8a0))[_0xbcbd('0x27')](function(_0x3a8da2){logger[_0xbcbd('0x65')](util[_0xbcbd('0x32')](_0xbcbd('0x71'),_0x5a9784,_0x3ed7e1,_0x3a8da2['Location']));_0xc4959b[_0xbcbd('0x72')]=_0x3a8da2[_0xbcbd('0x73')];_0xc4959b[_0xbcbd('0x74')]=_0x3a8da2[_0xbcbd('0x75')];logger[_0xbcbd('0x65')](util[_0xbcbd('0x32')](_0xbcbd('0x76'),_0x5a9784));return startTranscribe(_0x76afea,_0x46d753,_0x3e7694,uuidv4(),_0x3432eb,_0x3a8da2[_0xbcbd('0x75')]);})[_0xbcbd('0x27')](function(_0x490974){logger[_0xbcbd('0x65')](util[_0xbcbd('0x32')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x5a9784,_0x490974[_0xbcbd('0x77')][_0xbcbd('0x78')]));_0xc4959b[_0xbcbd('0x79')]=_0x490974['TranscriptionJob'][_0xbcbd('0x78')];_0xc4959b[_0xbcbd('0x7a')]=_0x490974[_0xbcbd('0x77')][_0xbcbd('0x7b')];return _0x262abd(_0xc4959b);})[_0xbcbd('0x4b')](function(_0x41e488){return _0x2eb1cf(_0x41e488);});});}exports[_0xbcbd('0x7c')]=function(_0x23ae5e,_0x11de66,_0x3a3bf1){var _0x50e254;var _0x4417b1;var _0x34b595;var _0x41a6b3=require(_0xbcbd('0x4e'));return db['VoiceRecording'][_0xbcbd('0x7d')]({'where':{'id':_0x23ae5e[_0xbcbd('0x47')]['id']}})[_0xbcbd('0x27')](function(_0x48b99b){if(_0x48b99b){var _0x1cd13d=util['format']('%s.cypher',_0x48b99b['value']);if(fs['existsSync'](_0x1cd13d)){cypher=!![];return _0x41a6b3[_0xbcbd('0x52')](_0x1cd13d,_0x48b99b[_0xbcbd('0x50')],config[_0xbcbd('0x53')]['recording'])[_0xbcbd('0x27')](function(){return _0x48b99b;});}return _0x48b99b;}})[_0xbcbd('0x27')](function(_0x403ce9){if(!_0x403ce9){throw new db[(_0xbcbd('0x55'))]['ValidationError'](_0xbcbd('0x7e'));}_0x4417b1=_0x403ce9;return db[_0xbcbd('0x7f')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x11de66,null))['then'](function(_0xe20662){if(_0xe20662){_0x50e254=_0xe20662;if(!_0x50e254[_0xbcbd('0x80')]||!_0x50e254['transcribeAccountId']||!_0x50e254[_0xbcbd('0x81')]||!_0x50e254['language']||!_0x50e254[_0xbcbd('0x72')]){throw new db[(_0xbcbd('0x55'))]['ValidationError'](_0xbcbd('0x82'));}if(_0x23ae5e['body']['runSentiment']&&(!_0x50e254[_0xbcbd('0x83')]||!_0x50e254[_0xbcbd('0x84')]||!_0x50e254['sentimentRegion']||!_0x50e254[_0xbcbd('0x85')]||!_0x50e254[_0xbcbd('0x72')])){throw new db[(_0xbcbd('0x55'))][(_0xbcbd('0x60'))](_0xbcbd('0x86'));}return db[_0xbcbd('0x87')]['findOne']({'where':{'id':_0x50e254[_0xbcbd('0x88')]}});}})[_0xbcbd('0x27')](function(_0x5d574e){if(!_0x5d574e){throw new db[(_0xbcbd('0x55'))][(_0xbcbd('0x60'))](_0xbcbd('0x89'));}if(!_0x5d574e[_0xbcbd('0x8a')]||!_0x5d574e[_0xbcbd('0x8b')]){throw new db[(_0xbcbd('0x55'))]['ValidationError'](_0xbcbd('0x8c'));}_0x34b595=_0x5d574e;return getBucketslist(_0x34b595['data1'],_0x34b595[_0xbcbd('0x8b')],_0x50e254[_0xbcbd('0x81')]);})['then'](function(_0x5a1036){if(_0x5a1036&&_0x5a1036['Buckets']){var _0x2e1827=_[_0xbcbd('0x49')](_0x5a1036[_0xbcbd('0x8d')],function(_0x17bb81){return _0x17bb81[_0xbcbd('0x8e')]===_0x50e254[_0xbcbd('0x72')];});if(!_0x2e1827){logger[_0xbcbd('0x65')](util['format'](_0xbcbd('0x8f'),_0x23ae5e[_0xbcbd('0x47')]['id'],_0x50e254[_0xbcbd('0x72')]));return createBucket(_0x34b595['data1'],_0x34b595[_0xbcbd('0x8b')],_0x50e254[_0xbcbd('0x81')],_0x50e254[_0xbcbd('0x72')]);}logger[_0xbcbd('0x65')](util[_0xbcbd('0x32')](_0xbcbd('0x90'),_0x23ae5e[_0xbcbd('0x47')]['id'],_0x50e254[_0xbcbd('0x72')]));return;}})[_0xbcbd('0x27')](function(_0x303697){if(_0x4417b1['transcribeStatus']===_0xbcbd('0x91')){return transcribe(_0x23ae5e['params']['id'],_0x34b595[_0xbcbd('0x8a')],_0x34b595['data2'],_0x50e254[_0xbcbd('0x81')],_0x50e254['bucket'],_0x4417b1[_0xbcbd('0x50')],_0x50e254['language']);}else{logger['info'](util[_0xbcbd('0x32')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x23ae5e[_0xbcbd('0x47')]['id']));return{'transcribeStatus':_0xbcbd('0x92')};}})[_0xbcbd('0x27')](function(_0x2e88e3){if(_0x2e88e3){_0x2e88e3['tempSentiment']=_0x23ae5e[_0xbcbd('0x4a')]['runSentiment'];return _0x4417b1['updateAttributes'](_0x2e88e3);}})['then'](respondWithResult(_0x11de66,null))[_0xbcbd('0x4b')](handleError(_0x11de66,null));};function writeFile(_0x291c0c,_0x52a60c){return new Promise(function(_0x30e564,_0x24f520){fs[_0xbcbd('0x93')](_0x52a60c,_0x291c0c,function(_0x186a16,_0x52d9a6){if(_0x186a16){return _0x24f520(_0x186a16);}else{return _0x30e564(_0x52d9a6);}});});}exports['downloadTranscribe']=function(_0x5ea16,_0x5a727a,_0x1273cf){return db['VoiceRecording'][_0xbcbd('0x7d')]({'where':{'id':_0x5ea16[_0xbcbd('0x47')]['id']}})['then'](handleEntityNotFound(_0x5a727a))[_0xbcbd('0x27')](function(_0x5573b4){if(_0x5573b4&&_0x5573b4[_0xbcbd('0x94')]){var _0xabcae0=_0x5573b4[_0xbcbd('0x94')];var _0x48a8f7=config[_0xbcbd('0x95')]+_0xbcbd('0x96')+_0x5573b4['id']+_0xbcbd('0x97');if(fs['existsSync'](_0x48a8f7)){return _0x48a8f7;}return writeFile(_0xabcae0,_0x48a8f7)[_0xbcbd('0x27')](function(){return _0x48a8f7;});}else{throw new db[(_0xbcbd('0x55'))][(_0xbcbd('0x60'))]('Transcript\x20not\x20available');}})[_0xbcbd('0x27')](function(_0xaca564){return _0x5a727a['download'](_0xaca564);})[_0xbcbd('0x4b')](handleError(_0x5a727a));}; \ No newline at end of file +var _0x9485=['sentiment','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','../../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','Content-Range','reject','save','update','then','destroy','error','stack','send','index','map','VoiceRecording','rawAttributes','type','key','model','name','format','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','include','catch','params','create','body','describe','download','../../components/encryptor','uniqueid','find','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','sequelize','col','push','$and','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJob','TranscriptionJobStatus','runTranscribe','ValidationError','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured'];(function(_0x573b67,_0x40bada){var _0x53a235=function(_0x57c7ad){while(--_0x57c7ad){_0x573b67['push'](_0x573b67['shift']());}};_0x53a235(++_0x40bada);}(_0x9485,0x1d7));var _0x5948=function(_0x43c742,_0x130c38){_0x43c742=_0x43c742-0x0;var _0x3159cf=_0x9485[_0x43c742];return _0x3159cf;};'use strict';var emlformat=require(_0x5948('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5948('0x1'));var jsonpatch=require(_0x5948('0x2'));var rp=require(_0x5948('0x3'));var moment=require(_0x5948('0x4'));var BPromise=require(_0x5948('0x5'));var Mustache=require(_0x5948('0x6'));var util=require('util');var path=require(_0x5948('0x7'));var sox=require(_0x5948('0x8'));var csv=require(_0x5948('0x9'));var ejs=require(_0x5948('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5948('0xb'));var squel=require('squel');var crypto=require(_0x5948('0xc'));var jsforce=require(_0x5948('0xd'));var deskjs=require(_0x5948('0xe'));var toCsv=require(_0x5948('0x9'));var querystring=require('querystring');var Papa=require(_0x5948('0xf'));var AWS=require(_0x5948('0x10'));var uuidv4=require(_0x5948('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5948('0x12'));var as=require(_0x5948('0x13'));var hardwareService=require(_0x5948('0x14'));var logger=require(_0x5948('0x15'))('api');var utils=require(_0x5948('0x16'));var config=require(_0x5948('0x17'));var licenseUtil=require(_0x5948('0x18'));var db=require(_0x5948('0x19'))['db'];function respondWithStatusCode(_0x5a2832,_0xc59ce2){_0xc59ce2=_0xc59ce2||0xcc;return function(_0x32adb8){if(_0x32adb8){return _0x5a2832[_0x5948('0x1a')](_0xc59ce2);}return _0x5a2832[_0x5948('0x1b')](_0xc59ce2)[_0x5948('0x1c')]();};}function respondWithResult(_0x172291,_0x260234){_0x260234=_0x260234||0xc8;return function(_0x332a2b){if(_0x332a2b){return _0x172291[_0x5948('0x1b')](_0x260234)[_0x5948('0x1d')](_0x332a2b);}};}function respondWithFilteredResult(_0x3ffbcd,_0x1f7f53){return function(_0x1b9011){if(_0x1b9011){var _0x1636e3=typeof _0x1f7f53[_0x5948('0x1e')]===_0x5948('0x1f')&&typeof _0x1f7f53[_0x5948('0x20')]===_0x5948('0x1f');var _0x39156b=_0x1b9011['count'];var _0x1a2f9f=_0x1636e3?0x0:_0x1f7f53[_0x5948('0x1e')];var _0x214e7a=_0x1636e3?_0x1b9011[_0x5948('0x21')]:_0x1f7f53[_0x5948('0x1e')]+_0x1f7f53[_0x5948('0x20')];var _0x21f30e;if(_0x214e7a>=_0x39156b){_0x214e7a=_0x39156b;_0x21f30e=0xc8;}else{_0x21f30e=0xce;}_0x3ffbcd['status'](_0x21f30e);return _0x3ffbcd[_0x5948('0x22')](_0x5948('0x23'),_0x1a2f9f+'-'+_0x214e7a+'/'+_0x39156b)['json'](_0x1b9011);}return null;};}function patchUpdates(_0x236e6f){return function(_0x50c594){try{jsonpatch['apply'](_0x50c594,_0x236e6f,!![]);}catch(_0x39636c){return BPromise[_0x5948('0x24')](_0x39636c);}return _0x50c594[_0x5948('0x25')]();};}function saveUpdates(_0x2dfcc7,_0x301069){return function(_0x581cab){if(_0x581cab){return _0x581cab[_0x5948('0x26')](_0x2dfcc7)[_0x5948('0x27')](function(_0x425169){return _0x425169;});}return null;};}function removeEntity(_0x2e461a,_0x1e029c){return function(_0x3edb73){if(_0x3edb73){return _0x3edb73[_0x5948('0x28')]()[_0x5948('0x27')](function(){_0x2e461a[_0x5948('0x1b')](0xcc)[_0x5948('0x1c')]();});}};}function handleEntityNotFound(_0xca10ce,_0x588d3c){return function(_0x22123a){if(!_0x22123a){_0xca10ce[_0x5948('0x1a')](0x194);}return _0x22123a;};}function handleError(_0x10e005,_0xa42498){_0xa42498=_0xa42498||0x1f4;return function(_0xb39e47){logger[_0x5948('0x29')](_0xb39e47[_0x5948('0x2a')]);if(_0xb39e47['name']){delete _0xb39e47['name'];}_0x10e005[_0x5948('0x1b')](_0xa42498)[_0x5948('0x2b')](_0xb39e47);};}exports[_0x5948('0x2c')]=function(_0x295bdf,_0x2b1b94){var _0x30c672={},_0x36e44d={},_0x56be7a={'count':0x0,'rows':[]};var _0x19a404=_[_0x5948('0x2d')](db[_0x5948('0x2e')][_0x5948('0x2f')],function(_0xad083a){return{'name':_0xad083a['fieldName'],'type':_0xad083a[_0x5948('0x30')][_0x5948('0x31')]};});_0x36e44d[_0x5948('0x32')]=_['differenceBy'](_[_0x5948('0x2d')](_0x19a404,_0x5948('0x33')),[_0x5948('0x34')]);_0x36e44d[_0x5948('0x35')]=_[_0x5948('0x36')](_0x295bdf[_0x5948('0x35')]);_0x36e44d[_0x5948('0x37')]=_['intersection'](_0x36e44d[_0x5948('0x32')],_0x36e44d[_0x5948('0x35')]);_0x30c672[_0x5948('0x38')]=_[_0x5948('0x39')](_0x36e44d[_0x5948('0x32')],qs[_0x5948('0x3a')](_0x295bdf[_0x5948('0x35')]['fields']));_0x30c672['attributes']=_0x30c672['attributes'][_0x5948('0x3b')]?_0x30c672['attributes']:_0x36e44d['model'];if(!_0x295bdf[_0x5948('0x35')]['hasOwnProperty']('nolimit')){_0x30c672[_0x5948('0x20')]=qs['limit'](_0x295bdf[_0x5948('0x35')]['limit']);_0x30c672[_0x5948('0x1e')]=qs[_0x5948('0x1e')](_0x295bdf[_0x5948('0x35')][_0x5948('0x1e')]);}_0x30c672[_0x5948('0x3c')]=qs[_0x5948('0x3d')](_0x295bdf[_0x5948('0x35')][_0x5948('0x3d')]);_0x30c672[_0x5948('0x3e')]=qs[_0x5948('0x37')](_[_0x5948('0x3f')](_0x295bdf[_0x5948('0x35')],_0x36e44d['filters']),_0x19a404);if(_0x295bdf[_0x5948('0x35')][_0x5948('0x40')]){_0x30c672[_0x5948('0x3e')]=_['merge'](_0x30c672['where'],{'$or':_[_0x5948('0x2d')](_0x19a404,function(_0x34d44a){if(_0x34d44a['type']!==_0x5948('0x41')){var _0x2a8c23={};_0x2a8c23[_0x34d44a[_0x5948('0x33')]]={'$like':'%'+_0x295bdf['query'][_0x5948('0x40')]+'%'};return _0x2a8c23;}})});}_0x30c672=_[_0x5948('0x42')]({},_0x30c672,_0x295bdf['options']);var _0x1522fa={'where':_0x30c672[_0x5948('0x3e')]};return db[_0x5948('0x2e')][_0x5948('0x21')](_0x1522fa)['then'](function(_0xc8c44d){_0x56be7a[_0x5948('0x21')]=_0xc8c44d;if(_0x295bdf['query']['includeAll']){_0x30c672[_0x5948('0x43')]=[{'all':!![]}];}return db[_0x5948('0x2e')]['findAll'](_0x30c672);})[_0x5948('0x27')](function(_0x3b6e67){_0x56be7a['rows']=_0x3b6e67;return _0x56be7a;})['then'](respondWithFilteredResult(_0x2b1b94,_0x30c672))[_0x5948('0x44')](handleError(_0x2b1b94,null));};exports['show']=function(_0x533899,_0x4f960c){var _0x1b0e5f={'raw':![],'where':{'id':_0x533899[_0x5948('0x45')]['id']}},_0x4151df={};_0x4151df[_0x5948('0x32')]=_[_0x5948('0x36')](db[_0x5948('0x2e')][_0x5948('0x2f')]);_0x4151df[_0x5948('0x35')]=_[_0x5948('0x36')](_0x533899[_0x5948('0x35')]);_0x4151df['filters']=_[_0x5948('0x39')](_0x4151df[_0x5948('0x32')],_0x4151df[_0x5948('0x35')]);_0x1b0e5f[_0x5948('0x38')]=_[_0x5948('0x39')](_0x4151df[_0x5948('0x32')],qs['fields'](_0x533899[_0x5948('0x35')]['fields']));_0x1b0e5f[_0x5948('0x38')]=_0x1b0e5f[_0x5948('0x38')]['length']?_0x1b0e5f['attributes']:_0x4151df[_0x5948('0x32')];if(_0x533899[_0x5948('0x35')]['includeAll']){_0x1b0e5f[_0x5948('0x43')]=[{'all':!![]}];}_0x1b0e5f=_[_0x5948('0x42')]({},_0x1b0e5f,_0x533899['options']);return db[_0x5948('0x2e')]['find'](_0x1b0e5f)[_0x5948('0x27')](handleEntityNotFound(_0x4f960c,null))[_0x5948('0x27')](respondWithResult(_0x4f960c,null))['catch'](handleError(_0x4f960c,null));};exports['create']=function(_0x154fa3,_0x3555a8){return db[_0x5948('0x2e')][_0x5948('0x46')](_0x154fa3[_0x5948('0x47')],{})[_0x5948('0x27')](respondWithResult(_0x3555a8,0xc9))['catch'](handleError(_0x3555a8,null));};exports[_0x5948('0x26')]=function(_0x2fc147,_0x91aef8){if(_0x2fc147['body']['id']){delete _0x2fc147[_0x5948('0x47')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x2fc147[_0x5948('0x45')]['id']}})[_0x5948('0x27')](handleEntityNotFound(_0x91aef8,null))[_0x5948('0x27')](saveUpdates(_0x2fc147[_0x5948('0x47')],null))[_0x5948('0x27')](respondWithResult(_0x91aef8,null))[_0x5948('0x44')](handleError(_0x91aef8,null));};exports[_0x5948('0x48')]=function(_0x45e763,_0x18cf29){return db[_0x5948('0x2e')][_0x5948('0x48')]()[_0x5948('0x27')](respondWithResult(_0x18cf29,null))[_0x5948('0x44')](handleError(_0x18cf29,null));};exports[_0x5948('0x49')]=function(_0x45485d,_0x577601,_0x5c4b3e){var _0x426610=require(_0x5948('0x4a'));var _0x3be525=![];var _0x45c53e={};if(_0x45485d[_0x5948('0x35')][_0x5948('0x30')]&&_0x45485d[_0x5948('0x35')][_0x5948('0x30')]==='uniqueid'){_0x45c53e[_0x5948('0x4b')]=_0x45485d[_0x5948('0x45')]['id'];}else{_0x45c53e['id']=_0x45485d['params']['id'];}return db[_0x5948('0x2e')][_0x5948('0x4c')]({'where':_0x45c53e,'attributes':['id',_0x5948('0x4d')],'raw':!![]})[_0x5948('0x27')](handleEntityNotFound(_0x577601,null))[_0x5948('0x27')](function(_0x14b142){if(_0x14b142){var _0x55190e=_0x14b142[_0x5948('0x4d')];var _0x508df5=util[_0x5948('0x34')](_0x5948('0x4e'),_0x55190e);if(fs[_0x5948('0x4f')](_0x508df5)){_0x3be525=!![];return _0x426610[_0x5948('0x50')](_0x508df5,_0x55190e,config[_0x5948('0x51')][_0x5948('0x52')])['then'](function(){return _0x14b142;});}return _0x14b142;}})['then'](function(_0x788496){if(_0x788496){var _0x579af9=_0x788496['value'];if(!fs['existsSync'](_0x579af9)){throw new db[(_0x5948('0x53'))]['ValidationError'](_0x5948('0x54'));}if(_0x788496[_0x5948('0x55')]){return _0x577601['download'](_0x579af9,_0x788496[_0x5948('0x55')]+path[_0x5948('0x56')](_0x579af9),function(){if(_0x3be525){fs[_0x5948('0x57')](_0x579af9);}});}else{return _0x577601[_0x5948('0x49')](_0x579af9,function(_0x1ed703){if(_0x3be525){fs[_0x5948('0x57')](_0x579af9);}});}}})[_0x5948('0x44')](function(_0x3c06c5){if(_0x3c06c5[_0x5948('0x58')]===_0x5948('0x54')){_0x577601[_0x5948('0x1b')](0x194)[_0x5948('0x2b')]('Not\x20found');}else{return handleError(_0x577601,null);}});};exports[_0x5948('0x59')]=function(_0x1d0068,_0x2a84ef,_0x57ffe3){var _0x4ddfba=require(_0x5948('0x4a'));var _0x368df6=![];var _0x3b009e={'$and':[db[_0x5948('0x5a')][_0x5948('0x3e')](db[_0x5948('0x5a')]['fn']('MD5',db['sequelize'][_0x5948('0x5b')](_0x5948('0x4b'))),_0x1d0068[_0x5948('0x35')]['token'])]};if(_0x1d0068[_0x5948('0x35')][_0x5948('0x30')]&&_0x1d0068[_0x5948('0x35')][_0x5948('0x30')]===_0x5948('0x4b')){_0x3b009e['$and'][_0x5948('0x5c')]({'uniqueid':_0x1d0068['params']['id']});}else{_0x3b009e[_0x5948('0x5d')][_0x5948('0x5c')]({'id':_0x1d0068[_0x5948('0x45')]['id']});}return db[_0x5948('0x2e')][_0x5948('0x4c')]({'where':_0x3b009e,'attributes':['id',_0x5948('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x2a84ef,null))['then'](function(_0x105375){if(_0x105375){var _0x52df52=util[_0x5948('0x34')](_0x5948('0x4e'),_0x105375['value']);if(fs[_0x5948('0x4f')](_0x52df52)){_0x368df6=!![];return _0x4ddfba['decryptFile'](_0x52df52,_0x105375['value'],config[_0x5948('0x51')][_0x5948('0x52')])[_0x5948('0x27')](function(){return _0x105375;});}return _0x105375;}})[_0x5948('0x27')](function(_0xc14e11){if(_0xc14e11){if(!fs[_0x5948('0x4f')](_0xc14e11[_0x5948('0x4d')])){throw new db['Sequelize']['ValidationError']('VoiceRecording\x20not\x20found');}if(_0xc14e11[_0x5948('0x55')]){return _0x2a84ef[_0x5948('0x49')](_0xc14e11[_0x5948('0x4d')],_0xc14e11[_0x5948('0x55')]+path[_0x5948('0x56')](_0xc14e11['value']),function(){if(_0x368df6){fs[_0x5948('0x57')](_0xc14e11['value']);}});}else{return _0x2a84ef[_0x5948('0x49')](_0xc14e11[_0x5948('0x4d')],function(_0xa22d9a){if(_0x368df6){fs[_0x5948('0x57')](_0xc14e11[_0x5948('0x4d')]);}});}}})[_0x5948('0x44')](handleError(_0x2a84ef,null));};exports[_0x5948('0x28')]=function(_0x328de5,_0x1a71f2){return db[_0x5948('0x2e')]['find']({'where':{'id':_0x328de5[_0x5948('0x45')]['id']}})[_0x5948('0x27')](function(_0x2159bd){if(_['isNil'](_0x2159bd)){throw new ReferenceError(_0x5948('0x5e'));}return _0x2159bd;})[_0x5948('0x27')](function(_0x182a2f){var _0x4dc0ea=_0x182a2f[_0x5948('0x4d')];logger[_0x5948('0x5f')](_0x5948('0x60'),_0x4dc0ea);if(!_[_0x5948('0x61')](_0x182a2f[_0x5948('0x4d')])&&fs[_0x5948('0x4f')](_0x4dc0ea)){logger[_0x5948('0x5f')](_0x5948('0x62')+_0x4dc0ea+_0x5948('0x63'));fs['unlinkSync'](_0x4dc0ea);}_0x4dc0ea=_0x4dc0ea+_0x5948('0x64');if(!_[_0x5948('0x61')](_0x182a2f[_0x5948('0x4d')])&&fs['existsSync'](_0x4dc0ea)){logger[_0x5948('0x5f')]('File:\x20\x22'+_0x4dc0ea+_0x5948('0x63'));fs[_0x5948('0x65')](_0x4dc0ea);}return _0x182a2f;})['then'](function(_0x2ddacb){if(!_0x2ddacb)throw new InternalError();return _0x2ddacb[_0x5948('0x28')]();})[_0x5948('0x27')](function(){_0x1a71f2[_0x5948('0x1b')](0xcc)[_0x5948('0x1c')]();})[_0x5948('0x44')](handleError(_0x1a71f2,null));};function getBucketslist(_0x1f79e1,_0x312f72,_0x5ad2d5){return new Promise(function(_0x4a28ad,_0x184739){var _0x3dac34=new AWS['S3']({'accessKeyId':_0x312f72,'secretAccessKey':_0x1f79e1,'region':_0x5ad2d5});_0x3dac34[_0x5948('0x66')]({},function(_0x2589e4,_0x3aea48){if(_0x2589e4){return _0x184739(_0x2589e4);}else{return _0x4a28ad(_0x3aea48);}});});}function createBucket(_0x559506,_0x3975b9,_0x5230bc,_0x3b307f){return new Promise(function(_0x86f30f,_0x474ddd){var _0x14a58e=new AWS['S3']({'accessKeyId':_0x3975b9,'secretAccessKey':_0x559506,'region':_0x5230bc});_0x14a58e[_0x5948('0x67')]({'Bucket':_0x3b307f},function(_0x23ed6b,_0x3c4bb0){if(_0x23ed6b){return _0x474ddd(_0x23ed6b);}else{return _0x86f30f(_0x3c4bb0);}});});}function uploadFile(_0x585311,_0x3b5440,_0x226e8f,_0x37ec5f,_0x2b5eb4,_0x2d54f2){return new Promise(function(_0x158aa4,_0x2080bc){var _0x406662=new AWS['S3']({'accessKeyId':_0x3b5440,'secretAccessKey':_0x585311,'region':_0x226e8f});_0x406662[_0x5948('0x68')]({'Bucket':_0x37ec5f,'Key':_0x2b5eb4,'Body':_0x2d54f2},function(_0x24145b,_0x23243c){if(_0x24145b){return _0x2080bc(_0x24145b);}else{return _0x158aa4(_0x23243c);}});});}function startTranscribe(_0x375344,_0x9e21b1,_0x27752c,_0x3e6427,_0x34ba0d,_0x41c982){return new Promise(function(_0x868f93,_0x2399b7){var _0x2db6d0=new AWS['TranscribeService']({'accessKeyId':_0x9e21b1,'secretAccessKey':_0x375344,'region':_0x27752c});_0x2db6d0[_0x5948('0x69')]({'TranscriptionJobName':_0x3e6427,'LanguageCode':_0x34ba0d,'Media':{'MediaFileUri':_0x41c982}},function(_0x245787,_0x42efba){if(_0x245787){return _0x2399b7(_0x245787);}else{return _0x868f93(_0x42efba);}});});}function transcribe(_0x394fff,_0x4c880d,_0x112419,_0x582eec,_0x163c42,_0x602b,_0x4c67d1){return new Promise(function(_0x2e8610,_0x5b2a4c){var _0x5e9205={};logger[_0x5948('0x5f')](util[_0x5948('0x34')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x394fff,_0x163c42));return uploadFile(_0x4c880d,_0x112419,_0x582eec,_0x163c42,path['basename'](_0x602b),fs['readFileSync'](_0x602b))[_0x5948('0x27')](function(_0x223c43){logger[_0x5948('0x5f')](util['format'](_0x5948('0x6a'),_0x394fff,_0x163c42,_0x223c43[_0x5948('0x6b')]));_0x5e9205['bucket']=_0x223c43[_0x5948('0x6c')];_0x5e9205['location']=_0x223c43['Location'];logger[_0x5948('0x5f')](util[_0x5948('0x34')](_0x5948('0x6d'),_0x394fff));return startTranscribe(_0x4c880d,_0x112419,_0x582eec,uuidv4(),_0x4c67d1,_0x223c43[_0x5948('0x6b')]);})[_0x5948('0x27')](function(_0x49aa99){logger[_0x5948('0x5f')](util[_0x5948('0x34')](_0x5948('0x6e'),_0x394fff,_0x49aa99['TranscriptionJob'][_0x5948('0x6f')]));_0x5e9205[_0x5948('0x70')]=_0x49aa99['TranscriptionJob']['TranscriptionJobName'];_0x5e9205[_0x5948('0x71')]=_0x49aa99[_0x5948('0x72')][_0x5948('0x73')];return _0x2e8610(_0x5e9205);})[_0x5948('0x44')](function(_0x52817b){return _0x5b2a4c(_0x52817b);});});}exports[_0x5948('0x74')]=function(_0x719634,_0x45df14,_0x27f340){var _0x4ac5eb;var _0x4a8b8c;var _0x27ceba;var _0x3ff873=require(_0x5948('0x4a'));return db['VoiceRecording']['findOne']({'where':{'id':_0x719634['params']['id']}})[_0x5948('0x27')](function(_0x17ead7){if(_0x17ead7){var _0x1b933f=util[_0x5948('0x34')](_0x5948('0x4e'),_0x17ead7['value']);if(fs[_0x5948('0x4f')](_0x1b933f)){cypher=!![];return _0x3ff873['decryptFile'](_0x1b933f,_0x17ead7[_0x5948('0x4d')],config['secrets'][_0x5948('0x52')])['then'](function(){return _0x17ead7;});}return _0x17ead7;}})[_0x5948('0x27')](function(_0x168b41){if(!_0x168b41){throw new db[(_0x5948('0x53'))][(_0x5948('0x75'))](_0x5948('0x76'));}_0x4a8b8c=_0x168b41;return db[_0x5948('0x77')]['findOne']({'where':{'id':0x1}});})[_0x5948('0x27')](handleEntityNotFound(_0x45df14,null))[_0x5948('0x27')](function(_0x56e5ed){if(_0x56e5ed){_0x4ac5eb=_0x56e5ed;if(!_0x4ac5eb[_0x5948('0x78')]||!_0x4ac5eb[_0x5948('0x79')]||!_0x4ac5eb[_0x5948('0x7a')]||!_0x4ac5eb[_0x5948('0x7b')]||!_0x4ac5eb['bucket']){throw new db['Sequelize'][(_0x5948('0x75'))](_0x5948('0x7c'));}if(_0x719634[_0x5948('0x47')]['runSentiment']&&(!_0x4ac5eb[_0x5948('0x7d')]||!_0x4ac5eb[_0x5948('0x7e')]||!_0x4ac5eb[_0x5948('0x7f')]||!_0x4ac5eb[_0x5948('0x7b')]||!_0x4ac5eb[_0x5948('0x80')])){throw new db['Sequelize'][(_0x5948('0x75'))](_0x5948('0x81'));}return db[_0x5948('0x82')][_0x5948('0x83')]({'where':{'id':_0x4ac5eb[_0x5948('0x79')]}});}})[_0x5948('0x27')](function(_0x23ab5f){if(!_0x23ab5f){throw new db[(_0x5948('0x53'))][(_0x5948('0x75'))](_0x5948('0x84'));}if(!_0x23ab5f[_0x5948('0x85')]||!_0x23ab5f[_0x5948('0x86')]){throw new db[(_0x5948('0x53'))][(_0x5948('0x75'))](_0x5948('0x87'));}_0x27ceba=_0x23ab5f;return getBucketslist(_0x27ceba[_0x5948('0x85')],_0x27ceba['data2'],_0x4ac5eb['transcribeRegion']);})['then'](function(_0x59bcd6){if(_0x59bcd6&&_0x59bcd6[_0x5948('0x88')]){var _0x23d341=_[_0x5948('0x4c')](_0x59bcd6[_0x5948('0x88')],function(_0x556372){return _0x556372[_0x5948('0x89')]===_0x4ac5eb[_0x5948('0x80')];});if(!_0x23d341){logger[_0x5948('0x5f')](util[_0x5948('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x719634[_0x5948('0x45')]['id'],_0x4ac5eb[_0x5948('0x80')]));return createBucket(_0x27ceba[_0x5948('0x85')],_0x27ceba[_0x5948('0x86')],_0x4ac5eb[_0x5948('0x7a')],_0x4ac5eb[_0x5948('0x80')]);}logger[_0x5948('0x5f')](util[_0x5948('0x34')](_0x5948('0x8a'),_0x719634[_0x5948('0x45')]['id'],_0x4ac5eb[_0x5948('0x80')]));return;}})['then'](function(_0x14f235){if(_0x4a8b8c[_0x5948('0x71')]===_0x5948('0x8b')){return transcribe(_0x719634[_0x5948('0x45')]['id'],_0x27ceba[_0x5948('0x85')],_0x27ceba['data2'],_0x4ac5eb[_0x5948('0x7a')],_0x4ac5eb[_0x5948('0x80')],_0x4a8b8c[_0x5948('0x4d')],_0x4ac5eb[_0x5948('0x7b')]);}else{logger[_0x5948('0x5f')](util[_0x5948('0x34')](_0x5948('0x8c'),_0x719634[_0x5948('0x45')]['id']));return{'transcribeStatus':_0x5948('0x8d')};}})['then'](function(_0x213eb7){if(_0x213eb7){_0x213eb7['tempSentiment']=_0x719634[_0x5948('0x47')]['runSentiment'];return _0x4a8b8c['updateAttributes'](_0x213eb7);}})[_0x5948('0x27')](respondWithResult(_0x45df14,null))['catch'](handleError(_0x45df14,null));};function writeFile(_0x108c93,_0x3f73dd){return new Promise(function(_0x502e8e,_0x11932e){fs[_0x5948('0x8e')](_0x3f73dd,_0x108c93,function(_0x597d4b,_0x36d5b1){if(_0x597d4b){return _0x11932e(_0x597d4b);}else{return _0x502e8e(_0x36d5b1);}});});}exports[_0x5948('0x8f')]=function(_0x5d590e,_0x1815b9,_0x412929){return db[_0x5948('0x2e')][_0x5948('0x83')]({'where':{'id':_0x5d590e[_0x5948('0x45')]['id']}})[_0x5948('0x27')](handleEntityNotFound(_0x1815b9))[_0x5948('0x27')](function(_0x35d444){if(_0x35d444&&_0x35d444[_0x5948('0x90')]){var _0x4c4127=_0x35d444[_0x5948('0x90')];var _0x547434=config[_0x5948('0x91')]+_0x5948('0x92')+_0x35d444['id']+_0x5948('0x93');if(fs[_0x5948('0x4f')](_0x547434)){return _0x547434;}return writeFile(_0x4c4127,_0x547434)[_0x5948('0x27')](function(){return _0x547434;});}else{throw new db[(_0x5948('0x53'))][(_0x5948('0x75'))](_0x5948('0x94'));}})[_0x5948('0x27')](function(_0x5a26f6){return _0x1815b9[_0x5948('0x49')](_0x5a26f6);})['catch'](handleError(_0x1815b9));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 7b48951..84ca50e 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 _0x47d6=['VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x3243be,_0x477fa8){var _0x47daf8=function(_0x46f2c8){while(--_0x46f2c8){_0x3243be['push'](_0x3243be['shift']());}};_0x47daf8(++_0x477fa8);}(_0x47d6,0x1de));var _0x647d=function(_0x3fe627,_0xa3d989){_0x3fe627=_0x3fe627-0x0;var _0x1403ad=_0x47d6[_0x3fe627];return _0x1403ad;};'use strict';var attributes=require(_0x647d('0x0'));module[_0x647d('0x1')]=function(_0xaf144e,_0x549430){return _0xaf144e['define'](_0x647d('0x2'),attributes,{'tableName':_0x647d('0x3'),'paranoid':![],'indexes':[{'name':_0x647d('0x4'),'fields':['uniqueid']},{'name':_0x647d('0x5'),'fields':[_0x647d('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf3cd=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0x545e06,_0xe14fa6){var _0x4cfaa2=function(_0x496dd9){while(--_0x496dd9){_0x545e06['push'](_0x545e06['shift']());}};_0x4cfaa2(++_0xe14fa6);}(_0xf3cd,0xfe));var _0xdf3c=function(_0xd4ec0c,_0x2afcd2){_0xd4ec0c=_0xd4ec0c-0x0;var _0x580218=_0xf3cd[_0xd4ec0c];return _0x580218;};'use strict';var attributes=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]=function(_0x31e5a5,_0x1e0814){return _0x31e5a5[_0xdf3c('0x2')](_0xdf3c('0x3'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xdf3c('0x4'),'fields':[_0xdf3c('0x4')]},{'name':_0xdf3c('0x5'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index baec6c8..b3bff37 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 _0xb44a=['client','http','request','then','VoiceRecording,\x20%s,\x20%s','debug','stringify','error','code','message','info','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','../../components/encryptor','Setting','findOne','create','callRecordingEncryption','existsSync','value','%s.cypher','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x55fb83,_0x1d3856){var _0x59a87a=function(_0x38bdd1){while(--_0x38bdd1){_0x55fb83['push'](_0x55fb83['shift']());}};_0x59a87a(++_0x1d3856);}(_0xb44a,0x1c2));var _0xab44=function(_0x50aea5,_0x5dd077){_0x50aea5=_0x50aea5-0x0;var _0x4657f1=_0xb44a[_0x50aea5];return _0x4657f1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xab44('0x0'));var BPromise=require('bluebird');var rs=require(_0xab44('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab44('0x2'));var logger=require('../../config/logger')(_0xab44('0x3'));var config=require(_0xab44('0x4'));var jayson=require(_0xab44('0x5'));var client=jayson[_0xab44('0x6')][_0xab44('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3303b1,_0x3ead8d,_0x495825){return new BPromise(function(_0x137a8c,_0x133a6d){return client[_0xab44('0x8')](_0x3303b1,_0x495825)[_0xab44('0x9')](function(_0xa14367){logger['info'](_0xab44('0xa'),_0x3ead8d,'request\x20sent');logger[_0xab44('0xb')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x3ead8d,'request\x20sent',JSON[_0xab44('0xc')](_0xa14367));if(_0xa14367[_0xab44('0xd')]){if(_0xa14367[_0xab44('0xd')][_0xab44('0xe')]===0x1f4){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0xa14367['error']['message']);return _0x133a6d(_0xa14367[_0xab44('0xd')]['message']);}logger[_0xab44('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x3ead8d,_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);return _0x137a8c(_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);}else{logger[_0xab44('0x10')](_0xab44('0xa'),_0x3ead8d,'request\x20sent');_0x137a8c(_0xa14367['result'][_0xab44('0xf')]);}})[_0xab44('0x11')](function(_0x14fe36){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0x14fe36);_0x133a6d(_0x14fe36);});});}exports[_0xab44('0x12')]=function(_0x354b09){var _0x44fa43=this;return new Promise(function(_0x310b15,_0xc4b3dc){return db[_0xab44('0x13')]['update'](_0x354b09[_0xab44('0x14')],{'raw':_0x354b09[_0xab44('0x15')]?_0x354b09[_0xab44('0x15')][_0xab44('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x354b09[_0xab44('0x15')]?_0x354b09['options'][_0xab44('0x17')]||null:null,'attributes':_0x354b09['options']?_0x354b09[_0xab44('0x15')][_0xab44('0x18')]||null:null,'limit':_0x354b09[_0xab44('0x15')]?_0x354b09[_0xab44('0x15')]['limit']||null:null})[_0xab44('0x9')](function(_0x26fc03){logger[_0xab44('0x10')](_0xab44('0x12'),_0x354b09);logger[_0xab44('0xb')](_0xab44('0x12'),_0x354b09,JSON[_0xab44('0xc')](_0x26fc03));_0x310b15(_0x26fc03);})['catch'](function(_0x595761){logger[_0xab44('0xd')]('UpdateVoiceRecording',_0x595761[_0xab44('0xf')],_0x354b09);_0xc4b3dc(_0x44fa43['error'](0x1f4,_0x595761[_0xab44('0xf')]));});});};exports['CreateVoiceRecording']=function(_0x531583){var _0x8e60fa=this;return new Promise(function(_0x25287b,_0x259192){var _0x4620ed=require(_0xab44('0x19'));var _0x4e820c;return db[_0xab44('0x1a')][_0xab44('0x1b')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0xab44('0x9')](function(_0xebb7d1){_0x4e820c=_0xebb7d1;return db[_0xab44('0x13')][_0xab44('0x1c')](_0x531583[_0xab44('0x14')]);})[_0xab44('0x9')](function(_0x59f844){if(_0x4e820c[_0xab44('0x1d')]&&fs[_0xab44('0x1e')](_0x59f844[_0xab44('0x1f')])){var _0x47e1be=util['format'](_0xab44('0x20'),_0x59f844['value']);return _0x4620ed['encryptFile'](_0x59f844[_0xab44('0x1f')],_0x47e1be,config[_0xab44('0x21')][_0xab44('0x22')])[_0xab44('0x9')](function(){fs[_0xab44('0x23')](_0x59f844[_0xab44('0x1f')]);logger[_0xab44('0x10')](_0xab44('0x24'));return _0x59f844;});}return _0x59f844;})[_0xab44('0x9')](function(_0x1e8e9d){logger[_0xab44('0x10')](_0xab44('0x25'),_0x531583);logger[_0xab44('0xb')](_0xab44('0x25'),_0x531583,JSON['stringify'](_0x1e8e9d));_0x25287b(_0x1e8e9d);})['catch'](function(_0x27e318){logger[_0xab44('0xd')]('CreateVoiceRecording',_0x27e318[_0xab44('0xf')],_0x531583);_0x259192(_0x8e60fa[_0xab44('0xd')](0x1f4,_0x27e318[_0xab44('0xf')]));});});}; \ No newline at end of file +var _0x1623=['../../config/utils','../../config/environment','client','http','request','then','info','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','where','limit','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','format','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xdc8eb0,_0x5351e4){var _0x2daef9=function(_0x381e2e){while(--_0x381e2e){_0xdc8eb0['push'](_0xdc8eb0['shift']());}};_0x2daef9(++_0x5351e4);}(_0x1623,0xab));var _0x3162=function(_0x3f87b2,_0x3223f8){_0x3f87b2=_0x3f87b2-0x0;var _0x531a6a=_0x1623[_0x3f87b2];return _0x531a6a;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('VoiceRecording,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('VoiceRecording,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});}exports[_0x3162('0x16')]=function(_0x1eed46){var _0x391d97=this;return new Promise(function(_0x4b2bf3,_0x42f283){return db[_0x3162('0x17')][_0x3162('0x18')](_0x1eed46[_0x3162('0x19')],{'raw':_0x1eed46['options']?_0x1eed46[_0x3162('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eed46['options']?_0x1eed46[_0x3162('0x1a')][_0x3162('0x1b')]||null:null,'attributes':_0x1eed46[_0x3162('0x1a')]?_0x1eed46['options']['attributes']||null:null,'limit':_0x1eed46[_0x3162('0x1a')]?_0x1eed46[_0x3162('0x1a')][_0x3162('0x1c')]||null:null})[_0x3162('0xa')](function(_0x31b27b){logger[_0x3162('0xb')](_0x3162('0x16'),_0x1eed46);logger[_0x3162('0xc')]('UpdateVoiceRecording',_0x1eed46,JSON[_0x3162('0xf')](_0x31b27b));_0x4b2bf3(_0x31b27b);})[_0x3162('0x15')](function(_0x3919e7){logger[_0x3162('0x10')](_0x3162('0x16'),_0x3919e7[_0x3162('0x13')],_0x1eed46);_0x42f283(_0x391d97[_0x3162('0x10')](0x1f4,_0x3919e7[_0x3162('0x13')]));});});};exports[_0x3162('0x1d')]=function(_0x356c5d){var _0x8fa09f=this;return new Promise(function(_0x2f62d7,_0x1c03a4){var _0x48de45=require(_0x3162('0x1e'));var _0x552469;return db[_0x3162('0x1f')][_0x3162('0x20')]({'attributes':['id',_0x3162('0x21')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x4903e7){_0x552469=_0x4903e7;return db[_0x3162('0x17')][_0x3162('0x22')](_0x356c5d[_0x3162('0x19')]);})[_0x3162('0xa')](function(_0x2f88ec){if(_0x552469['callRecordingEncryption']&&fs[_0x3162('0x23')](_0x2f88ec['value'])){var _0xf11765=util[_0x3162('0x24')](_0x3162('0x25'),_0x2f88ec[_0x3162('0x26')]);return _0x48de45[_0x3162('0x27')](_0x2f88ec[_0x3162('0x26')],_0xf11765,config[_0x3162('0x28')][_0x3162('0x29')])['then'](function(){fs[_0x3162('0x2a')](_0x2f88ec[_0x3162('0x26')]);logger['info'](_0x3162('0x2b'));return _0x2f88ec;});}return _0x2f88ec;})[_0x3162('0xa')](function(_0x528340){logger['info'](_0x3162('0x1d'),_0x356c5d);logger['debug'](_0x3162('0x1d'),_0x356c5d,JSON[_0x3162('0xf')](_0x528340));_0x2f62d7(_0x528340);})[_0x3162('0x15')](function(_0x551442){logger['error'](_0x3162('0x1d'),_0x551442[_0x3162('0x13')],_0x356c5d);_0x1c03a4(_0x8fa09f['error'](0x1f4,_0x551442[_0x3162('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index b6bc3ba..a47eb6c 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 _0x2240=['../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','/:id','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x56b279,_0x2d6695){var _0x5cfab3=function(_0x26985f){while(--_0x26985f){_0x56b279['push'](_0x56b279['shift']());}};_0x5cfab3(++_0x2d6695);}(_0x2240,0x1b4));var _0x0224=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x2240[_0x3511d3];return _0x5d6321;};'use strict';var multer=require(_0x0224('0x0'));var util=require('util');var path=require(_0x0224('0x1'));var timeout=require(_0x0224('0x2'));var express=require(_0x0224('0x3'));var router=express['Router']();var fs_extra=require(_0x0224('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0224('0x5'));var config=require(_0x0224('0x6'));var controller=require(_0x0224('0x7'));router[_0x0224('0x8')]('/',auth[_0x0224('0x9')](),controller[_0x0224('0xa')]);router[_0x0224('0x8')](_0x0224('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x0224('0x8')](_0x0224('0xc'),auth[_0x0224('0x9')](),controller['show']);router['post']('/',auth[_0x0224('0x9')](),controller['create']);router[_0x0224('0xd')](_0x0224('0xc'),auth[_0x0224('0x9')](),controller['update']);router[_0x0224('0xe')](_0x0224('0xc'),auth[_0x0224('0x9')](),controller[_0x0224('0xf')]);module[_0x0224('0x10')]=router; \ No newline at end of file +var _0xc6bf=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','describe','post','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x414014,_0x4e3322){var _0x38ab83=function(_0x2e80e1){while(--_0x2e80e1){_0x414014['push'](_0x414014['shift']());}};_0x38ab83(++_0x4e3322);}(_0xc6bf,0xba));var _0xfc6b=function(_0xd58823,_0x15c483){_0xd58823=_0xd58823-0x0;var _0x249c0a=_0xc6bf[_0xd58823];return _0x249c0a;};'use strict';var multer=require(_0xfc6b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfc6b('0x1'));var express=require(_0xfc6b('0x2'));var router=express[_0xfc6b('0x3')]();var fs_extra=require(_0xfc6b('0x4'));var auth=require(_0xfc6b('0x5'));var interaction=require(_0xfc6b('0x6'));var config=require(_0xfc6b('0x7'));var controller=require(_0xfc6b('0x8'));router[_0xfc6b('0x9')]('/',auth[_0xfc6b('0xa')](),controller[_0xfc6b('0xb')]);router['get']('/describe',auth[_0xfc6b('0xa')](),controller[_0xfc6b('0xc')]);router[_0xfc6b('0x9')]('/:id',auth[_0xfc6b('0xa')](),controller['show']);router[_0xfc6b('0xd')]('/',auth[_0xfc6b('0xa')](),controller['create']);router['put'](_0xfc6b('0xe'),auth['isAuthenticated'](),controller[_0xfc6b('0xf')]);router[_0xfc6b('0x10')](_0xfc6b('0xe'),auth['isAuthenticated'](),controller[_0xfc6b('0x11')]);module[_0xfc6b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 83842c3..7857d7c 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 _0xceb5=['blind','STRING','moment','exports','ENUM'];(function(_0x5bd809,_0x568bd0){var _0x1c7a2d=function(_0x2238ef){while(--_0x2238ef){_0x5bd809['push'](_0x5bd809['shift']());}};_0x1c7a2d(++_0x568bd0);}(_0xceb5,0x13d));var _0x5ceb=function(_0x318410,_0x451962){_0x318410=_0x318410-0x0;var _0x2898a3=_0xceb5[_0x318410];return _0x2898a3;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5ceb('0x0'));module[_0x5ceb('0x1')]={'type':{'type':Sequelize[_0x5ceb('0x2')](_0x5ceb('0x3'),'attended')},'result':{'type':Sequelize[_0x5ceb('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x5ceb('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x5ceb('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x5ceb('0x4')]},'transferercontext':{'type':Sequelize[_0x5ceb('0x4')]},'transfererexten':{'type':Sequelize[_0x5ceb('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x5ceb('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x5ceb('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x5ceb('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x5ceb('0x4')]},'transfereecontext':{'type':Sequelize[_0x5ceb('0x4')]},'transfereeexten':{'type':Sequelize[_0x5ceb('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x5ceb('0x4')]},'isexternal':{'type':Sequelize[_0x5ceb('0x2')]('Yes','No')},'context':{'type':Sequelize[_0x5ceb('0x4')]},'extension':{'type':Sequelize[_0x5ceb('0x4')]}}; \ No newline at end of file +var _0xfab5=['sequelize','moment','blind','attended','STRING','ENUM','Yes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfab5,0x1ea));var _0x5fab=function(_0x3e25bc,_0x1b01f3){_0x3e25bc=_0x3e25bc-0x0;var _0x345958=_0xfab5[_0x3e25bc];return _0x345958;};'use strict';var Sequelize=require(_0x5fab('0x0'));var moment=require(_0x5fab('0x1'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x5fab('0x2'),_0x5fab('0x3'))},'result':{'type':Sequelize[_0x5fab('0x4')]},'transfererchannel':{'type':Sequelize[_0x5fab('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x5fab('0x4')]},'transferercalleridname':{'type':Sequelize[_0x5fab('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x5fab('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x5fab('0x4')]},'transferercontext':{'type':Sequelize[_0x5fab('0x4')]},'transfererexten':{'type':Sequelize[_0x5fab('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x5fab('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x5fab('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x5fab('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x5fab('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x5fab('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x5fab('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x5fab('0x4')]},'isexternal':{'type':Sequelize[_0x5fab('0x5')](_0x5fab('0x6'),'No')},'context':{'type':Sequelize[_0x5fab('0x4')]},'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 8a1256e..1bf8ed7 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 _0xa32d=['catch','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','apply','reject','save','then','destroy','error','stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows'];(function(_0x25e639,_0x218b67){var _0x512585=function(_0x117c40){while(--_0x117c40){_0x25e639['push'](_0x25e639['shift']());}};_0x512585(++_0x218b67);}(_0xa32d,0xe8));var _0xda32=function(_0x283127,_0x54d4d5){_0x283127=_0x283127-0x0;var _0x43da5d=_0xa32d[_0x283127];return _0x43da5d;};'use strict';var emlformat=require(_0xda32('0x0'));var rimraf=require(_0xda32('0x1'));var zipdir=require(_0xda32('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda32('0x3'));var moment=require(_0xda32('0x4'));var BPromise=require(_0xda32('0x5'));var Mustache=require(_0xda32('0x6'));var util=require('util');var path=require(_0xda32('0x7'));var sox=require(_0xda32('0x8'));var csv=require(_0xda32('0x9'));var ejs=require(_0xda32('0xa'));var fs=require('fs');var fs_extra=require(_0xda32('0xb'));var _=require(_0xda32('0xc'));var squel=require(_0xda32('0xd'));var crypto=require(_0xda32('0xe'));var jsforce=require(_0xda32('0xf'));var deskjs=require(_0xda32('0x10'));var toCsv=require(_0xda32('0x9'));var querystring=require(_0xda32('0x11'));var Papa=require('papaparse');var Redis=require(_0xda32('0x12'));var authService=require(_0xda32('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xda32('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda32('0x15'))(_0xda32('0x16'));var utils=require(_0xda32('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xda32('0x18'))['db'];function respondWithStatusCode(_0x45a2fe,_0x43ea94){_0x43ea94=_0x43ea94||0xcc;return function(_0x4df1f9){if(_0x4df1f9){return _0x45a2fe[_0xda32('0x19')](_0x43ea94);}return _0x45a2fe['status'](_0x43ea94)['end']();};}function respondWithResult(_0x223f22,_0x22e404){_0x22e404=_0x22e404||0xc8;return function(_0x512a0b){if(_0x512a0b){return _0x223f22['status'](_0x22e404)[_0xda32('0x1a')](_0x512a0b);}};}function respondWithFilteredResult(_0x18164b,_0x3daaf3){return function(_0x3f1f76){if(_0x3f1f76){var _0x38389e=typeof _0x3daaf3[_0xda32('0x1b')]===_0xda32('0x1c')&&typeof _0x3daaf3[_0xda32('0x1d')]===_0xda32('0x1c');var _0x27af04=_0x3f1f76[_0xda32('0x1e')];var _0x508120=_0x38389e?0x0:_0x3daaf3[_0xda32('0x1b')];var _0x20e2fc=_0x38389e?_0x3f1f76[_0xda32('0x1e')]:_0x3daaf3[_0xda32('0x1b')]+_0x3daaf3['limit'];var _0x4538fc;if(_0x20e2fc>=_0x27af04){_0x20e2fc=_0x27af04;_0x4538fc=0xc8;}else{_0x4538fc=0xce;}_0x18164b[_0xda32('0x1f')](_0x4538fc);return _0x18164b['set']('Content-Range',_0x508120+'-'+_0x20e2fc+'/'+_0x27af04)['json'](_0x3f1f76);}return null;};}function patchUpdates(_0x2d162d){return function(_0x5dff6b){try{jsonpatch[_0xda32('0x20')](_0x5dff6b,_0x2d162d,!![]);}catch(_0x1dab9c){return BPromise[_0xda32('0x21')](_0x1dab9c);}return _0x5dff6b[_0xda32('0x22')]();};}function saveUpdates(_0x288c0c,_0x57e280){return function(_0x6ace74){if(_0x6ace74){return _0x6ace74['update'](_0x288c0c)[_0xda32('0x23')](function(_0x5bec29){return _0x5bec29;});}return null;};}function removeEntity(_0x3443b5,_0x40c79a){return function(_0x2e7424){if(_0x2e7424){return _0x2e7424[_0xda32('0x24')]()[_0xda32('0x23')](function(){_0x3443b5[_0xda32('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fc78d,_0x168964){return function(_0x2ccdd5){if(!_0x2ccdd5){_0x4fc78d[_0xda32('0x19')](0x194);}return _0x2ccdd5;};}function handleError(_0x243cb0,_0x2240ee){_0x2240ee=_0x2240ee||0x1f4;return function(_0x35f243){logger[_0xda32('0x25')](_0x35f243[_0xda32('0x26')]);if(_0x35f243['name']){delete _0x35f243[_0xda32('0x27')];}_0x243cb0[_0xda32('0x1f')](_0x2240ee)[_0xda32('0x28')](_0x35f243);};}exports['index']=function(_0x43aee6,_0x17d964){var _0x56648d={},_0x362f09={},_0x196d0b={'count':0x0,'rows':[]};var _0x4589aa=_[_0xda32('0x29')](db[_0xda32('0x2a')][_0xda32('0x2b')],function(_0x562f2f){return{'name':_0x562f2f[_0xda32('0x2c')],'type':_0x562f2f['type'][_0xda32('0x2d')]};});_0x362f09['model']=_['map'](_0x4589aa,_0xda32('0x27'));_0x362f09['query']=_[_0xda32('0x2e')](_0x43aee6[_0xda32('0x2f')]);_0x362f09[_0xda32('0x30')]=_[_0xda32('0x31')](_0x362f09[_0xda32('0x32')],_0x362f09[_0xda32('0x2f')]);_0x56648d[_0xda32('0x33')]=_[_0xda32('0x31')](_0x362f09['model'],qs[_0xda32('0x34')](_0x43aee6[_0xda32('0x2f')][_0xda32('0x34')]));_0x56648d[_0xda32('0x33')]=_0x56648d[_0xda32('0x33')][_0xda32('0x35')]?_0x56648d['attributes']:_0x362f09[_0xda32('0x32')];if(!_0x43aee6[_0xda32('0x2f')][_0xda32('0x36')](_0xda32('0x37'))){_0x56648d[_0xda32('0x1d')]=qs[_0xda32('0x1d')](_0x43aee6[_0xda32('0x2f')][_0xda32('0x1d')]);_0x56648d[_0xda32('0x1b')]=qs[_0xda32('0x1b')](_0x43aee6['query']['offset']);}_0x56648d['order']=qs[_0xda32('0x38')](_0x43aee6[_0xda32('0x2f')][_0xda32('0x38')]);_0x56648d[_0xda32('0x39')]=qs[_0xda32('0x30')](_[_0xda32('0x3a')](_0x43aee6[_0xda32('0x2f')],_0x362f09['filters']),_0x4589aa);if(_0x43aee6[_0xda32('0x2f')][_0xda32('0x3b')]){_0x56648d['where']=_['merge'](_0x56648d[_0xda32('0x39')],{'$or':_[_0xda32('0x29')](_0x4589aa,function(_0x2bd5e0){if(_0x2bd5e0[_0xda32('0x3c')]!==_0xda32('0x3d')){var _0x36a87b={};_0x36a87b[_0x2bd5e0[_0xda32('0x27')]]={'$like':'%'+_0x43aee6[_0xda32('0x2f')][_0xda32('0x3b')]+'%'};return _0x36a87b;}})});}_0x56648d=_[_0xda32('0x3e')]({},_0x56648d,_0x43aee6[_0xda32('0x3f')]);var _0x3c28dd={'where':_0x56648d['where']};return db[_0xda32('0x2a')][_0xda32('0x1e')](_0x3c28dd)['then'](function(_0x42a6d8){_0x196d0b[_0xda32('0x1e')]=_0x42a6d8;if(_0x43aee6[_0xda32('0x2f')][_0xda32('0x40')]){_0x56648d[_0xda32('0x41')]=[{'all':!![]}];}return db[_0xda32('0x2a')][_0xda32('0x42')](_0x56648d);})[_0xda32('0x23')](function(_0x5cd96d){_0x196d0b[_0xda32('0x43')]=_0x5cd96d;return _0x196d0b;})[_0xda32('0x23')](respondWithFilteredResult(_0x17d964,_0x56648d))[_0xda32('0x44')](handleError(_0x17d964,null));};exports['show']=function(_0x34d608,_0x17ec14){var _0x479de0={'raw':!![],'where':{'id':_0x34d608[_0xda32('0x45')]['id']}},_0x1b3250={};_0x1b3250['model']=_[_0xda32('0x2e')](db[_0xda32('0x2a')]['rawAttributes']);_0x1b3250['query']=_[_0xda32('0x2e')](_0x34d608[_0xda32('0x2f')]);_0x1b3250[_0xda32('0x30')]=_['intersection'](_0x1b3250[_0xda32('0x32')],_0x1b3250[_0xda32('0x2f')]);_0x479de0[_0xda32('0x33')]=_[_0xda32('0x31')](_0x1b3250[_0xda32('0x32')],qs[_0xda32('0x34')](_0x34d608[_0xda32('0x2f')]['fields']));_0x479de0['attributes']=_0x479de0['attributes'][_0xda32('0x35')]?_0x479de0['attributes']:_0x1b3250['model'];if(_0x34d608[_0xda32('0x2f')][_0xda32('0x40')]){_0x479de0[_0xda32('0x41')]=[{'all':!![]}];}_0x479de0=_[_0xda32('0x3e')]({},_0x479de0,_0x34d608[_0xda32('0x3f')]);return db[_0xda32('0x2a')][_0xda32('0x46')](_0x479de0)['then'](handleEntityNotFound(_0x17ec14,null))[_0xda32('0x23')](respondWithResult(_0x17ec14,null))[_0xda32('0x44')](handleError(_0x17ec14,null));};exports[_0xda32('0x47')]=function(_0x595f3f,_0x2378c3){return db[_0xda32('0x2a')]['create'](_0x595f3f[_0xda32('0x48')],{})['then'](respondWithResult(_0x2378c3,0xc9))['catch'](handleError(_0x2378c3,null));};exports[_0xda32('0x49')]=function(_0x4f5403,_0x2fd3e8){if(_0x4f5403[_0xda32('0x48')]['id']){delete _0x4f5403['body']['id'];}return db[_0xda32('0x2a')][_0xda32('0x46')]({'where':{'id':_0x4f5403[_0xda32('0x45')]['id']}})['then'](handleEntityNotFound(_0x2fd3e8,null))['then'](saveUpdates(_0x4f5403['body'],null))[_0xda32('0x23')](respondWithResult(_0x2fd3e8,null))[_0xda32('0x44')](handleError(_0x2fd3e8,null));};exports['destroy']=function(_0x5d8de7,_0x3f5fbe){return db[_0xda32('0x2a')][_0xda32('0x46')]({'where':{'id':_0x5d8de7[_0xda32('0x45')]['id']}})['then'](handleEntityNotFound(_0x3f5fbe,null))['then'](removeEntity(_0x3f5fbe,null))[_0xda32('0x44')](handleError(_0x3f5fbe,null));};exports['describe']=function(_0x9e6acd,_0x8b5738){return db[_0xda32('0x2a')][_0xda32('0x4a')]()[_0xda32('0x23')](respondWithResult(_0x8b5738,null))[_0xda32('0x44')](handleError(_0x8b5738,null));}; \ No newline at end of file +var _0x31f1=['query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','create','body','find','destroy','describe','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','update','then','end','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key'];(function(_0x15e239,_0x563cb0){var _0x3c21fd=function(_0x2dbdb5){while(--_0x2dbdb5){_0x15e239['push'](_0x15e239['shift']());}};_0x3c21fd(++_0x563cb0);}(_0x31f1,0x179));var _0x131f=function(_0x2041ed,_0x370c24){_0x2041ed=_0x2041ed-0x0;var _0x271aec=_0x31f1[_0x2041ed];return _0x271aec;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x131f('0x0'));var zipdir=require(_0x131f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x131f('0x2'));var BPromise=require(_0x131f('0x3'));var Mustache=require(_0x131f('0x4'));var util=require(_0x131f('0x5'));var path=require('path');var sox=require(_0x131f('0x6'));var csv=require(_0x131f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x131f('0x8'));var _=require('lodash');var squel=require(_0x131f('0x9'));var crypto=require(_0x131f('0xa'));var jsforce=require(_0x131f('0xb'));var deskjs=require(_0x131f('0xc'));var toCsv=require(_0x131f('0x7'));var querystring=require(_0x131f('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x131f('0xe'));var hardwareService=require(_0x131f('0xf'));var logger=require(_0x131f('0x10'))('api');var utils=require(_0x131f('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x131f('0x12'));var db=require(_0x131f('0x13'))['db'];function respondWithStatusCode(_0x356c20,_0x576b25){_0x576b25=_0x576b25||0xcc;return function(_0x19159b){if(_0x19159b){return _0x356c20[_0x131f('0x14')](_0x576b25);}return _0x356c20['status'](_0x576b25)['end']();};}function respondWithResult(_0x268b87,_0xb7f731){_0xb7f731=_0xb7f731||0xc8;return function(_0x1950e4){if(_0x1950e4){return _0x268b87[_0x131f('0x15')](_0xb7f731)[_0x131f('0x16')](_0x1950e4);}};}function respondWithFilteredResult(_0x2e69b0,_0xcfb9dc){return function(_0x539eb6){if(_0x539eb6){var _0x51cad8=typeof _0xcfb9dc[_0x131f('0x17')]===_0x131f('0x18')&&typeof _0xcfb9dc[_0x131f('0x19')]===_0x131f('0x18');var _0x2614df=_0x539eb6[_0x131f('0x1a')];var _0xacf663=_0x51cad8?0x0:_0xcfb9dc[_0x131f('0x17')];var _0x5437b9=_0x51cad8?_0x539eb6[_0x131f('0x1a')]:_0xcfb9dc['offset']+_0xcfb9dc[_0x131f('0x19')];var _0x312381;if(_0x5437b9>=_0x2614df){_0x5437b9=_0x2614df;_0x312381=0xc8;}else{_0x312381=0xce;}_0x2e69b0[_0x131f('0x15')](_0x312381);return _0x2e69b0['set'](_0x131f('0x1b'),_0xacf663+'-'+_0x5437b9+'/'+_0x2614df)[_0x131f('0x16')](_0x539eb6);}return null;};}function patchUpdates(_0x49361a){return function(_0x4acfa6){try{jsonpatch[_0x131f('0x1c')](_0x4acfa6,_0x49361a,!![]);}catch(_0x2af6fb){return BPromise['reject'](_0x2af6fb);}return _0x4acfa6['save']();};}function saveUpdates(_0x54501f,_0x4afbea){return function(_0x2f58d4){if(_0x2f58d4){return _0x2f58d4[_0x131f('0x1d')](_0x54501f)['then'](function(_0x4a6cdf){return _0x4a6cdf;});}return null;};}function removeEntity(_0x340848,_0x1cfd32){return function(_0x537da6){if(_0x537da6){return _0x537da6['destroy']()[_0x131f('0x1e')](function(){_0x340848[_0x131f('0x15')](0xcc)[_0x131f('0x1f')]();});}};}function handleEntityNotFound(_0x35c438,_0x590853){return function(_0x44d47f){if(!_0x44d47f){_0x35c438[_0x131f('0x14')](0x194);}return _0x44d47f;};}function handleError(_0x45cc0b,_0x27b6cb){_0x27b6cb=_0x27b6cb||0x1f4;return function(_0xc2f8a4){logger[_0x131f('0x20')](_0xc2f8a4[_0x131f('0x21')]);if(_0xc2f8a4[_0x131f('0x22')]){delete _0xc2f8a4['name'];}_0x45cc0b[_0x131f('0x15')](_0x27b6cb)[_0x131f('0x23')](_0xc2f8a4);};}exports[_0x131f('0x24')]=function(_0x46b384,_0x3ea108){var _0x3d9583={},_0x4b83ce={},_0x574bf6={'count':0x0,'rows':[]};var _0x24064e=_[_0x131f('0x25')](db[_0x131f('0x26')][_0x131f('0x27')],function(_0x39b951){return{'name':_0x39b951[_0x131f('0x28')],'type':_0x39b951[_0x131f('0x29')][_0x131f('0x2a')]};});_0x4b83ce['model']=_[_0x131f('0x25')](_0x24064e,_0x131f('0x22'));_0x4b83ce[_0x131f('0x2b')]=_[_0x131f('0x2c')](_0x46b384[_0x131f('0x2b')]);_0x4b83ce[_0x131f('0x2d')]=_[_0x131f('0x2e')](_0x4b83ce[_0x131f('0x2f')],_0x4b83ce[_0x131f('0x2b')]);_0x3d9583[_0x131f('0x30')]=_[_0x131f('0x2e')](_0x4b83ce[_0x131f('0x2f')],qs[_0x131f('0x31')](_0x46b384[_0x131f('0x2b')][_0x131f('0x31')]));_0x3d9583[_0x131f('0x30')]=_0x3d9583['attributes'][_0x131f('0x32')]?_0x3d9583['attributes']:_0x4b83ce['model'];if(!_0x46b384['query'][_0x131f('0x33')]('nolimit')){_0x3d9583[_0x131f('0x19')]=qs['limit'](_0x46b384[_0x131f('0x2b')][_0x131f('0x19')]);_0x3d9583[_0x131f('0x17')]=qs[_0x131f('0x17')](_0x46b384[_0x131f('0x2b')][_0x131f('0x17')]);}_0x3d9583[_0x131f('0x34')]=qs[_0x131f('0x35')](_0x46b384[_0x131f('0x2b')][_0x131f('0x35')]);_0x3d9583['where']=qs[_0x131f('0x2d')](_['pick'](_0x46b384[_0x131f('0x2b')],_0x4b83ce[_0x131f('0x2d')]),_0x24064e);if(_0x46b384[_0x131f('0x2b')][_0x131f('0x36')]){_0x3d9583[_0x131f('0x37')]=_[_0x131f('0x38')](_0x3d9583[_0x131f('0x37')],{'$or':_[_0x131f('0x25')](_0x24064e,function(_0x56bc44){if(_0x56bc44[_0x131f('0x29')]!==_0x131f('0x39')){var _0x1655cd={};_0x1655cd[_0x56bc44[_0x131f('0x22')]]={'$like':'%'+_0x46b384[_0x131f('0x2b')][_0x131f('0x36')]+'%'};return _0x1655cd;}})});}_0x3d9583=_['merge']({},_0x3d9583,_0x46b384['options']);var _0x1c0c81={'where':_0x3d9583['where']};return db[_0x131f('0x26')][_0x131f('0x1a')](_0x1c0c81)[_0x131f('0x1e')](function(_0xc8885e){_0x574bf6[_0x131f('0x1a')]=_0xc8885e;if(_0x46b384[_0x131f('0x2b')][_0x131f('0x3a')]){_0x3d9583[_0x131f('0x3b')]=[{'all':!![]}];}return db[_0x131f('0x26')][_0x131f('0x3c')](_0x3d9583);})[_0x131f('0x1e')](function(_0x350782){_0x574bf6['rows']=_0x350782;return _0x574bf6;})[_0x131f('0x1e')](respondWithFilteredResult(_0x3ea108,_0x3d9583))[_0x131f('0x3d')](handleError(_0x3ea108,null));};exports[_0x131f('0x3e')]=function(_0x37cb0a,_0x55240a){var _0x2bc97a={'raw':!![],'where':{'id':_0x37cb0a[_0x131f('0x3f')]['id']}},_0x586147={};_0x586147[_0x131f('0x2f')]=_[_0x131f('0x2c')](db[_0x131f('0x26')][_0x131f('0x27')]);_0x586147[_0x131f('0x2b')]=_['keys'](_0x37cb0a[_0x131f('0x2b')]);_0x586147['filters']=_[_0x131f('0x2e')](_0x586147['model'],_0x586147[_0x131f('0x2b')]);_0x2bc97a[_0x131f('0x30')]=_[_0x131f('0x2e')](_0x586147[_0x131f('0x2f')],qs[_0x131f('0x31')](_0x37cb0a['query'][_0x131f('0x31')]));_0x2bc97a[_0x131f('0x30')]=_0x2bc97a[_0x131f('0x30')]['length']?_0x2bc97a[_0x131f('0x30')]:_0x586147[_0x131f('0x2f')];if(_0x37cb0a[_0x131f('0x2b')][_0x131f('0x3a')]){_0x2bc97a[_0x131f('0x3b')]=[{'all':!![]}];}_0x2bc97a=_[_0x131f('0x38')]({},_0x2bc97a,_0x37cb0a[_0x131f('0x40')]);return db[_0x131f('0x26')]['find'](_0x2bc97a)['then'](handleEntityNotFound(_0x55240a,null))['then'](respondWithResult(_0x55240a,null))[_0x131f('0x3d')](handleError(_0x55240a,null));};exports[_0x131f('0x41')]=function(_0x5cee0e,_0x33f6d4){return db['VoiceTransferReport']['create'](_0x5cee0e[_0x131f('0x42')],{})[_0x131f('0x1e')](respondWithResult(_0x33f6d4,0xc9))[_0x131f('0x3d')](handleError(_0x33f6d4,null));};exports['update']=function(_0x55b1b9,_0x250cd4){if(_0x55b1b9['body']['id']){delete _0x55b1b9[_0x131f('0x42')]['id'];}return db['VoiceTransferReport'][_0x131f('0x43')]({'where':{'id':_0x55b1b9[_0x131f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x250cd4,null))[_0x131f('0x1e')](saveUpdates(_0x55b1b9[_0x131f('0x42')],null))[_0x131f('0x1e')](respondWithResult(_0x250cd4,null))[_0x131f('0x3d')](handleError(_0x250cd4,null));};exports[_0x131f('0x44')]=function(_0x218230,_0x2f45c8){return db[_0x131f('0x26')][_0x131f('0x43')]({'where':{'id':_0x218230[_0x131f('0x3f')]['id']}})[_0x131f('0x1e')](handleEntityNotFound(_0x2f45c8,null))[_0x131f('0x1e')](removeEntity(_0x2f45c8,null))[_0x131f('0x3d')](handleError(_0x2f45c8,null));};exports[_0x131f('0x45')]=function(_0x597e6d,_0x2537f8){return db[_0x131f('0x26')][_0x131f('0x45')]()[_0x131f('0x1e')](respondWithResult(_0x2537f8,null))['catch'](handleError(_0x2537f8,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 31e682f..d3e907e 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 _0x32cc=['util','api','bluebird','path','rimraf','../../config/environment','define','VoiceTransferReport','report_call_transfer','lodash'];(function(_0x171fdc,_0x16ae91){var _0x3782ea=function(_0x58b691){while(--_0x58b691){_0x171fdc['push'](_0x171fdc['shift']());}};_0x3782ea(++_0x16ae91);}(_0x32cc,0x1f3));var _0xc32c=function(_0x56a332,_0x486239){_0x56a332=_0x56a332-0x0;var _0x46612b=_0x32cc[_0x56a332];return _0x46612b;};'use strict';var _=require(_0xc32c('0x0'));var util=require(_0xc32c('0x1'));var logger=require('../../config/logger')(_0xc32c('0x2'));var moment=require('moment');var BPromise=require(_0xc32c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc32c('0x4'));var rimraf=require(_0xc32c('0x5'));var config=require(_0xc32c('0x6'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x48bff0,_0x26767b){return _0x48bff0[_0xc32c('0x7')](_0xc32c('0x8'),attributes,{'tableName':_0xc32c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c27=['exports','VoiceTransferReport','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voiceTransferReport.attributes'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x5c27,0xad));var _0x75c2=function(_0x102123,_0x5c1a48){_0x102123=_0x102123-0x0;var _0x151fee=_0x5c27[_0x102123];return _0x151fee;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x75c2('0x0'))(_0x75c2('0x1'));var moment=require(_0x75c2('0x2'));var BPromise=require(_0x75c2('0x3'));var rp=require(_0x75c2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x75c2('0x5'));var attributes=require(_0x75c2('0x6'));module[_0x75c2('0x7')]=function(_0x5ddcc9,_0x4a338e){return _0x5ddcc9['define'](_0x75c2('0x8'),attributes,{'tableName':'report_call_transfer','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 03edb3a..4548aeb 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 _0x620b=['error','code','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','debug','stringify','lodash','util','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x291374,_0x149155){var _0x239be2=function(_0x18ec2c){while(--_0x18ec2c){_0x291374['push'](_0x291374['shift']());}};_0x239be2(++_0x149155);}(_0x620b,0xf1));var _0xb620=function(_0x4684b9,_0x5b7c54){_0x4684b9=_0x4684b9-0x0;var _0x12b748=_0x620b[_0x4684b9];return _0x12b748;};'use strict';var _=require(_0xb620('0x0'));var util=require(_0xb620('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb620('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb620('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb620('0x4'))('rpc');var config=require(_0xb620('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb620('0x6')][_0xb620('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5ccccb,_0x69141a,_0x3685a5){return new BPromise(function(_0x4339cd,_0x52348e){return client[_0xb620('0x8')](_0x5ccccb,_0x3685a5)[_0xb620('0x9')](function(_0x2933fd){logger['info'](_0xb620('0xa'),_0x69141a,'request\x20sent');logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x69141a,_0xb620('0xb'),JSON['stringify'](_0x2933fd));if(_0x2933fd['error']){if(_0x2933fd[_0xb620('0xc')][_0xb620('0xd')]===0x1f4){logger[_0xb620('0xc')](_0xb620('0xa'),_0x69141a,_0x2933fd[_0xb620('0xc')][_0xb620('0xe')]);return _0x52348e(_0x2933fd['error'][_0xb620('0xe')]);}logger[_0xb620('0xc')](_0xb620('0xa'),_0x69141a,_0x2933fd['error'][_0xb620('0xe')]);return _0x4339cd(_0x2933fd[_0xb620('0xc')][_0xb620('0xe')]);}else{logger['info'](_0xb620('0xa'),_0x69141a,_0xb620('0xb'));_0x4339cd(_0x2933fd[_0xb620('0xf')]['message']);}})['catch'](function(_0x267436){logger[_0xb620('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x69141a,_0x267436);_0x52348e(_0x267436);});});}exports[_0xb620('0x10')]=function(_0x331243){var _0x3c3086=this;return new Promise(function(_0x7c7cce,_0x668984){return db[_0xb620('0x11')][_0xb620('0x12')](_0x331243['body'],{'raw':_0x331243[_0xb620('0x13')]?_0x331243['options'][_0xb620('0x14')]===undefined?!![]:![]:!![]})[_0xb620('0x9')](function(_0x4398df){logger['info'](_0xb620('0x10'),_0x331243);logger[_0xb620('0x15')](_0xb620('0x10'),_0x331243,JSON[_0xb620('0x16')](_0x4398df));_0x7c7cce(_0x4398df);})['catch'](function(_0x2a0888){logger[_0xb620('0xc')]('CreateVoiceTransferReport',_0x2a0888['message'],_0x331243);_0x668984(_0x3c3086[_0xb620('0xc')](0x1f4,_0x2a0888['message']));});});}; \ No newline at end of file +var _0xe897=['CreateVoiceTransferReport','VoiceTransferReport','create','options','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x502e4d,_0x552eec){var _0x18ebe4=function(_0xb5e067){while(--_0xb5e067){_0x502e4d['push'](_0x502e4d['shift']());}};_0x18ebe4(++_0x552eec);}(_0xe897,0xf7));var _0x7e89=function(_0x5111e8,_0x5915d5){_0x5111e8=_0x5111e8-0x0;var _0x4978dd=_0xe897[_0x5111e8];return _0x4978dd;};'use strict';var _=require(_0x7e89('0x0'));var util=require(_0x7e89('0x1'));var moment=require(_0x7e89('0x2'));var BPromise=require(_0x7e89('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e89('0x4'));var db=require(_0x7e89('0x5'))['db'];var utils=require(_0x7e89('0x6'));var logger=require(_0x7e89('0x7'))('rpc');var config=require(_0x7e89('0x8'));var jayson=require(_0x7e89('0x9'));var client=jayson[_0x7e89('0xa')][_0x7e89('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5813c8,_0x350d8c,_0x3753b4){return new BPromise(function(_0x4b4403,_0x383b72){return client[_0x7e89('0xc')](_0x5813c8,_0x3753b4)['then'](function(_0x39f007){logger[_0x7e89('0xd')](_0x7e89('0xe'),_0x350d8c,_0x7e89('0xf'));logger[_0x7e89('0x10')](_0x7e89('0x11'),_0x350d8c,_0x7e89('0xf'),JSON[_0x7e89('0x12')](_0x39f007));if(_0x39f007['error']){if(_0x39f007[_0x7e89('0x13')][_0x7e89('0x14')]===0x1f4){logger[_0x7e89('0x13')](_0x7e89('0xe'),_0x350d8c,_0x39f007[_0x7e89('0x13')]['message']);return _0x383b72(_0x39f007[_0x7e89('0x13')][_0x7e89('0x15')]);}logger[_0x7e89('0x13')](_0x7e89('0xe'),_0x350d8c,_0x39f007['error'][_0x7e89('0x15')]);return _0x4b4403(_0x39f007['error'][_0x7e89('0x15')]);}else{logger[_0x7e89('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x350d8c,'request\x20sent');_0x4b4403(_0x39f007[_0x7e89('0x16')][_0x7e89('0x15')]);}})['catch'](function(_0x3fc886){logger[_0x7e89('0x13')](_0x7e89('0xe'),_0x350d8c,_0x3fc886);_0x383b72(_0x3fc886);});});}exports[_0x7e89('0x17')]=function(_0x50b8d3){var _0x17f9fd=this;return new Promise(function(_0x3eec05,_0x3cb504){return db[_0x7e89('0x18')][_0x7e89('0x19')](_0x50b8d3['body'],{'raw':_0x50b8d3[_0x7e89('0x1a')]?_0x50b8d3[_0x7e89('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x36d3ad){logger[_0x7e89('0xd')]('CreateVoiceTransferReport',_0x50b8d3);logger[_0x7e89('0x10')](_0x7e89('0x17'),_0x50b8d3,JSON[_0x7e89('0x12')](_0x36d3ad));_0x3eec05(_0x36d3ad);})['catch'](function(_0x4be996){logger['error'](_0x7e89('0x17'),_0x4be996[_0x7e89('0x15')],_0x50b8d3);_0x3cb504(_0x17f9fd[_0x7e89('0x13')](0x1f4,_0x4be996['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 7111691..45e8e0d 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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb43b,0x1b2));var _0xbb43=function(_0x522b0a,_0x3b9acd){_0x522b0a=_0x522b0a-0x0;var _0x1037a5=_0xb43b[_0x522b0a];return _0x1037a5;};'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 _0xe5b3=['transfer','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','answer','hold','/unhold','unhold','/calls','calls','/transfer'];(function(_0x46dc12,_0x55ccc3){var _0x4c1b0e=function(_0x2aa0cd){while(--_0x2aa0cd){_0x46dc12['push'](_0x46dc12['shift']());}};_0x4c1b0e(++_0x55ccc3);}(_0xe5b3,0x133));var _0x3e5b=function(_0x13cfcd,_0x2c3d5d){_0x13cfcd=_0x13cfcd-0x0;var _0x3b4a88=_0xe5b3[_0x13cfcd];return _0x3b4a88;};'use strict';var express=require('express');var router=express[_0x3e5b('0x0')]();var auth=require(_0x3e5b('0x1'));var controller=require(_0x3e5b('0x2'));router[_0x3e5b('0x3')](_0x3e5b('0x4'),auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0x7')]);router[_0x3e5b('0x3')](_0x3e5b('0x8'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0x9')]);router[_0x3e5b('0x3')]('/answer',auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xa')]);router[_0x3e5b('0x3')]('/hold',auth['isAuthenticated'](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xb')]);router[_0x3e5b('0x3')](_0x3e5b('0xc'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0xd')]);router['post'](_0x3e5b('0xe'),auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xf')]);router[_0x3e5b('0x3')](_0x3e5b('0x10'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 5138955..a0e30b3 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 _0xc874=['filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callerId','callbackUrl','info','format','webbar:originate','originate\x20executed!','hangup','validate','webbar:hangup','hangup\x20executed!','answer','entityFound:','user:%s','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','../../mysqldb','../../config/environment','jayson/promise','client','http','webbarapi','ioredis','defaults','redis','localhost','socket.io-emitter','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','stringify','emit','log','error','stack','name','send','status','NotFound','request','then','code','message','result','catch','User','findOne','VoiceChannels'];(function(_0x3c56a7,_0x3a1afb){var _0x614a1f=function(_0x69721a){while(--_0x69721a){_0x3c56a7['push'](_0x3c56a7['shift']());}};_0x614a1f(++_0x3a1afb);}(_0xc874,0x154));var _0x4c87=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xc874[_0x4dcc2d];return _0x1bbd79;};'use strict';var path=require(_0x4c87('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x4c87('0x1'))['db'];var config=require(_0x4c87('0x2'));var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x4c87('0x3'));var amiClient=jayson[_0x4c87('0x4')][_0x4c87('0x5')]({'port':0x232a});var logger=require('../../config/logger')(_0x4c87('0x6'));var Redis=require(_0x4c87('0x7'));config['redis']=_[_0x4c87('0x8')](config[_0x4c87('0x9')],{'host':_0x4c87('0xa'),'port':0x18eb});var io=require(_0x4c87('0xb'))(new Redis(config[_0x4c87('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x4c87('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x4c87('0xd'),'required':[!![],_0x4c87('0xe')]},'callerId':{'type':_0x4c87('0xd')},'callbackUrl':{'type':_0x4c87('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x4c87('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x4c87('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x4c87('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x4c87('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x4c87('0xc'),'required':[!![],_0x4c87('0xf')]},'sessionId':{'type':_0x4c87('0xd'),'required':[!![],_0x4c87('0x10')]},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4c87('0xf')]},'sessionId':{'type':_0x4c87('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x4c87('0xc'),'required':[!![],_0x4c87('0xf')]},'sessionId':{'type':_0x4c87('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x4c87('0xc'),'required':[!![],_0x4c87('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x4c87('0xc'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x27abb9,_0x3c32cc,_0x585705){logger['info'](_0x27abb9,_0x3c32cc,JSON[_0x4c87('0x11')](_0x585705));io['to'](_0x27abb9)[_0x4c87('0x12')](_0x3c32cc,_0x585705);}function handleError(_0x2b55fa){return function(_0x547d92){console[_0x4c87('0x13')]('handleError:',_0x547d92,_0x547d92 instanceof RangeError);logger[_0x4c87('0x14')](_0x547d92[_0x4c87('0x15')]);if(_0x547d92 instanceof RangeError){if(_0x547d92[_0x4c87('0x16')]){delete _0x547d92[_0x4c87('0x16')];}_0x2b55fa['status'](0x194)[_0x4c87('0x17')](_0x547d92);}else{if(_0x547d92[_0x4c87('0x16')]){delete _0x547d92[_0x4c87('0x16')];}_0x2b55fa[_0x4c87('0x18')](0x1f4)[_0x4c87('0x17')](_0x547d92);}};}function checkError(){return function(_0x22fac7){if(!_0x22fac7){throw new RangeError(_0x4c87('0x19'));}return _0x22fac7;};}function respondWithRpcPromise(_0x9da0d6,_0x50289b){return new BPromise(function(_0x353ac9,_0x33aafd){var _0x5cc15d=amiClient;return _0x5cc15d[_0x4c87('0x1a')](_0x9da0d6,_0x50289b)[_0x4c87('0x1b')](function(_0x5a9496){if(_0x5a9496[_0x4c87('0x14')]){if(_0x5a9496[_0x4c87('0x14')][_0x4c87('0x1c')]===0x1f4){return _0x33aafd(_0x5a9496[_0x4c87('0x14')]['message']);}return _0x353ac9(_0x5a9496[_0x4c87('0x14')][_0x4c87('0x1d')]);}else{_0x353ac9(_0x5a9496[_0x4c87('0x1e')]);}})[_0x4c87('0x1f')](function(_0x637dbc){_0x33aafd(_0x637dbc);});});}function getAgent(_0x3eb09e){return db[_0x4c87('0x20')][_0x4c87('0x21')]({'where':{'id':_0x3eb09e,'role':'agent'}})[_0x4c87('0x1b')](checkError());}function getAgentCheckSession(_0x47ef54,_0x27f13d){return new BPromise(function(_0x381af7,_0x3a9520){var _0x1f246e=respondWithRpcPromise(_0x4c87('0x22'));var _0x583371=getAgent(_0x47ef54);Promise['all']([_0x1f246e,_0x583371])[_0x4c87('0x1b')](function(_0x23483e){var _0x2e3549=_0x23483e[0x0];var _0x106121=_0x23483e[0x1];var _0xa7eb3=_[_0x4c87('0x23')](_0x2e3549[_0x4c87('0x24')],function(_0x10aea2){return _0x10aea2[_0x4c87('0x25')]==_0x106121['id']&&_0x10aea2[_0x4c87('0x26')]==_0x27f13d;});if(_0xa7eb3[_0x4c87('0x27')]==0x1){_0x381af7(_0x106121);}else{_0x3a9520(new RangeError(_0x4c87('0x28')+_0x27f13d+_0x4c87('0x29')));}});});}exports[_0x4c87('0x2a')]=function(_0x3a1aaf,_0x185590){logger['info'](_0x4c87('0x2b'),_0x3a1aaf['body']);var _0x110b84=originateValidation['validate'](_0x3a1aaf[_0x4c87('0x2c')]);if(_0x110b84[_0x4c87('0x27')]>0x0){return _0x185590[_0x4c87('0x18')](0x190)[_0x4c87('0x2d')](_0x110b84);}var _0x58eb98=_0x3a1aaf[_0x4c87('0x2c')][_0x4c87('0x2e')];var _0x2f307a=_0x3a1aaf[_0x4c87('0x2c')]['callNumber'];var _0x2060f8=_0x3a1aaf[_0x4c87('0x2c')][_0x4c87('0x2f')];var _0x30fdba=_0x3a1aaf['body'][_0x4c87('0x30')];return getAgent(_0x58eb98)[_0x4c87('0x1b')](function(_0x5fb196){logger[_0x4c87('0x31')]('entityFound:',_0x5fb196['name']);emit(util[_0x4c87('0x32')]('user:%s',_0x5fb196[_0x4c87('0x16')]),_0x4c87('0x33'),{'callNumber':_0x2f307a,'callerId':_0x2060f8,'callbackUrl':_0x30fdba});return _0x185590[_0x4c87('0x18')](0xc8)[_0x4c87('0x2d')]({'error':![],'message':_0x4c87('0x34')});})['catch'](handleError(_0x185590));};exports[_0x4c87('0x35')]=function(_0x11a632,_0xcc73b5){logger['info']('hangup\x20fired:',_0x11a632[_0x4c87('0x2c')]);var _0x2da03f=hangupValidation[_0x4c87('0x36')](_0x11a632['body']);if(_0x2da03f[_0x4c87('0x27')]>0x0){return _0xcc73b5['status'](0x190)['json'](_0x2da03f);}var _0x5bbd35=_0x11a632[_0x4c87('0x2c')][_0x4c87('0x2e')];var _0x2de50d=_0x11a632['body'][_0x4c87('0x26')];return getAgent(_0x5bbd35)[_0x4c87('0x1b')](function(_0x5de7b1){logger[_0x4c87('0x31')]('entityFound:',_0x5de7b1['name']);emit(util[_0x4c87('0x32')]('user:%s',_0x5de7b1[_0x4c87('0x16')]),_0x4c87('0x37'),{'sessionId':_0x2de50d});return _0xcc73b5['status'](0xc8)[_0x4c87('0x2d')]({'error':![],'message':_0x4c87('0x38')});})['catch'](handleError(_0xcc73b5));};exports[_0x4c87('0x39')]=function(_0x5a70b7,_0x521944){logger[_0x4c87('0x31')]('answer\x20fired:',_0x5a70b7['body']);var _0x35c74b=answerValidation[_0x4c87('0x36')](_0x5a70b7['body']);if(_0x35c74b[_0x4c87('0x27')]>0x0){return _0x521944[_0x4c87('0x18')](0x190)[_0x4c87('0x2d')](_0x35c74b);}var _0x45b950=_0x5a70b7['body'][_0x4c87('0x2e')];var _0x448208=_0x5a70b7[_0x4c87('0x2c')][_0x4c87('0x26')];return getAgent(_0x45b950)['then'](function(_0x33716e){logger[_0x4c87('0x31')](_0x4c87('0x3a'),_0x33716e['name']);emit(util[_0x4c87('0x32')](_0x4c87('0x3b'),_0x33716e[_0x4c87('0x16')]),_0x4c87('0x3c'),{'sessionId':_0x448208});return _0x521944['status'](0xc8)[_0x4c87('0x2d')]({'error':![],'message':_0x4c87('0x3d')});})[_0x4c87('0x1f')](handleError(_0x521944));};exports['hold']=function(_0x507686,_0x41cfe9){logger[_0x4c87('0x31')](_0x4c87('0x3e'),_0x507686[_0x4c87('0x2c')]);var _0x52bac1=holdValidation['validate'](_0x507686[_0x4c87('0x2c')]);if(_0x52bac1[_0x4c87('0x27')]>0x0){return _0x41cfe9[_0x4c87('0x18')](0x190)[_0x4c87('0x2d')](_0x52bac1);}var _0x2c7eef=_0x507686[_0x4c87('0x2c')][_0x4c87('0x2e')];var _0x290761=_0x507686[_0x4c87('0x2c')][_0x4c87('0x26')];return getAgent(_0x2c7eef)['then'](function(_0x20f4f2){logger[_0x4c87('0x31')](_0x4c87('0x3a'),_0x20f4f2[_0x4c87('0x16')]);emit(util['format'](_0x4c87('0x3b'),_0x20f4f2[_0x4c87('0x16')]),_0x4c87('0x3f'),{'sessionId':_0x290761});return _0x41cfe9['status'](0xc8)[_0x4c87('0x2d')]({'error':![],'message':_0x4c87('0x40')});})[_0x4c87('0x1f')](handleError(_0x41cfe9));};exports['unhold']=function(_0x31f23a,_0x1b5843){logger[_0x4c87('0x31')]('unhold\x20fired:',_0x31f23a['body']);var _0x578b39=unholdValidation['validate'](_0x31f23a['body']);if(_0x578b39[_0x4c87('0x27')]>0x0){return _0x1b5843[_0x4c87('0x18')](0x190)['json'](_0x578b39);}var _0x59545c=_0x31f23a[_0x4c87('0x2c')][_0x4c87('0x2e')];var _0x205419=_0x31f23a[_0x4c87('0x2c')][_0x4c87('0x26')];return getAgent(_0x59545c)[_0x4c87('0x1b')](function(_0x64642a){logger[_0x4c87('0x31')]('entityFound:',_0x64642a['name']);emit(util[_0x4c87('0x32')](_0x4c87('0x3b'),_0x64642a[_0x4c87('0x16')]),_0x4c87('0x41'),{'sessionId':_0x205419});return _0x1b5843[_0x4c87('0x18')](0xc8)[_0x4c87('0x2d')]({'error':![],'message':_0x4c87('0x42')});})[_0x4c87('0x1f')](handleError(_0x1b5843));};exports[_0x4c87('0x43')]=function(_0x2a4bf1,_0x4aa6e3){logger['info'](_0x4c87('0x44'),_0x4aa6e3['body']);var _0x3fae0d=callsValidation[_0x4c87('0x36')](_0x2a4bf1[_0x4c87('0x2c')]);if(_0x3fae0d['length']>0x0){return _0x4aa6e3[_0x4c87('0x18')](0x190)[_0x4c87('0x2d')](_0x3fae0d);}var _0x3d407a=_0x2a4bf1[_0x4c87('0x2c')][_0x4c87('0x2e')];var _0x67c32d=respondWithRpcPromise(_0x4c87('0x22'));var _0x4e552a=getAgent(_0x3d407a);return Promise['all']([_0x67c32d,_0x4e552a])[_0x4c87('0x1b')](function(_0x2fb4a){var _0x253e8b=_0x2fb4a[0x0];var _0x197c0d=_0x2fb4a[0x1];var _0x16be71=_[_0x4c87('0x23')](_0x253e8b[_0x4c87('0x24')],function(_0x1f7b9b){return _0x1f7b9b[_0x4c87('0x25')]==_0x197c0d['id'];});return _0x4aa6e3[_0x4c87('0x18')](0xc8)[_0x4c87('0x2d')]({'count':_0x16be71[_0x4c87('0x27')],'rows':_0x16be71});})[_0x4c87('0x1f')](handleError(_0x4aa6e3));};exports['conference']=function(_0x37b319,_0x24c52a){logger[_0x4c87('0x31')](_0x4c87('0x45'),_0x37b319[_0x4c87('0x2c')]);var _0x1d71e5=conferenceValidation[_0x4c87('0x36')](_0x37b319['body']);if(_0x1d71e5['length']>0x0){return _0x24c52a[_0x4c87('0x18')](0x190)['json'](_0x1d71e5);}var _0x53e6ba=_0x37b319['body'][_0x4c87('0x2e')];return getAgent(_0x53e6ba)[_0x4c87('0x1b')](function(_0x20c0b6){logger[_0x4c87('0x31')](_0x4c87('0x3a'),_0x20c0b6['name']);emit(util['format'](_0x4c87('0x3b'),_0x20c0b6['name']),'webbar:conference');return _0x24c52a['status'](0xc8)[_0x4c87('0x2d')]({'error':![],'message':_0x4c87('0x46')});})[_0x4c87('0x1f')](handleError(_0x24c52a));};exports[_0x4c87('0x47')]=function(_0x44a2c7,_0x4ed555){logger['info'](_0x4c87('0x48'),_0x44a2c7[_0x4c87('0x2c')]);var _0xdf24be=transferValidation[_0x4c87('0x36')](_0x44a2c7['body']);if(_0xdf24be['length']>0x0){return _0x4ed555[_0x4c87('0x18')](0x190)['json'](_0xdf24be);}var _0x30773f=_0x44a2c7[_0x4c87('0x2c')]['userId'];var _0x10b898=_0x44a2c7['body'][_0x4c87('0x26')];var _0x38dfad=_0x44a2c7[_0x4c87('0x2c')][_0x4c87('0x49')];return getAgent(_0x30773f)['then'](function(_0x44a493){logger[_0x4c87('0x31')](_0x4c87('0x3a'),_0x44a493[_0x4c87('0x16')]);emit(util[_0x4c87('0x32')](_0x4c87('0x3b'),_0x44a493['name']),'webbar:transfer',{'sessionId':_0x10b898,'transferNumber':_0x38dfad});return _0x4ed555[_0x4c87('0x18')](0xc8)[_0x4c87('0x2d')]({'error':![],'message':_0x4c87('0x4a')});})['catch'](handleError(_0x4ed555));}; \ No newline at end of file +var _0xca66=['sessionId\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','code','message','result','catch','User','findOne','agent','all','filter','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','callNumber','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','hangup','hangup\x20fired:','validate','then','format','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','userId','sessionId','answer\x20executed!','hold','webbar:hold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','VoiceChannels','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transferNumber','transfer\x20executed!','path','../../config/environment','util','bluebird','client','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required'];(function(_0x10a889,_0x220612){var _0x3b5ed3=function(_0x4f0137){while(--_0x4f0137){_0x10a889['push'](_0x10a889['shift']());}};_0x3b5ed3(++_0x220612);}(_0xca66,0x8b));var _0x6ca6=function(_0x1fb9b0,_0x22ffd7){_0x1fb9b0=_0x1fb9b0-0x0;var _0x37ce00=_0xca66[_0x1fb9b0];return _0x37ce00;};'use strict';var path=require(_0x6ca6('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0x6ca6('0x1'));var util=require(_0x6ca6('0x2'));var BPromise=require(_0x6ca6('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x6ca6('0x4')]['http']({'port':0x232a});var logger=require(_0x6ca6('0x5'))('webbarapi');var Redis=require(_0x6ca6('0x6'));config[_0x6ca6('0x7')]=_[_0x6ca6('0x8')](config[_0x6ca6('0x7')],{'host':_0x6ca6('0x9'),'port':0x18eb});var io=require(_0x6ca6('0xa'))(new Redis(config[_0x6ca6('0x7')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'callNumber':{'type':_0x6ca6('0xd'),'required':[!![],_0x6ca6('0xe')]},'callerId':{'type':_0x6ca6('0xd')},'callbackUrl':{'type':_0x6ca6('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x6ca6('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'sessionId':{'type':_0x6ca6('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'sessionId':{'type':'string','required':[!![],_0x6ca6('0xf')]},'transferNumber':{'type':_0x6ca6('0xd'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'sessionId':{'type':_0x6ca6('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'sessionId':{'type':_0x6ca6('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6ca6('0xc')]}});function emit(_0x19e94f,_0x260b56,_0x3f03e6){logger[_0x6ca6('0x10')](_0x19e94f,_0x260b56,JSON[_0x6ca6('0x11')](_0x3f03e6));io['to'](_0x19e94f)[_0x6ca6('0x12')](_0x260b56,_0x3f03e6);}function handleError(_0x4f056d){return function(_0x2391ce){console[_0x6ca6('0x13')](_0x6ca6('0x14'),_0x2391ce,_0x2391ce instanceof RangeError);logger[_0x6ca6('0x15')](_0x2391ce[_0x6ca6('0x16')]);if(_0x2391ce instanceof RangeError){if(_0x2391ce[_0x6ca6('0x17')]){delete _0x2391ce[_0x6ca6('0x17')];}_0x4f056d[_0x6ca6('0x18')](0x194)[_0x6ca6('0x19')](_0x2391ce);}else{if(_0x2391ce[_0x6ca6('0x17')]){delete _0x2391ce[_0x6ca6('0x17')];}_0x4f056d['status'](0x1f4)[_0x6ca6('0x19')](_0x2391ce);}};}function checkError(){return function(_0x254afe){if(!_0x254afe){throw new RangeError(_0x6ca6('0x1a'));}return _0x254afe;};}function respondWithRpcPromise(_0x195c92,_0x3a24aa){return new BPromise(function(_0x438694,_0x593f15){var _0xfb962d=amiClient;return _0xfb962d[_0x6ca6('0x1b')](_0x195c92,_0x3a24aa)['then'](function(_0x4927c1){if(_0x4927c1[_0x6ca6('0x15')]){if(_0x4927c1[_0x6ca6('0x15')][_0x6ca6('0x1c')]===0x1f4){return _0x593f15(_0x4927c1[_0x6ca6('0x15')][_0x6ca6('0x1d')]);}return _0x438694(_0x4927c1['error'][_0x6ca6('0x1d')]);}else{_0x438694(_0x4927c1[_0x6ca6('0x1e')]);}})[_0x6ca6('0x1f')](function(_0x2d8c64){_0x593f15(_0x2d8c64);});});}function getAgent(_0x3971a2){return db[_0x6ca6('0x20')][_0x6ca6('0x21')]({'where':{'id':_0x3971a2,'role':_0x6ca6('0x22')}})['then'](checkError());}function getAgentCheckSession(_0x55b07f,_0x144ec5){return new BPromise(function(_0x9467bd,_0xf1d821){var _0x141c0f=respondWithRpcPromise('VoiceChannels');var _0x5ea6f7=getAgent(_0x55b07f);Promise[_0x6ca6('0x23')]([_0x141c0f,_0x5ea6f7])['then'](function(_0x4ab84c){var _0x141e78=_0x4ab84c[0x0];var _0xefd407=_0x4ab84c[0x1];var _0x4a15cb=_[_0x6ca6('0x24')](_0x141e78[_0x6ca6('0x25')],function(_0xac50e8){return _0xac50e8[_0x6ca6('0x26')]==_0xefd407['id']&&_0xac50e8['sessionId']==_0x144ec5;});if(_0x4a15cb[_0x6ca6('0x27')]==0x1){_0x9467bd(_0xefd407);}else{_0xf1d821(new RangeError(_0x6ca6('0x28')+_0x144ec5+_0x6ca6('0x29')));}});});}exports[_0x6ca6('0x2a')]=function(_0x480264,_0x467a89){logger[_0x6ca6('0x10')](_0x6ca6('0x2b'),_0x480264[_0x6ca6('0x2c')]);var _0x5788a2=originateValidation['validate'](_0x480264['body']);if(_0x5788a2['length']>0x0){return _0x467a89['status'](0x190)[_0x6ca6('0x2d')](_0x5788a2);}var _0x3389c2=_0x480264[_0x6ca6('0x2c')]['userId'];var _0x206ecd=_0x480264[_0x6ca6('0x2c')][_0x6ca6('0x2e')];var _0x388e32=_0x480264['body'][_0x6ca6('0x2f')];var _0x40de00=_0x480264[_0x6ca6('0x2c')][_0x6ca6('0x30')];return getAgent(_0x3389c2)['then'](function(_0x1e28b4){logger['info'](_0x6ca6('0x31'),_0x1e28b4['name']);emit(util['format'](_0x6ca6('0x32'),_0x1e28b4[_0x6ca6('0x17')]),_0x6ca6('0x33'),{'callNumber':_0x206ecd,'callerId':_0x388e32,'callbackUrl':_0x40de00});return _0x467a89[_0x6ca6('0x18')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0x6ca6('0x1f')](handleError(_0x467a89));};exports[_0x6ca6('0x34')]=function(_0x49c8a4,_0x43c2cb){logger['info'](_0x6ca6('0x35'),_0x49c8a4['body']);var _0x1ada8b=hangupValidation[_0x6ca6('0x36')](_0x49c8a4[_0x6ca6('0x2c')]);if(_0x1ada8b[_0x6ca6('0x27')]>0x0){return _0x43c2cb[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x1ada8b);}var _0x45e77b=_0x49c8a4[_0x6ca6('0x2c')]['userId'];var _0x2f6daf=_0x49c8a4['body']['sessionId'];return getAgent(_0x45e77b)[_0x6ca6('0x37')](function(_0x306eda){logger['info'](_0x6ca6('0x31'),_0x306eda['name']);emit(util[_0x6ca6('0x38')](_0x6ca6('0x32'),_0x306eda[_0x6ca6('0x17')]),_0x6ca6('0x39'),{'sessionId':_0x2f6daf});return _0x43c2cb['status'](0xc8)['json']({'error':![],'message':_0x6ca6('0x3a')});})[_0x6ca6('0x1f')](handleError(_0x43c2cb));};exports[_0x6ca6('0x3b')]=function(_0x3423e2,_0x4e6d4){logger['info'](_0x6ca6('0x3c'),_0x3423e2[_0x6ca6('0x2c')]);var _0x5bed6e=answerValidation[_0x6ca6('0x36')](_0x3423e2[_0x6ca6('0x2c')]);if(_0x5bed6e[_0x6ca6('0x27')]>0x0){return _0x4e6d4[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x5bed6e);}var _0x3e658e=_0x3423e2[_0x6ca6('0x2c')][_0x6ca6('0x3d')];var _0x1a8b7e=_0x3423e2['body'][_0x6ca6('0x3e')];return getAgent(_0x3e658e)[_0x6ca6('0x37')](function(_0x243661){logger[_0x6ca6('0x10')](_0x6ca6('0x31'),_0x243661[_0x6ca6('0x17')]);emit(util[_0x6ca6('0x38')](_0x6ca6('0x32'),_0x243661['name']),'webbar:answer',{'sessionId':_0x1a8b7e});return _0x4e6d4[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':_0x6ca6('0x3f')});})[_0x6ca6('0x1f')](handleError(_0x4e6d4));};exports[_0x6ca6('0x40')]=function(_0x33f5d5,_0x1f51f4){logger['info']('hold\x20fired:',_0x33f5d5[_0x6ca6('0x2c')]);var _0x42b263=holdValidation['validate'](_0x33f5d5[_0x6ca6('0x2c')]);if(_0x42b263[_0x6ca6('0x27')]>0x0){return _0x1f51f4[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x42b263);}var _0xc1928f=_0x33f5d5[_0x6ca6('0x2c')][_0x6ca6('0x3d')];var _0x5f27f5=_0x33f5d5[_0x6ca6('0x2c')][_0x6ca6('0x3e')];return getAgent(_0xc1928f)[_0x6ca6('0x37')](function(_0x4fde51){logger[_0x6ca6('0x10')]('entityFound:',_0x4fde51[_0x6ca6('0x17')]);emit(util['format']('user:%s',_0x4fde51['name']),_0x6ca6('0x41'),{'sessionId':_0x5f27f5});return _0x1f51f4[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':'hold\x20executed!'});})[_0x6ca6('0x1f')](handleError(_0x1f51f4));};exports['unhold']=function(_0x1f552d,_0x1010a6){logger[_0x6ca6('0x10')](_0x6ca6('0x42'),_0x1f552d[_0x6ca6('0x2c')]);var _0x2e6364=unholdValidation[_0x6ca6('0x36')](_0x1f552d[_0x6ca6('0x2c')]);if(_0x2e6364[_0x6ca6('0x27')]>0x0){return _0x1010a6[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x2e6364);}var _0x5578fb=_0x1f552d[_0x6ca6('0x2c')][_0x6ca6('0x3d')];var _0x1de2ca=_0x1f552d[_0x6ca6('0x2c')][_0x6ca6('0x3e')];return getAgent(_0x5578fb)['then'](function(_0x14d87a){logger[_0x6ca6('0x10')](_0x6ca6('0x31'),_0x14d87a['name']);emit(util['format']('user:%s',_0x14d87a['name']),_0x6ca6('0x43'),{'sessionId':_0x1de2ca});return _0x1010a6[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x1010a6));};exports[_0x6ca6('0x44')]=function(_0x2cbf30,_0x2591de){logger['info'](_0x6ca6('0x45'),_0x2591de['body']);var _0x281759=callsValidation[_0x6ca6('0x36')](_0x2cbf30[_0x6ca6('0x2c')]);if(_0x281759[_0x6ca6('0x27')]>0x0){return _0x2591de['status'](0x190)[_0x6ca6('0x2d')](_0x281759);}var _0x4874d8=_0x2cbf30['body'][_0x6ca6('0x3d')];var _0x11538e=respondWithRpcPromise(_0x6ca6('0x46'));var _0x35854a=getAgent(_0x4874d8);return Promise['all']([_0x11538e,_0x35854a])[_0x6ca6('0x37')](function(_0x1c12ae){var _0x2c4053=_0x1c12ae[0x0];var _0x13d3ea=_0x1c12ae[0x1];var _0x43881a=_[_0x6ca6('0x24')](_0x2c4053[_0x6ca6('0x25')],function(_0x405609){return _0x405609[_0x6ca6('0x26')]==_0x13d3ea['id'];});return _0x2591de[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'count':_0x43881a[_0x6ca6('0x27')],'rows':_0x43881a});})[_0x6ca6('0x1f')](handleError(_0x2591de));};exports[_0x6ca6('0x47')]=function(_0x2eeed6,_0x290c04){logger['info'](_0x6ca6('0x48'),_0x2eeed6[_0x6ca6('0x2c')]);var _0x2f4886=conferenceValidation[_0x6ca6('0x36')](_0x2eeed6[_0x6ca6('0x2c')]);if(_0x2f4886[_0x6ca6('0x27')]>0x0){return _0x290c04[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x2f4886);}var _0x3328ea=_0x2eeed6[_0x6ca6('0x2c')][_0x6ca6('0x3d')];return getAgent(_0x3328ea)[_0x6ca6('0x37')](function(_0x9834d6){logger[_0x6ca6('0x10')](_0x6ca6('0x31'),_0x9834d6[_0x6ca6('0x17')]);emit(util['format'](_0x6ca6('0x32'),_0x9834d6[_0x6ca6('0x17')]),_0x6ca6('0x49'));return _0x290c04[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':_0x6ca6('0x4a')});})['catch'](handleError(_0x290c04));};exports['transfer']=function(_0x509fe3,_0x21f786){logger[_0x6ca6('0x10')]('transfer\x20fired:',_0x509fe3[_0x6ca6('0x2c')]);var _0xc6021a=transferValidation[_0x6ca6('0x36')](_0x509fe3['body']);if(_0xc6021a[_0x6ca6('0x27')]>0x0){return _0x21f786[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0xc6021a);}var _0x1c3064=_0x509fe3[_0x6ca6('0x2c')]['userId'];var _0x514684=_0x509fe3[_0x6ca6('0x2c')][_0x6ca6('0x3e')];var _0x47d420=_0x509fe3[_0x6ca6('0x2c')][_0x6ca6('0x4b')];return getAgent(_0x1c3064)[_0x6ca6('0x37')](function(_0x19e7ac){logger[_0x6ca6('0x10')](_0x6ca6('0x31'),_0x19e7ac[_0x6ca6('0x17')]);emit(util[_0x6ca6('0x38')](_0x6ca6('0x32'),_0x19e7ac['name']),'webbar:transfer',{'sessionId':_0x514684,'transferNumber':_0x47d420});return _0x21f786[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':_0x6ca6('0x4c')});})[_0x6ca6('0x1f')](handleError(_0x21f786));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 86ffe38..03feaa8 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 _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','post','/:id/canned_answers','/:id/users','addAgents','/:id/notify','notify','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x4fa559,_0x5e7a03){var _0x59a8ed=function(_0x29a158){while(--_0x29a158){_0x4fa559['push'](_0x4fa559['shift']());}};_0x59a8ed(++_0x5e7a03);}(_0x9f0e,0x116));var _0xe9f0=function(_0x474859,_0x138c8b){_0x474859=_0x474859-0x0;var _0x9df51a=_0x9f0e[_0x474859];return _0x9df51a;};'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['describe']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0x9')](_0xe9f0('0xe'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x9')]('/:id/canned_answers',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x10')]);router[_0xe9f0('0x9')]('/:id/users',auth[_0xe9f0('0xb')](),controller['getAgents']);router[_0xe9f0('0x9')](_0xe9f0('0x11'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x12')]);router['post']('/',auth[_0xe9f0('0xb')](),controller['create']);router[_0xe9f0('0x13')](_0xe9f0('0xe'),auth[_0xe9f0('0xb')](),controller['addDisposition']);router[_0xe9f0('0x13')](_0xe9f0('0x14'),auth[_0xe9f0('0xb')](),controller['addAnswer']);router[_0xe9f0('0x13')](_0xe9f0('0x15'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x16')]);router[_0xe9f0('0x13')](_0xe9f0('0x11'),auth[_0xe9f0('0xb')](),controller['addApplications']);router[_0xe9f0('0x13')](_0xe9f0('0x17'),controller[_0xe9f0('0x18')]);router['post'](_0xe9f0('0x19'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x1a')]);router[_0xe9f0('0x1b')]('/:id',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x1c')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe9f0('0x1d')]);router[_0xe9f0('0x1e')](_0xe9f0('0xe'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x1f')]);router['delete'](_0xe9f0('0x14'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x20')]);router[_0xe9f0('0x1e')](_0xe9f0('0x15'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x21')]);module[_0xe9f0('0x22')]=router; \ No newline at end of file +var _0xacf4=['./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id/dispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','post','create','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','delete','destroy','removeDispositions','removeAnswers','removeAgents','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x724d7a,_0x2fe1e1){var _0x2e1533=function(_0x4f435a){while(--_0x4f435a){_0x724d7a['push'](_0x724d7a['shift']());}};_0x2e1533(++_0x2fe1e1);}(_0xacf4,0xe7));var _0x4acf=function(_0x50470f,_0x1e0719){_0x50470f=_0x50470f-0x0;var _0x45e97c=_0xacf4[_0x50470f];return _0x45e97c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4acf('0x0'));var timeout=require(_0x4acf('0x1'));var express=require(_0x4acf('0x2'));var router=express[_0x4acf('0x3')]();var fs_extra=require(_0x4acf('0x4'));var auth=require(_0x4acf('0x5'));var interaction=require(_0x4acf('0x6'));var config=require('../../config/environment');var controller=require(_0x4acf('0x7'));router[_0x4acf('0x8')]('/',auth['isAuthenticated'](),controller[_0x4acf('0x9')]);router[_0x4acf('0x8')](_0x4acf('0xa'),auth[_0x4acf('0xb')](),controller[_0x4acf('0xc')]);router['get']('/:id',auth[_0x4acf('0xb')](),controller['show']);router[_0x4acf('0x8')](_0x4acf('0xd'),auth[_0x4acf('0xb')](),controller['getDispositions']);router[_0x4acf('0x8')](_0x4acf('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x4acf('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x4acf('0xf')]);router[_0x4acf('0x8')](_0x4acf('0x10'),auth[_0x4acf('0xb')](),controller[_0x4acf('0x11')]);router[_0x4acf('0x12')]('/',auth[_0x4acf('0xb')](),controller[_0x4acf('0x13')]);router[_0x4acf('0x12')](_0x4acf('0xd'),auth[_0x4acf('0xb')](),controller['addDisposition']);router[_0x4acf('0x12')]('/:id/canned_answers',auth[_0x4acf('0xb')](),controller[_0x4acf('0x14')]);router[_0x4acf('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0x4acf('0x15')]);router[_0x4acf('0x12')](_0x4acf('0x10'),auth['isAuthenticated'](),controller[_0x4acf('0x16')]);router[_0x4acf('0x12')](_0x4acf('0x17'),controller[_0x4acf('0x18')]);router[_0x4acf('0x12')](_0x4acf('0x19'),auth[_0x4acf('0xb')](),controller[_0x4acf('0x1a')]);router[_0x4acf('0x1b')](_0x4acf('0x1c'),auth[_0x4acf('0xb')](),controller['update']);router[_0x4acf('0x1d')](_0x4acf('0x1c'),auth['isAuthenticated'](),controller[_0x4acf('0x1e')]);router[_0x4acf('0x1d')]('/:id/dispositions',auth[_0x4acf('0xb')](),controller[_0x4acf('0x1f')]);router[_0x4acf('0x1d')](_0x4acf('0xe'),auth['isAuthenticated'](),controller[_0x4acf('0x20')]);router[_0x4acf('0x1d')]('/:id/users',auth[_0x4acf('0xb')](),controller[_0x4acf('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index baf09cb..ae996a7 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 _0x6b2d=['BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x1c42c5,_0x2dba7a){var _0x1ddc16=function(_0x3a0287){while(--_0x3a0287){_0x1c42c5['push'](_0x1c42c5['shift']());}};_0x1ddc16(++_0x2dba7a);}(_0x6b2d,0x166));var _0xd6b2=function(_0x38da49,_0xd1407c){_0x38da49=_0x38da49-0x0;var _0x1868dc=_0x6b2d[_0x38da49];return _0x1868dc;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xd6b2('0x0'));module[_0xd6b2('0x1')]={'name':{'type':Sequelize[_0xd6b2('0x2')],'unique':_0xd6b2('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xd6b2('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xd6b2('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xd6b2('0x4')]();}},'phone':{'type':Sequelize[_0xd6b2('0x2')]},'type':{'type':Sequelize[_0xd6b2('0x5')](_0xd6b2('0x6'),_0xd6b2('0x7'))},'accountSid':{'type':Sequelize[_0xd6b2('0x2')]},'baseUrl':{'type':Sequelize[_0xd6b2('0x2')]},'authToken':{'type':Sequelize[_0xd6b2('0x2')]},'notificationTemplate':{'type':Sequelize[_0xd6b2('0x8')],'defaultValue':function(){return _0xd6b2('0x9');}},'notificationSound':{'type':Sequelize[_0xd6b2('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xd6b2('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd6b2('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd6b2('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd6b2('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd6b2('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd6b2('0xb')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xd6b2('0xa')],'defaultValue':![],'comment':_0xd6b2('0xc'),'set':function(_0x22695f){if(!_0x22695f){this[_0xd6b2('0xd')](_0xd6b2('0xe'),null);}this[_0xd6b2('0xd')](_0xd6b2('0xf'),_0x22695f);}},'description':{'type':Sequelize[_0xd6b2('0x2')]}}; \ No newline at end of file +var _0xd98e=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','name','STRING','ENUM','twilio','sinch','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x3a5e11,_0x346470){var _0x2ca2ba=function(_0x334a47){while(--_0x334a47){_0x3a5e11['push'](_0x3a5e11['shift']());}};_0x2ca2ba(++_0x346470);}(_0xd98e,0x1a3));var _0xed98=function(_0x407ea9,_0x5df008){_0x407ea9=_0x407ea9-0x0;var _0x3a5722=_0xd98e[_0x407ea9];return _0x3a5722;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xed98('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xed98('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0xed98('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xed98('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xed98('0x2')]},'type':{'type':Sequelize[_0xed98('0x3')](_0xed98('0x4'),_0xed98('0x5'))},'accountSid':{'type':Sequelize[_0xed98('0x2')]},'baseUrl':{'type':Sequelize[_0xed98('0x2')]},'authToken':{'type':Sequelize[_0xed98('0x2')]},'notificationTemplate':{'type':Sequelize[_0xed98('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xed98('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xed98('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xed98('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xed98('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xed98('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xed98('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xed98('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xed98('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xed98('0x7')],'defaultValue':![],'comment':_0xed98('0x9'),'set':function(_0x3c28a9){if(!_0x3c28a9){this[_0xed98('0xa')](_0xed98('0xb'),null);}this[_0xed98('0xa')](_0xed98('0xc'),_0x3c28a9);}},'description':{'type':Sequelize[_0xed98('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index ee1e057..826251f 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 _0xc71c=['debug','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','WhatsappAccount','includeAll','include','rows','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','WhatsappAccountId','Disposition','findAll','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','stack','finally','json','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','message_id','applications','orderBy','asc','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','twilio','from','From','replace','whatsapp:','MessageSid','notifications','messageId','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','Contacts','updatedAt','list','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','AttachmentId','UserId','User','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','CmList','List','DESC','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','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/environment','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x33dadb,_0x16d0cc){var _0x3d4c4d=function(_0x414c03){while(--_0x414c03){_0x33dadb['push'](_0x33dadb['shift']());}};_0x3d4c4d(++_0x16d0cc);}(_0xc71c,0xa2));var _0xcc71=function(_0x14cfb8,_0x37950f){_0x14cfb8=_0x14cfb8-0x0;var _0x55a359=_0xc71c[_0x14cfb8];return _0x55a359;};'use strict';var emlformat=require(_0xcc71('0x0'));var rimraf=require(_0xcc71('0x1'));var zipdir=require(_0xcc71('0x2'));var jsonpatch=require(_0xcc71('0x3'));var rp=require(_0xcc71('0x4'));var moment=require('moment');var BPromise=require(_0xcc71('0x5'));var Mustache=require(_0xcc71('0x6'));var util=require(_0xcc71('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xcc71('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcc71('0x9'));var _=require(_0xcc71('0xa'));var squel=require(_0xcc71('0xb'));var crypto=require(_0xcc71('0xc'));var jsforce=require(_0xcc71('0xd'));var deskjs=require(_0xcc71('0xe'));var toCsv=require(_0xcc71('0x8'));var querystring=require(_0xcc71('0xf'));var Papa=require(_0xcc71('0x10'));var Redis=require(_0xcc71('0x11'));var authService=require(_0xcc71('0x12'));var qs=require(_0xcc71('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc71('0x14'));var logger=require(_0xcc71('0x15'))('api');var utils=require(_0xcc71('0x16'));var config=require(_0xcc71('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xcc71('0x18')](config['redis'],{'host':_0xcc71('0x19'),'port':0x18eb});var socket=require(_0xcc71('0x1a'))(new Redis(config['redis']));require(_0xcc71('0x1b'))[_0xcc71('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xcc71('0x1d')][_0xcc71('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0xfe2fd9,_0x58e9f2,_0x2eead5,_0xa2357e){return new BPromise(function(_0x18de52,_0x42ea76){var _0x163666=_0xa2357e||client;return _0x163666['request'](_0xfe2fd9,_0x2eead5)[_0xcc71('0x1f')](function(_0x311ff0){logger[_0xcc71('0x20')](_0xcc71('0x21'),_0x58e9f2,_0xcc71('0x22'));logger[_0xcc71('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x58e9f2,_0xcc71('0x22'),JSON[_0xcc71('0x24')](_0x311ff0));if(_0x311ff0[_0xcc71('0x25')]){if(_0x311ff0[_0xcc71('0x25')]['code']===0x1f4){logger[_0xcc71('0x25')](_0xcc71('0x21'),_0x58e9f2,_0x311ff0[_0xcc71('0x25')][_0xcc71('0x26')]);return _0x42ea76(_0x311ff0[_0xcc71('0x25')][_0xcc71('0x26')]);}logger[_0xcc71('0x25')](_0xcc71('0x21'),_0x58e9f2,_0x311ff0[_0xcc71('0x25')][_0xcc71('0x26')]);return _0x18de52(_0x311ff0[_0xcc71('0x25')][_0xcc71('0x26')]);}else{logger['info'](_0xcc71('0x21'),_0x58e9f2,_0xcc71('0x22'));_0x18de52(_0x311ff0[_0xcc71('0x27')]['message']);}})[_0xcc71('0x28')](function(_0x1e8cfc){logger[_0xcc71('0x25')](_0xcc71('0x21'),_0x58e9f2,_0x1e8cfc);_0x42ea76(_0x1e8cfc);});});}function respondWithStatusCode(_0x2c97d7,_0x29b5d6){_0x29b5d6=_0x29b5d6||0xcc;return function(_0x3db113){if(_0x3db113){return _0x2c97d7[_0xcc71('0x29')](_0x29b5d6);}return _0x2c97d7[_0xcc71('0x2a')](_0x29b5d6)[_0xcc71('0x2b')]();};}function respondWithResult(_0x5167bb,_0x2351b0){_0x2351b0=_0x2351b0||0xc8;return function(_0x280d50){if(_0x280d50){return _0x5167bb['status'](_0x2351b0)['json'](_0x280d50);}};}function respondWithFilteredResult(_0x1dbd5f,_0x5cddbd){return function(_0x25552c){if(_0x25552c){var _0x41ecfb=typeof _0x5cddbd[_0xcc71('0x2c')]===_0xcc71('0x2d')&&typeof _0x5cddbd[_0xcc71('0x2e')]===_0xcc71('0x2d');var _0x2dae21=_0x25552c['count'];var _0x46feb0=_0x41ecfb?0x0:_0x5cddbd['offset'];var _0x118877=_0x41ecfb?_0x25552c[_0xcc71('0x2f')]:_0x5cddbd[_0xcc71('0x2c')]+_0x5cddbd[_0xcc71('0x2e')];var _0x75c641;if(_0x118877>=_0x2dae21){_0x118877=_0x2dae21;_0x75c641=0xc8;}else{_0x75c641=0xce;}_0x1dbd5f['status'](_0x75c641);return _0x1dbd5f[_0xcc71('0x30')](_0xcc71('0x31'),_0x46feb0+'-'+_0x118877+'/'+_0x2dae21)['json'](_0x25552c);}return null;};}function patchUpdates(_0x1bb599){return function(_0x1b8416){try{jsonpatch['apply'](_0x1b8416,_0x1bb599,!![]);}catch(_0x465bf9){return BPromise[_0xcc71('0x32')](_0x465bf9);}return _0x1b8416[_0xcc71('0x33')]();};}function saveUpdates(_0x2a7423,_0x18466b){return function(_0x478822){if(_0x478822){return _0x478822[_0xcc71('0x34')](_0x2a7423)[_0xcc71('0x1f')](function(_0x309d95){return _0x309d95;});}return null;};}function removeEntity(_0x25e8c9,_0x1ebf96){return function(_0xf289da){if(_0xf289da){return _0xf289da[_0xcc71('0x35')]()['then'](function(){var _0x759afe=_0xf289da['get']({'plain':!![]});var _0x5cca72='WhatsappAccounts';return db['UserProfileResource'][_0xcc71('0x35')]({'where':{'type':_0x5cca72,'resourceId':_0x759afe['id']}})[_0xcc71('0x1f')](function(){return _0xf289da;});})[_0xcc71('0x1f')](function(){_0x25e8c9[_0xcc71('0x2a')](0xcc)[_0xcc71('0x2b')]();});}};}function handleEntityNotFound(_0x50c4d6,_0x31d201){return function(_0x3c271d){if(!_0x3c271d){_0x50c4d6[_0xcc71('0x29')](0x194);}return _0x3c271d;};}function handleError(_0x3866e8,_0x379d92){_0x379d92=_0x379d92||0x1f4;return function(_0x54bb1b){logger[_0xcc71('0x25')](_0x54bb1b['stack']);if(_0x54bb1b[_0xcc71('0x36')]){delete _0x54bb1b[_0xcc71('0x36')];}_0x3866e8[_0xcc71('0x2a')](_0x379d92)[_0xcc71('0x37')](_0x54bb1b);};}exports[_0xcc71('0x38')]=function(_0xae2cd9,_0x5bcbab){var _0x581a1c={'include':[{'model':db[_0xcc71('0x39')],'as':_0xcc71('0x3a')}]},_0x4555d4={},_0x40c5f5={'count':0x0,'rows':[]};var _0x1ceb18=_[_0xcc71('0x3b')](db['WhatsappAccount'][_0xcc71('0x3c')],function(_0x4afa22){return{'name':_0x4afa22[_0xcc71('0x3d')],'type':_0x4afa22[_0xcc71('0x3e')][_0xcc71('0x3f')]};});_0x4555d4[_0xcc71('0x40')]=_['map'](_0x1ceb18,_0xcc71('0x36'));_0x4555d4[_0xcc71('0x41')]=_[_0xcc71('0x42')](_0xae2cd9['query']);_0x4555d4[_0xcc71('0x43')]=_[_0xcc71('0x44')](_0x4555d4[_0xcc71('0x40')],_0x4555d4[_0xcc71('0x41')]);_0x581a1c['attributes']=_[_0xcc71('0x44')](_0x4555d4[_0xcc71('0x40')],qs[_0xcc71('0x45')](_0xae2cd9['query'][_0xcc71('0x45')]));_0x581a1c[_0xcc71('0x46')]=_0x581a1c[_0xcc71('0x46')][_0xcc71('0x47')]?_0x581a1c[_0xcc71('0x46')]:_0x4555d4[_0xcc71('0x40')];if(!_0xae2cd9['query'][_0xcc71('0x48')](_0xcc71('0x49'))){_0x581a1c['limit']=qs[_0xcc71('0x2e')](_0xae2cd9[_0xcc71('0x41')][_0xcc71('0x2e')]);_0x581a1c[_0xcc71('0x2c')]=qs[_0xcc71('0x2c')](_0xae2cd9[_0xcc71('0x41')][_0xcc71('0x2c')]);}_0x581a1c[_0xcc71('0x4a')]=qs[_0xcc71('0x4b')](_0xae2cd9[_0xcc71('0x41')]['sort']);_0x581a1c['where']=qs[_0xcc71('0x43')](_[_0xcc71('0x4c')](_0xae2cd9['query'],_0x4555d4[_0xcc71('0x43')]),_0x1ceb18);if(_0xae2cd9[_0xcc71('0x41')]['filter']){_0x581a1c[_0xcc71('0x4d')]=_[_0xcc71('0x4e')](_0x581a1c['where'],{'$or':_[_0xcc71('0x3b')](_0x1ceb18,function(_0x1d3b9f){if(_0x1d3b9f['type']!==_0xcc71('0x4f')){var _0x20d6a8={};_0x20d6a8[_0x1d3b9f[_0xcc71('0x36')]]={'$like':'%'+_0xae2cd9[_0xcc71('0x41')][_0xcc71('0x50')]+'%'};return _0x20d6a8;}})});}_0x581a1c=_['merge']({},_0x581a1c,_0xae2cd9[_0xcc71('0x51')]);var _0x1fe81f={'where':_0x581a1c[_0xcc71('0x4d')]};return db[_0xcc71('0x52')][_0xcc71('0x2f')](_0x1fe81f)[_0xcc71('0x1f')](function(_0x5a2e45){_0x40c5f5[_0xcc71('0x2f')]=_0x5a2e45;if(_0xae2cd9['query'][_0xcc71('0x53')]){_0x581a1c[_0xcc71('0x54')]=[{'all':!![]}];}return db[_0xcc71('0x52')]['findAll'](_0x581a1c);})['then'](function(_0x4d9387){_0x40c5f5[_0xcc71('0x55')]=_0x4d9387;return _0x40c5f5;})[_0xcc71('0x1f')](respondWithFilteredResult(_0x5bcbab,_0x581a1c))['catch'](handleError(_0x5bcbab,null));};exports[_0xcc71('0x56')]=function(_0x1e3bac,_0x40080b){var _0x2290f5={'raw':![],'where':{'id':_0x1e3bac[_0xcc71('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xcc71('0x3a')}]},_0x20e225={};_0x20e225[_0xcc71('0x40')]=_['keys'](db[_0xcc71('0x52')][_0xcc71('0x3c')]);_0x20e225[_0xcc71('0x41')]=_[_0xcc71('0x42')](_0x1e3bac[_0xcc71('0x41')]);_0x20e225[_0xcc71('0x43')]=_[_0xcc71('0x44')](_0x20e225[_0xcc71('0x40')],_0x20e225['query']);_0x2290f5[_0xcc71('0x46')]=_[_0xcc71('0x44')](_0x20e225['model'],qs[_0xcc71('0x45')](_0x1e3bac[_0xcc71('0x41')][_0xcc71('0x45')]));_0x2290f5[_0xcc71('0x46')]=_0x2290f5[_0xcc71('0x46')]['length']?_0x2290f5[_0xcc71('0x46')]:_0x20e225[_0xcc71('0x40')];if(_0x1e3bac['query'][_0xcc71('0x53')]){_0x2290f5[_0xcc71('0x54')]=[{'all':!![]}];}_0x2290f5=_[_0xcc71('0x4e')]({},_0x2290f5,_0x1e3bac['options']);return db[_0xcc71('0x52')][_0xcc71('0x58')](_0x2290f5)[_0xcc71('0x1f')](handleEntityNotFound(_0x40080b,null))[_0xcc71('0x1f')](respondWithResult(_0x40080b,null))['catch'](handleError(_0x40080b,null));};exports[_0xcc71('0x59')]=function(_0x4af4d3,_0x7c3f97){return db['WhatsappAccount'][_0xcc71('0x59')](_0x4af4d3[_0xcc71('0x5a')],{})[_0xcc71('0x1f')](function(_0x4e3bbf){var _0x44366d=_0x4af4d3[_0xcc71('0x5b')][_0xcc71('0x5c')]({'plain':!![]});if(!_0x44366d)throw new Error(_0xcc71('0x5d'));if(_0x44366d['role']===_0xcc71('0x5b')){var _0x3fc89b=_0x4e3bbf[_0xcc71('0x5c')]({'plain':!![]});var _0xfce3eb='WhatsappAccounts';return db[_0xcc71('0x5e')][_0xcc71('0x58')]({'where':{'name':_0xfce3eb,'userProfileId':_0x44366d['userProfileId']},'raw':!![]})[_0xcc71('0x1f')](function(_0x43c200){if(_0x43c200&&_0x43c200[_0xcc71('0x5f')]===0x0){return db[_0xcc71('0x60')]['create']({'name':_0x3fc89b[_0xcc71('0x36')],'resourceId':_0x3fc89b['id'],'type':_0x43c200['name'],'sectionId':_0x43c200['id']},{})['then'](function(){return _0x4e3bbf;});}else{return _0x4e3bbf;}})[_0xcc71('0x28')](function(_0x38adc7){logger[_0xcc71('0x25')](_0xcc71('0x61'),_0x38adc7);throw _0x38adc7;});}return _0x4e3bbf;})[_0xcc71('0x1f')](respondWithResult(_0x7c3f97,0xc9))['catch'](handleError(_0x7c3f97,null));};exports[_0xcc71('0x34')]=function(_0x444553,_0x44619f){if(_0x444553[_0xcc71('0x5a')]['id']){delete _0x444553[_0xcc71('0x5a')]['id'];}return db['WhatsappAccount'][_0xcc71('0x58')]({'where':{'id':_0x444553[_0xcc71('0x57')]['id']},'include':[{'model':db[_0xcc71('0x39')],'as':_0xcc71('0x3a')}]})[_0xcc71('0x1f')](handleEntityNotFound(_0x44619f,null))[_0xcc71('0x1f')](saveUpdates(_0x444553[_0xcc71('0x5a')],null))[_0xcc71('0x1f')](respondWithResult(_0x44619f,null))['catch'](handleError(_0x44619f,null));};exports[_0xcc71('0x35')]=function(_0x1d42ef,_0x4c340e){return db[_0xcc71('0x52')]['find']({'where':{'id':_0x1d42ef[_0xcc71('0x57')]['id']}})['then'](handleEntityNotFound(_0x4c340e,null))[_0xcc71('0x1f')](removeEntity(_0x4c340e,null))[_0xcc71('0x28')](handleError(_0x4c340e,null));};exports['describe']=function(_0x38f82c,_0x25cee8){return db[_0xcc71('0x52')]['describe']()[_0xcc71('0x1f')](respondWithResult(_0x25cee8,null))['catch'](handleError(_0x25cee8,null));};exports[_0xcc71('0x62')]=function(_0x3dd2a2,_0x1b09a3,_0x3739bc){if(_0x3dd2a2[_0xcc71('0x5a')]['id']){delete _0x3dd2a2[_0xcc71('0x5a')]['id'];}return db[_0xcc71('0x52')]['find']({'where':{'id':_0x3dd2a2[_0xcc71('0x57')]['id']}})[_0xcc71('0x1f')](handleEntityNotFound(_0x1b09a3,null))[_0xcc71('0x1f')](function(_0x12dadd){if(_0x12dadd){_0x3dd2a2[_0xcc71('0x5a')][_0xcc71('0x63')]=_0x12dadd['id'];return db['Disposition']['create'](_0x3dd2a2[_0xcc71('0x5a')]);}})['then'](respondWithResult(_0x1b09a3,null))[_0xcc71('0x28')](handleError(_0x1b09a3,null));};exports['getDispositions']=function(_0x4e450b,_0x534ba7,_0x17834b){var _0xfe11eb={'raw':![],'where':{}};var _0x1e5169={};var _0x2cbf1b={'count':0x0,'rows':[]};return db[_0xcc71('0x52')]['findOne']({'where':{'id':_0x4e450b['params']['id']}})[_0xcc71('0x1f')](handleEntityNotFound(_0x534ba7,null))[_0xcc71('0x1f')](function(_0x24890b){if(_0x24890b){_0x1e5169[_0xcc71('0x40')]=_['keys'](db[_0xcc71('0x64')][_0xcc71('0x3c')]);_0x1e5169[_0xcc71('0x41')]=_[_0xcc71('0x42')](_0x4e450b['query']);_0x1e5169['filters']=_[_0xcc71('0x44')](_0x1e5169[_0xcc71('0x40')],_0x1e5169[_0xcc71('0x41')]);_0xfe11eb[_0xcc71('0x46')]=_[_0xcc71('0x44')](_0x1e5169[_0xcc71('0x40')],qs[_0xcc71('0x45')](_0x4e450b[_0xcc71('0x41')][_0xcc71('0x45')]));_0xfe11eb[_0xcc71('0x46')]=_0xfe11eb[_0xcc71('0x46')][_0xcc71('0x47')]?_0xfe11eb['attributes']:_0x1e5169[_0xcc71('0x40')];if(!_0x4e450b['query'][_0xcc71('0x48')](_0xcc71('0x49'))){_0xfe11eb[_0xcc71('0x2e')]=qs['limit'](_0x4e450b['query'][_0xcc71('0x2e')]);_0xfe11eb[_0xcc71('0x2c')]=qs[_0xcc71('0x2c')](_0x4e450b[_0xcc71('0x41')]['offset']);}_0xfe11eb[_0xcc71('0x4a')]=qs[_0xcc71('0x4b')](_0x4e450b[_0xcc71('0x41')][_0xcc71('0x4b')]);_0xfe11eb['where']=qs['filters'](_[_0xcc71('0x4c')](_0x4e450b['query'],_0x1e5169['filters']));_0xfe11eb[_0xcc71('0x4d')][_0xcc71('0x63')]=_0x24890b['id'];if(_0x4e450b[_0xcc71('0x41')]['filter']){_0xfe11eb[_0xcc71('0x4d')]=_[_0xcc71('0x4e')](_0xfe11eb['where'],{'$or':_[_0xcc71('0x3b')](_0xfe11eb[_0xcc71('0x46')],function(_0x200092){var _0x588813={};_0x588813[_0x200092]={'$like':'%'+_0x4e450b[_0xcc71('0x41')][_0xcc71('0x50')]+'%'};return _0x588813;})});}_0xfe11eb=_[_0xcc71('0x4e')]({},_0xfe11eb,_0x4e450b[_0xcc71('0x51')]);return db['Disposition']['count']({'where':_0xfe11eb[_0xcc71('0x4d')]})[_0xcc71('0x1f')](function(_0x304bcc){_0x2cbf1b['count']=_0x304bcc;if(_0x4e450b[_0xcc71('0x41')][_0xcc71('0x53')]){_0xfe11eb[_0xcc71('0x54')]=[{'all':!![]}];}return db[_0xcc71('0x64')][_0xcc71('0x65')](_0xfe11eb);})[_0xcc71('0x1f')](function(_0x28e9de){_0x2cbf1b[_0xcc71('0x55')]=_0x28e9de;return _0x2cbf1b;});}})[_0xcc71('0x1f')](respondWithFilteredResult(_0x534ba7,_0xfe11eb))['catch'](handleError(_0x534ba7,null));};exports[_0xcc71('0x66')]=function(_0x563906,_0x594964,_0x348349){return db[_0xcc71('0x52')]['find']({'where':{'id':_0x563906[_0xcc71('0x57')]['id']}})[_0xcc71('0x1f')](handleEntityNotFound(_0x594964,null))[_0xcc71('0x1f')](function(_0x40206a){if(_0x40206a){return _0x40206a['removeDispositions'](_0x563906[_0xcc71('0x41')][_0xcc71('0x67')]);}})[_0xcc71('0x1f')](respondWithStatusCode(_0x594964,null))['catch'](handleError(_0x594964,null));};exports[_0xcc71('0x68')]=function(_0x2a1118,_0x15ef77,_0x5efe24){if(_0x2a1118[_0xcc71('0x5a')]['id']){delete _0x2a1118[_0xcc71('0x5a')]['id'];}return db[_0xcc71('0x52')][_0xcc71('0x58')]({'where':{'id':_0x2a1118['params']['id']}})[_0xcc71('0x1f')](handleEntityNotFound(_0x15ef77,null))[_0xcc71('0x1f')](function(_0x556e91){if(_0x556e91){_0x2a1118['body'][_0xcc71('0x63')]=_0x556e91['id'];return db[_0xcc71('0x69')][_0xcc71('0x59')](_0x2a1118[_0xcc71('0x5a')]);}})['then'](respondWithResult(_0x15ef77,null))[_0xcc71('0x28')](handleError(_0x15ef77,null));};exports['getAnswers']=function(_0x572b88,_0x185c1c,_0x87db51){var _0x37bfa3={'raw':![],'where':{}};var _0xfb62da={};var _0x31d555={'count':0x0,'rows':[]};return db[_0xcc71('0x52')][_0xcc71('0x6a')]({'where':{'id':_0x572b88[_0xcc71('0x57')]['id']}})[_0xcc71('0x1f')](handleEntityNotFound(_0x185c1c,null))[_0xcc71('0x1f')](function(_0x5e3e87){if(_0x5e3e87){_0xfb62da[_0xcc71('0x40')]=_[_0xcc71('0x42')](db[_0xcc71('0x69')][_0xcc71('0x3c')]);_0xfb62da['query']=_[_0xcc71('0x42')](_0x572b88[_0xcc71('0x41')]);_0xfb62da[_0xcc71('0x43')]=_[_0xcc71('0x44')](_0xfb62da[_0xcc71('0x40')],_0xfb62da[_0xcc71('0x41')]);_0x37bfa3['attributes']=_[_0xcc71('0x44')](_0xfb62da[_0xcc71('0x40')],qs['fields'](_0x572b88[_0xcc71('0x41')][_0xcc71('0x45')]));_0x37bfa3[_0xcc71('0x46')]=_0x37bfa3[_0xcc71('0x46')][_0xcc71('0x47')]?_0x37bfa3[_0xcc71('0x46')]:_0xfb62da[_0xcc71('0x40')];if(!_0x572b88['query'][_0xcc71('0x48')](_0xcc71('0x49'))){_0x37bfa3['limit']=qs[_0xcc71('0x2e')](_0x572b88[_0xcc71('0x41')][_0xcc71('0x2e')]);_0x37bfa3['offset']=qs['offset'](_0x572b88[_0xcc71('0x41')][_0xcc71('0x2c')]);}_0x37bfa3['order']=qs[_0xcc71('0x4b')](_0x572b88['query'][_0xcc71('0x4b')]);_0x37bfa3[_0xcc71('0x4d')]=qs[_0xcc71('0x43')](_[_0xcc71('0x4c')](_0x572b88[_0xcc71('0x41')],_0xfb62da[_0xcc71('0x43')]));_0x37bfa3[_0xcc71('0x4d')]['WhatsappAccountId']=_0x5e3e87['id'];if(_0x572b88['query'][_0xcc71('0x50')]){_0x37bfa3[_0xcc71('0x4d')]=_[_0xcc71('0x4e')](_0x37bfa3[_0xcc71('0x4d')],{'$or':_[_0xcc71('0x3b')](_0x37bfa3[_0xcc71('0x46')],function(_0x52e718){var _0x5d5cd3={};_0x5d5cd3[_0x52e718]={'$like':'%'+_0x572b88[_0xcc71('0x41')][_0xcc71('0x50')]+'%'};return _0x5d5cd3;})});}_0x37bfa3=_[_0xcc71('0x4e')]({},_0x37bfa3,_0x572b88[_0xcc71('0x51')]);return db[_0xcc71('0x69')][_0xcc71('0x2f')]({'where':_0x37bfa3[_0xcc71('0x4d')]})[_0xcc71('0x1f')](function(_0x231d55){_0x31d555[_0xcc71('0x2f')]=_0x231d55;if(_0x572b88['query'][_0xcc71('0x53')]){_0x37bfa3[_0xcc71('0x54')]=[{'all':!![]}];}return db[_0xcc71('0x69')][_0xcc71('0x65')](_0x37bfa3);})[_0xcc71('0x1f')](function(_0x41897d){_0x31d555[_0xcc71('0x55')]=_0x41897d;return _0x31d555;});}})[_0xcc71('0x1f')](respondWithFilteredResult(_0x185c1c,_0x37bfa3))['catch'](handleError(_0x185c1c,null));};exports[_0xcc71('0x6b')]=function(_0x44d497,_0x426226,_0x4be698){return db[_0xcc71('0x52')][_0xcc71('0x58')]({'where':{'id':_0x44d497['params']['id']}})[_0xcc71('0x1f')](handleEntityNotFound(_0x426226,null))[_0xcc71('0x1f')](function(_0x5bf621){if(_0x5bf621){return _0x5bf621[_0xcc71('0x6b')](_0x44d497[_0xcc71('0x41')][_0xcc71('0x67')]);}})[_0xcc71('0x1f')](respondWithStatusCode(_0x426226,null))[_0xcc71('0x28')](handleError(_0x426226,null));};exports[_0xcc71('0x6c')]=function(_0xef0453,_0x248dae,_0x44877b){return db[_0xcc71('0x52')][_0xcc71('0x58')]({'where':{'id':_0xef0453[_0xcc71('0x57')]['id']}})['then'](handleEntityNotFound(_0x248dae,null))[_0xcc71('0x1f')](function(_0x2f37fd){if(_0x2f37fd){return _0x2f37fd['addAgents'](_0xef0453['body'][_0xcc71('0x67')],_[_0xcc71('0x6d')](_0xef0453[_0xcc71('0x5a')],[_0xcc71('0x67'),'id'])||{})[_0xcc71('0x6e')](function(_0x2ca4c1){for(var _0x9646e=0x0;_0x9646e<_0xef0453['body'][_0xcc71('0x67')]['length'];_0x9646e+=0x1){socket[_0xcc71('0x6f')](_0xcc71('0x70'),{'UserId':Number(_0xef0453[_0xcc71('0x5a')]['ids'][_0x9646e]),'WhatsappAccountId':Number(_0xef0453[_0xcc71('0x57')]['id'])});}return _0x2ca4c1;});}})[_0xcc71('0x1f')](respondWithResult(_0x248dae,null))[_0xcc71('0x28')](handleError(_0x248dae,null));};exports[_0xcc71('0x71')]=function(_0x35889f,_0x73d841,_0x268dc3){return db['WhatsappAccount'][_0xcc71('0x58')]({'where':{'id':_0x35889f[_0xcc71('0x57')]['id']}})['then'](handleEntityNotFound(_0x73d841,null))[_0xcc71('0x1f')](function(_0x23c42d){if(_0x23c42d){return _0x23c42d[_0xcc71('0x71')](_0x35889f['query']['ids'])[_0xcc71('0x1f')](function(){if(_[_0xcc71('0x72')](_0x35889f['query']['ids'])){for(var _0xac0cff=0x0;_0xac0cff<_0x35889f[_0xcc71('0x41')]['ids'][_0xcc71('0x47')];_0xac0cff+=0x1){socket[_0xcc71('0x6f')](_0xcc71('0x73'),{'UserId':Number(_0x35889f['query']['ids'][_0xac0cff]),'WhatsappAccountId':Number(_0x35889f[_0xcc71('0x57')]['id'])});}}else{socket[_0xcc71('0x6f')](_0xcc71('0x73'),{'UserId':Number(_0x35889f[_0xcc71('0x41')][_0xcc71('0x67')]),'WhatsappAccountId':Number(_0x35889f[_0xcc71('0x57')]['id'])});}});}})[_0xcc71('0x1f')](respondWithStatusCode(_0x73d841,null))[_0xcc71('0x28')](handleError(_0x73d841,null));};exports[_0xcc71('0x74')]=function(_0xa79917,_0x28a888,_0x1d2d34){var _0x1d9b85={};var _0x5742d2={};var _0x43303b;var _0x1eb5cd;return db[_0xcc71('0x52')][_0xcc71('0x6a')]({'where':{'id':_0xa79917[_0xcc71('0x57')]['id']}})[_0xcc71('0x1f')](handleEntityNotFound(_0x28a888,null))[_0xcc71('0x1f')](function(_0x5e62d8){if(_0x5e62d8){_0x43303b=_0x5e62d8;_0x5742d2[_0xcc71('0x40')]=_[_0xcc71('0x42')](db['User'][_0xcc71('0x3c')]);_0x5742d2[_0xcc71('0x41')]=_[_0xcc71('0x42')](_0xa79917[_0xcc71('0x41')]);_0x5742d2[_0xcc71('0x43')]=_[_0xcc71('0x44')](_0x5742d2[_0xcc71('0x40')],_0x5742d2['query']);_0x1d9b85['attributes']=_[_0xcc71('0x44')](_0x5742d2['model'],qs[_0xcc71('0x45')](_0xa79917['query']['fields']));_0x1d9b85[_0xcc71('0x46')]=_0x1d9b85['attributes'][_0xcc71('0x47')]?_0x1d9b85[_0xcc71('0x46')]:_0x5742d2[_0xcc71('0x40')];_0x1d9b85['order']=qs[_0xcc71('0x4b')](_0xa79917[_0xcc71('0x41')]['sort']);_0x1d9b85[_0xcc71('0x4d')]=qs['filters'](_[_0xcc71('0x4c')](_0xa79917[_0xcc71('0x41')],_0x5742d2['filters']));if(_0xa79917[_0xcc71('0x41')][_0xcc71('0x50')]){_0x1d9b85[_0xcc71('0x4d')]=_[_0xcc71('0x4e')](_0x1d9b85[_0xcc71('0x4d')],{'$or':_['map'](_0x1d9b85[_0xcc71('0x46')],function(_0x3832f6){var _0x26e360={};_0x26e360[_0x3832f6]={'$like':'%'+_0xa79917[_0xcc71('0x41')][_0xcc71('0x50')]+'%'};return _0x26e360;})});}_0x1d9b85=_[_0xcc71('0x4e')]({},_0x1d9b85,_0xa79917['options']);return _0x43303b['getAgents'](_0x1d9b85);}})['then'](function(_0x27cab1){if(_0x27cab1){_0x1eb5cd=_0x27cab1['length'];if(!_0xa79917[_0xcc71('0x41')][_0xcc71('0x48')](_0xcc71('0x49'))){_0x1d9b85[_0xcc71('0x2e')]=qs[_0xcc71('0x2e')](_0xa79917[_0xcc71('0x41')]['limit']);_0x1d9b85[_0xcc71('0x2c')]=qs[_0xcc71('0x2c')](_0xa79917[_0xcc71('0x41')][_0xcc71('0x2c')]);}return _0x43303b['getAgents'](_0x1d9b85);}})['then'](function(_0x2f55a1){if(_0x2f55a1){return _0x2f55a1?{'count':_0x1eb5cd,'rows':_0x2f55a1}:null;}})[_0xcc71('0x1f')](respondWithResult(_0x28a888,null))['catch'](handleError(_0x28a888,null));};exports[_0xcc71('0x75')]=function(_0x3b9c30,_0x2860b0){var _0x2ffdf0=_0x3b9c30[_0xcc71('0x57')]['id'];var _0x524923=_0x3b9c30[_0xcc71('0x5a')];var _0x5b897c=0xc8;var _0x1d78ac=null;return db[_0xcc71('0x76')][_0xcc71('0x77')]({'isolationLevel':db[_0xcc71('0x76')][_0xcc71('0x78')][_0xcc71('0x79')][_0xcc71('0x7a')]},function(_0x33ed5c){return db['WhatsappAccount'][_0xcc71('0x6a')]({'where':{'id':_0x2ffdf0},'transaction':_0x33ed5c})['then'](function(_0x47cc61){if(_0x47cc61){return db[_0xcc71('0x7b')][_0xcc71('0x35')]({'where':{'WhatsappAccountId':_0x2ffdf0},'transaction':_0x33ed5c})['then'](function(){var _0x4a7449=_[_0xcc71('0x3b')](_0x524923,function(_0x1eab78){_0x1eab78[_0xcc71('0x63')]=_0x2ffdf0;return _0x1eab78;});return db['WhatsappApplication'][_0xcc71('0x7c')](_0x4a7449,{'transaction':_0x33ed5c});});}else{_0x5b897c=0x194;_0x1d78ac=[];}});})[_0xcc71('0x1f')](function(){if(_0x5b897c!==0x194){return db[_0xcc71('0x7b')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x2ffdf0},'order':_0xcc71('0x7d')})[_0xcc71('0x1f')](function(_0x3feeef){_0x1d78ac=_0x3feeef;});}})[_0xcc71('0x28')](function(_0x49f720){_0x5b897c=0x1f4;logger[_0xcc71('0x25')](_0x49f720[_0xcc71('0x7e')]);if(_0x49f720['name']){delete _0x49f720[_0xcc71('0x36')];}_0x1d78ac=_0x49f720;})[_0xcc71('0x7f')](function(){if(_0x1d78ac===null){_0x2860b0[_0xcc71('0x29')](_0x5b897c);}else{if(_0x5b897c===0x1f4){_0x2860b0[_0xcc71('0x2a')](_0x5b897c)[_0xcc71('0x37')](_0x1d78ac);}else{_0x2860b0[_0xcc71('0x2a')](_0x5b897c)[_0xcc71('0x80')](_0x1d78ac);}}});};exports['getApplications']=function(_0x37c24c,_0x49477f,_0x210c6f){var _0x4ab04e={};var _0x4d1855={};var _0x29272a;var _0x141a7a;return db[_0xcc71('0x52')][_0xcc71('0x6a')]({'where':{'id':_0x37c24c[_0xcc71('0x57')]['id']}})['then'](handleEntityNotFound(_0x49477f,null))[_0xcc71('0x1f')](function(_0x5097c8){if(_0x5097c8){_0x29272a=_0x5097c8;_0x4d1855[_0xcc71('0x40')]=_['keys'](db[_0xcc71('0x7b')][_0xcc71('0x3c')]);_0x4d1855[_0xcc71('0x41')]=_[_0xcc71('0x42')](_0x37c24c[_0xcc71('0x41')]);_0x4d1855[_0xcc71('0x43')]=_[_0xcc71('0x44')](_0x4d1855[_0xcc71('0x40')],_0x4d1855[_0xcc71('0x41')]);_0x4ab04e[_0xcc71('0x46')]=_[_0xcc71('0x44')](_0x4d1855[_0xcc71('0x40')],qs['fields'](_0x37c24c[_0xcc71('0x41')][_0xcc71('0x45')]));_0x4ab04e['attributes']=_0x4ab04e[_0xcc71('0x46')]['length']?_0x4ab04e[_0xcc71('0x46')]:_0x4d1855[_0xcc71('0x40')];_0x4ab04e['order']=qs['sort'](_0x37c24c[_0xcc71('0x41')][_0xcc71('0x4b')]);_0x4ab04e[_0xcc71('0x4d')]=qs[_0xcc71('0x43')](_[_0xcc71('0x4c')](_0x37c24c['query'],_0x4d1855['filters']));if(_0x37c24c['query']['filter']){_0x4ab04e[_0xcc71('0x4d')]=_[_0xcc71('0x4e')](_0x4ab04e[_0xcc71('0x4d')],{'$or':_[_0xcc71('0x3b')](_0x4ab04e['attributes'],function(_0x11a4c8){var _0x441bd2={};_0x441bd2[_0x11a4c8]={'$like':'%'+_0x37c24c[_0xcc71('0x41')][_0xcc71('0x50')]+'%'};return _0x441bd2;})});}_0x4ab04e=_[_0xcc71('0x4e')]({},_0x4ab04e,_0x37c24c['options']);return _0x29272a[_0xcc71('0x81')](_0x4ab04e);}})[_0xcc71('0x1f')](function(_0x1e1434){if(_0x1e1434){_0x141a7a=_0x1e1434[_0xcc71('0x47')];if(!_0x37c24c['query'][_0xcc71('0x48')](_0xcc71('0x49'))){_0x4ab04e[_0xcc71('0x2e')]=qs[_0xcc71('0x2e')](_0x37c24c['query'][_0xcc71('0x2e')]);_0x4ab04e['offset']=qs[_0xcc71('0x2c')](_0x37c24c[_0xcc71('0x41')][_0xcc71('0x2c')]);}return _0x29272a['getApplications'](_0x4ab04e);}})[_0xcc71('0x1f')](function(_0x37b446){if(_0x37b446){return _0x37b446?{'count':_0x141a7a,'rows':_0x37b446}:null;}})[_0xcc71('0x1f')](respondWithResult(_0x49477f,null))['catch'](handleError(_0x49477f,null));};exports[_0xcc71('0x82')]=function(_0xf7f5d,_0x2c6436,_0x40695a){var _0x42d107={'channel':_0xcc71('0x83')};var _0x167324=[];var _0x34b154=[];var _0x57244e={};return db[_0xcc71('0x52')][_0xcc71('0x58')]({'where':{'id':_0xf7f5d[_0xcc71('0x57')]['id']},'include':[{'model':db[_0xcc71('0x7b')],'as':_0xcc71('0x84')}]})['then'](handleEntityNotFound(_0x2c6436,null))[_0xcc71('0x1f')](function(_0x5a1681){_0x42d107['account']=_0x5a1681;if(_0x42d107[_0xcc71('0x85')]&&_0x42d107[_0xcc71('0x85')][_0xcc71('0x3e')]===_0xcc71('0x86')&&_0xf7f5d[_0xcc71('0x5a')][_0xcc71('0x87')]){if(_0xf7f5d[_0xcc71('0x5a')][_0xcc71('0x87')][_0xcc71('0x47')]===0x0)return;if(_0xf7f5d[_0xcc71('0x5a')][_0xcc71('0x87')][0x0][_0xcc71('0x88')]!==_0xcc71('0x89'))return;return db['WhatsappMessage'][_0xcc71('0x34')]({'read':!![],'readAt':_0xf7f5d['body'][_0xcc71('0x87')][0x0]['timestamp']},{'where':{'messageId':_0xf7f5d[_0xcc71('0x5a')][_0xcc71('0x87')][0x0][_0xcc71('0x8a')]},'individualHooks':!![]})[_0xcc71('0x1f')](function(_0x5b74fe){return _0x2c6436[_0xcc71('0x2a')](0xc8)[_0xcc71('0x80')](_0x5b74fe);});}_0x42d107[_0xcc71('0x8b')]=_[_0xcc71('0x8c')](_0x5a1681[_0xcc71('0x84')],[_0xcc71('0x7d')],[_0xcc71('0x8d')]);if(_0x42d107[_0xcc71('0x85')][_0xcc71('0x84')]){delete _0x42d107['account'][_0xcc71('0x84')];}return db[_0xcc71('0x8e')][_0xcc71('0x8f')]()['then'](function(_0x90d252){if(!_0x90d252){throw new db[(_0xcc71('0x90'))][(_0xcc71('0x91'))](_0xcc71('0x92'));}_0x167324=_[_0xcc71('0x93')](_[_0xcc71('0x42')](_0x90d252),[_0xcc71('0x94'),'updatedAt']);_0x34b154=_['difference'](_['keys'](_0x90d252),[_0xcc71('0x94'),'updatedAt',_0xcc71('0x95'),_0xcc71('0x96')]);_0x42d107[_0xcc71('0x5a')]={'mapKey':'mobile'};if(_0x42d107['account']&&_0x42d107['account'][_0xcc71('0x3e')]===_0xcc71('0x97')){_0x42d107[_0xcc71('0x5a')][_0xcc71('0x98')]=_0xf7f5d[_0xcc71('0x5a')][_0xcc71('0x99')][_0xcc71('0x9a')](_0xcc71('0x9b'),'');_0x42d107[_0xcc71('0x5a')][_0xcc71('0x5a')]=_0xf7f5d[_0xcc71('0x5a')]['Body'];_0x42d107[_0xcc71('0x5a')]['messageId']=_0xf7f5d['body'][_0xcc71('0x9c')];}if(_0x42d107[_0xcc71('0x85')]&&_0x42d107[_0xcc71('0x85')][_0xcc71('0x3e')]===_0xcc71('0x86')){_0x42d107[_0xcc71('0x5a')][_0xcc71('0x98')]=_0xf7f5d[_0xcc71('0x5a')][_0xcc71('0x9d')][0x0][_0xcc71('0x98')];_0x42d107[_0xcc71('0x5a')][_0xcc71('0x5a')]=_0xf7f5d[_0xcc71('0x5a')][_0xcc71('0x9d')][0x0][_0xcc71('0x26')]['body'];_0x42d107[_0xcc71('0x5a')][_0xcc71('0x9e')]=_0xf7f5d['body'][_0xcc71('0x9d')][0x0][_0xcc71('0x8a')];}if(_0x42d107[_0xcc71('0x5a')]['id']){delete _0x42d107[_0xcc71('0x5a')]['id'];}if(_[_0xcc71('0x9f')](_0x42d107[_0xcc71('0x5a')]['from'])){throw new db[(_0xcc71('0x90'))][(_0xcc71('0x91'))](_0xcc71('0xa0'));}if(_[_0xcc71('0x9f')](_0x42d107[_0xcc71('0x5a')]['body'])||_0x42d107['body']['body']===''){throw new db[(_0xcc71('0x90'))][(_0xcc71('0x91'))](_0xcc71('0xa1'));}if(_[_0xcc71('0x9f')](_0x42d107[_0xcc71('0x5a')][_0xcc71('0xa2')])){throw new db['Sequelize']['ValidationError'](_0xcc71('0xa3')+_0x34b154);}if(!_[_0xcc71('0xa4')](_0x34b154,_0x42d107[_0xcc71('0x5a')]['mapKey'])){throw new db['Sequelize'][(_0xcc71('0x91'))](_0xcc71('0xa5')+_0x34b154);}_0x57244e[_0x42d107[_0xcc71('0x5a')]['mapKey']]=_0x42d107[_0xcc71('0x5a')][_0xcc71('0x98')];return db['CmList'][_0xcc71('0x58')]({'where':{'id':_0x42d107['account']['ListId']},'include':[{'model':db['CmContact'],'as':_0xcc71('0xa6'),'where':_0x57244e,'limit':0x1,'order':[[_0xcc71('0xa7'),'DESC']]}]});})[_0xcc71('0x1f')](handleEntityNotFound(_0x2c6436,null))[_0xcc71('0x1f')](function(_0x2bfef9){if(_0x2bfef9){_0x42d107[_0xcc71('0xa8')]=_[_0xcc71('0x6d')](_0x2bfef9,[_0xcc71('0xa6')]);if(_0x2bfef9[_0xcc71('0xa6')]['length']){return _0x2bfef9[_0xcc71('0xa6')][0x0];}var _0x4dfd51=_['defaults'](_0x42d107[_0xcc71('0x5a')],{'firstName':_0x42d107[_0xcc71('0x5a')][_0xcc71('0x98')],'ListId':_0x2bfef9['id']});_0x4dfd51[_0x42d107[_0xcc71('0x5a')][_0xcc71('0xa2')]]=_0x42d107[_0xcc71('0x5a')][_0xcc71('0x98')];return db[_0xcc71('0x8e')][_0xcc71('0x59')](_0x4dfd51,{'fields':_0x167324,'raw':!![]});}})['then'](handleEntityNotFound(_0x2c6436,null))[_0xcc71('0x1f')](function(_0x442490){if(_0x442490){_0x42d107[_0xcc71('0xa9')]=_0x442490;var _0x45f830={'ContactId':_0x442490['id'],'phone':_0x42d107[_0xcc71('0x5a')][_0xcc71('0x98')],'WhatsappAccountId':_0xf7f5d['params']['id']};var _0x32d529={'ContactId':_0x442490['id'],'WhatsappAccountId':_0xf7f5d[_0xcc71('0x57')]['id'],'closed':![]};return db[_0xcc71('0xaa')][_0xcc71('0x58')]({'where':_0x32d529})[_0xcc71('0x1f')](function(_0x3301e3){if(_0x3301e3){return[_0x3301e3,![]];}return db[_0xcc71('0xaa')][_0xcc71('0x59')](_0x45f830)[_0xcc71('0x1f')](function(_0x81bf1d){return[_0x81bf1d,!![]];});});}})[_0xcc71('0x6e')](function(_0x217725,_0x936bea){_0x42d107[_0xcc71('0xab')]=_0x217725[_0xcc71('0x5c')]({'plain':!![]});_0x42d107[_0xcc71('0xab')][_0xcc71('0xac')]=![];if(_0x936bea){if(_0x42d107[_0xcc71('0x85')][_0xcc71('0xad')]){_0x42d107[_0xcc71('0x8b')][_0xcc71('0xae')]({'id':0x0,'priority':_0x42d107['applications'][_0xcc71('0x47')]+0x1,'app':_0xcc71('0xaf'),'appdata':_0xcc71('0xb0'),'interval':_0xcc71('0xb1')});}_0x42d107[_0xcc71('0xab')][_0xcc71('0xac')]=!![];}return db[_0xcc71('0xb2')]['create']({'phone':_0x42d107[_0xcc71('0x5a')]['from'],'messageId':_0x42d107[_0xcc71('0x5a')][_0xcc71('0x9e')],'body':_0x42d107[_0xcc71('0x5a')]['body'],'WhatsappAccountId':_0xf7f5d['params']['id'],'WhatsappInteractionId':_0x217725['id'],'direction':'in','ContactId':_0x217725['ContactId'],'AttachmentId':_0x42d107[_0xcc71('0x5a')][_0xcc71('0xb3')]});})[_0xcc71('0x1f')](function(_0x14df17){_0x42d107['message']=_0x14df17;if(_0x42d107[_0xcc71('0xab')][_0xcc71('0xb4')]){return db[_0xcc71('0xb5')]['find']({'attributes':['id',_0xcc71('0x36')],'where':{'id':_0x42d107[_0xcc71('0xab')][_0xcc71('0xb4')]}})[_0xcc71('0x1f')](function(_0x3c9ae0){if(_0x3c9ae0){_0x42d107['applications'][_0xcc71('0xb6')]({'id':0x0,'priority':0x0,'app':_0xcc71('0xb7'),'appdata':_0x3c9ae0[_0xcc71('0x36')]+','+(_0x42d107['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x42d107);});}return respondWithRpcPromise(_0xcc71('0xb8'),_0xcc71('0xb9'),_0x42d107);})[_0xcc71('0x1f')](function(_0x496d8e){if(_0x496d8e){var _0x19a3ad=0xc8;var _0x507e69=_0xcc71('0xba');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x507e69,_0x19a3ad,_0xcc71('0xbb'));logger['debug'](_0xcc71('0xbc'),_0x507e69,_0x19a3ad,_0xcc71('0xbb'),JSON['stringify'](_0x496d8e));if(_0x42d107[_0xcc71('0x85')][_0xcc71('0x3e')]===_0xcc71('0x97')){return _0x2c6436[_0xcc71('0x2a')](_0x19a3ad)[_0xcc71('0x30')](_0xcc71('0xbd'),_0xcc71('0xbe'))[_0xcc71('0x37')]('\x0a');}else{return _0x2c6436['status'](_0x19a3ad)[_0xcc71('0x80')](_0x496d8e);}}});})[_0xcc71('0x28')](handleError(_0x2c6436,null));};exports[_0xcc71('0x37')]=function(_0x2da91e,_0x5b8176,_0x57664e){var _0x1782a2,_0xe8fa08,_0x1aea21;if(_[_0xcc71('0x9f')](_0x2da91e[_0xcc71('0x5a')][_0xcc71('0x5a')])||_0x2da91e[_0xcc71('0x5a')][_0xcc71('0x5a')]===''){throw new db[(_0xcc71('0x90'))][(_0xcc71('0x91'))](_0xcc71('0xa1'));}if(_[_0xcc71('0x9f')](_0x2da91e[_0xcc71('0x5a')]['to'])){throw new db['Sequelize'][(_0xcc71('0x91'))]('to\x20is\x20mandatory');}_0x1782a2=_0x2da91e[_0xcc71('0x5a')]['to'];return db[_0xcc71('0x52')][_0xcc71('0x58')]({'where':{'id':_0x2da91e[_0xcc71('0x57')]['id']},'include':[{'model':db[_0xcc71('0xbf')],'as':_0xcc71('0xc0'),'include':[{'model':db[_0xcc71('0x8e')],'as':_0xcc71('0xa6'),'where':{'mobile':_0x1782a2},'limit':0x1,'order':[[_0xcc71('0xa7'),_0xcc71('0xc1')]]}]}]})[_0xcc71('0x1f')](handleEntityNotFound(_0x5b8176,null))[_0xcc71('0x1f')](function(_0x34e81d){if(_0x34e81d&&_0x34e81d[_0xcc71('0xc0')]){_0xe8fa08=_0x34e81d[_0xcc71('0x5c')]({'plain':!![]});if(_0xe8fa08['List']&&_0xe8fa08[_0xcc71('0xc0')]['Contacts']['length']){return _0xe8fa08[_0xcc71('0xc0')][_0xcc71('0xa6')][0x0];}return db['CmContact'][_0xcc71('0x59')](_[_0xcc71('0x18')](_0x2da91e['body'],{'firstName':_0x1782a2,'mobile':_0x1782a2,'phone':_0x1782a2,'ListId':_0xe8fa08[_0xcc71('0x96')]}));}})[_0xcc71('0x1f')](handleEntityNotFound(_0x5b8176,null))[_0xcc71('0x1f')](function(_0x36d215){if(_0x36d215){_0x1aea21=_0x36d215;return db['WhatsappInteraction'][_0xcc71('0x58')]({'where':{'ContactId':_0x1aea21['id'],'closed':![],'WhatsappAccountId':_0xe8fa08['id']}})[_0xcc71('0x1f')](function(_0x584b4c){if(_0x584b4c){return[_0x584b4c,![]];}return db['WhatsappInteraction'][_0xcc71('0x59')]({'UserId':_0x2da91e[_0xcc71('0x5b')]['id'],'ContactId':_0x1aea21['id'],'WhatsappAccountId':_0xe8fa08['id'],'phone':_0x1782a2,'firstMsgDirection':_0xcc71('0xc2'),'Messages':[_[_0xcc71('0x4e')](_0x2da91e[_0xcc71('0x5a')],{'read':![],'body':_0x2da91e[_0xcc71('0x5a')][_0xcc71('0x5a')],'phone':_0x1782a2,'WhatsappAccountId':_0xe8fa08['id'],'UserId':_0x2da91e[_0xcc71('0x5b')]['id'],'ContactId':_0x1aea21['id']})]},{'include':[{'model':db[_0xcc71('0xb2')],'as':_0xcc71('0xc3')}]})[_0xcc71('0x1f')](function(_0x2bd4ce){return[_0x2bd4ce,!![]];});});}})[_0xcc71('0x6e')](function(_0x280097,_0x5e1a7e){if(_0x5e1a7e){return _0x280097;}return db[_0xcc71('0xb2')]['create'](_['merge'](_0x2da91e[_0xcc71('0x5a')],{'read':![],'body':_0x2da91e[_0xcc71('0x5a')]['body'],'phone':_0x1782a2,'WhatsappAccountId':_0xe8fa08['id'],'WhatsappInteractionId':_0x280097['id'],'UserId':_0x2da91e[_0xcc71('0x5b')]['id'],'ContactId':_0x1aea21['id']}))[_0xcc71('0x1f')](function(_0x4e606b){_0x280097[_0xcc71('0xc4')][_0xcc71('0xc3')]=[];_0x280097[_0xcc71('0xc4')][_0xcc71('0xc3')]['push'](_0x4e606b[_0xcc71('0xc4')]);return _0x280097;});})[_0xcc71('0x1f')](respondWithResult(_0x5b8176,null))[_0xcc71('0x28')](handleError(_0x5b8176,null));}; \ No newline at end of file +var _0x9833=['code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','keys','filters','model','attributes','intersection','query','fields','length','order','sort','pick','where','VIRTUAL','merge','include','findAll','rows','show','rawAttributes','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','hasOwnProperty','nolimit','filter','removeDispositions','ids','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','finally','send','getApplications','whatsapp','sinch','statuses','state','WhatsappMessage','timestamp','message_id','applications','Applications','priority','asc','account','CmContact','Sequelize','ValidationError','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','whatsapp:','Body','MessageSid','notifications','messageId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','Contacts','DESC','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','Messages','dataValues','eml-format','rimraf','request-promise','moment','bluebird','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','register','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x1f5ab3,_0x2d2473){var _0x2bd0d7=function(_0x41c41b){while(--_0x41c41b){_0x1f5ab3['push'](_0x1f5ab3['shift']());}};_0x2bd0d7(++_0x2d2473);}(_0x9833,0x9a));var _0x3983=function(_0x373ffe,_0x268f8f){_0x373ffe=_0x373ffe-0x0;var _0x40fa43=_0x9833[_0x373ffe];return _0x40fa43;};'use strict';var emlformat=require(_0x3983('0x0'));var rimraf=require(_0x3983('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3983('0x2'));var moment=require(_0x3983('0x3'));var BPromise=require(_0x3983('0x4'));var Mustache=require('mustache');var util=require(_0x3983('0x5'));var path=require(_0x3983('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3983('0x7'));var _=require(_0x3983('0x8'));var squel=require(_0x3983('0x9'));var crypto=require(_0x3983('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3983('0xb'));var toCsv=require(_0x3983('0xc'));var querystring=require(_0x3983('0xd'));var Papa=require(_0x3983('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3983('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3983('0x10'))(_0x3983('0x11'));var utils=require(_0x3983('0x12'));var config=require(_0x3983('0x13'));var licenseUtil=require(_0x3983('0x14'));var db=require(_0x3983('0x15'))['db'];config[_0x3983('0x16')]=_[_0x3983('0x17')](config[_0x3983('0x16')],{'host':_0x3983('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3983('0x16')]));require(_0x3983('0x19'))[_0x3983('0x1a')](socket);var jayson=require(_0x3983('0x1b'));var client=jayson['client'][_0x3983('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x565532,_0x39323b,_0x3ac206,_0x972c2b){return new BPromise(function(_0x58f43a,_0x3fd35d){var _0x291668=_0x972c2b||client;return _0x291668[_0x3983('0x1d')](_0x565532,_0x3ac206)[_0x3983('0x1e')](function(_0x49073c){logger[_0x3983('0x1f')](_0x3983('0x20'),_0x39323b,_0x3983('0x21'));logger[_0x3983('0x22')](_0x3983('0x23'),_0x39323b,'request\x20sent',JSON['stringify'](_0x49073c));if(_0x49073c[_0x3983('0x24')]){if(_0x49073c[_0x3983('0x24')][_0x3983('0x25')]===0x1f4){logger[_0x3983('0x24')](_0x3983('0x20'),_0x39323b,_0x49073c[_0x3983('0x24')][_0x3983('0x26')]);return _0x3fd35d(_0x49073c[_0x3983('0x24')][_0x3983('0x26')]);}logger[_0x3983('0x24')](_0x3983('0x20'),_0x39323b,_0x49073c[_0x3983('0x24')]['message']);return _0x58f43a(_0x49073c[_0x3983('0x24')][_0x3983('0x26')]);}else{logger[_0x3983('0x1f')](_0x3983('0x20'),_0x39323b,_0x3983('0x21'));_0x58f43a(_0x49073c['result'][_0x3983('0x26')]);}})[_0x3983('0x27')](function(_0x59dc55){logger[_0x3983('0x24')](_0x3983('0x20'),_0x39323b,_0x59dc55);_0x3fd35d(_0x59dc55);});});}function respondWithStatusCode(_0xec20bc,_0x5de2ec){_0x5de2ec=_0x5de2ec||0xcc;return function(_0x1853d9){if(_0x1853d9){return _0xec20bc[_0x3983('0x28')](_0x5de2ec);}return _0xec20bc[_0x3983('0x29')](_0x5de2ec)[_0x3983('0x2a')]();};}function respondWithResult(_0x95d2b8,_0x497f11){_0x497f11=_0x497f11||0xc8;return function(_0x872c6b){if(_0x872c6b){return _0x95d2b8[_0x3983('0x29')](_0x497f11)[_0x3983('0x2b')](_0x872c6b);}};}function respondWithFilteredResult(_0x118eb5,_0x5ad7df){return function(_0x5c0486){if(_0x5c0486){var _0x1fc4d2=typeof _0x5ad7df[_0x3983('0x2c')]===_0x3983('0x2d')&&typeof _0x5ad7df[_0x3983('0x2e')]===_0x3983('0x2d');var _0x1fb909=_0x5c0486[_0x3983('0x2f')];var _0x4cd84c=_0x1fc4d2?0x0:_0x5ad7df[_0x3983('0x2c')];var _0x3d63b2=_0x1fc4d2?_0x5c0486[_0x3983('0x2f')]:_0x5ad7df[_0x3983('0x2c')]+_0x5ad7df[_0x3983('0x2e')];var _0x50393c;if(_0x3d63b2>=_0x1fb909){_0x3d63b2=_0x1fb909;_0x50393c=0xc8;}else{_0x50393c=0xce;}_0x118eb5[_0x3983('0x29')](_0x50393c);return _0x118eb5[_0x3983('0x30')](_0x3983('0x31'),_0x4cd84c+'-'+_0x3d63b2+'/'+_0x1fb909)[_0x3983('0x2b')](_0x5c0486);}return null;};}function patchUpdates(_0x1dda49){return function(_0x55a187){try{jsonpatch[_0x3983('0x32')](_0x55a187,_0x1dda49,!![]);}catch(_0x3a23bf){return BPromise[_0x3983('0x33')](_0x3a23bf);}return _0x55a187[_0x3983('0x34')]();};}function saveUpdates(_0x2a2d59,_0x3f1f10){return function(_0x4c32f5){if(_0x4c32f5){return _0x4c32f5[_0x3983('0x35')](_0x2a2d59)[_0x3983('0x1e')](function(_0x1a4644){return _0x1a4644;});}return null;};}function removeEntity(_0x4a4f74,_0x234213){return function(_0x26a033){if(_0x26a033){return _0x26a033[_0x3983('0x36')]()['then'](function(){var _0x14afd0=_0x26a033[_0x3983('0x37')]({'plain':!![]});var _0x3c96a6=_0x3983('0x38');return db[_0x3983('0x39')][_0x3983('0x36')]({'where':{'type':_0x3c96a6,'resourceId':_0x14afd0['id']}})['then'](function(){return _0x26a033;});})[_0x3983('0x1e')](function(){_0x4a4f74[_0x3983('0x29')](0xcc)[_0x3983('0x2a')]();});}};}function handleEntityNotFound(_0x3a1a92,_0x3fe87f){return function(_0xf06b33){if(!_0xf06b33){_0x3a1a92[_0x3983('0x28')](0x194);}return _0xf06b33;};}function handleError(_0x5608a0,_0x303e2d){_0x303e2d=_0x303e2d||0x1f4;return function(_0x59c028){logger[_0x3983('0x24')](_0x59c028[_0x3983('0x3a')]);if(_0x59c028[_0x3983('0x3b')]){delete _0x59c028['name'];}_0x5608a0[_0x3983('0x29')](_0x303e2d)['send'](_0x59c028);};}exports[_0x3983('0x3c')]=function(_0x28a8c7,_0x2c1deb){var _0x206bbc={'include':[{'model':db[_0x3983('0x3d')],'as':_0x3983('0x3e')}]},_0x360b57={},_0x4f9e3a={'count':0x0,'rows':[]};var _0x5109c3=_[_0x3983('0x3f')](db[_0x3983('0x40')]['rawAttributes'],function(_0x4a21e8){return{'name':_0x4a21e8[_0x3983('0x41')],'type':_0x4a21e8[_0x3983('0x42')]['key']};});_0x360b57['model']=_[_0x3983('0x3f')](_0x5109c3,_0x3983('0x3b'));_0x360b57['query']=_[_0x3983('0x43')](_0x28a8c7['query']);_0x360b57[_0x3983('0x44')]=_['intersection'](_0x360b57[_0x3983('0x45')],_0x360b57['query']);_0x206bbc[_0x3983('0x46')]=_[_0x3983('0x47')](_0x360b57[_0x3983('0x45')],qs['fields'](_0x28a8c7[_0x3983('0x48')][_0x3983('0x49')]));_0x206bbc['attributes']=_0x206bbc['attributes'][_0x3983('0x4a')]?_0x206bbc[_0x3983('0x46')]:_0x360b57[_0x3983('0x45')];if(!_0x28a8c7[_0x3983('0x48')]['hasOwnProperty']('nolimit')){_0x206bbc[_0x3983('0x2e')]=qs['limit'](_0x28a8c7[_0x3983('0x48')][_0x3983('0x2e')]);_0x206bbc['offset']=qs['offset'](_0x28a8c7[_0x3983('0x48')][_0x3983('0x2c')]);}_0x206bbc[_0x3983('0x4b')]=qs['sort'](_0x28a8c7[_0x3983('0x48')][_0x3983('0x4c')]);_0x206bbc['where']=qs[_0x3983('0x44')](_[_0x3983('0x4d')](_0x28a8c7[_0x3983('0x48')],_0x360b57[_0x3983('0x44')]),_0x5109c3);if(_0x28a8c7[_0x3983('0x48')]['filter']){_0x206bbc[_0x3983('0x4e')]=_['merge'](_0x206bbc['where'],{'$or':_[_0x3983('0x3f')](_0x5109c3,function(_0x58409b){if(_0x58409b['type']!==_0x3983('0x4f')){var _0x3ff823={};_0x3ff823[_0x58409b[_0x3983('0x3b')]]={'$like':'%'+_0x28a8c7[_0x3983('0x48')]['filter']+'%'};return _0x3ff823;}})});}_0x206bbc=_[_0x3983('0x50')]({},_0x206bbc,_0x28a8c7['options']);var _0x306530={'where':_0x206bbc['where']};return db[_0x3983('0x40')][_0x3983('0x2f')](_0x306530)['then'](function(_0x22749a){_0x4f9e3a['count']=_0x22749a;if(_0x28a8c7[_0x3983('0x48')]['includeAll']){_0x206bbc[_0x3983('0x51')]=[{'all':!![]}];}return db[_0x3983('0x40')][_0x3983('0x52')](_0x206bbc);})[_0x3983('0x1e')](function(_0x4cf43d){_0x4f9e3a[_0x3983('0x53')]=_0x4cf43d;return _0x4f9e3a;})['then'](respondWithFilteredResult(_0x2c1deb,_0x206bbc))[_0x3983('0x27')](handleError(_0x2c1deb,null));};exports[_0x3983('0x54')]=function(_0x5431fb,_0x43a187){var _0x5099a3={'raw':![],'where':{'id':_0x5431fb['params']['id']},'include':[{'model':db[_0x3983('0x3d')],'as':_0x3983('0x3e')}]},_0x5cfda3={};_0x5cfda3[_0x3983('0x45')]=_[_0x3983('0x43')](db['WhatsappAccount'][_0x3983('0x55')]);_0x5cfda3[_0x3983('0x48')]=_[_0x3983('0x43')](_0x5431fb['query']);_0x5cfda3[_0x3983('0x44')]=_[_0x3983('0x47')](_0x5cfda3[_0x3983('0x45')],_0x5cfda3['query']);_0x5099a3[_0x3983('0x46')]=_[_0x3983('0x47')](_0x5cfda3[_0x3983('0x45')],qs[_0x3983('0x49')](_0x5431fb[_0x3983('0x48')][_0x3983('0x49')]));_0x5099a3[_0x3983('0x46')]=_0x5099a3['attributes'][_0x3983('0x4a')]?_0x5099a3['attributes']:_0x5cfda3[_0x3983('0x45')];if(_0x5431fb[_0x3983('0x48')][_0x3983('0x56')]){_0x5099a3[_0x3983('0x51')]=[{'all':!![]}];}_0x5099a3=_[_0x3983('0x50')]({},_0x5099a3,_0x5431fb[_0x3983('0x57')]);return db[_0x3983('0x40')][_0x3983('0x58')](_0x5099a3)[_0x3983('0x1e')](handleEntityNotFound(_0x43a187,null))[_0x3983('0x1e')](respondWithResult(_0x43a187,null))[_0x3983('0x27')](handleError(_0x43a187,null));};exports[_0x3983('0x59')]=function(_0x340c9c,_0x430be9){return db[_0x3983('0x40')]['create'](_0x340c9c[_0x3983('0x5a')],{})[_0x3983('0x1e')](function(_0x44f043){var _0x215093=_0x340c9c[_0x3983('0x5b')]['get']({'plain':!![]});if(!_0x215093)throw new Error(_0x3983('0x5c'));if(_0x215093[_0x3983('0x5d')]===_0x3983('0x5b')){var _0x3aab3e=_0x44f043[_0x3983('0x37')]({'plain':!![]});var _0x10af04='WhatsappAccounts';return db[_0x3983('0x5e')]['find']({'where':{'name':_0x10af04,'userProfileId':_0x215093[_0x3983('0x5f')]},'raw':!![]})[_0x3983('0x1e')](function(_0xbbaac5){if(_0xbbaac5&&_0xbbaac5['autoAssociation']===0x0){return db[_0x3983('0x39')][_0x3983('0x59')]({'name':_0x3aab3e[_0x3983('0x3b')],'resourceId':_0x3aab3e['id'],'type':_0xbbaac5[_0x3983('0x3b')],'sectionId':_0xbbaac5['id']},{})[_0x3983('0x1e')](function(){return _0x44f043;});}else{return _0x44f043;}})['catch'](function(_0x2c60b8){logger[_0x3983('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c60b8);throw _0x2c60b8;});}return _0x44f043;})[_0x3983('0x1e')](respondWithResult(_0x430be9,0xc9))[_0x3983('0x27')](handleError(_0x430be9,null));};exports['update']=function(_0x2fe593,_0x5723ba){if(_0x2fe593['body']['id']){delete _0x2fe593[_0x3983('0x5a')]['id'];}return db[_0x3983('0x40')][_0x3983('0x58')]({'where':{'id':_0x2fe593[_0x3983('0x60')]['id']},'include':[{'model':db[_0x3983('0x3d')],'as':_0x3983('0x3e')}]})['then'](handleEntityNotFound(_0x5723ba,null))['then'](saveUpdates(_0x2fe593[_0x3983('0x5a')],null))[_0x3983('0x1e')](respondWithResult(_0x5723ba,null))[_0x3983('0x27')](handleError(_0x5723ba,null));};exports['destroy']=function(_0x3efcb2,_0x4a7aec){return db[_0x3983('0x40')][_0x3983('0x58')]({'where':{'id':_0x3efcb2[_0x3983('0x60')]['id']}})[_0x3983('0x1e')](handleEntityNotFound(_0x4a7aec,null))[_0x3983('0x1e')](removeEntity(_0x4a7aec,null))[_0x3983('0x27')](handleError(_0x4a7aec,null));};exports[_0x3983('0x61')]=function(_0x115f1e,_0x21cb4b){return db[_0x3983('0x40')]['describe']()[_0x3983('0x1e')](respondWithResult(_0x21cb4b,null))[_0x3983('0x27')](handleError(_0x21cb4b,null));};exports[_0x3983('0x62')]=function(_0x1c898c,_0x4d04be,_0x3f26c3){if(_0x1c898c['body']['id']){delete _0x1c898c[_0x3983('0x5a')]['id'];}return db[_0x3983('0x40')][_0x3983('0x58')]({'where':{'id':_0x1c898c['params']['id']}})['then'](handleEntityNotFound(_0x4d04be,null))['then'](function(_0x1af676){if(_0x1af676){_0x1c898c[_0x3983('0x5a')][_0x3983('0x63')]=_0x1af676['id'];return db[_0x3983('0x64')][_0x3983('0x59')](_0x1c898c[_0x3983('0x5a')]);}})[_0x3983('0x1e')](respondWithResult(_0x4d04be,null))[_0x3983('0x27')](handleError(_0x4d04be,null));};exports[_0x3983('0x65')]=function(_0x18f0bb,_0x5ea996,_0x27ba9f){var _0x5ad195={'raw':![],'where':{}};var _0x22145b={};var _0x130605={'count':0x0,'rows':[]};return db[_0x3983('0x40')]['findOne']({'where':{'id':_0x18f0bb[_0x3983('0x60')]['id']}})['then'](handleEntityNotFound(_0x5ea996,null))['then'](function(_0x3d2cdc){if(_0x3d2cdc){_0x22145b[_0x3983('0x45')]=_[_0x3983('0x43')](db[_0x3983('0x64')][_0x3983('0x55')]);_0x22145b['query']=_[_0x3983('0x43')](_0x18f0bb[_0x3983('0x48')]);_0x22145b[_0x3983('0x44')]=_[_0x3983('0x47')](_0x22145b['model'],_0x22145b[_0x3983('0x48')]);_0x5ad195['attributes']=_[_0x3983('0x47')](_0x22145b['model'],qs[_0x3983('0x49')](_0x18f0bb[_0x3983('0x48')][_0x3983('0x49')]));_0x5ad195['attributes']=_0x5ad195[_0x3983('0x46')][_0x3983('0x4a')]?_0x5ad195['attributes']:_0x22145b['model'];if(!_0x18f0bb['query'][_0x3983('0x66')](_0x3983('0x67'))){_0x5ad195['limit']=qs[_0x3983('0x2e')](_0x18f0bb[_0x3983('0x48')][_0x3983('0x2e')]);_0x5ad195['offset']=qs[_0x3983('0x2c')](_0x18f0bb[_0x3983('0x48')][_0x3983('0x2c')]);}_0x5ad195[_0x3983('0x4b')]=qs[_0x3983('0x4c')](_0x18f0bb[_0x3983('0x48')][_0x3983('0x4c')]);_0x5ad195['where']=qs[_0x3983('0x44')](_['pick'](_0x18f0bb['query'],_0x22145b['filters']));_0x5ad195[_0x3983('0x4e')][_0x3983('0x63')]=_0x3d2cdc['id'];if(_0x18f0bb[_0x3983('0x48')]['filter']){_0x5ad195[_0x3983('0x4e')]=_[_0x3983('0x50')](_0x5ad195[_0x3983('0x4e')],{'$or':_[_0x3983('0x3f')](_0x5ad195[_0x3983('0x46')],function(_0x595d53){var _0x3cd765={};_0x3cd765[_0x595d53]={'$like':'%'+_0x18f0bb[_0x3983('0x48')][_0x3983('0x68')]+'%'};return _0x3cd765;})});}_0x5ad195=_[_0x3983('0x50')]({},_0x5ad195,_0x18f0bb['options']);return db[_0x3983('0x64')]['count']({'where':_0x5ad195['where']})[_0x3983('0x1e')](function(_0x53038a){_0x130605[_0x3983('0x2f')]=_0x53038a;if(_0x18f0bb['query']['includeAll']){_0x5ad195['include']=[{'all':!![]}];}return db[_0x3983('0x64')][_0x3983('0x52')](_0x5ad195);})[_0x3983('0x1e')](function(_0x22e952){_0x130605['rows']=_0x22e952;return _0x130605;});}})[_0x3983('0x1e')](respondWithFilteredResult(_0x5ea996,_0x5ad195))['catch'](handleError(_0x5ea996,null));};exports['removeDispositions']=function(_0x4b5800,_0x36d981,_0x5a354d){return db[_0x3983('0x40')][_0x3983('0x58')]({'where':{'id':_0x4b5800['params']['id']}})[_0x3983('0x1e')](handleEntityNotFound(_0x36d981,null))[_0x3983('0x1e')](function(_0x48b95f){if(_0x48b95f){return _0x48b95f[_0x3983('0x69')](_0x4b5800['query'][_0x3983('0x6a')]);}})[_0x3983('0x1e')](respondWithStatusCode(_0x36d981,null))[_0x3983('0x27')](handleError(_0x36d981,null));};exports['addAnswer']=function(_0x32a2c1,_0x564550,_0x4a2501){if(_0x32a2c1['body']['id']){delete _0x32a2c1[_0x3983('0x5a')]['id'];}return db[_0x3983('0x40')][_0x3983('0x58')]({'where':{'id':_0x32a2c1[_0x3983('0x60')]['id']}})['then'](handleEntityNotFound(_0x564550,null))[_0x3983('0x1e')](function(_0x194a59){if(_0x194a59){_0x32a2c1['body'][_0x3983('0x63')]=_0x194a59['id'];return db[_0x3983('0x6b')][_0x3983('0x59')](_0x32a2c1[_0x3983('0x5a')]);}})['then'](respondWithResult(_0x564550,null))['catch'](handleError(_0x564550,null));};exports[_0x3983('0x6c')]=function(_0x19e196,_0x54af8c,_0x2579dc){var _0x9c9664={'raw':![],'where':{}};var _0x109598={};var _0x483a81={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x3983('0x6d')]({'where':{'id':_0x19e196[_0x3983('0x60')]['id']}})[_0x3983('0x1e')](handleEntityNotFound(_0x54af8c,null))[_0x3983('0x1e')](function(_0x414d7b){if(_0x414d7b){_0x109598[_0x3983('0x45')]=_[_0x3983('0x43')](db[_0x3983('0x6b')][_0x3983('0x55')]);_0x109598[_0x3983('0x48')]=_[_0x3983('0x43')](_0x19e196[_0x3983('0x48')]);_0x109598['filters']=_[_0x3983('0x47')](_0x109598[_0x3983('0x45')],_0x109598[_0x3983('0x48')]);_0x9c9664[_0x3983('0x46')]=_[_0x3983('0x47')](_0x109598['model'],qs[_0x3983('0x49')](_0x19e196[_0x3983('0x48')][_0x3983('0x49')]));_0x9c9664['attributes']=_0x9c9664['attributes'][_0x3983('0x4a')]?_0x9c9664['attributes']:_0x109598[_0x3983('0x45')];if(!_0x19e196['query']['hasOwnProperty'](_0x3983('0x67'))){_0x9c9664['limit']=qs[_0x3983('0x2e')](_0x19e196[_0x3983('0x48')][_0x3983('0x2e')]);_0x9c9664[_0x3983('0x2c')]=qs[_0x3983('0x2c')](_0x19e196[_0x3983('0x48')]['offset']);}_0x9c9664[_0x3983('0x4b')]=qs['sort'](_0x19e196['query'][_0x3983('0x4c')]);_0x9c9664['where']=qs['filters'](_[_0x3983('0x4d')](_0x19e196[_0x3983('0x48')],_0x109598['filters']));_0x9c9664[_0x3983('0x4e')][_0x3983('0x63')]=_0x414d7b['id'];if(_0x19e196['query'][_0x3983('0x68')]){_0x9c9664['where']=_['merge'](_0x9c9664[_0x3983('0x4e')],{'$or':_[_0x3983('0x3f')](_0x9c9664[_0x3983('0x46')],function(_0x53b4a1){var _0x987555={};_0x987555[_0x53b4a1]={'$like':'%'+_0x19e196[_0x3983('0x48')]['filter']+'%'};return _0x987555;})});}_0x9c9664=_[_0x3983('0x50')]({},_0x9c9664,_0x19e196[_0x3983('0x57')]);return db['CannedAnswer'][_0x3983('0x2f')]({'where':_0x9c9664['where']})['then'](function(_0x3fd7b7){_0x483a81[_0x3983('0x2f')]=_0x3fd7b7;if(_0x19e196[_0x3983('0x48')][_0x3983('0x56')]){_0x9c9664['include']=[{'all':!![]}];}return db[_0x3983('0x6b')]['findAll'](_0x9c9664);})['then'](function(_0x4fc640){_0x483a81[_0x3983('0x53')]=_0x4fc640;return _0x483a81;});}})[_0x3983('0x1e')](respondWithFilteredResult(_0x54af8c,_0x9c9664))[_0x3983('0x27')](handleError(_0x54af8c,null));};exports[_0x3983('0x6e')]=function(_0x1834eb,_0x1f5af2,_0x298f4e){return db[_0x3983('0x40')][_0x3983('0x58')]({'where':{'id':_0x1834eb[_0x3983('0x60')]['id']}})['then'](handleEntityNotFound(_0x1f5af2,null))['then'](function(_0x83926b){if(_0x83926b){return _0x83926b[_0x3983('0x6e')](_0x1834eb[_0x3983('0x48')]['ids']);}})[_0x3983('0x1e')](respondWithStatusCode(_0x1f5af2,null))[_0x3983('0x27')](handleError(_0x1f5af2,null));};exports[_0x3983('0x6f')]=function(_0x231f6f,_0x35c0dd,_0x389043){return db[_0x3983('0x40')][_0x3983('0x58')]({'where':{'id':_0x231f6f[_0x3983('0x60')]['id']}})[_0x3983('0x1e')](handleEntityNotFound(_0x35c0dd,null))[_0x3983('0x1e')](function(_0x5aa51f){if(_0x5aa51f){return _0x5aa51f[_0x3983('0x6f')](_0x231f6f[_0x3983('0x5a')]['ids'],_[_0x3983('0x70')](_0x231f6f['body'],[_0x3983('0x6a'),'id'])||{})[_0x3983('0x71')](function(_0x108f2f){for(var _0x21bf84=0x0;_0x21bf84<_0x231f6f[_0x3983('0x5a')][_0x3983('0x6a')][_0x3983('0x4a')];_0x21bf84+=0x1){socket[_0x3983('0x72')](_0x3983('0x73'),{'UserId':Number(_0x231f6f[_0x3983('0x5a')][_0x3983('0x6a')][_0x21bf84]),'WhatsappAccountId':Number(_0x231f6f[_0x3983('0x60')]['id'])});}return _0x108f2f;});}})[_0x3983('0x1e')](respondWithResult(_0x35c0dd,null))[_0x3983('0x27')](handleError(_0x35c0dd,null));};exports[_0x3983('0x74')]=function(_0x16325a,_0x531807,_0x51e4a8){return db[_0x3983('0x40')][_0x3983('0x58')]({'where':{'id':_0x16325a[_0x3983('0x60')]['id']}})[_0x3983('0x1e')](handleEntityNotFound(_0x531807,null))[_0x3983('0x1e')](function(_0x319fb2){if(_0x319fb2){return _0x319fb2[_0x3983('0x74')](_0x16325a[_0x3983('0x48')][_0x3983('0x6a')])['then'](function(){if(_[_0x3983('0x75')](_0x16325a[_0x3983('0x48')][_0x3983('0x6a')])){for(var _0x195e71=0x0;_0x195e71<_0x16325a['query'][_0x3983('0x6a')][_0x3983('0x4a')];_0x195e71+=0x1){socket[_0x3983('0x72')]('userWhatsappAccount:remove',{'UserId':Number(_0x16325a[_0x3983('0x48')][_0x3983('0x6a')][_0x195e71]),'WhatsappAccountId':Number(_0x16325a[_0x3983('0x60')]['id'])});}}else{socket[_0x3983('0x72')](_0x3983('0x76'),{'UserId':Number(_0x16325a[_0x3983('0x48')][_0x3983('0x6a')]),'WhatsappAccountId':Number(_0x16325a['params']['id'])});}});}})[_0x3983('0x1e')](respondWithStatusCode(_0x531807,null))[_0x3983('0x27')](handleError(_0x531807,null));};exports['getAgents']=function(_0x5ee57a,_0x1df593,_0x43c1b6){var _0x3199ad={};var _0x10bb22={};var _0x2958ad;var _0x2e32fb;return db['WhatsappAccount'][_0x3983('0x6d')]({'where':{'id':_0x5ee57a[_0x3983('0x60')]['id']}})['then'](handleEntityNotFound(_0x1df593,null))['then'](function(_0x597841){if(_0x597841){_0x2958ad=_0x597841;_0x10bb22['model']=_[_0x3983('0x43')](db['User'][_0x3983('0x55')]);_0x10bb22[_0x3983('0x48')]=_[_0x3983('0x43')](_0x5ee57a[_0x3983('0x48')]);_0x10bb22[_0x3983('0x44')]=_['intersection'](_0x10bb22[_0x3983('0x45')],_0x10bb22[_0x3983('0x48')]);_0x3199ad[_0x3983('0x46')]=_[_0x3983('0x47')](_0x10bb22[_0x3983('0x45')],qs[_0x3983('0x49')](_0x5ee57a['query']['fields']));_0x3199ad[_0x3983('0x46')]=_0x3199ad['attributes']['length']?_0x3199ad[_0x3983('0x46')]:_0x10bb22[_0x3983('0x45')];_0x3199ad[_0x3983('0x4b')]=qs[_0x3983('0x4c')](_0x5ee57a[_0x3983('0x48')][_0x3983('0x4c')]);_0x3199ad[_0x3983('0x4e')]=qs[_0x3983('0x44')](_[_0x3983('0x4d')](_0x5ee57a['query'],_0x10bb22['filters']));if(_0x5ee57a[_0x3983('0x48')][_0x3983('0x68')]){_0x3199ad['where']=_[_0x3983('0x50')](_0x3199ad['where'],{'$or':_[_0x3983('0x3f')](_0x3199ad[_0x3983('0x46')],function(_0x33418a){var _0x1964b9={};_0x1964b9[_0x33418a]={'$like':'%'+_0x5ee57a[_0x3983('0x48')][_0x3983('0x68')]+'%'};return _0x1964b9;})});}_0x3199ad=_[_0x3983('0x50')]({},_0x3199ad,_0x5ee57a['options']);return _0x2958ad[_0x3983('0x77')](_0x3199ad);}})['then'](function(_0xa5dd8d){if(_0xa5dd8d){_0x2e32fb=_0xa5dd8d['length'];if(!_0x5ee57a[_0x3983('0x48')][_0x3983('0x66')](_0x3983('0x67'))){_0x3199ad[_0x3983('0x2e')]=qs[_0x3983('0x2e')](_0x5ee57a[_0x3983('0x48')][_0x3983('0x2e')]);_0x3199ad[_0x3983('0x2c')]=qs[_0x3983('0x2c')](_0x5ee57a[_0x3983('0x48')]['offset']);}return _0x2958ad[_0x3983('0x77')](_0x3199ad);}})[_0x3983('0x1e')](function(_0x59bdc6){if(_0x59bdc6){return _0x59bdc6?{'count':_0x2e32fb,'rows':_0x59bdc6}:null;}})[_0x3983('0x1e')](respondWithResult(_0x1df593,null))[_0x3983('0x27')](handleError(_0x1df593,null));};exports['addApplications']=function(_0x33c3d0,_0x48e553){var _0x65afe2=_0x33c3d0['params']['id'];var _0x241846=_0x33c3d0[_0x3983('0x5a')];var _0x494ffa=0xc8;var _0x4f758e=null;return db[_0x3983('0x78')][_0x3983('0x79')]({'isolationLevel':db[_0x3983('0x78')][_0x3983('0x7a')][_0x3983('0x7b')][_0x3983('0x7c')]},function(_0x31985b){return db['WhatsappAccount'][_0x3983('0x6d')]({'where':{'id':_0x65afe2},'transaction':_0x31985b})['then'](function(_0x599fdb){if(_0x599fdb){return db[_0x3983('0x7d')][_0x3983('0x36')]({'where':{'WhatsappAccountId':_0x65afe2},'transaction':_0x31985b})[_0x3983('0x1e')](function(){var _0x29ee10=_[_0x3983('0x3f')](_0x241846,function(_0x50caf1){_0x50caf1[_0x3983('0x63')]=_0x65afe2;return _0x50caf1;});return db[_0x3983('0x7d')][_0x3983('0x7e')](_0x29ee10,{'transaction':_0x31985b});});}else{_0x494ffa=0x194;_0x4f758e=[];}});})[_0x3983('0x1e')](function(){if(_0x494ffa!==0x194){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x65afe2},'order':'priority'})[_0x3983('0x1e')](function(_0x3a694a){_0x4f758e=_0x3a694a;});}})[_0x3983('0x27')](function(_0x4ce261){_0x494ffa=0x1f4;logger['error'](_0x4ce261[_0x3983('0x3a')]);if(_0x4ce261[_0x3983('0x3b')]){delete _0x4ce261[_0x3983('0x3b')];}_0x4f758e=_0x4ce261;})[_0x3983('0x7f')](function(){if(_0x4f758e===null){_0x48e553[_0x3983('0x28')](_0x494ffa);}else{if(_0x494ffa===0x1f4){_0x48e553[_0x3983('0x29')](_0x494ffa)[_0x3983('0x80')](_0x4f758e);}else{_0x48e553[_0x3983('0x29')](_0x494ffa)[_0x3983('0x2b')](_0x4f758e);}}});};exports[_0x3983('0x81')]=function(_0x48f0d4,_0x2888e2,_0xbd99aa){var _0x152f29={};var _0x4a0e52={};var _0x7727f0;var _0x4eb3a4;return db['WhatsappAccount']['findOne']({'where':{'id':_0x48f0d4[_0x3983('0x60')]['id']}})['then'](handleEntityNotFound(_0x2888e2,null))[_0x3983('0x1e')](function(_0x51c572){if(_0x51c572){_0x7727f0=_0x51c572;_0x4a0e52[_0x3983('0x45')]=_['keys'](db[_0x3983('0x7d')][_0x3983('0x55')]);_0x4a0e52[_0x3983('0x48')]=_[_0x3983('0x43')](_0x48f0d4[_0x3983('0x48')]);_0x4a0e52[_0x3983('0x44')]=_[_0x3983('0x47')](_0x4a0e52[_0x3983('0x45')],_0x4a0e52[_0x3983('0x48')]);_0x152f29[_0x3983('0x46')]=_[_0x3983('0x47')](_0x4a0e52['model'],qs[_0x3983('0x49')](_0x48f0d4[_0x3983('0x48')][_0x3983('0x49')]));_0x152f29['attributes']=_0x152f29[_0x3983('0x46')][_0x3983('0x4a')]?_0x152f29[_0x3983('0x46')]:_0x4a0e52[_0x3983('0x45')];_0x152f29[_0x3983('0x4b')]=qs['sort'](_0x48f0d4[_0x3983('0x48')][_0x3983('0x4c')]);_0x152f29[_0x3983('0x4e')]=qs[_0x3983('0x44')](_[_0x3983('0x4d')](_0x48f0d4[_0x3983('0x48')],_0x4a0e52[_0x3983('0x44')]));if(_0x48f0d4[_0x3983('0x48')][_0x3983('0x68')]){_0x152f29[_0x3983('0x4e')]=_[_0x3983('0x50')](_0x152f29['where'],{'$or':_[_0x3983('0x3f')](_0x152f29[_0x3983('0x46')],function(_0x4f0363){var _0x38e748={};_0x38e748[_0x4f0363]={'$like':'%'+_0x48f0d4[_0x3983('0x48')][_0x3983('0x68')]+'%'};return _0x38e748;})});}_0x152f29=_[_0x3983('0x50')]({},_0x152f29,_0x48f0d4[_0x3983('0x57')]);return _0x7727f0[_0x3983('0x81')](_0x152f29);}})[_0x3983('0x1e')](function(_0x50cfe8){if(_0x50cfe8){_0x4eb3a4=_0x50cfe8[_0x3983('0x4a')];if(!_0x48f0d4['query']['hasOwnProperty'](_0x3983('0x67'))){_0x152f29[_0x3983('0x2e')]=qs['limit'](_0x48f0d4[_0x3983('0x48')][_0x3983('0x2e')]);_0x152f29[_0x3983('0x2c')]=qs[_0x3983('0x2c')](_0x48f0d4[_0x3983('0x48')]['offset']);}return _0x7727f0[_0x3983('0x81')](_0x152f29);}})['then'](function(_0xdecede){if(_0xdecede){return _0xdecede?{'count':_0x4eb3a4,'rows':_0xdecede}:null;}})[_0x3983('0x1e')](respondWithResult(_0x2888e2,null))['catch'](handleError(_0x2888e2,null));};exports['notify']=function(_0x8433b6,_0x169570,_0x2e7ecd){var _0x29d5aa={'channel':_0x3983('0x82')};var _0x4f1d09=[];var _0x13a2f3=[];var _0x5865d6={};return db[_0x3983('0x40')][_0x3983('0x58')]({'where':{'id':_0x8433b6[_0x3983('0x60')]['id']},'include':[{'model':db[_0x3983('0x7d')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x169570,null))[_0x3983('0x1e')](function(_0x3c6db0){_0x29d5aa['account']=_0x3c6db0;if(_0x29d5aa['account']&&_0x29d5aa['account'][_0x3983('0x42')]===_0x3983('0x83')&&_0x8433b6['body'][_0x3983('0x84')]){if(_0x8433b6[_0x3983('0x5a')][_0x3983('0x84')][_0x3983('0x4a')]===0x0)return;if(_0x8433b6[_0x3983('0x5a')][_0x3983('0x84')][0x0][_0x3983('0x85')]!=='read')return;return db[_0x3983('0x86')]['update']({'read':!![],'readAt':_0x8433b6[_0x3983('0x5a')][_0x3983('0x84')][0x0][_0x3983('0x87')]},{'where':{'messageId':_0x8433b6[_0x3983('0x5a')][_0x3983('0x84')][0x0][_0x3983('0x88')]},'individualHooks':!![]})[_0x3983('0x1e')](function(_0xbca2db){return _0x169570[_0x3983('0x29')](0xc8)[_0x3983('0x2b')](_0xbca2db);});}_0x29d5aa[_0x3983('0x89')]=_['orderBy'](_0x3c6db0[_0x3983('0x8a')],[_0x3983('0x8b')],[_0x3983('0x8c')]);if(_0x29d5aa[_0x3983('0x8d')][_0x3983('0x8a')]){delete _0x29d5aa['account'][_0x3983('0x8a')];}return db[_0x3983('0x8e')][_0x3983('0x61')]()[_0x3983('0x1e')](function(_0x335e82){if(!_0x335e82){throw new db[(_0x3983('0x8f'))][(_0x3983('0x90'))]('no\x20available\x20attributes');}_0x4f1d09=_['difference'](_['keys'](_0x335e82),[_0x3983('0x91'),_0x3983('0x92')]);_0x13a2f3=_['difference'](_['keys'](_0x335e82),['createdAt',_0x3983('0x92'),_0x3983('0x93'),_0x3983('0x94')]);_0x29d5aa['body']={'mapKey':_0x3983('0x95')};if(_0x29d5aa[_0x3983('0x8d')]&&_0x29d5aa[_0x3983('0x8d')][_0x3983('0x42')]===_0x3983('0x96')){_0x29d5aa[_0x3983('0x5a')][_0x3983('0x97')]=_0x8433b6[_0x3983('0x5a')]['From']['replace'](_0x3983('0x98'),'');_0x29d5aa[_0x3983('0x5a')]['body']=_0x8433b6[_0x3983('0x5a')][_0x3983('0x99')];_0x29d5aa[_0x3983('0x5a')]['messageId']=_0x8433b6[_0x3983('0x5a')][_0x3983('0x9a')];}if(_0x29d5aa[_0x3983('0x8d')]&&_0x29d5aa['account'][_0x3983('0x42')]==='sinch'){_0x29d5aa[_0x3983('0x5a')][_0x3983('0x97')]=_0x8433b6[_0x3983('0x5a')]['notifications'][0x0][_0x3983('0x97')];_0x29d5aa['body']['body']=_0x8433b6[_0x3983('0x5a')][_0x3983('0x9b')][0x0]['message'][_0x3983('0x5a')];_0x29d5aa[_0x3983('0x5a')][_0x3983('0x9c')]=_0x8433b6['body']['notifications'][0x0][_0x3983('0x88')];}if(_0x29d5aa['body']['id']){delete _0x29d5aa[_0x3983('0x5a')]['id'];}if(_['isNil'](_0x29d5aa[_0x3983('0x5a')][_0x3983('0x97')])){throw new db[(_0x3983('0x8f'))]['ValidationError'](_0x3983('0x9d'));}if(_[_0x3983('0x9e')](_0x29d5aa[_0x3983('0x5a')][_0x3983('0x5a')])||_0x29d5aa[_0x3983('0x5a')]['body']===''){throw new db[(_0x3983('0x8f'))][(_0x3983('0x90'))](_0x3983('0x9f'));}if(_[_0x3983('0x9e')](_0x29d5aa['body']['mapKey'])){throw new db['Sequelize'][(_0x3983('0x90'))](_0x3983('0xa0')+_0x13a2f3);}if(!_['includes'](_0x13a2f3,_0x29d5aa['body'][_0x3983('0xa1')])){throw new db[(_0x3983('0x8f'))][(_0x3983('0x90'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x13a2f3);}_0x5865d6[_0x29d5aa['body'][_0x3983('0xa1')]]=_0x29d5aa[_0x3983('0x5a')][_0x3983('0x97')];return db['CmList'][_0x3983('0x58')]({'where':{'id':_0x29d5aa['account'][_0x3983('0x94')]},'include':[{'model':db[_0x3983('0x8e')],'as':_0x3983('0xa2'),'where':_0x5865d6,'limit':0x1,'order':[[_0x3983('0x92'),_0x3983('0xa3')]]}]});})[_0x3983('0x1e')](handleEntityNotFound(_0x169570,null))[_0x3983('0x1e')](function(_0x2c83d6){if(_0x2c83d6){_0x29d5aa['list']=_['omit'](_0x2c83d6,['Contacts']);if(_0x2c83d6[_0x3983('0xa2')][_0x3983('0x4a')]){return _0x2c83d6[_0x3983('0xa2')][0x0];}var _0x450973=_[_0x3983('0x17')](_0x29d5aa[_0x3983('0x5a')],{'firstName':_0x29d5aa[_0x3983('0x5a')]['from'],'ListId':_0x2c83d6['id']});_0x450973[_0x29d5aa['body'][_0x3983('0xa1')]]=_0x29d5aa[_0x3983('0x5a')][_0x3983('0x97')];return db[_0x3983('0x8e')][_0x3983('0x59')](_0x450973,{'fields':_0x4f1d09,'raw':!![]});}})[_0x3983('0x1e')](handleEntityNotFound(_0x169570,null))[_0x3983('0x1e')](function(_0x500ebb){if(_0x500ebb){_0x29d5aa[_0x3983('0xa4')]=_0x500ebb;var _0x3660f7={'ContactId':_0x500ebb['id'],'phone':_0x29d5aa[_0x3983('0x5a')][_0x3983('0x97')],'WhatsappAccountId':_0x8433b6[_0x3983('0x60')]['id']};var _0x30394={'ContactId':_0x500ebb['id'],'WhatsappAccountId':_0x8433b6[_0x3983('0x60')]['id'],'closed':![]};return db[_0x3983('0xa5')][_0x3983('0x58')]({'where':_0x30394})[_0x3983('0x1e')](function(_0x31a196){if(_0x31a196){return[_0x31a196,![]];}return db[_0x3983('0xa5')][_0x3983('0x59')](_0x3660f7)[_0x3983('0x1e')](function(_0xf9a7c7){return[_0xf9a7c7,!![]];});});}})[_0x3983('0x71')](function(_0x5c0290,_0x46a318){_0x29d5aa[_0x3983('0xa6')]=_0x5c0290['get']({'plain':!![]});_0x29d5aa[_0x3983('0xa6')][_0x3983('0xa7')]=![];if(_0x46a318){if(_0x29d5aa['account'][_0x3983('0xa8')]){_0x29d5aa[_0x3983('0x89')][_0x3983('0xa9')]({'id':0x0,'priority':_0x29d5aa['applications']['length']+0x1,'app':_0x3983('0xaa'),'appdata':_0x3983('0xab'),'interval':_0x3983('0xac')});}_0x29d5aa[_0x3983('0xa6')][_0x3983('0xa7')]=!![];}return db[_0x3983('0x86')][_0x3983('0x59')]({'phone':_0x29d5aa[_0x3983('0x5a')][_0x3983('0x97')],'messageId':_0x29d5aa[_0x3983('0x5a')]['messageId'],'body':_0x29d5aa['body'][_0x3983('0x5a')],'WhatsappAccountId':_0x8433b6[_0x3983('0x60')]['id'],'WhatsappInteractionId':_0x5c0290['id'],'direction':'in','ContactId':_0x5c0290[_0x3983('0xad')],'AttachmentId':_0x29d5aa['body'][_0x3983('0xae')]});})[_0x3983('0x1e')](function(_0x5fbab6){_0x29d5aa[_0x3983('0x26')]=_0x5fbab6;if(_0x29d5aa[_0x3983('0xa6')][_0x3983('0xaf')]){return db[_0x3983('0xb0')][_0x3983('0x58')]({'attributes':['id',_0x3983('0x3b')],'where':{'id':_0x29d5aa[_0x3983('0xa6')][_0x3983('0xaf')]}})[_0x3983('0x1e')](function(_0x1aacf5){if(_0x1aacf5){_0x29d5aa['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x3983('0xb1'),'appdata':_0x1aacf5[_0x3983('0x3b')]+','+(_0x29d5aa['account'][_0x3983('0xb2')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x3983('0xb3'),'startRouting',_0x29d5aa);});}return respondWithRpcPromise(_0x3983('0xb3'),_0x3983('0xb4'),_0x29d5aa);})[_0x3983('0x1e')](function(_0x25a60c){if(_0x25a60c){var _0x4ef97a=0xc8;var _0xe62ce=_0x3983('0xb5');logger[_0x3983('0x1f')](_0x3983('0x23'),_0xe62ce,_0x4ef97a,'entity\x20found');logger['debug'](_0x3983('0xb6'),_0xe62ce,_0x4ef97a,'entity\x20found',JSON[_0x3983('0xb7')](_0x25a60c));if(_0x29d5aa['account'][_0x3983('0x42')]===_0x3983('0x96')){return _0x169570[_0x3983('0x29')](_0x4ef97a)['set'](_0x3983('0xb8'),_0x3983('0xb9'))[_0x3983('0x80')](_0x3983('0xba'));}else{return _0x169570[_0x3983('0x29')](_0x4ef97a)['json'](_0x25a60c);}}});})['catch'](handleError(_0x169570,null));};exports['send']=function(_0x55b017,_0x428c01,_0x77e802){var _0x1a97d7,_0x54326c,_0x22b751;if(_[_0x3983('0x9e')](_0x55b017[_0x3983('0x5a')][_0x3983('0x5a')])||_0x55b017[_0x3983('0x5a')]['body']===''){throw new db[(_0x3983('0x8f'))][(_0x3983('0x90'))](_0x3983('0x9f'));}if(_['isNil'](_0x55b017[_0x3983('0x5a')]['to'])){throw new db[(_0x3983('0x8f'))]['ValidationError'](_0x3983('0xbb'));}_0x1a97d7=_0x55b017['body']['to'];return db[_0x3983('0x40')][_0x3983('0x58')]({'where':{'id':_0x55b017[_0x3983('0x60')]['id']},'include':[{'model':db['CmList'],'as':_0x3983('0xbc'),'include':[{'model':db[_0x3983('0x8e')],'as':_0x3983('0xa2'),'where':{'mobile':_0x1a97d7},'limit':0x1,'order':[['updatedAt',_0x3983('0xa3')]]}]}]})['then'](handleEntityNotFound(_0x428c01,null))['then'](function(_0x3fe84b){if(_0x3fe84b&&_0x3fe84b[_0x3983('0xbc')]){_0x54326c=_0x3fe84b[_0x3983('0x37')]({'plain':!![]});if(_0x54326c['List']&&_0x54326c['List']['Contacts'][_0x3983('0x4a')]){return _0x54326c[_0x3983('0xbc')][_0x3983('0xa2')][0x0];}return db[_0x3983('0x8e')][_0x3983('0x59')](_[_0x3983('0x17')](_0x55b017['body'],{'firstName':_0x1a97d7,'mobile':_0x1a97d7,'phone':_0x1a97d7,'ListId':_0x54326c[_0x3983('0x94')]}));}})[_0x3983('0x1e')](handleEntityNotFound(_0x428c01,null))[_0x3983('0x1e')](function(_0x54ec6b){if(_0x54ec6b){_0x22b751=_0x54ec6b;return db['WhatsappInteraction'][_0x3983('0x58')]({'where':{'ContactId':_0x22b751['id'],'closed':![],'WhatsappAccountId':_0x54326c['id']}})[_0x3983('0x1e')](function(_0x59a8da){if(_0x59a8da){return[_0x59a8da,![]];}return db[_0x3983('0xa5')][_0x3983('0x59')]({'UserId':_0x55b017[_0x3983('0x5b')]['id'],'ContactId':_0x22b751['id'],'WhatsappAccountId':_0x54326c['id'],'phone':_0x1a97d7,'firstMsgDirection':'out','Messages':[_[_0x3983('0x50')](_0x55b017[_0x3983('0x5a')],{'read':![],'body':_0x55b017[_0x3983('0x5a')][_0x3983('0x5a')],'phone':_0x1a97d7,'WhatsappAccountId':_0x54326c['id'],'UserId':_0x55b017[_0x3983('0x5b')]['id'],'ContactId':_0x22b751['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x3983('0xbd')}]})['then'](function(_0x420ae3){return[_0x420ae3,!![]];});});}})[_0x3983('0x71')](function(_0x1175b9,_0x86d95){if(_0x86d95){return _0x1175b9;}return db[_0x3983('0x86')][_0x3983('0x59')](_['merge'](_0x55b017[_0x3983('0x5a')],{'read':![],'body':_0x55b017[_0x3983('0x5a')][_0x3983('0x5a')],'phone':_0x1a97d7,'WhatsappAccountId':_0x54326c['id'],'WhatsappInteractionId':_0x1175b9['id'],'UserId':_0x55b017[_0x3983('0x5b')]['id'],'ContactId':_0x22b751['id']}))['then'](function(_0x4d0d85){_0x1175b9[_0x3983('0xbe')]['Messages']=[];_0x1175b9['dataValues'][_0x3983('0xbd')][_0x3983('0xa9')](_0x4d0d85['dataValues']);return _0x1175b9;});})[_0x3983('0x1e')](respondWithResult(_0x428c01,null))[_0x3983('0x27')](handleError(_0x428c01,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 7f3152f..dbd40fd 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 _0x0fc5=['remove','emit','hook','../../mysqldb','WhatsappAccount','setMaxListeners','save','update'];(function(_0x259bb2,_0x5190e2){var _0x479a9b=function(_0x349955){while(--_0x349955){_0x259bb2['push'](_0x259bb2['shift']());}};_0x479a9b(++_0x5190e2);}(_0x0fc5,0x6b));var _0x50fc=function(_0x5637a8,_0x152a1f){_0x5637a8=_0x5637a8-0x0;var _0x11fb57=_0x0fc5[_0x5637a8];return _0x11fb57;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x50fc('0x0'))['db'][_0x50fc('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x50fc('0x2')](0x0);var events={'afterCreate':_0x50fc('0x3'),'afterUpdate':_0x50fc('0x4'),'afterDestroy':_0x50fc('0x5')};function emitEvent(_0x48a7a5){return function(_0x3498bf,_0x4d4cac,_0xac7caa){WhatsappAccountEvents[_0x50fc('0x6')](_0x48a7a5+':'+_0x3498bf['id'],_0x3498bf);WhatsappAccountEvents['emit'](_0x48a7a5,_0x3498bf);_0xac7caa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x50fc('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x8a9e=['hasOwnProperty','hook','../../mysqldb','save','remove','emit'];(function(_0x1c5d18,_0x1803ef){var _0x4583d6=function(_0xb4aa40){while(--_0xb4aa40){_0x1c5d18['push'](_0x1c5d18['shift']());}};_0x4583d6(++_0x1803ef);}(_0x8a9e,0x188));var _0xe8a9=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x8a9e[_0x2b10c6];return _0x3789d2;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xe8a9('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe8a9('0x1'),'afterUpdate':'update','afterDestroy':_0xe8a9('0x2')};function emitEvent(_0x5b4ea0){return function(_0x57b57d,_0x462217,_0x1c79bd){WhatsappAccountEvents['emit'](_0x5b4ea0+':'+_0x57b57d['id'],_0x57b57d);WhatsappAccountEvents[_0xe8a9('0x3')](_0x5b4ea0,_0x57b57d);_0x1c79bd(null);};}for(var e in events){if(events[_0xe8a9('0x4')](e)){var event=events[e];WhatsappAccount[_0xe8a9('0x5')](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 ce6eda7..685c270 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 _0x91bf=['./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment'];(function(_0x427352,_0x1bce61){var _0x23e0e6=function(_0x2a42a9){while(--_0x2a42a9){_0x427352['push'](_0x427352['shift']());}};_0x23e0e6(++_0x1bce61);}(_0x91bf,0x1a8));var _0xf91b=function(_0x33614c,_0x37e369){_0x33614c=_0x33614c-0x0;var _0x2fff4a=_0x91bf[_0x33614c];return _0x2fff4a;};'use strict';var _=require(_0xf91b('0x0'));var util=require('util');var logger=require(_0xf91b('0x1'))(_0xf91b('0x2'));var moment=require('moment');var BPromise=require(_0xf91b('0x3'));var rp=require(_0xf91b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf91b('0x5'));var attributes=require(_0xf91b('0x6'));module['exports']=function(_0x5d335d,_0x5cf311){return _0x5d335d[_0xf91b('0x7')](_0xf91b('0x8'),attributes,{'tableName':_0xf91b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5074=['api','moment','bluebird','path','rimraf','exports','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger'];(function(_0x36decb,_0x398689){var _0x1e80b0=function(_0x2ee604){while(--_0x2ee604){_0x36decb['push'](_0x36decb['shift']());}};_0x1e80b0(++_0x398689);}(_0x5074,0x6c));var _0x4507=function(_0x3dee92,_0x55e1eb){_0x3dee92=_0x3dee92-0x0;var _0x44d36e=_0x5074[_0x3dee92];return _0x44d36e;};'use strict';var _=require(_0x4507('0x0'));var util=require('util');var logger=require(_0x4507('0x1'))(_0x4507('0x2'));var moment=require(_0x4507('0x3'));var BPromise=require(_0x4507('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4507('0x5'));var rimraf=require(_0x4507('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module[_0x4507('0x7')]=function(_0x359c9c,_0x30b8ed){return _0x359c9c['define'](_0x4507('0x8'),attributes,{'tableName':_0x4507('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 dfe64f2..52917df 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 _0xe4a3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','info','result','find','options','where','attributes','map','include','model','then','ShowWhatsappAccount','moment'];(function(_0x1b9b74,_0xd2ba13){var _0x33a515=function(_0x1b4d6b){while(--_0x1b4d6b){_0x1b9b74['push'](_0x1b9b74['shift']());}};_0x33a515(++_0xd2ba13);}(_0xe4a3,0x107));var _0x3e4a=function(_0x4d180c,_0x45c68e){_0x4d180c=_0x4d180c-0x0;var _0x49b57e=_0xe4a3[_0x4d180c];return _0x49b57e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3e4a('0x0'));var BPromise=require(_0x3e4a('0x1'));var rs=require(_0x3e4a('0x2'));var fs=require('fs');var Redis=require(_0x3e4a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3e4a('0x4'));var logger=require(_0x3e4a('0x5'))(_0x3e4a('0x6'));var config=require(_0x3e4a('0x7'));var jayson=require(_0x3e4a('0x8'));var client=jayson[_0x3e4a('0x9')][_0x3e4a('0xa')]({'port':0x232a});config['redis']=_[_0x3e4a('0xb')](config['redis'],{'host':_0x3e4a('0xc'),'port':0x18eb});var socket=require(_0x3e4a('0xd'))(new Redis(config[_0x3e4a('0xe')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x3f8918,_0x19afa2,_0x11c4b6){return new BPromise(function(_0x267957,_0x3fb125){return client['request'](_0x3f8918,_0x11c4b6)['then'](function(_0x452b1a){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x19afa2,_0x3e4a('0xf'));logger[_0x3e4a('0x10')](_0x3e4a('0x11'),_0x19afa2,_0x3e4a('0xf'),JSON[_0x3e4a('0x12')](_0x452b1a));if(_0x452b1a[_0x3e4a('0x13')]){if(_0x452b1a[_0x3e4a('0x13')]['code']===0x1f4){logger['error'](_0x3e4a('0x14'),_0x19afa2,_0x452b1a[_0x3e4a('0x13')][_0x3e4a('0x15')]);return _0x3fb125(_0x452b1a['error'][_0x3e4a('0x15')]);}logger[_0x3e4a('0x13')](_0x3e4a('0x14'),_0x19afa2,_0x452b1a[_0x3e4a('0x13')][_0x3e4a('0x15')]);return _0x267957(_0x452b1a[_0x3e4a('0x13')][_0x3e4a('0x15')]);}else{logger[_0x3e4a('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x19afa2,'request\x20sent');_0x267957(_0x452b1a[_0x3e4a('0x17')][_0x3e4a('0x15')]);}})['catch'](function(_0x1958c0){logger[_0x3e4a('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x19afa2,_0x1958c0);_0x3fb125(_0x1958c0);});});}exports['ShowWhatsappAccount']=function(_0x4023b6){var _0x5490d6=this;return new Promise(function(_0x2a144f,_0x39c1f5){return db['WhatsappAccount'][_0x3e4a('0x18')]({'raw':_0x4023b6['options']?_0x4023b6[_0x3e4a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4023b6['options']?_0x4023b6[_0x3e4a('0x19')][_0x3e4a('0x1a')]||null:null,'attributes':_0x4023b6[_0x3e4a('0x19')]?_0x4023b6[_0x3e4a('0x19')][_0x3e4a('0x1b')]||null:null,'include':_0x4023b6['options']?_0x4023b6[_0x3e4a('0x19')]['include']?_[_0x3e4a('0x1c')](_0x4023b6[_0x3e4a('0x19')][_0x3e4a('0x1d')],function(_0x3095dc){return{'model':db[_0x3095dc[_0x3e4a('0x1e')]],'as':_0x3095dc['as'],'attributes':_0x3095dc[_0x3e4a('0x1b')],'include':_0x3095dc[_0x3e4a('0x1d')]?_[_0x3e4a('0x1c')](_0x3095dc['include'],function(_0x1626cb){return{'model':db[_0x1626cb[_0x3e4a('0x1e')]],'as':_0x1626cb['as'],'attributes':_0x1626cb[_0x3e4a('0x1b')],'include':_0x1626cb[_0x3e4a('0x1d')]?_[_0x3e4a('0x1c')](_0x1626cb[_0x3e4a('0x1d')],function(_0x244b7a){return{'model':db[_0x244b7a[_0x3e4a('0x1e')]],'as':_0x244b7a['as'],'attributes':_0x244b7a['attributes']};}):[]};}):[]};}):[]:[]})[_0x3e4a('0x1f')](function(_0x284508){logger[_0x3e4a('0x16')](_0x3e4a('0x20'),_0x4023b6);logger[_0x3e4a('0x10')](_0x3e4a('0x20'),_0x4023b6,JSON[_0x3e4a('0x12')](_0x284508));_0x2a144f(_0x284508);})['catch'](function(_0x1efe2e){logger[_0x3e4a('0x13')](_0x3e4a('0x20'),_0x1efe2e[_0x3e4a('0x15')],_0x4023b6);_0x39c1f5(_0x5490d6[_0x3e4a('0x13')](0x1f4,_0x1efe2e[_0x3e4a('0x15')]));});});}; \ No newline at end of file +var _0xe34c=['where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','debug','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','request\x20sent','catch','ShowWhatsappAccount','find','options'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0xe34c,0x1cc));var _0xce34=function(_0x507c1c,_0x594f86){_0x507c1c=_0x507c1c-0x0;var _0x17b9c7=_0xe34c[_0x507c1c];return _0x17b9c7;};'use strict';var _=require(_0xce34('0x0'));var util=require(_0xce34('0x1'));var moment=require('moment');var BPromise=require(_0xce34('0x2'));var rs=require(_0xce34('0x3'));var fs=require('fs');var Redis=require(_0xce34('0x4'));var db=require(_0xce34('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xce34('0x6'))(_0xce34('0x7'));var config=require('../../config/environment');var jayson=require(_0xce34('0x8'));var client=jayson[_0xce34('0x9')]['http']({'port':0x232a});config['redis']=_[_0xce34('0xa')](config[_0xce34('0xb')],{'host':_0xce34('0xc'),'port':0x18eb});var socket=require(_0xce34('0xd'))(new Redis(config[_0xce34('0xb')]));require(_0xce34('0xe'))[_0xce34('0xf')](socket);function respondWithRpcPromise(_0xb99cf1,_0x548643,_0x54cd2d){return new BPromise(function(_0x9635bc,_0x2a0784){return client[_0xce34('0x10')](_0xb99cf1,_0x54cd2d)[_0xce34('0x11')](function(_0x3b7674){logger[_0xce34('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x548643,'request\x20sent');logger[_0xce34('0x13')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x548643,'request\x20sent',JSON[_0xce34('0x14')](_0x3b7674));if(_0x3b7674[_0xce34('0x15')]){if(_0x3b7674[_0xce34('0x15')][_0xce34('0x16')]===0x1f4){logger[_0xce34('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x548643,_0x3b7674[_0xce34('0x15')][_0xce34('0x17')]);return _0x2a0784(_0x3b7674[_0xce34('0x15')]['message']);}logger['error'](_0xce34('0x18'),_0x548643,_0x3b7674['error'][_0xce34('0x17')]);return _0x9635bc(_0x3b7674[_0xce34('0x15')]['message']);}else{logger[_0xce34('0x12')](_0xce34('0x18'),_0x548643,_0xce34('0x19'));_0x9635bc(_0x3b7674['result'][_0xce34('0x17')]);}})[_0xce34('0x1a')](function(_0x3b752f){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x548643,_0x3b752f);_0x2a0784(_0x3b752f);});});}exports[_0xce34('0x1b')]=function(_0x5b188a){var _0x42a3e8=this;return new Promise(function(_0x4122b8,_0x1b2373){return db['WhatsappAccount'][_0xce34('0x1c')]({'raw':_0x5b188a[_0xce34('0x1d')]?_0x5b188a[_0xce34('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5b188a[_0xce34('0x1d')]?_0x5b188a[_0xce34('0x1d')][_0xce34('0x1e')]||null:null,'attributes':_0x5b188a[_0xce34('0x1d')]?_0x5b188a[_0xce34('0x1d')][_0xce34('0x1f')]||null:null,'include':_0x5b188a[_0xce34('0x1d')]?_0x5b188a[_0xce34('0x1d')][_0xce34('0x20')]?_[_0xce34('0x21')](_0x5b188a[_0xce34('0x1d')][_0xce34('0x20')],function(_0x5c2ccb){return{'model':db[_0x5c2ccb[_0xce34('0x22')]],'as':_0x5c2ccb['as'],'attributes':_0x5c2ccb[_0xce34('0x1f')],'include':_0x5c2ccb['include']?_[_0xce34('0x21')](_0x5c2ccb[_0xce34('0x20')],function(_0x5bed9d){return{'model':db[_0x5bed9d[_0xce34('0x22')]],'as':_0x5bed9d['as'],'attributes':_0x5bed9d[_0xce34('0x1f')],'include':_0x5bed9d[_0xce34('0x20')]?_[_0xce34('0x21')](_0x5bed9d[_0xce34('0x20')],function(_0x4b0b6d){return{'model':db[_0x4b0b6d[_0xce34('0x22')]],'as':_0x4b0b6d['as'],'attributes':_0x4b0b6d['attributes']};}):[]};}):[]};}):[]:[]})[_0xce34('0x11')](function(_0x439f86){logger[_0xce34('0x12')]('ShowWhatsappAccount',_0x5b188a);logger[_0xce34('0x13')](_0xce34('0x1b'),_0x5b188a,JSON[_0xce34('0x14')](_0x439f86));_0x4122b8(_0x439f86);})['catch'](function(_0x28babb){logger['error'](_0xce34('0x1b'),_0x28babb[_0xce34('0x17')],_0x5b188a);_0x1b2373(_0x42a3e8['error'](0x1f4,_0x28babb['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index a3df3b5..cefcb02 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 _0xb68b=['register','length','./whatsappAccount.events','save','remove','update','emit','removeListener'];(function(_0x2238ba,_0xfeb953){var _0x33032f=function(_0x337e44){while(--_0x337e44){_0x2238ba['push'](_0x2238ba['shift']());}};_0x33032f(++_0xfeb953);}(_0xb68b,0x9a));var _0xbb68=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xb68b[_0x5d6456];return _0x4d66c1;};'use strict';var WhatsappAccountEvents=require(_0xbb68('0x0'));var events=[_0xbb68('0x1'),_0xbb68('0x2'),_0xbb68('0x3')];function createListener(_0x121e29,_0x378163){return function(_0x48ba2e){_0x378163[_0xbb68('0x4')](_0x121e29,_0x48ba2e);};}function removeListener(_0x1a1d2e,_0x25c75c){return function(){WhatsappAccountEvents[_0xbb68('0x5')](_0x1a1d2e,_0x25c75c);};}exports[_0xbb68('0x6')]=function(_0x3775f0){for(var _0x2bfd45=0x0,_0x5233c2=events[_0xbb68('0x7')];_0x2bfd45<_0x5233c2;_0x2bfd45++){var _0x25b69f=events[_0x2bfd45];var _0x35357c=createListener('whatsappAccount:'+_0x25b69f,_0x3775f0);WhatsappAccountEvents['on'](_0x25b69f,_0x35357c);}}; \ No newline at end of file +var _0xb3ca=['whatsappAccount:','./whatsappAccount.events','save','remove','update','removeListener','register','length'];(function(_0x296bf1,_0x5a9279){var _0x5adc7a=function(_0x267813){while(--_0x267813){_0x296bf1['push'](_0x296bf1['shift']());}};_0x5adc7a(++_0x5a9279);}(_0xb3ca,0x151));var _0xab3c=function(_0x340e24,_0xde71e){_0x340e24=_0x340e24-0x0;var _0x1808a=_0xb3ca[_0x340e24];return _0x1808a;};'use strict';var WhatsappAccountEvents=require(_0xab3c('0x0'));var events=[_0xab3c('0x1'),_0xab3c('0x2'),_0xab3c('0x3')];function createListener(_0x1206ed,_0x1d46ae){return function(_0xd02338){_0x1d46ae['emit'](_0x1206ed,_0xd02338);};}function removeListener(_0x4e9e96,_0x1c1abe){return function(){WhatsappAccountEvents[_0xab3c('0x4')](_0x4e9e96,_0x1c1abe);};}exports[_0xab3c('0x5')]=function(_0x2621a4){for(var _0xa1c504=0x0,_0x35c1a3=events[_0xab3c('0x6')];_0xa1c504<_0x35c1a3;_0xa1c504++){var _0x73fe6f=events[_0xa1c504];var _0x1cff1b=createListener(_0xab3c('0x7')+_0x73fe6f,_0x2621a4);WhatsappAccountEvents['on'](_0x73fe6f,_0x1cff1b);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 97973de..ae4b4e4 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 _0x5125=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x57621b,_0x41ba1f){var _0x45b5d7=function(_0x26b0f0){while(--_0x26b0f0){_0x57621b['push'](_0x57621b['shift']());}};_0x45b5d7(++_0x41ba1f);}(_0x5125,0xcb));var _0x5512=function(_0x44d237,_0x464b03){_0x44d237=_0x44d237-0x0;var _0x5e5d08=_0x5125[_0x44d237];return _0x5e5d08;};'use strict';var multer=require(_0x5512('0x0'));var util=require(_0x5512('0x1'));var path=require(_0x5512('0x2'));var timeout=require(_0x5512('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5512('0x4'));var auth=require(_0x5512('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5512('0x6'));var controller=require('./whatsappApplication.controller');router[_0x5512('0x7')]('/',auth[_0x5512('0x8')](),controller[_0x5512('0x9')]);router[_0x5512('0x7')](_0x5512('0xa'),auth['isAuthenticated'](),controller[_0x5512('0xb')]);router[_0x5512('0xc')]('/',auth[_0x5512('0x8')](),controller[_0x5512('0xd')]);router[_0x5512('0xe')](_0x5512('0xa'),auth[_0x5512('0x8')](),controller[_0x5512('0xf')]);router[_0x5512('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5512('0x11')]);module[_0x5512('0x12')]=router; \ No newline at end of file +var _0x0c3c=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x4a0f5a,_0xaa4371){var _0x5435ef=function(_0x563b9f){while(--_0x563b9f){_0x4a0f5a['push'](_0x4a0f5a['shift']());}};_0x5435ef(++_0xaa4371);}(_0x0c3c,0x199));var _0xc0c3=function(_0x1cee55,_0xe75188){_0x1cee55=_0x1cee55-0x0;var _0x4f640a=_0x0c3c[_0x1cee55];return _0x4f640a;};'use strict';var multer=require(_0xc0c3('0x0'));var util=require('util');var path=require(_0xc0c3('0x1'));var timeout=require(_0xc0c3('0x2'));var express=require(_0xc0c3('0x3'));var router=express['Router']();var fs_extra=require(_0xc0c3('0x4'));var auth=require(_0xc0c3('0x5'));var interaction=require(_0xc0c3('0x6'));var config=require(_0xc0c3('0x7'));var controller=require('./whatsappApplication.controller');router[_0xc0c3('0x8')]('/',auth[_0xc0c3('0x9')](),controller[_0xc0c3('0xa')]);router[_0xc0c3('0x8')](_0xc0c3('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xc0c3('0xc')]('/',auth[_0xc0c3('0x9')](),controller[_0xc0c3('0xd')]);router[_0xc0c3('0xe')](_0xc0c3('0xb'),auth[_0xc0c3('0x9')](),controller['update']);router[_0xc0c3('0xf')](_0xc0c3('0xb'),auth[_0xc0c3('0x9')](),controller[_0xc0c3('0x10')]);module[_0xc0c3('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index d96377e..7ea8cf7 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 _0xe688=['INTEGER','TEXT','STRING','*,*,*,*','exports'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xe688,0x144));var _0x8e68=function(_0x4b1b76,_0x2246ba){_0x4b1b76=_0x4b1b76-0x0;var _0x1aa885=_0xe688[_0x4b1b76];return _0x1aa885;};'use strict';var Sequelize=require('sequelize');module[_0x8e68('0x0')]={'priority':{'type':Sequelize[_0x8e68('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8e68('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8e68('0x3')],'defaultValue':_0x8e68('0x4')}}; \ No newline at end of file +var _0xd661=['exports','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x401a73,_0x222281){var _0x548283=function(_0x2bd35c){while(--_0x2bd35c){_0x401a73['push'](_0x401a73['shift']());}};_0x548283(++_0x222281);}(_0xd661,0x13a));var _0x1d66=function(_0x15c679,_0x402cc0){_0x15c679=_0x15c679-0x0;var _0x152d42=_0xd661[_0x15c679];return _0x152d42;};'use strict';var Sequelize=require(_0x1d66('0x0'));module[_0x1d66('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x1d66('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x1d66('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1d66('0x2')],'defaultValue':_0x1d66('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 0fdb8ee..2c5ac1a 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 _0xf9e5=['util','path','to-csv','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','set','json','apply','reject','save','error','stack','name','send','index','map','type','key','query','intersection','model','attributes','fields','length','nolimit','offset','sort','where','filters','pick','filter','merge','options','WhatsappApplication','then','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x5c4fa9,_0x20ab63){var _0x462ec6=function(_0x3b3956){while(--_0x3b3956){_0x5c4fa9['push'](_0x5c4fa9['shift']());}};_0x462ec6(++_0x20ab63);}(_0xf9e5,0x89));var _0x5f9e=function(_0x5bdf1c,_0x217719){_0x5bdf1c=_0x5bdf1c-0x0;var _0x4a17ba=_0xf9e5[_0x5bdf1c];return _0x4a17ba;};'use strict';var emlformat=require(_0x5f9e('0x0'));var rimraf=require(_0x5f9e('0x1'));var zipdir=require(_0x5f9e('0x2'));var jsonpatch=require(_0x5f9e('0x3'));var rp=require(_0x5f9e('0x4'));var moment=require(_0x5f9e('0x5'));var BPromise=require(_0x5f9e('0x6'));var Mustache=require('mustache');var util=require(_0x5f9e('0x7'));var path=require(_0x5f9e('0x8'));var sox=require('sox');var csv=require(_0x5f9e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f9e('0xa'));var squel=require(_0x5f9e('0xb'));var crypto=require('crypto');var jsforce=require(_0x5f9e('0xc'));var deskjs=require(_0x5f9e('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5f9e('0xe'));var authService=require(_0x5f9e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5f9e('0x10'));var hardwareService=require(_0x5f9e('0x11'));var logger=require(_0x5f9e('0x12'))(_0x5f9e('0x13'));var utils=require(_0x5f9e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5f9e('0x15'));var db=require(_0x5f9e('0x16'))['db'];function respondWithStatusCode(_0xc6f097,_0x46013e){_0x46013e=_0x46013e||0xcc;return function(_0x4a5917){if(_0x4a5917){return _0xc6f097[_0x5f9e('0x17')](_0x46013e);}return _0xc6f097[_0x5f9e('0x18')](_0x46013e)['end']();};}function respondWithResult(_0x550b03,_0x236bb1){_0x236bb1=_0x236bb1||0xc8;return function(_0x25b363){if(_0x25b363){return _0x550b03[_0x5f9e('0x18')](_0x236bb1)['json'](_0x25b363);}};}function respondWithFilteredResult(_0x44efdd,_0x41514f){return function(_0x395d9a){if(_0x395d9a){var _0x280001=typeof _0x41514f['offset']===_0x5f9e('0x19')&&typeof _0x41514f[_0x5f9e('0x1a')]==='undefined';var _0x4a6e2f=_0x395d9a[_0x5f9e('0x1b')];var _0x5891a2=_0x280001?0x0:_0x41514f['offset'];var _0x1a81c0=_0x280001?_0x395d9a[_0x5f9e('0x1b')]:_0x41514f['offset']+_0x41514f[_0x5f9e('0x1a')];var _0x5a5a9c;if(_0x1a81c0>=_0x4a6e2f){_0x1a81c0=_0x4a6e2f;_0x5a5a9c=0xc8;}else{_0x5a5a9c=0xce;}_0x44efdd[_0x5f9e('0x18')](_0x5a5a9c);return _0x44efdd[_0x5f9e('0x1c')]('Content-Range',_0x5891a2+'-'+_0x1a81c0+'/'+_0x4a6e2f)[_0x5f9e('0x1d')](_0x395d9a);}return null;};}function patchUpdates(_0x357f8c){return function(_0x1e5f68){try{jsonpatch[_0x5f9e('0x1e')](_0x1e5f68,_0x357f8c,!![]);}catch(_0xf679a2){return BPromise[_0x5f9e('0x1f')](_0xf679a2);}return _0x1e5f68[_0x5f9e('0x20')]();};}function saveUpdates(_0x496bf3,_0x3d0cca){return function(_0x2465ae){if(_0x2465ae){return _0x2465ae['update'](_0x496bf3)['then'](function(_0x25fb51){return _0x25fb51;});}return null;};}function removeEntity(_0x573dbe,_0x346732){return function(_0x227afd){if(_0x227afd){return _0x227afd['destroy']()['then'](function(){_0x573dbe['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb667f9,_0x3b14a9){return function(_0x5b1509){if(!_0x5b1509){_0xb667f9['sendStatus'](0x194);}return _0x5b1509;};}function handleError(_0x4102a5,_0x3ae3ce){_0x3ae3ce=_0x3ae3ce||0x1f4;return function(_0x31df5c){logger[_0x5f9e('0x21')](_0x31df5c[_0x5f9e('0x22')]);if(_0x31df5c[_0x5f9e('0x23')]){delete _0x31df5c[_0x5f9e('0x23')];}_0x4102a5['status'](_0x3ae3ce)[_0x5f9e('0x24')](_0x31df5c);};}exports[_0x5f9e('0x25')]=function(_0x342ac2,_0x10e8bf){var _0x457e11={},_0x420525={},_0x566caf={'count':0x0,'rows':[]};var _0x4bde22=_[_0x5f9e('0x26')](db['WhatsappApplication']['rawAttributes'],function(_0x44ed1f){return{'name':_0x44ed1f['fieldName'],'type':_0x44ed1f[_0x5f9e('0x27')][_0x5f9e('0x28')]};});_0x420525['model']=_[_0x5f9e('0x26')](_0x4bde22,_0x5f9e('0x23'));_0x420525[_0x5f9e('0x29')]=_['keys'](_0x342ac2[_0x5f9e('0x29')]);_0x420525['filters']=_[_0x5f9e('0x2a')](_0x420525[_0x5f9e('0x2b')],_0x420525['query']);_0x457e11[_0x5f9e('0x2c')]=_[_0x5f9e('0x2a')](_0x420525[_0x5f9e('0x2b')],qs[_0x5f9e('0x2d')](_0x342ac2[_0x5f9e('0x29')][_0x5f9e('0x2d')]));_0x457e11['attributes']=_0x457e11[_0x5f9e('0x2c')][_0x5f9e('0x2e')]?_0x457e11[_0x5f9e('0x2c')]:_0x420525[_0x5f9e('0x2b')];if(!_0x342ac2[_0x5f9e('0x29')]['hasOwnProperty'](_0x5f9e('0x2f'))){_0x457e11[_0x5f9e('0x1a')]=qs['limit'](_0x342ac2[_0x5f9e('0x29')][_0x5f9e('0x1a')]);_0x457e11[_0x5f9e('0x30')]=qs[_0x5f9e('0x30')](_0x342ac2[_0x5f9e('0x29')][_0x5f9e('0x30')]);}_0x457e11['order']=qs[_0x5f9e('0x31')](_0x342ac2[_0x5f9e('0x29')]['sort']);_0x457e11[_0x5f9e('0x32')]=qs[_0x5f9e('0x33')](_[_0x5f9e('0x34')](_0x342ac2[_0x5f9e('0x29')],_0x420525[_0x5f9e('0x33')]),_0x4bde22);if(_0x342ac2['query'][_0x5f9e('0x35')]){_0x457e11[_0x5f9e('0x32')]=_[_0x5f9e('0x36')](_0x457e11['where'],{'$or':_[_0x5f9e('0x26')](_0x4bde22,function(_0x4e3d04){if(_0x4e3d04[_0x5f9e('0x27')]!=='VIRTUAL'){var _0x3af37e={};_0x3af37e[_0x4e3d04[_0x5f9e('0x23')]]={'$like':'%'+_0x342ac2[_0x5f9e('0x29')][_0x5f9e('0x35')]+'%'};return _0x3af37e;}})});}_0x457e11=_[_0x5f9e('0x36')]({},_0x457e11,_0x342ac2[_0x5f9e('0x37')]);var _0x20ba93={'where':_0x457e11[_0x5f9e('0x32')]};return db[_0x5f9e('0x38')]['count'](_0x20ba93)[_0x5f9e('0x39')](function(_0x385936){_0x566caf[_0x5f9e('0x1b')]=_0x385936;if(_0x342ac2[_0x5f9e('0x29')][_0x5f9e('0x3a')]){_0x457e11[_0x5f9e('0x3b')]=[{'all':!![]}];}return db[_0x5f9e('0x38')][_0x5f9e('0x3c')](_0x457e11);})['then'](function(_0x22df8c){_0x566caf[_0x5f9e('0x3d')]=_0x22df8c;return _0x566caf;})[_0x5f9e('0x39')](respondWithFilteredResult(_0x10e8bf,_0x457e11))['catch'](handleError(_0x10e8bf,null));};exports[_0x5f9e('0x3e')]=function(_0x334aa4,_0x12e1ad){var _0x55439e={'raw':!![],'where':{'id':_0x334aa4[_0x5f9e('0x3f')]['id']}},_0x577069={};_0x577069['model']=_[_0x5f9e('0x40')](db[_0x5f9e('0x38')][_0x5f9e('0x41')]);_0x577069[_0x5f9e('0x29')]=_['keys'](_0x334aa4[_0x5f9e('0x29')]);_0x577069[_0x5f9e('0x33')]=_['intersection'](_0x577069[_0x5f9e('0x2b')],_0x577069[_0x5f9e('0x29')]);_0x55439e[_0x5f9e('0x2c')]=_['intersection'](_0x577069[_0x5f9e('0x2b')],qs['fields'](_0x334aa4[_0x5f9e('0x29')]['fields']));_0x55439e[_0x5f9e('0x2c')]=_0x55439e[_0x5f9e('0x2c')]['length']?_0x55439e[_0x5f9e('0x2c')]:_0x577069[_0x5f9e('0x2b')];if(_0x334aa4[_0x5f9e('0x29')]['includeAll']){_0x55439e['include']=[{'all':!![]}];}_0x55439e=_[_0x5f9e('0x36')]({},_0x55439e,_0x334aa4[_0x5f9e('0x37')]);return db[_0x5f9e('0x38')][_0x5f9e('0x42')](_0x55439e)[_0x5f9e('0x39')](handleEntityNotFound(_0x12e1ad,null))[_0x5f9e('0x39')](respondWithResult(_0x12e1ad,null))[_0x5f9e('0x43')](handleError(_0x12e1ad,null));};exports[_0x5f9e('0x44')]=function(_0x2098bd,_0x1069bd){return db['WhatsappApplication']['create'](_0x2098bd['body'],{})['then'](respondWithResult(_0x1069bd,0xc9))[_0x5f9e('0x43')](handleError(_0x1069bd,null));};exports[_0x5f9e('0x45')]=function(_0x2e6773,_0xc9e73e){if(_0x2e6773[_0x5f9e('0x46')]['id']){delete _0x2e6773[_0x5f9e('0x46')]['id'];}return db[_0x5f9e('0x38')][_0x5f9e('0x42')]({'where':{'id':_0x2e6773[_0x5f9e('0x3f')]['id']}})[_0x5f9e('0x39')](handleEntityNotFound(_0xc9e73e,null))[_0x5f9e('0x39')](saveUpdates(_0x2e6773['body'],null))['then'](respondWithResult(_0xc9e73e,null))[_0x5f9e('0x43')](handleError(_0xc9e73e,null));};exports[_0x5f9e('0x47')]=function(_0x4f17ee,_0x3334e2){return db['WhatsappApplication'][_0x5f9e('0x42')]({'where':{'id':_0x4f17ee[_0x5f9e('0x3f')]['id']}})[_0x5f9e('0x39')](handleEntityNotFound(_0x3334e2,null))[_0x5f9e('0x39')](removeEntity(_0x3334e2,null))[_0x5f9e('0x43')](handleError(_0x3334e2,null));}; \ No newline at end of file +var _0xbd0a=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','status','error','stack','name','send','index','map','WhatsappApplication','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','find','create','body','eml-format','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x4ca5d4,_0x25e0e){var _0x44798a=function(_0x4abf1c){while(--_0x4abf1c){_0x4ca5d4['push'](_0x4ca5d4['shift']());}};_0x44798a(++_0x25e0e);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x571560,_0x588a19){_0x571560=_0x571560-0x0;var _0x1dce89=_0xbd0a[_0x571560];return _0x1dce89;};'use strict';var emlformat=require(_0xabd0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xabd0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xabd0('0x2'));var Mustache=require(_0xabd0('0x3'));var util=require(_0xabd0('0x4'));var path=require(_0xabd0('0x5'));var sox=require(_0xabd0('0x6'));var csv=require(_0xabd0('0x7'));var ejs=require(_0xabd0('0x8'));var fs=require('fs');var fs_extra=require(_0xabd0('0x9'));var _=require(_0xabd0('0xa'));var squel=require('squel');var crypto=require(_0xabd0('0xb'));var jsforce=require(_0xabd0('0xc'));var deskjs=require(_0xabd0('0xd'));var toCsv=require('to-csv');var querystring=require(_0xabd0('0xe'));var Papa=require('papaparse');var Redis=require(_0xabd0('0xf'));var authService=require(_0xabd0('0x10'));var qs=require(_0xabd0('0x11'));var as=require(_0xabd0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xabd0('0x13'))('api');var utils=require(_0xabd0('0x14'));var config=require(_0xabd0('0x15'));var licenseUtil=require(_0xabd0('0x16'));var db=require(_0xabd0('0x17'))['db'];function respondWithStatusCode(_0x3bf33,_0xd66d68){_0xd66d68=_0xd66d68||0xcc;return function(_0x5b0f34){if(_0x5b0f34){return _0x3bf33[_0xabd0('0x18')](_0xd66d68);}return _0x3bf33['status'](_0xd66d68)[_0xabd0('0x19')]();};}function respondWithResult(_0x145f76,_0x5ceb94){_0x5ceb94=_0x5ceb94||0xc8;return function(_0x56ba31){if(_0x56ba31){return _0x145f76['status'](_0x5ceb94)['json'](_0x56ba31);}};}function respondWithFilteredResult(_0x679d0b,_0x26d8fd){return function(_0x97f4ec){if(_0x97f4ec){var _0xdb7a40=typeof _0x26d8fd[_0xabd0('0x1a')]===_0xabd0('0x1b')&&typeof _0x26d8fd[_0xabd0('0x1c')]===_0xabd0('0x1b');var _0x2d17b1=_0x97f4ec['count'];var _0x3a0ace=_0xdb7a40?0x0:_0x26d8fd['offset'];var _0x579dcd=_0xdb7a40?_0x97f4ec[_0xabd0('0x1d')]:_0x26d8fd[_0xabd0('0x1a')]+_0x26d8fd[_0xabd0('0x1c')];var _0x23f955;if(_0x579dcd>=_0x2d17b1){_0x579dcd=_0x2d17b1;_0x23f955=0xc8;}else{_0x23f955=0xce;}_0x679d0b['status'](_0x23f955);return _0x679d0b[_0xabd0('0x1e')](_0xabd0('0x1f'),_0x3a0ace+'-'+_0x579dcd+'/'+_0x2d17b1)['json'](_0x97f4ec);}return null;};}function patchUpdates(_0x56c2f5){return function(_0x1c955e){try{jsonpatch[_0xabd0('0x20')](_0x1c955e,_0x56c2f5,!![]);}catch(_0x4d9416){return BPromise[_0xabd0('0x21')](_0x4d9416);}return _0x1c955e[_0xabd0('0x22')]();};}function saveUpdates(_0xa1ebf,_0x1e077e){return function(_0x4c9f3a){if(_0x4c9f3a){return _0x4c9f3a[_0xabd0('0x23')](_0xa1ebf)[_0xabd0('0x24')](function(_0x3376bc){return _0x3376bc;});}return null;};}function removeEntity(_0x462420,_0x264167){return function(_0xf6dbad){if(_0xf6dbad){return _0xf6dbad[_0xabd0('0x25')]()[_0xabd0('0x24')](function(){_0x462420[_0xabd0('0x26')](0xcc)[_0xabd0('0x19')]();});}};}function handleEntityNotFound(_0x52c8be,_0x369dd0){return function(_0x2699c4){if(!_0x2699c4){_0x52c8be[_0xabd0('0x18')](0x194);}return _0x2699c4;};}function handleError(_0x3e0dd2,_0x31b869){_0x31b869=_0x31b869||0x1f4;return function(_0x399996){logger[_0xabd0('0x27')](_0x399996[_0xabd0('0x28')]);if(_0x399996[_0xabd0('0x29')]){delete _0x399996[_0xabd0('0x29')];}_0x3e0dd2[_0xabd0('0x26')](_0x31b869)[_0xabd0('0x2a')](_0x399996);};}exports[_0xabd0('0x2b')]=function(_0x3246de,_0x1fe955){var _0x15096f={},_0x5427a0={},_0x1c0d90={'count':0x0,'rows':[]};var _0x2d4c55=_[_0xabd0('0x2c')](db[_0xabd0('0x2d')]['rawAttributes'],function(_0x1ef94b){return{'name':_0x1ef94b[_0xabd0('0x2e')],'type':_0x1ef94b[_0xabd0('0x2f')]['key']};});_0x5427a0[_0xabd0('0x30')]=_[_0xabd0('0x2c')](_0x2d4c55,'name');_0x5427a0[_0xabd0('0x31')]=_['keys'](_0x3246de[_0xabd0('0x31')]);_0x5427a0[_0xabd0('0x32')]=_[_0xabd0('0x33')](_0x5427a0[_0xabd0('0x30')],_0x5427a0[_0xabd0('0x31')]);_0x15096f[_0xabd0('0x34')]=_['intersection'](_0x5427a0[_0xabd0('0x30')],qs[_0xabd0('0x35')](_0x3246de[_0xabd0('0x31')][_0xabd0('0x35')]));_0x15096f[_0xabd0('0x34')]=_0x15096f[_0xabd0('0x34')][_0xabd0('0x36')]?_0x15096f[_0xabd0('0x34')]:_0x5427a0[_0xabd0('0x30')];if(!_0x3246de[_0xabd0('0x31')][_0xabd0('0x37')](_0xabd0('0x38'))){_0x15096f[_0xabd0('0x1c')]=qs[_0xabd0('0x1c')](_0x3246de[_0xabd0('0x31')]['limit']);_0x15096f['offset']=qs['offset'](_0x3246de[_0xabd0('0x31')][_0xabd0('0x1a')]);}_0x15096f[_0xabd0('0x39')]=qs[_0xabd0('0x3a')](_0x3246de[_0xabd0('0x31')]['sort']);_0x15096f['where']=qs['filters'](_[_0xabd0('0x3b')](_0x3246de['query'],_0x5427a0[_0xabd0('0x32')]),_0x2d4c55);if(_0x3246de[_0xabd0('0x31')][_0xabd0('0x3c')]){_0x15096f[_0xabd0('0x3d')]=_[_0xabd0('0x3e')](_0x15096f[_0xabd0('0x3d')],{'$or':_[_0xabd0('0x2c')](_0x2d4c55,function(_0x42e86e){if(_0x42e86e['type']!==_0xabd0('0x3f')){var _0x592de0={};_0x592de0[_0x42e86e['name']]={'$like':'%'+_0x3246de[_0xabd0('0x31')][_0xabd0('0x3c')]+'%'};return _0x592de0;}})});}_0x15096f=_[_0xabd0('0x3e')]({},_0x15096f,_0x3246de[_0xabd0('0x40')]);var _0x1b8687={'where':_0x15096f['where']};return db[_0xabd0('0x2d')][_0xabd0('0x1d')](_0x1b8687)[_0xabd0('0x24')](function(_0x2e0bdf){_0x1c0d90['count']=_0x2e0bdf;if(_0x3246de[_0xabd0('0x31')][_0xabd0('0x41')]){_0x15096f[_0xabd0('0x42')]=[{'all':!![]}];}return db[_0xabd0('0x2d')][_0xabd0('0x43')](_0x15096f);})[_0xabd0('0x24')](function(_0x2aa5a9){_0x1c0d90[_0xabd0('0x44')]=_0x2aa5a9;return _0x1c0d90;})[_0xabd0('0x24')](respondWithFilteredResult(_0x1fe955,_0x15096f))[_0xabd0('0x45')](handleError(_0x1fe955,null));};exports[_0xabd0('0x46')]=function(_0x975bbe,_0x237a33){var _0x514ea3={'raw':!![],'where':{'id':_0x975bbe[_0xabd0('0x47')]['id']}},_0x2ba135={};_0x2ba135[_0xabd0('0x30')]=_['keys'](db['WhatsappApplication'][_0xabd0('0x48')]);_0x2ba135[_0xabd0('0x31')]=_[_0xabd0('0x49')](_0x975bbe[_0xabd0('0x31')]);_0x2ba135[_0xabd0('0x32')]=_['intersection'](_0x2ba135['model'],_0x2ba135[_0xabd0('0x31')]);_0x514ea3[_0xabd0('0x34')]=_[_0xabd0('0x33')](_0x2ba135[_0xabd0('0x30')],qs[_0xabd0('0x35')](_0x975bbe['query'][_0xabd0('0x35')]));_0x514ea3[_0xabd0('0x34')]=_0x514ea3[_0xabd0('0x34')]['length']?_0x514ea3[_0xabd0('0x34')]:_0x2ba135[_0xabd0('0x30')];if(_0x975bbe[_0xabd0('0x31')][_0xabd0('0x41')]){_0x514ea3['include']=[{'all':!![]}];}_0x514ea3=_[_0xabd0('0x3e')]({},_0x514ea3,_0x975bbe[_0xabd0('0x40')]);return db[_0xabd0('0x2d')][_0xabd0('0x4a')](_0x514ea3)['then'](handleEntityNotFound(_0x237a33,null))[_0xabd0('0x24')](respondWithResult(_0x237a33,null))[_0xabd0('0x45')](handleError(_0x237a33,null));};exports[_0xabd0('0x4b')]=function(_0xc80459,_0x2a1069){return db[_0xabd0('0x2d')]['create'](_0xc80459['body'],{})[_0xabd0('0x24')](respondWithResult(_0x2a1069,0xc9))['catch'](handleError(_0x2a1069,null));};exports['update']=function(_0x2293bd,_0x1610d9){if(_0x2293bd[_0xabd0('0x4c')]['id']){delete _0x2293bd[_0xabd0('0x4c')]['id'];}return db['WhatsappApplication'][_0xabd0('0x4a')]({'where':{'id':_0x2293bd[_0xabd0('0x47')]['id']}})[_0xabd0('0x24')](handleEntityNotFound(_0x1610d9,null))[_0xabd0('0x24')](saveUpdates(_0x2293bd['body'],null))['then'](respondWithResult(_0x1610d9,null))[_0xabd0('0x45')](handleError(_0x1610d9,null));};exports[_0xabd0('0x25')]=function(_0x16dd64,_0x32a5c9){return db[_0xabd0('0x2d')][_0xabd0('0x4a')]({'where':{'id':_0x16dd64[_0xabd0('0x47')]['id']}})[_0xabd0('0x24')](handleEntityNotFound(_0x32a5c9,null))[_0xabd0('0x24')](removeEntity(_0x32a5c9,null))['catch'](handleError(_0x32a5c9,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 4ae2a1a..d151b09 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 _0x38d3=['./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x11ca63,_0xea9f9c){var _0x41f1f6=function(_0xb80b69){while(--_0xb80b69){_0x11ca63['push'](_0x11ca63['shift']());}};_0x41f1f6(++_0xea9f9c);}(_0x38d3,0x1a7));var _0x338d=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x38d3[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x338d('0x0'));var util=require(_0x338d('0x1'));var logger=require('../../config/logger')(_0x338d('0x2'));var moment=require(_0x338d('0x3'));var BPromise=require(_0x338d('0x4'));var rp=require(_0x338d('0x5'));var fs=require('fs');var path=require(_0x338d('0x6'));var rimraf=require(_0x338d('0x7'));var config=require(_0x338d('0x8'));var attributes=require(_0x338d('0x9'));module[_0x338d('0xa')]=function(_0x4e32b4,_0x2a056d){return _0x4e32b4[_0x338d('0xb')](_0x338d('0xc'),attributes,{'tableName':_0x338d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x338d('0xe'),'collate':_0x338d('0xf')});}; \ No newline at end of file +var _0x4006=['../../config/environment','define','WhatsappApplication','whatsapp_applications','utf8mb4','util','../../config/logger','api','moment','path'];(function(_0x152aa4,_0x512cdb){var _0x227143=function(_0xbf99e0){while(--_0xbf99e0){_0x152aa4['push'](_0x152aa4['shift']());}};_0x227143(++_0x512cdb);}(_0x4006,0x1c7));var _0x6400=function(_0x5a3975,_0x19d772){_0x5a3975=_0x5a3975-0x0;var _0x5ef02d=_0x4006[_0x5a3975];return _0x5ef02d;};'use strict';var _=require('lodash');var util=require(_0x6400('0x0'));var logger=require(_0x6400('0x1'))(_0x6400('0x2'));var moment=require(_0x6400('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6400('0x4'));var rimraf=require('rimraf');var config=require(_0x6400('0x5'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x2dbd03,_0x599e6f){return _0x2dbd03[_0x6400('0x6')](_0x6400('0x7'),attributes,{'tableName':_0x6400('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6400('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 42a4305..6880e8b 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 _0x17ba=['code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5eef31,_0x428539){var _0x4d7baa=function(_0x303d59){while(--_0x303d59){_0x5eef31['push'](_0x5eef31['shift']());}};_0x4d7baa(++_0x428539);}(_0x17ba,0xab));var _0xa17b=function(_0x21594a,_0x27a636){_0x21594a=_0x21594a-0x0;var _0x2cd6fc=_0x17ba[_0x21594a];return _0x2cd6fc;};'use strict';var _=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var moment=require('moment');var BPromise=require(_0xa17b('0x2'));var rs=require(_0xa17b('0x3'));var fs=require('fs');var Redis=require(_0xa17b('0x4'));var db=require(_0xa17b('0x5'))['db'];var utils=require(_0xa17b('0x6'));var logger=require(_0xa17b('0x7'))(_0xa17b('0x8'));var config=require(_0xa17b('0x9'));var jayson=require(_0xa17b('0xa'));var client=jayson[_0xa17b('0xb')][_0xa17b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e3d43,_0x1957be,_0x57f9cd){return new BPromise(function(_0x2ca4d3,_0x17d1d2){return client[_0xa17b('0xd')](_0x2e3d43,_0x57f9cd)[_0xa17b('0xe')](function(_0x15bdfc){logger['info'](_0xa17b('0xf'),_0x1957be,_0xa17b('0x10'));logger[_0xa17b('0x11')](_0xa17b('0x12'),_0x1957be,_0xa17b('0x10'),JSON[_0xa17b('0x13')](_0x15bdfc));if(_0x15bdfc[_0xa17b('0x14')]){if(_0x15bdfc['error'][_0xa17b('0x15')]===0x1f4){logger[_0xa17b('0x14')](_0xa17b('0xf'),_0x1957be,_0x15bdfc['error'][_0xa17b('0x16')]);return _0x17d1d2(_0x15bdfc[_0xa17b('0x14')][_0xa17b('0x16')]);}logger[_0xa17b('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x1957be,_0x15bdfc[_0xa17b('0x14')]['message']);return _0x2ca4d3(_0x15bdfc[_0xa17b('0x14')][_0xa17b('0x16')]);}else{logger['info'](_0xa17b('0xf'),_0x1957be,_0xa17b('0x10'));_0x2ca4d3(_0x15bdfc[_0xa17b('0x17')][_0xa17b('0x16')]);}})['catch'](function(_0x98a295){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x1957be,_0x98a295);_0x17d1d2(_0x98a295);});});} \ No newline at end of file +var _0x9bde=['code','message','WhatsappApplication,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x4b141e,_0x18f608){var _0x21c384=function(_0x20eb14){while(--_0x20eb14){_0x4b141e['push'](_0x4b141e['shift']());}};_0x21c384(++_0x18f608);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4dfbfe,_0x80b6cc){_0x4dfbfe=_0x4dfbfe-0x0;var _0xca1fda=_0x9bde[_0x4dfbfe];return _0xca1fda;};'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')]('WhatsappApplication,\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')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('WhatsappApplication,\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')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index a43aec9..b6ca29b 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 _0x2b83=['getMessages','/:id/download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','whatsappinteraction:update','removeTags','exports','util','path','express','Router','fs-extra','../../config/environment','./whatsappInteraction.controller','isAuthenticated','get','/describe','describe','/:id','/:id/messages'];(function(_0x2766d8,_0x2db5b5){var _0x51cb7a=function(_0x150b77){while(--_0x150b77){_0x2766d8['push'](_0x2766d8['shift']());}};_0x51cb7a(++_0x2db5b5);}(_0x2b83,0x1d3));var _0x32b8=function(_0x237954,_0x343ad6){_0x237954=_0x237954-0x0;var _0x42b847=_0x2b83[_0x237954];return _0x42b847;};'use strict';var multer=require('multer');var util=require(_0x32b8('0x0'));var path=require(_0x32b8('0x1'));var timeout=require('connect-timeout');var express=require(_0x32b8('0x2'));var router=express[_0x32b8('0x3')]();var fs_extra=require(_0x32b8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x32b8('0x5'));var controller=require(_0x32b8('0x6'));router['get']('/',auth[_0x32b8('0x7')](),controller['index']);router[_0x32b8('0x8')](_0x32b8('0x9'),auth[_0x32b8('0x7')](),controller[_0x32b8('0xa')]);router['get'](_0x32b8('0xb'),auth[_0x32b8('0x7')](),controller['show']);router['get'](_0x32b8('0xc'),auth['isAuthenticated'](),controller[_0x32b8('0xd')]);router[_0x32b8('0x8')](_0x32b8('0xe'),auth[_0x32b8('0x7')](),controller['download']);router[_0x32b8('0xf')]('/',auth[_0x32b8('0x7')](),controller['create']);router['post'](_0x32b8('0xc'),auth['isAuthenticated'](),controller[_0x32b8('0x10')]);router['post'](_0x32b8('0x11'),auth[_0x32b8('0x7')](),interaction[_0x32b8('0x12')](_0x32b8('0x13'),_0x32b8('0x14')),controller['addTags']);router['put'](_0x32b8('0xb'),auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0x32b8('0x15')),controller['update']);router['delete'](_0x32b8('0xb'),auth[_0x32b8('0x7')](),interaction[_0x32b8('0x12')](_0x32b8('0x13'),'whatsappinteraction:destroy'),controller['destroy']);router['delete'](_0x32b8('0x11'),auth[_0x32b8('0x7')](),controller[_0x32b8('0x16')]);module[_0x32b8('0x17')]=router; \ No newline at end of file +var _0x7217=['/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','whatsappinteraction:addtags','addTags','whatsapp','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x2a3552,_0x187b2f){var _0x3e81a5=function(_0x234fbc){while(--_0x234fbc){_0x2a3552['push'](_0x2a3552['shift']());}};_0x3e81a5(++_0x187b2f);}(_0x7217,0x19e));var _0x7721=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x7217[_0x521929];return _0x632436;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x13')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0x14')]);router['post'](_0x7721('0xf'),auth[_0x7721('0x9')](),controller['addMessage']);router[_0x7721('0x13')](_0x7721('0x15'),auth[_0x7721('0x9')](),interaction[_0x7721('0x16')]('whatsapp',_0x7721('0x17')),controller[_0x7721('0x18')]);router['put']('/:id',auth['isAuthenticated'](),interaction[_0x7721('0x16')](_0x7721('0x19'),_0x7721('0x1a')),controller[_0x7721('0x1b')]);router['delete'](_0x7721('0xd'),auth['isAuthenticated'](),interaction[_0x7721('0x16')]('whatsapp',_0x7721('0x1c')),controller[_0x7721('0x1d')]);router[_0x7721('0x1e')](_0x7721('0x15'),auth[_0x7721('0x9')](),controller[_0x7721('0x1f')]);module[_0x7721('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 1aad4ac..520eec5 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 _0x943c=['sequelize','moment','exports','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x18c129,_0x44f693){var _0x1d33a9=function(_0x486fa7){while(--_0x486fa7){_0x18c129['push'](_0x18c129['shift']());}};_0x1d33a9(++_0x44f693);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc943('0x0'));var moment=require(_0xc943('0x1'));module[_0xc943('0x2')]={'closed':{'type':Sequelize[_0xc943('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc943('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc943('0x4')]},'note':{'type':Sequelize[_0xc943('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xc943('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xc943('0x6')]('in',_0xc943('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc943('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xc943('0x6')]('in',_0xc943('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc943('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x1939=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x5b9807,_0x1b828a){var _0x32ca53=function(_0x5194e4){while(--_0x5194e4){_0x5b9807['push'](_0x5b9807['shift']());}};_0x32ca53(++_0x1b828a);}(_0x1939,0x1d1));var _0x9193=function(_0xbbfe59,_0x46067f){_0xbbfe59=_0xbbfe59-0x0;var _0x28a2a4=_0x1939[_0xbbfe59];return _0x28a2a4;};'use strict';var Sequelize=require(_0x9193('0x0'));var moment=require('moment');module[_0x9193('0x1')]={'closed':{'type':Sequelize[_0x9193('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9193('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9193('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9193('0x4')]},'note':{'type':Sequelize[_0x9193('0x4')]},'phone':{'type':Sequelize[_0x9193('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x9193('0x5')]('in',_0x9193('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9193('0x5')]('in',_0x9193('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9193('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 18de161..3bb960a 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 _0xc931=['direction','secret','read','value','renderFile','views','downloadInteraction.ejs','transcript-','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','status','sendStatus','error','stack','name','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','whatsapp','user','catch','show','model','keys','query','filters','intersection','fields','attributes','length','includeAll','include','options','find','create','body','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','sort','where','pick','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','format','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','attachments','Attachment','Messages','createdAt','WhatsappAccount','Account','Owner','fullname','get','Whatsapp','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System'];(function(_0x3702ec,_0x352d5e){var _0x51531a=function(_0x27b6de){while(--_0x27b6de){_0x3702ec['push'](_0x3702ec['shift']());}};_0x51531a(++_0x352d5e);}(_0xc931,0x19c));var _0x1c93=function(_0x423c8e,_0x2765f7){_0x423c8e=_0x423c8e-0x0;var _0x54ea88=_0xc931[_0x423c8e];return _0x54ea88;};'use strict';var rimraf=require(_0x1c93('0x0'));var zipdir=require(_0x1c93('0x1'));var moment=require('moment');var BPromise=require(_0x1c93('0x2'));var util=require(_0x1c93('0x3'));var path=require(_0x1c93('0x4'));var ejs=require(_0x1c93('0x5'));var fs=require('fs');var _=require(_0x1c93('0x6'));var Redis=require(_0x1c93('0x7'));var interaction=require(_0x1c93('0x8'));var qs=require(_0x1c93('0x9'));var pdf=require(_0x1c93('0xa'));var logger=require('../../config/logger')(_0x1c93('0xb'));var config=require(_0x1c93('0xc'));var db=require(_0x1c93('0xd'))['db'];config['redis']=_[_0x1c93('0xe')](config[_0x1c93('0xf')],{'host':_0x1c93('0x10'),'port':0x18eb});var socket=require(_0x1c93('0x11'))(new Redis(config[_0x1c93('0xf')]));require(_0x1c93('0x12'))['register'](socket);function respondWithStatusCode(_0x78ce89,_0x498c41){_0x498c41=_0x498c41||0xcc;return function(_0x551e59){if(_0x551e59){return _0x78ce89['sendStatus'](_0x498c41);}return _0x78ce89['status'](_0x498c41)[_0x1c93('0x13')]();};}function respondWithResult(_0x8f5c5b,_0x27ad45){_0x27ad45=_0x27ad45||0xc8;return function(_0x12f21d){if(_0x12f21d){return _0x8f5c5b['status'](_0x27ad45)[_0x1c93('0x14')](_0x12f21d);}};}function respondWithFilteredResult(_0x17c1e5,_0x2c7f56){return function(_0x4cb0a6){if(_0x4cb0a6){var _0x4014c0=typeof _0x2c7f56[_0x1c93('0x15')]===_0x1c93('0x16')&&typeof _0x2c7f56[_0x1c93('0x17')]===_0x1c93('0x16');var _0x830129=_0x4cb0a6[_0x1c93('0x18')];var _0x5be810=_0x4014c0?0x0:_0x2c7f56['offset'];var _0x2f6f2c=_0x4014c0?_0x4cb0a6[_0x1c93('0x18')]:_0x2c7f56[_0x1c93('0x15')]+_0x2c7f56[_0x1c93('0x17')];var _0x51aa35;if(_0x2f6f2c>=_0x830129){_0x2f6f2c=_0x830129;_0x51aa35=0xc8;}else{_0x51aa35=0xce;}_0x17c1e5['status'](_0x51aa35);return _0x17c1e5[_0x1c93('0x19')](_0x1c93('0x1a'),_0x5be810+'-'+_0x2f6f2c+'/'+_0x830129)[_0x1c93('0x14')](_0x4cb0a6);}return null;};}function saveUpdates(_0x173af4){return function(_0x195839){if(_0x195839){return _0x195839[_0x1c93('0x1b')](_0x173af4)['then'](function(_0x5baf98){return _0x5baf98;});}return null;};}function removeEntity(_0x5719a5){return function(_0x574747){if(_0x574747){return _0x574747[_0x1c93('0x1c')]()[_0x1c93('0x1d')](function(){_0x5719a5[_0x1c93('0x1e')](0xcc)[_0x1c93('0x13')]();});}};}function handleEntityNotFound(_0x24faa1){return function(_0x2343c3){if(!_0x2343c3){_0x24faa1[_0x1c93('0x1f')](0x194);}return _0x2343c3;};}function handleError(_0x4f0629,_0x14b99b){_0x14b99b=_0x14b99b||0x1f4;return function(_0x26c4b2){logger[_0x1c93('0x20')](_0x26c4b2[_0x1c93('0x21')]);if(_0x26c4b2[_0x1c93('0x22')]){delete _0x26c4b2[_0x1c93('0x22')];}_0x4f0629[_0x1c93('0x1e')](_0x14b99b)['send'](_0x26c4b2);};}exports[_0x1c93('0x23')]=function(_0x27d52b,_0x5be8b9){var _0x18f1ce={};var _0x1c275c=_[_0x1c93('0x24')](db[_0x1c93('0x25')][_0x1c93('0x26')],function(_0x449e65){return{'name':_0x449e65[_0x1c93('0x27')],'type':_0x449e65[_0x1c93('0x28')][_0x1c93('0x29')]};});_0x18f1ce=qs[_0x1c93('0x2a')](_0x1c275c,_0x27d52b);return interaction['findAll'](_0x1c93('0x2b'),_0x27d52b['query'],_0x27d52b[_0x1c93('0x2c')],_0x18f1ce,_0x1c275c)[_0x1c93('0x1d')](respondWithFilteredResult(_0x5be8b9,_0x18f1ce))[_0x1c93('0x2d')](handleError(_0x5be8b9,null));};exports[_0x1c93('0x2e')]=function(_0x457a9a,_0x2b5428){var _0x2832e8={'raw':![],'where':{'id':_0x457a9a['params']['id']}},_0x55058c={};_0x55058c[_0x1c93('0x2f')]=_[_0x1c93('0x30')](db[_0x1c93('0x25')][_0x1c93('0x26')]);_0x55058c[_0x1c93('0x31')]=_[_0x1c93('0x30')](_0x457a9a[_0x1c93('0x31')]);_0x55058c[_0x1c93('0x32')]=_['intersection'](_0x55058c[_0x1c93('0x2f')],_0x55058c[_0x1c93('0x31')]);_0x2832e8['attributes']=_[_0x1c93('0x33')](_0x55058c[_0x1c93('0x2f')],qs[_0x1c93('0x34')](_0x457a9a['query'][_0x1c93('0x34')]));_0x2832e8[_0x1c93('0x35')]=_0x2832e8[_0x1c93('0x35')][_0x1c93('0x36')]?_0x2832e8[_0x1c93('0x35')]:_0x55058c[_0x1c93('0x2f')];if(_0x457a9a[_0x1c93('0x31')][_0x1c93('0x37')]){_0x2832e8[_0x1c93('0x38')]=[{'all':!![]}];}_0x2832e8=_['merge']({},_0x2832e8,_0x457a9a[_0x1c93('0x39')]);return db[_0x1c93('0x25')][_0x1c93('0x3a')](_0x2832e8)[_0x1c93('0x1d')](handleEntityNotFound(_0x2b5428,null))[_0x1c93('0x1d')](respondWithResult(_0x2b5428,null))['catch'](handleError(_0x2b5428,null));};exports['create']=function(_0x3ae63b,_0xb93403){return db['WhatsappInteraction'][_0x1c93('0x3b')](_0x3ae63b[_0x1c93('0x3c')],{})[_0x1c93('0x1d')](respondWithResult(_0xb93403,0xc9))[_0x1c93('0x2d')](handleError(_0xb93403,null));};exports[_0x1c93('0x1b')]=function(_0x21d311,_0x16b40c){if(_0x21d311[_0x1c93('0x3c')]['id']){delete _0x21d311[_0x1c93('0x3c')]['id'];}return db['WhatsappInteraction'][_0x1c93('0x3a')]({'where':{'id':_0x21d311['params']['id']}})[_0x1c93('0x1d')](handleEntityNotFound(_0x16b40c,null))[_0x1c93('0x1d')](saveUpdates(_0x21d311['body'],null))[_0x1c93('0x1d')](respondWithResult(_0x16b40c,null))[_0x1c93('0x2d')](handleError(_0x16b40c,null));};exports[_0x1c93('0x1c')]=function(_0x1847e4,_0x26e4d5){return db[_0x1c93('0x25')][_0x1c93('0x3a')]({'where':{'id':_0x1847e4[_0x1c93('0x3d')]['id']}})[_0x1c93('0x1d')](handleEntityNotFound(_0x26e4d5,null))[_0x1c93('0x1d')](removeEntity(_0x26e4d5,null))[_0x1c93('0x2d')](handleError(_0x26e4d5,null));};exports[_0x1c93('0x3e')]=function(_0x3ac35d,_0x4f9fde){return db[_0x1c93('0x25')]['describe']()[_0x1c93('0x1d')](respondWithResult(_0x4f9fde,null))[_0x1c93('0x2d')](handleError(_0x4f9fde,null));};exports[_0x1c93('0x3f')]=function(_0x441a6f,_0x1c2f1e){return db[_0x1c93('0x40')][_0x1c93('0x3a')]({'where':{'id':_0x441a6f[_0x1c93('0x3d')]['id']}})[_0x1c93('0x1d')](handleEntityNotFound(_0x1c2f1e,null))[_0x1c93('0x1d')](function(_0x33117b){if(_0x33117b){return _0x33117b[_0x1c93('0x3f')](_0x441a6f[_0x1c93('0x3c')][_0x1c93('0x41')],_[_0x1c93('0x42')](_0x441a6f[_0x1c93('0x3c')],[_0x1c93('0x41'),'id'])||{});}})[_0x1c93('0x1d')](respondWithResult(_0x1c2f1e,null))[_0x1c93('0x2d')](handleError(_0x1c2f1e,null));};exports[_0x1c93('0x43')]=function(_0x3bcbee,_0x356df4){var _0x50e242={'raw':![],'where':{}};var _0x13ccd2={};var _0x3e772c={'count':0x0,'rows':[]};return db[_0x1c93('0x25')][_0x1c93('0x44')]({'where':{'id':_0x3bcbee[_0x1c93('0x3d')]['id']}})[_0x1c93('0x1d')](handleEntityNotFound(_0x356df4,null))[_0x1c93('0x1d')](function(_0x3c99af){if(_0x3c99af){_0x13ccd2[_0x1c93('0x2f')]=_[_0x1c93('0x30')](db['WhatsappMessage'][_0x1c93('0x26')]);_0x13ccd2[_0x1c93('0x31')]=_[_0x1c93('0x30')](_0x3bcbee['query']);_0x13ccd2[_0x1c93('0x32')]=_[_0x1c93('0x33')](_0x13ccd2[_0x1c93('0x2f')],_0x13ccd2[_0x1c93('0x31')]);_0x50e242['attributes']=_['intersection'](_0x13ccd2[_0x1c93('0x2f')],qs[_0x1c93('0x34')](_0x3bcbee['query'][_0x1c93('0x34')]));_0x50e242[_0x1c93('0x35')]=_0x50e242[_0x1c93('0x35')][_0x1c93('0x36')]?_0x50e242[_0x1c93('0x35')]:_0x13ccd2[_0x1c93('0x2f')];if(!_0x3bcbee[_0x1c93('0x31')][_0x1c93('0x45')](_0x1c93('0x46'))){_0x50e242[_0x1c93('0x17')]=qs[_0x1c93('0x17')](_0x3bcbee['query'][_0x1c93('0x17')]);_0x50e242[_0x1c93('0x15')]=qs[_0x1c93('0x15')](_0x3bcbee[_0x1c93('0x31')][_0x1c93('0x15')]);}_0x50e242['order']=qs[_0x1c93('0x47')](_0x3bcbee[_0x1c93('0x31')][_0x1c93('0x47')]);_0x50e242[_0x1c93('0x48')]=qs['filters'](_[_0x1c93('0x49')](_0x3bcbee[_0x1c93('0x31')],_0x13ccd2[_0x1c93('0x32')]));_0x50e242[_0x1c93('0x48')]['WhatsappInteractionId']=_0x3c99af['id'];if(_0x3bcbee[_0x1c93('0x31')][_0x1c93('0x4a')]){_0x50e242[_0x1c93('0x48')]=_[_0x1c93('0x4b')](_0x50e242['where'],{'$or':_[_0x1c93('0x24')](_0x50e242[_0x1c93('0x35')],function(_0x3e515f){var _0x349cab={};_0x349cab[_0x3e515f]={'$like':'%'+_0x3bcbee[_0x1c93('0x31')][_0x1c93('0x4a')]+'%'};return _0x349cab;})});}if(_0x3bcbee[_0x1c93('0x31')][_0x1c93('0x4c')]){var _0x4571d2=_0x3bcbee[_0x1c93('0x31')][_0x1c93('0x4c')][_0x1c93('0x4d')](',');var _0x49a926={};_0x49a926[_0x4571d2[0x0]]={'$gte':moment(_0x4571d2[0x1])['format'](_0x1c93('0x4e'))};_0x50e242[_0x1c93('0x48')]=_[_0x1c93('0x4b')](_0x50e242[_0x1c93('0x48')],_0x49a926);}_0x50e242=_['merge']({},_0x50e242,_0x3bcbee[_0x1c93('0x39')]);return db['WhatsappMessage']['count']({'where':_0x50e242[_0x1c93('0x48')]})[_0x1c93('0x1d')](function(_0x337014){_0x3e772c[_0x1c93('0x18')]=_0x337014;if(_0x3bcbee['query'][_0x1c93('0x37')]){_0x50e242[_0x1c93('0x38')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x1c93('0x4f')](_0x50e242);})['then'](function(_0x3979d8){_0x3e772c['rows']=_0x3979d8;return _0x3e772c;});}})[_0x1c93('0x1d')](respondWithFilteredResult(_0x356df4,_0x50e242))[_0x1c93('0x2d')](handleError(_0x356df4,null));};exports[_0x1c93('0x50')]=function(_0x4023e6,_0x847e70){return db[_0x1c93('0x25')][_0x1c93('0x3a')]({'where':{'id':_0x4023e6[_0x1c93('0x3d')]['id']}})[_0x1c93('0x1d')](handleEntityNotFound(_0x847e70,null))[_0x1c93('0x1d')](function(_0x5e45cd){if(_0x5e45cd){return _0x5e45cd[_0x1c93('0x51')](_0x4023e6[_0x1c93('0x3c')][_0x1c93('0x41')],_[_0x1c93('0x42')](_0x4023e6[_0x1c93('0x3c')],[_0x1c93('0x41'),'id'])||{})[_0x1c93('0x52')](function(){return db[_0x1c93('0x53')][_0x1c93('0x4f')]({'attributes':['id',_0x1c93('0x22'),_0x1c93('0x54')],'where':{'id':_0x4023e6['body'][_0x1c93('0x41')]}});})[_0x1c93('0x1d')](function(_0x4cdb59){socket[_0x1c93('0x55')](_0x1c93('0x56'),{'id':Number(_0x4023e6[_0x1c93('0x3d')]['id']),'tags':_0x4cdb59||[]});return{'id':Number(_0x4023e6[_0x1c93('0x3d')]['id']),'tags':_0x4cdb59||[]};});}})[_0x1c93('0x1d')](respondWithResult(_0x847e70,null))[_0x1c93('0x2d')](handleError(_0x847e70,null));};exports[_0x1c93('0x57')]=function(_0x504f1a,_0x13625b){return db['WhatsappInteraction'][_0x1c93('0x3a')]({'where':{'id':_0x504f1a['params']['id']}})[_0x1c93('0x1d')](handleEntityNotFound(_0x13625b,null))[_0x1c93('0x1d')](function(_0x189686){if(_0x189686){return _0x189686['removeTags'](_0x504f1a[_0x1c93('0x31')][_0x1c93('0x41')]);}})[_0x1c93('0x1d')](respondWithStatusCode(_0x13625b,null))[_0x1c93('0x2d')](handleError(_0x13625b,null));};exports[_0x1c93('0x58')]=function(_0x339310,_0x5a0138){var _0x2ffd84=moment()[_0x1c93('0x59')]()[_0x1c93('0x5a')]();var _0x14cdcd=path[_0x1c93('0x5b')](config[_0x1c93('0x5c')],_0x1c93('0x5d'),_0x1c93('0x5e'),'tmp');var _0x36c393=path[_0x1c93('0x5b')](config[_0x1c93('0x5c')],'server',_0x1c93('0x5e'),'attachments');var _0x3cabc6=path[_0x1c93('0x5b')](_0x14cdcd,_0x2ffd84);var _0x146bcd=util[_0x1c93('0x5f')](_0x1c93('0x60'),_0x339310[_0x1c93('0x3d')]['id'],_0x2ffd84);var _0x72f8e5=path['join'](_0x14cdcd,_0x146bcd);var _0x3da45b=[];_0x3da45b[_0x1c93('0x61')]({'model':db[_0x1c93('0x62')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x3da45b[_0x1c93('0x61')]({'model':db[_0x1c93('0x63')],'as':_0x1c93('0x64'),'attributes':['id',_0x1c93('0x65'),_0x1c93('0x66')],'raw':!![]});if(_0x339310['query'][_0x1c93('0x67')]){_0x3da45b[_0x1c93('0x61')]({'model':db['Attachment'],'as':_0x1c93('0x68'),'raw':!![]});}var _0x1c67bb=[{'model':db[_0x1c93('0x40')],'as':_0x1c93('0x69'),'attributes':['id',_0x1c93('0x3c'),_0x1c93('0x6a'),'direction','secret','read'],'include':_0x3da45b}];_0x1c67bb[_0x1c93('0x61')]({'model':db[_0x1c93('0x6b')],'as':_0x1c93('0x6c'),'attributes':['id','name']});_0x1c67bb[_0x1c93('0x61')]({'model':db['User'],'as':_0x1c93('0x6d'),'attributes':['id',_0x1c93('0x6e')]});return db[_0x1c93('0x25')][_0x1c93('0x3a')]({'where':{'id':_0x339310[_0x1c93('0x3d')]['id']},'include':_0x1c67bb})['then'](handleEntityNotFound(_0x5a0138,null))[_0x1c93('0x1d')](function(_0x19a883){if(_0x19a883){var _0x244bca=_0x19a883[_0x1c93('0x6f')]({'plain':!![]});fs['mkdirSync'](_0x3cabc6);var _0x50d912={'channel':_0x1c93('0x70'),'account':_0x244bca[_0x1c93('0x6c')][_0x1c93('0x22')],'agent':_0x244bca['Owner']?_0x244bca[_0x1c93('0x6d')][_0x1c93('0x6e')]:_0x1c93('0x71'),'createdAt':moment(_0x244bca['createdAt'])[_0x1c93('0x5f')](_0x1c93('0x4e'))[_0x1c93('0x5a')](),'closedAt':_0x244bca[_0x1c93('0x72')]?moment(_0x244bca[_0x1c93('0x73')])[_0x1c93('0x5f')](_0x1c93('0x4e'))[_0x1c93('0x5a')]():'','disposition':_0x244bca[_0x1c93('0x74')],'messages':_(_0x244bca['Messages'])[_0x1c93('0x4a')]({'secret':![]})[_0x1c93('0x24')](function(_0x56304b){if(_0x56304b[_0x1c93('0x68')]){var _0x496431=path[_0x1c93('0x5b')](_0x36c393,_0x56304b[_0x1c93('0x68')][_0x1c93('0x75')]);if(fs[_0x1c93('0x76')](_0x496431)){fs[_0x1c93('0x77')](_0x496431)[_0x1c93('0x78')](fs[_0x1c93('0x79')](path[_0x1c93('0x5b')](_0x3cabc6,_0x56304b[_0x1c93('0x68')]['basename'])));}}return{'date':moment(_0x56304b[_0x1c93('0x6a')])[_0x1c93('0x5f')](_0x1c93('0x4e'))[_0x1c93('0x5a')](),'sender':_0x56304b['direction']===_0x1c93('0x7a')?_0x56304b[_0x1c93('0x62')]?_0x56304b[_0x1c93('0x62')][_0x1c93('0x6e')]:_0x1c93('0x7b'):_0x56304b[_0x1c93('0x64')]['firstName']+(_0x56304b[_0x1c93('0x64')][_0x1c93('0x66')]?'\x20'+_0x56304b['Contact'][_0x1c93('0x66')]:''),'body':_0x56304b[_0x1c93('0x68')]?_0x56304b[_0x1c93('0x68')][_0x1c93('0x75')]:_0x56304b['body'],'direction':_0x56304b[_0x1c93('0x7c')]===_0x1c93('0x7a')?'A':'C','secret':_0x56304b[_0x1c93('0x7d')],'read':_0x56304b[_0x1c93('0x7e')],'attachment':_0x56304b[_0x1c93('0x68')]};})[_0x1c93('0x7f')]()};return ejs[_0x1c93('0x80')](path[_0x1c93('0x5b')](config[_0x1c93('0x5c')],_0x1c93('0x5d'),_0x1c93('0x81'),_0x1c93('0x82')),{'interaction':_0x50d912})[_0x1c93('0x1d')](function(_0x1016e6){var _0x2b6f53=path[_0x1c93('0x5b')](_0x3cabc6,_0x1c93('0x83')+_0x244bca['id']+'-'+_0x2ffd84+'.pdf');var _0x3de0c5={'path':_0x2b6f53,'channel':_0x1c93('0x70'),'interactionId':_0x244bca['id']};return pdf['createPdfFromHTML'](_0x1016e6,_0x3de0c5);})[_0x1c93('0x1d')](function(){return new BPromise(function(_0x3673c4,_0xc94616){zipdir(_0x3cabc6,{'saveTo':_0x72f8e5},function(_0x415be6,_0x57f32b){if(_0x415be6)return _0xc94616(_0x415be6);return _0x3673c4(_0x57f32b);});})['then'](function(){return new BPromise(function(_0x17cf52,_0x59de04){rimraf(_0x3cabc6,function(_0xf64440){if(_0xf64440)_0x59de04(_0xf64440);return _0x17cf52();});});})['then'](function(){return _0x5a0138['download'](_0x72f8e5,_0x146bcd,function(_0x5e7d9b){if(_0x5e7d9b){console['log'](_0x1c93('0x84'),_0x5e7d9b);}else{fs[_0x1c93('0x85')](_0x72f8e5);}});});});}else{return _0x5a0138[_0x1c93('0x1f')](0xc8);}})[_0x1c93('0x2d')](handleError(_0x5a0138,null));}; \ No newline at end of file +var _0xb7a0=['../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','undefined','limit','offset','status','set','Content-Range','json','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','getOptions','whatsapp','query','catch','show','params','model','WhatsappInteraction','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','WhatsappMessage','addMessage','getMessages','hasOwnProperty','nolimit','sort','where','pick','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','count','rows','setTags','ids','omit','spread','Tag','findAll','color','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','createdAt','direction','read','WhatsappAccount','Owner','get','mkdirSync','Whatsapp','N.A.','toString','closed','closedAt','disposition','existsSync','createReadStream','pipe','basename','out','System','secret','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','unlinkSync','zip-dir','moment','bluebird','util','path','ejs','lodash','../../components/interaction/service','../../components/export/pdf','../../config/logger'];(function(_0x1ca30d,_0x4591cf){var _0x363c58=function(_0x2184e7){while(--_0x2184e7){_0x1ca30d['push'](_0x1ca30d['shift']());}};_0x363c58(++_0x4591cf);}(_0xb7a0,0xfa));var _0x0b7a=function(_0x3162f7,_0x55e9b4){_0x3162f7=_0x3162f7-0x0;var _0x1098bb=_0xb7a0[_0x3162f7];return _0x1098bb;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x0b7a('0x0'));var moment=require(_0x0b7a('0x1'));var BPromise=require(_0x0b7a('0x2'));var util=require(_0x0b7a('0x3'));var path=require(_0x0b7a('0x4'));var ejs=require(_0x0b7a('0x5'));var fs=require('fs');var _=require(_0x0b7a('0x6'));var Redis=require('ioredis');var interaction=require(_0x0b7a('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x0b7a('0x8'));var logger=require(_0x0b7a('0x9'))('api');var config=require(_0x0b7a('0xa'));var db=require(_0x0b7a('0xb'))['db'];config[_0x0b7a('0xc')]=_['defaults'](config[_0x0b7a('0xc')],{'host':_0x0b7a('0xd'),'port':0x18eb});var socket=require(_0x0b7a('0xe'))(new Redis(config['redis']));require(_0x0b7a('0xf'))[_0x0b7a('0x10')](socket);function respondWithStatusCode(_0x388b6d,_0x99c7ef){_0x99c7ef=_0x99c7ef||0xcc;return function(_0x385949){if(_0x385949){return _0x388b6d[_0x0b7a('0x11')](_0x99c7ef);}return _0x388b6d['status'](_0x99c7ef)[_0x0b7a('0x12')]();};}function respondWithResult(_0x48fb98,_0x22aa2c){_0x22aa2c=_0x22aa2c||0xc8;return function(_0x42d483){if(_0x42d483){return _0x48fb98['status'](_0x22aa2c)['json'](_0x42d483);}};}function respondWithFilteredResult(_0x5d3d30,_0x3e5e59){return function(_0x79f0c){if(_0x79f0c){var _0x1ae858=typeof _0x3e5e59['offset']===_0x0b7a('0x13')&&typeof _0x3e5e59[_0x0b7a('0x14')]===_0x0b7a('0x13');var _0x462758=_0x79f0c['count'];var _0x2ea91c=_0x1ae858?0x0:_0x3e5e59['offset'];var _0x1bf5e9=_0x1ae858?_0x79f0c['count']:_0x3e5e59[_0x0b7a('0x15')]+_0x3e5e59['limit'];var _0x4b1f76;if(_0x1bf5e9>=_0x462758){_0x1bf5e9=_0x462758;_0x4b1f76=0xc8;}else{_0x4b1f76=0xce;}_0x5d3d30[_0x0b7a('0x16')](_0x4b1f76);return _0x5d3d30[_0x0b7a('0x17')](_0x0b7a('0x18'),_0x2ea91c+'-'+_0x1bf5e9+'/'+_0x462758)[_0x0b7a('0x19')](_0x79f0c);}return null;};}function saveUpdates(_0x4a2cd9){return function(_0x520a21){if(_0x520a21){return _0x520a21[_0x0b7a('0x1a')](_0x4a2cd9)[_0x0b7a('0x1b')](function(_0x5a00e8){return _0x5a00e8;});}return null;};}function removeEntity(_0xea0c9c){return function(_0x31e7c8){if(_0x31e7c8){return _0x31e7c8[_0x0b7a('0x1c')]()[_0x0b7a('0x1b')](function(){_0xea0c9c['status'](0xcc)[_0x0b7a('0x12')]();});}};}function handleEntityNotFound(_0x34b4ec){return function(_0x74665d){if(!_0x74665d){_0x34b4ec[_0x0b7a('0x11')](0x194);}return _0x74665d;};}function handleError(_0x4061a2,_0x4459f8){_0x4459f8=_0x4459f8||0x1f4;return function(_0x21b7ab){logger[_0x0b7a('0x1d')](_0x21b7ab[_0x0b7a('0x1e')]);if(_0x21b7ab[_0x0b7a('0x1f')]){delete _0x21b7ab[_0x0b7a('0x1f')];}_0x4061a2[_0x0b7a('0x16')](_0x4459f8)[_0x0b7a('0x20')](_0x21b7ab);};}exports['index']=function(_0x4c52ee,_0x1887cd){var _0x43ffcf={};var _0x2ba5d2=_[_0x0b7a('0x21')](db['WhatsappInteraction'][_0x0b7a('0x22')],function(_0x333288){return{'name':_0x333288['fieldName'],'type':_0x333288[_0x0b7a('0x23')][_0x0b7a('0x24')]};});_0x43ffcf=qs[_0x0b7a('0x25')](_0x2ba5d2,_0x4c52ee);return interaction['findAll'](_0x0b7a('0x26'),_0x4c52ee[_0x0b7a('0x27')],_0x4c52ee['user'],_0x43ffcf,_0x2ba5d2)[_0x0b7a('0x1b')](respondWithFilteredResult(_0x1887cd,_0x43ffcf))[_0x0b7a('0x28')](handleError(_0x1887cd,null));};exports[_0x0b7a('0x29')]=function(_0x23e043,_0x574041){var _0xbc081={'raw':![],'where':{'id':_0x23e043[_0x0b7a('0x2a')]['id']}},_0x1ae721={};_0x1ae721[_0x0b7a('0x2b')]=_['keys'](db[_0x0b7a('0x2c')]['rawAttributes']);_0x1ae721[_0x0b7a('0x27')]=_[_0x0b7a('0x2d')](_0x23e043['query']);_0x1ae721[_0x0b7a('0x2e')]=_[_0x0b7a('0x2f')](_0x1ae721[_0x0b7a('0x2b')],_0x1ae721['query']);_0xbc081[_0x0b7a('0x30')]=_['intersection'](_0x1ae721['model'],qs['fields'](_0x23e043[_0x0b7a('0x27')][_0x0b7a('0x31')]));_0xbc081[_0x0b7a('0x30')]=_0xbc081[_0x0b7a('0x30')][_0x0b7a('0x32')]?_0xbc081[_0x0b7a('0x30')]:_0x1ae721[_0x0b7a('0x2b')];if(_0x23e043[_0x0b7a('0x27')][_0x0b7a('0x33')]){_0xbc081[_0x0b7a('0x34')]=[{'all':!![]}];}_0xbc081=_[_0x0b7a('0x35')]({},_0xbc081,_0x23e043[_0x0b7a('0x36')]);return db['WhatsappInteraction'][_0x0b7a('0x37')](_0xbc081)['then'](handleEntityNotFound(_0x574041,null))['then'](respondWithResult(_0x574041,null))[_0x0b7a('0x28')](handleError(_0x574041,null));};exports[_0x0b7a('0x38')]=function(_0x4ed77a,_0x12bd1f){return db[_0x0b7a('0x2c')][_0x0b7a('0x38')](_0x4ed77a['body'],{})[_0x0b7a('0x1b')](respondWithResult(_0x12bd1f,0xc9))[_0x0b7a('0x28')](handleError(_0x12bd1f,null));};exports[_0x0b7a('0x1a')]=function(_0x496cf6,_0x24f4e6){if(_0x496cf6[_0x0b7a('0x39')]['id']){delete _0x496cf6['body']['id'];}return db[_0x0b7a('0x2c')]['find']({'where':{'id':_0x496cf6[_0x0b7a('0x2a')]['id']}})[_0x0b7a('0x1b')](handleEntityNotFound(_0x24f4e6,null))[_0x0b7a('0x1b')](saveUpdates(_0x496cf6['body'],null))[_0x0b7a('0x1b')](respondWithResult(_0x24f4e6,null))[_0x0b7a('0x28')](handleError(_0x24f4e6,null));};exports[_0x0b7a('0x1c')]=function(_0x310dcb,_0xe966a7){return db['WhatsappInteraction']['find']({'where':{'id':_0x310dcb[_0x0b7a('0x2a')]['id']}})[_0x0b7a('0x1b')](handleEntityNotFound(_0xe966a7,null))[_0x0b7a('0x1b')](removeEntity(_0xe966a7,null))[_0x0b7a('0x28')](handleError(_0xe966a7,null));};exports[_0x0b7a('0x3a')]=function(_0x162aa5,_0x14ebcf){return db[_0x0b7a('0x2c')][_0x0b7a('0x3a')]()[_0x0b7a('0x1b')](respondWithResult(_0x14ebcf,null))['catch'](handleError(_0x14ebcf,null));};exports['addMessage']=function(_0x17ec0a,_0x26fe7c){return db[_0x0b7a('0x3b')]['find']({'where':{'id':_0x17ec0a[_0x0b7a('0x2a')]['id']}})[_0x0b7a('0x1b')](handleEntityNotFound(_0x26fe7c,null))[_0x0b7a('0x1b')](function(_0x412b38){if(_0x412b38){return _0x412b38[_0x0b7a('0x3c')](_0x17ec0a[_0x0b7a('0x39')]['ids'],_['omit'](_0x17ec0a[_0x0b7a('0x39')],['ids','id'])||{});}})['then'](respondWithResult(_0x26fe7c,null))['catch'](handleError(_0x26fe7c,null));};exports[_0x0b7a('0x3d')]=function(_0x41cd0d,_0x11a2ba){var _0x19bca5={'raw':![],'where':{}};var _0x1123df={};var _0x4ced91={'count':0x0,'rows':[]};return db[_0x0b7a('0x2c')]['findOne']({'where':{'id':_0x41cd0d[_0x0b7a('0x2a')]['id']}})[_0x0b7a('0x1b')](handleEntityNotFound(_0x11a2ba,null))[_0x0b7a('0x1b')](function(_0x1b0605){if(_0x1b0605){_0x1123df[_0x0b7a('0x2b')]=_[_0x0b7a('0x2d')](db[_0x0b7a('0x3b')]['rawAttributes']);_0x1123df['query']=_[_0x0b7a('0x2d')](_0x41cd0d['query']);_0x1123df[_0x0b7a('0x2e')]=_[_0x0b7a('0x2f')](_0x1123df[_0x0b7a('0x2b')],_0x1123df[_0x0b7a('0x27')]);_0x19bca5[_0x0b7a('0x30')]=_[_0x0b7a('0x2f')](_0x1123df[_0x0b7a('0x2b')],qs['fields'](_0x41cd0d['query'][_0x0b7a('0x31')]));_0x19bca5[_0x0b7a('0x30')]=_0x19bca5[_0x0b7a('0x30')]['length']?_0x19bca5['attributes']:_0x1123df[_0x0b7a('0x2b')];if(!_0x41cd0d[_0x0b7a('0x27')][_0x0b7a('0x3e')](_0x0b7a('0x3f'))){_0x19bca5['limit']=qs['limit'](_0x41cd0d[_0x0b7a('0x27')][_0x0b7a('0x14')]);_0x19bca5['offset']=qs[_0x0b7a('0x15')](_0x41cd0d[_0x0b7a('0x27')]['offset']);}_0x19bca5['order']=qs[_0x0b7a('0x40')](_0x41cd0d[_0x0b7a('0x27')][_0x0b7a('0x40')]);_0x19bca5[_0x0b7a('0x41')]=qs[_0x0b7a('0x2e')](_[_0x0b7a('0x42')](_0x41cd0d['query'],_0x1123df[_0x0b7a('0x2e')]));_0x19bca5[_0x0b7a('0x41')][_0x0b7a('0x43')]=_0x1b0605['id'];if(_0x41cd0d[_0x0b7a('0x27')]['filter']){_0x19bca5[_0x0b7a('0x41')]=_['merge'](_0x19bca5[_0x0b7a('0x41')],{'$or':_[_0x0b7a('0x21')](_0x19bca5[_0x0b7a('0x30')],function(_0x4c52a0){var _0x34b735={};_0x34b735[_0x4c52a0]={'$like':'%'+_0x41cd0d[_0x0b7a('0x27')][_0x0b7a('0x44')]+'%'};return _0x34b735;})});}if(_0x41cd0d['query'][_0x0b7a('0x45')]){var _0x145166=_0x41cd0d[_0x0b7a('0x27')][_0x0b7a('0x45')][_0x0b7a('0x46')](',');var _0x1da6bd={};_0x1da6bd[_0x145166[0x0]]={'$gte':moment(_0x145166[0x1])[_0x0b7a('0x47')](_0x0b7a('0x48'))};_0x19bca5['where']=_['merge'](_0x19bca5['where'],_0x1da6bd);}_0x19bca5=_[_0x0b7a('0x35')]({},_0x19bca5,_0x41cd0d[_0x0b7a('0x36')]);return db[_0x0b7a('0x3b')][_0x0b7a('0x49')]({'where':_0x19bca5[_0x0b7a('0x41')]})[_0x0b7a('0x1b')](function(_0x38cbf3){_0x4ced91['count']=_0x38cbf3;if(_0x41cd0d[_0x0b7a('0x27')][_0x0b7a('0x33')]){_0x19bca5[_0x0b7a('0x34')]=[{'all':!![]}];}return db[_0x0b7a('0x3b')]['findAll'](_0x19bca5);})[_0x0b7a('0x1b')](function(_0x14e919){_0x4ced91[_0x0b7a('0x4a')]=_0x14e919;return _0x4ced91;});}})[_0x0b7a('0x1b')](respondWithFilteredResult(_0x11a2ba,_0x19bca5))[_0x0b7a('0x28')](handleError(_0x11a2ba,null));};exports['addTags']=function(_0x33103d,_0x4050bd){return db[_0x0b7a('0x2c')][_0x0b7a('0x37')]({'where':{'id':_0x33103d[_0x0b7a('0x2a')]['id']}})[_0x0b7a('0x1b')](handleEntityNotFound(_0x4050bd,null))[_0x0b7a('0x1b')](function(_0x373460){if(_0x373460){return _0x373460[_0x0b7a('0x4b')](_0x33103d['body'][_0x0b7a('0x4c')],_[_0x0b7a('0x4d')](_0x33103d['body'],['ids','id'])||{})[_0x0b7a('0x4e')](function(){return db[_0x0b7a('0x4f')][_0x0b7a('0x50')]({'attributes':['id',_0x0b7a('0x1f'),_0x0b7a('0x51')],'where':{'id':_0x33103d[_0x0b7a('0x39')][_0x0b7a('0x4c')]}});})[_0x0b7a('0x1b')](function(_0x45ee4e){socket[_0x0b7a('0x52')](_0x0b7a('0x53'),{'id':Number(_0x33103d[_0x0b7a('0x2a')]['id']),'tags':_0x45ee4e||[]});return{'id':Number(_0x33103d[_0x0b7a('0x2a')]['id']),'tags':_0x45ee4e||[]};});}})[_0x0b7a('0x1b')](respondWithResult(_0x4050bd,null))[_0x0b7a('0x28')](handleError(_0x4050bd,null));};exports[_0x0b7a('0x54')]=function(_0x115553,_0x36bacb){return db[_0x0b7a('0x2c')]['find']({'where':{'id':_0x115553[_0x0b7a('0x2a')]['id']}})[_0x0b7a('0x1b')](handleEntityNotFound(_0x36bacb,null))[_0x0b7a('0x1b')](function(_0x14c76d){if(_0x14c76d){return _0x14c76d[_0x0b7a('0x54')](_0x115553['query'][_0x0b7a('0x4c')]);}})[_0x0b7a('0x1b')](respondWithStatusCode(_0x36bacb,null))[_0x0b7a('0x28')](handleError(_0x36bacb,null));};exports[_0x0b7a('0x55')]=function(_0x2ba8f0,_0x278e06){var _0x9d5859=moment()[_0x0b7a('0x56')]()['toString']();var _0x3900e2=path[_0x0b7a('0x57')](config[_0x0b7a('0x58')],_0x0b7a('0x59'),_0x0b7a('0x5a'),_0x0b7a('0x5b'));var _0x1222ee=path[_0x0b7a('0x57')](config[_0x0b7a('0x58')],_0x0b7a('0x59'),_0x0b7a('0x5a'),_0x0b7a('0x5c'));var _0x553bf7=path[_0x0b7a('0x57')](_0x3900e2,_0x9d5859);var _0x38a8eb=util['format'](_0x0b7a('0x5d'),_0x2ba8f0[_0x0b7a('0x2a')]['id'],_0x9d5859);var _0x4c030d=path[_0x0b7a('0x57')](_0x3900e2,_0x38a8eb);var _0x3d1605=[];_0x3d1605[_0x0b7a('0x5e')]({'model':db['User'],'as':_0x0b7a('0x5f'),'attributes':['id',_0x0b7a('0x60')],'raw':!![]});_0x3d1605[_0x0b7a('0x5e')]({'model':db[_0x0b7a('0x61')],'as':_0x0b7a('0x62'),'attributes':['id',_0x0b7a('0x63'),_0x0b7a('0x64')],'raw':!![]});if(_0x2ba8f0[_0x0b7a('0x27')][_0x0b7a('0x5c')]){_0x3d1605[_0x0b7a('0x5e')]({'model':db[_0x0b7a('0x65')],'as':_0x0b7a('0x65'),'raw':!![]});}var _0x333c6b=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x0b7a('0x39'),_0x0b7a('0x66'),_0x0b7a('0x67'),'secret',_0x0b7a('0x68')],'include':_0x3d1605}];_0x333c6b[_0x0b7a('0x5e')]({'model':db[_0x0b7a('0x69')],'as':'Account','attributes':['id',_0x0b7a('0x1f')]});_0x333c6b[_0x0b7a('0x5e')]({'model':db['User'],'as':_0x0b7a('0x6a'),'attributes':['id','fullname']});return db[_0x0b7a('0x2c')][_0x0b7a('0x37')]({'where':{'id':_0x2ba8f0[_0x0b7a('0x2a')]['id']},'include':_0x333c6b})['then'](handleEntityNotFound(_0x278e06,null))[_0x0b7a('0x1b')](function(_0x29a237){if(_0x29a237){var _0x1f1dab=_0x29a237[_0x0b7a('0x6b')]({'plain':!![]});fs[_0x0b7a('0x6c')](_0x553bf7);var _0x4bb4ce={'channel':_0x0b7a('0x6d'),'account':_0x1f1dab['Account'][_0x0b7a('0x1f')],'agent':_0x1f1dab[_0x0b7a('0x6a')]?_0x1f1dab[_0x0b7a('0x6a')][_0x0b7a('0x60')]:_0x0b7a('0x6e'),'createdAt':moment(_0x1f1dab[_0x0b7a('0x66')])[_0x0b7a('0x47')](_0x0b7a('0x48'))[_0x0b7a('0x6f')](),'closedAt':_0x1f1dab[_0x0b7a('0x70')]?moment(_0x1f1dab[_0x0b7a('0x71')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x0b7a('0x6f')]():'','disposition':_0x1f1dab[_0x0b7a('0x72')],'messages':_(_0x1f1dab['Messages'])[_0x0b7a('0x44')]({'secret':![]})[_0x0b7a('0x21')](function(_0x72a8f9){if(_0x72a8f9[_0x0b7a('0x65')]){var _0x238361=path[_0x0b7a('0x57')](_0x1222ee,_0x72a8f9[_0x0b7a('0x65')]['basename']);if(fs[_0x0b7a('0x73')](_0x238361)){fs[_0x0b7a('0x74')](_0x238361)[_0x0b7a('0x75')](fs['createWriteStream'](path['join'](_0x553bf7,_0x72a8f9[_0x0b7a('0x65')][_0x0b7a('0x76')])));}}return{'date':moment(_0x72a8f9[_0x0b7a('0x66')])[_0x0b7a('0x47')](_0x0b7a('0x48'))[_0x0b7a('0x6f')](),'sender':_0x72a8f9['direction']===_0x0b7a('0x77')?_0x72a8f9['User']?_0x72a8f9[_0x0b7a('0x5f')][_0x0b7a('0x60')]:_0x0b7a('0x78'):_0x72a8f9[_0x0b7a('0x62')][_0x0b7a('0x63')]+(_0x72a8f9[_0x0b7a('0x62')][_0x0b7a('0x64')]?'\x20'+_0x72a8f9['Contact']['lastName']:''),'body':_0x72a8f9[_0x0b7a('0x65')]?_0x72a8f9[_0x0b7a('0x65')][_0x0b7a('0x76')]:_0x72a8f9[_0x0b7a('0x39')],'direction':_0x72a8f9[_0x0b7a('0x67')]===_0x0b7a('0x77')?'A':'C','secret':_0x72a8f9[_0x0b7a('0x79')],'read':_0x72a8f9[_0x0b7a('0x68')],'attachment':_0x72a8f9[_0x0b7a('0x65')]};})['value']()};return ejs[_0x0b7a('0x7a')](path[_0x0b7a('0x57')](config['root'],_0x0b7a('0x59'),_0x0b7a('0x7b'),_0x0b7a('0x7c')),{'interaction':_0x4bb4ce})['then'](function(_0x2db810){var _0x15f6d5=path['join'](_0x553bf7,'transcript-'+_0x1f1dab['id']+'-'+_0x9d5859+_0x0b7a('0x7d'));var _0x215cba={'path':_0x15f6d5,'channel':_0x0b7a('0x6d'),'interactionId':_0x1f1dab['id']};return pdf[_0x0b7a('0x7e')](_0x2db810,_0x215cba);})[_0x0b7a('0x1b')](function(){return new BPromise(function(_0x532a5e,_0x4088fe){zipdir(_0x553bf7,{'saveTo':_0x4c030d},function(_0x245c9d,_0x556568){if(_0x245c9d)return _0x4088fe(_0x245c9d);return _0x532a5e(_0x556568);});})[_0x0b7a('0x1b')](function(){return new BPromise(function(_0x5b65a8,_0x5f3f05){rimraf(_0x553bf7,function(_0x23b7d8){if(_0x23b7d8)_0x5f3f05(_0x23b7d8);return _0x5b65a8();});});})[_0x0b7a('0x1b')](function(){return _0x278e06[_0x0b7a('0x55')](_0x4c030d,_0x38a8eb,function(_0x4b932c){if(_0x4b932c){console[_0x0b7a('0x7f')](_0x0b7a('0x80'),_0x4b932c);}else{fs[_0x0b7a('0x81')](_0x4c030d);}});});});}else{return _0x278e06[_0x0b7a('0x11')](0xc8);}})[_0x0b7a('0x28')](handleError(_0x278e06,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 87d476b..4b0d96d 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 _0x2746=['emit','catch','hasOwnProperty','hook','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x1b4917,_0x52fedc){var _0x3cd84d=function(_0x5ab700){while(--_0x5ab700){_0x1b4917['push'](_0x1b4917['shift']());}};_0x3cd84d(++_0x52fedc);}(_0x2746,0x19c));var _0x6274=function(_0x27d2fe,_0xa3b873){_0x27d2fe=_0x27d2fe-0x0;var _0x309311=_0x2746[_0x27d2fe];return _0x309311;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db'][_0x6274('0x0')];var WhatsappMessage=require(_0x6274('0x1'))['db'][_0x6274('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x6274('0x3')](0x0);var events={'afterCreate':_0x6274('0x4'),'afterUpdate':_0x6274('0x5'),'afterDestroy':'remove'};function emitEvent(_0x52b270){return function(_0x4492d3,_0x232d4d,_0x1978ff){_0x4492d3['getUsers']({'attributes':['id'],'raw':!![]})[_0x6274('0x6')](function(_0x937a27){_0x4492d3[_0x6274('0x7')](_0x6274('0x8'),_0x937a27[_0x6274('0x9')](function(_0x5c2869){return{'id':_0x5c2869['id']};}));return WhatsappMessage[_0x6274('0xa')]({'where':{'WhatsappInteractionId':_0x4492d3['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x218189){_0x4492d3[_0x6274('0x7')](_0x6274('0xb'),_0x218189[_0x6274('0xc')]);WhatsappInteractionEvents[_0x6274('0xd')](_0x52b270+':'+_0x4492d3['id'],_0x4492d3);WhatsappInteractionEvents[_0x6274('0xd')](_0x52b270,_0x4492d3);_0x1978ff(null);})[_0x6274('0xe')](_0x1978ff(null));};}for(var e in events){if(events[_0x6274('0xf')](e)){var event=events[e];WhatsappInteraction[_0x6274('0x10')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xc961=['events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x1ce743,_0x15c90c){var _0x5a4b42=function(_0x1bfee6){while(--_0x1bfee6){_0x1ce743['push'](_0x1ce743['shift']());}};_0x5a4b42(++_0x15c90c);}(_0xc961,0x17a));var _0x1c96=function(_0x33e114,_0x77cc5a){_0x33e114=_0x33e114-0x0;var _0x17e9b6=_0xc961[_0x33e114];return _0x17e9b6;};'use strict';var EventEmitter=require(_0x1c96('0x0'));var WhatsappInteraction=require(_0x1c96('0x1'))['db'][_0x1c96('0x2')];var WhatsappMessage=require(_0x1c96('0x1'))['db'][_0x1c96('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x1c96('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x30d2e0){return function(_0x494d92,_0x180969,_0x5594ee){_0x494d92[_0x1c96('0x5')]({'attributes':['id'],'raw':!![]})[_0x1c96('0x6')](function(_0x1f09ff){_0x494d92[_0x1c96('0x7')](_0x1c96('0x8'),_0x1f09ff[_0x1c96('0x9')](function(_0x5523de){return{'id':_0x5523de['id']};}));return WhatsappMessage[_0x1c96('0xa')]({'where':{'WhatsappInteractionId':_0x494d92['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1c96('0x6')](function(_0x691a95){_0x494d92[_0x1c96('0x7')](_0x1c96('0xb'),_0x691a95[_0x1c96('0xc')]);WhatsappInteractionEvents[_0x1c96('0xd')](_0x30d2e0+':'+_0x494d92['id'],_0x494d92);WhatsappInteractionEvents[_0x1c96('0xd')](_0x30d2e0,_0x494d92);_0x5594ee(null);})[_0x1c96('0xe')](_0x5594ee(null));};}for(var e in events){if(events[_0x1c96('0xf')](e)){var event=events[e];WhatsappInteraction[_0x1c96('0x10')](e,emitEvent(event));}}module[_0x1c96('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 9280d74..f82b442 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 _0x5de8=['exports','define','WhatsappInteraction','whatsapp_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes'];(function(_0x3d20a3,_0x416806){var _0x44feb5=function(_0x7054bc){while(--_0x7054bc){_0x3d20a3['push'](_0x3d20a3['shift']());}};_0x44feb5(++_0x416806);}(_0x5de8,0xf7));var _0x85de=function(_0x1fd0ec,_0x2aa54b){_0x1fd0ec=_0x1fd0ec-0x0;var _0xe3164a=_0x5de8[_0x1fd0ec];return _0xe3164a;};'use strict';var _=require('lodash');var util=require(_0x85de('0x0'));var logger=require(_0x85de('0x1'))('api');var moment=require(_0x85de('0x2'));var BPromise=require(_0x85de('0x3'));var rp=require(_0x85de('0x4'));var fs=require('fs');var path=require(_0x85de('0x5'));var rimraf=require(_0x85de('0x6'));var config=require(_0x85de('0x7'));var attributes=require(_0x85de('0x8'));module[_0x85de('0x9')]=function(_0x15fe46,_0x53c356){return _0x15fe46[_0x85de('0xa')](_0x85de('0xb'),attributes,{'tableName':_0x85de('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1c55ca,_0x4b40c2,_0x44c021){if(_0x1c55ca['changed']('closed')){_0x1c55ca[_0x85de('0xd')]=moment()[_0x85de('0xe')](_0x85de('0xf'));}_0x44c021(null,_0x1c55ca);}}});}; \ No newline at end of file +var _0x6113=['request-promise','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x57014b,_0x360c0f){var _0x2b258a=function(_0x52c4a3){while(--_0x52c4a3){_0x57014b['push'](_0x57014b['shift']());}};_0x2b258a(++_0x360c0f);}(_0x6113,0x13e));var _0x3611=function(_0x2df74c,_0x42b9cb){_0x2df74c=_0x2df74c-0x0;var _0x219cc6=_0x6113[_0x2df74c];return _0x219cc6;};'use strict';var _=require(_0x3611('0x0'));var util=require(_0x3611('0x1'));var logger=require(_0x3611('0x2'))(_0x3611('0x3'));var moment=require(_0x3611('0x4'));var BPromise=require(_0x3611('0x5'));var rp=require(_0x3611('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3611('0x7'));var attributes=require(_0x3611('0x8'));module[_0x3611('0x9')]=function(_0x13037f,_0x218ee0){return _0x13037f[_0x3611('0xa')](_0x3611('0xb'),attributes,{'tableName':_0x3611('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x516659,_0x57b596,_0xc9347a){if(_0x516659[_0x3611('0xd')](_0x3611('0xe'))){_0x516659[_0x3611('0xf')]=moment()[_0x3611('0x10')](_0x3611('0x11'));}_0xc9347a(null,_0x516659);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 141cf64..130f685 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 _0xb98b=['rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','where','attributes','limit','stringify','AddTagsToWhatsappInteraction','find','body','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2b72a6,_0x16620d){var _0x26e7f3=function(_0x42d103){while(--_0x42d103){_0x2b72a6['push'](_0x2b72a6['shift']());}};_0x26e7f3(++_0x16620d);}(_0xb98b,0xd4));var _0xbb98=function(_0x3126bf,_0x146d75){_0x3126bf=_0x3126bf-0x0;var _0x106fab=_0xb98b[_0x3126bf];return _0x106fab;};'use strict';var _=require(_0xbb98('0x0'));var util=require(_0xbb98('0x1'));var moment=require(_0xbb98('0x2'));var BPromise=require('bluebird');var rs=require(_0xbb98('0x3'));var fs=require('fs');var Redis=require(_0xbb98('0x4'));var db=require(_0xbb98('0x5'))['db'];var utils=require(_0xbb98('0x6'));var logger=require(_0xbb98('0x7'))(_0xbb98('0x8'));var config=require(_0xbb98('0x9'));var jayson=require(_0xbb98('0xa'));var client=jayson[_0xbb98('0xb')]['http']({'port':0x232a});config[_0xbb98('0xc')]=_[_0xbb98('0xd')](config[_0xbb98('0xc')],{'host':_0xbb98('0xe'),'port':0x18eb});var socket=require(_0xbb98('0xf'))(new Redis(config[_0xbb98('0xc')]));require(_0xbb98('0x10'))[_0xbb98('0x11')](socket);function respondWithRpcPromise(_0x22029b,_0xc0a35c,_0x445244){return new BPromise(function(_0xbbcefc,_0x4809b2){return client['request'](_0x22029b,_0x445244)[_0xbb98('0x12')](function(_0x20917d){logger[_0xbb98('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0xc0a35c,_0xbb98('0x14'));logger[_0xbb98('0x15')](_0xbb98('0x16'),_0xc0a35c,_0xbb98('0x14'),JSON['stringify'](_0x20917d));if(_0x20917d[_0xbb98('0x17')]){if(_0x20917d[_0xbb98('0x17')][_0xbb98('0x18')]===0x1f4){logger['error'](_0xbb98('0x19'),_0xc0a35c,_0x20917d['error']['message']);return _0x4809b2(_0x20917d[_0xbb98('0x17')]['message']);}logger[_0xbb98('0x17')](_0xbb98('0x19'),_0xc0a35c,_0x20917d[_0xbb98('0x17')]['message']);return _0xbbcefc(_0x20917d[_0xbb98('0x17')][_0xbb98('0x1a')]);}else{logger['info'](_0xbb98('0x19'),_0xc0a35c,_0xbb98('0x14'));_0xbbcefc(_0x20917d[_0xbb98('0x1b')][_0xbb98('0x1a')]);}})[_0xbb98('0x1c')](function(_0x58c31e){logger[_0xbb98('0x17')](_0xbb98('0x19'),_0xc0a35c,_0x58c31e);_0x4809b2(_0x58c31e);});});}exports[_0xbb98('0x1d')]=function(_0x195470){var _0x5e1081=this;return new Promise(function(_0x4d6551,_0x4b8939){return db[_0xbb98('0x1e')][_0xbb98('0x1f')](_0x195470['body'],{'raw':_0x195470[_0xbb98('0x20')]?_0x195470['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x195470[_0xbb98('0x20')]?_0x195470[_0xbb98('0x20')][_0xbb98('0x21')]||null:null,'attributes':_0x195470[_0xbb98('0x20')]?_0x195470[_0xbb98('0x20')][_0xbb98('0x22')]||null:null,'limit':_0x195470['options']?_0x195470['options'][_0xbb98('0x23')]||null:null})[_0xbb98('0x12')](function(_0x332581){logger[_0xbb98('0x13')](_0xbb98('0x1d'),_0x195470);logger[_0xbb98('0x15')](_0xbb98('0x1d'),_0x195470,JSON[_0xbb98('0x24')](_0x332581));_0x4d6551(_0x332581);})[_0xbb98('0x1c')](function(_0x1d833b){logger[_0xbb98('0x17')](_0xbb98('0x1d'),_0x1d833b[_0xbb98('0x1a')],_0x195470);_0x4b8939(_0x5e1081[_0xbb98('0x17')](0x1f4,_0x1d833b[_0xbb98('0x1a')]));});});};exports[_0xbb98('0x25')]=function(_0xda643a){return new Promise(function(_0x365071,_0x4441c1){return db[_0xbb98('0x1e')][_0xbb98('0x26')]({'where':_0xda643a['options']?_0xda643a[_0xbb98('0x20')][_0xbb98('0x21')]||null:null})[_0xbb98('0x12')](function(_0x42cb31){if(_0x42cb31){return _0x42cb31['addTags'](_0xda643a[_0xbb98('0x27')][_0xbb98('0x28')],_[_0xbb98('0x29')](_0xda643a[_0xbb98('0x27')],[_0xbb98('0x28'),'id'])||{});}})[_0xbb98('0x2a')](function(_0xb02df3){logger[_0xbb98('0x13')](_0xbb98('0x2b'),_0xda643a);logger[_0xbb98('0x15')](_0xbb98('0x2b'),_0xda643a,JSON[_0xbb98('0x24')](_0xb02df3));_0x365071(_0xb02df3);})[_0xbb98('0x1c')](function(_0x26f1ec){logger[_0xbb98('0x17')](_0xbb98('0x2b'),_0x26f1ec[_0xbb98('0x1a')],_0xda643a);_0x4441c1(_this[_0xbb98('0x17')](0x1f4,_0x26f1ec['message']));});});}; \ No newline at end of file +var _0x9a6c=['catch','WhatsappInteraction','update','body','options','raw','where','attributes','limit','debug','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','addTags','omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result'];(function(_0x2d1158,_0xed7af0){var _0x5a2903=function(_0x1af70c){while(--_0x1af70c){_0x2d1158['push'](_0x2d1158['shift']());}};_0x5a2903(++_0xed7af0);}(_0x9a6c,0x6c));var _0xc9a6=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9a6c[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xc9a6('0x0'));var util=require('util');var moment=require(_0xc9a6('0x1'));var BPromise=require(_0xc9a6('0x2'));var rs=require(_0xc9a6('0x3'));var fs=require('fs');var Redis=require(_0xc9a6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9a6('0x5'));var logger=require(_0xc9a6('0x6'))(_0xc9a6('0x7'));var config=require(_0xc9a6('0x8'));var jayson=require(_0xc9a6('0x9'));var client=jayson[_0xc9a6('0xa')][_0xc9a6('0xb')]({'port':0x232a});config[_0xc9a6('0xc')]=_[_0xc9a6('0xd')](config[_0xc9a6('0xc')],{'host':_0xc9a6('0xe'),'port':0x18eb});var socket=require(_0xc9a6('0xf'))(new Redis(config[_0xc9a6('0xc')]));require(_0xc9a6('0x10'))[_0xc9a6('0x11')](socket);function respondWithRpcPromise(_0x5e7275,_0x2fe049,_0x1a167d){return new BPromise(function(_0x219a3f,_0x2c86b2){return client['request'](_0x5e7275,_0x1a167d)[_0xc9a6('0x12')](function(_0x484075){logger[_0xc9a6('0x13')](_0xc9a6('0x14'),_0x2fe049,'request\x20sent');logger['debug'](_0xc9a6('0x15'),_0x2fe049,'request\x20sent',JSON[_0xc9a6('0x16')](_0x484075));if(_0x484075[_0xc9a6('0x17')]){if(_0x484075[_0xc9a6('0x17')]['code']===0x1f4){logger[_0xc9a6('0x17')](_0xc9a6('0x14'),_0x2fe049,_0x484075[_0xc9a6('0x17')][_0xc9a6('0x18')]);return _0x2c86b2(_0x484075['error'][_0xc9a6('0x18')]);}logger[_0xc9a6('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x2fe049,_0x484075['error'][_0xc9a6('0x18')]);return _0x219a3f(_0x484075['error'][_0xc9a6('0x18')]);}else{logger[_0xc9a6('0x13')](_0xc9a6('0x14'),_0x2fe049,_0xc9a6('0x19'));_0x219a3f(_0x484075[_0xc9a6('0x1a')][_0xc9a6('0x18')]);}})[_0xc9a6('0x1b')](function(_0x42539c){logger[_0xc9a6('0x17')](_0xc9a6('0x14'),_0x2fe049,_0x42539c);_0x2c86b2(_0x42539c);});});}exports['UpdateWhatsappInteraction']=function(_0x2ffcbc){var _0x218233=this;return new Promise(function(_0x17fa31,_0x2910bd){return db[_0xc9a6('0x1c')][_0xc9a6('0x1d')](_0x2ffcbc[_0xc9a6('0x1e')],{'raw':_0x2ffcbc['options']?_0x2ffcbc[_0xc9a6('0x1f')][_0xc9a6('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ffcbc['options']?_0x2ffcbc['options'][_0xc9a6('0x21')]||null:null,'attributes':_0x2ffcbc['options']?_0x2ffcbc[_0xc9a6('0x1f')][_0xc9a6('0x22')]||null:null,'limit':_0x2ffcbc['options']?_0x2ffcbc['options'][_0xc9a6('0x23')]||null:null})[_0xc9a6('0x12')](function(_0x32f55b){logger[_0xc9a6('0x13')]('UpdateWhatsappInteraction',_0x2ffcbc);logger[_0xc9a6('0x24')](_0xc9a6('0x25'),_0x2ffcbc,JSON[_0xc9a6('0x16')](_0x32f55b));_0x17fa31(_0x32f55b);})[_0xc9a6('0x1b')](function(_0x2e0908){logger[_0xc9a6('0x17')](_0xc9a6('0x25'),_0x2e0908[_0xc9a6('0x18')],_0x2ffcbc);_0x2910bd(_0x218233[_0xc9a6('0x17')](0x1f4,_0x2e0908[_0xc9a6('0x18')]));});});};exports[_0xc9a6('0x26')]=function(_0x1b1626){return new Promise(function(_0x2a6e61,_0x4ff32d){return db['WhatsappInteraction'][_0xc9a6('0x27')]({'where':_0x1b1626[_0xc9a6('0x1f')]?_0x1b1626[_0xc9a6('0x1f')]['where']||null:null})['then'](function(_0x44f70a){if(_0x44f70a){return _0x44f70a[_0xc9a6('0x28')](_0x1b1626['body']['ids'],_[_0xc9a6('0x29')](_0x1b1626[_0xc9a6('0x1e')],[_0xc9a6('0x2a'),'id'])||{});}})[_0xc9a6('0x2b')](function(_0x4efba1){logger[_0xc9a6('0x13')](_0xc9a6('0x2c'),_0x1b1626);logger[_0xc9a6('0x24')]('AddTags',_0x1b1626,JSON[_0xc9a6('0x16')](_0x4efba1));_0x2a6e61(_0x4efba1);})[_0xc9a6('0x1b')](function(_0x342956){logger[_0xc9a6('0x17')](_0xc9a6('0x2c'),_0x342956[_0xc9a6('0x18')],_0x1b1626);_0x4ff32d(_this[_0xc9a6('0x17')](0x1f4,_0x342956[_0xc9a6('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 4818bb8..d206d73 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 _0x0a2d=['length','./whatsappInteraction.events','emit'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x0a2d,0x1a2));var _0xd0a2=function(_0x4f614c,_0x2cd3b8){_0x4f614c=_0x4f614c-0x0;var _0x5c7f6c=_0x0a2d[_0x4f614c];return _0x5c7f6c;};'use strict';var WhatsappInteractionEvents=require(_0xd0a2('0x0'));var events=['save','remove','update'];function createListener(_0x20115b,_0x530af7){return function(_0x5ec027){_0x530af7[_0xd0a2('0x1')](_0x20115b,_0x5ec027);};}function removeListener(_0x1e4c81,_0x3c3901){return function(){WhatsappInteractionEvents['removeListener'](_0x1e4c81,_0x3c3901);};}exports['register']=function(_0xd34114){for(var _0x14a804=0x0,_0x3a9f03=events[_0xd0a2('0x2')];_0x14a804<_0x3a9f03;_0x14a804++){var _0x33cee6=events[_0x14a804];var _0xb01a9f=createListener('whatsappInteraction:'+_0x33cee6,_0xd34114);WhatsappInteractionEvents['on'](_0x33cee6,_0xb01a9f);}}; \ No newline at end of file +var _0xcae5=['save','remove','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xcae5,0x1f1));var _0x5cae=function(_0x2ae6f6,_0x4a4c6f){_0x2ae6f6=_0x2ae6f6-0x0;var _0x41dd46=_0xcae5[_0x2ae6f6];return _0x41dd46;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x5cae('0x0'),_0x5cae('0x1'),'update'];function createListener(_0x36a9ab,_0x34e259){return function(_0x5e7d90){_0x34e259[_0x5cae('0x2')](_0x36a9ab,_0x5e7d90);};}function removeListener(_0x69e43a,_0x5d6d99){return function(){WhatsappInteractionEvents[_0x5cae('0x3')](_0x69e43a,_0x5d6d99);};}exports[_0x5cae('0x4')]=function(_0xc5e35){for(var _0x2bf24f=0x0,_0x2c62d9=events[_0x5cae('0x5')];_0x2bf24f<_0x2c62d9;_0x2bf24f++){var _0x2ac62d=events[_0x2bf24f];var _0x3fd429=createListener(_0x5cae('0x6')+_0x2ac62d,_0xc5e35);WhatsappInteractionEvents['on'](_0x2ac62d,_0x3fd429);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 186d75d..0d470f3 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 _0x4f5e=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','/describe','describe','post','whatsappmessage:create','create','/:id/status','status','put','/:id','update','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path'];(function(_0x1871ab,_0x511217){var _0xf4b0a6=function(_0x3567ce){while(--_0x3567ce){_0x1871ab['push'](_0x1871ab['shift']());}};_0xf4b0a6(++_0x511217);}(_0x4f5e,0xb3));var _0xe4f5=function(_0x1a72da,_0x124452){_0x1a72da=_0x1a72da-0x0;var _0x858c82=_0x4f5e[_0x1a72da];return _0x858c82;};'use strict';var multer=require(_0xe4f5('0x0'));var util=require(_0xe4f5('0x1'));var path=require(_0xe4f5('0x2'));var timeout=require(_0xe4f5('0x3'));var express=require('express');var router=express[_0xe4f5('0x4')]();var fs_extra=require(_0xe4f5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe4f5('0x6'));var config=require(_0xe4f5('0x7'));var controller=require(_0xe4f5('0x8'));router['get']('/',auth[_0xe4f5('0x9')](),controller[_0xe4f5('0xa')]);router['get'](_0xe4f5('0xb'),auth[_0xe4f5('0x9')](),controller[_0xe4f5('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe4f5('0xd')]('/',auth[_0xe4f5('0x9')](),interaction['tracked']('whatsapp',_0xe4f5('0xe')),controller[_0xe4f5('0xf')]);router[_0xe4f5('0xd')](_0xe4f5('0x10'),controller[_0xe4f5('0x11')]);router[_0xe4f5('0x12')](_0xe4f5('0x13'),auth['isAuthenticated'](),controller[_0xe4f5('0x14')]);router[_0xe4f5('0x12')](_0xe4f5('0x15'),auth['isAuthenticated'](),controller['accept']);router[_0xe4f5('0x12')](_0xe4f5('0x16'),auth[_0xe4f5('0x9')](),controller[_0xe4f5('0x17')]);router['delete'](_0xe4f5('0x13'),auth['isAuthenticated'](),controller[_0xe4f5('0x18')]);module[_0xe4f5('0x19')]=router; \ No newline at end of file +var _0x5f3b=['isAuthenticated','/:id','show','whatsapp','whatsappmessage:create','post','/:id/status','status','put','update','/:id/accept','/:id/reject','reject','destroy','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0x5f3b,0x122));var _0xb5f3=function(_0x18db39,_0x5dbdbc){_0x18db39=_0x18db39-0x0;var _0x200176=_0x5f3b[_0x18db39];return _0x200176;};'use strict';var multer=require(_0xb5f3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb5f3('0x1')]();var fs_extra=require(_0xb5f3('0x2'));var auth=require(_0xb5f3('0x3'));var interaction=require(_0xb5f3('0x4'));var config=require(_0xb5f3('0x5'));var controller=require(_0xb5f3('0x6'));router[_0xb5f3('0x7')]('/',auth['isAuthenticated'](),controller[_0xb5f3('0x8')]);router[_0xb5f3('0x7')](_0xb5f3('0x9'),auth[_0xb5f3('0xa')](),controller['describe']);router[_0xb5f3('0x7')](_0xb5f3('0xb'),auth[_0xb5f3('0xa')](),controller[_0xb5f3('0xc')]);router['post']('/',auth[_0xb5f3('0xa')](),interaction['tracked'](_0xb5f3('0xd'),_0xb5f3('0xe')),controller['create']);router[_0xb5f3('0xf')](_0xb5f3('0x10'),controller[_0xb5f3('0x11')]);router[_0xb5f3('0x12')](_0xb5f3('0xb'),auth[_0xb5f3('0xa')](),controller[_0xb5f3('0x13')]);router[_0xb5f3('0x12')](_0xb5f3('0x14'),auth[_0xb5f3('0xa')](),controller['accept']);router['put'](_0xb5f3('0x15'),auth[_0xb5f3('0xa')](),controller[_0xb5f3('0x16')]);router['delete'](_0xb5f3('0xb'),auth[_0xb5f3('0xa')](),controller[_0xb5f3('0x17')]);module[_0xb5f3('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 68d7d9a..3a070b6 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 _0x1580=['ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x3cf387,_0x31ed26){var _0x24425f=function(_0x500fc6){while(--_0x500fc6){_0x3cf387['push'](_0x3cf387['shift']());}};_0x24425f(++_0x31ed26);}(_0x1580,0x15a));var _0x0158=function(_0x2a26a2,_0x22a172){_0x2a26a2=_0x2a26a2-0x0;var _0x449693=_0x1580[_0x2a26a2];return _0x449693;};'use strict';var Sequelize=require(_0x0158('0x0'));module[_0x0158('0x1')]={'body':{'type':Sequelize[_0x0158('0x2')](_0x0158('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0158('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0158('0x5')]('in',_0x0158('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x0158('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x0158('0x8')]},'secret':{'type':Sequelize[_0x0158('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x0158('0x2')]}}; \ No newline at end of file +var _0xbfe8=['out','STRING','DATE','exports','medium','BOOLEAN'];(function(_0x43ec2e,_0x3719b4){var _0x40ff3d=function(_0x450e31){while(--_0x450e31){_0x43ec2e['push'](_0x43ec2e['shift']());}};_0x40ff3d(++_0x3719b4);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x14c85c,_0x641112){_0x14c85c=_0x14c85c-0x0;var _0x89b231=_0xbfe8[_0x14c85c];return _0x89b231;};'use strict';var Sequelize=require('sequelize');module[_0x8bfe('0x0')]={'body':{'type':Sequelize['TEXT'](_0x8bfe('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x8bfe('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x8bfe('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8bfe('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x8bfe('0x5')]},'secret':{'type':Sequelize[_0x8bfe('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8bfe('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 8cf7351..3811e9f 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 _0x140d=['WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','destroy','stack','name','send','index','map','WhatsappMessage','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','merge','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','update','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','email','rejectmessage','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','request-promise','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./whatsappMessage.socket','register','jayson/promise','client','then','info'];(function(_0x3fc00,_0x475154){var _0x1f8f0b=function(_0x5aef8c){while(--_0x5aef8c){_0x3fc00['push'](_0x3fc00['shift']());}};_0x1f8f0b(++_0x475154);}(_0x140d,0x180));var _0xd140=function(_0x5c2968,_0x3d772b){_0x5c2968=_0x5c2968-0x0;var _0x3e3ff8=_0x140d[_0x5c2968];return _0x3e3ff8;};'use strict';var emlformat=require(_0xd140('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd140('0x1'));var moment=require(_0xd140('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xd140('0x3'));var util=require(_0xd140('0x4'));var path=require(_0xd140('0x5'));var sox=require(_0xd140('0x6'));var csv=require(_0xd140('0x7'));var ejs=require(_0xd140('0x8'));var fs=require('fs');var fs_extra=require(_0xd140('0x9'));var _=require(_0xd140('0xa'));var squel=require(_0xd140('0xb'));var crypto=require(_0xd140('0xc'));var jsforce=require(_0xd140('0xd'));var deskjs=require(_0xd140('0xe'));var toCsv=require(_0xd140('0x7'));var querystring=require(_0xd140('0xf'));var Papa=require(_0xd140('0x10'));var Redis=require('ioredis');var authService=require(_0xd140('0x11'));var qs=require(_0xd140('0x12'));var as=require(_0xd140('0x13'));var hardwareService=require(_0xd140('0x14'));var logger=require(_0xd140('0x15'))(_0xd140('0x16'));var utils=require(_0xd140('0x17'));var config=require(_0xd140('0x18'));var licenseUtil=require(_0xd140('0x19'));var db=require(_0xd140('0x1a'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xd140('0x1b'),'port':0x18eb});var socket=require(_0xd140('0x1c'))(new Redis(config[_0xd140('0x1d')]));require(_0xd140('0x1e'))[_0xd140('0x1f')](socket);var jayson=require(_0xd140('0x20'));var client=jayson[_0xd140('0x21')]['http']({'port':0x232c});var client9002=jayson[_0xd140('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ee3f9,_0x467f5d,_0x2160c6,_0x9deb30){return new BPromise(function(_0x18fb85,_0x344489){var _0x52a106=_0x9deb30||client;return _0x52a106['request'](_0x3ee3f9,_0x2160c6)[_0xd140('0x22')](function(_0x2704cf){logger[_0xd140('0x23')](_0xd140('0x24'),_0x467f5d,_0xd140('0x25'));logger[_0xd140('0x26')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x467f5d,_0xd140('0x25'),JSON['stringify'](_0x2704cf));if(_0x2704cf['error']){if(_0x2704cf['error'][_0xd140('0x27')]===0x1f4){logger[_0xd140('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x467f5d,_0x2704cf[_0xd140('0x28')][_0xd140('0x29')]);return _0x344489(_0x2704cf[_0xd140('0x28')][_0xd140('0x29')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x467f5d,_0x2704cf[_0xd140('0x28')][_0xd140('0x29')]);return _0x18fb85(_0x2704cf['error'][_0xd140('0x29')]);}else{logger[_0xd140('0x23')](_0xd140('0x24'),_0x467f5d,'request\x20sent');_0x18fb85(_0x2704cf[_0xd140('0x2a')][_0xd140('0x29')]);}})[_0xd140('0x2b')](function(_0x3b8e67){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x467f5d,_0x3b8e67);_0x344489(_0x3b8e67);});});}function respondWithStatusCode(_0x3d53a3,_0x2abeac){_0x2abeac=_0x2abeac||0xcc;return function(_0x45b4f7){if(_0x45b4f7){return _0x3d53a3[_0xd140('0x2c')](_0x2abeac);}return _0x3d53a3[_0xd140('0x2d')](_0x2abeac)[_0xd140('0x2e')]();};}function respondWithResult(_0x2d7386,_0x2ea9be){_0x2ea9be=_0x2ea9be||0xc8;return function(_0x7800c1){if(_0x7800c1){return _0x2d7386['status'](_0x2ea9be)['json'](_0x7800c1);}};}function respondWithFilteredResult(_0x5099f2,_0x339291){return function(_0x2547af){if(_0x2547af){var _0x76367f=typeof _0x339291[_0xd140('0x2f')]===_0xd140('0x30')&&typeof _0x339291[_0xd140('0x31')]===_0xd140('0x30');var _0x1a0a53=_0x2547af[_0xd140('0x32')];var _0x4a57ac=_0x76367f?0x0:_0x339291[_0xd140('0x2f')];var _0xec5fad=_0x76367f?_0x2547af[_0xd140('0x32')]:_0x339291['offset']+_0x339291['limit'];var _0x186b43;if(_0xec5fad>=_0x1a0a53){_0xec5fad=_0x1a0a53;_0x186b43=0xc8;}else{_0x186b43=0xce;}_0x5099f2['status'](_0x186b43);return _0x5099f2[_0xd140('0x33')](_0xd140('0x34'),_0x4a57ac+'-'+_0xec5fad+'/'+_0x1a0a53)[_0xd140('0x35')](_0x2547af);}return null;};}function patchUpdates(_0x4b0860){return function(_0x1ec9b7){try{jsonpatch['apply'](_0x1ec9b7,_0x4b0860,!![]);}catch(_0x49470e){return BPromise['reject'](_0x49470e);}return _0x1ec9b7[_0xd140('0x36')]();};}function saveUpdates(_0x1c9ed1,_0x588f73){return function(_0x371822){if(_0x371822){return _0x371822['update'](_0x1c9ed1)[_0xd140('0x22')](function(_0x51fd1d){return _0x51fd1d;});}return null;};}function removeEntity(_0x582347,_0x580494){return function(_0x326d74){if(_0x326d74){return _0x326d74[_0xd140('0x37')]()['then'](function(){_0x582347[_0xd140('0x2d')](0xcc)[_0xd140('0x2e')]();});}};}function handleEntityNotFound(_0x4acfaf,_0x2a19b8){return function(_0x1fcb77){if(!_0x1fcb77){_0x4acfaf['sendStatus'](0x194);}return _0x1fcb77;};}function handleError(_0x2376e2,_0x14aceb){_0x14aceb=_0x14aceb||0x1f4;return function(_0x49a6b4){logger[_0xd140('0x28')](_0x49a6b4[_0xd140('0x38')]);if(_0x49a6b4[_0xd140('0x39')]){delete _0x49a6b4[_0xd140('0x39')];}_0x2376e2[_0xd140('0x2d')](_0x14aceb)[_0xd140('0x3a')](_0x49a6b4);};}exports[_0xd140('0x3b')]=function(_0xbffc9,_0x2415b6){var _0x56ef2d={},_0x356950={},_0x590db7={'count':0x0,'rows':[]};var _0x188df4=_[_0xd140('0x3c')](db[_0xd140('0x3d')]['rawAttributes'],function(_0x3c08a7){return{'name':_0x3c08a7[_0xd140('0x3e')],'type':_0x3c08a7[_0xd140('0x3f')][_0xd140('0x40')]};});_0x356950[_0xd140('0x41')]=_[_0xd140('0x3c')](_0x188df4,_0xd140('0x39'));_0x356950[_0xd140('0x42')]=_[_0xd140('0x43')](_0xbffc9['query']);_0x356950[_0xd140('0x44')]=_[_0xd140('0x45')](_0x356950['model'],_0x356950[_0xd140('0x42')]);_0x56ef2d['attributes']=_[_0xd140('0x45')](_0x356950['model'],qs[_0xd140('0x46')](_0xbffc9['query'][_0xd140('0x46')]));_0x56ef2d[_0xd140('0x47')]=_0x56ef2d[_0xd140('0x47')][_0xd140('0x48')]?_0x56ef2d[_0xd140('0x47')]:_0x356950[_0xd140('0x41')];if(!_0xbffc9[_0xd140('0x42')][_0xd140('0x49')]('nolimit')){_0x56ef2d[_0xd140('0x31')]=qs['limit'](_0xbffc9['query'][_0xd140('0x31')]);_0x56ef2d[_0xd140('0x2f')]=qs[_0xd140('0x2f')](_0xbffc9['query'][_0xd140('0x2f')]);}_0x56ef2d[_0xd140('0x4a')]=qs['sort'](_0xbffc9[_0xd140('0x42')]['sort']);_0x56ef2d[_0xd140('0x4b')]=qs[_0xd140('0x44')](_[_0xd140('0x4c')](_0xbffc9[_0xd140('0x42')],_0x356950[_0xd140('0x44')]),_0x188df4);if(_0xbffc9[_0xd140('0x42')]['filter']){_0x56ef2d['where']=_['merge'](_0x56ef2d[_0xd140('0x4b')],{'$or':_[_0xd140('0x3c')](_0x188df4,function(_0x59cd02){if(_0x59cd02['type']!=='VIRTUAL'){var _0x248157={};_0x248157[_0x59cd02[_0xd140('0x39')]]={'$like':'%'+_0xbffc9['query']['filter']+'%'};return _0x248157;}})});}_0x56ef2d=_[_0xd140('0x4d')]({},_0x56ef2d,_0xbffc9['options']);var _0x951b14={'where':_0x56ef2d[_0xd140('0x4b')]};return db['WhatsappMessage'][_0xd140('0x32')](_0x951b14)[_0xd140('0x22')](function(_0x270098){_0x590db7[_0xd140('0x32')]=_0x270098;if(_0xbffc9['query'][_0xd140('0x4e')]){_0x56ef2d[_0xd140('0x4f')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xd140('0x50')](_0x56ef2d);})[_0xd140('0x22')](function(_0x4481fe){_0x590db7[_0xd140('0x51')]=_0x4481fe;return _0x590db7;})[_0xd140('0x22')](respondWithFilteredResult(_0x2415b6,_0x56ef2d))[_0xd140('0x2b')](handleError(_0x2415b6,null));};exports[_0xd140('0x52')]=function(_0x3fd30e,_0x4d591){var _0x55f2ea={'raw':!![],'where':{'id':_0x3fd30e[_0xd140('0x53')]['id']}},_0x296c93={};_0x296c93[_0xd140('0x41')]=_['keys'](db[_0xd140('0x3d')][_0xd140('0x54')]);_0x296c93[_0xd140('0x42')]=_['keys'](_0x3fd30e[_0xd140('0x42')]);_0x296c93['filters']=_['intersection'](_0x296c93['model'],_0x296c93['query']);_0x55f2ea['attributes']=_['intersection'](_0x296c93[_0xd140('0x41')],qs[_0xd140('0x46')](_0x3fd30e[_0xd140('0x42')][_0xd140('0x46')]));_0x55f2ea['attributes']=_0x55f2ea['attributes']['length']?_0x55f2ea[_0xd140('0x47')]:_0x296c93['model'];if(_0x3fd30e['query'][_0xd140('0x4e')]){_0x55f2ea['include']=[{'all':!![]}];}_0x55f2ea=_[_0xd140('0x4d')]({},_0x55f2ea,_0x3fd30e[_0xd140('0x55')]);return db['WhatsappMessage'][_0xd140('0x56')](_0x55f2ea)[_0xd140('0x22')](handleEntityNotFound(_0x4d591,null))[_0xd140('0x22')](respondWithResult(_0x4d591,null))['catch'](handleError(_0x4d591,null));};exports[_0xd140('0x57')]=function(_0x3fe0a0,_0x4fb117){return db['WhatsappMessage']['create'](_0x3fe0a0[_0xd140('0x58')],{})[_0xd140('0x22')](respondWithResult(_0x4fb117,0xc9))[_0xd140('0x2b')](handleError(_0x4fb117,null));};exports['update']=function(_0x5be3e5,_0xb36e79){if(_0x5be3e5[_0xd140('0x58')]['id']){delete _0x5be3e5[_0xd140('0x58')]['id'];}return db[_0xd140('0x3d')][_0xd140('0x56')]({'where':{'id':_0x5be3e5[_0xd140('0x53')]['id']}})['then'](handleEntityNotFound(_0xb36e79,null))[_0xd140('0x22')](saveUpdates(_0x5be3e5[_0xd140('0x58')],null))[_0xd140('0x22')](respondWithResult(_0xb36e79,null))[_0xd140('0x2b')](handleError(_0xb36e79,null));};exports['destroy']=function(_0x46db34,_0x38d067){return db[_0xd140('0x3d')]['find']({'where':{'id':_0x46db34[_0xd140('0x53')]['id']}})[_0xd140('0x22')](handleEntityNotFound(_0x38d067,null))[_0xd140('0x22')](removeEntity(_0x38d067,null))[_0xd140('0x2b')](handleError(_0x38d067,null));};exports[_0xd140('0x59')]=function(_0x7d698c,_0x22fb53){return db[_0xd140('0x3d')][_0xd140('0x59')]()['then'](respondWithResult(_0x22fb53,null))[_0xd140('0x2b')](handleError(_0x22fb53,null));};var interaction_log=require('../../config/logger')(_0xd140('0x5a'));exports[_0xd140('0x5b')]=function(_0x29081f,_0x4a9809,_0x234b70){var _0x14f895={'agent':{},'channel':_0xd140('0x5c')};if(_0x29081f[_0xd140('0x58')]['id']){delete _0x29081f['body']['id'];}_0x29081f['body'][_0xd140('0x5d')]=!![];_0x29081f[_0xd140('0x58')]['readAt']=moment()[_0xd140('0x5e')](_0xd140('0x5f'));_0x29081f[_0xd140('0x58')][_0xd140('0x60')]=_0x29081f[_0xd140('0x58')]['UserId']||_0x29081f[_0xd140('0x61')]['id'];_0x14f895[_0xd140('0x62')]['id']=_0x29081f[_0xd140('0x58')][_0xd140('0x60')];return db[_0xd140('0x3d')][_0xd140('0x56')]({'where':{'id':_0x29081f['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4a9809,null))['then'](saveUpdates(_0x29081f[_0xd140('0x58')],null))[_0xd140('0x22')](function(_0x177e5b){if(_0x177e5b){_0x14f895[_0xd140('0x29')]=_0x177e5b[_0xd140('0x63')]({'plain':!![]});return db[_0xd140('0x64')]['find']({'where':{'id':_0x177e5b[_0xd140('0x65')]}});}return null;})[_0xd140('0x22')](handleEntityNotFound(_0x4a9809,null))['then'](function(_0x578a02){if(_0x578a02){return _0x578a02[_0xd140('0x66')]({'UserId':_0x29081f[_0xd140('0x58')]['UserId'],'read1stAt':_[_0xd140('0x67')](_0x578a02[_0xd140('0x68')])?moment()[_0xd140('0x5e')](_0xd140('0x5f')):undefined});}return null;})[_0xd140('0x22')](function(_0x1ea69f){if(_0x1ea69f){_0x14f895[_0xd140('0x69')]=_0x1ea69f['get']({'plain':!![]});interaction_log[_0xd140('0x23')](_0xd140('0x6a'),_0x29081f[_0xd140('0x61')]['id'],_0x29081f[_0xd140('0x61')][_0xd140('0x39')],_0x29081f[_0xd140('0x61')][_0xd140('0x6b')],_0x14f895[_0xd140('0x69')]['id'],_0x29081f['body']?JSON[_0xd140('0x6c')](_0x29081f['body']):_0xd140('0x6d'));return respondWithRpcPromise(_0xd140('0x6e'),'acceptMessage',_0x14f895);}return null;})[_0xd140('0x22')](function(_0x36bb1c){var _0x139991='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x36bb1c[_0xd140('0x29')][_0xd140('0x6f')];return db['sequelize'][_0xd140('0x42')](_0x139991,{'type':db[_0xd140('0x70')][_0xd140('0x71')][_0xd140('0x72')],'raw':!![]})[_0xd140('0x22')](function(_0x4b154a){return _0x4b154a;});})['then'](function(_0x495668){if(_0x495668){_0x14f895[_0xd140('0x29')][_0xd140('0x73')]=_0x495668[0x0];if(!_0x29081f[_0xd140('0x58')][_0xd140('0x60')])return;return db[_0xd140('0x74')][_0xd140('0x56')]({'where':{'id':_0x29081f['body'][_0xd140('0x60')],'role':'agent'},'attributes':['id',_0xd140('0x39'),_0xd140('0x75'),'email',_0xd140('0x76')],'raw':!![]});}return null;})[_0xd140('0x22')](function(_0x1dadd7){if(!_0x1dadd7)return null;_0x14f895['message'][_0xd140('0x62')]=_0x1dadd7;return _0x14f895;})[_0xd140('0x22')](function(_0x3a1eea){if(_0x3a1eea){if(_0x29081f['body'][_0xd140('0x77')]){_0x14f895[_0xd140('0x29')][_0xd140('0x78')]=util['format'](_0xd140('0x79'),_0x29081f['user'][_0xd140('0x39')]);_0x14f895[_0xd140('0x29')]['channel']=_0x14f895[_0xd140('0x7a')];_0x14f895['message'][_0xd140('0x7b')]=_0x14f895[_0xd140('0x7a')];_0x14f895['message']['event']='accept';return respondWithRpcPromise(_0xd140('0x7c'),_0xd140('0x7c'),{'event':_0xd140('0x7d'),'message':_0x14f895[_0xd140('0x29')]},client9002)[_0xd140('0x22')](function(){return _0x14f895;});}return _0x14f895;}return null;})[_0xd140('0x22')](respondWithResult(_0x4a9809,null))[_0xd140('0x2b')](handleError(_0x4a9809,null));};var interaction_log=require(_0xd140('0x15'))(_0xd140('0x5a'));exports[_0xd140('0x7e')]=function(_0x1367a3,_0x2d4464,_0x52725d){var _0x5c44e3={'agent':{},'channel':_0xd140('0x5c')};if(_0x1367a3[_0xd140('0x58')]['id']){delete _0x1367a3['body']['id'];}_0x1367a3[_0xd140('0x58')]['UserId']=_0x1367a3[_0xd140('0x58')][_0xd140('0x60')]||_0x1367a3[_0xd140('0x61')]['id'];_0x5c44e3[_0xd140('0x62')]['id']=_0x1367a3['body'][_0xd140('0x60')];return db[_0xd140('0x3d')][_0xd140('0x56')]({'where':{'id':_0x1367a3[_0xd140('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2d4464,null))[_0xd140('0x22')](function(_0x2a12df){if(_0x2a12df){_0x5c44e3[_0xd140('0x29')]=_0x2a12df[_0xd140('0x63')]({'plain':!![]});return db[_0xd140('0x64')]['find']({'where':{'id':_0x2a12df[_0xd140('0x65')]}});}return null;})[_0xd140('0x22')](handleEntityNotFound(_0x2d4464,null))['then'](function(_0x3a1f45){if(_0x3a1f45){_0x5c44e3['interaction']=_0x3a1f45[_0xd140('0x63')]({'plain':!![]});interaction_log['info'](_0xd140('0x7f'),_0x1367a3[_0xd140('0x61')]['id'],_0x1367a3[_0xd140('0x61')]['name'],_0x1367a3[_0xd140('0x61')][_0xd140('0x6b')],_0x5c44e3['interaction']['id'],_0x1367a3[_0xd140('0x58')]?JSON[_0xd140('0x6c')](_0x1367a3[_0xd140('0x58')]):_0xd140('0x6d'));return respondWithRpcPromise(_0xd140('0x80'),_0xd140('0x81'),_0x5c44e3);}return null;})[_0xd140('0x22')](function(_0x37fbc5){var _0x5473c7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x37fbc5['message'][_0xd140('0x6f')];return db['sequelize']['query'](_0x5473c7,{'type':db[_0xd140('0x70')][_0xd140('0x71')]['SELECT'],'raw':!![]})['then'](function(_0x2945d4){return _0x2945d4;});})[_0xd140('0x22')](function(_0x21ca55){if(_0x21ca55){_0x5c44e3[_0xd140('0x29')]['contact']=_0x21ca55[0x0];if(!_0x1367a3[_0xd140('0x58')][_0xd140('0x60')])return;return db[_0xd140('0x74')][_0xd140('0x56')]({'where':{'id':_0x1367a3[_0xd140('0x58')][_0xd140('0x60')],'role':_0xd140('0x62')},'attributes':['id',_0xd140('0x39'),_0xd140('0x75'),_0xd140('0x82'),'internal'],'raw':!![]});}return null;})[_0xd140('0x22')](function(_0x580e32){if(!_0x580e32)return null;_0x5c44e3[_0xd140('0x29')][_0xd140('0x62')]=_0x580e32;return _0x5c44e3;})[_0xd140('0x22')](function(_0x5422ca){if(_0x5422ca){_0x5422ca[_0xd140('0x29')]['interface']=util[_0xd140('0x5e')](_0xd140('0x79'),_0x1367a3['user'][_0xd140('0x39')]);_0x5422ca[_0xd140('0x29')][_0xd140('0x7a')]=_0x5c44e3[_0xd140('0x7a')];_0x5422ca[_0xd140('0x29')][_0xd140('0x7b')]=_0x5c44e3['channel'];_0x5422ca[_0xd140('0x29')]['event']=_0xd140('0x7e');respondWithRpcPromise('EventManager',_0xd140('0x7c'),{'event':_0xd140('0x83'),'message':_0x5422ca[_0xd140('0x29')]},client9002);return _0x5c44e3;}return null;})[_0xd140('0x22')](respondWithResult(_0x2d4464,null))['catch'](handleError(_0x2d4464,null));};exports[_0xd140('0x2d')]=function(_0x3d42ff,_0x2fb2f8,_0x55b628){if(_0x3d42ff[_0xd140('0x58')]['id']){delete _0x3d42ff[_0xd140('0x58')]['id'];}var _0x1b87cf;return db['WhatsappMessage']['find']({'where':{'id':_0x3d42ff['params']['id']}})[_0xd140('0x22')](handleEntityNotFound(_0x2fb2f8,null))[_0xd140('0x22')](function(_0x13f8ba){if(_0x13f8ba){_0x1b87cf=_0x13f8ba;return db['WhatsappAccount'][_0xd140('0x56')]({'where':{'id':_0x13f8ba['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x2fb2f8,null))[_0xd140('0x22')](function(_0x17d758){if(_0x17d758){logger[_0xd140('0x26')](_0xd140('0x84'),_0xd140('0x2d'),_0xd140('0x85'),_0x17d758[_0xd140('0x3f')],util[_0xd140('0x86')](_0x3d42ff[_0xd140('0x58')],{'showHidden':![],'depth':null}));switch(_0x17d758[_0xd140('0x3f')]){case _0xd140('0x87'):if(_0x3d42ff[_0xd140('0x58')][_0xd140('0x88')]&&_0x3d42ff[_0xd140('0x58')]['MessageSid']===_0x1b87cf[_0xd140('0x89')]&&_0x3d42ff[_0xd140('0x58')]['MessageStatus']&&_0x3d42ff['body'][_0xd140('0x8a')]==='read'){return _0x1b87cf['update']({'read':!![]});}else{logger[_0xd140('0x28')](_0xd140('0x8b'),_0xd140('0x2d'),_0xd140('0x87'),util[_0xd140('0x86')](_0x3d42ff[_0xd140('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x1b87cf;}})[_0xd140('0x22')](respondWithResult(_0x2fb2f8,null))[_0xd140('0x2b')](handleError(_0x2fb2f8,null));}; \ No newline at end of file +var _0xeecb=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','http','request','then','info','request\x20sent','debug','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','save','destroy','end','stack','name','send','index','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','nolimit','order','filters','pick','filter','where','merge','options','WhatsappMessage','includeAll','include','findAll','rows','params','keys','find','create','body','update','describe','whatsapp-interactions','accept','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','email','interface','channel','motionChannel','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','fullname','internal','event','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','rimraf','zip-dir'];(function(_0x427a21,_0x2b58af){var _0x18c737=function(_0x124749){while(--_0x124749){_0x427a21['push'](_0x427a21['shift']());}};_0x18c737(++_0x2b58af);}(_0xeecb,0x18d));var _0xbeec=function(_0x475e33,_0x42824a){_0x475e33=_0x475e33-0x0;var _0x318871=_0xeecb[_0x475e33];return _0x318871;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbeec('0x0'));var zipdir=require(_0xbeec('0x1'));var jsonpatch=require(_0xbeec('0x2'));var rp=require(_0xbeec('0x3'));var moment=require(_0xbeec('0x4'));var BPromise=require(_0xbeec('0x5'));var Mustache=require(_0xbeec('0x6'));var util=require(_0xbeec('0x7'));var path=require(_0xbeec('0x8'));var sox=require(_0xbeec('0x9'));var csv=require(_0xbeec('0xa'));var ejs=require(_0xbeec('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbeec('0xc'));var crypto=require(_0xbeec('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbeec('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbeec('0xf'));var Papa=require(_0xbeec('0x10'));var Redis=require(_0xbeec('0x11'));var authService=require(_0xbeec('0x12'));var qs=require(_0xbeec('0x13'));var as=require(_0xbeec('0x14'));var hardwareService=require(_0xbeec('0x15'));var logger=require(_0xbeec('0x16'))(_0xbeec('0x17'));var utils=require('../../config/utils');var config=require(_0xbeec('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xbeec('0x19')]=_[_0xbeec('0x1a')](config[_0xbeec('0x19')],{'host':_0xbeec('0x1b'),'port':0x18eb});var socket=require(_0xbeec('0x1c'))(new Redis(config[_0xbeec('0x19')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xbeec('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xbeec('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x48602a,_0x4b6ab2,_0xe9233f,_0x158553){return new BPromise(function(_0x14e4e7,_0x60ebe5){var _0x52826a=_0x158553||client;return _0x52826a[_0xbeec('0x1e')](_0x48602a,_0xe9233f)[_0xbeec('0x1f')](function(_0xf62c4e){logger[_0xbeec('0x20')]('WhatsappMessage,\x20%s,\x20%s',_0x4b6ab2,_0xbeec('0x21'));logger[_0xbeec('0x22')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4b6ab2,_0xbeec('0x21'),JSON[_0xbeec('0x23')](_0xf62c4e));if(_0xf62c4e[_0xbeec('0x24')]){if(_0xf62c4e[_0xbeec('0x24')]['code']===0x1f4){logger[_0xbeec('0x24')](_0xbeec('0x25'),_0x4b6ab2,_0xf62c4e[_0xbeec('0x24')][_0xbeec('0x26')]);return _0x60ebe5(_0xf62c4e[_0xbeec('0x24')]['message']);}logger[_0xbeec('0x24')](_0xbeec('0x25'),_0x4b6ab2,_0xf62c4e[_0xbeec('0x24')][_0xbeec('0x26')]);return _0x14e4e7(_0xf62c4e[_0xbeec('0x24')][_0xbeec('0x26')]);}else{logger[_0xbeec('0x20')](_0xbeec('0x25'),_0x4b6ab2,'request\x20sent');_0x14e4e7(_0xf62c4e[_0xbeec('0x27')]['message']);}})[_0xbeec('0x28')](function(_0x275b1b){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4b6ab2,_0x275b1b);_0x60ebe5(_0x275b1b);});});}function respondWithStatusCode(_0x38b5c4,_0x2350d9){_0x2350d9=_0x2350d9||0xcc;return function(_0x9e786a){if(_0x9e786a){return _0x38b5c4[_0xbeec('0x29')](_0x2350d9);}return _0x38b5c4[_0xbeec('0x2a')](_0x2350d9)['end']();};}function respondWithResult(_0x369164,_0x341408){_0x341408=_0x341408||0xc8;return function(_0x1f4ee9){if(_0x1f4ee9){return _0x369164[_0xbeec('0x2a')](_0x341408)[_0xbeec('0x2b')](_0x1f4ee9);}};}function respondWithFilteredResult(_0x187bae,_0x14a895){return function(_0x5b2ac7){if(_0x5b2ac7){var _0x18af54=typeof _0x14a895[_0xbeec('0x2c')]==='undefined'&&typeof _0x14a895[_0xbeec('0x2d')]==='undefined';var _0x3d29f0=_0x5b2ac7['count'];var _0x347364=_0x18af54?0x0:_0x14a895[_0xbeec('0x2c')];var _0x19f60c=_0x18af54?_0x5b2ac7[_0xbeec('0x2e')]:_0x14a895['offset']+_0x14a895['limit'];var _0x18aa58;if(_0x19f60c>=_0x3d29f0){_0x19f60c=_0x3d29f0;_0x18aa58=0xc8;}else{_0x18aa58=0xce;}_0x187bae[_0xbeec('0x2a')](_0x18aa58);return _0x187bae[_0xbeec('0x2f')](_0xbeec('0x30'),_0x347364+'-'+_0x19f60c+'/'+_0x3d29f0)[_0xbeec('0x2b')](_0x5b2ac7);}return null;};}function patchUpdates(_0x307903){return function(_0x30f1e0){try{jsonpatch['apply'](_0x30f1e0,_0x307903,!![]);}catch(_0x3ce43e){return BPromise[_0xbeec('0x31')](_0x3ce43e);}return _0x30f1e0[_0xbeec('0x32')]();};}function saveUpdates(_0x45a6a9,_0x39b72b){return function(_0x2e9bc2){if(_0x2e9bc2){return _0x2e9bc2['update'](_0x45a6a9)[_0xbeec('0x1f')](function(_0x961f8b){return _0x961f8b;});}return null;};}function removeEntity(_0x398d32,_0x714f37){return function(_0x3c617b){if(_0x3c617b){return _0x3c617b[_0xbeec('0x33')]()['then'](function(){_0x398d32[_0xbeec('0x2a')](0xcc)[_0xbeec('0x34')]();});}};}function handleEntityNotFound(_0x3da2a7,_0x1b0285){return function(_0x3a53a3){if(!_0x3a53a3){_0x3da2a7[_0xbeec('0x29')](0x194);}return _0x3a53a3;};}function handleError(_0xce8301,_0x2c7f34){_0x2c7f34=_0x2c7f34||0x1f4;return function(_0x3efe7c){logger['error'](_0x3efe7c[_0xbeec('0x35')]);if(_0x3efe7c['name']){delete _0x3efe7c[_0xbeec('0x36')];}_0xce8301[_0xbeec('0x2a')](_0x2c7f34)[_0xbeec('0x37')](_0x3efe7c);};}exports[_0xbeec('0x38')]=function(_0x37a66d,_0x41a0e6){var _0x511113={},_0x199ae3={},_0x12a4c9={'count':0x0,'rows':[]};var _0x14317f=_['map'](db['WhatsappMessage'][_0xbeec('0x39')],function(_0x2d8ff0){return{'name':_0x2d8ff0['fieldName'],'type':_0x2d8ff0[_0xbeec('0x3a')][_0xbeec('0x3b')]};});_0x199ae3[_0xbeec('0x3c')]=_[_0xbeec('0x3d')](_0x14317f,_0xbeec('0x36'));_0x199ae3['query']=_['keys'](_0x37a66d[_0xbeec('0x3e')]);_0x199ae3['filters']=_[_0xbeec('0x3f')](_0x199ae3['model'],_0x199ae3[_0xbeec('0x3e')]);_0x511113[_0xbeec('0x40')]=_[_0xbeec('0x3f')](_0x199ae3[_0xbeec('0x3c')],qs[_0xbeec('0x41')](_0x37a66d[_0xbeec('0x3e')][_0xbeec('0x41')]));_0x511113[_0xbeec('0x40')]=_0x511113[_0xbeec('0x40')][_0xbeec('0x42')]?_0x511113['attributes']:_0x199ae3[_0xbeec('0x3c')];if(!_0x37a66d[_0xbeec('0x3e')]['hasOwnProperty'](_0xbeec('0x43'))){_0x511113['limit']=qs[_0xbeec('0x2d')](_0x37a66d[_0xbeec('0x3e')]['limit']);_0x511113['offset']=qs[_0xbeec('0x2c')](_0x37a66d[_0xbeec('0x3e')]['offset']);}_0x511113[_0xbeec('0x44')]=qs['sort'](_0x37a66d[_0xbeec('0x3e')]['sort']);_0x511113['where']=qs[_0xbeec('0x45')](_[_0xbeec('0x46')](_0x37a66d[_0xbeec('0x3e')],_0x199ae3[_0xbeec('0x45')]),_0x14317f);if(_0x37a66d[_0xbeec('0x3e')][_0xbeec('0x47')]){_0x511113[_0xbeec('0x48')]=_[_0xbeec('0x49')](_0x511113[_0xbeec('0x48')],{'$or':_[_0xbeec('0x3d')](_0x14317f,function(_0x92794e){if(_0x92794e[_0xbeec('0x3a')]!=='VIRTUAL'){var _0x183929={};_0x183929[_0x92794e[_0xbeec('0x36')]]={'$like':'%'+_0x37a66d[_0xbeec('0x3e')]['filter']+'%'};return _0x183929;}})});}_0x511113=_[_0xbeec('0x49')]({},_0x511113,_0x37a66d[_0xbeec('0x4a')]);var _0x17260a={'where':_0x511113[_0xbeec('0x48')]};return db[_0xbeec('0x4b')][_0xbeec('0x2e')](_0x17260a)['then'](function(_0x5b0ba1){_0x12a4c9[_0xbeec('0x2e')]=_0x5b0ba1;if(_0x37a66d[_0xbeec('0x3e')][_0xbeec('0x4c')]){_0x511113[_0xbeec('0x4d')]=[{'all':!![]}];}return db[_0xbeec('0x4b')][_0xbeec('0x4e')](_0x511113);})[_0xbeec('0x1f')](function(_0x4a383d){_0x12a4c9[_0xbeec('0x4f')]=_0x4a383d;return _0x12a4c9;})[_0xbeec('0x1f')](respondWithFilteredResult(_0x41a0e6,_0x511113))[_0xbeec('0x28')](handleError(_0x41a0e6,null));};exports['show']=function(_0x4f8f76,_0xb2641c){var _0x3470c5={'raw':!![],'where':{'id':_0x4f8f76[_0xbeec('0x50')]['id']}},_0x372c28={};_0x372c28['model']=_['keys'](db[_0xbeec('0x4b')]['rawAttributes']);_0x372c28[_0xbeec('0x3e')]=_[_0xbeec('0x51')](_0x4f8f76['query']);_0x372c28[_0xbeec('0x45')]=_[_0xbeec('0x3f')](_0x372c28[_0xbeec('0x3c')],_0x372c28[_0xbeec('0x3e')]);_0x3470c5[_0xbeec('0x40')]=_[_0xbeec('0x3f')](_0x372c28[_0xbeec('0x3c')],qs[_0xbeec('0x41')](_0x4f8f76[_0xbeec('0x3e')]['fields']));_0x3470c5['attributes']=_0x3470c5[_0xbeec('0x40')][_0xbeec('0x42')]?_0x3470c5['attributes']:_0x372c28[_0xbeec('0x3c')];if(_0x4f8f76[_0xbeec('0x3e')][_0xbeec('0x4c')]){_0x3470c5[_0xbeec('0x4d')]=[{'all':!![]}];}_0x3470c5=_[_0xbeec('0x49')]({},_0x3470c5,_0x4f8f76['options']);return db[_0xbeec('0x4b')][_0xbeec('0x52')](_0x3470c5)['then'](handleEntityNotFound(_0xb2641c,null))[_0xbeec('0x1f')](respondWithResult(_0xb2641c,null))[_0xbeec('0x28')](handleError(_0xb2641c,null));};exports[_0xbeec('0x53')]=function(_0x4f951d,_0x3981ab){return db[_0xbeec('0x4b')]['create'](_0x4f951d[_0xbeec('0x54')],{})[_0xbeec('0x1f')](respondWithResult(_0x3981ab,0xc9))[_0xbeec('0x28')](handleError(_0x3981ab,null));};exports[_0xbeec('0x55')]=function(_0x2f6390,_0x4dc353){if(_0x2f6390[_0xbeec('0x54')]['id']){delete _0x2f6390[_0xbeec('0x54')]['id'];}return db[_0xbeec('0x4b')]['find']({'where':{'id':_0x2f6390['params']['id']}})[_0xbeec('0x1f')](handleEntityNotFound(_0x4dc353,null))[_0xbeec('0x1f')](saveUpdates(_0x2f6390[_0xbeec('0x54')],null))[_0xbeec('0x1f')](respondWithResult(_0x4dc353,null))['catch'](handleError(_0x4dc353,null));};exports['destroy']=function(_0x31de80,_0xe657f7){return db[_0xbeec('0x4b')]['find']({'where':{'id':_0x31de80[_0xbeec('0x50')]['id']}})['then'](handleEntityNotFound(_0xe657f7,null))[_0xbeec('0x1f')](removeEntity(_0xe657f7,null))[_0xbeec('0x28')](handleError(_0xe657f7,null));};exports[_0xbeec('0x56')]=function(_0x31eea2,_0x1320c1){return db[_0xbeec('0x4b')][_0xbeec('0x56')]()[_0xbeec('0x1f')](respondWithResult(_0x1320c1,null))[_0xbeec('0x28')](handleError(_0x1320c1,null));};var interaction_log=require(_0xbeec('0x16'))(_0xbeec('0x57'));exports[_0xbeec('0x58')]=function(_0xd08b82,_0xc86c89,_0x1ad7d0){var _0x4982c0={'agent':{},'channel':_0xbeec('0x59')};if(_0xd08b82['body']['id']){delete _0xd08b82['body']['id'];}_0xd08b82[_0xbeec('0x54')][_0xbeec('0x5a')]=!![];_0xd08b82['body']['readAt']=moment()[_0xbeec('0x5b')](_0xbeec('0x5c'));_0xd08b82[_0xbeec('0x54')][_0xbeec('0x5d')]=_0xd08b82['body'][_0xbeec('0x5d')]||_0xd08b82[_0xbeec('0x5e')]['id'];_0x4982c0['agent']['id']=_0xd08b82['body']['UserId'];return db[_0xbeec('0x4b')]['find']({'where':{'id':_0xd08b82[_0xbeec('0x50')]['id'],'UserId':null}})[_0xbeec('0x1f')](handleEntityNotFound(_0xc86c89,null))[_0xbeec('0x1f')](saveUpdates(_0xd08b82[_0xbeec('0x54')],null))[_0xbeec('0x1f')](function(_0x53769d){if(_0x53769d){_0x4982c0[_0xbeec('0x26')]=_0x53769d[_0xbeec('0x5f')]({'plain':!![]});return db['WhatsappInteraction'][_0xbeec('0x52')]({'where':{'id':_0x53769d[_0xbeec('0x60')]}});}return null;})[_0xbeec('0x1f')](handleEntityNotFound(_0xc86c89,null))['then'](function(_0x1d02a5){if(_0x1d02a5){return _0x1d02a5[_0xbeec('0x55')]({'UserId':_0xd08b82[_0xbeec('0x54')][_0xbeec('0x5d')],'read1stAt':_[_0xbeec('0x61')](_0x1d02a5[_0xbeec('0x62')])?moment()[_0xbeec('0x5b')](_0xbeec('0x5c')):undefined});}return null;})[_0xbeec('0x1f')](function(_0x3914a6){if(_0x3914a6){_0x4982c0[_0xbeec('0x63')]=_0x3914a6[_0xbeec('0x5f')]({'plain':!![]});interaction_log['info'](_0xbeec('0x64'),_0xd08b82['user']['id'],_0xd08b82['user'][_0xbeec('0x36')],_0xd08b82[_0xbeec('0x5e')][_0xbeec('0x65')],_0x4982c0['interaction']['id'],_0xd08b82[_0xbeec('0x54')]?JSON[_0xbeec('0x23')](_0xd08b82[_0xbeec('0x54')]):'null');return respondWithRpcPromise(_0xbeec('0x66'),_0xbeec('0x67'),_0x4982c0);}return null;})[_0xbeec('0x1f')](function(_0xa74d49){var _0x552604=_0xbeec('0x68')+_0xa74d49[_0xbeec('0x26')][_0xbeec('0x69')];return db[_0xbeec('0x6a')][_0xbeec('0x3e')](_0x552604,{'type':db[_0xbeec('0x6b')][_0xbeec('0x6c')][_0xbeec('0x6d')],'raw':!![]})[_0xbeec('0x1f')](function(_0x44abd){return _0x44abd;});})[_0xbeec('0x1f')](function(_0x212477){if(_0x212477){_0x4982c0[_0xbeec('0x26')][_0xbeec('0x6e')]=_0x212477[0x0];if(!_0xd08b82['body'][_0xbeec('0x5d')])return;return db[_0xbeec('0x6f')][_0xbeec('0x52')]({'where':{'id':_0xd08b82[_0xbeec('0x54')]['UserId'],'role':_0xbeec('0x70')},'attributes':['id',_0xbeec('0x36'),'fullname',_0xbeec('0x71'),'internal'],'raw':!![]});}return null;})[_0xbeec('0x1f')](function(_0x10efc1){if(!_0x10efc1)return null;_0x4982c0[_0xbeec('0x26')][_0xbeec('0x70')]=_0x10efc1;return _0x4982c0;})[_0xbeec('0x1f')](function(_0x57977c){if(_0x57977c){if(_0xd08b82[_0xbeec('0x54')]['manual']){_0x4982c0[_0xbeec('0x26')][_0xbeec('0x72')]=util['format']('SIP/%s',_0xd08b82[_0xbeec('0x5e')]['name']);_0x4982c0[_0xbeec('0x26')][_0xbeec('0x73')]=_0x4982c0[_0xbeec('0x73')];_0x4982c0[_0xbeec('0x26')][_0xbeec('0x74')]=_0x4982c0[_0xbeec('0x73')];_0x4982c0[_0xbeec('0x26')]['event']='accept';return respondWithRpcPromise('EventManager',_0xbeec('0x75'),{'event':'acceptmessage','message':_0x4982c0[_0xbeec('0x26')]},client9002)['then'](function(){return _0x4982c0;});}return _0x4982c0;}return null;})[_0xbeec('0x1f')](respondWithResult(_0xc86c89,null))[_0xbeec('0x28')](handleError(_0xc86c89,null));};var interaction_log=require(_0xbeec('0x16'))(_0xbeec('0x57'));exports[_0xbeec('0x31')]=function(_0x9bf6b,_0x524ac2,_0x2ee5d8){var _0x2d5c40={'agent':{},'channel':_0xbeec('0x59')};if(_0x9bf6b[_0xbeec('0x54')]['id']){delete _0x9bf6b['body']['id'];}_0x9bf6b[_0xbeec('0x54')][_0xbeec('0x5d')]=_0x9bf6b[_0xbeec('0x54')]['UserId']||_0x9bf6b[_0xbeec('0x5e')]['id'];_0x2d5c40[_0xbeec('0x70')]['id']=_0x9bf6b[_0xbeec('0x54')][_0xbeec('0x5d')];return db[_0xbeec('0x4b')][_0xbeec('0x52')]({'where':{'id':_0x9bf6b['params']['id'],'UserId':null}})[_0xbeec('0x1f')](handleEntityNotFound(_0x524ac2,null))[_0xbeec('0x1f')](function(_0x1593e9){if(_0x1593e9){_0x2d5c40['message']=_0x1593e9['get']({'plain':!![]});return db['WhatsappInteraction'][_0xbeec('0x52')]({'where':{'id':_0x1593e9[_0xbeec('0x60')]}});}return null;})[_0xbeec('0x1f')](handleEntityNotFound(_0x524ac2,null))[_0xbeec('0x1f')](function(_0x2314e7){if(_0x2314e7){_0x2d5c40[_0xbeec('0x63')]=_0x2314e7[_0xbeec('0x5f')]({'plain':!![]});interaction_log[_0xbeec('0x20')](_0xbeec('0x76'),_0x9bf6b[_0xbeec('0x5e')]['id'],_0x9bf6b[_0xbeec('0x5e')][_0xbeec('0x36')],_0x9bf6b[_0xbeec('0x5e')][_0xbeec('0x65')],_0x2d5c40['interaction']['id'],_0x9bf6b[_0xbeec('0x54')]?JSON[_0xbeec('0x23')](_0x9bf6b['body']):_0xbeec('0x77'));return respondWithRpcPromise(_0xbeec('0x78'),'rejectMessage',_0x2d5c40);}return null;})['then'](function(_0x2ffa74){var _0x47095e=_0xbeec('0x68')+_0x2ffa74['message'][_0xbeec('0x69')];return db[_0xbeec('0x6a')][_0xbeec('0x3e')](_0x47095e,{'type':db[_0xbeec('0x6b')][_0xbeec('0x6c')][_0xbeec('0x6d')],'raw':!![]})[_0xbeec('0x1f')](function(_0x2609c7){return _0x2609c7;});})[_0xbeec('0x1f')](function(_0x142978){if(_0x142978){_0x2d5c40[_0xbeec('0x26')][_0xbeec('0x6e')]=_0x142978[0x0];if(!_0x9bf6b[_0xbeec('0x54')]['UserId'])return;return db['User'][_0xbeec('0x52')]({'where':{'id':_0x9bf6b[_0xbeec('0x54')][_0xbeec('0x5d')],'role':_0xbeec('0x70')},'attributes':['id',_0xbeec('0x36'),_0xbeec('0x79'),'email',_0xbeec('0x7a')],'raw':!![]});}return null;})[_0xbeec('0x1f')](function(_0x3d8053){if(!_0x3d8053)return null;_0x2d5c40['message']['agent']=_0x3d8053;return _0x2d5c40;})[_0xbeec('0x1f')](function(_0x5f2b02){if(_0x5f2b02){_0x5f2b02[_0xbeec('0x26')][_0xbeec('0x72')]=util[_0xbeec('0x5b')]('SIP/%s',_0x9bf6b[_0xbeec('0x5e')][_0xbeec('0x36')]);_0x5f2b02[_0xbeec('0x26')][_0xbeec('0x73')]=_0x2d5c40[_0xbeec('0x73')];_0x5f2b02[_0xbeec('0x26')][_0xbeec('0x74')]=_0x2d5c40[_0xbeec('0x73')];_0x5f2b02['message'][_0xbeec('0x7b')]=_0xbeec('0x31');respondWithRpcPromise(_0xbeec('0x75'),_0xbeec('0x75'),{'event':'rejectmessage','message':_0x5f2b02[_0xbeec('0x26')]},client9002);return _0x2d5c40;}return null;})[_0xbeec('0x1f')](respondWithResult(_0x524ac2,null))[_0xbeec('0x28')](handleError(_0x524ac2,null));};exports[_0xbeec('0x2a')]=function(_0x16d201,_0x4e27ee,_0x224555){if(_0x16d201[_0xbeec('0x54')]['id']){delete _0x16d201[_0xbeec('0x54')]['id'];}var _0x4d2002;return db[_0xbeec('0x4b')][_0xbeec('0x52')]({'where':{'id':_0x16d201[_0xbeec('0x50')]['id']}})[_0xbeec('0x1f')](handleEntityNotFound(_0x4e27ee,null))['then'](function(_0x4627a0){if(_0x4627a0){_0x4d2002=_0x4627a0;return db['WhatsappAccount'][_0xbeec('0x52')]({'where':{'id':_0x4627a0[_0xbeec('0x7c')]}});}})[_0xbeec('0x1f')](handleEntityNotFound(_0x4e27ee,null))[_0xbeec('0x1f')](function(_0x811beb){if(_0x811beb){logger[_0xbeec('0x22')](_0xbeec('0x7d'),_0xbeec('0x2a'),_0xbeec('0x7e'),_0x811beb['type'],util['inspect'](_0x16d201['body'],{'showHidden':![],'depth':null}));switch(_0x811beb['type']){case _0xbeec('0x7f'):if(_0x16d201[_0xbeec('0x54')][_0xbeec('0x80')]&&_0x16d201[_0xbeec('0x54')][_0xbeec('0x80')]===_0x4d2002[_0xbeec('0x81')]&&_0x16d201[_0xbeec('0x54')][_0xbeec('0x82')]&&_0x16d201[_0xbeec('0x54')][_0xbeec('0x82')]===_0xbeec('0x5a')){return _0x4d2002[_0xbeec('0x55')]({'read':!![]});}else{logger[_0xbeec('0x24')](_0xbeec('0x83'),_0xbeec('0x2a'),_0xbeec('0x7f'),util[_0xbeec('0x84')](_0x16d201[_0xbeec('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x4d2002;}})[_0xbeec('0x1f')](respondWithResult(_0x4e27ee,null))[_0xbeec('0x28')](handleError(_0x4e27ee,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 57c7dd8..eebbd04 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 _0xed3c=['WhatsappMessage','setMaxListeners','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x265f15,_0xcbce10){var _0x2145f5=function(_0x2a3824){while(--_0x2a3824){_0x265f15['push'](_0x265f15['shift']());}};_0x2145f5(++_0xcbce10);}(_0xed3c,0x1a6));var _0xced3=function(_0x43e11f,_0x196da0){_0x43e11f=_0x43e11f-0x0;var _0x3c9208=_0xed3c[_0x43e11f];return _0x3c9208;};'use strict';var EventEmitter=require(_0xced3('0x0'));var WhatsappMessage=require(_0xced3('0x1'))['db'][_0xced3('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xced3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xced3('0x4'),'afterDestroy':_0xced3('0x5')};function emitEvent(_0x14488e){return function(_0x5f03e0,_0x51e500,_0x3d3aa0){WhatsappMessageEvents[_0xced3('0x6')](_0x14488e+':'+_0x5f03e0['id'],_0x5f03e0);WhatsappMessageEvents[_0xced3('0x6')](_0x14488e,_0x5f03e0);_0x3d3aa0(null);};}for(var e in events){if(events[_0xced3('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x2f68=['../../mysqldb','WhatsappMessage','setMaxListeners','save','remove','emit','exports'];(function(_0x39e1b2,_0x45d149){var _0x251326=function(_0x1ca5a8){while(--_0x1ca5a8){_0x39e1b2['push'](_0x39e1b2['shift']());}};_0x251326(++_0x45d149);}(_0x2f68,0x9a));var _0x82f6=function(_0x3f5838,_0x77434c){_0x3f5838=_0x3f5838-0x0;var _0x57afa1=_0x2f68[_0x3f5838];return _0x57afa1;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x82f6('0x0'))['db'][_0x82f6('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x82f6('0x2')](0x0);var events={'afterCreate':_0x82f6('0x3'),'afterUpdate':'update','afterDestroy':_0x82f6('0x4')};function emitEvent(_0x488d61){return function(_0x2a06dc,_0x2ab73d,_0x5dad09){WhatsappMessageEvents[_0x82f6('0x5')](_0x488d61+':'+_0x2a06dc['id'],_0x2a06dc);WhatsappMessageEvents[_0x82f6('0x5')](_0x488d61,_0x2a06dc);_0x5dad09(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x82f6('0x6')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index e60a2dd..ba8484f 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 _0x3e9d=['text','POST','application/json','statuses','message_id','catch','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','WhatsappAccountId','type','accountSid','authToken','phone','create','whatsapp:','remote','/api/whatsapp/messages/','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl'];(function(_0x45069b,_0xa96e24){var _0xc78423=function(_0x2bc09d){while(--_0x2bc09d){_0x45069b['push'](_0x45069b['shift']());}};_0xc78423(++_0xa96e24);}(_0x3e9d,0x1ba));var _0xd3e9=function(_0x4d76b3,_0x352bf1){_0x4d76b3=_0x4d76b3-0x0;var _0x50bcf5=_0x3e9d[_0x4d76b3];return _0x50bcf5;};'use strict';var _=require(_0xd3e9('0x0'));var util=require(_0xd3e9('0x1'));var logger=require('../../config/logger')(_0xd3e9('0x2'));var moment=require(_0xd3e9('0x3'));var BPromise=require(_0xd3e9('0x4'));var rp=require(_0xd3e9('0x5'));var fetch=require('node-fetch');var fs=require('fs');var path=require('path');var rimraf=require(_0xd3e9('0x6'));var config=require(_0xd3e9('0x7'));var attributes=require(_0xd3e9('0x8'));module[_0xd3e9('0x9')]=function(_0x568eea,_0x4dc1de){return _0x568eea[_0xd3e9('0xa')](_0xd3e9('0xb'),attributes,{'tableName':_0xd3e9('0xc'),'paranoid':![],'indexes':[{'name':_0xd3e9('0xd'),'fields':[_0xd3e9('0xd')]},{'name':_0xd3e9('0xe'),'fields':[_0xd3e9('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4628c5,_0x177ce2,_0x45bfda){var _0x341c10=_0x568eea[_0xd3e9('0x10')];var _0x17175a=_0x4628c5[_0xd3e9('0x11')]({'plain':!![]});if(_0x17175a[_0xd3e9('0x12')][_0xd3e9('0x13')]()==='in'||_0x17175a[_0xd3e9('0x12')]['toLowerCase']()===_0xd3e9('0x14')&&!_0x17175a['secret']&&!_['isNil'](_0x17175a['UserId'])){_0x341c10[_0xd3e9('0x15')][_0xd3e9('0x16')]({'where':{'id':_0x17175a[_0xd3e9('0x17')]}})[_0xd3e9('0x18')](function(_0x15930c){if(_0x15930c){_0x15930c[_0xd3e9('0x19')]({'lastMsgAt':_0x17175a[_0xd3e9('0x1a')],'lastMsgDirection':_0x17175a[_0xd3e9('0x12')][_0xd3e9('0x13')]()});}})['catch'](function(_0x2ace6c){console['error'](_0x2ace6c);});}if(_0x17175a[_0xd3e9('0x12')]==='out'&&!_0x17175a['secret']){var _0x423c7d;_0x341c10['WhatsappAccount']['find']({'where':{'id':_0x17175a[_0xd3e9('0x1b')]},'raw':!![]})[_0xd3e9('0x18')](function(_0x57985c){_0x423c7d=_0x57985c;if(_0x423c7d&&_0x423c7d[_0xd3e9('0x1c')]){switch(_0x423c7d[_0xd3e9('0x1c')]){case'twilio':var _0x103386=require('twilio');if(_0x423c7d[_0xd3e9('0x1d')]&&_0x423c7d[_0xd3e9('0x1e')]&&_0x423c7d[_0xd3e9('0x1f')]){var _0x5d9d89=new _0x103386(_0x423c7d['accountSid'],_0x423c7d[_0xd3e9('0x1e')]);_0x5d9d89['messages'][_0xd3e9('0x20')]({'body':_0x17175a['body'],'to':_0xd3e9('0x21')+_0x17175a[_0xd3e9('0x1f')],'from':'whatsapp:'+_0x423c7d[_0xd3e9('0x1f')],'statusCallback':_0x423c7d[_0xd3e9('0x22')]+_0xd3e9('0x23')+_0x17175a['id']+'/status?token='+_0x423c7d['token']})['then'](function(_0x4d8901){if(_0x4d8901[_0xd3e9('0x24')]){return _0x4628c5[_0xd3e9('0x19')]({'messageId':_0x4d8901[_0xd3e9('0x24')]});}})['catch'](function(_0x5099d6){logger['error'](_0xd3e9('0x25'),_0xd3e9('0x26'),_0xd3e9('0x27'),util['inspect'](_0x5099d6,{'showHidden':![],'depth':null}));});}else{logger[_0xd3e9('0x28')](_0xd3e9('0x25'),_0xd3e9('0x26'),'twilio',_0xd3e9('0x29'));}break;case _0xd3e9('0x2a'):var _0x405568=_0x423c7d[_0xd3e9('0x1d')];var _0x4550a6=_0x423c7d[_0xd3e9('0x1e')];var _0x452f9c=_0x423c7d[_0xd3e9('0x2b')]+'/whatsapp/v1/'+_0x405568+'/messages/';var _0x4ad840={'to':[_0x17175a[_0xd3e9('0x1f')]],'message':{'type':_0xd3e9('0x2c'),'text':_0x17175a[_0xd3e9('0xf')]}};var _0x5cd05a={'method':_0xd3e9('0x2d'),'uri':_0x452f9c,'headers':{'Authorization':'Bearer\x20'+_0x4550a6,'Content-Type':_0xd3e9('0x2e')},'body':_0x4ad840,'json':!![]};rp(_0x5cd05a)['then'](function(_0x29dbbc){if(_0x29dbbc[_0xd3e9('0x2f')][0x0][_0xd3e9('0x30')]){return _0x4628c5[_0xd3e9('0x19')]({'messageId':_0x29dbbc[_0xd3e9('0x2f')][0x0]['message_id']});}})[_0xd3e9('0x31')](function(_0x56fa3f){logger[_0xd3e9('0x32')](_0xd3e9('0x33'),_0x56fa3f);});break;}}})['finally'](function(){_0x45bfda();});}else{_0x45bfda();}}},'charset':_0xd3e9('0x34'),'collate':_0xd3e9('0x35')});}; \ No newline at end of file +var _0x961d=['Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/messages/','text','body','statuses','message_id','err','finally','lodash','util','moment','request-promise','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','catch','error','WhatsappAccount','WhatsappAccountId','type','twilio','authToken','accountSid','messages','create','whatsapp:','phone','/api/whatsapp/messages/','sid','afterCreate','inspect'];(function(_0x370c2c,_0x1ef5a7){var _0x40fb96=function(_0x3a8d1b){while(--_0x3a8d1b){_0x370c2c['push'](_0x370c2c['shift']());}};_0x40fb96(++_0x1ef5a7);}(_0x961d,0x9c));var _0xd961=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0x961d[_0x2f5a22];return _0x326b70;};'use strict';var _=require(_0xd961('0x0'));var util=require(_0xd961('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd961('0x2'));var BPromise=require('bluebird');var rp=require(_0xd961('0x3'));var fetch=require(_0xd961('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd961('0x5'));var config=require(_0xd961('0x6'));var attributes=require(_0xd961('0x7'));module[_0xd961('0x8')]=function(_0x5af184,_0xe3db7){return _0x5af184[_0xd961('0x9')](_0xd961('0xa'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xd961('0xb'),'fields':['messageId']},{'name':_0xd961('0xc'),'fields':['body'],'type':_0xd961('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ef3a0,_0x5aa587,_0xa749bd){var _0x5e08a2=_0x5af184['models'];var _0x2a73fc=_0x5ef3a0['get']({'plain':!![]});if(_0x2a73fc[_0xd961('0xe')][_0xd961('0xf')]()==='in'||_0x2a73fc[_0xd961('0xe')][_0xd961('0xf')]()===_0xd961('0x10')&&!_0x2a73fc[_0xd961('0x11')]&&!_[_0xd961('0x12')](_0x2a73fc[_0xd961('0x13')])){_0x5e08a2[_0xd961('0x14')]['findOne']({'where':{'id':_0x2a73fc[_0xd961('0x15')]}})[_0xd961('0x16')](function(_0x4dffd7){if(_0x4dffd7){_0x4dffd7[_0xd961('0x17')]({'lastMsgAt':_0x2a73fc['createdAt'],'lastMsgDirection':_0x2a73fc[_0xd961('0xe')][_0xd961('0xf')]()});}})[_0xd961('0x18')](function(_0x4a7e2b){console[_0xd961('0x19')](_0x4a7e2b);});}if(_0x2a73fc[_0xd961('0xe')]==='out'&&!_0x2a73fc[_0xd961('0x11')]){var _0x120740;_0x5e08a2[_0xd961('0x1a')]['find']({'where':{'id':_0x2a73fc[_0xd961('0x1b')]},'raw':!![]})['then'](function(_0x489a1f){_0x120740=_0x489a1f;if(_0x120740&&_0x120740['type']){switch(_0x120740[_0xd961('0x1c')]){case _0xd961('0x1d'):var _0x46f80e=require('twilio');if(_0x120740['accountSid']&&_0x120740[_0xd961('0x1e')]&&_0x120740['phone']){var _0x2a58aa=new _0x46f80e(_0x120740[_0xd961('0x1f')],_0x120740[_0xd961('0x1e')]);_0x2a58aa[_0xd961('0x20')][_0xd961('0x21')]({'body':_0x2a73fc['body'],'to':_0xd961('0x22')+_0x2a73fc[_0xd961('0x23')],'from':_0xd961('0x22')+_0x120740[_0xd961('0x23')],'statusCallback':_0x120740['remote']+_0xd961('0x24')+_0x2a73fc['id']+'/status?token='+_0x120740['token']})['then'](function(_0x2dc29c){if(_0x2dc29c[_0xd961('0x25')]){return _0x5ef3a0[_0xd961('0x17')]({'messageId':_0x2dc29c[_0xd961('0x25')]});}})[_0xd961('0x18')](function(_0x5669ce){logger[_0xd961('0x19')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xd961('0x26'),_0xd961('0x1d'),util[_0xd961('0x27')](_0x5669ce,{'showHidden':![],'depth':null}));});}else{logger[_0xd961('0x19')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xd961('0x26'),_0xd961('0x1d'),_0xd961('0x28'));}break;case'sinch':var _0x1980f4=_0x120740[_0xd961('0x1f')];var _0x28d68c=_0x120740[_0xd961('0x1e')];var _0x51aa12=_0x120740[_0xd961('0x29')]+'/whatsapp/v1/'+_0x1980f4+_0xd961('0x2a');var _0x1fdf62={'to':[_0x2a73fc[_0xd961('0x23')]],'message':{'type':_0xd961('0x2b'),'text':_0x2a73fc[_0xd961('0x2c')]}};var _0x3590ef={'method':'POST','uri':_0x51aa12,'headers':{'Authorization':'Bearer\x20'+_0x28d68c,'Content-Type':'application/json'},'body':_0x1fdf62,'json':!![]};rp(_0x3590ef)[_0xd961('0x16')](function(_0xb39f65){if(_0xb39f65[_0xd961('0x2d')][0x0][_0xd961('0x2e')]){return _0x5ef3a0[_0xd961('0x17')]({'messageId':_0xb39f65[_0xd961('0x2d')][0x0][_0xd961('0x2e')]});}})[_0xd961('0x18')](function(_0x3da8de){logger[_0xd961('0x2f')]('WhatsappMessage,\x20%s',_0x3da8de);});break;}}})[_0xd961('0x30')](function(){_0xa749bd();});}else{_0xa749bd();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index a7e4696..6b7bd50 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 _0x7fb7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','stringify','moment'];(function(_0x22cb5f,_0x2cdd63){var _0x274d36=function(_0x421472){while(--_0x421472){_0x22cb5f['push'](_0x22cb5f['shift']());}};_0x274d36(++_0x2cdd63);}(_0x7fb7,0x1d0));var _0x77fb=function(_0x5b13c3,_0x378e0a){_0x5b13c3=_0x5b13c3-0x0;var _0x3d6780=_0x7fb7[_0x5b13c3];return _0x3d6780;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x77fb('0x0'));var BPromise=require(_0x77fb('0x1'));var rs=require(_0x77fb('0x2'));var fs=require('fs');var Redis=require(_0x77fb('0x3'));var db=require(_0x77fb('0x4'))['db'];var utils=require(_0x77fb('0x5'));var logger=require(_0x77fb('0x6'))(_0x77fb('0x7'));var config=require(_0x77fb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x77fb('0x9')][_0x77fb('0xa')]({'port':0x232a});config[_0x77fb('0xb')]=_['defaults'](config[_0x77fb('0xb')],{'host':_0x77fb('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x77fb('0xb')]));require(_0x77fb('0xd'))[_0x77fb('0xe')](socket);function respondWithRpcPromise(_0x6854b3,_0x113352,_0x1d19c5){return new BPromise(function(_0x479f0a,_0x4609a6){return client[_0x77fb('0xf')](_0x6854b3,_0x1d19c5)[_0x77fb('0x10')](function(_0x3d50be){logger[_0x77fb('0x11')](_0x77fb('0x12'),_0x113352,_0x77fb('0x13'));logger[_0x77fb('0x14')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x113352,'request\x20sent',JSON['stringify'](_0x3d50be));if(_0x3d50be[_0x77fb('0x15')]){if(_0x3d50be[_0x77fb('0x15')]['code']===0x1f4){logger[_0x77fb('0x15')](_0x77fb('0x12'),_0x113352,_0x3d50be[_0x77fb('0x15')][_0x77fb('0x16')]);return _0x4609a6(_0x3d50be[_0x77fb('0x15')][_0x77fb('0x16')]);}logger[_0x77fb('0x15')](_0x77fb('0x12'),_0x113352,_0x3d50be['error'][_0x77fb('0x16')]);return _0x479f0a(_0x3d50be[_0x77fb('0x15')][_0x77fb('0x16')]);}else{logger[_0x77fb('0x11')](_0x77fb('0x12'),_0x113352,_0x77fb('0x13'));_0x479f0a(_0x3d50be[_0x77fb('0x17')][_0x77fb('0x16')]);}})[_0x77fb('0x18')](function(_0x5ed035){logger[_0x77fb('0x15')](_0x77fb('0x12'),_0x113352,_0x5ed035);_0x4609a6(_0x5ed035);});});}exports[_0x77fb('0x19')]=function(_0x58f96d){var _0x5e4dba=this;return new Promise(function(_0x10c5a2,_0x3cb857){return db[_0x77fb('0x1a')]['create'](_0x58f96d[_0x77fb('0x1b')],{'raw':_0x58f96d[_0x77fb('0x1c')]?_0x58f96d[_0x77fb('0x1c')][_0x77fb('0x1d')]===undefined?!![]:![]:!![]})[_0x77fb('0x10')](function(_0x9a758d){logger[_0x77fb('0x11')](_0x77fb('0x19'),_0x58f96d);logger[_0x77fb('0x14')](_0x77fb('0x19'),_0x58f96d,JSON[_0x77fb('0x1e')](_0x9a758d));_0x10c5a2(_0x9a758d);})['catch'](function(_0x3dfea5){logger['error'](_0x77fb('0x19'),_0x3dfea5['message'],_0x58f96d);_0x3cb857(_0x5e4dba[_0x77fb('0x15')](0x1f4,_0x3dfea5['message']));});});}; \ No newline at end of file +var _0xf115=['../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','raw','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x54f8dc,_0x19b2d4){var _0x58cfca=function(_0x413684){while(--_0x413684){_0x54f8dc['push'](_0x54f8dc['shift']());}};_0x58cfca(++_0x19b2d4);}(_0xf115,0xd9));var _0x5f11=function(_0xa61fd1,_0x38e3fb){_0xa61fd1=_0xa61fd1-0x0;var _0x4f87f5=_0xf115[_0xa61fd1];return _0x4f87f5;};'use strict';var _=require(_0x5f11('0x0'));var util=require(_0x5f11('0x1'));var moment=require(_0x5f11('0x2'));var BPromise=require(_0x5f11('0x3'));var rs=require(_0x5f11('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f11('0x5'))['db'];var utils=require(_0x5f11('0x6'));var logger=require(_0x5f11('0x7'))('rpc');var config=require(_0x5f11('0x8'));var jayson=require(_0x5f11('0x9'));var client=jayson['client'][_0x5f11('0xa')]({'port':0x232a});config[_0x5f11('0xb')]=_[_0x5f11('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5f11('0xd'))(new Redis(config[_0x5f11('0xb')]));require(_0x5f11('0xe'))['register'](socket);function respondWithRpcPromise(_0x37492e,_0x23d102,_0x306a20){return new BPromise(function(_0x31e9c0,_0x4587fc){return client[_0x5f11('0xf')](_0x37492e,_0x306a20)[_0x5f11('0x10')](function(_0x16920e){logger[_0x5f11('0x11')](_0x5f11('0x12'),_0x23d102,_0x5f11('0x13'));logger[_0x5f11('0x14')](_0x5f11('0x15'),_0x23d102,_0x5f11('0x13'),JSON['stringify'](_0x16920e));if(_0x16920e[_0x5f11('0x16')]){if(_0x16920e[_0x5f11('0x16')]['code']===0x1f4){logger[_0x5f11('0x16')](_0x5f11('0x12'),_0x23d102,_0x16920e['error'][_0x5f11('0x17')]);return _0x4587fc(_0x16920e[_0x5f11('0x16')][_0x5f11('0x17')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x23d102,_0x16920e[_0x5f11('0x16')][_0x5f11('0x17')]);return _0x31e9c0(_0x16920e[_0x5f11('0x16')][_0x5f11('0x17')]);}else{logger[_0x5f11('0x11')](_0x5f11('0x12'),_0x23d102,_0x5f11('0x13'));_0x31e9c0(_0x16920e[_0x5f11('0x18')]['message']);}})[_0x5f11('0x19')](function(_0xcf3f82){logger['error'](_0x5f11('0x12'),_0x23d102,_0xcf3f82);_0x4587fc(_0xcf3f82);});});}exports[_0x5f11('0x1a')]=function(_0x6f4a39){var _0x3f5b54=this;return new Promise(function(_0x213b1b,_0x4356dc){return db[_0x5f11('0x1b')][_0x5f11('0x1c')](_0x6f4a39[_0x5f11('0x1d')],{'raw':_0x6f4a39['options']?_0x6f4a39['options'][_0x5f11('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x549fd8){logger['info']('CreateWhatsappMessage',_0x6f4a39);logger['debug'](_0x5f11('0x1a'),_0x6f4a39,JSON[_0x5f11('0x1f')](_0x549fd8));_0x213b1b(_0x549fd8);})[_0x5f11('0x19')](function(_0x24c48e){logger[_0x5f11('0x16')]('CreateWhatsappMessage',_0x24c48e[_0x5f11('0x17')],_0x6f4a39);_0x4356dc(_0x3f5b54[_0x5f11('0x16')](0x1f4,_0x24c48e[_0x5f11('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 05c10de..90796fd 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 _0x1a19=['emit','removeListener','register','whatsappMessage:','./whatsappMessage.events','save','remove','update'];(function(_0x304efc,_0x2c6a48){var _0x34e2b9=function(_0x327c24){while(--_0x327c24){_0x304efc['push'](_0x304efc['shift']());}};_0x34e2b9(++_0x2c6a48);}(_0x1a19,0x1b4));var _0x91a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a19[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappMessageEvents=require(_0x91a1('0x0'));var events=[_0x91a1('0x1'),_0x91a1('0x2'),_0x91a1('0x3')];function createListener(_0x516c81,_0x2d340a){return function(_0x5687bd){_0x2d340a[_0x91a1('0x4')](_0x516c81,_0x5687bd);};}function removeListener(_0x2a930a,_0x417952){return function(){WhatsappMessageEvents[_0x91a1('0x5')](_0x2a930a,_0x417952);};}exports[_0x91a1('0x6')]=function(_0x393e20){for(var _0x506ee1=0x0,_0x5d4207=events['length'];_0x506ee1<_0x5d4207;_0x506ee1++){var _0x3001c4=events[_0x506ee1];var _0x1dd555=createListener(_0x91a1('0x7')+_0x3001c4,_0x393e20);WhatsappMessageEvents['on'](_0x3001c4,_0x1dd555);}}; \ No newline at end of file +var _0xc62d=['update','emit','removeListener','register','whatsappMessage:','save','remove'];(function(_0x32662c,_0x2b3566){var _0x3e4157=function(_0xb13c30){while(--_0xb13c30){_0x32662c['push'](_0x32662c['shift']());}};_0x3e4157(++_0x2b3566);}(_0xc62d,0x98));var _0xdc62=function(_0x4602e4,_0x378ee6){_0x4602e4=_0x4602e4-0x0;var _0x425e18=_0xc62d[_0x4602e4];return _0x425e18;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xdc62('0x0'),_0xdc62('0x1'),_0xdc62('0x2')];function createListener(_0x592c81,_0x3dcdec){return function(_0x36f300){_0x3dcdec[_0xdc62('0x3')](_0x592c81,_0x36f300);};}function removeListener(_0x18b53f,_0x301be8){return function(){WhatsappMessageEvents[_0xdc62('0x4')](_0x18b53f,_0x301be8);};}exports[_0xdc62('0x5')]=function(_0x2ce07e){for(var _0x1e7dce=0x0,_0x1dbe6f=events['length'];_0x1e7dce<_0x1dbe6f;_0x1e7dce++){var _0xd3586d=events[_0x1e7dce];var _0x5a535e=createListener(_0xdc62('0x6')+_0xd3586d,_0x2ce07e);WhatsappMessageEvents['on'](_0xd3586d,_0x5a535e);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index e12a83e..4a38203 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 _0xfd59=['../../config/environment','./whatsappQueue.controller','get','index','/describe','describe','isAuthenticated','show','getMembers','getTeams','/:id/users','post','/:id/teams','addAgents','put','/:id','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4d00c2,_0x5e4705){var _0x1e2e28=function(_0x434037){while(--_0x434037){_0x4d00c2['push'](_0x4d00c2['shift']());}};_0x1e2e28(++_0x5e4705);}(_0xfd59,0xa0));var _0x9fd5=function(_0x5c08d2,_0x140571){_0x5c08d2=_0x5c08d2-0x0;var _0x181171=_0xfd59[_0x5c08d2];return _0x181171;};'use strict';var multer=require(_0x9fd5('0x0'));var util=require(_0x9fd5('0x1'));var path=require(_0x9fd5('0x2'));var timeout=require(_0x9fd5('0x3'));var express=require(_0x9fd5('0x4'));var router=express['Router']();var fs_extra=require(_0x9fd5('0x5'));var auth=require(_0x9fd5('0x6'));var interaction=require(_0x9fd5('0x7'));var config=require(_0x9fd5('0x8'));var controller=require(_0x9fd5('0x9'));router[_0x9fd5('0xa')]('/',auth['isAuthenticated'](),controller[_0x9fd5('0xb')]);router[_0x9fd5('0xa')](_0x9fd5('0xc'),auth['isAuthenticated'](),controller[_0x9fd5('0xd')]);router[_0x9fd5('0xa')]('/:id',auth[_0x9fd5('0xe')](),controller[_0x9fd5('0xf')]);router[_0x9fd5('0xa')]('/:id/members',auth['isAuthenticated'](),controller[_0x9fd5('0x10')]);router[_0x9fd5('0xa')]('/:id/teams',auth[_0x9fd5('0xe')](),controller[_0x9fd5('0x11')]);router['get'](_0x9fd5('0x12'),auth[_0x9fd5('0xe')](),controller['getAgents']);router[_0x9fd5('0x13')]('/',auth[_0x9fd5('0xe')](),controller['create']);router[_0x9fd5('0x13')](_0x9fd5('0x14'),auth[_0x9fd5('0xe')](),controller['addTeams']);router[_0x9fd5('0x13')](_0x9fd5('0x12'),auth[_0x9fd5('0xe')](),controller[_0x9fd5('0x15')]);router[_0x9fd5('0x16')](_0x9fd5('0x17'),auth['isAuthenticated'](),controller[_0x9fd5('0x18')]);router[_0x9fd5('0x19')](_0x9fd5('0x17'),auth[_0x9fd5('0xe')](),controller['destroy']);router[_0x9fd5('0x19')](_0x9fd5('0x14'),auth[_0x9fd5('0xe')](),controller[_0x9fd5('0x1a')]);router[_0x9fd5('0x19')](_0x9fd5('0x12'),auth[_0x9fd5('0xe')](),controller[_0x9fd5('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x1779=['getAgents','addTeams','addAgents','put','update','destroy','removeTeams','delete','removeAgents','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users'];(function(_0x20073b,_0x9c031e){var _0x428d14=function(_0x1c6d8b){while(--_0x1c6d8b){_0x20073b['push'](_0x20073b['shift']());}};_0x428d14(++_0x9c031e);}(_0x1779,0x1f0));var _0x9177=function(_0x2ec2cb,_0x16c8bb){_0x2ec2cb=_0x2ec2cb-0x0;var _0x30b5f5=_0x1779[_0x2ec2cb];return _0x30b5f5;};'use strict';var multer=require(_0x9177('0x0'));var util=require(_0x9177('0x1'));var path=require(_0x9177('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9177('0x3'));var interaction=require(_0x9177('0x4'));var config=require(_0x9177('0x5'));var controller=require(_0x9177('0x6'));router['get']('/',auth[_0x9177('0x7')](),controller[_0x9177('0x8')]);router[_0x9177('0x9')](_0x9177('0xa'),auth[_0x9177('0x7')](),controller['describe']);router[_0x9177('0x9')](_0x9177('0xb'),auth[_0x9177('0x7')](),controller[_0x9177('0xc')]);router[_0x9177('0x9')](_0x9177('0xd'),auth[_0x9177('0x7')](),controller[_0x9177('0xe')]);router[_0x9177('0x9')](_0x9177('0xf'),auth[_0x9177('0x7')](),controller['getTeams']);router['get'](_0x9177('0x10'),auth['isAuthenticated'](),controller[_0x9177('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x9177('0xf'),auth[_0x9177('0x7')](),controller[_0x9177('0x12')]);router['post'](_0x9177('0x10'),auth[_0x9177('0x7')](),controller[_0x9177('0x13')]);router[_0x9177('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x9177('0x15')]);router['delete'](_0x9177('0xb'),auth['isAuthenticated'](),controller[_0x9177('0x16')]);router['delete'](_0x9177('0xf'),auth[_0x9177('0x7')](),controller[_0x9177('0x17')]);router[_0x9177('0x18')](_0x9177('0x10'),auth[_0x9177('0x7')](),controller[_0x9177('0x19')]);module[_0x9177('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index cad8aa0..61b6a67 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 _0x4de7=['rrmemory','roundrobin','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x2f6cc7,_0x31b6a3){var _0x5323a7=function(_0x2d019f){while(--_0x2d019f){_0x2f6cc7['push'](_0x2f6cc7['shift']());}};_0x5323a7(++_0x31b6a3);}(_0x4de7,0x1f3));var _0x74de=function(_0x5a641e,_0x3dd1c5){_0x5a641e=_0x5a641e-0x0;var _0x2fcdcb=_0x4de7[_0x5a641e];return _0x2fcdcb;};'use strict';var Sequelize=require(_0x74de('0x0'));module['exports']={'name':{'type':Sequelize[_0x74de('0x1')],'unique':_0x74de('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x74de('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x74de('0x4')](_0x74de('0x5'),'beepall',_0x74de('0x6'))},'description':{'type':Sequelize[_0x74de('0x1')]}}; \ No newline at end of file +var _0x22dd=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x570f65,_0x9ca295){var _0x2570cf=function(_0x4bd1e8){while(--_0x4bd1e8){_0x570f65['push'](_0x570f65['shift']());}};_0x2570cf(++_0x9ca295);}(_0x22dd,0xe4));var _0xd22d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x22dd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd22d('0x0'));module[_0xd22d('0x1')]={'name':{'type':Sequelize[_0xd22d('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd22d('0x3')](_0xd22d('0x4'),_0xd22d('0x5'),_0xd22d('0x6'))},'description':{'type':Sequelize[_0xd22d('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index cf833af..d554ad9 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 _0xb9b5=['WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','union','compact','value','isEmpty','removeAgents','forEach','emit','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','then','destroy','get','WhatsappQueues','UserProfileResource','end','error','name','send','map','WhatsappQueue','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','create','body','user','role','userProfileId','autoAssociation','update','find','params','describe','getMembers','findOne','UserWhatsappQueue','order','pick','User','findAndCountAll','UserId','whatsappPause','updatedAt','createdAt','%s/%s','SIP','getTeams','ids','Team','findAll','online','voicePause','flatMap','sequelize','transaction','addTeams','each','findOrCreate','removeTeams','Agents','select','field','user_has_teams','ut.TeamId\x20=\x20tq.TeamId'];(function(_0x8821a8,_0x4be205){var _0x1e443c=function(_0x4bc91e){while(--_0x4bc91e){_0x8821a8['push'](_0x8821a8['shift']());}};_0x1e443c(++_0x4be205);}(_0xb9b5,0x1b1));var _0x5b9b=function(_0x91ec40,_0xa1ec3b){_0x91ec40=_0x91ec40-0x0;var _0x428c7a=_0xb9b5[_0x91ec40];return _0x428c7a;};'use strict';var emlformat=require(_0x5b9b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5b9b('0x1'));var jsonpatch=require(_0x5b9b('0x2'));var rp=require(_0x5b9b('0x3'));var moment=require(_0x5b9b('0x4'));var BPromise=require(_0x5b9b('0x5'));var Mustache=require('mustache');var util=require(_0x5b9b('0x6'));var path=require('path');var sox=require(_0x5b9b('0x7'));var csv=require('to-csv');var ejs=require(_0x5b9b('0x8'));var fs=require('fs');var fs_extra=require(_0x5b9b('0x9'));var _=require(_0x5b9b('0xa'));var squel=require(_0x5b9b('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5b9b('0xc'));var toCsv=require(_0x5b9b('0xd'));var querystring=require(_0x5b9b('0xe'));var Papa=require(_0x5b9b('0xf'));var Redis=require(_0x5b9b('0x10'));var authService=require(_0x5b9b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5b9b('0x12'));var hardwareService=require(_0x5b9b('0x13'));var logger=require(_0x5b9b('0x14'))(_0x5b9b('0x15'));var utils=require('../../config/utils');var config=require(_0x5b9b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5b9b('0x17'))['db'];config[_0x5b9b('0x18')]=_[_0x5b9b('0x19')](config[_0x5b9b('0x18')],{'host':_0x5b9b('0x1a'),'port':0x18eb});var socket=require(_0x5b9b('0x1b'))(new Redis(config['redis']));require(_0x5b9b('0x1c'))[_0x5b9b('0x1d')](socket);function respondWithStatusCode(_0x4edef8,_0x59bc9e){_0x59bc9e=_0x59bc9e||0xcc;return function(_0x5ec8ff){if(_0x5ec8ff){return _0x4edef8[_0x5b9b('0x1e')](_0x59bc9e);}return _0x4edef8[_0x5b9b('0x1f')](_0x59bc9e)['end']();};}function respondWithResult(_0x34023b,_0x3bee27){_0x3bee27=_0x3bee27||0xc8;return function(_0x5ac521){if(_0x5ac521){return _0x34023b[_0x5b9b('0x1f')](_0x3bee27)[_0x5b9b('0x20')](_0x5ac521);}};}function respondWithFilteredResult(_0x1d5de0,_0x4890c9){return function(_0x10efe1){if(_0x10efe1){var _0x5e58c7=typeof _0x4890c9[_0x5b9b('0x21')]===_0x5b9b('0x22')&&typeof _0x4890c9['limit']===_0x5b9b('0x22');var _0x8774a7=_0x10efe1[_0x5b9b('0x23')];var _0x4ea948=_0x5e58c7?0x0:_0x4890c9[_0x5b9b('0x21')];var _0x422f34=_0x5e58c7?_0x10efe1[_0x5b9b('0x23')]:_0x4890c9[_0x5b9b('0x21')]+_0x4890c9[_0x5b9b('0x24')];var _0x4fcdfd;if(_0x422f34>=_0x8774a7){_0x422f34=_0x8774a7;_0x4fcdfd=0xc8;}else{_0x4fcdfd=0xce;}_0x1d5de0[_0x5b9b('0x1f')](_0x4fcdfd);return _0x1d5de0[_0x5b9b('0x25')]('Content-Range',_0x4ea948+'-'+_0x422f34+'/'+_0x8774a7)[_0x5b9b('0x20')](_0x10efe1);}return null;};}function patchUpdates(_0x4973d5){return function(_0x5fecac){try{jsonpatch[_0x5b9b('0x26')](_0x5fecac,_0x4973d5,!![]);}catch(_0x495c5f){return BPromise['reject'](_0x495c5f);}return _0x5fecac[_0x5b9b('0x27')]();};}function saveUpdates(_0xb6c897,_0x147806){return function(_0x223119){if(_0x223119){return _0x223119['update'](_0xb6c897)[_0x5b9b('0x28')](function(_0x451663){return _0x451663;});}return null;};}function removeEntity(_0x9f6444,_0x370f9e){return function(_0x3868ee){if(_0x3868ee){return _0x3868ee[_0x5b9b('0x29')]()[_0x5b9b('0x28')](function(){var _0x252da7=_0x3868ee[_0x5b9b('0x2a')]({'plain':!![]});var _0x255432=_0x5b9b('0x2b');return db[_0x5b9b('0x2c')][_0x5b9b('0x29')]({'where':{'type':_0x255432,'resourceId':_0x252da7['id']}})[_0x5b9b('0x28')](function(){return _0x3868ee;});})['then'](function(){_0x9f6444[_0x5b9b('0x1f')](0xcc)[_0x5b9b('0x2d')]();});}};}function handleEntityNotFound(_0x1aef80,_0x3e0f0f){return function(_0xeec8c0){if(!_0xeec8c0){_0x1aef80[_0x5b9b('0x1e')](0x194);}return _0xeec8c0;};}function handleError(_0x5738dc,_0x190684){_0x190684=_0x190684||0x1f4;return function(_0x5ce825){logger[_0x5b9b('0x2e')](_0x5ce825['stack']);if(_0x5ce825[_0x5b9b('0x2f')]){delete _0x5ce825[_0x5b9b('0x2f')];}_0x5738dc[_0x5b9b('0x1f')](_0x190684)[_0x5b9b('0x30')](_0x5ce825);};}exports['index']=function(_0xcddc2f,_0x460bdd){var _0x10a4cf={},_0x50f659={},_0x54b428={'count':0x0,'rows':[]};var _0x1aac4e=_[_0x5b9b('0x31')](db[_0x5b9b('0x32')][_0x5b9b('0x33')],function(_0x3438b7){return{'name':_0x3438b7['fieldName'],'type':_0x3438b7[_0x5b9b('0x34')]['key']};});_0x50f659[_0x5b9b('0x35')]=_[_0x5b9b('0x31')](_0x1aac4e,_0x5b9b('0x2f'));_0x50f659[_0x5b9b('0x36')]=_[_0x5b9b('0x37')](_0xcddc2f[_0x5b9b('0x36')]);_0x50f659[_0x5b9b('0x38')]=_[_0x5b9b('0x39')](_0x50f659['model'],_0x50f659[_0x5b9b('0x36')]);_0x10a4cf[_0x5b9b('0x3a')]=_[_0x5b9b('0x39')](_0x50f659[_0x5b9b('0x35')],qs[_0x5b9b('0x3b')](_0xcddc2f[_0x5b9b('0x36')][_0x5b9b('0x3b')]));_0x10a4cf[_0x5b9b('0x3a')]=_0x10a4cf[_0x5b9b('0x3a')][_0x5b9b('0x3c')]?_0x10a4cf['attributes']:_0x50f659[_0x5b9b('0x35')];if(!_0xcddc2f[_0x5b9b('0x36')][_0x5b9b('0x3d')](_0x5b9b('0x3e'))){_0x10a4cf['limit']=qs[_0x5b9b('0x24')](_0xcddc2f[_0x5b9b('0x36')][_0x5b9b('0x24')]);_0x10a4cf[_0x5b9b('0x21')]=qs[_0x5b9b('0x21')](_0xcddc2f[_0x5b9b('0x36')][_0x5b9b('0x21')]);}_0x10a4cf['order']=qs[_0x5b9b('0x3f')](_0xcddc2f[_0x5b9b('0x36')][_0x5b9b('0x3f')]);_0x10a4cf[_0x5b9b('0x40')]=qs[_0x5b9b('0x38')](_['pick'](_0xcddc2f[_0x5b9b('0x36')],_0x50f659[_0x5b9b('0x38')]),_0x1aac4e);if(_0xcddc2f[_0x5b9b('0x36')][_0x5b9b('0x41')]){_0x10a4cf[_0x5b9b('0x40')]=_[_0x5b9b('0x42')](_0x10a4cf['where'],{'$or':_[_0x5b9b('0x31')](_0x1aac4e,function(_0xee4756){if(_0xee4756['type']!==_0x5b9b('0x43')){var _0x2f02f9={};_0x2f02f9[_0xee4756[_0x5b9b('0x2f')]]={'$like':'%'+_0xcddc2f[_0x5b9b('0x36')][_0x5b9b('0x41')]+'%'};return _0x2f02f9;}})});}_0x10a4cf=_[_0x5b9b('0x42')]({},_0x10a4cf,_0xcddc2f[_0x5b9b('0x44')]);var _0x276d1b={'where':_0x10a4cf['where']};return db[_0x5b9b('0x32')][_0x5b9b('0x23')](_0x276d1b)[_0x5b9b('0x28')](function(_0x16a4ac){_0x54b428['count']=_0x16a4ac;if(_0xcddc2f['query'][_0x5b9b('0x45')]){_0x10a4cf[_0x5b9b('0x46')]=[{'all':!![]}];}return db[_0x5b9b('0x32')]['findAll'](_0x10a4cf);})[_0x5b9b('0x28')](function(_0x2cb853){_0x54b428[_0x5b9b('0x47')]=_0x2cb853;return _0x54b428;})[_0x5b9b('0x28')](respondWithFilteredResult(_0x460bdd,_0x10a4cf))[_0x5b9b('0x48')](handleError(_0x460bdd,null));};exports[_0x5b9b('0x49')]=function(_0x91b2ec,_0x5a1a7e){var _0x348c1d={'raw':!![],'where':{'id':_0x91b2ec['params']['id']}},_0x58413e={};_0x58413e[_0x5b9b('0x35')]=_[_0x5b9b('0x37')](db['WhatsappQueue'][_0x5b9b('0x33')]);_0x58413e['query']=_[_0x5b9b('0x37')](_0x91b2ec['query']);_0x58413e['filters']=_['intersection'](_0x58413e[_0x5b9b('0x35')],_0x58413e[_0x5b9b('0x36')]);_0x348c1d[_0x5b9b('0x3a')]=_[_0x5b9b('0x39')](_0x58413e[_0x5b9b('0x35')],qs['fields'](_0x91b2ec['query']['fields']));_0x348c1d[_0x5b9b('0x3a')]=_0x348c1d['attributes'][_0x5b9b('0x3c')]?_0x348c1d[_0x5b9b('0x3a')]:_0x58413e[_0x5b9b('0x35')];if(_0x91b2ec[_0x5b9b('0x36')][_0x5b9b('0x45')]){_0x348c1d[_0x5b9b('0x46')]=[{'all':!![]}];}_0x348c1d=_[_0x5b9b('0x42')]({},_0x348c1d,_0x91b2ec[_0x5b9b('0x44')]);return db[_0x5b9b('0x32')]['find'](_0x348c1d)[_0x5b9b('0x28')](handleEntityNotFound(_0x5a1a7e,null))[_0x5b9b('0x28')](respondWithResult(_0x5a1a7e,null))['catch'](handleError(_0x5a1a7e,null));};exports[_0x5b9b('0x4a')]=function(_0xae5c0e,_0xa91be5){return db[_0x5b9b('0x32')][_0x5b9b('0x4a')](_0xae5c0e[_0x5b9b('0x4b')],{})[_0x5b9b('0x28')](function(_0x2da75e){var _0x23d868=_0xae5c0e[_0x5b9b('0x4c')][_0x5b9b('0x2a')]({'plain':!![]});if(!_0x23d868)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23d868[_0x5b9b('0x4d')]===_0x5b9b('0x4c')){var _0x27778c=_0x2da75e[_0x5b9b('0x2a')]({'plain':!![]});var _0x4495f4='WhatsappQueues';return db['UserProfileSection']['find']({'where':{'name':_0x4495f4,'userProfileId':_0x23d868[_0x5b9b('0x4e')]},'raw':!![]})[_0x5b9b('0x28')](function(_0x18bff7){if(_0x18bff7&&_0x18bff7[_0x5b9b('0x4f')]===0x0){return db[_0x5b9b('0x2c')][_0x5b9b('0x4a')]({'name':_0x27778c[_0x5b9b('0x2f')],'resourceId':_0x27778c['id'],'type':_0x18bff7['name'],'sectionId':_0x18bff7['id']},{})[_0x5b9b('0x28')](function(){return _0x2da75e;});}else{return _0x2da75e;}})[_0x5b9b('0x48')](function(_0x419ecd){logger[_0x5b9b('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x419ecd);throw _0x419ecd;});}return _0x2da75e;})[_0x5b9b('0x28')](respondWithResult(_0xa91be5,0xc9))[_0x5b9b('0x48')](handleError(_0xa91be5,null));};exports[_0x5b9b('0x50')]=function(_0x4ef7d9,_0xeb65e3){if(_0x4ef7d9[_0x5b9b('0x4b')]['id']){delete _0x4ef7d9[_0x5b9b('0x4b')]['id'];}return db['WhatsappQueue'][_0x5b9b('0x51')]({'where':{'id':_0x4ef7d9[_0x5b9b('0x52')]['id']}})['then'](handleEntityNotFound(_0xeb65e3,null))['then'](saveUpdates(_0x4ef7d9[_0x5b9b('0x4b')],null))[_0x5b9b('0x28')](respondWithResult(_0xeb65e3,null))[_0x5b9b('0x48')](handleError(_0xeb65e3,null));};exports[_0x5b9b('0x29')]=function(_0x28750d,_0x5496e9){return db[_0x5b9b('0x32')][_0x5b9b('0x51')]({'where':{'id':_0x28750d['params']['id']}})['then'](handleEntityNotFound(_0x5496e9,null))[_0x5b9b('0x28')](removeEntity(_0x5496e9,null))['catch'](handleError(_0x5496e9,null));};exports[_0x5b9b('0x53')]=function(_0x1c0993,_0x230317){return db[_0x5b9b('0x32')][_0x5b9b('0x53')]()[_0x5b9b('0x28')](respondWithResult(_0x230317,null))[_0x5b9b('0x48')](handleError(_0x230317,null));};exports[_0x5b9b('0x54')]=function(_0x2da096,_0x50c62a,_0x44cd1a){var _0x575caa={'raw':!![],'where':{}},_0x14c270={},_0x56e032;return db[_0x5b9b('0x32')][_0x5b9b('0x55')]({'where':{'id':_0x2da096[_0x5b9b('0x52')]['id']}})['then'](handleEntityNotFound(_0x50c62a,null))[_0x5b9b('0x28')](function(_0x1cb1c9){if(_0x1cb1c9){_0x56e032=_0x1cb1c9[_0x5b9b('0x2a')]({'plain':!![]});_0x14c270[_0x5b9b('0x35')]=_[_0x5b9b('0x37')](db[_0x5b9b('0x56')][_0x5b9b('0x33')]);_0x14c270['query']=_['keys'](_0x2da096[_0x5b9b('0x36')]);_0x14c270[_0x5b9b('0x38')]=_['intersection'](_0x14c270[_0x5b9b('0x35')],_0x14c270[_0x5b9b('0x36')]);_0x575caa[_0x5b9b('0x3a')]=_[_0x5b9b('0x39')](_0x14c270[_0x5b9b('0x35')],qs[_0x5b9b('0x3b')](_0x2da096[_0x5b9b('0x36')][_0x5b9b('0x3b')]));_0x575caa[_0x5b9b('0x3a')]=_0x575caa[_0x5b9b('0x3a')][_0x5b9b('0x3c')]?_0x575caa['attributes']:_0x14c270[_0x5b9b('0x35')];if(!_0x2da096['query'][_0x5b9b('0x3d')]('nolimit')){_0x575caa[_0x5b9b('0x24')]=qs['limit'](_0x2da096[_0x5b9b('0x36')][_0x5b9b('0x24')]);_0x575caa[_0x5b9b('0x21')]=qs[_0x5b9b('0x21')](_0x2da096[_0x5b9b('0x36')][_0x5b9b('0x21')]);}_0x575caa[_0x5b9b('0x57')]=qs['sort'](_0x2da096[_0x5b9b('0x36')][_0x5b9b('0x3f')]);_0x575caa[_0x5b9b('0x40')]=qs['filters'](_[_0x5b9b('0x58')](_0x2da096[_0x5b9b('0x36')],_0x14c270[_0x5b9b('0x38')]));_0x575caa[_0x5b9b('0x40')]['WhatsappQueueId']=_0x1cb1c9['id'];if(_0x2da096[_0x5b9b('0x36')][_0x5b9b('0x41')]){_0x575caa[_0x5b9b('0x40')]=_['merge'](_0x575caa[_0x5b9b('0x40')],{'$or':_[_0x5b9b('0x31')](_0x575caa[_0x5b9b('0x3a')],function(_0x61450c){var _0x3b513e={};_0x3b513e[_0x61450c]={'$like':'%'+_0x2da096[_0x5b9b('0x36')][_0x5b9b('0x41')]+'%'};return _0x3b513e;})});}_0x575caa=_['merge']({},_0x575caa,_0x2da096['options']);return db[_0x5b9b('0x56')]['findAll'](_0x575caa);}})[_0x5b9b('0x28')](function(_0x18580e){if(_0x18580e){return db[_0x5b9b('0x59')][_0x5b9b('0x5a')]({'where':{'id':_[_0x5b9b('0x31')](_0x18580e,_0x5b9b('0x5b')),'role':'agent'},'attributes':['id','name',_0x5b9b('0x5c'),_0x5b9b('0x5d'),_0x5b9b('0x5e')]});}})[_0x5b9b('0x28')](function(_0x547ef5){if(_0x547ef5){return{'count':_0x547ef5[_0x5b9b('0x23')],'rows':_['map'](_0x547ef5['rows'],function(_0x4c093a){return{'membername':_0x4c093a[_0x5b9b('0x2f')],'UserId':_0x4c093a['id'],'queue_name':_0x56e032[_0x5b9b('0x2f')],'WhatsappQueueId':_0x56e032['id'],'interface':util['format'](_0x5b9b('0x5f'),_0x5b9b('0x60'),_0x4c093a[_0x5b9b('0x2f')]),'penalty':0x0,'paused':_0x4c093a[_0x5b9b('0x5c')],'createdAt':_0x4c093a['createdAt'],'updatedAt':_0x4c093a[_0x5b9b('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5b9b('0x28')](respondWithFilteredResult(_0x50c62a,_0x575caa))['catch'](handleError(_0x50c62a,null));};exports[_0x5b9b('0x61')]=function(_0x45a79d,_0x39c825,_0x347273){var _0x13d0a3={};var _0x1f8365={};var _0x35ab63;var _0x2b1725;return db[_0x5b9b('0x32')][_0x5b9b('0x55')]({'where':{'id':_0x45a79d[_0x5b9b('0x52')]['id']}})['then'](handleEntityNotFound(_0x39c825,null))[_0x5b9b('0x28')](function(_0x40dfe4){if(_0x40dfe4){_0x35ab63=_0x40dfe4;_0x1f8365[_0x5b9b('0x35')]=_[_0x5b9b('0x37')](db['Team'][_0x5b9b('0x33')]);_0x1f8365['query']=_['keys'](_0x45a79d[_0x5b9b('0x36')]);_0x1f8365[_0x5b9b('0x38')]=_['intersection'](_0x1f8365['model'],_0x1f8365[_0x5b9b('0x36')]);_0x13d0a3[_0x5b9b('0x3a')]=_[_0x5b9b('0x39')](_0x1f8365[_0x5b9b('0x35')],qs['fields'](_0x45a79d[_0x5b9b('0x36')][_0x5b9b('0x3b')]));_0x13d0a3[_0x5b9b('0x3a')]=_0x13d0a3[_0x5b9b('0x3a')][_0x5b9b('0x3c')]?_0x13d0a3['attributes']:_0x1f8365['model'];_0x13d0a3[_0x5b9b('0x57')]=qs[_0x5b9b('0x3f')](_0x45a79d['query'][_0x5b9b('0x3f')]);_0x13d0a3[_0x5b9b('0x40')]=qs[_0x5b9b('0x38')](_['pick'](_0x45a79d['query'],_0x1f8365[_0x5b9b('0x38')]));if(_0x45a79d[_0x5b9b('0x36')][_0x5b9b('0x41')]){_0x13d0a3[_0x5b9b('0x40')]=_['merge'](_0x13d0a3[_0x5b9b('0x40')],{'$or':_[_0x5b9b('0x31')](_0x13d0a3[_0x5b9b('0x3a')],function(_0x41e0d3){var _0x1de4fd={};_0x1de4fd[_0x41e0d3]={'$like':'%'+_0x45a79d['query'][_0x5b9b('0x41')]+'%'};return _0x1de4fd;})});}_0x13d0a3=_[_0x5b9b('0x42')]({},_0x13d0a3,_0x45a79d[_0x5b9b('0x44')]);return _0x35ab63[_0x5b9b('0x61')](_0x13d0a3);}})[_0x5b9b('0x28')](function(_0x5c6a7b){if(_0x5c6a7b){_0x2b1725=_0x5c6a7b[_0x5b9b('0x3c')];if(!_0x45a79d['query'][_0x5b9b('0x3d')]('nolimit')){_0x13d0a3[_0x5b9b('0x24')]=qs[_0x5b9b('0x24')](_0x45a79d['query'][_0x5b9b('0x24')]);_0x13d0a3[_0x5b9b('0x21')]=qs[_0x5b9b('0x21')](_0x45a79d[_0x5b9b('0x36')]['offset']);}return _0x35ab63[_0x5b9b('0x61')](_0x13d0a3);}})[_0x5b9b('0x28')](function(_0x49615c){if(_0x49615c){return _0x49615c?{'count':_0x2b1725,'rows':_0x49615c}:null;}})[_0x5b9b('0x28')](respondWithResult(_0x39c825,null))[_0x5b9b('0x48')](handleError(_0x39c825,null));};exports['addTeams']=function(_0x106028,_0x14aea2,_0x1d38ab){var _0xaf8a5a=_0x106028[_0x5b9b('0x4b')][_0x5b9b('0x62')];return db[_0x5b9b('0x63')][_0x5b9b('0x64')]({'where':{'id':_0xaf8a5a},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x5b9b('0x2f'),_0x5b9b('0x65'),_0x5b9b('0x66'),'interface'],'raw':!![]}]})[_0x5b9b('0x28')](function(_0x10a542){if(_0x10a542){var _0x12a47e=_[_0x5b9b('0x67')](_0x10a542,function(_0x1a6fd4){var _0x46982f=_0x1a6fd4['get']({'plain':!![]});return _0x46982f['Agents'];});return db[_0x5b9b('0x32')][_0x5b9b('0x51')]({'where':{'id':_0x106028[_0x5b9b('0x52')]['id']}})['then'](function(_0x17ee39){return db[_0x5b9b('0x68')][_0x5b9b('0x69')](function(_0x2fdbe2){return _0x17ee39[_0x5b9b('0x6a')](_0xaf8a5a,{'transaction':_0x2fdbe2})[_0x5b9b('0x28')](function(){return BPromise[_0x5b9b('0x6b')](_0x12a47e,function(_0x4e6b73){return db['UserWhatsappQueue'][_0x5b9b('0x6c')]({'where':{'UserId':_0x4e6b73['id'],'WhatsappQueueId':_0x106028[_0x5b9b('0x52')]['id']},'transaction':_0x2fdbe2});});})[_0x5b9b('0x28')](function(){_0x12a47e['forEach'](function(_0x47c388){socket['emit']('userWhatsappQueue:save',{'UserId':_0x47c388['id'],'WhatsappQueueId':_0x17ee39['id']});});});});});}})[_0x5b9b('0x28')](respondWithStatusCode(_0x14aea2,null))['catch'](handleError(_0x14aea2,null));};exports[_0x5b9b('0x6d')]=function(_0x41c117,_0x12d5bf,_0x25eca4){return db[_0x5b9b('0x63')][_0x5b9b('0x64')]({'where':{'id':_0x41c117[_0x5b9b('0x36')][_0x5b9b('0x62')]},'attributes':['id'],'include':[{'model':db[_0x5b9b('0x59')],'as':_0x5b9b('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x5b9b('0x28')](handleEntityNotFound(_0x12d5bf,null))[_0x5b9b('0x28')](function(_0x46e2fe){var _0x506241=_[_0x5b9b('0x31')](_0x46e2fe,'id');var _0x25e62e=[];var _0x4468e3=[];var _0x2ee4e5=squel[_0x5b9b('0x6f')]();_0x2ee4e5[_0x5b9b('0x70')]('tq.TeamId')['from']('team_has_whatsapp_queues','tq')['join'](_0x5b9b('0x71'),'ut',_0x5b9b('0x72'))[_0x5b9b('0x40')](_0x5b9b('0x73'),_0x41c117[_0x5b9b('0x52')]['id']);for(var _0x2cc782=0x0;_0x2cc782<_0x46e2fe[_0x5b9b('0x3c')];_0x2cc782+=0x1){let _0x4eb68d=_0x46e2fe[_0x2cc782];for(var _0x249d31=0x0;_0x249d31<_0x4eb68d[_0x5b9b('0x6e')][_0x5b9b('0x3c')];_0x249d31+=0x1){let _0x8086c0=_0x4eb68d[_0x5b9b('0x6e')][_0x249d31];var _0xd3a43e=_0x2ee4e5[_0x5b9b('0x74')]();_0xd3a43e[_0x5b9b('0x40')](_0x5b9b('0x75'),_0x8086c0['id']);_0x4468e3[_0x5b9b('0x76')](db[_0x5b9b('0x68')][_0x5b9b('0x36')](_0xd3a43e[_0x5b9b('0x77')](),{'type':db[_0x5b9b('0x68')][_0x5b9b('0x78')][_0x5b9b('0x79')]})[_0x5b9b('0x28')](function(_0x3b1d5c){if(_0x3b1d5c[_0x5b9b('0x3c')]===0x1){return _0x8086c0['id'];}else{var _0x5dc190=_[_0x5b9b('0x7a')](_['map'](_0x3b1d5c,'TeamId'),function(_0x2e78c9){return _['includes'](_0x506241,_0x2e78c9);});if(_0x5dc190){return _0x8086c0['id'];}}}));}}return BPromise[_0x5b9b('0x7b')](_0x4468e3)['then'](function(_0x2b17e6){_0x25e62e=_(_0x25e62e)[_0x5b9b('0x7c')](_0x2b17e6)[_0x5b9b('0x7d')]()[_0x5b9b('0x7e')]();return db[_0x5b9b('0x32')][_0x5b9b('0x51')]({'where':{'id':_0x41c117['params']['id']}})['then'](function(_0x45b0f2){return db[_0x5b9b('0x68')][_0x5b9b('0x69')](function(_0x49ac1d){return _0x45b0f2[_0x5b9b('0x6d')](_0x41c117[_0x5b9b('0x36')][_0x5b9b('0x62')],{'transaction':_0x49ac1d})['then'](function(){if(!_[_0x5b9b('0x7f')](_0x25e62e)){return _0x45b0f2[_0x5b9b('0x80')](_0x25e62e,{'transaction':_0x49ac1d});}})['then'](function(){_0x25e62e[_0x5b9b('0x81')](function(_0x467cb3){socket[_0x5b9b('0x82')](_0x5b9b('0x83'),{'UserId':_0x467cb3,'WhatsappQueueId':_0x45b0f2['id']});});});});});});})[_0x5b9b('0x28')](respondWithStatusCode(_0x12d5bf,null))['catch'](handleError(_0x12d5bf,null));};exports[_0x5b9b('0x84')]=function(_0x16362e,_0x490937,_0x4d097d){return db['WhatsappQueue'][_0x5b9b('0x51')]({'where':{'id':_0x16362e[_0x5b9b('0x52')]['id']}})[_0x5b9b('0x28')](handleEntityNotFound(_0x490937,null))[_0x5b9b('0x28')](function(_0x2f03d3){if(_0x2f03d3){return _0x2f03d3['addAgents'](_0x16362e[_0x5b9b('0x4b')][_0x5b9b('0x62')],_[_0x5b9b('0x85')](_0x16362e[_0x5b9b('0x4b')],['ids','id'])||{})[_0x5b9b('0x86')](function(_0x359b89){for(var _0x1a9952=0x0;_0x1a9952<_0x16362e[_0x5b9b('0x4b')]['ids']['length'];_0x1a9952+=0x1){socket[_0x5b9b('0x82')]('userWhatsappQueue:save',{'UserId':Number(_0x16362e['body'][_0x5b9b('0x62')][_0x1a9952]),'WhatsappQueueId':Number(_0x16362e[_0x5b9b('0x52')]['id'])});}return _0x359b89;});}})['then'](respondWithResult(_0x490937,null))['catch'](handleError(_0x490937,null));};exports['removeAgents']=function(_0x25cf66,_0x49d745,_0x2cc478){return db['WhatsappQueue'][_0x5b9b('0x51')]({'where':{'id':_0x25cf66[_0x5b9b('0x52')]['id']}})['then'](handleEntityNotFound(_0x49d745,null))[_0x5b9b('0x28')](function(_0x5f3b1d){if(_0x5f3b1d){return _0x5f3b1d['removeAgents'](_0x25cf66['query'][_0x5b9b('0x62')])[_0x5b9b('0x28')](function(){if(_[_0x5b9b('0x87')](_0x25cf66[_0x5b9b('0x36')][_0x5b9b('0x62')])){for(var _0x16063a=0x0;_0x16063a<_0x25cf66[_0x5b9b('0x36')][_0x5b9b('0x62')]['length'];_0x16063a+=0x1){socket[_0x5b9b('0x82')](_0x5b9b('0x83'),{'UserId':Number(_0x25cf66['query'][_0x5b9b('0x62')][_0x16063a]),'WhatsappQueueId':Number(_0x25cf66['params']['id'])});}}else{socket['emit'](_0x5b9b('0x83'),{'UserId':Number(_0x25cf66[_0x5b9b('0x36')][_0x5b9b('0x62')]),'WhatsappQueueId':Number(_0x25cf66['params']['id'])});}});}})['then'](respondWithStatusCode(_0x49d745,null))[_0x5b9b('0x48')](handleError(_0x49d745,null));};exports[_0x5b9b('0x88')]=function(_0x1e14d8,_0x1dc8ba,_0x26f440){var _0x9c8e70={};var _0x2f3ff1={};var _0x531c44;var _0xb0875;return db[_0x5b9b('0x32')][_0x5b9b('0x55')]({'where':{'id':_0x1e14d8['params']['id']}})[_0x5b9b('0x28')](handleEntityNotFound(_0x1dc8ba,null))[_0x5b9b('0x28')](function(_0x1b0c77){if(_0x1b0c77){_0x531c44=_0x1b0c77;_0x2f3ff1[_0x5b9b('0x35')]=_[_0x5b9b('0x37')](db[_0x5b9b('0x59')][_0x5b9b('0x33')]);_0x2f3ff1[_0x5b9b('0x36')]=_[_0x5b9b('0x37')](_0x1e14d8[_0x5b9b('0x36')]);_0x2f3ff1[_0x5b9b('0x38')]=_['intersection'](_0x2f3ff1[_0x5b9b('0x35')],_0x2f3ff1['query']);_0x9c8e70[_0x5b9b('0x3a')]=_['intersection'](_0x2f3ff1[_0x5b9b('0x35')],qs[_0x5b9b('0x3b')](_0x1e14d8[_0x5b9b('0x36')][_0x5b9b('0x3b')]));_0x9c8e70['attributes']=_0x9c8e70[_0x5b9b('0x3a')][_0x5b9b('0x3c')]?_0x9c8e70[_0x5b9b('0x3a')]:_0x2f3ff1[_0x5b9b('0x35')];_0x9c8e70[_0x5b9b('0x57')]=qs[_0x5b9b('0x3f')](_0x1e14d8[_0x5b9b('0x36')]['sort']);_0x9c8e70[_0x5b9b('0x40')]=qs[_0x5b9b('0x38')](_[_0x5b9b('0x58')](_0x1e14d8[_0x5b9b('0x36')],_0x2f3ff1['filters']));if(_0x1e14d8['query']['filter']){_0x9c8e70[_0x5b9b('0x40')]=_[_0x5b9b('0x42')](_0x9c8e70['where'],{'$or':_[_0x5b9b('0x31')](_0x9c8e70[_0x5b9b('0x3a')],function(_0x1054db){var _0x46000a={};_0x46000a[_0x1054db]={'$like':'%'+_0x1e14d8[_0x5b9b('0x36')][_0x5b9b('0x41')]+'%'};return _0x46000a;})});}_0x9c8e70=_[_0x5b9b('0x42')]({},_0x9c8e70,_0x1e14d8[_0x5b9b('0x44')]);return _0x531c44[_0x5b9b('0x88')](_0x9c8e70);}})[_0x5b9b('0x28')](function(_0x185968){if(_0x185968){_0xb0875=_0x185968[_0x5b9b('0x3c')];if(!_0x1e14d8[_0x5b9b('0x36')][_0x5b9b('0x3d')]('nolimit')){_0x9c8e70['limit']=qs[_0x5b9b('0x24')](_0x1e14d8[_0x5b9b('0x36')][_0x5b9b('0x24')]);_0x9c8e70['offset']=qs[_0x5b9b('0x21')](_0x1e14d8[_0x5b9b('0x36')]['offset']);}return _0x531c44[_0x5b9b('0x88')](_0x9c8e70);}})[_0x5b9b('0x28')](function(_0x3b4500){if(_0x3b4500){return _0x3b4500?{'count':_0xb0875,'rows':_0x3b4500}:null;}})[_0x5b9b('0x28')](respondWithResult(_0x1dc8ba,null))['catch'](handleError(_0x1dc8ba,null));}; \ No newline at end of file +var _0xd4d7=['getTeams','Team','rawAttributes','order','addTeams','ids','findAll','User','Agents','voicePause','flatMap','sequelize','transaction','each','findOrCreate','emit','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','addAgents','omit','spread','userWhatsappQueue:save','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','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','../../config/environment','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','end','name','send','fieldName','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','where','filters','pick','filter','merge','type','VIRTUAL','options','WhatsappQueue','include','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserWhatsappQueue','nolimit','sort','findAndCountAll','UserId','agent','whatsappPause','updatedAt','rows','format','createdAt'];(function(_0x972b3c,_0x8053a9){var _0x58ac69=function(_0x368299){while(--_0x368299){_0x972b3c['push'](_0x972b3c['shift']());}};_0x58ac69(++_0x8053a9);}(_0xd4d7,0x148));var _0x7d4d=function(_0x3d6d05,_0x16c8b8){_0x3d6d05=_0x3d6d05-0x0;var _0x288baf=_0xd4d7[_0x3d6d05];return _0x288baf;};'use strict';var emlformat=require(_0x7d4d('0x0'));var rimraf=require(_0x7d4d('0x1'));var zipdir=require(_0x7d4d('0x2'));var jsonpatch=require(_0x7d4d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7d4d('0x4'));var util=require(_0x7d4d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x7d4d('0x6'));var ejs=require(_0x7d4d('0x7'));var fs=require('fs');var fs_extra=require(_0x7d4d('0x8'));var _=require(_0x7d4d('0x9'));var squel=require(_0x7d4d('0xa'));var crypto=require('crypto');var jsforce=require(_0x7d4d('0xb'));var deskjs=require(_0x7d4d('0xc'));var toCsv=require(_0x7d4d('0x6'));var querystring=require(_0x7d4d('0xd'));var Papa=require(_0x7d4d('0xe'));var Redis=require(_0x7d4d('0xf'));var authService=require(_0x7d4d('0x10'));var qs=require(_0x7d4d('0x11'));var as=require(_0x7d4d('0x12'));var hardwareService=require(_0x7d4d('0x13'));var logger=require(_0x7d4d('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7d4d('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x7d4d('0x16')](config[_0x7d4d('0x17')],{'host':_0x7d4d('0x18'),'port':0x18eb});var socket=require(_0x7d4d('0x19'))(new Redis(config['redis']));require(_0x7d4d('0x1a'))[_0x7d4d('0x1b')](socket);function respondWithStatusCode(_0x2fb4ad,_0x406563){_0x406563=_0x406563||0xcc;return function(_0x120027){if(_0x120027){return _0x2fb4ad[_0x7d4d('0x1c')](_0x406563);}return _0x2fb4ad[_0x7d4d('0x1d')](_0x406563)['end']();};}function respondWithResult(_0x19f98f,_0x52138f){_0x52138f=_0x52138f||0xc8;return function(_0x12c20b){if(_0x12c20b){return _0x19f98f['status'](_0x52138f)[_0x7d4d('0x1e')](_0x12c20b);}};}function respondWithFilteredResult(_0x217b10,_0x5587a9){return function(_0x4e8f68){if(_0x4e8f68){var _0x80813a=typeof _0x5587a9['offset']===_0x7d4d('0x1f')&&typeof _0x5587a9[_0x7d4d('0x20')]===_0x7d4d('0x1f');var _0x3bbf64=_0x4e8f68[_0x7d4d('0x21')];var _0x35a997=_0x80813a?0x0:_0x5587a9['offset'];var _0x22a1ce=_0x80813a?_0x4e8f68['count']:_0x5587a9[_0x7d4d('0x22')]+_0x5587a9[_0x7d4d('0x20')];var _0x285e71;if(_0x22a1ce>=_0x3bbf64){_0x22a1ce=_0x3bbf64;_0x285e71=0xc8;}else{_0x285e71=0xce;}_0x217b10[_0x7d4d('0x1d')](_0x285e71);return _0x217b10[_0x7d4d('0x23')](_0x7d4d('0x24'),_0x35a997+'-'+_0x22a1ce+'/'+_0x3bbf64)[_0x7d4d('0x1e')](_0x4e8f68);}return null;};}function patchUpdates(_0x1fe180){return function(_0x5f5e0d){try{jsonpatch[_0x7d4d('0x25')](_0x5f5e0d,_0x1fe180,!![]);}catch(_0x5599db){return BPromise[_0x7d4d('0x26')](_0x5599db);}return _0x5f5e0d[_0x7d4d('0x27')]();};}function saveUpdates(_0xa95708,_0x3eee94){return function(_0x1e1472){if(_0x1e1472){return _0x1e1472[_0x7d4d('0x28')](_0xa95708)[_0x7d4d('0x29')](function(_0x1041de){return _0x1041de;});}return null;};}function removeEntity(_0x9590df,_0x2e298a){return function(_0x544e5d){if(_0x544e5d){return _0x544e5d[_0x7d4d('0x2a')]()[_0x7d4d('0x29')](function(){var _0x8630d6=_0x544e5d[_0x7d4d('0x2b')]({'plain':!![]});var _0x507b0b=_0x7d4d('0x2c');return db[_0x7d4d('0x2d')]['destroy']({'where':{'type':_0x507b0b,'resourceId':_0x8630d6['id']}})[_0x7d4d('0x29')](function(){return _0x544e5d;});})[_0x7d4d('0x29')](function(){_0x9590df['status'](0xcc)[_0x7d4d('0x2e')]();});}};}function handleEntityNotFound(_0x13c265,_0x5905ee){return function(_0xf7bddc){if(!_0xf7bddc){_0x13c265[_0x7d4d('0x1c')](0x194);}return _0xf7bddc;};}function handleError(_0x10524b,_0x20f34f){_0x20f34f=_0x20f34f||0x1f4;return function(_0x2c6712){logger['error'](_0x2c6712['stack']);if(_0x2c6712[_0x7d4d('0x2f')]){delete _0x2c6712[_0x7d4d('0x2f')];}_0x10524b['status'](_0x20f34f)[_0x7d4d('0x30')](_0x2c6712);};}exports['index']=function(_0x26840d,_0x24e9a2){var _0x278fd5={},_0x3408a4={},_0x2aedbc={'count':0x0,'rows':[]};var _0x568a73=_['map'](db['WhatsappQueue']['rawAttributes'],function(_0x3a8217){return{'name':_0x3a8217[_0x7d4d('0x31')],'type':_0x3a8217['type']['key']};});_0x3408a4[_0x7d4d('0x32')]=_[_0x7d4d('0x33')](_0x568a73,_0x7d4d('0x2f'));_0x3408a4[_0x7d4d('0x34')]=_[_0x7d4d('0x35')](_0x26840d[_0x7d4d('0x34')]);_0x3408a4['filters']=_['intersection'](_0x3408a4['model'],_0x3408a4[_0x7d4d('0x34')]);_0x278fd5[_0x7d4d('0x36')]=_[_0x7d4d('0x37')](_0x3408a4[_0x7d4d('0x32')],qs[_0x7d4d('0x38')](_0x26840d[_0x7d4d('0x34')]['fields']));_0x278fd5[_0x7d4d('0x36')]=_0x278fd5[_0x7d4d('0x36')][_0x7d4d('0x39')]?_0x278fd5[_0x7d4d('0x36')]:_0x3408a4['model'];if(!_0x26840d[_0x7d4d('0x34')][_0x7d4d('0x3a')]('nolimit')){_0x278fd5['limit']=qs[_0x7d4d('0x20')](_0x26840d['query']['limit']);_0x278fd5[_0x7d4d('0x22')]=qs[_0x7d4d('0x22')](_0x26840d[_0x7d4d('0x34')][_0x7d4d('0x22')]);}_0x278fd5['order']=qs['sort'](_0x26840d['query']['sort']);_0x278fd5[_0x7d4d('0x3b')]=qs[_0x7d4d('0x3c')](_[_0x7d4d('0x3d')](_0x26840d[_0x7d4d('0x34')],_0x3408a4[_0x7d4d('0x3c')]),_0x568a73);if(_0x26840d['query'][_0x7d4d('0x3e')]){_0x278fd5[_0x7d4d('0x3b')]=_[_0x7d4d('0x3f')](_0x278fd5[_0x7d4d('0x3b')],{'$or':_['map'](_0x568a73,function(_0xacf4ab){if(_0xacf4ab[_0x7d4d('0x40')]!==_0x7d4d('0x41')){var _0x5191cf={};_0x5191cf[_0xacf4ab[_0x7d4d('0x2f')]]={'$like':'%'+_0x26840d[_0x7d4d('0x34')]['filter']+'%'};return _0x5191cf;}})});}_0x278fd5=_[_0x7d4d('0x3f')]({},_0x278fd5,_0x26840d[_0x7d4d('0x42')]);var _0x9b3928={'where':_0x278fd5[_0x7d4d('0x3b')]};return db[_0x7d4d('0x43')]['count'](_0x9b3928)[_0x7d4d('0x29')](function(_0x84ed5d){_0x2aedbc[_0x7d4d('0x21')]=_0x84ed5d;if(_0x26840d['query']['includeAll']){_0x278fd5[_0x7d4d('0x44')]=[{'all':!![]}];}return db[_0x7d4d('0x43')]['findAll'](_0x278fd5);})[_0x7d4d('0x29')](function(_0x1cec56){_0x2aedbc['rows']=_0x1cec56;return _0x2aedbc;})[_0x7d4d('0x29')](respondWithFilteredResult(_0x24e9a2,_0x278fd5))[_0x7d4d('0x45')](handleError(_0x24e9a2,null));};exports[_0x7d4d('0x46')]=function(_0x58135c,_0x2ab9b7){var _0x4d8e44={'raw':!![],'where':{'id':_0x58135c[_0x7d4d('0x47')]['id']}},_0x131a7c={};_0x131a7c['model']=_['keys'](db[_0x7d4d('0x43')]['rawAttributes']);_0x131a7c[_0x7d4d('0x34')]=_[_0x7d4d('0x35')](_0x58135c['query']);_0x131a7c[_0x7d4d('0x3c')]=_['intersection'](_0x131a7c[_0x7d4d('0x32')],_0x131a7c['query']);_0x4d8e44['attributes']=_['intersection'](_0x131a7c[_0x7d4d('0x32')],qs[_0x7d4d('0x38')](_0x58135c[_0x7d4d('0x34')][_0x7d4d('0x38')]));_0x4d8e44[_0x7d4d('0x36')]=_0x4d8e44[_0x7d4d('0x36')][_0x7d4d('0x39')]?_0x4d8e44[_0x7d4d('0x36')]:_0x131a7c['model'];if(_0x58135c[_0x7d4d('0x34')][_0x7d4d('0x48')]){_0x4d8e44['include']=[{'all':!![]}];}_0x4d8e44=_[_0x7d4d('0x3f')]({},_0x4d8e44,_0x58135c[_0x7d4d('0x42')]);return db[_0x7d4d('0x43')][_0x7d4d('0x49')](_0x4d8e44)[_0x7d4d('0x29')](handleEntityNotFound(_0x2ab9b7,null))[_0x7d4d('0x29')](respondWithResult(_0x2ab9b7,null))[_0x7d4d('0x45')](handleError(_0x2ab9b7,null));};exports[_0x7d4d('0x4a')]=function(_0x30dc80,_0x458d8c){return db[_0x7d4d('0x43')][_0x7d4d('0x4a')](_0x30dc80['body'],{})['then'](function(_0x375d2b){var _0x324562=_0x30dc80[_0x7d4d('0x4b')][_0x7d4d('0x2b')]({'plain':!![]});if(!_0x324562)throw new Error(_0x7d4d('0x4c'));if(_0x324562[_0x7d4d('0x4d')]==='user'){var _0x11a73=_0x375d2b[_0x7d4d('0x2b')]({'plain':!![]});var _0x1f3a35=_0x7d4d('0x2c');return db[_0x7d4d('0x4e')][_0x7d4d('0x49')]({'where':{'name':_0x1f3a35,'userProfileId':_0x324562[_0x7d4d('0x4f')]},'raw':!![]})[_0x7d4d('0x29')](function(_0x154f0f){if(_0x154f0f&&_0x154f0f[_0x7d4d('0x50')]===0x0){return db[_0x7d4d('0x2d')][_0x7d4d('0x4a')]({'name':_0x11a73[_0x7d4d('0x2f')],'resourceId':_0x11a73['id'],'type':_0x154f0f[_0x7d4d('0x2f')],'sectionId':_0x154f0f['id']},{})[_0x7d4d('0x29')](function(){return _0x375d2b;});}else{return _0x375d2b;}})['catch'](function(_0x5e5937){logger[_0x7d4d('0x51')](_0x7d4d('0x52'),_0x5e5937);throw _0x5e5937;});}return _0x375d2b;})[_0x7d4d('0x29')](respondWithResult(_0x458d8c,0xc9))[_0x7d4d('0x45')](handleError(_0x458d8c,null));};exports['update']=function(_0x5a7b78,_0x1b288f){if(_0x5a7b78[_0x7d4d('0x53')]['id']){delete _0x5a7b78[_0x7d4d('0x53')]['id'];}return db['WhatsappQueue'][_0x7d4d('0x49')]({'where':{'id':_0x5a7b78['params']['id']}})[_0x7d4d('0x29')](handleEntityNotFound(_0x1b288f,null))[_0x7d4d('0x29')](saveUpdates(_0x5a7b78[_0x7d4d('0x53')],null))[_0x7d4d('0x29')](respondWithResult(_0x1b288f,null))[_0x7d4d('0x45')](handleError(_0x1b288f,null));};exports[_0x7d4d('0x2a')]=function(_0x5aa7a3,_0x3bd4d8){return db[_0x7d4d('0x43')][_0x7d4d('0x49')]({'where':{'id':_0x5aa7a3[_0x7d4d('0x47')]['id']}})[_0x7d4d('0x29')](handleEntityNotFound(_0x3bd4d8,null))[_0x7d4d('0x29')](removeEntity(_0x3bd4d8,null))[_0x7d4d('0x45')](handleError(_0x3bd4d8,null));};exports[_0x7d4d('0x54')]=function(_0x21a7fc,_0x52ef16){return db[_0x7d4d('0x43')][_0x7d4d('0x54')]()[_0x7d4d('0x29')](respondWithResult(_0x52ef16,null))[_0x7d4d('0x45')](handleError(_0x52ef16,null));};exports[_0x7d4d('0x55')]=function(_0x1539af,_0x586406,_0x23536d){var _0x3d4e09={'raw':!![],'where':{}},_0x5dbbc3={},_0x14141d;return db[_0x7d4d('0x43')][_0x7d4d('0x56')]({'where':{'id':_0x1539af[_0x7d4d('0x47')]['id']}})[_0x7d4d('0x29')](handleEntityNotFound(_0x586406,null))[_0x7d4d('0x29')](function(_0x2801d6){if(_0x2801d6){_0x14141d=_0x2801d6[_0x7d4d('0x2b')]({'plain':!![]});_0x5dbbc3[_0x7d4d('0x32')]=_[_0x7d4d('0x35')](db[_0x7d4d('0x57')]['rawAttributes']);_0x5dbbc3[_0x7d4d('0x34')]=_[_0x7d4d('0x35')](_0x1539af['query']);_0x5dbbc3['filters']=_[_0x7d4d('0x37')](_0x5dbbc3[_0x7d4d('0x32')],_0x5dbbc3[_0x7d4d('0x34')]);_0x3d4e09[_0x7d4d('0x36')]=_[_0x7d4d('0x37')](_0x5dbbc3[_0x7d4d('0x32')],qs[_0x7d4d('0x38')](_0x1539af[_0x7d4d('0x34')][_0x7d4d('0x38')]));_0x3d4e09['attributes']=_0x3d4e09[_0x7d4d('0x36')][_0x7d4d('0x39')]?_0x3d4e09[_0x7d4d('0x36')]:_0x5dbbc3['model'];if(!_0x1539af['query'][_0x7d4d('0x3a')](_0x7d4d('0x58'))){_0x3d4e09[_0x7d4d('0x20')]=qs[_0x7d4d('0x20')](_0x1539af[_0x7d4d('0x34')][_0x7d4d('0x20')]);_0x3d4e09[_0x7d4d('0x22')]=qs[_0x7d4d('0x22')](_0x1539af[_0x7d4d('0x34')][_0x7d4d('0x22')]);}_0x3d4e09['order']=qs[_0x7d4d('0x59')](_0x1539af[_0x7d4d('0x34')][_0x7d4d('0x59')]);_0x3d4e09[_0x7d4d('0x3b')]=qs[_0x7d4d('0x3c')](_['pick'](_0x1539af[_0x7d4d('0x34')],_0x5dbbc3[_0x7d4d('0x3c')]));_0x3d4e09[_0x7d4d('0x3b')]['WhatsappQueueId']=_0x2801d6['id'];if(_0x1539af[_0x7d4d('0x34')][_0x7d4d('0x3e')]){_0x3d4e09[_0x7d4d('0x3b')]=_[_0x7d4d('0x3f')](_0x3d4e09[_0x7d4d('0x3b')],{'$or':_[_0x7d4d('0x33')](_0x3d4e09[_0x7d4d('0x36')],function(_0x18aae0){var _0x4f73ab={};_0x4f73ab[_0x18aae0]={'$like':'%'+_0x1539af[_0x7d4d('0x34')]['filter']+'%'};return _0x4f73ab;})});}_0x3d4e09=_[_0x7d4d('0x3f')]({},_0x3d4e09,_0x1539af[_0x7d4d('0x42')]);return db[_0x7d4d('0x57')]['findAll'](_0x3d4e09);}})[_0x7d4d('0x29')](function(_0x4b4c79){if(_0x4b4c79){return db['User'][_0x7d4d('0x5a')]({'where':{'id':_['map'](_0x4b4c79,_0x7d4d('0x5b')),'role':_0x7d4d('0x5c')},'attributes':['id','name',_0x7d4d('0x5d'),_0x7d4d('0x5e'),'createdAt']});}})['then'](function(_0x5c175e){if(_0x5c175e){return{'count':_0x5c175e[_0x7d4d('0x21')],'rows':_[_0x7d4d('0x33')](_0x5c175e[_0x7d4d('0x5f')],function(_0x2f8743){return{'membername':_0x2f8743[_0x7d4d('0x2f')],'UserId':_0x2f8743['id'],'queue_name':_0x14141d[_0x7d4d('0x2f')],'WhatsappQueueId':_0x14141d['id'],'interface':util[_0x7d4d('0x60')]('%s/%s','SIP',_0x2f8743[_0x7d4d('0x2f')]),'penalty':0x0,'paused':_0x2f8743['whatsappPause'],'createdAt':_0x2f8743[_0x7d4d('0x61')],'updatedAt':_0x2f8743[_0x7d4d('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7d4d('0x29')](respondWithFilteredResult(_0x586406,_0x3d4e09))[_0x7d4d('0x45')](handleError(_0x586406,null));};exports[_0x7d4d('0x62')]=function(_0x187463,_0x5df5d0,_0x2603a8){var _0x2856a9={};var _0x2360c0={};var _0x26994e;var _0x4e0b75;return db['WhatsappQueue']['findOne']({'where':{'id':_0x187463[_0x7d4d('0x47')]['id']}})[_0x7d4d('0x29')](handleEntityNotFound(_0x5df5d0,null))[_0x7d4d('0x29')](function(_0x39646c){if(_0x39646c){_0x26994e=_0x39646c;_0x2360c0[_0x7d4d('0x32')]=_[_0x7d4d('0x35')](db[_0x7d4d('0x63')][_0x7d4d('0x64')]);_0x2360c0[_0x7d4d('0x34')]=_[_0x7d4d('0x35')](_0x187463[_0x7d4d('0x34')]);_0x2360c0['filters']=_[_0x7d4d('0x37')](_0x2360c0[_0x7d4d('0x32')],_0x2360c0['query']);_0x2856a9[_0x7d4d('0x36')]=_['intersection'](_0x2360c0[_0x7d4d('0x32')],qs[_0x7d4d('0x38')](_0x187463[_0x7d4d('0x34')][_0x7d4d('0x38')]));_0x2856a9[_0x7d4d('0x36')]=_0x2856a9[_0x7d4d('0x36')][_0x7d4d('0x39')]?_0x2856a9['attributes']:_0x2360c0['model'];_0x2856a9[_0x7d4d('0x65')]=qs[_0x7d4d('0x59')](_0x187463[_0x7d4d('0x34')][_0x7d4d('0x59')]);_0x2856a9[_0x7d4d('0x3b')]=qs[_0x7d4d('0x3c')](_['pick'](_0x187463['query'],_0x2360c0[_0x7d4d('0x3c')]));if(_0x187463[_0x7d4d('0x34')][_0x7d4d('0x3e')]){_0x2856a9[_0x7d4d('0x3b')]=_[_0x7d4d('0x3f')](_0x2856a9[_0x7d4d('0x3b')],{'$or':_[_0x7d4d('0x33')](_0x2856a9[_0x7d4d('0x36')],function(_0x109b47){var _0x3c5021={};_0x3c5021[_0x109b47]={'$like':'%'+_0x187463['query'][_0x7d4d('0x3e')]+'%'};return _0x3c5021;})});}_0x2856a9=_[_0x7d4d('0x3f')]({},_0x2856a9,_0x187463[_0x7d4d('0x42')]);return _0x26994e['getTeams'](_0x2856a9);}})['then'](function(_0x109fc5){if(_0x109fc5){_0x4e0b75=_0x109fc5['length'];if(!_0x187463['query'][_0x7d4d('0x3a')](_0x7d4d('0x58'))){_0x2856a9[_0x7d4d('0x20')]=qs['limit'](_0x187463[_0x7d4d('0x34')][_0x7d4d('0x20')]);_0x2856a9['offset']=qs[_0x7d4d('0x22')](_0x187463[_0x7d4d('0x34')][_0x7d4d('0x22')]);}return _0x26994e[_0x7d4d('0x62')](_0x2856a9);}})[_0x7d4d('0x29')](function(_0x9b0008){if(_0x9b0008){return _0x9b0008?{'count':_0x4e0b75,'rows':_0x9b0008}:null;}})[_0x7d4d('0x29')](respondWithResult(_0x5df5d0,null))[_0x7d4d('0x45')](handleError(_0x5df5d0,null));};exports[_0x7d4d('0x66')]=function(_0x1a975b,_0x4b2dd1,_0x3ee2f5){var _0x135742=_0x1a975b[_0x7d4d('0x53')][_0x7d4d('0x67')];return db['Team'][_0x7d4d('0x68')]({'where':{'id':_0x135742},'attributes':['id'],'include':[{'model':db[_0x7d4d('0x69')],'as':_0x7d4d('0x6a'),'attributes':['id','name','online',_0x7d4d('0x6b'),'interface'],'raw':!![]}]})[_0x7d4d('0x29')](function(_0x382917){if(_0x382917){var _0x3b64b0=_[_0x7d4d('0x6c')](_0x382917,function(_0x3e5723){var _0x2c7547=_0x3e5723[_0x7d4d('0x2b')]({'plain':!![]});return _0x2c7547[_0x7d4d('0x6a')];});return db[_0x7d4d('0x43')][_0x7d4d('0x49')]({'where':{'id':_0x1a975b[_0x7d4d('0x47')]['id']}})[_0x7d4d('0x29')](function(_0x2ee860){return db[_0x7d4d('0x6d')][_0x7d4d('0x6e')](function(_0x1a9688){return _0x2ee860[_0x7d4d('0x66')](_0x135742,{'transaction':_0x1a9688})[_0x7d4d('0x29')](function(){return BPromise[_0x7d4d('0x6f')](_0x3b64b0,function(_0x6491a4){return db[_0x7d4d('0x57')][_0x7d4d('0x70')]({'where':{'UserId':_0x6491a4['id'],'WhatsappQueueId':_0x1a975b['params']['id']},'transaction':_0x1a9688});});})['then'](function(){_0x3b64b0['forEach'](function(_0x307dd6){socket[_0x7d4d('0x71')]('userWhatsappQueue:save',{'UserId':_0x307dd6['id'],'WhatsappQueueId':_0x2ee860['id']});});});});});}})[_0x7d4d('0x29')](respondWithStatusCode(_0x4b2dd1,null))['catch'](handleError(_0x4b2dd1,null));};exports['removeTeams']=function(_0x4f8512,_0x511cfd,_0x2a2675){return db[_0x7d4d('0x63')]['findAll']({'where':{'id':_0x4f8512[_0x7d4d('0x34')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7d4d('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x511cfd,null))[_0x7d4d('0x29')](function(_0x220f8f){var _0xa246c4=_[_0x7d4d('0x33')](_0x220f8f,'id');var _0x3a67a6=[];var _0x5abb51=[];var _0x4356c4=squel['select']();_0x4356c4[_0x7d4d('0x72')](_0x7d4d('0x73'))[_0x7d4d('0x74')]('team_has_whatsapp_queues','tq')[_0x7d4d('0x75')](_0x7d4d('0x76'),'ut',_0x7d4d('0x77'))['where'](_0x7d4d('0x78'),_0x4f8512[_0x7d4d('0x47')]['id']);for(var _0x51c8d5=0x0;_0x51c8d5<_0x220f8f[_0x7d4d('0x39')];_0x51c8d5+=0x1){let _0x2b778b=_0x220f8f[_0x51c8d5];for(var _0x35b5a2=0x0;_0x35b5a2<_0x2b778b[_0x7d4d('0x6a')][_0x7d4d('0x39')];_0x35b5a2+=0x1){let _0x5206c0=_0x2b778b[_0x7d4d('0x6a')][_0x35b5a2];var _0x11d254=_0x4356c4[_0x7d4d('0x79')]();_0x11d254[_0x7d4d('0x3b')](_0x7d4d('0x7a'),_0x5206c0['id']);_0x5abb51[_0x7d4d('0x7b')](db['sequelize'][_0x7d4d('0x34')](_0x11d254[_0x7d4d('0x7c')](),{'type':db[_0x7d4d('0x6d')]['QueryTypes'][_0x7d4d('0x7d')]})[_0x7d4d('0x29')](function(_0x4a00c2){if(_0x4a00c2['length']===0x1){return _0x5206c0['id'];}else{var _0x539883=_['every'](_[_0x7d4d('0x33')](_0x4a00c2,_0x7d4d('0x7e')),function(_0xdc7f36){return _[_0x7d4d('0x7f')](_0xa246c4,_0xdc7f36);});if(_0x539883){return _0x5206c0['id'];}}}));}}return BPromise[_0x7d4d('0x80')](_0x5abb51)[_0x7d4d('0x29')](function(_0x486f67){_0x3a67a6=_(_0x3a67a6)[_0x7d4d('0x81')](_0x486f67)[_0x7d4d('0x82')]()[_0x7d4d('0x83')]();return db[_0x7d4d('0x43')][_0x7d4d('0x49')]({'where':{'id':_0x4f8512[_0x7d4d('0x47')]['id']}})[_0x7d4d('0x29')](function(_0x1dc0ad){return db[_0x7d4d('0x6d')][_0x7d4d('0x6e')](function(_0x4d050){return _0x1dc0ad[_0x7d4d('0x84')](_0x4f8512[_0x7d4d('0x34')][_0x7d4d('0x67')],{'transaction':_0x4d050})['then'](function(){if(!_[_0x7d4d('0x85')](_0x3a67a6)){return _0x1dc0ad[_0x7d4d('0x86')](_0x3a67a6,{'transaction':_0x4d050});}})[_0x7d4d('0x29')](function(){_0x3a67a6['forEach'](function(_0x17b16e){socket[_0x7d4d('0x71')]('userWhatsappQueue:remove',{'UserId':_0x17b16e,'WhatsappQueueId':_0x1dc0ad['id']});});});});});});})[_0x7d4d('0x29')](respondWithStatusCode(_0x511cfd,null))['catch'](handleError(_0x511cfd,null));};exports[_0x7d4d('0x87')]=function(_0x2ce0d1,_0x29306d,_0x5bb1f7){return db[_0x7d4d('0x43')][_0x7d4d('0x49')]({'where':{'id':_0x2ce0d1['params']['id']}})[_0x7d4d('0x29')](handleEntityNotFound(_0x29306d,null))['then'](function(_0x2916f6){if(_0x2916f6){return _0x2916f6['addAgents'](_0x2ce0d1['body'][_0x7d4d('0x67')],_[_0x7d4d('0x88')](_0x2ce0d1[_0x7d4d('0x53')],[_0x7d4d('0x67'),'id'])||{})[_0x7d4d('0x89')](function(_0x20cf1c){for(var _0x38b6af=0x0;_0x38b6af<_0x2ce0d1[_0x7d4d('0x53')][_0x7d4d('0x67')]['length'];_0x38b6af+=0x1){socket['emit'](_0x7d4d('0x8a'),{'UserId':Number(_0x2ce0d1[_0x7d4d('0x53')]['ids'][_0x38b6af]),'WhatsappQueueId':Number(_0x2ce0d1['params']['id'])});}return _0x20cf1c;});}})[_0x7d4d('0x29')](respondWithResult(_0x29306d,null))['catch'](handleError(_0x29306d,null));};exports[_0x7d4d('0x86')]=function(_0x282904,_0x18b7e1,_0x1c068f){return db['WhatsappQueue'][_0x7d4d('0x49')]({'where':{'id':_0x282904[_0x7d4d('0x47')]['id']}})[_0x7d4d('0x29')](handleEntityNotFound(_0x18b7e1,null))['then'](function(_0x7dd584){if(_0x7dd584){return _0x7dd584[_0x7d4d('0x86')](_0x282904[_0x7d4d('0x34')][_0x7d4d('0x67')])[_0x7d4d('0x29')](function(){if(_[_0x7d4d('0x8b')](_0x282904[_0x7d4d('0x34')]['ids'])){for(var _0x223db6=0x0;_0x223db6<_0x282904['query'][_0x7d4d('0x67')]['length'];_0x223db6+=0x1){socket[_0x7d4d('0x71')](_0x7d4d('0x8c'),{'UserId':Number(_0x282904[_0x7d4d('0x34')][_0x7d4d('0x67')][_0x223db6]),'WhatsappQueueId':Number(_0x282904[_0x7d4d('0x47')]['id'])});}}else{socket[_0x7d4d('0x71')](_0x7d4d('0x8c'),{'UserId':Number(_0x282904[_0x7d4d('0x34')][_0x7d4d('0x67')]),'WhatsappQueueId':Number(_0x282904[_0x7d4d('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x18b7e1,null))[_0x7d4d('0x45')](handleError(_0x18b7e1,null));};exports['getAgents']=function(_0x199aed,_0x5d5257,_0x3682ef){var _0x33c603={};var _0x1a0883={};var _0x2f4331;var _0x5acd48;return db['WhatsappQueue'][_0x7d4d('0x56')]({'where':{'id':_0x199aed[_0x7d4d('0x47')]['id']}})[_0x7d4d('0x29')](handleEntityNotFound(_0x5d5257,null))['then'](function(_0x1c7cf6){if(_0x1c7cf6){_0x2f4331=_0x1c7cf6;_0x1a0883[_0x7d4d('0x32')]=_[_0x7d4d('0x35')](db[_0x7d4d('0x69')][_0x7d4d('0x64')]);_0x1a0883[_0x7d4d('0x34')]=_[_0x7d4d('0x35')](_0x199aed[_0x7d4d('0x34')]);_0x1a0883[_0x7d4d('0x3c')]=_['intersection'](_0x1a0883[_0x7d4d('0x32')],_0x1a0883[_0x7d4d('0x34')]);_0x33c603[_0x7d4d('0x36')]=_[_0x7d4d('0x37')](_0x1a0883[_0x7d4d('0x32')],qs[_0x7d4d('0x38')](_0x199aed[_0x7d4d('0x34')][_0x7d4d('0x38')]));_0x33c603['attributes']=_0x33c603[_0x7d4d('0x36')][_0x7d4d('0x39')]?_0x33c603['attributes']:_0x1a0883[_0x7d4d('0x32')];_0x33c603[_0x7d4d('0x65')]=qs[_0x7d4d('0x59')](_0x199aed[_0x7d4d('0x34')][_0x7d4d('0x59')]);_0x33c603[_0x7d4d('0x3b')]=qs['filters'](_[_0x7d4d('0x3d')](_0x199aed[_0x7d4d('0x34')],_0x1a0883['filters']));if(_0x199aed[_0x7d4d('0x34')]['filter']){_0x33c603['where']=_['merge'](_0x33c603['where'],{'$or':_['map'](_0x33c603[_0x7d4d('0x36')],function(_0x4475e6){var _0x2bd9f3={};_0x2bd9f3[_0x4475e6]={'$like':'%'+_0x199aed[_0x7d4d('0x34')][_0x7d4d('0x3e')]+'%'};return _0x2bd9f3;})});}_0x33c603=_[_0x7d4d('0x3f')]({},_0x33c603,_0x199aed[_0x7d4d('0x42')]);return _0x2f4331[_0x7d4d('0x8d')](_0x33c603);}})['then'](function(_0x3bcd92){if(_0x3bcd92){_0x5acd48=_0x3bcd92[_0x7d4d('0x39')];if(!_0x199aed[_0x7d4d('0x34')][_0x7d4d('0x3a')]('nolimit')){_0x33c603[_0x7d4d('0x20')]=qs[_0x7d4d('0x20')](_0x199aed[_0x7d4d('0x34')][_0x7d4d('0x20')]);_0x33c603[_0x7d4d('0x22')]=qs[_0x7d4d('0x22')](_0x199aed[_0x7d4d('0x34')][_0x7d4d('0x22')]);}return _0x2f4331[_0x7d4d('0x8d')](_0x33c603);}})[_0x7d4d('0x29')](function(_0x25a4ed){if(_0x25a4ed){return _0x25a4ed?{'count':_0x5acd48,'rows':_0x25a4ed}:null;}})[_0x7d4d('0x29')](respondWithResult(_0x5d5257,null))[_0x7d4d('0x45')](handleError(_0x5d5257,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index ef7f7eb..c3c551f 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 _0x8839=['save','update','remove','emit','hasOwnProperty','exports','events','setMaxListeners'];(function(_0x6b23f3,_0x4189c9){var _0x473e8f=function(_0x2112c2){while(--_0x2112c2){_0x6b23f3['push'](_0x6b23f3['shift']());}};_0x473e8f(++_0x4189c9);}(_0x8839,0x1d6));var _0x9883=function(_0x14e7f8,_0x15a364){_0x14e7f8=_0x14e7f8-0x0;var _0x153a38=_0x8839[_0x14e7f8];return _0x153a38;};'use strict';var EventEmitter=require(_0x9883('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x9883('0x1')](0x0);var events={'afterCreate':_0x9883('0x2'),'afterUpdate':_0x9883('0x3'),'afterDestroy':_0x9883('0x4')};function emitEvent(_0x503d06){return function(_0x38fa16,_0xe5e16b,_0x212e7f){WhatsappQueueEvents[_0x9883('0x5')](_0x503d06+':'+_0x38fa16['id'],_0x38fa16);WhatsappQueueEvents[_0x9883('0x5')](_0x503d06,_0x38fa16);_0x212e7f(null);};}for(var e in events){if(events[_0x9883('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x9883('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xe6b5=['save','remove','emit','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners'];(function(_0x2427de,_0x51990b){var _0x8cb15c=function(_0x312bca){while(--_0x312bca){_0x2427de['push'](_0x2427de['shift']());}};_0x8cb15c(++_0x51990b);}(_0xe6b5,0x1e4));var _0x5e6b=function(_0x2e238a,_0x1b95d2){_0x2e238a=_0x2e238a-0x0;var _0x4fc840=_0xe6b5[_0x2e238a];return _0x4fc840;};'use strict';var EventEmitter=require(_0x5e6b('0x0'));var WhatsappQueue=require(_0x5e6b('0x1'))['db'][_0x5e6b('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5e6b('0x3')](0x0);var events={'afterCreate':_0x5e6b('0x4'),'afterUpdate':'update','afterDestroy':_0x5e6b('0x5')};function emitEvent(_0x33c3a4){return function(_0x3174d5,_0x41c9a7,_0xafc7bd){WhatsappQueueEvents['emit'](_0x33c3a4+':'+_0x3174d5['id'],_0x3174d5);WhatsappQueueEvents[_0x5e6b('0x6')](_0x33c3a4,_0x3174d5);_0xafc7bd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x5e6b('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 28af1d2..3c71a8b 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 _0x0608=['api','moment','bluebird','request-promise','path','rimraf','exports','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger'];(function(_0x73e23e,_0xac8fc2){var _0x476e48=function(_0x1944eb){while(--_0x1944eb){_0x73e23e['push'](_0x73e23e['shift']());}};_0x476e48(++_0xac8fc2);}(_0x0608,0x159));var _0x8060=function(_0x1cc556,_0x1064e9){_0x1cc556=_0x1cc556-0x0;var _0x3b9cb7=_0x0608[_0x1cc556];return _0x3b9cb7;};'use strict';var _=require(_0x8060('0x0'));var util=require(_0x8060('0x1'));var logger=require(_0x8060('0x2'))(_0x8060('0x3'));var moment=require(_0x8060('0x4'));var BPromise=require(_0x8060('0x5'));var rp=require(_0x8060('0x6'));var fs=require('fs');var path=require(_0x8060('0x7'));var rimraf=require(_0x8060('0x8'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0x8060('0x9')]=function(_0x491af5,_0x2ec83b){return _0x491af5['define'](_0x8060('0xa'),attributes,{'tableName':_0x8060('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9825=['../../config/environment','exports','define','WhatsappQueue','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3d1244,_0x156028){var _0x5d6372=function(_0x509c76){while(--_0x509c76){_0x3d1244['push'](_0x3d1244['shift']());}};_0x5d6372(++_0x156028);}(_0x9825,0xe0));var _0x5982=function(_0x5b8a26,_0x7313bb){_0x5b8a26=_0x5b8a26-0x0;var _0x37f956=_0x9825[_0x5b8a26];return _0x37f956;};'use strict';var _=require('lodash');var util=require(_0x5982('0x0'));var logger=require(_0x5982('0x1'))(_0x5982('0x2'));var moment=require(_0x5982('0x3'));var BPromise=require('bluebird');var rp=require(_0x5982('0x4'));var fs=require('fs');var path=require(_0x5982('0x5'));var rimraf=require('rimraf');var config=require(_0x5982('0x6'));var attributes=require('./whatsappQueue.attributes');module[_0x5982('0x7')]=function(_0xe774a1,_0x2f5602){return _0xe774a1[_0x5982('0x8')](_0x5982('0x9'),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 eab7d59..79ae905 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 _0xf017=['defaults','redis','localhost','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueue','options','where','attributes','include','map','model','info','GetWhatsappQueue','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x49afc7,_0x3ea0e1){var _0x362101=function(_0x45b8ba){while(--_0x45b8ba){_0x49afc7['push'](_0x49afc7['shift']());}};_0x362101(++_0x3ea0e1);}(_0xf017,0x68));var _0x7f01=function(_0x5984d0,_0x45f747){_0x5984d0=_0x5984d0-0x0;var _0x386441=_0xf017[_0x5984d0];return _0x386441;};'use strict';var _=require(_0x7f01('0x0'));var util=require(_0x7f01('0x1'));var moment=require(_0x7f01('0x2'));var BPromise=require(_0x7f01('0x3'));var rs=require(_0x7f01('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f01('0x5'))['db'];var utils=require(_0x7f01('0x6'));var logger=require(_0x7f01('0x7'))(_0x7f01('0x8'));var config=require(_0x7f01('0x9'));var jayson=require(_0x7f01('0xa'));var client=jayson[_0x7f01('0xb')][_0x7f01('0xc')]({'port':0x232a});config['redis']=_[_0x7f01('0xd')](config[_0x7f01('0xe')],{'host':_0x7f01('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7f01('0xe')]));require('./whatsappQueue.socket')[_0x7f01('0x10')](socket);function respondWithRpcPromise(_0xade0c2,_0x7e71b9,_0x4427cb){return new BPromise(function(_0x207cf7,_0x33109f){return client[_0x7f01('0x11')](_0xade0c2,_0x4427cb)[_0x7f01('0x12')](function(_0x47bdaa){logger['info'](_0x7f01('0x13'),_0x7e71b9,_0x7f01('0x14'));logger[_0x7f01('0x15')](_0x7f01('0x16'),_0x7e71b9,_0x7f01('0x14'),JSON[_0x7f01('0x17')](_0x47bdaa));if(_0x47bdaa['error']){if(_0x47bdaa[_0x7f01('0x18')][_0x7f01('0x19')]===0x1f4){logger[_0x7f01('0x18')](_0x7f01('0x13'),_0x7e71b9,_0x47bdaa[_0x7f01('0x18')][_0x7f01('0x1a')]);return _0x33109f(_0x47bdaa[_0x7f01('0x18')][_0x7f01('0x1a')]);}logger[_0x7f01('0x18')](_0x7f01('0x13'),_0x7e71b9,_0x47bdaa[_0x7f01('0x18')][_0x7f01('0x1a')]);return _0x207cf7(_0x47bdaa[_0x7f01('0x18')]['message']);}else{logger['info'](_0x7f01('0x13'),_0x7e71b9,_0x7f01('0x14'));_0x207cf7(_0x47bdaa[_0x7f01('0x1b')][_0x7f01('0x1a')]);}})[_0x7f01('0x1c')](function(_0xf3859d){logger[_0x7f01('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x7e71b9,_0xf3859d);_0x33109f(_0xf3859d);});});}exports['GetWhatsappQueue']=function(_0x55d97d){var _0x29f134=this;return new Promise(function(_0x124a26,_0x42d5e9){return db[_0x7f01('0x1d')]['findAll']({'raw':_0x55d97d[_0x7f01('0x1e')]?_0x55d97d['options']['raw']===undefined?!![]:![]:!![],'where':_0x55d97d[_0x7f01('0x1e')]?_0x55d97d['options'][_0x7f01('0x1f')]||null:null,'attributes':_0x55d97d['options']?_0x55d97d['options'][_0x7f01('0x20')]||null:null,'limit':_0x55d97d[_0x7f01('0x1e')]?_0x55d97d[_0x7f01('0x1e')]['limit']||null:null,'include':_0x55d97d[_0x7f01('0x1e')]?_0x55d97d['options'][_0x7f01('0x21')]?_[_0x7f01('0x22')](_0x55d97d[_0x7f01('0x1e')][_0x7f01('0x21')],function(_0x21da09){return{'model':db[_0x21da09[_0x7f01('0x23')]],'as':_0x21da09['as'],'attributes':_0x21da09[_0x7f01('0x20')],'include':_0x21da09[_0x7f01('0x21')]?_['map'](_0x21da09[_0x7f01('0x21')],function(_0x214fcc){return{'model':db[_0x214fcc[_0x7f01('0x23')]],'as':_0x214fcc['as'],'attributes':_0x214fcc[_0x7f01('0x20')],'include':_0x214fcc[_0x7f01('0x21')]?_['map'](_0x214fcc[_0x7f01('0x21')],function(_0x5536e8){return{'model':db[_0x5536e8['model']],'as':_0x5536e8['as'],'attributes':_0x5536e8[_0x7f01('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7f01('0x12')](function(_0x485e6c){logger[_0x7f01('0x24')](_0x7f01('0x25'),_0x55d97d);logger[_0x7f01('0x15')](_0x7f01('0x25'),_0x55d97d,JSON['stringify'](_0x485e6c));_0x124a26(_0x485e6c);})['catch'](function(_0x1f99d9){logger[_0x7f01('0x18')]('GetWhatsappQueue',_0x1f99d9[_0x7f01('0x1a')],_0x55d97d);_0x42d5e9(_0x29f134['error'](0x1f4,_0x1f99d9[_0x7f01('0x1a')]));});});};exports['ShowWhatsappQueue']=function(_0xcbc5cf){var _0x3fb609=this;return new Promise(function(_0x5ec346,_0x1c9603){return db[_0x7f01('0x1d')]['find']({'raw':_0xcbc5cf[_0x7f01('0x1e')]?_0xcbc5cf[_0x7f01('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xcbc5cf[_0x7f01('0x1e')]?_0xcbc5cf['options'][_0x7f01('0x1f')]||null:null,'attributes':_0xcbc5cf['options']?_0xcbc5cf['options'][_0x7f01('0x20')]||null:null,'include':_0xcbc5cf[_0x7f01('0x1e')]?_0xcbc5cf[_0x7f01('0x1e')][_0x7f01('0x21')]?_[_0x7f01('0x22')](_0xcbc5cf[_0x7f01('0x1e')]['include'],function(_0x2245e5){return{'model':db[_0x2245e5[_0x7f01('0x23')]],'as':_0x2245e5['as'],'attributes':_0x2245e5[_0x7f01('0x20')],'include':_0x2245e5[_0x7f01('0x21')]?_[_0x7f01('0x22')](_0x2245e5[_0x7f01('0x21')],function(_0x28fa1e){return{'model':db[_0x28fa1e[_0x7f01('0x23')]],'as':_0x28fa1e['as'],'attributes':_0x28fa1e['attributes'],'include':_0x28fa1e['include']?_['map'](_0x28fa1e[_0x7f01('0x21')],function(_0xd67ce9){return{'model':db[_0xd67ce9['model']],'as':_0xd67ce9['as'],'attributes':_0xd67ce9[_0x7f01('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d4316){logger[_0x7f01('0x24')]('ShowWhatsappQueue',_0xcbc5cf);logger[_0x7f01('0x15')](_0x7f01('0x26'),_0xcbc5cf,JSON[_0x7f01('0x17')](_0x1d4316));_0x5ec346(_0x1d4316);})[_0x7f01('0x1c')](function(_0x369b65){logger[_0x7f01('0x18')](_0x7f01('0x26'),_0x369b65[_0x7f01('0x1a')],_0xcbc5cf);_0x1c9603(_0x3fb609[_0x7f01('0x18')](0x1f4,_0x369b65[_0x7f01('0x1a')]));});});}; \ No newline at end of file +var _0x8b3e=['map','model','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','options','raw','where','attributes','limit','include'];(function(_0x4d28d6,_0x4b8b57){var _0x4bf4a6=function(_0x308402){while(--_0x308402){_0x4d28d6['push'](_0x4d28d6['shift']());}};_0x4bf4a6(++_0x4b8b57);}(_0x8b3e,0x14b));var _0xe8b3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8b3e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe8b3('0x0'));var util=require(_0xe8b3('0x1'));var moment=require(_0xe8b3('0x2'));var BPromise=require(_0xe8b3('0x3'));var rs=require(_0xe8b3('0x4'));var fs=require('fs');var Redis=require(_0xe8b3('0x5'));var db=require(_0xe8b3('0x6'))['db'];var utils=require(_0xe8b3('0x7'));var logger=require(_0xe8b3('0x8'))(_0xe8b3('0x9'));var config=require('../../config/environment');var jayson=require(_0xe8b3('0xa'));var client=jayson[_0xe8b3('0xb')][_0xe8b3('0xc')]({'port':0x232a});config[_0xe8b3('0xd')]=_[_0xe8b3('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe8b3('0xf'))(new Redis(config[_0xe8b3('0xd')]));require(_0xe8b3('0x10'))[_0xe8b3('0x11')](socket);function respondWithRpcPromise(_0x4f64d5,_0x1b54f4,_0xdeb216){return new BPromise(function(_0xa1f4d6,_0x2c5586){return client['request'](_0x4f64d5,_0xdeb216)[_0xe8b3('0x12')](function(_0x5afb2b){logger[_0xe8b3('0x13')](_0xe8b3('0x14'),_0x1b54f4,_0xe8b3('0x15'));logger[_0xe8b3('0x16')](_0xe8b3('0x17'),_0x1b54f4,_0xe8b3('0x15'),JSON[_0xe8b3('0x18')](_0x5afb2b));if(_0x5afb2b[_0xe8b3('0x19')]){if(_0x5afb2b[_0xe8b3('0x19')][_0xe8b3('0x1a')]===0x1f4){logger[_0xe8b3('0x19')](_0xe8b3('0x14'),_0x1b54f4,_0x5afb2b['error'][_0xe8b3('0x1b')]);return _0x2c5586(_0x5afb2b[_0xe8b3('0x19')][_0xe8b3('0x1b')]);}logger[_0xe8b3('0x19')](_0xe8b3('0x14'),_0x1b54f4,_0x5afb2b[_0xe8b3('0x19')][_0xe8b3('0x1b')]);return _0xa1f4d6(_0x5afb2b[_0xe8b3('0x19')][_0xe8b3('0x1b')]);}else{logger[_0xe8b3('0x13')](_0xe8b3('0x14'),_0x1b54f4,_0xe8b3('0x15'));_0xa1f4d6(_0x5afb2b[_0xe8b3('0x1c')][_0xe8b3('0x1b')]);}})[_0xe8b3('0x1d')](function(_0xab8b5b){logger[_0xe8b3('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x1b54f4,_0xab8b5b);_0x2c5586(_0xab8b5b);});});}exports[_0xe8b3('0x1e')]=function(_0x111632){var _0x24f27a=this;return new Promise(function(_0x30898b,_0x5e7604){return db[_0xe8b3('0x1f')]['findAll']({'raw':_0x111632[_0xe8b3('0x20')]?_0x111632[_0xe8b3('0x20')][_0xe8b3('0x21')]===undefined?!![]:![]:!![],'where':_0x111632[_0xe8b3('0x20')]?_0x111632[_0xe8b3('0x20')][_0xe8b3('0x22')]||null:null,'attributes':_0x111632[_0xe8b3('0x20')]?_0x111632[_0xe8b3('0x20')][_0xe8b3('0x23')]||null:null,'limit':_0x111632[_0xe8b3('0x20')]?_0x111632[_0xe8b3('0x20')][_0xe8b3('0x24')]||null:null,'include':_0x111632[_0xe8b3('0x20')]?_0x111632[_0xe8b3('0x20')][_0xe8b3('0x25')]?_[_0xe8b3('0x26')](_0x111632[_0xe8b3('0x20')][_0xe8b3('0x25')],function(_0x3f9d3a){return{'model':db[_0x3f9d3a[_0xe8b3('0x27')]],'as':_0x3f9d3a['as'],'attributes':_0x3f9d3a['attributes'],'include':_0x3f9d3a[_0xe8b3('0x25')]?_[_0xe8b3('0x26')](_0x3f9d3a[_0xe8b3('0x25')],function(_0x4a07d2){return{'model':db[_0x4a07d2['model']],'as':_0x4a07d2['as'],'attributes':_0x4a07d2[_0xe8b3('0x23')],'include':_0x4a07d2[_0xe8b3('0x25')]?_[_0xe8b3('0x26')](_0x4a07d2[_0xe8b3('0x25')],function(_0x15257a){return{'model':db[_0x15257a['model']],'as':_0x15257a['as'],'attributes':_0x15257a[_0xe8b3('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32c584){logger[_0xe8b3('0x13')](_0xe8b3('0x1e'),_0x111632);logger[_0xe8b3('0x16')](_0xe8b3('0x1e'),_0x111632,JSON[_0xe8b3('0x18')](_0x32c584));_0x30898b(_0x32c584);})[_0xe8b3('0x1d')](function(_0x367105){logger[_0xe8b3('0x19')]('GetWhatsappQueue',_0x367105[_0xe8b3('0x1b')],_0x111632);_0x5e7604(_0x24f27a[_0xe8b3('0x19')](0x1f4,_0x367105[_0xe8b3('0x1b')]));});});};exports[_0xe8b3('0x28')]=function(_0x42b386){var _0x11676d=this;return new Promise(function(_0x4104d9,_0x119fff){return db['WhatsappQueue']['find']({'raw':_0x42b386[_0xe8b3('0x20')]?_0x42b386[_0xe8b3('0x20')][_0xe8b3('0x21')]===undefined?!![]:![]:!![],'where':_0x42b386[_0xe8b3('0x20')]?_0x42b386['options'][_0xe8b3('0x22')]||null:null,'attributes':_0x42b386[_0xe8b3('0x20')]?_0x42b386[_0xe8b3('0x20')][_0xe8b3('0x23')]||null:null,'include':_0x42b386[_0xe8b3('0x20')]?_0x42b386[_0xe8b3('0x20')][_0xe8b3('0x25')]?_[_0xe8b3('0x26')](_0x42b386['options'][_0xe8b3('0x25')],function(_0x438aef){return{'model':db[_0x438aef['model']],'as':_0x438aef['as'],'attributes':_0x438aef[_0xe8b3('0x23')],'include':_0x438aef[_0xe8b3('0x25')]?_[_0xe8b3('0x26')](_0x438aef[_0xe8b3('0x25')],function(_0x5f5995){return{'model':db[_0x5f5995[_0xe8b3('0x27')]],'as':_0x5f5995['as'],'attributes':_0x5f5995['attributes'],'include':_0x5f5995[_0xe8b3('0x25')]?_[_0xe8b3('0x26')](_0x5f5995[_0xe8b3('0x25')],function(_0x89bf4f){return{'model':db[_0x89bf4f[_0xe8b3('0x27')]],'as':_0x89bf4f['as'],'attributes':_0x89bf4f[_0xe8b3('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x91b352){logger[_0xe8b3('0x13')]('ShowWhatsappQueue',_0x42b386);logger[_0xe8b3('0x16')](_0xe8b3('0x28'),_0x42b386,JSON[_0xe8b3('0x18')](_0x91b352));_0x4104d9(_0x91b352);})['catch'](function(_0x58947b){logger[_0xe8b3('0x19')](_0xe8b3('0x28'),_0x58947b['message'],_0x42b386);_0x119fff(_0x11676d[_0xe8b3('0x19')](0x1f4,_0x58947b[_0xe8b3('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 478abc7..2986217 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 _0xaed1=['register','length','whatsappQueue:','./whatsappQueue.events','remove','update','emit','removeListener'];(function(_0x1bce75,_0x40f166){var _0x567b24=function(_0x3c0985){while(--_0x3c0985){_0x1bce75['push'](_0x1bce75['shift']());}};_0x567b24(++_0x40f166);}(_0xaed1,0x83));var _0x1aed=function(_0x5cdf5d,_0x616e66){_0x5cdf5d=_0x5cdf5d-0x0;var _0x2b947a=_0xaed1[_0x5cdf5d];return _0x2b947a;};'use strict';var WhatsappQueueEvents=require(_0x1aed('0x0'));var events=['save',_0x1aed('0x1'),_0x1aed('0x2')];function createListener(_0x3aef5d,_0xc137ba){return function(_0x35a447){_0xc137ba[_0x1aed('0x3')](_0x3aef5d,_0x35a447);};}function removeListener(_0x4e3e72,_0xe85e31){return function(){WhatsappQueueEvents[_0x1aed('0x4')](_0x4e3e72,_0xe85e31);};}exports[_0x1aed('0x5')]=function(_0x216488){for(var _0x3e9d3a=0x0,_0x796acb=events[_0x1aed('0x6')];_0x3e9d3a<_0x796acb;_0x3e9d3a++){var _0x147945=events[_0x3e9d3a];var _0xd3d927=createListener(_0x1aed('0x7')+_0x147945,_0x216488);WhatsappQueueEvents['on'](_0x147945,_0xd3d927);}}; \ No newline at end of file +var _0x0f1a=['save','remove','update','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x3ecf65,_0x3bac13){var _0x1907df=function(_0x247dd9){while(--_0x247dd9){_0x3ecf65['push'](_0x3ecf65['shift']());}};_0x1907df(++_0x3bac13);}(_0x0f1a,0x1c1));var _0xa0f1=function(_0x26dc96,_0x10c6f5){_0x26dc96=_0x26dc96-0x0;var _0x30b7be=_0x0f1a[_0x26dc96];return _0x30b7be;};'use strict';var WhatsappQueueEvents=require(_0xa0f1('0x0'));var events=[_0xa0f1('0x1'),_0xa0f1('0x2'),_0xa0f1('0x3')];function createListener(_0x3908f0,_0x33b50a){return function(_0x3fe519){_0x33b50a['emit'](_0x3908f0,_0x3fe519);};}function removeListener(_0x3c88b3,_0x4d5352){return function(){WhatsappQueueEvents['removeListener'](_0x3c88b3,_0x4d5352);};}exports['register']=function(_0x1a8157){for(var _0x57a648=0x0,_0x570ef2=events[_0xa0f1('0x4')];_0x57a648<_0x570ef2;_0x57a648++){var _0xa45d93=events[_0x57a648];var _0x1cd306=createListener(_0xa0f1('0x5')+_0xa45d93,_0x1a8157);WhatsappQueueEvents['on'](_0xa45d93,_0x1cd306);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 68f64a3..20effcf 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 _0x05af=['isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x05af,0xe8));var _0xf05a=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x05af[_0x5a95fa];return _0x1a61b8;};'use strict';var multer=require(_0xf05a('0x0'));var util=require(_0xf05a('0x1'));var path=require('path');var timeout=require(_0xf05a('0x2'));var express=require(_0xf05a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf05a('0x4'));var config=require(_0xf05a('0x5'));var controller=require(_0xf05a('0x6'));router[_0xf05a('0x7')]('/',auth[_0xf05a('0x8')](),controller[_0xf05a('0x9')]);router[_0xf05a('0x7')](_0xf05a('0xa'),auth['isAuthenticated'](),controller[_0xf05a('0xb')]);router['get'](_0xf05a('0xc'),auth[_0xf05a('0x8')](),controller['show']);router[_0xf05a('0xd')]('/',auth[_0xf05a('0x8')](),controller[_0xf05a('0xe')]);router[_0xf05a('0xf')](_0xf05a('0xc'),auth['isAuthenticated'](),controller[_0xf05a('0x10')]);router[_0xf05a('0x11')](_0xf05a('0xc'),auth[_0xf05a('0x8')](),controller[_0xf05a('0x12')]);module[_0xf05a('0x13')]=router; \ No newline at end of file +var _0x3ae9=['describe','show','post','create','put','/:id','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x8466cd,_0x2a3590){var _0x33bf02=function(_0x2ba5a2){while(--_0x2ba5a2){_0x8466cd['push'](_0x8466cd['shift']());}};_0x33bf02(++_0x2a3590);}(_0x3ae9,0x9f));var _0x93ae=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x3ae9[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x93ae('0x0'));var util=require(_0x93ae('0x1'));var path=require('path');var timeout=require(_0x93ae('0x2'));var express=require(_0x93ae('0x3'));var router=express[_0x93ae('0x4')]();var fs_extra=require(_0x93ae('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x93ae('0x6'));var config=require(_0x93ae('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0x93ae('0x8')]('/',auth[_0x93ae('0x9')](),controller[_0x93ae('0xa')]);router[_0x93ae('0x8')](_0x93ae('0xb'),auth[_0x93ae('0x9')](),controller[_0x93ae('0xc')]);router[_0x93ae('0x8')]('/:id',auth[_0x93ae('0x9')](),controller[_0x93ae('0xd')]);router[_0x93ae('0xe')]('/',auth[_0x93ae('0x9')](),controller[_0x93ae('0xf')]);router[_0x93ae('0x10')](_0x93ae('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x93ae('0x12')](_0x93ae('0x11'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index af578d1..19f9448 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(_0x1b17e9,_0xf49b42){var _0xfee9fe=function(_0x559b67){while(--_0x559b67){_0x1b17e9['push'](_0x1b17e9['shift']());}};_0xfee9fe(++_0xf49b42);}(_0x7a54,0x106));var _0x47a5=function(_0x82ad22,_0x3f36fc){_0x82ad22=_0x82ad22-0x0;var _0x3c3dbd=_0x7a54[_0x82ad22];return _0x3c3dbd;};'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(_0x35a07f,_0x425de9){var _0x280fc3=function(_0x4f9866){while(--_0x4f9866){_0x35a07f['push'](_0x35a07f['shift']());}};_0x280fc3(++_0x425de9);}(_0x7a54,0x106));var _0x47a5=function(_0x22c946,_0xef66d5){_0x22c946=_0x22c946-0x0;var _0x4540c7=_0x7a54[_0x22c946];return _0x4540c7;};'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 4892b1d..491f3e2 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 _0x9348=['save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','WhatsappQueueReport','count','include','findAll','show','params','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../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','undefined','set','apply','reject'];(function(_0x12d942,_0x2b39fe){var _0x39a33f=function(_0x3f611d){while(--_0x3f611d){_0x12d942['push'](_0x12d942['shift']());}};_0x39a33f(++_0x2b39fe);}(_0x9348,0x10d));var _0x8934=function(_0x2c3210,_0xa63c1c){_0x2c3210=_0x2c3210-0x0;var _0x4067d3=_0x9348[_0x2c3210];return _0x4067d3;};'use strict';var emlformat=require(_0x8934('0x0'));var rimraf=require(_0x8934('0x1'));var zipdir=require(_0x8934('0x2'));var jsonpatch=require(_0x8934('0x3'));var rp=require(_0x8934('0x4'));var moment=require('moment');var BPromise=require(_0x8934('0x5'));var Mustache=require(_0x8934('0x6'));var util=require('util');var path=require(_0x8934('0x7'));var sox=require(_0x8934('0x8'));var csv=require(_0x8934('0x9'));var ejs=require(_0x8934('0xa'));var fs=require('fs');var fs_extra=require(_0x8934('0xb'));var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var licenseUtil=require(_0x8934('0x17'));var db=require(_0x8934('0x18'))['db'];function respondWithStatusCode(_0x4a999c,_0x68427d){_0x68427d=_0x68427d||0xcc;return function(_0x108eab){if(_0x108eab){return _0x4a999c[_0x8934('0x19')](_0x68427d);}return _0x4a999c[_0x8934('0x1a')](_0x68427d)[_0x8934('0x1b')]();};}function respondWithResult(_0xdf59f4,_0x5b560f){_0x5b560f=_0x5b560f||0xc8;return function(_0x254720){if(_0x254720){return _0xdf59f4[_0x8934('0x1a')](_0x5b560f)[_0x8934('0x1c')](_0x254720);}};}function respondWithFilteredResult(_0x94b948,_0x34d4dc){return function(_0x41e6a9){if(_0x41e6a9){var _0x2a5b04=typeof _0x34d4dc[_0x8934('0x1d')]==='undefined'&&typeof _0x34d4dc[_0x8934('0x1e')]===_0x8934('0x1f');var _0x261c78=_0x41e6a9['count'];var _0x47f25e=_0x2a5b04?0x0:_0x34d4dc['offset'];var _0x2ff9ce=_0x2a5b04?_0x41e6a9['count']:_0x34d4dc[_0x8934('0x1d')]+_0x34d4dc[_0x8934('0x1e')];var _0x14b4e4;if(_0x2ff9ce>=_0x261c78){_0x2ff9ce=_0x261c78;_0x14b4e4=0xc8;}else{_0x14b4e4=0xce;}_0x94b948[_0x8934('0x1a')](_0x14b4e4);return _0x94b948[_0x8934('0x20')]('Content-Range',_0x47f25e+'-'+_0x2ff9ce+'/'+_0x261c78)[_0x8934('0x1c')](_0x41e6a9);}return null;};}function patchUpdates(_0x5ae49f){return function(_0x476c6c){try{jsonpatch[_0x8934('0x21')](_0x476c6c,_0x5ae49f,!![]);}catch(_0x1ccbe5){return BPromise[_0x8934('0x22')](_0x1ccbe5);}return _0x476c6c[_0x8934('0x23')]();};}function saveUpdates(_0x331e18,_0x36fe20){return function(_0x4f4a9b){if(_0x4f4a9b){return _0x4f4a9b[_0x8934('0x24')](_0x331e18)[_0x8934('0x25')](function(_0x32020a){return _0x32020a;});}return null;};}function removeEntity(_0x343e09,_0x43b89a){return function(_0x5e593b){if(_0x5e593b){return _0x5e593b[_0x8934('0x26')]()[_0x8934('0x25')](function(){_0x343e09[_0x8934('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16cfc2,_0x561df2){return function(_0x14c5f0){if(!_0x14c5f0){_0x16cfc2[_0x8934('0x19')](0x194);}return _0x14c5f0;};}function handleError(_0x110f7f,_0x5ef0ed){_0x5ef0ed=_0x5ef0ed||0x1f4;return function(_0x1fd5eb){logger[_0x8934('0x27')](_0x1fd5eb[_0x8934('0x28')]);if(_0x1fd5eb[_0x8934('0x29')]){delete _0x1fd5eb['name'];}_0x110f7f[_0x8934('0x1a')](_0x5ef0ed)[_0x8934('0x2a')](_0x1fd5eb);};}exports[_0x8934('0x2b')]=function(_0x3d93c7,_0x44972b){var _0x20d448={},_0x3f328a={},_0x457634={'count':0x0,'rows':[]};var _0x9c6a71=_[_0x8934('0x2c')](db['WhatsappQueueReport'][_0x8934('0x2d')],function(_0x3e973e){return{'name':_0x3e973e['fieldName'],'type':_0x3e973e[_0x8934('0x2e')][_0x8934('0x2f')]};});_0x3f328a[_0x8934('0x30')]=_[_0x8934('0x2c')](_0x9c6a71,'name');_0x3f328a[_0x8934('0x31')]=_[_0x8934('0x32')](_0x3d93c7[_0x8934('0x31')]);_0x3f328a[_0x8934('0x33')]=_[_0x8934('0x34')](_0x3f328a['model'],_0x3f328a[_0x8934('0x31')]);_0x20d448['attributes']=_['intersection'](_0x3f328a[_0x8934('0x30')],qs[_0x8934('0x35')](_0x3d93c7[_0x8934('0x31')][_0x8934('0x35')]));_0x20d448['attributes']=_0x20d448[_0x8934('0x36')][_0x8934('0x37')]?_0x20d448[_0x8934('0x36')]:_0x3f328a[_0x8934('0x30')];if(!_0x3d93c7[_0x8934('0x31')]['hasOwnProperty'](_0x8934('0x38'))){_0x20d448[_0x8934('0x1e')]=qs['limit'](_0x3d93c7['query'][_0x8934('0x1e')]);_0x20d448[_0x8934('0x1d')]=qs['offset'](_0x3d93c7['query'][_0x8934('0x1d')]);}_0x20d448[_0x8934('0x39')]=qs[_0x8934('0x3a')](_0x3d93c7[_0x8934('0x31')][_0x8934('0x3a')]);_0x20d448[_0x8934('0x3b')]=qs[_0x8934('0x33')](_[_0x8934('0x3c')](_0x3d93c7[_0x8934('0x31')],_0x3f328a[_0x8934('0x33')]),_0x9c6a71);if(_0x3d93c7[_0x8934('0x31')]['filter']){_0x20d448[_0x8934('0x3b')]=_[_0x8934('0x3d')](_0x20d448['where'],{'$or':_[_0x8934('0x2c')](_0x9c6a71,function(_0x122ad1){if(_0x122ad1[_0x8934('0x2e')]!==_0x8934('0x3e')){var _0xb189f1={};_0xb189f1[_0x122ad1['name']]={'$like':'%'+_0x3d93c7['query']['filter']+'%'};return _0xb189f1;}})});}_0x20d448=_[_0x8934('0x3d')]({},_0x20d448,_0x3d93c7[_0x8934('0x3f')]);var _0x8814f6={'where':_0x20d448['where']};return db[_0x8934('0x40')]['count'](_0x8814f6)['then'](function(_0x332098){_0x457634[_0x8934('0x41')]=_0x332098;if(_0x3d93c7['query']['includeAll']){_0x20d448[_0x8934('0x42')]=[{'all':!![]}];}return db[_0x8934('0x40')][_0x8934('0x43')](_0x20d448);})['then'](function(_0x46bfe7){_0x457634['rows']=_0x46bfe7;return _0x457634;})[_0x8934('0x25')](respondWithFilteredResult(_0x44972b,_0x20d448))['catch'](handleError(_0x44972b,null));};exports[_0x8934('0x44')]=function(_0x476ed9,_0x83be9e){var _0x566d67={'raw':!![],'where':{'id':_0x476ed9[_0x8934('0x45')]['id']}},_0xefdfab={};_0xefdfab[_0x8934('0x30')]=_[_0x8934('0x32')](db['WhatsappQueueReport'][_0x8934('0x2d')]);_0xefdfab[_0x8934('0x31')]=_[_0x8934('0x32')](_0x476ed9[_0x8934('0x31')]);_0xefdfab[_0x8934('0x33')]=_[_0x8934('0x34')](_0xefdfab[_0x8934('0x30')],_0xefdfab[_0x8934('0x31')]);_0x566d67['attributes']=_['intersection'](_0xefdfab['model'],qs[_0x8934('0x35')](_0x476ed9[_0x8934('0x31')]['fields']));_0x566d67[_0x8934('0x36')]=_0x566d67['attributes'][_0x8934('0x37')]?_0x566d67[_0x8934('0x36')]:_0xefdfab['model'];if(_0x476ed9[_0x8934('0x31')][_0x8934('0x46')]){_0x566d67[_0x8934('0x42')]=[{'all':!![]}];}_0x566d67=_[_0x8934('0x3d')]({},_0x566d67,_0x476ed9['options']);return db[_0x8934('0x40')][_0x8934('0x47')](_0x566d67)['then'](handleEntityNotFound(_0x83be9e,null))[_0x8934('0x25')](respondWithResult(_0x83be9e,null))[_0x8934('0x48')](handleError(_0x83be9e,null));};exports[_0x8934('0x49')]=function(_0x2d5c6a,_0x406d0a){return db[_0x8934('0x40')][_0x8934('0x49')](_0x2d5c6a[_0x8934('0x4a')],{})[_0x8934('0x25')](respondWithResult(_0x406d0a,0xc9))[_0x8934('0x48')](handleError(_0x406d0a,null));};exports[_0x8934('0x24')]=function(_0xe212bc,_0x2c322d){if(_0xe212bc[_0x8934('0x4a')]['id']){delete _0xe212bc[_0x8934('0x4a')]['id'];}return db[_0x8934('0x40')][_0x8934('0x47')]({'where':{'id':_0xe212bc[_0x8934('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c322d,null))[_0x8934('0x25')](saveUpdates(_0xe212bc[_0x8934('0x4a')],null))['then'](respondWithResult(_0x2c322d,null))['catch'](handleError(_0x2c322d,null));};exports['destroy']=function(_0x4bc431,_0x3610a0){return db[_0x8934('0x40')][_0x8934('0x47')]({'where':{'id':_0x4bc431['params']['id']}})['then'](handleEntityNotFound(_0x3610a0,null))[_0x8934('0x25')](removeEntity(_0x3610a0,null))['catch'](handleError(_0x3610a0,null));};exports['describe']=function(_0xce93cd,_0x2778f9){return db[_0x8934('0x40')][_0x8934('0x4b')]()[_0x8934('0x25')](respondWithResult(_0x2778f9,null))[_0x8934('0x48')](handleError(_0x2778f9,null));}; \ No newline at end of file +var _0xb9be=['ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','end','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','WhatsappQueueReport','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','map','options','includeAll','include','show','params','rawAttributes','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb9be,0xc5));var _0xeb9b=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xb9be[_0x21549c];return _0x426cbd;};'use strict';var emlformat=require(_0xeb9b('0x0'));var rimraf=require(_0xeb9b('0x1'));var zipdir=require(_0xeb9b('0x2'));var jsonpatch=require(_0xeb9b('0x3'));var rp=require(_0xeb9b('0x4'));var moment=require(_0xeb9b('0x5'));var BPromise=require(_0xeb9b('0x6'));var Mustache=require(_0xeb9b('0x7'));var util=require(_0xeb9b('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xeb9b('0x9'));var ejs=require(_0xeb9b('0xa'));var fs=require('fs');var fs_extra=require(_0xeb9b('0xb'));var _=require('lodash');var squel=require(_0xeb9b('0xc'));var crypto=require(_0xeb9b('0xd'));var jsforce=require(_0xeb9b('0xe'));var deskjs=require(_0xeb9b('0xf'));var toCsv=require(_0xeb9b('0x9'));var querystring=require(_0xeb9b('0x10'));var Papa=require(_0xeb9b('0x11'));var Redis=require(_0xeb9b('0x12'));var authService=require(_0xeb9b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb9b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb9b('0x15'));var utils=require(_0xeb9b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xeb9b('0x17'));var db=require(_0xeb9b('0x18'))['db'];function respondWithStatusCode(_0x3df18a,_0x2a01df){_0x2a01df=_0x2a01df||0xcc;return function(_0x51598f){if(_0x51598f){return _0x3df18a['sendStatus'](_0x2a01df);}return _0x3df18a['status'](_0x2a01df)[_0xeb9b('0x19')]();};}function respondWithResult(_0x1ef03f,_0x2674e6){_0x2674e6=_0x2674e6||0xc8;return function(_0x4ec46d){if(_0x4ec46d){return _0x1ef03f['status'](_0x2674e6)['json'](_0x4ec46d);}};}function respondWithFilteredResult(_0x32538b,_0x1a5f27){return function(_0x406afd){if(_0x406afd){var _0x3fa308=typeof _0x1a5f27[_0xeb9b('0x1a')]===_0xeb9b('0x1b')&&typeof _0x1a5f27[_0xeb9b('0x1c')]==='undefined';var _0x2e8645=_0x406afd[_0xeb9b('0x1d')];var _0x21aca6=_0x3fa308?0x0:_0x1a5f27[_0xeb9b('0x1a')];var _0x3cbe3e=_0x3fa308?_0x406afd[_0xeb9b('0x1d')]:_0x1a5f27[_0xeb9b('0x1a')]+_0x1a5f27[_0xeb9b('0x1c')];var _0x2c199f;if(_0x3cbe3e>=_0x2e8645){_0x3cbe3e=_0x2e8645;_0x2c199f=0xc8;}else{_0x2c199f=0xce;}_0x32538b[_0xeb9b('0x1e')](_0x2c199f);return _0x32538b['set'](_0xeb9b('0x1f'),_0x21aca6+'-'+_0x3cbe3e+'/'+_0x2e8645)['json'](_0x406afd);}return null;};}function patchUpdates(_0x5d5f54){return function(_0x580498){try{jsonpatch[_0xeb9b('0x20')](_0x580498,_0x5d5f54,!![]);}catch(_0x4ab4b8){return BPromise[_0xeb9b('0x21')](_0x4ab4b8);}return _0x580498[_0xeb9b('0x22')]();};}function saveUpdates(_0x37935c,_0x37d7e0){return function(_0x3c8be7){if(_0x3c8be7){return _0x3c8be7[_0xeb9b('0x23')](_0x37935c)[_0xeb9b('0x24')](function(_0x15e5b8){return _0x15e5b8;});}return null;};}function removeEntity(_0x142d1c,_0x46df93){return function(_0x61c86d){if(_0x61c86d){return _0x61c86d[_0xeb9b('0x25')]()[_0xeb9b('0x24')](function(){_0x142d1c[_0xeb9b('0x1e')](0xcc)[_0xeb9b('0x19')]();});}};}function handleEntityNotFound(_0x434461,_0x4c997e){return function(_0xd57390){if(!_0xd57390){_0x434461['sendStatus'](0x194);}return _0xd57390;};}function handleError(_0x66a567,_0x5d6846){_0x5d6846=_0x5d6846||0x1f4;return function(_0x347ec1){logger[_0xeb9b('0x26')](_0x347ec1[_0xeb9b('0x27')]);if(_0x347ec1[_0xeb9b('0x28')]){delete _0x347ec1['name'];}_0x66a567[_0xeb9b('0x1e')](_0x5d6846)[_0xeb9b('0x29')](_0x347ec1);};}exports['index']=function(_0x35ff07,_0x33bb1d){var _0x5ce745={},_0x2a4b51={},_0x2ea20f={'count':0x0,'rows':[]};var _0x4188d5=_['map'](db[_0xeb9b('0x2a')]['rawAttributes'],function(_0x6bb66){return{'name':_0x6bb66['fieldName'],'type':_0x6bb66[_0xeb9b('0x2b')]['key']};});_0x2a4b51[_0xeb9b('0x2c')]=_['map'](_0x4188d5,_0xeb9b('0x28'));_0x2a4b51['query']=_[_0xeb9b('0x2d')](_0x35ff07[_0xeb9b('0x2e')]);_0x2a4b51[_0xeb9b('0x2f')]=_[_0xeb9b('0x30')](_0x2a4b51[_0xeb9b('0x2c')],_0x2a4b51[_0xeb9b('0x2e')]);_0x5ce745[_0xeb9b('0x31')]=_[_0xeb9b('0x30')](_0x2a4b51[_0xeb9b('0x2c')],qs[_0xeb9b('0x32')](_0x35ff07['query'][_0xeb9b('0x32')]));_0x5ce745[_0xeb9b('0x31')]=_0x5ce745[_0xeb9b('0x31')][_0xeb9b('0x33')]?_0x5ce745[_0xeb9b('0x31')]:_0x2a4b51[_0xeb9b('0x2c')];if(!_0x35ff07[_0xeb9b('0x2e')]['hasOwnProperty'](_0xeb9b('0x34'))){_0x5ce745[_0xeb9b('0x1c')]=qs[_0xeb9b('0x1c')](_0x35ff07['query'][_0xeb9b('0x1c')]);_0x5ce745[_0xeb9b('0x1a')]=qs[_0xeb9b('0x1a')](_0x35ff07[_0xeb9b('0x2e')][_0xeb9b('0x1a')]);}_0x5ce745[_0xeb9b('0x35')]=qs['sort'](_0x35ff07[_0xeb9b('0x2e')][_0xeb9b('0x36')]);_0x5ce745['where']=qs[_0xeb9b('0x2f')](_[_0xeb9b('0x37')](_0x35ff07[_0xeb9b('0x2e')],_0x2a4b51[_0xeb9b('0x2f')]),_0x4188d5);if(_0x35ff07[_0xeb9b('0x2e')][_0xeb9b('0x38')]){_0x5ce745[_0xeb9b('0x39')]=_['merge'](_0x5ce745[_0xeb9b('0x39')],{'$or':_[_0xeb9b('0x3a')](_0x4188d5,function(_0x3b5472){if(_0x3b5472['type']!=='VIRTUAL'){var _0x4eacc3={};_0x4eacc3[_0x3b5472[_0xeb9b('0x28')]]={'$like':'%'+_0x35ff07[_0xeb9b('0x2e')][_0xeb9b('0x38')]+'%'};return _0x4eacc3;}})});}_0x5ce745=_['merge']({},_0x5ce745,_0x35ff07[_0xeb9b('0x3b')]);var _0x9b36ae={'where':_0x5ce745[_0xeb9b('0x39')]};return db[_0xeb9b('0x2a')][_0xeb9b('0x1d')](_0x9b36ae)[_0xeb9b('0x24')](function(_0x377c9d){_0x2ea20f['count']=_0x377c9d;if(_0x35ff07[_0xeb9b('0x2e')][_0xeb9b('0x3c')]){_0x5ce745[_0xeb9b('0x3d')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x5ce745);})[_0xeb9b('0x24')](function(_0x110122){_0x2ea20f['rows']=_0x110122;return _0x2ea20f;})[_0xeb9b('0x24')](respondWithFilteredResult(_0x33bb1d,_0x5ce745))['catch'](handleError(_0x33bb1d,null));};exports[_0xeb9b('0x3e')]=function(_0xcce4da,_0x28b075){var _0x300565={'raw':!![],'where':{'id':_0xcce4da[_0xeb9b('0x3f')]['id']}},_0xbee63e={};_0xbee63e[_0xeb9b('0x2c')]=_[_0xeb9b('0x2d')](db[_0xeb9b('0x2a')][_0xeb9b('0x40')]);_0xbee63e[_0xeb9b('0x2e')]=_[_0xeb9b('0x2d')](_0xcce4da['query']);_0xbee63e['filters']=_[_0xeb9b('0x30')](_0xbee63e['model'],_0xbee63e[_0xeb9b('0x2e')]);_0x300565[_0xeb9b('0x31')]=_[_0xeb9b('0x30')](_0xbee63e['model'],qs[_0xeb9b('0x32')](_0xcce4da[_0xeb9b('0x2e')]['fields']));_0x300565[_0xeb9b('0x31')]=_0x300565[_0xeb9b('0x31')][_0xeb9b('0x33')]?_0x300565[_0xeb9b('0x31')]:_0xbee63e[_0xeb9b('0x2c')];if(_0xcce4da[_0xeb9b('0x2e')][_0xeb9b('0x3c')]){_0x300565[_0xeb9b('0x3d')]=[{'all':!![]}];}_0x300565=_['merge']({},_0x300565,_0xcce4da['options']);return db[_0xeb9b('0x2a')]['find'](_0x300565)['then'](handleEntityNotFound(_0x28b075,null))[_0xeb9b('0x24')](respondWithResult(_0x28b075,null))[_0xeb9b('0x41')](handleError(_0x28b075,null));};exports[_0xeb9b('0x42')]=function(_0x195f5a,_0x45bc74){return db[_0xeb9b('0x2a')]['create'](_0x195f5a['body'],{})['then'](respondWithResult(_0x45bc74,0xc9))[_0xeb9b('0x41')](handleError(_0x45bc74,null));};exports['update']=function(_0x4901b0,_0x2ee59c){if(_0x4901b0[_0xeb9b('0x43')]['id']){delete _0x4901b0[_0xeb9b('0x43')]['id'];}return db[_0xeb9b('0x2a')][_0xeb9b('0x44')]({'where':{'id':_0x4901b0[_0xeb9b('0x3f')]['id']}})[_0xeb9b('0x24')](handleEntityNotFound(_0x2ee59c,null))[_0xeb9b('0x24')](saveUpdates(_0x4901b0[_0xeb9b('0x43')],null))['then'](respondWithResult(_0x2ee59c,null))['catch'](handleError(_0x2ee59c,null));};exports[_0xeb9b('0x25')]=function(_0x21c93a,_0x542ef4){return db[_0xeb9b('0x2a')]['find']({'where':{'id':_0x21c93a[_0xeb9b('0x3f')]['id']}})[_0xeb9b('0x24')](handleEntityNotFound(_0x542ef4,null))['then'](removeEntity(_0x542ef4,null))['catch'](handleError(_0x542ef4,null));};exports['describe']=function(_0x211238,_0x32d8cd){return db[_0xeb9b('0x2a')]['describe']()['then'](respondWithResult(_0x32d8cd,null))[_0xeb9b('0x41')](handleError(_0x32d8cd,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 783c962..6007498 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 _0xccc1=['path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3d5df9,_0x5b3623){var _0x50ba39=function(_0x3c0de0){while(--_0x3c0de0){_0x3d5df9['push'](_0x3d5df9['shift']());}};_0x50ba39(++_0x5b3623);}(_0xccc1,0x107));var _0x1ccc=function(_0x21b74b,_0x543c76){_0x21b74b=_0x21b74b-0x0;var _0x518cc6=_0xccc1[_0x21b74b];return _0x518cc6;};'use strict';var _=require(_0x1ccc('0x0'));var util=require(_0x1ccc('0x1'));var logger=require(_0x1ccc('0x2'))(_0x1ccc('0x3'));var moment=require(_0x1ccc('0x4'));var BPromise=require(_0x1ccc('0x5'));var rp=require(_0x1ccc('0x6'));var fs=require('fs');var path=require(_0x1ccc('0x7'));var rimraf=require(_0x1ccc('0x8'));var config=require(_0x1ccc('0x9'));var attributes=require(_0x1ccc('0xa'));module['exports']=function(_0x5d5201,_0x36cb02){return _0x5d5201[_0x1ccc('0xb')](_0x1ccc('0xc'),attributes,{'tableName':_0x1ccc('0xd'),'paranoid':![],'indexes':[{'name':_0x1ccc('0xe'),'fields':[_0x1ccc('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x52ac=['request-promise','path','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x1826fa,_0x391e3a){var _0x1316f6=function(_0x2af398){while(--_0x2af398){_0x1826fa['push'](_0x1826fa['shift']());}};_0x1316f6(++_0x391e3a);}(_0x52ac,0xe0));var _0xc52a=function(_0x8426a0,_0x183ad8){_0x8426a0=_0x8426a0-0x0;var _0x4f71e3=_0x52ac[_0x8426a0];return _0x4f71e3;};'use strict';var _=require(_0xc52a('0x0'));var util=require('util');var logger=require(_0xc52a('0x1'))(_0xc52a('0x2'));var moment=require(_0xc52a('0x3'));var BPromise=require('bluebird');var rp=require(_0xc52a('0x4'));var fs=require('fs');var path=require(_0xc52a('0x5'));var rimraf=require('rimraf');var config=require(_0xc52a('0x6'));var attributes=require(_0xc52a('0x7'));module['exports']=function(_0x5bed7e,_0x16e176){return _0x5bed7e[_0xc52a('0x8')](_0xc52a('0x9'),attributes,{'tableName':_0xc52a('0xa'),'paranoid':![],'indexes':[{'name':_0xc52a('0xb'),'fields':[_0xc52a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index a460f03..6dfaf83 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 _0x95c3=['message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','raw','update','options','attributes','limit','UpdateWhatsappQueueReport','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x223461,_0x2bca70){var _0x4dbe0a=function(_0x3c3cb6){while(--_0x3c3cb6){_0x223461['push'](_0x223461['shift']());}};_0x4dbe0a(++_0x2bca70);}(_0x95c3,0x6d));var _0x395c=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x95c3[_0xbe200f];return _0x192597;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x395c('0x0'));var BPromise=require(_0x395c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x395c('0x2'))['db'];var utils=require(_0x395c('0x3'));var logger=require(_0x395c('0x4'))(_0x395c('0x5'));var config=require(_0x395c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x395c('0x7')][_0x395c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d2d61,_0x385f6d,_0x8422f){return new BPromise(function(_0x1fdb0e,_0x340766){return client[_0x395c('0x9')](_0x3d2d61,_0x8422f)[_0x395c('0xa')](function(_0x2601c2){logger[_0x395c('0xb')](_0x395c('0xc'),_0x385f6d,'request\x20sent');logger[_0x395c('0xd')](_0x395c('0xe'),_0x385f6d,_0x395c('0xf'),JSON[_0x395c('0x10')](_0x2601c2));if(_0x2601c2['error']){if(_0x2601c2[_0x395c('0x11')][_0x395c('0x12')]===0x1f4){logger['error'](_0x395c('0xc'),_0x385f6d,_0x2601c2[_0x395c('0x11')][_0x395c('0x13')]);return _0x340766(_0x2601c2[_0x395c('0x11')]['message']);}logger[_0x395c('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x385f6d,_0x2601c2['error']['message']);return _0x1fdb0e(_0x2601c2[_0x395c('0x11')][_0x395c('0x13')]);}else{logger[_0x395c('0xb')](_0x395c('0xc'),_0x385f6d,_0x395c('0xf'));_0x1fdb0e(_0x2601c2[_0x395c('0x14')][_0x395c('0x13')]);}})[_0x395c('0x15')](function(_0x2e63b0){logger[_0x395c('0x11')](_0x395c('0xc'),_0x385f6d,_0x2e63b0);_0x340766(_0x2e63b0);});});}exports[_0x395c('0x16')]=function(_0x55516b){var _0x57054d=this;return new Promise(function(_0x202efc,_0x11c7d5){return db[_0x395c('0x17')][_0x395c('0x18')](_0x55516b[_0x395c('0x19')],{'raw':_0x55516b['options']?_0x55516b['options'][_0x395c('0x1a')]===undefined?!![]:![]:!![]})[_0x395c('0xa')](function(_0x32d669){logger[_0x395c('0xb')](_0x395c('0x16'),_0x55516b);logger[_0x395c('0xd')](_0x395c('0x16'),_0x55516b,JSON[_0x395c('0x10')](_0x32d669));_0x202efc(_0x32d669);})[_0x395c('0x15')](function(_0x11b802){logger[_0x395c('0x11')](_0x395c('0x16'),_0x11b802[_0x395c('0x13')],_0x55516b);_0x11c7d5(_0x57054d[_0x395c('0x11')](0x1f4,_0x11b802[_0x395c('0x13')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x404384){var _0x221350=this;return new Promise(function(_0x56faad,_0x135d31){return db[_0x395c('0x17')][_0x395c('0x1b')](_0x404384['body'],{'raw':_0x404384[_0x395c('0x1c')]?_0x404384[_0x395c('0x1c')][_0x395c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x404384[_0x395c('0x1c')]?_0x404384[_0x395c('0x1c')]['where']||null:null,'attributes':_0x404384[_0x395c('0x1c')]?_0x404384['options'][_0x395c('0x1d')]||null:null,'limit':_0x404384[_0x395c('0x1c')]?_0x404384[_0x395c('0x1c')][_0x395c('0x1e')]||null:null})[_0x395c('0xa')](function(_0x26343c){logger[_0x395c('0xb')](_0x395c('0x1f'),_0x404384);logger[_0x395c('0xd')]('UpdateWhatsappQueueReport',_0x404384,JSON[_0x395c('0x10')](_0x26343c));_0x56faad(_0x26343c);})[_0x395c('0x15')](function(_0x500e15){logger[_0x395c('0x11')](_0x395c('0x1f'),_0x500e15[_0x395c('0x13')],_0x404384);_0x135d31(_0x221350[_0x395c('0x11')](0x1f4,_0x500e15[_0x395c('0x13')]));});});}; \ No newline at end of file +var _0xbe7a=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateWhatsappQueueReport','create','body','raw','then','UpdateWhatsappQueueReport','update','options','attributes'];(function(_0x47eacf,_0x1b00a7){var _0x6706e9=function(_0x4841f8){while(--_0x4841f8){_0x47eacf['push'](_0x47eacf['shift']());}};_0x6706e9(++_0x1b00a7);}(_0xbe7a,0x1e0));var _0xabe7=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xbe7a[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xabe7('0x0'));var util=require(_0xabe7('0x1'));var moment=require(_0xabe7('0x2'));var BPromise=require(_0xabe7('0x3'));var rs=require(_0xabe7('0x4'));var fs=require('fs');var Redis=require(_0xabe7('0x5'));var db=require(_0xabe7('0x6'))['db'];var utils=require(_0xabe7('0x7'));var logger=require(_0xabe7('0x8'))(_0xabe7('0x9'));var config=require(_0xabe7('0xa'));var jayson=require(_0xabe7('0xb'));var client=jayson[_0xabe7('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4db0e7,_0x632d8,_0xdc4e68){return new BPromise(function(_0x119515,_0x587c0b){return client['request'](_0x4db0e7,_0xdc4e68)['then'](function(_0xe46647){logger[_0xabe7('0xd')](_0xabe7('0xe'),_0x632d8,'request\x20sent');logger[_0xabe7('0xf')](_0xabe7('0x10'),_0x632d8,_0xabe7('0x11'),JSON[_0xabe7('0x12')](_0xe46647));if(_0xe46647[_0xabe7('0x13')]){if(_0xe46647[_0xabe7('0x13')][_0xabe7('0x14')]===0x1f4){logger[_0xabe7('0x13')](_0xabe7('0xe'),_0x632d8,_0xe46647['error'][_0xabe7('0x15')]);return _0x587c0b(_0xe46647['error'][_0xabe7('0x15')]);}logger[_0xabe7('0x13')](_0xabe7('0xe'),_0x632d8,_0xe46647[_0xabe7('0x13')][_0xabe7('0x15')]);return _0x119515(_0xe46647[_0xabe7('0x13')][_0xabe7('0x15')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x632d8,_0xabe7('0x11'));_0x119515(_0xe46647['result'][_0xabe7('0x15')]);}})[_0xabe7('0x16')](function(_0x40a529){logger['error'](_0xabe7('0xe'),_0x632d8,_0x40a529);_0x587c0b(_0x40a529);});});}exports[_0xabe7('0x17')]=function(_0x2c38c7){var _0x4d97ec=this;return new Promise(function(_0x44e15b,_0x3565b2){return db['WhatsappQueueReport'][_0xabe7('0x18')](_0x2c38c7[_0xabe7('0x19')],{'raw':_0x2c38c7['options']?_0x2c38c7['options'][_0xabe7('0x1a')]===undefined?!![]:![]:!![]})[_0xabe7('0x1b')](function(_0x188d6a){logger[_0xabe7('0xd')](_0xabe7('0x17'),_0x2c38c7);logger[_0xabe7('0xf')]('CreateWhatsappQueueReport',_0x2c38c7,JSON[_0xabe7('0x12')](_0x188d6a));_0x44e15b(_0x188d6a);})[_0xabe7('0x16')](function(_0x583bcb){logger['error'](_0xabe7('0x17'),_0x583bcb[_0xabe7('0x15')],_0x2c38c7);_0x3565b2(_0x4d97ec['error'](0x1f4,_0x583bcb[_0xabe7('0x15')]));});});};exports[_0xabe7('0x1c')]=function(_0x34ec65){var _0x5bbaa4=this;return new Promise(function(_0x46f795,_0x25d9ed){return db['WhatsappQueueReport'][_0xabe7('0x1d')](_0x34ec65[_0xabe7('0x19')],{'raw':_0x34ec65['options']?_0x34ec65[_0xabe7('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34ec65[_0xabe7('0x1e')]?_0x34ec65['options']['where']||null:null,'attributes':_0x34ec65[_0xabe7('0x1e')]?_0x34ec65[_0xabe7('0x1e')][_0xabe7('0x1f')]||null:null,'limit':_0x34ec65[_0xabe7('0x1e')]?_0x34ec65['options']['limit']||null:null})[_0xabe7('0x1b')](function(_0x489b1a){logger[_0xabe7('0xd')](_0xabe7('0x1c'),_0x34ec65);logger['debug'](_0xabe7('0x1c'),_0x34ec65,JSON[_0xabe7('0x12')](_0x489b1a));_0x46f795(_0x489b1a);})[_0xabe7('0x16')](function(_0x51ddd8){logger[_0xabe7('0x13')](_0xabe7('0x1c'),_0x51ddd8[_0xabe7('0x15')],_0x34ec65);_0x25d9ed(_0x5bbaa4[_0xabe7('0x13')](0x1f4,_0x51ddd8[_0xabe7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index f5e012a..7279693 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 _0x748c=['post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show'];(function(_0xa6e4c8,_0x52e242){var _0x29e0c8=function(_0x2caaf2){while(--_0x2caaf2){_0xa6e4c8['push'](_0xa6e4c8['shift']());}};_0x29e0c8(++_0x52e242);}(_0x748c,0x94));var _0xc748=function(_0x237b37,_0x1021d3){_0x237b37=_0x237b37-0x0;var _0x5706c5=_0x748c[_0x237b37];return _0x5706c5;};'use strict';var multer=require(_0xc748('0x0'));var util=require(_0xc748('0x1'));var path=require(_0xc748('0x2'));var timeout=require(_0xc748('0x3'));var express=require('express');var router=express[_0xc748('0x4')]();var fs_extra=require(_0xc748('0x5'));var auth=require(_0xc748('0x6'));var interaction=require(_0xc748('0x7'));var config=require('../../config/environment');var controller=require('./whatsappTransferReport.controller');router[_0xc748('0x8')]('/',auth[_0xc748('0x9')](),controller[_0xc748('0xa')]);router[_0xc748('0x8')]('/describe',auth[_0xc748('0x9')](),controller['describe']);router[_0xc748('0x8')]('/:id',auth[_0xc748('0x9')](),controller[_0xc748('0xb')]);router[_0xc748('0xc')]('/',auth[_0xc748('0x9')](),controller[_0xc748('0xd')]);router[_0xc748('0xe')](_0xc748('0xf'),auth[_0xc748('0x9')](),controller[_0xc748('0x10')]);router[_0xc748('0x11')](_0xc748('0xf'),auth[_0xc748('0x9')](),controller[_0xc748('0x12')]);module[_0xc748('0x13')]=router; \ No newline at end of file +var _0x5e4f=['show','post','create','put','update','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x5e4f,0x168));var _0xf5e4=function(_0x529059,_0x294a33){_0x529059=_0x529059-0x0;var _0x156bc2=_0x5e4f[_0x529059];return _0x156bc2;};'use strict';var multer=require(_0xf5e4('0x0'));var util=require(_0xf5e4('0x1'));var path=require(_0xf5e4('0x2'));var timeout=require('connect-timeout');var express=require(_0xf5e4('0x3'));var router=express[_0xf5e4('0x4')]();var fs_extra=require(_0xf5e4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf5e4('0x6'));var config=require(_0xf5e4('0x7'));var controller=require(_0xf5e4('0x8'));router[_0xf5e4('0x9')]('/',auth[_0xf5e4('0xa')](),controller[_0xf5e4('0xb')]);router[_0xf5e4('0x9')](_0xf5e4('0xc'),auth[_0xf5e4('0xa')](),controller[_0xf5e4('0xd')]);router[_0xf5e4('0x9')]('/:id',auth[_0xf5e4('0xa')](),controller[_0xf5e4('0xe')]);router[_0xf5e4('0xf')]('/',auth[_0xf5e4('0xa')](),controller[_0xf5e4('0x10')]);router[_0xf5e4('0x11')]('/:id',auth[_0xf5e4('0xa')](),controller[_0xf5e4('0x12')]);router['delete'](_0xf5e4('0x13'),auth['isAuthenticated'](),controller[_0xf5e4('0x14')]);module[_0xf5e4('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index d4b59c5..2a6e791 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 _0x896e=['DATE','sequelize','exports','STRING','ENUM','account','agent','queue'];(function(_0x592c94,_0x3295a4){var _0x722e9c=function(_0x2a9b60){while(--_0x2a9b60){_0x592c94['push'](_0x592c94['shift']());}};_0x722e9c(++_0x3295a4);}(_0x896e,0x1e9));var _0xe896=function(_0x5c080f,_0x3405da){_0x5c080f=_0x5c080f-0x0;var _0x193a59=_0x896e[_0x5c080f];return _0x193a59;};'use strict';var Sequelize=require(_0xe896('0x0'));module[_0xe896('0x1')]={'uniqueid':{'type':Sequelize[_0xe896('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe896('0x3')](_0xe896('0x4'),_0xe896('0x5'),_0xe896('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xe896('0x7')]}}; \ No newline at end of file +var _0xa664=['queue','exports','STRING','ENUM','account'];(function(_0x522be1,_0x1cff04){var _0x40596c=function(_0x3dc67a){while(--_0x3dc67a){_0x522be1['push'](_0x522be1['shift']());}};_0x40596c(++_0x1cff04);}(_0xa664,0x132));var _0x4a66=function(_0x7190b4,_0x480596){_0x7190b4=_0x7190b4-0x0;var _0x1d7c5e=_0xa664[_0x7190b4];return _0x1d7c5e;};'use strict';var Sequelize=require('sequelize');module[_0x4a66('0x0')]={'uniqueid':{'type':Sequelize[_0x4a66('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x4a66('0x2')](_0x4a66('0x3'),'agent',_0x4a66('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 6a0bb7d..069bb49 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 _0x9370=['reject','save','then','destroy','error','stack','index','WhatsappTransferReport','key','model','map','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','options','findAll','rows','show','params','filters','includeAll','include','merge','find','catch','create','body','update','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x9370,0x158));var _0x0937=function(_0x8d8ada,_0x35824c){_0x8d8ada=_0x8d8ada-0x0;var _0x406e2e=_0x9370[_0x8d8ada];return _0x406e2e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0937('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0937('0x1'));var rp=require(_0x0937('0x2'));var moment=require(_0x0937('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0937('0x4'));var util=require(_0x0937('0x5'));var path=require(_0x0937('0x6'));var sox=require(_0x0937('0x7'));var csv=require(_0x0937('0x8'));var ejs=require(_0x0937('0x9'));var fs=require('fs');var fs_extra=require(_0x0937('0xa'));var _=require(_0x0937('0xb'));var squel=require(_0x0937('0xc'));var crypto=require(_0x0937('0xd'));var jsforce=require(_0x0937('0xe'));var deskjs=require(_0x0937('0xf'));var toCsv=require(_0x0937('0x8'));var querystring=require(_0x0937('0x10'));var Papa=require(_0x0937('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0937('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0937('0x13'));var logger=require(_0x0937('0x14'))(_0x0937('0x15'));var utils=require(_0x0937('0x16'));var config=require(_0x0937('0x17'));var licenseUtil=require(_0x0937('0x18'));var db=require(_0x0937('0x19'))['db'];function respondWithStatusCode(_0x303015,_0x4cb87e){_0x4cb87e=_0x4cb87e||0xcc;return function(_0x4b52cc){if(_0x4b52cc){return _0x303015[_0x0937('0x1a')](_0x4cb87e);}return _0x303015['status'](_0x4cb87e)[_0x0937('0x1b')]();};}function respondWithResult(_0x1097d4,_0x20fec8){_0x20fec8=_0x20fec8||0xc8;return function(_0x185231){if(_0x185231){return _0x1097d4['status'](_0x20fec8)[_0x0937('0x1c')](_0x185231);}};}function respondWithFilteredResult(_0x487ca2,_0xfaa593){return function(_0x3454eb){if(_0x3454eb){var _0x4d519f=typeof _0xfaa593['offset']==='undefined'&&typeof _0xfaa593['limit']==='undefined';var _0x3ac3f3=_0x3454eb[_0x0937('0x1d')];var _0x53a44c=_0x4d519f?0x0:_0xfaa593[_0x0937('0x1e')];var _0x95ef50=_0x4d519f?_0x3454eb[_0x0937('0x1d')]:_0xfaa593[_0x0937('0x1e')]+_0xfaa593[_0x0937('0x1f')];var _0x1bf05e;if(_0x95ef50>=_0x3ac3f3){_0x95ef50=_0x3ac3f3;_0x1bf05e=0xc8;}else{_0x1bf05e=0xce;}_0x487ca2[_0x0937('0x20')](_0x1bf05e);return _0x487ca2[_0x0937('0x21')](_0x0937('0x22'),_0x53a44c+'-'+_0x95ef50+'/'+_0x3ac3f3)['json'](_0x3454eb);}return null;};}function patchUpdates(_0x2e8fe6){return function(_0x13267e){try{jsonpatch[_0x0937('0x23')](_0x13267e,_0x2e8fe6,!![]);}catch(_0x55008a){return BPromise[_0x0937('0x24')](_0x55008a);}return _0x13267e[_0x0937('0x25')]();};}function saveUpdates(_0x5c3194,_0x463e56){return function(_0x421b92){if(_0x421b92){return _0x421b92['update'](_0x5c3194)[_0x0937('0x26')](function(_0x51e9d5){return _0x51e9d5;});}return null;};}function removeEntity(_0x2dd8cb,_0x3b3f75){return function(_0x39acc6){if(_0x39acc6){return _0x39acc6[_0x0937('0x27')]()['then'](function(){_0x2dd8cb['status'](0xcc)[_0x0937('0x1b')]();});}};}function handleEntityNotFound(_0xb460d5,_0x8b831a){return function(_0x128fb3){if(!_0x128fb3){_0xb460d5['sendStatus'](0x194);}return _0x128fb3;};}function handleError(_0x16e5f7,_0x2ec678){_0x2ec678=_0x2ec678||0x1f4;return function(_0x892335){logger[_0x0937('0x28')](_0x892335[_0x0937('0x29')]);if(_0x892335['name']){delete _0x892335['name'];}_0x16e5f7[_0x0937('0x20')](_0x2ec678)['send'](_0x892335);};}exports[_0x0937('0x2a')]=function(_0x130808,_0x5d9903){var _0x2667ce={},_0x289006={},_0x2bf2c7={'count':0x0,'rows':[]};var _0x138d21=_['map'](db[_0x0937('0x2b')]['rawAttributes'],function(_0x2ec1af){return{'name':_0x2ec1af['fieldName'],'type':_0x2ec1af['type'][_0x0937('0x2c')]};});_0x289006[_0x0937('0x2d')]=_[_0x0937('0x2e')](_0x138d21,_0x0937('0x2f'));_0x289006[_0x0937('0x30')]=_[_0x0937('0x31')](_0x130808[_0x0937('0x30')]);_0x289006['filters']=_[_0x0937('0x32')](_0x289006[_0x0937('0x2d')],_0x289006['query']);_0x2667ce['attributes']=_[_0x0937('0x32')](_0x289006['model'],qs['fields'](_0x130808['query'][_0x0937('0x33')]));_0x2667ce[_0x0937('0x34')]=_0x2667ce[_0x0937('0x34')][_0x0937('0x35')]?_0x2667ce['attributes']:_0x289006[_0x0937('0x2d')];if(!_0x130808[_0x0937('0x30')][_0x0937('0x36')](_0x0937('0x37'))){_0x2667ce[_0x0937('0x1f')]=qs[_0x0937('0x1f')](_0x130808[_0x0937('0x30')]['limit']);_0x2667ce[_0x0937('0x1e')]=qs['offset'](_0x130808[_0x0937('0x30')][_0x0937('0x1e')]);}_0x2667ce['order']=qs[_0x0937('0x38')](_0x130808['query'][_0x0937('0x38')]);_0x2667ce[_0x0937('0x39')]=qs['filters'](_[_0x0937('0x3a')](_0x130808[_0x0937('0x30')],_0x289006['filters']),_0x138d21);if(_0x130808[_0x0937('0x30')]['filter']){_0x2667ce['where']=_['merge'](_0x2667ce[_0x0937('0x39')],{'$or':_[_0x0937('0x2e')](_0x138d21,function(_0x3ae32e){if(_0x3ae32e[_0x0937('0x3b')]!==_0x0937('0x3c')){var _0xb658d2={};_0xb658d2[_0x3ae32e[_0x0937('0x2f')]]={'$like':'%'+_0x130808[_0x0937('0x30')]['filter']+'%'};return _0xb658d2;}})});}_0x2667ce=_['merge']({},_0x2667ce,_0x130808[_0x0937('0x3d')]);var _0x41974a={'where':_0x2667ce[_0x0937('0x39')]};return db['WhatsappTransferReport'][_0x0937('0x1d')](_0x41974a)[_0x0937('0x26')](function(_0x13cce1){_0x2bf2c7[_0x0937('0x1d')]=_0x13cce1;if(_0x130808[_0x0937('0x30')]['includeAll']){_0x2667ce['include']=[{'all':!![]}];}return db[_0x0937('0x2b')][_0x0937('0x3e')](_0x2667ce);})[_0x0937('0x26')](function(_0x11d3ef){_0x2bf2c7[_0x0937('0x3f')]=_0x11d3ef;return _0x2bf2c7;})['then'](respondWithFilteredResult(_0x5d9903,_0x2667ce))['catch'](handleError(_0x5d9903,null));};exports[_0x0937('0x40')]=function(_0x2c7cda,_0x441d07){var _0x1032e9={'raw':!![],'where':{'id':_0x2c7cda[_0x0937('0x41')]['id']}},_0xbdc7d7={};_0xbdc7d7[_0x0937('0x2d')]=_[_0x0937('0x31')](db['WhatsappTransferReport']['rawAttributes']);_0xbdc7d7[_0x0937('0x30')]=_['keys'](_0x2c7cda[_0x0937('0x30')]);_0xbdc7d7[_0x0937('0x42')]=_[_0x0937('0x32')](_0xbdc7d7['model'],_0xbdc7d7[_0x0937('0x30')]);_0x1032e9[_0x0937('0x34')]=_[_0x0937('0x32')](_0xbdc7d7['model'],qs[_0x0937('0x33')](_0x2c7cda[_0x0937('0x30')]['fields']));_0x1032e9[_0x0937('0x34')]=_0x1032e9[_0x0937('0x34')][_0x0937('0x35')]?_0x1032e9['attributes']:_0xbdc7d7[_0x0937('0x2d')];if(_0x2c7cda[_0x0937('0x30')][_0x0937('0x43')]){_0x1032e9[_0x0937('0x44')]=[{'all':!![]}];}_0x1032e9=_[_0x0937('0x45')]({},_0x1032e9,_0x2c7cda[_0x0937('0x3d')]);return db[_0x0937('0x2b')][_0x0937('0x46')](_0x1032e9)[_0x0937('0x26')](handleEntityNotFound(_0x441d07,null))[_0x0937('0x26')](respondWithResult(_0x441d07,null))[_0x0937('0x47')](handleError(_0x441d07,null));};exports['create']=function(_0x5133a9,_0x69a737){return db[_0x0937('0x2b')][_0x0937('0x48')](_0x5133a9[_0x0937('0x49')],{})[_0x0937('0x26')](respondWithResult(_0x69a737,0xc9))[_0x0937('0x47')](handleError(_0x69a737,null));};exports[_0x0937('0x4a')]=function(_0x19ad41,_0x2ff62d){if(_0x19ad41[_0x0937('0x49')]['id']){delete _0x19ad41[_0x0937('0x49')]['id'];}return db[_0x0937('0x2b')][_0x0937('0x46')]({'where':{'id':_0x19ad41['params']['id']}})[_0x0937('0x26')](handleEntityNotFound(_0x2ff62d,null))[_0x0937('0x26')](saveUpdates(_0x19ad41[_0x0937('0x49')],null))[_0x0937('0x26')](respondWithResult(_0x2ff62d,null))[_0x0937('0x47')](handleError(_0x2ff62d,null));};exports[_0x0937('0x27')]=function(_0xdd47f,_0x35b4d2){return db[_0x0937('0x2b')][_0x0937('0x46')]({'where':{'id':_0xdd47f[_0x0937('0x41')]['id']}})['then'](handleEntityNotFound(_0x35b4d2,null))[_0x0937('0x26')](removeEntity(_0x35b4d2,null))[_0x0937('0x47')](handleError(_0x35b4d2,null));};exports['describe']=function(_0x1fb2bf,_0x2211c0){return db[_0x0937('0x2b')][_0x0937('0x4b')]()['then'](respondWithResult(_0x2211c0,null))[_0x0937('0x47')](handleError(_0x2211c0,null));}; \ No newline at end of file +var _0xa209=['set','Content-Range','save','update','destroy','end','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit'];(function(_0x2f9e80,_0x1d5b11){var _0x5ad122=function(_0x34969a){while(--_0x34969a){_0x2f9e80['push'](_0x2f9e80['shift']());}};_0x5ad122(++_0x1d5b11);}(_0xa209,0xb6));var _0x9a20=function(_0x36cc2d,_0x2950d4){_0x36cc2d=_0x36cc2d-0x0;var _0x4553fc=_0xa209[_0x36cc2d];return _0x4553fc;};'use strict';var emlformat=require(_0x9a20('0x0'));var rimraf=require(_0x9a20('0x1'));var zipdir=require(_0x9a20('0x2'));var jsonpatch=require(_0x9a20('0x3'));var rp=require('request-promise');var moment=require(_0x9a20('0x4'));var BPromise=require(_0x9a20('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9a20('0x6'));var sox=require(_0x9a20('0x7'));var csv=require(_0x9a20('0x8'));var ejs=require(_0x9a20('0x9'));var fs=require('fs');var fs_extra=require(_0x9a20('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9a20('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9a20('0xc'));var toCsv=require(_0x9a20('0x8'));var querystring=require(_0x9a20('0xd'));var Papa=require(_0x9a20('0xe'));var Redis=require(_0x9a20('0xf'));var authService=require(_0x9a20('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9a20('0x11'));var utils=require(_0x9a20('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x9a20('0x13'));var db=require(_0x9a20('0x14'))['db'];function respondWithStatusCode(_0x1869ce,_0x1346e9){_0x1346e9=_0x1346e9||0xcc;return function(_0x1460b0){if(_0x1460b0){return _0x1869ce[_0x9a20('0x15')](_0x1346e9);}return _0x1869ce[_0x9a20('0x16')](_0x1346e9)['end']();};}function respondWithResult(_0x39864f,_0xc60b5d){_0xc60b5d=_0xc60b5d||0xc8;return function(_0x4e83ab){if(_0x4e83ab){return _0x39864f[_0x9a20('0x16')](_0xc60b5d)[_0x9a20('0x17')](_0x4e83ab);}};}function respondWithFilteredResult(_0x4c44a1,_0x332c50){return function(_0x19ad57){if(_0x19ad57){var _0x1e0c27=typeof _0x332c50[_0x9a20('0x18')]==='undefined'&&typeof _0x332c50['limit']===_0x9a20('0x19');var _0x280ef7=_0x19ad57[_0x9a20('0x1a')];var _0x24d930=_0x1e0c27?0x0:_0x332c50[_0x9a20('0x18')];var _0x3ecfae=_0x1e0c27?_0x19ad57[_0x9a20('0x1a')]:_0x332c50['offset']+_0x332c50[_0x9a20('0x1b')];var _0x9eda36;if(_0x3ecfae>=_0x280ef7){_0x3ecfae=_0x280ef7;_0x9eda36=0xc8;}else{_0x9eda36=0xce;}_0x4c44a1[_0x9a20('0x16')](_0x9eda36);return _0x4c44a1[_0x9a20('0x1c')](_0x9a20('0x1d'),_0x24d930+'-'+_0x3ecfae+'/'+_0x280ef7)[_0x9a20('0x17')](_0x19ad57);}return null;};}function patchUpdates(_0x2f075d){return function(_0x5f0862){try{jsonpatch['apply'](_0x5f0862,_0x2f075d,!![]);}catch(_0xe2ff02){return BPromise['reject'](_0xe2ff02);}return _0x5f0862[_0x9a20('0x1e')]();};}function saveUpdates(_0x486745,_0x145991){return function(_0xf4f177){if(_0xf4f177){return _0xf4f177[_0x9a20('0x1f')](_0x486745)['then'](function(_0x5e8ed3){return _0x5e8ed3;});}return null;};}function removeEntity(_0x38efcd,_0x21f249){return function(_0x461006){if(_0x461006){return _0x461006[_0x9a20('0x20')]()['then'](function(){_0x38efcd['status'](0xcc)[_0x9a20('0x21')]();});}};}function handleEntityNotFound(_0x21bb9e,_0x4e2e38){return function(_0x12008c){if(!_0x12008c){_0x21bb9e['sendStatus'](0x194);}return _0x12008c;};}function handleError(_0x17807a,_0x5b8c45){_0x5b8c45=_0x5b8c45||0x1f4;return function(_0x30e678){logger['error'](_0x30e678[_0x9a20('0x22')]);if(_0x30e678['name']){delete _0x30e678[_0x9a20('0x23')];}_0x17807a[_0x9a20('0x16')](_0x5b8c45)[_0x9a20('0x24')](_0x30e678);};}exports[_0x9a20('0x25')]=function(_0x29df21,_0x5a38af){var _0x18a32c={},_0x51cb07={},_0x119d20={'count':0x0,'rows':[]};var _0x26000f=_[_0x9a20('0x26')](db[_0x9a20('0x27')][_0x9a20('0x28')],function(_0x2cfbc4){return{'name':_0x2cfbc4['fieldName'],'type':_0x2cfbc4['type'][_0x9a20('0x29')]};});_0x51cb07[_0x9a20('0x2a')]=_['map'](_0x26000f,_0x9a20('0x23'));_0x51cb07[_0x9a20('0x2b')]=_[_0x9a20('0x2c')](_0x29df21[_0x9a20('0x2b')]);_0x51cb07[_0x9a20('0x2d')]=_[_0x9a20('0x2e')](_0x51cb07[_0x9a20('0x2a')],_0x51cb07[_0x9a20('0x2b')]);_0x18a32c[_0x9a20('0x2f')]=_['intersection'](_0x51cb07[_0x9a20('0x2a')],qs[_0x9a20('0x30')](_0x29df21[_0x9a20('0x2b')]['fields']));_0x18a32c['attributes']=_0x18a32c[_0x9a20('0x2f')][_0x9a20('0x31')]?_0x18a32c[_0x9a20('0x2f')]:_0x51cb07[_0x9a20('0x2a')];if(!_0x29df21['query'][_0x9a20('0x32')](_0x9a20('0x33'))){_0x18a32c[_0x9a20('0x1b')]=qs[_0x9a20('0x1b')](_0x29df21[_0x9a20('0x2b')][_0x9a20('0x1b')]);_0x18a32c[_0x9a20('0x18')]=qs['offset'](_0x29df21[_0x9a20('0x2b')][_0x9a20('0x18')]);}_0x18a32c['order']=qs[_0x9a20('0x34')](_0x29df21[_0x9a20('0x2b')][_0x9a20('0x34')]);_0x18a32c['where']=qs[_0x9a20('0x2d')](_[_0x9a20('0x35')](_0x29df21[_0x9a20('0x2b')],_0x51cb07[_0x9a20('0x2d')]),_0x26000f);if(_0x29df21[_0x9a20('0x2b')][_0x9a20('0x36')]){_0x18a32c[_0x9a20('0x37')]=_[_0x9a20('0x38')](_0x18a32c[_0x9a20('0x37')],{'$or':_[_0x9a20('0x26')](_0x26000f,function(_0x28e72d){if(_0x28e72d['type']!==_0x9a20('0x39')){var _0x58052f={};_0x58052f[_0x28e72d[_0x9a20('0x23')]]={'$like':'%'+_0x29df21[_0x9a20('0x2b')]['filter']+'%'};return _0x58052f;}})});}_0x18a32c=_[_0x9a20('0x38')]({},_0x18a32c,_0x29df21[_0x9a20('0x3a')]);var _0x77aaf8={'where':_0x18a32c['where']};return db[_0x9a20('0x27')][_0x9a20('0x1a')](_0x77aaf8)[_0x9a20('0x3b')](function(_0x1db6bd){_0x119d20[_0x9a20('0x1a')]=_0x1db6bd;if(_0x29df21[_0x9a20('0x2b')][_0x9a20('0x3c')]){_0x18a32c[_0x9a20('0x3d')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x9a20('0x3e')](_0x18a32c);})[_0x9a20('0x3b')](function(_0x490977){_0x119d20[_0x9a20('0x3f')]=_0x490977;return _0x119d20;})[_0x9a20('0x3b')](respondWithFilteredResult(_0x5a38af,_0x18a32c))['catch'](handleError(_0x5a38af,null));};exports['show']=function(_0x38b80f,_0x5e186e){var _0xea7c77={'raw':!![],'where':{'id':_0x38b80f['params']['id']}},_0x48835b={};_0x48835b['model']=_['keys'](db[_0x9a20('0x27')][_0x9a20('0x28')]);_0x48835b['query']=_[_0x9a20('0x2c')](_0x38b80f[_0x9a20('0x2b')]);_0x48835b[_0x9a20('0x2d')]=_[_0x9a20('0x2e')](_0x48835b[_0x9a20('0x2a')],_0x48835b[_0x9a20('0x2b')]);_0xea7c77['attributes']=_[_0x9a20('0x2e')](_0x48835b[_0x9a20('0x2a')],qs['fields'](_0x38b80f['query']['fields']));_0xea7c77['attributes']=_0xea7c77[_0x9a20('0x2f')]['length']?_0xea7c77['attributes']:_0x48835b[_0x9a20('0x2a')];if(_0x38b80f[_0x9a20('0x2b')][_0x9a20('0x3c')]){_0xea7c77['include']=[{'all':!![]}];}_0xea7c77=_[_0x9a20('0x38')]({},_0xea7c77,_0x38b80f[_0x9a20('0x3a')]);return db['WhatsappTransferReport'][_0x9a20('0x40')](_0xea7c77)['then'](handleEntityNotFound(_0x5e186e,null))[_0x9a20('0x3b')](respondWithResult(_0x5e186e,null))[_0x9a20('0x41')](handleError(_0x5e186e,null));};exports[_0x9a20('0x42')]=function(_0x294b2a,_0x4af2e2){return db[_0x9a20('0x27')][_0x9a20('0x42')](_0x294b2a['body'],{})[_0x9a20('0x3b')](respondWithResult(_0x4af2e2,0xc9))[_0x9a20('0x41')](handleError(_0x4af2e2,null));};exports[_0x9a20('0x1f')]=function(_0x571fe2,_0xcc1b36){if(_0x571fe2[_0x9a20('0x43')]['id']){delete _0x571fe2[_0x9a20('0x43')]['id'];}return db[_0x9a20('0x27')]['find']({'where':{'id':_0x571fe2[_0x9a20('0x44')]['id']}})[_0x9a20('0x3b')](handleEntityNotFound(_0xcc1b36,null))[_0x9a20('0x3b')](saveUpdates(_0x571fe2[_0x9a20('0x43')],null))[_0x9a20('0x3b')](respondWithResult(_0xcc1b36,null))[_0x9a20('0x41')](handleError(_0xcc1b36,null));};exports['destroy']=function(_0x1fbaa4,_0x279b6c){return db[_0x9a20('0x27')][_0x9a20('0x40')]({'where':{'id':_0x1fbaa4[_0x9a20('0x44')]['id']}})['then'](handleEntityNotFound(_0x279b6c,null))[_0x9a20('0x3b')](removeEntity(_0x279b6c,null))[_0x9a20('0x41')](handleError(_0x279b6c,null));};exports[_0x9a20('0x45')]=function(_0x26f516,_0x4f6800){return db['WhatsappTransferReport'][_0x9a20('0x45')]()[_0x9a20('0x3b')](respondWithResult(_0x4f6800,null))['catch'](handleError(_0x4f6800,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index bddc43e..d899b1a 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 _0xfdd5=['rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x111e94,_0x31c837){var _0x3de107=function(_0x65bd1e){while(--_0x65bd1e){_0x111e94['push'](_0x111e94['shift']());}};_0x3de107(++_0x31c837);}(_0xfdd5,0x180));var _0x5fdd=function(_0x3a53e4,_0x26c5ba){_0x3a53e4=_0x3a53e4-0x0;var _0x4f9e2f=_0xfdd5[_0x3a53e4];return _0x4f9e2f;};'use strict';var _=require(_0x5fdd('0x0'));var util=require(_0x5fdd('0x1'));var logger=require(_0x5fdd('0x2'))('api');var moment=require(_0x5fdd('0x3'));var BPromise=require(_0x5fdd('0x4'));var rp=require(_0x5fdd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5fdd('0x6'));var config=require(_0x5fdd('0x7'));var attributes=require(_0x5fdd('0x8'));module['exports']=function(_0x45dae0,_0x1d2acc){return _0x45dae0[_0x5fdd('0x9')](_0x5fdd('0xa'),attributes,{'tableName':_0x5fdd('0xb'),'paranoid':![],'indexes':[{'name':_0x5fdd('0xc'),'fields':[_0x5fdd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc45c=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger'];(function(_0x370d49,_0xa05493){var _0x26b62a=function(_0x15bd2e){while(--_0x15bd2e){_0x370d49['push'](_0x370d49['shift']());}};_0x26b62a(++_0xa05493);}(_0xc45c,0xe8));var _0xcc45=function(_0x249b75,_0x26c7d9){_0x249b75=_0x249b75-0x0;var _0x1763f2=_0xc45c[_0x249b75];return _0x1763f2;};'use strict';var _=require(_0xcc45('0x0'));var util=require('util');var logger=require(_0xcc45('0x1'))(_0xcc45('0x2'));var moment=require(_0xcc45('0x3'));var BPromise=require(_0xcc45('0x4'));var rp=require(_0xcc45('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc45('0x6'));var config=require(_0xcc45('0x7'));var attributes=require(_0xcc45('0x8'));module['exports']=function(_0x4e3500,_0x47a94a){return _0x4e3500[_0xcc45('0x9')](_0xcc45('0xa'),attributes,{'tableName':_0xcc45('0xb'),'paranoid':![],'indexes':[{'name':_0xcc45('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 0f0f869..8a70602 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 _0xfd8b=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','randomstring'];(function(_0x319777,_0x5897b4){var _0x46b0cd=function(_0x4255f9){while(--_0x4255f9){_0x319777['push'](_0x319777['shift']());}};_0x46b0cd(++_0x5897b4);}(_0xfd8b,0x1b5));var _0xbfd8=function(_0x316b85,_0x1e3721){_0x316b85=_0x316b85-0x0;var _0x38ecc9=_0xfd8b[_0x316b85];return _0x38ecc9;};'use strict';var _=require(_0xbfd8('0x0'));var util=require('util');var moment=require(_0xbfd8('0x1'));var BPromise=require('bluebird');var rs=require(_0xbfd8('0x2'));var fs=require('fs');var Redis=require(_0xbfd8('0x3'));var db=require(_0xbfd8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfd8('0x5'))(_0xbfd8('0x6'));var config=require(_0xbfd8('0x7'));var jayson=require(_0xbfd8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b9686,_0x5845b8,_0xc5391b){return new BPromise(function(_0x2429d4,_0xf68026){return client[_0xbfd8('0x9')](_0x4b9686,_0xc5391b)[_0xbfd8('0xa')](function(_0x3b9b15){logger[_0xbfd8('0xb')](_0xbfd8('0xc'),_0x5845b8,_0xbfd8('0xd'));logger[_0xbfd8('0xe')](_0xbfd8('0xf'),_0x5845b8,_0xbfd8('0xd'),JSON[_0xbfd8('0x10')](_0x3b9b15));if(_0x3b9b15[_0xbfd8('0x11')]){if(_0x3b9b15[_0xbfd8('0x11')][_0xbfd8('0x12')]===0x1f4){logger[_0xbfd8('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x5845b8,_0x3b9b15[_0xbfd8('0x11')][_0xbfd8('0x13')]);return _0xf68026(_0x3b9b15[_0xbfd8('0x11')]['message']);}logger[_0xbfd8('0x11')](_0xbfd8('0xc'),_0x5845b8,_0x3b9b15[_0xbfd8('0x11')][_0xbfd8('0x13')]);return _0x2429d4(_0x3b9b15[_0xbfd8('0x11')]['message']);}else{logger[_0xbfd8('0xb')](_0xbfd8('0xc'),_0x5845b8,_0xbfd8('0xd'));_0x2429d4(_0x3b9b15['result']['message']);}})['catch'](function(_0x4d407f){logger[_0xbfd8('0x11')](_0xbfd8('0xc'),_0x5845b8,_0x4d407f);_0xf68026(_0x4d407f);});});} \ No newline at end of file +var _0x6abe=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6abe,0x1a7));var _0xe6ab=function(_0x11df2a,_0x588cfb){_0x11df2a=_0x11df2a-0x0;var _0x27a372=_0x6abe[_0x11df2a];return _0x27a372;};'use strict';var _=require(_0xe6ab('0x0'));var util=require(_0xe6ab('0x1'));var moment=require(_0xe6ab('0x2'));var BPromise=require(_0xe6ab('0x3'));var rs=require(_0xe6ab('0x4'));var fs=require('fs');var Redis=require(_0xe6ab('0x5'));var db=require(_0xe6ab('0x6'))['db'];var utils=require(_0xe6ab('0x7'));var logger=require(_0xe6ab('0x8'))(_0xe6ab('0x9'));var config=require(_0xe6ab('0xa'));var jayson=require(_0xe6ab('0xb'));var client=jayson[_0xe6ab('0xc')][_0xe6ab('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4c603b,_0xe8ebae,_0x3e2108){return new BPromise(function(_0x360bfa,_0x3a70f9){return client[_0xe6ab('0xe')](_0x4c603b,_0x3e2108)[_0xe6ab('0xf')](function(_0x5a470f){logger[_0xe6ab('0x10')](_0xe6ab('0x11'),_0xe8ebae,_0xe6ab('0x12'));logger[_0xe6ab('0x13')](_0xe6ab('0x14'),_0xe8ebae,_0xe6ab('0x12'),JSON[_0xe6ab('0x15')](_0x5a470f));if(_0x5a470f[_0xe6ab('0x16')]){if(_0x5a470f[_0xe6ab('0x16')][_0xe6ab('0x17')]===0x1f4){logger[_0xe6ab('0x16')](_0xe6ab('0x11'),_0xe8ebae,_0x5a470f[_0xe6ab('0x16')][_0xe6ab('0x18')]);return _0x3a70f9(_0x5a470f[_0xe6ab('0x16')][_0xe6ab('0x18')]);}logger['error'](_0xe6ab('0x11'),_0xe8ebae,_0x5a470f[_0xe6ab('0x16')][_0xe6ab('0x18')]);return _0x360bfa(_0x5a470f[_0xe6ab('0x16')]['message']);}else{logger[_0xe6ab('0x10')](_0xe6ab('0x11'),_0xe8ebae,_0xe6ab('0x12'));_0x360bfa(_0x5a470f[_0xe6ab('0x19')]['message']);}})[_0xe6ab('0x1a')](function(_0x40e6bb){logger[_0xe6ab('0x16')](_0xe6ab('0x11'),_0xe8ebae,_0x40e6bb);_0x3a70f9(_0x40e6bb);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index e7abee1..65e60b3 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee14=['Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','info','start','filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error'];(function(_0x48e4d8,_0x4e77de){var _0x21f3a9=function(_0x58a2eb){while(--_0x58a2eb){_0x48e4d8['push'](_0x48e4d8['shift']());}};_0x21f3a9(++_0x4e77de);}(_0xee14,0x13a));var _0x4ee1=function(_0x5eb3ad,_0x5f26e9){_0x5eb3ad=_0x5eb3ad-0x0;var _0x5f1abb=_0xee14[_0x5eb3ad];return _0x5f1abb;};'use strict';var _=require('lodash');var db=require('./mysqldb')['db'];var seedDb=require(_0x4ee1('0x0'));var checkLicense=require(_0x4ee1('0x1'));var rpc=require(_0x4ee1('0x2'));var config=require(_0x4ee1('0x3'));var logger=require(_0x4ee1('0x4'))(_0x4ee1('0x5'));var pm2=require(_0x4ee1('0x6'));var pm2Config=require(_0x4ee1('0x7'));var schedule=require(_0x4ee1('0x8'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x4ee1('0x9'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x4ee1('0xa'));function main(){return db[_0x4ee1('0xb')][_0x4ee1('0xc')]()[_0x4ee1('0xd')](function(){if(config[_0x4ee1('0xe')]){return seedDb[_0x4ee1('0xf')]();}})['then'](function(){return checkLicense[_0x4ee1('0xf')]();})[_0x4ee1('0xd')](function(){return rpc['listen']();})[_0x4ee1('0xd')](function(_0x252021){logger[_0x4ee1('0x10')](_0x252021);return chat[_0x4ee1('0x11')]();})['then'](function(){return whatsapp[_0x4ee1('0x11')]();})[_0x4ee1('0xd')](function(){return schedule[_0x4ee1('0x11')]();})[_0x4ee1('0xd')](function(){return transcribe[_0x4ee1('0x11')]();})[_0x4ee1('0xd')](function(){return provider['start']();})[_0x4ee1('0xd')](function(_0x461f99){logger[_0x4ee1('0x10')](_0x461f99);return pm2[_0x4ee1('0x11')](pm2Config);})[_0x4ee1('0xd')](function(_0x1c342a){var _0x2ffb2d=_0x1c342a[_0x4ee1('0x12')](function(_0xb7eafd){return typeof _0xb7eafd['exitCode']===_0x4ee1('0x13')&&_0xb7eafd[_0x4ee1('0x14')]>=0x0;});if(_0x2ffb2d[_0x4ee1('0x15')]>0x0){throw new Error(_0x2ffb2d[_0x4ee1('0x15')]+_0x4ee1('0x16')+_[_0x4ee1('0x17')](_0x2ffb2d,function(_0x2eff91){return'\x22'+_0x2eff91[_0x4ee1('0x18')][_0x4ee1('0x19')]+'\x22';}));}logger[_0x4ee1('0x10')](_0x4ee1('0x1a'),_['map'](_[_0x4ee1('0x12')](_0x1c342a,{'status':_0x4ee1('0x1b')}),_0x4ee1('0x19'))[_0x4ee1('0x1c')]());logger[_0x4ee1('0x10')](_0x4ee1('0x1d'),_['map'](_[_0x4ee1('0x12')](_0x1c342a,function(_0x333e96){return _0x333e96[_0x4ee1('0x1e')]!==_0x4ee1('0x1b');}),_0x4ee1('0x19'))[_0x4ee1('0x1c')]()||_0x4ee1('0x1f'));console[_0x4ee1('0x20')](_0x4ee1('0x21'));})[_0x4ee1('0x22')](function(_0x4faaf6){console['log'](_0x4ee1('0x23'),_0x4faaf6);logger[_0x4ee1('0x24')](_0x4ee1('0x25'),_0x4faaf6);process[_0x4ee1('0x26')](0x1);});}main(); \ No newline at end of file +var _0xaf1b=['length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','filter','name','Offline\x20apps:','status','online','join','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','then','default','listen','info','start','exitCode','number'];(function(_0x4f83ca,_0x46f67a){var _0x1fbac3=function(_0x19e401){while(--_0x19e401){_0x4f83ca['push'](_0x4f83ca['shift']());}};_0x1fbac3(++_0x46f67a);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x218036,_0x5bd8d5){_0x218036=_0x218036-0x0;var _0x12510c=_0xaf1b[_0x218036];return _0x12510c;};'use strict';var _=require(_0xbaf1('0x0'));var db=require(_0xbaf1('0x1'))['db'];var seedDb=require(_0xbaf1('0x2'));var checkLicense=require(_0xbaf1('0x3'));var rpc=require(_0xbaf1('0x4'));var config=require(_0xbaf1('0x5'));var logger=require(_0xbaf1('0x6'))(_0xbaf1('0x7'));var pm2=require(_0xbaf1('0x8'));var pm2Config=require(_0xbaf1('0x9'));var schedule=require(_0xbaf1('0xa'));var chat=require(_0xbaf1('0xb'));var whatsapp=require(_0xbaf1('0xc'));var transcribe=require(_0xbaf1('0xd'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xbaf1('0xe')]['sync']()[_0xbaf1('0xf')](function(){if(config['seedDB']){return seedDb[_0xbaf1('0x10')]();}})[_0xbaf1('0xf')](function(){return checkLicense[_0xbaf1('0x10')]();})['then'](function(){return rpc[_0xbaf1('0x11')]();})[_0xbaf1('0xf')](function(_0x56e04e){logger[_0xbaf1('0x12')](_0x56e04e);return chat['start']();})[_0xbaf1('0xf')](function(){return whatsapp[_0xbaf1('0x13')]();})[_0xbaf1('0xf')](function(){return schedule[_0xbaf1('0x13')]();})[_0xbaf1('0xf')](function(){return transcribe[_0xbaf1('0x13')]();})['then'](function(){return provider['start']();})[_0xbaf1('0xf')](function(_0x1a10d6){logger[_0xbaf1('0x12')](_0x1a10d6);return pm2[_0xbaf1('0x13')](pm2Config);})[_0xbaf1('0xf')](function(_0x1097d6){var _0x177599=_0x1097d6['filter'](function(_0x32981b){return typeof _0x32981b[_0xbaf1('0x14')]===_0xbaf1('0x15')&&_0x32981b[_0xbaf1('0x14')]>=0x0;});if(_0x177599[_0xbaf1('0x16')]>0x0){throw new Error(_0x177599[_0xbaf1('0x16')]+_0xbaf1('0x17')+_[_0xbaf1('0x18')](_0x177599,function(_0x58d217){return'\x22'+_0x58d217[_0xbaf1('0x19')]['name']+'\x22';}));}logger[_0xbaf1('0x12')](_0xbaf1('0x1a'),_[_0xbaf1('0x18')](_[_0xbaf1('0x1b')](_0x1097d6,{'status':'online'}),_0xbaf1('0x1c'))['join']());logger[_0xbaf1('0x12')](_0xbaf1('0x1d'),_['map'](_[_0xbaf1('0x1b')](_0x1097d6,function(_0x33c524){return _0x33c524[_0xbaf1('0x1e')]!==_0xbaf1('0x1f');}),_0xbaf1('0x1c'))[_0xbaf1('0x20')]()||'None');console['log'](_0xbaf1('0x21'));})[_0xbaf1('0x22')](function(_0x254178){console['log'](_0xbaf1('0x23'),_0x254178);logger[_0xbaf1('0x24')](_0xbaf1('0x25'),_0x254178);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index d6daf16..8c28d1d 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 _0xb43b=['headers','then','authenticate','pass','status','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','find','sub','allowedLoginAttempts','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','minutes','User\x20object\x20not\x20found.','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','apiKeyNonce','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','unshift','encryptString','join','promisify','sign','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','crypto','moment','session','role','fullname','name','internal','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','allowmessenger','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarPrefixRequired','phoneBarRemoteControl','interface','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','whatsappAutoanswer','isChatInteractionAuthorized','use','ChatInteraction','findOne','params','closed','disposition','unmanaged','json','Forbidden.','catch','isAuthenticated','authorization','startsWith'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xb43b,0x1b2));var _0xbb43=function(_0x17f9ec,_0x58c568){_0x17f9ec=_0x17f9ec-0x0;var _0x6efa98=_0xb43b[_0x17f9ec];return _0x6efa98;};'use strict';var db=require(_0xbb43('0x0'))['db'];var config=require(_0xbb43('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xbb43('0x2'));var encryptor=require(_0xbb43('0x3'));var _=require(_0xbb43('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xbb43('0x5'));var compose=require(_0xbb43('0x6'));var basicAuth=require(_0xbb43('0x7'));var crypto=require(_0xbb43('0x8'));var BPromise=require('bluebird');var util=require('util');var moment=require(_0xbb43('0x9'));var validateJwt=expressJwt({'secret':config['secrets'][_0xbb43('0xa')]});var userAttributes=['id',_0xbb43('0xb'),_0xbb43('0xc'),_0xbb43('0xd'),_0xbb43('0xe'),'email',_0xbb43('0xf'),_0xbb43('0x10'),'md5secret',_0xbb43('0x11'),_0xbb43('0x12'),_0xbb43('0x13'),_0xbb43('0x14'),_0xbb43('0x15'),_0xbb43('0x16'),'pauseType',_0xbb43('0x17'),_0xbb43('0x18'),'lastPauseAt','crudPermissions',_0xbb43('0x19'),'passwordResetAt','alias',_0xbb43('0x1a'),'phoneBarAutoAnswerDelay',_0xbb43('0x1b'),_0xbb43('0x1c'),'phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires',_0xbb43('0x1d'),_0xbb43('0x1e'),'phoneBarRemoteControlPort','hotdesk',_0xbb43('0x1f'),'userProfileId','privacyEnabled',_0xbb43('0x20'),_0xbb43('0x21'),_0xbb43('0x22'),'downloadOmnichannelInteractions',_0xbb43('0x23'),'ignorePauseForPreviewCalls',_0xbb43('0x24'),_0xbb43('0x25'),'chatAutoanswerDelay','emailAutoanswer',_0xbb43('0x26'),_0xbb43('0x27'),_0xbb43('0x28'),_0xbb43('0x29'),'openchannelAutoanswerDelay',_0xbb43('0x2a'),'faxAutoanswerDelay',_0xbb43('0x2b'),'whatsappAutoanswerDelay'];exports[_0xbb43('0x2c')]=function(){return this['isAuthenticated'](!![])[_0xbb43('0x2d')](function(_0x451cbd,_0x577ddd,_0x1d0768){if(_0x451cbd['user']){_0x1d0768();}else{return db[_0xbb43('0x2e')][_0xbb43('0x2f')]({'where':{'id':_0x451cbd[_0xbb43('0x30')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})['then'](function(_0x269ca5){if(_0x269ca5&&_0x269ca5[_0xbb43('0x31')]){return _0x577ddd['status'](_0x269ca5[_0xbb43('0x32')]===_0xbb43('0x33')?0x195:0x193)[_0xbb43('0x34')]({'message':_0x269ca5[_0xbb43('0x32')]==='unmanaged'?'Unmanaged.':_0xbb43('0x35')});}else{_0x1d0768();}})[_0xbb43('0x36')](function(_0xa88db0){_0x1d0768(_0xa88db0);});}});};exports[_0xbb43('0x37')]=function isAuthenticated(_0x510b05){return compose()[_0xbb43('0x2d')](function(_0x21d386,_0x473828,_0x539730){var _0x2ad6da;if(_0x21d386['headers'][_0xbb43('0x38')]){if(_[_0xbb43('0x39')](_0x21d386[_0xbb43('0x3a')][_0xbb43('0x38')],'Basic')){var _0x157d62=basicAuth(_0x21d386);db['User']['find']({'where':{'name':_0x157d62['name']}})[_0xbb43('0x3b')](function(_0x573a05){if(!_0x573a05||!_0x573a05[_0xbb43('0x3c')](_0x157d62[_0xbb43('0x3d')])){return _0x473828[_0xbb43('0x3e')](0x191)['json']({'message':_0xbb43('0x3f')});}_0x21d386[_0xbb43('0x40')]={'id':_0x573a05['id']};_0x539730();})[_0xbb43('0x36')](function(_0xd987fa){_0x539730(_0xd987fa);});}else if(_[_0xbb43('0x39')](_0x21d386[_0xbb43('0x3a')][_0xbb43('0x38')],_0xbb43('0x41'))){validateJwt(_0x21d386,_0x473828,_0x539730);}else{if(_0x510b05){_0x539730();}else{return _0x473828['status'](0x193)[_0xbb43('0x34')]({'message':_0xbb43('0x42')});}}}else if(_0x21d386[_0xbb43('0x43')][_0xbb43('0x44')]){try{var _0x4015ec={'audience':hardwareConf[_0xbb43('0x45')](),'issuer':hardwareConf[_0xbb43('0x45')]()};verifyJwt(_0x21d386[_0xbb43('0x43')][_0xbb43('0x44')],_0x4015ec)[_0xbb43('0x3b')](function(_0x21346a){return db[_0xbb43('0x46')][_0xbb43('0x47')]({'where':{'id':_0x21346a[_0xbb43('0x48')]}})[_0xbb43('0x3b')](function(_0x405f36){_0x2ad6da=_0x405f36;return db['Setting'][_0xbb43('0x2f')]({'where':{'id':0x1},'attributes':[_0xbb43('0x49'),'blockDuration'],'raw':!![]});})[_0xbb43('0x3b')](function(_0x2c9a7c){if(!_0x2ad6da||!_[_0xbb43('0x4a')](_0x2ad6da['apiKeyNonce'],_0x21346a['nonce'])){return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':_0xbb43('0x4b')});}if(_0x2ad6da['disabled']){return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':_0xbb43('0x4c')});}if(_0x2ad6da[_0xbb43('0x4d')]){if(_0x2c9a7c[_0xbb43('0x4e')]>0x0){if(moment(_0x2ad6da[_0xbb43('0x4f')])['add'](_0x2c9a7c[_0xbb43('0x4e')],_0xbb43('0x50'))>moment()){return _0x473828[_0xbb43('0x3e')](0x191)[_0xbb43('0x34')]({'message':_0xbb43('0x4c')});}}else{return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x21d386[_0xbb43('0x40')]={'id':_0x2ad6da['id']};_0x539730();});})[_0xbb43('0x36')](function(){return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1fcf64){_0x539730(_0x1fcf64);}}else if(_0x510b05){_0x539730();}else{return _0x473828[_0xbb43('0x3e')](0x193)[_0xbb43('0x34')]({'message':_0xbb43('0x42')});}})['use'](function(_0x3e0871,_0x136bd4,_0x59750b){if(_0x3e0871[_0xbb43('0x40')]){db['User'][_0xbb43('0x47')]({'where':{'id':_0x3e0871[_0xbb43('0x40')]['id']},'attributes':userAttributes})[_0xbb43('0x3b')](function(_0x14e57e){if(!_0x14e57e){return _0x136bd4[_0xbb43('0x3e')](0x194)[_0xbb43('0x34')]({'message':'User\x20not\x20found.'});}_0x3e0871[_0xbb43('0x40')]=_0x14e57e;_0x59750b();})['catch'](function(_0x307f1e){_0x59750b(_0x307f1e);});}else if(_0x510b05){_0x59750b();}else{return _0x136bd4[_0xbb43('0x3e')](0x194)[_0xbb43('0x34')]({'message':_0xbb43('0x51')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xbb43('0x2d')](function(_0x39f75f,_0x4bc351,_0x24ba15){return licenseUtil[_0xbb43('0x52')]()[_0xbb43('0x3b')](function(_0x40f519){if(_0x40f519[_0xbb43('0x53')]){_0x24ba15();}else{return _0x4bc351['status'](0x193)[_0xbb43('0x34')]({'message':_0xbb43('0x54')});}})['catch'](function(_0x1a66f0){_0x24ba15(_0x1a66f0);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x4d7034,_0x5e2e6d,_0x1c3482){return licenseUtil['getLicense']()[_0xbb43('0x3b')](function(_0x5e5c86){if(_0x5e5c86[_0xbb43('0x55')]){_0x1c3482();}else{return _0x5e2e6d[_0xbb43('0x3e')](0x193)[_0xbb43('0x34')]({'message':'Forbidden'});}})[_0xbb43('0x36')](function(_0x4d9f18){_0x1c3482(_0x4d9f18);});});};exports[_0xbb43('0x56')]=function(_0x2518bf,_0xd43d24,_0x29840e){_0x2518bf[_0xbb43('0x56')]=!![];return _0x29840e();};exports[_0xbb43('0x57')]=function signToken(_0x37d8d3){return signJwt(_0x37d8d3);};exports['setTokenCookie']=function(_0x93f6e7,_0x26ea59){if(!_0x93f6e7[_0xbb43('0x40')]){return _0x26ea59[_0xbb43('0x3e')](0x194)['json']({'message':_0xbb43('0x58')});}var _0x3233b7={'payload':{'id':_0x93f6e7[_0xbb43('0x40')]['id'],'role':_0x93f6e7[_0xbb43('0x40')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3233b7)[_0xbb43('0x3b')](function(_0x3fdb10){_0x26ea59[_0xbb43('0x59')]('motion.token',_0x3fdb10);_0x26ea59[_0xbb43('0x5a')](_0xbb43('0x5b'));})[_0xbb43('0x36')](function(_0x1dc40a){return _0x26ea59[_0xbb43('0x3e')](0x1f4)['send'](_0x1dc40a);});};exports['retrieveApiKey']=function(_0xb44557){if(_['isNil'](_0xb44557[_0xbb43('0x5c')])||_[_0xbb43('0x5d')](_0xb44557['apiKeyIat'])){return null;}else{return createJwt(_0xb44557);}};exports[_0xbb43('0x5e')]=function(_0x3719dc){_0x3719dc[_0xbb43('0x5c')]=generateNonce();_0x3719dc[_0xbb43('0x5f')]=generateIssuedAt();return createJwt(_0x3719dc);};exports[_0xbb43('0x60')]=function(_0x5cb3c6,_0x124f88){var _0x539ffc=_0x5cb3c6['query'][_0xbb43('0x44')];if(_0x539ffc){var _0x1b9307={'nonce':_0x124f88[_0xbb43('0x5c')],'iat':_0x124f88[_0xbb43('0x5f')],'audience':hardwareConf[_0xbb43('0x45')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x539ffc,_0x1b9307)['then'](function(){return generateApiKey(_0x124f88);});}else{throw{'message':_0xbb43('0x61')};}};exports[_0xbb43('0x62')]=function(_0x3a84ad){var _0x308646=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x308646[_0xbb43('0x63')](_0x3a84ad))throw new db[(_0xbb43('0x64'))][(_0xbb43('0x65'))](_0xbb43('0x66'));return;};exports[_0xbb43('0x67')]=function(_0x578b85,_0x1b6f96,_0xb996d7){var _0x432bd8=encryptor[_0xbb43('0x68')](_0x1b6f96)[_0xbb43('0x69')](',');for(var _0x1fae27=0x0;_0x1fae27<_0xb996d7;_0x1fae27++){if(!_0x432bd8[_0x1fae27])break;if(_0x578b85[_0xbb43('0x6a')]()===_0x432bd8[_0x1fae27][_0xbb43('0x6a')]()){var _0x3e01e4=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0xb996d7);if(_0xb996d7===0x1){_0x3e01e4=_0xbb43('0x6b');}throw new db[(_0xbb43('0x64'))][(_0xbb43('0x65'))](_0x3e01e4);}}return;};exports[_0xbb43('0x6c')]=function(_0x38814a,_0x19e27e){var _0x2e01fb=_0x19e27e?encryptor['decryptString'](_0x19e27e)[_0xbb43('0x69')](','):[];if(_0x2e01fb['length']===0x5){_0x2e01fb['splice'](-0x1,0x1);}_0x2e01fb[_0xbb43('0x6d')](_0x38814a);return encryptor[_0xbb43('0x6e')](_0x2e01fb[_0xbb43('0x6f')](','));};function signJwt(_0x22ce17){var _0x24393a=BPromise[_0xbb43('0x70')](jwt[_0xbb43('0x71')],{'context':jwt});var _0x341481=_0x22ce17['secret']||config['secrets'][_0xbb43('0xa')];return new BPromise(function(_0x2b96b8,_0x137e75){_0x24393a(_0x22ce17[_0xbb43('0x72')],_0x341481,_0x22ce17[_0xbb43('0x73')])[_0xbb43('0x3b')](function(_0x12717e){_0x2b96b8(_0x12717e);})[_0xbb43('0x36')](function(_0x3ca6ad){_0x137e75(_0x3ca6ad);});});}function verifyJwt(_0x555426,_0x165936,_0x392d1a){var _0x234bc7=BPromise[_0xbb43('0x70')](jwt[_0xbb43('0x74')],{'context':jwt});var _0x33a4db=_0x392d1a||config['secrets'][_0xbb43('0xa')];return new BPromise(function(_0xb48be2,_0x42e437){_0x234bc7(_0x555426,_0x33a4db,_0x165936)[_0xbb43('0x3b')](function(_0xc34a02){_0xb48be2(_0xc34a02);})['catch'](function(_0x3c260f){_0x42e437(_0x3c260f);});});}function generateNonce(){return crypto[_0xbb43('0x75')](0x10)[_0xbb43('0x76')](_0xbb43('0x77'));}function generateIssuedAt(){return Math[_0xbb43('0x78')](Date[_0xbb43('0x79')]()/0x3e8)[_0xbb43('0x76')]();}function createJwt(_0x2992ea){var _0x10fd8b={'payload':{'iat':_0x2992ea[_0xbb43('0x5f')],'nonce':_0x2992ea['apiKeyNonce']},'options':{'algorithm':_0xbb43('0x7a'),'subject':_0x2992ea['id']['toString'](),'issuer':hardwareConf[_0xbb43('0x45')](),'audience':hardwareConf[_0xbb43('0x45')]()}};return signJwt(_0x10fd8b)[_0xbb43('0x3b')](function(_0x3dbcd9){return{'iat':_0x2992ea[_0xbb43('0x5f')],'nonce':_0x2992ea['apiKeyNonce'],'token':_0x3dbcd9};});} \ No newline at end of file +var _0xedd9=['crypto','bluebird','util','moment','session','fullname','name','internal','email','permissions','voicePause','chatPause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','json','Unmanaged.','authorization','startsWith','headers','Basic','User','find','authenticate','pass','status','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','split','unshift','join','promisify','secrets','payload','verify','hex','toString','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware'];(function(_0x559948,_0x5d7a75){var _0x4fc8d5=function(_0x4f77aa){while(--_0x4f77aa){_0x559948['push'](_0x559948['shift']());}};_0x4fc8d5(++_0x5d7a75);}(_0xedd9,0xfc));var _0x9edd=function(_0x298000,_0x24d983){_0x298000=_0x298000-0x0;var _0x48993c=_0xedd9[_0x298000];return _0x48993c;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x9edd('0x0'));var hardwareConf=require(_0x9edd('0x1'));var licenseUtil=require(_0x9edd('0x2'));var encryptor=require(_0x9edd('0x3'));var _=require(_0x9edd('0x4'));var jwt=require(_0x9edd('0x5'));var expressJwt=require(_0x9edd('0x6'));var compose=require(_0x9edd('0x7'));var basicAuth=require('basic-auth');var crypto=require(_0x9edd('0x8'));var BPromise=require(_0x9edd('0x9'));var util=require(_0x9edd('0xa'));var moment=require(_0x9edd('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x9edd('0xc')]});var userAttributes=['id','role',_0x9edd('0xd'),_0x9edd('0xe'),_0x9edd('0xf'),_0x9edd('0x10'),'userpic',_0x9edd('0x11'),'md5secret',_0x9edd('0x12'),_0x9edd('0x13'),'mailPause',_0x9edd('0x14'),_0x9edd('0x15'),'openchannelPause',_0x9edd('0x16'),_0x9edd('0x17'),_0x9edd('0x18'),_0x9edd('0x19'),_0x9edd('0x1a'),_0x9edd('0x1b'),_0x9edd('0x1c'),_0x9edd('0x1d'),'phoneBarAutoAnswer',_0x9edd('0x1e'),_0x9edd('0x1f'),_0x9edd('0x20'),_0x9edd('0x21'),_0x9edd('0x22'),_0x9edd('0x23'),_0x9edd('0x24'),_0x9edd('0x25'),'phoneBarRemoteControlPort',_0x9edd('0x26'),_0x9edd('0x27'),_0x9edd('0x28'),'privacyEnabled',_0x9edd('0x29'),_0x9edd('0x2a'),_0x9edd('0x2b'),'downloadOmnichannelInteractions',_0x9edd('0x2c'),'ignorePauseForPreviewCalls',_0x9edd('0x2d'),_0x9edd('0x2e'),'chatAutoanswerDelay','emailAutoanswer',_0x9edd('0x2f'),'smsAutoanswer',_0x9edd('0x30'),'openchannelAutoanswer','openchannelAutoanswerDelay',_0x9edd('0x31'),_0x9edd('0x32'),'whatsappAutoanswer','whatsappAutoanswerDelay'];exports[_0x9edd('0x33')]=function(){return this[_0x9edd('0x34')](!![])[_0x9edd('0x35')](function(_0x542172,_0x3741c8,_0x1dca43){if(_0x542172[_0x9edd('0x36')]){_0x1dca43();}else{return db[_0x9edd('0x37')][_0x9edd('0x38')]({'where':{'id':_0x542172['params']['id']},'attributes':['id',_0x9edd('0x39'),_0x9edd('0x3a')],'raw':!![]})[_0x9edd('0x3b')](function(_0x2f9f86){if(_0x2f9f86&&_0x2f9f86[_0x9edd('0x39')]){return _0x3741c8['status'](_0x2f9f86['disposition']===_0x9edd('0x3c')?0x195:0x193)[_0x9edd('0x3d')]({'message':_0x2f9f86[_0x9edd('0x3a')]===_0x9edd('0x3c')?_0x9edd('0x3e'):'Forbidden.'});}else{_0x1dca43();}})['catch'](function(_0x214d0a){_0x1dca43(_0x214d0a);});}});};exports[_0x9edd('0x34')]=function isAuthenticated(_0x1c762c){return compose()['use'](function(_0x238b22,_0x28cfae,_0x2ae8dd){var _0x41af53;if(_0x238b22['headers'][_0x9edd('0x3f')]){if(_[_0x9edd('0x40')](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x42'))){var _0x42e664=basicAuth(_0x238b22);db[_0x9edd('0x43')][_0x9edd('0x44')]({'where':{'name':_0x42e664[_0x9edd('0xe')]}})[_0x9edd('0x3b')](function(_0x4fd03f){if(!_0x4fd03f||!_0x4fd03f[_0x9edd('0x45')](_0x42e664[_0x9edd('0x46')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':'Wrong\x20credentials.'});}_0x238b22[_0x9edd('0x36')]={'id':_0x4fd03f['id']};_0x2ae8dd();})[_0x9edd('0x48')](function(_0x267c74){_0x2ae8dd(_0x267c74);});}else if(_['startsWith'](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x49'))){validateJwt(_0x238b22,_0x28cfae,_0x2ae8dd);}else{if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':_0x9edd('0x4a')});}}}else if(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')]){try{var _0xd0fd74={'audience':hardwareConf[_0x9edd('0x4d')](),'issuer':hardwareConf[_0x9edd('0x4d')]()};verifyJwt(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')],_0xd0fd74)[_0x9edd('0x3b')](function(_0x5757fc){return db[_0x9edd('0x43')]['find']({'where':{'id':_0x5757fc[_0x9edd('0x4e')]}})[_0x9edd('0x3b')](function(_0x10d6fd){_0x41af53=_0x10d6fd;return db[_0x9edd('0x4f')][_0x9edd('0x38')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9edd('0x50')],'raw':!![]});})[_0x9edd('0x3b')](function(_0x2b3469){if(!_0x41af53||!_[_0x9edd('0x51')](_0x41af53[_0x9edd('0x52')],_0x5757fc[_0x9edd('0x53')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x54')});}if(_0x41af53[_0x9edd('0x55')]){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x41af53[_0x9edd('0x56')]){if(_0x2b3469['blockDuration']>0x0){if(moment(_0x41af53[_0x9edd('0x57')])[_0x9edd('0x58')](_0x2b3469[_0x9edd('0x50')],'minutes')>moment()){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});}}else{return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x238b22[_0x9edd('0x36')]={'id':_0x41af53['id']};_0x2ae8dd();});})[_0x9edd('0x48')](function(){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});});}catch(_0x389f51){_0x2ae8dd(_0x389f51);}}else if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)['json']({'message':_0x9edd('0x4a')});}})['use'](function(_0x2bdb3f,_0xc1e657,_0x587d74){if(_0x2bdb3f[_0x9edd('0x36')]){db['User']['find']({'where':{'id':_0x2bdb3f[_0x9edd('0x36')]['id']},'attributes':userAttributes})[_0x9edd('0x3b')](function(_0x1f276b){if(!_0x1f276b){return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5a')});}_0x2bdb3f[_0x9edd('0x36')]=_0x1f276b;_0x587d74();})[_0x9edd('0x48')](function(_0x18c149){_0x587d74(_0x18c149);});}else if(_0x1c762c){_0x587d74();}else{return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5b')});}});};exports[_0x9edd('0x5c')]=function canUpdate(){return compose()[_0x9edd('0x35')](function(_0x46e9f4,_0x5416f8,_0x13197d){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x1e5805){if(_0x1e5805[_0x9edd('0x5e')]){_0x13197d();}else{return _0x5416f8[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})['catch'](function(_0x4bc7a1){_0x13197d(_0x4bc7a1);});});};exports[_0x9edd('0x5f')]=function isWebrtcLicence(){return compose()['use'](function(_0x8b1fdb,_0x19b56b,_0x2b06d3){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x53005b){if(_0x53005b[_0x9edd('0x60')]){_0x2b06d3();}else{return _0x19b56b[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})[_0x9edd('0x48')](function(_0xfd7bd1){_0x2b06d3(_0xfd7bd1);});});};exports[_0x9edd('0x61')]=function(_0x293b03,_0x1d78c4,_0x35bdec){_0x293b03['isMiddleware']=!![];return _0x35bdec();};exports[_0x9edd('0x62')]=function signToken(_0x237e91){return signJwt(_0x237e91);};exports['setTokenCookie']=function(_0xb93816,_0x8d8701){if(!_0xb93816['user']){return _0x8d8701[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x63')});}var _0x5215b0={'payload':{'id':_0xb93816[_0x9edd('0x36')]['id'],'role':_0xb93816[_0x9edd('0x36')][_0x9edd('0x64')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5215b0)[_0x9edd('0x3b')](function(_0x53f6e3){_0x8d8701[_0x9edd('0x65')](_0x9edd('0x66'),_0x53f6e3);_0x8d8701[_0x9edd('0x67')]('/dashboards/general');})[_0x9edd('0x48')](function(_0x21f6ce){return _0x8d8701['status'](0x1f4)[_0x9edd('0x68')](_0x21f6ce);});};exports['retrieveApiKey']=function(_0x336494){if(_[_0x9edd('0x69')](_0x336494[_0x9edd('0x52')])||_[_0x9edd('0x69')](_0x336494[_0x9edd('0x6a')])){return null;}else{return createJwt(_0x336494);}};exports[_0x9edd('0x6b')]=function(_0x2334d4){_0x2334d4[_0x9edd('0x52')]=generateNonce();_0x2334d4[_0x9edd('0x6a')]=generateIssuedAt();return createJwt(_0x2334d4);};exports[_0x9edd('0x6c')]=function(_0x31272d,_0x5a3b1d){var _0x161bea=_0x31272d[_0x9edd('0x4b')][_0x9edd('0x4c')];if(_0x161bea){var _0x58fe29={'nonce':_0x5a3b1d[_0x9edd('0x52')],'iat':_0x5a3b1d['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x161bea,_0x58fe29)[_0x9edd('0x3b')](function(){return generateApiKey(_0x5a3b1d);});}else{throw{'message':_0x9edd('0x6d')};}};exports[_0x9edd('0x6e')]=function(_0x35ddb3){var _0x48a900=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x48a900['test'](_0x35ddb3))throw new db['Sequelize'][(_0x9edd('0x6f'))](_0x9edd('0x70'));return;};exports[_0x9edd('0x71')]=function(_0x1091ff,_0x2e2920,_0x41ec97){var _0x25906c=encryptor[_0x9edd('0x72')](_0x2e2920)['split'](',');for(var _0x16dfdc=0x0;_0x16dfdc<_0x41ec97;_0x16dfdc++){if(!_0x25906c[_0x16dfdc])break;if(_0x1091ff['toLowerCase']()===_0x25906c[_0x16dfdc][_0x9edd('0x73')]()){var _0x6a1cfc=util['format'](_0x9edd('0x74'),_0x41ec97);if(_0x41ec97===0x1){_0x6a1cfc=_0x9edd('0x75');}throw new db[(_0x9edd('0x76'))]['ValidationError'](_0x6a1cfc);}}return;};exports[_0x9edd('0x77')]=function(_0x2e1ce3,_0x430eb4){var _0x15ebfa=_0x430eb4?encryptor[_0x9edd('0x72')](_0x430eb4)[_0x9edd('0x78')](','):[];if(_0x15ebfa['length']===0x5){_0x15ebfa['splice'](-0x1,0x1);}_0x15ebfa[_0x9edd('0x79')](_0x2e1ce3);return encryptor['encryptString'](_0x15ebfa[_0x9edd('0x7a')](','));};function signJwt(_0x3e9a3e){var _0x439083=BPromise[_0x9edd('0x7b')](jwt['sign'],{'context':jwt});var _0x21ead2=_0x3e9a3e['secret']||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0xc6bde6,_0x5ca123){_0x439083(_0x3e9a3e[_0x9edd('0x7d')],_0x21ead2,_0x3e9a3e['options'])[_0x9edd('0x3b')](function(_0x4e1eda){_0xc6bde6(_0x4e1eda);})['catch'](function(_0x236b82){_0x5ca123(_0x236b82);});});}function verifyJwt(_0x4a72d0,_0x141137,_0x134c9c){var _0x307a61=BPromise['promisify'](jwt[_0x9edd('0x7e')],{'context':jwt});var _0x321485=_0x134c9c||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0x467512,_0x4d8fbb){_0x307a61(_0x4a72d0,_0x321485,_0x141137)['then'](function(_0x2e1a96){_0x467512(_0x2e1a96);})[_0x9edd('0x48')](function(_0x5516c4){_0x4d8fbb(_0x5516c4);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x9edd('0x7f'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x9edd('0x80')]();}function createJwt(_0x32ff46){var _0x589348={'payload':{'iat':_0x32ff46[_0x9edd('0x6a')],'nonce':_0x32ff46[_0x9edd('0x52')]},'options':{'algorithm':_0x9edd('0x81'),'subject':_0x32ff46['id']['toString'](),'issuer':hardwareConf[_0x9edd('0x4d')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x589348)[_0x9edd('0x3b')](function(_0x18d1a0){return{'iat':_0x32ff46['apiKeyIat'],'nonce':_0x32ff46[_0x9edd('0x52')],'token':_0x18d1a0};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 04666f6..97d9605 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 _0x757a=['findOne','slice','fieldType','keys','type','./sql-utils','../../mysqldb','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','tags','checkListsRestrictions','ids','tag','countFilteredContacts','count','clause','rows','catch','describe','startsWith','cf_','map','CmCustomField'];(function(_0x58836f,_0x5351e2){var _0x28f9b1=function(_0x30a6cc){while(--_0x30a6cc){_0x58836f['push'](_0x58836f['shift']());}};_0x28f9b1(++_0x5351e2);}(_0x757a,0xde));var _0xa757=function(_0x47caf5,_0xe8407f){_0x47caf5=_0x47caf5-0x0;var _0x2e9754=_0x757a[_0x47caf5];return _0x2e9754;};'use strict';var _=require('lodash');var sqlUtils=require(_0xa757('0x0'));var db=require(_0xa757('0x1'))['db'];exports['findAll']=function(_0x5c03c3,_0x5709ed,_0x32be3b,_0x1721c6){var _0x1c2932={'count':0x0,'rows':[]};var _0x453d07=sqlUtils[_0xa757('0x2')](_0x5709ed,_0x5c03c3);if(_0x453d07){return Promise[_0xa757('0x3')](_0x1c2932);}var _0x5edca8=sqlUtils[_0xa757('0x4')]();var _0x4343b6={};var _0x53be0e=![];var _0x2930fa=![];return Promise[_0xa757('0x3')]()[_0xa757('0x5')](function(){if(_0x5c03c3[_0xa757('0x6')]){return sqlUtils[_0xa757('0x7')](_0x5c03c3['search'],_0x1721c6);}else{return sqlUtils[_0xa757('0x8')](_0x5c03c3,_0x1721c6);}})[_0xa757('0x5')](function(_0x32f0ec){_0x5edca8[_0xa757('0x9')](_0x32f0ec[_0xa757('0xa')]);_0x5edca8[_0xa757('0x9')](_0x32f0ec[_0xa757('0xb')]);_0x5edca8['where'](_0x32f0ec['filter']);_0x5edca8['where'](_0x32f0ec['user']['clause']);_0x4343b6=_0x32f0ec[_0xa757('0xc')];_0x2930fa=_0x32f0ec['user']['skip'];return sqlUtils[_0xa757('0xd')](_0x5709ed,_0x5c03c3,_0x2930fa);})['then'](function(_0x481508){_0x5edca8[_0xa757('0x9')](_0x481508);var _0x1b670e=_0x5c03c3[_0xa757('0x6')]?_0x4343b6[_0xa757('0xe')]:_0x5c03c3[_0xa757('0xf')];_0x53be0e=_0x1b670e?!![]:![];return sqlUtils[_0xa757('0x10')](_0x5edca8,_0x1b670e);})[_0xa757('0x5')](function(_0x2f7947){_0x1c2932[_0xa757('0x11')]=_0x2f7947;if(_0x1c2932[_0xa757('0x11')]===0x0){return;}return sqlUtils['buildContactsQuery'](_0x5edca8,_0x5c03c3[_0xa757('0xb')],_0x32be3b,_0x53be0e,_0x4343b6[_0xa757('0x12')],_0x2930fa);})[_0xa757('0x5')](function(_0x4d9f58){if(!_0x4d9f58){return[];}return sqlUtils['getFilteredContacts'](_0x4d9f58,_0x5c03c3,_0x32be3b);})[_0xa757('0x5')](function(_0x468d45){_0x1c2932[_0xa757('0x13')]=_0x468d45;return _0x1c2932;})[_0xa757('0x14')](function(_0x27f4ba){throw _0x27f4ba;});};exports[_0xa757('0x15')]=function(){var _0x4bd137={};var _0x58954=[];return db['CmContact'][_0xa757('0x15')]()[_0xa757('0x5')](function(_0x14014c){_0x4bd137=_0x14014c;var _0x2c9ec6=Object['keys'](_0x4bd137)['filter'](function(_0x40ec48){return _[_0xa757('0x16')](_0x40ec48,_0xa757('0x17'))?_0x40ec48:undefined;});var _0x8d121f=_0x2c9ec6[_0xa757('0x18')](function(_0x40562f){return db[_0xa757('0x19')][_0xa757('0x1a')]({'where':{'id':_0x40562f[_0xa757('0x1b')](0x3)},'raw':!![]});});return Promise['all'](_0x8d121f);})[_0xa757('0x5')](function(_0x59e9d4){for(var _0x422e9e=0x0;_0x422e9e<_0x59e9d4['length'];_0x422e9e++){if(_0x59e9d4[_0x422e9e]){var _0x40551d=_0xa757('0x17')+_0x59e9d4[_0x422e9e]['id'];_0x4bd137[_0x40551d][_0xa757('0x1c')]=_0x59e9d4[_0x422e9e]['type'];}}_0x58954=_[_0xa757('0x18')](Object[_0xa757('0x1d')](_0x4bd137),function(_0x471e84){return{'name':_0x471e84,'type':_0x4bd137[_0x471e84][_0xa757('0x1e')]};});return _0x58954;})['catch'](function(_0x449a7d){throw _0x449a7d;});}; \ No newline at end of file +var _0x2032=['map','findOne','slice','all','length','fieldType','type','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','where','user','ids','tag','countFilteredContacts','count','buildContactsQuery','clause','getFilteredContacts','rows','describe','CmContact','filter','startsWith','cf_'];(function(_0x11e444,_0x2394cd){var _0x577b0e=function(_0x4ebbf3){while(--_0x4ebbf3){_0x11e444['push'](_0x11e444['shift']());}};_0x577b0e(++_0x2394cd);}(_0x2032,0xd9));var _0x2203=function(_0x11104c,_0x339419){_0x11104c=_0x11104c-0x0;var _0x198712=_0x2032[_0x11104c];return _0x198712;};'use strict';var _=require('lodash');var sqlUtils=require(_0x2203('0x0'));var db=require(_0x2203('0x1'))['db'];exports[_0x2203('0x2')]=function(_0x4c28da,_0x486390,_0x228a29,_0x4b4c7f){var _0x46c49a={'count':0x0,'rows':[]};var _0x880dcd=sqlUtils[_0x2203('0x3')](_0x486390,_0x4c28da);if(_0x880dcd){return Promise[_0x2203('0x4')](_0x46c49a);}var _0x3f7ba1=sqlUtils[_0x2203('0x5')]();var _0x2e0f63={};var _0x2676aa=![];var _0x18c4d6=![];return Promise[_0x2203('0x4')]()[_0x2203('0x6')](function(){if(_0x4c28da['search']){return sqlUtils['parseAdvancedSearchFilter'](_0x4c28da[_0x2203('0x7')],_0x4b4c7f);}else{return sqlUtils['parseQueryParameters'](_0x4c28da,_0x4b4c7f);}})[_0x2203('0x6')](function(_0x2972f3){_0x3f7ba1[_0x2203('0x8')](_0x2972f3['default']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3['fields']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3['filter']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3[_0x2203('0x9')]['clause']);_0x2e0f63=_0x2972f3['tags'];_0x18c4d6=_0x2972f3['user']['skip'];return sqlUtils['checkListsRestrictions'](_0x486390,_0x4c28da,_0x18c4d6);})[_0x2203('0x6')](function(_0x538b30){_0x3f7ba1['where'](_0x538b30);var _0x21a3af=_0x4c28da[_0x2203('0x7')]?_0x2e0f63[_0x2203('0xa')]:_0x4c28da[_0x2203('0xb')];_0x2676aa=_0x21a3af?!![]:![];return sqlUtils[_0x2203('0xc')](_0x3f7ba1,_0x21a3af);})[_0x2203('0x6')](function(_0x2c36e6){_0x46c49a[_0x2203('0xd')]=_0x2c36e6;if(_0x46c49a[_0x2203('0xd')]===0x0){return;}return sqlUtils[_0x2203('0xe')](_0x3f7ba1,_0x4c28da['fields'],_0x228a29,_0x2676aa,_0x2e0f63[_0x2203('0xf')],_0x18c4d6);})[_0x2203('0x6')](function(_0x4893ff){if(!_0x4893ff){return[];}return sqlUtils[_0x2203('0x10')](_0x4893ff,_0x4c28da,_0x228a29);})[_0x2203('0x6')](function(_0x4aeb9f){_0x46c49a[_0x2203('0x11')]=_0x4aeb9f;return _0x46c49a;})['catch'](function(_0x2904ba){throw _0x2904ba;});};exports[_0x2203('0x12')]=function(){var _0x3c8c34={};var _0x3b4034=[];return db[_0x2203('0x13')][_0x2203('0x12')]()['then'](function(_0x13d3f7){_0x3c8c34=_0x13d3f7;var _0x50822b=Object['keys'](_0x3c8c34)[_0x2203('0x14')](function(_0x496d82){return _[_0x2203('0x15')](_0x496d82,_0x2203('0x16'))?_0x496d82:undefined;});var _0x5d4c4e=_0x50822b[_0x2203('0x17')](function(_0x5e29cd){return db['CmCustomField'][_0x2203('0x18')]({'where':{'id':_0x5e29cd[_0x2203('0x19')](0x3)},'raw':!![]});});return Promise[_0x2203('0x1a')](_0x5d4c4e);})[_0x2203('0x6')](function(_0x1244f4){for(var _0x3114ef=0x0;_0x3114ef<_0x1244f4[_0x2203('0x1b')];_0x3114ef++){if(_0x1244f4[_0x3114ef]){var _0x250349='cf_'+_0x1244f4[_0x3114ef]['id'];_0x3c8c34[_0x250349][_0x2203('0x1c')]=_0x1244f4[_0x3114ef][_0x2203('0x1d')];}}_0x3b4034=_[_0x2203('0x17')](Object['keys'](_0x3c8c34),function(_0xb2071b){return{'name':_0xb2071b,'type':_0x3c8c34[_0xb2071b][_0x2203('0x1d')]};});return _0x3b4034;})['catch'](function(_0xd6e109){throw _0xd6e109;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index cc58385..26b0266 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 _0xfd88=['select','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','keyBy','Sequelize','QueryTypes','CmContact','query','Tags','clone','isEmpty','t.id\x20IN\x20?','SELECT','toString','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','agent','search','ListId','true','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','lastName','mobile','fax','email','CompanyId','createdAt','deletedAt','TagIds','includes','push','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','length','find','dateOfBirth','fieldType','datetime','castTo','buildExpression','type','default','value','start','end','Tag','split','map','tags','clause','and','User','uc.UserId\x20=\x20?','user','skip','keys','some','name','Contact','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','tag','filter','role','getLists','c.ListId\x20IS\x20NULL','attributes'];(function(_0x3e0991,_0x4f7df4){var _0xea4798=function(_0xeb6e08){while(--_0xeb6e08){_0x3e0991['push'](_0x3e0991['shift']());}};_0xea4798(++_0x4f7df4);}(_0xfd88,0x1ca));var _0x8fd8=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0xfd88[_0x4687df];return _0x32eaef;};'use strict';var _=require(_0x8fd8('0x0'));var squel=require(_0x8fd8('0x1'));var as=require(_0x8fd8('0x2'));var qs=require(_0x8fd8('0x3'));var utils=require(_0x8fd8('0x4'));var db=require(_0x8fd8('0x5'))['db'];function skipContactsQuery(_0xf1817e,_0xa92e7c){var _0x545ce4=![];if(_0xf1817e['role']===_0x8fd8('0x6')&&!_0xa92e7c[_0x8fd8('0x7')]&&!_0xa92e7c[_0x8fd8('0x8')]&&_0xa92e7c['autocomplete']!==_0x8fd8('0x9')){_0x545ce4=!![];}return _0x545ce4;}function getContactsSubquery(){return squel['select']()[_0x8fd8('0xa')](_0x8fd8('0xb'),'c')[_0x8fd8('0xc')](_0x8fd8('0xd'));}function applyJoinClauses(_0x54f774,_0xc21b0a){var _0x52d6bd=_0xc21b0a?'c':_0x8fd8('0xe');_0x54f774[_0x8fd8('0xf')](_0x8fd8('0x10'),'uc',_0x8fd8('0x11')+_0x52d6bd+_0x8fd8('0x12'))['left_join'](_0x8fd8('0x13'),'ct',_0x8fd8('0x14')+_0x52d6bd+_0x8fd8('0x12'))[_0x8fd8('0xf')](_0x8fd8('0x15'),'t','t.id\x20=\x20ct.TagId');return _0x54f774;}function addFieldsToQuery(_0x455664,_0xa07e1c,_0x3c1892,_0x2af3a7,_0x464cc4){var _0x547324=_0x464cc4?'c':_0x8fd8('0xe');if(!_0xa07e1c){_0xa07e1c=['id','firstName',_0x8fd8('0x16'),'phone',_0x8fd8('0x17'),_0x8fd8('0x18'),_0x8fd8('0x19'),_0x8fd8('0x8'),_0x8fd8('0x1a'),_0x8fd8('0x1b'),'updatedAt',_0x8fd8('0x1c'),_0x8fd8('0x1d')];}else if(!_0xa07e1c[_0x8fd8('0x1e')]('id')){_0xa07e1c[_0x8fd8('0x1f')]('id');}var _0x173da1=_0x3c1892&&_0x464cc4||!_0x3c1892&&!_0x464cc4;if(_0x2af3a7){_0x173da1=_0x2af3a7&&_0x464cc4||!_0x2af3a7&&!_0x464cc4;}_0xa07e1c[_0x8fd8('0x20')](function(_0x41a0cf){if(_0x41a0cf===_0x8fd8('0x1d')){if(_0x173da1){_0x455664['field'](_0x8fd8('0x21'),_0x41a0cf);}else if(_0x3c1892||_0x2af3a7){_0x455664[_0x8fd8('0x22')](_0x547324+'.'+_0x41a0cf);}}else{_0x455664['field'](_0x547324+'.'+_0x41a0cf);}});return _0x455664;}function getSqlClauses(){var _0x25756a={'default':squel['expr'](),'fields':squel[_0x8fd8('0x23')](),'filter':squel[_0x8fd8('0x23')](),'tags':{'clause':squel[_0x8fd8('0x23')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x25756a;}function parseTagParameter(_0x2c2153){var _0x38a18f=squel[_0x8fd8('0x23')]();if(_0x2c2153){var _0x5dd195=utils[_0x8fd8('0x24')](_0x2c2153);_0x5dd195[_0x8fd8('0x20')](function(_0x2fc852){_0x38a18f['or'](_0x8fd8('0x25'),'%,'+_0x2fc852+',%');});}return _0x38a18f;}function parseSearchFilter(_0x4e06b7){var _0x40d3ce=squel[_0x8fd8('0x23')]();if(_0x4e06b7){var _0x30ee68=_0x4e06b7[_0x8fd8('0x26')]('\x5c','\x5c\x5c')[_0x8fd8('0x26')](/'/g,'\x27\x27');if(_0x30ee68['split']('\x20')['length']>0x1){_0x40d3ce['or'](_0x8fd8('0x27'),qs['getFullTextValue'](_0x30ee68),null);}else{if(qs['isNumeric'](_0x30ee68)){_0x40d3ce['or']('c.id\x20LIKE\x20?',_0x30ee68+'%');_0x40d3ce['or'](_0x8fd8('0x28'),_0x30ee68+'%');_0x40d3ce['or'](_0x8fd8('0x29'),_0x30ee68+'%');_0x40d3ce['or'](_0x8fd8('0x2a'),_0x30ee68+'%');}else if(qs[_0x8fd8('0x2b')](_0x30ee68)){_0x40d3ce['or'](_0x8fd8('0x2c'),_0x30ee68+'%');}else{_0x40d3ce['or'](_0x8fd8('0x2d'),'%'+_0x30ee68+'%');_0x40d3ce['or'](_0x8fd8('0x2e'),'%'+_0x30ee68+'%');_0x40d3ce['or']('c.email\x20LIKE\x20?','%'+_0x30ee68+'%');}}}return _0x40d3ce;}function parseAdvancedSearchFilter(_0x32200b,_0xd99416){var _0x4536cf=getSqlClauses();var _0x18a25f=as[_0x8fd8('0x2f')](_0x32200b);var _0x3eed15=_0x18a25f[_0x8fd8('0x30')];for(var _0x65b06a=0x0;_0x65b06a<_0x18a25f[_0x8fd8('0x31')][_0x8fd8('0x32')];_0x65b06a++){var _0x4cda86=_0x18a25f[_0x8fd8('0x31')][_0x65b06a];var _0x414437='c';var _0x49503d=_[_0x8fd8('0x33')](_0xd99416,['name',_0x4cda86[_0x8fd8('0x22')]]);if(_0x49503d){if(_0x4cda86['field']===_0x8fd8('0x34')||_0x49503d[_0x8fd8('0x35')]===_0x8fd8('0x36')){_0x4cda86[_0x8fd8('0x37')]='DATE';}var _0x4ad264=as[_0x8fd8('0x38')](_0x414437,_0x49503d[_0x8fd8('0x39')],_0x4cda86);_0x4536cf[_0x8fd8('0x3a')][_0x3eed15](_0x4ad264['text'],_0x4ad264[_0x8fd8('0x3b')][_0x8fd8('0x3c')],_0x4ad264[_0x8fd8('0x3b')][_0x8fd8('0x3d')]);}else{if(_0x4cda86[_0x8fd8('0x22')]===_0x8fd8('0x3e')){var _0xaa9130=_0x4cda86[_0x8fd8('0x3b')][_0x8fd8('0x3f')](',')[_0x8fd8('0x40')](function(_0x17eb26){return Number(_0x17eb26);});var _0x3f7366=parseTagParameter(_0xaa9130);_0x4536cf[_0x8fd8('0x41')][_0x8fd8('0x42')][_0x8fd8('0x43')](_0x3f7366);_0x4536cf[_0x8fd8('0x41')]['ids']=_0xaa9130;}else if(_0x4cda86['field']===_0x8fd8('0x44')){_0x4536cf['user']['clause']['and'](_0x8fd8('0x45'),_0x4cda86[_0x8fd8('0x3b')]);_0x4536cf[_0x8fd8('0x46')][_0x8fd8('0x47')]=!![];}}}return _0x4536cf;}function parseModelFields(_0x2ebce2,_0x4ecab9){var _0x4f5687=squel['expr']();var _0x1048ce=_(_0x2ebce2)[_0x8fd8('0x48')]()[_0x8fd8('0x40')](function(_0x20ba31){return _[_0x8fd8('0x49')](_0x4ecab9,[_0x8fd8('0x4a'),_0x20ba31])?_0x20ba31:undefined;})['compact']()[_0x8fd8('0x3b')]();if(_0x2ebce2[_0x8fd8('0x4b')]){_0x1048ce[_0x8fd8('0x1f')](_0x8fd8('0x4b'));}if(_0x1048ce[_0x8fd8('0x32')]>0x0){_0x1048ce[_0x8fd8('0x20')](function(_0x115c9a){if(_0x115c9a===_0x8fd8('0x8')){_0x4f5687['and'](_0x8fd8('0x4c'),[]['concat'](_0x2ebce2[_0x115c9a]));}else if(_0x115c9a===_0x8fd8('0x4b')){var _0x377b98='%'+_0x2ebce2[_0x115c9a]+'%';_0x4f5687[_0x8fd8('0x43')](_0x8fd8('0x4d'),_0x377b98);}else{_0x4f5687['and']('c.'+_0x115c9a+_0x8fd8('0x4e'),_0x2ebce2[_0x115c9a]);}});}return _0x4f5687;}function parseQueryParameters(_0x29c7b0,_0x3faa19){var _0x4cf401=getSqlClauses();return Promise[_0x8fd8('0x4f')]()['then'](function(){return parseModelFields(_0x29c7b0,_0x3faa19);})[_0x8fd8('0x50')](function(_0x4b841e){_0x4cf401['fields'][_0x8fd8('0x43')](_0x4b841e);return parseTagParameter(_0x29c7b0[_0x8fd8('0x51')]);})['then'](function(_0x3a645a){_0x4cf401[_0x8fd8('0x41')][_0x8fd8('0x42')][_0x8fd8('0x43')](_0x3a645a);return parseSearchFilter(_0x29c7b0['filter']);})['then'](function(_0x39425c){_0x4cf401[_0x8fd8('0x52')]=_0x39425c;return _0x4cf401;});}function checkListsRestrictions(_0x15d5b4,_0x1413b8,_0x2f520d){var _0x124496=squel[_0x8fd8('0x23')]();return Promise[_0x8fd8('0x4f')]()[_0x8fd8('0x50')](function(){if(_0x1413b8[_0x8fd8('0x7')]&&_0x15d5b4[_0x8fd8('0x53')]===_0x8fd8('0x6')&&!_0x2f520d){return _0x15d5b4[_0x8fd8('0x54')]({'attributes':['id'],'raw':!![]});}})[_0x8fd8('0x50')](function(_0x292a0b){if(_0x292a0b){if(_0x292a0b[_0x8fd8('0x32')]===0x0){_0x124496['and'](_0x8fd8('0x55'));}else{_0x124496[_0x8fd8('0x43')](_0x8fd8('0x4c'),_['map'](_0x292a0b,'id'));}}})[_0x8fd8('0x50')](function(){return _0x124496;});}function buildContactsQuery(_0x7b3bba,_0x245998,_0x58aee0,_0x5b6032,_0x3d4928,_0x4047fa){if(_0x245998){_0x245998=_0x58aee0[_0x8fd8('0x56')];}_0x7b3bba=addFieldsToQuery(_0x7b3bba,_0x245998,_0x5b6032,_0x4047fa,!![]);var _0x439bee=squel[_0x8fd8('0x57')]();_0x439bee=addFieldsToQuery(_0x439bee,_0x245998,_0x5b6032,_0x4047fa,![]);if(_0x5b6032||_0x4047fa){_0x7b3bba=applyJoinClauses(_0x7b3bba,!![]);_0x7b3bba[_0x8fd8('0x58')](_0x8fd8('0x59'));if(_0x58aee0[_0x8fd8('0x5a')]){_0x439bee['limit'](_0x58aee0['limit']);}if(_0x58aee0[_0x8fd8('0x5b')]){_0x439bee[_0x8fd8('0x5b')](_0x58aee0[_0x8fd8('0x5b')]);}}else{_0x439bee=applyJoinClauses(_0x439bee,![]);_0x439bee['group'](_0x8fd8('0x5c'));if(_0x58aee0[_0x8fd8('0x5a')]){_0x7b3bba[_0x8fd8('0x5a')](_0x58aee0['limit']);}if(_0x58aee0[_0x8fd8('0x5b')]){_0x7b3bba[_0x8fd8('0x5b')](_0x58aee0[_0x8fd8('0x5b')]);}}_0x439bee[_0x8fd8('0x5d')](_0x3d4928);if(_0x58aee0[_0x8fd8('0x5e')]){_0x58aee0[_0x8fd8('0x5e')]['forEach'](function(_0x29c9c7){_0x7b3bba[_0x8fd8('0x5e')]('c.'+_0x29c9c7[0x0],_0x29c9c7[0x1]===_0x8fd8('0x5f')?![]:!![]);_0x439bee[_0x8fd8('0x5e')](_0x8fd8('0x60')+_0x29c9c7[0x0],_0x29c9c7[0x1]===_0x8fd8('0x5f')?![]:!![]);});}_0x439bee[_0x8fd8('0xa')](_0x7b3bba,_0x8fd8('0xe'));return _0x439bee;}function getFilteredContacts(_0x55b6ba){var _0x35bb81=[];return db[_0x8fd8('0x3e')][_0x8fd8('0x61')]({'attributes':['id',_0x8fd8('0x4a'),'color'],'raw':!![]})[_0x8fd8('0x50')](function(_0x3dc388){_0x35bb81=_[_0x8fd8('0x62')](_0x3dc388,'id');var _0x4685f0={'type':db[_0x8fd8('0x63')][_0x8fd8('0x64')]['SELECT'],'model':db[_0x8fd8('0x65')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x8fd8('0x66')](_0x55b6ba['toString'](),_0x4685f0);})[_0x8fd8('0x50')](function(_0x34849f){_0x34849f[_0x8fd8('0x20')](function(_0x15a758){if(_0x15a758[_0x8fd8('0x1d')]){_0x15a758[_0x8fd8('0x67')]=[];_0x15a758['TagIds'][_0x8fd8('0x3f')](',')[_0x8fd8('0x20')](function(_0xd88bd4){_0x15a758[_0x8fd8('0x67')]['push'](_0x35bb81[_0xd88bd4]);});}delete _0x15a758[_0x8fd8('0x1d')];});return _0x34849f;});}function countFilteredContacts(_0x46733c,_0x1d0284){var _0x484103=_0x46733c[_0x8fd8('0x68')]();_0x484103['field']('COUNT(*)');_0x484103=applyJoinClauses(_0x484103,!![]);_0x46733c[_0x8fd8('0x58')]('c.id');var _0x8434f6=utils[_0x8fd8('0x24')](_0x1d0284);if(!_[_0x8fd8('0x69')](_0x8434f6)){_0x484103[_0x8fd8('0xc')](_0x8fd8('0x6a'),_0x8434f6);}var _0x3c3a34={'type':db[_0x8fd8('0x63')][_0x8fd8('0x64')][_0x8fd8('0x6b')],'raw':!![]};return db['sequelize'][_0x8fd8('0x66')](_0x484103[_0x8fd8('0x6c')](),_0x3c3a34)['then'](function(_0x1de046){return _0x1de046[0x0]['COUNT(*)'];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xbdae=['text','value','start','end','Tag','map','tags','clause','ids','User','and','uc.UserId\x20=\x20?','user','skip','keys','some','compact','Contact','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','getLists','c.ListId\x20IS\x20NULL','attributes','c.id','limit','offset','group','having','order','DESC','subqry.','keyBy','Sequelize','QueryTypes','SELECT','query','toString','TagIds','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','sequelize','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../../mysqldb','agent','search','ListId','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','cm_contact_has_tags','.id','firstName','lastName','fax','email','CompanyId','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','datetime','DATE','buildExpression','type'];(function(_0x5a4846,_0x28d781){var _0x2d2276=function(_0x2af201){while(--_0x2af201){_0x5a4846['push'](_0x5a4846['shift']());}};_0x2d2276(++_0x28d781);}(_0xbdae,0x1dc));var _0xebda=function(_0x4f0cc2,_0x463c25){_0x4f0cc2=_0x4f0cc2-0x0;var _0x1eb94f=_0xbdae[_0x4f0cc2];return _0x1eb94f;};'use strict';var _=require(_0xebda('0x0'));var squel=require(_0xebda('0x1'));var as=require(_0xebda('0x2'));var qs=require(_0xebda('0x3'));var utils=require('../interaction/utils');var db=require(_0xebda('0x4'))['db'];function skipContactsQuery(_0x2cdc90,_0x2446be){var _0x3457c4=![];if(_0x2cdc90['role']===_0xebda('0x5')&&!_0x2446be[_0xebda('0x6')]&&!_0x2446be[_0xebda('0x7')]&&_0x2446be['autocomplete']!=='true'){_0x3457c4=!![];}return _0x3457c4;}function getContactsSubquery(){return squel[_0xebda('0x8')]()[_0xebda('0x9')](_0xebda('0xa'),'c')[_0xebda('0xb')](_0xebda('0xc'));}function applyJoinClauses(_0x56e471,_0x17af17){var _0x4671a2=_0x17af17?'c':_0xebda('0xd');_0x56e471[_0xebda('0xe')](_0xebda('0xf'),'uc',_0xebda('0x10')+_0x4671a2+'.id')['left_join'](_0xebda('0x11'),'ct','ct.CmContactId\x20=\x20'+_0x4671a2+_0xebda('0x12'))[_0xebda('0xe')]('tools_tags','t','t.id\x20=\x20ct.TagId');return _0x56e471;}function addFieldsToQuery(_0x227ee7,_0x29a28f,_0x2723d4,_0x32abe4,_0x494b06){var _0x449d7b=_0x494b06?'c':_0xebda('0xd');if(!_0x29a28f){_0x29a28f=['id',_0xebda('0x13'),_0xebda('0x14'),'phone','mobile',_0xebda('0x15'),_0xebda('0x16'),_0xebda('0x7'),_0xebda('0x17'),'createdAt','updatedAt','deletedAt','TagIds'];}else if(!_0x29a28f['includes']('id')){_0x29a28f[_0xebda('0x18')]('id');}var _0x3fe7b7=_0x2723d4&&_0x494b06||!_0x2723d4&&!_0x494b06;if(_0x32abe4){_0x3fe7b7=_0x32abe4&&_0x494b06||!_0x32abe4&&!_0x494b06;}_0x29a28f[_0xebda('0x19')](function(_0x464bd7){if(_0x464bd7==='TagIds'){if(_0x3fe7b7){_0x227ee7[_0xebda('0x1a')](_0xebda('0x1b'),_0x464bd7);}else if(_0x2723d4||_0x32abe4){_0x227ee7['field'](_0x449d7b+'.'+_0x464bd7);}}else{_0x227ee7[_0xebda('0x1a')](_0x449d7b+'.'+_0x464bd7);}});return _0x227ee7;}function getSqlClauses(){var _0x23b02d={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0xebda('0x1c')](),'tags':{'clause':squel[_0xebda('0x1c')](),'ids':null},'user':{'clause':squel[_0xebda('0x1c')](),'skip':![]}};return _0x23b02d;}function parseTagParameter(_0x17eb32){var _0x144e11=squel['expr']();if(_0x17eb32){var _0x552f70=utils[_0xebda('0x1d')](_0x17eb32);_0x552f70[_0xebda('0x19')](function(_0x2ba9e8){_0x144e11['or'](_0xebda('0x1e'),'%,'+_0x2ba9e8+',%');});}return _0x144e11;}function parseSearchFilter(_0x35bfb4){var _0x1328e5=squel[_0xebda('0x1c')]();if(_0x35bfb4){var _0x1d5837=_0x35bfb4[_0xebda('0x1f')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x1d5837[_0xebda('0x20')]('\x20')[_0xebda('0x21')]>0x1){_0x1328e5['or'](_0xebda('0x22'),qs[_0xebda('0x23')](_0x1d5837),null);}else{if(qs['isNumeric'](_0x1d5837)){_0x1328e5['or'](_0xebda('0x24'),_0x1d5837+'%');_0x1328e5['or'](_0xebda('0x25'),_0x1d5837+'%');_0x1328e5['or'](_0xebda('0x26'),_0x1d5837+'%');_0x1328e5['or'](_0xebda('0x27'),_0x1d5837+'%');}else if(qs[_0xebda('0x28')](_0x1d5837)){_0x1328e5['or']('c.email\x20LIKE\x20?',_0x1d5837+'%');}else{_0x1328e5['or'](_0xebda('0x29'),'%'+_0x1d5837+'%');_0x1328e5['or'](_0xebda('0x2a'),'%'+_0x1d5837+'%');_0x1328e5['or'](_0xebda('0x2b'),'%'+_0x1d5837+'%');}}}return _0x1328e5;}function parseAdvancedSearchFilter(_0x1e85bf,_0x25fc1c){var _0x529a86=getSqlClauses();var _0x1fb30a=as[_0xebda('0x2c')](_0x1e85bf);var _0x419e93=_0x1fb30a[_0xebda('0x2d')];for(var _0x512135=0x0;_0x512135<_0x1fb30a['conditions'][_0xebda('0x21')];_0x512135++){var _0x5d3fd5=_0x1fb30a[_0xebda('0x2e')][_0x512135];var _0x214803='c';var _0x2b0a0e=_[_0xebda('0x2f')](_0x25fc1c,[_0xebda('0x30'),_0x5d3fd5['field']]);if(_0x2b0a0e){if(_0x5d3fd5[_0xebda('0x1a')]===_0xebda('0x31')||_0x2b0a0e['fieldType']===_0xebda('0x32')){_0x5d3fd5['castTo']=_0xebda('0x33');}var _0x5efe64=as[_0xebda('0x34')](_0x214803,_0x2b0a0e[_0xebda('0x35')],_0x5d3fd5);_0x529a86['default'][_0x419e93](_0x5efe64[_0xebda('0x36')],_0x5efe64[_0xebda('0x37')][_0xebda('0x38')],_0x5efe64[_0xebda('0x37')][_0xebda('0x39')]);}else{if(_0x5d3fd5[_0xebda('0x1a')]===_0xebda('0x3a')){var _0x97f7ae=_0x5d3fd5[_0xebda('0x37')][_0xebda('0x20')](',')[_0xebda('0x3b')](function(_0x3dee46){return Number(_0x3dee46);});var _0x40bb86=parseTagParameter(_0x97f7ae);_0x529a86[_0xebda('0x3c')][_0xebda('0x3d')]['and'](_0x40bb86);_0x529a86['tags'][_0xebda('0x3e')]=_0x97f7ae;}else if(_0x5d3fd5[_0xebda('0x1a')]===_0xebda('0x3f')){_0x529a86['user']['clause'][_0xebda('0x40')](_0xebda('0x41'),_0x5d3fd5[_0xebda('0x37')]);_0x529a86[_0xebda('0x42')][_0xebda('0x43')]=!![];}}}return _0x529a86;}function parseModelFields(_0x2f669f,_0x12bffc){var _0x1558e4=squel[_0xebda('0x1c')]();var _0x4ff7db=_(_0x2f669f)[_0xebda('0x44')]()['map'](function(_0x125612){return _[_0xebda('0x45')](_0x12bffc,[_0xebda('0x30'),_0x125612])?_0x125612:undefined;})[_0xebda('0x46')]()[_0xebda('0x37')]();if(_0x2f669f[_0xebda('0x47')]){_0x4ff7db[_0xebda('0x18')](_0xebda('0x47'));}if(_0x4ff7db[_0xebda('0x21')]>0x0){_0x4ff7db[_0xebda('0x19')](function(_0x41852e){if(_0x41852e==='ListId'){_0x1558e4[_0xebda('0x40')](_0xebda('0x48'),[][_0xebda('0x49')](_0x2f669f[_0x41852e]));}else if(_0x41852e==='Contact'){var _0x443657='%'+_0x2f669f[_0x41852e]+'%';_0x1558e4['and'](_0xebda('0x4a'),_0x443657);}else{_0x1558e4[_0xebda('0x40')]('c.'+_0x41852e+_0xebda('0x4b'),_0x2f669f[_0x41852e]);}});}return _0x1558e4;}function parseQueryParameters(_0x453907,_0x5475ae){var _0x202020=getSqlClauses();return Promise[_0xebda('0x4c')]()[_0xebda('0x4d')](function(){return parseModelFields(_0x453907,_0x5475ae);})[_0xebda('0x4d')](function(_0x20901f){_0x202020[_0xebda('0x4e')]['and'](_0x20901f);return parseTagParameter(_0x453907[_0xebda('0x4f')]);})['then'](function(_0x18ab03){_0x202020[_0xebda('0x3c')]['clause'][_0xebda('0x40')](_0x18ab03);return parseSearchFilter(_0x453907['filter']);})['then'](function(_0x1efb84){_0x202020[_0xebda('0x50')]=_0x1efb84;return _0x202020;});}function checkListsRestrictions(_0x159529,_0x26838f,_0x53008a){var _0x49f951=squel['expr']();return Promise[_0xebda('0x4c')]()[_0xebda('0x4d')](function(){if(_0x26838f[_0xebda('0x6')]&&_0x159529['role']===_0xebda('0x5')&&!_0x53008a){return _0x159529[_0xebda('0x51')]({'attributes':['id'],'raw':!![]});}})[_0xebda('0x4d')](function(_0xda2a20){if(_0xda2a20){if(_0xda2a20[_0xebda('0x21')]===0x0){_0x49f951['and'](_0xebda('0x52'));}else{_0x49f951[_0xebda('0x40')](_0xebda('0x48'),_[_0xebda('0x3b')](_0xda2a20,'id'));}}})['then'](function(){return _0x49f951;});}function buildContactsQuery(_0x41355c,_0x190d80,_0x4deb4e,_0x484248,_0x27c8f0,_0x56f2c7){if(_0x190d80){_0x190d80=_0x4deb4e[_0xebda('0x53')];}_0x41355c=addFieldsToQuery(_0x41355c,_0x190d80,_0x484248,_0x56f2c7,!![]);var _0x2edb17=squel['select']();_0x2edb17=addFieldsToQuery(_0x2edb17,_0x190d80,_0x484248,_0x56f2c7,![]);if(_0x484248||_0x56f2c7){_0x41355c=applyJoinClauses(_0x41355c,!![]);_0x41355c['group'](_0xebda('0x54'));if(_0x4deb4e[_0xebda('0x55')]){_0x2edb17[_0xebda('0x55')](_0x4deb4e[_0xebda('0x55')]);}if(_0x4deb4e[_0xebda('0x56')]){_0x2edb17[_0xebda('0x56')](_0x4deb4e[_0xebda('0x56')]);}}else{_0x2edb17=applyJoinClauses(_0x2edb17,![]);_0x2edb17[_0xebda('0x57')]('subqry.id');if(_0x4deb4e[_0xebda('0x55')]){_0x41355c[_0xebda('0x55')](_0x4deb4e[_0xebda('0x55')]);}if(_0x4deb4e['offset']){_0x41355c[_0xebda('0x56')](_0x4deb4e[_0xebda('0x56')]);}}_0x2edb17[_0xebda('0x58')](_0x27c8f0);if(_0x4deb4e[_0xebda('0x59')]){_0x4deb4e[_0xebda('0x59')][_0xebda('0x19')](function(_0x523a86){_0x41355c['order']('c.'+_0x523a86[0x0],_0x523a86[0x1]===_0xebda('0x5a')?![]:!![]);_0x2edb17['order'](_0xebda('0x5b')+_0x523a86[0x0],_0x523a86[0x1]===_0xebda('0x5a')?![]:!![]);});}_0x2edb17['from'](_0x41355c,_0xebda('0xd'));return _0x2edb17;}function getFilteredContacts(_0x413d2e){var _0x1763d2=[];return db[_0xebda('0x3a')]['findAll']({'attributes':['id','name','color'],'raw':!![]})[_0xebda('0x4d')](function(_0x30eecf){_0x1763d2=_[_0xebda('0x5c')](_0x30eecf,'id');var _0x31108b={'type':db[_0xebda('0x5d')][_0xebda('0x5e')][_0xebda('0x5f')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0xebda('0x60')](_0x413d2e[_0xebda('0x61')](),_0x31108b);})[_0xebda('0x4d')](function(_0x370ec5){_0x370ec5[_0xebda('0x19')](function(_0x38d2ce){if(_0x38d2ce[_0xebda('0x62')]){_0x38d2ce[_0xebda('0x63')]=[];_0x38d2ce[_0xebda('0x62')][_0xebda('0x20')](',')[_0xebda('0x19')](function(_0x3a0a6d){_0x38d2ce[_0xebda('0x63')][_0xebda('0x18')](_0x1763d2[_0x3a0a6d]);});}delete _0x38d2ce[_0xebda('0x62')];});return _0x370ec5;});}function countFilteredContacts(_0x19bd48,_0x47be4a){var _0xd2f4cc=_0x19bd48[_0xebda('0x64')]();_0xd2f4cc['field'](_0xebda('0x65'));_0xd2f4cc=applyJoinClauses(_0xd2f4cc,!![]);_0x19bd48[_0xebda('0x57')](_0xebda('0x54'));var _0x590117=utils[_0xebda('0x1d')](_0x47be4a);if(!_[_0xebda('0x66')](_0x590117)){_0xd2f4cc[_0xebda('0xb')](_0xebda('0x67'),_0x590117);}var _0x55d9fe={'type':db[_0xebda('0x5d')][_0xebda('0x5e')][_0xebda('0x5f')],'raw':!![]};return db[_0xebda('0x68')][_0xebda('0x60')](_0xd2f4cc['toString'](),_0x55d9fe)[_0xebda('0x4d')](function(_0x488c7c){return _0x488c7c[0x0]['COUNT(*)'];});}module[_0xebda('0x69')]={'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 cd59412..e3131d3 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 _0x1239=['error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','binary','write','end','final','close','createDecipher','unlink','encryptString','secret','createCipher','update','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','aes-256-ctr','encrypt','algorithm','join'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1239,0x1b6));var _0x9123=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1239[_0x2dafbe];return _0x58a45a;};'use strict';var crypto=require(_0x9123('0x0'));var fs=require('fs');var BPromise=require(_0x9123('0x1'));var _=require(_0x9123('0x2'));var config=require(_0x9123('0x3'));var logger=require(_0x9123('0x4'))(_0x9123('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':_0x9123('0x6')};const fileOptions={'algorithm':'aes192'};if(config[_0x9123('0x7')]&&config['encrypt'][_0x9123('0x8')]){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions[_0x9123('0x8')]=config[_0x9123('0x7')][_0x9123('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x9123('0x9')](',\x20');logger[_0x9123('0xa')](config[_0x9123('0x7')][_0x9123('0x8')],_0x9123('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x4d1051){return AES_SUPPORTED_RX[_0x9123('0xc')](_0x4d1051);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x9123('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x494725){return getSupportedCiphers()[_0x9123('0xe')](_0x494725)>-0x1;}function combineOptions(_0x4c8433){var _0x388a86={};for(var _0x1e8c4e in fileOptions){if(fileOptions[_0x9123('0xf')](_0x1e8c4e)){_0x388a86[_0x1e8c4e]=fileOptions[_0x1e8c4e];}}if(_0x4c8433){for(var _0x2578f4 in _0x4c8433){if(_0x4c8433[_0x9123('0xf')](_0x2578f4)){_0x388a86[_0x2578f4]=_0x4c8433[_0x2578f4];}}}return _0x388a86;}exports['encryptFile']=function(_0x3c31b9,_0x5a19ff,_0x3170da,_0x135114){return new BPromise(function(_0x52a154,_0x159928){_0x135114=combineOptions(_0x135114);var _0x1a8a4b=new Buffer(_0x3170da);var _0x46fb09=fs[_0x9123('0x10')](_0x3c31b9);var _0x248e4a=fs[_0x9123('0x11')](_0x5a19ff);var _0x12ce0b=crypto['createCipher'](_0x135114['algorithm'],_0x1a8a4b);_0x46fb09['on']('data',function(_0x5444b2){var _0x13aa4e=new Buffer(_0x12ce0b['update'](_0x5444b2),_0x9123('0x12'));_0x248e4a[_0x9123('0x13')](_0x13aa4e);});_0x46fb09['on'](_0x9123('0x14'),function(){try{var _0x279c9b=new Buffer(_0x12ce0b[_0x9123('0x15')](_0x9123('0x12')),_0x9123('0x12'));_0x248e4a[_0x9123('0x13')](_0x279c9b);_0x248e4a[_0x9123('0x14')]();_0x248e4a['on'](_0x9123('0x16'),function(){return _0x52a154(_0x5a19ff);});}catch(_0x3282ee){fs['unlink'](_0x5a19ff);return _0x159928(_0x3282ee);}});});};exports['decryptFile']=function(_0xc17018,_0x5120a3,_0xd325ba,_0x5a55c7){return new BPromise(function(_0x4ea3e9,_0x24570e){_0x5a55c7=combineOptions(_0x5a55c7);var _0x572abc=new Buffer(_0xd325ba);var _0x163847=fs['createReadStream'](_0xc17018);var _0x42a7ca=fs[_0x9123('0x11')](_0x5120a3);var _0x130204=crypto[_0x9123('0x17')](_0x5a55c7[_0x9123('0x8')],_0x572abc);_0x163847['on']('data',function(_0x2cf6e8){var _0x4d30a9=new Buffer(_0x130204['update'](_0x2cf6e8),'binary');_0x42a7ca['write'](_0x4d30a9);});_0x163847['on']('end',function(){try{var _0x3f8004=new Buffer(_0x130204[_0x9123('0x15')](_0x9123('0x12')),'binary');_0x42a7ca[_0x9123('0x13')](_0x3f8004);_0x42a7ca['end']();_0x42a7ca['on'](_0x9123('0x16'),function(){return _0x4ea3e9(_0x5120a3);});}catch(_0x5950d4){fs[_0x9123('0x18')](_0x5120a3);return _0x24570e(_0x5950d4);}});});};exports[_0x9123('0x19')]=function(_0x44f0eb,_0x1c32f7,_0x160673){var _0x56dba0=_0x160673||stringOptions[_0x9123('0x8')];var _0xcd13a3=_0x1c32f7||stringOptions[_0x9123('0x1a')];var _0x5e5917=crypto[_0x9123('0x1b')](_0x56dba0,_0xcd13a3);var _0x14f9c1=_0x5e5917[_0x9123('0x1c')](_0x44f0eb,_0x9123('0x1d'),_0x9123('0x1e'));_0x14f9c1+=_0x5e5917[_0x9123('0x15')](_0x9123('0x1e'));return _0x14f9c1;};exports[_0x9123('0x1f')]=function(_0x2b8af3,_0x46d2d9,_0x7b0ac4){var _0x2da349=_0x7b0ac4||stringOptions[_0x9123('0x8')];var _0x20471d=_0x46d2d9||stringOptions[_0x9123('0x1a')];var _0x5906bc=crypto[_0x9123('0x17')](_0x2da349,_0x20471d);var _0x23fc51=_0x5906bc[_0x9123('0x1c')](_0x2b8af3,_0x9123('0x1e'),_0x9123('0x1d'));_0x23fc51+=_0x5906bc[_0x9123('0x15')](_0x9123('0x1d'));return _0x23fc51;}; \ No newline at end of file +var _0x78d4=['join','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','end','binary','write','unlink','createDecipher','close','secret','createCipher','update','utf8','base64','decryptString','final','crypto','bluebird','lodash','../../config/environment','app','secrets','session','aes-256-ctr','encrypt','algorithm'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x78d4,0xbc));var _0x478d=function(_0x51ad2f,_0x3d022e){_0x51ad2f=_0x51ad2f-0x0;var _0x5414f8=_0x78d4[_0x51ad2f];return _0x5414f8;};'use strict';var crypto=require(_0x478d('0x0'));var fs=require('fs');var BPromise=require(_0x478d('0x1'));var _=require(_0x478d('0x2'));var config=require(_0x478d('0x3'));var logger=require('../../config/logger')(_0x478d('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x478d('0x5')][_0x478d('0x6')],'algorithm':_0x478d('0x7')};const fileOptions={'algorithm':'aes192'};if(config[_0x478d('0x8')]&&config[_0x478d('0x8')][_0x478d('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x478d('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0x478d('0x8')][_0x478d('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x478d('0xa')](',\x20');logger['error'](config['encrypt'][_0x478d('0x9')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x1fd392){return AES_SUPPORTED_RX[_0x478d('0xb')](_0x1fd392);}function getSupportedCiphers(){return crypto[_0x478d('0xc')]()[_0x478d('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x4f2abd){return getSupportedCiphers()[_0x478d('0xe')](_0x4f2abd)>-0x1;}function combineOptions(_0x42ed3d){var _0x498562={};for(var _0x9739b4 in fileOptions){if(fileOptions[_0x478d('0xf')](_0x9739b4)){_0x498562[_0x9739b4]=fileOptions[_0x9739b4];}}if(_0x42ed3d){for(var _0x26e3f7 in _0x42ed3d){if(_0x42ed3d[_0x478d('0xf')](_0x26e3f7)){_0x498562[_0x26e3f7]=_0x42ed3d[_0x26e3f7];}}}return _0x498562;}exports[_0x478d('0x10')]=function(_0x1516d6,_0x531f15,_0x1726ca,_0x2db29b){return new BPromise(function(_0x3a40f5,_0x3a94f6){_0x2db29b=combineOptions(_0x2db29b);var _0x446b84=new Buffer(_0x1726ca);var _0x32bd55=fs[_0x478d('0x11')](_0x1516d6);var _0x4e8a00=fs[_0x478d('0x12')](_0x531f15);var _0x5e175e=crypto['createCipher'](_0x2db29b['algorithm'],_0x446b84);_0x32bd55['on'](_0x478d('0x13'),function(_0x3b6482){var _0x5eda86=new Buffer(_0x5e175e['update'](_0x3b6482),'binary');_0x4e8a00['write'](_0x5eda86);});_0x32bd55['on'](_0x478d('0x14'),function(){try{var _0x1dfc3e=new Buffer(_0x5e175e['final']('binary'),_0x478d('0x15'));_0x4e8a00[_0x478d('0x16')](_0x1dfc3e);_0x4e8a00[_0x478d('0x14')]();_0x4e8a00['on']('close',function(){return _0x3a40f5(_0x531f15);});}catch(_0x525f6b){fs[_0x478d('0x17')](_0x531f15);return _0x3a94f6(_0x525f6b);}});});};exports['decryptFile']=function(_0x3fcb61,_0x46586f,_0x5cc72d,_0x3a464a){return new BPromise(function(_0x3b9514,_0x2cfc0d){_0x3a464a=combineOptions(_0x3a464a);var _0x137b1a=new Buffer(_0x5cc72d);var _0x263a72=fs[_0x478d('0x11')](_0x3fcb61);var _0x5bbc87=fs[_0x478d('0x12')](_0x46586f);var _0x2b9582=crypto[_0x478d('0x18')](_0x3a464a[_0x478d('0x9')],_0x137b1a);_0x263a72['on'](_0x478d('0x13'),function(_0x19cbd8){var _0x1dfb12=new Buffer(_0x2b9582['update'](_0x19cbd8),'binary');_0x5bbc87[_0x478d('0x16')](_0x1dfb12);});_0x263a72['on'](_0x478d('0x14'),function(){try{var _0x19db7b=new Buffer(_0x2b9582['final'](_0x478d('0x15')),_0x478d('0x15'));_0x5bbc87[_0x478d('0x16')](_0x19db7b);_0x5bbc87['end']();_0x5bbc87['on'](_0x478d('0x19'),function(){return _0x3b9514(_0x46586f);});}catch(_0x334bfa){fs['unlink'](_0x46586f);return _0x2cfc0d(_0x334bfa);}});});};exports['encryptString']=function(_0x59e689,_0x142da9,_0x3cda2a){var _0x280a45=_0x3cda2a||stringOptions[_0x478d('0x9')];var _0xd88916=_0x142da9||stringOptions[_0x478d('0x1a')];var _0x37cf4f=crypto[_0x478d('0x1b')](_0x280a45,_0xd88916);var _0x32be01=_0x37cf4f[_0x478d('0x1c')](_0x59e689,_0x478d('0x1d'),_0x478d('0x1e'));_0x32be01+=_0x37cf4f['final']('base64');return _0x32be01;};exports[_0x478d('0x1f')]=function(_0x55da05,_0x310530,_0x3daff1){var _0x474c27=_0x3daff1||stringOptions['algorithm'];var _0x29b928=_0x310530||stringOptions[_0x478d('0x1a')];var _0xd3f662=crypto['createDecipher'](_0x474c27,_0x29b928);var _0x5bbf35=_0xd3f662[_0x478d('0x1c')](_0x55da05,_0x478d('0x1e'),_0x478d('0x1d'));_0x5bbf35+=_0xd3f662[_0x478d('0x20')](_0x478d('0x1d'));return _0x5bbf35;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 945663a..0bc91f9 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 _0xc4b8=['forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip\x20finished','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','length','range'];(function(_0x902fb0,_0x81c2e){var _0x2ff07d=function(_0x1018fe){while(--_0x1018fe){_0x902fb0['push'](_0x902fb0['shift']());}};_0x2ff07d(++_0x81c2e);}(_0xc4b8,0x19f));var _0x8c4b=function(_0x41834b,_0x1f4958){_0x41834b=_0x41834b-0x0;var _0x54defe=_0xc4b8[_0x41834b];return _0x54defe;};'use strict';var util=require(_0x8c4b('0x0'));var path=require(_0x8c4b('0x1'));var _=require(_0x8c4b('0x2'));var csv=require(_0x8c4b('0x3'));var fs=require('fs');var BPromise=require(_0x8c4b('0x4'));var zipdir=require(_0x8c4b('0x5'));var rimraf=require(_0x8c4b('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0x8c4b('0x7'))[_0x8c4b('0x8')];var logger=require(_0x8c4b('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x8c4b('0xa')][0x2]);var QUERY=process[_0x8c4b('0xa')][0x3];var PATH=process[_0x8c4b('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x486b36,_0x5466fc){var _0x5b582c={'status':_0x486b36};var _0x4e86a0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5466fc){_0x5b582c[_0x8c4b('0xb')]=_0x5466fc;}return db[_0x8c4b('0xc')]['update'](_0x5b582c,_0x4e86a0);}function main(){var _0x5b54a8=0x1388;var _0x3c5913;logger[_0x8c4b('0xd')](util[_0x8c4b('0xe')](_0x8c4b('0xf'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x8c4b('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8c4b('0x11'),_0x8c4b('0x12')]})[_0x8c4b('0x13')](function(_0x2b6985){if(_0x2b6985){_0x3c5913=_0x2b6985;_0x5b54a8=_0x3c5913[_0x8c4b('0x12')]||0x1388;}})[_0x8c4b('0x13')](function(){return dbH[_0x8c4b('0x14')]['query'](util[_0x8c4b('0xe')](_0x8c4b('0x15'),QUERY),{'type':dbH[_0x8c4b('0x14')]['QueryTypes'][_0x8c4b('0x16')]});})[_0x8c4b('0x13')](function(_0x4e3ff5){if(!_0x4e3ff5[0x0][_0x8c4b('0x17')]){return analyticExtractedReport('Empty');}var _0x229fb8=[];var _0x43a865=0x0;if(_0x3c5913[_0x8c4b('0x11')]){if(_0x4e3ff5&&_0x4e3ff5[_0x8c4b('0x18')]){var _0x576db0=_[_0x8c4b('0x19')](_0x4e3ff5[0x0][_0x8c4b('0x17')]/_0x5b54a8);var _0x1230a6=Number['isInteger'](_0x4e3ff5[0x0][_0x8c4b('0x17')]/_0x5b54a8)?_0x4e3ff5[0x0][_0x8c4b('0x17')]%_0x5b54a8:0x0;_0x576db0[_0x8c4b('0x1a')](function(_0x9d4afe){if(_0x9d4afe>0x0){_0x43a865+=_0x5b54a8;}_0x229fb8[_0x8c4b('0x1b')](dbH[_0x8c4b('0x14')][_0x8c4b('0x1c')](util[_0x8c4b('0xe')](_0x8c4b('0x1d'),QUERY,_0x5b54a8,_0x43a865),{'type':dbH[_0x8c4b('0x14')][_0x8c4b('0x1e')][_0x8c4b('0x16')]}));});if(_0x1230a6>0x0){_0x43a865+=_0x5b54a8;_0x229fb8[_0x8c4b('0x1b')](dbH[_0x8c4b('0x14')][_0x8c4b('0x1c')](util[_0x8c4b('0xe')](_0x8c4b('0x1d'),QUERY,_0x1230a6,_0x43a865),{'type':dbH[_0x8c4b('0x14')][_0x8c4b('0x1e')][_0x8c4b('0x16')]}));}}}else{_0x229fb8[_0x8c4b('0x1b')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x8c4b('0x14')][_0x8c4b('0x1e')][_0x8c4b('0x16')]}));}var _0x57ef8f=path['dirname'](PATH);var _0x3a62aa=path['basename'](PATH,_0x8c4b('0x1f'));var _0x235367=_0x3c5913[_0x8c4b('0x11')]&&_0x229fb8['length']>0x1;var _0x37ab4f=[];if(!fs[_0x8c4b('0x20')](path[_0x8c4b('0x21')](_0x57ef8f,_0x3a62aa))&&_0x235367){fs[_0x8c4b('0x22')](path[_0x8c4b('0x21')](_0x57ef8f,_0x3a62aa));}return BPromise[_0x8c4b('0x23')](_0x229fb8,function(_0x27a245){_0x37ab4f[_0x8c4b('0x1b')](_0x27a245);})[_0x8c4b('0x13')](function(){for(var _0x259082=0x0;_0x259082<_0x37ab4f[_0x8c4b('0x18')];_0x259082+=0x1){var _0x23e75c;var _0x171d8e=_0x37ab4f[_0x259082];if(_0x235367){_0x23e75c=path['join'](_0x57ef8f,_0x3a62aa,util[_0x8c4b('0xe')](_0x8c4b('0x24'),_0x3a62aa,_0x259082,_0x8c4b('0x25')));}else{_0x23e75c=path[_0x8c4b('0x21')](_0x57ef8f,util['format'](_0x8c4b('0x26'),_0x3a62aa,'csv'));}fs[_0x8c4b('0x27')](_0x23e75c,csv(_0x171d8e));}})[_0x8c4b('0x13')](function(){if(_0x235367){return new Promise(function(_0x470c9f){zipdir(path[_0x8c4b('0x21')](_0x57ef8f,_0x3a62aa),{'saveTo':path[_0x8c4b('0x21')](_0x57ef8f,util['format'](_0x8c4b('0x26'),_0x3a62aa,'zip'))},function(_0x56ea16,_0x2d0e49){rimraf(path[_0x8c4b('0x21')](_0x57ef8f,_0x3a62aa),function(){});_0x470c9f(_0x8c4b('0x28'));});});}})[_0x8c4b('0x13')](function(){logger['info'](util[_0x8c4b('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x8c4b('0x29')));return analyticExtractedReport(_0x8c4b('0x2a'),_0x235367?util[_0x8c4b('0xe')](_0x8c4b('0x26'),_0x3a62aa,_0x235367?'zip':'csv'):null);});})[_0x8c4b('0x2b')](function(_0x1c6299){logger[_0x8c4b('0xd')](util[_0x8c4b('0xe')](_0x8c4b('0x2c'),EXTRACTED_REPORT_ID,'CSV'),util[_0x8c4b('0x2d')](_0x1c6299,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8c4b('0x2e'));})[_0x8c4b('0x2f')](function(){process[_0x8c4b('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x6853=['range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','format','dirname','basename','length','existsSync','join','each','%s%d.%s','csv','%s.%s','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','util','to-csv','zip-dir','rimraf','../../mysqldb','dbH','argv','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty'];(function(_0x25a553,_0x57d9e7){var _0x1aff24=function(_0x5496e1){while(--_0x5496e1){_0x25a553['push'](_0x25a553['shift']());}};_0x1aff24(++_0x57d9e7);}(_0x6853,0x13c));var _0x3685=function(_0x5bac30,_0x118582){_0x5bac30=_0x5bac30-0x0;var _0x152f17=_0x6853[_0x5bac30];return _0x152f17;};'use strict';var util=require(_0x3685('0x0'));var path=require('path');var _=require('lodash');var csv=require(_0x3685('0x1'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x3685('0x2'));var rimraf=require(_0x3685('0x3'));var db=require(_0x3685('0x4'))['db'];var dbH=require('../../mysqldb')[_0x3685('0x5')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x3685('0x6')][0x2]);var QUERY=process[_0x3685('0x6')][0x3];var PATH=process[_0x3685('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x30daf0,_0x43370d){var _0x4f390e={'status':_0x30daf0};var _0x2dc32e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x43370d){_0x4f390e['savename']=_0x43370d;}return db['AnalyticExtractedReport'][_0x3685('0x7')](_0x4f390e,_0x2dc32e);}function main(){var _0x36dd51=0x1388;var _0x310cbe;logger[_0x3685('0x8')](util['format'](_0x3685('0x9'),EXTRACTED_REPORT_ID,_0x3685('0xa')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3685('0xb'),_0x3685('0xc')]})[_0x3685('0xd')](function(_0x1602e4){if(_0x1602e4){_0x310cbe=_0x1602e4;_0x36dd51=_0x310cbe['splitSizeCsv']||0x1388;}})[_0x3685('0xd')](function(){return dbH[_0x3685('0xe')][_0x3685('0xf')](util['format'](_0x3685('0x10'),QUERY),{'type':dbH[_0x3685('0xe')]['QueryTypes'][_0x3685('0x11')]});})[_0x3685('0xd')](function(_0x1d62d4){if(!_0x1d62d4[0x0][_0x3685('0x12')]){return analyticExtractedReport(_0x3685('0x13'));}var _0x100e4c=[];var _0x2810ea=0x0;if(_0x310cbe['split']){if(_0x1d62d4&&_0x1d62d4['length']){var _0x347e46=_[_0x3685('0x14')](_0x1d62d4[0x0][_0x3685('0x12')]/_0x36dd51);var _0x2b4a6d=Number[_0x3685('0x15')](_0x1d62d4[0x0][_0x3685('0x12')]/_0x36dd51)?_0x1d62d4[0x0][_0x3685('0x12')]%_0x36dd51:0x0;_0x347e46[_0x3685('0x16')](function(_0x1af216){if(_0x1af216>0x0){_0x2810ea+=_0x36dd51;}_0x100e4c[_0x3685('0x17')](dbH[_0x3685('0xe')]['query'](util['format'](_0x3685('0x18'),QUERY,_0x36dd51,_0x2810ea),{'type':dbH[_0x3685('0xe')][_0x3685('0x19')]['SELECT']}));});if(_0x2b4a6d>0x0){_0x2810ea+=_0x36dd51;_0x100e4c[_0x3685('0x17')](dbH[_0x3685('0xe')][_0x3685('0xf')](util[_0x3685('0x1a')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2b4a6d,_0x2810ea),{'type':dbH[_0x3685('0xe')][_0x3685('0x19')][_0x3685('0x11')]}));}}}else{_0x100e4c[_0x3685('0x17')](dbH[_0x3685('0xe')][_0x3685('0xf')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x3685('0x11')]}));}var _0x5d8c0e=path[_0x3685('0x1b')](PATH);var _0x3af7f8=path[_0x3685('0x1c')](PATH,'.csv');var _0x5d8c1f=_0x310cbe[_0x3685('0xb')]&&_0x100e4c[_0x3685('0x1d')]>0x1;var _0x21fa53=[];if(!fs[_0x3685('0x1e')](path[_0x3685('0x1f')](_0x5d8c0e,_0x3af7f8))&&_0x5d8c1f){fs['mkdirSync'](path[_0x3685('0x1f')](_0x5d8c0e,_0x3af7f8));}return BPromise[_0x3685('0x20')](_0x100e4c,function(_0x3e7e00){_0x21fa53[_0x3685('0x17')](_0x3e7e00);})['then'](function(){for(var _0x46091d=0x0;_0x46091d<_0x21fa53['length'];_0x46091d+=0x1){var _0x3a9e23;var _0x59b482=_0x21fa53[_0x46091d];if(_0x5d8c1f){_0x3a9e23=path[_0x3685('0x1f')](_0x5d8c0e,_0x3af7f8,util[_0x3685('0x1a')](_0x3685('0x21'),_0x3af7f8,_0x46091d,_0x3685('0x22')));}else{_0x3a9e23=path[_0x3685('0x1f')](_0x5d8c0e,util[_0x3685('0x1a')]('%s.%s',_0x3af7f8,_0x3685('0x22')));}fs['writeFileSync'](_0x3a9e23,csv(_0x59b482));}})[_0x3685('0xd')](function(){if(_0x5d8c1f){return new Promise(function(_0x3c0d7a){zipdir(path['join'](_0x5d8c0e,_0x3af7f8),{'saveTo':path[_0x3685('0x1f')](_0x5d8c0e,util['format'](_0x3685('0x23'),_0x3af7f8,_0x3685('0x24')))},function(_0x496c68,_0x37628b){rimraf(path[_0x3685('0x1f')](_0x5d8c0e,_0x3af7f8),function(){});_0x3c0d7a(_0x3685('0x25'));});});}})['then'](function(){logger['info'](util[_0x3685('0x1a')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x3685('0x26'),_0x5d8c1f?util[_0x3685('0x1a')](_0x3685('0x23'),_0x3af7f8,_0x5d8c1f?'zip':_0x3685('0x22')):null);});})[_0x3685('0x27')](function(_0x49b056){logger[_0x3685('0x8')](util[_0x3685('0x1a')](_0x3685('0x28'),EXTRACTED_REPORT_ID,_0x3685('0xa')),util['inspect'](_0x49b056,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x3685('0x29')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 13ce91b..52928dd 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 _0xa758=['Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','pipe','createWriteStream','finish','end','createPdfFromHTML','createPdfKitDocument','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','length','auto','body','concat','chunk','keys','forEach','format','name','startDate','endDate','push','header','pageBreak','footer','black','right','num','Empty','Setting','split','splitSizePdf','then','range','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','SELECT','QueryTypes','dirname','basename','.pdf','existsSync','mkdirSync','join','each','flatten','%s%d.%s','pdf','%s.%s','all','zip\x20finished','info'];(function(_0x550d2f,_0x367bea){var _0x28e111=function(_0x2e47eb){while(--_0x2e47eb){_0x550d2f['push'](_0x550d2f['shift']());}};_0x28e111(++_0x367bea);}(_0xa758,0x1e0));var _0x8a75=function(_0x1e6f26,_0x27d992){_0x1e6f26=_0x1e6f26-0x0;var _0x4820f9=_0xa758[_0x1e6f26];return _0x4820f9;};'use strict';var _=require('lodash');var fs=require('fs');var util=require('util');var path=require(_0x8a75('0x0'));var moment=require(_0x8a75('0x1'));var htmlToPdfmake=require(_0x8a75('0x2'));var PdfPrinter=require(_0x8a75('0x3'));var zipdir=require(_0x8a75('0x4'));var rimraf=require(_0x8a75('0x5'));var JSDOM=require(_0x8a75('0x6'))[_0x8a75('0x7')];var window=new JSDOM('')[_0x8a75('0x8')];var BPromise=require(_0x8a75('0x9'));var db=require(_0x8a75('0xa'))['db'];var dbH=require(_0x8a75('0xa'))[_0x8a75('0xb')];var logger=require(_0x8a75('0xc'))(_0x8a75('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0x8a75('0xe')][0x2]);var QUERY=process[_0x8a75('0xe')][0x3];var PATH=process[_0x8a75('0xe')][0x4];var NAME=process[_0x8a75('0xe')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1473dc,_0x52528f){var _0x30140e={'status':_0x1473dc};var _0xa87386={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x52528f){_0x30140e['savename']=_0x52528f;}return db[_0x8a75('0xf')][_0x8a75('0x10')](_0x30140e,_0xa87386);}function getHeaders(_0x3652dc){return _[_0x8a75('0x11')](_0x3652dc,function(_0xc2e50c){return{'text':_0xc2e50c,'style':_0x8a75('0x12')};});}function getRows(_0x37c157,_0xdada50){return _[_0x8a75('0x11')](_0xdada50,function(_0x1cd1ad){return _(_0x1cd1ad)[_0x8a75('0x13')](_0x37c157)[_0x8a75('0x11')](function(_0x43b2b4){return _0x43b2b4?_[_0x8a75('0x14')](_0x43b2b4):'';})[_0x8a75('0x15')]();});}function createTable(_0x1d1353,_0x5ddd43){var _0x44bedf={'widths':_['fill'](Array(_0x1d1353[_0x8a75('0x16')]),0x91),'heights':function(_0x18cbdb){return _0x18cbdb===0x0?_0x8a75('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x219ce1=getHeaders(_0x1d1353);_0x44bedf[_0x8a75('0x18')]['push'](_0x219ce1);var _0x44af27=getRows(_0x1d1353,_0x5ddd43);_0x44bedf[_0x8a75('0x18')]=_0x44bedf[_0x8a75('0x18')][_0x8a75('0x19')](_0x44af27);return _0x44bedf;}function createTables(_0x61240b){var _0x288b4d=[];var _0x2eca93=_[_0x8a75('0x1a')](Object[_0x8a75('0x1b')](_0x61240b[0x0]),0x5);_0x2eca93[_0x8a75('0x1c')](function(_0x321f08){_0x288b4d['push'](createTable(_0x321f08,_0x61240b));});return _0x288b4d;}function getPDFDocDefinition(_0x1fc0e9){var _0x4949b2=util[_0x8a75('0x1d')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x8a75('0x1e')],moment(EXTRACTED_REPORT[_0x8a75('0x1f')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x8a75('0x20')])['format'](FORMAT));var _0x517117=[];for(var _0x262855=0x0;_0x262855<_0x1fc0e9['length'];_0x262855++){var _0x376849=[];if(_0x262855===0x0){_0x376849[_0x8a75('0x21')]({'text':_0x4949b2,'style':_0x8a75('0x22')});}var _0x1dd047={'table':_0x1fc0e9[_0x262855]};if(_0x262855>0x0){_0x1dd047[_0x8a75('0x23')]='before';_0x1dd047['margin']=[0x0,0x46,0x0,0x0];}_0x376849[_0x8a75('0x21')](_0x1dd047);_0x517117['push'](_0x376849);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x517117,'footer':function(_0x127f99,_0x1299c4){return{'text':_0x127f99[_0x8a75('0x14')]()+'\x20/\x20'+_0x1299c4,'style':_0x8a75('0x24')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x8a75('0x25')},'footer':{'alignment':_0x8a75('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x750113){var _0x585525=0x1388;var _0x2148d2;if(!_0x750113[0x0][_0x8a75('0x27')]){return analyticExtractedReport(_0x8a75('0x28'));}return db[_0x8a75('0x29')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8a75('0x2a'),_0x8a75('0x2b')]})[_0x8a75('0x2c')](function(_0x33189e){if(_0x33189e){_0x2148d2=_0x33189e;_0x585525=_0x2148d2[_0x8a75('0x2b')]||0x3e8;}})['then'](function(){var _0x133d1e=[];var _0x315b31=0x0;if(_0x2148d2[_0x8a75('0x2a')]){if(_0x750113&&_0x750113[_0x8a75('0x16')]){var _0x1acddd=_[_0x8a75('0x2d')](_0x750113[0x0][_0x8a75('0x27')]/_0x585525);var _0x2caca4=Number[_0x8a75('0x2e')](_0x750113[0x0][_0x8a75('0x27')]/_0x585525)?_0x750113[0x0][_0x8a75('0x27')]%_0x585525:0x0;_0x1acddd[_0x8a75('0x1c')](function(_0x436739){if(_0x436739>0x0){_0x315b31+=_0x585525;}_0x133d1e[_0x8a75('0x21')](dbH['sequelize'][_0x8a75('0x2f')](util[_0x8a75('0x1d')](_0x8a75('0x30'),QUERY,_0x585525,_0x315b31),{'type':dbH[_0x8a75('0x31')]['QueryTypes'][_0x8a75('0x32')]}));});if(_0x2caca4>0x0){_0x315b31+=_0x585525;_0x133d1e[_0x8a75('0x21')](dbH[_0x8a75('0x31')][_0x8a75('0x2f')](util[_0x8a75('0x1d')](_0x8a75('0x30'),QUERY,_0x2caca4,_0x315b31),{'type':dbH[_0x8a75('0x31')]['QueryTypes']['SELECT']}));}}}else{_0x133d1e[_0x8a75('0x21')](dbH[_0x8a75('0x31')]['query'](QUERY,{'type':dbH[_0x8a75('0x31')][_0x8a75('0x33')][_0x8a75('0x32')]}));}var _0x457281=path[_0x8a75('0x34')](PATH);var _0x518ecc=path[_0x8a75('0x35')](PATH,_0x8a75('0x36'));var _0x564cc8=_0x2148d2[_0x8a75('0x2a')]&&_0x133d1e[_0x8a75('0x16')]>0x1;var _0x14b109=[];if(!fs[_0x8a75('0x37')](path['join'](_0x457281,_0x518ecc))&&_0x564cc8){fs[_0x8a75('0x38')](path[_0x8a75('0x39')](_0x457281,_0x518ecc));}return BPromise[_0x8a75('0x3a')](_0x133d1e,function(_0x596c5f){_0x14b109[_0x8a75('0x21')](_0x596c5f);})[_0x8a75('0x2c')](function(){var _0x343b08=[];for(var _0x51a3a9=0x0;_0x51a3a9<_0x14b109[_0x8a75('0x16')];_0x51a3a9+=0x1){var _0xe831ad=_0x14b109[_0x51a3a9];var _0x47b767=createTables(_[_0x8a75('0x3b')](_0xe831ad));var _0x510f67;var _0x23ea07=getPDFDocDefinition(_0x47b767);var _0x182e62=getPDFPrinter();var _0x1c6162=_0x182e62['createPdfKitDocument'](_0x23ea07);if(_0x564cc8){_0x510f67=path[_0x8a75('0x39')](_0x457281,_0x518ecc,util['format'](_0x8a75('0x3c'),_0x518ecc,_0x51a3a9,_0x8a75('0x3d')));}else{_0x510f67=path[_0x8a75('0x39')](_0x457281,util['format'](_0x8a75('0x3e'),_0x518ecc,_0x8a75('0x3d')));}_0x343b08[_0x8a75('0x21')](writePDFDocument(_0x1c6162,_0x510f67));}return Promise[_0x8a75('0x3f')](_0x343b08);})[_0x8a75('0x2c')](function(){if(_0x564cc8){return new Promise(function(_0x16b9fd){zipdir(path[_0x8a75('0x39')](_0x457281,_0x518ecc),{'saveTo':path[_0x8a75('0x39')](_0x457281,util['format']('%s.%s',_0x518ecc,'zip'))},function(){rimraf(path[_0x8a75('0x39')](_0x457281,_0x518ecc),function(){});_0x16b9fd(_0x8a75('0x40'));});});}})[_0x8a75('0x2c')](function(){if(!_0x564cc8)return;rimraf(path[_0x8a75('0x39')](_0x457281,_0x518ecc),function(){});})[_0x8a75('0x2c')](function(){logger[_0x8a75('0x41')](util['format'](_0x8a75('0x42'),EXTRACTED_REPORT_ID,_0x8a75('0x43')));return analyticExtractedReport(_0x8a75('0x44'),_0x564cc8?util['format'](_0x8a75('0x3e'),_0x518ecc,_0x564cc8?'zip':_0x8a75('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x8a75('0x1d')](_0x8a75('0x45'),EXTRACTED_REPORT_ID,_0x8a75('0x43')));return db[_0x8a75('0xf')][_0x8a75('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x8a75('0x2c')](function(_0x2bc5ac){EXTRACTED_REPORT=_0x2bc5ac;return dbH['sequelize'][_0x8a75('0x2f')](util[_0x8a75('0x1d')](_0x8a75('0x47'),QUERY),{'type':dbH[_0x8a75('0x31')]['QueryTypes']['SELECT']});})['then'](extractReport)[_0x8a75('0x48')](function(_0x53c08f){logger[_0x8a75('0x41')](util['format'](_0x8a75('0x49'),EXTRACTED_REPORT_ID,'PDF'),util[_0x8a75('0x4a')](_0x53c08f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8a75('0x4b'));})[_0x8a75('0x4c')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x4aa1b4=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x8a75('0x4d'),'italics':__dirname+_0x8a75('0x4e'),'bolditalics':__dirname+_0x8a75('0x4f')}});return _0x4aa1b4;}function getPDFDocDefinitionFromHTML(_0x5519ee,_0x23603b){var _0x3d772d=util[_0x8a75('0x1d')]('%s\x20#%d',_0x23603b[_0x8a75('0x50')],_0x23603b['interactionId']);var _0x5f53ee=moment()[_0x8a75('0x1d')](_0x8a75('0x51'))[_0x8a75('0x14')]();var _0x124bd7=htmlToPdfmake(_0x5519ee,{'window':window,'tableAutoSize':!![]});return{'content':[_0x124bd7],'defaultStyle':{'font':_0x8a75('0x52')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x8a75('0x53')}},'header':function(){return[{'text':_0x8a75('0x54'),'style':'header'}];},'footer':function(_0x1b9196,_0x38f0e2){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x3d772d,_0x1b9196,_0x38f0e2,_0x5f53ee),'style':'footer'}];}};}function writePDFDocument(_0x5b4cec,_0x4e143b){return new Promise(function(_0x246123,_0x464442){var _0x2a0b28=_0x5b4cec[_0x8a75('0x55')](fs[_0x8a75('0x56')](_0x4e143b));_0x2a0b28['on']('finish',function(){_0x246123(_0x8a75('0x57'));});_0x2a0b28['on']('error',function(_0x595101){_0x464442(_0x595101);});_0x5b4cec[_0x8a75('0x58')]();});}exports[_0x8a75('0x59')]=function(_0x2f293d,_0x5ac47a){var _0x2e9d58=getPDFPrinter();var _0xbb509f=getPDFDocDefinitionFromHTML(_0x2f293d,_0x5ac47a);var _0x37724f=_0x2e9d58[_0x8a75('0x5a')](_0xbb509f);return writePDFDocument(_0x37724f,_0x5ac47a[_0x8a75('0x0')])[_0x8a75('0x48')](function(_0x422fd5){throw _0x422fd5;});}; \ No newline at end of file +var _0xe875=['inspect','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','path','lodash','util','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','pick','toString','value','fill','length','auto','body','push','concat','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','header','pageBreak','before','margin','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','split','splitSizePdf','then','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','sequelize','SELECT','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x97b519,_0x3f9837){var _0x44ddef=function(_0x38c326){while(--_0x38c326){_0x97b519['push'](_0x97b519['shift']());}};_0x44ddef(++_0x3f9837);}(_0xe875,0x131));var _0x5e87=function(_0x3b1000,_0x1d3208){_0x3b1000=_0x3b1000-0x0;var _0x357d05=_0xe875[_0x3b1000];return _0x357d05;};'use strict';var _=require(_0x5e87('0x0'));var fs=require('fs');var util=require(_0x5e87('0x1'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x5e87('0x2'));var zipdir=require(_0x5e87('0x3'));var rimraf=require(_0x5e87('0x4'));var JSDOM=require(_0x5e87('0x5'))[_0x5e87('0x6')];var window=new JSDOM('')[_0x5e87('0x7')];var BPromise=require(_0x5e87('0x8'));var db=require(_0x5e87('0x9'))['db'];var dbH=require(_0x5e87('0x9'))[_0x5e87('0xa')];var logger=require(_0x5e87('0xb'))(_0x5e87('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0x5e87('0xd')][0x2]);var QUERY=process[_0x5e87('0xd')][0x3];var PATH=process[_0x5e87('0xd')][0x4];var NAME=process[_0x5e87('0xd')][0x5];var FORMAT=_0x5e87('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x400f0c,_0x2cfaac){var _0x219621={'status':_0x400f0c};var _0x49abe8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2cfaac){_0x219621[_0x5e87('0xf')]=_0x2cfaac;}return db[_0x5e87('0x10')]['update'](_0x219621,_0x49abe8);}function getHeaders(_0x37dd45){return _[_0x5e87('0x11')](_0x37dd45,function(_0x32f8aa){return{'text':_0x32f8aa,'style':'tableHeader'};});}function getRows(_0x3abdb1,_0x5191c1){return _[_0x5e87('0x11')](_0x5191c1,function(_0x16e67a){return _(_0x16e67a)[_0x5e87('0x12')](_0x3abdb1)[_0x5e87('0x11')](function(_0x522866){return _0x522866?_[_0x5e87('0x13')](_0x522866):'';})[_0x5e87('0x14')]();});}function createTable(_0x52ba7b,_0xba728b){var _0x714d74={'widths':_[_0x5e87('0x15')](Array(_0x52ba7b[_0x5e87('0x16')]),0x91),'heights':function(_0x5347c4){return _0x5347c4===0x0?_0x5e87('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x324d7a=getHeaders(_0x52ba7b);_0x714d74[_0x5e87('0x18')][_0x5e87('0x19')](_0x324d7a);var _0x13af0b=getRows(_0x52ba7b,_0xba728b);_0x714d74[_0x5e87('0x18')]=_0x714d74[_0x5e87('0x18')][_0x5e87('0x1a')](_0x13af0b);return _0x714d74;}function createTables(_0x2ef740){var _0x205d67=[];var _0x3a3ba0=_['chunk'](Object['keys'](_0x2ef740[0x0]),0x5);_0x3a3ba0[_0x5e87('0x1b')](function(_0x4b9e8a){_0x205d67[_0x5e87('0x19')](createTable(_0x4b9e8a,_0x2ef740));});return _0x205d67;}function getPDFDocDefinition(_0x29fe7c){var _0x45fbdf=util[_0x5e87('0x1c')](_0x5e87('0x1d'),NAME,EXTRACTED_REPORT[_0x5e87('0x1e')],moment(EXTRACTED_REPORT[_0x5e87('0x1f')])[_0x5e87('0x1c')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x5e87('0x1c')](FORMAT));var _0x108a28=[];for(var _0x13b3f3=0x0;_0x13b3f3<_0x29fe7c[_0x5e87('0x16')];_0x13b3f3++){var _0x5336e7=[];if(_0x13b3f3===0x0){_0x5336e7[_0x5e87('0x19')]({'text':_0x45fbdf,'style':_0x5e87('0x20')});}var _0x18f3c8={'table':_0x29fe7c[_0x13b3f3]};if(_0x13b3f3>0x0){_0x18f3c8[_0x5e87('0x21')]=_0x5e87('0x22');_0x18f3c8[_0x5e87('0x23')]=[0x0,0x46,0x0,0x0];}_0x5336e7['push'](_0x18f3c8);_0x108a28['push'](_0x5336e7);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x108a28,'footer':function(_0x5495cd,_0x5ae0bb){return{'text':_0x5495cd['toString']()+_0x5e87('0x24')+_0x5ae0bb,'style':_0x5e87('0x25')};},'defaultStyle':{'font':_0x5e87('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x5e87('0x27')},'footer':{'alignment':_0x5e87('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1bf213){var _0x4889a8=0x1388;var _0xf3ba04;if(!_0x1bf213[0x0][_0x5e87('0x29')]){return analyticExtractedReport(_0x5e87('0x2a'));}return db[_0x5e87('0x2b')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5e87('0x2c'),_0x5e87('0x2d')]})['then'](function(_0x2e521f){if(_0x2e521f){_0xf3ba04=_0x2e521f;_0x4889a8=_0xf3ba04[_0x5e87('0x2d')]||0x3e8;}})[_0x5e87('0x2e')](function(){var _0x3ff7ea=[];var _0xfcc6e1=0x0;if(_0xf3ba04[_0x5e87('0x2c')]){if(_0x1bf213&&_0x1bf213['length']){var _0x2f2d9e=_['range'](_0x1bf213[0x0][_0x5e87('0x29')]/_0x4889a8);var _0x594f01=Number[_0x5e87('0x2f')](_0x1bf213[0x0]['num']/_0x4889a8)?_0x1bf213[0x0][_0x5e87('0x29')]%_0x4889a8:0x0;_0x2f2d9e[_0x5e87('0x1b')](function(_0x7ca167){if(_0x7ca167>0x0){_0xfcc6e1+=_0x4889a8;}_0x3ff7ea[_0x5e87('0x19')](dbH['sequelize'][_0x5e87('0x30')](util[_0x5e87('0x1c')](_0x5e87('0x31'),QUERY,_0x4889a8,_0xfcc6e1),{'type':dbH['sequelize'][_0x5e87('0x32')]['SELECT']}));});if(_0x594f01>0x0){_0xfcc6e1+=_0x4889a8;_0x3ff7ea[_0x5e87('0x19')](dbH['sequelize'][_0x5e87('0x30')](util[_0x5e87('0x1c')](_0x5e87('0x31'),QUERY,_0x594f01,_0xfcc6e1),{'type':dbH[_0x5e87('0x33')][_0x5e87('0x32')][_0x5e87('0x34')]}));}}}else{_0x3ff7ea['push'](dbH['sequelize'][_0x5e87('0x30')](QUERY,{'type':dbH[_0x5e87('0x33')]['QueryTypes']['SELECT']}));}var _0x2607ed=path['dirname'](PATH);var _0x44856e=path[_0x5e87('0x35')](PATH,_0x5e87('0x36'));var _0x2f33e3=_0xf3ba04['split']&&_0x3ff7ea[_0x5e87('0x16')]>0x1;var _0x4c7329=[];if(!fs[_0x5e87('0x37')](path[_0x5e87('0x38')](_0x2607ed,_0x44856e))&&_0x2f33e3){fs[_0x5e87('0x39')](path[_0x5e87('0x38')](_0x2607ed,_0x44856e));}return BPromise[_0x5e87('0x3a')](_0x3ff7ea,function(_0x1c9d10){_0x4c7329['push'](_0x1c9d10);})[_0x5e87('0x2e')](function(){var _0x334d19=[];for(var _0x1272db=0x0;_0x1272db<_0x4c7329[_0x5e87('0x16')];_0x1272db+=0x1){var _0x1ffcb9=_0x4c7329[_0x1272db];var _0x345a11=createTables(_[_0x5e87('0x3b')](_0x1ffcb9));var _0x50cc15;var _0x38a332=getPDFDocDefinition(_0x345a11);var _0x553d46=getPDFPrinter();var _0x215d23=_0x553d46[_0x5e87('0x3c')](_0x38a332);if(_0x2f33e3){_0x50cc15=path['join'](_0x2607ed,_0x44856e,util[_0x5e87('0x1c')](_0x5e87('0x3d'),_0x44856e,_0x1272db,'pdf'));}else{_0x50cc15=path[_0x5e87('0x38')](_0x2607ed,util[_0x5e87('0x1c')]('%s.%s',_0x44856e,_0x5e87('0x3e')));}_0x334d19[_0x5e87('0x19')](writePDFDocument(_0x215d23,_0x50cc15));}return Promise[_0x5e87('0x3f')](_0x334d19);})[_0x5e87('0x2e')](function(){if(_0x2f33e3){return new Promise(function(_0x24d91d){zipdir(path[_0x5e87('0x38')](_0x2607ed,_0x44856e),{'saveTo':path[_0x5e87('0x38')](_0x2607ed,util[_0x5e87('0x1c')](_0x5e87('0x40'),_0x44856e,_0x5e87('0x41')))},function(){rimraf(path[_0x5e87('0x38')](_0x2607ed,_0x44856e),function(){});_0x24d91d(_0x5e87('0x42'));});});}})[_0x5e87('0x2e')](function(){if(!_0x2f33e3)return;rimraf(path[_0x5e87('0x38')](_0x2607ed,_0x44856e),function(){});})[_0x5e87('0x2e')](function(){logger[_0x5e87('0x43')](util[_0x5e87('0x1c')](_0x5e87('0x44'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x2f33e3?util['format'](_0x5e87('0x40'),_0x44856e,_0x2f33e3?'zip':_0x5e87('0x3e')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x5e87('0x43')](util[_0x5e87('0x1c')](_0x5e87('0x45'),EXTRACTED_REPORT_ID,_0x5e87('0x46')));return db[_0x5e87('0x10')][_0x5e87('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x5e87('0x2e')](function(_0x209756){EXTRACTED_REPORT=_0x209756;return dbH[_0x5e87('0x33')][_0x5e87('0x30')](util['format'](_0x5e87('0x48'),QUERY),{'type':dbH[_0x5e87('0x33')][_0x5e87('0x32')][_0x5e87('0x34')]});})[_0x5e87('0x2e')](extractReport)[_0x5e87('0x49')](function(_0x6f80eb){logger['info'](util[_0x5e87('0x1c')](_0x5e87('0x4a'),EXTRACTED_REPORT_ID,'PDF'),util[_0x5e87('0x4b')](_0x6f80eb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5e87('0x4c'));})[_0x5e87('0x4d')](function(){process[_0x5e87('0x4e')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1851d2=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x5e87('0x4f'),'italics':__dirname+_0x5e87('0x50'),'bolditalics':__dirname+_0x5e87('0x51')}});return _0x1851d2;}function getPDFDocDefinitionFromHTML(_0x590664,_0x547109){var _0xfab91=util['format'](_0x5e87('0x52'),_0x547109[_0x5e87('0x53')],_0x547109[_0x5e87('0x54')]);var _0x3f4f01=moment()[_0x5e87('0x1c')]('YYYY-MM-DD')['toString']();var _0x5153c3=htmlToPdfmake(_0x590664,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5153c3],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x5e87('0x55'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x5e87('0x55'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x5e87('0x55')}},'header':function(){return[{'text':_0x5e87('0x56'),'style':_0x5e87('0x20')}];},'footer':function(_0x142fbe,_0x49409b){return[{'text':util[_0x5e87('0x1c')](_0x5e87('0x57'),_0xfab91,_0x142fbe,_0x49409b,_0x3f4f01),'style':_0x5e87('0x25')}];}};}function writePDFDocument(_0x221008,_0x4dcaaa){return new Promise(function(_0x234c6d,_0x10c3e3){var _0x225292=_0x221008[_0x5e87('0x58')](fs[_0x5e87('0x59')](_0x4dcaaa));_0x225292['on']('finish',function(){_0x234c6d(_0x5e87('0x5a'));});_0x225292['on'](_0x5e87('0x5b'),function(_0x21d560){_0x10c3e3(_0x21d560);});_0x221008[_0x5e87('0x5c')]();});}exports[_0x5e87('0x5d')]=function(_0x1a0985,_0xd5d837){var _0x1668cd=getPDFPrinter();var _0x5071df=getPDFDocDefinitionFromHTML(_0x1a0985,_0xd5d837);var _0x335be9=_0x1668cd[_0x5e87('0x3c')](_0x5071df);return writePDFDocument(_0x335be9,_0xd5d837[_0x5e87('0x5e')])['catch'](function(_0xfc0852){throw _0xfc0852;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 28d44b8..4a71572 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 _0xe3a1=['then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.xlsx','existsSync','each','join','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','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','finally','exit','bluebird','zip-dir','rimraf','../../mysqldb','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx'];(function(_0x55653c,_0x3706ea){var _0x1b5a4f=function(_0x368b27){while(--_0x368b27){_0x55653c['push'](_0x55653c['shift']());}};_0x1b5a4f(++_0x3706ea);}(_0xe3a1,0x10a));var _0x1e3a=function(_0x61c63,_0x2e5aa3){_0x61c63=_0x61c63-0x0;var _0x166e6f=_0xe3a1[_0x61c63];return _0x166e6f;};'use strict';var util=require('util');var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x1e3a('0x0'));var zipdir=require(_0x1e3a('0x1'));var rimraf=require(_0x1e3a('0x2'));var db=require('../../mysqldb')['db'];var dbH=require(_0x1e3a('0x3'))['dbH'];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x1e3a('0x4')][0x2]);var QUERY=process[_0x1e3a('0x4')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x556ace,_0x11d6d2){var _0x52d2f0={'status':_0x556ace};var _0x226391={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x11d6d2){_0x52d2f0[_0x1e3a('0x5')]=_0x11d6d2;}return db[_0x1e3a('0x6')][_0x1e3a('0x7')](_0x52d2f0,_0x226391);}function main(){var _0x4ff198=0x1388;var _0x3c4b81;logger[_0x1e3a('0x8')](util[_0x1e3a('0x9')](_0x1e3a('0xa'),EXTRACTED_REPORT_ID,_0x1e3a('0xb')));return db[_0x1e3a('0xc')][_0x1e3a('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1e3a('0xe'),_0x1e3a('0xf')]})['then'](function(_0x27739c){if(_0x27739c){_0x3c4b81=_0x27739c;_0x4ff198=_0x3c4b81[_0x1e3a('0xf')]||0x1388;}})[_0x1e3a('0x10')](function(){return dbH[_0x1e3a('0x11')][_0x1e3a('0x12')](util[_0x1e3a('0x9')](_0x1e3a('0x13'),QUERY),{'type':dbH[_0x1e3a('0x11')]['QueryTypes']['SELECT']});})['then'](function(_0x10ee5a){if(!_0x10ee5a[0x0][_0x1e3a('0x14')]){return analyticExtractedReport(_0x1e3a('0x15'));}var _0x102f24=[];var _0x4d855b=0x0;if(_0x3c4b81['split']){if(_0x10ee5a&&_0x10ee5a[_0x1e3a('0x16')]){var _0x3e4b62=_[_0x1e3a('0x17')](_0x10ee5a[0x0][_0x1e3a('0x14')]/_0x4ff198);var _0x1b0ed9=Number['isInteger'](_0x10ee5a[0x0]['num']/_0x4ff198)?_0x10ee5a[0x0][_0x1e3a('0x14')]%_0x4ff198:0x0;_0x3e4b62[_0x1e3a('0x18')](function(_0x10a263){if(_0x10a263>0x0){_0x4d855b+=_0x4ff198;}_0x102f24[_0x1e3a('0x19')](dbH[_0x1e3a('0x11')]['query'](util['format'](_0x1e3a('0x1a'),QUERY,_0x4ff198,_0x4d855b),{'type':dbH[_0x1e3a('0x11')][_0x1e3a('0x1b')][_0x1e3a('0x1c')]}));});if(_0x1b0ed9>0x0){_0x4d855b+=_0x4ff198;_0x102f24[_0x1e3a('0x19')](dbH['sequelize'][_0x1e3a('0x12')](util[_0x1e3a('0x9')](_0x1e3a('0x1a'),QUERY,_0x1b0ed9,_0x4d855b),{'type':dbH['sequelize']['QueryTypes'][_0x1e3a('0x1c')]}));}}}else{_0x102f24[_0x1e3a('0x19')](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize'][_0x1e3a('0x1b')][_0x1e3a('0x1c')]}));}var _0x30bfd0=path[_0x1e3a('0x1d')](PATH);var _0x4390b0=path[_0x1e3a('0x1e')](PATH,_0x1e3a('0x1f'));var _0x287dd1=_0x3c4b81[_0x1e3a('0xe')]&&_0x102f24['length']>0x1;var _0x387115=[];if(!fs[_0x1e3a('0x20')](path['join'](_0x30bfd0,_0x4390b0))&&_0x287dd1){fs['mkdirSync'](path['join'](_0x30bfd0,_0x4390b0));}return BPromise[_0x1e3a('0x21')](_0x102f24,function(_0x3a6830){_0x387115[_0x1e3a('0x19')](_0x3a6830);})['then'](function(){for(var _0x1c1f7f=0x0;_0x1c1f7f<_0x387115[_0x1e3a('0x16')];_0x1c1f7f+=0x1){var _0x56b9ee;var _0x143fde=_0x387115[_0x1c1f7f];if(_0x287dd1){_0x56b9ee=path[_0x1e3a('0x22')](_0x30bfd0,_0x4390b0,util[_0x1e3a('0x9')](_0x1e3a('0x23'),_0x4390b0,_0x1c1f7f,_0x1e3a('0x24')));}else{_0x56b9ee=path[_0x1e3a('0x22')](_0x30bfd0,util[_0x1e3a('0x9')]('%s.%s',_0x4390b0,'xlsx'));}fs[_0x1e3a('0x25')](_0x56b9ee,json2xls(_0x143fde),_0x1e3a('0x26'));}})[_0x1e3a('0x10')](function(){if(_0x287dd1){return new Promise(function(_0x2eefea){zipdir(path['join'](_0x30bfd0,_0x4390b0),{'saveTo':path['join'](_0x30bfd0,util[_0x1e3a('0x9')](_0x1e3a('0x27'),_0x4390b0,_0x1e3a('0x28')))},function(_0x37e665,_0x47731d){rimraf(path[_0x1e3a('0x22')](_0x30bfd0,_0x4390b0),function(){});_0x2eefea('zip\x20finished');});});}})[_0x1e3a('0x10')](function(){logger[_0x1e3a('0x8')](util[_0x1e3a('0x9')](_0x1e3a('0x29'),EXTRACTED_REPORT_ID,_0x1e3a('0xb')));return analyticExtractedReport(_0x1e3a('0x2a'),_0x287dd1?util[_0x1e3a('0x9')]('%s.%s',_0x4390b0,_0x287dd1?'zip':_0x1e3a('0x24')):null);});})[_0x1e3a('0x2b')](function(_0x315aa6){logger[_0x1e3a('0x8')](util[_0x1e3a('0x9')](_0x1e3a('0x2c'),EXTRACTED_REPORT_ID,_0x1e3a('0xb')),util['inspect'](_0x315aa6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x1e3a('0x2d')](function(){process[_0x1e3a('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x8091=['writeFileSync','zip','zip\x20finished','info','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','QueryTypes','Empty','length','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.xlsx','existsSync','join','each','%s%d.%s','%s.%s'];(function(_0x77b9dc,_0x133d61){var _0x50de60=function(_0x3f0729){while(--_0x3f0729){_0x77b9dc['push'](_0x77b9dc['shift']());}};_0x50de60(++_0x133d61);}(_0x8091,0x124));var _0x1809=function(_0x20f36b,_0x4f0953){_0x20f36b=_0x20f36b-0x0;var _0xadf26e=_0x8091[_0x20f36b];return _0xadf26e;};'use strict';var util=require(_0x1809('0x0'));var path=require(_0x1809('0x1'));var _=require(_0x1809('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0x1809('0x3'));var rimraf=require(_0x1809('0x4'));var db=require(_0x1809('0x5'))['db'];var dbH=require(_0x1809('0x5'))[_0x1809('0x6')];var logger=require(_0x1809('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x1809('0x8')][0x2]);var QUERY=process[_0x1809('0x8')][0x3];var PATH=process[_0x1809('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xd90ca4,_0x34b31c){var _0x14c71c={'status':_0xd90ca4};var _0x1c22d9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x34b31c){_0x14c71c[_0x1809('0x9')]=_0x34b31c;}return db['AnalyticExtractedReport'][_0x1809('0xa')](_0x14c71c,_0x1c22d9);}function main(){var _0xb62294=0x1388;var _0x18b68c;logger['info'](util[_0x1809('0xb')](_0x1809('0xc'),EXTRACTED_REPORT_ID,_0x1809('0xd')));return db[_0x1809('0xe')][_0x1809('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1809('0x10'),_0x1809('0x11')]})[_0x1809('0x12')](function(_0x33dc31){if(_0x33dc31){_0x18b68c=_0x33dc31;_0xb62294=_0x18b68c['splitSizeXlsx']||0x1388;}})[_0x1809('0x12')](function(){return dbH[_0x1809('0x13')][_0x1809('0x14')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x1809('0x15')]['SELECT']});})[_0x1809('0x12')](function(_0x5a32f3){if(!_0x5a32f3[0x0]['num']){return analyticExtractedReport(_0x1809('0x16'));}var _0x19aae6=[];var _0x2cd365=0x0;if(_0x18b68c[_0x1809('0x10')]){if(_0x5a32f3&&_0x5a32f3[_0x1809('0x17')]){var _0x359556=_['range'](_0x5a32f3[0x0]['num']/_0xb62294);var _0x8a8a41=Number['isInteger'](_0x5a32f3[0x0]['num']/_0xb62294)?_0x5a32f3[0x0][_0x1809('0x18')]%_0xb62294:0x0;_0x359556[_0x1809('0x19')](function(_0x54444c){if(_0x54444c>0x0){_0x2cd365+=_0xb62294;}_0x19aae6[_0x1809('0x1a')](dbH['sequelize']['query'](util[_0x1809('0xb')](_0x1809('0x1b'),QUERY,_0xb62294,_0x2cd365),{'type':dbH[_0x1809('0x13')]['QueryTypes']['SELECT']}));});if(_0x8a8a41>0x0){_0x2cd365+=_0xb62294;_0x19aae6[_0x1809('0x1a')](dbH[_0x1809('0x13')][_0x1809('0x14')](util[_0x1809('0xb')](_0x1809('0x1b'),QUERY,_0x8a8a41,_0x2cd365),{'type':dbH[_0x1809('0x13')][_0x1809('0x15')]['SELECT']}));}}}else{_0x19aae6[_0x1809('0x1a')](dbH[_0x1809('0x13')][_0x1809('0x14')](QUERY,{'type':dbH['sequelize'][_0x1809('0x15')][_0x1809('0x1c')]}));}var _0xbf8965=path[_0x1809('0x1d')](PATH);var _0x81b24d=path[_0x1809('0x1e')](PATH,_0x1809('0x1f'));var _0x1fa0e0=_0x18b68c[_0x1809('0x10')]&&_0x19aae6['length']>0x1;var _0x5c3be0=[];if(!fs[_0x1809('0x20')](path['join'](_0xbf8965,_0x81b24d))&&_0x1fa0e0){fs['mkdirSync'](path[_0x1809('0x21')](_0xbf8965,_0x81b24d));}return BPromise[_0x1809('0x22')](_0x19aae6,function(_0x31e0a1){_0x5c3be0[_0x1809('0x1a')](_0x31e0a1);})['then'](function(){for(var _0x5a609e=0x0;_0x5a609e<_0x5c3be0[_0x1809('0x17')];_0x5a609e+=0x1){var _0x36e1a4;var _0x493e32=_0x5c3be0[_0x5a609e];if(_0x1fa0e0){_0x36e1a4=path['join'](_0xbf8965,_0x81b24d,util[_0x1809('0xb')](_0x1809('0x23'),_0x81b24d,_0x5a609e,'xlsx'));}else{_0x36e1a4=path['join'](_0xbf8965,util[_0x1809('0xb')](_0x1809('0x24'),_0x81b24d,'xlsx'));}fs[_0x1809('0x25')](_0x36e1a4,json2xls(_0x493e32),'binary');}})[_0x1809('0x12')](function(){if(_0x1fa0e0){return new Promise(function(_0x2dc224){zipdir(path[_0x1809('0x21')](_0xbf8965,_0x81b24d),{'saveTo':path[_0x1809('0x21')](_0xbf8965,util[_0x1809('0xb')](_0x1809('0x24'),_0x81b24d,_0x1809('0x26')))},function(_0xa4c0c9,_0x31f1f9){rimraf(path[_0x1809('0x21')](_0xbf8965,_0x81b24d),function(){});_0x2dc224(_0x1809('0x27'));});});}})[_0x1809('0x12')](function(){logger[_0x1809('0x28')](util[_0x1809('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x1809('0xd')));return analyticExtractedReport(_0x1809('0x29'),_0x1fa0e0?util[_0x1809('0xb')](_0x1809('0x24'),_0x81b24d,_0x1fa0e0?'zip':'xlsx'):null);});})[_0x1809('0x2a')](function(_0x4b671d){logger[_0x1809('0x28')](util['format'](_0x1809('0x2b'),EXTRACTED_REPORT_ID,_0x1809('0xd')),util[_0x1809('0x2c')](_0x4b671d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1809('0x2d'));})['finally'](function(){process[_0x1809('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 38edd88..7a84eeb 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 _0x3c1a=['CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','util','Interval','findAll','then','intervals','models','VoiceExtension','IntervalId','uniq','map','exten','filter','groupBy','queue','playback','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','interval','tag'];(function(_0x24b239,_0x29c50c){var _0x25a868=function(_0xe13519){while(--_0xe13519){_0x24b239['push'](_0x24b239['shift']());}};_0x25a868(++_0x29c50c);}(_0x3c1a,0x1d9));var _0xa3c1=function(_0x16e0c8,_0x4861eb){_0x16e0c8=_0x16e0c8-0x0;var _0xe4b5af=_0x3c1a[_0x16e0c8];return _0xe4b5af;};'use strict';var _=require('lodash');var util=require(_0xa3c1('0x0'));function rewrite(_0x436426,_0x2178ca){var _0x3e758b=this;return _0x436426['models'][_0xa3c1('0x1')][_0xa3c1('0x2')]({'raw':!![]})[_0xa3c1('0x3')](function(_0x3c6fdd){_0x3e758b[_0xa3c1('0x4')]=_0x3c6fdd;return _0x436426[_0xa3c1('0x5')][_0xa3c1('0x6')][_0xa3c1('0x2')]({'where':{'IntervalId':_0x2178ca[_0xa3c1('0x7')]},'raw':!![]});})[_0xa3c1('0x3')](function(_0x191f90){return _0x436426[_0xa3c1('0x5')][_0xa3c1('0x6')][_0xa3c1('0x2')]({'where':{'exten':{'$in':_[_0xa3c1('0x8')](_[_0xa3c1('0x9')](_0x191f90,_0xa3c1('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xa3c1('0x3')](function(_0x399acc){var _0x465dc5=_['filter'](_0x399acc,{'priority':'1'});var _0x407d3d=_[_0xa3c1('0xb')](_0x399acc,{'isApp':0x1});var _0x392748=_[_0xa3c1('0xc')](_0x407d3d,_0xa3c1('0xa'));var _0x34b0b7=[_0xa3c1('0xd'),_0xa3c1('0xe')];var _0x531c59=[];var _0x3ba231=[];for(var _0x2b5ad1 in _0x392748){if(_0x392748['hasOwnProperty'](_0x2b5ad1)){_0x3e758b[_0xa3c1('0xf')]=0x2;_0x3e758b[_0xa3c1('0x10')]=[];_0x3e758b[_0xa3c1('0x11')]=_[_0xa3c1('0x12')](_0x465dc5,{'exten':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0xa')]});_0x3e758b[_0xa3c1('0x10')][_0xa3c1('0x13')]({'type':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x14')],'app':_0xa3c1('0x15'),'appdata':util[_0xa3c1('0x16')](_0xa3c1('0x17'),_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x14')]),'context':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x18')],'exten':_0x392748[_0x2b5ad1][0x0]['exten'],'priority':_0x3e758b[_0xa3c1('0xf')]++,'VoiceExtensionId':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x19')]});if(_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x14')]===_0xa3c1('0x1a')){_0x3e758b[_0xa3c1('0x10')][_0xa3c1('0x13')]({'type':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x14')],'app':_0xa3c1('0x15'),'appdata':_0xa3c1('0x1b')+_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x19')],'context':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x18')],'exten':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0xa')],'priority':_0x3e758b[_0xa3c1('0xf')]++,'VoiceExtensionId':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x19')]});}else if(_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x14')]===_0xa3c1('0x1c')){if(_0x3e758b[_0xa3c1('0x11')]){_0x3e758b[_0xa3c1('0x10')][_0xa3c1('0x13')]({'type':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x14')],'app':_0xa3c1('0x15'),'appdata':_0xa3c1('0x1d')+(_0x3e758b[_0xa3c1('0x11')][_0xa3c1('0x1e')]?_0xa3c1('0x1f')+_0x3e758b[_0xa3c1('0x11')][_0xa3c1('0x1e')]+'}':_0xa3c1('0x20')),'context':_0x392748[_0x2b5ad1][0x0]['context'],'exten':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0xa')],'priority':_0x3e758b[_0xa3c1('0xf')]++,'VoiceExtensionId':_0x392748[_0x2b5ad1][0x0]['VoiceExtensionId']});}_0x3e758b[_0xa3c1('0x10')][_0xa3c1('0x13')]({'type':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x14')],'app':_0xa3c1('0x15'),'appdata':_0xa3c1('0x1b')+_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x19')],'context':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x18')],'exten':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0xa')],'priority':_0x3e758b['priority']++,'VoiceExtensionId':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x19')]});var _0x3d2321=_0x3e758b[_0xa3c1('0xf')]++;_0x3e758b[_0xa3c1('0x10')][_0xa3c1('0x13')]({'type':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x14')],'app':_0xa3c1('0x21'),'appdata':_0xa3c1('0x22')+(_0x3d2321+0x2)+'):Goto('+(_0x3d2321+0x1)+')','context':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x18')],'exten':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0xa')],'priority':_0x3d2321,'VoiceExtensionId':_0x392748[_0x2b5ad1][0x0]['VoiceExtensionId']});if(_0x3e758b[_0xa3c1('0x11')]){_0x3e758b[_0xa3c1('0x10')][_0xa3c1('0x13')]({'type':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x14')],'app':_0xa3c1('0x15'),'appdata':_0x3e758b['extension']['cutdigits']?_0xa3c1('0x23')+_0x3e758b[_0xa3c1('0x11')][_0xa3c1('0x1e')]+'}':_0xa3c1('0x24'),'context':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x18')],'exten':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0xa')],'priority':_0x3e758b[_0xa3c1('0xf')]++,'VoiceExtensionId':_0x392748[_0x2b5ad1][0x0]['VoiceExtensionId']});}_0x3e758b[_0xa3c1('0x10')][_0xa3c1('0x13')]({'type':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x14')],'app':_0xa3c1('0x15'),'appdata':_0xa3c1('0x25')+_0x392748[_0x2b5ad1][0x0]['VoiceExtensionId'],'context':_0x392748[_0x2b5ad1][0x0]['context'],'exten':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0xa')],'priority':_0x3e758b['priority']++,'VoiceExtensionId':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x19')]});if(_0x3e758b[_0xa3c1('0x11')]&&_0x3e758b[_0xa3c1('0x11')][_0xa3c1('0x26')]('recordingFormat')&&_0x3e758b[_0xa3c1('0x11')][_0xa3c1('0x27')]!==_0xa3c1('0x28')){_0x3e758b[_0xa3c1('0x10')][_0xa3c1('0x13')]({'type':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x14')],'app':_0xa3c1('0x15'),'appdata':_0xa3c1('0x29'),'context':_0x392748[_0x2b5ad1][0x0]['context'],'exten':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0xa')],'priority':_0x3e758b[_0xa3c1('0xf')]++,'VoiceExtensionId':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x19')]});_0x3e758b['extensions'][_0xa3c1('0x13')]({'type':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x14')],'app':_0xa3c1('0x15'),'appdata':_0xa3c1('0x2a')+_0x3e758b[_0xa3c1('0x11')]['recordingFormat']||_0xa3c1('0x2b'),'context':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x18')],'exten':_0x392748[_0x2b5ad1][0x0]['exten'],'priority':_0x3e758b[_0xa3c1('0xf')]++,'VoiceExtensionId':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x19')]});}}_0x3e758b[_0xa3c1('0x10')][_0xa3c1('0x13')]({'type':_0x392748[_0x2b5ad1][0x0]['type'],'app':_0xa3c1('0x15'),'appdata':_0xa3c1('0x2c'),'context':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x18')],'exten':_0x392748[_0x2b5ad1][0x0]['exten'],'priority':_0x3e758b[_0xa3c1('0xf')]++,'VoiceExtensionId':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x19')]});_0x3e758b[_0xa3c1('0x10')]['push']({'type':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x14')],'app':_0xa3c1('0x15'),'appdata':_0xa3c1('0x2d'),'context':_0x392748[_0x2b5ad1][0x0]['context'],'exten':_0x392748[_0x2b5ad1][0x0]['exten'],'priority':_0x3e758b[_0xa3c1('0xf')]++,'VoiceExtensionId':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x19')]});_0x3e758b[_0xa3c1('0x10')]['push']({'type':_0x392748[_0x2b5ad1][0x0]['type'],'app':_0xa3c1('0x15'),'appdata':'MONITOR_OPTIONS=ab','context':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x18')],'exten':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0xa')],'priority':_0x3e758b[_0xa3c1('0xf')]++,'VoiceExtensionId':_0x392748[_0x2b5ad1][0x0]['VoiceExtensionId']});for(var _0x19de94=0x0,_0x2799cb=0x0;_0x19de94<_0x392748[_0x2b5ad1][_0xa3c1('0x2e')];_0x19de94+=0x1,_0x2799cb=0x0){var _0xfe1f65=_0x392748[_0x2b5ad1][_0x19de94];if(_0xfe1f65['type']){_0xfe1f65[_0xa3c1('0x14')]=_0xfe1f65[_0xa3c1('0x14')][_0xa3c1('0x2f')]();}var _0x315056=[];var _0x3ac342=[];delete _0xfe1f65['id'];delete _0xfe1f65[_0xa3c1('0x30')];delete _0xfe1f65[_0xa3c1('0x31')];var _0x24e79c=_0xfe1f65[_0xa3c1('0x32')]!=='*,*,*,*'?[_0xfe1f65['interval']]:_0xfe1f65[_0xa3c1('0x7')]?_[_0xa3c1('0x9')](_['filter'](_0x3e758b[_0xa3c1('0x4')],{'IntervalId':_0xfe1f65[_0xa3c1('0x7')]}),'interval'):[];if(_0xfe1f65[_0xa3c1('0x26')](_0xa3c1('0x33'))){if(_0xfe1f65[_0xa3c1('0x33')]&&_0xfe1f65['tag']!=='--'){_0x315056['push']({'type':_0xfe1f65[_0xa3c1('0x14')],'app':'Set','appdata':_0xa3c1('0x34')+_0xfe1f65[_0xa3c1('0x33')],'context':_0xfe1f65[_0xa3c1('0x18')],'exten':_0xfe1f65[_0xa3c1('0xa')],'priority':_0x24e79c[_0xa3c1('0x2e')]+_0x3e758b['priority']+_0x2799cb++,'VoiceExtensionId':_0xfe1f65[_0xa3c1('0x19')]});}}if(_0xfe1f65[_0xa3c1('0x14')]==='outbound'&&_0xfe1f65[_0xa3c1('0x26')](_0xa3c1('0x35'))){if(_0xfe1f65[_0xa3c1('0x35')]){_0x315056[_0xa3c1('0x13')]({'type':_0xfe1f65[_0xa3c1('0x14')],'app':_0xa3c1('0x21'),'appdata':_0xa3c1('0x36')+_0xfe1f65[_0xa3c1('0x35')]+')','context':_0xfe1f65['context'],'exten':_0xfe1f65['exten'],'priority':_0x24e79c[_0xa3c1('0x2e')]+_0x3e758b['priority']+_0x2799cb++,'VoiceExtensionId':_0xfe1f65[_0xa3c1('0x19')]});}else{_0x315056[_0xa3c1('0x13')]({'type':_0xfe1f65['type'],'app':_0xa3c1('0x21'),'appdata':_0xa3c1('0x37'),'context':_0xfe1f65[_0xa3c1('0x18')],'exten':_0xfe1f65[_0xa3c1('0xa')],'priority':_0x24e79c[_0xa3c1('0x2e')]+_0x3e758b[_0xa3c1('0xf')]+_0x2799cb++,'VoiceExtensionId':_0xfe1f65[_0xa3c1('0x19')]});}}if(_0xfe1f65['hasOwnProperty'](_0xa3c1('0x38'))){if(_0x34b0b7[_0xa3c1('0x39')](_0xfe1f65['app'][_0xa3c1('0x2f')]())>=0x0&&_0xfe1f65[_0xa3c1('0x3a')]!==_0xa3c1('0x3b')){if(_0xfe1f65[_0xa3c1('0x38')]){_0x315056['push']({'type':_0xfe1f65[_0xa3c1('0x14')],'app':_0xa3c1('0x21'),'appdata':_0xa3c1('0x3c'),'context':_0xfe1f65[_0xa3c1('0x18')],'exten':_0xfe1f65[_0xa3c1('0xa')],'priority':_0x24e79c[_0xa3c1('0x2e')]+_0x3e758b[_0xa3c1('0xf')]+_0x2799cb++,'VoiceExtensionId':_0xfe1f65[_0xa3c1('0x19')]});_0x315056['push']({'type':_0xfe1f65['type'],'app':_0xa3c1('0x15'),'appdata':_0xa3c1('0x3d'),'context':_0xfe1f65['context'],'exten':_0xfe1f65[_0xa3c1('0xa')],'priority':_0x24e79c[_0xa3c1('0x2e')]+_0x3e758b[_0xa3c1('0xf')]+_0x2799cb++,'VoiceExtensionId':_0xfe1f65[_0xa3c1('0x19')]});}else{_0x315056[_0xa3c1('0x13')]({'type':_0xfe1f65['type'],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0xfe1f65['context'],'exten':_0xfe1f65[_0xa3c1('0xa')],'priority':_0x24e79c['length']+_0x3e758b[_0xa3c1('0xf')]+_0x2799cb++,'VoiceExtensionId':_0xfe1f65['VoiceExtensionId']});_0x315056[_0xa3c1('0x13')]({'type':_0xfe1f65[_0xa3c1('0x14')],'app':'Set','appdata':_0xa3c1('0x3e'),'context':_0xfe1f65[_0xa3c1('0x18')],'exten':_0xfe1f65['exten'],'priority':_0x24e79c[_0xa3c1('0x2e')]+_0x3e758b[_0xa3c1('0xf')]+_0x2799cb++,'VoiceExtensionId':_0xfe1f65[_0xa3c1('0x19')]});}}}for(var _0x3f62ee=0x0;_0x3f62ee<_0x24e79c[_0xa3c1('0x2e')];_0x3f62ee+=0x1){var _0xe9d667=_0x3e758b[_0xa3c1('0xf')]+_0x24e79c[_0xa3c1('0x2e')];var _0x487632=_0x3f62ee===_0x24e79c['length']-0x1?_0x3e758b[_0xa3c1('0xf')]+_0x315056[_0xa3c1('0x2e')]+_0x3ac342[_0xa3c1('0x2e')]+0x2:_0x3e758b['priority']+_0x3f62ee+0x1;_0x315056[_0xa3c1('0x3f')](_0x3f62ee,0x0,{'type':_0xfe1f65['type'],'app':'GotoIfTime','appdata':_0x24e79c[_0x3f62ee]+'?'+_0xfe1f65[_0xa3c1('0x18')]+_0xa3c1('0x40')+_0xe9d667+':'+_0xfe1f65[_0xa3c1('0x18')]+',${EXTEN},'+_0x487632,'exten':_0xfe1f65[_0xa3c1('0xa')],'context':_0xfe1f65[_0xa3c1('0x18')],'priority':_0x3e758b[_0xa3c1('0xf')]+_0x3f62ee,'VoiceExtensionId':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x19')]});}_0xfe1f65['priority']=_0x315056['length']?_[_0xa3c1('0x41')](_0x315056)[_0xa3c1('0xf')]+0x1:_0x3e758b[_0xa3c1('0xf')];_0x3e758b[_0xa3c1('0xf')]=(_0x3ac342[_0xa3c1('0x2e')]?_[_0xa3c1('0x41')](_0x3ac342)[_0xa3c1('0xf')]:_0xfe1f65[_0xa3c1('0xf')])+0x1;_0x3e758b[_0xa3c1('0x10')]=_['concat'](_0x3e758b[_0xa3c1('0x10')],_0x315056,[_0xfe1f65],_0x3ac342);}_0x3e758b[_0xa3c1('0x10')][_0xa3c1('0x13')]({'type':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x14')],'app':_0xa3c1('0x42'),'exten':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0xa')],'context':_0x392748[_0x2b5ad1][0x0][_0xa3c1('0x18')],'priority':_0x3e758b[_0xa3c1('0xf')],'VoiceExtensionId':_0x392748[_0x2b5ad1][0x0]['VoiceExtensionId']});_0x531c59[_0xa3c1('0x13')](_0x392748[_0x2b5ad1][0x0]['VoiceExtensionId']);_0x3ba231=_[_0xa3c1('0x43')](_0x3ba231,_0x3e758b[_0xa3c1('0x10')]);}}return _0x436426[_0xa3c1('0x44')](function(_0x281a12){return _0x436426[_0xa3c1('0x5')][_0xa3c1('0x6')][_0xa3c1('0x45')]({'where':{'VoiceExtensionId':{'$in':_0x531c59}},'transaction':_0x281a12})[_0xa3c1('0x3')](function(_0x17c18b){return _0x436426[_0xa3c1('0x5')][_0xa3c1('0x6')][_0xa3c1('0x46')](_[_0xa3c1('0x47')](_0x3ba231,_0xa3c1('0xf')),{'transaction':_0x281a12});});});})[_0xa3c1('0x48')](function(_0x45d11f){console[_0xa3c1('0x49')](_0x45d11f);});}exports[_0xa3c1('0x4a')]=rewrite; \ No newline at end of file +var _0xf05c=['MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','map','CDR(tag)=','tag','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','catch','rewrite','lodash','util','models','findAll','intervals','VoiceExtension','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','then','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','Set','type','inbound','CDR(routeid)=','context','outbound','CDR(destination)=','cutdigits','${EXTEN}','VoiceExtensionId','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0'];(function(_0x2daf65,_0x200143){var _0x3f0a34=function(_0x19fa27){while(--_0x19fa27){_0x2daf65['push'](_0x2daf65['shift']());}};_0x3f0a34(++_0x200143);}(_0xf05c,0x176));var _0xcf05=function(_0x24fa05,_0x2b7735){_0x24fa05=_0x24fa05-0x0;var _0x250d9a=_0xf05c[_0x24fa05];return _0x250d9a;};'use strict';var _=require(_0xcf05('0x0'));var util=require(_0xcf05('0x1'));function rewrite(_0x5b6fb2,_0x4438ea){var _0x574d23=this;return _0x5b6fb2[_0xcf05('0x2')]['Interval'][_0xcf05('0x3')]({'raw':!![]})['then'](function(_0x2f9eb1){_0x574d23[_0xcf05('0x4')]=_0x2f9eb1;return _0x5b6fb2[_0xcf05('0x2')][_0xcf05('0x5')]['findAll']({'where':{'IntervalId':_0x4438ea[_0xcf05('0x6')]},'raw':!![]});})['then'](function(_0x107ea3){return _0x5b6fb2['models'][_0xcf05('0x5')][_0xcf05('0x3')]({'where':{'exten':{'$in':_[_0xcf05('0x7')](_['map'](_0x107ea3,_0xcf05('0x8')))}},'order':[{'raw':_0xcf05('0x9')}],'raw':!![]});})[_0xcf05('0xa')](function(_0x113d25){var _0x4461a9=_[_0xcf05('0xb')](_0x113d25,{'priority':'1'});var _0x2cb51b=_[_0xcf05('0xb')](_0x113d25,{'isApp':0x1});var _0x358b29=_[_0xcf05('0xc')](_0x2cb51b,_0xcf05('0x8'));var _0x453e0c=[_0xcf05('0xd'),_0xcf05('0xe')];var _0x43b231=[];var _0x1a2636=[];for(var _0x3bf042 in _0x358b29){if(_0x358b29[_0xcf05('0xf')](_0x3bf042)){_0x574d23[_0xcf05('0x10')]=0x2;_0x574d23[_0xcf05('0x11')]=[];_0x574d23[_0xcf05('0x12')]=_[_0xcf05('0x13')](_0x4461a9,{'exten':_0x358b29[_0x3bf042][0x0][_0xcf05('0x8')]});_0x574d23['extensions'][_0xcf05('0x14')]({'type':_0x358b29[_0x3bf042][0x0]['type'],'app':_0xcf05('0x15'),'appdata':util['format']('CDR(type)=%s',_0x358b29[_0x3bf042][0x0]['type']),'context':_0x358b29[_0x3bf042][0x0]['context'],'exten':_0x358b29[_0x3bf042][0x0][_0xcf05('0x8')],'priority':_0x574d23[_0xcf05('0x10')]++,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0]['VoiceExtensionId']});if(_0x358b29[_0x3bf042][0x0][_0xcf05('0x16')]===_0xcf05('0x17')){_0x574d23[_0xcf05('0x11')][_0xcf05('0x14')]({'type':_0x358b29[_0x3bf042][0x0][_0xcf05('0x16')],'app':_0xcf05('0x15'),'appdata':_0xcf05('0x18')+_0x358b29[_0x3bf042][0x0]['VoiceExtensionId'],'context':_0x358b29[_0x3bf042][0x0][_0xcf05('0x19')],'exten':_0x358b29[_0x3bf042][0x0][_0xcf05('0x8')],'priority':_0x574d23[_0xcf05('0x10')]++,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0]['VoiceExtensionId']});}else if(_0x358b29[_0x3bf042][0x0][_0xcf05('0x16')]===_0xcf05('0x1a')){if(_0x574d23[_0xcf05('0x12')]){_0x574d23[_0xcf05('0x11')][_0xcf05('0x14')]({'type':_0x358b29[_0x3bf042][0x0]['type'],'app':_0xcf05('0x15'),'appdata':_0xcf05('0x1b')+(_0x574d23[_0xcf05('0x12')][_0xcf05('0x1c')]?'${EXTEN:'+_0x574d23['extension']['cutdigits']+'}':_0xcf05('0x1d')),'context':_0x358b29[_0x3bf042][0x0]['context'],'exten':_0x358b29[_0x3bf042][0x0][_0xcf05('0x8')],'priority':_0x574d23['priority']++,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')]});}_0x574d23[_0xcf05('0x11')]['push']({'type':_0x358b29[_0x3bf042][0x0][_0xcf05('0x16')],'app':_0xcf05('0x15'),'appdata':_0xcf05('0x18')+_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')],'context':_0x358b29[_0x3bf042][0x0][_0xcf05('0x19')],'exten':_0x358b29[_0x3bf042][0x0]['exten'],'priority':_0x574d23[_0xcf05('0x10')]++,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')]});var _0x19f57f=_0x574d23[_0xcf05('0x10')]++;_0x574d23[_0xcf05('0x11')][_0xcf05('0x14')]({'type':_0x358b29[_0x3bf042][0x0]['type'],'app':_0xcf05('0x1f'),'appdata':_0xcf05('0x20')+(_0x19f57f+0x2)+_0xcf05('0x21')+(_0x19f57f+0x1)+')','context':_0x358b29[_0x3bf042][0x0]['context'],'exten':_0x358b29[_0x3bf042][0x0]['exten'],'priority':_0x19f57f,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0]['VoiceExtensionId']});if(_0x574d23['extension']){_0x574d23[_0xcf05('0x11')][_0xcf05('0x14')]({'type':_0x358b29[_0x3bf042][0x0][_0xcf05('0x16')],'app':_0xcf05('0x15'),'appdata':_0x574d23['extension'][_0xcf05('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x574d23['extension'][_0xcf05('0x1c')]+'}':_0xcf05('0x22'),'context':_0x358b29[_0x3bf042][0x0][_0xcf05('0x19')],'exten':_0x358b29[_0x3bf042][0x0]['exten'],'priority':_0x574d23['priority']++,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')]});}_0x574d23[_0xcf05('0x11')][_0xcf05('0x14')]({'type':_0x358b29[_0x3bf042][0x0][_0xcf05('0x16')],'app':_0xcf05('0x15'),'appdata':_0xcf05('0x23')+_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')],'context':_0x358b29[_0x3bf042][0x0][_0xcf05('0x19')],'exten':_0x358b29[_0x3bf042][0x0]['exten'],'priority':_0x574d23['priority']++,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')]});if(_0x574d23['extension']&&_0x574d23['extension'][_0xcf05('0xf')](_0xcf05('0x24'))&&_0x574d23[_0xcf05('0x12')][_0xcf05('0x24')]!==_0xcf05('0x25')){_0x574d23[_0xcf05('0x11')][_0xcf05('0x14')]({'type':_0x358b29[_0x3bf042][0x0][_0xcf05('0x16')],'app':_0xcf05('0x15'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x358b29[_0x3bf042][0x0][_0xcf05('0x19')],'exten':_0x358b29[_0x3bf042][0x0][_0xcf05('0x8')],'priority':_0x574d23['priority']++,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')]});_0x574d23[_0xcf05('0x11')]['push']({'type':_0x358b29[_0x3bf042][0x0]['type'],'app':_0xcf05('0x15'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x574d23['extension'][_0xcf05('0x24')]||'wav','context':_0x358b29[_0x3bf042][0x0][_0xcf05('0x19')],'exten':_0x358b29[_0x3bf042][0x0][_0xcf05('0x8')],'priority':_0x574d23[_0xcf05('0x10')]++,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')]});}}_0x574d23[_0xcf05('0x11')][_0xcf05('0x14')]({'type':_0x358b29[_0x3bf042][0x0][_0xcf05('0x16')],'app':_0xcf05('0x15'),'appdata':_0xcf05('0x26'),'context':_0x358b29[_0x3bf042][0x0][_0xcf05('0x19')],'exten':_0x358b29[_0x3bf042][0x0][_0xcf05('0x8')],'priority':_0x574d23[_0xcf05('0x10')]++,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')]});_0x574d23[_0xcf05('0x11')]['push']({'type':_0x358b29[_0x3bf042][0x0][_0xcf05('0x16')],'app':_0xcf05('0x15'),'appdata':_0xcf05('0x27'),'context':_0x358b29[_0x3bf042][0x0][_0xcf05('0x19')],'exten':_0x358b29[_0x3bf042][0x0][_0xcf05('0x8')],'priority':_0x574d23['priority']++,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0]['VoiceExtensionId']});_0x574d23['extensions'][_0xcf05('0x14')]({'type':_0x358b29[_0x3bf042][0x0][_0xcf05('0x16')],'app':_0xcf05('0x15'),'appdata':_0xcf05('0x28'),'context':_0x358b29[_0x3bf042][0x0][_0xcf05('0x19')],'exten':_0x358b29[_0x3bf042][0x0][_0xcf05('0x8')],'priority':_0x574d23[_0xcf05('0x10')]++,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')]});for(var _0x189c4c=0x0,_0x5b4f90=0x0;_0x189c4c<_0x358b29[_0x3bf042]['length'];_0x189c4c+=0x1,_0x5b4f90=0x0){var _0x1d86bd=_0x358b29[_0x3bf042][_0x189c4c];if(_0x1d86bd['type']){_0x1d86bd['type']=_0x1d86bd[_0xcf05('0x16')][_0xcf05('0x29')]();}var _0x501a79=[];var _0x3b76bc=[];delete _0x1d86bd['id'];delete _0x1d86bd[_0xcf05('0x2a')];delete _0x1d86bd[_0xcf05('0x2b')];var _0x2e7ceb=_0x1d86bd[_0xcf05('0x2c')]!==_0xcf05('0x2d')?[_0x1d86bd['interval']]:_0x1d86bd['IntervalId']?_[_0xcf05('0x2e')](_[_0xcf05('0xb')](_0x574d23[_0xcf05('0x4')],{'IntervalId':_0x1d86bd[_0xcf05('0x6')]}),_0xcf05('0x2c')):[];if(_0x1d86bd[_0xcf05('0xf')]('tag')){if(_0x1d86bd['tag']&&_0x1d86bd['tag']!=='--'){_0x501a79[_0xcf05('0x14')]({'type':_0x1d86bd[_0xcf05('0x16')],'app':'Set','appdata':_0xcf05('0x2f')+_0x1d86bd[_0xcf05('0x30')],'context':_0x1d86bd['context'],'exten':_0x1d86bd[_0xcf05('0x8')],'priority':_0x2e7ceb[_0xcf05('0x31')]+_0x574d23['priority']+_0x5b4f90++,'VoiceExtensionId':_0x1d86bd[_0xcf05('0x1e')]});}}if(_0x1d86bd['type']===_0xcf05('0x1a')&&_0x1d86bd['hasOwnProperty'](_0xcf05('0x32'))){if(_0x1d86bd[_0xcf05('0x32')]){_0x501a79[_0xcf05('0x14')]({'type':_0x1d86bd[_0xcf05('0x16')],'app':_0xcf05('0x1f'),'appdata':_0xcf05('0x33')+_0x1d86bd[_0xcf05('0x32')]+')','context':_0x1d86bd[_0xcf05('0x19')],'exten':_0x1d86bd['exten'],'priority':_0x2e7ceb[_0xcf05('0x31')]+_0x574d23[_0xcf05('0x10')]+_0x5b4f90++,'VoiceExtensionId':_0x1d86bd[_0xcf05('0x1e')]});}else{_0x501a79[_0xcf05('0x14')]({'type':_0x1d86bd[_0xcf05('0x16')],'app':_0xcf05('0x1f'),'appdata':_0xcf05('0x34'),'context':_0x1d86bd[_0xcf05('0x19')],'exten':_0x1d86bd[_0xcf05('0x8')],'priority':_0x2e7ceb[_0xcf05('0x31')]+_0x574d23[_0xcf05('0x10')]+_0x5b4f90++,'VoiceExtensionId':_0x1d86bd[_0xcf05('0x1e')]});}}if(_0x1d86bd[_0xcf05('0xf')]('answer')){if(_0x453e0c[_0xcf05('0x35')](_0x1d86bd[_0xcf05('0x36')][_0xcf05('0x29')]())>=0x0&&_0x1d86bd[_0xcf05('0x37')]!=='custom'){if(_0x1d86bd[_0xcf05('0x38')]){_0x501a79[_0xcf05('0x14')]({'type':_0x1d86bd['type'],'app':'ExecIf','appdata':_0xcf05('0x39'),'context':_0x1d86bd[_0xcf05('0x19')],'exten':_0x1d86bd[_0xcf05('0x8')],'priority':_0x2e7ceb[_0xcf05('0x31')]+_0x574d23[_0xcf05('0x10')]+_0x5b4f90++,'VoiceExtensionId':_0x1d86bd['VoiceExtensionId']});_0x501a79[_0xcf05('0x14')]({'type':_0x1d86bd['type'],'app':'Set','appdata':_0xcf05('0x3a'),'context':_0x1d86bd[_0xcf05('0x19')],'exten':_0x1d86bd[_0xcf05('0x8')],'priority':_0x2e7ceb[_0xcf05('0x31')]+_0x574d23[_0xcf05('0x10')]+_0x5b4f90++,'VoiceExtensionId':_0x1d86bd['VoiceExtensionId']});}else{_0x501a79[_0xcf05('0x14')]({'type':_0x1d86bd[_0xcf05('0x16')],'app':_0xcf05('0x1f'),'appdata':_0xcf05('0x3b'),'context':_0x1d86bd['context'],'exten':_0x1d86bd['exten'],'priority':_0x2e7ceb[_0xcf05('0x31')]+_0x574d23['priority']+_0x5b4f90++,'VoiceExtensionId':_0x1d86bd['VoiceExtensionId']});_0x501a79[_0xcf05('0x14')]({'type':_0x1d86bd[_0xcf05('0x16')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x1d86bd['context'],'exten':_0x1d86bd[_0xcf05('0x8')],'priority':_0x2e7ceb[_0xcf05('0x31')]+_0x574d23[_0xcf05('0x10')]+_0x5b4f90++,'VoiceExtensionId':_0x1d86bd[_0xcf05('0x1e')]});}}}for(var _0x29e030=0x0;_0x29e030<_0x2e7ceb['length'];_0x29e030+=0x1){var _0x2c53a6=_0x574d23['priority']+_0x2e7ceb[_0xcf05('0x31')];var _0x33bb1a=_0x29e030===_0x2e7ceb['length']-0x1?_0x574d23[_0xcf05('0x10')]+_0x501a79[_0xcf05('0x31')]+_0x3b76bc['length']+0x2:_0x574d23[_0xcf05('0x10')]+_0x29e030+0x1;_0x501a79['splice'](_0x29e030,0x0,{'type':_0x1d86bd[_0xcf05('0x16')],'app':'GotoIfTime','appdata':_0x2e7ceb[_0x29e030]+'?'+_0x1d86bd[_0xcf05('0x19')]+_0xcf05('0x3c')+_0x2c53a6+':'+_0x1d86bd[_0xcf05('0x19')]+_0xcf05('0x3c')+_0x33bb1a,'exten':_0x1d86bd[_0xcf05('0x8')],'context':_0x1d86bd[_0xcf05('0x19')],'priority':_0x574d23[_0xcf05('0x10')]+_0x29e030,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')]});}_0x1d86bd[_0xcf05('0x10')]=_0x501a79[_0xcf05('0x31')]?_[_0xcf05('0x3d')](_0x501a79)['priority']+0x1:_0x574d23[_0xcf05('0x10')];_0x574d23['priority']=(_0x3b76bc[_0xcf05('0x31')]?_[_0xcf05('0x3d')](_0x3b76bc)[_0xcf05('0x10')]:_0x1d86bd[_0xcf05('0x10')])+0x1;_0x574d23[_0xcf05('0x11')]=_[_0xcf05('0x3e')](_0x574d23[_0xcf05('0x11')],_0x501a79,[_0x1d86bd],_0x3b76bc);}_0x574d23['extensions']['push']({'type':_0x358b29[_0x3bf042][0x0][_0xcf05('0x16')],'app':_0xcf05('0x3f'),'exten':_0x358b29[_0x3bf042][0x0][_0xcf05('0x8')],'context':_0x358b29[_0x3bf042][0x0]['context'],'priority':_0x574d23[_0xcf05('0x10')],'VoiceExtensionId':_0x358b29[_0x3bf042][0x0]['VoiceExtensionId']});_0x43b231[_0xcf05('0x14')](_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')]);_0x1a2636=_['concat'](_0x1a2636,_0x574d23['extensions']);}}return _0x5b6fb2[_0xcf05('0x40')](function(_0x5a482d){return _0x5b6fb2[_0xcf05('0x2')]['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x43b231}},'transaction':_0x5a482d})[_0xcf05('0xa')](function(_0x5de3fb){return _0x5b6fb2[_0xcf05('0x2')]['VoiceExtension'][_0xcf05('0x41')](_[_0xcf05('0x42')](_0x1a2636,_0xcf05('0x10')),{'transaction':_0x5a482d});});});})[_0xcf05('0x43')](function(_0x32be4f){console['error'](_0x32be4f);});}exports[_0xcf05('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 0ef6ad7..253f582 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 _0x6a48=['cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','field','NOW()','ContactId','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','select','\x20=\x20?','ListId\x20=\x20?','str','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','id\x20IN\x20?','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','Campaign','get','CampaignId','BlackLists','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','CSV\x20parsed\x20correctly!','info','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','test','errors','length','map','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','create','keys','then','push','pick','catch','message'];(function(_0xc1cc58,_0xf473e5){var _0x3bcd10=function(_0x1616a7){while(--_0x1616a7){_0xc1cc58['push'](_0xc1cc58['shift']());}};_0x3bcd10(++_0xf473e5);}(_0x6a48,0x18f));var _0x86a4=function(_0x4d5536,_0x10143c){_0x4d5536=_0x4d5536-0x0;var _0x3cdbc9=_0x6a48[_0x4d5536];return _0x3cdbc9;};'use strict';var BPromise=require(_0x86a4('0x0'));var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require(_0x86a4('0x1'));var Papa=require(_0x86a4('0x2'));var Redis=require(_0x86a4('0x3'));var db=require(_0x86a4('0x4'))['db'];var config=require(_0x86a4('0x5'));var logger=require(_0x86a4('0x6'))(_0x86a4('0x7'));config[_0x86a4('0x8')]=_[_0x86a4('0x9')](config[_0x86a4('0x8')],{'host':_0x86a4('0xa'),'port':0x18eb});var socket=require(_0x86a4('0xb'))(new Redis(config['redis']));require(_0x86a4('0xc'))[_0x86a4('0xd')](socket);try{if(!process[_0x86a4('0xe')][0x2]||process[_0x86a4('0xe')][0x2]===_0x86a4('0xf')||process[_0x86a4('0xe')][0x2]===_0x86a4('0x10')){throw new Error(_0x86a4('0x11'));}var FILEPATH=process[_0x86a4('0xe')][0x2];if(!process[_0x86a4('0xe')][0x3]||process['argv'][0x3]===_0x86a4('0xf')||process[_0x86a4('0xe')][0x3]===_0x86a4('0x10')||!process['argv'][0x4]||process['argv'][0x4]===_0x86a4('0xf')||process[_0x86a4('0xe')][0x4]==='null'){throw new Error(_0x86a4('0x12'));}var FIELDS=_[_0x86a4('0x13')](process[_0x86a4('0xe')][0x3][_0x86a4('0x14')](','),process['argv'][0x4][_0x86a4('0x14')](','));if(!process[_0x86a4('0xe')][0x5]||process[_0x86a4('0xe')][0x5]===_0x86a4('0xf')||process[_0x86a4('0xe')][0x5]==='null'){throw new Error(_0x86a4('0x15'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x86a4('0xe')][0x6]&&process[_0x86a4('0xe')][0x6]!==_0x86a4('0xf')&&process[_0x86a4('0xe')][0x6]!==_0x86a4('0x10')?process[_0x86a4('0xe')][0x6]:null;var DUPLICATES=process[_0x86a4('0xe')][0x7]&&process[_0x86a4('0xe')][0x7]!==_0x86a4('0xf')&&process[_0x86a4('0xe')][0x7]!==_0x86a4('0x10')?process[_0x86a4('0xe')][0x7]:null;if(!process[_0x86a4('0xe')][0x8]||process[_0x86a4('0xe')][0x8]===_0x86a4('0xf')||process[_0x86a4('0xe')][0x8]===_0x86a4('0x10')){throw new Error(_0x86a4('0x16'));}var SOCKET_TIMESTAMP=process[_0x86a4('0xe')][0x8];}catch(_0x2d1aaf){logger[_0x86a4('0x17')](_0x2d1aaf);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(_0x35ead3,_0x43098c,_0x3d8da3,_0x321b43){var _0x212058={'message':_0x43098c};_0x212058[_0x35ead3]=!![];if(_0x3d8da3){_0x212058[_0x86a4('0x18')]=_0x3d8da3;}if(_0x321b43){_0x212058['index']=_0x321b43;}return _0x212058;}function isEmail(_0x23c300){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))*$/[_0x86a4('0x19')](_0x23c300);}function checkRow(_0xb66bea,_0x2483f3,_0x4f429d){return new BPromise(function(_0x56f58c,_0x152641){if(_['isNil'](_0xb66bea)){return _0x152641(handleCheckRowError(_0x86a4('0x17'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x4f429d));}if(_0xb66bea[_0x86a4('0x1a')]&&_0xb66bea[_0x86a4('0x1a')][_0x86a4('0x1b')]){var _0x2e6883=_[_0x86a4('0x1c')](_0xb66bea['errors'],'message')[_0x86a4('0x1d')](';');return _0x152641(handleCheckRowError(_0x86a4('0x17'),_0x2e6883,null,_0x4f429d));}var _0x25ce0a={};for(var _0x41ae24 in FIELDS){if(FIELDS[_0x86a4('0x1e')](_0x41ae24)&&FIELDS[_0x41ae24]){_0x25ce0a[_0x41ae24]=_0xb66bea[_0x86a4('0x1f')][0x0][FIELDS[_0x41ae24]]||_0xb66bea['data'][0x0]['\ufeff'+FIELDS[_0x41ae24]];}}if(!_0x25ce0a[_0x86a4('0x20')]){return _0x152641(handleCheckRowError('error',_0x86a4('0x21'),null,_0x4f429d));}if(!_0x25ce0a[_0x86a4('0x22')]){return _0x152641(handleCheckRowError(_0x86a4('0x17'),_0x86a4('0x23'),null,_0x4f429d));}if(_0x25ce0a[_0x86a4('0x24')]){var _0x10d0e4=moment(_0x25ce0a[_0x86a4('0x24')],_0x86a4('0x25'));if(!_0x10d0e4[_0x86a4('0x26')]()){return _0x152641(handleCheckRowError(_0x86a4('0x17'),_0x86a4('0x27'),null,_0x4f429d));}}if(_0x25ce0a[_0x86a4('0x28')]){if(!isEmail(_0x25ce0a[_0x86a4('0x28')])){return _0x152641(handleCheckRowError(_0x86a4('0x17'),_0x86a4('0x29'),null,_0x4f429d));}}_0x25ce0a[_0x86a4('0x2a')]=LISTID;_0x25ce0a[_0x86a4('0x2b')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x86a4('0x1b')]&&_0x2483f3){var _0x538dae={};for(var _0x97a660=0x0,_0x122bf8=DUPLICATES[_0x86a4('0x1b')];_0x97a660<_0x122bf8;_0x97a660+=0x1){_0x538dae[DUPLICATES[_0x97a660]]=_0x25ce0a[DUPLICATES[_0x97a660]];}var _0x2363ea=_[_0x86a4('0x2c')](_0x2483f3,_0x538dae);if(_0x2363ea){return _0x152641(handleCheckRowError(_0x86a4('0x2d'),'Duplicate\x20Contact',_0x2363ea,_0x4f429d));}}return db['CmContact'][_0x86a4('0x2e')](_0x25ce0a,{'raw':!![],'hooks':![],'fields':_[_0x86a4('0x2f')](_0x25ce0a)})[_0x86a4('0x30')](function(_0x426edc){if(DUPLICATES&&DUPLICATES[_0x86a4('0x1b')]&&_0x2483f3){_0x2483f3[_0x86a4('0x31')](_[_0x86a4('0x32')](_0x25ce0a,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x426edc['id'];return _0x56f58c();})[_0x86a4('0x33')](function(_0x314c28){return _0x152641(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x314c28[_0x86a4('0x34')]||JSON['stringify'](_0x314c28)),null,_0x4f429d));});});}function checkHopper(){function _0x450a78(){return function(_0x5a710f){logger['error'](_0x86a4('0x35'),_0x86a4('0x36'),util[_0x86a4('0x37')](_0x5a710f,{'showHidden':![],'depth':null}));};}var _0x2b47e2=function(_0x14c9df,_0x12e622){var _0x344e81=squel[_0x86a4('0x38')]()[_0x86a4('0x39')](_0x86a4('0x3a'))[_0x86a4('0x3b')]([_0x86a4('0x22'),_0x86a4('0x3c'),'ContactId',_0x86a4('0x2a'),_0x12e622,_0x86a4('0x3d'),_0x86a4('0x3e')],squel['select']()[_0x86a4('0x3f')](_0x86a4('0x22'),'phone')[_0x86a4('0x3f')](_0x86a4('0x40'),'scheduledAt')[_0x86a4('0x3f')]('id',_0x86a4('0x41'))[_0x86a4('0x3f')](LISTID[_0x86a4('0x42')](),_0x86a4('0x2a'))[_0x86a4('0x3f')](_0x14c9df['id'][_0x86a4('0x42')](),_0x12e622)['field'](_0x86a4('0x40'),_0x86a4('0x3d'))[_0x86a4('0x3f')]('NOW()','updatedAt')[_0x86a4('0x43')](_0x86a4('0x44'))[_0x86a4('0x45')](_0x86a4('0x46'))[_0x86a4('0x45')]('ListId\x20=\x20?',LISTID['toString']())[_0x86a4('0x45')]('phone\x20IS\x20NOT\x20NULL')[_0x86a4('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0x86a4('0x47')]()[_0x86a4('0x3f')](_0x86a4('0x22'))[_0x86a4('0x43')]('cm_hopper')['where'](_0x12e622+_0x86a4('0x48'),_0x14c9df['id'][_0x86a4('0x42')]())))[_0x86a4('0x42')]();return _0x344e81;};var _0x5ebac5=function(_0x267a53,_0x470e53){var _0x27cf15=squel['insert']()[_0x86a4('0x39')](_0x86a4('0x3a'))[_0x86a4('0x3b')](['phone',_0x86a4('0x3c'),'ContactId',_0x86a4('0x2a'),_0x470e53,_0x86a4('0x3d'),_0x86a4('0x3e')],squel['select']()[_0x86a4('0x3f')]('phone',_0x86a4('0x22'))[_0x86a4('0x3f')](_0x86a4('0x40'),_0x86a4('0x3c'))[_0x86a4('0x3f')]('id',_0x86a4('0x41'))['field'](LISTID[_0x86a4('0x42')](),'ListId')[_0x86a4('0x3f')](_0x267a53['id'][_0x86a4('0x42')](),_0x470e53)[_0x86a4('0x3f')](_0x86a4('0x40'),'createdAt')[_0x86a4('0x3f')]('NOW()',_0x86a4('0x3e'))['from'](_0x86a4('0x44'))[_0x86a4('0x45')](_0x86a4('0x46'))[_0x86a4('0x45')](_0x86a4('0x49'),LISTID[_0x86a4('0x42')]())[_0x86a4('0x45')]('id\x20IN\x20?',squel[_0x86a4('0x4a')](hopperContacts))[_0x86a4('0x45')](_0x86a4('0x4b'))[_0x86a4('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0x86a4('0x47')]()[_0x86a4('0x3f')]('calleridnum')[_0x86a4('0x43')](_0x86a4('0x4c'))['where'](_0x470e53+_0x86a4('0x48'),_0x267a53['id'][_0x86a4('0x42')]()))[_0x86a4('0x45')](_0x86a4('0x4d'),squel[_0x86a4('0x47')]()['field'](_0x86a4('0x22'))[_0x86a4('0x43')]('cm_hopper')[_0x86a4('0x45')](_0x470e53+'\x20=\x20?',_0x267a53['id']['toString']())))[_0x86a4('0x42')]();return _0x27cf15;};function _0x3b955d(_0x2ddeeb,_0x5d8d87){var _0x4647ff=squel['insert']()[_0x86a4('0x39')](_0x86a4('0x3a'))[_0x86a4('0x3b')]([_0x86a4('0x22'),'scheduledAt',_0x86a4('0x41'),_0x86a4('0x2a'),_0x5d8d87,_0x86a4('0x3d'),'updatedAt'],squel[_0x86a4('0x47')]()[_0x86a4('0x3f')](_0x86a4('0x22'),_0x86a4('0x22'))[_0x86a4('0x3f')](_0x86a4('0x40'),_0x86a4('0x3c'))[_0x86a4('0x3f')]('id',_0x86a4('0x41'))[_0x86a4('0x3f')](LISTID[_0x86a4('0x42')](),_0x86a4('0x2a'))['field'](_0x2ddeeb['id'][_0x86a4('0x42')](),_0x5d8d87)['field'](_0x86a4('0x40'),_0x86a4('0x3d'))['field']('NOW()',_0x86a4('0x3e'))[_0x86a4('0x43')](_0x86a4('0x44'))[_0x86a4('0x45')]('deletedAt\x20IS\x20NULL')[_0x86a4('0x45')](_0x86a4('0x49'),LISTID[_0x86a4('0x42')]())['where'](_0x86a4('0x4e'),squel[_0x86a4('0x4a')](hopperContacts))['where'](_0x86a4('0x4b')))[_0x86a4('0x42')]();return _0x4647ff;}function _0x1f0c00(_0x480e77,_0x286f83){var _0x380730=squel['insert']()[_0x86a4('0x39')]('cm_hopper_black')[_0x86a4('0x3b')](['phone',_0x86a4('0x41'),'ListId',_0x286f83,_0x86a4('0x3d'),_0x86a4('0x3e')],squel[_0x86a4('0x47')]()[_0x86a4('0x3f')](_0x86a4('0x22'),'phone')[_0x86a4('0x3f')]('id','ContactId')[_0x86a4('0x3f')](LISTID[_0x86a4('0x42')](),'ListId')['field'](_0x480e77['id']['toString'](),_0x286f83)[_0x86a4('0x3f')]('NOW()','createdAt')['field'](_0x86a4('0x40'),_0x86a4('0x3e'))[_0x86a4('0x43')](_0x86a4('0x44'))[_0x86a4('0x45')](_0x86a4('0x46'))[_0x86a4('0x45')](_0x86a4('0x49'),LISTID[_0x86a4('0x42')]())['where']('id\x20IN\x20?',squel[_0x86a4('0x4a')](hopperContacts))[_0x86a4('0x45')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x380730;}return db[_0x86a4('0x4f')][_0x86a4('0x50')]({'where':{'type':_0x86a4('0x51')},'attributes':['id',_0x86a4('0x52')],'include':[{'model':db[_0x86a4('0x53')],'as':_0x86a4('0x54'),'where':{'id':LISTID}}]})[_0x86a4('0x30')](function(_0x250c73){var _0x135358=[];if(_0x250c73){var _0x3d1948;for(var _0x3a34cc=0x0,_0x5275fe;_0x3a34cc<_0x250c73[_0x86a4('0x1b')];_0x3a34cc+=0x1){_0x5275fe=_0x250c73[_0x3a34cc]['get']({'plain':!![]});switch(_0x5275fe[_0x86a4('0x52')]){case _0x86a4('0x55'):_0x135358[_0x86a4('0x31')](db[_0x86a4('0x56')][_0x86a4('0x57')](_0x5ebac5(_0x5275fe,_0x86a4('0x58')))[_0x86a4('0x30')](function(){})[_0x86a4('0x33')](_0x450a78()));break;case _0x86a4('0x59'):_0x135358[_0x86a4('0x31')](db[_0x86a4('0x56')][_0x86a4('0x57')](_0x2b47e2(_0x5275fe,_0x86a4('0x58')))[_0x86a4('0x30')](function(){})[_0x86a4('0x33')](_0x450a78()));break;default:_0x135358[_0x86a4('0x31')](db[_0x86a4('0x56')][_0x86a4('0x57')](_0x3b955d(_0x5275fe,_0x86a4('0x58')))[_0x86a4('0x30')](function(){})[_0x86a4('0x33')](_0x450a78()));}}}return _0x135358;})[_0x86a4('0x5a')]()[_0x86a4('0x30')](function(){return db[_0x86a4('0x4f')][_0x86a4('0x50')]({'where':{'type':_0x86a4('0x51')},'attributes':['id'],'include':[{'model':db[_0x86a4('0x53')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x86a4('0x30')](function(_0x1503a4){var _0x5b00cf=[];if(_0x1503a4){var _0x1dd6f2;for(var _0x1efa9f=0x0,_0x3d968d;_0x1efa9f<_0x1503a4[_0x86a4('0x1b')];_0x1efa9f+=0x1){_0x3d968d=_0x1503a4[_0x1efa9f]['get']({'plain':!![]});_0x5b00cf[_0x86a4('0x31')](db[_0x86a4('0x56')][_0x86a4('0x57')](_0x1f0c00(_0x3d968d,_0x86a4('0x58')))[_0x86a4('0x30')](function(){})[_0x86a4('0x33')](_0x450a78()));}}return _0x5b00cf;})['all']();})[_0x86a4('0x30')](function(){return db[_0x86a4('0x5b')][_0x86a4('0x50')]({'attributes':['id',_0x86a4('0x52')],'include':[{'model':db['CmList'],'as':_0x86a4('0x54'),'where':{'id':LISTID}}]})[_0x86a4('0x30')](function(_0x24ff78){var _0x46ff43=[];if(_0x24ff78){for(var _0x1db861=0x0,_0x48d210;_0x1db861<_0x24ff78[_0x86a4('0x1b')];_0x1db861+=0x1){_0x48d210=_0x24ff78[_0x1db861][_0x86a4('0x5c')]({'plain':!![]});switch(_0x48d210[_0x86a4('0x52')]){case'always':_0x46ff43[_0x86a4('0x31')](db[_0x86a4('0x56')][_0x86a4('0x57')](_0x5ebac5(_0x48d210,'CampaignId'))[_0x86a4('0x30')](function(){})[_0x86a4('0x33')](_0x450a78()));break;case _0x86a4('0x59'):_0x46ff43[_0x86a4('0x31')](db[_0x86a4('0x56')][_0x86a4('0x57')](_0x2b47e2(_0x48d210,_0x86a4('0x5d')))['then'](function(){})['catch'](_0x450a78()));break;default:_0x46ff43[_0x86a4('0x31')](db[_0x86a4('0x56')]['query'](_0x3b955d(_0x48d210,_0x86a4('0x5d')))[_0x86a4('0x30')](function(){})[_0x86a4('0x33')](_0x450a78()));}}}return _0x46ff43;})[_0x86a4('0x5a')]();})[_0x86a4('0x30')](function(){return db['Campaign'][_0x86a4('0x50')]({'attributes':['id'],'include':[{'model':db[_0x86a4('0x53')],'as':_0x86a4('0x5e'),'where':{'id':LISTID}}]})[_0x86a4('0x30')](function(_0x8f48b){var _0x1f1220=[];if(_0x8f48b){for(var _0x57b568=0x0,_0x73ecd4;_0x57b568<_0x8f48b[_0x86a4('0x1b')];_0x57b568+=0x1){_0x73ecd4=_0x8f48b[_0x57b568][_0x86a4('0x5c')]({'plain':!![]});_0x1f1220[_0x86a4('0x31')](db['sequelize'][_0x86a4('0x57')](_0x1f0c00(_0x73ecd4,_0x86a4('0x5d')))['then'](function(){})[_0x86a4('0x33')](_0x450a78()));}}return _0x1f1220;})['all']();})[_0x86a4('0x33')](function(_0x1272c8){logger[_0x86a4('0x17')]('cmContact,\x20%s,\x20%s',_0x86a4('0x5f'),_0x1272c8['message']);});}var processPromises=function(_0x4a9f94){return BPromise[_0x86a4('0x5a')](promises)[_0x86a4('0x30')](function(_0x2ef5e8){})[_0x86a4('0x33')](function(_0x3f2c30){logger[_0x86a4('0x17')](_0x86a4('0x60'),JSON[_0x86a4('0x61')](_0x3f2c30));})['finally'](function(){socket[_0x86a4('0x62')](_0x86a4('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4a9f94){return _0x4a9f94['resume']();}});};var endCsv=function(){return BPromise[_0x86a4('0x64')]()['then'](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x86a4('0x62')](_0x86a4('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x86a4('0x65')](FILEPATH);}catch(_0xe2c8c1){logger[_0x86a4('0x17')](_0x86a4('0x66'),JSON['stringify'](_0xe2c8c1));}finally{process[_0x86a4('0x67')](0x0);}});};process['on'](_0x86a4('0x68'),function(){logger['info'](_0x86a4('0x69'));endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x86a4('0x14')](',');return db[_0x86a4('0x6a')][_0x86a4('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x23f082){var _0x32d580=fs[_0x86a4('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x86a4('0x6c')](_0x32d580,{'header':!![],'skipEmptyLines':!![],'step':function(_0x24c344,_0x52a002){total+=0x1;var _0xd904b3=total;promises[_0x86a4('0x31')](checkRow(_0x24c344,_0x23f082,_0xd904b3)[_0x86a4('0x30')](function(){success+=0x1;})[_0x86a4('0x33')](function(_0x1bc715){if(_0x1bc715[_0x86a4('0x17')]){errors+=0x1;delete _0x1bc715['error'];}else if(_0x1bc715[_0x86a4('0x2d')]){duplicates+=0x1;delete _0x1bc715['duplicate'];}rows['push'](_0x1bc715);}));if(total%0xc8===0x0){_0x52a002['pause']();return processPromises(_0x52a002);}},'complete':function(){return processPromises()[_0x86a4('0x30')](function(){logger['info'](_0x86a4('0x6d'));endCsv();});},'error':function(_0x50f8e7,_0x39767a){logger[_0x86a4('0x6e')](_0x86a4('0x6f'),JSON[_0x86a4('0x61')](_0x50f8e7));endCsv();}});})[_0x86a4('0x33')](function(_0xeb3df9){logger[_0x86a4('0x17')](_0x86a4('0x70'),JSON[_0x86a4('0x61')](_0xeb3df9));});}main(); \ No newline at end of file +var _0x254d=['resume','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','CSV\x20import\x20process\x20stopped!','split','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','bluebird','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','Missing\x20filepath\x20parameter!','undefined','null','Missing\x20binding\x20parameters!','zipObject','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','createdAt','select','field','NOW()','toString','from','cm_contacts','where','ListId\x20=\x20?','\x20=\x20?','fromQuery','updatedAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','VoiceQueueId','all','Campaign','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit'];(function(_0x1d47a4,_0x197d81){var _0x3a16d7=function(_0x256282){while(--_0x256282){_0x1d47a4['push'](_0x1d47a4['shift']());}};_0x3a16d7(++_0x197d81);}(_0x254d,0x82));var _0xd254=function(_0x4e90e3,_0x570a1d){_0x4e90e3=_0x4e90e3-0x0;var _0x295e5b=_0x254d[_0x4e90e3];return _0x295e5b;};'use strict';var BPromise=require(_0xd254('0x0'));var util=require('util');var _=require(_0xd254('0x1'));var fs=require('fs');var squel=require(_0xd254('0x2'));var Papa=require(_0xd254('0x3'));var Redis=require(_0xd254('0x4'));var db=require(_0xd254('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0xd254('0x6'))(_0xd254('0x7'));config[_0xd254('0x8')]=_[_0xd254('0x9')](config[_0xd254('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xd254('0xa'))(new Redis(config[_0xd254('0x8')]));require(_0xd254('0xb'))[_0xd254('0xc')](socket);try{if(!process[_0xd254('0xd')][0x2]||process[_0xd254('0xd')][0x2]==='undefined'||process['argv'][0x2]==='null'){throw new Error(_0xd254('0xe'));}var FILEPATH=process['argv'][0x2];if(!process[_0xd254('0xd')][0x3]||process[_0xd254('0xd')][0x3]===_0xd254('0xf')||process[_0xd254('0xd')][0x3]===_0xd254('0x10')||!process[_0xd254('0xd')][0x4]||process['argv'][0x4]===_0xd254('0xf')||process[_0xd254('0xd')][0x4]===_0xd254('0x10')){throw new Error(_0xd254('0x11'));}var FIELDS=_[_0xd254('0x12')](process[_0xd254('0xd')][0x3]['split'](','),process[_0xd254('0xd')][0x4]['split'](','));if(!process[_0xd254('0xd')][0x5]||process[_0xd254('0xd')][0x5]===_0xd254('0xf')||process[_0xd254('0xd')][0x5]===_0xd254('0x10')){throw new Error(_0xd254('0x13'));}var LISTID=process[_0xd254('0xd')][0x5];var COMPANYID=process[_0xd254('0xd')][0x6]&&process[_0xd254('0xd')][0x6]!==_0xd254('0xf')&&process['argv'][0x6]!==_0xd254('0x10')?process[_0xd254('0xd')][0x6]:null;var DUPLICATES=process[_0xd254('0xd')][0x7]&&process[_0xd254('0xd')][0x7]!=='undefined'&&process[_0xd254('0xd')][0x7]!==_0xd254('0x10')?process[_0xd254('0xd')][0x7]:null;if(!process[_0xd254('0xd')][0x8]||process['argv'][0x8]==='undefined'||process[_0xd254('0xd')][0x8]===_0xd254('0x10')){throw new Error(_0xd254('0x14'));}var SOCKET_TIMESTAMP=process[_0xd254('0xd')][0x8];}catch(_0x5769d5){logger['error'](_0x5769d5);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(_0x162a1c,_0x2df2fa,_0x597664,_0x41f3bf){var _0x184a2e={'message':_0x2df2fa};_0x184a2e[_0x162a1c]=!![];if(_0x597664){_0x184a2e[_0xd254('0x15')]=_0x597664;}if(_0x41f3bf){_0x184a2e[_0xd254('0x16')]=_0x41f3bf;}return _0x184a2e;}function isEmail(_0x4414b0){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))*$/[_0xd254('0x17')](_0x4414b0);}function checkRow(_0x1f7a47,_0x3b4d63,_0x881a4){return new BPromise(function(_0x368756,_0x23f71f){if(_[_0xd254('0x18')](_0x1f7a47)){return _0x23f71f(handleCheckRowError(_0xd254('0x19'),_0xd254('0x1a'),null,_0x881a4));}if(_0x1f7a47[_0xd254('0x1b')]&&_0x1f7a47['errors'][_0xd254('0x1c')]){var _0x149090=_[_0xd254('0x1d')](_0x1f7a47[_0xd254('0x1b')],_0xd254('0x1e'))[_0xd254('0x1f')](';');return _0x23f71f(handleCheckRowError(_0xd254('0x19'),_0x149090,null,_0x881a4));}var _0xe61990={};for(var _0x5eaecc in FIELDS){if(FIELDS[_0xd254('0x20')](_0x5eaecc)&&FIELDS[_0x5eaecc]){_0xe61990[_0x5eaecc]=_0x1f7a47[_0xd254('0x21')][0x0][FIELDS[_0x5eaecc]]||_0x1f7a47[_0xd254('0x21')][0x0]['\ufeff'+FIELDS[_0x5eaecc]];}}if(!_0xe61990[_0xd254('0x22')]){return _0x23f71f(handleCheckRowError(_0xd254('0x19'),_0xd254('0x23'),null,_0x881a4));}if(!_0xe61990['phone']){return _0x23f71f(handleCheckRowError(_0xd254('0x19'),_0xd254('0x24'),null,_0x881a4));}if(_0xe61990[_0xd254('0x25')]){var _0x37bc3e=moment(_0xe61990[_0xd254('0x25')],'YYYY-MM-DD');if(!_0x37bc3e[_0xd254('0x26')]()){return _0x23f71f(handleCheckRowError(_0xd254('0x19'),_0xd254('0x27'),null,_0x881a4));}}if(_0xe61990[_0xd254('0x28')]){if(!isEmail(_0xe61990[_0xd254('0x28')])){return _0x23f71f(handleCheckRowError(_0xd254('0x19'),_0xd254('0x29'),null,_0x881a4));}}_0xe61990['ListId']=LISTID;_0xe61990[_0xd254('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x3b4d63){var _0x23eba5={};for(var _0xe35a95=0x0,_0x5115fc=DUPLICATES[_0xd254('0x1c')];_0xe35a95<_0x5115fc;_0xe35a95+=0x1){_0x23eba5[DUPLICATES[_0xe35a95]]=_0xe61990[DUPLICATES[_0xe35a95]];}var _0x10d3a0=_[_0xd254('0x2b')](_0x3b4d63,_0x23eba5);if(_0x10d3a0){return _0x23f71f(handleCheckRowError(_0xd254('0x2c'),_0xd254('0x2d'),_0x10d3a0,_0x881a4));}}return db[_0xd254('0x2e')][_0xd254('0x2f')](_0xe61990,{'raw':!![],'hooks':![],'fields':_[_0xd254('0x30')](_0xe61990)})[_0xd254('0x31')](function(_0x1a0163){if(DUPLICATES&&DUPLICATES['length']&&_0x3b4d63){_0x3b4d63[_0xd254('0x32')](_[_0xd254('0x33')](_0xe61990,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1a0163['id'];return _0x368756();})[_0xd254('0x34')](function(_0x1766d2){return _0x23f71f(handleCheckRowError(_0xd254('0x19'),_0xd254('0x35')+(_0x1766d2['message']||JSON[_0xd254('0x36')](_0x1766d2)),null,_0x881a4));});});}function checkHopper(){function _0x13fd36(){return function(_0x59213b){logger[_0xd254('0x19')](_0xd254('0x37'),_0xd254('0x38'),util[_0xd254('0x39')](_0x59213b,{'showHidden':![],'depth':null}));};}var _0x3199af=function(_0x294124,_0x230716){var _0x1ae64a=squel[_0xd254('0x3a')]()[_0xd254('0x3b')](_0xd254('0x3c'))['fromQuery']([_0xd254('0x3d'),_0xd254('0x3e'),_0xd254('0x3f'),_0xd254('0x40'),_0x230716,_0xd254('0x41'),'updatedAt'],squel[_0xd254('0x42')]()[_0xd254('0x43')]('phone','phone')[_0xd254('0x43')](_0xd254('0x44'),_0xd254('0x3e'))['field']('id',_0xd254('0x3f'))[_0xd254('0x43')](LISTID[_0xd254('0x45')](),_0xd254('0x40'))[_0xd254('0x43')](_0x294124['id'][_0xd254('0x45')](),_0x230716)[_0xd254('0x43')]('NOW()','createdAt')[_0xd254('0x43')](_0xd254('0x44'),'updatedAt')[_0xd254('0x46')](_0xd254('0x47'))[_0xd254('0x48')]('deletedAt\x20IS\x20NULL')[_0xd254('0x48')](_0xd254('0x49'),LISTID[_0xd254('0x45')]())[_0xd254('0x48')]('phone\x20IS\x20NOT\x20NULL')[_0xd254('0x48')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xd254('0x3d'))['from'](_0xd254('0x3c'))[_0xd254('0x48')](_0x230716+_0xd254('0x4a'),_0x294124['id']['toString']())))[_0xd254('0x45')]();return _0x1ae64a;};var _0x3a3bc1=function(_0x1662e2,_0x30cea9){var _0x50c063=squel[_0xd254('0x3a')]()['into'](_0xd254('0x3c'))[_0xd254('0x4b')]([_0xd254('0x3d'),'scheduledAt',_0xd254('0x3f'),_0xd254('0x40'),_0x30cea9,_0xd254('0x41'),_0xd254('0x4c')],squel[_0xd254('0x42')]()['field'](_0xd254('0x3d'),_0xd254('0x3d'))['field'](_0xd254('0x44'),_0xd254('0x3e'))[_0xd254('0x43')]('id',_0xd254('0x3f'))[_0xd254('0x43')](LISTID['toString'](),_0xd254('0x40'))[_0xd254('0x43')](_0x1662e2['id']['toString'](),_0x30cea9)[_0xd254('0x43')](_0xd254('0x44'),_0xd254('0x41'))[_0xd254('0x43')]('NOW()',_0xd254('0x4c'))[_0xd254('0x46')](_0xd254('0x47'))[_0xd254('0x48')](_0xd254('0x4d'))['where'](_0xd254('0x49'),LISTID['toString']())[_0xd254('0x48')](_0xd254('0x4e'),squel[_0xd254('0x4f')](hopperContacts))[_0xd254('0x48')](_0xd254('0x50'))[_0xd254('0x48')](_0xd254('0x51'),squel[_0xd254('0x42')]()[_0xd254('0x43')](_0xd254('0x52'))['from'](_0xd254('0x53'))['where'](_0x30cea9+_0xd254('0x4a'),_0x1662e2['id'][_0xd254('0x45')]()))[_0xd254('0x48')](_0xd254('0x51'),squel[_0xd254('0x42')]()[_0xd254('0x43')](_0xd254('0x3d'))[_0xd254('0x46')](_0xd254('0x3c'))[_0xd254('0x48')](_0x30cea9+_0xd254('0x4a'),_0x1662e2['id'][_0xd254('0x45')]())))[_0xd254('0x45')]();return _0x50c063;};function _0x3892df(_0x4b7bcc,_0x5ed9e2){var _0xb1bc1f=squel[_0xd254('0x3a')]()[_0xd254('0x3b')]('cm_hopper')['fromQuery']([_0xd254('0x3d'),_0xd254('0x3e'),_0xd254('0x3f'),_0xd254('0x40'),_0x5ed9e2,_0xd254('0x41'),'updatedAt'],squel[_0xd254('0x42')]()[_0xd254('0x43')](_0xd254('0x3d'),_0xd254('0x3d'))[_0xd254('0x43')](_0xd254('0x44'),_0xd254('0x3e'))[_0xd254('0x43')]('id','ContactId')[_0xd254('0x43')](LISTID[_0xd254('0x45')](),'ListId')[_0xd254('0x43')](_0x4b7bcc['id'][_0xd254('0x45')](),_0x5ed9e2)[_0xd254('0x43')](_0xd254('0x44'),_0xd254('0x41'))[_0xd254('0x43')](_0xd254('0x44'),'updatedAt')['from']('cm_contacts')[_0xd254('0x48')](_0xd254('0x4d'))[_0xd254('0x48')](_0xd254('0x49'),LISTID['toString']())[_0xd254('0x48')]('id\x20IN\x20?',squel[_0xd254('0x4f')](hopperContacts))[_0xd254('0x48')](_0xd254('0x50')))[_0xd254('0x45')]();return _0xb1bc1f;}function _0x41db90(_0x5552f0,_0x4fc922){var _0x3b3d7b=squel[_0xd254('0x3a')]()['into'](_0xd254('0x54'))[_0xd254('0x4b')](['phone',_0xd254('0x3f'),_0xd254('0x40'),_0x4fc922,_0xd254('0x41'),_0xd254('0x4c')],squel[_0xd254('0x42')]()[_0xd254('0x43')]('phone','phone')['field']('id',_0xd254('0x3f'))[_0xd254('0x43')](LISTID['toString'](),'ListId')['field'](_0x5552f0['id']['toString'](),_0x4fc922)[_0xd254('0x43')](_0xd254('0x44'),_0xd254('0x41'))[_0xd254('0x43')]('NOW()',_0xd254('0x4c'))[_0xd254('0x46')]('cm_contacts')[_0xd254('0x48')](_0xd254('0x4d'))['where'](_0xd254('0x49'),LISTID[_0xd254('0x45')]())['where'](_0xd254('0x4e'),squel[_0xd254('0x4f')](hopperContacts))[_0xd254('0x48')](_0xd254('0x50')))['toString']();return _0x3b3d7b;}return db[_0xd254('0x55')][_0xd254('0x56')]({'where':{'type':_0xd254('0x57')},'attributes':['id',_0xd254('0x58')],'include':[{'model':db[_0xd254('0x59')],'as':_0xd254('0x5a'),'where':{'id':LISTID}}]})[_0xd254('0x31')](function(_0x46feaa){var _0x19e7a1=[];if(_0x46feaa){var _0x51f055;for(var _0x11726f=0x0,_0x1567d3;_0x11726f<_0x46feaa[_0xd254('0x1c')];_0x11726f+=0x1){_0x1567d3=_0x46feaa[_0x11726f][_0xd254('0x5b')]({'plain':!![]});switch(_0x1567d3[_0xd254('0x58')]){case _0xd254('0x5c'):_0x19e7a1[_0xd254('0x32')](db[_0xd254('0x5d')][_0xd254('0x5e')](_0x3a3bc1(_0x1567d3,'VoiceQueueId'))[_0xd254('0x31')](function(){})['catch'](_0x13fd36()));break;case'onlyIfOpen':_0x19e7a1[_0xd254('0x32')](db[_0xd254('0x5d')][_0xd254('0x5e')](_0x3199af(_0x1567d3,_0xd254('0x5f')))[_0xd254('0x31')](function(){})[_0xd254('0x34')](_0x13fd36()));break;default:_0x19e7a1[_0xd254('0x32')](db[_0xd254('0x5d')][_0xd254('0x5e')](_0x3892df(_0x1567d3,_0xd254('0x5f')))[_0xd254('0x31')](function(){})[_0xd254('0x34')](_0x13fd36()));}}}return _0x19e7a1;})[_0xd254('0x60')]()[_0xd254('0x31')](function(){return db[_0xd254('0x55')][_0xd254('0x56')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xd254('0x59')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x18066a){var _0xbd588b=[];if(_0x18066a){var _0x37d50d;for(var _0x4b55c5=0x0,_0x3407c6;_0x4b55c5<_0x18066a['length'];_0x4b55c5+=0x1){_0x3407c6=_0x18066a[_0x4b55c5]['get']({'plain':!![]});_0xbd588b['push'](db[_0xd254('0x5d')][_0xd254('0x5e')](_0x41db90(_0x3407c6,_0xd254('0x5f')))[_0xd254('0x31')](function(){})[_0xd254('0x34')](_0x13fd36()));}}return _0xbd588b;})[_0xd254('0x60')]();})['then'](function(){return db[_0xd254('0x61')][_0xd254('0x56')]({'attributes':['id',_0xd254('0x58')],'include':[{'model':db['CmList'],'as':_0xd254('0x5a'),'where':{'id':LISTID}}]})[_0xd254('0x31')](function(_0x1842d5){var _0x23e0a6=[];if(_0x1842d5){for(var _0x4c00fb=0x0,_0x1deada;_0x4c00fb<_0x1842d5[_0xd254('0x1c')];_0x4c00fb+=0x1){_0x1deada=_0x1842d5[_0x4c00fb]['get']({'plain':!![]});switch(_0x1deada['dialCheckDuplicateType']){case _0xd254('0x5c'):_0x23e0a6[_0xd254('0x32')](db[_0xd254('0x5d')]['query'](_0x3a3bc1(_0x1deada,_0xd254('0x62')))['then'](function(){})['catch'](_0x13fd36()));break;case _0xd254('0x63'):_0x23e0a6[_0xd254('0x32')](db['sequelize'][_0xd254('0x5e')](_0x3199af(_0x1deada,_0xd254('0x62')))[_0xd254('0x31')](function(){})[_0xd254('0x34')](_0x13fd36()));break;default:_0x23e0a6['push'](db['sequelize'][_0xd254('0x5e')](_0x3892df(_0x1deada,'CampaignId'))[_0xd254('0x31')](function(){})['catch'](_0x13fd36()));}}}return _0x23e0a6;})['all']();})[_0xd254('0x31')](function(){return db['Campaign']['findAll']({'attributes':['id'],'include':[{'model':db[_0xd254('0x59')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xd254('0x31')](function(_0x10c48f){var _0x3cf146=[];if(_0x10c48f){for(var _0x20c6d1=0x0,_0xa3833e;_0x20c6d1<_0x10c48f[_0xd254('0x1c')];_0x20c6d1+=0x1){_0xa3833e=_0x10c48f[_0x20c6d1][_0xd254('0x5b')]({'plain':!![]});_0x3cf146[_0xd254('0x32')](db[_0xd254('0x5d')]['query'](_0x41db90(_0xa3833e,_0xd254('0x62')))[_0xd254('0x31')](function(){})['catch'](_0x13fd36()));}}return _0x3cf146;})['all']();})[_0xd254('0x34')](function(_0x5bb929){logger['error'](_0xd254('0x64'),'generalCheckHopper',_0x5bb929[_0xd254('0x1e')]);});}var processPromises=function(_0x213018){return BPromise[_0xd254('0x60')](promises)[_0xd254('0x31')](function(_0x452f13){})[_0xd254('0x34')](function(_0x3a9521){logger[_0xd254('0x19')](_0xd254('0x65'),JSON[_0xd254('0x36')](_0x3a9521));})[_0xd254('0x66')](function(){socket[_0xd254('0x67')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x213018){return _0x213018[_0xd254('0x68')]();}});};var endCsv=function(){return BPromise[_0xd254('0x69')]()[_0xd254('0x31')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xd254('0x67')](_0xd254('0x6a')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xd254('0x6b')](FILEPATH);}catch(_0x57bf60){logger[_0xd254('0x19')](_0xd254('0x6c'),JSON['stringify'](_0x57bf60));}finally{process[_0xd254('0x6d')](0x0);}});};process['on']('SIGINT',function(){logger['info'](_0xd254('0x6e'));endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xd254('0x6f')](',');return db[_0xd254('0x2e')][_0xd254('0x56')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x414d08){var _0x43591d=fs[_0xd254('0x70')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xd254('0x71')](_0x43591d,{'header':!![],'skipEmptyLines':!![],'step':function(_0x144d19,_0x3c073e){total+=0x1;var _0x4e1f9f=total;promises[_0xd254('0x32')](checkRow(_0x144d19,_0x414d08,_0x4e1f9f)[_0xd254('0x31')](function(){success+=0x1;})[_0xd254('0x34')](function(_0x41f176){if(_0x41f176[_0xd254('0x19')]){errors+=0x1;delete _0x41f176[_0xd254('0x19')];}else if(_0x41f176[_0xd254('0x2c')]){duplicates+=0x1;delete _0x41f176[_0xd254('0x2c')];}rows[_0xd254('0x32')](_0x41f176);}));if(total%0xc8===0x0){_0x3c073e[_0xd254('0x72')]();return processPromises(_0x3c073e);}},'complete':function(){return processPromises()['then'](function(){logger[_0xd254('0x73')](_0xd254('0x74'));endCsv();});},'error':function(_0x361f81,_0x36f261){logger[_0xd254('0x73')]('CSV\x20parse\x20error',JSON[_0xd254('0x36')](_0x361f81));endCsv();}});})['catch'](function(_0x3f2d7d){logger[_0xd254('0x19')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xd254('0x36')](_0x3f2d7d));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 79d2750..a30e89d 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 _0x8d59=['timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','name','_description','AdditionalPhones','header','writeFileSync','parse','createReadStream','rows','errors','find','hasOwnProperty','data','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','agent\x20not\x20exists','email','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','description','SystemRow','appendFileSync','Abort\x20parser','abort','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','voice_queues_','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',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','orderBy','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns','campaigns_has_cm_blacklists','CampaignId','finish','affectedRows','emit','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','then','length','split','push','all','filter','CmContactHasItem','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','insert','into','cm_hopper','fromQuery','ListId','createdAt','updatedAt','priority','UserId','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','ContactId','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','cm_contacts.UserId','scheduledat','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId='];(function(_0x3446c8,_0x5d9075){var _0x376277=function(_0x575679){while(--_0x575679){_0x3446c8['push'](_0x3446c8['shift']());}};_0x376277(++_0x5d9075);}(_0x8d59,0x109));var _0x98d5=function(_0x4c117f,_0x4ff1f8){_0x4c117f=_0x4c117f-0x0;var _0xb5884e=_0x8d59[_0x4c117f];return _0xb5884e;};'use strict';var fs=require('fs');var path=require(_0x98d5('0x0'));var _=require(_0x98d5('0x1'));var Papa=require(_0x98d5('0x2'));var util=require(_0x98d5('0x3'));var BPromise=require(_0x98d5('0x4'));var moment=require(_0x98d5('0x5'));var squel=require(_0x98d5('0x6'));var Redis=require(_0x98d5('0x7'));var db=require(_0x98d5('0x8'))['db'];var config=require(_0x98d5('0x9'));var shared=require(_0x98d5('0xa'));var logger=require(_0x98d5('0xb'))(_0x98d5('0xc'));config[_0x98d5('0xd')]=_[_0x98d5('0xe')](config[_0x98d5('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x98d5('0xf'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x98d5('0x10')](_0x98d5('0x11'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x98d5('0x10')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x22e118){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))*$/[_0x98d5('0x12')](_0x22e118);}function selectNotIn(_0x5c888a,_0x2550af,_0x49777b,_0x2d6fee,_0x44f410){return squel['select']()[_0x98d5('0x13')](_0x98d5('0x14'))[_0x98d5('0x15')](_0x2d6fee)[_0x98d5('0x16')](_0x2550af,null,_0x2550af+_0x98d5('0x17')+_0x2d6fee+'.'+_0x49777b)[_0x98d5('0x18')](_0x2d6fee+'.'+_0x49777b+_0x98d5('0x19')+_0x5c888a+'.'+_0x49777b)[_0x98d5('0x18')](_0x2550af+_0x98d5('0x1a')+_0x44f410[_0x98d5('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x39982f,_0x276638){promisesAdditionalPhones=[];return db[_0x98d5('0x1b')][_0x98d5('0x1c')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x98d5('0x1d')](function(_0x488681){if(_0x488681!==null){var _0x81ce96=[];for(var _0x1203a0=0x0;_0x1203a0<_0x488681[_0x98d5('0x1e')];_0x1203a0++){var _0x1bd366=_0x488681[_0x1203a0];_0x81ce96['push'](insertAdditionalPhones(_0x1bd366));}}Promise['all'](_0x81ce96)[_0x98d5('0x1d')](function(){_0x39982f({'val':0x1});});});});}function insertAdditionalPhones(_0x204c86){return new Promise(function(_0x1a0a12,_0x2ad619){var _0x36e6e7=_0x204c86['AdditionalPhones'];var _0x12c8c3=_0x36e6e7[_0x98d5('0x1f')](';');var _0x128adc=[];orderBy=0x0;for(var _0x3326eb=0x0;_0x3326eb<_0x12c8c3[_0x98d5('0x1e')];_0x3326eb++){_0x128adc[_0x98d5('0x20')](splitAdditionalPhone(_0x204c86['id'],_0x12c8c3[_0x3326eb]));}Promise[_0x98d5('0x21')](_0x128adc)[_0x98d5('0x1d')](function(){_0x1a0a12({'val':_0x12c8c3[_0x98d5('0x1e')]});});});}function splitAdditionalPhone(_0x3fb6e0,_0x4f4d0f){return new Promise(function(_0x15f4a2,_0x16108f){var _0x195941=_0x4f4d0f[_0x98d5('0x1f')](':');var _0x23144f=_0x195941[0x0];var _0x596a4f=_0x195941[0x1];if(!_['isNil'](_0x596a4f)){var _0x240da8=_0x596a4f['split']('|');var _0x13a3f6=[];for(var _0xc7128=0x0;_0xc7128<_0x240da8[_0x98d5('0x1e')];_0xc7128++){if(_0x240da8[_0xc7128]!==''){var _0x32b861=_[_0x98d5('0x22')](promisesAdditionalPhones,{'contactId':_0x3fb6e0,'phone':_0x240da8[_0xc7128]});if(_0x32b861[_0x98d5('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0x98d5('0x20')]({'contactId':_0x3fb6e0,'contactTypeId':_0x23144f,'phone':_0x240da8[_0xc7128],'orderBy':orderBy});}}}_0x15f4a2({'ok':0x1});}else _0x15f4a2({'res':0x0});});}function createAdditionalPhone(_0x545b75,_0x1e4f65,_0x198293,_0x288504){var _0x24b04f='';var _0x2445b6='';var _0x289e60=_0x198293['split']('§');_0x24b04f=_0x289e60[0x0];if(_0x289e60[_0x98d5('0x1e')]==0x2)_0x2445b6=_0x289e60[0x1];return new Promise(function(_0xcb0753,_0x2d8886){return db[_0x98d5('0x23')]['findOne']({'where':{'CmContactId':_0x545b75,'item':_0x24b04f}})[_0x98d5('0x1d')](function(_0x22e8c1){if(_0x22e8c1){return db[_0x98d5('0x23')]['update']({'ItemTypeId':_0x1e4f65,'description':_0x2445b6,'OrderBy':_0x288504},{'where':{'CmContactId':_0x545b75,'item':_0x24b04f}})[_0x98d5('0x1d')](function(_0x14464b){_0xcb0753({'res':_0x98d5('0x24')});});}else{return db[_0x98d5('0x23')][_0x98d5('0x25')]({'CmContactId':_0x545b75,'item':_0x24b04f,'description':_0x2445b6,'ItemTypeId':_0x1e4f65,'OrderBy':_0x288504,'ItemClass':_0x98d5('0x26')})[_0x98d5('0x1d')](function(_0xfac947){_0xcb0753({'res':_0x98d5('0x27')});});}});});}function insertCmHopper(_0x4df78f,_0x15377b,_0x1028ae,_0x41762d,_0x23210f){var _0x1a01a1=[_0x98d5('0x28'),_0x98d5('0x29'),_0x98d5('0x2a'),_0x98d5('0x2b'),_0x15377b+'.'+_0x41762d,_0x98d5('0x2c'),_0x98d5('0x2d'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x23210f+'\x22'];return squel[_0x98d5('0x2e')]()[_0x98d5('0x2f')](_0x98d5('0x30'))[_0x98d5('0x31')]([_0x98d5('0x14'),'scheduledat','ContactId',_0x98d5('0x32'),_0x41762d,_0x98d5('0x33'),_0x98d5('0x34'),_0x98d5('0x35'),_0x98d5('0x36'),_0x98d5('0x37')],squel[_0x98d5('0x38')]()[_0x98d5('0x39')](_0x1a01a1)[_0x98d5('0x15')](_0x15377b)[_0x98d5('0x16')](_0x98d5('0x3a'),null,_0x98d5('0x3b')+_0x15377b+_0x98d5('0x3c'))[_0x98d5('0x16')](_0x1028ae,null,_0x1028ae+_0x98d5('0x17')+_0x15377b+'.'+_0x41762d)[_0x98d5('0x18')](_0x15377b+_0x98d5('0x3d'),_0x4df78f)[_0x98d5('0x18')](_0x98d5('0x3e'),NOW)[_0x98d5('0x18')](_0x98d5('0x3f'),selectNotIn(_0x15377b,_0x1028ae,_0x41762d,'cm_hopper',[_0x98d5('0x40'),_0x98d5('0x41')]))['where'](_0x98d5('0x3f'),selectNotIn(_0x15377b,_0x1028ae,_0x41762d,_0x98d5('0x30'),[_0x98d5('0x40')])))[_0x98d5('0x42')]();}function insertCmHopperBlack(_0x5598e2,_0x5b78da,_0xc4cbdc,_0x59fe5e){var _0x315d71=[_0x98d5('0x28'),'cm_contacts.id',_0x98d5('0x2b'),_0x5b78da+'.'+_0x59fe5e,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x98d5('0x2e')]()[_0x98d5('0x2f')](_0x98d5('0x43'))[_0x98d5('0x31')](['phone',_0x98d5('0x44'),_0x98d5('0x32'),_0x59fe5e,'createdAt','updatedAt'],squel[_0x98d5('0x38')]()[_0x98d5('0x39')](_0x315d71)['from'](_0x5b78da)[_0x98d5('0x16')](_0x98d5('0x3a'),null,_0x98d5('0x3b')+_0x5b78da+_0x98d5('0x3c'))[_0x98d5('0x16')](_0xc4cbdc,null,_0xc4cbdc+_0x98d5('0x17')+_0x5b78da+'.'+_0x59fe5e)[_0x98d5('0x18')](_0x5b78da+_0x98d5('0x3d'),_0x5598e2)[_0x98d5('0x18')](_0x98d5('0x3e'),NOW)['where'](_0x98d5('0x3f'),squel[_0x98d5('0x38')]()[_0x98d5('0x13')](_0x98d5('0x14'))[_0x98d5('0x15')](_0x98d5('0x43'))[_0x98d5('0x18')](_0x98d5('0x45'),_0x5598e2)['where'](_0x59fe5e+_0x98d5('0x19')+_0x5b78da+'.'+_0x59fe5e)))[_0x98d5('0x42')]();}function insertTzCmHopper(_0x3ef2de,_0x44723f,_0x1af928,_0x4e127f,_0x2c560a,_0x33df92){var _0x31d854=[_0x98d5('0x28'),_0x98d5('0x46')+_0x33df92+_0x98d5('0x47'),_0x98d5('0x2a'),_0x98d5('0x2b'),_0x44723f+'.'+_0x4e127f,'cm_contacts.createdAt',_0x98d5('0x2d'),_0x98d5('0x48'),_0x98d5('0x49'),'\x22'+_0x2c560a+'\x22'];var _0x469847=squel['insert']()[_0x98d5('0x2f')]('cm_hopper')['fromQuery']([_0x98d5('0x14'),_0x98d5('0x4a'),_0x98d5('0x44'),_0x98d5('0x32'),_0x4e127f,_0x98d5('0x33'),_0x98d5('0x34'),_0x98d5('0x35'),'UserId',_0x98d5('0x37')],squel[_0x98d5('0x38')]()[_0x98d5('0x39')](_0x31d854)[_0x98d5('0x15')](_0x44723f)[_0x98d5('0x16')](_0x98d5('0x3a'),null,_0x98d5('0x3b')+_0x44723f+_0x98d5('0x3c'))[_0x98d5('0x16')](_0x1af928,null,_0x1af928+_0x98d5('0x17')+_0x44723f+'.'+_0x4e127f)[_0x98d5('0x16')](_0x33df92,null,_0x33df92+_0x98d5('0x17')+_0x44723f+'.'+_0x4e127f)[_0x98d5('0x18')](_0x44723f+'.CmListId\x20=\x20?',_0x3ef2de)[_0x98d5('0x18')](_0x98d5('0x3e'),NOW)['where'](_0x98d5('0x3f'),selectNotIn(_0x44723f,_0x1af928,_0x4e127f,_0x98d5('0x30'),[_0x98d5('0x40'),'\x22onlyIfOpen\x22']))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x44723f,_0x1af928,_0x4e127f,'cm_hopper',[_0x98d5('0x40')])))[_0x98d5('0x42')]();return _0x469847;}function insertTzCmHopperBlack(_0x334e37,_0x44ea03,_0x1e9dbd,_0x4046cd){var _0x40f826=[_0x98d5('0x28'),_0x98d5('0x2a'),_0x98d5('0x2b'),_0x44ea03+'.'+_0x4046cd,'cm_contacts.createdAt',_0x98d5('0x2d')];return squel[_0x98d5('0x2e')]()['into'](_0x98d5('0x43'))[_0x98d5('0x31')]([_0x98d5('0x14'),_0x98d5('0x44'),_0x98d5('0x32'),_0x4046cd,_0x98d5('0x33'),_0x98d5('0x34')],squel[_0x98d5('0x38')]()[_0x98d5('0x39')](_0x40f826)[_0x98d5('0x15')](_0x44ea03)[_0x98d5('0x16')](_0x98d5('0x3a'),null,_0x98d5('0x3b')+_0x44ea03+_0x98d5('0x3c'))[_0x98d5('0x16')](_0x1e9dbd,null,_0x1e9dbd+_0x98d5('0x17')+_0x44ea03+'.'+_0x4046cd)[_0x98d5('0x18')](_0x44ea03+_0x98d5('0x3d'),_0x334e37)[_0x98d5('0x18')](_0x98d5('0x3e'),NOW)['where'](_0x98d5('0x3f'),squel[_0x98d5('0x38')]()['field'](_0x98d5('0x14'))['from']('cm_hopper_black')['where']('ListId\x20=\x20?',_0x334e37)['where'](_0x4046cd+'\x20=\x20'+_0x44ea03+'.'+_0x4046cd)))[_0x98d5('0x42')]();}function insertCmHopperAdditionalPhones(_0x1483b1){var _0x2c39a1=[_0x98d5('0x4b'),_0x98d5('0x4c'),_0x98d5('0x4d'),_0x98d5('0x4e'),_0x98d5('0x4f')];return squel['insert']()[_0x98d5('0x2f')](_0x98d5('0x50'))[_0x98d5('0x31')](['CmHopperId',_0x98d5('0x14'),_0x98d5('0x51'),_0x98d5('0x33'),_0x98d5('0x34')],squel['select']()[_0x98d5('0x39')](_0x2c39a1)[_0x98d5('0x15')](_0x98d5('0x30'))[_0x98d5('0x16')](_0x98d5('0x3a'),null,_0x98d5('0x52'))[_0x98d5('0x16')](_0x98d5('0x53'),null,_0x98d5('0x54'))[_0x98d5('0x18')](_0x98d5('0x55'),_0x1483b1)[_0x98d5('0x18')](_0x98d5('0x3e'),NOW))[_0x98d5('0x42')]();}function insertCmContact(_0x1602b9,_0x2e1b0b,_0x5a57e9,_0x2c8ec6){var _0x4cf9ea=_[_0x98d5('0x56')](_[_0x98d5('0x57')](_0x2c8ec6),['ListId',_0x98d5('0x58'),'createdAt',_0x98d5('0x34')]);return squel['insert']()[_0x98d5('0x2f')](_0x98d5('0x3a'))[_0x98d5('0x31')](_0x4cf9ea,squel[_0x98d5('0x38')]()[_0x98d5('0x39')](_0x4cf9ea)[_0x98d5('0x15')](_0x2e1b0b)['where']('('+_0x5a57e9[_0x98d5('0x16')](',')+_0x98d5('0x59'),squel[_0x98d5('0x38')]()[_0x98d5('0x39')](_0x5a57e9)['from']('cm_contacts')['where'](_0x98d5('0x45'),_0x1602b9)['where'](_0x98d5('0x5a')))[_0x98d5('0x18')](_0x98d5('0x5b'),squel[_0x98d5('0x38')]()[_0x98d5('0x13')](_0x98d5('0x5c'),_0x98d5('0x5d'))[_0x98d5('0x15')](_0x2e1b0b)[_0x98d5('0x5e')](_0x5a57e9[_0x98d5('0x16')](','))))[_0x98d5('0x42')]();}function handleStop(){logger[_0x98d5('0x5f')](_0x98d5('0x60'));stopped=!![];}function handleUncaughtException(_0x1ec972){logger[_0x98d5('0x61')](_0x1ec972[_0x98d5('0x62')]);process[_0x98d5('0x63')](0x1);}function handleError(_0x325d8e,_0x1b3dfd){stats['errors'][_0x98d5('0x20')]({'name':_0x1b3dfd[_0x98d5('0x64')],'message':_0x1b3dfd['message'],'row':_0x325d8e});}function handleQuery(_0x5dfbc5){logger[_0x98d5('0x5f')](_0x5dfbc5);return db[_0x98d5('0x65')][_0x98d5('0x66')](_0x5dfbc5)[_0x98d5('0x67')](function(_0x3e5569){results[_0x98d5('0x20')](_0x3e5569);})[_0x98d5('0x68')](function(_0x1702ef){logger[_0x98d5('0x61')](_0x1702ef[_0x98d5('0x62')]);});}function updateTzCampaigns(_0x3eb626){return new Promise(function(_0x8b8f21,_0x3bf5f6){var _0x345753=squel['select']()['fields']([_0x98d5('0x69'),_0x98d5('0x6a')])['from']('campaigns')[_0x98d5('0x16')](_0x98d5('0x6b'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')['where'](_0x98d5('0x6c')+_0x3eb626);db['sequelize'][_0x98d5('0x66')](_0x345753[_0x98d5('0x42')]())[_0x98d5('0x67')](function(_0x4a7e48){var _0xebcb2b=[];for(var _0x1b72d1=0x0;_0x1b72d1<_0x4a7e48['length'];_0x1b72d1++){_0xebcb2b['push'](getTimezoneData(_0x4a7e48[_0x1b72d1],tmp_campaigns));}BPromise[_0x98d5('0x21')](_0xebcb2b)['then'](function(){_0x8b8f21({'val':0x1});});})[_0x98d5('0x68')](function(_0x1e18d6){logger[_0x98d5('0x61')](_0x1e18d6[_0x98d5('0x62')]);_0x8b8f21({'val':0x0});});});}function updateTzVoiceQueues(_0x55695f){return new Promise(function(_0x53d6c8,_0x5a99f4){var _0x548756=squel['select']()[_0x98d5('0x39')]([_0x98d5('0x6d'),_0x98d5('0x6e')])[_0x98d5('0x15')]('voice_queues')[_0x98d5('0x16')]('voice_queues_has_cm_lists',null,_0x98d5('0x6f'))['where'](_0x98d5('0x70')+_0x55695f);db[_0x98d5('0x65')][_0x98d5('0x66')](_0x548756['toString']())[_0x98d5('0x67')](function(_0x3fc1c3){var _0x5bc250=[];for(var _0x16cf25=0x0;_0x16cf25<_0x3fc1c3[_0x98d5('0x1e')];_0x16cf25++){_0x5bc250['push'](getTimezoneData(_0x3fc1c3[_0x16cf25],tmp_voice_queues));}BPromise['all'](_0x5bc250)[_0x98d5('0x1d')](function(){_0x53d6c8({'val':0x1});});})['catch'](function(_0xae25c2){logger[_0x98d5('0x61')](_0xae25c2[_0x98d5('0x62')]);_0x53d6c8({'val':0x0});});});}function getTimezoneData(_0x40fbf7,_0x170674){return new Promise(function(_0x2fdd5c,_0x3c7a1e){var _0x2c53b6=shared[_0x98d5('0x71')];var _0x2eb730=_0x2c53b6[_0x40fbf7[_0x98d5('0x72')]];if(_[_0x98d5('0x73')](_0x2eb730)){_0x2fdd5c({'ret':0x1});}else{var _0x34c53d=_0x2eb730[_0x98d5('0x74')];var _0x45926e=squel['insert']()['into'](_0x170674)[_0x98d5('0x75')]('id',_0x40fbf7['id'])[_0x98d5('0x75')](_0x98d5('0x76'),_0x34c53d)[_0x98d5('0x75')](_0x98d5('0x72'),_0x40fbf7['dialTimezone'])[_0x98d5('0x42')]();return db[_0x98d5('0x65')][_0x98d5('0x66')](_0x45926e)[_0x98d5('0x67')](function(_0x4a3aae){_0x2fdd5c({'ret':0x1});})[_0x98d5('0x68')](function(_0x4015bc){logger['error'](_0x4015bc[_0x98d5('0x62')]);_0x3c7a1e({'ret':0x1});});}});}function handleTZQuery(_0x3c5381){logger['info'](_0x3c5381);return db[_0x98d5('0x65')][_0x98d5('0x66')](_0x3c5381)['spread'](function(_0x581e76){})['catch'](function(_0x115059){logger[_0x98d5('0x61')](_0x115059['message']);});}function main(_0x243f3e,_0x3b31c6,_0x2d94f8,_0x247c0c){logger[_0x98d5('0x5f')](_0x98d5('0x77'),_0x243f3e,JSON[_0x98d5('0x78')](_0x3b31c6));process[_0x98d5('0x79')](_0x98d5('0x7a'));var _0x1c8a69=_0x3b31c6[_0x98d5('0x7b')];var _0x22f382=_[_0x98d5('0x7c')](_0x1c8a69);var _0x4df0dc=_0x3b31c6[_0x98d5('0x7d')];var _0x41dacc=path[_0x98d5('0x16')](config[_0x98d5('0x7e')],_0x98d5('0x7f'),_0x4df0dc+_0x98d5('0x80'));hasTZ=_['keys'](_0x1c8a69)['includes'](_0x98d5('0x72'));var _0x4801ec=_[_0x98d5('0x57')](_0x1c8a69)[_0x98d5('0x16')]();logger['info']('header',_0x4801ec);db['ContactItemType'][_0x98d5('0x1c')]({'raw':!![],'attributes':['id','name']})[_0x98d5('0x1d')](function(_0x404891){for(var _0x117a2b=0x0;_0x117a2b<_0x404891[_0x98d5('0x1e')];_0x117a2b++){if(_0x404891[_0x117a2b]['name']in _0x1c8a69){contactItemTypes[_0x98d5('0x20')](_0x404891[_0x117a2b]);delete _0x22f382[_0x404891[_0x117a2b][_0x98d5('0x81')]];hasAdditionalPhones=!![];}for(var _0x52adc9 in _0x1c8a69){if(_0x404891[_0x117a2b][_0x98d5('0x81')]+_0x98d5('0x82')===_0x52adc9){phoneDescriptions[_0x98d5('0x20')]({'itemTypeId':_0x404891[_0x117a2b]['id'],'description':_0x52adc9});delete _0x22f382[_0x52adc9];}}}if(hasAdditionalPhones)_0x22f382[_0x98d5('0x83')]='';var _0x546c92=_[_0x98d5('0x57')](_0x22f382)[_0x98d5('0x16')]();logger['info'](_0x98d5('0x84'),_0x546c92);fs[_0x98d5('0x85')](_0x41dacc,_0x546c92+'\x0a');Papa[_0x98d5('0x86')](fs[_0x98d5('0x87')](_0x243f3e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2643e9,_0x2a85ae){try{for(var _0x3665af=0x0,_0x32d9bd=[];_0x3665af<_0x2643e9['data'][_0x98d5('0x1e')];_0x3665af++){stats[_0x98d5('0x88')]+=0x1;if(_0x2643e9[_0x98d5('0x89')][_0x3665af]){handleError(_0x2643e9['data'][_0x3665af],_0x2643e9['errors'][_0x3665af]);}else{var _0x1ff41a=[];var _0x56f129=[];var _0x3a9100={};for(var _0x2b14e1 in _0x1c8a69){let _0x2e68b5=contactItemTypes[_0x98d5('0x8a')](_0x4f578b=>_0x4f578b[_0x98d5('0x81')]===_0x2b14e1);let _0x3ee913=contactItemTypes[_0x98d5('0x8a')](_0x57fd5f=>_0x57fd5f[_0x98d5('0x81')]+_0x98d5('0x82')===_0x2b14e1);if(_[_0x98d5('0x73')](_0x2e68b5)&&_[_0x98d5('0x73')](_0x3ee913)){if(_0x1c8a69[_0x98d5('0x8b')](_0x2b14e1)){if(_0x2643e9[_0x98d5('0x8c')][_0x3665af][_0x1c8a69[_0x2b14e1]]){var _0x135656=_[_0x98d5('0x8d')](_0x2643e9[_0x98d5('0x8c')][_0x3665af][_0x1c8a69[_0x2b14e1]][_0x98d5('0x8e')](/"/g,'\x27'));switch(_0x2b14e1){case _0x98d5('0x4a'):var _0x5ae036=moment(_0x135656,_0x98d5('0x11'),!![]);if(_0x5ae036[_0x98d5('0x8f')]()){_0x32d9bd['push']('\x22'+_0x135656+'\x22');}else{_0x1ff41a[_0x98d5('0x20')](_0x98d5('0x90'));}break;case _0x98d5('0x35'):var _0x5c3210=parseInt(_0x135656);_0x135656=_['isNaN'](_0x5c3210)||_0x5c3210<0x0||_0x5c3210>0x4?_0x247c0c?0x3:0x2:_0x5c3210;_0x32d9bd[_0x98d5('0x20')]('\x22'+_0x135656+'\x22');break;case _0x98d5('0x36'):var _0x53478b=parseInt(_0x135656);if(_[_0x98d5('0x91')](_0x53478b)&&_['includes'](_0x2d94f8,_0x53478b)){_0x32d9bd[_0x98d5('0x20')]('\x22'+_0x53478b+'\x22');}else{_0x1ff41a[_0x98d5('0x20')](_0x98d5('0x92'));}break;case _0x98d5('0x93'):if(isEmail(_0x135656)){_0x32d9bd[_0x98d5('0x20')]('\x22'+_0x135656+'\x22');}else{_0x1ff41a['push']('email\x20wrong\x20format');}break;case _0x98d5('0x94'):var _0x2ad99f=moment(_0x135656,'YYYY-MM-DD',!![]);if(_0x2ad99f[_0x98d5('0x8f')]()){_0x32d9bd['push']('\x22'+_0x135656+'\x22');}else{_0x1ff41a[_0x98d5('0x20')](_0x98d5('0x95'));}break;case _0x98d5('0x72'):var _0x4e54b4=shared[_0x98d5('0x71')];var _0x19b641=_0x4e54b4[_0x135656];if(!_[_0x98d5('0x73')](_0x19b641)){var _0x2120fa=_0x19b641[_0x98d5('0x74')];_0x32d9bd[_0x98d5('0x20')]('\x22'+_0x135656+'\x22');_0x32d9bd[_0x98d5('0x20')]('\x22'+_0x2120fa+'\x22');}break;default:_0x32d9bd[_0x98d5('0x20')]('\x22'+_0x135656+'\x22');}}else{switch(_0x2b14e1){case _0x98d5('0x96'):case _0x98d5('0x14'):_0x1ff41a[_0x98d5('0x20')](_0x2b14e1+'\x20not\x20specified');break;default:_0x32d9bd[_0x98d5('0x20')]('\x22\x22');}}}}else{var _0x190ae4='';if(!_[_0x98d5('0x73')](_0x2e68b5)){if(!_0x3a9100['hasOwnProperty'](_0x2e68b5['id'])){if(!_['isNil'](_0x2643e9['data'][_0x3665af][_0x1c8a69[_0x2b14e1]])){var _0x135656=_['trim'](_0x2643e9[_0x98d5('0x8c')][_0x3665af][_0x1c8a69[_0x2b14e1]][_0x98d5('0x8e')](/"/g,'\x27'));var _0x4a96c6=phoneDescriptions[_0x98d5('0x8a')](_0x4ca4d5=>_0x4ca4d5['itemTypeId']===_0x2e68b5['id']);if(!_[_0x98d5('0x73')](_0x4a96c6)){var _0x1a12dd=_[_0x98d5('0x8d')](_0x2643e9[_0x98d5('0x8c')][_0x3665af][_0x1c8a69[_0x4a96c6[_0x98d5('0x97')]]][_0x98d5('0x8e')](/"/g,'\x27'));if(!_['isNil'](_0x1a12dd))_0x135656=_0x135656+'§'+_0x1a12dd;}if(_0x190ae4=='')_0x190ae4=_0x135656;else _0x190ae4+='|'+_0x135656;}_0x56f129[_0x98d5('0x20')](_0x2e68b5['id']+':'+_0x190ae4);_0x3a9100[_0x2e68b5['id']]=0x1;}}}}if(hasAdditionalPhones){_0x32d9bd[_0x98d5('0x20')]('\x22'+_0x56f129[_0x98d5('0x16')](';')+'\x22');}if(_0x1ff41a[_0x98d5('0x1e')]){handleError(_0x2643e9[_0x98d5('0x8c')][_0x3665af],{'code':_0x98d5('0x98'),'message':_0x1ff41a[_0x98d5('0x16')]()});}else{fs[_0x98d5('0x99')](_0x41dacc,_0x32d9bd[_0x98d5('0x16')]()+'\x0a');}_0x32d9bd=[];}if(!(stats[_0x98d5('0x88')]%0xc8)){socket['emit']('contact:import:'+_0x4df0dc,stats);stats[_0x98d5('0x89')]=[];}}if(stopped){logger[_0x98d5('0x5f')](_0x98d5('0x9a'));_0x2a85ae[_0x98d5('0x9b')]();}}catch(_0xc782bf){handleError(_0x2643e9[_0x98d5('0x8c')][_0x3665af],{'code':'SystemError','message':_0xc782bf[_0x98d5('0x62')]});logger[_0x98d5('0x61')](_0x98d5('0x9c'),_0xc782bf[_0x98d5('0x62')]);}},'complete':function(){try{var _0x549bee=[];var _0x769703=[];var _0x5795d8=_0x98d5('0x3a');if(_0x3b31c6[_0x98d5('0x9d')]&&_0x3b31c6[_0x98d5('0x9d')][_0x98d5('0x1e')]){_0x5795d8='cm_contacts_'+_0x4df0dc;_0x549bee[_0x98d5('0x20')](_0x98d5('0x9e')+_0x5795d8+_0x98d5('0x9f'));}tmp_campaigns='campaigns_'+_0x4df0dc;tmp_voice_queues=_0x98d5('0xa0')+_0x4df0dc;_0x769703[_0x98d5('0x20')](_0x98d5('0x9e')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x769703[_0x98d5('0x20')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x98d5('0xa1')](_0x769703,handleTZQuery)['then'](function(_0x3d208d){updateTzCampaigns(_0x3b31c6[_0x98d5('0x32')])[_0x98d5('0x1d')](function(_0x5e9ca9){updateTzVoiceQueues(_0x3b31c6[_0x98d5('0x32')])[_0x98d5('0x1d')](function(_0x14464d){if(hasTZ)_0x546c92=_0x546c92[_0x98d5('0x8e')](_0x98d5('0x72'),_0x98d5('0xa2'));var _0x4fdc61=util[_0x98d5('0x10')](_0x98d5('0xa3'),_0x41dacc,_0x5795d8,_0x546c92,_0x3b31c6['ListId'],_0x3b31c6[_0x98d5('0x58')]||null,NOW,NOW);if(_['isNil'](_0x1c8a69[_0x98d5('0x4a')])){_0x4fdc61+=_0x98d5('0xa4');}_0x549bee['push'](_0x4fdc61);if(_0x3b31c6['duplicates']&&_0x3b31c6[_0x98d5('0x9d')][_0x98d5('0x1e')]){_0x549bee[_0x98d5('0x20')](insertCmContact(_0x3b31c6['ListId'],_0x5795d8,_0x3b31c6[_0x98d5('0x9d')],_0x1c8a69));_0x549bee[_0x98d5('0x20')](_0x98d5('0xa5')+_0x5795d8+';');}BPromise['each'](_0x549bee,handleQuery)['then'](function(_0x1ef7a5){BPromise[_0x98d5('0x21')]([handleAdditionalPhones()])[_0x98d5('0x1d')](function(){_0x549bee=[];for(var _0x45535d=0x0;_0x45535d\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','SIGINT','path','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','join','.id\x20=\x20','where','CmContact','findAll','AdditionalPhones','length','push','all','then','split','isNil','CmContactHasItem','update','updated','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_hopper','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_contacts.createdAt','into','cm_hopper_black','from','.CmListId\x20=\x20?','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.id','cm_contacts.ListId\x20=\x20','cm_contacts.phone','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','OrderBy','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','error','message','exit','errors','sequelize','query','spread','catch','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_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','set','offset','main','stringify','send','start','binding','socket_timestamp','root','.csv','includes','keys','header','ContactItemType','name','_description','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)'];(function(_0x3572e9,_0x445f82){var _0x7076af=function(_0x1cc6ca){while(--_0x1cc6ca){_0x3572e9['push'](_0x3572e9['shift']());}};_0x7076af(++_0x445f82);}(_0x6366,0x198));var _0x6636=function(_0x23e03e,_0x130544){_0x23e03e=_0x23e03e-0x0;var _0x28056a=_0x6366[_0x23e03e];return _0x28056a;};'use strict';var fs=require('fs');var path=require(_0x6636('0x0'));var _=require(_0x6636('0x1'));var Papa=require(_0x6636('0x2'));var util=require('util');var BPromise=require(_0x6636('0x3'));var moment=require(_0x6636('0x4'));var squel=require(_0x6636('0x5'));var Redis=require(_0x6636('0x6'));var db=require(_0x6636('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0x6636('0x8'));var logger=require(_0x6636('0x9'))('import');config[_0x6636('0xa')]=_['defaults'](config['redis'],{'host':_0x6636('0xb'),'port':0x18eb});var socket=require(_0x6636('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x6636('0xd')](_0x6636('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x6636('0xd')](_0x6636('0xe'));function isEmail(_0x4247a3){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'](_0x4247a3);}function selectNotIn(_0x9304c1,_0x402125,_0x4a0bc5,_0x2ee7b2,_0xeb879c){return squel[_0x6636('0xf')]()[_0x6636('0x10')](_0x6636('0x11'))['from'](_0x2ee7b2)[_0x6636('0x12')](_0x402125,null,_0x402125+_0x6636('0x13')+_0x2ee7b2+'.'+_0x4a0bc5)[_0x6636('0x14')](_0x2ee7b2+'.'+_0x4a0bc5+'\x20=\x20'+_0x9304c1+'.'+_0x4a0bc5)['where'](_0x402125+'.dialCheckDuplicateType\x20IN\x20('+_0xeb879c[_0x6636('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5bee5b,_0x56f6b0){promisesAdditionalPhones=[];return db[_0x6636('0x15')][_0x6636('0x16')]({'raw':!![],'attributes':['id',_0x6636('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x1fe2ca){if(_0x1fe2ca!==null){var _0x42decd=[];for(var _0x1f2c0e=0x0;_0x1f2c0e<_0x1fe2ca[_0x6636('0x18')];_0x1f2c0e++){var _0x259e63=_0x1fe2ca[_0x1f2c0e];_0x42decd[_0x6636('0x19')](insertAdditionalPhones(_0x259e63));}}Promise[_0x6636('0x1a')](_0x42decd)['then'](function(){_0x5bee5b({'val':0x1});});});});}function insertAdditionalPhones(_0x3a6ea2){return new Promise(function(_0x27d4bf,_0x4dd7a2){var _0x26c5a8=_0x3a6ea2[_0x6636('0x17')];var _0x1a0b74=_0x26c5a8['split'](';');var _0x44c4aa=[];orderBy=0x0;for(var _0x4dff5c=0x0;_0x4dff5c<_0x1a0b74['length'];_0x4dff5c++){_0x44c4aa[_0x6636('0x19')](splitAdditionalPhone(_0x3a6ea2['id'],_0x1a0b74[_0x4dff5c]));}Promise[_0x6636('0x1a')](_0x44c4aa)[_0x6636('0x1b')](function(){_0x27d4bf({'val':_0x1a0b74[_0x6636('0x18')]});});});}function splitAdditionalPhone(_0x2652a8,_0x3b9ce1){return new Promise(function(_0x36805a,_0x5a39f5){var _0x20e3d2=_0x3b9ce1[_0x6636('0x1c')](':');var _0x3ab28e=_0x20e3d2[0x0];var _0x5b345e=_0x20e3d2[0x1];if(!_[_0x6636('0x1d')](_0x5b345e)){var _0x26fff9=_0x5b345e[_0x6636('0x1c')]('|');var _0xdb501f=[];for(var _0x340c1a=0x0;_0x340c1a<_0x26fff9[_0x6636('0x18')];_0x340c1a++){if(_0x26fff9[_0x340c1a]!==''){var _0x41a9c6=_['filter'](promisesAdditionalPhones,{'contactId':_0x2652a8,'phone':_0x26fff9[_0x340c1a]});if(_0x41a9c6[_0x6636('0x18')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x2652a8,'contactTypeId':_0x3ab28e,'phone':_0x26fff9[_0x340c1a],'orderBy':orderBy});}}}_0x36805a({'ok':0x1});}else _0x36805a({'res':0x0});});}function createAdditionalPhone(_0x4cbf8b,_0x504097,_0x245208,_0x274dbd){var _0x471f8b='';var _0x375360='';var _0x305338=_0x245208[_0x6636('0x1c')]('§');_0x471f8b=_0x305338[0x0];if(_0x305338['length']==0x2)_0x375360=_0x305338[0x1];return new Promise(function(_0x5997ba,_0x2c6307){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x4cbf8b,'item':_0x471f8b}})[_0x6636('0x1b')](function(_0x1ccd40){if(_0x1ccd40){return db[_0x6636('0x1e')][_0x6636('0x1f')]({'ItemTypeId':_0x504097,'description':_0x375360,'OrderBy':_0x274dbd},{'where':{'CmContactId':_0x4cbf8b,'item':_0x471f8b}})['then'](function(_0x258fce){_0x5997ba({'res':_0x6636('0x20')});});}else{return db[_0x6636('0x1e')]['create']({'CmContactId':_0x4cbf8b,'item':_0x471f8b,'description':_0x375360,'ItemTypeId':_0x504097,'OrderBy':_0x274dbd,'ItemClass':'PHONE'})['then'](function(_0x36ebb3){_0x5997ba({'res':'inserted'});});}});});}function insertCmHopper(_0x4f9bd5,_0x26b39c,_0x1f12b0,_0x1334a7,_0xfd97ea){var _0x18b5ce=['cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId',_0x26b39c+'.'+_0x1334a7,'cm_contacts.createdAt',_0x6636('0x21'),_0x6636('0x22'),_0x6636('0x23'),'\x22'+_0xfd97ea+'\x22'];return squel[_0x6636('0x24')]()['into']('cm_hopper')[_0x6636('0x25')]([_0x6636('0x11'),_0x6636('0x26'),_0x6636('0x27'),_0x6636('0x28'),_0x1334a7,_0x6636('0x29'),_0x6636('0x2a'),_0x6636('0x2b'),_0x6636('0x2c'),_0x6636('0x2d')],squel['select']()[_0x6636('0x2e')](_0x18b5ce)['from'](_0x26b39c)['join'](_0x6636('0x2f'),null,'cm_contacts.ListId\x20=\x20'+_0x26b39c+_0x6636('0x30'))[_0x6636('0x12')](_0x1f12b0,null,_0x1f12b0+_0x6636('0x13')+_0x26b39c+'.'+_0x1334a7)[_0x6636('0x14')](_0x26b39c+'.CmListId\x20=\x20?',_0x4f9bd5)[_0x6636('0x14')](_0x6636('0x31'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x26b39c,_0x1f12b0,_0x1334a7,_0x6636('0x32'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0x6636('0x14')](_0x6636('0x33'),selectNotIn(_0x26b39c,_0x1f12b0,_0x1334a7,_0x6636('0x32'),[_0x6636('0x34')])))[_0x6636('0x35')]();}function insertCmHopperBlack(_0x280383,_0x3810b5,_0x3fe030,_0x5013a3){var _0x47a526=['cm_contacts.phone','cm_contacts.id',_0x6636('0x36'),_0x3810b5+'.'+_0x5013a3,_0x6636('0x37'),_0x6636('0x21')];return squel[_0x6636('0x24')]()[_0x6636('0x38')](_0x6636('0x39'))['fromQuery']([_0x6636('0x11'),'ContactId','ListId',_0x5013a3,_0x6636('0x29'),_0x6636('0x2a')],squel['select']()[_0x6636('0x2e')](_0x47a526)[_0x6636('0x3a')](_0x3810b5)[_0x6636('0x12')](_0x6636('0x2f'),null,'cm_contacts.ListId\x20=\x20'+_0x3810b5+'.CmListId')[_0x6636('0x12')](_0x3fe030,null,_0x3fe030+_0x6636('0x13')+_0x3810b5+'.'+_0x5013a3)['where'](_0x3810b5+_0x6636('0x3b'),_0x280383)[_0x6636('0x14')](_0x6636('0x31'),NOW)['where'](_0x6636('0x33'),squel[_0x6636('0xf')]()['field'](_0x6636('0x11'))['from'](_0x6636('0x39'))[_0x6636('0x14')](_0x6636('0x3c'),_0x280383)[_0x6636('0x14')](_0x5013a3+'\x20=\x20'+_0x3810b5+'.'+_0x5013a3)))['toString']();}function insertTzCmHopper(_0x4692a0,_0x57cdac,_0x236a61,_0x52a6ec,_0x2f8565,_0x9ae971){var _0x26520e=['cm_contacts.phone',_0x6636('0x3d')+_0x9ae971+_0x6636('0x3e'),_0x6636('0x3f'),'cm_contacts.ListId',_0x57cdac+'.'+_0x52a6ec,_0x6636('0x37'),_0x6636('0x21'),'cm_contacts.priority',_0x6636('0x23'),'\x22'+_0x2f8565+'\x22'];var _0x31ce2f=squel[_0x6636('0x24')]()[_0x6636('0x38')](_0x6636('0x32'))['fromQuery']([_0x6636('0x11'),_0x6636('0x26'),_0x6636('0x27'),_0x6636('0x28'),_0x52a6ec,'createdAt',_0x6636('0x2a'),_0x6636('0x2b'),_0x6636('0x2c'),_0x6636('0x2d')],squel['select']()[_0x6636('0x2e')](_0x26520e)[_0x6636('0x3a')](_0x57cdac)[_0x6636('0x12')]('cm_contacts',null,_0x6636('0x40')+_0x57cdac+_0x6636('0x30'))[_0x6636('0x12')](_0x236a61,null,_0x236a61+_0x6636('0x13')+_0x57cdac+'.'+_0x52a6ec)[_0x6636('0x12')](_0x9ae971,null,_0x9ae971+_0x6636('0x13')+_0x57cdac+'.'+_0x52a6ec)[_0x6636('0x14')](_0x57cdac+_0x6636('0x3b'),_0x4692a0)[_0x6636('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x6636('0x14')](_0x6636('0x33'),selectNotIn(_0x57cdac,_0x236a61,_0x52a6ec,'cm_hopper',[_0x6636('0x34'),'\x22onlyIfOpen\x22']))[_0x6636('0x14')](_0x6636('0x33'),selectNotIn(_0x57cdac,_0x236a61,_0x52a6ec,'cm_hopper',[_0x6636('0x34')])))[_0x6636('0x35')]();return _0x31ce2f;}function insertTzCmHopperBlack(_0x51820b,_0x18a5bc,_0x2bcbc5,_0x70ca59){var _0x2a70dc=[_0x6636('0x41'),_0x6636('0x3f'),_0x6636('0x36'),_0x18a5bc+'.'+_0x70ca59,_0x6636('0x37'),_0x6636('0x21')];return squel['insert']()['into']('cm_hopper_black')[_0x6636('0x25')]([_0x6636('0x11'),_0x6636('0x27'),_0x6636('0x28'),_0x70ca59,_0x6636('0x29'),_0x6636('0x2a')],squel[_0x6636('0xf')]()[_0x6636('0x2e')](_0x2a70dc)[_0x6636('0x3a')](_0x18a5bc)[_0x6636('0x12')](_0x6636('0x2f'),null,_0x6636('0x40')+_0x18a5bc+'.CmListId')['join'](_0x2bcbc5,null,_0x2bcbc5+_0x6636('0x13')+_0x18a5bc+'.'+_0x70ca59)[_0x6636('0x14')](_0x18a5bc+'.CmListId\x20=\x20?',_0x51820b)[_0x6636('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x6636('0x14')](_0x6636('0x33'),squel['select']()[_0x6636('0x10')](_0x6636('0x11'))[_0x6636('0x3a')](_0x6636('0x39'))[_0x6636('0x14')]('ListId\x20=\x20?',_0x51820b)['where'](_0x70ca59+'\x20=\x20'+_0x18a5bc+'.'+_0x70ca59)))[_0x6636('0x35')]();}function insertCmHopperAdditionalPhones(_0xd581fa){var _0x5b1cce=[_0x6636('0x42'),_0x6636('0x43'),_0x6636('0x44'),_0x6636('0x45'),_0x6636('0x46')];return squel[_0x6636('0x24')]()[_0x6636('0x38')]('cm_hopper_additional_phones')['fromQuery'](['CmHopperId',_0x6636('0x11'),_0x6636('0x47'),_0x6636('0x29'),'updatedAt'],squel['select']()[_0x6636('0x2e')](_0x5b1cce)[_0x6636('0x3a')](_0x6636('0x32'))['join'](_0x6636('0x2f'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x6636('0x12')](_0x6636('0x48'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where'](_0x6636('0x49'),_0xd581fa)[_0x6636('0x14')](_0x6636('0x31'),NOW))[_0x6636('0x35')]();}function insertCmContact(_0x3d88ce,_0x13b8b2,_0x5c0d33,_0x542251){var _0x4de5f4=_[_0x6636('0x4a')](_['keys'](_0x542251),[_0x6636('0x28'),'CompanyId',_0x6636('0x29'),_0x6636('0x2a')]);return squel[_0x6636('0x24')]()[_0x6636('0x38')](_0x6636('0x2f'))['fromQuery'](_0x4de5f4,squel[_0x6636('0xf')]()[_0x6636('0x2e')](_0x4de5f4)[_0x6636('0x3a')](_0x13b8b2)[_0x6636('0x14')]('('+_0x5c0d33[_0x6636('0x12')](',')+_0x6636('0x4b'),squel[_0x6636('0xf')]()[_0x6636('0x2e')](_0x5c0d33)[_0x6636('0x3a')](_0x6636('0x2f'))['where'](_0x6636('0x3c'),_0x3d88ce)[_0x6636('0x14')](_0x6636('0x4c')))['where'](_0x6636('0x4d'),squel['select']()[_0x6636('0x10')](_0x6636('0x4e'),_0x6636('0x4f'))[_0x6636('0x3a')](_0x13b8b2)[_0x6636('0x50')](_0x5c0d33[_0x6636('0x12')](','))))[_0x6636('0x35')]();}function handleStop(){logger[_0x6636('0x51')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x214b09){logger[_0x6636('0x52')](_0x214b09[_0x6636('0x53')]);process[_0x6636('0x54')](0x1);}function handleError(_0x4e48a5,_0x518845){stats[_0x6636('0x55')]['push']({'name':_0x518845['code'],'message':_0x518845[_0x6636('0x53')],'row':_0x4e48a5});}function handleQuery(_0x28d3e7){logger['info'](_0x28d3e7);return db[_0x6636('0x56')][_0x6636('0x57')](_0x28d3e7)[_0x6636('0x58')](function(_0x47e0f8){results[_0x6636('0x19')](_0x47e0f8);})[_0x6636('0x59')](function(_0x1c2f4f){logger['error'](_0x1c2f4f[_0x6636('0x53')]);});}function updateTzCampaigns(_0x3de2df){return new Promise(function(_0x392b97,_0x508bec){var _0x35fd3b=squel[_0x6636('0xf')]()[_0x6636('0x2e')](['campaigns.id',_0x6636('0x5a')])[_0x6636('0x3a')](_0x6636('0x5b'))[_0x6636('0x12')](_0x6636('0x5c'),null,_0x6636('0x5d'))[_0x6636('0x14')](_0x6636('0x5e')+_0x3de2df);db[_0x6636('0x56')][_0x6636('0x57')](_0x35fd3b['toString']())['spread'](function(_0x43c5d5){var _0x19d58a=[];for(var _0x393e0f=0x0;_0x393e0f<_0x43c5d5[_0x6636('0x18')];_0x393e0f++){_0x19d58a[_0x6636('0x19')](getTimezoneData(_0x43c5d5[_0x393e0f],tmp_campaigns));}BPromise[_0x6636('0x1a')](_0x19d58a)[_0x6636('0x1b')](function(){_0x392b97({'val':0x1});});})[_0x6636('0x59')](function(_0x24c5c1){logger['error'](_0x24c5c1[_0x6636('0x53')]);_0x392b97({'val':0x0});});});}function updateTzVoiceQueues(_0x33f596){return new Promise(function(_0x1b901e,_0x2e9101){var _0x501f8b=squel[_0x6636('0xf')]()[_0x6636('0x2e')]([_0x6636('0x5f'),_0x6636('0x60')])['from']('voice_queues')[_0x6636('0x12')](_0x6636('0x61'),null,_0x6636('0x62'))['where']('voice_queues_has_cm_lists.CmListId='+_0x33f596);db[_0x6636('0x56')]['query'](_0x501f8b[_0x6636('0x35')]())[_0x6636('0x58')](function(_0x3695bd){var _0x46dce8=[];for(var _0x323224=0x0;_0x323224<_0x3695bd[_0x6636('0x18')];_0x323224++){_0x46dce8['push'](getTimezoneData(_0x3695bd[_0x323224],tmp_voice_queues));}BPromise[_0x6636('0x1a')](_0x46dce8)[_0x6636('0x1b')](function(){_0x1b901e({'val':0x1});});})['catch'](function(_0x18129a){logger['error'](_0x18129a[_0x6636('0x53')]);_0x1b901e({'val':0x0});});});}function getTimezoneData(_0x6ce8b0,_0x1a151b){return new Promise(function(_0x2554be,_0x544cbd){var _0x3e1fea=shared[_0x6636('0x63')];var _0x29e426=_0x3e1fea[_0x6ce8b0[_0x6636('0x64')]];if(_[_0x6636('0x1d')](_0x29e426)){_0x2554be({'ret':0x1});}else{var _0x4fdf64=_0x29e426['utcOffset'];var _0x3605b9=squel[_0x6636('0x24')]()[_0x6636('0x38')](_0x1a151b)[_0x6636('0x65')]('id',_0x6ce8b0['id'])['set'](_0x6636('0x66'),_0x4fdf64)[_0x6636('0x65')]('dialTimezone',_0x6ce8b0[_0x6636('0x64')])[_0x6636('0x35')]();return db[_0x6636('0x56')][_0x6636('0x57')](_0x3605b9)['spread'](function(_0x503dcb){_0x2554be({'ret':0x1});})[_0x6636('0x59')](function(_0xe5eb92){logger[_0x6636('0x52')](_0xe5eb92[_0x6636('0x53')]);_0x544cbd({'ret':0x1});});}});}function handleTZQuery(_0x45873e){logger[_0x6636('0x51')](_0x45873e);return db[_0x6636('0x56')][_0x6636('0x57')](_0x45873e)[_0x6636('0x58')](function(_0x23cc40){})[_0x6636('0x59')](function(_0x36f3c4){logger[_0x6636('0x52')](_0x36f3c4['message']);});}function main(_0x43feb5,_0x1a27e2,_0x3e19b8,_0x2d32b8){logger[_0x6636('0x51')](_0x6636('0x67'),_0x43feb5,JSON[_0x6636('0x68')](_0x1a27e2));process[_0x6636('0x69')](_0x6636('0x6a'));var _0x5d15e9=_0x1a27e2[_0x6636('0x6b')];var _0x486155=_['clone'](_0x5d15e9);var _0x1f170b=_0x1a27e2[_0x6636('0x6c')];var _0x49bc01=path[_0x6636('0x12')](config[_0x6636('0x6d')],'server/files/tmp',_0x1f170b+_0x6636('0x6e'));hasTZ=_['keys'](_0x5d15e9)[_0x6636('0x6f')](_0x6636('0x64'));var _0x3efdbb=_[_0x6636('0x70')](_0x5d15e9)[_0x6636('0x12')]();logger['info'](_0x6636('0x71'),_0x3efdbb);db[_0x6636('0x72')][_0x6636('0x16')]({'raw':!![],'attributes':['id',_0x6636('0x73')]})[_0x6636('0x1b')](function(_0x31f4c3){for(var _0x32e97e=0x0;_0x32e97e<_0x31f4c3[_0x6636('0x18')];_0x32e97e++){if(_0x31f4c3[_0x32e97e][_0x6636('0x73')]in _0x5d15e9){contactItemTypes[_0x6636('0x19')](_0x31f4c3[_0x32e97e]);delete _0x486155[_0x31f4c3[_0x32e97e][_0x6636('0x73')]];hasAdditionalPhones=!![];}for(var _0x1d597e in _0x5d15e9){if(_0x31f4c3[_0x32e97e]['name']+_0x6636('0x74')===_0x1d597e){phoneDescriptions[_0x6636('0x19')]({'itemTypeId':_0x31f4c3[_0x32e97e]['id'],'description':_0x1d597e});delete _0x486155[_0x1d597e];}}}if(hasAdditionalPhones)_0x486155['AdditionalPhones']='';var _0x575d16=_[_0x6636('0x70')](_0x486155)[_0x6636('0x12')]();logger[_0x6636('0x51')](_0x6636('0x71'),_0x575d16);fs[_0x6636('0x75')](_0x49bc01,_0x575d16+'\x0a');Papa[_0x6636('0x76')](fs[_0x6636('0x77')](_0x43feb5),{'header':!![],'skipEmptyLines':!![],'step':function(_0x48ceed,_0x2e4919){try{for(var _0x526ec4=0x0,_0x24a5b6=[];_0x526ec4<_0x48ceed[_0x6636('0x78')][_0x6636('0x18')];_0x526ec4++){stats[_0x6636('0x79')]+=0x1;if(_0x48ceed['errors'][_0x526ec4]){handleError(_0x48ceed['data'][_0x526ec4],_0x48ceed[_0x6636('0x55')][_0x526ec4]);}else{var _0x539860=[];var _0xdace83=[];var _0x4030f6={};for(var _0x48c910 in _0x5d15e9){let _0x5a18f0=contactItemTypes[_0x6636('0x7a')](_0x292887=>_0x292887[_0x6636('0x73')]===_0x48c910);let _0x18b3c6=contactItemTypes[_0x6636('0x7a')](_0x281425=>_0x281425[_0x6636('0x73')]+_0x6636('0x74')===_0x48c910);if(_[_0x6636('0x1d')](_0x5a18f0)&&_[_0x6636('0x1d')](_0x18b3c6)){if(_0x5d15e9[_0x6636('0x7b')](_0x48c910)){if(_0x48ceed[_0x6636('0x78')][_0x526ec4][_0x5d15e9[_0x48c910]]){var _0xea521b=_[_0x6636('0x7c')](_0x48ceed[_0x6636('0x78')][_0x526ec4][_0x5d15e9[_0x48c910]]['replace'](/"/g,'\x27'));switch(_0x48c910){case _0x6636('0x26'):var _0x3e9a9d=moment(_0xea521b,_0x6636('0xe'),!![]);if(_0x3e9a9d['isValid']()){_0x24a5b6[_0x6636('0x19')]('\x22'+_0xea521b+'\x22');}else{_0x539860['push'](_0x6636('0x7d'));}break;case _0x6636('0x2b'):var _0x397805=parseInt(_0xea521b);_0xea521b=_['isNaN'](_0x397805)||_0x397805<0x0||_0x397805>0x4?_0x2d32b8?0x3:0x2:_0x397805;_0x24a5b6[_0x6636('0x19')]('\x22'+_0xea521b+'\x22');break;case _0x6636('0x2c'):var _0x2cd65f=parseInt(_0xea521b);if(_[_0x6636('0x7e')](_0x2cd65f)&&_[_0x6636('0x6f')](_0x3e19b8,_0x2cd65f)){_0x24a5b6[_0x6636('0x19')]('\x22'+_0x2cd65f+'\x22');}else{_0x539860['push'](_0x6636('0x7f'));}break;case _0x6636('0x80'):if(isEmail(_0xea521b)){_0x24a5b6[_0x6636('0x19')]('\x22'+_0xea521b+'\x22');}else{_0x539860[_0x6636('0x19')]('email\x20wrong\x20format');}break;case _0x6636('0x81'):var _0x198286=moment(_0xea521b,_0x6636('0x82'),!![]);if(_0x198286['isValid']()){_0x24a5b6[_0x6636('0x19')]('\x22'+_0xea521b+'\x22');}else{_0x539860[_0x6636('0x19')](_0x6636('0x83'));}break;case _0x6636('0x64'):var _0x5b38d2=shared['timezones'];var _0x43e777=_0x5b38d2[_0xea521b];if(!_['isNil'](_0x43e777)){var _0x81232e=_0x43e777['utcOffset'];_0x24a5b6[_0x6636('0x19')]('\x22'+_0xea521b+'\x22');_0x24a5b6['push']('\x22'+_0x81232e+'\x22');}break;default:_0x24a5b6['push']('\x22'+_0xea521b+'\x22');}}else{switch(_0x48c910){case _0x6636('0x84'):case _0x6636('0x11'):_0x539860[_0x6636('0x19')](_0x48c910+_0x6636('0x85'));break;default:_0x24a5b6['push']('\x22\x22');}}}}else{var _0x5ef3bf='';if(!_['isNil'](_0x5a18f0)){if(!_0x4030f6[_0x6636('0x7b')](_0x5a18f0['id'])){if(!_[_0x6636('0x1d')](_0x48ceed[_0x6636('0x78')][_0x526ec4][_0x5d15e9[_0x48c910]])){var _0xea521b=_['trim'](_0x48ceed['data'][_0x526ec4][_0x5d15e9[_0x48c910]][_0x6636('0x86')](/"/g,'\x27'));var _0x976a2d=phoneDescriptions['find'](_0x20976b=>_0x20976b[_0x6636('0x87')]===_0x5a18f0['id']);if(!_['isNil'](_0x976a2d)){var _0x6f0e74=_[_0x6636('0x7c')](_0x48ceed['data'][_0x526ec4][_0x5d15e9[_0x976a2d[_0x6636('0x88')]]]['replace'](/"/g,'\x27'));if(!_[_0x6636('0x1d')](_0x6f0e74))_0xea521b=_0xea521b+'§'+_0x6f0e74;}if(_0x5ef3bf=='')_0x5ef3bf=_0xea521b;else _0x5ef3bf+='|'+_0xea521b;}_0xdace83['push'](_0x5a18f0['id']+':'+_0x5ef3bf);_0x4030f6[_0x5a18f0['id']]=0x1;}}}}if(hasAdditionalPhones){_0x24a5b6[_0x6636('0x19')]('\x22'+_0xdace83[_0x6636('0x12')](';')+'\x22');}if(_0x539860[_0x6636('0x18')]){handleError(_0x48ceed['data'][_0x526ec4],{'code':_0x6636('0x89'),'message':_0x539860[_0x6636('0x12')]()});}else{fs[_0x6636('0x8a')](_0x49bc01,_0x24a5b6['join']()+'\x0a');}_0x24a5b6=[];}if(!(stats[_0x6636('0x79')]%0xc8)){socket[_0x6636('0x8b')](_0x6636('0x8c')+_0x1f170b,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x6636('0x8d'));_0x2e4919[_0x6636('0x8e')]();}}catch(_0x499659){handleError(_0x48ceed['data'][_0x526ec4],{'code':_0x6636('0x8f'),'message':_0x499659[_0x6636('0x53')]});logger[_0x6636('0x52')](_0x6636('0x90'),_0x499659[_0x6636('0x53')]);}},'complete':function(){try{var _0x7ecaf3=[];var _0x127b8b=[];var _0x1638cb='cm_contacts';if(_0x1a27e2[_0x6636('0x91')]&&_0x1a27e2[_0x6636('0x91')][_0x6636('0x18')]){_0x1638cb=_0x6636('0x92')+_0x1f170b;_0x7ecaf3[_0x6636('0x19')](_0x6636('0x93')+_0x1638cb+_0x6636('0x94'));}tmp_campaigns=_0x6636('0x95')+_0x1f170b;tmp_voice_queues=_0x6636('0x96')+_0x1f170b;_0x127b8b[_0x6636('0x19')](_0x6636('0x93')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x127b8b[_0x6636('0x19')](_0x6636('0x93')+tmp_voice_queues+_0x6636('0x97'));BPromise[_0x6636('0x98')](_0x127b8b,handleTZQuery)[_0x6636('0x1b')](function(_0x17f731){updateTzCampaigns(_0x1a27e2['ListId'])[_0x6636('0x1b')](function(_0xdb21ac){updateTzVoiceQueues(_0x1a27e2[_0x6636('0x28')])[_0x6636('0x1b')](function(_0x2673b7){if(hasTZ)_0x575d16=_0x575d16[_0x6636('0x86')](_0x6636('0x64'),_0x6636('0x99'));var _0x88ba7e=util[_0x6636('0xd')](_0x6636('0x9a'),_0x49bc01,_0x1638cb,_0x575d16,_0x1a27e2['ListId'],_0x1a27e2[_0x6636('0x9b')]||null,NOW,NOW);if(_[_0x6636('0x1d')](_0x5d15e9['scheduledat'])){_0x88ba7e+=_0x6636('0x9c');}_0x7ecaf3[_0x6636('0x19')](_0x88ba7e);if(_0x1a27e2[_0x6636('0x91')]&&_0x1a27e2[_0x6636('0x91')][_0x6636('0x18')]){_0x7ecaf3[_0x6636('0x19')](insertCmContact(_0x1a27e2[_0x6636('0x28')],_0x1638cb,_0x1a27e2['duplicates'],_0x5d15e9));_0x7ecaf3[_0x6636('0x19')](_0x6636('0x9d')+_0x1638cb+';');}BPromise[_0x6636('0x98')](_0x7ecaf3,handleQuery)[_0x6636('0x1b')](function(_0x35b794){BPromise['all']([handleAdditionalPhones()])[_0x6636('0x1b')](function(){_0x7ecaf3=[];for(var _0xc96e30=0x0;_0xc96e30_0x57aa22[_0xc988('0x67')]===_0xba26fb);let _0x12472e=contactItemTypes[_0xc988('0x6e')](_0x29a1e1=>_0x29a1e1[_0xc988('0x67')]+_0xc988('0x6f')===_0xba26fb);if(_[_0xc988('0x18')](_0x1ee899)&&_[_0xc988('0x18')](_0x12472e)){if(_0x5d0704['hasOwnProperty'](_0xba26fb)){if(_0x1736dd[_0xc988('0x6d')][_0x470575][_0x5d0704[_0xba26fb]]){var _0x9d3177=_[_0xc988('0x70')](_0x1736dd[_0xc988('0x6d')][_0x470575][_0x5d0704[_0xba26fb]][_0xc988('0x71')](/"/g,'\x27'));switch(_0xba26fb){case _0xc988('0x31'):var _0x5c4653=moment(_0x9d3177,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x5c4653[_0xc988('0x72')]()){_0x375b89['push']('\x22'+_0x9d3177+'\x22');}else{_0x4e9560[_0xc988('0x1a')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xc988('0x73'):var _0x3af287=parseInt(_0x9d3177);_0x9d3177=_[_0xc988('0x74')](_0x3af287)||_0x3af287<0x0||_0x3af287>0x4?_0x4347ba?0x3:0x2:_0x3af287;_0x375b89['push']('\x22'+_0x9d3177+'\x22');break;case _0xc988('0x35'):var _0x103d23=parseInt(_0x9d3177);if(_[_0xc988('0x75')](_0x103d23)&&_[_0xc988('0x76')](_0x1f2212,_0x103d23)){_0x375b89[_0xc988('0x1a')]('\x22'+_0x103d23+'\x22');}else{_0x4e9560['push'](_0xc988('0x77'));}break;case _0xc988('0x78'):if(isEmail(_0x9d3177)){_0x375b89[_0xc988('0x1a')]('\x22'+_0x9d3177+'\x22');}else{_0x4e9560['push'](_0xc988('0x79'));}break;case'dateOfBirth':var _0xd013c0=moment(_0x9d3177,'YYYY-MM-DD',!![]);if(_0xd013c0[_0xc988('0x72')]()){_0x375b89[_0xc988('0x1a')]('\x22'+_0x9d3177+'\x22');}else{_0x4e9560['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x375b89[_0xc988('0x1a')]('\x22'+_0x9d3177+'\x22');}}else{switch(_0xba26fb){case _0xc988('0x7a'):case'phone':_0x4e9560[_0xc988('0x1a')](_0xba26fb+'\x20not\x20specified');break;default:_0x375b89[_0xc988('0x1a')]('\x22\x22');}}}}else{var _0x55c53e='';if(!_[_0xc988('0x18')](_0x1ee899)){if(!_0x58b27b[_0xc988('0x7b')](_0x1ee899['id'])){for(var _0x1b94dd=0x0;_0x1b94dd<_0x5d0704[_0xba26fb][_0xc988('0x17')];_0x1b94dd++){var _0x9d3177=_[_0xc988('0x70')](_0x1736dd['data'][_0x470575][_0x5d0704[_0xba26fb][_0x1b94dd]][_0xc988('0x71')](/"/g,'\x27'));var _0x52c469=phoneDescriptions[_0xc988('0x6e')](_0x40266e=>_0x40266e[_0xc988('0x7c')]===_0x1ee899['id']);if(!_[_0xc988('0x18')](_0x52c469)){var _0x412e79=_['trim'](_0x1736dd[_0xc988('0x6d')][_0x470575][_0x5d0704[_0x52c469[_0xc988('0x7d')]][0x0]][_0xc988('0x71')](/"/g,'\x27'));if(!_['isNil'](_0x412e79))_0x9d3177=_0x9d3177+'§'+_0x412e79;}if(_0x55c53e=='')_0x55c53e=_0x9d3177;else _0x55c53e+='|'+_0x9d3177;}_0x28f146['push'](_0x1ee899['id']+':'+_0x55c53e);_0x58b27b[_0x1ee899['id']]=0x1;}}}}if(hasAdditionalPhones){_0x375b89['push']('\x22'+_0x28f146[_0xc988('0x10')](';')+'\x22');}if(_0x4e9560[_0xc988('0x17')]){handleError(_0x1736dd['data'][_0x470575],{'code':_0xc988('0x7e'),'message':_0x4e9560[_0xc988('0x10')]()});}else{fs['appendFileSync'](_0x2c25a1,_0x375b89[_0xc988('0x10')]()+'\x0a');}_0x375b89=[];}if(!(stats[_0xc988('0x6c')]%0xc8)){socket[_0xc988('0x7f')]('contact:import:'+_0x473455,stats);stats['errors']=[];}}if(stopped){logger[_0xc988('0x5c')](_0xc988('0x80'));_0x102524[_0xc988('0x81')]();}}catch(_0x22fd21){handleError(_0x1736dd[_0xc988('0x6d')][_0x470575],{'code':_0xc988('0x82'),'message':_0x22fd21['message']});logger[_0xc988('0x1d')](_0xc988('0x83'),_0x22fd21['message']);}},'complete':function(){try{var _0x176905=[];var _0x2be857=tempTableName;_0x176905['push'](_0xc988('0x84')+_0x2be857+'\x20LIKE\x20cm_contacts;');logger['info']('CIS\x20len',contactItemTypes[_0xc988('0x17')]);var _0x5a21dd=util[_0xc988('0x8')](_0xc988('0x85'),_0x2c25a1,_0x2be857,_0xd6e464,_0x49d508['ListId'],_0x49d508['CompanyId']||null,NOW,NOW);if(_[_0xc988('0x18')](_0x5d0704[_0xc988('0x31')])){_0x5a21dd+=_0xc988('0x86');}_0x176905['push'](_0x5a21dd);BPromise[_0xc988('0x87')](_0x176905,handleQuery)[_0xc988('0x1c')](function(_0x47c834){BPromise[_0xc988('0x1b')]([handleAdditionalPhones()])[_0xc988('0x1c')](function(){_0x176905=[];for(var _0x120343=0x0;_0x120343\x20\x20');}var _0x1c73d7=path[_0xc988('0x10')](config[_0xc988('0x91')],_0xc988('0x62'),process['argv'][0x2]);if(!fs[_0xc988('0x92')](_0x1c73d7)){throw new Error(_0xc988('0x93'));}var _0x4b409e={};try{_0x4b409e=JSON[_0xc988('0x6a')](process[_0xc988('0x90')][0x3]);if(!_0x4b409e[_0xc988('0x61')]){throw new Error(_0xc988('0x94'));}var _0x4a8a98=0x0;if(_0x4b409e[_0xc988('0x61')][_0xc988('0x35')]){_0x4a8a98=0x1;}if(!_0x4b409e[_0xc988('0x43')]){throw new Error(_0xc988('0x95'));}}catch(_0x5e6f15){throw new Error(_0xc988('0x96'));}var _0x2cbb10=[];try{_0x2cbb10=_[_0xc988('0x97')](JSON[_0xc988('0x6a')](process[_0xc988('0x90')][0x4]),'id');}catch(_0x404910){logger[_0xc988('0x5c')](_0xc988('0x98'));}main(_0x1c73d7,_0x4b409e,_0x2cbb10,_0x4a8a98);}validate();process['on']('SIGINT',handleStop);process['on'](_0xc988('0x99'),handleUncaughtException); \ No newline at end of file +var _0x2d28=['../../../config/environment','../../../config/logger','redis','localhost','socket.io-emitter','cm_contacts_temp_','format','YYYYMMDDHHmmss','test','select','field','phone','from','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','error','split','filter','CmContactHasItem','findOne','update','PHONE','inserted','CmHopper','cm_contacts.phone','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.id','cm_contacts.createdAt','fields','.CmListId','cm_hopper_black','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','exit','errors','message','main','send','start','binding','clone','socket_timestamp','server/files/tmp','.csv','body','name','_description','info','parse','createReadStream','rows','data','find','hasOwnProperty','trim','YYYY-MM-DD\x20HH:mm:ss','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','\x20not\x20specified','itemTypeId','description','replace','emit','contact:import:','Abort\x20parser','abort','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','each','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','squel','ioredis'];(function(_0x2d78c6,_0x1b5010){var _0x43b12a=function(_0x50cccc){while(--_0x50cccc){_0x2d78c6['push'](_0x2d78c6['shift']());}};_0x43b12a(++_0x1b5010);}(_0x2d28,0x1be));var _0x82d2=function(_0x5027b1,_0x1409a5){_0x5027b1=_0x5027b1-0x0;var _0x4a46cf=_0x2d28[_0x5027b1];return _0x4a46cf;};'use strict';var fs=require('fs');var path=require(_0x82d2('0x0'));var _=require(_0x82d2('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x82d2('0x2'));var Redis=require(_0x82d2('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x82d2('0x4'));var logger=require(_0x82d2('0x5'))('import');config[_0x82d2('0x6')]=_['defaults'](config[_0x82d2('0x6')],{'host':_0x82d2('0x7'),'port':0x18eb});var socket=require(_0x82d2('0x8'))(new Redis(config[_0x82d2('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()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x82d2('0x9')+moment()[_0x82d2('0xa')](_0x82d2('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x132cf9){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))*$/[_0x82d2('0xc')](_0x132cf9);}function selectNotIn(_0x2affca,_0x508e51,_0x576b16,_0x3f5dda,_0x483b6e){return squel[_0x82d2('0xd')]()[_0x82d2('0xe')](_0x82d2('0xf'))[_0x82d2('0x10')](_0x3f5dda)['join'](_0x508e51,null,_0x508e51+_0x82d2('0x11')+_0x3f5dda+'.'+_0x576b16)[_0x82d2('0x12')](_0x3f5dda+'.'+_0x576b16+'\x20=\x20'+_0x2affca+'.'+_0x576b16)['where'](_0x508e51+_0x82d2('0x13')+_0x483b6e[_0x82d2('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2bf42c,_0x1cbeae){promisesAdditionalPhones=[];promisesContact=[];return db[_0x82d2('0x15')][_0x82d2('0x16')](_0x82d2('0x17')+tempTableName)[_0x82d2('0x18')](function(_0x38836e){if(_0x38836e!==null){var _0x35b8ff=[];for(var _0x7e5af1=0x0;_0x7e5af1<_0x38836e[_0x82d2('0x19')];_0x7e5af1++){var _0x4d2c11=_0x38836e[_0x7e5af1];if(!_[_0x82d2('0x1a')](_0x4d2c11['phone'])){if(!_[_0x82d2('0x1a')](_0x4d2c11[_0x82d2('0x1b')]))_0x35b8ff[_0x82d2('0x1c')](insertAdditionalPhones(_0x4d2c11));promisesContact['push']({'contact':_0x4d2c11});}}}Promise[_0x82d2('0x1d')](_0x35b8ff)[_0x82d2('0x1e')](function(){_0x2bf42c({'val':0x1});});})[_0x82d2('0x1f')](function(_0x227898){logger[_0x82d2('0x20')](_0x227898['message']);});});}function insertAdditionalPhones(_0xb023a3){return new Promise(function(_0x2374c6,_0x507f04){var _0x3f35a1=_0xb023a3[_0x82d2('0x1b')];if(_[_0x82d2('0x1a')](_0x3f35a1))_0x507f04({'val':0x0});else{var _0x103655=_0x3f35a1[_0x82d2('0x21')](';');var _0x4696d4=[];orderBy=0x0;for(var _0x238432=0x0;_0x238432<_0x103655[_0x82d2('0x19')];_0x238432++){_0x4696d4['push'](splitAdditionalPhone(_0xb023a3['id'],_0x103655[_0x238432]));}Promise['all'](_0x4696d4)[_0x82d2('0x1e')](function(){_0x2374c6({'val':_0x103655['length']});});}});}function splitAdditionalPhone(_0x59555b,_0x79b653){return new Promise(function(_0x4fcbe1,_0x4308a8){var _0x4049e1=_0x79b653[_0x82d2('0x21')](':');var _0x1e8c0d=_0x4049e1[0x0];var _0x23d153=_0x4049e1[0x1];if(_0x23d153!==''){var _0x2c84de=_0x23d153[_0x82d2('0x21')]('|');var _0x19acd0=[];for(var _0x13bb38=0x0;_0x13bb38<_0x2c84de[_0x82d2('0x19')];_0x13bb38++){if(_0x2c84de[_0x13bb38]!==''){var _0x39b82d=_[_0x82d2('0x22')](promisesAdditionalPhones,{'contactId':_0x59555b,'phone':_0x2c84de[_0x13bb38]});if(_0x39b82d['length']==0x0){orderBy++;promisesAdditionalPhones[_0x82d2('0x1c')]({'contactId':_0x59555b,'contactTypeId':_0x1e8c0d,'phone':_0x2c84de[_0x13bb38],'orderBy':orderBy});}}}_0x4fcbe1({'ok':0x1});}else _0x4fcbe1({'res':0x0});});}function createAdditionalPhone(_0x94e1fd,_0x260ddf,_0x488f48,_0x2d2ef1){var _0x3790b2='';var _0x286526='';var _0x2a6564=_0x488f48[_0x82d2('0x21')]('§');_0x3790b2=_0x2a6564[0x0];if(_0x2a6564[_0x82d2('0x19')]==0x2)_0x286526=_0x2a6564[0x1];return new Promise(function(_0x9058b9,_0x52a855){return db[_0x82d2('0x23')][_0x82d2('0x24')]({'where':{'CmContactId':_0x94e1fd,'item':_0x3790b2}})['then'](function(_0x201e2d){if(_0x201e2d){return db[_0x82d2('0x23')][_0x82d2('0x25')]({'ItemTypeId':_0x260ddf,'description':_0x286526,'OrderBy':_0x2d2ef1},{'where':{'CmContactId':_0x94e1fd,'item':_0x3790b2}})['then'](function(_0x21b8e3){_0x9058b9({'res':'updated'});});}else{return db[_0x82d2('0x23')]['create']({'CmContactId':_0x94e1fd,'item':_0x3790b2,'ItemTypeId':_0x260ddf,'description':_0x286526,'OrderBy':_0x2d2ef1,'ItemClass':_0x82d2('0x26')})['then'](function(_0x3a1f4d){_0x9058b9({'res':_0x82d2('0x27')});});}});});}function updateContact(_0x247319){return new Promise(function(_0x247b44,_0xf250f7){var _0xad055b=_0x247319['id'];delete _0x247319['id'];return db['CmContact'][_0x82d2('0x25')](_0x247319,{'where':{'id':_0xad055b}})[_0x82d2('0x1e')](function(_0x3fcb23){updatedRows+=0x1;return db[_0x82d2('0x28')][_0x82d2('0x25')]({'phone':_0x247319[_0x82d2('0xf')]},{'where':{'ContactId':_0xad055b}})[_0x82d2('0x1e')](function(_0x4f26f4){_0x247b44({'ret':'OK'});});});});}function insertCmHopper(_0x2c7bbf,_0x3877fe,_0x27745a,_0x1de7bf,_0x1f1bab){var _0x493f34=[_0x82d2('0x29'),'cm_contacts.scheduledat','cm_contacts.id',_0x82d2('0x2a'),_0x3877fe+'.'+_0x1de7bf,'cm_contacts.createdAt',_0x82d2('0x2b'),_0x82d2('0x2c'),_0x82d2('0x2d'),'\x22'+_0x1f1bab+'\x22'];return squel[_0x82d2('0x2e')]()[_0x82d2('0x2f')](_0x82d2('0x30'))[_0x82d2('0x31')]([_0x82d2('0xf'),_0x82d2('0x32'),_0x82d2('0x33'),_0x82d2('0x34'),_0x1de7bf,_0x82d2('0x35'),_0x82d2('0x36'),_0x82d2('0x37'),_0x82d2('0x38'),_0x82d2('0x39')],squel[_0x82d2('0xd')]()['fields'](_0x493f34)[_0x82d2('0x10')](_0x3877fe)[_0x82d2('0x14')](_0x82d2('0x3a'),null,_0x82d2('0x3b')+_0x3877fe+'.CmListId')['join'](_0x27745a,null,_0x27745a+_0x82d2('0x11')+_0x3877fe+'.'+_0x1de7bf)[_0x82d2('0x12')](_0x3877fe+'.CmListId\x20=\x20?',_0x2c7bbf)[_0x82d2('0x12')](_0x82d2('0x3c'),NOW)[_0x82d2('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3877fe,_0x27745a,_0x1de7bf,_0x82d2('0x30'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0x82d2('0x12')](_0x82d2('0x3d'),selectNotIn(_0x3877fe,_0x27745a,_0x1de7bf,_0x82d2('0x30'),[_0x82d2('0x3e')])))[_0x82d2('0x3f')]();}function insertCmHopperBlack(_0x4680b7,_0x37671e,_0x4e6a08,_0x3886af){var _0x5ce132=[_0x82d2('0x29'),_0x82d2('0x40'),_0x82d2('0x2a'),_0x37671e+'.'+_0x3886af,_0x82d2('0x41'),_0x82d2('0x2b')];return squel[_0x82d2('0x2e')]()[_0x82d2('0x2f')]('cm_hopper_black')[_0x82d2('0x31')](['phone','ContactId',_0x82d2('0x34'),_0x3886af,_0x82d2('0x35'),'updatedAt'],squel['select']()[_0x82d2('0x42')](_0x5ce132)['from'](_0x37671e)['join'](_0x82d2('0x3a'),null,_0x82d2('0x3b')+_0x37671e+_0x82d2('0x43'))[_0x82d2('0x14')](_0x4e6a08,null,_0x4e6a08+_0x82d2('0x11')+_0x37671e+'.'+_0x3886af)[_0x82d2('0x12')](_0x37671e+'.CmListId\x20=\x20?',_0x4680b7)[_0x82d2('0x12')](_0x82d2('0x3c'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x82d2('0xd')]()['field'](_0x82d2('0xf'))[_0x82d2('0x10')](_0x82d2('0x44'))['where'](_0x82d2('0x45'),_0x4680b7)[_0x82d2('0x12')](_0x3886af+'\x20=\x20?',_0x37671e+'.'+_0x3886af)))[_0x82d2('0x3f')]();}function insertCmHopperAdditionalPhones(_0x957941){var _0x5d4853=[_0x82d2('0x46'),_0x82d2('0x47'),_0x82d2('0x48'),_0x82d2('0x49'),_0x82d2('0x4a')];return squel[_0x82d2('0x2e')]()[_0x82d2('0x2f')](_0x82d2('0x4b'))[_0x82d2('0x31')](['CmHopperId',_0x82d2('0xf'),_0x82d2('0x4c'),'createdAt','updatedAt'],squel['select']()[_0x82d2('0x42')](_0x5d4853)[_0x82d2('0x10')]('cm_hopper')['join'](_0x82d2('0x3a'),null,_0x82d2('0x4d'))[_0x82d2('0x14')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x82d2('0x12')](_0x82d2('0x4e'),_0x957941)[_0x82d2('0x12')](_0x82d2('0x3c'),NOW))[_0x82d2('0x3f')]();}function insertCmContact(_0x5ea1c6,_0x435bd7,_0x41d60f,_0x36ba8a){var _0x4e4f17=_[_0x82d2('0x4f')](_[_0x82d2('0x50')](_0x36ba8a),['ListId',_0x82d2('0x51'),'createdAt',_0x82d2('0x36')]);return squel['insert']()['into'](_0x82d2('0x3a'))['fromQuery'](_0x4e4f17,squel[_0x82d2('0xd')]()['fields'](_0x4e4f17)[_0x82d2('0x10')](_0x435bd7)[_0x82d2('0x12')]('('+_0x41d60f[_0x82d2('0x14')](',')+_0x82d2('0x52'),squel[_0x82d2('0xd')]()[_0x82d2('0x42')](_0x41d60f)[_0x82d2('0x10')](_0x82d2('0x3a'))[_0x82d2('0x12')](_0x82d2('0x45'),_0x5ea1c6))['where'](_0x82d2('0x53'),squel[_0x82d2('0xd')]()[_0x82d2('0xe')](_0x82d2('0x54'),_0x82d2('0x55'))[_0x82d2('0x10')](_0x435bd7)[_0x82d2('0x56')](_0x41d60f[_0x82d2('0x14')](','))))[_0x82d2('0x3f')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x56d84b){logger[_0x82d2('0x20')](_0x56d84b['message']);process[_0x82d2('0x57')](0x1);}function handleError(_0x351104,_0x2522e0){stats[_0x82d2('0x58')]['push']({'name':_0x2522e0['code'],'message':_0x2522e0['message'],'row':_0x351104});}function handleQuery(_0x38d51a){logger['info'](_0x38d51a);return db[_0x82d2('0x15')][_0x82d2('0x16')](_0x38d51a)[_0x82d2('0x18')](function(_0x47eaca){results[_0x82d2('0x1c')](_0x47eaca);})[_0x82d2('0x1f')](function(_0x507049){logger[_0x82d2('0x20')](_0x507049[_0x82d2('0x59')]);});}function main(_0x3fdfff,_0x14ca69,_0x35defe,_0x8e28a4){logger['info'](_0x82d2('0x5a'),_0x3fdfff,JSON['stringify'](_0x14ca69));process[_0x82d2('0x5b')](_0x82d2('0x5c'));var _0xa3ef37=_0x14ca69[_0x82d2('0x5d')];var _0x486e53=_[_0x82d2('0x5e')](_0xa3ef37);var _0x1e6dd2=_0x14ca69[_0x82d2('0x5f')];var _0x5581cd=path[_0x82d2('0x14')](config['root'],_0x82d2('0x60'),_0x1e6dd2+_0x82d2('0x61'));logger['info'](_0x82d2('0x62'),_0x14ca69);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x82d2('0x63')]})[_0x82d2('0x1e')](function(_0x2f96b5){for(var _0x23bcab=0x0;_0x23bcab<_0x2f96b5[_0x82d2('0x19')];_0x23bcab++){if(_0x2f96b5[_0x23bcab]['name']in _0xa3ef37){contactItemTypes[_0x82d2('0x1c')](_0x2f96b5[_0x23bcab]);delete _0x486e53[_0x2f96b5[_0x23bcab]['name']];hasAdditionalPhones=!![];}for(var _0x1d842c in _0xa3ef37){if(_0x2f96b5[_0x23bcab][_0x82d2('0x63')]+_0x82d2('0x64')===_0x1d842c){phoneDescriptions['push']({'itemTypeId':_0x2f96b5[_0x23bcab]['id'],'description':_0x1d842c});delete _0x486e53[_0x1d842c];}}}if(hasAdditionalPhones)_0x486e53[_0x82d2('0x1b')]='';var _0x32463b=_[_0x82d2('0x50')](_0x486e53)[_0x82d2('0x14')]();logger[_0x82d2('0x65')]('header',_0x32463b);fs['writeFileSync'](_0x5581cd,_0x32463b+'\x0a');Papa[_0x82d2('0x66')](fs[_0x82d2('0x67')](_0x3fdfff),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5b1d0e,_0x5f2033){try{for(var _0x2ef5e1=0x0,_0x1040b2=[];_0x2ef5e1<_0x5b1d0e['data'][_0x82d2('0x19')];_0x2ef5e1++){stats[_0x82d2('0x68')]+=0x1;if(_0x5b1d0e['errors'][_0x2ef5e1]){handleError(_0x5b1d0e[_0x82d2('0x69')][_0x2ef5e1],_0x5b1d0e[_0x82d2('0x58')][_0x2ef5e1]);}else{var _0x37da2b=[];var _0x3a4473=[];var _0x44ab84={};for(var _0x7f6398 in _0xa3ef37){let _0x5722b2=contactItemTypes[_0x82d2('0x6a')](_0x5b7662=>_0x5b7662[_0x82d2('0x63')]===_0x7f6398);let _0x528ff5=contactItemTypes[_0x82d2('0x6a')](_0x39fc59=>_0x39fc59['name']+_0x82d2('0x64')===_0x7f6398);if(_[_0x82d2('0x1a')](_0x5722b2)&&_['isNil'](_0x528ff5)){if(_0xa3ef37[_0x82d2('0x6b')](_0x7f6398)){if(_0x5b1d0e[_0x82d2('0x69')][_0x2ef5e1][_0xa3ef37[_0x7f6398]]){var _0x3d7887=_[_0x82d2('0x6c')](_0x5b1d0e['data'][_0x2ef5e1][_0xa3ef37[_0x7f6398]]['replace'](/"/g,'\x27'));switch(_0x7f6398){case _0x82d2('0x32'):var _0x13c36a=moment(_0x3d7887,_0x82d2('0x6d'),!![]);if(_0x13c36a['isValid']()){_0x1040b2[_0x82d2('0x1c')]('\x22'+_0x3d7887+'\x22');}else{_0x37da2b[_0x82d2('0x1c')](_0x82d2('0x6e'));}break;case _0x82d2('0x37'):var _0x252895=parseInt(_0x3d7887);_0x3d7887=_[_0x82d2('0x6f')](_0x252895)||_0x252895<0x0||_0x252895>0x4?_0x8e28a4?0x3:0x2:_0x252895;_0x1040b2[_0x82d2('0x1c')]('\x22'+_0x3d7887+'\x22');break;case _0x82d2('0x38'):var _0x485174=parseInt(_0x3d7887);if(_[_0x82d2('0x70')](_0x485174)&&_[_0x82d2('0x71')](_0x35defe,_0x485174)){_0x1040b2[_0x82d2('0x1c')]('\x22'+_0x485174+'\x22');}else{_0x37da2b[_0x82d2('0x1c')](_0x82d2('0x72'));}break;case _0x82d2('0x73'):if(isEmail(_0x3d7887)){_0x1040b2[_0x82d2('0x1c')]('\x22'+_0x3d7887+'\x22');}else{_0x37da2b['push'](_0x82d2('0x74'));}break;case _0x82d2('0x75'):var _0x4891e4=moment(_0x3d7887,_0x82d2('0x76'),!![]);if(_0x4891e4[_0x82d2('0x77')]()){_0x1040b2[_0x82d2('0x1c')]('\x22'+_0x3d7887+'\x22');}else{_0x37da2b['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x1040b2[_0x82d2('0x1c')]('\x22'+_0x3d7887+'\x22');}}else{switch(_0x7f6398){case'firstName':case _0x82d2('0xf'):_0x37da2b[_0x82d2('0x1c')](_0x7f6398+_0x82d2('0x78'));break;default:_0x1040b2[_0x82d2('0x1c')]('\x22\x22');}}}}else{var _0x373098='';if(!_[_0x82d2('0x1a')](_0x5722b2)){if(!_0x44ab84[_0x82d2('0x6b')](_0x5722b2['id'])){for(var _0x2711c2=0x0;_0x2711c2<_0xa3ef37[_0x7f6398][_0x82d2('0x19')];_0x2711c2++){var _0x3d7887=_['trim'](_0x5b1d0e[_0x82d2('0x69')][_0x2ef5e1][_0xa3ef37[_0x7f6398][_0x2711c2]]['replace'](/"/g,'\x27'));var _0x453cf0=phoneDescriptions[_0x82d2('0x6a')](_0x4df171=>_0x4df171[_0x82d2('0x79')]===_0x5722b2['id']);if(!_[_0x82d2('0x1a')](_0x453cf0)){var _0x1dba8e=_[_0x82d2('0x6c')](_0x5b1d0e['data'][_0x2ef5e1][_0xa3ef37[_0x453cf0[_0x82d2('0x7a')]][0x0]][_0x82d2('0x7b')](/"/g,'\x27'));if(!_[_0x82d2('0x1a')](_0x1dba8e))_0x3d7887=_0x3d7887+'§'+_0x1dba8e;}if(_0x373098=='')_0x373098=_0x3d7887;else _0x373098+='|'+_0x3d7887;}_0x3a4473[_0x82d2('0x1c')](_0x5722b2['id']+':'+_0x373098);_0x44ab84[_0x5722b2['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1040b2[_0x82d2('0x1c')]('\x22'+_0x3a4473['join'](';')+'\x22');}if(_0x37da2b[_0x82d2('0x19')]){handleError(_0x5b1d0e[_0x82d2('0x69')][_0x2ef5e1],{'code':'SystemRow','message':_0x37da2b[_0x82d2('0x14')]()});}else{fs['appendFileSync'](_0x5581cd,_0x1040b2[_0x82d2('0x14')]()+'\x0a');}_0x1040b2=[];}if(!(stats['rows']%0xc8)){socket[_0x82d2('0x7c')](_0x82d2('0x7d')+_0x1e6dd2,stats);stats['errors']=[];}}if(stopped){logger[_0x82d2('0x65')](_0x82d2('0x7e'));_0x5f2033[_0x82d2('0x7f')]();}}catch(_0xf3e3aa){handleError(_0x5b1d0e[_0x82d2('0x69')][_0x2ef5e1],{'code':'SystemError','message':_0xf3e3aa[_0x82d2('0x59')]});logger[_0x82d2('0x20')]('step',_0xf3e3aa['message']);}},'complete':function(){try{var _0x379aa5=[];var _0x2ce529=tempTableName;_0x379aa5['push'](_0x82d2('0x80')+_0x2ce529+_0x82d2('0x81'));logger['info'](_0x82d2('0x82'),contactItemTypes[_0x82d2('0x19')]);var _0x4ec03b=util[_0x82d2('0xa')](_0x82d2('0x83'),_0x5581cd,_0x2ce529,_0x32463b,_0x14ca69[_0x82d2('0x34')],_0x14ca69['CompanyId']||null,NOW,NOW);if(_['isNil'](_0xa3ef37['scheduledat'])){_0x4ec03b+=',\x20scheduledAt\x20=\x20NOW()';}_0x379aa5['push'](_0x4ec03b);BPromise['each'](_0x379aa5,handleQuery)[_0x82d2('0x1e')](function(_0x2d03b6){BPromise[_0x82d2('0x1d')]([handleAdditionalPhones()])[_0x82d2('0x1e')](function(){_0x379aa5=[];for(var _0x197cc0=0x0;_0x197cc0\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','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','name','field','color','tools_tags','user_has_','_interactions','select','u.id','u.fullname','ui.','left_join','length','where','map','getInteractionsTables','getInteractionFK'];(function(_0xbf25a4,_0x1cf487){var _0x4ed96c=function(_0x166dc0){while(--_0x166dc0){_0xbf25a4['push'](_0xbf25a4['shift']());}};_0x4ed96c(++_0x1cf487);}(_0x9b87,0x8e));var _0x79b8=function(_0x5e64ea,_0x18c018){_0x5e64ea=_0x5e64ea-0x0;var _0x11fb3b=_0x9b87[_0x5e64ea];return _0x11fb3b;};'use strict';var _=require(_0x79b8('0x0'));var squel=require(_0x79b8('0x1'));var as=require(_0x79b8('0x2'));var qs=require(_0x79b8('0x3'));var updateInteraction=require(_0x79b8('0x4'))[_0x79b8('0x5')];var utils=require(_0x79b8('0x6'));var db=require(_0x79b8('0x7'))['db'];function skipInteractionsQuery(_0xbc1e74,_0xa65bbc,_0x1f9679){var _0x399796=![];var _0x3ccc53=utils[_0x79b8('0x8')](_0xbc1e74);if(_0xa65bbc[_0x79b8('0x9')]===_0x79b8('0xa')&&!_0x1f9679['search']&&!_0x1f9679[_0x3ccc53]){_0x399796=!![];}return _0x399796;}function getTagsQuery(){return squel['select']()['field']('id')['field'](_0x79b8('0xb'))[_0x79b8('0xc')](_0x79b8('0xd'))['from'](_0x79b8('0xe'));}function getUsersQuery(_0x2fdb05,_0xdf585a){var _0x525bc1=utils['getInteractionFK'](_0x2fdb05);var _0x46c0ce=_0x79b8('0xf')+_0x2fdb05+_0x79b8('0x10');var _0x2cabe4=squel[_0x79b8('0x11')]()[_0x79b8('0xc')](_0x79b8('0x12'))[_0x79b8('0xc')](_0x79b8('0x13'))[_0x79b8('0xc')](_0x79b8('0x14')+_0x525bc1)['from'](_0x46c0ce,'ui')[_0x79b8('0x15')]('users','u','u.id\x20=\x20ui.UserId');if(_0xdf585a[_0x79b8('0x16')]>0x0){_0x2cabe4[_0x79b8('0x17')](_0x79b8('0x14')+_0x525bc1+'\x20IN\x20?',_[_0x79b8('0x18')](_0xdf585a,'id'));}return _0x2cabe4;}function getInteractionsQuery(_0x49e40b){var _0x5ef869=utils[_0x79b8('0x19')](_0x49e40b);var _0x24c02f=utils[_0x79b8('0x8')](_0x49e40b);var _0x2ae2d5=utils[_0x79b8('0x1a')](_0x49e40b);return squel[_0x79b8('0x11')]()['from'](_0x5ef869[_0x79b8('0x1b')],'i')['left_join']('cm_contacts','c',_0x79b8('0x1c'))[_0x79b8('0x15')](_0x79b8('0x1d'),'o',_0x79b8('0x1e'))[_0x79b8('0x15')](_0x5ef869[_0x79b8('0x1f')],'a',_0x79b8('0x20')+_0x24c02f)[_0x79b8('0x15')](_0x5ef869[_0x79b8('0x21')],'me','me.'+_0x2ae2d5+_0x79b8('0x22'))[_0x79b8('0x15')](_0x5ef869['interactionsTags'],'it',_0x79b8('0x23')+_0x2ae2d5+_0x79b8('0x22'))['left_join'](_0x79b8('0xe'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x5e8228={'body':squel[_0x79b8('0x24')](),'contact':squel[_0x79b8('0x24')](),'default':squel[_0x79b8('0x24')](),'fields':squel[_0x79b8('0x24')](),'filter':squel[_0x79b8('0x24')](),'read':squel['expr'](),'tags':{'clause':squel[_0x79b8('0x24')](),'ids':null},'user':squel[_0x79b8('0x24')]()};return _0x5e8228;}function parseTagParameter(_0x1e84f3){var _0x3ba5ac=squel['expr']();if(_0x1e84f3){var _0x438130=utils[_0x79b8('0x25')](_0x1e84f3);_0x438130[_0x79b8('0x26')](function(_0x4aa92c){_0x3ba5ac['or'](_0x79b8('0x27'),'%,'+_0x4aa92c+',%');});}return _0x3ba5ac;}function parseReadParameter(_0x4a4ef6){var _0x43058e='';if(_0x4a4ef6){_0x43058e=_0x79b8('0x28');if(_0x4a4ef6==='1'){_0x43058e=_0x43058e[_0x79b8('0x29')](_0x79b8('0x2a'),'=');}else{_0x43058e=_0x43058e['replace'](_0x79b8('0x2a'),'>');}}return _0x43058e;}function parseSearchFilter(_0x5a24fd,_0x169597){var _0x4a4d64=squel[_0x79b8('0x24')]();if(_0x169597){var _0x1090d2=_0x169597[_0x79b8('0x29')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x79b8('0x2b')](_0x1090d2)){_0x4a4d64['or'](_0x79b8('0x2c'),_0x1090d2+'%');if([_0x79b8('0x2d'),_0x79b8('0x2e')]['includes'](_0x5a24fd)){_0x4a4d64['or'](_0x79b8('0x2f'),_0x1090d2+'%');}else if(_0x5a24fd==='fax'){_0x4a4d64['or']('i.fax\x20LIKE\x20?',_0x1090d2+'%');}else if(_0x5a24fd===_0x79b8('0x30')){_0x4a4d64['or'](_0x79b8('0x31'),_0x1090d2+'%');}}else if(_0x5a24fd==='mail'&&qs[_0x79b8('0x32')](_0x1090d2)){_0x4a4d64['or']('c.email\x20LIKE\x20?',_0x1090d2+'%');}else{if(_0x5a24fd==='mail'){_0x4a4d64['or'](_0x79b8('0x33'),qs['getFullTextValue'](_0x1090d2))['or'](_0x79b8('0x34'),qs[_0x79b8('0x35')](_0x1090d2));}else{if(_0x5a24fd!=='fax'){_0x4a4d64['or'](_0x79b8('0x36'),qs[_0x79b8('0x35')](_0x1090d2));}_0x4a4d64['or'](_0x79b8('0x37'),_0x1090d2+'%');}}}return _0x4a4d64;}function parseAdvancedSearchFilter(_0x1e5bd9,_0x330535){var _0x3d7214=getSqlClauses();var _0x54a8f3=as[_0x79b8('0x38')](_0x1e5bd9);var _0x28b32b=_0x54a8f3[_0x79b8('0x39')];for(var _0x985c4=0x0;_0x985c4<_0x54a8f3[_0x79b8('0x3a')][_0x79b8('0x16')];_0x985c4++){var _0x43a80a=_0x54a8f3[_0x79b8('0x3a')][_0x985c4];var _0x3522e6='i';var _0x1a167d=_[_0x79b8('0x3b')](_0x330535,['name',_0x43a80a[_0x79b8('0xc')]]);if(_0x1a167d){var _0x9de99=as[_0x79b8('0x3c')](_0x3522e6,_0x1a167d['type'],_0x43a80a);_0x3d7214[_0x79b8('0x3d')][_0x28b32b](_0x9de99[_0x79b8('0x3e')],_0x9de99[_0x79b8('0x3f')][_0x79b8('0x40')],_0x9de99[_0x79b8('0x3f')][_0x79b8('0x41')]);}else{switch(_0x43a80a['field']){case _0x79b8('0x42'):var _0x5be93d=parseReadParameter(_0x43a80a['value']);_0x3d7214[_0x79b8('0x43')]['and'](_0x5be93d);break;case'Contact':if(_0x43a80a[_0x79b8('0x44')]===_0x79b8('0x45')){if(_0x43a80a[_0x79b8('0x3f')][_0x79b8('0x46')]('\x20')[_0x79b8('0x16')]>0x1){_0x3d7214[_0x79b8('0x47')][_0x28b32b](_0x79b8('0x48'),qs[_0x79b8('0x35')](_0x43a80a[_0x79b8('0x3f')]),null);}else{var _0x37fe86='%'+_0x43a80a[_0x79b8('0x3f')]+'%';_0x3d7214[_0x79b8('0x47')][_0x28b32b](_0x79b8('0x49'),_0x37fe86,_0x37fe86,_0x37fe86);}}else{_0x1a167d=_['find'](_0x330535,[_0x79b8('0xb'),_0x79b8('0x4a')]);_0x43a80a['field']=_0x79b8('0x4a');_0x9de99=as[_0x79b8('0x3c')](_0x3522e6,_0x1a167d['type'],_0x43a80a);_0x3d7214[_0x79b8('0x47')][_0x28b32b](_0x9de99[_0x79b8('0x3e')],_0x9de99[_0x79b8('0x3f')][_0x79b8('0x40')],_0x9de99[_0x79b8('0x3f')][_0x79b8('0x41')]);}break;case _0x79b8('0x4b'):var _0x110730=_0x43a80a[_0x79b8('0x3f')][_0x79b8('0x46')](',')[_0x79b8('0x18')](function(_0x379217){return Number(_0x379217);});var _0x4d5bd9=parseTagParameter(_0x110730);_0x3d7214['tags'][_0x79b8('0x4c')][_0x79b8('0x4d')](_0x4d5bd9);_0x3d7214[_0x79b8('0x4e')][_0x79b8('0x4f')]=_0x110730;break;case'User':if(_0x43a80a[_0x79b8('0x44')]===_0x79b8('0x45')){_0x3d7214[_0x79b8('0x50')][_0x28b32b](_0x79b8('0x51'),'%'+_0x43a80a['value']+'%',null);}else{_0x1a167d=_[_0x79b8('0x3b')](_0x330535,[_0x79b8('0xb'),_0x79b8('0x52')]);_0x43a80a[_0x79b8('0xc')]='UserId';_0x9de99=as[_0x79b8('0x3c')](_0x3522e6,_0x1a167d[_0x79b8('0x53')],_0x43a80a);_0x3d7214[_0x79b8('0x50')][_0x28b32b](_0x9de99[_0x79b8('0x3e')],_0x9de99[_0x79b8('0x3f')][_0x79b8('0x40')],_0x9de99['value'][_0x79b8('0x41')]);}break;case _0x79b8('0x54'):case _0x79b8('0x55'):_0x9de99=as[_0x79b8('0x3c')]('me',null,_0x43a80a);_0x3d7214['body'][_0x28b32b](_0x9de99['text'],_0x9de99[_0x79b8('0x3f')][_0x79b8('0x40')],_0x9de99[_0x79b8('0x3f')][_0x79b8('0x41')]);break;}}}return _0x3d7214;}function parseModelFields(_0x32e7ea,_0x19272d,_0x1d4e87){var _0x372d36=utils[_0x79b8('0x8')](_0x32e7ea);var _0x51cd68=squel[_0x79b8('0x24')]();var _0x374fe9=_(_0x19272d)[_0x79b8('0x56')]()['map'](function(_0x28d28f){return _['some'](_0x1d4e87,['name',_0x28d28f])?_0x28d28f:undefined;})[_0x79b8('0x57')]()[_0x79b8('0x3f')]();if(_0x374fe9[_0x79b8('0x16')]>0x0){_0x374fe9[_0x79b8('0x26')](function(_0x4cdcf9){if(_0x4cdcf9===_0x372d36){_0x51cd68['and']('i.'+_0x372d36+_0x79b8('0x58'),[][_0x79b8('0x59')](_0x19272d[_0x4cdcf9]));}else if(_0x4cdcf9===_0x79b8('0x5a')){var _0x43f401=JSON[_0x79b8('0x5b')](_0x19272d[_0x4cdcf9])[_0x79b8('0x5c')];var _0x3f3ffc=JSON[_0x79b8('0x5b')](_0x19272d[_0x4cdcf9])[_0x79b8('0x5d')];_0x51cd68[_0x79b8('0x4d')](_0x79b8('0x5e'),_0x43f401,_0x3f3ffc);}else{if(_0x19272d[_0x4cdcf9]===_0x79b8('0x5f')){_0x51cd68[_0x79b8('0x4d')]('i.'+_0x4cdcf9+_0x79b8('0x60'));}else{_0x51cd68['and']('i.'+_0x4cdcf9+_0x79b8('0x61'),_0x19272d[_0x4cdcf9]);}}});}return _0x51cd68;}function parseQueryParameters(_0x16f272,_0x2eb440,_0x2bbe40){var _0x48fe74=getSqlClauses();return Promise['resolve']()[_0x79b8('0x62')](function(){return parseModelFields(_0x16f272,_0x2eb440,_0x2bbe40);})[_0x79b8('0x62')](function(_0x3226e6){_0x48fe74[_0x79b8('0x63')]['and'](_0x3226e6);return parseReadParameter(_0x2eb440[_0x79b8('0x43')]);})[_0x79b8('0x62')](function(_0x58c737){_0x48fe74[_0x79b8('0x43')][_0x79b8('0x4d')](_0x58c737);return parseTagParameter(_0x2eb440[_0x79b8('0x64')]);})['then'](function(_0x152a80){_0x48fe74['tags'][_0x79b8('0x4c')][_0x79b8('0x4d')](_0x152a80);return parseSearchFilter(_0x16f272,_0x2eb440[_0x79b8('0x65')]);})[_0x79b8('0x62')](function(_0xdffe64){_0x48fe74[_0x79b8('0x65')]=_0xdffe64;return _0x48fe74;});}function checkAccountsRestrictions(_0x3f22ea,_0x2bf5b6,_0xe0d55d){var _0x17e421=utils['getAccountFK'](_0x3f22ea);var _0x1dfcbd='get'+_[_0x79b8('0x66')](_0x3f22ea)+(_0x3f22ea==='chat'?_0x79b8('0x67'):_0x79b8('0x68'));var _0x4146b0=squel[_0x79b8('0x24')]();return Promise[_0x79b8('0x69')]()[_0x79b8('0x62')](function(){if(_0xe0d55d[_0x79b8('0x6a')]&&_0x2bf5b6['role']===_0x79b8('0xa')){return _0x2bf5b6[_0x1dfcbd]({'attributes':['id'],'raw':!![]});}})[_0x79b8('0x62')](function(_0x19953b){if(_0x19953b){if(_0x19953b[_0x79b8('0x16')]===0x0){_0x4146b0[_0x79b8('0x4d')]('i.'+_0x17e421+_0x79b8('0x60'));}else{_0x4146b0['and']('i.'+_0x17e421+_0x79b8('0x58'),_[_0x79b8('0x18')](_0x19953b,'id'));}}else if(!_0xe0d55d[_0x17e421]){_0x4146b0['and']('i.'+_0x17e421+_0x79b8('0x6b'));}})['then'](function(){return _0x4146b0;});}function getClosedOrderClause(_0xadb335,_0x1eb0dc){var _0x5bcdde='';var _0xecf12a=[_0x79b8('0x6c'),'i.secondDisposition',_0x79b8('0x6d')];if(_0xadb335==='mail'){_0xecf12a[_0x79b8('0x6e')]('i.substatus');}if(_0x1eb0dc[_0x79b8('0x6f')]==='0'&&_0xadb335===_0x79b8('0x70')){_0x5bcdde=_0x79b8('0x71');}else{if(_0x1eb0dc[_0x79b8('0x6f')]==='1'){_0xecf12a[_0x79b8('0x72')]();}_0x5bcdde=_0x79b8('0x73')+_0xecf12a['join'](',\x20')+')';}return _0x5bcdde;}function getFilteredInteractions(_0x291ef1,_0x604b43,_0x5c02a7,_0x5b4443){var _0x2228a2=utils[_0x79b8('0x1a')](_0x291ef1);var _0x4fb2fd=_[_0x79b8('0x66')](_0x291ef1)+_0x79b8('0x74');var _0x2daf0a=[];var _0x57787f=getTagsQuery();var _0x1a15ac={'type':db[_0x79b8('0x75')][_0x79b8('0x76')][_0x79b8('0x77')],'raw':!![]};var _0x41b63e=[];var _0x441aad=[];return db['sequelize'][_0x79b8('0x78')](_0x57787f[_0x79b8('0x79')](),_0x1a15ac)[_0x79b8('0x62')](function(_0x54b5af){_0x2daf0a=_[_0x79b8('0x7a')](_0x54b5af,'id');_0x1a15ac=_[_0x79b8('0x7b')](_0x1a15ac,{'model':db[_0x4fb2fd],'mapToModel':!![],'nest':!![]});if(_0x5c02a7[_0x79b8('0x63')]){_0x5b4443['attributes'][_0x79b8('0x26')](function(_0x2e3b8c){_0x604b43['field']('i.'+_0x2e3b8c);});}else{_0x604b43['field'](_0x79b8('0x7c'),_0x79b8('0x42'));_0x604b43[_0x79b8('0xc')](_0x79b8('0x7d'),_0x79b8('0x7e'));_0x604b43[_0x79b8('0xc')](_0x79b8('0x7f'),_0x79b8('0x80'));if(_0x291ef1==='mail'){_0x604b43[_0x79b8('0xc')]('a.email','Account.email');_0x604b43[_0x79b8('0xc')]('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',_0x79b8('0x81'));_0x604b43[_0x79b8('0xc')](_0x79b8('0x82'));_0x604b43['field'](_0x79b8('0x83'));_0x604b43[_0x79b8('0xc')](_0x79b8('0x84'));_0x604b43[_0x79b8('0xc')](_0x79b8('0x85'));_0x604b43[_0x79b8('0xc')](_0x79b8('0x86'));_0x604b43[_0x79b8('0xc')](_0x79b8('0x87'));_0x604b43[_0x79b8('0xc')](_0x79b8('0x88'));_0x604b43[_0x79b8('0xc')]('i.lastMsgDirection');_0x604b43[_0x79b8('0xc')](_0x79b8('0x89'));_0x604b43[_0x79b8('0xc')](_0x79b8('0x6d'));_0x604b43[_0x79b8('0xc')](_0x79b8('0x8a'));_0x604b43[_0x79b8('0xc')](_0x79b8('0x6c'));_0x604b43[_0x79b8('0xc')](_0x79b8('0x71'));_0x604b43[_0x79b8('0xc')]('i.to');_0x604b43[_0x79b8('0xc')]('i.ContactId');_0x604b43['field'](_0x79b8('0x8b'));_0x604b43[_0x79b8('0xc')](_0x79b8('0x8c'));}else if(_0x291ef1===_0x79b8('0x30')){_0x604b43[_0x79b8('0xc')](_0x79b8('0x8d'),_0x79b8('0x81'));}else{_0x604b43[_0x79b8('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','contactName');}if(_0x291ef1!=='mail'){_0x604b43[_0x79b8('0xc')](_0x79b8('0x8e'));}_0x604b43[_0x79b8('0xc')](_0x79b8('0x8f'),_0x79b8('0x90'));_0x604b43[_0x79b8('0xc')](_0x79b8('0x91'),_0x79b8('0x92'));_0x604b43[_0x79b8('0xc')](_0x79b8('0x93'),_0x79b8('0x94'));_0x604b43[_0x79b8('0xc')]('c.phone',_0x79b8('0x95'));_0x604b43[_0x79b8('0xc')]('c.mobile',_0x79b8('0x96'));_0x604b43[_0x79b8('0xc')](_0x79b8('0x97'),_0x79b8('0x98'));_0x604b43[_0x79b8('0xc')](_0x79b8('0x99'),_0x79b8('0x9a'));_0x604b43[_0x79b8('0xc')]('o.internal','Owner.internal');_0x604b43[_0x79b8('0xc')](_0x79b8('0x9b'),_0x79b8('0x9c'));}if(_0x5b4443[_0x79b8('0x9d')]){_0x604b43[_0x79b8('0x9d')](_0x5b4443[_0x79b8('0x9d')]);}if(_0x5b4443[_0x79b8('0x9e')]){_0x604b43[_0x79b8('0x9e')](_0x5b4443[_0x79b8('0x9e')]);}return db[_0x79b8('0x9f')]['query'](_0x604b43['toString'](),_0x1a15ac);})['then'](function(_0x4cc6cc){_0x41b63e=_0x4cc6cc;var _0x1207d3=getUsersQuery(_0x291ef1,_0x41b63e);return db[_0x79b8('0x9f')]['query'](_0x1207d3[_0x79b8('0x79')](),_0x1a15ac);})[_0x79b8('0x62')](function(_0xcde403){_0x441aad=_[_0x79b8('0xa0')](_0xcde403,_0x2228a2);if(_0x291ef1===_0x79b8('0x70')){return db[_0x79b8('0xa1')][_0x79b8('0xa2')]({'attributes':[_0x79b8('0xa3')],'raw':!![]});}})[_0x79b8('0x62')](function(_0x1014cf){var _0x2b7e60=_0x1014cf?_0x1014cf['enableEmailPreview']:undefined;var _0x4a7963=_0x41b63e[_0x79b8('0x18')](function(_0xf0bf62){return updateInteraction(_0xf0bf62,_0x2daf0a,_0x441aad,_0x2b7e60);});return Promise[_0x79b8('0xa4')](_0x4a7963);});}function countFilteredInteractions(_0x42915c,_0x93645){var _0x2d6a76=_0x42915c[_0x79b8('0xa5')]();_0x2d6a76['field'](_0x79b8('0xa6'));_0x2d6a76[_0x79b8('0xc')](_0x79b8('0x7c'),_0x79b8('0x42'));var _0x540967=utils[_0x79b8('0x25')](_0x93645);if(!_[_0x79b8('0xa7')](_0x540967)){_0x2d6a76[_0x79b8('0x17')]('t.id\x20IN\x20?',_0x540967);}var _0xf96b56={'type':db[_0x79b8('0x75')][_0x79b8('0x76')][_0x79b8('0x77')],'raw':!![]};return db['sequelize']['query'](_0x2d6a76[_0x79b8('0x79')](),_0xf96b56);}module[_0x79b8('0xa8')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xfc03=['sequelize','query','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','Account.mandatoryDisposition','a.email','Account.email','contactName','i.id','i.updatedAt','i.closed','i.attach','i.lastMsgDirection','i.subject','i.ContactId','i.MailAccountId','i.UserId','openchannel','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','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','groupBy','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','QueryTypes','lodash','../parsers/advancedSearch','../parsers/qs','updateInteraction','../../mysqldb','getAccountFK','role','search','field','name','from','tools_tags','user_has_','_interactions','select','u.id','ui.','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','interactions','left_join','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.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','{OPERATOR}','replace','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.fax\x20LIKE\x20?','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','fax','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','find','buildExpression','type','default','text','value','start','unreadMessages','read','and','$substring','split','contact','ContactId','end','Tag','clause','tags','ids','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','user','body','some','compact','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','resolve','then','fields','tag','filter','get','capitalize','chat','Websites','Accounts','agent','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','join','getInteractionFK','Interaction','Sequelize','SELECT'];(function(_0x33d8fc,_0x5cf5ff){var _0x470807=function(_0x37ff84){while(--_0x37ff84){_0x33d8fc['push'](_0x33d8fc['shift']());}};_0x470807(++_0x5cf5ff);}(_0xfc03,0x16f));var _0x3fc0=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xfc03[_0x346737];return _0x1ade2e;};'use strict';var _=require(_0x3fc0('0x0'));var squel=require('squel');var as=require(_0x3fc0('0x1'));var qs=require(_0x3fc0('0x2'));var updateInteraction=require('./update-interaction')[_0x3fc0('0x3')];var utils=require('./utils');var db=require(_0x3fc0('0x4'))['db'];function skipInteractionsQuery(_0x1eeb62,_0x390f7e,_0x29d814){var _0x92a96c=![];var _0x389bfb=utils[_0x3fc0('0x5')](_0x1eeb62);if(_0x390f7e[_0x3fc0('0x6')]==='agent'&&!_0x29d814[_0x3fc0('0x7')]&&!_0x29d814[_0x389bfb]){_0x92a96c=!![];}return _0x92a96c;}function getTagsQuery(){return squel['select']()[_0x3fc0('0x8')]('id')[_0x3fc0('0x8')](_0x3fc0('0x9'))[_0x3fc0('0x8')]('color')[_0x3fc0('0xa')](_0x3fc0('0xb'));}function getUsersQuery(_0xe9d431,_0x43faa8){var _0x16b04c=utils['getInteractionFK'](_0xe9d431);var _0x1f476c=_0x3fc0('0xc')+_0xe9d431+_0x3fc0('0xd');var _0x5e75e8=squel[_0x3fc0('0xe')]()['field'](_0x3fc0('0xf'))[_0x3fc0('0x8')]('u.fullname')[_0x3fc0('0x8')](_0x3fc0('0x10')+_0x16b04c)[_0x3fc0('0xa')](_0x1f476c,'ui')['left_join'](_0x3fc0('0x11'),'u',_0x3fc0('0x12'));if(_0x43faa8[_0x3fc0('0x13')]>0x0){_0x5e75e8[_0x3fc0('0x14')]('ui.'+_0x16b04c+_0x3fc0('0x15'),_[_0x3fc0('0x16')](_0x43faa8,'id'));}return _0x5e75e8;}function getInteractionsQuery(_0x3ef95e){var _0x5b59f1=utils[_0x3fc0('0x17')](_0x3ef95e);var _0x491446=utils[_0x3fc0('0x5')](_0x3ef95e);var _0x3c5026=utils['getInteractionFK'](_0x3ef95e);return squel[_0x3fc0('0xe')]()[_0x3fc0('0xa')](_0x5b59f1[_0x3fc0('0x18')],'i')[_0x3fc0('0x19')](_0x3fc0('0x1a'),'c',_0x3fc0('0x1b'))[_0x3fc0('0x19')](_0x3fc0('0x11'),'o',_0x3fc0('0x1c'))['left_join'](_0x5b59f1[_0x3fc0('0x1d')],'a',_0x3fc0('0x1e')+_0x491446)[_0x3fc0('0x19')](_0x5b59f1[_0x3fc0('0x1f')],'me',_0x3fc0('0x20')+_0x3c5026+_0x3fc0('0x21'))['left_join'](_0x5b59f1[_0x3fc0('0x22')],'it',_0x3fc0('0x23')+_0x3c5026+_0x3fc0('0x21'))[_0x3fc0('0x19')](_0x3fc0('0xb'),'t',_0x3fc0('0x24'));}function getSqlClauses(){var _0x2f423e={'body':squel[_0x3fc0('0x25')](),'contact':squel[_0x3fc0('0x25')](),'default':squel[_0x3fc0('0x25')](),'fields':squel[_0x3fc0('0x25')](),'filter':squel[_0x3fc0('0x25')](),'read':squel[_0x3fc0('0x25')](),'tags':{'clause':squel[_0x3fc0('0x25')](),'ids':null},'user':squel[_0x3fc0('0x25')]()};return _0x2f423e;}function parseTagParameter(_0xbec5b5){var _0x4f5111=squel[_0x3fc0('0x25')]();if(_0xbec5b5){var _0x1b539b=utils[_0x3fc0('0x26')](_0xbec5b5);_0x1b539b[_0x3fc0('0x27')](function(_0x5a9179){_0x4f5111['or'](_0x3fc0('0x28'),'%,'+_0x5a9179+',%');});}return _0x4f5111;}function parseReadParameter(_0x197dfa){var _0x126515='';if(_0x197dfa){_0x126515=_0x3fc0('0x29');if(_0x197dfa==='1'){_0x126515=_0x126515['replace'](_0x3fc0('0x2a'),'=');}else{_0x126515=_0x126515[_0x3fc0('0x2b')](_0x3fc0('0x2a'),'>');}}return _0x126515;}function parseSearchFilter(_0xac736c,_0x29aa32){var _0x244af1=squel['expr']();if(_0x29aa32){var _0xd9ecae=_0x29aa32[_0x3fc0('0x2b')]('\x5c','\x5c\x5c')[_0x3fc0('0x2b')](/'/g,'\x27\x27');if(qs[_0x3fc0('0x2c')](_0xd9ecae)){_0x244af1['or'](_0x3fc0('0x2d'),_0xd9ecae+'%');if([_0x3fc0('0x2e'),_0x3fc0('0x2f')][_0x3fc0('0x30')](_0xac736c)){_0x244af1['or']('i.phone\x20LIKE\x20?',_0xd9ecae+'%');}else if(_0xac736c==='fax'){_0x244af1['or'](_0x3fc0('0x31'),_0xd9ecae+'%');}else if(_0xac736c==='openchannel'){_0x244af1['or'](_0x3fc0('0x32'),_0xd9ecae+'%');}}else if(_0xac736c===_0x3fc0('0x33')&&qs[_0x3fc0('0x34')](_0xd9ecae)){_0x244af1['or'](_0x3fc0('0x35'),_0xd9ecae+'%');}else{if(_0xac736c===_0x3fc0('0x33')){_0x244af1['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xd9ecae))['or'](_0x3fc0('0x36'),qs[_0x3fc0('0x37')](_0xd9ecae));}else{if(_0xac736c!==_0x3fc0('0x38')){_0x244af1['or'](_0x3fc0('0x39'),qs[_0x3fc0('0x37')](_0xd9ecae));}_0x244af1['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xd9ecae+'%');}}}return _0x244af1;}function parseAdvancedSearchFilter(_0xe1279a,_0x1f19e8){var _0x399c9c=getSqlClauses();var _0x4db60d=as[_0x3fc0('0x3a')](_0xe1279a);var _0x4279c0=_0x4db60d[_0x3fc0('0x3b')];for(var _0x2eee6e=0x0;_0x2eee6e<_0x4db60d['conditions'][_0x3fc0('0x13')];_0x2eee6e++){var _0x19cf58=_0x4db60d['conditions'][_0x2eee6e];var _0x297943='i';var _0x5179e3=_[_0x3fc0('0x3c')](_0x1f19e8,[_0x3fc0('0x9'),_0x19cf58[_0x3fc0('0x8')]]);if(_0x5179e3){var _0x2db02e=as[_0x3fc0('0x3d')](_0x297943,_0x5179e3[_0x3fc0('0x3e')],_0x19cf58);_0x399c9c[_0x3fc0('0x3f')][_0x4279c0](_0x2db02e[_0x3fc0('0x40')],_0x2db02e[_0x3fc0('0x41')][_0x3fc0('0x42')],_0x2db02e[_0x3fc0('0x41')]['end']);}else{switch(_0x19cf58[_0x3fc0('0x8')]){case _0x3fc0('0x43'):var _0x2af7c6=parseReadParameter(_0x19cf58[_0x3fc0('0x41')]);_0x399c9c[_0x3fc0('0x44')][_0x3fc0('0x45')](_0x2af7c6);break;case'Contact':if(_0x19cf58['operator']===_0x3fc0('0x46')){if(_0x19cf58[_0x3fc0('0x41')][_0x3fc0('0x47')]('\x20')[_0x3fc0('0x13')]>0x1){_0x399c9c[_0x3fc0('0x48')][_0x4279c0]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x19cf58['value']),null);}else{var _0x1bc6ad='%'+_0x19cf58[_0x3fc0('0x41')]+'%';_0x399c9c[_0x3fc0('0x48')][_0x4279c0]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1bc6ad,_0x1bc6ad,_0x1bc6ad);}}else{_0x5179e3=_['find'](_0x1f19e8,[_0x3fc0('0x9'),_0x3fc0('0x49')]);_0x19cf58[_0x3fc0('0x8')]=_0x3fc0('0x49');_0x2db02e=as['buildExpression'](_0x297943,_0x5179e3['type'],_0x19cf58);_0x399c9c[_0x3fc0('0x48')][_0x4279c0](_0x2db02e[_0x3fc0('0x40')],_0x2db02e['value'][_0x3fc0('0x42')],_0x2db02e['value'][_0x3fc0('0x4a')]);}break;case _0x3fc0('0x4b'):var _0x33af75=_0x19cf58[_0x3fc0('0x41')][_0x3fc0('0x47')](',')[_0x3fc0('0x16')](function(_0x80dfee){return Number(_0x80dfee);});var _0x1b3b70=parseTagParameter(_0x33af75);_0x399c9c['tags'][_0x3fc0('0x4c')]['and'](_0x1b3b70);_0x399c9c[_0x3fc0('0x4d')][_0x3fc0('0x4e')]=_0x33af75;break;case _0x3fc0('0x4f'):if(_0x19cf58[_0x3fc0('0x50')]===_0x3fc0('0x46')){_0x399c9c['user'][_0x4279c0](_0x3fc0('0x51'),'%'+_0x19cf58[_0x3fc0('0x41')]+'%',null);}else{_0x5179e3=_[_0x3fc0('0x3c')](_0x1f19e8,[_0x3fc0('0x9'),'UserId']);_0x19cf58[_0x3fc0('0x8')]='UserId';_0x2db02e=as[_0x3fc0('0x3d')](_0x297943,_0x5179e3[_0x3fc0('0x3e')],_0x19cf58);_0x399c9c[_0x3fc0('0x52')][_0x4279c0](_0x2db02e[_0x3fc0('0x40')],_0x2db02e[_0x3fc0('0x41')]['start'],_0x2db02e[_0x3fc0('0x41')][_0x3fc0('0x4a')]);}break;case _0x3fc0('0x53'):case'plainBody':_0x2db02e=as[_0x3fc0('0x3d')]('me',null,_0x19cf58);_0x399c9c[_0x3fc0('0x53')][_0x4279c0](_0x2db02e['text'],_0x2db02e[_0x3fc0('0x41')][_0x3fc0('0x42')],_0x2db02e[_0x3fc0('0x41')]['end']);break;}}}return _0x399c9c;}function parseModelFields(_0x5e5c73,_0x3a35ac,_0xa3de5a){var _0xb70836=utils['getAccountFK'](_0x5e5c73);var _0x1d6844=squel['expr']();var _0x40dbf3=_(_0x3a35ac)['keys']()['map'](function(_0x5be8cc){return _[_0x3fc0('0x54')](_0xa3de5a,[_0x3fc0('0x9'),_0x5be8cc])?_0x5be8cc:undefined;})[_0x3fc0('0x55')]()[_0x3fc0('0x41')]();if(_0x40dbf3[_0x3fc0('0x13')]>0x0){_0x40dbf3[_0x3fc0('0x27')](function(_0x4fa770){if(_0x4fa770===_0xb70836){_0x1d6844[_0x3fc0('0x45')]('i.'+_0xb70836+_0x3fc0('0x15'),[]['concat'](_0x3a35ac[_0x4fa770]));}else if(_0x4fa770==='createdAt'){var _0x74ae6a=JSON[_0x3fc0('0x56')](_0x3a35ac[_0x4fa770])[_0x3fc0('0x57')];var _0x31b981=JSON[_0x3fc0('0x56')](_0x3a35ac[_0x4fa770])[_0x3fc0('0x58')];_0x1d6844[_0x3fc0('0x45')](_0x3fc0('0x59'),_0x74ae6a,_0x31b981);}else{if(_0x3a35ac[_0x4fa770]===_0x3fc0('0x5a')){_0x1d6844[_0x3fc0('0x45')]('i.'+_0x4fa770+_0x3fc0('0x5b'));}else{_0x1d6844[_0x3fc0('0x45')]('i.'+_0x4fa770+'\x20=\x20?',_0x3a35ac[_0x4fa770]);}}});}return _0x1d6844;}function parseQueryParameters(_0x24be72,_0xda5d3e,_0x24ee40){var _0x1dfd2c=getSqlClauses();return Promise[_0x3fc0('0x5c')]()['then'](function(){return parseModelFields(_0x24be72,_0xda5d3e,_0x24ee40);})[_0x3fc0('0x5d')](function(_0x57b6d0){_0x1dfd2c[_0x3fc0('0x5e')][_0x3fc0('0x45')](_0x57b6d0);return parseReadParameter(_0xda5d3e[_0x3fc0('0x44')]);})[_0x3fc0('0x5d')](function(_0x519973){_0x1dfd2c[_0x3fc0('0x44')][_0x3fc0('0x45')](_0x519973);return parseTagParameter(_0xda5d3e[_0x3fc0('0x5f')]);})[_0x3fc0('0x5d')](function(_0xe7f024){_0x1dfd2c[_0x3fc0('0x4d')]['clause'][_0x3fc0('0x45')](_0xe7f024);return parseSearchFilter(_0x24be72,_0xda5d3e[_0x3fc0('0x60')]);})[_0x3fc0('0x5d')](function(_0x21c46f){_0x1dfd2c[_0x3fc0('0x60')]=_0x21c46f;return _0x1dfd2c;});}function checkAccountsRestrictions(_0x737d45,_0x5b9b40,_0x14240b){var _0x258a27=utils[_0x3fc0('0x5')](_0x737d45);var _0x5a3732=_0x3fc0('0x61')+_[_0x3fc0('0x62')](_0x737d45)+(_0x737d45===_0x3fc0('0x63')?_0x3fc0('0x64'):_0x3fc0('0x65'));var _0x30bd70=squel[_0x3fc0('0x25')]();return Promise[_0x3fc0('0x5c')]()[_0x3fc0('0x5d')](function(){if(_0x14240b[_0x3fc0('0x7')]&&_0x5b9b40[_0x3fc0('0x6')]===_0x3fc0('0x66')){return _0x5b9b40[_0x5a3732]({'attributes':['id'],'raw':!![]});}})[_0x3fc0('0x5d')](function(_0x25d6d7){if(_0x25d6d7){if(_0x25d6d7[_0x3fc0('0x13')]===0x0){_0x30bd70['and']('i.'+_0x258a27+_0x3fc0('0x5b'));}else{_0x30bd70[_0x3fc0('0x45')]('i.'+_0x258a27+_0x3fc0('0x15'),_[_0x3fc0('0x16')](_0x25d6d7,'id'));}}else if(!_0x14240b[_0x258a27]){_0x30bd70[_0x3fc0('0x45')]('i.'+_0x258a27+_0x3fc0('0x67'));}})[_0x3fc0('0x5d')](function(){return _0x30bd70;});}function getClosedOrderClause(_0x84ec78,_0x1c7d11){var _0x2b9226='';var _0x5a9ad5=[_0x3fc0('0x68'),_0x3fc0('0x69'),_0x3fc0('0x6a')];if(_0x84ec78===_0x3fc0('0x33')){_0x5a9ad5[_0x3fc0('0x6b')](_0x3fc0('0x6c'));}if(_0x1c7d11['closed']==='0'&&_0x84ec78===_0x3fc0('0x33')){_0x2b9226=_0x3fc0('0x6c');}else{if(_0x1c7d11[_0x3fc0('0x6d')]==='1'){_0x5a9ad5['shift']();}_0x2b9226=_0x3fc0('0x6e')+_0x5a9ad5[_0x3fc0('0x6f')](',\x20')+')';}return _0x2b9226;}function getFilteredInteractions(_0x2f8b6b,_0x105df2,_0x11b3f5,_0x12758a){var _0x5b9161=utils[_0x3fc0('0x70')](_0x2f8b6b);var _0x139971=_['capitalize'](_0x2f8b6b)+_0x3fc0('0x71');var _0x16cd67=[];var _0x11468e=getTagsQuery();var _0x3d7073={'type':db[_0x3fc0('0x72')]['QueryTypes'][_0x3fc0('0x73')],'raw':!![]};var _0x42c1ee=[];var _0x138436=[];return db[_0x3fc0('0x74')][_0x3fc0('0x75')](_0x11468e[_0x3fc0('0x76')](),_0x3d7073)[_0x3fc0('0x5d')](function(_0xa9b93c){_0x16cd67=_[_0x3fc0('0x77')](_0xa9b93c,'id');_0x3d7073=_[_0x3fc0('0x78')](_0x3d7073,{'model':db[_0x139971],'mapToModel':!![],'nest':!![]});if(_0x11b3f5[_0x3fc0('0x5e')]){_0x12758a['attributes'][_0x3fc0('0x27')](function(_0x4f667b){_0x105df2[_0x3fc0('0x8')]('i.'+_0x4f667b);});}else{_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x79'),_0x3fc0('0x43'));_0x105df2['field']('a.key',_0x3fc0('0x7a'));_0x105df2[_0x3fc0('0x8')]('a.mandatoryDisposition',_0x3fc0('0x7b'));if(_0x2f8b6b===_0x3fc0('0x33')){_0x105df2['field'](_0x3fc0('0x7c'),_0x3fc0('0x7d'));_0x105df2[_0x3fc0('0x8')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x3fc0('0x7e'));_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x7f'));_0x105df2['field']('i.createdAt');_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x80'));_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x81'));_0x105df2[_0x3fc0('0x8')]('i.closedAt');_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x82'));_0x105df2[_0x3fc0('0x8')]('i.lastMsgAt');_0x105df2['field'](_0x3fc0('0x83'));_0x105df2['field'](_0x3fc0('0x84'));_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x6a'));_0x105df2[_0x3fc0('0x8')]('i.secondDisposition');_0x105df2['field'](_0x3fc0('0x68'));_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x6c'));_0x105df2[_0x3fc0('0x8')]('i.to');_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x85'));_0x105df2['field'](_0x3fc0('0x86'));_0x105df2['field'](_0x3fc0('0x87'));}else if(_0x2f8b6b===_0x3fc0('0x88')){_0x105df2['field'](_0x3fc0('0x89'),_0x3fc0('0x7e'));}else{_0x105df2[_0x3fc0('0x8')]('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',_0x3fc0('0x7e'));}if(_0x2f8b6b!==_0x3fc0('0x33')){_0x105df2['field']('i.*');}_0x105df2[_0x3fc0('0x8')]('c.firstName',_0x3fc0('0x8a'));_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x8b'),_0x3fc0('0x8c'));_0x105df2['field'](_0x3fc0('0x8d'),_0x3fc0('0x8e'));_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x8f'),_0x3fc0('0x90'));_0x105df2['field'](_0x3fc0('0x91'),'Contact.mobile');_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x92'),_0x3fc0('0x93'));_0x105df2[_0x3fc0('0x8')]('o.fullname','Owner.fullname');_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x94'),_0x3fc0('0x95'));_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x96'),'TagIds');}if(_0x12758a[_0x3fc0('0x97')]){_0x105df2[_0x3fc0('0x97')](_0x12758a[_0x3fc0('0x97')]);}if(_0x12758a[_0x3fc0('0x98')]){_0x105df2[_0x3fc0('0x98')](_0x12758a[_0x3fc0('0x98')]);}return db['sequelize'][_0x3fc0('0x75')](_0x105df2[_0x3fc0('0x76')](),_0x3d7073);})['then'](function(_0xb6dd6d){_0x42c1ee=_0xb6dd6d;var _0x346b98=getUsersQuery(_0x2f8b6b,_0x42c1ee);return db['sequelize'][_0x3fc0('0x75')](_0x346b98[_0x3fc0('0x76')](),_0x3d7073);})[_0x3fc0('0x5d')](function(_0x9a6d45){_0x138436=_[_0x3fc0('0x99')](_0x9a6d45,_0x5b9161);if(_0x2f8b6b===_0x3fc0('0x33')){return db['Setting']['findOne']({'attributes':['enableEmailPreview'],'raw':!![]});}})['then'](function(_0x2cbdd6){var _0x2d7d37=_0x2cbdd6?_0x2cbdd6[_0x3fc0('0x9a')]:undefined;var _0x119f70=_0x42c1ee[_0x3fc0('0x16')](function(_0x51bd47){return updateInteraction(_0x51bd47,_0x16cd67,_0x138436,_0x2d7d37);});return Promise[_0x3fc0('0x9b')](_0x119f70);});}function countFilteredInteractions(_0xcb2d8f,_0x166278){var _0x18583a=_0xcb2d8f[_0x3fc0('0x9c')]();_0x18583a[_0x3fc0('0x8')](_0x3fc0('0x9d'));_0x18583a[_0x3fc0('0x8')](_0x3fc0('0x79'),_0x3fc0('0x43'));var _0x592c80=utils[_0x3fc0('0x26')](_0x166278);if(!_[_0x3fc0('0x9e')](_0x592c80)){_0x18583a[_0x3fc0('0x14')](_0x3fc0('0x9f'),_0x592c80);}var _0x57f884={'type':db[_0x3fc0('0x72')][_0x3fc0('0xa0')][_0x3fc0('0x73')],'raw':!![]};return db[_0x3fc0('0x74')][_0x3fc0('0x75')](_0x18583a[_0x3fc0('0x76')](),_0x57f884);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 0d3a4fb..38b87c0 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 _0x1ae1=['../../mysqldb','fullname','split','forEach','push','waiting','talking','answered','abandoned','total','closed','disposition','UserId','unmanaged','MailMessage','findOne','out','plainBody','then','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','lodash'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0x1ae1,0xbc));var _0x11ae=function(_0x26487c,_0x146d98){_0x26487c=_0x26487c-0x0;var _0x3839c3=_0x1ae1[_0x26487c];return _0x3839c3;};'use strict';var _=require(_0x11ae('0x0'));var db=require(_0x11ae('0x1'))['db'];function getInteractionUsers(_0x49e6b9,_0x3cd78e){return new Promise(function(_0x1e785c,_0x591f2d){try{var _0xfc6cb2=[];if(_0x3cd78e[_0x49e6b9]){_0xfc6cb2=_0x3cd78e[_0x49e6b9]['map'](function(_0x5b0ab0){return{'id':_0x5b0ab0['id'],'fullname':_0x5b0ab0[_0x11ae('0x2')]};});}return _0x1e785c(_0xfc6cb2);}catch(_0x2635b2){_0x591f2d(_0x2635b2);}});}function getInteractionTags(_0x3918ae,_0x31a27c){var _0x511ad0=[];if(_0x3918ae){_0x3918ae[_0x11ae('0x3')](',')[_0x11ae('0x4')](function(_0x58d6e9){_0x511ad0[_0x11ae('0x5')](_0x31a27c[_0x58d6e9]);});}return _0x511ad0;}function updateWaitingCounter(_0x47b568){if(_0x47b568[_0x11ae('0x6')]){_0x47b568[_0x11ae('0x6')]-=0x1;}}function updateInteractionCounters(_0x1b0b8a){_0x1b0b8a['waiting']=0x0;_0x1b0b8a[_0x11ae('0x7')]=0x0;_0x1b0b8a[_0x11ae('0x8')]=0x0;_0x1b0b8a['unmanaged']=0x0;_0x1b0b8a[_0x11ae('0x9')]=0x0;_0x1b0b8a[_0x11ae('0xa')]=0x0;if(_0x1b0b8a[_0x11ae('0xb')]){if(_0x1b0b8a[_0x11ae('0xc')]==='abandoned'){_0x1b0b8a[_0x11ae('0x9')]+=0x1;updateWaitingCounter(_0x1b0b8a);}if(_0x1b0b8a[_0x11ae('0xd')]){_0x1b0b8a[_0x11ae('0x8')]+=0x1;if(_0x1b0b8a[_0x11ae('0x7')]){_0x1b0b8a[_0x11ae('0x7')]-=0x1;}}else{if(_0x1b0b8a['disposition']){_0x1b0b8a[_0x11ae('0xe')]+=0x1;updateWaitingCounter(_0x1b0b8a);}}}else{if(!_0x1b0b8a[_0x11ae('0xd')]){_0x1b0b8a['waiting']+=0x1;}if(_0x1b0b8a[_0x11ae('0xd')]){_0x1b0b8a[_0x11ae('0x7')]+=0x1;updateWaitingCounter(_0x1b0b8a);}}_0x1b0b8a[_0x11ae('0xa')]+=0x1;return _0x1b0b8a;}function getLastMessageText(_0x488db7){return db[_0x11ae('0xf')][_0x11ae('0x10')]({'where':{'$and':[{'MailInteractionId':_0x488db7['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x11ae('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x11ae('0x12')],'order':'-id','raw':!![]})[_0x11ae('0x13')](function(_0x57a0d3){if(_0x57a0d3&&_0x57a0d3[_0x11ae('0x12')]){_0x488db7[_0x11ae('0x14')]=_[_0x11ae('0x15')](_0x57a0d3['plainBody']);}return _0x488db7;})[_0x11ae('0x16')](function(_0x23421e){throw _0x23421e;});}exports[_0x11ae('0x17')]=function(_0x53e332,_0x33e298,_0x4e124f,_0x39bc95){return new Promise(function(_0x460ee3,_0x7055d2){return getInteractionUsers(_0x53e332['id'],_0x4e124f)[_0x11ae('0x13')](function(_0x26f9c6){_0x53e332[_0x11ae('0x18')]=_0x26f9c6;return getInteractionTags(_0x53e332[_0x11ae('0x19')],_0x33e298);})[_0x11ae('0x13')](function(_0x259609){_0x53e332[_0x11ae('0x1a')]=_0x259609;delete _0x53e332[_0x11ae('0x19')];return updateInteractionCounters(_0x53e332);})[_0x11ae('0x13')](function(_0x20f45c){if(_0x39bc95){return getLastMessageText(_0x20f45c);}else{return _0x20f45c;}})[_0x11ae('0x13')](function(_0x220727){_0x460ee3(_0x220727);})['catch'](function(_0x1614ea){_0x7055d2(_0x1614ea);});});}; \ No newline at end of file +var _0xc31c=['MailMessage','findOne','plainBody','-id','then','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','../../mysqldb','map','fullname','split','forEach','waiting','answered','total','closed','disposition','abandoned','UserId','talking','unmanaged'];(function(_0x33f53a,_0x24261e){var _0x5db392=function(_0x1ea1ee){while(--_0x1ea1ee){_0x33f53a['push'](_0x33f53a['shift']());}};_0x5db392(++_0x24261e);}(_0xc31c,0x144));var _0xcc31=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xc31c[_0x55f8b4];return _0x2475f9;};'use strict';var _=require('lodash');var db=require(_0xcc31('0x0'))['db'];function getInteractionUsers(_0x5960e6,_0x4a3184){return new Promise(function(_0x52e65b,_0x4489fe){try{var _0x4a5cb8=[];if(_0x4a3184[_0x5960e6]){_0x4a5cb8=_0x4a3184[_0x5960e6][_0xcc31('0x1')](function(_0x531195){return{'id':_0x531195['id'],'fullname':_0x531195[_0xcc31('0x2')]};});}return _0x52e65b(_0x4a5cb8);}catch(_0x583818){_0x4489fe(_0x583818);}});}function getInteractionTags(_0x2ae967,_0x4b1cff){var _0x4c3be5=[];if(_0x2ae967){_0x2ae967[_0xcc31('0x3')](',')[_0xcc31('0x4')](function(_0x4ec930){_0x4c3be5['push'](_0x4b1cff[_0x4ec930]);});}return _0x4c3be5;}function updateWaitingCounter(_0x2179a4){if(_0x2179a4[_0xcc31('0x5')]){_0x2179a4[_0xcc31('0x5')]-=0x1;}}function updateInteractionCounters(_0x16e17b){_0x16e17b['waiting']=0x0;_0x16e17b['talking']=0x0;_0x16e17b[_0xcc31('0x6')]=0x0;_0x16e17b['unmanaged']=0x0;_0x16e17b['abandoned']=0x0;_0x16e17b[_0xcc31('0x7')]=0x0;if(_0x16e17b[_0xcc31('0x8')]){if(_0x16e17b[_0xcc31('0x9')]===_0xcc31('0xa')){_0x16e17b[_0xcc31('0xa')]+=0x1;updateWaitingCounter(_0x16e17b);}if(_0x16e17b[_0xcc31('0xb')]){_0x16e17b[_0xcc31('0x6')]+=0x1;if(_0x16e17b['talking']){_0x16e17b[_0xcc31('0xc')]-=0x1;}}else{if(_0x16e17b[_0xcc31('0x9')]){_0x16e17b[_0xcc31('0xd')]+=0x1;updateWaitingCounter(_0x16e17b);}}}else{if(!_0x16e17b[_0xcc31('0xb')]){_0x16e17b[_0xcc31('0x5')]+=0x1;}if(_0x16e17b['UserId']){_0x16e17b[_0xcc31('0xc')]+=0x1;updateWaitingCounter(_0x16e17b);}}_0x16e17b['total']+=0x1;return _0x16e17b;}function getLastMessageText(_0x45b606){return db[_0xcc31('0xe')][_0xcc31('0xf')]({'where':{'$and':[{'MailInteractionId':_0x45b606['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xcc31('0x10')],'order':_0xcc31('0x11'),'raw':!![]})[_0xcc31('0x12')](function(_0x2290f8){if(_0x2290f8&&_0x2290f8[_0xcc31('0x10')]){_0x45b606[_0xcc31('0x13')]=_[_0xcc31('0x14')](_0x2290f8['plainBody']);}return _0x45b606;})[_0xcc31('0x15')](function(_0x20b52a){throw _0x20b52a;});}exports[_0xcc31('0x16')]=function(_0x50e155,_0x477881,_0x3d7173,_0x42bb9b){return new Promise(function(_0x5806d7,_0x4fb44c){return getInteractionUsers(_0x50e155['id'],_0x3d7173)[_0xcc31('0x12')](function(_0x3c1c7c){_0x50e155[_0xcc31('0x17')]=_0x3c1c7c;return getInteractionTags(_0x50e155[_0xcc31('0x18')],_0x477881);})['then'](function(_0x37fe6d){_0x50e155[_0xcc31('0x19')]=_0x37fe6d;delete _0x50e155['TagIds'];return updateInteractionCounters(_0x50e155);})['then'](function(_0x58f0e3){if(_0x42bb9b){return getLastMessageText(_0x58f0e3);}else{return _0x58f0e3;}})[_0xcc31('0x12')](function(_0x5a7327){_0x5806d7(_0x5a7327);})[_0xcc31('0x15')](function(_0x95bea0){_0x4fb44c(_0x95bea0);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index c7a465e..4219c56 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 _0x645f=['InteractionId','upperFirst','unknown','_messages','user_has_','_interactions','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','Interaction','findOne','then','update','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','mail-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x645f,0x19a));var _0xf645=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x645f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf645('0x0'));var db=require(_0xf645('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0xf645('0x2'))(_0xf645('0x3')),'fax':require('../../config/logger')('fax-interactions'),'sms':require(_0xf645('0x2'))(_0xf645('0x4')),'chat':require(_0xf645('0x2'))(_0xf645('0x5')),'whatsapp':require(_0xf645('0x2'))(_0xf645('0x6'))};function getAccountFK(_0x284ab2){return _[_0xf645('0x7')](_0x284ab2)+(_0x284ab2===_0xf645('0x8')?_0xf645('0x9'):'Account')+'Id';}function getInteractionFK(_0x5de72e){return _[_0xf645('0x7')](_0x5de72e)+_0xf645('0xa');}function getInteractionId(_0x2ebbe4,_0xb2f994,_0x4a9d84){if(_0x2ebbe4&&_0x2ebbe4[_['upperFirst'](_0x4a9d84)+_0xf645('0xa')]){return _0x2ebbe4[_[_0xf645('0xb')](_0x4a9d84)+_0xf645('0xa')];}else if(_0x2ebbe4&&_0x2ebbe4['id']){return _0x2ebbe4['id'];}else if(_0xb2f994&&_0xb2f994['id']){return _0xb2f994['id'];}else{return _0xf645('0xc');}}function getInteractionsTables(_0x7a1756){return{'accounts':_0x7a1756+'_'+(_0x7a1756===_0xf645('0x8')?'websites':'accounts'),'interactions':_0x7a1756+'_interactions','interactionsTags':_0x7a1756+'_interaction_has_tags','messages':_0x7a1756+_0xf645('0xd'),'userInteractions':_0xf645('0xe')+_0x7a1756+_0xf645('0xf')};}function getSelectedTags(_0x1d6989){var _0x2792d5=[];if(_0x1d6989){_0x2792d5=Array[_0xf645('0x10')](_0x1d6989)?_0x1d6989:[_0x1d6989];}return _0x2792d5;}function log(_0x5da159,_0x2bdf64,_0x100bae,_0x25c7db,_0x4b4543,_0x33811b){loggers[_0x4b4543['toLowerCase']()][_0x5da159](_0xf645('0x11'),_0x33811b[_0xf645('0x12')](),_0x2bdf64?_0x2bdf64['id']:null,_0x2bdf64?_0x2bdf64['name']:null,_0x2bdf64?_0x2bdf64[_0xf645('0x13')]:null,getInteractionId(_0x100bae,_0x25c7db,_0x4b4543),_0x100bae?JSON['stringify'](_0x100bae):'null');}function updateUser(_0x3e59ac,_0x358169,_0x230049,_0x478e99,_0x2f6852){db[_['upperFirst'](_0x478e99)+_0xf645('0x14')][_0xf645('0x15')]({'where':{'id':getInteractionId(_0x358169,_0x230049,_0x478e99)}})[_0xf645('0x16')](function(_0x25ee29){if(_0x25ee29){return _0x25ee29[_0xf645('0x17')]({'UserId':_0x3e59ac?_0x3e59ac['id']:null});}})[_0xf645('0x16')](function(_0x4d2996){if(_0x4d2996){log(_0xf645('0x18'),_0x3e59ac,_0x358169,_0x230049,_0x478e99,_0x2f6852);}})[_0xf645('0x19')](function(){log(_0xf645('0x1a'),_0x3e59ac,_0x358169,_0x230049,_0x478e99,_0x2f6852);});}module[_0xf645('0x1b')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xca4d=['fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','Website','Account','capitalize','upperFirst','InteractionId','unknown','chat','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','findOne','update','then','info','error','exports','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0xca4d,0x11c));var _0xdca4=function(_0x8b67fc,_0x393958){_0x8b67fc=_0x8b67fc-0x0;var _0x424a6e=_0xca4d[_0x8b67fc];return _0x424a6e;};'use strict';var _=require('lodash');var db=require(_0xdca4('0x0'))['db'];var loggers={'openchannel':require(_0xdca4('0x1'))(_0xdca4('0x2')),'mail':require(_0xdca4('0x1'))(_0xdca4('0x3')),'fax':require('../../config/logger')(_0xdca4('0x4')),'sms':require(_0xdca4('0x1'))(_0xdca4('0x5')),'chat':require('../../config/logger')(_0xdca4('0x6')),'whatsapp':require('../../config/logger')(_0xdca4('0x7'))};function getAccountFK(_0x5f0c06){return _['capitalize'](_0x5f0c06)+(_0x5f0c06==='chat'?_0xdca4('0x8'):_0xdca4('0x9'))+'Id';}function getInteractionFK(_0x3bfaea){return _[_0xdca4('0xa')](_0x3bfaea)+'InteractionId';}function getInteractionId(_0x2a13ef,_0x2ad3b5,_0x34b152){if(_0x2a13ef&&_0x2a13ef[_[_0xdca4('0xb')](_0x34b152)+'InteractionId']){return _0x2a13ef[_[_0xdca4('0xb')](_0x34b152)+_0xdca4('0xc')];}else if(_0x2a13ef&&_0x2a13ef['id']){return _0x2a13ef['id'];}else if(_0x2ad3b5&&_0x2ad3b5['id']){return _0x2ad3b5['id'];}else{return _0xdca4('0xd');}}function getInteractionsTables(_0x5baf9f){return{'accounts':_0x5baf9f+'_'+(_0x5baf9f===_0xdca4('0xe')?_0xdca4('0xf'):_0xdca4('0x10')),'interactions':_0x5baf9f+_0xdca4('0x11'),'interactionsTags':_0x5baf9f+_0xdca4('0x12'),'messages':_0x5baf9f+_0xdca4('0x13'),'userInteractions':_0xdca4('0x14')+_0x5baf9f+_0xdca4('0x11')};}function getSelectedTags(_0x1d14a3){var _0x4d6286=[];if(_0x1d14a3){_0x4d6286=Array['isArray'](_0x1d14a3)?_0x1d14a3:[_0x1d14a3];}return _0x4d6286;}function log(_0x4d54ed,_0x52daee,_0x24ae57,_0x39d30d,_0x57a80d,_0x1e0ece){loggers[_0x57a80d[_0xdca4('0x15')]()][_0x4d54ed](_0xdca4('0x16'),_0x1e0ece[_0xdca4('0x17')](),_0x52daee?_0x52daee['id']:null,_0x52daee?_0x52daee[_0xdca4('0x18')]:null,_0x52daee?_0x52daee['role']:null,getInteractionId(_0x24ae57,_0x39d30d,_0x57a80d),_0x24ae57?JSON[_0xdca4('0x19')](_0x24ae57):'null');}function updateUser(_0x53a0b9,_0x512a70,_0x5983a1,_0x903b42,_0x3a2c33){db[_[_0xdca4('0xb')](_0x903b42)+'Interaction'][_0xdca4('0x1a')]({'where':{'id':getInteractionId(_0x512a70,_0x5983a1,_0x903b42)}})['then'](function(_0x2334f0){if(_0x2334f0){return _0x2334f0[_0xdca4('0x1b')]({'UserId':_0x53a0b9?_0x53a0b9['id']:null});}})[_0xdca4('0x1c')](function(_0xc026c){if(_0xc026c){log(_0xdca4('0x1d'),_0x53a0b9,_0x512a70,_0x5983a1,_0x903b42,_0x3a2c33);}})['catch'](function(){log(_0xdca4('0x1e'),_0x53a0b9,_0x512a70,_0x5983a1,_0x903b42,_0x3a2c33);});}module[_0xdca4('0x1f')]={'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 6086301..a9ec918 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 _0x451a=['hasOwnProperty','use','License','findOne','then','count','status','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','util','../../mysqldb','../../config/environment','data1','license','split','%s:%s:%s','update','utf8','parse'];(function(_0x26ee89,_0x3bb107){var _0x3a626f=function(_0x1eba88){while(--_0x1eba88){_0x26ee89['push'](_0x26ee89['shift']());}};_0x3a626f(++_0x3bb107);}(_0x451a,0x186));var _0xa451=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x451a[_0x3e44fa];return _0x2a0aba;};'use strict';var crypto=require('crypto');var util=require(_0xa451('0x0'));var compose=require('composable-middleware');var db=require(_0xa451('0x1'))['db'];var config=require(_0xa451('0x2'));function getValueFromLicense(_0x1250f3,_0x437bbc){if(_0x1250f3&&_0x437bbc){if(_0x437bbc[_0xa451('0x3')]&&_0x437bbc[_0xa451('0x4')]){var _0xb9fa3d=_0x437bbc[_0xa451('0x3')];var _0x214487=_0x437bbc[_0xa451('0x4')];var _0x5c91b5=_0xb9fa3d[_0xa451('0x5')]('-')[0x4];var _0x62314=_0xb9fa3d[_0xa451('0x5')]('-')[0x0];var _0x533212=crypto['createDecipher']('aes-256-ctr',util['format'](_0xa451('0x6'),_0x5c91b5,_0xb9fa3d,_0x62314));var _0x1f2679=_0x533212[_0xa451('0x7')](_0x214487,'base64',_0xa451('0x8'));_0x1f2679+=_0x533212['final'](_0xa451('0x8'));var _0x17f4f4=JSON[_0xa451('0x9')](_0x1f2679);return _0x17f4f4[_0xa451('0xa')](_0x1250f3)?_0x17f4f4[_0x1250f3]:null;}}return null;}function isLimit(_0x105474,_0x5e6ddd,_0xc01e3a,_0x58c4e6){var _0x3e1be1=_0x5e6ddd;return compose()[_0xa451('0xb')](function(_0x49b126,_0x5825bc,_0x350e2b){return db[_0xa451('0xc')][_0xa451('0xd')]({'where':{'id':0x1},'raw':!![]})[_0xa451('0xe')](function(_0x3f32c7){var _0x9ce3a4=getValueFromLicense(_0x105474,_0x3f32c7);return _0x9ce3a4?_0x9ce3a4:_0x3e1be1;})[_0xa451('0xe')](function(_0x36a25a){_0x3e1be1=_0x36a25a;return _0xc01e3a[_0xa451('0xf')](_0x58c4e6);})[_0xa451('0xe')](function(_0x28025d){if(_0x28025d>=_0x3e1be1){return _0x5825bc[_0xa451('0x10')](0x193)['json']({'message':util[_0xa451('0x11')](_0xa451('0x12'),_0x105474)});}_0x350e2b();})[_0xa451('0x13')](function(_0x4ff946){_0x350e2b(_0x4ff946);});});}function isUserLimit(){return isLimit(_0xa451('0x14'),0x1,db[_0xa451('0x15')],{'where':{'$or':[{'role':_0xa451('0x16')},{'role':_0xa451('0x17')}]}});}exports[_0xa451('0x18')]=isUserLimit; \ No newline at end of file +var _0x1b7f=['split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','parse','hasOwnProperty','License','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1b7f,0x65));var _0xf1b7=function(_0x227d91,_0x414e00){_0x227d91=_0x227d91-0x0;var _0x1266b6=_0x1b7f[_0x227d91];return _0x1266b6;};'use strict';var crypto=require(_0xf1b7('0x0'));var util=require(_0xf1b7('0x1'));var compose=require(_0xf1b7('0x2'));var db=require(_0xf1b7('0x3'))['db'];var config=require(_0xf1b7('0x4'));function getValueFromLicense(_0x1e7b31,_0x4448dd){if(_0x1e7b31&&_0x4448dd){if(_0x4448dd[_0xf1b7('0x5')]&&_0x4448dd[_0xf1b7('0x6')]){var _0x249693=_0x4448dd['data1'];var _0x1d4e3e=_0x4448dd[_0xf1b7('0x6')];var _0x9fa8d5=_0x249693[_0xf1b7('0x7')]('-')[0x4];var _0xdeafcb=_0x249693[_0xf1b7('0x7')]('-')[0x0];var _0x4d3aaf=crypto['createDecipher'](_0xf1b7('0x8'),util[_0xf1b7('0x9')](_0xf1b7('0xa'),_0x9fa8d5,_0x249693,_0xdeafcb));var _0x401919=_0x4d3aaf[_0xf1b7('0xb')](_0x1d4e3e,_0xf1b7('0xc'),_0xf1b7('0xd'));_0x401919+=_0x4d3aaf['final']('utf8');var _0x3943cf=JSON[_0xf1b7('0xe')](_0x401919);return _0x3943cf[_0xf1b7('0xf')](_0x1e7b31)?_0x3943cf[_0x1e7b31]:null;}}return null;}function isLimit(_0x245f3d,_0x1c32f3,_0x3a666b,_0x4b8ece){var _0x313c1e=_0x1c32f3;return compose()['use'](function(_0x51324,_0x3b5457,_0x5e71dd){return db[_0xf1b7('0x10')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x3f63c4){var _0xd27cde=getValueFromLicense(_0x245f3d,_0x3f63c4);return _0xd27cde?_0xd27cde:_0x313c1e;})[_0xf1b7('0x11')](function(_0x2c2cc8){_0x313c1e=_0x2c2cc8;return _0x3a666b[_0xf1b7('0x12')](_0x4b8ece);})[_0xf1b7('0x11')](function(_0x18540a){if(_0x18540a>=_0x313c1e){return _0x3b5457[_0xf1b7('0x13')](0x193)[_0xf1b7('0x14')]({'message':util[_0xf1b7('0x9')](_0xf1b7('0x15'),_0x245f3d)});}_0x5e71dd();})[_0xf1b7('0x16')](function(_0x58a815){_0x5e71dd(_0x58a815);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xf1b7('0x17')],{'where':{'$or':[{'role':_0xf1b7('0x18')},{'role':_0xf1b7('0x19')}]}});}exports[_0xf1b7('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index a1f536e..9bc35e3 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 _0x0145=['$ne','$notIn','\x20IS\x20NULL)','=\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?','<\x20?','>\x20?','<=\x20?','$gte','$in','start','$startsWith','utcOffset','add','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','split','length','slice','forEach','shift','match','filter','map','buildExpression','DATE','$eq','operator','$between','value','includes','$gt','days','format','castTo','text','CAST(','field','\x20AS\x20'];(function(_0x220540,_0x534c70){var _0x2b8b99=function(_0xc49724){while(--_0xc49724){_0x220540['push'](_0x220540['shift']());}};_0x2b8b99(++_0x534c70);}(_0x0145,0x1a3));var _0x5014=function(_0x2e546b,_0x2f41f3){_0x2e546b=_0x2e546b-0x0;var _0x53f60d=_0x0145[_0x2e546b];return _0x53f60d;};'use strict';var _=require(_0x5014('0x0'));var moment=require(_0x5014('0x1'));exports[_0x5014('0x2')]=function(_0x2fcf1f){var _0x5b8585={'conditions':[]};_0x5b8585[_0x5014('0x3')]=_[_0x5014('0x4')](_0x2fcf1f,_0x5014('0x5'))?'or':_0x5014('0x6');var _0x29f1f7=_0x2fcf1f[_0x5014('0x7')]('[$and]','')[_0x5014('0x7')](_0x5014('0x5'),'')[_0x5014('0x8')]('||');for(var _0x502a97=0x0;_0x502a97<_0x29f1f7[_0x5014('0x9')];_0x502a97++){var _0x49bd94=_0x29f1f7[_0x502a97][_0x5014('0x8')](':=');var _0x5e1149=_0x49bd94[0x0];var _0xef9a61=_0x49bd94[_0x5014('0xa')](0x1);_0xef9a61[_0x5014('0xb')](function(_0x4693ed){var _0x4615f9=_0x4693ed[_0x5014('0x8')]('[')[_0x5014('0xc')]();var _0x3703db=_0x4693ed[_0x5014('0xd')](/\[(.*?)\]/g);_0x3703db['forEach'](function(_0x30d13f){var _0x3a2e6b=_0x30d13f['split']('[')[_0x5014('0xe')](function(_0x256daa){return _0x256daa['indexOf'](']')>-0x1;})[_0x5014('0xf')](function(_0x4a80e7){return _0x4a80e7['split'](']')[0x0];})[0x0];_0x5b8585['conditions']['push']({'field':_0x5e1149,'operator':_0x4615f9,'value':_0x3a2e6b});});});}return _0x5b8585;};exports[_0x5014('0x10')]=function(_0x306e68,_0x5ab942,_0x2bb0d5){var _0x17056b={};if(_0x5ab942===_0x5014('0x11')){if(_0x2bb0d5['operator']===_0x5014('0x12')){_0x2bb0d5[_0x5014('0x13')]=_0x5014('0x14');_0x2bb0d5[_0x5014('0x15')]+=','+_0x2bb0d5[_0x5014('0x15')];}else if(_[_0x5014('0x16')]([_0x5014('0x17'),'$lte'],_0x2bb0d5[_0x5014('0x13')])){_0x2bb0d5[_0x5014('0x15')]=moment(_0x2bb0d5[_0x5014('0x15')])['add'](0x1,_0x5014('0x18'))[_0x5014('0x19')]('YYYY-MM-DD');}}if(_0x2bb0d5['castTo']){_0x5ab942=_0x2bb0d5[_0x5014('0x1a')];_0x17056b[_0x5014('0x1b')]=_0x5014('0x1c')+_0x306e68+'.'+_0x2bb0d5[_0x5014('0x1d')]+_0x5014('0x1e')+_0x2bb0d5[_0x5014('0x1a')]+')\x20'+parseOperator(_0x2bb0d5[_0x5014('0x13')]);}else{_0x17056b[_0x5014('0x1b')]=_0x306e68+'.'+_0x2bb0d5[_0x5014('0x1d')]+'\x20'+parseOperator(_0x2bb0d5[_0x5014('0x13')]);}if(_[_0x5014('0x16')]([_0x5014('0x1f'),_0x5014('0x20')],_0x2bb0d5['operator']))_0x17056b[_0x5014('0x1b')]='('+_0x17056b[_0x5014('0x1b')]+'\x20OR\x20'+_0x306e68+'.'+_0x2bb0d5[_0x5014('0x1d')]+_0x5014('0x21');_0x17056b[_0x5014('0x15')]=parseValue(_0x5ab942,_0x2bb0d5[_0x5014('0x13')],_0x2bb0d5[_0x5014('0x15')]);return _0x17056b;};function parseOperator(_0x29344e){var _0x311b1a;switch(_0x29344e){case'$in':_0x311b1a='IN\x20?';break;case _0x5014('0x20'):_0x311b1a='NOT\x20IN\x20?';break;case'$eq':_0x311b1a=_0x5014('0x22');break;case _0x5014('0x1f'):_0x311b1a=_0x5014('0x23');break;case _0x5014('0x24'):case'$startsWith':case _0x5014('0x25'):_0x311b1a=_0x5014('0x26');break;case'$lt':_0x311b1a=_0x5014('0x27');break;case _0x5014('0x17'):_0x311b1a=_0x5014('0x28');break;case'$lte':_0x311b1a=_0x5014('0x29');break;case _0x5014('0x2a'):_0x311b1a='>=\x20?';break;case _0x5014('0x14'):_0x311b1a='BETWEEN\x20?\x20AND\x20?';break;}return _0x311b1a;}function parseValue(_0x3f1f1c,_0x2476cd,_0x1a9401){var _0x599a42={'start':undefined,'end':undefined};switch(_0x2476cd){case _0x5014('0x2b'):case _0x5014('0x20'):_0x599a42['start']=_0x1a9401[_0x5014('0x8')](',');break;case _0x5014('0x24'):_0x599a42[_0x5014('0x2c')]='%'+_0x1a9401+'%';break;case _0x5014('0x2d'):_0x599a42[_0x5014('0x2c')]=_0x1a9401+'%';break;case _0x5014('0x25'):_0x599a42[_0x5014('0x2c')]='%'+_0x1a9401;break;case _0x5014('0x14'):var _0x36ad3b=_0x1a9401[_0x5014('0x8')](',');var _0x1a9401=_0x36ad3b[_0x5014('0xc')]();var _0x569540=_0x36ad3b['pop']();if(_0x3f1f1c===_0x5014('0x11')){_0x1a9401=moment(_0x1a9401)[_0x5014('0x2e')](0x0,!![])[_0x5014('0x19')]();_0x569540=moment(_0x569540)[_0x5014('0x2e')](0x0,!![])['add'](0x17,'hours')[_0x5014('0x2f')](0x3b,_0x5014('0x30'))['add'](0x3b,_0x5014('0x31'))[_0x5014('0x19')]();}_0x599a42={'start':_0x1a9401,'end':_0x569540};break;default:_0x599a42['start']=_0x1a9401;break;}return _0x599a42;} \ No newline at end of file +var _0xf9ba=['>\x20?','<=\x20?','$gte','>=\x20?','start','$substring','pop','utcOffset','hours','minutes','seconds','lodash','parseSearch','startsWith','[$or]','and','replace','[$and]','split','length','slice','shift','match','forEach','filter','indexOf','push','DATE','$eq','operator','$between','includes','$gt','$lte','value','add','days','format','castTo','text','CAST(','\x20AS\x20','field','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','$startsWith','$endsWith','$lt'];(function(_0x423d72,_0x2d6813){var _0xceab52=function(_0xf1a90c){while(--_0xf1a90c){_0x423d72['push'](_0x423d72['shift']());}};_0xceab52(++_0x2d6813);}(_0xf9ba,0x71));var _0xaf9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf9ba[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xaf9b('0x0'));var moment=require('moment');exports[_0xaf9b('0x1')]=function(_0x4d5536){var _0x475cbd={'conditions':[]};_0x475cbd['sqlOperator']=_[_0xaf9b('0x2')](_0x4d5536,_0xaf9b('0x3'))?'or':_0xaf9b('0x4');var _0x15a5df=_0x4d5536[_0xaf9b('0x5')](_0xaf9b('0x6'),'')[_0xaf9b('0x5')](_0xaf9b('0x3'),'')[_0xaf9b('0x7')]('||');for(var _0x3a6d85=0x0;_0x3a6d85<_0x15a5df[_0xaf9b('0x8')];_0x3a6d85++){var _0x384fbb=_0x15a5df[_0x3a6d85]['split'](':=');var _0x50d563=_0x384fbb[0x0];var _0x23f16d=_0x384fbb[_0xaf9b('0x9')](0x1);_0x23f16d['forEach'](function(_0x2c5679){var _0xf9404c=_0x2c5679[_0xaf9b('0x7')]('[')[_0xaf9b('0xa')]();var _0x34278a=_0x2c5679[_0xaf9b('0xb')](/\[(.*?)\]/g);_0x34278a[_0xaf9b('0xc')](function(_0x15e6e5){var _0xd4b0ae=_0x15e6e5['split']('[')[_0xaf9b('0xd')](function(_0x5e1c21){return _0x5e1c21[_0xaf9b('0xe')](']')>-0x1;})['map'](function(_0x5ad9a0){return _0x5ad9a0[_0xaf9b('0x7')](']')[0x0];})[0x0];_0x475cbd['conditions'][_0xaf9b('0xf')]({'field':_0x50d563,'operator':_0xf9404c,'value':_0xd4b0ae});});});}return _0x475cbd;};exports['buildExpression']=function(_0x2135de,_0x5e4731,_0x2d6983){var _0x899a1b={};if(_0x5e4731===_0xaf9b('0x10')){if(_0x2d6983['operator']===_0xaf9b('0x11')){_0x2d6983[_0xaf9b('0x12')]=_0xaf9b('0x13');_0x2d6983['value']+=','+_0x2d6983['value'];}else if(_[_0xaf9b('0x14')]([_0xaf9b('0x15'),_0xaf9b('0x16')],_0x2d6983[_0xaf9b('0x12')])){_0x2d6983[_0xaf9b('0x17')]=moment(_0x2d6983[_0xaf9b('0x17')])[_0xaf9b('0x18')](0x1,_0xaf9b('0x19'))[_0xaf9b('0x1a')]('YYYY-MM-DD');}}if(_0x2d6983[_0xaf9b('0x1b')]){_0x5e4731=_0x2d6983[_0xaf9b('0x1b')];_0x899a1b[_0xaf9b('0x1c')]=_0xaf9b('0x1d')+_0x2135de+'.'+_0x2d6983['field']+_0xaf9b('0x1e')+_0x2d6983['castTo']+')\x20'+parseOperator(_0x2d6983['operator']);}else{_0x899a1b[_0xaf9b('0x1c')]=_0x2135de+'.'+_0x2d6983[_0xaf9b('0x1f')]+'\x20'+parseOperator(_0x2d6983[_0xaf9b('0x12')]);}if(_['includes']([_0xaf9b('0x20'),'$notIn'],_0x2d6983[_0xaf9b('0x12')]))_0x899a1b[_0xaf9b('0x1c')]='('+_0x899a1b['text']+_0xaf9b('0x21')+_0x2135de+'.'+_0x2d6983[_0xaf9b('0x1f')]+_0xaf9b('0x22');_0x899a1b['value']=parseValue(_0x5e4731,_0x2d6983[_0xaf9b('0x12')],_0x2d6983[_0xaf9b('0x17')]);return _0x899a1b;};function parseOperator(_0x3672f9){var _0x2338fd;switch(_0x3672f9){case _0xaf9b('0x23'):_0x2338fd='IN\x20?';break;case'$notIn':_0x2338fd=_0xaf9b('0x24');break;case'$eq':_0x2338fd='=\x20?';break;case'$ne':_0x2338fd='<>\x20?';break;case'$substring':case _0xaf9b('0x25'):case _0xaf9b('0x26'):_0x2338fd='LIKE\x20?';break;case _0xaf9b('0x27'):_0x2338fd='<\x20?';break;case _0xaf9b('0x15'):_0x2338fd=_0xaf9b('0x28');break;case _0xaf9b('0x16'):_0x2338fd=_0xaf9b('0x29');break;case _0xaf9b('0x2a'):_0x2338fd=_0xaf9b('0x2b');break;case _0xaf9b('0x13'):_0x2338fd='BETWEEN\x20?\x20AND\x20?';break;}return _0x2338fd;}function parseValue(_0x4332d9,_0x408945,_0x11f6ea){var _0x4e2362={'start':undefined,'end':undefined};switch(_0x408945){case _0xaf9b('0x23'):case'$notIn':_0x4e2362[_0xaf9b('0x2c')]=_0x11f6ea[_0xaf9b('0x7')](',');break;case _0xaf9b('0x2d'):_0x4e2362['start']='%'+_0x11f6ea+'%';break;case _0xaf9b('0x25'):_0x4e2362[_0xaf9b('0x2c')]=_0x11f6ea+'%';break;case'$endsWith':_0x4e2362[_0xaf9b('0x2c')]='%'+_0x11f6ea;break;case'$between':var _0x207ed2=_0x11f6ea['split'](',');var _0x11f6ea=_0x207ed2[_0xaf9b('0xa')]();var _0x49ea8b=_0x207ed2[_0xaf9b('0x2e')]();if(_0x4332d9===_0xaf9b('0x10')){_0x11f6ea=moment(_0x11f6ea)[_0xaf9b('0x2f')](0x0,!![])[_0xaf9b('0x1a')]();_0x49ea8b=moment(_0x49ea8b)[_0xaf9b('0x2f')](0x0,!![])['add'](0x17,_0xaf9b('0x30'))[_0xaf9b('0x18')](0x3b,_0xaf9b('0x31'))['add'](0x3b,_0xaf9b('0x32'))[_0xaf9b('0x1a')]();}_0x4e2362={'start':_0x11f6ea,'end':_0x49ea8b};break;default:_0x4e2362[_0xaf9b('0x2c')]=_0x11f6ea;break;}return _0x4e2362;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 9e52132..c70ef6f 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 _0xac31=['object','columns','value','merge','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','includes','split','filters','isEmpty','forOwn','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','$lte','utc','subtract','name','uniqueid','isArray','limit','offset','sort','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','unset','hasOwnProperty','omit','^[+]?[0-9]*$','isEmail','match','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','model','map','intersection','attributes','fields','length','nolimit','order','where','pick','filter'];(function(_0x5d9004,_0x231a97){var _0x5ba9bb=function(_0x2840b0){while(--_0x2840b0){_0x5d9004['push'](_0x5d9004['shift']());}};_0x5ba9bb(++_0x231a97);}(_0xac31,0xca));var _0x1ac3=function(_0x32d07e,_0x368427){_0x32d07e=_0x32d07e-0x0;var _0x52b2d5=_0xac31[_0x32d07e];return _0x52b2d5;};'use strict';var _=require(_0x1ac3('0x0'));var sequelize=require(_0x1ac3('0x1'));var moment=require(_0x1ac3('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x3086c0){var _0xd6934=['ne'];try{var _0x11dd6d=JSON[_0x1ac3('0x3')](_0x3086c0);var _0x59b42c=Object[_0x1ac3('0x4')](_0x11dd6d)[0x0];return _0xd6934[_0x1ac3('0x5')](_0x59b42c);}catch(_0x4dcc96){return![];}}function getOperatorValue(_0x5ef1b6){var _0xbe22b7=JSON[_0x1ac3('0x3')](_0x5ef1b6);var _0x2bf9b1=Object[_0x1ac3('0x4')](_0xbe22b7)[0x0];var _0x157604=_0xbe22b7[_0x2bf9b1];return{['$'+_0x2bf9b1]:_0x157604};}exports['fields']=function(_0x2d17de){var _0x4d7695=null;if(_0x2d17de){_0x4d7695=_0x2d17de[_0x1ac3('0x6')](',');}return _0x4d7695;};exports[_0x1ac3('0x7')]=function(_0x344674,_0x53500b){var _0xa26c88={};if(!_[_0x1ac3('0x8')](_0x344674)){_[_0x1ac3('0x9')](_0x344674,function(_0x24f0d2,_0x2a8dc7){try{if(_0x53500b){var _0x422d19=_['find'](_0x53500b,{'name':_0x2a8dc7})||{};if(hasSequelizeOperator(_0x24f0d2)){_0xa26c88[_0x2a8dc7]=getOperatorValue(_0x24f0d2);}else if(_0x422d19[_0x1ac3('0xa')]===_0x1ac3('0xb')&&_[_0x1ac3('0xc')](_0x24f0d2)){var _0x2338b9=JSON['parse'](_0x24f0d2);var _0x88ed7c={'$gte':moment(moment(_0x2338b9[_0x1ac3('0xd')])[_0x1ac3('0xe')](_0x1ac3('0xf')))['utc']()[_0x1ac3('0xe')](),'$lte':moment(moment(_0x2338b9[_0x1ac3('0x10')])['format'](_0x1ac3('0xf')))[_0x1ac3('0x11')]()[_0x1ac3('0x12')](0x1,'s')['format']()};_0xa26c88[_0x2a8dc7]=_0x88ed7c;}else if(_0x422d19[_0x1ac3('0x13')]===_0x1ac3('0x14')){_0xa26c88[_0x2a8dc7]=_0x24f0d2;}else{_0xa26c88[_0x2a8dc7]=_[_0x1ac3('0x15')](_0x24f0d2)?_0x24f0d2:JSON['parse'](_0x24f0d2);}}else{_0xa26c88[_0x2a8dc7]=_[_0x1ac3('0x15')](_0x24f0d2)?_0x24f0d2:JSON['parse'](_0x24f0d2);}}catch(_0x291616){_0xa26c88[_0x2a8dc7]=_0x24f0d2[_0x1ac3('0x6')](',');}});}return _0xa26c88;};exports[_0x1ac3('0x16')]=function(_0x3b7e51){_0x3b7e51=parseInt(_0x3b7e51,0xa);if(!_0x3b7e51||_0x3b7e51<0x0){_0x3b7e51=LIMIT_VALUE;}return _0x3b7e51;};exports[_0x1ac3('0x17')]=function(_0x557076){_0x557076=parseInt(_0x557076,0xa);if(!_0x557076||_0x557076<0x0){_0x557076=0x0;}return _0x557076;};exports[_0x1ac3('0x18')]=function(_0x2ea481){var _0x296abf,_0x257f60=null;if(_0x2ea481){_0x296abf=_0x2ea481['split'](',');_0x257f60=_['map'](_0x296abf,function(_0x2879d8){if(_0x2879d8[_0x1ac3('0x19')]('-')===0x0){return[_0x2879d8===_0x1ac3('0x1a')?sequelize[_0x1ac3('0x1b')](sequelize[_0x1ac3('0x1c')](_0x1ac3('0x1a')),_0x1ac3('0x1d')):_0x2879d8[_0x1ac3('0x1e')](0x1),_0x1ac3('0x1f')];}else{return[_0x2879d8==='priority'?sequelize[_0x1ac3('0x1b')](sequelize[_0x1ac3('0x1c')]('priority'),_0x1ac3('0x1d')):_0x2879d8,_0x1ac3('0x20')];}});}return _0x257f60;};exports['omit']=function(_0xf9affb,_0x2f65e8){if(_[_0x1ac3('0x8')](_0xf9affb)){return _0xf9affb;}if(_[_0x1ac3('0x15')](_0xf9affb)){for(var _0x10db3d=0x0;_0x10db3d<_0xf9affb['length'];_0x10db3d+=0x1){_0xf9affb[_0x10db3d]=this['omit'](_0xf9affb[_0x10db3d],_0x2f65e8);}return _0xf9affb;}if(!_['isObject'](_0xf9affb)){return _0xf9affb;}if(_['isString'](_0x2f65e8)){_0x2f65e8=[_0x2f65e8];}if(!_['isArray'](_0x2f65e8)){return _0xf9affb;}for(var _0x3ea482=0x0;_0x3ea482<_0x2f65e8['length'];_0x3ea482+=0x1){_[_0x1ac3('0x21')](_0xf9affb,_0x2f65e8[_0x3ea482]);}for(var _0x3e4a4e in _0xf9affb){if(_0xf9affb[_0x1ac3('0x22')](_0x3e4a4e)){_0xf9affb[_0x3e4a4e]=this[_0x1ac3('0x23')](_0xf9affb[_0x3e4a4e],_0x2f65e8);}}return _0xf9affb;};exports['isNumeric']=function(_0x61441d){return _0x61441d['match'](RegExp(_0x1ac3('0x24')))?!![]:![];};exports[_0x1ac3('0x25')]=function(_0x440aed){return _0x440aed[_0x1ac3('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0x1ac3('0x27')]=function(_0xc3f097){var _0x9c17c2=[];_0xc3f097['split'](/[ ,]+/)[_0x1ac3('0x28')](function(_0x3b4c65){_0x3b4c65=_0x3b4c65[_0x1ac3('0x29')](/([^:]")"+/g,'$1');_0x3b4c65='+'+_0x3b4c65+'*';var _0x47437c=/[ `!@#$%^&*()_\-?~]/;if(_0x3b4c65['match'](_0x47437c))_0x3b4c65='\x22'+_0x3b4c65+'\x22';_0x9c17c2[_0x1ac3('0x2a')](_0x3b4c65);});return _0x9c17c2[_0x1ac3('0x2b')]('\x20');};exports[_0x1ac3('0x2c')]=function(_0x294513,_0x204d78,_0x479b42){var _0xbeed18={},_0x760b65={};if(_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x2e')]){_0x204d78[_0x1ac3('0x2d')]['id']=_0x204d78[_0x1ac3('0x2d')]['$id'];delete _0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x2e')];}_0xbeed18[_0x1ac3('0x2f')]=_[_0x1ac3('0x30')](_0x294513,'name');_0xbeed18[_0x1ac3('0x2d')]=_[_0x1ac3('0x4')](_0x204d78[_0x1ac3('0x2d')]);_0xbeed18[_0x1ac3('0x7')]=_[_0x1ac3('0x31')](_0xbeed18[_0x1ac3('0x2f')],_0xbeed18[_0x1ac3('0x2d')]);_0x760b65[_0x1ac3('0x32')]=_[_0x1ac3('0x31')](_0xbeed18['model'],this[_0x1ac3('0x33')](_0x204d78[_0x1ac3('0x2d')]['fields']));_0x760b65[_0x1ac3('0x32')]=_0x760b65[_0x1ac3('0x32')][_0x1ac3('0x34')]?_0x760b65[_0x1ac3('0x32')]:_0xbeed18[_0x1ac3('0x2f')];if(!_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x22')](_0x1ac3('0x35'))){_0x760b65['limit']=this[_0x1ac3('0x16')](_0x204d78['query'][_0x1ac3('0x16')]);_0x760b65[_0x1ac3('0x17')]=this[_0x1ac3('0x17')](_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x17')]);}_0x760b65[_0x1ac3('0x36')]=this['sort'](_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x18')]);_0x760b65[_0x1ac3('0x37')]=this['filters'](_[_0x1ac3('0x38')](_0x204d78[_0x1ac3('0x2d')],_0xbeed18['filters']),_0x294513);if(_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x39')]){var _0xb4664e=_0x294513;var _0x1b0099=_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x39')];if(typeof _0x1b0099===_0x1ac3('0x3a')){_0xb4664e=_[_0x1ac3('0x39')](_0x294513,function(_0x48a0a2){return _[_0x1ac3('0x5')](_0x1b0099[_0x1ac3('0x3b')],_0x48a0a2[_0x1ac3('0x13')]);});_0x1b0099=_0x1b0099[_0x1ac3('0x3c')];}_0x760b65[_0x1ac3('0x37')]=_[_0x1ac3('0x3d')](_0x760b65[_0x1ac3('0x37')],{'$or':_['map'](_0xb4664e,function(_0x4edc4d){if(_0x4edc4d[_0x1ac3('0xa')]!==_0x1ac3('0x3e')){if(_0x479b42){return sequelize['where'](sequelize['fn'](_0x1ac3('0x3f'),sequelize[_0x1ac3('0x1c')](_0x4edc4d['name'])),{'$like':sequelize['fn'](_0x1ac3('0x3f'),'%'+_0x204d78['query'][_0x1ac3('0x39')]+'%')});}else{var _0x406f0d={};_0x406f0d[_0x4edc4d[_0x1ac3('0x13')]]={'$like':'%'+_0x204d78[_0x1ac3('0x2d')]['filter']+'%'};return _0x406f0d;}}})});}_0x760b65=_[_0x1ac3('0x3d')]({},_0x760b65,_0x204d78[_0x1ac3('0x40')]);return _0x760b65;}; \ No newline at end of file +var _0xef17=['ASC','omit','length','isObject','unset','hasOwnProperty','^[+]?[0-9]*$','isEmail','getFullTextValue','match','query','$id','model','attributes','intersection','nolimit','limit','order','where','pick','filter','object','includes','columns','value','merge','map','type','lower','options','lodash','sequelize','moment','parse','keys','fields','split','filters','isEmpty','forOwn','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','name','isArray','offset','sort','indexOf','priority','cast','col','unsigned','substr'];(function(_0x57437b,_0x389bff){var _0x1e47e0=function(_0x534144){while(--_0x534144){_0x57437b['push'](_0x57437b['shift']());}};_0x1e47e0(++_0x389bff);}(_0xef17,0x136));var _0x7ef1=function(_0x4e5d5e,_0x25501d){_0x4e5d5e=_0x4e5d5e-0x0;var _0x46beb7=_0xef17[_0x4e5d5e];return _0x46beb7;};'use strict';var _=require(_0x7ef1('0x0'));var sequelize=require(_0x7ef1('0x1'));var moment=require(_0x7ef1('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x11f6b7){var _0x601558=['ne'];try{var _0x2c0aac=JSON[_0x7ef1('0x3')](_0x11f6b7);var _0x19a10d=Object[_0x7ef1('0x4')](_0x2c0aac)[0x0];return _0x601558['includes'](_0x19a10d);}catch(_0x1d2f83){return![];}}function getOperatorValue(_0x514b70){var _0x138ed1=JSON['parse'](_0x514b70);var _0x34a040=Object['keys'](_0x138ed1)[0x0];var _0x5aec63=_0x138ed1[_0x34a040];return{['$'+_0x34a040]:_0x5aec63};}exports[_0x7ef1('0x5')]=function(_0x3398a6){var _0x56ab07=null;if(_0x3398a6){_0x56ab07=_0x3398a6[_0x7ef1('0x6')](',');}return _0x56ab07;};exports[_0x7ef1('0x7')]=function(_0x4534fc,_0x3d47e2){var _0x2cb9b0={};if(!_[_0x7ef1('0x8')](_0x4534fc)){_[_0x7ef1('0x9')](_0x4534fc,function(_0x4bedd1,_0x4da8e8){try{if(_0x3d47e2){var _0x1d4522=_['find'](_0x3d47e2,{'name':_0x4da8e8})||{};if(hasSequelizeOperator(_0x4bedd1)){_0x2cb9b0[_0x4da8e8]=getOperatorValue(_0x4bedd1);}else if(_0x1d4522['type']==='DATE'&&_[_0x7ef1('0xa')](_0x4bedd1)){var _0x51e226=JSON[_0x7ef1('0x3')](_0x4bedd1);var _0x29c920={'$gte':moment(moment(_0x51e226[_0x7ef1('0xb')])[_0x7ef1('0xc')](_0x7ef1('0xd')))[_0x7ef1('0xe')]()[_0x7ef1('0xc')](),'$lte':moment(moment(_0x51e226[_0x7ef1('0xf')])['format']('YYYY-MM-DD'))[_0x7ef1('0xe')]()['subtract'](0x1,'s')[_0x7ef1('0xc')]()};_0x2cb9b0[_0x4da8e8]=_0x29c920;}else if(_0x1d4522[_0x7ef1('0x10')]==='uniqueid'){_0x2cb9b0[_0x4da8e8]=_0x4bedd1;}else{_0x2cb9b0[_0x4da8e8]=_['isArray'](_0x4bedd1)?_0x4bedd1:JSON['parse'](_0x4bedd1);}}else{_0x2cb9b0[_0x4da8e8]=_[_0x7ef1('0x11')](_0x4bedd1)?_0x4bedd1:JSON['parse'](_0x4bedd1);}}catch(_0x3a5835){_0x2cb9b0[_0x4da8e8]=_0x4bedd1['split'](',');}});}return _0x2cb9b0;};exports['limit']=function(_0x5b7e36){_0x5b7e36=parseInt(_0x5b7e36,0xa);if(!_0x5b7e36||_0x5b7e36<0x0){_0x5b7e36=LIMIT_VALUE;}return _0x5b7e36;};exports[_0x7ef1('0x12')]=function(_0x575a75){_0x575a75=parseInt(_0x575a75,0xa);if(!_0x575a75||_0x575a75<0x0){_0x575a75=0x0;}return _0x575a75;};exports[_0x7ef1('0x13')]=function(_0x2a8fab){var _0x5291b0,_0x568d0a=null;if(_0x2a8fab){_0x5291b0=_0x2a8fab[_0x7ef1('0x6')](',');_0x568d0a=_['map'](_0x5291b0,function(_0x458459){if(_0x458459[_0x7ef1('0x14')]('-')===0x0){return[_0x458459===_0x7ef1('0x15')?sequelize[_0x7ef1('0x16')](sequelize[_0x7ef1('0x17')](_0x7ef1('0x15')),_0x7ef1('0x18')):_0x458459[_0x7ef1('0x19')](0x1),'DESC'];}else{return[_0x458459===_0x7ef1('0x15')?sequelize[_0x7ef1('0x16')](sequelize[_0x7ef1('0x17')](_0x7ef1('0x15')),_0x7ef1('0x18')):_0x458459,_0x7ef1('0x1a')];}});}return _0x568d0a;};exports[_0x7ef1('0x1b')]=function(_0x144e74,_0x508a5f){if(_['isEmpty'](_0x144e74)){return _0x144e74;}if(_[_0x7ef1('0x11')](_0x144e74)){for(var _0x12ef5a=0x0;_0x12ef5a<_0x144e74[_0x7ef1('0x1c')];_0x12ef5a+=0x1){_0x144e74[_0x12ef5a]=this[_0x7ef1('0x1b')](_0x144e74[_0x12ef5a],_0x508a5f);}return _0x144e74;}if(!_[_0x7ef1('0x1d')](_0x144e74)){return _0x144e74;}if(_['isString'](_0x508a5f)){_0x508a5f=[_0x508a5f];}if(!_[_0x7ef1('0x11')](_0x508a5f)){return _0x144e74;}for(var _0x9eca93=0x0;_0x9eca93<_0x508a5f[_0x7ef1('0x1c')];_0x9eca93+=0x1){_[_0x7ef1('0x1e')](_0x144e74,_0x508a5f[_0x9eca93]);}for(var _0x232f4e in _0x144e74){if(_0x144e74[_0x7ef1('0x1f')](_0x232f4e)){_0x144e74[_0x232f4e]=this[_0x7ef1('0x1b')](_0x144e74[_0x232f4e],_0x508a5f);}}return _0x144e74;};exports['isNumeric']=function(_0x2e8f1b){return _0x2e8f1b['match'](RegExp(_0x7ef1('0x20')))?!![]:![];};exports[_0x7ef1('0x21')]=function(_0x4b5fde){return _0x4b5fde['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x7ef1('0x22')]=function(_0x1136dc){var _0x5ab3a5=[];_0x1136dc[_0x7ef1('0x6')](/[ ,]+/)['forEach'](function(_0x3aa113){_0x3aa113=_0x3aa113['replace'](/([^:]")"+/g,'$1');_0x3aa113='+'+_0x3aa113+'*';var _0x122999=/[ `!@#$%^&*()_\-?~]/;if(_0x3aa113[_0x7ef1('0x23')](_0x122999))_0x3aa113='\x22'+_0x3aa113+'\x22';_0x5ab3a5['push'](_0x3aa113);});return _0x5ab3a5['join']('\x20');};exports['getOptions']=function(_0x5f2976,_0x1b72a1,_0x36b83f){var _0x596abe={},_0x1110f5={};if(_0x1b72a1['query']['$id']){_0x1b72a1[_0x7ef1('0x24')]['id']=_0x1b72a1['query'][_0x7ef1('0x25')];delete _0x1b72a1[_0x7ef1('0x24')][_0x7ef1('0x25')];}_0x596abe[_0x7ef1('0x26')]=_['map'](_0x5f2976,_0x7ef1('0x10'));_0x596abe[_0x7ef1('0x24')]=_['keys'](_0x1b72a1['query']);_0x596abe['filters']=_['intersection'](_0x596abe[_0x7ef1('0x26')],_0x596abe['query']);_0x1110f5[_0x7ef1('0x27')]=_[_0x7ef1('0x28')](_0x596abe[_0x7ef1('0x26')],this[_0x7ef1('0x5')](_0x1b72a1[_0x7ef1('0x24')][_0x7ef1('0x5')]));_0x1110f5[_0x7ef1('0x27')]=_0x1110f5[_0x7ef1('0x27')][_0x7ef1('0x1c')]?_0x1110f5[_0x7ef1('0x27')]:_0x596abe[_0x7ef1('0x26')];if(!_0x1b72a1['query'][_0x7ef1('0x1f')](_0x7ef1('0x29'))){_0x1110f5['limit']=this[_0x7ef1('0x2a')](_0x1b72a1[_0x7ef1('0x24')][_0x7ef1('0x2a')]);_0x1110f5[_0x7ef1('0x12')]=this[_0x7ef1('0x12')](_0x1b72a1['query'][_0x7ef1('0x12')]);}_0x1110f5[_0x7ef1('0x2b')]=this[_0x7ef1('0x13')](_0x1b72a1[_0x7ef1('0x24')][_0x7ef1('0x13')]);_0x1110f5[_0x7ef1('0x2c')]=this[_0x7ef1('0x7')](_[_0x7ef1('0x2d')](_0x1b72a1[_0x7ef1('0x24')],_0x596abe[_0x7ef1('0x7')]),_0x5f2976);if(_0x1b72a1[_0x7ef1('0x24')][_0x7ef1('0x2e')]){var _0x2da912=_0x5f2976;var _0x39b280=_0x1b72a1[_0x7ef1('0x24')]['filter'];if(typeof _0x39b280===_0x7ef1('0x2f')){_0x2da912=_[_0x7ef1('0x2e')](_0x5f2976,function(_0x302212){return _[_0x7ef1('0x30')](_0x39b280[_0x7ef1('0x31')],_0x302212[_0x7ef1('0x10')]);});_0x39b280=_0x39b280[_0x7ef1('0x32')];}_0x1110f5[_0x7ef1('0x2c')]=_[_0x7ef1('0x33')](_0x1110f5[_0x7ef1('0x2c')],{'$or':_[_0x7ef1('0x34')](_0x2da912,function(_0x374bf5){if(_0x374bf5[_0x7ef1('0x35')]!=='VIRTUAL'){if(_0x36b83f){return sequelize[_0x7ef1('0x2c')](sequelize['fn'](_0x7ef1('0x36'),sequelize[_0x7ef1('0x17')](_0x374bf5[_0x7ef1('0x10')])),{'$like':sequelize['fn'](_0x7ef1('0x36'),'%'+_0x1b72a1[_0x7ef1('0x24')]['filter']+'%')});}else{var _0x4448ca={};_0x4448ca[_0x374bf5[_0x7ef1('0x10')]]={'$like':'%'+_0x1b72a1[_0x7ef1('0x24')][_0x7ef1('0x2e')]+'%'};return _0x4448ca;}}})});}_0x1110f5=_[_0x7ef1('0x33')]({},_0x1110f5,_0x1b72a1[_0x7ef1('0x37')]);return _0x1110f5;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index b3fc72f..cf2abd9 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 _0xcda2=['result','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','unknown','*pause','busy','getAgentStatus','isArray','startCase','Queue','findOne','flatten','uniq','value','getAgentIdsByQueues','includes','map','getAgentIdsByStatus','name','fullname','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','order','startsWith','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','address','mailCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','pick','lodash','jayson/promise','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','whatsappPause','every','filter','length','idle','ringing','isNil','voicePause','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','then','error'];(function(_0x29228f,_0x1bf6c5){var _0x4b55b6=function(_0x4d1ee5){while(--_0x4d1ee5){_0x29228f['push'](_0x29228f['shift']());}};_0x4b55b6(++_0x1bf6c5);}(_0xcda2,0x1a6));var _0x2cda=function(_0x5bbe7e,_0x19c08f){_0x5bbe7e=_0x5bbe7e-0x0;var _0x6ebda1=_0xcda2[_0x5bbe7e];return _0x6ebda1;};'use strict';var _=require(_0x2cda('0x0'));var jayson=require(_0x2cda('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x2cda('0x2')][_0x2cda('0x3')]({'port':0x232a});var routingClient=jayson[_0x2cda('0x2')][_0x2cda('0x3')]({'port':0x232c});function isAgentPaused(_0x20008a,_0x65075d){var _0x13f7e9=[_0x20008a[_0x2cda('0x4')],_0x20008a[_0x2cda('0x5')],_0x20008a[_0x2cda('0x6')],_0x20008a[_0x2cda('0x7')],_0x20008a[_0x2cda('0x8')],_0x20008a['voicePause'],_0x20008a[_0x2cda('0x9')]];if(!_0x65075d)return _[_0x2cda('0xa')](_0x13f7e9);var _0x38a23d=_[_0x2cda('0xb')](_0x13f7e9);return _0x38a23d[_0x2cda('0xc')]>0x0&&_0x38a23d[_0x2cda('0xc')]<_0x13f7e9['length']?!![]:![];}function isIdle(_0x4a4c1a){return _0x4a4c1a===_0x2cda('0xd')||_0x4a4c1a==='unknown'||_0x4a4c1a==='unavailable'||_0x4a4c1a===_0x2cda('0xe')||_[_0x2cda('0xf')](_0x4a4c1a);}function isAgentIdle(_0x3d9d4e){if(_0x3d9d4e['voiceStatus']!=='idle'&&_0x3d9d4e[_0x2cda('0x10')]){_0x3d9d4e[_0x2cda('0x11')]=_0x2cda('0x12');return![];}return _[_0x2cda('0xa')]([_0x3d9d4e[_0x2cda('0x13')],_0x3d9d4e[_0x2cda('0x14')],_0x3d9d4e[_0x2cda('0x15')],_0x3d9d4e[_0x2cda('0x16')],_0x3d9d4e[_0x2cda('0x17')],_0x3d9d4e[_0x2cda('0x11')],_0x3d9d4e[_0x2cda('0x18')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x2cda('0x19')]('Agents',{})[_0x2cda('0x1a')](function(_0x820c45){if(_0x820c45[_0x2cda('0x1b')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x4522ee=_0x820c45[_0x2cda('0x1c')];return routingClient['request'](_0x2cda('0x1d'),{})['then'](function(_0x3b0550){if(_0x3b0550[_0x2cda('0x1b')]){throw new Error(_0x2cda('0x1e'));}var _0x27d38f=_0x3b0550[_0x2cda('0x1c')];return _[_0x2cda('0x1f')]({},_0x4522ee,_0x27d38f);});})[_0x2cda('0x20')](function(_0x5aaec7){throw _0x5aaec7;});}exports[_0x2cda('0x21')]=getRealtimeAgents;function getAgentStatus(_0x4cf2a4){var _0x52fbb7=_0x2cda('0x22');if(isAgentPaused(_0x4cf2a4))_0x52fbb7=_0x2cda('0x12');else if(isAgentPaused(_0x4cf2a4,!![]))_0x52fbb7=_0x2cda('0x23');else if(isAgentIdle(_0x4cf2a4))_0x52fbb7=_0x2cda('0xd');else _0x52fbb7=_0x2cda('0x24');return _0x52fbb7;}exports[_0x2cda('0x25')]=getAgentStatus;function getAgentIdsByQueues(_0xb141d8,_0x42fcca){var _0x363f2e=_[_0x2cda('0x26')](_0xb141d8)?_0xb141d8:[_0xb141d8];var _0x4ce134=_[_0x2cda('0x27')](_0x42fcca)+_0x2cda('0x28');var _0x531199=_['map'](_0x363f2e,function(_0x3da041){return db[_0x4ce134][_0x2cda('0x29')]({'where':{'id':_0x3da041}})[_0x2cda('0x1a')](function(_0x55155f){if(!_0x55155f)return[];return _0x55155f['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x531199)[_0x2cda('0x1a')](function(_0xcca3b1){var _0x573d59=_(_0xcca3b1)[_0x2cda('0x2a')]()['map']('id')[_0x2cda('0x2b')]()[_0x2cda('0x2c')]();return _0x573d59;});}exports[_0x2cda('0x2d')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x145c56,_0x32805f,_0x539986){try{if(_0x32805f[_0x2cda('0xc')]>0x0){_0x145c56=_0x145c56[_0x2cda('0xb')](function(_0x263265){return _0x32805f[_0x2cda('0x2e')](_0x263265['id']);});}var _0x2a0ac2=_0x145c56['filter'](function(_0xfbbbcc){var _0x2a41d6=_0x2cda('0x24');if(isAgentIdle(_0xfbbbcc)){_0x2a41d6=_0x2cda('0xd');}return _0x2a41d6===_0x539986;});return _[_0x2cda('0x2f')](_0x2a0ac2,'id');}catch(_0x1277f6){throw _0x1277f6;}}exports[_0x2cda('0x30')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0xc556f2,_0x5c95b9,_0x49ec3f){return Promise['resolve']()[_0x2cda('0x1a')](function(){if(_0x5c95b9[_0x2cda('0xc')]>0x0){_0xc556f2=_0xc556f2[_0x2cda('0xb')](function(_0x59b1cb){return _0x5c95b9[_0x2cda('0x2e')](_0x59b1cb['id']);});}return _0xc556f2;})[_0x2cda('0x1a')](function(){return db['User']['findAll']({'attributes':['id',_0x2cda('0x31'),_0x2cda('0x32'),_0x2cda('0x4'),_0x2cda('0x5'),_0x2cda('0x6'),_0x2cda('0x7'),'smsPause','voicePause',_0x2cda('0x9'),_0x2cda('0x33')],'where':{'id':{'$in':_[_0x2cda('0x2f')](_0xc556f2,'id')}},'raw':!![]});})[_0x2cda('0x1a')](function(_0x42f48f){return _0x42f48f['map'](function(_0x3bfdc0){var _0x1673d8=_[_0x2cda('0x34')](_0xc556f2,['id',_0x3bfdc0['id']]);var _0x588ed9=filterAgentAttributes(_0x1673d8);_[_0x2cda('0x1f')](_0x3bfdc0,_0x588ed9);_0x3bfdc0[_0x2cda('0x35')]=getAgentStatus(_0x3bfdc0);return _0x3bfdc0;});})[_0x2cda('0x1a')](function(_0x2454ac){var _0x4390b5=sortAgentsByStatus(_0x2454ac,_0x49ec3f);return _[_0x2cda('0x2f')](_0x4390b5,'id');})[_0x2cda('0x20')](function(_0x40179c){throw _0x40179c;});}exports[_0x2cda('0x36')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x200725){var _0x28f227={'fields':[],'order':null};var _0x43ad92=_0x200725[_0x2cda('0x37')](',');_0x28f227['fields']=_[_0x2cda('0xb')](_0x43ad92,function(_0x5ecc28){if(!_0x5ecc28[_0x2cda('0x2e')](_0x2cda('0x35'))){return!![];}_0x28f227[_0x2cda('0x38')]=_[_0x2cda('0x39')](_0x5ecc28,'-')?_0x2cda('0x3a'):_0x2cda('0x3b');return![];});return _0x28f227;}exports[_0x2cda('0x3c')]=getUpdatedSortOptions;function validateSortParameter(_0x8c35be){if(_0x8c35be[_0x2cda('0x2e')]('fullname')&&!_0x8c35be[_0x2cda('0x2e')](_0x2cda('0x3d'))){var _0x485836=_0x8c35be[_0x2cda('0x3e')](0x0,_0x8c35be[_0x2cda('0x3f')](_0x2cda('0x32')));_0x8c35be+=','+_0x485836+_0x2cda('0x3d');}return _0x8c35be;}exports[_0x2cda('0x40')]=validateSortParameter;function sortAgentsByStatus(_0x3947e8,_0x4134c5){var _0xd245f2=_0x3947e8[_0x2cda('0x41')](function(_0x458024,_0x186879){if(_0x458024['globalStatus']===_0x186879[_0x2cda('0x35')]){if(_0x458024[_0x2cda('0x35')]===_0x2cda('0x12')){if(_0x4134c5===_0x2cda('0x3a')){return(_0x458024[_0x2cda('0x33')]||'')<(_0x186879[_0x2cda('0x33')]||'')||_0x458024['fullname']['toLowerCase']()>_0x186879[_0x2cda('0x32')]['toLowerCase']()?0x1:-0x1;}else{return(_0x458024[_0x2cda('0x33')]||'')<(_0x186879['pauseType']||'')||_0x458024[_0x2cda('0x32')][_0x2cda('0x42')]()>_0x186879[_0x2cda('0x32')][_0x2cda('0x42')]()?-0x1:0x1;}}else{if(_0x4134c5==='DESC'){return _0x458024[_0x2cda('0x32')][_0x2cda('0x42')]()<_0x186879['fullname'][_0x2cda('0x42')]()?0x1:-0x1;}else{return _0x458024['fullname'][_0x2cda('0x42')]()<_0x186879[_0x2cda('0x32')][_0x2cda('0x42')]()?-0x1:0x1;}}}else{if(_0x4134c5===_0x2cda('0x3a')){return _0x458024[_0x2cda('0x35')]<_0x186879[_0x2cda('0x35')]?0x1:-0x1;}else{return _0x458024['globalStatus']<_0x186879[_0x2cda('0x35')]?-0x1:0x1;}}});return _0xd245f2;}exports[_0x2cda('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x5776c2){var _0x128cc7=[_0x2cda('0x44'),_0x2cda('0x45'),'lastLoginAt',_0x2cda('0x46'),'pauseType',_0x2cda('0x46'),'internal',_0x2cda('0x47'),'chatPause','openchannelPause',_0x2cda('0x6'),_0x2cda('0x8'),'whatsappPause',_0x2cda('0x5'),_0x2cda('0x10'),'chatCapacity','openchannelCapacity',_0x2cda('0x48'),_0x2cda('0x49'),_0x2cda('0x4a'),'faxCapacity',_0x2cda('0x4b'),'openchannelCurrentCapacity',_0x2cda('0x4c'),_0x2cda('0x4d'),_0x2cda('0x4e'),_0x2cda('0x4f'),_0x2cda('0x13'),_0x2cda('0x16'),_0x2cda('0x15'),_0x2cda('0x17'),_0x2cda('0x18'),_0x2cda('0x14'),_0x2cda('0x11'),_0x2cda('0x50'),'openchannelStatusTime',_0x2cda('0x51'),_0x2cda('0x52'),'whatsappStatusTime',_0x2cda('0x53'),'voiceStatusTime','queue',_0x2cda('0x54'),_0x2cda('0x55'),_0x2cda('0x56'),_0x2cda('0x57'),'routealias'];var _0x25f925=['chatPause',_0x2cda('0x7'),_0x2cda('0x6'),_0x2cda('0x8'),_0x2cda('0x9'),_0x2cda('0x5'),'voicePause',_0x2cda('0x45')];var _0xd757b4=_(_0x5776c2)[_0x2cda('0x58')](_0x25f925)[_0x2cda('0x59')](_0x128cc7)['value']();return _0xd757b4;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file +var _0x371e=['error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','all','flatten','uniq','value','getAgentIdsByQueues','includes','resolve','User','findAll','fullname','chatPause','openchannelPause','pauseType','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','toLowerCase','online','lastPauseAt','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','filterAgentAttributes','jayson/promise','../../mysqldb','client','faxPause','mailPause','smsPause','voicePause','whatsappPause','filter','length','idle','unknown','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x371e,0x145));var _0xe371=function(_0x387b51,_0x20cb4a){_0x387b51=_0x387b51-0x0;var _0x3580b3=_0x371e[_0x387b51];return _0x3580b3;};'use strict';var _=require('lodash');var jayson=require(_0xe371('0x0'));var db=require(_0xe371('0x1'))['db'];var amiClient=jayson[_0xe371('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0xe371('0x2')]['http']({'port':0x232c});function isAgentPaused(_0xae8839,_0x4fc5e4){var _0x57f0ed=[_0xae8839['chatPause'],_0xae8839[_0xe371('0x3')],_0xae8839[_0xe371('0x4')],_0xae8839['openchannelPause'],_0xae8839[_0xe371('0x5')],_0xae8839[_0xe371('0x6')],_0xae8839[_0xe371('0x7')]];if(!_0x4fc5e4)return _['every'](_0x57f0ed);var _0x38714c=_[_0xe371('0x8')](_0x57f0ed);return _0x38714c['length']>0x0&&_0x38714c[_0xe371('0x9')]<_0x57f0ed['length']?!![]:![];}function isIdle(_0x20b078){return _0x20b078===_0xe371('0xa')||_0x20b078===_0xe371('0xb')||_0x20b078==='unavailable'||_0x20b078==='ringing'||_['isNil'](_0x20b078);}function isAgentIdle(_0x42e9c0){if(_0x42e9c0['voiceStatus']!=='idle'&&_0x42e9c0[_0xe371('0x6')]){_0x42e9c0[_0xe371('0xc')]=_0xe371('0xd');return![];}return _['every']([_0x42e9c0[_0xe371('0xe')],_0x42e9c0[_0xe371('0xf')],_0x42e9c0[_0xe371('0x10')],_0x42e9c0[_0xe371('0x11')],_0x42e9c0[_0xe371('0x12')],_0x42e9c0[_0xe371('0xc')],_0x42e9c0[_0xe371('0x13')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xe371('0x14')](_0xe371('0x15'),{})[_0xe371('0x16')](function(_0x438820){if(_0x438820[_0xe371('0x17')]){throw new Error(_0xe371('0x18'));}var _0x459c56=_0x438820['result'];return routingClient[_0xe371('0x14')]('Agents',{})[_0xe371('0x16')](function(_0x4607b0){if(_0x4607b0[_0xe371('0x17')]){throw new Error(_0xe371('0x19'));}var _0xdeefd4=_0x4607b0[_0xe371('0x1a')];return _[_0xe371('0x1b')]({},_0x459c56,_0xdeefd4);});})[_0xe371('0x1c')](function(_0x36212a){throw _0x36212a;});}exports[_0xe371('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x15cd4a){var _0xd20f3b=_0xe371('0xb');if(isAgentPaused(_0x15cd4a))_0xd20f3b=_0xe371('0xd');else if(isAgentPaused(_0x15cd4a,!![]))_0xd20f3b=_0xe371('0x1e');else if(isAgentIdle(_0x15cd4a))_0xd20f3b='idle';else _0xd20f3b=_0xe371('0x1f');return _0xd20f3b;}exports[_0xe371('0x20')]=getAgentStatus;function getAgentIdsByQueues(_0x217517,_0xc4c97a){var _0x1b3f27=_[_0xe371('0x21')](_0x217517)?_0x217517:[_0x217517];var _0x592c44=_[_0xe371('0x22')](_0xc4c97a)+_0xe371('0x23');var _0x1cc3b1=_[_0xe371('0x24')](_0x1b3f27,function(_0xb9429f){return db[_0x592c44][_0xe371('0x25')]({'where':{'id':_0xb9429f}})['then'](function(_0xffb755){if(!_0xffb755)return[];return _0xffb755['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0xe371('0x26')](_0x1cc3b1)[_0xe371('0x16')](function(_0x299925){var _0x72d068=_(_0x299925)[_0xe371('0x27')]()[_0xe371('0x24')]('id')[_0xe371('0x28')]()[_0xe371('0x29')]();return _0x72d068;});}exports[_0xe371('0x2a')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0xda80bf,_0x51145f,_0x4e3bf0){try{if(_0x51145f[_0xe371('0x9')]>0x0){_0xda80bf=_0xda80bf['filter'](function(_0x3e5502){return _0x51145f[_0xe371('0x2b')](_0x3e5502['id']);});}var _0xd03c63=_0xda80bf['filter'](function(_0x11dd92){var _0x48a7c0=_0xe371('0x1f');if(isAgentIdle(_0x11dd92)){_0x48a7c0=_0xe371('0xa');}return _0x48a7c0===_0x4e3bf0;});return _[_0xe371('0x24')](_0xd03c63,'id');}catch(_0x4b994e){throw _0x4b994e;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x35c4c0,_0x34cb74,_0x428300){return Promise[_0xe371('0x2c')]()[_0xe371('0x16')](function(){if(_0x34cb74[_0xe371('0x9')]>0x0){_0x35c4c0=_0x35c4c0[_0xe371('0x8')](function(_0x395a4f){return _0x34cb74[_0xe371('0x2b')](_0x395a4f['id']);});}return _0x35c4c0;})[_0xe371('0x16')](function(){return db[_0xe371('0x2d')][_0xe371('0x2e')]({'attributes':['id','name',_0xe371('0x2f'),_0xe371('0x30'),_0xe371('0x3'),_0xe371('0x4'),_0xe371('0x31'),_0xe371('0x5'),_0xe371('0x6'),_0xe371('0x7'),_0xe371('0x32')],'where':{'id':{'$in':_['map'](_0x35c4c0,'id')}},'raw':!![]});})[_0xe371('0x16')](function(_0x59967a){return _0x59967a[_0xe371('0x24')](function(_0x5ae749){var _0x328d3a=_['find'](_0x35c4c0,['id',_0x5ae749['id']]);var _0x55d583=filterAgentAttributes(_0x328d3a);_[_0xe371('0x1b')](_0x5ae749,_0x55d583);_0x5ae749[_0xe371('0x33')]=getAgentStatus(_0x5ae749);return _0x5ae749;});})[_0xe371('0x16')](function(_0xba988b){var _0x37371b=sortAgentsByStatus(_0xba988b,_0x428300);return _[_0xe371('0x24')](_0x37371b,'id');})['catch'](function(_0x24277d){throw _0x24277d;});}exports[_0xe371('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x20837d){var _0x2ed7df={'fields':[],'order':null};var _0xb0d86a=_0x20837d[_0xe371('0x35')](',');_0x2ed7df[_0xe371('0x36')]=_[_0xe371('0x8')](_0xb0d86a,function(_0x4d077e){if(!_0x4d077e[_0xe371('0x2b')](_0xe371('0x33'))){return!![];}_0x2ed7df[_0xe371('0x37')]=_[_0xe371('0x38')](_0x4d077e,'-')?_0xe371('0x39'):'ASC';return![];});return _0x2ed7df;}exports[_0xe371('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x354f1e){if(_0x354f1e[_0xe371('0x2b')]('fullname')&&!_0x354f1e[_0xe371('0x2b')](_0xe371('0x3b'))){var _0x4bdace=_0x354f1e[_0xe371('0x3c')](0x0,_0x354f1e[_0xe371('0x3d')]('fullname'));_0x354f1e+=','+_0x4bdace+_0xe371('0x3b');}return _0x354f1e;}exports[_0xe371('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x154d90,_0x16fe21){var _0x3be100=_0x154d90['sort'](function(_0x82eb1,_0x3b2aec){if(_0x82eb1[_0xe371('0x33')]===_0x3b2aec[_0xe371('0x33')]){if(_0x82eb1[_0xe371('0x33')]===_0xe371('0xd')){if(_0x16fe21===_0xe371('0x39')){return(_0x82eb1['pauseType']||'')<(_0x3b2aec[_0xe371('0x32')]||'')||_0x82eb1['fullname'][_0xe371('0x3f')]()>_0x3b2aec[_0xe371('0x2f')][_0xe371('0x3f')]()?0x1:-0x1;}else{return(_0x82eb1[_0xe371('0x32')]||'')<(_0x3b2aec[_0xe371('0x32')]||'')||_0x82eb1[_0xe371('0x2f')][_0xe371('0x3f')]()>_0x3b2aec['fullname']['toLowerCase']()?-0x1:0x1;}}else{if(_0x16fe21===_0xe371('0x39')){return _0x82eb1[_0xe371('0x2f')][_0xe371('0x3f')]()<_0x3b2aec[_0xe371('0x2f')][_0xe371('0x3f')]()?0x1:-0x1;}else{return _0x82eb1[_0xe371('0x2f')]['toLowerCase']()<_0x3b2aec[_0xe371('0x2f')][_0xe371('0x3f')]()?-0x1:0x1;}}}else{if(_0x16fe21==='DESC'){return _0x82eb1[_0xe371('0x33')]<_0x3b2aec[_0xe371('0x33')]?0x1:-0x1;}else{return _0x82eb1[_0xe371('0x33')]<_0x3b2aec[_0xe371('0x33')]?-0x1:0x1;}}});return _0x3be100;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x4ab0a3){var _0x7e9512=['userpic',_0xe371('0x40'),'lastLoginAt',_0xe371('0x41'),_0xe371('0x32'),_0xe371('0x41'),_0xe371('0x3b'),'address',_0xe371('0x30'),'openchannelPause',_0xe371('0x4'),_0xe371('0x5'),_0xe371('0x7'),_0xe371('0x3'),_0xe371('0x6'),_0xe371('0x42'),_0xe371('0x43'),_0xe371('0x44'),_0xe371('0x45'),_0xe371('0x46'),'faxCapacity',_0xe371('0x47'),_0xe371('0x48'),_0xe371('0x49'),_0xe371('0x4a'),_0xe371('0x4b'),'faxCurrentCapacity','chatStatus',_0xe371('0x11'),_0xe371('0x10'),'smsStatus',_0xe371('0x13'),_0xe371('0xf'),'voiceStatus',_0xe371('0x4c'),'openchannelStatusTime',_0xe371('0x4d'),_0xe371('0x4e'),_0xe371('0x4f'),_0xe371('0x50'),'voiceStatusTime',_0xe371('0x51'),_0xe371('0x52'),_0xe371('0x53'),'phoneBarEnableScreenRecordingByAgent',_0xe371('0x54'),_0xe371('0x55')];var _0xe5ed4e=[_0xe371('0x30'),_0xe371('0x31'),_0xe371('0x4'),_0xe371('0x5'),_0xe371('0x7'),_0xe371('0x3'),_0xe371('0x6'),_0xe371('0x40')];var _0x117aa8=_(_0x4ab0a3)['omit'](_0xe5ed4e)['pick'](_0x7e9512)[_0xe371('0x29')]();return _0x117aa8;}exports[_0xe371('0x56')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index e97a143..82f7330 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 _0x0b10=['Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','startCase','Queues','then','error','format','catch','getRealtimeQueues','inbound','concat','get','busy','outbound','originated','merge','pick','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','invalid','loggedInDb','notInUse','onHold','ringInUse','talking','unavailable','pTalking','message','statusMessage','dialActive'];(function(_0x560eca,_0x337bfd){var _0x251ecc=function(_0xeae7fe){while(--_0xeae7fe){_0x560eca['push'](_0x560eca['shift']());}};_0x251ecc(++_0x337bfd);}(_0x0b10,0x151));var _0x00b1=function(_0x524c77,_0x1abaeb){_0x524c77=_0x524c77-0x0;var _0x48c782=_0x0b10[_0x524c77];return _0x48c782;};'use strict';var _=require(_0x00b1('0x0'));var jayson=require(_0x00b1('0x1'));var util=require(_0x00b1('0x2'));var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0x00b1('0x3')][_0x00b1('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x00b1('0x5'),_0x00b1('0x6'),_0x00b1('0x7'),_0x00b1('0x8')];var VOICE_QUEUE_ATTRIBUTES=['busy','inUse',_0x00b1('0x9'),_0x00b1('0xa'),_0x00b1('0xb'),_0x00b1('0xc'),'ringing',_0x00b1('0xd'),_0x00b1('0xe'),_0x00b1('0xf'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x00b1('0x10'),'originated',_0x00b1('0x11'),_0x00b1('0x12'),_0x00b1('0x13'),'dialMethod',_0x00b1('0x14'),_0x00b1('0x15'),_0x00b1('0x16'),_0x00b1('0x17'),_0x00b1('0x18'),_0x00b1('0x19'),_0x00b1('0x1a'),_0x00b1('0x1b'),_0x00b1('0x1c'),_0x00b1('0x1d'),_0x00b1('0x1e'),_0x00b1('0x1f'),'predictiveIntervalAnsweredCalls',_0x00b1('0x20'),_0x00b1('0x21'),_0x00b1('0x22'),_0x00b1('0x23')];function getRealtimeQueues(_0x482baf,_0x34911f){var _0x14b185=_0x34911f==='voice'?amiClient:routingClient;return _0x14b185['request'](_[_0x00b1('0x24')](_0x34911f)+_0x00b1('0x25'),_0x482baf)[_0x00b1('0x26')](function(_0x2b9c8e){if(_0x2b9c8e[_0x00b1('0x27')])throw new Error(util[_0x00b1('0x28')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x34911f));return _0x2b9c8e['result'];})[_0x00b1('0x29')](function(_0x1ceabe){throw _0x1ceabe;});}exports[_0x00b1('0x2a')]=getRealtimeQueues;function initializeQueues(_0x4ea810,_0x1b7810,_0x2ba4c4,_0x18f318){var _0x32ccf5=DEFAULT_QUEUE_ATTRIBUTES;if(_0x2ba4c4==='voice'){if(_0x18f318===_0x00b1('0x2b')){_0x32ccf5=_0x32ccf5[_0x00b1('0x2c')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x18f318==='outbound'){_0x32ccf5=_0x32ccf5[_0x00b1('0x2c')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x4ea810['map'](function(_0x40654d){var _0x258d49=_0x40654d[_0x00b1('0x2d')]({'plain':!![]});_0x258d49[_0x00b1('0x7')]=0x0;_0x258d49[_0x00b1('0xa')]=0x0;_0x258d49[_0x00b1('0x6')]=0x0;_0x258d49[_0x00b1('0x5')]=0x0;_0x258d49['waiting']=0x0;if(_0x2ba4c4==='voice'){_0x258d49[_0x00b1('0xe')]=0x0;_0x258d49[_0x00b1('0x2e')]=0x0;if(_0x18f318===_0x00b1('0x2f')){_0x258d49[_0x00b1('0x10')]=0x0;_0x258d49[_0x00b1('0x30')]=0x0;}}var _0x557346=_['find'](_0x1b7810,['id',_0x258d49['id']]);if(_0x557346){_[_0x00b1('0x31')](_0x258d49,_[_0x00b1('0x32')](_0x557346,_0x32ccf5));}return _0x258d49;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0x7161=['voice','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','map','get','outbound','find','merge','initializeQueues','jayson/promise','util','http','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','startPredictive','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime'];(function(_0xff6bff,_0x11f090){var _0x1b0110=function(_0x55bd3a){while(--_0x55bd3a){_0xff6bff['push'](_0xff6bff['shift']());}};_0x1b0110(++_0x11f090);}(_0x7161,0x10d));var _0x1716=function(_0x2167a9,_0x2ae049){_0x2167a9=_0x2167a9-0x0;var _0x9a741f=_0x7161[_0x2167a9];return _0x9a741f;};'use strict';var _=require('lodash');var jayson=require(_0x1716('0x0'));var util=require(_0x1716('0x1'));var amiClient=jayson['client'][_0x1716('0x2')]({'port':0x232a});var routingClient=jayson['client'][_0x1716('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x1716('0x3'),_0x1716('0x4'),_0x1716('0x5')];var VOICE_QUEUE_ATTRIBUTES=[_0x1716('0x6'),_0x1716('0x7'),_0x1716('0x8'),_0x1716('0x9'),'notInUse',_0x1716('0xa'),_0x1716('0xb'),_0x1716('0xc'),_0x1716('0xd'),_0x1716('0xe'),_0x1716('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x1716('0x10'),_0x1716('0x11'),_0x1716('0x12'),_0x1716('0x13'),_0x1716('0x14'),_0x1716('0x15'),'Trunk',_0x1716('0x16'),'startProgressive','erlangCalls','erlangCallToSecond',_0x1716('0x17'),'erlangBusyFactor',_0x1716('0x18'),_0x1716('0x19'),'dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable',_0x1716('0x1a'),_0x1716('0x1b'),_0x1716('0x1c'),_0x1716('0x1d'),_0x1716('0x1e'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x2470d4,_0x19a081){var _0x5f20ff=_0x19a081===_0x1716('0x1f')?amiClient:routingClient;return _0x5f20ff[_0x1716('0x20')](_[_0x1716('0x21')](_0x19a081)+_0x1716('0x22'),_0x2470d4)[_0x1716('0x23')](function(_0x5dec5c){if(_0x5dec5c[_0x1716('0x24')])throw new Error(util[_0x1716('0x25')](_0x1716('0x26'),_0x19a081));return _0x5dec5c[_0x1716('0x27')];})[_0x1716('0x28')](function(_0x558276){throw _0x558276;});}exports[_0x1716('0x29')]=getRealtimeQueues;function initializeQueues(_0x172916,_0x4bcd61,_0x3bfedf,_0x37ff17){var _0x25c91d=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3bfedf===_0x1716('0x1f')){if(_0x37ff17===_0x1716('0x2a')){_0x25c91d=_0x25c91d[_0x1716('0x2b')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x37ff17==='outbound'){_0x25c91d=_0x25c91d['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x172916[_0x1716('0x2c')](function(_0x2dc2c0){var _0x3cb6a4=_0x2dc2c0[_0x1716('0x2d')]({'plain':!![]});_0x3cb6a4['paused']=0x0;_0x3cb6a4[_0x1716('0x9')]=0x0;_0x3cb6a4[_0x1716('0x3')]=0x0;_0x3cb6a4['available']=0x0;_0x3cb6a4[_0x1716('0x5')]=0x0;if(_0x3bfedf===_0x1716('0x1f')){_0x3cb6a4['talking']=0x0;_0x3cb6a4['busy']=0x0;if(_0x37ff17===_0x1716('0x2e')){_0x3cb6a4[_0x1716('0x10')]=0x0;_0x3cb6a4['originated']=0x0;}}var _0x66f8a3=_[_0x1716('0x2f')](_0x4bcd61,['id',_0x3cb6a4['id']]);if(_0x66f8a3){_[_0x1716('0x30')](_0x3cb6a4,_['pick'](_0x66f8a3,_0x25c91d));}return _0x3cb6a4;});}exports[_0x1716('0x31')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index e965b25..3d8e71e 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x4be3e7,_0x3a7f05){var _0x4d44a0=function(_0x3eafee){while(--_0x3eafee){_0x4be3e7['push'](_0x4be3e7['shift']());}};_0x4d44a0(++_0x3a7f05);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x53f5eb,_0x585522){var _0x3a7230=function(_0x268aa1){while(--_0x268aa1){_0x53f5eb['push'](_0x53f5eb['shift']());}};_0x3a7230(++_0x585522);}(_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 ad70cd3..a8b8fbc 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 _0x50f3=['dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','hex','substring','lodash','child_process','execSync','../environment','orderBy','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map','join','createHash','md5','update','digest','getUuid','test','licenseToken','win32'];(function(_0x39eeea,_0x49d05f){var _0x2ad830=function(_0x7eef0f){while(--_0x7eef0f){_0x39eeea['push'](_0x39eeea['shift']());}};_0x2ad830(++_0x49d05f);}(_0x50f3,0x1d5));var _0x350f=function(_0x59cd78,_0x456e09){_0x59cd78=_0x59cd78-0x0;var _0x323bbf=_0x50f3[_0x59cd78];return _0x323bbf;};'use strict';var _=require(_0x350f('0x0'));var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0x350f('0x1'))[_0x350f('0x2')];var config=require(_0x350f('0x3'));function getInterfaces(){var _0x4953b0=[];var _0xd3e78d=os['networkInterfaces']();var _0x1f58c2=_[_0x350f('0x4')](_['keys'](_0xd3e78d));for(var _0x6f569b=0x0;_0x6f569b<_0x1f58c2['length'];_0x6f569b++){var _0x32d049=_0xd3e78d[_0x1f58c2[_0x6f569b]][_0x350f('0x5')](function(_0x23e0a3){return _0x23e0a3[_0x350f('0x6')]===_0x350f('0x7')&&_0x23e0a3[_0x350f('0x8')]===![];});_0x4953b0=_0x4953b0[_0x350f('0x9')](_0x32d049);}return _0x4953b0;}function getFirstInterface(){var _0x593cf9=_[_0x350f('0xa')](getInterfaces());return{'macAddress':_0x593cf9&&_0x593cf9[_0x350f('0xb')]?_0x593cf9[_0x350f('0xb')]:_0x350f('0xc'),'ipAddress':_0x593cf9&&_0x593cf9['address']?_0x593cf9[_0x350f('0xd')]:_0x350f('0xe')};}exports[_0x350f('0xf')]=getFirstInterface;function getCPUhash(){var _0x1e5e2a=_[_0x350f('0x4')](os['cpus']()[_0x350f('0x10')](function(_0x2ec38f){return _0x2ec38f['model'];}))[_0x350f('0x11')](':');return crypto[_0x350f('0x12')](_0x350f('0x13'))[_0x350f('0x14')](_0x1e5e2a)[_0x350f('0x15')]('hex');}exports[_0x350f('0x16')]=function(){var _0x3473e2=os['platform']();var _0x3d5bed=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x3d5bed[_0x350f('0x17')](config[_0x350f('0x18')])){return config[_0x350f('0x18')];}else if(_0x3473e2===_0x350f('0x19')){return exec(_0x350f('0x1a'),{'encoding':'utf8'})[_0x350f('0x1b')]('\x0d\x0a','');}else{var _0x319cde=getFirstInterface();var _0x4d6fdf=getCPUhash();var _0x481ebd=_0x4d6fdf+'|'+os[_0x350f('0x1c')]()+'|'+_0x319cde[_0x350f('0x1d')]+'|'+_0x319cde[_0x350f('0x1e')];var _0x216b5e=crypto['createHash'](_0x350f('0x13'))['update'](_0x481ebd)[_0x350f('0x15')](_0x350f('0x1f'));return _0x216b5e[_0x350f('0x20')](0x0,0x8)+'-'+_0x216b5e[_0x350f('0x20')](0x8,0xc)+'-'+_0x216b5e[_0x350f('0x20')](0xc,0x10)+'-'+_0x216b5e['substring'](0x10,0x14)+'-'+_0x216b5e['substring'](0x14);}}; \ No newline at end of file +var _0x38a8=['join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','win32','replace','hostname','macAddress','ipAddress','substring','crypto','bimedia-machine-uuid','execSync','../environment','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map'];(function(_0x5967ef,_0x3ec9eb){var _0x34df20=function(_0x3e4c34){while(--_0x3e4c34){_0x5967ef['push'](_0x5967ef['shift']());}};_0x34df20(++_0x3ec9eb);}(_0x38a8,0xbf));var _0x838a=function(_0x26d9b3,_0x591f4e){_0x26d9b3=_0x26d9b3-0x0;var _0x15c226=_0x38a8[_0x26d9b3];return _0x15c226;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x838a('0x0'));var machine=require(_0x838a('0x1'));var exec=require('child_process')[_0x838a('0x2')];var config=require(_0x838a('0x3'));function getInterfaces(){var _0x20e848=[];var _0x3369ba=os['networkInterfaces']();var _0x454233=_[_0x838a('0x4')](_[_0x838a('0x5')](_0x3369ba));for(var _0x42e93f=0x0;_0x42e93f<_0x454233[_0x838a('0x6')];_0x42e93f++){var _0x5b0d62=_0x3369ba[_0x454233[_0x42e93f]][_0x838a('0x7')](function(_0x2ee08b){return _0x2ee08b[_0x838a('0x8')]===_0x838a('0x9')&&_0x2ee08b[_0x838a('0xa')]===![];});_0x20e848=_0x20e848[_0x838a('0xb')](_0x5b0d62);}return _0x20e848;}function getFirstInterface(){var _0x4edda3=_[_0x838a('0xc')](getInterfaces());return{'macAddress':_0x4edda3&&_0x4edda3[_0x838a('0xd')]?_0x4edda3['mac']:_0x838a('0xe'),'ipAddress':_0x4edda3&&_0x4edda3['address']?_0x4edda3[_0x838a('0xf')]:_0x838a('0x10')};}exports[_0x838a('0x11')]=getFirstInterface;function getCPUhash(){var _0x3def98=_[_0x838a('0x4')](os['cpus']()[_0x838a('0x12')](function(_0x16490a){return _0x16490a['model'];}))[_0x838a('0x13')](':');return crypto[_0x838a('0x14')](_0x838a('0x15'))[_0x838a('0x16')](_0x3def98)[_0x838a('0x17')](_0x838a('0x18'));}exports[_0x838a('0x19')]=function(){var _0xea90a1=os[_0x838a('0x1a')]();var _0x5f4607=/[0-9a-f-]{36}/;if(config[_0x838a('0x1b')]&&_0x5f4607[_0x838a('0x1c')](config[_0x838a('0x1b')])){return config['licenseToken'];}else if(_0xea90a1===_0x838a('0x1d')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0x838a('0x1e')]('\x0d\x0a','');}else{var _0x2f8e77=getFirstInterface();var _0x185ac7=getCPUhash();var _0x199532=_0x185ac7+'|'+os[_0x838a('0x1f')]()+'|'+_0x2f8e77[_0x838a('0x20')]+'|'+_0x2f8e77[_0x838a('0x21')];var _0x391c88=crypto['createHash'](_0x838a('0x15'))['update'](_0x199532)[_0x838a('0x17')]('hex');return _0x391c88[_0x838a('0x22')](0x0,0x8)+'-'+_0x391c88[_0x838a('0x22')](0x8,0xc)+'-'+_0x391c88[_0x838a('0x22')](0xc,0x10)+'-'+_0x391c88[_0x838a('0x22')](0x10,0x14)+'-'+_0x391c88[_0x838a('0x22')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index c9d00e8..dcc5476 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 _0xd92e=['error','message','finally','getUuid','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','catch'];(function(_0x37635e,_0x21b6f5){var _0x3c0965=function(_0xe9864c){while(--_0xe9864c){_0x37635e['push'](_0x37635e['shift']());}};_0x3c0965(++_0x21b6f5);}(_0xd92e,0x1e0));var _0xed92=function(_0x2acded,_0x2f4cb9){_0x2acded=_0x2acded-0x0;var _0x3411fc=_0xd92e[_0x2acded];return _0x3411fc;};'use strict';var util=require(_0xed92('0x0'));var moment=require(_0xed92('0x1'));var rp=require(_0xed92('0x2'));var BPromise=require(_0xed92('0x3'));var pkginfo=require(_0xed92('0x4'))(module,'version');var db=require(_0xed92('0x5'))['db'];var encryptor=require(_0xed92('0x6'));var hardware=require(_0xed92('0x7'));var logger=require(_0xed92('0x8'))(_0xed92('0x9'));var HOST=_0xed92('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4a4a52){return new BPromise(function(_0x2aeedb,_0xb45842){var _0x3b9cc5=util[_0xed92('0xb')](_0xed92('0xc'),HOST,_0x4a4a52,module[_0xed92('0xd')][_0xed92('0xe')]);if(oldToken){_0x3b9cc5=util[_0xed92('0xb')](_0xed92('0xf'),HOST,_0x4a4a52,module['exports'][_0xed92('0xe')],oldToken);}var _0x387548={'uri':_0x3b9cc5,'method':_0xed92('0x10'),'timeout':0xea60,'json':!![]};return rp(_0x387548)[_0xed92('0x11')](function(_0xe77493){_0x2aeedb(_0xe77493);})['catch'](function(_0x471f9b){_0xb45842(_0x471f9b);});});}function manageLicense(_0x42deea,_0x1f5022){var _0xa5bfa8=_0x1f5022[_0xed92('0x12')]({'plain':!![]});if(!isOldTokenSent&&_0xa5bfa8[_0xed92('0x13')]!==_0x42deea&&!_0xa5bfa8[_0xed92('0x14')]){oldToken=_0xa5bfa8[_0xed92('0x13')];}httpRequest(_0x42deea)[_0xed92('0x11')](function(_0x21fdec){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x21fdec[_0xed92('0x15')]){isOldTokenSent=![];if(!_0xa5bfa8[_0xed92('0x9')]&&_0xa5bfa8['license']!=_0x21fdec['license']||_0xa5bfa8['license']&&_0xa5bfa8[_0xed92('0x14')]){logger[_0xed92('0x16')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0xa5bfa8['license']&&!_0xa5bfa8[_0xed92('0x14')]&&_0xa5bfa8['license']!=_0x21fdec['license']){logger['info'](_0xed92('0x17'));}if(_0xa5bfa8[_0xed92('0x9')]&&!_0xa5bfa8[_0xed92('0x14')]&&_0xa5bfa8[_0xed92('0x9')]==_0x21fdec[_0xed92('0x9')]){return _0x1f5022;}return _0x1f5022[_0xed92('0x18')]({'data1':_0x42deea,'data2':null,'license':_0x21fdec[_0xed92('0x9')]});}else{if(_0x21fdec[_0xed92('0x9')]||_0xa5bfa8[_0xed92('0x9')]){if(!_0xa5bfa8[_0xed92('0x14')]){if(_0xa5bfa8[_0xed92('0x13')]==_0x42deea){GRAY_PERIOD_REASON=_0xed92('0x19');logger[_0xed92('0x16')](_0xed92('0x1a'));}else{GRAY_PERIOD_REASON=_0xed92('0x1b');logger[_0xed92('0x16')](_0xed92('0x1c'),_0xa5bfa8['data1'],_0x42deea);}logger[_0xed92('0x16')](_0xed92('0x1d'),GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0xed92('0x1e')));return _0x1f5022[_0xed92('0x18')]({'data2':encryptor[_0xed92('0x1f')](moment()['format'](_0xed92('0x1e')))});}else{if(moment()['diff'](encryptor[_0xed92('0x20')](_0xa5bfa8[_0xed92('0x14')]),_0xed92('0x21'))>DAYS){logger[_0xed92('0x16')](_0xed92('0x22'),moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x1f5022[_0xed92('0x18')]({'data1':_0x42deea,'data2':null,'license':null});}}}else{if(_0xa5bfa8['data1']!=_0x42deea){logger[_0xed92('0x16')](_0xed92('0x1c'),_0xa5bfa8[_0xed92('0x13')],_0x42deea);return _0x1f5022[_0xed92('0x18')]({'data1':_0x42deea,'data2':null,'license':null});}}}return _0x1f5022;})[_0xed92('0x11')](function(_0x426df8){_0x1f5022=_0x426df8;})[_0xed92('0x23')](function(_0x34d63e){logger[_0xed92('0x24')](_0x34d63e[_0xed92('0x25')]);})[_0xed92('0x26')](function(){setTimeout(function(){manageLicense(hardware[_0xed92('0x27')](),_0x1f5022);},TIME);});}function defaultLicense(){var _0x217b2a=hardware['getUuid']();if(_0x217b2a){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x217b2a}})[_0xed92('0x28')](function(_0x183f73,_0xc7aa4e){logger[_0xed92('0x16')](_0xed92('0x29'),_0x217b2a);manageLicense(_0x217b2a,_0x183f73);})[_0xed92('0x23')](function(_0x1148f3){logger[_0xed92('0x24')](_0x1148f3[_0xed92('0x25')]);});}}exports[_0xed92('0x2a')]=defaultLicense; \ No newline at end of file +var _0xa852=['%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get','data2','data1','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','util','request-promise','pkginfo','version','../../mysqldb','../../components/encryptor','license','format','%s/api/servers/%s/check?version=%s','exports'];(function(_0x5545dd,_0x51898b){var _0x7999f9=function(_0x4fcf53){while(--_0x4fcf53){_0x5545dd['push'](_0x5545dd['shift']());}};_0x7999f9(++_0x51898b);}(_0xa852,0xa0));var _0x2a85=function(_0x84a2e5,_0x3c1db6){_0x84a2e5=_0x84a2e5-0x0;var _0x476cd6=_0xa852[_0x84a2e5];return _0x476cd6;};'use strict';var util=require(_0x2a85('0x0'));var moment=require('moment');var rp=require(_0x2a85('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0x2a85('0x2'))(module,_0x2a85('0x3'));var db=require(_0x2a85('0x4'))['db'];var encryptor=require(_0x2a85('0x5'));var hardware=require('./hardware');var logger=require('../logger')(_0x2a85('0x6'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x24ef26){return new BPromise(function(_0x11edd6,_0x3762d2){var _0x3ebf4c=util[_0x2a85('0x7')](_0x2a85('0x8'),HOST,_0x24ef26,module[_0x2a85('0x9')][_0x2a85('0x3')]);if(oldToken){_0x3ebf4c=util[_0x2a85('0x7')](_0x2a85('0xa'),HOST,_0x24ef26,module[_0x2a85('0x9')][_0x2a85('0x3')],oldToken);}var _0x30df00={'uri':_0x3ebf4c,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x30df00)[_0x2a85('0xb')](function(_0x1cb788){_0x11edd6(_0x1cb788);})[_0x2a85('0xc')](function(_0x168662){_0x3762d2(_0x168662);});});}function manageLicense(_0xa5a313,_0x867298){var _0x3d879b=_0x867298[_0x2a85('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x3d879b['data1']!==_0xa5a313&&!_0x3d879b[_0x2a85('0xe')]){oldToken=_0x3d879b[_0x2a85('0xf')];}httpRequest(_0xa5a313)['then'](function(_0x303b2a){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x303b2a[_0x2a85('0x10')]){isOldTokenSent=![];if(!_0x3d879b[_0x2a85('0x6')]&&_0x3d879b[_0x2a85('0x6')]!=_0x303b2a[_0x2a85('0x6')]||_0x3d879b[_0x2a85('0x6')]&&_0x3d879b['data2']){logger['info'](_0x2a85('0x11'));}if(_0x3d879b[_0x2a85('0x6')]&&!_0x3d879b[_0x2a85('0xe')]&&_0x3d879b[_0x2a85('0x6')]!=_0x303b2a['license']){logger[_0x2a85('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x3d879b['license']&&!_0x3d879b[_0x2a85('0xe')]&&_0x3d879b[_0x2a85('0x6')]==_0x303b2a['license']){return _0x867298;}return _0x867298[_0x2a85('0x13')]({'data1':_0xa5a313,'data2':null,'license':_0x303b2a['license']});}else{if(_0x303b2a['license']||_0x3d879b['license']){if(!_0x3d879b[_0x2a85('0xe')]){if(_0x3d879b[_0x2a85('0xf')]==_0xa5a313){GRAY_PERIOD_REASON='Disabled';logger[_0x2a85('0x12')](_0x2a85('0x14'));}else{GRAY_PERIOD_REASON=_0x2a85('0x15');logger[_0x2a85('0x12')](_0x2a85('0x16'),_0x3d879b[_0x2a85('0xf')],_0xa5a313);}logger[_0x2a85('0x12')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x2a85('0x17')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x867298[_0x2a85('0x13')]({'data2':encryptor[_0x2a85('0x18')](moment()[_0x2a85('0x7')](_0x2a85('0x19')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x3d879b['data2']),_0x2a85('0x1a'))>DAYS){logger[_0x2a85('0x12')](_0x2a85('0x1b'),moment()[_0x2a85('0x7')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x867298[_0x2a85('0x13')]({'data1':_0xa5a313,'data2':null,'license':null});}}}else{if(_0x3d879b[_0x2a85('0xf')]!=_0xa5a313){logger[_0x2a85('0x12')](_0x2a85('0x16'),_0x3d879b[_0x2a85('0xf')],_0xa5a313);return _0x867298[_0x2a85('0x13')]({'data1':_0xa5a313,'data2':null,'license':null});}}}return _0x867298;})[_0x2a85('0xb')](function(_0x2edddb){_0x867298=_0x2edddb;})[_0x2a85('0xc')](function(_0x107bd6){logger[_0x2a85('0x1c')](_0x107bd6[_0x2a85('0x1d')]);})[_0x2a85('0x1e')](function(){setTimeout(function(){manageLicense(hardware[_0x2a85('0x1f')](),_0x867298);},TIME);});}function defaultLicense(){var _0xb576cc=hardware[_0x2a85('0x1f')]();if(_0xb576cc){return db['License'][_0x2a85('0x20')]({'where':{'id':0x1},'defaults':{'data1':_0xb576cc}})['spread'](function(_0x204d32,_0x61918a){logger[_0x2a85('0x12')](_0x2a85('0x21'),_0xb576cc);manageLicense(_0xb576cc,_0x204d32);})[_0x2a85('0xc')](function(_0x4bc25b){logger[_0x2a85('0x1c')](_0x4bc25b[_0x2a85('0x1d')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 29ee103..06ffc69 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 _0x8d73=['decryptString','format','demo','machineUuid','gray','add','grayReason','message','User','findAll','sequelize','COUNT','count','admin','user','telephone','users','telephones','role','catch','pick','License\x20limit\x20reached\x20for\x20users','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','find','defaults','then','uuid','data1','License\x20key\x20value\x20not\x20found','split'];(function(_0x104993,_0x3f9a6b){var _0x105a96=function(_0x4ad1cb){while(--_0x4ad1cb){_0x104993['push'](_0x104993['shift']());}};_0x105a96(++_0x3f9a6b);}(_0x8d73,0xd4));var _0x38d7=function(_0x2ae98d,_0xa3ad86){_0x2ae98d=_0x2ae98d-0x0;var _0xa9b7f8=_0x8d73[_0x2ae98d];return _0xa9b7f8;};'use strict';var util=require(_0x38d7('0x0'));var _=require('lodash');var moment=require(_0x38d7('0x1'));var BPromise=require(_0x38d7('0x2'));var hardware=require(_0x38d7('0x3'));var encryptor=require(_0x38d7('0x4'));var db=require(_0x38d7('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x38d7('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x38d7('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x38d7('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2279c1){return new BPromise(function(_0x3ad86d,_0x24d5c4){return db['License'][_0x38d7('0x9')](_[_0x38d7('0xa')](_0x2279c1,{'raw':!![],'where':{'id':0x1}}))[_0x38d7('0xb')](function(_0x39dbd6){return checkLicense(_0x39dbd6,null);})[_0x38d7('0xb')](function(_0x2b6c4d){_0x3ad86d(_0x2b6c4d);return;})['catch'](function(_0x1db16f){_0x24d5c4(_0x1db16f);});});}function checkLicense(_0x14dd9c,_0x4bff67){if(!_0x14dd9c){demoLicense[_0x38d7('0xc')]=_0x14dd9c[_0x38d7('0xd')];return demoLicense;}try{var _0xac1298=_0x4bff67||_0x14dd9c['license'];if(_['isEmpty'](_0xac1298)){throw new Error(_0x38d7('0xe'));}var _0x3096e5=_0x14dd9c[_0x38d7('0xd')];var _0x1013f1=_0x14dd9c['data2'];var _0x22bd01=_0x3096e5[_0x38d7('0xf')]('-')[0x4];var _0x55aec2=_0x3096e5[_0x38d7('0xf')]('-')[0x0];var _0x5e6ade=encryptor[_0x38d7('0x10')](_0xac1298,util[_0x38d7('0x11')]('%s:%s:%s',_0x22bd01,_0x3096e5,_0x55aec2));var _0x2ee9c4=JSON['parse'](_0x5e6ade);_0x2ee9c4[_0x38d7('0x12')]=![];_0x2ee9c4[_0x38d7('0xc')]=_0x3096e5;_0x2ee9c4[_0x38d7('0x13')]=hardware[_0x38d7('0x7')]();if(_0x1013f1){var _0x1f711d=encryptor[_0x38d7('0x10')](_0x1013f1);_0x2ee9c4[_0x38d7('0x14')]=_0x1f711d;_0x2ee9c4['deadline']=moment(_0x1f711d)[_0x38d7('0x15')](0x7,'days')[_0x38d7('0x11')]();_0x2ee9c4[_0x38d7('0x16')]=_0x2ee9c4[_0x38d7('0xc')]!=_0x2ee9c4[_0x38d7('0x13')]?'changed':'disabled';}return _0x2ee9c4;}catch(_0x4c1355){breakingLicense[_0x38d7('0xc')]=_0x14dd9c[_0x38d7('0xd')];breakingLicense[_0x38d7('0x17')]=_0x4c1355['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x12af43,_0x356002){getLicense()[_0x38d7('0xb')](function(_0xd1b10a){return db[_0x38d7('0x18')][_0x38d7('0x19')]({'attributes':['role',[db[_0x38d7('0x1a')]['fn'](_0x38d7('0x1b'),db['sequelize']['col']('role')),_0x38d7('0x1c')]],'group':'role','where':{'role':{'$or':[_0x38d7('0x1d'),_0x38d7('0x1e'),_0x38d7('0x1f')]}},'raw':!![]})[_0x38d7('0xb')](function(_0x2e1bb3){var _0x2ab1dc={'user':_0xd1b10a[_0x38d7('0x20')]||0x0,'telephone':_0xd1b10a[_0x38d7('0x21')]||0x0};_0x2e1bb3['forEach'](function(_0x2ea855){var _0x10448d=_0x2ea855[_0x38d7('0x22')]===_0x38d7('0x1d')?_0x38d7('0x1e'):_0x2ea855[_0x38d7('0x22')];_0x2ab1dc[_0x10448d]-=_0x2ea855[_0x38d7('0x1c')];if(_0x2ab1dc[_0x10448d]<0x0)_0x2ab1dc[_0x10448d]=0x0;});_0x12af43(_0x2ab1dc);return;});})[_0x38d7('0x23')](function(_0x519c4a){_0x356002(_0x519c4a);});});}function checkUserLimits(_0x6ba055){return new BPromise(function(_0x505555,_0xe363ce){getLimits()['then'](function(_0x27357c){var _0x331c2d=_[_0x38d7('0x24')](_['countBy'](_0x6ba055,_0x38d7('0x22')),[_0x38d7('0x1d'),_0x38d7('0x1e'),'telephone']);var _0x1f9e8b=(_0x331c2d[_0x38d7('0x1d')]||0x0)+(_0x331c2d[_0x38d7('0x1e')]||0x0);var _0x2b278f=_0x331c2d['telephone']||0x0;if(_0x1f9e8b>_0x27357c[_0x38d7('0x1e')])return _0xe363ce(_0x38d7('0x25'));if(_0x2b278f>_0x27357c['telephone'])return _0xe363ce('License\x20limit\x20reached\x20for\x20telephones');return _0x505555();})[_0x38d7('0x23')](function(_0x18aa28){_0xe363ce(_0x18aa28);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x5fe5=['admin','telephone','users','user','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','../../components/encryptor','../../mysqldb','Demo\x20license','Breaking\x20license','License','find','defaults','then','catch','uuid','isEmpty','data1','data2','split','%s:%s:%s','parse','demo','machineUuid','getUuid','decryptString','gray','deadline','add','days','format','grayReason','message','role','sequelize','COUNT','col','count'];(function(_0x90e312,_0x4deaf4){var _0xe11402=function(_0x3f55f2){while(--_0x3f55f2){_0x90e312['push'](_0x90e312['shift']());}};_0xe11402(++_0x4deaf4);}(_0x5fe5,0x1b6));var _0x55fe=function(_0x2906e6,_0x5ccd59){_0x2906e6=_0x2906e6-0x0;var _0x12517a=_0x5fe5[_0x2906e6];return _0x12517a;};'use strict';var util=require(_0x55fe('0x0'));var _=require(_0x55fe('0x1'));var moment=require(_0x55fe('0x2'));var BPromise=require('bluebird');var hardware=require('./hardware');var encryptor=require(_0x55fe('0x3'));var db=require(_0x55fe('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x55fe('0x5'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x55fe('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2be1b6){return new BPromise(function(_0x51ca8d,_0x29c157){return db[_0x55fe('0x7')][_0x55fe('0x8')](_[_0x55fe('0x9')](_0x2be1b6,{'raw':!![],'where':{'id':0x1}}))[_0x55fe('0xa')](function(_0x4dc8ac){return checkLicense(_0x4dc8ac,null);})[_0x55fe('0xa')](function(_0x27cffc){_0x51ca8d(_0x27cffc);return;})[_0x55fe('0xb')](function(_0x599762){_0x29c157(_0x599762);});});}function checkLicense(_0xc68b44,_0x5a763c){if(!_0xc68b44){demoLicense[_0x55fe('0xc')]=_0xc68b44['data1'];return demoLicense;}try{var _0x338663=_0x5a763c||_0xc68b44['license'];if(_[_0x55fe('0xd')](_0x338663)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x5b728b=_0xc68b44[_0x55fe('0xe')];var _0x771374=_0xc68b44[_0x55fe('0xf')];var _0x68c4d5=_0x5b728b[_0x55fe('0x10')]('-')[0x4];var _0x5ddb00=_0x5b728b['split']('-')[0x0];var _0xc6b8c4=encryptor['decryptString'](_0x338663,util['format'](_0x55fe('0x11'),_0x68c4d5,_0x5b728b,_0x5ddb00));var _0x3244bf=JSON[_0x55fe('0x12')](_0xc6b8c4);_0x3244bf[_0x55fe('0x13')]=![];_0x3244bf['uuid']=_0x5b728b;_0x3244bf[_0x55fe('0x14')]=hardware[_0x55fe('0x15')]();if(_0x771374){var _0x23638b=encryptor[_0x55fe('0x16')](_0x771374);_0x3244bf[_0x55fe('0x17')]=_0x23638b;_0x3244bf[_0x55fe('0x18')]=moment(_0x23638b)[_0x55fe('0x19')](0x7,_0x55fe('0x1a'))[_0x55fe('0x1b')]();_0x3244bf[_0x55fe('0x1c')]=_0x3244bf[_0x55fe('0xc')]!=_0x3244bf[_0x55fe('0x14')]?'changed':'disabled';}return _0x3244bf;}catch(_0xe087f7){breakingLicense[_0x55fe('0xc')]=_0xc68b44[_0x55fe('0xe')];breakingLicense[_0x55fe('0x1d')]=_0xe087f7[_0x55fe('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x322582,_0x4ec901){getLicense()[_0x55fe('0xa')](function(_0x34670a){return db['User']['findAll']({'attributes':[_0x55fe('0x1e'),[db[_0x55fe('0x1f')]['fn'](_0x55fe('0x20'),db['sequelize'][_0x55fe('0x21')](_0x55fe('0x1e'))),_0x55fe('0x22')]],'group':_0x55fe('0x1e'),'where':{'role':{'$or':[_0x55fe('0x23'),'user',_0x55fe('0x24')]}},'raw':!![]})[_0x55fe('0xa')](function(_0x58a575){var _0x3289ec={'user':_0x34670a[_0x55fe('0x25')]||0x0,'telephone':_0x34670a['telephones']||0x0};_0x58a575['forEach'](function(_0x53d4e1){var _0x478dd8=_0x53d4e1[_0x55fe('0x1e')]==='admin'?_0x55fe('0x26'):_0x53d4e1[_0x55fe('0x1e')];_0x3289ec[_0x478dd8]-=_0x53d4e1[_0x55fe('0x22')];if(_0x3289ec[_0x478dd8]<0x0)_0x3289ec[_0x478dd8]=0x0;});_0x322582(_0x3289ec);return;});})[_0x55fe('0xb')](function(_0x174964){_0x4ec901(_0x174964);});});}function checkUserLimits(_0xa84077){return new BPromise(function(_0x44bd2d,_0x44259f){getLimits()['then'](function(_0x22f5d7){var _0x36695c=_[_0x55fe('0x27')](_[_0x55fe('0x28')](_0xa84077,_0x55fe('0x1e')),[_0x55fe('0x23'),_0x55fe('0x26'),_0x55fe('0x24')]);var _0x5f1e93=(_0x36695c[_0x55fe('0x23')]||0x0)+(_0x36695c[_0x55fe('0x26')]||0x0);var _0x6a4638=_0x36695c[_0x55fe('0x24')]||0x0;if(_0x5f1e93>_0x22f5d7['user'])return _0x44259f(_0x55fe('0x29'));if(_0x6a4638>_0x22f5d7[_0x55fe('0x24')])return _0x44259f('License\x20limit\x20reached\x20for\x20telephones');return _0x44bd2d();})['catch'](function(_0x4cb1c3){_0x44259f(_0x4cb1c3);});});}module[_0x55fe('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 9f88a8f..5f07389 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 _0x28f2=['myappanuglar-secret','app-id','secret','exports','http://localhost:9000'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x28f2,0x193));var _0x228f=function(_0x3a60fb,_0x681211){_0x3a60fb=_0x3a60fb-0x0;var _0x4ba614=_0x28f2[_0x3a60fb];return _0x4ba614;};'use strict';module[_0x228f('0x0')]={'DOMAIN':_0x228f('0x1'),'SESSION_SECRET':_0x228f('0x2'),'GOOGLE_ID':_0x228f('0x3'),'GOOGLE_SECRET':_0x228f('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xfff0=['app-id','http://localhost:9000','myappanuglar-secret'];(function(_0x30969f,_0x9bc95c){var _0xf66894=function(_0x21c608){while(--_0x21c608){_0x30969f['push'](_0x30969f['shift']());}};_0xf66894(++_0x9bc95c);}(_0xfff0,0x139));var _0x0fff=function(_0x29edd5,_0xb26c07){_0x29edd5=_0x29edd5-0x0;var _0x1bca55=_0xfff0[_0x29edd5];return _0x1bca55;};'use strict';module['exports']={'DOMAIN':_0x0fff('0x0'),'SESSION_SECRET':_0x0fff('0x1'),'GOOGLE_ID':_0x0fff('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 08ad20b..a92ce2d 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6213=['../utils/loggers','fileLogger'];(function(_0x378bd7,_0x19168){var _0x19a1df=function(_0x224153){while(--_0x224153){_0x378bd7['push'](_0x378bd7['shift']());}};_0x19a1df(++_0x19168);}(_0x6213,0x142));var _0x3621=function(_0x3cdff8,_0x8cebd3){_0x3cdff8=_0x3cdff8-0x0;var _0x2db909=_0x6213[_0x3cdff8];return _0x2db909;};'use strict';var fileLogger=require(_0x3621('0x0'))[_0x3621('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0x476e=['exports','../utils/loggers','fileLogger'];(function(_0x4b5982,_0x482507){var _0x70e189=function(_0x217af5){while(--_0x217af5){_0x4b5982['push'](_0x4b5982['shift']());}};_0x70e189(++_0x482507);}(_0x476e,0x172));var _0xe476=function(_0x469a9d,_0x3992f2){_0x469a9d=_0x469a9d-0x0;var _0x567bcb=_0x476e[_0x469a9d];return _0x567bcb;};'use strict';var fileLogger=require(_0xe476('0x0'))[_0xe476('0x1')];module[_0xe476('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index d559a81..b51d9cc 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 _0x9d11=['legacy-libs','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','resolve','root'];(function(_0x61b8f1,_0x1655b3){var _0x3ecfd9=function(_0x2e53fd){while(--_0x2e53fd){_0x61b8f1['push'](_0x61b8f1['shift']());}};_0x3ecfd9(++_0x1655b3);}(_0x9d11,0x1b1));var _0x19d1=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0x9d11[_0x152136];return _0x20df44;};'use strict';var path=require('path');var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0x19d1('0x0')](path['join'](cfg[_0x19d1('0x1')],_0x19d1('0x2')))};var pm2config={'apps':[{'name':_0x19d1('0x3'),'script':path[_0x19d1('0x4')](__dirname,_0x19d1('0x5')),'env':env},{'name':_0x19d1('0x6'),'script':path[_0x19d1('0x4')](__dirname,_0x19d1('0x7')),'env':env},{'name':_0x19d1('0x8'),'script':path[_0x19d1('0x4')](__dirname,'../../services/agi/index.js'),'env':env},{'name':'email','script':path[_0x19d1('0x4')](__dirname,_0x19d1('0x9')),'env':env},{'name':_0x19d1('0xa'),'script':path['join'](__dirname,_0x19d1('0xb')),'env':env},{'name':_0x19d1('0xc'),'script':path[_0x19d1('0x4')](__dirname,_0x19d1('0xd')),'env':env}]};module[_0x19d1('0xe')]=pm2config; \ No newline at end of file +var _0x1ca0=['email','../../services/email/index.js','routing','xdr','exports','../../config/environment','resolve','legacy-libs','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js'];(function(_0x3ee55a,_0x19aeea){var _0x581800=function(_0x636cb7){while(--_0x636cb7){_0x3ee55a['push'](_0x3ee55a['shift']());}};_0x581800(++_0x19aeea);}(_0x1ca0,0x122));var _0x01ca=function(_0x2c9056,_0x552f14){_0x2c9056=_0x2c9056-0x0;var _0x3e6959=_0x1ca0[_0x2c9056];return _0x3e6959;};'use strict';var path=require('path');var cfg=require(_0x01ca('0x0'));var env={'NODE_PATH':path[_0x01ca('0x1')](path['join'](cfg['root'],_0x01ca('0x2')))};var pm2config={'apps':[{'name':_0x01ca('0x3'),'script':path[_0x01ca('0x4')](__dirname,_0x01ca('0x5')),'env':env},{'name':_0x01ca('0x6'),'script':path[_0x01ca('0x4')](__dirname,_0x01ca('0x7')),'env':env},{'name':_0x01ca('0x8'),'script':path[_0x01ca('0x4')](__dirname,_0x01ca('0x9')),'env':env},{'name':_0x01ca('0xa'),'script':path[_0x01ca('0x4')](__dirname,_0x01ca('0xb')),'env':env},{'name':_0x01ca('0xc'),'script':path['join'](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x01ca('0xd'),'script':path[_0x01ca('0x4')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x01ca('0xe')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 2b01a38..325c8ba 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 _0x6204=['delete','dump','saved','pm2','bluebird','./config','connect','connected','then','start','stop','disconnect','restart','list'];(function(_0x50344a,_0x509623){var _0x16376f=function(_0x4ec0ec){while(--_0x4ec0ec){_0x50344a['push'](_0x50344a['shift']());}};_0x16376f(++_0x509623);}(_0x6204,0x1c3));var _0x4620=function(_0x5d236e,_0xa66e2a){_0x5d236e=_0x5d236e-0x0;var _0x16e1bb=_0x6204[_0x5d236e];return _0x16e1bb;};'use strict';var pm2=require(_0x4620('0x0'));var BPromise=require(_0x4620('0x1'));var config=require(_0x4620('0x2'));function connect(){return new BPromise(function(_0x8fd807,_0x312a84){return pm2[_0x4620('0x3')](function(_0x5b1eab){if(_0x5b1eab){return _0x312a84(_0x5b1eab);}return _0x8fd807(_0x4620('0x4'));});});};exports['start']=function(_0x57c029){return connect()[_0x4620('0x5')](function(){return new BPromise(function(_0x11f276,_0x1c0bc6){return pm2[_0x4620('0x6')](_0x57c029,function(_0xb7345e,_0x12a8b2){if(_0xb7345e){return _0x1c0bc6(_0xb7345e);}pm2['disconnect']();return _0x11f276(_0x12a8b2);});});});};exports[_0x4620('0x7')]=function(_0x3615ba){return connect()[_0x4620('0x5')](function(){return new BPromise(function(_0x4424c1,_0x456c0f){return pm2[_0x4620('0x7')](_0x3615ba,function(_0x58ed75,_0x43f635){if(_0x58ed75){return _0x456c0f(_0x58ed75);}pm2[_0x4620('0x8')]();return _0x4424c1(_0x43f635);});});});};exports[_0x4620('0x9')]=function(_0x2fc732){return connect()[_0x4620('0x5')](function(){return new BPromise(function(_0x2d69ab,_0x12203e){return pm2[_0x4620('0x9')](_0x2fc732,function(_0x4e014e,_0xb99abc){if(_0x4e014e){return _0x12203e(_0x4e014e);}pm2[_0x4620('0x8')]();return _0x2d69ab(_0xb99abc);});});});};exports['list']=function(){return connect()[_0x4620('0x5')](function(){return new BPromise(function(_0x2c1c38,_0x2acedb){return pm2[_0x4620('0xa')](function(_0x4e5c61,_0x1a88b8){if(_0x4e5c61){return _0x2acedb(_0x4e5c61);}pm2[_0x4620('0x8')]();return _0x2c1c38(_0x1a88b8);});});});};exports['describe']=function(_0x24e4f4){return connect()['then'](function(){return new BPromise(function(_0x2b87a7,_0x3db12b){return pm2['describe'](_0x24e4f4,function(_0x531ace,_0x3560c8){if(_0x531ace){return _0x3db12b(_0x531ace);}pm2[_0x4620('0x8')]();return _0x2b87a7(_0x3560c8);});});});};exports[_0x4620('0xb')]=function(_0x4b79b2){return connect()[_0x4620('0x5')](function(){return new BPromise(function(_0x59137f,_0x4e2cf4){return pm2[_0x4620('0xb')](_0x4b79b2,function(_0x5c19d5,_0xfa991){if(_0x5c19d5){return _0x4e2cf4(_0x5c19d5);}pm2[_0x4620('0x8')]();return _0x59137f(_0xfa991);});});});};exports['dump']=function(){return connect()[_0x4620('0x5')](function(){return new BPromise(function(_0x366329,_0x2bc2cf){return pm2[_0x4620('0xc')](function(_0x9312bc){if(_0x9312bc){return _0x2bc2cf(_0x9312bc);}return _0x366329(_0x4620('0xd'));});});});}; \ No newline at end of file +var _0x7c3b=['pm2','bluebird','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','saved'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7c3b,0x193));var _0xb7c3=function(_0x3604ea,_0x16db6f){_0x3604ea=_0x3604ea-0x0;var _0xd1c443=_0x7c3b[_0x3604ea];return _0xd1c443;};'use strict';var pm2=require(_0xb7c3('0x0'));var BPromise=require(_0xb7c3('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x2d5512,_0x34ca7b){return pm2[_0xb7c3('0x2')](function(_0x3442b1){if(_0x3442b1){return _0x34ca7b(_0x3442b1);}return _0x2d5512(_0xb7c3('0x3'));});});};exports[_0xb7c3('0x4')]=function(_0x521a95){return connect()[_0xb7c3('0x5')](function(){return new BPromise(function(_0x21c3a,_0x15f0a2){return pm2[_0xb7c3('0x4')](_0x521a95,function(_0x1d2b7f,_0x1c3e9a){if(_0x1d2b7f){return _0x15f0a2(_0x1d2b7f);}pm2[_0xb7c3('0x6')]();return _0x21c3a(_0x1c3e9a);});});});};exports[_0xb7c3('0x7')]=function(_0x3e66ac){return connect()[_0xb7c3('0x5')](function(){return new BPromise(function(_0x852797,_0xb1277a){return pm2[_0xb7c3('0x7')](_0x3e66ac,function(_0x3a5921,_0x419eb7){if(_0x3a5921){return _0xb1277a(_0x3a5921);}pm2['disconnect']();return _0x852797(_0x419eb7);});});});};exports[_0xb7c3('0x8')]=function(_0x5af806){return connect()[_0xb7c3('0x5')](function(){return new BPromise(function(_0x197e27,_0x125dea){return pm2['restart'](_0x5af806,function(_0xb14b5,_0x4d7a1b){if(_0xb14b5){return _0x125dea(_0xb14b5);}pm2['disconnect']();return _0x197e27(_0x4d7a1b);});});});};exports[_0xb7c3('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x6e8bb2,_0x47e63e){return pm2['list'](function(_0x5b07ff,_0x375c98){if(_0x5b07ff){return _0x47e63e(_0x5b07ff);}pm2[_0xb7c3('0x6')]();return _0x6e8bb2(_0x375c98);});});});};exports[_0xb7c3('0xa')]=function(_0x27c42f){return connect()['then'](function(){return new BPromise(function(_0x4dc9e8,_0x403915){return pm2['describe'](_0x27c42f,function(_0x1e6a1e,_0xd448c6){if(_0x1e6a1e){return _0x403915(_0x1e6a1e);}pm2[_0xb7c3('0x6')]();return _0x4dc9e8(_0xd448c6);});});});};exports[_0xb7c3('0xb')]=function(_0x58d1cd){return connect()[_0xb7c3('0x5')](function(){return new BPromise(function(_0xdeded7,_0x36c00d){return pm2[_0xb7c3('0xb')](_0x58d1cd,function(_0x12b58a,_0x16e4fc){if(_0x12b58a){return _0x36c00d(_0x12b58a);}pm2[_0xb7c3('0x6')]();return _0xdeded7(_0x16e4fc);});});});};exports['dump']=function(){return connect()[_0xb7c3('0x5')](function(){return new BPromise(function(_0x4602dc,_0x4b8733){return pm2['dump'](function(_0x4f0635){if(_0x4f0635){return _0x4b8733(_0x4f0635);}return _0x4602dc(_0xb7c3('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 0533935..033a1ab 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 _0x9f13=['info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','minutes','length','map'];(function(_0x861ca3,_0x5a3f7c){var _0x15d94d=function(_0x5076dd){while(--_0x5076dd){_0x861ca3['push'](_0x861ca3['shift']());}};_0x15d94d(++_0x5a3f7c);}(_0x9f13,0x91));var _0x39f1=function(_0x5b445b,_0xd251da){_0x5b445b=_0x5b445b-0x0;var _0x1a40fe=_0x9f13[_0x5b445b];return _0x1a40fe;};'use strict';var _=require(_0x39f1('0x0'));var moment=require(_0x39f1('0x1'));var Redis=require(_0x39f1('0x2'));var util=require('util');var config=require(_0x39f1('0x3'));var db=require(_0x39f1('0x4'))['db'];var logger=require(_0x39f1('0x5'))(_0x39f1('0x6'));config[_0x39f1('0x7')]=_['defaults'](config[_0x39f1('0x7')],{'host':_0x39f1('0x8'),'port':0x18eb});var io=require(_0x39f1('0x9'))(new Redis(config[_0x39f1('0x7')]));function closeInteractions(){var _0x50a37b=0x0;var _0x48ac35=[];return db[_0x39f1('0xa')][_0x39f1('0xb')]({'raw':!![],'attributes':['id',_0x39f1('0xc')],'where':{'id':0x1}})[_0x39f1('0xd')](function(_0x49c913){_0x50a37b=_0x49c913[_0x39f1('0xc')];if(_0x50a37b){return db[_0x39f1('0xe')][_0x39f1('0xf')]({'raw':!![],'attributes':['id',_0x39f1('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x49c913['chatTimeout'],_0x39f1('0x11'))}}});}else{return[];}})['then'](function(_0x34542c){if(_0x34542c&&_0x34542c[_0x39f1('0x12')]){_0x48ac35=_[_0x39f1('0x13')](_0x34542c||[],'id');logger[_0x39f1('0x14')](_0x39f1('0x15'),_0x48ac35[_0x39f1('0x16')]());return db['ChatInteraction'][_0x39f1('0x17')]({'closeReason':_0x39f1('0x18'),'disposition':_0x39f1('0x19'),'closed':!![],'closedAt':moment()[_0x39f1('0x1a')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x48ac35}});}})[_0x39f1('0xd')](function(){if(_0x48ac35&&_0x48ac35[_0x39f1('0x12')]){logger[_0x39f1('0x14')](_0x39f1('0x1b'),_0x48ac35[_0x39f1('0x16')]());for(var _0x714649=0x0;_0x714649<_0x48ac35['length'];_0x714649++){io[_0x39f1('0x1c')](_0x39f1('0x1d'),{'id':_0x48ac35[_0x714649],'closed':!![]});}}})[_0x39f1('0x1e')](function(_0x466cbc){logger['error'](_0x39f1('0x1f'),_0x466cbc?util['inspect'](_0x466cbc,{'showHidden':![],'depth':null}):'');});}exports[_0x39f1('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xad07=['inspect','start','lodash','ioredis','util','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','findAll','lastMsgAt','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xad07,0x14c));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7ad0('0x0'));var moment=require('moment');var Redis=require(_0x7ad0('0x1'));var util=require(_0x7ad0('0x2'));var config=require('../../config/environment');var db=require(_0x7ad0('0x3'))['db'];var logger=require(_0x7ad0('0x4'))(_0x7ad0('0x5'));config['redis']=_[_0x7ad0('0x6')](config[_0x7ad0('0x7')],{'host':_0x7ad0('0x8'),'port':0x18eb});var io=require(_0x7ad0('0x9'))(new Redis(config[_0x7ad0('0x7')]));function closeInteractions(){var _0xb10bcd=0x0;var _0x3f729e=[];return db[_0x7ad0('0xa')][_0x7ad0('0xb')]({'raw':!![],'attributes':['id',_0x7ad0('0xc')],'where':{'id':0x1}})[_0x7ad0('0xd')](function(_0x5642d1){_0xb10bcd=_0x5642d1[_0x7ad0('0xc')];if(_0xb10bcd){return db['ChatInteraction'][_0x7ad0('0xe')]({'raw':!![],'attributes':['id',_0x7ad0('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x5642d1[_0x7ad0('0xc')],_0x7ad0('0x10'))}}});}else{return[];}})[_0x7ad0('0xd')](function(_0x21d2ec){if(_0x21d2ec&&_0x21d2ec[_0x7ad0('0x11')]){_0x3f729e=_[_0x7ad0('0x12')](_0x21d2ec||[],'id');logger[_0x7ad0('0x13')](_0x7ad0('0x14'),_0x3f729e[_0x7ad0('0x15')]());return db['ChatInteraction'][_0x7ad0('0x16')]({'closeReason':_0x7ad0('0x17'),'disposition':_0x7ad0('0x18'),'closed':!![],'closedAt':moment()[_0x7ad0('0x19')](_0x7ad0('0x1a'))},{'where':{'id':_0x3f729e}});}})[_0x7ad0('0xd')](function(){if(_0x3f729e&&_0x3f729e[_0x7ad0('0x11')]){logger[_0x7ad0('0x13')](_0x7ad0('0x1b'),_0x3f729e[_0x7ad0('0x15')]());for(var _0x329ea9=0x0;_0x329ea9<_0x3f729e[_0x7ad0('0x11')];_0x329ea9++){io['emit'](_0x7ad0('0x1c'),{'id':_0x3f729e[_0x329ea9],'closed':!![]});}}})['catch'](function(_0x300013){logger[_0x7ad0('0x1d')](_0x7ad0('0x1e'),_0x300013?util[_0x7ad0('0x1f')](_0x300013,{'showHidden':![],'depth':null}):'');});}exports[_0x7ad0('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index aa8238d..da2587f 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 _0x8194=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x53b4c6,_0x54bd38){var _0x292711=function(_0x2956ea){while(--_0x2956ea){_0x53b4c6['push'](_0x53b4c6['shift']());}};_0x292711(++_0x54bd38);}(_0x8194,0x99));var _0x4819=function(_0x59f0ff,_0x2b9d67){_0x59f0ff=_0x59f0ff-0x0;var _0x28e782=_0x8194[_0x59f0ff];return _0x28e782;};'use strict';function start(){var _0x358851=require(_0x4819('0x0'));return _0x358851['startAllRefreshIntervals']();}module[_0x4819('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x1a6e=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x2db526,_0x1c599d){var _0x50f269=function(_0x1eeec7){while(--_0x1eeec7){_0x2db526['push'](_0x2db526['shift']());}};_0x50f269(++_0x1c599d);}(_0x1a6e,0x65));var _0xe1a6=function(_0x540160,_0x24c6b6){_0x540160=_0x540160-0x0;var _0x476120=_0x1a6e[_0x540160];return _0x476120;};'use strict';function start(){var _0x4642cc=require(_0xe1a6('0x0'));return _0x4642cc[_0xe1a6('0x1')]();}module[_0xe1a6('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 c9a1ad3..7ed46fd 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 _0x84fe=['catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','active','isBetween','endAt','add','start','add\x20cron','stop\x20cron','update','update\x20cron','util','path','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','name','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','attachments','stringify','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','email\x20sent'];(function(_0x10a7f6,_0x2a5f41){var _0x3a026a=function(_0x1fefb6){while(--_0x1fefb6){_0x10a7f6['push'](_0x10a7f6['shift']());}};_0x3a026a(++_0x2a5f41);}(_0x84fe,0xdf));var _0xe84f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x84fe[_0x321bb2];return _0x9c12ed;};'use strict';var fs=require('fs');var util=require(_0xe84f('0x0'));var path=require(_0xe84f('0x1'));var _=require('lodash');var moment=require(_0xe84f('0x2'));var CronJobManager=require(_0xe84f('0x3'));var jayson=require(_0xe84f('0x4'));var BPromise=require(_0xe84f('0x5'));var logger=require(_0xe84f('0x6'))(_0xe84f('0x7'));var db=require(_0xe84f('0x8'))['db'];var analyticCustomReportController=require(_0xe84f('0x9'));var analyticDefaultReportController=require(_0xe84f('0xa'));var client=jayson[_0xe84f('0xb')][_0xe84f('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x31c033,_0x32f7f5){return function(){logger[_0xe84f('0xd')](_0xe84f('0xe'),_0x31c033[_0xe84f('0xf')]);var _0x13567e=!![];var _0x334bb8=_0x31c033[_0xe84f('0x10')]['getSmtpOptions']();var _0x4c54c4={'account':_0x334bb8,'message':{'from':util[_0xe84f('0x11')](_0xe84f('0x12'),_0x31c033['MailAccount']['name'],_0x31c033[_0xe84f('0x10')][_0xe84f('0xf')]||_0x31c033[_0xe84f('0x10')][_0xe84f('0x13')]['user']),'to':_0x31c033['email'],'cc':_0x31c033['cc'],'bcc':_0x31c033[_0xe84f('0x14')],'subject':util[_0xe84f('0x11')](_0xe84f('0x15'),_0x32f7f5[_0xe84f('0x16')],_0x31c033['subtractNumber'],_0x31c033['subtractUnit'])}};var _0x58dd77=path[_0xe84f('0x17')](__dirname,_0xe84f('0x18'));var _0x30417f=_0x32f7f5[_0xe84f('0x19')];var _0x1a86ea=util[_0xe84f('0x11')](_0xe84f('0x1a'),path[_0xe84f('0x1b')](_0x32f7f5[_0xe84f('0x19')],path[_0xe84f('0x1c')](_0x32f7f5[_0xe84f('0x19')])),_0xe84f('0x1d'));var _0x4377a9=path[_0xe84f('0x17')](_0x58dd77,_0x30417f);var _0x3ab7ae=path[_0xe84f('0x17')](_0x58dd77,_0x1a86ea);if(fs[_0xe84f('0x1e')](_0x4377a9)){_0x32f7f5[_0xe84f('0x1f')]=_0xe84f('0x20');_0x4c54c4[_0xe84f('0x21')][_0xe84f('0x22')]=[{'filename':_0x30417f,'path':_0x4377a9}];_0x4c54c4[_0xe84f('0x21')]['text']=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xe84f('0x23')](_0x32f7f5,null,0x2));}else if(fs[_0xe84f('0x1e')](_0x3ab7ae)){_0x32f7f5[_0xe84f('0x1f')]=_0xe84f('0x20');_0x4c54c4['message']['attachments']=[{'filename':_0x1a86ea,'path':_0x3ab7ae}];}else{_0x4c54c4[_0xe84f('0x21')][_0xe84f('0x24')]=_0xe84f('0x25');if(!_0x31c033['sendIfEmpty']){_0x13567e=![];logger['info'](_0xe84f('0x26'));}}if(_0x13567e){return client['request'](_0xe84f('0x27'),_0x4c54c4)[_0xe84f('0x28')](function(_0x24ada2){if(_0x24ada2[_0xe84f('0x29')]){return logger[_0xe84f('0x29')](_0xe84f('0x2a'),JSON[_0xe84f('0x23')](_0x24ada2));}return logger[_0xe84f('0xd')](_0xe84f('0x2b'));})[_0xe84f('0x2c')](function(_0xd2adb1){return logger[_0xe84f('0x29')](_0xe84f('0x2a'),JSON['stringify'](_0xd2adb1));});}};}function handleError(){return function(_0x3a8ef3){return logger[_0xe84f('0x29')](JSON[_0xe84f('0x23')](_0x3a8ef3));};}function handleResult(_0x32d366){return function(_0x4c24c4){logger[_0xe84f('0xd')](_0xe84f('0x2d'),JSON[_0xe84f('0x23')](_0x4c24c4));if(_0x32d366[_0xe84f('0x10')]&&_0x32d366['MailAccount'][_0xe84f('0x13')]&&!_['isNil'](_0x32d366[_0xe84f('0xf')])){setTimeout(handleSendEmail(_0x32d366,_0x4c24c4),0x3c*0x3e8);}};}function handleJob(_0x3c36ce){return function(){try{if(_[_0xe84f('0x2e')](_0x3c36ce[_0xe84f('0x2f')])){return logger[_0xe84f('0xd')](_0xe84f('0x30'));}if(_[_0xe84f('0x2e')](_0x3c36ce[_0xe84f('0x31')])){return logger[_0xe84f('0xd')](_0xe84f('0x32'));}var _0x29d2f6={'startDate':moment()[_0xe84f('0x33')](_0x3c36ce[_0xe84f('0x2f')],_0x3c36ce[_0xe84f('0x31')])[_0xe84f('0x11')](_0xe84f('0x34')),'endDate':moment()[_0xe84f('0x11')](_0xe84f('0x34')),'type':'scheduled','output':_0x3c36ce[_0xe84f('0x35')],'name':_0x3c36ce[_0xe84f('0x16')]};if(!_[_0xe84f('0x2e')](_0x3c36ce['DefaultReportId'])){logger[_0xe84f('0xd')]('exec\x20defaul\x20report\x20id:%s',_0x3c36ce[_0xe84f('0x36')]);return analyticDefaultReportController[_0xe84f('0x37')]({'id':_0x3c36ce[_0xe84f('0x36')]},_0x29d2f6)[_0xe84f('0x28')](handleResult(_0x3c36ce))[_0xe84f('0x2c')](handleError());}if(!_['isNil'](_0x3c36ce[_0xe84f('0x38')])){logger[_0xe84f('0xd')](_0xe84f('0x39'),_0x3c36ce[_0xe84f('0x38')]);return analyticCustomReportController[_0xe84f('0x37')]({'id':_0x3c36ce['CustomReportId']},_0x29d2f6)['then'](handleResult(_0x3c36ce))['catch'](handleError());}}catch(_0x8c3e39){logger[_0xe84f('0x29')](JSON[_0xe84f('0x23')](_0x8c3e39));}return logger[_0xe84f('0xd')](_0xe84f('0x3a'));};}function getJobs(_0x560a58){var _0x3f1bed={};if(_0x560a58){_0x3f1bed['id']=_0x560a58;}return db[_0xe84f('0x3b')][_0xe84f('0x3c')]({'where':_0x3f1bed,'include':[{'model':db[_0xe84f('0x10')],'attributes':['id',_0xe84f('0x16'),'email'],'include':[{'model':db[_0xe84f('0x3d')],'as':'Smtp','include':[{'model':db[_0xe84f('0x3e')],'as':_0xe84f('0x3e')}]}]}]})[_0xe84f('0x28')](function(_0x22e228){var _0x15a04c=_[_0xe84f('0x3f')](manager[_0xe84f('0x40')]);var _0x45f714=_[_0xe84f('0x41')](_0x22e228,function(_0x1b5e8f){return _0x1b5e8f['id'][_0xe84f('0x42')]();});var _0x57a105=_[_0xe84f('0x43')](_0x22e228,function(_0x51258d){return _0x51258d['id']['toString']();});var _0x48613=_0x560a58?_0x45f714:_[_0xe84f('0x44')](_0x45f714,_0x15a04c);var _0x27fb8d=_[_0xe84f('0x45')](_0x45f714,_0x15a04c);var _0x3e16ff=_[_0xe84f('0x44')](_0x15a04c,_0x45f714);var _0x1ad766;var _0x11f917;for(_0x1ad766=0x0;_0x1ad766<_0x3e16ff[_0xe84f('0x46')]&&!_0x560a58;_0x1ad766+=0x1){_0x11f917=_0x3e16ff[_0x1ad766][_0xe84f('0x42')]();if(manager[_0xe84f('0x47')](_0x11f917)){manager[_0xe84f('0x48')](_0x11f917);manager[_0xe84f('0x49')](_0x11f917);logger[_0xe84f('0xd')](_0xe84f('0x4a'),_0x11f917);}}logger[_0xe84f('0xd')]('toRun',JSON[_0xe84f('0x23')](_0x48613));for(_0x1ad766=0x0;_0x1ad766<_0x48613['length'];_0x1ad766+=0x1){_0x11f917=_0x48613[_0x1ad766]['toString']();logger[_0xe84f('0xd')](_0xe84f('0x4b'),_0x11f917);if(_0x560a58){logger[_0xe84f('0xd')](_0xe84f('0x4c'),_0x560a58);logger[_0xe84f('0xd')](JSON[_0xe84f('0x23')](_0x57a105[_0x11f917]));BPromise[_0xe84f('0x4d')]()['then'](handleJob(_0x57a105[_0x11f917]));logger[_0xe84f('0xd')](_0xe84f('0x4e'),_0x57a105[_0x11f917][_0xe84f('0x16')],_0x57a105[_0x11f917][_0xe84f('0x4f')]);}else if(_0x57a105[_0x11f917][_0xe84f('0x4f')]&&_0x57a105[_0x11f917][_0xe84f('0x50')]&&moment()[_0xe84f('0x51')](_0x57a105[_0x11f917]['startAt'],_0x57a105[_0x11f917][_0xe84f('0x52')])){manager[_0xe84f('0x53')](_0x11f917,_0x57a105[_0x11f917][_0xe84f('0x4f')],handleJob(_0x57a105[_0x11f917]));manager[_0xe84f('0x54')](_0x11f917);logger[_0xe84f('0xd')](_0xe84f('0x55'),_0x57a105[_0x11f917][_0xe84f('0x16')],_0x57a105[_0x11f917][_0xe84f('0x4f')]);}else if(manager['exists'](_0x11f917)){manager[_0xe84f('0x48')](_0x11f917);manager[_0xe84f('0x49')](_0x11f917);logger[_0xe84f('0xd')](_0xe84f('0x56'),_0x57a105[_0x11f917][_0xe84f('0x16')],_0x57a105[_0x11f917][_0xe84f('0x4f')]);}}for(_0x1ad766=0x0,_0x11f917;_0x1ad766<_0x27fb8d['length']&&!_0x560a58;_0x1ad766+=0x1){_0x11f917=_0x27fb8d[_0x1ad766]['toString']();if(manager[_0xe84f('0x47')](_0x11f917)){if(_0x57a105[_0x11f917][_0xe84f('0x4f')]&&_0x57a105[_0x11f917][_0xe84f('0x50')]&&moment()[_0xe84f('0x51')](_0x57a105[_0x11f917]['startAt'],_0x57a105[_0x11f917][_0xe84f('0x52')])){manager[_0xe84f('0x57')](_0x11f917,_0x57a105[_0x11f917][_0xe84f('0x4f')],handleJob(_0x57a105[_0x11f917]));logger[_0xe84f('0xd')](_0xe84f('0x58'),_0x57a105[_0x11f917][_0xe84f('0x16')],_0x57a105[_0x11f917][_0xe84f('0x4f')]);}else{manager[_0xe84f('0x48')](_0x11f917);manager['deleteJob'](_0x11f917);logger[_0xe84f('0xd')]('stop\x20cron',_0x57a105[_0x11f917]['name'],_0x57a105[_0x11f917][_0xe84f('0x4f')]);}}}})[_0xe84f('0x2c')](function(_0x52b8e7){logger[_0xe84f('0x29')](JSON['stringify'](_0x52b8e7));});}exports['run']=function(_0x45eabc){return getJobs(_0x45eabc);};exports[_0xe84f('0x54')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x73d7=['stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','info','empty\x20file,\x20email\x20not\x20sent','request','error','email\x20sent','catch','error\x20mail','data','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','then','no\x20report\x20id','Schedule','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','length','deleteJob','toRun','index','my\x20id','resolve','run\x20job','cron','startAt','add','start','exists','stop','isBetween','endAt','update','update\x20cron','stop\x20cron','run','path','moment','cron-job-manager','jayson/promise','../logger','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a'];(function(_0x35ea46,_0x52c1c1){var _0x5e6dfa=function(_0x3a5abc){while(--_0x3a5abc){_0x35ea46['push'](_0x35ea46['shift']());}};_0x5e6dfa(++_0x52c1c1);}(_0x73d7,0x135));var _0x773d=function(_0x2186d0,_0x32b73b){_0x2186d0=_0x2186d0-0x0;var _0x5443bd=_0x73d7[_0x2186d0];return _0x5443bd;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x773d('0x0'));var _=require('lodash');var moment=require(_0x773d('0x1'));var CronJobManager=require(_0x773d('0x2'));var jayson=require(_0x773d('0x3'));var BPromise=require('bluebird');var logger=require(_0x773d('0x4'))('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x773d('0x5'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x773d('0x6')][_0x773d('0x7')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5e2ac3,_0x3e4a74){return function(){logger['info'](_0x773d('0x8'),_0x5e2ac3['email']);var _0x52daad=!![];var _0x398f84=_0x5e2ac3[_0x773d('0x9')][_0x773d('0xa')]();var _0x12eff2={'account':_0x398f84,'message':{'from':util[_0x773d('0xb')](_0x773d('0xc'),_0x5e2ac3['MailAccount'][_0x773d('0xd')],_0x5e2ac3['MailAccount']['email']||_0x5e2ac3['MailAccount']['Smtp']['user']),'to':_0x5e2ac3['email'],'cc':_0x5e2ac3['cc'],'bcc':_0x5e2ac3[_0x773d('0xe')],'subject':util[_0x773d('0xb')](_0x773d('0xf'),_0x3e4a74[_0x773d('0xd')],_0x5e2ac3[_0x773d('0x10')],_0x5e2ac3[_0x773d('0x11')])}};var _0x270cd0=path[_0x773d('0x12')](__dirname,_0x773d('0x13'));var _0x41f413=_0x3e4a74[_0x773d('0x14')];var _0x3a5757=util[_0x773d('0xb')](_0x773d('0x15'),path[_0x773d('0x16')](_0x3e4a74['savename'],path['extname'](_0x3e4a74['savename'])),_0x773d('0x17'));var _0x5494d3=path[_0x773d('0x12')](_0x270cd0,_0x41f413);var _0x3cd3d1=path['join'](_0x270cd0,_0x3a5757);if(fs[_0x773d('0x18')](_0x5494d3)){_0x3e4a74[_0x773d('0x19')]=_0x773d('0x1a');_0x12eff2[_0x773d('0x1b')][_0x773d('0x1c')]=[{'filename':_0x41f413,'path':_0x5494d3}];_0x12eff2[_0x773d('0x1b')][_0x773d('0x1d')]=util[_0x773d('0xb')](_0x773d('0x1e'),JSON[_0x773d('0x1f')](_0x3e4a74,null,0x2));}else if(fs[_0x773d('0x18')](_0x3cd3d1)){_0x3e4a74[_0x773d('0x19')]=_0x773d('0x1a');_0x12eff2[_0x773d('0x1b')][_0x773d('0x1c')]=[{'filename':_0x3a5757,'path':_0x3cd3d1}];}else{_0x12eff2[_0x773d('0x1b')]['text']=_0x773d('0x20');if(!_0x5e2ac3['sendIfEmpty']){_0x52daad=![];logger[_0x773d('0x21')](_0x773d('0x22'));}}if(_0x52daad){return client[_0x773d('0x23')]('SendMail',_0x12eff2)['then'](function(_0x5b4c51){if(_0x5b4c51[_0x773d('0x24')]){return logger['error']('error\x20mail',JSON['stringify'](_0x5b4c51));}return logger['info'](_0x773d('0x25'));})[_0x773d('0x26')](function(_0x4637e2){return logger[_0x773d('0x24')](_0x773d('0x27'),JSON[_0x773d('0x1f')](_0x4637e2));});}};}function handleError(){return function(_0x1cdb97){return logger[_0x773d('0x24')](JSON['stringify'](_0x1cdb97));};}function handleResult(_0x150910){return function(_0x1e298a){logger[_0x773d('0x21')](_0x773d('0x28'),JSON[_0x773d('0x1f')](_0x1e298a));if(_0x150910['MailAccount']&&_0x150910[_0x773d('0x9')][_0x773d('0x29')]&&!_[_0x773d('0x2a')](_0x150910['email'])){setTimeout(handleSendEmail(_0x150910,_0x1e298a),0x3c*0x3e8);}};}function handleJob(_0x1f079a){return function(){try{if(_[_0x773d('0x2a')](_0x1f079a[_0x773d('0x10')])){return logger[_0x773d('0x21')](_0x773d('0x2b'));}if(_['isNil'](_0x1f079a[_0x773d('0x11')])){return logger[_0x773d('0x21')](_0x773d('0x2c'));}var _0x14ac2c={'startDate':moment()[_0x773d('0x2d')](_0x1f079a['subtractNumber'],_0x1f079a['subtractUnit'])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x773d('0x2e')),'type':_0x773d('0x2f'),'output':_0x1f079a[_0x773d('0x30')],'name':_0x1f079a['name']};if(!_[_0x773d('0x2a')](_0x1f079a['DefaultReportId'])){logger['info'](_0x773d('0x31'),_0x1f079a[_0x773d('0x32')]);return analyticDefaultReportController[_0x773d('0x33')]({'id':_0x1f079a[_0x773d('0x32')]},_0x14ac2c)['then'](handleResult(_0x1f079a))[_0x773d('0x26')](handleError());}if(!_[_0x773d('0x2a')](_0x1f079a[_0x773d('0x34')])){logger[_0x773d('0x21')](_0x773d('0x35'),_0x1f079a['CustomReportId']);return analyticCustomReportController[_0x773d('0x33')]({'id':_0x1f079a['CustomReportId']},_0x14ac2c)[_0x773d('0x36')](handleResult(_0x1f079a))['catch'](handleError());}}catch(_0x5e7c37){logger[_0x773d('0x24')](JSON[_0x773d('0x1f')](_0x5e7c37));}return logger['info'](_0x773d('0x37'));};}function getJobs(_0x59f108){var _0x3f00c8={};if(_0x59f108){_0x3f00c8['id']=_0x59f108;}return db[_0x773d('0x38')]['findAll']({'where':_0x3f00c8,'include':[{'model':db['MailAccount'],'attributes':['id',_0x773d('0xd'),'email'],'include':[{'model':db[_0x773d('0x39')],'as':_0x773d('0x29'),'include':[{'model':db[_0x773d('0x3a')],'as':_0x773d('0x3a')}]}]}]})[_0x773d('0x36')](function(_0x52dbed){var _0x5f2a75=_[_0x773d('0x3b')](manager[_0x773d('0x3c')]);var _0x1dfe01=_[_0x773d('0x3d')](_0x52dbed,function(_0x1e0646){return _0x1e0646['id'][_0x773d('0x3e')]();});var _0x5cdea1=_[_0x773d('0x3f')](_0x52dbed,function(_0x15ba88){return _0x15ba88['id'][_0x773d('0x3e')]();});var _0x11964e=_0x59f108?_0x1dfe01:_[_0x773d('0x40')](_0x1dfe01,_0x5f2a75);var _0x118cda=_[_0x773d('0x41')](_0x1dfe01,_0x5f2a75);var _0x387393=_[_0x773d('0x40')](_0x5f2a75,_0x1dfe01);var _0x261774;var _0x4f053b;for(_0x261774=0x0;_0x261774<_0x387393[_0x773d('0x42')]&&!_0x59f108;_0x261774+=0x1){_0x4f053b=_0x387393[_0x261774][_0x773d('0x3e')]();if(manager['exists'](_0x4f053b)){manager['stop'](_0x4f053b);manager[_0x773d('0x43')](_0x4f053b);logger[_0x773d('0x21')]('delete\x20cron',_0x4f053b);}}logger['info'](_0x773d('0x44'),JSON[_0x773d('0x1f')](_0x11964e));for(_0x261774=0x0;_0x261774<_0x11964e[_0x773d('0x42')];_0x261774+=0x1){_0x4f053b=_0x11964e[_0x261774][_0x773d('0x3e')]();logger[_0x773d('0x21')](_0x773d('0x45'),_0x4f053b);if(_0x59f108){logger[_0x773d('0x21')](_0x773d('0x46'),_0x59f108);logger[_0x773d('0x21')](JSON[_0x773d('0x1f')](_0x5cdea1[_0x4f053b]));BPromise[_0x773d('0x47')]()[_0x773d('0x36')](handleJob(_0x5cdea1[_0x4f053b]));logger[_0x773d('0x21')](_0x773d('0x48'),_0x5cdea1[_0x4f053b][_0x773d('0xd')],_0x5cdea1[_0x4f053b][_0x773d('0x49')]);}else if(_0x5cdea1[_0x4f053b][_0x773d('0x49')]&&_0x5cdea1[_0x4f053b]['active']&&moment()['isBetween'](_0x5cdea1[_0x4f053b][_0x773d('0x4a')],_0x5cdea1[_0x4f053b]['endAt'])){manager[_0x773d('0x4b')](_0x4f053b,_0x5cdea1[_0x4f053b]['cron'],handleJob(_0x5cdea1[_0x4f053b]));manager[_0x773d('0x4c')](_0x4f053b);logger['info']('add\x20cron',_0x5cdea1[_0x4f053b]['name'],_0x5cdea1[_0x4f053b][_0x773d('0x49')]);}else if(manager[_0x773d('0x4d')](_0x4f053b)){manager[_0x773d('0x4e')](_0x4f053b);manager['deleteJob'](_0x4f053b);logger[_0x773d('0x21')]('stop\x20cron',_0x5cdea1[_0x4f053b]['name'],_0x5cdea1[_0x4f053b][_0x773d('0x49')]);}}for(_0x261774=0x0,_0x4f053b;_0x261774<_0x118cda['length']&&!_0x59f108;_0x261774+=0x1){_0x4f053b=_0x118cda[_0x261774]['toString']();if(manager['exists'](_0x4f053b)){if(_0x5cdea1[_0x4f053b][_0x773d('0x49')]&&_0x5cdea1[_0x4f053b]['active']&&moment()[_0x773d('0x4f')](_0x5cdea1[_0x4f053b][_0x773d('0x4a')],_0x5cdea1[_0x4f053b][_0x773d('0x50')])){manager[_0x773d('0x51')](_0x4f053b,_0x5cdea1[_0x4f053b]['cron'],handleJob(_0x5cdea1[_0x4f053b]));logger[_0x773d('0x21')](_0x773d('0x52'),_0x5cdea1[_0x4f053b][_0x773d('0xd')],_0x5cdea1[_0x4f053b][_0x773d('0x49')]);}else{manager[_0x773d('0x4e')](_0x4f053b);manager['deleteJob'](_0x4f053b);logger['info'](_0x773d('0x53'),_0x5cdea1[_0x4f053b][_0x773d('0xd')],_0x5cdea1[_0x4f053b][_0x773d('0x49')]);}}}})[_0x773d('0x26')](function(_0x5b2941){logger['error'](JSON['stringify'](_0x5b2941));});}exports[_0x773d('0x54')]=function(_0x2661f1){return getJobs(_0x2661f1);};exports[_0x773d('0x4c')]=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 e6ad36b..1cb85a0 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 _0x9879=['IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','error','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','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','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','sentiment','sentimentAccountId','sentimentRegion','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason','resolve','bucket','findOne','Mixed','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll'];(function(_0x56f4e5,_0x140814){var _0x486dfd=function(_0x29078a){while(--_0x29078a){_0x56f4e5['push'](_0x56f4e5['shift']());}};_0x486dfd(++_0x140814);}(_0x9879,0x98));var _0x9987=function(_0x154f04,_0x1038df){_0x154f04=_0x154f04-0x0;var _0x321b4f=_0x9879[_0x154f04];return _0x321b4f;};var _=require('lodash');var AWS=require(_0x9987('0x0'));var rp=require(_0x9987('0x1'));var util=require(_0x9987('0x2'));var BPromise=require(_0x9987('0x3'));var db=require(_0x9987('0x4'))['db'];var logger=require(_0x9987('0x5'))(_0x9987('0x6'));function getTranscriptionJob(_0x2ab2a8,_0x37ebe8,_0x58c208,_0x271cf0){return new Promise(function(_0x473510,_0x15193d){var _0xce52bb=new AWS[(_0x9987('0x7'))]({'accessKeyId':_0x37ebe8,'secretAccessKey':_0x2ab2a8,'region':_0x58c208});_0xce52bb['getTranscriptionJob']({'TranscriptionJobName':_0x271cf0},function(_0x1cf155,_0x563978){if(_0x1cf155){return _0x15193d(_0x1cf155);}else{return _0x473510(_0x563978);}});});}function sentiment(_0x5d04f0,_0x235c16,_0x5704ac,_0x23c008,_0x15a223){return new Promise(function(_0x45a08f,_0x286f03){var _0xe0c310=new AWS[(_0x9987('0x8'))]({'accessKeyId':_0x235c16,'secretAccessKey':_0x5d04f0,'region':_0x5704ac});_0xe0c310[_0x9987('0x9')]({'Text':_0x23c008,'LanguageCode':_0x15a223[_0x9987('0xa')](0x0,0x2)},function(_0x460db3,_0x44066d){if(_0x460db3){return _0x286f03(_0x460db3);}else{return _0x45a08f(_0x44066d);}});});}function checkTranscribeJob(_0x476d3f,_0x2c353c,_0x4c91e3){var _0x24a42b;return new BPromise(function(_0x40239d,_0xc55e99){logger[_0x9987('0xb')](util[_0x9987('0xc')](_0x9987('0xd'),_0x476d3f['id'],_0x476d3f[_0x9987('0xe')]));return getTranscriptionJob(_0x4c91e3[_0x9987('0xf')],_0x4c91e3[_0x9987('0x10')],_0x2c353c[_0x9987('0x11')],_0x476d3f[_0x9987('0xe')])[_0x9987('0x12')](function(_0x598a6f){logger['info'](util[_0x9987('0xc')](_0x9987('0x13'),_0x476d3f['id'],_0x476d3f[_0x9987('0xe')],_0x598a6f[_0x9987('0x14')][_0x9987('0x15')]));if(!_0x476d3f['fileText']){switch(_0x598a6f[_0x9987('0x14')][_0x9987('0x15')]){case _0x9987('0x16'):var _0x2d7b88={'transcribeStatus':_0x598a6f[_0x9987('0x14')][_0x9987('0x15')],'fileUri':_0x598a6f[_0x9987('0x14')]['Transcript'][_0x9987('0x17')]};logger[_0x9987('0xb')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x476d3f['id']));return rp({'uri':_0x598a6f[_0x9987('0x14')]['Transcript']['TranscriptFileUri'],'json':!![]})[_0x9987('0x12')](function(_0xd18e1f){logger[_0x9987('0xb')](util[_0x9987('0xc')](_0x9987('0x18'),_0x476d3f['id']));if(_0xd18e1f&&_0xd18e1f[_0x9987('0x19')]&&_0xd18e1f['results'][_0x9987('0x1a')]&&_0xd18e1f[_0x9987('0x19')][_0x9987('0x1a')][_0x9987('0x1b')]){_0x2d7b88['fileText']='';for(var _0x450fe4=0x0;_0x450fe4<_0xd18e1f[_0x9987('0x19')]['transcripts'][_0x9987('0x1b')];_0x450fe4++){_0x2d7b88[_0x9987('0x1c')]+=_0xd18e1f[_0x9987('0x19')]['transcripts'][_0x450fe4][_0x9987('0x1d')]+'';}}return _0x476d3f[_0x9987('0x1e')](_0x2d7b88);})[_0x9987('0x12')](function(){logger[_0x9987('0xb')](util[_0x9987('0xc')](_0x9987('0x1f'),_0x476d3f['id']));if(!_0x476d3f[_0x9987('0x20')]){throw new db[(_0x9987('0x21'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2c353c[_0x9987('0x22')]||!_0x2c353c[_0x9987('0x23')]||!_0x2c353c[_0x9987('0x24')]||!_0x2c353c['language']||!_0x2c353c['bucket']){throw new db[(_0x9987('0x21'))][(_0x9987('0x25'))](_0x9987('0x26'));}if(!_0x2d7b88[_0x9987('0x1c')]){throw new Error(_0x9987('0x27'));}if(_0x2c353c['sentimentAccountId']===_0x4c91e3['id']){return _0x4c91e3;}else{return db[_0x9987('0x28')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x37056e){if(!_0x37056e){throw new db[(_0x9987('0x21'))][(_0x9987('0x25'))](_0x9987('0x29'));}if(!_0x37056e[_0x9987('0xf')]||!_0x37056e[_0x9987('0x10')]){throw new db[(_0x9987('0x21'))][(_0x9987('0x25'))](_0x9987('0x2a'));}_0x24a42b=_0x37056e;logger[_0x9987('0xb')](util[_0x9987('0xc')](_0x9987('0x2b'),_0x476d3f['id']));return sentiment(_0x24a42b['data1'],_0x24a42b[_0x9987('0x10')],_0x2c353c[_0x9987('0x24')],_0x2d7b88[_0x9987('0x1c')],_0x2c353c[_0x9987('0x2c')]);})[_0x9987('0x12')](function(_0x296166){logger[_0x9987('0xb')](util['format'](_0x9987('0x2d'),_0x476d3f['id']));return _0x476d3f[_0x9987('0x1e')]({'sentiment':_0x296166[_0x9987('0x2e')],'sPositive':_0x296166[_0x9987('0x2f')][_0x9987('0x30')],'sNegative':_0x296166[_0x9987('0x2f')][_0x9987('0x31')],'sMixed':_0x296166['SentimentScore']['Mixed'],'sNeutral':_0x296166['SentimentScore'][_0x9987('0x32')]});})[_0x9987('0x12')](function(){logger[_0x9987('0xb')](util[_0x9987('0xc')](_0x9987('0x1f'),_0x476d3f['id']));_0x40239d();});case _0x9987('0x33'):return _0x476d3f[_0x9987('0x1e')]({'transcribeStatus':'FAILED','failureReason':_0x598a6f[_0x9987('0x14')][_0x9987('0x34')]})['then'](function(){logger[_0x9987('0xb')](util[_0x9987('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x476d3f['id']));_0x40239d();});default:logger[_0x9987('0xb')](util[_0x9987('0xc')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x476d3f['id']));break;}}else{return BPromise[_0x9987('0x35')]()[_0x9987('0x12')](function(){if(!_0x476d3f[_0x9987('0x20')]){throw new db[(_0x9987('0x21'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2c353c[_0x9987('0x22')]||!_0x2c353c[_0x9987('0x23')]||!_0x2c353c['sentimentRegion']||!_0x2c353c[_0x9987('0x2c')]||!_0x2c353c[_0x9987('0x36')]){throw new db[(_0x9987('0x21'))][(_0x9987('0x25'))](_0x9987('0x26'));}if(!_0x476d3f[_0x9987('0x1c')]){throw new Error(_0x9987('0x27'));}if(_0x2c353c[_0x9987('0x23')]===_0x4c91e3['id']){return _0x4c91e3;}else{return db['CloudProvider'][_0x9987('0x37')]({'where':{'id':_settings[_0x9987('0x23')]}});}})['then'](function(_0x4738e2){if(!_0x4738e2){throw new db['Sequelize'][(_0x9987('0x25'))](_0x9987('0x29'));}if(!_0x4738e2[_0x9987('0xf')]||!_0x4738e2[_0x9987('0x10')]){throw new db[(_0x9987('0x21'))][(_0x9987('0x25'))]('Cloud\x20Provider\x20not\x20configured');}_0x24a42b=_0x4738e2;logger[_0x9987('0xb')](util['format'](_0x9987('0x2b'),_0x476d3f['id']));return sentiment(_0x24a42b[_0x9987('0xf')],_0x24a42b[_0x9987('0x10')],_0x2c353c[_0x9987('0x24')],_0x476d3f['fileText'],_0x2c353c['language']);})[_0x9987('0x12')](function(_0x556ff4){logger['info'](util[_0x9987('0xc')](_0x9987('0x2d'),_0x476d3f['id']));return _0x476d3f[_0x9987('0x1e')]({'sentiment':_0x556ff4['Sentiment'],'sPositive':_0x556ff4[_0x9987('0x2f')]['Positive'],'sNegative':_0x556ff4[_0x9987('0x2f')][_0x9987('0x31')],'sMixed':_0x556ff4['SentimentScore'][_0x9987('0x38')],'sNeutral':_0x556ff4[_0x9987('0x2f')][_0x9987('0x32')],'transcribeStatus':_0x9987('0x16')});})[_0x9987('0x12')](function(){logger['info'](util[_0x9987('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x476d3f['id']));_0x40239d();});}})[_0x9987('0x39')](function(_0x4b4e86){if(_0x4b4e86){if(!_0x4b4e86[_0x9987('0x3a')]||_0x4b4e86['name']!==_0x9987('0x3b')){logger['error'](util[_0x9987('0xc')](_0x9987('0x3c'),_0x476d3f['id']),util[_0x9987('0x3d')](_0x4b4e86,{'showHidden':![],'depth':null}));}}_0x40239d();});});}function checkTranscribe(){var _0x5ac118;var _0xb3d65b;var _0x5adaea;return db[_0x9987('0x3e')][_0x9987('0x3f')]({'where':{'transcribeStatus':_0x9987('0x40')}})['then'](function(_0x6aecc){if(!_0x6aecc||!_0x6aecc[_0x9987('0x1b')]){throw new db[(_0x9987('0x21'))][(_0x9987('0x25'))](_0x9987('0x41'));}_0x5ac118=_0x6aecc;return db['Setting'][_0x9987('0x37')]({'where':{'id':0x1}});})[_0x9987('0x12')](function(_0x27da49){if(!_0x27da49){throw new db[(_0x9987('0x21'))][(_0x9987('0x25'))]('Settings\x20not\x20available');}_0xb3d65b=_0x27da49;if(!_0xb3d65b[_0x9987('0x6')]||!_0xb3d65b[_0x9987('0x42')]||!_0xb3d65b['transcribeRegion']||!_0xb3d65b[_0x9987('0x2c')]||!_0xb3d65b[_0x9987('0x36')]){throw new db[(_0x9987('0x21'))][(_0x9987('0x25'))](_0x9987('0x43'));}return db['CloudProvider'][_0x9987('0x37')]({'where':{'id':_0xb3d65b[_0x9987('0x42')]}});})[_0x9987('0x12')](function(_0x990b25){if(!_0x990b25){throw new db[(_0x9987('0x21'))][(_0x9987('0x25'))](_0x9987('0x29'));}if(!_0x990b25[_0x9987('0xf')]||!_0x990b25[_0x9987('0x10')]){throw new db[(_0x9987('0x21'))][(_0x9987('0x25'))](_0x9987('0x2a'));}_0x5adaea=_0x990b25;var _0x13c2b8=[];_0x5ac118[_0x9987('0x44')](function(_0x19787d){_0x13c2b8['push'](checkTranscribeJob(_0x19787d,_0xb3d65b,_0x5adaea));});return BPromise[_0x9987('0x45')](_0x13c2b8);})[_0x9987('0x39')](function(_0x5223e3){if(_0x5223e3){if(!_0x5223e3[_0x9987('0x3a')]||_0x5223e3['name']!==_0x9987('0x3b')){logger[_0x9987('0x46')](util[_0x9987('0x3d')](_0x5223e3,{'showHidden':![],'depth':null}));}}});}exports[_0x9987('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x530f=['[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','then','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','Mixed','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','start','aws-sdk','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format'];(function(_0x3ec857,_0x443909){var _0x2459ff=function(_0x173b77){while(--_0x173b77){_0x3ec857['push'](_0x3ec857['shift']());}};_0x2459ff(++_0x443909);}(_0x530f,0x167));var _0xf530=function(_0x4f9e31,_0x19881c){_0x4f9e31=_0x4f9e31-0x0;var _0x2f9fc7=_0x530f[_0x4f9e31];return _0x2f9fc7;};var _=require('lodash');var AWS=require(_0xf530('0x0'));var rp=require('request-promise');var util=require('util');var BPromise=require(_0xf530('0x1'));var db=require(_0xf530('0x2'))['db'];var logger=require(_0xf530('0x3'))(_0xf530('0x4'));function getTranscriptionJob(_0x464b2e,_0x2bacf8,_0x5cb04f,_0xa4e5b7){return new Promise(function(_0x58f5f8,_0x3a0301){var _0x2ce7f8=new AWS[(_0xf530('0x5'))]({'accessKeyId':_0x2bacf8,'secretAccessKey':_0x464b2e,'region':_0x5cb04f});_0x2ce7f8['getTranscriptionJob']({'TranscriptionJobName':_0xa4e5b7},function(_0x2bbe3c,_0xf205be){if(_0x2bbe3c){return _0x3a0301(_0x2bbe3c);}else{return _0x58f5f8(_0xf205be);}});});}function sentiment(_0x375d92,_0x38503f,_0x4132bf,_0x1b3603,_0x4b8336){return new Promise(function(_0xd747c3,_0x2fd24d){var _0x383493=new AWS[(_0xf530('0x6'))]({'accessKeyId':_0x38503f,'secretAccessKey':_0x375d92,'region':_0x4132bf});_0x383493[_0xf530('0x7')]({'Text':_0x1b3603,'LanguageCode':_0x4b8336[_0xf530('0x8')](0x0,0x2)},function(_0x4cd30d,_0x4c483a){if(_0x4cd30d){return _0x2fd24d(_0x4cd30d);}else{return _0xd747c3(_0x4c483a);}});});}function checkTranscribeJob(_0x35c314,_0x194b1f,_0x27f552){var _0x332ce2;return new BPromise(function(_0x8d76da,_0x4afc17){logger[_0xf530('0x9')](util[_0xf530('0xa')](_0xf530('0xb'),_0x35c314['id'],_0x35c314[_0xf530('0xc')]));return getTranscriptionJob(_0x27f552[_0xf530('0xd')],_0x27f552[_0xf530('0xe')],_0x194b1f[_0xf530('0xf')],_0x35c314[_0xf530('0xc')])['then'](function(_0x244fb8){logger[_0xf530('0x9')](util['format'](_0xf530('0x10'),_0x35c314['id'],_0x35c314[_0xf530('0xc')],_0x244fb8['TranscriptionJob'][_0xf530('0x11')]));if(!_0x35c314[_0xf530('0x12')]){switch(_0x244fb8[_0xf530('0x13')][_0xf530('0x11')]){case'COMPLETED':var _0x34742c={'transcribeStatus':_0x244fb8[_0xf530('0x13')][_0xf530('0x11')],'fileUri':_0x244fb8[_0xf530('0x13')][_0xf530('0x14')][_0xf530('0x15')]};logger['info'](util[_0xf530('0xa')](_0xf530('0x16'),_0x35c314['id']));return rp({'uri':_0x244fb8[_0xf530('0x13')][_0xf530('0x14')][_0xf530('0x15')],'json':!![]})['then'](function(_0x4dbbaf){logger['info'](util[_0xf530('0xa')](_0xf530('0x17'),_0x35c314['id']));if(_0x4dbbaf&&_0x4dbbaf[_0xf530('0x18')]&&_0x4dbbaf[_0xf530('0x18')][_0xf530('0x19')]&&_0x4dbbaf['results'][_0xf530('0x19')][_0xf530('0x1a')]){_0x34742c[_0xf530('0x12')]='';for(var _0x24a4dc=0x0;_0x24a4dc<_0x4dbbaf[_0xf530('0x18')][_0xf530('0x19')][_0xf530('0x1a')];_0x24a4dc++){_0x34742c[_0xf530('0x12')]+=_0x4dbbaf[_0xf530('0x18')][_0xf530('0x19')][_0x24a4dc][_0xf530('0x1b')]+'';}}return _0x35c314['update'](_0x34742c);})[_0xf530('0x1c')](function(){logger[_0xf530('0x9')](util[_0xf530('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x35c314['id']));if(!_0x35c314[_0xf530('0x1d')]){throw new db['Sequelize']['ValidationError'](_0xf530('0x1e'));}if(!_0x194b1f[_0xf530('0x1f')]||!_0x194b1f[_0xf530('0x20')]||!_0x194b1f['sentimentRegion']||!_0x194b1f[_0xf530('0x21')]||!_0x194b1f[_0xf530('0x22')]){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))](_0xf530('0x25'));}if(!_0x34742c[_0xf530('0x12')]){throw new Error(_0xf530('0x26'));}if(_0x194b1f[_0xf530('0x20')]===_0x27f552['id']){return _0x27f552;}else{return db[_0xf530('0x27')][_0xf530('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xf530('0x1c')](function(_0x4a1e5f){if(!_0x4a1e5f){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4a1e5f['data1']||!_0x4a1e5f['data2']){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))](_0xf530('0x29'));}_0x332ce2=_0x4a1e5f;logger[_0xf530('0x9')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x35c314['id']));return sentiment(_0x332ce2[_0xf530('0xd')],_0x332ce2[_0xf530('0xe')],_0x194b1f[_0xf530('0x2a')],_0x34742c[_0xf530('0x12')],_0x194b1f[_0xf530('0x21')]);})[_0xf530('0x1c')](function(_0x1d6dfe){logger['info'](util[_0xf530('0xa')](_0xf530('0x2b'),_0x35c314['id']));return _0x35c314[_0xf530('0x2c')]({'sentiment':_0x1d6dfe[_0xf530('0x2d')],'sPositive':_0x1d6dfe[_0xf530('0x2e')]['Positive'],'sNegative':_0x1d6dfe[_0xf530('0x2e')]['Negative'],'sMixed':_0x1d6dfe[_0xf530('0x2e')]['Mixed'],'sNeutral':_0x1d6dfe[_0xf530('0x2e')][_0xf530('0x2f')]});})[_0xf530('0x1c')](function(){logger[_0xf530('0x9')](util['format'](_0xf530('0x30'),_0x35c314['id']));_0x8d76da();});case'FAILED':return _0x35c314['update']({'transcribeStatus':_0xf530('0x31'),'failureReason':_0x244fb8[_0xf530('0x13')][_0xf530('0x32')]})[_0xf530('0x1c')](function(){logger[_0xf530('0x9')](util[_0xf530('0xa')](_0xf530('0x30'),_0x35c314['id']));_0x8d76da();});default:logger[_0xf530('0x9')](util[_0xf530('0xa')](_0xf530('0x33'),_0x35c314['id']));break;}}else{return BPromise[_0xf530('0x34')]()[_0xf530('0x1c')](function(){if(!_0x35c314['tempSentiment']){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))](_0xf530('0x1e'));}if(!_0x194b1f[_0xf530('0x1f')]||!_0x194b1f[_0xf530('0x20')]||!_0x194b1f[_0xf530('0x2a')]||!_0x194b1f[_0xf530('0x21')]||!_0x194b1f['bucket']){throw new db['Sequelize']['ValidationError'](_0xf530('0x25'));}if(!_0x35c314[_0xf530('0x12')]){throw new Error(_0xf530('0x26'));}if(_0x194b1f[_0xf530('0x20')]===_0x27f552['id']){return _0x27f552;}else{return db[_0xf530('0x27')]['findOne']({'where':{'id':_settings[_0xf530('0x20')]}});}})['then'](function(_0x38372c){if(!_0x38372c){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))](_0xf530('0x35'));}if(!_0x38372c[_0xf530('0xd')]||!_0x38372c['data2']){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))]('Cloud\x20Provider\x20not\x20configured');}_0x332ce2=_0x38372c;logger['info'](util[_0xf530('0xa')](_0xf530('0x36'),_0x35c314['id']));return sentiment(_0x332ce2['data1'],_0x332ce2[_0xf530('0xe')],_0x194b1f['sentimentRegion'],_0x35c314[_0xf530('0x12')],_0x194b1f[_0xf530('0x21')]);})[_0xf530('0x1c')](function(_0x5d6333){logger['info'](util[_0xf530('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x35c314['id']));return _0x35c314[_0xf530('0x2c')]({'sentiment':_0x5d6333['Sentiment'],'sPositive':_0x5d6333[_0xf530('0x2e')][_0xf530('0x37')],'sNegative':_0x5d6333['SentimentScore']['Negative'],'sMixed':_0x5d6333['SentimentScore'][_0xf530('0x38')],'sNeutral':_0x5d6333['SentimentScore'][_0xf530('0x2f')],'transcribeStatus':_0xf530('0x39')});})[_0xf530('0x1c')](function(){logger[_0xf530('0x9')](util[_0xf530('0xa')](_0xf530('0x30'),_0x35c314['id']));_0x8d76da();});}})[_0xf530('0x3a')](function(_0x245675){if(_0x245675){if(!_0x245675[_0xf530('0x3b')]||_0x245675[_0xf530('0x3b')]!==_0xf530('0x3c')){logger[_0xf530('0x3d')](util[_0xf530('0xa')](_0xf530('0x3e'),_0x35c314['id']),util[_0xf530('0x3f')](_0x245675,{'showHidden':![],'depth':null}));}}_0x8d76da();});});}function checkTranscribe(){var _0x17acce;var _0x3060a9;var _0x73b6d9;return db[_0xf530('0x40')][_0xf530('0x41')]({'where':{'transcribeStatus':_0xf530('0x42')}})[_0xf530('0x1c')](function(_0x2d3ed9){if(!_0x2d3ed9||!_0x2d3ed9[_0xf530('0x1a')]){throw new db['Sequelize'][(_0xf530('0x24'))](_0xf530('0x43'));}_0x17acce=_0x2d3ed9;return db[_0xf530('0x44')][_0xf530('0x28')]({'where':{'id':0x1}});})[_0xf530('0x1c')](function(_0x484dca){if(!_0x484dca){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))]('Settings\x20not\x20available');}_0x3060a9=_0x484dca;if(!_0x3060a9[_0xf530('0x4')]||!_0x3060a9[_0xf530('0x45')]||!_0x3060a9[_0xf530('0xf')]||!_0x3060a9[_0xf530('0x21')]||!_0x3060a9['bucket']){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))](_0xf530('0x46'));}return db[_0xf530('0x27')][_0xf530('0x28')]({'where':{'id':_0x3060a9[_0xf530('0x45')]}});})['then'](function(_0x304150){if(!_0x304150){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))](_0xf530('0x35'));}if(!_0x304150['data1']||!_0x304150[_0xf530('0xe')]){throw new db['Sequelize'][(_0xf530('0x24'))](_0xf530('0x29'));}_0x73b6d9=_0x304150;var _0x3d4664=[];_0x17acce[_0xf530('0x47')](function(_0x3c83eb){_0x3d4664['push'](checkTranscribeJob(_0x3c83eb,_0x3060a9,_0x73b6d9));});return BPromise[_0xf530('0x48')](_0x3d4664);})[_0xf530('0x3a')](function(_0x261c00){if(_0x261c00){if(!_0x261c00[_0xf530('0x3b')]||_0x261c00[_0xf530('0x3b')]!=='SequelizeValidationError'){logger['error'](util['inspect'](_0x261c00,{'showHidden':![],'depth':null}));}}});}exports[_0xf530('0x49')]=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 cceaa19..b420981 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 _0xdd74=['hours','then','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb','schedule','redis','defaults','localhost','WhatsappInteraction','lastMsgAt','subtract'];(function(_0x5bf420,_0x2d068d){var _0x1c5255=function(_0x4964a2){while(--_0x4964a2){_0x5bf420['push'](_0x5bf420['shift']());}};_0x1c5255(++_0x2d068d);}(_0xdd74,0x15c));var _0x4dd7=function(_0x551ed2,_0x197d2d){_0x551ed2=_0x551ed2-0x0;var _0x4bb9d1=_0xdd74[_0x551ed2];return _0x4bb9d1;};'use strict';var _=require(_0x4dd7('0x0'));var moment=require(_0x4dd7('0x1'));var Redis=require(_0x4dd7('0x2'));var util=require(_0x4dd7('0x3'));var config=require('../../config/environment');var db=require(_0x4dd7('0x4'))['db'];var logger=require('../logger')(_0x4dd7('0x5'));config[_0x4dd7('0x6')]=_[_0x4dd7('0x7')](config[_0x4dd7('0x6')],{'host':_0x4dd7('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4dd7('0x6')]));function closeInteractions(){var _0x419199=[];return db[_0x4dd7('0x9')]['findAll']({'raw':!![],'attributes':['id',_0x4dd7('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4dd7('0xb')](0x18,_0x4dd7('0xc'))}}})[_0x4dd7('0xd')](function(_0x4f3f34){if(_0x4f3f34&&_0x4f3f34['length']){_0x419199=_['map'](_0x4f3f34||[],'id');logger[_0x4dd7('0xe')](_0x4dd7('0xf'),_0x419199['join']());return db[_0x4dd7('0x9')][_0x4dd7('0x10')]({'closeReason':_0x4dd7('0x11'),'disposition':_0x4dd7('0x12'),'closed':!![],'closedAt':moment()[_0x4dd7('0x13')](_0x4dd7('0x14'))},{'where':{'id':_0x419199}});}})['then'](function(){if(_0x419199&&_0x419199[_0x4dd7('0x15')]){logger[_0x4dd7('0xe')](_0x4dd7('0x16'),_0x419199[_0x4dd7('0x17')]());for(var _0x26b1c4=0x0;_0x26b1c4<_0x419199[_0x4dd7('0x15')];_0x26b1c4++){io['emit'](_0x4dd7('0x18'),{'id':_0x419199[_0x26b1c4],'closed':!![]});}}})[_0x4dd7('0x19')](function(_0x1e1c65){logger[_0x4dd7('0x1a')](_0x4dd7('0x1b'),_0x1e1c65?util[_0x4dd7('0x1c')](_0x1e1c65,{'showHidden':![],'depth':null}):'');});}exports[_0x4dd7('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x1149=['join','update','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','lodash','moment','ioredis','util','../../config/environment','../logger','redis','defaults','localhost','socket.io-emitter','findAll','lastMsgAt','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1149,0x19f));var _0x9114=function(_0x2facd6,_0x2aaf16){_0x2facd6=_0x2facd6-0x0;var _0x4fbcb0=_0x1149[_0x2facd6];return _0x4fbcb0;};'use strict';var _=require(_0x9114('0x0'));var moment=require(_0x9114('0x1'));var Redis=require(_0x9114('0x2'));var util=require(_0x9114('0x3'));var config=require(_0x9114('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x9114('0x5'))('schedule');config[_0x9114('0x6')]=_[_0x9114('0x7')](config[_0x9114('0x6')],{'host':_0x9114('0x8'),'port':0x18eb});var io=require(_0x9114('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x23d9cd=[];return db['WhatsappInteraction'][_0x9114('0xa')]({'raw':!![],'attributes':['id',_0x9114('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x9114('0xc'))}}})[_0x9114('0xd')](function(_0x4deba1){if(_0x4deba1&&_0x4deba1[_0x9114('0xe')]){_0x23d9cd=_['map'](_0x4deba1||[],'id');logger[_0x9114('0xf')](_0x9114('0x10'),_0x23d9cd[_0x9114('0x11')]());return db['WhatsappInteraction'][_0x9114('0x12')]({'closeReason':'system','disposition':_0x9114('0x13'),'closed':!![],'closedAt':moment()[_0x9114('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x23d9cd}});}})['then'](function(){if(_0x23d9cd&&_0x23d9cd[_0x9114('0xe')]){logger[_0x9114('0xf')](_0x9114('0x15'),_0x23d9cd['join']());for(var _0x3f34d6=0x0;_0x3f34d6<_0x23d9cd[_0x9114('0xe')];_0x3f34d6++){io[_0x9114('0x16')](_0x9114('0x17'),{'id':_0x23d9cd[_0x3f34d6],'closed':!![]});}}})[_0x9114('0x18')](function(_0x5ff6fb){logger[_0x9114('0x19')](_0x9114('0x1a'),_0x5ff6fb?util['inspect'](_0x5ff6fb,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 363e669..4a540bf 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14a3=['destroy','CmContact','log','finished\x20populating','CmHopper','then','hopper1','contacts2','bulkCreate','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now'];(function(_0x225e24,_0x478574){var _0x526038=function(_0xfe2533){while(--_0xfe2533){_0x225e24['push'](_0x225e24['shift']());}};_0x526038(++_0x478574);}(_0x14a3,0x6f));var _0x314a=function(_0x4b7a20,_0x470a22){_0x4b7a20=_0x4b7a20-0x0;var _0x302aa4=_0x14a3[_0x4b7a20];return _0x302aa4;};'use strict';var util=require(_0x314a('0x0'));var db=require(_0x314a('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x314a('0x2')]({'id':i,'firstName':_0x314a('0x3')+i,'lastName':_0x314a('0x4')+i,'phone':0xf879fb460+i,'email':_0x314a('0x5')+i+_0x314a('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x314a('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x314a('0x7')](),'updatedAt':Date[_0x314a('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x314a('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x314a('0x4')+i,'phone':0xf879fb460+i,'email':_0x314a('0x5')+i+_0x314a('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x314a('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x314a('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x314a('0x7')](),'updatedAt':Date['now']()});}db['CmContact'][_0x314a('0x8')]({'where':{}})['then'](function(){return db[_0x314a('0x9')]['bulkCreate'](contacts);})['then'](function(){console[_0x314a('0xa')](_0x314a('0xb'),'contacts1');return db[_0x314a('0xc')][_0x314a('0x8')]({'where':{}});})[_0x314a('0xd')](function(){return db[_0x314a('0xc')]['bulkCreate'](hopper);})['then'](function(){console[_0x314a('0xa')](_0x314a('0xb'),_0x314a('0xe'));return db[_0x314a('0x9')]['bulkCreate'](contacts2);})[_0x314a('0xd')](function(){console[_0x314a('0xa')](_0x314a('0xb'),_0x314a('0xf'));return db[_0x314a('0xc')][_0x314a('0x10')](hopper2);})[_0x314a('0xd')](function(){console[_0x314a('0xa')](_0x314a('0xb'),'hopper2');})['catch'](function(_0x3d17a9){console[_0x314a('0xa')](_0x3d17a9);}); \ No newline at end of file +var _0x7895=['CmHopper','hopper1','contacts2','hopper2','catch','util','push','@xcally.com','now','Innocenzo','Biondo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1'];(function(_0xf0a541,_0x149051){var _0x48c42b=function(_0xf161ea){while(--_0xf161ea){_0xf0a541['push'](_0xf0a541['shift']());}};_0x48c42b(++_0x149051);}(_0x7895,0x113));var _0x5789=function(_0x1d903d,_0x44911b){_0x1d903d=_0x1d903d-0x0;var _0xe2f9d8=_0x7895[_0x1d903d];return _0xe2f9d8;};'use strict';var util=require(_0x5789('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x5789('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x5789('0x2')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x5789('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x5789('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5789('0x3')](),'updatedAt':Date[_0x5789('0x3')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x5789('0x4')+i,'lastName':_0x5789('0x5')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x5789('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5789('0x3')](),'updatedAt':Date['now']()});}db[_0x5789('0x6')][_0x5789('0x7')]({'where':{}})[_0x5789('0x8')](function(){return db['CmContact'][_0x5789('0x9')](contacts);})['then'](function(){console[_0x5789('0xa')](_0x5789('0xb'),_0x5789('0xc'));return db[_0x5789('0xd')][_0x5789('0x7')]({'where':{}});})['then'](function(){return db[_0x5789('0xd')][_0x5789('0x9')](hopper);})['then'](function(){console[_0x5789('0xa')](_0x5789('0xb'),_0x5789('0xe'));return db[_0x5789('0x6')][_0x5789('0x9')](contacts2);})[_0x5789('0x8')](function(){console[_0x5789('0xa')](_0x5789('0xb'),_0x5789('0xf'));return db[_0x5789('0xd')][_0x5789('0x9')](hopper2);})[_0x5789('0x8')](function(){console['log'](_0x5789('0xb'),_0x5789('0x10'));})[_0x5789('0x11')](function(_0x2285d3){console['log'](_0x2285d3);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 66742ab..e8c2781 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x35fe=['bulkCreate','then','log','add\x20user','catch','util','../mysqldb','format','%s%s','agent','wss','all','ulaw','yes','actpass','User'];(function(_0x3da8f8,_0x271bd3){var _0x277758=function(_0x573bdf){while(--_0x573bdf){_0x3da8f8['push'](_0x3da8f8['shift']());}};_0x277758(++_0x271bd3);}(_0x35fe,0x85));var _0xe35f=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x35fe[_0xbd08b4];return _0x314f1e;};'use strict';var util=require(_0xe35f('0x0'));var db=require(_0xe35f('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xe35f('0x2')](_0xe35f('0x3'),_0xe35f('0x4'),i),'fullname':util['format'](_0xe35f('0x3'),_0xe35f('0x4'),i),'email':util['format']('%s%s@xcally.com',_0xe35f('0x4'),i),'role':'agent','password':'password','internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0xe35f('0x5')],'disallow':[_0xe35f('0x6')],'allow':[_0xe35f('0x7')],'defaultuser':util[_0xe35f('0x2')](_0xe35f('0x3'),_0xe35f('0x4'),i),'encryption':'yes','avpf':_0xe35f('0x8'),'force_avp':_0xe35f('0x8'),'icesupport':_0xe35f('0x8'),'dtlsenable':_0xe35f('0x8'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xe35f('0x9'),'callerid':util[_0xe35f('0x2')]('\x22%s\x22\x20<%s>',util['format'](_0xe35f('0x3'),'agent',i),0xfa0+i)});}db[_0xe35f('0xa')][_0xe35f('0xb')](users)[_0xe35f('0xc')](function(){console[_0xe35f('0xd')](_0xe35f('0xe'));})[_0xe35f('0xf')](function(_0x588453){console[_0xe35f('0xd')](_0x588453);}); \ No newline at end of file +var _0xe323=['wss','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp'];(function(_0x338b3e,_0x11d80b){var _0xcb18a0=function(_0x155264){while(--_0x155264){_0x338b3e['push'](_0x338b3e['shift']());}};_0xcb18a0(++_0x11d80b);}(_0xe323,0x1f0));var _0x3e32=function(_0x4e2cf2,_0x1d0f3e){_0x4e2cf2=_0x4e2cf2-0x0;var _0xd70473=_0xe323[_0x4e2cf2];return _0xd70473;};'use strict';var util=require(_0x3e32('0x0'));var db=require(_0x3e32('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x3e32('0x2')]({'name':util[_0x3e32('0x3')](_0x3e32('0x4'),_0x3e32('0x5'),i),'fullname':util['format']('%s%s','agent',i),'email':util[_0x3e32('0x3')](_0x3e32('0x6'),'agent',i),'role':_0x3e32('0x5'),'password':_0x3e32('0x7'),'internal':0xfa0+i,'type':_0x3e32('0x8'),'transport':[_0x3e32('0x9'),'ws',_0x3e32('0xa')],'disallow':['all'],'allow':['ulaw'],'defaultuser':util[_0x3e32('0x3')](_0x3e32('0x4'),'agent',i),'encryption':'yes','avpf':'yes','force_avp':_0x3e32('0xb'),'icesupport':_0x3e32('0xb'),'dtlsenable':_0x3e32('0xb'),'dtlsverify':'no','dtlscertfile':_0x3e32('0xc'),'dtlsprivatekey':_0x3e32('0xd'),'dtlssetup':_0x3e32('0xe'),'callerid':util[_0x3e32('0x3')](_0x3e32('0xf'),util['format'](_0x3e32('0x4'),_0x3e32('0x5'),i),0xfa0+i)});}db[_0x3e32('0x10')][_0x3e32('0x11')](users)[_0x3e32('0x12')](function(){console[_0x3e32('0x13')](_0x3e32('0x14'));})[_0x3e32('0x15')](function(_0x171bb7){console['log'](_0x171bb7);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index f6b6892..06e5420 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d14=['connectedAt','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','./environment','name','Agents','role','agent','telephone','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','format','%s:queue:%s','length','user:%s','query','User','find','handshake','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','admin','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','voice:inbound','voice:outbound','userProfileId','MailQueues','WhatsappQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','voice','chat','fax','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','log','join','default','connection','setMaxListeners','address','request','remotePort'];(function(_0x477d3e,_0x25003b){var _0x4addc1=function(_0x169e9e){while(--_0x169e9e){_0x477d3e['push'](_0x477d3e['shift']());}};_0x4addc1(++_0x25003b);}(_0x7d14,0x6d));var _0x47d1=function(_0x47fa8c,_0x214d2a){_0x47fa8c=_0x47fa8c-0x0;var _0x574620=_0x7d14[_0x47fa8c];return _0x574620;};'use strict';var _=require(_0x47d1('0x0'));var util=require(_0x47d1('0x1'));var BPromise=require('bluebird');var db=require(_0x47d1('0x2'))['db'];var config=require(_0x47d1('0x3'));var queryQueues={'attributes':['id',_0x47d1('0x4')],'include':[{'as':_0x47d1('0x5'),'model':db['User'],'attributes':['id',_0x47d1('0x4'),_0x47d1('0x6')],'raw':!![],'where':{'role':_0x47d1('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x47d1('0x4')],'where':{'role':_0x47d1('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x47d1('0x4'),'type'],'where':{'type':_0x47d1('0x9')}};function getAssociatedResources(_0x1ff23a,_0x2a0bee,_0x175dd2){return db[_0x47d1('0xa')][_0x47d1('0xb')]({'where':{'name':_0x1ff23a,'userProfileId':_0x2a0bee},'raw':!![]})[_0x47d1('0xc')](function(_0x198c7c){if(_0x198c7c){if(_0x198c7c[_0x47d1('0xd')]){switch(_0x1ff23a){case _0x47d1('0xe'):case _0x47d1('0xf'):case _0x47d1('0x10'):case _0x47d1('0x11'):case'MailQueues':case _0x47d1('0x12'):case _0x47d1('0x13'):return db[_0x175dd2][_0x47d1('0x14')](queryQueues);case _0x47d1('0x15'):return db[_0x175dd2][_0x47d1('0x14')](queryTelephones);case _0x47d1('0x16'):return db[_0x175dd2][_0x47d1('0x14')](queryTrunks);case _0x47d1('0x17'):return db[_0x175dd2][_0x47d1('0x14')](queryCampaigns);}}else{return db[_0x47d1('0x18')][_0x47d1('0x14')]({'attributes':[_0x47d1('0x19')],'where':{'sectionId':_0x198c7c['id']},'raw':!![]})[_0x47d1('0xc')](function(_0x18754d){if(_0x18754d){var _0x29bbb9={'where':{'id':_[_0x47d1('0x1a')](_0x18754d,'resourceId')},'raw':!![]};switch(_0x175dd2){case'User':_0x29bbb9[_0x47d1('0x1b')][_0x47d1('0x6')]='telephone';break;case _0x47d1('0x1c'):_0x29bbb9['where']['type']=_0x47d1('0x9');break;}return db[_0x175dd2][_0x47d1('0x14')](_0x29bbb9);}else{return[];}});}}else{return[];}})[_0x47d1('0xc')](function(_0x20ce33){return _0x20ce33;});}function joinOrLeaveQueues(_0x54ca37,_0x297a32,_0x58452c,_0x32c511){_0x54ca37[_0x297a32](util[_0x47d1('0x1d')](_0x47d1('0x1e'),_0x58452c,_0x32c511['name']));if(_0x32c511[_0x47d1('0x5')]){for(var _0x4260a0=0x0;_0x4260a0<_0x32c511[_0x47d1('0x5')][_0x47d1('0x1f')];_0x4260a0+=0x1){_0x54ca37[_0x297a32](util['format'](_0x47d1('0x20'),_0x32c511[_0x47d1('0x5')][_0x4260a0][_0x47d1('0x4')]));}}}function joinOrLeave(_0x3970cf,_0x5de4d1,_0x29bca2){var _0x4400e5;if(_0x3970cf['handshake'][_0x47d1('0x21')]['id']){db[_0x47d1('0x22')][_0x47d1('0x23')]({'attributes':['id',_0x47d1('0x4'),_0x47d1('0x6'),'userProfileId'],'where':{'id':_0x3970cf[_0x47d1('0x24')]['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0x47d1('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x47d1('0x26')],'as':_0x47d1('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x47d1('0x28')],'as':_0x47d1('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x47d1('0x2a')],'as':_0x47d1('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x47d1('0x2c')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x47d1('0x2d')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x47d1('0xc')](function(_0x3d3573){if(_0x3d3573){_0x4400e5=_0x3d3573;_0x3970cf[_0x5de4d1](util[_0x47d1('0x1d')](_0x47d1('0x20'),_0x3d3573[_0x47d1('0x4')]));var _0x1009f7=[];switch(_0x3d3573[_0x47d1('0x6')]){case _0x47d1('0x2e'):_0x3970cf[_0x5de4d1]('voice:inbound');_0x3970cf[_0x5de4d1]('voice:outbound');if(queryQueues[_0x47d1('0x2f')](_0x47d1('0x30'))){delete queryQueues[_0x47d1('0x30')];}_0x1009f7['push'](db[_0x47d1('0x31')][_0x47d1('0x14')](queryQueues));_0x1009f7[_0x47d1('0x32')](db[_0x47d1('0x33')][_0x47d1('0x14')](queryQueues));_0x1009f7['push'](db[_0x47d1('0x34')][_0x47d1('0x14')](queryQueues));_0x1009f7[_0x47d1('0x32')](db[_0x47d1('0x35')][_0x47d1('0x14')](queryQueues));_0x1009f7[_0x47d1('0x32')](db[_0x47d1('0x36')][_0x47d1('0x14')](queryQueues));_0x1009f7[_0x47d1('0x32')](db[_0x47d1('0x37')]['findAll'](queryQueues));_0x1009f7['push'](db['WhatsappQueue'][_0x47d1('0x14')](queryQueues));_0x1009f7[_0x47d1('0x32')](db[_0x47d1('0x22')][_0x47d1('0x14')](queryTelephones));_0x1009f7['push'](db[_0x47d1('0x38')][_0x47d1('0x14')](queryTrunks));_0x1009f7['push'](db[_0x47d1('0x1c')]['findAll'](queryCampaigns));_0x1009f7[_0x47d1('0x32')](db[_0x47d1('0x22')]['findAll'](queryAgents));break;case _0x47d1('0x39'):_0x3970cf[_0x5de4d1](_0x47d1('0x3a'));_0x3970cf[_0x5de4d1](_0x47d1('0x3b'));_0x1009f7[_0x47d1('0x32')](getAssociatedResources(_0x47d1('0xe'),_0x3d3573['userProfileId'],_0x47d1('0x31')));_0x1009f7['push'](getAssociatedResources(_0x47d1('0xf'),_0x3d3573[_0x47d1('0x3c')],_0x47d1('0x33')));_0x1009f7[_0x47d1('0x32')](getAssociatedResources(_0x47d1('0x10'),_0x3d3573[_0x47d1('0x3c')],_0x47d1('0x34')));_0x1009f7[_0x47d1('0x32')](getAssociatedResources(_0x47d1('0x11'),_0x3d3573[_0x47d1('0x3c')],_0x47d1('0x35')));_0x1009f7[_0x47d1('0x32')](getAssociatedResources(_0x47d1('0x3d'),_0x3d3573[_0x47d1('0x3c')],_0x47d1('0x36')));_0x1009f7[_0x47d1('0x32')](getAssociatedResources(_0x47d1('0x12'),_0x3d3573[_0x47d1('0x3c')],_0x47d1('0x37')));_0x1009f7[_0x47d1('0x32')](getAssociatedResources(_0x47d1('0x13'),_0x3d3573[_0x47d1('0x3c')],_0x47d1('0x3e')));_0x1009f7[_0x47d1('0x32')](getAssociatedResources(_0x47d1('0x15'),_0x3d3573[_0x47d1('0x3c')],_0x47d1('0x22')));_0x1009f7[_0x47d1('0x32')](getAssociatedResources('Trunks',_0x3d3573['userProfileId'],_0x47d1('0x38')));_0x1009f7[_0x47d1('0x32')](getAssociatedResources(_0x47d1('0x17'),_0x3d3573['userProfileId'],_0x47d1('0x1c')));_0x1009f7[_0x47d1('0x32')](db[_0x47d1('0x22')][_0x47d1('0x14')](queryAgents));break;case'agent':_0x3970cf[_0x5de4d1](_0x47d1('0x3a'));_0x3970cf[_0x5de4d1]('voice:outbound');_0x1009f7['push'](_0x3d3573[_0x47d1('0x3f')]({'attributes':['id',_0x47d1('0x4')]}));_0x1009f7[_0x47d1('0x32')](_0x3d3573[_0x47d1('0x40')]({'attributes':['id','name']}));_0x1009f7[_0x47d1('0x32')](_0x3d3573[_0x47d1('0x41')]({'attributes':['id',_0x47d1('0x4')]}));_0x1009f7['push'](_0x3d3573[_0x47d1('0x42')]({'attributes':['id',_0x47d1('0x4')]}));_0x1009f7[_0x47d1('0x32')](_0x3d3573['getMailQueues']({'attributes':['id','name']}));_0x1009f7[_0x47d1('0x32')](_0x3d3573[_0x47d1('0x43')]({'attributes':['id',_0x47d1('0x4')]}));_0x1009f7[_0x47d1('0x32')](_0x3d3573['getWhatsappQueues']({'attributes':['id',_0x47d1('0x4')]}));break;}return BPromise['all'](_0x1009f7);}})['then'](function(_0x15d824){if(_0x15d824&&_0x15d824['length']){for(var _0x4917bd=0x0;_0x4917bd<_0x15d824['length'];_0x4917bd+=0x1){for(var _0x36500a=0x0;_0x36500a<_0x15d824[_0x4917bd][_0x47d1('0x1f')];_0x36500a+=0x1){switch(_0x4917bd){case 0x0:joinOrLeaveQueues(_0x3970cf,_0x5de4d1,_0x47d1('0x44'),_0x15d824[_0x4917bd][_0x36500a]);break;case 0x1:joinOrLeaveQueues(_0x3970cf,_0x5de4d1,_0x47d1('0x45'),_0x15d824[_0x4917bd][_0x36500a]);break;case 0x2:joinOrLeaveQueues(_0x3970cf,_0x5de4d1,_0x47d1('0x46'),_0x15d824[_0x4917bd][_0x36500a]);break;case 0x3:joinOrLeaveQueues(_0x3970cf,_0x5de4d1,_0x47d1('0x47'),_0x15d824[_0x4917bd][_0x36500a]);break;case 0x4:joinOrLeaveQueues(_0x3970cf,_0x5de4d1,'mail',_0x15d824[_0x4917bd][_0x36500a]);break;case 0x5:joinOrLeaveQueues(_0x3970cf,_0x5de4d1,_0x47d1('0x48'),_0x15d824[_0x4917bd][_0x36500a]);break;case 0x6:joinOrLeaveQueues(_0x3970cf,_0x5de4d1,_0x47d1('0x49'),_0x15d824[_0x4917bd][_0x36500a]);break;case 0x7:if(_0x4400e5[_0x47d1('0x6')]!=='agent')_0x3970cf[_0x5de4d1](util[_0x47d1('0x1d')](_0x47d1('0x4a'),_0x15d824[_0x4917bd][_0x36500a]['name']));break;case 0x8:if(_0x4400e5[_0x47d1('0x6')]!==_0x47d1('0x7'))_0x3970cf[_0x5de4d1](util['format'](_0x47d1('0x4b'),_0x15d824[_0x4917bd][_0x36500a]['name']));break;case 0x9:if(_0x4400e5[_0x47d1('0x6')]!==_0x47d1('0x7'))_0x3970cf[_0x5de4d1](util[_0x47d1('0x1d')](_0x47d1('0x4c'),_0x15d824[_0x4917bd][_0x36500a]['type'],_0x15d824[_0x4917bd][_0x36500a][_0x47d1('0x4')]));break;case 0xa:_0x3970cf[_0x5de4d1](util[_0x47d1('0x1d')](_0x47d1('0x20'),_0x15d824[_0x4917bd][_0x36500a][_0x47d1('0x4')]));break;}}}}})[_0x47d1('0xc')](function(){if(_0x5de4d1===_0x47d1('0x4d')){var _0x2d5647=_[_0x47d1('0x1a')](_0x4400e5[_0x47d1('0x25')],'id');return _0x4400e5[_0x47d1('0x4e')](_0x2d5647)['then'](function(){for(var _0x34f4c7=0x0;_0x34f4c7<_0x2d5647[_0x47d1('0x1f')];_0x34f4c7+=0x1){_0x29bca2['emit'](_0x47d1('0x4f'),{'ChatInteractionId':Number(_0x2d5647[_0x34f4c7]),'UserId':Number(_0x4400e5['id'])});}});}})[_0x47d1('0xc')](function(){if(_0x5de4d1===_0x47d1('0x4d')){var _0x237901=_[_0x47d1('0x1a')](_0x4400e5['MailInteractions'],'id');return _0x4400e5[_0x47d1('0x50')](_0x237901)[_0x47d1('0xc')](function(){for(var _0x2d4ad8=0x0;_0x2d4ad8<_0x237901['length'];_0x2d4ad8+=0x1){_0x29bca2[_0x47d1('0x51')](_0x47d1('0x52'),{'MailInteractionId':Number(_0x237901[_0x2d4ad8]),'UserId':Number(_0x4400e5['id'])});}});}})[_0x47d1('0xc')](function(){if(_0x5de4d1==='leave'){var _0x240490=_[_0x47d1('0x1a')](_0x4400e5[_0x47d1('0x29')],'id');return _0x4400e5[_0x47d1('0x53')](_0x240490)[_0x47d1('0xc')](function(){for(var _0x5adfa2=0x0;_0x5adfa2<_0x240490['length'];_0x5adfa2+=0x1){_0x29bca2[_0x47d1('0x51')](_0x47d1('0x54'),{'FaxInteractionId':Number(_0x240490[_0x5adfa2]),'UserId':Number(_0x4400e5['id'])});}});}})[_0x47d1('0xc')](function(){if(_0x5de4d1===_0x47d1('0x4d')){var _0x5152b5=_['map'](_0x4400e5[_0x47d1('0x2b')],'id');return _0x4400e5[_0x47d1('0x55')](_0x5152b5)[_0x47d1('0xc')](function(){for(var _0x3968a8=0x0;_0x3968a8<_0x5152b5[_0x47d1('0x1f')];_0x3968a8+=0x1){_0x29bca2[_0x47d1('0x51')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x5152b5[_0x3968a8]),'UserId':Number(_0x4400e5['id'])});}});}})['then'](function(){if(_0x5de4d1===_0x47d1('0x4d')){var _0x588a76=_[_0x47d1('0x1a')](_0x4400e5[_0x47d1('0x56')],'id');return _0x4400e5[_0x47d1('0x57')](_0x588a76)[_0x47d1('0xc')](function(){for(var _0x3b50c1=0x0;_0x3b50c1<_0x588a76[_0x47d1('0x1f')];_0x3b50c1+=0x1){_0x29bca2[_0x47d1('0x51')](_0x47d1('0x58'),{'OpenchannelInteractionId':Number(_0x588a76[_0x3b50c1]),'UserId':Number(_0x4400e5['id'])});}});}})['then'](function(){if(_0x5de4d1===_0x47d1('0x4d')){var _0x434a91=_[_0x47d1('0x1a')](_0x4400e5[_0x47d1('0x59')],'id');return _0x4400e5[_0x47d1('0x5a')](_0x434a91)[_0x47d1('0xc')](function(){for(var _0x23bca3=0x0;_0x23bca3<_0x434a91[_0x47d1('0x1f')];_0x23bca3+=0x1){_0x29bca2[_0x47d1('0x51')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x434a91[_0x23bca3]),'UserId':Number(_0x4400e5['id'])});}});}})['catch'](function(_0x30c62b){_0x3970cf[_0x47d1('0x5b')](_0x30c62b);});}}function onDisconnect(_0x91af6f,_0x40ff80){joinOrLeave(_0x91af6f,_0x47d1('0x4d'),_0x40ff80);}function onConnect(_0x14eb13){joinOrLeave(_0x14eb13,_0x47d1('0x5c'));}exports[_0x47d1('0x5d')]=function(_0x127edc){_0x127edc['on'](_0x47d1('0x5e'),function(_0x2a61b9){_0x2a61b9[_0x47d1('0x5f')](0x0);_0x2a61b9[_0x47d1('0x60')]=_0x2a61b9[_0x47d1('0x61')][_0x47d1('0x5e')]['remoteAddress']+':'+_0x2a61b9[_0x47d1('0x61')][_0x47d1('0x5e')][_0x47d1('0x62')];_0x2a61b9[_0x47d1('0x63')]=new Date();_0x2a61b9['log']=function(_0x41c7cf){console[_0x47d1('0x5b')](_0x47d1('0x64')+_0x2a61b9['nsp'][_0x47d1('0x4')]+'['+_0x2a61b9[_0x47d1('0x60')]+']',_0x41c7cf);};_0x2a61b9['on'](_0x47d1('0x65'),function(){onDisconnect(_0x2a61b9,_0x127edc);_0x2a61b9[_0x47d1('0x5b')](_0x47d1('0x66'));});onConnect(_0x2a61b9);_0x2a61b9[_0x47d1('0x5b')](_0x47d1('0x67'));});}; \ No newline at end of file +var _0x91ed=['OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','userProfileId','VoiceQueue','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','address','connection','remoteAddress','request','remotePort','log','nsp','disconnect','DISCONNECTED','bluebird','../mysqldb','name','Agents','User','role','telephone','agent','type','ivr','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','find','ChatInteraction','MailInteraction','MailInteractions','FaxInteractions','SmsInteractions','OpenchannelInteraction'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x91ed,0x99));var _0xd91e=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x91ed[_0x819464];return _0x49dcc0;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0xd91e('0x0'));var db=require(_0xd91e('0x1'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xd91e('0x2')],'include':[{'as':_0xd91e('0x3'),'model':db[_0xd91e('0x4')],'attributes':['id','name',_0xd91e('0x5')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xd91e('0x2')],'where':{'role':_0xd91e('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0xd91e('0x2')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xd91e('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xd91e('0x2'),_0xd91e('0x8')],'where':{'type':_0xd91e('0x9')}};function getAssociatedResources(_0x33d9d1,_0x141ea4,_0x4d5dd1){return db[_0xd91e('0xa')][_0xd91e('0xb')]({'where':{'name':_0x33d9d1,'userProfileId':_0x141ea4},'raw':!![]})[_0xd91e('0xc')](function(_0xfd52a){if(_0xfd52a){if(_0xfd52a['autoAssociation']){switch(_0x33d9d1){case _0xd91e('0xd'):case _0xd91e('0xe'):case _0xd91e('0xf'):case _0xd91e('0x10'):case _0xd91e('0x11'):case _0xd91e('0x12'):case _0xd91e('0x13'):return db[_0x4d5dd1]['findAll'](queryQueues);case _0xd91e('0x14'):return db[_0x4d5dd1]['findAll'](queryTelephones);case'Trunks':return db[_0x4d5dd1][_0xd91e('0x15')](queryTrunks);case _0xd91e('0x16'):return db[_0x4d5dd1][_0xd91e('0x15')](queryCampaigns);}}else{return db[_0xd91e('0x17')][_0xd91e('0x15')]({'attributes':[_0xd91e('0x18')],'where':{'sectionId':_0xfd52a['id']},'raw':!![]})[_0xd91e('0xc')](function(_0x47a508){if(_0x47a508){var _0x387cf2={'where':{'id':_[_0xd91e('0x19')](_0x47a508,_0xd91e('0x18'))},'raw':!![]};switch(_0x4d5dd1){case _0xd91e('0x4'):_0x387cf2[_0xd91e('0x1a')][_0xd91e('0x5')]=_0xd91e('0x6');break;case _0xd91e('0x1b'):_0x387cf2[_0xd91e('0x1a')][_0xd91e('0x8')]='ivr';break;}return db[_0x4d5dd1][_0xd91e('0x15')](_0x387cf2);}else{return[];}});}}else{return[];}})[_0xd91e('0xc')](function(_0xa9ca33){return _0xa9ca33;});}function joinOrLeaveQueues(_0x349817,_0x3fdff7,_0x1f0ef5,_0x2d1070){_0x349817[_0x3fdff7](util[_0xd91e('0x1c')](_0xd91e('0x1d'),_0x1f0ef5,_0x2d1070[_0xd91e('0x2')]));if(_0x2d1070[_0xd91e('0x3')]){for(var _0x125ee0=0x0;_0x125ee0<_0x2d1070['Agents'][_0xd91e('0x1e')];_0x125ee0+=0x1){_0x349817[_0x3fdff7](util['format'](_0xd91e('0x1f'),_0x2d1070['Agents'][_0x125ee0][_0xd91e('0x2')]));}}}function joinOrLeave(_0x21339c,_0x38b026,_0x59da27){var _0x55074c;if(_0x21339c[_0xd91e('0x20')][_0xd91e('0x21')]['id']){db[_0xd91e('0x4')][_0xd91e('0x22')]({'attributes':['id',_0xd91e('0x2'),_0xd91e('0x5'),'userProfileId'],'where':{'id':_0x21339c[_0xd91e('0x20')][_0xd91e('0x21')]['id']},'include':[{'model':db[_0xd91e('0x23')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xd91e('0x24')],'as':_0xd91e('0x25'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xd91e('0x26'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xd91e('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xd91e('0x28')],'as':_0xd91e('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xd91e('0x2a')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xd91e('0xc')](function(_0x11d248){if(_0x11d248){_0x55074c=_0x11d248;_0x21339c[_0x38b026](util[_0xd91e('0x1c')](_0xd91e('0x1f'),_0x11d248['name']));var _0xd4957c=[];switch(_0x11d248[_0xd91e('0x5')]){case _0xd91e('0x2b'):_0x21339c[_0x38b026](_0xd91e('0x2c'));_0x21339c[_0x38b026](_0xd91e('0x2d'));if(queryQueues[_0xd91e('0x2e')](_0xd91e('0x2f'))){delete queryQueues[_0xd91e('0x2f')];}_0xd4957c[_0xd91e('0x30')](db['VoiceQueue']['findAll'](queryQueues));_0xd4957c[_0xd91e('0x30')](db[_0xd91e('0x31')]['findAll'](queryQueues));_0xd4957c[_0xd91e('0x30')](db[_0xd91e('0x32')][_0xd91e('0x15')](queryQueues));_0xd4957c[_0xd91e('0x30')](db[_0xd91e('0x33')][_0xd91e('0x15')](queryQueues));_0xd4957c[_0xd91e('0x30')](db['MailQueue'][_0xd91e('0x15')](queryQueues));_0xd4957c[_0xd91e('0x30')](db[_0xd91e('0x34')][_0xd91e('0x15')](queryQueues));_0xd4957c[_0xd91e('0x30')](db[_0xd91e('0x35')][_0xd91e('0x15')](queryQueues));_0xd4957c[_0xd91e('0x30')](db[_0xd91e('0x4')]['findAll'](queryTelephones));_0xd4957c[_0xd91e('0x30')](db[_0xd91e('0x36')][_0xd91e('0x15')](queryTrunks));_0xd4957c[_0xd91e('0x30')](db[_0xd91e('0x1b')][_0xd91e('0x15')](queryCampaigns));_0xd4957c[_0xd91e('0x30')](db[_0xd91e('0x4')][_0xd91e('0x15')](queryAgents));break;case _0xd91e('0x37'):_0x21339c[_0x38b026]('voice:inbound');_0x21339c[_0x38b026](_0xd91e('0x2d'));_0xd4957c[_0xd91e('0x30')](getAssociatedResources(_0xd91e('0xd'),_0x11d248[_0xd91e('0x38')],_0xd91e('0x39')));_0xd4957c[_0xd91e('0x30')](getAssociatedResources(_0xd91e('0xe'),_0x11d248[_0xd91e('0x38')],_0xd91e('0x31')));_0xd4957c['push'](getAssociatedResources(_0xd91e('0xf'),_0x11d248['userProfileId'],_0xd91e('0x32')));_0xd4957c[_0xd91e('0x30')](getAssociatedResources(_0xd91e('0x10'),_0x11d248[_0xd91e('0x38')],'SmsQueue'));_0xd4957c[_0xd91e('0x30')](getAssociatedResources('MailQueues',_0x11d248[_0xd91e('0x38')],'MailQueue'));_0xd4957c['push'](getAssociatedResources('OpenchannelQueues',_0x11d248[_0xd91e('0x38')],'OpenchannelQueue'));_0xd4957c[_0xd91e('0x30')](getAssociatedResources(_0xd91e('0x13'),_0x11d248['userProfileId'],'WhatsappQueue'));_0xd4957c['push'](getAssociatedResources(_0xd91e('0x14'),_0x11d248['userProfileId'],_0xd91e('0x4')));_0xd4957c[_0xd91e('0x30')](getAssociatedResources(_0xd91e('0x3a'),_0x11d248['userProfileId'],_0xd91e('0x36')));_0xd4957c[_0xd91e('0x30')](getAssociatedResources(_0xd91e('0x16'),_0x11d248['userProfileId'],_0xd91e('0x1b')));_0xd4957c['push'](db[_0xd91e('0x4')][_0xd91e('0x15')](queryAgents));break;case _0xd91e('0x7'):_0x21339c[_0x38b026](_0xd91e('0x2c'));_0x21339c[_0x38b026]('voice:outbound');_0xd4957c[_0xd91e('0x30')](_0x11d248[_0xd91e('0x3b')]({'attributes':['id',_0xd91e('0x2')]}));_0xd4957c[_0xd91e('0x30')](_0x11d248[_0xd91e('0x3c')]({'attributes':['id',_0xd91e('0x2')]}));_0xd4957c['push'](_0x11d248[_0xd91e('0x3d')]({'attributes':['id',_0xd91e('0x2')]}));_0xd4957c[_0xd91e('0x30')](_0x11d248['getSmsQueues']({'attributes':['id',_0xd91e('0x2')]}));_0xd4957c['push'](_0x11d248[_0xd91e('0x3e')]({'attributes':['id','name']}));_0xd4957c[_0xd91e('0x30')](_0x11d248[_0xd91e('0x3f')]({'attributes':['id',_0xd91e('0x2')]}));_0xd4957c[_0xd91e('0x30')](_0x11d248[_0xd91e('0x40')]({'attributes':['id','name']}));break;}return BPromise[_0xd91e('0x41')](_0xd4957c);}})['then'](function(_0x17b5db){if(_0x17b5db&&_0x17b5db[_0xd91e('0x1e')]){for(var _0x43e2e5=0x0;_0x43e2e5<_0x17b5db['length'];_0x43e2e5+=0x1){for(var _0x27c1ef=0x0;_0x27c1ef<_0x17b5db[_0x43e2e5][_0xd91e('0x1e')];_0x27c1ef+=0x1){switch(_0x43e2e5){case 0x0:joinOrLeaveQueues(_0x21339c,_0x38b026,_0xd91e('0x42'),_0x17b5db[_0x43e2e5][_0x27c1ef]);break;case 0x1:joinOrLeaveQueues(_0x21339c,_0x38b026,_0xd91e('0x43'),_0x17b5db[_0x43e2e5][_0x27c1ef]);break;case 0x2:joinOrLeaveQueues(_0x21339c,_0x38b026,_0xd91e('0x44'),_0x17b5db[_0x43e2e5][_0x27c1ef]);break;case 0x3:joinOrLeaveQueues(_0x21339c,_0x38b026,_0xd91e('0x45'),_0x17b5db[_0x43e2e5][_0x27c1ef]);break;case 0x4:joinOrLeaveQueues(_0x21339c,_0x38b026,_0xd91e('0x46'),_0x17b5db[_0x43e2e5][_0x27c1ef]);break;case 0x5:joinOrLeaveQueues(_0x21339c,_0x38b026,'openchannel',_0x17b5db[_0x43e2e5][_0x27c1ef]);break;case 0x6:joinOrLeaveQueues(_0x21339c,_0x38b026,_0xd91e('0x47'),_0x17b5db[_0x43e2e5][_0x27c1ef]);break;case 0x7:if(_0x55074c[_0xd91e('0x5')]!==_0xd91e('0x7'))_0x21339c[_0x38b026](util['format'](_0xd91e('0x48'),_0x17b5db[_0x43e2e5][_0x27c1ef][_0xd91e('0x2')]));break;case 0x8:if(_0x55074c[_0xd91e('0x5')]!==_0xd91e('0x7'))_0x21339c[_0x38b026](util[_0xd91e('0x1c')](_0xd91e('0x49'),_0x17b5db[_0x43e2e5][_0x27c1ef][_0xd91e('0x2')]));break;case 0x9:if(_0x55074c['role']!==_0xd91e('0x7'))_0x21339c[_0x38b026](util[_0xd91e('0x1c')](_0xd91e('0x4a'),_0x17b5db[_0x43e2e5][_0x27c1ef][_0xd91e('0x8')],_0x17b5db[_0x43e2e5][_0x27c1ef][_0xd91e('0x2')]));break;case 0xa:_0x21339c[_0x38b026](util[_0xd91e('0x1c')](_0xd91e('0x1f'),_0x17b5db[_0x43e2e5][_0x27c1ef][_0xd91e('0x2')]));break;}}}}})['then'](function(){if(_0x38b026===_0xd91e('0x4b')){var _0x2f6cc8=_[_0xd91e('0x19')](_0x55074c[_0xd91e('0x4c')],'id');return _0x55074c['removeChatInteractions'](_0x2f6cc8)['then'](function(){for(var _0x59468e=0x0;_0x59468e<_0x2f6cc8[_0xd91e('0x1e')];_0x59468e+=0x1){_0x59da27['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x2f6cc8[_0x59468e]),'UserId':Number(_0x55074c['id'])});}});}})[_0xd91e('0xc')](function(){if(_0x38b026===_0xd91e('0x4b')){var _0x5bb1f8=_[_0xd91e('0x19')](_0x55074c[_0xd91e('0x25')],'id');return _0x55074c[_0xd91e('0x4d')](_0x5bb1f8)[_0xd91e('0xc')](function(){for(var _0x578978=0x0;_0x578978<_0x5bb1f8[_0xd91e('0x1e')];_0x578978+=0x1){_0x59da27[_0xd91e('0x4e')](_0xd91e('0x4f'),{'MailInteractionId':Number(_0x5bb1f8[_0x578978]),'UserId':Number(_0x55074c['id'])});}});}})[_0xd91e('0xc')](function(){if(_0x38b026===_0xd91e('0x4b')){var _0x3b1331=_['map'](_0x55074c[_0xd91e('0x26')],'id');return _0x55074c[_0xd91e('0x50')](_0x3b1331)[_0xd91e('0xc')](function(){for(var _0x279a3b=0x0;_0x279a3b<_0x3b1331[_0xd91e('0x1e')];_0x279a3b+=0x1){_0x59da27[_0xd91e('0x4e')](_0xd91e('0x51'),{'FaxInteractionId':Number(_0x3b1331[_0x279a3b]),'UserId':Number(_0x55074c['id'])});}});}})[_0xd91e('0xc')](function(){if(_0x38b026==='leave'){var _0x5183fb=_[_0xd91e('0x19')](_0x55074c['SmsInteractions'],'id');return _0x55074c[_0xd91e('0x52')](_0x5183fb)[_0xd91e('0xc')](function(){for(var _0x4aa68d=0x0;_0x4aa68d<_0x5183fb[_0xd91e('0x1e')];_0x4aa68d+=0x1){_0x59da27['emit'](_0xd91e('0x53'),{'SmsInteractionId':Number(_0x5183fb[_0x4aa68d]),'UserId':Number(_0x55074c['id'])});}});}})['then'](function(){if(_0x38b026===_0xd91e('0x4b')){var _0x3f93f1=_['map'](_0x55074c[_0xd91e('0x29')],'id');return _0x55074c[_0xd91e('0x54')](_0x3f93f1)['then'](function(){for(var _0x3d2ac2=0x0;_0x3d2ac2<_0x3f93f1[_0xd91e('0x1e')];_0x3d2ac2+=0x1){_0x59da27[_0xd91e('0x4e')](_0xd91e('0x55'),{'OpenchannelInteractionId':Number(_0x3f93f1[_0x3d2ac2]),'UserId':Number(_0x55074c['id'])});}});}})['then'](function(){if(_0x38b026==='leave'){var _0x55300f=_[_0xd91e('0x19')](_0x55074c['WhatsappInteractions'],'id');return _0x55074c['removeWhatsappInteractions'](_0x55300f)['then'](function(){for(var _0x37527a=0x0;_0x37527a<_0x55300f[_0xd91e('0x1e')];_0x37527a+=0x1){_0x59da27[_0xd91e('0x4e')](_0xd91e('0x56'),{'WhatsappInteractionId':Number(_0x55300f[_0x37527a]),'UserId':Number(_0x55074c['id'])});}});}})[_0xd91e('0x57')](function(_0x185ab1){_0x21339c['log'](_0x185ab1);});}}function onDisconnect(_0x2b0c8f,_0x518f14){joinOrLeave(_0x2b0c8f,_0xd91e('0x4b'),_0x518f14);}function onConnect(_0x253ea2){joinOrLeave(_0x253ea2,'join');}exports['default']=function(_0x1b8074){_0x1b8074['on']('connection',function(_0x1d3dae){_0x1d3dae['setMaxListeners'](0x0);_0x1d3dae[_0xd91e('0x58')]=_0x1d3dae['request'][_0xd91e('0x59')][_0xd91e('0x5a')]+':'+_0x1d3dae[_0xd91e('0x5b')][_0xd91e('0x59')][_0xd91e('0x5c')];_0x1d3dae['connectedAt']=new Date();_0x1d3dae[_0xd91e('0x5d')]=function(_0x505cfe){console[_0xd91e('0x5d')]('SocketIO\x20'+_0x1d3dae[_0xd91e('0x5e')]['name']+'['+_0x1d3dae[_0xd91e('0x58')]+']',_0x505cfe);};_0x1d3dae['on'](_0xd91e('0x5f'),function(){onDisconnect(_0x1d3dae,_0x1b8074);_0x1d3dae['log'](_0xd91e('0x60'));});onConnect(_0x1d3dae);_0x1d3dae[_0xd91e('0x5d')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 8317cb8..5fa2917 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 _0x7d6b=['closedinteraction','ChatMessage','newmessage','SmsInteraction','Sms','SmsMessage','Whatsapp','WhatsappInteraction','newinteraction','WhatsappMessage','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','error','code','Trigger,\x20%s','channel','motionChannel','event','direction','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','QueryTypes','UserId','interface','format','SIP/%s','agent','incomingmessage','outgoingmessage','catch','AfterCreateMessage','get','offlineMessage','opened','resolve','Sequelize','contact','name','AfterCreate','changed','closed','substatus','SELECT','User','fullname','email','default','hasOwnProperty','model','hook','condition','util','triggers','client','Chat','ChatInteraction','afterCreate','afterUpdate'];(function(_0xbb1850,_0x1ec97c){var _0x9f19f=function(_0x1779e0){while(--_0x1779e0){_0xbb1850['push'](_0xbb1850['shift']());}};_0x9f19f(++_0x1ec97c);}(_0x7d6b,0x89));var _0xb7d6=function(_0x4c6156,_0x1a7486){_0x4c6156=_0x4c6156-0x0;var _0x449719=_0x7d6b[_0x4c6156];return _0x449719;};'use strict';var util=require(_0xb7d6('0x0'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var logger=require('../logger')(_0xb7d6('0x1'));var client=jayson[_0xb7d6('0x2')]['http']({'port':0x232a});var triggers=[{'channel':_0xb7d6('0x3'),'model':_0xb7d6('0x4'),'event':_0xb7d6('0x5'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xb7d6('0x3'),'model':_0xb7d6('0x4'),'event':_0xb7d6('0x6'),'condition':_0xb7d6('0x7'),'callback':afterUpdate},{'channel':_0xb7d6('0x3'),'model':_0xb7d6('0x8'),'event':_0xb7d6('0x5'),'condition':_0xb7d6('0x9'),'callback':afterCreateMessage},{'channel':_0xb7d6('0x3'),'model':'ChatOfflineMessage','event':_0xb7d6('0x5'),'condition':_0xb7d6('0x9'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0xb7d6('0xa'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Sms','model':_0xb7d6('0xa'),'event':_0xb7d6('0x6'),'condition':_0xb7d6('0x7'),'callback':afterUpdate},{'channel':_0xb7d6('0xb'),'model':_0xb7d6('0xc'),'event':_0xb7d6('0x5'),'condition':_0xb7d6('0x9'),'callback':afterCreateMessage},{'channel':_0xb7d6('0xd'),'model':_0xb7d6('0xe'),'event':_0xb7d6('0x5'),'condition':_0xb7d6('0xf'),'callback':afterCreate},{'channel':'Whatsapp','model':_0xb7d6('0xe'),'event':_0xb7d6('0x6'),'condition':_0xb7d6('0x7'),'callback':afterUpdate},{'channel':_0xb7d6('0xd'),'model':_0xb7d6('0x10'),'event':'afterCreate','condition':_0xb7d6('0x9'),'callback':afterCreateMessage},{'channel':'Fax','model':_0xb7d6('0x11'),'event':_0xb7d6('0x5'),'condition':_0xb7d6('0xf'),'callback':afterCreate},{'channel':_0xb7d6('0x12'),'model':_0xb7d6('0x11'),'event':'afterUpdate','condition':_0xb7d6('0x7'),'callback':afterUpdate},{'channel':'Fax','model':_0xb7d6('0x13'),'event':_0xb7d6('0x5'),'condition':_0xb7d6('0x9'),'callback':afterCreateMessage},{'channel':_0xb7d6('0x14'),'model':_0xb7d6('0x15'),'event':_0xb7d6('0x5'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xb7d6('0x14'),'model':_0xb7d6('0x15'),'event':_0xb7d6('0x6'),'condition':_0xb7d6('0x7'),'callback':afterUpdate},{'channel':_0xb7d6('0x14'),'model':_0xb7d6('0x16'),'event':_0xb7d6('0x5'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xb7d6('0x17'),'model':_0xb7d6('0x18'),'event':_0xb7d6('0x5'),'condition':_0xb7d6('0xf'),'callback':afterCreate},{'channel':_0xb7d6('0x17'),'model':'OpenchannelInteraction','event':_0xb7d6('0x6'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xb7d6('0x17'),'model':_0xb7d6('0x19'),'event':_0xb7d6('0x5'),'condition':_0xb7d6('0x9'),'callback':afterCreateMessage}];function request(_0x117e7d){return client[_0xb7d6('0x1a')](_0xb7d6('0x1b'),_0x117e7d)[_0xb7d6('0x1c')](function(_0x410d9c){logger[_0xb7d6('0x1d')]('Trigger,\x20%s',_0xb7d6('0x1b'),_0x410d9c);if(_0x410d9c[_0xb7d6('0x1e')]){if(_0x410d9c[_0xb7d6('0x1e')][_0xb7d6('0x1f')]===0x1f4){logger[_0xb7d6('0x1e')](_0xb7d6('0x20'),_0xb7d6('0x1b'),_0x410d9c[_0xb7d6('0x1e')]);}}})['catch'](function(_0x87df5c){logger['error'](_0xb7d6('0x20'),'EventManager',_0x87df5c);});}function afterCreateMessage(_0x4088d0){return function(_0x3fcb49){_0x3fcb49=_0x3fcb49['get']({'plain':!![]});_0x3fcb49[_0xb7d6('0x21')]=_0x4088d0;_0x3fcb49[_0xb7d6('0x22')]=_0x4088d0;_0x3fcb49[_0xb7d6('0x23')]=_0x3fcb49[_0xb7d6('0x24')];Promise['resolve']()[_0xb7d6('0x1c')](function(){if(typeof _0x3fcb49[_0xb7d6('0x25')]===_0xb7d6('0x26'))return null;var _0x169b67=_0xb7d6('0x27')+_0x3fcb49[_0xb7d6('0x25')];return db[_0xb7d6('0x28')][_0xb7d6('0x29')](_0x169b67,{'type':db['Sequelize'][_0xb7d6('0x2a')]['SELECT'],'raw':!![]});})[_0xb7d6('0x1c')](function(_0xade701){if(_0xade701){_0x3fcb49['contact']=_0xade701[0x0];}if(typeof _0x3fcb49[_0xb7d6('0x2b')]==='undefined')return;return getAgent(_0x3fcb49[_0xb7d6('0x2b')]);})[_0xb7d6('0x1c')](function(_0x2295ea){if(_0x2295ea){_0x3fcb49[_0xb7d6('0x2c')]=util[_0xb7d6('0x2d')](_0xb7d6('0x2e'),_0x2295ea['name']);_0x3fcb49[_0xb7d6('0x2f')]=_0x2295ea;_0x3fcb49[_0xb7d6('0x21')]=_0x4088d0;return request({'event':_0xb7d6('0x30'),'message':_0x3fcb49});}else{return request({'event':_0xb7d6('0x31'),'message':_0x3fcb49});}})[_0xb7d6('0x32')](function(_0x1955e0){logger[_0xb7d6('0x1e')]('Trigger,\x20%s',_0xb7d6('0x33'),_0x1955e0);});};}function afterCreateOfflineMessage(_0x3525ff){return function(_0xeba5f6){_0xeba5f6=_0xeba5f6[_0xb7d6('0x34')]({'plain':!![]});_0xeba5f6[_0xb7d6('0x21')]=_0x3525ff;_0xeba5f6[_0xb7d6('0x22')]=_0x3525ff;_0xeba5f6[_0xb7d6('0x23')]=_0xb7d6('0x35');return request({'event':_0xeba5f6[_0xb7d6('0x23')],'message':_0xeba5f6});};}function afterCreate(_0x41345a,_0x5c91af){return function(_0x5c98d2){_0x5c98d2=_0x5c98d2[_0xb7d6('0x34')]({'plain':!![]});_0x5c98d2[_0xb7d6('0x21')]=_0x41345a;_0x5c98d2[_0xb7d6('0x22')]=_0x41345a;_0x5c98d2[_0xb7d6('0x23')]=_0xb7d6('0x36');Promise[_0xb7d6('0x37')]()[_0xb7d6('0x1c')](function(){var _0x4aad25='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5c98d2['ContactId'];return db[_0xb7d6('0x28')][_0xb7d6('0x29')](_0x4aad25,{'type':db[_0xb7d6('0x38')][_0xb7d6('0x2a')]['SELECT'],'raw':!![]});})[_0xb7d6('0x1c')](function(_0x191760){if(_0x191760){_0x5c98d2[_0xb7d6('0x39')]=_0x191760[0x0];}if(typeof _0x5c98d2['UserId']==='undefined')return;return getAgent(_0x5c98d2[_0xb7d6('0x2b')]);})[_0xb7d6('0x1c')](function(_0x2f98f3){if(_0x2f98f3){_0x5c98d2[_0xb7d6('0x2c')]=util['format'](_0xb7d6('0x2e'),_0x2f98f3[_0xb7d6('0x3a')]);_0x5c98d2[_0xb7d6('0x2f')]=_0x2f98f3;}return request({'event':_0x5c91af,'message':_0x5c98d2});})[_0xb7d6('0x32')](function(_0x2cb2d9){logger[_0xb7d6('0x1e')]('Trigger,\x20%s',_0xb7d6('0x3b'),_0x2cb2d9);});};}function afterUpdate(_0x1c2153){return function(_0xcef3e2){var _0x1b6c75=_0xcef3e2[_0xb7d6('0x3c')](_0xb7d6('0x3d'))&&_0xcef3e2['closed'];var _0x3d44ec=_0xcef3e2[_0xb7d6('0x3c')](_0xb7d6('0x3e'));if(_0x1b6c75||_0x3d44ec){var _0x4c410f=_0x1b6c75?_0xb7d6('0x7'):_0xb7d6('0x3e');var _0x1e7ca8=_0xcef3e2[_0xb7d6('0x34')]({'plain':!![]});_0x1e7ca8[_0xb7d6('0x21')]=_0x1c2153;_0x1e7ca8[_0xb7d6('0x22')]=_0x1c2153;_0x1e7ca8[_0xb7d6('0x23')]=_0x1b6c75?'closed':_0xb7d6('0x3e');var _0xc45d3a=_0xb7d6('0x27')+_0x1e7ca8['ContactId'];return db['sequelize'][_0xb7d6('0x29')](_0xc45d3a,{'type':db[_0xb7d6('0x38')][_0xb7d6('0x2a')][_0xb7d6('0x3f')],'raw':!![]})[_0xb7d6('0x1c')](function(_0xb13860){if(_0xb13860){_0x1e7ca8[_0xb7d6('0x39')]=_0xb13860[0x0];}if(typeof _0x1e7ca8[_0xb7d6('0x2b')]==='undefined')return;return getAgent(_0x1e7ca8[_0xb7d6('0x2b')]);})['then'](function(_0xfb4106){if(_0xfb4106){_0x1e7ca8['interface']=util[_0xb7d6('0x2d')]('SIP/%s',_0xfb4106[_0xb7d6('0x3a')]);_0x1e7ca8[_0xb7d6('0x2f')]=_0xfb4106;}return request({'event':_0x4c410f,'message':_0x1e7ca8});})[_0xb7d6('0x32')](function(_0x5232e6){logger['error'](_0xb7d6('0x20'),'AfterUpdate',_0x5232e6);});}};}function getAgent(_0x21a334){return db[_0xb7d6('0x40')]['find']({'where':{'id':_0x21a334},'attributes':['id','name',_0xb7d6('0x41'),_0xb7d6('0x42'),'internal'],'raw':!![]})[_0xb7d6('0x1c')](function(_0x175c31){return _0x175c31;});}exports[_0xb7d6('0x43')]=function(){for(var _0x1369ae=0x0;_0x1369ae=_0x134197[_0xdf62('0x12')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x4e577f(_0x13fe0b);})[_0xdf62('0x13')](function(_0xc730ad){_0x341dbf(_0xc730ad);});});}; \ No newline at end of file +var _0xbd5b=['bluebird','../mysqldb','./license/util','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','count','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash'];(function(_0x3717da,_0x2773a9){var _0x570cc2=function(_0x1f165a){while(--_0x1f165a){_0x3717da['push'](_0x3717da['shift']());}};_0x570cc2(++_0x2773a9);}(_0xbd5b,0x185));var _0xbbd5=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xbd5b[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xbbd5('0x0'));var BPromise=require(_0xbbd5('0x1'));var db=require(_0xbbd5('0x2'))['db'];var util=require(_0xbbd5('0x3'));var channels=['voice',_0xbbd5('0x4'),_0xbbd5('0x5'),_0xbbd5('0x6'),_0xbbd5('0x7'),_0xbbd5('0x8'),_0xbbd5('0x9')];exports[_0xbbd5('0xa')]=function(){return channels;};exports[_0xbbd5('0xb')]=function(_0x460e3d){_0x460e3d=_0x460e3d[_0xbbd5('0xc')]();return _[_0xbbd5('0xd')](channels,_0x460e3d);};exports[_0xbbd5('0xe')]=function(_0xad4976,_0x23c788,_0x2478bd,_0x1c0207){var _0x16cbd8={'loginAttempts':_0x23c788,'blocked':_0x2478bd};if(!_[_0xbbd5('0xf')](_0x1c0207)){_0x16cbd8[_0xbbd5('0x10')]=_0x1c0207;}return _0xad4976[_0xbbd5('0x11')](_0x16cbd8);};exports[_0xbbd5('0x12')]=function(_0x2297f0){return new BPromise(function(_0x5efe3e,_0x37d0c4){var _0x3f5f9b=0x0;if(_0x2297f0[_0xbbd5('0x13')]!==_0xbbd5('0x14')){_0x5efe3e(_0x2297f0);}db[_0xbbd5('0x15')][_0xbbd5('0x16')]({'where':{'role':_0xbbd5('0x14'),'online':!![],'id':{'$ne':_0x2297f0['id']}}})['then'](function(_0x336db9){_0x3f5f9b=_0x336db9;return util['getLicense']();})['then'](function(_0x2456ec){if(_0x2456ec&&_0x2456ec['agents']&&_0x3f5f9b>=_0x2456ec[_0xbbd5('0x17')]){throw Error(_0xbbd5('0x18'));}_0x5efe3e(_0x2297f0);})[_0xbbd5('0x19')](function(_0x3d44ff){_0x37d0c4(_0x3d44ff);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 763f889..d7efca1 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['OutOfInterval','error','stack','status','util','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','inherits'];(function(_0x173f13,_0x4ea3cf){var _0x585942=function(_0x96d7d5){while(--_0x96d7d5){_0x173f13['push'](_0x173f13['shift']());}};_0x585942(++_0x4ea3cf);}(_0x70e0,0x17b));var _0x070e=function(_0x3179c9,_0x55bdc8){_0x3179c9=_0x3179c9-0x0;var _0x513ffe=_0x70e0[_0x3179c9];return _0x513ffe;};'use strict';var util=require(_0x070e('0x0'));var logger=require(_0x070e('0x1'))(_0x070e('0x2'));var APIError=function(_0x4d95bb,_0x579b83){this[_0x070e('0x3')]=_0x4d95bb||_0x070e('0x4');this[_0x070e('0x5')]=_0x579b83||_0x070e('0x6');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x7bce9b){this['message']=_0x7bce9b||_0x070e('0x7');this['name']='Bad\x20Request';util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x35ab0c){this[_0x070e('0x3')]=_0x35ab0c||_0x070e('0x8');this[_0x070e('0x5')]=_0x070e('0x9');util[_0x070e('0xa')](APINotFoundError,APIError);};function getStatusCode(_0x11ffa8){switch(_0x11ffa8){case'Bad\x20Request':return 0x190;case'Forbidden',_0x070e('0xb'):return 0x193;case _0x070e('0x9'):return 0x194;default:return 0x1f4;}}function handleError(_0x12bb37){return function(_0xb8d819){logger[_0x070e('0xc')](_0xb8d819[_0x070e('0xd')]);var _0x25cfe1=getStatusCode(_0xb8d819[_0x070e('0x5')]);if(_0xb8d819[_0x070e('0x5')])delete _0xb8d819[_0x070e('0x5')];return _0x12bb37[_0x070e('0xe')](_0x25cfe1)['send'](_0xb8d819);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xe5b5=['name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Forbidden','error','status','send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error'];(function(_0x7d9f81,_0x5a9cd4){var _0x5abef7=function(_0x226a05){while(--_0x226a05){_0x7d9f81['push'](_0x7d9f81['shift']());}};_0x5abef7(++_0x5a9cd4);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x1d4449,_0x495153){_0x1d4449=_0x1d4449-0x0;var _0x4dcde3=_0xe5b5[_0x1d4449];return _0x4dcde3;};'use strict';var util=require(_0x5e5b('0x0'));var logger=require(_0x5e5b('0x1'))(_0x5e5b('0x2'));var APIError=function(_0x3b3efd,_0x208070){this[_0x5e5b('0x3')]=_0x3b3efd||_0x5e5b('0x4');this[_0x5e5b('0x5')]=_0x208070||_0x5e5b('0x6');util[_0x5e5b('0x7')](APIError,Error);};var APIBadRequestError=function(_0xdc6616){this[_0x5e5b('0x3')]=_0xdc6616||_0x5e5b('0x8');this[_0x5e5b('0x5')]=_0x5e5b('0x8');util[_0x5e5b('0x7')](APIBadRequestError,APIError);};var APINotFoundError=function(_0xe089b1){this[_0x5e5b('0x3')]=_0xe089b1||_0x5e5b('0x9');this[_0x5e5b('0x5')]=_0x5e5b('0xa');util[_0x5e5b('0x7')](APINotFoundError,APIError);};function getStatusCode(_0x3f8534){switch(_0x3f8534){case'Bad\x20Request':return 0x190;case _0x5e5b('0xb'),'OutOfInterval':return 0x193;case _0x5e5b('0xa'):return 0x194;default:return 0x1f4;}}function handleError(_0x58185){return function(_0x23e667){logger[_0x5e5b('0xc')](_0x23e667['stack']);var _0x4a1424=getStatusCode(_0x23e667['name']);if(_0x23e667[_0x5e5b('0x5')])delete _0x23e667[_0x5e5b('0x5')];return _0x58185[_0x5e5b('0xd')](_0x4a1424)[_0x5e5b('0xe')](_0x23e667);};}module[_0x5e5b('0xf')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 2c609db..f743219 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x441c=['render','status','404'];(function(_0x1e8f35,_0x1b6142){var _0x35324b=function(_0x133c4e){while(--_0x133c4e){_0x1e8f35['push'](_0x1e8f35['shift']());}};_0x35324b(++_0x1b6142);}(_0x441c,0x14f));var _0xc441=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x441c[_0xa8883];return _0x479426;};'use strict';module['exports'][0x194]=function pageNotFound(_0x52b121,_0x2aeabc){var _0x5dbdcf=_0xc441('0x0');var _0x4c1824=0x194;var _0x335dce={'status':_0x4c1824};_0x2aeabc['status'](_0x335dce['status']);_0x2aeabc[_0xc441('0x1')](_0x5dbdcf,{},function(_0x5cbe3e,_0x1e4238){if(_0x5cbe3e){return _0x2aeabc['status'](_0x335dce[_0xc441('0x2')])['json'](_0x335dce);}_0x2aeabc['send'](_0x1e4238);});}; \ No newline at end of file +var _0x8b26=['status','render','json','send'];(function(_0x33db28,_0x3f27ec){var _0x588298=function(_0x1073a8){while(--_0x1073a8){_0x33db28['push'](_0x33db28['shift']());}};_0x588298(++_0x3f27ec);}(_0x8b26,0x120));var _0x68b2=function(_0x41eb8b,_0x8e630f){_0x41eb8b=_0x41eb8b-0x0;var _0x57f6be=_0x8b26[_0x41eb8b];return _0x57f6be;};'use strict';module['exports'][0x194]=function pageNotFound(_0x14a53,_0xa5e0cb){var _0x183318='404';var _0x4f338c=0x194;var _0x50f0c0={'status':_0x4f338c};_0xa5e0cb[_0x68b2('0x0')](_0x50f0c0['status']);_0xa5e0cb[_0x68b2('0x1')](_0x183318,{},function(_0x5bcd6a,_0x2f9b13){if(_0x5bcd6a){return _0xa5e0cb['status'](_0x50f0c0[_0x68b2('0x0')])[_0x68b2('0x2')](_0x50f0c0);}_0xa5e0cb[_0x68b2('0x3')](_0x2f9b13);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 38cef8e..b2be8fe 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd5b4=['../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','VoiceMail','cascade','userSetting','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','WhatsappInteractions','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefix','MailQueues','UserChatQueue','FaxQueue','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','VoiceChanSpy','SpiedAgents','Applications','Sounds','moh_has_sounds','VoiceQueueId','CmHopper','Hoppers','HopperHistories','HopperBlacks','JscriptySessionReport','JscriptySessions','Trunk','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','mailbox','mailboxuser','QueueCalls','AgentReports','uniqueid','Contact','ContactId','MailAccountId','restrict','CloudProviderId','Imap','Smtp','Dispositions','Answers','Messages','Interactions','MailApplication','List','ListId','TemplateId','team_has_mail_queues','MailInteractionId','Tags','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','Account','ChatWebsiteId','TagId','Items','FaxAccountId','Exntensions','FaxMessage','FaxInteractionId','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsMessage','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccount','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','UserOpenchannelQueue','team_has_openchannel_queues','ProactiveActions','Agent','Queue','ChatQueueId','ChatMessage','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','ChatGroupId','Website','CompanyId','Phones','CmContactId','cm_contact_has_tags','AdditionalPhones','CampaignId','OwnerId','All','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','MailApplications','ChatApplications','FaxApplications','SmsApplications','CustomReportId','Sound','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','CmHopperId','AllConditions','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','DefaultReportId','MetricId','AccountId','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','DescriptionId','VariableId','SugarcrmConfiguration','Configurations','Field','DeskAccount','int_desk_configuration_has_tags','ZohoAccount','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerConfiguration','Dynamics365Account','SessionId','JscriptyProject','ProjectId','ChatQueues','team_has_whatsapp_queues','campaigns_has_cm_lists','FromMailAccountId','FromAccount','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ChatTransferReport','FromChatWebsiteId','FromUserId','ToUserId','ToChatWebsiteId','ToAccount','FromFaxAccountId','FromAgent','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CustomFields','Queues','voice_queues_has_cm_lists','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','ToWhatsappAccountId','ToQueueId','user','../config/environment','lodash','jstz','determine','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','127.0.0.1','name','database','username','password','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsQueue','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','ServicenowField','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareProject','../api/squareProject/squareProject.model','SquareMessage','Team','License','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile'];(function(_0xd816e2,_0x5edac2){var _0x1f5924=function(_0x1bcbf0){while(--_0x1bcbf0){_0xd816e2['push'](_0xd816e2['shift']());}};_0x1f5924(++_0x5edac2);}(_0xd5b4,0x104));var _0x4d5b=function(_0x377ff6,_0xf7fb77){_0x377ff6=_0x377ff6-0x0;var _0x2f6117=_0xd5b4[_0x377ff6];return _0x2f6117;};'use strict';var config=require(_0x4d5b('0x0'));var Sequelize=require('sequelize');var _=require(_0x4d5b('0x1'));var jstz=require(_0x4d5b('0x2'));var timezone=jstz[_0x4d5b('0x3')]();config[_0x4d5b('0x4')]=_[_0x4d5b('0x5')](config[_0x4d5b('0x4')],{'database':_0x4d5b('0x6'),'username':_0x4d5b('0x7'),'password':_0x4d5b('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x4d5b('0x9'),'dialectOptions':{'charset':_0x4d5b('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x4d5b('0xb'),'collate':_0x4d5b('0xc')}}});config[_0x4d5b('0xd')]=_[_0x4d5b('0x5')](config[_0x4d5b('0xd')],{'database':_0x4d5b('0x6'),'username':'xcall','password':_0x4d5b('0x8'),'options':{'host':_0x4d5b('0xe'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x4d5b('0xa')},'logging':![],'timezone':timezone[_0x4d5b('0xf')](),'define':{'charset':_0x4d5b('0xb'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x4d5b('0x4')][_0x4d5b('0x10')],config[_0x4d5b('0x4')][_0x4d5b('0x11')],config[_0x4d5b('0x4')][_0x4d5b('0x12')],config[_0x4d5b('0x4')][_0x4d5b('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x4d5b('0x10')],config[_0x4d5b('0xd')][_0x4d5b('0x11')],config['sequelizeHistory']['password'],config[_0x4d5b('0xd')][_0x4d5b('0x13')])};db[_0x4d5b('0x14')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x16'));db['VoiceChanSpy']=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x17'));db[_0x4d5b('0x18')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x19'));db[_0x4d5b('0x1a')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x1b'));db[_0x4d5b('0x1c')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x1d'));db[_0x4d5b('0x1e')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0x1f'));db[_0x4d5b('0x20')]=db[_0x4d5b('0x4')]['import'](_0x4d5b('0x21'));db[_0x4d5b('0x22')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x23'));db['VoiceMail']=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/voiceMail/voiceMail.model');db[_0x4d5b('0x24')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x25'));db[_0x4d5b('0x26')]=db[_0x4d5b('0x4')]['import'](_0x4d5b('0x27'));db[_0x4d5b('0x28')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x29'));db[_0x4d5b('0x2a')]=db[_0x4d5b('0x4')]['import'](_0x4d5b('0x2b'));db[_0x4d5b('0x2c')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x4d5b('0x2d')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x2e'));db['Trunk']=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/trunk/trunk.model');db[_0x4d5b('0x2f')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x30'));db[_0x4d5b('0x31')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x32'));db[_0x4d5b('0x33')]=db[_0x4d5b('0x4')]['import'](_0x4d5b('0x34'));db['UserChatQueue']=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0x35'));db[_0x4d5b('0x36')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0x37'));db[_0x4d5b('0x38')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x39'));db['UserSmsQueue']=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x4d5b('0x3a')]=db[_0x4d5b('0x4')]['import'](_0x4d5b('0x3b'));db[_0x4d5b('0x3c')]=db[_0x4d5b('0x4')]['import']('../api/mailServerIn/mailServerIn.model');db[_0x4d5b('0x3d')]=db['sequelize']['import'](_0x4d5b('0x3e'));db[_0x4d5b('0x3f')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x40'));db[_0x4d5b('0x41')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0x42'));db['MailSubstatus']=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0x43'));db[_0x4d5b('0x44')]=db[_0x4d5b('0x4')]['import'](_0x4d5b('0x45'));db[_0x4d5b('0x46')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x47'));db['MailApplication']=db['sequelize'][_0x4d5b('0x15')]('../api/mailApplication/mailApplication.model');db[_0x4d5b('0x48')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x49'));db[_0x4d5b('0x4a')]=db[_0x4d5b('0x4')]['import'](_0x4d5b('0x4b'));db[_0x4d5b('0x4c')]=db['sequelize']['import']('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x4d'));db[_0x4d5b('0x4e')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x4f'));db['FaxInteraction']=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x50'));db['FaxMessage']=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x51'));db['FaxQueue']=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x52'));db[_0x4d5b('0x53')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x54'));db['SmsAccount']=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0x55'));db[_0x4d5b('0x56')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0x57'));db[_0x4d5b('0x58')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0x59'));db['SmsMessage']=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/smsMessage/smsMessage.model');db[_0x4d5b('0x5a')]=db['sequelize'][_0x4d5b('0x15')]('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x5b'));db[_0x4d5b('0x5c')]=db[_0x4d5b('0x4')]['import']('../api/openchannelApplication/openchannelApplication.model');db[_0x4d5b('0x5d')]=db[_0x4d5b('0x4')]['import'](_0x4d5b('0x5e'));db[_0x4d5b('0x5f')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x60'));db[_0x4d5b('0x61')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/openchannelQueue/openchannelQueue.model');db[_0x4d5b('0x62')]=db['sequelize']['import']('../api/chatWebsite/chatWebsite.model');db[_0x4d5b('0x63')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0x64'));db[_0x4d5b('0x65')]=db[_0x4d5b('0x4')]['import'](_0x4d5b('0x66'));db['ChatInteraction']=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x67'));db['ChatMessage']=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0x68'));db[_0x4d5b('0x69')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x6a'));db[_0x4d5b('0x6b')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/chatQueue/chatQueue.model');db[_0x4d5b('0x6c')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x6d'));db[_0x4d5b('0x6e')]=db[_0x4d5b('0x4')]['import'](_0x4d5b('0x6f'));db[_0x4d5b('0x70')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0x71'));db[_0x4d5b('0x72')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0x73'));db['CmHopper']=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/cmHopper/cmHopper.model');db[_0x4d5b('0x74')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x4d5b('0x75')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x76'));db[_0x4d5b('0x77')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x78'));db[_0x4d5b('0x79')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0x7a'));db[_0x4d5b('0x7b')]=db[_0x4d5b('0x4')]['import'](_0x4d5b('0x7c'));db[_0x4d5b('0x7d')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/action/action.model');db[_0x4d5b('0x7e')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0x7f'));db[_0x4d5b('0x80')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x81'));db[_0x4d5b('0x82')]=db[_0x4d5b('0x4')]['import'](_0x4d5b('0x83'));db[_0x4d5b('0x84')]=db['sequelize'][_0x4d5b('0x15')]('../api/condition/condition.model');db[_0x4d5b('0x85')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x86'));db[_0x4d5b('0x87')]=db[_0x4d5b('0x4')]['import'](_0x4d5b('0x88'));db[_0x4d5b('0x89')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/cdr/cdr.model');db[_0x4d5b('0x8a')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x8b'));db[_0x4d5b('0x8c')]=db['sequelize'][_0x4d5b('0x15')]('../api/schedule/schedule.model');db['Sound']=db['sequelize'][_0x4d5b('0x15')]('../api/sound/sound.model');db[_0x4d5b('0x8d')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x8e'));db[_0x4d5b('0x8f')]=db[_0x4d5b('0x4')]['import'](_0x4d5b('0x90'));db[_0x4d5b('0x91')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/cmContactHasItem/cmContactHasItem.model');db[_0x4d5b('0x92')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x93'));db[_0x4d5b('0x94')]=db[_0x4d5b('0x4')]['import'](_0x4d5b('0x95'));db[_0x4d5b('0x96')]=db[_0x4d5b('0x4')]['import']('../api/trigger/trigger.model');db[_0x4d5b('0x97')]=db['sequelize'][_0x4d5b('0x15')]('../api/variable/variable.model');db[_0x4d5b('0x98')]=db['sequelize']['import'](_0x4d5b('0x99'));db[_0x4d5b('0x9a')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x9b'));db[_0x4d5b('0x9c')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x9d'));db[_0x4d5b('0x9e')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x9f'));db['AnalyticExtractedReport']=db[_0x4d5b('0x4')]['import'](_0x4d5b('0xa0'));db[_0x4d5b('0xa1')]=db[_0x4d5b('0x4')]['import'](_0x4d5b('0xa2'));db['AnalyticFieldReport']=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0xa3'));db[_0x4d5b('0xa4')]=db[_0x4d5b('0x4')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0x4d5b('0xa5')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0xa6'));db[_0x4d5b('0xa7')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x4d5b('0xa8')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0xa9'));db[_0x4d5b('0xaa')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0xab'));db['SugarcrmConfiguration']=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0xac'));db[_0x4d5b('0xad')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0xae'));db['DeskAccount']=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/intDeskAccount/intDeskAccount.model');db[_0x4d5b('0xaf')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x4d5b('0xb0')]=db['sequelize']['import'](_0x4d5b('0xb1'));db['ZohoAccount']=db['sequelize']['import'](_0x4d5b('0xb2'));db[_0x4d5b('0xb3')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0xb4'));db[_0x4d5b('0xb5')]=db[_0x4d5b('0x4')]['import'](_0x4d5b('0xb6'));db[_0x4d5b('0xb7')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0xb8'));db[_0x4d5b('0xb9')]=db[_0x4d5b('0x4')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x4d5b('0xba')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0xbb'));db['FreshdeskAccount']=db['sequelize'][_0x4d5b('0x15')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x4d5b('0xbc')]=db['sequelize']['import'](_0x4d5b('0xbd'));db[_0x4d5b('0xbe')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0xbf'));db[_0x4d5b('0xc0')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0xc1'));db['VtigerConfiguration']=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x4d5b('0xc2')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0xc3'));db[_0x4d5b('0xc4')]=db['sequelize'][_0x4d5b('0x15')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x4d5b('0xc5')]=db['sequelize']['import']('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x4d5b('0xc6')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0xc7'));db[_0x4d5b('0xc8')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0xc9'));db[_0x4d5b('0xca')]=db['sequelize'][_0x4d5b('0x15')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x4d5b('0xcb')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0xcc'));db[_0x4d5b('0xcd')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x4d5b('0xce')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0xcf'));db[_0x4d5b('0x98')]=db['sequelize']['import']('../api/integration/integration.model');db[_0x4d5b('0xd0')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0xd1'));db[_0x4d5b('0xd2')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0xd3'));db[_0x4d5b('0xd4')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x4d5b('0xd5')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0xd6'));db[_0x4d5b('0xd7')]=db[_0x4d5b('0x4')]['import'](_0x4d5b('0xd8'));db['JscriptySessionReport']=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0xd9'));db[_0x4d5b('0xda')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0xdb'));db[_0x4d5b('0xdc')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0xdd'));db[_0x4d5b('0xde')]=db[_0x4d5b('0x4')]['import'](_0x4d5b('0xdf'));db['JscriptyProject']=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0xe0'));db[_0x4d5b('0xe1')]=db[_0x4d5b('0x4')]['import'](_0x4d5b('0xe2'));db['SquareOdbc']=db['sequelize']['import']('../api/squareOdbc/squareOdbc.model');db[_0x4d5b('0xe3')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0xe4'));db['SquareRecording']=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/squareRecording/squareRecording.model');db[_0x4d5b('0xe5')]=db['sequelize'][_0x4d5b('0x15')]('../api/squareMessage/squareMessage.model');db[_0x4d5b('0xe6')]=db['sequelize'][_0x4d5b('0x15')]('../api/team/team.model');db[_0x4d5b('0xe7')]=db[_0x4d5b('0x4')]['import']('../api/license/license.model');db[_0x4d5b('0xe8')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0xe9'));db[_0x4d5b('0xea')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0xeb'));db[_0x4d5b('0xec')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0xed'));db[_0x4d5b('0xee')]=db[_0x4d5b('0x4')]['import']('../api/plugin/plugin.model');db[_0x4d5b('0xef')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0xf0'));db['ChatTransferReport']=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0xf1'));db[_0x4d5b('0xf2')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0xf3'));db[_0x4d5b('0xf4')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x4d5b('0xf5')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0xf6'));db[_0x4d5b('0xf7')]=db['sequelize']['import'](_0x4d5b('0xf8'));db['VoicePrefix']=db[_0x4d5b('0x4')]['import'](_0x4d5b('0xf9'));db[_0x4d5b('0xfa')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0xfb'));db[_0x4d5b('0xfc')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/userProfileSection/userProfileSection.model');db[_0x4d5b('0xfd')]=db[_0x4d5b('0x4')]['import'](_0x4d5b('0xfe'));db[_0x4d5b('0xff')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0x100'));db[_0x4d5b('0x101')]=db['sequelize']['import']('../api/whatsappAccount/whatsappAccount.model');db[_0x4d5b('0x102')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/whatsappApplication/whatsappApplication.model');db[_0x4d5b('0x103')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0x104'));db[_0x4d5b('0x105')]=db['sequelize'][_0x4d5b('0x15')]('../api/whatsappMessage/whatsappMessage.model');db[_0x4d5b('0x106')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x107'));db[_0x4d5b('0x108')]=db[_0x4d5b('0x4')]['import'](_0x4d5b('0x109'));db[_0x4d5b('0x10a')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0x10b'));db[_0x4d5b('0x10c')]=db['sequelize'][_0x4d5b('0x15')](_0x4d5b('0x10d'));db[_0x4d5b('0x10e')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x4d5b('0x10f')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x110'));db[_0x4d5b('0x111')]=db[_0x4d5b('0x4')]['import'](_0x4d5b('0x112'));db[_0x4d5b('0x113')]=db[_0x4d5b('0x4')][_0x4d5b('0x15')](_0x4d5b('0x114'));db[_0x4d5b('0x14')][_0x4d5b('0x115')](db[_0x4d5b('0x116')],{'as':_0x4d5b('0x116'),'onDelete':_0x4d5b('0x117'),'foreignKey':'UserId'});db['User'][_0x4d5b('0x115')](db['UserSetting'],{'as':_0x4d5b('0x118'),'onDelete':'cascade','foreignKey':_0x4d5b('0x119')});db['User'][_0x4d5b('0x11a')](db['VoiceRecording'],{'as':_0x4d5b('0x11b'),'foreignKey':_0x4d5b('0x119')});db[_0x4d5b('0x14')][_0x4d5b('0x11a')](db[_0x4d5b('0x31')],{'as':_0x4d5b('0x11c'),'foreignKey':'UserId'});db[_0x4d5b('0x14')][_0x4d5b('0x11a')](db['VoiceExtension'],{'as':_0x4d5b('0x11d'),'onDelete':_0x4d5b('0x117'),'hooks':!![]});db[_0x4d5b('0x14')]['hasMany'](db['CmHopperFinal'],{'as':_0x4d5b('0x11e'),'foreignKey':'UserId'});db[_0x4d5b('0x14')]['hasMany'](db[_0x4d5b('0x77')],{'as':_0x4d5b('0x11f'),'foreignKey':_0x4d5b('0x119')});db['User'][_0x4d5b('0x11a')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'UserId'});db['User'][_0x4d5b('0x11a')](db[_0x4d5b('0x5d')],{'as':'OpenchannelInteractions','foreignKey':_0x4d5b('0x119')});db[_0x4d5b('0x14')][_0x4d5b('0x11a')](db[_0x4d5b('0x120')],{'as':_0x4d5b('0x121'),'foreignKey':'UserId'});db[_0x4d5b('0x14')][_0x4d5b('0x11a')](db[_0x4d5b('0x58')],{'as':_0x4d5b('0x122'),'foreignKey':_0x4d5b('0x119')});db[_0x4d5b('0x14')][_0x4d5b('0x11a')](db[_0x4d5b('0x123')],{'as':_0x4d5b('0x124'),'foreignKey':_0x4d5b('0x119')});db['User'][_0x4d5b('0x11a')](db[_0x4d5b('0x44')],{'as':'MailInteractions','foreignKey':_0x4d5b('0x119')});db['User'][_0x4d5b('0x11a')](db['WhatsappInteraction'],{'as':_0x4d5b('0x125'),'foreignKey':_0x4d5b('0x119')});db[_0x4d5b('0x14')][_0x4d5b('0x11a')](db[_0x4d5b('0xff')],{'as':'UserNotifications','foreignKey':_0x4d5b('0x126')});db['User'][_0x4d5b('0x127')](db[_0x4d5b('0xfa')],{'as':_0x4d5b('0xfa'),'foreignKey':_0x4d5b('0x128')});db[_0x4d5b('0x14')][_0x4d5b('0x129')](db[_0x4d5b('0x6c')],{'as':_0x4d5b('0x12a'),'through':_0x4d5b('0x12b')});db[_0x4d5b('0x14')]['belongsToMany'](db['CmContact'],{'as':_0x4d5b('0x12c'),'through':_0x4d5b('0x12d')});db[_0x4d5b('0x14')]['belongsToMany'](db['CmList'],{'as':_0x4d5b('0x12e'),'through':_0x4d5b('0x12f')});db[_0x4d5b('0x14')]['belongsToMany'](db[_0x4d5b('0xe6')],{'through':_0x4d5b('0x130')});db[_0x4d5b('0x14')][_0x4d5b('0x129')](db[_0x4d5b('0x44')],{'as':_0x4d5b('0x131'),'through':_0x4d5b('0x132')});db[_0x4d5b('0x14')][_0x4d5b('0x129')](db[_0x4d5b('0x120')],{'as':_0x4d5b('0x121'),'through':_0x4d5b('0x133')});db[_0x4d5b('0x14')]['belongsToMany'](db[_0x4d5b('0x123')],{'as':'FaxInteractions','through':_0x4d5b('0x134')});db[_0x4d5b('0x14')][_0x4d5b('0x129')](db['SmsInteraction'],{'as':_0x4d5b('0x122'),'through':_0x4d5b('0x135')});db[_0x4d5b('0x14')][_0x4d5b('0x129')](db[_0x4d5b('0x5d')],{'as':_0x4d5b('0x136'),'through':_0x4d5b('0x137')});db[_0x4d5b('0x14')][_0x4d5b('0x129')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':_0x4d5b('0x138')});db[_0x4d5b('0x14')][_0x4d5b('0x129')](db[_0x4d5b('0x1e')],{'as':_0x4d5b('0x139'),'through':_0x4d5b('0x33'),'required':![]});db['User']['belongsToMany'](db[_0x4d5b('0x13a')],{'as':'VoicePrefixes','through':_0x4d5b('0x111'),'required':![]});db[_0x4d5b('0x14')][_0x4d5b('0x129')](db[_0x4d5b('0x41')],{'as':_0x4d5b('0x13b'),'through':_0x4d5b('0x36'),'required':![]});db['User'][_0x4d5b('0x129')](db['ChatQueue'],{'as':'ChatQueues','through':_0x4d5b('0x13c'),'required':![],'hooks':!![]});db[_0x4d5b('0x14')]['belongsToMany'](db[_0x4d5b('0x13d')],{'as':_0x4d5b('0x13e'),'through':_0x4d5b('0x38'),'required':![]});db[_0x4d5b('0x14')][_0x4d5b('0x129')](db[_0x4d5b('0x5a')],{'as':_0x4d5b('0x13f'),'through':_0x4d5b('0x140'),'required':![]});db['User'][_0x4d5b('0x129')](db[_0x4d5b('0x61')],{'as':_0x4d5b('0x141'),'through':'UserOpenchannelQueue','required':![]});db[_0x4d5b('0x14')][_0x4d5b('0x129')](db[_0x4d5b('0x10a')],{'as':_0x4d5b('0x142'),'through':_0x4d5b('0x3a'),'required':![]});db[_0x4d5b('0x14')]['belongsToMany'](db[_0x4d5b('0xf7')],{'through':_0x4d5b('0x12f')});db[_0x4d5b('0x14')]['belongsToMany'](db[_0x4d5b('0x62')],{'as':_0x4d5b('0x143'),'through':_0x4d5b('0x144')});db[_0x4d5b('0x14')][_0x4d5b('0x129')](db[_0x4d5b('0x145')],{'as':_0x4d5b('0x146'),'through':'user_has_fax_accounts'});db[_0x4d5b('0x14')]['belongsToMany'](db['MailAccount'],{'as':'MailAccounts','through':_0x4d5b('0x147')});db['User'][_0x4d5b('0x129')](db['OpenchannelAccount'],{'as':_0x4d5b('0x148'),'through':_0x4d5b('0x149')});db[_0x4d5b('0x14')][_0x4d5b('0x129')](db[_0x4d5b('0x14a')],{'as':'SmsAccounts','through':_0x4d5b('0x14b')});db[_0x4d5b('0x14')][_0x4d5b('0x129')](db[_0x4d5b('0x101')],{'as':_0x4d5b('0x14c'),'through':_0x4d5b('0x14d')});db[_0x4d5b('0x14e')]['hasMany'](db[_0x4d5b('0x1a')],{'as':_0x4d5b('0x14f'),'onDelete':_0x4d5b('0x117'),'foreignKey':'ChanSpyId'});db['VoiceContext'][_0x4d5b('0x11a')](db[_0x4d5b('0x1a')],{'onDelete':_0x4d5b('0x117')});db[_0x4d5b('0x1a')][_0x4d5b('0x11a')](db[_0x4d5b('0x1a')],{'as':_0x4d5b('0x150'),'onDelete':_0x4d5b('0x117')});db['VoiceMusicOnHold']['belongsToMany'](db['Sound'],{'as':_0x4d5b('0x151'),'through':_0x4d5b('0x152')});db['VoiceQueue'][_0x4d5b('0x11a')](db[_0x4d5b('0x31')],{'as':'Members','foreignKey':_0x4d5b('0x153')});db[_0x4d5b('0x1e')][_0x4d5b('0x11a')](db[_0x4d5b('0x154')],{'as':_0x4d5b('0x155'),'foreignKey':_0x4d5b('0x153')});db['VoiceQueue'][_0x4d5b('0x11a')](db['CmHopperFinal'],{'as':_0x4d5b('0x11e'),'foreignKey':_0x4d5b('0x153')});db[_0x4d5b('0x1e')]['hasMany'](db[_0x4d5b('0x77')],{'as':_0x4d5b('0x156'),'foreignKey':_0x4d5b('0x153')});db[_0x4d5b('0x1e')]['hasMany'](db[_0x4d5b('0x79')],{'as':_0x4d5b('0x79'),'foreignKey':_0x4d5b('0x153')});db[_0x4d5b('0x1e')][_0x4d5b('0x11a')](db[_0x4d5b('0x74')],{'as':_0x4d5b('0x157'),'foreignKey':_0x4d5b('0x153')});db[_0x4d5b('0x1e')][_0x4d5b('0x11a')](db[_0x4d5b('0x158')],{'as':_0x4d5b('0x159'),'foreignKey':_0x4d5b('0x153')});db[_0x4d5b('0x1e')][_0x4d5b('0x127')](db[_0x4d5b('0x15a')],{'as':'Trunk','foreignKey':_0x4d5b('0x15b')});db[_0x4d5b('0x1e')][_0x4d5b('0x127')](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0x4d5b('0x15c')});db[_0x4d5b('0x1e')]['belongsTo'](db[_0x4d5b('0x85')],{'as':_0x4d5b('0x85'),'foreignKey':_0x4d5b('0x15d')});db[_0x4d5b('0x1e')]['belongsTo'](db['Pause'],{'as':_0x4d5b('0x15e'),'foreignKey':_0x4d5b('0x15f')});db['VoiceQueue'][_0x4d5b('0x129')](db[_0x4d5b('0xf7')],{'as':_0x4d5b('0x12e'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue']['belongsToMany'](db['User'],{'as':_0x4d5b('0x160'),'through':_0x4d5b('0x33')});db['VoiceQueue'][_0x4d5b('0x129')](db[_0x4d5b('0xe6')],{'as':_0x4d5b('0x161'),'through':_0x4d5b('0x10e')});db['VoiceQueue'][_0x4d5b('0x129')](db[_0x4d5b('0xf7')],{'as':_0x4d5b('0x162'),'through':_0x4d5b('0x163')});db[_0x4d5b('0x20')]['belongsTo'](db['User'],{'as':_0x4d5b('0x14'),'foreignKey':'UserId'});db[_0x4d5b('0x22')][_0x4d5b('0x127')](db[_0x4d5b('0x14')],{'as':_0x4d5b('0x14'),'foreignKey':_0x4d5b('0x119')});db[_0x4d5b('0x116')][_0x4d5b('0x11a')](db[_0x4d5b('0x24')],{'as':'Messages','onDelete':_0x4d5b('0x117'),'foreignKey':'mailboxuser','sourceKey':_0x4d5b('0x164')});db[_0x4d5b('0x24')][_0x4d5b('0x127')](db[_0x4d5b('0x116')],{'foreignKey':_0x4d5b('0x165'),'targetKey':_0x4d5b('0x164')});db[_0x4d5b('0x26')][_0x4d5b('0x11a')](db[_0x4d5b('0x2c')],{'as':_0x4d5b('0x166'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x4d5b('0x11a')](db[_0x4d5b('0x2a')],{'as':_0x4d5b('0x167'),'foreignKey':_0x4d5b('0x168'),'constraints':![]});db[_0x4d5b('0x26')][_0x4d5b('0x127')](db['User'],{'as':_0x4d5b('0x14'),'foreignKey':_0x4d5b('0x119')});db['VoiceCallReport']['belongsTo'](db[_0x4d5b('0x72')],{'as':_0x4d5b('0x169'),'foreignKey':_0x4d5b('0x16a')});db[_0x4d5b('0x3c')]['belongsTo'](db['MailAccount'],{'as':_0x4d5b('0x3f'),'foreignKey':_0x4d5b('0x16b')});db[_0x4d5b('0x3c')]['belongsTo'](db[_0x4d5b('0x10c')],{'as':_0x4d5b('0x10c'),'foreignKey':'CloudProviderId','onDelete':_0x4d5b('0x16c')});db[_0x4d5b('0x3d')][_0x4d5b('0x127')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0x4d5b('0x16b')});db[_0x4d5b('0x3d')][_0x4d5b('0x127')](db[_0x4d5b('0x10c')],{'as':'CloudProvider','foreignKey':_0x4d5b('0x16d'),'onDelete':_0x4d5b('0x16c')});db[_0x4d5b('0x3f')][_0x4d5b('0x115')](db[_0x4d5b('0x3c')],{'as':_0x4d5b('0x16e'),'onDelete':_0x4d5b('0x117')});db[_0x4d5b('0x3f')][_0x4d5b('0x115')](db[_0x4d5b('0x3d')],{'as':_0x4d5b('0x16f'),'onDelete':_0x4d5b('0x117')});db[_0x4d5b('0x3f')]['hasMany'](db['Disposition'],{'as':_0x4d5b('0x170'),'foreignKey':_0x4d5b('0x16b'),'onDelete':'cascade'});db[_0x4d5b('0x3f')][_0x4d5b('0x11a')](db[_0x4d5b('0x80')],{'as':_0x4d5b('0x171'),'foreignKey':'MailAccountId'});db[_0x4d5b('0x3f')][_0x4d5b('0x11a')](db[_0x4d5b('0x46')],{'as':_0x4d5b('0x172'),'foreignKey':_0x4d5b('0x16b')});db[_0x4d5b('0x3f')][_0x4d5b('0x11a')](db[_0x4d5b('0x44')],{'as':_0x4d5b('0x173')});db[_0x4d5b('0x3f')]['hasMany'](db[_0x4d5b('0x174')],{'as':_0x4d5b('0x150')});db['MailAccount']['belongsTo'](db[_0x4d5b('0xf7')],{'as':_0x4d5b('0x175'),'foreignKey':_0x4d5b('0x176')});db[_0x4d5b('0x3f')][_0x4d5b('0x127')](db[_0x4d5b('0x94')],{'as':'Template','foreignKey':_0x4d5b('0x177')});db[_0x4d5b('0x3f')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x4d5b('0x15f')});db[_0x4d5b('0x3f')]['belongsToMany'](db['User'],{'as':_0x4d5b('0x160'),'through':_0x4d5b('0x147')});db['MailQueue'][_0x4d5b('0x129')](db['User'],{'as':_0x4d5b('0x160'),'through':'UserMailQueue'});db[_0x4d5b('0x41')][_0x4d5b('0x129')](db['Team'],{'through':_0x4d5b('0x178'),'as':_0x4d5b('0x161')});db[_0x4d5b('0x44')]['hasMany'](db['MailMessage'],{'as':'Messages','onDelete':_0x4d5b('0x117'),'foreignKey':_0x4d5b('0x179')});db[_0x4d5b('0x44')][_0x4d5b('0x127')](db[_0x4d5b('0x3f')],{'as':'Account','foreignKey':_0x4d5b('0x16b')});db[_0x4d5b('0x44')][_0x4d5b('0x127')](db[_0x4d5b('0x72')],{'as':'Contact','foreignKey':_0x4d5b('0x16a')});db[_0x4d5b('0x44')][_0x4d5b('0x127')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0x4d5b('0x44')][_0x4d5b('0x129')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x4d5b('0x17a')});db[_0x4d5b('0x44')]['belongsToMany'](db[_0x4d5b('0x8d')],{'through':_0x4d5b('0x17b'),'as':_0x4d5b('0x17c')});db[_0x4d5b('0x44')][_0x4d5b('0x129')](db[_0x4d5b('0x14')],{'as':_0x4d5b('0x17d'),'through':_0x4d5b('0x132'),'foreignKey':_0x4d5b('0x179')});db[_0x4d5b('0x46')][_0x4d5b('0x11a')](db[_0x4d5b('0xec')],{'as':_0x4d5b('0x17e'),'onDelete':_0x4d5b('0x117')});db[_0x4d5b('0x46')][_0x4d5b('0x127')](db[_0x4d5b('0x14')],{'as':'User'});db[_0x4d5b('0x46')][_0x4d5b('0x127')](db['CmContact'],{'onDelete':_0x4d5b('0x117'),'as':_0x4d5b('0x169')});db['MailMessage'][_0x4d5b('0x127')](db[_0x4d5b('0x44')],{'as':_0x4d5b('0x17f'),'foreignKey':_0x4d5b('0x179')});db[_0x4d5b('0x46')][_0x4d5b('0x127')](db['MailAccount'],{'as':_0x4d5b('0x180'),'foreignKey':_0x4d5b('0x16b')});db['MailMessage'][_0x4d5b('0x127')](db[_0x4d5b('0x62')],{'as':_0x4d5b('0x62'),'foreignKey':_0x4d5b('0x181')});db[_0x4d5b('0x46')][_0x4d5b('0x127')](db[_0x4d5b('0x69')],{'as':_0x4d5b('0x69'),'foreignKey':'ChatOfflineMessageId'});db['MailApplication'][_0x4d5b('0x127')](db[_0x4d5b('0x14')],{'onDelete':_0x4d5b('0x16c')});db[_0x4d5b('0x174')]['belongsTo'](db[_0x4d5b('0x41')],{'onDelete':'restrict'});db[_0x4d5b('0x174')][_0x4d5b('0x127')](db[_0x4d5b('0x3f')],{'onDelete':'restrict'});db['MailApplication'][_0x4d5b('0x127')](db[_0x4d5b('0x85')],{'onDelete':_0x4d5b('0x16c'),'foreignKey':'IntervalId'});db[_0x4d5b('0x174')][_0x4d5b('0x127')](db[_0x4d5b('0x8d')],{'onDelete':_0x4d5b('0x16c'),'foreignKey':_0x4d5b('0x182')});db[_0x4d5b('0x48')][_0x4d5b('0x127')](db[_0x4d5b('0x3f')],{});db[_0x4d5b('0x48')][_0x4d5b('0x127')](db[_0x4d5b('0xf7')],{'as':_0x4d5b('0x175'),'foreignKey':_0x4d5b('0x176')});db['MailQueueReport'][_0x4d5b('0x127')](db[_0x4d5b('0x72')],{'as':_0x4d5b('0x169'),'foreignKey':'ContactId'});db[_0x4d5b('0x48')]['belongsTo'](db[_0x4d5b('0x44')],{});db[_0x4d5b('0x48')][_0x4d5b('0x127')](db[_0x4d5b('0x46')],{});db[_0x4d5b('0x48')]['belongsTo'](db['User'],{});db[_0x4d5b('0x48')][_0x4d5b('0x127')](db[_0x4d5b('0x41')],{});db['Dashboard'][_0x4d5b('0x11a')](db[_0x4d5b('0x4c')],{'as':_0x4d5b('0x183'),'onDelete':_0x4d5b('0x117')});db[_0x4d5b('0x145')][_0x4d5b('0x11a')](db[_0x4d5b('0x82')],{'as':'Dispositions','foreignKey':'FaxAccountId','onDelete':_0x4d5b('0x117')});db[_0x4d5b('0x145')][_0x4d5b('0x11a')](db[_0x4d5b('0x80')],{'as':_0x4d5b('0x171'),'foreignKey':_0x4d5b('0x184')});db[_0x4d5b('0x145')]['hasMany'](db[_0x4d5b('0x123')],{'as':_0x4d5b('0x173')});db['FaxAccount'][_0x4d5b('0x11a')](db['FaxApplication'],{'as':_0x4d5b('0x150')});db[_0x4d5b('0x145')]['hasMany'](db[_0x4d5b('0x1a')],{'as':_0x4d5b('0x185'),'onDelete':_0x4d5b('0x117')});db[_0x4d5b('0x145')][_0x4d5b('0x11a')](db['FaxMessage'],{'as':_0x4d5b('0x172')});db[_0x4d5b('0x145')][_0x4d5b('0x127')](db[_0x4d5b('0x15a')],{'as':'Trunk'});db[_0x4d5b('0x145')][_0x4d5b('0x127')](db[_0x4d5b('0xf7')],{'as':_0x4d5b('0x175'),'foreignKey':_0x4d5b('0x176')});db[_0x4d5b('0x145')][_0x4d5b('0x127')](db['Pause'],{'as':_0x4d5b('0x15e'),'foreignKey':_0x4d5b('0x15f')});db[_0x4d5b('0x145')][_0x4d5b('0x129')](db[_0x4d5b('0x14')],{'as':_0x4d5b('0x160'),'through':'user_has_fax_accounts'});db[_0x4d5b('0x4e')][_0x4d5b('0x127')](db['User'],{'onDelete':_0x4d5b('0x16c')});db['FaxApplication']['belongsTo'](db[_0x4d5b('0x13d')],{'onDelete':'restrict'});db['FaxApplication'][_0x4d5b('0x127')](db[_0x4d5b('0x145')],{'onDelete':_0x4d5b('0x16c')});db[_0x4d5b('0x4e')][_0x4d5b('0x127')](db[_0x4d5b('0x8d')],{'onDelete':_0x4d5b('0x16c'),'foreignKey':_0x4d5b('0x182')});db['FaxInteraction'][_0x4d5b('0x11a')](db[_0x4d5b('0x186')],{'as':_0x4d5b('0x172'),'onDelete':_0x4d5b('0x117'),'foreignKey':_0x4d5b('0x187')});db[_0x4d5b('0x123')][_0x4d5b('0x127')](db[_0x4d5b('0x145')],{'as':_0x4d5b('0x180'),'foreignKey':_0x4d5b('0x184')});db[_0x4d5b('0x123')]['belongsTo'](db[_0x4d5b('0x72')],{'as':_0x4d5b('0x169'),'foreignKey':'ContactId'});db[_0x4d5b('0x123')][_0x4d5b('0x127')](db['User'],{'as':_0x4d5b('0x188'),'foreignKey':'UserId'});db['FaxInteraction'][_0x4d5b('0x129')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0x4d5b('0x17a')});db[_0x4d5b('0x123')]['belongsToMany'](db['Tag'],{'through':_0x4d5b('0x189'),'as':'ThroughTags'});db[_0x4d5b('0x123')][_0x4d5b('0x129')](db['User'],{'as':_0x4d5b('0x17d'),'through':_0x4d5b('0x134'),'foreignKey':'FaxInteractionId'});db[_0x4d5b('0x186')][_0x4d5b('0x127')](db['User'],{'onDelete':'cascade','as':_0x4d5b('0x14')});db[_0x4d5b('0x186')][_0x4d5b('0x127')](db[_0x4d5b('0x123')],{'as':'Interaction','foreignKey':_0x4d5b('0x187')});db[_0x4d5b('0x186')][_0x4d5b('0x127')](db['CmContact'],{'onDelete':'cascade','as':_0x4d5b('0x169')});db[_0x4d5b('0x186')][_0x4d5b('0x127')](db[_0x4d5b('0xec')],{'as':_0x4d5b('0xec'),'foreignKey':_0x4d5b('0x18a')});db[_0x4d5b('0x186')][_0x4d5b('0x127')](db['FaxAccount'],{'as':_0x4d5b('0x180'),'foreignKey':_0x4d5b('0x184')});db[_0x4d5b('0x13d')]['belongsToMany'](db['User'],{'as':_0x4d5b('0x160'),'through':_0x4d5b('0x38')});db['FaxQueue'][_0x4d5b('0x129')](db['Team'],{'through':_0x4d5b('0x18b'),'as':_0x4d5b('0x161')});db[_0x4d5b('0x53')][_0x4d5b('0x127')](db[_0x4d5b('0x145')],{});db[_0x4d5b('0x53')]['belongsTo'](db[_0x4d5b('0xf7')],{'as':_0x4d5b('0x175'),'foreignKey':_0x4d5b('0x176')});db['FaxQueueReport'][_0x4d5b('0x127')](db[_0x4d5b('0x72')],{'as':_0x4d5b('0x169'),'foreignKey':_0x4d5b('0x16a')});db['FaxQueueReport'][_0x4d5b('0x127')](db[_0x4d5b('0x123')],{});db['FaxQueueReport'][_0x4d5b('0x127')](db[_0x4d5b('0x186')],{});db[_0x4d5b('0x53')][_0x4d5b('0x127')](db['User'],{});db[_0x4d5b('0x53')]['belongsTo'](db[_0x4d5b('0x13d')],{});db['SmsAccount'][_0x4d5b('0x11a')](db[_0x4d5b('0x82')],{'as':_0x4d5b('0x170'),'foreignKey':'SmsAccountId','onDelete':_0x4d5b('0x117')});db[_0x4d5b('0x14a')][_0x4d5b('0x11a')](db[_0x4d5b('0x80')],{'as':_0x4d5b('0x171'),'foreignKey':'SmsAccountId'});db[_0x4d5b('0x14a')][_0x4d5b('0x11a')](db[_0x4d5b('0x18c')],{'as':'Messages','foreignKey':_0x4d5b('0x18d')});db[_0x4d5b('0x14a')][_0x4d5b('0x11a')](db[_0x4d5b('0x58')],{'as':_0x4d5b('0x173')});db[_0x4d5b('0x14a')][_0x4d5b('0x11a')](db[_0x4d5b('0x56')],{'as':_0x4d5b('0x150')});db['SmsAccount'][_0x4d5b('0x127')](db[_0x4d5b('0xf7')],{'as':_0x4d5b('0x175'),'foreignKey':_0x4d5b('0x176')});db['SmsAccount']['belongsTo'](db[_0x4d5b('0x87')],{'as':_0x4d5b('0x15e'),'foreignKey':_0x4d5b('0x15f')});db[_0x4d5b('0x14a')][_0x4d5b('0x129')](db[_0x4d5b('0x14')],{'as':_0x4d5b('0x160'),'through':_0x4d5b('0x14b')});db[_0x4d5b('0x56')][_0x4d5b('0x127')](db[_0x4d5b('0x14')],{'onDelete':'restrict'});db[_0x4d5b('0x56')]['belongsTo'](db['SmsQueue'],{'onDelete':_0x4d5b('0x16c')});db[_0x4d5b('0x56')][_0x4d5b('0x127')](db[_0x4d5b('0x14a')],{'onDelete':_0x4d5b('0x16c')});db[_0x4d5b('0x56')][_0x4d5b('0x127')](db[_0x4d5b('0x85')],{'onDelete':_0x4d5b('0x16c'),'foreignKey':_0x4d5b('0x15d')});db[_0x4d5b('0x56')][_0x4d5b('0x127')](db[_0x4d5b('0x8d')],{'onDelete':_0x4d5b('0x16c'),'foreignKey':_0x4d5b('0x182')});db['SmsInteraction']['hasMany'](db[_0x4d5b('0x18c')],{'as':_0x4d5b('0x172'),'onDelete':_0x4d5b('0x117'),'foreignKey':_0x4d5b('0x18e')});db[_0x4d5b('0x58')][_0x4d5b('0x127')](db[_0x4d5b('0x14a')],{'as':'Account','foreignKey':_0x4d5b('0x18d')});db[_0x4d5b('0x58')][_0x4d5b('0x127')](db[_0x4d5b('0x72')],{'as':'Contact','foreignKey':_0x4d5b('0x16a')});db['SmsInteraction'][_0x4d5b('0x127')](db[_0x4d5b('0x14')],{'as':_0x4d5b('0x188'),'foreignKey':_0x4d5b('0x119')});db[_0x4d5b('0x58')][_0x4d5b('0x129')](db[_0x4d5b('0x8d')],{'through':_0x4d5b('0x18f'),'as':_0x4d5b('0x17a')});db[_0x4d5b('0x58')][_0x4d5b('0x129')](db[_0x4d5b('0x8d')],{'through':_0x4d5b('0x18f'),'as':'ThroughTags'});db[_0x4d5b('0x58')]['belongsToMany'](db[_0x4d5b('0x14')],{'as':_0x4d5b('0x17d'),'through':_0x4d5b('0x135'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x4d5b('0x127')](db['User'],{'as':_0x4d5b('0x14')});db['SmsMessage'][_0x4d5b('0x127')](db[_0x4d5b('0x72')],{'onDelete':_0x4d5b('0x117'),'as':_0x4d5b('0x169')});db[_0x4d5b('0x18c')][_0x4d5b('0x127')](db['SmsInteraction'],{'onDelete':_0x4d5b('0x117'),'as':'Interaction','foreignKey':_0x4d5b('0x18e')});db['SmsMessage'][_0x4d5b('0x127')](db[_0x4d5b('0x14a')],{'as':_0x4d5b('0x180'),'foreignKey':_0x4d5b('0x18d')});db['SmsQueue'][_0x4d5b('0x129')](db['User'],{'as':_0x4d5b('0x160'),'through':_0x4d5b('0x140'),'foreignKey':_0x4d5b('0x190')});db[_0x4d5b('0x5a')][_0x4d5b('0x129')](db[_0x4d5b('0xe6')],{'through':_0x4d5b('0x191'),'as':_0x4d5b('0x161')});db[_0x4d5b('0x192')][_0x4d5b('0x11a')](db['Disposition'],{'as':_0x4d5b('0x170'),'foreignKey':_0x4d5b('0x193'),'onDelete':_0x4d5b('0x117')});db[_0x4d5b('0x192')][_0x4d5b('0x11a')](db[_0x4d5b('0x80')],{'as':'Answers','foreignKey':_0x4d5b('0x193')});db[_0x4d5b('0x192')][_0x4d5b('0x11a')](db['OpenchannelInteraction'],{'as':_0x4d5b('0x173'),'foreignKey':_0x4d5b('0x193')});db[_0x4d5b('0x192')][_0x4d5b('0x11a')](db[_0x4d5b('0x5f')],{'as':_0x4d5b('0x172'),'foreignKey':_0x4d5b('0x193')});db[_0x4d5b('0x192')]['hasMany'](db[_0x4d5b('0x5c')],{'as':'Applications','foreignKey':_0x4d5b('0x193')});db[_0x4d5b('0x192')][_0x4d5b('0x127')](db['CmList'],{'as':_0x4d5b('0x175'),'foreignKey':'ListId'});db[_0x4d5b('0x192')][_0x4d5b('0x127')](db[_0x4d5b('0x87')],{'as':_0x4d5b('0x15e'),'foreignKey':_0x4d5b('0x15f')});db[_0x4d5b('0x192')][_0x4d5b('0x129')](db[_0x4d5b('0x14')],{'as':_0x4d5b('0x160'),'through':'user_has_openchannel_accounts'});db[_0x4d5b('0x5c')]['belongsTo'](db[_0x4d5b('0x14')],{'onDelete':_0x4d5b('0x16c')});db[_0x4d5b('0x5c')]['belongsTo'](db[_0x4d5b('0x61')],{'onDelete':_0x4d5b('0x16c'),'foreignKey':_0x4d5b('0x194')});db[_0x4d5b('0x5c')][_0x4d5b('0x127')](db[_0x4d5b('0x192')],{'onDelete':_0x4d5b('0x16c'),'foreignKey':_0x4d5b('0x193')});db['OpenchannelApplication'][_0x4d5b('0x127')](db['Interval'],{'onDelete':_0x4d5b('0x16c'),'foreignKey':_0x4d5b('0x15d')});db[_0x4d5b('0x5c')][_0x4d5b('0x127')](db[_0x4d5b('0x8d')],{'onDelete':_0x4d5b('0x16c'),'foreignKey':_0x4d5b('0x182')});db['OpenchannelInteraction'][_0x4d5b('0x11a')](db['OpenchannelMessage'],{'as':_0x4d5b('0x172'),'onDelete':'cascade','foreignKey':_0x4d5b('0x195')});db['OpenchannelInteraction'][_0x4d5b('0x127')](db[_0x4d5b('0x192')],{'as':'Account','foreignKey':_0x4d5b('0x193')});db[_0x4d5b('0x5d')][_0x4d5b('0x127')](db['CmContact'],{'as':_0x4d5b('0x169'),'foreignKey':_0x4d5b('0x16a')});db['OpenchannelInteraction'][_0x4d5b('0x127')](db[_0x4d5b('0x14')],{'as':'Owner','foreignKey':_0x4d5b('0x119')});db[_0x4d5b('0x5d')][_0x4d5b('0x129')](db[_0x4d5b('0x8d')],{'through':_0x4d5b('0x196'),'as':_0x4d5b('0x17a')});db[_0x4d5b('0x5d')]['belongsToMany'](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x4d5b('0x17c')});db[_0x4d5b('0x5d')][_0x4d5b('0x129')](db[_0x4d5b('0x14')],{'as':_0x4d5b('0x17d'),'through':_0x4d5b('0x137'),'foreignKey':_0x4d5b('0x195')});db['OpenchannelMessage'][_0x4d5b('0x127')](db[_0x4d5b('0x14')],{'onDelete':_0x4d5b('0x117'),'as':_0x4d5b('0x14')});db[_0x4d5b('0x5f')][_0x4d5b('0x127')](db[_0x4d5b('0x72')],{'onDelete':_0x4d5b('0x117'),'as':_0x4d5b('0x169')});db[_0x4d5b('0x5f')]['belongsTo'](db[_0x4d5b('0x5d')],{'onDelete':_0x4d5b('0x117'),'as':_0x4d5b('0x17f'),'foreignKey':_0x4d5b('0x195')});db['OpenchannelMessage'][_0x4d5b('0x127')](db[_0x4d5b('0xec')],{'as':_0x4d5b('0xec'),'foreignKey':_0x4d5b('0x18a')});db[_0x4d5b('0x5f')][_0x4d5b('0x127')](db[_0x4d5b('0x192')],{'as':_0x4d5b('0x180'),'foreignKey':_0x4d5b('0x193')});db[_0x4d5b('0x61')]['belongsToMany'](db[_0x4d5b('0x14')],{'as':_0x4d5b('0x160'),'through':_0x4d5b('0x197'),'foreignKey':_0x4d5b('0x194')});db['OpenchannelQueue'][_0x4d5b('0x129')](db[_0x4d5b('0xe6')],{'through':_0x4d5b('0x198'),'as':'Teams'});db[_0x4d5b('0x62')][_0x4d5b('0x11a')](db[_0x4d5b('0x82')],{'as':_0x4d5b('0x170'),'foreignKey':_0x4d5b('0x181'),'onDelete':_0x4d5b('0x117')});db['ChatWebsite'][_0x4d5b('0x11a')](db[_0x4d5b('0x80')],{'as':_0x4d5b('0x171'),'foreignKey':'ChatWebsiteId'});db[_0x4d5b('0x62')]['hasMany'](db[_0x4d5b('0x6e')],{'as':_0x4d5b('0x199')});db[_0x4d5b('0x62')][_0x4d5b('0x11a')](db[_0x4d5b('0x120')],{'as':_0x4d5b('0x173')});db[_0x4d5b('0x62')]['hasMany'](db[_0x4d5b('0x65')],{'as':_0x4d5b('0x150')});db[_0x4d5b('0x62')][_0x4d5b('0x11a')](db['ChatMessage'],{'as':_0x4d5b('0x172')});db[_0x4d5b('0x62')][_0x4d5b('0x127')](db['CmList'],{'as':'List','foreignKey':_0x4d5b('0x176')});db['ChatWebsite'][_0x4d5b('0x127')](db['Interval'],{'as':_0x4d5b('0x85'),'foreignKey':_0x4d5b('0x15d')});db['ChatWebsite'][_0x4d5b('0x127')](db[_0x4d5b('0x3f')],{'as':_0x4d5b('0x3f'),'foreignKey':'MailAccountId'});db[_0x4d5b('0x62')][_0x4d5b('0x127')](db[_0x4d5b('0x87')],{'as':_0x4d5b('0x15e'),'foreignKey':_0x4d5b('0x15f')});db[_0x4d5b('0x62')][_0x4d5b('0x129')](db['User'],{'as':'Agents','through':'user_has_chat_websites'});db[_0x4d5b('0x63')][_0x4d5b('0x127')](db[_0x4d5b('0x192')],{});db[_0x4d5b('0x63')]['belongsTo'](db['CmList'],{'as':_0x4d5b('0x175'),'foreignKey':_0x4d5b('0x176')});db[_0x4d5b('0x63')][_0x4d5b('0x127')](db[_0x4d5b('0x72')],{'as':_0x4d5b('0x169'),'foreignKey':'ContactId'});db[_0x4d5b('0x63')][_0x4d5b('0x127')](db[_0x4d5b('0x5d')],{});db[_0x4d5b('0x63')][_0x4d5b('0x127')](db['OpenchannelMessage'],{});db[_0x4d5b('0x63')][_0x4d5b('0x127')](db['User'],{});db[_0x4d5b('0x63')]['belongsTo'](db[_0x4d5b('0x61')],{});db[_0x4d5b('0x65')]['belongsTo'](db[_0x4d5b('0x14')],{'as':_0x4d5b('0x19a'),'foreignKey':_0x4d5b('0x119'),'onDelete':'restrict'});db[_0x4d5b('0x65')][_0x4d5b('0x127')](db[_0x4d5b('0x6b')],{'as':_0x4d5b('0x19b'),'foreignKey':_0x4d5b('0x19c'),'onDelete':_0x4d5b('0x16c')});db[_0x4d5b('0x65')][_0x4d5b('0x127')](db[_0x4d5b('0x62')],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':_0x4d5b('0x16c')});db[_0x4d5b('0x65')][_0x4d5b('0x127')](db[_0x4d5b('0x8d')],{'onDelete':_0x4d5b('0x16c'),'foreignKey':_0x4d5b('0x182')});db['ChatInteraction'][_0x4d5b('0x11a')](db[_0x4d5b('0x19d')],{'as':_0x4d5b('0x172'),'onDelete':'cascade','foreignKey':_0x4d5b('0x19e')});db[_0x4d5b('0x120')][_0x4d5b('0x127')](db[_0x4d5b('0x62')],{'as':_0x4d5b('0x180'),'foreignKey':_0x4d5b('0x181')});db['ChatInteraction'][_0x4d5b('0x127')](db[_0x4d5b('0x72')],{'as':_0x4d5b('0x169'),'foreignKey':_0x4d5b('0x16a')});db[_0x4d5b('0x120')][_0x4d5b('0x127')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0x4d5b('0x120')][_0x4d5b('0x129')](db[_0x4d5b('0x8d')],{'through':_0x4d5b('0x19f'),'as':_0x4d5b('0x17a')});db[_0x4d5b('0x120')][_0x4d5b('0x129')](db[_0x4d5b('0x8d')],{'through':_0x4d5b('0x19f'),'as':_0x4d5b('0x17c')});db['ChatInteraction'][_0x4d5b('0x129')](db['User'],{'as':_0x4d5b('0x17d'),'through':_0x4d5b('0x133'),'foreignKey':_0x4d5b('0x19e')});db[_0x4d5b('0x19d')][_0x4d5b('0x127')](db[_0x4d5b('0x14')],{'onDelete':_0x4d5b('0x117'),'as':_0x4d5b('0x14')});db[_0x4d5b('0x19d')][_0x4d5b('0x127')](db[_0x4d5b('0x72')],{'onDelete':_0x4d5b('0x117'),'as':_0x4d5b('0x169'),'foreignKey':_0x4d5b('0x16a')});db['ChatMessage'][_0x4d5b('0x127')](db['ChatInteraction'],{'onDelete':_0x4d5b('0x117'),'as':_0x4d5b('0x17f'),'foreignKey':'ChatInteractionId'});db[_0x4d5b('0x19d')][_0x4d5b('0x127')](db[_0x4d5b('0xec')],{'as':_0x4d5b('0xec'),'foreignKey':'AttachmentId'});db[_0x4d5b('0x19d')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':_0x4d5b('0x181')});db[_0x4d5b('0x69')][_0x4d5b('0x11a')](db[_0x4d5b('0xec')],{'as':_0x4d5b('0x17e'),'foreignKey':_0x4d5b('0x1a0'),'onDelete':_0x4d5b('0x117'),'hooks':!![]});db[_0x4d5b('0x69')][_0x4d5b('0x127')](db['CmContact'],{'onDelete':_0x4d5b('0x117'),'as':_0x4d5b('0x169'),'foreignKey':'ContactId'});db['ChatOfflineMessage'][_0x4d5b('0x127')](db[_0x4d5b('0x62')],{'as':_0x4d5b('0x180'),'foreignKey':_0x4d5b('0x181')});db['ChatQueue']['belongsToMany'](db[_0x4d5b('0x14')],{'as':_0x4d5b('0x160'),'through':_0x4d5b('0x13c'),'hooks':!![]});db[_0x4d5b('0x6b')][_0x4d5b('0x129')](db['Team'],{'through':'team_has_chat_queues','as':_0x4d5b('0x161')});db[_0x4d5b('0x6c')][_0x4d5b('0x11a')](db[_0x4d5b('0xd4')],{'as':_0x4d5b('0x172'),'foreignKey':_0x4d5b('0x1a1'),'onDelete':'cascade'});db[_0x4d5b('0x6c')]['belongsToMany'](db['User'],{'as':'Members','through':_0x4d5b('0x12b')});db[_0x4d5b('0x6e')]['belongsTo'](db[_0x4d5b('0x62')],{'as':_0x4d5b('0x1a2'),'foreignKey':_0x4d5b('0x181')});db[_0x4d5b('0x70')][_0x4d5b('0x11a')](db['CmContact'],{'as':_0x4d5b('0x12c'),'foreignKey':_0x4d5b('0x1a3')});db[_0x4d5b('0x72')][_0x4d5b('0x11a')](db['CmContactHasItem'],{'as':_0x4d5b('0x1a4'),'foreignKey':_0x4d5b('0x1a5')});db['CmContact'][_0x4d5b('0x11a')](db[_0x4d5b('0x154')],{'as':_0x4d5b('0x155'),'foreignKey':_0x4d5b('0x16a')});db[_0x4d5b('0x72')]['hasMany'](db[_0x4d5b('0x75')],{'as':_0x4d5b('0x11e'),'foreignKey':_0x4d5b('0x16a')});db[_0x4d5b('0x72')][_0x4d5b('0x11a')](db[_0x4d5b('0x77')],{'as':_0x4d5b('0x156'),'foreignKey':'ContactId'});db[_0x4d5b('0x72')][_0x4d5b('0x11a')](db[_0x4d5b('0x79')],{'as':_0x4d5b('0x79'),'foreignKey':_0x4d5b('0x16a')});db['CmContact'][_0x4d5b('0x11a')](db[_0x4d5b('0x158')],{'as':_0x4d5b('0x159'),'foreignKey':'ContactId'});db[_0x4d5b('0x72')]['hasMany'](db[_0x4d5b('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x4d5b('0x16c')});db[_0x4d5b('0x72')][_0x4d5b('0x11a')](db[_0x4d5b('0x120')],{'as':_0x4d5b('0x121'),'foreignKey':_0x4d5b('0x16a'),'onDelete':_0x4d5b('0x16c')});db[_0x4d5b('0x72')][_0x4d5b('0x11a')](db[_0x4d5b('0x58')],{'as':_0x4d5b('0x122'),'foreignKey':_0x4d5b('0x16a'),'onDelete':_0x4d5b('0x16c')});db[_0x4d5b('0x72')][_0x4d5b('0x11a')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':_0x4d5b('0x16c')});db['CmContact']['hasMany'](db[_0x4d5b('0x44')],{'as':'MailInteractions','foreignKey':_0x4d5b('0x16a'),'onDelete':_0x4d5b('0x16c')});db['CmContact'][_0x4d5b('0x127')](db['CmCompany'],{'as':'Company','foreignKey':'CompanyId'});db['CmContact']['belongsTo'](db[_0x4d5b('0xf7')],{'as':_0x4d5b('0x175'),'foreignKey':_0x4d5b('0x176'),'onDelete':_0x4d5b('0x117')});db[_0x4d5b('0x72')][_0x4d5b('0x129')](db[_0x4d5b('0x14')],{'as':_0x4d5b('0x17d'),'through':_0x4d5b('0x12d')});db['CmContact']['belongsToMany'](db[_0x4d5b('0x8d')],{'as':_0x4d5b('0x17a'),'through':_0x4d5b('0x1a6')});db[_0x4d5b('0x72')]['belongsToMany'](db[_0x4d5b('0x8d')],{'through':_0x4d5b('0x1a6'),'as':_0x4d5b('0x17c')});db['CmHopper']['hasMany'](db[_0x4d5b('0x92')],{'as':_0x4d5b('0x1a7'),'foreignKey':'CmHopperId'});db[_0x4d5b('0x154')][_0x4d5b('0x127')](db[_0x4d5b('0x72')],{'as':_0x4d5b('0x169'),'foreignKey':'ContactId','onDelete':_0x4d5b('0x117')});db[_0x4d5b('0x154')]['belongsTo'](db[_0x4d5b('0xf7')],{'as':_0x4d5b('0x175'),'foreignKey':_0x4d5b('0x176'),'onDelete':_0x4d5b('0x117')});db[_0x4d5b('0x154')][_0x4d5b('0x127')](db[_0x4d5b('0x14')],{'as':_0x4d5b('0x19a'),'foreignKey':'UserId'});db[_0x4d5b('0x154')]['belongsTo'](db[_0x4d5b('0x1e')],{'as':'Queue','foreignKey':_0x4d5b('0x153'),'onDelete':'cascade'});db[_0x4d5b('0x154')][_0x4d5b('0x127')](db[_0x4d5b('0xe8')],{'as':_0x4d5b('0xe8'),'foreignKey':_0x4d5b('0x1a8'),'onDelete':_0x4d5b('0x117')});db[_0x4d5b('0x154')][_0x4d5b('0x127')](db[_0x4d5b('0x14')],{'as':'Owner','foreignKey':_0x4d5b('0x1a9')});db[_0x4d5b('0x74')]['belongsTo'](db[_0x4d5b('0x72')],{'as':_0x4d5b('0x169'),'foreignKey':'ContactId','onDelete':_0x4d5b('0x117')});db['CmHopperBlack'][_0x4d5b('0x127')](db[_0x4d5b('0xf7')],{'as':_0x4d5b('0x175'),'foreignKey':_0x4d5b('0x176'),'onDelete':'cascade'});db[_0x4d5b('0x74')][_0x4d5b('0x127')](db['VoiceQueue'],{'as':_0x4d5b('0x19b'),'foreignKey':_0x4d5b('0x153'),'onDelete':'cascade'});db[_0x4d5b('0x74')]['belongsTo'](db[_0x4d5b('0xe8')],{'as':_0x4d5b('0xe8'),'foreignKey':'CampaignId','onDelete':_0x4d5b('0x117')});db[_0x4d5b('0x7e')][_0x4d5b('0x11a')](db[_0x4d5b('0x84')],{'as':{'plural':_0x4d5b('0x1aa'),'singular':'OneAll'},'foreignKey':_0x4d5b('0x1ab'),'onDelete':_0x4d5b('0x117'),'hooks':!![]});db['Automation'][_0x4d5b('0x11a')](db[_0x4d5b('0x84')],{'as':{'plural':'Any','singular':_0x4d5b('0x1ac')},'foreignKey':_0x4d5b('0x1ad'),'onDelete':_0x4d5b('0x117'),'hooks':!![]});db['Automation']['hasMany'](db[_0x4d5b('0x7d')],{'as':_0x4d5b('0x1ae'),'foreignKey':_0x4d5b('0x1af'),'onDelete':_0x4d5b('0x117'),'hooks':!![]});db[_0x4d5b('0x82')]['hasMany'](db[_0x4d5b('0x82')],{'as':_0x4d5b('0x170'),'foreignKey':'ParentId','onDelete':_0x4d5b('0x117')});db[_0x4d5b('0x85')][_0x4d5b('0x11a')](db[_0x4d5b('0x85')],{'as':'Intervals','foreignKey':_0x4d5b('0x15d'),'onDelete':_0x4d5b('0x117'),'hooks':!![],'required':![]});db[_0x4d5b('0x85')][_0x4d5b('0x11a')](db['VoiceExtension'],{'as':_0x4d5b('0x11d'),'foreignKey':_0x4d5b('0x15d'),'onDelete':_0x4d5b('0x16c')});db[_0x4d5b('0x85')][_0x4d5b('0x11a')](db[_0x4d5b('0x174')],{'as':_0x4d5b('0x1b0'),'foreignKey':_0x4d5b('0x15d')});db[_0x4d5b('0x85')]['hasMany'](db[_0x4d5b('0x65')],{'as':_0x4d5b('0x1b1'),'foreignKey':'IntervalId'});db[_0x4d5b('0x85')][_0x4d5b('0x11a')](db['FaxApplication'],{'as':_0x4d5b('0x1b2'),'foreignKey':'IntervalId'});db[_0x4d5b('0x85')][_0x4d5b('0x11a')](db[_0x4d5b('0x56')],{'as':_0x4d5b('0x1b3'),'foreignKey':_0x4d5b('0x15d')});db['Schedule'][_0x4d5b('0x127')](db[_0x4d5b('0x3f')],{});db[_0x4d5b('0x8c')][_0x4d5b('0x127')](db[_0x4d5b('0x9e')],{'foreignKey':'DefaultReportId'});db[_0x4d5b('0x8c')][_0x4d5b('0x127')](db[_0x4d5b('0x9c')],{'foreignKey':_0x4d5b('0x1b4')});db[_0x4d5b('0x1b5')][_0x4d5b('0x129')](db[_0x4d5b('0x1c')],{'as':_0x4d5b('0x1b6'),'through':_0x4d5b('0x152'),'onDelete':_0x4d5b('0x16c')});db['Tag'][_0x4d5b('0x129')](db[_0x4d5b('0x72')],{'through':_0x4d5b('0x1a6')});db['Tag']['belongsToMany'](db['ChatInteraction'],{'through':_0x4d5b('0x19f')});db[_0x4d5b('0x8d')][_0x4d5b('0x129')](db[_0x4d5b('0x44')],{'through':_0x4d5b('0x17b')});db[_0x4d5b('0x8d')][_0x4d5b('0x129')](db[_0x4d5b('0x58')],{'through':'sms_interaction_has_tags'});db[_0x4d5b('0x8d')][_0x4d5b('0x129')](db[_0x4d5b('0x123')],{'through':_0x4d5b('0x189')});db[_0x4d5b('0x8d')][_0x4d5b('0x129')](db['OpenchannelInteraction'],{'through':_0x4d5b('0x196')});db[_0x4d5b('0x8d')][_0x4d5b('0x129')](db['WhatsappInteraction'],{'through':_0x4d5b('0x1b7')});db['CmContactHasItem']['belongsTo'](db[_0x4d5b('0x8f')],{'as':_0x4d5b('0x1b8'),'foreignKey':_0x4d5b('0x1b9')});db[_0x4d5b('0x92')][_0x4d5b('0x127')](db[_0x4d5b('0x154')],{'as':_0x4d5b('0x1ba'),'foreignKey':_0x4d5b('0x1bb')});db[_0x4d5b('0x91')][_0x4d5b('0x127')](db[_0x4d5b('0x72')],{'as':'Contact','foreignKey':_0x4d5b('0x1a5')});db['Trigger']['hasMany'](db[_0x4d5b('0x84')],{'as':{'plural':_0x4d5b('0x1bc'),'singular':'AllCondition'},'foreignKey':_0x4d5b('0x1bd'),'onDelete':_0x4d5b('0x117'),'hooks':!![]});db[_0x4d5b('0x96')][_0x4d5b('0x11a')](db[_0x4d5b('0x84')],{'as':{'plural':_0x4d5b('0x1be'),'singular':'AnyCondition'},'foreignKey':_0x4d5b('0x1bf'),'onDelete':_0x4d5b('0x117'),'hooks':!![]});db[_0x4d5b('0x96')][_0x4d5b('0x11a')](db[_0x4d5b('0x7d')],{'as':_0x4d5b('0x1ae'),'foreignKey':_0x4d5b('0x1c0'),'onDelete':_0x4d5b('0x117'),'hooks':!![]});db['AnalyticCustomReport'][_0x4d5b('0x11a')](db[_0x4d5b('0x1c1')],{'as':_0x4d5b('0x1c2'),'onDelete':_0x4d5b('0x117'),'foreignKey':_0x4d5b('0x1b4'),'hooks':!![]});db[_0x4d5b('0x9e')][_0x4d5b('0x11a')](db['AnalyticFieldReport'],{'as':_0x4d5b('0x1c2'),'onDelete':_0x4d5b('0x117'),'foreignKey':_0x4d5b('0x1c3')});db[_0x4d5b('0xa1')][_0x4d5b('0x11a')](db[_0x4d5b('0x1c1')],{'as':_0x4d5b('0x1c2'),'onDelete':_0x4d5b('0x117'),'foreignKey':_0x4d5b('0x1c4')});db['AnalyticFieldReport'][_0x4d5b('0x127')](db[_0x4d5b('0xa1')],{'foreignKey':_0x4d5b('0x1c4')});db[_0x4d5b('0xa5')][_0x4d5b('0x11a')](db[_0x4d5b('0xa7')],{'as':'Configurations','onDelete':_0x4d5b('0x117'),'foreignKey':_0x4d5b('0x1c5')});db[_0x4d5b('0xa7')][_0x4d5b('0x11a')](db[_0x4d5b('0xa8')],{'as':_0x4d5b('0x1c6'),'onDelete':_0x4d5b('0x117'),'foreignKey':_0x4d5b('0x1c7')});db[_0x4d5b('0xa7')][_0x4d5b('0x11a')](db[_0x4d5b('0xa8')],{'as':_0x4d5b('0x1c8'),'onDelete':_0x4d5b('0x117'),'foreignKey':'DescriptionId'});db[_0x4d5b('0xa7')][_0x4d5b('0x11a')](db[_0x4d5b('0xa8')],{'as':'Fields','onDelete':_0x4d5b('0x117'),'foreignKey':_0x4d5b('0x1c9')});db[_0x4d5b('0xa7')][_0x4d5b('0x127')](db[_0x4d5b('0xa5')],{'as':'Account','foreignKey':_0x4d5b('0x1c5')});db[_0x4d5b('0xa8')][_0x4d5b('0x11a')](db[_0x4d5b('0xa8')],{'as':_0x4d5b('0x1ca'),'foreignKey':_0x4d5b('0x1c7')});db[_0x4d5b('0xa8')][_0x4d5b('0x11a')](db['SalesforceField'],{'as':_0x4d5b('0x1cb'),'foreignKey':_0x4d5b('0x1cc')});db['SalesforceField'][_0x4d5b('0x11a')](db[_0x4d5b('0xa8')],{'as':'Field','foreignKey':_0x4d5b('0x1c9')});db[_0x4d5b('0xa8')][_0x4d5b('0x127')](db['Variable'],{'as':_0x4d5b('0x97'),'foreignKey':_0x4d5b('0x1cd')});db[_0x4d5b('0xaa')][_0x4d5b('0x11a')](db[_0x4d5b('0x1ce')],{'as':_0x4d5b('0x1cf'),'onDelete':_0x4d5b('0x117'),'foreignKey':_0x4d5b('0x1c5')});db[_0x4d5b('0x1ce')]['hasMany'](db[_0x4d5b('0xad')],{'as':_0x4d5b('0x1c6'),'onDelete':'cascade','foreignKey':_0x4d5b('0x1c7')});db[_0x4d5b('0x1ce')][_0x4d5b('0x11a')](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0x4d5b('0x117'),'foreignKey':'DescriptionId'});db[_0x4d5b('0x1ce')][_0x4d5b('0x11a')](db[_0x4d5b('0xad')],{'as':_0x4d5b('0x1c2'),'onDelete':'cascade','foreignKey':_0x4d5b('0x1c9')});db[_0x4d5b('0x1ce')][_0x4d5b('0x127')](db[_0x4d5b('0xaa')],{'as':_0x4d5b('0x180'),'foreignKey':'AccountId'});db[_0x4d5b('0xad')][_0x4d5b('0x11a')](db[_0x4d5b('0xad')],{'as':_0x4d5b('0x1ca'),'foreignKey':'SubjectId'});db[_0x4d5b('0xad')]['hasMany'](db[_0x4d5b('0xad')],{'as':_0x4d5b('0x1cb'),'foreignKey':_0x4d5b('0x1cc')});db[_0x4d5b('0xad')]['hasMany'](db[_0x4d5b('0xad')],{'as':_0x4d5b('0x1d0'),'foreignKey':_0x4d5b('0x1c9')});db['SugarcrmField'][_0x4d5b('0x127')](db[_0x4d5b('0x97')],{'as':'Variable','foreignKey':'VariableId'});db[_0x4d5b('0x1d1')][_0x4d5b('0x11a')](db[_0x4d5b('0xaf')],{'as':_0x4d5b('0x1cf'),'onDelete':_0x4d5b('0x117'),'foreignKey':_0x4d5b('0x1c5')});db[_0x4d5b('0xaf')][_0x4d5b('0x11a')](db[_0x4d5b('0xb0')],{'as':'Subjects','onDelete':_0x4d5b('0x117'),'foreignKey':_0x4d5b('0x1c7')});db[_0x4d5b('0xaf')][_0x4d5b('0x11a')](db[_0x4d5b('0xb0')],{'as':_0x4d5b('0x1c8'),'onDelete':'cascade','foreignKey':_0x4d5b('0x1cc')});db['DeskConfiguration'][_0x4d5b('0x11a')](db[_0x4d5b('0xb0')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x4d5b('0x1c9')});db[_0x4d5b('0xaf')][_0x4d5b('0x127')](db['DeskAccount'],{'as':'Account','foreignKey':_0x4d5b('0x1c5')});db[_0x4d5b('0xaf')][_0x4d5b('0x129')](db[_0x4d5b('0x8d')],{'through':_0x4d5b('0x1d2')});db[_0x4d5b('0xb0')][_0x4d5b('0x11a')](db[_0x4d5b('0xb0')],{'as':_0x4d5b('0x1ca'),'foreignKey':_0x4d5b('0x1c7')});db[_0x4d5b('0xb0')][_0x4d5b('0x11a')](db[_0x4d5b('0xb0')],{'as':_0x4d5b('0x1cb'),'foreignKey':_0x4d5b('0x1cc')});db[_0x4d5b('0xb0')][_0x4d5b('0x11a')](db[_0x4d5b('0xb0')],{'as':_0x4d5b('0x1d0'),'foreignKey':'FieldId'});db[_0x4d5b('0xb0')][_0x4d5b('0x127')](db[_0x4d5b('0x97')],{'as':'Variable','foreignKey':'VariableId'});db[_0x4d5b('0x1d3')][_0x4d5b('0x11a')](db[_0x4d5b('0xb3')],{'as':_0x4d5b('0x1cf'),'onDelete':_0x4d5b('0x117'),'foreignKey':'AccountId'});db[_0x4d5b('0xb3')][_0x4d5b('0x11a')](db[_0x4d5b('0xb5')],{'as':_0x4d5b('0x1c6'),'onDelete':_0x4d5b('0x117'),'foreignKey':_0x4d5b('0x1c7')});db['ZohoConfiguration'][_0x4d5b('0x11a')](db[_0x4d5b('0xb5')],{'as':_0x4d5b('0x1c8'),'onDelete':_0x4d5b('0x117'),'foreignKey':_0x4d5b('0x1cc')});db[_0x4d5b('0xb3')][_0x4d5b('0x11a')](db['ZohoField'],{'as':_0x4d5b('0x1c2'),'onDelete':_0x4d5b('0x117'),'foreignKey':_0x4d5b('0x1c9')});db[_0x4d5b('0xb3')]['belongsTo'](db['ZohoAccount'],{'as':_0x4d5b('0x180'),'foreignKey':'AccountId'});db[_0x4d5b('0xb5')][_0x4d5b('0x11a')](db[_0x4d5b('0xb5')],{'as':_0x4d5b('0x1ca'),'foreignKey':_0x4d5b('0x1c7')});db['ZohoField'][_0x4d5b('0x11a')](db['ZohoField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x4d5b('0xb5')]['hasMany'](db[_0x4d5b('0xb5')],{'as':'Field','foreignKey':'FieldId'});db[_0x4d5b('0xb5')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x4d5b('0xb7')][_0x4d5b('0x11a')](db[_0x4d5b('0xb9')],{'as':_0x4d5b('0x1cf'),'onDelete':_0x4d5b('0x117'),'foreignKey':_0x4d5b('0x1c5')});db[_0x4d5b('0xb9')][_0x4d5b('0x11a')](db['ZendeskField'],{'as':_0x4d5b('0x1c6'),'foreignKey':_0x4d5b('0x1c7')});db[_0x4d5b('0xb9')][_0x4d5b('0x11a')](db[_0x4d5b('0xba')],{'as':_0x4d5b('0x1c8'),'foreignKey':'DescriptionId'});db['ZendeskConfiguration']['hasMany'](db[_0x4d5b('0xba')],{'as':'Fields','foreignKey':_0x4d5b('0x1c9')});db['ZendeskConfiguration'][_0x4d5b('0x127')](db[_0x4d5b('0xb7')],{'as':_0x4d5b('0x180'),'foreignKey':_0x4d5b('0x1c5')});db['ZendeskConfiguration'][_0x4d5b('0x129')](db['Tag'],{'through':_0x4d5b('0x1d4')});db['ZendeskField']['hasMany'](db['ZendeskField'],{'as':_0x4d5b('0x1ca'),'foreignKey':_0x4d5b('0x1c7')});db[_0x4d5b('0xba')]['hasMany'](db[_0x4d5b('0xba')],{'as':_0x4d5b('0x1cb'),'foreignKey':'DescriptionId'});db[_0x4d5b('0xba')][_0x4d5b('0x11a')](db[_0x4d5b('0xba')],{'as':_0x4d5b('0x1d0'),'foreignKey':'FieldId'});db[_0x4d5b('0xba')][_0x4d5b('0x127')](db[_0x4d5b('0x97')],{'as':_0x4d5b('0x97'),'foreignKey':'VariableId'});db[_0x4d5b('0x1d5')][_0x4d5b('0x11a')](db[_0x4d5b('0xbc')],{'as':_0x4d5b('0x1cf'),'onDelete':_0x4d5b('0x117'),'foreignKey':'AccountId'});db[_0x4d5b('0xbc')][_0x4d5b('0x11a')](db[_0x4d5b('0xbe')],{'as':_0x4d5b('0x1c6'),'onDelete':_0x4d5b('0x117'),'foreignKey':_0x4d5b('0x1c7')});db[_0x4d5b('0xbc')][_0x4d5b('0x11a')](db[_0x4d5b('0xbe')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x4d5b('0xbc')]['hasMany'](db[_0x4d5b('0xbe')],{'as':_0x4d5b('0x1c2'),'onDelete':'cascade','foreignKey':_0x4d5b('0x1c9')});db[_0x4d5b('0xbc')][_0x4d5b('0x127')](db[_0x4d5b('0x1d5')],{'as':'Account','foreignKey':'AccountId'});db[_0x4d5b('0xbc')][_0x4d5b('0x129')](db[_0x4d5b('0x8d')],{'through':_0x4d5b('0x1d6')});db[_0x4d5b('0xbe')][_0x4d5b('0x11a')](db['FreshdeskField'],{'as':_0x4d5b('0x1ca'),'foreignKey':'SubjectId'});db[_0x4d5b('0xbe')][_0x4d5b('0x11a')](db[_0x4d5b('0xbe')],{'as':_0x4d5b('0x1cb'),'foreignKey':_0x4d5b('0x1cc')});db[_0x4d5b('0xbe')][_0x4d5b('0x11a')](db[_0x4d5b('0xbe')],{'as':_0x4d5b('0x1d0'),'foreignKey':_0x4d5b('0x1c9')});db[_0x4d5b('0xbe')][_0x4d5b('0x127')](db[_0x4d5b('0x97')],{'as':_0x4d5b('0x97'),'foreignKey':'VariableId'});db[_0x4d5b('0xc0')][_0x4d5b('0x11a')](db[_0x4d5b('0x1d7')],{'as':_0x4d5b('0x1cf'),'onDelete':_0x4d5b('0x117'),'foreignKey':_0x4d5b('0x1c5')});db[_0x4d5b('0x1d7')]['hasMany'](db[_0x4d5b('0xc2')],{'as':_0x4d5b('0x1c6'),'foreignKey':_0x4d5b('0x1c7')});db['VtigerConfiguration'][_0x4d5b('0x11a')](db['VtigerField'],{'as':_0x4d5b('0x1c8'),'foreignKey':_0x4d5b('0x1cc')});db['VtigerConfiguration']['hasMany'](db[_0x4d5b('0xc2')],{'as':'Fields','foreignKey':_0x4d5b('0x1c9')});db[_0x4d5b('0x1d7')][_0x4d5b('0x127')](db[_0x4d5b('0xc0')],{'as':_0x4d5b('0x180'),'foreignKey':'AccountId'});db[_0x4d5b('0xc2')][_0x4d5b('0x11a')](db[_0x4d5b('0xc2')],{'as':'Subject','foreignKey':_0x4d5b('0x1c7')});db[_0x4d5b('0xc2')][_0x4d5b('0x11a')](db['VtigerField'],{'as':_0x4d5b('0x1cb'),'foreignKey':_0x4d5b('0x1cc')});db[_0x4d5b('0xc2')][_0x4d5b('0x11a')](db['VtigerField'],{'as':_0x4d5b('0x1d0'),'foreignKey':_0x4d5b('0x1c9')});db['VtigerField']['belongsTo'](db[_0x4d5b('0x97')],{'as':'Variable','foreignKey':_0x4d5b('0x1cd')});db['ServicenowAccount']['hasMany'](db['ServicenowConfiguration'],{'as':_0x4d5b('0x1cf'),'onDelete':'cascade','foreignKey':_0x4d5b('0x1c5')});db[_0x4d5b('0xc5')][_0x4d5b('0x11a')](db[_0x4d5b('0xc6')],{'as':_0x4d5b('0x1c6'),'foreignKey':_0x4d5b('0x1c7')});db[_0x4d5b('0xc5')][_0x4d5b('0x11a')](db[_0x4d5b('0xc6')],{'as':_0x4d5b('0x1c8'),'foreignKey':_0x4d5b('0x1cc')});db[_0x4d5b('0xc5')][_0x4d5b('0x11a')](db[_0x4d5b('0xc6')],{'as':_0x4d5b('0x1c2'),'foreignKey':'FieldId'});db[_0x4d5b('0xc5')]['belongsTo'](db[_0x4d5b('0xc4')],{'as':_0x4d5b('0x180'),'foreignKey':_0x4d5b('0x1c5')});db[_0x4d5b('0xc6')][_0x4d5b('0x11a')](db[_0x4d5b('0xc6')],{'as':'Subject','foreignKey':_0x4d5b('0x1c7')});db[_0x4d5b('0xc6')][_0x4d5b('0x11a')](db[_0x4d5b('0xc6')],{'as':_0x4d5b('0x1cb'),'foreignKey':_0x4d5b('0x1cc')});db['ServicenowField'][_0x4d5b('0x11a')](db[_0x4d5b('0xc6')],{'as':_0x4d5b('0x1d0'),'foreignKey':_0x4d5b('0x1c9')});db[_0x4d5b('0xc6')]['belongsTo'](db['Variable'],{'as':_0x4d5b('0x97'),'foreignKey':_0x4d5b('0x1cd')});db[_0x4d5b('0x1d8')][_0x4d5b('0x11a')](db['Dynamics365Configuration'],{'as':_0x4d5b('0x1cf'),'onDelete':_0x4d5b('0x117'),'foreignKey':'AccountId'});db[_0x4d5b('0x1d8')][_0x4d5b('0x127')](db[_0x4d5b('0x10c')],{'as':_0x4d5b('0x10c'),'foreignKey':_0x4d5b('0x16d')});db[_0x4d5b('0xc8')]['hasMany'](db['Dynamics365Field'],{'as':_0x4d5b('0x1c6'),'onDelete':_0x4d5b('0x117'),'foreignKey':_0x4d5b('0x1c7')});db[_0x4d5b('0xc8')]['hasMany'](db[_0x4d5b('0xca')],{'as':'Descriptions','onDelete':_0x4d5b('0x117'),'foreignKey':'DescriptionId'});db[_0x4d5b('0xc8')][_0x4d5b('0x11a')](db[_0x4d5b('0xca')],{'as':_0x4d5b('0x1c2'),'onDelete':_0x4d5b('0x117'),'foreignKey':_0x4d5b('0x1c9')});db[_0x4d5b('0xc8')][_0x4d5b('0x127')](db[_0x4d5b('0x1d8')],{'as':'Account','foreignKey':'AccountId'});db['Dynamics365Field']['hasMany'](db[_0x4d5b('0xca')],{'as':_0x4d5b('0x1ca'),'foreignKey':_0x4d5b('0x1c7')});db['Dynamics365Field']['hasMany'](db[_0x4d5b('0xca')],{'as':_0x4d5b('0x1cb'),'foreignKey':_0x4d5b('0x1cc')});db['Dynamics365Field'][_0x4d5b('0x11a')](db[_0x4d5b('0xca')],{'as':'Field','foreignKey':'FieldId'});db['Dynamics365Field']['belongsTo'](db[_0x4d5b('0x97')],{'as':'Variable','foreignKey':_0x4d5b('0x1cd')});db['FreshsalesAccount'][_0x4d5b('0x11a')](db[_0x4d5b('0xcd')],{'as':_0x4d5b('0x1cf'),'onDelete':_0x4d5b('0x117'),'foreignKey':'AccountId'});db[_0x4d5b('0xcd')][_0x4d5b('0x11a')](db[_0x4d5b('0xce')],{'as':_0x4d5b('0x1c6'),'foreignKey':'SubjectId'});db[_0x4d5b('0xcd')][_0x4d5b('0x11a')](db[_0x4d5b('0xce')],{'as':_0x4d5b('0x1c8'),'foreignKey':'DescriptionId'});db[_0x4d5b('0xcd')][_0x4d5b('0x11a')](db['FreshsalesField'],{'as':_0x4d5b('0x1c2'),'foreignKey':_0x4d5b('0x1c9')});db['FreshsalesConfiguration'][_0x4d5b('0x127')](db[_0x4d5b('0xcb')],{'as':'Account','foreignKey':'AccountId'});db[_0x4d5b('0xce')][_0x4d5b('0x11a')](db[_0x4d5b('0xce')],{'as':_0x4d5b('0x1ca'),'foreignKey':_0x4d5b('0x1c7')});db[_0x4d5b('0xce')]['hasMany'](db[_0x4d5b('0xce')],{'as':_0x4d5b('0x1cb'),'foreignKey':_0x4d5b('0x1cc')});db[_0x4d5b('0xce')][_0x4d5b('0x11a')](db[_0x4d5b('0xce')],{'as':'Field','foreignKey':_0x4d5b('0x1c9')});db[_0x4d5b('0xce')][_0x4d5b('0x127')](db[_0x4d5b('0x97')],{'as':_0x4d5b('0x97'),'foreignKey':_0x4d5b('0x1cd')});db['ChatQueueReport'][_0x4d5b('0x127')](db['ChatWebsite'],{});db[_0x4d5b('0xd2')]['belongsTo'](db[_0x4d5b('0xf7')],{'as':_0x4d5b('0x175'),'foreignKey':_0x4d5b('0x176')});db[_0x4d5b('0xd2')][_0x4d5b('0x127')](db[_0x4d5b('0x72')],{'as':_0x4d5b('0x169'),'foreignKey':'ContactId'});db[_0x4d5b('0xd2')][_0x4d5b('0x127')](db[_0x4d5b('0x120')],{});db[_0x4d5b('0xd2')][_0x4d5b('0x127')](db[_0x4d5b('0x19d')],{});db[_0x4d5b('0xd2')][_0x4d5b('0x127')](db[_0x4d5b('0x14')],{});db[_0x4d5b('0xd2')][_0x4d5b('0x127')](db['ChatQueue'],{});db[_0x4d5b('0xd4')][_0x4d5b('0x127')](db[_0x4d5b('0x14')],{'onDelete':_0x4d5b('0x117'),'foreignKey':'FromId'});db[_0x4d5b('0xd4')][_0x4d5b('0x127')](db[_0x4d5b('0x14')],{'onDelete':_0x4d5b('0x117'),'foreignKey':'ToId'});db[_0x4d5b('0x158')]['hasMany'](db[_0x4d5b('0xd7')],{'foreignKey':_0x4d5b('0x1d9'),'onDelete':_0x4d5b('0x117')});db[_0x4d5b('0x158')][_0x4d5b('0x11a')](db['JscriptyAnswerReport'],{'foreignKey':_0x4d5b('0x1d9'),'onDelete':_0x4d5b('0x117')});db[_0x4d5b('0xda')][_0x4d5b('0x127')](db[_0x4d5b('0x14a')],{});db['SmsQueueReport'][_0x4d5b('0x127')](db[_0x4d5b('0xf7')],{'as':_0x4d5b('0x175'),'foreignKey':_0x4d5b('0x176')});db[_0x4d5b('0xda')][_0x4d5b('0x127')](db[_0x4d5b('0x72')],{'as':_0x4d5b('0x169'),'foreignKey':'ContactId'});db[_0x4d5b('0xda')]['belongsTo'](db[_0x4d5b('0x58')],{});db['SmsQueueReport']['belongsTo'](db[_0x4d5b('0x18c')],{});db[_0x4d5b('0xda')]['belongsTo'](db[_0x4d5b('0x14')],{});db[_0x4d5b('0xda')]['belongsTo'](db[_0x4d5b('0x5a')],{});db[_0x4d5b('0x1da')]['hasMany'](db['JscriptySessionReport'],{'foreignKey':_0x4d5b('0x1db')});db[_0x4d5b('0x1da')][_0x4d5b('0x11a')](db['JscriptyQuestionReport'],{'foreignKey':_0x4d5b('0x1db')});db[_0x4d5b('0x1da')][_0x4d5b('0x11a')](db[_0x4d5b('0xd5')],{'foreignKey':'ProjectId'});db['Team']['belongsToMany'](db[_0x4d5b('0x14')],{'as':'Agents','through':'user_has_teams'});db[_0x4d5b('0xe6')]['belongsToMany'](db[_0x4d5b('0x1e')],{'through':'TeamVoiceQueue','as':_0x4d5b('0x139')});db[_0x4d5b('0xe6')][_0x4d5b('0x129')](db[_0x4d5b('0x41')],{'through':'team_has_mail_queues','as':_0x4d5b('0x13b')});db['Team'][_0x4d5b('0x129')](db[_0x4d5b('0x6b')],{'through':'team_has_chat_queues','as':_0x4d5b('0x1dc')});db[_0x4d5b('0xe6')]['belongsToMany'](db['FaxQueue'],{'through':_0x4d5b('0x18b'),'as':_0x4d5b('0x13e')});db[_0x4d5b('0xe6')][_0x4d5b('0x129')](db[_0x4d5b('0x5a')],{'through':_0x4d5b('0x191'),'as':_0x4d5b('0x13f')});db[_0x4d5b('0xe6')][_0x4d5b('0x129')](db[_0x4d5b('0x61')],{'through':_0x4d5b('0x198'),'as':'OpenchannelQueues'});db[_0x4d5b('0xe6')][_0x4d5b('0x129')](db[_0x4d5b('0x10a')],{'through':_0x4d5b('0x1dd'),'as':_0x4d5b('0x142')});db[_0x4d5b('0xe6')][_0x4d5b('0x129')](db[_0x4d5b('0x13a')],{'through':'TeamVoicePrefix','as':'VoicePrefixes'});db[_0x4d5b('0xe8')][_0x4d5b('0x11a')](db[_0x4d5b('0x154')],{'as':_0x4d5b('0x155'),'foreignKey':_0x4d5b('0x1a8')});db[_0x4d5b('0xe8')][_0x4d5b('0x11a')](db[_0x4d5b('0x75')],{'as':'HopperFinals','foreignKey':_0x4d5b('0x1a8')});db['Campaign']['hasMany'](db[_0x4d5b('0x77')],{'as':_0x4d5b('0x156'),'foreignKey':_0x4d5b('0x1a8')});db[_0x4d5b('0xe8')][_0x4d5b('0x11a')](db[_0x4d5b('0x74')],{'as':_0x4d5b('0x157'),'foreignKey':_0x4d5b('0x1a8')});db['Campaign'][_0x4d5b('0x127')](db[_0x4d5b('0x15a')],{'as':_0x4d5b('0x15a'),'foreignKey':_0x4d5b('0x15b')});db[_0x4d5b('0xe8')][_0x4d5b('0x127')](db[_0x4d5b('0x15a')],{'as':'TrunkBackup','foreignKey':_0x4d5b('0x15c')});db[_0x4d5b('0xe8')]['belongsTo'](db['Interval'],{'as':_0x4d5b('0x85'),'foreignKey':_0x4d5b('0x15d')});db[_0x4d5b('0xe8')][_0x4d5b('0x127')](db[_0x4d5b('0xe3')],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0x4d5b('0xe8')][_0x4d5b('0x129')](db['CmList'],{'as':_0x4d5b('0x12e'),'through':_0x4d5b('0x1de')});db[_0x4d5b('0xe8')][_0x4d5b('0x129')](db[_0x4d5b('0xf7')],{'as':_0x4d5b('0x162'),'through':'campaigns_has_cm_blacklists'});db[_0x4d5b('0xec')][_0x4d5b('0x127')](db['ChatOfflineMessage'],{'as':_0x4d5b('0x69'),'foreignKey':_0x4d5b('0x1a0')});db[_0x4d5b('0xef')][_0x4d5b('0x127')](db[_0x4d5b('0x46')],{});db[_0x4d5b('0xef')][_0x4d5b('0x127')](db[_0x4d5b('0x44')],{});db[_0x4d5b('0xef')][_0x4d5b('0x127')](db['MailAccount'],{'foreignKey':_0x4d5b('0x1df'),'as':_0x4d5b('0x1e0')});db['MailTransferReport'][_0x4d5b('0x127')](db[_0x4d5b('0x14')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x4d5b('0xef')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0x4d5b('0x1e1')});db[_0x4d5b('0xef')]['belongsTo'](db['MailQueue'],{'foreignKey':_0x4d5b('0x1e2'),'as':_0x4d5b('0x1e3')});db[_0x4d5b('0xef')][_0x4d5b('0x127')](db[_0x4d5b('0x3f')],{'foreignKey':_0x4d5b('0x1e4'),'as':'ToAccount'});db[_0x4d5b('0x1e5')][_0x4d5b('0x127')](db[_0x4d5b('0x19d')],{});db[_0x4d5b('0x1e5')][_0x4d5b('0x127')](db[_0x4d5b('0x120')],{});db[_0x4d5b('0x1e5')][_0x4d5b('0x127')](db['ChatWebsite'],{'foreignKey':_0x4d5b('0x1e6'),'as':'FromAccount'});db['ChatTransferReport']['belongsTo'](db[_0x4d5b('0x14')],{'foreignKey':_0x4d5b('0x1e7'),'as':'FromAgent'});db[_0x4d5b('0x1e5')]['belongsTo'](db[_0x4d5b('0x14')],{'foreignKey':_0x4d5b('0x1e8'),'as':_0x4d5b('0x1e1')});db[_0x4d5b('0x1e5')][_0x4d5b('0x127')](db[_0x4d5b('0x6b')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db['ChatTransferReport'][_0x4d5b('0x127')](db['ChatWebsite'],{'foreignKey':_0x4d5b('0x1e9'),'as':_0x4d5b('0x1ea')});db[_0x4d5b('0xf2')][_0x4d5b('0x127')](db[_0x4d5b('0x186')],{});db[_0x4d5b('0xf2')][_0x4d5b('0x127')](db[_0x4d5b('0x123')],{});db[_0x4d5b('0xf2')][_0x4d5b('0x127')](db[_0x4d5b('0x145')],{'foreignKey':_0x4d5b('0x1eb'),'as':_0x4d5b('0x1e0')});db[_0x4d5b('0xf2')][_0x4d5b('0x127')](db['User'],{'foreignKey':_0x4d5b('0x1e7'),'as':_0x4d5b('0x1ec')});db['FaxTransferReport']['belongsTo'](db[_0x4d5b('0x14')],{'foreignKey':_0x4d5b('0x1e8'),'as':_0x4d5b('0x1e1')});db[_0x4d5b('0xf2')][_0x4d5b('0x127')](db[_0x4d5b('0x13d')],{'foreignKey':_0x4d5b('0x1ed'),'as':_0x4d5b('0x1e3')});db[_0x4d5b('0xf2')]['belongsTo'](db[_0x4d5b('0x145')],{'foreignKey':_0x4d5b('0x1ee'),'as':'ToAccount'});db[_0x4d5b('0xf4')][_0x4d5b('0x127')](db[_0x4d5b('0x5f')],{});db[_0x4d5b('0xf4')]['belongsTo'](db[_0x4d5b('0x5d')],{});db[_0x4d5b('0xf4')][_0x4d5b('0x127')](db['OpenchannelAccount'],{'foreignKey':_0x4d5b('0x1ef'),'as':_0x4d5b('0x1e0')});db[_0x4d5b('0xf4')][_0x4d5b('0x127')](db[_0x4d5b('0x14')],{'foreignKey':_0x4d5b('0x1e7'),'as':_0x4d5b('0x1ec')});db[_0x4d5b('0xf4')][_0x4d5b('0x127')](db[_0x4d5b('0x14')],{'foreignKey':_0x4d5b('0x1e8'),'as':_0x4d5b('0x1e1')});db[_0x4d5b('0xf4')][_0x4d5b('0x127')](db[_0x4d5b('0x61')],{'foreignKey':_0x4d5b('0x1f0'),'as':_0x4d5b('0x1e3')});db[_0x4d5b('0xf4')][_0x4d5b('0x127')](db[_0x4d5b('0x192')],{'foreignKey':_0x4d5b('0x1f1'),'as':_0x4d5b('0x1ea')});db[_0x4d5b('0xf5')][_0x4d5b('0x127')](db[_0x4d5b('0x18c')],{});db[_0x4d5b('0xf5')][_0x4d5b('0x127')](db['SmsInteraction'],{});db[_0x4d5b('0xf5')][_0x4d5b('0x127')](db['SmsAccount'],{'foreignKey':_0x4d5b('0x1f2'),'as':_0x4d5b('0x1e0')});db[_0x4d5b('0xf5')][_0x4d5b('0x127')](db[_0x4d5b('0x14')],{'foreignKey':_0x4d5b('0x1e7'),'as':_0x4d5b('0x1ec')});db[_0x4d5b('0xf5')][_0x4d5b('0x127')](db['User'],{'foreignKey':_0x4d5b('0x1e8'),'as':_0x4d5b('0x1e1')});db[_0x4d5b('0xf5')][_0x4d5b('0x127')](db[_0x4d5b('0x5a')],{'foreignKey':'ToSmsQueueId','as':_0x4d5b('0x1e3')});db[_0x4d5b('0xf5')]['belongsTo'](db[_0x4d5b('0x14a')],{'foreignKey':_0x4d5b('0x1f3'),'as':_0x4d5b('0x1ea')});db[_0x4d5b('0xf7')][_0x4d5b('0x11a')](db['Disposition'],{'as':_0x4d5b('0x170'),'foreignKey':_0x4d5b('0x176'),'onDelete':'cascade'});db[_0x4d5b('0xf7')][_0x4d5b('0x11a')](db[_0x4d5b('0x7b')],{'as':_0x4d5b('0x1f4'),'foreignKey':_0x4d5b('0x176')});db['CmList'][_0x4d5b('0x11a')](db[_0x4d5b('0x72')],{'as':'Contacts','onDelete':_0x4d5b('0x117'),'foreignKey':_0x4d5b('0x176')});db[_0x4d5b('0xf7')]['hasMany'](db[_0x4d5b('0x75')],{'as':_0x4d5b('0x11e'),'foreignKey':_0x4d5b('0x176')});db[_0x4d5b('0xf7')][_0x4d5b('0x11a')](db['CmHopperHistory'],{'as':_0x4d5b('0x11f'),'foreignKey':_0x4d5b('0x176')});db[_0x4d5b('0xf7')][_0x4d5b('0x11a')](db['ReportAgentPreview'],{'as':_0x4d5b('0x79'),'foreignKey':'ListId'});db[_0x4d5b('0xf7')][_0x4d5b('0x129')](db[_0x4d5b('0x1e')],{'as':_0x4d5b('0x1f5'),'through':_0x4d5b('0x1f6')});db[_0x4d5b('0xf7')]['belongsToMany'](db[_0x4d5b('0x14')],{'as':'Agents','through':_0x4d5b('0x12f')});db[_0x4d5b('0x13a')][_0x4d5b('0x11a')](db[_0x4d5b('0x1a')],{'as':'Extensions','onDelete':_0x4d5b('0x117')});db[_0x4d5b('0x13a')][_0x4d5b('0x129')](db[_0x4d5b('0x14')],{'as':_0x4d5b('0x160'),'through':'UserVoicePrefix'});db[_0x4d5b('0x13a')][_0x4d5b('0x129')](db[_0x4d5b('0xe6')],{'through':'TeamVoicePrefix','as':_0x4d5b('0x161')});db[_0x4d5b('0xfa')][_0x4d5b('0x11a')](db[_0x4d5b('0x14')],{'as':_0x4d5b('0x17d'),'foreignKey':'userProfileId'});db[_0x4d5b('0xfa')][_0x4d5b('0x11a')](db['UserProfileSection'],{'as':_0x4d5b('0x1f7'),'foreignKey':'userProfileId','onDelete':_0x4d5b('0x117')});db[_0x4d5b('0xfc')][_0x4d5b('0x11a')](db[_0x4d5b('0xfd')],{'as':_0x4d5b('0x1f8'),'foreignKey':_0x4d5b('0x1f9'),'onDelete':_0x4d5b('0x117')});db[_0x4d5b('0x101')]['hasMany'](db[_0x4d5b('0x82')],{'as':_0x4d5b('0x170'),'foreignKey':'WhatsappAccountId','onDelete':_0x4d5b('0x117')});db['WhatsappAccount']['hasMany'](db[_0x4d5b('0x80')],{'as':_0x4d5b('0x171'),'foreignKey':_0x4d5b('0x1fa')});db[_0x4d5b('0x101')][_0x4d5b('0x11a')](db['WhatsappMessage'],{'as':'Messages','foreignKey':_0x4d5b('0x1fa')});db['WhatsappAccount'][_0x4d5b('0x11a')](db[_0x4d5b('0x103')],{'as':_0x4d5b('0x173')});db['WhatsappAccount'][_0x4d5b('0x11a')](db[_0x4d5b('0x102')],{'as':_0x4d5b('0x150')});db[_0x4d5b('0x101')][_0x4d5b('0x127')](db[_0x4d5b('0xf7')],{'as':_0x4d5b('0x175'),'foreignKey':_0x4d5b('0x176')});db[_0x4d5b('0x101')]['belongsTo'](db[_0x4d5b('0x87')],{'as':_0x4d5b('0x15e'),'foreignKey':_0x4d5b('0x15f')});db['WhatsappAccount'][_0x4d5b('0x129')](db[_0x4d5b('0x14')],{'as':_0x4d5b('0x160'),'through':_0x4d5b('0x14d')});db['WhatsappApplication'][_0x4d5b('0x127')](db['User'],{'onDelete':_0x4d5b('0x16c')});db[_0x4d5b('0x102')][_0x4d5b('0x127')](db['WhatsappQueue'],{'onDelete':_0x4d5b('0x16c')});db[_0x4d5b('0x102')]['belongsTo'](db[_0x4d5b('0x101')],{'onDelete':'restrict'});db[_0x4d5b('0x102')][_0x4d5b('0x127')](db[_0x4d5b('0x85')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['WhatsappApplication'][_0x4d5b('0x127')](db[_0x4d5b('0x8d')],{'onDelete':_0x4d5b('0x16c'),'foreignKey':_0x4d5b('0x182')});db['WhatsappInteraction'][_0x4d5b('0x11a')](db[_0x4d5b('0x105')],{'as':_0x4d5b('0x172'),'onDelete':_0x4d5b('0x117'),'foreignKey':'WhatsappInteractionId'});db[_0x4d5b('0x103')][_0x4d5b('0x127')](db[_0x4d5b('0x101')],{'as':_0x4d5b('0x180'),'foreignKey':'WhatsappAccountId'});db[_0x4d5b('0x103')][_0x4d5b('0x127')](db[_0x4d5b('0x72')],{'as':'Contact','foreignKey':'ContactId'});db[_0x4d5b('0x103')][_0x4d5b('0x127')](db[_0x4d5b('0x14')],{'as':_0x4d5b('0x188'),'foreignKey':_0x4d5b('0x119')});db['WhatsappInteraction']['belongsToMany'](db[_0x4d5b('0x8d')],{'through':_0x4d5b('0x1b7'),'as':_0x4d5b('0x17a')});db[_0x4d5b('0x103')][_0x4d5b('0x129')](db[_0x4d5b('0x8d')],{'through':'whatsapp_interaction_has_tags','as':_0x4d5b('0x17c')});db[_0x4d5b('0x103')][_0x4d5b('0x129')](db[_0x4d5b('0x14')],{'as':_0x4d5b('0x17d'),'through':'user_has_whatsapp_interactions','foreignKey':_0x4d5b('0x1fb')});db['WhatsappMessage'][_0x4d5b('0x127')](db[_0x4d5b('0x14')],{'as':_0x4d5b('0x14')});db[_0x4d5b('0x105')]['belongsTo'](db['CmContact'],{'onDelete':_0x4d5b('0x117'),'as':_0x4d5b('0x169')});db['WhatsappMessage'][_0x4d5b('0x127')](db[_0x4d5b('0x103')],{'onDelete':_0x4d5b('0x117'),'as':'Interaction','foreignKey':_0x4d5b('0x1fb')});db[_0x4d5b('0x105')]['belongsTo'](db[_0x4d5b('0x101')],{'as':'Account','foreignKey':_0x4d5b('0x1fa')});db['WhatsappQueueReport'][_0x4d5b('0x127')](db['WhatsappAccount'],{});db[_0x4d5b('0x106')][_0x4d5b('0x127')](db[_0x4d5b('0xf7')],{'as':_0x4d5b('0x175'),'foreignKey':_0x4d5b('0x176')});db[_0x4d5b('0x106')][_0x4d5b('0x127')](db[_0x4d5b('0x72')],{'as':'Contact','foreignKey':'ContactId'});db[_0x4d5b('0x106')]['belongsTo'](db[_0x4d5b('0x103')],{});db[_0x4d5b('0x106')]['belongsTo'](db[_0x4d5b('0x10a')],{});db['WhatsappQueueReport'][_0x4d5b('0x127')](db[_0x4d5b('0x105')],{});db[_0x4d5b('0x106')]['belongsTo'](db[_0x4d5b('0x14')],{});db[_0x4d5b('0x108')][_0x4d5b('0x127')](db[_0x4d5b('0x105')],{});db[_0x4d5b('0x108')][_0x4d5b('0x127')](db[_0x4d5b('0x103')],{});db[_0x4d5b('0x108')][_0x4d5b('0x127')](db[_0x4d5b('0x101')],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db[_0x4d5b('0x108')][_0x4d5b('0x127')](db[_0x4d5b('0x101')],{'foreignKey':_0x4d5b('0x1fc'),'as':'ToAccount'});db[_0x4d5b('0x108')][_0x4d5b('0x127')](db[_0x4d5b('0x10a')],{'foreignKey':_0x4d5b('0x1fd'),'as':'ToQueue'});db[_0x4d5b('0x108')][_0x4d5b('0x127')](db[_0x4d5b('0x14')],{'foreignKey':'FromUserId','as':_0x4d5b('0x1ec')});db[_0x4d5b('0x108')][_0x4d5b('0x127')](db[_0x4d5b('0x14')],{'foreignKey':_0x4d5b('0x1e8'),'as':_0x4d5b('0x1e1')});db['WhatsappQueue'][_0x4d5b('0x129')](db['User'],{'as':'Agents','through':_0x4d5b('0x3a'),'foreignKey':'WhatsappQueueId'});db[_0x4d5b('0x10a')]['belongsToMany'](db['Team'],{'through':_0x4d5b('0x1dd'),'as':_0x4d5b('0x161')});db['UserSetting'][_0x4d5b('0x127')](db[_0x4d5b('0x14')],{'as':_0x4d5b('0x1fe'),'foreignKey':_0x4d5b('0x119'),'onDelete':'cascade','hooks':!![]});db[_0x4d5b('0x10c')][_0x4d5b('0x115')](db[_0x4d5b('0x1d8')],{'as':_0x4d5b('0x1d8'),'onDelete':_0x4d5b('0x16c')});db[_0x4d5b('0x10c')]['hasOne'](db[_0x4d5b('0x3c')],{'as':_0x4d5b('0x16e'),'onDelete':_0x4d5b('0x16c')});db[_0x4d5b('0x10c')][_0x4d5b('0x115')](db[_0x4d5b('0x3d')],{'as':_0x4d5b('0x16f'),'onDelete':_0x4d5b('0x16c')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x7e0a=['../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserChatQueue','UserMailQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerConfiguration/intVtigerConfiguration.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/jscriptyProject/jscriptyProject.model','../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','Campaign','../api/campaign/campaign.model','Attachment','../api/attachment/attachment.model','Plugin','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','VoiceMail','UserId','userSetting','cascade','hasMany','Recordings','VoiceQueuesRt','Extensions','OpenchannelInteraction','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','WhatsappInteractions','UserNotification','SenderId','belongsToMany','Groups','chat_group_has_users','cm_user_has_contacts','Lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','MailQueue','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','cm_user_has_lists','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','VoiceContext','Applications','VoiceMusicOnHold','Sound','moh_has_sounds','Members','VoiceQueueId','Hoppers','CmHopperFinal','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessions','Trunk','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','Agents','Team','Teams','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceMailMessage','QueueCalls','uniqueid','ContactId','MailAccountId','restrict','CloudProviderId','Imap','Disposition','Dispositions','Answers','List','ListId','TemplateId','mandatoryDispositionPause','mandatoryDispositionPauseId','team_has_mail_queues','Contact','Owner','mail_interaction_has_tags','Tags','Users','MailInteractionId','Attachments','Interaction','Account','ChatWebsite','TagId','Dashboard','Items','FaxAccountId','Interactions','Exntensions','fax_interaction_has_tags','ThroughTags','FaxInteractionId','AttachmentId','UserFaxQueue','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','UserOpenchannelQueue','team_has_openchannel_queues','ChatWebsiteId','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','ChatOfflineMessageId','ChatGroupId','Contacts','CompanyId','Phones','CmContactId','MailInteractions','cm_contact_has_tags','AdditionalPhones','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Action','Actions','ParentId','Intervals','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','AnalyticFieldReport','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Configurations','Field','VariableId','int_desk_configuration_has_tags','ZohoField','ZohoAccount','FreshdeskConfiguration','VtigerConfiguration','VtigerField','ServicenowField','Dynamics365Configuration','FreshsalesConfiguration','FreshsalesAccount','ToId','JscriptyQuestionReport','SessionId','ProjectId','JscriptyProject','team_has_whatsapp_queues','WhatsappQueues','HopperFinals','TrunkId','BlackLists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAccount','ToUserId','ToChatQueueId','ToChatWebsiteId','FromUserId','ToFaxQueueId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','voice_queues_has_cm_lists','UserVoicePrefix','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappMessage','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','Smtp','exports','../config/environment','lodash','jstz','determine','sequelize','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8_general_ci','sequelizeHistory','defaultsDeep','motion2','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceContext/voiceContext.model','VoiceExtension'];(function(_0x4709c8,_0x3384ca){var _0x478cdd=function(_0x5193ce){while(--_0x5193ce){_0x4709c8['push'](_0x4709c8['shift']());}};_0x478cdd(++_0x3384ca);}(_0x7e0a,0x1eb));var _0xa7e0=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7e0a[_0x4b369d];return _0x571a98;};'use strict';var config=require(_0xa7e0('0x0'));var Sequelize=require('sequelize');var _=require(_0xa7e0('0x1'));var jstz=require(_0xa7e0('0x2'));var timezone=jstz[_0xa7e0('0x3')]();config[_0xa7e0('0x4')]=_['defaultsDeep'](config['sequelize'],{'database':'motion2','username':_0xa7e0('0x5'),'password':_0xa7e0('0x6'),'options':{'host':_0xa7e0('0x7'),'port':0xcea,'dialect':_0xa7e0('0x8'),'dialectOptions':{'charset':_0xa7e0('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0xa7e0('0xa')}}});config[_0xa7e0('0xb')]=_[_0xa7e0('0xc')](config[_0xa7e0('0xb')],{'database':_0xa7e0('0xd'),'username':_0xa7e0('0x5'),'password':'xC@LL1234','options':{'host':_0xa7e0('0x7'),'port':0xcea,'dialect':_0xa7e0('0x8'),'dialectOptions':{'charset':_0xa7e0('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xa7e0('0x4')][_0xa7e0('0xe')],config[_0xa7e0('0x4')][_0xa7e0('0xf')],config[_0xa7e0('0x4')][_0xa7e0('0x10')],config['sequelize'][_0xa7e0('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xa7e0('0xb')]['database'],config[_0xa7e0('0xb')][_0xa7e0('0xf')],config[_0xa7e0('0xb')][_0xa7e0('0x10')],config[_0xa7e0('0xb')]['options'])};db[_0xa7e0('0x12')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x14'));db[_0xa7e0('0x15')]=db['sequelize'][_0xa7e0('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x16'));db[_0xa7e0('0x17')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0x18'));db['VoiceMusicOnHold']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x19'));db[_0xa7e0('0x1a')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x1b'));db[_0xa7e0('0x1c')]=db['sequelize'][_0xa7e0('0x13')]('../api/voiceRecording/voiceRecording.model');db[_0xa7e0('0x1d')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x1e'));db['VoiceMail']=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x1f'));db[_0xa7e0('0x20')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x21'));db['VoiceDialReport']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x22'));db[_0xa7e0('0x23')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/voiceAgentReport/voiceAgentReport.model');db['VoiceQueueReport']=db[_0xa7e0('0x4')]['import']('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x24'));db['Trunk']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x25'));db[_0xa7e0('0x26')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x27'));db[_0xa7e0('0x28')]=db['sequelize']['import'](_0xa7e0('0x29'));db['UserVoiceQueue']=db[_0xa7e0('0x4')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db[_0xa7e0('0x2a')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/userChatQueue/userChatQueue.model');db[_0xa7e0('0x2b')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0x2c'));db[_0xa7e0('0x2d')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x2e'));db['UserOpenchannelQueue']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x2f'));db[_0xa7e0('0x30')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0x31'));db[_0xa7e0('0x32')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x33'));db[_0xa7e0('0x34')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x35'));db[_0xa7e0('0x36')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x37'));db['MailQueue']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x38'));db[_0xa7e0('0x39')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x3a'));db[_0xa7e0('0x3b')]=db[_0xa7e0('0x4')]['import']('../api/mailInteraction/mailInteraction.model');db[_0xa7e0('0x3c')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x3d'));db[_0xa7e0('0x3e')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x3f'));db[_0xa7e0('0x40')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x41'));db['Dashboard']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x42'));db[_0xa7e0('0x43')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x44'));db[_0xa7e0('0x45')]=db['sequelize'][_0xa7e0('0x13')]('../api/faxAccount/faxAccount.model');db[_0xa7e0('0x46')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x47'));db[_0xa7e0('0x48')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x49'));db[_0xa7e0('0x4a')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x4b'));db[_0xa7e0('0x4c')]=db[_0xa7e0('0x4')]['import']('../api/faxQueue/faxQueue.model');db[_0xa7e0('0x4d')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/faxQueueReport/faxQueueReport.model');db[_0xa7e0('0x4e')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x4f'));db[_0xa7e0('0x50')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x51'));db[_0xa7e0('0x52')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x53'));db[_0xa7e0('0x54')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0x55'));db[_0xa7e0('0x56')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x57'));db[_0xa7e0('0x58')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x59'));db[_0xa7e0('0x5a')]=db[_0xa7e0('0x4')]['import']('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x5b'));db[_0xa7e0('0x5c')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x5d'));db[_0xa7e0('0x5e')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x5f'));db['ChatWebsite']=db[_0xa7e0('0x4')]['import']('../api/chatWebsite/chatWebsite.model');db[_0xa7e0('0x60')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0x61'));db[_0xa7e0('0x62')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x63'));db['ChatInteraction']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x64'));db[_0xa7e0('0x65')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/chatMessage/chatMessage.model');db[_0xa7e0('0x66')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x67'));db[_0xa7e0('0x68')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x69'));db[_0xa7e0('0x6a')]=db['sequelize'][_0xa7e0('0x13')]('../api/chatGroup/chatGroup.model');db[_0xa7e0('0x6b')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0xa7e0('0x6c')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x6d'));db[_0xa7e0('0x6e')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x6f'));db[_0xa7e0('0x70')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x71'));db['CmHopperBlack']=db['sequelize']['import'](_0xa7e0('0x72'));db['CmHopperFinal']=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0xa7e0('0x73')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0xa7e0('0x74')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0x75'));db[_0xa7e0('0x76')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x77'));db['Action']=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0x78'));db[_0xa7e0('0x79')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x7a'));db[_0xa7e0('0x7b')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x7c'));db['Disposition']=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/disposition/disposition.model');db[_0xa7e0('0x7d')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x7e'));db[_0xa7e0('0x7f')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/interval/interval.model');db[_0xa7e0('0x80')]=db['sequelize']['import'](_0xa7e0('0x81'));db[_0xa7e0('0x82')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x83'));db[_0xa7e0('0x84')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0xa7e0('0x85')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0x86'));db['Sound']=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x87'));db[_0xa7e0('0x88')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x89'));db[_0xa7e0('0x8a')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x8b'));db[_0xa7e0('0x8c')]=db[_0xa7e0('0x4')]['import']('../api/cmContactHasItem/cmContactHasItem.model');db[_0xa7e0('0x8d')]=db['sequelize']['import'](_0xa7e0('0x8e'));db[_0xa7e0('0x8f')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x90'));db[_0xa7e0('0x91')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0x92'));db[_0xa7e0('0x93')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x94'));db['Integration']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x95'));db['IntegrationReport']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x96'));db[_0xa7e0('0x97')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0xa7e0('0x98')]=db['sequelize']['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xa7e0('0x99')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x9a'));db[_0xa7e0('0x9b')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0x9c'));db['AnalyticFieldReport']=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x9d'));db[_0xa7e0('0x9e')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x9f'));db[_0xa7e0('0xa0')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xa1'));db[_0xa7e0('0xa2')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/intSalesforceField/intSalesforceField.model');db[_0xa7e0('0xa3')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xa4'));db[_0xa7e0('0xa5')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xa6'));db[_0xa7e0('0xa7')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xa8'));db[_0xa7e0('0xa9')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xaa'));db[_0xa7e0('0xab')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xac'));db[_0xa7e0('0xad')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xae'));db['ZohoAccount']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xaf'));db[_0xa7e0('0xb0')]=db['sequelize'][_0xa7e0('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0xb1'));db[_0xa7e0('0xb2')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xb3'));db[_0xa7e0('0xb4')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xa7e0('0xb5')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0xb6'));db[_0xa7e0('0xb7')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xb8'));db['FreshdeskConfiguration']=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0xb9'));db[_0xa7e0('0xba')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0xbb'));db[_0xa7e0('0xbc')]=db[_0xa7e0('0x4')]['import']('../api/intVtigerAccount/intVtigerAccount.model');db['VtigerConfiguration']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xbd'));db['VtigerField']=db[_0xa7e0('0x4')]['import']('../api/intVtigerField/intVtigerField.model');db[_0xa7e0('0xbe')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0xa7e0('0xbf')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xc0'));db['ServicenowField']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xc1'));db[_0xa7e0('0xc2')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xc3'));db['Dynamics365Configuration']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xc4'));db[_0xa7e0('0xc5')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xc6'));db['FreshsalesAccount']=db[_0xa7e0('0x4')]['import'](_0xa7e0('0xc7'));db['FreshsalesConfiguration']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xc8'));db[_0xa7e0('0xc9')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0xca'));db[_0xa7e0('0xcb')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x95'));db[_0xa7e0('0xcc')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xcd'));db[_0xa7e0('0xce')]=db['sequelize']['import']('../api/chatQueueReport/chatQueueReport.model');db[_0xa7e0('0xcf')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0xd0'));db[_0xa7e0('0xd1')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xd2'));db['JscriptyQuestionReport']=db['sequelize']['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xa7e0('0xd3')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xd4'));db[_0xa7e0('0xd5')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0xd6'));db[_0xa7e0('0xd7')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xd8'));db['SquareDetailsReport']=db['sequelize'][_0xa7e0('0x13')]('../api/squareReportDetail/squareReportDetail.model');db['JscriptyProject']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xd9'));db['Setting']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xda'));db[_0xa7e0('0xdb')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xdc'));db[_0xa7e0('0xdd')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xde'));db[_0xa7e0('0xdf')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0xe0'));db[_0xa7e0('0xe1')]=db['sequelize']['import'](_0xa7e0('0xe2'));db['Team']=db[_0xa7e0('0x4')]['import']('../api/team/team.model');db[_0xa7e0('0xe3')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xe4'));db[_0xa7e0('0xe5')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0xe6'));db['Migration']=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/migration/migration.model');db[_0xa7e0('0xe7')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0xe8'));db[_0xa7e0('0xe9')]=db['sequelize'][_0xa7e0('0x13')]('../api/plugin/plugin.model');db['MailTransferReport']=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/mailTransferReport/mailTransferReport.model');db[_0xa7e0('0xea')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xeb'));db[_0xa7e0('0xec')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0xed'));db[_0xa7e0('0xee')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xef'));db['SmsTransferReport']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xf0'));db[_0xa7e0('0xf1')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0xf2'));db[_0xa7e0('0xf3')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xf4'));db[_0xa7e0('0xf5')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/userProfile/userProfile.model');db[_0xa7e0('0xf6')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xf7'));db[_0xa7e0('0xf8')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/userProfileResource/userProfileResource.model');db['UserNotification']=db['sequelize'][_0xa7e0('0x13')]('../api/userNotification/userNotification.model');db[_0xa7e0('0xf9')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xfa'));db['WhatsappApplication']=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0xfb'));db[_0xa7e0('0xfc')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xfd'));db['WhatsappMessage']=db['sequelize']['import'](_0xa7e0('0xfe'));db[_0xa7e0('0xff')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x100'));db[_0xa7e0('0x101')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x102'));db[_0xa7e0('0x103')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x104'));db[_0xa7e0('0x105')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/cloudProvider/cloudProvider.model');db[_0xa7e0('0x106')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x107'));db[_0xa7e0('0x108')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x109'));db['UserVoicePrefix']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x10a'));db[_0xa7e0('0x10b')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x10c'));db[_0xa7e0('0x12')][_0xa7e0('0x10d')](db[_0xa7e0('0x10e')],{'as':_0xa7e0('0x10e'),'onDelete':'cascade','foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x12')]['hasOne'](db[_0xa7e0('0x10b')],{'as':_0xa7e0('0x110'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x12')][_0xa7e0('0x112')](db[_0xa7e0('0x1c')],{'as':_0xa7e0('0x113'),'foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x12')][_0xa7e0('0x112')](db['UserVoiceQueueRt'],{'as':_0xa7e0('0x114'),'foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x12')][_0xa7e0('0x112')](db[_0xa7e0('0x17')],{'as':_0xa7e0('0x115'),'onDelete':_0xa7e0('0x111'),'hooks':!![]});db[_0xa7e0('0x12')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'UserId'});db[_0xa7e0('0x12')][_0xa7e0('0x112')](db[_0xa7e0('0x73')],{'as':'HopperHistory','foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x12')][_0xa7e0('0x112')](db[_0xa7e0('0x74')],{'as':_0xa7e0('0x74'),'foreignKey':'UserId'});db['User'][_0xa7e0('0x112')](db[_0xa7e0('0x116')],{'as':_0xa7e0('0x117'),'foreignKey':'UserId'});db[_0xa7e0('0x12')][_0xa7e0('0x112')](db[_0xa7e0('0x118')],{'as':_0xa7e0('0x119'),'foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x12')][_0xa7e0('0x112')](db[_0xa7e0('0x52')],{'as':_0xa7e0('0x11a'),'foreignKey':'UserId'});db['User'][_0xa7e0('0x112')](db[_0xa7e0('0x48')],{'as':_0xa7e0('0x11b'),'foreignKey':_0xa7e0('0x10f')});db['User']['hasMany'](db[_0xa7e0('0x3b')],{'as':'MailInteractions','foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x12')]['hasMany'](db[_0xa7e0('0xfc')],{'as':_0xa7e0('0x11c'),'foreignKey':'UserId'});db[_0xa7e0('0x12')]['hasMany'](db[_0xa7e0('0x11d')],{'as':'UserNotifications','foreignKey':_0xa7e0('0x11e')});db['User']['belongsTo'](db[_0xa7e0('0xf5')],{'as':_0xa7e0('0xf5'),'foreignKey':'userProfileId'});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0x6a')],{'as':_0xa7e0('0x120'),'through':_0xa7e0('0x121')});db['User']['belongsToMany'](db['CmContact'],{'as':'Contacts','through':_0xa7e0('0x122')});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db['CmList'],{'as':_0xa7e0('0x123'),'through':'cm_user_has_lists'});db[_0xa7e0('0x12')]['belongsToMany'](db['Team'],{'through':_0xa7e0('0x124')});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db['MailInteraction'],{'as':'MailInteractions','through':_0xa7e0('0x125')});db[_0xa7e0('0x12')]['belongsToMany'](db[_0xa7e0('0x118')],{'as':_0xa7e0('0x119'),'through':_0xa7e0('0x126')});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0x48')],{'as':_0xa7e0('0x11b'),'through':_0xa7e0('0x127')});db['User']['belongsToMany'](db['SmsInteraction'],{'as':_0xa7e0('0x11a'),'through':'user_has_sms_interactions'});db[_0xa7e0('0x12')]['belongsToMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db['WhatsappInteraction'],{'as':_0xa7e0('0x11c'),'through':_0xa7e0('0x128')});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0x1a')],{'as':_0xa7e0('0x129'),'through':_0xa7e0('0x12a'),'required':![]});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0xf3')],{'as':_0xa7e0('0x12b'),'through':'UserVoicePrefix','required':![]});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0x12c')],{'as':_0xa7e0('0x12d'),'through':_0xa7e0('0x2b'),'required':![]});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0x68')],{'as':_0xa7e0('0x12e'),'through':_0xa7e0('0x2a'),'required':![],'hooks':!![]});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0x4c')],{'as':_0xa7e0('0x12f'),'through':'UserFaxQueue','required':![]});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db['SmsQueue'],{'as':_0xa7e0('0x130'),'through':'UserSmsQueue','required':![]});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0x5e')],{'as':_0xa7e0('0x131'),'through':'UserOpenchannelQueue','required':![]});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0x103')],{'as':'WhatsappQueues','through':_0xa7e0('0x30'),'required':![]});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0xf1')],{'through':_0xa7e0('0x132')});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db['ChatWebsite'],{'as':_0xa7e0('0x133'),'through':_0xa7e0('0x134')});db['User']['belongsToMany'](db[_0xa7e0('0x45')],{'as':_0xa7e0('0x135'),'through':_0xa7e0('0x136')});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0x36')],{'as':_0xa7e0('0x137'),'through':_0xa7e0('0x138')});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db['OpenchannelAccount'],{'as':_0xa7e0('0x139'),'through':'user_has_openchannel_accounts'});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db['SmsAccount'],{'as':_0xa7e0('0x13a'),'through':'user_has_sms_accounts'});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0xf9')],{'as':_0xa7e0('0x13b'),'through':_0xa7e0('0x13c')});db['VoiceChanSpy']['hasMany'](db[_0xa7e0('0x17')],{'as':_0xa7e0('0x13d'),'onDelete':_0xa7e0('0x111'),'foreignKey':'ChanSpyId'});db[_0xa7e0('0x13e')][_0xa7e0('0x112')](db[_0xa7e0('0x17')],{'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x17')]['hasMany'](db[_0xa7e0('0x17')],{'as':_0xa7e0('0x13f'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x140')]['belongsToMany'](db[_0xa7e0('0x141')],{'as':'Sounds','through':_0xa7e0('0x142')});db['VoiceQueue'][_0xa7e0('0x112')](db[_0xa7e0('0x28')],{'as':_0xa7e0('0x143'),'foreignKey':_0xa7e0('0x144')});db['VoiceQueue'][_0xa7e0('0x112')](db[_0xa7e0('0x70')],{'as':_0xa7e0('0x145'),'foreignKey':_0xa7e0('0x144')});db[_0xa7e0('0x1a')][_0xa7e0('0x112')](db[_0xa7e0('0x146')],{'as':'HopperFinals','foreignKey':_0xa7e0('0x144')});db[_0xa7e0('0x1a')][_0xa7e0('0x112')](db[_0xa7e0('0x73')],{'as':_0xa7e0('0x147'),'foreignKey':'VoiceQueueId'});db[_0xa7e0('0x1a')]['hasMany'](db[_0xa7e0('0x74')],{'as':_0xa7e0('0x74'),'foreignKey':_0xa7e0('0x144')});db[_0xa7e0('0x1a')]['hasMany'](db[_0xa7e0('0x148')],{'as':_0xa7e0('0x149'),'foreignKey':'VoiceQueueId'});db[_0xa7e0('0x1a')][_0xa7e0('0x112')](db[_0xa7e0('0xd3')],{'as':_0xa7e0('0x14a'),'foreignKey':_0xa7e0('0x144')});db[_0xa7e0('0x1a')]['belongsTo'](db[_0xa7e0('0x14b')],{'as':_0xa7e0('0x14b'),'foreignKey':'TrunkId'});db['VoiceQueue'][_0xa7e0('0x14c')](db[_0xa7e0('0x14b')],{'as':_0xa7e0('0x14d'),'foreignKey':_0xa7e0('0x14e')});db[_0xa7e0('0x1a')][_0xa7e0('0x14c')](db['Interval'],{'as':_0xa7e0('0x7f'),'foreignKey':_0xa7e0('0x14f')});db[_0xa7e0('0x1a')][_0xa7e0('0x14c')](db[_0xa7e0('0x80')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xa7e0('0x1a')][_0xa7e0('0x11f')](db['CmList'],{'as':_0xa7e0('0x123'),'through':'voice_queues_has_cm_lists'});db[_0xa7e0('0x1a')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x150'),'through':_0xa7e0('0x12a')});db[_0xa7e0('0x1a')][_0xa7e0('0x11f')](db[_0xa7e0('0x151')],{'as':_0xa7e0('0x152'),'through':_0xa7e0('0x106')});db[_0xa7e0('0x1a')][_0xa7e0('0x11f')](db['CmList'],{'as':'BlackLists','through':_0xa7e0('0x153')});db[_0xa7e0('0x1c')]['belongsTo'](db[_0xa7e0('0x12')],{'as':'User','foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x1d')][_0xa7e0('0x14c')](db['User'],{'as':_0xa7e0('0x12'),'foreignKey':'UserId'});db[_0xa7e0('0x10e')][_0xa7e0('0x112')](db['VoiceMailMessage'],{'as':_0xa7e0('0x154'),'onDelete':'cascade','foreignKey':_0xa7e0('0x155'),'sourceKey':_0xa7e0('0x156')});db[_0xa7e0('0x157')][_0xa7e0('0x14c')](db[_0xa7e0('0x10e')],{'foreignKey':'mailboxuser','targetKey':_0xa7e0('0x156')});db[_0xa7e0('0x20')][_0xa7e0('0x112')](db['VoiceQueueReport'],{'as':_0xa7e0('0x158'),'foreignKey':'uniqueid','constraints':![]});db[_0xa7e0('0x20')][_0xa7e0('0x112')](db[_0xa7e0('0x23')],{'as':'AgentReports','foreignKey':_0xa7e0('0x159'),'constraints':![]});db['VoiceCallReport'][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x12'),'foreignKey':'UserId'});db[_0xa7e0('0x20')][_0xa7e0('0x14c')](db[_0xa7e0('0x6e')],{'as':'Contact','foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0x32')][_0xa7e0('0x14c')](db[_0xa7e0('0x36')],{'as':_0xa7e0('0x36'),'foreignKey':_0xa7e0('0x15b')});db[_0xa7e0('0x32')]['belongsTo'](db[_0xa7e0('0x105')],{'as':_0xa7e0('0x105'),'foreignKey':'CloudProviderId','onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x34')][_0xa7e0('0x14c')](db[_0xa7e0('0x36')],{'as':_0xa7e0('0x36'),'foreignKey':_0xa7e0('0x15b')});db[_0xa7e0('0x34')][_0xa7e0('0x14c')](db[_0xa7e0('0x105')],{'as':_0xa7e0('0x105'),'foreignKey':_0xa7e0('0x15d'),'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x36')]['hasOne'](db[_0xa7e0('0x32')],{'as':_0xa7e0('0x15e'),'onDelete':'cascade'});db['MailAccount'][_0xa7e0('0x10d')](db['MailServerOut'],{'as':'Smtp','onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x36')]['hasMany'](db[_0xa7e0('0x15f')],{'as':_0xa7e0('0x160'),'foreignKey':_0xa7e0('0x15b'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x36')][_0xa7e0('0x112')](db[_0xa7e0('0x7b')],{'as':_0xa7e0('0x161'),'foreignKey':_0xa7e0('0x15b')});db[_0xa7e0('0x36')][_0xa7e0('0x112')](db[_0xa7e0('0x3c')],{'as':'Messages','foreignKey':_0xa7e0('0x15b')});db['MailAccount']['hasMany'](db['MailInteraction'],{'as':'Interactions'});db[_0xa7e0('0x36')][_0xa7e0('0x112')](db[_0xa7e0('0x3e')],{'as':_0xa7e0('0x13f')});db[_0xa7e0('0x36')][_0xa7e0('0x14c')](db['CmList'],{'as':_0xa7e0('0x162'),'foreignKey':_0xa7e0('0x163')});db[_0xa7e0('0x36')][_0xa7e0('0x14c')](db[_0xa7e0('0x8f')],{'as':_0xa7e0('0x8f'),'foreignKey':_0xa7e0('0x164')});db[_0xa7e0('0x36')][_0xa7e0('0x14c')](db['Pause'],{'as':_0xa7e0('0x165'),'foreignKey':_0xa7e0('0x166')});db[_0xa7e0('0x36')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x150'),'through':_0xa7e0('0x138')});db[_0xa7e0('0x12c')]['belongsToMany'](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x150'),'through':'UserMailQueue'});db['MailQueue']['belongsToMany'](db[_0xa7e0('0x151')],{'through':_0xa7e0('0x167'),'as':_0xa7e0('0x152')});db[_0xa7e0('0x3b')][_0xa7e0('0x112')](db[_0xa7e0('0x3c')],{'as':_0xa7e0('0x154'),'onDelete':_0xa7e0('0x111'),'foreignKey':'MailInteractionId'});db['MailInteraction'][_0xa7e0('0x14c')](db[_0xa7e0('0x36')],{'as':'Account','foreignKey':_0xa7e0('0x15b')});db[_0xa7e0('0x3b')][_0xa7e0('0x14c')](db[_0xa7e0('0x6e')],{'as':_0xa7e0('0x168'),'foreignKey':_0xa7e0('0x15a')});db['MailInteraction']['belongsTo'](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x169'),'foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x3b')][_0xa7e0('0x11f')](db['Tag'],{'through':_0xa7e0('0x16a'),'as':_0xa7e0('0x16b')});db['MailInteraction'][_0xa7e0('0x11f')](db['Tag'],{'through':_0xa7e0('0x16a'),'as':'ThroughTags'});db[_0xa7e0('0x3b')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x16c'),'through':_0xa7e0('0x125'),'foreignKey':_0xa7e0('0x16d')});db['MailMessage'][_0xa7e0('0x112')](db[_0xa7e0('0xe7')],{'as':_0xa7e0('0x16e'),'onDelete':'cascade'});db[_0xa7e0('0x3c')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'as':'User'});db[_0xa7e0('0x3c')]['belongsTo'](db[_0xa7e0('0x6e')],{'onDelete':'cascade','as':_0xa7e0('0x168')});db[_0xa7e0('0x3c')][_0xa7e0('0x14c')](db[_0xa7e0('0x3b')],{'as':_0xa7e0('0x16f'),'foreignKey':_0xa7e0('0x16d')});db[_0xa7e0('0x3c')][_0xa7e0('0x14c')](db[_0xa7e0('0x36')],{'as':_0xa7e0('0x170'),'foreignKey':_0xa7e0('0x15b')});db['MailMessage']['belongsTo'](db[_0xa7e0('0x171')],{'as':_0xa7e0('0x171'),'foreignKey':'ChatWebsiteId'});db[_0xa7e0('0x3c')]['belongsTo'](db[_0xa7e0('0x66')],{'as':_0xa7e0('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0xa7e0('0x3e')][_0xa7e0('0x14c')](db['User'],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x3e')][_0xa7e0('0x14c')](db['MailQueue'],{'onDelete':'restrict'});db['MailApplication'][_0xa7e0('0x14c')](db['MailAccount'],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x3e')][_0xa7e0('0x14c')](db[_0xa7e0('0x7f')],{'onDelete':_0xa7e0('0x15c'),'foreignKey':'IntervalId'});db['MailApplication']['belongsTo'](db[_0xa7e0('0x88')],{'onDelete':_0xa7e0('0x15c'),'foreignKey':_0xa7e0('0x172')});db[_0xa7e0('0x40')][_0xa7e0('0x14c')](db[_0xa7e0('0x36')],{});db[_0xa7e0('0x40')][_0xa7e0('0x14c')](db[_0xa7e0('0xf1')],{'as':_0xa7e0('0x162'),'foreignKey':'ListId'});db['MailQueueReport']['belongsTo'](db[_0xa7e0('0x6e')],{'as':_0xa7e0('0x168'),'foreignKey':'ContactId'});db['MailQueueReport'][_0xa7e0('0x14c')](db['MailInteraction'],{});db[_0xa7e0('0x40')][_0xa7e0('0x14c')](db[_0xa7e0('0x3c')],{});db[_0xa7e0('0x40')]['belongsTo'](db[_0xa7e0('0x12')],{});db['MailQueueReport']['belongsTo'](db[_0xa7e0('0x12c')],{});db[_0xa7e0('0x173')][_0xa7e0('0x112')](db['DashboardItem'],{'as':_0xa7e0('0x174'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x45')][_0xa7e0('0x112')](db[_0xa7e0('0x15f')],{'as':'Dispositions','foreignKey':_0xa7e0('0x175'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x45')][_0xa7e0('0x112')](db[_0xa7e0('0x7b')],{'as':_0xa7e0('0x161'),'foreignKey':'FaxAccountId'});db[_0xa7e0('0x45')][_0xa7e0('0x112')](db['FaxInteraction'],{'as':_0xa7e0('0x176')});db[_0xa7e0('0x45')][_0xa7e0('0x112')](db[_0xa7e0('0x46')],{'as':_0xa7e0('0x13f')});db[_0xa7e0('0x45')]['hasMany'](db[_0xa7e0('0x17')],{'as':_0xa7e0('0x177'),'onDelete':'cascade'});db[_0xa7e0('0x45')][_0xa7e0('0x112')](db[_0xa7e0('0x4a')],{'as':'Messages'});db[_0xa7e0('0x45')][_0xa7e0('0x14c')](db[_0xa7e0('0x14b')],{'as':'Trunk'});db[_0xa7e0('0x45')][_0xa7e0('0x14c')](db['CmList'],{'as':'List','foreignKey':'ListId'});db['FaxAccount']['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xa7e0('0x45')][_0xa7e0('0x11f')](db['User'],{'as':_0xa7e0('0x150'),'through':_0xa7e0('0x136')});db['FaxApplication'][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x46')][_0xa7e0('0x14c')](db[_0xa7e0('0x4c')],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x46')][_0xa7e0('0x14c')](db['FaxAccount'],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x46')][_0xa7e0('0x14c')](db['Tag'],{'onDelete':_0xa7e0('0x15c'),'foreignKey':_0xa7e0('0x172')});db['FaxInteraction'][_0xa7e0('0x112')](db[_0xa7e0('0x4a')],{'as':_0xa7e0('0x154'),'onDelete':'cascade','foreignKey':'FaxInteractionId'});db[_0xa7e0('0x48')][_0xa7e0('0x14c')](db['FaxAccount'],{'as':_0xa7e0('0x170'),'foreignKey':_0xa7e0('0x175')});db['FaxInteraction']['belongsTo'](db[_0xa7e0('0x6e')],{'as':_0xa7e0('0x168'),'foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0x48')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'as':'Owner','foreignKey':'UserId'});db[_0xa7e0('0x48')][_0xa7e0('0x11f')](db[_0xa7e0('0x88')],{'through':'fax_interaction_has_tags','as':_0xa7e0('0x16b')});db[_0xa7e0('0x48')][_0xa7e0('0x11f')](db[_0xa7e0('0x88')],{'through':_0xa7e0('0x178'),'as':_0xa7e0('0x179')});db[_0xa7e0('0x48')]['belongsToMany'](db['User'],{'as':_0xa7e0('0x16c'),'through':_0xa7e0('0x127'),'foreignKey':'FaxInteractionId'});db[_0xa7e0('0x4a')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'onDelete':_0xa7e0('0x111'),'as':'User'});db[_0xa7e0('0x4a')][_0xa7e0('0x14c')](db[_0xa7e0('0x48')],{'as':'Interaction','foreignKey':_0xa7e0('0x17a')});db[_0xa7e0('0x4a')][_0xa7e0('0x14c')](db[_0xa7e0('0x6e')],{'onDelete':'cascade','as':_0xa7e0('0x168')});db[_0xa7e0('0x4a')][_0xa7e0('0x14c')](db['Attachment'],{'as':_0xa7e0('0xe7'),'foreignKey':_0xa7e0('0x17b')});db['FaxMessage'][_0xa7e0('0x14c')](db[_0xa7e0('0x45')],{'as':'Account','foreignKey':_0xa7e0('0x175')});db['FaxQueue'][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x150'),'through':_0xa7e0('0x17c')});db['FaxQueue']['belongsToMany'](db[_0xa7e0('0x151')],{'through':_0xa7e0('0x17d'),'as':_0xa7e0('0x152')});db[_0xa7e0('0x4d')][_0xa7e0('0x14c')](db['FaxAccount'],{});db[_0xa7e0('0x4d')][_0xa7e0('0x14c')](db[_0xa7e0('0xf1')],{'as':_0xa7e0('0x162'),'foreignKey':_0xa7e0('0x163')});db['FaxQueueReport'][_0xa7e0('0x14c')](db[_0xa7e0('0x6e')],{'as':_0xa7e0('0x168'),'foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0x4d')][_0xa7e0('0x14c')](db[_0xa7e0('0x48')],{});db[_0xa7e0('0x4d')][_0xa7e0('0x14c')](db[_0xa7e0('0x4a')],{});db[_0xa7e0('0x4d')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{});db[_0xa7e0('0x4d')][_0xa7e0('0x14c')](db['FaxQueue'],{});db[_0xa7e0('0x4e')][_0xa7e0('0x112')](db[_0xa7e0('0x15f')],{'as':'Dispositions','foreignKey':'SmsAccountId','onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x4e')]['hasMany'](db[_0xa7e0('0x7b')],{'as':'Answers','foreignKey':_0xa7e0('0x17e')});db[_0xa7e0('0x4e')][_0xa7e0('0x112')](db[_0xa7e0('0x54')],{'as':_0xa7e0('0x154'),'foreignKey':_0xa7e0('0x17e')});db[_0xa7e0('0x4e')][_0xa7e0('0x112')](db[_0xa7e0('0x52')],{'as':_0xa7e0('0x176')});db[_0xa7e0('0x4e')][_0xa7e0('0x112')](db['SmsApplication'],{'as':_0xa7e0('0x13f')});db[_0xa7e0('0x4e')][_0xa7e0('0x14c')](db[_0xa7e0('0xf1')],{'as':'List','foreignKey':_0xa7e0('0x163')});db[_0xa7e0('0x4e')][_0xa7e0('0x14c')](db[_0xa7e0('0x80')],{'as':_0xa7e0('0x165'),'foreignKey':'mandatoryDispositionPauseId'});db['SmsAccount'][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x150'),'through':_0xa7e0('0x17f')});db['SmsApplication'][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x50')][_0xa7e0('0x14c')](db[_0xa7e0('0x56')],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x50')][_0xa7e0('0x14c')](db[_0xa7e0('0x4e')],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x50')][_0xa7e0('0x14c')](db[_0xa7e0('0x7f')],{'onDelete':_0xa7e0('0x15c'),'foreignKey':'IntervalId'});db['SmsApplication'][_0xa7e0('0x14c')](db[_0xa7e0('0x88')],{'onDelete':_0xa7e0('0x15c'),'foreignKey':_0xa7e0('0x172')});db[_0xa7e0('0x52')][_0xa7e0('0x112')](db[_0xa7e0('0x54')],{'as':_0xa7e0('0x154'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x180')});db['SmsInteraction'][_0xa7e0('0x14c')](db[_0xa7e0('0x4e')],{'as':_0xa7e0('0x170'),'foreignKey':'SmsAccountId'});db[_0xa7e0('0x52')][_0xa7e0('0x14c')](db[_0xa7e0('0x6e')],{'as':'Contact','foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0x52')][_0xa7e0('0x14c')](db['User'],{'as':_0xa7e0('0x169'),'foreignKey':'UserId'});db['SmsInteraction'][_0xa7e0('0x11f')](db[_0xa7e0('0x88')],{'through':_0xa7e0('0x181'),'as':_0xa7e0('0x16b')});db[_0xa7e0('0x52')][_0xa7e0('0x11f')](db[_0xa7e0('0x88')],{'through':_0xa7e0('0x181'),'as':_0xa7e0('0x179')});db[_0xa7e0('0x52')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x16c'),'through':_0xa7e0('0x182'),'foreignKey':'SmsInteractionId'});db[_0xa7e0('0x54')]['belongsTo'](db['User'],{'as':_0xa7e0('0x12')});db[_0xa7e0('0x54')][_0xa7e0('0x14c')](db[_0xa7e0('0x6e')],{'onDelete':'cascade','as':'Contact'});db['SmsMessage'][_0xa7e0('0x14c')](db[_0xa7e0('0x52')],{'onDelete':_0xa7e0('0x111'),'as':_0xa7e0('0x16f'),'foreignKey':_0xa7e0('0x180')});db[_0xa7e0('0x54')][_0xa7e0('0x14c')](db[_0xa7e0('0x4e')],{'as':_0xa7e0('0x170'),'foreignKey':_0xa7e0('0x17e')});db[_0xa7e0('0x56')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x150'),'through':_0xa7e0('0x2d'),'foreignKey':_0xa7e0('0x183')});db['SmsQueue'][_0xa7e0('0x11f')](db[_0xa7e0('0x151')],{'through':_0xa7e0('0x184'),'as':_0xa7e0('0x152')});db[_0xa7e0('0x58')][_0xa7e0('0x112')](db[_0xa7e0('0x15f')],{'as':'Dispositions','foreignKey':_0xa7e0('0x185'),'onDelete':'cascade'});db['OpenchannelAccount'][_0xa7e0('0x112')](db[_0xa7e0('0x7b')],{'as':_0xa7e0('0x161'),'foreignKey':_0xa7e0('0x185')});db[_0xa7e0('0x58')]['hasMany'](db[_0xa7e0('0x116')],{'as':_0xa7e0('0x176'),'foreignKey':_0xa7e0('0x185')});db[_0xa7e0('0x58')][_0xa7e0('0x112')](db[_0xa7e0('0x5c')],{'as':_0xa7e0('0x154'),'foreignKey':_0xa7e0('0x185')});db[_0xa7e0('0x58')][_0xa7e0('0x112')](db['OpenchannelApplication'],{'as':_0xa7e0('0x13f'),'foreignKey':_0xa7e0('0x185')});db['OpenchannelAccount']['belongsTo'](db[_0xa7e0('0xf1')],{'as':_0xa7e0('0x162'),'foreignKey':_0xa7e0('0x163')});db[_0xa7e0('0x58')]['belongsTo'](db[_0xa7e0('0x80')],{'as':_0xa7e0('0x165'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xa7e0('0x58')][_0xa7e0('0x11f')](db['User'],{'as':'Agents','through':_0xa7e0('0x186')});db[_0xa7e0('0x5a')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x5a')][_0xa7e0('0x14c')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0xa7e0('0x187')});db[_0xa7e0('0x5a')][_0xa7e0('0x14c')](db[_0xa7e0('0x58')],{'onDelete':_0xa7e0('0x15c'),'foreignKey':_0xa7e0('0x185')});db['OpenchannelApplication'][_0xa7e0('0x14c')](db[_0xa7e0('0x7f')],{'onDelete':_0xa7e0('0x15c'),'foreignKey':_0xa7e0('0x14f')});db['OpenchannelApplication']['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0xa7e0('0x172')});db[_0xa7e0('0x116')][_0xa7e0('0x112')](db['OpenchannelMessage'],{'as':_0xa7e0('0x154'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x188')});db['OpenchannelInteraction'][_0xa7e0('0x14c')](db[_0xa7e0('0x58')],{'as':_0xa7e0('0x170'),'foreignKey':'OpenchannelAccountId'});db[_0xa7e0('0x116')][_0xa7e0('0x14c')](db['CmContact'],{'as':_0xa7e0('0x168'),'foreignKey':'ContactId'});db['OpenchannelInteraction']['belongsTo'](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x169'),'foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x116')]['belongsToMany'](db[_0xa7e0('0x88')],{'through':_0xa7e0('0x189'),'as':'Tags'});db['OpenchannelInteraction'][_0xa7e0('0x11f')](db[_0xa7e0('0x88')],{'through':_0xa7e0('0x189'),'as':_0xa7e0('0x179')});db[_0xa7e0('0x116')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x16c'),'through':_0xa7e0('0x18a'),'foreignKey':_0xa7e0('0x188')});db[_0xa7e0('0x5c')]['belongsTo'](db[_0xa7e0('0x12')],{'onDelete':_0xa7e0('0x111'),'as':_0xa7e0('0x12')});db[_0xa7e0('0x5c')][_0xa7e0('0x14c')](db[_0xa7e0('0x6e')],{'onDelete':_0xa7e0('0x111'),'as':_0xa7e0('0x168')});db['OpenchannelMessage'][_0xa7e0('0x14c')](db[_0xa7e0('0x116')],{'onDelete':'cascade','as':_0xa7e0('0x16f'),'foreignKey':_0xa7e0('0x188')});db[_0xa7e0('0x5c')][_0xa7e0('0x14c')](db[_0xa7e0('0xe7')],{'as':_0xa7e0('0xe7'),'foreignKey':_0xa7e0('0x17b')});db[_0xa7e0('0x5c')]['belongsTo'](db[_0xa7e0('0x58')],{'as':_0xa7e0('0x170'),'foreignKey':_0xa7e0('0x185')});db[_0xa7e0('0x5e')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x150'),'through':_0xa7e0('0x18b'),'foreignKey':_0xa7e0('0x187')});db[_0xa7e0('0x5e')][_0xa7e0('0x11f')](db['Team'],{'through':_0xa7e0('0x18c'),'as':'Teams'});db['ChatWebsite'][_0xa7e0('0x112')](db['Disposition'],{'as':_0xa7e0('0x160'),'foreignKey':_0xa7e0('0x18d'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x171')]['hasMany'](db[_0xa7e0('0x7b')],{'as':_0xa7e0('0x161'),'foreignKey':_0xa7e0('0x18d')});db['ChatWebsite'][_0xa7e0('0x112')](db[_0xa7e0('0x6b')],{'as':'ProactiveActions'});db[_0xa7e0('0x171')][_0xa7e0('0x112')](db[_0xa7e0('0x118')],{'as':_0xa7e0('0x176')});db['ChatWebsite'][_0xa7e0('0x112')](db['ChatApplication'],{'as':_0xa7e0('0x13f')});db[_0xa7e0('0x171')]['hasMany'](db[_0xa7e0('0x65')],{'as':_0xa7e0('0x154')});db[_0xa7e0('0x171')][_0xa7e0('0x14c')](db[_0xa7e0('0xf1')],{'as':'List','foreignKey':_0xa7e0('0x163')});db['ChatWebsite']['belongsTo'](db[_0xa7e0('0x7f')],{'as':_0xa7e0('0x7f'),'foreignKey':_0xa7e0('0x14f')});db['ChatWebsite'][_0xa7e0('0x14c')](db[_0xa7e0('0x36')],{'as':_0xa7e0('0x36'),'foreignKey':_0xa7e0('0x15b')});db[_0xa7e0('0x171')][_0xa7e0('0x14c')](db['Pause'],{'as':_0xa7e0('0x165'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xa7e0('0x171')][_0xa7e0('0x11f')](db['User'],{'as':_0xa7e0('0x150'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0xa7e0('0x14c')](db[_0xa7e0('0x58')],{});db[_0xa7e0('0x60')][_0xa7e0('0x14c')](db[_0xa7e0('0xf1')],{'as':_0xa7e0('0x162'),'foreignKey':'ListId'});db[_0xa7e0('0x60')]['belongsTo'](db[_0xa7e0('0x6e')],{'as':_0xa7e0('0x168'),'foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0x60')][_0xa7e0('0x14c')](db[_0xa7e0('0x116')],{});db[_0xa7e0('0x60')][_0xa7e0('0x14c')](db[_0xa7e0('0x5c')],{});db[_0xa7e0('0x60')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{});db[_0xa7e0('0x60')][_0xa7e0('0x14c')](db[_0xa7e0('0x5e')],{});db['ChatApplication'][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x18e'),'foreignKey':_0xa7e0('0x10f'),'onDelete':_0xa7e0('0x15c')});db['ChatApplication'][_0xa7e0('0x14c')](db['ChatQueue'],{'as':_0xa7e0('0x18f'),'foreignKey':_0xa7e0('0x190'),'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x62')][_0xa7e0('0x14c')](db[_0xa7e0('0x171')],{'as':_0xa7e0('0x191'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0xa7e0('0x62')][_0xa7e0('0x14c')](db[_0xa7e0('0x88')],{'onDelete':_0xa7e0('0x15c'),'foreignKey':_0xa7e0('0x172')});db[_0xa7e0('0x118')][_0xa7e0('0x112')](db[_0xa7e0('0x65')],{'as':_0xa7e0('0x154'),'onDelete':'cascade','foreignKey':'ChatInteractionId'});db['ChatInteraction'][_0xa7e0('0x14c')](db[_0xa7e0('0x171')],{'as':_0xa7e0('0x170'),'foreignKey':_0xa7e0('0x18d')});db['ChatInteraction'][_0xa7e0('0x14c')](db['CmContact'],{'as':'Contact','foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0x118')][_0xa7e0('0x14c')](db['User'],{'as':_0xa7e0('0x169'),'foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x118')][_0xa7e0('0x11f')](db[_0xa7e0('0x88')],{'through':_0xa7e0('0x192'),'as':_0xa7e0('0x16b')});db[_0xa7e0('0x118')]['belongsToMany'](db[_0xa7e0('0x88')],{'through':_0xa7e0('0x192'),'as':_0xa7e0('0x179')});db[_0xa7e0('0x118')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x16c'),'through':_0xa7e0('0x126'),'foreignKey':'ChatInteractionId'});db[_0xa7e0('0x65')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'onDelete':'cascade','as':_0xa7e0('0x12')});db[_0xa7e0('0x65')][_0xa7e0('0x14c')](db['CmContact'],{'onDelete':_0xa7e0('0x111'),'as':_0xa7e0('0x168'),'foreignKey':'ContactId'});db[_0xa7e0('0x65')][_0xa7e0('0x14c')](db[_0xa7e0('0x118')],{'onDelete':_0xa7e0('0x111'),'as':_0xa7e0('0x16f'),'foreignKey':_0xa7e0('0x193')});db['ChatMessage'][_0xa7e0('0x14c')](db[_0xa7e0('0xe7')],{'as':_0xa7e0('0xe7'),'foreignKey':_0xa7e0('0x17b')});db['ChatMessage'][_0xa7e0('0x14c')](db['ChatWebsite'],{'as':_0xa7e0('0x170'),'foreignKey':_0xa7e0('0x18d')});db[_0xa7e0('0x66')][_0xa7e0('0x112')](db[_0xa7e0('0xe7')],{'as':'Attachments','foreignKey':_0xa7e0('0x194'),'onDelete':'cascade','hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db[_0xa7e0('0x6e')],{'onDelete':'cascade','as':_0xa7e0('0x168'),'foreignKey':'ContactId'});db[_0xa7e0('0x66')]['belongsTo'](db[_0xa7e0('0x171')],{'as':_0xa7e0('0x170'),'foreignKey':_0xa7e0('0x18d')});db[_0xa7e0('0x68')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x150'),'through':_0xa7e0('0x2a'),'hooks':!![]});db[_0xa7e0('0x68')][_0xa7e0('0x11f')](db[_0xa7e0('0x151')],{'through':'team_has_chat_queues','as':'Teams'});db['ChatGroup'][_0xa7e0('0x112')](db[_0xa7e0('0xcf')],{'as':'Messages','foreignKey':_0xa7e0('0x195'),'onDelete':'cascade'});db[_0xa7e0('0x6a')][_0xa7e0('0x11f')](db['User'],{'as':_0xa7e0('0x143'),'through':_0xa7e0('0x121')});db[_0xa7e0('0x6b')][_0xa7e0('0x14c')](db['ChatWebsite'],{'as':_0xa7e0('0x191'),'foreignKey':_0xa7e0('0x18d')});db[_0xa7e0('0x6c')][_0xa7e0('0x112')](db['CmContact'],{'as':_0xa7e0('0x196'),'foreignKey':_0xa7e0('0x197')});db['CmContact']['hasMany'](db[_0xa7e0('0x8c')],{'as':_0xa7e0('0x198'),'foreignKey':_0xa7e0('0x199')});db['CmContact'][_0xa7e0('0x112')](db[_0xa7e0('0x70')],{'as':_0xa7e0('0x145'),'foreignKey':_0xa7e0('0x15a')});db['CmContact'][_0xa7e0('0x112')](db[_0xa7e0('0x146')],{'as':'HopperFinals','foreignKey':'ContactId'});db[_0xa7e0('0x6e')][_0xa7e0('0x112')](db[_0xa7e0('0x73')],{'as':'HopperHistories','foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0x6e')]['hasMany'](db[_0xa7e0('0x74')],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db[_0xa7e0('0x6e')][_0xa7e0('0x112')](db[_0xa7e0('0xd3')],{'as':_0xa7e0('0x14a'),'foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0x6e')][_0xa7e0('0x112')](db[_0xa7e0('0x116')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0xa7e0('0x6e')]['hasMany'](db[_0xa7e0('0x118')],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x6e')][_0xa7e0('0x112')](db[_0xa7e0('0x52')],{'as':_0xa7e0('0x11a'),'foreignKey':_0xa7e0('0x15a'),'onDelete':_0xa7e0('0x15c')});db['CmContact'][_0xa7e0('0x112')](db['FaxInteraction'],{'as':_0xa7e0('0x11b'),'foreignKey':'ContactId','onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x6e')][_0xa7e0('0x112')](db[_0xa7e0('0x3b')],{'as':_0xa7e0('0x19a'),'foreignKey':_0xa7e0('0x15a'),'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x6e')][_0xa7e0('0x14c')](db[_0xa7e0('0x6c')],{'as':'Company','foreignKey':'CompanyId'});db['CmContact'][_0xa7e0('0x14c')](db[_0xa7e0('0xf1')],{'as':'List','foreignKey':_0xa7e0('0x163'),'onDelete':_0xa7e0('0x111')});db['CmContact']['belongsToMany'](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x16c'),'through':_0xa7e0('0x122')});db[_0xa7e0('0x6e')][_0xa7e0('0x11f')](db['Tag'],{'as':'Tags','through':_0xa7e0('0x19b')});db[_0xa7e0('0x6e')][_0xa7e0('0x11f')](db[_0xa7e0('0x88')],{'through':_0xa7e0('0x19b'),'as':_0xa7e0('0x179')});db['CmHopper'][_0xa7e0('0x112')](db[_0xa7e0('0x8d')],{'as':_0xa7e0('0x19c'),'foreignKey':'CmHopperId'});db[_0xa7e0('0x70')][_0xa7e0('0x14c')](db[_0xa7e0('0x6e')],{'as':'Contact','foreignKey':_0xa7e0('0x15a'),'onDelete':_0xa7e0('0x111')});db['CmHopper'][_0xa7e0('0x14c')](db[_0xa7e0('0xf1')],{'as':_0xa7e0('0x162'),'foreignKey':_0xa7e0('0x163'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x70')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x18e'),'foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x70')][_0xa7e0('0x14c')](db[_0xa7e0('0x1a')],{'as':_0xa7e0('0x18f'),'foreignKey':_0xa7e0('0x144'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x70')][_0xa7e0('0x14c')](db[_0xa7e0('0xe5')],{'as':_0xa7e0('0xe5'),'foreignKey':_0xa7e0('0x19d'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x70')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x169'),'foreignKey':_0xa7e0('0x19e')});db['CmHopperBlack'][_0xa7e0('0x14c')](db[_0xa7e0('0x6e')],{'as':'Contact','foreignKey':_0xa7e0('0x15a'),'onDelete':_0xa7e0('0x111')});db['CmHopperBlack'][_0xa7e0('0x14c')](db[_0xa7e0('0xf1')],{'as':_0xa7e0('0x162'),'foreignKey':_0xa7e0('0x163'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x148')]['belongsTo'](db[_0xa7e0('0x1a')],{'as':_0xa7e0('0x18f'),'foreignKey':'VoiceQueueId','onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x148')][_0xa7e0('0x14c')](db[_0xa7e0('0xe5')],{'as':_0xa7e0('0xe5'),'foreignKey':'CampaignId','onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x79')][_0xa7e0('0x112')](db[_0xa7e0('0x7d')],{'as':{'plural':_0xa7e0('0x19f'),'singular':_0xa7e0('0x1a0')},'foreignKey':_0xa7e0('0x1a1'),'onDelete':_0xa7e0('0x111'),'hooks':!![]});db[_0xa7e0('0x79')]['hasMany'](db['Condition'],{'as':{'plural':_0xa7e0('0x1a2'),'singular':_0xa7e0('0x1a3')},'foreignKey':_0xa7e0('0x1a4'),'onDelete':'cascade','hooks':!![]});db[_0xa7e0('0x79')][_0xa7e0('0x112')](db[_0xa7e0('0x1a5')],{'as':_0xa7e0('0x1a6'),'foreignKey':'AutomationId','onDelete':_0xa7e0('0x111'),'hooks':!![]});db[_0xa7e0('0x15f')][_0xa7e0('0x112')](db[_0xa7e0('0x15f')],{'as':_0xa7e0('0x160'),'foreignKey':_0xa7e0('0x1a7'),'onDelete':'cascade'});db[_0xa7e0('0x7f')][_0xa7e0('0x112')](db['Interval'],{'as':_0xa7e0('0x1a8'),'foreignKey':_0xa7e0('0x14f'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xa7e0('0x7f')][_0xa7e0('0x112')](db[_0xa7e0('0x17')],{'as':_0xa7e0('0x115'),'foreignKey':_0xa7e0('0x14f'),'onDelete':_0xa7e0('0x15c')});db['Interval'][_0xa7e0('0x112')](db[_0xa7e0('0x3e')],{'as':'MailApplications','foreignKey':_0xa7e0('0x14f')});db[_0xa7e0('0x7f')]['hasMany'](db[_0xa7e0('0x62')],{'as':_0xa7e0('0x1a9'),'foreignKey':'IntervalId'});db[_0xa7e0('0x7f')]['hasMany'](db['FaxApplication'],{'as':_0xa7e0('0x1aa'),'foreignKey':_0xa7e0('0x14f')});db[_0xa7e0('0x7f')][_0xa7e0('0x112')](db[_0xa7e0('0x50')],{'as':_0xa7e0('0x1ab'),'foreignKey':_0xa7e0('0x14f')});db[_0xa7e0('0x85')][_0xa7e0('0x14c')](db[_0xa7e0('0x36')],{});db[_0xa7e0('0x85')]['belongsTo'](db[_0xa7e0('0x98')],{'foreignKey':_0xa7e0('0x1ac')});db['Schedule'][_0xa7e0('0x14c')](db[_0xa7e0('0x97')],{'foreignKey':_0xa7e0('0x1ad')});db[_0xa7e0('0x141')][_0xa7e0('0x11f')](db[_0xa7e0('0x140')],{'as':_0xa7e0('0x1ae'),'through':_0xa7e0('0x142'),'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x88')]['belongsToMany'](db['CmContact'],{'through':_0xa7e0('0x19b')});db['Tag'][_0xa7e0('0x11f')](db[_0xa7e0('0x118')],{'through':_0xa7e0('0x192')});db[_0xa7e0('0x88')][_0xa7e0('0x11f')](db[_0xa7e0('0x3b')],{'through':_0xa7e0('0x16a')});db['Tag'][_0xa7e0('0x11f')](db[_0xa7e0('0x52')],{'through':'sms_interaction_has_tags'});db[_0xa7e0('0x88')][_0xa7e0('0x11f')](db[_0xa7e0('0x48')],{'through':'fax_interaction_has_tags'});db[_0xa7e0('0x88')][_0xa7e0('0x11f')](db[_0xa7e0('0x116')],{'through':_0xa7e0('0x189')});db[_0xa7e0('0x88')]['belongsToMany'](db['WhatsappInteraction'],{'through':_0xa7e0('0x1af')});db['CmContactHasItem'][_0xa7e0('0x14c')](db[_0xa7e0('0x8a')],{'as':'ItemType','foreignKey':_0xa7e0('0x1b0')});db[_0xa7e0('0x8d')][_0xa7e0('0x14c')](db['CmHopper'],{'as':_0xa7e0('0x1b1'),'foreignKey':'CmHopperId'});db[_0xa7e0('0x8c')][_0xa7e0('0x14c')](db[_0xa7e0('0x6e')],{'as':_0xa7e0('0x168'),'foreignKey':'CmContactId'});db[_0xa7e0('0x91')][_0xa7e0('0x112')](db[_0xa7e0('0x7d')],{'as':{'plural':_0xa7e0('0x1b2'),'singular':_0xa7e0('0x1b3')},'foreignKey':_0xa7e0('0x1b4'),'onDelete':_0xa7e0('0x111'),'hooks':!![]});db['Trigger']['hasMany'](db[_0xa7e0('0x7d')],{'as':{'plural':_0xa7e0('0x1b5'),'singular':_0xa7e0('0x1b6')},'foreignKey':_0xa7e0('0x1b7'),'onDelete':_0xa7e0('0x111'),'hooks':!![]});db[_0xa7e0('0x91')][_0xa7e0('0x112')](db[_0xa7e0('0x1a5')],{'as':_0xa7e0('0x1a6'),'foreignKey':_0xa7e0('0x1b8'),'onDelete':_0xa7e0('0x111'),'hooks':!![]});db['AnalyticCustomReport'][_0xa7e0('0x112')](db['AnalyticFieldReport'],{'as':_0xa7e0('0x1b9'),'onDelete':'cascade','foreignKey':_0xa7e0('0x1ad'),'hooks':!![]});db[_0xa7e0('0x98')][_0xa7e0('0x112')](db['AnalyticFieldReport'],{'as':_0xa7e0('0x1b9'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1ac')});db['AnalyticMetric']['hasMany'](db['AnalyticFieldReport'],{'as':_0xa7e0('0x1b9'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1ba')});db[_0xa7e0('0x1bb')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0xa7e0('0x1ba')});db[_0xa7e0('0x9e')][_0xa7e0('0x112')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1bc')});db[_0xa7e0('0xa0')][_0xa7e0('0x112')](db['SalesforceField'],{'as':_0xa7e0('0x1bd'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0xa0')][_0xa7e0('0x112')](db[_0xa7e0('0xa2')],{'as':_0xa7e0('0x1bf'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1c0')});db[_0xa7e0('0xa0')][_0xa7e0('0x112')](db[_0xa7e0('0xa2')],{'as':_0xa7e0('0x1b9'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0xa0')][_0xa7e0('0x14c')](db[_0xa7e0('0x9e')],{'as':'Account','foreignKey':'AccountId'});db[_0xa7e0('0xa2')]['hasMany'](db[_0xa7e0('0xa2')],{'as':_0xa7e0('0x1c2'),'foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0xa2')][_0xa7e0('0x112')](db[_0xa7e0('0xa2')],{'as':_0xa7e0('0x1c3'),'foreignKey':_0xa7e0('0x1c0')});db[_0xa7e0('0xa2')][_0xa7e0('0x112')](db[_0xa7e0('0xa2')],{'as':'Field','foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0xa2')][_0xa7e0('0x14c')](db[_0xa7e0('0x93')],{'as':'Variable','foreignKey':'VariableId'});db[_0xa7e0('0xa3')]['hasMany'](db[_0xa7e0('0xa5')],{'as':_0xa7e0('0x1c4'),'onDelete':'cascade','foreignKey':_0xa7e0('0x1bc')});db['SugarcrmConfiguration'][_0xa7e0('0x112')](db[_0xa7e0('0xa7')],{'as':_0xa7e0('0x1bd'),'onDelete':'cascade','foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0xa5')]['hasMany'](db[_0xa7e0('0xa7')],{'as':_0xa7e0('0x1bf'),'onDelete':'cascade','foreignKey':_0xa7e0('0x1c0')});db[_0xa7e0('0xa5')]['hasMany'](db['SugarcrmField'],{'as':_0xa7e0('0x1b9'),'onDelete':_0xa7e0('0x111'),'foreignKey':'FieldId'});db[_0xa7e0('0xa5')][_0xa7e0('0x14c')](db[_0xa7e0('0xa3')],{'as':_0xa7e0('0x170'),'foreignKey':'AccountId'});db[_0xa7e0('0xa7')][_0xa7e0('0x112')](db[_0xa7e0('0xa7')],{'as':_0xa7e0('0x1c2'),'foreignKey':_0xa7e0('0x1be')});db['SugarcrmField'][_0xa7e0('0x112')](db[_0xa7e0('0xa7')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xa7e0('0xa7')][_0xa7e0('0x112')](db[_0xa7e0('0xa7')],{'as':_0xa7e0('0x1c5'),'foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0xa7')][_0xa7e0('0x14c')](db[_0xa7e0('0x93')],{'as':'Variable','foreignKey':_0xa7e0('0x1c6')});db['DeskAccount'][_0xa7e0('0x112')](db[_0xa7e0('0xab')],{'as':_0xa7e0('0x1c4'),'onDelete':_0xa7e0('0x111'),'foreignKey':'AccountId'});db[_0xa7e0('0xab')][_0xa7e0('0x112')](db[_0xa7e0('0xad')],{'as':_0xa7e0('0x1bd'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0xab')][_0xa7e0('0x112')](db[_0xa7e0('0xad')],{'as':_0xa7e0('0x1bf'),'onDelete':'cascade','foreignKey':_0xa7e0('0x1c0')});db['DeskConfiguration']['hasMany'](db[_0xa7e0('0xad')],{'as':'Fields','onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0xab')]['belongsTo'](db['DeskAccount'],{'as':_0xa7e0('0x170'),'foreignKey':_0xa7e0('0x1bc')});db[_0xa7e0('0xab')]['belongsToMany'](db[_0xa7e0('0x88')],{'through':_0xa7e0('0x1c7')});db[_0xa7e0('0xad')]['hasMany'](db['DeskField'],{'as':_0xa7e0('0x1c2'),'foreignKey':_0xa7e0('0x1be')});db['DeskField'][_0xa7e0('0x112')](db[_0xa7e0('0xad')],{'as':_0xa7e0('0x1c3'),'foreignKey':_0xa7e0('0x1c0')});db[_0xa7e0('0xad')][_0xa7e0('0x112')](db[_0xa7e0('0xad')],{'as':_0xa7e0('0x1c5'),'foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0xad')][_0xa7e0('0x14c')](db['Variable'],{'as':_0xa7e0('0x93'),'foreignKey':_0xa7e0('0x1c6')});db['ZohoAccount']['hasMany'](db['ZohoConfiguration'],{'as':'Configurations','onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1bc')});db[_0xa7e0('0xb0')][_0xa7e0('0x112')](db['ZohoField'],{'as':_0xa7e0('0x1bd'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0xb0')][_0xa7e0('0x112')](db[_0xa7e0('0x1c8')],{'as':'Descriptions','onDelete':_0xa7e0('0x111'),'foreignKey':'DescriptionId'});db[_0xa7e0('0xb0')][_0xa7e0('0x112')](db[_0xa7e0('0x1c8')],{'as':_0xa7e0('0x1b9'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0xb0')][_0xa7e0('0x14c')](db[_0xa7e0('0x1c9')],{'as':'Account','foreignKey':_0xa7e0('0x1bc')});db['ZohoField'][_0xa7e0('0x112')](db[_0xa7e0('0x1c8')],{'as':_0xa7e0('0x1c2'),'foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0x1c8')][_0xa7e0('0x112')](db[_0xa7e0('0x1c8')],{'as':_0xa7e0('0x1c3'),'foreignKey':'DescriptionId'});db[_0xa7e0('0x1c8')][_0xa7e0('0x112')](db[_0xa7e0('0x1c8')],{'as':_0xa7e0('0x1c5'),'foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0x1c8')][_0xa7e0('0x14c')](db[_0xa7e0('0x93')],{'as':_0xa7e0('0x93'),'foreignKey':_0xa7e0('0x1c6')});db[_0xa7e0('0xb2')][_0xa7e0('0x112')](db[_0xa7e0('0xb4')],{'as':_0xa7e0('0x1c4'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1bc')});db[_0xa7e0('0xb4')][_0xa7e0('0x112')](db['ZendeskField'],{'as':_0xa7e0('0x1bd'),'foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0xb4')][_0xa7e0('0x112')](db['ZendeskField'],{'as':_0xa7e0('0x1bf'),'foreignKey':_0xa7e0('0x1c0')});db[_0xa7e0('0xb4')][_0xa7e0('0x112')](db['ZendeskField'],{'as':'Fields','foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0xb4')][_0xa7e0('0x14c')](db['ZendeskAccount'],{'as':_0xa7e0('0x170'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0xa7e0('0x11f')](db[_0xa7e0('0x88')],{'through':'int_zendesk_configuration_has_tags'});db[_0xa7e0('0xb5')][_0xa7e0('0x112')](db['ZendeskField'],{'as':_0xa7e0('0x1c2'),'foreignKey':_0xa7e0('0x1be')});db['ZendeskField'][_0xa7e0('0x112')](db[_0xa7e0('0xb5')],{'as':_0xa7e0('0x1c3'),'foreignKey':'DescriptionId'});db[_0xa7e0('0xb5')][_0xa7e0('0x112')](db[_0xa7e0('0xb5')],{'as':_0xa7e0('0x1c5'),'foreignKey':'FieldId'});db['ZendeskField'][_0xa7e0('0x14c')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xa7e0('0xb7')]['hasMany'](db[_0xa7e0('0x1ca')],{'as':_0xa7e0('0x1c4'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1bc')});db['FreshdeskConfiguration'][_0xa7e0('0x112')](db['FreshdeskField'],{'as':'Subjects','onDelete':_0xa7e0('0x111'),'foreignKey':'SubjectId'});db[_0xa7e0('0x1ca')]['hasMany'](db[_0xa7e0('0xba')],{'as':_0xa7e0('0x1bf'),'onDelete':'cascade','foreignKey':_0xa7e0('0x1c0')});db['FreshdeskConfiguration']['hasMany'](db[_0xa7e0('0xba')],{'as':_0xa7e0('0x1b9'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0x1ca')]['belongsTo'](db[_0xa7e0('0xb7')],{'as':'Account','foreignKey':_0xa7e0('0x1bc')});db[_0xa7e0('0x1ca')][_0xa7e0('0x11f')](db[_0xa7e0('0x88')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xa7e0('0xba')]['hasMany'](db[_0xa7e0('0xba')],{'as':_0xa7e0('0x1c2'),'foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0xba')][_0xa7e0('0x112')](db[_0xa7e0('0xba')],{'as':_0xa7e0('0x1c3'),'foreignKey':_0xa7e0('0x1c0')});db['FreshdeskField']['hasMany'](db[_0xa7e0('0xba')],{'as':'Field','foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0xba')][_0xa7e0('0x14c')](db[_0xa7e0('0x93')],{'as':_0xa7e0('0x93'),'foreignKey':_0xa7e0('0x1c6')});db[_0xa7e0('0xbc')][_0xa7e0('0x112')](db['VtigerConfiguration'],{'as':_0xa7e0('0x1c4'),'onDelete':_0xa7e0('0x111'),'foreignKey':'AccountId'});db[_0xa7e0('0x1cb')][_0xa7e0('0x112')](db['VtigerField'],{'as':_0xa7e0('0x1bd'),'foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0x1cb')]['hasMany'](db[_0xa7e0('0x1cc')],{'as':_0xa7e0('0x1bf'),'foreignKey':'DescriptionId'});db[_0xa7e0('0x1cb')][_0xa7e0('0x112')](db['VtigerField'],{'as':_0xa7e0('0x1b9'),'foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0x1cb')]['belongsTo'](db[_0xa7e0('0xbc')],{'as':_0xa7e0('0x170'),'foreignKey':_0xa7e0('0x1bc')});db['VtigerField'][_0xa7e0('0x112')](db['VtigerField'],{'as':_0xa7e0('0x1c2'),'foreignKey':'SubjectId'});db[_0xa7e0('0x1cc')][_0xa7e0('0x112')](db[_0xa7e0('0x1cc')],{'as':_0xa7e0('0x1c3'),'foreignKey':_0xa7e0('0x1c0')});db['VtigerField']['hasMany'](db[_0xa7e0('0x1cc')],{'as':_0xa7e0('0x1c5'),'foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0x1cc')]['belongsTo'](db[_0xa7e0('0x93')],{'as':'Variable','foreignKey':_0xa7e0('0x1c6')});db[_0xa7e0('0xbe')][_0xa7e0('0x112')](db['ServicenowConfiguration'],{'as':_0xa7e0('0x1c4'),'onDelete':'cascade','foreignKey':_0xa7e0('0x1bc')});db['ServicenowConfiguration'][_0xa7e0('0x112')](db[_0xa7e0('0x1cd')],{'as':_0xa7e0('0x1bd'),'foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0xbf')][_0xa7e0('0x112')](db[_0xa7e0('0x1cd')],{'as':_0xa7e0('0x1bf'),'foreignKey':_0xa7e0('0x1c0')});db['ServicenowConfiguration'][_0xa7e0('0x112')](db[_0xa7e0('0x1cd')],{'as':_0xa7e0('0x1b9'),'foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0xbf')][_0xa7e0('0x14c')](db[_0xa7e0('0xbe')],{'as':_0xa7e0('0x170'),'foreignKey':'AccountId'});db[_0xa7e0('0x1cd')][_0xa7e0('0x112')](db[_0xa7e0('0x1cd')],{'as':_0xa7e0('0x1c2'),'foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0x1cd')][_0xa7e0('0x112')](db[_0xa7e0('0x1cd')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xa7e0('0x1cd')][_0xa7e0('0x112')](db[_0xa7e0('0x1cd')],{'as':_0xa7e0('0x1c5'),'foreignKey':'FieldId'});db[_0xa7e0('0x1cd')][_0xa7e0('0x14c')](db['Variable'],{'as':_0xa7e0('0x93'),'foreignKey':_0xa7e0('0x1c6')});db[_0xa7e0('0xc2')]['hasMany'](db[_0xa7e0('0x1ce')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xa7e0('0x1bc')});db[_0xa7e0('0xc2')][_0xa7e0('0x14c')](db[_0xa7e0('0x105')],{'as':_0xa7e0('0x105'),'foreignKey':'CloudProviderId'});db[_0xa7e0('0x1ce')]['hasMany'](db[_0xa7e0('0xc5')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0x1ce')][_0xa7e0('0x112')](db['Dynamics365Field'],{'as':'Descriptions','onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1c0')});db[_0xa7e0('0x1ce')][_0xa7e0('0x112')](db[_0xa7e0('0xc5')],{'as':_0xa7e0('0x1b9'),'onDelete':'cascade','foreignKey':_0xa7e0('0x1c1')});db['Dynamics365Configuration'][_0xa7e0('0x14c')](db['Dynamics365Account'],{'as':_0xa7e0('0x170'),'foreignKey':_0xa7e0('0x1bc')});db[_0xa7e0('0xc5')][_0xa7e0('0x112')](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0xc5')][_0xa7e0('0x112')](db['Dynamics365Field'],{'as':_0xa7e0('0x1c3'),'foreignKey':_0xa7e0('0x1c0')});db[_0xa7e0('0xc5')][_0xa7e0('0x112')](db[_0xa7e0('0xc5')],{'as':_0xa7e0('0x1c5'),'foreignKey':'FieldId'});db['Dynamics365Field'][_0xa7e0('0x14c')](db[_0xa7e0('0x93')],{'as':_0xa7e0('0x93'),'foreignKey':'VariableId'});db['FreshsalesAccount'][_0xa7e0('0x112')](db[_0xa7e0('0x1cf')],{'as':_0xa7e0('0x1c4'),'onDelete':_0xa7e0('0x111'),'foreignKey':'AccountId'});db['FreshsalesConfiguration']['hasMany'](db[_0xa7e0('0xc9')],{'as':_0xa7e0('0x1bd'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration'][_0xa7e0('0x112')](db[_0xa7e0('0xc9')],{'as':'Descriptions','foreignKey':_0xa7e0('0x1c0')});db[_0xa7e0('0x1cf')][_0xa7e0('0x112')](db[_0xa7e0('0xc9')],{'as':_0xa7e0('0x1b9'),'foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0x1cf')][_0xa7e0('0x14c')](db[_0xa7e0('0x1d0')],{'as':_0xa7e0('0x170'),'foreignKey':'AccountId'});db[_0xa7e0('0xc9')][_0xa7e0('0x112')](db[_0xa7e0('0xc9')],{'as':'Subject','foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0xc9')][_0xa7e0('0x112')](db[_0xa7e0('0xc9')],{'as':_0xa7e0('0x1c3'),'foreignKey':_0xa7e0('0x1c0')});db[_0xa7e0('0xc9')]['hasMany'](db[_0xa7e0('0xc9')],{'as':'Field','foreignKey':'FieldId'});db[_0xa7e0('0xc9')][_0xa7e0('0x14c')](db[_0xa7e0('0x93')],{'as':_0xa7e0('0x93'),'foreignKey':_0xa7e0('0x1c6')});db[_0xa7e0('0xce')][_0xa7e0('0x14c')](db[_0xa7e0('0x171')],{});db[_0xa7e0('0xce')]['belongsTo'](db[_0xa7e0('0xf1')],{'as':_0xa7e0('0x162'),'foreignKey':'ListId'});db['ChatQueueReport'][_0xa7e0('0x14c')](db['CmContact'],{'as':_0xa7e0('0x168'),'foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0xce')][_0xa7e0('0x14c')](db[_0xa7e0('0x118')],{});db[_0xa7e0('0xce')][_0xa7e0('0x14c')](db[_0xa7e0('0x65')],{});db[_0xa7e0('0xce')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{});db[_0xa7e0('0xce')][_0xa7e0('0x14c')](db['ChatQueue'],{});db['ChatInternalMessage'][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'onDelete':_0xa7e0('0x111'),'foreignKey':'FromId'});db[_0xa7e0('0xcf')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1d1')});db[_0xa7e0('0xd3')][_0xa7e0('0x112')](db[_0xa7e0('0x1d2')],{'foreignKey':_0xa7e0('0x1d3'),'onDelete':'cascade'});db[_0xa7e0('0xd3')][_0xa7e0('0x112')](db[_0xa7e0('0xd1')],{'foreignKey':_0xa7e0('0x1d3'),'onDelete':'cascade'});db[_0xa7e0('0xd5')][_0xa7e0('0x14c')](db['SmsAccount'],{});db[_0xa7e0('0xd5')]['belongsTo'](db[_0xa7e0('0xf1')],{'as':_0xa7e0('0x162'),'foreignKey':'ListId'});db[_0xa7e0('0xd5')][_0xa7e0('0x14c')](db['CmContact'],{'as':_0xa7e0('0x168'),'foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0xd5')][_0xa7e0('0x14c')](db[_0xa7e0('0x52')],{});db[_0xa7e0('0xd5')][_0xa7e0('0x14c')](db[_0xa7e0('0x54')],{});db[_0xa7e0('0xd5')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{});db[_0xa7e0('0xd5')][_0xa7e0('0x14c')](db[_0xa7e0('0x56')],{});db['JscriptyProject'][_0xa7e0('0x112')](db[_0xa7e0('0xd3')],{'foreignKey':_0xa7e0('0x1d4')});db[_0xa7e0('0x1d5')][_0xa7e0('0x112')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0xa7e0('0x112')](db[_0xa7e0('0xd1')],{'foreignKey':'ProjectId'});db[_0xa7e0('0x151')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x150'),'through':_0xa7e0('0x124')});db['Team']['belongsToMany'](db[_0xa7e0('0x1a')],{'through':'TeamVoiceQueue','as':_0xa7e0('0x129')});db[_0xa7e0('0x151')][_0xa7e0('0x11f')](db['MailQueue'],{'through':'team_has_mail_queues','as':_0xa7e0('0x12d')});db[_0xa7e0('0x151')][_0xa7e0('0x11f')](db[_0xa7e0('0x68')],{'through':'team_has_chat_queues','as':_0xa7e0('0x12e')});db[_0xa7e0('0x151')][_0xa7e0('0x11f')](db[_0xa7e0('0x4c')],{'through':_0xa7e0('0x17d'),'as':'FaxQueues'});db[_0xa7e0('0x151')][_0xa7e0('0x11f')](db[_0xa7e0('0x56')],{'through':_0xa7e0('0x184'),'as':_0xa7e0('0x130')});db[_0xa7e0('0x151')][_0xa7e0('0x11f')](db[_0xa7e0('0x5e')],{'through':_0xa7e0('0x18c'),'as':_0xa7e0('0x131')});db[_0xa7e0('0x151')][_0xa7e0('0x11f')](db[_0xa7e0('0x103')],{'through':_0xa7e0('0x1d6'),'as':_0xa7e0('0x1d7')});db[_0xa7e0('0x151')]['belongsToMany'](db[_0xa7e0('0xf3')],{'through':_0xa7e0('0x108'),'as':'VoicePrefixes'});db[_0xa7e0('0xe5')]['hasMany'](db['CmHopper'],{'as':_0xa7e0('0x145'),'foreignKey':_0xa7e0('0x19d')});db[_0xa7e0('0xe5')][_0xa7e0('0x112')](db['CmHopperFinal'],{'as':_0xa7e0('0x1d8'),'foreignKey':_0xa7e0('0x19d')});db['Campaign'][_0xa7e0('0x112')](db[_0xa7e0('0x73')],{'as':_0xa7e0('0x147'),'foreignKey':_0xa7e0('0x19d')});db[_0xa7e0('0xe5')][_0xa7e0('0x112')](db[_0xa7e0('0x148')],{'as':_0xa7e0('0x149'),'foreignKey':_0xa7e0('0x19d')});db[_0xa7e0('0xe5')][_0xa7e0('0x14c')](db[_0xa7e0('0x14b')],{'as':'Trunk','foreignKey':_0xa7e0('0x1d9')});db[_0xa7e0('0xe5')][_0xa7e0('0x14c')](db[_0xa7e0('0x14b')],{'as':_0xa7e0('0x14d'),'foreignKey':_0xa7e0('0x14e')});db['Campaign']['belongsTo'](db[_0xa7e0('0x7f')],{'as':'Interval','foreignKey':'IntervalId'});db[_0xa7e0('0xe5')]['belongsTo'](db[_0xa7e0('0xdd')],{'as':_0xa7e0('0xdd'),'foreignKey':'SquareProjectId'});db[_0xa7e0('0xe5')]['belongsToMany'](db[_0xa7e0('0xf1')],{'as':_0xa7e0('0x123'),'through':'campaigns_has_cm_lists'});db[_0xa7e0('0xe5')][_0xa7e0('0x11f')](db['CmList'],{'as':_0xa7e0('0x1da'),'through':_0xa7e0('0x1db')});db[_0xa7e0('0xe7')]['belongsTo'](db[_0xa7e0('0x66')],{'as':_0xa7e0('0x66'),'foreignKey':_0xa7e0('0x194')});db['MailTransferReport']['belongsTo'](db[_0xa7e0('0x3c')],{});db['MailTransferReport'][_0xa7e0('0x14c')](db[_0xa7e0('0x3b')],{});db[_0xa7e0('0x1dc')]['belongsTo'](db[_0xa7e0('0x36')],{'foreignKey':_0xa7e0('0x1dd'),'as':'FromAccount'});db['MailTransferReport'][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'foreignKey':'FromUserId','as':_0xa7e0('0x1de')});db['MailTransferReport'][_0xa7e0('0x14c')](db['User'],{'foreignKey':'ToUserId','as':_0xa7e0('0x1df')});db['MailTransferReport'][_0xa7e0('0x14c')](db['MailQueue'],{'foreignKey':_0xa7e0('0x1e0'),'as':_0xa7e0('0x1e1')});db[_0xa7e0('0x1dc')][_0xa7e0('0x14c')](db['MailAccount'],{'foreignKey':_0xa7e0('0x1e2'),'as':_0xa7e0('0x1e3')});db[_0xa7e0('0xea')][_0xa7e0('0x14c')](db[_0xa7e0('0x65')],{});db['ChatTransferReport'][_0xa7e0('0x14c')](db[_0xa7e0('0x118')],{});db[_0xa7e0('0xea')]['belongsTo'](db[_0xa7e0('0x171')],{'foreignKey':_0xa7e0('0x1e4'),'as':_0xa7e0('0x1e5')});db[_0xa7e0('0xea')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'foreignKey':'FromUserId','as':_0xa7e0('0x1de')});db[_0xa7e0('0xea')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'foreignKey':_0xa7e0('0x1e6'),'as':_0xa7e0('0x1df')});db[_0xa7e0('0xea')][_0xa7e0('0x14c')](db[_0xa7e0('0x68')],{'foreignKey':_0xa7e0('0x1e7'),'as':_0xa7e0('0x1e1')});db[_0xa7e0('0xea')][_0xa7e0('0x14c')](db[_0xa7e0('0x171')],{'foreignKey':_0xa7e0('0x1e8'),'as':_0xa7e0('0x1e3')});db[_0xa7e0('0xec')][_0xa7e0('0x14c')](db[_0xa7e0('0x4a')],{});db[_0xa7e0('0xec')]['belongsTo'](db[_0xa7e0('0x48')],{});db[_0xa7e0('0xec')][_0xa7e0('0x14c')](db[_0xa7e0('0x45')],{'foreignKey':'FromFaxAccountId','as':_0xa7e0('0x1e5')});db[_0xa7e0('0xec')][_0xa7e0('0x14c')](db['User'],{'foreignKey':_0xa7e0('0x1e9'),'as':_0xa7e0('0x1de')});db[_0xa7e0('0xec')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'foreignKey':'ToUserId','as':_0xa7e0('0x1df')});db[_0xa7e0('0xec')][_0xa7e0('0x14c')](db['FaxQueue'],{'foreignKey':_0xa7e0('0x1ea'),'as':_0xa7e0('0x1e1')});db['FaxTransferReport'][_0xa7e0('0x14c')](db[_0xa7e0('0x45')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db['OpenchannelTransferReport'][_0xa7e0('0x14c')](db['OpenchannelMessage'],{});db[_0xa7e0('0xee')]['belongsTo'](db[_0xa7e0('0x116')],{});db[_0xa7e0('0xee')][_0xa7e0('0x14c')](db[_0xa7e0('0x58')],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db['OpenchannelTransferReport'][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xa7e0('0xee')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'foreignKey':_0xa7e0('0x1e6'),'as':_0xa7e0('0x1df')});db['OpenchannelTransferReport'][_0xa7e0('0x14c')](db[_0xa7e0('0x5e')],{'foreignKey':_0xa7e0('0x1eb'),'as':'ToQueue'});db[_0xa7e0('0xee')][_0xa7e0('0x14c')](db[_0xa7e0('0x58')],{'foreignKey':_0xa7e0('0x1ec'),'as':_0xa7e0('0x1e3')});db[_0xa7e0('0x1ed')][_0xa7e0('0x14c')](db['SmsMessage'],{});db[_0xa7e0('0x1ed')][_0xa7e0('0x14c')](db['SmsInteraction'],{});db[_0xa7e0('0x1ed')][_0xa7e0('0x14c')](db[_0xa7e0('0x4e')],{'foreignKey':_0xa7e0('0x1ee'),'as':_0xa7e0('0x1e5')});db['SmsTransferReport'][_0xa7e0('0x14c')](db['User'],{'foreignKey':'FromUserId','as':_0xa7e0('0x1de')});db[_0xa7e0('0x1ed')][_0xa7e0('0x14c')](db['User'],{'foreignKey':_0xa7e0('0x1e6'),'as':_0xa7e0('0x1df')});db[_0xa7e0('0x1ed')]['belongsTo'](db[_0xa7e0('0x56')],{'foreignKey':_0xa7e0('0x1ef'),'as':_0xa7e0('0x1e1')});db[_0xa7e0('0x1ed')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0xa7e0('0x1f0'),'as':'ToAccount'});db['CmList'][_0xa7e0('0x112')](db[_0xa7e0('0x15f')],{'as':_0xa7e0('0x160'),'foreignKey':_0xa7e0('0x163'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0xf1')][_0xa7e0('0x112')](db['CmCustomField'],{'as':'CustomFields','foreignKey':_0xa7e0('0x163')});db[_0xa7e0('0xf1')][_0xa7e0('0x112')](db[_0xa7e0('0x6e')],{'as':_0xa7e0('0x196'),'onDelete':_0xa7e0('0x111'),'foreignKey':'ListId'});db[_0xa7e0('0xf1')][_0xa7e0('0x112')](db[_0xa7e0('0x146')],{'as':_0xa7e0('0x1d8'),'foreignKey':_0xa7e0('0x163')});db['CmList'][_0xa7e0('0x112')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0xa7e0('0x163')});db[_0xa7e0('0xf1')][_0xa7e0('0x112')](db[_0xa7e0('0x74')],{'as':_0xa7e0('0x74'),'foreignKey':'ListId'});db[_0xa7e0('0xf1')][_0xa7e0('0x11f')](db[_0xa7e0('0x1a')],{'as':_0xa7e0('0x1f1'),'through':_0xa7e0('0x1f2')});db[_0xa7e0('0xf1')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':'Agents','through':_0xa7e0('0x132')});db['VoicePrefix']['hasMany'](db['VoiceExtension'],{'as':_0xa7e0('0x115'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0xf3')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':'Agents','through':_0xa7e0('0x1f3')});db[_0xa7e0('0xf3')][_0xa7e0('0x11f')](db[_0xa7e0('0x151')],{'through':_0xa7e0('0x108'),'as':'Teams'});db['UserProfile'][_0xa7e0('0x112')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x16c'),'foreignKey':_0xa7e0('0x1f4')});db[_0xa7e0('0xf5')]['hasMany'](db[_0xa7e0('0xf6')],{'as':_0xa7e0('0x1f5'),'foreignKey':'userProfileId','onDelete':'cascade'});db[_0xa7e0('0xf6')][_0xa7e0('0x112')](db[_0xa7e0('0xf8')],{'as':_0xa7e0('0x1f6'),'foreignKey':_0xa7e0('0x1f7'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0xf9')][_0xa7e0('0x112')](db[_0xa7e0('0x15f')],{'as':_0xa7e0('0x160'),'foreignKey':_0xa7e0('0x1f8'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0xf9')]['hasMany'](db[_0xa7e0('0x7b')],{'as':_0xa7e0('0x161'),'foreignKey':_0xa7e0('0x1f8')});db[_0xa7e0('0xf9')][_0xa7e0('0x112')](db['WhatsappMessage'],{'as':_0xa7e0('0x154'),'foreignKey':_0xa7e0('0x1f8')});db['WhatsappAccount'][_0xa7e0('0x112')](db[_0xa7e0('0xfc')],{'as':_0xa7e0('0x176')});db[_0xa7e0('0xf9')][_0xa7e0('0x112')](db[_0xa7e0('0x1f9')],{'as':_0xa7e0('0x13f')});db['WhatsappAccount'][_0xa7e0('0x14c')](db[_0xa7e0('0xf1')],{'as':_0xa7e0('0x162'),'foreignKey':_0xa7e0('0x163')});db[_0xa7e0('0xf9')][_0xa7e0('0x14c')](db[_0xa7e0('0x80')],{'as':_0xa7e0('0x165'),'foreignKey':_0xa7e0('0x166')});db[_0xa7e0('0xf9')][_0xa7e0('0x11f')](db['User'],{'as':'Agents','through':_0xa7e0('0x13c')});db['WhatsappApplication'][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x1f9')][_0xa7e0('0x14c')](db[_0xa7e0('0x103')],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x1f9')][_0xa7e0('0x14c')](db[_0xa7e0('0xf9')],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x1f9')][_0xa7e0('0x14c')](db[_0xa7e0('0x7f')],{'onDelete':_0xa7e0('0x15c'),'foreignKey':_0xa7e0('0x14f')});db['WhatsappApplication'][_0xa7e0('0x14c')](db[_0xa7e0('0x88')],{'onDelete':'restrict','foreignKey':_0xa7e0('0x172')});db[_0xa7e0('0xfc')][_0xa7e0('0x112')](db[_0xa7e0('0x1fa')],{'as':_0xa7e0('0x154'),'onDelete':'cascade','foreignKey':_0xa7e0('0x1fb')});db[_0xa7e0('0xfc')]['belongsTo'](db[_0xa7e0('0xf9')],{'as':'Account','foreignKey':_0xa7e0('0x1f8')});db['WhatsappInteraction'][_0xa7e0('0x14c')](db[_0xa7e0('0x6e')],{'as':'Contact','foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0xfc')]['belongsTo'](db[_0xa7e0('0x12')],{'as':'Owner','foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0xfc')][_0xa7e0('0x11f')](db[_0xa7e0('0x88')],{'through':_0xa7e0('0x1af'),'as':_0xa7e0('0x16b')});db['WhatsappInteraction']['belongsToMany'](db['Tag'],{'through':_0xa7e0('0x1af'),'as':_0xa7e0('0x179')});db[_0xa7e0('0xfc')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':'Users','through':'user_has_whatsapp_interactions','foreignKey':_0xa7e0('0x1fb')});db['WhatsappMessage'][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x12')});db['WhatsappMessage']['belongsTo'](db[_0xa7e0('0x6e')],{'onDelete':_0xa7e0('0x111'),'as':'Contact'});db[_0xa7e0('0x1fa')][_0xa7e0('0x14c')](db[_0xa7e0('0xfc')],{'onDelete':_0xa7e0('0x111'),'as':_0xa7e0('0x16f'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage']['belongsTo'](db['WhatsappAccount'],{'as':_0xa7e0('0x170'),'foreignKey':'WhatsappAccountId'});db[_0xa7e0('0xff')][_0xa7e0('0x14c')](db[_0xa7e0('0xf9')],{});db[_0xa7e0('0xff')][_0xa7e0('0x14c')](db[_0xa7e0('0xf1')],{'as':'List','foreignKey':_0xa7e0('0x163')});db[_0xa7e0('0xff')]['belongsTo'](db[_0xa7e0('0x6e')],{'as':'Contact','foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0xff')][_0xa7e0('0x14c')](db[_0xa7e0('0xfc')],{});db[_0xa7e0('0xff')][_0xa7e0('0x14c')](db['WhatsappQueue'],{});db['WhatsappQueueReport'][_0xa7e0('0x14c')](db[_0xa7e0('0x1fa')],{});db[_0xa7e0('0xff')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{});db[_0xa7e0('0x101')][_0xa7e0('0x14c')](db[_0xa7e0('0x1fa')],{});db[_0xa7e0('0x101')][_0xa7e0('0x14c')](db[_0xa7e0('0xfc')],{});db['WhatsappTransferReport']['belongsTo'](db[_0xa7e0('0xf9')],{'foreignKey':_0xa7e0('0x1fc'),'as':_0xa7e0('0x1e5')});db[_0xa7e0('0x101')][_0xa7e0('0x14c')](db[_0xa7e0('0xf9')],{'foreignKey':_0xa7e0('0x1fd'),'as':'ToAccount'});db[_0xa7e0('0x101')][_0xa7e0('0x14c')](db[_0xa7e0('0x103')],{'foreignKey':_0xa7e0('0x1fe'),'as':_0xa7e0('0x1e1')});db[_0xa7e0('0x101')]['belongsTo'](db[_0xa7e0('0x12')],{'foreignKey':_0xa7e0('0x1e9'),'as':_0xa7e0('0x1de')});db[_0xa7e0('0x101')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'foreignKey':'ToUserId','as':_0xa7e0('0x1df')});db[_0xa7e0('0x103')]['belongsToMany'](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x150'),'through':_0xa7e0('0x30'),'foreignKey':_0xa7e0('0x1ff')});db[_0xa7e0('0x103')]['belongsToMany'](db[_0xa7e0('0x151')],{'through':_0xa7e0('0x1d6'),'as':_0xa7e0('0x152')});db[_0xa7e0('0x10b')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x200'),'foreignKey':_0xa7e0('0x10f'),'onDelete':_0xa7e0('0x111'),'hooks':!![]});db[_0xa7e0('0x105')]['hasOne'](db['Dynamics365Account'],{'as':_0xa7e0('0xc2'),'onDelete':'restrict'});db[_0xa7e0('0x105')][_0xa7e0('0x10d')](db[_0xa7e0('0x32')],{'as':_0xa7e0('0x15e'),'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x105')][_0xa7e0('0x10d')](db[_0xa7e0('0x34')],{'as':_0xa7e0('0x201'),'onDelete':'restrict'});module[_0xa7e0('0x202')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index b7c3e8b..0b9296a 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x12db=['./api/intServicenowAccount','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','/api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/pm2','/api/logs','join','root','/apidoc','/www','static','/demo','/snippet','3.1.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/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/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/queues','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/actions','./api/action','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/schedules','./api/schedule','/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/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intDeskAccount','/api/integrations/desk/fields','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts'];(function(_0x1b835e,_0x242188){var _0x1f30b9=function(_0x5b7a8e){while(--_0x5b7a8e){_0x1b835e['push'](_0x1b835e['shift']());}};_0x1f30b9(++_0x242188);}(_0x12db,0x67));var _0xb12d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x12db[_0x1facfa];return _0x9ec701;};'use strict';var path=require(_0xb12d('0x0'));var express=require(_0xb12d('0x1'));var errors=require(_0xb12d('0x2'));var config=require(_0xb12d('0x3'));var setupLoggers=require(_0xb12d('0x4'))[_0xb12d('0x5')];var clientSideLogs=require(_0xb12d('0x6'));exports[_0xb12d('0x7')]=function(_0x27af32){return setupLoggers(_0x27af32)[_0xb12d('0x8')](function(){_0x27af32['use'](_0xb12d('0x9'),require(_0xb12d('0xa')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xc'),require(_0xb12d('0xd')));_0x27af32['use'](_0xb12d('0xe'),require(_0xb12d('0xf')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x10'),require(_0xb12d('0x11')));_0x27af32[_0xb12d('0xb')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x27af32[_0xb12d('0xb')](_0xb12d('0x12'),require(_0xb12d('0x13')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x14'),require(_0xb12d('0x15')));_0x27af32['use']('/api/screen/recordings',require(_0xb12d('0x16')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x17'),require(_0xb12d('0x18')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x19'),require(_0xb12d('0x1a')));_0x27af32[_0xb12d('0xb')]('/api/voice/calls/reports',require(_0xb12d('0x1b')));_0x27af32['use']('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x27af32[_0xb12d('0xb')](_0xb12d('0x1c'),require(_0xb12d('0x1d')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x1e'),require('./api/voiceQueueReport'));_0x27af32['use']('/api/members/reports',require(_0xb12d('0x1f')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x20'),require(_0xb12d('0x21')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x22'),require(_0xb12d('0x23')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x24'),require('./api/mailServerOut'));_0x27af32[_0xb12d('0xb')](_0xb12d('0x25'),require('./api/mailAccount'));_0x27af32[_0xb12d('0xb')](_0xb12d('0x26'),require(_0xb12d('0x27')));_0x27af32[_0xb12d('0xb')]('/api/mail/substatuses',require(_0xb12d('0x28')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x29'),require('./api/mailInteraction'));_0x27af32[_0xb12d('0xb')](_0xb12d('0x2a'),require(_0xb12d('0x2b')));_0x27af32['use'](_0xb12d('0x2c'),require(_0xb12d('0x2d')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x2e'),require(_0xb12d('0x2f')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x30'),require(_0xb12d('0x31')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x32'),require(_0xb12d('0x33')));_0x27af32['use']('/api/fax/accounts',require('./api/faxAccount'));_0x27af32[_0xb12d('0xb')]('/api/fax/applications',require(_0xb12d('0x34')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x35'),require(_0xb12d('0x36')));_0x27af32[_0xb12d('0xb')]('/api/fax/messages',require('./api/faxMessage'));_0x27af32[_0xb12d('0xb')](_0xb12d('0x37'),require('./api/faxQueue'));_0x27af32[_0xb12d('0xb')]('/api/fax/reports/queue',require(_0xb12d('0x38')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x39'),require('./api/smsAccount'));_0x27af32[_0xb12d('0xb')](_0xb12d('0x3a'),require(_0xb12d('0x3b')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x3c'),require(_0xb12d('0x3d')));_0x27af32[_0xb12d('0xb')]('/api/sms/messages',require(_0xb12d('0x3e')));_0x27af32['use'](_0xb12d('0x3f'),require('./api/smsQueue'));_0x27af32[_0xb12d('0xb')](_0xb12d('0x40'),require(_0xb12d('0x41')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x42'),require(_0xb12d('0x43')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x44'),require(_0xb12d('0x45')));_0x27af32['use']('/api/openchannel/messages',require(_0xb12d('0x46')));_0x27af32[_0xb12d('0xb')]('/api/openchannel/queues',require(_0xb12d('0x47')));_0x27af32['use'](_0xb12d('0x48'),require(_0xb12d('0x49')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x4a'),require(_0xb12d('0x4b')));_0x27af32['use'](_0xb12d('0x4c'),require('./api/chatApplication'));_0x27af32[_0xb12d('0xb')](_0xb12d('0x4d'),require('./api/chatInteraction'));_0x27af32[_0xb12d('0xb')]('/api/chat/messages',require(_0xb12d('0x4e')));_0x27af32['use'](_0xb12d('0x4f'),require('./api/chatOfflineMessage'));_0x27af32['use'](_0xb12d('0x50'),require('./api/chatQueue'));_0x27af32['use'](_0xb12d('0x51'),require(_0xb12d('0x52')));_0x27af32['use'](_0xb12d('0x53'),require('./api/chatProactiveAction'));_0x27af32[_0xb12d('0xb')]('/api/cm/companies',require('./api/cmCompany'));_0x27af32['use']('/api/cm/contacts',require(_0xb12d('0x54')));_0x27af32['use'](_0xb12d('0x55'),require(_0xb12d('0x56')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x57'),require(_0xb12d('0x58')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x59'),require(_0xb12d('0x5a')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x5b'),require(_0xb12d('0x5c')));_0x27af32[_0xb12d('0xb')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x27af32[_0xb12d('0xb')](_0xb12d('0x5d'),require(_0xb12d('0x5e')));_0x27af32[_0xb12d('0xb')]('/api/automations',require(_0xb12d('0x5f')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x60'),require('./api/cannedAnswer'));_0x27af32[_0xb12d('0xb')](_0xb12d('0x61'),require(_0xb12d('0x62')));_0x27af32['use'](_0xb12d('0x63'),require(_0xb12d('0x64')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x65'),require(_0xb12d('0x66')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x67'),require('./api/pause'));_0x27af32[_0xb12d('0xb')](_0xb12d('0x68'),require(_0xb12d('0x69')));_0x27af32[_0xb12d('0xb')]('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0x27af32[_0xb12d('0xb')](_0xb12d('0x6a'),require(_0xb12d('0x6b')));_0x27af32['use'](_0xb12d('0x6c'),require('./api/sound'));_0x27af32[_0xb12d('0xb')](_0xb12d('0x6d'),require(_0xb12d('0x6e')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x6f'),require(_0xb12d('0x70')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x71'),require(_0xb12d('0x72')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x73'),require(_0xb12d('0x74')));_0x27af32['use'](_0xb12d('0x75'),require(_0xb12d('0x76')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x77'),require('./api/trigger'));_0x27af32['use'](_0xb12d('0x78'),require(_0xb12d('0x79')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x7a'),require('./api/integration'));_0x27af32['use'](_0xb12d('0x7b'),require('./api/integrationReport'));_0x27af32['use'](_0xb12d('0x7c'),require(_0xb12d('0x7d')));_0x27af32['use'](_0xb12d('0x7e'),require(_0xb12d('0x7f')));_0x27af32[_0xb12d('0xb')]('/api/analytics/extracted_reports',require(_0xb12d('0x80')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x81'),require('./api/analyticMetric'));_0x27af32[_0xb12d('0xb')](_0xb12d('0x82'),require(_0xb12d('0x83')));_0x27af32['use'](_0xb12d('0x84'),require(_0xb12d('0x85')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x86'),require(_0xb12d('0x87')));_0x27af32[_0xb12d('0xb')]('/api/integrations/salesforce/configurations',require(_0xb12d('0x88')));_0x27af32['use']('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x27af32['use'](_0xb12d('0x89'),require('./api/intSugarcrmAccount'));_0x27af32[_0xb12d('0xb')](_0xb12d('0x8a'),require(_0xb12d('0x8b')));_0x27af32['use'](_0xb12d('0x8c'),require('./api/intSugarcrmField'));_0x27af32[_0xb12d('0xb')]('/api/integrations/desk/accounts',require(_0xb12d('0x8d')));_0x27af32[_0xb12d('0xb')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x27af32['use'](_0xb12d('0x8e'),require('./api/intDeskField'));_0x27af32['use']('/api/integrations/zoho/accounts',require(_0xb12d('0x8f')));_0x27af32[_0xb12d('0xb')]('/api/integrations/zoho/configurations',require(_0xb12d('0x90')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x91'),require('./api/intZohoField'));_0x27af32[_0xb12d('0xb')](_0xb12d('0x92'),require('./api/intZendeskAccount'));_0x27af32[_0xb12d('0xb')](_0xb12d('0x93'),require(_0xb12d('0x94')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x95'),require(_0xb12d('0x96')));_0x27af32['use'](_0xb12d('0x97'),require(_0xb12d('0x98')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x99'),require(_0xb12d('0x9a')));_0x27af32[_0xb12d('0xb')](_0xb12d('0x9b'),require(_0xb12d('0x9c')));_0x27af32[_0xb12d('0xb')]('/api/integrations/vtiger/accounts',require(_0xb12d('0x9d')));_0x27af32[_0xb12d('0xb')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x27af32[_0xb12d('0xb')](_0xb12d('0x9e'),require(_0xb12d('0x9f')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xa0'),require(_0xb12d('0xa1')));_0x27af32[_0xb12d('0xb')]('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x27af32[_0xb12d('0xb')](_0xb12d('0xa2'),require('./api/intServicenowField'));_0x27af32['use'](_0xb12d('0xa3'),require(_0xb12d('0xa4')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xa5'),require(_0xb12d('0xa6')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xa7'),require(_0xb12d('0xa8')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xa9'),require(_0xb12d('0xaa')));_0x27af32[_0xb12d('0xb')]('/api/integrations/freshsales/configurations',require(_0xb12d('0xab')));_0x27af32['use']('/api/integrations/freshsales/fields',require(_0xb12d('0xac')));_0x27af32['use'](_0xb12d('0xad'),require(_0xb12d('0xae')));_0x27af32['use'](_0xb12d('0xaf'),require(_0xb12d('0xb0')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xb1'),require(_0xb12d('0xb2')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xb3'),require('./api/jscriptyAnswerReport'));_0x27af32[_0xb12d('0xb')](_0xb12d('0xb4'),require(_0xb12d('0xb5')));_0x27af32[_0xb12d('0xb')]('/api/jscripty/sessions/reports',require(_0xb12d('0xb6')));_0x27af32['use'](_0xb12d('0xb7'),require(_0xb12d('0xb8')));_0x27af32[_0xb12d('0xb')]('/api/square/reports',require(_0xb12d('0xb9')));_0x27af32[_0xb12d('0xb')]('/api/square/details/reports',require(_0xb12d('0xba')));_0x27af32['use']('/api/jscripty/projects',require(_0xb12d('0xbb')));_0x27af32['use'](_0xb12d('0xbc'),require(_0xb12d('0xbd')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xbe'),require('./api/squareOdbc'));_0x27af32[_0xb12d('0xb')]('/api/square/projects',require(_0xb12d('0xbf')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xc0'),require(_0xb12d('0xc1')));_0x27af32['use'](_0xb12d('0xc2'),require(_0xb12d('0xc3')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xc4'),require(_0xb12d('0xc5')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xc6'),require(_0xb12d('0xc7')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xc8'),require(_0xb12d('0xc9')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xca'),require('./api/migration'));_0x27af32[_0xb12d('0xb')]('/api/attachments',require(_0xb12d('0xcb')));_0x27af32[_0xb12d('0xb')]('/api/plugins',require(_0xb12d('0xcc')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xcd'),require(_0xb12d('0xce')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xcf'),require(_0xb12d('0xd0')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xd1'),require(_0xb12d('0xd2')));_0x27af32[_0xb12d('0xb')]('/api/openchannel/reports/transfer',require(_0xb12d('0xd3')));_0x27af32['use'](_0xb12d('0xd4'),require(_0xb12d('0xd5')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xd6'),require(_0xb12d('0xd7')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xd8'),require(_0xb12d('0xd9')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xda'),require('./api/userProfile'));_0x27af32[_0xb12d('0xb')]('/api/userProfile/sections',require(_0xb12d('0xdb')));_0x27af32['use'](_0xb12d('0xdc'),require(_0xb12d('0xdd')));_0x27af32['use'](_0xb12d('0xde'),require(_0xb12d('0xdf')));_0x27af32['use']('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x27af32[_0xb12d('0xb')](_0xb12d('0xe0'),require(_0xb12d('0xe1')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xe2'),require('./api/whatsappInteraction'));_0x27af32[_0xb12d('0xb')](_0xb12d('0xe3'),require(_0xb12d('0xe4')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xe5'),require('./api/whatsappQueueReport'));_0x27af32[_0xb12d('0xb')]('/api/whatsapp/reports/transfer',require(_0xb12d('0xe6')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xe7'),require('./api/whatsappQueue'));_0x27af32[_0xb12d('0xb')](_0xb12d('0xe8'),require('./api/cloudProvider'));_0x27af32['use'](_0xb12d('0xe9'),require('./api/realtime'));_0x27af32[_0xb12d('0xb')](_0xb12d('0xea'),require(_0xb12d('0xeb')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xec'),require('./api/authLocal'));_0x27af32[_0xb12d('0xb')](_0xb12d('0xed'),require(_0xb12d('0xee')));_0x27af32['use'](_0xb12d('0xef'),require(_0xb12d('0xf0')));_0x27af32[_0xb12d('0xb')](_0xb12d('0xf1'),require('./api/jira'));_0x27af32[_0xb12d('0xb')](_0xb12d('0xf2'),require('./api/rpc'));_0x27af32[_0xb12d('0xb')](_0xb12d('0xf3'),require(_0xb12d('0xf4')));_0x27af32['use'](_0xb12d('0xf5'),require('./api/system'));_0x27af32[_0xb12d('0xb')]('/api/pm2',require(_0xb12d('0xf6')));_0x27af32[_0xb12d('0xb')]('/api/webbar',require('./api/webbar'));_0x27af32['use'](_0xb12d('0xf7'),clientSideLogs);_0x27af32[_0xb12d('0xb')]('/apidoc',express['static'](path[_0xb12d('0xf8')](config[_0xb12d('0xf9')],_0xb12d('0xfa'))));_0x27af32[_0xb12d('0xb')](_0xb12d('0xfb'),express[_0xb12d('0xfc')](path[_0xb12d('0xf8')](config[_0xb12d('0xf9')],_0xb12d('0xfb'))));_0x27af32[_0xb12d('0xb')](_0xb12d('0xfd'),express[_0xb12d('0xfc')](path[_0xb12d('0xf8')](config[_0xb12d('0xf9')],_0xb12d('0xfd'))));_0x27af32['use'](_0xb12d('0xfe'),express['static'](path[_0xb12d('0xf8')](config[_0xb12d('0xf9')],'snippet',_0xb12d('0xff'))));_0x27af32[_0xb12d('0xb')](_0xb12d('0x100'),express[_0xb12d('0xfc')](path[_0xb12d('0xf8')](config[_0xb12d('0xf9')],_0xb12d('0x101'))));_0x27af32[_0xb12d('0x102')](_0xb12d('0x103'))[_0xb12d('0x104')](errors[0x194]);_0x27af32['route']('/*')[_0xb12d('0x104')](function(_0x2e03bc,_0x46313b){_0x46313b['sendFile'](path[_0xb12d('0x105')](_0x27af32[_0xb12d('0x104')](_0xb12d('0x106'))+_0xb12d('0x107')));});return _0x27af32;});}; \ No newline at end of file +var _0xb631=['./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','3.1.0','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','./errors','./config/environment','setupLoggers','default','then','/api/users','use','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations'];(function(_0xc0ebd3,_0x30a6ac){var _0x5ac54a=function(_0x56cb42){while(--_0x56cb42){_0xc0ebd3['push'](_0xc0ebd3['shift']());}};_0x5ac54a(++_0x30a6ac);}(_0xb631,0x8a));var _0x1b63=function(_0x49f450,_0x236469){_0x49f450=_0x49f450-0x0;var _0x3253b2=_0xb631[_0x49f450];return _0x3253b2;};'use strict';var path=require('path');var express=require('express');var errors=require(_0x1b63('0x0'));var config=require(_0x1b63('0x1'));var setupLoggers=require('./utils/client-side-logger')[_0x1b63('0x2')];var clientSideLogs=require('./api/client-side-logs');exports[_0x1b63('0x3')]=function(_0x5a0818){return setupLoggers(_0x5a0818)[_0x1b63('0x4')](function(){_0x5a0818['use'](_0x1b63('0x5'),require('./api/user'));_0x5a0818[_0x1b63('0x6')]('/api/voice/chanspy',require(_0x1b63('0x7')));_0x5a0818['use'](_0x1b63('0x8'),require(_0x1b63('0x9')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xa'),require(_0x1b63('0xb')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xc'),require(_0x1b63('0xd')));_0x5a0818['use']('/api/voice/queues',require(_0x1b63('0xe')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xf'),require(_0x1b63('0x10')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x11'),require(_0x1b63('0x12')));_0x5a0818['use'](_0x1b63('0x13'),require('./api/voiceMail'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x14'),require(_0x1b63('0x15')));_0x5a0818['use']('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x5a0818[_0x1b63('0x6')]('/api/voice/dials/reports',require(_0x1b63('0x16')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x17'),require(_0x1b63('0x18')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x19'),require('./api/voiceQueueReport'));_0x5a0818[_0x1b63('0x6')]('/api/members/reports',require('./api/memberReport'));_0x5a0818['use'](_0x1b63('0x1a'),require(_0x1b63('0x1b')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x1c'),require(_0x1b63('0x1d')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x1e'),require('./api/mailServerOut'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x1f'),require(_0x1b63('0x20')));_0x5a0818['use'](_0x1b63('0x21'),require(_0x1b63('0x22')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x23'),require(_0x1b63('0x24')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x25'),require(_0x1b63('0x26')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x27'),require('./api/mailMessage'));_0x5a0818[_0x1b63('0x6')]('/api/mail/applications',require(_0x1b63('0x28')));_0x5a0818['use'](_0x1b63('0x29'),require(_0x1b63('0x2a')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x2b'),require('./api/dashboard'));_0x5a0818['use'](_0x1b63('0x2c'),require(_0x1b63('0x2d')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x2e'),require(_0x1b63('0x2f')));_0x5a0818['use']('/api/fax/applications',require(_0x1b63('0x30')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x31'),require('./api/faxInteraction'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x32'),require(_0x1b63('0x33')));_0x5a0818['use'](_0x1b63('0x34'),require(_0x1b63('0x35')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x36'),require(_0x1b63('0x37')));_0x5a0818[_0x1b63('0x6')]('/api/sms/accounts',require(_0x1b63('0x38')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x39'),require('./api/smsApplication'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x3a'),require(_0x1b63('0x3b')));_0x5a0818[_0x1b63('0x6')]('/api/sms/messages',require(_0x1b63('0x3c')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x3d'),require(_0x1b63('0x3e')));_0x5a0818[_0x1b63('0x6')]('/api/openchannel/accounts',require(_0x1b63('0x3f')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x40'),require(_0x1b63('0x41')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x42'),require(_0x1b63('0x43')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x44'),require(_0x1b63('0x45')));_0x5a0818[_0x1b63('0x6')]('/api/openchannel/queues',require(_0x1b63('0x46')));_0x5a0818['use'](_0x1b63('0x47'),require('./api/chatWebsite'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x48'),require(_0x1b63('0x49')));_0x5a0818['use'](_0x1b63('0x4a'),require('./api/chatApplication'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x4b'),require('./api/chatInteraction'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x4c'),require(_0x1b63('0x4d')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x4e'),require(_0x1b63('0x4f')));_0x5a0818[_0x1b63('0x6')]('/api/chat/queues',require('./api/chatQueue'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x50'),require(_0x1b63('0x51')));_0x5a0818[_0x1b63('0x6')]('/api/chat/proactive_actions',require(_0x1b63('0x52')));_0x5a0818['use']('/api/cm/companies',require(_0x1b63('0x53')));_0x5a0818['use'](_0x1b63('0x54'),require(_0x1b63('0x55')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x56'),require(_0x1b63('0x57')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x58'),require(_0x1b63('0x59')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x5a'),require(_0x1b63('0x5b')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x5c'),require(_0x1b63('0x5d')));_0x5a0818[_0x1b63('0x6')]('/api/cm/custom_fields',require(_0x1b63('0x5e')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x5f'),require(_0x1b63('0x60')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x61'),require(_0x1b63('0x62')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x63'),require('./api/cannedAnswer'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x64'),require('./api/disposition'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x65'),require(_0x1b63('0x66')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x67'),require(_0x1b63('0x68')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x69'),require(_0x1b63('0x6a')));_0x5a0818['use'](_0x1b63('0x6b'),require('./api/cdr'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x6c'),require('./api/voiceQueuesLog'));_0x5a0818['use'](_0x1b63('0x6d'),require(_0x1b63('0x6e')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x6f'),require(_0x1b63('0x70')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x71'),require(_0x1b63('0x72')));_0x5a0818[_0x1b63('0x6')]('/api/contact_item_types',require(_0x1b63('0x73')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x74'),require(_0x1b63('0x75')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x76'),require('./api/cmHopperAdditionalPhone'));_0x5a0818['use'](_0x1b63('0x77'),require('./api/template'));_0x5a0818[_0x1b63('0x6')]('/api/triggers',require(_0x1b63('0x78')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x79'),require('./api/variable'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x7a'),require(_0x1b63('0x7b')));_0x5a0818['use'](_0x1b63('0x7c'),require(_0x1b63('0x7d')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x7e'),require(_0x1b63('0x7f')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x80'),require(_0x1b63('0x81')));_0x5a0818[_0x1b63('0x6')]('/api/analytics/extracted_reports',require(_0x1b63('0x82')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x83'),require(_0x1b63('0x84')));_0x5a0818[_0x1b63('0x6')]('/api/analytics/field_reports',require(_0x1b63('0x85')));_0x5a0818[_0x1b63('0x6')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x86'),require(_0x1b63('0x87')));_0x5a0818['use']('/api/integrations/salesforce/configurations',require(_0x1b63('0x88')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x89'),require(_0x1b63('0x8a')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x8b'),require('./api/intSugarcrmAccount'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x8c'),require(_0x1b63('0x8d')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x8e'),require(_0x1b63('0x8f')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x90'),require(_0x1b63('0x91')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x92'),require(_0x1b63('0x93')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x94'),require(_0x1b63('0x95')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x96'),require('./api/intZohoAccount'));_0x5a0818[_0x1b63('0x6')]('/api/integrations/zoho/configurations',require(_0x1b63('0x97')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x98'),require(_0x1b63('0x99')));_0x5a0818[_0x1b63('0x6')]('/api/integrations/zendesk/accounts',require(_0x1b63('0x9a')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x9b'),require(_0x1b63('0x9c')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x9d'),require('./api/intZendeskField'));_0x5a0818['use'](_0x1b63('0x9e'),require(_0x1b63('0x9f')));_0x5a0818['use']('/api/integrations/freshdesk/configurations',require(_0x1b63('0xa0')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xa1'),require(_0x1b63('0xa2')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xa3'),require(_0x1b63('0xa4')));_0x5a0818['use'](_0x1b63('0xa5'),require(_0x1b63('0xa6')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xa7'),require(_0x1b63('0xa8')));_0x5a0818['use'](_0x1b63('0xa9'),require('./api/intServicenowAccount'));_0x5a0818['use'](_0x1b63('0xaa'),require(_0x1b63('0xab')));_0x5a0818[_0x1b63('0x6')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xac'),require(_0x1b63('0xad')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xae'),require(_0x1b63('0xaf')));_0x5a0818['use'](_0x1b63('0xb0'),require('./api/intDynamics365Field'));_0x5a0818[_0x1b63('0x6')]('/api/integrations/freshsales/accounts',require(_0x1b63('0xb1')));_0x5a0818['use'](_0x1b63('0xb2'),require('./api/intFreshsalesConfiguration'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xb3'),require(_0x1b63('0xb4')));_0x5a0818[_0x1b63('0x6')]('/api/networks',require(_0x1b63('0xb5')));_0x5a0818[_0x1b63('0x6')]('/api/chat/reports/queue',require(_0x1b63('0xb6')));_0x5a0818['use'](_0x1b63('0xb7'),require(_0x1b63('0xb8')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xb9'),require('./api/jscriptyAnswerReport'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xba'),require(_0x1b63('0xbb')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xbc'),require(_0x1b63('0xbd')));_0x5a0818['use'](_0x1b63('0xbe'),require(_0x1b63('0xbf')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xc0'),require(_0x1b63('0xc1')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xc2'),require(_0x1b63('0xc3')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xc4'),require('./api/jscriptyProject'));_0x5a0818[_0x1b63('0x6')]('/api/settings',require('./api/setting'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xc5'),require(_0x1b63('0xc6')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xc7'),require(_0x1b63('0xc8')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xc9'),require(_0x1b63('0xca')));_0x5a0818[_0x1b63('0x6')]('/api/square/messages',require(_0x1b63('0xcb')));_0x5a0818[_0x1b63('0x6')]('/api/teams',require(_0x1b63('0xcc')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xcd'),require(_0x1b63('0xce')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xcf'),require(_0x1b63('0xd0')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xd1'),require(_0x1b63('0xd2')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xd3'),require('./api/attachment'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xd4'),require('./api/plugin'));_0x5a0818[_0x1b63('0x6')]('/api/mail/reports/transfer',require(_0x1b63('0xd5')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xd6'),require(_0x1b63('0xd7')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xd8'),require('./api/faxTransferReport'));_0x5a0818[_0x1b63('0x6')]('/api/openchannel/reports/transfer',require(_0x1b63('0xd9')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xda'),require(_0x1b63('0xdb')));_0x5a0818['use'](_0x1b63('0xdc'),require(_0x1b63('0xdd')));_0x5a0818['use'](_0x1b63('0xde'),require(_0x1b63('0xdf')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xe0'),require(_0x1b63('0xe1')));_0x5a0818['use'](_0x1b63('0xe2'),require(_0x1b63('0xe3')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xe4'),require(_0x1b63('0xe5')));_0x5a0818[_0x1b63('0x6')]('/api/userNotifications',require('./api/userNotification'));_0x5a0818[_0x1b63('0x6')]('/api/whatsapp/accounts',require(_0x1b63('0xe6')));_0x5a0818['use'](_0x1b63('0xe7'),require(_0x1b63('0xe8')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xe9'),require(_0x1b63('0xea')));_0x5a0818[_0x1b63('0x6')]('/api/whatsapp/messages',require(_0x1b63('0xeb')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xec'),require(_0x1b63('0xed')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xee'),require(_0x1b63('0xef')));_0x5a0818['use'](_0x1b63('0xf0'),require(_0x1b63('0xf1')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xf2'),require(_0x1b63('0xf3')));_0x5a0818['use'](_0x1b63('0xf4'),require(_0x1b63('0xf5')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xf6'),require(_0x1b63('0xf7')));_0x5a0818[_0x1b63('0x6')]('/api/auth/local',require(_0x1b63('0xf8')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xf9'),require(_0x1b63('0xfa')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xfb'),require(_0x1b63('0xfc')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xfd'),require(_0x1b63('0xfe')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xff'),require(_0x1b63('0x100')));_0x5a0818['use'](_0x1b63('0x101'),require(_0x1b63('0x102')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x103'),require(_0x1b63('0x104')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x105'),require(_0x1b63('0x106')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x107'),require('./api/webbar'));_0x5a0818['use'](_0x1b63('0x108'),clientSideLogs);_0x5a0818['use'](_0x1b63('0x109'),express[_0x1b63('0x10a')](path['join'](config['root'],_0x1b63('0x109'))));_0x5a0818['use']('/www',express[_0x1b63('0x10a')](path[_0x1b63('0x10b')](config[_0x1b63('0x10c')],_0x1b63('0x10d'))));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x10e'),express[_0x1b63('0x10a')](path[_0x1b63('0x10b')](config[_0x1b63('0x10c')],_0x1b63('0x10e'))));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x10f'),express[_0x1b63('0x10a')](path[_0x1b63('0x10b')](config[_0x1b63('0x10c')],'snippet',_0x1b63('0x110'))));_0x5a0818['use']('/plugins',express[_0x1b63('0x10a')](path[_0x1b63('0x10b')](config['root'],_0x1b63('0x111'))));_0x5a0818['route'](_0x1b63('0x112'))[_0x1b63('0x113')](errors[0x194]);_0x5a0818['route']('/*')[_0x1b63('0x113')](function(_0xf4b1d5,_0x59965a){_0x59965a[_0x1b63('0x114')](path[_0x1b63('0x115')](_0x5a0818[_0x1b63('0x113')]('appPath')+_0x1b63('0x116')));});return _0x5a0818;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 78bbd53..11416ea 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6028=['../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','RPC\x20listening\x20on\x20','jayson/promise','lodash','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc'];(function(_0x583078,_0x5117f1){var _0x3683a5=function(_0x489882){while(--_0x489882){_0x583078['push'](_0x583078['shift']());}};_0x3683a5(++_0x5117f1);}(_0x6028,0xdf));var _0x8602=function(_0x406347,_0x3afc59){_0x406347=_0x406347-0x0;var _0x75e14e=_0x6028[_0x406347];return _0x75e14e;};'use strict';var jayson=require(_0x8602('0x0'));var _=require(_0x8602('0x1'));var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x124f8c,_0x270c0f){var _0x26e0f4={};_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require('../api/user/user.rpc'));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x3')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x4')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x5')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x6')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x7')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x8')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x9')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require('../api/memberReport/memberReport.rpc'));_0x26e0f4=_['merge'](_0x26e0f4,require(_0x8602('0xa')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0xb')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0xc')));_0x26e0f4=_['merge'](_0x26e0f4,require(_0x8602('0xd')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0xe')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0xf')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x10')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x11')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require('../api/mailApplication/mailApplication.rpc'));_0x26e0f4=_['merge'](_0x26e0f4,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x26e0f4=_['merge'](_0x26e0f4,require('../api/faxAccount/faxAccount.rpc'));_0x26e0f4=_['merge'](_0x26e0f4,require('../api/faxApplication/faxApplication.rpc'));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x12')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require('../api/faxMessage/faxMessage.rpc'));_0x26e0f4=_['merge'](_0x26e0f4,require('../api/faxQueue/faxQueue.rpc'));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x13')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x14')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x15')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require('../api/smsMessage/smsMessage.rpc'));_0x26e0f4=_['merge'](_0x26e0f4,require('../api/smsQueue/smsQueue.rpc'));_0x26e0f4=_['merge'](_0x26e0f4,require(_0x8602('0x16')));_0x26e0f4=_['merge'](_0x26e0f4,require(_0x8602('0x17')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x18')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x19')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x1a')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require('../api/chatInteraction/chatInteraction.rpc'));_0x26e0f4=_['merge'](_0x26e0f4,require(_0x8602('0x1b')));_0x26e0f4=_['merge'](_0x26e0f4,require(_0x8602('0x1c')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x1d')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x1e')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x1f')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x26e0f4=_['merge'](_0x26e0f4,require(_0x8602('0x20')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x21')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x22')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x23')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x24')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x25')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x26')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require('../api/trigger/trigger.rpc'));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x27')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x28')));_0x26e0f4=_['merge'](_0x26e0f4,require(_0x8602('0x29')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x2a')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x2b')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x2c')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x2d')));_0x26e0f4=_['merge'](_0x26e0f4,require(_0x8602('0x2e')));_0x26e0f4=_['merge'](_0x26e0f4,require(_0x8602('0x2f')));_0x26e0f4=_['merge'](_0x26e0f4,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x30')));_0x26e0f4=_['merge'](_0x26e0f4,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x31')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x32')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require('../api/squareProject/squareProject.rpc'));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require('../api/squareRecording/squareRecording.rpc'));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x33')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x34')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require('../api/attachment/attachment.rpc'));_0x26e0f4=_['merge'](_0x26e0f4,require(_0x8602('0x35')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x36')));_0x26e0f4=_['merge'](_0x26e0f4,require(_0x8602('0x37')));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x38')));_0x26e0f4=_['merge'](_0x26e0f4,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x26e0f4=_[_0x8602('0x2')](_0x26e0f4,require(_0x8602('0x39')));var _0x2cf722=jayson[_0x8602('0x3a')](_0x26e0f4)[_0x8602('0x3b')]();var _0xa0ee49=config[_0x8602('0x3c')]['port']||config[_0x8602('0x3d')]+0x1;var _0x16a041=config[_0x8602('0x3c')]['ip']||'localhost';_0x2cf722['on'](_0x8602('0x3e'),function(_0x4ce1b0){return _0x270c0f(_0x4ce1b0);});_0x2cf722['listen'](_0xa0ee49,_0x16a041,function(){console[_0x8602('0x3f')](_0x8602('0x40'),_0x16a041,_0xa0ee49);require('../config/triggers')['default']();return _0x124f8c(_0x8602('0x41')+_0x16a041+':'+_0xa0ee49);});});}; \ No newline at end of file +var _0x0aee=['../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc'];(function(_0x35e28d,_0x2bcf66){var _0x2b72d9=function(_0x1689a1){while(--_0x1689a1){_0x35e28d['push'](_0x35e28d['shift']());}};_0x2b72d9(++_0x2bcf66);}(_0x0aee,0x1a3));var _0xe0ae=function(_0x1bbd58,_0x3015e6){_0x1bbd58=_0x1bbd58-0x0;var _0x50fd62=_0x0aee[_0x1bbd58];return _0x50fd62;};'use strict';var jayson=require(_0xe0ae('0x0'));var _=require('lodash');var config=require(_0xe0ae('0x1'));exports['listen']=function(){return new Promise(function(_0x474185,_0x54aa83){var _0x4be96a={};_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x3')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require('../api/voiceExtension/voiceExtension.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x4')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x5')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x6')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x7')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x8')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x9')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0xa')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0xb')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0xc')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0xd')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0xe')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0xf')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x10')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x11')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x12')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x13')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x14')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x15')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x16')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x17')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x18')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x19')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x1a')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x1b')));_0x4be96a=_['merge'](_0x4be96a,require('../api/smsInteraction/smsInteraction.rpc'));_0x4be96a=_['merge'](_0x4be96a,require('../api/smsMessage/smsMessage.rpc'));_0x4be96a=_['merge'](_0x4be96a,require('../api/smsQueue/smsQueue.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x1c')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x1d')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x1e')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x1f')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x20')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x21')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x22')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x23')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x24')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x25')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x26')));_0x4be96a=_['merge'](_0x4be96a,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x27')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x28')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x29')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x2a')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x2b')));_0x4be96a=_['merge'](_0x4be96a,require('../api/trigger/trigger.rpc'));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x2c')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x2d')));_0x4be96a=_['merge'](_0x4be96a,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x2e')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x2f')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x30')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x31')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x32')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x4be96a=_['merge'](_0x4be96a,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x33')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x34')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require('../api/squareReport/squareReport.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x35')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x36')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require('../api/squareOdbc/squareOdbc.rpc'));_0x4be96a=_['merge'](_0x4be96a,require('../api/squareProject/squareProject.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x37')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require('../api/squareMessage/squareMessage.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x38')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x39')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x3a')));_0x4be96a=_['merge'](_0x4be96a,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x3b')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x3c')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x3d')));var _0x98faa=jayson[_0xe0ae('0x3e')](_0x4be96a)[_0xe0ae('0x3f')]();var _0x511249=config['rpc'][_0xe0ae('0x40')]||config[_0xe0ae('0x40')]+0x1;var _0x529742=config[_0xe0ae('0x41')]['ip']||_0xe0ae('0x42');_0x98faa['on'](_0xe0ae('0x43'),function(_0x4569c6){return _0x54aa83(_0x4569c6);});_0x98faa[_0xe0ae('0x44')](_0x511249,_0x529742,function(){console[_0xe0ae('0x45')](_0xe0ae('0x46'),_0x529742,_0x511249);require('../config/triggers')[_0xe0ae('0x47')]();return _0x474185(_0xe0ae('0x48')+_0x529742+':'+_0x511249);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 78a079b..630a7cc 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 _0xf295=['format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','setContext','setExtension','noop','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setTimeout','setEncoding','utf8','headers','emit','ready','toLowerCase','hangup','substring','520-Invalid','520\x20End\x20of\x20proper','function','no\x20code','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','close','inherits','prototype','sendRequest','sync','answer','beep'];(function(_0x4f0312,_0x2c2fb7){var _0x38eecd=function(_0x57b9f2){while(--_0x57b9f2){_0x4f0312['push'](_0x4f0312['shift']());}};_0x38eecd(++_0x2c2fb7);}(_0xf295,0x1bd));var _0x5f29=function(_0x189d48,_0x4cea66){_0x189d48=_0x189d48-0x0;var _0x5213ad=_0xf295[_0x189d48];return _0x5213ad;};'use strict';var util=require(_0x5f29('0x0'));var _=require(_0x5f29('0x1'));var EventEmitter=require(_0x5f29('0x2'))[_0x5f29('0x3')];var AGIReply=require(_0x5f29('0x4'));var AGIError=require(_0x5f29('0x5'));function AGIChannel(_0x1cbb17){var _0x32a1c3=this,_0x3ebb94=new AGIReply(),_0x594dd2=![],_0x5ab1a1={};EventEmitter[_0x5f29('0x6')](_0x32a1c3);_0x1cbb17['setEncoding']('utf8');_0x1cbb17[_0x5f29('0x7')](0x8*0x3c*0x3c*0x3e8);_0x3ebb94[_0x5f29('0x8')](_0x5f29('0x9'));_0x3ebb94['on'](_0x5f29('0xa'),function(_0x396eb0){for(var _0x4ee5b9 in _0x396eb0){_0x32a1c3[_0x4ee5b9]=_0x396eb0[_0x4ee5b9];}_0x32a1c3[_0x5f29('0xb')](_0x5f29('0xc'));});_0x3ebb94['on']('line',function(_0x4bb8e3){if(_0x4bb8e3[_0x5f29('0xd')]()==_0x5f29('0xe')){_0x32a1c3[_0x5f29('0xb')](_0x5f29('0xe'));return;}if(_0x4bb8e3[_0x5f29('0xf')](0x0,0xb)==_0x5f29('0x10')){_0x594dd2=!![];}if(_0x594dd2){_0x5ab1a1['rx']+=_0x4bb8e3+'\x0a';if(_0x4bb8e3['search'](_0x5f29('0x11'))!=-0x1){_0x594dd2=![];}}else{_0x5ab1a1['rx']=_0x4bb8e3;}if(_0x594dd2){return;}if(typeof _0x5ab1a1['cb']==_0x5f29('0x12')){var _0x5829d5=_0x5ab1a1['rx'][_0x5f29('0xf')](0x0,0x3),_0x16aa0c=null,_0x519afc=null;_0x5829d5=parseInt(_0x5829d5);if(isNaN(_0x5829d5)){_0x5ab1a1['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x5f29('0x13')});return;}if(_0x5829d5!=0xc8){_0x5ab1a1['cb'](null,{'code':_0x5829d5,'result':-0x1,'extra':'KO'});return;}_0x16aa0c=_0x5ab1a1['rx'][_0x5f29('0xf')](0x4)['replace']('result=','');if(_0x16aa0c[_0x5f29('0x14')]('\x20')!=-0x1){_0x16aa0c=_0x16aa0c[_0x5f29('0x15')](0x0,_0x16aa0c['indexOf']('\x20'));}if(_[_0x5f29('0x16')](_0x16aa0c,'-1')){_0x16aa0c=parseInt(_0x16aa0c);}_0x519afc=_0x5ab1a1['rx']['split']('\x20');if(_0x519afc[_0x5f29('0x17')]==0x3){_0x519afc=_0x519afc[0x2]['substring'](0x1,_0x519afc[0x2][_0x5f29('0x17')]-0x1);}else if(_0x519afc['length']>0x3){var _0x485063=/\((.+)\)/;var _0x45bd7f=_0x5ab1a1['rx'][_0x5f29('0x18')](_0x485063);if(_0x45bd7f){_0x519afc=_0x45bd7f[0x1];}else{_0x519afc=null;}}else{_0x519afc=null;}_0x5ab1a1['cb'](null,{'code':_0x5829d5,'result':_0x16aa0c,'extra':_0x519afc});}});_0x1cbb17['on']('error',function(_0x4fe3c7){_0x32a1c3[_0x5f29('0xb')](_0x5f29('0x19'),new AGIError(_0x5f29('0x1a'),_0x4fe3c7[_0x5f29('0x1b')]));});_0x1cbb17['on']('close',function(){_0x32a1c3[_0x5f29('0xb')]('close',new AGIError(_0x5f29('0x1c')));});_0x1cbb17['on'](_0x5f29('0x1d'),function(){_0x32a1c3['emit']('timeout',new AGIError(_0x5f29('0x1e')));_0x1cbb17[_0x5f29('0x1f')]();});_0x1cbb17[_0x5f29('0x20')](_0x3ebb94);this['command']=function(_0x58a5d0,_0x142578){var _0x58a5d0=_0x58a5d0||'',_0x142578=typeof _0x142578==_0x5f29('0x12')?_0x142578:new Function();_0x5ab1a1={'tx':_0x58a5d0,'rx':'','cb':_0x142578};_0x1cbb17[_0x5f29('0x21')](_0x58a5d0+'\x0a');},this[_0x5f29('0x22')]=function(){_0x1cbb17['destroy']();};}util[_0x5f29('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x5f29('0x24')][_0x5f29('0x25')]=function(_0x3cdab8){return this['command'][_0x5f29('0x26')](this,_0x3cdab8);};AGIChannel[_0x5f29('0x24')][_0x5f29('0x27')]=function(){return this[_0x5f29('0x25')]('ANSWER');};AGIChannel['prototype']['getData']=function(_0x489a11,_0x385ad4,_0x234f33){_0x489a11=_0x489a11===undefined?_0x5f29('0x28'):_0x489a11;_0x385ad4=_0x385ad4===undefined?'5':_0x385ad4;_0x234f33=_0x234f33===undefined?'1':_0x234f33;return this[_0x5f29('0x25')](util[_0x5f29('0x29')](_0x5f29('0x2a'),_0x489a11,_0x385ad4*0x3e8,_0x234f33));};AGIChannel[_0x5f29('0x24')]['noop']=function(_0x15ba06){_0x15ba06=_0x15ba06||'NO\x20MESSAGE';return this[_0x5f29('0x25')](util[_0x5f29('0x29')](_0x5f29('0x2b'),_0x15ba06));};AGIChannel[_0x5f29('0x24')][_0x5f29('0x2c')]=function(_0x24af27,_0x51e218){if(_[_0x5f29('0x2d')](_0x51e218)){return this['sendRequest'](util['format'](_0x5f29('0x2e'),_0x24af27,_0x51e218['join'](',')));}return this[_0x5f29('0x25')](util['format'](_0x5f29('0x2e'),_0x24af27,_0x51e218));};AGIChannel[_0x5f29('0x24')]['setContext']=function(_0x4b2c58){return this[_0x5f29('0x25')](util[_0x5f29('0x29')](_0x5f29('0x2f'),_0x4b2c58));};AGIChannel[_0x5f29('0x24')]['setExtension']=function(_0x32bb73){return this['sendRequest'](util[_0x5f29('0x29')](_0x5f29('0x30'),_0x32bb73));};AGIChannel[_0x5f29('0x24')][_0x5f29('0x31')]=function(_0x28922f){return this['sendRequest'](util['format'](_0x5f29('0x32'),_0x28922f));};AGIChannel[_0x5f29('0x24')][_0x5f29('0xe')]=function(){return this[_0x5f29('0x25')](_0x5f29('0x33'));};AGIChannel[_0x5f29('0x24')][_0x5f29('0x34')]=function(_0x5557a5,_0x33c5da){var _0x2d88af=_[_0x5f29('0x35')](_0x33c5da)||_[_0x5f29('0x36')](_0x33c5da)?_0x33c5da[_0x5f29('0x37')]():_0x33c5da;return this[_0x5f29('0x25')](util[_0x5f29('0x29')](_0x5f29('0x38'),_0x5557a5,_0x2d88af?_0x2d88af[_0x5f29('0x37')]()[_0x5f29('0x39')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x5f29('0x24')][_0x5f29('0x3a')]=function(_0x4c5d20,_0x19ad2c){return this[_0x5f29('0x25')](util[_0x5f29('0x29')](_0x5f29('0x3b'),_0x4c5d20,_0x19ad2c));};AGIChannel[_0x5f29('0x24')]['sayDigits']=function(_0x91309,_0x5547d4){return this[_0x5f29('0x25')](util['format'](_0x5f29('0x3c'),_0x91309,_0x5547d4));};AGIChannel[_0x5f29('0x24')][_0x5f29('0x3d')]=function(_0x1876d1,_0x25d616){return this[_0x5f29('0x25')](util[_0x5f29('0x29')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x1876d1,_0x25d616));};AGIChannel[_0x5f29('0x24')][_0x5f29('0x3e')]=function(_0x96dac9,_0xf15709,_0x319943){_0xf15709=_0xf15709||this[_0x5f29('0x3f')];_0x319943=_0x319943||0x1;this[_0x5f29('0x40')](_0x96dac9);this[_0x5f29('0x41')](_0xf15709);this[_0x5f29('0x31')](_0x319943);return this[_0x5f29('0x42')](util[_0x5f29('0x29')](_0x5f29('0x43'),_0x96dac9,_0xf15709,_0x319943));};AGIChannel[_0x5f29('0x24')]['getVariable']=function(_0x51379a){return this[_0x5f29('0x25')](util[_0x5f29('0x29')](_0x5f29('0x44'),_0x51379a));};AGIChannel['prototype'][_0x5f29('0x45')]=function(_0x186869,_0x2004f8,_0x4e4edf,_0x39624c,_0x3bcebd,_0x27662a){_0x2004f8=_0x2004f8||_0x5f29('0x46');_0x4e4edf=_0x4e4edf||'';_0x39624c=_0x39624c===undefined?-0x1:_0x39624c==='-1'?-0x1:_0x39624c*0x3e8;_0x3bcebd=_0x3bcebd===undefined?'':'s='+_0x3bcebd;_0x27662a=_0x27662a?_0x5f29('0x47'):'';return this[_0x5f29('0x25')](util[_0x5f29('0x29')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x186869,_0x2004f8,_0x4e4edf,_0x39624c,_0x27662a,_0x3bcebd));};AGIChannel['prototype'][_0x5f29('0x48')]=function(_0x478276,_0x83f849){_0x83f849=_0x83f849||'';return this[_0x5f29('0x25')](util[_0x5f29('0x29')](_0x5f29('0x49'),_0x478276,_0x83f849));};AGIChannel[_0x5f29('0x24')][_0x5f29('0x4a')]=function(_0x180dab){return this[_0x5f29('0x2c')](_0x5f29('0x4b'),_0x180dab);};AGIChannel[_0x5f29('0x24')][_0x5f29('0x4c')]=function(_0x5b8fa8){return this[_0x5f29('0x2c')](_0x5f29('0x4d'),_0x5b8fa8);};AGIChannel[_0x5f29('0x24')]['error']=function(_0x3b2078,_0xcceed5){this[_0x5f29('0x42')](util[_0x5f29('0x29')](_0x5f29('0x4e'),_0x3b2078['id'],_0x3b2078[_0x5f29('0x4f')],_0xcceed5));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x5f29('0x50')]=AGIChannel; \ No newline at end of file +var _0x9802=['SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','./reply','./error','setTimeout','setEncoding','utf8','emit','ready','line','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','sendRequest','prototype','answer','ANSWER','getData','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic'];(function(_0x2f002f,_0xce066a){var _0x42d0df=function(_0x5180a9){while(--_0x5180a9){_0x2f002f['push'](_0x2f002f['shift']());}};_0x42d0df(++_0xce066a);}(_0x9802,0xf6));var _0x2980=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x9802[_0x4a747d];return _0x3a5b5c;};'use strict';var util=require(_0x2980('0x0'));var _=require(_0x2980('0x1'));var EventEmitter=require(_0x2980('0x2'))['EventEmitter'];var AGIReply=require(_0x2980('0x3'));var AGIError=require(_0x2980('0x4'));function AGIChannel(_0x8c8c1e){var _0x21e68f=this,_0x2879d2=new AGIReply(),_0x59f868=![],_0x2bf45d={};EventEmitter['call'](_0x21e68f);_0x8c8c1e['setEncoding']('utf8');_0x8c8c1e[_0x2980('0x5')](0x8*0x3c*0x3c*0x3e8);_0x2879d2[_0x2980('0x6')](_0x2980('0x7'));_0x2879d2['on']('headers',function(_0x44f9d6){for(var _0x114694 in _0x44f9d6){_0x21e68f[_0x114694]=_0x44f9d6[_0x114694];}_0x21e68f[_0x2980('0x8')](_0x2980('0x9'));});_0x2879d2['on'](_0x2980('0xa'),function(_0x222f2f){if(_0x222f2f[_0x2980('0xb')]()==_0x2980('0xc')){_0x21e68f['emit']('hangup');return;}if(_0x222f2f['substring'](0x0,0xb)==_0x2980('0xd')){_0x59f868=!![];}if(_0x59f868){_0x2bf45d['rx']+=_0x222f2f+'\x0a';if(_0x222f2f[_0x2980('0xe')](_0x2980('0xf'))!=-0x1){_0x59f868=![];}}else{_0x2bf45d['rx']=_0x222f2f;}if(_0x59f868){return;}if(typeof _0x2bf45d['cb']==_0x2980('0x10')){var _0x34a13c=_0x2bf45d['rx'][_0x2980('0x11')](0x0,0x3),_0xa259f9=null,_0x4f5f2d=null;_0x34a13c=parseInt(_0x34a13c);if(isNaN(_0x34a13c)){_0x2bf45d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x34a13c!=0xc8){_0x2bf45d['cb'](null,{'code':_0x34a13c,'result':-0x1,'extra':'KO'});return;}_0xa259f9=_0x2bf45d['rx'][_0x2980('0x11')](0x4)[_0x2980('0x12')](_0x2980('0x13'),'');if(_0xa259f9[_0x2980('0x14')]('\x20')!=-0x1){_0xa259f9=_0xa259f9[_0x2980('0x15')](0x0,_0xa259f9[_0x2980('0x14')]('\x20'));}if(_['startsWith'](_0xa259f9,'-1')){_0xa259f9=parseInt(_0xa259f9);}_0x4f5f2d=_0x2bf45d['rx'][_0x2980('0x16')]('\x20');if(_0x4f5f2d[_0x2980('0x17')]==0x3){_0x4f5f2d=_0x4f5f2d[0x2][_0x2980('0x11')](0x1,_0x4f5f2d[0x2]['length']-0x1);}else if(_0x4f5f2d[_0x2980('0x17')]>0x3){var _0x5e5074=/\((.+)\)/;var _0x74d740=_0x2bf45d['rx'][_0x2980('0x18')](_0x5e5074);if(_0x74d740){_0x4f5f2d=_0x74d740[0x1];}else{_0x4f5f2d=null;}}else{_0x4f5f2d=null;}_0x2bf45d['cb'](null,{'code':_0x34a13c,'result':_0xa259f9,'extra':_0x4f5f2d});}});_0x8c8c1e['on'](_0x2980('0x19'),function(_0x1ec2e9){_0x21e68f[_0x2980('0x8')](_0x2980('0x19'),new AGIError(_0x2980('0x1a'),_0x1ec2e9['code']));});_0x8c8c1e['on']('close',function(){_0x21e68f[_0x2980('0x8')](_0x2980('0x1b'),new AGIError(_0x2980('0x1c')));});_0x8c8c1e['on'](_0x2980('0x1d'),function(){_0x21e68f[_0x2980('0x8')](_0x2980('0x1d'),new AGIError(_0x2980('0x1e')));_0x8c8c1e[_0x2980('0x1f')]();});_0x8c8c1e[_0x2980('0x20')](_0x2879d2);this[_0x2980('0x21')]=function(_0x16d8f3,_0x1a37eb){var _0x16d8f3=_0x16d8f3||'',_0x1a37eb=typeof _0x1a37eb=='function'?_0x1a37eb:new Function();_0x2bf45d={'tx':_0x16d8f3,'rx':'','cb':_0x1a37eb};_0x8c8c1e[_0x2980('0x22')](_0x16d8f3+'\x0a');},this['close']=function(){_0x8c8c1e[_0x2980('0x1f')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x2980('0x23')]=function(_0x10b6ae){return this[_0x2980('0x21')]['sync'](this,_0x10b6ae);};AGIChannel[_0x2980('0x24')][_0x2980('0x25')]=function(){return this['sendRequest'](_0x2980('0x26'));};AGIChannel[_0x2980('0x24')][_0x2980('0x27')]=function(_0x98e126,_0x3bbf4a,_0x1e785e){_0x98e126=_0x98e126===undefined?_0x2980('0x28'):_0x98e126;_0x3bbf4a=_0x3bbf4a===undefined?'5':_0x3bbf4a;_0x1e785e=_0x1e785e===undefined?'1':_0x1e785e;return this[_0x2980('0x23')](util[_0x2980('0x29')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x98e126,_0x3bbf4a*0x3e8,_0x1e785e));};AGIChannel[_0x2980('0x24')][_0x2980('0x2a')]=function(_0x77ebd){_0x77ebd=_0x77ebd||_0x2980('0x2b');return this[_0x2980('0x23')](util[_0x2980('0x29')](_0x2980('0x2c'),_0x77ebd));};AGIChannel[_0x2980('0x24')][_0x2980('0x2d')]=function(_0x12806d,_0x67f072){if(_[_0x2980('0x2e')](_0x67f072)){return this[_0x2980('0x23')](util['format'](_0x2980('0x2f'),_0x12806d,_0x67f072[_0x2980('0x30')](',')));}return this[_0x2980('0x23')](util['format']('EXEC\x20%s\x20%s',_0x12806d,_0x67f072));};AGIChannel['prototype'][_0x2980('0x31')]=function(_0x7eb8e0){return this[_0x2980('0x23')](util[_0x2980('0x29')]('SET\x20CONTEXT\x20%s',_0x7eb8e0));};AGIChannel[_0x2980('0x24')][_0x2980('0x32')]=function(_0x240a83){return this['sendRequest'](util[_0x2980('0x29')](_0x2980('0x33'),_0x240a83));};AGIChannel[_0x2980('0x24')]['setPriority']=function(_0x5ef26a){return this[_0x2980('0x23')](util['format'](_0x2980('0x34'),_0x5ef26a));};AGIChannel[_0x2980('0x24')][_0x2980('0xc')]=function(){return this[_0x2980('0x23')](_0x2980('0x35'));};AGIChannel[_0x2980('0x24')][_0x2980('0x36')]=function(_0x1ab83b,_0x27b73a){var _0x528e12=_['isBoolean'](_0x27b73a)||_[_0x2980('0x37')](_0x27b73a)?_0x27b73a[_0x2980('0x38')]():_0x27b73a;return this['sendRequest'](util['format'](_0x2980('0x39'),_0x1ab83b,_0x528e12?_0x528e12[_0x2980('0x38')]()[_0x2980('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x2980('0x3a')]=function(_0x2a4d8e,_0x159115){return this[_0x2980('0x23')](util['format']('SAY\x20NUMBER\x20%s\x20%s',_0x2a4d8e,_0x159115));};AGIChannel['prototype'][_0x2980('0x3b')]=function(_0x5714ac,_0x330def){return this[_0x2980('0x23')](util[_0x2980('0x29')](_0x2980('0x3c'),_0x5714ac,_0x330def));};AGIChannel['prototype'][_0x2980('0x3d')]=function(_0x310956,_0x431354){return this[_0x2980('0x23')](util['format'](_0x2980('0x3e'),_0x310956,_0x431354));};AGIChannel[_0x2980('0x24')][_0x2980('0x3f')]=function(_0x437813,_0x1e24c8,_0x95e279){_0x1e24c8=_0x1e24c8||this[_0x2980('0x40')];_0x95e279=_0x95e279||0x1;this[_0x2980('0x31')](_0x437813);this[_0x2980('0x32')](_0x1e24c8);this[_0x2980('0x41')](_0x95e279);return this['noop'](util[_0x2980('0x29')](_0x2980('0x42'),_0x437813,_0x1e24c8,_0x95e279));};AGIChannel[_0x2980('0x24')][_0x2980('0x43')]=function(_0x12636c){return this[_0x2980('0x23')](util[_0x2980('0x29')](_0x2980('0x44'),_0x12636c));};AGIChannel['prototype'][_0x2980('0x45')]=function(_0x1decd0,_0x55337d,_0x1d766f,_0x907823,_0x55ba0f,_0x5728e1){_0x55337d=_0x55337d||'wav';_0x1d766f=_0x1d766f||'';_0x907823=_0x907823===undefined?-0x1:_0x907823==='-1'?-0x1:_0x907823*0x3e8;_0x55ba0f=_0x55ba0f===undefined?'':'s='+_0x55ba0f;_0x5728e1=_0x5728e1?_0x2980('0x46'):'';return this['sendRequest'](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x1decd0,_0x55337d,_0x1d766f,_0x907823,_0x5728e1,_0x55ba0f));};AGIChannel['prototype'][_0x2980('0x47')]=function(_0x6899d8,_0x4bd680){_0x4bd680=_0x4bd680||'';return this[_0x2980('0x23')](util[_0x2980('0x29')](_0x2980('0x48'),_0x6899d8,_0x4bd680));};AGIChannel[_0x2980('0x24')]['agi']=function(_0xa844b3){return this[_0x2980('0x2d')]('AGI',_0xa844b3);};AGIChannel[_0x2980('0x24')][_0x2980('0x49')]=function(_0x2c809a){return this[_0x2980('0x2d')](_0x2980('0x4a'),_0x2c809a);};AGIChannel['prototype'][_0x2980('0x19')]=function(_0x36f495,_0x4a2bd6){this[_0x2980('0x2a')](util[_0x2980('0x29')](_0x2980('0x4b'),_0x36f495['id'],_0x36f495[_0x2980('0x4c')],_0x4a2bd6));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 86cfff4..887f66d 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 _0x544c=['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.','push','format','apply','name','util'];(function(_0x4ac258,_0x4a4076){var _0x5096b8=function(_0x3ad39e){while(--_0x3ad39e){_0x4ac258['push'](_0x4ac258['shift']());}};_0x5096b8(++_0x4a4076);}(_0x544c,0x7f));var _0xc544=function(_0x30a191,_0x38b23b){_0x30a191=_0x30a191-0x0;var _0xf6f720=_0x544c[_0x30a191];return _0xf6f720;};'use strict';var util=require(_0xc544('0x0'));var error={'E_AGI_UNDEFINED':_0xc544('0x1'),'E_AGI_ARGUMENT_PORT':_0xc544('0x2'),'E_AGI_SERVER_ERROR':_0xc544('0x3'),'E_AGI_SERVER_CLOSE':_0xc544('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xc544('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xc544('0x6'),'E_AGI_SOCKET_ERROR':_0xc544('0x7'),'E_AGI_SOCKET_CLOSE':_0xc544('0x8'),'E_AGI_SOCKET_TIMEOUT':_0xc544('0x9'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xc544('0xa'),'E_AGI_IVR_ENTRY':_0xc544('0xb')};function AGIError(_0x1461d5){var _0x1461d5=_0x1461d5||null,_0xa033d2=_0xa033d2||[],_0x5b8169=0x1,_0x2556fc='';if(!error[_0x1461d5]){_0x1461d5='E_AGI_UNDEFINED';}_0xa033d2[_0xc544('0xc')](error[_0x1461d5]);while(arguments[_0x5b8169]){_0xa033d2[_0xc544('0xc')](arguments[_0x5b8169]);_0x5b8169++;}_0x2556fc=util[_0xc544('0xd')][_0xc544('0xe')](util,_0xa033d2);this['message']=_0x2556fc;this[_0xc544('0xf')]=_0x1461d5;}module['exports']=AGIError; \ No newline at end of file +var _0x9b70=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','push','format','apply','message','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x4497d1,_0x3b9f15){var _0x43cfd4=function(_0x2a6d4f){while(--_0x2a6d4f){_0x4497d1['push'](_0x4497d1['shift']());}};_0x43cfd4(++_0x3b9f15);}(_0x9b70,0x186));var _0x09b7=function(_0x4178d9,_0x457645){_0x4178d9=_0x4178d9-0x0;var _0x4c0932=_0x9b70[_0x4178d9];return _0x4c0932;};'use strict';var util=require(_0x09b7('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x09b7('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x09b7('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x09b7('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x09b7('0x4'),'E_AGI_SOCKET_ERROR':_0x09b7('0x5'),'E_AGI_SOCKET_CLOSE':_0x09b7('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x09b7('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x178909){var _0x178909=_0x178909||null,_0x28e167=_0x28e167||[],_0x2938a3=0x1,_0x3becc2='';if(!error[_0x178909]){_0x178909='E_AGI_UNDEFINED';}_0x28e167[_0x09b7('0x8')](error[_0x178909]);while(arguments[_0x2938a3]){_0x28e167[_0x09b7('0x8')](arguments[_0x2938a3]);_0x2938a3++;}_0x3becc2=util[_0x09b7('0x9')][_0x09b7('0xa')](util,_0x28e167);this[_0x09b7('0xb')]=_0x3becc2;this[_0x09b7('0xc')]=_0x178909;}module[_0x09b7('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 9fb9bc4..017ac74 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 _0x0d84=['exports','lodash','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','localhost','emit','error','E_AGI_SERVER_ERROR','message'];(function(_0x4124f1,_0x3fb4fb){var _0x43ac20=function(_0x5e91fa){while(--_0x5e91fa){_0x4124f1['push'](_0x4124f1['shift']());}};_0x43ac20(++_0x3fb4fb);}(_0x0d84,0x11f));var _0x40d8=function(_0x2499e4,_0x3de805){_0x2499e4=_0x2499e4-0x0;var _0x117243=_0x0d84[_0x2499e4];return _0x117243;};'use strict';var _=require(_0x40d8('0x0'));var EventEmitter=require('events')[_0x40d8('0x1')];var Redis=require(_0x40d8('0x2'));var AGIError=require(_0x40d8('0x3'));var config=require(_0x40d8('0x4'));config[_0x40d8('0x5')]=_[_0x40d8('0x6')](config['redis'],{'host':_0x40d8('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub['subscribe']('agi',function(_0x3a311f){if(_0x3a311f)return eventEmitter[_0x40d8('0x8')](_0x40d8('0x9'),new AGIError(_0x40d8('0xa'),_0x3a311f));});sub['on'](_0x40d8('0xb'),function(_0x39b17f,_0x1dc3fc){if(_0x39b17f!=='agi')return;try{var _0x4eecf2=JSON['parse'](_0x1dc3fc);eventEmitter[_0x40d8('0x8')]('projectUpdate',_0x4eecf2);}catch(_0x221447){eventEmitter[_0x40d8('0x8')](_0x40d8('0x9'),new AGIError(_0x40d8('0xa'),_0x221447));}});module[_0x40d8('0xc')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x7234=['emit','error','message','parse','projectUpdate','E_AGI_SERVER_ERROR','EventEmitter','./error','../../config/environment','redis','localhost','subscribe','agi'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0x7234,0x1da));var _0x4723=function(_0x1b820f,_0x425eb4){_0x1b820f=_0x1b820f-0x0;var _0x423354=_0x7234[_0x1b820f];return _0x423354;};'use strict';var _=require('lodash');var EventEmitter=require('events')[_0x4723('0x0')];var Redis=require('ioredis');var AGIError=require(_0x4723('0x1'));var config=require(_0x4723('0x2'));config[_0x4723('0x3')]=_['defaults'](config[_0x4723('0x3')],{'host':_0x4723('0x4'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x4723('0x3')]);sub[_0x4723('0x5')](_0x4723('0x6'),function(_0x5db086){if(_0x5db086)return eventEmitter[_0x4723('0x7')](_0x4723('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x5db086));});sub['on'](_0x4723('0x9'),function(_0x3ddeeb,_0x27d10e){if(_0x3ddeeb!==_0x4723('0x6'))return;try{var _0xe5fd95=JSON[_0x4723('0xa')](_0x27d10e);eventEmitter[_0x4723('0x7')](_0x4723('0xb'),_0xe5fd95);}catch(_0x3f4957){eventEmitter[_0x4723('0x7')]('error',new AGIError(_0x4723('0xc'),_0x3f4957));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 207a9f1..e4ba443 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 _0x8eb9=['invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','agicommand','condition\x20not\x20found','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','push','size','getVertex','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','vswitch','target','default'];(function(_0x55fe30,_0x24f824){var _0x3e2021=function(_0x43ae74){while(--_0x43ae74){_0x55fe30['push'](_0x55fe30['shift']());}};_0x3e2021(++_0x24f824);}(_0x8eb9,0x1f3));var _0x98eb=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x8eb9[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x98eb('0x0'));var logger=require(_0x98eb('0x1'))(_0x98eb('0x2'));var verticesWithRetry=[_0x98eb('0x3'),_0x98eb('0x4'),_0x98eb('0x5')];var Graph=function(){this[_0x98eb('0x6')]={};this[_0x98eb('0x7')]={};this[_0x98eb('0x8')]=0x0;};Graph['prototype']['addVertex']=function(_0x21adca){this[_0x98eb('0x6')][_0x21adca['id']]=_0x21adca;this[_0x98eb('0x7')][_0x21adca['id']]=[];};Graph[_0x98eb('0x9')]['addEdge']=function(_0x123d44,_0x29ea1d,_0x2567e2){this[_0x98eb('0x7')][_0x123d44][_0x98eb('0xa')]({'target':_0x29ea1d,'condition':_0x2567e2});this[_0x98eb('0x8')]+=0x1;};Graph['prototype'][_0x98eb('0xb')]=function(){return _[_0x98eb('0xb')](this[_0x98eb('0x6')]);};Graph[_0x98eb('0x9')]['relations']=function(){return this[_0x98eb('0x8')];};Graph[_0x98eb('0x9')][_0x98eb('0xc')]=function(_0x1fe1f3){return this[_0x98eb('0x6')][_0x1fe1f3];};Graph['prototype']['traverseBFS']=function(_0x1d9ee6,_0x30f059){if(!this[_0x98eb('0x6')][_0x1d9ee6]){return logger[_0x98eb('0xd')](_0x98eb('0xe'));}var _0x32494f=_0x30f059(this[_0x98eb('0x6')][_0x1d9ee6]);if(!_0x32494f){return logger[_0x98eb('0xd')](_0x98eb('0xf'));}if(this[_0x98eb('0x7')][_0x1d9ee6][_0x98eb('0x10')]===0x0){return logger['info'](_0x98eb('0x11'));}for(var _0x5743c9=0x0,_0x4b2e1a=[],_0x3f796b=![];_0x5743c9\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','createSquareReport','then','catch','hasOwnProperty','indexOf','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','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','connection','lodash','util','../../config/environment','../../config/logger','agi','../../config/license/util','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','error','stack','deleted','splice','push','log','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x155d,0x1d1));var _0xd155=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x155d[_0xef8146];return _0x5a6cb0;};'use strict';var _=require(_0xd155('0x0'));var syncho=require('syncho');var util=require(_0xd155('0x1'));var config=require(_0xd155('0x2'));var logger=require(_0xd155('0x3'))(_0xd155('0x4'));var utilLicense=require(_0xd155('0x5'));var rpc=require('./rpc');var Project=require('./project');var AGIEmitter=require(_0xd155('0x6'))[_0xd155('0x7')];var projects=[];config['agi']=_[_0xd155('0x8')](config[_0xd155('0x4')],{'ip':_0xd155('0x9'),'port':0x11dd});AGIEmitter['on'](_0xd155('0xa'),projectUpdateHandler);function connectionHandler(_0x5baf4d){process[_0xd155('0xb')](function(){syncho(function(){try{setChannelVariables(_0x5baf4d);agiHandler(_0x5baf4d);}catch(_0x58caf2){logger[_0xd155('0xc')](_0x58caf2[_0xd155('0xd')]);}});});}function projectUpdateHandler(_0x1c174e){try{var _0x29301a=_['findIndex'](projects,['id',_0x1c174e['id']]);if(_0x29301a>-0x1){if(_0x1c174e[_0xd155('0xe')]===!![]){projects[_0xd155('0xf')](_0x29301a,0x1);}else{projects[_0x29301a]=_0x1c174e;}}else{projects[_0xd155('0x10')](_0x1c174e);}}catch(_0x11d372){logger[_0xd155('0xc')](_0x11d372[_0xd155('0xd')]);}}function listeningHandler(){console[_0xd155('0x11')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0xd155('0x12')]);logger[_0xd155('0x13')](util['format'](_0xd155('0x14'),config[_0xd155('0x4')]['ip'],config[_0xd155('0x4')]['port']));}function errorHandler(_0x26fd87){if(_0x26fd87&&_0x26fd87[_0xd155('0x15')]&&_0x26fd87[_0xd155('0x16')]){logger['error'](util[_0xd155('0x17')](_0xd155('0x18'),_0x26fd87['name'],_0x26fd87[_0xd155('0x16')]));}else{logger[_0xd155('0xc')](util[_0xd155('0x17')](_0xd155('0x19'),_0x26fd87[_0xd155('0xd')]));}}function closeHandler(){logger[_0xd155('0x13')](util[_0xd155('0x17')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xd155('0x1a')],this[_0xd155('0x1b')],this[_0xd155('0x1c')],this[_0xd155('0x1d')],this['uniqueid']));try{createSquareReport(this);}catch(_0xde0b31){logger['error'](_0xde0b31['stack']);}}function timeoutHandler(){logger[_0xd155('0x13')](util[_0xd155('0x17')](_0xd155('0x1e'),this[_0xd155('0x1a')],this[_0xd155('0x1b')],this[_0xd155('0x1c')],this['dnid'],this[_0xd155('0x1f')]));}function hangupHandler(){logger['info'](util[_0xd155('0x17')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xd155('0x1a')],this[_0xd155('0x1b')],this[_0xd155('0x1c')],this[_0xd155('0x1d')],this['uniqueid']));this['evtHangup']=!![];}function createSquareReport(_0x573b2d,_0x4b4eff){rpc[_0xd155('0x20')](_0x573b2d)[_0xd155('0x21')](function(_0x458d8e){if(_0x4b4eff){_0x4b4eff(null,_0x458d8e);}})[_0xd155('0x22')](function(_0xc4c0a5){if(_0x4b4eff){_0x4b4eff(null,_0xc4c0a5);}});}function setChannelVariables(_0x4cec7b){for(var _0x489061 in _0x4cec7b){if(_0x4cec7b[_0xd155('0x23')](_0x489061)){if(_0x489061[_0xd155('0x24')](_0xd155('0x25'))===0x0){_0x4cec7b[_0x489061[_0xd155('0x26')](0x4)]=_0x4cec7b[_0x489061];delete _0x4cec7b[_0x489061];}}}}function agiHandler(_0x22f953){logger[_0xd155('0x27')]('variables',JSON[_0xd155('0x28')](_0x22f953,null,0x2));logger[_0xd155('0x13')](util[_0xd155('0x17')](_0xd155('0x29'),_0x22f953[_0xd155('0x1a')],_0x22f953['calleridname'],_0x22f953[_0xd155('0x1c')],_0x22f953[_0xd155('0x1d')],_0x22f953[_0xd155('0x1f')]));_0x22f953['on'](_0xd155('0xc'),errorHandler);_0x22f953['on'](_0xd155('0x2a'),closeHandler);_0x22f953['on'](_0xd155('0x2b'),timeoutHandler);_0x22f953[_0xd155('0x2c')]=![];_0x22f953['on'](_0xd155('0x2d'),hangupHandler);var _0x49acf0=_[_0xd155('0x2e')](projects,[_0xd155('0x15'),_0x22f953[_0xd155('0x1a')]]);if(!_0x49acf0)return Project[_0xd155('0x2f')](_0x22f953);if(!_0x49acf0[_0xd155('0x30')])return Project[_0xd155('0x31')](_0x22f953);return Project[_0xd155('0x32')](_0x49acf0,_0x22f953);}function main(){var _0x3e270f;return utilLicense[_0xd155('0x33')]()['then'](function(_0x4f3782){if(!_0x4f3782)return;if(_0x4f3782[_0xd155('0x34')]){if(_0x4f3782['callysquare']&&_0x4f3782[_0xd155('0x35')]>0x0){logger[_0xd155('0x13')](util['format'](_0xd155('0x36'),_0x4f3782[_0xd155('0x35')]));_0x3e270f=_0x4f3782['callysquare'];}else{logger[_0xd155('0x13')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info'](_0xd155('0x37'));_0x3e270f=-0x1;}})[_0xd155('0x21')](function(){return Project[_0xd155('0x38')]();})['then'](function(_0x41e240){projects=_0x41e240;return;})['catch'](function(_0x50aadc){logger[_0xd155('0xc')](_0xd155('0x39'),_0x50aadc[_0xd155('0xd')]);})[_0xd155('0x3a')](function(){var _0x124f24=require(_0xd155('0x3b'))(config[_0xd155('0x4')][_0xd155('0x12')],config[_0xd155('0x4')]['ip'],_0x3e270f);_0x124f24['on'](_0xd155('0xc'),errorHandler);_0x124f24['on']('listening',listeningHandler);_0x124f24['on'](_0xd155('0x3c'),connectionHandler);_0x124f24['on'](_0xd155('0x2a'),closeHandler);});}main(); \ No newline at end of file +var _0x2097=['./rpc','./project','./events','EventEmitter','agi','defaults','127.0.0.1','projectUpdate','stack','findIndex','deleted','splice','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','info','calleridname','callerid','dnid','uniqueid','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','createSquareReport','then','hasOwnProperty','agi_','substring','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','find','handleNotFound','production','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','catch','[LICENSE]','./server','listening','connection','lodash','../../config/environment','../../config/license/util'];(function(_0x1ffff7,_0x2f9ff6){var _0x49d017=function(_0x1d2483){while(--_0x1d2483){_0x1ffff7['push'](_0x1ffff7['shift']());}};_0x49d017(++_0x2f9ff6);}(_0x2097,0x115));var _0x7209=function(_0x55ecdd,_0x23e592){_0x55ecdd=_0x55ecdd-0x0;var _0x17ee2b=_0x2097[_0x55ecdd];return _0x17ee2b;};'use strict';var _=require(_0x7209('0x0'));var syncho=require('syncho');var util=require('util');var config=require(_0x7209('0x1'));var logger=require('../../config/logger')('agi');var utilLicense=require(_0x7209('0x2'));var rpc=require(_0x7209('0x3'));var Project=require(_0x7209('0x4'));var AGIEmitter=require(_0x7209('0x5'))[_0x7209('0x6')];var projects=[];config[_0x7209('0x7')]=_[_0x7209('0x8')](config['agi'],{'ip':_0x7209('0x9'),'port':0x11dd});AGIEmitter['on'](_0x7209('0xa'),projectUpdateHandler);function connectionHandler(_0x84ccd0){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x84ccd0);agiHandler(_0x84ccd0);}catch(_0xf19236){logger['error'](_0xf19236[_0x7209('0xb')]);}});});}function projectUpdateHandler(_0xdb8104){try{var _0x536955=_[_0x7209('0xc')](projects,['id',_0xdb8104['id']]);if(_0x536955>-0x1){if(_0xdb8104[_0x7209('0xd')]===!![]){projects[_0x7209('0xe')](_0x536955,0x1);}else{projects[_0x536955]=_0xdb8104;}}else{projects['push'](_0xdb8104);}}catch(_0x29871f){logger[_0x7209('0xf')](_0x29871f[_0x7209('0xb')]);}}function listeningHandler(){console[_0x7209('0x10')](_0x7209('0x11'),config[_0x7209('0x7')][_0x7209('0x12')]);logger['info'](util[_0x7209('0x13')](_0x7209('0x14'),config[_0x7209('0x7')]['ip'],config[_0x7209('0x7')][_0x7209('0x12')]));}function errorHandler(_0x5a44bb){if(_0x5a44bb&&_0x5a44bb[_0x7209('0x15')]&&_0x5a44bb[_0x7209('0x16')]){logger[_0x7209('0xf')](util[_0x7209('0x13')](_0x7209('0x17'),_0x5a44bb[_0x7209('0x15')],_0x5a44bb[_0x7209('0x16')]));}else{logger[_0x7209('0xf')](util[_0x7209('0x13')](_0x7209('0x18'),_0x5a44bb[_0x7209('0xb')]));}}function closeHandler(){logger[_0x7209('0x19')](util[_0x7209('0x13')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x7209('0x1a')],this[_0x7209('0x1b')],this[_0x7209('0x1c')],this[_0x7209('0x1d')]));try{createSquareReport(this);}catch(_0x4e66a3){logger[_0x7209('0xf')](_0x4e66a3[_0x7209('0xb')]);}}function timeoutHandler(){logger[_0x7209('0x19')](util[_0x7209('0x13')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x7209('0x1e')],this[_0x7209('0x1a')],this[_0x7209('0x1b')],this[_0x7209('0x1c')],this[_0x7209('0x1d')]));}function hangupHandler(){logger[_0x7209('0x19')](util[_0x7209('0x13')](_0x7209('0x1f'),this[_0x7209('0x1e')],this[_0x7209('0x1a')],this[_0x7209('0x1b')],this[_0x7209('0x1c')],this[_0x7209('0x1d')]));this['evtHangup']=!![];}function createSquareReport(_0x2f9002,_0x374dd4){rpc[_0x7209('0x20')](_0x2f9002)[_0x7209('0x21')](function(_0x43ce5e){if(_0x374dd4){_0x374dd4(null,_0x43ce5e);}})['catch'](function(_0x5434ac){if(_0x374dd4){_0x374dd4(null,_0x5434ac);}});}function setChannelVariables(_0x5cefcc){for(var _0x2e6c62 in _0x5cefcc){if(_0x5cefcc[_0x7209('0x22')](_0x2e6c62)){if(_0x2e6c62['indexOf'](_0x7209('0x23'))===0x0){_0x5cefcc[_0x2e6c62[_0x7209('0x24')](0x4)]=_0x5cefcc[_0x2e6c62];delete _0x5cefcc[_0x2e6c62];}}}}function agiHandler(_0x1f3a7f){logger['debug']('variables',JSON['stringify'](_0x1f3a7f,null,0x2));logger[_0x7209('0x19')](util[_0x7209('0x13')](_0x7209('0x25'),_0x1f3a7f[_0x7209('0x1e')],_0x1f3a7f[_0x7209('0x1a')],_0x1f3a7f[_0x7209('0x1b')],_0x1f3a7f[_0x7209('0x1c')],_0x1f3a7f[_0x7209('0x1d')]));_0x1f3a7f['on']('error',errorHandler);_0x1f3a7f['on'](_0x7209('0x26'),closeHandler);_0x1f3a7f['on'](_0x7209('0x27'),timeoutHandler);_0x1f3a7f[_0x7209('0x28')]=![];_0x1f3a7f['on']('hangup',hangupHandler);var _0xd498b0=_[_0x7209('0x29')](projects,['name',_0x1f3a7f[_0x7209('0x1e')]]);if(!_0xd498b0)return Project[_0x7209('0x2a')](_0x1f3a7f);if(!_0xd498b0[_0x7209('0x2b')])return Project['handleUnpublished'](_0x1f3a7f);return Project[_0x7209('0x2c')](_0xd498b0,_0x1f3a7f);}function main(){var _0x30ca44;return utilLicense['getLicense']()['then'](function(_0xa6d06d){if(!_0xa6d06d)return;if(_0xa6d06d[_0x7209('0x2d')]){if(_0xa6d06d[_0x7209('0x2e')]&&_0xa6d06d[_0x7209('0x2e')]>0x0){logger[_0x7209('0x19')](util[_0x7209('0x13')](_0x7209('0x2f'),_0xa6d06d[_0x7209('0x2e')]));_0x30ca44=_0xa6d06d[_0x7209('0x2e')];}else{logger[_0x7209('0x19')](_0x7209('0x30'));}}else{logger['info'](_0x7209('0x31'));_0x30ca44=-0x1;}})[_0x7209('0x21')](function(){return Project[_0x7209('0x32')]();})[_0x7209('0x21')](function(_0x1f58cd){projects=_0x1f58cd;return;})[_0x7209('0x33')](function(_0x4ef3ba){logger[_0x7209('0xf')](_0x7209('0x34'),_0x4ef3ba[_0x7209('0xb')]);})['finally'](function(){var _0x160ded=require(_0x7209('0x35'))(config[_0x7209('0x7')][_0x7209('0x12')],config['agi']['ip'],_0x30ca44);_0x160ded['on'](_0x7209('0xf'),errorHandler);_0x160ded['on'](_0x7209('0x36'),listeningHandler);_0x160ded['on'](_0x7209('0x37'),connectionHandler);_0x160ded['on']('close',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 44481fe..aca4503 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 _0xa22a=['jayson/promise','client','http','then','error','SendMail','bluebird'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xa22a,0x187));var _0xaa22=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa22a[_0x3b380d];return _0x54502b;};'use strict';var BPromise=require(_0xaa22('0x0'));var jayson=require(_0xaa22('0x1'));var client=jayson[_0xaa22('0x2')][_0xaa22('0x3')]({'port':0x232b});function request(_0xd9292,_0x12765c){return new BPromise(function(_0x3a21a6,_0x316a54){return client['request'](_0xd9292,_0x12765c)[_0xaa22('0x4')](function(_0x4a449e){if(_0x4a449e[_0xaa22('0x5')]){return _0x316a54(_0x4a449e[_0xaa22('0x5')]['message']);}else{return _0x3a21a6(_0x4a449e['result']);}})['catch'](function(_0x56e144){return _0x316a54(_0x56e144);});});}exports['sendMailMessage']=function(_0x3a6f58,_0x3fa1f5){return request(_0xaa22('0x6'),{'account':_0x3a6f58,'message':_0x3fa1f5});}; \ No newline at end of file +var _0x1947=['http','request','then','error','message','catch','sendMailMessage','SendMail','bluebird','jayson/promise'];(function(_0x16536c,_0x77fb11){var _0x268ab6=function(_0x4a0f7d){while(--_0x4a0f7d){_0x16536c['push'](_0x16536c['shift']());}};_0x268ab6(++_0x77fb11);}(_0x1947,0x76));var _0x7194=function(_0x2a2733,_0x3dfaaf){_0x2a2733=_0x2a2733-0x0;var _0x2c22e5=_0x1947[_0x2a2733];return _0x2c22e5;};'use strict';var BPromise=require(_0x7194('0x0'));var jayson=require(_0x7194('0x1'));var client=jayson['client'][_0x7194('0x2')]({'port':0x232b});function request(_0x138208,_0xcddd47){return new BPromise(function(_0x6d354d,_0x311e5b){return client[_0x7194('0x3')](_0x138208,_0xcddd47)[_0x7194('0x4')](function(_0x5daf80){if(_0x5daf80[_0x7194('0x5')]){return _0x311e5b(_0x5daf80[_0x7194('0x5')][_0x7194('0x6')]);}else{return _0x6d354d(_0x5daf80['result']);}})[_0x7194('0x7')](function(_0x100bcb){return _0x311e5b(_0x100bcb);});});}exports[_0x7194('0x8')]=function(_0x212e50,_0x1ddac1){return request(_0x7194('0x9'),{'account':_0x212e50,'message':_0x1ddac1});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 7cc270e..9e7fcae 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 _0x3e13=['extension','priority','response','code','result','evtHangup','toString','error','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','isUndefined','[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','close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','agi','./mailRpc','./graph','./vertices','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','addEdge','source','target','value','toJson','mxGraphModel','root','inspect','production','start','debug','stringify','YYYY-MM-DD\x20HH:mm:ss','info','format','arg_1','calleridname','callerid','uniqueid','traverseBFS','clear','vertex','gotoc','context'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e13,0x95));var _0x33e1=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x3e13[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x33e1('0x0'));var moment=require(_0x33e1('0x1'));var parser=require(_0x33e1('0x2'));var util=require(_0x33e1('0x3'));var logger=require(_0x33e1('0x4'))(_0x33e1('0x5'));var rpc=require('./rpc');var mailRpc=require(_0x33e1('0x6'));var Graph=require(_0x33e1('0x7'));var Vertices=require(_0x33e1('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x33e1('0x9')]()[_0x33e1('0xa')](function(_0x16b83b){logger['error'](_0x33e1('0xb'),_0x16b83b[_0x33e1('0xc')]);return[];});}function addVertex(_0x334186,_0x2117cb,_0x2706c5){_0x2117cb[_0x33e1('0xd')]=_0x2706c5;if(_0x2117cb[_0x33e1('0xe')](_0x33e1('0xf'))){_0x2117cb[_0x33e1('0x10')]=parseInt(_0x2117cb[_0x33e1('0xf')],0xa);}_0x334186[_0x33e1('0x11')](_[_0x33e1('0x12')](_0x2117cb,_0x33e1('0x13')));}function initGraph(_0x45257c,_0x13e1b8){var _0x41ae9b=new Graph();for(var _0x2f89a0 in _0x45257c){if(_0x45257c[_0x33e1('0xe')](_0x2f89a0)){if(_[_0x33e1('0x14')](_0x45257c[_0x2f89a0])){for(var _0x271fb3=0x0;_0x271fb3<_0x45257c[_0x2f89a0][_0x33e1('0x15')];_0x271fb3+=0x1){addVertex(_0x41ae9b,_0x45257c[_0x2f89a0][_0x271fb3],_0x2f89a0);}}else{addVertex(_0x41ae9b,_0x45257c[_0x2f89a0],_0x2f89a0);}}}for(var _0x115ea1=0x0;_0x115ea1<_0x13e1b8['length'];_0x115ea1+=0x1){if(_0x13e1b8[_0x115ea1]['source']&&_0x13e1b8[_0x115ea1]['target']){_0x41ae9b[_0x33e1('0x16')](_0x13e1b8[_0x115ea1][_0x33e1('0x17')],_0x13e1b8[_0x115ea1][_0x33e1('0x18')],_0x13e1b8[_0x115ea1][_0x33e1('0x19')]);}}return _0x41ae9b;}function getRoot(_0x35d86f){return parser[_0x33e1('0x1a')](_0x35d86f,{'object':!![]})[_0x33e1('0x1b')][_0x33e1('0x1c')];}function inspect(_0x53ee9f){return util[_0x33e1('0x1d')](_0x53ee9f,{'showHidden':![],'depth':null});}function initialize(_0x56c454,_0x2d443d){var _0x419bda=getRoot(_0x56c454[_0x33e1('0x1e')]);if(!_0x419bda||!_0x419bda[_0x33e1('0x1f')])return;var _0x4860f7,_0x2a4a03,_0x2af14a;logger[_0x33e1('0x20')]('root',JSON[_0x33e1('0x21')](_0x419bda,null,0x2));_0x2d443d['joinAt']=moment()['format'](_0x33e1('0x22'));_0x4860f7=initGraph(_[_0x33e1('0x12')](_0x419bda,_0x33e1('0x13')),_0x419bda['mxCell']);_0x2a4a03=new Vertices(_0x2d443d,rpc,mailRpc);logger[_0x33e1('0x23')](util[_0x33e1('0x24')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2d443d[_0x33e1('0x25')],_0x2d443d[_0x33e1('0x26')],_0x2d443d[_0x33e1('0x27')],_0x2d443d['dnid'],_0x2d443d[_0x33e1('0x28')]));_0x4860f7[_0x33e1('0x29')](_0x419bda['start']['id'],function(_0x33f09b){try{_0x33f09b=_0x2a4a03[_0x33e1('0x2a')](_0x33f09b);logger['debug'](_0x33e1('0x2b'),JSON[_0x33e1('0x21')](_0x33f09b,null,0x2));if(_0x33f09b[_0x33e1('0xd')]===_0x33e1('0x2c')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x2d443d[_0x33e1('0x2d')]=_0x33f09b['context']||_0x2d443d[_0x33e1('0x2d')];_0x2d443d[_0x33e1('0x2e')]=_0x33f09b[_0x33e1('0x2e')];_0x2d443d[_0x33e1('0x2f')]=_0x33f09b[_0x33e1('0x2f')]?_0x33f09b['priority']-0x1:0x1;return null;}else if(_0x33f09b&&_0x2a4a03[_0x33f09b[_0x33e1('0xd')]]){_0x2af14a=_0x2a4a03[_0x33f09b[_0x33e1('0xd')]](_0x33f09b);logger['info'](_0x33e1('0x30'),JSON[_0x33e1('0x21')](_0x2af14a,null,0x2));if(_0x2af14a&&_0x2af14a[_0x33e1('0x31')]===AGI_CODE_SUCCESS&&_0x2af14a[_0x33e1('0x32')]!==AGI_RESULT_ERROR&&!_0x2d443d[_0x33e1('0x33')]){logger['debug']('response',inspect(_0x2af14a));return _['isUndefined'](_0x2af14a[_0x33e1('0x32')])?null:_0x2af14a[_0x33e1('0x32')][_0x33e1('0x34')]();}else{logger[_0x33e1('0x35')]('response',inspect(_0x2af14a));return null;}}else{logger[_0x33e1('0x35')](_0x33e1('0x36'));return null;}}catch(_0x20e46a){logger[_0x33e1('0x35')](_0x20e46a[_0x33e1('0xc')]);return null;}});if(_0x419bda['finally']){logger[_0x33e1('0x23')](util[_0x33e1('0x24')](_0x33e1('0x37'),_0x2d443d[_0x33e1('0x25')],_0x2d443d[_0x33e1('0x26')],_0x2d443d[_0x33e1('0x27')],_0x2d443d[_0x33e1('0x38')],_0x2d443d['uniqueid']));_0x4860f7['traverseBFS'](_0x419bda['finally']['id'],function(_0xb6724){try{_0xb6724=_0x2a4a03[_0x33e1('0x2a')](_0xb6724);logger[_0x33e1('0x20')](_0x33e1('0x2b'),JSON['stringify'](_0xb6724,null,0x2));if(_0xb6724&&_0x2a4a03[_0xb6724[_0x33e1('0xd')]]){_0x2af14a=_0x2a4a03[_0xb6724[_0x33e1('0xd')]](_0xb6724);if(_0x2af14a){logger['debug']('response',inspect(_0x2af14a));return _[_0x33e1('0x39')](_0x2af14a[_0x33e1('0x32')])?null:_0x2af14a['result'][_0x33e1('0x34')]();}else{logger['error'](_0x33e1('0x30'),inspect(_0x2af14a));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x1854ac){logger[_0x33e1('0x35')](_0x1854ac['stack']);return null;}});}logger[_0x33e1('0x23')](util[_0x33e1('0x24')](_0x33e1('0x3a'),_0x2d443d[_0x33e1('0x25')],_0x2d443d[_0x33e1('0x26')],_0x2d443d[_0x33e1('0x27')],_0x2d443d[_0x33e1('0x38')],_0x2d443d[_0x33e1('0x28')]));logger[_0x33e1('0x23')](util[_0x33e1('0x24')](_0x33e1('0x3b'),_0x2d443d[_0x33e1('0x2d')],_0x2d443d[_0x33e1('0x2e')],parseInt(_0x2d443d[_0x33e1('0x2f')],0xa)+0x1));_0x2d443d['continueAt'](_0x2d443d[_0x33e1('0x2d')],_0x2d443d[_0x33e1('0x2e')],parseInt(_0x2d443d[_0x33e1('0x2f')],0xa)+0x1);_0x2d443d[_0x33e1('0x3c')]();}function handleNotFound(_0x5cb950){logger['error'](util[_0x33e1('0x24')](_0x33e1('0x3d'),_0x5cb950['arg_1']));_0x5cb950[_0x33e1('0x3e')](_0x5cb950['context'],_0x5cb950['extension'],parseInt(_0x5cb950[_0x33e1('0x2f')],0xa)+0x1);_0x5cb950[_0x33e1('0x3c')]();}function handleUnpublished(_0x421f79){logger[_0x33e1('0x35')](util['format'](_0x33e1('0x3f'),_0x421f79[_0x33e1('0x25')]));_0x421f79[_0x33e1('0x3e')](_0x421f79[_0x33e1('0x2d')],_0x421f79[_0x33e1('0x2e')],parseInt(_0x421f79[_0x33e1('0x2f')],0xa)+0x1);_0x421f79[_0x33e1('0x3c')]();}module[_0x33e1('0x40')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x4aeb=['addEdge','inspect','production','debug','root','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','traverseBFS','start','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','error','finally','vertex','toString','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','lodash','xml2json','../../config/logger','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source','target'];(function(_0x214405,_0x2e9b3e){var _0x41d9ee=function(_0x393042){while(--_0x393042){_0x214405['push'](_0x214405['shift']());}};_0x41d9ee(++_0x2e9b3e);}(_0x4aeb,0x9a));var _0xb4ae=function(_0x56f67a,_0x438db2){_0x56f67a=_0x56f67a-0x0;var _0x472e91=_0x4aeb[_0x56f67a];return _0x472e91;};'use strict';var _=require(_0xb4ae('0x0'));var moment=require('moment');var parser=require(_0xb4ae('0x1'));var util=require('util');var logger=require(_0xb4ae('0x2'))('agi');var rpc=require(_0xb4ae('0x3'));var mailRpc=require(_0xb4ae('0x4'));var Graph=require(_0xb4ae('0x5'));var Vertices=require(_0xb4ae('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xb4ae('0x7')]()['catch'](function(_0x450fde){logger['error'](_0xb4ae('0x8'),_0x450fde[_0xb4ae('0x9')]);return[];});}function addVertex(_0x421a5a,_0x5566de,_0x121b46){_0x5566de[_0xb4ae('0xa')]=_0x121b46;if(_0x5566de[_0xb4ae('0xb')]('retry')){_0x5566de['maxRetry']=parseInt(_0x5566de[_0xb4ae('0xc')],0xa);}_0x421a5a[_0xb4ae('0xd')](_[_0xb4ae('0xe')](_0x5566de,_0xb4ae('0xf')));}function initGraph(_0x54245d,_0x344999){var _0x1112f0=new Graph();for(var _0x3fbc73 in _0x54245d){if(_0x54245d[_0xb4ae('0xb')](_0x3fbc73)){if(_[_0xb4ae('0x10')](_0x54245d[_0x3fbc73])){for(var _0x528eac=0x0;_0x528eac<_0x54245d[_0x3fbc73][_0xb4ae('0x11')];_0x528eac+=0x1){addVertex(_0x1112f0,_0x54245d[_0x3fbc73][_0x528eac],_0x3fbc73);}}else{addVertex(_0x1112f0,_0x54245d[_0x3fbc73],_0x3fbc73);}}}for(var _0x1e9b49=0x0;_0x1e9b49<_0x344999[_0xb4ae('0x11')];_0x1e9b49+=0x1){if(_0x344999[_0x1e9b49][_0xb4ae('0x12')]&&_0x344999[_0x1e9b49][_0xb4ae('0x13')]){_0x1112f0[_0xb4ae('0x14')](_0x344999[_0x1e9b49]['source'],_0x344999[_0x1e9b49][_0xb4ae('0x13')],_0x344999[_0x1e9b49]['value']);}}return _0x1112f0;}function getRoot(_0x5c6916){return parser['toJson'](_0x5c6916,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x33bc72){return util[_0xb4ae('0x15')](_0x33bc72,{'showHidden':![],'depth':null});}function initialize(_0x52cb2f,_0x5cc7ad){var _0x4c87c4=getRoot(_0x52cb2f[_0xb4ae('0x16')]);if(!_0x4c87c4||!_0x4c87c4['start'])return;var _0xd84515,_0x13dfc5,_0x1d8f73;logger[_0xb4ae('0x17')](_0xb4ae('0x18'),JSON[_0xb4ae('0x19')](_0x4c87c4,null,0x2));_0x5cc7ad[_0xb4ae('0x1a')]=moment()['format'](_0xb4ae('0x1b'));_0xd84515=initGraph(_[_0xb4ae('0xe')](_0x4c87c4,_0xb4ae('0xf')),_0x4c87c4[_0xb4ae('0xf')]);_0x13dfc5=new Vertices(_0x5cc7ad,rpc,mailRpc);logger['info'](util[_0xb4ae('0x1c')](_0xb4ae('0x1d'),_0x5cc7ad[_0xb4ae('0x1e')],_0x5cc7ad['calleridname'],_0x5cc7ad['callerid'],_0x5cc7ad[_0xb4ae('0x1f')],_0x5cc7ad[_0xb4ae('0x20')]));_0xd84515[_0xb4ae('0x21')](_0x4c87c4[_0xb4ae('0x22')]['id'],function(_0x3f7528){try{_0x3f7528=_0x13dfc5['clear'](_0x3f7528);logger['debug']('vertex',JSON[_0xb4ae('0x19')](_0x3f7528,null,0x2));if(_0x3f7528[_0xb4ae('0xa')]===_0xb4ae('0x23')){logger[_0xb4ae('0x24')](_0xb4ae('0x25'));_0x5cc7ad[_0xb4ae('0x26')]=_0x3f7528[_0xb4ae('0x26')]||_0x5cc7ad[_0xb4ae('0x26')];_0x5cc7ad[_0xb4ae('0x27')]=_0x3f7528[_0xb4ae('0x27')];_0x5cc7ad['priority']=_0x3f7528[_0xb4ae('0x28')]?_0x3f7528['priority']-0x1:0x1;return null;}else if(_0x3f7528&&_0x13dfc5[_0x3f7528['agicommand']]){_0x1d8f73=_0x13dfc5[_0x3f7528['agicommand']](_0x3f7528);logger[_0xb4ae('0x24')](_0xb4ae('0x29'),JSON['stringify'](_0x1d8f73,null,0x2));if(_0x1d8f73&&_0x1d8f73[_0xb4ae('0x2a')]===AGI_CODE_SUCCESS&&_0x1d8f73['result']!==AGI_RESULT_ERROR&&!_0x5cc7ad['evtHangup']){logger['debug'](_0xb4ae('0x29'),inspect(_0x1d8f73));return _[_0xb4ae('0x2b')](_0x1d8f73[_0xb4ae('0x2c')])?null:_0x1d8f73['result']['toString']();}else{logger[_0xb4ae('0x2d')](_0xb4ae('0x29'),inspect(_0x1d8f73));return null;}}else{logger[_0xb4ae('0x2d')]('agicommand\x20not\x20found');return null;}}catch(_0x51b434){logger[_0xb4ae('0x2d')](_0x51b434[_0xb4ae('0x9')]);return null;}});if(_0x4c87c4[_0xb4ae('0x2e')]){logger[_0xb4ae('0x24')](util[_0xb4ae('0x1c')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5cc7ad[_0xb4ae('0x1e')],_0x5cc7ad['calleridname'],_0x5cc7ad['callerid'],_0x5cc7ad[_0xb4ae('0x1f')],_0x5cc7ad['uniqueid']));_0xd84515['traverseBFS'](_0x4c87c4[_0xb4ae('0x2e')]['id'],function(_0x5ac084){try{_0x5ac084=_0x13dfc5['clear'](_0x5ac084);logger[_0xb4ae('0x17')](_0xb4ae('0x2f'),JSON[_0xb4ae('0x19')](_0x5ac084,null,0x2));if(_0x5ac084&&_0x13dfc5[_0x5ac084['agicommand']]){_0x1d8f73=_0x13dfc5[_0x5ac084['agicommand']](_0x5ac084);if(_0x1d8f73){logger['debug'](_0xb4ae('0x29'),inspect(_0x1d8f73));return _[_0xb4ae('0x2b')](_0x1d8f73[_0xb4ae('0x2c')])?null:_0x1d8f73['result'][_0xb4ae('0x30')]();}else{logger[_0xb4ae('0x2d')]('response',inspect(_0x1d8f73));return null;}}else{logger[_0xb4ae('0x2d')](_0xb4ae('0x31'));return null;}}catch(_0x25c38d){logger[_0xb4ae('0x2d')](_0x25c38d[_0xb4ae('0x9')]);return null;}});}logger['info'](util['format'](_0xb4ae('0x32'),_0x5cc7ad[_0xb4ae('0x1e')],_0x5cc7ad[_0xb4ae('0x33')],_0x5cc7ad[_0xb4ae('0x34')],_0x5cc7ad[_0xb4ae('0x1f')],_0x5cc7ad[_0xb4ae('0x20')]));logger[_0xb4ae('0x24')](util[_0xb4ae('0x1c')](_0xb4ae('0x35'),_0x5cc7ad['context'],_0x5cc7ad[_0xb4ae('0x27')],parseInt(_0x5cc7ad[_0xb4ae('0x28')],0xa)+0x1));_0x5cc7ad[_0xb4ae('0x36')](_0x5cc7ad[_0xb4ae('0x26')],_0x5cc7ad['extension'],parseInt(_0x5cc7ad[_0xb4ae('0x28')],0xa)+0x1);_0x5cc7ad['close']();}function handleNotFound(_0x3f33b4){logger['error'](util['format'](_0xb4ae('0x37'),_0x3f33b4[_0xb4ae('0x1e')]));_0x3f33b4[_0xb4ae('0x36')](_0x3f33b4[_0xb4ae('0x26')],_0x3f33b4[_0xb4ae('0x27')],parseInt(_0x3f33b4[_0xb4ae('0x28')],0xa)+0x1);_0x3f33b4[_0xb4ae('0x38')]();}function handleUnpublished(_0x4c2c49){logger[_0xb4ae('0x2d')](util['format'](_0xb4ae('0x39'),_0x4c2c49[_0xb4ae('0x1e')]));_0x4c2c49[_0xb4ae('0x36')](_0x4c2c49[_0xb4ae('0x26')],_0x4c2c49[_0xb4ae('0x27')],parseInt(_0x4c2c49[_0xb4ae('0x28')],0xa)+0x1);_0x4c2c49[_0xb4ae('0x38')]();}module['exports']={'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 83ccc8f..94bbc2d 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 _0x0d9f=['slice','trim','headers','emit','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','indexOf','substring','length','split'];(function(_0xf2a7a5,_0x322667){var _0x5c494b=function(_0x15aa32){while(--_0x15aa32){_0xf2a7a5['push'](_0xf2a7a5['shift']());}};_0x5c494b(++_0x322667);}(_0x0d9f,0x136));var _0xf0d9=function(_0x226ad1,_0x2858e2){_0x226ad1=_0x226ad1-0x0;var _0x16b625=_0x0d9f[_0x226ad1];return _0x16b625;};'use strict';var util=require(_0xf0d9('0x0'));var Transform=require(_0xf0d9('0x1'))[_0xf0d9('0x2')];function AGIReply(_0x57d8cb){Transform[_0xf0d9('0x3')](this,_0x57d8cb);this[_0xf0d9('0x4')]='';this[_0xf0d9('0x5')]=![];}util[_0xf0d9('0x6')](AGIReply,Transform);AGIReply[_0xf0d9('0x7')][_0xf0d9('0x8')]=function(_0x110615,_0x2d95d6,_0x33331d){var _0x36a132='\x0a',_0x47df62=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x4ae05d=-0x1,_0x458d8c=-0x1,_0x2ca3b0='',_0x23451e=0x0,_0x2ce499='',_0x48b7dc='';this[_0xf0d9('0x4')]+=_0x110615['toString']();_0x2ce499=this[_0xf0d9('0x4')];if(!this['_inBody']){_0x23451e=0x0;while(_0x47df62[_0x23451e]){while((_0x458d8c=_0x2ce499[_0xf0d9('0x9')](_0x47df62[_0x23451e]))!=-0x1){_0x2ca3b0=_0x47df62[_0x23451e];_0x48b7dc=_0x2ce499[_0xf0d9('0xa')](0x0,_0x458d8c);_0x2ce499=_0x2ce499['substring'](_0x458d8c+_0x2ca3b0[_0xf0d9('0xb')]);var _0x144ba3=_0x48b7dc[_0xf0d9('0xc')](_0x36a132),_0x182b4a=0x0,_0x2a38af={},_0x565dc1='',_0x88e885='',_0x176fc1=-0x1;while(_0x144ba3[_0x182b4a]){_0x176fc1=_0x144ba3[_0x182b4a][_0xf0d9('0x9')](':');if(_0x176fc1!=-0x1){_0x565dc1=_0x144ba3[_0x182b4a][_0xf0d9('0xd')](0x0,_0x176fc1)[_0xf0d9('0xe')]();_0x88e885=_0x144ba3[_0x182b4a]['slice'](_0x176fc1+0x1)[_0xf0d9('0xe')]();if(_0x565dc1[_0xf0d9('0xb')]>0x0){_0x2a38af[_0x565dc1]=_0x88e885;}}else{}_0x182b4a++;}this['emit'](_0xf0d9('0xf'),_0x2a38af);this[_0xf0d9('0x5')]=!![];}_0x23451e++;}this['_localBuffer']=_0x2ce499;}else{while((_0x4ae05d=_0x2ce499['indexOf'](_0x36a132))!=-0x1){_0x48b7dc=_0x2ce499[_0xf0d9('0xa')](0x0,_0x4ae05d);this[_0xf0d9('0x10')]('line',_0x48b7dc);_0x2ce499=_0x2ce499[_0xf0d9('0xa')](_0x4ae05d+_0x36a132[_0xf0d9('0xb')]);}this[_0xf0d9('0x4')]=_0x2ce499;}_0x33331d();};module['exports']=AGIReply; \ No newline at end of file +var _0xe3c9=['emit','headers','_inBody','exports','stream','call','_localBuffer','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','substring','split','indexOf','slice','trim','length'];(function(_0x53115c,_0x4f3917){var _0xbcea2c=function(_0x12253c){while(--_0x12253c){_0x53115c['push'](_0x53115c['shift']());}};_0xbcea2c(++_0x4f3917);}(_0xe3c9,0x1ad));var _0x9e3c=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xe3c9[_0x1694f5];return _0x5b4321;};'use strict';var util=require('util');var Transform=require(_0x9e3c('0x0'))['Transform'];function AGIReply(_0x23ecbd){Transform[_0x9e3c('0x1')](this,_0x23ecbd);this[_0x9e3c('0x2')]='';this['_inBody']=![];}util[_0x9e3c('0x3')](AGIReply,Transform);AGIReply[_0x9e3c('0x4')][_0x9e3c('0x5')]=function(_0x78dd08,_0x5405dc,_0x344bd1){var _0xd6e54e='\x0a',_0x5347cb=['\x0a\x0a',_0x9e3c('0x6')],_0x1437a0=-0x1,_0x335e99=-0x1,_0x59a631='',_0x3cc670=0x0,_0x53196b='',_0x54fc54='';this[_0x9e3c('0x2')]+=_0x78dd08['toString']();_0x53196b=this[_0x9e3c('0x2')];if(!this['_inBody']){_0x3cc670=0x0;while(_0x5347cb[_0x3cc670]){while((_0x335e99=_0x53196b['indexOf'](_0x5347cb[_0x3cc670]))!=-0x1){_0x59a631=_0x5347cb[_0x3cc670];_0x54fc54=_0x53196b[_0x9e3c('0x7')](0x0,_0x335e99);_0x53196b=_0x53196b[_0x9e3c('0x7')](_0x335e99+_0x59a631['length']);var _0x32a34e=_0x54fc54[_0x9e3c('0x8')](_0xd6e54e),_0xdaf85d=0x0,_0x15c99e={},_0x4bbf17='',_0x29edd0='',_0x9152bf=-0x1;while(_0x32a34e[_0xdaf85d]){_0x9152bf=_0x32a34e[_0xdaf85d][_0x9e3c('0x9')](':');if(_0x9152bf!=-0x1){_0x4bbf17=_0x32a34e[_0xdaf85d]['slice'](0x0,_0x9152bf)['trim']();_0x29edd0=_0x32a34e[_0xdaf85d][_0x9e3c('0xa')](_0x9152bf+0x1)[_0x9e3c('0xb')]();if(_0x4bbf17[_0x9e3c('0xc')]>0x0){_0x15c99e[_0x4bbf17]=_0x29edd0;}}else{}_0xdaf85d++;}this[_0x9e3c('0xd')](_0x9e3c('0xe'),_0x15c99e);this[_0x9e3c('0xf')]=!![];}_0x3cc670++;}this['_localBuffer']=_0x53196b;}else{while((_0x1437a0=_0x53196b[_0x9e3c('0x9')](_0xd6e54e))!=-0x1){_0x54fc54=_0x53196b[_0x9e3c('0x7')](0x0,_0x1437a0);this['emit']('line',_0x54fc54);_0x53196b=_0x53196b['substring'](_0x1437a0+_0xd6e54e[_0x9e3c('0xc')]);}this['_localBuffer']=_0x53196b;}_0x344bd1();};module[_0x9e3c('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 3457811..ce799ce 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 _0x6d0b=['ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','LogoutUser','lodash','jayson/promise','http','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowMailAccount','CloudProvider','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','ShowInterval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','createSquareMessage','ShowCmHopper','ListId','getPauseById'];(function(_0xe7a4b5,_0x200412){var _0xe5bb55=function(_0x3ab258){while(--_0x3ab258){_0xe7a4b5['push'](_0xe7a4b5['shift']());}};_0xe5bb55(++_0x200412);}(_0x6d0b,0x71));var _0xb6d0=function(_0x1784fa,_0x5e966d){_0x1784fa=_0x1784fa-0x0;var _0x588e27=_0x6d0b[_0x1784fa];return _0x588e27;};'use strict';var _=require(_0xb6d0('0x0'));var moment=require('moment');var jayson=require(_0xb6d0('0x1'));var client=jayson['client'][_0xb6d0('0x2')]({'port':0x2329});function request(_0x26ff2e,_0x15fea3){return new Promise(function(_0x266570,_0x293a26){return client[_0xb6d0('0x3')](_0x26ff2e,_0x15fea3)[_0xb6d0('0x4')](function(_0x57161a){if(_0x57161a[_0xb6d0('0x5')]){return _0x293a26(_0x57161a[_0xb6d0('0x5')][_0xb6d0('0x6')]);}else{return _0x266570(_0x57161a[_0xb6d0('0x7')]);}})[_0xb6d0('0x8')](function(_0x2e41cf){return _0x293a26(_0x2e41cf);});});}exports[_0xb6d0('0x9')]=function(){return request(_0xb6d0('0xa'),{'options':{'raw':![],'attributes':['id',_0xb6d0('0xb'),_0xb6d0('0xc')]}});};exports[_0xb6d0('0xd')]=function(_0x3dff2f){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x3dff2f},'attributes':[_0xb6d0('0xc')]}});};exports['getMailAccountById']=function(_0x237283){return request(_0xb6d0('0xe'),{'options':{'raw':![],'where':{'id':_0x237283},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':'CloudProvider','as':_0xb6d0('0xf')}]}],'attributes':['id','name','email'],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x52e72e){return request(_0xb6d0('0x10'),{'options':{'where':{'id':_0x52e72e},'attributes':[_0xb6d0('0xb')]}});};exports[_0xb6d0('0x11')]=function(_0x86a98a){return request(_0xb6d0('0x12'),{'options':{'where':{'id':_0x86a98a},'attributes':['name']}});};exports['getVariableById']=function(_0xcaeff1){return request(_0xb6d0('0x13'),{'options':{'where':{'id':_0xcaeff1},'attributes':['name']}});};exports[_0xb6d0('0x14')]=function(_0x393923){return request(_0xb6d0('0x15'),{'options':{'where':{'id':_0x393923},'attributes':[_0xb6d0('0x16')]}});};exports[_0xb6d0('0x17')]=function(_0x5e28c3){return request('ShowUser',{'options':{'where':{'id':_0x5e28c3},'attributes':[_0xb6d0('0xb')]}});};exports[_0xb6d0('0x18')]=function(_0x13448e){return request('GetContactByPhone',{'options':{'where':{'phone':_0x13448e[_0xb6d0('0x19')]},'attributes':['id']}});};exports[_0xb6d0('0x1a')]=function(_0x2bc1d5){return request(_0xb6d0('0x1b'),{'options':{'where':{'id':_0x2bc1d5},'attributes':[_0xb6d0('0xb')]}});};exports[_0xb6d0('0x1c')]=function(_0x2a4434){return request(_0xb6d0('0x1d'),{'options':{'where':{'id':_0x2a4434},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x12585d){return request(_0xb6d0('0x1e'),{'options':{'raw':![],'where':{'id':_0x12585d},'include':[{'model':'Interval','as':_0xb6d0('0x1f')}]}});};exports['getSmsAccountById']=function(_0x34606){return request(_0xb6d0('0x20'),{'options':{'where':{'id':_0x34606},'attributes':['id',_0xb6d0('0xb')]}});};exports[_0xb6d0('0x21')]=function(_0x46d7b8){return request(_0xb6d0('0x22'),{'body':_0x46d7b8});};exports['createSquareDetailsReport']=function(_0x5dc4ae){return request('CreateSquareDetailsReport',{'body':_0x5dc4ae});};exports[_0xb6d0('0x23')]=function(_0x117782){return request(_0xb6d0('0x24'),{'body':_[_0xb6d0('0x25')](_0x117782,{'project_name':_0x117782[_0xb6d0('0x26')],'prev_project_name':_0x117782[_0xb6d0('0x27')]||'','is_subproject':_0x117782[_0xb6d0('0x27')]?!![]:![],'leaveAt':moment()[_0xb6d0('0x28')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xb6d0('0x29')]=function(_0x2eb439){return request('CreateSquareRecording',{'body':_0x2eb439});};exports[_0xb6d0('0x2a')]=function(_0x5ed671){return request('CreateSquareMessage',{'body':_0x5ed671});};exports['createCmContact']=function(_0xe2bb15){return request(_0xb6d0('0x2b'),{'options':{'raw':![],'where':{'phone':_0xe2bb15['phone'],'ListId':_0xe2bb15[_0xb6d0('0x2c')]}}})[_0xb6d0('0x4')](function(_0x519b43){if(_0x519b43){return _0x519b43;}return request('CreateCmContact',{'body':_0xe2bb15});});};exports[_0xb6d0('0x2d')]=function(_0x287efa){return request(_0xb6d0('0x2e'),{'options':{'where':{'id':_0x287efa},'attributes':[_0xb6d0('0xb')]}});};exports[_0xb6d0('0x2f')]=function(_0x38bab0,_0x4e0b31){return request(_0xb6d0('0x30'),{'body':{'interface':_0x4e0b31},'options':{'where':_0x38bab0}});};exports[_0xb6d0('0x31')]=function(_0x430f84,_0x5416f7,_0x1b9fbb){return request(_0xb6d0('0x32'),{'body':{'type':_0x5416f7,'uniqueid':_0x1b9fbb},'options':{'where':_0x430f84}});};exports[_0xb6d0('0x33')]=function(_0x584151){return request('UnpauseUser',{'body':{},'options':{'where':_0x584151}});};exports['agentLogout']=function(_0x4a4981){return request(_0xb6d0('0x34'),{'body':{},'options':{'where':_0x4a4981}});}; \ No newline at end of file +var _0x864a=['ShowTrunk','getSoundById','ShowSound','save_name','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','ListId','getPauseById','agentLogin','LoginUser','agentUnpause','LogoutUser','lodash','moment','jayson/promise','client','then','error','message','catch','GetSquareProjects','name','production','getSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','phone','getTrunkById'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x864a,0x8a));var _0xa864=function(_0x1f50be,_0x5a3bb4){_0x1f50be=_0x1f50be-0x0;var _0x397f81=_0x864a[_0x1f50be];return _0x397f81;};'use strict';var _=require(_0xa864('0x0'));var moment=require(_0xa864('0x1'));var jayson=require(_0xa864('0x2'));var client=jayson[_0xa864('0x3')]['http']({'port':0x2329});function request(_0x4aba69,_0x4af03c){return new Promise(function(_0xa48455,_0x5b7903){return client['request'](_0x4aba69,_0x4af03c)[_0xa864('0x4')](function(_0xb64fd4){if(_0xb64fd4[_0xa864('0x5')]){return _0x5b7903(_0xb64fd4[_0xa864('0x5')][_0xa864('0x6')]);}else{return _0xa48455(_0xb64fd4['result']);}})[_0xa864('0x7')](function(_0x26c6d9){return _0x5b7903(_0x26c6d9);});});}exports['getSquareProjects']=function(){return request(_0xa864('0x8'),{'options':{'raw':![],'attributes':['id',_0xa864('0x9'),_0xa864('0xa')]}});};exports[_0xa864('0xb')]=function(_0x543f33){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x543f33},'attributes':[_0xa864('0xa')]}});};exports[_0xa864('0xc')]=function(_0x8baed){return request(_0xa864('0xd'),{'options':{'raw':![],'where':{'id':_0x8baed},'include':[{'model':_0xa864('0xe'),'as':_0xa864('0xf'),'include':[{'model':_0xa864('0x10'),'as':_0xa864('0x10')}]}],'attributes':['id',_0xa864('0x9'),_0xa864('0x11')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x1fe5b2){return request(_0xa864('0x12'),{'options':{'where':{'id':_0x1fe5b2},'attributes':['name']}});};exports[_0xa864('0x13')]=function(_0x6e0430){return request(_0xa864('0x14'),{'options':{'where':{'id':_0x6e0430},'attributes':[_0xa864('0x9')]}});};exports[_0xa864('0x15')]=function(_0x2aeed5){return request('ShowVariable',{'options':{'where':{'id':_0x2aeed5},'attributes':[_0xa864('0x9')]}});};exports[_0xa864('0x16')]=function(_0x204fb0){return request(_0xa864('0x17'),{'options':{'where':{'id':_0x204fb0},'attributes':[_0xa864('0x18')]}});};exports[_0xa864('0x19')]=function(_0x2e8336){return request(_0xa864('0x1a'),{'options':{'where':{'id':_0x2e8336},'attributes':['name']}});};exports[_0xa864('0x1b')]=function(_0x40cc6a){return request('GetContactByPhone',{'options':{'where':{'phone':_0x40cc6a[_0xa864('0x1c')]},'attributes':['id']}});};exports[_0xa864('0x1d')]=function(_0x1b3941){return request(_0xa864('0x1e'),{'options':{'where':{'id':_0x1b3941},'attributes':[_0xa864('0x9')]}});};exports[_0xa864('0x1f')]=function(_0x1f4f08){return request(_0xa864('0x20'),{'options':{'where':{'id':_0x1f4f08},'attributes':[_0xa864('0x21')]}});};exports['getIntervalById']=function(_0xc4c6ce){return request(_0xa864('0x22'),{'options':{'raw':![],'where':{'id':_0xc4c6ce},'include':[{'model':'Interval','as':_0xa864('0x23')}]}});};exports[_0xa864('0x24')]=function(_0x31d019){return request(_0xa864('0x25'),{'options':{'where':{'id':_0x31d019},'attributes':['id',_0xa864('0x9')]}});};exports[_0xa864('0x26')]=function(_0x452be5){return request('CreateSmsMessage',{'body':_0x452be5});};exports[_0xa864('0x27')]=function(_0x22e185){return request('CreateSquareDetailsReport',{'body':_0x22e185});};exports[_0xa864('0x28')]=function(_0x5ad543){return request(_0xa864('0x29'),{'body':_[_0xa864('0x2a')](_0x5ad543,{'project_name':_0x5ad543[_0xa864('0x2b')],'prev_project_name':_0x5ad543['arg_2']||'','is_subproject':_0x5ad543['arg_2']?!![]:![],'leaveAt':moment()[_0xa864('0x2c')](_0xa864('0x2d'))})});};exports['createSquareRecording']=function(_0x3a0d07){return request(_0xa864('0x2e'),{'body':_0x3a0d07});};exports[_0xa864('0x2f')]=function(_0x28950e){return request(_0xa864('0x30'),{'body':_0x28950e});};exports['createCmContact']=function(_0x4235e8){return request(_0xa864('0x31'),{'options':{'raw':![],'where':{'phone':_0x4235e8['phone'],'ListId':_0x4235e8[_0xa864('0x32')]}}})['then'](function(_0xe3f731){if(_0xe3f731){return _0xe3f731;}return request('CreateCmContact',{'body':_0x4235e8});});};exports[_0xa864('0x33')]=function(_0xa3ce00){return request('ShowPause',{'options':{'where':{'id':_0xa3ce00},'attributes':[_0xa864('0x9')]}});};exports[_0xa864('0x34')]=function(_0xa290,_0x5866df){return request(_0xa864('0x35'),{'body':{'interface':_0x5866df},'options':{'where':_0xa290}});};exports['agentPause']=function(_0x11fc1e,_0x25bc3d,_0x23a7e2){return request('PauseUser',{'body':{'type':_0x25bc3d,'uniqueid':_0x23a7e2},'options':{'where':_0x11fc1e}});};exports[_0xa864('0x36')]=function(_0x48b408){return request('UnpauseUser',{'body':{},'options':{'where':_0x48b408}});};exports['agentLogout']=function(_0x1f38c8){return request(_0xa864('0x37'),{'body':{},'options':{'where':_0x1f38c8}});}; \ 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 8f25a31..50dbbcf 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 _0x8c46=['./polly'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0x8c46,0x171));var _0x68c4=function(_0x22ff7a,_0x156018){_0x22ff7a=_0x22ff7a-0x0;var _0x19054f=_0x8c46[_0x22ff7a];return _0x19054f;};var polly=require(_0x68c4('0x0'));var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xb7ac=['exports','./polly','./lex'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0xb7ac,0x18a));var _0xcb7a=function(_0x33fb62,_0x1e1f11){_0x33fb62=_0x33fb62-0x0;var _0x17d328=_0xb7ac[_0x33fb62];return _0x17d328;};var polly=require(_0xcb7a('0x0'));var lex=require(_0xcb7a('0x1'));module[_0xcb7a('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 6c6d4a1..f7413b1 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. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x352a8d,_0x2a91b2,_0x4611be,_0x20aa4b,_0x447096,_0x192d48){return lex(_0x352a8d,_0x2a91b2,_0x4611be,_0x20aa4b,_0x447096,_0x192d48);}; \ No newline at end of file +var _0x668b=['./lib/api','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x668b,0x140));var _0xb668=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0x668b[_0x38854e];return _0x3f8415;};'use strict';var lex=require(_0xb668('0x0'));module[_0xb668('0x1')]=function(_0x51555f,_0x15fbea,_0x2c30c1,_0x49a53b,_0x336ba4,_0x5e2e83){return lex(_0x51555f,_0x15fbea,_0x2c30c1,_0x49a53b,_0x336ba4,_0x5e2e83);}; \ 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 6d32dad..c83a560 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(_0x457ef3,_0x4f5496){var _0x4c882a=function(_0x5aecba){while(--_0x5aecba){_0x457ef3['push'](_0x457ef3['shift']());}};_0x4c882a(++_0x4f5496);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x599380,_0x4d8a07){var _0x3493ca=function(_0xbf9681){while(--_0xbf9681){_0x599380['push'](_0x599380['shift']());}};_0x3493ca(++_0x4d8a07);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 b51505a..a3924ca 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 _0x959e=['exports'];(function(_0x168bd1,_0x4accb5){var _0x40bd51=function(_0x20ad03){while(--_0x20ad03){_0x168bd1['push'](_0x168bd1['shift']());}};_0x40bd51(++_0x4accb5);}(_0x959e,0x70));var _0xe959=function(_0x5192de,_0x4e91cd){_0x5192de=_0x5192de-0x0;var _0x4e287e=_0x959e[_0x5192de];return _0x4e287e;};'use strict';var polly=require('./lib/api');module[_0xe959('0x0')]=function(_0x4378de,_0x38a64e,_0x2a244b,_0x1f00a1,_0x4fcfb1,_0x469adc,_0x470ef0){return polly(_0x4378de,_0x38a64e,_0x2a244b,_0x1f00a1,_0x4fcfb1,_0x469adc,_0x470ef0);}; \ No newline at end of file +var _0xce6b=['exports','./lib/api'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xce6b,0x19b));var _0xbce6=function(_0x5a27a1,_0x38f0a5){_0x5a27a1=_0x5a27a1-0x0;var _0x4b09d0=_0xce6b[_0x5a27a1];return _0x4b09d0;};'use strict';var polly=require(_0xbce6('0x0'));module[_0xbce6('0x1')]=function(_0x2220df,_0x48b7eb,_0x221e75,_0x55afc5,_0x62abcd,_0x5956ab,_0x5db60e){return polly(_0x2220df,_0x48b7eb,_0x221e75,_0x55afc5,_0x62abcd,_0x5956ab,_0x5db60e);}; \ 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 59990cb..676b26f 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 _0xb165=['AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring','synthesizeSpeech'];(function(_0x29a707,_0x342505){var _0x229e83=function(_0x463053){while(--_0x463053){_0x29a707['push'](_0x29a707['shift']());}};_0x229e83(++_0x342505);}(_0xb165,0x188));var _0x5b16=function(_0x3e287a,_0x74cb92){_0x3e287a=_0x3e287a-0x0;var _0x4be25f=_0xb165[_0x3e287a];return _0x4be25f;};'use strict';var fs=require('fs');var path=require(_0x5b16('0x0'));var BPromise=require(_0x5b16('0x1'));var rs=require(_0x5b16('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x30b620,_0x5dd903,_0x2f1835){return new BPromise(function(_0x55b842,_0x25735b){_0x30b620[_0x5b16('0x3')](_0x5dd903,function(_0x3b894e,_0x52cd6e){if(_0x3b894e){_0x25735b(_0x3b894e);}else if(_0x52cd6e){if(_0x52cd6e[_0x5b16('0x4')]instanceof Buffer){fs[_0x5b16('0x5')](_0x2f1835,_0x52cd6e[_0x5b16('0x4')],function(_0x2d53f2){if(_0x2d53f2){_0x25735b(_0x2d53f2);}else{_0x55b842();}});}else{_0x25735b(new Error(_0x5b16('0x6')));}}else{_0x25735b(new Error(_0x5b16('0x7')));}});});}module[_0x5b16('0x8')]=function(_0x3fe379,_0x2a7d4b,_0x1da4b6,_0x4073fa,_0x2583ec,_0x1c4bfb,_0x388571){var _0xf2a74a=new AWS[(_0x5b16('0x9'))]({'accessKeyId':_0x3fe379,'secretAccessKey':_0x2a7d4b,'region':_0x1da4b6});var _0x1c3291={'Text':_0x2583ec,'TextType':_0x1c4bfb||_0x5b16('0xa'),'OutputFormat':_0x5b16('0xb'),'VoiceId':_0x4073fa};return pollyResult(_0xf2a74a,_0x1c3291,_0x388571);}; \ No newline at end of file +var _0x3734=['bluebird','aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text'];(function(_0xe44663,_0x115a95){var _0xcb8ae8=function(_0x53f5e5){while(--_0x53f5e5){_0xe44663['push'](_0xe44663['shift']());}};_0xcb8ae8(++_0x115a95);}(_0x3734,0x68));var _0x4373=function(_0x35056d,_0x1349cb){_0x35056d=_0x35056d-0x0;var _0x51fa9a=_0x3734[_0x35056d];return _0x51fa9a;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x4373('0x0'));var rs=require('randomstring');var AWS=require(_0x4373('0x1'));function pollyResult(_0x292e30,_0x2bed2c,_0x27e36a){return new BPromise(function(_0x1ca311,_0x375342){_0x292e30[_0x4373('0x2')](_0x2bed2c,function(_0x10cc74,_0x594c44){if(_0x10cc74){_0x375342(_0x10cc74);}else if(_0x594c44){if(_0x594c44[_0x4373('0x3')]instanceof Buffer){fs[_0x4373('0x4')](_0x27e36a,_0x594c44[_0x4373('0x3')],function(_0x76bd1e){if(_0x76bd1e){_0x375342(_0x76bd1e);}else{_0x1ca311();}});}else{_0x375342(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x375342(new Error(_0x4373('0x5')));}});});}module['exports']=function(_0x4864de,_0x1c64f6,_0x2ed451,_0x314ab4,_0x505559,_0x24b6a3,_0x2ba88a){var _0x1da8ce=new AWS[(_0x4373('0x6'))]({'accessKeyId':_0x4864de,'secretAccessKey':_0x1c64f6,'region':_0x2ed451});var _0x113f1b={'Text':_0x505559,'TextType':_0x24b6a3||_0x4373('0x7'),'OutputFormat':'mp3','VoiceId':_0x314ab4};return pollyResult(_0x1da8ce,_0x113f1b,_0x2ba88a);}; \ 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 e1557f6..e3f5866 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 _0xadbf=['exports','./lib/api'];(function(_0x3f1c6a,_0x2c0c7c){var _0x5497c6=function(_0x24b632){while(--_0x24b632){_0x3f1c6a['push'](_0x3f1c6a['shift']());}};_0x5497c6(++_0x2c0c7c);}(_0xadbf,0x1a3));var _0xfadb=function(_0x3be2b8,_0x41180c){_0x3be2b8=_0x3be2b8-0x0;var _0x315f61=_0xadbf[_0x3be2b8];return _0x315f61;};'use strict';var asr=require(_0xfadb('0x0'));module[_0xfadb('0x1')]=function(_0x54af03,_0x1b79a9,_0x88ebfa,_0x2b83c8){return asr(_0x54af03,_0x1b79a9,_0x88ebfa);}; \ No newline at end of file +var _0x684b=['./lib/api','exports'];(function(_0x329816,_0x2d09ae){var _0x4a611e=function(_0x5c1c14){while(--_0x5c1c14){_0x329816['push'](_0x329816['shift']());}};_0x4a611e(++_0x2d09ae);}(_0x684b,0xf6));var _0xb684=function(_0x16610c,_0x2796de){_0x16610c=_0x16610c-0x0;var _0x37f21b=_0x684b[_0x16610c];return _0x37f21b;};'use strict';var asr=require(_0xb684('0x0'));module[_0xb684('0x1')]=function(_0x5a3bc0,_0x3c2e78,_0x375c8e,_0x70f1b9){return asr(_0x5a3bc0,_0x3c2e78,_0x375c8e);}; \ 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 b4ab57d..24fb4e3 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 _0xda65=['LINEAR16','8000','url','bluebird','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key='];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xda65,0x1d0));var _0x5da6=function(_0x16267f,_0x2a6cc9){_0x16267f=_0x16267f-0x0;var _0x2a671b=_0xda65[_0x16267f];return _0x2a671b;};'use strict';var url=require(_0x5da6('0x0'));var BPromise=require(_0x5da6('0x1'));var fs=require('fs');var host=_0x5da6('0x2');module['exports']=function(_0x377db8,_0x20415b,_0xd35866){return new BPromise(function(_0x487700,_0x5c80b4){var _0x73d407;if(typeof _0x377db8!==_0x5da6('0x3')||_0x377db8[_0x5da6('0x4')]===0x0){return _0x5c80b4(_0x5da6('0x5'));}if(typeof _0x20415b!==_0x5da6('0x3')||_0x20415b['length']===0x0){return _0x5c80b4(_0x5da6('0x6'));}if(typeof _0xd35866!=='undefined'&&(typeof _0xd35866!=='string'||_0xd35866[_0x5da6('0x4')]===0x0)){return _0x5c80b4('lang\x20should\x20be\x20a\x20string');}try{_0x73d407=fs[_0x5da6('0x7')](_0x377db8)[_0x5da6('0x8')](_0x5da6('0x9'));}catch(_0x28d332){return _0x5c80b4(_0x28d332);}return _0x487700({'method':_0x5da6('0xa'),'uri':host+_0x5da6('0xb')+_0x20415b,'body':{'config':{'encoding':_0x5da6('0xc'),'sampleRateHertz':_0x5da6('0xd'),'languageCode':_0xd35866},'audio':{'content':_0x73d407}},'json':!![]});});}; \ No newline at end of file +var _0xd87e=['bluebird','exports','string','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','length','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','url'];(function(_0x2057ec,_0x2e3a88){var _0x386626=function(_0x3755f4){while(--_0x3755f4){_0x2057ec['push'](_0x2057ec['shift']());}};_0x386626(++_0x2e3a88);}(_0xd87e,0x1bf));var _0xed87=function(_0x1698f6,_0x441e4b){_0x1698f6=_0x1698f6-0x0;var _0x11d58f=_0xd87e[_0x1698f6];return _0x11d58f;};'use strict';var url=require(_0xed87('0x0'));var BPromise=require(_0xed87('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xed87('0x2')]=function(_0x189fdd,_0x16509b,_0x5901be){return new BPromise(function(_0xbbee79,_0x5e960f){var _0x11a5d9;if(typeof _0x189fdd!==_0xed87('0x3')||_0x189fdd['length']===0x0){return _0x5e960f(_0xed87('0x4'));}if(typeof _0x16509b!=='string'||_0x16509b['length']===0x0){return _0x5e960f(_0xed87('0x5'));}if(typeof _0x5901be!==_0xed87('0x6')&&(typeof _0x5901be!==_0xed87('0x3')||_0x5901be[_0xed87('0x7')]===0x0)){return _0x5e960f('lang\x20should\x20be\x20a\x20string');}try{_0x11a5d9=fs[_0xed87('0x8')](_0x189fdd)[_0xed87('0x9')](_0xed87('0xa'));}catch(_0x3c9a3c){return _0x5e960f(_0x3c9a3c);}return _0xbbee79({'method':_0xed87('0xb'),'uri':host+_0xed87('0xc')+_0x16509b,'body':{'config':{'encoding':_0xed87('0xd'),'sampleRateHertz':'8000','languageCode':_0x5901be},'audio':{'content':_0x11a5d9}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index 6d672f0..520573f 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 _0x8198=['exports','./asr'];(function(_0x17a78d,_0x4c8180){var _0x3a9549=function(_0x464523){while(--_0x464523){_0x17a78d['push'](_0x17a78d['shift']());}};_0x3a9549(++_0x4c8180);}(_0x8198,0x103));var _0x8819=function(_0x1fa381,_0x758c2a){_0x1fa381=_0x1fa381-0x0;var _0x47eefe=_0x8198[_0x1fa381];return _0x47eefe;};var asr=require(_0x8819('0x0'));module[_0x8819('0x1')]={'asr':asr}; \ No newline at end of file +var _0x7df3=['exports','./asr'];(function(_0x49a0b9,_0x8201dd){var _0x457f3e=function(_0x4abffd){while(--_0x4abffd){_0x49a0b9['push'](_0x49a0b9['shift']());}};_0x457f3e(++_0x8201dd);}(_0x7df3,0x1e1));var _0x37df=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x7df3[_0x484e36];return _0xafc85d;};var asr=require(_0x37df('0x0'));module[_0x37df('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 25f955a..28a06e6 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 _0x14a1=['info','split','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','stringify','jQ1olc','null','generic','data','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','tmp','asr','results','alternatives','transcript','join','map','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','resolvedQuery','fulfillment','speech','score','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','allRequiredParamsPresent','queryResult','diagnosticInfo','fields','end_conversation','name','intent','displayName','queryText','intentDetectionConfidence','tildeASR','confidence','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','nda','text','channelData','CustomAction','AudioFromTts','Data','bluebird','dialogflow','https','path','querystring','request-promise','randomstring','sox','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','end','request\x20to\x20','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','.wav','writeFileSync','then','777','readFileSync','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','generate','.mp3','writeFile','chmodSync'];(function(_0x32e527,_0x23fb05){var _0x120b95=function(_0x210247){while(--_0x210247){_0x32e527['push'](_0x32e527['shift']());}};_0x120b95(++_0x23fb05);}(_0x14a1,0x1b5));var _0x114a=function(_0x297c9a,_0x3b84bc){_0x297c9a=_0x297c9a-0x0;var _0x4c3805=_0x14a1[_0x297c9a];return _0x4c3805;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x114a('0x0'));var dialogflow=require(_0x114a('0x1'));var fs=require('fs');var http=require('http');var https=require(_0x114a('0x2'));var md5=require('md5');var path=require(_0x114a('0x3'));var querystring=require(_0x114a('0x4'));var rp=require(_0x114a('0x5'));var rs=require(_0x114a('0x6'));var sox=require(_0x114a('0x7'));var tts=require('google-tts-api');var urlParse=require('url')['parse'];var util=require('util');var aws=require('./aws');var google=require(_0x114a('0x8'));var sestek=require(_0x114a('0x9'));var tilde=require(_0x114a('0xa'));var logger=require('../../../config/logger')(_0x114a('0xb'));var ISPEECH_API=_0x114a('0xc');function downloadFile(_0x24a3ad,_0x495837){return new BPromise(function(_0x56fcc3,_0x4283c7){var _0x515e38=urlParse(_0x24a3ad);var _0x102eda=_0x515e38[_0x114a('0xd')]===_0x114a('0xe')?https:http;var _0x2e2257={'host':_0x515e38[_0x114a('0xf')],'path':_0x515e38[_0x114a('0x3')],'headers':{'user-agent':_0x114a('0x10')}};_0x102eda[_0x114a('0x11')](_0x2e2257,function(_0x242213){if(_0x242213[_0x114a('0x12')]!==0xc8){logger['error']('request\x20to\x20'+_0x24a3ad+_0x114a('0x13')+_0x242213[_0x114a('0x12')]+'\x20('+_0x242213[_0x114a('0x14')]+')');_0x4283c7(new Error('request\x20to\x20'+_0x24a3ad+_0x114a('0x13')+_0x242213[_0x114a('0x12')]+'\x20('+_0x242213['statusMessage']+')'));return;}var _0x199130=fs[_0x114a('0x15')](_0x495837);_0x199130['on'](_0x114a('0x16'),function(){logger['info'](_0x114a('0x17'));_0x199130[_0x114a('0x18')](_0x56fcc3);});_0x199130['on'](_0x114a('0x19'),function(_0x1745d1){fs[_0x114a('0x1a')](_0x495837);logger[_0x114a('0x19')](_0x114a('0x1b'),_0x1745d1);_0x4283c7(_0x1745d1);});_0x242213[_0x114a('0x1c')](_0x199130);})['on'](_0x114a('0x19'),function(_0x4e1127){logger[_0x114a('0x19')](_0x4e1127);_0x4283c7(_0x4e1127);})[_0x114a('0x1d')]();});}function uploadFile(_0x44f8c6){return new BPromise(function(_0x70931c,_0x1d4786){var _0x5d7a90=urlParse(_0x44f8c6);var _0x41c515=_0x5d7a90[_0x114a('0xd')]==='https:'?https:http;var _0x29b4d3={'host':_0x5d7a90[_0x114a('0xf')],'path':_0x5d7a90[_0x114a('0x3')],'headers':{'user-agent':'WHAT_EVER'}};_0x41c515[_0x114a('0x11')](_0x29b4d3,function(_0x36c245){if(_0x36c245[_0x114a('0x12')]!==0xc8){_0x1d4786(new Error(_0x114a('0x1e')+_0x44f8c6+_0x114a('0x13')+_0x36c245[_0x114a('0x12')]+'\x20('+_0x36c245['statusMessage']+')'));return;}var _0x1ac524='';_0x36c245['on']('data',function(_0x3eef75){_0x1ac524+=_0x3eef75;});_0x36c245['on'](_0x114a('0x1d'),function(){_0x70931c(_0x1ac524);});})['on'](_0x114a('0x19'),function(_0x122208){_0x1d4786(_0x122208);})[_0x114a('0x1d')]();});}function convertFile(_0x1f7476,_0xd4c21e){return new BPromise(function(_0x95eefb,_0x32eeff){var _0x231e35=sox[_0x114a('0x1f')](_0x1f7476,_0xd4c21e,{'sampleRate':0x1f40,'format':_0x114a('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x231e35['on'](_0x114a('0x19'),function(_0x5d996f){logger[_0x114a('0x19')](_0x114a('0x21'),_0x5d996f);_0x32eeff(_0x5d996f);});_0x231e35['on']('end',function(){logger['info'](_0x114a('0x22'));_0x95eefb();});_0x231e35[_0x114a('0x23')]();});}function base64Decode(_0x40db3c,_0x4b39ab){var _0x55935e=path[_0x114a('0x24')](__dirname,'tmp',rs['generate'](0x4)+_0x114a('0x25'));fs[_0x114a('0x26')](_0x55935e,_0x40db3c,'base64');return convertFile(_0x55935e,_0x4b39ab)[_0x114a('0x27')](function(){try{fs[_0x114a('0x1a')](_0x55935e);fs['chmodSync'](_0x4b39ab,_0x114a('0x28'));}catch(_0x584231){logger[_0x114a('0x19')](_0x584231);}return _0x4b39ab['split']('.')[0x0];});}function base64Encode(_0x11f7c6){var _0x54cf14=fs[_0x114a('0x29')](_0x11f7c6);return new Buffer(_0x54cf14)['toString']('base64');}exports[_0x114a('0x2a')]=function(_0x5c4893,_0x40d17d,_0x17e500,_0x574d87,_0xb72208,_0x15660c){var _0x1de61c,_0x55a9db;var _0x449872='https://texttospeech.googleapis.com/v1/';var _0x5c639b=_0x114a('0x2b')+_0x5c4893;var _0x12dab3={};if(_0x40d17d===_0x114a('0x2c')){_0x12dab3[_0x114a('0x2d')]={'ssml':_0x17e500};}else{_0x12dab3['input']={'text':_0x17e500};};_0x12dab3[_0x114a('0x2e')]={'languageCode':_0x574d87,'ssmlGender':_0xb72208};_0x12dab3[_0x114a('0x2f')]={'audioEncoding':_0x114a('0x30'),'sampleRateHertz':0x1f40};var _0x37a572={'url':_0x449872+_0x114a('0x31')+_0x5c639b,'method':_0x114a('0x32'),'json':!![],'body':_0x12dab3};return rp(_0x37a572)[_0x114a('0x27')](function(_0x4b17c7){return new BPromise(function(_0x24b9eb,_0x3fec53){_0x1de61c=path[_0x114a('0x24')](__dirname,'tmp',rs[_0x114a('0x33')](0x4)+_0x114a('0x34'));var _0x21f5e5=Buffer['from'](_0x4b17c7['audioContent'],'base64');return fs[_0x114a('0x35')](_0x1de61c,_0x21f5e5,function(_0x2816ae){_0x3fec53(_0x2816ae);},function(_0x55bf7b){fs[_0x114a('0x36')](_0x1de61c,_0x114a('0x28'));_0x24b9eb(_0x55bf7b);});});})['then'](function(_0x5bade0){_0x55a9db=path[_0x114a('0x24')](__dirname,'tmp',rs[_0x114a('0x33')](0x4)+_0x114a('0x25'));return convertFile(_0x1de61c,_0x55a9db);})['then'](function(){try{fs[_0x114a('0x1a')](_0x1de61c);fs[_0x114a('0x36')](_0x55a9db,_0x114a('0x28'));}catch(_0x3233c3){logger[_0x114a('0x19')](_0x3233c3);}logger[_0x114a('0x37')]('googleCloudTTS\x20path',_0x55a9db[_0x114a('0x38')]('.')[0x0]);return _0x55a9db['split']('.')[0x0];});};exports['googleTTS']=function(_0x5a947c,_0x5e9c08){var _0x3df618=_0x114a('0x39');var _0x12b75c,_0xf9ead4;var _0x38ad18;var _0xaf2d25={'encoding':_0x114a('0x3a'),'method':_0x114a('0x32'),'timeout':0x2710,'url':_0x3df618,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x114a('0x3b')+encodeURIComponent(JSON[_0x114a('0x3c')]([[[_0x114a('0x3d'),JSON[_0x114a('0x3c')]([_0x5a947c,_0x5e9c08||'en',![],_0x114a('0x3e')]),null,_0x114a('0x3f')]]]))};return rp(_0xaf2d25)[_0x114a('0x27')](function(_0x29f201){try{_0x38ad18=eval(_0x29f201['slice'](0x5))[0x0][0x2];}catch(_0x2a361b){throw new Error('parse\x20response\x20failed:\x0a'+_0x29f201[_0x114a('0x40')]);}if(!_0x38ad18){if(_0x5a947c[_0x114a('0x41')]>0xc8){throw new Error(_0x114a('0x42'));}else{throw new Error('lang\x20\x22'+_0x5e9c08+_0x114a('0x43'));}}try{_0x38ad18=eval(_0x38ad18)[0x0];}catch(_0x25cf9f){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x114a('0x40')]);}const _0x303686=_0x38ad18;_0x12b75c=path[_0x114a('0x24')](__dirname,_0x114a('0x44'),rs['generate'](0x4)+'.mp3');fs[_0x114a('0x26')](_0x12b75c,_0x38ad18,{'encoding':'base64'});_0xf9ead4=path[_0x114a('0x24')](__dirname,_0x114a('0x44'),rs[_0x114a('0x33')](0x4)+_0x114a('0x25'));return convertFile(_0x12b75c,_0xf9ead4);})[_0x114a('0x27')](function(){try{fs[_0x114a('0x1a')](_0x12b75c);fs['chmodSync'](_0xf9ead4,_0x114a('0x28'));}catch(_0x2f3a8a){logger[_0x114a('0x19')](_0x2f3a8a);}logger[_0x114a('0x37')]('goggleTTS\x20path',_0xf9ead4[_0x114a('0x38')]('.')[0x0]);return _0xf9ead4[_0x114a('0x38')]('.')[0x0];});};exports['googleASR']=function(_0x1ed20b,_0x5a6344,_0x4302a8){return google[_0x114a('0x45')](_0x1ed20b,_0x5a6344,_0x4302a8)['then'](function(_0x24b0f6){logger['info'](_0x24b0f6['uri']);return rp(_0x24b0f6);})[_0x114a('0x27')](function(_0x4ebe2c){var _0xc5e0c='';var _0x558c62=0x0;try{fs['unlink'](_0x1ed20b);}catch(_0x17d94e){logger[_0x114a('0x19')](_0x17d94e);}if(_0x4ebe2c&&_0x4ebe2c[_0x114a('0x46')]){_0xc5e0c=_0x4ebe2c[_0x114a('0x46')]['map'](function(_0x304b2c){return _0x304b2c&&_0x304b2c['alternatives'][0x0]&&_0x304b2c[_0x114a('0x47')][0x0][_0x114a('0x48')]?_0x304b2c[_0x114a('0x47')][0x0][_0x114a('0x48')]:'';})[_0x114a('0x49')]('\x0a');_0x558c62=_0x4ebe2c['results'][_0x114a('0x4a')](function(_0x39d4ef){return _0x39d4ef&&_0x39d4ef[_0x114a('0x47')][0x0]&&_0x39d4ef[_0x114a('0x47')][0x0]['confidence']?_0x39d4ef[_0x114a('0x47')][0x0]['confidence']:0x0;})[_0x114a('0x49')]('\x0a');}logger['info'](_0x114a('0x4b'),_0xc5e0c);logger[_0x114a('0x37')](_0x114a('0x4c'),_0x558c62);return{'transcript':_0xc5e0c,'confidence':_0x558c62};})[_0x114a('0x4d')](function(_0x34e0a9){logger[_0x114a('0x19')](_0x114a('0x4e'),_0x34e0a9[_0x114a('0x12')],_0x34e0a9['name'],_0x34e0a9[_0x114a('0x4f')]);});};exports[_0x114a('0x50')]=function(_0x34af7e,_0x49cb92,_0xdf1c29,_0x5a28df){var _0x55fc1a=apiai(_0x49cb92,{'language':_0x5a28df||'en'});return _0x55fc1a[_0x114a('0x51')](_0xdf1c29,{'sessionId':md5(_0x34af7e)})[_0x114a('0x27')](function(_0x554a71){logger[_0x114a('0x37')](JSON[_0x114a('0x3c')](_0x554a71));return{'source':_0x554a71[_0x114a('0x52')][_0x114a('0x53')],'resolvedQuery':_0x554a71[_0x114a('0x52')][_0x114a('0x54')],'action':_0x554a71[_0x114a('0x52')]['action'],'actionIncomplete':_0x554a71[_0x114a('0x52')]['actionIncomplete'],'speech':_0x554a71[_0x114a('0x52')][_0x114a('0x55')][_0x114a('0x56')],'score':_0x554a71[_0x114a('0x52')][_0x114a('0x57')],'statusCode':_0x554a71[_0x114a('0x58')][_0x114a('0x59')],'endConversation':_0x554a71[_0x114a('0x52')]['metadata']['endConversation']||![],'isFallbackIntent':_0x554a71['result'][_0x114a('0x5a')][_0x114a('0x5b')]};});};exports[_0x114a('0x5c')]=function(_0x2d5a88,_0x57bf49,_0x2ba803,_0x1036f7,_0x500f5a,_0xd70470){var _0x5df87a=_0x1036f7[_0x114a('0x5d')](/\\n/g,'\x0a');var _0x8be334={'credentials':{'private_key':_0x5df87a,'client_email':_0x2ba803}};var _0x495d4a=new dialogflow[(_0x114a('0x5e'))](_0x8be334);var _0x5dfe3c=_0x495d4a['sessionPath'](_0x57bf49,md5(_0x2d5a88));var _0x425abf={'session':_0x5dfe3c,'queryInput':{'text':{'text':_0x500f5a,'languageCode':_0xd70470}}};return _0x495d4a['detectIntent'](_0x425abf)[_0x114a('0x27')](function(_0x14eb67){if(_0x14eb67&&_0x14eb67['length']){logger['info']('Dialogflow\x20V2\x20response:',JSON['stringify'](_0x14eb67));var _0x2f87ab=_0x14eb67[0x0];if(_0x2f87ab){var _0x1f14d0={'action':_0x2f87ab['queryResult']['action'],'allRequiredParamsPresent':_0x2f87ab['queryResult'][_0x114a('0x5f')],'endConversation':_0x2f87ab[_0x114a('0x60')][_0x114a('0x61')]&&_0x2f87ab[_0x114a('0x60')][_0x114a('0x61')][_0x114a('0x62')]?_0x2f87ab[_0x114a('0x60')]['diagnosticInfo'][_0x114a('0x62')][_0x114a('0x63')]['boolValue']:![],'fulfillmentText':_0x2f87ab[_0x114a('0x60')]['fulfillmentText'],'intentName':_0x2f87ab[_0x114a('0x60')]['intent'][_0x114a('0x64')],'intentDisplayName':_0x2f87ab['queryResult'][_0x114a('0x65')][_0x114a('0x66')],'isFallbackIntent':_0x2f87ab[_0x114a('0x60')]['intent']['isFallback'],'languageCode':_0x2f87ab[_0x114a('0x60')]['languageCode'],'queryText':_0x2f87ab[_0x114a('0x60')][_0x114a('0x67')],'responseId':_0x2f87ab['responseId'],'score':_0x2f87ab['queryResult'][_0x114a('0x68')],'speech':_0x2f87ab[_0x114a('0x60')]['fulfillmentText'],'providerResponse':JSON[_0x114a('0x3c')](_0x14eb67)};return _0x1f14d0;}}});};exports[_0x114a('0x69')]=function(_0x5c3f40,_0x1bb6fa,_0x48726e,_0x59f3e6){return tilde[_0x114a('0x45')](_0x5c3f40,_0x1bb6fa,_0x48726e,_0x59f3e6)[_0x114a('0x27')](function(_0x367b4d){try{fs[_0x114a('0x1a')](_0x5c3f40);}catch(_0x246fbb){logger[_0x114a('0x19')](_0x246fbb);}logger[_0x114a('0x37')]('Tilde\x20ASR\x20transcription',_0x367b4d[_0x114a('0x48')]);logger[_0x114a('0x37')]('Tilde\x20ASR\x20confidence',_0x367b4d[_0x114a('0x6a')]);return _0x367b4d;});};exports['awsPolly']=function(_0x1dc134,_0x3d29d1,_0x11368e,_0x2eb227,_0x559f23,_0x19f3d3){var _0x4964ce=path[_0x114a('0x24')](__dirname,_0x114a('0x44'),rs[_0x114a('0x33')](0x4)+_0x114a('0x34'));var _0xf979b8;return aws['polly'](_0x1dc134,_0x3d29d1,_0x11368e,_0x2eb227,_0x559f23,_0x19f3d3,_0x4964ce)['then'](function(){_0xf979b8=path['resolve'](__dirname,_0x114a('0x44'),rs[_0x114a('0x33')](0x4)+_0x114a('0x25'));return convertFile(_0x4964ce,_0xf979b8);})['then'](function(){try{fs[_0x114a('0x1a')](_0x4964ce);fs[_0x114a('0x36')](_0xf979b8,_0x114a('0x28'));}catch(_0x12984b){logger['error'](_0x12984b);}return _0xf979b8[_0x114a('0x38')]('.')[0x0];});};exports[_0x114a('0x6b')]=function(_0x3d7023,_0x55ee2c,_0x101d1f,_0x4c9d5f,_0x2a1fe2,_0x5c1402){return aws[_0x114a('0x6c')](_0x3d7023,_0x55ee2c,_0x101d1f,_0x4c9d5f,_0x2a1fe2,_0x5c1402)[_0x114a('0x27')](function(_0x29c023){logger[_0x114a('0x37')](JSON[_0x114a('0x3c')](_0x29c023));return _0x29c023;});};exports[_0x114a('0x6d')]=function(_0x674880,_0x5719a0,_0x5d1c08,_0x562dc8){var _0x5e9d4e=util[_0x114a('0x6e')](_0x114a('0x6f'),ISPEECH_API,_0x674880,encodeURIComponent(_0x5719a0),_0x5d1c08,_0x562dc8);var _0x1e3a7e=path[_0x114a('0x24')](__dirname,_0x114a('0x44'),rs[_0x114a('0x33')](0x4)+_0x114a('0x34'));var _0xdaf1e4;return downloadFile(_0x5e9d4e,_0x1e3a7e)[_0x114a('0x27')](function(){_0xdaf1e4=path[_0x114a('0x24')](__dirname,_0x114a('0x44'),rs[_0x114a('0x33')](0x4)+_0x114a('0x25'));return convertFile(_0x1e3a7e,_0xdaf1e4);})[_0x114a('0x27')](function(){try{fs[_0x114a('0x1a')](_0x1e3a7e);fs['chmodSync'](_0xdaf1e4,'777');}catch(_0x50c2d4){logger['error'](_0x50c2d4);}return _0xdaf1e4[_0x114a('0x38')]('.')[0x0];});};exports[_0x114a('0x70')]=function(_0x444638,_0x46978d,_0x1421bb,_0x2711be){var _0x511499=util[_0x114a('0x6e')](_0x114a('0x71'),ISPEECH_API,_0x46978d,_0x1421bb,base64Encode(_0x444638),_0x2711be?util[_0x114a('0x6e')](_0x114a('0x72'),encodeURIComponent(_0x2711be)):_0x114a('0x73'));return uploadFile(_0x511499)[_0x114a('0x27')](function(_0x4c735d){return querystring[_0x114a('0x74')](_0x4c735d);});};exports['sestekNDA']=function(_0x49f547,_0x2faf41){return sestek[_0x114a('0x75')](_0x49f547,_0x2faf41)[_0x114a('0x27')](function(_0x3cd9be){logger['info'](JSON[_0x114a('0x3c')](_0x3cd9be));var _0x20c528={'speech':_0x3cd9be[_0x114a('0x76')],'action':_0x3cd9be[_0x114a('0x77')]?_0x3cd9be[_0x114a('0x77')][_0x114a('0x78')]:undefined,'actiondata':_0x3cd9be[_0x114a('0x77')]?_0x3cd9be[_0x114a('0x77')]['CustomActionData']:undefined};if(_0x3cd9be['channelData']&&_0x3cd9be[_0x114a('0x77')][_0x114a('0x79')]){return base64Decode(_0x3cd9be[_0x114a('0x77')]['AudioFromTts'][_0x114a('0x7a')],path[_0x114a('0x24')](__dirname,_0x114a('0x44'),rs[_0x114a('0x33')](0x4)+_0x114a('0x25')))[_0x114a('0x27')](function(_0x575b4d){_0x20c528['audiofile']=_0x575b4d;return _0x20c528;});}return _0x20c528;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0xf758=['name','message','googleDialogflow','textRequest','result','source','fulfillment','speech','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','action','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','dirName','apiai-promise','bluebird','https','md5','path','querystring','randomstring','sox','url','parse','./aws','./google','./tilde','agi','protocol','https:','host','WHAT_EVER','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish\x20download\x20file','close','error','download\x20error','pipe','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','unlink','split','readFileSync','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','from','audioContent','chmodSync','777','info','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','slice','length','lang\x20\x22','\x22\x20might\x20not\x20exist','data','.mp3','googleASR','asr','results','alternatives','transcript','confidence','join','googleASR\x20transcription','catch','[%s]\x20%s:%s'];(function(_0x107a30,_0x175ab9){var _0x41b99b=function(_0x2c00b6){while(--_0x2c00b6){_0x107a30['push'](_0x107a30['shift']());}};_0x41b99b(++_0x175ab9);}(_0xf758,0xb5));var _0x8f75=function(_0x1fd7c0,_0x1d3c01){_0x1fd7c0=_0x1fd7c0-0x0;var _0x1f27d5=_0xf758[_0x1fd7c0];return _0x1f27d5;};'use strict';var apiai=require(_0x8f75('0x0'));var BPromise=require(_0x8f75('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require(_0x8f75('0x2'));var md5=require(_0x8f75('0x3'));var path=require(_0x8f75('0x4'));var querystring=require(_0x8f75('0x5'));var rp=require('request-promise');var rs=require(_0x8f75('0x6'));var sox=require(_0x8f75('0x7'));var tts=require('google-tts-api');var urlParse=require(_0x8f75('0x8'))[_0x8f75('0x9')];var util=require('util');var aws=require(_0x8f75('0xa'));var google=require(_0x8f75('0xb'));var sestek=require('./sestek');var tilde=require(_0x8f75('0xc'));var logger=require('../../../config/logger')(_0x8f75('0xd'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x3ce5ae,_0x2ca5f3){return new BPromise(function(_0x23d693,_0x4a8ac7){var _0x251253=urlParse(_0x3ce5ae);var _0x17d0d0=_0x251253[_0x8f75('0xe')]===_0x8f75('0xf')?https:http;var _0x52674d={'host':_0x251253[_0x8f75('0x10')],'path':_0x251253[_0x8f75('0x4')],'headers':{'user-agent':_0x8f75('0x11')}};_0x17d0d0[_0x8f75('0x12')](_0x52674d,function(_0x3636f5){if(_0x3636f5['statusCode']!==0xc8){logger['error'](_0x8f75('0x13')+_0x3ce5ae+_0x8f75('0x14')+_0x3636f5[_0x8f75('0x15')]+'\x20('+_0x3636f5['statusMessage']+')');_0x4a8ac7(new Error(_0x8f75('0x13')+_0x3ce5ae+_0x8f75('0x14')+_0x3636f5[_0x8f75('0x15')]+'\x20('+_0x3636f5[_0x8f75('0x16')]+')'));return;}var _0xe075dc=fs[_0x8f75('0x17')](_0x2ca5f3);_0xe075dc['on']('finish',function(){logger['info'](_0x8f75('0x18'));_0xe075dc[_0x8f75('0x19')](_0x23d693);});_0xe075dc['on'](_0x8f75('0x1a'),function(_0x579e70){fs['unlink'](_0x2ca5f3);logger[_0x8f75('0x1a')](_0x8f75('0x1b'),_0x579e70);_0x4a8ac7(_0x579e70);});_0x3636f5[_0x8f75('0x1c')](_0xe075dc);})['on'](_0x8f75('0x1a'),function(_0x1c640c){logger[_0x8f75('0x1a')](_0x1c640c);_0x4a8ac7(_0x1c640c);})[_0x8f75('0x1d')]();});}function uploadFile(_0x4bf36a){return new BPromise(function(_0xc4f8a8,_0x3ddabf){var _0x4944d0=urlParse(_0x4bf36a);var _0x2457d3=_0x4944d0['protocol']==='https:'?https:http;var _0x3cb090={'host':_0x4944d0[_0x8f75('0x10')],'path':_0x4944d0['path'],'headers':{'user-agent':_0x8f75('0x11')}};_0x2457d3[_0x8f75('0x12')](_0x3cb090,function(_0x44cf45){if(_0x44cf45[_0x8f75('0x15')]!==0xc8){_0x3ddabf(new Error(_0x8f75('0x13')+_0x4bf36a+_0x8f75('0x14')+_0x44cf45['statusCode']+'\x20('+_0x44cf45[_0x8f75('0x16')]+')'));return;}var _0x2c5dea='';_0x44cf45['on']('data',function(_0x189ed0){_0x2c5dea+=_0x189ed0;});_0x44cf45['on']('end',function(){_0xc4f8a8(_0x2c5dea);});})['on'](_0x8f75('0x1a'),function(_0x300328){_0x3ddabf(_0x300328);})['end']();});}function convertFile(_0x31f734,_0x51fd52){return new BPromise(function(_0x468c44,_0x3edd9f){var _0x210e56=sox[_0x8f75('0x1e')](_0x31f734,_0x51fd52,{'sampleRate':0x1f40,'format':_0x8f75('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x210e56['on'](_0x8f75('0x1a'),function(_0x3ed20a){logger['error'](_0x8f75('0x20'),_0x3ed20a);_0x3edd9f(_0x3ed20a);});_0x210e56['on'](_0x8f75('0x1d'),function(){logger['info'](_0x8f75('0x21'));_0x468c44();});_0x210e56[_0x8f75('0x22')]();});}function base64Decode(_0xa05413,_0x490cea){var _0x100a91=path[_0x8f75('0x23')](__dirname,_0x8f75('0x24'),rs[_0x8f75('0x25')](0x4)+_0x8f75('0x26'));fs[_0x8f75('0x27')](_0x100a91,_0xa05413,_0x8f75('0x28'));return convertFile(_0x100a91,_0x490cea)[_0x8f75('0x29')](function(){try{fs[_0x8f75('0x2a')](_0x100a91);fs['chmodSync'](_0x490cea,'777');}catch(_0x4c68ac){logger[_0x8f75('0x1a')](_0x4c68ac);}return _0x490cea[_0x8f75('0x2b')]('.')[0x0];});}function base64Encode(_0x152775){var _0x226ba8=fs[_0x8f75('0x2c')](_0x152775);return new Buffer(_0x226ba8)['toString']('base64');}exports['googleCloudTTS']=function(_0x248726,_0x579917,_0x4eb2b2,_0x568298,_0x25606d,_0x367fde){var _0x476986,_0xb195db;var _0x4fbc2f=_0x8f75('0x2d');var _0x39c7cb=_0x8f75('0x2e')+_0x248726;var _0x56e372={};if(_0x579917===_0x8f75('0x2f')){_0x56e372[_0x8f75('0x30')]={'ssml':_0x4eb2b2};}else{_0x56e372['input']={'text':_0x4eb2b2};};_0x56e372[_0x8f75('0x31')]={'languageCode':_0x568298,'ssmlGender':_0x25606d};_0x56e372[_0x8f75('0x32')]={'audioEncoding':_0x8f75('0x33'),'sampleRateHertz':0x1f40};var _0x2a61d0={'url':_0x4fbc2f+_0x8f75('0x34')+_0x39c7cb,'method':_0x8f75('0x35'),'json':!![],'body':_0x56e372};return rp(_0x2a61d0)['then'](function(_0xc29f6d){return new BPromise(function(_0x1d2a28,_0x2a926a){_0x476986=path[_0x8f75('0x23')](__dirname,'tmp',rs[_0x8f75('0x25')](0x4)+'.mp3');var _0x2fd6d6=Buffer[_0x8f75('0x36')](_0xc29f6d[_0x8f75('0x37')],'base64');return fs['writeFile'](_0x476986,_0x2fd6d6,function(_0x30d263){_0x2a926a(_0x30d263);},function(_0x52cfbf){fs[_0x8f75('0x38')](_0x476986,_0x8f75('0x39'));_0x1d2a28(_0x52cfbf);});});})[_0x8f75('0x29')](function(_0x47dd5e){_0xb195db=path[_0x8f75('0x23')](__dirname,'tmp',rs[_0x8f75('0x25')](0x4)+_0x8f75('0x26'));return convertFile(_0x476986,_0xb195db);})[_0x8f75('0x29')](function(){try{fs[_0x8f75('0x2a')](_0x476986);fs[_0x8f75('0x38')](_0xb195db,'777');}catch(_0x3e5236){logger[_0x8f75('0x1a')](_0x3e5236);}logger[_0x8f75('0x3a')]('googleCloudTTS\x20path',_0xb195db[_0x8f75('0x2b')]('.')[0x0]);return _0xb195db[_0x8f75('0x2b')]('.')[0x0];});};exports[_0x8f75('0x3b')]=function(_0x461b15,_0x15254c){var _0x448a11=_0x8f75('0x3c');var _0x1a144c,_0x8507f0;var _0x87013f;var _0x13f9d0={'encoding':_0x8f75('0x3d'),'method':'POST','timeout':0x2710,'url':_0x448a11,'headers':{'Content-Type':_0x8f75('0x3e')},'body':_0x8f75('0x3f')+encodeURIComponent(JSON[_0x8f75('0x40')]([[['jQ1olc',JSON['stringify']([_0x461b15,_0x15254c||'en',![],'null']),null,'generic']]]))};return rp(_0x13f9d0)[_0x8f75('0x29')](function(_0x23ae25){try{_0x87013f=eval(_0x23ae25[_0x8f75('0x41')](0x5))[0x0][0x2];}catch(_0x4ff0d7){throw new Error('parse\x20response\x20failed:\x0a'+_0x23ae25['data']);}if(!_0x87013f){if(_0x461b15[_0x8f75('0x42')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x8f75('0x43')+_0x15254c+_0x8f75('0x44'));}}try{_0x87013f=eval(_0x87013f)[0x0];}catch(_0x5b767b){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x8f75('0x45')]);}const _0x510997=_0x87013f;_0x1a144c=path['resolve'](__dirname,'tmp',rs[_0x8f75('0x25')](0x4)+_0x8f75('0x46'));fs[_0x8f75('0x27')](_0x1a144c,_0x87013f,{'encoding':_0x8f75('0x28')});_0x8507f0=path[_0x8f75('0x23')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x1a144c,_0x8507f0);})[_0x8f75('0x29')](function(){try{fs[_0x8f75('0x2a')](_0x1a144c);fs['chmodSync'](_0x8507f0,_0x8f75('0x39'));}catch(_0x3fa7ab){logger[_0x8f75('0x1a')](_0x3fa7ab);}logger[_0x8f75('0x3a')]('goggleTTS\x20path',_0x8507f0[_0x8f75('0x2b')]('.')[0x0]);return _0x8507f0[_0x8f75('0x2b')]('.')[0x0];});};exports[_0x8f75('0x47')]=function(_0x3f4d61,_0x40fca0,_0x50371e){return google[_0x8f75('0x48')](_0x3f4d61,_0x40fca0,_0x50371e)[_0x8f75('0x29')](function(_0x5c6e49){logger[_0x8f75('0x3a')](_0x5c6e49['uri']);return rp(_0x5c6e49);})[_0x8f75('0x29')](function(_0x44a499){var _0x4ddd7a='';var _0x37e537=0x0;try{fs[_0x8f75('0x2a')](_0x3f4d61);}catch(_0x123f2f){logger[_0x8f75('0x1a')](_0x123f2f);}if(_0x44a499&&_0x44a499[_0x8f75('0x49')]){_0x4ddd7a=_0x44a499[_0x8f75('0x49')]['map'](function(_0x135d0b){return _0x135d0b&&_0x135d0b[_0x8f75('0x4a')][0x0]&&_0x135d0b[_0x8f75('0x4a')][0x0][_0x8f75('0x4b')]?_0x135d0b[_0x8f75('0x4a')][0x0]['transcript']:'';})['join']('\x0a');_0x37e537=_0x44a499[_0x8f75('0x49')]['map'](function(_0x25c7ce){return _0x25c7ce&&_0x25c7ce[_0x8f75('0x4a')][0x0]&&_0x25c7ce['alternatives'][0x0][_0x8f75('0x4c')]?_0x25c7ce[_0x8f75('0x4a')][0x0][_0x8f75('0x4c')]:0x0;})[_0x8f75('0x4d')]('\x0a');}logger[_0x8f75('0x3a')](_0x8f75('0x4e'),_0x4ddd7a);logger[_0x8f75('0x3a')]('googleASR\x20confidence',_0x37e537);return{'transcript':_0x4ddd7a,'confidence':_0x37e537};})[_0x8f75('0x4f')](function(_0x29023c){logger[_0x8f75('0x1a')](_0x8f75('0x50'),_0x29023c[_0x8f75('0x15')],_0x29023c[_0x8f75('0x51')],_0x29023c[_0x8f75('0x52')]);});};exports[_0x8f75('0x53')]=function(_0x5b797b,_0x444f76,_0x10741a,_0x4ca740){var _0x2004a9=apiai(_0x444f76,{'language':_0x4ca740||'en'});return _0x2004a9[_0x8f75('0x54')](_0x10741a,{'sessionId':md5(_0x5b797b)})[_0x8f75('0x29')](function(_0xf730e4){logger[_0x8f75('0x3a')](JSON[_0x8f75('0x40')](_0xf730e4));return{'source':_0xf730e4[_0x8f75('0x55')][_0x8f75('0x56')],'resolvedQuery':_0xf730e4[_0x8f75('0x55')]['resolvedQuery'],'action':_0xf730e4[_0x8f75('0x55')]['action'],'actionIncomplete':_0xf730e4[_0x8f75('0x55')]['actionIncomplete'],'speech':_0xf730e4[_0x8f75('0x55')][_0x8f75('0x57')][_0x8f75('0x58')],'score':_0xf730e4[_0x8f75('0x55')]['score'],'statusCode':_0xf730e4[_0x8f75('0x59')][_0x8f75('0x5a')],'endConversation':_0xf730e4['result'][_0x8f75('0x5b')][_0x8f75('0x5c')]||![],'isFallbackIntent':_0xf730e4[_0x8f75('0x55')][_0x8f75('0x5b')][_0x8f75('0x5d')]};});};exports[_0x8f75('0x5e')]=function(_0x4397d1,_0x3ea3ba,_0x3ddd7a,_0x40d1fb,_0x1835ff,_0x1231d5){var _0x188293=_0x40d1fb['replace'](/\\n/g,'\x0a');var _0x5df3cc={'credentials':{'private_key':_0x188293,'client_email':_0x3ddd7a}};var _0x32e326=new dialogflow['SessionsClient'](_0x5df3cc);var _0x16fb37=_0x32e326[_0x8f75('0x5f')](_0x3ea3ba,md5(_0x4397d1));var _0x18e631={'session':_0x16fb37,'queryInput':{'text':{'text':_0x1835ff,'languageCode':_0x1231d5}}};return _0x32e326[_0x8f75('0x60')](_0x18e631)[_0x8f75('0x29')](function(_0x3f6949){if(_0x3f6949&&_0x3f6949[_0x8f75('0x42')]){logger[_0x8f75('0x3a')](_0x8f75('0x61'),JSON[_0x8f75('0x40')](_0x3f6949));var _0x27e7eb=_0x3f6949[0x0];if(_0x27e7eb){var _0x3f9d68={'action':_0x27e7eb['queryResult'][_0x8f75('0x62')],'allRequiredParamsPresent':_0x27e7eb[_0x8f75('0x63')][_0x8f75('0x64')],'endConversation':_0x27e7eb[_0x8f75('0x63')][_0x8f75('0x65')]&&_0x27e7eb['queryResult'][_0x8f75('0x65')][_0x8f75('0x66')]?_0x27e7eb[_0x8f75('0x63')][_0x8f75('0x65')][_0x8f75('0x66')][_0x8f75('0x67')][_0x8f75('0x68')]:![],'fulfillmentText':_0x27e7eb[_0x8f75('0x63')][_0x8f75('0x69')],'intentName':_0x27e7eb[_0x8f75('0x63')][_0x8f75('0x6a')]['name'],'intentDisplayName':_0x27e7eb['queryResult'][_0x8f75('0x6a')][_0x8f75('0x6b')],'isFallbackIntent':_0x27e7eb['queryResult']['intent'][_0x8f75('0x6c')],'languageCode':_0x27e7eb[_0x8f75('0x63')][_0x8f75('0x6d')],'queryText':_0x27e7eb[_0x8f75('0x63')]['queryText'],'responseId':_0x27e7eb[_0x8f75('0x6e')],'score':_0x27e7eb[_0x8f75('0x63')][_0x8f75('0x6f')],'speech':_0x27e7eb[_0x8f75('0x63')][_0x8f75('0x69')],'providerResponse':JSON[_0x8f75('0x40')](_0x3f6949)};return _0x3f9d68;}}});};exports[_0x8f75('0x70')]=function(_0x363549,_0x167da0,_0x1ca4ef,_0xdcf201){return tilde[_0x8f75('0x48')](_0x363549,_0x167da0,_0x1ca4ef,_0xdcf201)[_0x8f75('0x29')](function(_0x35fdfb){try{fs[_0x8f75('0x2a')](_0x363549);}catch(_0x5831b8){logger[_0x8f75('0x1a')](_0x5831b8);}logger[_0x8f75('0x3a')](_0x8f75('0x71'),_0x35fdfb['transcript']);logger[_0x8f75('0x3a')](_0x8f75('0x72'),_0x35fdfb['confidence']);return _0x35fdfb;});};exports[_0x8f75('0x73')]=function(_0x372086,_0x10be48,_0x3e37cb,_0x1f7113,_0xd6ba7d,_0x46f3b1){var _0x19e6c3=path['resolve'](__dirname,_0x8f75('0x24'),rs[_0x8f75('0x25')](0x4)+'.mp3');var _0x13140;return aws['polly'](_0x372086,_0x10be48,_0x3e37cb,_0x1f7113,_0xd6ba7d,_0x46f3b1,_0x19e6c3)[_0x8f75('0x29')](function(){_0x13140=path['resolve'](__dirname,_0x8f75('0x24'),rs[_0x8f75('0x25')](0x4)+'.wav');return convertFile(_0x19e6c3,_0x13140);})['then'](function(){try{fs[_0x8f75('0x2a')](_0x19e6c3);fs[_0x8f75('0x38')](_0x13140,_0x8f75('0x39'));}catch(_0x55d488){logger['error'](_0x55d488);}return _0x13140[_0x8f75('0x2b')]('.')[0x0];});};exports[_0x8f75('0x74')]=function(_0x3907ae,_0x8fa2d6,_0x5278db,_0x416a38,_0x116ec4,_0x585732){return aws['lex'](_0x3907ae,_0x8fa2d6,_0x5278db,_0x416a38,_0x116ec4,_0x585732)[_0x8f75('0x29')](function(_0x1daee9){logger['info'](JSON[_0x8f75('0x40')](_0x1daee9));return _0x1daee9;});};exports[_0x8f75('0x75')]=function(_0x14c0b7,_0x456f11,_0x449f66,_0x5fb587){var _0x907f9d=util[_0x8f75('0x76')](_0x8f75('0x77'),ISPEECH_API,_0x14c0b7,encodeURIComponent(_0x456f11),_0x449f66,_0x5fb587);var _0x2834d1=path[_0x8f75('0x23')](__dirname,_0x8f75('0x24'),rs[_0x8f75('0x25')](0x4)+_0x8f75('0x46'));var _0xeca3bb;return downloadFile(_0x907f9d,_0x2834d1)['then'](function(){_0xeca3bb=path[_0x8f75('0x23')](__dirname,'tmp',rs['generate'](0x4)+_0x8f75('0x26'));return convertFile(_0x2834d1,_0xeca3bb);})[_0x8f75('0x29')](function(){try{fs[_0x8f75('0x2a')](_0x2834d1);fs[_0x8f75('0x38')](_0xeca3bb,'777');}catch(_0x1b8507){logger['error'](_0x1b8507);}return _0xeca3bb[_0x8f75('0x2b')]('.')[0x0];});};exports[_0x8f75('0x78')]=function(_0x19e2d2,_0x5b22d9,_0x21d07a,_0x3e57ba){var _0x5c6460=util[_0x8f75('0x76')](_0x8f75('0x79'),ISPEECH_API,_0x5b22d9,_0x21d07a,base64Encode(_0x19e2d2),_0x3e57ba?util[_0x8f75('0x76')](_0x8f75('0x7a'),encodeURIComponent(_0x3e57ba)):_0x8f75('0x7b'));return uploadFile(_0x5c6460)['then'](function(_0x2f0e82){return querystring[_0x8f75('0x9')](_0x2f0e82);});};exports[_0x8f75('0x7c')]=function(_0x2c0d2f,_0x54d22d){return sestek[_0x8f75('0x7d')](_0x2c0d2f,_0x54d22d)['then'](function(_0xdaf0fd){logger[_0x8f75('0x3a')](JSON[_0x8f75('0x40')](_0xdaf0fd));var _0x47174e={'speech':_0xdaf0fd[_0x8f75('0x7e')],'action':_0xdaf0fd['channelData']?_0xdaf0fd[_0x8f75('0x7f')]['CustomAction']:undefined,'actiondata':_0xdaf0fd[_0x8f75('0x7f')]?_0xdaf0fd[_0x8f75('0x7f')][_0x8f75('0x80')]:undefined};if(_0xdaf0fd[_0x8f75('0x7f')]&&_0xdaf0fd[_0x8f75('0x7f')]['AudioFromTts']){return base64Decode(_0xdaf0fd[_0x8f75('0x7f')][_0x8f75('0x81')]['Data'],path['resolve'](__dirname,_0x8f75('0x24'),rs[_0x8f75('0x25')](0x4)+'.wav'))[_0x8f75('0x29')](function(_0x4be803){_0x47174e['audiofile']=_0x4be803;return _0x47174e;});}return _0x47174e;});};exports[_0x8f75('0x82')]=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 af55091..41d191f 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 _0x9ed1=['exports','./nda'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x9ed1,0x147));var _0x19ed=function(_0x4f333e,_0x82eb15){_0x4f333e=_0x4f333e-0x0;var _0x3a4190=_0x9ed1[_0x4f333e];return _0x3a4190;};var nda=require(_0x19ed('0x0'));module[_0x19ed('0x1')]={'nda':nda}; \ No newline at end of file +var _0xbff4=['exports'];(function(_0x57f8fa,_0x413e2b){var _0x89e95a=function(_0x1b98e7){while(--_0x1b98e7){_0x57f8fa['push'](_0x57f8fa['shift']());}};_0x89e95a(++_0x413e2b);}(_0xbff4,0x80));var _0x4bff=function(_0x3299d1,_0x545733){_0x3299d1=_0x3299d1-0x0;var _0x44356e=_0xbff4[_0x3299d1];return _0x44356e;};var nda=require('./nda');module[_0x4bff('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 83a3f05..55e569a 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 _0x1df5=['ProjectName','ndagenerate_audio','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData'];(function(_0x25936d,_0x5512d5){var _0x1cbddc=function(_0x187399){while(--_0x187399){_0x25936d['push'](_0x25936d['shift']());}};_0x1cbddc(++_0x5512d5);}(_0x1df5,0xfd));var _0x51df=function(_0x9b7841,_0x2602cc){_0x9b7841=_0x9b7841-0x0;var _0x3957f0=_0x1df5[_0x9b7841];return _0x3957f0;};'use strict';var rp=require(_0x51df('0x0'));var url=require(_0x51df('0x1'));var logger=require(_0x51df('0x2'))(_0x51df('0x3'));module[_0x51df('0x4')]=function(_0x557d22,_0x3439b4){var _0x457292={'method':_0x51df('0x5'),'uri':url[_0x51df('0x6')](_0x3439b4[_0x51df('0x7')],_0x51df('0x8')),'form':{'grant_type':_0x51df('0x9'),'username':_0x3439b4[_0x51df('0xa')],'password':_0x3439b4['password']},'json':!![]};return rp(_0x457292)[_0x51df('0xb')](function(_0x53b879){var _0x42a74a={'method':_0x51df('0x5'),'uri':url[_0x51df('0x6')](_0x3439b4[_0x51df('0xc')],_0x51df('0xd')),'body':{'type':_0x3439b4[_0x51df('0xe')]||_0x51df('0xf'),'channelId':_0x51df('0x10'),'conversation':{'id':_0x557d22['uniqueid']},'from':{'id':_0x557d22[_0x51df('0x11')],'name':_0x557d22[_0x51df('0x12')]},'recipient':{'id':_0x557d22[_0x51df('0x13')],'name':_0x557d22[_0x51df('0x14')]},'text':_0x3439b4[_0x51df('0x15')],'channelData':{}},'headers':{'Authorization':_0x51df('0x16')+_0x53b879[_0x51df('0x17')]},'json':!![]};if(_0x3439b4[_0x51df('0x18')]){_0x42a74a[_0x51df('0x19')][_0x51df('0x1a')][_0x51df('0x1b')]=_0x3439b4[_0x51df('0x18')];}if(_0x3439b4[_0x51df('0x1c')]=='1'){_0x42a74a[_0x51df('0x19')][_0x51df('0x1a')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x51df('0x1d')};}if(_0x3439b4[_0x51df('0x1e')]){_0x42a74a['body'][_0x51df('0x1a')][_0x51df('0x1f')]=_0x3439b4[_0x51df('0x1e')];if(_0x3439b4['custom_action_data']){_0x42a74a[_0x51df('0x19')][_0x51df('0x1a')][_0x51df('0x20')]=_0x3439b4[_0x51df('0x21')];}}logger['info'](JSON[_0x51df('0x22')](_0x42a74a));return rp(_0x42a74a);});}; \ No newline at end of file +var _0x33a4=['project','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','body','info','stringify','url','agi','exports','resolve','ndauth_url','/token','password','username','then','POST','ndassistant_url','message','Nda','uniqueid','callerid','calleridname','text','Bearer\x20','access_token'];(function(_0x325676,_0x1615a9){var _0xaababf=function(_0x22b03b){while(--_0x22b03b){_0x325676['push'](_0x325676['shift']());}};_0xaababf(++_0x1615a9);}(_0x33a4,0x88));var _0x433a=function(_0x1c4387,_0x3288ff){_0x1c4387=_0x1c4387-0x0;var _0x357041=_0x33a4[_0x1c4387];return _0x357041;};'use strict';var rp=require('request-promise');var url=require(_0x433a('0x0'));var logger=require('../../../../../config/logger')(_0x433a('0x1'));module[_0x433a('0x2')]=function(_0x1917aa,_0x4909a4){var _0x4b7aef={'method':'POST','uri':url[_0x433a('0x3')](_0x4909a4[_0x433a('0x4')],_0x433a('0x5')),'form':{'grant_type':_0x433a('0x6'),'username':_0x4909a4[_0x433a('0x7')],'password':_0x4909a4['password']},'json':!![]};return rp(_0x4b7aef)[_0x433a('0x8')](function(_0x58e65c){var _0x2c2404={'method':_0x433a('0x9'),'uri':url[_0x433a('0x3')](_0x4909a4[_0x433a('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x4909a4['ndaactivity_type']||_0x433a('0xb'),'channelId':_0x433a('0xc'),'conversation':{'id':_0x1917aa[_0x433a('0xd')]},'from':{'id':_0x1917aa[_0x433a('0xe')],'name':_0x1917aa[_0x433a('0xf')]},'recipient':{'id':_0x1917aa['dnid'],'name':_0x1917aa['extension']},'text':_0x4909a4[_0x433a('0x10')],'channelData':{}},'headers':{'Authorization':_0x433a('0x11')+_0x58e65c[_0x433a('0x12')]},'json':!![]};if(_0x4909a4[_0x433a('0x13')]){_0x2c2404['body'][_0x433a('0x14')][_0x433a('0x15')]=_0x4909a4['project'];}if(_0x4909a4[_0x433a('0x16')]=='1'){_0x2c2404['body'][_0x433a('0x14')][_0x433a('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x433a('0x18')};}if(_0x4909a4['custom_action']){_0x2c2404['body'][_0x433a('0x14')][_0x433a('0x19')]=_0x4909a4[_0x433a('0x1a')];if(_0x4909a4[_0x433a('0x1b')]){_0x2c2404[_0x433a('0x1c')]['channelData']['CustomActionData']=_0x4909a4[_0x433a('0x1b')];}}logger[_0x433a('0x1d')](JSON[_0x433a('0x1e')](_0x2c2404));return rp(_0x2c2404);});}; \ 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 94189d9..15d89c2 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 _0xa2df=['exports','./lib/api'];(function(_0x28d8c0,_0x5ca531){var _0x257b01=function(_0x397cca){while(--_0x397cca){_0x28d8c0['push'](_0x28d8c0['shift']());}};_0x257b01(++_0x5ca531);}(_0xa2df,0x10d));var _0xfa2d=function(_0x350ba0,_0x3417b1){_0x350ba0=_0x350ba0-0x0;var _0x5aadd1=_0xa2df[_0x350ba0];return _0x5aadd1;};'use strict';var asr=require(_0xfa2d('0x0'));module[_0xfa2d('0x1')]=function(_0x397b08,_0x5dcf54,_0x25de39,_0x57e1f6){return asr(_0x397b08,_0x5dcf54,_0x25de39,_0x57e1f6);}; \ No newline at end of file +var _0xa739=['./lib/api','exports'];(function(_0x295491,_0x4d8b4a){var _0x2a6742=function(_0xfa3f7d){while(--_0xfa3f7d){_0x295491['push'](_0x295491['shift']());}};_0x2a6742(++_0x4d8b4a);}(_0xa739,0x72));var _0x9a73=function(_0x2d23c4,_0x32be04){_0x2d23c4=_0x2d23c4-0x0;var _0x323c61=_0xa739[_0x2d23c4];return _0x323c61;};'use strict';var asr=require(_0x9a73('0x0'));module[_0x9a73('0x1')]=function(_0x19d803,_0xd52a17,_0x3c67a8,_0x22cc8e){return asr(_0x19d803,_0xd52a17,_0x3c67a8,_0x22cc8e);}; \ 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 9047029..996688d 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 _0x165a=['result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','bluebird','lodash','moment','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','unix','send','stringify','createReadStream','data','close','EOS','error','terminate','parse','status'];(function(_0x2d0d68,_0x11e7ab){var _0xb8b405=function(_0x505fe6){while(--_0x505fe6){_0x2d0d68['push'](_0x2d0d68['shift']());}};_0xb8b405(++_0x11e7ab);}(_0x165a,0x1f0));var _0xa165=function(_0x146fc1,_0x418c03){_0x146fc1=_0x146fc1-0x0;var _0x25777e=_0x165a[_0x146fc1];return _0x25777e;};'use strict';var BPromise=require(_0xa165('0x0'));var _=require(_0xa165('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xa165('0x2'));var crypto=require('crypto');var logger=require(_0xa165('0x3'))(_0xa165('0x4'));module[_0xa165('0x5')]=function(_0x4d46c9,_0xd27500,_0x23505c,_0x1c2d90){return new BPromise(function(_0x5a48af,_0x82946b){logger[_0xa165('0x6')]('Tilde\x20URI',_0x1c2d90||_0xa165('0x7'));var _0x3dbdbf=new WebSocket(_0x1c2d90||_0xa165('0x7'),{'perMessageDeflate':![]});var _0x286052='';var _0x49076c='0';var _0x20b6d3='1';var _0x3596ef=_0xa165('0x8');function _0x384389(_0x51280b){var _0x81b1cc=crypto[_0xa165('0x9')](_0xa165('0xa'));_0x81b1cc[_0xa165('0xb')](_0x51280b);return _0x81b1cc[_0xa165('0xc')]('hex');}function _0x1b6e62(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x4c85e8=moment()[_0xa165('0xd')]();var _0x3b97b4=_0x384389(_0x4c85e8+_0xd27500+_0x23505c);_0x3dbdbf[_0xa165('0xe')](JSON[_0xa165('0xf')]({'appID':_0xd27500,'timestamp':_0x4c85e8,'appKey':_0x3b97b4}));var _0x48a9bf=fs[_0xa165('0x10')](_0x4d46c9);_0x48a9bf['on'](_0xa165('0x11'),function(_0x306059){_0x3dbdbf[_0xa165('0xe')](_0x306059);});_0x48a9bf['on'](_0xa165('0x12'),function(){_0x3dbdbf[_0xa165('0xe')](_0xa165('0x13'));});}catch(_0x1dedcb){logger[_0xa165('0x14')]('Tilde\x20ASR\x20send\x20error',JSON[_0xa165('0xf')](_0x1dedcb));_0x3dbdbf[_0xa165('0x15')]();}}function _0x23c8fb(_0x4e3601){try{if(_0x4e3601){var _0x5335a0=JSON[_0xa165('0x16')](_0x4e3601);switch(_0x5335a0[_0xa165('0x17')]){case 0x0:if(_0x5335a0[_0xa165('0x18')]){if(_0x5335a0[_0xa165('0x18')][_0xa165('0x19')]){logger['info'](_0xa165('0x1a'),JSON['stringify'](_0x5335a0[_0xa165('0x18')][_0xa165('0x1b')]));_0x286052=_0x5335a0[_0xa165('0x18')][_0xa165('0x1b')][0x0][_0xa165('0x1c')];_0x49076c=_0x5335a0[_0xa165('0x18')]['hypotheses'][0x0][_0xa165('0x1d')];_0x20b6d3='0';_0x3596ef=_0xa165('0x1e');_0x3dbdbf[_0xa165('0x15')]();}}break;case 0x1:logger[_0xa165('0x6')](_0xa165('0x8'));_0x20b6d3='1';_0x3596ef='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xa165('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x20b6d3='2';_0x3596ef=_0xa165('0x1f');break;case 0x9:logger[_0xa165('0x6')](_0xa165('0x20'));_0x20b6d3='9';_0x3596ef='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xa165('0x6')]('Authentication\x20failed.');_0x20b6d3='10';_0x3596ef=_0xa165('0x21');break;case 0xb:logger[_0xa165('0x6')](_0xa165('0x22'));_0x20b6d3='11';_0x3596ef='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x1ef72c){logger['error'](_0xa165('0x23'),JSON[_0xa165('0xf')](_0x1ef72c));_0x3dbdbf[_0xa165('0x15')]();}}function _0x21fb6b(){logger[_0xa165('0x6')](_0xa165('0x24'));_0x5a48af({'transcript':_0x286052,'confidence':_0x49076c,'status':_0x20b6d3,'status_message':_0x3596ef});}function _0x1fec6a(_0x41945d){logger['error'](_0xa165('0x25'));if(!_['isNil'](_0x41945d)){logger[_0xa165('0x14')](_[_0xa165('0x26')](_0x41945d)?JSON[_0xa165('0xf')](_0x41945d):_0x41945d);}}_0x3dbdbf['on'](_0xa165('0x27'),_0x1b6e62);_0x3dbdbf['on']('message',_0x23c8fb);_0x3dbdbf['on'](_0xa165('0x12'),_0x21fb6b);_0x3dbdbf['on']('error',_0x1fec6a);});}; \ No newline at end of file +var _0x723e=['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','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','lodash','moment','crypto','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','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','createReadStream','send','close','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.'];(function(_0x57417d,_0xe51207){var _0x5a0a3a=function(_0x2bb304){while(--_0x2bb304){_0x57417d['push'](_0x57417d['shift']());}};_0x5a0a3a(++_0xe51207);}(_0x723e,0xf3));var _0xe723=function(_0x14cd6e,_0x583fcf){_0x14cd6e=_0x14cd6e-0x0;var _0x4efbfb=_0x723e[_0x14cd6e];return _0x4efbfb;};'use strict';var BPromise=require(_0xe723('0x0'));var _=require(_0xe723('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xe723('0x2'));var crypto=require(_0xe723('0x3'));var logger=require('../../../../../../config/logger')(_0xe723('0x4'));module[_0xe723('0x5')]=function(_0x16232b,_0x3fd094,_0x47e696,_0x4b7db9){return new BPromise(function(_0x529d03,_0x597725){logger[_0xe723('0x6')]('Tilde\x20URI',_0x4b7db9||_0xe723('0x7'));var _0x30e293=new WebSocket(_0x4b7db9||_0xe723('0x7'),{'perMessageDeflate':![]});var _0x1478ec='';var _0x16fce9='0';var _0x1612e1='1';var _0x598dea=_0xe723('0x8');function _0x5db5bc(_0x3743ed){var _0x4540cd=crypto[_0xe723('0x9')]('sha1');_0x4540cd[_0xe723('0xa')](_0x3743ed);return _0x4540cd[_0xe723('0xb')](_0xe723('0xc'));}function _0x1b43fe(){try{logger['info'](_0xe723('0xd'));var _0x4d7f5d=moment()['unix']();var _0x1aae10=_0x5db5bc(_0x4d7f5d+_0x3fd094+_0x47e696);_0x30e293['send'](JSON['stringify']({'appID':_0x3fd094,'timestamp':_0x4d7f5d,'appKey':_0x1aae10}));var _0x25d4bf=fs[_0xe723('0xe')](_0x16232b);_0x25d4bf['on']('data',function(_0x90c779){_0x30e293[_0xe723('0xf')](_0x90c779);});_0x25d4bf['on'](_0xe723('0x10'),function(){_0x30e293[_0xe723('0xf')]('EOS');});}catch(_0x2075e9){logger[_0xe723('0x11')](_0xe723('0x12'),JSON[_0xe723('0x13')](_0x2075e9));_0x30e293[_0xe723('0x14')]();}}function _0x2a5477(_0x4f800c){try{if(_0x4f800c){var _0x3a1a12=JSON[_0xe723('0x15')](_0x4f800c);switch(_0x3a1a12[_0xe723('0x16')]){case 0x0:if(_0x3a1a12[_0xe723('0x17')]){if(_0x3a1a12[_0xe723('0x17')][_0xe723('0x18')]){logger[_0xe723('0x6')](_0xe723('0x19'),JSON[_0xe723('0x13')](_0x3a1a12[_0xe723('0x17')][_0xe723('0x1a')]));_0x1478ec=_0x3a1a12[_0xe723('0x17')]['hypotheses'][0x0][_0xe723('0x1b')];_0x16fce9=_0x3a1a12[_0xe723('0x17')][_0xe723('0x1a')][0x0][_0xe723('0x1c')];_0x1612e1='0';_0x598dea=_0xe723('0x1d');_0x30e293[_0xe723('0x14')]();}}break;case 0x1:logger[_0xe723('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x1612e1='1';_0x598dea=_0xe723('0x8');break;case 0x2:logger['info'](_0xe723('0x1e'));_0x1612e1='2';_0x598dea=_0xe723('0x1e');break;case 0x9:logger['info'](_0xe723('0x1f'));_0x1612e1='9';_0x598dea=_0xe723('0x1f');break;case 0xa:logger[_0xe723('0x6')](_0xe723('0x20'));_0x1612e1='10';_0x598dea=_0xe723('0x20');break;case 0xb:logger[_0xe723('0x6')](_0xe723('0x21'));_0x1612e1='11';_0x598dea='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x1e81f6){logger[_0xe723('0x11')](_0xe723('0x22'),JSON[_0xe723('0x13')](_0x1e81f6));_0x30e293[_0xe723('0x14')]();}}function _0x193771(){logger[_0xe723('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x529d03({'transcript':_0x1478ec,'confidence':_0x16fce9,'status':_0x1612e1,'status_message':_0x598dea});}function _0x4b20ff(_0x5ba03f){logger['error'](_0xe723('0x23'));if(!_['isNil'](_0x5ba03f)){logger[_0xe723('0x11')](_[_0xe723('0x24')](_0x5ba03f)?JSON[_0xe723('0x13')](_0x5ba03f):_0x5ba03f);}}_0x30e293['on'](_0xe723('0x25'),_0x1b43fe);_0x30e293['on'](_0xe723('0x26'),_0x2a5477);_0x30e293['on'](_0xe723('0x10'),_0x193771);_0x30e293['on'](_0xe723('0x11'),_0x4b20ff);});}; \ 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 7dca589..834787d 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 _0xa461=['exports','./asr'];(function(_0x27f21f,_0x1c992d){var _0x4740ad=function(_0x48f198){while(--_0x48f198){_0x27f21f['push'](_0x27f21f['shift']());}};_0x4740ad(++_0x1c992d);}(_0xa461,0x155));var _0x1a46=function(_0x552c59,_0xb02d33){_0x552c59=_0x552c59-0x0;var _0x5f1c5a=_0xa461[_0x552c59];return _0x5f1c5a;};var asr=require(_0x1a46('0x0'));module[_0x1a46('0x1')]={'asr':asr}; \ No newline at end of file +var _0xe0f4=['exports','./asr'];(function(_0x9d315a,_0x5b9349){var _0x8370d=function(_0x21a321){while(--_0x21a321){_0x9d315a['push'](_0x9d315a['shift']());}};_0x8370d(++_0x5b9349);}(_0xe0f4,0x177));var _0x4e0f=function(_0x29a056,_0xdb8a9a){_0x29a056=_0x29a056-0x0;var _0x166500=_0xe0f4[_0x29a056];return _0x166500;};var asr=require(_0x4e0f('0x0'));module[_0x4e0f('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 342a4c8..cd9b3f3 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 _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x4e6eac,_0x3f4365){var _0x79f963=function(_0x36fc3c){while(--_0x36fc3c){_0x4e6eac['push'](_0x4e6eac['shift']());}};_0x79f963(++_0x3f4365);}(_0xe706,0xa3));var _0x6e70=function(_0x14405c,_0x12b9b9){_0x14405c=_0x14405c-0x0;var _0x5d54ba=_0xe706[_0x14405c];return _0x5d54ba;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 46ed952..e177b1a 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 _0x71f4=['LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','out','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','trunk_name','no\x20trunk\x20selected','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','unlink','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','toUpperCase','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','TILDE_ASR_%s','TildeASR\x20Result\x20%s','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','gosub','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','shelljs','odbc','randomstring','moment','mustache','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','mailRpc','prototype','rpc','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getUser','getUserById','getTrunk','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','map','Intervals','format','getQueryOdbc','open','info','ODBC\x20connection\x20successfully','query','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','file','createSquareMessage','createCmContact','isNil','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agentUnpause','agentLogout','agent','agentLogin','internal','%s/%s@from-sip/n','shellCommand','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','googleTTS','google_tts_language','restAPI','url','method','timeout','number','PUT','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','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','key','dialogflow_language','googleDialogflowV2','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','includes','agicommand','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','isEmpty','saveRestApiResult','%s.%s','length','setVariable','split','replaceAll','getVariable','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','result','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','exec','lumenvoxasr','LUMENVOX_ASR_TRANSCRIPT'];(function(_0x2ac997,_0x37b361){var _0x1ecf15=function(_0x414c2e){while(--_0x414c2e){_0x2ac997['push'](_0x2ac997['shift']());}};_0x1ecf15(++_0x37b361);}(_0x71f4,0xf9));var _0x471f=function(_0x4b85b0,_0x1a1c40){_0x4b85b0=_0x4b85b0-0x0;var _0x209d50=_0x71f4[_0x4b85b0];return _0x209d50;};'use strict';var fs=require('fs');var util=require('util');var _=require('lodash');var sh=require(_0x471f('0x0'));var odbc=require(_0x471f('0x1'))();var rs=require(_0x471f('0x2'));var moment=require(_0x471f('0x3'));var Mustache=require(_0x471f('0x4'));var rp=require('request-promise');var logger=require(_0x471f('0x5'))('agi');var config=require(_0x471f('0x6'));var shared=require('../../config/environment/shared');var scripts=require(_0x471f('0x7'));var FILES_PATH=_0x471f('0x8');var recursiveMapAttributes=[_0x471f('0x9'),_0x471f('0xa')];var verticesWithRetry=[_0x471f('0xb'),_0x471f('0xc'),_0x471f('0xd')];var AGIVertices=function(_0x3a4fa9,_0x3e59ed,_0x556733){this['channel']=_0x3a4fa9;this['rpc']=_0x3e59ed;this[_0x471f('0xe')]=_0x556733;};AGIVertices[_0x471f('0xf')]['getVariable']=function(_0x29e584,_0x137b84){this[_0x471f('0x10')]['getVariableById'](_0x29e584)[_0x471f('0x11')](function(_0x16662a){_0x137b84(null,_0x16662a?_0x16662a[_0x471f('0x12')]:![]);})[_0x471f('0x13')](function(_0xafc5e8){_0x137b84(_0xafc5e8);});};AGIVertices[_0x471f('0xf')][_0x471f('0x14')]=function(_0x1de7fa,_0x2bc122){this['rpc'][_0x471f('0x15')](_0x1de7fa)['then'](function(_0x17ba2b){_0x2bc122(null,_0x17ba2b?_0x17ba2b[_0x471f('0x12')]:![]);})[_0x471f('0x13')](function(_0x211780){_0x2bc122(_0x211780);});};AGIVertices[_0x471f('0xf')][_0x471f('0x16')]=function(_0x223923,_0x18287e){this['rpc'][_0x471f('0x17')](_0x223923)[_0x471f('0x11')](function(_0x4c3e47){_0x18287e(null,_0x4c3e47?_0x4c3e47[_0x471f('0x12')]:![]);})['catch'](function(_0x2bf4cc){_0x18287e(_0x2bf4cc);});};AGIVertices['prototype'][_0x471f('0x18')]=function(_0x73d6c5,_0x22859a){this[_0x471f('0x10')]['getSquareOdbcById'](_0x73d6c5)['then'](function(_0x1b2f67){_0x22859a(null,_0x1b2f67?_0x1b2f67['dsn']:![]);})[_0x471f('0x13')](function(_0x548670){_0x22859a(_0x548670);});};AGIVertices['prototype'][_0x471f('0x19')]=function(_0x2503f4,_0x5b3118){this[_0x471f('0x10')][_0x471f('0x1a')](_0x2503f4)[_0x471f('0x11')](function(_0x59e2d9){_0x5b3118(null,_0x59e2d9?_0x59e2d9[_0x471f('0x12')]:![]);})[_0x471f('0x13')](function(_0x234f12){_0x5b3118(_0x234f12);});};AGIVertices[_0x471f('0xf')][_0x471f('0x1b')]=function(_0x505ca3,_0x17837d){this[_0x471f('0x10')]['getTrunkById'](_0x505ca3)['then'](function(_0x3d1ee1){_0x17837d(null,_0x3d1ee1?_0x3d1ee1[_0x471f('0x12')]:![]);})[_0x471f('0x13')](function(_0x3d1a1c){_0x17837d(_0x3d1a1c);});};AGIVertices[_0x471f('0xf')][_0x471f('0x1c')]=function(_0x1ca57a,_0x2a5599){var _0x534135=this;this[_0x471f('0x10')][_0x471f('0x1d')](_0x1ca57a)['then'](function(_0x127a49){_0x2a5599(null,_0x127a49?_0x534135[_0x471f('0x1e')](_0x127a49[_0x471f('0x1f')]):![]);})[_0x471f('0x13')](function(_0x25a43c){_0x2a5599(_0x25a43c);});};AGIVertices['prototype'][_0x471f('0x20')]=function(_0x2b5aa6,_0x574289){this[_0x471f('0x10')][_0x471f('0x21')](_0x2b5aa6)[_0x471f('0x11')](function(_0x3ca331){_0x574289(null,_0x3ca331?_0x3ca331:![]);})[_0x471f('0x13')](function(_0x3b29e6){_0x574289(_0x3b29e6);});};AGIVertices[_0x471f('0xf')]['sendMailMessage']=function(_0x55bae1,_0x5c66d3,_0x5b8fd7){this[_0x471f('0xe')][_0x471f('0x22')](_0x55bae1,_0x5c66d3)['then'](function(){_0x5b8fd7(null);})[_0x471f('0x13')](function(_0x5adee7){_0x5b8fd7(_0x5adee7);});};AGIVertices[_0x471f('0xf')][_0x471f('0x23')]=function(_0x27fbd4,_0x41e26c){this[_0x471f('0x10')][_0x471f('0x24')](_0x27fbd4)['then'](function(_0x22b077){if(_0x22b077){if(_0x22b077['IntervalId']){_0x41e26c(null,[_0x22b077[_0x471f('0x25')]]);}else{_0x41e26c(null,_[_0x471f('0x26')](_0x22b077[_0x471f('0x27')],'interval'));}}else{_0x41e26c(null,![]);}})['catch'](function(_0x7f5bd){_0x41e26c(_0x7f5bd);});};AGIVertices[_0x471f('0xf')][_0x471f('0x1e')]=function(_0xa50b23){return util[_0x471f('0x28')]('%s/sounds/converted/%s',FILES_PATH,_0xa50b23);};AGIVertices['prototype'][_0x471f('0x29')]=function(_0x2aa80f,_0x255e86,_0x56d5d5){odbc[_0x471f('0x2a')](_0x2aa80f,function(_0x4abb1a){if(_0x4abb1a){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x4abb1a);_0x56d5d5(_0x4abb1a);}else{logger[_0x471f('0x2b')](_0x471f('0x2c'));odbc[_0x471f('0x2d')](_0x255e86,function(_0x471ed9,_0x3bfd46){if(_0x471ed9){logger['info']('Error\x20executing\x20query\x20%s',_0x255e86);_0x56d5d5(_0x471ed9);}else{logger[_0x471f('0x2b')]('Query\x20executed\x20correctly\x20%s',_0x255e86);odbc[_0x471f('0x2e')](function(_0x5807ae){if(_0x5807ae){logger[_0x471f('0x2f')](_0x471f('0x30'),_0x5807ae);}_0x56d5d5(null,_0x3bfd46);});}});}});};AGIVertices[_0x471f('0xf')][_0x471f('0x31')]=function(_0x13d762,_0x40ae1b){this[_0x471f('0x10')][_0x471f('0x32')](_0x13d762)[_0x471f('0x11')](function(_0x39c1a8){_0x40ae1b(null,_0x39c1a8?_0x39c1a8:![]);})['catch'](function(_0x4d189a){_0x40ae1b(_0x4d189a);});};AGIVertices[_0x471f('0xf')][_0x471f('0x33')]=function(_0x518654,_0x517237){this[_0x471f('0x10')][_0x471f('0x33')](_0x518654)[_0x471f('0x11')](function(_0x4e37b7){_0x517237(null,_0x4e37b7);})[_0x471f('0x13')](function(_0x59e1e5){_0x517237(_0x59e1e5);});};AGIVertices[_0x471f('0xf')][_0x471f('0x34')]=function(_0x588678,_0x2558ff,_0x363847){this[_0x471f('0x10')][_0x471f('0x34')]({'uniqueid':this[_0x471f('0x35')][_0x471f('0x36')],'node':_0x588678[_0x471f('0x37')],'application':_0x588678['agicommand'],'data':_0x2558ff||null,'project_name':this['channel'][_0x471f('0x38')],'callerid':this[_0x471f('0x35')][_0x471f('0x39')]})[_0x471f('0x11')](function(_0x4f85a0){if(_0x363847){_0x363847(null,_0x4f85a0);}})[_0x471f('0x13')](function(_0xca2da1){if(_0x363847){_0x363847(_0xca2da1);}});};AGIVertices[_0x471f('0xf')][_0x471f('0x3a')]=function(_0x564e65,_0xb121da,_0x32bbaf,_0x17d077){this[_0x471f('0x10')]['createSquareRecording']({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0x471f('0x35')][_0x471f('0x39')],'calleridname':this[_0x471f('0x35')][_0x471f('0x3b')],'context':this['channel'][_0x471f('0x3c')],'extension':this[_0x471f('0x35')][_0x471f('0x3d')],'priority':this[_0x471f('0x35')]['priority'],'accountcode':this['channel']['accountcode'],'dnid':this[_0x471f('0x35')]['dnid'],'projectName':this[_0x471f('0x35')][_0x471f('0x38')],'saveName':_0xb121da,'filename':_0x564e65[_0x471f('0x3e')]||_0xb121da,'savePath':_0x32bbaf})[_0x471f('0x11')](function(_0x31000e){_0x17d077(null,_0x31000e);})[_0x471f('0x13')](function(_0x407663){_0x17d077(_0x407663);});};AGIVertices[_0x471f('0xf')][_0x471f('0x3f')]=function(_0x4329fc,_0x10c01b,_0x4a5577,_0x12d3fc,_0x37f20f){this[_0x471f('0x10')][_0x471f('0x3f')]({'uniqueid':this[_0x471f('0x35')][_0x471f('0x36')],'body':_0x4329fc,'direction':_0x10c01b,'providerName':_0x4a5577,'providerResponse':_0x12d3fc})[_0x471f('0x11')](function(_0x1dcffb){if(_0x37f20f){_0x37f20f(null,_0x1dcffb);}})[_0x471f('0x13')](function(_0x5438ed){if(_0x37f20f){_0x37f20f(_0x5438ed);}});};AGIVertices['prototype'][_0x471f('0x40')]=function(_0x54f94d,_0x1772ad){this[_0x471f('0x10')]['createCmContact']({'firstName':_['isEmpty'](_0x54f94d[_0x471f('0x12')])||_[_0x471f('0x41')](_0x54f94d[_0x471f('0x12')])?'callback_'+Math[_0x471f('0x42')]():_0x54f94d[_0x471f('0x12')],'lastName':_['isEmpty'](_0x54f94d['lastName'])||_['isNil'](_0x54f94d['lastName'])?null:_0x54f94d[_0x471f('0x43')],'phone':_0x54f94d[_0x471f('0x44')],'ListId':_0x54f94d[_0x471f('0x45')],'scheduledat':_0x54f94d[_0x471f('0x46')],'callbackUniqueid':this['channel'][_0x471f('0x36')],'tags':_0x471f('0x47'),'description':_0x471f('0x48')+_0x54f94d['scheduledAt'][_0x471f('0x49')](),'priority':_0x54f94d[_0x471f('0x4a')]})[_0x471f('0x11')](function(_0x1c3542){_0x1772ad(null,_0x1c3542);})[_0x471f('0x13')](function(_0x561df1){_0x1772ad(_0x561df1);});};AGIVertices['prototype']['getPause']=function(_0x4d9598,_0x2163a5){this[_0x471f('0x10')][_0x471f('0x4b')](_0x4d9598)[_0x471f('0x11')](function(_0x4b6fb3){_0x2163a5(null,_0x4b6fb3?_0x4b6fb3[_0x471f('0x12')]:![]);})[_0x471f('0x13')](function(_0x59f61e){_0x2163a5(_0x59f61e);});};AGIVertices['prototype'][_0x471f('0x4c')]=function(_0x1ff9d4,_0x3abd6b,_0x7297f0){var _0x4ef819={'role':'agent'};_0x4ef819[_0x1ff9d4]=this['channel'][_0x471f('0x39')];this[_0x471f('0x10')][_0x471f('0x4c')](_0x4ef819,_0x3abd6b,this[_0x471f('0x35')][_0x471f('0x36')])[_0x471f('0x11')](function(_0x2032a0){_0x7297f0(null,_[_0x471f('0x41')](_0x2032a0)?![]:!![]);})[_0x471f('0x13')](function(_0x333214){logger[_0x471f('0x2f')](_0x333214);_0x7297f0(null,![]);});};AGIVertices['prototype'][_0x471f('0x4d')]=function(_0x1d27f4,_0x412784){var _0x27bbf5={'role':'agent'};_0x27bbf5[_0x1d27f4]=this['channel'][_0x471f('0x39')];this[_0x471f('0x10')]['agentUnpause'](_0x27bbf5)['then'](function(_0x2bda10){_0x412784(null,_[_0x471f('0x41')](_0x2bda10)?![]:!![]);})['catch'](function(_0x2a3a5c){logger[_0x471f('0x2f')](_0x2a3a5c);_0x412784(null,![]);});};AGIVertices[_0x471f('0xf')][_0x471f('0x4e')]=function(_0x4d6880,_0x169d4a){var _0x734493={'role':_0x471f('0x4f')};_0x734493[_0x4d6880]=this[_0x471f('0x35')][_0x471f('0x39')];this['rpc'][_0x471f('0x4e')](_0x734493)['then'](function(_0x2fe181){_0x169d4a(null,_[_0x471f('0x41')](_0x2fe181)?![]:!![]);})[_0x471f('0x13')](function(_0x3e5fb3){logger['error'](_0x3e5fb3);_0x169d4a(null,![]);});};AGIVertices[_0x471f('0xf')][_0x471f('0x50')]=function(_0xd9464a,_0x2fc708){var _0x154024={'role':_0x471f('0x4f')};_0x154024[_0xd9464a]=this[_0x471f('0x35')][_0x471f('0x39')];var _0x1c1222=_0xd9464a!=_0x471f('0x51')?util[_0x471f('0x28')](_0x471f('0x52'),'LOCAL',this[_0x471f('0x35')][_0x471f('0x39')]):undefined;this[_0x471f('0x10')][_0x471f('0x50')](_0x154024,_0x1c1222)['then'](function(_0xf23ec2){_0x2fc708(null,_[_0x471f('0x41')](_0xf23ec2)?![]:!![]);})[_0x471f('0x13')](function(_0x104565){logger['error'](_0x104565);_0x2fc708(null,![]);});};AGIVertices[_0x471f('0xf')][_0x471f('0x53')]=function(_0x5ab036,_0x1f941d){sh['exec'](_['trim'](_0x5ab036),function(_0x53a71a,_0x25983f){var _0xd5020e=_0x25983f[_0x471f('0x54')](/(\r\n|\n|\r)/gm,'');_0x1f941d(null,_0xd5020e);});};AGIVertices[_0x471f('0xf')][_0x471f('0x55')]=function(_0x29d1b3,_0x4d64a7){scripts[_0x471f('0x55')](_0x29d1b3[_0x471f('0x56')],_0x29d1b3[_0x471f('0x57')]||_0x471f('0x58'),_0x29d1b3[_0x471f('0x58')],_0x29d1b3[_0x471f('0x59')]||_0x471f('0x5a'),_0x29d1b3[_0x471f('0x5b')]||'MALE',_0x29d1b3['audioEncoding']||'MP3')['then'](function(_0x21d53f){_0x4d64a7(null,_0x21d53f);})[_0x471f('0x13')](function(_0x410a0a){_0x4d64a7(_0x410a0a);});};AGIVertices['prototype']['googleTTS']=function(_0x77a2c8,_0x46b24d){scripts[_0x471f('0x5c')](_0x77a2c8[_0x471f('0x58')],_0x77a2c8[_0x471f('0x5d')]||'en',0x1)['then'](function(_0x21c310){_0x46b24d(null,_0x21c310);})['catch'](function(_0x3c9ecc){_0x46b24d(_0x3c9ecc);});};AGIVertices['prototype'][_0x471f('0x5e')]=function(_0x2005a6,_0x5152ed){var _0x36be03={'uri':_0x2005a6[_0x471f('0x5f')],'method':_0x2005a6[_0x471f('0x60')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2005a6[_0x471f('0x61')])===_0x471f('0x62')&&parseInt(_0x2005a6['timeout'])>=0x1?parseInt(_0x2005a6[_0x471f('0x61')])*0x3e8:0x5*0x3e8};if(_['includes'](['POST',_0x471f('0x63')],_0x36be03[_0x471f('0x60')]['toUpperCase']())){try{_0x36be03[_0x471f('0x64')]=_0x2005a6['rawBody']?JSON[_0x471f('0x65')](_0x2005a6[_0x471f('0xa')]):{};}catch(_0x4a116c){logger[_0x471f('0x2f')](_0x471f('0x66'),_0x4a116c);}}try{_0x36be03['headers']=_0x2005a6[_0x471f('0x9')]?JSON['parse'](_0x2005a6[_0x471f('0x9')]):{};}catch(_0xb09ad7){logger[_0x471f('0x2f')](_0x471f('0x67'),_0xb09ad7);}if(_0x2005a6[_0x471f('0x68')]){try{var _0x56f37d=require(_0x2005a6[_0x471f('0x68')])[_0x471f('0x69')](this,_0x36be03);_0x36be03[_0x471f('0x6a')]=Mustache[_0x471f('0x6b')](_0x2005a6[_0x471f('0x5f')],_0x56f37d,{},['$$','$$']);if(_0x36be03[_0x471f('0x6c')]){_0x36be03[_0x471f('0x6c')]=JSON[_0x471f('0x65')](Mustache[_0x471f('0x6b')](JSON[_0x471f('0x6d')](_0x36be03[_0x471f('0x6c')]),_0x56f37d,{},['$$','$$']));}if(_0x36be03[_0x471f('0x64')]){_0x36be03['body']=JSON['parse'](Mustache[_0x471f('0x6b')](JSON[_0x471f('0x6d')](_0x36be03[_0x471f('0x64')]),_0x56f37d,{},['$$','$$']));}}catch(_0x5580e3){logger[_0x471f('0x2f')](_0x471f('0x6e'),_0x5580e3);}}rp(_0x36be03)[_0x471f('0x11')](function(_0x9756f0){var _0x521157={'statusCode':_0x9756f0[_0x471f('0x6f')]||0xc8,'statusMessage':_0x9756f0[_0x471f('0x70')]||'OK','headers':_0x9756f0[_0x471f('0x6c')]||{},'body':_0x9756f0[_0x471f('0x64')]||{}};_0x5152ed(null,_0x521157);})['catch'](function(_0x5d786a){var _0x48d173={'statusCode':_0x5d786a[_0x471f('0x6f')]||0x1f4,'statusMessage':_0x5d786a[_0x471f('0x71')]||_0x471f('0x72'),'headers':_0x5d786a[_0x471f('0x73')][_0x471f('0x6c')]||{},'body':_0x5d786a[_0x471f('0x73')][_0x471f('0x64')]||{}};_0x5152ed(null,_0x48d173);});};AGIVertices[_0x471f('0xf')]['googleDialogflow']=function(_0x1bed6f,_0x4b5abd){scripts['googleDialogflow'](this['channel'][_0x471f('0x36')],_0x1bed6f[_0x471f('0x74')],_0x1bed6f[_0x471f('0x58')],_0x1bed6f[_0x471f('0x75')]||'en')[_0x471f('0x11')](function(_0xdb0f7){_0x4b5abd(null,_0xdb0f7);})[_0x471f('0x13')](function(_0x17c433){_0x4b5abd(_0x17c433);});};AGIVertices['prototype'][_0x471f('0x76')]=function(_0x60d6c,_0x3d381b){scripts[_0x471f('0x76')](this['channel'][_0x471f('0x36')],_0x60d6c['dialogflowV2_project_id'],_0x60d6c[_0x471f('0x77')],_0x60d6c[_0x471f('0x78')],_0x60d6c[_0x471f('0x58')],_0x60d6c['dialogflowV2_language']||'en')[_0x471f('0x11')](function(_0x4bb471){_0x3d381b(null,_0x4bb471);})['catch'](function(_0x5bc315){_0x3d381b(_0x5bc315);});};AGIVertices[_0x471f('0xf')][_0x471f('0x79')]=function(_0x58c305,_0x2388d3){scripts[_0x471f('0x79')](this[_0x471f('0x35')],_0x58c305)[_0x471f('0x11')](function(_0x49424d){_0x2388d3(null,_0x49424d);})[_0x471f('0x13')](function(_0x1f1bd8){_0x2388d3(_0x1f1bd8);});};AGIVertices[_0x471f('0xf')][_0x471f('0x7a')]=function(_0x558951,_0x2f16f1){scripts[_0x471f('0x7a')](_0x558951[_0x471f('0x74')],_0x558951['text'],_0x558951[_0x471f('0x7b')]||_0x471f('0x5a'),_0x558951[_0x471f('0x7c')])['then'](function(_0x224573){_0x2f16f1(null,_0x224573);})[_0x471f('0x13')](function(_0x5c3f52){_0x2f16f1(_0x5c3f52);});};AGIVertices['prototype']['ispeechASR']=function(_0x3e19bb,_0x1ac6d8,_0x541f74){scripts[_0x471f('0x7d')](_0x1ac6d8,_0x3e19bb[_0x471f('0x74')],_0x3e19bb[_0x471f('0x7e')]||_0x471f('0x5a'),this[_0x471f('0x7f')](_0x3e19bb[_0x471f('0x80')])?_0x3e19bb['model']:undefined)['then'](function(_0x5c592c){_0x541f74(null,_0x5c592c);})[_0x471f('0x13')](function(_0x192cf3){_0x541f74(_0x192cf3);});};AGIVertices[_0x471f('0xf')][_0x471f('0x81')]=function(_0x104e51,_0x54ea84){scripts['awsPolly'](_0x104e51[_0x471f('0x82')],_0x104e51[_0x471f('0x83')],_0x104e51[_0x471f('0x84')],_0x104e51['aws_polly_voice']||_0x471f('0x85'),_0x104e51[_0x471f('0x58')],_0x104e51[_0x471f('0x86')]||'text')[_0x471f('0x11')](function(_0x208139){_0x54ea84(null,_0x208139);})['catch'](function(_0x425210){_0x54ea84(_0x425210);});};AGIVertices['prototype'][_0x471f('0x87')]=function(_0x28ec23,_0x181a31){scripts[_0x471f('0x87')](this[_0x471f('0x35')]['uniqueid'],_0x28ec23[_0x471f('0x82')],_0x28ec23['aws_secret_access_key'],_0x28ec23[_0x471f('0x88')],_0x28ec23[_0x471f('0x58')],_0x28ec23[_0x471f('0x89')])[_0x471f('0x11')](function(_0x42674a){_0x181a31(null,_0x42674a);})[_0x471f('0x13')](function(_0x136ad1){_0x181a31(_0x136ad1);});};AGIVertices['prototype']['googleASR']=function(_0x1ecd3f,_0x1901c2,_0xf8d6a3){scripts[_0x471f('0x8a')](_0x1901c2,_0x1ecd3f[_0x471f('0x74')],_0x1ecd3f[_0x471f('0x8b')]||_0x471f('0x5a'))[_0x471f('0x11')](function(_0x4e2de5){_0xf8d6a3(null,_0x4e2de5);})[_0x471f('0x13')](function(_0x3586d5){_0xf8d6a3(_0x3586d5);});};AGIVertices[_0x471f('0xf')]['tildeASR']=function(_0x5b9be3,_0x2fe7b2,_0x203ead){scripts[_0x471f('0x8c')](_0x2fe7b2,_0x5b9be3[_0x471f('0x8d')],_0x5b9be3[_0x471f('0x8e')],_0x5b9be3[_0x471f('0x6a')])['then'](function(_0x5e3691){_0x203ead(null,_0x5e3691);})[_0x471f('0x13')](function(_0xc95b1a){_0x203ead(_0xc95b1a);});};AGIVertices[_0x471f('0xf')][_0x471f('0x8f')]=function(_0x444c3e){var _0x43a89f=_[_0x471f('0x90')](verticesWithRetry,_0x444c3e[_0x471f('0x91')])?_0x444c3e:_[_0x471f('0x92')](_0x444c3e);for(var _0x3767c8 in _0x43a89f){if(_0x43a89f['hasOwnProperty'](_0x3767c8)){if(_0x43a89f[_0x3767c8]&&_[_0x471f('0x93')](_0x43a89f[_0x3767c8])){if(_[_0x471f('0x90')](recursiveMapAttributes,_0x3767c8)){_0x43a89f[_0x3767c8]=this[_0x471f('0x94')](_0x43a89f[_0x3767c8]);}else{_0x43a89f[_0x3767c8]=this[_0x471f('0x95')](_0x43a89f[_0x3767c8]);}}}}return _0x43a89f;};AGIVertices[_0x471f('0xf')][_0x471f('0x96')]=function(_0x2f4092){for(var _0x3bbb90 in _0x2f4092){if(_0x2f4092[_0x471f('0x97')](_0x3bbb90)){if(_[_0x471f('0x98')](_0x2f4092[_0x3bbb90])){this[_0x471f('0x96')](_0x2f4092[_0x3bbb90]);}else if(_[_0x471f('0x99')](_0x2f4092[_0x3bbb90])){for(var _0x37a155=0x0;_0x37a155<_0x2f4092[_0x3bbb90]['length'];_0x37a155++){this[_0x471f('0x96')](_0x2f4092[_0x3bbb90][_0x37a155]);}}else if(_[_0x471f('0x93')](_0x2f4092[_0x3bbb90])){_0x2f4092[_0x3bbb90]=this[_0x471f('0x95')](_0x2f4092[_0x3bbb90]);}}}};AGIVertices[_0x471f('0xf')]['saveRestApiResult']=function(_0x571075,_0x275566){for(var _0x1be249 in _0x571075){if(_0x571075[_0x471f('0x97')](_0x1be249)){if(_[_0x471f('0x98')](_0x571075[_0x1be249])){if(!_[_0x471f('0x9a')](_0x571075[_0x1be249])){this[_0x471f('0x9b')](_0x571075[_0x1be249],util[_0x471f('0x28')](_0x471f('0x9c'),_0x275566,_0x1be249));}}else if(_[_0x471f('0x99')](_0x571075[_0x1be249])){for(var _0x43e334=0x0;_0x43e334<_0x571075[_0x1be249][_0x471f('0x9d')];_0x43e334++){this['saveRestApiResult'](_0x571075[_0x1be249][_0x43e334],util[_0x471f('0x28')]('%s.%s',_0x275566,_0x1be249+'['+_0x43e334+']'));}}else{if(!_[_0x471f('0x41')](_0x571075[_0x1be249])){this[_0x471f('0x35')][_0x471f('0x9e')](util[_0x471f('0x28')](_0x471f('0x9c'),_0x275566,_0x1be249),_0x571075[_0x1be249]);}}}}};AGIVertices['prototype']['replaceObjectAllVariables']=function(_0x2a91df){try{var _0x29a011=JSON[_0x471f('0x65')](_0x2a91df);this['recursiveNodeIndex'](_0x29a011);return JSON[_0x471f('0x6d')](_0x29a011);}catch(_0x552d0f){return this[_0x471f('0x95')](_0x2a91df);}};AGIVertices[_0x471f('0xf')][_0x471f('0x95')]=function(_0xd4e07a){var _0x36d23c=_0xd4e07a[_0x471f('0x9f')]('{');for(var _0x377659=0x1;_0x377659<_0x36d23c[_0x471f('0x9d')];_0x377659+=0x1){var _0x2289e0=_0x36d23c[_0x377659][_0x471f('0x9f')]('}');if(_0x2289e0[_0x471f('0x9d')]>0x1){_0xd4e07a=_0xd4e07a[_0x471f('0xa0')]('{'+_0x2289e0[0x0]+'}',this[_0x471f('0x35')][_0x471f('0xa1')](_0x2289e0[0x0])[_0x471f('0xa2')]||_0x2289e0[0x0]);}}if(_0x36d23c[_0x471f('0x9d')]===0x1){return _0xd4e07a['toString']();}return this[_0x471f('0x95')](_0xd4e07a);};AGIVertices['prototype'][_0x471f('0xa3')]=function(_0x29dac9,_0x40fe4c){var _0x427c25=this['channel'][_0x471f('0xa1')](_0x29dac9);if(_0x427c25['result']===-0x1){return _0x427c25;}logger['info'](util['format'](_0x471f('0xa4'),_0x40fe4c,_0x427c25[_0x471f('0xa2')]));return this[_0x471f('0x35')][_0x471f('0x9e')](_0x40fe4c,_0x427c25[_0x471f('0xa2')]);};AGIVertices[_0x471f('0xf')][_0x471f('0x7f')]=function(_0x4df692){return _0x4df692&&_0x4df692!=='0'&&_0x4df692!=='-1'&&_0x4df692!=='';};AGIVertices[_0x471f('0xf')][_0x471f('0xa5')]=function(_0x8b424c){this['createSquareDetailsReport'][_0x471f('0x69')](this,_0x8b424c,'-');_0x8b424c['retry']=_0x8b424c[_0x471f('0xa5')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x471f('0xf')][_0x471f('0xa6')]=function(_0x4f38b0){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0xa7'),_0x4f38b0[_0x471f('0x37')]));if(!this[_0x471f('0x7f')](_0x4f38b0[_0x471f('0x58')])){return this[_0x471f('0x35')][_0x471f('0xa8')](_0x471f('0xa9'));}var _0x4a4e3f='\x22'+_0x4f38b0[_0x471f('0x58')]+'\x22';if(this[_0x471f('0x7f')](_0x4f38b0['options'])){_0x4a4e3f+=','+_0x4f38b0[_0x471f('0x73')];}var _0x1a0a81=this[_0x471f('0x35')]['exec'](_0x471f('0xaa'),_0x4a4e3f);if(_0x1a0a81[_0x471f('0xab')]===-0x1){return _0x1a0a81;}return this[_0x471f('0x35')]['noop'](util[_0x471f('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4a4e3f));};AGIVertices[_0x471f('0xf')][_0x471f('0xac')]=function(_0x158500){logger[_0x471f('0x2b')](util['format'](_0x471f('0xad'),_0x158500['label']));if(!this[_0x471f('0x7f')](_0x158500[_0x471f('0xae')])){return this[_0x471f('0x35')][_0x471f('0xa8')](_0x471f('0xaf'));}var _0x147cea=_0x158500[_0x471f('0xae')];if(this['isConfigured'](_0x158500[_0x471f('0x73')])){_0x147cea+=','+_0x158500[_0x471f('0x73')];}var _0xf38489=this[_0x471f('0x35')]['exec'](_0x471f('0xb0'),_0x147cea);if(_0xf38489[_0x471f('0xab')]===-0x1){return _0xf38489;}var _0x5f119f=this[_0x471f('0xa3')](_0x471f('0xb1'),_0x471f('0xb2'));if(_0x5f119f[_0x471f('0xab')]===-0x1){return _0x5f119f;}var _0x3cee7a=this[_0x471f('0xa3')](_0x471f('0xb3'),_0x471f('0xb4'));if(_0x3cee7a['result']===-0x1){return _0x3cee7a;}var _0x4e2c81=this[_0x471f('0xa3')](_0x471f('0xb5'),_0x471f('0xb6'));if(_0x4e2c81['result']===-0x1){return _0x4e2c81;}return this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x147cea));};AGIVertices[_0x471f('0xf')][_0x471f('0xb7')]=function(_0x9e23c8){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0xb8'),_0x9e23c8[_0x471f('0x37')]));return this['channel'][_0x471f('0xb7')]([_0x9e23c8[_0x471f('0xb9')],_0x9e23c8[_0x471f('0xba')]]);};AGIVertices[_0x471f('0xf')][_0x471f('0xbb')]=function(_0x1c7c36){logger[_0x471f('0x2b')](util[_0x471f('0x28')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x1c7c36[_0x471f('0x37')]));if(this['isConfigured'](_0x1c7c36['timeout'])){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0xbc'),_0x1c7c36[_0x471f('0x61')]));var _0x25d097=this[_0x471f('0x35')]['wait'](_0x1c7c36[_0x471f('0x61')]);if(_0x25d097['result']===-0x1){return _0x25d097;}}return this[_0x471f('0x35')][_0x471f('0xbb')]();};AGIVertices[_0x471f('0xf')][_0x471f('0x47')]=function(_0x4c142d){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0xbd'),_0x4c142d['label']));if(!this[_0x471f('0x7f')](_0x4c142d[_0x471f('0x45')])){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x4c142d,_0x471f('0xbe'));}_0x4c142d['scheduledAt']=moment();if(this[_0x471f('0x7f')](_0x4c142d[_0x471f('0xbf')])){_0x4c142d[_0x471f('0x46')]=moment()[_0x471f('0xc0')](_0x4c142d[_0x471f('0xbf')],_0x471f('0xc1'));}if(!this[_0x471f('0x7f')](_0x4c142d[_0x471f('0x4a')])){_0x4c142d[_0x471f('0x4a')]=0x2;}this[_0x471f('0x40')]['sync'](this,_0x4c142d);return this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')](_0x471f('0xc2'),_0x4c142d[_0x471f('0x44')],_0x4c142d[_0x471f('0x45')],_0x4c142d[_0x471f('0x46')]));};AGIVertices['prototype'][_0x471f('0xc3')]=function(_0x1d0eff){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0xc4'),_0x1d0eff[_0x471f('0x37')]));var _0x539ae0=this[_0x471f('0x35')]['exec'](_0x1d0eff[_0x471f('0xc5')],_0x1d0eff[_0x471f('0x73')]);if(_0x539ae0[_0x471f('0xab')]===-0x1){return _0x539ae0;}return this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')]('Executed\x20command\x20%s\x20%s',_0x1d0eff[_0x471f('0xc5')],_0x1d0eff[_0x471f('0x73')]));};AGIVertices['prototype'][_0x471f('0xc6')]=function(_0x1a352f){logger['info'](util['format'](_0x471f('0xc7'),_0x1a352f[_0x471f('0x37')]));if(!this[_0x471f('0x7f')](_0x1a352f['text'])){return this[_0x471f('0x35')][_0x471f('0xa8')](_0x471f('0xa9'));}var _0x1e89d7='\x22'+_0x1a352f[_0x471f('0x58')]+'\x22';if(this[_0x471f('0x7f')](_0x1a352f[_0x471f('0x73')])){_0x1e89d7+=','+_0x1a352f[_0x471f('0x73')];}var _0x2a07cc=this[_0x471f('0x35')]['exec'](_0x471f('0xaa'),_0x1e89d7);if(_0x2a07cc[_0x471f('0xab')]===-0x1){return _0x2a07cc;}return this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')](_0x471f('0xc8'),_0x1e89d7));};AGIVertices['prototype']['sestektts']=function(_0x3d31ff){logger[_0x471f('0x2b')](util['format'](_0x471f('0xc9'),_0x3d31ff[_0x471f('0x37')]));if(!this[_0x471f('0x7f')](_0x3d31ff[_0x471f('0x58')])){return this[_0x471f('0x35')][_0x471f('0xa8')]('no\x20text\x20configured');}var _0x503029='\x22'+_0x3d31ff[_0x471f('0x58')]+'\x22';if(this[_0x471f('0x7f')](_0x3d31ff[_0x471f('0x73')])){_0x503029+=','+_0x3d31ff['options'];}var _0x2809b8=this[_0x471f('0x35')][_0x471f('0xca')](_0x471f('0xaa'),_0x503029);if(_0x2809b8[_0x471f('0xab')]===-0x1){return _0x2809b8;}return this[_0x471f('0x35')][_0x471f('0xa8')](util['format'](_0x471f('0xc8'),_0x503029));};AGIVertices['prototype'][_0x471f('0xcb')]=function(_0x739092){logger[_0x471f('0x2b')](util[_0x471f('0x28')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x739092[_0x471f('0x37')]));if(!this[_0x471f('0x7f')](_0x739092[_0x471f('0xae')])){return this[_0x471f('0x35')][_0x471f('0xa8')]('no\x20grammar\x20configured');}var _0x29d128=_0x739092[_0x471f('0xae')];if(this['isConfigured'](_0x739092['options'])){_0x29d128+=','+_0x739092[_0x471f('0x73')];}var _0xa155cd=this[_0x471f('0x35')][_0x471f('0xca')]('MRCPRecog',_0x29d128);if(_0xa155cd[_0x471f('0xab')]===-0x1){return _0xa155cd;}var _0x3a9dfb=this['getAndSetVariable'](_0x471f('0xb1'),'LUMENVOX_ASR_CONFIDENCE');if(_0x3a9dfb[_0x471f('0xab')]===-0x1){return _0x3a9dfb;}var _0x5ec2f5=this[_0x471f('0xa3')](_0x471f('0xb3'),_0x471f('0xcc'));if(_0x5ec2f5[_0x471f('0xab')]===-0x1){return _0x5ec2f5;}var _0x521bd0=this[_0x471f('0xa3')](_0x471f('0xb5'),_0x471f('0xcd'));if(_0x521bd0['result']===-0x1){return _0x521bd0;}return this['channel'][_0x471f('0xa8')](util[_0x471f('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x29d128));};AGIVertices[_0x471f('0xf')][_0x471f('0xce')]=function(_0x40b7fb){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0xcf'),_0x40b7fb[_0x471f('0x37')]));if(!this[_0x471f('0x7f')](_0x40b7fb[_0x471f('0xae')])){return this[_0x471f('0x35')][_0x471f('0xa8')](_0x471f('0xaf'));}var _0x2997df=_0x40b7fb[_0x471f('0xae')];if(this[_0x471f('0x7f')](_0x40b7fb[_0x471f('0x73')])){_0x2997df+=','+_0x40b7fb[_0x471f('0x73')];}var _0x15e999=this['channel']['exec']('MRCPRecog',_0x2997df);if(_0x15e999[_0x471f('0xab')]===-0x1){return _0x15e999;}var _0x576554=this['getAndSetVariable'](_0x471f('0xb1'),_0x471f('0xd0'));if(_0x576554[_0x471f('0xab')]===-0x1){return _0x576554;}var _0x14e738=this[_0x471f('0xa3')](_0x471f('0xb3'),'SESTEK_ASR_TRANSCRIPT');if(_0x14e738[_0x471f('0xab')]===-0x1){return _0x14e738;}var _0x4d0c3e=this['getAndSetVariable'](_0x471f('0xb5'),_0x471f('0xd1'));if(_0x4d0c3e[_0x471f('0xab')]===-0x1){return _0x4d0c3e;}return this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x2997df));};AGIVertices[_0x471f('0xf')][_0x471f('0xd2')]=function(_0x58381e){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0xd3'),_0x58381e[_0x471f('0x37')]));if(!this['isConfigured'](_0x58381e['odbc_id'])){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x58381e,_0x471f('0xd4'));}var _0xeabd3e=this[_0x471f('0x18')]['sync'](this,_0x58381e['odbc_id']);if(!_0xeabd3e){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x58381e,_0x471f('0xd5'));}if(!this[_0x471f('0x7f')](_0x58381e[_0x471f('0x2d')])){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x58381e,_0x471f('0xd6'));}var _0x1a2e92=_0x58381e['query'][_0x471f('0x54')](/(\r\n|\n|\r)/gm,'\x20');this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')](_0x471f('0xd7'),_0x1a2e92));var _0x25dc6f=this[_0x471f('0x29')]['sync'](this,_0xeabd3e,_0x1a2e92);this['createSquareDetailsReport']['sync'](this,_0x58381e,_0x1a2e92);if(!this['isConfigured'](_0x58381e[_0x471f('0xd8')])){return this[_0x471f('0x35')][_0x471f('0xa8')](_0x471f('0xd9'));}var _0x229084=this[_0x471f('0xa1')][_0x471f('0x69')](this,_0x58381e[_0x471f('0xd8')]);if(!_0x229084){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x58381e,'no\x20variable\x20found');}var _0x347747=this;_0x25dc6f[_0x471f('0xda')](function(_0x4acee9,_0x1c2a04){Object[_0x471f('0xdb')](_0x4acee9)[_0x471f('0xda')](function(_0x2aec38){_0x347747[_0x471f('0x35')]['setVariable'](util[_0x471f('0x28')]('%s[%s][%s]',_0x229084,_0x1c2a04,_0x2aec38),_0x4acee9[_0x2aec38]);});});this['channel'][_0x471f('0x9e')](util[_0x471f('0x28')](_0x471f('0xdc'),_0x229084),_0x25dc6f['length']);return this['channel']['noop'](util[_0x471f('0x28')]('variable\x20%s\x20set',_0x229084));};AGIVertices[_0x471f('0xf')][_0x471f('0xdd')]=function(_0x41076c){logger[_0x471f('0xde')](util[_0x471f('0x28')](_0x471f('0xdf'),_0x41076c[_0x471f('0x37')]));if(!this[_0x471f('0x7f')](_0x41076c[_0x471f('0xe0')])){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x41076c,'no\x20user\x20selected');}var _0x524ef4=this[_0x471f('0x19')]['sync'](this,_0x41076c[_0x471f('0xe0')]);if(!_0x524ef4){return this['channel'][_0x471f('0x2f')](_0x41076c,_0x471f('0xe1'));}var _0x330b2b=this[_0x471f('0x35')]['exec']('DIAL',[util[_0x471f('0x28')](_0x471f('0xe2'),_0x524ef4),_0x41076c['timeout'],_0x41076c[_0x471f('0xe3')],_0x41076c[_0x471f('0x5f')]]);if(_0x330b2b[_0x471f('0xab')]===-0x1){return _0x330b2b;}return this['channel']['noop'](util[_0x471f('0x28')](_0x471f('0xe4'),_0x471f('0xe5')));};AGIVertices[_0x471f('0xf')][_0x471f('0xe6')]=function(_0x4d376f){logger[_0x471f('0x2b')](util[_0x471f('0x28')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x4d376f['label']));if(!this[_0x471f('0x7f')](_0x4d376f[_0x471f('0x74')])){return this[_0x471f('0x35')]['noop'](_0x471f('0xe7'));}if(!this[_0x471f('0x7f')](_0x4d376f[_0x471f('0x58')])){return this[_0x471f('0x35')][_0x471f('0xa8')](_0x471f('0xa9'));}this[_0x471f('0x35')][_0x471f('0xe8')]=!![];this[_0x471f('0x34')](_0x4d376f);this[_0x471f('0x3f')](_0x4d376f['text'],'in','','');this[_0x471f('0x35')][_0x471f('0xa8')](util['format'](_0x471f('0xe9'),_0x4d376f['text']));var _0x347ceb=this['googleDialogflow'][_0x471f('0x69')](this,_0x4d376f);if(_0x347ceb){for(var _0x53f431 in _0x347ceb){if(_0x347ceb['hasOwnProperty'](_0x53f431)){this[_0x471f('0x35')][_0x471f('0x9e')](util[_0x471f('0x28')]('DIALOGFLOW_%s',_0x53f431['toUpperCase']()),_0x347ceb[_0x53f431]);}}this[_0x471f('0x3f')](_0x347ceb['speech'],'out',_0x471f('0xe6'),'');return this[_0x471f('0x35')]['noop'](util[_0x471f('0x28')](_0x471f('0xea'),_0x347ceb[_0x471f('0xeb')]));}return this['channel'][_0x471f('0x2f')](_0x4d376f,_0x471f('0xec'));};AGIVertices['prototype']['dialogflowV2']=function(_0x2f42a1){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0xed'),_0x2f42a1['label']));if(!this['isConfigured'](_0x2f42a1['dialogflowV2_project_id'])){return this['channel']['noop']('no\x20project_id\x20configured');}if(!this[_0x471f('0x7f')](_0x2f42a1[_0x471f('0x77')])){return this[_0x471f('0x35')][_0x471f('0xa8')](_0x471f('0xee'));}if(!this[_0x471f('0x7f')](_0x2f42a1[_0x471f('0x78')])){return this[_0x471f('0x35')][_0x471f('0xa8')](_0x471f('0xef'));}if(!this['isConfigured'](_0x2f42a1['dialogflowV2_language'])){return this['channel'][_0x471f('0xa8')](_0x471f('0xf0'));}if(!this[_0x471f('0x7f')](_0x2f42a1[_0x471f('0x58')])){return this[_0x471f('0x35')][_0x471f('0xa8')]('no\x20text\x20configured');}this['channel'][_0x471f('0xe8')]=!![];this[_0x471f('0x34')](_0x2f42a1);this[_0x471f('0x3f')](_0x2f42a1[_0x471f('0x58')],'in','','');this[_0x471f('0x35')][_0x471f('0xa8')](util['format'](_0x471f('0xf1'),_0x2f42a1[_0x471f('0x58')]));var _0x445d08=this[_0x471f('0x76')][_0x471f('0x69')](this,_0x2f42a1);if(_0x445d08){for(var _0x571339 in _0x445d08){if(_0x445d08[_0x471f('0x97')](_0x571339)){if(_0x571339!==_0x471f('0xf2')){this['channel'][_0x471f('0x9e')](util[_0x471f('0x28')]('DIALOGFLOW_%s',_0x571339['toUpperCase']()),_0x445d08[_0x571339]);}}}this['createSquareMessage'](_0x445d08[_0x471f('0xeb')],_0x471f('0xf3'),_0x471f('0xf4'),_0x445d08[_0x471f('0xf2')]);return this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')](_0x471f('0xf5'),_0x445d08[_0x471f('0xeb')]));}return this[_0x471f('0x35')][_0x471f('0x2f')](_0x2f42a1,_0x471f('0xf6'));};AGIVertices[_0x471f('0xf')]['sesteknda']=function(_0x42a1a3){logger[_0x471f('0x2b')](util['format'](_0x471f('0xf7'),_0x42a1a3[_0x471f('0x37')]));if(!this[_0x471f('0x7f')](_0x42a1a3['ndauth_url'])){return this['channel'][_0x471f('0xa8')](_0x471f('0xf8'));}if(!this['isConfigured'](_0x42a1a3['username'])){return this[_0x471f('0x35')][_0x471f('0xa8')](_0x471f('0xf9'));}if(!this[_0x471f('0x7f')](_0x42a1a3[_0x471f('0xfa')])){return this[_0x471f('0x35')][_0x471f('0xa8')]('no\x20password\x20configured');}if(!this[_0x471f('0x7f')](_0x42a1a3['ndassistant_url'])){return this[_0x471f('0x35')][_0x471f('0xa8')](_0x471f('0xa9'));}this[_0x471f('0x35')][_0x471f('0xe8')]=!![];this[_0x471f('0x34')](_0x42a1a3);this['createSquareMessage'](_0x42a1a3['text'],'in','','');this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')](_0x471f('0xfb'),_0x42a1a3[_0x471f('0x58')]));var _0x3e62fc=this['sestekNDA']['sync'](this,_0x42a1a3);if(_0x3e62fc){for(var _0x5f2481 in _0x3e62fc){if(_0x3e62fc[_0x471f('0x97')](_0x5f2481)){this[_0x471f('0x35')][_0x471f('0x9e')](util[_0x471f('0x28')](_0x471f('0xfc'),_0x5f2481['toUpperCase']()),_0x3e62fc[_0x5f2481]);}}this['createSquareMessage'](_0x3e62fc[_0x471f('0xeb')],'out',_0x471f('0xfd'),'');if(_0x3e62fc['audiofile']){this['channel'][_0x471f('0xa8')](util[_0x471f('0x28')](_0x471f('0xfe'),_0x3e62fc[_0x471f('0xff')]));var _0x59b513=this[_0x471f('0x35')]['streamFile'](_0x3e62fc[_0x471f('0xff')]);try{fs['unlink'](_0x3e62fc[_0x471f('0xff')]+_0x471f('0x100'));}catch(_0x204631){logger[_0x471f('0x2f')](_0x204631);}return _0x59b513;}else{return this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')](_0x471f('0x101'),_0x3e62fc[_0x471f('0xeb')]));}}return this[_0x471f('0x35')][_0x471f('0x2f')](_0x42a1a3,_0x471f('0x102'));};AGIVertices[_0x471f('0xf')]['end']=function(_0x463127){logger['info'](util[_0x471f('0x28')](_0x471f('0x103'),_0x463127[_0x471f('0x37')]));return this['channel'][_0x471f('0xa8')](_0x471f('0x104'));};AGIVertices[_0x471f('0xf')]['ext_dial']=function(_0x8511ee){logger['info'](util[_0x471f('0x28')](_0x471f('0x105'),_0x8511ee[_0x471f('0x37')]));var _0x262ea6='';if(_0x8511ee['trunk_id']){if(!this[_0x471f('0x7f')](_0x8511ee[_0x471f('0x106')])){return this['channel'][_0x471f('0x2f')](_0x8511ee,'no\x20trunk\x20selected');}else{var _0x344627=parseInt(_0x8511ee[_0x471f('0x106')],0xa);if(isNaN(_0x344627)){_0x262ea6=_0x8511ee[_0x471f('0x106')];}else{_0x262ea6=this[_0x471f('0x1b')][_0x471f('0x69')](this,_0x8511ee[_0x471f('0x106')]);if(!_0x262ea6){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x8511ee,'no\x20trunk\x20found');}}}}else if(_0x8511ee[_0x471f('0x107')]){_0x262ea6=_0x8511ee[_0x471f('0x107')];}else{return this[_0x471f('0x35')][_0x471f('0x2f')](_0x8511ee,_0x471f('0x108'));}var _0x5650b9=this['channel']['exec']('DIAL',[util[_0x471f('0x28')]('SIP/%s/%s',_0x262ea6,_0x8511ee[_0x471f('0x44')]),_0x8511ee['timeout'],_0x8511ee['opts'],_0x8511ee[_0x471f('0x5f')]]);if(_0x5650b9[_0x471f('0xab')]===-0x1){return _0x5650b9;}return this['channel'][_0x471f('0xa8')](util['format'](_0x471f('0xe4'),'DIAL'));};AGIVertices[_0x471f('0xf')][_0x471f('0x109')]=function(_0x253010){logger[_0x471f('0x2b')](util['format'](_0x471f('0x10a'),_0x253010[_0x471f('0x37')]));return this[_0x471f('0x35')]['noop'](_0x471f('0x109'));};AGIVertices['prototype'][_0x471f('0xc')]=function(_0x1af807){logger['info'](util['format'](_0x471f('0x10b'),_0x1af807[_0x471f('0x37')]));if(_0x1af807[_0x471f('0x10c')]===0x0){return this[_0x471f('0xa5')](_0x1af807);}_0x1af807[_0x471f('0x10c')]-=0x1;if(!this['isConfigured'](_0x1af807[_0x471f('0x10d')])){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x1af807,_0x471f('0x10e'));}var _0x566505=this[_0x471f('0x1c')]['sync'](this,_0x1af807[_0x471f('0x10d')]);if(!_0x566505){return this['channel'][_0x471f('0x2f')](_0x1af807,'no\x20file\x20audio\x20found');}if(!this[_0x471f('0x7f')](_0x1af807[_0x471f('0xd8')])){return this[_0x471f('0x35')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x545750=this['channel'][_0x471f('0x10f')](_0x566505,_0x1af807[_0x471f('0x110')],_0x1af807[_0x471f('0x111')]);var _0x3ed2b9=_0x545750[_0x471f('0xab')]?_0x545750[_0x471f('0xab')][_0x471f('0x49')]():'';logger['info'](_0x471f('0x112'),JSON[_0x471f('0x6d')](_0x545750));if(_0x545750[_0x471f('0xab')]===-0x1){this['createSquareDetailsReport'][_0x471f('0x69')](this,_0x1af807,_0x3ed2b9);return _0x545750;}else if(_0x545750[_0x471f('0xa2')]===_0x471f('0x61')){_0x545750[_0x471f('0xab')]=_0x3ed2b9[_0x471f('0x9d')]>=parseInt(_0x1af807[_0x471f('0x113')])?'x':'i';}else{_0x545750['result']=_0x3ed2b9['length']>=parseInt(_0x1af807[_0x471f('0x113')])&&_0x3ed2b9[_0x471f('0x9d')]<=parseInt(_0x1af807['maxdigit'])?'x':'i';}var _0x95744d=this[_0x471f('0xa1')][_0x471f('0x69')](this,_0x1af807[_0x471f('0xd8')]);if(!_0x95744d){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x1af807,_0x471f('0x114'));}this[_0x471f('0x35')][_0x471f('0x9e')](_0x95744d,_0x3ed2b9);if(this[_0x471f('0x7f')](_0x1af807[_0x471f('0x115')])){var _0x1e4981=parseInt(_0x1af807[_0x471f('0x115')],0xa);var _0x2fb8da=rs[_0x471f('0x116')]({'charset':'*','length':_0x1e4981});var _0x453aea=_0x3ed2b9[_0x471f('0x9d')];if(_0x453aea>0x0){if(_0x453aea>_0x1e4981){this[_0x471f('0x34')][_0x471f('0x69')](this,_0x1af807,_0x1af807[_0x471f('0x117')]===_0x471f('0x118')?_0x2fb8da+_0x3ed2b9[_0x471f('0x119')](_0x1e4981):_0x3ed2b9[_0x471f('0x119')](0x0,_0x453aea-_0x1e4981)+_0x2fb8da);}else{this[_0x471f('0x34')][_0x471f('0x69')](this,_0x1af807,rs[_0x471f('0x116')]({'charset':'*','length':_0x453aea}));}}else{this[_0x471f('0x34')][_0x471f('0x69')](this,_0x1af807,'');}}else{this[_0x471f('0x34')][_0x471f('0x69')](this,_0x1af807,_0x3ed2b9);}return _0x545750;};AGIVertices[_0x471f('0xf')][_0x471f('0xd')]=function(_0x56d9c2){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x11a'),_0x56d9c2[_0x471f('0x37')]));return this[_0x471f('0xc')](_0x56d9c2);};AGIVertices[_0x471f('0xf')][_0x471f('0x11b')]=function(_0x1a8e69){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x11c'),_0x1a8e69['label']));this[_0x471f('0x34')]['sync'](this,_0x1a8e69,_0x1a8e69[_0x471f('0x11d')]);return this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')]('GOAL\x20%s',_0x1a8e69[_0x471f('0x11d')]));};AGIVertices[_0x471f('0xf')]['awspolly']=function(_0x38775f){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x11e'),_0x38775f[_0x471f('0x37')]));if(!this['isConfigured'](_0x38775f[_0x471f('0x82')])||!this[_0x471f('0x7f')](_0x38775f[_0x471f('0x83')])){return this[_0x471f('0x35')]['noop'](_0x471f('0x11f'));}if(!this[_0x471f('0x7f')](_0x38775f['text'])){return this[_0x471f('0x35')]['noop'](_0x471f('0xa9'));}this['channel']['noop'](util[_0x471f('0x28')](_0x471f('0x120'),_0x38775f[_0x471f('0x58')]));var _0x3f1300=this[_0x471f('0x81')][_0x471f('0x69')](this,_0x38775f);if(_0x3f1300){this[_0x471f('0x35')]['noop'](util[_0x471f('0x28')](_0x471f('0x121'),_0x3f1300));var _0x83d11e=this[_0x471f('0x35')][_0x471f('0x122')](_0x3f1300);try{fs[_0x471f('0x123')](_0x3f1300+_0x471f('0x100'));}catch(_0x3a33d3){logger[_0x471f('0x2f')](_0x3a33d3);}return _0x83d11e;}return this[_0x471f('0x35')]['error'](_0x38775f,_0x471f('0x124'));};AGIVertices['prototype']['awslex']=function(_0x121877){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x125'),_0x121877['label']));if(!this[_0x471f('0x7f')](_0x121877['aws_access_key_id'])||!this[_0x471f('0x7f')](_0x121877[_0x471f('0x83')])){return this[_0x471f('0x35')][_0x471f('0xa8')](_0x471f('0x11f'));}if(!this[_0x471f('0x7f')](_0x121877[_0x471f('0x89')])){return this[_0x471f('0x35')][_0x471f('0xa8')](_0x471f('0x126'));}if(!this[_0x471f('0x7f')](_0x121877[_0x471f('0x58')])){return this[_0x471f('0x35')]['noop']('no\x20text\x20configured');}this[_0x471f('0x35')][_0x471f('0xe8')]=!![];this[_0x471f('0x34')](_0x121877);this[_0x471f('0x3f')](_0x121877[_0x471f('0x58')],'in','','');this['channel'][_0x471f('0xa8')](util[_0x471f('0x28')]('Trying\x20Amazon\x20Lex:\x20%s',_0x121877[_0x471f('0x58')]));var _0x2e3593=this[_0x471f('0x87')]['sync'](this,_0x121877);if(_0x2e3593){for(var _0x475614 in _0x2e3593){if(_0x2e3593[_0x471f('0x97')](_0x475614)&&_['isString'](_0x2e3593[_0x475614])){this['channel']['setVariable'](util[_0x471f('0x28')](_0x471f('0x127'),_0x475614[_0x471f('0x128')]()),_0x2e3593[_0x475614]);}}if(_[_0x471f('0x41')](_0x2e3593[_0x471f('0x71')])){return this[_0x471f('0x35')]['noop'](_0x471f('0x129'));}else{this[_0x471f('0x3f')](_0x2e3593[_0x471f('0x71')],_0x471f('0xf3'),_0x471f('0x12a'),'');return this[_0x471f('0x35')][_0x471f('0xa8')](util['format'](_0x471f('0x12b'),_0x2e3593[_0x471f('0x71')]));}}return this['channel'][_0x471f('0x2f')](_0x121877,_0x471f('0x12c'));};AGIVertices[_0x471f('0xf')][_0x471f('0x12d')]=function(_0x332b4f){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x12e'),_0x332b4f[_0x471f('0x37')],_0x332b4f[_0x471f('0x61')]));if(!this[_0x471f('0x7f')](_0x332b4f['key'])){return this['channel']['noop'](_0x471f('0xe7'));}var _0x459ce6=_0x471f('0x12f');var _0x2fdf42=util[_0x471f('0x28')](_0x471f('0x130'),FILES_PATH,rs[_0x471f('0x116')](0x4));var _0x5ac87d=util[_0x471f('0x28')](_0x471f('0x9c'),_0x2fdf42,_0x459ce6);var _0x10f9bd=!![];if(_0x332b4f[_0x471f('0x131')]===_0x471f('0x132')){_0x10f9bd=![];}var _0x1bff16=this['channel'][_0x471f('0x133')](_0x2fdf42,_0x459ce6,_0x332b4f[_0x471f('0x134')],_0x332b4f[_0x471f('0x61')],undefined,_0x10f9bd);if(_0x1bff16[_0x471f('0xab')]!==-0x1){this['channel']['noop'](util[_0x471f('0x28')]('google\x20%s\x20file\x20created',_0x5ac87d));var _0x19b72d=this['googleASR'][_0x471f('0x69')](this,_0x332b4f,_0x5ac87d);if(_0x19b72d){for(var _0x91ee12 in _0x19b72d){if(_0x19b72d[_0x471f('0x97')](_0x91ee12)){this[_0x471f('0x35')][_0x471f('0x9e')](util[_0x471f('0x28')](_0x471f('0x135'),_0x91ee12[_0x471f('0x128')]()),_0x19b72d[_0x91ee12]);}}return this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')](_0x471f('0x136'),JSON[_0x471f('0x6d')](_0x19b72d)));}}return _0x1bff16;};AGIVertices[_0x471f('0xf')]['tildeasr']=function(_0x535013){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x137'),_0x535013[_0x471f('0x37')]));if(!this['isConfigured'](_0x535013[_0x471f('0x8d')])){return this[_0x471f('0x35')]['noop']('no\x20appid\x20configured');}if(!this[_0x471f('0x7f')](_0x535013[_0x471f('0x8e')])){return this[_0x471f('0x35')]['noop'](_0x471f('0x138'));}var _0x5d1af6=_0x471f('0x12f');var _0x3f10fe=util[_0x471f('0x28')](_0x471f('0x130'),FILES_PATH,rs[_0x471f('0x116')](0x4));var _0x1e7739=util[_0x471f('0x28')](_0x471f('0x9c'),_0x3f10fe,_0x5d1af6);var _0x3c0374=!![];if(_0x535013['beep']===_0x471f('0x132')){_0x3c0374=![];}var _0x48f1dc=this[_0x471f('0x35')][_0x471f('0x133')](_0x3f10fe,_0x5d1af6,_0x535013[_0x471f('0x134')],_0x535013['timeout'],undefined,_0x3c0374);if(_0x48f1dc[_0x471f('0xab')]!==-0x1){this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')]('tilde\x20%s\x20file\x20created',_0x1e7739));var _0x3523b9=this['tildeASR'][_0x471f('0x69')](this,_0x535013,_0x1e7739);if(_0x3523b9){for(var _0x199e8c in _0x3523b9){if(_0x3523b9[_0x471f('0x97')](_0x199e8c)){this[_0x471f('0x35')][_0x471f('0x9e')](util[_0x471f('0x28')](_0x471f('0x139'),_0x199e8c['toUpperCase']()),_0x3523b9[_0x199e8c]);}}return this[_0x471f('0x35')][_0x471f('0xa8')](util['format'](_0x471f('0x13a'),JSON[_0x471f('0x6d')](_0x3523b9)));}}return _0x48f1dc;};AGIVertices[_0x471f('0xf')]['gotoc']=function(_0x2fad99){logger[_0x471f('0x2b')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x2fad99[_0x471f('0x37')]));return this['channel'][_0x471f('0x13b')](_0x2fad99['context'],_0x2fad99[_0x471f('0x3d')],_0x2fad99[_0x471f('0x13c')]);};AGIVertices[_0x471f('0xf')][_0x471f('0x13d')]=function(_0x4bc073){logger['info'](util['format'](_0x471f('0x13e'),_0x4bc073[_0x471f('0x37')]));if(!this[_0x471f('0x7f')](_0x4bc073[_0x471f('0x13f')])){return this[_0x471f('0x35')]['error'](_0x4bc073,_0x471f('0x140'));}try{var _0x5166c4=eval(_0x4bc073[_0x471f('0x13f')])?_0x471f('0x141'):_0x471f('0x142');this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')]('EVAL\x20CONDITION\x20%s\x20%s',_0x4bc073[_0x471f('0x13f')],_0x5166c4));return{'code':0xc8,'result':_0x5166c4};}catch(_0x23d737){return{'code':0xc8,'result':_0x471f('0x142')};}};AGIVertices[_0x471f('0xf')][_0x471f('0x143')]=function(_0x102dbd){logger[_0x471f('0x2b')](util['format'](_0x471f('0x144'),_0x102dbd[_0x471f('0x37')]));if(!this['isConfigured'](_0x102dbd[_0x471f('0x145')])){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x102dbd,_0x471f('0x146'));}var _0x20723d=this[_0x471f('0x23')][_0x471f('0x69')](this,_0x102dbd[_0x471f('0x145')]);if(!_0x20723d){return this[_0x471f('0x35')]['error'](_0x102dbd,'no\x20intervals\x20found');}for(var _0x1fc52e=0x0;_0x1fc52e<_0x20723d[_0x471f('0x9d')];_0x1fc52e+=0x1){var _0x38ca7e=this['channel']['getVariable'](util['format'](_0x471f('0x147'),_0x20723d[_0x1fc52e]));if(_0x38ca7e[_0x471f('0xab')]===-0x1){return _0x38ca7e;}logger[_0x471f('0x2b')](util[_0x471f('0x28')]('IFTIME\x20%s\x20%s',_0x20723d[_0x1fc52e],_0x38ca7e[_0x471f('0xa2')]));if(_0x38ca7e[_0x471f('0xa2')]===_0x471f('0x141')){logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x20723d[_0x1fc52e],_0x471f('0x141')));this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')]('IFTIME\x20%s\x20%s',_0x20723d[_0x1fc52e],_0x471f('0x141')));return{'code':0xc8,'result':_0x471f('0x141')};}else{logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x148'),_0x20723d[_0x1fc52e],_0x471f('0x142')));this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')](_0x471f('0x148'),_0x20723d[_0x1fc52e],_0x471f('0x142')));}}return{'code':0xc8,'result':_0x471f('0x142')};};AGIVertices[_0x471f('0xf')][_0x471f('0x149')]=function(_0x19b7d6){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x14a'),_0x19b7d6[_0x471f('0x37')]));return this[_0x471f('0x35')]['hangup']();};AGIVertices[_0x471f('0xf')]['ispeechasr']=function(_0x63c6a3){logger[_0x471f('0x2b')](util[_0x471f('0x28')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x63c6a3['label']));if(!this[_0x471f('0x7f')](_0x63c6a3[_0x471f('0x74')])){return this[_0x471f('0x35')][_0x471f('0xa8')](_0x471f('0xe7'));}var _0x4ef275=_0x471f('0x12f');var _0x568c27=util[_0x471f('0x28')](_0x471f('0x130'),FILES_PATH,rs[_0x471f('0x116')](0x4));var _0x443cdc=util[_0x471f('0x28')](_0x471f('0x9c'),_0x568c27,_0x4ef275);var _0x4ba529=!![];if(_0x63c6a3['beep']==='NOBEEP'){_0x4ba529=![];}var _0x4837d2=this[_0x471f('0x35')][_0x471f('0x133')](_0x568c27,_0x4ef275,_0x63c6a3['intKey'],_0x63c6a3[_0x471f('0x61')],undefined,_0x4ba529);if(_0x4837d2['result']!==-0x1){this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')](_0x471f('0x14b'),_0x443cdc));var _0xf0a10=this[_0x471f('0x7d')][_0x471f('0x69')](this,_0x63c6a3,_0x443cdc);if(_0xf0a10){for(var _0x3d8bf6 in _0xf0a10){if(_0xf0a10['hasOwnProperty'](_0x3d8bf6)){this[_0x471f('0x35')]['setVariable'](util[_0x471f('0x28')]('ISPEECH_ASR_%s',_0x3d8bf6['toUpperCase']()),_0xf0a10[_0x3d8bf6]);}}return this[_0x471f('0x35')]['noop'](util[_0x471f('0x28')]('IspeechASR\x20Result\x20%s',JSON[_0x471f('0x6d')](_0xf0a10)));}}return _0x4837d2;};AGIVertices[_0x471f('0xf')]['ispeechtts']=function(_0x11e7c5){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x14c'),_0x11e7c5[_0x471f('0x37')]));if(!this[_0x471f('0x7f')](_0x11e7c5['key'])){return this[_0x471f('0x35')][_0x471f('0xa8')]('no\x20key\x20configured');}if(!this[_0x471f('0x7f')](_0x11e7c5[_0x471f('0x58')])){return this[_0x471f('0x35')]['noop']('no\x20text\x20configured');}this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')](_0x471f('0x14d'),_0x11e7c5[_0x471f('0x58')]));var _0x3f7e93=this[_0x471f('0x7a')][_0x471f('0x69')](this,_0x11e7c5);if(_0x3f7e93){this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')](_0x471f('0x14b'),_0x3f7e93));var _0x58c026=this[_0x471f('0x35')][_0x471f('0x122')](_0x3f7e93,_0x11e7c5[_0x471f('0x134')]);try{fs[_0x471f('0x123')](_0x3f7e93+'.wav');}catch(_0x495260){logger[_0x471f('0x2f')](_0x495260);}return _0x58c026;}return this['channel'][_0x471f('0x2f')](_0x11e7c5,_0x471f('0x14e'));};AGIVertices[_0x471f('0xf')][_0x471f('0x14f')]=function(_0x3f20c2){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x150'),_0x3f20c2[_0x471f('0x37')]));if(!this[_0x471f('0x7f')](_0x3f20c2[_0x471f('0x151')])){return this['channel']['error'](_0x3f20c2,_0x471f('0x152'));}logger['info'](util[_0x471f('0x28')](_0x471f('0x153'),this[_0x471f('0x35')]['callerid'],_0x3f20c2[_0x471f('0x151')]));var _0x25e438=this[_0x471f('0x50')]['sync'](this,_0x3f20c2[_0x471f('0x151')]);if(_0x25e438){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x154'),this[_0x471f('0x35')]['callerid'],_0x3f20c2[_0x471f('0x151')]));this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')](_0x471f('0x154'),this[_0x471f('0x35')]['callerid'],_0x3f20c2[_0x471f('0x151')]));return{'code':0xc8,'result':'success'};}else{logger[_0x471f('0x2b')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x471f('0x35')][_0x471f('0x39')],_0x3f20c2[_0x471f('0x151')]));this[_0x471f('0x35')][_0x471f('0xa8')](util['format'](_0x471f('0x155'),this[_0x471f('0x35')][_0x471f('0x39')],_0x3f20c2[_0x471f('0x151')]));return{'code':0xc8,'result':_0x471f('0x156')};}};AGIVertices[_0x471f('0xf')][_0x471f('0x157')]=function(_0x51a49c){logger[_0x471f('0x2b')](util['format'](_0x471f('0x158'),_0x51a49c['label']));if(!this[_0x471f('0x7f')](_0x51a49c[_0x471f('0x151')])){return this['channel']['error'](_0x51a49c,_0x471f('0x152'));}logger[_0x471f('0x2b')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x471f('0x35')][_0x471f('0x39')],_0x51a49c['findBy']));var _0x5c756b=this[_0x471f('0x4e')][_0x471f('0x69')](this,_0x51a49c[_0x471f('0x151')]);if(_0x5c756b){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x154'),this['channel']['callerid'],_0x51a49c[_0x471f('0x151')]));this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x471f('0x35')][_0x471f('0x39')],_0x51a49c['findBy']));return{'code':0xc8,'result':_0x471f('0x159')};}else{logger[_0x471f('0x2b')](util[_0x471f('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x471f('0x39')],_0x51a49c[_0x471f('0x151')]));this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')](_0x471f('0x155'),this['channel'][_0x471f('0x39')],_0x51a49c['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x471f('0xf')][_0x471f('0x15a')]=function(_0x44afcd){logger[_0x471f('0x2b')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x44afcd['label']));if(!this[_0x471f('0x7f')](_0x44afcd[_0x471f('0x15b')])){return this[_0x471f('0x35')]['error'](_0x44afcd,_0x471f('0x15c'));}this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')](_0x471f('0x15d'),_0x44afcd[_0x471f('0x15b')]));var _0x32f3e5=eval(_0x44afcd[_0x471f('0x15b')]);if(!this[_0x471f('0x7f')](_0x44afcd[_0x471f('0xd8')])){return this[_0x471f('0x35')][_0x471f('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x486077=this[_0x471f('0xa1')]['sync'](this,_0x44afcd[_0x471f('0xd8')]);if(!_0x486077){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x44afcd,_0x471f('0x114'));}if(_[_0x471f('0x99')](_0x32f3e5)){var _0x349be6=this;_0x32f3e5['forEach'](function(_0x131612,_0x5b5d00){_0x349be6[_0x471f('0x35')][_0x471f('0x9e')](util[_0x471f('0x28')](_0x471f('0x15e'),_0x486077,_0x5b5d00),_0x131612);});return this[_0x471f('0x35')][_0x471f('0xa8')](util['format'](_0x471f('0x15f'),_0x486077));}else{return this[_0x471f('0x35')]['setVariable'](_0x486077,_0x32f3e5);}};AGIVertices[_0x471f('0xf')][_0x471f('0xb')]=function(_0x1755c8){logger[_0x471f('0x2b')](util[_0x471f('0x28')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x1755c8[_0x471f('0x37')]));if(_0x1755c8[_0x471f('0x10c')]===0x0){return this[_0x471f('0xa5')](_0x1755c8);}_0x1755c8[_0x471f('0x10c')]-=0x1;if(!this[_0x471f('0x7f')](_0x1755c8[_0x471f('0x10d')])){return this['channel'][_0x471f('0x2f')](_0x1755c8,_0x471f('0x10e'));}var _0x5667c7=this[_0x471f('0x1c')][_0x471f('0x69')](this,_0x1755c8['file_id']);if(!_0x5667c7){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x1755c8,'no\x20file\x20audio\x20found');}var _0x52b58a=this[_0x471f('0x35')][_0x471f('0x10f')](_0x5667c7,_0x1755c8[_0x471f('0x110')],_0x1755c8['digit']);var _0x1da943=_0x52b58a[_0x471f('0xab')];if(_0x52b58a[_0x471f('0xab')]===-0x1){this[_0x471f('0x34')]['sync'](this,_0x1755c8,'-1');return _0x52b58a;}else if(_0x52b58a[_0x471f('0xa2')]===_0x471f('0x61')){_0x52b58a[_0x471f('0xab')]=_0x52b58a[_0x471f('0xab')]['length']>0x0?_0x52b58a[_0x471f('0xab')]:'t';}else if(_['isEmpty'](_0x52b58a['result'])){_0x52b58a[_0x471f('0xab')]='#';_0x1da943='#';}if(!this['isConfigured'](_0x1755c8['variable_id'])){this[_0x471f('0x35')][_0x471f('0xa8')](_0x471f('0xd9'));}else{var _0x5947db=this[_0x471f('0xa1')][_0x471f('0x69')](this,_0x1755c8[_0x471f('0xd8')]);if(!_0x5947db){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x1755c8,_0x471f('0x114'));}this[_0x471f('0x35')][_0x471f('0x9e')](_0x5947db,_0x1da943);}this['createSquareDetailsReport'][_0x471f('0x69')](this,_0x1755c8,_0x1da943);return _0x52b58a;};AGIVertices[_0x471f('0xf')][_0x471f('0xa8')]=function(_0x41d478){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x160'),_0x41d478[_0x471f('0x37')]));return this[_0x471f('0x35')][_0x471f('0xa8')](_0x41d478[_0x471f('0x161')]||_0x41d478[_0x471f('0x37')]);};AGIVertices['prototype'][_0x471f('0x162')]=function(_0x388e1d){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x163'),_0x388e1d[_0x471f('0x37')]));if(!this[_0x471f('0x7f')](_0x388e1d['findBy'])){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x388e1d,'no\x20find\x20by\x20configured');}logger[_0x471f('0x2b')](util['format'](_0x471f('0x153'),this['channel'][_0x471f('0x39')],_0x388e1d['findBy']));var _0x359fe7=this[_0x471f('0x164')][_0x471f('0x69')](this,_0x388e1d[_0x471f('0x165')]);var _0x80c88=this[_0x471f('0x4c')][_0x471f('0x69')](this,_0x388e1d[_0x471f('0x151')],_0x359fe7);if(_0x80c88){logger['info'](util[_0x471f('0x28')](_0x471f('0x154'),this[_0x471f('0x35')][_0x471f('0x39')],_0x388e1d[_0x471f('0x151')]));this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x471f('0x35')][_0x471f('0x39')],_0x388e1d[_0x471f('0x151')]));return{'code':0xc8,'result':'success'};}else{logger[_0x471f('0x2b')](util['format'](_0x471f('0x155'),this[_0x471f('0x35')]['callerid'],_0x388e1d[_0x471f('0x151')]));this[_0x471f('0x35')][_0x471f('0xa8')](util['format'](_0x471f('0x154'),this[_0x471f('0x35')]['callerid'],_0x388e1d[_0x471f('0x151')]));return{'code':0xc8,'result':_0x471f('0x156')};}};AGIVertices[_0x471f('0xf')][_0x471f('0x166')]=function(_0x5cc18c){logger[_0x471f('0x2b')](util['format'](_0x471f('0x167'),_0x5cc18c[_0x471f('0x37')]));if(!this[_0x471f('0x7f')](_0x5cc18c['file_id'])){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x5cc18c,_0x471f('0x10e'));}var _0x3b992b=this[_0x471f('0x1c')][_0x471f('0x69')](this,_0x5cc18c[_0x471f('0x10d')]);if(!_0x3b992b){return this['channel']['error'](_0x5cc18c,'no\x20file\x20audio\x20found');}var _0x29f1d3=this[_0x471f('0x35')][_0x471f('0xca')](_0x471f('0x168'),[_0x3b992b,_0x5cc18c[_0x471f('0xe3')]]);if(_0x29f1d3['result']===-0x1){return _0x29f1d3;}return this[_0x471f('0x35')]['noop'](util[_0x471f('0x28')](_0x471f('0x169'),_0x471f('0x168'),_0x3b992b));};AGIVertices[_0x471f('0xf')][_0x471f('0x16a')]=function(_0x4a82de){logger[_0x471f('0x2b')](util['format'](_0x471f('0x16b'),_0x4a82de[_0x471f('0x37')]));if(!this[_0x471f('0x7f')](_0x4a82de[_0x471f('0x16c')])){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x4a82de,_0x471f('0x16d'));}var _0x10aef6='';var _0x11f1d3=parseInt(_0x4a82de[_0x471f('0x16c')],0xa);if(isNaN(_0x11f1d3)){_0x10aef6=_0x4a82de[_0x471f('0x16c')];}else{_0x10aef6=this[_0x471f('0x14')][_0x471f('0x69')](this,_0x4a82de[_0x471f('0x16c')]);if(!_0x10aef6){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x4a82de,_0x471f('0x16e'));}}var _0x179b43='';if(this[_0x471f('0x7f')](_0x4a82de[_0x471f('0x10d')])){var _0x542973=this[_0x471f('0x1c')][_0x471f('0x69')](this,_0x4a82de[_0x471f('0x10d')]);if(_0x542973){_0x179b43=_0x542973;}}this[_0x471f('0x34')]['sync'](this,_0x4a82de,_0x10aef6);if(_0x4a82de[_0x471f('0xe3')][_0x471f('0x16f')]('x')<0x0){_0x4a82de[_0x471f('0xe3')]+='x';}if(_0x4a82de[_0x471f('0xe3')][_0x471f('0x16f')]('X')<0x0){_0x4a82de[_0x471f('0xe3')]+='X';}this[_0x471f('0x35')]['setVariable'](_0x471f('0x170'),_0x10aef6?_0x10aef6[_0x471f('0x171')]():'');var _0x18f318=this[_0x471f('0x35')][_0x471f('0xca')]('QUEUE',[_0x10aef6,_0x4a82de[_0x471f('0xe3')],_0x4a82de[_0x471f('0x5f')],_0x179b43,_0x4a82de[_0x471f('0x61')],_0x4a82de[_0x471f('0xb7')],_0x4a82de['macro'],_0x4a82de[_0x471f('0x172')],'',_0x4a82de[_0x471f('0x173')]]);if(_0x18f318[_0x471f('0xab')]===-0x1){return _0x18f318;}return this[_0x471f('0x35')]['noop'](util[_0x471f('0x28')]('Executed\x20command\x20%s\x20%s',_0x471f('0x174'),_0x10aef6));};AGIVertices['prototype'][_0x471f('0x175')]=function(_0x2c2226){logger['info'](util[_0x471f('0x28')](_0x471f('0x176'),_0x2c2226['label']));var _0xefdeaa=_0x2c2226[_0x471f('0x177')]||_0x471f('0x12f');var _0x52fcb1=util[_0x471f('0x28')](_0x471f('0x178'),this[_0x471f('0x35')]['uniqueid'],rs[_0x471f('0x116')](0x5));var _0x2e5e8d=util[_0x471f('0x28')]('%s/recordings/%s.%s',FILES_PATH,_0x52fcb1,_0xefdeaa);var _0x9698c1=util['format'](_0x471f('0x130'),FILES_PATH,_0x52fcb1);this[_0x471f('0x3a')][_0x471f('0x69')](this,_0x2c2226,_0x52fcb1,_0x2e5e8d);this[_0x471f('0x35')][_0x471f('0x9e')](_0x471f('0x179'),_0x52fcb1);logger[_0x471f('0x2b')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x9698c1,_0xefdeaa,_0x2c2226[_0x471f('0x17a')],_0x2c2226[_0x471f('0x61')]);return this['channel'][_0x471f('0x133')](_0x9698c1,_0xefdeaa,_0x2c2226[_0x471f('0x17a')],_0x2c2226[_0x471f('0x61')],undefined,!![]);};AGIVertices[_0x471f('0xf')][_0x471f('0x17b')]=function(_0x115ec7){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x17c'),_0x115ec7['label']));if(!this[_0x471f('0x7f')](_0x115ec7[_0x471f('0x5f')])){return this[_0x471f('0x35')][_0x471f('0xa8')](_0x471f('0x17d'));}var _0x5c62e0=this[_0x471f('0x5e')][_0x471f('0x69')](this,_0x115ec7);logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x17e'),util[_0x471f('0x17f')](_0x5c62e0,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x115ec7['variable_id'])){return this['channel']['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x28322e=this['getVariable'][_0x471f('0x69')](this,_0x115ec7[_0x471f('0xd8')]);if(!_0x28322e){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x115ec7,'no\x20variable\x20found');}this[_0x471f('0x35')]['setVariable'](util[_0x471f('0x28')](_0x471f('0x180'),_0x28322e),_0x5c62e0[_0x471f('0x6f')]?_0x5c62e0[_0x471f('0x6f')]:_0x471f('0x181'));this[_0x471f('0x35')][_0x471f('0x9e')](util[_0x471f('0x28')]('%s_STATUS_MESSAGE',_0x28322e),_0x5c62e0['statusMessage']?_0x5c62e0[_0x471f('0x70')]:'OK');if(_0x5c62e0[_0x471f('0x64')]){try{this[_0x471f('0x9b')](_0x5c62e0['body'],_0x28322e);}catch(_0x570270){logger[_0x471f('0x2f')](util[_0x471f('0x28')](_0x471f('0x182'),_0x28322e));}}return this[_0x471f('0x35')][_0x471f('0xa8')](util['format'](_0x471f('0x183'),_0x28322e));};AGIVertices[_0x471f('0xf')]['saydigits']=function(_0x594914){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x184'),_0x594914['label']));return this[_0x471f('0x35')][_0x471f('0x185')](_0x594914['digits']['replace'](/\s+/g,''),_0x594914[_0x471f('0x17a')]);};AGIVertices[_0x471f('0xf')][_0x471f('0x186')]=function(_0x23ba2d){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x187'),_0x23ba2d[_0x471f('0x37')]));return this['channel'][_0x471f('0x188')](_0x23ba2d[_0x471f('0x62')][_0x471f('0x54')](/\s+/g,''),_0x23ba2d['escape_digits']);};AGIVertices[_0x471f('0xf')]['sayphonetic']=function(_0x485fe3){logger[_0x471f('0x2b')](util[_0x471f('0x28')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x485fe3[_0x471f('0x37')]));return this[_0x471f('0x35')][_0x471f('0x189')](_0x485fe3['text'],_0x485fe3[_0x471f('0x17a')]);};AGIVertices[_0x471f('0xf')]['sendMail']=function(_0xe30336){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x18a'),_0xe30336['label']));if(!this[_0x471f('0x7f')](_0xe30336[_0x471f('0x18b')])){return this['channel'][_0x471f('0xa8')]('no\x20mail\x20account\x20configured');}var _0x43a9c6=this[_0x471f('0x20')]['sync'](this,_0xe30336[_0x471f('0x18b')]);if(!_0x43a9c6||!_0x43a9c6['Smtp']){return this[_0x471f('0x35')]['error'](_0xe30336,_0x471f('0x18c'));}var _0xb9827f={'from':util[_0x471f('0x28')](_0x471f('0x18d'),_0x43a9c6[_0x471f('0x12')],_0x43a9c6[_0x471f('0x18e')]||_0x43a9c6[_0x471f('0x18f')][_0x471f('0x190')]),'to':_0xe30336['to']||'','cc':_0xe30336['cc']||'','bcc':_0xe30336['bcc']||'','subject':_0xe30336[_0x471f('0x191')],'html':_0xe30336[_0x471f('0x58')],'text':_0xe30336[_0x471f('0x58')]};if(this[_0x471f('0x7f')](_0xe30336['template_id'])){}logger[_0x471f('0xde')](_0x471f('0x192'),JSON[_0x471f('0x6d')](_0xb9827f));this[_0x471f('0x34')][_0x471f('0x69')](this,_0xe30336,_0xe30336[_0x471f('0x18b')]);this[_0x471f('0x35')]['noop'](util[_0x471f('0x28')](_0x471f('0x193'),_0x43a9c6['name']));this[_0x471f('0x22')][_0x471f('0x69')](this,_0x43a9c6[_0x471f('0x194')],_0xb9827f);return this['channel'][_0x471f('0xa8')](_0x471f('0x195'));};AGIVertices[_0x471f('0xf')][_0x471f('0x196')]=function(_0x443d21){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x197'),_0x443d21[_0x471f('0x37')]));return this[_0x471f('0x35')][_0x471f('0xa8')](_0x471f('0x198'));};AGIVertices[_0x471f('0xf')][_0x471f('0x199')]=function(_0x3ef2ad){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x19a'),_0x3ef2ad[_0x471f('0x37')]));if(!this['isConfigured'](_0x3ef2ad[_0x471f('0x19b')])){return this[_0x471f('0x35')][_0x471f('0xa8')](_0x471f('0x19c'));}var _0x196694=this['getSmsAccount'][_0x471f('0x69')](this,_0x3ef2ad['sms_account_id']);if(!_0x196694){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x3ef2ad,_0x471f('0x19d'));}var _0x316d6d={'body':_0x3ef2ad['sms_text'],'phone':_0x3ef2ad['to']||'','SmsAccountId':_0x196694['id']};logger['debug'](_0x471f('0x19e'),JSON['stringify'](_0x316d6d));this[_0x471f('0x34')][_0x471f('0x69')](this,_0x3ef2ad,_0x3ef2ad[_0x471f('0x19b')]);this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')](_0x471f('0x19f'),_0x196694[_0x471f('0x12')]));this[_0x471f('0x33')][_0x471f('0x69')](this,_0x316d6d);return this[_0x471f('0x35')][_0x471f('0xa8')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x471f('0xf')][_0x471f('0x1a0')]=function(_0x2d54d9){logger[_0x471f('0x2b')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x2d54d9[_0x471f('0x37')]));if(!this[_0x471f('0x7f')](_0x2d54d9[_0x471f('0xd8')])){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x2d54d9,_0x471f('0x1a1'));}var _0x176129=this[_0x471f('0xa1')][_0x471f('0x69')](this,_0x2d54d9[_0x471f('0xd8')]);if(!_0x176129){return this['channel'][_0x471f('0x2f')](_0x2d54d9,'no\x20variable\x20found');}return this[_0x471f('0x35')][_0x471f('0x9e')](_0x176129,_0x2d54d9[_0x471f('0x1a2')]);};AGIVertices['prototype'][_0x471f('0x1a3')]=function(_0xc22759){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x1a4'),_0xc22759['label']));this[_0x471f('0x35')]['noop']('START\x20CALLY\x20SQUARE');if(_0xc22759[_0x471f('0xbb')]===_0x471f('0x1a5')){this[_0x471f('0x35')][_0x471f('0xa8')]('Answer');return this[_0x471f('0x35')][_0x471f('0xbb')]();}return this[_0x471f('0x35')][_0x471f('0xa8')](_0x471f('0x1a6'));};AGIVertices[_0x471f('0xf')][_0x471f('0x1a7')]=function(_0x2e5dae){logger[_0x471f('0x2b')](util[_0x471f('0x28')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x2e5dae['label']));if(!this[_0x471f('0x7f')](_0x2e5dae[_0x471f('0x1a8')])){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x2e5dae,_0x471f('0x1a9'));}var _0x259e30=this[_0x471f('0x16')][_0x471f('0x69')](this,_0x2e5dae[_0x471f('0x1a8')]);if(!this[_0x471f('0x7f')](_0x259e30)){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x2e5dae,util[_0x471f('0x28')](_0x471f('0x1aa'),_0x2e5dae[_0x471f('0x1a8')]));}if(_0x259e30===this[_0x471f('0x35')][_0x471f('0x38')]){return this['channel'][_0x471f('0x2f')](_0x2e5dae,_0x471f('0x1ab'));}this['createSquareDetailsReport'][_0x471f('0x69')](this,_0x2e5dae,_0x259e30);var _0x42135b=this[_0x471f('0x35')][_0x471f('0xca')](_0x471f('0x1ac'),util[_0x471f('0x28')](_0x471f('0x1ad'),config[_0x471f('0xb7')][_0x471f('0x1ae')]||_0x471f('0x1af'),_0x259e30,this[_0x471f('0x35')]['arg_1']));if(_0x42135b['result']===-0x1){return _0x42135b;}return this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')]('Executed\x20command\x20%s\x20%s','AGI',_0x259e30));};AGIVertices[_0x471f('0xf')][_0x471f('0x1b0')]=function(_0x192760){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x1b1'),_0x192760[_0x471f('0x37')]));var _0x395743=this[_0x471f('0x53')][_0x471f('0x69')](this,_0x192760['command']);this[_0x471f('0x34')][_0x471f('0x69')](this,_0x192760,_0x192760[_0x471f('0xb9')]);if(this[_0x471f('0x7f')](_0x192760['variable_id'])){var _0x3d59a4=this['getVariable']['sync'](this,_0x192760[_0x471f('0xd8')]);if(_0x3d59a4){this[_0x471f('0x35')][_0x471f('0x9e')](_0x3d59a4,_0x395743);return this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')](_0x471f('0x1b2'),_0x192760['command'],_0x3d59a4));}}return this['channel']['noop'](util['format'](_0x471f('0x1b3'),_0x192760[_0x471f('0xb9')]));};AGIVertices[_0x471f('0xf')][_0x471f('0x1b4')]=function(_0xb1f006){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x1b5'),_0xb1f006[_0x471f('0x37')]));_0xb1f006[_0x471f('0x58')]=_0xb1f006[_0x471f('0x58')][_0x471f('0x54')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0xb1f006['apiKey'])){return this[_0x471f('0x35')][_0x471f('0xa8')](_0x471f('0x1b6'));}if(!this[_0x471f('0x7f')](_0xb1f006['text'])){return this[_0x471f('0x35')][_0x471f('0xa8')]('no\x20text\x20configured');}this['channel'][_0x471f('0xa8')](util[_0x471f('0x28')](_0x471f('0x1b7'),_0xb1f006[_0x471f('0x58')]));var _0x5c035f=this[_0x471f('0x55')][_0x471f('0x69')](this,_0xb1f006);if(_0x5c035f){this[_0x471f('0x35')][_0x471f('0xa8')](util['format'](_0x471f('0x1b8'),_0x5c035f));var _0xd8fac3=this[_0x471f('0x35')]['streamFile'](_0x5c035f);try{fs['unlink'](_0x5c035f+_0x471f('0x100'));}catch(_0x2e6bf0){logger[_0x471f('0x2f')](_0x2e6bf0);}return _0xd8fac3;}return this[_0x471f('0x35')][_0x471f('0x2f')](_0xb1f006,_0x471f('0x1b9'));};AGIVertices[_0x471f('0xf')][_0x471f('0x1ba')]=function(_0x204b2c){logger['info'](util[_0x471f('0x28')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x204b2c['label']));_0x204b2c['text']=_0x204b2c['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x204b2c[_0x471f('0x58')])){return this[_0x471f('0x35')]['noop']('no\x20text\x20configured');}this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')]('Trying\x20Google\x20TTS\x20%s',_0x204b2c[_0x471f('0x58')]));var _0x529f38=this[_0x471f('0x5c')][_0x471f('0x69')](this,_0x204b2c);if(_0x529f38){this[_0x471f('0x35')]['noop'](util[_0x471f('0x28')](_0x471f('0x1bb'),_0x529f38));var _0x1cd7ac=this['channel'][_0x471f('0x122')](_0x529f38);try{fs[_0x471f('0x123')](_0x529f38+_0x471f('0x100'));}catch(_0x2809a0){logger[_0x471f('0x2f')](_0x2809a0);}return _0x1cd7ac;}return this[_0x471f('0x35')]['error'](_0x204b2c,_0x471f('0x1bc'));};AGIVertices['prototype'][_0x471f('0x1bd')]=function(_0x3ccb8e){logger['info'](util[_0x471f('0x28')](_0x471f('0x1be'),_0x3ccb8e[_0x471f('0x37')]));if(!this[_0x471f('0x7f')](_0x3ccb8e[_0x471f('0x151')])){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x3ccb8e,_0x471f('0x152'));}logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x153'),this['channel'][_0x471f('0x39')],_0x3ccb8e[_0x471f('0x151')]));var _0xc33f8a=this[_0x471f('0x4d')][_0x471f('0x69')](this,_0x3ccb8e[_0x471f('0x151')]);if(_0xc33f8a){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x154'),this[_0x471f('0x35')][_0x471f('0x39')],_0x3ccb8e[_0x471f('0x151')]));this[_0x471f('0x35')]['noop'](util[_0x471f('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x471f('0x39')],_0x3ccb8e[_0x471f('0x151')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x471f('0x28')](_0x471f('0x155'),this[_0x471f('0x35')]['callerid'],_0x3ccb8e['findBy']));this[_0x471f('0x35')][_0x471f('0xa8')](util[_0x471f('0x28')](_0x471f('0x155'),this[_0x471f('0x35')]['callerid'],_0x3ccb8e['findBy']));return{'code':0xc8,'result':_0x471f('0x156')};}};AGIVertices[_0x471f('0xf')][_0x471f('0x1bf')]=function(_0x36b810){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x1c0'),_0x36b810[_0x471f('0x37')]));var _0x1a4f82=this[_0x471f('0x35')]['exec'](_0x471f('0x1c1'),[_0x36b810[_0x471f('0x1c2')],_0x36b810[_0x471f('0x73')]]);if(_0x1a4f82[_0x471f('0xab')]===-0x1){return _0x1a4f82;}return this['channel']['noop'](util[_0x471f('0x28')](_0x471f('0x169'),_0x471f('0x1c1'),_0x36b810[_0x471f('0x1c2')]));};AGIVertices['prototype'][_0x471f('0x1c3')]=function(_0x5e0521){logger[_0x471f('0x2b')](util[_0x471f('0x28')](_0x471f('0x1c4'),_0x5e0521[_0x471f('0x37')]));if(!this['isConfigured'](_0x5e0521['variable_id'])){return this[_0x471f('0x35')]['error'](_0x5e0521,_0x471f('0x1a1'));}var _0x1b55ac=this[_0x471f('0xa1')][_0x471f('0x69')](this,_0x5e0521[_0x471f('0xd8')]);if(!_0x1b55ac){return this[_0x471f('0x35')][_0x471f('0x2f')](_0x5e0521,'no\x20variable\x20found');}var _0x2161d1=this[_0x471f('0x35')]['getVariable'](_0x1b55ac);return{'code':0xc8,'result':_0x2161d1[_0x471f('0xa2')]?_0x2161d1[_0x471f('0xa2')]:'-'};};String['prototype']['replaceAll']=function(_0x36385d,_0x529ec5){return this[_0x471f('0x9f')](_0x36385d)['join'](_0x529ec5);};module[_0x471f('0x1c5')]=AGIVertices; \ No newline at end of file +var _0xa958=['NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','toUpperCase','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','wav','intKey','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','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','logout','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','opts','indexOf','XMCS-QUEUE','toLowerCase','gosub','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s/recordings/%s.%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','arg_1','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','system','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','util','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','channel','rpc','mailRpc','getVariable','catch','getVoiceQueue','getVoiceQueueById','then','name','getSquareProject','getSquareProjectById','prototype','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervalById','interval','map','Intervals','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','uniqueid','createCmContact','isEmpty','isNil','callback_','lastName','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','MP3','googleTTS','url','method','timeout','number','POST','PUT','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','en-US','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','includes','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','length','replaceAllVariables','saveRestApiResult','%s.%s','isArray','setVariable','split','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','createSquareMessage','googleDialogflow','DIALOGFLOW_%s','speech','dialogflow','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','out','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','file_id','no\x20file\x20audio\x20found','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','%s/recordings/%s','beep'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa958,0x94));var _0x8a95=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa958[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var util=require(_0x8a95('0x0'));var _=require('lodash');var sh=require(_0x8a95('0x1'));var odbc=require(_0x8a95('0x2'))();var rs=require(_0x8a95('0x3'));var moment=require(_0x8a95('0x4'));var Mustache=require(_0x8a95('0x5'));var rp=require(_0x8a95('0x6'));var logger=require('../../config/logger')('agi');var config=require(_0x8a95('0x7'));var shared=require(_0x8a95('0x8'));var scripts=require(_0x8a95('0x9'));var FILES_PATH=_0x8a95('0xa');var recursiveMapAttributes=[_0x8a95('0xb'),_0x8a95('0xc')];var verticesWithRetry=[_0x8a95('0xd'),'getdigits',_0x8a95('0xe')];var AGIVertices=function(_0x1e5a06,_0x1f944c,_0x240b22){this[_0x8a95('0xf')]=_0x1e5a06;this[_0x8a95('0x10')]=_0x1f944c;this[_0x8a95('0x11')]=_0x240b22;};AGIVertices['prototype'][_0x8a95('0x12')]=function(_0x98e81c,_0x574fef){this[_0x8a95('0x10')]['getVariableById'](_0x98e81c)['then'](function(_0x108b6f){_0x574fef(null,_0x108b6f?_0x108b6f['name']:![]);})[_0x8a95('0x13')](function(_0x1579cd){_0x574fef(_0x1579cd);});};AGIVertices['prototype'][_0x8a95('0x14')]=function(_0x189505,_0x59c5cc){this[_0x8a95('0x10')][_0x8a95('0x15')](_0x189505)[_0x8a95('0x16')](function(_0x3cae29){_0x59c5cc(null,_0x3cae29?_0x3cae29[_0x8a95('0x17')]:![]);})[_0x8a95('0x13')](function(_0x13922b){_0x59c5cc(_0x13922b);});};AGIVertices['prototype'][_0x8a95('0x18')]=function(_0x556592,_0x334b18){this['rpc'][_0x8a95('0x19')](_0x556592)[_0x8a95('0x16')](function(_0x2d6305){_0x334b18(null,_0x2d6305?_0x2d6305[_0x8a95('0x17')]:![]);})[_0x8a95('0x13')](function(_0x33e007){_0x334b18(_0x33e007);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x1b')]=function(_0x2b0eaf,_0x23da17){this[_0x8a95('0x10')][_0x8a95('0x1c')](_0x2b0eaf)[_0x8a95('0x16')](function(_0x361804){_0x23da17(null,_0x361804?_0x361804[_0x8a95('0x1d')]:![]);})[_0x8a95('0x13')](function(_0x1e812e){_0x23da17(_0x1e812e);});};AGIVertices['prototype']['getUser']=function(_0x476c2c,_0x25e5a7){this[_0x8a95('0x10')][_0x8a95('0x1e')](_0x476c2c)[_0x8a95('0x16')](function(_0xfc238){_0x25e5a7(null,_0xfc238?_0xfc238['name']:![]);})['catch'](function(_0x29a731){_0x25e5a7(_0x29a731);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x1f')]=function(_0x23130a,_0x223737){this[_0x8a95('0x10')][_0x8a95('0x20')](_0x23130a)[_0x8a95('0x16')](function(_0x3e880b){_0x223737(null,_0x3e880b?_0x3e880b[_0x8a95('0x17')]:![]);})['catch'](function(_0x1a98e0){_0x223737(_0x1a98e0);});};AGIVertices[_0x8a95('0x1a')]['getSound']=function(_0x1d21a9,_0x582d2c){var _0x508b0f=this;this[_0x8a95('0x10')]['getSoundById'](_0x1d21a9)[_0x8a95('0x16')](function(_0x5d961f){_0x582d2c(null,_0x5d961f?_0x508b0f[_0x8a95('0x21')](_0x5d961f[_0x8a95('0x22')]):![]);})[_0x8a95('0x13')](function(_0x13e2ed){_0x582d2c(_0x13e2ed);});};AGIVertices[_0x8a95('0x1a')]['getMailAccount']=function(_0x23252e,_0x5e0837){this['rpc'][_0x8a95('0x23')](_0x23252e)['then'](function(_0x511925){_0x5e0837(null,_0x511925?_0x511925:![]);})[_0x8a95('0x13')](function(_0x186745){_0x5e0837(_0x186745);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x24')]=function(_0x3091aa,_0x2d0a28,_0x371ad3){this[_0x8a95('0x11')][_0x8a95('0x24')](_0x3091aa,_0x2d0a28)[_0x8a95('0x16')](function(){_0x371ad3(null);})[_0x8a95('0x13')](function(_0x311239){_0x371ad3(_0x311239);});};AGIVertices[_0x8a95('0x1a')]['getIntervals']=function(_0x2edb09,_0x5e647f){this['rpc'][_0x8a95('0x25')](_0x2edb09)[_0x8a95('0x16')](function(_0x25e55a){if(_0x25e55a){if(_0x25e55a['IntervalId']){_0x5e647f(null,[_0x25e55a[_0x8a95('0x26')]]);}else{_0x5e647f(null,_[_0x8a95('0x27')](_0x25e55a[_0x8a95('0x28')],_0x8a95('0x26')));}}else{_0x5e647f(null,![]);}})[_0x8a95('0x13')](function(_0x411bf3){_0x5e647f(_0x411bf3);});};AGIVertices[_0x8a95('0x1a')]['getSoundPath']=function(_0x432d01){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x432d01);};AGIVertices['prototype']['getQueryOdbc']=function(_0x504f9e,_0x57e522,_0x129edc){odbc[_0x8a95('0x29')](_0x504f9e,function(_0x980019){if(_0x980019){logger[_0x8a95('0x2a')](_0x8a95('0x2b'),_0x980019);_0x129edc(_0x980019);}else{logger[_0x8a95('0x2c')](_0x8a95('0x2d'));odbc[_0x8a95('0x2e')](_0x57e522,function(_0x557608,_0x2752d2){if(_0x557608){logger['info'](_0x8a95('0x2f'),_0x57e522);_0x129edc(_0x557608);}else{logger[_0x8a95('0x2c')](_0x8a95('0x30'),_0x57e522);odbc[_0x8a95('0x31')](function(_0x1e7592){if(_0x1e7592){logger[_0x8a95('0x2a')](_0x8a95('0x32'),_0x1e7592);}_0x129edc(null,_0x2752d2);});}});}});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x33')]=function(_0x3bccb9,_0x1aba8d){this['rpc'][_0x8a95('0x34')](_0x3bccb9)['then'](function(_0x358a9c){_0x1aba8d(null,_0x358a9c?_0x358a9c:![]);})['catch'](function(_0x5e0c6d){_0x1aba8d(_0x5e0c6d);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x35')]=function(_0xabf2b2,_0x453815){this[_0x8a95('0x10')][_0x8a95('0x35')](_0xabf2b2)['then'](function(_0xab4e60){_0x453815(null,_0xab4e60);})[_0x8a95('0x13')](function(_0x5e7479){_0x453815(_0x5e7479);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x36')]=function(_0xff9088,_0x2e983a,_0x2729db){this[_0x8a95('0x10')]['createSquareDetailsReport']({'uniqueid':this[_0x8a95('0xf')]['uniqueid'],'node':_0xff9088[_0x8a95('0x37')],'application':_0xff9088[_0x8a95('0x38')],'data':_0x2e983a||null,'project_name':this[_0x8a95('0xf')]['arg_1'],'callerid':this[_0x8a95('0xf')][_0x8a95('0x39')]})['then'](function(_0x503585){if(_0x2729db){_0x2729db(null,_0x503585);}})[_0x8a95('0x13')](function(_0x54c193){if(_0x2729db){_0x2729db(_0x54c193);}});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x3a')]=function(_0x4cbffb,_0x192bc9,_0x2f3b23,_0x3dfb84){this[_0x8a95('0x10')][_0x8a95('0x3a')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0x8a95('0xf')]['callerid'],'calleridname':this[_0x8a95('0xf')][_0x8a95('0x3b')],'context':this[_0x8a95('0xf')][_0x8a95('0x3c')],'extension':this['channel'][_0x8a95('0x3d')],'priority':this[_0x8a95('0xf')][_0x8a95('0x3e')],'accountcode':this[_0x8a95('0xf')][_0x8a95('0x3f')],'dnid':this[_0x8a95('0xf')][_0x8a95('0x40')],'projectName':this[_0x8a95('0xf')]['arg_1'],'saveName':_0x192bc9,'filename':_0x4cbffb[_0x8a95('0x41')]||_0x192bc9,'savePath':_0x2f3b23})['then'](function(_0x2e29ab){_0x3dfb84(null,_0x2e29ab);})[_0x8a95('0x13')](function(_0x463a5b){_0x3dfb84(_0x463a5b);});};AGIVertices[_0x8a95('0x1a')]['createSquareMessage']=function(_0x541438,_0x40280b,_0x529e93,_0x744326,_0x50bc10){this[_0x8a95('0x10')]['createSquareMessage']({'uniqueid':this[_0x8a95('0xf')][_0x8a95('0x42')],'body':_0x541438,'direction':_0x40280b,'providerName':_0x529e93,'providerResponse':_0x744326})[_0x8a95('0x16')](function(_0x1460c7){if(_0x50bc10){_0x50bc10(null,_0x1460c7);}})[_0x8a95('0x13')](function(_0x29afff){if(_0x50bc10){_0x50bc10(_0x29afff);}});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x43')]=function(_0xeabff1,_0x561831){this[_0x8a95('0x10')][_0x8a95('0x43')]({'firstName':_[_0x8a95('0x44')](_0xeabff1['name'])||_[_0x8a95('0x45')](_0xeabff1[_0x8a95('0x17')])?_0x8a95('0x46')+Math['random']():_0xeabff1[_0x8a95('0x17')],'lastName':_[_0x8a95('0x44')](_0xeabff1[_0x8a95('0x47')])||_['isNil'](_0xeabff1[_0x8a95('0x47')])?null:_0xeabff1[_0x8a95('0x47')],'phone':_0xeabff1['phone'],'ListId':_0xeabff1[_0x8a95('0x48')],'scheduledat':_0xeabff1[_0x8a95('0x49')],'callbackUniqueid':this[_0x8a95('0xf')]['uniqueid'],'tags':_0x8a95('0x4a'),'description':'Callback\x20scheduled\x20at\x20'+_0xeabff1[_0x8a95('0x49')][_0x8a95('0x4b')](),'priority':_0xeabff1[_0x8a95('0x4c')]})['then'](function(_0xe04bed){_0x561831(null,_0xe04bed);})[_0x8a95('0x13')](function(_0x155556){_0x561831(_0x155556);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x4d')]=function(_0x3a267a,_0x488f26){this['rpc'][_0x8a95('0x4e')](_0x3a267a)['then'](function(_0x1db297){_0x488f26(null,_0x1db297?_0x1db297['name']:![]);})[_0x8a95('0x13')](function(_0x1597d8){_0x488f26(_0x1597d8);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x4f')]=function(_0x33baeb,_0x4923d1,_0x1d87eb){var _0x4bf6c2={'role':_0x8a95('0x50')};_0x4bf6c2[_0x33baeb]=this[_0x8a95('0xf')]['callerid'];this[_0x8a95('0x10')][_0x8a95('0x4f')](_0x4bf6c2,_0x4923d1,this['channel']['uniqueid'])['then'](function(_0x46fb97){_0x1d87eb(null,_[_0x8a95('0x45')](_0x46fb97)?![]:!![]);})[_0x8a95('0x13')](function(_0x3203f7){logger[_0x8a95('0x2a')](_0x3203f7);_0x1d87eb(null,![]);});};AGIVertices[_0x8a95('0x1a')]['agentUnpause']=function(_0x5f1777,_0x42cb08){var _0x3f2f35={'role':_0x8a95('0x50')};_0x3f2f35[_0x5f1777]=this[_0x8a95('0xf')][_0x8a95('0x39')];this[_0x8a95('0x10')][_0x8a95('0x51')](_0x3f2f35)[_0x8a95('0x16')](function(_0x1ffad9){_0x42cb08(null,_[_0x8a95('0x45')](_0x1ffad9)?![]:!![]);})[_0x8a95('0x13')](function(_0x46bffd){logger['error'](_0x46bffd);_0x42cb08(null,![]);});};AGIVertices[_0x8a95('0x1a')]['agentLogout']=function(_0x21b395,_0x4426dc){var _0x6206fe={'role':_0x8a95('0x50')};_0x6206fe[_0x21b395]=this[_0x8a95('0xf')][_0x8a95('0x39')];this[_0x8a95('0x10')][_0x8a95('0x52')](_0x6206fe)[_0x8a95('0x16')](function(_0x49395f){_0x4426dc(null,_[_0x8a95('0x45')](_0x49395f)?![]:!![]);})[_0x8a95('0x13')](function(_0x584bf9){logger['error'](_0x584bf9);_0x4426dc(null,![]);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x53')]=function(_0x3475e0,_0x58192c){var _0x1c0321={'role':'agent'};_0x1c0321[_0x3475e0]=this[_0x8a95('0xf')]['callerid'];var _0x24fba1=_0x3475e0!=_0x8a95('0x54')?util[_0x8a95('0x55')](_0x8a95('0x56'),_0x8a95('0x57'),this[_0x8a95('0xf')][_0x8a95('0x39')]):undefined;this[_0x8a95('0x10')][_0x8a95('0x53')](_0x1c0321,_0x24fba1)[_0x8a95('0x16')](function(_0x1ea4f8){_0x58192c(null,_[_0x8a95('0x45')](_0x1ea4f8)?![]:!![]);})[_0x8a95('0x13')](function(_0x11e1ad){logger[_0x8a95('0x2a')](_0x11e1ad);_0x58192c(null,![]);});};AGIVertices['prototype'][_0x8a95('0x58')]=function(_0xb576bd,_0x40c552){sh[_0x8a95('0x59')](_['trim'](_0xb576bd),function(_0x52130e,_0x5772db){var _0x379c60=_0x5772db[_0x8a95('0x5a')](/(\r\n|\n|\r)/gm,'');_0x40c552(null,_0x379c60);});};AGIVertices['prototype'][_0x8a95('0x5b')]=function(_0x5bf56b,_0x3ebb7f){scripts[_0x8a95('0x5b')](_0x5bf56b[_0x8a95('0x5c')],_0x5bf56b[_0x8a95('0x5d')]||_0x8a95('0x5e'),_0x5bf56b[_0x8a95('0x5e')],_0x5bf56b[_0x8a95('0x5f')]||'en-US',_0x5bf56b[_0x8a95('0x60')]||_0x8a95('0x61'),_0x5bf56b['audioEncoding']||_0x8a95('0x62'))[_0x8a95('0x16')](function(_0x31226a){_0x3ebb7f(null,_0x31226a);})[_0x8a95('0x13')](function(_0x13e659){_0x3ebb7f(_0x13e659);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x63')]=function(_0x4564a7,_0x455b2f){scripts[_0x8a95('0x63')](_0x4564a7[_0x8a95('0x5e')],_0x4564a7['google_tts_language']||'en',0x1)[_0x8a95('0x16')](function(_0x4e42e6){_0x455b2f(null,_0x4e42e6);})[_0x8a95('0x13')](function(_0x2c00be){_0x455b2f(_0x2c00be);});};AGIVertices[_0x8a95('0x1a')]['restAPI']=function(_0x2485bb,_0x244ac9){var _0x4fa511={'uri':_0x2485bb[_0x8a95('0x64')],'method':_0x2485bb[_0x8a95('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2485bb[_0x8a95('0x66')])===_0x8a95('0x67')&&parseInt(_0x2485bb[_0x8a95('0x66')])>=0x1?parseInt(_0x2485bb[_0x8a95('0x66')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x8a95('0x68'),_0x8a95('0x69')],_0x4fa511['method']['toUpperCase']())){try{_0x4fa511[_0x8a95('0x6a')]=_0x2485bb['rawBody']?JSON['parse'](_0x2485bb['rawBody']):{};}catch(_0x22da9e){logger[_0x8a95('0x2a')](_0x8a95('0x6b'),_0x22da9e);}}try{_0x4fa511[_0x8a95('0x6c')]=_0x2485bb[_0x8a95('0xb')]?JSON[_0x8a95('0x6d')](_0x2485bb[_0x8a95('0xb')]):{};}catch(_0x201fb1){logger['error'](_0x8a95('0x6e'),_0x201fb1);}if(_0x2485bb[_0x8a95('0x6f')]){try{var _0x403d8e=require(_0x2485bb['computedVariables'])[_0x8a95('0x70')](this,_0x4fa511);_0x4fa511[_0x8a95('0x71')]=Mustache[_0x8a95('0x72')](_0x2485bb[_0x8a95('0x64')],_0x403d8e,{},['$$','$$']);if(_0x4fa511['headers']){_0x4fa511[_0x8a95('0x6c')]=JSON['parse'](Mustache[_0x8a95('0x72')](JSON[_0x8a95('0x73')](_0x4fa511[_0x8a95('0x6c')]),_0x403d8e,{},['$$','$$']));}if(_0x4fa511[_0x8a95('0x6a')]){_0x4fa511['body']=JSON[_0x8a95('0x6d')](Mustache['render'](JSON['stringify'](_0x4fa511['body']),_0x403d8e,{},['$$','$$']));}}catch(_0x297fb2){logger[_0x8a95('0x2a')](_0x8a95('0x74'),_0x297fb2);}}rp(_0x4fa511)[_0x8a95('0x16')](function(_0x511fd2){var _0x284af6={'statusCode':_0x511fd2[_0x8a95('0x75')]||0xc8,'statusMessage':_0x511fd2[_0x8a95('0x76')]||'OK','headers':_0x511fd2[_0x8a95('0x6c')]||{},'body':_0x511fd2[_0x8a95('0x6a')]||{}};_0x244ac9(null,_0x284af6);})[_0x8a95('0x13')](function(_0x511dc5){var _0x192388={'statusCode':_0x511dc5['statusCode']||0x1f4,'statusMessage':_0x511dc5[_0x8a95('0x77')]||_0x8a95('0x78'),'headers':_0x511dc5['options'][_0x8a95('0x6c')]||{},'body':_0x511dc5[_0x8a95('0x79')][_0x8a95('0x6a')]||{}};_0x244ac9(null,_0x192388);});};AGIVertices['prototype']['googleDialogflow']=function(_0x201d40,_0x1162c5){scripts['googleDialogflow'](this[_0x8a95('0xf')][_0x8a95('0x42')],_0x201d40[_0x8a95('0x7a')],_0x201d40['text'],_0x201d40[_0x8a95('0x7b')]||'en')[_0x8a95('0x16')](function(_0x4e25fa){_0x1162c5(null,_0x4e25fa);})[_0x8a95('0x13')](function(_0x14e2ca){_0x1162c5(_0x14e2ca);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x7c')]=function(_0x57aaa0,_0x32534c){scripts[_0x8a95('0x7c')](this[_0x8a95('0xf')][_0x8a95('0x42')],_0x57aaa0[_0x8a95('0x7d')],_0x57aaa0[_0x8a95('0x7e')],_0x57aaa0[_0x8a95('0x7f')],_0x57aaa0[_0x8a95('0x5e')],_0x57aaa0['dialogflowV2_language']||'en')[_0x8a95('0x16')](function(_0x48ba2e){_0x32534c(null,_0x48ba2e);})['catch'](function(_0x1fa486){_0x32534c(_0x1fa486);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x80')]=function(_0x324001,_0xf988aa){scripts['sestekNDA'](this[_0x8a95('0xf')],_0x324001)[_0x8a95('0x16')](function(_0x24f059){_0xf988aa(null,_0x24f059);})[_0x8a95('0x13')](function(_0x22d413){_0xf988aa(_0x22d413);});};AGIVertices['prototype']['ispeechTTS']=function(_0x392332,_0x1fe5b2){scripts[_0x8a95('0x81')](_0x392332[_0x8a95('0x7a')],_0x392332[_0x8a95('0x5e')],_0x392332['ispeech_tts_language']||_0x8a95('0x82'),_0x392332[_0x8a95('0x83')])['then'](function(_0x5a34a4){_0x1fe5b2(null,_0x5a34a4);})[_0x8a95('0x13')](function(_0x19976d){_0x1fe5b2(_0x19976d);});};AGIVertices['prototype'][_0x8a95('0x84')]=function(_0xc928e0,_0x3459f9,_0xc53840){scripts[_0x8a95('0x84')](_0x3459f9,_0xc928e0[_0x8a95('0x7a')],_0xc928e0['ispeech_asr_language']||_0x8a95('0x82'),this[_0x8a95('0x85')](_0xc928e0[_0x8a95('0x86')])?_0xc928e0[_0x8a95('0x86')]:undefined)['then'](function(_0x177ba6){_0xc53840(null,_0x177ba6);})[_0x8a95('0x13')](function(_0x503d4d){_0xc53840(_0x503d4d);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x87')]=function(_0x5ecf4f,_0x6694be){scripts[_0x8a95('0x87')](_0x5ecf4f[_0x8a95('0x88')],_0x5ecf4f[_0x8a95('0x89')],_0x5ecf4f[_0x8a95('0x8a')],_0x5ecf4f['aws_polly_voice']||'Amy',_0x5ecf4f[_0x8a95('0x5e')],_0x5ecf4f['aws_text_type']||_0x8a95('0x5e'))[_0x8a95('0x16')](function(_0xa661a){_0x6694be(null,_0xa661a);})[_0x8a95('0x13')](function(_0x351d51){_0x6694be(_0x351d51);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x8b')]=function(_0x184897,_0xb13730){scripts[_0x8a95('0x8b')](this[_0x8a95('0xf')][_0x8a95('0x42')],_0x184897[_0x8a95('0x88')],_0x184897['aws_secret_access_key'],_0x184897[_0x8a95('0x8c')],_0x184897[_0x8a95('0x5e')],_0x184897[_0x8a95('0x8d')])[_0x8a95('0x16')](function(_0x2965ff){_0xb13730(null,_0x2965ff);})[_0x8a95('0x13')](function(_0x1dcdc2){_0xb13730(_0x1dcdc2);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x8e')]=function(_0x8b8a21,_0x1b897b,_0x514f1d){scripts[_0x8a95('0x8e')](_0x1b897b,_0x8b8a21[_0x8a95('0x7a')],_0x8b8a21[_0x8a95('0x8f')]||'en-US')[_0x8a95('0x16')](function(_0x34f796){_0x514f1d(null,_0x34f796);})[_0x8a95('0x13')](function(_0x583d84){_0x514f1d(_0x583d84);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x90')]=function(_0x1fdce3,_0x19005a,_0x16d3b9){scripts[_0x8a95('0x90')](_0x19005a,_0x1fdce3[_0x8a95('0x91')],_0x1fdce3[_0x8a95('0x92')],_0x1fdce3['uri'])[_0x8a95('0x16')](function(_0x5086b0){_0x16d3b9(null,_0x5086b0);})[_0x8a95('0x13')](function(_0x55ad3a){_0x16d3b9(_0x55ad3a);});};AGIVertices[_0x8a95('0x1a')]['clear']=function(_0x1bd5b4){var _0x238703=_[_0x8a95('0x93')](verticesWithRetry,_0x1bd5b4[_0x8a95('0x38')])?_0x1bd5b4:_['clone'](_0x1bd5b4);for(var _0x728c42 in _0x238703){if(_0x238703[_0x8a95('0x94')](_0x728c42)){if(_0x238703[_0x728c42]&&_[_0x8a95('0x95')](_0x238703[_0x728c42])){if(_['includes'](recursiveMapAttributes,_0x728c42)){_0x238703[_0x728c42]=this[_0x8a95('0x96')](_0x238703[_0x728c42]);}else{_0x238703[_0x728c42]=this['replaceAllVariables'](_0x238703[_0x728c42]);}}}}return _0x238703;};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x97')]=function(_0xbf4c82){for(var _0x2a58d7 in _0xbf4c82){if(_0xbf4c82['hasOwnProperty'](_0x2a58d7)){if(_[_0x8a95('0x98')](_0xbf4c82[_0x2a58d7])){this[_0x8a95('0x97')](_0xbf4c82[_0x2a58d7]);}else if(_['isArray'](_0xbf4c82[_0x2a58d7])){for(var _0x15f022=0x0;_0x15f022<_0xbf4c82[_0x2a58d7][_0x8a95('0x99')];_0x15f022++){this[_0x8a95('0x97')](_0xbf4c82[_0x2a58d7][_0x15f022]);}}else if(_[_0x8a95('0x95')](_0xbf4c82[_0x2a58d7])){_0xbf4c82[_0x2a58d7]=this[_0x8a95('0x9a')](_0xbf4c82[_0x2a58d7]);}}}};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x9b')]=function(_0x35d44a,_0x66af1){for(var _0x118321 in _0x35d44a){if(_0x35d44a[_0x8a95('0x94')](_0x118321)){if(_[_0x8a95('0x98')](_0x35d44a[_0x118321])){if(!_[_0x8a95('0x44')](_0x35d44a[_0x118321])){this['saveRestApiResult'](_0x35d44a[_0x118321],util[_0x8a95('0x55')](_0x8a95('0x9c'),_0x66af1,_0x118321));}}else if(_[_0x8a95('0x9d')](_0x35d44a[_0x118321])){for(var _0xffcbb9=0x0;_0xffcbb9<_0x35d44a[_0x118321][_0x8a95('0x99')];_0xffcbb9++){this[_0x8a95('0x9b')](_0x35d44a[_0x118321][_0xffcbb9],util[_0x8a95('0x55')](_0x8a95('0x9c'),_0x66af1,_0x118321+'['+_0xffcbb9+']'));}}else{if(!_[_0x8a95('0x45')](_0x35d44a[_0x118321])){this[_0x8a95('0xf')][_0x8a95('0x9e')](util[_0x8a95('0x55')](_0x8a95('0x9c'),_0x66af1,_0x118321),_0x35d44a[_0x118321]);}}}}};AGIVertices[_0x8a95('0x1a')]['replaceObjectAllVariables']=function(_0x3aa0d8){try{var _0x435021=JSON['parse'](_0x3aa0d8);this[_0x8a95('0x97')](_0x435021);return JSON[_0x8a95('0x73')](_0x435021);}catch(_0x410bb1){return this[_0x8a95('0x9a')](_0x3aa0d8);}};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x9a')]=function(_0x2eaf8b){var _0x182df9=_0x2eaf8b[_0x8a95('0x9f')]('{');for(var _0x5327a1=0x1;_0x5327a1<_0x182df9[_0x8a95('0x99')];_0x5327a1+=0x1){var _0x169a83=_0x182df9[_0x5327a1][_0x8a95('0x9f')]('}');if(_0x169a83['length']>0x1){_0x2eaf8b=_0x2eaf8b['replaceAll']('{'+_0x169a83[0x0]+'}',this[_0x8a95('0xf')]['getVariable'](_0x169a83[0x0])[_0x8a95('0xa0')]||_0x169a83[0x0]);}}if(_0x182df9['length']===0x1){return _0x2eaf8b[_0x8a95('0x4b')]();}return this[_0x8a95('0x9a')](_0x2eaf8b);};AGIVertices[_0x8a95('0x1a')][_0x8a95('0xa1')]=function(_0x5f55b0,_0x2ff2e4){var _0x4cbb96=this[_0x8a95('0xf')][_0x8a95('0x12')](_0x5f55b0);if(_0x4cbb96[_0x8a95('0xa2')]===-0x1){return _0x4cbb96;}logger[_0x8a95('0x2c')](util['format'](_0x8a95('0xa3'),_0x2ff2e4,_0x4cbb96[_0x8a95('0xa0')]));return this[_0x8a95('0xf')][_0x8a95('0x9e')](_0x2ff2e4,_0x4cbb96[_0x8a95('0xa0')]);};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x85')]=function(_0x5b9f63){return _0x5b9f63&&_0x5b9f63!=='0'&&_0x5b9f63!=='-1'&&_0x5b9f63!=='';};AGIVertices['prototype'][_0x8a95('0xa4')]=function(_0x4c2ed9){this[_0x8a95('0x36')]['sync'](this,_0x4c2ed9,'-');_0x4c2ed9[_0x8a95('0xa5')]=_0x4c2ed9['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x8a95('0x1a')][_0x8a95('0xa6')]=function(_0x1754c7){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0xa7'),_0x1754c7['label']));if(!this[_0x8a95('0x85')](_0x1754c7[_0x8a95('0x5e')])){return this['channel'][_0x8a95('0xa8')](_0x8a95('0xa9'));}var _0x3cb114='\x22'+_0x1754c7[_0x8a95('0x5e')]+'\x22';if(this[_0x8a95('0x85')](_0x1754c7[_0x8a95('0x79')])){_0x3cb114+=','+_0x1754c7['options'];}var _0x45e646=this['channel']['exec'](_0x8a95('0xaa'),_0x3cb114);if(_0x45e646['result']===-0x1){return _0x45e646;}return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3cb114));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0xab')]=function(_0x1f9428){logger['info'](util['format'](_0x8a95('0xac'),_0x1f9428[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x1f9428[_0x8a95('0xad')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0xae'));}var _0x110d3a=_0x1f9428[_0x8a95('0xad')];if(this['isConfigured'](_0x1f9428[_0x8a95('0x79')])){_0x110d3a+=','+_0x1f9428[_0x8a95('0x79')];}var _0x8d7ff3=this[_0x8a95('0xf')][_0x8a95('0x59')](_0x8a95('0xaf'),_0x110d3a);if(_0x8d7ff3[_0x8a95('0xa2')]===-0x1){return _0x8d7ff3;}var _0x1f9a3d=this['getAndSetVariable'](_0x8a95('0xb0'),'MRCP_RECOG_CONFIDENCE');if(_0x1f9a3d[_0x8a95('0xa2')]===-0x1){return _0x1f9a3d;}var _0x5b31cc=this[_0x8a95('0xa1')](_0x8a95('0xb1'),_0x8a95('0xb2'));if(_0x5b31cc['result']===-0x1){return _0x5b31cc;}var _0x1b4c42=this[_0x8a95('0xa1')](_0x8a95('0xb3'),_0x8a95('0xb4'));if(_0x1b4c42[_0x8a95('0xa2')]===-0x1){return _0x1b4c42;}return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0xb5'),_0x110d3a));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0xb6')]=function(_0x12a59b){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0xb7'),_0x12a59b[_0x8a95('0x37')]));return this[_0x8a95('0xf')]['agi']([_0x12a59b['command'],_0x12a59b[_0x8a95('0xb8')]]);};AGIVertices[_0x8a95('0x1a')][_0x8a95('0xb9')]=function(_0x540fc8){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x540fc8[_0x8a95('0x37')]));if(this[_0x8a95('0x85')](_0x540fc8[_0x8a95('0x66')])){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0xba'),_0x540fc8[_0x8a95('0x66')]));var _0x2e32f9=this[_0x8a95('0xf')][_0x8a95('0xbb')](_0x540fc8[_0x8a95('0x66')]);if(_0x2e32f9[_0x8a95('0xa2')]===-0x1){return _0x2e32f9;}}return this[_0x8a95('0xf')]['answer']();};AGIVertices['prototype'][_0x8a95('0x4a')]=function(_0xf46069){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0xf46069[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0xf46069['list_id'])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0xf46069,'no\x20list\x20selected');}_0xf46069[_0x8a95('0x49')]=moment();if(this[_0x8a95('0x85')](_0xf46069['delay'])){_0xf46069[_0x8a95('0x49')]=moment()[_0x8a95('0xbc')](_0xf46069[_0x8a95('0xbd')],_0x8a95('0xbe'));}if(!this[_0x8a95('0x85')](_0xf46069[_0x8a95('0x4c')])){_0xf46069[_0x8a95('0x4c')]=0x2;}this[_0x8a95('0x43')][_0x8a95('0x70')](this,_0xf46069);return this['channel'][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0xbf'),_0xf46069['phone'],_0xf46069[_0x8a95('0x48')],_0xf46069[_0x8a95('0x49')]));};AGIVertices[_0x8a95('0x1a')]['custom_app']=function(_0xb84467){logger['info'](util[_0x8a95('0x55')](_0x8a95('0xc0'),_0xb84467[_0x8a95('0x37')]));var _0x5a5c27=this[_0x8a95('0xf')]['exec'](_0xb84467['application'],_0xb84467['options']);if(_0x5a5c27['result']===-0x1){return _0x5a5c27;}return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0xc1'),_0xb84467[_0x8a95('0xc2')],_0xb84467[_0x8a95('0x79')]));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0xc3')]=function(_0x126075){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0xc4'),_0x126075[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x126075[_0x8a95('0x5e')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')]('no\x20text\x20configured');}var _0x37588d='\x22'+_0x126075[_0x8a95('0x5e')]+'\x22';if(this['isConfigured'](_0x126075[_0x8a95('0x79')])){_0x37588d+=','+_0x126075[_0x8a95('0x79')];}var _0x27b045=this[_0x8a95('0xf')][_0x8a95('0x59')](_0x8a95('0xaa'),_0x37588d);if(_0x27b045['result']===-0x1){return _0x27b045;}return this['channel'][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0xc5'),_0x37588d));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0xc6')]=function(_0x5b65d5){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0xc7'),_0x5b65d5[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x5b65d5[_0x8a95('0x5e')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0xa9'));}var _0x5d2ab0='\x22'+_0x5b65d5[_0x8a95('0x5e')]+'\x22';if(this['isConfigured'](_0x5b65d5[_0x8a95('0x79')])){_0x5d2ab0+=','+_0x5b65d5[_0x8a95('0x79')];}var _0x26fdc2=this[_0x8a95('0xf')][_0x8a95('0x59')]('MRCPSynth',_0x5d2ab0);if(_0x26fdc2[_0x8a95('0xa2')]===-0x1){return _0x26fdc2;}return this[_0x8a95('0xf')][_0x8a95('0xa8')](util['format'](_0x8a95('0xc5'),_0x5d2ab0));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0xc8')]=function(_0x4b3c00){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0xc9'),_0x4b3c00['label']));if(!this[_0x8a95('0x85')](_0x4b3c00['grammar'])){return this[_0x8a95('0xf')]['noop'](_0x8a95('0xae'));}var _0x2c03a0=_0x4b3c00[_0x8a95('0xad')];if(this[_0x8a95('0x85')](_0x4b3c00[_0x8a95('0x79')])){_0x2c03a0+=','+_0x4b3c00[_0x8a95('0x79')];}var _0x456da0=this['channel'][_0x8a95('0x59')](_0x8a95('0xaf'),_0x2c03a0);if(_0x456da0[_0x8a95('0xa2')]===-0x1){return _0x456da0;}var _0x4eaf0b=this[_0x8a95('0xa1')](_0x8a95('0xb0'),_0x8a95('0xca'));if(_0x4eaf0b[_0x8a95('0xa2')]===-0x1){return _0x4eaf0b;}var _0x24e1cd=this[_0x8a95('0xa1')](_0x8a95('0xb1'),_0x8a95('0xcb'));if(_0x24e1cd[_0x8a95('0xa2')]===-0x1){return _0x24e1cd;}var _0x49a4c5=this[_0x8a95('0xa1')]('RECOG_INSTANCE()',_0x8a95('0xcc'));if(_0x49a4c5[_0x8a95('0xa2')]===-0x1){return _0x49a4c5;}return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0xb5'),_0x2c03a0));};AGIVertices[_0x8a95('0x1a')]['sestekasr']=function(_0x2df116){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x2df116[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x2df116[_0x8a95('0xad')])){return this['channel'][_0x8a95('0xa8')](_0x8a95('0xae'));}var _0x579813=_0x2df116['grammar'];if(this[_0x8a95('0x85')](_0x2df116[_0x8a95('0x79')])){_0x579813+=','+_0x2df116[_0x8a95('0x79')];}var _0x3e313f=this['channel'][_0x8a95('0x59')](_0x8a95('0xaf'),_0x579813);if(_0x3e313f[_0x8a95('0xa2')]===-0x1){return _0x3e313f;}var _0x179811=this[_0x8a95('0xa1')](_0x8a95('0xb0'),_0x8a95('0xcd'));if(_0x179811[_0x8a95('0xa2')]===-0x1){return _0x179811;}var _0x200204=this[_0x8a95('0xa1')]('RECOG_INPUT()',_0x8a95('0xce'));if(_0x200204[_0x8a95('0xa2')]===-0x1){return _0x200204;}var _0x1af308=this[_0x8a95('0xa1')](_0x8a95('0xb3'),_0x8a95('0xcf'));if(_0x1af308[_0x8a95('0xa2')]===-0x1){return _0x1af308;}return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')]('Executed\x20command\x20MRCPRecog\x20%s',_0x579813));};AGIVertices[_0x8a95('0x1a')]['database']=function(_0x144c53){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0xd0'),_0x144c53[_0x8a95('0x37')]));if(!this['isConfigured'](_0x144c53[_0x8a95('0xd1')])){return this[_0x8a95('0xf')]['error'](_0x144c53,'no\x20database\x20selected');}var _0x2eb25a=this[_0x8a95('0x1b')][_0x8a95('0x70')](this,_0x144c53[_0x8a95('0xd1')]);if(!_0x2eb25a){return this[_0x8a95('0xf')]['error'](_0x144c53,_0x8a95('0xd2'));}if(!this['isConfigured'](_0x144c53[_0x8a95('0x2e')])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x144c53,_0x8a95('0xd3'));}var _0x308078=_0x144c53[_0x8a95('0x2e')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')]('query:\x20%s',_0x308078));var _0x4bb9ae=this[_0x8a95('0xd4')][_0x8a95('0x70')](this,_0x2eb25a,_0x308078);this[_0x8a95('0x36')][_0x8a95('0x70')](this,_0x144c53,_0x308078);if(!this[_0x8a95('0x85')](_0x144c53[_0x8a95('0xd5')])){return this['channel'][_0x8a95('0xa8')](_0x8a95('0xd6'));}var _0x500ccf=this[_0x8a95('0x12')][_0x8a95('0x70')](this,_0x144c53[_0x8a95('0xd5')]);if(!_0x500ccf){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x144c53,_0x8a95('0xd7'));}var _0x590c57=this;_0x4bb9ae[_0x8a95('0xd8')](function(_0x2c191e,_0x4fce46){Object[_0x8a95('0xd9')](_0x2c191e)[_0x8a95('0xd8')](function(_0x40e6e9){_0x590c57[_0x8a95('0xf')][_0x8a95('0x9e')](util[_0x8a95('0x55')](_0x8a95('0xda'),_0x500ccf,_0x4fce46,_0x40e6e9),_0x2c191e[_0x40e6e9]);});});this[_0x8a95('0xf')]['setVariable'](util[_0x8a95('0x55')](_0x8a95('0xdb'),_0x500ccf),_0x4bb9ae[_0x8a95('0x99')]);return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0xdc'),_0x500ccf));};AGIVertices[_0x8a95('0x1a')]['dial']=function(_0x20629f){logger[_0x8a95('0xdd')](util[_0x8a95('0x55')](_0x8a95('0xde'),_0x20629f[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x20629f[_0x8a95('0xdf')])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x20629f,_0x8a95('0xe0'));}var _0x3759ed=this[_0x8a95('0xe1')]['sync'](this,_0x20629f['sip_id']);if(!_0x3759ed){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x20629f,_0x8a95('0xe2'));}var _0x487423=this[_0x8a95('0xf')]['exec'](_0x8a95('0xe3'),[util['format'](_0x8a95('0xe4'),_0x3759ed),_0x20629f[_0x8a95('0x66')],_0x20629f['opts'],_0x20629f[_0x8a95('0x64')]]);if(_0x487423[_0x8a95('0xa2')]===-0x1){return _0x487423;}return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0xe5'),_0x8a95('0xe3')));};AGIVertices['prototype']['dialogflow']=function(_0xb2cd9e){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0xe6'),_0xb2cd9e[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0xb2cd9e[_0x8a95('0x7a')])){return this['channel'][_0x8a95('0xa8')](_0x8a95('0xe7'));}if(!this[_0x8a95('0x85')](_0xb2cd9e[_0x8a95('0x5e')])){return this['channel'][_0x8a95('0xa8')](_0x8a95('0xa9'));}this[_0x8a95('0xf')][_0x8a95('0xe8')]=!![];this['createSquareDetailsReport'](_0xb2cd9e);this[_0x8a95('0xe9')](_0xb2cd9e[_0x8a95('0x5e')],'in','','');this[_0x8a95('0xf')][_0x8a95('0xa8')](util['format']('Trying\x20Dialogflow:\x20%s',_0xb2cd9e[_0x8a95('0x5e')]));var _0x3ec950=this[_0x8a95('0xea')][_0x8a95('0x70')](this,_0xb2cd9e);if(_0x3ec950){for(var _0x8c94c in _0x3ec950){if(_0x3ec950[_0x8a95('0x94')](_0x8c94c)){this[_0x8a95('0xf')][_0x8a95('0x9e')](util['format'](_0x8a95('0xeb'),_0x8c94c['toUpperCase']()),_0x3ec950[_0x8c94c]);}}this[_0x8a95('0xe9')](_0x3ec950[_0x8a95('0xec')],'out',_0x8a95('0xed'),'');return this[_0x8a95('0xf')][_0x8a95('0xa8')](util['format']('Dialogflow\x20Result\x20%s',_0x3ec950['speech']));}return this[_0x8a95('0xf')]['error'](_0xb2cd9e,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x8a95('0x1a')]['dialogflowV2']=function(_0x399eac){logger[_0x8a95('0x2c')](util['format'](_0x8a95('0xee'),_0x399eac[_0x8a95('0x37')]));if(!this['isConfigured'](_0x399eac[_0x8a95('0x7d')])){return this['channel'][_0x8a95('0xa8')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x399eac[_0x8a95('0x7e')])){return this[_0x8a95('0xf')]['noop'](_0x8a95('0xef'));}if(!this['isConfigured'](_0x399eac[_0x8a95('0x7f')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0xf0'));}if(!this[_0x8a95('0x85')](_0x399eac[_0x8a95('0xf1')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0xf2'));}if(!this['isConfigured'](_0x399eac[_0x8a95('0x5e')])){return this['channel'][_0x8a95('0xa8')](_0x8a95('0xa9'));}this['channel']['bot']=!![];this[_0x8a95('0x36')](_0x399eac);this['createSquareMessage'](_0x399eac[_0x8a95('0x5e')],'in','','');this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0xf3'),_0x399eac[_0x8a95('0x5e')]));var _0x4f0485=this[_0x8a95('0x7c')][_0x8a95('0x70')](this,_0x399eac);if(_0x4f0485){for(var _0x46469b in _0x4f0485){if(_0x4f0485['hasOwnProperty'](_0x46469b)){if(_0x46469b!==_0x8a95('0xf4')){this[_0x8a95('0xf')]['setVariable'](util['format'](_0x8a95('0xeb'),_0x46469b['toUpperCase']()),_0x4f0485[_0x46469b]);}}}this[_0x8a95('0xe9')](_0x4f0485[_0x8a95('0xec')],_0x8a95('0xf5'),_0x8a95('0xf6'),_0x4f0485['providerResponse']);return this['channel'][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0xf7'),_0x4f0485[_0x8a95('0xec')]));}return this['channel']['error'](_0x399eac,_0x8a95('0xf8'));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0xf9')]=function(_0xf211a5){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0xfa'),_0xf211a5[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0xf211a5['ndauth_url'])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0xfb'));}if(!this[_0x8a95('0x85')](_0xf211a5[_0x8a95('0xfc')])){return this['channel'][_0x8a95('0xa8')](_0x8a95('0xfd'));}if(!this[_0x8a95('0x85')](_0xf211a5[_0x8a95('0xfe')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')]('no\x20password\x20configured');}if(!this[_0x8a95('0x85')](_0xf211a5[_0x8a95('0xff')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')]('no\x20text\x20configured');}this[_0x8a95('0xf')]['bot']=!![];this[_0x8a95('0x36')](_0xf211a5);this[_0x8a95('0xe9')](_0xf211a5[_0x8a95('0x5e')],'in','','');this[_0x8a95('0xf')]['noop'](util[_0x8a95('0x55')]('Trying\x20SestekNDA:\x20%s',_0xf211a5[_0x8a95('0x5e')]));var _0x3fc641=this[_0x8a95('0x80')]['sync'](this,_0xf211a5);if(_0x3fc641){for(var _0x123840 in _0x3fc641){if(_0x3fc641[_0x8a95('0x94')](_0x123840)){this[_0x8a95('0xf')][_0x8a95('0x9e')](util[_0x8a95('0x55')](_0x8a95('0x100'),_0x123840['toUpperCase']()),_0x3fc641[_0x123840]);}}this[_0x8a95('0xe9')](_0x3fc641[_0x8a95('0xec')],_0x8a95('0xf5'),'sesteknda','');if(_0x3fc641[_0x8a95('0x101')]){this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x102'),_0x3fc641[_0x8a95('0x101')]));var _0xad0294=this[_0x8a95('0xf')][_0x8a95('0x103')](_0x3fc641[_0x8a95('0x101')]);try{fs[_0x8a95('0x104')](_0x3fc641[_0x8a95('0x101')]+_0x8a95('0x105'));}catch(_0x39142e){logger['error'](_0x39142e);}return _0xad0294;}else{return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x106'),_0x3fc641['speech']));}}return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0xf211a5,_0x8a95('0x107'));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x108')]=function(_0x80be49){logger['info'](util[_0x8a95('0x55')](_0x8a95('0x109'),_0x80be49[_0x8a95('0x37')]));return this['channel'][_0x8a95('0xa8')](_0x8a95('0x108'));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x10a')]=function(_0x4b6b59){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x10b'),_0x4b6b59[_0x8a95('0x37')]));var _0x470928='';if(_0x4b6b59[_0x8a95('0x10c')]){if(!this['isConfigured'](_0x4b6b59[_0x8a95('0x10c')])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x4b6b59,_0x8a95('0x10d'));}else{var _0x1540fd=parseInt(_0x4b6b59[_0x8a95('0x10c')],0xa);if(isNaN(_0x1540fd)){_0x470928=_0x4b6b59[_0x8a95('0x10c')];}else{_0x470928=this['getTrunk'][_0x8a95('0x70')](this,_0x4b6b59[_0x8a95('0x10c')]);if(!_0x470928){return this['channel'][_0x8a95('0x2a')](_0x4b6b59,_0x8a95('0x10e'));}}}}else if(_0x4b6b59[_0x8a95('0x10f')]){_0x470928=_0x4b6b59[_0x8a95('0x10f')];}else{return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x4b6b59,_0x8a95('0x10d'));}var _0x1f82db=this[_0x8a95('0xf')][_0x8a95('0x59')]('DIAL',[util[_0x8a95('0x55')](_0x8a95('0x110'),_0x470928,_0x4b6b59['phone']),_0x4b6b59[_0x8a95('0x66')],_0x4b6b59['opts'],_0x4b6b59[_0x8a95('0x64')]]);if(_0x1f82db[_0x8a95('0xa2')]===-0x1){return _0x1f82db;}return this['channel'][_0x8a95('0xa8')](util['format'](_0x8a95('0xe5'),'DIAL'));};AGIVertices[_0x8a95('0x1a')]['finally']=function(_0x209a35){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x111'),_0x209a35['label']));return this['channel'][_0x8a95('0xa8')]('finally');};AGIVertices['prototype'][_0x8a95('0x112')]=function(_0x18c3fb){logger[_0x8a95('0x2c')](util['format'](_0x8a95('0x113'),_0x18c3fb[_0x8a95('0x37')]));if(_0x18c3fb[_0x8a95('0xa5')]===0x0){return this['maxRetry'](_0x18c3fb);}_0x18c3fb['retry']-=0x1;if(!this[_0x8a95('0x85')](_0x18c3fb['file_id'])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x18c3fb,_0x8a95('0x114'));}var _0x4aa0aa=this[_0x8a95('0x115')][_0x8a95('0x70')](this,_0x18c3fb[_0x8a95('0x116')]);if(!_0x4aa0aa){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x18c3fb,_0x8a95('0x117'));}if(!this[_0x8a95('0x85')](_0x18c3fb[_0x8a95('0xd5')])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x8a95('0xd6'));}var _0x5f3d4f=this[_0x8a95('0xf')]['getData'](_0x4aa0aa,_0x18c3fb[_0x8a95('0x118')],_0x18c3fb[_0x8a95('0x119')]);var _0x40aba6=_0x5f3d4f['result']?_0x5f3d4f[_0x8a95('0xa2')][_0x8a95('0x4b')]():'';logger[_0x8a95('0x2c')](_0x8a95('0x11a'),JSON[_0x8a95('0x73')](_0x5f3d4f));if(_0x5f3d4f['result']===-0x1){this[_0x8a95('0x36')]['sync'](this,_0x18c3fb,_0x40aba6);return _0x5f3d4f;}else if(_0x5f3d4f[_0x8a95('0xa0')]===_0x8a95('0x66')){_0x5f3d4f[_0x8a95('0xa2')]=_0x40aba6[_0x8a95('0x99')]>=parseInt(_0x18c3fb[_0x8a95('0x11b')])?'x':'i';}else{_0x5f3d4f[_0x8a95('0xa2')]=_0x40aba6['length']>=parseInt(_0x18c3fb[_0x8a95('0x11b')])&&_0x40aba6[_0x8a95('0x99')]<=parseInt(_0x18c3fb[_0x8a95('0x119')])?'x':'i';}var _0x5e1f0f=this['getVariable'][_0x8a95('0x70')](this,_0x18c3fb[_0x8a95('0xd5')]);if(!_0x5e1f0f){return this['channel'][_0x8a95('0x2a')](_0x18c3fb,_0x8a95('0xd7'));}this[_0x8a95('0xf')][_0x8a95('0x9e')](_0x5e1f0f,_0x40aba6);if(this[_0x8a95('0x85')](_0x18c3fb[_0x8a95('0x11c')])){var _0x555bd5=parseInt(_0x18c3fb['hiddendigitsnum'],0xa);var _0x5ec846=rs[_0x8a95('0x11d')]({'charset':'*','length':_0x555bd5});var _0x5972c1=_0x40aba6[_0x8a95('0x99')];if(_0x5972c1>0x0){if(_0x5972c1>_0x555bd5){this['createSquareDetailsReport']['sync'](this,_0x18c3fb,_0x18c3fb[_0x8a95('0x11e')]===_0x8a95('0x11f')?_0x5ec846+_0x40aba6[_0x8a95('0x120')](_0x555bd5):_0x40aba6[_0x8a95('0x120')](0x0,_0x5972c1-_0x555bd5)+_0x5ec846);}else{this[_0x8a95('0x36')][_0x8a95('0x70')](this,_0x18c3fb,rs[_0x8a95('0x11d')]({'charset':'*','length':_0x5972c1}));}}else{this['createSquareDetailsReport']['sync'](this,_0x18c3fb,'');}}else{this['createSquareDetailsReport'][_0x8a95('0x70')](this,_0x18c3fb,_0x40aba6);}return _0x5f3d4f;};AGIVertices[_0x8a95('0x1a')][_0x8a95('0xe')]=function(_0x2d74fe){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x121'),_0x2d74fe['label']));return this['getdigits'](_0x2d74fe);};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x122')]=function(_0x4e2524){logger[_0x8a95('0x2c')](util['format'](_0x8a95('0x123'),_0x4e2524[_0x8a95('0x37')]));this[_0x8a95('0x36')][_0x8a95('0x70')](this,_0x4e2524,_0x4e2524[_0x8a95('0x124')]);return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x125'),_0x4e2524['goalname']));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x126')]=function(_0x2db921){logger['info'](util[_0x8a95('0x55')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x2db921['label']));if(!this[_0x8a95('0x85')](_0x2db921['aws_access_key_id'])||!this[_0x8a95('0x85')](_0x2db921[_0x8a95('0x89')])){return this['channel'][_0x8a95('0xa8')](_0x8a95('0x127'));}if(!this[_0x8a95('0x85')](_0x2db921[_0x8a95('0x5e')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0xa9'));}this[_0x8a95('0xf')][_0x8a95('0xa8')](util['format']('Trying\x20aws\x20Polly\x20%s',_0x2db921[_0x8a95('0x5e')]));var _0x4c0f28=this[_0x8a95('0x87')][_0x8a95('0x70')](this,_0x2db921);if(_0x4c0f28){this['channel']['noop'](util['format'](_0x8a95('0x128'),_0x4c0f28));var _0x37af74=this[_0x8a95('0xf')]['streamFile'](_0x4c0f28);try{fs['unlink'](_0x4c0f28+_0x8a95('0x105'));}catch(_0x23d6dc){logger[_0x8a95('0x2a')](_0x23d6dc);}return _0x37af74;}return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x2db921,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x129')]=function(_0x5dcaa0){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x12a'),_0x5dcaa0[_0x8a95('0x37')]));if(!this['isConfigured'](_0x5dcaa0[_0x8a95('0x88')])||!this['isConfigured'](_0x5dcaa0['aws_secret_access_key'])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0x127'));}if(!this['isConfigured'](_0x5dcaa0[_0x8a95('0x8d')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0x12b'));}if(!this[_0x8a95('0x85')](_0x5dcaa0['text'])){return this[_0x8a95('0xf')][_0x8a95('0xa8')]('no\x20text\x20configured');}this['channel'][_0x8a95('0xe8')]=!![];this['createSquareDetailsReport'](_0x5dcaa0);this[_0x8a95('0xe9')](_0x5dcaa0[_0x8a95('0x5e')],'in','','');this['channel'][_0x8a95('0xa8')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x5dcaa0[_0x8a95('0x5e')]));var _0x3cbe41=this['awsLex'][_0x8a95('0x70')](this,_0x5dcaa0);if(_0x3cbe41){for(var _0x5dbda4 in _0x3cbe41){if(_0x3cbe41[_0x8a95('0x94')](_0x5dbda4)&&_['isString'](_0x3cbe41[_0x5dbda4])){this[_0x8a95('0xf')][_0x8a95('0x9e')](util['format'](_0x8a95('0x12c'),_0x5dbda4['toUpperCase']()),_0x3cbe41[_0x5dbda4]);}}if(_[_0x8a95('0x45')](_0x3cbe41['message'])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0x12d'));}else{this[_0x8a95('0xe9')](_0x3cbe41[_0x8a95('0x77')],_0x8a95('0xf5'),_0x8a95('0x12e'),'');return this[_0x8a95('0xf')]['noop'](util[_0x8a95('0x55')](_0x8a95('0x12f'),_0x3cbe41[_0x8a95('0x77')]));}}return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x5dcaa0,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x130')]=function(_0x5218ab){logger['info'](util[_0x8a95('0x55')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x5218ab[_0x8a95('0x37')],_0x5218ab[_0x8a95('0x66')]));if(!this[_0x8a95('0x85')](_0x5218ab[_0x8a95('0x7a')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0xe7'));}var _0x13ceaa='wav';var _0x257e35=util[_0x8a95('0x55')](_0x8a95('0x131'),FILES_PATH,rs[_0x8a95('0x11d')](0x4));var _0x54d4c9=util[_0x8a95('0x55')]('%s.%s',_0x257e35,_0x13ceaa);var _0xa74ccb=!![];if(_0x5218ab[_0x8a95('0x132')]===_0x8a95('0x133')){_0xa74ccb=![];}var _0x4d9c38=this['channel'][_0x8a95('0x134')](_0x257e35,_0x13ceaa,_0x5218ab['intKey'],_0x5218ab[_0x8a95('0x66')],undefined,_0xa74ccb);if(_0x4d9c38['result']!==-0x1){this[_0x8a95('0xf')]['noop'](util[_0x8a95('0x55')](_0x8a95('0x135'),_0x54d4c9));var _0x243940=this[_0x8a95('0x8e')][_0x8a95('0x70')](this,_0x5218ab,_0x54d4c9);if(_0x243940){for(var _0x5bed9d in _0x243940){if(_0x243940[_0x8a95('0x94')](_0x5bed9d)){this[_0x8a95('0xf')]['setVariable'](util[_0x8a95('0x55')](_0x8a95('0x136'),_0x5bed9d[_0x8a95('0x137')]()),_0x243940[_0x5bed9d]);}}return this[_0x8a95('0xf')]['noop'](util[_0x8a95('0x55')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x243940)));}}return _0x4d9c38;};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x138')]=function(_0x5b7d61){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x139'),_0x5b7d61[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x5b7d61[_0x8a95('0x91')])){return this[_0x8a95('0xf')]['noop']('no\x20appid\x20configured');}if(!this[_0x8a95('0x85')](_0x5b7d61[_0x8a95('0x92')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')]('no\x20appsecret\x20configured');}var _0x2e56bd=_0x8a95('0x13a');var _0x325cbe=util[_0x8a95('0x55')](_0x8a95('0x131'),FILES_PATH,rs['generate'](0x4));var _0x3ea677=util[_0x8a95('0x55')](_0x8a95('0x9c'),_0x325cbe,_0x2e56bd);var _0x10fd35=!![];if(_0x5b7d61[_0x8a95('0x132')]===_0x8a95('0x133')){_0x10fd35=![];}var _0x4d08c9=this[_0x8a95('0xf')][_0x8a95('0x134')](_0x325cbe,_0x2e56bd,_0x5b7d61[_0x8a95('0x13b')],_0x5b7d61[_0x8a95('0x66')],undefined,_0x10fd35);if(_0x4d08c9[_0x8a95('0xa2')]!==-0x1){this[_0x8a95('0xf')][_0x8a95('0xa8')](util['format']('tilde\x20%s\x20file\x20created',_0x3ea677));var _0x3662e1=this[_0x8a95('0x90')][_0x8a95('0x70')](this,_0x5b7d61,_0x3ea677);if(_0x3662e1){for(var _0x4347df in _0x3662e1){if(_0x3662e1[_0x8a95('0x94')](_0x4347df)){this['channel']['setVariable'](util[_0x8a95('0x55')]('TILDE_ASR_%s',_0x4347df[_0x8a95('0x137')]()),_0x3662e1[_0x4347df]);}}return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')]('TildeASR\x20Result\x20%s',JSON[_0x8a95('0x73')](_0x3662e1)));}}return _0x4d08c9;};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x13c')]=function(_0x360770){logger['info'](util['format'](_0x8a95('0x13d'),_0x360770[_0x8a95('0x37')]));return this['channel'][_0x8a95('0x13e')](_0x360770[_0x8a95('0x3c')],_0x360770[_0x8a95('0x3d')],_0x360770[_0x8a95('0x3e')]);};AGIVertices['prototype'][_0x8a95('0x13f')]=function(_0x3e2906){logger['info'](util['format'](_0x8a95('0x140'),_0x3e2906[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x3e2906[_0x8a95('0x141')])){return this['channel'][_0x8a95('0x2a')](_0x3e2906,_0x8a95('0x142'));}try{var _0x33ab2e=eval(_0x3e2906[_0x8a95('0x141')])?'true':_0x8a95('0x143');this[_0x8a95('0xf')]['noop'](util[_0x8a95('0x55')](_0x8a95('0x144'),_0x3e2906[_0x8a95('0x141')],_0x33ab2e));return{'code':0xc8,'result':_0x33ab2e};}catch(_0x13a1bd){return{'code':0xc8,'result':_0x8a95('0x143')};}};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x145')]=function(_0x57c504){logger['info'](util[_0x8a95('0x55')](_0x8a95('0x146'),_0x57c504[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x57c504['interval_id'])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x57c504,'no\x20interval\x20configured');}var _0x441be2=this['getIntervals']['sync'](this,_0x57c504['interval_id']);if(!_0x441be2){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x57c504,'no\x20intervals\x20found');}for(var _0x460e5b=0x0;_0x460e5b<_0x441be2[_0x8a95('0x99')];_0x460e5b+=0x1){var _0x476256=this[_0x8a95('0xf')]['getVariable'](util[_0x8a95('0x55')](_0x8a95('0x147'),_0x441be2[_0x460e5b]));if(_0x476256['result']===-0x1){return _0x476256;}logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x148'),_0x441be2[_0x460e5b],_0x476256['extra']));if(_0x476256[_0x8a95('0xa0')]===_0x8a95('0x149')){logger['info'](util[_0x8a95('0x55')](_0x8a95('0x148'),_0x441be2[_0x460e5b],_0x8a95('0x149')));this[_0x8a95('0xf')]['noop'](util[_0x8a95('0x55')](_0x8a95('0x148'),_0x441be2[_0x460e5b],'true'));return{'code':0xc8,'result':_0x8a95('0x149')};}else{logger[_0x8a95('0x2c')](util[_0x8a95('0x55')]('IFTIME\x20%s\x20%s',_0x441be2[_0x460e5b],_0x8a95('0x143')));this['channel'][_0x8a95('0xa8')](util['format'](_0x8a95('0x148'),_0x441be2[_0x460e5b],'false'));}}return{'code':0xc8,'result':_0x8a95('0x143')};};AGIVertices['prototype'][_0x8a95('0x14a')]=function(_0x445752){logger[_0x8a95('0x2c')](util['format'](_0x8a95('0x14b'),_0x445752[_0x8a95('0x37')]));return this[_0x8a95('0xf')][_0x8a95('0x14a')]();};AGIVertices['prototype']['ispeechasr']=function(_0x1ad172){logger[_0x8a95('0x2c')](util['format'](_0x8a95('0x14c'),_0x1ad172[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x1ad172['key'])){return this[_0x8a95('0xf')]['noop'](_0x8a95('0xe7'));}var _0x4d5f9e=_0x8a95('0x13a');var _0x1cb70b=util[_0x8a95('0x55')]('%s/recordings/%s',FILES_PATH,rs[_0x8a95('0x11d')](0x4));var _0x567470=util[_0x8a95('0x55')]('%s.%s',_0x1cb70b,_0x4d5f9e);var _0x2bb0a6=!![];if(_0x1ad172[_0x8a95('0x132')]===_0x8a95('0x133')){_0x2bb0a6=![];}var _0x24ed61=this[_0x8a95('0xf')]['recordFile'](_0x1cb70b,_0x4d5f9e,_0x1ad172[_0x8a95('0x13b')],_0x1ad172[_0x8a95('0x66')],undefined,_0x2bb0a6);if(_0x24ed61[_0x8a95('0xa2')]!==-0x1){this['channel']['noop'](util[_0x8a95('0x55')]('ispeech\x20%s\x20file\x20created',_0x567470));var _0x53ceb2=this['ispeechASR'][_0x8a95('0x70')](this,_0x1ad172,_0x567470);if(_0x53ceb2){for(var _0x48dbb8 in _0x53ceb2){if(_0x53ceb2[_0x8a95('0x94')](_0x48dbb8)){this[_0x8a95('0xf')]['setVariable'](util[_0x8a95('0x55')](_0x8a95('0x14d'),_0x48dbb8[_0x8a95('0x137')]()),_0x53ceb2[_0x48dbb8]);}}return this[_0x8a95('0xf')]['noop'](util['format'](_0x8a95('0x14e'),JSON[_0x8a95('0x73')](_0x53ceb2)));}}return _0x24ed61;};AGIVertices[_0x8a95('0x1a')]['ispeechtts']=function(_0x55b7e1){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x14f'),_0x55b7e1[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x55b7e1[_0x8a95('0x7a')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0xe7'));}if(!this[_0x8a95('0x85')](_0x55b7e1[_0x8a95('0x5e')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0xa9'));}this[_0x8a95('0xf')]['noop'](util['format'](_0x8a95('0x150'),_0x55b7e1[_0x8a95('0x5e')]));var _0x41e967=this[_0x8a95('0x81')][_0x8a95('0x70')](this,_0x55b7e1);if(_0x41e967){this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x151'),_0x41e967));var _0x5e61be=this[_0x8a95('0xf')][_0x8a95('0x103')](_0x41e967,_0x55b7e1[_0x8a95('0x13b')]);try{fs['unlink'](_0x41e967+'.wav');}catch(_0x55e5f9){logger['error'](_0x55e5f9);}return _0x5e61be;}return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x55b7e1,_0x8a95('0x152'));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x153')]=function(_0x3c2307){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x3c2307[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x3c2307[_0x8a95('0x154')])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x3c2307,_0x8a95('0x155'));}logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x156'),this[_0x8a95('0xf')]['callerid'],_0x3c2307[_0x8a95('0x154')]));var _0x390959=this[_0x8a95('0x53')][_0x8a95('0x70')](this,_0x3c2307[_0x8a95('0x154')]);if(_0x390959){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x157'),this[_0x8a95('0xf')][_0x8a95('0x39')],_0x3c2307[_0x8a95('0x154')]));this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8a95('0xf')][_0x8a95('0x39')],_0x3c2307[_0x8a95('0x154')]));return{'code':0xc8,'result':_0x8a95('0x158')};}else{logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x159'),this[_0x8a95('0xf')][_0x8a95('0x39')],_0x3c2307['findBy']));this['channel'][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x159'),this[_0x8a95('0xf')]['callerid'],_0x3c2307[_0x8a95('0x154')]));return{'code':0xc8,'result':_0x8a95('0x15a')};}};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x15b')]=function(_0xc9c6fa){logger['info'](util[_0x8a95('0x55')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0xc9c6fa['label']));if(!this[_0x8a95('0x85')](_0xc9c6fa[_0x8a95('0x154')])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0xc9c6fa,_0x8a95('0x155'));}logger['info'](util['format'](_0x8a95('0x156'),this[_0x8a95('0xf')][_0x8a95('0x39')],_0xc9c6fa[_0x8a95('0x154')]));var _0x418589=this[_0x8a95('0x52')][_0x8a95('0x70')](this,_0xc9c6fa['findBy']);if(_0x418589){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x157'),this[_0x8a95('0xf')][_0x8a95('0x39')],_0xc9c6fa[_0x8a95('0x154')]));this[_0x8a95('0xf')]['noop'](util[_0x8a95('0x55')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x8a95('0x39')],_0xc9c6fa[_0x8a95('0x154')]));return{'code':0xc8,'result':'success'};}else{logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x159'),this[_0x8a95('0xf')][_0x8a95('0x39')],_0xc9c6fa[_0x8a95('0x154')]));this['channel'][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x159'),this[_0x8a95('0xf')][_0x8a95('0x39')],_0xc9c6fa['findBy']));return{'code':0xc8,'result':_0x8a95('0x15a')};}};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x15c')]=function(_0x675a78){logger['info'](util[_0x8a95('0x55')](_0x8a95('0x15d'),_0x675a78[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x675a78[_0x8a95('0x15e')])){return this['channel'][_0x8a95('0x2a')](_0x675a78,_0x8a95('0x15f'));}this[_0x8a95('0xf')]['noop'](util['format'](_0x8a95('0x160'),_0x675a78[_0x8a95('0x15e')]));var _0x15def3=eval(_0x675a78['operation']);if(!this['isConfigured'](_0x675a78[_0x8a95('0xd5')])){return this[_0x8a95('0xf')]['noop'](_0x8a95('0xd6'));}var _0x197a1f=this['getVariable']['sync'](this,_0x675a78[_0x8a95('0xd5')]);if(!_0x197a1f){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x675a78,_0x8a95('0xd7'));}if(_[_0x8a95('0x9d')](_0x15def3)){var _0x2c5ed2=this;_0x15def3['forEach'](function(_0x57bc35,_0x4ebdcd){_0x2c5ed2[_0x8a95('0xf')][_0x8a95('0x9e')](util[_0x8a95('0x55')]('%s[%s]',_0x197a1f,_0x4ebdcd),_0x57bc35);});return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x161'),_0x197a1f));}else{return this[_0x8a95('0xf')][_0x8a95('0x9e')](_0x197a1f,_0x15def3);}};AGIVertices[_0x8a95('0x1a')][_0x8a95('0xd')]=function(_0x4bfb4e){logger[_0x8a95('0x2c')](util['format'](_0x8a95('0x162'),_0x4bfb4e[_0x8a95('0x37')]));if(_0x4bfb4e[_0x8a95('0xa5')]===0x0){return this[_0x8a95('0xa4')](_0x4bfb4e);}_0x4bfb4e[_0x8a95('0xa5')]-=0x1;if(!this[_0x8a95('0x85')](_0x4bfb4e['file_id'])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x4bfb4e,_0x8a95('0x114'));}var _0x1ffe9f=this[_0x8a95('0x115')][_0x8a95('0x70')](this,_0x4bfb4e[_0x8a95('0x116')]);if(!_0x1ffe9f){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x4bfb4e,'no\x20file\x20audio\x20found');}var _0x4bb53f=this['channel'][_0x8a95('0x163')](_0x1ffe9f,_0x4bfb4e[_0x8a95('0x118')],_0x4bfb4e['digit']);var _0x218dcb=_0x4bb53f[_0x8a95('0xa2')];if(_0x4bb53f['result']===-0x1){this[_0x8a95('0x36')][_0x8a95('0x70')](this,_0x4bfb4e,'-1');return _0x4bb53f;}else if(_0x4bb53f[_0x8a95('0xa0')]===_0x8a95('0x66')){_0x4bb53f['result']=_0x4bb53f[_0x8a95('0xa2')]['length']>0x0?_0x4bb53f['result']:'t';}else if(_[_0x8a95('0x44')](_0x4bb53f['result'])){_0x4bb53f['result']='#';_0x218dcb='#';}if(!this[_0x8a95('0x85')](_0x4bfb4e[_0x8a95('0xd5')])){this[_0x8a95('0xf')]['noop'](_0x8a95('0xd6'));}else{var _0x5cc09f=this['getVariable'][_0x8a95('0x70')](this,_0x4bfb4e[_0x8a95('0xd5')]);if(!_0x5cc09f){return this[_0x8a95('0xf')]['error'](_0x4bfb4e,_0x8a95('0xd7'));}this[_0x8a95('0xf')][_0x8a95('0x9e')](_0x5cc09f,_0x218dcb);}this[_0x8a95('0x36')][_0x8a95('0x70')](this,_0x4bfb4e,_0x218dcb);return _0x4bb53f;};AGIVertices['prototype'][_0x8a95('0xa8')]=function(_0x331079){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x164'),_0x331079[_0x8a95('0x37')]));return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x331079[_0x8a95('0x165')]||_0x331079['label']);};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x166')]=function(_0x4f9490){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x167'),_0x4f9490['label']));if(!this[_0x8a95('0x85')](_0x4f9490[_0x8a95('0x154')])){return this[_0x8a95('0xf')]['error'](_0x4f9490,_0x8a95('0x155'));}logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x156'),this[_0x8a95('0xf')]['callerid'],_0x4f9490[_0x8a95('0x154')]));var _0x33ca93=this['getPause'][_0x8a95('0x70')](this,_0x4f9490[_0x8a95('0x168')]);var _0x584dba=this[_0x8a95('0x4f')]['sync'](this,_0x4f9490['findBy'],_0x33ca93);if(_0x584dba){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x157'),this[_0x8a95('0xf')][_0x8a95('0x39')],_0x4f9490[_0x8a95('0x154')]));this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8a95('0xf')]['callerid'],_0x4f9490[_0x8a95('0x154')]));return{'code':0xc8,'result':_0x8a95('0x158')};}else{logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x159'),this[_0x8a95('0xf')][_0x8a95('0x39')],_0x4f9490[_0x8a95('0x154')]));this['channel']['noop'](util['format'](_0x8a95('0x157'),this[_0x8a95('0xf')][_0x8a95('0x39')],_0x4f9490['findBy']));return{'code':0xc8,'result':_0x8a95('0x15a')};}};AGIVertices['prototype'][_0x8a95('0x169')]=function(_0x5a3996){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x16a'),_0x5a3996[_0x8a95('0x37')]));if(!this['isConfigured'](_0x5a3996[_0x8a95('0x116')])){return this[_0x8a95('0xf')]['error'](_0x5a3996,_0x8a95('0x114'));}var _0x57719c=this['getSound'][_0x8a95('0x70')](this,_0x5a3996[_0x8a95('0x116')]);if(!_0x57719c){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x5a3996,_0x8a95('0x117'));}var _0x359a2e=this['channel'][_0x8a95('0x59')]('PLAYBACK',[_0x57719c,_0x5a3996['opts']]);if(_0x359a2e['result']===-0x1){return _0x359a2e;}return this[_0x8a95('0xf')]['noop'](util[_0x8a95('0x55')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x57719c));};AGIVertices['prototype'][_0x8a95('0x16b')]=function(_0x39c5b5){logger[_0x8a95('0x2c')](util['format'](_0x8a95('0x16c'),_0x39c5b5[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x39c5b5[_0x8a95('0x16d')])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x39c5b5,'no\x20queue\x20selected');}var _0x4a0d9e='';var _0x2ec0e0=parseInt(_0x39c5b5[_0x8a95('0x16d')],0xa);if(isNaN(_0x2ec0e0)){_0x4a0d9e=_0x39c5b5['queue_id'];}else{_0x4a0d9e=this['getVoiceQueue'][_0x8a95('0x70')](this,_0x39c5b5[_0x8a95('0x16d')]);if(!_0x4a0d9e){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x39c5b5,_0x8a95('0x16e'));}}var _0x33d555='';if(this[_0x8a95('0x85')](_0x39c5b5[_0x8a95('0x116')])){var _0x491cb1=this[_0x8a95('0x115')]['sync'](this,_0x39c5b5[_0x8a95('0x116')]);if(_0x491cb1){_0x33d555=_0x491cb1;}}this[_0x8a95('0x36')]['sync'](this,_0x39c5b5,_0x4a0d9e);if(_0x39c5b5[_0x8a95('0x16f')][_0x8a95('0x170')]('x')<0x0){_0x39c5b5['opts']+='x';}if(_0x39c5b5['opts'][_0x8a95('0x170')]('X')<0x0){_0x39c5b5[_0x8a95('0x16f')]+='X';}this[_0x8a95('0xf')][_0x8a95('0x9e')](_0x8a95('0x171'),_0x4a0d9e?_0x4a0d9e[_0x8a95('0x172')]():'');var _0xcca4b9=this[_0x8a95('0xf')][_0x8a95('0x59')]('QUEUE',[_0x4a0d9e,_0x39c5b5[_0x8a95('0x16f')],_0x39c5b5[_0x8a95('0x64')],_0x33d555,_0x39c5b5['timeout'],_0x39c5b5['agi'],_0x39c5b5['macro'],_0x39c5b5[_0x8a95('0x173')],'',_0x39c5b5[_0x8a95('0x174')]]);if(_0xcca4b9['result']===-0x1){return _0xcca4b9;}return this[_0x8a95('0xf')]['noop'](util['format'](_0x8a95('0xc1'),_0x8a95('0x175'),_0x4a0d9e));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x176')]=function(_0xcc653d){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x177'),_0xcc653d['label']));var _0x402d99=_0xcc653d['recordingFormat']||_0x8a95('0x13a');var _0x312ba5=util[_0x8a95('0x55')]('%s_%s',this['channel'][_0x8a95('0x42')],rs[_0x8a95('0x11d')](0x5));var _0x4c3b32=util[_0x8a95('0x55')](_0x8a95('0x178'),FILES_PATH,_0x312ba5,_0x402d99);var _0x16f7c3=util[_0x8a95('0x55')](_0x8a95('0x131'),FILES_PATH,_0x312ba5);this['createSquareRecording']['sync'](this,_0xcc653d,_0x312ba5,_0x4c3b32);this['channel'][_0x8a95('0x9e')]('RECORDING_SAVENAME',_0x312ba5);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x16f7c3,_0x402d99,_0xcc653d[_0x8a95('0x179')],_0xcc653d[_0x8a95('0x66')]);return this[_0x8a95('0xf')][_0x8a95('0x134')](_0x16f7c3,_0x402d99,_0xcc653d[_0x8a95('0x179')],_0xcc653d[_0x8a95('0x66')],undefined,!![]);};AGIVertices['prototype'][_0x8a95('0x17a')]=function(_0x101d2e){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x17b'),_0x101d2e[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x101d2e[_0x8a95('0x64')])){return this[_0x8a95('0xf')]['noop'](_0x8a95('0x17c'));}var _0x39ba8a=this['restAPI'][_0x8a95('0x70')](this,_0x101d2e);logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x17d'),util['inspect'](_0x39ba8a,{'showHidden':![],'depth':null})));if(!this[_0x8a95('0x85')](_0x101d2e[_0x8a95('0xd5')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0x17e'));}var _0x22f13a=this[_0x8a95('0x12')][_0x8a95('0x70')](this,_0x101d2e['variable_id']);if(!_0x22f13a){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x101d2e,_0x8a95('0xd7'));}this[_0x8a95('0xf')]['setVariable'](util[_0x8a95('0x55')](_0x8a95('0x17f'),_0x22f13a),_0x39ba8a['statusCode']?_0x39ba8a[_0x8a95('0x75')]:_0x8a95('0x180'));this[_0x8a95('0xf')][_0x8a95('0x9e')](util['format'](_0x8a95('0x181'),_0x22f13a),_0x39ba8a[_0x8a95('0x76')]?_0x39ba8a[_0x8a95('0x76')]:'OK');if(_0x39ba8a[_0x8a95('0x6a')]){try{this[_0x8a95('0x9b')](_0x39ba8a[_0x8a95('0x6a')],_0x22f13a);}catch(_0x30152b){logger[_0x8a95('0x2a')](util[_0x8a95('0x55')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x22f13a));}}return this['channel'][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0xdc'),_0x22f13a));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x182')]=function(_0x4cc42b){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x183'),_0x4cc42b[_0x8a95('0x37')]));return this[_0x8a95('0xf')][_0x8a95('0x184')](_0x4cc42b[_0x8a95('0x185')]['replace'](/\s+/g,''),_0x4cc42b[_0x8a95('0x179')]);};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x186')]=function(_0x1805a6){logger[_0x8a95('0x2c')](util['format'](_0x8a95('0x187'),_0x1805a6[_0x8a95('0x37')]));return this['channel']['sayNumber'](_0x1805a6[_0x8a95('0x67')]['replace'](/\s+/g,''),_0x1805a6[_0x8a95('0x179')]);};AGIVertices['prototype'][_0x8a95('0x188')]=function(_0x1148a4){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x1148a4[_0x8a95('0x37')]));return this['channel'][_0x8a95('0x189')](_0x1148a4[_0x8a95('0x5e')],_0x1148a4[_0x8a95('0x179')]);};AGIVertices['prototype'][_0x8a95('0x18a')]=function(_0x27839f){logger[_0x8a95('0x2c')](util['format'](_0x8a95('0x18b'),_0x27839f['label']));if(!this['isConfigured'](_0x27839f[_0x8a95('0x18c')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0x18d'));}var _0x5c2748=this[_0x8a95('0x18e')][_0x8a95('0x70')](this,_0x27839f[_0x8a95('0x18c')]);if(!_0x5c2748||!_0x5c2748[_0x8a95('0x18f')]){return this['channel'][_0x8a95('0x2a')](_0x27839f,_0x8a95('0x190'));}var _0x3d81ac={'from':util['format'](_0x8a95('0x191'),_0x5c2748[_0x8a95('0x17')],_0x5c2748[_0x8a95('0x192')]||_0x5c2748[_0x8a95('0x18f')][_0x8a95('0x193')]),'to':_0x27839f['to']||'','cc':_0x27839f['cc']||'','bcc':_0x27839f[_0x8a95('0x194')]||'','subject':_0x27839f['subject'],'html':_0x27839f['text'],'text':_0x27839f['text']};if(this[_0x8a95('0x85')](_0x27839f['template_id'])){}logger[_0x8a95('0xdd')](_0x8a95('0x195'),JSON['stringify'](_0x3d81ac));this[_0x8a95('0x36')]['sync'](this,_0x27839f,_0x27839f['account_id']);this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x5c2748[_0x8a95('0x17')]));this[_0x8a95('0x24')]['sync'](this,_0x5c2748['smtpOptions'],_0x3d81ac);return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0x196'));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x197')]=function(_0x279dea){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x198'),_0x279dea[_0x8a95('0x37')]));return this['channel'][_0x8a95('0xa8')](_0x8a95('0x199'));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x19a')]=function(_0x266f16){logger['info'](util[_0x8a95('0x55')](_0x8a95('0x19b'),_0x266f16['label']));if(!this[_0x8a95('0x85')](_0x266f16[_0x8a95('0x19c')])){return this['channel'][_0x8a95('0xa8')](_0x8a95('0x19d'));}var _0x2acf95=this['getSmsAccount'][_0x8a95('0x70')](this,_0x266f16[_0x8a95('0x19c')]);if(!_0x2acf95){return this[_0x8a95('0xf')]['error'](_0x266f16,_0x8a95('0x19e'));}var _0x3c76f4={'body':_0x266f16[_0x8a95('0x19f')],'phone':_0x266f16['to']||'','SmsAccountId':_0x2acf95['id']};logger['debug'](_0x8a95('0x1a0'),JSON[_0x8a95('0x73')](_0x3c76f4));this[_0x8a95('0x36')]['sync'](this,_0x266f16,_0x266f16[_0x8a95('0x19c')]);this['channel'][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x1a1'),_0x2acf95[_0x8a95('0x17')]));this[_0x8a95('0x35')][_0x8a95('0x70')](this,_0x3c76f4);return this[_0x8a95('0xf')]['noop'](_0x8a95('0x1a2'));};AGIVertices[_0x8a95('0x1a')]['set']=function(_0x539169){logger[_0x8a95('0x2c')](util['format'](_0x8a95('0x1a3'),_0x539169['label']));if(!this[_0x8a95('0x85')](_0x539169[_0x8a95('0xd5')])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x539169,_0x8a95('0x1a4'));}var _0x4d99a2=this[_0x8a95('0x12')][_0x8a95('0x70')](this,_0x539169[_0x8a95('0xd5')]);if(!_0x4d99a2){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x539169,'no\x20variable\x20found');}return this[_0x8a95('0xf')]['setVariable'](_0x4d99a2,_0x539169[_0x8a95('0x1a5')]);};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x1a6')]=function(_0x2b921f){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')]('Enter\x20in\x20START\x20(%s)\x20block',_0x2b921f[_0x8a95('0x37')]));this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0x1a7'));if(_0x2b921f[_0x8a95('0xb9')]===_0x8a95('0x1a8')){this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0x1a9'));return this[_0x8a95('0xf')][_0x8a95('0xb9')]();}return this['channel'][_0x8a95('0xa8')](_0x8a95('0x1aa'));};AGIVertices[_0x8a95('0x1a')]['subproject']=function(_0x149287){logger['info'](util[_0x8a95('0x55')](_0x8a95('0x1ab'),_0x149287[_0x8a95('0x37')]));if(!this['isConfigured'](_0x149287[_0x8a95('0x1ac')])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x149287,'no\x20subproject\x20selected');}var _0x57170b=this['getSquareProject'][_0x8a95('0x70')](this,_0x149287[_0x8a95('0x1ac')]);if(!this[_0x8a95('0x85')](_0x57170b)){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x149287,util[_0x8a95('0x55')](_0x8a95('0x1ad'),_0x149287[_0x8a95('0x1ac')]));}if(_0x57170b===this[_0x8a95('0xf')][_0x8a95('0x1ae')]){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x149287,_0x8a95('0x1af'));}this[_0x8a95('0x36')][_0x8a95('0x70')](this,_0x149287,_0x57170b);var _0x562c86=this['channel'][_0x8a95('0x59')](_0x8a95('0x1b0'),util[_0x8a95('0x55')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x8a95('0xb6')][_0x8a95('0x1b1')]||'127.0.0.1',_0x57170b,this[_0x8a95('0xf')][_0x8a95('0x1ae')]));if(_0x562c86[_0x8a95('0xa2')]===-0x1){return _0x562c86;}return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0xc1'),'AGI',_0x57170b));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x1b2')]=function(_0x4bac9b){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x4bac9b[_0x8a95('0x37')]));var _0x437843=this['shellCommand'][_0x8a95('0x70')](this,_0x4bac9b[_0x8a95('0x1b3')]);this[_0x8a95('0x36')][_0x8a95('0x70')](this,_0x4bac9b,_0x4bac9b['command']);if(this[_0x8a95('0x85')](_0x4bac9b[_0x8a95('0xd5')])){var _0x1b1774=this['getVariable'][_0x8a95('0x70')](this,_0x4bac9b['variable_id']);if(_0x1b1774){this[_0x8a95('0xf')]['setVariable'](_0x1b1774,_0x437843);return this['channel'][_0x8a95('0xa8')](util['format'](_0x8a95('0x1b4'),_0x4bac9b[_0x8a95('0x1b3')],_0x1b1774));}}return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x1b5'),_0x4bac9b[_0x8a95('0x1b3')]));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x1b6')]=function(_0x41fa6e){logger['info'](util[_0x8a95('0x55')](_0x8a95('0x1b7'),_0x41fa6e[_0x8a95('0x37')]));_0x41fa6e['text']=_0x41fa6e[_0x8a95('0x5e')][_0x8a95('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x41fa6e[_0x8a95('0x5c')])){return this['channel'][_0x8a95('0xa8')](_0x8a95('0x1b8'));}if(!this[_0x8a95('0x85')](_0x41fa6e[_0x8a95('0x5e')])){return this['channel']['noop'](_0x8a95('0xa9'));}this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x1b9'),_0x41fa6e['text']));var _0x300bbc=this['googleCloudTTS'][_0x8a95('0x70')](this,_0x41fa6e);if(_0x300bbc){this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x1ba'),_0x300bbc));var _0x27eee8=this[_0x8a95('0xf')][_0x8a95('0x103')](_0x300bbc);try{fs[_0x8a95('0x104')](_0x300bbc+'.wav');}catch(_0x5613fc){logger[_0x8a95('0x2a')](_0x5613fc);}return _0x27eee8;}return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x41fa6e,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x8a95('0x1a')]['tts']=function(_0x20ecda){logger['info'](util[_0x8a95('0x55')](_0x8a95('0x1bb'),_0x20ecda[_0x8a95('0x37')]));_0x20ecda[_0x8a95('0x5e')]=_0x20ecda[_0x8a95('0x5e')][_0x8a95('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8a95('0x85')](_0x20ecda['text'])){return this['channel']['noop'](_0x8a95('0xa9'));}this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x1bc'),_0x20ecda[_0x8a95('0x5e')]));var _0xc4aefa=this['googleTTS'][_0x8a95('0x70')](this,_0x20ecda);if(_0xc4aefa){this['channel'][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x1bd'),_0xc4aefa));var _0x81f72b=this[_0x8a95('0xf')][_0x8a95('0x103')](_0xc4aefa);try{fs['unlink'](_0xc4aefa+_0x8a95('0x105'));}catch(_0x1f0a8c){logger[_0x8a95('0x2a')](_0x1f0a8c);}return _0x81f72b;}return this['channel'][_0x8a95('0x2a')](_0x20ecda,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x1be')]=function(_0x453450){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x1bf'),_0x453450[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x453450[_0x8a95('0x154')])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x453450,_0x8a95('0x155'));}logger[_0x8a95('0x2c')](util[_0x8a95('0x55')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8a95('0xf')][_0x8a95('0x39')],_0x453450[_0x8a95('0x154')]));var _0x4b28b1=this[_0x8a95('0x51')][_0x8a95('0x70')](this,_0x453450[_0x8a95('0x154')]);if(_0x4b28b1){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x157'),this['channel'][_0x8a95('0x39')],_0x453450[_0x8a95('0x154')]));this[_0x8a95('0xf')][_0x8a95('0xa8')](util['format'](_0x8a95('0x157'),this['channel'][_0x8a95('0x39')],_0x453450[_0x8a95('0x154')]));return{'code':0xc8,'result':_0x8a95('0x158')};}else{logger[_0x8a95('0x2c')](util['format'](_0x8a95('0x159'),this[_0x8a95('0xf')]['callerid'],_0x453450[_0x8a95('0x154')]));this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x159'),this[_0x8a95('0xf')]['callerid'],_0x453450[_0x8a95('0x154')]));return{'code':0xc8,'result':_0x8a95('0x15a')};}};AGIVertices['prototype'][_0x8a95('0x1c0')]=function(_0x588cb5){logger['info'](util[_0x8a95('0x55')](_0x8a95('0x1c1'),_0x588cb5[_0x8a95('0x37')]));var _0x40948d=this[_0x8a95('0xf')][_0x8a95('0x59')](_0x8a95('0x1c2'),[_0x588cb5[_0x8a95('0x1c3')],_0x588cb5[_0x8a95('0x79')]]);if(_0x40948d[_0x8a95('0xa2')]===-0x1){return _0x40948d;}return this[_0x8a95('0xf')]['noop'](util[_0x8a95('0x55')](_0x8a95('0xc1'),_0x8a95('0x1c2'),_0x588cb5[_0x8a95('0x1c3')]));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x1c4')]=function(_0x3bfeba){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x1c5'),_0x3bfeba[_0x8a95('0x37')]));if(!this['isConfigured'](_0x3bfeba['variable_id'])){return this['channel'][_0x8a95('0x2a')](_0x3bfeba,_0x8a95('0x1a4'));}var _0x189f63=this['getVariable'][_0x8a95('0x70')](this,_0x3bfeba['variable_id']);if(!_0x189f63){return this[_0x8a95('0xf')]['error'](_0x3bfeba,'no\x20variable\x20found');}var _0xd000ca=this['channel'][_0x8a95('0x12')](_0x189f63);return{'code':0xc8,'result':_0xd000ca['extra']?_0xd000ca['extra']:'-'};};String[_0x8a95('0x1a')][_0x8a95('0x1c6')]=function(_0x49f791,_0x13cc83){return this['split'](_0x49f791)['join'](_0x13cc83);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 642410e..5eaf3f9 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 _0xab1f=['[%s][HANGUP:UNIQUEID]','[%s][HANGUP:LINKEDID]','linkedid','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','isNil','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','transfererlinkedid','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','timer','stopAcw','acwTimeout','lastPauseAt','format','uniqueid','updateAcw','update','catch','[%s][UPDATE][ERRORS:%s]','error','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','prototype','[%s][TIMER][STOP][AGENT:%s]','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','interface','isUndefined'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xab1f,0x6a));var _0xfab1=function(_0x2e783b,_0x2b22f2){_0x2e783b=_0x2e783b-0x0;var _0x39fe8b=_0xab1f[_0x2e783b];return _0x39fe8b;};'use strict';var _=require(_0xfab1('0x0'));var moment=require(_0xfab1('0x1'));var ami=require(_0xfab1('0x2'));var logger=require(_0xfab1('0x3'))(_0xfab1('0x4'));var RpcUser=require(_0xfab1('0x5'));var RpcVoiceAgentReport=require(_0xfab1('0x6'));function Acw(_0x93959b){this['voiceQueues']=_0x93959b[_0xfab1('0x7')];this[_0xfab1('0x8')]=_0x93959b[_0xfab1('0x8')];this[_0xfab1('0x9')]=_0x93959b['timers'];this[_0xfab1('0xa')]={};ami['on'](_0xfab1('0xb'),this[_0xfab1('0xc')][_0xfab1('0xd')](this));ami['on'](_0xfab1('0xe'),this[_0xfab1('0xf')][_0xfab1('0xd')](this));ami['on'](_0xfab1('0x10'),this[_0xfab1('0x11')][_0xfab1('0xd')](this));ami['on']('agentringnoanswer',this[_0xfab1('0x12')][_0xfab1('0xd')](this));ami['on']('attendedtransfer',this[_0xfab1('0x13')][_0xfab1('0xd')](this));ami['on'](_0xfab1('0x14'),this['syncBlindTransfer'][_0xfab1('0xd')](this));ami['on'](_0xfab1('0x15'),this[_0xfab1('0x16')][_0xfab1('0xd')](this));}function getDiff(_0x39d3cc){var _0x1287ba=moment()[_0xfab1('0x17')](0x0);var _0x4c2b97=moment(_0x39d3cc)[_0xfab1('0x17')](0x0);return _0x1287ba[_0xfab1('0x18')](_0x4c2b97,_0xfab1('0x19'));}Acw['prototype'][_0xfab1('0x1a')]=function(_0xedd26d){try{var _0x592b9d=this;var _0x2b06a6=this[_0xfab1('0xa')][_0xedd26d]['interface'];var _0x40f037=this[_0xfab1('0xa')][_0xedd26d][_0xfab1('0x1b')];var _0x22deff=this['voiceQueues'][_0x40f037];var _0x20ca46=![];var _0x4da6a4=_0xfab1('0x1c');if(_0x22deff[_0xfab1('0x1d')]){if(_0x22deff[_0xfab1('0x1e')]['name']){_0x20ca46=!![];_0x4da6a4=_0x22deff[_0xfab1('0x1e')]['name'];}}return ami[_0xfab1('0x1f')]({'action':_0xfab1('0x20'),'interface':_0x2b06a6,'paused':!![],'reason':_0x4da6a4})[_0xfab1('0x21')](function(){if(_0x592b9d['agents'][_0x2b06a6]){return RpcUser[_0xfab1('0x22')](_0x592b9d[_0xfab1('0x8')][_0x2b06a6]['id'])[_0xfab1('0x21')](function(_0x35a1a3){if(_0x35a1a3&&!_0x35a1a3[_0xfab1('0x23')]){logger[_0xfab1('0x24')](_0xfab1('0x25'),_0xedd26d,_0x2b06a6,_0x40f037);var _0xa93413=_0x592b9d['channels'][_0xedd26d][_0xfab1('0x26')]&&_0x592b9d[_0xfab1('0xa')][_0xedd26d][_0xfab1('0x27')]?_0x592b9d[_0xfab1('0xa')][_0xedd26d][_0xfab1('0x27')]:_0xedd26d;return RpcUser['savePause'](_0x592b9d[_0xfab1('0x8')][_0x2b06a6],_0x4da6a4,_0xa93413)[_0xfab1('0x21')](function(){if(!_0x20ca46){_0x592b9d[_0xfab1('0x9')][_0x2b06a6]={};logger[_0xfab1('0x24')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0xedd26d,_0x592b9d[_0xfab1('0x7')][_0x40f037]['acwTimeout'],_0x2b06a6,_0x40f037);_0x592b9d[_0xfab1('0x9')][_0x2b06a6][_0xfab1('0x28')]=setTimeout(_0x592b9d[_0xfab1('0x29')][_0xfab1('0xd')](_0x592b9d,_0x2b06a6),_0x592b9d[_0xfab1('0x7')][_0x40f037][_0xfab1('0x2a')]*0x3e8);_0x592b9d[_0xfab1('0x9')][_0x2b06a6][_0xfab1('0x2b')]=moment()[_0xfab1('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');_0x592b9d[_0xfab1('0x9')][_0x2b06a6][_0xfab1('0x2d')]=_0xedd26d;_0x592b9d[_0xfab1('0x9')][_0x2b06a6][_0xfab1('0x1b')]=_0x40f037;_0x592b9d[_0xfab1('0x9')][_0x2b06a6][_0xfab1('0x2e')]=function(){var _0x5824fd=getDiff(_0x592b9d['timers'][_0x2b06a6][_0xfab1('0x2b')]);clearTimeout(_0x592b9d[_0xfab1('0x9')][_0x2b06a6]['timer']);_0x592b9d[_0xfab1('0x9')][_0x2b06a6]['timer']=![];RpcVoiceAgentReport[_0xfab1('0x2f')]({'acwtime':_0x5824fd},_0x592b9d[_0xfab1('0x9')][_0x2b06a6][_0xfab1('0x2d')],_0x2b06a6)[_0xfab1('0x21')](function(_0x79f79a){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0xedd26d,_0x5824fd,_0x79f79a);})[_0xfab1('0x30')](function(_0x2fe3d1){logger['error'](_0xfab1('0x31'),_0xedd26d,_0x2fe3d1);});delete _0x592b9d[_0xfab1('0x9')][_0x2b06a6];};}});}else{logger[_0xfab1('0x24')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0xedd26d,_0x2b06a6,_0x40f037);}});}})['catch'](function(){logger[_0xfab1('0x32')](_0xfab1('0x33'),_0xedd26d,_0x592b9d['voiceQueues'][_0x40f037][_0xfab1('0x2a')],_0x2b06a6,_0x40f037);})[_0xfab1('0x34')](function(){delete _0x592b9d[_0xfab1('0xa')][_0xedd26d];});}catch(_0xaedd73){logger[_0xfab1('0x32')](_0xfab1('0x35'),_0xaedd73[_0xfab1('0x36')]);}};Acw[_0xfab1('0x37')][_0xfab1('0x29')]=function(_0x547e83){try{var _0x46009e=this;if(_0x46009e[_0xfab1('0x9')][_0x547e83]){_0x46009e['timers'][_0x547e83][_0xfab1('0x28')]=![];var _0x560c61=_0x46009e['timers'][_0x547e83][_0xfab1('0x2d')];var _0x1a33d4=_0x46009e[_0xfab1('0x9')][_0x547e83][_0xfab1('0x1b')];var _0x23b19a=_0x46009e[_0xfab1('0x7')][_0x1a33d4][_0xfab1('0x2a')];logger[_0xfab1('0x24')](_0xfab1('0x38'),_0x560c61,_0x547e83);RpcUser['saveUnpause'](this[_0xfab1('0x8')][_0x547e83]);RpcVoiceAgentReport['update']({'acwtime':_0x23b19a,'agentacw':!![]},_0x560c61,_0x547e83)[_0xfab1('0x21')](function(_0x1632a8){logger[_0xfab1('0x24')](_0xfab1('0x39'),_0x560c61,_0x23b19a,_0x1632a8);})['catch'](function(_0x308dad){logger[_0xfab1('0x32')](_0xfab1('0x31'),_0x560c61,_0x308dad);});}else{logger[_0xfab1('0x32')](_0xfab1('0x3a'),_0x547e83);if(_0x46009e[_0xfab1('0x9')]){logger[_0xfab1('0x24')](_0xfab1('0x3b'),JSON[_0xfab1('0x3c')](_0x46009e[_0xfab1('0x9')]));}}}catch(_0x469228){logger['error'](_0xfab1('0x3d'),_0x469228[_0xfab1('0x36')]);}};Acw[_0xfab1('0x37')][_0xfab1('0xc')]=function(_0x55e993){try{if(this[_0xfab1('0x7')][_0x55e993[_0xfab1('0x1b')]]&&(this[_0xfab1('0x7')][_0x55e993[_0xfab1('0x1b')]][_0xfab1('0x4')]||this['voiceQueues'][_0x55e993[_0xfab1('0x1b')]][_0xfab1('0x1d')])){if(this['agents'][_0x55e993[_0xfab1('0x3e')]]){this[_0xfab1('0xa')][_0x55e993[_0xfab1('0x2d')]]={'queue':_0x55e993[_0xfab1('0x1b')],'interface':_0x55e993[_0xfab1('0x3e')],'destlinkedid':_0x55e993[_0xfab1('0x27')]};}}}catch(_0x45bd07){logger[_0xfab1('0x32')]('[ACW][syncAgentConnect]\x20%s',_0x45bd07['message']);}};Acw[_0xfab1('0x37')]['syncAgentConnectPreview']=function(_0xdfa6b7){try{if(this[_0xfab1('0x7')][_0xdfa6b7[_0xfab1('0x1b')]]&&(this[_0xfab1('0x7')][_0xdfa6b7['queue']][_0xfab1('0x4')]||this[_0xfab1('0x7')][_0xdfa6b7[_0xfab1('0x1b')]]['mandatoryDisposition'])){if(this[_0xfab1('0x8')][_0xdfa6b7[_0xfab1('0x3e')]]){this[_0xfab1('0xa')][_0xdfa6b7[_0xfab1('0x2d')]]={'queue':_0xdfa6b7[_0xfab1('0x1b')],'interface':_0xdfa6b7[_0xfab1('0x3e')]};}}}catch(_0x20cef2){logger[_0xfab1('0x32')]('[ACW][syncAgentConnectPreview]\x20%s',_0x20cef2[_0xfab1('0x36')]);}};Acw[_0xfab1('0x37')][_0xfab1('0xf')]=function(_0x395f7d){try{if(this['channels'][_0x395f7d[_0xfab1('0x2d')]]&&_[_0xfab1('0x3f')](this[_0xfab1('0xa')][_0x395f7d['uniqueid']][_0xfab1('0x26')])){logger[_0xfab1('0x24')](_0xfab1('0x40'),_0x395f7d[_0xfab1('0x2d')]);this['startAcw'](_0x395f7d[_0xfab1('0x2d')]);}else if(this['channels'][_0x395f7d['linkedid']]&&_[_0xfab1('0x3f')](this[_0xfab1('0xa')][_0x395f7d['linkedid']][_0xfab1('0x26')])){logger[_0xfab1('0x24')](_0xfab1('0x41'),_0x395f7d[_0xfab1('0x42')]);this[_0xfab1('0x1a')](_0x395f7d[_0xfab1('0x42')]);}}catch(_0x5d79f7){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x5d79f7[_0xfab1('0x36')]);}};Acw[_0xfab1('0x37')]['syncHangup']=function(_0x384a5e){try{if(this[_0xfab1('0xa')][_0x384a5e[_0xfab1('0x2d')]]&&this[_0xfab1('0xa')][_0x384a5e[_0xfab1('0x2d')]][_0xfab1('0x26')]){logger[_0xfab1('0x24')](_0xfab1('0x43'),_0x384a5e[_0xfab1('0x2d')]);this[_0xfab1('0x1a')](_0x384a5e[_0xfab1('0x2d')]);}else if(this['channels'][_0x384a5e[_0xfab1('0x42')]]&&this['channels'][_0x384a5e['linkedid']][_0xfab1('0x26')]){logger['info'](_0xfab1('0x44'),_0x384a5e[_0xfab1('0x42')]);this[_0xfab1('0x1a')](_0x384a5e[_0xfab1('0x42')]);}}catch(_0x4131f8){logger['error'](_0xfab1('0x45'),_0x4131f8[_0xfab1('0x36')]);}};Acw[_0xfab1('0x37')][_0xfab1('0x13')]=function(_0x53f953){try{if(!_['isNil'](this['channels'][_0x53f953[_0xfab1('0x46')]])){this[_0xfab1('0x1a')](_0x53f953['transfereeuniqueid']);if(this[_0xfab1('0xa')][_0x53f953[_0xfab1('0x47')]]){this[_0xfab1('0xa')][_0x53f953[_0xfab1('0x47')]]['attended']=!![];this[_0xfab1('0xa')][_0x53f953['transfertargetuniqueid']]=this['channels'][_0x53f953['secondtransfereruniqueid']];delete this[_0xfab1('0xa')][_0x53f953['secondtransfereruniqueid']];}}else if(!_[_0xfab1('0x48')](this[_0xfab1('0xa')][_0x53f953[_0xfab1('0x49')]])){this[_0xfab1('0x1a')](_0x53f953['transfertargetuniqueid']);if(this['channels'][_0x53f953[_0xfab1('0x4a')]]){this['channels'][_0x53f953[_0xfab1('0x4a')]][_0xfab1('0x26')]=!![];this[_0xfab1('0xa')][_0x53f953['transfereeuniqueid']]=this[_0xfab1('0xa')][_0x53f953[_0xfab1('0x4a')]];delete this['channels'][_0x53f953[_0xfab1('0x4a')]];}}}catch(_0x1bfa25){logger[_0xfab1('0x32')](_0xfab1('0x4b'),_0x1bfa25[_0xfab1('0x36')]);}};Acw[_0xfab1('0x37')][_0xfab1('0x4c')]=function(_0x1d9db9){try{if(this[_0xfab1('0xa')][_0x1d9db9[_0xfab1('0x4d')]]){logger[_0xfab1('0x24')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xfab1('0x3c')](_0x1d9db9[_0xfab1('0x4d')]));this[_0xfab1('0x1a')](_0x1d9db9['transfereruniqueid']);}else if(this[_0xfab1('0xa')][_0x1d9db9[_0xfab1('0x4e')]]){logger[_0xfab1('0x24')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xfab1('0x3c')](_0x1d9db9['transfererlinkedid']));this[_0xfab1('0x1a')](_0x1d9db9['transfererlinkedid']);}}catch(_0x1061ab){logger[_0xfab1('0x32')]('[ACW][syncBlindTransfer]\x20%s',_0x1061ab[_0xfab1('0x36')]);}};Acw[_0xfab1('0x37')]['syncAgentRingNoAnswer']=function(_0x407bf9){try{if(this[_0xfab1('0x7')][_0x407bf9['queue']]&&this[_0xfab1('0x7')][_0x407bf9[_0xfab1('0x1b')]][_0xfab1('0x4f')]===_0xfab1('0x50')){if(this[_0xfab1('0x8')][_0x407bf9[_0xfab1('0x3e')]]){logger[_0xfab1('0x24')](_0xfab1('0x51'),_0x407bf9['uniqueid'],_0x407bf9[_0xfab1('0x3e')],_0x407bf9[_0xfab1('0x1b')]);return RpcUser['savePause'](this[_0xfab1('0x8')][_0x407bf9[_0xfab1('0x3e')]],_0xfab1('0x52'),_0x407bf9['uniqueid']);}}}catch(_0x536c0d){logger['error'](_0xfab1('0x53'),_0x536c0d[_0xfab1('0x36')]);}};module[_0xfab1('0x54')]=Acw; \ No newline at end of file +var _0xedd7=['blindtransfer','diff','seconds','prototype','queue','ACW','mandatoryDispositionPause','name','QueuePause','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','then','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','lastPauseAt','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','bind','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer'];(function(_0x5e7098,_0x1371ba){var _0x50f670=function(_0x102f4a){while(--_0x102f4a){_0x5e7098['push'](_0x5e7098['shift']());}};_0x50f670(++_0x1371ba);}(_0xedd7,0x90));var _0x7edd=function(_0x29a578,_0x406599){_0x29a578=_0x29a578-0x0;var _0x1cebfe=_0xedd7[_0x29a578];return _0x1cebfe;};'use strict';var _=require(_0x7edd('0x0'));var moment=require(_0x7edd('0x1'));var ami=require(_0x7edd('0x2'));var logger=require('../../../config/logger')(_0x7edd('0x3'));var RpcUser=require(_0x7edd('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x8828e3){this['voiceQueues']=_0x8828e3[_0x7edd('0x5')];this[_0x7edd('0x6')]=_0x8828e3['agents'];this['timers']=_0x8828e3[_0x7edd('0x7')];this[_0x7edd('0x8')]={};ami['on'](_0x7edd('0x9'),this['syncAgentConnect'][_0x7edd('0xa')](this));ami['on']('hanguprequest',this[_0x7edd('0xb')][_0x7edd('0xa')](this));ami['on']('hangup',this[_0x7edd('0xc')][_0x7edd('0xa')](this));ami['on'](_0x7edd('0xd'),this[_0x7edd('0xe')]['bind'](this));ami['on'](_0x7edd('0xf'),this['syncAttendedTransfer'][_0x7edd('0xa')](this));ami['on'](_0x7edd('0x10'),this['syncBlindTransfer']['bind'](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0x7edd('0xa')](this));}function getDiff(_0x67e320){var _0x5d2871=moment()['milliseconds'](0x0);var _0x25c5b8=moment(_0x67e320)['milliseconds'](0x0);return _0x5d2871[_0x7edd('0x11')](_0x25c5b8,_0x7edd('0x12'));}Acw[_0x7edd('0x13')]['startAcw']=function(_0xb53e2a){try{var _0x112ebb=this;var _0x5ab7f5=this['channels'][_0xb53e2a]['interface'];var _0x2bc5a0=this[_0x7edd('0x8')][_0xb53e2a][_0x7edd('0x14')];var _0x53d34d=this[_0x7edd('0x5')][_0x2bc5a0];var _0x19bdc8=![];var _0x3863a4=_0x7edd('0x15');if(_0x53d34d['mandatoryDisposition']){if(_0x53d34d[_0x7edd('0x16')]['name']){_0x19bdc8=!![];_0x3863a4=_0x53d34d['mandatoryDispositionPause'][_0x7edd('0x17')];}}return ami['Action']({'action':_0x7edd('0x18'),'interface':_0x5ab7f5,'paused':!![],'reason':_0x3863a4})['then'](function(){if(_0x112ebb[_0x7edd('0x6')][_0x5ab7f5]){return RpcUser['getAgent'](_0x112ebb[_0x7edd('0x6')][_0x5ab7f5]['id'])['then'](function(_0x529d6c){if(_0x529d6c&&!_0x529d6c[_0x7edd('0x19')]){logger[_0x7edd('0x1a')](_0x7edd('0x1b'),_0xb53e2a,_0x5ab7f5,_0x2bc5a0);var _0x14977b=_0x112ebb[_0x7edd('0x8')][_0xb53e2a][_0x7edd('0x1c')]&&_0x112ebb[_0x7edd('0x8')][_0xb53e2a][_0x7edd('0x1d')]?_0x112ebb['channels'][_0xb53e2a][_0x7edd('0x1d')]:_0xb53e2a;return RpcUser[_0x7edd('0x1e')](_0x112ebb[_0x7edd('0x6')][_0x5ab7f5],_0x3863a4,_0x14977b)[_0x7edd('0x1f')](function(){if(!_0x19bdc8){_0x112ebb[_0x7edd('0x7')][_0x5ab7f5]={};logger[_0x7edd('0x1a')](_0x7edd('0x20'),_0xb53e2a,_0x112ebb[_0x7edd('0x5')][_0x2bc5a0][_0x7edd('0x21')],_0x5ab7f5,_0x2bc5a0);_0x112ebb[_0x7edd('0x7')][_0x5ab7f5]['timer']=setTimeout(_0x112ebb[_0x7edd('0x22')][_0x7edd('0xa')](_0x112ebb,_0x5ab7f5),_0x112ebb[_0x7edd('0x5')][_0x2bc5a0][_0x7edd('0x21')]*0x3e8);_0x112ebb[_0x7edd('0x7')][_0x5ab7f5]['lastPauseAt']=moment()[_0x7edd('0x23')](_0x7edd('0x24'));_0x112ebb[_0x7edd('0x7')][_0x5ab7f5]['uniqueid']=_0xb53e2a;_0x112ebb['timers'][_0x5ab7f5][_0x7edd('0x14')]=_0x2bc5a0;_0x112ebb[_0x7edd('0x7')][_0x5ab7f5][_0x7edd('0x25')]=function(){var _0x1fe904=getDiff(_0x112ebb[_0x7edd('0x7')][_0x5ab7f5][_0x7edd('0x26')]);clearTimeout(_0x112ebb['timers'][_0x5ab7f5][_0x7edd('0x27')]);_0x112ebb[_0x7edd('0x7')][_0x5ab7f5][_0x7edd('0x27')]=![];RpcVoiceAgentReport[_0x7edd('0x28')]({'acwtime':_0x1fe904},_0x112ebb[_0x7edd('0x7')][_0x5ab7f5][_0x7edd('0x29')],_0x5ab7f5)['then'](function(_0x18ebe6){logger['info'](_0x7edd('0x2a'),_0xb53e2a,_0x1fe904,_0x18ebe6);})[_0x7edd('0x2b')](function(_0x57bda0){logger['error'](_0x7edd('0x2c'),_0xb53e2a,_0x57bda0);});delete _0x112ebb[_0x7edd('0x7')][_0x5ab7f5];};}});}else{logger[_0x7edd('0x1a')](_0x7edd('0x2d'),_0xb53e2a,_0x5ab7f5,_0x2bc5a0);}});}})[_0x7edd('0x2b')](function(){logger[_0x7edd('0x2e')](_0x7edd('0x20'),_0xb53e2a,_0x112ebb['voiceQueues'][_0x2bc5a0][_0x7edd('0x21')],_0x5ab7f5,_0x2bc5a0);})['finally'](function(){delete _0x112ebb[_0x7edd('0x8')][_0xb53e2a];});}catch(_0x4d2001){logger[_0x7edd('0x2e')](_0x7edd('0x2f'),_0x4d2001[_0x7edd('0x30')]);}};Acw[_0x7edd('0x13')][_0x7edd('0x22')]=function(_0x360c93){try{var _0x2c5336=this;if(_0x2c5336[_0x7edd('0x7')][_0x360c93]){_0x2c5336[_0x7edd('0x7')][_0x360c93][_0x7edd('0x27')]=![];var _0xe03af5=_0x2c5336[_0x7edd('0x7')][_0x360c93][_0x7edd('0x29')];var _0x7a21c4=_0x2c5336[_0x7edd('0x7')][_0x360c93][_0x7edd('0x14')];var _0x467288=_0x2c5336['voiceQueues'][_0x7a21c4][_0x7edd('0x21')];logger[_0x7edd('0x1a')](_0x7edd('0x31'),_0xe03af5,_0x360c93);RpcUser['saveUnpause'](this['agents'][_0x360c93]);RpcVoiceAgentReport['update']({'acwtime':_0x467288,'agentacw':!![]},_0xe03af5,_0x360c93)[_0x7edd('0x1f')](function(_0x3087b4){logger[_0x7edd('0x1a')](_0x7edd('0x2a'),_0xe03af5,_0x467288,_0x3087b4);})[_0x7edd('0x2b')](function(_0x4929fa){logger[_0x7edd('0x2e')](_0x7edd('0x2c'),_0xe03af5,_0x4929fa);});}else{logger[_0x7edd('0x2e')](_0x7edd('0x32'),_0x360c93);if(_0x2c5336[_0x7edd('0x7')]){logger['info']('[ACW][TIMERS]',JSON[_0x7edd('0x33')](_0x2c5336[_0x7edd('0x7')]));}}}catch(_0x2109f8){logger[_0x7edd('0x2e')](_0x7edd('0x34'),_0x2109f8[_0x7edd('0x30')]);}};Acw[_0x7edd('0x13')]['syncAgentConnect']=function(_0x2d37fa){try{if(this[_0x7edd('0x5')][_0x2d37fa['queue']]&&(this[_0x7edd('0x5')][_0x2d37fa[_0x7edd('0x14')]]['acw']||this['voiceQueues'][_0x2d37fa['queue']]['mandatoryDisposition'])){if(this['agents'][_0x2d37fa[_0x7edd('0x35')]]){this['channels'][_0x2d37fa[_0x7edd('0x29')]]={'queue':_0x2d37fa[_0x7edd('0x14')],'interface':_0x2d37fa[_0x7edd('0x35')],'destlinkedid':_0x2d37fa[_0x7edd('0x1d')]};}}}catch(_0x5210e9){logger[_0x7edd('0x2e')](_0x7edd('0x36'),_0x5210e9[_0x7edd('0x30')]);}};Acw['prototype'][_0x7edd('0x37')]=function(_0x713ba3){try{if(this[_0x7edd('0x5')][_0x713ba3[_0x7edd('0x14')]]&&(this[_0x7edd('0x5')][_0x713ba3[_0x7edd('0x14')]]['acw']||this[_0x7edd('0x5')][_0x713ba3[_0x7edd('0x14')]][_0x7edd('0x38')])){if(this[_0x7edd('0x6')][_0x713ba3[_0x7edd('0x35')]]){this[_0x7edd('0x8')][_0x713ba3[_0x7edd('0x29')]]={'queue':_0x713ba3[_0x7edd('0x14')],'interface':_0x713ba3[_0x7edd('0x35')]};}}}catch(_0x5eb600){logger[_0x7edd('0x2e')](_0x7edd('0x39'),_0x5eb600[_0x7edd('0x30')]);}};Acw[_0x7edd('0x13')][_0x7edd('0xb')]=function(_0x39428c){try{if(this[_0x7edd('0x8')][_0x39428c[_0x7edd('0x29')]]&&_[_0x7edd('0x3a')](this[_0x7edd('0x8')][_0x39428c['uniqueid']]['attended'])){logger['info'](_0x7edd('0x3b'),_0x39428c[_0x7edd('0x29')]);this[_0x7edd('0x3c')](_0x39428c[_0x7edd('0x29')]);}else if(this['channels'][_0x39428c['linkedid']]&&_['isUndefined'](this[_0x7edd('0x8')][_0x39428c[_0x7edd('0x3d')]][_0x7edd('0x1c')])){logger[_0x7edd('0x1a')](_0x7edd('0x3e'),_0x39428c[_0x7edd('0x3d')]);this[_0x7edd('0x3c')](_0x39428c[_0x7edd('0x3d')]);}}catch(_0x647b8d){logger[_0x7edd('0x2e')](_0x7edd('0x3f'),_0x647b8d[_0x7edd('0x30')]);}};Acw['prototype'][_0x7edd('0xc')]=function(_0x3eb84c){try{if(this[_0x7edd('0x8')][_0x3eb84c[_0x7edd('0x29')]]&&this[_0x7edd('0x8')][_0x3eb84c['uniqueid']][_0x7edd('0x1c')]){logger[_0x7edd('0x1a')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x3eb84c['uniqueid']);this[_0x7edd('0x3c')](_0x3eb84c['uniqueid']);}else if(this['channels'][_0x3eb84c['linkedid']]&&this[_0x7edd('0x8')][_0x3eb84c[_0x7edd('0x3d')]][_0x7edd('0x1c')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x3eb84c[_0x7edd('0x3d')]);this[_0x7edd('0x3c')](_0x3eb84c[_0x7edd('0x3d')]);}}catch(_0x120604){logger[_0x7edd('0x2e')](_0x7edd('0x40'),_0x120604[_0x7edd('0x30')]);}};Acw[_0x7edd('0x13')]['syncAttendedTransfer']=function(_0x2b3780){try{if(!_['isNil'](this[_0x7edd('0x8')][_0x2b3780[_0x7edd('0x41')]])){this[_0x7edd('0x3c')](_0x2b3780[_0x7edd('0x41')]);if(this['channels'][_0x2b3780['secondtransfereruniqueid']]){this[_0x7edd('0x8')][_0x2b3780[_0x7edd('0x42')]][_0x7edd('0x1c')]=!![];this[_0x7edd('0x8')][_0x2b3780['transfertargetuniqueid']]=this[_0x7edd('0x8')][_0x2b3780[_0x7edd('0x42')]];delete this[_0x7edd('0x8')][_0x2b3780['secondtransfereruniqueid']];}}else if(!_['isNil'](this[_0x7edd('0x8')][_0x2b3780[_0x7edd('0x43')]])){this[_0x7edd('0x3c')](_0x2b3780[_0x7edd('0x43')]);if(this['channels'][_0x2b3780['origtransfereruniqueid']]){this['channels'][_0x2b3780[_0x7edd('0x44')]]['attended']=!![];this['channels'][_0x2b3780[_0x7edd('0x41')]]=this[_0x7edd('0x8')][_0x2b3780[_0x7edd('0x44')]];delete this[_0x7edd('0x8')][_0x2b3780[_0x7edd('0x44')]];}}}catch(_0x2e6b86){logger[_0x7edd('0x2e')](_0x7edd('0x45'),_0x2e6b86[_0x7edd('0x30')]);}};Acw[_0x7edd('0x13')][_0x7edd('0x46')]=function(_0x17c26a){try{if(this[_0x7edd('0x8')][_0x17c26a['transfereruniqueid']]){logger[_0x7edd('0x1a')](_0x7edd('0x47'),JSON['stringify'](_0x17c26a[_0x7edd('0x48')]));this['startAcw'](_0x17c26a[_0x7edd('0x48')]);}else if(this[_0x7edd('0x8')][_0x17c26a[_0x7edd('0x49')]]){logger[_0x7edd('0x1a')](_0x7edd('0x4a'),JSON[_0x7edd('0x33')](_0x17c26a[_0x7edd('0x49')]));this[_0x7edd('0x3c')](_0x17c26a['transfererlinkedid']);}}catch(_0xd02309){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0xd02309[_0x7edd('0x30')]);}};Acw[_0x7edd('0x13')][_0x7edd('0xe')]=function(_0x349639){try{if(this[_0x7edd('0x5')][_0x349639[_0x7edd('0x14')]]&&this[_0x7edd('0x5')][_0x349639[_0x7edd('0x14')]][_0x7edd('0x4b')]===_0x7edd('0x4c')){if(this['agents'][_0x349639['interface']]){logger[_0x7edd('0x1a')](_0x7edd('0x4d'),_0x349639[_0x7edd('0x29')],_0x349639['interface'],_0x349639[_0x7edd('0x14')]);return RpcUser[_0x7edd('0x1e')](this[_0x7edd('0x6')][_0x349639['interface']],'Auto-Pause',_0x349639[_0x7edd('0x29')]);}}}catch(_0x5a1d25){logger['error'](_0x7edd('0x4e'),_0x5a1d25['message']);}};module[_0x7edd('0x4f')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 1f5892d..779d038 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 _0x28de=['username','password','keepConnected','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionQueueSummary','catch','exports','bluebird','../../config/logger','ami','../../config/environment','port','asterisk'];(function(_0x413f87,_0x12c5c0){var _0xb4ae8c=function(_0x3a4910){while(--_0x3a4910){_0x413f87['push'](_0x413f87['shift']());}};_0xb4ae8c(++_0x12c5c0);}(_0x28de,0x186));var _0xe28d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x28de[_0x321bb2];return _0x9c12ed;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xe28d('0x0'));var util=require('util');var logger=require(_0xe28d('0x1'))(_0xe28d('0x2'));var config=require(_0xe28d('0x3'));var ami=new Manager(config['asterisk'][_0xe28d('0x4')],config[_0xe28d('0x5')]['ip'],config['asterisk'][_0xe28d('0x6')],config[_0xe28d('0x5')][_0xe28d('0x7')],!![]);ami[_0xe28d('0x8')]();ami[_0xe28d('0x9')]=BPromise[_0xe28d('0xa')](ami['action']);function error(_0x51f91a){logger[_0xe28d('0xb')](util[_0xe28d('0xc')](_0xe28d('0xd'),config[_0xe28d('0x5')][_0xe28d('0x6')],config[_0xe28d('0x5')]['ip'],config[_0xe28d('0x5')]['port'],util[_0xe28d('0xe')](_0x51f91a,![],null)));}function close(){logger[_0xe28d('0xb')](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xe28d('0x5')]['username'],config['asterisk']['ip'],config[_0xe28d('0x5')][_0xe28d('0x4')]));}ami[_0xe28d('0xf')]=function(){return function(){return ami[_0xe28d('0x9')]({'action':_0xe28d('0x10')});};};ami[_0xe28d('0x11')]=function(){return function(){return ami[_0xe28d('0x9')]({'action':'devicestatelist'});};};ami[_0xe28d('0x12')]=function(){return function(){return ami[_0xe28d('0x9')]({'action':_0xe28d('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0xe28d('0x14')});};};ami[_0xe28d('0x15')]=function(){return function(){return ami[_0xe28d('0x9')]({'action':'coreshowchannels'});};};function connect(){logger[_0xe28d('0x16')](util[_0xe28d('0xc')](_0xe28d('0x17'),config['asterisk'][_0xe28d('0x6')],config[_0xe28d('0x5')]['ip'],config[_0xe28d('0x5')][_0xe28d('0x4')]));ami[_0xe28d('0x18')](_0xe28d('0xb'),error);ami['once'](_0xe28d('0x19'),close);}ami['on'](_0xe28d('0x1a'),connect);ami['on'](_0xe28d('0x1b'),function(_0xcd6a5a){logger[_0xe28d('0x16')](util['format'](_0xe28d('0x1c'),config[_0xe28d('0x5')]['username'],config['asterisk']['ip'],config['asterisk'][_0xe28d('0x4')],util[_0xe28d('0xe')](_0xcd6a5a,![],null)));});ami['on'](_0xe28d('0x1d'),function(){logger[_0xe28d('0x16')](util[_0xe28d('0xc')](_0xe28d('0x1e'),config[_0xe28d('0x5')]['username'],config[_0xe28d('0x5')]['ip'],config['asterisk'][_0xe28d('0x4')]));return Promise[_0xe28d('0x1f')]()[_0xe28d('0x20')](ami[_0xe28d('0xf')]())[_0xe28d('0x20')](ami['actionDeviceStateList']())[_0xe28d('0x20')](ami[_0xe28d('0x12')]())['then'](ami[_0xe28d('0x21')]())[_0xe28d('0x20')](ami[_0xe28d('0x15')]())[_0xe28d('0x22')](function(_0xbba772){logger[_0xe28d('0xb')]('[ami.js][fullybooted]',util[_0xe28d('0xe')](_0xbba772,{'showHidden':![],'depth':null}));});});ami[_0xe28d('0x18')](_0xe28d('0xb'),error);ami[_0xe28d('0x18')](_0xe28d('0x19'),close);module[_0xe28d('0x23')]=ami; \ No newline at end of file +var _0xc756=['catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/environment','asterisk','port','username','keepConnected','Action','promisify','inspect','error','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','info','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then'];(function(_0x26ac72,_0x482803){var _0x25fc90=function(_0x5f063c){while(--_0x5f063c){_0x26ac72['push'](_0x26ac72['shift']());}};_0x25fc90(++_0x482803);}(_0xc756,0x147));var _0x6c75=function(_0x3cc3ed,_0x1d9a7e){_0x3cc3ed=_0x3cc3ed-0x0;var _0x2e36e1=_0xc756[_0x3cc3ed];return _0x2e36e1;};'use strict';var Manager=require(_0x6c75('0x0'));var BPromise=require(_0x6c75('0x1'));var util=require(_0x6c75('0x2'));var logger=require('../../config/logger')('ami');var config=require(_0x6c75('0x3'));var ami=new Manager(config[_0x6c75('0x4')][_0x6c75('0x5')],config['asterisk']['ip'],config[_0x6c75('0x4')][_0x6c75('0x6')],config[_0x6c75('0x4')]['password'],!![]);ami[_0x6c75('0x7')]();ami[_0x6c75('0x8')]=BPromise[_0x6c75('0x9')](ami['action']);function error(_0x1b3f24){logger['error'](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x6c75('0x4')][_0x6c75('0x6')],config[_0x6c75('0x4')]['ip'],config[_0x6c75('0x4')][_0x6c75('0x5')],util[_0x6c75('0xa')](_0x1b3f24,![],null)));}function close(){logger[_0x6c75('0xb')](util[_0x6c75('0xc')](_0x6c75('0xd'),config[_0x6c75('0x4')][_0x6c75('0x6')],config[_0x6c75('0x4')]['ip'],config[_0x6c75('0x4')][_0x6c75('0x5')]));}ami[_0x6c75('0xe')]=function(){return function(){return ami[_0x6c75('0x8')]({'action':'sipshowregistry'});};};ami[_0x6c75('0xf')]=function(){return function(){return ami[_0x6c75('0x8')]({'action':_0x6c75('0x10')});};};ami[_0x6c75('0x11')]=function(){return function(){return ami[_0x6c75('0x8')]({'action':'sippeerstatus'});};};ami[_0x6c75('0x12')]=function(){return function(){return ami[_0x6c75('0x8')]({'action':_0x6c75('0x13')});};};ami[_0x6c75('0x14')]=function(){return function(){return ami['Action']({'action':_0x6c75('0x15')});};};function connect(){logger['info'](util['format'](_0x6c75('0x16'),config[_0x6c75('0x4')][_0x6c75('0x6')],config[_0x6c75('0x4')]['ip'],config[_0x6c75('0x4')][_0x6c75('0x5')]));ami[_0x6c75('0x17')](_0x6c75('0xb'),error);ami['once'](_0x6c75('0x18'),close);}ami['on'](_0x6c75('0x19'),connect);ami['on'](_0x6c75('0x1a'),function(_0x5d31c5){logger['info'](util['format'](_0x6c75('0x1b'),config['asterisk'][_0x6c75('0x6')],config[_0x6c75('0x4')]['ip'],config[_0x6c75('0x4')][_0x6c75('0x5')],util[_0x6c75('0xa')](_0x5d31c5,![],null)));});ami['on'](_0x6c75('0x1c'),function(){logger[_0x6c75('0x1d')](util['format'](_0x6c75('0x1e'),config[_0x6c75('0x4')][_0x6c75('0x6')],config['asterisk']['ip'],config[_0x6c75('0x4')]['port']));return Promise[_0x6c75('0x1f')]()[_0x6c75('0x20')](ami[_0x6c75('0xe')]())[_0x6c75('0x20')](ami[_0x6c75('0xf')]())[_0x6c75('0x20')](ami[_0x6c75('0x11')]())[_0x6c75('0x20')](ami['actionQueueSummary']())[_0x6c75('0x20')](ami[_0x6c75('0x14')]())[_0x6c75('0x21')](function(_0x168b61){logger['error'](_0x6c75('0x22'),util[_0x6c75('0xa')](_0x168b61,{'showHidden':![],'depth':null}));});});ami['once'](_0x6c75('0xb'),error);ami['once'](_0x6c75('0x18'),close);module[_0x6c75('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 9e462d9..92d4ff1 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 _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x55c979,_0x36c5f0){var _0x690107=function(_0xa61dad){while(--_0xa61dad){_0x55c979['push'](_0x55c979['shift']());}};_0x690107(++_0x36c5f0);}(_0xe706,0xa3));var _0x6e70=function(_0x337dd9,_0x54e3f3){_0x337dd9=_0x337dd9-0x0;var _0x20f4fc=_0xe706[_0x337dd9];return _0x20f4fc;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file +var _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x22e2b1,_0x26ff20){var _0x23f9ef=function(_0x4f6528){while(--_0x4f6528){_0x22e2b1['push'](_0x22e2b1['shift']());}};_0x23f9ef(++_0x26ff20);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x47f7f5,_0xa5caf){_0x47f7f5=_0x47f7f5-0x0;var _0x52fe6b=_0xbdb7[_0x47f7f5];return _0x52fe6b;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index b686cb2..502c488 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 _0x5895=['dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','outboundRejectCallsDay','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[callProgressDetecting]','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Drop\x20in\x20this\x20interval','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','getDataPredictiveOld','abandonmentRate','[CatchErlangB]','loggedIn','outboundQueuePauses','predictiveIntervalPauses','check\x20failure','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','dialRecallMeTimeout','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','temp','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','checkContactEmpty','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','checkContactLowerLimitOriginate','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','Umin\x20=\x20','util','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','booked','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','env','127.0.0.1','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startProgressive','queueBookedRR','queuesSummary','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','voice_queue:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','erlangAbandonmentRate','getSeconds','name','startProgressive\x20value\x20cleared','startPredictive','handlePredictive','error','stack','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','statedesc','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','[ifTime][Action]','isTrunkReachable','active','SIP/%s','reachable','status','unmonitored','prototype','checkIsTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','iftime\x20%s,%s','interval','content','indexOf','catch','command','true','all','then','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','loopCampaigns','resetActiveCalls','syncCampaigns','undefined','resolve','launchHandleIvr','[syncCampaigns]','dialMethod','progressive','power','handlePower','predictive','Queue','method\x20not\x20recognized','dialTimezone','dialGlobalInterval','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_INTERVAL','AMI\x20IfTime','Error','syncAgentConnect','queue','uniqueid','ivr','updateOriginated','answertime','outboundAnswerCallsDay','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','createHistory','moveContactManagedDialer','[syncAgentComplete]','droptime','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','state','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','minutes','ListId','VoiceQueueId','CampaignId','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','dropreason','CALLEREXIT','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','Abandoned','[syncAgentComplete][createHistory][11]','channel','actionid','roundrobin','isNil','locked','stateinterface','rrmemory','queueBooked','merge','idHopper','paused','strategy','run','ContactId','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock3]','responsetime','getQueue','response','callProgressDetecting','variable','amdstatus','exten','dialAMDActive','outboundAnswerAgiCallsDay','membername','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','countmachineretry','countcongestionretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','HANGUP','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','AMD','[syncAgentComplete][createHistory][0]','reason\x2019\x20machine....','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','online','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','enqueue','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','UserId','[emptyContact]','handlePreviewRecallNotifications','handleIvr','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','isOutboundQueue','dialQueueTimeout','NONE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','XMD-','toUpper','Trunk','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','dialPrefix','trim','dialCutDigit','substring','xcally-motion-dialer','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','countbusyretry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Machine]','dialAgentRejectMaxRetry'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0x5895,0x81));var _0x5589=function(_0x43962b,_0x4f7647){_0x43962b=_0x43962b-0x0;var _0x577059=_0x5895[_0x43962b];return _0x577059;};'use strict';var util=require(_0x5589('0x0'));var _=require(_0x5589('0x1'));var uuid=require(_0x5589('0x2'));var moment=require(_0x5589('0x3'));var rr=require('rr');var Redis=require(_0x5589('0x4'));var utils=require(_0x5589('0x5'));var hopperUtils=require(_0x5589('0x6'));var ut=require(_0x5589('0x7'));var config=require(_0x5589('0x8'));var logger=require(_0x5589('0x9'))('dialer');var loggerBooked=require(_0x5589('0x9'))(_0x5589('0xa'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0x5589('0x9'))('syncQueueSummary');var ami=require(_0x5589('0xb'));config[_0x5589('0xc')]=_[_0x5589('0xd')](config[_0x5589('0xc')],{'host':_0x5589('0xe'),'port':0x18eb});var io=require(_0x5589('0xf'))(new Redis(config[_0x5589('0xc')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x5589('0x10'));var RpcSetting=require(_0x5589('0x11'));var Interval=require(_0x5589('0x12'));var Action=require(_0x5589('0x13'));var History=require(_0x5589('0x14'));var Final=require(_0x5589('0x15'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require('./models/hangup');var ipAgi=process[_0x5589('0x16')]['XCALLY_IP_AGI']||_0x5589('0x17');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x2bf15a){this[_0x5589('0x18')]=this[_0x5589('0x18')]?this[_0x5589('0x18')][_0x5589('0x19')](_0x2bf15a):_0x2bf15a();};function Dialer(_0x1646c7,_0x1521c7){this[_0x5589('0x1a')]=new Sequence();this[_0x5589('0x1b')]=_0x1521c7;this[_0x5589('0x1c')]=_0x1646c7[_0x5589('0x1c')];this[_0x5589('0x1d')]=_0x1646c7[_0x5589('0x1d')];this[_0x5589('0x1e')]=_0x1646c7[_0x5589('0x1e')];this[_0x5589('0x1f')]=_0x1646c7[_0x5589('0x1f')];this[_0x5589('0x20')]=config[_0x5589('0x20')]||0x2;this['channels']={};this[_0x5589('0x21')]={};this[_0x5589('0x22')]={};this[_0x5589('0x23')]={};this[_0x5589('0x24')]={};this['startPredictive']={};this[_0x5589('0x25')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0x5589('0x26')]={};this[_0x5589('0x27')]={};ami['on'](_0x5589('0x28'),this['syncAgentConnect'][_0x5589('0x29')](this));ami['on'](_0x5589('0x2a'),this[_0x5589('0x2b')][_0x5589('0x29')](this));ami['on'](_0x5589('0x2c'),this[_0x5589('0x2d')][_0x5589('0x29')](this));ami['on'](_0x5589('0x2e'),this[_0x5589('0x2f')]['bind'](this));ami['on'](_0x5589('0x30'),this[_0x5589('0x31')][_0x5589('0x29')](this));ami['on'](_0x5589('0x32'),this[_0x5589('0x33')]['bind'](this));ami['on'](_0x5589('0x34'),this[_0x5589('0x35')][_0x5589('0x29')](this));ami['on'](_0x5589('0x36'),this[_0x5589('0x37')][_0x5589('0x29')](this));ami['on'](_0x5589('0x38'),this[_0x5589('0x39')][_0x5589('0x29')](this));ami['on']('queuemember',this[_0x5589('0x3a')][_0x5589('0x29')](this));ami['on'](_0x5589('0x3b'),this[_0x5589('0x3c')][_0x5589('0x29')](this));this['loopCampaigns']();this[_0x5589('0x3d')]();RpcSetting[_0x5589('0x3e')]()['then'](function(_0x236e34){previewRecallmeReminderInterval=_0x236e34[_0x5589('0x3f')];});}function isNotNull(_0x59c46e){return _0x59c46e!==null&&!_[_0x5589('0x40')](_0x59c46e);}function msgResponse(_0xbe9421,_0x2c9f9b,_0x25e15e){return{'action':_0xbe9421,'response':_0x2c9f9b,'message':_0x25e15e,'stack':_0x25e15e};}function emit(_0x369ce7,_0x8167c9,_0x3cf307){io['to'](_0x369ce7)[_0x5589('0x41')](_0x8167c9,_0x3cf307);}function emitOutboundVoiceQueueSummary(_0x13cb30){if(_0x13cb30[_0x5589('0x42')]===_0x5589('0x43')){logger[_0x5589('0x44')](_0x5589('0x45'),util[_0x5589('0x46')](_0x13cb30,{'showHidden':![],'depth':null}));emit(util[_0x5589('0x47')](_0x5589('0x48'),_0x13cb30['name']),_0x5589('0x49'),_0x13cb30);}}function checkGetDataPredictive(_0x30e2f2){if(isNotNull(_0x30e2f2)&&!_['isEmpty'](_0x30e2f2)){loggerPredictive[_0x5589('0x4a')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x5589('0x4a')](_0x5589('0x4b'),_0x30e2f2[_0x5589('0x4c')]);loggerPredictive[_0x5589('0x4a')](_0x5589('0x4d'),_0x30e2f2[_0x5589('0x4e')]);loggerPredictive[_0x5589('0x4a')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x30e2f2[_0x5589('0x4f')]);loggerPredictive[_0x5589('0x4a')](_0x5589('0x50'),_0x30e2f2[_0x5589('0x51')]);loggerPredictive[_0x5589('0x4a')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x30e2f2['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x5589('0x4a')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x30e2f2[_0x5589('0x52')]);loggerPredictive[_0x5589('0x4a')](_0x5589('0x53'));if(_0x30e2f2['predictiveIntervalTotalCalls']>0x0){if(!_[_0x5589('0x40')](_0x30e2f2[_0x5589('0x52')])&&_0x30e2f2['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x5589('0x4a')](_0x5589('0x54'));if(!_[_0x5589('0x40')](_0x30e2f2[_0x5589('0x55')])&&_0x30e2f2[_0x5589('0x55')]>0x0){return!![];}loggerPredictive[_0x5589('0x4a')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x5589('0x4a')](_0x5589('0x56'));}}else{loggerPredictive['info'](_0x5589('0x57'));}return![];}function mergeDataErlangB(_0x3be4bc){return function(_0x59874f){loggerPredictive[_0x5589('0x4a')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x5589('0x4a')](_0x5589('0x58'),_0x59874f[_0x5589('0x59')]);loggerPredictive[_0x5589('0x4a')](_0x5589('0x5a'),_0x59874f[_0x5589('0x5b')]);loggerPredictive['info'](_0x5589('0x5c'),_0x59874f['erlangAbandonmentRate']);loggerPredictive[_0x5589('0x4a')](_0x5589('0x5d'),_0x59874f[_0x5589('0x5e')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x59874f[_0x5589('0x5f')]);loggerPredictive[_0x5589('0x4a')](_0x5589('0x53'));_['merge'](_0x3be4bc,_0x59874f);};}function ifInterval(_0x407dac,_0x5d04be){if(_[_0x5589('0x40')](_0x5d04be)){return![];}return utils[_0x5589('0x60')](undefined,_0x5d04be)<_0x407dac*0x3c;}function clearPredictiveAttributes(_0x480435){if(_0x480435[_0x5589('0x25')]){_0x480435['startProgressive']=undefined;loggerPredictive[_0x5589('0x44')](_0x480435[_0x5589('0x61')],_0x5589('0x62'));}if(_0x480435[_0x5589('0x63')]){_0x480435['startPredictive']=undefined;loggerPredictive[_0x5589('0x44')](_0x480435[_0x5589('0x61')],'startPredictive\x20value\x20cleared');}if(_0x480435[_0x5589('0x64')]){clearInterval(_0x480435['handlePredictive']);_0x480435[_0x5589('0x64')]=undefined;loggerPredictive[_0x5589('0x44')](_0x480435[_0x5589('0x61')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x1e82ed,_0x54267b){return function(_0x51393d){loggerPredictive[_0x5589('0x65')](_0x54267b[_0x5589('0x61')],_0x1e82ed);loggerPredictive['error'](_0x51393d[_0x5589('0x66')]);clearPredictiveAttributes(_0x54267b);};}function loggerCatch(_0x532e24){return function(_0x13b876){logger[_0x5589('0x65')](_0x532e24,util[_0x5589('0x46')](_0x13b876,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x1a5efb,_0xe05eb5,_0x3502c2){return function(_0x1182d8){utils['checkContactLowerLimitOriginate'](_0xe05eb5,_0x3502c2,0x0);logger[_0x5589('0x65')](_0x1a5efb,util[_0x5589('0x46')](_0x1182d8,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x223f29){return function(_0x28d78c){if(isNotNull(_0x28d78c)&&isNotNull(_0x28d78c[0x0])){if(_0x28d78c[0x0][_0x5589('0x67')]>0x0){_0x223f29[_0x5589('0x68')]=utils[_0x5589('0x69')][_0x5589('0x6a')];logger[_0x5589('0x4a')](_0x5589('0x6b')+_0x223f29[_0x5589('0x61')],_0x28d78c[0x0][_0x5589('0x67')],'contacts');}else{_0x223f29[_0x5589('0x68')]=utils[_0x5589('0x69')][_0x5589('0x6c')];logger[_0x5589('0x4a')](_0x5589('0x6d')+_0x223f29[_0x5589('0x61')]);}}};}function createObjHistory(_0x4e63fb,_0x2a1df7,_0xb37818,_0x4df8aa,_0x56b903){_0x4e63fb[_0x5589('0x68')]=_0xb37818;var _0x510b8c=new Action(_0x4e63fb,_0x2a1df7);var _0x787f35=new History(_0x510b8c);_0x787f35['state']=_0x4df8aa;_0x787f35[_0x5589('0x6e')]=_0x56b903;_0x787f35[_0x5589('0x6f')]=_0x510b8c[_0x5589('0x70')];return _0x787f35;}function unlockQueueStatus(_0x572f31,_0x212a48){setTimeout(function(){if(_[_0x5589('0x40')](_0x572f31[_0x5589('0x71')])){loggerBooked[_0x5589('0x65')]('[unlockQueueStatus][undefined]',_0x212a48);}_0x572f31[_0x5589('0x71')]=!![];loggerBooked[_0x5589('0x4a')](_0x5589('0x72'),_0x212a48,JSON[_0x5589('0x73')](_[_0x5589('0x74')](_0x572f31,[_0x5589('0x61'),_0x5589('0x71')])));},0x1f3);}function checkInterval(_0x427cfa){return function(){if(!isNotNull(_0x427cfa[_0x5589('0x75')])){_0x427cfa[_0x5589('0x68')]=utils[_0x5589('0x69')][_0x5589('0x76')];throw _0x427cfa['name']+_0x5589('0x77');}if(!isNotNull(_0x427cfa[_0x5589('0x75')]['Intervals'])){_0x427cfa[_0x5589('0x68')]=utils[_0x5589('0x69')][_0x5589('0x76')];throw _0x427cfa[_0x5589('0x61')]+_0x5589('0x77');}if(!isNotNull(_[_0x5589('0x78')](_0x427cfa['Interval'][_0x5589('0x79')]))){_0x427cfa[_0x5589('0x68')]=utils['CAMPAIGN_STATUS'][_0x5589('0x76')];throw _0x427cfa[_0x5589('0x61')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x411fd5){return function(){if(!utils['isIVRCampaignActive'](_0x411fd5)){_0x411fd5['message']=utils[_0x5589('0x69')]['INACTIVE'];throw _0x411fd5[_0x5589('0x61')]+_0x5589('0x7a');}};}function emitCampaignSummary(_0x164cb3){if(utils[_0x5589('0x7b')](_0x164cb3)){emit(util[_0x5589('0x47')](_0x5589('0x7c'),_0x164cb3[_0x5589('0x61')]),_0x5589('0x7d'),_0x164cb3);}}function loggerCatchQueueSummary(_0x551259,_0x49f1ee){return function(_0x58e2be){clearPredictiveAttributes(_0x49f1ee);emitCampaignSummary(_0x49f1ee);loggerSyncQueueSummary[_0x5589('0x44')](_0x551259,util[_0x5589('0x46')](_0x58e2be,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x33882){if(_0x33882[_0x5589('0x7e')]){if(_0x33882[_0x5589('0x7f')]===0x0){_0x33882[_0x5589('0x7e')]=![];_0x33882['message']=utils['CAMPAIGN_STATUS'][_0x5589('0x80')];loggerSyncQueueSummary[_0x5589('0x44')](_0x5589('0x81'),_0x33882[_0x5589('0x61')],_0x5589('0x82'));}else{_0x33882[_0x5589('0x68')]=utils[_0x5589('0x69')]['DISACTIVED'];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x33882[_0x5589('0x61')],_0x5589('0x83'));}emitCampaignSummary(_0x33882);}}function myreject(_0x37b8e9){return function(_0x1d606e){return _0x37b8e9(msgResponse(_0x5589('0x84'),'Error',JSON[_0x5589('0x73')](_0x1d606e)));};}Dialer['prototype'][_0x5589('0x85')]=function(_0x49eaab){return!_[_0x5589('0x40')](_0x49eaab)&&_0x49eaab&&!_[_0x5589('0x40')](_0x49eaab[_0x5589('0x61')])&&!_[_0x5589('0x40')](_0x49eaab['active'])&&_0x49eaab[_0x5589('0x86')]&&(this[_0x5589('0x1f')][util[_0x5589('0x47')](_0x5589('0x87'),_0x49eaab[_0x5589('0x61')])]['status']===_0x5589('0x88')||this[_0x5589('0x1f')][util[_0x5589('0x47')](_0x5589('0x87'),_0x49eaab[_0x5589('0x61')])][_0x5589('0x89')]===_0x5589('0x8a'));};Dialer[_0x5589('0x8b')][_0x5589('0x8c')]=function(_0x5c9ca7){var _0x49fded=this;return function(){if(!_0x49fded[_0x5589('0x85')](_0x5c9ca7['Trunk'])){if(!_0x49fded[_0x5589('0x85')](_0x5c9ca7[_0x5589('0x8d')])){_0x5c9ca7[_0x5589('0x68')]=utils[_0x5589('0x69')][_0x5589('0x8e')];throw _0x5c9ca7['name']+_0x5589('0x8f');}}};};Dialer[_0x5589('0x8b')][_0x5589('0x90')]=function(_0x17cff2,_0x152982,_0x1faf44,_0x499239){var _0x54f5ad=this;return function(){var _0x3450e6=!![];return _0x54f5ad[_0x5589('0x91')](_0x17cff2,_0x152982,_0x1faf44,_0x499239,_0x3450e6);};};Dialer[_0x5589('0x8b')][_0x5589('0x92')]=function(_0x2737d7,_0x15701a,_0x1e4f8d,_0xe7769c){var _0x5c8b73=this;return function(){var _0x178c27=![];return _0x5c8b73[_0x5589('0x91')](_0x2737d7[_0x5589('0x79')],_0x15701a,_0x1e4f8d,_0xe7769c,_0x178c27);};};Dialer[_0x5589('0x8b')]['ifTimeIvr']=function(_0x51ebb0,_0x5a2819,_0xdb8226,_0x28c5b3,_0x328b3f){var _0xef4670=[];return new Promise(function(_0x53e2cb,_0x50e390){if(!isNotNull(_0x51ebb0)){_0x28c5b3['message']=utils[_0x5589('0x69')][_0x5589('0x76')];return _0x50e390(msgResponse(_0x5589('0x93'),_0x5589('0x94'),_0xdb8226+_0x5589('0x95')));}if(_[_0x5589('0x78')](_0x51ebb0)){_0x28c5b3[_0x5589('0x68')]=utils['CAMPAIGN_STATUS'][_0x5589('0x96')];return _0x50e390(msgResponse(_0x5589('0x93'),_0x5589('0x94'),_0xdb8226+_0x5589('0x97')));}if(_0x5a2819&&_[_0x5589('0x40')](config[_0x5589('0x98')][_0x5a2819])){_0x28c5b3['message']=utils[_0x5589('0x69')][_0x5589('0x99')];return _0x50e390(msgResponse(_0x5589('0x93'),_0x5589('0x94'),_0xdb8226+_0x5589('0x9a')+_0x5a2819));}if(_[_0x5589('0x9b')](_0x51ebb0)){for(var _0x42da33=0x0;_0x42da33<_0x51ebb0[_0x5589('0x9c')];_0x42da33+=0x1){_0xef4670[_0x5589('0x9d')](ami[_0x5589('0x9e')]({'action':'command','command':util[_0x5589('0x47')](_0x5589('0x9f'),_0x51ebb0[_0x42da33][_0x5589('0xa0')],!_[_0x5589('0x40')](config[_0x5589('0x98')][_0x5a2819])?_0x5a2819:'')})['then'](function(_0xc06cda){return _0xc06cda[_0x5589('0xa1')][_0x5589('0xa2')]('true')>=0x0;})[_0x5589('0xa3')](myreject(_0x50e390)));}}else{_0xef4670[_0x5589('0x9d')](ami[_0x5589('0x9e')]({'action':_0x5589('0xa4'),'command':util[_0x5589('0x47')](_0x5589('0x9f'),_0x51ebb0,!_['isUndefined'](config[_0x5589('0x98')][_0x5a2819])?_0x5a2819:'')})['then'](function(_0x4d75b6){return _0x4d75b6[_0x5589('0xa1')][_0x5589('0xa2')](_0x5589('0xa5'))>=0x0;})[_0x5589('0xa3')](myreject(_0x50e390)));}Promise[_0x5589('0xa6')](_0xef4670)[_0x5589('0xa7')](function(_0x5265da){var _0x41c9b6=_[_0x5589('0xa8')](_0x5265da);if(_0x41c9b6){return _0x53e2cb(_0x41c9b6);}else{_0x28c5b3['message']=_0x328b3f?utils[_0x5589('0x69')][_0x5589('0xa9')]:utils[_0x5589('0x69')]['OVERTIME_INTERVAL'];return _0x50e390(msgResponse(_0x5589('0xaa'),_0x5589('0x94'),_0x5589('0xab')+_0x328b3f+'\x20'+_0xdb8226+_0x5589('0xac')+util[_0x5589('0x46')](_0x51ebb0,{'showHidden':![],'depth':null})+_0x5589('0xad')+_0x5a2819));}})[_0x5589('0xa3')](function(_0x184086){return _0x50e390(msgResponse(_0x5589('0x93'),'Failure',JSON[_0x5589('0x73')](_0x184086)));});});};Dialer[_0x5589('0x8b')][_0x5589('0xae')]=function(){var _0x4f860e=this;return cmHopper[_0x5589('0xaf')]({'active':![]},{'where':{'active':!![]}})[_0x5589('0xa7')](function(){setInterval(function(){_0x4f860e[_0x5589('0xb0')]();},0x3e8);});};Dialer[_0x5589('0x8b')][_0x5589('0xb0')]=function(){var _0x22de38=this;var _0x1419e0;for(var _0x13a778 in this[_0x5589('0x1d')]){if(typeof this['campaigns'][_0x13a778]!==_0x5589('0xb1')){_0x1419e0=this[_0x5589('0x1d')][_0x13a778];if(utils['isIVRCampaign'](_0x1419e0)&&utils['isIVRCampaignActive'](_0x1419e0)){_0x1419e0[_0x5589('0x7e')]=!![];Promise[_0x5589('0xb2')]()[_0x5589('0xa7')](checkIsIVRCampaignActive(_0x1419e0))['then'](checkInterval(_0x1419e0))[_0x5589('0xa7')](_0x22de38[_0x5589('0x8c')](_0x1419e0))[_0x5589('0xa7')](_0x22de38[_0x5589('0x90')](_0x1419e0['dialGlobalInterval'],_0x1419e0['dialTimezone'],_0x1419e0[_0x5589('0x61')],_0x1419e0))[_0x5589('0xa7')](_0x22de38['checkIfTimeIntervals'](_0x1419e0[_0x5589('0x75')],_0x1419e0['dialTimezone'],_0x1419e0[_0x5589('0x61')],_0x1419e0))[_0x5589('0xa7')](_0x22de38[_0x5589('0xb3')](_0x1419e0))[_0x5589('0xa3')](loggerCatchQueueSummary(_0x5589('0xb4'),_0x1419e0));}else{notSendMessagesCampaign(_0x1419e0);}}}};Dialer[_0x5589('0x8b')]['checkDialMethod']=function(_0x56ae64){if(_0x56ae64[_0x5589('0xb5')]!=='predictive'){clearPredictiveAttributes(_0x56ae64);}switch(_0x56ae64['dialMethod']){case _0x5589('0xb6'):this['handlePower'](_0x56ae64,0x1);break;case _0x5589('0xb7'):this[_0x5589('0xb8')](_0x56ae64,_0x56ae64['dialPowerLevel']);break;case _0x5589('0xb9'):this['predictive'](_0x56ae64);break;case _0x5589('0xa'):this[_0x5589('0xb8')](_0x56ae64,0x1);break;default:logger['error'](_0x5589('0xba'),_0x56ae64[_0x5589('0x61')],_0x5589('0xbb'));}};Dialer[_0x5589('0x8b')]['ifTime']=function(_0x4d0816,_0x1d6d11){var _0x2e0200=_0x4d0816[_0x5589('0xbc')];var _0x359a60=_0x1d6d11?_0x4d0816[_0x5589('0xbd')]:_0x4d0816[_0x5589('0x75')][_0x5589('0x79')];logger[_0x5589('0xbe')](_0x5589('0xbf'),_0x359a60,_0x2e0200,_0x4d0816[_0x5589('0x61')],util[_0x5589('0x47')](_0x5589('0xc0'),_0x4d0816[_0x5589('0x61')],_0x4d0816['id']));var _0x470a05=null;return Interval[_0x5589('0xc1')](_0x359a60,_0x2e0200)['then'](function(_0x1f5a48){if(_0x1f5a48===!![]){return _0x1f5a48;}else{_0x4d0816[_0x5589('0x68')]=_0x1d6d11?utils[_0x5589('0x69')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x5589('0x69')][_0x5589('0xc2')];_0x470a05=msgResponse('[ifTime][promiseAll]','Failure','Global:\x20'+_0x1d6d11+'\x20'+_0x4d0816[_0x5589('0x61')]+_0x5589('0xac')+util['inspect'](_0x359a60,{'showHidden':![],'depth':null})+_0x5589('0xad')+_0x2e0200);}if(_0x470a05!==null){logger[_0x5589('0xbe')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x470a05);_0x470a05['isGlobal']=_0x1d6d11;throw _0x470a05;}})[_0x5589('0xa3')](function(_0x2d734a){logger['error'](_0x5589('0xc3'),_0x2d734a);throw msgResponse(_0x5589('0x84'),_0x5589('0xc4'),util[_0x5589('0x46')](_0x2d734a,{'showHidden':![],'depth':null}));});};Dialer[_0x5589('0x8b')][_0x5589('0xc5')]=function(_0x17d1c8){if(this['voiceQueues'][_0x17d1c8[_0x5589('0xc6')]]){if(this[_0x5589('0x23')][_0x17d1c8[_0x5589('0xc7')]]&&this[_0x5589('0x23')][_0x17d1c8['uniqueid']][_0x5589('0x42')]!==_0x5589('0xc8')){this[_0x5589('0xc9')](this[_0x5589('0x1c')][_0x17d1c8[_0x5589('0xc6')]]);this[_0x5589('0x23')][_0x17d1c8[_0x5589('0xc7')]][_0x5589('0xca')]=moment()[_0x5589('0x47')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x5589('0x8b')][_0x5589('0x2f')]=function(_0x184582){var _0x55613d=this[_0x5589('0x23')][_0x184582[_0x5589('0xc7')]];if(this[_0x5589('0x1c')][_0x184582[_0x5589('0xc6')]]){if(_0x55613d&&_0x55613d['type']!==_0x5589('0xc8')){delete this[_0x5589('0x23')][_0x184582[_0x5589('0xc7')]];this[_0x5589('0x1c')][_0x184582[_0x5589('0xc6')]][_0x5589('0xcb')]+=0x1;var _0x439544=new AgentComplete(_0x55613d,_0x184582);if(_0x184582[_0x5589('0xcc')]==='agent'){_0x439544[_0x5589('0xcd')]=this[_0x5589('0x1c')][_0x184582[_0x5589('0xc6')]][_0x5589('0xce')]&&this[_0x5589('0x1c')][_0x184582['queue']][_0x5589('0xcf')]?moment()['format'](_0x5589('0xd0')):undefined;}hopperUtils[_0x5589('0xd1')](_0x439544)[_0x5589('0xa3')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x5589('0xd2')](_0x439544)['catch'](loggerCatch(_0x5589('0xd3')));}}};Dialer[_0x5589('0x8b')][_0x5589('0x2b')]=function(_0x7f498f){var _0x6aa2cb=this[_0x5589('0x23')][_0x7f498f[_0x5589('0xc7')]];var _0x57d548=this;var _0x32f29b=![];var _0x23a6b7;var _0x408b37;if(this[_0x5589('0x1c')][_0x7f498f[_0x5589('0xc6')]]){if(_0x6aa2cb&&_0x6aa2cb[_0x5589('0x42')]!==_0x5589('0xc8')){delete this['uniqueId'][_0x7f498f[_0x5589('0xc7')]];this[_0x5589('0xc9')](this[_0x5589('0x1c')][_0x7f498f[_0x5589('0xc6')]]);_0x6aa2cb[_0x5589('0xd4')]=moment()[_0x5589('0x47')](_0x5589('0xd0'));var _0x465421=new QueueCallerAbandon(_0x6aa2cb,_0x7f498f);if(utils[_0x5589('0x60')](_0x6aa2cb['droptime'],_0x6aa2cb['responsetime'])>=_0x6aa2cb['dialQueueTimeout']){this[_0x5589('0x1c')][_0x7f498f[_0x5589('0xc6')]][_0x5589('0x4f')]+=0x1;this[_0x5589('0x1c')][_0x7f498f[_0x5589('0xc6')]][_0x5589('0xd5')]+=0x1;this['voiceQueues'][_0x7f498f[_0x5589('0xc6')]][_0x5589('0xd6')]+=0x1;_0x465421['state']=0xa;_0x465421[_0x5589('0x6e')]=_0x5589('0xd7');_0x465421['dropreason']=_0x5589('0xd8');_0x465421[_0x5589('0xcd')]=this[_0x5589('0x1c')][_0x7f498f[_0x5589('0xc6')]][_0x5589('0xce')]?moment()[_0x5589('0x47')](_0x5589('0xd0')):undefined;_0x465421[_0x5589('0xd9')]+=0x1;_0x465421[_0x5589('0xda')]+=0x1;_0x23a6b7=this[_0x5589('0x1c')][_0x7f498f[_0x5589('0xc6')]][_0x5589('0xdb')];_0x408b37=this[_0x5589('0x1c')][_0x7f498f[_0x5589('0xc6')]][_0x5589('0xdc')];hopperUtils[_0x5589('0xdd')](_0x465421,_0x465421[_0x5589('0xde')],_0x6aa2cb[_0x5589('0xdf')])['then'](function(_0x1a19a9){_0x32f29b=_0x1a19a9[_0x5589('0xe0')]==0x1;if(_0x465421['countdropretry']>=_0x57d548[_0x5589('0x1c')][_0x7f498f['queue']][_0x5589('0xe1')]){_0x57d548[_0x5589('0xe2')](_0x465421,_0x1a19a9['additional']);}else{hopperUtils[_0x5589('0xe3')]({'active':![],'countdropretry':_0x465421[_0x5589('0xd9')],'scheduledat':moment()['add'](_0x57d548[_0x5589('0x1c')][_0x7f498f[_0x5589('0xc6')]]['dialDropRetryFrequency'],_0x5589('0xe4'))[_0x5589('0x47')](_0x5589('0xd0')),'ContactId':_0x6aa2cb['ContactId'],'ListId':_0x6aa2cb[_0x5589('0xe5')],'VoiceQueueId':_0x6aa2cb[_0x5589('0xe6')]||undefined,'CampaignId':_0x6aa2cb[_0x5589('0xe7')]||undefined})[_0x5589('0xa3')](loggerCatch('[rescheduleContact][Drop]'));var _0x3a6303=new History(_0x465421);_0x3a6303[_0x5589('0xde')]=0xa;_0x3a6303[_0x5589('0x6e')]='Drop';_0x3a6303[_0x5589('0x70')]=moment()[_0x5589('0x47')](_0x5589('0xd0'));_0x3a6303[_0x5589('0x6f')]=_0x3a6303[_0x5589('0x70')];_0x3a6303[_0x5589('0xe8')]=_0x465421[_0x5589('0xe8')];_0x3a6303[_0x5589('0xe9')]=_0x465421[_0x5589('0xe9')];hopperUtils[_0x5589('0xd1')](_0x3a6303)['catch'](loggerCatch(_0x5589('0xea')));}})[_0x5589('0xa7')](function(){if(_0x32f29b)hopperUtils[_0x5589('0xeb')](_0x465421,_0x23a6b7,_0x408b37)[_0x5589('0xa7')](function(){return 0x1;});});}else{this[_0x5589('0x1c')][_0x7f498f['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x5589('0x1c')][_0x7f498f[_0x5589('0xc6')]][_0x5589('0xec')]+=0x1;_0x465421[_0x5589('0xde')]=0xb;_0x465421[_0x5589('0x6e')]='Abandoned';_0x465421[_0x5589('0xed')]=_0x5589('0xee');_0x465421[_0x5589('0xef')]+=0x1;_0x465421[_0x5589('0xda')]+=0x1;_0x23a6b7=this[_0x5589('0x1c')][_0x7f498f[_0x5589('0xc6')]]['dialAbandonedRetryFrequency'];_0x408b37=this[_0x5589('0x1c')][_0x7f498f[_0x5589('0xc6')]][_0x5589('0xdc')];hopperUtils['verifyAdditionalPhones'](_0x465421,_0x465421[_0x5589('0xde')],_0x6aa2cb['voiceQueue'])[_0x5589('0xa7')](function(_0x1e051d){if(_0x465421['countabandonedretry']>=_0x57d548[_0x5589('0x1c')][_0x7f498f[_0x5589('0xc6')]][_0x5589('0xf0')]){_0x57d548[_0x5589('0xe2')](_0x465421,_0x1e051d[_0x5589('0xe0')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x465421[_0x5589('0xef')],'scheduledat':moment()['add'](_0x57d548[_0x5589('0x1c')][_0x7f498f[_0x5589('0xc6')]][_0x5589('0xf1')],_0x5589('0xe4'))[_0x5589('0x47')](_0x5589('0xd0')),'ContactId':_0x6aa2cb['ContactId'],'ListId':_0x6aa2cb['ListId'],'VoiceQueueId':_0x6aa2cb['VoiceQueueId']||undefined,'CampaignId':_0x6aa2cb[_0x5589('0xe7')]||undefined})[_0x5589('0xa3')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x5005ff=new History(_0x465421);_0x5005ff[_0x5589('0xde')]=0xb;_0x5005ff[_0x5589('0x6e')]=_0x5589('0xf2');_0x5005ff['starttime']=moment()[_0x5589('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x5005ff['endtime']=_0x5005ff[_0x5589('0x70')];_0x5005ff[_0x5589('0xe8')]=_0x465421[_0x5589('0xe8')];_0x5005ff['calleridnum']=_0x465421[_0x5589('0xe9')];hopperUtils[_0x5589('0xd1')](_0x5005ff)[_0x5589('0xa3')](loggerCatch(_0x5589('0xf3')));}})[_0x5589('0xa7')](function(){if(_0x32f29b)hopperUtils[_0x5589('0xeb')](_0x465421,_0x23a6b7,_0x408b37)[_0x5589('0xa7')](function(){return 0x1;});});}}}};Dialer[_0x5589('0x8b')][_0x5589('0x37')]=function(_0x13b3bc){if(this[_0x5589('0x21')][_0x13b3bc['uniqueid']]){this['actions'][_0x13b3bc[_0x5589('0xc7')]][_0x5589('0xf4')]=_0x13b3bc[_0x5589('0xf4')];}if(this[_0x5589('0x23')][_0x13b3bc['uniqueid']]){this[_0x5589('0x23')][_0x13b3bc[_0x5589('0xc7')]]['channel']=_0x13b3bc[_0x5589('0xf4')];}};Dialer[_0x5589('0x8b')][_0x5589('0x3a')]=function(_0x280aed){if(!this[_0x5589('0x21')][_0x280aed[_0x5589('0xf5')]]){return;}var _0x11d489=this[_0x5589('0x1c')][this[_0x5589('0x21')][_0x280aed['actionid']][_0x5589('0xc6')]]['strategy']||'rrmemory';if(_0x11d489===_0x5589('0xf6')){if(this[_0x5589('0x21')][_0x280aed[_0x5589('0xf5')]]&&_[_0x5589('0xf7')](this[_0x5589('0x21')][_0x280aed[_0x5589('0xf5')]][_0x5589('0xf8')])&&_0x280aed[_0x5589('0x89')]==='1'&&_0x280aed['paused']==='0'){if(this[_0x5589('0x1e')][_0x280aed[_0x5589('0xf9')]]){if(!this[_0x5589('0x1e')][_0x280aed[_0x5589('0xf9')]][_0x5589('0xf8')]){this[_0x5589('0x1e')][_0x280aed[_0x5589('0xf9')]][_0x5589('0xf8')]=!![];this[_0x5589('0x21')][_0x280aed[_0x5589('0xf5')]][_0x5589('0xf8')]=!![];this['actions'][_0x280aed[_0x5589('0xf5')]][_0x5589('0xf9')]=_0x280aed[_0x5589('0xf9')];}}}}else if(_0x11d489===_0x5589('0xfa')){if(this[_0x5589('0x21')][_0x280aed[_0x5589('0xf5')]]){if(this[_0x5589('0x1e')][_0x280aed['stateinterface']]){this[_0x5589('0x21')][_0x280aed[_0x5589('0xf5')]][_0x5589('0xf9')]=_0x280aed[_0x5589('0xf9')];if(_['isNil'](this[_0x5589('0xfb')][this['actions'][_0x280aed[_0x5589('0xf5')]][_0x5589('0xc6')]])){this[_0x5589('0xfb')][this[_0x5589('0x21')][_0x280aed[_0x5589('0xf5')]]['queue']]=[];}this[_0x5589('0xfb')][this[_0x5589('0x21')][_0x280aed['actionid']]['queue']][_0x5589('0x9d')](_[_0x5589('0xfc')](_[_0x5589('0x74')](this[_0x5589('0x21')][_0x280aed[_0x5589('0xf5')]],[_0x5589('0xfd'),_0x5589('0xf9')]),{'status':_0x280aed[_0x5589('0x89')],'paused':_0x280aed[_0x5589('0xfe')]}));}}}};Dialer[_0x5589('0x8b')][_0x5589('0x3c')]=function(_0x3f47e4){if(!this[_0x5589('0x21')][_0x3f47e4[_0x5589('0xf5')]]){return;}var _0x2b1a37=this;var _0x37eed6=this[_0x5589('0x1c')][this[_0x5589('0x21')][_0x3f47e4[_0x5589('0xf5')]][_0x5589('0xc6')]];var _0x32a0a7=_0x37eed6[_0x5589('0xff')]||_0x5589('0xfa');if(_0x32a0a7===_0x5589('0xf6')){if(this[_0x5589('0x21')][_0x3f47e4['actionid']]&&this[_0x5589('0x21')][_0x3f47e4[_0x5589('0xf5')]]['stateinterface']){this['preview'][_0x5589('0x100')](this[_0x5589('0x21')][_0x3f47e4[_0x5589('0xf5')]][_0x5589('0xfd')],this[_0x5589('0x21')][_0x3f47e4[_0x5589('0xf5')]]['stateinterface'])[_0x5589('0xa3')](function(_0x3775cb){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util[_0x5589('0x46')](_0x3775cb,{'showHidden':![],'depth':null}));})[_0x5589('0x19')](function(){_0x2b1a37[_0x5589('0xc9')](_0x2b1a37[_0x5589('0x1c')][_0x2b1a37[_0x5589('0x21')][_0x3f47e4['actionid']][_0x5589('0xc6')]]);_0x2b1a37[_0x5589('0x1e')][_0x2b1a37[_0x5589('0x21')][_0x3f47e4[_0x5589('0xf5')]][_0x5589('0xf9')]]['locked']=![];delete _0x2b1a37[_0x5589('0x21')][_0x3f47e4[_0x5589('0xf5')]];unlockQueueStatus(_0x37eed6);});}else{this['updateOriginated'](this[_0x5589('0x1c')][this['actions'][_0x3f47e4[_0x5589('0xf5')]][_0x5589('0xc6')]]);hopperUtils[_0x5589('0xe3')]({'active':![],'ContactId':this['actions'][_0x3f47e4[_0x5589('0xf5')]][_0x5589('0x101')],'ListId':this[_0x5589('0x21')][_0x3f47e4['actionid']][_0x5589('0xe5')],'VoiceQueueId':this[_0x5589('0x21')][_0x3f47e4[_0x5589('0xf5')]][_0x5589('0xe6')]||undefined,'CampaignId':this['actions'][_0x3f47e4['actionid']]['CampaignId']||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x5589('0x21')][_0x3f47e4[_0x5589('0xf5')]];unlockQueueStatus(_0x37eed6);}}else if(_0x32a0a7===_0x5589('0xfa')){var _0x126e15;if(this['actions'][_0x3f47e4['actionid']]&&!_['isEmpty'](this['queueBooked'][this[_0x5589('0x21')][_0x3f47e4['actionid']][_0x5589('0xc6')]])){if(this[_0x5589('0x26')][_0x2b1a37[_0x5589('0x21')][_0x3f47e4[_0x5589('0xf5')]][_0x5589('0xc6')]]){this[_0x5589('0x26')][_0x2b1a37['actions'][_0x3f47e4[_0x5589('0xf5')]]['queue']]=this[_0x5589('0x26')][this[_0x5589('0x21')][_0x3f47e4[_0x5589('0xf5')]][_0x5589('0xc6')]]?this[_0x5589('0x26')][this[_0x5589('0x21')][_0x3f47e4['actionid']][_0x5589('0xc6')]]:this['queueBooked'][this[_0x5589('0x21')][_0x3f47e4[_0x5589('0xf5')]][_0x5589('0xc6')]]?this[_0x5589('0xfb')][this[_0x5589('0x21')][_0x3f47e4[_0x5589('0xf5')]][_0x5589('0xc6')]][_0x5589('0x102')]||0x0:0x0;}this['queueBooked'][this[_0x5589('0x21')][_0x3f47e4[_0x5589('0xf5')]][_0x5589('0xc6')]][_0x5589('0x102')]=this['queueBookedRR'][this[_0x5589('0x21')][_0x3f47e4[_0x5589('0xf5')]]['queue']];for(var _0x2df64f=0x0;_0x2df64f=_0x3e7069[_0x5589('0x122')]){_0x589021[_0x5589('0x123')](_0x51b057,_0x3260c1,_0x139047,_0x5589('0x124'));}else{if(_0x51b057[_0x5589('0x11e')]>=_0x3e7069[_0x5589('0x125')]){_0x589021[_0x5589('0x126')](_0x51b057,_0x3260c1,_0x139047,'reason\x2019\x20machine....');}else{hopperUtils[_0x5589('0xe3')]({'active':![],'countmachineretry':_0x51b057[_0x5589('0x11e')],'scheduledat':moment()[_0x5589('0x127')](_0x3e7069['dialMachineRetryFrequency'],_0x5589('0xe4'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x51b057['ContactId'],'ListId':_0x51b057['ListId'],'VoiceQueueId':_0x51b057['VoiceQueueId']||undefined,'CampaignId':_0x51b057[_0x5589('0xe7')]||undefined})[_0x5589('0xa3')](loggerCatch('[rescheduleContact][Machine]'));_0x3260c1({'reschedule':0x1});}}});}if(_0x53f4fd[_0x5589('0x42')]==='ivr'&&this[_0x5589('0x1d')][_0x53f4fd[_0x5589('0xc6')]][_0x5589('0x112')]&&_0x445e30[_0x5589('0x11b')]===_0x5589('0x128')){delete this[_0x5589('0x23')][_0x445e30['uniqueid']];this[_0x5589('0xc9')](this[_0x5589('0x1d')][_0x53f4fd[_0x5589('0xc6')]]);_0x525715=new Hangup(_0x53f4fd,_0x445e30);_0x525715[_0x5589('0xde')]=0x12;_0x525715[_0x5589('0x6e')]=_0x5589('0x129');_0x525715[_0x5589('0x114')]='AMD';ami['emit'](_0x5589('0x115'),ut[_0x5589('0x116')](_0x525715,_0x5589('0x117')));this['saveInDb'](_0x525715,_0x5589('0x12a'),_0x5589('0x12b'));}if(_0x53f4fd[_0x5589('0x42')]===_0x5589('0xc8')&&this[_0x5589('0x1d')][_0x53f4fd[_0x5589('0xc6')]][_0x5589('0x112')]&&_0x445e30[_0x5589('0x11b')]===_0x5589('0x11c')){return new Promise(function(_0x22ab03,_0x27722c){delete _0x589021[_0x5589('0x23')][_0x445e30[_0x5589('0xc7')]];_0x589021[_0x5589('0xc9')](_0x589021['campaigns'][_0x53f4fd[_0x5589('0xc6')]]);_0x589021[_0x5589('0x1d')][_0x53f4fd[_0x5589('0xc6')]]['outboundAnswerCallsDay']+=0x1;_0x589021[_0x5589('0x1d')][_0x53f4fd[_0x5589('0xc6')]][_0x5589('0x113')]+=0x1;var _0x289a8e=_0x589021[_0x5589('0x1d')][_0x53f4fd['queue']];var _0x1b7d29=new Hangup(_0x53f4fd,_0x445e30);_0x1b7d29[_0x5589('0xde')]=0x13;_0x1b7d29['statedesc']=_0x5589('0x11d');_0x1b7d29['membername']=_0x5589('0x12c');_0x1b7d29[_0x5589('0x11e')]+=0x1;_0x1b7d29['countglobal']+=0x1;_0x1b7d29[_0x5589('0x117')]=!![];ami[_0x5589('0x41')](_0x5589('0x115'),ut['buildObj'](_0x1b7d29,'amd'));hopperUtils[_0x5589('0xd1')](_0x1b7d29)[_0x5589('0xa3')](loggerCatch(_0x5589('0x12d')));if(_0x1b7d29['countbusyretry']+_0x1b7d29[_0x5589('0x11f')]+_0x1b7d29['countnoanswerretry']+_0x1b7d29[_0x5589('0x120')]+_0x1b7d29['countdropretry']+_0x1b7d29[_0x5589('0xef')]+_0x1b7d29[_0x5589('0x11e')]+_0x1b7d29[_0x5589('0x121')]>=_0x289a8e['dialGlobalMaxRetry']){_0x589021[_0x5589('0x123')](_0x1b7d29,_0x22ab03,_0x27722c,_0x5589('0x124'));}else{if(_0x1b7d29['countmachineretry']>=_0x289a8e[_0x5589('0x125')]){_0x589021[_0x5589('0x126')](_0x1b7d29,_0x22ab03,_0x27722c,_0x5589('0x12e'));}else{hopperUtils[_0x5589('0xe3')]({'active':![],'countmachineretry':_0x1b7d29[_0x5589('0x11e')],'scheduledat':moment()[_0x5589('0x127')](_0x289a8e[_0x5589('0x12f')],_0x5589('0xe4'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1b7d29[_0x5589('0x101')],'ListId':_0x1b7d29['ListId'],'VoiceQueueId':_0x1b7d29[_0x5589('0xe6')]||undefined,'CampaignId':_0x1b7d29[_0x5589('0xe7')]||undefined})[_0x5589('0xa3')](loggerCatch('[rescheduleContact][Machine]'));_0x22ab03({'reschedule':0x1});}}});}}};Dialer[_0x5589('0x8b')][_0x5589('0x35')]=function(_0x1e8232){var _0x45a8c8=this[_0x5589('0x23')][_0x1e8232[_0x5589('0xc7')]];var _0x4859ff;if(_0x45a8c8&&_0x45a8c8[_0x5589('0x42')]==='ivr'){delete this[_0x5589('0x23')][_0x1e8232[_0x5589('0xc7')]];this['updateOriginated'](this[_0x5589('0x1d')][_0x45a8c8[_0x5589('0xc6')]]);this['campaigns'][_0x45a8c8[_0x5589('0xc6')]][_0x5589('0x130')]+=0x1;_0x4859ff=new Hangup(_0x45a8c8,_0x1e8232);hopperUtils[_0x5589('0xd1')](_0x4859ff)[_0x5589('0xa3')](loggerCatch(_0x5589('0x131')));hopperUtils[_0x5589('0xd2')](_0x4859ff)[_0x5589('0xa3')](loggerCatch(_0x5589('0x132')));}if(_0x45a8c8&&_0x45a8c8[_0x5589('0x42')]!==_0x5589('0xc8')&&isNotNull(this[_0x5589('0x1c')][_0x45a8c8[_0x5589('0xc6')]][_0x5589('0x133')])){delete this[_0x5589('0x23')][_0x1e8232[_0x5589('0xc7')]];this[_0x5589('0xc9')](this[_0x5589('0x1c')][_0x45a8c8[_0x5589('0xc6')]]);this['voiceQueues'][_0x45a8c8[_0x5589('0xc6')]]['outboundAnswerCallsDay']+=0x1;this[_0x5589('0x1c')][_0x45a8c8[_0x5589('0xc6')]][_0x5589('0x113')]+=0x1;_0x4859ff=new Hangup(_0x45a8c8,_0x1e8232);_0x4859ff[_0x5589('0xde')]=0x10;_0x4859ff['statedesc']='AnswerAGI';_0x4859ff[_0x5589('0x114')]=_0x5589('0x134');hopperUtils[_0x5589('0xd1')](_0x4859ff)['catch'](loggerCatch(_0x5589('0x131')));hopperUtils[_0x5589('0xd2')](_0x4859ff)[_0x5589('0xa3')](loggerCatch(_0x5589('0x132')));}if(_0x45a8c8&&_0x45a8c8[_0x5589('0x42')]!==_0x5589('0xc8')&&!isNotNull(this[_0x5589('0x1c')][_0x45a8c8[_0x5589('0xc6')]]['dialQueueProject'])){delete this[_0x5589('0x23')][_0x1e8232[_0x5589('0xc7')]];this['updateOriginated'](this['voiceQueues'][_0x45a8c8[_0x5589('0xc6')]]);this['voiceQueues'][_0x45a8c8['queue']]['outboundUnknownCallsDay']+=0x1;_0x4859ff=new Hangup(_0x45a8c8,_0x1e8232);_0x4859ff['state']=0xc;_0x4859ff[_0x5589('0x6e')]=_0x1e8232[_0x5589('0x135')];_0x4859ff[_0x5589('0x114')]=_0x5589('0x136');hopperUtils['createHistory'](_0x4859ff)[_0x5589('0xa3')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x4859ff)[_0x5589('0xa3')](loggerCatch(_0x5589('0x132')));}};Dialer['prototype']['syncQueueSummary']=function(_0xb77ae4){var _0x5be5e6=this;if(!_0x5be5e6[_0x5589('0x27')][_0xb77ae4['name']]){_0x5be5e6[_0x5589('0x27')][_0xb77ae4[_0x5589('0x61')]]={'running':![]};}else if(_0x5be5e6[_0x5589('0x27')][_0xb77ae4['name']][_0x5589('0x137')]===!![]){return;}else if(_0x5be5e6['queuesSummary'][_0xb77ae4[_0x5589('0x61')]][_0x5589('0x137')]===![]){_0x5be5e6['queuesSummary'][_0xb77ae4[_0x5589('0x61')]][_0x5589('0x137')]=!![];}var _0x529c80=_0x5be5e6['voiceQueues'][_0xb77ae4[_0x5589('0x61')]];var _0x3f7d75=_0x529c80[_0x5589('0x68')]!==utils['CAMPAIGN_STATUS'][_0x5589('0x80')];var _0xe536fb=utils[_0x5589('0x138')](_0x529c80);_0x529c80[_0x5589('0x139')]=utils['getQueueCampaignStatusMessage'](_0x529c80,_0x5be5e6[_0x5589('0x1f')]);Promise[_0x5589('0xb2')]()['then'](function(){if(_0x529c80[_0x5589('0x139')]===utils[_0x5589('0x69')][_0x5589('0x80')]){if(_0x3f7d75){clearPredictiveAttributes(_0x529c80);_0xb77ae4[_0x5589('0x63')]=undefined;_0xb77ae4['startProgressive']=undefined;}if(_0x529c80[_0x5589('0x139')]===utils['CAMPAIGN_STATUS']['INACTIVE']){_0xb77ae4[_0x5589('0x13a')]=0x0;_0xb77ae4[_0x5589('0xfe')]=0x0;_0xb77ae4[_0x5589('0x13b')]=0x0;_0xb77ae4[_0x5589('0x13c')]=0x0;_0xb77ae4[_0x5589('0x13d')]=0x0;}}else if(_0x529c80[_0x5589('0x139')]===utils['CAMPAIGN_STATUS'][_0x5589('0x13e')]&&!_0xe536fb){return _0x5be5e6[_0x5589('0x93')](_0x529c80,!![])[_0x5589('0xa7')](function(){return _0x5be5e6['ifTime'](_0x529c80,![]);})[_0x5589('0xa7')](function(){return _0x5be5e6['checkDialMethod'](_0x529c80);})[_0x5589('0xa3')](function(_0x554d46){loggerSyncQueueSummary['debug'](_0x5589('0x13f'),util[_0x5589('0x46')](_0x554d46,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x529c80);});}else{clearPredictiveAttributes(_0x529c80);}})[_0x5589('0xa7')](function(){var _0x210746=_0xb77ae4[_0x5589('0x140')](_0x529c80);if(_0x210746||_0x529c80['queueSummaryCountersUpdated']){_0x529c80[_0x5589('0x141')]=![];_0xb77ae4[_0x5589('0x142')](_0x529c80);Object[_0x5589('0x143')](_0x529c80,_0xb77ae4);emitOutboundVoiceQueueSummary(_0xb77ae4);}_0x5be5e6[_0x5589('0x27')][_0x529c80['name']][_0x5589('0x137')]=![];})[_0x5589('0xa3')](function(_0x1ebf84){logger[_0x5589('0x65')](_0x5589('0x13f'),util[_0x5589('0x46')](_0x1ebf84,{'showHidden':![],'depth':null}));_0x5be5e6[_0x5589('0x27')][_0x529c80[_0x5589('0x61')]][_0x5589('0x137')]=![];});};Dialer[_0x5589('0x8b')][_0x5589('0x33')]=_[_0x5589('0x144')](function(){var _0x45f4c0=_[_0x5589('0x145')](this[_0x5589('0x1c')],function(_0x3c6fc1){return _0x3c6fc1['dialPreviewRecallmeReminder'];});var _0x4baea4=_[_0x5589('0x145')](this['agents'],function(_0x5738ed){return _0x5738ed[_0x5589('0x146')]&&_0x5738ed['status']===_0x5589('0x88');});if(_0x45f4c0[_0x5589('0x9c')]>0x0&&_0x4baea4[_0x5589('0x9c')]>0x0){return Promise[_0x5589('0xb2')]()['then'](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x45f4c0,'id'),previewRecallmeReminderInterval,_[_0x5589('0x147')](_0x4baea4,'id')))['then'](function(_0x4666cc){for(var _0x30440a=0x0;_0x30440a<_0x4666cc[_0x5589('0x9c')];_0x30440a++){var _0x432ba7=_0x4666cc[_0x30440a][_0x5589('0x148')]['name'];if(_0x432ba7)io['to'](util[_0x5589('0x47')](_0x5589('0x149'),_0x432ba7))['emit'](_0x5589('0x14a'),{'hopper':_0x4666cc[_0x30440a]});}})[_0x5589('0xa3')](function(_0x19f02f){logger[_0x5589('0x65')](_0x5589('0x14b'),_0x19f02f);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x5589('0x3d')]=function(){var _0xfc412a=this;setInterval(function(){_0xfc412a[_0x5589('0x14c')](_0xfc412a[_0x5589('0x23')],_0x5589('0x14d'));_0xfc412a[_0x5589('0x14c')](_0xfc412a[_0x5589('0x21')],_0x5589('0x14e'));},0x32c8);};Dialer[_0x5589('0x8b')][_0x5589('0x14c')]=function(_0x46cde4,_0x4fbec5){var _0x3ac4b7=this;for(var _0x2a9bcf in _0x46cde4){if(typeof _0x46cde4[_0x2a9bcf]!==_0x5589('0xb1')){this['sequence'][_0x5589('0x14f')](function(){if(!_[_0x5589('0xf7')](_0x46cde4[_0x2a9bcf])){return ami[_0x5589('0x9e')]({'action':_0x5589('0x89'),'channel':_0x46cde4[_0x2a9bcf][_0x5589('0xf4')]})[_0x5589('0xa3')](function(_0x184f9e){if(_0x184f9e['message']===_0x5589('0x150')){setTimeout(function(){if(_0x46cde4[_0x2a9bcf]&&_0x46cde4[_0x2a9bcf][_0x5589('0x42')]!==_0x5589('0xc8')){_0x3ac4b7[_0x5589('0xc9')](_0x3ac4b7['voiceQueues'][_0x46cde4[_0x2a9bcf][_0x5589('0xc6')]]);logger[_0x5589('0x65')](_0x5589('0x151'),_0x4fbec5,_0x2a9bcf,_0x46cde4[_0x2a9bcf][_0x5589('0xc6')]);delete _0x46cde4[_0x2a9bcf];}if(_0x46cde4[_0x2a9bcf]&&_0x46cde4[_0x2a9bcf]['type']===_0x5589('0xc8')){_0x3ac4b7[_0x5589('0xc9')](_0x3ac4b7[_0x5589('0x1d')][_0x46cde4[_0x2a9bcf][_0x5589('0xc6')]]);logger[_0x5589('0x65')](_0x5589('0x152'),_0x4fbec5,_0x2a9bcf,_0x46cde4[_0x2a9bcf]['queue']);delete _0x46cde4[_0x2a9bcf];}},0x2328);}});}});}}};Dialer['prototype'][_0x5589('0x153')]=function(_0x360f16){return Promise[_0x5589('0xb2')]()['then'](voiceQueueRt[_0x5589('0x153')](_0x360f16))[_0x5589('0xa3')](loggerCatch(_0x5589('0x154')));};Dialer['prototype'][_0x5589('0xc9')]=function(_0x5aaf30){if(!_['isUndefined'](_0x5aaf30)&&_0x5aaf30!==null){if(typeof _0x5aaf30['originated']!==_0x5589('0xb1')){if(_0x5aaf30['originated']>0x0){_0x5aaf30[_0x5589('0x7f')]-=0x1;}else{logger['error'](_0x5589('0x155'));}}}else{logger[_0x5589('0x65')](_0x5589('0x156'));}};Dialer[_0x5589('0x8b')]['loggerHandler']=function(_0x1cab58,_0x777990){var _0x4c3349=this;return function(_0x27471f){_0x4c3349[_0x5589('0xc9')](_0x777990);logger[_0x5589('0x65')](_0x1cab58,util['inspect'](_0x27471f,{'showHidden':![],'depth':null}));};};Dialer[_0x5589('0x8b')][_0x5589('0x157')]=function(_0x1ff047,_0x39f15f,_0x2551a2){var _0x3e4592={'state':0x19,'statedesc':_0x5589('0x158')};this[_0x5589('0xc9')](_0x39f15f);this[_0x5589('0x118')](_['merge'](_0x3e4592,_[_0x5589('0x74')](_0x2551a2,[_0x5589('0x101'),'ListId',_0x5589('0x159'),_0x5589('0xe6'),_0x5589('0xe7')])),'[emptyContact][createHistory]',_0x5589('0x15a'));logger[_0x5589('0x65')](_0x1ff047);};Dialer[_0x5589('0x8b')][_0x5589('0x118')]=function(_0x3aed2b,_0x313566,_0xce7658){hopperUtils['createHistory'](_0x3aed2b)['catch'](loggerCatch(_0x313566));hopperUtils[_0x5589('0xd2')](_0x3aed2b)['catch'](loggerCatch(_0xce7658));};Dialer[_0x5589('0x8b')]['queueCallerAbandonCreateState']=function(_0x2d0a17,_0x317891){hopperUtils[_0x5589('0xd1')](_0x2d0a17)[_0x5589('0xa3')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x317891==0x0){hopperUtils[_0x5589('0xd2')](_0x2d0a17)[_0x5589('0xa3')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x5589('0x8b')][_0x5589('0x14b')]=function(_0x4045d9){return Promise['resolve']()[_0x5589('0xa7')](cmHopper[_0x5589('0x15b')](_0x4045d9['id'],previewRecallmeReminderInterval))[_0x5589('0xa7')](function(_0x4f987e){for(var _0x45b4cc=0x0;_0x45b4cc<_0x4f987e[_0x5589('0x9c')];_0x45b4cc++){var _0x2f0c81=_0x4f987e[_0x45b4cc][_0x5589('0x148')][_0x5589('0x61')];if(_0x2f0c81)io['to'](util[_0x5589('0x47')](_0x5589('0x149'),_0x2f0c81))[_0x5589('0x41')](_0x5589('0x14a'),{'hopper':_0x4f987e[_0x45b4cc]});}})['catch'](function(){});};Dialer[_0x5589('0x8b')][_0x5589('0xb3')]=function(_0x38f9a3){var _0x167b9b=this;return function(){_0x167b9b[_0x5589('0x15c')](_0x38f9a3);};};Dialer[_0x5589('0x8b')]['actionOriginate']=function(_0x98a55c,_0x36be6a){var _0x1c5f2a=this;var _0x464dad=uuid['v4']();this[_0x5589('0x21')][_0x464dad]=new Action(_0x98a55c,_0x36be6a,_0x464dad);return new Promise(function(_0xe745c2,_0x23f860){if(_[_0x5589('0x40')](_0x98a55c)&&typeof _0x98a55c!=='object'){return _0x23f860(msgResponse(_0x5589('0x15d'),_0x5589('0x94'),_0x5589('0x15e')));}if(_[_0x5589('0x40')](_0x36be6a[_0x5589('0x15f')])||_0x36be6a['phone']===null){return _0x23f860(msgResponse(_0x5589('0x15d'),_0x5589('0x94'),_0x5589('0x160')));}var _0x2a77d7={'XMD-CALLERID':_0x1c5f2a[_0x5589('0x21')][_0x464dad][_0x5589('0x161')](),'XMD-AGI':_0x98a55c[_0x5589('0x133')]?util[_0x5589('0x47')](_0x5589('0x162'),ipAgi,_0x98a55c[_0x5589('0x133')]):'NONE','XMD-AGIAFTER':_0x98a55c[_0x5589('0xce')]?util[_0x5589('0x47')](_0x5589('0x162'),ipAgi,_0x98a55c['dialQueueProject2']):'NONE','XMD-QUEUE':utils[_0x5589('0x163')](_0x98a55c)?util['format']('\x22%s,%s%s,,,%s\x22',_0x98a55c[_0x5589('0x61')],_0x98a55c['dialQueueOptions']||'',_0x98a55c['dialAgiAfterHangupAgent']?'c':'',_0x98a55c[_0x5589('0x164')]||0x3):_0x5589('0x165'),'XMD-CONTACTID':_0x36be6a[_0x5589('0x101')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1c5f2a['actions'][_0x464dad][_0x5589('0x161')](),'XMD-AMD':_0x98a55c[_0x5589('0x112')]?_0x5589('0x13e'):_0x5589('0x165'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x98a55c[_0x5589('0x112')]){_0x2a77d7[_0x5589('0x166')]=_0x98a55c['dialAMDInitialSilence']||0x9c4;_0x2a77d7[_0x5589('0x167')]=_0x98a55c['dialAMDGreeting']||0x5dc;_0x2a77d7[_0x5589('0x168')]=_0x98a55c[_0x5589('0x169')]||0x320;_0x2a77d7[_0x5589('0x16a')]=_0x98a55c[_0x5589('0x16b')]||0x1388;_0x2a77d7[_0x5589('0x16c')]=_0x98a55c[_0x5589('0x16d')]||0x64;_0x2a77d7[_0x5589('0x16e')]=_0x98a55c[_0x5589('0x16f')]||0x32;_0x2a77d7[_0x5589('0x170')]=_0x98a55c['dialAMDMaximumNumberOfWords']||0x3;_0x2a77d7[_0x5589('0x171')]=_0x98a55c[_0x5589('0x172')]||0x100;_0x2a77d7[_0x5589('0x173')]=_0x98a55c[_0x5589('0x174')]||0x1388;}if(utils['isOutboundQueue'](_0x98a55c)){_0x2a77d7[_0x5589('0x175')]=_0x36be6a['VoiceQueueId'];}else{_0x2a77d7[_0x5589('0x176')]=_0x36be6a['CampaignId'];}for(var _0x402ab8 in _0x36be6a[_0x5589('0x177')]){if(typeof _0x36be6a[_0x5589('0x177')][_0x402ab8]!==_0x5589('0xb1')){if(isNotNull(_0x36be6a[_0x5589('0x177')][_0x402ab8])&&_0x402ab8!=='id'&&_0x402ab8!==_0x5589('0x178')&&_0x402ab8!==_0x5589('0x179')&&_0x402ab8!==_0x5589('0x17a')){_0x2a77d7[util[_0x5589('0x47')]('%s%s',_0x5589('0x17b'),_[_0x5589('0x17c')](_0x402ab8))]=_0x36be6a[_0x5589('0x177')][_0x402ab8];}}}var _0x39f983=_0x1c5f2a[_0x5589('0x85')](_0x98a55c[_0x5589('0x17d')])?utils['getCallerId'](_0x98a55c[_0x5589('0x17d')][_0x5589('0x17e')],_0x98a55c[_0x5589('0x17f')],_0x98a55c[_0x5589('0x180')]>0x0?utils[_0x5589('0x181')](_0x98a55c['dialOriginateCallerIdNumber'],_0x98a55c[_0x5589('0x180')]):_0x98a55c[_0x5589('0x182')]):utils['getCallerId'](_[_0x5589('0xf7')](_0x98a55c[_0x5589('0x8d')])?_0x98a55c['Trunk'][_0x5589('0x17e')]:_0x98a55c[_0x5589('0x8d')][_0x5589('0x17e')],_0x98a55c[_0x5589('0x17f')],_0x98a55c[_0x5589('0x180')]>0x0?utils[_0x5589('0x181')](_0x98a55c[_0x5589('0x182')],_0x98a55c['dialRandomLastDigitCallerIdNumber']):_0x98a55c[_0x5589('0x182')]);if(_0x39f983){_0x2a77d7[_0x5589('0x183')]=_0x1c5f2a[_0x5589('0x21')][_0x464dad][_0x5589('0x184')]=utils[_0x5589('0x185')](_0x39f983);_0x2a77d7[_0x5589('0x186')]=_0x36be6a[_0x5589('0x15f')];}_0x98a55c['variables']=_0x2a77d7;return ami[_0x5589('0x9e')]({'actionid':_0x464dad,'action':_0x5589('0x15d'),'channel':_0x1c5f2a[_0x5589('0x85')](_0x98a55c[_0x5589('0x17d')])?util[_0x5589('0x47')]('SIP/%s/%s%s',_0x98a55c[_0x5589('0x17d')][_0x5589('0x61')],isNotNull(_0x98a55c['dialPrefix'])?_0x98a55c[_0x5589('0x187')][_0x5589('0x188')]()||'':'',_0x98a55c[_0x5589('0x189')]>0x0?_0x36be6a[_0x5589('0x15f')][_0x5589('0x18a')](_0x98a55c['dialCutDigit']):_0x36be6a[_0x5589('0x15f')]):util[_0x5589('0x47')]('SIP/%s/%s%s',_[_0x5589('0xf7')](_0x98a55c['TrunkBackup'])?_0x98a55c[_0x5589('0x17d')][_0x5589('0x61')]:_0x98a55c['TrunkBackup'][_0x5589('0x61')],isNotNull(_0x98a55c['dialPrefix'])?_0x98a55c[_0x5589('0x187')][_0x5589('0x188')]()||'':'',_0x98a55c['dialCutDigit']>0x0?_0x36be6a[_0x5589('0x15f')][_0x5589('0x18a')](_0x98a55c[_0x5589('0x189')]):_0x36be6a[_0x5589('0x15f')]),'callerid':_0x39f983,'Exten':_0x5589('0x18b'),'Context':_0x5589('0x18c'),'Priority':'1','variable':_0x2a77d7,'timeout':(_0x98a55c[_0x5589('0x18d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x464dad})[_0x5589('0xa7')](function(_0x5a02e5){return _0xe745c2(_0x5a02e5);})['catch'](function(_0x553ee1){_0x98a55c[_0x5589('0x18e')]+=0x1;var _0x2d4ef7=new History(_0x1c5f2a[_0x5589('0x21')][_0x464dad]);logger['error'](util[_0x5589('0x47')](_0x5589('0x18f'),JSON[_0x5589('0x73')](_0x553ee1)));_0x2d4ef7[_0x5589('0xde')]=0xe;_0x2d4ef7['statedesc']=_0x5589('0x190');_0x2d4ef7['starttime']=moment()['format'](_0x5589('0xd0'));_0x2d4ef7[_0x5589('0x6f')]=_0x2d4ef7['starttime'];hopperUtils['createHistory'](_0x2d4ef7)[_0x5589('0xa3')](loggerCatch(_0x5589('0x191')));_0x1c5f2a[_0x5589('0xd2')](_0x2d4ef7)[_0x5589('0xa3')](loggerCatch(_0x5589('0x191')))[_0x5589('0x19')](function(){delete _0x1c5f2a['actions'][_0x464dad];return _0x23f860(msgResponse('originate',_0x5589('0xc4'),_0x5589('0x192')));});});});};Dialer[_0x5589('0x8b')][_0x5589('0x193')]=function(_0x4a2d7e,_0x5b146f,_0x1712fc){var _0x3b0614=new History(_0x5b146f);if(_0x3b0614['countbusyretry']+_0x3b0614['countcongestionretry']+_0x3b0614[_0x5589('0x194')]+_0x3b0614[_0x5589('0x120')]+_0x3b0614[_0x5589('0xd9')]+_0x3b0614[_0x5589('0xef')]+_0x3b0614[_0x5589('0x11e')]+_0x3b0614[_0x5589('0x121')]>=_0x1712fc[_0x5589('0x122')]-0x1){return!![];}switch(_0x4a2d7e){case 0x3:if(_0x3b0614[_0x5589('0x194')]>=_0x1712fc[_0x5589('0x195')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x3b0614[_0x5589('0x194')]+=0x1,'scheduledat':moment()['add'](_0x1712fc[_0x5589('0x196')],'minutes')['format'](_0x5589('0xd0')),'ContactId':_0x3b0614['ContactId'],'ListId':_0x3b0614[_0x5589('0xe5')],'VoiceQueueId':_0x3b0614[_0x5589('0xe6')]||undefined,'CampaignId':_0x3b0614[_0x5589('0xe7')]||undefined})[_0x5589('0xa3')](loggerCatch(_0x5589('0x197')));break;case 0x5:if(_0x3b0614['countbusyretry']>=_0x1712fc['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x5589('0xe3')]({'active':![],'countbusyretry':_0x3b0614[_0x5589('0x198')]+=0x1,'scheduledat':moment()[_0x5589('0x127')](_0x1712fc[_0x5589('0x199')],_0x5589('0xe4'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b0614[_0x5589('0x101')],'ListId':_0x3b0614['ListId'],'VoiceQueueId':_0x3b0614['VoiceQueueId']||undefined,'CampaignId':_0x3b0614[_0x5589('0xe7')]||undefined})[_0x5589('0xa3')](loggerCatch(_0x5589('0x19a')));break;case 0x8:if(_0x3b0614['countcongestionretry']>=_0x1712fc['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x5589('0xe3')]({'active':![],'countcongestionretry':_0x3b0614[_0x5589('0x11f')]+=0x1,'scheduledat':moment()[_0x5589('0x127')](_0x1712fc[_0x5589('0x19b')],_0x5589('0xe4'))[_0x5589('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b0614[_0x5589('0x101')],'ListId':_0x3b0614['ListId'],'VoiceQueueId':_0x3b0614[_0x5589('0xe6')]||undefined,'CampaignId':_0x3b0614[_0x5589('0xe7')]||undefined})[_0x5589('0xa3')](loggerCatch(_0x5589('0x19c')));break;case 0x0:if(_0x3b0614['countnosuchnumberretry']>=_0x1712fc[_0x5589('0x19d')]-0x1){return!![];}else{hopperUtils[_0x5589('0xe3')]({'active':![],'countnosuchnumberretry':_0x3b0614[_0x5589('0x120')]+=0x1,'scheduledat':moment()[_0x5589('0x127')](_0x1712fc[_0x5589('0x19e')],_0x5589('0xe4'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b0614[_0x5589('0x101')],'ListId':_0x3b0614[_0x5589('0xe5')],'VoiceQueueId':_0x3b0614['VoiceQueueId']||undefined,'CampaignId':_0x3b0614[_0x5589('0xe7')]||undefined})[_0x5589('0xa3')](loggerCatch(_0x5589('0x19f')));}break;case 0xa:if(_0x3b0614[_0x5589('0xd9')]>=_0x1712fc[_0x5589('0xe1')]-0x1){return!![];}hopperUtils[_0x5589('0xe3')]({'active':![],'countdropretry':_0x3b0614['countdropretry']+=0x1,'scheduledat':moment()[_0x5589('0x127')](_0x1712fc[_0x5589('0xdb')],_0x5589('0xe4'))[_0x5589('0x47')](_0x5589('0xd0')),'ContactId':_0x3b0614[_0x5589('0x101')],'ListId':_0x3b0614[_0x5589('0xe5')],'VoiceQueueId':_0x3b0614[_0x5589('0xe6')]||undefined,'CampaignId':_0x3b0614[_0x5589('0xe7')]||undefined})[_0x5589('0xa3')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x3b0614[_0x5589('0xef')]>=_0x1712fc[_0x5589('0xf0')]-0x1){return!![];}hopperUtils[_0x5589('0xe3')]({'active':![],'countabandonedretry':_0x3b0614['countabandonedretry']+=0x1,'scheduledat':moment()[_0x5589('0x127')](_0x1712fc['dialAbandonedRetryFrequency'],'minutes')[_0x5589('0x47')](_0x5589('0xd0')),'ContactId':_0x3b0614[_0x5589('0x101')],'ListId':_0x3b0614['ListId'],'VoiceQueueId':_0x3b0614['VoiceQueueId']||undefined,'CampaignId':_0x3b0614[_0x5589('0xe7')]||undefined})[_0x5589('0xa3')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x3b0614[_0x5589('0x11e')]>=_0x1712fc['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x5589('0xe3')]({'active':![],'countmachineretry':_0x3b0614['countmachineretry']+=0x1,'scheduledat':moment()[_0x5589('0x127')](_0x1712fc[_0x5589('0x12f')],_0x5589('0xe4'))[_0x5589('0x47')](_0x5589('0xd0')),'ContactId':_0x3b0614[_0x5589('0x101')],'ListId':_0x3b0614['ListId'],'VoiceQueueId':_0x3b0614[_0x5589('0xe6')]||undefined,'CampaignId':_0x3b0614[_0x5589('0xe7')]||undefined})[_0x5589('0xa3')](loggerCatch(_0x5589('0x1a0')));break;case 0x14:if(_0x3b0614[_0x5589('0x121')]>=_0x1712fc[_0x5589('0x1a1')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x3b0614[_0x5589('0x121')]+=0x1,'scheduledat':moment()[_0x5589('0x127')](_0x1712fc[_0x5589('0x1a2')],_0x5589('0xe4'))[_0x5589('0x47')](_0x5589('0xd0')),'ContactId':_0x3b0614[_0x5589('0x101')],'ListId':_0x3b0614[_0x5589('0xe5')],'VoiceQueueId':_0x3b0614[_0x5589('0xe6')]||undefined,'CampaignId':_0x3b0614['CampaignId']||undefined})[_0x5589('0xa3')](loggerCatch(_0x5589('0x1a3')));break;default:return!![];}};Dialer[_0x5589('0x8b')][_0x5589('0x10e')]=function(_0x392f56,_0x4225e6,_0xf73ac2){var _0x1eaceb=this;var _0x37692e=new History(_0x392f56);var _0x36875d=![];var _0x1c3ca7;var _0x5691a8;return new Promise(function(_0x371b70,_0x1e8637){if(_[_0x5589('0x40')](_0x4225e6)&&typeof _0x4225e6!=='object'){return _0x1e8637(msgResponse('[callProgressDetecting]',_0x5589('0x94'),_0x5589('0x1a4')));}if(_['isUndefined'](_0xf73ac2)&&typeof _0xf73ac2!=='object'){return _0x1e8637(msgResponse('[callProgressDetecting]','Failure','evt\x20is\x20undefine'));}hopperUtils[_0x5589('0xdd')](_0x37692e,_0xf73ac2[_0x5589('0xcc')],_0x4225e6)[_0x5589('0xa7')](function(_0x3c1bc2){if(_0x3c1bc2[_0x5589('0xe0')]==0x1)_0x36875d=!![];switch(_0xf73ac2['reason']){case'0':_0x4225e6[_0x5589('0x1a5')]+=0x1;_0x37692e[_0x5589('0xde')]=0x0;_0x37692e[_0x5589('0x6e')]=_0x5589('0x1a6');_0x37692e[_0x5589('0x120')]+=0x1;_0x37692e[_0x5589('0xda')]+=0x1;ami[_0x5589('0x41')](_0x5589('0x1a7'),ut[_0x5589('0x116')](_0x392f56,_0x5589('0x1a8')));_0x1c3ca7=_0x4225e6[_0x5589('0x19e')];_0x5691a8=_0x4225e6[_0x5589('0xdc')];hopperUtils[_0x5589('0xd1')](_0x37692e)[_0x5589('0xa3')](loggerCatch(_0x5589('0x12d')));if(_0x1eaceb[_0x5589('0x193')](0x0,_0x392f56,_0x4225e6)&&!_0x36875d){if(_0x37692e['countnosuchnumberretry']>=_0x4225e6[_0x5589('0x19d')]){_0x1eaceb[_0x5589('0x126')](_0x37692e,_0x371b70,_0x1e8637,'reason\x200\x20no\x20such\x20number....');}else{_0x1eaceb[_0x5589('0x123')](_0x37692e,_0x371b70,_0x1e8637,_0x5589('0x1a9'));}}break;case'3':_0x4225e6['outboundNoAnswerCallsDay']+=0x1;_0x37692e[_0x5589('0xde')]=0x3;_0x37692e[_0x5589('0x6e')]=_0x5589('0x1aa');_0x37692e[_0x5589('0x194')]+=0x1;_0x37692e[_0x5589('0xda')]+=0x1;var _0x279488=ut[_0x5589('0x1ab')](_0x392f56,_0x4225e6);ami[_0x5589('0x41')](_0x5589('0x1ac'),_0x279488);_0x1c3ca7=_0x4225e6['dialNoAnswerRetryFrequency'];_0x5691a8=_0x4225e6['callAdditionalPhoneAfterMin'];hopperUtils[_0x5589('0xd1')](_0x37692e)[_0x5589('0xa3')](loggerCatch(_0x5589('0x1ad')));if(_0x1eaceb[_0x5589('0x193')](0x3,_0x392f56,_0x4225e6)&&!_0x36875d){if(_0x37692e[_0x5589('0x194')]>=_0x4225e6[_0x5589('0x195')]){_0x1eaceb[_0x5589('0x126')](_0x37692e,_0x371b70,_0x1e8637,_0x5589('0x1ae'));}else{_0x1eaceb[_0x5589('0x123')](_0x37692e,_0x371b70,_0x1e8637,_0x5589('0x1ae'));}}break;case'5':_0x4225e6['outboundBusyCallsDay']+=0x1;_0x37692e[_0x5589('0xde')]=0x5;_0x37692e[_0x5589('0x6e')]=_0x5589('0x1af');_0x37692e[_0x5589('0x198')]+=0x1;_0x37692e[_0x5589('0xda')]+=0x1;ami[_0x5589('0x41')](_0x5589('0x1b0'),ut[_0x5589('0x116')](_0x392f56,_0x5589('0x1b1')));_0x1c3ca7=_0x4225e6['dialBusyRetryFrequency'];_0x5691a8=_0x4225e6['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x37692e)['catch'](loggerCatch(_0x5589('0x1b2')));if(_0x1eaceb['checkRetriveMax'](0x5,_0x392f56,_0x4225e6)&&!_0x36875d){if(_0x37692e[_0x5589('0x198')]>=_0x4225e6[_0x5589('0x1b3')]){_0x1eaceb['createStateFinal'](_0x37692e,_0x371b70,_0x1e8637,_0x5589('0x1b4'));}else{_0x1eaceb[_0x5589('0x123')](_0x37692e,_0x371b70,_0x1e8637,_0x5589('0x1b4'));}}break;case'8':_0x4225e6[_0x5589('0x1b5')]+=0x1;_0x37692e[_0x5589('0xde')]=0x8;_0x37692e[_0x5589('0x6e')]=_0x5589('0x1b6');_0x37692e[_0x5589('0x11f')]+=0x1;_0x37692e[_0x5589('0xda')]+=0x1;_0x1c3ca7=_0x4225e6['dialCongestionRetryFrequency'];_0x5691a8=_0x4225e6[_0x5589('0xdc')];ami[_0x5589('0x41')](_0x5589('0x1b7'),ut[_0x5589('0x116')](_0x392f56,'congestion'));hopperUtils[_0x5589('0xd1')](_0x37692e)['catch'](loggerCatch(_0x5589('0x1b8')));if(_0x1eaceb['checkRetriveMax'](0x8,_0x392f56,_0x4225e6)&&!_0x36875d){if(_0x37692e[_0x5589('0x11f')]>=_0x4225e6[_0x5589('0x1b9')]){_0x1eaceb[_0x5589('0x126')](_0x37692e,_0x371b70,_0x1e8637,_0x5589('0x1ba'));}else{_0x1eaceb[_0x5589('0x123')](_0x37692e,_0x371b70,_0x1e8637,_0x5589('0x1ba'));}}break;case'11':_0x4225e6[_0x5589('0x1bb')]+=0x1;_0x37692e[_0x5589('0xde')]=0xb;_0x37692e[_0x5589('0x6e')]=_0x5589('0xf2');_0x37692e[_0x5589('0xef')]+=0x1;_0x37692e[_0x5589('0xda')]+=0x1;_0x1c3ca7=_0x4225e6[_0x5589('0xf1')];_0x5691a8=_0x4225e6[_0x5589('0xdc')];hopperUtils[_0x5589('0xd1')](_0x37692e)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x1eaceb[_0x5589('0x193')](0xb,_0x392f56,_0x4225e6)&&!_0x36875d){if(_0x37692e[_0x5589('0xef')]>=_0x4225e6[_0x5589('0xf0')]){_0x1eaceb[_0x5589('0x126')](_0x37692e,_0x371b70,_0x1e8637,'reason\x2011\x20abandoned');}else{_0x1eaceb[_0x5589('0x123')](_0x37692e,_0x371b70,_0x1e8637,'reason\x2011\x20abandoned');}}break;case'20':_0x4225e6[_0x5589('0x1bc')]+=0x1;_0x37692e[_0x5589('0xde')]=0x14;_0x37692e[_0x5589('0x6e')]=_0x5589('0x1bd');_0x37692e[_0x5589('0x121')]+=0x1;_0x37692e[_0x5589('0xda')]+=0x1;_0x1c3ca7=_0x4225e6['dialAgentRejectRetryFrequency'];_0x5691a8=_0x4225e6[_0x5589('0xdc')];ami[_0x5589('0x41')]('custom:agentreject',ut[_0x5589('0x116')](_0x392f56,_0x5589('0x1be')));hopperUtils[_0x5589('0xd1')](_0x37692e)[_0x5589('0xa3')](loggerCatch(_0x5589('0x1bf')));if(_0x1eaceb['checkRetriveMax'](0x14,_0x392f56,_0x4225e6)&&!_0x36875d){if(_0x37692e['countagentrejectretry']>=_0x4225e6['dialAgentRejectMaxRetry']){_0x1eaceb[_0x5589('0x126')](_0x37692e,_0x371b70,_0x1e8637,_0x5589('0x1c0'));}else{_0x1eaceb[_0x5589('0x123')](_0x37692e,_0x371b70,_0x1e8637,_0x5589('0x1c0'));}}break;default:_0x4225e6[_0x5589('0x1c1')]+=0x1;_0x37692e[_0x5589('0xde')]=0xc;_0x37692e['statedesc']=_0xf73ac2[_0x5589('0xcc')];_0x1c3ca7=_0x4225e6[_0x5589('0x1a2')];_0x5691a8=_0x4225e6['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x37692e)[_0x5589('0xa3')](loggerCatch(_0x5589('0x1c2')));if(_0x1eaceb[_0x5589('0x193')](_0xf73ac2[_0x5589('0xcc')],_0x392f56,_0x4225e6)&&!_0x36875d){if(_0x37692e[_0x5589('0x198')]+_0x37692e[_0x5589('0x11f')]+_0x37692e[_0x5589('0x194')]+_0x37692e[_0x5589('0x120')]+_0x37692e[_0x5589('0xd9')]+_0x37692e[_0x5589('0xef')]+_0x37692e['countmachineretry']+_0x37692e[_0x5589('0x121')]>=_0x4225e6[_0x5589('0x122')]){_0x1eaceb['stateGlobal'](_0x37692e,_0x371b70,_0x1e8637,_0xf73ac2['reason']);}else{_0x1eaceb[_0x5589('0x126')](_0x37692e,_0x371b70,_0x1e8637,_0xf73ac2[_0x5589('0xcc')]);}}}})[_0x5589('0xa7')](function(){if(_0x36875d){hopperUtils[_0x5589('0xeb')](_0x37692e,_0x1c3ca7,_0x5691a8)['then'](function(){return _0x371b70(0x1);});}});});};Dialer['prototype'][_0x5589('0x123')]=function(_0xb442d5,_0x1e44e7,_0x22d952,_0x143a69){var _0x5cd63c=new Final(_0xb442d5);_0x5cd63c[_0x5589('0xde')]=0xf;_0x5cd63c['statedesc']=_0x5589('0x1c3');this[_0x5589('0x126')](_0x5cd63c,_0x1e44e7,_0x22d952,_0x143a69);};Dialer[_0x5589('0x8b')][_0x5589('0x126')]=function(_0x1df0a8,_0x1a969e,_0x3a2a58,_0x640c6){hopperUtils[_0x5589('0xd2')](_0x1df0a8)[_0x5589('0xa7')](function(){return _0x1a969e(msgResponse(_0x5589('0x1c4'),'Success',_0x640c6));})['catch'](function(){return _0x3a2a58(msgResponse(_0x5589('0x1c5'),_0x5589('0x94'),_0x5589('0x1c6')));});};Dialer[_0x5589('0x8b')]['predictive']=function(_0x3fca3c){var _0x4c1006=_0x3fca3c['dialPredictiveOptimizationPercentage']/0x64;var _0x254edd=_0x3fca3c[_0x5589('0xd5')]/(_0x3fca3c[_0x5589('0xd5')]+_0x3fca3c['outboundAnswerCallsDay']);var _0x44d196=Math[_0x5589('0x1c7')](_0x3fca3c[_0x5589('0x1c8')]*(_0x3fca3c['predictiveIntervalMaxThreshold']/0x64));var _0x413267=Math[_0x5589('0x1c7')](_0x3fca3c[_0x5589('0x1c8')]*(_0x3fca3c[_0x5589('0x1c9')]/0x64));var _0x1a79ba=_0x3fca3c[_0x5589('0x13a')]+_0x3fca3c[_0x5589('0x13c')];var _0x5897=Math[_0x5589('0x1ca')](_0x3fca3c[_0x5589('0x59')]*_0x3fca3c[_0x5589('0x5f')]*_0x3fca3c[_0x5589('0x1cb')]*_0x3fca3c[_0x5589('0x1cc')]);if(_[_0x5589('0x40')](_0x3fca3c[_0x5589('0x25')])){if(!_[_0x5589('0x40')](_0x3fca3c[_0x5589('0x63')])){_0x3fca3c['startPredictive']=undefined;loggerPredictive[_0x5589('0x65')](_0x5589('0x1cd'),_0x5589('0x1ce'));}if(!_[_0x5589('0x40')](_0x3fca3c['handlePredictive'])){loggerPredictive[_0x5589('0x65')]('[startMethodPredictive][StartProgressive]',_0x5589('0x1cf'));clearInterval(_0x3fca3c[_0x5589('0x64')]);_0x3fca3c[_0x5589('0x64')]=undefined;}_0x3fca3c[_0x5589('0x25')]=moment()[_0x5589('0x47')](_0x5589('0xd0'));loggerPredictive['info'](_0x3fca3c[_0x5589('0x61')],'collection\x20data\x20in\x20progressive\x20at',_0x3fca3c['startProgressive']);this[_0x5589('0xb8')](_0x3fca3c,0x1);}else if(ifInterval(_0x3fca3c[_0x5589('0x1d0')],_0x3fca3c[_0x5589('0x25')])){this['handlePower'](_0x3fca3c,0x1);loggerPredictiveCalls[_0x5589('0x4a')](_0x5589('0x1d1'),_0x3fca3c[_0x5589('0x25')],_0x3fca3c['name']);_0x3fca3c['erlangCalls']=0x0;_0x3fca3c['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x4c1006<_0x254edd&&_0x3fca3c[_0x5589('0x1d2')]===_0x5589('0x1d3')){clearPredictiveAttributes(_0x3fca3c);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x254edd,_0x5589('0x25'),_0x3fca3c[_0x5589('0x61')]);}else if(_0x5897<_0x3fca3c[_0x5589('0xd6')]&&_0x3fca3c[_0x5589('0x1d2')]===_0x5589('0x1d3')){clearPredictiveAttributes(_0x3fca3c);loggerPredictive[_0x5589('0x4a')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x5897,_0x5589('0x1d4'),_0x3fca3c['predictiveIntervalErlangCallsDroppedCalls'],_0x5589('0x25'),_0x3fca3c[_0x5589('0x61')]);}else if(!ifInterval(_0x3fca3c[_0x5589('0x1d0')],_0x3fca3c[_0x5589('0x25')])&&_[_0x5589('0x40')](_0x3fca3c[_0x5589('0x63')])&&!_[_0x5589('0x40')](_0x3fca3c[_0x5589('0x25')])){_0x3fca3c[_0x5589('0x63')]=moment()[_0x5589('0x47')](_0x5589('0xd0'));loggerPredictive[_0x5589('0x4a')](_0x3fca3c[_0x5589('0x61')],'started\x20in\x20predictive\x20at',_0x3fca3c[_0x5589('0x63')]);hopperUtils[_0x5589('0x1d5')](_0x3fca3c[_0x5589('0x1d0')])[_0x5589('0xa7')](this['getDataPredictive'](_0x3fca3c))[_0x5589('0xa7')](mergeDataErlangB(_0x3fca3c))[_0x5589('0xa7')](this[_0x5589('0x1d6')](_0x3fca3c))[_0x5589('0xa3')](loggerCatchPredictive(_0x5589('0x1d7'),_0x3fca3c));}else if(!ifInterval(_0x3fca3c[_0x5589('0x1d0')],_0x3fca3c[_0x5589('0x63')])){_0x3fca3c[_0x5589('0xd6')]=0x0;_0x3fca3c['startPredictive']=moment()[_0x5589('0x47')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x5589('0x4a')](_0x3fca3c['name'],_0x5589('0x1d8'),_0x3fca3c[_0x5589('0x63')]);clearInterval(_0x3fca3c[_0x5589('0x64')]);_0x3fca3c[_0x5589('0x64')]=undefined;hopperUtils['avgHandleTime'](_0x3fca3c[_0x5589('0x1d0')])[_0x5589('0xa7')](this[_0x5589('0x1d9')](_0x3fca3c))[_0x5589('0xa7')](mergeDataErlangB(_0x3fca3c))[_0x5589('0xa7')](this['startMethodPredictive'](_0x3fca3c))[_0x5589('0xa3')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x3fca3c));}else if(_0x3fca3c[_0x5589('0x1c8')]&&_0x1a79ba<_0x3fca3c[_0x5589('0x1c8')]-_0x413267){clearPredictiveAttributes(_0x3fca3c);loggerPredictive['info'](_0x3fca3c['name'],_0x5589('0x1da'),_0x1a79ba,_0x5589('0x1db'),_0x3fca3c[_0x5589('0x1c8')],'-',_0x413267,'=',_0x3fca3c[_0x5589('0x1c8')]-_0x413267,')');}else if(_0x3fca3c['predictiveIntervalAvailable']&&_0x1a79ba>_0x3fca3c[_0x5589('0x1c8')]+_0x44d196){clearPredictiveAttributes(_0x3fca3c);loggerPredictive[_0x5589('0x4a')](_0x3fca3c[_0x5589('0x61')],_0x5589('0x1da'),_0x1a79ba,_0x5589('0x1dc'),_0x3fca3c[_0x5589('0x1c8')],'+',_0x44d196,'=',_0x3fca3c['predictiveIntervalAvailable']+_0x44d196,')');}};Dialer[_0x5589('0x8b')][_0x5589('0x1d9')]=function(_0x3eecbd){var _0x3314c2=this;return function(_0xabb639){return new Promise(function(_0x3b74ff,_0x24903f){_[_0x5589('0xfc')](_0x3eecbd,_0xabb639[0x0]);if(checkGetDataPredictive(_0xabb639[0x0])){var _0x438cfa=_0x3eecbd[_0x5589('0x1c8')]=_0x3eecbd[_0x5589('0x13c')]+_0x3eecbd['available'];var _0x95ce8f=_0x3eecbd['dialPredictiveInterval']*0x3c;var _0x5a2826=_0xabb639[0x0][_0x5589('0x52')]+_0xabb639[0x0]['predictiveIntervalAvgHoldtime'];var _0x18cf16=(_0xabb639[0x0]['predictiveIntervalAnsweredCalls']+_0xabb639[0x0][_0x5589('0x4f')]+_0xabb639[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xabb639[0x0][_0x5589('0x4c')];_0x3eecbd[_0x5589('0x1cb')]=_0x18cf16>0x0?_0x18cf16:0x1;switch(_0x3eecbd[_0x5589('0x1d2')]){case _0x5589('0x1d3'):var _0x5bf6e9=_0x3eecbd[_0x5589('0x1dd')]/0x64;return _0x3314c2['abandonmentRate'](_0x438cfa,_0x95ce8f,_0x5a2826,_0x18cf16,_0x5bf6e9)[_0x5589('0xa7')](function(_0x1179fe){return _0x3b74ff(_0x1179fe);});case _0x5589('0x1de'):var _0x51e2ed=_0x3eecbd[_0x5589('0x1dd')]/0x64;return _0x3314c2[_0x5589('0x1df')](_0x438cfa,_0x95ce8f,_0x5a2826,_0x18cf16,_0x51e2ed)['then'](function(_0x360d16){return _0x3b74ff(_0x360d16);});default:return _0x24903f(msgResponse('[getDataPredictive]',_0x5589('0x94'),_0x5589('0x1e0')));}}else{return _0x24903f(msgResponse(_0x5589('0x1e1'),_0x5589('0x94'),'check\x20failure'));}});};};Dialer['prototype'][_0x5589('0x1e2')]=function(_0x5af403){var _0x25497a=this;return function(_0x35b442){return new Promise(function(_0x461d70,_0x54dede){_['merge'](_0x5af403,_0x35b442[0x0]);if(checkGetDataPredictive(_0x35b442[0x0])){loggerPredictive['info'](JSON[_0x5589('0x73')](_0x35b442[0x0]));if(_0x5af403[_0x5589('0x1d2')]===_0x5589('0x1d3')){return _0x25497a[_0x5589('0x153')](_0x5af403['id'])[_0x5589('0xa7')](function(_0xfb349f){var _0x4b31cd=_0x5af403['loggedIn']-_0xfb349f[0x0]['outboundQueuePauses'];var _0x3600ab=_0x5af403['dialPredictiveInterval']*0x3c;var _0x4343d5=_0x35b442[0x0][_0x5589('0x52')]+_0x35b442[0x0][_0x5589('0x55')];var _0x3d295a=(_0x35b442[0x0][_0x5589('0x4e')]+_0x35b442[0x0][_0x5589('0x4f')]+_0x35b442[0x0][_0x5589('0x51')])/_0x35b442[0x0][_0x5589('0x4c')];var _0x5a587c=_0x5af403['dialPredictiveOptimizationPercentage']/0x64;_0x5af403['predictiveIntervalPauses']=_0xfb349f[0x0]['outboundQueuePauses']||0x0;_0x5af403[_0x5589('0x1cb')]=_0x3d295a>0x0?_0x3d295a:0x1;return _0x25497a[_0x5589('0x1e3')](_0x4b31cd,_0x3600ab,_0x4343d5,_0x3d295a,_0x5a587c);})[_0x5589('0xa7')](function(_0xaec069){return _0x461d70(_0xaec069);})[_0x5589('0xa3')](function(_0x121733){return _0x54dede(msgResponse(_0x5589('0x1e4'),_0x5589('0x94'),JSON[_0x5589('0x73')](_0x121733)));});}if(_0x5af403['dialPredictiveOptimization']===_0x5589('0x1de')){return _0x25497a[_0x5589('0x153')](_0x5af403['id'])[_0x5589('0xa7')](function(_0x29eb9f){var _0xc70def=_0x5af403[_0x5589('0x1e5')]-_0x29eb9f[0x0][_0x5589('0x1e6')];var _0x3e9dc1=_0x5af403[_0x5589('0x1d0')]*0x3c;var _0x25fbf9=_0x35b442[0x0][_0x5589('0x52')]+_0x35b442[0x0]['predictiveIntervalAvgHoldtime'];var _0x3e3df0=(_0x35b442[0x0][_0x5589('0x4e')]+_0x35b442[0x0][_0x5589('0x4f')]+_0x35b442[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x35b442[0x0]['predictiveIntervalTotalCalls'];var _0x2013a5=_0x5af403[_0x5589('0x1dd')]/0x64;_0x5af403[_0x5589('0x1e7')]=_0x29eb9f[0x0][_0x5589('0x1e6')]||0x0;_0x5af403[_0x5589('0x1cb')]=_0x3e3df0>0x0?_0x3e3df0:0x1;return _0x25497a['busyFactor'](_0xc70def,_0x3e9dc1,_0x25fbf9,_0x3e3df0,_0x2013a5);})['then'](function(_0x2fc13a){return _0x461d70(_0x2fc13a);})[_0x5589('0xa3')](function(_0x3d07c7){return _0x54dede(msgResponse(_0x5589('0x1e4'),_0x5589('0x94'),JSON[_0x5589('0x73')](_0x3d07c7)));});}}else{return _0x54dede(msgResponse(_0x5589('0x1e1'),_0x5589('0x94'),_0x5589('0x1e8')));}});};};Dialer[_0x5589('0x8b')]['startMethodPredictive']=function(_0x376945){var _0xb4875b=this;return function(){var _0x3253a0=0x0;var _0xca2539=Math['floor'](_0x376945[_0x5589('0x5b')]*0x3e8);if(_0xca2539>0x0){_0xca2539=_0xca2539<0x64?0x64:_0xca2539;loggerPredictive[_0x5589('0x4a')](_0x376945[_0x5589('0x61')],_0x5589('0x1e9'),_0xca2539,'milliseconds');_0x376945[_0x5589('0x64')]=setInterval(function(){_0xb4875b[_0x5589('0x64')](_0x376945);loggerPredictiveCalls[_0x5589('0x4a')]('[handlePredictive]',_0x3253a0+=0x1);},_0xca2539);}else{loggerPredictive[_0x5589('0x4a')](_0x376945[_0x5589('0x61')],_0x5589('0x1ea'));}};};Dialer[_0x5589('0x8b')][_0x5589('0x1eb')]=function(_0xac59e9,_0x2091fa){var _0x4b83d7=this;return function(_0x2b1f1b){if(_['isEmpty'](_0x2b1f1b)){if(_[_0x5589('0xf7')](_0x2091fa[_0x5589('0x159')])||!_0x2091fa[_0x5589('0x1ec')]){if(_0xac59e9[_0x5589('0xb5')]==='booked'){_0xac59e9[_0x5589('0x71')]=_[_0x5589('0x40')](_0xac59e9[_0x5589('0x71')])?!![]:_0xac59e9[_0x5589('0x71')];var _0x38b2ad=uuid['v4']();_0x4b83d7[_0x5589('0x21')][_0x38b2ad]=new Action(_0xac59e9,_0x2091fa,_0x38b2ad);loggerBooked[_0x5589('0x4a')]('[booked][checkContactBlack]',_0x38b2ad,'queueStatusComplete:\x20',JSON[_0x5589('0x73')](_0xac59e9[_0x5589('0x71')]),_0x5589('0x1ed'),_0xac59e9[_0x5589('0x61')]);if(_0xac59e9[_0x5589('0x71')]){_0xac59e9[_0x5589('0x71')]=![];_0x4b83d7[_0x5589('0xfb')][_0x4b83d7[_0x5589('0x21')][_0x38b2ad][_0x5589('0xc6')]]=[];ami[_0x5589('0x9e')]({'actionid':_0x38b2ad,'action':'queuestatus','queue':_0xac59e9[_0x5589('0x61')]})[_0x5589('0xa3')](function(){_0x4b83d7[_0x5589('0xc9')](_0xac59e9);hopperUtils[_0x5589('0xe3')]({'active':![],'ContactId':_0x4b83d7[_0x5589('0x21')][_0x38b2ad][_0x5589('0x101')],'ListId':_0x4b83d7[_0x5589('0x21')][_0x38b2ad][_0x5589('0xe5')],'VoiceQueueId':_0x4b83d7[_0x5589('0x21')][_0x38b2ad][_0x5589('0xe6')]||undefined,'CampaignId':_0x4b83d7[_0x5589('0x21')][_0x38b2ad][_0x5589('0xe7')]||undefined})[_0x5589('0xa3')](loggerCatch(_0x5589('0x1ee')));delete _0x4b83d7[_0x5589('0x21')][_0x38b2ad];});}else{loggerBooked[_0x5589('0x4a')]('[booked][checkContactBlack][else]',JSON[_0x5589('0x73')](_0xac59e9[_0x5589('0x71')]),'Queue:\x20',_0xac59e9[_0x5589('0x61')]);_0x4b83d7[_0x5589('0xc9')](_0xac59e9);hopperUtils[_0x5589('0xe3')]({'active':![],'ContactId':_0x4b83d7[_0x5589('0x21')][_0x38b2ad][_0x5589('0x101')],'ListId':_0x4b83d7[_0x5589('0x21')][_0x38b2ad]['ListId'],'VoiceQueueId':_0x4b83d7['actions'][_0x38b2ad][_0x5589('0xe6')]||undefined,'CampaignId':_0x4b83d7['actions'][_0x38b2ad][_0x5589('0xe7')]||undefined})[_0x5589('0xa3')](loggerCatch(_0x5589('0x1ee')));delete _0x4b83d7[_0x5589('0x21')][_0x38b2ad];}}else{return _0x4b83d7[_0x5589('0x1ef')](_0xac59e9,_0x2091fa);}}else{if(utils[_0x5589('0x60')](undefined,_0x2091fa['scheduledat'])<_0xac59e9[_0x5589('0x1f0')]*0x3c){if(_0x2091fa[_0x5589('0x148')]&&!_0x2091fa[_0x5589('0x148')]['voicePause']){_0x4b83d7[_0x5589('0x1b')][_0x5589('0x100')](_0x2091fa['id'])[_0x5589('0x19')](function(){_0x4b83d7[_0x5589('0xc9')](_0xac59e9);});}else{hopperUtils[_0x5589('0x1f1')]({'active':![]},_0x2091fa['id'],0x1)[_0x5589('0x19')](function(){_0x4b83d7[_0x5589('0xc9')](_0xac59e9);});}}else{_0xac59e9[_0x5589('0x1f2')]+=0x1;_0x4b83d7[_0x5589('0xc9')](_0xac59e9);if(_0xac59e9[_0x5589('0x1f3')]){hopperUtils[_0x5589('0xe3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2091fa[_0x5589('0x101')],'ListId':_0x2091fa[_0x5589('0xe5')],'VoiceQueueId':_0x2091fa[_0x5589('0xe6')]||undefined,'CampaignId':_0x2091fa[_0x5589('0xe7')]||undefined})[_0x5589('0xa3')](loggerCatch(_0x5589('0x1f4')));hopperUtils[_0x5589('0xd1')](createObjHistory(_0xac59e9,_0x2091fa,utils[_0x5589('0x69')][_0x5589('0x1f5')],0x17,'RecallInQueue'))['catch'](loggerCatch(_0x5589('0x1f6')));}else{_0x4b83d7['saveInDb'](createObjHistory(_0xac59e9,_0x2091fa,utils[_0x5589('0x69')][_0x5589('0x1f7')],0x16,'RecallFailedTimeout'),_0x5589('0x1f8'),_0x5589('0x1f9'));}}}}else{_0xac59e9[_0x5589('0x1fa')]+=0x1;_0x4b83d7[_0x5589('0x118')](createObjHistory(_0xac59e9,_0x2091fa,utils[_0x5589('0x69')]['BLACKLIST'],0xd,_0x5589('0x1fb')),_0x5589('0x1fc'),_0x5589('0x1fd'));throw'inBlackList';}};};Dialer[_0x5589('0x8b')][_0x5589('0x15c')]=function(_0x2fa5eb){var _0x579919=this;var _0x1a1013=_0x2fa5eb[_0x5589('0x1fe')]-_0x2fa5eb['originated']-_0x2fa5eb[_0x5589('0x1ff')];emitCampaignSummary(_0x2fa5eb);if(_0x1a1013>0x0){if(_0x1a1013>this['maxNumberOriginate']){_0x1a1013=this[_0x5589('0x20')];}_0x2fa5eb[_0x5589('0x1ff')]+=_0x1a1013;hopperUtils['getContactDialerIvr'](_0x2fa5eb,_0x1a1013)[_0x5589('0xa7')](function(_0x3004f8){_0x2fa5eb[_0x5589('0x1ff')]-=_0x1a1013;_0x2fa5eb['temp']=_0x2fa5eb[_0x5589('0x1ff')]>0x0?_0x2fa5eb[_0x5589('0x1ff')]:0x0;if(!utils['checkContactEmpty'](_0x3004f8)){_0x2fa5eb[_0x5589('0x68')]=utils[_0x5589('0x69')][_0x5589('0x6c')];logger['info']('[getContactCampaign2][Empty]'+_0x2fa5eb[_0x5589('0x61')]);}else{_0x2fa5eb[_0x5589('0x7f')]+=_0x3004f8[_0x5589('0x9c')];_0x2fa5eb[_0x5589('0x68')]=utils['CAMPAIGN_STATUS'][_0x5589('0x200')];for(var _0x4a7b70=0x0;_0x4a7b70<_0x3004f8['length'];_0x4a7b70+=0x1){_0x2fa5eb[_0x5589('0x201')]+=0x1;if(_[_0x5589('0xf7')](_0x3004f8[_0x4a7b70])||_['isNil'](_0x3004f8[_0x4a7b70][_0x5589('0x177')])||_['isNil'](_0x3004f8[_0x4a7b70]['phone'])){_0x579919[_0x5589('0x157')](_0x5589('0x202'),_0x2fa5eb,_0x3004f8[_0x4a7b70]);}else{hopperUtils[_0x5589('0x203')](_['pick'](_0x3004f8[_0x4a7b70],[_0x5589('0xe7'),_0x5589('0x15f')]))[_0x5589('0xa7')](_0x579919[_0x5589('0x1eb')](_0x2fa5eb,_0x3004f8[_0x4a7b70]))['catch'](_0x579919[_0x5589('0x204')](_0x5589('0x205'),_0x2fa5eb));}}}})[_0x5589('0xa3')](loggerGetContactDialer(_0x5589('0x206'),_0x2fa5eb,_0x1a1013));}};Dialer[_0x5589('0x8b')]['handlePower']=function(_0x4461bc,_0x296c4c){var _0x1d0477=this;var _0x568e49=[];if(_0x296c4c<0x1||_0x4461bc[_0x5589('0xb5')]===_0x5589('0xa')){_0x296c4c=0x1;}var _0x4ca900=Math['floor'](_0x4461bc['available']*_0x296c4c)-_0x4461bc[_0x5589('0x7f')]-_0x4461bc['temp'];if(_0x4461bc[_0x5589('0x207')]>0x0){var _0x4b47fa=_0x4461bc['dialLimitQueue']-_0x4461bc['originated']-_0x4461bc[_0x5589('0x13c')]-_0x4461bc[_0x5589('0x1ff')]-_0x4461bc[_0x5589('0x13d')];if(_0x4ca900>_0x4b47fa){_0x4ca900=_0x4b47fa;}}if(_0x4ca900>0x0){if(_0x4461bc[_0x5589('0xb5')]==='booked'){_0x4ca900=0x1;}if(_0x4ca900>this[_0x5589('0x20')]){_0x4ca900=this[_0x5589('0x20')];}_0x4461bc[_0x5589('0x1ff')]+=_0x4ca900;for(var _0x1d8255 in this[_0x5589('0x1e')]){if(typeof this[_0x5589('0x1e')][_0x1d8255]!=='undefined'){if(this[_0x5589('0x1e')][_0x1d8255][_0x5589('0xde')]===_0x5589('0x208')&&this[_0x5589('0x1e')][_0x1d8255][_0x5589('0x89')]==='reachable'){_0x568e49['push'](this[_0x5589('0x1e')][_0x1d8255]['id']);}}}hopperUtils['getContactDialer'](_0x4461bc,_0x568e49,_0x4ca900)['then'](function(_0x29f66a){_0x4461bc['temp']-=_0x4ca900;_0x4461bc[_0x5589('0x1ff')]=_0x4461bc[_0x5589('0x1ff')]>0x0?_0x4461bc['temp']:0x0;if(!utils[_0x5589('0x209')](_0x29f66a)){hopperUtils[_0x5589('0x20a')](_0x4461bc)[_0x5589('0xa7')](sendMessageReschedule(_0x4461bc))[_0x5589('0xa3')](loggerCatch(_0x5589('0x20b')));}else{_0x4461bc[_0x5589('0x7f')]+=_0x29f66a['length'];_0x4461bc[_0x5589('0x68')]=_0x4461bc[_0x5589('0xb5')]==='booked'?utils[_0x5589('0x69')]['ACTIVE']:utils[_0x5589('0x69')][_0x5589('0x200')];for(var _0x4a9df3=0x0;_0x4a9df3<_0x29f66a[_0x5589('0x9c')];_0x4a9df3+=0x1){if(_[_0x5589('0xf7')](_0x29f66a[_0x4a9df3])||_[_0x5589('0xf7')](_0x29f66a[_0x4a9df3][_0x5589('0x177')])||_['isNil'](_0x29f66a[_0x4a9df3][_0x5589('0x15f')])){_0x1d0477[_0x5589('0x157')](_0x5589('0x202'),_0x4461bc,_0x29f66a[_0x4a9df3]);}else{hopperUtils[_0x5589('0x20c')](_[_0x5589('0x74')](_0x29f66a[_0x4a9df3],[_0x5589('0xe6'),'phone']))[_0x5589('0xa7')](_0x1d0477[_0x5589('0x1eb')](_0x4461bc,_0x29f66a[_0x4a9df3]))['catch'](_0x1d0477[_0x5589('0x204')]('[actionOriginate]\x20',_0x4461bc));}}}})[_0x5589('0xa3')](loggerGetContactDialer(_0x5589('0x20d'),_0x4461bc,_0x4ca900));}};Dialer[_0x5589('0x8b')][_0x5589('0x64')]=function(_0x18b8c1){if(_0x18b8c1[_0x5589('0x207')]>0x0){var _0x2e5016=_0x18b8c1[_0x5589('0x207')]-_0x18b8c1['originated']-_0x18b8c1[_0x5589('0x13c')];if(_0x2e5016>0x0){this[_0x5589('0x20e')](_0x18b8c1);}else{loggerPredictiveCalls[_0x5589('0x4a')](_0x5589('0x20f'));}}else{this[_0x5589('0x20e')](_0x18b8c1);}};Dialer['prototype'][_0x5589('0x20e')]=function(_0x4039a8){var _0x4a1a23=this;var _0x3d2d47=[];_0x4039a8[_0x5589('0x7f')]+=0x1;for(var _0x5a00f5 in this[_0x5589('0x1e')]){if(typeof this[_0x5589('0x1e')][_0x5a00f5]!==_0x5589('0xb1')){if(this[_0x5589('0x1e')][_0x5a00f5][_0x5589('0xde')]==='not_inuse'&&this[_0x5589('0x1e')][_0x5a00f5]['status']===_0x5589('0x88')){_0x3d2d47[_0x5589('0x9d')](this['agents'][_0x5a00f5]['id']);}}}return this['getContactDialer'](_0x4039a8['id'],_0x3d2d47,0x1,_0x4039a8[_0x5589('0x210')],_0x4039a8)[_0x5589('0xa7')](function(_0x3c4e9c){if(!utils[_0x5589('0x209')](_0x3c4e9c)){utils[_0x5589('0x211')](_0x4039a8,0x1,0x0);return hopperUtils['countReScheduled'](_0x4039a8)[_0x5589('0xa7')](sendMessageReschedule(_0x4039a8))[_0x5589('0xa3')](loggerCatch(_0x5589('0x20b')));}else{_0x4039a8[_0x5589('0x68')]=utils[_0x5589('0x69')]['RUNNING'];if(_[_0x5589('0xf7')](_0x3c4e9c[0x0])||_[_0x5589('0xf7')](_0x3c4e9c[0x0][_0x5589('0x177')])||_[_0x5589('0xf7')](_0x3c4e9c[0x0][_0x5589('0x15f')])){_0x4a1a23[_0x5589('0x157')](_0x5589('0x202'),_0x4039a8,_0x3c4e9c[0x0]);}else{return hopperUtils[_0x5589('0x20c')](_['pick'](_0x3c4e9c[0x0],['VoiceQueueId',_0x5589('0x15f')]))[_0x5589('0xa7')](_0x4a1a23[_0x5589('0x1eb')](_0x4039a8,_0x3c4e9c[0x0]))['catch'](_0x4a1a23[_0x5589('0x204')](_0x5589('0x212'),_0x4039a8));}}})[_0x5589('0xa3')](loggerGetContactDialer(_0x5589('0x213'),_0x4039a8,0x1));};Dialer[_0x5589('0x8b')][_0x5589('0x1e3')]=function(_0x26fc60,_0x1918d6,_0x2e2326,_0x2794cc,_0x5145c0,_0x5aec91){loggerPredictive[_0x5589('0x4a')](_0x5589('0x214'));loggerPredictive['info'](_0x5589('0x215'),_0x26fc60);loggerPredictive[_0x5589('0x4a')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1918d6);loggerPredictive[_0x5589('0x4a')](_0x5589('0x216'),_0x2e2326);loggerPredictive['info'](_0x5589('0x217'),_0x2794cc);loggerPredictive['info'](_0x5589('0x218'),_0x5145c0);loggerPredictive[_0x5589('0x4a')](_0x5589('0x53'));return new Promise(function(_0x1d0b30,_0x12016f){if(_0x26fc60<=0x0||isNaN(_0x26fc60)){return _0x12016f(msgResponse(_0x5589('0x219'),_0x5589('0xc4'),_0x5589('0x21a')+_0x26fc60));}if(_0x2e2326<=0x0||isNaN(_0x2e2326)){return _0x12016f(msgResponse(_0x5589('0x219'),'Error',_0x5589('0x21b')+_0x2e2326));}if(_0x2794cc<=0x0||isNaN(_0x2794cc)){return _0x12016f(msgResponse('[abandonmentRate]',_0x5589('0xc4'),_0x5589('0x21c')+_0x2794cc));}if(_0x1918d6<=0x0||isNaN(_0x1918d6)){return _0x12016f(msgResponse(_0x5589('0x219'),'Error',_0x5589('0x21d')+_0x1918d6));}if(_0x5145c0<=0x0||isNaN(_0x5145c0)){return _0x12016f(msgResponse('[abandonmentRate]',_0x5589('0xc4'),_0x5589('0x21e')+_0x5145c0));}_0x5aec91=_0x5aec91||0x0;var _0x57a014=0x1/_0x2e2326;var _0x55c78f=0x0;var _0x436d76=0x0;var _0x373bbc=0x0;var _0x4c4d56=0x0;for(var _0x57387e=0x0;_0x373bbc<_0x5145c0;_0x57387e+=0x1){_0x436d76=_0x57387e/_0x1918d6;_0x55c78f=(_0x2794cc*_0x436d76+_0x5aec91)/_0x57a014;_0x373bbc=utils['erlangb'](_0x55c78f,_0x26fc60);_0x4c4d56=_0x55c78f/_0x26fc60*(0x1-utils[_0x5589('0x21f')](_0x55c78f,_0x26fc60));}return _0x1d0b30({'erlangCalls':_0x57387e,'erlangCallToSecond':_0x1918d6/_0x57387e,'erlangAbandonmentRate':_0x373bbc,'erlangBusyFactor':_0x4c4d56});});};Dialer['prototype'][_0x5589('0x1df')]=function(_0x17bbbb,_0x3e4d78,_0x1d3791,_0x132590,_0x202d74,_0x2c41eb){loggerPredictive[_0x5589('0x4a')](_0x5589('0x220'));loggerPredictive['info'](_0x5589('0x215'),_0x17bbbb);loggerPredictive[_0x5589('0x4a')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e4d78);loggerPredictive[_0x5589('0x4a')]('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',_0x1d3791);loggerPredictive[_0x5589('0x4a')](_0x5589('0x217'),_0x132590);loggerPredictive[_0x5589('0x4a')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x202d74);loggerPredictive[_0x5589('0x4a')](_0x5589('0x53'));return new Promise(function(_0x162af1,_0x401d89){if(_0x17bbbb<=0x0||isNaN(_0x17bbbb)){return _0x401d89(msgResponse(_0x5589('0x221'),_0x5589('0xc4'),_0x5589('0x21a')+_0x17bbbb));}if(_0x1d3791<=0x0||isNaN(_0x1d3791)){return _0x401d89(msgResponse(_0x5589('0x221'),_0x5589('0xc4'),_0x5589('0x21b')+_0x1d3791));}if(_0x132590<=0x0||isNaN(_0x132590)){return _0x401d89(msgResponse('[busyFactor]',_0x5589('0xc4'),_0x5589('0x21c')+_0x132590));}if(_0x3e4d78<=0x0||isNaN(_0x3e4d78)){return _0x401d89(msgResponse('[busyFactor]',_0x5589('0xc4'),_0x5589('0x21d')+_0x3e4d78));}if(_0x202d74<=0x0||isNaN(_0x202d74)){return _0x401d89(msgResponse(_0x5589('0x221'),_0x5589('0xc4'),_0x5589('0x222')+_0x202d74));}_0x2c41eb=_0x2c41eb||0x0;var _0x1b1878=0x1/_0x1d3791;var _0x486953=0x0;var _0x5c72c3=0x0;var _0x3d74b8=0x0;var _0x568ccf=0x0;for(var _0x12aa07=0x0;_0x568ccf<_0x202d74;_0x12aa07+=0x1){_0x5c72c3=_0x12aa07/_0x3e4d78;_0x486953=(_0x132590*_0x5c72c3+_0x2c41eb)/_0x1b1878;_0x3d74b8=utils['erlangb'](_0x486953,_0x17bbbb);_0x568ccf=_0x486953/_0x17bbbb*(0x1-utils[_0x5589('0x21f')](_0x486953,_0x17bbbb));}return _0x162af1({'erlangCalls':_0x12aa07,'erlangCallToSecond':_0x3e4d78/_0x12aa07,'erlangAbandonmentRate':_0x3d74b8,'erlangBusyFactor':_0x568ccf});});};module['exports']=Dialer; \ No newline at end of file +var _0xd8c0=['uniqueid','ivr','updateOriginated','answertime','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','countdropretry','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','dialDropMaxRetry','additional','rescheduleContact','add','dialDropRetryFrequency','minutes','ContactId','VoiceQueueId','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','dialAbandonedMaxRetry','queueCallerAbandonCreateState','dialAbandonedRetryFrequency','ListId','Abandoned','[syncAgentComplete][createHistory][11]','channel','actionid','rrmemory','isNil','locked','stateinterface','idHopper','paused','roundrobin','run','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','[booked][unlock]','CampaignId','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','responsetime','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','saveInDb','[syncHangupInAMDIvr][createHistory]','countnoanswerretry','stateGlobal','reason19\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AGI','dialQueueProject','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','pTalking','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','reachable','handlePreviewRecallNotifications','map','Agent','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','undefined','enqueue','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','UserId','[syncQueueCallerAbandon]\x20[Drop]','user:%s','handleIvr','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','getCaller','dialAMDInitialSilence','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','XMD-','toUpper','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate','originate\x20action\x20Error','checkRetriveMax','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','custom:agentnosuchnumber','nosuchnumber','createStateFinal','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','outboundBusyCallsDay','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','dialPredictiveInterval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','talking','predictiveIntervalAnsweredCalls','dropRate','abandonmentRate','busyFactor','[getDataPredictive]','check\x20failure','outboundQueuePauses','predictiveIntervalPauses','predictiveIntervalHitRate','[CatchErlangB]','agentBusyFactor','loggedIn','milliseconds','fail\x20to\x20scheduled\x20calls','recallme','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','outboundReCallsDay','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','temp','maxNumberOriginate','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','ivrTotalCallsDays','checkIsBlackListIvr','checkContactBlack','loggerHandler','getContactDialer','countReScheduled','RUNNING','checkIsBlackList','[getContactDialer2]','dialLimitQueue','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','dialOrderByScheduledAt','[countReScheduled]\x20','[actionOriginate]\x20','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','interval\x20=\x20','Umin\x20=\x20','util','lodash','uuid','./utils/hopper','../preview/util/util','../../../config/logger','dialer','booked','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','127.0.0.1','prototype','tail','finally','preview','voiceQueues','campaigns','agents','trunks','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','varset','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\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','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','erlangAbandonmentRate','merge','debug','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','catch','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','resolve','checkIfTime','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','predictive','progressive','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','[ifTime][promiseAll]','Global:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','queue'];(function(_0x192e6b,_0x7cef59){var _0x7bec68=function(_0x4060f3){while(--_0x4060f3){_0x192e6b['push'](_0x192e6b['shift']());}};_0x7bec68(++_0x7cef59);}(_0xd8c0,0x162));var _0x0d8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8c0[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x0d8c('0x0'));var _=require(_0x0d8c('0x1'));var uuid=require(_0x0d8c('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require('ioredis');var utils=require('./utils');var hopperUtils=require(_0x0d8c('0x3'));var ut=require(_0x0d8c('0x4'));var config=require('../../../config/environment/');var logger=require(_0x0d8c('0x5'))(_0x0d8c('0x6'));var loggerBooked=require('../../../config/logger')(_0x0d8c('0x7'));var loggerPredictive=require(_0x0d8c('0x5'))('predictive');var loggerPredictiveCalls=require(_0x0d8c('0x5'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x0d8c('0x5'))('syncQueueSummary');var ami=require(_0x0d8c('0x8'));config[_0x0d8c('0x9')]=_[_0x0d8c('0xa')](config[_0x0d8c('0x9')],{'host':_0x0d8c('0xb'),'port':0x18eb});var io=require(_0x0d8c('0xc'))(new Redis(config[_0x0d8c('0x9')]));var cmHopper=require(_0x0d8c('0xd'));var voiceQueueRt=require(_0x0d8c('0xe'));var RpcSetting=require(_0x0d8c('0xf'));var Interval=require(_0x0d8c('0x10'));var Action=require(_0x0d8c('0x11'));var History=require(_0x0d8c('0x12'));var Final=require(_0x0d8c('0x13'));var AgentComplete=require(_0x0d8c('0x14'));var QueueCallerAbandon=require(_0x0d8c('0x15'));var Hangup=require(_0x0d8c('0x16'));var ipAgi=process[_0x0d8c('0x17')]['XCALLY_IP_AGI']||_0x0d8c('0x18');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x0d8c('0x19')]['enqueue']=function(_0x4bd75d){this[_0x0d8c('0x1a')]=this[_0x0d8c('0x1a')]?this[_0x0d8c('0x1a')][_0x0d8c('0x1b')](_0x4bd75d):_0x4bd75d();};function Dialer(_0x155726,_0x388662){this['sequence']=new Sequence();this[_0x0d8c('0x1c')]=_0x388662;this[_0x0d8c('0x1d')]=_0x155726[_0x0d8c('0x1d')];this[_0x0d8c('0x1e')]=_0x155726[_0x0d8c('0x1e')];this[_0x0d8c('0x1f')]=_0x155726[_0x0d8c('0x1f')];this[_0x0d8c('0x20')]=_0x155726[_0x0d8c('0x20')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this['channels']={};this[_0x0d8c('0x21')]={};this[_0x0d8c('0x22')]={};this[_0x0d8c('0x23')]={};this['optionPredictive']={};this[_0x0d8c('0x24')]={};this[_0x0d8c('0x25')]={};this[_0x0d8c('0x26')]={};this[_0x0d8c('0x27')]={};this[_0x0d8c('0x28')]={};this[_0x0d8c('0x29')]={};ami['on'](_0x0d8c('0x2a'),this[_0x0d8c('0x2b')][_0x0d8c('0x2c')](this));ami['on'](_0x0d8c('0x2d'),this[_0x0d8c('0x2e')][_0x0d8c('0x2c')](this));ami['on'](_0x0d8c('0x2f'),this[_0x0d8c('0x30')][_0x0d8c('0x2c')](this));ami['on'](_0x0d8c('0x31'),this[_0x0d8c('0x32')][_0x0d8c('0x2c')](this));ami['on'](_0x0d8c('0x33'),this[_0x0d8c('0x34')][_0x0d8c('0x2c')](this));ami['on'](_0x0d8c('0x35'),this[_0x0d8c('0x36')][_0x0d8c('0x2c')](this));ami['on'](_0x0d8c('0x37'),this[_0x0d8c('0x38')][_0x0d8c('0x2c')](this));ami['on'](_0x0d8c('0x39'),this['syncNewExten'][_0x0d8c('0x2c')](this));ami['on'](_0x0d8c('0x3a'),this['syncVarSet'][_0x0d8c('0x2c')](this));ami['on'](_0x0d8c('0x3b'),this[_0x0d8c('0x3c')][_0x0d8c('0x2c')](this));ami['on']('queuestatuscomplete',this[_0x0d8c('0x3d')][_0x0d8c('0x2c')](this));this[_0x0d8c('0x3e')]();this['loopClearZombieChannels']();RpcSetting[_0x0d8c('0x3f')]()[_0x0d8c('0x40')](function(_0x14be3f){previewRecallmeReminderInterval=_0x14be3f[_0x0d8c('0x41')];});}function isNotNull(_0x88e213){return _0x88e213!==null&&!_[_0x0d8c('0x42')](_0x88e213);}function msgResponse(_0x1757a7,_0x3256bf,_0x3be9d4){return{'action':_0x1757a7,'response':_0x3256bf,'message':_0x3be9d4,'stack':_0x3be9d4};}function emit(_0x19ae43,_0x3cd4c6,_0x129692){io['to'](_0x19ae43)[_0x0d8c('0x43')](_0x3cd4c6,_0x129692);}function emitOutboundVoiceQueueSummary(_0x121b46){if(_0x121b46[_0x0d8c('0x44')]===_0x0d8c('0x45')){logger['debug'](_0x0d8c('0x46'),util[_0x0d8c('0x47')](_0x121b46,{'showHidden':![],'depth':null}));emit(util[_0x0d8c('0x48')]('voice:queue:%s',_0x121b46[_0x0d8c('0x49')]),_0x0d8c('0x4a'),_0x121b46);}}function checkGetDataPredictive(_0x39e2f9){if(isNotNull(_0x39e2f9)&&!_[_0x0d8c('0x4b')](_0x39e2f9)){loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x4d'));loggerPredictive[_0x0d8c('0x4c')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x39e2f9[_0x0d8c('0x4e')]);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x4f'),_0x39e2f9['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x50'),_0x39e2f9[_0x0d8c('0x51')]);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x52'),_0x39e2f9[_0x0d8c('0x53')]);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x54'),_0x39e2f9[_0x0d8c('0x55')]);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x56'),_0x39e2f9[_0x0d8c('0x57')]);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x58'));if(_0x39e2f9[_0x0d8c('0x4e')]>0x0){if(!_[_0x0d8c('0x42')](_0x39e2f9[_0x0d8c('0x57')])&&_0x39e2f9['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x0d8c('0x4c')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x0d8c('0x42')](_0x39e2f9['predictiveIntervalAvgHoldtime'])&&_0x39e2f9['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x59'));}else{loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x5a'));}}else{loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x5b'));}return![];}function mergeDataErlangB(_0x3e3647){return function(_0xde1d81){loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x5c'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xde1d81[_0x0d8c('0x5d')]);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x5e'),_0xde1d81[_0x0d8c('0x5f')]);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x60'),_0xde1d81['erlangAbandonmentRate']);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x61'),_0xde1d81[_0x0d8c('0x62')]);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x60'),_0xde1d81[_0x0d8c('0x63')]);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x58'));_[_0x0d8c('0x64')](_0x3e3647,_0xde1d81);};}function ifInterval(_0x1fa7a0,_0xf78850){if(_['isUndefined'](_0xf78850)){return![];}return utils['getSeconds'](undefined,_0xf78850)<_0x1fa7a0*0x3c;}function clearPredictiveAttributes(_0x2b04ff){if(_0x2b04ff[_0x0d8c('0x25')]){_0x2b04ff[_0x0d8c('0x25')]=undefined;loggerPredictive[_0x0d8c('0x65')](_0x2b04ff['name'],'startProgressive\x20value\x20cleared');}if(_0x2b04ff[_0x0d8c('0x24')]){_0x2b04ff[_0x0d8c('0x24')]=undefined;loggerPredictive[_0x0d8c('0x65')](_0x2b04ff[_0x0d8c('0x49')],_0x0d8c('0x66'));}if(_0x2b04ff['handlePredictive']){clearInterval(_0x2b04ff[_0x0d8c('0x67')]);_0x2b04ff[_0x0d8c('0x67')]=undefined;loggerPredictive[_0x0d8c('0x65')](_0x2b04ff[_0x0d8c('0x49')],_0x0d8c('0x68'));}}function loggerCatchPredictive(_0x11e8e8,_0x4a0fee){return function(_0x58e241){loggerPredictive[_0x0d8c('0x69')](_0x4a0fee[_0x0d8c('0x49')],_0x11e8e8);loggerPredictive[_0x0d8c('0x69')](_0x58e241[_0x0d8c('0x6a')]);clearPredictiveAttributes(_0x4a0fee);};}function loggerCatch(_0x4b8939){return function(_0x2b8b31){logger[_0x0d8c('0x69')](_0x4b8939,util['inspect'](_0x2b8b31,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x3934c7,_0x28affa,_0x5aacf8){return function(_0x3806da){utils[_0x0d8c('0x6b')](_0x28affa,_0x5aacf8,0x0);logger[_0x0d8c('0x69')](_0x3934c7,util[_0x0d8c('0x47')](_0x3806da,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4e13a9){return function(_0x7a174a){if(isNotNull(_0x7a174a)&&isNotNull(_0x7a174a[0x0])){if(_0x7a174a[0x0][_0x0d8c('0x6c')]>0x0){_0x4e13a9[_0x0d8c('0x6d')]=utils[_0x0d8c('0x6e')][_0x0d8c('0x6f')];logger[_0x0d8c('0x4c')]('[getContactDialer2][ReScheduled]'+_0x4e13a9[_0x0d8c('0x49')],_0x7a174a[0x0][_0x0d8c('0x6c')],_0x0d8c('0x70'));}else{_0x4e13a9['message']=utils[_0x0d8c('0x6e')][_0x0d8c('0x71')];logger[_0x0d8c('0x4c')](_0x0d8c('0x72')+_0x4e13a9['name']);}}};}function createObjHistory(_0x3bfe8f,_0x597134,_0x2e9e96,_0x20412f,_0x57a003){_0x3bfe8f[_0x0d8c('0x6d')]=_0x2e9e96;var _0x375c20=new Action(_0x3bfe8f,_0x597134);var _0x25bee8=new History(_0x375c20);_0x25bee8[_0x0d8c('0x73')]=_0x20412f;_0x25bee8[_0x0d8c('0x74')]=_0x57a003;_0x25bee8[_0x0d8c('0x75')]=_0x375c20[_0x0d8c('0x76')];return _0x25bee8;}function unlockQueueStatus(_0xb17ad9,_0x39c539){setTimeout(function(){if(_[_0x0d8c('0x42')](_0xb17ad9[_0x0d8c('0x77')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x39c539);}_0xb17ad9['queueStatusComplete']=!![];loggerBooked[_0x0d8c('0x4c')](_0x0d8c('0x78'),_0x39c539,JSON[_0x0d8c('0x79')](_[_0x0d8c('0x7a')](_0xb17ad9,[_0x0d8c('0x49'),_0x0d8c('0x77')])));},0x1f3);}function checkInterval(_0x3a3cb5){return function(){if(!isNotNull(_0x3a3cb5[_0x0d8c('0x7b')])){_0x3a3cb5[_0x0d8c('0x6d')]=utils[_0x0d8c('0x6e')][_0x0d8c('0x7c')];throw _0x3a3cb5[_0x0d8c('0x49')]+_0x0d8c('0x7d');}if(!isNotNull(_0x3a3cb5[_0x0d8c('0x7b')][_0x0d8c('0x7e')])){_0x3a3cb5[_0x0d8c('0x6d')]=utils[_0x0d8c('0x6e')]['NULL_INTERVAL'];throw _0x3a3cb5['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x0d8c('0x4b')](_0x3a3cb5[_0x0d8c('0x7b')][_0x0d8c('0x7e')]))){_0x3a3cb5[_0x0d8c('0x6d')]=utils[_0x0d8c('0x6e')][_0x0d8c('0x7c')];throw _0x3a3cb5[_0x0d8c('0x49')]+_0x0d8c('0x7d');}};}function checkIsIVRCampaignActive(_0x17e044){return function(){if(!utils[_0x0d8c('0x7f')](_0x17e044)){_0x17e044[_0x0d8c('0x6d')]=utils['CAMPAIGN_STATUS'][_0x0d8c('0x80')];throw _0x17e044['name']+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x45d57a){if(utils[_0x0d8c('0x81')](_0x45d57a)){emit(util[_0x0d8c('0x48')](_0x0d8c('0x82'),_0x45d57a[_0x0d8c('0x49')]),'campaign:save',_0x45d57a);}}function loggerCatchQueueSummary(_0x3a842f,_0x1a7002){return function(_0x4f2e14){clearPredictiveAttributes(_0x1a7002);emitCampaignSummary(_0x1a7002);loggerSyncQueueSummary['debug'](_0x3a842f,util[_0x0d8c('0x47')](_0x4f2e14,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x2035f6){if(_0x2035f6['sendMessageOneNotActive']){if(_0x2035f6['originated']===0x0){_0x2035f6[_0x0d8c('0x83')]=![];_0x2035f6['message']=utils['CAMPAIGN_STATUS'][_0x0d8c('0x80')];loggerSyncQueueSummary[_0x0d8c('0x65')](_0x0d8c('0x84'),_0x2035f6['name'],_0x0d8c('0x85'));}else{_0x2035f6[_0x0d8c('0x6d')]=utils[_0x0d8c('0x6e')]['DISACTIVED'];loggerSyncQueueSummary[_0x0d8c('0x65')](_0x0d8c('0x84'),_0x2035f6[_0x0d8c('0x49')],_0x0d8c('0x86'));}emitCampaignSummary(_0x2035f6);}}function myreject(_0x17b734){return function(_0x483802){return _0x17b734(msgResponse(_0x0d8c('0x87'),_0x0d8c('0x88'),JSON[_0x0d8c('0x79')](_0x483802)));};}Dialer[_0x0d8c('0x19')][_0x0d8c('0x89')]=function(_0x4d863d){return!_['isUndefined'](_0x4d863d)&&_0x4d863d&&!_[_0x0d8c('0x42')](_0x4d863d[_0x0d8c('0x49')])&&!_[_0x0d8c('0x42')](_0x4d863d[_0x0d8c('0x8a')])&&_0x4d863d[_0x0d8c('0x8a')]&&(this[_0x0d8c('0x20')][util[_0x0d8c('0x48')](_0x0d8c('0x8b'),_0x4d863d[_0x0d8c('0x49')])][_0x0d8c('0x8c')]==='reachable'||this[_0x0d8c('0x20')][util[_0x0d8c('0x48')]('SIP/%s',_0x4d863d[_0x0d8c('0x49')])][_0x0d8c('0x8c')]===_0x0d8c('0x8d'));};Dialer[_0x0d8c('0x19')][_0x0d8c('0x8e')]=function(_0x1829e6){var _0x546a7b=this;return function(){if(!_0x546a7b[_0x0d8c('0x89')](_0x1829e6[_0x0d8c('0x8f')])){if(!_0x546a7b['isTrunkReachable'](_0x1829e6[_0x0d8c('0x90')])){_0x1829e6[_0x0d8c('0x6d')]=utils[_0x0d8c('0x6e')][_0x0d8c('0x91')];throw _0x1829e6[_0x0d8c('0x49')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0x0d8c('0x19')]['checkIfTime']=function(_0x12ea54,_0x40c243,_0x563ed9,_0x1b2984){var _0xd133ca=this;return function(){var _0x528f6a=!![];return _0xd133ca['ifTimeIvr'](_0x12ea54,_0x40c243,_0x563ed9,_0x1b2984,_0x528f6a);};};Dialer[_0x0d8c('0x19')][_0x0d8c('0x92')]=function(_0x191875,_0x231fb4,_0x5c0ae0,_0x19f2c0){var _0x1c5465=this;return function(){var _0x19d237=![];return _0x1c5465['ifTimeIvr'](_0x191875[_0x0d8c('0x7e')],_0x231fb4,_0x5c0ae0,_0x19f2c0,_0x19d237);};};Dialer['prototype'][_0x0d8c('0x93')]=function(_0x512c3e,_0x432adf,_0x32fc22,_0x1de4e8,_0x452153){var _0x9beb99=[];return new Promise(function(_0x3116a9,_0x36054f){if(!isNotNull(_0x512c3e)){_0x1de4e8[_0x0d8c('0x6d')]=utils[_0x0d8c('0x6e')][_0x0d8c('0x7c')];return _0x36054f(msgResponse(_0x0d8c('0x94'),_0x0d8c('0x95'),_0x32fc22+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x0d8c('0x4b')](_0x512c3e)){_0x1de4e8[_0x0d8c('0x6d')]=utils['CAMPAIGN_STATUS'][_0x0d8c('0x96')];return _0x36054f(msgResponse(_0x0d8c('0x94'),'Failure',_0x32fc22+_0x0d8c('0x97')));}if(_0x432adf&&_[_0x0d8c('0x42')](config[_0x0d8c('0x98')][_0x432adf])){_0x1de4e8['message']=utils[_0x0d8c('0x6e')][_0x0d8c('0x99')];return _0x36054f(msgResponse('ifTime',_0x0d8c('0x95'),_0x32fc22+_0x0d8c('0x9a')+_0x432adf));}if(_[_0x0d8c('0x9b')](_0x512c3e)){for(var _0x538b20=0x0;_0x538b20<_0x512c3e[_0x0d8c('0x9c')];_0x538b20+=0x1){_0x9beb99[_0x0d8c('0x9d')](ami[_0x0d8c('0x9e')]({'action':_0x0d8c('0x9f'),'command':util[_0x0d8c('0x48')](_0x0d8c('0xa0'),_0x512c3e[_0x538b20][_0x0d8c('0xa1')],!_[_0x0d8c('0x42')](config[_0x0d8c('0x98')][_0x432adf])?_0x432adf:'')})[_0x0d8c('0x40')](function(_0x45d169){return _0x45d169[_0x0d8c('0xa2')][_0x0d8c('0xa3')](_0x0d8c('0xa4'))>=0x0;})[_0x0d8c('0xa5')](myreject(_0x36054f)));}}else{_0x9beb99[_0x0d8c('0x9d')](ami[_0x0d8c('0x9e')]({'action':_0x0d8c('0x9f'),'command':util['format']('iftime\x20%s,%s',_0x512c3e,!_[_0x0d8c('0x42')](config[_0x0d8c('0x98')][_0x432adf])?_0x432adf:'')})[_0x0d8c('0x40')](function(_0x39468a){return _0x39468a[_0x0d8c('0xa2')][_0x0d8c('0xa3')]('true')>=0x0;})['catch'](myreject(_0x36054f)));}Promise['all'](_0x9beb99)[_0x0d8c('0x40')](function(_0x3018d6){var _0x2b7053=_[_0x0d8c('0xa6')](_0x3018d6);if(_0x2b7053){return _0x3116a9(_0x2b7053);}else{_0x1de4e8[_0x0d8c('0x6d')]=_0x452153?utils[_0x0d8c('0x6e')][_0x0d8c('0xa7')]:utils[_0x0d8c('0x6e')][_0x0d8c('0xa8')];return _0x36054f(msgResponse('[ifTime][promiseAll]',_0x0d8c('0x95'),'Global:\x20'+_0x452153+'\x20'+_0x32fc22+_0x0d8c('0xa9')+util[_0x0d8c('0x47')](_0x512c3e,{'showHidden':![],'depth':null})+_0x0d8c('0xaa')+_0x432adf));}})[_0x0d8c('0xa5')](function(_0xc7e51){return _0x36054f(msgResponse('ifTime',_0x0d8c('0x95'),JSON[_0x0d8c('0x79')](_0xc7e51)));});});};Dialer[_0x0d8c('0x19')][_0x0d8c('0x3e')]=function(){var _0x317356=this;return cmHopper[_0x0d8c('0xab')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x317356['syncCampaigns']();},0x3e8);});};Dialer[_0x0d8c('0x19')][_0x0d8c('0xac')]=function(){var _0x78bb25=this;var _0x1dbc03;for(var _0x48cd9b in this['campaigns']){if(typeof this['campaigns'][_0x48cd9b]!=='undefined'){_0x1dbc03=this['campaigns'][_0x48cd9b];if(utils[_0x0d8c('0x81')](_0x1dbc03)&&utils[_0x0d8c('0x7f')](_0x1dbc03)){_0x1dbc03[_0x0d8c('0x83')]=!![];Promise[_0x0d8c('0xad')]()[_0x0d8c('0x40')](checkIsIVRCampaignActive(_0x1dbc03))[_0x0d8c('0x40')](checkInterval(_0x1dbc03))[_0x0d8c('0x40')](_0x78bb25[_0x0d8c('0x8e')](_0x1dbc03))[_0x0d8c('0x40')](_0x78bb25[_0x0d8c('0xae')](_0x1dbc03[_0x0d8c('0xaf')],_0x1dbc03[_0x0d8c('0xb0')],_0x1dbc03[_0x0d8c('0x49')],_0x1dbc03))['then'](_0x78bb25['checkIfTimeIntervals'](_0x1dbc03['Interval'],_0x1dbc03[_0x0d8c('0xb0')],_0x1dbc03['name'],_0x1dbc03))['then'](_0x78bb25[_0x0d8c('0xb1')](_0x1dbc03))[_0x0d8c('0xa5')](loggerCatchQueueSummary(_0x0d8c('0xb2'),_0x1dbc03));}else{notSendMessagesCampaign(_0x1dbc03);}}}};Dialer[_0x0d8c('0x19')][_0x0d8c('0xb3')]=function(_0x1b9c68){if(_0x1b9c68[_0x0d8c('0xb4')]!==_0x0d8c('0xb5')){clearPredictiveAttributes(_0x1b9c68);}switch(_0x1b9c68[_0x0d8c('0xb4')]){case _0x0d8c('0xb6'):this[_0x0d8c('0xb7')](_0x1b9c68,0x1);break;case'power':this[_0x0d8c('0xb7')](_0x1b9c68,_0x1b9c68[_0x0d8c('0xb8')]);break;case'predictive':this[_0x0d8c('0xb5')](_0x1b9c68);break;case'booked':this['handlePower'](_0x1b9c68,0x1);break;default:logger[_0x0d8c('0x69')](_0x0d8c('0xb9'),_0x1b9c68[_0x0d8c('0x49')],_0x0d8c('0xba'));}};Dialer['prototype'][_0x0d8c('0x94')]=function(_0x2d663e,_0x4902fb){var _0x2a7854=_0x2d663e[_0x0d8c('0xb0')];var _0x1edf60=_0x4902fb?_0x2d663e['dialGlobalInterval']:_0x2d663e[_0x0d8c('0x7b')][_0x0d8c('0x7e')];logger[_0x0d8c('0xbb')](_0x0d8c('0xbc'),_0x1edf60,_0x2a7854,_0x2d663e['name'],util['format'](_0x0d8c('0xbd'),_0x2d663e['name'],_0x2d663e['id']));var _0x8aaeb8=null;return Interval['intervalIftime'](_0x1edf60,_0x2a7854)[_0x0d8c('0x40')](function(_0x3106b0){if(_0x3106b0===!![]){return _0x3106b0;}else{_0x2d663e[_0x0d8c('0x6d')]=_0x4902fb?utils[_0x0d8c('0x6e')][_0x0d8c('0xa7')]:utils['CAMPAIGN_STATUS'][_0x0d8c('0xa8')];_0x8aaeb8=msgResponse(_0x0d8c('0xbe'),_0x0d8c('0x95'),_0x0d8c('0xbf')+_0x4902fb+'\x20'+_0x2d663e[_0x0d8c('0x49')]+_0x0d8c('0xa9')+util[_0x0d8c('0x47')](_0x1edf60,{'showHidden':![],'depth':null})+_0x0d8c('0xaa')+_0x2a7854);}if(_0x8aaeb8!==null){logger[_0x0d8c('0xbb')](_0x0d8c('0xc0'),_0x8aaeb8);_0x8aaeb8[_0x0d8c('0xc1')]=_0x4902fb;throw _0x8aaeb8;}})[_0x0d8c('0xa5')](function(_0xab9140){logger['error']('AMI\x20IfTime',_0xab9140);throw msgResponse(_0x0d8c('0x87'),_0x0d8c('0x88'),util['inspect'](_0xab9140,{'showHidden':![],'depth':null}));});};Dialer[_0x0d8c('0x19')][_0x0d8c('0x2b')]=function(_0x59ad75){if(this[_0x0d8c('0x1d')][_0x59ad75[_0x0d8c('0xc2')]]){if(this[_0x0d8c('0x23')][_0x59ad75[_0x0d8c('0xc3')]]&&this[_0x0d8c('0x23')][_0x59ad75[_0x0d8c('0xc3')]]['type']!==_0x0d8c('0xc4')){this[_0x0d8c('0xc5')](this[_0x0d8c('0x1d')][_0x59ad75[_0x0d8c('0xc2')]]);this['uniqueId'][_0x59ad75[_0x0d8c('0xc3')]][_0x0d8c('0xc6')]=moment()[_0x0d8c('0x48')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x0d8c('0x19')][_0x0d8c('0x32')]=function(_0x3591f4){var _0x2e64e8=this[_0x0d8c('0x23')][_0x3591f4[_0x0d8c('0xc3')]];if(this[_0x0d8c('0x1d')][_0x3591f4[_0x0d8c('0xc2')]]){if(_0x2e64e8&&_0x2e64e8[_0x0d8c('0x44')]!==_0x0d8c('0xc4')){delete this['uniqueId'][_0x3591f4['uniqueid']];this['voiceQueues'][_0x3591f4[_0x0d8c('0xc2')]][_0x0d8c('0xc7')]+=0x1;var _0x16d423=new AgentComplete(_0x2e64e8,_0x3591f4);if(_0x3591f4[_0x0d8c('0xc8')]===_0x0d8c('0xc9')){_0x16d423[_0x0d8c('0xca')]=this[_0x0d8c('0x1d')][_0x3591f4['queue']][_0x0d8c('0xcb')]&&this[_0x0d8c('0x1d')][_0x3591f4[_0x0d8c('0xc2')]][_0x0d8c('0xcc')]?moment()['format'](_0x0d8c('0xcd')):undefined;}hopperUtils[_0x0d8c('0xce')](_0x16d423)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0xcf')));hopperUtils[_0x0d8c('0xd0')](_0x16d423)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0xd1')));}}};Dialer[_0x0d8c('0x19')][_0x0d8c('0x2e')]=function(_0x4ce3bb){var _0x1d2ec2=this[_0x0d8c('0x23')][_0x4ce3bb[_0x0d8c('0xc3')]];var _0x1ec30e=this;var _0x4b8ed8=![];var _0x32677c;var _0x368581;if(this[_0x0d8c('0x1d')][_0x4ce3bb[_0x0d8c('0xc2')]]){if(_0x1d2ec2&&_0x1d2ec2[_0x0d8c('0x44')]!=='ivr'){delete this[_0x0d8c('0x23')][_0x4ce3bb[_0x0d8c('0xc3')]];this[_0x0d8c('0xc5')](this['voiceQueues'][_0x4ce3bb[_0x0d8c('0xc2')]]);_0x1d2ec2[_0x0d8c('0xd2')]=moment()[_0x0d8c('0x48')](_0x0d8c('0xcd'));var _0x340513=new QueueCallerAbandon(_0x1d2ec2,_0x4ce3bb);if(utils['getSeconds'](_0x1d2ec2[_0x0d8c('0xd2')],_0x1d2ec2['responsetime'])>=_0x1d2ec2[_0x0d8c('0xd3')]){this['voiceQueues'][_0x4ce3bb[_0x0d8c('0xc2')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x4ce3bb[_0x0d8c('0xc2')]][_0x0d8c('0xd4')]+=0x1;this['voiceQueues'][_0x4ce3bb[_0x0d8c('0xc2')]][_0x0d8c('0xd5')]+=0x1;_0x340513[_0x0d8c('0x73')]=0xa;_0x340513[_0x0d8c('0x74')]='Drop';_0x340513[_0x0d8c('0xd6')]=_0x0d8c('0xd7');_0x340513[_0x0d8c('0xca')]=this[_0x0d8c('0x1d')][_0x4ce3bb[_0x0d8c('0xc2')]][_0x0d8c('0xcb')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x340513[_0x0d8c('0xd8')]+=0x1;_0x340513[_0x0d8c('0xd9')]+=0x1;_0x32677c=this[_0x0d8c('0x1d')][_0x4ce3bb[_0x0d8c('0xc2')]]['dialDropRetryFrequency'];_0x368581=this[_0x0d8c('0x1d')][_0x4ce3bb[_0x0d8c('0xc2')]][_0x0d8c('0xda')];hopperUtils[_0x0d8c('0xdb')](_0x340513,_0x340513[_0x0d8c('0x73')],_0x1d2ec2[_0x0d8c('0xdc')])['then'](function(_0x2883bc){_0x4b8ed8=_0x2883bc['additional']==0x1;if(_0x340513[_0x0d8c('0xd8')]>=_0x1ec30e[_0x0d8c('0x1d')][_0x4ce3bb[_0x0d8c('0xc2')]][_0x0d8c('0xdd')]){_0x1ec30e['queueCallerAbandonCreateState'](_0x340513,_0x2883bc[_0x0d8c('0xde')]);}else{hopperUtils[_0x0d8c('0xdf')]({'active':![],'countdropretry':_0x340513[_0x0d8c('0xd8')],'scheduledat':moment()[_0x0d8c('0xe0')](_0x1ec30e[_0x0d8c('0x1d')][_0x4ce3bb[_0x0d8c('0xc2')]][_0x0d8c('0xe1')],_0x0d8c('0xe2'))[_0x0d8c('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1d2ec2[_0x0d8c('0xe3')],'ListId':_0x1d2ec2['ListId'],'VoiceQueueId':_0x1d2ec2[_0x0d8c('0xe4')]||undefined,'CampaignId':_0x1d2ec2['CampaignId']||undefined})['catch'](loggerCatch(_0x0d8c('0xe5')));var _0x16a2b5=new History(_0x340513);_0x16a2b5[_0x0d8c('0x73')]=0xa;_0x16a2b5[_0x0d8c('0x74')]=_0x0d8c('0xe6');_0x16a2b5[_0x0d8c('0x76')]=moment()[_0x0d8c('0x48')](_0x0d8c('0xcd'));_0x16a2b5['endtime']=_0x16a2b5[_0x0d8c('0x76')];_0x16a2b5[_0x0d8c('0xe7')]=_0x340513['calleridname'];_0x16a2b5[_0x0d8c('0xe8')]=_0x340513['calleridnum'];hopperUtils[_0x0d8c('0xce')](_0x16a2b5)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0xe9')));}})[_0x0d8c('0x40')](function(){if(_0x4b8ed8)hopperUtils[_0x0d8c('0xea')](_0x340513,_0x32677c,_0x368581)[_0x0d8c('0x40')](function(){return 0x1;});});}else{this['voiceQueues'][_0x4ce3bb[_0x0d8c('0xc2')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x4ce3bb[_0x0d8c('0xc2')]][_0x0d8c('0xeb')]+=0x1;_0x340513[_0x0d8c('0x73')]=0xb;_0x340513[_0x0d8c('0x74')]='Abandoned';_0x340513[_0x0d8c('0xd6')]=_0x0d8c('0xec');_0x340513['countabandonedretry']+=0x1;_0x340513[_0x0d8c('0xd9')]+=0x1;_0x32677c=this['voiceQueues'][_0x4ce3bb['queue']]['dialAbandonedRetryFrequency'];_0x368581=this[_0x0d8c('0x1d')][_0x4ce3bb[_0x0d8c('0xc2')]][_0x0d8c('0xda')];hopperUtils['verifyAdditionalPhones'](_0x340513,_0x340513[_0x0d8c('0x73')],_0x1d2ec2[_0x0d8c('0xdc')])['then'](function(_0x24d98c){if(_0x340513[_0x0d8c('0xed')]>=_0x1ec30e[_0x0d8c('0x1d')][_0x4ce3bb[_0x0d8c('0xc2')]][_0x0d8c('0xee')]){_0x1ec30e[_0x0d8c('0xef')](_0x340513,_0x24d98c[_0x0d8c('0xde')]);}else{hopperUtils[_0x0d8c('0xdf')]({'active':![],'countabandonedretry':_0x340513[_0x0d8c('0xed')],'scheduledat':moment()[_0x0d8c('0xe0')](_0x1ec30e['voiceQueues'][_0x4ce3bb[_0x0d8c('0xc2')]][_0x0d8c('0xf0')],_0x0d8c('0xe2'))['format'](_0x0d8c('0xcd')),'ContactId':_0x1d2ec2[_0x0d8c('0xe3')],'ListId':_0x1d2ec2[_0x0d8c('0xf1')],'VoiceQueueId':_0x1d2ec2[_0x0d8c('0xe4')]||undefined,'CampaignId':_0x1d2ec2['CampaignId']||undefined})[_0x0d8c('0xa5')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x5d80c4=new History(_0x340513);_0x5d80c4['state']=0xb;_0x5d80c4[_0x0d8c('0x74')]=_0x0d8c('0xf2');_0x5d80c4[_0x0d8c('0x76')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5d80c4[_0x0d8c('0x75')]=_0x5d80c4[_0x0d8c('0x76')];_0x5d80c4['calleridname']=_0x340513[_0x0d8c('0xe7')];_0x5d80c4[_0x0d8c('0xe8')]=_0x340513[_0x0d8c('0xe8')];hopperUtils[_0x0d8c('0xce')](_0x5d80c4)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0xf3')));}})['then'](function(){if(_0x4b8ed8)hopperUtils[_0x0d8c('0xea')](_0x340513,_0x32677c,_0x368581)[_0x0d8c('0x40')](function(){return 0x1;});});}}}};Dialer[_0x0d8c('0x19')]['syncNewExten']=function(_0x574c06){if(this['actions'][_0x574c06[_0x0d8c('0xc3')]]){this[_0x0d8c('0x21')][_0x574c06[_0x0d8c('0xc3')]][_0x0d8c('0xf4')]=_0x574c06[_0x0d8c('0xf4')];}if(this['uniqueId'][_0x574c06['uniqueid']]){this[_0x0d8c('0x23')][_0x574c06[_0x0d8c('0xc3')]][_0x0d8c('0xf4')]=_0x574c06[_0x0d8c('0xf4')];}};Dialer['prototype']['syncQueueMember']=function(_0x598ead){if(!this[_0x0d8c('0x21')][_0x598ead[_0x0d8c('0xf5')]]){return;}var _0x22ea18=this[_0x0d8c('0x1d')][this['actions'][_0x598ead[_0x0d8c('0xf5')]][_0x0d8c('0xc2')]]['strategy']||_0x0d8c('0xf6');if(_0x22ea18==='roundrobin'){if(this[_0x0d8c('0x21')][_0x598ead[_0x0d8c('0xf5')]]&&_[_0x0d8c('0xf7')](this[_0x0d8c('0x21')][_0x598ead[_0x0d8c('0xf5')]][_0x0d8c('0xf8')])&&_0x598ead[_0x0d8c('0x8c')]==='1'&&_0x598ead['paused']==='0'){if(this[_0x0d8c('0x1f')][_0x598ead[_0x0d8c('0xf9')]]){if(!this[_0x0d8c('0x1f')][_0x598ead[_0x0d8c('0xf9')]][_0x0d8c('0xf8')]){this[_0x0d8c('0x1f')][_0x598ead['stateinterface']]['locked']=!![];this[_0x0d8c('0x21')][_0x598ead[_0x0d8c('0xf5')]][_0x0d8c('0xf8')]=!![];this[_0x0d8c('0x21')][_0x598ead['actionid']][_0x0d8c('0xf9')]=_0x598ead['stateinterface'];}}}}else if(_0x22ea18===_0x0d8c('0xf6')){if(this[_0x0d8c('0x21')][_0x598ead[_0x0d8c('0xf5')]]){if(this['agents'][_0x598ead['stateinterface']]){this[_0x0d8c('0x21')][_0x598ead[_0x0d8c('0xf5')]][_0x0d8c('0xf9')]=_0x598ead[_0x0d8c('0xf9')];if(_[_0x0d8c('0xf7')](this[_0x0d8c('0x27')][this[_0x0d8c('0x21')][_0x598ead[_0x0d8c('0xf5')]][_0x0d8c('0xc2')]])){this['queueBooked'][this[_0x0d8c('0x21')][_0x598ead[_0x0d8c('0xf5')]][_0x0d8c('0xc2')]]=[];}this[_0x0d8c('0x27')][this[_0x0d8c('0x21')][_0x598ead['actionid']][_0x0d8c('0xc2')]][_0x0d8c('0x9d')](_[_0x0d8c('0x64')](_['pick'](this[_0x0d8c('0x21')][_0x598ead[_0x0d8c('0xf5')]],[_0x0d8c('0xfa'),'stateinterface']),{'status':_0x598ead['status'],'paused':_0x598ead[_0x0d8c('0xfb')]}));}}}};Dialer[_0x0d8c('0x19')][_0x0d8c('0x3d')]=function(_0x354959){if(!this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]]){return;}var _0x46684e=this;var _0x29111d=this[_0x0d8c('0x1d')][this[_0x0d8c('0x21')][_0x354959['actionid']][_0x0d8c('0xc2')]];var _0x103798=_0x29111d['strategy']||_0x0d8c('0xf6');if(_0x103798===_0x0d8c('0xfc')){if(this['actions'][_0x354959[_0x0d8c('0xf5')]]&&this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xf9')]){this['preview'][_0x0d8c('0xfd')](this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xfa')],this[_0x0d8c('0x21')][_0x354959['actionid']][_0x0d8c('0xf9')])[_0x0d8c('0xa5')](function(_0x50f804){logger['error'](_0x0d8c('0xfe'),util['inspect'](_0x50f804,{'showHidden':![],'depth':null}));})[_0x0d8c('0x1b')](function(){_0x46684e[_0x0d8c('0xc5')](_0x46684e['voiceQueues'][_0x46684e[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xc2')]]);_0x46684e['agents'][_0x46684e[_0x0d8c('0x21')][_0x354959['actionid']][_0x0d8c('0xf9')]]['locked']=![];delete _0x46684e[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]];unlockQueueStatus(_0x29111d);});}else{this[_0x0d8c('0xc5')](this[_0x0d8c('0x1d')][this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]]['queue']]);hopperUtils[_0x0d8c('0xdf')]({'active':![],'ContactId':this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xe3')],'ListId':this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xf1')],'VoiceQueueId':this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xe4')]||undefined,'CampaignId':this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]]['CampaignId']||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]];unlockQueueStatus(_0x29111d);}}else if(_0x103798===_0x0d8c('0xf6')){var _0xed8d82;if(this[_0x0d8c('0x21')][_0x354959['actionid']]&&!_['isEmpty'](this[_0x0d8c('0x27')][this['actions'][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xc2')]])){if(this['queueBookedRR'][_0x46684e[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]]['queue']]){this[_0x0d8c('0x28')][_0x46684e[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xc2')]]=this[_0x0d8c('0x28')][this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xc2')]]?this[_0x0d8c('0x28')][this['actions'][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xc2')]]:this[_0x0d8c('0x27')][this['actions'][_0x354959[_0x0d8c('0xf5')]]['queue']]?this[_0x0d8c('0x27')][this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xc2')]][_0x0d8c('0xff')]||0x0:0x0;}this[_0x0d8c('0x27')][this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]]['queue']][_0x0d8c('0xff')]=this[_0x0d8c('0x28')][this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xc2')]];for(var _0x46eda8=0x0;_0x46eda8=_0x3975e8[_0x0d8c('0x129')]){_0xd6d0a0['stateGlobal'](_0x3dcc33,_0x522a49,_0x5c44a6,'reason19\x20machine....');}else{if(_0x3dcc33[_0x0d8c('0x122')]>=_0x3975e8[_0x0d8c('0x12a')]){_0xd6d0a0['createStateFinal'](_0x3dcc33,_0x522a49,_0x5c44a6,_0x0d8c('0x12b'));}else{hopperUtils[_0x0d8c('0xdf')]({'active':![],'countmachineretry':_0x3dcc33[_0x0d8c('0x122')],'scheduledat':moment()['add'](_0x3975e8[_0x0d8c('0x12c')],_0x0d8c('0xe2'))['format'](_0x0d8c('0xcd')),'ContactId':_0x3dcc33['ContactId'],'ListId':_0x3dcc33['ListId'],'VoiceQueueId':_0x3dcc33[_0x0d8c('0xe4')]||undefined,'CampaignId':_0x3dcc33[_0x0d8c('0x105')]||undefined})['catch'](loggerCatch(_0x0d8c('0x12d')));_0x522a49({'reschedule':0x1});}}});}if(_0x21eb69[_0x0d8c('0x44')]===_0x0d8c('0xc4')&&this[_0x0d8c('0x1e')][_0x21eb69['queue']]['dialAMDActive']&&_0x59196d[_0x0d8c('0x116')]===_0x0d8c('0x117')){delete this['uniqueId'][_0x59196d['uniqueid']];this[_0x0d8c('0xc5')](this[_0x0d8c('0x1e')][_0x21eb69[_0x0d8c('0xc2')]]);_0x3c6bef=new Hangup(_0x21eb69,_0x59196d);_0x3c6bef[_0x0d8c('0x73')]=0x12;_0x3c6bef['statedesc']=_0x0d8c('0x119');_0x3c6bef[_0x0d8c('0x11a')]=_0x0d8c('0x11b');ami[_0x0d8c('0x43')](_0x0d8c('0x11c'),ut[_0x0d8c('0x11d')](_0x3c6bef,_0x0d8c('0x123')));this[_0x0d8c('0x12e')](_0x3c6bef,_0x0d8c('0x12f'),'[syncHangupInAMDIvr]');}if(_0x21eb69[_0x0d8c('0x44')]===_0x0d8c('0xc4')&&this[_0x0d8c('0x1e')][_0x21eb69[_0x0d8c('0xc2')]][_0x0d8c('0x11f')]&&_0x59196d['value']===_0x0d8c('0x120')){return new Promise(function(_0x318128,_0x32824a){delete _0xd6d0a0[_0x0d8c('0x23')][_0x59196d[_0x0d8c('0xc3')]];_0xd6d0a0[_0x0d8c('0xc5')](_0xd6d0a0[_0x0d8c('0x1e')][_0x21eb69[_0x0d8c('0xc2')]]);_0xd6d0a0[_0x0d8c('0x1e')][_0x21eb69[_0x0d8c('0xc2')]][_0x0d8c('0xc7')]+=0x1;_0xd6d0a0['campaigns'][_0x21eb69[_0x0d8c('0xc2')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x50fe7d=_0xd6d0a0[_0x0d8c('0x1e')][_0x21eb69[_0x0d8c('0xc2')]];var _0x2f2f00=new Hangup(_0x21eb69,_0x59196d);_0x2f2f00[_0x0d8c('0x73')]=0x13;_0x2f2f00[_0x0d8c('0x74')]='Machine';_0x2f2f00[_0x0d8c('0x11a')]=_0x0d8c('0x11b');_0x2f2f00['countmachineretry']+=0x1;_0x2f2f00[_0x0d8c('0xd9')]+=0x1;_0x2f2f00[_0x0d8c('0x123')]=!![];ami[_0x0d8c('0x43')](_0x0d8c('0x11c'),ut[_0x0d8c('0x11d')](_0x2f2f00,_0x0d8c('0x123')));hopperUtils['createHistory'](_0x2f2f00)[_0x0d8c('0xa5')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2f2f00[_0x0d8c('0x125')]+_0x2f2f00[_0x0d8c('0x126')]+_0x2f2f00[_0x0d8c('0x130')]+_0x2f2f00[_0x0d8c('0x127')]+_0x2f2f00[_0x0d8c('0xd8')]+_0x2f2f00[_0x0d8c('0xed')]+_0x2f2f00[_0x0d8c('0x122')]+_0x2f2f00[_0x0d8c('0x128')]>=_0x50fe7d[_0x0d8c('0x129')]){_0xd6d0a0[_0x0d8c('0x131')](_0x2f2f00,_0x318128,_0x32824a,_0x0d8c('0x132'));}else{if(_0x2f2f00[_0x0d8c('0x122')]>=_0x50fe7d[_0x0d8c('0x12a')]){_0xd6d0a0['createStateFinal'](_0x2f2f00,_0x318128,_0x32824a,'reason\x2019\x20machine....');}else{hopperUtils[_0x0d8c('0xdf')]({'active':![],'countmachineretry':_0x2f2f00[_0x0d8c('0x122')],'scheduledat':moment()[_0x0d8c('0xe0')](_0x50fe7d[_0x0d8c('0x12c')],_0x0d8c('0xe2'))[_0x0d8c('0x48')](_0x0d8c('0xcd')),'ContactId':_0x2f2f00[_0x0d8c('0xe3')],'ListId':_0x2f2f00['ListId'],'VoiceQueueId':_0x2f2f00[_0x0d8c('0xe4')]||undefined,'CampaignId':_0x2f2f00[_0x0d8c('0x105')]||undefined})[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x12d')));_0x318128({'reschedule':0x1});}}});}}};Dialer[_0x0d8c('0x19')]['syncHangup']=function(_0x2327ec){var _0x415694=this['uniqueId'][_0x2327ec[_0x0d8c('0xc3')]];var _0x7cf4c9;if(_0x415694&&_0x415694[_0x0d8c('0x44')]===_0x0d8c('0xc4')){delete this['uniqueId'][_0x2327ec[_0x0d8c('0xc3')]];this[_0x0d8c('0xc5')](this[_0x0d8c('0x1e')][_0x415694[_0x0d8c('0xc2')]]);this[_0x0d8c('0x1e')][_0x415694[_0x0d8c('0xc2')]][_0x0d8c('0x133')]+=0x1;_0x7cf4c9=new Hangup(_0x415694,_0x2327ec);hopperUtils['createHistory'](_0x7cf4c9)['catch'](loggerCatch(_0x0d8c('0x134')));hopperUtils['moveContactManagedDialer'](_0x7cf4c9)['catch'](loggerCatch(_0x0d8c('0x135')));}if(_0x415694&&_0x415694[_0x0d8c('0x44')]!==_0x0d8c('0xc4')&&isNotNull(this[_0x0d8c('0x1d')][_0x415694[_0x0d8c('0xc2')]]['dialQueueProject'])){delete this['uniqueId'][_0x2327ec[_0x0d8c('0xc3')]];this[_0x0d8c('0xc5')](this[_0x0d8c('0x1d')][_0x415694[_0x0d8c('0xc2')]]);this[_0x0d8c('0x1d')][_0x415694[_0x0d8c('0xc2')]]['outboundAnswerCallsDay']+=0x1;this[_0x0d8c('0x1d')][_0x415694[_0x0d8c('0xc2')]][_0x0d8c('0x118')]+=0x1;_0x7cf4c9=new Hangup(_0x415694,_0x2327ec);_0x7cf4c9['state']=0x10;_0x7cf4c9[_0x0d8c('0x74')]='AnswerAGI';_0x7cf4c9[_0x0d8c('0x11a')]=_0x0d8c('0x136');hopperUtils['createHistory'](_0x7cf4c9)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x134')));hopperUtils[_0x0d8c('0xd0')](_0x7cf4c9)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x135')));}if(_0x415694&&_0x415694[_0x0d8c('0x44')]!=='ivr'&&!isNotNull(this[_0x0d8c('0x1d')][_0x415694[_0x0d8c('0xc2')]][_0x0d8c('0x137')])){delete this[_0x0d8c('0x23')][_0x2327ec['uniqueid']];this['updateOriginated'](this[_0x0d8c('0x1d')][_0x415694[_0x0d8c('0xc2')]]);this['voiceQueues'][_0x415694['queue']]['outboundUnknownCallsDay']+=0x1;_0x7cf4c9=new Hangup(_0x415694,_0x2327ec);_0x7cf4c9[_0x0d8c('0x73')]=0xc;_0x7cf4c9[_0x0d8c('0x74')]=_0x2327ec[_0x0d8c('0x138')];_0x7cf4c9[_0x0d8c('0x11a')]=_0x0d8c('0x139');hopperUtils[_0x0d8c('0xce')](_0x7cf4c9)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x0d8c('0xd0')](_0x7cf4c9)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x135')));}};Dialer['prototype']['syncQueueSummary']=function(_0x274b31){var _0x433ae4=this;if(!_0x433ae4[_0x0d8c('0x29')][_0x274b31[_0x0d8c('0x49')]]){_0x433ae4[_0x0d8c('0x29')][_0x274b31['name']]={'running':![]};}else if(_0x433ae4[_0x0d8c('0x29')][_0x274b31[_0x0d8c('0x49')]]['running']===!![]){return;}else if(_0x433ae4[_0x0d8c('0x29')][_0x274b31['name']][_0x0d8c('0x13a')]===![]){_0x433ae4[_0x0d8c('0x29')][_0x274b31[_0x0d8c('0x49')]][_0x0d8c('0x13a')]=!![];}var _0x6f6311=_0x433ae4[_0x0d8c('0x1d')][_0x274b31[_0x0d8c('0x49')]];var _0xe66d08=_0x6f6311['message']!==utils[_0x0d8c('0x6e')][_0x0d8c('0x80')];var _0x3abd7f=utils[_0x0d8c('0x13b')](_0x6f6311);_0x6f6311[_0x0d8c('0x13c')]=utils[_0x0d8c('0x13d')](_0x6f6311,_0x433ae4[_0x0d8c('0x20')]);Promise[_0x0d8c('0xad')]()['then'](function(){if(_0x6f6311['statusMessage']===utils[_0x0d8c('0x6e')][_0x0d8c('0x80')]){if(_0xe66d08){clearPredictiveAttributes(_0x6f6311);_0x274b31[_0x0d8c('0x24')]=undefined;_0x274b31[_0x0d8c('0x25')]=undefined;}if(_0x6f6311[_0x0d8c('0x13c')]===utils[_0x0d8c('0x6e')][_0x0d8c('0x80')]){_0x274b31[_0x0d8c('0x13e')]=0x0;_0x274b31[_0x0d8c('0xfb')]=0x0;_0x274b31[_0x0d8c('0x13f')]=0x0;_0x274b31['talking']=0x0;_0x274b31[_0x0d8c('0x140')]=0x0;}}else if(_0x6f6311[_0x0d8c('0x13c')]===utils[_0x0d8c('0x6e')][_0x0d8c('0x141')]&&!_0x3abd7f){return _0x433ae4[_0x0d8c('0x94')](_0x6f6311,!![])['then'](function(){return _0x433ae4[_0x0d8c('0x94')](_0x6f6311,![]);})[_0x0d8c('0x40')](function(){return _0x433ae4['checkDialMethod'](_0x6f6311);})[_0x0d8c('0xa5')](function(_0x57193d){loggerSyncQueueSummary['debug'](_0x0d8c('0x142'),util[_0x0d8c('0x47')](_0x57193d,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x6f6311);});}else{clearPredictiveAttributes(_0x6f6311);}})[_0x0d8c('0x40')](function(){var _0x2e0e55=_0x274b31['compareToOutboundQueue'](_0x6f6311);if(_0x2e0e55||_0x6f6311[_0x0d8c('0x143')]){_0x6f6311[_0x0d8c('0x143')]=![];_0x274b31[_0x0d8c('0x144')](_0x6f6311);Object[_0x0d8c('0x145')](_0x6f6311,_0x274b31);emitOutboundVoiceQueueSummary(_0x274b31);}_0x433ae4[_0x0d8c('0x29')][_0x6f6311['name']][_0x0d8c('0x13a')]=![];})[_0x0d8c('0xa5')](function(_0x445b10){logger[_0x0d8c('0x69')]('[syncQueueSummary]',util[_0x0d8c('0x47')](_0x445b10,{'showHidden':![],'depth':null}));_0x433ae4[_0x0d8c('0x29')][_0x6f6311[_0x0d8c('0x49')]]['running']=![];});};Dialer[_0x0d8c('0x19')]['syncQueueSummaryComplete']=_[_0x0d8c('0x146')](function(){var _0x4981a2=_[_0x0d8c('0x147')](this[_0x0d8c('0x1d')],function(_0x501f20){return _0x501f20[_0x0d8c('0x148')];});var _0x29047d=_[_0x0d8c('0x147')](this[_0x0d8c('0x1f')],function(_0x36854c){return _0x36854c['online']&&_0x36854c[_0x0d8c('0x8c')]===_0x0d8c('0x149');});if(_0x4981a2['length']>0x0&&_0x29047d[_0x0d8c('0x9c')]>0x0){return Promise[_0x0d8c('0xad')]()[_0x0d8c('0x40')](cmHopper[_0x0d8c('0x14a')](_[_0x0d8c('0x14b')](_0x4981a2,'id'),previewRecallmeReminderInterval,_[_0x0d8c('0x14b')](_0x29047d,'id')))['then'](function(_0x3ecfa3){for(var _0x59a7ed=0x0;_0x59a7ed<_0x3ecfa3[_0x0d8c('0x9c')];_0x59a7ed++){var _0x5bb455=_0x3ecfa3[_0x59a7ed][_0x0d8c('0x14c')]['name'];if(_0x5bb455)io['to'](util[_0x0d8c('0x48')]('user:%s',_0x5bb455))[_0x0d8c('0x43')](_0x0d8c('0x14d'),{'hopper':_0x3ecfa3[_0x59a7ed]});}})[_0x0d8c('0xa5')](function(_0x3fea86){logger[_0x0d8c('0x69')](_0x0d8c('0x14e'),_0x3fea86);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x0d8c('0x19')][_0x0d8c('0x14f')]=function(){var _0x248b62=this;setInterval(function(){_0x248b62[_0x0d8c('0x150')](_0x248b62[_0x0d8c('0x23')],'[uniqueid]');_0x248b62[_0x0d8c('0x150')](_0x248b62[_0x0d8c('0x21')],'[actions]');},0x32c8);};Dialer[_0x0d8c('0x19')]['clearZombieChannels']=function(_0x2ccb66,_0x594f08){var _0x2910f6=this;for(var _0x11f174 in _0x2ccb66){if(typeof _0x2ccb66[_0x11f174]!==_0x0d8c('0x151')){this['sequence'][_0x0d8c('0x152')](function(){if(!_[_0x0d8c('0xf7')](_0x2ccb66[_0x11f174])){return ami[_0x0d8c('0x9e')]({'action':_0x0d8c('0x8c'),'channel':_0x2ccb66[_0x11f174][_0x0d8c('0xf4')]})['catch'](function(_0x306aaa){if(_0x306aaa[_0x0d8c('0x6d')]===_0x0d8c('0x153')){setTimeout(function(){if(_0x2ccb66[_0x11f174]&&_0x2ccb66[_0x11f174][_0x0d8c('0x44')]!==_0x0d8c('0xc4')){_0x2910f6[_0x0d8c('0xc5')](_0x2910f6[_0x0d8c('0x1d')][_0x2ccb66[_0x11f174][_0x0d8c('0xc2')]]);logger[_0x0d8c('0x69')](_0x0d8c('0x154'),_0x594f08,_0x11f174,_0x2ccb66[_0x11f174][_0x0d8c('0xc2')]);delete _0x2ccb66[_0x11f174];}if(_0x2ccb66[_0x11f174]&&_0x2ccb66[_0x11f174][_0x0d8c('0x44')]===_0x0d8c('0xc4')){_0x2910f6[_0x0d8c('0xc5')](_0x2910f6[_0x0d8c('0x1e')][_0x2ccb66[_0x11f174][_0x0d8c('0xc2')]]);logger[_0x0d8c('0x69')](_0x0d8c('0x155'),_0x594f08,_0x11f174,_0x2ccb66[_0x11f174][_0x0d8c('0xc2')]);delete _0x2ccb66[_0x11f174];}},0x2328);}});}});}}};Dialer[_0x0d8c('0x19')][_0x0d8c('0x156')]=function(_0x1f7abb){return Promise[_0x0d8c('0xad')]()['then'](voiceQueueRt[_0x0d8c('0x156')](_0x1f7abb))[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x157')));};Dialer[_0x0d8c('0x19')][_0x0d8c('0xc5')]=function(_0x550df1){if(!_['isUndefined'](_0x550df1)&&_0x550df1!==null){if(typeof _0x550df1[_0x0d8c('0x158')]!=='undefined'){if(_0x550df1[_0x0d8c('0x158')]>0x0){_0x550df1[_0x0d8c('0x158')]-=0x1;}else{logger[_0x0d8c('0x69')](_0x0d8c('0x159'));}}}else{logger['error'](_0x0d8c('0x15a'));}};Dialer['prototype']['loggerHandler']=function(_0x2739f0,_0x3406bc){var _0x20b912=this;return function(_0x2d0cd9){_0x20b912['updateOriginated'](_0x3406bc);logger[_0x0d8c('0x69')](_0x2739f0,util[_0x0d8c('0x47')](_0x2d0cd9,{'showHidden':![],'depth':null}));};};Dialer[_0x0d8c('0x19')][_0x0d8c('0x15b')]=function(_0x2b1502,_0x3ab53c,_0x70110f){var _0xc3b0d6={'state':0x19,'statedesc':'notFound'};this[_0x0d8c('0xc5')](_0x3ab53c);this[_0x0d8c('0x12e')](_[_0x0d8c('0x64')](_0xc3b0d6,_['pick'](_0x70110f,[_0x0d8c('0xe3'),_0x0d8c('0xf1'),_0x0d8c('0x15c'),'VoiceQueueId',_0x0d8c('0x105')])),'[emptyContact][createHistory]','[emptyContact]');logger['error'](_0x2b1502);};Dialer[_0x0d8c('0x19')]['saveInDb']=function(_0x4913a0,_0x8dfa5f,_0x88f794){hopperUtils[_0x0d8c('0xce')](_0x4913a0)[_0x0d8c('0xa5')](loggerCatch(_0x8dfa5f));hopperUtils['moveContactManagedDialer'](_0x4913a0)[_0x0d8c('0xa5')](loggerCatch(_0x88f794));};Dialer[_0x0d8c('0x19')][_0x0d8c('0xef')]=function(_0x34b99a,_0x10d31e){hopperUtils[_0x0d8c('0xce')](_0x34b99a)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0xcf')));if(_0x10d31e==0x0){hopperUtils['moveContactManagedDialer'](_0x34b99a)['catch'](loggerCatch(_0x0d8c('0x15d')));}};Dialer[_0x0d8c('0x19')][_0x0d8c('0x14e')]=function(_0x212151){return Promise[_0x0d8c('0xad')]()[_0x0d8c('0x40')](cmHopper['handlePreviewRecallNotifications'](_0x212151['id'],previewRecallmeReminderInterval))[_0x0d8c('0x40')](function(_0x1d90e5){for(var _0x1d1b49=0x0;_0x1d1b49<_0x1d90e5['length'];_0x1d1b49++){var _0x5555e6=_0x1d90e5[_0x1d1b49][_0x0d8c('0x14c')][_0x0d8c('0x49')];if(_0x5555e6)io['to'](util[_0x0d8c('0x48')](_0x0d8c('0x15e'),_0x5555e6))[_0x0d8c('0x43')]('user:dialPreviewRecallReminder',{'hopper':_0x1d90e5[_0x1d1b49]});}})[_0x0d8c('0xa5')](function(){});};Dialer['prototype'][_0x0d8c('0xb1')]=function(_0x31f35d){var _0x45d3cc=this;return function(){_0x45d3cc[_0x0d8c('0x15f')](_0x31f35d);};};Dialer[_0x0d8c('0x19')][_0x0d8c('0x160')]=function(_0x33f32d,_0x1f5b9e){var _0x4a57a7=this;var _0x19f420=uuid['v4']();this['actions'][_0x19f420]=new Action(_0x33f32d,_0x1f5b9e,_0x19f420);return new Promise(function(_0x2965dc,_0x49ed4d){if(_[_0x0d8c('0x42')](_0x33f32d)&&typeof _0x33f32d!==_0x0d8c('0x161')){return _0x49ed4d(msgResponse('originate','Failure',_0x0d8c('0x162')));}if(_[_0x0d8c('0x42')](_0x1f5b9e[_0x0d8c('0x163')])||_0x1f5b9e[_0x0d8c('0x163')]===null){return _0x49ed4d(msgResponse('originate',_0x0d8c('0x95'),_0x0d8c('0x164')));}var _0x370e57={'XMD-CALLERID':_0x4a57a7['actions'][_0x19f420]['getCaller'](),'XMD-AGI':_0x33f32d['dialQueueProject']?util[_0x0d8c('0x48')]('\x22agi://%s/square,%s\x22',ipAgi,_0x33f32d[_0x0d8c('0x137')]):_0x0d8c('0x165'),'XMD-AGIAFTER':_0x33f32d[_0x0d8c('0xcb')]?util[_0x0d8c('0x48')]('\x22agi://%s/square,%s\x22',ipAgi,_0x33f32d['dialQueueProject2']):'NONE','XMD-QUEUE':utils[_0x0d8c('0x166')](_0x33f32d)?util[_0x0d8c('0x48')](_0x0d8c('0x167'),_0x33f32d[_0x0d8c('0x49')],_0x33f32d['dialQueueOptions']||'',_0x33f32d[_0x0d8c('0xcc')]?'c':'',_0x33f32d['dialQueueTimeout']||0x3):_0x0d8c('0x165'),'XMD-CONTACTID':_0x1f5b9e[_0x0d8c('0xe3')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4a57a7[_0x0d8c('0x21')][_0x19f420][_0x0d8c('0x168')](),'XMD-AMD':_0x33f32d[_0x0d8c('0x11f')]?'ACTIVE':_0x0d8c('0x165'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x33f32d[_0x0d8c('0x11f')]){_0x370e57['XMD-AMDINITIALSILENCE']=_0x33f32d[_0x0d8c('0x169')]||0x9c4;_0x370e57['XMD-AMDGREETING']=_0x33f32d['dialAMDGreeting']||0x5dc;_0x370e57['XMD-AMDAFTERGREETINGSILENCE']=_0x33f32d[_0x0d8c('0x16a')]||0x320;_0x370e57[_0x0d8c('0x16b')]=_0x33f32d[_0x0d8c('0x16c')]||0x1388;_0x370e57[_0x0d8c('0x16d')]=_0x33f32d[_0x0d8c('0x16e')]||0x64;_0x370e57[_0x0d8c('0x16f')]=_0x33f32d['dialAMDBetweenWordsSilence']||0x32;_0x370e57['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x33f32d[_0x0d8c('0x170')]||0x3;_0x370e57[_0x0d8c('0x171')]=_0x33f32d[_0x0d8c('0x172')]||0x100;_0x370e57[_0x0d8c('0x173')]=_0x33f32d[_0x0d8c('0x174')]||0x1388;}if(utils['isOutboundQueue'](_0x33f32d)){_0x370e57[_0x0d8c('0x175')]=_0x1f5b9e['VoiceQueueId'];}else{_0x370e57[_0x0d8c('0x176')]=_0x1f5b9e[_0x0d8c('0x105')];}for(var _0x7cab5b in _0x1f5b9e[_0x0d8c('0x177')]){if(typeof _0x1f5b9e[_0x0d8c('0x177')][_0x7cab5b]!=='undefined'){if(isNotNull(_0x1f5b9e[_0x0d8c('0x177')][_0x7cab5b])&&_0x7cab5b!=='id'&&_0x7cab5b!==_0x0d8c('0x178')&&_0x7cab5b!==_0x0d8c('0x179')&&_0x7cab5b!==_0x0d8c('0x17a')){_0x370e57[util['format']('%s%s',_0x0d8c('0x17b'),_[_0x0d8c('0x17c')](_0x7cab5b))]=_0x1f5b9e[_0x0d8c('0x177')][_0x7cab5b];}}}var _0x38e671=_0x4a57a7[_0x0d8c('0x89')](_0x33f32d['Trunk'])?utils[_0x0d8c('0x17d')](_0x33f32d[_0x0d8c('0x8f')]['callerid'],_0x33f32d[_0x0d8c('0x17e')],_0x33f32d[_0x0d8c('0x17f')]>0x0?utils[_0x0d8c('0x180')](_0x33f32d[_0x0d8c('0x181')],_0x33f32d[_0x0d8c('0x17f')]):_0x33f32d['dialOriginateCallerIdNumber']):utils[_0x0d8c('0x17d')](_[_0x0d8c('0xf7')](_0x33f32d[_0x0d8c('0x90')])?_0x33f32d[_0x0d8c('0x8f')]['callerid']:_0x33f32d[_0x0d8c('0x90')][_0x0d8c('0x182')],_0x33f32d[_0x0d8c('0x17e')],_0x33f32d[_0x0d8c('0x17f')]>0x0?utils[_0x0d8c('0x180')](_0x33f32d[_0x0d8c('0x181')],_0x33f32d[_0x0d8c('0x17f')]):_0x33f32d['dialOriginateCallerIdNumber']);if(_0x38e671){_0x370e57[_0x0d8c('0x183')]=_0x4a57a7[_0x0d8c('0x21')][_0x19f420][_0x0d8c('0x184')]=utils[_0x0d8c('0x185')](_0x38e671);_0x370e57[_0x0d8c('0x186')]=_0x1f5b9e[_0x0d8c('0x163')];}_0x33f32d[_0x0d8c('0x187')]=_0x370e57;return ami[_0x0d8c('0x9e')]({'actionid':_0x19f420,'action':'originate','channel':_0x4a57a7[_0x0d8c('0x89')](_0x33f32d[_0x0d8c('0x8f')])?util[_0x0d8c('0x48')](_0x0d8c('0x188'),_0x33f32d[_0x0d8c('0x8f')][_0x0d8c('0x49')],isNotNull(_0x33f32d[_0x0d8c('0x189')])?_0x33f32d[_0x0d8c('0x189')][_0x0d8c('0x18a')]()||'':'',_0x33f32d[_0x0d8c('0x18b')]>0x0?_0x1f5b9e[_0x0d8c('0x163')][_0x0d8c('0x18c')](_0x33f32d['dialCutDigit']):_0x1f5b9e[_0x0d8c('0x163')]):util[_0x0d8c('0x48')]('SIP/%s/%s%s',_[_0x0d8c('0xf7')](_0x33f32d['TrunkBackup'])?_0x33f32d[_0x0d8c('0x8f')][_0x0d8c('0x49')]:_0x33f32d[_0x0d8c('0x90')][_0x0d8c('0x49')],isNotNull(_0x33f32d[_0x0d8c('0x189')])?_0x33f32d[_0x0d8c('0x189')][_0x0d8c('0x18a')]()||'':'',_0x33f32d[_0x0d8c('0x18b')]>0x0?_0x1f5b9e[_0x0d8c('0x163')][_0x0d8c('0x18c')](_0x33f32d[_0x0d8c('0x18b')]):_0x1f5b9e[_0x0d8c('0x163')]),'callerid':_0x38e671,'Exten':_0x0d8c('0x115'),'Context':_0x0d8c('0x18d'),'Priority':'1','variable':_0x370e57,'timeout':(_0x33f32d[_0x0d8c('0x18e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x19f420})['then'](function(_0x278716){return _0x2965dc(_0x278716);})[_0x0d8c('0xa5')](function(_0x3a78b4){_0x33f32d[_0x0d8c('0x18f')]+=0x1;var _0x265b7c=new History(_0x4a57a7[_0x0d8c('0x21')][_0x19f420]);logger[_0x0d8c('0x69')](util[_0x0d8c('0x48')](_0x0d8c('0x190'),JSON[_0x0d8c('0x79')](_0x3a78b4)));_0x265b7c[_0x0d8c('0x73')]=0xe;_0x265b7c[_0x0d8c('0x74')]='OriginateError';_0x265b7c[_0x0d8c('0x76')]=moment()['format'](_0x0d8c('0xcd'));_0x265b7c['endtime']=_0x265b7c[_0x0d8c('0x76')];hopperUtils['createHistory'](_0x265b7c)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x191')));_0x4a57a7['moveContactManagedDialer'](_0x265b7c)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x191')))[_0x0d8c('0x1b')](function(){delete _0x4a57a7['actions'][_0x19f420];return _0x49ed4d(msgResponse(_0x0d8c('0x192'),_0x0d8c('0x88'),_0x0d8c('0x193')));});});});};Dialer[_0x0d8c('0x19')][_0x0d8c('0x194')]=function(_0x2c68e5,_0x856177,_0x4c0f44){var _0x47633d=new History(_0x856177);if(_0x47633d[_0x0d8c('0x125')]+_0x47633d[_0x0d8c('0x126')]+_0x47633d[_0x0d8c('0x130')]+_0x47633d[_0x0d8c('0x127')]+_0x47633d[_0x0d8c('0xd8')]+_0x47633d[_0x0d8c('0xed')]+_0x47633d[_0x0d8c('0x122')]+_0x47633d[_0x0d8c('0x128')]>=_0x4c0f44[_0x0d8c('0x129')]-0x1){return!![];}switch(_0x2c68e5){case 0x3:if(_0x47633d[_0x0d8c('0x130')]>=_0x4c0f44['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x47633d[_0x0d8c('0x130')]+=0x1,'scheduledat':moment()[_0x0d8c('0xe0')](_0x4c0f44['dialNoAnswerRetryFrequency'],'minutes')[_0x0d8c('0x48')](_0x0d8c('0xcd')),'ContactId':_0x47633d[_0x0d8c('0xe3')],'ListId':_0x47633d['ListId'],'VoiceQueueId':_0x47633d[_0x0d8c('0xe4')]||undefined,'CampaignId':_0x47633d['CampaignId']||undefined})[_0x0d8c('0xa5')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x47633d[_0x0d8c('0x125')]>=_0x4c0f44[_0x0d8c('0x195')]-0x1){return!![];}hopperUtils[_0x0d8c('0xdf')]({'active':![],'countbusyretry':_0x47633d['countbusyretry']+=0x1,'scheduledat':moment()[_0x0d8c('0xe0')](_0x4c0f44[_0x0d8c('0x196')],'minutes')[_0x0d8c('0x48')](_0x0d8c('0xcd')),'ContactId':_0x47633d[_0x0d8c('0xe3')],'ListId':_0x47633d[_0x0d8c('0xf1')],'VoiceQueueId':_0x47633d['VoiceQueueId']||undefined,'CampaignId':_0x47633d[_0x0d8c('0x105')]||undefined})['catch'](loggerCatch(_0x0d8c('0x197')));break;case 0x8:if(_0x47633d['countcongestionretry']>=_0x4c0f44[_0x0d8c('0x198')]-0x1){return!![];}hopperUtils[_0x0d8c('0xdf')]({'active':![],'countcongestionretry':_0x47633d[_0x0d8c('0x126')]+=0x1,'scheduledat':moment()[_0x0d8c('0xe0')](_0x4c0f44[_0x0d8c('0x199')],_0x0d8c('0xe2'))[_0x0d8c('0x48')](_0x0d8c('0xcd')),'ContactId':_0x47633d[_0x0d8c('0xe3')],'ListId':_0x47633d[_0x0d8c('0xf1')],'VoiceQueueId':_0x47633d[_0x0d8c('0xe4')]||undefined,'CampaignId':_0x47633d['CampaignId']||undefined})[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x19a')));break;case 0x0:if(_0x47633d[_0x0d8c('0x127')]>=_0x4c0f44[_0x0d8c('0x19b')]-0x1){return!![];}else{hopperUtils[_0x0d8c('0xdf')]({'active':![],'countnosuchnumberretry':_0x47633d['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x0d8c('0xe0')](_0x4c0f44[_0x0d8c('0x19c')],'minutes')['format'](_0x0d8c('0xcd')),'ContactId':_0x47633d[_0x0d8c('0xe3')],'ListId':_0x47633d[_0x0d8c('0xf1')],'VoiceQueueId':_0x47633d['VoiceQueueId']||undefined,'CampaignId':_0x47633d[_0x0d8c('0x105')]||undefined})['catch'](loggerCatch(_0x0d8c('0x19d')));}break;case 0xa:if(_0x47633d['countdropretry']>=_0x4c0f44[_0x0d8c('0xdd')]-0x1){return!![];}hopperUtils[_0x0d8c('0xdf')]({'active':![],'countdropretry':_0x47633d[_0x0d8c('0xd8')]+=0x1,'scheduledat':moment()[_0x0d8c('0xe0')](_0x4c0f44[_0x0d8c('0xe1')],'minutes')[_0x0d8c('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x47633d[_0x0d8c('0xe3')],'ListId':_0x47633d['ListId'],'VoiceQueueId':_0x47633d[_0x0d8c('0xe4')]||undefined,'CampaignId':_0x47633d[_0x0d8c('0x105')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x47633d[_0x0d8c('0xed')]>=_0x4c0f44[_0x0d8c('0xee')]-0x1){return!![];}hopperUtils[_0x0d8c('0xdf')]({'active':![],'countabandonedretry':_0x47633d['countabandonedretry']+=0x1,'scheduledat':moment()[_0x0d8c('0xe0')](_0x4c0f44[_0x0d8c('0xf0')],_0x0d8c('0xe2'))[_0x0d8c('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x47633d[_0x0d8c('0xe3')],'ListId':_0x47633d[_0x0d8c('0xf1')],'VoiceQueueId':_0x47633d['VoiceQueueId']||undefined,'CampaignId':_0x47633d['CampaignId']||undefined})[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x19e')));break;case 0x13:if(_0x47633d[_0x0d8c('0x122')]>=_0x4c0f44['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x0d8c('0xdf')]({'active':![],'countmachineretry':_0x47633d['countmachineretry']+=0x1,'scheduledat':moment()[_0x0d8c('0xe0')](_0x4c0f44[_0x0d8c('0x12c')],_0x0d8c('0xe2'))[_0x0d8c('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x47633d[_0x0d8c('0xe3')],'ListId':_0x47633d[_0x0d8c('0xf1')],'VoiceQueueId':_0x47633d[_0x0d8c('0xe4')]||undefined,'CampaignId':_0x47633d[_0x0d8c('0x105')]||undefined})[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x12d')));break;case 0x14:if(_0x47633d[_0x0d8c('0x128')]>=_0x4c0f44[_0x0d8c('0x19f')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x47633d['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x0d8c('0xe0')](_0x4c0f44[_0x0d8c('0x1a0')],_0x0d8c('0xe2'))[_0x0d8c('0x48')](_0x0d8c('0xcd')),'ContactId':_0x47633d[_0x0d8c('0xe3')],'ListId':_0x47633d[_0x0d8c('0xf1')],'VoiceQueueId':_0x47633d[_0x0d8c('0xe4')]||undefined,'CampaignId':_0x47633d[_0x0d8c('0x105')]||undefined})[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x1a1')));break;default:return!![];}};Dialer[_0x0d8c('0x19')]['callProgressDetecting']=function(_0xd70724,_0x3da563,_0x4f7b07){var _0x73a8e8=this;var _0x3dd734=new History(_0xd70724);var _0x18da3a=![];var _0x70850e;var _0x5d2831;return new Promise(function(_0x49ec9d,_0x2bb954){if(_['isUndefined'](_0x3da563)&&typeof _0x3da563!==_0x0d8c('0x161')){return _0x2bb954(msgResponse(_0x0d8c('0x1a2'),_0x0d8c('0x95'),_0x0d8c('0x1a3')));}if(_['isUndefined'](_0x4f7b07)&&typeof _0x4f7b07!==_0x0d8c('0x161')){return _0x2bb954(msgResponse(_0x0d8c('0x1a2'),_0x0d8c('0x95'),_0x0d8c('0x1a4')));}hopperUtils[_0x0d8c('0xdb')](_0x3dd734,_0x4f7b07[_0x0d8c('0xc8')],_0x3da563)['then'](function(_0x289206){if(_0x289206['additional']==0x1)_0x18da3a=!![];switch(_0x4f7b07[_0x0d8c('0xc8')]){case'0':_0x3da563[_0x0d8c('0x1a5')]+=0x1;_0x3dd734['state']=0x0;_0x3dd734['statedesc']='NoSuchNumber';_0x3dd734[_0x0d8c('0x127')]+=0x1;_0x3dd734[_0x0d8c('0xd9')]+=0x1;ami[_0x0d8c('0x43')](_0x0d8c('0x1a6'),ut['buildObj'](_0xd70724,_0x0d8c('0x1a7')));_0x70850e=_0x3da563[_0x0d8c('0x19c')];_0x5d2831=_0x3da563[_0x0d8c('0xda')];hopperUtils[_0x0d8c('0xce')](_0x3dd734)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x124')));if(_0x73a8e8[_0x0d8c('0x194')](0x0,_0xd70724,_0x3da563)&&!_0x18da3a){if(_0x3dd734['countnosuchnumberretry']>=_0x3da563[_0x0d8c('0x19b')]){_0x73a8e8[_0x0d8c('0x1a8')](_0x3dd734,_0x49ec9d,_0x2bb954,_0x0d8c('0x1a9'));}else{_0x73a8e8[_0x0d8c('0x131')](_0x3dd734,_0x49ec9d,_0x2bb954,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x3da563[_0x0d8c('0x1aa')]+=0x1;_0x3dd734[_0x0d8c('0x73')]=0x3;_0x3dd734['statedesc']=_0x0d8c('0x1ab');_0x3dd734['countnoanswerretry']+=0x1;_0x3dd734[_0x0d8c('0xd9')]+=0x1;var _0x39d171=ut['buildNoAnswerEventPayload'](_0xd70724,_0x3da563);ami[_0x0d8c('0x43')](_0x0d8c('0x1ac'),_0x39d171);_0x70850e=_0x3da563[_0x0d8c('0x1ad')];_0x5d2831=_0x3da563[_0x0d8c('0xda')];hopperUtils[_0x0d8c('0xce')](_0x3dd734)['catch'](loggerCatch(_0x0d8c('0x1ae')));if(_0x73a8e8[_0x0d8c('0x194')](0x3,_0xd70724,_0x3da563)&&!_0x18da3a){if(_0x3dd734[_0x0d8c('0x130')]>=_0x3da563[_0x0d8c('0x1af')]){_0x73a8e8['createStateFinal'](_0x3dd734,_0x49ec9d,_0x2bb954,'reason\x203\x20ringing\x20no\x20answer');}else{_0x73a8e8[_0x0d8c('0x131')](_0x3dd734,_0x49ec9d,_0x2bb954,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x3da563[_0x0d8c('0x1b0')]+=0x1;_0x3dd734[_0x0d8c('0x73')]=0x5;_0x3dd734[_0x0d8c('0x74')]='Busy';_0x3dd734[_0x0d8c('0x125')]+=0x1;_0x3dd734[_0x0d8c('0xd9')]+=0x1;ami[_0x0d8c('0x43')](_0x0d8c('0x1b1'),ut[_0x0d8c('0x11d')](_0xd70724,_0x0d8c('0x1b2')));_0x70850e=_0x3da563[_0x0d8c('0x196')];_0x5d2831=_0x3da563[_0x0d8c('0xda')];hopperUtils[_0x0d8c('0xce')](_0x3dd734)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x1b3')));if(_0x73a8e8[_0x0d8c('0x194')](0x5,_0xd70724,_0x3da563)&&!_0x18da3a){if(_0x3dd734[_0x0d8c('0x125')]>=_0x3da563[_0x0d8c('0x195')]){_0x73a8e8['createStateFinal'](_0x3dd734,_0x49ec9d,_0x2bb954,_0x0d8c('0x1b4'));}else{_0x73a8e8['stateGlobal'](_0x3dd734,_0x49ec9d,_0x2bb954,_0x0d8c('0x1b4'));}}break;case'8':_0x3da563[_0x0d8c('0x1b5')]+=0x1;_0x3dd734[_0x0d8c('0x73')]=0x8;_0x3dd734['statedesc']=_0x0d8c('0x1b6');_0x3dd734['countcongestionretry']+=0x1;_0x3dd734[_0x0d8c('0xd9')]+=0x1;_0x70850e=_0x3da563[_0x0d8c('0x199')];_0x5d2831=_0x3da563[_0x0d8c('0xda')];ami[_0x0d8c('0x43')](_0x0d8c('0x1b7'),ut[_0x0d8c('0x11d')](_0xd70724,_0x0d8c('0x1b8')));hopperUtils[_0x0d8c('0xce')](_0x3dd734)[_0x0d8c('0xa5')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x73a8e8[_0x0d8c('0x194')](0x8,_0xd70724,_0x3da563)&&!_0x18da3a){if(_0x3dd734[_0x0d8c('0x126')]>=_0x3da563[_0x0d8c('0x198')]){_0x73a8e8[_0x0d8c('0x1a8')](_0x3dd734,_0x49ec9d,_0x2bb954,'reason\x208\x20congestion');}else{_0x73a8e8[_0x0d8c('0x131')](_0x3dd734,_0x49ec9d,_0x2bb954,_0x0d8c('0x1b9'));}}break;case'11':_0x3da563[_0x0d8c('0x1ba')]+=0x1;_0x3dd734[_0x0d8c('0x73')]=0xb;_0x3dd734[_0x0d8c('0x74')]=_0x0d8c('0xf2');_0x3dd734[_0x0d8c('0xed')]+=0x1;_0x3dd734[_0x0d8c('0xd9')]+=0x1;_0x70850e=_0x3da563[_0x0d8c('0xf0')];_0x5d2831=_0x3da563['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x3dd734)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0xf3')));if(_0x73a8e8['checkRetriveMax'](0xb,_0xd70724,_0x3da563)&&!_0x18da3a){if(_0x3dd734[_0x0d8c('0xed')]>=_0x3da563[_0x0d8c('0xee')]){_0x73a8e8[_0x0d8c('0x1a8')](_0x3dd734,_0x49ec9d,_0x2bb954,_0x0d8c('0x1bb'));}else{_0x73a8e8['stateGlobal'](_0x3dd734,_0x49ec9d,_0x2bb954,'reason\x2011\x20abandoned');}}break;case'20':_0x3da563[_0x0d8c('0x1bc')]+=0x1;_0x3dd734['state']=0x14;_0x3dd734[_0x0d8c('0x74')]=_0x0d8c('0x1bd');_0x3dd734[_0x0d8c('0x128')]+=0x1;_0x3dd734[_0x0d8c('0xd9')]+=0x1;_0x70850e=_0x3da563[_0x0d8c('0x1a0')];_0x5d2831=_0x3da563[_0x0d8c('0xda')];ami[_0x0d8c('0x43')](_0x0d8c('0x1be'),ut[_0x0d8c('0x11d')](_0xd70724,'agentreject'));hopperUtils[_0x0d8c('0xce')](_0x3dd734)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x1bf')));if(_0x73a8e8[_0x0d8c('0x194')](0x14,_0xd70724,_0x3da563)&&!_0x18da3a){if(_0x3dd734[_0x0d8c('0x128')]>=_0x3da563[_0x0d8c('0x19f')]){_0x73a8e8[_0x0d8c('0x1a8')](_0x3dd734,_0x49ec9d,_0x2bb954,_0x0d8c('0x1c0'));}else{_0x73a8e8['stateGlobal'](_0x3dd734,_0x49ec9d,_0x2bb954,'reason\x2020\x20agentreject');}}break;default:_0x3da563[_0x0d8c('0x1c1')]+=0x1;_0x3dd734[_0x0d8c('0x73')]=0xc;_0x3dd734[_0x0d8c('0x74')]=_0x4f7b07[_0x0d8c('0xc8')];_0x70850e=_0x3da563[_0x0d8c('0x1a0')];_0x5d2831=_0x3da563[_0x0d8c('0xda')];hopperUtils[_0x0d8c('0xce')](_0x3dd734)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x1c2')));if(_0x73a8e8['checkRetriveMax'](_0x4f7b07['reason'],_0xd70724,_0x3da563)&&!_0x18da3a){if(_0x3dd734[_0x0d8c('0x125')]+_0x3dd734['countcongestionretry']+_0x3dd734['countnoanswerretry']+_0x3dd734[_0x0d8c('0x127')]+_0x3dd734[_0x0d8c('0xd8')]+_0x3dd734[_0x0d8c('0xed')]+_0x3dd734[_0x0d8c('0x122')]+_0x3dd734[_0x0d8c('0x128')]>=_0x3da563['dialGlobalMaxRetry']){_0x73a8e8[_0x0d8c('0x131')](_0x3dd734,_0x49ec9d,_0x2bb954,_0x4f7b07[_0x0d8c('0xc8')]);}else{_0x73a8e8[_0x0d8c('0x1a8')](_0x3dd734,_0x49ec9d,_0x2bb954,_0x4f7b07[_0x0d8c('0xc8')]);}}}})['then'](function(){if(_0x18da3a){hopperUtils[_0x0d8c('0xea')](_0x3dd734,_0x70850e,_0x5d2831)[_0x0d8c('0x40')](function(){return _0x49ec9d(0x1);});}});});};Dialer[_0x0d8c('0x19')][_0x0d8c('0x131')]=function(_0x15145a,_0x5dfb13,_0x122ca0,_0x50eb00){var _0x2c8380=new Final(_0x15145a);_0x2c8380[_0x0d8c('0x73')]=0xf;_0x2c8380[_0x0d8c('0x74')]=_0x0d8c('0x1c3');this[_0x0d8c('0x1a8')](_0x2c8380,_0x5dfb13,_0x122ca0,_0x50eb00);};Dialer[_0x0d8c('0x19')][_0x0d8c('0x1a8')]=function(_0x1ab1cb,_0x5da4fb,_0x33b472,_0x271e8e){hopperUtils[_0x0d8c('0xd0')](_0x1ab1cb)[_0x0d8c('0x40')](function(){return _0x5da4fb(msgResponse('[callProgressDetecting]',_0x0d8c('0x10e'),_0x271e8e));})[_0x0d8c('0xa5')](function(){return _0x33b472(msgResponse('[moveContactManagedDialer][0]',_0x0d8c('0x95'),_0x0d8c('0x1c4')));});};Dialer['prototype']['predictive']=function(_0x488d02){var _0x34d7d4=_0x488d02[_0x0d8c('0x1c5')]/0x64;var _0x40933b=_0x488d02[_0x0d8c('0xd4')]/(_0x488d02[_0x0d8c('0xd4')]+_0x488d02[_0x0d8c('0xc7')]);var _0xf5d714=Math[_0x0d8c('0x1c6')](_0x488d02[_0x0d8c('0x1c7')]*(_0x488d02[_0x0d8c('0x1c8')]/0x64));var _0x317f67=Math[_0x0d8c('0x1c6')](_0x488d02['predictiveIntervalAvailable']*(_0x488d02[_0x0d8c('0x1c9')]/0x64));var _0xd92e9c=_0x488d02['available']+_0x488d02['talking'];var _0x42426f=Math[_0x0d8c('0x1ca')](_0x488d02[_0x0d8c('0x5d')]*_0x488d02[_0x0d8c('0x63')]*_0x488d02['predictiveIntervalHitRate']*_0x488d02[_0x0d8c('0x1cb')]);if(_[_0x0d8c('0x42')](_0x488d02['startProgressive'])){if(!_[_0x0d8c('0x42')](_0x488d02[_0x0d8c('0x24')])){_0x488d02[_0x0d8c('0x24')]=undefined;loggerPredictive[_0x0d8c('0x69')](_0x0d8c('0x1cc'),_0x0d8c('0x1cd'));}if(!_[_0x0d8c('0x42')](_0x488d02[_0x0d8c('0x67')])){loggerPredictive[_0x0d8c('0x69')](_0x0d8c('0x1cc'),_0x0d8c('0x1ce'));clearInterval(_0x488d02[_0x0d8c('0x67')]);_0x488d02[_0x0d8c('0x67')]=undefined;}_0x488d02[_0x0d8c('0x25')]=moment()[_0x0d8c('0x48')](_0x0d8c('0xcd'));loggerPredictive[_0x0d8c('0x4c')](_0x488d02[_0x0d8c('0x49')],_0x0d8c('0x1cf'),_0x488d02[_0x0d8c('0x25')]);this[_0x0d8c('0xb7')](_0x488d02,0x1);}else if(ifInterval(_0x488d02['dialPredictiveInterval'],_0x488d02[_0x0d8c('0x25')])){this[_0x0d8c('0xb7')](_0x488d02,0x1);loggerPredictiveCalls[_0x0d8c('0x4c')](_0x0d8c('0x1d0'),_0x488d02['startProgressive'],_0x488d02['name']);_0x488d02[_0x0d8c('0x5d')]=0x0;_0x488d02[_0x0d8c('0xd5')]=0x0;}else if(_0x34d7d4<_0x40933b&&_0x488d02[_0x0d8c('0x1d1')]==='dropRate'){clearPredictiveAttributes(_0x488d02);loggerPredictive[_0x0d8c('0x4c')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x0d8c('0x1d2'),_0x40933b,_0x0d8c('0x25'),_0x488d02[_0x0d8c('0x49')]);}else if(_0x42426f<_0x488d02[_0x0d8c('0xd5')]&&_0x488d02[_0x0d8c('0x1d1')]==='dropRate'){clearPredictiveAttributes(_0x488d02);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x1d3'),_0x0d8c('0x1d4'),_0x42426f,'Drop\x20in\x20this\x20interval',_0x488d02['predictiveIntervalErlangCallsDroppedCalls'],_0x0d8c('0x25'),_0x488d02[_0x0d8c('0x49')]);}else if(!ifInterval(_0x488d02[_0x0d8c('0x1d5')],_0x488d02[_0x0d8c('0x25')])&&_[_0x0d8c('0x42')](_0x488d02['startPredictive'])&&!_[_0x0d8c('0x42')](_0x488d02['startProgressive'])){_0x488d02[_0x0d8c('0x24')]=moment()['format'](_0x0d8c('0xcd'));loggerPredictive['info'](_0x488d02[_0x0d8c('0x49')],_0x0d8c('0x1d6'),_0x488d02['startPredictive']);hopperUtils[_0x0d8c('0x1d7')](_0x488d02[_0x0d8c('0x1d5')])[_0x0d8c('0x40')](this[_0x0d8c('0x1d8')](_0x488d02))[_0x0d8c('0x40')](mergeDataErlangB(_0x488d02))[_0x0d8c('0x40')](this[_0x0d8c('0x1d9')](_0x488d02))[_0x0d8c('0xa5')](loggerCatchPredictive(_0x0d8c('0x1da'),_0x488d02));}else if(!ifInterval(_0x488d02[_0x0d8c('0x1d5')],_0x488d02['startPredictive'])){_0x488d02[_0x0d8c('0xd5')]=0x0;_0x488d02[_0x0d8c('0x24')]=moment()[_0x0d8c('0x48')](_0x0d8c('0xcd'));loggerPredictive[_0x0d8c('0x4c')](_0x488d02['name'],_0x0d8c('0x1db'),_0x488d02[_0x0d8c('0x24')]);clearInterval(_0x488d02[_0x0d8c('0x67')]);_0x488d02[_0x0d8c('0x67')]=undefined;hopperUtils['avgHandleTime'](_0x488d02['dialPredictiveInterval'])[_0x0d8c('0x40')](this[_0x0d8c('0x1d8')](_0x488d02))[_0x0d8c('0x40')](mergeDataErlangB(_0x488d02))[_0x0d8c('0x40')](this[_0x0d8c('0x1d9')](_0x488d02))[_0x0d8c('0xa5')](loggerCatchPredictive(_0x0d8c('0x1dc'),_0x488d02));}else if(_0x488d02['predictiveIntervalAvailable']&&_0xd92e9c<_0x488d02[_0x0d8c('0x1c7')]-_0x317f67){clearPredictiveAttributes(_0x488d02);loggerPredictive[_0x0d8c('0x4c')](_0x488d02[_0x0d8c('0x49')],_0x0d8c('0x1dd'),_0xd92e9c,_0x0d8c('0x1de'),_0x488d02[_0x0d8c('0x1c7')],'-',_0x317f67,'=',_0x488d02[_0x0d8c('0x1c7')]-_0x317f67,')');}else if(_0x488d02['predictiveIntervalAvailable']&&_0xd92e9c>_0x488d02[_0x0d8c('0x1c7')]+_0xf5d714){clearPredictiveAttributes(_0x488d02);loggerPredictive[_0x0d8c('0x4c')](_0x488d02[_0x0d8c('0x49')],_0x0d8c('0x1dd'),_0xd92e9c,_0x0d8c('0x1df'),_0x488d02['predictiveIntervalAvailable'],'+',_0xf5d714,'=',_0x488d02['predictiveIntervalAvailable']+_0xf5d714,')');}};Dialer[_0x0d8c('0x19')][_0x0d8c('0x1d8')]=function(_0x48136a){var _0x43ba5a=this;return function(_0x2a9418){return new Promise(function(_0x167a5c,_0x19c51a){_[_0x0d8c('0x64')](_0x48136a,_0x2a9418[0x0]);if(checkGetDataPredictive(_0x2a9418[0x0])){var _0x8b8a59=_0x48136a['predictiveIntervalAvailable']=_0x48136a[_0x0d8c('0x1e0')]+_0x48136a[_0x0d8c('0x13e')];var _0x3d49d7=_0x48136a['dialPredictiveInterval']*0x3c;var _0xef9b3b=_0x2a9418[0x0][_0x0d8c('0x57')]+_0x2a9418[0x0]['predictiveIntervalAvgHoldtime'];var _0x3cb30f=(_0x2a9418[0x0][_0x0d8c('0x1e1')]+_0x2a9418[0x0][_0x0d8c('0x51')]+_0x2a9418[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2a9418[0x0][_0x0d8c('0x4e')];_0x48136a['predictiveIntervalHitRate']=_0x3cb30f>0x0?_0x3cb30f:0x1;switch(_0x48136a[_0x0d8c('0x1d1')]){case _0x0d8c('0x1e2'):var _0x22a773=_0x48136a[_0x0d8c('0x1c5')]/0x64;return _0x43ba5a[_0x0d8c('0x1e3')](_0x8b8a59,_0x3d49d7,_0xef9b3b,_0x3cb30f,_0x22a773)['then'](function(_0x271fc3){return _0x167a5c(_0x271fc3);});case'agentBusyFactor':var _0x4ec864=_0x48136a['dialPredictiveOptimizationPercentage']/0x64;return _0x43ba5a[_0x0d8c('0x1e4')](_0x8b8a59,_0x3d49d7,_0xef9b3b,_0x3cb30f,_0x4ec864)['then'](function(_0x2547ba){return _0x167a5c(_0x2547ba);});default:return _0x19c51a(msgResponse(_0x0d8c('0x1e5'),_0x0d8c('0x95'),'Unknown\x20Predictive'));}}else{return _0x19c51a(msgResponse(_0x0d8c('0x1e5'),'Failure',_0x0d8c('0x1e6')));}});};};Dialer[_0x0d8c('0x19')]['getDataPredictiveOld']=function(_0x5f00fc){var _0x16bc05=this;return function(_0x304eaf){return new Promise(function(_0x554b61,_0x561773){_[_0x0d8c('0x64')](_0x5f00fc,_0x304eaf[0x0]);if(checkGetDataPredictive(_0x304eaf[0x0])){loggerPredictive['info'](JSON[_0x0d8c('0x79')](_0x304eaf[0x0]));if(_0x5f00fc[_0x0d8c('0x1d1')]===_0x0d8c('0x1e2')){return _0x16bc05['getVoiceQueueRtPauses'](_0x5f00fc['id'])[_0x0d8c('0x40')](function(_0x83179e){var _0x18b2bc=_0x5f00fc['loggedIn']-_0x83179e[0x0][_0x0d8c('0x1e7')];var _0x163cc5=_0x5f00fc[_0x0d8c('0x1d5')]*0x3c;var _0x4f1848=_0x304eaf[0x0][_0x0d8c('0x57')]+_0x304eaf[0x0]['predictiveIntervalAvgHoldtime'];var _0x14bf43=(_0x304eaf[0x0][_0x0d8c('0x1e1')]+_0x304eaf[0x0][_0x0d8c('0x51')]+_0x304eaf[0x0][_0x0d8c('0x53')])/_0x304eaf[0x0][_0x0d8c('0x4e')];var _0x1db70c=_0x5f00fc[_0x0d8c('0x1c5')]/0x64;_0x5f00fc[_0x0d8c('0x1e8')]=_0x83179e[0x0][_0x0d8c('0x1e7')]||0x0;_0x5f00fc[_0x0d8c('0x1e9')]=_0x14bf43>0x0?_0x14bf43:0x1;return _0x16bc05['abandonmentRate'](_0x18b2bc,_0x163cc5,_0x4f1848,_0x14bf43,_0x1db70c);})[_0x0d8c('0x40')](function(_0x27d685){return _0x554b61(_0x27d685);})['catch'](function(_0x5f3e71){return _0x561773(msgResponse(_0x0d8c('0x1ea'),_0x0d8c('0x95'),JSON[_0x0d8c('0x79')](_0x5f3e71)));});}if(_0x5f00fc[_0x0d8c('0x1d1')]===_0x0d8c('0x1eb')){return _0x16bc05[_0x0d8c('0x156')](_0x5f00fc['id'])[_0x0d8c('0x40')](function(_0x65a55e){var _0xcde3d6=_0x5f00fc[_0x0d8c('0x1ec')]-_0x65a55e[0x0][_0x0d8c('0x1e7')];var _0x364422=_0x5f00fc[_0x0d8c('0x1d5')]*0x3c;var _0x333549=_0x304eaf[0x0][_0x0d8c('0x57')]+_0x304eaf[0x0]['predictiveIntervalAvgHoldtime'];var _0x2ca449=(_0x304eaf[0x0][_0x0d8c('0x1e1')]+_0x304eaf[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x304eaf[0x0][_0x0d8c('0x53')])/_0x304eaf[0x0][_0x0d8c('0x4e')];var _0x348343=_0x5f00fc[_0x0d8c('0x1c5')]/0x64;_0x5f00fc[_0x0d8c('0x1e8')]=_0x65a55e[0x0][_0x0d8c('0x1e7')]||0x0;_0x5f00fc[_0x0d8c('0x1e9')]=_0x2ca449>0x0?_0x2ca449:0x1;return _0x16bc05[_0x0d8c('0x1e4')](_0xcde3d6,_0x364422,_0x333549,_0x2ca449,_0x348343);})['then'](function(_0x3fa7af){return _0x554b61(_0x3fa7af);})['catch'](function(_0x5b7cc5){return _0x561773(msgResponse(_0x0d8c('0x1ea'),'Failure',JSON['stringify'](_0x5b7cc5)));});}}else{return _0x561773(msgResponse('[getDataPredictive]',_0x0d8c('0x95'),_0x0d8c('0x1e6')));}});};};Dialer['prototype'][_0x0d8c('0x1d9')]=function(_0x1b3f90){var _0x59d990=this;return function(){var _0x14e3f9=0x0;var _0x20e57b=Math[_0x0d8c('0x1ca')](_0x1b3f90['erlangCallToSecond']*0x3e8);if(_0x20e57b>0x0){_0x20e57b=_0x20e57b<0x64?0x64:_0x20e57b;loggerPredictive[_0x0d8c('0x4c')](_0x1b3f90[_0x0d8c('0x49')],'one\x20call\x20every:',_0x20e57b,_0x0d8c('0x1ed'));_0x1b3f90['handlePredictive']=setInterval(function(){_0x59d990[_0x0d8c('0x67')](_0x1b3f90);loggerPredictiveCalls[_0x0d8c('0x4c')]('[handlePredictive]',_0x14e3f9+=0x1);},_0x20e57b);}else{loggerPredictive['info'](_0x1b3f90[_0x0d8c('0x49')],_0x0d8c('0x1ee'));}};};Dialer[_0x0d8c('0x19')]['checkContactBlack']=function(_0x5cf2aa,_0x3d4f1d){var _0x547a2f=this;return function(_0x1e7ac0){if(_[_0x0d8c('0x4b')](_0x1e7ac0)){if(_[_0x0d8c('0xf7')](_0x3d4f1d[_0x0d8c('0x15c')])||!_0x3d4f1d[_0x0d8c('0x1ef')]){if(_0x5cf2aa['dialMethod']==='booked'){_0x5cf2aa[_0x0d8c('0x77')]=_[_0x0d8c('0x42')](_0x5cf2aa['queueStatusComplete'])?!![]:_0x5cf2aa[_0x0d8c('0x77')];var _0xdc9d20=uuid['v4']();_0x547a2f[_0x0d8c('0x21')][_0xdc9d20]=new Action(_0x5cf2aa,_0x3d4f1d,_0xdc9d20);loggerBooked['info']('[booked][checkContactBlack]',_0xdc9d20,'queueStatusComplete:\x20',JSON[_0x0d8c('0x79')](_0x5cf2aa[_0x0d8c('0x77')]),_0x0d8c('0x1f0'),_0x5cf2aa['name']);if(_0x5cf2aa[_0x0d8c('0x77')]){_0x5cf2aa[_0x0d8c('0x77')]=![];_0x547a2f[_0x0d8c('0x27')][_0x547a2f[_0x0d8c('0x21')][_0xdc9d20][_0x0d8c('0xc2')]]=[];ami[_0x0d8c('0x9e')]({'actionid':_0xdc9d20,'action':_0x0d8c('0x1f1'),'queue':_0x5cf2aa[_0x0d8c('0x49')]})['catch'](function(){_0x547a2f[_0x0d8c('0xc5')](_0x5cf2aa);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x547a2f[_0x0d8c('0x21')][_0xdc9d20]['ContactId'],'ListId':_0x547a2f['actions'][_0xdc9d20]['ListId'],'VoiceQueueId':_0x547a2f[_0x0d8c('0x21')][_0xdc9d20][_0x0d8c('0xe4')]||undefined,'CampaignId':_0x547a2f['actions'][_0xdc9d20][_0x0d8c('0x105')]||undefined})[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x1f2')));delete _0x547a2f[_0x0d8c('0x21')][_0xdc9d20];});}else{loggerBooked[_0x0d8c('0x4c')](_0x0d8c('0x1f3'),JSON[_0x0d8c('0x79')](_0x5cf2aa[_0x0d8c('0x77')]),'Queue:\x20',_0x5cf2aa['name']);_0x547a2f['updateOriginated'](_0x5cf2aa);hopperUtils[_0x0d8c('0xdf')]({'active':![],'ContactId':_0x547a2f[_0x0d8c('0x21')][_0xdc9d20]['ContactId'],'ListId':_0x547a2f[_0x0d8c('0x21')][_0xdc9d20][_0x0d8c('0xf1')],'VoiceQueueId':_0x547a2f[_0x0d8c('0x21')][_0xdc9d20][_0x0d8c('0xe4')]||undefined,'CampaignId':_0x547a2f[_0x0d8c('0x21')][_0xdc9d20][_0x0d8c('0x105')]||undefined})[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x1f2')));delete _0x547a2f[_0x0d8c('0x21')][_0xdc9d20];}}else{return _0x547a2f[_0x0d8c('0x160')](_0x5cf2aa,_0x3d4f1d);}}else{if(utils['getSeconds'](undefined,_0x3d4f1d[_0x0d8c('0x1f4')])<_0x5cf2aa[_0x0d8c('0x1f5')]*0x3c){if(_0x3d4f1d[_0x0d8c('0x14c')]&&!_0x3d4f1d[_0x0d8c('0x14c')]['voicePause']){_0x547a2f[_0x0d8c('0x1c')][_0x0d8c('0xfd')](_0x3d4f1d['id'])[_0x0d8c('0x1b')](function(){_0x547a2f[_0x0d8c('0xc5')](_0x5cf2aa);});}else{hopperUtils['unlockContact']({'active':![]},_0x3d4f1d['id'],0x1)[_0x0d8c('0x1b')](function(){_0x547a2f[_0x0d8c('0xc5')](_0x5cf2aa);});}}else{_0x5cf2aa[_0x0d8c('0x1f6')]+=0x1;_0x547a2f[_0x0d8c('0xc5')](_0x5cf2aa);if(_0x5cf2aa['dialRecallInQueue']){hopperUtils[_0x0d8c('0xdf')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3d4f1d[_0x0d8c('0xe3')],'ListId':_0x3d4f1d['ListId'],'VoiceQueueId':_0x3d4f1d[_0x0d8c('0xe4')]||undefined,'CampaignId':_0x3d4f1d['CampaignId']||undefined})[_0x0d8c('0xa5')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils['createHistory'](createObjHistory(_0x5cf2aa,_0x3d4f1d,utils[_0x0d8c('0x6e')]['QUEUE_RECALL'],0x17,'RecallInQueue'))[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x1f7')));}else{_0x547a2f[_0x0d8c('0x12e')](createObjHistory(_0x5cf2aa,_0x3d4f1d,utils['CAMPAIGN_STATUS'][_0x0d8c('0x1f8')],0x16,_0x0d8c('0x1f9')),_0x0d8c('0x1fa'),_0x0d8c('0x1fb'));}}}}else{_0x5cf2aa['outboundBlacklistCallsDay']+=0x1;_0x547a2f['saveInDb'](createObjHistory(_0x5cf2aa,_0x3d4f1d,utils['CAMPAIGN_STATUS'][_0x0d8c('0x1fc')],0xd,_0x0d8c('0x1fd')),_0x0d8c('0x1fe'),'[Originate][MoveBlacklist]');throw _0x0d8c('0x1ff');}};};Dialer['prototype']['handleIvr']=function(_0x1a6c40){var _0x5cfb0c=this;var _0x330544=_0x1a6c40['limitCalls']-_0x1a6c40[_0x0d8c('0x158')]-_0x1a6c40[_0x0d8c('0x200')];emitCampaignSummary(_0x1a6c40);if(_0x330544>0x0){if(_0x330544>this['maxNumberOriginate']){_0x330544=this[_0x0d8c('0x201')];}_0x1a6c40[_0x0d8c('0x200')]+=_0x330544;hopperUtils[_0x0d8c('0x202')](_0x1a6c40,_0x330544)['then'](function(_0x3b536d){_0x1a6c40[_0x0d8c('0x200')]-=_0x330544;_0x1a6c40[_0x0d8c('0x200')]=_0x1a6c40['temp']>0x0?_0x1a6c40['temp']:0x0;if(!utils[_0x0d8c('0x203')](_0x3b536d)){_0x1a6c40[_0x0d8c('0x6d')]=utils[_0x0d8c('0x6e')]['NO_AVAILABLE_CONTACTS'];logger[_0x0d8c('0x4c')](_0x0d8c('0x204')+_0x1a6c40['name']);}else{_0x1a6c40[_0x0d8c('0x158')]+=_0x3b536d[_0x0d8c('0x9c')];_0x1a6c40['message']=utils[_0x0d8c('0x6e')]['RUNNING'];for(var _0x49070a=0x0;_0x49070a<_0x3b536d['length'];_0x49070a+=0x1){_0x1a6c40[_0x0d8c('0x205')]+=0x1;if(_[_0x0d8c('0xf7')](_0x3b536d[_0x49070a])||_[_0x0d8c('0xf7')](_0x3b536d[_0x49070a][_0x0d8c('0x177')])||_['isNil'](_0x3b536d[_0x49070a][_0x0d8c('0x163')])){_0x5cfb0c[_0x0d8c('0x15b')]('[actionOriginate]\x20',_0x1a6c40,_0x3b536d[_0x49070a]);}else{hopperUtils[_0x0d8c('0x206')](_[_0x0d8c('0x7a')](_0x3b536d[_0x49070a],[_0x0d8c('0x105'),_0x0d8c('0x163')]))[_0x0d8c('0x40')](_0x5cfb0c[_0x0d8c('0x207')](_0x1a6c40,_0x3b536d[_0x49070a]))[_0x0d8c('0xa5')](_0x5cfb0c[_0x0d8c('0x208')]('[actionOriginateIvr]\x20',_0x1a6c40));}}}})['catch'](loggerGetContactDialer('[getContactCampaign2]',_0x1a6c40,_0x330544));}};Dialer['prototype']['handlePower']=function(_0x3d0108,_0x412202){var _0x5227f6=this;var _0x4e6165=[];if(_0x412202<0x1||_0x3d0108[_0x0d8c('0xb4')]===_0x0d8c('0x7')){_0x412202=0x1;}var _0x242e8e=Math[_0x0d8c('0x1ca')](_0x3d0108['available']*_0x412202)-_0x3d0108[_0x0d8c('0x158')]-_0x3d0108[_0x0d8c('0x200')];if(_0x3d0108['dialLimitQueue']>0x0){var _0x9b064c=_0x3d0108['dialLimitQueue']-_0x3d0108[_0x0d8c('0x158')]-_0x3d0108[_0x0d8c('0x1e0')]-_0x3d0108[_0x0d8c('0x200')]-_0x3d0108[_0x0d8c('0x140')];if(_0x242e8e>_0x9b064c){_0x242e8e=_0x9b064c;}}if(_0x242e8e>0x0){if(_0x3d0108['dialMethod']===_0x0d8c('0x7')){_0x242e8e=0x1;}if(_0x242e8e>this[_0x0d8c('0x201')]){_0x242e8e=this[_0x0d8c('0x201')];}_0x3d0108[_0x0d8c('0x200')]+=_0x242e8e;for(var _0x437d32 in this[_0x0d8c('0x1f')]){if(typeof this[_0x0d8c('0x1f')][_0x437d32]!==_0x0d8c('0x151')){if(this[_0x0d8c('0x1f')][_0x437d32][_0x0d8c('0x73')]==='not_inuse'&&this[_0x0d8c('0x1f')][_0x437d32]['status']===_0x0d8c('0x149')){_0x4e6165[_0x0d8c('0x9d')](this['agents'][_0x437d32]['id']);}}}hopperUtils[_0x0d8c('0x209')](_0x3d0108,_0x4e6165,_0x242e8e)['then'](function(_0x51c02f){_0x3d0108[_0x0d8c('0x200')]-=_0x242e8e;_0x3d0108[_0x0d8c('0x200')]=_0x3d0108['temp']>0x0?_0x3d0108[_0x0d8c('0x200')]:0x0;if(!utils[_0x0d8c('0x203')](_0x51c02f)){hopperUtils[_0x0d8c('0x20a')](_0x3d0108)['then'](sendMessageReschedule(_0x3d0108))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x3d0108[_0x0d8c('0x158')]+=_0x51c02f['length'];_0x3d0108[_0x0d8c('0x6d')]=_0x3d0108['dialMethod']==='booked'?utils[_0x0d8c('0x6e')][_0x0d8c('0x141')]:utils[_0x0d8c('0x6e')][_0x0d8c('0x20b')];for(var _0x47f321=0x0;_0x47f321<_0x51c02f[_0x0d8c('0x9c')];_0x47f321+=0x1){if(_['isNil'](_0x51c02f[_0x47f321])||_[_0x0d8c('0xf7')](_0x51c02f[_0x47f321][_0x0d8c('0x177')])||_[_0x0d8c('0xf7')](_0x51c02f[_0x47f321][_0x0d8c('0x163')])){_0x5227f6[_0x0d8c('0x15b')]('[actionOriginate]\x20',_0x3d0108,_0x51c02f[_0x47f321]);}else{hopperUtils[_0x0d8c('0x20c')](_[_0x0d8c('0x7a')](_0x51c02f[_0x47f321],[_0x0d8c('0xe4'),_0x0d8c('0x163')]))['then'](_0x5227f6['checkContactBlack'](_0x3d0108,_0x51c02f[_0x47f321]))['catch'](_0x5227f6[_0x0d8c('0x208')]('[actionOriginate]\x20',_0x3d0108));}}}})[_0x0d8c('0xa5')](loggerGetContactDialer(_0x0d8c('0x20d'),_0x3d0108,_0x242e8e));}};Dialer[_0x0d8c('0x19')][_0x0d8c('0x67')]=function(_0x2db8e7){if(_0x2db8e7['dialLimitQueue']>0x0){var _0x1f5b1b=_0x2db8e7[_0x0d8c('0x20e')]-_0x2db8e7[_0x0d8c('0x158')]-_0x2db8e7['talking'];if(_0x1f5b1b>0x0){this[_0x0d8c('0x20f')](_0x2db8e7);}else{loggerPredictiveCalls[_0x0d8c('0x4c')](_0x0d8c('0x210'));}}else{this['tryOriginatePredictive'](_0x2db8e7);}};Dialer['prototype'][_0x0d8c('0x20f')]=function(_0x4aec3c){var _0x5678fc=this;var _0xf78871=[];_0x4aec3c[_0x0d8c('0x158')]+=0x1;for(var _0x2784f6 in this[_0x0d8c('0x1f')]){if(typeof this[_0x0d8c('0x1f')][_0x2784f6]!=='undefined'){if(this['agents'][_0x2784f6][_0x0d8c('0x73')]===_0x0d8c('0x211')&&this[_0x0d8c('0x1f')][_0x2784f6][_0x0d8c('0x8c')]==='reachable'){_0xf78871[_0x0d8c('0x9d')](this['agents'][_0x2784f6]['id']);}}}return this[_0x0d8c('0x209')](_0x4aec3c['id'],_0xf78871,0x1,_0x4aec3c[_0x0d8c('0x212')],_0x4aec3c)['then'](function(_0xde4316){if(!utils['checkContactEmpty'](_0xde4316)){utils['checkContactLowerLimitOriginate'](_0x4aec3c,0x1,0x0);return hopperUtils['countReScheduled'](_0x4aec3c)['then'](sendMessageReschedule(_0x4aec3c))[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x213')));}else{_0x4aec3c[_0x0d8c('0x6d')]=utils[_0x0d8c('0x6e')]['RUNNING'];if(_['isNil'](_0xde4316[0x0])||_[_0x0d8c('0xf7')](_0xde4316[0x0]['Contact'])||_[_0x0d8c('0xf7')](_0xde4316[0x0][_0x0d8c('0x163')])){_0x5678fc[_0x0d8c('0x15b')](_0x0d8c('0x214'),_0x4aec3c,_0xde4316[0x0]);}else{return hopperUtils[_0x0d8c('0x20c')](_[_0x0d8c('0x7a')](_0xde4316[0x0],[_0x0d8c('0xe4'),_0x0d8c('0x163')]))[_0x0d8c('0x40')](_0x5678fc[_0x0d8c('0x207')](_0x4aec3c,_0xde4316[0x0]))['catch'](_0x5678fc[_0x0d8c('0x208')](_0x0d8c('0x215'),_0x4aec3c));}}})[_0x0d8c('0xa5')](loggerGetContactDialer(_0x0d8c('0x216'),_0x4aec3c,0x1));};Dialer[_0x0d8c('0x19')]['abandonmentRate']=function(_0x59f5de,_0x3545f5,_0x722a93,_0x1df550,_0x4ee5d1,_0x2eb747){loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x217'));loggerPredictive[_0x0d8c('0x4c')]('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',_0x59f5de);loggerPredictive['info'](_0x0d8c('0x218'),_0x3545f5);loggerPredictive[_0x0d8c('0x4c')]('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',_0x722a93);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x219'),_0x1df550);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x21a'),_0x4ee5d1);loggerPredictive[_0x0d8c('0x4c')]('---------------------------');return new Promise(function(_0x14e6c3,_0xeaedf2){if(_0x59f5de<=0x0||isNaN(_0x59f5de)){return _0xeaedf2(msgResponse('[abandonmentRate]','Error',_0x0d8c('0x21b')+_0x59f5de));}if(_0x722a93<=0x0||isNaN(_0x722a93)){return _0xeaedf2(msgResponse(_0x0d8c('0x21c'),_0x0d8c('0x88'),'Ts\x20=\x20'+_0x722a93));}if(_0x1df550<=0x0||isNaN(_0x1df550)){return _0xeaedf2(msgResponse('[abandonmentRate]',_0x0d8c('0x88'),'p\x20=\x20'+_0x1df550));}if(_0x3545f5<=0x0||isNaN(_0x3545f5)){return _0xeaedf2(msgResponse('[abandonmentRate]','Error','interval\x20=\x20'+_0x3545f5));}if(_0x4ee5d1<=0x0||isNaN(_0x4ee5d1)){return _0xeaedf2(msgResponse(_0x0d8c('0x21c'),_0x0d8c('0x88'),'Amax\x20=\x20'+_0x4ee5d1));}_0x2eb747=_0x2eb747||0x0;var _0x53c19e=0x1/_0x722a93;var _0x249490=0x0;var _0x25dbfe=0x0;var _0xebec2a=0x0;var _0x1a8e69=0x0;for(var _0x46e3b7=0x0;_0xebec2a<_0x4ee5d1;_0x46e3b7+=0x1){_0x25dbfe=_0x46e3b7/_0x3545f5;_0x249490=(_0x1df550*_0x25dbfe+_0x2eb747)/_0x53c19e;_0xebec2a=utils[_0x0d8c('0x21d')](_0x249490,_0x59f5de);_0x1a8e69=_0x249490/_0x59f5de*(0x1-utils['erlangb'](_0x249490,_0x59f5de));}return _0x14e6c3({'erlangCalls':_0x46e3b7,'erlangCallToSecond':_0x3545f5/_0x46e3b7,'erlangAbandonmentRate':_0xebec2a,'erlangBusyFactor':_0x1a8e69});});};Dialer[_0x0d8c('0x19')][_0x0d8c('0x1e4')]=function(_0x419be6,_0x119e1f,_0x5cf74f,_0x584125,_0x354450,_0x583331){loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x21e'));loggerPredictive[_0x0d8c('0x4c')]('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',_0x419be6);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x218'),_0x119e1f);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x21f'),_0x5cf74f);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x219'),_0x584125);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x220'),_0x354450);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x58'));return new Promise(function(_0x1a634c,_0x44bc49){if(_0x419be6<=0x0||isNaN(_0x419be6)){return _0x44bc49(msgResponse(_0x0d8c('0x221'),_0x0d8c('0x88'),_0x0d8c('0x21b')+_0x419be6));}if(_0x5cf74f<=0x0||isNaN(_0x5cf74f)){return _0x44bc49(msgResponse(_0x0d8c('0x221'),_0x0d8c('0x88'),_0x0d8c('0x222')+_0x5cf74f));}if(_0x584125<=0x0||isNaN(_0x584125)){return _0x44bc49(msgResponse(_0x0d8c('0x221'),_0x0d8c('0x88'),'p\x20=\x20'+_0x584125));}if(_0x119e1f<=0x0||isNaN(_0x119e1f)){return _0x44bc49(msgResponse(_0x0d8c('0x221'),'Error',_0x0d8c('0x223')+_0x119e1f));}if(_0x354450<=0x0||isNaN(_0x354450)){return _0x44bc49(msgResponse(_0x0d8c('0x221'),_0x0d8c('0x88'),_0x0d8c('0x224')+_0x354450));}_0x583331=_0x583331||0x0;var _0x1f57c9=0x1/_0x5cf74f;var _0x197384=0x0;var _0x4f8282=0x0;var _0x34750c=0x0;var _0x53cf32=0x0;for(var _0x56ec46=0x0;_0x53cf32<_0x354450;_0x56ec46+=0x1){_0x4f8282=_0x56ec46/_0x119e1f;_0x197384=(_0x584125*_0x4f8282+_0x583331)/_0x1f57c9;_0x34750c=utils[_0x0d8c('0x21d')](_0x197384,_0x419be6);_0x53cf32=_0x197384/_0x419be6*(0x1-utils[_0x0d8c('0x21d')](_0x197384,_0x419be6));}return _0x1a634c({'erlangCalls':_0x56ec46,'erlangCallToSecond':_0x119e1f/_0x56ec46,'erlangAbandonmentRate':_0x34750c,'erlangBusyFactor':_0x53cf32});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index bc40c25..c2e7c34 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 _0x2301=['callbackat','recallme','originatecalleridnum','prototype','getCaller','dialCutDigit','queue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','lastName','phone','active','type','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid'];(function(_0x449e89,_0xff2df2){var _0x57d365=function(_0x7774e9){while(--_0x7774e9){_0x449e89['push'](_0x449e89['shift']());}};_0x57d365(++_0xff2df2);}(_0x2301,0x104));var _0x1230=function(_0x5ba549,_0x425afd){_0x5ba549=_0x5ba549-0x0;var _0x36e3a1=_0x2301[_0x5ba549];return _0x36e3a1;};'use strict';var util=require(_0x1230('0x0'));var _=require(_0x1230('0x1'));var moment=require(_0x1230('0x2'));function checkNameSurname(_0x5671e0,_0x59b719,_0x41bef2){var _0x1c11f7='';if(!_[_0x1230('0x3')](_0x59b719)&&'string'===typeof _0x59b719){_0x1c11f7+=_0x59b719;}if(!_[_0x1230('0x3')](_0x41bef2)&&_0x1230('0x4')===typeof _0x41bef2){_0x1c11f7+='\x20'+_0x41bef2;}if(_0x1c11f7!==''){return _0x1c11f7;}return _0x5671e0;}function Action(_0x204bc8,_0x558fff,_0x1445af){this[_0x1230('0x5')]=_0x204bc8;this[_0x1230('0x6')]=_0x1445af||undefined;this[_0x1230('0x7')]=checkNameSurname(_0x558fff[_0x1230('0x8')]['phone'],_0x558fff['Contact'][_0x1230('0x9')],_0x558fff['Contact'][_0x1230('0xa')]);this['number']=_0x558fff[_0x1230('0xb')];this['queue']=_0x204bc8['name'];this[_0x1230('0xc')]=_0x558fff[_0x1230('0xc')]||![];this[_0x1230('0xd')]=_0x204bc8[_0x1230('0xd')];this[_0x1230('0xe')]=_0x204bc8[_0x1230('0xe')]||0x3;this[_0x1230('0xf')]=_0x558fff['scheduledat'];this[_0x1230('0x10')]=_0x558fff['countbusyretry'];this['countcongestionretry']=_0x558fff['countcongestionretry'];this[_0x1230('0x11')]=_0x558fff[_0x1230('0x11')];this[_0x1230('0x12')]=_0x558fff[_0x1230('0x12')];this['countdropretry']=_0x558fff[_0x1230('0x13')];this[_0x1230('0x14')]=_0x558fff[_0x1230('0x14')];this[_0x1230('0x15')]=_0x558fff[_0x1230('0x15')];this[_0x1230('0x16')]=_0x558fff[_0x1230('0x16')];this['ContactId']=_0x558fff[_0x1230('0x17')];this[_0x1230('0x18')]=_0x558fff[_0x1230('0x18')];this[_0x1230('0x19')]=_0x558fff['UserId'];this[_0x1230('0x1a')]=_0x558fff[_0x1230('0x1a')];this['CampaignId']=_0x558fff['CampaignId'];this[_0x1230('0x1b')]=_0x558fff['id'];this[_0x1230('0x1c')]=_0x558fff[_0x1230('0x8')][_0x1230('0x9')]||'';this[_0x1230('0x1d')]=moment()[_0x1230('0x1e')](_0x1230('0x1f'));this[_0x1230('0x20')]=_0x558fff[_0x1230('0x20')];this['callbackuniqueid']=_0x558fff[_0x1230('0x21')];this[_0x1230('0x22')]=_0x558fff[_0x1230('0x22')];this[_0x1230('0x23')]=_0x558fff[_0x1230('0x23')];this[_0x1230('0x24')]='';this['originatecalleridname']='';}Action[_0x1230('0x25')][_0x1230('0x26')]=function(){return util['format']('\x22%s\x22\x20<%s>',this['name'],this['voiceQueue'][_0x1230('0x27')]>0x0?this['number']['substring'](this[_0x1230('0x5')][_0x1230('0x27')]):this['number']);};Action[_0x1230('0x25')]['getQueue']=function(){return this[_0x1230('0x28')];};module[_0x1230('0x29')]=Action; \ No newline at end of file +var _0x4e94=['getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','lodash','moment','string','voiceQueue','Contact','phone','firstName','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme'];(function(_0x336c17,_0x12bc12){var _0x37a0ca=function(_0x21c229){while(--_0x21c229){_0x336c17['push'](_0x336c17['shift']());}};_0x37a0ca(++_0x12bc12);}(_0x4e94,0x84));var _0x44e9=function(_0x1b8e60,_0x21b885){_0x1b8e60=_0x1b8e60-0x0;var _0x363363=_0x4e94[_0x1b8e60];return _0x363363;};'use strict';var util=require(_0x44e9('0x0'));var _=require(_0x44e9('0x1'));var moment=require(_0x44e9('0x2'));function checkNameSurname(_0x447f1a,_0x647514,_0x65043b){var _0x2f2650='';if(!_['isNil'](_0x647514)&&_0x44e9('0x3')===typeof _0x647514){_0x2f2650+=_0x647514;}if(!_['isNil'](_0x65043b)&&'string'===typeof _0x65043b){_0x2f2650+='\x20'+_0x65043b;}if(_0x2f2650!==''){return _0x2f2650;}return _0x447f1a;}function Action(_0xec7429,_0x26f0c5,_0x498588){this[_0x44e9('0x4')]=_0xec7429;this['uniqueid']=_0x498588||undefined;this['name']=checkNameSurname(_0x26f0c5[_0x44e9('0x5')][_0x44e9('0x6')],_0x26f0c5[_0x44e9('0x5')][_0x44e9('0x7')],_0x26f0c5[_0x44e9('0x5')][_0x44e9('0x8')]);this[_0x44e9('0x9')]=_0x26f0c5['phone'];this[_0x44e9('0xa')]=_0xec7429[_0x44e9('0xb')];this[_0x44e9('0xc')]=_0x26f0c5['active']||![];this[_0x44e9('0xd')]=_0xec7429[_0x44e9('0xd')];this[_0x44e9('0xe')]=_0xec7429['dialQueueTimeout']||0x3;this[_0x44e9('0xf')]=_0x26f0c5[_0x44e9('0xf')];this['countbusyretry']=_0x26f0c5[_0x44e9('0x10')];this['countcongestionretry']=_0x26f0c5[_0x44e9('0x11')];this[_0x44e9('0x12')]=_0x26f0c5['countnoanswerretry'];this[_0x44e9('0x13')]=_0x26f0c5[_0x44e9('0x13')];this[_0x44e9('0x14')]=_0x26f0c5['countdropretry'];this['countabandonedretry']=_0x26f0c5[_0x44e9('0x15')];this[_0x44e9('0x16')]=_0x26f0c5[_0x44e9('0x16')];this[_0x44e9('0x17')]=_0x26f0c5[_0x44e9('0x17')];this[_0x44e9('0x18')]=_0x26f0c5[_0x44e9('0x18')];this['ListId']=_0x26f0c5[_0x44e9('0x19')];this['UserId']=_0x26f0c5['UserId'];this['VoiceQueueId']=_0x26f0c5[_0x44e9('0x1a')];this[_0x44e9('0x1b')]=_0x26f0c5['CampaignId'];this[_0x44e9('0x1c')]=_0x26f0c5['id'];this['ContactFirstName']=_0x26f0c5[_0x44e9('0x5')][_0x44e9('0x7')]||'';this[_0x44e9('0x1d')]=moment()[_0x44e9('0x1e')](_0x44e9('0x1f'));this[_0x44e9('0x20')]=_0x26f0c5['callback'];this[_0x44e9('0x21')]=_0x26f0c5['callbackuniqueid'];this[_0x44e9('0x22')]=_0x26f0c5[_0x44e9('0x22')];this[_0x44e9('0x23')]=_0x26f0c5[_0x44e9('0x23')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action['prototype'][_0x44e9('0x24')]=function(){return util['format'](_0x44e9('0x25'),this['name'],this[_0x44e9('0x4')][_0x44e9('0x26')]>0x0?this[_0x44e9('0x9')][_0x44e9('0x27')](this[_0x44e9('0x4')]['dialCutDigit']):this[_0x44e9('0x9')]);};Action['prototype'][_0x44e9('0x28')]=function(){return this[_0x44e9('0xa')];};module[_0x44e9('0x29')]=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 091b250..69a8461 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 _0x5a40=['type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','membername','reason','callback','callbackat','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','agiafterat','exports','Answer','scheduledat'];(function(_0x4b36e0,_0x25d3fc){var _0xb18bc7=function(_0x3d0923){while(--_0x3d0923){_0x4b36e0['push'](_0x4b36e0['shift']());}};_0xb18bc7(++_0x25d3fc);}(_0x5a40,0x9e));var _0x05a4=function(_0x25555c,_0xfe0327){_0x25555c=_0x25555c-0x0;var _0x377519=_0x5a40[_0x25555c];return _0x377519;};'use strict';var moment=require('moment');var utils=require('../utils');function AgentComplete(_0x5879a8,_0x5e002f){this['state']=0x4;this['statedesc']=_0x05a4('0x0');this[_0x05a4('0x1')]=_0x5879a8[_0x05a4('0x1')];this[_0x05a4('0x2')]=_0x5879a8[_0x05a4('0x2')];this[_0x05a4('0x3')]=_0x5879a8[_0x05a4('0x2')]===_0x05a4('0x4')?_0x05a4('0x5'):_0x5879a8[_0x05a4('0x2')];this[_0x05a4('0x6')]=_0x5879a8[_0x05a4('0x6')];this['countcongestionretry']=_0x5879a8[_0x05a4('0x7')];this[_0x05a4('0x8')]=_0x5879a8[_0x05a4('0x8')];this[_0x05a4('0x9')]=_0x5879a8[_0x05a4('0x6')]+_0x5879a8[_0x05a4('0x7')]+_0x5879a8[_0x05a4('0x8')]+_0x5879a8['countnosuchnumberretry']+_0x5879a8['countdropretry']+_0x5879a8['countabandonedretry']+_0x5879a8['countmachineretry']+_0x5879a8[_0x05a4('0xa')];this[_0x05a4('0xb')]=_0x5879a8[_0x05a4('0xb')];this['countdropretry']=_0x5879a8[_0x05a4('0xc')];this[_0x05a4('0xd')]=_0x5879a8[_0x05a4('0xd')];this[_0x05a4('0xe')]=_0x5879a8[_0x05a4('0xe')];this['countagentrejectretry']=_0x5879a8['countagentrejectretry'];this[_0x05a4('0xf')]=_0x5e002f[_0x05a4('0xf')];this[_0x05a4('0x10')]=_0x5879a8[_0x05a4('0x11')];this[_0x05a4('0x12')]=_0x5879a8[_0x05a4('0x13')];this[_0x05a4('0x14')]=_0x5879a8[_0x05a4('0x14')];this[_0x05a4('0x15')]=_0x5879a8['responsetime'];this[_0x05a4('0x16')]=_0x5879a8[_0x05a4('0x16')];this[_0x05a4('0x17')]=moment()[_0x05a4('0x18')](_0x05a4('0x19'));this['ringtime']=utils[_0x05a4('0x1a')](_0x5879a8[_0x05a4('0x15')],_0x5879a8[_0x05a4('0x14')]);this[_0x05a4('0x1b')]=utils[_0x05a4('0x1a')](_0x5879a8[_0x05a4('0x16')],_0x5879a8[_0x05a4('0x15')]);this[_0x05a4('0x1c')]=utils['getSeconds'](this[_0x05a4('0x17')],_0x5879a8[_0x05a4('0x16')]);this[_0x05a4('0x5')]=_0x5e002f[_0x05a4('0x5')];this[_0x05a4('0x1d')]=_0x5e002f[_0x05a4('0x1d')];this[_0x05a4('0x1e')]=_0x5e002f['reason'];this[_0x05a4('0x1f')]=_0x5879a8[_0x05a4('0x1f')];this['callbackuniqueid']=_0x5879a8['callbackuniqueid'];this[_0x05a4('0x20')]=_0x5879a8[_0x05a4('0x20')];this['recallme']=_0x5879a8['recallme'];this['ContactId']=_0x5879a8['ContactId'];this[_0x05a4('0x21')]=_0x5879a8['ListId'];this[_0x05a4('0x22')]=_0x5879a8[_0x05a4('0x22')];this['VoiceQueueId']=_0x5879a8[_0x05a4('0x23')];this[_0x05a4('0x24')]=_0x5879a8[_0x05a4('0x24')];this['originatecalleridnum']=_0x5879a8['originatecalleridnum']||'';this[_0x05a4('0x25')]=_0x5879a8['originatecalleridname']||'';this[_0x05a4('0x26')]=_0x5879a8[_0x05a4('0x26')];}module[_0x05a4('0x27')]=AgentComplete; \ No newline at end of file +var _0x942b=['ringtime','getSeconds','holdtime','talktime','membername','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x57bd71,_0x33adb7){var _0x487fae=function(_0x288715){while(--_0x288715){_0x57bd71['push'](_0x57bd71['shift']());}};_0x487fae(++_0x33adb7);}(_0x942b,0xc6));var _0xb942=function(_0x376121,_0xd28328){_0x376121=_0x376121-0x0;var _0x3504e7=_0x942b[_0x376121];return _0x3504e7;};'use strict';var moment=require(_0xb942('0x0'));var utils=require(_0xb942('0x1'));function AgentComplete(_0x4af21a,_0x4f6df8){this[_0xb942('0x2')]=0x4;this[_0xb942('0x3')]=_0xb942('0x4');this[_0xb942('0x5')]=_0x4af21a['scheduledat'];this[_0xb942('0x6')]=_0x4af21a[_0xb942('0x6')];this[_0xb942('0x7')]=_0x4af21a['type']===_0xb942('0x8')?_0xb942('0x9'):_0x4af21a[_0xb942('0x6')];this[_0xb942('0xa')]=_0x4af21a[_0xb942('0xa')];this[_0xb942('0xb')]=_0x4af21a[_0xb942('0xb')];this[_0xb942('0xc')]=_0x4af21a[_0xb942('0xc')];this['countglobal']=_0x4af21a[_0xb942('0xa')]+_0x4af21a[_0xb942('0xb')]+_0x4af21a[_0xb942('0xc')]+_0x4af21a[_0xb942('0xd')]+_0x4af21a[_0xb942('0xe')]+_0x4af21a[_0xb942('0xf')]+_0x4af21a[_0xb942('0x10')]+_0x4af21a[_0xb942('0x11')];this['countnosuchnumberretry']=_0x4af21a[_0xb942('0xd')];this[_0xb942('0xe')]=_0x4af21a[_0xb942('0xe')];this[_0xb942('0xf')]=_0x4af21a[_0xb942('0xf')];this[_0xb942('0x10')]=_0x4af21a[_0xb942('0x10')];this[_0xb942('0x11')]=_0x4af21a['countagentrejectretry'];this[_0xb942('0x12')]=_0x4f6df8[_0xb942('0x12')];this['calleridname']=_0x4af21a['name'];this[_0xb942('0x13')]=_0x4af21a[_0xb942('0x14')];this[_0xb942('0x15')]=_0x4af21a[_0xb942('0x15')];this[_0xb942('0x16')]=_0x4af21a[_0xb942('0x16')];this['answertime']=_0x4af21a[_0xb942('0x17')];this[_0xb942('0x18')]=moment()[_0xb942('0x19')](_0xb942('0x1a'));this[_0xb942('0x1b')]=utils[_0xb942('0x1c')](_0x4af21a[_0xb942('0x16')],_0x4af21a[_0xb942('0x15')]);this[_0xb942('0x1d')]=utils['getSeconds'](_0x4af21a['answertime'],_0x4af21a[_0xb942('0x16')]);this[_0xb942('0x1e')]=utils[_0xb942('0x1c')](this[_0xb942('0x18')],_0x4af21a['answertime']);this[_0xb942('0x9')]=_0x4f6df8[_0xb942('0x9')];this[_0xb942('0x1f')]=_0x4f6df8[_0xb942('0x1f')];this['reason']=_0x4f6df8['reason'];this[_0xb942('0x20')]=_0x4af21a['callback'];this['callbackuniqueid']=_0x4af21a[_0xb942('0x21')];this[_0xb942('0x22')]=_0x4af21a[_0xb942('0x22')];this[_0xb942('0x23')]=_0x4af21a[_0xb942('0x23')];this['ContactId']=_0x4af21a[_0xb942('0x24')];this[_0xb942('0x25')]=_0x4af21a['ListId'];this['UserId']=_0x4af21a[_0xb942('0x26')];this[_0xb942('0x27')]=_0x4af21a[_0xb942('0x27')];this[_0xb942('0x28')]=_0x4af21a[_0xb942('0x28')];this[_0xb942('0x29')]=_0x4af21a[_0xb942('0x29')]||'';this[_0xb942('0x2a')]=_0x4af21a['originatecalleridname']||'';this[_0xb942('0x2b')]=_0x4af21a[_0xb942('0x2b')];}module[_0xb942('0x2c')]=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 c3564bd..88ada58 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 _0x9dee=['originatecalleridname','state','statedesc','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x22ee1e,_0x3eff80){var _0x49a5c9=function(_0x373480){while(--_0x373480){_0x22ee1e['push'](_0x22ee1e['shift']());}};_0x49a5c9(++_0x3eff80);}(_0x9dee,0x16e));var _0xe9de=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x9dee[_0x16629d];return _0x56ccee;};'use strict';function Final(_0x5e4c16){this[_0xe9de('0x0')]=_0x5e4c16[_0xe9de('0x0')];this['scheduledat']=_0x5e4c16[_0xe9de('0x1')];this[_0xe9de('0x2')]=_0x5e4c16[_0xe9de('0x2')];this['campaigntype']=_0x5e4c16['type']==='outbound'?_0xe9de('0x3'):_0x5e4c16['type'];this[_0xe9de('0x4')]=_0x5e4c16['countbusyretry'];this['countcongestionretry']=_0x5e4c16[_0xe9de('0x5')];this[_0xe9de('0x6')]=_0x5e4c16['countnoanswerretry'];this[_0xe9de('0x7')]=_0x5e4c16['countbusyretry']+_0x5e4c16['countcongestionretry']+_0x5e4c16[_0xe9de('0x6')]+_0x5e4c16['countnosuchnumberretry']+_0x5e4c16['countdropretry']+_0x5e4c16[_0xe9de('0x8')]+_0x5e4c16[_0xe9de('0x9')]+_0x5e4c16['countagentrejectretry'];this['countnosuchnumberretry']=_0x5e4c16[_0xe9de('0xa')];this['countdropretry']=_0x5e4c16['countdropretry'];this['countabandonedretry']=_0x5e4c16['countabandonedretry'];this['countmachineretry']=_0x5e4c16[_0xe9de('0x9')];this['countagentrejectretry']=_0x5e4c16[_0xe9de('0xb')];this[_0xe9de('0x3')]=_0x5e4c16[_0xe9de('0x3')];this[_0xe9de('0xc')]=_0x5e4c16[_0xe9de('0xc')];this[_0xe9de('0xd')]=_0x5e4c16[_0xe9de('0xd')];this[_0xe9de('0xe')]=_0x5e4c16[_0xe9de('0xe')];this['responsetime']=_0x5e4c16[_0xe9de('0xf')];this[_0xe9de('0x10')]=_0x5e4c16[_0xe9de('0xf')];this[_0xe9de('0x11')]=_0x5e4c16[_0xe9de('0x11')]||0x0;this[_0xe9de('0x12')]=_0x5e4c16[_0xe9de('0x12')]||0x0;this['talktime']=_0x5e4c16[_0xe9de('0x13')]||0x0;this[_0xe9de('0x14')]=_0x5e4c16['callback'];this['callbackuniqueid']=_0x5e4c16[_0xe9de('0x15')];this[_0xe9de('0x16')]=_0x5e4c16[_0xe9de('0x16')];this[_0xe9de('0x17')]=_0x5e4c16[_0xe9de('0x17')];this[_0xe9de('0x18')]=_0x5e4c16[_0xe9de('0x18')];this[_0xe9de('0x19')]=_0x5e4c16[_0xe9de('0x19')];this[_0xe9de('0x1a')]=_0x5e4c16[_0xe9de('0x1a')];this[_0xe9de('0x1b')]=_0x5e4c16['VoiceQueueId'];this[_0xe9de('0x1c')]=_0x5e4c16['CampaignId'];this['originatecalleridnum']=_0x5e4c16[_0xe9de('0x1d')]||'';this[_0xe9de('0x1e')]=_0x5e4c16[_0xe9de('0x1e')]||'';this[_0xe9de('0x1f')]=_0x5e4c16[_0xe9de('0x1f')];this['statedesc']=_0x5e4c16[_0xe9de('0x20')];}module['exports']=Final; \ No newline at end of file +var _0x30d6=['uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','statedesc','exports'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x30d6,0xd8));var _0x630d=function(_0x372129,_0x539547){_0x372129=_0x372129-0x0;var _0x2385b4=_0x30d6[_0x372129];return _0x2385b4;};'use strict';function Final(_0x11db91){this['uniqueid']=_0x11db91[_0x630d('0x0')];this['scheduledat']=_0x11db91[_0x630d('0x1')];this['type']=_0x11db91[_0x630d('0x2')];this[_0x630d('0x3')]=_0x11db91[_0x630d('0x2')]===_0x630d('0x4')?'queue':_0x11db91[_0x630d('0x2')];this[_0x630d('0x5')]=_0x11db91[_0x630d('0x5')];this[_0x630d('0x6')]=_0x11db91['countcongestionretry'];this[_0x630d('0x7')]=_0x11db91[_0x630d('0x7')];this[_0x630d('0x8')]=_0x11db91[_0x630d('0x5')]+_0x11db91['countcongestionretry']+_0x11db91[_0x630d('0x7')]+_0x11db91[_0x630d('0x9')]+_0x11db91[_0x630d('0xa')]+_0x11db91[_0x630d('0xb')]+_0x11db91['countmachineretry']+_0x11db91[_0x630d('0xc')];this[_0x630d('0x9')]=_0x11db91[_0x630d('0x9')];this['countdropretry']=_0x11db91[_0x630d('0xa')];this['countabandonedretry']=_0x11db91['countabandonedretry'];this[_0x630d('0xd')]=_0x11db91[_0x630d('0xd')];this[_0x630d('0xc')]=_0x11db91['countagentrejectretry'];this[_0x630d('0xe')]=_0x11db91[_0x630d('0xe')];this['calleridname']=_0x11db91[_0x630d('0xf')];this[_0x630d('0x10')]=_0x11db91['calleridnum'];this[_0x630d('0x11')]=_0x11db91[_0x630d('0x11')];this[_0x630d('0x12')]=_0x11db91[_0x630d('0x12')];this[_0x630d('0x13')]=_0x11db91[_0x630d('0x12')];this[_0x630d('0x14')]=_0x11db91[_0x630d('0x14')]||0x0;this[_0x630d('0x15')]=_0x11db91[_0x630d('0x15')]||0x0;this[_0x630d('0x16')]=_0x11db91[_0x630d('0x16')]||0x0;this['callback']=_0x11db91[_0x630d('0x17')];this[_0x630d('0x18')]=_0x11db91[_0x630d('0x18')];this['callbackat']=_0x11db91[_0x630d('0x19')];this['recallme']=_0x11db91[_0x630d('0x1a')];this['ContactId']=_0x11db91[_0x630d('0x1b')];this['ListId']=_0x11db91[_0x630d('0x1c')];this[_0x630d('0x1d')]=_0x11db91[_0x630d('0x1d')];this['VoiceQueueId']=_0x11db91[_0x630d('0x1e')];this['CampaignId']=_0x11db91['CampaignId'];this['originatecalleridnum']=_0x11db91[_0x630d('0x1f')]||'';this[_0x630d('0x20')]=_0x11db91[_0x630d('0x20')]||'';this[_0x630d('0x21')]=_0x11db91[_0x630d('0x21')];this[_0x630d('0x22')]=_0x11db91[_0x630d('0x22')];}module[_0x630d('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index a62d4ad..36365f3 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 _0x552d=['name','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','queue','membername','IVR','reason','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','../utils','Answer','scheduledat','type','amd','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname'];(function(_0x2de078,_0xdda9be){var _0x4e393b=function(_0x3fd0e5){while(--_0x3fd0e5){_0x2de078['push'](_0x2de078['shift']());}};_0x4e393b(++_0xdda9be);}(_0x552d,0x1b9));var _0xd552=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x552d[_0x42cae2];return _0x5f256f;};'use strict';var moment=require('moment');var utils=require(_0xd552('0x0'));function Hangup(_0x126937,_0x122f11){this['state']=0x4;this['statedesc']=_0xd552('0x1');this[_0xd552('0x2')]=_0x126937['scheduledat'];this[_0xd552('0x3')]=_0x126937[_0xd552('0x3')];this['campaigntype']=_0x126937[_0xd552('0x3')]==='outbound'?'queue':_0x126937['type'];this['amd']=_0x126937[_0xd552('0x4')]||![];this['countbusyretry']=_0x126937[_0xd552('0x5')];this[_0xd552('0x6')]=_0x126937[_0xd552('0x6')];this['countnoanswerretry']=_0x126937['countnoanswerretry'];this['countglobal']=_0x126937[_0xd552('0x5')]+_0x126937[_0xd552('0x6')]+_0x126937[_0xd552('0x7')]+_0x126937['countnosuchnumberretry']+_0x126937['countdropretry']+_0x126937[_0xd552('0x8')]+_0x126937[_0xd552('0x9')]+_0x126937['countagentrejectretry'];this[_0xd552('0xa')]=_0x126937[_0xd552('0xa')];this['countdropretry']=_0x126937['countdropretry'];this[_0xd552('0x8')]=_0x126937[_0xd552('0x8')];this['countmachineretry']=_0x126937[_0xd552('0x9')];this[_0xd552('0xb')]=_0x126937['countagentrejectretry'];this[_0xd552('0xc')]=_0x122f11[_0xd552('0xc')];this[_0xd552('0xd')]=_0x126937[_0xd552('0xe')];this['calleridnum']=_0x126937[_0xd552('0xf')];this[_0xd552('0x10')]=_0x126937[_0xd552('0x10')];this[_0xd552('0x11')]=_0x126937[_0xd552('0x11')];this[_0xd552('0x12')]=moment()['format'](_0xd552('0x13'));this[_0xd552('0x14')]=utils[_0xd552('0x15')](_0x126937[_0xd552('0x11')],_0x126937[_0xd552('0x10')]);this[_0xd552('0x16')]=0x0;this['talktime']=utils[_0xd552('0x15')](this[_0xd552('0x12')],_0x126937['responsetime']);this[_0xd552('0x17')]=_0x126937[_0xd552('0x17')];this[_0xd552('0x18')]=_0xd552('0x19');this[_0xd552('0x1a')]=_0x122f11['cause-txt'];this['callback']=_0x126937['callback'];this['callbackuniqueid']=_0x126937['callbackuniqueid'];this[_0xd552('0x1b')]=_0x126937[_0xd552('0x1b')];this[_0xd552('0x1c')]=_0x126937[_0xd552('0x1c')];this[_0xd552('0x1d')]=_0x126937[_0xd552('0x1d')];this[_0xd552('0x1e')]=_0x126937[_0xd552('0x1e')];this['UserId']=_0x126937[_0xd552('0x1f')];this[_0xd552('0x20')]=_0x126937['VoiceQueueId'];this[_0xd552('0x21')]=_0x126937[_0xd552('0x21')];}module[_0xd552('0x22')]=Hangup; \ No newline at end of file +var _0xbf74=['responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ListId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','campaigntype','type','queue','amd','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime'];(function(_0x4415b1,_0x31b8e9){var _0x30e06c=function(_0x59c21b){while(--_0x59c21b){_0x4415b1['push'](_0x4415b1['shift']());}};_0x30e06c(++_0x31b8e9);}(_0xbf74,0x10f));var _0x4bf7=function(_0x1dc5c3,_0x1bea78){_0x1dc5c3=_0x1dc5c3-0x0;var _0x5e4b7e=_0xbf74[_0x1dc5c3];return _0x5e4b7e;};'use strict';var moment=require(_0x4bf7('0x0'));var utils=require(_0x4bf7('0x1'));function Hangup(_0x9bf184,_0x460aa3){this[_0x4bf7('0x2')]=0x4;this[_0x4bf7('0x3')]=_0x4bf7('0x4');this[_0x4bf7('0x5')]=_0x9bf184['scheduledat'];this['type']=_0x9bf184['type'];this[_0x4bf7('0x6')]=_0x9bf184[_0x4bf7('0x7')]==='outbound'?_0x4bf7('0x8'):_0x9bf184['type'];this[_0x4bf7('0x9')]=_0x9bf184['amd']||![];this['countbusyretry']=_0x9bf184[_0x4bf7('0xa')];this['countcongestionretry']=_0x9bf184['countcongestionretry'];this[_0x4bf7('0xb')]=_0x9bf184[_0x4bf7('0xb')];this[_0x4bf7('0xc')]=_0x9bf184['countbusyretry']+_0x9bf184[_0x4bf7('0xd')]+_0x9bf184[_0x4bf7('0xb')]+_0x9bf184[_0x4bf7('0xe')]+_0x9bf184[_0x4bf7('0xf')]+_0x9bf184[_0x4bf7('0x10')]+_0x9bf184[_0x4bf7('0x11')]+_0x9bf184[_0x4bf7('0x12')];this[_0x4bf7('0xe')]=_0x9bf184[_0x4bf7('0xe')];this[_0x4bf7('0xf')]=_0x9bf184[_0x4bf7('0xf')];this[_0x4bf7('0x10')]=_0x9bf184[_0x4bf7('0x10')];this[_0x4bf7('0x11')]=_0x9bf184[_0x4bf7('0x11')];this[_0x4bf7('0x12')]=_0x9bf184['countagentrejectretry'];this['uniqueid']=_0x460aa3['uniqueid'];this[_0x4bf7('0x13')]=_0x9bf184['name'];this[_0x4bf7('0x14')]=_0x9bf184[_0x4bf7('0x15')];this[_0x4bf7('0x16')]=_0x9bf184[_0x4bf7('0x16')];this[_0x4bf7('0x17')]=_0x9bf184[_0x4bf7('0x17')];this[_0x4bf7('0x18')]=moment()[_0x4bf7('0x19')](_0x4bf7('0x1a'));this[_0x4bf7('0x1b')]=utils[_0x4bf7('0x1c')](_0x9bf184[_0x4bf7('0x17')],_0x9bf184[_0x4bf7('0x16')]);this['holdtime']=0x0;this[_0x4bf7('0x1d')]=utils[_0x4bf7('0x1c')](this[_0x4bf7('0x18')],_0x9bf184[_0x4bf7('0x17')]);this['queue']=_0x9bf184[_0x4bf7('0x8')];this[_0x4bf7('0x1e')]=_0x4bf7('0x1f');this[_0x4bf7('0x20')]=_0x460aa3[_0x4bf7('0x21')];this[_0x4bf7('0x22')]=_0x9bf184[_0x4bf7('0x22')];this[_0x4bf7('0x23')]=_0x9bf184[_0x4bf7('0x23')];this[_0x4bf7('0x24')]=_0x9bf184[_0x4bf7('0x24')];this['recallme']=_0x9bf184[_0x4bf7('0x25')];this['ContactId']=_0x9bf184['ContactId'];this[_0x4bf7('0x26')]=_0x9bf184[_0x4bf7('0x26')];this['UserId']=_0x9bf184['UserId'];this[_0x4bf7('0x27')]=_0x9bf184[_0x4bf7('0x27')];this[_0x4bf7('0x28')]=_0x9bf184[_0x4bf7('0x28')];}module[_0x4bf7('0x29')]=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 5fddc46..b106e6a 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 _0x98fa=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0xdfa07f,_0x17cd1c){var _0x11387d=function(_0xec67ec){while(--_0xec67ec){_0xdfa07f['push'](_0xdfa07f['shift']());}};_0x11387d(++_0x17cd1c);}(_0x98fa,0x7e));var _0xa98f=function(_0x37cdb9,_0x548c10){_0x37cdb9=_0x37cdb9-0x0;var _0x4101b8=_0x98fa[_0x37cdb9];return _0x4101b8;};'use strict';var utils=require(_0xa98f('0x0'));function History(_0x487f1e){this['uniqueid']=_0x487f1e['uniqueid'];this[_0xa98f('0x1')]=_0x487f1e[_0xa98f('0x1')]||undefined;this[_0xa98f('0x2')]=_0x487f1e['type'];this[_0xa98f('0x3')]=_0x487f1e['type']===_0xa98f('0x4')?_0xa98f('0x5'):_0x487f1e[_0xa98f('0x2')];this['countbusyretry']=_0x487f1e[_0xa98f('0x6')];this[_0xa98f('0x7')]=_0x487f1e[_0xa98f('0x7')];this['countnoanswerretry']=_0x487f1e[_0xa98f('0x8')];this['countglobal']=_0x487f1e['countbusyretry']+_0x487f1e['countcongestionretry']+_0x487f1e[_0xa98f('0x8')]+_0x487f1e[_0xa98f('0x9')]+_0x487f1e[_0xa98f('0xa')]+_0x487f1e[_0xa98f('0xb')]+_0x487f1e[_0xa98f('0xc')]+_0x487f1e[_0xa98f('0xd')];this[_0xa98f('0x9')]=_0x487f1e[_0xa98f('0x9')];this['countdropretry']=_0x487f1e[_0xa98f('0xa')];this[_0xa98f('0xb')]=_0x487f1e[_0xa98f('0xb')];this[_0xa98f('0xc')]=_0x487f1e[_0xa98f('0xc')];this[_0xa98f('0xd')]=_0x487f1e[_0xa98f('0xd')];this[_0xa98f('0x5')]=_0x487f1e[_0xa98f('0x5')];this[_0xa98f('0xe')]=_0x487f1e[_0xa98f('0xf')];this[_0xa98f('0x10')]=_0x487f1e['number'];this[_0xa98f('0x11')]=_0x487f1e[_0xa98f('0x11')];this[_0xa98f('0x12')]=_0x487f1e['responsetime'];this[_0xa98f('0x13')]=_0x487f1e['responsetime'];this[_0xa98f('0x14')]=utils['getSeconds'](_0x487f1e[_0xa98f('0x12')],_0x487f1e[_0xa98f('0x11')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0xa98f('0x15')]=_0x487f1e[_0xa98f('0x15')];this[_0xa98f('0x16')]=_0x487f1e[_0xa98f('0x16')];this[_0xa98f('0x17')]=_0x487f1e['callbackat'];this['recallme']=_0x487f1e[_0xa98f('0x18')];this[_0xa98f('0x19')]=_0x487f1e['ContactId'];this[_0xa98f('0x1a')]=_0x487f1e[_0xa98f('0x1a')];this[_0xa98f('0x1b')]=_0x487f1e[_0xa98f('0x1b')];this['VoiceQueueId']=_0x487f1e[_0xa98f('0x1c')];this[_0xa98f('0x1d')]=_0x487f1e[_0xa98f('0x1d')];this[_0xa98f('0x1e')]=_0x487f1e['originatecalleridnum']||'';this[_0xa98f('0x1f')]=_0x487f1e[_0xa98f('0x1f')]||'';this[_0xa98f('0x20')]=_0x487f1e['state'];this[_0xa98f('0x21')]=_0x487f1e['statedesc'];}module['exports']=History; \ No newline at end of file +var _0x42ef=['campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','queue','name','calleridnum','starttime','endtime','responsetime','ringtime','getSeconds','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x42ef,0x138));var _0xf42e=function(_0x1eadd5,_0x407ffa){_0x1eadd5=_0x1eadd5-0x0;var _0x5ac6a4=_0x42ef[_0x1eadd5];return _0x5ac6a4;};'use strict';var utils=require('../utils');function History(_0x313fe0){this[_0xf42e('0x0')]=_0x313fe0[_0xf42e('0x0')];this['scheduledat']=_0x313fe0[_0xf42e('0x1')]||undefined;this[_0xf42e('0x2')]=_0x313fe0[_0xf42e('0x2')];this[_0xf42e('0x3')]=_0x313fe0[_0xf42e('0x2')]==='outbound'?'queue':_0x313fe0['type'];this[_0xf42e('0x4')]=_0x313fe0['countbusyretry'];this[_0xf42e('0x5')]=_0x313fe0[_0xf42e('0x5')];this[_0xf42e('0x6')]=_0x313fe0[_0xf42e('0x6')];this[_0xf42e('0x7')]=_0x313fe0[_0xf42e('0x4')]+_0x313fe0[_0xf42e('0x5')]+_0x313fe0['countnoanswerretry']+_0x313fe0['countnosuchnumberretry']+_0x313fe0[_0xf42e('0x8')]+_0x313fe0[_0xf42e('0x9')]+_0x313fe0[_0xf42e('0xa')]+_0x313fe0[_0xf42e('0xb')];this[_0xf42e('0xc')]=_0x313fe0['countnosuchnumberretry'];this['countdropretry']=_0x313fe0[_0xf42e('0x8')];this['countabandonedretry']=_0x313fe0['countabandonedretry'];this[_0xf42e('0xa')]=_0x313fe0['countmachineretry'];this[_0xf42e('0xb')]=_0x313fe0[_0xf42e('0xb')];this[_0xf42e('0xd')]=_0x313fe0['queue'];this['calleridname']=_0x313fe0[_0xf42e('0xe')];this[_0xf42e('0xf')]=_0x313fe0['number'];this[_0xf42e('0x10')]=_0x313fe0[_0xf42e('0x10')];this['responsetime']=_0x313fe0['responsetime'];this[_0xf42e('0x11')]=_0x313fe0[_0xf42e('0x12')];this[_0xf42e('0x13')]=utils[_0xf42e('0x14')](_0x313fe0[_0xf42e('0x12')],_0x313fe0['starttime']);this[_0xf42e('0x15')]=0x0;this['talktime']=0x0;this[_0xf42e('0x16')]=_0x313fe0['callback'];this[_0xf42e('0x17')]=_0x313fe0['callbackuniqueid'];this[_0xf42e('0x18')]=_0x313fe0[_0xf42e('0x18')];this[_0xf42e('0x19')]=_0x313fe0[_0xf42e('0x19')];this[_0xf42e('0x1a')]=_0x313fe0[_0xf42e('0x1a')];this[_0xf42e('0x1b')]=_0x313fe0[_0xf42e('0x1b')];this[_0xf42e('0x1c')]=_0x313fe0[_0xf42e('0x1c')];this['VoiceQueueId']=_0x313fe0['VoiceQueueId'];this['CampaignId']=_0x313fe0[_0xf42e('0x1d')];this[_0xf42e('0x1e')]=_0x313fe0['originatecalleridnum']||'';this[_0xf42e('0x1f')]=_0x313fe0[_0xf42e('0x1f')]||'';this['state']=_0x313fe0[_0xf42e('0x20')];this[_0xf42e('0x21')]=_0x313fe0[_0xf42e('0x21')];}module[_0xf42e('0x22')]=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 c82ec8b..8b619b7 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 _0xf53d=['countagentrejectretry','countnosuchnumberretry','countmachineretry','calleridname','name','calleridnum','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry'];(function(_0x26cd05,_0x1f7d74){var _0x3e13b9=function(_0x1af957){while(--_0x1af957){_0x26cd05['push'](_0x26cd05['shift']());}};_0x3e13b9(++_0x1f7d74);}(_0xf53d,0x199));var _0xdf53=function(_0x3ce0e6,_0x35fcfc){_0x3ce0e6=_0x3ce0e6-0x0;var _0x1a1f6b=_0xf53d[_0x3ce0e6];return _0x1a1f6b;};'use strict';var utils=require(_0xdf53('0x0'));function QueueCallerAbandon(_0x3b6625,_0x4ee8c2){this[_0xdf53('0x1')]=_0x3b6625[_0xdf53('0x1')];this[_0xdf53('0x2')]=_0x3b6625['type'];this[_0xdf53('0x3')]=_0x3b6625['type']===_0xdf53('0x4')?'queue':_0x3b6625['type'];this[_0xdf53('0x5')]=_0x3b6625['countbusyretry'];this[_0xdf53('0x6')]=_0x3b6625[_0xdf53('0x6')];this[_0xdf53('0x7')]=_0x3b6625[_0xdf53('0x7')];this[_0xdf53('0x8')]=_0x3b6625[_0xdf53('0x5')]+_0x3b6625[_0xdf53('0x6')]+_0x3b6625[_0xdf53('0x7')]+_0x3b6625['countnosuchnumberretry']+_0x3b6625[_0xdf53('0x9')]+_0x3b6625[_0xdf53('0xa')]+_0x3b6625['countmachineretry']+_0x3b6625[_0xdf53('0xb')];this['countnosuchnumberretry']=_0x3b6625[_0xdf53('0xc')];this[_0xdf53('0x9')]=_0x3b6625[_0xdf53('0x9')];this[_0xdf53('0xa')]=_0x3b6625[_0xdf53('0xa')];this[_0xdf53('0xd')]=_0x3b6625['countmachineretry'];this[_0xdf53('0xb')]=_0x3b6625['countagentrejectretry'];this['uniqueid']=_0x4ee8c2['uniqueid'];this[_0xdf53('0xe')]=_0x3b6625[_0xdf53('0xf')];this[_0xdf53('0x10')]=_0x3b6625['number'];this[_0xdf53('0x11')]=_0x3b6625[_0xdf53('0x11')];this[_0xdf53('0x12')]=_0x3b6625[_0xdf53('0x12')];this[_0xdf53('0x13')]=_0x3b6625[_0xdf53('0x13')];this[_0xdf53('0x14')]=_0x3b6625[_0xdf53('0x14')];this[_0xdf53('0x15')]=this[_0xdf53('0x13')];this[_0xdf53('0x16')]=utils[_0xdf53('0x17')](_0x3b6625['responsetime'],_0x3b6625[_0xdf53('0x11')]);this['holdtime']=utils[_0xdf53('0x17')](this[_0xdf53('0x13')],_0x3b6625[_0xdf53('0x12')]);this['talktime']=0x0;this[_0xdf53('0x18')]=_0x4ee8c2[_0xdf53('0x18')];this[_0xdf53('0x19')]=_0x4ee8c2['connectedlinename'];this[_0xdf53('0x1a')]=_0x4ee8c2['reason'];this['callback']=_0x3b6625[_0xdf53('0x1b')];this['callbackuniqueid']=_0x3b6625[_0xdf53('0x1c')];this[_0xdf53('0x1d')]=_0x3b6625[_0xdf53('0x1d')];this[_0xdf53('0x1e')]=_0x3b6625[_0xdf53('0x1e')];this[_0xdf53('0x1f')]=_0x3b6625[_0xdf53('0x1f')];this['ListId']=_0x3b6625[_0xdf53('0x20')];this[_0xdf53('0x21')]=_0x3b6625[_0xdf53('0x21')];this[_0xdf53('0x22')]=_0x3b6625['VoiceQueueId'];this[_0xdf53('0x23')]=_0x3b6625[_0xdf53('0x23')];this[_0xdf53('0x24')]=_0x3b6625[_0xdf53('0x24')]||'';this[_0xdf53('0x25')]=_0x3b6625[_0xdf53('0x25')]||'';this[_0xdf53('0x26')]=_0x3b6625[_0xdf53('0x26')];this[_0xdf53('0x27')]=_0x3b6625[_0xdf53('0x27')];this[_0xdf53('0x28')]=_0x3b6625[_0xdf53('0x28')];}module[_0xdf53('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x0f77=['recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat'];(function(_0xb3b452,_0x582e8e){var _0x238983=function(_0x3bc866){while(--_0x3bc866){_0xb3b452['push'](_0xb3b452['shift']());}};_0x238983(++_0x582e8e);}(_0x0f77,0x65));var _0x70f7=function(_0x170a9f,_0x5ecb4a){_0x170a9f=_0x170a9f-0x0;var _0x9be5af=_0x0f77[_0x170a9f];return _0x9be5af;};'use strict';var utils=require(_0x70f7('0x0'));function QueueCallerAbandon(_0x1b8235,_0xa0ce59){this[_0x70f7('0x1')]=_0x1b8235[_0x70f7('0x1')];this[_0x70f7('0x2')]=_0x1b8235[_0x70f7('0x2')];this[_0x70f7('0x3')]=_0x1b8235[_0x70f7('0x2')]===_0x70f7('0x4')?_0x70f7('0x5'):_0x1b8235['type'];this['countbusyretry']=_0x1b8235['countbusyretry'];this[_0x70f7('0x6')]=_0x1b8235[_0x70f7('0x6')];this[_0x70f7('0x7')]=_0x1b8235[_0x70f7('0x7')];this[_0x70f7('0x8')]=_0x1b8235[_0x70f7('0x9')]+_0x1b8235[_0x70f7('0x6')]+_0x1b8235[_0x70f7('0x7')]+_0x1b8235[_0x70f7('0xa')]+_0x1b8235[_0x70f7('0xb')]+_0x1b8235[_0x70f7('0xc')]+_0x1b8235['countmachineretry']+_0x1b8235[_0x70f7('0xd')];this['countnosuchnumberretry']=_0x1b8235[_0x70f7('0xa')];this[_0x70f7('0xb')]=_0x1b8235[_0x70f7('0xb')];this[_0x70f7('0xc')]=_0x1b8235[_0x70f7('0xc')];this[_0x70f7('0xe')]=_0x1b8235[_0x70f7('0xe')];this['countagentrejectretry']=_0x1b8235['countagentrejectretry'];this[_0x70f7('0xf')]=_0xa0ce59[_0x70f7('0xf')];this[_0x70f7('0x10')]=_0x1b8235[_0x70f7('0x11')];this['calleridnum']=_0x1b8235[_0x70f7('0x12')];this[_0x70f7('0x13')]=_0x1b8235[_0x70f7('0x13')];this[_0x70f7('0x14')]=_0x1b8235['responsetime'];this[_0x70f7('0x15')]=_0x1b8235[_0x70f7('0x15')];this[_0x70f7('0x16')]=_0x1b8235[_0x70f7('0x16')];this[_0x70f7('0x17')]=this[_0x70f7('0x15')];this[_0x70f7('0x18')]=utils[_0x70f7('0x19')](_0x1b8235[_0x70f7('0x14')],_0x1b8235['starttime']);this[_0x70f7('0x1a')]=utils[_0x70f7('0x19')](this['droptime'],_0x1b8235['responsetime']);this[_0x70f7('0x1b')]=0x0;this[_0x70f7('0x5')]=_0xa0ce59[_0x70f7('0x5')];this[_0x70f7('0x1c')]=_0xa0ce59[_0x70f7('0x1d')];this[_0x70f7('0x1e')]=_0xa0ce59['reason'];this[_0x70f7('0x1f')]=_0x1b8235[_0x70f7('0x1f')];this['callbackuniqueid']=_0x1b8235[_0x70f7('0x20')];this[_0x70f7('0x21')]=_0x1b8235[_0x70f7('0x21')];this[_0x70f7('0x22')]=_0x1b8235['recallme'];this[_0x70f7('0x23')]=_0x1b8235['ContactId'];this[_0x70f7('0x24')]=_0x1b8235[_0x70f7('0x24')];this[_0x70f7('0x25')]=_0x1b8235['UserId'];this['VoiceQueueId']=_0x1b8235['VoiceQueueId'];this[_0x70f7('0x26')]=_0x1b8235[_0x70f7('0x26')];this['originatecalleridnum']=_0x1b8235[_0x70f7('0x27')]||'';this['originatecalleridname']=_0x1b8235[_0x70f7('0x28')]||'';this[_0x70f7('0x29')]=_0x1b8235['agiafterat'];this[_0x70f7('0x2a')]=_0x1b8235[_0x70f7('0x2a')];this[_0x70f7('0x2b')]=_0x1b8235[_0x70f7('0x2b')];}module[_0x70f7('0x2c')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 4dc6335..4e08055 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 _0xa9e0=['catch','temp','getContactDialer','getContactDialerIvr','error','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopperBlack','inspect','dialOrderByScheduledAt'];(function(_0x9bc20,_0x3a7837){var _0x210177=function(_0x4dcb29){while(--_0x4dcb29){_0x9bc20['push'](_0x9bc20['shift']());}};_0x210177(++_0x3a7837);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var util=require(_0x0a9e('0x0'));var logger=require(_0x0a9e('0x1'))(_0x0a9e('0x2'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0a9e('0x3'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x333808){return util[_0x0a9e('0x4')](_0x333808,{'showHidden':![],'depth':null});}function getContactDialer(_0x2ab90b,_0x991246,_0x981158){return cmHopper['getContactDialer'](_0x2ab90b['id'],_0x991246,_0x981158,_0x2ab90b[_0x0a9e('0x5')])[_0x0a9e('0x6')](function(_0x2cc193){_0x2ab90b['temp']-=_0x981158;if(_0x2ab90b['temp']<0x0){_0x2ab90b[_0x0a9e('0x7')]=0x0;}logger['error']('[getContactDialer]',inspectError(_0x2cc193));});}exports[_0x0a9e('0x8')]=getContactDialer;function getContactDialerIvr(_0xf81284,_0x307b3e){return cmHopper[_0x0a9e('0x9')](_0xf81284['id'],_0x307b3e,_0xf81284[_0x0a9e('0x5')])[_0x0a9e('0x6')](function(_0x4a4c56){_0xf81284['temp']-=_0x307b3e;if(_0xf81284['temp']<0x0){_0xf81284['temp']=0x0;}logger[_0x0a9e('0xa')](_0x0a9e('0xb'),inspectError(_0x4a4c56));});}exports[_0x0a9e('0x9')]=getContactDialerIvr;function countReScheduled(_0x26d672){return cmHopper[_0x0a9e('0xc')](_0x26d672)[_0x0a9e('0x6')](function(_0x5db4b0){logger[_0x0a9e('0xa')](_0x0a9e('0xd'),inspectError(_0x5db4b0));});}exports[_0x0a9e('0xc')]=countReScheduled;function rescheduleContact(_0x281129){return cmHopper[_0x0a9e('0xe')](_0x281129)[_0x0a9e('0x6')](function(_0x52a03d){logger[_0x0a9e('0xa')]('[rescheduleContact]',inspectError(_0x52a03d));});}exports[_0x0a9e('0xe')]=rescheduleContact;function unlockContact(_0x519dfd,_0x16033c,_0x12066b){return cmHopper['unlockContact'](_0x519dfd,_0x16033c,_0x12066b)[_0x0a9e('0x6')](function(_0x5a0a06){logger[_0x0a9e('0xa')](_0x0a9e('0xf'),inspectError(_0x5a0a06));});}exports[_0x0a9e('0x10')]=unlockContact;function moveContactManagedDialer(_0x205fd6){return cmHopper[_0x0a9e('0x11')](_0x205fd6)[_0x0a9e('0x6')](function(_0x530eb7){logger[_0x0a9e('0xa')](_0x0a9e('0x12'),inspectError(_0x530eb7));});}exports[_0x0a9e('0x11')]=moveContactManagedDialer;function checkIsBlackList(_0x1c696a){return cmHopperBlack[_0x0a9e('0x13')](_0x1c696a)['catch'](function(_0x2c3407){logger[_0x0a9e('0xa')]('[checkIsBlackList]',inspectError(_0x2c3407));});}exports[_0x0a9e('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x5a09ef){return cmHopperBlack['checkIsBlackListIvr'](_0x5a09ef)[_0x0a9e('0x6')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x14'),inspectError(_0x432e56));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return cmHopperAdditionalPhone[_0x0a9e('0x15')](_0xfb6e48,_0x2fb0e4,_0x3b45bc)[_0x0a9e('0x6')](function(_0x42ac8f){logger[_0x0a9e('0xa')]('[verifyAdditionalPhone]',inspectError(_0x42ac8f));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x197ec0,_0x3a8e58,_0x40c424){return cmHopperAdditionalPhone[_0x0a9e('0x16')](_0x197ec0,_0x3a8e58,_0x40c424)['catch'](function(_0x384319){logger['error'](_0x0a9e('0x17'),inspectError(_0x384319));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x1dc186){return cmHopperHistory[_0x0a9e('0x18')](_0x1dc186)[_0x0a9e('0x6')](function(_0x14433c){logger[_0x0a9e('0xa')](_0x0a9e('0x19'),inspectError(_0x14433c));});}exports[_0x0a9e('0x18')]=avgHandleTime;function createHistory(_0x14de77){return cmHopperHistory['createHistory'](_0x14de77)[_0x0a9e('0x6')](function(_0x468813){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),inspectError(_0x468813));});}exports['createHistory']=createHistory; \ No newline at end of file +var _0xb10b=['[createHistory]','util','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialer','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory'];(function(_0x468033,_0x13fdf8){var _0x7151f9=function(_0x2c9d05){while(--_0x2c9d05){_0x468033['push'](_0x468033['shift']());}};_0x7151f9(++_0x13fdf8);}(_0xb10b,0x12a));var _0xbb10=function(_0x4214da,_0x586705){_0x4214da=_0x4214da-0x0;var _0x64da0=_0xb10b[_0x4214da];return _0x64da0;};'use strict';var util=require(_0xbb10('0x0'));var logger=require('../../../../config/logger')(_0xbb10('0x1'));var cmHopper=require(_0xbb10('0x2'));var cmHopperAdditionalPhone=require(_0xbb10('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0xbb10('0x4'));function inspectError(_0x9bbed){return util[_0xbb10('0x5')](_0x9bbed,{'showHidden':![],'depth':null});}function getContactDialer(_0x22320e,_0x49baf4,_0x312b72){return cmHopper['getContactDialer'](_0x22320e['id'],_0x49baf4,_0x312b72,_0x22320e[_0xbb10('0x6')])[_0xbb10('0x7')](function(_0x513741){_0x22320e[_0xbb10('0x8')]-=_0x312b72;if(_0x22320e[_0xbb10('0x8')]<0x0){_0x22320e[_0xbb10('0x8')]=0x0;}logger[_0xbb10('0x9')](_0xbb10('0xa'),inspectError(_0x513741));});}exports[_0xbb10('0xb')]=getContactDialer;function getContactDialerIvr(_0x229887,_0xa3adc8){return cmHopper['getContactDialerIvr'](_0x229887['id'],_0xa3adc8,_0x229887['dialOrderByScheduledAt'])[_0xbb10('0x7')](function(_0x118a74){_0x229887[_0xbb10('0x8')]-=_0xa3adc8;if(_0x229887['temp']<0x0){_0x229887[_0xbb10('0x8')]=0x0;}logger['error'](_0xbb10('0xc'),inspectError(_0x118a74));});}exports[_0xbb10('0xd')]=getContactDialerIvr;function countReScheduled(_0x285009){return cmHopper[_0xbb10('0xe')](_0x285009)[_0xbb10('0x7')](function(_0x147230){logger['error'](_0xbb10('0xf'),inspectError(_0x147230));});}exports[_0xbb10('0xe')]=countReScheduled;function rescheduleContact(_0x45b9d6){return cmHopper[_0xbb10('0x10')](_0x45b9d6)[_0xbb10('0x7')](function(_0x2f2ebf){logger[_0xbb10('0x9')](_0xbb10('0x11'),inspectError(_0x2f2ebf));});}exports[_0xbb10('0x10')]=rescheduleContact;function unlockContact(_0x2b184e,_0x4a2bfc,_0x2eca0f){return cmHopper[_0xbb10('0x12')](_0x2b184e,_0x4a2bfc,_0x2eca0f)[_0xbb10('0x7')](function(_0x42db98){logger[_0xbb10('0x9')](_0xbb10('0x13'),inspectError(_0x42db98));});}exports[_0xbb10('0x12')]=unlockContact;function moveContactManagedDialer(_0x30efc6){return cmHopper[_0xbb10('0x14')](_0x30efc6)[_0xbb10('0x7')](function(_0x48b6e9){logger[_0xbb10('0x9')](_0xbb10('0x15'),inspectError(_0x48b6e9));});}exports[_0xbb10('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x109908){return cmHopperBlack[_0xbb10('0x16')](_0x109908)[_0xbb10('0x7')](function(_0x4deb49){logger[_0xbb10('0x9')](_0xbb10('0x17'),inspectError(_0x4deb49));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x4c4b0d){return cmHopperBlack[_0xbb10('0x18')](_0x4c4b0d)[_0xbb10('0x7')](function(_0x2e911d){logger[_0xbb10('0x9')](_0xbb10('0x19'),inspectError(_0x2e911d));});}exports[_0xbb10('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x407cb4,_0x436104,_0x7f2377){return cmHopperAdditionalPhone[_0xbb10('0x1a')](_0x407cb4,_0x436104,_0x7f2377)[_0xbb10('0x7')](function(_0x26ad93){logger['error']('[verifyAdditionalPhone]',inspectError(_0x26ad93));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xc93a04,_0x3c5ae7,_0x2c89b9){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0xc93a04,_0x3c5ae7,_0x2c89b9)[_0xbb10('0x7')](function(_0x24d586){logger[_0xbb10('0x9')](_0xbb10('0x1b'),inspectError(_0x24d586));});}exports[_0xbb10('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x20d946){return cmHopperHistory[_0xbb10('0x1d')](_0x20d946)['catch'](function(_0x3796c7){logger[_0xbb10('0x9')](_0xbb10('0x1e'),inspectError(_0x3796c7));});}exports[_0xbb10('0x1d')]=avgHandleTime;function createHistory(_0x1d30aa){return cmHopperHistory[_0xbb10('0x1f')](_0x1d30aa)['catch'](function(_0x221624){logger['error'](_0xbb10('0x20'),inspectError(_0x221624));});}exports['createHistory']=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index eb23a73..2ba3774 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 _0xcbd9=['timezones','ACTIVE','RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','milliseconds','diff','seconds','getSeconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','Trunk','name','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','originated','getQueueCampaignActiveStatusMessage','match','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactLowerLimitOriginate','lodash','util','../../../../config/logger','dialer','../../../../config/environment/shared'];(function(_0x40fe6b,_0x15d928){var _0x143aa8=function(_0x40a032){while(--_0x40a032){_0x40fe6b['push'](_0x40fe6b['shift']());}};_0x143aa8(++_0x15d928);}(_0xcbd9,0x143));var _0x9cbd=function(_0x4ff2aa,_0x2c7634){_0x4ff2aa=_0x4ff2aa-0x0;var _0x57ccf3=_0xcbd9[_0x4ff2aa];return _0x57ccf3;};'use strict';var _=require(_0x9cbd('0x0'));var moment=require('moment');var util=require(_0x9cbd('0x1'));var logger=require(_0x9cbd('0x2'))(_0x9cbd('0x3'));var timezones=require(_0x9cbd('0x4'))[_0x9cbd('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x9cbd('0x6'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x9cbd('0x7'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x9cbd('0x8'),'EMPTY_INTERVAL':_0x9cbd('0x9'),'INACTIVE':_0x9cbd('0xa'),'NO_AGENTS_LOGGED':_0x9cbd('0xb'),'NO_AVAILABLE_CONTACTS':_0x9cbd('0xc'),'NULL_INTERVAL':_0x9cbd('0xd'),'OVERTIME_INTERVAL':_0x9cbd('0xe'),'OVERTIME_GLOBAL_INTERVAL':_0x9cbd('0xf'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0x9cbd('0x10'),'RUNNING':_0x9cbd('0x11'),'UNKNOWN_TIMEZONE':_0x9cbd('0x12'),'UNREACHABLE_TRUNK':_0x9cbd('0x13')};exports[_0x9cbd('0x14')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x2d56ad){return _0x2d56ad['dialMethod']===_0x9cbd('0x15');}exports[_0x9cbd('0x16')]=isPreviewCampaign;function isIVRCampaign(_0x309723){return _0x309723[_0x9cbd('0x17')]===_0x9cbd('0x18');}exports[_0x9cbd('0x19')]=isIVRCampaign;function isOutboundQueue(_0x94454e){return _0x94454e[_0x9cbd('0x17')]===_0x9cbd('0x1a');}exports[_0x9cbd('0x1b')]=isOutboundQueue;function isQueueCampaignActive(_0x52fb04){return _0x52fb04[_0x9cbd('0x1c')];}exports[_0x9cbd('0x1d')]=isQueueCampaignActive;function isIVRCampaignActive(_0x45e165){return _0x45e165[_0x9cbd('0x1e')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x4ffd70,_0x25defc){var _0x11bdfa=moment(_0x4ffd70)[_0x9cbd('0x1f')](0x0);var _0x396199=moment(_0x25defc)['milliseconds'](0x0);return _0x11bdfa[_0x9cbd('0x20')](_0x396199,_0x9cbd('0x21'));}exports[_0x9cbd('0x22')]=getSeconds;function hasQueueCampaignDataChanged(_0xfb0372,_0x380d74){var _0x2e0074=![];var _0x1992dd=_0xfb0372[_0x9cbd('0x23')]!==_0x380d74['dialMethod']||_0xfb0372[_0x9cbd('0x1c')]!==_0x380d74[_0x9cbd('0x1c')]||_0xfb0372[_0x9cbd('0x24')]!==_0x380d74['message'];var _0x545473=_0xfb0372[_0x9cbd('0x25')]!==_0x380d74['available']||_0xfb0372[_0x9cbd('0x26')]!==_0x380d74[_0x9cbd('0x26')]||_0xfb0372[_0x9cbd('0x27')]!==_0x380d74['loggedInDb']||_0xfb0372[_0x9cbd('0x28')]!==_0x380d74[_0x9cbd('0x28')]||_0xfb0372[_0x9cbd('0x29')]!==_0x380d74[_0x9cbd('0x29')]||_0xfb0372['pTalking']!==_0x380d74[_0x9cbd('0x2a')]||_0xfb0372[_0x9cbd('0x2b')]!==_0x380d74[_0x9cbd('0x2b')]||_0xfb0372[_0x9cbd('0x2c')]!==_0x380d74['inUse']||_0xfb0372['originated']!==_0x380d74['originated'];if(_0xfb0372[_0x9cbd('0x2d')]&&_0x380d74[_0x9cbd('0x2d')]){_0x2e0074=_0xfb0372[_0x9cbd('0x2d')][_0x9cbd('0x2e')]!==_0x380d74[_0x9cbd('0x2d')]['name']||_0xfb0372['Trunk'][_0x9cbd('0x1e')]!==_0x380d74[_0x9cbd('0x2d')][_0x9cbd('0x1e')];}return _0x1992dd||_0x545473||_0x2e0074;}exports[_0x9cbd('0x2f')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x4eafb8){var _0x157082=null;var _0x34ff3f=_0x4eafb8['dialTimezone'];if(_[_0x9cbd('0x30')](_0x4eafb8[_0x9cbd('0x31')])||_[_0x9cbd('0x30')](_0x4eafb8[_0x9cbd('0x32')])||_[_0x9cbd('0x30')](_0x4eafb8[_0x9cbd('0x32')][_0x9cbd('0x33')])){_0x157082=CAMPAIGN_STATUS[_0x9cbd('0x34')];}else if(_[_0x9cbd('0x35')](_0x4eafb8[_0x9cbd('0x31')])||_['isEmpty'](_0x4eafb8[_0x9cbd('0x32')][_0x9cbd('0x33')])){_0x157082=CAMPAIGN_STATUS[_0x9cbd('0x36')];}else if(_0x34ff3f&&!timezones[_0x34ff3f]){_0x157082=CAMPAIGN_STATUS[_0x9cbd('0x37')];}return _0x157082;}function checkAnyValidTrunk(_0x5e29e2,_0x359d74){var _0x3dbf84=null;var _0x3b1695=_0x9cbd('0x38');var _0x188229=[_0x9cbd('0x39'),_0x9cbd('0x3a')];var _0x1156b6=!![];if(_0x5e29e2[_0x9cbd('0x2d')]&&_0x5e29e2[_0x9cbd('0x2d')]['active']){_0x3b1695+=_0x5e29e2['Trunk'][_0x9cbd('0x2e')];_0x3dbf84=_0x359d74[_0x3b1695];_0x1156b6=_0x188229[_0x9cbd('0x3b')](_0x3dbf84[_0x9cbd('0x3c')]);}else if(_0x5e29e2[_0x9cbd('0x3d')]&&_0x5e29e2[_0x9cbd('0x3d')]['active']){_0x3b1695+=_0x5e29e2[_0x9cbd('0x3d')][_0x9cbd('0x2e')];_0x3dbf84=_0x359d74[_0x3b1695];_0x1156b6=_0x188229[_0x9cbd('0x3b')](_0x3dbf84['status']);}return _0x1156b6;}function getQueueCampaignStatusMessage(_0x3917d4,_0x545491){var _0x520333=CAMPAIGN_STATUS[_0x9cbd('0x6')];var _0x3f7ab1=isPreviewCampaign(_0x3917d4);if(!isQueueCampaignActive(_0x3917d4)){if(_0x3f7ab1){_0x520333=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x3917d4['originated']===0x0&&_0x3917d4['talking']===0x0&&_0x3917d4['waiting']===0x0&&(_0x3917d4[_0x9cbd('0x2a')]||0x0)===0x0){_0x520333=CAMPAIGN_STATUS[_0x9cbd('0x3e')];}else{_0x520333=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x3917d4[_0x9cbd('0x26')]===0x0){_0x520333=CAMPAIGN_STATUS[_0x9cbd('0x3f')];}else if(!checkAnyValidTrunk(_0x3917d4,_0x545491)){_0x520333=CAMPAIGN_STATUS[_0x9cbd('0x40')];}else if(!isPreviewCampaign(_0x3917d4)){var _0x54ae71=checkAnyValidQueueCampaignInterval(_0x3917d4);if(_0x54ae71){_0x520333=_0x54ae71;}}return _0x520333;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x2568f4){var _0x2ae7ff=CAMPAIGN_STATUS['DISACTIVED'];if(_0x2568f4[_0x9cbd('0x41')]===0x0&&_0x2568f4[_0x9cbd('0x29')]===0x0&&_0x2568f4[_0x9cbd('0x2b')]===0x0&&(_0x2568f4[_0x9cbd('0x2a')]||0x0)===0x0){_0x2ae7ff=CAMPAIGN_STATUS[_0x9cbd('0x3e')];}return _0x2ae7ff;}exports[_0x9cbd('0x42')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0xaf690a){var _0xdae7a3=_0xaf690a[_0x9cbd('0x43')](/"(.*?)"/);return _0xdae7a3?_0xdae7a3[0x1]:_0xaf690a;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x38e8d8,_0x342760,_0x1e88d1){if(!_[_0x9cbd('0x44')](_0x1e88d1)&&typeof _0x1e88d1===_0x9cbd('0x45')&&!_['isEmpty'](_0x1e88d1)){if(!_['isUndefined'](_0x342760)&&typeof _0x342760===_0x9cbd('0x45')&&!_[_0x9cbd('0x35')](_0x342760)){return util[_0x9cbd('0x46')](_0x9cbd('0x47'),_0x342760,_0x1e88d1);}return util[_0x9cbd('0x46')]('\x22%s\x22\x20<%s>',_0x1e88d1,_0x1e88d1);}if(!_['isUndefined'](_0x38e8d8)&&typeof _0x38e8d8===_0x9cbd('0x45')&&!_[_0x9cbd('0x35')](_0x38e8d8)){return _0x38e8d8;}return _0x9cbd('0x48');}exports[_0x9cbd('0x49')]=getCallerId;function getCallerIdRandom(_0x7a49d1,_0xf2e136){var _0x1a39a4;var _0x53d44f;var _0x2b1aaa;if(_0xf2e136<=0x0){_0xf2e136=0x1;}_0x1a39a4=new RegExp(_0x9cbd('0x4a')+_0xf2e136+'}$');_0x53d44f=Math[_0x9cbd('0x4b')](0xa,_0xf2e136-0x1);_0x2b1aaa=Math['pow'](0xa,_0xf2e136)-0x1;return util[_0x9cbd('0x46')]('%s',_['replace'](_0x7a49d1,_0x1a39a4,_['random'](_0x53d44f,_0x2b1aaa)['toString']()));}exports[_0x9cbd('0x4c')]=getCallerIdRandom;function decrementOriginate(_0xf140e5){if(_0xf140e5[_0x9cbd('0x41')]&&_0xf140e5[_0x9cbd('0x41')]>0x0){_0xf140e5[_0x9cbd('0x41')]-=0x1;}else{logger[_0x9cbd('0x4d')](_0x9cbd('0x4e'));}}exports[_0x9cbd('0x4f')]=decrementOriginate;function checkContactEmpty(_0x265be1){return _0x265be1&&_0x265be1[_0x9cbd('0x50')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x54403a,_0x2be1c9){if(_0x2be1c9===0x0){return 0x0;}var _0x3698b5=0x1;for(var _0x54e55f=0x1;_0x54e55f<=_0x2be1c9;_0x54e55f+=0x1){_0x3698b5=0x1+_0x3698b5*_0x54e55f/_0x54403a;}return 0x1/_0x3698b5;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x45f16d,_0x1acfe2,_0x887095){if(_0x1acfe2>_0x887095){for(var _0x3c07f4=0x0;_0x3c07f4<_0x1acfe2-_0x887095;_0x3c07f4+=0x1){decrementOriginate(_0x45f16d);}}}exports[_0x9cbd('0x51')]=checkContactLowerLimitOriginate; \ No newline at end of file +var _0xe237=['dialActive','active','isIVRCampaignActive','milliseconds','diff','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Interval','Intervals','isEmpty','EMPTY_INTERVAL','unmonitored','TrunkBackup','status','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','lodash','util','dialer','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','ivr','isIVRCampaign','type','outbound','isOutboundQueue'];(function(_0x1af26f,_0x2d9fe0){var _0x584374=function(_0x303d34){while(--_0x303d34){_0x1af26f['push'](_0x1af26f['shift']());}};_0x584374(++_0x2d9fe0);}(_0xe237,0x1a2));var _0x7e23=function(_0x247126,_0x5e6a3a){_0x247126=_0x247126-0x0;var _0x485479=_0xe237[_0x247126];return _0x485479;};'use strict';var _=require(_0x7e23('0x0'));var moment=require('moment');var util=require(_0x7e23('0x1'));var logger=require('../../../../config/logger')(_0x7e23('0x2'));var timezones=require('../../../../config/environment/shared')['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0x7e23('0x3'),'BLACKLIST':_0x7e23('0x4'),'CONTACTS_RESCHEDULED':_0x7e23('0x5'),'DEACTIVATED':_0x7e23('0x6'),'DISACTIVED':_0x7e23('0x7'),'EMPTY_INTERVAL':_0x7e23('0x8'),'INACTIVE':_0x7e23('0x9'),'NO_AGENTS_LOGGED':_0x7e23('0xa'),'NO_AVAILABLE_CONTACTS':_0x7e23('0xb'),'NULL_INTERVAL':_0x7e23('0xc'),'OVERTIME_INTERVAL':_0x7e23('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0x7e23('0xe'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0x7e23('0xf'),'RUNNING':_0x7e23('0x10'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x7e23('0x11')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x47c526){return _0x47c526[_0x7e23('0x12')]===_0x7e23('0x13');}exports[_0x7e23('0x14')]=isPreviewCampaign;function isIVRCampaign(_0x43c169){return _0x43c169['type']===_0x7e23('0x15');}exports[_0x7e23('0x16')]=isIVRCampaign;function isOutboundQueue(_0x3aa8d6){return _0x3aa8d6[_0x7e23('0x17')]===_0x7e23('0x18');}exports[_0x7e23('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0x541099){return _0x541099[_0x7e23('0x1a')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x400f57){return _0x400f57[_0x7e23('0x1b')];}exports[_0x7e23('0x1c')]=isIVRCampaignActive;function getSeconds(_0x23f57e,_0x11cb93){var _0x222fe6=moment(_0x23f57e)[_0x7e23('0x1d')](0x0);var _0x56b792=moment(_0x11cb93)[_0x7e23('0x1d')](0x0);return _0x222fe6[_0x7e23('0x1e')](_0x56b792,'seconds');}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x4da0d4,_0x1d463b){var _0x417ec=![];var _0x24f4fc=_0x4da0d4[_0x7e23('0x12')]!==_0x1d463b[_0x7e23('0x12')]||_0x4da0d4[_0x7e23('0x1a')]!==_0x1d463b[_0x7e23('0x1a')]||_0x4da0d4[_0x7e23('0x1f')]!==_0x1d463b[_0x7e23('0x1f')];var _0x27bc04=_0x4da0d4[_0x7e23('0x20')]!==_0x1d463b[_0x7e23('0x20')]||_0x4da0d4['loggedIn']!==_0x1d463b[_0x7e23('0x21')]||_0x4da0d4['loggedInDb']!==_0x1d463b[_0x7e23('0x22')]||_0x4da0d4[_0x7e23('0x23')]!==_0x1d463b[_0x7e23('0x23')]||_0x4da0d4[_0x7e23('0x24')]!==_0x1d463b[_0x7e23('0x24')]||_0x4da0d4[_0x7e23('0x25')]!==_0x1d463b[_0x7e23('0x25')]||_0x4da0d4[_0x7e23('0x26')]!==_0x1d463b[_0x7e23('0x26')]||_0x4da0d4['inUse']!==_0x1d463b[_0x7e23('0x27')]||_0x4da0d4[_0x7e23('0x28')]!==_0x1d463b['originated'];if(_0x4da0d4[_0x7e23('0x29')]&&_0x1d463b[_0x7e23('0x29')]){_0x417ec=_0x4da0d4[_0x7e23('0x29')][_0x7e23('0x2a')]!==_0x1d463b[_0x7e23('0x29')]['name']||_0x4da0d4[_0x7e23('0x29')][_0x7e23('0x1b')]!==_0x1d463b['Trunk'][_0x7e23('0x1b')];}return _0x24f4fc||_0x27bc04||_0x417ec;}exports[_0x7e23('0x2b')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x18b19e){var _0x4f3d01=null;var _0x1e774c=_0x18b19e['dialTimezone'];if(_[_0x7e23('0x2c')](_0x18b19e[_0x7e23('0x2d')])||_[_0x7e23('0x2c')](_0x18b19e[_0x7e23('0x2e')])||_['isNil'](_0x18b19e[_0x7e23('0x2e')][_0x7e23('0x2f')])){_0x4f3d01=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0x7e23('0x30')](_0x18b19e[_0x7e23('0x2d')])||_[_0x7e23('0x30')](_0x18b19e[_0x7e23('0x2e')][_0x7e23('0x2f')])){_0x4f3d01=CAMPAIGN_STATUS[_0x7e23('0x31')];}else if(_0x1e774c&&!timezones[_0x1e774c]){_0x4f3d01=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x4f3d01;}function checkAnyValidTrunk(_0x4349af,_0x35908d){var _0x10604c=null;var _0x4300c1='SIP/';var _0x17069c=['reachable',_0x7e23('0x32')];var _0x40ecbd=!![];if(_0x4349af[_0x7e23('0x29')]&&_0x4349af['Trunk']['active']){_0x4300c1+=_0x4349af['Trunk']['name'];_0x10604c=_0x35908d[_0x4300c1];_0x40ecbd=_0x17069c['includes'](_0x10604c['status']);}else if(_0x4349af['TrunkBackup']&&_0x4349af[_0x7e23('0x33')][_0x7e23('0x1b')]){_0x4300c1+=_0x4349af[_0x7e23('0x33')][_0x7e23('0x2a')];_0x10604c=_0x35908d[_0x4300c1];_0x40ecbd=_0x17069c['includes'](_0x10604c[_0x7e23('0x34')]);}return _0x40ecbd;}function getQueueCampaignStatusMessage(_0x50c391,_0x379ed6){var _0x2d46ea=CAMPAIGN_STATUS[_0x7e23('0x3')];var _0x3ef1dd=isPreviewCampaign(_0x50c391);if(!isQueueCampaignActive(_0x50c391)){if(_0x3ef1dd){_0x2d46ea=CAMPAIGN_STATUS[_0x7e23('0x35')];}else{if(_0x50c391[_0x7e23('0x28')]===0x0&&_0x50c391[_0x7e23('0x24')]===0x0&&_0x50c391['waiting']===0x0&&(_0x50c391['pTalking']||0x0)===0x0){_0x2d46ea=CAMPAIGN_STATUS[_0x7e23('0x35')];}else{_0x2d46ea=CAMPAIGN_STATUS[_0x7e23('0x36')];}}}else if(_0x50c391[_0x7e23('0x21')]===0x0){_0x2d46ea=CAMPAIGN_STATUS[_0x7e23('0x37')];}else if(!checkAnyValidTrunk(_0x50c391,_0x379ed6)){_0x2d46ea=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x50c391)){var _0xc7aaa5=checkAnyValidQueueCampaignInterval(_0x50c391);if(_0xc7aaa5){_0x2d46ea=_0xc7aaa5;}}return _0x2d46ea;}exports[_0x7e23('0x38')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x35562b){var _0x554c30=CAMPAIGN_STATUS[_0x7e23('0x36')];if(_0x35562b[_0x7e23('0x28')]===0x0&&_0x35562b[_0x7e23('0x24')]===0x0&&_0x35562b[_0x7e23('0x26')]===0x0&&(_0x35562b[_0x7e23('0x25')]||0x0)===0x0){_0x554c30=CAMPAIGN_STATUS[_0x7e23('0x35')];}return _0x554c30;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x147d16){var _0x49a4ec=_0x147d16['match'](/"(.*?)"/);return _0x49a4ec?_0x49a4ec[0x1]:_0x147d16;}exports[_0x7e23('0x39')]=extractCalleridName;function getCallerId(_0x39fc41,_0x2ac396,_0x3e91c0){if(!_[_0x7e23('0x3a')](_0x3e91c0)&&typeof _0x3e91c0===_0x7e23('0x3b')&&!_['isEmpty'](_0x3e91c0)){if(!_[_0x7e23('0x3a')](_0x2ac396)&&typeof _0x2ac396===_0x7e23('0x3b')&&!_['isEmpty'](_0x2ac396)){return util[_0x7e23('0x3c')](_0x7e23('0x3d'),_0x2ac396,_0x3e91c0);}return util[_0x7e23('0x3c')](_0x7e23('0x3d'),_0x3e91c0,_0x3e91c0);}if(!_['isUndefined'](_0x39fc41)&&typeof _0x39fc41==='string'&&!_['isEmpty'](_0x39fc41)){return _0x39fc41;}return'\x22\x22\x20<>';}exports[_0x7e23('0x3e')]=getCallerId;function getCallerIdRandom(_0x4c059c,_0x3a1ebf){var _0x535600;var _0x15a584;var _0x450e21;if(_0x3a1ebf<=0x0){_0x3a1ebf=0x1;}_0x535600=new RegExp(_0x7e23('0x3f')+_0x3a1ebf+'}$');_0x15a584=Math[_0x7e23('0x40')](0xa,_0x3a1ebf-0x1);_0x450e21=Math[_0x7e23('0x40')](0xa,_0x3a1ebf)-0x1;return util[_0x7e23('0x3c')]('%s',_[_0x7e23('0x41')](_0x4c059c,_0x535600,_[_0x7e23('0x42')](_0x15a584,_0x450e21)[_0x7e23('0x43')]()));}exports[_0x7e23('0x44')]=getCallerIdRandom;function decrementOriginate(_0x36e882){if(_0x36e882[_0x7e23('0x28')]&&_0x36e882[_0x7e23('0x28')]>0x0){_0x36e882['originated']-=0x1;}else{logger['error'](_0x7e23('0x45'));}}exports[_0x7e23('0x46')]=decrementOriginate;function checkContactEmpty(_0x2b5cfb){return _0x2b5cfb&&_0x2b5cfb['length']>0x0;}exports[_0x7e23('0x47')]=checkContactEmpty;function erlangb(_0x4fd234,_0x3c6bd2){if(_0x3c6bd2===0x0){return 0x0;}var _0x2a4ea2=0x1;for(var _0x280421=0x1;_0x280421<=_0x3c6bd2;_0x280421+=0x1){_0x2a4ea2=0x1+_0x2a4ea2*_0x280421/_0x4fd234;}return 0x1/_0x2a4ea2;}exports[_0x7e23('0x48')]=erlangb;function checkContactLowerLimitOriginate(_0x907f2b,_0x33d6ee,_0x6f533a){if(_0x33d6ee>_0x6f533a){for(var _0x30d50c=0x0;_0x30d50c<_0x33d6ee-_0x6f533a;_0x30d50c+=0x1){decrementOriginate(_0x907f2b);}}}exports[_0x7e23('0x49')]=checkContactLowerLimitOriginate; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 3e6305d..a64a7d1 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(_0x53f035,_0x27517f){var _0x434495=function(_0x14e804){while(--_0x14e804){_0x53f035['push'](_0x53f035['shift']());}};_0x434495(++_0x27517f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x29cb28,_0x28e555){var _0x4ea33b=function(_0xbec6dd){while(--_0xbec6dd){_0x29cb28['push'](_0x29cb28['shift']());}};_0x4ea33b(++_0x28e555);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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 6b9e4cd..3029e78 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 _0xb92d=['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','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','exports','util','lodash','bluebird','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','exten','uniqueid','channels','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','hasOwnProperty','operation','status','localstationid','remotestationid','pagestransferred','resolution','transferrate','filename','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','logger','updateStatus','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkTrunk'];(function(_0x5351d4,_0x9fad72){var _0x158dd6=function(_0x21c0b4){while(--_0x21c0b4){_0x5351d4['push'](_0x5351d4['shift']());}};_0x158dd6(++_0x9fad72);}(_0xb92d,0x17e));var _0xdb92=function(_0x1f7839,_0x2a26e6){_0x1f7839=_0x1f7839-0x0;var _0x36b42e=_0xb92d[_0x1f7839];return _0x36b42e;};'use strict';var util=require(_0xdb92('0x0'));var _=require(_0xdb92('0x1'));var BPromise=require(_0xdb92('0x2'));var uuid=require('uuid');var moment=require('moment');var path=require(_0xdb92('0x3'));var tiff2pdf=require(_0xdb92('0x4'));var gs=require('./util/gs');var logger=require(_0xdb92('0x5'))(_0xdb92('0x6'));var ami=require(_0xdb92('0x7'));var rpcDb=require(_0xdb92('0x8'));var Channel=require(_0xdb92('0x9'));var ut=require(_0xdb92('0xa'));var Action=require('./action');var faxAccount=require(_0xdb92('0xb'));var attachment=require(_0xdb92('0xc'));var faxMessage=require(_0xdb92('0xd'));function Fax(_0x2addf5){this['channels']={};this[_0xdb92('0xe')]=_0x2addf5[_0xdb92('0xe')];this['trunks']=_0x2addf5[_0xdb92('0xf')];this[_0xdb92('0x10')]={};ami['on'](_0xdb92('0x11'),this[_0xdb92('0x12')][_0xdb92('0x13')](this));ami['on'](_0xdb92('0x14'),this[_0xdb92('0x15')][_0xdb92('0x13')](this));ami['on'](_0xdb92('0x16'),this[_0xdb92('0x17')][_0xdb92('0x13')](this));ami['on'](_0xdb92('0x18'),this[_0xdb92('0x19')][_0xdb92('0x13')](this));ami['on'](_0xdb92('0x1a'),this[_0xdb92('0x1b')]['bind'](this));ami['on'](_0xdb92('0x1c'),this[_0xdb92('0x1d')][_0xdb92('0x13')](this));ami['on'](_0xdb92('0x1e'),this[_0xdb92('0x1f')]['bind'](this));ami['on'](_0xdb92('0x20'),this[_0xdb92('0x21')][_0xdb92('0x13')](this));}Fax[_0xdb92('0x22')][_0xdb92('0x12')]=function(_0x525367){if(_0x525367[_0xdb92('0x23')]===_0xdb92('0x24')){for(var _0x5335e7 in this['faxAccounts']){if(this[_0xdb92('0xe')]['hasOwnProperty'](_0x5335e7)){if(_0x525367[_0xdb92('0x25')]===this['faxAccounts'][_0x5335e7]['localstationid']){this['channels'][_0x525367[_0xdb92('0x26')]]={};this[_0xdb92('0x27')][_0x525367[_0xdb92('0x26')]][_0xdb92('0x28')]=_0x525367[_0xdb92('0x28')];this[_0xdb92('0x27')][_0x525367[_0xdb92('0x26')]]['id']=this[_0xdb92('0xe')][_0x5335e7]['id'];this['channels'][_0x525367[_0xdb92('0x26')]]['name']=this[_0xdb92('0xe')][_0x5335e7][_0xdb92('0x29')];logger[_0xdb92('0x2a')](_0x525367['uniqueid'],_0xdb92('0x2b'));}}}}if(this[_0xdb92('0x10')][_0x525367[_0xdb92('0x26')]]){this[_0xdb92('0x27')][_0x525367[_0xdb92('0x26')]]={};this['channels'][_0x525367[_0xdb92('0x26')]][_0xdb92('0x28')]=_0x525367[_0xdb92('0x28')];logger[_0xdb92('0x2a')](_0x525367['uniqueid'],_0xdb92('0x2b'));}};Fax[_0xdb92('0x22')][_0xdb92('0x15')]=function(_0x5ca0c1){if(this[_0xdb92('0x27')][_0x5ca0c1[_0xdb92('0x26')]]){for(var _0x5d4d65 in _0x5ca0c1[_0xdb92('0x2c')]){if(_0x5ca0c1[_0xdb92('0x2c')]['hasOwnProperty'](_0x5d4d65)){this[_0xdb92('0x27')][_0x5ca0c1[_0xdb92('0x26')]][_0x5d4d65]=_0x5ca0c1[_0xdb92('0x2d')];}}}};Fax[_0xdb92('0x22')][_0xdb92('0x17')]=function(_0x432f16){if(this[_0xdb92('0x27')][_0x432f16['uniqueid']]){this[_0xdb92('0x27')][_0x432f16[_0xdb92('0x26')]][_0xdb92('0x2e')]=_0x432f16['channelstate'];this[_0xdb92('0x27')][_0x432f16['uniqueid']]['channelstatedesc']=_0x432f16['channelstatedesc'];}};Fax['prototype']['syncNewExten']=function(_0x507ff8){if(this['channels'][_0x507ff8['uniqueid']]){for(var _0x4af786 in _0x507ff8['variable']){if(_0x507ff8[_0xdb92('0x2c')][_0xdb92('0x2f')](_0x4af786)){this['channels'][_0x507ff8[_0xdb92('0x26')]][_0x4af786]=_0x507ff8['value'];}}}};Fax[_0xdb92('0x22')][_0xdb92('0x1b')]=function(_0x371688){if(this[_0xdb92('0x27')][_0x371688['uniqueid']]){this[_0xdb92('0x27')][_0x371688[_0xdb92('0x26')]][_0xdb92('0x30')]=_0x371688[_0xdb92('0x30')];this['channels'][_0x371688[_0xdb92('0x26')]][_0xdb92('0x31')]=_0x371688[_0xdb92('0x31')];this[_0xdb92('0x27')][_0x371688[_0xdb92('0x26')]][_0xdb92('0x32')]=_0x371688[_0xdb92('0x32')];this[_0xdb92('0x27')][_0x371688[_0xdb92('0x26')]]['filename']=_0x371688['filename'];logger['info'](_0x371688[_0xdb92('0x26')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0xdb92('0x1d')]=function(_0x52ec1d){var _0x397ed9=this;if(this[_0xdb92('0x27')][_0x52ec1d[_0xdb92('0x26')]]){var _0x502d9f=this[_0xdb92('0x27')][_0x52ec1d[_0xdb92('0x26')]]['id'];this[_0xdb92('0x27')][_0x52ec1d[_0xdb92('0x26')]][_0xdb92('0x33')]=_0x52ec1d['remotestationid'];this[_0xdb92('0x27')][_0x52ec1d['uniqueid']][_0xdb92('0x34')]=_0x52ec1d['pagestransferred'];this[_0xdb92('0x27')][_0x52ec1d[_0xdb92('0x26')]]['localstationid']=_0x52ec1d[_0xdb92('0x32')];this[_0xdb92('0x27')][_0x52ec1d[_0xdb92('0x26')]]['resolution']=_0x52ec1d[_0xdb92('0x35')];this[_0xdb92('0x27')][_0x52ec1d[_0xdb92('0x26')]][_0xdb92('0x36')]=_0x52ec1d['transferrate'];this[_0xdb92('0x27')][_0x52ec1d[_0xdb92('0x26')]][_0xdb92('0x37')]=_0x52ec1d[_0xdb92('0x37')];this[_0xdb92('0x27')][_0x52ec1d[_0xdb92('0x26')]][_0xdb92('0x38')]=_0x52ec1d[_0xdb92('0x38')];if(this[_0xdb92('0x27')][_0x52ec1d[_0xdb92('0x26')]][_0xdb92('0x34')]>0x0){tiff2pdf(_0x52ec1d[_0xdb92('0x37')],_0xdb92('0x39'),function(_0x442d6e){logger[_0xdb92('0x2a')](_0x52ec1d['uniqueid'],_0xdb92('0x3a'),_0x442d6e[_0xdb92('0x3b')]);attachment[_0xdb92('0x3c')]({'name':path[_0xdb92('0x3d')](_0x52ec1d[_0xdb92('0x37')])[_0xdb92('0x29')],'basename':path['parse'](_0x52ec1d[_0xdb92('0x37')])[_0xdb92('0x29')]+_0xdb92('0x3e'),'type':_0xdb92('0x3f')})[_0xdb92('0x40')](function(_0x1212a1){faxAccount[_0xdb92('0x41')](_0x502d9f,{'from':_0x52ec1d[_0xdb92('0x38')],'mapKey':_0xdb92('0x6'),'body':path[_0xdb92('0x3d')](_0x52ec1d[_0xdb92('0x37')])[_0xdb92('0x29')]+_0xdb92('0x3e'),'AttachmentId':_0x1212a1['id']})[_0xdb92('0x42')](function(_0x3d2326){logger[_0xdb92('0x43')](_0x52ec1d[_0xdb92('0x26')],_0xdb92('0x44'),JSON[_0xdb92('0x45')](_0x3d2326));});})['catch'](function(_0x7106ee){logger[_0xdb92('0x43')](_0x52ec1d[_0xdb92('0x26')],'\x20receiveFax\x20',JSON[_0xdb92('0x45')](_0x7106ee));});});}logger[_0xdb92('0x2a')](_0x52ec1d[_0xdb92('0x26')],_0xdb92('0x46'));}};Fax['prototype'][_0xdb92('0x21')]=function(_0x26222b){if(this[_0xdb92('0x10')][_0x26222b[_0xdb92('0x26')]]){_[_0xdb92('0x47')](this[_0xdb92('0x27')][_0x26222b[_0xdb92('0x26')]],_[_0xdb92('0x48')](_0x26222b,[_0xdb92('0x49'),_0xdb92('0x4a')]));}};function updateStatus(_0x27f1f1){if(_0x27f1f1[_0xdb92('0x4b')]){faxMessage['update'](_0x27f1f1['AttachmentId'],{'failMessage':_0xdb92('0x4c')})[_0xdb92('0x40')](function(_0x41f428){ut['logger']('[Fax][Message][Error][Updated]',_0x41f428);})[_0xdb92('0x42')](function(_0x2ae96a){ut[_0xdb92('0x4d')]('[Fax][Message][Error][NoUpdate1]',_0x2ae96a);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xdb92('0x22')][_0xdb92('0x4e')]=function(_0x2e6517,_0xb6cffe,_0x1bfb5f){var _0x14cdb8=this;var _0x24b4d5={};if(_0xb6cffe){_0x24b4d5={'read':_0xb6cffe};}else{_0x24b4d5={'failMessage':_0x1bfb5f};}if(this[_0xdb92('0x10')][_0x2e6517][_0xdb92('0x4b')]){faxMessage['update'](this[_0xdb92('0x10')][_0x2e6517][_0xdb92('0x4b')],_0x24b4d5)['then'](function(_0x5126f1){ut[_0xdb92('0x4d')]('[Fax][Message][Updated]',_0x5126f1);})[_0xdb92('0x42')](function(_0x3db663){ut[_0xdb92('0x4d')](_0xdb92('0x4f'),_0x3db663);})[_0xdb92('0x50')](function(){delete _0x14cdb8[_0xdb92('0x27')][_0x2e6517];delete _0x14cdb8[_0xdb92('0x10')][_0x2e6517];});}else{ut[_0xdb92('0x4d')]('[Fax][Message][NoUpdate2]');delete this[_0xdb92('0x27')][_0x2e6517];delete this['actions'][_0x2e6517];}};Fax[_0xdb92('0x22')][_0xdb92('0x1f')]=function(_0x2a2e7c){var _0x46a50d=this;if(this[_0xdb92('0x27')][_0x2a2e7c['uniqueid']]){if(this[_0xdb92('0x10')][_0x2a2e7c['uniqueid']]){this[_0xdb92('0x27')][_0x2a2e7c[_0xdb92('0x26')]]['id']=this[_0xdb92('0x10')][_0x2a2e7c[_0xdb92('0x26')]]['id'];this[_0xdb92('0x27')][_0x2a2e7c[_0xdb92('0x26')]][_0xdb92('0x29')]=this[_0xdb92('0x10')][_0x2a2e7c['uniqueid']]['name'];}logger['info'](_0x2a2e7c[_0xdb92('0x26')],this[_0xdb92('0x10')][_0x2a2e7c['uniqueid']]?_0xdb92('0x51'):_0xdb92('0x52'),JSON[_0xdb92('0x45')](this[_0xdb92('0x27')][_0x2a2e7c[_0xdb92('0x26')]]));if(this['actions'][_0x2a2e7c[_0xdb92('0x26')]]){if(this[_0xdb92('0x27')][_0x2a2e7c['uniqueid']]['faxpages']>0x0&&this['channels'][_0x2a2e7c[_0xdb92('0x26')]][_0xdb92('0x1a')]===_0xdb92('0x53')){this[_0xdb92('0x4e')](_0x2a2e7c['uniqueid'],!![]);}else{this[_0xdb92('0x4e')](_0x2a2e7c['uniqueid'],![],this['channels'][_0x2a2e7c['uniqueid']][_0xdb92('0x54')]?_0xdb92('0x55')+this['channels'][_0x2a2e7c[_0xdb92('0x26')]][_0xdb92('0x54')]:_0xdb92('0x56'));}}}};Fax['prototype'][_0xdb92('0x57')]=function(_0x2335d9){var _0x29570c=this;return new BPromise(function(_0x4d4211,_0x50da38){_0x29570c[_0xdb92('0x58')](_0x2335d9,_0x29570c['faxAccounts'][_0x2335d9[_0xdb92('0x59')]])[_0xdb92('0x40')](function(_0x24d0cd){ut[_0xdb92('0x4d')](_0xdb92('0x5a'),_0x24d0cd);_0x4d4211(ut[_0xdb92('0x3b')](_0xdb92('0x5b')));})[_0xdb92('0x42')](function(_0x1f165b){ut[_0xdb92('0x4d')]('[Fax][execOriginate][failure]',_0x1f165b);updateStatus(_0x2335d9);_0x50da38(ut[_0xdb92('0x3b')](_0xdb92('0x5c')));});});};Fax[_0xdb92('0x22')]['checkAfterSend']=function(_0x33378f){var _0x4a5302=this;return new BPromise(function(_0x1a278f,_0x5ae412){var _0x526618=_0x4a5302[_0xdb92('0x5d')](_0x4a5302['faxAccounts'][_0x33378f['FaxAccountId']]['Trunk'],_0x33378f);if(_0x526618[_0xdb92('0x5e')]){_0x1a278f(ut['message'](_0xdb92('0x5f')));}else{_0x5ae412(ut[_0xdb92('0x3b')](_0x526618[_0xdb92('0x3b')]));}});};function originate(_0x489bc4,_0x55540c,_0x5c7af9){return new BPromise(function(_0x40bcfd,_0x482c34){if(_0x5c7af9){var _0x1721b6=util[_0xdb92('0x60')](_0xdb92('0x61'),path['parse'](_0x489bc4[_0xdb92('0x3')])[_0xdb92('0x29')],_0x489bc4[_0xdb92('0x3')]);gs[_0xdb92('0x62')](_0x1721b6)['then'](function(){_0x489bc4[_0xdb92('0x3')]=util[_0xdb92('0x60')](_0xdb92('0x63'),path[_0xdb92('0x3d')](_0x489bc4[_0xdb92('0x3')])['dir'],path[_0xdb92('0x3d')](_0x489bc4[_0xdb92('0x3')])[_0xdb92('0x29')]);_0x55540c[_0xdb92('0x64')]=_0x489bc4[_0xdb92('0x3')];ut[_0xdb92('0x4d')](_0xdb92('0x65'),'');ami['Action'](ut[_0xdb92('0x66')](_0x489bc4,_0x55540c))[_0xdb92('0x40')](function(_0x5c4638){_0x40bcfd(_0x5c4638);})[_0xdb92('0x42')](function(_0xf3dcc1){_0x482c34(_0xf3dcc1);});})[_0xdb92('0x42')](function(_0x39b672){_0x482c34(_0x39b672);});}else{ami[_0xdb92('0x67')](ut[_0xdb92('0x66')](_0x489bc4,_0x55540c))['then'](function(_0xb8e1f7){_0x40bcfd(_0xb8e1f7);})[_0xdb92('0x42')](function(_0x53233a){_0x482c34(_0x53233a);});}});}Fax['prototype'][_0xdb92('0x58')]=function(_0x33f260,_0x266d11){var _0x4cd893=this;return new BPromise(function(_0x113f1f,_0xa8b41c){var _0x2e5576=uuid['v4']();var _0x285172=ut[_0xdb92('0x68')](_0x33f260,_0x266d11);_0x4cd893[_0xdb92('0x10')][_0x2e5576]=new Action(_0x2e5576,_0x266d11,_0x33f260);var _0x29f50c=_0x4cd893[_0xdb92('0x10')][_0x2e5576];if(path[_0xdb92('0x3d')](_0x33f260['path'])[_0xdb92('0x69')]==='.pdf'){originate(_0x29f50c,_0x285172,!![])['then'](function(_0x4d4d17){_0x113f1f(_0x4d4d17);})[_0xdb92('0x42')](function(_0x3a32d9){_0xa8b41c(_0x3a32d9);});}else{originate(_0x29f50c,_0x285172,![])[_0xdb92('0x40')](function(_0xe5e3b2){_0x113f1f(_0xe5e3b2);})[_0xdb92('0x42')](function(_0x1b5d00){_0xa8b41c(_0x1b5d00);});}});};Fax['prototype'][_0xdb92('0x6a')]=function(_0x48357a){return!_[_0xdb92('0x6b')](_0x48357a)&&!_[_0xdb92('0x6b')](_0x48357a['name'])&&!_['isNil'](_0x48357a[_0xdb92('0x6c')])&&_0x48357a[_0xdb92('0x6c')]&&!_[_0xdb92('0x6b')](this['trunks'][util['format']('SIP/%s',_0x48357a[_0xdb92('0x29')])])&&!_['isNil'](this[_0xdb92('0xf')][util[_0xdb92('0x60')](_0xdb92('0x6d'),_0x48357a[_0xdb92('0x29')])][_0xdb92('0x31')])&&(this[_0xdb92('0xf')][util[_0xdb92('0x60')](_0xdb92('0x6d'),_0x48357a[_0xdb92('0x29')])][_0xdb92('0x31')]===_0xdb92('0x6e')||this[_0xdb92('0xf')][util['format'](_0xdb92('0x6d'),_0x48357a[_0xdb92('0x29')])][_0xdb92('0x31')]===_0xdb92('0x6f'));};Fax['prototype'][_0xdb92('0x5d')]=function(_0x2f36c7,_0x5152e8){if(!this['isTrunkReachable'](_0x2f36c7)){ut['logger'](_0xdb92('0x70'),_['isNil'](_0x2f36c7)?'':_0x2f36c7[_0xdb92('0x29')]+_0xdb92('0x71'));return{'isValid':![],'message':_0xdb92('0x72')};}if(_[_0xdb92('0x6b')](_0x5152e8[_0xdb92('0x6')])){ut['logger'](_0xdb92('0x73'),JSON['stringify'](_0x5152e8));return{'isValid':![],'message':_0xdb92('0x74')};}if(_[_0xdb92('0x6b')](_0x5152e8['path'])){ut['logger'](_0xdb92('0x75'),JSON[_0xdb92('0x45')](_0x5152e8));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xdb92('0x76')]=Fax; \ No newline at end of file +var _0xc741=['FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','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','path','execute','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isNil','active','SIP/%s','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','uuid','moment','tiff2pdf','../../../config/logger','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','bind','syncVarSet','newstate','syncNewState','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','prototype','syncNewchannel','context','hasOwnProperty','localstationid','uniqueid','channel','name','info','actions','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','filename','calleridnum','/var/opt/motion2/server/files/attachments/','message','parse','.pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send'];(function(_0x4b8f4a,_0x30d9f6){var _0x3d84db=function(_0x231607){while(--_0x231607){_0x4b8f4a['push'](_0x4b8f4a['shift']());}};_0x3d84db(++_0x30d9f6);}(_0xc741,0x99));var _0x1c74=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc741[_0x36c5b0];return _0xf19333;};'use strict';var util=require('util');var _=require(_0x1c74('0x0'));var BPromise=require(_0x1c74('0x1'));var uuid=require(_0x1c74('0x2'));var moment=require(_0x1c74('0x3'));var path=require('path');var tiff2pdf=require(_0x1c74('0x4'));var gs=require('./util/gs');var logger=require(_0x1c74('0x5'))('fax');var ami=require(_0x1c74('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0x1c74('0x7'));var ut=require(_0x1c74('0x8'));var Action=require(_0x1c74('0x9'));var faxAccount=require(_0x1c74('0xa'));var attachment=require(_0x1c74('0xb'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x2b7755){this[_0x1c74('0xc')]={};this[_0x1c74('0xd')]=_0x2b7755['faxAccounts'];this[_0x1c74('0xe')]=_0x2b7755['trunks'];this['actions']={};ami['on']('newchannel',this['syncNewchannel'][_0x1c74('0xf')](this));ami['on']('varset',this[_0x1c74('0x10')][_0x1c74('0xf')](this));ami['on'](_0x1c74('0x11'),this[_0x1c74('0x12')][_0x1c74('0xf')](this));ami['on']('newexten',this[_0x1c74('0x13')]['bind'](this));ami['on'](_0x1c74('0x14'),this['syncFaxStatus'][_0x1c74('0xf')](this));ami['on'](_0x1c74('0x15'),this[_0x1c74('0x16')][_0x1c74('0xf')](this));ami['on'](_0x1c74('0x17'),this[_0x1c74('0x18')][_0x1c74('0xf')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x1c74('0xf')](this));}Fax[_0x1c74('0x19')][_0x1c74('0x1a')]=function(_0x593586){if(_0x593586[_0x1c74('0x1b')]==='from-voip-provider'){for(var _0x9ee805 in this[_0x1c74('0xd')]){if(this['faxAccounts'][_0x1c74('0x1c')](_0x9ee805)){if(_0x593586['exten']===this[_0x1c74('0xd')][_0x9ee805][_0x1c74('0x1d')]){this[_0x1c74('0xc')][_0x593586[_0x1c74('0x1e')]]={};this[_0x1c74('0xc')][_0x593586[_0x1c74('0x1e')]][_0x1c74('0x1f')]=_0x593586['channel'];this[_0x1c74('0xc')][_0x593586[_0x1c74('0x1e')]]['id']=this[_0x1c74('0xd')][_0x9ee805]['id'];this[_0x1c74('0xc')][_0x593586[_0x1c74('0x1e')]][_0x1c74('0x20')]=this[_0x1c74('0xd')][_0x9ee805][_0x1c74('0x20')];logger[_0x1c74('0x21')](_0x593586[_0x1c74('0x1e')],'\x20syncNewchannel\x20');}}}}if(this[_0x1c74('0x22')][_0x593586[_0x1c74('0x1e')]]){this['channels'][_0x593586[_0x1c74('0x1e')]]={};this[_0x1c74('0xc')][_0x593586[_0x1c74('0x1e')]][_0x1c74('0x1f')]=_0x593586[_0x1c74('0x1f')];logger[_0x1c74('0x21')](_0x593586[_0x1c74('0x1e')],_0x1c74('0x23'));}};Fax['prototype'][_0x1c74('0x10')]=function(_0x2694a6){if(this['channels'][_0x2694a6['uniqueid']]){for(var _0x25aa67 in _0x2694a6[_0x1c74('0x24')]){if(_0x2694a6['variable'][_0x1c74('0x1c')](_0x25aa67)){this[_0x1c74('0xc')][_0x2694a6[_0x1c74('0x1e')]][_0x25aa67]=_0x2694a6[_0x1c74('0x25')];}}}};Fax[_0x1c74('0x19')][_0x1c74('0x12')]=function(_0x464a8f){if(this['channels'][_0x464a8f[_0x1c74('0x1e')]]){this['channels'][_0x464a8f[_0x1c74('0x1e')]][_0x1c74('0x26')]=_0x464a8f[_0x1c74('0x26')];this[_0x1c74('0xc')][_0x464a8f[_0x1c74('0x1e')]]['channelstatedesc']=_0x464a8f[_0x1c74('0x27')];}};Fax[_0x1c74('0x19')][_0x1c74('0x13')]=function(_0x6559d0){if(this[_0x1c74('0xc')][_0x6559d0[_0x1c74('0x1e')]]){for(var _0x447a71 in _0x6559d0[_0x1c74('0x24')]){if(_0x6559d0['variable']['hasOwnProperty'](_0x447a71)){this[_0x1c74('0xc')][_0x6559d0['uniqueid']][_0x447a71]=_0x6559d0[_0x1c74('0x25')];}}}};Fax[_0x1c74('0x19')][_0x1c74('0x28')]=function(_0x145392){if(this[_0x1c74('0xc')][_0x145392[_0x1c74('0x1e')]]){this['channels'][_0x145392[_0x1c74('0x1e')]][_0x1c74('0x29')]=_0x145392[_0x1c74('0x29')];this[_0x1c74('0xc')][_0x145392['uniqueid']][_0x1c74('0x2a')]=_0x145392['status'];this[_0x1c74('0xc')][_0x145392[_0x1c74('0x1e')]][_0x1c74('0x1d')]=_0x145392[_0x1c74('0x1d')];this[_0x1c74('0xc')][_0x145392[_0x1c74('0x1e')]]['filename']=_0x145392['filename'];logger[_0x1c74('0x21')](_0x145392['uniqueid'],_0x1c74('0x2b'));}};Fax['prototype'][_0x1c74('0x16')]=function(_0x1bc71d){var _0x1b745e=this;if(this[_0x1c74('0xc')][_0x1bc71d['uniqueid']]){var _0x1cd106=this[_0x1c74('0xc')][_0x1bc71d[_0x1c74('0x1e')]]['id'];this[_0x1c74('0xc')][_0x1bc71d[_0x1c74('0x1e')]][_0x1c74('0x2c')]=_0x1bc71d['remotestationid'];this[_0x1c74('0xc')][_0x1bc71d['uniqueid']][_0x1c74('0x2d')]=_0x1bc71d[_0x1c74('0x2d')];this[_0x1c74('0xc')][_0x1bc71d[_0x1c74('0x1e')]][_0x1c74('0x1d')]=_0x1bc71d[_0x1c74('0x1d')];this[_0x1c74('0xc')][_0x1bc71d[_0x1c74('0x1e')]]['resolution']=_0x1bc71d[_0x1c74('0x2e')];this['channels'][_0x1bc71d['uniqueid']][_0x1c74('0x2f')]=_0x1bc71d[_0x1c74('0x2f')];this[_0x1c74('0xc')][_0x1bc71d[_0x1c74('0x1e')]][_0x1c74('0x30')]=_0x1bc71d['filename'];this[_0x1c74('0xc')][_0x1bc71d['uniqueid']][_0x1c74('0x31')]=_0x1bc71d['calleridnum'];if(this[_0x1c74('0xc')][_0x1bc71d[_0x1c74('0x1e')]][_0x1c74('0x2d')]>0x0){tiff2pdf(_0x1bc71d['filename'],_0x1c74('0x32'),function(_0x3f8c29){logger[_0x1c74('0x21')](_0x1bc71d[_0x1c74('0x1e')],'\x20result\x20conversion\x20file\x20',_0x3f8c29[_0x1c74('0x33')]);attachment['create']({'name':path[_0x1c74('0x34')](_0x1bc71d[_0x1c74('0x30')])['name'],'basename':path[_0x1c74('0x34')](_0x1bc71d[_0x1c74('0x30')])['name']+_0x1c74('0x35'),'type':'application/pdf'})[_0x1c74('0x36')](function(_0x1feae0){faxAccount[_0x1c74('0x37')](_0x1cd106,{'from':_0x1bc71d[_0x1c74('0x31')],'mapKey':'fax','body':path['parse'](_0x1bc71d[_0x1c74('0x30')])[_0x1c74('0x20')]+'.pdf','AttachmentId':_0x1feae0['id']})[_0x1c74('0x38')](function(_0x1beed0){logger[_0x1c74('0x39')](_0x1bc71d[_0x1c74('0x1e')],_0x1c74('0x3a'),JSON[_0x1c74('0x3b')](_0x1beed0));});})[_0x1c74('0x38')](function(_0x629532){logger[_0x1c74('0x39')](_0x1bc71d['uniqueid'],_0x1c74('0x3c'),JSON[_0x1c74('0x3b')](_0x629532));});});}logger[_0x1c74('0x21')](_0x1bc71d[_0x1c74('0x1e')],_0x1c74('0x3c'));}};Fax[_0x1c74('0x19')]['syncOriginateResponse']=function(_0x48eff4){if(this[_0x1c74('0x22')][_0x48eff4[_0x1c74('0x1e')]]){_[_0x1c74('0x3d')](this[_0x1c74('0xc')][_0x48eff4[_0x1c74('0x1e')]],_[_0x1c74('0x3e')](_0x48eff4,['response',_0x1c74('0x3f')]));}};function updateStatus(_0x586776){if(_0x586776[_0x1c74('0x40')]){faxMessage[_0x1c74('0x41')](_0x586776[_0x1c74('0x40')],{'failMessage':_0x1c74('0x42')})[_0x1c74('0x36')](function(_0x3f8190){ut[_0x1c74('0x43')](_0x1c74('0x44'),_0x3f8190);})[_0x1c74('0x38')](function(_0x2c12fe){ut[_0x1c74('0x43')](_0x1c74('0x45'),_0x2c12fe);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype'][_0x1c74('0x46')]=function(_0x24178a,_0x426f86,_0x20b423){var _0x210755=this;var _0x3a06b9={};if(_0x426f86){_0x3a06b9={'read':_0x426f86};}else{_0x3a06b9={'failMessage':_0x20b423};}if(this[_0x1c74('0x22')][_0x24178a]['AttachmentId']){faxMessage[_0x1c74('0x41')](this[_0x1c74('0x22')][_0x24178a][_0x1c74('0x40')],_0x3a06b9)[_0x1c74('0x36')](function(_0x550565){ut[_0x1c74('0x43')](_0x1c74('0x47'),_0x550565);})[_0x1c74('0x38')](function(_0x33b14e){ut[_0x1c74('0x43')]('[Fax][Message][NoUpdate1]',_0x33b14e);})[_0x1c74('0x48')](function(){delete _0x210755['channels'][_0x24178a];delete _0x210755[_0x1c74('0x22')][_0x24178a];});}else{ut['logger'](_0x1c74('0x49'));delete this[_0x1c74('0xc')][_0x24178a];delete this['actions'][_0x24178a];}};Fax[_0x1c74('0x19')]['syncHangup']=function(_0x42cbe4){var _0xed721=this;if(this['channels'][_0x42cbe4[_0x1c74('0x1e')]]){if(this[_0x1c74('0x22')][_0x42cbe4[_0x1c74('0x1e')]]){this[_0x1c74('0xc')][_0x42cbe4[_0x1c74('0x1e')]]['id']=this['actions'][_0x42cbe4[_0x1c74('0x1e')]]['id'];this[_0x1c74('0xc')][_0x42cbe4[_0x1c74('0x1e')]][_0x1c74('0x20')]=this[_0x1c74('0x22')][_0x42cbe4[_0x1c74('0x1e')]][_0x1c74('0x20')];}logger[_0x1c74('0x21')](_0x42cbe4[_0x1c74('0x1e')],this[_0x1c74('0x22')][_0x42cbe4['uniqueid']]?_0x1c74('0x4a'):_0x1c74('0x4b'),JSON[_0x1c74('0x3b')](this[_0x1c74('0xc')][_0x42cbe4[_0x1c74('0x1e')]]));if(this['actions'][_0x42cbe4[_0x1c74('0x1e')]]){if(this[_0x1c74('0xc')][_0x42cbe4[_0x1c74('0x1e')]][_0x1c74('0x4c')]>0x0&&this[_0x1c74('0xc')][_0x42cbe4['uniqueid']][_0x1c74('0x14')]===_0x1c74('0x4d')){this[_0x1c74('0x46')](_0x42cbe4[_0x1c74('0x1e')],!![]);}else{this[_0x1c74('0x46')](_0x42cbe4['uniqueid'],![],this[_0x1c74('0xc')][_0x42cbe4['uniqueid']][_0x1c74('0x4e')]?_0x1c74('0x4f')+this[_0x1c74('0xc')][_0x42cbe4[_0x1c74('0x1e')]][_0x1c74('0x4e')]:'SENDING\x20FAILED');}}}};Fax[_0x1c74('0x19')][_0x1c74('0x50')]=function(_0x49c045){var _0xcf8007=this;return new BPromise(function(_0xb44389,_0x51a758){_0xcf8007['execOriginate'](_0x49c045,_0xcf8007[_0x1c74('0xd')][_0x49c045[_0x1c74('0x51')]])[_0x1c74('0x36')](function(_0x1ff375){ut['logger'](_0x1c74('0x52'),_0x1ff375);_0xb44389(ut['message'](_0x1c74('0x53')));})[_0x1c74('0x38')](function(_0x1ecf30){ut[_0x1c74('0x43')](_0x1c74('0x54'),_0x1ecf30);updateStatus(_0x49c045);_0x51a758(ut[_0x1c74('0x33')](_0x1c74('0x55')));});});};Fax[_0x1c74('0x19')][_0x1c74('0x56')]=function(_0x6d10ea){var _0x5327a3=this;return new BPromise(function(_0x34d579,_0x3ae483){var _0x2d83e6=_0x5327a3[_0x1c74('0x57')](_0x5327a3['faxAccounts'][_0x6d10ea['FaxAccountId']][_0x1c74('0x58')],_0x6d10ea);if(_0x2d83e6[_0x1c74('0x59')]){_0x34d579(ut[_0x1c74('0x33')](_0x1c74('0x5a')));}else{_0x3ae483(ut[_0x1c74('0x33')](_0x2d83e6[_0x1c74('0x33')]));}});};function originate(_0x1ae88e,_0x57935e,_0x284886){return new BPromise(function(_0x2fab95,_0xc5eb57){if(_0x284886){var _0x3d2c82=util['format'](_0x1c74('0x5b'),path[_0x1c74('0x34')](_0x1ae88e['path'])[_0x1c74('0x20')],_0x1ae88e[_0x1c74('0x5c')]);gs[_0x1c74('0x5d')](_0x3d2c82)[_0x1c74('0x36')](function(){_0x1ae88e[_0x1c74('0x5c')]=util[_0x1c74('0x5e')](_0x1c74('0x5f'),path['parse'](_0x1ae88e[_0x1c74('0x5c')])[_0x1c74('0x60')],path[_0x1c74('0x34')](_0x1ae88e[_0x1c74('0x5c')])[_0x1c74('0x20')]);_0x57935e[_0x1c74('0x61')]=_0x1ae88e['path'];ut[_0x1c74('0x43')](_0x1c74('0x62'),'');ami[_0x1c74('0x63')](ut[_0x1c74('0x64')](_0x1ae88e,_0x57935e))[_0x1c74('0x36')](function(_0x35883d){_0x2fab95(_0x35883d);})[_0x1c74('0x38')](function(_0x5ac5b1){_0xc5eb57(_0x5ac5b1);});})[_0x1c74('0x38')](function(_0x55b86b){_0xc5eb57(_0x55b86b);});}else{ami[_0x1c74('0x63')](ut['variablesAction'](_0x1ae88e,_0x57935e))[_0x1c74('0x36')](function(_0x28d51f){_0x2fab95(_0x28d51f);})['catch'](function(_0x2c6ded){_0xc5eb57(_0x2c6ded);});}});}Fax[_0x1c74('0x19')][_0x1c74('0x65')]=function(_0x5b128a,_0x30996f){var _0x4b95f1=this;return new BPromise(function(_0x47740b,_0x187848){var _0xfa0e3e=uuid['v4']();var _0x481f26=ut[_0x1c74('0x66')](_0x5b128a,_0x30996f);_0x4b95f1[_0x1c74('0x22')][_0xfa0e3e]=new Action(_0xfa0e3e,_0x30996f,_0x5b128a);var _0x52e1e1=_0x4b95f1[_0x1c74('0x22')][_0xfa0e3e];if(path['parse'](_0x5b128a['path'])[_0x1c74('0x67')]===_0x1c74('0x35')){originate(_0x52e1e1,_0x481f26,!![])['then'](function(_0x309c89){_0x47740b(_0x309c89);})[_0x1c74('0x38')](function(_0xd28941){_0x187848(_0xd28941);});}else{originate(_0x52e1e1,_0x481f26,![])[_0x1c74('0x36')](function(_0x1f85be){_0x47740b(_0x1f85be);})[_0x1c74('0x38')](function(_0x139130){_0x187848(_0x139130);});}});};Fax[_0x1c74('0x19')]['isTrunkReachable']=function(_0x2dfa7e){return!_[_0x1c74('0x68')](_0x2dfa7e)&&!_[_0x1c74('0x68')](_0x2dfa7e[_0x1c74('0x20')])&&!_[_0x1c74('0x68')](_0x2dfa7e[_0x1c74('0x69')])&&_0x2dfa7e[_0x1c74('0x69')]&&!_[_0x1c74('0x68')](this[_0x1c74('0xe')][util['format']('SIP/%s',_0x2dfa7e[_0x1c74('0x20')])])&&!_[_0x1c74('0x68')](this['trunks'][util[_0x1c74('0x5e')](_0x1c74('0x6a'),_0x2dfa7e[_0x1c74('0x20')])]['status'])&&(this['trunks'][util[_0x1c74('0x5e')](_0x1c74('0x6a'),_0x2dfa7e[_0x1c74('0x20')])][_0x1c74('0x2a')]==='reachable'||this['trunks'][util['format'](_0x1c74('0x6a'),_0x2dfa7e[_0x1c74('0x20')])][_0x1c74('0x2a')]==='unmonitored');};Fax[_0x1c74('0x19')]['checkTrunk']=function(_0x4cf019,_0x451742){if(!this[_0x1c74('0x6b')](_0x4cf019)){ut[_0x1c74('0x43')](_0x1c74('0x6c'),_[_0x1c74('0x68')](_0x4cf019)?'':_0x4cf019[_0x1c74('0x20')]+_0x1c74('0x6d'));return{'isValid':![],'message':_0x1c74('0x6e')};}if(_[_0x1c74('0x68')](_0x451742['fax'])){ut[_0x1c74('0x43')](_0x1c74('0x6f'),JSON[_0x1c74('0x3b')](_0x451742));return{'isValid':![],'message':_0x1c74('0x70')};}if(_[_0x1c74('0x68')](_0x451742[_0x1c74('0x5c')])){ut[_0x1c74('0x43')](_0x1c74('0x71'),JSON[_0x1c74('0x3b')](_0x451742));return{'isValid':![],'message':_0x1c74('0x72')};}return{'isValid':!![],'message':_0x1c74('0x73')};};module[_0x1c74('0x74')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 1d490e1..5714f5e 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 _0x8611=['error','inspect','notify','then','catch','[Notify]\x20','util','bluebird','preview','../rpc/faxAccount'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x8611,0x7e));var _0x1861=function(_0x26ade0,_0x54ecba){_0x26ade0=_0x26ade0-0x0;var _0x50a266=_0x8611[_0x26ade0];return _0x50a266;};'use strict';var util=require(_0x1861('0x0'));var BPromise=require(_0x1861('0x1'));var logger=require('../../../config/logger')(_0x1861('0x2'));var _=require('lodash');var faxAccount=require(_0x1861('0x3'));function loggerCatch(_0x13ff72){return function(_0x21a05b){logger[_0x1861('0x4')](_0x13ff72,util[_0x1861('0x5')](_0x21a05b,{'showHidden':![],'depth':null}));};}exports[_0x1861('0x6')]=function(_0x1a3c45,_0x96d150){return BPromise['resolve']()[_0x1861('0x7')](faxAccount[_0x1861('0x6')](_0x1a3c45,_0x96d150))[_0x1861('0x8')](loggerCatch(_0x1861('0x9')));}; \ No newline at end of file +var _0xbcf5=['notify','resolve','then','catch','[Notify]\x20','util','../../../config/logger','error'];(function(_0x2a0dc9,_0x3802f4){var _0x198be1=function(_0x154add){while(--_0x154add){_0x2a0dc9['push'](_0x2a0dc9['shift']());}};_0x198be1(++_0x3802f4);}(_0xbcf5,0x8d));var _0x5bcf=function(_0x90ca5e,_0x180f9c){_0x90ca5e=_0x90ca5e-0x0;var _0x52c9b5=_0xbcf5[_0x90ca5e];return _0x52c9b5;};'use strict';var util=require(_0x5bcf('0x0'));var BPromise=require('bluebird');var logger=require(_0x5bcf('0x1'))('preview');var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x5e7ed4){return function(_0x2a4eda){logger[_0x5bcf('0x2')](_0x5e7ed4,util['inspect'](_0x2a4eda,{'showHidden':![],'depth':null}));};}exports[_0x5bcf('0x3')]=function(_0x431d40,_0x2ed892){return BPromise[_0x5bcf('0x4')]()[_0x5bcf('0x5')](faxAccount[_0x5bcf('0x3')](_0x431d40,_0x2ed892))[_0x5bcf('0x6')](loggerCatch(_0x5bcf('0x7')));}; \ 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 967433e..7bc5ea3 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 _0xf393=['child_process','execute','info','Exec\x20gs','inspect','util','bluebird'];(function(_0x4ff7d1,_0x3331d1){var _0x16e063=function(_0x18c921){while(--_0x18c921){_0x4ff7d1['push'](_0x4ff7d1['shift']());}};_0x16e063(++_0x3331d1);}(_0xf393,0xb4));var _0x3f39=function(_0x13ae1e,_0x229e96){_0x13ae1e=_0x13ae1e-0x0;var _0x2bdab6=_0xf393[_0x13ae1e];return _0x2bdab6;};'use strict';var util=require(_0x3f39('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0x3f39('0x1'));var exec=require(_0x3f39('0x2'))['exec'];exports[_0x3f39('0x3')]=function(_0x459a97){return new BPromise(function(_0x120df8,_0x5b215b){exec(_0x459a97,function(_0x3cc7df,_0x4cf557,_0x10d966){logger[_0x3f39('0x4')](_0x3f39('0x5'),_0x4cf557);if(_0x3cc7df){logger[_0x3f39('0x4')](_0x3f39('0x5'),'\x20Error\x20:',util[_0x3f39('0x6')](_0x3cc7df,{'showHidden':![],'depth':null}),_0x4cf557,_0x10d966);_0x5b215b(_0x3cc7df);}_0x120df8(_0x4cf557);});});}; \ No newline at end of file +var _0xf4e6=['execute','info','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec'];(function(_0x4db243,_0x364131){var _0x18a45e=function(_0x2b8a68){while(--_0x2b8a68){_0x4db243['push'](_0x4db243['shift']());}};_0x18a45e(++_0x364131);}(_0xf4e6,0x130));var _0x6f4e=function(_0x13187a,_0x2fcec4){_0x13187a=_0x13187a-0x0;var _0x65b85f=_0xf4e6[_0x13187a];return _0x65b85f;};'use strict';var util=require(_0x6f4e('0x0'));var logger=require(_0x6f4e('0x1'))(_0x6f4e('0x2'));var BPromise=require(_0x6f4e('0x3'));var exec=require(_0x6f4e('0x4'))[_0x6f4e('0x5')];exports[_0x6f4e('0x6')]=function(_0x5c0bf9){return new BPromise(function(_0x1878a5,_0xdc9340){exec(_0x5c0bf9,function(_0x36ddc0,_0x41d075,_0x599ebe){logger[_0x6f4e('0x7')]('Exec\x20gs',_0x41d075);if(_0x36ddc0){logger[_0x6f4e('0x7')]('Exec\x20gs',_0x6f4e('0x8'),util[_0x6f4e('0x9')](_0x36ddc0,{'showHidden':![],'depth':null}),_0x41d075,_0x599ebe);_0xdc9340(_0x36ddc0);}_0x1878a5(_0x41d075);});});}; \ 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 2f9e6f3..8aa0147 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 _0xcc59=['fax','message','logger','inspect','ecm','headerinfo','minrate','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','variablesAction','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','uniqueid','util','lodash','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc59,0xba));var _0x9cc5=function(_0x4eb6ec,_0x7f2520){_0x4eb6ec=_0x4eb6ec-0x0;var _0x58881b=_0xcc59[_0x4eb6ec];return _0x58881b;};'use strict';var util=require(_0x9cc5('0x0'));var _=require(_0x9cc5('0x1'));var moment=require(_0x9cc5('0x2'));var logger=require('../../../../config/logger')(_0x9cc5('0x3'));exports[_0x9cc5('0x4')]=function(_0xaa9dcd){return{'message':_0xaa9dcd};};exports[_0x9cc5('0x5')]=function(_0xdf45dd,_0x44fae8){logger['info'](_0xdf45dd,util[_0x9cc5('0x6')](_0x44fae8,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x392968,_0x2119df){var _0x16c368={'XMF-ECM':_0x2119df[_0x9cc5('0x7')],'XMF-HEADERINFO':_0x2119df[_0x9cc5('0x8')],'XMF-MINRATE':_0x2119df[_0x9cc5('0x9')],'XMF-MAXRATE':_0x2119df['maxrate'],'XMF-MODEM':util['format'](_0x9cc5('0xa'),_0x2119df['modem']),'XMF-GATEWAY':_0x2119df[_0x9cc5('0xb')],'XMF-FAXDETECT':_0x2119df[_0x9cc5('0xc')],'XMF-T38TIMEOUT':_0x2119df[_0x9cc5('0xd')],'XMF-LOCALSTATIONID':_0x2119df[_0x9cc5('0xe')],'XMF-PATH':_0x392968['path']};return _0x16c368;};exports[_0x9cc5('0xf')]=function(_0x4fb40f,_0x146fdd){return{'actionid':_0x4fb40f['uniqueid'],'action':'originate','channel':_0x4fb40f['channel'],'Exten':_0x9cc5('0x10'),'Context':_0x9cc5('0x11'),'Priority':'1','callerid':util[_0x9cc5('0x12')](_0x9cc5('0x13'),_0x4fb40f[_0x9cc5('0x8')]?_0x4fb40f['headerinfo']:'',_0x4fb40f[_0x9cc5('0xe')]),'variable':_0x146fdd,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4fb40f[_0x9cc5('0x14')]};}; \ No newline at end of file +var _0x25ad=['headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','t38timeout','path','uniqueid','originate','channel','xcally-motion-fax','from-sip','localstationid','util','moment','../../../../config/logger','fax','logger','info','inspect'];(function(_0x12d6c2,_0x409bc8){var _0x1c9825=function(_0x569f66){while(--_0x569f66){_0x12d6c2['push'](_0x12d6c2['shift']());}};_0x1c9825(++_0x409bc8);}(_0x25ad,0x1b1));var _0xd25a=function(_0x3d0c0a,_0x569519){_0x3d0c0a=_0x3d0c0a-0x0;var _0x338e0e=_0x25ad[_0x3d0c0a];return _0x338e0e;};'use strict';var util=require(_0xd25a('0x0'));var _=require('lodash');var moment=require(_0xd25a('0x1'));var logger=require(_0xd25a('0x2'))(_0xd25a('0x3'));exports['message']=function(_0x26b892){return{'message':_0x26b892};};exports[_0xd25a('0x4')]=function(_0x1532c5,_0x6a6a0d){logger[_0xd25a('0x5')](_0x1532c5,util[_0xd25a('0x6')](_0x6a6a0d,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x4ca0db,_0x3694c6){var _0x330817={'XMF-ECM':_0x3694c6['ecm'],'XMF-HEADERINFO':_0x3694c6[_0xd25a('0x7')],'XMF-MINRATE':_0x3694c6[_0xd25a('0x8')],'XMF-MAXRATE':_0x3694c6[_0xd25a('0x9')],'XMF-MODEM':util[_0xd25a('0xa')](_0xd25a('0xb'),_0x3694c6[_0xd25a('0xc')]),'XMF-GATEWAY':_0x3694c6[_0xd25a('0xd')],'XMF-FAXDETECT':_0x3694c6['faxdetect'],'XMF-T38TIMEOUT':_0x3694c6[_0xd25a('0xe')],'XMF-LOCALSTATIONID':_0x3694c6['localstationid'],'XMF-PATH':_0x4ca0db[_0xd25a('0xf')]};return _0x330817;};exports['variablesAction']=function(_0x54b88c,_0x5a9a8e){return{'actionid':_0x54b88c[_0xd25a('0x10')],'action':_0xd25a('0x11'),'channel':_0x54b88c[_0xd25a('0x12')],'Exten':_0xd25a('0x13'),'Context':_0xd25a('0x14'),'Priority':'1','callerid':util[_0xd25a('0xa')]('\x22%s\x22\x20<%s>',_0x54b88c[_0xd25a('0x7')]?_0x54b88c[_0xd25a('0x7')]:'',_0x54b88c[_0xd25a('0x15')]),'variable':_0x5a9a8e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x54b88c['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 4cac672..447a18d 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 _0xbf01=['./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','resolve','then','initAgents','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initSalesforceAccounts','getSugarcrmAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','inspect','sync','catch','util','moment','./realtime','./acw','./dialer','./fax','./rpc/user','./rpc/voiceQueue'];(function(_0x47e309,_0x1e771a){var _0x2e1900=function(_0x407297){while(--_0x407297){_0x47e309['push'](_0x47e309['shift']());}};_0x2e1900(++_0x1e771a);}(_0xbf01,0x6a));var _0x1bf0=function(_0x338f73,_0x1945c8){_0x338f73=_0x338f73-0x0;var _0x163fdf=_0xbf01[_0x338f73];return _0x163fdf;};'use strict';var util=require(_0x1bf0('0x0'));var moment=require(_0x1bf0('0x1'));var server=require('./server');var Realtime=require(_0x1bf0('0x2'));var Report=require('./report');var Acw=require(_0x1bf0('0x3'));var Trigger=require('./trigger');var Dialer=require(_0x1bf0('0x4'));var Preview=require('./preview');var Fax=require(_0x1bf0('0x5'));var user=require(_0x1bf0('0x6'));var voiceQueue=require(_0x1bf0('0x7'));var voiceQueueReport=require(_0x1bf0('0x8'));var voiceCallReport=require(_0x1bf0('0x9'));var trunk=require(_0x1bf0('0xa'));var trigger=require(_0x1bf0('0xb'));var template=require(_0x1bf0('0xc'));var cmHopperHistory=require(_0x1bf0('0xd'));var campaign=require(_0x1bf0('0xe'));var voiceExtension=require(_0x1bf0('0xf'));var faxAccount=require(_0x1bf0('0x10'));var zendesk=require(_0x1bf0('0x11'));var salesforce=require(_0x1bf0('0x12'));var sugarcrm=require(_0x1bf0('0x13'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x1bf0('0x14'));var zoho=require(_0x1bf0('0x15'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x1bf0('0x16'));var servicenow=require(_0x1bf0('0x17'));var dynamics365=require(_0x1bf0('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x1bf0('0x19')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x1bf0('0x1a')]()[_0x1bf0('0x1b')](user['getAgents']())[_0x1bf0('0x1b')](realtime[_0x1bf0('0x1c')]())[_0x1bf0('0x1b')](user['getTelephones']())[_0x1bf0('0x1b')](realtime[_0x1bf0('0x1d')]())[_0x1bf0('0x1b')](trunk['getTrunks']())[_0x1bf0('0x1b')](realtime[_0x1bf0('0x1e')]())['then'](voiceQueue[_0x1bf0('0x1f')]())[_0x1bf0('0x1b')](realtime[_0x1bf0('0x20')]())[_0x1bf0('0x1b')](trigger[_0x1bf0('0x21')]())[_0x1bf0('0x1b')](realtime['initTriggers']())[_0x1bf0('0x1b')](template['getTemplates']())[_0x1bf0('0x1b')](realtime['initTemplates']())['then'](zendesk['getZendeskAccounts']())['then'](realtime['initZendeskAccounts']())[_0x1bf0('0x1b')](salesforce['getSalesforceAccounts']())[_0x1bf0('0x1b')](realtime[_0x1bf0('0x22')]())[_0x1bf0('0x1b')](sugarcrm[_0x1bf0('0x23')]())[_0x1bf0('0x1b')](realtime['initSugarcrmAccounts']())[_0x1bf0('0x1b')](freshdesk['getFreshdeskAccounts']())['then'](realtime['initFreshdeskAccounts']())[_0x1bf0('0x1b')](desk[_0x1bf0('0x24')]())[_0x1bf0('0x1b')](realtime['initDeskAccounts']())[_0x1bf0('0x1b')](zoho[_0x1bf0('0x25')]())[_0x1bf0('0x1b')](realtime[_0x1bf0('0x26')]())[_0x1bf0('0x1b')](vtiger['getVtigerAccounts']())[_0x1bf0('0x1b')](realtime['initVtigerAccounts']())[_0x1bf0('0x1b')](freshsales['getFreshsalesAccounts']())[_0x1bf0('0x1b')](realtime[_0x1bf0('0x27')]())[_0x1bf0('0x1b')](servicenow[_0x1bf0('0x28')]())[_0x1bf0('0x1b')](realtime[_0x1bf0('0x29')]())[_0x1bf0('0x1b')](dynamics365[_0x1bf0('0x2a')]())[_0x1bf0('0x1b')](realtime['initDynamics365Accounts']())['then'](campaign[_0x1bf0('0x2b')]())[_0x1bf0('0x1b')](realtime['initCampaigns']())[_0x1bf0('0x1b')](voiceExtension['getVoiceExtensions']())['then'](realtime['initVoiceExtensions']())['then'](faxAccount['getFaxAccounts']())['then'](realtime[_0x1bf0('0x2c')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0x1bf0('0x1a')]()[_0x1bf0('0x1b')](voiceQueueReport[_0x1bf0('0x2d')]())[_0x1bf0('0x1b')](realtime[_0x1bf0('0x2e')]())[_0x1bf0('0x1b')](cmHopperHistory[_0x1bf0('0x2f')]())[_0x1bf0('0x1b')](realtime['initVoiceQueueHopperHistory']())[_0x1bf0('0x1b')](cmHopperHistory[_0x1bf0('0x30')]())[_0x1bf0('0x1b')](realtime[_0x1bf0('0x31')]())[_0x1bf0('0x1b')](voiceCallReport[_0x1bf0('0x32')]())['then'](realtime[_0x1bf0('0x33')]())['catch'](function(_0x3fd4c4){logger[_0x1bf0('0x34')](_0x1bf0('0x35'),util[_0x1bf0('0x36')](_0x3fd4c4,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x1bf0('0x1b')](function(){return initRealtime();})[_0x1bf0('0x1b')](function(){return initParams();})['then'](function(){report[_0x1bf0('0x37')]();setInterval(initRealtime,0x1388);})[_0x1bf0('0x38')](function(_0x54d4cf){logger[_0x1bf0('0x34')]('[index.js][main]',util['inspect'](_0x54d4cf,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x0551=['getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','listen','sync','[index.js][main]','inspect','util','moment','./server','./realtime','./acw','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','ami','get','hour','then','getAgents','initTelephones','getTrunks','initVoiceQueues','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions'];(function(_0x962814,_0x14e92e){var _0x2b404d=function(_0x459c97){while(--_0x459c97){_0x962814['push'](_0x962814['shift']());}};_0x2b404d(++_0x14e92e);}(_0x0551,0x15a));var _0x1055=function(_0x3ab0ac,_0x1ea9cf){_0x3ab0ac=_0x3ab0ac-0x0;var _0x1f743d=_0x0551[_0x3ab0ac];return _0x1f743d;};'use strict';var util=require(_0x1055('0x0'));var moment=require(_0x1055('0x1'));var server=require(_0x1055('0x2'));var Realtime=require(_0x1055('0x3'));var Report=require('./report');var Acw=require(_0x1055('0x4'));var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require(_0x1055('0x5'));var Fax=require(_0x1055('0x6'));var user=require('./rpc/user');var voiceQueue=require(_0x1055('0x7'));var voiceQueueReport=require(_0x1055('0x8'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x1055('0x9'));var trigger=require(_0x1055('0xa'));var template=require(_0x1055('0xb'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0x1055('0xc'));var faxAccount=require(_0x1055('0xd'));var zendesk=require(_0x1055('0xe'));var salesforce=require(_0x1055('0xf'));var sugarcrm=require(_0x1055('0x10'));var freshdesk=require(_0x1055('0x11'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x1055('0x12'));var freshsales=require(_0x1055('0x13'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x1055('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('../../config/logger')(_0x1055('0x15'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x1055('0x16')](_0x1055('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x1055('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x1055('0x18')](user[_0x1055('0x19')]())[_0x1055('0x18')](realtime['initAgents']())[_0x1055('0x18')](user['getTelephones']())[_0x1055('0x18')](realtime[_0x1055('0x1a')]())[_0x1055('0x18')](trunk[_0x1055('0x1b')]())[_0x1055('0x18')](realtime['initTrunks']())['then'](voiceQueue['getVoiceQueues']())[_0x1055('0x18')](realtime[_0x1055('0x1c')]())['then'](trigger['getTriggers']())[_0x1055('0x18')](realtime['initTriggers']())[_0x1055('0x18')](template[_0x1055('0x1d')]())[_0x1055('0x18')](realtime['initTemplates']())['then'](zendesk[_0x1055('0x1e')]())['then'](realtime[_0x1055('0x1f')]())[_0x1055('0x18')](salesforce[_0x1055('0x20')]())[_0x1055('0x18')](realtime[_0x1055('0x21')]())[_0x1055('0x18')](sugarcrm[_0x1055('0x22')]())[_0x1055('0x18')](realtime['initSugarcrmAccounts']())[_0x1055('0x18')](freshdesk['getFreshdeskAccounts']())[_0x1055('0x18')](realtime[_0x1055('0x23')]())[_0x1055('0x18')](desk['getDeskAccounts']())[_0x1055('0x18')](realtime[_0x1055('0x24')]())[_0x1055('0x18')](zoho[_0x1055('0x25')]())['then'](realtime[_0x1055('0x26')]())[_0x1055('0x18')](vtiger[_0x1055('0x27')]())[_0x1055('0x18')](realtime[_0x1055('0x28')]())[_0x1055('0x18')](freshsales[_0x1055('0x29')]())[_0x1055('0x18')](realtime[_0x1055('0x2a')]())[_0x1055('0x18')](servicenow[_0x1055('0x2b')]())[_0x1055('0x18')](realtime[_0x1055('0x2c')]())['then'](dynamics365[_0x1055('0x2d')]())[_0x1055('0x18')](realtime['initDynamics365Accounts']())['then'](campaign[_0x1055('0x2e')]())[_0x1055('0x18')](realtime[_0x1055('0x2f')]())[_0x1055('0x18')](voiceExtension[_0x1055('0x30')]())[_0x1055('0x18')](realtime[_0x1055('0x31')]())[_0x1055('0x18')](faxAccount[_0x1055('0x32')]())[_0x1055('0x18')](realtime[_0x1055('0x33')]())[_0x1055('0x18')](function(){return realtime;});}function initParams(){return Promise[_0x1055('0x34')]()[_0x1055('0x18')](voiceQueueReport[_0x1055('0x35')]())[_0x1055('0x18')](realtime[_0x1055('0x36')]())[_0x1055('0x18')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x1055('0x18')](realtime[_0x1055('0x37')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x1055('0x18')](realtime[_0x1055('0x38')]())['then'](voiceCallReport[_0x1055('0x39')]())[_0x1055('0x18')](realtime[_0x1055('0x3a')]())[_0x1055('0x3b')](function(_0x20f142){logger[_0x1055('0x3c')](_0x1055('0x3d'),util['inspect'](_0x20f142,{'showHidden':![],'depth':null}));});}function main(){return server[_0x1055('0x3e')](realtime,preview,fax)['then'](function(){return initRealtime();})['then'](function(){return initParams();})[_0x1055('0x18')](function(){report[_0x1055('0x3f')]();setInterval(initRealtime,0x1388);})[_0x1055('0x3b')](function(_0x510ff9){logger[_0x1055('0x3c')](_0x1055('0x40'),util[_0x1055('0x41')](_0x510ff9,{'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 b6fa995..a639691 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 _0xf443=['user:presence','exports','util','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','stateTime','status','unknown','address','phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','statePause','format','voiceStatus','voiceStatusQueue','onhold','stringify','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf443,0xc5));var _0x3f44=function(_0x442cf3,_0x3220ee){_0x442cf3=_0x442cf3-0x0;var _0x32f751=_0xf443[_0x442cf3];return _0x32f751;};'use strict';var _=require('lodash');var util=require(_0x3f44('0x0'));var moment=require(_0x3f44('0x1'));var md5=require(_0x3f44('0x2'));var Redis=require(_0x3f44('0x3'));var config=require('../../../config/environment');config[_0x3f44('0x4')]=_[_0x3f44('0x5')](config[_0x3f44('0x4')],{'host':_0x3f44('0x6'),'port':0x18eb});var io=require(_0x3f44('0x7'))(new Redis(config['redis']));function Agent(_0x2911d6){this['id']=_0x2911d6['id']||0x0;this[_0x3f44('0x8')]=_0x2911d6[_0x3f44('0x8')]||'';this[_0x3f44('0x9')]=_0x2911d6[_0x3f44('0x9')]||'';this[_0x3f44('0xa')]=_0x2911d6[_0x3f44('0xa')]||'';this[_0x3f44('0xb')]=_0x2911d6[_0x3f44('0xb')]||'';this[_0x3f44('0xc')]='unknown';this[_0x3f44('0xd')]=0x0;this[_0x3f44('0xe')]=_0x3f44('0xf');this[_0x3f44('0x10')]='';this[_0x3f44('0x11')]='';this[_0x3f44('0x12')]='';this[_0x3f44('0x13')]='';this[_0x3f44('0x14')]=_0x2911d6[_0x3f44('0x14')]||![];this['voiceStatus']='unknown';this[_0x3f44('0x15')]=0x0;this[_0x3f44('0x16')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x3f44('0x17')]=![];this[_0x3f44('0x2')]='';}Agent[_0x3f44('0x18')][_0x3f44('0x19')]=function(_0xf85d6a){var _0x272368;if(_0xf85d6a&&_0xf85d6a[_0x3f44('0xc')]){_0x272368=_0xf85d6a[_0x3f44('0xc')][_0x3f44('0x1a')]();switch(_0x272368){case _0x3f44('0x1b'):_0x272368='idle';break;case _0x3f44('0x1c'):_0x272368=_0x3f44('0x1d');break;}}if(_0x272368&&this['voiceStatus']!==_0x272368||_0xf85d6a[_0x3f44('0x1e')]){this[_0x3f44('0x15')]=_['toNumber'](moment()[_0x3f44('0x1f')]('x'));}if(_0x272368){this[_0x3f44('0x20')]=_0x272368;}var _0x23fe0d={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this['accountcode'],'fullname':this[_0x3f44('0xb')],'state':this[_0x3f44('0xc')],'stateTime':this[_0x3f44('0xd')],'status':this[_0x3f44('0xe')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x3f44('0x20')],'voiceStatusTime':this[_0x3f44('0x15')],'voiceStatusCallerIdNumber':this[_0x3f44('0x16')],'voiceStatusQueue':this[_0x3f44('0x21')],'interface':this[_0x3f44('0x13')],'onhold':this[_0x3f44('0x22')]};var _0x19f112=md5(JSON[_0x3f44('0x23')](_0x23fe0d));if(this[_0x3f44('0x2')]!==_0x19f112){this['md5']=_0x19f112;io['to'](util[_0x3f44('0x1f')]('user:%s',_0x23fe0d['name']))[_0x3f44('0x24')]('user:save',_0x23fe0d);io[_0x3f44('0x24')](_0x3f44('0x25'),_0x23fe0d);}};module[_0x3f44('0x26')]=Agent; \ No newline at end of file +var _0xae24=['state','unknown','stateTime','status','address','mobile','interface','online','voiceStatusTime','voiceStatusQueue','local','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','voiceStatus','toNumber','format','voiceStatusCallerIdNumber','user:%s','user:save','user:presence','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname'];(function(_0x35e534,_0x1652a9){var _0x4ea57f=function(_0xd8fae){while(--_0xd8fae){_0x35e534['push'](_0x35e534['shift']());}};_0x4ea57f(++_0x1652a9);}(_0xae24,0x180));var _0x4ae2=function(_0x26940b,_0x3fdb1d){_0x26940b=_0x26940b-0x0;var _0xdad58d=_0xae24[_0x26940b];return _0xdad58d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4ae2('0x0'));var md5=require(_0x4ae2('0x1'));var Redis=require(_0x4ae2('0x2'));var config=require(_0x4ae2('0x3'));config[_0x4ae2('0x4')]=_[_0x4ae2('0x5')](config[_0x4ae2('0x4')],{'host':_0x4ae2('0x6'),'port':0x18eb});var io=require(_0x4ae2('0x7'))(new Redis(config[_0x4ae2('0x4')]));function Agent(_0x526b01){this['id']=_0x526b01['id']||0x0;this[_0x4ae2('0x8')]=_0x526b01[_0x4ae2('0x8')]||'';this[_0x4ae2('0x9')]=_0x526b01['email']||'';this['accountcode']=_0x526b01[_0x4ae2('0xa')]||'';this[_0x4ae2('0xb')]=_0x526b01[_0x4ae2('0xb')]||'';this[_0x4ae2('0xc')]=_0x4ae2('0xd');this[_0x4ae2('0xe')]=0x0;this[_0x4ae2('0xf')]=_0x4ae2('0xd');this[_0x4ae2('0x10')]='';this['phone']='';this[_0x4ae2('0x11')]='';this[_0x4ae2('0x12')]='';this['online']=_0x526b01[_0x4ae2('0x13')]||![];this['voiceStatus']=_0x4ae2('0xd');this[_0x4ae2('0x14')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x4ae2('0x15')]='';this['onhold']=![];this[_0x4ae2('0x16')]=![];this[_0x4ae2('0x1')]='';}Agent['prototype'][_0x4ae2('0x17')]=function(_0x401bd4){var _0xf73472;if(_0x401bd4&&_0x401bd4[_0x4ae2('0xc')]){_0xf73472=_0x401bd4[_0x4ae2('0xc')][_0x4ae2('0x18')]();switch(_0xf73472){case _0x4ae2('0x19'):_0xf73472=_0x4ae2('0x1a');break;case _0x4ae2('0x1b'):_0xf73472=_0x4ae2('0x1c');break;}}if(_0xf73472&&this[_0x4ae2('0x1d')]!==_0xf73472||_0x401bd4['statePause']){this[_0x4ae2('0x14')]=_[_0x4ae2('0x1e')](moment()[_0x4ae2('0x1f')]('x'));}if(_0xf73472){this['voiceStatus']=_0xf73472;}var _0x16f68b={'id':this['id'],'name':this['name'],'email':this[_0x4ae2('0x9')],'accountcode':this[_0x4ae2('0xa')],'fullname':this[_0x4ae2('0xb')],'state':this['state'],'stateTime':this[_0x4ae2('0xe')],'status':this[_0x4ae2('0xf')],'address':this[_0x4ae2('0x10')],'online':this[_0x4ae2('0x13')],'voiceStatus':this[_0x4ae2('0x1d')],'voiceStatusTime':this[_0x4ae2('0x14')],'voiceStatusCallerIdNumber':this[_0x4ae2('0x20')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x4ae2('0x12')],'onhold':this['onhold']};var _0x1eae9a=md5(JSON['stringify'](_0x16f68b));if(this[_0x4ae2('0x1')]!==_0x1eae9a){this[_0x4ae2('0x1')]=_0x1eae9a;io['to'](util['format'](_0x4ae2('0x21'),_0x16f68b[_0x4ae2('0x8')]))['emit'](_0x4ae2('0x22'),_0x16f68b);io['emit'](_0x4ae2('0x23'),_0x16f68b);}};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 19a6f0e..12127d1 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 _0xa2b4=['limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrTotalCallsDays','sendMessageOneNotActive'];(function(_0x195413,_0x393ff4){var _0x1df657=function(_0x35e83e){while(--_0x35e83e){_0x195413['push'](_0x195413['shift']());}};_0x1df657(++_0x393ff4);}(_0xa2b4,0xe9));var _0x4a2b=function(_0x3a09e6,_0x32bbf9){_0x3a09e6=_0x3a09e6-0x0;var _0x2fa6c0=_0xa2b4[_0x3a09e6];return _0x2fa6c0;};'use strict';function Campaign(_0x47c2d2){this['id']=_0x47c2d2['id']||0x0;this[_0x4a2b('0x0')]=_0x47c2d2[_0x4a2b('0x0')]||'';this[_0x4a2b('0x1')]=_0x47c2d2[_0x4a2b('0x1')]||_0x4a2b('0x2');this[_0x4a2b('0x3')]=0x0;this[_0x4a2b('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x4a2b('0x5')]=0x0;this['message']='';this[_0x4a2b('0x6')]=!![];this['active']=_0x47c2d2['active'];this['limitCalls']=_0x47c2d2[_0x4a2b('0x7')];this[_0x4a2b('0x8')]=_0x47c2d2['dialTimezone']||null;this['dialGlobalInterval']=_0x47c2d2[_0x4a2b('0x9')]?_0x47c2d2[_0x4a2b('0x9')]:null;this['dialOriginateCallerIdName']=_0x47c2d2[_0x4a2b('0xa')];this[_0x4a2b('0xb')]=_0x47c2d2[_0x4a2b('0xb')];this[_0x4a2b('0xc')]=_0x47c2d2[_0x4a2b('0xc')]||0x1e;this['dialCongestionMaxRetry']=_0x47c2d2[_0x4a2b('0xd')];this['dialCongestionRetryFrequency']=_0x47c2d2[_0x4a2b('0xe')];this[_0x4a2b('0xf')]=_0x47c2d2[_0x4a2b('0xf')];this['dialBusyRetryFrequency']=_0x47c2d2[_0x4a2b('0x10')];this['dialNoAnswerMaxRetry']=_0x47c2d2['dialNoAnswerMaxRetry'];this[_0x4a2b('0x11')]=_0x47c2d2[_0x4a2b('0x11')];this[_0x4a2b('0x12')]=_0x47c2d2[_0x4a2b('0x12')];this[_0x4a2b('0x13')]=_0x47c2d2[_0x4a2b('0x13')]||0x3;this[_0x4a2b('0x14')]=_0x47c2d2[_0x4a2b('0x14')]||0x96;this[_0x4a2b('0x15')]=_0x47c2d2[_0x4a2b('0x15')]||0x3;this['dialDropRetryFrequency']=_0x47c2d2[_0x4a2b('0x16')]||0x96;this[_0x4a2b('0x17')]=_0x47c2d2[_0x4a2b('0x17')]||0x3;this[_0x4a2b('0x18')]=_0x47c2d2[_0x4a2b('0x18')]||0x96;this[_0x4a2b('0x19')]=_0x47c2d2['dialMachineMaxRetry']||0x3;this[_0x4a2b('0x1a')]=_0x47c2d2[_0x4a2b('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0x47c2d2[_0x4a2b('0x1b')]||0x3;this[_0x4a2b('0x1c')]=_0x47c2d2['dialAgentRejectRetryFrequency']||0x96;this[_0x4a2b('0x1d')]=_0x47c2d2['dialOrderByScheduledAt']||'DESC';this['dialPrefix']=_0x47c2d2[_0x4a2b('0x1e')]||undefined;this[_0x4a2b('0x1f')]=_0x47c2d2[_0x4a2b('0x1f')]||undefined;this['dialCutDigit']=_0x47c2d2[_0x4a2b('0x20')]||undefined;this[_0x4a2b('0x21')]=_0x47c2d2[_0x4a2b('0x21')]?_0x47c2d2['TrunkBackup']:undefined;this[_0x4a2b('0x22')]=_0x47c2d2[_0x4a2b('0x22')]?_0x47c2d2[_0x4a2b('0x22')]:undefined;this[_0x4a2b('0x23')]=_0x47c2d2[_0x4a2b('0x23')]?_0x47c2d2[_0x4a2b('0x23')]:undefined;this[_0x4a2b('0x24')]=_0x47c2d2[_0x4a2b('0x24')]?_0x47c2d2[_0x4a2b('0x24')]:undefined;this[_0x4a2b('0x25')]=_0x47c2d2[_0x4a2b('0x24')]?_0x47c2d2['SquareProject'][_0x4a2b('0x0')]:undefined;this[_0x4a2b('0x26')]=_0x47c2d2['dialAMDActive']||![];this[_0x4a2b('0x27')]=_0x47c2d2[_0x4a2b('0x27')];this[_0x4a2b('0x28')]=_0x47c2d2[_0x4a2b('0x28')];this[_0x4a2b('0x29')]=_0x47c2d2[_0x4a2b('0x29')];this['dialAMDTotalAnalysisTime']=_0x47c2d2[_0x4a2b('0x2a')];this[_0x4a2b('0x2b')]=_0x47c2d2['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x47c2d2[_0x4a2b('0x2c')];this['dialAMDMaximumNumberOfWords']=_0x47c2d2['dialAMDMaximumNumberOfWords'];this[_0x4a2b('0x2d')]=_0x47c2d2['dialAMDSilenceThreshold'];this[_0x4a2b('0x2e')]=_0x47c2d2[_0x4a2b('0x2e')];}module[_0x4a2b('0x2f')]=Campaign; \ No newline at end of file +var _0x7dbc=['dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry'];(function(_0x48646f,_0x54b3a7){var _0x2601cb=function(_0x4d8ee2){while(--_0x4d8ee2){_0x48646f['push'](_0x48646f['shift']());}};_0x2601cb(++_0x54b3a7);}(_0x7dbc,0x77));var _0xc7db=function(_0x57cd2a,_0x217d82){_0x57cd2a=_0x57cd2a-0x0;var _0x4cda43=_0x7dbc[_0x57cd2a];return _0x4cda43;};'use strict';function Campaign(_0x3b9e45){this['id']=_0x3b9e45['id']||0x0;this[_0xc7db('0x0')]=_0x3b9e45[_0xc7db('0x0')]||'';this[_0xc7db('0x1')]=_0x3b9e45[_0xc7db('0x1')]||_0xc7db('0x2');this[_0xc7db('0x3')]=0x0;this[_0xc7db('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xc7db('0x5')]=0x0;this[_0xc7db('0x6')]='';this[_0xc7db('0x7')]=!![];this['active']=_0x3b9e45['active'];this[_0xc7db('0x8')]=_0x3b9e45[_0xc7db('0x8')];this[_0xc7db('0x9')]=_0x3b9e45['dialTimezone']||null;this['dialGlobalInterval']=_0x3b9e45[_0xc7db('0xa')]?_0x3b9e45['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x3b9e45[_0xc7db('0xb')];this[_0xc7db('0xc')]=_0x3b9e45['dialOriginateCallerIdNumber'];this[_0xc7db('0xd')]=_0x3b9e45[_0xc7db('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x3b9e45['dialCongestionMaxRetry'];this[_0xc7db('0xe')]=_0x3b9e45[_0xc7db('0xe')];this['dialBusyMaxRetry']=_0x3b9e45[_0xc7db('0xf')];this['dialBusyRetryFrequency']=_0x3b9e45[_0xc7db('0x10')];this['dialNoAnswerMaxRetry']=_0x3b9e45[_0xc7db('0x11')];this[_0xc7db('0x12')]=_0x3b9e45['dialNoAnswerRetryFrequency'];this[_0xc7db('0x13')]=_0x3b9e45[_0xc7db('0x13')];this['dialNoSuchNumberMaxRetry']=_0x3b9e45[_0xc7db('0x14')]||0x3;this[_0xc7db('0x15')]=_0x3b9e45[_0xc7db('0x15')]||0x96;this[_0xc7db('0x16')]=_0x3b9e45['dialDropMaxRetry']||0x3;this[_0xc7db('0x17')]=_0x3b9e45['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x3b9e45['dialAbandonedMaxRetry']||0x3;this[_0xc7db('0x18')]=_0x3b9e45[_0xc7db('0x18')]||0x96;this[_0xc7db('0x19')]=_0x3b9e45['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x3b9e45[_0xc7db('0x1a')]||0x96;this[_0xc7db('0x1b')]=_0x3b9e45['dialAgentRejectMaxRetry']||0x3;this[_0xc7db('0x1c')]=_0x3b9e45['dialAgentRejectRetryFrequency']||0x96;this[_0xc7db('0x1d')]=_0x3b9e45['dialOrderByScheduledAt']||_0xc7db('0x1e');this[_0xc7db('0x1f')]=_0x3b9e45['dialPrefix']||undefined;this[_0xc7db('0x20')]=_0x3b9e45[_0xc7db('0x20')]||undefined;this[_0xc7db('0x21')]=_0x3b9e45['dialCutDigit']||undefined;this[_0xc7db('0x22')]=_0x3b9e45[_0xc7db('0x22')]?_0x3b9e45[_0xc7db('0x22')]:undefined;this[_0xc7db('0x23')]=_0x3b9e45[_0xc7db('0x23')]?_0x3b9e45[_0xc7db('0x23')]:undefined;this[_0xc7db('0x24')]=_0x3b9e45[_0xc7db('0x24')]?_0x3b9e45['Interval']:undefined;this[_0xc7db('0x25')]=_0x3b9e45[_0xc7db('0x25')]?_0x3b9e45[_0xc7db('0x25')]:undefined;this['dialQueueProject']=_0x3b9e45[_0xc7db('0x25')]?_0x3b9e45[_0xc7db('0x25')][_0xc7db('0x0')]:undefined;this[_0xc7db('0x26')]=_0x3b9e45[_0xc7db('0x26')]||![];this[_0xc7db('0x27')]=_0x3b9e45['dialAMDInitialSilence'];this[_0xc7db('0x28')]=_0x3b9e45['dialAMDGreeting'];this[_0xc7db('0x29')]=_0x3b9e45[_0xc7db('0x29')];this[_0xc7db('0x2a')]=_0x3b9e45[_0xc7db('0x2a')];this[_0xc7db('0x2b')]=_0x3b9e45[_0xc7db('0x2b')];this[_0xc7db('0x2c')]=_0x3b9e45[_0xc7db('0x2c')];this[_0xc7db('0x2d')]=_0x3b9e45[_0xc7db('0x2d')];this[_0xc7db('0x2e')]=_0x3b9e45['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x3b9e45[_0xc7db('0x2f')];}module[_0xc7db('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 47b4dfc..21f9d97 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 _0xae8e=['calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel'];(function(_0x57724c,_0x13400c){var _0x391bf8=function(_0x1e8fbf){while(--_0x1e8fbf){_0x57724c['push'](_0x57724c['shift']());}};_0x391bf8(++_0x13400c);}(_0xae8e,0xc3));var _0xeae8=function(_0xc437e0,_0x1d09b4){_0xc437e0=_0xc437e0-0x0;var _0x443cbb=_0xae8e[_0xc437e0];return _0x443cbb;};'use strict';function Channel(){this[_0xeae8('0x0')]=null;this[_0xeae8('0x1')]='';this[_0xeae8('0x2')]='';this[_0xeae8('0x3')]=0x0;this[_0xeae8('0x4')]='';this[_0xeae8('0x5')]=undefined;this[_0xeae8('0x6')]=undefined;this[_0xeae8('0x7')]=0x0;this[_0xeae8('0x8')]='';this[_0xeae8('0x9')]=0x0;this[_0xeae8('0xa')]=0x0;this[_0xeae8('0xb')]=0x0;this[_0xeae8('0xc')]=![];this[_0xeae8('0xd')]=null;this[_0xeae8('0xe')]=null;this[_0xeae8('0xf')]=![];this[_0xeae8('0x10')]=![];this[_0xeae8('0x11')]='';this[_0xeae8('0x12')]='';this[_0xeae8('0x13')]=0x0;this[_0xeae8('0x14')]=0x0;this[_0xeae8('0x15')]=0x0;this[_0xeae8('0x16')]=null;this[_0xeae8('0x17')]=null;this[_0xeae8('0x18')]=null;this[_0xeae8('0x19')]=![];this[_0xeae8('0x1a')]=null;this[_0xeae8('0x1b')]=null;this[_0xeae8('0x1c')]=[];this[_0xeae8('0x1d')]=undefined;this[_0xeae8('0x1e')]=undefined;this['transferType']=undefined;this[_0xeae8('0x1f')]=0x0;}module[_0xeae8('0x20')]=Channel; \ No newline at end of file +var _0xdc36=['monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','answertime','endtime','unmanaged','abandoned','lastdata','duration','holdtime','type','tag','disposition','monitorFilename'];(function(_0x1d1afc,_0xf849f5){var _0xf8db68=function(_0x168225){while(--_0x168225){_0x1d1afc['push'](_0x1d1afc['shift']());}};_0xf8db68(++_0xf849f5);}(_0xdc36,0x18c));var _0x6dc3=function(_0x3815ac,_0x4b3151){_0x3815ac=_0x3815ac-0x0;var _0x218cec=_0xdc36[_0x3815ac];return _0x218cec;};'use strict';function Channel(){this[_0x6dc3('0x0')]=null;this['channel']='';this[_0x6dc3('0x1')]='';this[_0x6dc3('0x2')]=0x0;this['calleridname']='';this[_0x6dc3('0x3')]=undefined;this[_0x6dc3('0x4')]=undefined;this[_0x6dc3('0x5')]=0x0;this['context']='';this[_0x6dc3('0x6')]=0x0;this[_0x6dc3('0x7')]=0x0;this[_0x6dc3('0x8')]=0x0;this['answered']=![];this[_0x6dc3('0x9')]=null;this[_0x6dc3('0xa')]=null;this[_0x6dc3('0xb')]=![];this[_0x6dc3('0xc')]=![];this['lastapplication']='';this[_0x6dc3('0xd')]='';this[_0x6dc3('0xe')]=0x0;this['billableseconds']=0x0;this[_0x6dc3('0xf')]=0x0;this[_0x6dc3('0x10')]=null;this[_0x6dc3('0x11')]=null;this[_0x6dc3('0x12')]=null;this['monitor']=![];this[_0x6dc3('0x13')]=null;this['queue']=null;this[_0x6dc3('0x14')]=[];this[_0x6dc3('0x15')]=undefined;this[_0x6dc3('0x16')]=undefined;this[_0x6dc3('0x17')]=undefined;this[_0x6dc3('0x18')]=0x0;}module[_0x6dc3('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 96dab4d..71ebdc6 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 _0x3360=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','Configurations','name','username'];(function(_0x12a5f7,_0x1b0f65){var _0x36391d=function(_0x4d5fd8){while(--_0x4d5fd8){_0x12a5f7['push'](_0x12a5f7['shift']());}};_0x36391d(++_0x1b0f65);}(_0x3360,0xe5));var _0x0336=function(_0x52b792,_0x31a7d5){_0x52b792=_0x52b792-0x0;var _0x279fc3=_0x3360[_0x52b792];return _0x279fc3;};'use strict';function DeskAccount(_0x4cb7be){this['id']=_0x4cb7be['id']||0x0;this[_0x0336('0x0')]=_0x4cb7be['name']||'';this['username']=_0x4cb7be[_0x0336('0x1')]||'';this[_0x0336('0x2')]=_0x4cb7be[_0x0336('0x2')]||'';this[_0x0336('0x3')]=_0x4cb7be[_0x0336('0x3')]||'';this['password']=_0x4cb7be[_0x0336('0x4')]||'';this[_0x0336('0x5')]=_0x4cb7be['consumerKey']||'';this[_0x0336('0x6')]=_0x4cb7be[_0x0336('0x6')]||'';this[_0x0336('0x7')]=_0x4cb7be['token']||'';this[_0x0336('0x8')]=_0x4cb7be[_0x0336('0x8')]||'';this[_0x0336('0x9')]=_0x4cb7be[_0x0336('0x9')]||'';this['serverUrl']=_0x4cb7be['serverUrl']||'';this[_0x0336('0xa')]=_0x4cb7be[_0x0336('0xa')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0xb34d=['exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x167181,_0x119986){var _0x2f4ae0=function(_0x429527){while(--_0x429527){_0x167181['push'](_0x167181['shift']());}};_0x2f4ae0(++_0x119986);}(_0xb34d,0xd1));var _0xdb34=function(_0x33faf3,_0x5628a7){_0x33faf3=_0x33faf3-0x0;var _0x395766=_0xb34d[_0x33faf3];return _0x395766;};'use strict';function DeskAccount(_0x49db46){this['id']=_0x49db46['id']||0x0;this[_0xdb34('0x0')]=_0x49db46['name']||'';this[_0xdb34('0x1')]=_0x49db46[_0xdb34('0x1')]||'';this[_0xdb34('0x2')]=_0x49db46[_0xdb34('0x2')]||'';this['authType']=_0x49db46[_0xdb34('0x3')]||'';this[_0xdb34('0x4')]=_0x49db46['password']||'';this[_0xdb34('0x5')]=_0x49db46['consumerKey']||'';this['consumerSecret']=_0x49db46[_0xdb34('0x6')]||'';this['token']=_0x49db46[_0xdb34('0x7')]||'';this['tokenSecret']=_0x49db46[_0xdb34('0x8')]||'';this['type']=_0x49db46[_0xdb34('0x9')]||'';this[_0xdb34('0xa')]=_0x49db46[_0xdb34('0xa')]||'';this[_0xdb34('0xb')]=_0x49db46[_0xdb34('0xb')]||{};}module[_0xdb34('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 433504f..afd1e31 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 _0x5e66=['serverUrl','modernAuthentication','Configurations','CloudProvider','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x1f0684,_0x791927){var _0x2c6747=function(_0x10f748){while(--_0x10f748){_0x1f0684['push'](_0x1f0684['shift']());}};_0x2c6747(++_0x791927);}(_0x5e66,0x67));var _0x65e6=function(_0x45e71d,_0x29b5f1){_0x45e71d=_0x45e71d-0x0;var _0x4b7fee=_0x5e66[_0x45e71d];return _0x4b7fee;};'use strict';function Dynamics365Account(_0x1b72ab){this['id']=_0x1b72ab['id']||0x0;this['name']=_0x1b72ab[_0x65e6('0x0')]||'';this['username']=_0x1b72ab[_0x65e6('0x1')]||'';this[_0x65e6('0x2')]=_0x1b72ab[_0x65e6('0x2')]||'';this['remoteUri']=_0x1b72ab[_0x65e6('0x3')]||'';this[_0x65e6('0x4')]=_0x1b72ab[_0x65e6('0x4')]||'';this[_0x65e6('0x5')]=_0x1b72ab[_0x65e6('0x5')]||'';this['clientSecret']=_0x1b72ab[_0x65e6('0x6')]||{};this[_0x65e6('0x7')]=_0x1b72ab[_0x65e6('0x7')]||'';this[_0x65e6('0x8')]=_0x1b72ab[_0x65e6('0x8')]||![];this[_0x65e6('0x9')]=_0x1b72ab[_0x65e6('0x9')]||{};this[_0x65e6('0xa')]=_0x1b72ab[_0x65e6('0xa')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0xf144=['CloudProvider','exports','name','username','password','remoteUri','tenantId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0x4971ac,_0x4a7b95){var _0x5d31cb=function(_0x4b1aa5){while(--_0x4b1aa5){_0x4971ac['push'](_0x4971ac['shift']());}};_0x5d31cb(++_0x4a7b95);}(_0xf144,0x9c));var _0x4f14=function(_0x3e8f8e,_0x50e78d){_0x3e8f8e=_0x3e8f8e-0x0;var _0x428d54=_0xf144[_0x3e8f8e];return _0x428d54;};'use strict';function Dynamics365Account(_0x1cb61c){this['id']=_0x1cb61c['id']||0x0;this[_0x4f14('0x0')]=_0x1cb61c[_0x4f14('0x0')]||'';this[_0x4f14('0x1')]=_0x1cb61c['username']||'';this[_0x4f14('0x2')]=_0x1cb61c['password']||'';this[_0x4f14('0x3')]=_0x1cb61c[_0x4f14('0x3')]||'';this[_0x4f14('0x4')]=_0x1cb61c[_0x4f14('0x4')]||'';this['clientId']=_0x1cb61c['clientId']||'';this[_0x4f14('0x5')]=_0x1cb61c[_0x4f14('0x5')]||{};this['serverUrl']=_0x1cb61c[_0x4f14('0x6')]||'';this[_0x4f14('0x7')]=_0x1cb61c['modernAuthentication']||![];this[_0x4f14('0x8')]=_0x1cb61c[_0x4f14('0x8')]||{};this[_0x4f14('0x9')]=_0x1cb61c[_0x4f14('0x9')]||{};}module[_0x4f14('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 6a0fdca..5065fd1 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 _0xe030=['description','ecm','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xe030,0xdc));var _0x0e03=function(_0x343d40,_0x577e42){_0x343d40=_0x343d40-0x0;var _0xa3f900=_0xe030[_0x343d40];return _0xa3f900;};'use strict';function FaxAccount(_0x2abd54){this['id']=_0x2abd54['id']||0x0;this[_0x0e03('0x0')]=_0x2abd54[_0x0e03('0x0')]||'';this[_0x0e03('0x1')]=_0x2abd54['description'];this[_0x0e03('0x2')]=_0x2abd54[_0x0e03('0x2')];this['headerinfo']=_0x2abd54['headerinfo'];this[_0x0e03('0x3')]=_0x2abd54['localstationid'];this[_0x0e03('0x4')]=_0x2abd54['minrate']||0x960;this[_0x0e03('0x5')]=_0x2abd54['maxrate']||0x3840;this[_0x0e03('0x6')]=_0x2abd54[_0x0e03('0x6')]||_0x0e03('0x7');this['gateway']=_0x2abd54[_0x0e03('0x8')]||'no';this[_0x0e03('0x9')]=_0x2abd54[_0x0e03('0x9')]||'no';this[_0x0e03('0xa')]=_0x2abd54[_0x0e03('0xa')]||0x1388;this[_0x0e03('0xb')]=_0x2abd54[_0x0e03('0xb')]||_0x0e03('0xc');this[_0x0e03('0xd')]=_0x2abd54['Trunk']?_0x2abd54[_0x0e03('0xd')]:undefined;this[_0x0e03('0xe')]=_0x2abd54['ListId'];this[_0x0e03('0xf')]=_0x2abd54['key'];}module[_0x0e03('0x10')]=FaxAccount; \ No newline at end of file +var _0xf93e=['Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP'];(function(_0x5cb052,_0x333521){var _0x4a0f67=function(_0x1f14c8){while(--_0x1f14c8){_0x5cb052['push'](_0x5cb052['shift']());}};_0x4a0f67(++_0x333521);}(_0xf93e,0x1be));var _0xef93=function(_0x50a5ee,_0xa4c369){_0x50a5ee=_0x50a5ee-0x0;var _0x2aea2f=_0xf93e[_0x50a5ee];return _0x2aea2f;};'use strict';function FaxAccount(_0x1da172){this['id']=_0x1da172['id']||0x0;this[_0xef93('0x0')]=_0x1da172[_0xef93('0x0')]||'';this[_0xef93('0x1')]=_0x1da172[_0xef93('0x1')];this[_0xef93('0x2')]=_0x1da172[_0xef93('0x2')];this[_0xef93('0x3')]=_0x1da172[_0xef93('0x3')];this[_0xef93('0x4')]=_0x1da172[_0xef93('0x4')];this['minrate']=_0x1da172[_0xef93('0x5')]||0x960;this[_0xef93('0x6')]=_0x1da172[_0xef93('0x6')]||0x3840;this['modem']=_0x1da172[_0xef93('0x7')]||'v17,v27,v29';this[_0xef93('0x8')]=_0x1da172['gateway']||'no';this[_0xef93('0x9')]=_0x1da172[_0xef93('0x9')]||'no';this[_0xef93('0xa')]=_0x1da172[_0xef93('0xa')]||0x1388;this[_0xef93('0xb')]=_0x1da172[_0xef93('0xb')]||_0xef93('0xc');this[_0xef93('0xd')]=_0x1da172[_0xef93('0xd')]?_0x1da172[_0xef93('0xd')]:undefined;this[_0xef93('0xe')]=_0x1da172[_0xef93('0xe')];this[_0xef93('0xf')]=_0x1da172[_0xef93('0xf')];}module[_0xef93('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 007bc9b..ad53019 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 _0x6686=['username','apiKey','remoteUri','serverUrl','Configurations','name'];(function(_0x162b38,_0x543c5c){var _0x4d04a0=function(_0x528b9f){while(--_0x528b9f){_0x162b38['push'](_0x162b38['shift']());}};_0x4d04a0(++_0x543c5c);}(_0x6686,0xbf));var _0x6668=function(_0x1c4611,_0x50e33a){_0x1c4611=_0x1c4611-0x0;var _0x474fd1=_0x6686[_0x1c4611];return _0x474fd1;};'use strict';function FreshdeskAccount(_0x35a345){this['id']=_0x35a345['id']||0x0;this[_0x6668('0x0')]=_0x35a345[_0x6668('0x0')]||'';this[_0x6668('0x1')]=_0x35a345['username']||'';this[_0x6668('0x2')]=_0x35a345['token']||'';this[_0x6668('0x3')]=_0x35a345[_0x6668('0x3')]||'';this[_0x6668('0x4')]=_0x35a345[_0x6668('0x4')]||'';this[_0x6668('0x5')]=_0x35a345[_0x6668('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x345c=['name','username','apiKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x4a5f6c,_0x4f532e){var _0x281ffd=function(_0x4c68e3){while(--_0x4c68e3){_0x4a5f6c['push'](_0x4a5f6c['shift']());}};_0x281ffd(++_0x4f532e);}(_0x345c,0x1dc));var _0xc345=function(_0x4e936c,_0x81f200){_0x4e936c=_0x4e936c-0x0;var _0xa39a1c=_0x345c[_0x4e936c];return _0xa39a1c;};'use strict';function FreshdeskAccount(_0x73d2a1){this['id']=_0x73d2a1['id']||0x0;this[_0xc345('0x0')]=_0x73d2a1[_0xc345('0x0')]||'';this[_0xc345('0x1')]=_0x73d2a1[_0xc345('0x1')]||'';this[_0xc345('0x2')]=_0x73d2a1['token']||'';this[_0xc345('0x3')]=_0x73d2a1[_0xc345('0x3')]||'';this[_0xc345('0x4')]=_0x73d2a1[_0xc345('0x4')]||'';this[_0xc345('0x5')]=_0x73d2a1['Configurations']||{};}module[_0xc345('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index fd71b25..e02147e 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 _0x20d7=['exports','name','username','remoteUri','serverUrl'];(function(_0x4245f1,_0x1b04ce){var _0x49f545=function(_0xe52ef9){while(--_0xe52ef9){_0x4245f1['push'](_0x4245f1['shift']());}};_0x49f545(++_0x1b04ce);}(_0x20d7,0x146));var _0x720d=function(_0x11a167,_0x4bc0db){_0x11a167=_0x11a167-0x0;var _0x5022eb=_0x20d7[_0x11a167];return _0x5022eb;};'use strict';function FreshsalesAccount(_0x2c7afc){this['id']=_0x2c7afc['id']||0x0;this['name']=_0x2c7afc[_0x720d('0x0')]||'';this[_0x720d('0x1')]=_0x2c7afc[_0x720d('0x1')]||'';this['apiKey']=_0x2c7afc['token']||'';this['remoteUri']=_0x2c7afc[_0x720d('0x2')]||'';this[_0x720d('0x3')]=_0x2c7afc['serverUrl']||'';this['Configurations']=_0x2c7afc['Configurations']||{};}module[_0x720d('0x4')]=FreshsalesAccount; \ No newline at end of file +var _0xabce=['username','remoteUri','serverUrl','Configurations','name'];(function(_0x5e45c2,_0x2d6a5d){var _0x27760c=function(_0x57472b){while(--_0x57472b){_0x5e45c2['push'](_0x5e45c2['shift']());}};_0x27760c(++_0x2d6a5d);}(_0xabce,0x103));var _0xeabc=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xabce[_0x2bf141];return _0x48277b;};'use strict';function FreshsalesAccount(_0x3c9509){this['id']=_0x3c9509['id']||0x0;this[_0xeabc('0x0')]=_0x3c9509[_0xeabc('0x0')]||'';this[_0xeabc('0x1')]=_0x3c9509[_0xeabc('0x1')]||'';this['apiKey']=_0x3c9509['token']||'';this[_0xeabc('0x2')]=_0x3c9509[_0xeabc('0x2')]||'';this[_0xeabc('0x3')]=_0x3c9509['serverUrl']||'';this['Configurations']=_0x3c9509[_0xeabc('0x4')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index c26b774..77a6a8c 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 _0x8a13=['holdtime','lastAssignedTo','motionChannel','mohtime','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','context','exten','priority'];(function(_0x58818d,_0x2e6e73){var _0x15b750=function(_0x54193b){while(--_0x54193b){_0x58818d['push'](_0x58818d['shift']());}};_0x15b750(++_0x2e6e73);}(_0x8a13,0xeb));var _0x38a1=function(_0x19e38e,_0xb15cc7){_0x19e38e=_0x19e38e-0x0;var _0x14bec3=_0x8a13[_0x19e38e];return _0x14bec3;};'use strict';function QueueReport(){this[_0x38a1('0x0')]=_0x38a1('0x1');this[_0x38a1('0x2')]='';this[_0x38a1('0x3')]='';this[_0x38a1('0x4')]='';this[_0x38a1('0x5')]='';this[_0x38a1('0x6')]=null;this[_0x38a1('0x7')]=null;this['position']=0x1;this[_0x38a1('0x8')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0x38a1('0x9')]=null;this[_0x38a1('0xa')]=![];this[_0x38a1('0xb')]=null;this[_0x38a1('0xc')]=0x1;this[_0x38a1('0xd')]='';this['connectedlinenum']='';this[_0x38a1('0xe')]='';this['accountcode']='';this[_0x38a1('0xf')]='';this[_0x38a1('0x10')]='';this[_0x38a1('0x11')]='';this[_0x38a1('0x12')]=0x0;this['assigned']=![];this[_0x38a1('0x13')]='';this[_0x38a1('0x14')]='voice';this['routealias']=null;this[_0x38a1('0x15')]=0x0;this['variables']={};}module[_0x38a1('0x16')]=QueueReport; \ No newline at end of file +var _0xac3b=['calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','exten','priority','holdtime','assigned','motionChannel','voice','routealias','mohtime','exports','type','inbound','uniqueid'];(function(_0x10fca9,_0x2aca67){var _0x5b3c4f=function(_0x51bb9c){while(--_0x51bb9c){_0x10fca9['push'](_0x10fca9['shift']());}};_0x5b3c4f(++_0x2aca67);}(_0xac3b,0x169));var _0xbac3=function(_0x13023b,_0x51328e){_0x13023b=_0x13023b-0x0;var _0x458326=_0xac3b[_0x13023b];return _0x458326;};'use strict';function QueueReport(){this[_0xbac3('0x0')]=_0xbac3('0x1');this[_0xbac3('0x2')]='';this[_0xbac3('0x3')]='';this[_0xbac3('0x4')]='';this[_0xbac3('0x5')]='';this[_0xbac3('0x6')]=null;this[_0xbac3('0x7')]=null;this['position']=0x1;this['count']=0x1;this[_0xbac3('0x8')]=![];this[_0xbac3('0x9')]=null;this['queuecallercomplete']=![];this[_0xbac3('0xa')]=null;this[_0xbac3('0xb')]=![];this[_0xbac3('0xc')]=null;this['originalposition']=0x1;this[_0xbac3('0xd')]='';this[_0xbac3('0xe')]='';this[_0xbac3('0xf')]='';this[_0xbac3('0x10')]='';this['context']='';this[_0xbac3('0x11')]='';this[_0xbac3('0x12')]='';this[_0xbac3('0x13')]=0x0;this[_0xbac3('0x14')]=![];this['lastAssignedTo']='';this[_0xbac3('0x15')]=_0xbac3('0x16');this[_0xbac3('0x17')]=null;this[_0xbac3('0x18')]=0x0;this['variables']={};}module[_0xbac3('0x19')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 921445f..3435f8f 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 _0x5a44=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a44,0x122));var _0x45a4=function(_0x3a77ae,_0xf085c4){_0x3a77ae=_0x3a77ae-0x0;var _0x39fc96=_0x5a44[_0x3a77ae];return _0x39fc96;};'use strict';function SalesforceAccount(_0x3868f5){this['id']=_0x3868f5['id']||0x0;this[_0x45a4('0x0')]=_0x3868f5[_0x45a4('0x0')]||'';this[_0x45a4('0x1')]=_0x3868f5[_0x45a4('0x1')]||'';this[_0x45a4('0x2')]=_0x3868f5['remoteUri']||'';this[_0x45a4('0x3')]=_0x3868f5[_0x45a4('0x3')]||'';this[_0x45a4('0x4')]=_0x3868f5[_0x45a4('0x4')]||'';this['clientSecret']=_0x3868f5[_0x45a4('0x5')]||'';this[_0x45a4('0x6')]=_0x3868f5[_0x45a4('0x6')]||'';this['type']=_0x3868f5[_0x45a4('0x7')]||_0x45a4('0x8');this[_0x45a4('0x9')]=_0x3868f5[_0x45a4('0x9')]||'';this['Configurations']=_0x3868f5[_0x45a4('0xa')]||{};}module[_0x45a4('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x5707=['exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','integrationTab','serverUrl'];(function(_0x3687e6,_0x33eb32){var _0xdd9a8e=function(_0x136a4a){while(--_0x136a4a){_0x3687e6['push'](_0x3687e6['shift']());}};_0xdd9a8e(++_0x33eb32);}(_0x5707,0x1b9));var _0x7570=function(_0x18f82b,_0x3ea7a0){_0x18f82b=_0x18f82b-0x0;var _0x5d8128=_0x5707[_0x18f82b];return _0x5d8128;};'use strict';function SalesforceAccount(_0x22269d){this['id']=_0x22269d['id']||0x0;this['name']=_0x22269d[_0x7570('0x0')]||'';this[_0x7570('0x1')]=_0x22269d[_0x7570('0x1')]||'';this[_0x7570('0x2')]=_0x22269d[_0x7570('0x2')]||'';this[_0x7570('0x3')]=_0x22269d[_0x7570('0x3')]||'';this[_0x7570('0x4')]=_0x22269d[_0x7570('0x4')]||'';this[_0x7570('0x5')]=_0x22269d[_0x7570('0x5')]||'';this[_0x7570('0x6')]=_0x22269d['securityToken']||'';this['type']=_0x22269d['type']||_0x7570('0x7');this[_0x7570('0x8')]=_0x22269d[_0x7570('0x8')]||'';this['Configurations']=_0x22269d['Configurations']||{};}module[_0x7570('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 df21749..4deb0fc 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 _0x8fe8=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x14406e,_0x5e8863){var _0xe0d78d=function(_0x55b54b){while(--_0x55b54b){_0x14406e['push'](_0x14406e['shift']());}};_0xe0d78d(++_0x5e8863);}(_0x8fe8,0xca));var _0x88fe=function(_0x1c158d,_0x180fb0){_0x1c158d=_0x1c158d-0x0;var _0x4a7751=_0x8fe8[_0x1c158d];return _0x4a7751;};'use strict';function ServicenowAccount(_0x494551){this['id']=_0x494551['id']||0x0;this['name']=_0x494551[_0x88fe('0x0')]||'';this[_0x88fe('0x1')]=_0x494551['username']||'';this[_0x88fe('0x2')]=_0x494551[_0x88fe('0x2')]||'';this[_0x88fe('0x3')]=_0x494551[_0x88fe('0x3')]||'';this[_0x88fe('0x4')]=_0x494551['serverUrl']||'';this['Configurations']=_0x494551[_0x88fe('0x5')]||{};}module[_0x88fe('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x7c9b=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x28147f,_0x1e1f2d){var _0x32a646=function(_0x13713e){while(--_0x13713e){_0x28147f['push'](_0x28147f['shift']());}};_0x32a646(++_0x1e1f2d);}(_0x7c9b,0x8a));var _0xb7c9=function(_0x1b7615,_0x3489b8){_0x1b7615=_0x1b7615-0x0;var _0x476788=_0x7c9b[_0x1b7615];return _0x476788;};'use strict';function ServicenowAccount(_0x4e6cb8){this['id']=_0x4e6cb8['id']||0x0;this[_0xb7c9('0x0')]=_0x4e6cb8[_0xb7c9('0x0')]||'';this[_0xb7c9('0x1')]=_0x4e6cb8['username']||'';this[_0xb7c9('0x2')]=_0x4e6cb8['password']||'';this[_0xb7c9('0x3')]=_0x4e6cb8[_0xb7c9('0x3')]||'';this[_0xb7c9('0x4')]=_0x4e6cb8[_0xb7c9('0x4')]||'';this[_0xb7c9('0x5')]=_0x4e6cb8[_0xb7c9('0x5')]||{};}module[_0xb7c9('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 8206a30..779fe74 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 _0xf883=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0xfe9138,_0x4f85ff){var _0x265d0f=function(_0x431711){while(--_0x431711){_0xfe9138['push'](_0xfe9138['shift']());}};_0x265d0f(++_0x4f85ff);}(_0xf883,0x177));var _0x3f88=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf883[_0x3dd15e];return _0x231fd0;};'use strict';function SugarcrmAccount(_0x4bae0e){this['id']=_0x4bae0e['id']||0x0;this[_0x3f88('0x0')]=_0x4bae0e['name']||'';this[_0x3f88('0x1')]=_0x4bae0e['username']||'';this[_0x3f88('0x2')]=_0x4bae0e[_0x3f88('0x2')]||'';this['remoteUri']=_0x4bae0e[_0x3f88('0x3')]||'';this[_0x3f88('0x4')]=_0x4bae0e[_0x3f88('0x4')]||'';this[_0x3f88('0x5')]=_0x4bae0e[_0x3f88('0x5')]||{};}module[_0x3f88('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x41d7=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3b711c,_0x4b22dc){var _0x2685f0=function(_0x3b5ba6){while(--_0x3b5ba6){_0x3b711c['push'](_0x3b711c['shift']());}};_0x2685f0(++_0x4b22dc);}(_0x41d7,0x186));var _0x741d=function(_0xc160f3,_0x217558){_0xc160f3=_0xc160f3-0x0;var _0x34f4f6=_0x41d7[_0xc160f3];return _0x34f4f6;};'use strict';function SugarcrmAccount(_0x76ab98){this['id']=_0x76ab98['id']||0x0;this[_0x741d('0x0')]=_0x76ab98[_0x741d('0x0')]||'';this[_0x741d('0x1')]=_0x76ab98[_0x741d('0x1')]||'';this[_0x741d('0x2')]=_0x76ab98['password']||'';this[_0x741d('0x3')]=_0x76ab98[_0x741d('0x3')]||'';this[_0x741d('0x4')]=_0x76ab98[_0x741d('0x4')]||'';this['Configurations']=_0x76ab98[_0x741d('0x5')]||{};}module[_0x741d('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 646754a..d0d2a24 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 _0x1e00=['accountcode','state','status','unknown','name'];(function(_0x302d3d,_0x2210b1){var _0x1661a6=function(_0x5dd648){while(--_0x5dd648){_0x302d3d['push'](_0x302d3d['shift']());}};_0x1661a6(++_0x2210b1);}(_0x1e00,0x1df));var _0x01e0=function(_0x139f6b,_0x2ce6de){_0x139f6b=_0x139f6b-0x0;var _0x2c000a=_0x1e00[_0x139f6b];return _0x2c000a;};'use strict';function Telephone(_0x1d310d){this['id']=_0x1d310d['id']||0x0;this['name']=_0x1d310d[_0x01e0('0x0')]||'';this['accountcode']=_0x1d310d[_0x01e0('0x1')]||'';this[_0x01e0('0x2')]='unknown';this['stateTime']=0x0;this[_0x01e0('0x3')]=_0x01e0('0x4');this['address']='';}module['exports']=Telephone; \ No newline at end of file +var _0xe8cd=['state','stateTime','status','name','accountcode'];(function(_0x3e5a19,_0x22a0bf){var _0x46bf34=function(_0x3f8dd9){while(--_0x3f8dd9){_0x3e5a19['push'](_0x3e5a19['shift']());}};_0x46bf34(++_0x22a0bf);}(_0xe8cd,0x152));var _0xde8c=function(_0x5093e9,_0x5154d0){_0x5093e9=_0x5093e9-0x0;var _0x4c9a22=_0xe8cd[_0x5093e9];return _0x4c9a22;};'use strict';function Telephone(_0x3168de){this['id']=_0x3168de['id']||0x0;this['name']=_0x3168de[_0xde8c('0x0')]||'';this[_0xde8c('0x1')]=_0x3168de['accountcode']||'';this[_0xde8c('0x2')]='unknown';this[_0xde8c('0x3')]=0x0;this[_0xde8c('0x4')]='unknown';this['address']='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index dfd7f3d..0fb5aa5 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x4d4201,_0x166506){var _0x382eb9=function(_0x3ee602){while(--_0x3ee602){_0x4d4201['push'](_0x4d4201['shift']());}};_0x382eb9(++_0x166506);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x66ae4d,_0x1e36d9){var _0x12f159=function(_0x201b26){while(--_0x201b26){_0x66ae4d['push'](_0x66ae4d['shift']());}};_0x12f159(++_0x1e36d9);}(_0xb10b,0x12a));var _0xbb10=function(_0x49e77b,_0x59ced7){_0x49e77b=_0x49e77b-0x0;var _0x58b978=_0xb10b[_0x49e77b];return _0x58b978;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 3e25433..93edba4 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 _0x14a0=['voice','status','AnyConditions','Actions','name','channel'];(function(_0xf150c8,_0x59e831){var _0x7d35e=function(_0x133027){while(--_0x133027){_0xf150c8['push'](_0xf150c8['shift']());}};_0x7d35e(++_0x59e831);}(_0x14a0,0x8e));var _0x014a=function(_0x1fe705,_0x2ed051){_0x1fe705=_0x1fe705-0x0;var _0x41e937=_0x14a0[_0x1fe705];return _0x41e937;};'use strict';function Trigger(_0x1ee939){this['id']=_0x1ee939['id']||0x0;this[_0x014a('0x0')]=_0x1ee939[_0x014a('0x0')]||'';this[_0x014a('0x1')]=_0x1ee939[_0x014a('0x1')]||_0x014a('0x2');this[_0x014a('0x3')]=_0x1ee939[_0x014a('0x3')]||![];this['AllConditions']=_0x1ee939['AllConditions']||[];this[_0x014a('0x4')]=_0x1ee939[_0x014a('0x4')]||[];this[_0x014a('0x5')]=_0x1ee939['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0x5f66=['AllConditions','AnyConditions','Actions','name','channel','voice','status'];(function(_0x496738,_0x3f1a9f){var _0xee1381=function(_0x4dc50c){while(--_0x4dc50c){_0x496738['push'](_0x496738['shift']());}};_0xee1381(++_0x3f1a9f);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';function Trigger(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||_0x65f6('0x2');this[_0x65f6('0x3')]=_0x253044[_0x65f6('0x3')]||![];this['AllConditions']=_0x253044[_0x65f6('0x4')]||[];this['AnyConditions']=_0x253044[_0x65f6('0x5')]||[];this[_0x65f6('0x6')]=_0x253044['Actions']||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 978c752..c7be746 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 _0xa3dc=['registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','status','indexOf','split','host','port','domainport','refresh','stateRegistry'];(function(_0x28b684,_0x5d2bb3){var _0x3aa4ba=function(_0x48d4fa){while(--_0x48d4fa){_0x28b684['push'](_0x28b684['shift']());}};_0x3aa4ba(++_0x5d2bb3);}(_0xa3dc,0x1ad));var _0xca3d=function(_0x21fe12,_0x29aafd){_0x21fe12=_0x21fe12-0x0;var _0x503e30=_0xa3dc[_0x21fe12];return _0x503e30;};'use strict';function Trunk(_0x50d674){this['id']=_0x50d674['id']||0x0;this[_0xca3d('0x0')]=_0x50d674[_0xca3d('0x0')]||![];this[_0xca3d('0x1')]=_0x50d674[_0xca3d('0x1')]||'';this[_0xca3d('0x2')]=_0xca3d('0x3');this[_0xca3d('0x4')]=0x0;this[_0xca3d('0x5')]=_0xca3d('0x3');this['registry']=_0x50d674['registry']&&_0x50d674['registry'][_0xca3d('0x6')](':')?_0x50d674['registry'][_0xca3d('0x7')](':')[0x0]:'';this[_0xca3d('0x8')]='';this[_0xca3d('0x9')]='';this['domain']='';this[_0xca3d('0xa')]='';this[_0xca3d('0xb')]='';this[_0xca3d('0xc')]=_0xca3d('0x3');this[_0xca3d('0xd')]='';this[_0xca3d('0xe')]='';this[_0xca3d('0xf')]=_0x50d674[_0xca3d('0xf')]||'';}module[_0xca3d('0x10')]=Trunk; \ No newline at end of file +var _0xa7cf=['state','unknown','stateTime','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name'];(function(_0x2d926d,_0x106492){var _0x2aa16c=function(_0x19f303){while(--_0x19f303){_0x2d926d['push'](_0x2d926d['shift']());}};_0x2aa16c(++_0x106492);}(_0xa7cf,0x7c));var _0xfa7c=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0xa7cf[_0x15ea09];return _0x3e9c78;};'use strict';function Trunk(_0x5b17f5){this['id']=_0x5b17f5['id']||0x0;this[_0xfa7c('0x0')]=_0x5b17f5[_0xfa7c('0x0')]||![];this[_0xfa7c('0x1')]=_0x5b17f5['name']||'';this[_0xfa7c('0x2')]=_0xfa7c('0x3');this[_0xfa7c('0x4')]=0x0;this['status']=_0xfa7c('0x3');this[_0xfa7c('0x5')]=_0x5b17f5[_0xfa7c('0x5')]&&_0x5b17f5['registry'][_0xfa7c('0x6')](':')?_0x5b17f5[_0xfa7c('0x5')][_0xfa7c('0x7')](':')[0x0]:'';this[_0xfa7c('0x8')]='';this[_0xfa7c('0x9')]='';this[_0xfa7c('0xa')]='';this[_0xfa7c('0xb')]='';this[_0xfa7c('0xc')]='';this[_0xfa7c('0xd')]=_0xfa7c('0x3');this[_0xfa7c('0xe')]='';this[_0xfa7c('0xf')]='';this[_0xfa7c('0x10')]=_0x5b17f5['defaultuser']||'';}module[_0xfa7c('0x11')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index e3c4540..2677134 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 _0x0f1b=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x3c8a57,_0x4a95e3){var _0x4a9a0e=function(_0xe80153){while(--_0xe80153){_0x3c8a57['push'](_0x3c8a57['shift']());}};_0x4a9a0e(++_0x4a95e3);}(_0x0f1b,0x18c));var _0xb0f1=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x0f1b[_0x411017];return _0x2adeea;};'use strict';function voiceExtension(_0x51f876){this['id']=_0x51f876['id']||0x0;this[_0xb0f1('0x0')]=_0x51f876[_0xb0f1('0x0')]||'';this['recordingFormat']=_0x51f876[_0xb0f1('0x1')]||_0xb0f1('0x2');this['mandatoryDisposition']=_0x51f876[_0xb0f1('0x3')]||![];}module[_0xb0f1('0x4')]=voiceExtension; \ No newline at end of file +var _0x8c85=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8c85,0x1ea));var _0x58c8=function(_0x560b45,_0x159cff){_0x560b45=_0x560b45-0x0;var _0x474278=_0x8c85[_0x560b45];return _0x474278;};'use strict';function voiceExtension(_0x5a6b63){this['id']=_0x5a6b63['id']||0x0;this[_0x58c8('0x0')]=_0x5a6b63[_0x58c8('0x0')]||'';this[_0x58c8('0x1')]=_0x5a6b63[_0x58c8('0x1')]||_0x58c8('0x2');this[_0x58c8('0x3')]=_0x5a6b63[_0x58c8('0x3')]||![];}module[_0x58c8('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 3b45e66..d1b7935 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 _0x151a=['tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','gsm','fewestcalls','leastrecent','linear','random','roundrobin','rrordered','wrandom','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','sumBillable','available','busy','inUse','invalid','loggedIn','notInUse','onHold','ringing','ringInUse','talking','unknown','acw','acwTimeout','autopause','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions'];(function(_0x2d40fb,_0x2f29ef){var _0x177d4a=function(_0x5a9a7e){while(--_0x5a9a7e){_0x2d40fb['push'](_0x2d40fb['shift']());}};_0x177d4a(++_0x2f29ef);}(_0x151a,0xcb));var _0xa151=function(_0x1c37fe,_0x10a098){_0x1c37fe=_0x1c37fe-0x0;var _0x45e904=_0x151a[_0x1c37fe];return _0x45e904;};'use strict';var monitorFormat={'wav':'wav','wav49':'wav49','gsm':_0xa151('0x0')};var strategy={'fewestcalls':_0xa151('0x1'),'leastrecent':_0xa151('0x2'),'linear':_0xa151('0x3'),'random':_0xa151('0x4'),'ringall':'ringall','rr':_0xa151('0x5'),'rrmemory':'rrmemory','rrordered':_0xa151('0x6'),'wrandom':_0xa151('0x7')};function VoiceQueue(_0x1af1e2){this['id']=_0x1af1e2['id']||0x0;this['name']=_0x1af1e2['name']||'';this['monitor_format']=_0x1af1e2[_0xa151('0x8')]||'';this[_0xa151('0x9')]=_0x1af1e2[_0xa151('0x9')]||_0xa151('0xa');this[_0xa151('0xb')]=0x0;this[_0xa151('0xc')]=0x0;this[_0xa151('0xd')]=0x0;this['sumDuration']=0x0;this[_0xa151('0xe')]=0x0;this[_0xa151('0xf')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0xa151('0x10')]=0x0;this[_0xa151('0x11')]=0x0;this[_0xa151('0x12')]=0x0;this[_0xa151('0x13')]=0x0;this[_0xa151('0x14')]=0x0;this[_0xa151('0x15')]=0x0;this[_0xa151('0x16')]=0x0;this['paused']=0x0;this[_0xa151('0x17')]=0x0;this[_0xa151('0x18')]=0x0;this[_0xa151('0x19')]=0x0;this['unavailable']=0x0;this[_0xa151('0x1a')]=0x0;this[_0xa151('0x1b')]=_0x1af1e2['acw']||![];this['acwTimeout']=_0x1af1e2[_0xa151('0x1c')]||0xa;this[_0xa151('0x1d')]=_0x1af1e2[_0xa151('0x1d')]||'no';this['sendMessageOneNotActive']=!![];this[_0xa151('0x1e')]='';this[_0xa151('0x1f')]='';this[_0xa151('0x20')]=0x0;this[_0xa151('0x21')]=0x0;this[_0xa151('0x22')]=_0x1af1e2[_0xa151('0x22')]||null;this['dialGlobalInterval']=_0x1af1e2[_0xa151('0x23')]?_0x1af1e2[_0xa151('0x23')]:null;this[_0xa151('0x24')]=_0x1af1e2[_0xa151('0x24')];this[_0xa151('0x25')]=_0x1af1e2[_0xa151('0x25')]||_0xa151('0x26');this[_0xa151('0x27')]=_0x1af1e2[_0xa151('0x27')]||0x0;this[_0xa151('0x28')]=_0x1af1e2['dialLimitQueue']||0x0;this[_0xa151('0x29')]=_0x1af1e2['dialPowerLevel']||0x1;this[_0xa151('0x2a')]=_0x1af1e2[_0xa151('0x2a')]||_0xa151('0x2b');this[_0xa151('0x2c')]=_0x1af1e2[_0xa151('0x2c')]||0.03;this[_0xa151('0x2d')]=_0x1af1e2[_0xa151('0x2d')]||0x258;this[_0xa151('0x2e')]=_0x1af1e2[_0xa151('0x2e')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x1af1e2[_0xa151('0x2f')]||_0xa151('0x30');this[_0xa151('0x31')]=_0x1af1e2[_0xa151('0x31')]||0x1e;this['dialQueueOptions']=_0x1af1e2[_0xa151('0x32')]||_0xa151('0x33');this[_0xa151('0x34')]=_0x1af1e2['dialQueueTimeout']||0x3;this[_0xa151('0x35')]=_0x1af1e2[_0xa151('0x35')]||undefined;this['dialCongestionMaxRetry']=_0x1af1e2[_0xa151('0x36')]||0x3;this[_0xa151('0x37')]=_0x1af1e2['dialCongestionRetryFrequency']||0x96;this[_0xa151('0x38')]=_0x1af1e2[_0xa151('0x38')]||0x3;this[_0xa151('0x39')]=_0x1af1e2['dialBusyRetryFrequency']||0x96;this[_0xa151('0x3a')]=_0x1af1e2[_0xa151('0x3a')]||0x3;this[_0xa151('0x3b')]=_0x1af1e2[_0xa151('0x3b')]||0x96;this[_0xa151('0x3c')]=_0x1af1e2[_0xa151('0x3c')]||0x3;this[_0xa151('0x3d')]=_0x1af1e2[_0xa151('0x3d')]||0x96;this[_0xa151('0x3e')]=_0x1af1e2[_0xa151('0x3e')]||0x3;this[_0xa151('0x3f')]=_0x1af1e2[_0xa151('0x3f')]||0x96;this['dialAbandonedMaxRetry']=_0x1af1e2[_0xa151('0x40')]||0x3;this['dialAbandonedRetryFrequency']=_0x1af1e2['dialAbandonedRetryFrequency']||0x96;this[_0xa151('0x41')]=_0x1af1e2[_0xa151('0x41')]||0x3;this[_0xa151('0x42')]=_0x1af1e2['dialMachineRetryFrequency']||0x96;this[_0xa151('0x43')]=_0x1af1e2[_0xa151('0x43')]||0x3;this[_0xa151('0x44')]=_0x1af1e2[_0xa151('0x44')]||0x96;this[_0xa151('0x45')]=_0x1af1e2[_0xa151('0x45')]||0x3;this[_0xa151('0x46')]=_0x1af1e2['dialGlobalMaxRetry']||0x4;this[_0xa151('0x47')]=_0x1af1e2[_0xa151('0x47')]?_0x1af1e2[_0xa151('0x47')]:undefined;this[_0xa151('0x48')]=_0x1af1e2[_0xa151('0x48')]?_0x1af1e2['TrunkBackup']:undefined;this[_0xa151('0x49')]=_0x1af1e2[_0xa151('0x49')]||undefined;this[_0xa151('0x4a')]=_0x1af1e2[_0xa151('0x4a')]?_0x1af1e2[_0xa151('0x4a')]:undefined;this['dialOrderByScheduledAt']=_0x1af1e2['dialOrderByScheduledAt']||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x1af1e2['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xa151('0x4b')]=_0x1af1e2[_0xa151('0x4b')]||undefined;this[_0xa151('0x4c')]=strategy[_0x1af1e2[_0xa151('0x4c')]];this[_0xa151('0x4d')]=!![];this[_0xa151('0x4e')]=_0x1af1e2[_0xa151('0x4e')]||![];this[_0xa151('0x4f')]=_0x1af1e2[_0xa151('0x4f')];this[_0xa151('0x50')]=_0x1af1e2[_0xa151('0x50')];this[_0xa151('0x51')]=_0x1af1e2[_0xa151('0x51')];this[_0xa151('0x52')]=_0x1af1e2[_0xa151('0x52')];this[_0xa151('0x53')]=_0x1af1e2[_0xa151('0x53')];this[_0xa151('0x54')]=_0x1af1e2[_0xa151('0x54')];this['dialAMDMaximumNumberOfWords']=_0x1af1e2[_0xa151('0x55')];this[_0xa151('0x56')]=_0x1af1e2['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x1af1e2['dialAMDMaximumWordLength'];this[_0xa151('0x57')]=0x0;this[_0xa151('0x58')]=0x0;this['timeout']=_0x1af1e2['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0xa151('0x59')]=0x0;this[_0xa151('0x5a')]=0x0;this[_0xa151('0x5b')]=0x0;this[_0xa151('0x5c')]=0x0;this[_0xa151('0x5d')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xa151('0x5e')]=0x0;this[_0xa151('0x5f')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xa151('0x60')]=0x0;this[_0xa151('0x61')]=0x0;this[_0xa151('0x62')]=0x0;this['outboundAbandonedDay']=0x0;this[_0xa151('0x63')]=undefined;this[_0xa151('0x64')]=undefined;this['handlePredictive']=undefined;this[_0xa151('0x65')]=1.05;this[_0xa151('0x66')]=0x0;this[_0xa151('0x67')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xa151('0x68')]=0x0;this[_0xa151('0x69')]=0x0;this[_0xa151('0x6a')]=0x0;this[_0xa151('0x6b')]=0x0;this[_0xa151('0x6c')]=0x0;this[_0xa151('0x6d')]=_0x1af1e2[_0xa151('0x6e')]||0x14;this[_0xa151('0x6f')]=_0x1af1e2[_0xa151('0x6e')]||0xa;this[_0xa151('0x70')]=0x0;this[_0xa151('0x71')]=0x0;this[_0xa151('0x72')]=0x1;this[_0xa151('0x73')]=0x0;this[_0xa151('0x74')]=0x0;this[_0xa151('0x75')]=0x0;this['erlangBusyFactor']=0x0;this[_0xa151('0x76')]=_0x1af1e2[_0xa151('0x76')]||0x1e;this['dialRecallInQueue']=_0x1af1e2['dialRecallInQueue']||![];this['dialPreviewAutoRecallMe']=!!_0x1af1e2[_0xa151('0x77')]||![];this['dialPreviewRecallmeReminder']=!!_0x1af1e2[_0xa151('0x78')]||![];this[_0xa151('0x79')]=_0x1af1e2[_0xa151('0x79')]||undefined;this['dialAgiAfterHangupClient']=_0x1af1e2[_0xa151('0x7a')]||![];this[_0xa151('0x7b')]=_0x1af1e2['dialAgiAfterHangupAgent']||![];this[_0xa151('0x8')]=monitorFormat[_0x1af1e2[_0xa151('0x8')]]?monitorFormat[_0x1af1e2[_0xa151('0x8')]]:undefined;this[_0xa151('0x7c')]=_0x1af1e2[_0xa151('0x7c')]||![];this[_0xa151('0x7d')]=_0x1af1e2['mandatoryDispositionPause']?_0x1af1e2[_0xa151('0x7d')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0xa151('0x7e')]=VoiceQueue; \ No newline at end of file +var _0x4384=['available','busy','inUse','invalid','notInUse','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','fewestcalls','leastrecent','ringall','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','total','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x4384,0x6d));var _0x4438=function(_0xc13402,_0x1b3c4f){_0xc13402=_0xc13402-0x0;var _0x3f1fca=_0x4384[_0xc13402];return _0x3f1fca;};'use strict';var monitorFormat={'wav':_0x4438('0x0'),'wav49':_0x4438('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0x4438('0x2'),'leastrecent':_0x4438('0x3'),'linear':'linear','random':'random','ringall':_0x4438('0x4'),'rr':'roundrobin','rrmemory':_0x4438('0x5'),'rrordered':_0x4438('0x6'),'wrandom':_0x4438('0x7')};function VoiceQueue(_0x80152a){this['id']=_0x80152a['id']||0x0;this[_0x4438('0x8')]=_0x80152a[_0x4438('0x8')]||'';this['monitor_format']=_0x80152a[_0x4438('0x9')]||'';this[_0x4438('0xa')]=_0x80152a[_0x4438('0xa')]||_0x4438('0xb');this['waiting']=0x0;this[_0x4438('0xc')]=0x0;this['answered']=0x0;this[_0x4438('0xd')]=0x0;this[_0x4438('0xe')]=0x0;this[_0x4438('0xf')]=0x0;this[_0x4438('0x10')]=0x0;this[_0x4438('0x11')]=0x0;this[_0x4438('0x12')]=0x0;this[_0x4438('0x13')]=0x0;this[_0x4438('0x14')]=0x0;this[_0x4438('0x15')]=0x0;this['loggedIn']=0x0;this[_0x4438('0x16')]=0x0;this['onHold']=0x0;this['paused']=0x0;this['ringing']=0x0;this[_0x4438('0x17')]=0x0;this[_0x4438('0x18')]=0x0;this[_0x4438('0x19')]=0x0;this[_0x4438('0x1a')]=0x0;this[_0x4438('0x1b')]=_0x80152a['acw']||![];this[_0x4438('0x1c')]=_0x80152a['acwTimeout']||0xa;this['autopause']=_0x80152a[_0x4438('0x1d')]||'no';this[_0x4438('0x1e')]=!![];this['message']='';this[_0x4438('0x1f')]='';this['originated']=0x0;this[_0x4438('0x20')]=0x0;this['dialTimezone']=_0x80152a[_0x4438('0x21')]||null;this[_0x4438('0x22')]=_0x80152a['dialGlobalInterval']?_0x80152a[_0x4438('0x22')]:null;this[_0x4438('0x23')]=_0x80152a['dialActive'];this['dialMethod']=_0x80152a[_0x4438('0x24')]||_0x4438('0x25');this['dialLimitChannel']=_0x80152a[_0x4438('0x26')]||0x0;this[_0x4438('0x27')]=_0x80152a[_0x4438('0x27')]||0x0;this[_0x4438('0x28')]=_0x80152a[_0x4438('0x28')]||0x1;this[_0x4438('0x29')]=_0x80152a[_0x4438('0x29')]||'dropRate';this[_0x4438('0x2a')]=_0x80152a[_0x4438('0x2a')]||0.03;this[_0x4438('0x2b')]=_0x80152a[_0x4438('0x2b')]||0x258;this[_0x4438('0x2c')]=_0x80152a['dialOriginateCallerIdName']||_0x4438('0x2d');this[_0x4438('0x2e')]=_0x80152a[_0x4438('0x2e')]||_0x4438('0x2d');this['dialOriginateTimeout']=_0x80152a[_0x4438('0x2f')]||0x1e;this[_0x4438('0x30')]=_0x80152a[_0x4438('0x30')]||_0x4438('0x31');this[_0x4438('0x32')]=_0x80152a['dialQueueTimeout']||0x3;this[_0x4438('0x33')]=_0x80152a['dialQueueProject']||undefined;this[_0x4438('0x34')]=_0x80152a[_0x4438('0x34')]||0x3;this[_0x4438('0x35')]=_0x80152a[_0x4438('0x35')]||0x96;this['dialBusyMaxRetry']=_0x80152a['dialBusyMaxRetry']||0x3;this[_0x4438('0x36')]=_0x80152a['dialBusyRetryFrequency']||0x96;this[_0x4438('0x37')]=_0x80152a[_0x4438('0x37')]||0x3;this[_0x4438('0x38')]=_0x80152a[_0x4438('0x38')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x80152a[_0x4438('0x39')]||0x3;this[_0x4438('0x3a')]=_0x80152a['dialNoSuchNumberRetryFrequency']||0x96;this[_0x4438('0x3b')]=_0x80152a[_0x4438('0x3b')]||0x3;this[_0x4438('0x3c')]=_0x80152a[_0x4438('0x3c')]||0x96;this[_0x4438('0x3d')]=_0x80152a[_0x4438('0x3d')]||0x3;this[_0x4438('0x3e')]=_0x80152a[_0x4438('0x3e')]||0x96;this['dialMachineMaxRetry']=_0x80152a['dialMachineMaxRetry']||0x3;this[_0x4438('0x3f')]=_0x80152a[_0x4438('0x3f')]||0x96;this[_0x4438('0x40')]=_0x80152a[_0x4438('0x40')]||0x3;this['dialAgentRejectRetryFrequency']=_0x80152a[_0x4438('0x41')]||0x96;this['callAdditionalPhoneAfterMin']=_0x80152a[_0x4438('0x42')]||0x3;this['dialGlobalMaxRetry']=_0x80152a[_0x4438('0x43')]||0x4;this[_0x4438('0x44')]=_0x80152a[_0x4438('0x44')]?_0x80152a[_0x4438('0x44')]:undefined;this[_0x4438('0x45')]=_0x80152a['TrunkBackup']?_0x80152a[_0x4438('0x45')]:undefined;this[_0x4438('0x46')]=_0x80152a[_0x4438('0x46')]||undefined;this[_0x4438('0x47')]=_0x80152a[_0x4438('0x47')]?_0x80152a[_0x4438('0x47')]:undefined;this['dialOrderByScheduledAt']=_0x80152a[_0x4438('0x48')]||'DESC';this[_0x4438('0x49')]=_0x80152a['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x4438('0x4a')]=_0x80152a['dialCutDigit']||undefined;this['strategy']=strategy[_0x80152a[_0x4438('0x4b')]];this[_0x4438('0x4c')]=!![];this['dialAMDActive']=_0x80152a[_0x4438('0x4d')]||![];this[_0x4438('0x4e')]=_0x80152a[_0x4438('0x4e')];this['dialAMDGreeting']=_0x80152a[_0x4438('0x4f')];this['dialAMDAfterGreetingSilence']=_0x80152a[_0x4438('0x50')];this[_0x4438('0x51')]=_0x80152a['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x80152a[_0x4438('0x52')];this[_0x4438('0x53')]=_0x80152a[_0x4438('0x53')];this[_0x4438('0x54')]=_0x80152a[_0x4438('0x54')];this[_0x4438('0x55')]=_0x80152a['dialAMDSilenceThreshold'];this[_0x4438('0x56')]=_0x80152a[_0x4438('0x56')];this['outboundRejectCallsDay']=0x0;this[_0x4438('0x57')]=0x0;this[_0x4438('0x58')]=_0x80152a[_0x4438('0x58')];this[_0x4438('0x59')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x4438('0x5a')]=0x0;this[_0x4438('0x5b')]=0x0;this[_0x4438('0x5c')]=0x0;this[_0x4438('0x5d')]=0x0;this[_0x4438('0x5e')]=0x0;this[_0x4438('0x5f')]=0x0;this[_0x4438('0x60')]=0x0;this[_0x4438('0x61')]=0x0;this[_0x4438('0x62')]=0x0;this[_0x4438('0x63')]=0x0;this['outboundReCallsDay']=0x0;this[_0x4438('0x64')]=0x0;this[_0x4438('0x65')]=undefined;this[_0x4438('0x66')]=undefined;this[_0x4438('0x67')]=undefined;this[_0x4438('0x68')]=1.05;this[_0x4438('0x69')]=0x0;this[_0x4438('0x6a')]=0x0;this[_0x4438('0x6b')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x4438('0x6c')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x4438('0x6d')]=0x0;this[_0x4438('0x6e')]=0x0;this['predictiveIntervalMaxThreshold']=_0x80152a['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x4438('0x6f')]=_0x80152a[_0x4438('0x70')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x4438('0x71')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x4438('0x72')]=0x0;this['erlangCallToSecond']=0x0;this[_0x4438('0x73')]=0x0;this[_0x4438('0x74')]=0x0;this['dialRecallMeTimeout']=_0x80152a[_0x4438('0x75')]||0x1e;this['dialRecallInQueue']=_0x80152a[_0x4438('0x76')]||![];this['dialPreviewAutoRecallMe']=!!_0x80152a['dialPreviewAutoRecallMe']||![];this[_0x4438('0x77')]=!!_0x80152a['dialPreviewRecallmeReminder']||![];this[_0x4438('0x78')]=_0x80152a[_0x4438('0x78')]||undefined;this[_0x4438('0x79')]=_0x80152a['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x80152a[_0x4438('0x7a')]||![];this[_0x4438('0x9')]=monitorFormat[_0x80152a[_0x4438('0x9')]]?monitorFormat[_0x80152a[_0x4438('0x9')]]:undefined;this[_0x4438('0x7b')]=_0x80152a['mandatoryDisposition']||![];this[_0x4438('0x7c')]=_0x80152a[_0x4438('0x7c')]?_0x80152a[_0x4438('0x7c')]:undefined;this[_0x4438('0x7d')]=![];}module[_0x4438('0x7e')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 657758a..bd5ab28 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 _0xa630=['startPredictive','startProgressive','statusMessage','Trunk','active','prototype','createReport','loggedin','callers','SIP/','online','incall','includes','status','dialMethod','booked','dialer','exten','some','message','outboundAbandonedCallsDay','exports','available','loggedIn','ringing','waiting','answered','inUse','loggedInDb','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','paused','pTalking','talking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor'];(function(_0x485c12,_0x63ee16){var _0x5c87ad=function(_0x5bb3cf){while(--_0x5bb3cf){_0x485c12['push'](_0x485c12['shift']());}};_0x5c87ad(++_0x63ee16);}(_0xa630,0xbe));var _0x0a63=function(_0x140fcf,_0x16b285){_0x140fcf=_0x140fcf-0x0;var _0x10b984=_0xa630[_0x140fcf];return _0x10b984;};'use strict';var INBOUND_COUNTERS=[_0x0a63('0x0'),_0x0a63('0x1'),'loggedInDb','paused',_0x0a63('0x2'),'talking',_0x0a63('0x3')];var OUTBOUND_COUNTERS=['available',_0x0a63('0x4'),_0x0a63('0x5'),_0x0a63('0x1'),_0x0a63('0x6'),_0x0a63('0x7'),'outboundAbandonedCallsDay',_0x0a63('0x8'),_0x0a63('0x9'),_0x0a63('0xa'),_0x0a63('0xb'),_0x0a63('0xc'),_0x0a63('0xd'),'outboundReCallsDay',_0x0a63('0xe'),_0x0a63('0xf'),_0x0a63('0x10'),_0x0a63('0x11'),_0x0a63('0x12'),_0x0a63('0x13'),_0x0a63('0x14'),_0x0a63('0x15'),_0x0a63('0x3')];function VoiceQueueSummary(_0x1bbf75){this['id']=_0x1bbf75['id'];this['name']=_0x1bbf75[_0x0a63('0x16')];this[_0x0a63('0x17')]=_0x1bbf75[_0x0a63('0x17')];this[_0x0a63('0x18')]=_0x1bbf75['abandoned']||0x0;this[_0x0a63('0x4')]=_0x1bbf75['answered']||0x0;this[_0x0a63('0x0')]=_0x1bbf75[_0x0a63('0x0')]||0x0;this[_0x0a63('0x19')]=_0x1bbf75[_0x0a63('0x19')]||0x0;this[_0x0a63('0x5')]=_0x1bbf75[_0x0a63('0x5')]||0x0;this[_0x0a63('0x1a')]=_0x1bbf75[_0x0a63('0x1a')]||0x0;this['loggedIn']=_0x1bbf75[_0x0a63('0x1')]||0x0;this['loggedInDb']=_0x1bbf75[_0x0a63('0x6')]||0x0;this[_0x0a63('0x1b')]=_0x1bbf75[_0x0a63('0x1b')]||0x0;this[_0x0a63('0x1c')]=_0x1bbf75[_0x0a63('0x1c')]||0x0;this[_0x0a63('0x10')]=_0x1bbf75[_0x0a63('0x10')]||0x0;this[_0x0a63('0x2')]=_0x1bbf75[_0x0a63('0x2')]||0x0;this[_0x0a63('0x1d')]=_0x1bbf75[_0x0a63('0x1d')];this['sumBillable']=_0x1bbf75['sumBillable'];this[_0x0a63('0x14')]=_0x1bbf75['sumDuration'];this[_0x0a63('0x1e')]=_0x1bbf75['sumHoldTime']||0x0;this[_0x0a63('0x12')]=_0x1bbf75[_0x0a63('0x12')]||0x0;this[_0x0a63('0x15')]=_0x1bbf75[_0x0a63('0x15')]||0x0;this['type']=_0x1bbf75[_0x0a63('0x1f')];this['unavailable']=_0x1bbf75[_0x0a63('0x20')]||0x0;this[_0x0a63('0x21')]=_0x1bbf75[_0x0a63('0x21')]||0x0;this[_0x0a63('0x22')]=_0x1bbf75[_0x0a63('0x22')]||0x0;this[_0x0a63('0x3')]=_0x1bbf75[_0x0a63('0x3')]||0x0;if(_0x1bbf75[_0x0a63('0x1f')]==='outbound'){this['pTalking']=_0x1bbf75['pTalking']||0x0;this['dialActive']=_0x1bbf75[_0x0a63('0x23')];this['dialMethod']=_0x1bbf75['dialMethod'];this[_0x0a63('0x24')]=_0x1bbf75[_0x0a63('0x24')];this[_0x0a63('0x25')]=_0x1bbf75[_0x0a63('0x25')];this['dialOriginateTimeout']=_0x1bbf75[_0x0a63('0x26')];this[_0x0a63('0x27')]=_0x1bbf75[_0x0a63('0x27')];this['temp']=_0x1bbf75[_0x0a63('0x28')];this[_0x0a63('0x29')]=_0x1bbf75[_0x0a63('0x29')];this[_0x0a63('0x8')]=_0x1bbf75[_0x0a63('0x8')];this[_0x0a63('0x9')]=_0x1bbf75[_0x0a63('0x9')];this[_0x0a63('0xa')]=_0x1bbf75['outboundBusyCallsDay'];this[_0x0a63('0xb')]=_0x1bbf75['outboundCongestionCallsDay'];this[_0x0a63('0x2a')]=_0x1bbf75[_0x0a63('0x2a')];this[_0x0a63('0x2b')]=_0x1bbf75[_0x0a63('0x2b')];this[_0x0a63('0x2c')]=_0x1bbf75['outboundDropCallsDayTimeout'];this[_0x0a63('0xc')]=_0x1bbf75[_0x0a63('0xc')];this[_0x0a63('0xd')]=_0x1bbf75[_0x0a63('0xd')];this['outboundOriginateFailureCallsDay']=_0x1bbf75[_0x0a63('0x2d')];this[_0x0a63('0x2e')]=_0x1bbf75['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x1bbf75[_0x0a63('0xe')];this['outboundUnknownCallsDay']=_0x1bbf75['outboundUnknownCallsDay'];this[_0x0a63('0x2f')]=_0x1bbf75[_0x0a63('0x2f')];this['predictiveIntervalAvgHoldtime']=_0x1bbf75[_0x0a63('0x30')];this[_0x0a63('0x31')]=_0x1bbf75[_0x0a63('0x31')];this[_0x0a63('0x32')]=_0x1bbf75[_0x0a63('0x32')];this['predictiveIntervalDroppedCallsTimeout']=_0x1bbf75['predictiveIntervalDroppedCallsTimeout'];this[_0x0a63('0x33')]=_0x1bbf75[_0x0a63('0x33')];this[_0x0a63('0x34')]=_0x1bbf75[_0x0a63('0x34')];this[_0x0a63('0x35')]=_0x1bbf75[_0x0a63('0x35')];this['predictiveIntervalMultiplicativeFactor']=_0x1bbf75[_0x0a63('0x36')];this[_0x0a63('0x37')]=_0x1bbf75['predictiveIntervalPauses'];this[_0x0a63('0x38')]=_0x1bbf75['predictiveIntervalAvailable'];this['predictiveIntervalTotalCalls']=_0x1bbf75[_0x0a63('0x39')];this[_0x0a63('0x7')]=_0x1bbf75[_0x0a63('0x7')];this['erlangCalls']=_0x1bbf75[_0x0a63('0x3a')];this[_0x0a63('0x3b')]=_0x1bbf75[_0x0a63('0x3b')];this[_0x0a63('0x3c')]=_0x1bbf75[_0x0a63('0x3c')];this[_0x0a63('0x3d')]=_0x1bbf75[_0x0a63('0x3d')];this['startPredictive']=_0x1bbf75[_0x0a63('0x3e')];this[_0x0a63('0x3f')]=_0x1bbf75[_0x0a63('0x3f')];this['message']=_0x1bbf75['message'];this[_0x0a63('0x40')]=_0x1bbf75['statusMessage'];}if(_0x1bbf75[_0x0a63('0x41')]){this[_0x0a63('0x41')]={'id':_0x1bbf75[_0x0a63('0x41')]['id'],'name':_0x1bbf75['Trunk'][_0x0a63('0x16')],'active':_0x1bbf75[_0x0a63('0x41')][_0x0a63('0x42')],'callerid':_0x1bbf75[_0x0a63('0x41')]['callerid']};}}VoiceQueueSummary[_0x0a63('0x43')][_0x0a63('0x44')]=function(_0x4234cd,_0x2ccd99,_0xf18ace,_0x38cfe4){this['loggedInDb']=0x0;this[_0x0a63('0x12')]=0x0;this[_0x0a63('0x10')]=0x0;this[_0x0a63('0x21')]=0x0;this[_0x0a63('0x1c')]=0x0;this[_0x0a63('0x5')]=0x0;this[_0x0a63('0x19')]=0x0;this[_0x0a63('0x1a')]=0x0;this[_0x0a63('0x20')]=0x0;this[_0x0a63('0x2')]=0x0;this[_0x0a63('0x1d')]=0x0;this[_0x0a63('0x1b')]=0x0;if(_0xf18ace){if(_0xf18ace[_0x0a63('0x0')]){this[_0x0a63('0x0')]=Number(_0xf18ace[_0x0a63('0x0')]);}if(_0xf18ace[_0x0a63('0x45')]){this[_0x0a63('0x1')]=Number(_0xf18ace[_0x0a63('0x45')]);}if(_0xf18ace[_0x0a63('0x46')]){this['waiting']=Number(_0xf18ace[_0x0a63('0x46')]);}}for(var _0x5ef4e9=0x0;_0x5ef4e9<_0x4234cd['length'];_0x5ef4e9++){var _0xd9eddc=_0x2ccd99[_0x0a63('0x47')+_0x4234cd[_0x5ef4e9][_0x0a63('0x16')]];if(_0xd9eddc&&_0xd9eddc[_0x0a63('0x48')]){this[_0x0a63('0x6')]+=0x1;}if(_0x4234cd[_0x5ef4e9][_0x0a63('0x49')]==='1'){this[_0x0a63('0x12')]+=0x1;}if(_0x4234cd[_0x5ef4e9][_0x0a63('0x10')]==='1'&&!['2','7','8'][_0x0a63('0x4a')](_0x4234cd[_0x5ef4e9][_0x0a63('0x4b')])){this[_0x0a63('0x10')]+=0x1;}switch(_0x4234cd[_0x5ef4e9][_0x0a63('0x4b')]){case'0':this[_0x0a63('0x21')]+=0x1;break;case'1':this[_0x0a63('0x1c')]+=0x1;break;case'2':this[_0x0a63('0x5')]+=0x1;break;case'3':this[_0x0a63('0x19')]+=0x1;break;case'4':this[_0x0a63('0x1a')]+=0x1;break;case'5':this[_0x0a63('0x20')]+=0x1;break;case'6':this[_0x0a63('0x2')]+=0x1;break;case'7':this[_0x0a63('0x1d')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x0a63('0x4c')]===_0x0a63('0x4d')){var _0x5905ce=Object['keys'](_0x38cfe4);for(var _0x58e686=0x0;_0x58e686<_0x5905ce['length'];_0x58e686++){var _0x36d066=_0x5905ce[_0x58e686];var _0x85fcf=_0x38cfe4[_0x36d066];if(_0x85fcf['queue']===this[_0x0a63('0x16')]&&_0x85fcf['type']===_0x0a63('0x4e')&&_0x85fcf[_0x0a63('0x4f')]==='xcally-motion-preview'){this['talking']+=0x1;}}if(this['talking']>this[_0x0a63('0x5')]){this[_0x0a63('0x12')]=this[_0x0a63('0x5')];}this[_0x0a63('0x11')]=0x0;}return this;};VoiceQueueSummary[_0x0a63('0x43')]['compareToInboundQueue']=function(_0x1d6008){var _0x38327a=![];if(_0x1d6008){_0x38327a=INBOUND_COUNTERS[_0x0a63('0x50')](function(_0x10adf1){return this[_0x10adf1]!==_0x1d6008[_0x10adf1];},this);}return _0x38327a;};VoiceQueueSummary[_0x0a63('0x43')]['compareToOutboundQueue']=function(_0x2f7208){var _0x3c9326=![];var _0x393996=![];var _0x1fbd2b=![];if(_0x2f7208){_0x3c9326=this['dialMethod']!==_0x2f7208[_0x0a63('0x4c')]||this[_0x0a63('0x23')]!==_0x2f7208[_0x0a63('0x23')]||this[_0x0a63('0x51')]!==_0x2f7208[_0x0a63('0x51')]||this[_0x0a63('0x40')]!==_0x2f7208['statusMessage'];_0x393996=OUTBOUND_COUNTERS[_0x0a63('0x50')](function(_0x200523){return this[_0x200523]!==_0x2f7208[_0x200523];},this);if(this[_0x0a63('0x41')]&&_0x2f7208[_0x0a63('0x41')]){_0x1fbd2b=this['Trunk']['name']!==_0x2f7208[_0x0a63('0x41')][_0x0a63('0x16')]||this[_0x0a63('0x41')][_0x0a63('0x42')]!==_0x2f7208[_0x0a63('0x41')]['active'];}}return _0x3c9326||_0x393996||_0x1fbd2b;};VoiceQueueSummary['prototype']['updateReportFromOutboundQueue']=function(_0x42c1bb){this['answered']=_0x42c1bb[_0x0a63('0x4')];this[_0x0a63('0x51')]=_0x42c1bb[_0x0a63('0x51')];this['statusMessage']=_0x42c1bb['statusMessage'];this[_0x0a63('0x7')]=_0x42c1bb[_0x0a63('0x7')];this[_0x0a63('0x52')]=_0x42c1bb[_0x0a63('0x52')];this[_0x0a63('0x8')]=_0x42c1bb[_0x0a63('0x8')];this[_0x0a63('0x9')]=_0x42c1bb[_0x0a63('0x9')];this[_0x0a63('0xa')]=_0x42c1bb[_0x0a63('0xa')];this[_0x0a63('0xb')]=_0x42c1bb[_0x0a63('0xb')];this[_0x0a63('0xc')]=_0x42c1bb[_0x0a63('0xc')];this['outboundNoSuchCallsDay']=_0x42c1bb['outboundNoSuchCallsDay'];this[_0x0a63('0x2e')]=_0x42c1bb[_0x0a63('0x2e')];this['outboundRejectCallsDay']=_0x42c1bb[_0x0a63('0xe')];this[_0x0a63('0xf')]=_0x42c1bb['outboundUnknownCallsDay'];this[_0x0a63('0x13')]=_0x42c1bb[_0x0a63('0x13')];this['sumDuration']=_0x42c1bb['sumDuration'];this[_0x0a63('0x15')]=_0x42c1bb[_0x0a63('0x15')];if(this[_0x0a63('0x4c')]==='preview'){this[_0x0a63('0x11')]=_0x42c1bb[_0x0a63('0x11')];}};module[_0x0a63('0x53')]=VoiceQueueSummary; \ No newline at end of file +var _0xab36=['message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','incall','status','booked','keys','queue','dialer','exten','some','compareToOutboundQueue','updateReportFromOutboundQueue','preview','exports','available','loggedIn','loggedInDb','paused','ringing','waiting','answered','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','talking','sumBillable','sumDuration','name','strategy','abandoned','busy','inUse','invalid','onHold','notInUse','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive'];(function(_0x3fe44b,_0x5c0687){var _0x5cfeec=function(_0x71133e){while(--_0x71133e){_0x3fe44b['push'](_0x3fe44b['shift']());}};_0x5cfeec(++_0x5c0687);}(_0xab36,0x1df));var _0x6ab3=function(_0x3ad20,_0x3efbea){_0x3ad20=_0x3ad20-0x0;var _0x468f48=_0xab36[_0x3ad20];return _0x468f48;};'use strict';var INBOUND_COUNTERS=[_0x6ab3('0x0'),_0x6ab3('0x1'),_0x6ab3('0x2'),_0x6ab3('0x3'),_0x6ab3('0x4'),'talking',_0x6ab3('0x5')];var OUTBOUND_COUNTERS=[_0x6ab3('0x0'),_0x6ab3('0x6'),'inUse',_0x6ab3('0x1'),_0x6ab3('0x2'),_0x6ab3('0x7'),_0x6ab3('0x8'),_0x6ab3('0x9'),_0x6ab3('0xa'),'outboundBusyCallsDay',_0x6ab3('0xb'),_0x6ab3('0xc'),'outboundNoSuchCallsDay',_0x6ab3('0xd'),'outboundRejectCallsDay',_0x6ab3('0xe'),_0x6ab3('0x3'),_0x6ab3('0xf'),_0x6ab3('0x10'),_0x6ab3('0x11'),_0x6ab3('0x12'),'total',_0x6ab3('0x5')];function VoiceQueueSummary(_0x576723){this['id']=_0x576723['id'];this[_0x6ab3('0x13')]=_0x576723[_0x6ab3('0x13')];this[_0x6ab3('0x14')]=_0x576723[_0x6ab3('0x14')];this[_0x6ab3('0x15')]=_0x576723['abandoned']||0x0;this[_0x6ab3('0x6')]=_0x576723[_0x6ab3('0x6')]||0x0;this[_0x6ab3('0x0')]=_0x576723[_0x6ab3('0x0')]||0x0;this[_0x6ab3('0x16')]=_0x576723['busy']||0x0;this[_0x6ab3('0x17')]=_0x576723['inUse']||0x0;this[_0x6ab3('0x18')]=_0x576723[_0x6ab3('0x18')]||0x0;this[_0x6ab3('0x1')]=_0x576723[_0x6ab3('0x1')]||0x0;this[_0x6ab3('0x2')]=_0x576723[_0x6ab3('0x2')]||0x0;this[_0x6ab3('0x19')]=_0x576723[_0x6ab3('0x19')]||0x0;this[_0x6ab3('0x1a')]=_0x576723['notInUse']||0x0;this[_0x6ab3('0x3')]=_0x576723['paused']||0x0;this[_0x6ab3('0x4')]=_0x576723[_0x6ab3('0x4')]||0x0;this[_0x6ab3('0x1b')]=_0x576723[_0x6ab3('0x1b')];this[_0x6ab3('0x11')]=_0x576723[_0x6ab3('0x11')];this[_0x6ab3('0x12')]=_0x576723['sumDuration'];this[_0x6ab3('0x1c')]=_0x576723[_0x6ab3('0x1c')]||0x0;this[_0x6ab3('0x10')]=_0x576723['talking']||0x0;this[_0x6ab3('0x1d')]=_0x576723['total']||0x0;this['type']=_0x576723[_0x6ab3('0x1e')];this['unavailable']=_0x576723[_0x6ab3('0x1f')]||0x0;this[_0x6ab3('0x20')]=_0x576723[_0x6ab3('0x20')]||0x0;this[_0x6ab3('0x21')]=_0x576723[_0x6ab3('0x21')]||0x0;this[_0x6ab3('0x5')]=_0x576723[_0x6ab3('0x5')]||0x0;if(_0x576723[_0x6ab3('0x1e')]===_0x6ab3('0x22')){this[_0x6ab3('0xf')]=_0x576723[_0x6ab3('0xf')]||0x0;this[_0x6ab3('0x23')]=_0x576723[_0x6ab3('0x23')];this[_0x6ab3('0x24')]=_0x576723['dialMethod'];this[_0x6ab3('0x25')]=_0x576723['dialOriginateCallerIdName'];this[_0x6ab3('0x26')]=_0x576723[_0x6ab3('0x26')];this[_0x6ab3('0x27')]=_0x576723[_0x6ab3('0x27')];this[_0x6ab3('0x28')]=_0x576723[_0x6ab3('0x28')];this['temp']=_0x576723['temp'];this[_0x6ab3('0x29')]=_0x576723['outboundAnswerAgiCallsDay'];this['outboundAnswerCallsDay']=_0x576723[_0x6ab3('0x9')];this[_0x6ab3('0xa')]=_0x576723[_0x6ab3('0xa')];this[_0x6ab3('0x2a')]=_0x576723[_0x6ab3('0x2a')];this[_0x6ab3('0xb')]=_0x576723[_0x6ab3('0xb')];this[_0x6ab3('0x2b')]=_0x576723['outboundDropCallsDayACS'];this[_0x6ab3('0x2c')]=_0x576723[_0x6ab3('0x2c')];this[_0x6ab3('0x2d')]=_0x576723[_0x6ab3('0x2d')];this[_0x6ab3('0xc')]=_0x576723[_0x6ab3('0xc')];this[_0x6ab3('0x2e')]=_0x576723[_0x6ab3('0x2e')];this['outboundOriginateFailureCallsDay']=_0x576723[_0x6ab3('0x2f')];this['outboundReCallsDay']=_0x576723['outboundReCallsDay'];this[_0x6ab3('0x30')]=_0x576723['outboundRejectCallsDay'];this[_0x6ab3('0xe')]=_0x576723[_0x6ab3('0xe')];this[_0x6ab3('0x31')]=_0x576723[_0x6ab3('0x31')];this[_0x6ab3('0x32')]=_0x576723[_0x6ab3('0x32')];this[_0x6ab3('0x33')]=_0x576723[_0x6ab3('0x33')];this[_0x6ab3('0x34')]=_0x576723[_0x6ab3('0x34')];this[_0x6ab3('0x35')]=_0x576723[_0x6ab3('0x35')];this[_0x6ab3('0x36')]=_0x576723[_0x6ab3('0x36')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x576723[_0x6ab3('0x37')];this[_0x6ab3('0x38')]=_0x576723[_0x6ab3('0x38')];this[_0x6ab3('0x39')]=_0x576723[_0x6ab3('0x39')];this[_0x6ab3('0x3a')]=_0x576723['predictiveIntervalPauses'];this[_0x6ab3('0x3b')]=_0x576723['predictiveIntervalAvailable'];this[_0x6ab3('0x3c')]=_0x576723[_0x6ab3('0x3c')];this['originated']=_0x576723[_0x6ab3('0x7')];this[_0x6ab3('0x3d')]=_0x576723['erlangCalls'];this['erlangCallToSecond']=_0x576723[_0x6ab3('0x3e')];this['erlangAbandonmentRate']=_0x576723[_0x6ab3('0x3f')];this[_0x6ab3('0x40')]=_0x576723['erlangBusyFactor'];this['startPredictive']=_0x576723[_0x6ab3('0x41')];this[_0x6ab3('0x42')]=_0x576723['startProgressive'];this['message']=_0x576723[_0x6ab3('0x43')];this[_0x6ab3('0x44')]=_0x576723['statusMessage'];}if(_0x576723[_0x6ab3('0x45')]){this[_0x6ab3('0x45')]={'id':_0x576723[_0x6ab3('0x45')]['id'],'name':_0x576723[_0x6ab3('0x45')][_0x6ab3('0x13')],'active':_0x576723['Trunk'][_0x6ab3('0x46')],'callerid':_0x576723['Trunk'][_0x6ab3('0x47')]};}}VoiceQueueSummary[_0x6ab3('0x48')][_0x6ab3('0x49')]=function(_0x3e5ae8,_0x26d6d6,_0x1fd302,_0x238059){this['loggedInDb']=0x0;this[_0x6ab3('0x10')]=0x0;this[_0x6ab3('0x3')]=0x0;this[_0x6ab3('0x20')]=0x0;this[_0x6ab3('0x1a')]=0x0;this['inUse']=0x0;this['busy']=0x0;this[_0x6ab3('0x18')]=0x0;this[_0x6ab3('0x1f')]=0x0;this[_0x6ab3('0x4')]=0x0;this[_0x6ab3('0x1b')]=0x0;this[_0x6ab3('0x19')]=0x0;if(_0x1fd302){if(_0x1fd302['available']){this[_0x6ab3('0x0')]=Number(_0x1fd302['available']);}if(_0x1fd302[_0x6ab3('0x4a')]){this['loggedIn']=Number(_0x1fd302[_0x6ab3('0x4a')]);}if(_0x1fd302[_0x6ab3('0x4b')]){this[_0x6ab3('0x5')]=Number(_0x1fd302[_0x6ab3('0x4b')]);}}for(var _0x5be6ce=0x0;_0x5be6ce<_0x3e5ae8[_0x6ab3('0x4c')];_0x5be6ce++){var _0x1be23f=_0x26d6d6[_0x6ab3('0x4d')+_0x3e5ae8[_0x5be6ce][_0x6ab3('0x13')]];if(_0x1be23f&&_0x1be23f[_0x6ab3('0x4e')]){this[_0x6ab3('0x2')]+=0x1;}if(_0x3e5ae8[_0x5be6ce][_0x6ab3('0x4f')]==='1'){this['talking']+=0x1;}if(_0x3e5ae8[_0x5be6ce][_0x6ab3('0x3')]==='1'&&!['2','7','8']['includes'](_0x3e5ae8[_0x5be6ce][_0x6ab3('0x50')])){this['paused']+=0x1;}switch(_0x3e5ae8[_0x5be6ce]['status']){case'0':this[_0x6ab3('0x20')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x6ab3('0x17')]+=0x1;break;case'3':this[_0x6ab3('0x16')]+=0x1;break;case'4':this[_0x6ab3('0x18')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x6ab3('0x1b')]+=0x1;break;case'8':this[_0x6ab3('0x19')]+=0x1;break;}}if(this[_0x6ab3('0x24')]===_0x6ab3('0x51')){var _0x59ce45=Object[_0x6ab3('0x52')](_0x238059);for(var _0x3db4b6=0x0;_0x3db4b6<_0x59ce45[_0x6ab3('0x4c')];_0x3db4b6++){var _0x3bad93=_0x59ce45[_0x3db4b6];var _0x2f3132=_0x238059[_0x3bad93];if(_0x2f3132[_0x6ab3('0x53')]===this[_0x6ab3('0x13')]&&_0x2f3132['type']===_0x6ab3('0x54')&&_0x2f3132[_0x6ab3('0x55')]==='xcally-motion-preview'){this[_0x6ab3('0x10')]+=0x1;}}if(this['talking']>this['inUse']){this[_0x6ab3('0x10')]=this[_0x6ab3('0x17')];}this[_0x6ab3('0xf')]=0x0;}return this;};VoiceQueueSummary[_0x6ab3('0x48')]['compareToInboundQueue']=function(_0x30298e){var _0x21805e=![];if(_0x30298e){_0x21805e=INBOUND_COUNTERS[_0x6ab3('0x56')](function(_0x2ae757){return this[_0x2ae757]!==_0x30298e[_0x2ae757];},this);}return _0x21805e;};VoiceQueueSummary[_0x6ab3('0x48')][_0x6ab3('0x57')]=function(_0x3ad8a9){var _0x3d55a4=![];var _0x4f6c9b=![];var _0x1f6f10=![];if(_0x3ad8a9){_0x3d55a4=this['dialMethod']!==_0x3ad8a9['dialMethod']||this[_0x6ab3('0x23')]!==_0x3ad8a9[_0x6ab3('0x23')]||this['message']!==_0x3ad8a9[_0x6ab3('0x43')]||this['statusMessage']!==_0x3ad8a9['statusMessage'];_0x4f6c9b=OUTBOUND_COUNTERS[_0x6ab3('0x56')](function(_0x591eed){return this[_0x591eed]!==_0x3ad8a9[_0x591eed];},this);if(this['Trunk']&&_0x3ad8a9[_0x6ab3('0x45')]){_0x1f6f10=this[_0x6ab3('0x45')][_0x6ab3('0x13')]!==_0x3ad8a9['Trunk']['name']||this[_0x6ab3('0x45')][_0x6ab3('0x46')]!==_0x3ad8a9[_0x6ab3('0x45')][_0x6ab3('0x46')];}}return _0x3d55a4||_0x4f6c9b||_0x1f6f10;};VoiceQueueSummary['prototype'][_0x6ab3('0x58')]=function(_0x407315){this[_0x6ab3('0x6')]=_0x407315[_0x6ab3('0x6')];this[_0x6ab3('0x43')]=_0x407315['message'];this[_0x6ab3('0x44')]=_0x407315['statusMessage'];this['originated']=_0x407315[_0x6ab3('0x7')];this[_0x6ab3('0x8')]=_0x407315[_0x6ab3('0x8')];this[_0x6ab3('0x9')]=_0x407315['outboundAnswerCallsDay'];this[_0x6ab3('0xa')]=_0x407315[_0x6ab3('0xa')];this['outboundBusyCallsDay']=_0x407315[_0x6ab3('0x2a')];this[_0x6ab3('0xb')]=_0x407315[_0x6ab3('0xb')];this[_0x6ab3('0xc')]=_0x407315['outboundNoAnswerCallsDay'];this[_0x6ab3('0x2e')]=_0x407315[_0x6ab3('0x2e')];this[_0x6ab3('0xd')]=_0x407315[_0x6ab3('0xd')];this['outboundRejectCallsDay']=_0x407315[_0x6ab3('0x30')];this[_0x6ab3('0xe')]=_0x407315[_0x6ab3('0xe')];this[_0x6ab3('0x11')]=_0x407315[_0x6ab3('0x11')];this[_0x6ab3('0x12')]=_0x407315['sumDuration'];this['total']=_0x407315[_0x6ab3('0x1d')];if(this['dialMethod']===_0x6ab3('0x59')){this[_0x6ab3('0xf')]=_0x407315[_0x6ab3('0xf')];}};module[_0x6ab3('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 1c49c2c..025bb11 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 _0xaaf5=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x3f560e,_0x289aa8){var _0x5bf213=function(_0xcc2f71){while(--_0xcc2f71){_0x3f560e['push'](_0x3f560e['shift']());}};_0x5bf213(++_0x289aa8);}(_0xaaf5,0x14d));var _0x5aaf=function(_0x59c0e4,_0x2ab697){_0x59c0e4=_0x59c0e4-0x0;var _0x55bcca=_0xaaf5[_0x59c0e4];return _0x55bcca;};'use strict';function VtigerAccount(_0x590fef){this['id']=_0x590fef['id']||0x0;this[_0x5aaf('0x0')]=_0x590fef[_0x5aaf('0x0')]||'';this[_0x5aaf('0x1')]=_0x590fef[_0x5aaf('0x1')]||'';this[_0x5aaf('0x2')]=_0x590fef[_0x5aaf('0x2')]||'';this[_0x5aaf('0x3')]=_0x590fef['remoteUri']||'';this['serverUrl']=_0x590fef[_0x5aaf('0x4')]||'';this[_0x5aaf('0x5')]=_0x590fef[_0x5aaf('0x5')]||{};}module[_0x5aaf('0x6')]=VtigerAccount; \ No newline at end of file +var _0x28c5=['exports','username','remoteUri','serverUrl','Configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28c5,0x19b));var _0x528c=function(_0x4bed11,_0xfb18bd){_0x4bed11=_0x4bed11-0x0;var _0x5b3fca=_0x28c5[_0x4bed11];return _0x5b3fca;};'use strict';function VtigerAccount(_0x374d62){this['id']=_0x374d62['id']||0x0;this['name']=_0x374d62['name']||'';this[_0x528c('0x0')]=_0x374d62[_0x528c('0x0')]||'';this['accessKey']=_0x374d62['accessKey']||'';this[_0x528c('0x1')]=_0x374d62['remoteUri']||'';this[_0x528c('0x2')]=_0x374d62[_0x528c('0x2')]||'';this['Configurations']=_0x374d62[_0x528c('0x3')]||{};}module[_0x528c('0x4')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 58ccb69..fc90359 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 _0x208e=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x299eb8,_0x2a3c76){var _0x59ee49=function(_0x482d53){while(--_0x482d53){_0x299eb8['push'](_0x299eb8['shift']());}};_0x59ee49(++_0x2a3c76);}(_0x208e,0xea));var _0xe208=function(_0x5d30b4,_0x199248){_0x5d30b4=_0x5d30b4-0x0;var _0x1acfb8=_0x208e[_0x5d30b4];return _0x1acfb8;};'use strict';function ZendeskAccount(_0x48147d){this['id']=_0x48147d['id']||0x0;this[_0xe208('0x0')]=_0x48147d[_0xe208('0x0')]||'';this[_0xe208('0x1')]=_0x48147d['username']||'';this[_0xe208('0x2')]=_0x48147d[_0xe208('0x2')]||'';this[_0xe208('0x3')]=_0x48147d[_0xe208('0x3')]||'';this[_0xe208('0x4')]=_0x48147d[_0xe208('0x4')]||'';this[_0xe208('0x5')]=_0x48147d['authType']||'';this[_0xe208('0x6')]=_0x48147d['type']||_0xe208('0x7');this[_0xe208('0x8')]=_0x48147d[_0xe208('0x8')]||'';this[_0xe208('0x9')]=_0x48147d['Configurations']||{};}module[_0xe208('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xf692=['token','authType','type','integrationTab','serverUrl','Configurations','name','username','password'];(function(_0x28731b,_0x254826){var _0x628abc=function(_0x2b753c){while(--_0x2b753c){_0x28731b['push'](_0x28731b['shift']());}};_0x628abc(++_0x254826);}(_0xf692,0xba));var _0x2f69=function(_0x113fac,_0x44a43d){_0x113fac=_0x113fac-0x0;var _0x32e9fc=_0xf692[_0x113fac];return _0x32e9fc;};'use strict';function ZendeskAccount(_0x5349d7){this['id']=_0x5349d7['id']||0x0;this[_0x2f69('0x0')]=_0x5349d7[_0x2f69('0x0')]||'';this['username']=_0x5349d7[_0x2f69('0x1')]||'';this[_0x2f69('0x2')]=_0x5349d7[_0x2f69('0x2')]||'';this[_0x2f69('0x3')]=_0x5349d7['token']||'';this['remoteUri']=_0x5349d7['remoteUri']||'';this[_0x2f69('0x4')]=_0x5349d7['authType']||'';this[_0x2f69('0x5')]=_0x5349d7[_0x2f69('0x5')]||_0x2f69('0x6');this[_0x2f69('0x7')]=_0x5349d7[_0x2f69('0x7')]||'';this['Configurations']=_0x5349d7[_0x2f69('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 9815d72..9772ebf 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 _0x377f=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x19a082,_0x5b79d0){var _0x34ccd3=function(_0x2ed9d4){while(--_0x2ed9d4){_0x19a082['push'](_0x19a082['shift']());}};_0x34ccd3(++_0x5b79d0);}(_0x377f,0x70));var _0xf377=function(_0x239a98,_0x288178){_0x239a98=_0x239a98-0x0;var _0x16d789=_0x377f[_0x239a98];return _0x16d789;};'use strict';function ZohoAccount(_0x3fd136){this['id']=_0x3fd136['id']||0x0;this[_0xf377('0x0')]=_0x3fd136[_0xf377('0x0')]||'';this[_0xf377('0x1')]=_0x3fd136[_0xf377('0x1')]||'';this[_0xf377('0x2')]=_0x3fd136[_0xf377('0x2')]||'';this[_0xf377('0x3')]=_0x3fd136[_0xf377('0x3')]||'';this[_0xf377('0x4')]=_0x3fd136[_0xf377('0x4')]||'';this[_0xf377('0x5')]=_0x3fd136[_0xf377('0x5')]||'';this[_0xf377('0x6')]=_0x3fd136[_0xf377('0x6')]||'';this[_0xf377('0x7')]=_0x3fd136[_0xf377('0x7')]||'';this['refreshToken']=_0x3fd136[_0xf377('0x8')]||'';this[_0xf377('0x9')]=_0x3fd136[_0xf377('0x9')]||{};}module[_0xf377('0xa')]=ZohoAccount; \ No newline at end of file +var _0xeef7=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x87ffc2,_0x38d737){var _0x5179be=function(_0x533e09){while(--_0x533e09){_0x87ffc2['push'](_0x87ffc2['shift']());}};_0x5179be(++_0x38d737);}(_0xeef7,0x133));var _0x7eef=function(_0x4d07d9,_0x152e11){_0x4d07d9=_0x4d07d9-0x0;var _0xcc917e=_0xeef7[_0x4d07d9];return _0xcc917e;};'use strict';function ZohoAccount(_0x2f4050){this['id']=_0x2f4050['id']||0x0;this[_0x7eef('0x0')]=_0x2f4050['name']||'';this[_0x7eef('0x1')]=_0x2f4050[_0x7eef('0x1')]||'';this[_0x7eef('0x2')]=_0x2f4050[_0x7eef('0x2')]||'';this[_0x7eef('0x3')]=_0x2f4050[_0x7eef('0x3')]||'';this[_0x7eef('0x4')]=_0x2f4050['clientId']||'';this[_0x7eef('0x5')]=_0x2f4050['clientSecret']||'';this[_0x7eef('0x6')]=_0x2f4050[_0x7eef('0x6')]||'';this['code']=_0x2f4050[_0x7eef('0x7')]||'';this[_0x7eef('0x8')]=_0x2f4050[_0x7eef('0x8')]||'';this[_0x7eef('0x9')]=_0x2f4050[_0x7eef('0x9')]||{};}module[_0x7eef('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 ad02e40..bd8ac79 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 _0xf2e3=['active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','exports','util','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName'];(function(_0x599d7f,_0xc586e8){var _0x3346d3=function(_0x56b820){while(--_0x56b820){_0x599d7f['push'](_0x599d7f['shift']());}};_0x3346d3(++_0xc586e8);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xf2e3[_0x8a969d];return _0x1d8dc7;};'use strict';var util=require(_0x3f2e('0x0'));var _=require('lodash');var moment=require(_0x3f2e('0x1'));function checkNameSurname(_0x231b2b,_0x3fba4b,_0x30f1bb){var _0x27d28c='';if(!_[_0x3f2e('0x2')](_0x3fba4b)&&_0x3f2e('0x3')===typeof _0x3fba4b){_0x27d28c+=_0x3fba4b;}if(!_[_0x3f2e('0x2')](_0x30f1bb)&&_0x3f2e('0x3')===typeof _0x30f1bb){_0x27d28c+='\x20'+_0x30f1bb;}if(_0x27d28c!==''){return _0x27d28c;}return _0x231b2b;}function Action(_0x5f254a,_0x33a3b7,_0xdd6b3e,_0x3c0864,_0xdf499f){this[_0x3f2e('0x4')]=_0xdd6b3e||undefined;this[_0x3f2e('0x5')]=_0x5f254a['id'];this[_0x3f2e('0x6')]=_0x33a3b7[_0x3f2e('0x7')];this[_0x3f2e('0x8')]=_0x33a3b7[_0x3f2e('0x8')];this[_0x3f2e('0x9')]=_0x3f2e('0x6');this[_0x3f2e('0xa')]=![];this[_0x3f2e('0xb')]=_[_0x3f2e('0x2')](_0x5f254a[_0x3f2e('0xc')])?undefined:_0x5f254a[_0x3f2e('0xc')][_0x3f2e('0x7')];this[_0x3f2e('0xd')]=this['membername']?util[_0x3f2e('0xe')](_0x3f2e('0xf'),this['membername']):_0x3c0864||undefined;this[_0x3f2e('0x10')]=checkNameSurname(_0x5f254a[_0x3f2e('0x11')][_0x3f2e('0x12')],_0x5f254a[_0x3f2e('0x11')][_0x3f2e('0x13')],_0x5f254a['Contact'][_0x3f2e('0x14')]);this[_0x3f2e('0x15')]=_0x5f254a[_0x3f2e('0x15')]||![];this['calleridnum']=_0x5f254a[_0x3f2e('0x12')];this[_0x3f2e('0x16')]=_0x5f254a[_0x3f2e('0x16')];this[_0x3f2e('0x17')]=_0x5f254a[_0x3f2e('0x17')]||0x0;this[_0x3f2e('0x18')]=_0x5f254a[_0x3f2e('0x18')]||0x0;this[_0x3f2e('0x19')]=_0x5f254a[_0x3f2e('0x19')]||0x0;this[_0x3f2e('0x1a')]=(_0x5f254a[_0x3f2e('0x17')]||0x0)+(_0x5f254a['countcongestionretry']||0x0)+(_0x5f254a[_0x3f2e('0x19')]||0x0)+(_0x5f254a[_0x3f2e('0x1b')]||0x0)+(_0x5f254a[_0x3f2e('0x1c')]||0x0)+(_0x5f254a[_0x3f2e('0x1d')]||0x0)+(_0x5f254a[_0x3f2e('0x1e')]||0x0)+(_0x5f254a['countagentrejectretry']||0x0);this['countnosuchnumberretry']=_0x5f254a[_0x3f2e('0x1b')]||0x0;this[_0x3f2e('0x1c')]=_0x5f254a[_0x3f2e('0x1c')]||0x0;this[_0x3f2e('0x1d')]=_0x5f254a[_0x3f2e('0x1d')]||0x0;this[_0x3f2e('0x1e')]=_0x5f254a['countmachineretry']||0x0;this['countagentrejectretry']=_0x5f254a[_0x3f2e('0x1f')]||0x0;this[_0x3f2e('0x20')]=_0x5f254a['callback'];this['callbackuniqueid']=_0x5f254a[_0x3f2e('0x21')];this['callbackat']=_0x5f254a[_0x3f2e('0x22')];this[_0x3f2e('0x23')]=_0x5f254a['recallme'];this['ContactId']=_0x5f254a['ContactId'];this[_0x3f2e('0x24')]=_0x5f254a[_0x3f2e('0x24')];this['UserId']=_[_0x3f2e('0x2')](_0x5f254a['Agent'])?_0x5f254a[_0x3f2e('0x25')]:_0x5f254a['Agent']['id'];this[_0x3f2e('0x26')]=_0x5f254a[_0x3f2e('0x26')];this[_0x3f2e('0x27')]='';this[_0x3f2e('0x28')]='';}Action[_0x3f2e('0x29')]['getCaller']=function(){return util[_0x3f2e('0xe')](_0x3f2e('0x2a'),this['calleridname'],this['number']);};module[_0x3f2e('0x2b')]=Action; \ No newline at end of file +var _0xe820=['calleridname','Contact','lastName','phone','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','moment','isNil','idContact','queue','name','type','dialAnswer','membername','Agent','format','SIP/%s'];(function(_0x5b1499,_0x49d3f1){var _0x5b70de=function(_0x49e362){while(--_0x49e362){_0x5b1499['push'](_0x5b1499['shift']());}};_0x5b70de(++_0x49d3f1);}(_0xe820,0xd2));var _0x0e82=function(_0x371fc4,_0x49353c){_0x371fc4=_0x371fc4-0x0;var _0x9dfa94=_0xe820[_0x371fc4];return _0x9dfa94;};'use strict';var util=require(_0x0e82('0x0'));var _=require('lodash');var moment=require(_0x0e82('0x1'));function checkNameSurname(_0x4e6b50,_0x55bbeb,_0x2d4a09){var _0x7b2e95='';if(!_[_0x0e82('0x2')](_0x55bbeb)&&'string'===typeof _0x55bbeb){_0x7b2e95+=_0x55bbeb;}if(!_[_0x0e82('0x2')](_0x2d4a09)&&'string'===typeof _0x2d4a09){_0x7b2e95+='\x20'+_0x2d4a09;}if(_0x7b2e95!==''){return _0x7b2e95;}return _0x4e6b50;}function Action(_0x2cb88f,_0x105e3c,_0x69e27f,_0x328b32,_0x2a0f9b){this['uniqueid']=_0x69e27f||undefined;this[_0x0e82('0x3')]=_0x2cb88f['id'];this[_0x0e82('0x4')]=_0x105e3c[_0x0e82('0x5')];this[_0x0e82('0x6')]=_0x105e3c[_0x0e82('0x6')];this['campaigntype']=_0x0e82('0x4');this[_0x0e82('0x7')]=![];this[_0x0e82('0x8')]=_[_0x0e82('0x2')](_0x2cb88f[_0x0e82('0x9')])?undefined:_0x2cb88f[_0x0e82('0x9')][_0x0e82('0x5')];this['channelAgent']=this[_0x0e82('0x8')]?util[_0x0e82('0xa')](_0x0e82('0xb'),this[_0x0e82('0x8')]):_0x328b32||undefined;this[_0x0e82('0xc')]=checkNameSurname(_0x2cb88f[_0x0e82('0xd')]['phone'],_0x2cb88f[_0x0e82('0xd')]['firstName'],_0x2cb88f['Contact'][_0x0e82('0xe')]);this['active']=_0x2cb88f['active']||![];this['calleridnum']=_0x2cb88f[_0x0e82('0xf')];this['scheduledat']=_0x2cb88f['scheduledat'];this[_0x0e82('0x10')]=_0x2cb88f['countbusyretry']||0x0;this[_0x0e82('0x11')]=_0x2cb88f[_0x0e82('0x11')]||0x0;this[_0x0e82('0x12')]=_0x2cb88f[_0x0e82('0x12')]||0x0;this['countglobal']=(_0x2cb88f[_0x0e82('0x10')]||0x0)+(_0x2cb88f[_0x0e82('0x11')]||0x0)+(_0x2cb88f[_0x0e82('0x12')]||0x0)+(_0x2cb88f[_0x0e82('0x13')]||0x0)+(_0x2cb88f[_0x0e82('0x14')]||0x0)+(_0x2cb88f[_0x0e82('0x15')]||0x0)+(_0x2cb88f[_0x0e82('0x16')]||0x0)+(_0x2cb88f[_0x0e82('0x17')]||0x0);this[_0x0e82('0x13')]=_0x2cb88f[_0x0e82('0x13')]||0x0;this[_0x0e82('0x14')]=_0x2cb88f['countdropretry']||0x0;this['countabandonedretry']=_0x2cb88f[_0x0e82('0x15')]||0x0;this[_0x0e82('0x16')]=_0x2cb88f[_0x0e82('0x16')]||0x0;this[_0x0e82('0x17')]=_0x2cb88f[_0x0e82('0x17')]||0x0;this[_0x0e82('0x18')]=_0x2cb88f[_0x0e82('0x18')];this[_0x0e82('0x19')]=_0x2cb88f['callbackuniqueid'];this[_0x0e82('0x1a')]=_0x2cb88f[_0x0e82('0x1a')];this[_0x0e82('0x1b')]=_0x2cb88f[_0x0e82('0x1b')];this['ContactId']=_0x2cb88f[_0x0e82('0x1c')];this[_0x0e82('0x1d')]=_0x2cb88f[_0x0e82('0x1d')];this[_0x0e82('0x1e')]=_['isNil'](_0x2cb88f[_0x0e82('0x9')])?_0x2cb88f['UserId']:_0x2cb88f['Agent']['id'];this[_0x0e82('0x1f')]=_0x2cb88f[_0x0e82('0x1f')];this['originatecalleridnum']='';this[_0x0e82('0x20')]='';}Action[_0x0e82('0x21')][_0x0e82('0x22')]=function(){return util['format'](_0x0e82('0x23'),this[_0x0e82('0xc')],this['number']);};module[_0x0e82('0x24')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 2382023..e898725 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 _0x70e0=['[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','extractCalleridName','extractCalleridNumber','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','callProgressDetectingAgent','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','uuid','../../../config/environment','../../../config/logger','preview','../ami','../rpc/cmHopperAdditionalPhone','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','clockClearZombieChannels','hangup','syncHangup','syncHangupRequest','bind','dialend','syncDialEnd','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','info','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','originated','pTalking','sendMessageOneNotActive','paused','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','CAMPAIGN_STATUS','DEACTIVATED','\x20is\x20deactivated','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','booked','type','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','enqueue','[clearZombieChannels][talking]','Queue','queue','pick','UserId','VoiceQueueId','ListId','status','catch','message','No\x20such\x20channel','updateOriginated','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','clearZombieChannels','[action]','recallMe','agentReadyId','agents','isNil','length','getDiff','scheduledat','Agent','voicePause','run','then','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','dialActive','isTrunkReachable','Trunk','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','dialNoSuchNumberRetryFrequency','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','additional','dialGlobalMaxRetry','dialBusyMaxRetry','rescheduleContact','activeContact','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','callAdditionalPhoneAfterMin','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','ABANDONED','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','queueSummaryCountersUpdated','isUndefined','object','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','Contact','lookAgent','isEmpty','execCall','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','unlockContact','getContactPreview','recallme','phone','checkInBlack'];(function(_0x14a9fe,_0x9cebe7){var _0x470f96=function(_0x5c8124){while(--_0x5c8124){_0x14a9fe['push'](_0x14a9fe['shift']());}};_0x470f96(++_0x9cebe7);}(_0x70e0,0x17b));var _0x070e=function(_0x5f30fa,_0x3b00b8){_0x5f30fa=_0x5f30fa-0x0;var _0x825aa0=_0x70e0[_0x5f30fa];return _0x825aa0;};'use strict';var util=require(_0x070e('0x0'));var _=require(_0x070e('0x1'));var uuid=require(_0x070e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x070e('0x3'));var logger=require(_0x070e('0x4'))(_0x070e('0x5'));var loggerAction=require(_0x070e('0x4'))('actionPreview');var ami=require(_0x070e('0x6'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x070e('0x7'));var Action=require('./action');var ut=require('./util/util');var utils=require('../dialer/utils');config[_0x070e('0x8')]=_[_0x070e('0x9')](config[_0x070e('0x8')],{'host':_0x070e('0xa'),'port':0x18eb});var io=require(_0x070e('0xb'))(new Redis(config[_0x070e('0x8')]));var Sequence=function(){};Sequence[_0x070e('0xc')]['enqueue']=function(_0x49b2fb){this[_0x070e('0xd')]=this[_0x070e('0xd')]?this[_0x070e('0xd')][_0x070e('0xe')](_0x49b2fb):_0x49b2fb();};function Preview(_0xa927a2){this[_0x070e('0xf')]=new Sequence();this[_0x070e('0x10')]=_0xa927a2[_0x070e('0x11')];this[_0x070e('0x12')]=_0xa927a2[_0x070e('0x12')];this[_0x070e('0x13')]={};this['agents']=_0xa927a2['agents'];this[_0x070e('0x14')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse']['bind'](this));ami['on'](_0x070e('0x15'),this[_0x070e('0x16')]['bind'](this));ami['on']('hanguprequest',this[_0x070e('0x17')][_0x070e('0x18')](this));ami['on'](_0x070e('0x19'),this[_0x070e('0x1a')]['bind'](this));ami['on']('newexten',this[_0x070e('0x1b')][_0x070e('0x18')](this));ami['on'](_0x070e('0x1c'),this[_0x070e('0x1d')][_0x070e('0x18')](this));ami['on']('attendedtransfer',this[_0x070e('0x1e')][_0x070e('0x18')](this));ami['on'](_0x070e('0x1f'),this[_0x070e('0x20')][_0x070e('0x18')](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x4e958f,_0x9907cf,_0x3004f0){io['to'](_0x4e958f)[_0x070e('0x21')](_0x9907cf,_0x3004f0);}function emitVoiceQueueChannelRemove(_0x4be0d7){logger[_0x070e('0x22')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x070e('0x23')](_0x4be0d7));emit(util[_0x070e('0x24')](_0x070e('0x25'),_0x4be0d7[_0x070e('0x26')]),_0x070e('0x27'),_0x4be0d7);io[_0x070e('0x21')](_0x070e('0x28'),_0x4be0d7);}function notSendMessagesQueue(_0x164cdf){if(_0x164cdf['sendMessageOneNotActive']){if(_0x164cdf[_0x070e('0x29')]===0x0&&_0x164cdf[_0x070e('0x2a')]===0x0){_0x164cdf[_0x070e('0x2b')]=![];_0x164cdf['available']=0x0;_0x164cdf[_0x070e('0x2c')]=0x0;_0x164cdf['message']=utils['CAMPAIGN_STATUS'][_0x070e('0x2d')];ut[_0x070e('0x2e')](_0x070e('0x2f'),_0x164cdf[_0x070e('0x26')]+_0x070e('0x30'));}else{_0x164cdf['message']=utils[_0x070e('0x31')][_0x070e('0x32')];ut[_0x070e('0x2e')](_0x070e('0x2f'),_0x164cdf[_0x070e('0x26')]+_0x070e('0x33'));}}}Preview[_0x070e('0xc')][_0x070e('0x34')]=function(){var _0x5e8326=this;setInterval(function(){_0x5e8326[_0x070e('0x35')]();},0x7cf);};Preview[_0x070e('0xc')][_0x070e('0x35')]=function(){var _0x56fc12=this['campaignsPreview'];this[_0x070e('0x14')]+=0x1;for(var _0x46065c in _0x56fc12){if(_0x56fc12[_0x070e('0x36')](_0x46065c)&&(_0x56fc12[_0x46065c]['dialMethod']===_0x070e('0x5')||_0x56fc12[_0x46065c][_0x070e('0x37')]===_0x070e('0x38'))&&_0x56fc12[_0x46065c][_0x070e('0x39')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x56fc12[_0x070e('0x36')](_0x46065c)&&_0x56fc12[_0x46065c]['dialMethod']===_0x070e('0x5')&&_0x56fc12[_0x46065c][_0x070e('0x39')]==='outbound'){if(_0x56fc12[_0x46065c]['dialActive']){this[_0x070e('0x3a')](_0x56fc12[_0x46065c]);if(_0x56fc12[_0x46065c][_0x070e('0x3b')])this['recallMe'](_0x56fc12[_0x46065c]);}else{notSendMessagesQueue(_0x56fc12[_0x46065c]);}}}};Preview['prototype'][_0x070e('0x3c')]=function(_0x27dd1f){var _0x444d02=this;this[_0x070e('0xf')][_0x070e('0x3d')](function(){if(!_['isNil'](_0x444d02['actions'][_0x27dd1f])){loggerAction[_0x070e('0x22')](_0x070e('0x3e'),_0x27dd1f,_0x070e('0x3f'),_0x444d02[_0x070e('0x13')][_0x27dd1f][_0x070e('0x40')],'originated:\x20',JSON[_0x070e('0x23')](_0x444d02[_0x070e('0x10')][_0x444d02['actions'][_0x27dd1f][_0x070e('0x40')]][_0x070e('0x29')]),'pTalking:\x20',JSON['stringify'](_0x444d02['campaignsPreview'][_0x444d02[_0x070e('0x13')][_0x27dd1f][_0x070e('0x40')]][_0x070e('0x2a')]),JSON[_0x070e('0x23')](_0x444d02[_0x070e('0x13')][_0x27dd1f]['dialAnswer']),JSON[_0x070e('0x23')](_[_0x070e('0x41')](_0x444d02[_0x070e('0x13')][_0x27dd1f],['contactId',_0x070e('0x42'),_0x070e('0x43'),_0x070e('0x44')])));return ami['Action']({'action':_0x070e('0x45'),'channel':_0x444d02[_0x070e('0x13')][_0x27dd1f]['channel']})[_0x070e('0x46')](function(_0x5d689b){if(_0x5d689b[_0x070e('0x47')]===_0x070e('0x48')){setTimeout(function(){if(_0x444d02[_0x070e('0x13')][_0x27dd1f]){ut[_0x070e('0x49')](_0x444d02[_0x070e('0x10')][_0x444d02['actions'][_0x27dd1f][_0x070e('0x40')]],'[clearZombieChannel]');if(_0x444d02['actions'][_0x27dd1f][_0x070e('0x4a')]===!![]){ut[_0x070e('0x4b')](_0x444d02[_0x070e('0x10')][_0x444d02['actions'][_0x27dd1f][_0x070e('0x40')]],_0x070e('0x4c'));ut[_0x070e('0x4d')](_0x070e('0x4e')+_0x27dd1f,_0x444d02['actions'][_0x27dd1f][_0x070e('0x40')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x27dd1f,_0x444d02['actions'][_0x27dd1f][_0x070e('0x40')]);delete _0x444d02[_0x070e('0x13')][_0x27dd1f];}},0x2328);}});}});};Preview[_0x070e('0xc')][_0x070e('0x4f')]=function(){var _0x34f23e=this;loggerAction['info'](_0x070e('0x50'),_['size'](this[_0x070e('0x13')]));for(var _0x42245d in this[_0x070e('0x13')]){if(_0x34f23e['actions']['hasOwnProperty'](_0x42245d)){_0x34f23e[_0x070e('0x3c')](_0x42245d);}}};Preview['prototype'][_0x070e('0x51')]=function(_0x3fdb75){var _0x139820=this;rpcDb['getContactRecallMe'](_0x3fdb75['id'],ut[_0x070e('0x52')](this[_0x070e('0x53')]))['then'](function(_0x589b97){if(!_[_0x070e('0x54')](_0x589b97)){for(var _0x945901=0x0;_0x945901<_0x589b97[_0x070e('0x55')];_0x945901+=0x1){if(ut[_0x070e('0x56')](_0x589b97[_0x945901][_0x070e('0x57')])<_0x3fdb75['dialRecallMeTimeout']*0x3c){if(_0x589b97[_0x945901][_0x070e('0x58')]&&!_0x589b97[_0x945901][_0x070e('0x58')][_0x070e('0x59')]){_0x139820[_0x070e('0x5a')](_0x589b97[_0x945901]['id'])[_0x070e('0x5b')](ut[_0x070e('0x5c')](_0x070e('0x5d')))[_0x070e('0x46')](ut[_0x070e('0x5c')](_0x070e('0x5d')));}else{rpcDb[_0x070e('0x5e')](_0x589b97[_0x945901]['id']);}}else{var _0x3be553=new Action(_0x589b97[_0x945901],_0x3fdb75);_0x3be553[_0x070e('0x5f')]=moment()[_0x070e('0x24')](_0x070e('0x60'));_0x3fdb75['outboundReCallsDay']+=0x1;ut[_0x070e('0x61')](_0x3be553,0x17,_0x070e('0x62'));if(_0x3fdb75[_0x070e('0x63')]){rpcDb[_0x070e('0x64')](ut[_0x070e('0x65')](_0x589b97[_0x945901]));rpcDb[_0x070e('0x66')](_0x3be553,_0x070e('0x67'));}else{ut[_0x070e('0x61')](_0x3be553,0x16,_0x070e('0x68'));rpcDb['createCustomerHistory'](_0x3be553,_0x070e('0x69'));rpcDb['createCustomerFinal'](_0x3be553,_0x070e('0x69'));}}}}})[_0x070e('0x46')](ut['logger2'](_0x070e('0x6a')));};Preview[_0x070e('0xc')][_0x070e('0x3a')]=function(_0xa74805){_0xa74805[_0x070e('0x2b')]=!![];if(ut[_0x070e('0x6b')](_0xa74805[_0x070e('0x6c')])){_0xa74805['message']=utils[_0x070e('0x31')]['NO_AGENTS_LOGGED'];}else if(!ut['isActive'](_0xa74805[_0x070e('0x6d')])){_0xa74805[_0x070e('0x47')]=utils[_0x070e('0x31')][_0x070e('0x2d')];}else if(!this[_0x070e('0x6e')](_0xa74805[_0x070e('0x6f')])){if(!this[_0x070e('0x6e')](_0xa74805[_0x070e('0x70')])){_0xa74805['message']=utils[_0x070e('0x31')]['UNREACHABLE_TRUNK'];}else{_0xa74805['message']=utils[_0x070e('0x31')][_0x070e('0x71')];}}else{_0xa74805['message']=utils[_0x070e('0x31')][_0x070e('0x71')];}};Preview[_0x070e('0xc')][_0x070e('0x72')]=function(_0x1aacfc,_0x382ce3,_0x1b36cd){var _0x4ef647=this;var _0x5874cd=this['actions'][_0x382ce3];var _0x3087e5=this[_0x070e('0x10')][_0x5874cd[_0x070e('0x40')]];var _0x2f8fcb;var _0x5ac0b5=![];var _0x25f34c=0x2;var _0x5d3c3a=0x3;if(_0x3087e5){switch(_0x1b36cd){case'1':_0x3087e5[_0x070e('0x73')]+=0x1;_0x5874cd[_0x070e('0x74')]+=0x1;_0x5874cd[_0x070e('0x75')]=ut[_0x070e('0x76')](_0x5874cd);ut[_0x070e('0x61')](_0x5874cd,0x0,_0x070e('0x77'));ami['emit'](_0x070e('0x78'),ut[_0x070e('0x79')](_0x5874cd,_0x070e('0x7a')));rpcDb['createCustomerHistory'](_0x5874cd,_0x070e('0x7b'));_0x4ef647[_0x070e('0x7c')](_0x5874cd,'0',_0x3087e5)['then'](function(_0x1f1df5){_0x5ac0b5=_0x1f1df5['additional']==0x1;_0x25f34c=_0x3087e5[_0x070e('0x7d')];_0x5d3c3a=_0x3087e5['callAdditionalPhoneAfterMin'];if(!_0x5ac0b5){if(ut['totalGlobal'](_0x5874cd)>=_0x3087e5['dialGlobalMaxRetry']){_0x2f8fcb=ut[_0x070e('0x7e')](_0x5874cd,0xf,_0x070e('0x7f'));rpcDb[_0x070e('0x80')](_0x2f8fcb,_0x070e('0x81'));}else{if(_0x5874cd[_0x070e('0x74')]>=_0x3087e5[_0x070e('0x82')]){rpcDb['createCustomerFinal'](_0x5874cd,_0x070e('0x81'));}else{rpcDb['rescheduleContact'](ut[_0x070e('0x83')](_0x5874cd,'countnosuchnumberretry',_0x3087e5[_0x070e('0x7d')]),_0x5874cd[_0x070e('0x84')],_0x5874cd['activeContact']);}}delete this[_0x070e('0x13')][_0x1aacfc['linkedid']];}else{_0x5874cd[_0x070e('0x74')]++;logger[_0x070e('0x22')](_0x070e('0x85'),_0x5874cd[_0x070e('0x74')]);logger[_0x070e('0x22')]('id',_0x5874cd[_0x070e('0x86')]);_0x4ef647[_0x070e('0x87')]({'id':_0x5874cd[_0x070e('0x86')],'field':{'countnosuchnumberretry':_0x5874cd[_0x070e('0x74')]}})[_0x070e('0x5b')](function(){_0x4ef647[_0x070e('0x88')](_0x5874cd,_0x25f34c,_0x5d3c3a)[_0x070e('0x5b')](function(){});});}});break;case _0x070e('0x89'):var _0x20bcf3=moment()['format'](_0x070e('0x60'));_0x5874cd[_0x070e('0x8a')]=_0x20bcf3;_0x5874cd[_0x070e('0x8b')]=_0x20bcf3;_0x5874cd[_0x070e('0x4a')]=!![];_0x3087e5['pTalking']+=0x1;logger[_0x070e('0x22')](_0x070e('0x8c'),_0x5874cd[_0x070e('0x8d')],_0x070e('0x8e'),_0x3087e5[_0x070e('0x26')],_0x070e('0x8f'),_0x3087e5['pTalking']);ami[_0x070e('0x21')](_0x070e('0x90'),ut[_0x070e('0x79')](_0x5874cd,_0x070e('0x91'),this['campaignsPreview'][_0x5874cd[_0x070e('0x40')]]));if(_0x3087e5['acw']){ami[_0x070e('0x21')](_0x070e('0x92'),ut[_0x070e('0x93')](_0x5874cd));}break;case'16':ami[_0x070e('0x21')](_0x070e('0x94'),ut['buildObj'](_0x5874cd,_0x070e('0x95'),this[_0x070e('0x10')][_0x5874cd[_0x070e('0x40')]]));emitVoiceQueueChannelRemove(ut[_0x070e('0x79')](_0x5874cd,'complete'));_0x3087e5[_0x070e('0x96')]+=0x1;_0x3087e5['total']+=0x1;_0x3087e5[_0x070e('0x97')]+=0x1;ut[_0x070e('0x4b')](_0x3087e5,_0x070e('0x98'));_0x5874cd['countglobal']=ut[_0x070e('0x76')](_0x5874cd);ut['logCustomer'](_0x5874cd,0x4,_0x070e('0x99'));rpcDb['createCustomerHistory'](_0x5874cd,_0x070e('0x9a'));rpcDb[_0x070e('0x80')](_0x5874cd,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x070e('0x9b')](_0x5874cd);_0x3087e5['sumDuration']+=_0x5874cd[_0x070e('0x9c')];_0x3087e5[_0x070e('0x9d')]+=_0x5874cd['talktime'];logger['info'](_0x070e('0x9e'),_0x5874cd[_0x070e('0x8d')],_0x070e('0x8e'),_0x3087e5[_0x070e('0x26')],_0x070e('0x8f'),_0x3087e5[_0x070e('0x2a')]);delete this[_0x070e('0x13')][_0x1aacfc[_0x070e('0x9f')]];break;case _0x070e('0xa0'):_0x3087e5[_0x070e('0xa1')]+=0x1;_0x5874cd[_0x070e('0xa2')]+=0x1;_0x5874cd[_0x070e('0x75')]=ut[_0x070e('0x76')](_0x5874cd);ut['logCustomer'](_0x5874cd,0x5,_0x070e('0xa3'));_0x25f34c=_0x3087e5[_0x070e('0xa4')];_0x5d3c3a=_0x3087e5['callAdditionalPhoneAfterMin'];ami['emit'](_0x070e('0xa5'),ut[_0x070e('0x79')](_0x5874cd,_0x070e('0xa6')));rpcDb[_0x070e('0x66')](_0x5874cd,_0x070e('0xa7'));_0x4ef647[_0x070e('0x7c')](_0x5874cd,'5',_0x3087e5)[_0x070e('0x5b')](function(_0x110813){_0x5ac0b5=_0x110813[_0x070e('0xa8')]==0x1;if(!_0x5ac0b5){if(ut[_0x070e('0x76')](_0x5874cd)>=_0x3087e5[_0x070e('0xa9')]){_0x2f8fcb=ut[_0x070e('0x7e')](_0x5874cd,0xf,_0x070e('0x7f'));rpcDb['createCustomerFinal'](_0x2f8fcb,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x5874cd['countbusyretry']>=_0x3087e5[_0x070e('0xaa')]){rpcDb[_0x070e('0x80')](_0x5874cd,_0x070e('0xa7'));}else{rpcDb[_0x070e('0xab')](ut['scheduledAt'](_0x5874cd,_0x070e('0xa2'),_0x3087e5[_0x070e('0xa4')]),_0x5874cd[_0x070e('0x84')],_0x5874cd[_0x070e('0xac')]);}}}else{_0x5874cd[_0x070e('0xa2')]++;_0x4ef647[_0x070e('0x87')]({'id':_0x5874cd['idContact'],'field':{'countbusyretry':_0x5874cd[_0x070e('0xa2')]}})['then'](function(){_0x4ef647[_0x070e('0x88')](_0x5874cd,_0x25f34c,_0x5d3c3a)[_0x070e('0x5b')](function(){});});}});break;case _0x070e('0xad'):_0x3087e5[_0x070e('0xae')]+=0x1;_0x5874cd[_0x070e('0xaf')]+=0x1;_0x5874cd['countglobal']=ut[_0x070e('0x76')](_0x5874cd);ut[_0x070e('0x61')](_0x5874cd,0x3,'NoAnswer');_0x25f34c=_0x3087e5[_0x070e('0xb0')];_0x5d3c3a=_0x3087e5[_0x070e('0xb1')];var _0x553ea1=ut[_0x070e('0xb2')](_0x5874cd,_0x3087e5);ami[_0x070e('0x21')](_0x070e('0xb3'),_0x553ea1);rpcDb['createCustomerHistory'](_0x5874cd,_0x070e('0xb4'));_0x4ef647[_0x070e('0x7c')](_0x5874cd,'3',_0x3087e5)[_0x070e('0x5b')](function(_0x1ad0bf){_0x5ac0b5=_0x1ad0bf[_0x070e('0xa8')]==0x1;if(!_0x5ac0b5){if(ut[_0x070e('0x76')](_0x5874cd)>=_0x3087e5[_0x070e('0xa9')]){_0x2f8fcb=ut[_0x070e('0x7e')](_0x5874cd,0xf,_0x070e('0x7f'));rpcDb[_0x070e('0x80')](_0x2f8fcb,_0x070e('0xb5'));}else{if(_0x5874cd[_0x070e('0xaf')]>=_0x3087e5[_0x070e('0xb6')]){rpcDb['createCustomerFinal'](_0x5874cd,_0x070e('0xb4'));}else{rpcDb[_0x070e('0xab')](ut[_0x070e('0x83')](_0x5874cd,_0x070e('0xaf'),_0x3087e5[_0x070e('0xb0')]),_0x5874cd[_0x070e('0x84')],_0x5874cd['activeContact']);}}}else{_0x5874cd['countnoanswerretry']++;_0x4ef647['incrementPreviewCounters']({'id':_0x5874cd[_0x070e('0x86')],'field':{'countnoanswerretry':_0x5874cd[_0x070e('0xaf')]}})[_0x070e('0x5b')](function(){_0x4ef647[_0x070e('0x88')](_0x5874cd,_0x25f34c,_0x5d3c3a)['then'](function(){});});}});break;case _0x070e('0xb7'):_0x3087e5[_0x070e('0xb8')]+=0x1;_0x5874cd[_0x070e('0xb9')]+=0x1;_0x5874cd['countglobal']=ut[_0x070e('0x76')](_0x5874cd);ut['logCustomer'](_0x5874cd,0x8,_0x070e('0xba'));_0x25f34c=_0x3087e5[_0x070e('0xbb')];_0x5d3c3a=_0x3087e5['callAdditionalPhoneAfterMin'];ami['emit'](_0x070e('0xbc'),ut[_0x070e('0x79')](_0x5874cd,'congestion'));rpcDb[_0x070e('0x66')](_0x5874cd,'[callProgressDetectingCustomer][logCongestion]');_0x4ef647['verifyAdditionalPhones'](_0x5874cd,'8',_0x3087e5)['then'](function(_0x15480c){_0x5ac0b5=_0x15480c[_0x070e('0xa8')]==0x1;if(!_0x5ac0b5){if(ut[_0x070e('0x76')](_0x5874cd)>=_0x3087e5[_0x070e('0xa9')]){_0x2f8fcb=ut[_0x070e('0x7e')](_0x5874cd,0xf,_0x070e('0x7f'));rpcDb[_0x070e('0x80')](_0x2f8fcb,_0x070e('0xbd'));}else{if(_0x5874cd[_0x070e('0xb9')]>=_0x3087e5[_0x070e('0xbe')]){rpcDb[_0x070e('0x80')](_0x5874cd,_0x070e('0xbf'));}else{rpcDb[_0x070e('0xab')](ut[_0x070e('0x83')](_0x5874cd,_0x070e('0xb9'),_0x3087e5[_0x070e('0xa4')]),_0x5874cd[_0x070e('0x84')],_0x5874cd[_0x070e('0xac')]);}}}else{_0x5874cd[_0x070e('0xb9')]++;_0x4ef647[_0x070e('0x87')]({'id':_0x5874cd[_0x070e('0x86')],'field':{'countcongestionretry':_0x5874cd[_0x070e('0xb9')]}})['then'](function(){_0x4ef647[_0x070e('0x88')](_0x5874cd,_0x25f34c,_0x5d3c3a)[_0x070e('0x5b')](function(){});});}});break;case _0x070e('0xc0'):_0x3087e5[_0x070e('0xc1')]+=0x1;_0x5874cd['countagentrejectretry']+=0x1;_0x5874cd[_0x070e('0x75')]=ut[_0x070e('0x76')](_0x5874cd);ut[_0x070e('0x61')](_0x5874cd,0x14,_0x070e('0xc2'));_0x25f34c=_0x3087e5[_0x070e('0xc3')];_0x5d3c3a=_0x3087e5[_0x070e('0xb1')];ami['emit']('custom:agentreject',ut['buildObj'](_0x5874cd,_0x070e('0xc4')));rpcDb['createCustomerHistory'](_0x5874cd,_0x070e('0xc5'));_0x4ef647[_0x070e('0x7c')](_0x5874cd,'20',_0x3087e5)['then'](function(_0x912f24){_0x5ac0b5=_0x912f24[_0x070e('0xa8')]==0x1;if(!_0x5ac0b5){if(ut['totalGlobal'](_0x5874cd)>=_0x3087e5['dialGlobalMaxRetry']){_0x2f8fcb=ut[_0x070e('0x7e')](_0x5874cd,0x14,_0x070e('0xc2'));rpcDb[_0x070e('0x80')](_0x2f8fcb,_0x070e('0xc6'));}else{if(_0x5874cd[_0x070e('0xc7')]>=_0x3087e5['dialAgentRejectMaxRetry']){rpcDb[_0x070e('0x80')](_0x5874cd,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x070e('0xab')](ut[_0x070e('0x83')](_0x5874cd,'countagentrejectretry',_0x3087e5[_0x070e('0xc3')]),_0x5874cd[_0x070e('0x84')],_0x5874cd[_0x070e('0xac')]);}}}else{_0x5874cd[_0x070e('0xaf')]++;_0x4ef647[_0x070e('0x87')]({'id':_0x5874cd[_0x070e('0x86')],'field':{'countnoanswerretry':_0x5874cd['countnoanswerretry']}})[_0x070e('0x5b')](function(){_0x4ef647[_0x070e('0x88')](_0x5874cd,_0x25f34c,_0x5d3c3a)[_0x070e('0x5b')](function(){});});}});break;case _0x070e('0xc8'):_0x3087e5[_0x070e('0xc9')]+=0x1;_0x5874cd['countabandonedretry']+=0x1;_0x5874cd[_0x070e('0x75')]=ut[_0x070e('0x76')](_0x5874cd);ut[_0x070e('0x61')](_0x5874cd,0xb,_0x070e('0xca'));rpcDb[_0x070e('0x66')](_0x5874cd,_0x070e('0xcb'));_0x4ef647[_0x070e('0x7c')](_0x5874cd,'11',_0x3087e5)[_0x070e('0x5b')](function(_0x1fb1e6){_0x5ac0b5=_0x1fb1e6[_0x070e('0xa8')]==0x1;if(!_0x5ac0b5){if(ut[_0x070e('0x76')](_0x5874cd)>=_0x3087e5[_0x070e('0xa9')]){_0x2f8fcb=ut[_0x070e('0x7e')](_0x5874cd,0xf,_0x070e('0x7f'));rpcDb[_0x070e('0x80')](_0x2f8fcb,_0x070e('0xcb'));}else{if(_0x5874cd['countabandonedetry']>=_0x3087e5['dialAbandonedMaxRety']){rpcDb[_0x070e('0x80')](_0x5874cd,_0x070e('0xcb'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x5874cd,'countabandonedretry',_0x3087e5['dialAbandonedRetryFrequency']),_0x5874cd[_0x070e('0x84')],_0x5874cd[_0x070e('0xac')]);}}}else{_0x5874cd[_0x070e('0xaf')]++;_0x4ef647[_0x070e('0x87')]({'id':_0x5874cd[_0x070e('0x86')],'field':{'countnoanswerretry':_0x5874cd[_0x070e('0xaf')]}})[_0x070e('0x5b')](function(){_0x4ef647[_0x070e('0x88')](_0x5874cd,_0x25f34c,_0x5d3c3a)[_0x070e('0x5b')](function(){});});}});break;case'18':_0x3087e5[_0x070e('0xcc')]+=0x1;_0x5874cd['countmachineretry']+=0x1;_0x5874cd[_0x070e('0x75')]=ut[_0x070e('0x76')](_0x5874cd);ut['logCustomer'](_0x5874cd,0x12,_0x1aacfc[_0x070e('0xcd')]||_0x1aacfc[_0x070e('0xce')]);ami[_0x070e('0x21')](_0x070e('0xcf'),ut['buildObj'](_0x5874cd,_0x070e('0xd0')));rpcDb[_0x070e('0x66')](_0x5874cd,_0x070e('0xd1'));_0x4ef647[_0x070e('0x7c')](_0x5874cd,'18',_0x3087e5)['then'](function(_0x4096ae){_0x5ac0b5=_0x4096ae[_0x070e('0xa8')]==0x1;if(!_0x5ac0b5){if(ut[_0x070e('0x76')](_0x5874cd)>=_0x3087e5[_0x070e('0xa9')]){_0x2f8fcb=ut[_0x070e('0x7e')](_0x5874cd,0x12,_0x070e('0x7f'));rpcDb[_0x070e('0x80')](_0x2f8fcb,_0x070e('0xd1'));}else{rpcDb[_0x070e('0x80')](_0x5874cd,_0x070e('0xd1'));}}else{_0x5874cd[_0x070e('0xaf')]++;_0x4ef647['incrementPreviewCounters']({'id':_0x5874cd[_0x070e('0x86')],'field':{'countnoanswerretry':_0x5874cd[_0x070e('0xaf')]}})['then'](function(){_0x4ef647['swapAdditionalPhones'](_0x5874cd,_0x25f34c,_0x5d3c3a)[_0x070e('0x5b')](function(){});});}});delete this['actions'][_0x1aacfc[_0x070e('0x9f')]];break;case'19':_0x3087e5[_0x070e('0xcc')]+=0x1;_0x5874cd[_0x070e('0x75')]=ut[_0x070e('0x76')](_0x5874cd);ut[_0x070e('0x61')](_0x5874cd,0x13,_0x1aacfc[_0x070e('0xcd')]||_0x1aacfc[_0x070e('0xce')]);ami['emit'](_0x070e('0xcf'),ut[_0x070e('0x79')](_0x5874cd,_0x070e('0xd0')));rpcDb[_0x070e('0x66')](_0x5874cd,'[callProgressDetectingCustomer][machine]');_0x4ef647['verifyAdditionalPhones'](_0x5874cd,'18',_0x3087e5)[_0x070e('0x5b')](function(_0x205305){_0x5ac0b5=_0x205305[_0x070e('0xa8')]==0x1;if(!_0x5ac0b5){if(ut['totalGlobal'](_0x5874cd)>=_0x3087e5[_0x070e('0xa9')]){_0x2f8fcb=ut[_0x070e('0x7e')](_0x5874cd,0xf,'Global');rpcDb[_0x070e('0x80')](_0x2f8fcb,_0x070e('0xd2'));}else{rpcDb[_0x070e('0x80')](_0x5874cd,_0x070e('0xd2'));}}else{_0x5874cd[_0x070e('0xaf')]++;_0x4ef647[_0x070e('0x87')]({'id':_0x5874cd['idContact'],'field':{'countnoanswerretry':_0x5874cd['countnoanswerretry']}})[_0x070e('0x5b')](function(){_0x4ef647['swapAdditionalPhones'](_0x5874cd,_0x25f34c,_0x5d3c3a)[_0x070e('0x5b')](function(){});});}});delete this[_0x070e('0x13')][_0x1aacfc['linkedid']];break;default:if(_0x5874cd[_0x070e('0x4a')]){ut['decrementTalkink'](_0x3087e5,_0x070e('0xd3'));ut[_0x070e('0x4d')](_0x070e('0xd4')+_0x3087e5[_0x070e('0x26')],_0x1aacfc);}_0x3087e5[_0x070e('0xcc')]+=0x1;_0x5874cd[_0x070e('0x75')]=ut['totalGlobal'](_0x5874cd);ut[_0x070e('0x61')](_0x5874cd,0xc,_0x1aacfc[_0x070e('0xcd')]||_0x1aacfc['dialstatus']);_0x25f34c=_0x3087e5['dialAgentRejectRetryFrequency'];_0x5d3c3a=_0x3087e5[_0x070e('0xb1')];rpcDb[_0x070e('0x66')](_0x5874cd,_0x070e('0xd5'));_0x4ef647[_0x070e('0x7c')](_0x5874cd,'20',_0x3087e5)[_0x070e('0x5b')](function(_0x3e2c30){_0x5ac0b5=_0x3e2c30[_0x070e('0xa8')]==0x1;if(!_0x5ac0b5){if(ut[_0x070e('0x76')](_0x5874cd)>=_0x3087e5['dialGlobalMaxRetry']){_0x2f8fcb=ut[_0x070e('0x7e')](_0x5874cd,0xf,_0x070e('0x7f'));rpcDb[_0x070e('0x80')](_0x2f8fcb,_0x070e('0xd6'));}else{rpcDb[_0x070e('0x80')](_0x5874cd,_0x070e('0xd6'));}delete this[_0x070e('0x13')][_0x1aacfc[_0x070e('0x9f')]];}else{_0x4ef647['swapAdditionalPhones'](_0x5874cd,_0x25f34c,_0x5d3c3a)[_0x070e('0x5b')](function(){});}});}if(!(_0x5874cd[_0x070e('0x4a')]&&_0x1b36cd==='16')){ut[_0x070e('0x49')](_0x3087e5,_0x070e('0xd7'));logger[_0x070e('0x22')](_0x070e('0xd8'),_0x5874cd[_0x070e('0x8d')],_0x070e('0x8e'),_0x3087e5[_0x070e('0x26')],_0x070e('0xd9'),_0x3087e5['originated']);}if(_0x1b36cd!=='ANSWER'){delete this[_0x070e('0x13')][_0x1aacfc[_0x070e('0x9f')]];delete this[_0x070e('0x13')][_0x1aacfc['destlinkedid']];}_0x3087e5[_0x070e('0xda')]=!![];}};Preview[_0x070e('0xc')]['callProgressDetectingAgent']=function(_0x26901c,_0x2b6909,_0x2f34b9){if(_[_0x070e('0xdb')](_0x2b6909)&&_0x070e('0xdc')!==typeof _0x2b6909){return;}if(_[_0x070e('0xdb')](_0x2f34b9)&&'object'!==typeof _0x2f34b9){return;}switch(_0x2f34b9['reason']){case'0':ut[_0x070e('0xdd')](_0x26901c,0x0,_0x070e('0x77'));rpcDb['createAgentHistory'](_0x26901c,_0x070e('0xde'));break;case'3':ut[_0x070e('0xdd')](_0x26901c,0x3,_0x070e('0xdf'));rpcDb[_0x070e('0xe0')](_0x26901c,_0x070e('0xe1'));break;case'5':ut[_0x070e('0xdd')](_0x26901c,0x5,'Busy');rpcDb[_0x070e('0xe0')](_0x26901c,_0x070e('0xe2'));break;case'8':ut['logAgent'](_0x26901c,0x8,_0x070e('0xba'));rpcDb[_0x070e('0xe0')](_0x26901c,_0x070e('0xe3'));break;case'22':ut[_0x070e('0xdd')](_0x26901c,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x26901c,_0x070e('0xe4'));break;default:ut[_0x070e('0xdd')](_0x26901c,0xc,_0x2f34b9[_0x070e('0xe5')]);rpcDb[_0x070e('0xe0')](_0x26901c,_0x070e('0xe3'));}ut[_0x070e('0x49')](_0x2b6909,_0x070e('0xe6'));logger[_0x070e('0x22')](_0x070e('0xe7'),_0x26901c[_0x070e('0x8d')],'\x20Queue',_0x2b6909[_0x070e('0x26')],_0x070e('0xd9'),_0x2b6909[_0x070e('0x29')]);delete this[_0x070e('0x13')][_0x26901c['uniqueid']];};Preview[_0x070e('0xc')][_0x070e('0x7c')]=function(_0x510bce,_0x4b559b,_0x27c346){return cmHopperAdditionalPhone[_0x070e('0x7c')](_0x510bce,_0x4b559b,_0x27c346)[_0x070e('0x46')](logger['info'](_0x070e('0xe8')));};Preview[_0x070e('0xc')][_0x070e('0x88')]=function(_0x2e21cf,_0x34b5ae,_0x5605da){return cmHopperAdditionalPhone[_0x070e('0x88')](_0x2e21cf,_0x34b5ae,_0x5605da)[_0x070e('0x46')](logger['info'](_0x070e('0xe9')));};Preview['prototype']['incrementPreviewCounters']=function(_0x48b0aa){return Promise[_0x070e('0xea')]()[_0x070e('0x5b')](cmHopperAdditionalPhone[_0x070e('0x87')](_0x48b0aa))[_0x070e('0x46')](logger['info'](_0x070e('0xeb')));};Preview[_0x070e('0xc')]['checkInBlack']=function(_0x3c6a6e,_0xa9694a,_0x24448e,_0x41afe5,_0x4ea0a6){var _0x445182=this;return new Promise(function(_0x50fbb4,_0x40ff1b){if(_['isNil'](_0xa9694a)||_[_0x070e('0x54')](_0xa9694a[_0x070e('0xec')])||_[_0x070e('0x54')](_0xa9694a['phone'])||_[_0x070e('0x54')](_0xa9694a[_0x070e('0x43')])){_0x40ff1b(ut[_0x070e('0x47')]('Contact\x20is\x20undefined',_0x41afe5,_0x4ea0a6));return;}var _0xbaed32=uuid['v4']();var _0x3a5086=_0x445182['campaignsPreview'][_0xa9694a[_0x070e('0x3f')][_0x070e('0x26')]];var _0x478e5b=_0x24448e?_0x445182['agents'][_0x24448e]['id']:undefined;_0x445182['actions'][_0xbaed32]=new Action(_0xa9694a,_0x3a5086,_0xbaed32,_0x24448e,_0x478e5b);var _0x5e1fee=_0x445182[_0x070e('0x13')][_0xbaed32];_0x5e1fee[_0x070e('0x84')]=_0x41afe5;_0x5e1fee[_0x070e('0xac')]=_0x4ea0a6;_0x5e1fee[_0x070e('0xed')]=_0x24448e;if(_[_0x070e('0xee')](_0x3c6a6e)){_0x445182[_0x070e('0xef')](_0x5e1fee,_0x3a5086,_0xa9694a,_0x24448e)[_0x070e('0x5b')](function(_0x472fc9){logger['info']('[Preview][execCall][success]','Queue:\x20'+_0x5e1fee['queue']+_0x070e('0xf0')+_0x5e1fee[_0x070e('0x86')],JSON[_0x070e('0x23')](_0x472fc9));ami[_0x070e('0x21')](_0x070e('0xf1'),ut['buildObj'](_0x5e1fee,'called',_0x445182[_0x070e('0x10')][_0x5e1fee[_0x070e('0x40')]]));_0x50fbb4(ut['message'](_0x070e('0xf2')));})[_0x070e('0x46')](function(_0x239385){ut[_0x070e('0x2e')](_0x070e('0xf3'),_0x239385);_0x40ff1b(ut[_0x070e('0x47')]('Call\x20failed',_0x41afe5,_0x4ea0a6));});}else{_0x3a5086[_0x070e('0xf4')]+=0x1;ut[_0x070e('0xf5')](_0x5e1fee);rpcDb[_0x070e('0xf6')](_0x5e1fee,'[Blacklist][error]');delete _0x445182[_0x070e('0x13')][_0xbaed32];_0x40ff1b(ut[_0x070e('0x47')](_0x070e('0xf7'),_0x41afe5,_0x4ea0a6));}});};Preview[_0x070e('0xc')]['isTrunkReachable']=function(_0x4175b9){return!_[_0x070e('0x54')](_0x4175b9)&&!_['isNil'](_0x4175b9[_0x070e('0x26')])&&!_[_0x070e('0x54')](_0x4175b9['active'])&&_0x4175b9[_0x070e('0xf8')]&&!_['isNil'](this[_0x070e('0x12')][util['format'](_0x070e('0xf9'),_0x4175b9['name'])])&&!_['isNil'](this[_0x070e('0x12')][util['format']('SIP/%s',_0x4175b9[_0x070e('0x26')])][_0x070e('0x45')])&&(this[_0x070e('0x12')][util[_0x070e('0x24')](_0x070e('0xf9'),_0x4175b9['name'])][_0x070e('0x45')]===_0x070e('0xfa')||this[_0x070e('0x12')][util[_0x070e('0x24')](_0x070e('0xf9'),_0x4175b9[_0x070e('0x26')])]['status']===_0x070e('0xfb'));};Preview[_0x070e('0xc')][_0x070e('0x5a')]=function(_0x44c780,_0x5817a0){return this['execRun'](_0x44c780,_0x5817a0)[_0x070e('0x5b')](function(_0x324641){return _[_0x070e('0x41')](_0x324641,[_0x070e('0x47')]);})[_0x070e('0x46')](function(_0x150ff2){if(_0x150ff2['unlock']){rpcDb[_0x070e('0xfc')](_0x44c780);}if(_0x150ff2[_0x070e('0xf8')]){rpcDb[_0x070e('0x5e')](_0x44c780);}throw _[_0x070e('0x41')](_0x150ff2,[_0x070e('0x47')]);});};Preview[_0x070e('0xc')]['execRun']=function(_0x4aabc3,_0x9b1fb1){var _0x43e514=this;var _0x193c72,_0x150bfb;return rpcDb[_0x070e('0xfd')](_0x4aabc3)[_0x070e('0x5b')](function(_0x257569){if(!_['isNil'](_0x257569[0x0])){_0x150bfb=_0x257569[0x0][_0x070e('0xfe')]?![]:!![];_0x193c72=_0x257569[0x0]['recallme']?!![]:![];_0x193c72=_0x9b1fb1?!![]:_0x193c72;}var _0xfe12a6=_0x43e514['validateContact'](_0x257569);if(_0xfe12a6['isValid']){rpcDb['checkIsBlackList'](_[_0x070e('0x41')](_0x257569[0x0],[_0x070e('0x43'),_0x070e('0xff')]))[_0x070e('0x5b')](function(_0xec8bee){_0x43e514[_0x070e('0x100')](_0xec8bee,_0x257569[0x0],_0x9b1fb1,_0x150bfb,_0x193c72)[_0x070e('0x5b')](function(_0x37285d){return _0x37285d;})[_0x070e('0x46')](function(_0x538bd4){throw _0x538bd4;});})[_0x070e('0x46')](function(_0x170efa){ut[_0x070e('0x2e')](_0x070e('0x101'),_0x170efa);throw ut[_0x070e('0x47')](_0x070e('0x102'),_0x150bfb,_0x193c72);});}else{throw ut[_0x070e('0x47')](_0xfe12a6[_0x070e('0x47')],_0x150bfb,_0x193c72);}})[_0x070e('0x46')](function(_0x4ad025){ut['logger'](_0x070e('0x103'),_0x4ad025);throw ut[_0x070e('0x47')]('Call\x20unsuccessful',![],!![]);});};Preview[_0x070e('0xc')]['validateContact']=function(_0x48d26c){if(_[_0x070e('0x54')](_0x48d26c)||_[_0x070e('0xee')](_0x48d26c)||!_['isNil'](_0x48d26c[0x0][_0x070e('0x58')])&&_[_0x070e('0x54')](_0x48d26c[0x0][_0x070e('0x58')]['name'])){ut['logger'](_0x070e('0x104'),_0x48d26c);return{'isValid':![],'message':_0x070e('0x105')};}var _0x21d392=this['campaignsPreview'][_0x48d26c[0x0][_0x070e('0x3f')][_0x070e('0x26')]];_0x21d392['message']=utils[_0x070e('0x31')][_0x070e('0x71')];if(_[_0x070e('0x54')](_0x21d392)){ut[_0x070e('0x2e')](_0x070e('0x106'),_0x21d392);return{'isValid':![],'message':_0x070e('0x107')};}if(!this[_0x070e('0x6e')](_0x21d392[_0x070e('0x6f')])){ut[_0x070e('0x2e')](_0x070e('0x108'),_0x070e('0x109')+_0x21d392[_0x070e('0x26')]+_0x070e('0x10a'));if(!this[_0x070e('0x6e')](_0x21d392[_0x070e('0x70')])){ut[_0x070e('0x2e')](_0x070e('0x108'),_0x21d392['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut['isActive'](_0x21d392[_0x070e('0x6d')])){ut[_0x070e('0x2e')](_0x070e('0x10b'),_0x21d392['name']+_0x070e('0x10c'));return{'isValid':![],'message':_0x070e('0x109')+_0x21d392[_0x070e('0x26')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x070e('0x10d')};};Preview[_0x070e('0xc')][_0x070e('0xef')]=function(_0x3ef1b3,_0x526afc,_0x7f803a,_0x3967bd){var _0x4717de=this;return new Promise(function(_0x4fde12,_0xcd40c1){var _0x417350=_0x3ef1b3[_0x070e('0x8d')];var _0x220cc9=_0x4717de[_0x070e('0x6e')](_0x526afc[_0x070e('0x6f')])?util[_0x070e('0x24')](_0x070e('0x10e'),_0x526afc[_0x070e('0x6f')]['name'],_['isNil'](_0x526afc[_0x070e('0x10f')])?'':_0x526afc['dialPrefix']['trim']()||'',_0x526afc[_0x070e('0x110')]>0x0?_0x7f803a[_0x070e('0xff')][_0x070e('0x111')](_0x526afc[_0x070e('0x110')]):_0x7f803a[_0x070e('0xff')]):util[_0x070e('0x24')]('SIP/%s/%s%s',_[_0x070e('0x54')](_0x526afc[_0x070e('0x70')])?_0x526afc[_0x070e('0x6f')][_0x070e('0x26')]:_0x526afc['TrunkBackup'][_0x070e('0x26')],_['isNil'](_0x526afc[_0x070e('0x10f')])?'':_0x526afc[_0x070e('0x10f')][_0x070e('0x112')]()||'',_0x526afc[_0x070e('0x110')]>0x0?_0x7f803a[_0x070e('0xff')][_0x070e('0x111')](_0x526afc[_0x070e('0x110')]):_0x7f803a[_0x070e('0xff')]);var _0x2b4e74=_0x4717de['isTrunkReachable'](_0x526afc[_0x070e('0x6f')])?ut[_0x070e('0x113')](_0x526afc[_0x070e('0x6f')][_0x070e('0x114')],_0x526afc[_0x070e('0x115')],_0x526afc[_0x070e('0x116')]>0x0?ut[_0x070e('0x117')](_0x526afc[_0x070e('0x118')],_0x526afc['dialRandomLastDigitCallerIdNumber']):_0x526afc[_0x070e('0x118')]):ut[_0x070e('0x113')](_['isNil'](_0x526afc['TrunkBackup'])?_0x526afc[_0x070e('0x6f')][_0x070e('0x114')]:_0x526afc[_0x070e('0x70')][_0x070e('0x114')],_0x526afc[_0x070e('0x115')],_0x526afc[_0x070e('0x116')]>0x0?ut['getCallerIdRandom'](_0x526afc['dialOriginateCallerIdNumber'],_0x526afc[_0x070e('0x116')]):_0x526afc[_0x070e('0x118')]);if(_0x2b4e74){_0x3ef1b3['originatecalleridname']=ut[_0x070e('0x119')](_0x2b4e74);_0x3ef1b3['originatecalleridnum']=ut[_0x070e('0x11a')](_0x2b4e74);}var _0xa2c957=ut['addVariables'](_0x526afc,_0x7f803a,_0x220cc9,_0x2b4e74,_0x417350,_0x3ef1b3);_[_0x070e('0x11b')](_0x3ef1b3,ut[_0x070e('0x11c')](_0xa2c957));_0x3ef1b3['starttime']=moment()['format'](_0x070e('0x60'));_0x526afc['variables']=_0xa2c957;var _0x1ebec9=ut[_0x070e('0x11d')](_0x3ef1b3,_0x526afc,_0xa2c957,_0x3ef1b3[_0x070e('0xac')],_0x3967bd);return ami['Action'](_0x1ebec9)[_0x070e('0x5b')](function(_0x17adf3){_0x526afc['originated']+=0x1;logger[_0x070e('0x22')](_0x070e('0x11e'),_0x417350,_0x070e('0x8e'),_0x526afc[_0x070e('0x26')],_0x070e('0xd9'),_0x526afc[_0x070e('0x29')]);_0x4fde12(_0x17adf3);})[_0x070e('0x46')](function(_0x358e1b){ut[_0x070e('0xdd')](_0x3ef1b3,0xe,_0x070e('0x11f'));rpcDb['createAgentHistory'](_0x3ef1b3,_0x070e('0x120'));_0xcd40c1(_0x358e1b);});});};Preview[_0x070e('0xc')][_0x070e('0x1b')]=function(_0x52d89d){if(this['actions'][_0x52d89d[_0x070e('0x9f')]]){this[_0x070e('0x13')][_0x52d89d[_0x070e('0x9f')]][_0x070e('0x121')]=_0x52d89d['channel'];}};Preview[_0x070e('0xc')]['syncOriginateResponse']=function(_0x5044e8){var _0x1a1851=this;var _0x52ca6c=this[_0x070e('0x13')][_0x5044e8[_0x070e('0x122')]];if(_0x52ca6c){if(_0x52ca6c[_0x070e('0xed')]&&this[_0x070e('0x53')][_0x52ca6c['lookAgent']]){ut[_0x070e('0x123')](_0x52ca6c,this['agents'][_0x52ca6c[_0x070e('0xed')]][_0x070e('0x26')],this[_0x070e('0x53')][_0x52ca6c[_0x070e('0xed')]]['id']);}var _0x475774=_[_0x070e('0x124')](_0x52ca6c);_0x475774[_0x070e('0x8a')]=moment()[_0x070e('0x24')](_0x070e('0x60'));var _0xf8cfd=_0x1a1851[_0x070e('0x10')][_0x52ca6c[_0x070e('0x40')]];if(ut[_0x070e('0x125')](_0x5044e8[_0x070e('0x126')])){if(_0x52ca6c[_0x070e('0x84')]){rpcDb[_0x070e('0xfc')](_0x52ca6c['idContact']);}if(_0x52ca6c['activeContact']){rpcDb[_0x070e('0x5e')](_0x52ca6c[_0x070e('0x86')]);}ami['emit'](_0x070e('0x127'),ut[_0x070e('0x79')](_0x52ca6c,'rejected',this[_0x070e('0x10')][_0x52ca6c[_0x070e('0x40')]]));this['callProgressDetectingAgent'](_0x475774,_0xf8cfd,_0x5044e8);}else{_0x52ca6c[_0x070e('0x5f')]=moment()[_0x070e('0x24')](_0x070e('0x60'));ut[_0x070e('0xdd')](_0x475774,0x4,_0x070e('0x99'));rpcDb[_0x070e('0xe0')](_0x475774,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x070e('0xc')][_0x070e('0x16')]=function(_0x275767){var _0x4f33d8=this[_0x070e('0x13')][_0x275767[_0x070e('0x9f')]];var _0xe50bad;if(_0x4f33d8){_0xe50bad=this[_0x070e('0x10')][_0x4f33d8['queue']];logger['info'](_0x070e('0x128'),_0x275767[_0x070e('0x9f')],_0x070e('0x8e'),_0xe50bad[_0x070e('0x26')],_0x070e('0x8f'),_0xe50bad[_0x070e('0x2a')]);}if(this[_0x070e('0x13')][_0x275767['linkedid']]&&_0x275767[_0x070e('0x9f')]!==_0x275767[_0x070e('0x8d')]){if(_0x275767[_0x070e('0x129')]==='16'&&this[_0x070e('0x13')][_0x275767[_0x070e('0x9f')]][_0x070e('0x4a')]){this[_0x070e('0x72')](_0x275767,_0x275767[_0x070e('0x9f')],_0x275767[_0x070e('0x129')]);}else if(this[_0x070e('0x13')][_0x275767[_0x070e('0x9f')]][_0x070e('0x4a')]){logger[_0x070e('0x22')](_0x070e('0x12a'),_0x275767[_0x070e('0x9f')],_0x275767['cause'],_0x070e('0x8e'),_0xe50bad[_0x070e('0x26')],_0x070e('0x8f'),_0xe50bad[_0x070e('0x2a')]);this[_0x070e('0x72')](_0x275767,_0x275767[_0x070e('0x9f')],_0x275767[_0x070e('0x129')]);}}else if(_0x4f33d8&&_['isNil'](_0x4f33d8[_0x070e('0x12b')])&&_0xe50bad[_0x070e('0x12c')]&&_0x275767[_0x070e('0x9f')]===_0x275767[_0x070e('0x8d')]&&_[_0x070e('0x54')](_0x275767[_0x070e('0xe5')])&&_0x275767[_0x070e('0x129')]==='16'&&_0x275767[_0x070e('0x12d')]==='6'&&_[_0x070e('0xdb')](_0x4f33d8['transfer'])){if(_0x4f33d8[_0x070e('0x84')]){rpcDb[_0x070e('0xfc')](_0x4f33d8[_0x070e('0x86')]);}if(_0x4f33d8[_0x070e('0xac')]){rpcDb[_0x070e('0x5e')](_0x4f33d8[_0x070e('0x86')]);}_0x275767[_0x070e('0xe5')]='22';this[_0x070e('0x12e')](_0x4f33d8,_0xe50bad,_0x275767);}else if(_0x4f33d8&&_0x4f33d8[_0x070e('0x12f')]){if(_0x275767[_0x070e('0x129')]==='16'&&this[_0x070e('0x13')][_0x275767[_0x070e('0x9f')]][_0x070e('0x4a')]){logger[_0x070e('0x22')](_0x070e('0x130'),_0x275767[_0x070e('0x9f')],_0x275767[_0x070e('0x129')],_0x070e('0x8e'),_0xe50bad[_0x070e('0x26')],_0x070e('0x8f'),_0xe50bad[_0x070e('0x2a')]);this[_0x070e('0x72')](_0x275767,_0x275767['linkedid'],_0x275767[_0x070e('0x129')]);}else if(this[_0x070e('0x13')][_0x275767[_0x070e('0x9f')]][_0x070e('0x4a')]){logger['info'](_0x070e('0x12a'),_0x275767['linkedid'],_0x275767[_0x070e('0x129')],'\x20Queue',_0xe50bad['name'],_0x070e('0x8f'),_0xe50bad[_0x070e('0x2a')]);this[_0x070e('0x72')](_0x275767,_0x275767['linkedid'],_0x275767[_0x070e('0x129')]);}}};Preview['prototype'][_0x070e('0x1a')]=function(_0x1e0e55){if(this['actions'][_0x1e0e55[_0x070e('0x131')]]&&_0x1e0e55['destlinkedid']!==_0x1e0e55[_0x070e('0x132')]){this[_0x070e('0x72')](_0x1e0e55,_0x1e0e55[_0x070e('0x131')],_0x1e0e55['dialstatus']);}};Preview['prototype'][_0x070e('0x17')]=function(_0x4bed29){if(this[_0x070e('0x13')][_0x4bed29[_0x070e('0x9f')]]&&_0x4bed29[_0x070e('0x9f')]!==_0x4bed29[_0x070e('0x8d')]&&!this[_0x070e('0x13')][_0x4bed29[_0x070e('0x9f')]]['dialAnswer']){if(_0x4bed29['cause']==='1'){this[_0x070e('0x72')](_0x4bed29,_0x4bed29['linkedid'],_0x4bed29['cause']);}}};Preview[_0x070e('0xc')][_0x070e('0x133')]=function(_0x3c8b7d,_0x5ddf05,_0x241d86){if(this[_0x070e('0x13')][_0x3c8b7d]){if(_[_0x070e('0x54')](this['actions'][_0x3c8b7d]['variables'])){this[_0x070e('0x13')][_0x3c8b7d][_0x070e('0x134')]={};}this[_0x070e('0x13')][_0x3c8b7d]['variables'][_0x5ddf05]=_0x241d86;}};Preview[_0x070e('0xc')]['syncVarSet']=function(_0x2e9263){try{if(!_['isNil'](_0x2e9263)){if(ut[_0x070e('0x135')](_[_0x070e('0x136')](_0x2e9263['variable'])[0x0])){this[_0x070e('0x133')](_0x2e9263[_0x070e('0x8d')],_[_0x070e('0x136')](_0x2e9263[_0x070e('0x137')])[0x0],_0x2e9263[_0x070e('0x138')]);}}}catch(_0xd6529a){logger[_0x070e('0x139')](_0x070e('0x13a'),util[_0x070e('0x13b')](_0xd6529a,{'showHidden':![],'depth':null}));}};Preview[_0x070e('0xc')][_0x070e('0x1e')]=function(_0x10b168){if(_0x10b168){if(this[_0x070e('0x13')][_0x10b168['transfertargetlinkedid']]){this[_0x070e('0x13')][_0x10b168[_0x070e('0x13c')]][_0x070e('0x12f')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x38afa3){if(_0x38afa3){if(this[_0x070e('0x13')][_0x38afa3['transfererlinkedid']]){this[_0x070e('0x13')][_0x38afa3[_0x070e('0x13d')]][_0x070e('0x12f')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x9c44=['Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','starttime','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','logLookAgent','clone','isFailure','Answer','[syncHangup][talking]','cause','statedesc','channelstate','transfer','addVariable','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','../ami','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','localhost','socket.io-emitter','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','syncNewExten','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','info','voice:queue:%s','voice_queue_presence:remove','sendMessageOneNotActive','available','message','CAMPAIGN_STATUS','INACTIVE','logger','\x20is\x20not\x20active','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20deactivated','prototype','syncCampaigns','dialMethod','booked','type','outbound','clearZombieChannels','hasOwnProperty','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','sequence','[clearZombieChannels][talking]','Queue','queue','originated:\x20','stringify','pTalking:\x20','pTalking','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','catch','disableContact','format','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','totalGlobal','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','name','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumBillable','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','rescheduleContact','swapAdditionalPhones','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','originated','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','isNil','Contact','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','phone','checkInBlack','[Preview][checkIsBlackList]'];(function(_0x2c4e05,_0x306c4e){var _0x2563df=function(_0x2a56fa){while(--_0x2a56fa){_0x2c4e05['push'](_0x2c4e05['shift']());}};_0x2563df(++_0x306c4e);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'use strict';var util=require('util');var _=require('lodash');var uuid=require(_0x49c4('0x0'));var moment=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));var logger=require(_0x49c4('0x4'))(_0x49c4('0x5'));var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0x49c4('0x6'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x49c4('0x7'));var Action=require(_0x49c4('0x8'));var ut=require(_0x49c4('0x9'));var utils=require(_0x49c4('0xa'));config[_0x49c4('0xb')]=_['defaults'](config[_0x49c4('0xb')],{'host':_0x49c4('0xc'),'port':0x18eb});var io=require(_0x49c4('0xd'))(new Redis(config[_0x49c4('0xb')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x451ea6){this[_0x49c4('0xe')]=this['tail']?this[_0x49c4('0xe')][_0x49c4('0xf')](_0x451ea6):_0x451ea6();};function Preview(_0x4adb3c){this['sequence']=new Sequence();this[_0x49c4('0x10')]=_0x4adb3c[_0x49c4('0x11')];this['trunks']=_0x4adb3c[_0x49c4('0x12')];this[_0x49c4('0x13')]={};this['agents']=_0x4adb3c[_0x49c4('0x14')];this[_0x49c4('0x15')]=0x0;ami['on'](_0x49c4('0x16'),this[_0x49c4('0x17')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x19'),this[_0x49c4('0x1a')][_0x49c4('0x18')](this));ami['on']('hanguprequest',this[_0x49c4('0x1b')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1c'),this[_0x49c4('0x1d')][_0x49c4('0x18')](this));ami['on']('newexten',this[_0x49c4('0x1e')][_0x49c4('0x18')](this));ami['on']('varset',this['syncVarSet'][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1f'),this[_0x49c4('0x20')]['bind'](this));ami['on'](_0x49c4('0x21'),this['syncBlindTransfer'][_0x49c4('0x18')](this));this[_0x49c4('0x22')](this[_0x49c4('0x10')]);}function emit(_0x291526,_0x382040,_0x41078c){io['to'](_0x291526)[_0x49c4('0x23')](_0x382040,_0x41078c);}function emitVoiceQueueChannelRemove(_0x46e475){logger[_0x49c4('0x24')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x46e475));emit(util['format'](_0x49c4('0x25'),_0x46e475['name']),'voice_queue_channel:remove',_0x46e475);io[_0x49c4('0x23')](_0x49c4('0x26'),_0x46e475);}function notSendMessagesQueue(_0x26c640){if(_0x26c640[_0x49c4('0x27')]){if(_0x26c640['originated']===0x0&&_0x26c640['pTalking']===0x0){_0x26c640[_0x49c4('0x27')]=![];_0x26c640[_0x49c4('0x28')]=0x0;_0x26c640['paused']=0x0;_0x26c640[_0x49c4('0x29')]=utils[_0x49c4('0x2a')][_0x49c4('0x2b')];ut[_0x49c4('0x2c')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x26c640['name']+_0x49c4('0x2d'));}else{_0x26c640['message']=utils[_0x49c4('0x2a')][_0x49c4('0x2e')];ut[_0x49c4('0x2c')](_0x49c4('0x2f'),_0x26c640['name']+_0x49c4('0x30'));}}}Preview[_0x49c4('0x31')][_0x49c4('0x22')]=function(){var _0x4f28a2=this;setInterval(function(){_0x4f28a2[_0x49c4('0x32')]();},0x7cf);};Preview[_0x49c4('0x31')][_0x49c4('0x32')]=function(){var _0x427b26=this[_0x49c4('0x10')];this[_0x49c4('0x15')]+=0x1;for(var _0x46f7ea in _0x427b26){if(_0x427b26['hasOwnProperty'](_0x46f7ea)&&(_0x427b26[_0x46f7ea]['dialMethod']==='preview'||_0x427b26[_0x46f7ea][_0x49c4('0x33')]===_0x49c4('0x34'))&&_0x427b26[_0x46f7ea][_0x49c4('0x35')]===_0x49c4('0x36')){if(this[_0x49c4('0x15')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x49c4('0x37')]();}}if(_0x427b26[_0x49c4('0x38')](_0x46f7ea)&&_0x427b26[_0x46f7ea][_0x49c4('0x33')]===_0x49c4('0x5')&&_0x427b26[_0x46f7ea]['type']==='outbound'){if(_0x427b26[_0x46f7ea][_0x49c4('0x39')]){this[_0x49c4('0x3a')](_0x427b26[_0x46f7ea]);if(_0x427b26[_0x46f7ea][_0x49c4('0x3b')])this[_0x49c4('0x3c')](_0x427b26[_0x46f7ea]);}else{notSendMessagesQueue(_0x427b26[_0x46f7ea]);}}}};Preview[_0x49c4('0x31')]['clearZombieChannel']=function(_0x2aac35){var _0x84c621=this;this[_0x49c4('0x3d')]['enqueue'](function(){if(!_['isNil'](_0x84c621[_0x49c4('0x13')][_0x2aac35])){loggerAction[_0x49c4('0x24')](_0x49c4('0x3e'),_0x2aac35,_0x49c4('0x3f'),_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x40')],_0x49c4('0x41'),JSON[_0x49c4('0x42')](_0x84c621[_0x49c4('0x10')][_0x84c621['actions'][_0x2aac35][_0x49c4('0x40')]]['originated']),_0x49c4('0x43'),JSON[_0x49c4('0x42')](_0x84c621[_0x49c4('0x10')][_0x84c621[_0x49c4('0x13')][_0x2aac35]['queue']][_0x49c4('0x44')]),JSON[_0x49c4('0x42')](_0x84c621[_0x49c4('0x13')][_0x2aac35]['dialAnswer']),JSON[_0x49c4('0x42')](_[_0x49c4('0x45')](_0x84c621[_0x49c4('0x13')][_0x2aac35],[_0x49c4('0x46'),_0x49c4('0x47'),_0x49c4('0x48'),_0x49c4('0x49')])));return ami[_0x49c4('0x4a')]({'action':_0x49c4('0x4b'),'channel':_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x4c')]})['catch'](function(_0x2d2510){if(_0x2d2510[_0x49c4('0x29')]===_0x49c4('0x4d')){setTimeout(function(){if(_0x84c621[_0x49c4('0x13')][_0x2aac35]){ut[_0x49c4('0x4e')](_0x84c621[_0x49c4('0x10')][_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x40')]],_0x49c4('0x4f'));if(_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x50')]===!![]){ut[_0x49c4('0x51')](_0x84c621[_0x49c4('0x10')][_0x84c621['actions'][_0x2aac35][_0x49c4('0x40')]],'[clearZombieChannel]');ut[_0x49c4('0x52')](_0x49c4('0x53')+_0x2aac35,_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x40')]);}ut[_0x49c4('0x52')](_0x49c4('0x54')+_0x2aac35,_0x84c621['actions'][_0x2aac35]['queue']);delete _0x84c621[_0x49c4('0x13')][_0x2aac35];}},0x2328);}});}});};Preview[_0x49c4('0x31')][_0x49c4('0x37')]=function(){var _0x117151=this;loggerAction['info'](_0x49c4('0x55'),_[_0x49c4('0x56')](this[_0x49c4('0x13')]));for(var _0x444270 in this[_0x49c4('0x13')]){if(_0x117151[_0x49c4('0x13')][_0x49c4('0x38')](_0x444270)){_0x117151[_0x49c4('0x57')](_0x444270);}}};Preview[_0x49c4('0x31')]['recallMe']=function(_0x2ad771){var _0x4d27d0=this;rpcDb[_0x49c4('0x58')](_0x2ad771['id'],ut[_0x49c4('0x59')](this[_0x49c4('0x14')]))[_0x49c4('0x5a')](function(_0x2d93d8){if(!_['isNil'](_0x2d93d8)){for(var _0x592e8e=0x0;_0x592e8e<_0x2d93d8[_0x49c4('0x5b')];_0x592e8e+=0x1){if(ut[_0x49c4('0x5c')](_0x2d93d8[_0x592e8e][_0x49c4('0x5d')])<_0x2ad771[_0x49c4('0x5e')]*0x3c){if(_0x2d93d8[_0x592e8e][_0x49c4('0x5f')]&&!_0x2d93d8[_0x592e8e][_0x49c4('0x5f')]['voicePause']){_0x4d27d0[_0x49c4('0x60')](_0x2d93d8[_0x592e8e]['id'])['then'](ut[_0x49c4('0x61')](_0x49c4('0x62')))[_0x49c4('0x63')](ut[_0x49c4('0x61')](_0x49c4('0x62')));}else{rpcDb[_0x49c4('0x64')](_0x2d93d8[_0x592e8e]['id']);}}else{var _0x2c6be1=new Action(_0x2d93d8[_0x592e8e],_0x2ad771);_0x2c6be1['starttime']=moment()[_0x49c4('0x65')](_0x49c4('0x66'));_0x2ad771['outboundReCallsDay']+=0x1;ut[_0x49c4('0x67')](_0x2c6be1,0x17,_0x49c4('0x68'));if(_0x2ad771[_0x49c4('0x69')]){rpcDb[_0x49c4('0x6a')](ut['createBody'](_0x2d93d8[_0x592e8e]));rpcDb['createCustomerHistory'](_0x2c6be1,_0x49c4('0x6b'));}else{ut['logCustomer'](_0x2c6be1,0x16,_0x49c4('0x6c'));rpcDb[_0x49c4('0x6d')](_0x2c6be1,_0x49c4('0x6e'));rpcDb[_0x49c4('0x6f')](_0x2c6be1,_0x49c4('0x6e'));}}}}})[_0x49c4('0x63')](ut[_0x49c4('0x61')]('[getContactRecallMe]'));};Preview[_0x49c4('0x31')][_0x49c4('0x3a')]=function(_0x3936d3){_0x3936d3[_0x49c4('0x27')]=!![];if(ut[_0x49c4('0x70')](_0x3936d3[_0x49c4('0x71')])){_0x3936d3[_0x49c4('0x29')]=utils[_0x49c4('0x2a')][_0x49c4('0x72')];}else if(!ut[_0x49c4('0x73')](_0x3936d3['dialActive'])){_0x3936d3['message']=utils[_0x49c4('0x2a')][_0x49c4('0x2b')];}else if(!this['isTrunkReachable'](_0x3936d3['Trunk'])){if(!this[_0x49c4('0x74')](_0x3936d3['TrunkBackup'])){_0x3936d3['message']=utils[_0x49c4('0x2a')][_0x49c4('0x75')];}else{_0x3936d3[_0x49c4('0x29')]=utils[_0x49c4('0x2a')][_0x49c4('0x76')];}}else{_0x3936d3[_0x49c4('0x29')]=utils[_0x49c4('0x2a')]['ACTIVE'];}};Preview[_0x49c4('0x31')][_0x49c4('0x77')]=function(_0x207572,_0x208208,_0x73840f){var _0xa431d=this;var _0x5d24f3=this['actions'][_0x208208];var _0x1ef0c1=this[_0x49c4('0x10')][_0x5d24f3[_0x49c4('0x40')]];var _0xf7a10f;var _0x23288e=![];var _0x6b2592=0x2;var _0xc2033f=0x3;if(_0x1ef0c1){switch(_0x73840f){case'1':_0x1ef0c1['outboundNoSuchCallsDay']+=0x1;_0x5d24f3[_0x49c4('0x78')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut['totalGlobal'](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x0,'NoSuchNumber');ami[_0x49c4('0x23')](_0x49c4('0x7a'),ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0x7c')));rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0x7d'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'0',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x483770){_0x23288e=_0x483770[_0x49c4('0x7f')]==0x1;_0x6b2592=_0x1ef0c1[_0x49c4('0x80')];_0xc2033f=_0x1ef0c1['callAdditionalPhoneAfterMin'];if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut['cloneAction'](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x5d24f3['countnosuchnumberretry']>=_0x1ef0c1['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0x84'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0x85')](_0x5d24f3,_0x49c4('0x78'),_0x1ef0c1['dialNoSuchNumberRetryFrequency']),_0x5d24f3[_0x49c4('0x86')],_0x5d24f3[_0x49c4('0x87')]);}}delete this['actions'][_0x207572[_0x49c4('0x88')]];}else{_0x5d24f3[_0x49c4('0x78')]++;logger[_0x49c4('0x24')](_0x49c4('0x89'),_0x5d24f3['countnosuchnumberretry']);logger[_0x49c4('0x24')]('id',_0x5d24f3[_0x49c4('0x8a')]);_0xa431d[_0x49c4('0x8b')]({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnosuchnumberretry':_0x5d24f3['countnosuchnumberretry']}})[_0x49c4('0x5a')](function(){_0xa431d['swapAdditionalPhones'](_0x5d24f3,_0x6b2592,_0xc2033f)['then'](function(){});});}});break;case'ANSWER':var _0x5d6de0=moment()[_0x49c4('0x65')](_0x49c4('0x66'));_0x5d24f3[_0x49c4('0x8c')]=_0x5d6de0;_0x5d24f3[_0x49c4('0x8d')]=_0x5d6de0;_0x5d24f3['dialAnswer']=!![];_0x1ef0c1['pTalking']+=0x1;logger[_0x49c4('0x24')](_0x49c4('0x8e'),_0x5d24f3[_0x49c4('0x8f')],_0x49c4('0x90'),_0x1ef0c1[_0x49c4('0x91')],_0x49c4('0x43'),_0x1ef0c1[_0x49c4('0x44')]);ami[_0x49c4('0x23')]('custom:agentconnect',ut[_0x49c4('0x7b')](_0x5d24f3,'connect',this[_0x49c4('0x10')][_0x5d24f3[_0x49c4('0x40')]]));if(_0x1ef0c1[_0x49c4('0x92')]){ami[_0x49c4('0x23')](_0x49c4('0x93'),ut[_0x49c4('0x94')](_0x5d24f3));}break;case'16':ami[_0x49c4('0x23')](_0x49c4('0x95'),ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0x96'),this[_0x49c4('0x10')][_0x5d24f3[_0x49c4('0x40')]]));emitVoiceQueueChannelRemove(ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0x96')));_0x1ef0c1[_0x49c4('0x97')]+=0x1;_0x1ef0c1[_0x49c4('0x98')]+=0x1;_0x1ef0c1[_0x49c4('0x99')]+=0x1;ut[_0x49c4('0x51')](_0x1ef0c1,'[16]');_0x5d24f3['countglobal']=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x4,'Answer');rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0x9a'));rpcDb[_0x49c4('0x6f')](_0x5d24f3,_0x49c4('0x9b'));rpcDb['crateCustomerReportQueue'](_0x5d24f3);_0x1ef0c1['sumDuration']+=_0x5d24f3['talktime'];_0x1ef0c1[_0x49c4('0x9c')]+=_0x5d24f3[_0x49c4('0x9d')];logger[_0x49c4('0x24')](_0x49c4('0x9e'),_0x5d24f3[_0x49c4('0x8f')],_0x49c4('0x90'),_0x1ef0c1[_0x49c4('0x91')],_0x49c4('0x43'),_0x1ef0c1[_0x49c4('0x44')]);delete this['actions'][_0x207572[_0x49c4('0x88')]];break;case _0x49c4('0x9f'):_0x1ef0c1[_0x49c4('0xa0')]+=0x1;_0x5d24f3['countbusyretry']+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x5,_0x49c4('0xa1'));_0x6b2592=_0x1ef0c1[_0x49c4('0xa2')];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];ami[_0x49c4('0x23')](_0x49c4('0xa4'),ut['buildObj'](_0x5d24f3,_0x49c4('0xa5')));rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0xa6'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'5',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x4a204d){_0x23288e=_0x4a204d['additional']==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1['dialGlobalMaxRetry']){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0xf,'Global');rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xa8'));}else{if(_0x5d24f3[_0x49c4('0xa9')]>=_0x1ef0c1[_0x49c4('0xaa')]){rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0xa6'));}else{rpcDb[_0x49c4('0xab')](ut[_0x49c4('0x85')](_0x5d24f3,_0x49c4('0xa9'),_0x1ef0c1[_0x49c4('0xa2')]),_0x5d24f3[_0x49c4('0x86')],_0x5d24f3[_0x49c4('0x87')]);}}}else{_0x5d24f3[_0x49c4('0xa9')]++;_0xa431d[_0x49c4('0x8b')]({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countbusyretry':_0x5d24f3['countbusyretry']}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)['then'](function(){});});}});break;case _0x49c4('0xad'):_0x1ef0c1['outboundNoAnswerCallsDay']+=0x1;_0x5d24f3[_0x49c4('0xae')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x3,_0x49c4('0xaf'));_0x6b2592=_0x1ef0c1['dialNoAnswerRetryFrequency'];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];var _0x2329b6=ut['buildNoAnswerEventPayload'](_0x5d24f3,_0x1ef0c1);ami[_0x49c4('0x23')](_0x49c4('0xb0'),_0x2329b6);rpcDb['createCustomerHistory'](_0x5d24f3,_0x49c4('0xb1'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'3',_0x1ef0c1)['then'](function(_0x37fef1){_0x23288e=_0x37fef1[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut['cloneAction'](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x5d24f3[_0x49c4('0xae')]>=_0x1ef0c1['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x5d24f3,_0x49c4('0xae'),_0x1ef0c1[_0x49c4('0xb2')]),_0x5d24f3['unlockAgent'],_0x5d24f3[_0x49c4('0x87')]);}}}else{_0x5d24f3['countnoanswerretry']++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3['idContact'],'field':{'countnoanswerretry':_0x5d24f3[_0x49c4('0xae')]}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});break;case'CONGESTION':_0x1ef0c1['outboundCongestionCallsDay']+=0x1;_0x5d24f3[_0x49c4('0xb3')]+=0x1;_0x5d24f3['countglobal']=ut[_0x49c4('0x81')](_0x5d24f3);ut['logCustomer'](_0x5d24f3,0x8,_0x49c4('0xb4'));_0x6b2592=_0x1ef0c1[_0x49c4('0xb5')];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];ami[_0x49c4('0x23')](_0x49c4('0xb6'),ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0xb7')));rpcDb['createCustomerHistory'](_0x5d24f3,_0x49c4('0xb8'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'8',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x16864c){_0x23288e=_0x16864c[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut['totalGlobal'](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb['createCustomerFinal'](_0xf7a10f,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x5d24f3[_0x49c4('0xb3')]>=_0x1ef0c1[_0x49c4('0xb9')]){rpcDb[_0x49c4('0x6f')](_0x5d24f3,_0x49c4('0xb8'));}else{rpcDb[_0x49c4('0xab')](ut['scheduledAt'](_0x5d24f3,_0x49c4('0xb3'),_0x1ef0c1[_0x49c4('0xa2')]),_0x5d24f3[_0x49c4('0x86')],_0x5d24f3[_0x49c4('0x87')]);}}}else{_0x5d24f3['countcongestionretry']++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countcongestionretry':_0x5d24f3[_0x49c4('0xb3')]}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});break;case'CANCEL':_0x1ef0c1[_0x49c4('0xba')]+=0x1;_0x5d24f3[_0x49c4('0xbb')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x14,_0x49c4('0xbc'));_0x6b2592=_0x1ef0c1['dialAgentRejectRetryFrequency'];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];ami[_0x49c4('0x23')](_0x49c4('0xbd'),ut[_0x49c4('0x7b')](_0x5d24f3,'agentreject'));rpcDb['createCustomerHistory'](_0x5d24f3,_0x49c4('0xbe'));_0xa431d['verifyAdditionalPhones'](_0x5d24f3,'20',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x532ba5){_0x23288e=_0x532ba5[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0xf7a10f,_0x49c4('0xbf'));}else{if(_0x5d24f3[_0x49c4('0xbb')]>=_0x1ef0c1[_0x49c4('0xc0')]){rpcDb['createCustomerFinal'](_0x5d24f3,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x49c4('0xab')](ut['scheduledAt'](_0x5d24f3,'countagentrejectretry',_0x1ef0c1[_0x49c4('0xc1')]),_0x5d24f3['unlockAgent'],_0x5d24f3[_0x49c4('0x87')]);}}}else{_0x5d24f3[_0x49c4('0xae')]++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnoanswerretry':_0x5d24f3[_0x49c4('0xae')]}})['then'](function(){_0xa431d['swapAdditionalPhones'](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});break;case'ABANDONED':_0x1ef0c1[_0x49c4('0xc2')]+=0x1;_0x5d24f3[_0x49c4('0xc3')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0xb,_0x49c4('0xc4'));rpcDb[_0x49c4('0x6d')](_0x5d24f3,'[callProgressDetectingCustomer][logAbandoned]');_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'11',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x85418e){_0x23288e=_0x85418e[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1['dialGlobalMaxRetry']){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0xf,'Global');rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xc5'));}else{if(_0x5d24f3[_0x49c4('0xc6')]>=_0x1ef0c1[_0x49c4('0xc7')]){rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0xc5'));}else{rpcDb[_0x49c4('0xab')](ut[_0x49c4('0x85')](_0x5d24f3,_0x49c4('0xc3'),_0x1ef0c1[_0x49c4('0xc8')]),_0x5d24f3[_0x49c4('0x86')],_0x5d24f3['activeContact']);}}}else{_0x5d24f3[_0x49c4('0xae')]++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnoanswerretry':_0x5d24f3[_0x49c4('0xae')]}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)['then'](function(){});});}});break;case'18':_0x1ef0c1[_0x49c4('0xc9')]+=0x1;_0x5d24f3[_0x49c4('0xca')]+=0x1;_0x5d24f3['countglobal']=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x12,_0x207572['cause-txt']||_0x207572['dialstatus']);ami[_0x49c4('0x23')](_0x49c4('0xcb'),ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0xcc')));rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0xcd'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'18',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x2b6e61){_0x23288e=_0x2b6e61[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1['dialGlobalMaxRetry']){_0xf7a10f=ut['cloneAction'](_0x5d24f3,0x12,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xcd'));}else{rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0xcd'));}}else{_0x5d24f3[_0x49c4('0xae')]++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnoanswerretry':_0x5d24f3['countnoanswerretry']}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});delete this[_0x49c4('0x13')][_0x207572['linkedid']];break;case'19':_0x1ef0c1[_0x49c4('0xc9')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x13,_0x207572[_0x49c4('0xce')]||_0x207572['dialstatus']);ami['emit']('custom:amd',ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0xcc')));rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0xcf'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'18',_0x1ef0c1)['then'](function(_0x3ea304){_0x23288e=_0x3ea304[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut['cloneAction'](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xcf'));}else{rpcDb[_0x49c4('0x6f')](_0x5d24f3,_0x49c4('0xcf'));}}else{_0x5d24f3['countnoanswerretry']++;_0xa431d[_0x49c4('0x8b')]({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnoanswerretry':_0x5d24f3[_0x49c4('0xae')]}})['then'](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});delete this[_0x49c4('0x13')][_0x207572['linkedid']];break;default:if(_0x5d24f3[_0x49c4('0x50')]){ut['decrementTalkink'](_0x1ef0c1,'[default]');ut[_0x49c4('0x52')](_0x49c4('0xd0')+_0x1ef0c1['name'],_0x207572);}_0x1ef0c1[_0x49c4('0xc9')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0xc,_0x207572[_0x49c4('0xce')]||_0x207572[_0x49c4('0xd1')]);_0x6b2592=_0x1ef0c1[_0x49c4('0xc1')];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];rpcDb['createCustomerHistory'](_0x5d24f3,'[callProgressDetectingCustomer][logUnknown]');_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'20',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x42f2db){_0x23288e=_0x42f2db['additional']==0x1;if(!_0x23288e){if(ut['totalGlobal'](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xd2'));}else{rpcDb[_0x49c4('0x6f')](_0x5d24f3,_0x49c4('0xd2'));}delete this[_0x49c4('0x13')][_0x207572[_0x49c4('0x88')]];}else{_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});}});}if(!(_0x5d24f3[_0x49c4('0x50')]&&_0x73840f==='16')){ut[_0x49c4('0x4e')](_0x1ef0c1,_0x49c4('0xd3'));logger['info'](_0x49c4('0xd4'),_0x5d24f3[_0x49c4('0x8f')],_0x49c4('0x90'),_0x1ef0c1[_0x49c4('0x91')],'originated:\x20',_0x1ef0c1['originated']);}if(_0x73840f!==_0x49c4('0xd5')){delete this['actions'][_0x207572[_0x49c4('0x88')]];delete this[_0x49c4('0x13')][_0x207572[_0x49c4('0xd6')]];}_0x1ef0c1[_0x49c4('0xd7')]=!![];}};Preview[_0x49c4('0x31')][_0x49c4('0xd8')]=function(_0x3238e7,_0xe9e187,_0x31ba95){if(_[_0x49c4('0xd9')](_0xe9e187)&&_0x49c4('0xda')!==typeof _0xe9e187){return;}if(_[_0x49c4('0xd9')](_0x31ba95)&&'object'!==typeof _0x31ba95){return;}switch(_0x31ba95[_0x49c4('0xdb')]){case'0':ut[_0x49c4('0xdc')](_0x3238e7,0x0,_0x49c4('0xdd'));rpcDb['createAgentHistory'](_0x3238e7,_0x49c4('0xde'));break;case'3':ut['logAgent'](_0x3238e7,0x3,_0x49c4('0xaf'));rpcDb[_0x49c4('0xdf')](_0x3238e7,_0x49c4('0xe0'));break;case'5':ut[_0x49c4('0xdc')](_0x3238e7,0x5,'Busy');rpcDb[_0x49c4('0xdf')](_0x3238e7,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x3238e7,0x8,_0x49c4('0xb4'));rpcDb[_0x49c4('0xdf')](_0x3238e7,_0x49c4('0xe1'));break;case'22':ut['logAgent'](_0x3238e7,0x16,'AnswerAGI');rpcDb[_0x49c4('0xdf')](_0x3238e7,_0x49c4('0xe2'));break;default:ut[_0x49c4('0xdc')](_0x3238e7,0xc,_0x31ba95[_0x49c4('0xdb')]);rpcDb[_0x49c4('0xdf')](_0x3238e7,_0x49c4('0xe1'));}ut[_0x49c4('0x4e')](_0xe9e187,_0x49c4('0xe3'));logger[_0x49c4('0x24')]('[originated][decrement][callProgressDetectingAgent]',_0x3238e7[_0x49c4('0x8f')],_0x49c4('0x90'),_0xe9e187['name'],'originated:\x20',_0xe9e187[_0x49c4('0xe4')]);delete this['actions'][_0x3238e7[_0x49c4('0x8f')]];};Preview['prototype'][_0x49c4('0x7e')]=function(_0x4b83a6,_0x30781e,_0x1fb51e){return cmHopperAdditionalPhone[_0x49c4('0x7e')](_0x4b83a6,_0x30781e,_0x1fb51e)[_0x49c4('0x63')](logger['info']('[verifyAdditionalPhone]\x20'));};Preview[_0x49c4('0x31')][_0x49c4('0xac')]=function(_0x3ce256,_0x5737b4,_0x367d3d){return cmHopperAdditionalPhone[_0x49c4('0xac')](_0x3ce256,_0x5737b4,_0x367d3d)['catch'](logger['info'](_0x49c4('0xe5')));};Preview[_0x49c4('0x31')][_0x49c4('0x8b')]=function(_0x49dc8a){return Promise[_0x49c4('0xe6')]()[_0x49c4('0x5a')](cmHopperAdditionalPhone[_0x49c4('0x8b')](_0x49dc8a))[_0x49c4('0x63')](logger['info'](_0x49c4('0xe7')));};Preview['prototype']['checkInBlack']=function(_0xf5f718,_0x171530,_0x12fda9,_0x24ff20,_0x5adb90){var _0x32b6e4=this;return new Promise(function(_0x947dd8,_0xa6f48){if(_[_0x49c4('0xe8')](_0x171530)||_['isNil'](_0x171530[_0x49c4('0xe9')])||_['isNil'](_0x171530['phone'])||_[_0x49c4('0xe8')](_0x171530[_0x49c4('0x48')])){_0xa6f48(ut[_0x49c4('0x29')]('Contact\x20is\x20undefined',_0x24ff20,_0x5adb90));return;}var _0x336853=uuid['v4']();var _0x4a874a=_0x32b6e4[_0x49c4('0x10')][_0x171530[_0x49c4('0x3f')][_0x49c4('0x91')]];var _0x3738d7=_0x12fda9?_0x32b6e4[_0x49c4('0x14')][_0x12fda9]['id']:undefined;_0x32b6e4[_0x49c4('0x13')][_0x336853]=new Action(_0x171530,_0x4a874a,_0x336853,_0x12fda9,_0x3738d7);var _0x2b31ac=_0x32b6e4['actions'][_0x336853];_0x2b31ac[_0x49c4('0x86')]=_0x24ff20;_0x2b31ac[_0x49c4('0x87')]=_0x5adb90;_0x2b31ac[_0x49c4('0xea')]=_0x12fda9;if(_[_0x49c4('0xeb')](_0xf5f718)){_0x32b6e4['execCall'](_0x2b31ac,_0x4a874a,_0x171530,_0x12fda9)['then'](function(_0x4c15ff){logger[_0x49c4('0x24')](_0x49c4('0xec'),_0x49c4('0xed')+_0x2b31ac[_0x49c4('0x40')]+_0x49c4('0xee')+_0x2b31ac[_0x49c4('0x8a')],JSON[_0x49c4('0x42')](_0x4c15ff));ami['emit'](_0x49c4('0xef'),ut[_0x49c4('0x7b')](_0x2b31ac,'called',_0x32b6e4['campaignsPreview'][_0x2b31ac['queue']]));_0x947dd8(ut[_0x49c4('0x29')](_0x49c4('0xf0')));})[_0x49c4('0x63')](function(_0x3d0013){ut[_0x49c4('0x2c')](_0x49c4('0xf1'),_0x3d0013);_0xa6f48(ut[_0x49c4('0x29')]('Call\x20failed',_0x24ff20,_0x5adb90));});}else{_0x4a874a[_0x49c4('0xf2')]+=0x1;ut[_0x49c4('0xf3')](_0x2b31ac);rpcDb[_0x49c4('0xf4')](_0x2b31ac,_0x49c4('0xf5'));delete _0x32b6e4['actions'][_0x336853];_0xa6f48(ut[_0x49c4('0x29')](_0x49c4('0xf6'),_0x24ff20,_0x5adb90));}});};Preview[_0x49c4('0x31')][_0x49c4('0x74')]=function(_0x12d707){return!_['isNil'](_0x12d707)&&!_[_0x49c4('0xe8')](_0x12d707['name'])&&!_['isNil'](_0x12d707[_0x49c4('0xf7')])&&_0x12d707[_0x49c4('0xf7')]&&!_[_0x49c4('0xe8')](this[_0x49c4('0x12')][util[_0x49c4('0x65')]('SIP/%s',_0x12d707[_0x49c4('0x91')])])&&!_[_0x49c4('0xe8')](this[_0x49c4('0x12')][util['format'](_0x49c4('0xf8'),_0x12d707[_0x49c4('0x91')])]['status'])&&(this[_0x49c4('0x12')][util[_0x49c4('0x65')](_0x49c4('0xf8'),_0x12d707[_0x49c4('0x91')])][_0x49c4('0x4b')]===_0x49c4('0xf9')||this[_0x49c4('0x12')][util['format'](_0x49c4('0xf8'),_0x12d707[_0x49c4('0x91')])][_0x49c4('0x4b')]===_0x49c4('0xfa'));};Preview[_0x49c4('0x31')]['run']=function(_0x34ce60,_0x39dc83){return this[_0x49c4('0xfb')](_0x34ce60,_0x39dc83)[_0x49c4('0x5a')](function(_0xa2c8cf){return _['pick'](_0xa2c8cf,[_0x49c4('0x29')]);})[_0x49c4('0x63')](function(_0x789121){if(_0x789121[_0x49c4('0xfc')]){rpcDb[_0x49c4('0xfd')](_0x34ce60);}if(_0x789121[_0x49c4('0xf7')]){rpcDb[_0x49c4('0x64')](_0x34ce60);}throw _[_0x49c4('0x45')](_0x789121,[_0x49c4('0x29')]);});};Preview[_0x49c4('0x31')]['execRun']=function(_0x2d3211,_0x1b6966){var _0x2c4d2a=this;var _0x1745f8,_0xe22808;return rpcDb['getContactPreview'](_0x2d3211)['then'](function(_0x13aab1){if(!_[_0x49c4('0xe8')](_0x13aab1[0x0])){_0xe22808=_0x13aab1[0x0][_0x49c4('0xfe')]?![]:!![];_0x1745f8=_0x13aab1[0x0][_0x49c4('0xfe')]?!![]:![];_0x1745f8=_0x1b6966?!![]:_0x1745f8;}var _0xd87f7e=_0x2c4d2a[_0x49c4('0xff')](_0x13aab1);if(_0xd87f7e['isValid']){rpcDb[_0x49c4('0x100')](_[_0x49c4('0x45')](_0x13aab1[0x0],['VoiceQueueId',_0x49c4('0x101')]))['then'](function(_0x30d99a){_0x2c4d2a[_0x49c4('0x102')](_0x30d99a,_0x13aab1[0x0],_0x1b6966,_0xe22808,_0x1745f8)[_0x49c4('0x5a')](function(_0x5db4a1){return _0x5db4a1;})[_0x49c4('0x63')](function(_0x4f431e){throw _0x4f431e;});})[_0x49c4('0x63')](function(_0x5025ee){ut['logger'](_0x49c4('0x103'),_0x5025ee);throw ut[_0x49c4('0x29')](_0x49c4('0x104'),_0xe22808,_0x1745f8);});}else{throw ut[_0x49c4('0x29')](_0xd87f7e[_0x49c4('0x29')],_0xe22808,_0x1745f8);}})[_0x49c4('0x63')](function(_0x5a06d7){ut['logger'](_0x49c4('0x105'),_0x5a06d7);throw ut[_0x49c4('0x29')](_0x49c4('0x104'),![],!![]);});};Preview[_0x49c4('0x31')][_0x49c4('0xff')]=function(_0x3d2dd0){if(_[_0x49c4('0xe8')](_0x3d2dd0)||_['isEmpty'](_0x3d2dd0)||!_['isNil'](_0x3d2dd0[0x0]['Agent'])&&_['isNil'](_0x3d2dd0[0x0][_0x49c4('0x5f')]['name'])){ut[_0x49c4('0x2c')](_0x49c4('0x106'),_0x3d2dd0);return{'isValid':![],'message':_0x49c4('0x107')};}var _0x53dd04=this['campaignsPreview'][_0x3d2dd0[0x0][_0x49c4('0x3f')][_0x49c4('0x91')]];_0x53dd04['message']=utils[_0x49c4('0x2a')][_0x49c4('0x76')];if(_[_0x49c4('0xe8')](_0x53dd04)){ut[_0x49c4('0x2c')](_0x49c4('0x108'),_0x53dd04);return{'isValid':![],'message':_0x49c4('0x109')};}if(!this['isTrunkReachable'](_0x53dd04[_0x49c4('0x10a')])){ut[_0x49c4('0x2c')](_0x49c4('0x10b'),'campaign\x20Name:\x20'+_0x53dd04[_0x49c4('0x91')]+_0x49c4('0x10c'));if(!this[_0x49c4('0x74')](_0x53dd04[_0x49c4('0x10d')])){ut[_0x49c4('0x2c')](_0x49c4('0x10b'),_0x53dd04[_0x49c4('0x91')]+_0x49c4('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x49c4('0x73')](_0x53dd04[_0x49c4('0x39')])){ut[_0x49c4('0x2c')](_0x49c4('0x10f'),_0x53dd04[_0x49c4('0x91')]+_0x49c4('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x53dd04[_0x49c4('0x91')]+_0x49c4('0x110')};}return{'isValid':!![],'message':_0x49c4('0x111')};};Preview[_0x49c4('0x31')][_0x49c4('0x112')]=function(_0x3a8fe1,_0x29c6fc,_0x1642fd,_0x4806ac){var _0xc641bc=this;return new Promise(function(_0xcec186,_0x1c8258){var _0x471e28=_0x3a8fe1[_0x49c4('0x8f')];var _0x5a471d=_0xc641bc['isTrunkReachable'](_0x29c6fc[_0x49c4('0x10a')])?util[_0x49c4('0x65')]('SIP/%s/%s%s',_0x29c6fc['Trunk'][_0x49c4('0x91')],_['isNil'](_0x29c6fc[_0x49c4('0x113')])?'':_0x29c6fc[_0x49c4('0x113')][_0x49c4('0x114')]()||'',_0x29c6fc[_0x49c4('0x115')]>0x0?_0x1642fd[_0x49c4('0x101')][_0x49c4('0x116')](_0x29c6fc[_0x49c4('0x115')]):_0x1642fd[_0x49c4('0x101')]):util['format'](_0x49c4('0x117'),_[_0x49c4('0xe8')](_0x29c6fc[_0x49c4('0x10d')])?_0x29c6fc[_0x49c4('0x10a')][_0x49c4('0x91')]:_0x29c6fc['TrunkBackup'][_0x49c4('0x91')],_[_0x49c4('0xe8')](_0x29c6fc['dialPrefix'])?'':_0x29c6fc[_0x49c4('0x113')][_0x49c4('0x114')]()||'',_0x29c6fc['dialCutDigit']>0x0?_0x1642fd[_0x49c4('0x101')][_0x49c4('0x116')](_0x29c6fc[_0x49c4('0x115')]):_0x1642fd['phone']);var _0x1ee36e=_0xc641bc[_0x49c4('0x74')](_0x29c6fc[_0x49c4('0x10a')])?ut[_0x49c4('0x118')](_0x29c6fc['Trunk'][_0x49c4('0x119')],_0x29c6fc['dialOriginateCallerIdName'],_0x29c6fc[_0x49c4('0x11a')]>0x0?ut[_0x49c4('0x11b')](_0x29c6fc[_0x49c4('0x11c')],_0x29c6fc[_0x49c4('0x11a')]):_0x29c6fc['dialOriginateCallerIdNumber']):ut[_0x49c4('0x118')](_[_0x49c4('0xe8')](_0x29c6fc[_0x49c4('0x10d')])?_0x29c6fc[_0x49c4('0x10a')][_0x49c4('0x119')]:_0x29c6fc[_0x49c4('0x10d')]['callerid'],_0x29c6fc['dialOriginateCallerIdName'],_0x29c6fc[_0x49c4('0x11a')]>0x0?ut[_0x49c4('0x11b')](_0x29c6fc[_0x49c4('0x11c')],_0x29c6fc[_0x49c4('0x11a')]):_0x29c6fc[_0x49c4('0x11c')]);if(_0x1ee36e){_0x3a8fe1[_0x49c4('0x11d')]=ut[_0x49c4('0x11e')](_0x1ee36e);_0x3a8fe1[_0x49c4('0x11f')]=ut[_0x49c4('0x120')](_0x1ee36e);}var _0x37dbbf=ut[_0x49c4('0x121')](_0x29c6fc,_0x1642fd,_0x5a471d,_0x1ee36e,_0x471e28,_0x3a8fe1);_[_0x49c4('0x122')](_0x3a8fe1,ut['toLowerVariables'](_0x37dbbf));_0x3a8fe1[_0x49c4('0x123')]=moment()[_0x49c4('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x29c6fc[_0x49c4('0x124')]=_0x37dbbf;var _0x5adc01=ut[_0x49c4('0x125')](_0x3a8fe1,_0x29c6fc,_0x37dbbf,_0x3a8fe1[_0x49c4('0x87')],_0x4806ac);return ami['Action'](_0x5adc01)[_0x49c4('0x5a')](function(_0x245fae){_0x29c6fc[_0x49c4('0xe4')]+=0x1;logger[_0x49c4('0x24')](_0x49c4('0x126'),_0x471e28,'\x20Queue',_0x29c6fc[_0x49c4('0x91')],'originated:\x20',_0x29c6fc[_0x49c4('0xe4')]);_0xcec186(_0x245fae);})[_0x49c4('0x63')](function(_0x294b2c){ut['logAgent'](_0x3a8fe1,0xe,_0x49c4('0x127'));rpcDb[_0x49c4('0xdf')](_0x3a8fe1,_0x49c4('0x128'));_0x1c8258(_0x294b2c);});});};Preview['prototype']['syncNewExten']=function(_0x256d6b){if(this[_0x49c4('0x13')][_0x256d6b[_0x49c4('0x88')]]){this[_0x49c4('0x13')][_0x256d6b[_0x49c4('0x88')]][_0x49c4('0x4c')]=_0x256d6b['channel'];}};Preview['prototype']['syncOriginateResponse']=function(_0x2eae62){var _0x417cef=this;var _0x153450=this[_0x49c4('0x13')][_0x2eae62['actionid']];if(_0x153450){if(_0x153450[_0x49c4('0xea')]&&this[_0x49c4('0x14')][_0x153450[_0x49c4('0xea')]]){ut[_0x49c4('0x129')](_0x153450,this[_0x49c4('0x14')][_0x153450[_0x49c4('0xea')]][_0x49c4('0x91')],this[_0x49c4('0x14')][_0x153450[_0x49c4('0xea')]]['id']);}var _0x39e6f5=_[_0x49c4('0x12a')](_0x153450);_0x39e6f5['responsetime']=moment()[_0x49c4('0x65')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3308c4=_0x417cef[_0x49c4('0x10')][_0x153450[_0x49c4('0x40')]];if(ut[_0x49c4('0x12b')](_0x2eae62['response'])){if(_0x153450[_0x49c4('0x86')]){rpcDb['unlockContact'](_0x153450['idContact']);}if(_0x153450['activeContact']){rpcDb[_0x49c4('0x64')](_0x153450[_0x49c4('0x8a')]);}ami[_0x49c4('0x23')]('custom:agentringnoanswer',ut[_0x49c4('0x7b')](_0x153450,'rejected',this[_0x49c4('0x10')][_0x153450[_0x49c4('0x40')]]));this[_0x49c4('0xd8')](_0x39e6f5,_0x3308c4,_0x2eae62);}else{_0x153450['starttime']=moment()[_0x49c4('0x65')](_0x49c4('0x66'));ut[_0x49c4('0xdc')](_0x39e6f5,0x4,_0x49c4('0x12c'));rpcDb[_0x49c4('0xdf')](_0x39e6f5,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x49c4('0x31')][_0x49c4('0x1a')]=function(_0x15e35f){var _0x6b1554=this['actions'][_0x15e35f['linkedid']];var _0x238884;if(_0x6b1554){_0x238884=this[_0x49c4('0x10')][_0x6b1554['queue']];logger[_0x49c4('0x24')](_0x49c4('0x12d'),_0x15e35f[_0x49c4('0x88')],_0x49c4('0x90'),_0x238884['name'],_0x49c4('0x43'),_0x238884[_0x49c4('0x44')]);}if(this['actions'][_0x15e35f['linkedid']]&&_0x15e35f[_0x49c4('0x88')]!==_0x15e35f[_0x49c4('0x8f')]){if(_0x15e35f[_0x49c4('0x12e')]==='16'&&this[_0x49c4('0x13')][_0x15e35f[_0x49c4('0x88')]]['dialAnswer']){this[_0x49c4('0x77')](_0x15e35f,_0x15e35f['linkedid'],_0x15e35f[_0x49c4('0x12e')]);}else if(this[_0x49c4('0x13')][_0x15e35f[_0x49c4('0x88')]][_0x49c4('0x50')]){logger['info']('[syncHangup][talking][cause]',_0x15e35f['linkedid'],_0x15e35f[_0x49c4('0x12e')],_0x49c4('0x90'),_0x238884[_0x49c4('0x91')],_0x49c4('0x43'),_0x238884['pTalking']);this['callProgressDetectingCustomer'](_0x15e35f,_0x15e35f[_0x49c4('0x88')],_0x15e35f['cause']);}}else if(_0x6b1554&&_[_0x49c4('0xe8')](_0x6b1554[_0x49c4('0x12f')])&&_0x238884['dialQueueProject']&&_0x15e35f[_0x49c4('0x88')]===_0x15e35f[_0x49c4('0x8f')]&&_[_0x49c4('0xe8')](_0x15e35f['reason'])&&_0x15e35f[_0x49c4('0x12e')]==='16'&&_0x15e35f[_0x49c4('0x130')]==='6'&&_[_0x49c4('0xd9')](_0x6b1554['transfer'])){if(_0x6b1554[_0x49c4('0x86')]){rpcDb[_0x49c4('0xfd')](_0x6b1554['idContact']);}if(_0x6b1554[_0x49c4('0x87')]){rpcDb[_0x49c4('0x64')](_0x6b1554['idContact']);}_0x15e35f[_0x49c4('0xdb')]='22';this[_0x49c4('0xd8')](_0x6b1554,_0x238884,_0x15e35f);}else if(_0x6b1554&&_0x6b1554[_0x49c4('0x131')]){if(_0x15e35f[_0x49c4('0x12e')]==='16'&&this[_0x49c4('0x13')][_0x15e35f['linkedid']][_0x49c4('0x50')]){logger[_0x49c4('0x24')]('[syncHangup][talking][transfer]',_0x15e35f[_0x49c4('0x88')],_0x15e35f[_0x49c4('0x12e')],_0x49c4('0x90'),_0x238884['name'],_0x49c4('0x43'),_0x238884['pTalking']);this[_0x49c4('0x77')](_0x15e35f,_0x15e35f[_0x49c4('0x88')],_0x15e35f['cause']);}else if(this[_0x49c4('0x13')][_0x15e35f['linkedid']][_0x49c4('0x50')]){logger[_0x49c4('0x24')]('[syncHangup][talking][cause]',_0x15e35f[_0x49c4('0x88')],_0x15e35f[_0x49c4('0x12e')],'\x20Queue',_0x238884['name'],_0x49c4('0x43'),_0x238884[_0x49c4('0x44')]);this[_0x49c4('0x77')](_0x15e35f,_0x15e35f[_0x49c4('0x88')],_0x15e35f[_0x49c4('0x12e')]);}}};Preview['prototype'][_0x49c4('0x1d')]=function(_0x40afb8){if(this[_0x49c4('0x13')][_0x40afb8[_0x49c4('0xd6')]]&&_0x40afb8[_0x49c4('0xd6')]!==_0x40afb8['destuniqueid']){this[_0x49c4('0x77')](_0x40afb8,_0x40afb8[_0x49c4('0xd6')],_0x40afb8[_0x49c4('0xd1')]);}};Preview[_0x49c4('0x31')][_0x49c4('0x1b')]=function(_0x39abbf){if(this[_0x49c4('0x13')][_0x39abbf[_0x49c4('0x88')]]&&_0x39abbf['linkedid']!==_0x39abbf[_0x49c4('0x8f')]&&!this[_0x49c4('0x13')][_0x39abbf[_0x49c4('0x88')]]['dialAnswer']){if(_0x39abbf['cause']==='1'){this[_0x49c4('0x77')](_0x39abbf,_0x39abbf['linkedid'],_0x39abbf[_0x49c4('0x12e')]);}}};Preview[_0x49c4('0x31')][_0x49c4('0x132')]=function(_0x3f0e74,_0x55f423,_0x3ce0f9){if(this[_0x49c4('0x13')][_0x3f0e74]){if(_[_0x49c4('0xe8')](this[_0x49c4('0x13')][_0x3f0e74]['variables'])){this[_0x49c4('0x13')][_0x3f0e74][_0x49c4('0x124')]={};}this['actions'][_0x3f0e74][_0x49c4('0x124')][_0x55f423]=_0x3ce0f9;}};Preview[_0x49c4('0x31')][_0x49c4('0x133')]=function(_0x72eab6){try{if(!_[_0x49c4('0xe8')](_0x72eab6)){if(ut[_0x49c4('0x134')](_[_0x49c4('0x135')](_0x72eab6[_0x49c4('0x136')])[0x0])){this['addVariable'](_0x72eab6['uniqueid'],_['keys'](_0x72eab6[_0x49c4('0x136')])[0x0],_0x72eab6[_0x49c4('0x137')]);}}}catch(_0x418ead){logger[_0x49c4('0x138')](_0x49c4('0x139'),util['inspect'](_0x418ead,{'showHidden':![],'depth':null}));}};Preview[_0x49c4('0x31')][_0x49c4('0x20')]=function(_0x9786bf){if(_0x9786bf){if(this[_0x49c4('0x13')][_0x9786bf['transfertargetlinkedid']]){this['actions'][_0x9786bf[_0x49c4('0x13a')]][_0x49c4('0x131')]=!![];}}};Preview[_0x49c4('0x31')][_0x49c4('0x13b')]=function(_0x281151){if(_0x281151){if(this[_0x49c4('0x13')][_0x281151['transfererlinkedid']]){this['actions'][_0x281151[_0x49c4('0x13c')]][_0x49c4('0x131')]=!![];}}};module[_0x49c4('0x13d')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index b16ea99..7bd098b 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 _0xa229=['../rpc/cmHopper','../rpc/cmHopperHistory','inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercompleteAt','endtime','membername','context','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview'];(function(_0x1f0724,_0x3a58bf){var _0x253ffb=function(_0x3b4c72){while(--_0x3b4c72){_0x1f0724['push'](_0x1f0724['shift']());}};_0x253ffb(++_0x3a58bf);}(_0xa229,0x168));var _0x9a22=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa229[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x9a22('0x0'));var BPromise=require(_0x9a22('0x1'));var logger=require(_0x9a22('0x2'))(_0x9a22('0x3'));var cmHopper=require(_0x9a22('0x4'));var cmHopperHistory=require(_0x9a22('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x89a5e6){return function(_0x2f9122){logger['error'](_0x89a5e6,util[_0x9a22('0x6')](_0x2f9122,{'showHidden':![],'depth':null}));};}function create(_0x352892){return cmHopperHistory[_0x9a22('0x7')](_0x352892)[_0x9a22('0x8')](loggerCatch(_0x9a22('0x9')));}function createAgent(_0x1818b9){return BPromise[_0x9a22('0xa')]()[_0x9a22('0xb')](agentReportPreview[_0x9a22('0x7')](_0x1818b9))[_0x9a22('0x8')](loggerCatch(_0x9a22('0x9')));}function moveContact(_0x3a1988){return cmHopper[_0x9a22('0xc')](_0x3a1988,!![])[_0x9a22('0x8')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x9a22('0xd')]=function(_0x5572c6){return cmHopperBlack[_0x9a22('0xd')](_0x5572c6)[_0x9a22('0x8')](loggerCatch(_0x9a22('0xe')));};exports[_0x9a22('0xf')]=function(_0x2ddf75){return BPromise[_0x9a22('0xa')]()[_0x9a22('0xb')](cmHopper['getContactPreview'](_0x2ddf75))[_0x9a22('0x8')](loggerCatch(_0x9a22('0x10')));};exports[_0x9a22('0x7')]=function(_0x584a8f,_0x46f08c){create(_0x584a8f)[_0x9a22('0x8')](loggerCatch(_0x46f08c));moveContact(_0x584a8f)[_0x9a22('0x8')](loggerCatch(_0x46f08c));};exports[_0x9a22('0x11')]=function(_0x5c5676,_0x3e0cf5){createAgent(_0x5c5676)[_0x9a22('0x8')](loggerCatch(_0x3e0cf5));};exports[_0x9a22('0x12')]=function(_0x1d0391,_0x51f3d3){create(_0x1d0391)[_0x9a22('0x8')](loggerCatch(_0x51f3d3));};exports[_0x9a22('0x13')]=function(_0x4feecc,_0x424dd0){moveContact(_0x4feecc)[_0x9a22('0x8')](loggerCatch(_0x424dd0));};exports[_0x9a22('0x14')]=function(_0x23d2a7,_0x513345,_0x3dcaf5){if(_0x513345){_0x23d2a7[_0x9a22('0x15')]=null;}if(_0x3dcaf5){_0x23d2a7[_0x9a22('0x16')]=![];}return cmHopper[_0x9a22('0x14')](_0x23d2a7)['catch'](loggerCatch(_0x9a22('0x17')));};exports[_0x9a22('0x18')]=function(_0x4dbe13){return cmHopper[_0x9a22('0x18')](_0x4dbe13)[_0x9a22('0x8')](loggerCatch(_0x9a22('0x19')));};exports['unlockContact']=function(_0xa41785){return cmHopper[_0x9a22('0x1a')]({'UserId':null},_0xa41785,0x1)[_0x9a22('0x8')](loggerCatch(_0x9a22('0x1b')));};exports[_0x9a22('0x1c')]=function(_0x1f5e41){return cmHopper[_0x9a22('0x1a')]({'active':![]},_0x1f5e41,0x1)[_0x9a22('0x8')](loggerCatch(_0x9a22('0x1d')));};exports['crateCustomerReportQueue']=function(_0x3a349d){var _0x2968cb={};_0x2968cb['type']=_0x3a349d[_0x9a22('0x1e')];_0x2968cb[_0x9a22('0x1f')]=_0x3a349d[_0x9a22('0x1f')];_0x2968cb['calleridnum']=_0x3a349d[_0x9a22('0x20')];_0x2968cb['calleridname']=_0x3a349d[_0x9a22('0x21')];_0x2968cb[_0x9a22('0x22')]=_0x3a349d[_0x9a22('0x22')];_0x2968cb[_0x9a22('0x23')]=_0x3a349d[_0x9a22('0x24')];_0x2968cb['queuecallerleaveAt']=_0x3a349d[_0x9a22('0x24')];_0x2968cb['queuecallercomplete']=0x1;_0x2968cb[_0x9a22('0x25')]=_0x3a349d[_0x9a22('0x26')];_0x2968cb['connectedlinename']=_0x3a349d[_0x9a22('0x27')];_0x2968cb[_0x9a22('0x28')]=_0x9a22('0x29');_0x2968cb['exten']=_0x9a22('0x2a');_0x2968cb[_0x9a22('0x2b')]=0x0;_0x2968cb[_0x9a22('0x2c')]=0x1;_0x2968cb[_0x9a22('0x2d')]=_0x3a349d[_0x9a22('0x27')];_0x2968cb['queuecallerexitreason']=_0x9a22('0x2e');return BPromise[_0x9a22('0xa')]()[_0x9a22('0xb')](voiceQueueReport[_0x9a22('0x2f')](_0x2968cb))[_0x9a22('0x8')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x9a22('0x30')]=function(_0x2effd6,_0x278faa){return BPromise[_0x9a22('0xa')]()[_0x9a22('0xb')](cmHopper[_0x9a22('0x30')](_0x2effd6,_0x278faa))['catch'](loggerCatch(_0x9a22('0x31')));};exports[_0x9a22('0x32')]=function(_0x195a6c){return cmHopper['rescheduleContact'](_0x195a6c,!![],!![])['catch'](loggerCatch(_0x9a22('0x33')));}; \ No newline at end of file +var _0xb2b1=['queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','catch','[createHistory]\x20','resolve','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','rescheduleContact','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','queue','queuecallerjoinAt'];(function(_0x48b8d8,_0x2288cb){var _0x3d3394=function(_0x31ff72){while(--_0x31ff72){_0x48b8d8['push'](_0x48b8d8['shift']());}};_0x3d3394(++_0x2288cb);}(_0xb2b1,0xb3));var _0x1b2b=function(_0x4f4319,_0x472bf7){_0x4f4319=_0x4f4319-0x0;var _0xacf3f6=_0xb2b1[_0x4f4319];return _0xacf3f6;};'use strict';var util=require(_0x1b2b('0x0'));var BPromise=require(_0x1b2b('0x1'));var logger=require(_0x1b2b('0x2'))('preview');var cmHopper=require(_0x1b2b('0x3'));var cmHopperHistory=require(_0x1b2b('0x4'));var cmHopperBlack=require(_0x1b2b('0x5'));var agentReportPreview=require(_0x1b2b('0x6'));var voiceQueueReport=require(_0x1b2b('0x7'));function loggerCatch(_0x5d4b95){return function(_0x1313a6){logger[_0x1b2b('0x8')](_0x5d4b95,util[_0x1b2b('0x9')](_0x1313a6,{'showHidden':![],'depth':null}));};}function create(_0x49d7fe){return cmHopperHistory['createHistory'](_0x49d7fe)[_0x1b2b('0xa')](loggerCatch(_0x1b2b('0xb')));}function createAgent(_0x14b935){return BPromise[_0x1b2b('0xc')]()['then'](agentReportPreview[_0x1b2b('0xd')](_0x14b935))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x3e5854){return cmHopper[_0x1b2b('0xe')](_0x3e5854,!![])[_0x1b2b('0xa')](loggerCatch(_0x1b2b('0xf')));}exports[_0x1b2b('0x10')]=function(_0x3ebdb1){return cmHopperBlack[_0x1b2b('0x10')](_0x3ebdb1)['catch'](loggerCatch(_0x1b2b('0x11')));};exports[_0x1b2b('0x12')]=function(_0x391c46){return BPromise['resolve']()[_0x1b2b('0x13')](cmHopper[_0x1b2b('0x12')](_0x391c46))[_0x1b2b('0xa')](loggerCatch(_0x1b2b('0x14')));};exports[_0x1b2b('0xd')]=function(_0x4ad97d,_0x39bc20){create(_0x4ad97d)['catch'](loggerCatch(_0x39bc20));moveContact(_0x4ad97d)[_0x1b2b('0xa')](loggerCatch(_0x39bc20));};exports[_0x1b2b('0x15')]=function(_0xc3a355,_0x450b1d){createAgent(_0xc3a355)[_0x1b2b('0xa')](loggerCatch(_0x450b1d));};exports[_0x1b2b('0x16')]=function(_0x43fd98,_0x3e0250){create(_0x43fd98)[_0x1b2b('0xa')](loggerCatch(_0x3e0250));};exports[_0x1b2b('0x17')]=function(_0x5d187d,_0x488ea8){moveContact(_0x5d187d)['catch'](loggerCatch(_0x488ea8));};exports['rescheduleContact']=function(_0x2846b8,_0x14701c,_0x409e3a){if(_0x14701c){_0x2846b8[_0x1b2b('0x18')]=null;}if(_0x409e3a){_0x2846b8['active']=![];}return cmHopper[_0x1b2b('0x19')](_0x2846b8)[_0x1b2b('0xa')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x36bb21){return cmHopper[_0x1b2b('0x1a')](_0x36bb21)[_0x1b2b('0xa')](loggerCatch(_0x1b2b('0x1b')));};exports[_0x1b2b('0x1c')]=function(_0x23dc4e){return cmHopper[_0x1b2b('0x1c')]({'UserId':null},_0x23dc4e,0x1)[_0x1b2b('0xa')](loggerCatch(_0x1b2b('0x1d')));};exports[_0x1b2b('0x1e')]=function(_0x41c20f){return cmHopper[_0x1b2b('0x1c')]({'active':![]},_0x41c20f,0x1)[_0x1b2b('0xa')](loggerCatch('[activeContact]\x20'));};exports[_0x1b2b('0x1f')]=function(_0x1151b0){var _0x3edeff={};_0x3edeff['type']=_0x1151b0[_0x1b2b('0x20')];_0x3edeff['uniqueid']=_0x1151b0[_0x1b2b('0x21')];_0x3edeff['calleridnum']=_0x1151b0[_0x1b2b('0x22')];_0x3edeff['calleridname']=_0x1151b0['calleridname'];_0x3edeff[_0x1b2b('0x23')]=_0x1151b0[_0x1b2b('0x23')];_0x3edeff[_0x1b2b('0x24')]=_0x1151b0['answertime'];_0x3edeff[_0x1b2b('0x25')]=_0x1151b0[_0x1b2b('0x26')];_0x3edeff[_0x1b2b('0x27')]=0x1;_0x3edeff[_0x1b2b('0x28')]=_0x1151b0['endtime'];_0x3edeff[_0x1b2b('0x29')]=_0x1151b0[_0x1b2b('0x2a')];_0x3edeff[_0x1b2b('0x2b')]='from-sip';_0x3edeff[_0x1b2b('0x2c')]=_0x1b2b('0x2d');_0x3edeff[_0x1b2b('0x2e')]=0x0;_0x3edeff['assigned']=0x1;_0x3edeff[_0x1b2b('0x2f')]=_0x1151b0[_0x1b2b('0x2a')];_0x3edeff[_0x1b2b('0x30')]='COMPLETED';return BPromise['resolve']()['then'](voiceQueueReport[_0x1b2b('0x31')](_0x3edeff))['catch'](loggerCatch(_0x1b2b('0x32')));};exports['getContactRecallMe']=function(_0x2aaa09,_0x3aa868){return BPromise[_0x1b2b('0xc')]()[_0x1b2b('0x13')](cmHopper[_0x1b2b('0x33')](_0x2aaa09,_0x3aa868))[_0x1b2b('0xa')](loggerCatch(_0x1b2b('0x34')));};exports['rescheduleContactInQueue']=function(_0x5a3063){return cmHopper[_0x1b2b('0x19')](_0x5a3063,!![],!![])[_0x1b2b('0xa')](loggerCatch(_0x1b2b('0x35')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index f72749d..5352720 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 _0x43f6=['\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','logAgent','ringtime','getSeconds','logLookAgent','membername','logCustomer','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','clone','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','interface','not_inuse','reachable','getDiff','milliseconds','diff','createBody','CampaignId','filterKey','idContact','campaigntype','countglobal','callback','callbackuniqueid','recallme','UserId','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosjitter','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','noanswer','variables','forEach','buildNoAnswerEventPayload','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','logger','info','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>'];(function(_0x4b822b,_0x1dee7f){var _0x1d8caf=function(_0x35f8d2){while(--_0x35f8d2){_0x4b822b['push'](_0x4b822b['shift']());}};_0x1d8caf(++_0x1dee7f);}(_0x43f6,0x82));var _0x643f=function(_0x19159d,_0x3d05c8){_0x19159d=_0x19159d-0x0;var _0x35884a=_0x43f6[_0x19159d];return _0x35884a;};'use strict';var util=require(_0x643f('0x0'));var _=require(_0x643f('0x1'));var moment=require('moment');var logger=require(_0x643f('0x2'))(_0x643f('0x3'));var ipAgi=process[_0x643f('0x4')][_0x643f('0x5')]||_0x643f('0x6');var utils=require(_0x643f('0x7'));exports[_0x643f('0x8')]=function(_0x58a440){return function(_0xf49495){logger[_0x643f('0x9')](_0x58a440,util[_0x643f('0xa')](_0xf49495,{'showHidden':![],'depth':null}));};};exports[_0x643f('0xb')]=function(_0x601cdd,_0x1dc5d9){logger[_0x643f('0xc')](_0x601cdd,util[_0x643f('0xa')](_0x1dc5d9,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x2310c9,_0x112c9d){logger[_0x643f('0x9')](_0x2310c9,util['inspect'](_0x112c9d,{'showHidden':![],'depth':null}));};exports[_0x643f('0xd')]=function(_0x252909){return function(_0x419842){logger[_0x643f('0xc')](_0x252909,util[_0x643f('0xa')](_0x419842,{'showHidden':![],'depth':null}));};};exports[_0x643f('0xe')]=function(_0x35b8ac,_0xefa462,_0x4403bb){return{'message':_0x35b8ac,'unlock':_0xefa462,'active':_0x4403bb};};exports[_0x643f('0xf')]=function(_0x1ac818,_0x8ecc94,_0x3207f7){if(!_[_0x643f('0x10')](_0x3207f7)&&_0x643f('0x11')===typeof _0x3207f7&&!_['isEmpty'](_0x3207f7)){if(!_[_0x643f('0x10')](_0x8ecc94)&&_0x643f('0x11')===typeof _0x8ecc94&&!_[_0x643f('0x12')](_0x8ecc94)){return util[_0x643f('0x13')](_0x643f('0x14'),_0x8ecc94,_0x3207f7);}return util[_0x643f('0x13')](_0x643f('0x14'),_0x3207f7,_0x3207f7);}if(!_[_0x643f('0x10')](_0x1ac818)&&_0x643f('0x11')===typeof _0x1ac818&&!_[_0x643f('0x12')](_0x1ac818)){return _0x1ac818;}return _0x643f('0x15');};exports[_0x643f('0x16')]=function(_0x347d46){if(_[_0x643f('0x17')](_0x347d46)){return![];}return _0x347d46;};exports[_0x643f('0x18')]=function(_0x4cc890,_0x3d9db0,_0x2e73e2,_0x27844c,_0x25c339,_0x387355){var _0x4e79a6={'XMD-QUEUE':_0x3d9db0[_0x643f('0x19')]?_0x3d9db0[_0x643f('0x19')]['name']:'','XMD-CALLERID':_0x27844c,'XMD-CALLERID-PREVIEW':_0x387355?util['format'](_0x643f('0x14'),_0x387355[_0x643f('0x1a')],_0x387355[_0x643f('0x1b')]):_0x27844c,'XMD-DIALID':_0x25c339,'XMD-CONTACTID':_0x3d9db0[_0x643f('0x1c')],'XMD-CDRTYPE':_0x643f('0x1d'),'CALLERID(all)':_0x27844c,'XMD-VOICEQUEUEID':_0x3d9db0[_0x643f('0x1e')],'XMD-DIALCHANNEL':_0x2e73e2,'XMD-DIALTIMEOUT':_0x4cc890[_0x643f('0x1f')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x643f('0x20'),_0x4cc890[_0x643f('0x21')]?'g':'',_['isEmpty'](_0x4cc890[_0x643f('0x22')])?'':_0x643f('0x23')),'XMD-DIALURL':_0x4cc890['dialPreviewUrl']||'','XMD-AGI':_0x4cc890[_0x643f('0x24')]?util['format'](_0x643f('0x25'),ipAgi,_0x4cc890[_0x643f('0x24')]):_0x643f('0x26'),'XMD-AGIAFTER':_0x4cc890[_0x643f('0x21')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x4cc890[_0x643f('0x21')]):_0x643f('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x387355?_0x387355[_0x643f('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x387355?_0x387355[_0x643f('0x28')]:'','XMD-DESTINATION':_0x643f('0x29'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x643f('0x12')](_0x4cc890['monitor_format'])){_0x4e79a6[util[_0x643f('0x13')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x4cc890[_0x643f('0x22')];_0x4e79a6[util[_0x643f('0x13')]('%s',_0x643f('0x2a'))]=_0x25c339;}if(_0x3d9db0&&_0x3d9db0['Contact']){for(var _0x1e8e9f in _0x3d9db0[_0x643f('0x2b')]){if(_0x3d9db0['Contact'][_0x643f('0x2c')](_0x1e8e9f)){if(!_[_0x643f('0x17')](_0x3d9db0[_0x643f('0x2b')][_0x1e8e9f])&&_0x1e8e9f!=='id'&&_0x1e8e9f!==_0x643f('0x2d')&&_0x1e8e9f!==_0x643f('0x2e')&&_0x1e8e9f!==_0x643f('0x2f')){_0x4e79a6[util[_0x643f('0x13')](_0x643f('0x30'),_0x643f('0x31'),_[_0x643f('0x32')](_0x1e8e9f))]=_0x3d9db0[_0x643f('0x2b')][_0x1e8e9f];}}}}return _0x4e79a6;};exports[_0x643f('0x33')]=function(_0xe93259){var _0x5d0373={};for(var _0x5345ae in _0xe93259){if(_0xe93259[_0x643f('0x2c')](_0x5345ae)){_0x5d0373[util['format']('%s',_['toLower'](_0x5345ae))]=_0xe93259[_0x5345ae];}}return{'variables':_0x5d0373};};exports[_0x643f('0x34')]=function(_0x398cd7,_0x1bb269){if(!_[_0x643f('0x17')](_0x398cd7)){if(_0x398cd7['hasOwnProperty'](_0x643f('0x35'))){if(_0x398cd7[_0x643f('0x35')]>0x0){_0x398cd7[_0x643f('0x35')]-=0x1;}else{logger['error'](_0x643f('0x36'),_0x1bb269);}}}else{logger[_0x643f('0x9')](_0x643f('0x37'),_0x1bb269);}};exports[_0x643f('0x38')]=function(_0x212a19){var _0xbf1ae6=moment()[_0x643f('0x13')](_0x643f('0x39'));_0x212a19[_0x643f('0x3a')]=0xd;_0x212a19[_0x643f('0x3b')]='Blacklist';_0x212a19[_0x643f('0x3c')]=_0xbf1ae6;_0x212a19[_0x643f('0x3d')]=_0xbf1ae6;_0x212a19[_0x643f('0x3e')]=_0xbf1ae6;};exports[_0x643f('0x3f')]=function(_0x56c5cc,_0x328775,_0x54ac6f){var _0x3e3a96=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x56c5cc[_0x643f('0x3a')]=_0x328775;_0x56c5cc[_0x643f('0x3b')]=_0x54ac6f;_0x56c5cc[_0x643f('0x3d')]=_0x3e3a96;_0x56c5cc[_0x643f('0x40')]=utils[_0x643f('0x41')](_0x56c5cc['responsetime'],_0x56c5cc[_0x643f('0x3c')]);};exports[_0x643f('0x42')]=function(_0x476df8,_0x49a004,_0x18cd63){_0x476df8[_0x643f('0x43')]=_0x49a004;_0x476df8['UserId']=_0x18cd63;};exports[_0x643f('0x44')]=function(_0x5b548b,_0x3302d2,_0x3439f1){var _0x3fa0d2=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5b548b[_0x643f('0x3a')]=_0x3302d2;_0x5b548b[_0x643f('0x3b')]=_0x3439f1;_0x5b548b[_0x643f('0x3d')]=_0x5b548b[_0x643f('0x3d')]?_0x5b548b[_0x643f('0x3d')]:_0x3fa0d2;_0x5b548b[_0x643f('0x3e')]=_0x5b548b[_0x643f('0x3e')]?_0x5b548b['endtime']:_0x3fa0d2;_0x5b548b[_0x643f('0x40')]=utils[_0x643f('0x41')](_0x5b548b['responsetime']||0x0,_0x5b548b[_0x643f('0x3c')]||0x0);_0x5b548b['talktime']=_0x5b548b[_0x643f('0x45')]?utils[_0x643f('0x41')](_0x5b548b[_0x643f('0x3e')],_0x5b548b[_0x643f('0x45')]):0x0;};exports[_0x643f('0x46')]=function(_0x429f19){return _0x429f19===_0x643f('0x47');};exports['variablesAction']=function(_0x1010d1,_0x538203,_0x5bb8e6,_0x1ec4a5,_0x30c70f){var _0x1a1713=_0x1ec4a5?_0x643f('0x48'):_0x1010d1['calleridname'];_0x1a1713=_0x30c70f?_0x643f('0x49'):_0x1a1713;return{'actionid':_0x1010d1[_0x643f('0x4a')],'action':_0x643f('0x4b'),'channel':_0x1010d1[_0x643f('0x4c')],'callerid':util[_0x643f('0x13')](_0x643f('0x14'),_0x1a1713,_0x1010d1[_0x643f('0x1b')]),'Exten':_0x643f('0x29'),'Context':_0x643f('0x4d'),'Priority':'1','variable':_0x5bb8e6,'timeout':(_0x538203[_0x643f('0x4e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1010d1['uniqueid']};};exports[_0x643f('0x4f')]=function(_0x1175a9){return _0x1175a9[_0x643f('0x50')]+_0x1175a9[_0x643f('0x51')]+_0x1175a9[_0x643f('0x52')]+_0x1175a9['countagentrejectretry']+_0x1175a9['countnosuchnumberretry'];};exports['cloneAction']=function(_0xd8d9d2){var _0x2f15db=_[_0x643f('0x53')](_0xd8d9d2);_0x2f15db[_0x643f('0x3a')]=0xf;_0x2f15db[_0x643f('0x3b')]='Global';return _0x2f15db;};exports[_0x643f('0x54')]=function(_0x381c04,_0x2cf94e,_0xc3dd64){var _0x282975={};_0x282975[_0x2cf94e]=_0x381c04[_0x2cf94e];_0x282975[_0x643f('0x55')]=![];_0x282975[_0x643f('0x56')]=moment()[_0x643f('0x57')](_0xc3dd64,_0x643f('0x58'))[_0x643f('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x282975[_0x643f('0x1c')]=_0x381c04[_0x643f('0x1c')];_0x282975[_0x643f('0x59')]=_0x381c04[_0x643f('0x59')];_0x282975['VoiceQueueId']=_0x381c04[_0x643f('0x1e')]||undefined;return _0x282975;};exports[_0x643f('0x5a')]=function(_0x351cd6,_0x1bd1c2){if(!_[_0x643f('0x17')](_0x351cd6)){if(_0x351cd6[_0x643f('0x5b')]>0x0){_0x351cd6[_0x643f('0x5b')]-=0x1;}else{logger[_0x643f('0x9')](_0x1bd1c2,_0x643f('0x5c'));}}else{logger['error'](_0x1bd1c2,_0x643f('0x5d'));}};exports[_0x643f('0x5e')]=function(_0x280d6c){if(_0x280d6c<=0x0){return!![];}return![];};function buildObj(_0x568532,_0x28cfae,_0x2a1cfc){_0x568532[_0x643f('0x5f')]=_0x28cfae;_0x568532[_0x643f('0x60')]=_0x568532[_0x643f('0x61')];_0x568532['interface']=_0x568532[_0x643f('0x4c')];_0x568532[_0x643f('0x62')]=_0x643f('0x63');if(_0x2a1cfc){_0x568532[_0x643f('0x64')]=_0x2a1cfc['mandatoryDisposition'];}return _0x568532;}exports[_0x643f('0x65')]=buildObj;exports[_0x643f('0x66')]=function(_0xb14ed2){var _0x4a3bb5={};_0x4a3bb5[_0x643f('0x61')]=_0xb14ed2[_0x643f('0x61')];_0x4a3bb5[_0x643f('0x67')]=_0xb14ed2[_0x643f('0x4c')];_0x4a3bb5[_0x643f('0x4a')]=_0xb14ed2[_0x643f('0x4a')];return _0x4a3bb5;};exports['agentReadyId']=function(_0x15b543){var _0x424ee9=[];for(var _0x51a3c7 in _0x15b543){if(_0x15b543[_0x643f('0x2c')](_0x51a3c7)){if(!_[_0x643f('0x17')](_0x15b543[_0x51a3c7])&&_0x15b543[_0x51a3c7][_0x643f('0x3a')]===_0x643f('0x68')&&_0x15b543[_0x51a3c7]['status']===_0x643f('0x69')){_0x424ee9['push'](_0x15b543[_0x51a3c7]['id']);}}}return _0x424ee9;};exports[_0x643f('0x6a')]=function(_0x890688){var _0x17eff4=moment()[_0x643f('0x6b')](0x0);var _0x415918=moment(_0x890688)[_0x643f('0x6b')](0x0);return _0x17eff4[_0x643f('0x6c')](_0x415918,'seconds');};exports[_0x643f('0x6d')]=function(_0x41626){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x41626['ContactId'],'ListId':_0x41626[_0x643f('0x59')],'VoiceQueueId':_0x41626[_0x643f('0x1e')]||undefined,'CampaignId':_0x41626[_0x643f('0x6e')]||undefined};};exports[_0x643f('0x6f')]=function(_0x3072ff){if(_0x3072ff==='uniqueid'||_0x3072ff===_0x643f('0x70')||_0x3072ff==='queue'||_0x3072ff==='type'||_0x3072ff===_0x643f('0x71')||_0x3072ff==='dialAnswer'||_0x3072ff===_0x643f('0x43')||_0x3072ff==='channelAgent'||_0x3072ff===_0x643f('0x1a')||_0x3072ff===_0x643f('0x55')||_0x3072ff==='calleridnum'||_0x3072ff===_0x643f('0x56')||_0x3072ff===_0x643f('0x50')||_0x3072ff===_0x643f('0x51')||_0x3072ff===_0x643f('0x52')||_0x3072ff===_0x643f('0x72')||_0x3072ff===_0x643f('0x73')||_0x3072ff===_0x643f('0x74')||_0x3072ff==='callbackat'||_0x3072ff===_0x643f('0x75')||_0x3072ff===_0x643f('0x1c')||_0x3072ff===_0x643f('0x59')||_0x3072ff===_0x643f('0x76')||_0x3072ff===_0x643f('0x1e')||_0x3072ff==='sipcallid'||_0x3072ff===_0x643f('0x77')||_0x3072ff===_0x643f('0x78')||_0x3072ff===_0x643f('0x79')||_0x3072ff==='xmd-listid'||_0x3072ff===_0x643f('0x7a')||_0x3072ff===_0x643f('0x7b')||_0x3072ff===_0x643f('0x7c')||_0x3072ff===_0x643f('0x7d')||_0x3072ff===_0x643f('0x7e')||_0x3072ff===_0x643f('0x7f')||_0x3072ff===_0x643f('0x80')||_0x3072ff===_0x643f('0x81')||_0x3072ff==='xmd-agiafter'||_0x3072ff===_0x643f('0x82')||_0x3072ff==='rtpaudioqos'||_0x3072ff===_0x643f('0x83')||_0x3072ff==='rtpaudioqosjitter'||_0x3072ff===_0x643f('0x84')||_0x3072ff===_0x643f('0x85')||_0x3072ff==='rtpaudioqoslossbridged'||_0x3072ff===_0x643f('0x86')||_0x3072ff===_0x643f('0x87')||_0x3072ff===_0x643f('0x88')||_0x3072ff===_0x643f('0x83')||_0x3072ff===_0x643f('0x89')||_0x3072ff===_0x643f('0x84')||_0x3072ff==='rtpaudioqosloss'||_0x3072ff==='rtpaudioqoslossbridged'||_0x3072ff===_0x643f('0x86')||_0x3072ff===_0x643f('0x87')||_0x3072ff===_0x643f('0x8a')||_0x3072ff===_0x643f('0x8b')||_0x3072ff===_0x643f('0x3a')||_0x3072ff===_0x643f('0x3b')){return![];}return!![];};exports[_0x643f('0x8c')]=function(_0x131ce6,_0xdb47ad){var _0x4ee57f,_0x40d97b,_0x3f74bc;if(_0xdb47ad<=0x0){_0xdb47ad=0x1;}_0x4ee57f=new RegExp(_0x643f('0x8d')+_0xdb47ad+'}$');_0x40d97b=Math[_0x643f('0x8e')](0xa,_0xdb47ad-0x1);_0x3f74bc=Math['pow'](0xa,_0xdb47ad)-0x1;return util[_0x643f('0x13')]('%s',_[_0x643f('0x8f')](_0x131ce6,_0x4ee57f,_['random'](_0x40d97b,_0x3f74bc)));};exports[_0x643f('0x90')]=function(_0x2e01b5){var _0x11f111=_0x2e01b5[_0x643f('0x91')](/"(.*?)"/);return _0x11f111?_0x11f111[0x1]:_0x2e01b5;};exports[_0x643f('0x92')]=function(_0x1ce413){var _0x410570=_0x1ce413[_0x643f('0x91')](/<(.*?)>/);return _0x410570?_0x410570[0x1]:_0x1ce413;};function buildNoAnswerEventPayload(_0x2a71af,_0x1d92bd){var _0x48edba=buildObj(_0x2a71af,_0x643f('0x93'));if(!_[_0x643f('0x12')](_0x1d92bd[_0x643f('0x94')])){Object['keys'](_0x1d92bd[_0x643f('0x94')])[_0x643f('0x95')](function(_0x770399){_0x48edba[_0x770399['toLowerCase']()]=_0x1d92bd[_0x643f('0x94')][_0x770399];});}return _0x48edba;}exports[_0x643f('0x96')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xf2d9=['match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','moment','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','inspect','logger','info','loggerError','error','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','addVariables','Queue','name','calleridnum','VoiceQueueId','dialQueueProject2','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','updateOriginated','isNil','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','getSeconds','membername','UserId','logCustomer','ringtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','calleridname','uniqueid','originate','channelAgent','timeout','totalGlobal','countbusyretry','countcongestionretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','active','minutes','ListId','decrementTalkink','IsNotLoggedIn','lastevent','queue','motionChannel','mandatoryDisposition','buildObj','interface','agentReadyId','not_inuse','status','push','milliseconds','diff','seconds','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','ContactId','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridNumber'];(function(_0x3fc505,_0x1d11fd){var _0x25d2d5=function(_0xca2279){while(--_0xca2279){_0x3fc505['push'](_0x3fc505['shift']());}};_0x25d2d5(++_0x1d11fd);}(_0xf2d9,0x125));var _0x9f2d=function(_0x5cb284,_0x4b558f){_0x5cb284=_0x5cb284-0x0;var _0x3302f2=_0xf2d9[_0x5cb284];return _0x3302f2;};'use strict';var util=require(_0x9f2d('0x0'));var _=require('lodash');var moment=require(_0x9f2d('0x1'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0x9f2d('0x2')][_0x9f2d('0x3')]||_0x9f2d('0x4');var utils=require(_0x9f2d('0x5'));exports[_0x9f2d('0x6')]=function(_0xdd7392){return function(_0x24ea47){logger['error'](_0xdd7392,util[_0x9f2d('0x7')](_0x24ea47,{'showHidden':![],'depth':null}));};};exports[_0x9f2d('0x8')]=function(_0x4a81fa,_0x7523a2){logger[_0x9f2d('0x9')](_0x4a81fa,util['inspect'](_0x7523a2,{'showHidden':![],'depth':null}));};exports[_0x9f2d('0xa')]=function(_0x1581b1,_0x10dd98){logger[_0x9f2d('0xb')](_0x1581b1,util['inspect'](_0x10dd98,{'showHidden':![],'depth':null}));};exports[_0x9f2d('0xc')]=function(_0x481338){return function(_0x1c59ba){logger['info'](_0x481338,util[_0x9f2d('0x7')](_0x1c59ba,{'showHidden':![],'depth':null}));};};exports[_0x9f2d('0xd')]=function(_0x5b45f5,_0x31a50a,_0x112f7d){return{'message':_0x5b45f5,'unlock':_0x31a50a,'active':_0x112f7d};};exports[_0x9f2d('0xe')]=function(_0x469e44,_0x4b8afe,_0x168335){if(!_[_0x9f2d('0xf')](_0x168335)&&_0x9f2d('0x10')===typeof _0x168335&&!_['isEmpty'](_0x168335)){if(!_[_0x9f2d('0xf')](_0x4b8afe)&&_0x9f2d('0x10')===typeof _0x4b8afe&&!_[_0x9f2d('0x11')](_0x4b8afe)){return util[_0x9f2d('0x12')]('\x22%s\x22\x20<%s>',_0x4b8afe,_0x168335);}return util[_0x9f2d('0x12')](_0x9f2d('0x13'),_0x168335,_0x168335);}if(!_[_0x9f2d('0xf')](_0x469e44)&&'string'===typeof _0x469e44&&!_[_0x9f2d('0x11')](_0x469e44)){return _0x469e44;}return _0x9f2d('0x14');};exports['isActive']=function(_0x9201d){if(_['isNil'](_0x9201d)){return![];}return _0x9201d;};exports[_0x9f2d('0x15')]=function(_0x5cdccc,_0x4ad767,_0x42b5e2,_0x546451,_0x14f294,_0x1f17e1){var _0x1cb234={'XMD-QUEUE':_0x4ad767[_0x9f2d('0x16')]?_0x4ad767[_0x9f2d('0x16')][_0x9f2d('0x17')]:'','XMD-CALLERID':_0x546451,'XMD-CALLERID-PREVIEW':_0x1f17e1?util[_0x9f2d('0x12')](_0x9f2d('0x13'),_0x1f17e1['calleridname'],_0x1f17e1[_0x9f2d('0x18')]):_0x546451,'XMD-DIALID':_0x14f294,'XMD-CONTACTID':_0x4ad767['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x546451,'XMD-VOICEQUEUEID':_0x4ad767[_0x9f2d('0x19')],'XMD-DIALCHANNEL':_0x42b5e2,'XMD-DIALTIMEOUT':_0x5cdccc['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x9f2d('0x12')]('\x22rtTxX%s%s\x22',_0x5cdccc[_0x9f2d('0x1a')]?'g':'',_[_0x9f2d('0x11')](_0x5cdccc['monitor_format'])?'':_0x9f2d('0x1b')),'XMD-DIALURL':_0x5cdccc['dialPreviewUrl']||'','XMD-AGI':_0x5cdccc[_0x9f2d('0x1c')]?util[_0x9f2d('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5cdccc[_0x9f2d('0x1c')]):'NONE','XMD-AGIAFTER':_0x5cdccc[_0x9f2d('0x1a')]?util[_0x9f2d('0x12')](_0x9f2d('0x1d'),ipAgi,_0x5cdccc['dialQueueProject2']):_0x9f2d('0x1e'),'XMD-ORIGINATECALLERIDNUM':_0x1f17e1?_0x1f17e1[_0x9f2d('0x1f')]:'','XMD-ORIGINATECALLERIDNAME':_0x1f17e1?_0x1f17e1[_0x9f2d('0x20')]:'','XMD-DESTINATION':_0x9f2d('0x21'),'SIPADDHEADER':_0x9f2d('0x22')};if(!_[_0x9f2d('0x11')](_0x5cdccc[_0x9f2d('0x23')])){_0x1cb234[util[_0x9f2d('0x12')]('%s',_0x9f2d('0x24'))]=_0x5cdccc['monitor_format'];_0x1cb234[util['format']('%s',_0x9f2d('0x25'))]=_0x14f294;}if(_0x4ad767&&_0x4ad767[_0x9f2d('0x26')]){for(var _0x3185bf in _0x4ad767[_0x9f2d('0x26')]){if(_0x4ad767['Contact'][_0x9f2d('0x27')](_0x3185bf)){if(!_['isNil'](_0x4ad767[_0x9f2d('0x26')][_0x3185bf])&&_0x3185bf!=='id'&&_0x3185bf!==_0x9f2d('0x28')&&_0x3185bf!==_0x9f2d('0x29')&&_0x3185bf!==_0x9f2d('0x2a')){_0x1cb234[util[_0x9f2d('0x12')](_0x9f2d('0x2b'),'XMD-',_[_0x9f2d('0x2c')](_0x3185bf))]=_0x4ad767[_0x9f2d('0x26')][_0x3185bf];}}}}return _0x1cb234;};exports[_0x9f2d('0x2d')]=function(_0x313eb0){var _0xc5541a={};for(var _0x256c66 in _0x313eb0){if(_0x313eb0[_0x9f2d('0x27')](_0x256c66)){_0xc5541a[util[_0x9f2d('0x12')]('%s',_['toLower'](_0x256c66))]=_0x313eb0[_0x256c66];}}return{'variables':_0xc5541a};};exports[_0x9f2d('0x2e')]=function(_0x48fae4,_0x2e801a){if(!_[_0x9f2d('0x2f')](_0x48fae4)){if(_0x48fae4[_0x9f2d('0x27')]('originated')){if(_0x48fae4['originated']>0x0){_0x48fae4['originated']-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x2e801a);}}}else{logger[_0x9f2d('0xb')](_0x9f2d('0x30'),_0x2e801a);}};exports[_0x9f2d('0x31')]=function(_0x54af6b){var _0x2bb127=moment()[_0x9f2d('0x12')](_0x9f2d('0x32'));_0x54af6b[_0x9f2d('0x33')]=0xd;_0x54af6b[_0x9f2d('0x34')]='Blacklist';_0x54af6b[_0x9f2d('0x35')]=_0x2bb127;_0x54af6b[_0x9f2d('0x36')]=_0x2bb127;_0x54af6b[_0x9f2d('0x37')]=_0x2bb127;};exports['logAgent']=function(_0x407629,_0x44ab53,_0x224e24){var _0x1893ff=moment()[_0x9f2d('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x407629[_0x9f2d('0x33')]=_0x44ab53;_0x407629[_0x9f2d('0x34')]=_0x224e24;_0x407629[_0x9f2d('0x36')]=_0x1893ff;_0x407629['ringtime']=utils[_0x9f2d('0x38')](_0x407629[_0x9f2d('0x36')],_0x407629[_0x9f2d('0x35')]);};exports['logLookAgent']=function(_0x5dec34,_0x41d400,_0x3cabb0){_0x5dec34[_0x9f2d('0x39')]=_0x41d400;_0x5dec34[_0x9f2d('0x3a')]=_0x3cabb0;};exports[_0x9f2d('0x3b')]=function(_0x315ca0,_0x268074,_0x29bfd8){var _0x2d07c7=moment()[_0x9f2d('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x315ca0[_0x9f2d('0x33')]=_0x268074;_0x315ca0[_0x9f2d('0x34')]=_0x29bfd8;_0x315ca0[_0x9f2d('0x36')]=_0x315ca0['responsetime']?_0x315ca0[_0x9f2d('0x36')]:_0x2d07c7;_0x315ca0[_0x9f2d('0x37')]=_0x315ca0[_0x9f2d('0x37')]?_0x315ca0[_0x9f2d('0x37')]:_0x2d07c7;_0x315ca0[_0x9f2d('0x3c')]=utils[_0x9f2d('0x38')](_0x315ca0[_0x9f2d('0x36')]||0x0,_0x315ca0[_0x9f2d('0x35')]||0x0);_0x315ca0[_0x9f2d('0x3d')]=_0x315ca0[_0x9f2d('0x3e')]?utils['getSeconds'](_0x315ca0[_0x9f2d('0x37')],_0x315ca0[_0x9f2d('0x3e')]):0x0;};exports[_0x9f2d('0x3f')]=function(_0x40c9b0){return _0x40c9b0===_0x9f2d('0x40');};exports[_0x9f2d('0x41')]=function(_0x51f247,_0x430287,_0x470ce1,_0x185bc1,_0x2262cc){var _0x1662d1=_0x185bc1?_0x9f2d('0x42'):_0x51f247[_0x9f2d('0x43')];_0x1662d1=_0x2262cc?'BOOKED':_0x1662d1;return{'actionid':_0x51f247[_0x9f2d('0x44')],'action':_0x9f2d('0x45'),'channel':_0x51f247[_0x9f2d('0x46')],'callerid':util[_0x9f2d('0x12')]('\x22%s\x22\x20<%s>',_0x1662d1,_0x51f247[_0x9f2d('0x18')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x470ce1,'timeout':(_0x430287[_0x9f2d('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x51f247[_0x9f2d('0x44')]};};exports[_0x9f2d('0x48')]=function(_0x21a349){return _0x21a349[_0x9f2d('0x49')]+_0x21a349[_0x9f2d('0x4a')]+_0x21a349['countnoanswerretry']+_0x21a349['countagentrejectretry']+_0x21a349[_0x9f2d('0x4b')];};exports[_0x9f2d('0x4c')]=function(_0x355608){var _0x51a1e9=_['clone'](_0x355608);_0x51a1e9[_0x9f2d('0x33')]=0xf;_0x51a1e9[_0x9f2d('0x34')]=_0x9f2d('0x4d');return _0x51a1e9;};exports[_0x9f2d('0x4e')]=function(_0x32ed25,_0x2e5962,_0x52209a){var _0xf7b0a0={};_0xf7b0a0[_0x2e5962]=_0x32ed25[_0x2e5962];_0xf7b0a0[_0x9f2d('0x4f')]=![];_0xf7b0a0['scheduledat']=moment()['add'](_0x52209a,_0x9f2d('0x50'))['format'](_0x9f2d('0x32'));_0xf7b0a0['ContactId']=_0x32ed25['ContactId'];_0xf7b0a0[_0x9f2d('0x51')]=_0x32ed25['ListId'];_0xf7b0a0['VoiceQueueId']=_0x32ed25[_0x9f2d('0x19')]||undefined;return _0xf7b0a0;};exports[_0x9f2d('0x52')]=function(_0x7e7170,_0xb6f5c9){if(!_['isNil'](_0x7e7170)){if(_0x7e7170['pTalking']>0x0){_0x7e7170['pTalking']-=0x1;}else{logger['error'](_0xb6f5c9,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0xb6f5c9,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x9f2d('0x53')]=function(_0x55e4b1){if(_0x55e4b1<=0x0){return!![];}return![];};function buildObj(_0x4e1999,_0x3f1cca,_0x449bd5){_0x4e1999[_0x9f2d('0x54')]=_0x3f1cca;_0x4e1999[_0x9f2d('0x17')]=_0x4e1999[_0x9f2d('0x55')];_0x4e1999['interface']=_0x4e1999['channelAgent'];_0x4e1999[_0x9f2d('0x56')]='voice';if(_0x449bd5){_0x4e1999[_0x9f2d('0x57')]=_0x449bd5[_0x9f2d('0x57')];}return _0x4e1999;}exports[_0x9f2d('0x58')]=buildObj;exports['buildAcw']=function(_0xa00d65){var _0x120caa={};_0x120caa[_0x9f2d('0x55')]=_0xa00d65['queue'];_0x120caa[_0x9f2d('0x59')]=_0xa00d65[_0x9f2d('0x46')];_0x120caa['uniqueid']=_0xa00d65[_0x9f2d('0x44')];return _0x120caa;};exports[_0x9f2d('0x5a')]=function(_0x4e92a8){var _0x4bc378=[];for(var _0x4e7cff in _0x4e92a8){if(_0x4e92a8[_0x9f2d('0x27')](_0x4e7cff)){if(!_[_0x9f2d('0x2f')](_0x4e92a8[_0x4e7cff])&&_0x4e92a8[_0x4e7cff][_0x9f2d('0x33')]===_0x9f2d('0x5b')&&_0x4e92a8[_0x4e7cff][_0x9f2d('0x5c')]==='reachable'){_0x4bc378[_0x9f2d('0x5d')](_0x4e92a8[_0x4e7cff]['id']);}}}return _0x4bc378;};exports['getDiff']=function(_0x1181d2){var _0xc1f377=moment()[_0x9f2d('0x5e')](0x0);var _0x1a0943=moment(_0x1181d2)[_0x9f2d('0x5e')](0x0);return _0xc1f377[_0x9f2d('0x5f')](_0x1a0943,_0x9f2d('0x60'));};exports[_0x9f2d('0x61')]=function(_0x177784){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x177784['ContactId'],'ListId':_0x177784['ListId'],'VoiceQueueId':_0x177784[_0x9f2d('0x19')]||undefined,'CampaignId':_0x177784[_0x9f2d('0x62')]||undefined};};exports['filterKey']=function(_0x570a72){if(_0x570a72===_0x9f2d('0x44')||_0x570a72===_0x9f2d('0x63')||_0x570a72==='queue'||_0x570a72===_0x9f2d('0x64')||_0x570a72===_0x9f2d('0x65')||_0x570a72===_0x9f2d('0x66')||_0x570a72===_0x9f2d('0x39')||_0x570a72===_0x9f2d('0x46')||_0x570a72===_0x9f2d('0x43')||_0x570a72==='active'||_0x570a72===_0x9f2d('0x18')||_0x570a72==='scheduledat'||_0x570a72===_0x9f2d('0x49')||_0x570a72==='countcongestionretry'||_0x570a72===_0x9f2d('0x67')||_0x570a72===_0x9f2d('0x68')||_0x570a72===_0x9f2d('0x69')||_0x570a72===_0x9f2d('0x6a')||_0x570a72===_0x9f2d('0x6b')||_0x570a72===_0x9f2d('0x6c')||_0x570a72===_0x9f2d('0x6d')||_0x570a72==='ListId'||_0x570a72==='UserId'||_0x570a72===_0x9f2d('0x19')||_0x570a72==='sipcallid'||_0x570a72===_0x9f2d('0x6e')||_0x570a72===_0x9f2d('0x6f')||_0x570a72===_0x9f2d('0x70')||_0x570a72===_0x9f2d('0x71')||_0x570a72===_0x9f2d('0x72')||_0x570a72===_0x9f2d('0x73')||_0x570a72===_0x9f2d('0x74')||_0x570a72===_0x9f2d('0x75')||_0x570a72==='xmd-dialchannel'||_0x570a72===_0x9f2d('0x76')||_0x570a72===_0x9f2d('0x77')||_0x570a72===_0x9f2d('0x78')||_0x570a72===_0x9f2d('0x79')||_0x570a72===_0x9f2d('0x7a')||_0x570a72===_0x9f2d('0x7b')||_0x570a72===_0x9f2d('0x7c')||_0x570a72==='rtpaudioqosjitter'||_0x570a72===_0x9f2d('0x7d')||_0x570a72===_0x9f2d('0x7e')||_0x570a72===_0x9f2d('0x7f')||_0x570a72===_0x9f2d('0x80')||_0x570a72===_0x9f2d('0x81')||_0x570a72===_0x9f2d('0x7b')||_0x570a72===_0x9f2d('0x7c')||_0x570a72==='rtpaudioqosjitter'||_0x570a72===_0x9f2d('0x7d')||_0x570a72==='rtpaudioqosloss'||_0x570a72===_0x9f2d('0x7f')||_0x570a72===_0x9f2d('0x80')||_0x570a72===_0x9f2d('0x81')||_0x570a72==='bridgepeer'||_0x570a72==='bridgepvtcallid'||_0x570a72==='state'||_0x570a72===_0x9f2d('0x34')){return![];}return!![];};exports[_0x9f2d('0x82')]=function(_0x4c5397,_0x38db8a){var _0x2a1e9f,_0x1c779d,_0x51df89;if(_0x38db8a<=0x0){_0x38db8a=0x1;}_0x2a1e9f=new RegExp(_0x9f2d('0x83')+_0x38db8a+'}$');_0x1c779d=Math[_0x9f2d('0x84')](0xa,_0x38db8a-0x1);_0x51df89=Math[_0x9f2d('0x84')](0xa,_0x38db8a)-0x1;return util[_0x9f2d('0x12')]('%s',_[_0x9f2d('0x85')](_0x4c5397,_0x2a1e9f,_[_0x9f2d('0x86')](_0x1c779d,_0x51df89)));};exports['extractCalleridName']=function(_0xc47800){var _0x40c686=_0xc47800['match'](/"(.*?)"/);return _0x40c686?_0x40c686[0x1]:_0xc47800;};exports[_0x9f2d('0x87')]=function(_0x268b9c){var _0x5656b1=_0x268b9c[_0x9f2d('0x88')](/<(.*?)>/);return _0x5656b1?_0x5656b1[0x1]:_0x268b9c;};function buildNoAnswerEventPayload(_0x104c78,_0x54c5a7){var _0x2ca907=buildObj(_0x104c78,_0x9f2d('0x89'));if(!_['isEmpty'](_0x54c5a7[_0x9f2d('0x8a')])){Object[_0x9f2d('0x8b')](_0x54c5a7[_0x9f2d('0x8a')])[_0x9f2d('0x8c')](function(_0x3ecaee){_0x2ca907[_0x3ecaee[_0x9f2d('0x8d')]()]=_0x54c5a7[_0x9f2d('0x8a')][_0x3ecaee];});}return _0x2ca907;}exports[_0x9f2d('0x8e')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 4f83e04..01d4cd6 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 _0xe1c3=['string','number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelredirect','queueadd'];(function(_0x404624,_0x47fce5){var _0x1d0885=function(_0x58740a){while(--_0x58740a){_0x404624['push'](_0x404624['shift']());}};_0x1d0885(++_0x47fce5);}(_0xe1c3,0x86));var _0x3e1c=function(_0xebbb35,_0x8bd06d){_0xebbb35=_0xebbb35-0x0;var _0x506e59=_0xe1c3[_0xebbb35];return _0x506e59;};'use strict';exports[_0x3e1c('0x0')]={'queue':{'type':_0x3e1c('0x1'),'required':!![]},'interface':{'type':_0x3e1c('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x3e1c('0x2'),'required':![]},'paused':{'type':_0x3e1c('0x3'),'required':![]}};exports[_0x3e1c('0x4')]={'queue':{'type':_0x3e1c('0x1'),'required':!![]},'interface':{'type':_0x3e1c('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x3e1c('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x3e1c('0x1'),'required':![]}};exports[_0x3e1c('0x5')]={'module':{'type':_0x3e1c('0x1'),'required':![]}};exports[_0x3e1c('0x6')]={'uniqueid':{'type':_0x3e1c('0x1'),'required':!![]}};exports[_0x3e1c('0x7')]={'uniqueid':{'type':_0x3e1c('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x3e1c('0x1')},'mixmonitorid':{'type':_0x3e1c('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports[_0x3e1c('0x8')]={'uniqueid':{'type':_0x3e1c('0x1'),'required':!![]},'exten':{'type':_0x3e1c('0x1'),'required':!![]},'context':{'type':_0x3e1c('0x1')}}; \ No newline at end of file +var _0xc442=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string'];(function(_0x555b87,_0x58ddfd){var _0x3f106f=function(_0x3e02ef){while(--_0x3e02ef){_0x555b87['push'](_0x555b87['shift']());}};_0x3f106f(++_0x58ddfd);}(_0xc442,0x8f));var _0x2c44=function(_0x5c2360,_0x1d13e0){_0x5c2360=_0x5c2360-0x0;var _0x4e26f0=_0xc442[_0x5c2360];return _0x4e26f0;};'use strict';exports['queueadd']={'queue':{'type':_0x2c44('0x0'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x2c44('0x0'),'required':!![]},'penalty':{'type':_0x2c44('0x1'),'required':![]},'paused':{'type':_0x2c44('0x2'),'required':![]}};exports[_0x2c44('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0x2c44('0x0'),'required':!![]},'paused':{'type':_0x2c44('0x2')},'reason':{'type':'string','required':![]}};exports[_0x2c44('0x4')]={'module':{'type':'string','required':![]}};exports[_0x2c44('0x5')]={'uniqueid':{'type':_0x2c44('0x0'),'required':!![]}};exports[_0x2c44('0x6')]={'uniqueid':{'type':_0x2c44('0x0'),'required':!![]},'filename':{'type':_0x2c44('0x0')},'format':{'type':_0x2c44('0x0')},'mixmonitorid':{'type':_0x2c44('0x0')}};exports[_0x2c44('0x7')]={'uniqueid':{'type':_0x2c44('0x0'),'required':!![]}};exports[_0x2c44('0x8')]={'uniqueid':{'type':_0x2c44('0x0'),'required':!![]},'exten':{'type':_0x2c44('0x0'),'required':!![]},'context':{'type':_0x2c44('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 599ee8f..677c4b4 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(_0x16a67b,_0x59842b){var _0x56e17b=function(_0x4957d2){while(--_0x4957d2){_0x16a67b['push'](_0x16a67b['shift']());}};_0x56e17b(++_0x59842b);}(_0xb10b,0x12a));var _0xbb10=function(_0x12dfeb,_0x3fe94f){_0x12dfeb=_0x12dfeb-0x0;var _0x3f2fb8=_0xb10b[_0x12dfeb];return _0x3f2fb8;};'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 _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x311aad,_0x54d658){_0x311aad=_0x311aad-0x0;var _0x1779bd=_0x0b0e[_0x311aad];return _0x1779bd;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 8c1fd1f..84ac366 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 _0x1d5e=['assign','hasOwnProperty'];(function(_0x31bcbe,_0x4ce65b){var _0x485320=function(_0x1cb6d7){while(--_0x1cb6d7){_0x31bcbe['push'](_0x31bcbe['shift']());}};_0x485320(++_0x4ce65b);}(_0x1d5e,0x108));var _0xe1d5=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x1d5e[_0x40a045];return _0x1a687c;};'use strict';function mergeDBDataToRealtime(_0x16a373,_0x59716e){var _0x14aacd=Object[_0xe1d5('0x0')]({},_0x16a373);for(var _0x9929af in _0x59716e){if(_0x14aacd[_0xe1d5('0x1')](_0x9929af)){_0x14aacd[_0x9929af]=_0x59716e[_0x9929af];}}return _0x14aacd;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0x5ed6=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x5d85f6,_0x392ce4){var _0xf1f85d=function(_0x4ffdfe){while(--_0x4ffdfe){_0x5d85f6['push'](_0x5d85f6['shift']());}};_0xf1f85d(++_0x392ce4);}(_0x5ed6,0x152));var _0x65ed=function(_0x256e32,_0x4013bc){_0x256e32=_0x256e32-0x0;var _0x464070=_0x5ed6[_0x256e32];return _0x464070;};'use strict';function mergeDBDataToRealtime(_0x100ef2,_0x1b2c91){var _0x1b12dd=Object[_0x65ed('0x0')]({},_0x100ef2);for(var _0x1588ac in _0x1b2c91){if(_0x1b12dd[_0x65ed('0x1')](_0x1588ac)){_0x1b12dd[_0x1588ac]=_0x1b2c91[_0x1588ac];}}return _0x1b12dd;}exports[_0x65ed('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 27d27e2..9fdc9cc 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 _0x1b7a=['transfers','transfereelinkedid','UserId','channel','split','membername','monitor','monitorFilename','monitors','filename','createdAt','xcally-motion-preview','connectedlinename','originatecalleridnum','exten','xcally-motion-dialer','voiceAgentReport','isArray','forEach','create','startsWith','Local','substring','indexOf','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','name','isNil','find','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','getCallType','getAgentByInternal','calleridnum','internal','destination','type','lastapplication','queue','lastdata','context','callerid','calleridpreview','destinationchannel','disposition','\x22%s\x22\x20<%s>','calleridname','linkedid'];(function(_0x43a15c,_0x37fdb2){var _0x340966=function(_0x24e719){while(--_0x24e719){_0x43a15c['push'](_0x43a15c['shift']());}};_0x340966(++_0x37fdb2);}(_0x1b7a,0xd2));var _0xa1b7=function(_0x489705,_0x402b63){_0x489705=_0x489705-0x0;var _0xe572f4=_0x1b7a[_0x489705];return _0xe572f4;};'use strict';var _=require(_0xa1b7('0x0'));var moment=require(_0xa1b7('0x1'));var util=require('util');var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0xa1b7('0x2'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xa1b7('0x3'));var RpcMemberReport=require(_0xa1b7('0x4'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xa1b7('0x5'));var RpcVoiceTransferReport=require(_0xa1b7('0x6'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xa1b7('0x7'));var VoiceDialReport=require(_0xa1b7('0x8'));var UserReport=require(_0xa1b7('0x9'));function Report(_0x450c4c){this[_0xa1b7('0xa')]=_0x450c4c;this[_0xa1b7('0xb')]=_0x450c4c[_0xa1b7('0xb')];this[_0xa1b7('0xc')]=_0x450c4c[_0xa1b7('0xc')];}Report[_0xa1b7('0xd')][_0xa1b7('0xe')]=function(_0xbaa004){var _0x5d3ab3=new VoiceQueueReport(this[_0xa1b7('0xa')]);var _0x1504c8=new VoiceAgentReport(this[_0xa1b7('0xa')]);var _0x32a45e=new VoiceDialReport(this[_0xa1b7('0xa')]);var _0x1e0903=new VoiceCallReport(this['realtime']);var _0x50db9e=new UserReport(this['realtime']);if(config[_0xa1b7('0xf')]&&config[_0xa1b7('0xf')][_0xa1b7('0x10')]){ami['on'](_0xa1b7('0x11'),this[_0xa1b7('0x12')][_0xa1b7('0x13')](this));ami['on'](_0xa1b7('0x14'),this[_0xa1b7('0x15')]['bind'](this));ami['on'](_0xa1b7('0x16'),this['voiceAgentReport'][_0xa1b7('0x13')](this));ami['on']('custom:voiceDialReport',this[_0xa1b7('0x17')][_0xa1b7('0x13')](this));ami['on'](_0xa1b7('0x18'),this[_0xa1b7('0x19')][_0xa1b7('0x13')](this));ami['on'](_0xa1b7('0x1a'),this[_0xa1b7('0x1b')][_0xa1b7('0x13')](this));}};Report[_0xa1b7('0xd')][_0xa1b7('0x1c')]=function(_0x215867){var _0x269d15;_0x269d15=_['find'](this[_0xa1b7('0xb')],function(_0x5ca547){return _0x5ca547[_0xa1b7('0x1d')]==_0x215867||_0x5ca547[_0xa1b7('0x1e')]==_0x215867;});if(_[_0xa1b7('0x1f')](_0x269d15)){var _0x1214f2=_[_0xa1b7('0x20')](this['telephones'],function(_0x594a03){return _0x594a03['accountcode']==_0x215867||_0x594a03['name']==_0x215867;});if(_0x1214f2){_0x269d15=_[_0xa1b7('0x20')](this[_0xa1b7('0xb')],function(_0x1af103){return _0x1af103[_0xa1b7('0x21')]==util[_0xa1b7('0x22')](_0xa1b7('0x23'),_0x1214f2['name']);});}}return _0x269d15;};Report[_0xa1b7('0xd')][_0xa1b7('0x12')]=function(_0x19a50f){for(var _0x5e5249=0x0;_0x5e5249<_0x19a50f[_0xa1b7('0x24')];_0x5e5249+=0x1){var _0x4ed348=this[_0xa1b7('0x1c')](_0x19a50f[_0x5e5249][_0xa1b7('0x25')]);if(_0x4ed348){_0x19a50f[_0x5e5249][_0xa1b7('0x1d')]=_0x4ed348[_0xa1b7('0x1d')];_0x19a50f[_0x5e5249][_0xa1b7('0x26')]=!![];_0x19a50f[_0x5e5249][_0xa1b7('0x27')]=_0x4ed348['name'];_0x19a50f[_0x5e5249][_0xa1b7('0x21')]=_[_0xa1b7('0x1f')](_0x4ed348['interface'])?util[_0xa1b7('0x22')](_0xa1b7('0x23'),_0x4ed348[_0xa1b7('0x1e')]):_0x4ed348[_0xa1b7('0x21')];if(_0x19a50f[_0x5e5249][_0xa1b7('0x28')]){_0x19a50f[_0x5e5249][_0xa1b7('0x29')]=moment()[_0xa1b7('0x22')](_0xa1b7('0x2a'));}if(_0x19a50f[_0x5e5249][_0xa1b7('0x2b')]){_0x19a50f[_0x5e5249][_0xa1b7('0x2c')]=moment()['format'](_0xa1b7('0x2a'));}RpcMemberReport[_0xa1b7('0x12')](_0x19a50f[_0x5e5249]);}RpcVoiceQueueReport['create'](_0x19a50f[_0x5e5249]);}};function extractCalleridNumber(_0x410c8a){var _0xa2afbf=_0x410c8a[_0xa1b7('0x2d')](/<(.*?)>/);return _0xa2afbf?_0xa2afbf[0x1]:_0x410c8a;}Report['prototype']['getAgentByInternal']=function(_0x44c6d6){for(var _0x440fb3=0x0;_0x440fb3/);return _0x5c17d9?_0x5c17d9[0x1]:_0x537a20;}Report[_0xac07('0xf')][_0xac07('0x2b')]=function(_0x21f381){for(var _0x5a7734=0x0;_0x5a7734',_0x571b79[_0xac07('0x41')],_0x571b79[_0xac07('0x3e')]);}if(RpcVoiceTransferReport[_0xac07('0x42')][_0x571b79[_0xac07('0x43')]]){var _0x35ffbf=RpcVoiceTransferReport['transfers'][_0x571b79['linkedid']];_0x35ffbf[_0xac07('0x44')]=_0x571b79[_0xac07('0x45')];RpcVoiceTransferReport[_0xac07('0x46')](_0x35ffbf);delete RpcVoiceTransferReport['transfers'][_0x571b79[_0xac07('0x43')]];}if(_[_0xac07('0x20')](_0x571b79['type'])){_0x571b79[_0xac07('0x47')]=this['getCallType'](_0x571b79);}if(_[_0xac07('0x20')](_0x571b79[_0xac07('0x48')])){var _0x7a116d=_0x571b79[_0xac07('0x3d')][_0xac07('0x2e')]('-')[0x0];var _0x14c8ef=this[_0xac07('0xd')][_0x7a116d];if(!_0x14c8ef)_0x14c8ef=this[_0xac07('0x2b')](_0x571b79[_0xac07('0x1e')]);if(_0x14c8ef){_0x571b79['UserId']=_0x14c8ef['id'];_0x571b79[_0xac07('0x49')]=_0x14c8ef['name'];}}RpcVoiceCallReport['create'](_0x571b79);if(_0x571b79['monitor']){for(var _0x49bca5=0x0;_0x49bca5<_0x571b79[_0xac07('0x4a')][_0xac07('0x24')];_0x49bca5+=0x1){_0x571b79[_0xac07('0x4b')]=_0x571b79[_0xac07('0x4a')][_0x49bca5][_0xac07('0x4c')];_0x571b79['createdAt']=_0x571b79[_0xac07('0x4a')][_0x49bca5][_0xac07('0x4d')];if(_0x571b79[_0xac07('0x32')]==_0xac07('0x39')){_0x571b79[_0xac07('0x3e')]=_0x571b79['connectedlinenum'];_0x571b79[_0xac07('0x41')]=_0x571b79['connectedlinename'];_0x571b79[_0xac07('0x4e')]=_0x571b79['accountcode'];_0x571b79[_0xac07('0x4f')]=_0x571b79['membername'];_0x571b79['exten']=_0x571b79['originatecalleridnum'];}else if(_0x571b79[_0xac07('0x32')]==_0xac07('0x50')){_0x571b79[_0xac07('0x3e')]=_0x571b79[_0xac07('0x31')];_0x571b79[_0xac07('0x32')]=_0x571b79['originatecalleridnum'];}RpcVoiceRecording['create'](_0x571b79);}}};Report[_0xac07('0xf')]['voiceAgentReport']=function(_0xe16f95){if(_[_0xac07('0x51')](_0xe16f95)){_0xe16f95['forEach'](function(_0x45a33b){RpcVoiceAgentReport['create'](_0x45a33b);});}else{RpcVoiceAgentReport[_0xac07('0x52')](_0xe16f95);}};Report[_0xac07('0xf')][_0xac07('0x19')]=function(_0x45ccd0){RpcVoiceDialReport[_0xac07('0x52')](_0x45ccd0);var _0x42f8e5;var _0x5ccb3f;var _0xc49b51=_0x45ccd0[_0xac07('0x3d')];if(_[_0xac07('0x53')](_0xc49b51,'Local')){_0x5ccb3f=_0xc49b51['substring'](_0xc49b51[_0xac07('0x54')]('/')+0x1,_0xc49b51['indexOf']('@'));_0x42f8e5=_[_0xac07('0x1d')](this[_0xac07('0xd')],function(_0x3ea655){return _0x3ea655[_0xac07('0x55')]==_0x5ccb3f||_0x3ea655[_0xac07('0x56')]==_0x5ccb3f||_0x3ea655[_0xac07('0x1e')]==_0x5ccb3f;});}else{_0x5ccb3f=_0xc49b51['substring'](_0xc49b51[_0xac07('0x54')]('/')+0x1,_0xc49b51[_0xac07('0x57')]('-'));_0x42f8e5=this[_0xac07('0x25')](_0x5ccb3f);}if(_0x42f8e5){_0x45ccd0['interface']=_[_0xac07('0x20')](_0x42f8e5['interface'])?util[_0xac07('0x22')]('SIP/%s',_0x42f8e5[_0xac07('0x1f')]):_0x42f8e5[_0xac07('0x21')];_0x45ccd0[_0xac07('0x49')]=_0x42f8e5['name'];_0x45ccd0[_0xac07('0x1e')]=_0x42f8e5['accountcode'];RpcMemberReport['voiceDialReport'](_0x45ccd0);}};Report[_0xac07('0xf')][_0xac07('0x46')]=function(_0x4816d5){RpcVoiceTransferReport[_0xac07('0x42')][_0x4816d5[_0xac07('0x58')]]=_0x4816d5;};Report[_0xac07('0xf')][_0xac07('0x1c')]=function(_0xfd4ce6){RpcVoiceTransferReport['attendedTransfer'](_0xfd4ce6);};module[_0xac07('0x59')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index ead662a..399b404 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d51=['devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','catch','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','find','stateRegistry','merge','omit','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s','name','trunk:save','device','toLowerCase','toNumber','format','stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','Local','substring','indexOf','phone','accountcode','local','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','[userReport][peerstatus]','registered','status','address','updateStatusRealtime','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','defaults','redis','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind'];(function(_0x2ad046,_0x3e0fd6){var _0x4ac5d8=function(_0x300cda){while(--_0x300cda){_0x2ad046['push'](_0x2ad046['shift']());}};_0x4ac5d8(++_0x3e0fd6);}(_0x1d51,0x87));var _0x11d5=function(_0x4bd7eb,_0x1632b0){_0x4bd7eb=_0x4bd7eb-0x0;var _0x435b9f=_0x1d51[_0x4bd7eb];return _0x435b9f;};'use strict';var _=require(_0x11d5('0x0'));var moment=require(_0x11d5('0x1'));var util=require(_0x11d5('0x2'));var Redis=require(_0x11d5('0x3'));var BPromise=require(_0x11d5('0x4'));var config=require(_0x11d5('0x5'));var logger=require(_0x11d5('0x6'))(_0x11d5('0x7'));var ami=require('../ami');config['redis']=_[_0x11d5('0x8')](config[_0x11d5('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x11d5('0xa'))(new Redis(config[_0x11d5('0x9')]));function UserReport(_0xa4d6c1){this[_0x11d5('0xb')]=_0xa4d6c1[_0x11d5('0xb')];this[_0x11d5('0xc')]=_0xa4d6c1[_0x11d5('0xc')];this[_0x11d5('0xd')]=_0xa4d6c1[_0x11d5('0xd')];ami['on'](_0x11d5('0xe'),this[_0x11d5('0xf')][_0x11d5('0x10')](this));ami['on']('registry',this['syncRegistry'][_0x11d5('0x10')](this));ami['on'](_0x11d5('0x11'),this[_0x11d5('0x12')][_0x11d5('0x10')](this));ami['on'](_0x11d5('0x13'),this[_0x11d5('0x14')][_0x11d5('0x10')](this));return this[_0x11d5('0x15')]();}function showSipRegistrations(){Promise[_0x11d5('0x16')]()[_0x11d5('0x17')](ami[_0x11d5('0x18')]())['catch'](function(_0x3f29ec){logger[_0x11d5('0x19')](_0x11d5('0x1a'),util[_0x11d5('0x1b')](_0x3f29ec,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x11d5('0x16')]()[_0x11d5('0x17')](ami[_0x11d5('0x1c')]())[_0x11d5('0x1d')](function(_0x2c304f){logger[_0x11d5('0x19')](_0x11d5('0x1e'),util[_0x11d5('0x1b')](_0x2c304f,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x11d5('0x16')]()['then'](ami[_0x11d5('0x1f')]())[_0x11d5('0x1d')](function(_0x7095fe){logger[_0x11d5('0x19')](_0x11d5('0x20'),util['inspect'](_0x7095fe,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0x11d5('0x15')]=function(){setInterval(function(){BPromise['resolve']()[_0x11d5('0x17')](showSipRegistrations())['then'](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0x11d5('0x21')][_0x11d5('0x22')]=function(_0x478ee4){return _0x478ee4!==null&&!_['isUndefined'](_0x478ee4);};UserReport['prototype'][_0x11d5('0x23')]=function(_0x135feb,_0x99c591,_0x42b065){io['to'](_0x135feb)[_0x11d5('0x23')](_0x99c591,_0x42b065);};UserReport[_0x11d5('0x21')][_0x11d5('0xf')]=function(_0x14d370){try{if(this[_0x11d5('0x22')](_0x14d370)){logger[_0x11d5('0x24')](_0x11d5('0x25'),_0x14d370[_0x11d5('0x26')],_0x14d370[_0x11d5('0x27')]);logger[_0x11d5('0x28')]('[userReport][registry]',util['inspect'](_0x14d370,{'showHidden':![],'depth':null}));var _0x592edd=_[_0x11d5('0x29')](this[_0x11d5('0xb')],{'defaultuser':_0x14d370[_0x11d5('0x26')]});if(_0x592edd){_0x14d370[_0x11d5('0x2a')]=_0x14d370['state'];_[_0x11d5('0x2b')](_0x592edd,_[_0x11d5('0x2c')](_0x14d370,[_0x11d5('0x2d'),'actionid',_0x11d5('0x26'),'state']));logger['debug'](_0x11d5('0x2e'),util[_0x11d5('0x1b')](_0x592edd,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x11d5('0x2f'),_0x592edd[_0x11d5('0x30')]),_0x11d5('0x31'),_0x592edd);}}}catch(_0x4fceda){logger['error']('[userReport][registry]',util['inspect'](_0x4fceda,{'showHidden':![],'depth':null}));}};UserReport[_0x11d5('0x21')][_0x11d5('0x12')]=function(_0x3d3fba){try{if(this[_0x11d5('0x22')](_0x3d3fba)){logger[_0x11d5('0x24')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x3d3fba['device'],_0x3d3fba[_0x11d5('0x27')]);logger[_0x11d5('0x28')]('[userReport][devicestatechange]',util['inspect'](_0x3d3fba,{'showHidden':![],'depth':null}));if(this['agents'][_0x3d3fba[_0x11d5('0x32')]]){if(!this[_0x11d5('0xc')][_0x3d3fba[_0x11d5('0x32')]]['local']||_0x3d3fba[_0x11d5('0x27')][_0x11d5('0x33')]()=='inuse'){this[_0x11d5('0xc')][_0x3d3fba[_0x11d5('0x32')]]['local']=![];if(this[_0x11d5('0xc')][_0x3d3fba[_0x11d5('0x32')]][_0x11d5('0x27')]!==_0x3d3fba['state']['toLowerCase']()){this['agents'][_0x3d3fba[_0x11d5('0x32')]]['stateTime']=_[_0x11d5('0x34')](moment()[_0x11d5('0x35')]('x'));}this[_0x11d5('0xc')][_0x3d3fba['device']][_0x11d5('0x27')]=_0x3d3fba[_0x11d5('0x27')][_0x11d5('0x33')]();this[_0x11d5('0xc')][_0x3d3fba['device']]['updateStatusRealtime'](_0x3d3fba);}}else if(this[_0x11d5('0xd')][_0x3d3fba[_0x11d5('0x32')]]){if(this[_0x11d5('0xd')][_0x3d3fba['device']]['state']!==_0x3d3fba['state']['toLowerCase']()){this['telephones'][_0x3d3fba[_0x11d5('0x32')]][_0x11d5('0x36')]=_[_0x11d5('0x34')](moment()[_0x11d5('0x35')]('x'));}this[_0x11d5('0xd')][_0x3d3fba[_0x11d5('0x32')]][_0x11d5('0x27')]=_0x3d3fba[_0x11d5('0x27')][_0x11d5('0x33')]();logger[_0x11d5('0x28')](_0x11d5('0x37'),util[_0x11d5('0x1b')](this[_0x11d5('0xd')][_0x3d3fba[_0x11d5('0x32')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x11d5('0x38'),this[_0x11d5('0xd')][_0x3d3fba[_0x11d5('0x32')]][_0x11d5('0x30')]),_0x11d5('0x39'),this[_0x11d5('0xd')][_0x3d3fba[_0x11d5('0x32')]]);}else if(this[_0x11d5('0xb')][_0x3d3fba['device']]){if(this[_0x11d5('0xb')][_0x3d3fba['device']]['state']!==_0x3d3fba[_0x11d5('0x27')]['toLowerCase']()){this[_0x11d5('0xb')][_0x3d3fba[_0x11d5('0x32')]][_0x11d5('0x36')]=_[_0x11d5('0x34')](moment()[_0x11d5('0x35')]('x'));}this[_0x11d5('0xb')][_0x3d3fba[_0x11d5('0x32')]][_0x11d5('0x27')]=_0x3d3fba[_0x11d5('0x27')][_0x11d5('0x33')]();logger[_0x11d5('0x28')](_0x11d5('0x3a'),util[_0x11d5('0x1b')](this[_0x11d5('0xb')][_0x3d3fba[_0x11d5('0x32')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x11d5('0x35')](_0x11d5('0x2f'),this['trunks'][_0x3d3fba[_0x11d5('0x32')]][_0x11d5('0x30')]),_0x11d5('0x31'),this[_0x11d5('0xb')][_0x3d3fba['device']]);}else if(_['startsWith'](_0x3d3fba[_0x11d5('0x32')],_0x11d5('0x3b'))){var _0x1c99e8=_0x3d3fba[_0x11d5('0x32')];var _0x8d30eb=_0x1c99e8[_0x11d5('0x3c')](_0x1c99e8[_0x11d5('0x3d')]('/')+0x1,_0x1c99e8['indexOf']('@'));var _0x3118f1=_[_0x11d5('0x29')](this[_0x11d5('0xc')],function(_0x52a9dc){return _0x52a9dc['mobile']==_0x8d30eb||_0x52a9dc[_0x11d5('0x3e')]==_0x8d30eb||_0x52a9dc[_0x11d5('0x3f')]==_0x8d30eb;});if(_0x3118f1){if(_0x3118f1[_0x11d5('0x27')]!==_0x3d3fba[_0x11d5('0x27')][_0x11d5('0x33')]()){_0x3118f1[_0x11d5('0x36')]=_[_0x11d5('0x34')](moment()[_0x11d5('0x35')]('x'));}_0x3118f1['state']=_0x3d3fba['state']['toLowerCase']();_0x3118f1[_0x11d5('0x40')]=!![];_0x3118f1['updateStatusRealtime'](_0x3d3fba);}}}}catch(_0x3118a5){logger[_0x11d5('0x19')](_0x11d5('0x41'),util['inspect'](_0x3118a5,{'showHidden':![],'depth':null}));}};UserReport[_0x11d5('0x21')][_0x11d5('0x14')]=function(_0x389fd2){try{if(this['isNotNull'](_0x389fd2)&&this[_0x11d5('0x22')](_0x389fd2['peerstatus'])){logger['info'](_0x11d5('0x42'),_0x389fd2[_0x11d5('0x43')],_0x389fd2['address'],_0x389fd2[_0x11d5('0x13')]);logger['debug'](_0x11d5('0x44'),util['inspect'](_0x389fd2,{'showHidden':![],'depth':null}));if(this['agents'][_0x389fd2[_0x11d5('0x43')]]){if(!this['agents'][_0x389fd2[_0x11d5('0x43')]]['local']||_0x389fd2[_0x11d5('0x13')][_0x11d5('0x33')]()==_0x11d5('0x45')){this[_0x11d5('0xc')][_0x389fd2[_0x11d5('0x43')]][_0x11d5('0x40')]=![];this[_0x11d5('0xc')][_0x389fd2[_0x11d5('0x43')]][_0x11d5('0x46')]=_0x389fd2[_0x11d5('0x13')][_0x11d5('0x33')]();this[_0x11d5('0xc')][_0x389fd2['peer']][_0x11d5('0x47')]=_0x389fd2[_0x11d5('0x47')];this[_0x11d5('0xc')][_0x389fd2[_0x11d5('0x43')]][_0x11d5('0x48')](_0x389fd2);}}else if(this[_0x11d5('0xd')][_0x389fd2[_0x11d5('0x43')]]){this[_0x11d5('0xd')][_0x389fd2[_0x11d5('0x43')]][_0x11d5('0x46')]=_0x389fd2[_0x11d5('0x13')][_0x11d5('0x33')]();this[_0x11d5('0xd')][_0x389fd2['peer']][_0x11d5('0x47')]=_0x389fd2['address'];logger[_0x11d5('0x28')](_0x11d5('0x49'),util[_0x11d5('0x1b')](this[_0x11d5('0xd')][_0x389fd2[_0x11d5('0x43')]],{'showHidden':![],'depth':null}));this[_0x11d5('0x23')](util['format']('telephone:%s',this[_0x11d5('0xd')][_0x389fd2[_0x11d5('0x43')]][_0x11d5('0x30')]),_0x11d5('0x39'),this[_0x11d5('0xd')][_0x389fd2[_0x11d5('0x43')]]);}else if(this['trunks'][_0x389fd2[_0x11d5('0x43')]]){this[_0x11d5('0xb')][_0x389fd2[_0x11d5('0x43')]][_0x11d5('0x46')]=_0x389fd2[_0x11d5('0x13')][_0x11d5('0x33')]();this[_0x11d5('0xb')][_0x389fd2[_0x11d5('0x43')]][_0x11d5('0x47')]=_0x389fd2['address'];logger[_0x11d5('0x28')](_0x11d5('0x4a'),util['inspect'](this['trunks'][_0x389fd2[_0x11d5('0x43')]],{'showHidden':![],'depth':null}));this[_0x11d5('0x23')](util[_0x11d5('0x35')]('trunk:%s',this['trunks'][_0x389fd2['peer']]['name']),_0x11d5('0x31'),this[_0x11d5('0xb')][_0x389fd2[_0x11d5('0x43')]]);}}}catch(_0x14ecf8){logger[_0x11d5('0x19')](_0x11d5('0x44'),util[_0x11d5('0x1b')](_0x14ecf8,{'showHidden':![],'depth':null}));}};module[_0x11d5('0x4b')]=UserReport; \ No newline at end of file +var _0x07e9=['error','[userReport][sippeerstatus]','prototype','isNotNull','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','find','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][registry]','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','inuse','toLowerCase','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','startsWith','substring','indexOf','mobile','phone','local','address','peer','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','lodash','moment','ioredis','bluebird','../../../config/environment','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','inspect','actionDeviceStateList'];(function(_0x525b88,_0x415cc8){var _0x3cb9a5=function(_0x5946b5){while(--_0x5946b5){_0x525b88['push'](_0x525b88['shift']());}};_0x3cb9a5(++_0x415cc8);}(_0x07e9,0x194));var _0x907e=function(_0x3cee62,_0x47f268){_0x3cee62=_0x3cee62-0x0;var _0x514b40=_0x07e9[_0x3cee62];return _0x514b40;};'use strict';var _=require(_0x907e('0x0'));var moment=require(_0x907e('0x1'));var util=require('util');var Redis=require(_0x907e('0x2'));var BPromise=require(_0x907e('0x3'));var config=require(_0x907e('0x4'));var logger=require('../../../config/logger')('ami');var ami=require(_0x907e('0x5'));config[_0x907e('0x6')]=_[_0x907e('0x7')](config[_0x907e('0x6')],{'host':_0x907e('0x8'),'port':0x18eb});var io=require(_0x907e('0x9'))(new Redis(config[_0x907e('0x6')]));function UserReport(_0x20a9d5){this[_0x907e('0xa')]=_0x20a9d5[_0x907e('0xa')];this['agents']=_0x20a9d5[_0x907e('0xb')];this['telephones']=_0x20a9d5[_0x907e('0xc')];ami['on'](_0x907e('0xd'),this[_0x907e('0xe')][_0x907e('0xf')](this));ami['on'](_0x907e('0x10'),this[_0x907e('0xe')][_0x907e('0xf')](this));ami['on'](_0x907e('0x11'),this[_0x907e('0x12')][_0x907e('0xf')](this));ami['on'](_0x907e('0x13'),this[_0x907e('0x14')][_0x907e('0xf')](this));return this[_0x907e('0x15')]();}function showSipRegistrations(){Promise[_0x907e('0x16')]()[_0x907e('0x17')](ami[_0x907e('0x18')]())[_0x907e('0x19')](function(_0xb354af){logger['error']('[userReport][sipshowregistry]',util[_0x907e('0x1a')](_0xb354af,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x907e('0x16')]()['then'](ami[_0x907e('0x1b')]())[_0x907e('0x19')](function(_0x1bccbc){logger[_0x907e('0x1c')]('[userReport][devicestatelist]',util[_0x907e('0x1a')](_0x1bccbc,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0x907e('0x17')](ami['actionSipPeerStatus']())[_0x907e('0x19')](function(_0x4df860){logger['error'](_0x907e('0x1d'),util['inspect'](_0x4df860,{'showHidden':![],'depth':null}));});}UserReport['prototype']['syncRealtimeShow']=function(){setInterval(function(){BPromise['resolve']()[_0x907e('0x17')](showSipRegistrations())[_0x907e('0x17')](listDeviceStates())[_0x907e('0x17')](showPeersStatus());},0x32c8);};UserReport[_0x907e('0x1e')][_0x907e('0x1f')]=function(_0x11ed3f){return _0x11ed3f!==null&&!_['isUndefined'](_0x11ed3f);};UserReport[_0x907e('0x1e')][_0x907e('0x20')]=function(_0x50e4c7,_0x3f086,_0xb616d){io['to'](_0x50e4c7)[_0x907e('0x20')](_0x3f086,_0xb616d);};UserReport[_0x907e('0x1e')][_0x907e('0xe')]=function(_0x349373){try{if(this['isNotNull'](_0x349373)){logger[_0x907e('0x21')](_0x907e('0x22'),_0x349373[_0x907e('0x23')],_0x349373[_0x907e('0x24')]);logger[_0x907e('0x25')]('[userReport][registry]',util['inspect'](_0x349373,{'showHidden':![],'depth':null}));var _0x460814=_[_0x907e('0x26')](this[_0x907e('0xa')],{'defaultuser':_0x349373[_0x907e('0x23')]});if(_0x460814){_0x349373['stateRegistry']=_0x349373[_0x907e('0x24')];_[_0x907e('0x27')](_0x460814,_[_0x907e('0x28')](_0x349373,[_0x907e('0x29'),_0x907e('0x2a'),_0x907e('0x23'),_0x907e('0x24')]));logger[_0x907e('0x25')](_0x907e('0x2b'),util[_0x907e('0x1a')](_0x460814,{'showHidden':![],'depth':null}));this[_0x907e('0x20')](util[_0x907e('0x2c')](_0x907e('0x2d'),_0x460814[_0x907e('0x2e')]),_0x907e('0x2f'),_0x460814);}}}catch(_0x384668){logger[_0x907e('0x1c')](_0x907e('0x30'),util[_0x907e('0x1a')](_0x384668,{'showHidden':![],'depth':null}));}};UserReport[_0x907e('0x1e')][_0x907e('0x12')]=function(_0x39bed7){try{if(this[_0x907e('0x1f')](_0x39bed7)){logger[_0x907e('0x21')](_0x907e('0x31'),_0x39bed7[_0x907e('0x32')],_0x39bed7[_0x907e('0x24')]);logger[_0x907e('0x25')](_0x907e('0x33'),util[_0x907e('0x1a')](_0x39bed7,{'showHidden':![],'depth':null}));if(this['agents'][_0x39bed7['device']]){if(!this[_0x907e('0xb')][_0x39bed7[_0x907e('0x32')]]['local']||_0x39bed7[_0x907e('0x24')]['toLowerCase']()==_0x907e('0x34')){this['agents'][_0x39bed7[_0x907e('0x32')]]['local']=![];if(this['agents'][_0x39bed7[_0x907e('0x32')]]['state']!==_0x39bed7[_0x907e('0x24')][_0x907e('0x35')]()){this[_0x907e('0xb')][_0x39bed7[_0x907e('0x32')]][_0x907e('0x36')]=_[_0x907e('0x37')](moment()[_0x907e('0x2c')]('x'));}this[_0x907e('0xb')][_0x39bed7['device']][_0x907e('0x24')]=_0x39bed7[_0x907e('0x24')][_0x907e('0x35')]();this['agents'][_0x39bed7['device']][_0x907e('0x38')](_0x39bed7);}}else if(this['telephones'][_0x39bed7[_0x907e('0x32')]]){if(this['telephones'][_0x39bed7[_0x907e('0x32')]][_0x907e('0x24')]!==_0x39bed7['state']['toLowerCase']()){this[_0x907e('0xc')][_0x39bed7[_0x907e('0x32')]][_0x907e('0x36')]=_[_0x907e('0x37')](moment()[_0x907e('0x2c')]('x'));}this[_0x907e('0xc')][_0x39bed7[_0x907e('0x32')]]['state']=_0x39bed7[_0x907e('0x24')][_0x907e('0x35')]();logger[_0x907e('0x25')](_0x907e('0x39'),util[_0x907e('0x1a')](this[_0x907e('0xc')][_0x39bed7[_0x907e('0x32')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x907e('0x2c')](_0x907e('0x3a'),this[_0x907e('0xc')][_0x39bed7[_0x907e('0x32')]][_0x907e('0x2e')]),_0x907e('0x3b'),this[_0x907e('0xc')][_0x39bed7[_0x907e('0x32')]]);}else if(this['trunks'][_0x39bed7[_0x907e('0x32')]]){if(this[_0x907e('0xa')][_0x39bed7['device']][_0x907e('0x24')]!==_0x39bed7['state']['toLowerCase']()){this[_0x907e('0xa')][_0x39bed7[_0x907e('0x32')]][_0x907e('0x36')]=_['toNumber'](moment()[_0x907e('0x2c')]('x'));}this[_0x907e('0xa')][_0x39bed7[_0x907e('0x32')]][_0x907e('0x24')]=_0x39bed7[_0x907e('0x24')]['toLowerCase']();logger['debug']('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x907e('0x1a')](this[_0x907e('0xa')][_0x39bed7['device']],{'showHidden':![],'depth':null}));this[_0x907e('0x20')](util['format'](_0x907e('0x2d'),this[_0x907e('0xa')][_0x39bed7[_0x907e('0x32')]][_0x907e('0x2e')]),'trunk:save',this['trunks'][_0x39bed7[_0x907e('0x32')]]);}else if(_[_0x907e('0x3c')](_0x39bed7[_0x907e('0x32')],'Local')){var _0x1879c5=_0x39bed7['device'];var _0x18e2c9=_0x1879c5[_0x907e('0x3d')](_0x1879c5['indexOf']('/')+0x1,_0x1879c5[_0x907e('0x3e')]('@'));var _0x1c9d31=_[_0x907e('0x26')](this[_0x907e('0xb')],function(_0x41ad69){return _0x41ad69[_0x907e('0x3f')]==_0x18e2c9||_0x41ad69[_0x907e('0x40')]==_0x18e2c9||_0x41ad69['accountcode']==_0x18e2c9;});if(_0x1c9d31){if(_0x1c9d31[_0x907e('0x24')]!==_0x39bed7[_0x907e('0x24')]['toLowerCase']()){_0x1c9d31['stateTime']=_[_0x907e('0x37')](moment()['format']('x'));}_0x1c9d31[_0x907e('0x24')]=_0x39bed7[_0x907e('0x24')]['toLowerCase']();_0x1c9d31[_0x907e('0x41')]=!![];_0x1c9d31[_0x907e('0x38')](_0x39bed7);}}}}catch(_0xe8c325){logger['error']('[userReport][devicestatechange]',util[_0x907e('0x1a')](_0xe8c325,{'showHidden':![],'depth':null}));}};UserReport[_0x907e('0x1e')]['syncPeerStatus']=function(_0x49d26d){try{if(this['isNotNull'](_0x49d26d)&&this[_0x907e('0x1f')](_0x49d26d[_0x907e('0x13')])){logger[_0x907e('0x21')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x49d26d['peer'],_0x49d26d[_0x907e('0x42')],_0x49d26d['peerstatus']);logger[_0x907e('0x25')]('[userReport][peerstatus]',util['inspect'](_0x49d26d,{'showHidden':![],'depth':null}));if(this[_0x907e('0xb')][_0x49d26d['peer']]){if(!this[_0x907e('0xb')][_0x49d26d[_0x907e('0x43')]][_0x907e('0x41')]||_0x49d26d[_0x907e('0x13')][_0x907e('0x35')]()==_0x907e('0x44')){this[_0x907e('0xb')][_0x49d26d['peer']][_0x907e('0x41')]=![];this[_0x907e('0xb')][_0x49d26d[_0x907e('0x43')]]['status']=_0x49d26d[_0x907e('0x13')][_0x907e('0x35')]();this['agents'][_0x49d26d['peer']][_0x907e('0x42')]=_0x49d26d[_0x907e('0x42')];this[_0x907e('0xb')][_0x49d26d[_0x907e('0x43')]][_0x907e('0x38')](_0x49d26d);}}else if(this[_0x907e('0xc')][_0x49d26d[_0x907e('0x43')]]){this[_0x907e('0xc')][_0x49d26d[_0x907e('0x43')]][_0x907e('0x45')]=_0x49d26d[_0x907e('0x13')]['toLowerCase']();this[_0x907e('0xc')][_0x49d26d[_0x907e('0x43')]][_0x907e('0x42')]=_0x49d26d[_0x907e('0x42')];logger['debug'](_0x907e('0x46'),util['inspect'](this['telephones'][_0x49d26d['peer']],{'showHidden':![],'depth':null}));this['emit'](util[_0x907e('0x2c')](_0x907e('0x3a'),this[_0x907e('0xc')][_0x49d26d['peer']]['name']),_0x907e('0x3b'),this[_0x907e('0xc')][_0x49d26d['peer']]);}else if(this[_0x907e('0xa')][_0x49d26d[_0x907e('0x43')]]){this[_0x907e('0xa')][_0x49d26d[_0x907e('0x43')]][_0x907e('0x45')]=_0x49d26d[_0x907e('0x13')][_0x907e('0x35')]();this[_0x907e('0xa')][_0x49d26d[_0x907e('0x43')]][_0x907e('0x42')]=_0x49d26d[_0x907e('0x42')];logger[_0x907e('0x25')](_0x907e('0x47'),util[_0x907e('0x1a')](this[_0x907e('0xa')][_0x49d26d['peer']],{'showHidden':![],'depth':null}));this['emit'](util[_0x907e('0x2c')]('trunk:%s',this[_0x907e('0xa')][_0x49d26d[_0x907e('0x43')]][_0x907e('0x2e')]),'trunk:save',this['trunks'][_0x49d26d[_0x907e('0x43')]]);}}}catch(_0x19e013){logger[_0x907e('0x1c')]('[userReport][peerstatus]',util[_0x907e('0x1a')](_0x19e013,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 7ef5c4c..5c60ca0 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc196=['connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','pick','channel','accountcode','exten','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','reason','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','name','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','transfer','talktime','acwtime','acwTimeout','interface','omit','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','agentcompleteAt','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','agentconnectAt','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','redis','socket.io-emitter','voiceChannels','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','queue','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','voice','merge','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20CHANNEL\x20','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20has\x20property!\x20%s,\x20%s\x20ARE\x20EQUAL?','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect'];(function(_0xb06911,_0x52e661){var _0x4389a8=function(_0x2230e5){while(--_0x2230e5){_0xb06911['push'](_0xb06911['shift']());}};_0x4389a8(++_0x52e661);}(_0xc196,0x10a));var _0x6c19=function(_0x5cd5e9,_0xf08195){_0x5cd5e9=_0x5cd5e9-0x0;var _0x398704=_0xc196[_0x5cd5e9];return _0x398704;};'use strict';var _=require(_0x6c19('0x0'));var moment=require(_0x6c19('0x1'));var util=require(_0x6c19('0x2'));var Redis=require(_0x6c19('0x3'));var config=require(_0x6c19('0x4'));var logger=require(_0x6c19('0x5'))('ami');var ami=require('../ami');config[_0x6c19('0x6')]=_['defaults'](config[_0x6c19('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x6c19('0x7'))(new Redis(config['redis']));function VoiceAgentReport(_0xdc5c72){this['channels']={};this[_0x6c19('0x8')]=_0xdc5c72[_0x6c19('0x9')];this['voiceQueues']=_0xdc5c72[_0x6c19('0xa')];this[_0x6c19('0xb')]=_0xdc5c72['agents'];this[_0x6c19('0xc')]={};ami['on'](_0x6c19('0xd'),this[_0x6c19('0xe')][_0x6c19('0xf')](this));ami['on'](_0x6c19('0x10'),this[_0x6c19('0x11')]['bind'](this));ami['on']('agentringnoanswer',this[_0x6c19('0x12')][_0x6c19('0xf')](this));ami['on'](_0x6c19('0x13'),this[_0x6c19('0x14')][_0x6c19('0xf')](this));ami['on'](_0x6c19('0x15'),this[_0x6c19('0x16')]['bind'](this));ami['on'](_0x6c19('0x17'),this[_0x6c19('0x18')][_0x6c19('0xf')](this));ami['on'](_0x6c19('0x19'),this[_0x6c19('0x1a')][_0x6c19('0xf')](this));ami['on']('musiconholdstart',this[_0x6c19('0x1b')][_0x6c19('0xf')](this));ami['on'](_0x6c19('0x1c'),this[_0x6c19('0x1d')][_0x6c19('0xf')](this));ami['on'](_0x6c19('0x1e'),this[_0x6c19('0x1f')][_0x6c19('0xf')](this));ami['on'](_0x6c19('0x20'),this[_0x6c19('0x21')][_0x6c19('0xf')](this));}VoiceAgentReport[_0x6c19('0x22')][_0x6c19('0x23')]=function(_0x401398,_0x3c241f,_0x27e782){io['to'](_0x401398)[_0x6c19('0x23')](_0x3c241f,_0x27e782);};VoiceAgentReport[_0x6c19('0x22')][_0x6c19('0x24')]=function(_0x21425d){return _0x21425d!==null&&!_[_0x6c19('0x25')](_0x21425d);};VoiceAgentReport[_0x6c19('0x22')]['syncAgentCalled']=function(_0x3db8d3){try{if(this[_0x6c19('0x24')](_0x3db8d3)){logger[_0x6c19('0x26')](_0x6c19('0x27'),_0x3db8d3['uniqueid'],_0x3db8d3[_0x6c19('0x28')],_0x3db8d3[_0x6c19('0x29')]);logger[_0x6c19('0x2a')](_0x6c19('0x2b'),_0x3db8d3[_0x6c19('0x2c')],util[_0x6c19('0x2d')](_0x3db8d3,{'showHidden':![],'depth':null}));if(_[_0x6c19('0x25')](this[_0x6c19('0x9')][_0x3db8d3[_0x6c19('0x2c')]])){this['channels'][_0x3db8d3[_0x6c19('0x2c')]]={};}var _0x51485b=this[_0x6c19('0xb')][_0x3db8d3['interface']];var _0x15b86c=this['channels'][_0x3db8d3[_0x6c19('0x2c')]][_0x3db8d3[_0x6c19('0x29')]];var _0x597ad4=this[_0x6c19('0xa')][_0x3db8d3[_0x6c19('0x2e')]];var _0x470aa8=this['variables'][_0x3db8d3['uniqueid']];if(_[_0x6c19('0x25')](_0x15b86c)){_0x15b86c={'agentcalledAt':moment()[_0x6c19('0x2f')](_0x6c19('0x30')),'lastevent':_0x6c19('0x31'),'mandatoryDisposition':_0x597ad4&&_0x597ad4[_0x6c19('0x32')]?_0x597ad4['mandatoryDisposition']:![],'type':_0x597ad4&&_0x597ad4[_0x6c19('0x33')]?_0x597ad4[_0x6c19('0x33')]:_0x6c19('0x34'),'variables':_0x470aa8,'motionChannel':_0x6c19('0x35')};}_[_0x6c19('0x36')](_0x15b86c,_['omit'](_0x3db8d3,[_0x6c19('0x37'),_0x6c19('0x38')]));this[_0x6c19('0x9')][_0x3db8d3[_0x6c19('0x2c')]][_0x3db8d3[_0x6c19('0x29')]]=_0x15b86c;logger[_0x6c19('0x2a')](_0x6c19('0x39'),_0x3db8d3['uniqueid'],util[_0x6c19('0x2d')](_0x15b86c,{'showHidden':![],'depth':null}));ami[_0x6c19('0x23')](_0x6c19('0x3a'),_0x15b86c);var _0x12bc54={'id':_0x51485b['id'],'calleridnum':_0x15b86c[_0x6c19('0x3b')],'queue':_0x15b86c[_0x6c19('0x2e')],'variables':_0x15b86c[_0x6c19('0xc')],'uniqueid':_0x3db8d3[_0x6c19('0x2c')]};logger[_0x6c19('0x2a')](_0x6c19('0x3c'),_0x3db8d3[_0x6c19('0x2c')],util['inspect'](_0x12bc54,{'showHidden':![],'depth':null}));this['emit'](util[_0x6c19('0x2f')](_0x6c19('0x3d'),_0x3db8d3[_0x6c19('0x28')]),_0x6c19('0x3e'),_0x12bc54);}}catch(_0x531556){logger[_0x6c19('0x3f')](_0x6c19('0x40'),_0x3db8d3[_0x6c19('0x2c')],util[_0x6c19('0x2d')](_0x531556,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6c19('0x22')][_0x6c19('0x11')]=function(_0x14a590){try{if(this['isNotNull'](_0x14a590)){if(this[_0x6c19('0x9')][_0x14a590['uniqueid']]){logger[_0x6c19('0x2a')](_0x6c19('0x41'),_0x14a590[_0x6c19('0x2c')],util['inspect'](_0x14a590,{'showHidden':![],'depth':null}));logger[_0x6c19('0x2a')](_0x6c19('0x42'),_0x14a590[_0x6c19('0x2c')],util['inspect'](this[_0x6c19('0x9')][_0x14a590[_0x6c19('0x2c')]],{'showHidden':![],'depth':null}));for(var _0x243ddc in this['channels'][_0x14a590[_0x6c19('0x2c')]]){if(this[_0x6c19('0x9')][_0x14a590[_0x6c19('0x2c')]][_0x6c19('0x43')](_0x243ddc)){logger[_0x6c19('0x2a')](_0x6c19('0x44'),_0x14a590[_0x6c19('0x2c')],_0x14a590['destuniqueid'],_0x243ddc,_0x14a590[_0x6c19('0x29')]===_0x243ddc);if(_0x14a590[_0x6c19('0x29')]===_0x243ddc){logger[_0x6c19('0x26')](_0x6c19('0x45'),_0x14a590[_0x6c19('0x2c')],_0x14a590[_0x6c19('0x28')],_0x14a590[_0x6c19('0x29')]);this[_0x6c19('0x9')][_0x14a590[_0x6c19('0x2c')]][_0x243ddc]['agentconnectAt']=moment()[_0x6c19('0x2f')](_0x6c19('0x30'));this[_0x6c19('0x9')][_0x14a590['uniqueid']][_0x243ddc][_0x6c19('0x46')]=_0x14a590[_0x6c19('0x46')];this[_0x6c19('0x9')][_0x14a590['uniqueid']][_0x243ddc][_0x6c19('0x47')]=_0x14a590[_0x6c19('0x47')];this[_0x6c19('0x9')][_0x14a590[_0x6c19('0x2c')]][_0x243ddc][_0x6c19('0x48')]=_0x14a590[_0x6c19('0x48')];this[_0x6c19('0x9')][_0x14a590[_0x6c19('0x2c')]][_0x243ddc][_0x6c19('0x49')]=_0x14a590[_0x6c19('0x49')];this[_0x6c19('0x9')][_0x14a590[_0x6c19('0x2c')]][_0x243ddc][_0x6c19('0x4a')]=_0x14a590[_0x6c19('0x4a')];this[_0x6c19('0x9')][_0x14a590['uniqueid']][_0x243ddc][_0x6c19('0x4b')]=_0x6c19('0x4c');if(this['voiceChannels'][this[_0x6c19('0x9')][_0x14a590[_0x6c19('0x2c')]][_0x243ddc][_0x6c19('0x2c')]]){var _0x1fc082=this[_0x6c19('0x8')][this[_0x6c19('0x9')][_0x14a590[_0x6c19('0x2c')]][_0x243ddc][_0x6c19('0x2c')]][_0x6c19('0x4d')];this[_0x6c19('0x9')][_0x14a590[_0x6c19('0x2c')]][_0x243ddc][_0x6c19('0x4d')]=_0x1fc082;_0x14a590['routealias']=_0x1fc082;}_[_0x6c19('0x36')](this['agents'][_0x14a590['interface']],_[_0x6c19('0x4e')](_0x14a590,[_0x6c19('0x2e'),'destconnectedlinenum','routealias']));var _0x5edb75=this[_0x6c19('0xb')][_0x14a590[_0x6c19('0x4f')]['split']('-')[0x0]];var _0x15de10={'id':_0x5edb75['id'],'name':_0x5edb75['name'],'agentconnected':!![],'destaccountcode':_0x5edb75[_0x6c19('0x50')],'destconnectedlinenum':this[_0x6c19('0x9')][_0x14a590[_0x6c19('0x2c')]][_0x14a590['destuniqueid']][_0x6c19('0x51')],'queue':this['channels'][_0x14a590[_0x6c19('0x2c')]][_0x14a590[_0x6c19('0x29')]][_0x6c19('0x2e')],'routealias':this['channels'][_0x14a590[_0x6c19('0x2c')]][_0x14a590['destuniqueid']][_0x6c19('0x4d')],'uniqueid':this[_0x6c19('0x9')][_0x14a590['uniqueid']][_0x14a590[_0x6c19('0x29')]]['uniqueid']};logger[_0x6c19('0x2a')](_0x6c19('0x52'),_0x14a590[_0x6c19('0x2c')],util['inspect'](this[_0x6c19('0x9')][_0x14a590['uniqueid']][_0x14a590[_0x6c19('0x29')]],{'showHidden':![],'depth':null}));ami[_0x6c19('0x23')](_0x6c19('0x53'),this[_0x6c19('0x9')][_0x14a590[_0x6c19('0x2c')]][_0x14a590[_0x6c19('0x29')]]);logger[_0x6c19('0x2a')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x14a590[_0x6c19('0x2c')],util['inspect'](_0x15de10,{'showHidden':![],'depth':null}));this['emit'](util[_0x6c19('0x2f')](_0x6c19('0x3d'),_0x14a590[_0x6c19('0x28')]),_0x6c19('0x54'),_0x15de10);}else if(!this[_0x6c19('0x9')][_0x14a590['uniqueid']][_0x243ddc][_0x6c19('0x55')]&&!this[_0x6c19('0x9')][_0x14a590[_0x6c19('0x2c')]][_0x243ddc]['agentcomplete']){logger[_0x6c19('0x26')](_0x6c19('0x56'),_0x14a590[_0x6c19('0x2c')],this[_0x6c19('0x9')][_0x14a590['uniqueid']][_0x243ddc][_0x6c19('0x28')],_0x243ddc);this['channels'][_0x14a590[_0x6c19('0x2c')]][_0x243ddc][_0x6c19('0x55')]=!![];this[_0x6c19('0x9')][_0x14a590[_0x6c19('0x2c')]][_0x243ddc][_0x6c19('0x57')]=moment()[_0x6c19('0x2f')](_0x6c19('0x30'));this['channels'][_0x14a590[_0x6c19('0x2c')]][_0x243ddc][_0x6c19('0x58')]=_0x14a590['destuniqueid'];this[_0x6c19('0x9')][_0x14a590['uniqueid']][_0x243ddc][_0x6c19('0x59')]=_0x14a590[_0x6c19('0x28')];this[_0x6c19('0x9')][_0x14a590[_0x6c19('0x2c')]][_0x243ddc]['lastevent']='answered_elsewhere';this['channels'][_0x14a590['uniqueid']][_0x243ddc][_0x6c19('0x5a')]=_0x6c19('0x5b');logger[_0x6c19('0x2a')](_0x6c19('0x5c'),_0x14a590['uniqueid'],util['inspect'](this[_0x6c19('0x9')][_0x14a590[_0x6c19('0x2c')]][_0x243ddc],{'showHidden':![],'depth':null}));ami[_0x6c19('0x23')](_0x6c19('0x5d'),this['channels'][_0x14a590[_0x6c19('0x2c')]][_0x243ddc]);}else{logger[_0x6c19('0x2a')]('[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken',_0x14a590[_0x6c19('0x2c')]);}}}}}}catch(_0x17d417){logger['error'](_0x6c19('0x5e'),_0x14a590[_0x6c19('0x2c')],util[_0x6c19('0x2d')](_0x17d417,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6c19('0x22')][_0x6c19('0x12')]=function(_0x42cdf3){try{if(this[_0x6c19('0x24')](_0x42cdf3)){logger[_0x6c19('0x2a')](_0x6c19('0x5f'),_0x42cdf3[_0x6c19('0x2c')],util['inspect'](_0x42cdf3,{'showHidden':![],'depth':null}));if(this[_0x6c19('0x9')][_0x42cdf3[_0x6c19('0x2c')]]&&this[_0x6c19('0x9')][_0x42cdf3['uniqueid']][_0x42cdf3[_0x6c19('0x29')]]){logger[_0x6c19('0x26')](_0x6c19('0x60'),_0x42cdf3[_0x6c19('0x2c')],_0x42cdf3[_0x6c19('0x28')],_0x42cdf3[_0x6c19('0x29')]);var _0x22e16d=this[_0x6c19('0xb')][_0x42cdf3['interface']];var _0x47145c=this[_0x6c19('0x9')][_0x42cdf3['uniqueid']][_0x42cdf3[_0x6c19('0x29')]];_0x47145c[_0x6c19('0x55')]=!![];_0x47145c[_0x6c19('0x57')]=moment()[_0x6c19('0x2f')](_0x6c19('0x30'));_0x47145c['lastevent']='rejected';_0x47145c[_0x6c19('0x5a')]=_0x6c19('0x61');var _0x3c59e3={'id':_0x22e16d['id'],'name':_0x22e16d[_0x6c19('0x62')],'queue':_0x47145c[_0x6c19('0x2e')],'uniqueid':_0x47145c['uniqueid']};logger['debug'](_0x6c19('0x63'),_0x42cdf3[_0x6c19('0x2c')],util[_0x6c19('0x2d')](_0x3c59e3,{'showHidden':![],'depth':null}));this[_0x6c19('0x23')](util[_0x6c19('0x2f')](_0x6c19('0x3d'),_0x22e16d['name']),_0x6c19('0x64'),_0x3c59e3);ami[_0x6c19('0x23')](_0x6c19('0x65'),_0x47145c);}}}catch(_0x2ad596){logger[_0x6c19('0x3f')](_0x6c19('0x66'),_0x42cdf3[_0x6c19('0x2c')],util[_0x6c19('0x2d')](_0x2ad596,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6c19('0x14')]=function(_0x12f9ab){try{if(this[_0x6c19('0x24')](_0x12f9ab)){logger[_0x6c19('0x2a')](_0x6c19('0x67'),_0x12f9ab[_0x6c19('0x2c')],util[_0x6c19('0x2d')](_0x12f9ab,{'showHidden':![],'depth':null}));if(this[_0x6c19('0x9')][_0x12f9ab[_0x6c19('0x2c')]]){for(var _0x4826db in this[_0x6c19('0x9')][_0x12f9ab[_0x6c19('0x2c')]]){if(this[_0x6c19('0x9')][_0x12f9ab[_0x6c19('0x2c')]][_0x6c19('0x43')](_0x4826db)&&!this[_0x6c19('0x9')][_0x12f9ab[_0x6c19('0x2c')]][_0x4826db][_0x6c19('0x55')]&&!this[_0x6c19('0x9')][_0x12f9ab[_0x6c19('0x2c')]][_0x4826db][_0x6c19('0x15')]){logger[_0x6c19('0x26')](_0x6c19('0x68'),_0x12f9ab[_0x6c19('0x2c')],this[_0x6c19('0x9')][_0x12f9ab['uniqueid']][_0x4826db][_0x6c19('0x28')],_0x4826db);this['channels'][_0x12f9ab[_0x6c19('0x2c')]][_0x4826db][_0x6c19('0x55')]=!![];this['channels'][_0x12f9ab[_0x6c19('0x2c')]][_0x4826db][_0x6c19('0x57')]=moment()[_0x6c19('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6c19('0x9')][_0x12f9ab[_0x6c19('0x2c')]][_0x4826db][_0x6c19('0x4b')]=_0x6c19('0x69');this[_0x6c19('0x9')][_0x12f9ab[_0x6c19('0x2c')]][_0x4826db][_0x6c19('0x5a')]='abandoned';logger['debug'](_0x6c19('0x6a'),_0x12f9ab['uniqueid'],util[_0x6c19('0x2d')](this[_0x6c19('0x9')][_0x12f9ab[_0x6c19('0x2c')]][_0x4826db],{'showHidden':![],'depth':null}));ami[_0x6c19('0x23')](_0x6c19('0x6b'),this[_0x6c19('0x9')][_0x12f9ab[_0x6c19('0x2c')]][_0x4826db]);}}}}}catch(_0x580727){logger[_0x6c19('0x3f')](_0x6c19('0x6c'),_0x12f9ab[_0x6c19('0x2c')],util[_0x6c19('0x2d')](_0x580727,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6c19('0x22')][_0x6c19('0x16')]=function(_0x119354){try{if(this[_0x6c19('0x24')](_0x119354)){logger[_0x6c19('0x2a')](_0x6c19('0x6d'),_0x119354[_0x6c19('0x2c')],util['inspect'](_0x119354,{'showHidden':![],'depth':null}));if(this[_0x6c19('0x9')][_0x119354[_0x6c19('0x2c')]]){for(var _0x5ebedc in this[_0x6c19('0x9')][_0x119354[_0x6c19('0x2c')]]){if(this[_0x6c19('0x9')][_0x119354[_0x6c19('0x2c')]][_0x6c19('0x43')](_0x5ebedc)){if(this['channels'][_0x119354[_0x6c19('0x2c')]][_0x5ebedc]['agentconnectAt']&&!this[_0x6c19('0x9')][_0x119354[_0x6c19('0x2c')]][_0x5ebedc][_0x6c19('0x15')]){logger['info'](_0x6c19('0x6e'),_0x119354['uniqueid'],this['channels'][_0x119354['uniqueid']][_0x5ebedc][_0x6c19('0x28')],_0x5ebedc);this['channels'][_0x119354[_0x6c19('0x2c')]][_0x5ebedc][_0x6c19('0x15')]=!![];this[_0x6c19('0x9')][_0x119354['uniqueid']][_0x5ebedc]['agentcompleteAt']=moment()['format'](_0x6c19('0x30'));this[_0x6c19('0x9')][_0x119354[_0x6c19('0x2c')]][_0x5ebedc]['lastevent']=_0x6c19('0x6f');this[_0x6c19('0x9')][_0x119354['uniqueid']][_0x5ebedc]['reason']=_0x119354[_0x6c19('0x5a')]==_0x6c19('0x70')?'agent':_0x119354['reason'];this[_0x6c19('0x9')][_0x119354[_0x6c19('0x2c')]][_0x5ebedc][_0x6c19('0x71')]=_0x119354[_0x6c19('0x71')];if(this[_0x6c19('0xa')][_0x119354[_0x6c19('0x2e')]]&&this[_0x6c19('0xa')][_0x119354[_0x6c19('0x2e')]]['acw']){this['channels'][_0x119354['uniqueid']][_0x5ebedc][_0x6c19('0x72')]=this[_0x6c19('0xa')][_0x119354['queue']][_0x6c19('0x73')];this[_0x6c19('0x9')][_0x119354[_0x6c19('0x2c')]][_0x5ebedc]['agentacw']=!![];}this['agents'][_0x119354[_0x6c19('0x74')]]=_[_0x6c19('0x75')](this['agents'][_0x119354[_0x6c19('0x74')]],[_0x6c19('0x2e'),_0x6c19('0x76')]);logger['debug'](_0x6c19('0x77'),_0x119354[_0x6c19('0x2c')],util[_0x6c19('0x2d')](this[_0x6c19('0x9')][_0x119354[_0x6c19('0x2c')]][_0x5ebedc],{'showHidden':![],'depth':null}));ami['emit'](_0x6c19('0x78'),this[_0x6c19('0x9')][_0x119354[_0x6c19('0x2c')]][_0x5ebedc]);logger[_0x6c19('0x2a')](_0x6c19('0x79'),_0x119354['uniqueid'],util[_0x6c19('0x2d')]({'id':this['agents'][_0x119354[_0x6c19('0x74')]]['id'],'destaccountcode':_0x119354[_0x6c19('0x7a')]},{'showHidden':![],'depth':null}));this[_0x6c19('0x23')](util[_0x6c19('0x2f')](_0x6c19('0x3d'),_0x119354[_0x6c19('0x28')]),'user:agentcomplete',{'id':this['agents'][_0x119354['interface']]['id'],'destaccountcode':Number(_0x119354['destaccountcode'])});}}}}}}catch(_0x4c2241){logger[_0x6c19('0x3f')]('[%s][voiceAgentReport][agentcomplete]',_0x119354[_0x6c19('0x2c')],util[_0x6c19('0x2d')](_0x4c2241,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6c19('0x22')][_0x6c19('0x18')]=function(_0x3e1232){try{if(this[_0x6c19('0x24')](_0x3e1232)){logger[_0x6c19('0x2a')](_0x6c19('0x7b'),_0x3e1232['uniqueid'],util[_0x6c19('0x2d')](_0x3e1232,{'showHidden':![],'depth':null}));this[_0x6c19('0x7c')](_0x3e1232[_0x6c19('0x2c')],_[_0x6c19('0x7d')](_0x3e1232[_0x6c19('0x7e')])[0x0],_0x3e1232[_0x6c19('0x7f')]);if(this[_0x6c19('0x9')][_0x3e1232[_0x6c19('0x2c')]]){for(var _0x18fccd in this[_0x6c19('0x9')][_0x3e1232[_0x6c19('0x2c')]]){if(this['channels'][_0x3e1232[_0x6c19('0x2c')]][_0x6c19('0x43')](_0x18fccd)){logger[_0x6c19('0x26')](_0x6c19('0x80'),_0x3e1232['uniqueid'],_0x18fccd,_[_0x6c19('0x7d')](_0x3e1232['variable'])[0x0],_0x3e1232[_0x6c19('0x7f')]);if(_[_0x6c19('0x25')](this[_0x6c19('0x9')][_0x3e1232[_0x6c19('0x2c')]][_0x18fccd][_0x6c19('0xc')])){this[_0x6c19('0x9')][_0x3e1232[_0x6c19('0x2c')]][_0x18fccd][_0x6c19('0xc')]={};}this[_0x6c19('0x9')][_0x3e1232[_0x6c19('0x2c')]][_0x18fccd][_0x6c19('0xc')]=this[_0x6c19('0xc')][_0x3e1232[_0x6c19('0x2c')]];}}}}}catch(_0x1f191a){logger[_0x6c19('0x3f')]('[%s][voiceAgentReport][varset]',_0x3e1232[_0x6c19('0x2c')],util[_0x6c19('0x2d')](_0x1f191a,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6c19('0x7c')]=function(_0x32cbb6,_0x5ed09d,_0x36ed76){var _0x3ac9e4=[_0x6c19('0x81'),'rtpaudioqosbridged',_0x6c19('0x82'),_0x6c19('0x83'),'rtpaudioqosloss',_0x6c19('0x84'),_0x6c19('0x85'),_0x6c19('0x86'),'sipcallid',_0x6c19('0x87'),_0x6c19('0x88'),_0x6c19('0x89'),'membercalls',_0x6c19('0x8a'),'memberinterface',_0x6c19('0x8b'),_0x6c19('0x28'),_0x6c19('0x8c'),_0x6c19('0x8d')];if(!_[_0x6c19('0x8e')](_0x5ed09d)&&!_[_0x6c19('0x8f')](_0x3ac9e4,_0x5ed09d)){if(_[_0x6c19('0x25')](this[_0x6c19('0xc')][_0x32cbb6])){this[_0x6c19('0xc')][_0x32cbb6]={};}this[_0x6c19('0xc')][_0x32cbb6][_0x5ed09d]=_0x36ed76;}};VoiceAgentReport[_0x6c19('0x22')]['syncHangup']=function(_0x4ea6db){try{if(this[_0x6c19('0x24')](_0x4ea6db)){logger['debug']('[%s][voiceAgentReport][hangup]\x20event:',_0x4ea6db[_0x6c19('0x2c')],util[_0x6c19('0x2d')](_0x4ea6db,{'showHidden':![],'depth':null}));if(this['channels'][_0x4ea6db['uniqueid']]){for(var _0x1d8591 in this[_0x6c19('0x9')][_0x4ea6db[_0x6c19('0x2c')]]){if(this[_0x6c19('0x9')][_0x4ea6db[_0x6c19('0x2c')]][_0x6c19('0x43')](_0x1d8591)){if(this[_0x6c19('0x9')][_0x4ea6db[_0x6c19('0x2c')]][_0x1d8591]['reason']==_0x6c19('0x70')&&this[_0x6c19('0x9')][_0x4ea6db['uniqueid']][_0x1d8591]['agentcomplete']){logger[_0x6c19('0x26')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4ea6db[_0x6c19('0x2c')],_0x1d8591);this[_0x6c19('0x9')][_0x4ea6db[_0x6c19('0x2c')]][_0x1d8591][_0x6c19('0x90')]=moment()[_0x6c19('0x2f')](_0x6c19('0x30'));}}}logger[_0x6c19('0x2a')](_0x6c19('0x91'),_0x4ea6db['uniqueid'],util[_0x6c19('0x2d')](_[_0x6c19('0x92')](this[_0x6c19('0x9')][_0x4ea6db['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x6c19('0x23')](_0x6c19('0x93'),_['values'](this[_0x6c19('0x9')][_0x4ea6db[_0x6c19('0x2c')]]));delete this[_0x6c19('0x9')][_0x4ea6db[_0x6c19('0x2c')]];}if(this[_0x6c19('0xc')][_0x4ea6db[_0x6c19('0x2c')]]){delete this[_0x6c19('0xc')][_0x4ea6db['uniqueid']];}}}catch(_0x257e65){logger[_0x6c19('0x3f')]('[%s][voiceAgentReport][hangup]',_0x4ea6db[_0x6c19('0x2c')],util[_0x6c19('0x2d')](_0x257e65,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6c19('0x22')][_0x6c19('0x1f')]=function(_0x5f1ae2){try{if(this[_0x6c19('0x24')](_0x5f1ae2)){logger['debug'](_0x6c19('0x94'),_0x5f1ae2[_0x6c19('0x2c')],util[_0x6c19('0x2d')](_0x5f1ae2,{'showHidden':![],'depth':null}));if(this['channels'][_0x5f1ae2['transfereeuniqueid']]){for(var _0x2e926a in this[_0x6c19('0x9')][_0x5f1ae2['transfereeuniqueid']]){if(this['channels'][_0x5f1ae2[_0x6c19('0x95')]]['hasOwnProperty'](_0x2e926a)){if(_0x5f1ae2[_0x6c19('0x96')]===_0x2e926a){logger[_0x6c19('0x26')](_0x6c19('0x97'),_0x5f1ae2['uniqueid'],this['channels'][_0x5f1ae2[_0x6c19('0x95')]][_0x2e926a][_0x6c19('0x28')],_0x2e926a);var _0x1e845e=moment();this[_0x6c19('0x9')][_0x5f1ae2[_0x6c19('0x95')]][_0x2e926a]['agentcomplete']=!![];this[_0x6c19('0x9')][_0x5f1ae2[_0x6c19('0x95')]][_0x2e926a][_0x6c19('0x90')]=moment()[_0x6c19('0x2f')](_0x6c19('0x30'));this['channels'][_0x5f1ae2[_0x6c19('0x95')]][_0x2e926a][_0x6c19('0x4b')]=_0x6c19('0x6f');this[_0x6c19('0x9')][_0x5f1ae2[_0x6c19('0x95')]][_0x2e926a]['reason']=_0x6c19('0x70');this[_0x6c19('0x9')][_0x5f1ae2['transfereeuniqueid']][_0x2e926a][_0x6c19('0x71')]=_0x1e845e[_0x6c19('0x98')](this['channels'][_0x5f1ae2[_0x6c19('0x95')]][_0x2e926a][_0x6c19('0x99')],_0x6c19('0x9a'));}}}}if(this['channels'][_0x5f1ae2['secondtransfereruniqueid']]){var _0x421c95=this[_0x6c19('0x9')][_0x5f1ae2[_0x6c19('0x9b')]];this['channels'][_0x5f1ae2[_0x6c19('0x9b')]]=this[_0x6c19('0x9')][_0x5f1ae2['transfereeuniqueid']];this[_0x6c19('0x9')][_0x5f1ae2[_0x6c19('0x95')]]=_0x421c95;}}}catch(_0x5c599c){logger[_0x6c19('0x3f')](_0x6c19('0x9c'),_0x5f1ae2[_0x6c19('0x2c')],util[_0x6c19('0x2d')](_0x5c599c,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6c19('0x21')]=function(_0x4acb56){try{if(this[_0x6c19('0x24')](_0x4acb56)){logger[_0x6c19('0x2a')](_0x6c19('0x9d'),_0x4acb56[_0x6c19('0x2c')],util[_0x6c19('0x2d')](_0x4acb56,{'showHidden':![],'depth':null}));if(this[_0x6c19('0x9')][_0x4acb56[_0x6c19('0x95')]]){for(var _0x2e4e22 in this[_0x6c19('0x9')][_0x4acb56['transfereeuniqueid']]){if(this[_0x6c19('0x9')][_0x4acb56[_0x6c19('0x95')]][_0x6c19('0x43')](_0x2e4e22)){if(_0x4acb56[_0x6c19('0x9e')]===_0x2e4e22){logger[_0x6c19('0x26')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x4acb56[_0x6c19('0x2c')],this['channels'][_0x4acb56[_0x6c19('0x95')]][_0x2e4e22][_0x6c19('0x28')],_0x2e4e22);var _0x3beb93=moment();this[_0x6c19('0x9')][_0x4acb56[_0x6c19('0x95')]][_0x2e4e22][_0x6c19('0x15')]=!![];this[_0x6c19('0x9')][_0x4acb56[_0x6c19('0x95')]][_0x2e4e22][_0x6c19('0x90')]=_0x3beb93;this[_0x6c19('0x9')][_0x4acb56[_0x6c19('0x95')]][_0x2e4e22][_0x6c19('0x4b')]=_0x6c19('0x6f');this[_0x6c19('0x9')][_0x4acb56[_0x6c19('0x95')]][_0x2e4e22][_0x6c19('0x5a')]=_0x6c19('0x70');this[_0x6c19('0x9')][_0x4acb56['transfereeuniqueid']][_0x2e4e22]['talktime']=_0x3beb93[_0x6c19('0x98')](this[_0x6c19('0x9')][_0x4acb56[_0x6c19('0x95')]][_0x2e4e22][_0x6c19('0x99')],_0x6c19('0x9a'));}}}}}}catch(_0x2abe60){logger[_0x6c19('0x3f')](_0x6c19('0x9f'),_0x4acb56[_0x6c19('0x2c')],util[_0x6c19('0x2d')](_0x2abe60,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6c19('0x22')]['syncMusicOnHoldStart']=function(_0x591aff){var _0x58f4ac='';try{if(this[_0x6c19('0x24')](_0x591aff)){logger[_0x6c19('0x2a')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x591aff[_0x6c19('0x2c')],util[_0x6c19('0x2d')](_0x591aff,{'showHidden':![],'depth':null}));if(_0x591aff[_0x6c19('0x4f')]){_0x58f4ac=_0x591aff[_0x6c19('0x4f')][_0x6c19('0xa0')](0x0,_0x591aff[_0x6c19('0x4f')][_0x6c19('0xa1')]('-'));if(this[_0x6c19('0xb')][_0x58f4ac]){logger[_0x6c19('0x26')](_0x6c19('0xa2'),_0x591aff['uniqueid'],_0x58f4ac);this['agents'][_0x58f4ac][_0x6c19('0xa3')]=!![];}}}}catch(_0x45ef4f){logger['error'](_0x6c19('0xa4'),_0x591aff[_0x6c19('0x2c')],util['inspect'](_0x45ef4f,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStop']=function(_0x5e95df){var _0x33b9bc='';try{if(this['isNotNull'](_0x5e95df)){logger[_0x6c19('0x2a')](_0x6c19('0xa5'),_0x5e95df['uniqueid'],util[_0x6c19('0x2d')](_0x5e95df,{'showHidden':![],'depth':null}));if(_0x5e95df[_0x6c19('0x4f')]){_0x33b9bc=_0x5e95df[_0x6c19('0x4f')][_0x6c19('0xa0')](0x0,_0x5e95df['channel']['lastIndexOf']('-'));if(this['agents'][_0x33b9bc]){logger['info'](_0x6c19('0xa6'),_0x5e95df[_0x6c19('0x2c')],_0x33b9bc);this[_0x6c19('0xb')][_0x33b9bc]['onhold']=![];}}}}catch(_0x3c183e){logger[_0x6c19('0x3f')]('[%s][voiceAgentReport][musiconholdstop]',_0x5e95df[_0x6c19('0x2c')],util[_0x6c19('0x2d')](_0x3c183e,{'showHidden':![],'depth':null}));}};module[_0x6c19('0xa7')]=VoiceAgentReport; \ No newline at end of file +var _0xb69d=['[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','ioredis','../../../config/environment','ami','redis','defaults','localhost','channels','voiceQueues','agents','agentcalled','syncAgentCalled','bind','syncAgentConnect','syncQueueCallerAbandon','agentcomplete','hangup','musiconholdstart','syncMusicOnHoldStart','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','interface','queue','variables','format','YYYY-MM-DD\x20HH:mm:ss','called','type','inbound','voice','omit','event','privilege','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentconnect]\x20CHANNEL\x20','[%s][voiceAgentReport][agentconnect]\x20has\x20property!\x20%s,\x20%s\x20ARE\x20EQUAL?','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','voiceChannels','routealias','merge','destconnectedlinenum','channel','split','name','accountcode','exten','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','reason','user:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','agentconnectAt','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','destaccountcode','[%s][voiceAgentReport][agentcomplete]','syncVarSet','keys','variable','value','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','isNil','syncHangup','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][musiconholdstart]\x20event:','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold'];(function(_0x2bb452,_0x2dbbc0){var _0x5f50a6=function(_0x4f66ce){while(--_0x4f66ce){_0x2bb452['push'](_0x2bb452['shift']());}};_0x5f50a6(++_0x2dbbc0);}(_0xb69d,0x13e));var _0xdb69=function(_0x55d8d0,_0x9334a){_0x55d8d0=_0x55d8d0-0x0;var _0x39a348=_0xb69d[_0x55d8d0];return _0x39a348;};'use strict';var _=require(_0xdb69('0x0'));var moment=require(_0xdb69('0x1'));var util=require('util');var Redis=require(_0xdb69('0x2'));var config=require(_0xdb69('0x3'));var logger=require('../../../config/logger')(_0xdb69('0x4'));var ami=require('../ami');config[_0xdb69('0x5')]=_[_0xdb69('0x6')](config[_0xdb69('0x5')],{'host':_0xdb69('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceAgentReport(_0x47aedd){this['channels']={};this['voiceChannels']=_0x47aedd[_0xdb69('0x8')];this[_0xdb69('0x9')]=_0x47aedd[_0xdb69('0x9')];this[_0xdb69('0xa')]=_0x47aedd[_0xdb69('0xa')];this['variables']={};ami['on'](_0xdb69('0xb'),this[_0xdb69('0xc')][_0xdb69('0xd')](this));ami['on']('agentconnect',this[_0xdb69('0xe')][_0xdb69('0xd')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer']['bind'](this));ami['on']('queuecallerabandon',this[_0xdb69('0xf')]['bind'](this));ami['on'](_0xdb69('0x10'),this['syncAgentComplete']['bind'](this));ami['on']('varset',this['syncVarSet'][_0xdb69('0xd')](this));ami['on'](_0xdb69('0x11'),this['syncHangup'][_0xdb69('0xd')](this));ami['on'](_0xdb69('0x12'),this[_0xdb69('0x13')][_0xdb69('0xd')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop']['bind'](this));ami['on'](_0xdb69('0x14'),this[_0xdb69('0x15')][_0xdb69('0xd')](this));ami['on'](_0xdb69('0x16'),this[_0xdb69('0x17')][_0xdb69('0xd')](this));}VoiceAgentReport[_0xdb69('0x18')][_0xdb69('0x19')]=function(_0x4e5a2f,_0xdb91f7,_0x4cb694){io['to'](_0x4e5a2f)['emit'](_0xdb91f7,_0x4cb694);};VoiceAgentReport[_0xdb69('0x18')][_0xdb69('0x1a')]=function(_0x5ec83d){return _0x5ec83d!==null&&!_[_0xdb69('0x1b')](_0x5ec83d);};VoiceAgentReport[_0xdb69('0x18')][_0xdb69('0xc')]=function(_0x4999d9){try{if(this[_0xdb69('0x1a')](_0x4999d9)){logger[_0xdb69('0x1c')](_0xdb69('0x1d'),_0x4999d9[_0xdb69('0x1e')],_0x4999d9[_0xdb69('0x1f')],_0x4999d9[_0xdb69('0x20')]);logger['debug'](_0xdb69('0x21'),_0x4999d9[_0xdb69('0x1e')],util[_0xdb69('0x22')](_0x4999d9,{'showHidden':![],'depth':null}));if(_[_0xdb69('0x1b')](this[_0xdb69('0x8')][_0x4999d9[_0xdb69('0x1e')]])){this[_0xdb69('0x8')][_0x4999d9['uniqueid']]={};}var _0x197edc=this['agents'][_0x4999d9[_0xdb69('0x23')]];var _0x164dee=this[_0xdb69('0x8')][_0x4999d9[_0xdb69('0x1e')]][_0x4999d9[_0xdb69('0x20')]];var _0x518282=this[_0xdb69('0x9')][_0x4999d9[_0xdb69('0x24')]];var _0x3f23af=this[_0xdb69('0x25')][_0x4999d9[_0xdb69('0x1e')]];if(_[_0xdb69('0x1b')](_0x164dee)){_0x164dee={'agentcalledAt':moment()[_0xdb69('0x26')](_0xdb69('0x27')),'lastevent':_0xdb69('0x28'),'mandatoryDisposition':_0x518282&&_0x518282['mandatoryDisposition']?_0x518282['mandatoryDisposition']:![],'type':_0x518282&&_0x518282[_0xdb69('0x29')]?_0x518282[_0xdb69('0x29')]:_0xdb69('0x2a'),'variables':_0x3f23af,'motionChannel':_0xdb69('0x2b')};}_['merge'](_0x164dee,_[_0xdb69('0x2c')](_0x4999d9,[_0xdb69('0x2d'),_0xdb69('0x2e')]));this[_0xdb69('0x8')][_0x4999d9[_0xdb69('0x1e')]][_0x4999d9[_0xdb69('0x20')]]=_0x164dee;logger[_0xdb69('0x2f')](_0xdb69('0x30'),_0x4999d9[_0xdb69('0x1e')],util[_0xdb69('0x22')](_0x164dee,{'showHidden':![],'depth':null}));ami['emit'](_0xdb69('0x31'),_0x164dee);var _0x473834={'id':_0x197edc['id'],'calleridnum':_0x164dee['calleridnum'],'queue':_0x164dee[_0xdb69('0x24')],'variables':_0x164dee[_0xdb69('0x25')],'uniqueid':_0x4999d9[_0xdb69('0x1e')]};logger[_0xdb69('0x2f')](_0xdb69('0x32'),_0x4999d9[_0xdb69('0x1e')],util[_0xdb69('0x22')](_0x473834,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xdb69('0x33'),_0x4999d9[_0xdb69('0x1f')]),_0xdb69('0x34'),_0x473834);}}catch(_0x5a8e19){logger[_0xdb69('0x35')]('[%s][voiceAgentReport][agentcalled]',_0x4999d9[_0xdb69('0x1e')],util[_0xdb69('0x22')](_0x5a8e19,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdb69('0x18')][_0xdb69('0xe')]=function(_0x5615d9){try{if(this[_0xdb69('0x1a')](_0x5615d9)){if(this[_0xdb69('0x8')][_0x5615d9[_0xdb69('0x1e')]]){logger[_0xdb69('0x2f')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x5615d9[_0xdb69('0x1e')],util[_0xdb69('0x22')](_0x5615d9,{'showHidden':![],'depth':null}));logger['debug'](_0xdb69('0x36'),_0x5615d9['uniqueid'],util[_0xdb69('0x22')](this[_0xdb69('0x8')][_0x5615d9[_0xdb69('0x1e')]],{'showHidden':![],'depth':null}));for(var _0x7f7fc7 in this[_0xdb69('0x8')][_0x5615d9['uniqueid']]){if(this[_0xdb69('0x8')][_0x5615d9[_0xdb69('0x1e')]]['hasOwnProperty'](_0x7f7fc7)){logger[_0xdb69('0x2f')](_0xdb69('0x37'),_0x5615d9[_0xdb69('0x1e')],_0x5615d9[_0xdb69('0x20')],_0x7f7fc7,_0x5615d9[_0xdb69('0x20')]===_0x7f7fc7);if(_0x5615d9[_0xdb69('0x20')]===_0x7f7fc7){logger[_0xdb69('0x1c')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x5615d9[_0xdb69('0x1e')],_0x5615d9[_0xdb69('0x1f')],_0x5615d9[_0xdb69('0x20')]);this['channels'][_0x5615d9[_0xdb69('0x1e')]][_0x7f7fc7]['agentconnectAt']=moment()[_0xdb69('0x26')](_0xdb69('0x27'));this['channels'][_0x5615d9[_0xdb69('0x1e')]][_0x7f7fc7][_0xdb69('0x38')]=_0x5615d9[_0xdb69('0x38')];this[_0xdb69('0x8')][_0x5615d9[_0xdb69('0x1e')]][_0x7f7fc7][_0xdb69('0x39')]=_0x5615d9[_0xdb69('0x39')];this['channels'][_0x5615d9[_0xdb69('0x1e')]][_0x7f7fc7]['destchannelstate']=_0x5615d9[_0xdb69('0x3a')];this['channels'][_0x5615d9[_0xdb69('0x1e')]][_0x7f7fc7][_0xdb69('0x3b')]=_0x5615d9[_0xdb69('0x3b')];this[_0xdb69('0x8')][_0x5615d9['uniqueid']][_0x7f7fc7][_0xdb69('0x3c')]=_0x5615d9[_0xdb69('0x3c')];this[_0xdb69('0x8')][_0x5615d9['uniqueid']][_0x7f7fc7][_0xdb69('0x3d')]=_0xdb69('0x3e');if(this[_0xdb69('0x3f')][this[_0xdb69('0x8')][_0x5615d9[_0xdb69('0x1e')]][_0x7f7fc7][_0xdb69('0x1e')]]){var _0x51ca9a=this['voiceChannels'][this['channels'][_0x5615d9[_0xdb69('0x1e')]][_0x7f7fc7][_0xdb69('0x1e')]][_0xdb69('0x40')];this[_0xdb69('0x8')][_0x5615d9[_0xdb69('0x1e')]][_0x7f7fc7][_0xdb69('0x40')]=_0x51ca9a;_0x5615d9[_0xdb69('0x40')]=_0x51ca9a;}_[_0xdb69('0x41')](this[_0xdb69('0xa')][_0x5615d9[_0xdb69('0x23')]],_['pick'](_0x5615d9,[_0xdb69('0x24'),_0xdb69('0x42'),_0xdb69('0x40')]));var _0x1ad8ae=this[_0xdb69('0xa')][_0x5615d9[_0xdb69('0x43')][_0xdb69('0x44')]('-')[0x0]];var _0x585a73={'id':_0x1ad8ae['id'],'name':_0x1ad8ae[_0xdb69('0x45')],'agentconnected':!![],'destaccountcode':_0x1ad8ae[_0xdb69('0x46')],'destconnectedlinenum':this['channels'][_0x5615d9['uniqueid']][_0x5615d9[_0xdb69('0x20')]][_0xdb69('0x47')],'queue':this[_0xdb69('0x8')][_0x5615d9[_0xdb69('0x1e')]][_0x5615d9[_0xdb69('0x20')]]['queue'],'routealias':this['channels'][_0x5615d9[_0xdb69('0x1e')]][_0x5615d9['destuniqueid']][_0xdb69('0x40')],'uniqueid':this[_0xdb69('0x8')][_0x5615d9[_0xdb69('0x1e')]][_0x5615d9[_0xdb69('0x20')]][_0xdb69('0x1e')]};logger['debug']('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x5615d9[_0xdb69('0x1e')],util[_0xdb69('0x22')](this[_0xdb69('0x8')][_0x5615d9['uniqueid']][_0x5615d9['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xdb69('0x19')](_0xdb69('0x48'),this['channels'][_0x5615d9[_0xdb69('0x1e')]][_0x5615d9[_0xdb69('0x20')]]);logger[_0xdb69('0x2f')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x5615d9[_0xdb69('0x1e')],util['inspect'](_0x585a73,{'showHidden':![],'depth':null}));this[_0xdb69('0x19')](util[_0xdb69('0x26')](_0xdb69('0x33'),_0x5615d9['membername']),_0xdb69('0x49'),_0x585a73);}else if(!this[_0xdb69('0x8')][_0x5615d9['uniqueid']][_0x7f7fc7][_0xdb69('0x4a')]&&!this['channels'][_0x5615d9[_0xdb69('0x1e')]][_0x7f7fc7][_0xdb69('0x10')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x5615d9['uniqueid'],this[_0xdb69('0x8')][_0x5615d9[_0xdb69('0x1e')]][_0x7f7fc7][_0xdb69('0x1f')],_0x7f7fc7);this[_0xdb69('0x8')][_0x5615d9[_0xdb69('0x1e')]][_0x7f7fc7]['agentringnoanswer']=!![];this[_0xdb69('0x8')][_0x5615d9['uniqueid']][_0x7f7fc7][_0xdb69('0x4b')]=moment()['format'](_0xdb69('0x27'));this[_0xdb69('0x8')][_0x5615d9[_0xdb69('0x1e')]][_0x7f7fc7][_0xdb69('0x4c')]=_0x5615d9[_0xdb69('0x20')];this[_0xdb69('0x8')][_0x5615d9['uniqueid']][_0x7f7fc7]['answeredelsewheremembername']=_0x5615d9[_0xdb69('0x1f')];this['channels'][_0x5615d9[_0xdb69('0x1e')]][_0x7f7fc7]['lastevent']=_0xdb69('0x4d');this[_0xdb69('0x8')][_0x5615d9['uniqueid']][_0x7f7fc7]['reason']=_0xdb69('0x4d');logger[_0xdb69('0x2f')](_0xdb69('0x4e'),_0x5615d9[_0xdb69('0x1e')],util['inspect'](this[_0xdb69('0x8')][_0x5615d9[_0xdb69('0x1e')]][_0x7f7fc7],{'showHidden':![],'depth':null}));ami[_0xdb69('0x19')](_0xdb69('0x4f'),this[_0xdb69('0x8')][_0x5615d9[_0xdb69('0x1e')]][_0x7f7fc7]);}else{logger[_0xdb69('0x2f')](_0xdb69('0x50'),_0x5615d9[_0xdb69('0x1e')]);}}}}}}catch(_0xa9fbe2){logger['error'](_0xdb69('0x51'),_0x5615d9[_0xdb69('0x1e')],util[_0xdb69('0x22')](_0xa9fbe2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdb69('0x18')]['syncAgentRingNoAnswer']=function(_0x520252){try{if(this['isNotNull'](_0x520252)){logger[_0xdb69('0x2f')](_0xdb69('0x52'),_0x520252[_0xdb69('0x1e')],util[_0xdb69('0x22')](_0x520252,{'showHidden':![],'depth':null}));if(this[_0xdb69('0x8')][_0x520252[_0xdb69('0x1e')]]&&this[_0xdb69('0x8')][_0x520252[_0xdb69('0x1e')]][_0x520252[_0xdb69('0x20')]]){logger[_0xdb69('0x1c')](_0xdb69('0x53'),_0x520252[_0xdb69('0x1e')],_0x520252[_0xdb69('0x1f')],_0x520252[_0xdb69('0x20')]);var _0x45e594=this[_0xdb69('0xa')][_0x520252[_0xdb69('0x23')]];var _0x297d02=this[_0xdb69('0x8')][_0x520252[_0xdb69('0x1e')]][_0x520252[_0xdb69('0x20')]];_0x297d02['agentringnoanswer']=!![];_0x297d02[_0xdb69('0x4b')]=moment()[_0xdb69('0x26')](_0xdb69('0x27'));_0x297d02['lastevent']=_0xdb69('0x54');_0x297d02[_0xdb69('0x55')]=_0xdb69('0x54');var _0x15f70d={'id':_0x45e594['id'],'name':_0x45e594[_0xdb69('0x45')],'queue':_0x297d02[_0xdb69('0x24')],'uniqueid':_0x297d02[_0xdb69('0x1e')]};logger[_0xdb69('0x2f')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x520252['uniqueid'],util[_0xdb69('0x22')](_0x15f70d,{'showHidden':![],'depth':null}));this[_0xdb69('0x19')](util['format'](_0xdb69('0x33'),_0x45e594['name']),_0xdb69('0x56'),_0x15f70d);ami['emit']('custom:agentringnoanswer',_0x297d02);}}}catch(_0x41b703){logger[_0xdb69('0x35')](_0xdb69('0x57'),_0x520252[_0xdb69('0x1e')],util[_0xdb69('0x22')](_0x41b703,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdb69('0x18')][_0xdb69('0xf')]=function(_0x15b0d7){try{if(this['isNotNull'](_0x15b0d7)){logger[_0xdb69('0x2f')](_0xdb69('0x58'),_0x15b0d7[_0xdb69('0x1e')],util['inspect'](_0x15b0d7,{'showHidden':![],'depth':null}));if(this['channels'][_0x15b0d7[_0xdb69('0x1e')]]){for(var _0x2f3c2d in this[_0xdb69('0x8')][_0x15b0d7[_0xdb69('0x1e')]]){if(this[_0xdb69('0x8')][_0x15b0d7[_0xdb69('0x1e')]][_0xdb69('0x59')](_0x2f3c2d)&&!this['channels'][_0x15b0d7[_0xdb69('0x1e')]][_0x2f3c2d][_0xdb69('0x4a')]&&!this['channels'][_0x15b0d7['uniqueid']][_0x2f3c2d][_0xdb69('0x10')]){logger[_0xdb69('0x1c')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x15b0d7[_0xdb69('0x1e')],this['channels'][_0x15b0d7[_0xdb69('0x1e')]][_0x2f3c2d]['membername'],_0x2f3c2d);this[_0xdb69('0x8')][_0x15b0d7[_0xdb69('0x1e')]][_0x2f3c2d][_0xdb69('0x4a')]=!![];this[_0xdb69('0x8')][_0x15b0d7[_0xdb69('0x1e')]][_0x2f3c2d][_0xdb69('0x4b')]=moment()[_0xdb69('0x26')](_0xdb69('0x27'));this[_0xdb69('0x8')][_0x15b0d7[_0xdb69('0x1e')]][_0x2f3c2d][_0xdb69('0x3d')]=_0xdb69('0x5a');this['channels'][_0x15b0d7[_0xdb69('0x1e')]][_0x2f3c2d][_0xdb69('0x55')]=_0xdb69('0x5a');logger[_0xdb69('0x2f')](_0xdb69('0x5b'),_0x15b0d7[_0xdb69('0x1e')],util[_0xdb69('0x22')](this[_0xdb69('0x8')][_0x15b0d7['uniqueid']][_0x2f3c2d],{'showHidden':![],'depth':null}));ami[_0xdb69('0x19')](_0xdb69('0x5c'),this['channels'][_0x15b0d7[_0xdb69('0x1e')]][_0x2f3c2d]);}}}}}catch(_0x3e5ece){logger[_0xdb69('0x35')](_0xdb69('0x5d'),_0x15b0d7[_0xdb69('0x1e')],util[_0xdb69('0x22')](_0x3e5ece,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdb69('0x18')][_0xdb69('0x5e')]=function(_0x205b39){try{if(this['isNotNull'](_0x205b39)){logger[_0xdb69('0x2f')](_0xdb69('0x5f'),_0x205b39[_0xdb69('0x1e')],util['inspect'](_0x205b39,{'showHidden':![],'depth':null}));if(this['channels'][_0x205b39[_0xdb69('0x1e')]]){for(var _0x353c2c in this[_0xdb69('0x8')][_0x205b39[_0xdb69('0x1e')]]){if(this['channels'][_0x205b39[_0xdb69('0x1e')]][_0xdb69('0x59')](_0x353c2c)){if(this[_0xdb69('0x8')][_0x205b39[_0xdb69('0x1e')]][_0x353c2c][_0xdb69('0x60')]&&!this[_0xdb69('0x8')][_0x205b39[_0xdb69('0x1e')]][_0x353c2c][_0xdb69('0x10')]){logger[_0xdb69('0x1c')](_0xdb69('0x61'),_0x205b39['uniqueid'],this[_0xdb69('0x8')][_0x205b39[_0xdb69('0x1e')]][_0x353c2c][_0xdb69('0x1f')],_0x353c2c);this[_0xdb69('0x8')][_0x205b39['uniqueid']][_0x353c2c][_0xdb69('0x10')]=!![];this[_0xdb69('0x8')][_0x205b39[_0xdb69('0x1e')]][_0x353c2c][_0xdb69('0x62')]=moment()[_0xdb69('0x26')](_0xdb69('0x27'));this[_0xdb69('0x8')][_0x205b39[_0xdb69('0x1e')]][_0x353c2c][_0xdb69('0x3d')]=_0xdb69('0x63');this[_0xdb69('0x8')][_0x205b39[_0xdb69('0x1e')]][_0x353c2c][_0xdb69('0x55')]=_0x205b39[_0xdb69('0x55')]==_0xdb69('0x64')?_0xdb69('0x65'):_0x205b39[_0xdb69('0x55')];this['channels'][_0x205b39['uniqueid']][_0x353c2c][_0xdb69('0x66')]=_0x205b39[_0xdb69('0x66')];if(this[_0xdb69('0x9')][_0x205b39[_0xdb69('0x24')]]&&this[_0xdb69('0x9')][_0x205b39['queue']][_0xdb69('0x67')]){this[_0xdb69('0x8')][_0x205b39['uniqueid']][_0x353c2c][_0xdb69('0x68')]=this['voiceQueues'][_0x205b39[_0xdb69('0x24')]][_0xdb69('0x69')];this[_0xdb69('0x8')][_0x205b39[_0xdb69('0x1e')]][_0x353c2c]['agentacw']=!![];}this[_0xdb69('0xa')][_0x205b39[_0xdb69('0x23')]]=_[_0xdb69('0x2c')](this[_0xdb69('0xa')][_0x205b39[_0xdb69('0x23')]],[_0xdb69('0x24'),_0xdb69('0x42')]);logger[_0xdb69('0x2f')](_0xdb69('0x6a'),_0x205b39['uniqueid'],util['inspect'](this[_0xdb69('0x8')][_0x205b39[_0xdb69('0x1e')]][_0x353c2c],{'showHidden':![],'depth':null}));ami[_0xdb69('0x19')](_0xdb69('0x6b'),this[_0xdb69('0x8')][_0x205b39[_0xdb69('0x1e')]][_0x353c2c]);logger[_0xdb69('0x2f')](_0xdb69('0x6c'),_0x205b39[_0xdb69('0x1e')],util[_0xdb69('0x22')]({'id':this[_0xdb69('0xa')][_0x205b39[_0xdb69('0x23')]]['id'],'destaccountcode':_0x205b39['destaccountcode']},{'showHidden':![],'depth':null}));this[_0xdb69('0x19')](util['format'](_0xdb69('0x33'),_0x205b39[_0xdb69('0x1f')]),_0xdb69('0x6d'),{'id':this[_0xdb69('0xa')][_0x205b39['interface']]['id'],'destaccountcode':Number(_0x205b39[_0xdb69('0x6e')])});}}}}}}catch(_0x190055){logger[_0xdb69('0x35')](_0xdb69('0x6f'),_0x205b39[_0xdb69('0x1e')],util['inspect'](_0x190055,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdb69('0x18')][_0xdb69('0x70')]=function(_0x484680){try{if(this[_0xdb69('0x1a')](_0x484680)){logger[_0xdb69('0x2f')]('[%s][voiceAgentReport][varset]\x20event:',_0x484680[_0xdb69('0x1e')],util['inspect'](_0x484680,{'showHidden':![],'depth':null}));this['addVariable'](_0x484680[_0xdb69('0x1e')],_[_0xdb69('0x71')](_0x484680[_0xdb69('0x72')])[0x0],_0x484680[_0xdb69('0x73')]);if(this['channels'][_0x484680[_0xdb69('0x1e')]]){for(var _0x34f73d in this['channels'][_0x484680[_0xdb69('0x1e')]]){if(this['channels'][_0x484680[_0xdb69('0x1e')]][_0xdb69('0x59')](_0x34f73d)){logger[_0xdb69('0x1c')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x484680[_0xdb69('0x1e')],_0x34f73d,_[_0xdb69('0x71')](_0x484680['variable'])[0x0],_0x484680[_0xdb69('0x73')]);if(_[_0xdb69('0x1b')](this['channels'][_0x484680[_0xdb69('0x1e')]][_0x34f73d]['variables'])){this[_0xdb69('0x8')][_0x484680[_0xdb69('0x1e')]][_0x34f73d]['variables']={};}this[_0xdb69('0x8')][_0x484680[_0xdb69('0x1e')]][_0x34f73d][_0xdb69('0x25')]=this[_0xdb69('0x25')][_0x484680[_0xdb69('0x1e')]];}}}}}catch(_0x3738c5){logger[_0xdb69('0x35')](_0xdb69('0x74'),_0x484680['uniqueid'],util['inspect'](_0x3738c5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdb69('0x18')][_0xdb69('0x75')]=function(_0x219eb4,_0x201f23,_0x317c13){var _0x449ff1=[_0xdb69('0x76'),_0xdb69('0x77'),_0xdb69('0x78'),'rtpaudioqosjitterbridged',_0xdb69('0x79'),'rtpaudioqoslossbridged',_0xdb69('0x7a'),'rtpaudioqosrttbridged',_0xdb69('0x7b'),'sipuri',_0xdb69('0x7c'),_0xdb69('0x7d'),_0xdb69('0x7e'),_0xdb69('0x7f'),_0xdb69('0x80'),_0xdb69('0x81'),_0xdb69('0x1f'),'memberpenalty','memberrealtime'];if(!_[_0xdb69('0x82')](_0x201f23)&&!_['includes'](_0x449ff1,_0x201f23)){if(_[_0xdb69('0x1b')](this[_0xdb69('0x25')][_0x219eb4])){this[_0xdb69('0x25')][_0x219eb4]={};}this['variables'][_0x219eb4][_0x201f23]=_0x317c13;}};VoiceAgentReport[_0xdb69('0x18')][_0xdb69('0x83')]=function(_0x5a3a0e){try{if(this[_0xdb69('0x1a')](_0x5a3a0e)){logger[_0xdb69('0x2f')]('[%s][voiceAgentReport][hangup]\x20event:',_0x5a3a0e[_0xdb69('0x1e')],util[_0xdb69('0x22')](_0x5a3a0e,{'showHidden':![],'depth':null}));if(this['channels'][_0x5a3a0e[_0xdb69('0x1e')]]){for(var _0x29515e in this[_0xdb69('0x8')][_0x5a3a0e['uniqueid']]){if(this[_0xdb69('0x8')][_0x5a3a0e['uniqueid']][_0xdb69('0x59')](_0x29515e)){if(this['channels'][_0x5a3a0e[_0xdb69('0x1e')]][_0x29515e][_0xdb69('0x55')]==_0xdb69('0x64')&&this[_0xdb69('0x8')][_0x5a3a0e[_0xdb69('0x1e')]][_0x29515e]['agentcomplete']){logger[_0xdb69('0x1c')](_0xdb69('0x84'),_0x5a3a0e['uniqueid'],_0x29515e);this[_0xdb69('0x8')][_0x5a3a0e['uniqueid']][_0x29515e][_0xdb69('0x62')]=moment()[_0xdb69('0x26')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0xdb69('0x2f')](_0xdb69('0x85'),_0x5a3a0e[_0xdb69('0x1e')],util[_0xdb69('0x22')](_[_0xdb69('0x86')](this['channels'][_0x5a3a0e[_0xdb69('0x1e')]]),{'showHidden':![],'depth':null}));ami[_0xdb69('0x19')](_0xdb69('0x87'),_[_0xdb69('0x86')](this[_0xdb69('0x8')][_0x5a3a0e[_0xdb69('0x1e')]]));delete this[_0xdb69('0x8')][_0x5a3a0e[_0xdb69('0x1e')]];}if(this[_0xdb69('0x25')][_0x5a3a0e[_0xdb69('0x1e')]]){delete this['variables'][_0x5a3a0e[_0xdb69('0x1e')]];}}}catch(_0x592bd9){logger[_0xdb69('0x35')](_0xdb69('0x88'),_0x5a3a0e['uniqueid'],util[_0xdb69('0x22')](_0x592bd9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdb69('0x18')][_0xdb69('0x15')]=function(_0x1fb1b1){try{if(this['isNotNull'](_0x1fb1b1)){logger[_0xdb69('0x2f')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x1fb1b1[_0xdb69('0x1e')],util[_0xdb69('0x22')](_0x1fb1b1,{'showHidden':![],'depth':null}));if(this[_0xdb69('0x8')][_0x1fb1b1['transfereeuniqueid']]){for(var _0x40806e in this[_0xdb69('0x8')][_0x1fb1b1[_0xdb69('0x89')]]){if(this[_0xdb69('0x8')][_0x1fb1b1['transfereeuniqueid']][_0xdb69('0x59')](_0x40806e)){if(_0x1fb1b1[_0xdb69('0x8a')]===_0x40806e){logger[_0xdb69('0x1c')](_0xdb69('0x8b'),_0x1fb1b1['uniqueid'],this[_0xdb69('0x8')][_0x1fb1b1[_0xdb69('0x89')]][_0x40806e]['membername'],_0x40806e);var _0x184155=moment();this['channels'][_0x1fb1b1['transfereeuniqueid']][_0x40806e][_0xdb69('0x10')]=!![];this[_0xdb69('0x8')][_0x1fb1b1['transfereeuniqueid']][_0x40806e][_0xdb69('0x62')]=moment()[_0xdb69('0x26')](_0xdb69('0x27'));this[_0xdb69('0x8')][_0x1fb1b1[_0xdb69('0x89')]][_0x40806e][_0xdb69('0x3d')]=_0xdb69('0x63');this[_0xdb69('0x8')][_0x1fb1b1['transfereeuniqueid']][_0x40806e][_0xdb69('0x55')]=_0xdb69('0x64');this[_0xdb69('0x8')][_0x1fb1b1[_0xdb69('0x89')]][_0x40806e][_0xdb69('0x66')]=_0x184155[_0xdb69('0x8c')](this[_0xdb69('0x8')][_0x1fb1b1[_0xdb69('0x89')]][_0x40806e]['agentconnectAt'],_0xdb69('0x8d'));}}}}if(this[_0xdb69('0x8')][_0x1fb1b1[_0xdb69('0x8e')]]){var _0x5ef24f=this[_0xdb69('0x8')][_0x1fb1b1['secondtransfereruniqueid']];this['channels'][_0x1fb1b1[_0xdb69('0x8e')]]=this[_0xdb69('0x8')][_0x1fb1b1[_0xdb69('0x89')]];this[_0xdb69('0x8')][_0x1fb1b1[_0xdb69('0x89')]]=_0x5ef24f;}}}catch(_0x200b99){logger['error'](_0xdb69('0x8f'),_0x1fb1b1[_0xdb69('0x1e')],util[_0xdb69('0x22')](_0x200b99,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdb69('0x18')]['syncBlindTransfer']=function(_0x2c1eac){try{if(this['isNotNull'](_0x2c1eac)){logger[_0xdb69('0x2f')](_0xdb69('0x90'),_0x2c1eac[_0xdb69('0x1e')],util[_0xdb69('0x22')](_0x2c1eac,{'showHidden':![],'depth':null}));if(this[_0xdb69('0x8')][_0x2c1eac[_0xdb69('0x89')]]){for(var _0x3b03c3 in this[_0xdb69('0x8')][_0x2c1eac[_0xdb69('0x89')]]){if(this[_0xdb69('0x8')][_0x2c1eac[_0xdb69('0x89')]][_0xdb69('0x59')](_0x3b03c3)){if(_0x2c1eac[_0xdb69('0x91')]===_0x3b03c3){logger[_0xdb69('0x1c')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2c1eac[_0xdb69('0x1e')],this['channels'][_0x2c1eac[_0xdb69('0x89')]][_0x3b03c3]['membername'],_0x3b03c3);var _0x4e3f19=moment();this[_0xdb69('0x8')][_0x2c1eac[_0xdb69('0x89')]][_0x3b03c3]['agentcomplete']=!![];this[_0xdb69('0x8')][_0x2c1eac[_0xdb69('0x89')]][_0x3b03c3][_0xdb69('0x62')]=_0x4e3f19;this['channels'][_0x2c1eac['transfereeuniqueid']][_0x3b03c3]['lastevent']=_0xdb69('0x63');this[_0xdb69('0x8')][_0x2c1eac[_0xdb69('0x89')]][_0x3b03c3][_0xdb69('0x55')]=_0xdb69('0x64');this[_0xdb69('0x8')][_0x2c1eac[_0xdb69('0x89')]][_0x3b03c3][_0xdb69('0x66')]=_0x4e3f19[_0xdb69('0x8c')](this['channels'][_0x2c1eac[_0xdb69('0x89')]][_0x3b03c3][_0xdb69('0x60')],'seconds');}}}}}}catch(_0x1b8c6d){logger[_0xdb69('0x35')]('[%s][voiceAgentReport][blindtransfer]',_0x2c1eac[_0xdb69('0x1e')],util[_0xdb69('0x22')](_0x1b8c6d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdb69('0x18')][_0xdb69('0x13')]=function(_0x5f0655){var _0x163731='';try{if(this['isNotNull'](_0x5f0655)){logger['debug'](_0xdb69('0x92'),_0x5f0655['uniqueid'],util[_0xdb69('0x22')](_0x5f0655,{'showHidden':![],'depth':null}));if(_0x5f0655['channel']){_0x163731=_0x5f0655['channel']['substring'](0x0,_0x5f0655[_0xdb69('0x43')][_0xdb69('0x93')]('-'));if(this[_0xdb69('0xa')][_0x163731]){logger[_0xdb69('0x1c')](_0xdb69('0x94'),_0x5f0655[_0xdb69('0x1e')],_0x163731);this[_0xdb69('0xa')][_0x163731][_0xdb69('0x95')]=!![];}}}}catch(_0x214150){logger[_0xdb69('0x35')](_0xdb69('0x96'),_0x5f0655['uniqueid'],util['inspect'](_0x214150,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xdb69('0x18')][_0xdb69('0x97')]=function(_0x932561){var _0x4e431f='';try{if(this[_0xdb69('0x1a')](_0x932561)){logger[_0xdb69('0x2f')](_0xdb69('0x98'),_0x932561[_0xdb69('0x1e')],util[_0xdb69('0x22')](_0x932561,{'showHidden':![],'depth':null}));if(_0x932561[_0xdb69('0x43')]){_0x4e431f=_0x932561[_0xdb69('0x43')][_0xdb69('0x99')](0x0,_0x932561[_0xdb69('0x43')][_0xdb69('0x93')]('-'));if(this[_0xdb69('0xa')][_0x4e431f]){logger[_0xdb69('0x1c')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x932561['uniqueid'],_0x4e431f);this[_0xdb69('0xa')][_0x4e431f][_0xdb69('0x95')]=![];}}}}catch(_0x12d85b){logger['error'](_0xdb69('0x9a'),_0x932561['uniqueid'],util[_0xdb69('0x22')](_0x12d85b,{'showHidden':![],'depth':null}));}};module[_0xdb69('0x9b')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 6434c13..c6b5c42 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9036=['undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','OutgoingSpoolFailed','application','applicationdata','appdata','startsWith','CDR(routeAlias)','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','lastapplication','lastdata','cdr(','match','[%s][voiceCallReport][newstate]\x20event:','answered','diff','destinationchannel','toNumber','UserId','membername','answertime','holdtime','connectedlinename','routealias','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','endsWith','.wav49','.WAV','monitorFilename','find','monitors','isNil','push','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','billableseconds','resolve','transferType','isEmpty','getSettings','stopRecordingOnTransfer','then','Action','StopMixMonitor','finally','webbar:stopmonitors','event','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','BlindTransfer','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','lodash','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','set','queue','agi','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','bind','newexten','syncNewExten','syncNewState','varset','syncVarSet','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','syncMusicOnHoldStop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','prototype','isNotNull','isUndefined','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','inspect','uniqueid','linkedid','merge','keys','context','from-sip','channel','xcally-motion-preview','split','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','exten','disposition','channelstate','pick'];(function(_0x32155f,_0x30ad67){var _0x588278=function(_0x502f4e){while(--_0x502f4e){_0x32155f['push'](_0x32155f['shift']());}};_0x588278(++_0x30ad67);}(_0x9036,0x74));var _0x6903=function(_0x316708,_0x30fa38){_0x316708=_0x316708-0x0;var _0x11cd4c=_0x9036[_0x316708];return _0x11cd4c;};'use strict';var _=require(_0x6903('0x0'));var moment=require('moment');var util=require(_0x6903('0x1'));var path=require(_0x6903('0x2'));var Redis=require(_0x6903('0x3'));var config=require(_0x6903('0x4'));var logger=require(_0x6903('0x5'))(_0x6903('0x6'));var ami=require(_0x6903('0x7'));var Channel=require('../model/channel');var RpcSetting=require('../rpc/setting');var applications=[_0x6903('0x8'),_0x6903('0x9'),_0x6903('0xa'),'dial','playback','voicemail'];var dispositions=[_0x6903('0xb'),'FAILED',_0x6903('0xc'),_0x6903('0xb'),_0x6903('0xb'),_0x6903('0xb'),_0x6903('0xd'),_0x6903('0xe'),_0x6903('0xc'),'FAILED',_0x6903('0xc')];config[_0x6903('0xf')]=_[_0x6903('0x10')](config[_0x6903('0xf')],{'host':_0x6903('0x11'),'port':0x18eb});var io=require(_0x6903('0x12'))(new Redis(config[_0x6903('0xf')]));function VoiceCallReport(_0x1ee7e6){this[_0x6903('0x13')]=_0x1ee7e6[_0x6903('0x13')];this[_0x6903('0x14')]=_0x1ee7e6[_0x6903('0x14')];this[_0x6903('0x15')]={};ami['on'](_0x6903('0x16'),this['syncNewExten'][_0x6903('0x17')](this));ami['on'](_0x6903('0x18'),this[_0x6903('0x19')][_0x6903('0x17')](this));ami['on']('newchannel',this['syncNewChannel'][_0x6903('0x17')](this));ami['on']('newstate',this[_0x6903('0x1a')][_0x6903('0x17')](this));ami['on'](_0x6903('0x1b'),this[_0x6903('0x1c')][_0x6903('0x17')](this));ami['on']('hangup',this[_0x6903('0x1d')][_0x6903('0x17')](this));ami['on']('newcallerid',this['syncNewCallerId'][_0x6903('0x17')](this));ami['on'](_0x6903('0x1e'),this[_0x6903('0x1f')]['bind'](this));ami['on'](_0x6903('0x20'),this[_0x6903('0x21')]['bind'](this));ami['on']('musiconholdstart',this[_0x6903('0x22')][_0x6903('0x17')](this));ami['on']('musiconholdstop',this[_0x6903('0x23')][_0x6903('0x17')](this));try{logger[_0x6903('0x24')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0x6903('0x25')]();}catch(_0x3e544a){logger[_0x6903('0x26')](_0x6903('0x27'),util['inspect'](_0x3e544a,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x6903('0x28')][_0x6903('0x29')]=function(_0x16582e){return _0x16582e!==null&&!_[_0x6903('0x2a')](_0x16582e);};VoiceCallReport['prototype']['emit']=function(_0x47557a,_0x8e7ece,_0x3e7c73){io['to'](_0x47557a)[_0x6903('0x2b')](_0x8e7ece,_0x3e7c73);};VoiceCallReport[_0x6903('0x28')][_0x6903('0x2c')]=function(_0x39e219){try{if(this[_0x6903('0x29')](_0x39e219)){logger[_0x6903('0x24')](_0x6903('0x2d'),_0x39e219['uniqueid'],_0x39e219[_0x6903('0x2e')],_0x39e219[_0x6903('0x2f')]);logger[_0x6903('0x30')](_0x6903('0x31'),_0x39e219['uniqueid'],util[_0x6903('0x32')](_0x39e219,{'showHidden':![],'depth':null}));if(_0x39e219[_0x6903('0x33')]===_0x39e219[_0x6903('0x34')]){if(!_[_0x6903('0x2a')](this['channels'][_0x39e219['uniqueid']])){_[_0x6903('0x35')](this['channels'][_0x39e219['uniqueid']],_['pick'](_0x39e219,_[_0x6903('0x36')](this[_0x6903('0x13')][_0x39e219[_0x6903('0x33')]])));}}if(_0x39e219[_0x6903('0x37')]===_0x6903('0x38')){if(this[_0x6903('0x14')][_0x39e219[_0x6903('0x39')]['split']('-')[0x0]]){if(_0x39e219['exten']==_0x6903('0x3a')){this[_0x6903('0x14')][_0x39e219[_0x6903('0x39')][_0x6903('0x3b')]('-')[0x0]][_0x6903('0x3c')]=_0x39e219[_0x6903('0x3d')];this[_0x6903('0x2b')](util[_0x6903('0x3e')](_0x6903('0x3f'),this[_0x6903('0x14')][_0x39e219['channel'][_0x6903('0x3b')]('-')[0x0]][_0x6903('0x40')]),_0x6903('0x41'),{'destaccountcode':this['agents'][_0x39e219[_0x6903('0x39')][_0x6903('0x3b')]('-')[0x0]][_0x6903('0x42')],'destconnectedlinenum':_0x39e219[_0x6903('0x3d')]});}}}}}catch(_0x2bd09c){logger[_0x6903('0x26')](_0x6903('0x43'),_0x39e219[_0x6903('0x33')],util[_0x6903('0x32')](_0x2bd09c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6903('0x28')]['syncNewChannel']=function(_0x5e6c9e){try{if(this[_0x6903('0x29')](_0x5e6c9e)){logger[_0x6903('0x30')](_0x6903('0x44'),_0x5e6c9e[_0x6903('0x33')],util['inspect'](_0x5e6c9e,{'showHidden':![],'depth':null}));if(this[_0x6903('0x13')][_0x5e6c9e['uniqueid']]){return;}if(_0x5e6c9e[_0x6903('0x39')]==='OutgoingSpoolFailed'){return;}if(_0x5e6c9e[_0x6903('0x33')]!==_0x5e6c9e[_0x6903('0x34')]&&!this['blindTransfers'][_0x5e6c9e[_0x6903('0x34')]]){return;}logger[_0x6903('0x24')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x5e6c9e[_0x6903('0x33')],_0x5e6c9e[_0x6903('0x37')],_0x5e6c9e[_0x6903('0x45')]);this[_0x6903('0x13')][_0x5e6c9e['uniqueid']]=new Channel();this[_0x6903('0x13')][_0x5e6c9e[_0x6903('0x33')]]['starttime']=moment()[_0x6903('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6903('0x13')][_0x5e6c9e[_0x6903('0x33')]][_0x6903('0x46')]=dispositions[_['toNumber'](_0x5e6c9e[_0x6903('0x47')])];_[_0x6903('0x35')](this[_0x6903('0x13')][_0x5e6c9e[_0x6903('0x33')]],_[_0x6903('0x48')](_0x5e6c9e,_[_0x6903('0x36')](this[_0x6903('0x13')][_0x5e6c9e[_0x6903('0x33')]])));if(_0x5e6c9e[_0x6903('0x37')]===_0x6903('0x38')){var _0x4c090c=this[_0x6903('0x14')][_0x5e6c9e[_0x6903('0x39')][_0x6903('0x3b')]('-')[0x0]];if(_0x4c090c&&typeof _0x4c090c[_0x6903('0x3c')]===_0x6903('0x49')){_0x4c090c[_0x6903('0x3c')]=_0x5e6c9e['exten'];logger[_0x6903('0x30')](_0x6903('0x4a'),_0x5e6c9e[_0x6903('0x33')],util['inspect']({'id':_0x4c090c['id'],'destaccountcode':_0x4c090c[_0x6903('0x42')],'destconnectedlinenum':_0x5e6c9e[_0x6903('0x45')]},{'showHidden':![],'depth':null}));this[_0x6903('0x2b')](util[_0x6903('0x3e')]('user:%s',_0x4c090c[_0x6903('0x40')]),_0x6903('0x41'),{'id':_0x4c090c['id'],'destaccountcode':_0x4c090c[_0x6903('0x42')],'destconnectedlinenum':_0x5e6c9e[_0x6903('0x45')]});}}}}catch(_0x3c47c7){logger[_0x6903('0x26')](_0x6903('0x4b'),_0x5e6c9e['uniqueid'],util['inspect'](_0x3c47c7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6903('0x28')][_0x6903('0x19')]=function(_0x41c825){try{if(this[_0x6903('0x29')](_0x41c825)){logger['debug']('[%s][voiceCallReport][newexten]\x20event:',_0x41c825['uniqueid'],util['inspect'](_0x41c825,{'showHidden':![],'depth':null}));if(_0x41c825['channel']===_0x6903('0x4c')||_0x41c825['exten']==='h')return;if(_0x41c825[_0x6903('0x33')]===_0x41c825[_0x6903('0x34')]||this['blindTransfers'][_0x41c825[_0x6903('0x34')]]){_0x41c825[_0x6903('0x4d')]=_0x41c825[_0x6903('0x4d')]?_0x41c825['application']['toLowerCase']():undefined;_0x41c825['applicationdata']=_0x41c825['appdata']||_0x41c825[_0x6903('0x4e')];if(_0x41c825[_0x6903('0x4f')]&&!_0x41c825[_0x6903('0x4f')][_0x6903('0x50')](_0x6903('0x51'))&&_0x41c825[_0x6903('0x4d')]!==_0x6903('0x9')){_0x41c825[_0x6903('0x4e')]=_0x41c825[_0x6903('0x4e')][_0x6903('0x52')]();}logger[_0x6903('0x24')](_0x6903('0x53'),_0x41c825['uniqueid'],_0x41c825[_0x6903('0x4d')],_0x41c825[_0x6903('0x4e')]);if(_[_0x6903('0x2a')](this[_0x6903('0x13')][_0x41c825[_0x6903('0x33')]])){this[_0x6903('0x13')][_0x41c825[_0x6903('0x33')]]=new Channel();this[_0x6903('0x13')][_0x41c825[_0x6903('0x33')]][_0x6903('0x54')]=_0x41c825[_0x6903('0x55')]?moment()[_0x6903('0x56')](moment['duration'](_0x41c825[_0x6903('0x55')])[_0x6903('0x57')](),_0x6903('0x57'))['format'](_0x6903('0x58')):moment()[_0x6903('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6903('0x13')][_0x41c825[_0x6903('0x33')]][_0x6903('0x46')]=_0x6903('0xb');}_[_0x6903('0x35')](this[_0x6903('0x13')][_0x41c825['uniqueid']],_[_0x6903('0x48')](_0x41c825,_[_0x6903('0x36')](this['channels'][_0x41c825[_0x6903('0x33')]])));if(_['includes'](applications,_0x41c825[_0x6903('0x4d')])){this[_0x6903('0x13')][_0x41c825[_0x6903('0x33')]][_0x6903('0x59')]=_0x41c825[_0x6903('0x4d')];this[_0x6903('0x13')][_0x41c825['uniqueid']][_0x6903('0x5a')]=_0x41c825['applicationdata'];if(_0x41c825[_0x6903('0x4d')]===_0x6903('0x8')&&_[_0x6903('0x50')](_0x41c825[_0x6903('0x4e')][_0x6903('0x52')](),_0x6903('0x5b'))){var _0x46316a=_0x41c825[_0x6903('0x4e')][_0x6903('0x3b')]('=');var _0x32601b=_0x46316a[0x0]['toLowerCase']()[_0x6903('0x5c')](/cdr\((.*)\)/);if(_0x32601b){if(_0x32601b[0x1]==='type'&&!_['isNil'](this[_0x6903('0x13')][_0x41c825['uniqueid']][_0x32601b[0x1]]))return;this[_0x6903('0x13')][_0x41c825[_0x6903('0x33')]][_0x32601b[0x1]]=_0x46316a[0x1];}}else if(_0x41c825['application']===_0x6903('0x9')){this[_0x6903('0x13')][_0x41c825[_0x6903('0x33')]][_0x6903('0x9')]=_0x41c825['applicationdata'][_0x6903('0x3b')](',')[0x0];}}}}}catch(_0x46d98c){logger['error']('[%s][voiceCallReport][newexten]',_0x41c825[_0x6903('0x33')],util[_0x6903('0x32')](_0x46d98c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6903('0x28')]['syncNewState']=function(_0x4eba84){try{if(this[_0x6903('0x29')](_0x4eba84)){logger[_0x6903('0x24')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x4eba84[_0x6903('0x33')],_0x4eba84[_0x6903('0x34')],_0x4eba84[_0x6903('0x2e')],_0x4eba84[_0x6903('0x2f')]);logger[_0x6903('0x30')](_0x6903('0x5d'),_0x4eba84[_0x6903('0x33')],util[_0x6903('0x32')](_0x4eba84,{'showHidden':![],'depth':null}));if(_0x4eba84[_0x6903('0x47')]!=='6')return;var _0x5cc849=this[_0x6903('0x14')][_0x4eba84['channel'][_0x6903('0x3b')]('-')[0x0]];if(_0x4eba84[_0x6903('0x33')]!==_0x4eba84[_0x6903('0x34')]){var _0x47a5cb=moment();if(this['channels'][_0x4eba84[_0x6903('0x34')]]){if(!this[_0x6903('0x13')][_0x4eba84['linkedid']][_0x6903('0x5e')]){this[_0x6903('0x13')][_0x4eba84['linkedid']][_0x6903('0x5e')]=!![];this[_0x6903('0x13')][_0x4eba84[_0x6903('0x34')]]['answertime']=_0x47a5cb['format']('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x6903('0x13')][_0x4eba84[_0x6903('0x34')]][_0x6903('0x54')]){this['channels'][_0x4eba84['linkedid']]['holdtime']=_0x47a5cb[_0x6903('0x5f')](this['channels'][_0x4eba84[_0x6903('0x34')]]['starttime'],'seconds');}}this['channels'][_0x4eba84['linkedid']][_0x6903('0x34')]=_0x4eba84[_0x6903('0x33')];if(_0x4eba84[_0x6903('0x2f')]!==_0x6903('0x3a')){this['channels'][_0x4eba84['linkedid']][_0x6903('0x3d')]=_0x4eba84[_0x6903('0x2f')];}this[_0x6903('0x13')][_0x4eba84[_0x6903('0x34')]]['connectedlinename']=_0x4eba84['calleridname'];this[_0x6903('0x13')][_0x4eba84['linkedid']][_0x6903('0x60')]=_0x4eba84[_0x6903('0x39')];this[_0x6903('0x13')][_0x4eba84[_0x6903('0x34')]]['disposition']=dispositions[_[_0x6903('0x61')](_0x4eba84['channelstate'])];if(_0x5cc849){this[_0x6903('0x13')][_0x4eba84['linkedid']][_0x6903('0x62')]=_0x5cc849['id'];this['channels'][_0x4eba84[_0x6903('0x34')]][_0x6903('0x63')]=_0x5cc849[_0x6903('0x40')];}}if(this[_0x6903('0x13')][_0x4eba84[_0x6903('0x33')]]){if(!this[_0x6903('0x13')][_0x4eba84['uniqueid']][_0x6903('0x5e')]){this['channels'][_0x4eba84[_0x6903('0x33')]][_0x6903('0x5e')]=!![];this[_0x6903('0x13')][_0x4eba84['uniqueid']][_0x6903('0x64')]=_0x47a5cb[_0x6903('0x3e')](_0x6903('0x58'));if(this['channels'][_0x4eba84[_0x6903('0x33')]][_0x6903('0x54')]){this[_0x6903('0x13')][_0x4eba84[_0x6903('0x33')]][_0x6903('0x65')]=_0x47a5cb['diff'](this[_0x6903('0x13')][_0x4eba84[_0x6903('0x33')]][_0x6903('0x54')],'seconds');}}if(_0x4eba84[_0x6903('0x2f')]!==_0x6903('0x3a')){this['channels'][_0x4eba84[_0x6903('0x33')]][_0x6903('0x3d')]=_0x4eba84[_0x6903('0x2f')];}this[_0x6903('0x13')][_0x4eba84[_0x6903('0x33')]][_0x6903('0x66')]=_0x4eba84[_0x6903('0x2e')];this[_0x6903('0x13')][_0x4eba84['uniqueid']][_0x6903('0x60')]=_0x4eba84[_0x6903('0x39')];this[_0x6903('0x13')][_0x4eba84['uniqueid']][_0x6903('0x46')]=dispositions[_[_0x6903('0x61')](_0x4eba84[_0x6903('0x47')])];}}else{if(this[_0x6903('0x13')][_0x4eba84[_0x6903('0x33')]]){if(_0x5cc849){this[_0x6903('0x13')][_0x4eba84[_0x6903('0x33')]][_0x6903('0x62')]=_0x5cc849['id'];this[_0x6903('0x13')][_0x4eba84['uniqueid']]['membername']=_0x5cc849[_0x6903('0x40')];}}}if(_0x4eba84['context']===_0x6903('0x38')){if(_0x5cc849){_0x5cc849[_0x6903('0x3c')]=_0x4eba84[_0x6903('0x45')];var _0x1eb299,_0x5dff8c;if(this['channels'][_0x4eba84[_0x6903('0x33')]]){_0x1eb299=this[_0x6903('0x13')][_0x4eba84['uniqueid']][_0x6903('0x67')];_0x5dff8c=this[_0x6903('0x13')][_0x4eba84[_0x6903('0x33')]]['queue'];}else if(this[_0x6903('0x13')][_0x4eba84['linkedid']]){_0x1eb299=this[_0x6903('0x13')][_0x4eba84[_0x6903('0x34')]][_0x6903('0x67')];_0x5dff8c=this[_0x6903('0x13')][_0x4eba84[_0x6903('0x34')]][_0x6903('0x9')];}_0x5cc849[_0x6903('0x9')]=_0x5dff8c;_0x5cc849[_0x6903('0x67')]=_0x1eb299;var _0x40c8f0={'id':_0x5cc849['id'],'name':_0x5cc849['name'],'agentconnected':!![],'destaccountcode':_0x5cc849[_0x6903('0x42')],'destconnectedlinenum':_0x4eba84['exten'],'queue':_0x5dff8c||undefined,'routealias':_0x1eb299,'uniqueid':_0x4eba84[_0x6903('0x34')]};logger[_0x6903('0x30')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x4eba84[_0x6903('0x33')],util['inspect'](_0x40c8f0,{'showHidden':![],'depth':null}));this[_0x6903('0x2b')](util[_0x6903('0x3e')](_0x6903('0x3f'),_0x5cc849[_0x6903('0x40')]),_0x6903('0x41'),_0x40c8f0);}}}}catch(_0x94578e){logger[_0x6903('0x26')](_0x6903('0x68'),_0x4eba84[_0x6903('0x33')],util['inspect'](_0x94578e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6903('0x28')][_0x6903('0x69')]=function(_0x14b103,_0x19a541){try{if(this[_0x6903('0x13')][_0x14b103]){logger[_0x6903('0x24')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x14b103,_0x19a541);this[_0x6903('0x13')][_0x14b103]['monitor']=!![];if(_[_0x6903('0x6a')](_0x19a541,'.wav49')){_0x19a541=_0x19a541['replace'](_0x6903('0x6b'),_0x6903('0x6c'));}this['channels'][_0x14b103][_0x6903('0x6d')]=_0x19a541;var _0x4461d4=_[_0x6903('0x6e')](this[_0x6903('0x13')][_0x14b103][_0x6903('0x6f')],{'filename':_0x19a541});if(_[_0x6903('0x70')](_0x4461d4)){this['channels'][_0x14b103][_0x6903('0x6f')][_0x6903('0x71')]({'filename':_0x19a541,'createdAt':moment()[_0x6903('0x3e')](_0x6903('0x58')),'mixmonitorid':'','status':'rec'});}}}catch(_0x11e832){logger[_0x6903('0x26')]('[%s][voiceCallReport][mixMonitorFilename]',_0x14b103,util[_0x6903('0x32')](_0x11e832,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6903('0x28')]['syncVarSet']=function(_0x4b1606){try{if(this['isNotNull'](_0x4b1606)){logger['debug'](_0x6903('0x72'),_0x4b1606[_0x6903('0x33')],util[_0x6903('0x32')](_0x4b1606,{'showHidden':![],'depth':null}));if(this[_0x6903('0x13')][_0x4b1606[_0x6903('0x33')]]&&_0x4b1606[_0x6903('0x39')]!='OutgoingSpoolFailed'){if(this['isNotNull'](_0x4b1606[_0x6903('0x73')])){if(this[_0x6903('0x29')](_0x4b1606['variable'][_0x6903('0x74')])){logger[_0x6903('0x24')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x4b1606[_0x6903('0x33')],_0x4b1606[_0x6903('0x75')]);this[_0x6903('0x69')](_0x4b1606[_0x6903('0x33')],_0x4b1606[_0x6903('0x75')]);}else if(this[_0x6903('0x29')](_0x4b1606[_0x6903('0x73')][_0x6903('0x76')])){logger[_0x6903('0x24')](_0x6903('0x77'),_0x4b1606['uniqueid'],_0x4b1606[_0x6903('0x75')]);this[_0x6903('0x13')][_0x4b1606['uniqueid']][_0x6903('0x2f')]=_0x4b1606[_0x6903('0x75')];}else if(this[_0x6903('0x29')](_0x4b1606[_0x6903('0x73')][_0x6903('0x78')])){logger[_0x6903('0x24')](_0x6903('0x79'),_0x4b1606[_0x6903('0x33')],_0x4b1606[_0x6903('0x75')]);this['channels'][_0x4b1606[_0x6903('0x33')]][_0x6903('0x7a')]=_0x4b1606[_0x6903('0x75')];}else if(this['isNotNull'](_0x4b1606[_0x6903('0x73')][_0x6903('0x7b')])){logger[_0x6903('0x24')](_0x6903('0x7c'),_0x4b1606[_0x6903('0x33')],_0x4b1606[_0x6903('0x75')]);this[_0x6903('0x13')][_0x4b1606[_0x6903('0x33')]][_0x6903('0x7d')]=_0x4b1606[_0x6903('0x75')];}else if(this[_0x6903('0x29')](_0x4b1606[_0x6903('0x73')][_0x6903('0x7e')])){logger['info'](_0x6903('0x7f'),_0x4b1606[_0x6903('0x33')],_0x4b1606[_0x6903('0x75')][_0x6903('0x3b')](',')[0x0]);this[_0x6903('0x13')][_0x4b1606[_0x6903('0x33')]]['queue']=_0x4b1606[_0x6903('0x75')][_0x6903('0x3b')](',')[0x0];}else if(this[_0x6903('0x29')](_0x4b1606[_0x6903('0x73')][_0x6903('0x80')])){logger['info'](_0x6903('0x81'),_0x4b1606[_0x6903('0x33')],_0x4b1606[_0x6903('0x75')]);this['channels'][_0x4b1606[_0x6903('0x33')]][_0x6903('0x82')]=_0x4b1606['value'];}else if(this[_0x6903('0x29')](_0x4b1606[_0x6903('0x73')][_0x6903('0x83')])){logger[_0x6903('0x24')](_0x6903('0x84'),_0x4b1606['uniqueid'],_0x4b1606[_0x6903('0x75')]);this[_0x6903('0x13')][_0x4b1606[_0x6903('0x33')]][_0x6903('0x85')]=_0x4b1606[_0x6903('0x75')];}else if(this[_0x6903('0x29')](_0x4b1606[_0x6903('0x73')]['xmd-callerid-preview'])){logger[_0x6903('0x24')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x4b1606[_0x6903('0x33')],_0x4b1606[_0x6903('0x75')]);this[_0x6903('0x13')][_0x4b1606[_0x6903('0x33')]][_0x6903('0x86')]=_0x4b1606[_0x6903('0x75')];}else if(this[_0x6903('0x29')](_0x4b1606[_0x6903('0x73')][_0x6903('0x87')])){logger[_0x6903('0x24')](_0x6903('0x88'),_0x4b1606[_0x6903('0x33')],_0x4b1606[_0x6903('0x75')]);this[_0x6903('0x13')][_0x4b1606[_0x6903('0x33')]][_0x6903('0x9')]=_0x4b1606[_0x6903('0x75')];}else if(this['isNotNull'](_0x4b1606[_0x6903('0x73')][_0x6903('0x89')])){logger[_0x6903('0x24')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x4b1606[_0x6903('0x33')],_0x4b1606[_0x6903('0x75')]);this[_0x6903('0x13')][_0x4b1606[_0x6903('0x33')]]['sipcalluniqueid']=_0x4b1606[_0x6903('0x75')];}}}else if(this[_0x6903('0x29')](_0x4b1606[_0x6903('0x73')]['mixmonitor_filename'])){if(_0x4b1606[_0x6903('0x75')]){var _0x185a09=path[_0x6903('0x8a')](_0x4b1606[_0x6903('0x75')])['name'];logger[_0x6903('0x24')](_0x6903('0x8b'),_0x185a09,_0x4b1606['value']);this[_0x6903('0x69')](_0x185a09,_0x4b1606[_0x6903('0x75')]);}}else if(this[_0x6903('0x13')][_0x4b1606[_0x6903('0x34')]]){if(this[_0x6903('0x29')](_0x4b1606[_0x6903('0x73')])){if(this['isNotNull'](_0x4b1606['variable'][_0x6903('0x89')])){logger[_0x6903('0x24')](_0x6903('0x8c'),_0x4b1606[_0x6903('0x34')],_0x4b1606['value']);this[_0x6903('0x13')][_0x4b1606[_0x6903('0x34')]][_0x6903('0x8d')]=_0x4b1606[_0x6903('0x75')];}}}}}catch(_0x5a1f23){logger[_0x6903('0x26')]('[%s][voiceCallReport][varset]',_0x4b1606[_0x6903('0x33')],util[_0x6903('0x32')](_0x5a1f23,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6903('0x28')][_0x6903('0x1d')]=function(_0x4f86a1){try{if(this[_0x6903('0x29')](_0x4f86a1)){logger[_0x6903('0x30')](_0x6903('0x8e'),_0x4f86a1[_0x6903('0x33')],util['inspect'](_0x4f86a1,{'showHidden':![],'depth':null}));if(this[_0x6903('0x15')][_0x4f86a1['linkedid']]){if(this[_0x6903('0x13')][this[_0x6903('0x15')][_0x4f86a1['linkedid']]['linkedid']]){this[_0x6903('0x13')][this[_0x6903('0x15')][_0x4f86a1[_0x6903('0x34')]]['linkedid']][_0x6903('0x33')]=_0x4f86a1['uniqueid'];this['channels'][this[_0x6903('0x15')][_0x4f86a1[_0x6903('0x34')]][_0x6903('0x34')]][_0x6903('0x5e')]=this[_0x6903('0x13')][_0x4f86a1[_0x6903('0x33')]]['answered'];this['channels'][this['blindTransfers'][_0x4f86a1[_0x6903('0x34')]][_0x6903('0x34')]][_0x6903('0x64')]=this[_0x6903('0x13')][_0x4f86a1[_0x6903('0x33')]][_0x6903('0x64')];this['channels'][this[_0x6903('0x15')][_0x4f86a1[_0x6903('0x34')]]['linkedid']][_0x6903('0x60')]=this[_0x6903('0x13')][this[_0x6903('0x15')][_0x4f86a1['linkedid']][_0x6903('0x34')]][_0x6903('0x39')];this['channels'][this[_0x6903('0x15')][_0x4f86a1[_0x6903('0x34')]][_0x6903('0x34')]]['disposition']=this[_0x6903('0x13')][_0x4f86a1[_0x6903('0x33')]][_0x6903('0x46')];this[_0x6903('0x13')][_0x4f86a1[_0x6903('0x33')]]=this[_0x6903('0x13')][this[_0x6903('0x15')][_0x4f86a1[_0x6903('0x34')]][_0x6903('0x34')]];delete this[_0x6903('0x13')][this[_0x6903('0x15')][_0x4f86a1[_0x6903('0x34')]][_0x6903('0x34')]];}else if(this[_0x6903('0x13')][this[_0x6903('0x15')][_0x4f86a1[_0x6903('0x34')]][_0x6903('0x33')]]){this[_0x6903('0x13')][this[_0x6903('0x15')][_0x4f86a1[_0x6903('0x34')]][_0x6903('0x33')]][_0x6903('0x33')]=[this[_0x6903('0x13')][this[_0x6903('0x15')][_0x4f86a1[_0x6903('0x34')]][_0x6903('0x33')]][_0x6903('0x34')],this[_0x6903('0x13')][this[_0x6903('0x15')][_0x4f86a1['linkedid']][_0x6903('0x33')]][_0x6903('0x34')]=this[_0x6903('0x13')][this[_0x6903('0x15')][_0x4f86a1[_0x6903('0x34')]][_0x6903('0x33')]][_0x6903('0x33')]][0x0];this[_0x6903('0x13')][this['blindTransfers'][_0x4f86a1[_0x6903('0x34')]][_0x6903('0x33')]][_0x6903('0x5e')]=this[_0x6903('0x13')][_0x4f86a1['uniqueid']][_0x6903('0x5e')];this[_0x6903('0x13')][this[_0x6903('0x15')][_0x4f86a1[_0x6903('0x34')]][_0x6903('0x33')]][_0x6903('0x64')]=this[_0x6903('0x13')][_0x4f86a1[_0x6903('0x33')]][_0x6903('0x64')];this[_0x6903('0x13')][this[_0x6903('0x15')][_0x4f86a1['linkedid']][_0x6903('0x33')]]['destinationchannel']=this[_0x6903('0x13')][this['blindTransfers'][_0x4f86a1[_0x6903('0x34')]][_0x6903('0x33')]][_0x6903('0x39')];this[_0x6903('0x13')][this[_0x6903('0x15')][_0x4f86a1[_0x6903('0x34')]][_0x6903('0x33')]][_0x6903('0x46')]=this[_0x6903('0x13')][_0x4f86a1[_0x6903('0x33')]][_0x6903('0x46')];this['channels'][_0x4f86a1[_0x6903('0x33')]]=this[_0x6903('0x13')][this[_0x6903('0x15')][_0x4f86a1[_0x6903('0x34')]][_0x6903('0x33')]];delete this[_0x6903('0x13')][this['blindTransfers'][_0x4f86a1[_0x6903('0x34')]][_0x6903('0x33')]];}}if(this[_0x6903('0x13')][_0x4f86a1[_0x6903('0x33')]]){logger[_0x6903('0x24')](_0x6903('0x8f'),_0x4f86a1[_0x6903('0x33')],_0x4f86a1['cause-txt']);var _0x4fccda=moment();this[_0x6903('0x13')][_0x4f86a1[_0x6903('0x33')]]['endtime']=_0x4fccda[_0x6903('0x3e')](_0x6903('0x58'));this[_0x6903('0x13')][_0x4f86a1[_0x6903('0x33')]][_0x6903('0x55')]=_0x4fccda[_0x6903('0x5f')](this['channels'][_0x4f86a1['uniqueid']][_0x6903('0x54')],'seconds');if(this[_0x6903('0x13')][_0x4f86a1[_0x6903('0x33')]][_0x6903('0x5e')]){this[_0x6903('0x13')][_0x4f86a1[_0x6903('0x33')]]['billableseconds']=_0x4fccda[_0x6903('0x5f')](this['channels'][_0x4f86a1[_0x6903('0x33')]][_0x6903('0x64')],_0x6903('0x57'));this[_0x6903('0x13')][_0x4f86a1[_0x6903('0x33')]][_0x6903('0x65')]=this['channels'][_0x4f86a1[_0x6903('0x33')]][_0x6903('0x55')]-this[_0x6903('0x13')][_0x4f86a1[_0x6903('0x33')]][_0x6903('0x90')];}if(_0x4f86a1[_0x6903('0x37')]==='from-sip'){if(this[_0x6903('0x14')][_0x4f86a1[_0x6903('0x39')][_0x6903('0x3b')]('-')[0x0]]){this[_0x6903('0x14')][_0x4f86a1[_0x6903('0x39')][_0x6903('0x3b')]('-')[0x0]]=_['omit'](this[_0x6903('0x14')][_0x4f86a1[_0x6903('0x39')][_0x6903('0x3b')]('-')[0x0]],[_0x6903('0x3c')]);logger[_0x6903('0x30')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x4f86a1[_0x6903('0x33')],util['inspect']({'id':this['agents'][_0x4f86a1['channel']['split']('-')[0x0]]['id'],'destaccountcode':this[_0x6903('0x14')][_0x4f86a1[_0x6903('0x39')][_0x6903('0x3b')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this['emit'](util[_0x6903('0x3e')](_0x6903('0x3f'),this[_0x6903('0x14')][_0x4f86a1['channel'][_0x6903('0x3b')]('-')[0x0]][_0x6903('0x40')]),'user:agentcomplete',{'id':this['agents'][_0x4f86a1[_0x6903('0x39')][_0x6903('0x3b')]('-')[0x0]]['id'],'destaccountcode':this[_0x6903('0x14')][_0x4f86a1[_0x6903('0x39')][_0x6903('0x3b')]('-')[0x0]][_0x6903('0x42')]});for(var _0xe15c3c=0x0;_0xe15c3c0x0?!![]:![];if(!_0x1ee768){return this['syncQueueSummaryComplete'](this['summary'][_0x4bc4('0x63')]);}};VoiceQueueReport[_0x4bc4('0xc')][_0x4bc4('0x64')]=function(_0x17ef2d){var _0x12cf65=this[_0x4bc4('0x17')]['id'];if(this[_0x4bc4('0x17')]['queuestatus'][_0x12cf65]&&this['summary'][_0x4bc4('0x57')][_0x12cf65][_0x17ef2d[_0x4bc4('0x55')]]){this[_0x4bc4('0x17')]['queuestatus'][_0x12cf65][_0x17ef2d[_0x4bc4('0x55')]][_0x4bc4('0x13')]['push'](_0x17ef2d);}};VoiceQueueReport[_0x4bc4('0xc')]['syncQueueSummary']=function(_0x588308){var _0x47f8cf=this;try{if(this[_0x4bc4('0x51')](_0x588308)&&this[_0x4bc4('0x51')](_0x588308['queue'])){logger[_0x4bc4('0x43')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x4bc4('0x3b')](_0x588308,{'showHidden':![],'depth':null}));var _0x4c5e5e=this[_0x4bc4('0x15')][_0x588308[_0x4bc4('0x4a')]];if(_0x4c5e5e){logger[_0x4bc4('0x65')](_0x4bc4('0x66'),_0x4c5e5e[_0x4bc4('0x4f')]);this['summary'][_0x4bc4('0x67')][_0x4c5e5e[_0x4bc4('0x4f')]]={'summaryEvent':_0x588308};this['summary'][_0x4bc4('0x62')]+=0x1;return ami[_0x4bc4('0x35')]({'action':_0x4bc4('0x57'),'queue':_0x4c5e5e[_0x4bc4('0x4f')]})[_0x4bc4('0x54')](function(_0x286c52){if(!_0x47f8cf[_0x4bc4('0x17')][_0x4bc4('0x57')][_0x588308[_0x4bc4('0x55')]]){_0x47f8cf[_0x4bc4('0x17')][_0x4bc4('0x57')][_0x588308[_0x4bc4('0x55')]]={};}_0x47f8cf[_0x4bc4('0x17')][_0x4bc4('0x57')][_0x588308[_0x4bc4('0x55')]][_0x286c52['actionid']]={'queue':_0x4c5e5e['name'],'agents':[]};})[_0x4bc4('0x37')](function(_0x2a878e){throw _0x2a878e;});}}}catch(_0x4ea73c){logger[_0x4bc4('0x3a')](_0x4bc4('0x58'),util[_0x4bc4('0x3b')](_0x4ea73c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x4bc4('0x1c')]=function(_0x69c89c){if(this[_0x4bc4('0x17')]['statusRequests']>0x0){this['summary'][_0x4bc4('0x63')]=_0x69c89c;return;}logger[_0x4bc4('0x43')](_0x4bc4('0x68'),util['inspect'](_0x69c89c,{'showHidden':![],'depth':null}));this[_0x4bc4('0x17')]=initializeSummary();ami[_0x4bc4('0x41')](_0x4bc4('0x69'),{});};VoiceQueueReport[_0x4bc4('0xc')]['syncQueueCallerJoin']=function(_0x5c920b){try{if(this['isNotNull'](_0x5c920b)){logger[_0x4bc4('0x43')](_0x4bc4('0x6a'),_0x5c920b['uniqueid'],util[_0x4bc4('0x3b')](_0x5c920b,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x4bc4('0x11')][_0x5c920b[_0x4bc4('0x45')]])){this[_0x4bc4('0x11')][_0x5c920b[_0x4bc4('0x45')]]=[];}if(_[_0x4bc4('0x6b')](this[_0x4bc4('0x14')][_0x5c920b[_0x4bc4('0x45')]])){this[_0x4bc4('0x14')][_0x5c920b[_0x4bc4('0x45')]]={};}var _0x5abc90=new QueueReport();_0x5abc90[_0x4bc4('0x4a')]=_0x5c920b[_0x4bc4('0x4a')];_0x5abc90['type']=this[_0x4bc4('0x15')][_0x5abc90[_0x4bc4('0x4a')]]&&this[_0x4bc4('0x15')][_0x5abc90[_0x4bc4('0x4a')]]['type']?this[_0x4bc4('0x15')][_0x5abc90[_0x4bc4('0x4a')]][_0x4bc4('0x4d')]||_0x4bc4('0x4e'):_0x4bc4('0x4e');_0x5abc90[_0x4bc4('0x6c')]=moment()[_0x4bc4('0x49')](_0x4bc4('0x6d'));_0x5abc90[_0x4bc4('0x6e')]=_0x5c920b[_0x4bc4('0x6e')];_0x5abc90[_0x4bc4('0x6f')]=_0x5c920b[_0x4bc4('0x6f')];_0x5abc90['uniqueid']=_0x5c920b[_0x4bc4('0x45')];_0x5abc90[_0x4bc4('0x70')]=this[_0x4bc4('0x14')][_0x5c920b[_0x4bc4('0x45')]][_0x4bc4('0x70')];logger['info'](_0x4bc4('0x71'),_0x5abc90['queue'],_0x5abc90['type']);_[_0x4bc4('0x72')](_0x5abc90,_[_0x4bc4('0x73')](_0x5c920b,_[_0x4bc4('0x74')](_0x5abc90)));this[_0x4bc4('0x11')][_0x5c920b[_0x4bc4('0x45')]][_0x4bc4('0x75')](_0x5abc90);this[_0x4bc4('0x14')][_0x5c920b['uniqueid']]=_0x5abc90;this[_0x4bc4('0x42')](_0x5abc90,_0x4bc4('0x76'));}}catch(_0x3933f4){logger[_0x4bc4('0x3a')](_0x4bc4('0x6a'),_0x5c920b[_0x4bc4('0x45')],util['inspect'](_0x3933f4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4bc4('0xc')]['syncQueueCallerAbandon']=function(_0x27418a){try{if(this[_0x4bc4('0x51')](_0x27418a)){logger[_0x4bc4('0x43')](_0x4bc4('0x77'),_0x27418a[_0x4bc4('0x45')],util['inspect'](_0x27418a,{'showHidden':![],'depth':null}));if(this[_0x4bc4('0x11')][_0x27418a[_0x4bc4('0x45')]]){var _0x244bb6=_[_0x4bc4('0x78')](this[_0x4bc4('0x11')][_0x27418a['uniqueid']]);_0x244bb6[_0x4bc4('0x79')]=![];_0x244bb6[_0x4bc4('0x7a')]=null;_0x244bb6['holdtime']=_0x27418a['holdtime'];_0x244bb6[_0x4bc4('0x7b')]=_0x27418a['originalposition'];_0x244bb6['queuecallerabandon']=!![];_0x244bb6[_0x4bc4('0x7c')]=moment()[_0x4bc4('0x49')](_0x4bc4('0x6d'));_0x244bb6[_0x4bc4('0x7d')]=_0x4bc4('0x7e');_0x244bb6[_0x4bc4('0x7f')]=null;logger[_0x4bc4('0x65')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x244bb6[_0x4bc4('0x4a')],_0x244bb6[_0x4bc4('0x4d')]);this[_0x4bc4('0x14')][_0x27418a['uniqueid']]=_0x244bb6;this[_0x4bc4('0x40')](_0x244bb6,'queuecallerabandon');}}}catch(_0x1c0373){logger[_0x4bc4('0x3a')](_0x4bc4('0x77'),_0x27418a[_0x4bc4('0x45')],util[_0x4bc4('0x3b')](_0x1c0373,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4bc4('0xc')][_0x4bc4('0x20')]=function(_0x1c09db){try{if(this[_0x4bc4('0x51')](_0x1c09db)){logger[_0x4bc4('0x43')](_0x4bc4('0x80'),_0x1c09db[_0x4bc4('0x45')],util[_0x4bc4('0x3b')](_0x1c09db,{'showHidden':![],'depth':null}));if(this[_0x4bc4('0x11')][_0x1c09db[_0x4bc4('0x45')]]){var _0x15b2fa=_[_0x4bc4('0x78')](this[_0x4bc4('0x11')][_0x1c09db[_0x4bc4('0x45')]]);_0x15b2fa[_0x4bc4('0x81')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x15b2fa['connectedlinenum']=_0x1c09db[_0x4bc4('0x82')];_0x15b2fa[_0x4bc4('0x83')]=_0x1c09db[_0x4bc4('0x83')];logger[_0x4bc4('0x65')](_0x4bc4('0x84'),_0x15b2fa[_0x4bc4('0x4a')],_0x15b2fa['type'],_0x1c09db[_0x4bc4('0x82')],_0x1c09db[_0x4bc4('0x83')]);this['channels'][_0x1c09db['uniqueid']]=_0x15b2fa;this[_0x4bc4('0x42')](_0x15b2fa,_0x4bc4('0x1f'));}}}catch(_0x286e7a){logger[_0x4bc4('0x3a')](_0x4bc4('0x80'),_0x1c09db[_0x4bc4('0x45')],util['inspect'](_0x286e7a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4bc4('0xc')][_0x4bc4('0x24')]=function(_0x3d5442){try{if(this[_0x4bc4('0x51')](_0x3d5442)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x3d5442['uniqueid'],util[_0x4bc4('0x3b')](_0x3d5442,{'showHidden':![],'depth':null}));if(this[_0x4bc4('0x11')][_0x3d5442[_0x4bc4('0x45')]]){var _0x6716ee=_['last'](this['queueReports'][_0x3d5442['uniqueid']]);_0x6716ee[_0x4bc4('0x79')]=!![];_0x6716ee[_0x4bc4('0x7d')]=_0x4bc4('0x85');logger['info']('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x6716ee[_0x4bc4('0x4a')],_0x6716ee[_0x4bc4('0x4d')]);}}}catch(_0x4b5d03){logger[_0x4bc4('0x3a')](_0x4bc4('0x86'),_0x3d5442[_0x4bc4('0x45')],util[_0x4bc4('0x3b')](_0x4b5d03,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4bc4('0xc')][_0x4bc4('0x22')]=function(_0x1b902a){try{if(this[_0x4bc4('0x51')](_0x1b902a)){logger[_0x4bc4('0x43')](_0x4bc4('0x87'),_0x1b902a[_0x4bc4('0x45')],util[_0x4bc4('0x3b')](_0x1b902a,{'showHidden':![],'depth':null}));if(this[_0x4bc4('0x11')][_0x1b902a[_0x4bc4('0x45')]]){var _0x20bdec=_[_0x4bc4('0x78')](this['queueReports'][_0x1b902a[_0x4bc4('0x45')]]);_0x20bdec['queuecallerabandon']=![];_0x20bdec[_0x4bc4('0x7c')]=null;_0x20bdec['assigned']=!![];_0x20bdec['lastAssignedTo']=_0x1b902a[_0x4bc4('0x88')];_0x20bdec[_0x4bc4('0x89')]=_0x1b902a[_0x4bc4('0x89')];_0x20bdec[_0x4bc4('0x79')]=!![];_0x20bdec[_0x4bc4('0x8a')]=![];_0x20bdec[_0x4bc4('0x8b')]=null;if(!_0x20bdec[_0x4bc4('0x8c')]){if(_0x1b902a[_0x4bc4('0x8d')]==_0x4bc4('0x8c')){_0x20bdec[_0x4bc4('0x7d')]='COMPLETED';logger[_0x4bc4('0x65')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x20bdec[_0x4bc4('0x4a')],_0x20bdec[_0x4bc4('0x4d')]);}else{if(_[_0x4bc4('0x8e')](_0x1b902a[_0x4bc4('0x8f')][_0x4bc4('0x90')](),'local/')){if(this['queueReports'][_0x1b902a[_0x4bc4('0x91')]]){var _0x1a340b=_[_0x4bc4('0x78')](this[_0x4bc4('0x11')][_0x1b902a[_0x4bc4('0x91')]]);_0x1a340b[_0x4bc4('0x79')]=![];_0x1a340b[_0x4bc4('0x8a')]=!![];_0x1a340b[_0x4bc4('0x8b')]=moment(_0x20bdec[_0x4bc4('0x6c')])['add'](_0x1b902a[_0x4bc4('0x89')],'seconds')[_0x4bc4('0x49')](_0x4bc4('0x6d'));_0x1a340b['queuecallerexitreason']=_0x4bc4('0x92');_0x1a340b[_0x4bc4('0x8c')]=!![];_0x1a340b[_0x4bc4('0x93')]='FORWARD';_0x1a340b['transferexten']=_0x1b902a['destexten'];_0x1a340b['transferuniqueid']=_0x1b902a[_0x4bc4('0x45')];logger[_0x4bc4('0x65')](_0x4bc4('0x94'),_0x1a340b[_0x4bc4('0x4a')],_0x1a340b['type']);var _0x3bd61e=this[_0x4bc4('0x11')][_0x1b902a[_0x4bc4('0x91')]];this[_0x4bc4('0x11')][_0x1b902a['linkedid']]=this[_0x4bc4('0x11')][_0x1b902a[_0x4bc4('0x45')]];this[_0x4bc4('0x11')][_0x1b902a[_0x4bc4('0x45')]]=_0x3bd61e;}}else{_0x20bdec[_0x4bc4('0x7d')]=_0x4bc4('0x95')+_0x1b902a[_0x4bc4('0x8d')][_0x4bc4('0x96')]();logger['info'](_0x4bc4('0x97'),_0x20bdec[_0x4bc4('0x4a')],_0x20bdec[_0x4bc4('0x4d')],_0x20bdec['queuecallerexitreason']);}}}this[_0x4bc4('0x14')][_0x1b902a[_0x4bc4('0x45')]]=_0x20bdec;this['emitVoiceQueueChannelRemove'](_0x20bdec,'agentcomplete');}}}catch(_0x3511bf){logger[_0x4bc4('0x3a')]('[%s][voiceQueueReport][agentcomplete]',_0x1b902a[_0x4bc4('0x45')],util[_0x4bc4('0x3b')](_0x3511bf,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4bc4('0xc')][_0x4bc4('0x98')]=function(_0x29c16b){try{if(this[_0x4bc4('0x51')](_0x29c16b)){logger[_0x4bc4('0x43')]('[%s][voiceQueueReport][varset]',_0x29c16b[_0x4bc4('0x45')],util['inspect'](_0x29c16b,{'showHidden':![],'depth':null}));this[_0x4bc4('0x99')](_0x29c16b[_0x4bc4('0x45')],_[_0x4bc4('0x74')](_0x29c16b[_0x4bc4('0x9a')])[0x0],_0x29c16b[_0x4bc4('0x9b')]);if(this[_0x4bc4('0x11')][_0x29c16b['uniqueid']]){var _0x5d8a67=_[_0x4bc4('0x78')](this[_0x4bc4('0x11')][_0x29c16b[_0x4bc4('0x45')]]);if(_0x5d8a67){if(this[_0x4bc4('0x51')](_0x29c16b[_0x4bc4('0x9a')])&&this[_0x4bc4('0x51')](_0x29c16b[_0x4bc4('0x9a')][_0x4bc4('0x57')])){switch(_0x29c16b[_0x4bc4('0x9b')]){case _0x4bc4('0x9c'):_0x5d8a67[_0x4bc4('0x8a')]=![];_0x5d8a67['queuecallerexitAt']=null;break;case _0x4bc4('0x9d'):_0x5d8a67[_0x4bc4('0x9e')]='timeout';_0x5d8a67['queuecallerexit']=!![];_0x5d8a67['queuecallerexitAt']=moment()['format'](_0x4bc4('0x6d'));_0x5d8a67[_0x4bc4('0x81')]=moment()[_0x4bc4('0x49')](_0x4bc4('0x6d'));logger['debug'](_0x4bc4('0x9f'),_0x29c16b[_0x4bc4('0x45')],util[_0x4bc4('0x3b')](_0x5d8a67,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x5d8a67);break;default:_0x5d8a67[_0x4bc4('0x8a')]=!![];_0x5d8a67[_0x4bc4('0x8b')]=moment()[_0x4bc4('0x49')](_0x4bc4('0x6d'));_0x5d8a67[_0x4bc4('0x81')]=moment()[_0x4bc4('0x49')](_0x4bc4('0x6d'));}_0x5d8a67[_0x4bc4('0xa0')]=![];_0x5d8a67['queuecallerabandonAt']=null;_0x5d8a67[_0x4bc4('0x7d')]=_0x29c16b[_0x4bc4('0x9b')];this[_0x4bc4('0x14')][_0x29c16b[_0x4bc4('0x45')]]=_0x5d8a67;this[_0x4bc4('0x40')](_0x5d8a67,_0x4bc4('0x25'));}else if(this[_0x4bc4('0x51')](_0x29c16b['variable'])&&this[_0x4bc4('0x51')](_0x29c16b[_0x4bc4('0x9a')][_0x4bc4('0xa1')])){if(!_0x5d8a67[_0x4bc4('0xa0')]){_0x5d8a67[_0x4bc4('0x8a')]=!![];_0x5d8a67[_0x4bc4('0x8b')]=moment()[_0x4bc4('0x49')](_0x4bc4('0x6d'));_0x5d8a67[_0x4bc4('0x7d')]=_0x4bc4('0xa2');_0x5d8a67['queuecallerleaveAt']=moment()['format'](_0x4bc4('0x6d'));this[_0x4bc4('0x14')][_0x29c16b[_0x4bc4('0x45')]]=_0x5d8a67;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x29c16b[_0x4bc4('0x45')],_0x5d8a67[_0x4bc4('0x4a')],_0x5d8a67[_0x4bc4('0x4d')],_[_0x4bc4('0x74')](_0x29c16b[_0x4bc4('0x9a')])[0x0],_0x29c16b[_0x4bc4('0x9b')]);_0x5d8a67['variables']=this['variables'][_0x29c16b[_0x4bc4('0x45')]];}}}}catch(_0x761177){logger['error']('[%s][voiceQueueReport][varset]',_0x29c16b[_0x4bc4('0x45')],util[_0x4bc4('0x3b')](_0x761177,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4bc4('0xc')]['addVariable']=function(_0xcc0059,_0x53f1ad,_0x45127e){var _0x485b4b=[_0x4bc4('0xa3'),_0x4bc4('0xa4'),'rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss',_0x4bc4('0xa5'),_0x4bc4('0xa6'),'rtpaudioqosrttbridged',_0x4bc4('0xa7'),_0x4bc4('0xa8'),_0x4bc4('0xa9'),_0x4bc4('0xaa'),_0x4bc4('0xab'),_0x4bc4('0xac'),'memberinterface',_0x4bc4('0xad'),_0x4bc4('0x88'),_0x4bc4('0xae'),_0x4bc4('0xaf')];if(!_[_0x4bc4('0x34')](_0x53f1ad)&&!_[_0x4bc4('0xb0')](_0x485b4b,_0x53f1ad)){if(_['isUndefined'](this[_0x4bc4('0x3d')][_0xcc0059])){this['variables'][_0xcc0059]={};}this[_0x4bc4('0x3d')][_0xcc0059][_0x53f1ad]=_0x45127e;}};VoiceQueueReport[_0x4bc4('0xc')][_0x4bc4('0xb1')]=function(_0x100709,_0x52b2e8,_0x4e58b9){var _0x492a72={};for(var _0x52cdc9=0x0;_0x52cdc90x0?!![]:![];if(!_0x5618a5){return this[_0x237b('0x17')](this['summary'][_0x237b('0x6c')]);}};VoiceQueueReport[_0x237b('0xa')][_0x237b('0x6d')]=function(_0x3d35fa){var _0x496bf8=this[_0x237b('0x45')]['id'];if(this['summary'][_0x237b('0x61')][_0x496bf8]&&this[_0x237b('0x45')]['queuestatus'][_0x496bf8][_0x3d35fa[_0x237b('0x5f')]]){this[_0x237b('0x45')][_0x237b('0x61')][_0x496bf8][_0x3d35fa[_0x237b('0x5f')]][_0x237b('0x11')]['push'](_0x3d35fa);}};VoiceQueueReport[_0x237b('0xa')][_0x237b('0x15')]=function(_0x585c39){var _0x40344b=this;try{if(this[_0x237b('0x59')](_0x585c39)&&this[_0x237b('0x59')](_0x585c39['queue'])){logger[_0x237b('0x54')](_0x237b('0x6e'),util[_0x237b('0x3f')](_0x585c39,{'showHidden':![],'depth':null}));var _0x133b38=this[_0x237b('0x12')][_0x585c39[_0x237b('0x4c')]];if(_0x133b38){logger['info']('[voiceQueueReport][queuesummary]\x20name:%s',_0x133b38[_0x237b('0x57')]);this[_0x237b('0x45')][_0x237b('0x5b')][_0x133b38['name']]={'summaryEvent':_0x585c39};this[_0x237b('0x45')][_0x237b('0x6b')]+=0x1;return ami['Action']({'action':_0x237b('0x61'),'queue':_0x133b38['name']})['then'](function(_0x1d06f1){if(!_0x40344b['summary'][_0x237b('0x61')][_0x585c39[_0x237b('0x5f')]]){_0x40344b[_0x237b('0x45')][_0x237b('0x61')][_0x585c39['actionid']]={};}_0x40344b[_0x237b('0x45')][_0x237b('0x61')][_0x585c39[_0x237b('0x5f')]][_0x1d06f1[_0x237b('0x5f')]]={'queue':_0x133b38['name'],'agents':[]};})[_0x237b('0x3c')](function(_0x5a1ed1){throw _0x5a1ed1;});}}}catch(_0x1d0fe8){logger['error'](_0x237b('0x62'),util['inspect'](_0x1d0fe8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x237b('0x17')]=function(_0x178f36){if(this[_0x237b('0x45')][_0x237b('0x6b')]>0x0){this[_0x237b('0x45')][_0x237b('0x6c')]=_0x178f36;return;}logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x237b('0x3f')](_0x178f36,{'showHidden':![],'depth':null}));this[_0x237b('0x45')]=initializeSummary();ami[_0x237b('0x48')](_0x237b('0x6f'),{});};VoiceQueueReport['prototype'][_0x237b('0x1c')]=function(_0x46ca1c){try{if(this[_0x237b('0x59')](_0x46ca1c)){logger['debug'](_0x237b('0x70'),_0x46ca1c[_0x237b('0x4a')],util[_0x237b('0x3f')](_0x46ca1c,{'showHidden':![],'depth':null}));if(_[_0x237b('0x71')](this[_0x237b('0xf')][_0x46ca1c[_0x237b('0x4a')]])){this['queueReports'][_0x46ca1c[_0x237b('0x4a')]]=[];}if(_[_0x237b('0x71')](this[_0x237b('0x37')][_0x46ca1c['uniqueid']])){this[_0x237b('0x37')][_0x46ca1c[_0x237b('0x4a')]]={};}var _0x1c390d=new QueueReport();_0x1c390d[_0x237b('0x4c')]=_0x46ca1c[_0x237b('0x4c')];_0x1c390d[_0x237b('0x52')]=this[_0x237b('0x12')][_0x1c390d[_0x237b('0x4c')]]&&this[_0x237b('0x12')][_0x1c390d['queue']][_0x237b('0x52')]?this[_0x237b('0x12')][_0x1c390d[_0x237b('0x4c')]]['type']||_0x237b('0x53'):'inbound';_0x1c390d['queuecallerjoinAt']=moment()['format'](_0x237b('0x72'));_0x1c390d['position']=_0x46ca1c[_0x237b('0x73')];_0x1c390d[_0x237b('0x74')]=_0x46ca1c[_0x237b('0x74')];_0x1c390d['uniqueid']=_0x46ca1c[_0x237b('0x4a')];_0x1c390d[_0x237b('0x75')]=this[_0x237b('0x37')][_0x46ca1c['uniqueid']]['routealias'];logger[_0x237b('0x76')](_0x237b('0x77'),_0x1c390d[_0x237b('0x4c')],_0x1c390d[_0x237b('0x52')]);_[_0x237b('0x78')](_0x1c390d,_[_0x237b('0x79')](_0x46ca1c,_['keys'](_0x1c390d)));this[_0x237b('0xf')][_0x46ca1c[_0x237b('0x4a')]][_0x237b('0x7a')](_0x1c390d);this['channels'][_0x46ca1c['uniqueid']]=_0x1c390d;this[_0x237b('0x7b')](_0x1c390d,_0x237b('0x1b'));}}catch(_0x2dcf0f){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x46ca1c[_0x237b('0x4a')],util['inspect'](_0x2dcf0f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x237b('0xa')][_0x237b('0x1e')]=function(_0x3b29f6){try{if(this['isNotNull'](_0x3b29f6)){logger[_0x237b('0x54')]('[%s][voiceQueueReport][queuecallerabandon]',_0x3b29f6[_0x237b('0x4a')],util[_0x237b('0x3f')](_0x3b29f6,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3b29f6[_0x237b('0x4a')]]){var _0x1ba1b0=_[_0x237b('0x7c')](this['queueReports'][_0x3b29f6[_0x237b('0x4a')]]);_0x1ba1b0[_0x237b('0x7d')]=![];_0x1ba1b0[_0x237b('0x7e')]=null;_0x1ba1b0['holdtime']=_0x3b29f6['holdtime'];_0x1ba1b0[_0x237b('0x7f')]=_0x3b29f6[_0x237b('0x7f')];_0x1ba1b0[_0x237b('0x1d')]=!![];_0x1ba1b0[_0x237b('0x80')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1ba1b0[_0x237b('0x81')]=_0x237b('0x82');_0x1ba1b0[_0x237b('0x83')]=null;logger[_0x237b('0x76')](_0x237b('0x84'),_0x1ba1b0[_0x237b('0x4c')],_0x1ba1b0[_0x237b('0x52')]);this['channels'][_0x3b29f6[_0x237b('0x4a')]]=_0x1ba1b0;this[_0x237b('0x46')](_0x1ba1b0,_0x237b('0x1d'));}}}catch(_0x71d4ee){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x3b29f6[_0x237b('0x4a')],util['inspect'](_0x71d4ee,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x237b('0xa')][_0x237b('0x85')]=function(_0x4883ef){try{if(this[_0x237b('0x59')](_0x4883ef)){logger[_0x237b('0x54')](_0x237b('0x86'),_0x4883ef['uniqueid'],util[_0x237b('0x3f')](_0x4883ef,{'showHidden':![],'depth':null}));if(this[_0x237b('0xf')][_0x4883ef[_0x237b('0x4a')]]){var _0x481a50=_['last'](this[_0x237b('0xf')][_0x4883ef['uniqueid']]);_0x481a50[_0x237b('0x87')]=moment()['format'](_0x237b('0x72'));_0x481a50[_0x237b('0x88')]=_0x4883ef[_0x237b('0x88')];_0x481a50[_0x237b('0x89')]=_0x4883ef[_0x237b('0x89')];logger[_0x237b('0x76')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x481a50[_0x237b('0x4c')],_0x481a50['type'],_0x4883ef[_0x237b('0x88')],_0x4883ef[_0x237b('0x89')]);this[_0x237b('0x37')][_0x4883ef[_0x237b('0x4a')]]=_0x481a50;this['emitVoiceQueueChannelSave'](_0x481a50,_0x237b('0x1f'));}}}catch(_0x3ce223){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x4883ef[_0x237b('0x4a')],util[_0x237b('0x3f')](_0x3ce223,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x237b('0x23')]=function(_0x1ba630){try{if(this[_0x237b('0x59')](_0x1ba630)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x1ba630[_0x237b('0x4a')],util['inspect'](_0x1ba630,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1ba630[_0x237b('0x4a')]]){var _0x1c5b50=_[_0x237b('0x7c')](this[_0x237b('0xf')][_0x1ba630[_0x237b('0x4a')]]);_0x1c5b50[_0x237b('0x7d')]=!![];_0x1c5b50[_0x237b('0x81')]=_0x237b('0x8a');logger[_0x237b('0x76')](_0x237b('0x8b'),_0x1c5b50['queue'],_0x1c5b50[_0x237b('0x52')]);}}}catch(_0xfcf100){logger[_0x237b('0x3d')](_0x237b('0x8c'),_0x1ba630[_0x237b('0x4a')],util[_0x237b('0x3f')](_0xfcf100,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x237b('0xa')][_0x237b('0x21')]=function(_0x1524de){try{if(this['isNotNull'](_0x1524de)){logger[_0x237b('0x54')](_0x237b('0x8d'),_0x1524de['uniqueid'],util['inspect'](_0x1524de,{'showHidden':![],'depth':null}));if(this[_0x237b('0xf')][_0x1524de[_0x237b('0x4a')]]){var _0x22adfd=_[_0x237b('0x7c')](this[_0x237b('0xf')][_0x1524de['uniqueid']]);_0x22adfd[_0x237b('0x1d')]=![];_0x22adfd['queuecallerabandonAt']=null;_0x22adfd['assigned']=!![];_0x22adfd[_0x237b('0x83')]=_0x1524de['membername'];_0x22adfd[_0x237b('0x8e')]=_0x1524de[_0x237b('0x8e')];_0x22adfd['queuecallercomplete']=!![];_0x22adfd[_0x237b('0x8f')]=![];_0x22adfd[_0x237b('0x90')]=null;if(!_0x22adfd[_0x237b('0x91')]){if(_0x1524de['reason']==_0x237b('0x91')){_0x22adfd[_0x237b('0x81')]='COMPLETED';logger[_0x237b('0x76')](_0x237b('0x92'),_0x22adfd[_0x237b('0x4c')],_0x22adfd['type']);}else{if(_[_0x237b('0x93')](_0x1524de[_0x237b('0x3b')][_0x237b('0x94')](),'local/')){if(this['queueReports'][_0x1524de['linkedid']]){var _0xf6504d=_['last'](this[_0x237b('0xf')][_0x1524de['linkedid']]);_0xf6504d[_0x237b('0x7d')]=![];_0xf6504d[_0x237b('0x8f')]=!![];_0xf6504d[_0x237b('0x90')]=moment(_0x22adfd[_0x237b('0x95')])[_0x237b('0x96')](_0x1524de[_0x237b('0x8e')],_0x237b('0x97'))[_0x237b('0x56')](_0x237b('0x72'));_0xf6504d['queuecallerexitreason']='FORWARDTRANSFER';_0xf6504d['transfer']=!![];_0xf6504d[_0x237b('0x98')]=_0x237b('0x99');_0xf6504d[_0x237b('0x9a')]=_0x1524de['destexten'];_0xf6504d['transferuniqueid']=_0x1524de[_0x237b('0x4a')];logger[_0x237b('0x76')](_0x237b('0x9b'),_0xf6504d[_0x237b('0x4c')],_0xf6504d[_0x237b('0x52')]);var _0x278fcc=this['queueReports'][_0x1524de[_0x237b('0x9c')]];this[_0x237b('0xf')][_0x1524de[_0x237b('0x9c')]]=this[_0x237b('0xf')][_0x1524de[_0x237b('0x4a')]];this['queueReports'][_0x1524de['uniqueid']]=_0x278fcc;}}else{_0x22adfd[_0x237b('0x81')]=_0x237b('0x9d')+_0x1524de[_0x237b('0x9e')][_0x237b('0x9f')]();logger[_0x237b('0x76')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x22adfd[_0x237b('0x4c')],_0x22adfd[_0x237b('0x52')],_0x22adfd[_0x237b('0x81')]);}}}this[_0x237b('0x37')][_0x1524de['uniqueid']]=_0x22adfd;this['emitVoiceQueueChannelRemove'](_0x22adfd,_0x237b('0x20'));}}}catch(_0x262781){logger[_0x237b('0x3d')](_0x237b('0x8d'),_0x1524de['uniqueid'],util[_0x237b('0x3f')](_0x262781,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x237b('0xa0')]=function(_0x479cf0){try{if(this[_0x237b('0x59')](_0x479cf0)){logger['debug'](_0x237b('0xa1'),_0x479cf0['uniqueid'],util['inspect'](_0x479cf0,{'showHidden':![],'depth':null}));this['addVariable'](_0x479cf0[_0x237b('0x4a')],_[_0x237b('0xa2')](_0x479cf0[_0x237b('0xa3')])[0x0],_0x479cf0[_0x237b('0xa4')]);if(this[_0x237b('0xf')][_0x479cf0[_0x237b('0x4a')]]){var _0x55aaa9=_['last'](this[_0x237b('0xf')][_0x479cf0[_0x237b('0x4a')]]);if(_0x55aaa9){if(this[_0x237b('0x59')](_0x479cf0[_0x237b('0xa3')])&&this[_0x237b('0x59')](_0x479cf0[_0x237b('0xa3')][_0x237b('0x61')])){switch(_0x479cf0[_0x237b('0xa4')]){case'CONTINUE':_0x55aaa9[_0x237b('0x8f')]=![];_0x55aaa9[_0x237b('0x90')]=null;break;case _0x237b('0xa5'):_0x55aaa9[_0x237b('0xa6')]=_0x237b('0xa7');_0x55aaa9[_0x237b('0x8f')]=!![];_0x55aaa9[_0x237b('0x90')]=moment()[_0x237b('0x56')](_0x237b('0x72'));_0x55aaa9[_0x237b('0x87')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0x237b('0x54')](_0x237b('0xa8'),_0x479cf0[_0x237b('0x4a')],util[_0x237b('0x3f')](_0x55aaa9,{'showHidden':![],'depth':null}));ami[_0x237b('0x48')](_0x237b('0xa9'),_0x55aaa9);break;default:_0x55aaa9[_0x237b('0x8f')]=!![];_0x55aaa9['queuecallerexitAt']=moment()[_0x237b('0x56')](_0x237b('0x72'));_0x55aaa9[_0x237b('0x87')]=moment()[_0x237b('0x56')](_0x237b('0x72'));}_0x55aaa9[_0x237b('0x1d')]=![];_0x55aaa9[_0x237b('0x80')]=null;_0x55aaa9[_0x237b('0x81')]=_0x479cf0[_0x237b('0xa4')];this[_0x237b('0x37')][_0x479cf0[_0x237b('0x4a')]]=_0x55aaa9;this['emitVoiceQueueChannelRemove'](_0x55aaa9,_0x237b('0x24'));}else if(this[_0x237b('0x59')](_0x479cf0[_0x237b('0xa3')])&&this['isNotNull'](_0x479cf0['variable'][_0x237b('0xaa')])){if(!_0x55aaa9['queuecallerabandon']){_0x55aaa9[_0x237b('0x8f')]=!![];_0x55aaa9[_0x237b('0x90')]=moment()[_0x237b('0x56')](_0x237b('0x72'));_0x55aaa9['queuecallerexitreason']=_0x237b('0xab');_0x55aaa9[_0x237b('0x87')]=moment()[_0x237b('0x56')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x237b('0x37')][_0x479cf0['uniqueid']]=_0x55aaa9;}}logger[_0x237b('0x76')](_0x237b('0xac'),_0x479cf0[_0x237b('0x4a')],_0x55aaa9['queue'],_0x55aaa9[_0x237b('0x52')],_[_0x237b('0xa2')](_0x479cf0[_0x237b('0xa3')])[0x0],_0x479cf0['value']);_0x55aaa9['variables']=this[_0x237b('0x13')][_0x479cf0[_0x237b('0x4a')]];}}}}catch(_0x1975a6){logger[_0x237b('0x3d')](_0x237b('0xa1'),_0x479cf0[_0x237b('0x4a')],util[_0x237b('0x3f')](_0x1975a6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x237b('0xa')][_0x237b('0xad')]=function(_0x415dec,_0x1d5fb1,_0x1ffee4){var _0x59049a=[_0x237b('0xae'),'rtpaudioqosbridged',_0x237b('0xaf'),_0x237b('0xb0'),_0x237b('0xb1'),'rtpaudioqoslossbridged',_0x237b('0xb2'),'rtpaudioqosrttbridged',_0x237b('0xb3'),'sipuri','bridgepeer',_0x237b('0xb4'),_0x237b('0xb5'),_0x237b('0xb6'),_0x237b('0xb7'),_0x237b('0xb8'),_0x237b('0xb9'),_0x237b('0xba'),'memberrealtime'];if(!_['isNil'](_0x1d5fb1)&&!_['includes'](_0x59049a,_0x1d5fb1)){if(_[_0x237b('0x71')](this[_0x237b('0x13')][_0x415dec])){this['variables'][_0x415dec]={};}this[_0x237b('0x13')][_0x415dec][_0x1d5fb1]=_0x1ffee4;}};VoiceQueueReport[_0x237b('0xa')][_0x237b('0xbb')]=function(_0x225ff3,_0xb81423,_0x5749a4){var _0xd27cec={};for(var _0x1c196e=0x0;_0x1c196e=0x0?moment(_0x3c0fba['endtime'])[_0x2da2('0xf')](_0x3c0fba[_0x2da2('0x1c')],_0x2da2('0x10')):null,'data1':_0x2da2('0x1e'),'data2':_0x3c0fba[_0x2da2('0x16')],'data3':_0x3c0fba[_0x2da2('0x13')],'data4':_0x3c0fba[_0x2da2('0x1f')]||null,'role':_0x2da2('0x15'),'internal':_0x3c0fba[_0x2da2('0x16')]?_['toNumber'](_0x3c0fba['accountcode']):undefined,'uniqueid':_0x3c0fba[_0x2da2('0x18')]},'log':_0x2da2('0x19')});}; \ No newline at end of file +var _0x9cf0=['diff','outbound','exten','dialstring','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','CreateMemberReport','voice','lastAssignedTo','isNil','format','SIP/%s','interface','TALKING','queuecallerleaveAt','inbound','calleridnum','queue','agent','accountcode','toNumber','voiceDialReport','Request','endtime','starttime'];(function(_0x1755f8,_0xda1d06){var _0x173584=function(_0x20a0ae){while(--_0x20a0ae){_0x1755f8['push'](_0x1755f8['shift']());}};_0x173584(++_0xda1d06);}(_0x9cf0,0xd6));var _0x09cf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9cf0[_0xa464c9];return _0x3d73c4;};'use strict';var moment=require(_0x09cf('0x0'));var _=require(_0x09cf('0x1'));var util=require(_0x09cf('0x2'));var client=require(_0x09cf('0x3'));exports[_0x09cf('0x4')]=function(_0x1af8cd){var _0x5a6c4a=_0x1af8cd[_0x09cf('0x5')]||_0x1af8cd[_0x09cf('0x6')];return client['Request'](_0x09cf('0x7'),{'body':{'channel':_0x09cf('0x8'),'membername':_0x1af8cd[_0x09cf('0x9')],'interface':_[_0x09cf('0xa')](_0x1af8cd['interface'])?util[_0x09cf('0xb')](_0x09cf('0xc'),_0x1af8cd[_0x09cf('0x9')]):_0x1af8cd[_0x09cf('0xd')],'type':_0x09cf('0xe'),'enterAt':_0x1af8cd[_0x09cf('0xf')],'exitAt':_0x5a6c4a,'duration':moment(_0x5a6c4a)['diff'](_0x1af8cd[_0x09cf('0xf')],'seconds'),'data1':_0x09cf('0x10'),'data2':_0x1af8cd[_0x09cf('0x11')],'data3':_0x1af8cd['exten'],'data4':null,'data5':_0x1af8cd[_0x09cf('0x12')],'role':_0x09cf('0x13'),'internal':_0x1af8cd[_0x09cf('0x14')]?_[_0x09cf('0x15')](_0x1af8cd[_0x09cf('0x14')]):undefined,'uniqueid':_0x1af8cd['uniqueid']},'log':_0x09cf('0x7')});};exports[_0x09cf('0x16')]=function(_0x3c2767){return client[_0x09cf('0x17')](_0x09cf('0x7'),{'body':{'channel':_0x09cf('0x8'),'membername':_0x3c2767['membername'],'interface':_0x3c2767[_0x09cf('0xd')],'type':'TALKING','enterAt':_0x3c2767['starttime'],'exitAt':_0x3c2767[_0x09cf('0x18')],'duration':moment(_0x3c2767[_0x09cf('0x18')])['diff'](_0x3c2767[_0x09cf('0x19')],'seconds')>=0x0?moment(_0x3c2767[_0x09cf('0x18')])[_0x09cf('0x1a')](_0x3c2767['starttime'],'seconds'):null,'data1':_0x09cf('0x1b'),'data2':_0x3c2767[_0x09cf('0x14')],'data3':_0x3c2767[_0x09cf('0x1c')],'data4':_0x3c2767[_0x09cf('0x1d')]||null,'role':_0x09cf('0x13'),'internal':_0x3c2767['accountcode']?_[_0x09cf('0x15')](_0x3c2767[_0x09cf('0x14')]):undefined,'uniqueid':_0x3c2767['uniqueid']},'log':_0x09cf('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 11255d0..92760d7 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 _0x9458=['Request','previewRecallmeReminderInterval'];(function(_0x26bcf5,_0x139137){var _0x3eab51=function(_0x30b99e){while(--_0x30b99e){_0x26bcf5['push'](_0x26bcf5['shift']());}};_0x3eab51(++_0x139137);}(_0x9458,0x1b8));var _0x8945=function(_0x23d5d1,_0x52cbc5){_0x23d5d1=_0x23d5d1-0x0;var _0x195b7a=_0x9458[_0x23d5d1];return _0x195b7a;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x8945('0x0')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x8945('0x1')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x40ac=['ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','Request'];(function(_0xd04b50,_0x3d635d){var _0x5de236=function(_0x9129b1){while(--_0x9129b1){_0xd04b50['push'](_0xd04b50['shift']());}};_0x5de236(++_0x3d635d);}(_0x40ac,0x1de));var _0xc40a=function(_0x5e0e90,_0x1c8363){_0x5e0e90=_0x5e0e90-0x0;var _0x33cfe3=_0x40ac[_0x5e0e90];return _0x33cfe3;};'use strict';var client=require(_0xc40a('0x0'));exports['getSettings']=function(){return client[_0xc40a('0x1')](_0xc40a('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc40a('0x3'),_0xc40a('0x4')]},'log':_0xc40a('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index f92c319..2ae61de 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 _0x4b4b=['../client','Request','GetTemplate','name','html'];(function(_0x12dc87,_0x2a3151){var _0x3d59a5=function(_0x2d42b8){while(--_0x2d42b8){_0x12dc87['push'](_0x12dc87['shift']());}};_0x3d59a5(++_0x2a3151);}(_0x4b4b,0x96));var _0xb4b4=function(_0x45ec71,_0x31ca8b){_0x45ec71=_0x45ec71-0x0;var _0x386f82=_0x4b4b[_0x45ec71];return _0x386f82;};'use strict';var client=require(_0xb4b4('0x0'));exports['getTemplates']=function(_0x3d9128){return function(_0x5c56d5){return client[_0xb4b4('0x1')](_0xb4b4('0x2'),{'options':{'raw':!![],'attributes':['id',_0xb4b4('0x3'),_0xb4b4('0x4')]},'log':_0xb4b4('0x2')});};}; \ No newline at end of file +var _0xcd2e=['html','getTemplates','Request','GetTemplate','name'];(function(_0xa895e7,_0x3d969d){var _0x41abe0=function(_0x7a9b69){while(--_0x7a9b69){_0xa895e7['push'](_0xa895e7['shift']());}};_0x41abe0(++_0x3d969d);}(_0xcd2e,0xfb));var _0xecd2=function(_0xce6f11,_0x3c3137){_0xce6f11=_0xce6f11-0x0;var _0x35b709=_0xcd2e[_0xce6f11];return _0x35b709;};'use strict';var client=require('../client');exports[_0xecd2('0x0')]=function(_0x217807){return function(_0x3abfbd){return client[_0xecd2('0x1')](_0xecd2('0x2'),{'options':{'raw':!![],'attributes':['id',_0xecd2('0x3'),_0xecd2('0x4')]},'log':_0xecd2('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 14b68ee..4424ffb 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 _0xbf10=['data1','data2','data3','data5','data7','../client','getTriggers','Request','GetTrigger','Condition','field','value','AnyConditions','operator','Action','Actions','action'];(function(_0x1e6fe6,_0x5b8a59){var _0x12a4c7=function(_0x439534){while(--_0x439534){_0x1e6fe6['push'](_0x1e6fe6['shift']());}};_0x12a4c7(++_0x5b8a59);}(_0xbf10,0x137));var _0x0bf1=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xbf10[_0xd1d19a];return _0x52a79d;};'use strict';var client=require(_0x0bf1('0x0'));exports[_0x0bf1('0x1')]=function(_0x3786f5){return function(_0x6e2104){return client[_0x0bf1('0x2')](_0x0bf1('0x3'),{'options':{'raw':![],'attributes':['id','name','channel','status'],'include':[{'model':_0x0bf1('0x4'),'as':'AllConditions','attributes':['id',_0x0bf1('0x5'),'operator',_0x0bf1('0x6')]},{'model':_0x0bf1('0x4'),'as':_0x0bf1('0x7'),'attributes':['id',_0x0bf1('0x5'),_0x0bf1('0x8'),'value']},{'model':_0x0bf1('0x9'),'as':_0x0bf1('0xa'),'attributes':['id',_0x0bf1('0xb'),_0x0bf1('0xc'),_0x0bf1('0xd'),_0x0bf1('0xe'),'data4',_0x0bf1('0xf'),'data6',_0x0bf1('0x10')]}]},'log':_0x0bf1('0x3')});};}; \ No newline at end of file +var _0x45a8=['Condition','AnyConditions','value','Actions','action','data1','data2','data3','data4','data5','data6','GetTrigger','../client','getTriggers','Request','name','channel','AllConditions','field','operator'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x45a8,0x1b0));var _0x845a=function(_0x264ee4,_0x2986a6){_0x264ee4=_0x264ee4-0x0;var _0x1cda8e=_0x45a8[_0x264ee4];return _0x1cda8e;};'use strict';var client=require(_0x845a('0x0'));exports[_0x845a('0x1')]=function(_0x386a91){return function(_0x52f5e5){return client[_0x845a('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x845a('0x3'),_0x845a('0x4'),'status'],'include':[{'model':'Condition','as':_0x845a('0x5'),'attributes':['id',_0x845a('0x6'),_0x845a('0x7'),'value']},{'model':_0x845a('0x8'),'as':_0x845a('0x9'),'attributes':['id',_0x845a('0x6'),_0x845a('0x7'),_0x845a('0xa')]},{'model':'Action','as':_0x845a('0xb'),'attributes':['id',_0x845a('0xc'),_0x845a('0xd'),_0x845a('0xe'),_0x845a('0xf'),_0x845a('0x10'),_0x845a('0x11'),_0x845a('0x12'),'data7']}]},'log':_0x845a('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index fdff660..9fa22d1 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 _0xe134=['name','registry','GetTrunk','../client','Request'];(function(_0x2e991e,_0x1dbbf3){var _0x30e469=function(_0x352ff8){while(--_0x352ff8){_0x2e991e['push'](_0x2e991e['shift']());}};_0x30e469(++_0x1dbbf3);}(_0xe134,0x102));var _0x4e13=function(_0x2626e5,_0x3b0bd6){_0x2626e5=_0x2626e5-0x0;var _0x53fb71=_0xe134[_0x2626e5];return _0x53fb71;};'use strict';var client=require(_0x4e13('0x0'));exports['getTrunks']=function(_0x2c4834){return function(_0x5e00b5){return client[_0x4e13('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x4e13('0x2'),_0x4e13('0x3'),'defaultuser']},'log':_0x4e13('0x4')});};}; \ No newline at end of file +var _0x3525=['getTrunks','Request','GetTrunk','name','registry','../client'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0x3525,0x143));var _0x5352=function(_0x8beed2,_0xd5bf4b){_0x8beed2=_0x8beed2-0x0;var _0x481ed9=_0x3525[_0x8beed2];return _0x481ed9;};'use strict';var client=require(_0x5352('0x0'));exports[_0x5352('0x1')]=function(_0xba0928){return function(_0x3a8fe7){return client[_0x5352('0x2')](_0x5352('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x5352('0x4'),_0x5352('0x5'),'defaultuser']},'log':_0x5352('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index abc9005..49b01fa 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 _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x4234a3,_0x40250d){var _0x44e1aa=function(_0x4b42a2){while(--_0x4b42a2){_0x4234a3['push'](_0x4234a3['shift']());}};_0x44e1aa(++_0x40250d);}(_0xedd9,0xfc));var _0x9edd=function(_0x100a60,_0x4448a4){_0x100a60=_0x100a60-0x0;var _0x13b8ef=_0xedd9[_0x100a60];return _0x13b8ef;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file +var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xe706,0xa3));var _0x6e70=function(_0x5ae187,_0x8afd5c){_0x5ae187=_0x5ae187-0x0;var _0x211069=_0xe706[_0x5ae187];return _0x211069;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 4804893..4b3f183 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 _0xb74e=['create','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x3085b3,_0x1b8a41){var _0x3e9e70=function(_0x2adfd5){while(--_0x2adfd5){_0x3085b3['push'](_0x3085b3['shift']());}};_0x3e9e70(++_0x1b8a41);}(_0xb74e,0x19c));var _0xeb74=function(_0x36315a,_0x51c1dd){_0x36315a=_0x36315a-0x0;var _0x231769=_0xb74e[_0x36315a];return _0x231769;};'use strict';var client=require('../client');exports[_0xeb74('0x0')]=function(_0x507362){return client['Request'](_0xeb74('0x1'),{'body':_0x507362,'log':_0xeb74('0x1')});};exports[_0xeb74('0x2')]=function(_0x560930,_0x55676a,_0x35fbda){return client['Request'](_0xeb74('0x3'),{'body':_0x560930,'options':{'where':{'uniqueid':_0x55676a,'interface':_0x35fbda,'agentcomplete':!![]}},'log':_0xeb74('0x3')});}; \ No newline at end of file +var _0xb589=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x4938ac,_0x3d8f06){var _0x5ed8e7=function(_0x202ef4){while(--_0x202ef4){_0x4938ac['push'](_0x4938ac['shift']());}};_0x5ed8e7(++_0x3d8f06);}(_0xb589,0x139));var _0x9b58=function(_0x147e9f,_0x57b3cb){_0x147e9f=_0x147e9f-0x0;var _0x321585=_0xb589[_0x147e9f];return _0x321585;};'use strict';var client=require(_0x9b58('0x0'));exports[_0x9b58('0x1')]=function(_0xf179a6){return client[_0x9b58('0x2')](_0x9b58('0x3'),{'body':_0xf179a6,'log':'CreateVoiceAgentReport'});};exports[_0x9b58('0x4')]=function(_0xadcbd,_0xb17ae4,_0x1762e6){return client['Request'](_0x9b58('0x5'),{'body':_0xadcbd,'options':{'where':{'uniqueid':_0xb17ae4,'interface':_0x1762e6,'agentcomplete':!![]}},'log':_0x9b58('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 01387a3..b01cecf 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 _0x7cd1=['type','disposition','billableseconds','GetVoiceCallReports','moment','util','lodash','create','Request','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format'];(function(_0x4268e0,_0x1b9638){var _0x405272=function(_0x32fb1e){while(--_0x32fb1e){_0x4268e0['push'](_0x4268e0['shift']());}};_0x405272(++_0x1b9638);}(_0x7cd1,0x6d));var _0x17cd=function(_0x531e48,_0x4bb96b){_0x531e48=_0x531e48-0x0;var _0x202971=_0x7cd1[_0x531e48];return _0x202971;};'use strict';var moment=require(_0x17cd('0x0'));var util=require(_0x17cd('0x1'));var _=require(_0x17cd('0x2'));var client=require('../client');exports[_0x17cd('0x3')]=function(_0x5d2861){return client[_0x17cd('0x4')](_0x17cd('0x5'),{'body':_['merge'](_0x5d2861,{'source':_0x5d2861[_0x17cd('0x6')],'destinationcontext':_0x5d2861[_0x17cd('0x7')],'callerid':_0x5d2861[_0x17cd('0x8')],'amaflags':_0x17cd('0x9')}),'log':_0x17cd('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x17cd('0x4')](_0x17cd('0xa'),{'options':{'where':{'type':[_0x17cd('0xb')],'createdAt':{'$between':[moment()[_0x17cd('0xc')](_0x17cd('0xd'))['format'](_0x17cd('0xe')),moment()[_0x17cd('0xf')]('day')[_0x17cd('0x10')](_0x17cd('0xe'))]}},'attributes':[_0x17cd('0x11'),_0x17cd('0x12'),'duration',_0x17cd('0x13')]},'log':_0x17cd('0x14')});};}; \ No newline at end of file +var _0x679f=['GetVoiceCallReports','moment','util','lodash','../client','create','Request','merge','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','startOf','day','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds'];(function(_0x55e2c0,_0x25ade0){var _0x440712=function(_0x1b2aca){while(--_0x1b2aca){_0x55e2c0['push'](_0x55e2c0['shift']());}};_0x440712(++_0x25ade0);}(_0x679f,0x1b6));var _0xf679=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x679f[_0x4a9fb1];return _0x348672;};'use strict';var moment=require(_0xf679('0x0'));var util=require(_0xf679('0x1'));var _=require(_0xf679('0x2'));var client=require(_0xf679('0x3'));exports[_0xf679('0x4')]=function(_0x5889da){return client[_0xf679('0x5')]('CreateVoiceCallReport',{'body':_[_0xf679('0x6')](_0x5889da,{'source':_0x5889da[_0xf679('0x7')],'destinationcontext':_0x5889da[_0xf679('0x8')],'callerid':_0x5889da[_0xf679('0x9')],'amaflags':_0xf679('0xa')}),'log':_0xf679('0xb')});};exports[_0xf679('0xc')]=function(){return function(){return client[_0xf679('0x5')](_0xf679('0xd'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xf679('0xe')](_0xf679('0xf'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xf679('0x10')]('day')['format'](_0xf679('0x11'))]}},'attributes':[_0xf679('0x12'),_0xf679('0x13'),_0xf679('0x14'),_0xf679('0x15')]},'log':_0xf679('0x16')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 59e5383..94efd38 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 _0x0764=['Request','CreateVoiceDialReport','../client','create'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x0764,0xd6));var _0x4076=function(_0x391986,_0x1f16e9){_0x391986=_0x391986-0x0;var _0x271e57=_0x0764[_0x391986];return _0x271e57;};'use strict';var client=require(_0x4076('0x0'));exports[_0x4076('0x1')]=function(_0x29bc85){return client[_0x4076('0x2')](_0x4076('0x3'),{'body':_0x29bc85,'log':_0x4076('0x3')});}; \ No newline at end of file +var _0x61d4=['../client','create','CreateVoiceDialReport'];(function(_0x23931f,_0x44a59c){var _0x2575ce=function(_0xea6dec){while(--_0xea6dec){_0x23931f['push'](_0x23931f['shift']());}};_0x2575ce(++_0x44a59c);}(_0x61d4,0xcf));var _0x461d=function(_0x5555c6,_0x3b388f){_0x5555c6=_0x5555c6-0x0;var _0x5e8dc5=_0x61d4[_0x5555c6];return _0x5e8dc5;};'use strict';var client=require(_0x461d('0x0'));exports[_0x461d('0x1')]=function(_0x4244b6){return client['Request'](_0x461d('0x2'),{'body':_0x4244b6,'log':_0x461d('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 2196e93..d864e99 100644 --- a/server/services/ami/rpc/voiceExtension.js +++ b/server/services/ami/rpc/voiceExtension.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bdb=['getVoiceExtensions','../client','Request','exten','recordingFormat'];(function(_0x11d47a,_0x318b3d){var _0x2b4ed6=function(_0x59bdbc){while(--_0x59bdbc){_0x11d47a['push'](_0x11d47a['shift']());}};_0x2b4ed6(++_0x318b3d);}(_0x2bdb,0x105));var _0xb2bd=function(_0x296363,_0x23a01c){_0x296363=_0x296363-0x0;var _0xae8db0=_0x2bdb[_0x296363];return _0xae8db0;};'use strict';var client=require(_0xb2bd('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xb2bd('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xb2bd('0x2'),_0xb2bd('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xb2bd('0x4')});};}; \ No newline at end of file +var _0xf151=['getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x29db16,_0x5e73f1){var _0x2784ce=function(_0x555b10){while(--_0x555b10){_0x29db16['push'](_0x29db16['shift']());}};_0x2784ce(++_0x5e73f1);}(_0xf151,0xab));var _0x1f15=function(_0x2e56a4,_0x481289){_0x2e56a4=_0x2e56a4-0x0;var _0x475c49=_0xf151[_0x2e56a4];return _0x475c49;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x1f15('0x0')](_0x1f15('0x1'),{'options':{'raw':!![],'attributes':['id',_0x1f15('0x2'),_0x1f15('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x1f15('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 01eb3e8..c387b0e 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 _0x692c=['active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','name','acw','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid'];(function(_0x4eb8e1,_0x52fb85){var _0x3a9f0a=function(_0x3b07fe){while(--_0x3b07fe){_0x4eb8e1['push'](_0x4eb8e1['shift']());}};_0x3a9f0a(++_0x52fb85);}(_0x692c,0x107));var _0xc692=function(_0x52477e,_0x572e40){_0x52477e=_0x52477e-0x0;var _0x2e1032=_0x692c[_0x52477e];return _0x2e1032;};'use strict';var client=require(_0xc692('0x0'));exports[_0xc692('0x1')]=function(){return function(){return client[_0xc692('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xc692('0x3'),_0xc692('0x4'),'acwTimeout',_0xc692('0x5'),_0xc692('0x6'),_0xc692('0x7'),'dialActive',_0xc692('0x8'),_0xc692('0x9'),'dialLimitQueue',_0xc692('0xa'),_0xc692('0xb'),_0xc692('0xc'),'dialPredictiveInterval','dialOriginateCallerIdName',_0xc692('0xd'),_0xc692('0xe'),_0xc692('0xf'),_0xc692('0x10'),_0xc692('0x11'),'dialCongestionMaxRetry',_0xc692('0x12'),'dialBusyMaxRetry',_0xc692('0x13'),'dialNoAnswerMaxRetry',_0xc692('0x14'),_0xc692('0x15'),_0xc692('0x16'),'dialGlobalInterval','dialPrefix',_0xc692('0x17'),'dialAMDActive',_0xc692('0x18'),_0xc692('0x19'),_0xc692('0x1a'),_0xc692('0x1b'),_0xc692('0x1c'),_0xc692('0x1d'),_0xc692('0x1e'),_0xc692('0x1f'),_0xc692('0x20'),_0xc692('0x21'),_0xc692('0x22'),'dialRecallInQueue',_0xc692('0x23'),_0xc692('0x24'),_0xc692('0x25'),_0xc692('0x26'),_0xc692('0x6'),_0xc692('0x27'),_0xc692('0x28'),_0xc692('0x29'),_0xc692('0x2a'),_0xc692('0x2b'),_0xc692('0x2c'),'dialDropRetryFrequency',_0xc692('0x2d'),_0xc692('0x2e'),_0xc692('0x2f'),_0xc692('0x30'),_0xc692('0x31'),_0xc692('0x32'),_0xc692('0x33'),_0xc692('0x34'),'dialPredictiveIntervalMinThreshold',_0xc692('0x35'),_0xc692('0x36')],'include':[{'model':_0xc692('0x37'),'as':'Trunk','attributes':['id',_0xc692('0x3'),_0xc692('0x38'),_0xc692('0x39')]},{'model':_0xc692('0x3a'),'as':_0xc692('0x3b'),'attributes':['id',_0xc692('0x3')]},{'model':_0xc692('0x37'),'as':_0xc692('0x3c'),'attributes':['id',_0xc692('0x3'),_0xc692('0x38'),'active']},{'model':_0xc692('0x3d'),'as':'Interval','attributes':['id',_0xc692('0x3')],'include':[{'model':_0xc692('0x3d'),'as':_0xc692('0x3e'),'attributes':['id',_0xc692('0x3'),_0xc692('0x3f')]}]}]},'log':_0xc692('0x1')});};}; \ No newline at end of file +var _0x4af2=['dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency'];(function(_0x15726f,_0x437797){var _0x2a261c=function(_0x5ec05c){while(--_0x5ec05c){_0x15726f['push'](_0x15726f['shift']());}};_0x2a261c(++_0x437797);}(_0x4af2,0xa8));var _0x24af=function(_0x26899b,_0x50ed58){_0x26899b=_0x26899b-0x0;var _0x1c7a04=_0x4af2[_0x26899b];return _0x1c7a04;};'use strict';var client=require('../client');exports[_0x24af('0x0')]=function(){return function(){return client[_0x24af('0x1')](_0x24af('0x2'),{'options':{'raw':![],'attributes':['id',_0x24af('0x3'),_0x24af('0x4'),'acwTimeout',_0x24af('0x5'),_0x24af('0x6'),'type','dialActive',_0x24af('0x7'),_0x24af('0x8'),_0x24af('0x9'),_0x24af('0xa'),_0x24af('0xb'),_0x24af('0xc'),_0x24af('0xd'),_0x24af('0xe'),_0x24af('0xf'),_0x24af('0x10'),_0x24af('0x11'),_0x24af('0x12'),'dialQueueProject',_0x24af('0x13'),_0x24af('0x14'),_0x24af('0x15'),'dialBusyRetryFrequency',_0x24af('0x16'),_0x24af('0x17'),_0x24af('0x18'),_0x24af('0x19'),_0x24af('0x1a'),_0x24af('0x1b'),_0x24af('0x1c'),_0x24af('0x1d'),_0x24af('0x1e'),_0x24af('0x1f'),_0x24af('0x20'),_0x24af('0x21'),_0x24af('0x22'),_0x24af('0x23'),_0x24af('0x24'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength',_0x24af('0x25'),_0x24af('0x26'),_0x24af('0x27'),_0x24af('0x28'),'dialAgiAfterHangupAgent',_0x24af('0x29'),_0x24af('0x2a'),_0x24af('0x6'),_0x24af('0x2b'),_0x24af('0x2c'),_0x24af('0x2d'),_0x24af('0x2e'),'dialNoSuchNumberRetryFrequency',_0x24af('0x2f'),_0x24af('0x30'),'dialAbandonedMaxRetry',_0x24af('0x31'),_0x24af('0x32'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0x24af('0x33'),_0x24af('0x34'),_0x24af('0x35'),'dialPreviewAutoRecallMe',_0x24af('0x36')],'include':[{'model':_0x24af('0x37'),'as':_0x24af('0x37'),'attributes':['id',_0x24af('0x3'),_0x24af('0x38'),_0x24af('0x39')]},{'model':_0x24af('0x3a'),'as':_0x24af('0x3b'),'attributes':['id',_0x24af('0x3')]},{'model':_0x24af('0x37'),'as':'TrunkBackup','attributes':['id',_0x24af('0x3'),_0x24af('0x38'),'active']},{'model':'Interval','as':_0x24af('0x3c'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0x24af('0x3d'),'attributes':['id',_0x24af('0x3'),_0x24af('0x3e')]}]}]},'log':_0x24af('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index b8c85ab..1be0c4f 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(_0x319fef,_0x597a41){var _0x423e39=function(_0x379a13){while(--_0x379a13){_0x319fef['push'](_0x319fef['shift']());}};_0x423e39(++_0x597a41);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x367b76,_0x5b9900){var _0x7612b3=function(_0x5c1240){while(--_0x5c1240){_0x367b76['push'](_0x367b76['shift']());}};_0x7612b3(++_0x5b9900);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 3b3ac52..d742e56 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 _0xcc4f=['getVoiceQueueRtPauses','../client','Request','GetVoiceQueueRtPauses'];(function(_0x3bece3,_0x10a102){var _0x4f033c=function(_0x46bcd6){while(--_0x46bcd6){_0x3bece3['push'](_0x3bece3['shift']());}};_0x4f033c(++_0x10a102);}(_0xcc4f,0x11d));var _0xfcc4=function(_0x28b6fd,_0x3148f5){_0x28b6fd=_0x28b6fd-0x0;var _0x1d963b=_0xcc4f[_0x28b6fd];return _0x1d963b;};'use strict';var client=require(_0xfcc4('0x0'));exports['getVoiceQueueRtPauses']=function(_0x3cc88c){return function(){return client[_0xfcc4('0x1')](_0xfcc4('0x2'),{'options':{'where':{'VoiceQueueId':_0x3cc88c,'paused':!![]},'raw':!![]},'log':_0xfcc4('0x3')});};}; \ No newline at end of file +var _0xec96=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x1dabd4,_0x48d3b2){var _0x4a806b=function(_0x47a00d){while(--_0x47a00d){_0x1dabd4['push'](_0x1dabd4['shift']());}};_0x4a806b(++_0x48d3b2);}(_0xec96,0x96));var _0x6ec9=function(_0x8d89a0,_0x4cbdc4){_0x8d89a0=_0x8d89a0-0x0;var _0x218e97=_0xec96[_0x8d89a0];return _0x218e97;};'use strict';var client=require(_0x6ec9('0x0'));exports[_0x6ec9('0x1')]=function(_0x3e242e){return function(){return client[_0x6ec9('0x2')](_0x6ec9('0x3'),{'options':{'where':{'VoiceQueueId':_0x3e242e,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 673a35e..129707c 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(_0x11af99,_0x5b4621){var _0x57f865=function(_0x475944){while(--_0x475944){_0x11af99['push'](_0x11af99['shift']());}};_0x57f865(++_0x5b4621);}(_0x7a54,0x106));var _0x47a5=function(_0x1b8b12,_0x54e895){_0x1b8b12=_0x1b8b12-0x0;var _0x171745=_0x7a54[_0x1b8b12];return _0x171745;};'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(_0x402789,_0x5e1cbd){var _0x33a1ed=function(_0x244bf4){while(--_0x244bf4){_0x402789['push'](_0x402789['shift']());}};_0x33a1ed(++_0x5e1cbd);}(_0x7a54,0x106));var _0x47a5=function(_0x3ccca2,_0x3bd75d){_0x3ccca2=_0x3ccca2-0x0;var _0xe4c8f3=_0x7a54[_0x3ccca2];return _0xe4c8f3;};'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 69c2be9..bd72bbf 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 _0x34ef=['transferercontext','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','extension','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode'];(function(_0x2180df,_0xa10b00){var _0x370927=function(_0x268e4d){while(--_0x268e4d){_0x2180df['push'](_0x2180df['shift']());}};_0x370927(++_0xa10b00);}(_0x34ef,0x10d));var _0xf34e=function(_0x16cda0,_0x3b7765){_0x16cda0=_0x16cda0-0x0;var _0x6d9b70=_0x34ef[_0x16cda0];return _0x6d9b70;};'use strict';var client=require(_0xf34e('0x0'));exports[_0xf34e('0x1')]={};exports[_0xf34e('0x2')]=function(_0x488f3b){return client[_0xf34e('0x3')](_0xf34e('0x4'),{'body':{'result':_0x488f3b[_0xf34e('0x5')],'transfererchannel':_0x488f3b[_0xf34e('0x6')],'transferercalleridnum':_0x488f3b[_0xf34e('0x7')],'transferercalleridname':_0x488f3b[_0xf34e('0x8')],'transfererconnectedlinenum':_0x488f3b['transfererconnectedlinenum'],'transfererconnectedlinename':_0x488f3b[_0xf34e('0x9')],'transfereraccountcode':_0x488f3b[_0xf34e('0xa')],'transferercontext':_0x488f3b[_0xf34e('0xb')],'transfererexten':_0x488f3b['transfererexten'],'transfererlinkedid':_0x488f3b[_0xf34e('0xc')],'transfereechannel':_0x488f3b[_0xf34e('0xd')],'transfereecalleridnum':_0x488f3b['transfereecalleridnum'],'transfereecalleridname':_0x488f3b[_0xf34e('0xe')],'transfereeconnectedlinenum':_0x488f3b[_0xf34e('0xf')],'transfereeconnectedlinename':_0x488f3b[_0xf34e('0x10')],'transfereeaccountcode':_0x488f3b[_0xf34e('0x11')],'transfereecontext':_0x488f3b['transfereecontext'],'transfereeexten':_0x488f3b[_0xf34e('0x12')],'transfereelinkedid':_0x488f3b[_0xf34e('0x13')],'isexternal':_0x488f3b[_0xf34e('0x14')],'context':_0x488f3b['context'],'extension':_0x488f3b[_0xf34e('0x15')],'type':'blind'},'log':_0xf34e('0x4')});};exports[_0xf34e('0x16')]=function(_0x527c57){return client[_0xf34e('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x527c57[_0xf34e('0x5')],'transfererchannel':_0x527c57[_0xf34e('0x17')],'transferercalleridnum':_0x527c57[_0xf34e('0x18')],'transferercalleridname':_0x527c57[_0xf34e('0x19')],'transfererconnectedlinenum':_0x527c57['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x527c57[_0xf34e('0x1a')],'transfereraccountcode':_0x527c57[_0xf34e('0x1b')],'transferercontext':_0x527c57['secondtransferercontext'],'transfererexten':_0x527c57['secondtransfererexten'],'transfererlinkedid':_0x527c57[_0xf34e('0x1c')],'transfereechannel':_0x527c57[_0xf34e('0x1d')],'transfereecalleridnum':_0x527c57[_0xf34e('0x1e')],'transfereecalleridname':_0x527c57['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x527c57[_0xf34e('0x1f')],'transfereeconnectedlinename':_0x527c57[_0xf34e('0x20')],'transfereeaccountcode':_0x527c57[_0xf34e('0x21')],'transfereecontext':_0x527c57[_0xf34e('0x22')],'transfereeexten':_0x527c57[_0xf34e('0x23')],'transfereelinkedid':_0x527c57[_0xf34e('0x24')],'isexternal':_0x527c57[_0xf34e('0x14')],'context':_0x527c57[_0xf34e('0x25')],'extension':_0x527c57[_0xf34e('0x26')],'type':_0xf34e('0x27')},'log':_0xf34e('0x4')});}; \ No newline at end of file +var _0x36dc=['transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','Request','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfereecalleridnum'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x36dc,0xdd));var _0xc36d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36dc[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc36d('0x0'));exports[_0xc36d('0x1')]={};exports[_0xc36d('0x2')]=function(_0x50836c){return client['Request'](_0xc36d('0x3'),{'body':{'result':_0x50836c[_0xc36d('0x4')],'transfererchannel':_0x50836c[_0xc36d('0x5')],'transferercalleridnum':_0x50836c[_0xc36d('0x6')],'transferercalleridname':_0x50836c[_0xc36d('0x7')],'transfererconnectedlinenum':_0x50836c[_0xc36d('0x8')],'transfererconnectedlinename':_0x50836c[_0xc36d('0x9')],'transfereraccountcode':_0x50836c[_0xc36d('0xa')],'transferercontext':_0x50836c['transferercontext'],'transfererexten':_0x50836c[_0xc36d('0xb')],'transfererlinkedid':_0x50836c['transfererlinkedid'],'transfereechannel':_0x50836c['transfereechannel'],'transfereecalleridnum':_0x50836c[_0xc36d('0xc')],'transfereecalleridname':_0x50836c['transfereecalleridname'],'transfereeconnectedlinenum':_0x50836c['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x50836c[_0xc36d('0xd')],'transfereeaccountcode':_0x50836c[_0xc36d('0xe')],'transfereecontext':_0x50836c['transfereecontext'],'transfereeexten':_0x50836c[_0xc36d('0xf')],'transfereelinkedid':_0x50836c[_0xc36d('0x10')],'isexternal':_0x50836c[_0xc36d('0x11')],'context':_0x50836c[_0xc36d('0x12')],'extension':_0x50836c[_0xc36d('0x13')],'type':_0xc36d('0x14')},'log':_0xc36d('0x3')});};exports[_0xc36d('0x15')]=function(_0x2e3227){return client[_0xc36d('0x16')]('CreateVoiceTransferReport',{'body':{'result':_0x2e3227[_0xc36d('0x4')],'transfererchannel':_0x2e3227[_0xc36d('0x17')],'transferercalleridnum':_0x2e3227['origtransferercalleridnum'],'transferercalleridname':_0x2e3227[_0xc36d('0x18')],'transfererconnectedlinenum':_0x2e3227[_0xc36d('0x19')],'transfererconnectedlinename':_0x2e3227[_0xc36d('0x1a')],'transfereraccountcode':_0x2e3227[_0xc36d('0x1b')],'transferercontext':_0x2e3227[_0xc36d('0x1c')],'transfererexten':_0x2e3227['secondtransfererexten'],'transfererlinkedid':_0x2e3227[_0xc36d('0x1d')],'transfereechannel':_0x2e3227['transfertargetchannel'],'transfereecalleridnum':_0x2e3227['transfertargetcalleridnum'],'transfereecalleridname':_0x2e3227[_0xc36d('0x1e')],'transfereeconnectedlinenum':_0x2e3227[_0xc36d('0x1f')],'transfereeconnectedlinename':_0x2e3227['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2e3227[_0xc36d('0x20')],'transfereecontext':_0x2e3227[_0xc36d('0x21')],'transfereeexten':_0x2e3227[_0xc36d('0x22')],'transfereelinkedid':_0x2e3227[_0xc36d('0x23')],'isexternal':_0x2e3227[_0xc36d('0x11')],'context':_0x2e3227[_0xc36d('0x24')],'extension':_0x2e3227[_0xc36d('0x25')],'type':_0xc36d('0x26')},'log':_0xc36d('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index eea7df6..67fc1b1 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 _0x723e=['send','checkAfterSend','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','jayson/promise','validate','moment','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','listen','format','SIP','name','timers','timer','agents','updateStatusRealtime','pause','QueuePause','asterisk','username','ami\x20disconnected','join','keys','reload','module','action','Reload','Action','then','message','catch','error','isConnected','pick','command','Command','content','voiceQueues','hasOwnProperty','push','find','omit','undefined','values','channels','length','voicechannel','map','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','type','inbound','outbound','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','voicequeuechannel','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','custom:'];(function(_0x1ee76b,_0xec75a0){var _0x48cea1=function(_0x4d48bc){while(--_0x4d48bc){_0x1ee76b['push'](_0x1ee76b['shift']());}};_0x48cea1(++_0xec75a0);}(_0x723e,0x179));var _0xe723=function(_0x2082b9,_0xd0c6b){_0x2082b9=_0x2082b9-0x0;var _0x4746d8=_0x723e[_0x2082b9];return _0x4746d8;};'use strict';var _=require('lodash');var util=require(_0xe723('0x0'));var jayson=require(_0xe723('0x1'));var schema=require(_0xe723('0x2'));var moment=require(_0xe723('0x3'));var config=require(_0xe723('0x4'));var properties=require(_0xe723('0x5'));var ami=require(_0xe723('0x6'));var VoiceQueueSummary=require(_0xe723('0x7'));exports[_0xe723('0x8')]=function(_0x10aa61,_0x4b1c43,_0x32d689){return new Promise(function(_0x20c13b,_0x1335cd){var _0x3bf082={'QueuePause':function(_0x2aebbd){return new Promise(function(_0xe50f7){var _0x1b46e0=util[_0xe723('0x9')]('%s/%s',_0xe723('0xa'),_0x2aebbd[_0xe723('0xb')]);if(_0x10aa61[_0xe723('0xc')]&&_0x10aa61['timers'][_0x1b46e0]&&_0x10aa61[_0xe723('0xc')][_0x1b46e0][_0xe723('0xd')]){_0x10aa61[_0xe723('0xc')][_0x1b46e0]['updateAcw']();}if(_0x10aa61[_0xe723('0xe')][_0x1b46e0]){_0x10aa61[_0xe723('0xe')][_0x1b46e0][_0xe723('0xf')]({'statePause':_0x2aebbd[_0xe723('0x10')]?!![]:![]});}_0xe50f7({'code':0xc8,'message':_0xe723('0x11')});});},'Reload':function(_0x5c066c){var _0x29a1e=this;return new Promise(function(_0x4bfbc1,_0x4ac4cb){if(ami['isConnected']()==![]){return _0x4ac4cb(_0x29a1e['error'](0x1f4,[config[_0xe723('0x12')]['ip'],config[_0xe723('0x12')][_0xe723('0x13')],_0xe723('0x14')][_0xe723('0x15')]('\x20')));}_0x5c066c=_['pick'](_0x5c066c,_[_0xe723('0x16')](properties[_0xe723('0x17')][_0xe723('0x18')]));_0x5c066c[_0xe723('0x19')]=_0xe723('0x1a');return ami[_0xe723('0x1b')](_0x5c066c)[_0xe723('0x1c')](function(_0x4a6f95){_0x4bfbc1({'code':0xc8,'message':_0x4a6f95[_0xe723('0x1d')]});})[_0xe723('0x1e')](function(_0x2057d7){_0x4ac4cb(_0x29a1e[_0xe723('0x1f')](0x1f5,_0x2057d7[_0xe723('0x1d')]));});});},'Command':function(_0x367782){var _0x5e8a90=this;return new Promise(function(_0x5b2308,_0x31c839){if(ami[_0xe723('0x20')]()==![]){return _0x31c839(_0x5e8a90['error'](0x1f4,[config[_0xe723('0x12')]['ip'],config[_0xe723('0x12')]['username'],_0xe723('0x14')]['join']('\x20')));}_0x367782=_[_0xe723('0x21')](_0x367782,_0xe723('0x22'));_0x367782[_0xe723('0x19')]=_0xe723('0x23');return ami[_0xe723('0x1b')](_0x367782)[_0xe723('0x1c')](function(_0x25f7d2){_0x5b2308({'code':0xc8,'message':_0x25f7d2[_0xe723('0x24')]});})[_0xe723('0x1e')](function(_0x19bd0c){_0x31c839(_0x5e8a90[_0xe723('0x1f')](0x1f5,_0x19bd0c[_0xe723('0x1d')]));});});},'VoiceQueues':function(){return new Promise(function(_0x5c4fb4){var _0x384786=[];for(var _0x59f095 in _0x10aa61[_0xe723('0x25')]){if(_0x10aa61[_0xe723('0x25')][_0xe723('0x26')](_0x59f095)){var _0xe7e271=_0x10aa61[_0xe723('0x25')][_0x59f095];var _0x598f15=new VoiceQueueSummary(_0xe7e271);_0x384786[_0xe723('0x27')](_0x598f15);}}_0x5c4fb4({'count':_0x384786['length'],'rows':_0x384786});});},'UpdateVoiceQueue':function(_0x52f919){return new Promise(function(_0x15911d,_0x511c74){var _0x3e6bc0=_[_0xe723('0x28')](_0x10aa61[_0xe723('0x25')],{'id':parseInt(_0x52f919['id'])});var _0x4d55cc=_[_0xe723('0x29')](_0x52f919,['id']);if(_0x3e6bc0){for(var _0x45e162 in _0x4d55cc){if(typeof _0x4d55cc[_0x45e162]!=='undefined'&&typeof _0x3e6bc0[_0x45e162]!==_0xe723('0x2a')){_0x3e6bc0[_0x45e162]=_0x4d55cc[_0x45e162];}}_0x15911d(_0x3e6bc0);}else{_0x511c74();}});},'VoiceChannels':function(){return new Promise(function(_0x5594f7){var _0x4c6fbd=_[_0xe723('0x2b')](_0x10aa61[_0xe723('0x2c')]);_0x5594f7({'count':_0x4c6fbd[_0xe723('0x2d')],'rows':_0x4c6fbd});});},'VoiceChannelMixMonitor':function(_0x2b0882){var _0x49788a=this;return new Promise(function(_0x57efec,_0x1d1146){if(ami['isConnected']()==![]){return _0x1d1146(_0x49788a[_0xe723('0x1f')](0x1f4,[config[_0xe723('0x12')]['ip'],config[_0xe723('0x12')][_0xe723('0x13')],_0xe723('0x14')][_0xe723('0x15')]('\x20')));}var _0x4706d4=schema(properties[_0xe723('0x2e')])[_0xe723('0x2')](_0x2b0882);if(_0x4706d4[_0xe723('0x2d')]>0x0){return _0x1d1146(_0x49788a[_0xe723('0x1f')](0x1f4,_[_0xe723('0x2f')](_0x4706d4,_0xe723('0x1d'))[_0xe723('0x15')](',\x20')));}var _0x5685d1=_[_0xe723('0x28')](_0x10aa61['channels'],{'uniqueid':_0x2b0882[_0xe723('0x30')]});if(_0x5685d1&&_0x5685d1[_0xe723('0x31')]){var _0x575f5e=util['format'](_0xe723('0x32'),_0x2b0882[_0xe723('0x33')]||_0x2b0882[_0xe723('0x30')],_0x2b0882[_0xe723('0x9')]||_0xe723('0x34'));return ami[_0xe723('0x1b')]({'action':'MixMonitor','channel':_0x5685d1[_0xe723('0x31')],'file':_0x575f5e,'options':_0xe723('0x35')})[_0xe723('0x1c')](function(_0x3acb94){var _0x281727=_[_0xe723('0x28')](_0x5685d1[_0xe723('0x36')],{'filename':_0xe723('0x37')+_0x575f5e[_0xe723('0x38')]()});if(_[_0xe723('0x39')](_0x281727)){_0x5685d1[_0xe723('0x36')][_0xe723('0x27')]({'filename':_0xe723('0x37')+_0x575f5e[_0xe723('0x38')](),'createdAt':moment()[_0xe723('0x9')](_0xe723('0x3a')),'mixmonitorid':_0x3acb94['mixmonitorid'],'status':_0xe723('0x3b')});}else{_0x281727[_0xe723('0x3c')]=_0x3acb94[_0xe723('0x3c')];_0x281727[_0xe723('0x3d')]='rec';}_0x57efec({'code':0xc8,'message':[_0x2b0882['uniqueid'],_0xe723('0x3e'),_0x3acb94[_0xe723('0x3c')]][_0xe723('0x15')]('\x20'),'mixmonitorid':_0x3acb94[_0xe723('0x3c')]});})['catch'](function(_0x5d5f24){_0x1d1146(_0x49788a[_0xe723('0x1f')](0x1f5,[_0x2b0882[_0xe723('0x30')],_0x5d5f24[_0xe723('0x1d')][_0xe723('0x38')]()][_0xe723('0x15')]('\x20')));});}else{return _0x1d1146(_0x49788a[_0xe723('0x1f')](0x1f5,_0xe723('0x3f')));}});},'VoiceChannelStopMixMonitor':function(_0x2b74d5){var _0x637b5f=this;return new Promise(function(_0x5b0c89,_0x490993){if(ami[_0xe723('0x20')]()==![]){return _0x490993(_0x637b5f['error'](0x1f4,[config['asterisk']['ip'],config[_0xe723('0x12')]['username'],_0xe723('0x14')][_0xe723('0x15')]('\x20')));}var _0x39f988=schema(properties[_0xe723('0x2e')])[_0xe723('0x2')](_0x2b74d5);if(_0x39f988[_0xe723('0x2d')]>0x0){return _0x490993(_0x637b5f[_0xe723('0x1f')](0x1f4,_['map'](_0x39f988,'message')[_0xe723('0x15')](',\x20')));}var _0x562583=_[_0xe723('0x28')](_0x10aa61['channels'],{'uniqueid':_0x2b74d5[_0xe723('0x30')]});if(_0x562583){return Promise[_0xe723('0x40')]()[_0xe723('0x1c')](function(){if(_0x562583[_0xe723('0x31')]){return ami[_0xe723('0x1b')]({'action':_0xe723('0x41'),'channel':_0x562583[_0xe723('0x31')],'mixmonitorid':_0x2b74d5[_0xe723('0x3c')]})[_0xe723('0x1e')](function(){});}})['then'](function(){if(_0x562583['destinationchannel']){return ami[_0xe723('0x1b')]({'action':_0xe723('0x41'),'channel':_0x562583[_0xe723('0x42')],'mixmonitorid':_0x2b74d5['mixmonitorid']})['catch'](function(){});}})['then'](function(){var _0xf25d94=_[_0xe723('0x28')](_0x562583[_0xe723('0x36')],{'mixmonitorid':_0x2b74d5['mixmonitorid']});if(_0xf25d94){_0xf25d94[_0xe723('0x3d')]=_0xe723('0x43');}})[_0xe723('0x1c')](function(){var _0x38bd1a=util[_0xe723('0x9')]('%s.%s',_0x2b74d5[_0xe723('0x33')]||_0x2b74d5['uniqueid'],_0x2b74d5[_0xe723('0x9')]||'wav');var _0x52f42e=_[_0xe723('0x28')](_0x562583[_0xe723('0x36')],{'filename':_0xe723('0x37')+_0x38bd1a['toLowerCase']()});if(_0x52f42e){_0x52f42e[_0xe723('0x3d')]='stop';}})[_0xe723('0x1c')](function(){_0x5b0c89({'code':0xc8,'message':[_0x2b74d5[_0xe723('0x30')],_0xe723('0x44')][_0xe723('0x15')]('\x20')});})[_0xe723('0x1e')](function(_0xf96ffb){_0x490993(_0x637b5f[_0xe723('0x1f')](0x1f5,[_0x2b74d5[_0xe723('0x30')],_0xf96ffb[_0xe723('0x1d')]['toLowerCase']()][_0xe723('0x15')]('\x20')));});}else{return _0x490993(_0x637b5f[_0xe723('0x1f')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x36ea62){var _0x410601=this;return new Promise(function(_0x56e92a){var _0x126ca5=_['values'](_0x10aa61['queueChannels']);var _0x35aa07={'count':_0x126ca5[_0xe723('0x2d')],'rows':_0x126ca5};if(_0x36ea62&&_0x36ea62[_0xe723('0x45')]){if(![_0xe723('0x46'),_0xe723('0x47')]['includes'](_0x36ea62[_0xe723('0x45')])){return _0x1335cd(_0x410601[_0xe723('0x1f')](0x190,_0xe723('0x48')));}var _0x111619=_[_0xe723('0x49')](_0x126ca5,function(_0x3909c4){return _0x3909c4[_0xe723('0x45')]===_0x36ea62[_0xe723('0x45')];});_0x35aa07[_0xe723('0x4a')]=_0x111619[_0xe723('0x2d')];_0x35aa07['rows']=_0x111619;}_0x56e92a(_0x35aa07);});},'VoiceQueuesChannel':function(_0x1f6471){var _0x10fb8a=this;return new Promise(function(_0x44a6f1,_0x4672be){var _0x4d0394=schema(properties[_0xe723('0x4b')])[_0xe723('0x2')](_0x1f6471);if(_0x4d0394['length']>0x0){return _0x4672be(_0x10fb8a[_0xe723('0x1f')](0x1f4,_[_0xe723('0x2f')](_0x4d0394,_0xe723('0x1d'))[_0xe723('0x15')](',\x20')));}var _0x4294ec=_[_0xe723('0x28')](_0x10aa61['queueChannels'],{'uniqueid':_0x1f6471[_0xe723('0x30')]});if(_0x4294ec){_0x44a6f1(_0x4294ec);}else{return _0x4672be(_0x10fb8a['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x3fef34){var _0x4e2139=this;return new Promise(function(_0x9f057e,_0x2ef56d){if(ami[_0xe723('0x20')]()==![]){return _0x2ef56d(_0x4e2139[_0xe723('0x1f')](0x1f4,[config[_0xe723('0x12')]['ip'],config['asterisk'][_0xe723('0x13')],_0xe723('0x14')][_0xe723('0x15')]('\x20')));}var _0x5c798f=schema(properties['voicequeuechannelhangup'])[_0xe723('0x2')](_0x3fef34);if(_0x5c798f[_0xe723('0x2d')]>0x0){return _0x2ef56d(_0x4e2139[_0xe723('0x1f')](0x1f4,_['map'](_0x5c798f,_0xe723('0x1d'))[_0xe723('0x15')](',\x20')));}var _0x5333a1=_['find'](_0x10aa61[_0xe723('0x4c')],{'uniqueid':_0x3fef34[_0xe723('0x30')]});if(_0x5333a1&&_0x5333a1[_0xe723('0x31')]){return ami[_0xe723('0x1b')]({'action':_0xe723('0x4d'),'channel':_0x5333a1[_0xe723('0x31')]})[_0xe723('0x1c')](function(_0x5668fe){_0x9f057e({'code':0xc8,'message':[_0x3fef34['uniqueid'],_0x5668fe['message'][_0xe723('0x38')]()][_0xe723('0x15')]('\x20')});})['catch'](function(_0x31996a){_0x2ef56d(_0x4e2139[_0xe723('0x1f')](0x1f5,[_0x3fef34[_0xe723('0x30')],_0x31996a['message']['toLowerCase']()][_0xe723('0x15')]('\x20')));});}else{return _0x2ef56d(_0x4e2139[_0xe723('0x1f')](0x1f5,_0xe723('0x3f')));}});},'VoiceQueuesChannelRedirect':function(_0x53cb23){var _0x54b461=this;return new Promise(function(_0x2d0ab5,_0x5b24a6){if(ami[_0xe723('0x20')]()==![]){return _0x5b24a6(_0x54b461[_0xe723('0x1f')](0x1f4,[config[_0xe723('0x12')]['ip'],config[_0xe723('0x12')][_0xe723('0x13')],_0xe723('0x14')][_0xe723('0x15')]('\x20')));}var _0x421520=schema(properties[_0xe723('0x4e')])['validate'](_0x53cb23);if(_0x421520[_0xe723('0x2d')]>0x0){return _0x5b24a6(_0x54b461[_0xe723('0x1f')](0x1f4,_[_0xe723('0x2f')](_0x421520,_0xe723('0x1d'))[_0xe723('0x15')](',\x20')));}var _0x40a3d5=_['find'](_0x10aa61[_0xe723('0x4c')],{'uniqueid':_0x53cb23[_0xe723('0x30')]});if(_0x40a3d5&&_0x40a3d5['channel']){return ami['Action']({'action':_0xe723('0x4f'),'channel':_0x40a3d5[_0xe723('0x31')],'exten':_0x53cb23[_0xe723('0x50')],'context':_0x53cb23['context']||_0x40a3d5['context'],'priority':0x1})[_0xe723('0x1c')](function(_0x59b5c2){_0x2d0ab5({'code':0xc8,'message':[_0x53cb23[_0xe723('0x30')],_0x59b5c2[_0xe723('0x1d')][_0xe723('0x38')]()][_0xe723('0x15')]('\x20')});})[_0xe723('0x1e')](function(_0x5e5896){_0x5b24a6(_0x54b461['error'](0x1f5,[_0x53cb23[_0xe723('0x30')],_0x5e5896[_0xe723('0x1d')][_0xe723('0x38')]()]['join']('\x20')));});}else{return _0x5b24a6(_0x54b461[_0xe723('0x1f')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x5cddfe){return new Promise(function(_0x182564){var _0xb52790=_[_0xe723('0x2b')](_0x10aa61[_0xe723('0xe')]);if(_0x5cddfe&&_0x5cddfe['id']){var _0x3b74ee=_[_0xe723('0x28')](_0xb52790,function(_0x4abf17){return _0x4abf17['id']===_0x5cddfe['id'];});_0x182564(_0x3b74ee);}else{_0x182564({'count':_0xb52790[_0xe723('0x2d')],'rows':_0xb52790});}});},'Telephones':function(){return new Promise(function(_0x5b51be){var _0x3295ce=_[_0xe723('0x2b')](_0x10aa61['telephones']);_0x5b51be({'count':_0x3295ce[_0xe723('0x2d')],'rows':_0x3295ce});});},'Trunks':function(){return new Promise(function(_0x6a881b){var _0x3f3b10=_[_0xe723('0x2b')](_0x10aa61[_0xe723('0x51')]);_0x6a881b({'count':_0x3f3b10[_0xe723('0x2d')],'rows':_0x3f3b10});});},'OutboundChannels':function(){return new Promise(function(_0x8c7489){var _0x3d8221=_[_0xe723('0x2b')](_0x10aa61[_0xe723('0x52')]);_0x8c7489({'count':_0x3d8221[_0xe723('0x2d')],'rows':_0x3d8221});});},'Outbound':function(){return new Promise(function(_0x2b2f72){_0x2b2f72(_0x10aa61[_0xe723('0x47')]);});},'Campaigns':function(){return new Promise(function(_0x15807e){var _0x32e535=_['values'](_0x10aa61[_0xe723('0x53')]);_0x15807e({'count':_0x32e535[_0xe723('0x2d')],'rows':_0x32e535});});},'VoiceQueuesPreview':function(_0x1d4fe0){var _0x507267=this;return new Promise(function(_0x330ab0,_0x7af941){_0x4b1c43[_0xe723('0x54')](_0x1d4fe0['id'])[_0xe723('0x1c')](function(_0x24f8f1){_0x330ab0({'code':0xc8,'message':_0x24f8f1[_0xe723('0x1d')]});})[_0xe723('0x1e')](function(_0x3d63d3){_0x7af941(_0x507267[_0xe723('0x1f')](0x1f4,_0x3d63d3[_0xe723('0x1d')]));});});},'EventManager':function(_0x5dc44a){var _0x14cd1d=this;return new Promise(function(_0x45e425,_0x333b34){if(!_0x5dc44a[_0xe723('0x55')]){return _0x333b34(_0x14cd1d[_0xe723('0x1f')](0x1f4,_0xe723('0x56')));}ami['emit'](_0xe723('0x57')+_0x5dc44a[_0xe723('0x55')],_0x5dc44a['message']);_0x45e425({'code':0xc8,'message':_0x5dc44a});});},'FaxAccounts':function(){return new Promise(function(_0x528981){var _0x28c0e4=_[_0xe723('0x2b')](_0x10aa61['faxAccounts']);_0x528981({'count':_0x28c0e4[_0xe723('0x2d')],'rows':_0x28c0e4});});},'SendFax':function(_0x1993d1){var _0x5f14c2=this;return new Promise(function(_0x511bd7,_0x510368){_0x32d689[_0xe723('0x58')](_0x1993d1)['then'](function(_0x54b1f5){_0x511bd7({'code':0xc8,'message':_0x54b1f5['message']});})[_0xe723('0x1e')](function(_0x423967){_0x510368(_0x5f14c2[_0xe723('0x1f')](0x1f4,_0x423967[_0xe723('0x1d')]));});});},'CheckAfterSend':function(_0x31ccef){var _0x42d66a=this;return new Promise(function(_0x3650ed,_0x4fc605){_0x32d689[_0xe723('0x59')](_0x31ccef)[_0xe723('0x1c')](function(_0x36d962){_0x3650ed({'code':0xc8,'message':_0x36d962[_0xe723('0x1d')]});})[_0xe723('0x1e')](function(_0x645e59){_0x4fc605(_0x42d66a['error'](0x1f4,_0x645e59['message']));});});}};var _0x1aee34=jayson['server'](_0x3bf082)['http']();_0x1aee34['on'](_0xe723('0x1f'),function(_0x501bb){return _0x1335cd(_0x501bb);});_0x1aee34['listen'](0x232a,_0xe723('0x5a'),function(){console[_0xe723('0x5b')](_0xe723('0x5c'),0x232a);return _0x20c13b('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0xf006=['mixmonitorid','rec','MixMonitor\x20Success','uniqueid','resolve','StopMixMonitor','destinationchannel','status','stop','Channel\x20doesn\x27t\x20exist','queueChannels','type','inbound','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','voicequeuechannel','voicequeuechannelhangup','Hangup','Redirect','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','validate','../../../config/environment','../ami','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','join','pick','keys','reload','module','Reload','message','catch','error','action','Command','Action','then','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','voicechannel','map','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/'];(function(_0x2c918e,_0xdc575e){var _0x5358e0=function(_0x30d6d3){while(--_0x30d6d3){_0x2c918e['push'](_0x2c918e['shift']());}};_0x5358e0(++_0xdc575e);}(_0xf006,0x146));var _0x6f00=function(_0x3acee3,_0x3280b6){_0x3acee3=_0x3acee3-0x0;var _0x280811=_0xf006[_0x3acee3];return _0x280811;};'use strict';var _=require('lodash');var util=require('util');var jayson=require(_0x6f00('0x0'));var schema=require(_0x6f00('0x1'));var moment=require('moment');var config=require(_0x6f00('0x2'));var properties=require('../properties');var ami=require(_0x6f00('0x3'));var VoiceQueueSummary=require('../model/voiceQueueSummary');exports['listen']=function(_0x44a0f9,_0x402677,_0x141e71){return new Promise(function(_0x52c9a2,_0x3c29ff){var _0x4f918f={'QueuePause':function(_0x3875fb){return new Promise(function(_0x3001b1){var _0x185728=util[_0x6f00('0x4')](_0x6f00('0x5'),_0x6f00('0x6'),_0x3875fb[_0x6f00('0x7')]);if(_0x44a0f9[_0x6f00('0x8')]&&_0x44a0f9[_0x6f00('0x8')][_0x185728]&&_0x44a0f9[_0x6f00('0x8')][_0x185728][_0x6f00('0x9')]){_0x44a0f9[_0x6f00('0x8')][_0x185728][_0x6f00('0xa')]();}if(_0x44a0f9['agents'][_0x185728]){_0x44a0f9[_0x6f00('0xb')][_0x185728][_0x6f00('0xc')]({'statePause':_0x3875fb[_0x6f00('0xd')]?!![]:![]});}_0x3001b1({'code':0xc8,'message':_0x6f00('0xe')});});},'Reload':function(_0x289fe9){var _0x5e3264=this;return new Promise(function(_0x322116,_0x4d5b73){if(ami[_0x6f00('0xf')]()==![]){return _0x4d5b73(_0x5e3264['error'](0x1f4,[config[_0x6f00('0x10')]['ip'],config[_0x6f00('0x10')][_0x6f00('0x11')],_0x6f00('0x12')][_0x6f00('0x13')]('\x20')));}_0x289fe9=_[_0x6f00('0x14')](_0x289fe9,_[_0x6f00('0x15')](properties[_0x6f00('0x16')][_0x6f00('0x17')]));_0x289fe9['action']=_0x6f00('0x18');return ami['Action'](_0x289fe9)['then'](function(_0x7c047e){_0x322116({'code':0xc8,'message':_0x7c047e[_0x6f00('0x19')]});})[_0x6f00('0x1a')](function(_0x340f78){_0x4d5b73(_0x5e3264[_0x6f00('0x1b')](0x1f5,_0x340f78[_0x6f00('0x19')]));});});},'Command':function(_0x23fe10){var _0x295640=this;return new Promise(function(_0x9844bf,_0x198cc7){if(ami[_0x6f00('0xf')]()==![]){return _0x198cc7(_0x295640[_0x6f00('0x1b')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x6f00('0x12')][_0x6f00('0x13')]('\x20')));}_0x23fe10=_[_0x6f00('0x14')](_0x23fe10,'command');_0x23fe10[_0x6f00('0x1c')]=_0x6f00('0x1d');return ami[_0x6f00('0x1e')](_0x23fe10)[_0x6f00('0x1f')](function(_0x388983){_0x9844bf({'code':0xc8,'message':_0x388983[_0x6f00('0x20')]});})[_0x6f00('0x1a')](function(_0x1ea061){_0x198cc7(_0x295640['error'](0x1f5,_0x1ea061[_0x6f00('0x19')]));});});},'VoiceQueues':function(){return new Promise(function(_0x45945e){var _0x1fd40b=[];for(var _0x4d41ef in _0x44a0f9[_0x6f00('0x21')]){if(_0x44a0f9['voiceQueues'][_0x6f00('0x22')](_0x4d41ef)){var _0x511293=_0x44a0f9[_0x6f00('0x21')][_0x4d41ef];var _0x39375d=new VoiceQueueSummary(_0x511293);_0x1fd40b[_0x6f00('0x23')](_0x39375d);}}_0x45945e({'count':_0x1fd40b[_0x6f00('0x24')],'rows':_0x1fd40b});});},'UpdateVoiceQueue':function(_0x375d76){return new Promise(function(_0x49eb87,_0x23a346){var _0x25cc71=_[_0x6f00('0x25')](_0x44a0f9[_0x6f00('0x21')],{'id':parseInt(_0x375d76['id'])});var _0x2671fe=_[_0x6f00('0x26')](_0x375d76,['id']);if(_0x25cc71){for(var _0xff36ce in _0x2671fe){if(typeof _0x2671fe[_0xff36ce]!==_0x6f00('0x27')&&typeof _0x25cc71[_0xff36ce]!==_0x6f00('0x27')){_0x25cc71[_0xff36ce]=_0x2671fe[_0xff36ce];}}_0x49eb87(_0x25cc71);}else{_0x23a346();}});},'VoiceChannels':function(){return new Promise(function(_0x3f0b64){var _0x380e68=_[_0x6f00('0x28')](_0x44a0f9[_0x6f00('0x29')]);_0x3f0b64({'count':_0x380e68[_0x6f00('0x24')],'rows':_0x380e68});});},'VoiceChannelMixMonitor':function(_0x5dde51){var _0x5775c5=this;return new Promise(function(_0x5d16ad,_0x5df06d){if(ami['isConnected']()==![]){return _0x5df06d(_0x5775c5['error'](0x1f4,[config[_0x6f00('0x10')]['ip'],config['asterisk'][_0x6f00('0x11')],_0x6f00('0x12')][_0x6f00('0x13')]('\x20')));}var _0x344446=schema(properties[_0x6f00('0x2a')])[_0x6f00('0x1')](_0x5dde51);if(_0x344446['length']>0x0){return _0x5df06d(_0x5775c5[_0x6f00('0x1b')](0x1f4,_[_0x6f00('0x2b')](_0x344446,_0x6f00('0x19'))[_0x6f00('0x13')](',\x20')));}var _0x4255e8=_['find'](_0x44a0f9['channels'],{'uniqueid':_0x5dde51['uniqueid']});if(_0x4255e8&&_0x4255e8[_0x6f00('0x2c')]){var _0x127569=util[_0x6f00('0x4')](_0x6f00('0x2d'),_0x5dde51[_0x6f00('0x2e')]||_0x5dde51['uniqueid'],_0x5dde51[_0x6f00('0x4')]||_0x6f00('0x2f'));return ami[_0x6f00('0x1e')]({'action':_0x6f00('0x30'),'channel':_0x4255e8[_0x6f00('0x2c')],'file':_0x127569,'options':_0x6f00('0x31')})[_0x6f00('0x1f')](function(_0x52936d){var _0x28e436=_[_0x6f00('0x25')](_0x4255e8[_0x6f00('0x32')],{'filename':'/var/spool/asterisk/monitor/'+_0x127569[_0x6f00('0x33')]()});if(_[_0x6f00('0x34')](_0x28e436)){_0x4255e8[_0x6f00('0x32')]['push']({'filename':_0x6f00('0x35')+_0x127569['toLowerCase'](),'createdAt':moment()[_0x6f00('0x4')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x52936d[_0x6f00('0x36')],'status':_0x6f00('0x37')});}else{_0x28e436[_0x6f00('0x36')]=_0x52936d[_0x6f00('0x36')];_0x28e436['status']=_0x6f00('0x37');}_0x5d16ad({'code':0xc8,'message':[_0x5dde51['uniqueid'],_0x6f00('0x38'),_0x52936d['mixmonitorid']][_0x6f00('0x13')]('\x20'),'mixmonitorid':_0x52936d[_0x6f00('0x36')]});})[_0x6f00('0x1a')](function(_0x1ed015){_0x5df06d(_0x5775c5['error'](0x1f5,[_0x5dde51['uniqueid'],_0x1ed015[_0x6f00('0x19')]['toLowerCase']()][_0x6f00('0x13')]('\x20')));});}else{return _0x5df06d(_0x5775c5[_0x6f00('0x1b')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x2699af){var _0x5dce37=this;return new Promise(function(_0x4cac2c,_0x38da7f){if(ami[_0x6f00('0xf')]()==![]){return _0x38da7f(_0x5dce37[_0x6f00('0x1b')](0x1f4,[config[_0x6f00('0x10')]['ip'],config['asterisk'][_0x6f00('0x11')],_0x6f00('0x12')][_0x6f00('0x13')]('\x20')));}var _0x407f35=schema(properties[_0x6f00('0x2a')])[_0x6f00('0x1')](_0x2699af);if(_0x407f35['length']>0x0){return _0x38da7f(_0x5dce37[_0x6f00('0x1b')](0x1f4,_[_0x6f00('0x2b')](_0x407f35,_0x6f00('0x19'))[_0x6f00('0x13')](',\x20')));}var _0x303a32=_[_0x6f00('0x25')](_0x44a0f9['channels'],{'uniqueid':_0x2699af[_0x6f00('0x39')]});if(_0x303a32){return Promise[_0x6f00('0x3a')]()[_0x6f00('0x1f')](function(){if(_0x303a32['channel']){return ami[_0x6f00('0x1e')]({'action':'StopMixMonitor','channel':_0x303a32[_0x6f00('0x2c')],'mixmonitorid':_0x2699af[_0x6f00('0x36')]})['catch'](function(){});}})[_0x6f00('0x1f')](function(){if(_0x303a32['destinationchannel']){return ami[_0x6f00('0x1e')]({'action':_0x6f00('0x3b'),'channel':_0x303a32[_0x6f00('0x3c')],'mixmonitorid':_0x2699af[_0x6f00('0x36')]})['catch'](function(){});}})[_0x6f00('0x1f')](function(){var _0x59085a=_[_0x6f00('0x25')](_0x303a32['monitors'],{'mixmonitorid':_0x2699af[_0x6f00('0x36')]});if(_0x59085a){_0x59085a[_0x6f00('0x3d')]=_0x6f00('0x3e');}})[_0x6f00('0x1f')](function(){var _0x470ff3=util[_0x6f00('0x4')](_0x6f00('0x2d'),_0x2699af[_0x6f00('0x2e')]||_0x2699af['uniqueid'],_0x2699af[_0x6f00('0x4')]||'wav');var _0x265666=_[_0x6f00('0x25')](_0x303a32[_0x6f00('0x32')],{'filename':'/var/spool/asterisk/monitor/'+_0x470ff3['toLowerCase']()});if(_0x265666){_0x265666[_0x6f00('0x3d')]=_0x6f00('0x3e');}})['then'](function(){_0x4cac2c({'code':0xc8,'message':[_0x2699af[_0x6f00('0x39')],'StopMixMonitor\x20Success'][_0x6f00('0x13')]('\x20')});})['catch'](function(_0x21ef05){_0x38da7f(_0x5dce37[_0x6f00('0x1b')](0x1f5,[_0x2699af['uniqueid'],_0x21ef05['message'][_0x6f00('0x33')]()][_0x6f00('0x13')]('\x20')));});}else{return _0x38da7f(_0x5dce37['error'](0x1f5,_0x6f00('0x3f')));}});},'VoiceQueuesChannels':function(_0x5c1ad7){var _0x32a4e1=this;return new Promise(function(_0x7f80ed){var _0x3100ee=_[_0x6f00('0x28')](_0x44a0f9[_0x6f00('0x40')]);var _0x7bbc78={'count':_0x3100ee[_0x6f00('0x24')],'rows':_0x3100ee};if(_0x5c1ad7&&_0x5c1ad7[_0x6f00('0x41')]){if(![_0x6f00('0x42'),_0x6f00('0x43')][_0x6f00('0x44')](_0x5c1ad7[_0x6f00('0x41')])){return _0x3c29ff(_0x32a4e1[_0x6f00('0x1b')](0x190,_0x6f00('0x45')));}var _0x2a1bda=_[_0x6f00('0x46')](_0x3100ee,function(_0x2ba83e){return _0x2ba83e[_0x6f00('0x41')]===_0x5c1ad7[_0x6f00('0x41')];});_0x7bbc78[_0x6f00('0x47')]=_0x2a1bda['length'];_0x7bbc78['rows']=_0x2a1bda;}_0x7f80ed(_0x7bbc78);});},'VoiceQueuesChannel':function(_0x13f299){var _0x5eda94=this;return new Promise(function(_0x1bbd46,_0xd0bf75){var _0x4edd9f=schema(properties[_0x6f00('0x48')])[_0x6f00('0x1')](_0x13f299);if(_0x4edd9f[_0x6f00('0x24')]>0x0){return _0xd0bf75(_0x5eda94['error'](0x1f4,_[_0x6f00('0x2b')](_0x4edd9f,'message')[_0x6f00('0x13')](',\x20')));}var _0x19a99c=_['find'](_0x44a0f9[_0x6f00('0x40')],{'uniqueid':_0x13f299[_0x6f00('0x39')]});if(_0x19a99c){_0x1bbd46(_0x19a99c);}else{return _0xd0bf75(_0x5eda94[_0x6f00('0x1b')](0x1f5,_0x6f00('0x3f')));}});},'VoiceQueuesChannelHangup':function(_0x3cf1a5){var _0x1bb9f5=this;return new Promise(function(_0x2f8720,_0x4a4905){if(ami['isConnected']()==![]){return _0x4a4905(_0x1bb9f5['error'](0x1f4,[config['asterisk']['ip'],config[_0x6f00('0x10')][_0x6f00('0x11')],'ami\x20disconnected']['join']('\x20')));}var _0x120674=schema(properties[_0x6f00('0x49')])[_0x6f00('0x1')](_0x3cf1a5);if(_0x120674[_0x6f00('0x24')]>0x0){return _0x4a4905(_0x1bb9f5['error'](0x1f4,_[_0x6f00('0x2b')](_0x120674,'message')['join'](',\x20')));}var _0x419f32=_[_0x6f00('0x25')](_0x44a0f9[_0x6f00('0x40')],{'uniqueid':_0x3cf1a5[_0x6f00('0x39')]});if(_0x419f32&&_0x419f32[_0x6f00('0x2c')]){return ami['Action']({'action':_0x6f00('0x4a'),'channel':_0x419f32[_0x6f00('0x2c')]})[_0x6f00('0x1f')](function(_0xa21d60){_0x2f8720({'code':0xc8,'message':[_0x3cf1a5['uniqueid'],_0xa21d60['message'][_0x6f00('0x33')]()]['join']('\x20')});})[_0x6f00('0x1a')](function(_0x67c198){_0x4a4905(_0x1bb9f5[_0x6f00('0x1b')](0x1f5,[_0x3cf1a5[_0x6f00('0x39')],_0x67c198['message']['toLowerCase']()][_0x6f00('0x13')]('\x20')));});}else{return _0x4a4905(_0x1bb9f5[_0x6f00('0x1b')](0x1f5,_0x6f00('0x3f')));}});},'VoiceQueuesChannelRedirect':function(_0x1f19c0){var _0x555bb1=this;return new Promise(function(_0x14554c,_0x37af94){if(ami[_0x6f00('0xf')]()==![]){return _0x37af94(_0x555bb1[_0x6f00('0x1b')](0x1f4,[config[_0x6f00('0x10')]['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0x6f00('0x13')]('\x20')));}var _0x3ca0af=schema(properties['voicequeuechannelredirect'])['validate'](_0x1f19c0);if(_0x3ca0af[_0x6f00('0x24')]>0x0){return _0x37af94(_0x555bb1[_0x6f00('0x1b')](0x1f4,_['map'](_0x3ca0af,'message')[_0x6f00('0x13')](',\x20')));}var _0x201795=_[_0x6f00('0x25')](_0x44a0f9[_0x6f00('0x40')],{'uniqueid':_0x1f19c0[_0x6f00('0x39')]});if(_0x201795&&_0x201795[_0x6f00('0x2c')]){return ami[_0x6f00('0x1e')]({'action':_0x6f00('0x4b'),'channel':_0x201795['channel'],'exten':_0x1f19c0['exten'],'context':_0x1f19c0[_0x6f00('0x4c')]||_0x201795[_0x6f00('0x4c')],'priority':0x1})[_0x6f00('0x1f')](function(_0x36742b){_0x14554c({'code':0xc8,'message':[_0x1f19c0[_0x6f00('0x39')],_0x36742b[_0x6f00('0x19')][_0x6f00('0x33')]()][_0x6f00('0x13')]('\x20')});})[_0x6f00('0x1a')](function(_0xeaa3ca){_0x37af94(_0x555bb1[_0x6f00('0x1b')](0x1f5,[_0x1f19c0[_0x6f00('0x39')],_0xeaa3ca[_0x6f00('0x19')][_0x6f00('0x33')]()][_0x6f00('0x13')]('\x20')));});}else{return _0x37af94(_0x555bb1[_0x6f00('0x1b')](0x1f5,_0x6f00('0x3f')));}});},'Agents':function(_0x4f2ce8){return new Promise(function(_0x58321e){var _0x28bdeb=_['values'](_0x44a0f9[_0x6f00('0xb')]);if(_0x4f2ce8&&_0x4f2ce8['id']){var _0x46e8a5=_[_0x6f00('0x25')](_0x28bdeb,function(_0x8904ae){return _0x8904ae['id']===_0x4f2ce8['id'];});_0x58321e(_0x46e8a5);}else{_0x58321e({'count':_0x28bdeb[_0x6f00('0x24')],'rows':_0x28bdeb});}});},'Telephones':function(){return new Promise(function(_0x5a4a18){var _0x25420e=_[_0x6f00('0x28')](_0x44a0f9[_0x6f00('0x4d')]);_0x5a4a18({'count':_0x25420e[_0x6f00('0x24')],'rows':_0x25420e});});},'Trunks':function(){return new Promise(function(_0x23260e){var _0xd1f5a8=_[_0x6f00('0x28')](_0x44a0f9[_0x6f00('0x4e')]);_0x23260e({'count':_0xd1f5a8[_0x6f00('0x24')],'rows':_0xd1f5a8});});},'OutboundChannels':function(){return new Promise(function(_0x1cc857){var _0x19b5eb=_['values'](_0x44a0f9[_0x6f00('0x4f')]);_0x1cc857({'count':_0x19b5eb[_0x6f00('0x24')],'rows':_0x19b5eb});});},'Outbound':function(){return new Promise(function(_0x422318){_0x422318(_0x44a0f9['outbound']);});},'Campaigns':function(){return new Promise(function(_0x576927){var _0xab1d07=_[_0x6f00('0x28')](_0x44a0f9[_0x6f00('0x50')]);_0x576927({'count':_0xab1d07[_0x6f00('0x24')],'rows':_0xab1d07});});},'VoiceQueuesPreview':function(_0x5a9b42){var _0x564625=this;return new Promise(function(_0x4cb62d,_0x5089a5){_0x402677[_0x6f00('0x51')](_0x5a9b42['id'])[_0x6f00('0x1f')](function(_0x3fb141){_0x4cb62d({'code':0xc8,'message':_0x3fb141[_0x6f00('0x19')]});})[_0x6f00('0x1a')](function(_0x505746){_0x5089a5(_0x564625[_0x6f00('0x1b')](0x1f4,_0x505746[_0x6f00('0x19')]));});});},'EventManager':function(_0x538143){var _0xf8a1b6=this;return new Promise(function(_0x220711,_0x418af1){if(!_0x538143[_0x6f00('0x52')]){return _0x418af1(_0xf8a1b6[_0x6f00('0x1b')](0x1f4,_0x6f00('0x53')));}ami[_0x6f00('0x54')](_0x6f00('0x55')+_0x538143['event'],_0x538143[_0x6f00('0x19')]);_0x220711({'code':0xc8,'message':_0x538143});});},'FaxAccounts':function(){return new Promise(function(_0x552bee){var _0x426f41=_[_0x6f00('0x28')](_0x44a0f9[_0x6f00('0x56')]);_0x552bee({'count':_0x426f41[_0x6f00('0x24')],'rows':_0x426f41});});},'SendFax':function(_0x1ad295){var _0x1468ca=this;return new Promise(function(_0x2d1c2b,_0x3a2dad){_0x141e71[_0x6f00('0x57')](_0x1ad295)[_0x6f00('0x1f')](function(_0x1de592){_0x2d1c2b({'code':0xc8,'message':_0x1de592[_0x6f00('0x19')]});})[_0x6f00('0x1a')](function(_0x31e3f4){_0x3a2dad(_0x1468ca['error'](0x1f4,_0x31e3f4[_0x6f00('0x19')]));});});},'CheckAfterSend':function(_0xdfa8ff){var _0x1be439=this;return new Promise(function(_0x523476,_0x6cfc80){_0x141e71[_0x6f00('0x58')](_0xdfa8ff)['then'](function(_0x30f620){_0x523476({'code':0xc8,'message':_0x30f620[_0x6f00('0x19')]});})[_0x6f00('0x1a')](function(_0x28ed94){_0x6cfc80(_0x1be439['error'](0x1f4,_0x28ed94['message']));});});}};var _0x4e3fd8=jayson[_0x6f00('0x59')](_0x4f918f)[_0x6f00('0x5a')]();_0x4e3fd8['on'](_0x6f00('0x1b'),function(_0x19eb2c){return _0x3c29ff(_0x19eb2c);});_0x4e3fd8['listen'](0x232a,_0x6f00('0x5b'),function(){console[_0x6f00('0x5c')](_0x6f00('0x5d'),0x232a);return _0x52c9a2(_0x6f00('0x5e')+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 d3aa37f..115d7c2 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 _0xfa60=['scheduledAt','updatedAt','union','resolve','then','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','uniqueid','data4','calleridnum','calleridname','','Unknown','push','[CM][%s][%s]\x20Contact\x20created:%s','destcalleridname','user:%s','name','format','trigger:%s','action','toLowerCase','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','firstName','lastName','mobile','fax'];(function(_0x4a7e98,_0x250137){var _0x27d10d=function(_0x378768){while(--_0x378768){_0x4a7e98['push'](_0x4a7e98['shift']());}};_0x27d10d(++_0x250137);}(_0xfa60,0x8a));var _0x0fa6=function(_0x55d736,_0x33512b){_0x55d736=_0x55d736-0x0;var _0x59d56e=_0xfa60[_0x55d736];return _0x59d56e;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0x0fa6('0x0'));var util=require(_0x0fa6('0x1'));var config=require(_0x0fa6('0x2'));var logger=require(_0x0fa6('0x3'))(_0x0fa6('0x4'));var cmContactRpc=require(_0x0fa6('0x5'));config['redis']=_['defaults'](config[_0x0fa6('0x6')],{'host':_0x0fa6('0x7'),'port':0x18eb});var io=require(_0x0fa6('0x8'))(new Redis(config['redis']));function emit(_0x535139,_0x3ec228,_0x19205d,_0x55d564,_0x30ca74){logger[_0x0fa6('0x9')](_0x0fa6('0xa'),_0x535139,_0x3ec228['id'],_0x19205d,_0x55d564,JSON[_0x0fa6('0xb')](_0x30ca74));io['to'](_0x19205d)['emit'](_0x55d564,_0x30ca74);}exports[_0x0fa6('0xc')]=function(_0x5d5f99,_0x31340b,_0x148eb6,_0x39f73f){var _0x1cb590,_0x149994;var _0x63a6c3={};var _0x3c2f5b;var _0x459b24=Number(_0x148eb6[_0x0fa6('0xd')]);var _0x1f06e4=_0x148eb6['data2']?Boolean(Number(_0x148eb6[_0x0fa6('0xe')])):![];var _0x1f53c1;var _0x299de1=![];if(!_[_0x0fa6('0xf')](_0x148eb6['data5'])){if(_0x148eb6[_0x0fa6('0x10')]=='1')_0x299de1=!![];}if(!_0x299de1){if(_0x39f73f[_0x0fa6('0x11')]){_0x63a6c3['id']=_0x39f73f[_0x0fa6('0x11')];}}if(!_0x63a6c3['id']){_0x63a6c3[_0x0fa6('0x12')]=_0x459b24;_0x1f53c1=_0x148eb6[_0x0fa6('0x13')]&&_0x148eb6['data3']!=='0'?_0x148eb6[_0x0fa6('0x13')][_0x0fa6('0x14')](','):[_0x0fa6('0x15')];_0x63a6c3[_0x0fa6('0x16')]=_[_0x0fa6('0x17')](_0x1f53c1,function(_0x47c7e4){var _0x4751fb={};_0x4751fb[_0x47c7e4]=_0x39f73f[_0x0fa6('0x18')]?_0x39f73f[_0x0fa6('0x19')]:_0x39f73f['calleridnum'];return _0x4751fb;});_0x3c2f5b=_0x39f73f['routeId']?_0x39f73f['destcalleridnum']:_0x39f73f['calleridnum'];}var _0x4b5c36=['id',_0x0fa6('0x1a'),_0x0fa6('0x1b'),'phone',_0x0fa6('0x1c'),_0x0fa6('0x1d'),'ListId','createdAt',_0x0fa6('0x1e'),_0x0fa6('0x1f')];var _0x46f5df=_[_0x0fa6('0x20')](_0x4b5c36,_0x1f53c1);BPromise[_0x0fa6('0x21')]()[_0x0fa6('0x22')](cmContactRpc[_0x0fa6('0x23')]({'attributes':_0x46f5df,'where':_0x63a6c3,'phone':_0x3c2f5b}))[_0x0fa6('0x22')](function(_0x4f45d5){_0x149994=_0x4f45d5;if(!_['isEmpty'](_0x149994)){if(_0x149994[_0x0fa6('0x24')]===0x1){_0x1cb590=_0x149994[0x0];logger[_0x0fa6('0x9')](_0x0fa6('0x25'),_0x39f73f['uniqueid'],_0x31340b['id'],_0x1cb590['id']);}else{logger[_0x0fa6('0x9')](_0x0fa6('0x26'),_0x39f73f['uniqueid'],_0x31340b['id'],_['map'](_0x149994,'id')[_0x0fa6('0x27')](','));}return;}else{logger['info'](_0x0fa6('0x28'),_0x39f73f[_0x0fa6('0x29')],_0x31340b['id']);var _0x71ebd={'ListId':_0x459b24};var _0x49f715=_0x148eb6[_0x0fa6('0x2a')]&&_0x148eb6[_0x0fa6('0x2a')]!=='0'?_0x148eb6[_0x0fa6('0x2a')]:_0x0fa6('0x15');if(_0x1f06e4){logger[_0x0fa6('0x9')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x39f73f[_0x0fa6('0x29')],_0x31340b['id']);_0x71ebd[_0x49f715]=_[_0x0fa6('0xf')](_0x39f73f[_0x0fa6('0x18')])?_0x39f73f[_0x0fa6('0x2b')]:_0x39f73f['destcalleridnum'];if(_[_0x0fa6('0xf')](_0x39f73f[_0x0fa6('0x18')])){_0x71ebd['firstName']=_0x39f73f['calleridname']&&_0x39f73f[_0x0fa6('0x2c')]!==_0x0fa6('0x2d')?_0x39f73f[_0x0fa6('0x2c')]:_0x0fa6('0x2e');}else{_0x71ebd[_0x0fa6('0x1a')]=_0x39f73f['destcalleridname']&&_0x39f73f['destcalleridname']!==_0x0fa6('0x2d')?_0x39f73f['destcalleridname']:'Unknown';}return BPromise[_0x0fa6('0x21')]()[_0x0fa6('0x22')](cmContactRpc['createContact'](_0x71ebd))['then'](function(_0x20a35c){_0x1cb590=_0x20a35c;_0x149994[_0x0fa6('0x2f')](_0x20a35c);if(_0x1cb590){logger[_0x0fa6('0x9')](_0x0fa6('0x30'),_0x39f73f[_0x0fa6('0x29')],_0x31340b['id'],_0x1cb590['id']);}return;});}else{logger[_0x0fa6('0x9')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x39f73f['uniqueid'],_0x31340b['id']);_0x71ebd[_0x49f715]=_[_0x0fa6('0xf')](_0x39f73f['routeId'])?_0x39f73f[_0x0fa6('0x2b')]:_0x39f73f[_0x0fa6('0x19')];if(_[_0x0fa6('0xf')](_0x39f73f[_0x0fa6('0x18')])){_0x71ebd['firstName']=_0x39f73f[_0x0fa6('0x2c')]&&_0x39f73f[_0x0fa6('0x2c')]!==_0x0fa6('0x2d')?_0x39f73f['calleridname']:_0x0fa6('0x2e');}else{_0x71ebd[_0x0fa6('0x1a')]=_0x39f73f['destcalleridname']&&_0x39f73f[_0x0fa6('0x31')]!==_0x0fa6('0x2d')?_0x39f73f[_0x0fa6('0x31')]:_0x0fa6('0x2e');}_0x1cb590=_0x71ebd;_0x149994['push'](_0x71ebd);return;}}})[_0x0fa6('0x22')](function(){if(_0x5d5f99){emit(_0x39f73f['uniqueid'],_0x31340b,util['format'](_0x0fa6('0x32'),_0x5d5f99[_0x0fa6('0x33')]),util[_0x0fa6('0x34')](_0x0fa6('0x35'),_0x148eb6[_0x0fa6('0x36')][_0x0fa6('0x37')]()),{'evt':_['merge'](_0x39f73f,{'autoCreate':_0x1f06e4}),'contact':_0x1cb590===undefined?{}:_0x1cb590,'contacts':_0x149994[_0x0fa6('0x24')]===0x0?undefined:_0x149994});}});}; \ No newline at end of file +var _0xafc8=['getContacts','isEmpty','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','name','format','trigger:%s','action','toLowerCase','merge','length','bluebird','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','info','[CM][%s][%s]','stringify','exec','data1','data2','data5','xmd-contactid','ListId','data3','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','scheduledAt','updatedAt','union','resolve','then'];(function(_0x11cf41,_0x3172b6){var _0x4e6a37=function(_0x1a2f20){while(--_0x1a2f20){_0x11cf41['push'](_0x11cf41['shift']());}};_0x4e6a37(++_0x3172b6);}(_0xafc8,0x15a));var _0x8afc=function(_0x5c234f,_0x37dabc){_0x5c234f=_0x5c234f-0x0;var _0x1b3ba6=_0xafc8[_0x5c234f];return _0x1b3ba6;};'use strict';var _=require('lodash');var BPromise=require(_0x8afc('0x0'));var Redis=require(_0x8afc('0x1'));var util=require(_0x8afc('0x2'));var config=require('../../../../config/environment');var logger=require(_0x8afc('0x3'))(_0x8afc('0x4'));var cmContactRpc=require(_0x8afc('0x5'));config[_0x8afc('0x6')]=_['defaults'](config[_0x8afc('0x6')],{'host':_0x8afc('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8afc('0x6')]));function emit(_0x5609ea,_0x5ba1a4,_0x1ad6a1,_0x2180cf,_0x3c5b87){logger[_0x8afc('0x8')](_0x8afc('0x9'),_0x5609ea,_0x5ba1a4['id'],_0x1ad6a1,_0x2180cf,JSON[_0x8afc('0xa')](_0x3c5b87));io['to'](_0x1ad6a1)['emit'](_0x2180cf,_0x3c5b87);}exports[_0x8afc('0xb')]=function(_0x55d01a,_0x44ec03,_0x5681f1,_0x9a2754){var _0xa50be4,_0x1c2527;var _0x4107e7={};var _0x535328;var _0x1ebfe0=Number(_0x5681f1[_0x8afc('0xc')]);var _0x52f19e=_0x5681f1['data2']?Boolean(Number(_0x5681f1[_0x8afc('0xd')])):![];var _0x452dc9;var _0x1c1c80=![];if(!_['isNil'](_0x5681f1['data5'])){if(_0x5681f1[_0x8afc('0xe')]=='1')_0x1c1c80=!![];}if(!_0x1c1c80){if(_0x9a2754[_0x8afc('0xf')]){_0x4107e7['id']=_0x9a2754['xmd-contactid'];}}if(!_0x4107e7['id']){_0x4107e7[_0x8afc('0x10')]=_0x1ebfe0;_0x452dc9=_0x5681f1[_0x8afc('0x11')]&&_0x5681f1[_0x8afc('0x11')]!=='0'?_0x5681f1['data3']['split'](','):[_0x8afc('0x12')];_0x4107e7[_0x8afc('0x13')]=_[_0x8afc('0x14')](_0x452dc9,function(_0x40a255){var _0x1319d9={};_0x1319d9[_0x40a255]=_0x9a2754[_0x8afc('0x15')]?_0x9a2754[_0x8afc('0x16')]:_0x9a2754[_0x8afc('0x17')];return _0x1319d9;});_0x535328=_0x9a2754[_0x8afc('0x15')]?_0x9a2754[_0x8afc('0x16')]:_0x9a2754[_0x8afc('0x17')];}var _0x717467=['id',_0x8afc('0x18'),_0x8afc('0x19'),_0x8afc('0x12'),_0x8afc('0x1a'),'fax','ListId','createdAt',_0x8afc('0x1b'),_0x8afc('0x1c')];var _0x424eb1=_[_0x8afc('0x1d')](_0x717467,_0x452dc9);BPromise[_0x8afc('0x1e')]()[_0x8afc('0x1f')](cmContactRpc[_0x8afc('0x20')]({'attributes':_0x424eb1,'where':_0x4107e7,'phone':_0x535328}))[_0x8afc('0x1f')](function(_0x4a1727){_0x1c2527=_0x4a1727;if(!_[_0x8afc('0x21')](_0x1c2527)){if(_0x1c2527['length']===0x1){_0xa50be4=_0x1c2527[0x0];logger[_0x8afc('0x8')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x9a2754[_0x8afc('0x22')],_0x44ec03['id'],_0xa50be4['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x9a2754['uniqueid'],_0x44ec03['id'],_[_0x8afc('0x14')](_0x1c2527,'id')[_0x8afc('0x23')](','));}return;}else{logger[_0x8afc('0x8')](_0x8afc('0x24'),_0x9a2754[_0x8afc('0x22')],_0x44ec03['id']);var _0x1971b5={'ListId':_0x1ebfe0};var _0xf86e27=_0x5681f1[_0x8afc('0x25')]&&_0x5681f1[_0x8afc('0x25')]!=='0'?_0x5681f1['data4']:'phone';if(_0x52f19e){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x9a2754[_0x8afc('0x22')],_0x44ec03['id']);_0x1971b5[_0xf86e27]=_[_0x8afc('0x26')](_0x9a2754[_0x8afc('0x15')])?_0x9a2754[_0x8afc('0x17')]:_0x9a2754[_0x8afc('0x16')];if(_['isNil'](_0x9a2754[_0x8afc('0x15')])){_0x1971b5['firstName']=_0x9a2754[_0x8afc('0x27')]&&_0x9a2754[_0x8afc('0x27')]!==_0x8afc('0x28')?_0x9a2754['calleridname']:_0x8afc('0x29');}else{_0x1971b5['firstName']=_0x9a2754[_0x8afc('0x2a')]&&_0x9a2754['destcalleridname']!==_0x8afc('0x28')?_0x9a2754[_0x8afc('0x2a')]:_0x8afc('0x29');}return BPromise[_0x8afc('0x1e')]()[_0x8afc('0x1f')](cmContactRpc[_0x8afc('0x2b')](_0x1971b5))['then'](function(_0x22bec3){_0xa50be4=_0x22bec3;_0x1c2527[_0x8afc('0x2c')](_0x22bec3);if(_0xa50be4){logger[_0x8afc('0x8')](_0x8afc('0x2d'),_0x9a2754[_0x8afc('0x22')],_0x44ec03['id'],_0xa50be4['id']);}return;});}else{logger[_0x8afc('0x8')](_0x8afc('0x2e'),_0x9a2754[_0x8afc('0x22')],_0x44ec03['id']);_0x1971b5[_0xf86e27]=_[_0x8afc('0x26')](_0x9a2754[_0x8afc('0x15')])?_0x9a2754['calleridnum']:_0x9a2754[_0x8afc('0x16')];if(_[_0x8afc('0x26')](_0x9a2754[_0x8afc('0x15')])){_0x1971b5['firstName']=_0x9a2754[_0x8afc('0x27')]&&_0x9a2754[_0x8afc('0x27')]!==_0x8afc('0x28')?_0x9a2754[_0x8afc('0x27')]:_0x8afc('0x29');}else{_0x1971b5['firstName']=_0x9a2754['destcalleridname']&&_0x9a2754[_0x8afc('0x2a')]!==_0x8afc('0x28')?_0x9a2754[_0x8afc('0x2a')]:_0x8afc('0x29');}_0xa50be4=_0x1971b5;_0x1c2527[_0x8afc('0x2c')](_0x1971b5);return;}}})['then'](function(){if(_0x55d01a){emit(_0x9a2754['uniqueid'],_0x44ec03,util['format']('user:%s',_0x55d01a[_0x8afc('0x2f')]),util[_0x8afc('0x30')](_0x8afc('0x31'),_0x5681f1[_0x8afc('0x32')][_0x8afc('0x33')]()),{'evt':_[_0x8afc('0x34')](_0x9a2754,{'autoCreate':_0x52f19e}),'contact':_0xa50be4===undefined?{}:_0xa50be4,'contacts':_0x1c2527[_0x8afc('0x35')]===0x0?undefined:_0x1c2527});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 38becde..1de1873 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 _0xd52a=['script','parse','search','channel','every','AllConditions','checkConditions','some','checkTrigger:\x20trigger','evt','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','event','agent','membername','lastevent','null','substatus','offlineMessage','equals','util','url','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','trigger','../ami','defaults','redis','localhost','socket.io-emitter','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','salesforceAccounts','freshdeskAccounts','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentreject','custom:amd','custom:timeout','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','emit','info','prototype','clone','undefined','motionChannel','debug','inspect','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','action','contactmanager','motionbar','browser','TemplateId','html','data2','render','template\x20not\x20found','uri','buildUri','data3','isNil','data4','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winApplication','format','user:%s','trigger:%s:%s','jscripty','name','toLowerCase','exec','integration','queue','routeId','urlforward'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xd52a,0x9a));var _0xad52=function(_0x361051,_0x2d9346){_0x361051=_0x361051-0x0;var _0x265e49=_0xd52a[_0x361051];return _0x265e49;};'use strict';var util=require(_0xad52('0x0'));var _=require('lodash');var url=require(_0xad52('0x1'));var Mustache=require('mustache');var Redis=require(_0xad52('0x2'));var urlforward=require(_0xad52('0x3'));var integration=require(_0xad52('0x4'));var cmContact=require(_0xad52('0x5'));var script=require(_0xad52('0x6'));var config=require(_0xad52('0x7'));var logger=require('../../../config/logger')(_0xad52('0x8'));var ami=require(_0xad52('0x9'));config['redis']=_[_0xad52('0xa')](config[_0xad52('0xb')],{'host':_0xad52('0xc'),'port':0x18eb});var io=require(_0xad52('0xd'))(new Redis(config['redis']));var operators={'equals':function(_0x192e95,_0xbbf053){return _0x192e95==_0xbbf053;},'not_equals':function(_0x6fcfea,_0x3477af){return _0x6fcfea!=_0x3477af;}};var barAndWebActions=[_0xad52('0xe'),_0xad52('0x1'),'winapp'];function Trigger(_0x1649eb){this[_0xad52('0xf')]=_0x1649eb[_0xad52('0xf')];this[_0xad52('0x10')]=_0x1649eb[_0xad52('0x10')];this[_0xad52('0x11')]=_0x1649eb[_0xad52('0x11')];this[_0xad52('0x12')]=_0x1649eb[_0xad52('0x12')];this[_0xad52('0x13')]=_0x1649eb[_0xad52('0x13')];this[_0xad52('0x14')]=_0x1649eb[_0xad52('0x14')];this['freshdeskAccounts']=_0x1649eb['freshdeskAccounts'];this['salesforceAccounts']=_0x1649eb['salesforceAccounts'];this[_0xad52('0x15')]=_0x1649eb[_0xad52('0x15')];this[_0xad52('0x16')]=_0x1649eb[_0xad52('0x16')];this['deskAccounts']=_0x1649eb[_0xad52('0x17')];this['vtigerAccounts']=_0x1649eb[_0xad52('0x18')];this[_0xad52('0x19')]=_0x1649eb['servicenowAccounts'];this[_0xad52('0x1a')]=_0x1649eb[_0xad52('0x1a')];this[_0xad52('0x1b')]=_0x1649eb[_0xad52('0x1b')];this[_0xad52('0x1c')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0xad52('0x1d')],'freshdesk':this[_0xad52('0x1e')],'sugarcrm':this[_0xad52('0x15')],'zoho':this[_0xad52('0x16')],'desk':this['deskAccounts'],'vtiger':this[_0xad52('0x18')],'dynamics365':this[_0xad52('0x1a')],'freshsales':this[_0xad52('0x1b')],'servicenow':this[_0xad52('0x19')]};ami['on']('custom:agentcalled',this[_0xad52('0x1f')][_0xad52('0x20')](this));ami['on'](_0xad52('0x21'),this[_0xad52('0x1f')][_0xad52('0x20')](this));ami['on'](_0xad52('0x22'),this[_0xad52('0x1f')]['bind'](this));ami['on'](_0xad52('0x23'),this['syncCustomEvent']['bind'](this));ami['on'](_0xad52('0x24'),this[_0xad52('0x1f')][_0xad52('0x20')](this));ami['on']('custom:agentnoanswer',this[_0xad52('0x1f')]['bind'](this));ami['on']('custom:agentbusy',this['syncCustomEvent'][_0xad52('0x20')](this));ami['on']('custom:agentcongestion',this['syncCustomEvent'][_0xad52('0x20')](this));ami['on'](_0xad52('0x25'),this[_0xad52('0x1f')]['bind'](this));ami['on'](_0xad52('0x26'),this[_0xad52('0x1f')][_0xad52('0x20')](this));ami['on']('custom:queuecallerabandon',this[_0xad52('0x1f')][_0xad52('0x20')](this));ami['on'](_0xad52('0x27'),this['syncCustomEvent'][_0xad52('0x20')](this));ami['on']('custom:dialbegin',this[_0xad52('0x28')][_0xad52('0x20')](this));ami['on'](_0xad52('0x29'),this[_0xad52('0x28')][_0xad52('0x20')](this));ami['on'](_0xad52('0x2a'),this[_0xad52('0x28')]['bind'](this));ami['on'](_0xad52('0x2b'),this[_0xad52('0x1f')][_0xad52('0x20')](this));ami['on'](_0xad52('0x2c'),this[_0xad52('0x1f')][_0xad52('0x20')](this));ami['on'](_0xad52('0x2d'),this[_0xad52('0x1f')][_0xad52('0x20')](this));ami['on']('custom:incomingmessage',this[_0xad52('0x1f')][_0xad52('0x20')](this));ami['on'](_0xad52('0x2e'),this['syncCustomEvent']['bind'](this));ami['on'](_0xad52('0x2f'),this[_0xad52('0x1f')][_0xad52('0x20')](this));ami['on'](_0xad52('0x30'),this[_0xad52('0x1f')][_0xad52('0x20')](this));ami['on'](_0xad52('0x31'),this[_0xad52('0x1f')][_0xad52('0x20')](this));}Trigger['prototype'][_0xad52('0x32')]=function(_0x4b87fe,_0x425880,_0x542f14){logger[_0xad52('0x33')](_0x4b87fe,_0x425880,JSON['stringify'](_0x542f14));io['to'](_0x4b87fe)[_0xad52('0x32')](_0x425880,_0x542f14);};Trigger[_0xad52('0x34')]['syncCustomEvent']=function(_0x80ced0){var _0x45c044=_[_0xad52('0x35')](_0x80ced0);if(typeof _0x45c044['motionChannel']===_0xad52('0x36')){_0x45c044[_0xad52('0x37')]='voice';}logger[_0xad52('0x38')](_0xad52('0x1f'),util[_0xad52('0x39')](_0x45c044,{'showHidden':!![],'depth':null}));this[_0xad52('0x3a')](_0x45c044);};Trigger[_0xad52('0x34')][_0xad52('0x28')]=function(_0x4dff72){if(this[_0xad52('0x10')][_0x4dff72[_0xad52('0x3b')]]){this[_0xad52('0x1f')](_0x4dff72);}};Trigger[_0xad52('0x34')][_0xad52('0x3a')]=function(_0x200d9d){var _0x246d4c;for(var _0x4b0e09 in this['triggers']){if(this['triggers'][_0xad52('0x3c')](_0x4b0e09)){if(this[_0xad52('0xf')][_0x4b0e09][_0xad52('0x3d')]){_0x246d4c=this[_0xad52('0x3e')](this['triggers'][_0x4b0e09],_0x200d9d);if(_0x246d4c){_[_0xad52('0x3f')](_0x200d9d,_0x200d9d[_0xad52('0x40')]);for(var _0x2ef2db=0x0,_0x42878e,_0x7a29d6,_0x65f9ae;_0x2ef2db0x0){_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 _0x5fc3=['map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x5fc3,0xa8));var _0x35fc=function(_0x257a28,_0x2cd00d){_0x257a28=_0x257a28-0x0;var _0x13bccc=_0x5fc3[_0x257a28];return _0x13bccc;};'use strict';var _=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var md5=require('md5');var util=require(_0x35fc('0x2'));var Redis=require(_0x35fc('0x3'));var intUtil=require(_0x35fc('0x4'));var config=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('desk');config[_0x35fc('0x7')]=_[_0x35fc('0x8')](config[_0x35fc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35fc('0x7')]));function emit(_0x508b32,_0x16e153,_0x27524f){io['to'](_0x508b32)[_0x35fc('0x9')](_0x16e153,_0x27524f);}var headers={'Content-Type':_0x35fc('0xa'),'Accept':_0x35fc('0xa')};function getUser(_0xf9d3a6,_0x2051ab){if(intUtil['validateEmail'](_0x2051ab)===!![]){logger[_0x35fc('0xb')](_0x35fc('0xc'),_0x2051ab);return request({'uri':util['format'](_0x35fc('0xd'),_0xf9d3a6[_0x35fc('0xe')])})['then'](function(_0xda83fb){if(_0xda83fb[_0x35fc('0xf')]){return _['find'](_0xda83fb['_embedded'][_0x35fc('0x10')],{'email':_0x2051ab});}})['then'](function(_0x397738){if(_0x397738){logger[_0x35fc('0xb')](_0x35fc('0x11'));return _0x397738;}else{logger[_0x35fc('0xb')](_0x35fc('0x12'));return request({'uri':util['format']('%s/users/me',_0xf9d3a6['remoteUri'])});}});}else{logger['info'](_0x35fc('0x13'));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x15'),_0xf9d3a6[_0x35fc('0xe')])});}}function request(_0x227a49){logger[_0x35fc('0x16')]('[HTTP]',JSON[_0x35fc('0x17')](_0x227a49));return rp(_[_0x35fc('0x8')](_0x227a49,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x41e165){var _0x363e47;if(_0x41e165[_0x35fc('0x18')]==='basic'){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x19'),_0x41e165[_0x35fc('0x1a')],_0x41e165['password']);}else if(_0x41e165[_0x35fc('0x18')]===_0x35fc('0x1b')){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x1c'),_0x41e165[_0x35fc('0x1a')],_0x41e165[_0x35fc('0x1b')]);}return util[_0x35fc('0x14')](_0x35fc('0x1d'),new Buffer(_0x363e47)[_0x35fc('0x1e')](_0x35fc('0x1f')));}function getEndUser(_0x5bd2b8,_0x323aee,_0xd5399f){logger[_0x35fc('0xb')](_0x35fc('0x20'),_0xd5399f);return request({'uri':util[_0x35fc('0x14')]('%s/customers/search',_0x5bd2b8[_0x35fc('0xe')]),'qs':{'phone':_0xd5399f}})[_0x35fc('0x21')](function(_0x561bf8){if(_0x561bf8[_0x35fc('0xf')]){logger[_0x35fc('0xb')](_0x35fc('0x22'));return _0x561bf8['_embedded'][_0x35fc('0x10')][0x0];}else{logger['info'](_0x35fc('0x23'));return request({'uri':util[_0x35fc('0x14')]('%s/customers',_0x5bd2b8['remoteUri']),'method':_0x35fc('0x24'),'body':{'first_name':_0x323aee,'title':_0x323aee,'phone_numbers':[{'type':'work','value':_0xd5399f}]}});}});}function getTags(_0x274208,_0x1a5d92){var _0x57001c=[];if(_0x274208&&_0x274208[_0x35fc('0x25')]>0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 17d1060..c456c18 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 _0x0592=['recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','error','Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','data2','resolve','clientId','username','password','clientSecret','then','access_token','toUpperCase','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','systemuserid','userId','info','catch','toLowerCase','destcalleridnum','calleridnum','POST','/systemusers(','4.0','body','headers','odata-entityid','lastIndexOf','enduserId','telephone1','GET','contacts?$select=','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','picklist','type','nameField','customField','idField','substring','indexOf','content','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','callDirection','queue','phonecalls','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','outbound','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL'];(function(_0x53b39a,_0x43a89a){var _0x29d39f=function(_0x25b321){while(--_0x25b321){_0x53b39a['push'](_0x53b39a['shift']());}};_0x29d39f(++_0x43a89a);}(_0x0592,0x156));var _0x2059=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0592[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var rp=require(_0x2059('0x0'));var util=require(_0x2059('0x1'));var intUtil=require(_0x2059('0x2'));var md5=require(_0x2059('0x3'));var Redis=require(_0x2059('0x4'));var logger=require(_0x2059('0x5'))('dynamics365');var config=require(_0x2059('0x6'));config[_0x2059('0x7')]=_[_0x2059('0x8')](config[_0x2059('0x7')],{'host':_0x2059('0x9'),'port':0x18eb});var io=require(_0x2059('0xa'))(new Redis(config['redis']));function getAuthToken(_0xc370ec,_0x3aaf65,_0x70baf2){if(_0xc370ec[_0x2059('0xb')]){_0xc370ec[_0x2059('0xc')]=_0xc370ec[_0x2059('0xd')][_0x2059('0xe')];_0xc370ec['tenantId']=_0xc370ec[_0x2059('0xd')][_0x2059('0xf')];return Promise[_0x2059('0x10')](_0xc370ec[_0x2059('0xd')]['data5']);}var _0x1dacb0={'method':'POST','uri':_0x3aaf65,'form':{'client_id':_0xc370ec[_0x2059('0x11')],'resource':_0xc370ec[_0x2059('0xc')],'username':_0xc370ec[_0x2059('0x12')],'password':_0xc370ec['password'],'grant_type':_0x2059('0x13'),'client_secret':_0xc370ec[_0x2059('0x14')]},'json':!![]};return rp(_0x1dacb0)[_0x2059('0x15')](function(_0x3ce692){return _0x3ce692[_0x2059('0x16')];})['catch'](function(_0x1e18fb){logger['error']('['+[_0x70baf2[_0x2059('0x17')]()]+']\x20Wrong\x20credentials!');return _0x1e18fb[_0x2059('0x18')];});}function getUser(_0x5e52fc,_0x2809b2,_0x77dab,_0x512ea5,_0x22731a,_0x15f825){return new Promise(function(_0x5920d5,_0x32c5d2){return getAuthToken(_0x2809b2,_0x512ea5,_0x15f825)[_0x2059('0x15')](function(_0x482bea){var _0x446226={'method':'GET','uri':_0x22731a+_0x2059('0x19'),'headers':{'Authorization':_0x2059('0x1a')+_0x482bea,'OData-Version':'4.0'},'json':!![]};return rp(_0x446226);})['then'](function(_0x3dbca3){var _0x233af0=_0x3dbca3[_0x2059('0x1b')];var _0x154901=![];var _0x34ba94=null;if(!_[_0x2059('0x1c')](_0x77dab)){if(intUtil[_0x2059('0x1d')](_0x77dab[_0x2059('0x1e')])){_0x5e52fc[_0x2059('0x1f')]=_0x77dab[_0x2059('0x1e')];for(_0x34ba94=0x0;_0x34ba94<_0x233af0[_0x2059('0x20')];_0x34ba94++){if(_0x233af0[_0x34ba94][_0x2059('0x21')]===_0x77dab[_0x2059('0x1e')]&&!_0x233af0[_0x34ba94]['isdisabled']){_0x154901=!![];logger['info']('['+[_0x15f825['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x233af0[_0x34ba94][_0x2059('0x22')]+'!');_0x5e52fc[_0x2059('0x23')]=_0x233af0[_0x34ba94]['systemuserid'];}}}}if(!_0x154901){logger[_0x2059('0x24')]('['+[_0x15f825['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x5e52fc[_0x2059('0x1f')]=_0x2809b2[_0x2059('0x12')];for(_0x34ba94=0x0;_0x34ba94<_0x233af0['length'];_0x34ba94++){if(_0x233af0[_0x34ba94]['internalemailaddress']===_0x2809b2[_0x2059('0x12')]){_0x5e52fc[_0x2059('0x23')]=_0x233af0[_0x34ba94]['systemuserid'];}}}_0x5920d5(_0x5e52fc);})[_0x2059('0x25')](function(_0x5b76b7){_0x32c5d2(_0x5b76b7['message']);});});}function createEndUser(_0x52f65b,_0x576f5c,_0x19ccec,_0x4481d6,_0x586082,_0xfa06fe,_0x1f0a29){return new Promise(function(_0xf4cb0c,_0x122a68){return getAuthToken(_0x576f5c,_0x19ccec,_0xfa06fe)[_0x2059('0x15')](function(_0x29eb0a){var _0x424871=_0xfa06fe[_0x2059('0x26')]()==='outbound'?_0x586082[_0x2059('0x27')]:_0x586082[_0x2059('0x28')];var _0x1bfa11={'method':_0x2059('0x29'),'uri':_0x4481d6+'contacts','body':{'fullname':_0x424871,'firstname':_0x424871,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x2059('0x2a')+_0x52f65b[_0x2059('0x23')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x29eb0a,'OData-Version':_0x2059('0x2b')},'json':!![],'resolveWithFullResponse':!![]};_0x1bfa11[_0x2059('0x2c')][_0x1f0a29]=_0x424871;return rp(_0x1bfa11);})[_0x2059('0x15')](function(_0x332c4e){var _0x41f3ef=_0x332c4e[_0x2059('0x2d')][_0x2059('0x2e')];var _0x2169af=_0x41f3ef['substring'](_0x41f3ef[_0x2059('0x2f')]('(')+0x1,_0x41f3ef[_0x2059('0x2f')](')'));_0x52f65b[_0x2059('0x30')]=_0x2169af;_0xf4cb0c(_0x52f65b);})[_0x2059('0x25')](function(_0x364715){_0x122a68(_0x364715['message']);});});}function getEndUser(_0x42e2a3,_0x445dfa,_0x2f8d3,_0x744a36,_0x1ce8a7,_0x2b4026,_0x2c61e0,_0x29906c){var _0x456027=_0x2b4026['toLowerCase']()==='outbound'?_0x1ce8a7[_0x2059('0x27')]:_0x1ce8a7['calleridnum'];return getAuthToken(_0x445dfa,_0x2f8d3,_0x2b4026)['then'](function(_0x139461){_0x29906c=_0x29906c?_0x29906c:_0x2059('0x31');var _0x7843ba={'method':_0x2059('0x32'),'uri':_0x744a36+_0x2059('0x33')+_0x29906c+'&$filter='+_0x29906c+'\x20eq\x20\x27'+_0x456027[_0x2059('0x34')]('+',_0x2059('0x35'))+'\x27','headers':{'Authorization':_0x2059('0x1a')+_0x139461,'If-None-Match':null,'OData-Version':_0x2059('0x2b')},'json':!![]};return rp(_0x7843ba);})['then'](function(_0x5d2f94){var _0x178472=![];if(!_0x5d2f94)return _0x178472;var _0x275209=_0x5d2f94[_0x2059('0x1b')];for(var _0x1007e6=0x0;_0x1007e6<_0x275209[_0x2059('0x20')];_0x1007e6++){if(_0x275209[_0x1007e6][_0x29906c]===_0x456027){_0x178472=!![];_0x42e2a3[_0x2059('0x30')]=_0x275209[_0x1007e6][_0x2059('0x36')];}}return _0x178472;})['then'](function(_0x25548c){if(_0x25548c)return _0x42e2a3;if(_0x2c61e0===_0x2059('0x37')){logger[_0x2059('0x24')]('['+[_0x2b4026['toUpperCase']()]+_0x2059('0x38'));return _0x42e2a3;}return createEndUser(_0x42e2a3,_0x445dfa,_0x2f8d3,_0x744a36,_0x1ce8a7,_0x2b4026,_0x29906c)['then'](function(_0x164eab){logger[_0x2059('0x24')]('['+[_0x2b4026[_0x2059('0x17')]()]+_0x2059('0x39'),_0x164eab[_0x2059('0x30')]);return _0x164eab;});});}function getCustomFields(_0x310d29,_0x584e92,_0x1054a9){var _0x4c2440={};if(_0x310d29['length']>0x0){_[_0x2059('0x3a')](_0x310d29,function(_0x468473){if(_[_0x2059('0x3b')](['string',_0x2059('0x3c')],_0x468473[_0x2059('0x3d')])&&_0x468473[_0x2059('0x3e')]&&!_0x468473[_0x2059('0x3f')]){var _0x30d942=_0x468473[_0x2059('0x40')]['toLowerCase']();var _0x415ae9=_0x30d942[_0x2059('0x41')](0x0,_0x30d942['indexOf']('_'));var _0x3439de=_0x30d942[_0x2059('0x41')](_0x30d942[_0x2059('0x42')]('_')+0x1);if(_0x415ae9===_0x1054a9){_0x4c2440[_0x3439de]=_0x468473[_0x2059('0x43')];}}});}return _0x4c2440;}function getTicket(_0x11f4b2,_0x44f460,_0x55c858,_0x1cd896,_0x2e6713,_0x22493e,_0x25beaf){return new Promise(function(_0x4e02be,_0x44f19c){var _0x2c935c;return getAuthToken(_0x44f460,_0x55c858,_0x25beaf)[_0x2059('0x15')](function(_0x4949d6){if(_0x22493e['ticketType']===_0x2059('0x44')){_0x2c935c={'method':'POST','uri':_0x1cd896+_0x2059('0x45'),'body':Object[_0x2059('0x46')]({},{'title':intUtil[_0x2059('0x47')](_0x22493e[_0x2059('0x48')],_0x2e6713,'\x20'),'description':intUtil[_0x2059('0x47')](_0x22493e[_0x2059('0x49')],_0x2e6713,'\x0a'),'customerid_contact@odata.bind':_0x11f4b2['enduserId']?_0x2059('0x4a')+_0x11f4b2[_0x2059('0x30')]+')':undefined,'ownerid@odata.bind':_0x2059('0x2a')+_0x11f4b2[_0x2059('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x22493e[_0x2059('0x4b')],_0x2e6713,_0x22493e[_0x2059('0x4c')])),'headers':{'Authorization':_0x2059('0x1a')+_0x4949d6,'OData-Version':_0x2059('0x2b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x22493e[_0x2059('0x4c')]==='phonecall'){var _0x2cdfe0=_0x11f4b2[_0x2059('0x30')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x11f4b2[_0x2059('0x23')]+')','participationtypemask':_0x11f4b2[_0x2059('0x4d')]===_0x2059('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x11f4b2[_0x2059('0x30')]+')','participationtypemask':_0x11f4b2[_0x2059('0x4d')]===_0x2059('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x2059('0x2a')+_0x11f4b2[_0x2059('0x23')]+')','participationtypemask':_0x11f4b2[_0x2059('0x4d')]==='queue'?0x2:0x1}];_0x2c935c={'method':'POST','uri':_0x1cd896+_0x2059('0x4f'),'body':Object[_0x2059('0x46')]({},{'subject':intUtil[_0x2059('0x47')](_0x22493e[_0x2059('0x48')],_0x2e6713,'\x20'),'phonenumber':String(_0x2e6713[_0x2059('0x28')]),'description':intUtil[_0x2059('0x47')](_0x22493e[_0x2059('0x49')],_0x2e6713,'\x0a'),'regardingobjectid_contact@odata.bind':_0x11f4b2['enduserId']?_0x2059('0x4a')+_0x11f4b2['enduserId']+')':undefined,'ownerid@odata.bind':_0x2059('0x2a')+_0x11f4b2[_0x2059('0x23')]+')','directioncode':_0x11f4b2[_0x2059('0x4d')]===_0x2059('0x4e')?![]:!![],'phonecall_activity_parties':_0x2cdfe0},getCustomFields(_0x22493e['Fields'],_0x2e6713,_0x22493e[_0x2059('0x4c')])),'headers':{'Authorization':_0x2059('0x1a')+_0x4949d6,'OData-Version':_0x2059('0x2b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2c935c);})['then'](function(_0x1c4d2e){var _0x46bef1=_0x1c4d2e[_0x2059('0x2d')][_0x2059('0x2e')];var _0x5dc1b9=_0x46bef1[_0x2059('0x41')](_0x46bef1[_0x2059('0x2f')]('(')+0x1,_0x46bef1[_0x2059('0x2f')](')'));_0x11f4b2[_0x2059('0x50')]=_0x5dc1b9;_0x4e02be(_0x11f4b2);})[_0x2059('0x25')](function(_0x563595){_0x44f19c(_0x563595[_0x2059('0x18')]);});});}function emit(_0x24eace,_0x5749c9,_0x1c48cd,_0x49d7c5){var _0x22efe4={'uri':util[_0x2059('0x51')](_0x2059('0x52'),_0x24eace,_0x1c48cd,_0x49d7c5)};io['to'](util[_0x2059('0x51')](_0x2059('0x53'),_0x5749c9))[_0x2059('0x54')]('trigger:browser:url',_0x22efe4);}exports['cs']=function(_0x5d3fb9,_0x1137bc,_0x9ec1f,_0x3f156e,_0x252534,_0x53cc8a,_0x11f71b,_0x2a77c0){var _0x35e8b1={};_0x53cc8a[_0x2059('0xc')]=_0x53cc8a[_0x2059('0xb')]?intUtil['stripTrailingSlash'](_0x53cc8a[_0x2059('0xd')][_0x2059('0xe')]):intUtil[_0x2059('0x55')](_0x53cc8a[_0x2059('0xc')]);_0x53cc8a[_0x2059('0x56')]=intUtil[_0x2059('0x55')](_0x53cc8a['serverUrl']);_0x35e8b1[_0x2059('0x4d')]=_0x2a77c0===_0x2059('0x4e')||_0x2a77c0===_0x2059('0x57')?'queue':_0x2059('0x58');var _0x515af6=_0x53cc8a[_0x2059('0xb')]?util[_0x2059('0x51')](_0x2059('0x59'),_0x53cc8a[_0x2059('0xd')][_0x2059('0xe')]):util[_0x2059('0x51')](_0x2059('0x59'),_0x53cc8a[_0x2059('0xc')]);var _0x28de41=util[_0x2059('0x51')](_0x2059('0x5a'),_0x53cc8a[_0x2059('0x5b')]);var _0xeecb4d=util['format'](_0x2059('0x5c'),_0x53cc8a[_0x2059('0x56')],_0x1137bc['uniqueid'],md5(_0x1137bc[_0x2059('0x5d')]));if(_0x252534&&_0x252534[_0x2059('0x5e')]){logger[_0x2059('0x24')](_0x2059('0x5f'),_0x2059('0x60'));_0x1137bc[_0x2059('0x61')]=_0xeecb4d;}else if(_0x11f71b&&_0x11f71b['recordingFormat']&&_0x11f71b[_0x2059('0x62')]!==_0x2059('0x63')){logger['info'](_0x2059('0x64'),_0x2059('0x60'));_0x1137bc[_0x2059('0x61')]=_0xeecb4d;}else{_0x1137bc[_0x2059('0x61')]='';}return getUser(_0x35e8b1,_0x53cc8a,_0x3f156e,_0x28de41,_0x515af6,_0x2a77c0)[_0x2059('0x15')](function(_0x236e2f){logger[_0x2059('0x24')]('['+_0x2a77c0[_0x2059('0x17')]()+_0x2059('0x65'),_0x236e2f['userId']);logger['info']('['+_0x2a77c0[_0x2059('0x17')]()+_0x2059('0x66'),_0x236e2f[_0x2059('0x1f')]);return getEndUser(_0x236e2f,_0x53cc8a,_0x28de41,_0x515af6,_0x1137bc,_0x2a77c0,_0x9ec1f[_0x2059('0x67')],_0x9ec1f['additionalSearchContact']);})[_0x2059('0x15')](function(_0x4155e0){logger[_0x2059('0x24')]('['+_0x2a77c0[_0x2059('0x17')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x4155e0[_0x2059('0x30')]);logger[_0x2059('0x24')]('['+_0x2a77c0[_0x2059('0x17')]()+_0x2059('0x68'),_0x1137bc['calleridnum']);return getTicket(_0x4155e0,_0x53cc8a,_0x28de41,_0x515af6,_0x1137bc,_0x9ec1f,_0x2a77c0);})[_0x2059('0x15')](function(_0x32e0e8){logger[_0x2059('0x24')](util[_0x2059('0x51')]('['+_0x2a77c0['toUpperCase']()+_0x2059('0x69'),_0x9ec1f['ticketType'],_0x32e0e8[_0x2059('0x50')]));logger[_0x2059('0x24')](util[_0x2059('0x51')]('['+_0x2a77c0[_0x2059('0x17')]()+_0x2059('0x6a'),_0x2a77c0));if(_0x2a77c0!==_0x2059('0x57')&&_0x9ec1f[_0x2059('0x6b')]){logger[_0x2059('0x24')]('['+_0x2a77c0[_0x2059('0x17')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x53cc8a['remoteUri'],_0x3f156e['name'],_0x9ec1f[_0x2059('0x4c')],_0x32e0e8[_0x2059('0x50')]);}})[_0x2059('0x25')](function(_0x17c36e){logger['error']('['+_0x2a77c0[_0x2059('0x17')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x17c36e[_0x2059('0x18')]);console[_0x2059('0x6c')](_0x2059('0x6d'),_0x17c36e);});}; \ No newline at end of file +var _0xac0e=['isNil','validateEmail','email','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','userId','toLowerCase','outbound','calleridnum','POST','contacts','/systemusers(','Bearer\x20','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','telephone1','contacts?$select=','\x20eq\x20\x27','replace','%2b','contactid','nothing','info',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','picklist','type','nameField','customField','indexOf','content','ticketType','incidents','getString','Fields','callDirection','queue','/contacts(','phonecalls','assign','Subjects','Descriptions','ticketId','catch','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','request-promise','util','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','clientId','username','password','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','4.0','value'];(function(_0xca1f0e,_0x2713d5){var _0x35e4ef=function(_0x44c40f){while(--_0x44c40f){_0xca1f0e['push'](_0xca1f0e['shift']());}};_0x35e4ef(++_0x2713d5);}(_0xac0e,0x12b));var _0xeac0=function(_0x281c26,_0x317ce9){_0x281c26=_0x281c26-0x0;var _0x579e87=_0xac0e[_0x281c26];return _0x579e87;};'use strict';var _=require('lodash');var rp=require(_0xeac0('0x0'));var util=require(_0xeac0('0x1'));var intUtil=require(_0xeac0('0x2'));var md5=require('md5');var Redis=require(_0xeac0('0x3'));var logger=require(_0xeac0('0x4'))(_0xeac0('0x5'));var config=require(_0xeac0('0x6'));config['redis']=_[_0xeac0('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xeac0('0x8'))(new Redis(config['redis']));function getAuthToken(_0xa99120,_0x1bd239,_0x3784af){if(_0xa99120[_0xeac0('0x9')]){_0xa99120[_0xeac0('0xa')]=_0xa99120[_0xeac0('0xb')][_0xeac0('0xc')];_0xa99120[_0xeac0('0xd')]=_0xa99120[_0xeac0('0xb')][_0xeac0('0xe')];return Promise[_0xeac0('0xf')](_0xa99120[_0xeac0('0xb')]['data5']);}var _0xcb40e={'method':'POST','uri':_0x1bd239,'form':{'client_id':_0xa99120[_0xeac0('0x10')],'resource':_0xa99120['remoteUri'],'username':_0xa99120[_0xeac0('0x11')],'password':_0xa99120['password'],'grant_type':_0xeac0('0x12'),'client_secret':_0xa99120['clientSecret']},'json':!![]};return rp(_0xcb40e)[_0xeac0('0x13')](function(_0x4b617e){return _0x4b617e[_0xeac0('0x14')];})['catch'](function(_0x5415f8){logger[_0xeac0('0x15')]('['+[_0x3784af[_0xeac0('0x16')]()]+_0xeac0('0x17'));return _0x5415f8[_0xeac0('0x18')];});}function getUser(_0x17096c,_0x445af9,_0x4019b8,_0x5a20a4,_0x5a4c5b,_0x5bde18){return new Promise(function(_0x10cc35,_0x10ff5a){return getAuthToken(_0x445af9,_0x5a20a4,_0x5bde18)[_0xeac0('0x13')](function(_0x5e032d){var _0x38f82a={'method':_0xeac0('0x19'),'uri':_0x5a4c5b+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x5e032d,'OData-Version':_0xeac0('0x1a')},'json':!![]};return rp(_0x38f82a);})[_0xeac0('0x13')](function(_0x1d1baf){var _0x224b21=_0x1d1baf[_0xeac0('0x1b')];var _0x440263=![];var _0x39d00f=null;if(!_[_0xeac0('0x1c')](_0x4019b8)){if(intUtil[_0xeac0('0x1d')](_0x4019b8[_0xeac0('0x1e')])){_0x17096c['userEmail']=_0x4019b8['email'];for(_0x39d00f=0x0;_0x39d00f<_0x224b21[_0xeac0('0x1f')];_0x39d00f++){if(_0x224b21[_0x39d00f][_0xeac0('0x20')]===_0x4019b8[_0xeac0('0x1e')]&&!_0x224b21[_0x39d00f][_0xeac0('0x21')]){_0x440263=!![];logger['info']('['+[_0x5bde18['toUpperCase']()]+_0xeac0('0x22')+_0x224b21[_0x39d00f]['systemuserid']+'!');_0x17096c['userId']=_0x224b21[_0x39d00f][_0xeac0('0x23')];}}}}if(!_0x440263){logger['info']('['+[_0x5bde18[_0xeac0('0x16')]()]+_0xeac0('0x24'));_0x17096c[_0xeac0('0x25')]=_0x445af9[_0xeac0('0x11')];for(_0x39d00f=0x0;_0x39d00f<_0x224b21[_0xeac0('0x1f')];_0x39d00f++){if(_0x224b21[_0x39d00f]['internalemailaddress']===_0x445af9['username']){_0x17096c[_0xeac0('0x26')]=_0x224b21[_0x39d00f][_0xeac0('0x23')];}}}_0x10cc35(_0x17096c);})['catch'](function(_0x457552){_0x10ff5a(_0x457552[_0xeac0('0x18')]);});});}function createEndUser(_0x242951,_0x280ff1,_0x283d76,_0x5d2c36,_0x329927,_0x5f4750,_0xdfb8ed){return new Promise(function(_0x5a0901,_0x338741){return getAuthToken(_0x280ff1,_0x283d76,_0x5f4750)[_0xeac0('0x13')](function(_0x14f7c9){var _0x2076e5=_0x5f4750[_0xeac0('0x27')]()===_0xeac0('0x28')?_0x329927['destcalleridnum']:_0x329927[_0xeac0('0x29')];var _0x11f43b={'method':_0xeac0('0x2a'),'uri':_0x5d2c36+_0xeac0('0x2b'),'body':{'fullname':_0x2076e5,'firstname':_0x2076e5,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xeac0('0x2c')+_0x242951[_0xeac0('0x26')]+')'},'headers':{'Authorization':_0xeac0('0x2d')+_0x14f7c9,'OData-Version':_0xeac0('0x1a')},'json':!![],'resolveWithFullResponse':!![]};_0x11f43b['body'][_0xdfb8ed]=_0x2076e5;return rp(_0x11f43b);})[_0xeac0('0x13')](function(_0x2df40a){var _0x151191=_0x2df40a[_0xeac0('0x2e')][_0xeac0('0x2f')];var _0x515bc7=_0x151191[_0xeac0('0x30')](_0x151191[_0xeac0('0x31')]('(')+0x1,_0x151191[_0xeac0('0x31')](')'));_0x242951[_0xeac0('0x32')]=_0x515bc7;_0x5a0901(_0x242951);})['catch'](function(_0x312db2){_0x338741(_0x312db2['message']);});});}function getEndUser(_0xb82012,_0x260510,_0x1a745d,_0x317415,_0x36407b,_0x1dbdc7,_0x53f9d6,_0x2599bd){var _0x56907a=_0x1dbdc7[_0xeac0('0x27')]()==='outbound'?_0x36407b[_0xeac0('0x33')]:_0x36407b[_0xeac0('0x29')];return getAuthToken(_0x260510,_0x1a745d,_0x1dbdc7)[_0xeac0('0x13')](function(_0x355ced){_0x2599bd=_0x2599bd?_0x2599bd:_0xeac0('0x34');var _0x1e1c2e={'method':'GET','uri':_0x317415+_0xeac0('0x35')+_0x2599bd+'&$filter='+_0x2599bd+_0xeac0('0x36')+_0x56907a[_0xeac0('0x37')]('+',_0xeac0('0x38'))+'\x27','headers':{'Authorization':_0xeac0('0x2d')+_0x355ced,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1e1c2e);})[_0xeac0('0x13')](function(_0x2ca915){var _0x4e6e67=![];if(!_0x2ca915)return _0x4e6e67;var _0x4b8824=_0x2ca915['value'];for(var _0x464d14=0x0;_0x464d14<_0x4b8824['length'];_0x464d14++){if(_0x4b8824[_0x464d14][_0x2599bd]===_0x56907a){_0x4e6e67=!![];_0xb82012[_0xeac0('0x32')]=_0x4b8824[_0x464d14][_0xeac0('0x39')];}}return _0x4e6e67;})['then'](function(_0x2166c3){if(_0x2166c3)return _0xb82012;if(_0x53f9d6===_0xeac0('0x3a')){logger[_0xeac0('0x3b')]('['+[_0x1dbdc7[_0xeac0('0x16')]()]+_0xeac0('0x3c'));return _0xb82012;}return createEndUser(_0xb82012,_0x260510,_0x1a745d,_0x317415,_0x36407b,_0x1dbdc7,_0x2599bd)[_0xeac0('0x13')](function(_0x102a11){logger['info']('['+[_0x1dbdc7[_0xeac0('0x16')]()]+_0xeac0('0x3d'),_0x102a11[_0xeac0('0x32')]);return _0x102a11;});});}function getCustomFields(_0x3a1951,_0x32099a,_0x2e206a){var _0x34c154={};if(_0x3a1951[_0xeac0('0x1f')]>0x0){_[_0xeac0('0x3e')](_0x3a1951,function(_0x47f07f){if(_[_0xeac0('0x3f')](['string',_0xeac0('0x40')],_0x47f07f[_0xeac0('0x41')])&&_0x47f07f[_0xeac0('0x42')]&&!_0x47f07f[_0xeac0('0x43')]){var _0x2f6684=_0x47f07f['idField']['toLowerCase']();var _0x3d16f0=_0x2f6684[_0xeac0('0x30')](0x0,_0x2f6684[_0xeac0('0x44')]('_'));var _0x2da586=_0x2f6684[_0xeac0('0x30')](_0x2f6684[_0xeac0('0x44')]('_')+0x1);if(_0x3d16f0===_0x2e206a){_0x34c154[_0x2da586]=_0x47f07f[_0xeac0('0x45')];}}});}return _0x34c154;}function getTicket(_0x4c0d4c,_0xcda559,_0x29ec83,_0x319ec1,_0x1fbc9a,_0x190e67,_0x582da8){return new Promise(function(_0x54a27b,_0x45d151){var _0x45e247;return getAuthToken(_0xcda559,_0x29ec83,_0x582da8)[_0xeac0('0x13')](function(_0x1a495d){if(_0x190e67[_0xeac0('0x46')]==='incident'){_0x45e247={'method':_0xeac0('0x2a'),'uri':_0x319ec1+_0xeac0('0x47'),'body':Object['assign']({},{'title':intUtil[_0xeac0('0x48')](_0x190e67['Subjects'],_0x1fbc9a,'\x20'),'description':intUtil['getString'](_0x190e67['Descriptions'],_0x1fbc9a,'\x0a'),'customerid_contact@odata.bind':_0x4c0d4c['enduserId']?'/contacts('+_0x4c0d4c['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x4c0d4c[_0xeac0('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x190e67[_0xeac0('0x49')],_0x1fbc9a,_0x190e67[_0xeac0('0x46')])),'headers':{'Authorization':'Bearer\x20'+_0x1a495d,'OData-Version':_0xeac0('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x190e67[_0xeac0('0x46')]==='phonecall'){var _0x717ef1=_0x4c0d4c[_0xeac0('0x32')]?[{'partyid_systemuser@odata.bind':_0xeac0('0x2c')+_0x4c0d4c[_0xeac0('0x26')]+')','participationtypemask':_0x4c0d4c[_0xeac0('0x4a')]===_0xeac0('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':_0xeac0('0x4c')+_0x4c0d4c[_0xeac0('0x32')]+')','participationtypemask':_0x4c0d4c[_0xeac0('0x4a')]===_0xeac0('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xeac0('0x2c')+_0x4c0d4c[_0xeac0('0x26')]+')','participationtypemask':_0x4c0d4c[_0xeac0('0x4a')]===_0xeac0('0x4b')?0x2:0x1}];_0x45e247={'method':_0xeac0('0x2a'),'uri':_0x319ec1+_0xeac0('0x4d'),'body':Object[_0xeac0('0x4e')]({},{'subject':intUtil[_0xeac0('0x48')](_0x190e67[_0xeac0('0x4f')],_0x1fbc9a,'\x20'),'phonenumber':String(_0x1fbc9a[_0xeac0('0x29')]),'description':intUtil['getString'](_0x190e67[_0xeac0('0x50')],_0x1fbc9a,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4c0d4c[_0xeac0('0x32')]?_0xeac0('0x4c')+_0x4c0d4c[_0xeac0('0x32')]+')':undefined,'ownerid@odata.bind':_0xeac0('0x2c')+_0x4c0d4c[_0xeac0('0x26')]+')','directioncode':_0x4c0d4c[_0xeac0('0x4a')]===_0xeac0('0x4b')?![]:!![],'phonecall_activity_parties':_0x717ef1},getCustomFields(_0x190e67[_0xeac0('0x49')],_0x1fbc9a,_0x190e67['ticketType'])),'headers':{'Authorization':_0xeac0('0x2d')+_0x1a495d,'OData-Version':_0xeac0('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x45e247);})['then'](function(_0x4f4601){var _0x3ef0b7=_0x4f4601[_0xeac0('0x2e')][_0xeac0('0x2f')];var _0x4be0cf=_0x3ef0b7['substring'](_0x3ef0b7['lastIndexOf']('(')+0x1,_0x3ef0b7[_0xeac0('0x31')](')'));_0x4c0d4c[_0xeac0('0x51')]=_0x4be0cf;_0x54a27b(_0x4c0d4c);})[_0xeac0('0x52')](function(_0x14c7c7){_0x45d151(_0x14c7c7[_0xeac0('0x18')]);});});}function emit(_0x2e7d8d,_0x2f9056,_0x26b5a1,_0xc1135c){var _0x2fbabc={'uri':util[_0xeac0('0x53')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x2e7d8d,_0x26b5a1,_0xc1135c)};io['to'](util['format'](_0xeac0('0x54'),_0x2f9056))[_0xeac0('0x55')](_0xeac0('0x56'),_0x2fbabc);}exports['cs']=function(_0x837081,_0x276d46,_0x5bdcf1,_0x248c31,_0x4b2809,_0x4aa464,_0x2fa7e5,_0x8bfb82){var _0x163c1a={};_0x4aa464[_0xeac0('0xa')]=_0x4aa464[_0xeac0('0x9')]?intUtil[_0xeac0('0x57')](_0x4aa464['CloudProvider'][_0xeac0('0xc')]):intUtil[_0xeac0('0x57')](_0x4aa464[_0xeac0('0xa')]);_0x4aa464[_0xeac0('0x58')]=intUtil[_0xeac0('0x57')](_0x4aa464[_0xeac0('0x58')]);_0x163c1a[_0xeac0('0x4a')]=_0x8bfb82==='queue'||_0x8bfb82==='unmanaged'?_0xeac0('0x4b'):_0xeac0('0x28');var _0x5135de=_0x4aa464[_0xeac0('0x9')]?util[_0xeac0('0x53')](_0xeac0('0x59'),_0x4aa464['CloudProvider'][_0xeac0('0xc')]):util[_0xeac0('0x53')]('%s/api/data/v9.0/',_0x4aa464[_0xeac0('0xa')]);var _0xddd6ff=util[_0xeac0('0x53')](_0xeac0('0x5a'),_0x4aa464['tenantId']);var _0x1ced8f=util[_0xeac0('0x53')](_0xeac0('0x5b'),_0x4aa464['serverUrl'],_0x276d46['uniqueid'],md5(_0x276d46[_0xeac0('0x5c')]));if(_0x4b2809&&_0x4b2809['monitor_format']){logger[_0xeac0('0x3b')](_0xeac0('0x5d'),'Recording\x20is\x20enabled!');_0x276d46[_0xeac0('0x5e')]=_0x1ced8f;}else if(_0x2fa7e5&&_0x2fa7e5[_0xeac0('0x5f')]&&_0x2fa7e5[_0xeac0('0x5f')]!==_0xeac0('0x60')){logger[_0xeac0('0x3b')](_0xeac0('0x61'),_0xeac0('0x62'));_0x276d46[_0xeac0('0x5e')]=_0x1ced8f;}else{_0x276d46[_0xeac0('0x5e')]='';}return getUser(_0x163c1a,_0x4aa464,_0x248c31,_0xddd6ff,_0x5135de,_0x8bfb82)['then'](function(_0x38fef1){logger[_0xeac0('0x3b')]('['+_0x8bfb82[_0xeac0('0x16')]()+_0xeac0('0x63'),_0x38fef1[_0xeac0('0x26')]);logger[_0xeac0('0x3b')]('['+_0x8bfb82[_0xeac0('0x16')]()+_0xeac0('0x64'),_0x38fef1[_0xeac0('0x25')]);return getEndUser(_0x38fef1,_0x4aa464,_0xddd6ff,_0x5135de,_0x276d46,_0x8bfb82,_0x5bdcf1[_0xeac0('0x65')],_0x5bdcf1[_0xeac0('0x66')]);})[_0xeac0('0x13')](function(_0x10baee){logger[_0xeac0('0x3b')]('['+_0x8bfb82['toUpperCase']()+_0xeac0('0x67'),_0x10baee[_0xeac0('0x32')]);logger[_0xeac0('0x3b')]('['+_0x8bfb82[_0xeac0('0x16')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x276d46['calleridnum']);return getTicket(_0x10baee,_0x4aa464,_0xddd6ff,_0x5135de,_0x276d46,_0x5bdcf1,_0x8bfb82);})['then'](function(_0x20a476){logger[_0xeac0('0x3b')](util[_0xeac0('0x53')]('['+_0x8bfb82[_0xeac0('0x16')]()+_0xeac0('0x68'),_0x5bdcf1['ticketType'],_0x20a476[_0xeac0('0x51')]));logger[_0xeac0('0x3b')](util['format']('['+_0x8bfb82[_0xeac0('0x16')]()+_0xeac0('0x69'),_0x8bfb82));if(_0x8bfb82!==_0xeac0('0x6a')&&_0x5bdcf1[_0xeac0('0x6b')]){logger['info']('['+_0x8bfb82[_0xeac0('0x16')]()+']',_0xeac0('0x6c'));emit(_0x4aa464[_0xeac0('0xa')],_0x248c31['name'],_0x5bdcf1[_0xeac0('0x46')],_0x20a476['ticketId']);}})[_0xeac0('0x52')](function(_0xd44c83){logger[_0xeac0('0x15')]('['+_0x8bfb82[_0xeac0('0x16')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0xd44c83[_0xeac0('0x18')]);console[_0xeac0('0x15')]('Error\x20running\x20Dynamics365\x20integration',_0xd44c83);});}; \ 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 0c5021a..25e85d0 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 _0x70b8=['content','variable','variableName','idField','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','Authorization','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','[OUTBOUND]','user:%s','trigger:browser:url','error','unmanaged','lastevent','toUpperCase','lodash','md5','util','./util','../../../../config/logger','redis','defaults','localhost','application/json','emit','info','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','Fields','custom_fields','mapValues','keyBy','value','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','length','Agent\x20found!','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','base64','debug','[HTTP]','stringify','forEach','includes','string','picklist','nameField','customField','toLowerCase','toString','type','push'];(function(_0x2dc520,_0x562e06){var _0x4e3c28=function(_0x1610d7){while(--_0x1610d7){_0x2dc520['push'](_0x2dc520['shift']());}};_0x4e3c28(++_0x562e06);}(_0x70b8,0x7b));var _0x870b=function(_0x522510,_0x3254bf){_0x522510=_0x522510-0x0;var _0x1165fd=_0x70b8[_0x522510];return _0x1165fd;};'use strict';var _=require(_0x870b('0x0'));var rp=require('request-promise');var md5=require(_0x870b('0x1'));var util=require(_0x870b('0x2'));var Redis=require('ioredis');var intUtil=require(_0x870b('0x3'));var config=require('../../../../config/environment');var logger=require(_0x870b('0x4'))('freshdesk');config[_0x870b('0x5')]=_[_0x870b('0x6')](config['redis'],{'host':_0x870b('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x870b('0x8'),'Accept':_0x870b('0x8')};function emit(_0x22c833,_0xc188ea,_0x585896){io['to'](_0x22c833)[_0x870b('0x9')](_0xc188ea,_0x585896);}function getTicket(_0x51710f,_0x25f201,_0xa8ab87,_0xcf4718,_0x9ec30){logger[_0x870b('0xa')]('Creating\x20new\x20ticket...');var _0x2cf8af=_[_0x870b('0xb')]({'responder_id':_0x25f201['id'],'requester_id':_0xa8ab87['id'],'name':util[_0x870b('0xc')]('Caller\x20-\x20%s',_0x9ec30[_0x870b('0xd')]),'phone':_0x9ec30[_0x870b('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x870b('0xf')](_0xcf4718[_0x870b('0x10')],_0x9ec30,'\x20'),'description':intUtil[_0x870b('0xf')](_0xcf4718[_0x870b('0x11')],_0x9ec30,'
'),'tags':getTags(_0xcf4718[_0x870b('0x12')],'name')},getCustomFields(_0xcf4718[_0x870b('0x13')],_0x9ec30));_0x2cf8af[_0x870b('0x14')]=_[_0x870b('0x15')](_[_0x870b('0x16')](_0x2cf8af[_0x870b('0x14')],'id'),_0x870b('0x17'));return request({'uri':util[_0x870b('0xc')]('%s/api/v2/tickets',_0x51710f['remoteUri']),'method':'POST','body':_0x2cf8af})[_0x870b('0x18')](function(_0x1680f0){logger[_0x870b('0xa')](_0x870b('0x19'));return _0x1680f0;});}function getUser(_0x321656,_0x427548){if(intUtil[_0x870b('0x1a')](_0x427548)){return request({'uri':util[_0x870b('0xc')](_0x870b('0x1b'),_0x321656[_0x870b('0x1c')]),'qs':{'email':_0x427548}})['then'](function(_0x4e2069){if(_0x4e2069[_0x870b('0x1d')]){logger[_0x870b('0xa')](_0x870b('0x1e'));return _[_0x870b('0x1f')](_0x4e2069,function(_0x29de2a){return _0x29de2a['contact']['email']===_0x427548;});}else{logger['info'](_0x870b('0x20'));return request({'uri':util['format'](_0x870b('0x21'),_0x321656['remoteUri'])})['then'](function(_0x3c67bd){logger[_0x870b('0xa')](_0x870b('0x22'));return _0x3c67bd;});}});}else{logger[_0x870b('0xa')](_0x870b('0x23'));return request({'uri':util[_0x870b('0xc')](_0x870b('0x21'),_0x321656[_0x870b('0x1c')])})['then'](function(_0x5e5766){logger['info'](_0x870b('0x22'));return _0x5e5766;});}}function getEndUser(_0x24335c,_0x15a031,_0x1d79ff){logger[_0x870b('0xa')](_0x870b('0x24'),_0x1d79ff);return request({'uri':util['format']('%s/api/v2/contacts',_0x24335c[_0x870b('0x1c')]),'qs':{'phone':_0x1d79ff}})['then'](function(_0x400fbf){if(_0x400fbf[_0x870b('0x1d')]){logger['info']('Enduser\x20found!');return _[_0x870b('0x1f')](_0x400fbf,{'phone':_0x1d79ff});}else{logger['info'](_0x870b('0x25'));return request({'uri':util[_0x870b('0xc')]('%s/api/v2/contacts',_0x24335c[_0x870b('0x1c')]),'method':_0x870b('0x26'),'body':{'name':_0x15a031,'phone':_0x1d79ff}})[_0x870b('0x18')](function(_0x3818f9){logger['info']('Enduser\x20created.');return _0x3818f9;});}});}function getAuth(_0x5649bb){return util[_0x870b('0xc')]('Basic\x20%s',new Buffer(_0x5649bb['apiKey']+':X')['toString'](_0x870b('0x27')));}function request(_0x597e74){logger[_0x870b('0x28')](_0x870b('0x29'),JSON[_0x870b('0x2a')](_0x597e74));return rp(_[_0x870b('0x6')](_0x597e74,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x29c62f,_0xb21f79){var _0x493a53=[];if(_0x29c62f&&_0x29c62f[_0x870b('0x1d')]>0x0){_0x493a53=_['map'](_0x29c62f,_0xb21f79);}return _0x493a53;}function getCustomFields(_0x558d2d,_0x51b1e2){var _0x5eae87=[];var _0x168175={'custom_fields':[]};if(_0x558d2d[_0x870b('0x1d')]>0x0){_[_0x870b('0x2b')](_0x558d2d,function(_0x237228){if(_[_0x870b('0x2c')]([_0x870b('0x2d'),_0x870b('0x2e')],_0x237228['type'])&&_0x237228[_0x870b('0x2f')]&&!_0x237228[_0x870b('0x30')]){_0x168175[_0x237228[_0x870b('0x2f')][_0x870b('0x31')]()]=_0x237228['content'][_0x870b('0x32')]();}else if(_[_0x870b('0x2c')]([_0x870b('0x2d'),'picklist'],_0x237228[_0x870b('0x33')])&&_0x237228['idField']&&_0x237228[_0x870b('0x30')]){_0x168175['custom_fields'][_0x870b('0x34')]({'id':_0x237228['idField'],'value':_0x237228[_0x870b('0x35')][_0x870b('0x32')]()});}else if(_0x237228[_0x870b('0x33')]===_0x870b('0x36')&&_0x237228[_0x870b('0x37')]&&_0x237228[_0x870b('0x38')]&&_0x237228[_0x870b('0x30')]){_0x51b1e2[_0x237228[_0x870b('0x37')]]&&_0x168175['custom_fields']['push']({'id':_0x237228[_0x870b('0x38')],'value':_0x51b1e2[_0x237228[_0x870b('0x37')]][_0x870b('0x32')]()});}else if(_0x237228[_0x870b('0x33')]===_0x870b('0x39')&&_0x237228[_0x870b('0x3a')]&&_0x237228[_0x870b('0x3a')][_0x870b('0x3b')]&&_0x237228[_0x870b('0x38')]&&_0x237228[_0x870b('0x30')]){_0x51b1e2[_0x237228['Variable'][_0x870b('0x3b')][_0x870b('0x31')]()]&&_0x168175[_0x870b('0x14')][_0x870b('0x34')]({'id':_0x237228['idField'],'value':_0x51b1e2[_0x237228['Variable']['name']['toLowerCase']()][_0x870b('0x32')]()});}});}return _0x168175;}exports[_0x870b('0x3c')]=function(_0x4cd571,_0xdb3cf2,_0x19028f,_0x3e93ea,_0x155210,_0x114b9b){var _0x2e0ed3,_0x360030;_0x114b9b[_0x870b('0x1c')]=intUtil[_0x870b('0x3d')](_0x114b9b['remoteUri']);_0x114b9b[_0x870b('0x3e')]=intUtil[_0x870b('0x3d')](_0x114b9b[_0x870b('0x3e')]);if(_0x155210&&_0x155210[_0x870b('0x3f')]){logger['info'](_0x870b('0x40'),_0x870b('0x41'));_0xdb3cf2['recordingURL']=util[_0x870b('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x114b9b['serverUrl'],_0xdb3cf2[_0x870b('0x42')],md5(_0xdb3cf2['uniqueid']));}else{_0xdb3cf2[_0x870b('0x43')]='';}headers[_0x870b('0x44')]=getAuth(_0x114b9b);return getUser(_0x114b9b,_0x3e93ea['email'])[_0x870b('0x18')](function(_0x190b23){_0x2e0ed3=_0x190b23;logger[_0x870b('0xa')]('The\x20User\x20ID\x20is:',_0x2e0ed3['id']);return getEndUser(_0x114b9b,_0xdb3cf2[_0x870b('0xd')],_0xdb3cf2['calleridnum']);})[_0x870b('0x18')](function(_0x2dcea3){_0x360030=_0x2dcea3;logger['info'](_0x870b('0x45'),_0x360030['id']);return getTicket(_0x114b9b,_0x2e0ed3,_0x360030,_0x19028f,_0xdb3cf2);})[_0x870b('0x18')](function(_0x5b7879){if(_0x5b7879&&_0x5b7879['id']){logger[_0x870b('0xa')](_0x870b('0x19'));logger[_0x870b('0xa')](_0x870b('0x46'),_0x5b7879['id']);logger[_0x870b('0xa')](_0x870b('0x40'),_0x870b('0x47'));emit(util[_0x870b('0xc')]('user:%s',_0x3e93ea[_0x870b('0x3b')]),'trigger:browser:url',{'uri':util[_0x870b('0xc')](_0x870b('0x48'),_0x114b9b[_0x870b('0x1c')],_0x5b7879['id'])});}})[_0x870b('0x49')](function(_0x1bf3dc){logger['error'](_0x870b('0x40'),JSON[_0x870b('0x2a')](_0x1bf3dc));});};exports[_0x870b('0x4a')]=function(_0x22c9fa,_0x5dfd70,_0x3f3622,_0x42471b,_0x184690,_0x23daf6,_0x287e14){var _0x16c3b9,_0x17d04a;_0x23daf6[_0x870b('0x1c')]=intUtil[_0x870b('0x3d')](_0x23daf6['remoteUri']);_0x23daf6['serverUrl']=intUtil[_0x870b('0x3d')](_0x23daf6[_0x870b('0x3e')]);if(_0x287e14&&_0x287e14[_0x870b('0x4b')]&&_0x287e14[_0x870b('0x4b')]!==_0x870b('0x4c')){logger[_0x870b('0xa')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5dfd70[_0x870b('0x43')]=util['format'](_0x870b('0x4d'),_0x23daf6[_0x870b('0x3e')],_0x5dfd70[_0x870b('0x42')],md5(_0x5dfd70[_0x870b('0x42')]));}headers[_0x870b('0x44')]=getAuth(_0x23daf6);return getUser(_0x23daf6,_0x42471b['email'])[_0x870b('0x18')](function(_0x2d282e){_0x16c3b9=_0x2d282e;logger[_0x870b('0xa')](_0x870b('0x4e'),_0x16c3b9['id']);return getEndUser(_0x23daf6,_0x5dfd70[_0x870b('0x4f')],_0x5dfd70[_0x870b('0x50')]);})[_0x870b('0x18')](function(_0x195cd5){_0x17d04a=_0x195cd5;logger[_0x870b('0xa')](_0x870b('0x45'),_0x17d04a['id']);return getTicket(_0x23daf6,_0x16c3b9,_0x17d04a,_0x3f3622,_0x5dfd70);})[_0x870b('0x18')](function(_0x50ef38){if(_0x50ef38&&_0x50ef38['id']){logger[_0x870b('0xa')](_0x870b('0x19'));logger[_0x870b('0xa')](_0x870b('0x46'),_0x50ef38['id']);logger['info'](_0x870b('0x51'),_0x870b('0x47'));emit(util[_0x870b('0xc')](_0x870b('0x52'),_0x42471b['name']),_0x870b('0x53'),{'uri':util['format'](_0x870b('0x48'),_0x23daf6[_0x870b('0x1c')],_0x50ef38['id'])});}})[_0x870b('0x49')](function(_0x20ccb4){logger[_0x870b('0x54')](_0x870b('0x51'),JSON['stringify'](_0x20ccb4));});};exports[_0x870b('0x55')]=function(_0x2eae8a,_0x55d910,_0x44f996,_0x48015f,_0xe86747,_0x2a3c99){var _0x1697a3,_0x1a9324;_0x2a3c99[_0x870b('0x1c')]=intUtil[_0x870b('0x3d')](_0x2a3c99[_0x870b('0x1c')]);_0x2a3c99[_0x870b('0x3e')]=intUtil[_0x870b('0x3d')](_0x2a3c99[_0x870b('0x3e')]);if(_0xe86747&&_0xe86747['monitor_format']){logger[_0x870b('0xa')]('['+_0x55d910[_0x870b('0x56')][_0x870b('0x57')]()+']',_0x870b('0x41'));_0x55d910[_0x870b('0x43')]=util[_0x870b('0xc')](_0x870b('0x4d'),_0x2a3c99[_0x870b('0x3e')],_0x55d910[_0x870b('0x42')],md5(_0x55d910[_0x870b('0x42')]));}else{_0x55d910[_0x870b('0x43')]='';}headers[_0x870b('0x44')]=getAuth(_0x2a3c99);return getUser(_0x2a3c99,'')['then'](function(_0x2d5b49){_0x1697a3=_0x2d5b49;logger['info'](_0x870b('0x4e'),_0x1697a3['id']);return getEndUser(_0x2a3c99,_0x55d910[_0x870b('0xd')],_0x55d910[_0x870b('0xe')]);})[_0x870b('0x18')](function(_0x4ba022){_0x1a9324=_0x4ba022;logger[_0x870b('0xa')](_0x870b('0x45'),_0x1a9324['id']);return getTicket(_0x2a3c99,_0x1697a3,_0x1a9324,_0x44f996,_0x55d910);})[_0x870b('0x18')](function(_0x29391f){if(_0x29391f){logger[_0x870b('0xa')](_0x870b('0x19'));logger[_0x870b('0xa')](_0x870b('0x46'),_0x29391f['id']);}})[_0x870b('0x49')](function(_0x3148a6){logger[_0x870b('0x54')]('['+_0x55d910[_0x870b('0x56')][_0x870b('0x57')]()+']',JSON[_0x870b('0x2a')](_0x3148a6));});}; \ No newline at end of file +var _0x9cc6=['util','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','Descriptions','
','name','custom_fields','%s/api/v2/tickets','remoteUri','POST','then','info','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','forEach','includes','string','picklist','type','nameField','toLowerCase','idField','customField','push','content','variable','variableName','Variable','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','uniqueid','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','monitor_format','toUpperCase','request-promise','md5'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9cc6,0x1b6));var _0x69cc=function(_0x5a7112,_0x1f9492){_0x5a7112=_0x5a7112-0x0;var _0x3147f7=_0x9cc6[_0x5a7112];return _0x3147f7;};'use strict';var _=require('lodash');var rp=require(_0x69cc('0x0'));var md5=require(_0x69cc('0x1'));var util=require(_0x69cc('0x2'));var Redis=require(_0x69cc('0x3'));var intUtil=require(_0x69cc('0x4'));var config=require('../../../../config/environment');var logger=require(_0x69cc('0x5'))(_0x69cc('0x6'));config[_0x69cc('0x7')]=_[_0x69cc('0x8')](config['redis'],{'host':_0x69cc('0x9'),'port':0x18eb});var io=require(_0x69cc('0xa'))(new Redis(config[_0x69cc('0x7')]));var headers={'Content-Type':_0x69cc('0xb'),'Accept':_0x69cc('0xb')};function emit(_0x3ec856,_0x20f8df,_0xd6d6d2){io['to'](_0x3ec856)['emit'](_0x20f8df,_0xd6d6d2);}function getTicket(_0x11f81e,_0x1df57d,_0x3f58a1,_0x4ea142,_0x4b4d25){logger['info'](_0x69cc('0xc'));var _0x43e653=_[_0x69cc('0xd')]({'responder_id':_0x1df57d['id'],'requester_id':_0x3f58a1['id'],'name':util[_0x69cc('0xe')](_0x69cc('0xf'),_0x4b4d25[_0x69cc('0x10')]),'phone':_0x4b4d25[_0x69cc('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x4ea142[_0x69cc('0x12')],_0x4b4d25,'\x20'),'description':intUtil['getString'](_0x4ea142[_0x69cc('0x13')],_0x4b4d25,_0x69cc('0x14')),'tags':getTags(_0x4ea142['Tags'],_0x69cc('0x15'))},getCustomFields(_0x4ea142['Fields'],_0x4b4d25));_0x43e653[_0x69cc('0x16')]=_['mapValues'](_['keyBy'](_0x43e653[_0x69cc('0x16')],'id'),'value');return request({'uri':util[_0x69cc('0xe')](_0x69cc('0x17'),_0x11f81e[_0x69cc('0x18')]),'method':_0x69cc('0x19'),'body':_0x43e653})[_0x69cc('0x1a')](function(_0x19523a){logger[_0x69cc('0x1b')](_0x69cc('0x1c'));return _0x19523a;});}function getUser(_0x168d03,_0x2d00fe){if(intUtil['validateEmail'](_0x2d00fe)){return request({'uri':util['format'](_0x69cc('0x1d'),_0x168d03[_0x69cc('0x18')]),'qs':{'email':_0x2d00fe}})[_0x69cc('0x1a')](function(_0x14c1c3){if(_0x14c1c3[_0x69cc('0x1e')]){logger['info'](_0x69cc('0x1f'));return _['find'](_0x14c1c3,function(_0x46e27f){return _0x46e27f['contact']['email']===_0x2d00fe;});}else{logger[_0x69cc('0x1b')](_0x69cc('0x20'));return request({'uri':util[_0x69cc('0xe')]('%s/api/v2/agents/me',_0x168d03[_0x69cc('0x18')])})['then'](function(_0x3bea23){logger['info'](_0x69cc('0x21'));return _0x3bea23;});}});}else{logger['info'](_0x69cc('0x22'));return request({'uri':util[_0x69cc('0xe')]('%s/api/v2/agents/me',_0x168d03[_0x69cc('0x18')])})['then'](function(_0x326627){logger[_0x69cc('0x1b')](_0x69cc('0x21'));return _0x326627;});}}function getEndUser(_0x1c5e85,_0x1243fc,_0x3803b4){logger[_0x69cc('0x1b')](_0x69cc('0x23'),_0x3803b4);return request({'uri':util[_0x69cc('0xe')]('%s/api/v2/contacts',_0x1c5e85['remoteUri']),'qs':{'phone':_0x3803b4}})['then'](function(_0x5697d8){if(_0x5697d8[_0x69cc('0x1e')]){logger[_0x69cc('0x1b')](_0x69cc('0x24'));return _[_0x69cc('0x25')](_0x5697d8,{'phone':_0x3803b4});}else{logger[_0x69cc('0x1b')](_0x69cc('0x26'));return request({'uri':util[_0x69cc('0xe')](_0x69cc('0x27'),_0x1c5e85['remoteUri']),'method':_0x69cc('0x19'),'body':{'name':_0x1243fc,'phone':_0x3803b4}})[_0x69cc('0x1a')](function(_0x2831d6){logger[_0x69cc('0x1b')](_0x69cc('0x28'));return _0x2831d6;});}});}function getAuth(_0x5e9ae6){return util[_0x69cc('0xe')](_0x69cc('0x29'),new Buffer(_0x5e9ae6[_0x69cc('0x2a')]+':X')[_0x69cc('0x2b')](_0x69cc('0x2c')));}function request(_0x385e79){logger[_0x69cc('0x2d')](_0x69cc('0x2e'),JSON[_0x69cc('0x2f')](_0x385e79));return rp(_['defaults'](_0x385e79,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x22707c,_0x34a566){var _0x342fd3=[];if(_0x22707c&&_0x22707c[_0x69cc('0x1e')]>0x0){_0x342fd3=_['map'](_0x22707c,_0x34a566);}return _0x342fd3;}function getCustomFields(_0x4bd45e,_0x2b56ee){var _0x6b46fa=[];var _0x1db601={'custom_fields':[]};if(_0x4bd45e[_0x69cc('0x1e')]>0x0){_[_0x69cc('0x30')](_0x4bd45e,function(_0x5b6ef0){if(_[_0x69cc('0x31')]([_0x69cc('0x32'),_0x69cc('0x33')],_0x5b6ef0[_0x69cc('0x34')])&&_0x5b6ef0[_0x69cc('0x35')]&&!_0x5b6ef0['customField']){_0x1db601[_0x5b6ef0['nameField'][_0x69cc('0x36')]()]=_0x5b6ef0['content'][_0x69cc('0x2b')]();}else if(_[_0x69cc('0x31')]([_0x69cc('0x32'),_0x69cc('0x33')],_0x5b6ef0[_0x69cc('0x34')])&&_0x5b6ef0[_0x69cc('0x37')]&&_0x5b6ef0[_0x69cc('0x38')]){_0x1db601[_0x69cc('0x16')][_0x69cc('0x39')]({'id':_0x5b6ef0[_0x69cc('0x37')],'value':_0x5b6ef0[_0x69cc('0x3a')][_0x69cc('0x2b')]()});}else if(_0x5b6ef0[_0x69cc('0x34')]===_0x69cc('0x3b')&&_0x5b6ef0[_0x69cc('0x3c')]&&_0x5b6ef0[_0x69cc('0x37')]&&_0x5b6ef0[_0x69cc('0x38')]){_0x2b56ee[_0x5b6ef0[_0x69cc('0x3c')]]&&_0x1db601[_0x69cc('0x16')][_0x69cc('0x39')]({'id':_0x5b6ef0[_0x69cc('0x37')],'value':_0x2b56ee[_0x5b6ef0[_0x69cc('0x3c')]][_0x69cc('0x2b')]()});}else if(_0x5b6ef0['type']==='customVariable'&&_0x5b6ef0[_0x69cc('0x3d')]&&_0x5b6ef0['Variable'][_0x69cc('0x15')]&&_0x5b6ef0[_0x69cc('0x37')]&&_0x5b6ef0[_0x69cc('0x38')]){_0x2b56ee[_0x5b6ef0['Variable'][_0x69cc('0x15')]['toLowerCase']()]&&_0x1db601['custom_fields']['push']({'id':_0x5b6ef0['idField'],'value':_0x2b56ee[_0x5b6ef0['Variable']['name'][_0x69cc('0x36')]()][_0x69cc('0x2b')]()});}});}return _0x1db601;}exports['queue']=function(_0x17db9a,_0x48d843,_0x556b1f,_0x3f36ac,_0x243ee6,_0x434e34){var _0x4fadd2,_0x19d4f0;_0x434e34['remoteUri']=intUtil[_0x69cc('0x3e')](_0x434e34['remoteUri']);_0x434e34['serverUrl']=intUtil[_0x69cc('0x3e')](_0x434e34[_0x69cc('0x3f')]);if(_0x243ee6&&_0x243ee6['monitor_format']){logger[_0x69cc('0x1b')](_0x69cc('0x40'),_0x69cc('0x41'));_0x48d843[_0x69cc('0x42')]=util[_0x69cc('0xe')](_0x69cc('0x43'),_0x434e34['serverUrl'],_0x48d843['uniqueid'],md5(_0x48d843['uniqueid']));}else{_0x48d843[_0x69cc('0x42')]='';}headers[_0x69cc('0x44')]=getAuth(_0x434e34);return getUser(_0x434e34,_0x3f36ac[_0x69cc('0x45')])[_0x69cc('0x1a')](function(_0x2f71ee){_0x4fadd2=_0x2f71ee;logger[_0x69cc('0x1b')](_0x69cc('0x46'),_0x4fadd2['id']);return getEndUser(_0x434e34,_0x48d843['calleridname'],_0x48d843['calleridnum']);})['then'](function(_0x21039c){_0x19d4f0=_0x21039c;logger['info']('The\x20Enduser\x20ID\x20is:',_0x19d4f0['id']);return getTicket(_0x434e34,_0x4fadd2,_0x19d4f0,_0x556b1f,_0x48d843);})[_0x69cc('0x1a')](function(_0x58e473){if(_0x58e473&&_0x58e473['id']){logger['info'](_0x69cc('0x1c'));logger[_0x69cc('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x58e473['id']);logger[_0x69cc('0x1b')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x69cc('0xe')](_0x69cc('0x47'),_0x3f36ac[_0x69cc('0x15')]),_0x69cc('0x48'),{'uri':util[_0x69cc('0xe')](_0x69cc('0x49'),_0x434e34[_0x69cc('0x18')],_0x58e473['id'])});}})[_0x69cc('0x4a')](function(_0x17cd9c){logger[_0x69cc('0x4b')]('[QUEUE]',JSON[_0x69cc('0x2f')](_0x17cd9c));});};exports[_0x69cc('0x4c')]=function(_0x238cc8,_0x2394d0,_0x1e687b,_0x153fa1,_0x503e7a,_0x5b8fb3,_0xf98e53){var _0x11eeff,_0x590bef;_0x5b8fb3[_0x69cc('0x18')]=intUtil[_0x69cc('0x3e')](_0x5b8fb3[_0x69cc('0x18')]);_0x5b8fb3[_0x69cc('0x3f')]=intUtil[_0x69cc('0x3e')](_0x5b8fb3[_0x69cc('0x3f')]);if(_0xf98e53&&_0xf98e53[_0x69cc('0x4d')]&&_0xf98e53[_0x69cc('0x4d')]!==_0x69cc('0x4e')){logger[_0x69cc('0x1b')]('[OUTBOUND]',_0x69cc('0x41'));_0x2394d0[_0x69cc('0x42')]=util[_0x69cc('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5b8fb3[_0x69cc('0x3f')],_0x2394d0[_0x69cc('0x4f')],md5(_0x2394d0[_0x69cc('0x4f')]));}headers[_0x69cc('0x44')]=getAuth(_0x5b8fb3);return getUser(_0x5b8fb3,_0x153fa1[_0x69cc('0x45')])[_0x69cc('0x1a')](function(_0x4ccb4d){_0x11eeff=_0x4ccb4d;logger[_0x69cc('0x1b')](_0x69cc('0x46'),_0x11eeff['id']);return getEndUser(_0x5b8fb3,_0x2394d0['destcalleridname'],_0x2394d0[_0x69cc('0x50')]);})[_0x69cc('0x1a')](function(_0x6d7c90){_0x590bef=_0x6d7c90;logger[_0x69cc('0x1b')](_0x69cc('0x51'),_0x590bef['id']);return getTicket(_0x5b8fb3,_0x11eeff,_0x590bef,_0x1e687b,_0x2394d0);})['then'](function(_0x2264c8){if(_0x2264c8&&_0x2264c8['id']){logger[_0x69cc('0x1b')](_0x69cc('0x1c'));logger['info'](_0x69cc('0x52'),_0x2264c8['id']);logger[_0x69cc('0x1b')](_0x69cc('0x53'),_0x69cc('0x54'));emit(util['format'](_0x69cc('0x47'),_0x153fa1[_0x69cc('0x15')]),_0x69cc('0x48'),{'uri':util[_0x69cc('0xe')](_0x69cc('0x49'),_0x5b8fb3[_0x69cc('0x18')],_0x2264c8['id'])});}})[_0x69cc('0x4a')](function(_0x45ae92){logger[_0x69cc('0x4b')]('[OUTBOUND]',JSON['stringify'](_0x45ae92));});};exports[_0x69cc('0x55')]=function(_0xc5f497,_0x3c2033,_0x5b365b,_0x4eebae,_0x20d7d0,_0x1521df){var _0x5aaf34,_0x10b78e;_0x1521df[_0x69cc('0x18')]=intUtil[_0x69cc('0x3e')](_0x1521df[_0x69cc('0x18')]);_0x1521df[_0x69cc('0x3f')]=intUtil[_0x69cc('0x3e')](_0x1521df[_0x69cc('0x3f')]);if(_0x20d7d0&&_0x20d7d0[_0x69cc('0x56')]){logger['info']('['+_0x3c2033['lastevent'][_0x69cc('0x57')]()+']',_0x69cc('0x41'));_0x3c2033[_0x69cc('0x42')]=util[_0x69cc('0xe')](_0x69cc('0x43'),_0x1521df['serverUrl'],_0x3c2033[_0x69cc('0x4f')],md5(_0x3c2033[_0x69cc('0x4f')]));}else{_0x3c2033[_0x69cc('0x42')]='';}headers[_0x69cc('0x44')]=getAuth(_0x1521df);return getUser(_0x1521df,'')[_0x69cc('0x1a')](function(_0x46823a){_0x5aaf34=_0x46823a;logger[_0x69cc('0x1b')](_0x69cc('0x46'),_0x5aaf34['id']);return getEndUser(_0x1521df,_0x3c2033[_0x69cc('0x10')],_0x3c2033['calleridnum']);})['then'](function(_0x17d298){_0x10b78e=_0x17d298;logger['info']('The\x20Enduser\x20ID\x20is:',_0x10b78e['id']);return getTicket(_0x1521df,_0x5aaf34,_0x10b78e,_0x5b365b,_0x3c2033);})[_0x69cc('0x1a')](function(_0x364037){if(_0x364037){logger[_0x69cc('0x1b')](_0x69cc('0x1c'));logger[_0x69cc('0x1b')](_0x69cc('0x52'),_0x364037['id']);}})['catch'](function(_0x5f39b0){logger[_0x69cc('0x4b')]('['+_0x3c2033['lastevent'][_0x69cc('0x57')]()+']',JSON[_0x69cc('0x2f')](_0x5f39b0));});}; \ 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 4b94146..03d6a5b 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 _0xc659=['serverUrl','adminEmail','username','outbound','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','socket.io-emitter','redis','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','email','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','&f=','&entities=contact','then','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','format','contact','message','Creating\x20new\x20task','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','ticketId','task','/contacts/','user:%s','Token\x20token=','remoteUri','stripTrailingSlash'];(function(_0x2ea44d,_0x3b8d16){var _0x2dc46b=function(_0x54f4f5){while(--_0x54f4f5){_0x2ea44d['push'](_0x2ea44d['shift']());}};_0x2dc46b(++_0x3b8d16);}(_0xc659,0x100));var _0x9c65=function(_0x1e7c90,_0x16ee4a){_0x1e7c90=_0x1e7c90-0x0;var _0x48abcf=_0xc659[_0x1e7c90];return _0x48abcf;};'use strict';var _=require(_0x9c65('0x0'));var rp=require(_0x9c65('0x1'));var md5=require(_0x9c65('0x2'));var util=require(_0x9c65('0x3'));var moment=require(_0x9c65('0x4'));var Promise=require(_0x9c65('0x5'));var Redis=require(_0x9c65('0x6'));var intUtil=require(_0x9c65('0x7'));var config=require(_0x9c65('0x8'));var logger=require(_0x9c65('0x9'))('freshsales');config['redis']=_[_0x9c65('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9c65('0xb'))(new Redis(config[_0x9c65('0xc')]));function getAdminId(_0x31e235,_0x130fdc,_0x1f7712,_0xcb12f5){return new Promise(function(_0x88186e,_0x5e0b90){var _0x1e0ebf=![];var _0x53415a={'method':_0x9c65('0xd'),'uri':_0xcb12f5+_0x9c65('0xe'),'json':!![]};_0x53415a[_0x9c65('0xf')]=_0x1f7712;logger[_0x9c65('0x10')](_0x9c65('0x11'));return rp(_0x53415a)['then'](function(_0x34090f){if(_0x34090f){var _0x34be5e=_0x34090f[_0x9c65('0x12')];var _0x36339d=null;for(_0x36339d=0x0;_0x36339d<_0x34be5e[_0x9c65('0x13')];_0x36339d++){if(_0x34be5e[_0x36339d][_0x9c65('0x14')]===_0x31e235['adminEmail']){_0x31e235['adminId']=_0x34be5e[_0x36339d]['id'];_0x1e0ebf=!![];}}if(_0x1e0ebf){logger['info']('Admin\x20found:',_0x31e235[_0x9c65('0x15')]);_0x88186e(_0x31e235);}else{_0x5e0b90({'statusCode':0x194,'message':_0x9c65('0x16')});}}else{_0x5e0b90({'statusCode':0x194,'message':_0x9c65('0x16')});}})[_0x9c65('0x17')](function(_0x166be5){logger[_0x9c65('0x18')]('['+[_0x130fdc[_0x9c65('0x19')]()]+']',_0x166be5['message']);_0x5e0b90(_0x166be5);});});}function getUser(_0x547684,_0x4ff7c3,_0x55430d){return function(_0x2883a8){return new Promise(function(_0x3ea31f,_0x3874aa){var _0x38fb27={'method':_0x9c65('0xd'),'uri':_0x55430d+'/api/selector/owners','json':!![]};_0x38fb27[_0x9c65('0xf')]=_0x4ff7c3;logger[_0x9c65('0x10')](_0x9c65('0x1a'));return rp(_0x38fb27)['then'](function(_0x46e7f9){if(_0x46e7f9){var _0xa21107=_0x46e7f9['users'];var _0x2ccf9e=![];var _0x591967=null;if(_0x2883a8[_0x9c65('0x1b')]!==null){logger[_0x9c65('0x10')](_0x9c65('0x1c'),_0x2883a8[_0x9c65('0x1b')]);_0x2883a8[_0x9c65('0x1d')]=_0x2883a8[_0x9c65('0x1b')];for(_0x591967=0x0;_0x591967<_0xa21107['length'];_0x591967++){if(_0xa21107[_0x591967][_0x9c65('0x14')]===_0x2883a8[_0x9c65('0x1b')]){_0x2ccf9e=!![];_0x2883a8[_0x9c65('0x1e')]=_0xa21107[_0x591967]['id'];logger[_0x9c65('0x10')]('User\x20found:',_0x2883a8['userId']);}}}if(!_0x2ccf9e){logger[_0x9c65('0x10')]('Admin\x20selected');_0x2883a8[_0x9c65('0x1d')]=_0x2883a8['adminEmail'];_0x2883a8[_0x9c65('0x1e')]=_0x2883a8[_0x9c65('0x15')];_0x2ccf9e=!![];}if(_0x2ccf9e){_0x3ea31f(_0x2883a8);}else{_0x3874aa({'statusCode':0x194,'message':_0x9c65('0x16')});}}else{_0x3874aa({'statusCode':0x194,'message':_0x9c65('0x16')});}})['catch'](function(_0x225ac2){logger[_0x9c65('0x18')]('['+[_0x547684[_0x9c65('0x19')]()]+']',_0x225ac2['message']);_0x3874aa(_0x225ac2);});});};}function searchContact(_0xc760fb,_0x4624d2,_0x324e13,_0x4fd4a4){return new Promise(function(_0x3acbc7,_0x4af5b9){var _0x27518b={'method':_0x9c65('0xd'),'headers':_0x4624d2,'uri':_0xc760fb+'/api/lookup?q='+_0x4fd4a4+_0x9c65('0x1f')+_0x324e13+_0x9c65('0x20'),'json':!![]};rp(_0x27518b)[_0x9c65('0x21')](function(_0xfdcc3f){var _0x5f17e9=_[_0x9c65('0x22')](_0xfdcc3f[_0x9c65('0x23')][_0x9c65('0x23')],[_0x324e13,_0x4fd4a4]);_0x3acbc7(_0x5f17e9);})[_0x9c65('0x17')](function(_0x76eb90){_0x4af5b9(_0x76eb90);});});}function getEndUser(_0x4b55ca,_0x469379,_0x5c94b2){return function(_0x26ed96){return new Promise(function(_0x460a4c,_0x5b177d){logger['info'](util['format'](_0x9c65('0x24'),_0x26ed96['contactNumber']));searchContact(_0x5c94b2,_0x469379,'mobile_number',_0x26ed96[_0x9c65('0x25')])['then'](function(_0x1e17c1){if(_0x1e17c1){_0x26ed96[_0x9c65('0x26')]=_0x1e17c1['id'];logger[_0x9c65('0x10')](_0x9c65('0x27'),_0x26ed96['endUserId']);return _0x460a4c(_0x26ed96);}searchContact(_0x5c94b2,_0x469379,_0x9c65('0x28'),_0x26ed96['contactNumber'])['then'](function(_0x434639){if(_0x434639){_0x26ed96[_0x9c65('0x26')]=_0x434639['id'];logger[_0x9c65('0x10')](_0x9c65('0x29'),_0x26ed96['endUserId']);return _0x460a4c(_0x26ed96);}createEndUser(_0x26ed96,_0x4b55ca,_0x469379,_0x5c94b2)[_0x9c65('0x21')](function(_0x33b944){logger[_0x9c65('0x10')](_0x9c65('0x2a'),_0x33b944[_0x9c65('0x26')]);return _0x460a4c(_0x33b944);});});})[_0x9c65('0x17')](function(_0x1715c9){_0x5b177d(_0x1715c9);});});};}function createEndUser(_0x26b35e,_0x3168bd,_0x13aeaf,_0x12496c){return new Promise(function(_0x5d29ed,_0x2628fe){var _0x3098b8=moment();var _0x24fb1d={'method':_0x9c65('0x2b'),'uri':_0x12496c+'/api/contacts','body':{'contact':{'last_name':_0x26b35e[_0x9c65('0x25')],'work_number':_0x26b35e[_0x9c65('0x25')],'mobile_number':_0x26b35e[_0x9c65('0x25')],'owner_id':_0x26b35e[_0x9c65('0x1e')],'created_at':_0x3098b8[_0x9c65('0x2c')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x24fb1d[_0x9c65('0xf')]=_0x13aeaf;logger[_0x9c65('0x10')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x24fb1d)[_0x9c65('0x21')](function(_0x2e4a1f){_0x26b35e[_0x9c65('0x26')]=_0x2e4a1f[_0x9c65('0x2d')]['id'];_0x5d29ed(_0x26b35e);})[_0x9c65('0x17')](function(_0xdd869b){logger[_0x9c65('0x18')]('['+[_0x3168bd[_0x9c65('0x19')]()]+']',_0xdd869b[_0x9c65('0x2e')]);_0x2628fe(_0xdd869b[_0x9c65('0x2e')]);});});}function getTicket(_0x4d6d5f,_0x45d535,_0x2e5160,_0x5a5b79,_0x329aab){return function(_0x14fc0b){logger[_0x9c65('0x10')](_0x9c65('0x2f'));return new Promise(function(_0x3bdb98,_0x947bd1){var _0x50cfc8=moment();var _0x190343={'method':'POST','uri':_0x2e5160+'/api/tasks','body':{'title':intUtil[_0x9c65('0x30')](_0x5a5b79[_0x9c65('0x31')],_0x329aab,'\x20'),'description':intUtil[_0x9c65('0x30')](_0x5a5b79[_0x9c65('0x32')],_0x329aab,'\x0a'),'owner_id':_0x14fc0b[_0x9c65('0x1e')],'creater_id':_0x14fc0b[_0x9c65('0x15')],'targetable_id':_0x14fc0b['endUserId'],'targetable_type':_0x9c65('0x33'),'created_at':_0x50cfc8[_0x9c65('0x2c')](_0x9c65('0x34')),'due_date':_0x50cfc8['add'](0x1e,'m')[_0x9c65('0x2c')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x190343[_0x9c65('0xf')]=_0x45d535;return rp(_0x190343)[_0x9c65('0x21')](function(_0x4f5c5e){_0x14fc0b[_0x9c65('0x35')]=_0x4f5c5e[_0x9c65('0x36')]['id'];logger['info']('Task\x20created:',_0x14fc0b[_0x9c65('0x35')]);_0x3bdb98(_0x14fc0b);})[_0x9c65('0x17')](function(_0x42f54e){logger['error']('['+[_0x4d6d5f[_0x9c65('0x19')]()]+']',_0x42f54e[_0x9c65('0x2e')]);_0x947bd1(_0x42f54e['message']);});});};}function emit(_0x2d2b67,_0x355dca,_0x5be32a){var _0x2225ba={'uri':_0x2d2b67+_0x9c65('0x37')+_0x5be32a};io['to'](util[_0x9c65('0x2c')](_0x9c65('0x38'),_0x355dca))['emit']('trigger:browser:url',_0x2225ba);}exports['cs']=function(_0x4a06c0,_0x37b0a1,_0x4b8782,_0x1ad8c7,_0x51559b,_0x58bbac,_0x36ba67,_0x1a6d2d){var _0x4e248f={};var _0x554cb7={'Authorization':_0x9c65('0x39')+_0x58bbac['apiKey']};_0x58bbac[_0x9c65('0x3a')]=intUtil[_0x9c65('0x3b')](_0x58bbac[_0x9c65('0x3a')]);_0x58bbac[_0x9c65('0x3c')]=intUtil[_0x9c65('0x3b')](_0x58bbac[_0x9c65('0x3c')]);var _0x1d0b3e=_0x58bbac[_0x9c65('0x3a')];_0x4e248f[_0x9c65('0x3d')]=_0x58bbac[_0x9c65('0x3e')];_0x4e248f[_0x9c65('0x25')]=_0x1a6d2d['toLowerCase']()===_0x9c65('0x3f')?_0x37b0a1['destcalleridnum']:_0x37b0a1['calleridnum'];_0x4e248f[_0x9c65('0x40')]=_0x1a6d2d===_0x9c65('0x41')||_0x1a6d2d==='unmanaged'?'queue':_0x9c65('0x3f');if(_0x1ad8c7){_0x4e248f[_0x9c65('0x1b')]=_0x1ad8c7[_0x9c65('0x14')];}var _0x29a35a=util['format'](_0x9c65('0x42'),_0x58bbac['serverUrl'],_0x37b0a1['uniqueid'],md5(_0x37b0a1['uniqueid']));if(_0x51559b&&_0x51559b[_0x9c65('0x43')]){logger[_0x9c65('0x10')](_0x9c65('0x44'),_0x9c65('0x45'));_0x37b0a1['recordingURL']=_0x29a35a;}else if(_0x36ba67&&_0x36ba67['recordingFormat']&&_0x36ba67[_0x9c65('0x46')]!==_0x9c65('0x47')){logger[_0x9c65('0x10')](_0x9c65('0x48'),'Recording\x20is\x20enabled!');_0x37b0a1['recordingURL']=_0x29a35a;}else{_0x37b0a1[_0x9c65('0x49')]='';}return getAdminId(_0x4e248f,_0x1a6d2d,_0x554cb7,_0x1d0b3e)['then'](getUser(_0x1a6d2d,_0x554cb7,_0x1d0b3e))[_0x9c65('0x21')](getEndUser(_0x1a6d2d,_0x554cb7,_0x1d0b3e))[_0x9c65('0x21')](getTicket(_0x1a6d2d,_0x554cb7,_0x1d0b3e,_0x4b8782,_0x37b0a1))['then'](function(_0x572a75){logger[_0x9c65('0x10')](util[_0x9c65('0x2c')](_0x9c65('0x4a'),_0x572a75[_0x9c65('0x35')]));if(_0x1a6d2d!==_0x9c65('0x4b')){logger[_0x9c65('0x10')]('['+[_0x1a6d2d[_0x9c65('0x19')]()]+']',_0x9c65('0x4c'));emit(_0x1d0b3e,_0x1ad8c7[_0x9c65('0x4d')],_0x572a75[_0x9c65('0x26')]);}})[_0x9c65('0x17')](function(_0x3b36b6){logger[_0x9c65('0x18')]('['+[_0x1a6d2d[_0x9c65('0x19')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x9c65('0x4e')](_0x3b36b6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2fb8=['User\x20found:','Admin\x20selected','error','toUpperCase','/api/lookup?q=','&f=','contacts','format','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','work_number','endUserId','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s',']\x20Error\x20running\x20Freshsales\x20integration','inspect','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','localhost','socket.io-emitter','redis','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','message','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','email','userId'];(function(_0x4d8310,_0x5df4fc){var _0xf9d244=function(_0x3e4600){while(--_0x3e4600){_0x4d8310['push'](_0x4d8310['shift']());}};_0xf9d244(++_0x5df4fc);}(_0x2fb8,0x12c));var _0x82fb=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x2fb8[_0x618414];return _0x21c19a;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0x82fb('0x0'));var moment=require(_0x82fb('0x1'));var Promise=require(_0x82fb('0x2'));var Redis=require(_0x82fb('0x3'));var intUtil=require(_0x82fb('0x4'));var config=require(_0x82fb('0x5'));var logger=require(_0x82fb('0x6'))(_0x82fb('0x7'));config['redis']=_[_0x82fb('0x8')](config['redis'],{'host':_0x82fb('0x9'),'port':0x18eb});var io=require(_0x82fb('0xa'))(new Redis(config[_0x82fb('0xb')]));function getAdminId(_0x1ed4a7,_0x2d2267,_0x2f006a,_0x24b25c){return new Promise(function(_0x45534e,_0x1f26b5){var _0xa8d494=![];var _0x4c3860={'method':_0x82fb('0xc'),'uri':_0x24b25c+_0x82fb('0xd'),'json':!![]};_0x4c3860[_0x82fb('0xe')]=_0x2f006a;logger['info'](_0x82fb('0xf'));return rp(_0x4c3860)[_0x82fb('0x10')](function(_0x21483f){if(_0x21483f){var _0x4201ed=_0x21483f['users'];var _0x2b22c4=null;for(_0x2b22c4=0x0;_0x2b22c4<_0x4201ed['length'];_0x2b22c4++){if(_0x4201ed[_0x2b22c4]['email']===_0x1ed4a7[_0x82fb('0x11')]){_0x1ed4a7[_0x82fb('0x12')]=_0x4201ed[_0x2b22c4]['id'];_0xa8d494=!![];}}if(_0xa8d494){logger[_0x82fb('0x13')](_0x82fb('0x14'),_0x1ed4a7[_0x82fb('0x12')]);_0x45534e(_0x1ed4a7);}else{_0x1f26b5({'statusCode':0x194,'message':_0x82fb('0x15')});}}else{_0x1f26b5({'statusCode':0x194,'message':_0x82fb('0x15')});}})[_0x82fb('0x16')](function(_0x3b74e4){logger['error']('['+[_0x2d2267['toUpperCase']()]+']',_0x3b74e4[_0x82fb('0x17')]);_0x1f26b5(_0x3b74e4);});});}function getUser(_0x340933,_0x5602b8,_0x11adc0){return function(_0x31f877){return new Promise(function(_0x220623,_0x197d88){var _0x306c54={'method':_0x82fb('0xc'),'uri':_0x11adc0+_0x82fb('0xd'),'json':!![]};_0x306c54['headers']=_0x5602b8;logger[_0x82fb('0x13')](_0x82fb('0x18'));return rp(_0x306c54)[_0x82fb('0x10')](function(_0x1220b0){if(_0x1220b0){var _0x2f4a9b=_0x1220b0[_0x82fb('0x19')];var _0x1141fb=![];var _0x437810=null;if(_0x31f877[_0x82fb('0x1a')]!==null){logger[_0x82fb('0x13')](_0x82fb('0x1b'),_0x31f877[_0x82fb('0x1a')]);_0x31f877[_0x82fb('0x1c')]=_0x31f877[_0x82fb('0x1a')];for(_0x437810=0x0;_0x437810<_0x2f4a9b[_0x82fb('0x1d')];_0x437810++){if(_0x2f4a9b[_0x437810][_0x82fb('0x1e')]===_0x31f877[_0x82fb('0x1a')]){_0x1141fb=!![];_0x31f877[_0x82fb('0x1f')]=_0x2f4a9b[_0x437810]['id'];logger[_0x82fb('0x13')](_0x82fb('0x20'),_0x31f877[_0x82fb('0x1f')]);}}}if(!_0x1141fb){logger[_0x82fb('0x13')](_0x82fb('0x21'));_0x31f877[_0x82fb('0x1c')]=_0x31f877[_0x82fb('0x11')];_0x31f877[_0x82fb('0x1f')]=_0x31f877[_0x82fb('0x12')];_0x1141fb=!![];}if(_0x1141fb){_0x220623(_0x31f877);}else{_0x197d88({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x197d88({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x82fb('0x16')](function(_0x4f40bb){logger[_0x82fb('0x22')]('['+[_0x340933[_0x82fb('0x23')]()]+']',_0x4f40bb[_0x82fb('0x17')]);_0x197d88(_0x4f40bb);});});};}function searchContact(_0x1cdedc,_0x106bd4,_0xecf5c5,_0xd8e919){return new Promise(function(_0xa586e0,_0x3e1761){var _0x456e9d={'method':'GET','headers':_0x106bd4,'uri':_0x1cdedc+_0x82fb('0x24')+_0xd8e919+_0x82fb('0x25')+_0xecf5c5+'&entities=contact','json':!![]};rp(_0x456e9d)[_0x82fb('0x10')](function(_0x3dd254){var _0x53fe92=_['find'](_0x3dd254[_0x82fb('0x26')][_0x82fb('0x26')],[_0xecf5c5,_0xd8e919]);_0xa586e0(_0x53fe92);})[_0x82fb('0x16')](function(_0x28c6c5){_0x3e1761(_0x28c6c5);});});}function getEndUser(_0x5e2be0,_0x5c3ae0,_0x47d6bc){return function(_0x45c26c){return new Promise(function(_0x2e6e65,_0x3f90e3){logger[_0x82fb('0x13')](util[_0x82fb('0x27')]('Searching\x20contact\x20with\x20phone\x20%s',_0x45c26c[_0x82fb('0x28')]));searchContact(_0x47d6bc,_0x5c3ae0,_0x82fb('0x29'),_0x45c26c[_0x82fb('0x28')])[_0x82fb('0x10')](function(_0x562cc2){if(_0x562cc2){_0x45c26c['endUserId']=_0x562cc2['id'];logger['info'](_0x82fb('0x2a'),_0x45c26c['endUserId']);return _0x2e6e65(_0x45c26c);}searchContact(_0x47d6bc,_0x5c3ae0,_0x82fb('0x2b'),_0x45c26c[_0x82fb('0x28')])[_0x82fb('0x10')](function(_0x518aae){if(_0x518aae){_0x45c26c[_0x82fb('0x2c')]=_0x518aae['id'];logger[_0x82fb('0x13')](_0x82fb('0x2d'),_0x45c26c[_0x82fb('0x2c')]);return _0x2e6e65(_0x45c26c);}createEndUser(_0x45c26c,_0x5e2be0,_0x5c3ae0,_0x47d6bc)[_0x82fb('0x10')](function(_0xc83806){logger[_0x82fb('0x13')]('Contact\x20created:',_0xc83806[_0x82fb('0x2c')]);return _0x2e6e65(_0xc83806);});});})[_0x82fb('0x16')](function(_0x46a36e){_0x3f90e3(_0x46a36e);});});};}function createEndUser(_0x33e78b,_0x50fd93,_0x1ba79f,_0x6c60ad){return new Promise(function(_0x521ba5,_0x134e83){var _0x359d4f=moment();var _0x281203={'method':_0x82fb('0x2e'),'uri':_0x6c60ad+_0x82fb('0x2f'),'body':{'contact':{'last_name':_0x33e78b[_0x82fb('0x28')],'work_number':_0x33e78b[_0x82fb('0x28')],'mobile_number':_0x33e78b[_0x82fb('0x28')],'owner_id':_0x33e78b['userId'],'created_at':_0x359d4f[_0x82fb('0x27')](_0x82fb('0x30'))}},'json':!![]};_0x281203['headers']=_0x1ba79f;logger[_0x82fb('0x13')](_0x82fb('0x31'));return rp(_0x281203)['then'](function(_0x51d0c4){_0x33e78b[_0x82fb('0x2c')]=_0x51d0c4['contact']['id'];_0x521ba5(_0x33e78b);})[_0x82fb('0x16')](function(_0x47fb60){logger[_0x82fb('0x22')]('['+[_0x50fd93['toUpperCase']()]+']',_0x47fb60['message']);_0x134e83(_0x47fb60['message']);});});}function getTicket(_0x32e65f,_0x12fd79,_0x347452,_0x152818,_0x38c3a9){return function(_0x82856c){logger[_0x82fb('0x13')](_0x82fb('0x32'));return new Promise(function(_0x50fefa,_0x31d648){var _0x420522=moment();var _0x3a76e8={'method':_0x82fb('0x2e'),'uri':_0x347452+'/api/tasks','body':{'title':intUtil[_0x82fb('0x33')](_0x152818[_0x82fb('0x34')],_0x38c3a9,'\x20'),'description':intUtil['getString'](_0x152818[_0x82fb('0x35')],_0x38c3a9,'\x0a'),'owner_id':_0x82856c['userId'],'creater_id':_0x82856c[_0x82fb('0x12')],'targetable_id':_0x82856c['endUserId'],'targetable_type':_0x82fb('0x36'),'created_at':_0x420522[_0x82fb('0x27')](_0x82fb('0x30')),'due_date':_0x420522[_0x82fb('0x37')](0x1e,'m')[_0x82fb('0x27')](_0x82fb('0x30'))},'json':!![]};_0x3a76e8[_0x82fb('0xe')]=_0x12fd79;return rp(_0x3a76e8)[_0x82fb('0x10')](function(_0x2243db){_0x82856c[_0x82fb('0x38')]=_0x2243db[_0x82fb('0x39')]['id'];logger['info'](_0x82fb('0x3a'),_0x82856c[_0x82fb('0x38')]);_0x50fefa(_0x82856c);})[_0x82fb('0x16')](function(_0x43aeab){logger[_0x82fb('0x22')]('['+[_0x32e65f[_0x82fb('0x23')]()]+']',_0x43aeab[_0x82fb('0x17')]);_0x31d648(_0x43aeab['message']);});});};}function emit(_0x5a732c,_0x133580,_0x15bedc){var _0x83ac54={'uri':_0x5a732c+_0x82fb('0x3b')+_0x15bedc};io['to'](util[_0x82fb('0x27')](_0x82fb('0x3c'),_0x133580))['emit'](_0x82fb('0x3d'),_0x83ac54);}exports['cs']=function(_0x239f72,_0x294bf1,_0x35315b,_0x24ceb2,_0x3199fa,_0x41d2e7,_0x2ca4f4,_0x280ef4){var _0x5072f4={};var _0x14fed9={'Authorization':_0x82fb('0x3e')+_0x41d2e7['apiKey']};_0x41d2e7[_0x82fb('0x3f')]=intUtil['stripTrailingSlash'](_0x41d2e7['remoteUri']);_0x41d2e7['serverUrl']=intUtil[_0x82fb('0x40')](_0x41d2e7[_0x82fb('0x41')]);var _0x161d28=_0x41d2e7[_0x82fb('0x3f')];_0x5072f4[_0x82fb('0x11')]=_0x41d2e7[_0x82fb('0x42')];_0x5072f4[_0x82fb('0x28')]=_0x280ef4[_0x82fb('0x43')]()===_0x82fb('0x44')?_0x294bf1['destcalleridnum']:_0x294bf1[_0x82fb('0x45')];_0x5072f4[_0x82fb('0x46')]=_0x280ef4==='queue'||_0x280ef4===_0x82fb('0x47')?_0x82fb('0x48'):_0x82fb('0x44');if(_0x24ceb2){_0x5072f4['agentEmail']=_0x24ceb2[_0x82fb('0x1e')];}var _0x4fadb4=util[_0x82fb('0x27')](_0x82fb('0x49'),_0x41d2e7['serverUrl'],_0x294bf1[_0x82fb('0x4a')],md5(_0x294bf1['uniqueid']));if(_0x3199fa&&_0x3199fa[_0x82fb('0x4b')]){logger[_0x82fb('0x13')]('[QUEUE]',_0x82fb('0x4c'));_0x294bf1[_0x82fb('0x4d')]=_0x4fadb4;}else if(_0x2ca4f4&&_0x2ca4f4[_0x82fb('0x4e')]&&_0x2ca4f4[_0x82fb('0x4e')]!==_0x82fb('0x4f')){logger[_0x82fb('0x13')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x294bf1[_0x82fb('0x4d')]=_0x4fadb4;}else{_0x294bf1['recordingURL']='';}return getAdminId(_0x5072f4,_0x280ef4,_0x14fed9,_0x161d28)[_0x82fb('0x10')](getUser(_0x280ef4,_0x14fed9,_0x161d28))['then'](getEndUser(_0x280ef4,_0x14fed9,_0x161d28))['then'](getTicket(_0x280ef4,_0x14fed9,_0x161d28,_0x35315b,_0x294bf1))[_0x82fb('0x10')](function(_0xa56cb0){logger['info'](util[_0x82fb('0x27')](_0x82fb('0x50'),_0xa56cb0[_0x82fb('0x38')]));if(_0x280ef4!==_0x82fb('0x47')){logger[_0x82fb('0x13')]('['+[_0x280ef4[_0x82fb('0x23')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x161d28,_0x24ceb2['name'],_0xa56cb0[_0x82fb('0x2c')]);}})[_0x82fb('0x16')](function(_0x1ff5cc){logger[_0x82fb('0x22')]('['+[_0x280ef4[_0x82fb('0x23')]()]+_0x82fb('0x51'),util[_0x82fb('0x52')](_0x1ff5cc,{'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 8ccd990..3cd0123 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 _0x1984=['../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','dynamics365','freshsales','data1','toLowerCase','data2','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','servicenow'];(function(_0xc08a23,_0x5a39dd){var _0x3d8b6a=function(_0x1eb452){while(--_0x1eb452){_0xc08a23['push'](_0xc08a23['shift']());}};_0x3d8b6a(++_0x5a39dd);}(_0x1984,0x1c2));var _0x4198=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x1984[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x4198('0x0'));var util=require('util');var zendesk=require(_0x4198('0x1'));var salesforce=require(_0x4198('0x2'));var sugarcrm=require(_0x4198('0x3'));var freshdesk=require(_0x4198('0x4'));var zoho=require(_0x4198('0x5'));var desk=require('./desk');var vtiger=require(_0x4198('0x6'));var servicenow=require(_0x4198('0x7'));var dynamics365=require(_0x4198('0x8'));var freshsales=require(_0x4198('0x9'));var integrations=[_0x4198('0xa'),_0x4198('0xb'),_0x4198('0xc'),'freshdesk',_0x4198('0xd'),_0x4198('0xe'),_0x4198('0xf'),_0x4198('0x10'),_0x4198('0x11'),'servicenow'];exports['exec']=function(_0x12cbb6,_0x4a9fda,_0xcd7fb1,_0x2ea433,_0x2bad03,_0x48f95c){if(_0xcd7fb1){if(_['includes'](integrations,_0x12cbb6[_0x4198('0x12')]['toLowerCase']())){try{var _0x28754d=null;var _0x4edb43='';var _0x28f51c=_0xcd7fb1[_0x12cbb6[_0x4198('0x12')][_0x4198('0x13')]()];if(_0x28f51c){var _0x4c1b9f=_0x28f51c[_0x12cbb6[_0x4198('0x14')]];if(_0x4c1b9f){var _0x4b4fee=_['find'](_0x4c1b9f[_0x4198('0x15')],{'id':parseInt(_0x12cbb6[_0x4198('0x16')],0xa)});if(_0x4b4fee){if(_0x2ea433){if(_0x2bad03&&_0x4a9fda[_0x4198('0x17')]){_0x4edb43=_0x4198('0x17');}else if(_0x4a9fda[_0x4198('0x18')]){_0x4edb43=_0x4198('0x19');}else{console[_0x4198('0x1a')](_0x4198('0x1b'),_0x4a9fda);}}else{_0x4edb43=_0x4198('0x1c');}switch(_0x12cbb6[_0x4198('0x12')][_0x4198('0x13')]()){case _0x4198('0xa'):zendesk[_0x4edb43](_0x12cbb6,_0x4a9fda,_0x4b4fee,_0x2ea433,_0x2bad03,_0x4c1b9f,_0x48f95c);break;case'salesforce':salesforce[_0x4edb43](_0x12cbb6,_0x4a9fda,_0x4b4fee,_0x2ea433,_0x2bad03,_0x4c1b9f,_0x48f95c);break;case _0x4198('0xc'):sugarcrm[_0x4edb43](_0x12cbb6,_0x4a9fda,_0x4b4fee,_0x2ea433,_0x2bad03,_0x4c1b9f,_0x48f95c);break;case _0x4198('0x1d'):freshdesk[_0x4edb43](_0x12cbb6,_0x4a9fda,_0x4b4fee,_0x2ea433,_0x2bad03,_0x4c1b9f,_0x48f95c);break;case'zoho':zoho[_0x4edb43](_0x12cbb6,_0x4a9fda,_0x4b4fee,_0x2ea433,_0x2bad03,_0x4c1b9f,_0x48f95c);break;case _0x4198('0xe'):desk[_0x4edb43](_0x12cbb6,_0x4a9fda,_0x4b4fee,_0x2ea433,_0x2bad03,_0x4c1b9f,_0x48f95c);break;case _0x4198('0xf'):vtiger[_0x4edb43](_0x12cbb6,_0x4a9fda,_0x4b4fee,_0x2ea433,_0x2bad03,_0x4c1b9f,_0x48f95c);break;case _0x4198('0x11'):freshsales['cs'](_0x12cbb6,_0x4a9fda,_0x4b4fee,_0x2ea433,_0x2bad03,_0x4c1b9f,_0x48f95c,_0x4edb43);break;case _0x4198('0x1e'):servicenow['cs'](_0x12cbb6,_0x4a9fda,_0x4b4fee,_0x2ea433,_0x2bad03,_0x4c1b9f,_0x48f95c,_0x4edb43);break;case _0x4198('0x10'):dynamics365['cs'](_0x12cbb6,_0x4a9fda,_0x4b4fee,_0x2ea433,_0x2bad03,_0x4c1b9f,_0x48f95c,_0x4edb43);break;default:console['log']('unknown\x20integration');}}else{_0x28754d=require(_0x4198('0x1f'))(_0x12cbb6[_0x4198('0x12')]['toLowerCase']());_0x28754d[_0x4198('0x20')](_0x4198('0x21'),util[_0x4198('0x22')](_0x4198('0x23'),_0x12cbb6['data1'][_0x4198('0x13')](),_0x12cbb6[_0x4198('0x16')]));}}else{_0x28754d=require(_0x4198('0x1f'))(_0x12cbb6[_0x4198('0x12')][_0x4198('0x13')]());_0x28754d['error'](_0x4198('0x21'),util[_0x4198('0x22')](_0x4198('0x24'),_0x12cbb6[_0x4198('0x12')][_0x4198('0x13')](),_0x12cbb6[_0x4198('0x14')]));}}else{}}catch(_0x4f424f){console[_0x4198('0x20')](_0x4f424f);}}}}; \ No newline at end of file +var _0x5432=['log','EVENT\x20UNKNOWN','unmanaged','zendesk','vtiger','servicenow','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','dynamics365','freshsales','exec','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x5432,0xc5));var _0x2543=function(_0x27ff79,_0x2216a0){_0x27ff79=_0x27ff79-0x0;var _0x4f2da3=_0x5432[_0x27ff79];return _0x4f2da3;};'use strict';var _=require(_0x2543('0x0'));var util=require(_0x2543('0x1'));var zendesk=require(_0x2543('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x2543('0x3'));var freshdesk=require(_0x2543('0x4'));var zoho=require(_0x2543('0x5'));var desk=require(_0x2543('0x6'));var vtiger=require(_0x2543('0x7'));var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require(_0x2543('0x8'));var integrations=['zendesk',_0x2543('0x9'),_0x2543('0xa'),_0x2543('0xb'),_0x2543('0xc'),_0x2543('0xd'),'vtiger',_0x2543('0xe'),_0x2543('0xf'),'servicenow'];exports[_0x2543('0x10')]=function(_0x2dd21a,_0x252471,_0x239cc4,_0x1fbb4a,_0x34dd3a,_0x4d9a69){if(_0x239cc4){if(_['includes'](integrations,_0x2dd21a[_0x2543('0x11')]['toLowerCase']())){try{var _0x37dabf=null;var _0x4c2179='';var _0x501338=_0x239cc4[_0x2dd21a['data1'][_0x2543('0x12')]()];if(_0x501338){var _0x513f11=_0x501338[_0x2dd21a[_0x2543('0x13')]];if(_0x513f11){var _0x1fc63b=_[_0x2543('0x14')](_0x513f11[_0x2543('0x15')],{'id':parseInt(_0x2dd21a[_0x2543('0x16')],0xa)});if(_0x1fc63b){if(_0x1fbb4a){if(_0x34dd3a&&_0x252471['queue']){_0x4c2179=_0x2543('0x17');}else if(_0x252471[_0x2543('0x18')]){_0x4c2179='outbound';}else{console[_0x2543('0x19')](_0x2543('0x1a'),_0x252471);}}else{_0x4c2179=_0x2543('0x1b');}switch(_0x2dd21a['data1'][_0x2543('0x12')]()){case _0x2543('0x1c'):zendesk[_0x4c2179](_0x2dd21a,_0x252471,_0x1fc63b,_0x1fbb4a,_0x34dd3a,_0x513f11,_0x4d9a69);break;case _0x2543('0x9'):salesforce[_0x4c2179](_0x2dd21a,_0x252471,_0x1fc63b,_0x1fbb4a,_0x34dd3a,_0x513f11,_0x4d9a69);break;case _0x2543('0xa'):sugarcrm[_0x4c2179](_0x2dd21a,_0x252471,_0x1fc63b,_0x1fbb4a,_0x34dd3a,_0x513f11,_0x4d9a69);break;case'freshdesk':freshdesk[_0x4c2179](_0x2dd21a,_0x252471,_0x1fc63b,_0x1fbb4a,_0x34dd3a,_0x513f11,_0x4d9a69);break;case'zoho':zoho[_0x4c2179](_0x2dd21a,_0x252471,_0x1fc63b,_0x1fbb4a,_0x34dd3a,_0x513f11,_0x4d9a69);break;case _0x2543('0xd'):desk[_0x4c2179](_0x2dd21a,_0x252471,_0x1fc63b,_0x1fbb4a,_0x34dd3a,_0x513f11,_0x4d9a69);break;case _0x2543('0x1d'):vtiger[_0x4c2179](_0x2dd21a,_0x252471,_0x1fc63b,_0x1fbb4a,_0x34dd3a,_0x513f11,_0x4d9a69);break;case _0x2543('0xf'):freshsales['cs'](_0x2dd21a,_0x252471,_0x1fc63b,_0x1fbb4a,_0x34dd3a,_0x513f11,_0x4d9a69,_0x4c2179);break;case _0x2543('0x1e'):servicenow['cs'](_0x2dd21a,_0x252471,_0x1fc63b,_0x1fbb4a,_0x34dd3a,_0x513f11,_0x4d9a69,_0x4c2179);break;case _0x2543('0xe'):dynamics365['cs'](_0x2dd21a,_0x252471,_0x1fc63b,_0x1fbb4a,_0x34dd3a,_0x513f11,_0x4d9a69,_0x4c2179);break;default:console['log'](_0x2543('0x1f'));}}else{_0x37dabf=require(_0x2543('0x20'))(_0x2dd21a[_0x2543('0x11')][_0x2543('0x12')]());_0x37dabf[_0x2543('0x21')](_0x2543('0x22'),util[_0x2543('0x23')](_0x2543('0x24'),_0x2dd21a[_0x2543('0x11')][_0x2543('0x12')](),_0x2dd21a['data3']));}}else{_0x37dabf=require('../../../../config/logger')(_0x2dd21a[_0x2543('0x11')]['toLowerCase']());_0x37dabf[_0x2543('0x21')]('[EXEC]',util['format']('%s\x20account\x20#%s\x20not\x20found',_0x2dd21a[_0x2543('0x11')]['toLowerCase'](),_0x2dd21a[_0x2543('0x13')]));}}else{}}catch(_0x3b81aa){console[_0x2543('0x21')](_0x3b81aa);}}}}; \ 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 a3ff0fb..53186c3 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 _0x3005=['ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','redis','localhost','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','Case','contact','ContactId','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','sobject','find','then','length','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','Lead','account_contact_lead','Account','execute','additionalSearchLead','lead','additionalSearchAccount','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','Company','format','upperFirst','forEach','string','picklist','idField','content','variable','variableName','toString','type','Variable','name','password','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','Fields','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','util'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x3005,0xfa));var _0x5300=function(_0x230ea3,_0x4a7b39){_0x230ea3=_0x230ea3-0x0;var _0x2e8764=_0x3005[_0x230ea3];return _0x2e8764;};'use strict';var _=require('lodash');var rp=require(_0x5300('0x0'));var moment=require(_0x5300('0x1'));var BPromise=require(_0x5300('0x2'));var md5=require(_0x5300('0x3'));var jsforce=require(_0x5300('0x4'));var util=require(_0x5300('0x5'));var Redis=require(_0x5300('0x6'));var intUtil=require(_0x5300('0x7'));var config=require(_0x5300('0x8'));var logger=require(_0x5300('0x9'))(_0x5300('0xa'));config['redis']=_[_0x5300('0xb')](config[_0x5300('0xc')],{'host':_0x5300('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5300('0xc')]));function emit(_0x312caa,_0x232abd,_0x485a18){io['to'](_0x312caa)['emit'](_0x232abd,_0x485a18);}function getTicket(_0x1e6b22,_0x4e3a09,_0xc8489d,_0x28a69c,_0x14e088,_0x2103dc,_0x18bf72,_0x437fbd){var _0x1338a8=Object[_0x5300('0xe')]({},{'OwnerId':_0x4e3a09['id'],'Subject':intUtil[_0x5300('0xf')](_0x28a69c[_0x5300('0x10')],_0x14e088,'\x20'),'Description':intUtil['getString'](_0x28a69c[_0x5300('0x11')],_0x14e088,'\x0a')},getCustomFields(_0x2103dc,_0x14e088));if(_0xc8489d){if(_0x28a69c[_0x5300('0x12')]===_0x5300('0x13')){_0x1338a8[_0x5300('0x14')]=moment[_0x5300('0x15')]();_0x1338a8[_0x5300('0x16')]=![];_0x1338a8[_0x5300('0x17')]=![];if(_0xc8489d['endUserType']==='contact'||_0xc8489d[_0x5300('0x18')]==='lead'){_0x1338a8['WhoId']=_0xc8489d['id'];}else if(_0xc8489d[_0x5300('0x18')]==='account'){_0x1338a8['WhatId']=_0xc8489d['id'];}}else if(_0x28a69c['ticketType']===_0x5300('0x19')){if(_0xc8489d['endUserType']===_0x5300('0x1a')){_0x1338a8[_0x5300('0x1b')]=_0xc8489d['id'];}else if(_0xc8489d['endUserType']===_0x5300('0x1c')){_0x1338a8[_0x5300('0x1d')]=_0xc8489d['id'];}else if(_0xc8489d['endUserType']==='lead'&&_0x28a69c[_0x5300('0x1e')]){_0x1338a8[_0x28a69c[_0x5300('0x1e')]]=_0xc8489d['id'];}else{logger[_0x5300('0x1f')](_0x5300('0x20'));}}}return _0x18bf72['sobject'](_0x28a69c['ticketType'])[_0x5300('0x21')](_0x1338a8);}function getUser(_0x10b95a,_0x458157,_0x49395a){if(!_[_0x5300('0x22')](_0x458157)&&intUtil[_0x5300('0x23')](_0x458157)){var _0x564f3d={'Email':_0x458157};var _0x1dbdb0={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x49395a[_0x5300('0x24')]('User')[_0x5300('0x25')](_0x564f3d,_0x1dbdb0)['execute']()[_0x5300('0x26')](function(_0x573d40){if(_0x573d40[_0x5300('0x27')]){var _0x3f1c75=_['find'](_0x573d40,function(_0xeb9303){return _0xeb9303[_0x5300('0x28')]===_0x458157;});if(_0x3f1c75){logger[_0x5300('0x1f')]('Agent\x20%s\x20found.',_0x458157);return BPromise[_0x5300('0x29')]({'id':_0x3f1c75['Id'],'name':_0x3f1c75[_0x5300('0x2a')]});}}else{logger[_0x5300('0x1f')](_0x5300('0x2b'),_0x458157);return _0x49395a[_0x5300('0x2c')]()[_0x5300('0x26')](function(_0x2e166f){return BPromise[_0x5300('0x29')]({'id':_0x2e166f[_0x5300('0x2d')],'name':_0x2e166f['display_name']});});}});}else{logger[_0x5300('0x1f')](_0x5300('0x2b'),_0x458157);return _0x49395a['identity']()[_0x5300('0x26')](function(_0x472aae){return BPromise[_0x5300('0x29')]({'id':_0x472aae[_0x5300('0x2d')],'name':_0x472aae[_0x5300('0x2e')]});});}}function getEndUser(_0x29e5ce,_0x46ba97,_0x2ba975,_0x27be03,_0x2f4e6a){var _0x1bfd9b={'$or':{'Phone':_0x27be03}};var _0x35479b={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x5300('0x29')]()[_0x5300('0x26')](function(){logger[_0x5300('0x1f')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x27be03,_0x46ba97[_0x5300('0x2f')]);switch(_0x46ba97[_0x5300('0x2f')]){case _0x5300('0x30'):var _0x3d555a=_[_0x5300('0x31')](_0x1bfd9b);if(_0x46ba97[_0x5300('0x32')]){var _0x350211={};_0x350211[_0x46ba97[_0x5300('0x32')]]=_0x27be03;_[_0x5300('0x33')](_0x3d555a[_0x5300('0x34')],_0x350211);}return _0x2f4e6a['sobject'](_0x5300('0x35'))[_0x5300('0x25')](_0x3d555a,_0x35479b)['execute']()[_0x5300('0x26')](function(_0x58581b){if(_0x58581b&&_0x58581b[_0x5300('0x27')]){return _0x58581b;}else{var _0x314937=_[_0x5300('0x31')](_0x1bfd9b);if(_0x46ba97['additionalSearchLead']){var _0x241d22={};_0x241d22[_0x46ba97['additionalSearchLead']]=_0x27be03;_[_0x5300('0x33')](_0x314937[_0x5300('0x34')],_0x241d22);}return _0x2f4e6a[_0x5300('0x24')](_0x5300('0x36'))[_0x5300('0x25')](_0x314937,_0x35479b);}});case _0x5300('0x37'):var _0x207e81=_[_0x5300('0x31')](_0x1bfd9b);if(_0x46ba97['additionalSearchAccount']){var _0x350211={};_0x350211[_0x46ba97['additionalSearchAccount']]=_0x27be03;_[_0x5300('0x33')](_0x207e81[_0x5300('0x34')],_0x350211);}return _0x2f4e6a[_0x5300('0x24')](_0x5300('0x38'))[_0x5300('0x25')](_0x207e81,_0x35479b)[_0x5300('0x39')]()[_0x5300('0x26')](function(_0x28877e){if(_0x28877e&&_0x28877e[_0x5300('0x27')]){return _0x28877e;}else{var _0x9903b=_['cloneDeep'](_0x1bfd9b);if(_0x46ba97[_0x5300('0x32')]){var _0x4f7152={};_0x4f7152[_0x46ba97[_0x5300('0x32')]]=_0x27be03;_[_0x5300('0x33')](_0x9903b[_0x5300('0x34')],_0x4f7152);}return _0x2f4e6a[_0x5300('0x24')](_0x5300('0x35'))[_0x5300('0x25')](_0x9903b,_0x35479b)['then'](function(_0x7a7994){if(_0x7a7994&&_0x7a7994[_0x5300('0x27')]){return _0x7a7994;}else{var _0x4d010d=_[_0x5300('0x31')](_0x1bfd9b);if(_0x46ba97['additionalSearchLead']){var _0x28572f={};_0x28572f[_0x46ba97[_0x5300('0x3a')]]=_0x27be03;_[_0x5300('0x33')](_0x4d010d[_0x5300('0x34')],_0x28572f);}return _0x2f4e6a[_0x5300('0x24')](_0x5300('0x36'))[_0x5300('0x25')](_0x4d010d,_0x35479b);}});}});case _0x5300('0x1a'):var _0x3d555a=_[_0x5300('0x31')](_0x1bfd9b);if(_0x46ba97['additionalSearchContact']){var _0x350211={};_0x350211[_0x46ba97[_0x5300('0x32')]]=_0x27be03;_[_0x5300('0x33')](_0x3d555a[_0x5300('0x34')],_0x350211);}return _0x2f4e6a[_0x5300('0x24')]('Contact')[_0x5300('0x25')](_0x3d555a,_0x35479b)[_0x5300('0x39')]();case _0x5300('0x3b'):var _0x2beb71=_[_0x5300('0x31')](_0x1bfd9b);if(_0x46ba97[_0x5300('0x3a')]){var _0x350211={};_0x350211[_0x46ba97[_0x5300('0x3a')]]=_0x27be03;_['merge'](_0x2beb71[_0x5300('0x34')],_0x350211);}return _0x2f4e6a['sobject'](_0x5300('0x36'))[_0x5300('0x25')](_0x2beb71,_0x35479b);case _0x5300('0x1c'):var _0x207e81=_[_0x5300('0x31')](_0x1bfd9b);if(_0x46ba97[_0x5300('0x3c')]){var _0x350211={};_0x350211[_0x46ba97[_0x5300('0x3c')]]=_0x27be03;_[_0x5300('0x33')](_0x207e81[_0x5300('0x34')],_0x350211);}return _0x2f4e6a[_0x5300('0x24')](_0x5300('0x38'))[_0x5300('0x25')](_0x207e81,_0x35479b);default:return null;}})[_0x5300('0x26')](function(_0x3473c8){if(_0x3473c8&&_0x3473c8[_0x5300('0x27')]){var _0x2689cc=_['first'](_0x3473c8);if(_0x2689cc){return BPromise[_0x5300('0x29')]({'id':_0x2689cc['Id'],'name':_0x2689cc[_0x5300('0x2a')],'phone':_0x2689cc['Phone'],'endUserType':_0x2689cc['attributes']['type'][_0x5300('0x3d')]()});}}})[_0x5300('0x26')](function(_0x5051ad){if(_0x5051ad){logger[_0x5300('0x1f')](_0x5300('0x3e'),_0x5051ad[_0x5300('0x18')],_0x27be03);return BPromise[_0x5300('0x29')](_0x5051ad);}else{logger[_0x5300('0x1f')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x27be03);var _0xd8f6eb={'Phone':_0x27be03};if(_0x46ba97[_0x5300('0x3f')]){if(_0x46ba97['moduleCreate']==='contact'){logger[_0x5300('0x1f')](_0x5300('0x40'),_0x27be03,_0x46ba97[_0x5300('0x3f')]);_0xd8f6eb[_0x5300('0x41')]=_0x2ba975!==_0x5300('0x42')?_0x2ba975:util['format']('Caller\x20-\x20%s',_0x27be03);}else if(_0x46ba97[_0x5300('0x3f')]===_0x5300('0x3b')){logger['info'](_0x5300('0x40'),_0x27be03,_0x46ba97[_0x5300('0x3f')]);_0xd8f6eb[_0x5300('0x41')]=_0x2ba975!==_0x5300('0x42')?_0x2ba975:util['format'](_0x5300('0x43'),_0x27be03);_0xd8f6eb[_0x5300('0x44')]='No\x20Company';}else if(_0x46ba97[_0x5300('0x3f')]==='account'){logger[_0x5300('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x27be03,_0x46ba97[_0x5300('0x3f')]);_0xd8f6eb[_0x5300('0x2a')]=_0x2ba975!==_0x5300('0x42')?_0x2ba975:util[_0x5300('0x45')](_0x5300('0x43'),_0x27be03);}else{return null;}}return _0x2f4e6a[_0x5300('0x24')](_[_0x5300('0x46')](_0x46ba97[_0x5300('0x3f')]))[_0x5300('0x21')](_0xd8f6eb)['then'](function(_0x8d7c80){return BPromise['resolve']({'id':_0x8d7c80['id'],'endUserType':_0x46ba97[_0x5300('0x3f')]});});}});}function getCustomFields(_0x110056,_0x5193e2){var _0x5bab1b={};if(_0x110056[_0x5300('0x27')]>0x0){_[_0x5300('0x47')](_0x110056,function(_0x3d6c24){if(_['includes']([_0x5300('0x48'),_0x5300('0x49')],_0x3d6c24['type'])&&_0x3d6c24[_0x5300('0x4a')]){_0x5bab1b[_0x3d6c24[_0x5300('0x4a')]]=_0x3d6c24[_0x5300('0x4b')]['toString']();}else if(_0x3d6c24['type']===_0x5300('0x4c')&&_0x3d6c24[_0x5300('0x4d')]&&_0x3d6c24['idField']){_0x5193e2[_0x3d6c24[_0x5300('0x4d')]]&&(_0x5bab1b[_0x3d6c24['idField']]=_0x5193e2[_0x3d6c24['variableName']][_0x5300('0x4e')]());}else if(_0x3d6c24[_0x5300('0x4f')]==='customVariable'&&_0x3d6c24[_0x5300('0x50')]&&_0x3d6c24[_0x5300('0x50')][_0x5300('0x51')]&&_0x3d6c24[_0x5300('0x4a')]){_0x5193e2[_0x3d6c24[_0x5300('0x50')]['name'][_0x5300('0x3d')]()]&&(_0x5bab1b[_0x3d6c24[_0x5300('0x4a')]]=_0x5193e2[_0x3d6c24[_0x5300('0x50')][_0x5300('0x51')][_0x5300('0x3d')]()]['toString']());}});}return _0x5bab1b;}function getConnection(_0x276205){var _0x1c1eb4=_0x276205[_0x5300('0x52')][_0x5300('0x53')](_0x276205['securityToken']);var _0x70b980=new jsforce[(_0x5300('0x54'))]({'oauth2':{'loginUrl':_0x276205[_0x5300('0x55')]||_0x5300('0x56'),'clientId':_0x276205[_0x5300('0x57')],'clientSecret':_0x276205[_0x5300('0x58')]}});return _0x70b980[_0x5300('0x59')](_0x276205[_0x5300('0x5a')],_0x1c1eb4)[_0x5300('0x26')](function(){logger[_0x5300('0x1f')](_0x5300('0x5b'));return _0x70b980;});}exports[_0x5300('0x5c')]=function(_0x2012bd,_0x3ec3fb,_0x37d27d,_0x4b9cf4,_0x538e0e,_0x3a0993){var _0x280cf6,_0x12a7c9,_0x42145c,_0x4dcb1c;_0x3a0993['serverUrl']=intUtil['stripTrailingSlash'](_0x3a0993[_0x5300('0x5d')]);_0x3a0993[_0x5300('0x55')]=intUtil[_0x5300('0x5e')](_0x3a0993['remoteUri']);if(_0x538e0e&&_0x538e0e[_0x5300('0x5f')]){logger[_0x5300('0x1f')]('[QUEUE]',_0x5300('0x60'));_0x3ec3fb[_0x5300('0x61')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3a0993[_0x5300('0x5d')],_0x3ec3fb[_0x5300('0x62')],md5(_0x3ec3fb[_0x5300('0x62')]));}else{_0x3ec3fb['recordingURL']='';}return getConnection(_0x3a0993)['then'](function(_0x24c0cc){_0x4dcb1c=_0x24c0cc;return getUser(_0x3a0993,_0x4b9cf4[_0x5300('0x63')],_0x4dcb1c);})[_0x5300('0x26')](function(_0x1b587d){_0x280cf6=_0x1b587d;return getEndUser(_0x3a0993,_0x37d27d,_0x3ec3fb[_0x5300('0x64')],_0x3ec3fb[_0x5300('0x65')],_0x4dcb1c);})[_0x5300('0x26')](function(_0x431b3a){_0x12a7c9=_0x431b3a;return getTicket(_0x3a0993,_0x280cf6,_0x12a7c9,_0x37d27d,_0x3ec3fb,_0x37d27d[_0x5300('0x66')],_0x4dcb1c,'queue');})['then'](function(_0x49be73){_0x42145c=_0x49be73;logger[_0x5300('0x1f')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x42145c['id']);logger[_0x5300('0x1f')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x42145c['id'],_0x4b9cf4[_0x5300('0x51')],_0x3a0993[_0x5300('0x4f')]);switch(_0x3a0993[_0x5300('0x4f')]){case _0x5300('0x67'):emit(util[_0x5300('0x45')](_0x5300('0x68'),_0x4b9cf4[_0x5300('0x51')]),_0x5300('0x69'),{'recordId':_0x42145c['id']});break;case _0x5300('0x6a'):emit(util['format'](_0x5300('0x68'),_0x4b9cf4[_0x5300('0x51')]),_0x5300('0x6b'),{'uri':util['format'](_0x5300('0x6c'),_0x4dcb1c[_0x5300('0x6d')],_0x42145c['id'])});break;default:logger[_0x5300('0x6e')](_0x5300('0x6f'));}})[_0x5300('0x70')](function(_0x13a568){logger[_0x5300('0x6e')]('[QUEUE]',_0x13a568);});};exports[_0x5300('0x71')]=function(_0xbe2770,_0x24fe1e,_0x205bae,_0x196ea1,_0xfa2b79,_0x5116f4,_0x1d0e6a){var _0x40582b,_0x348f6d,_0x756940,_0x11acae;_0x5116f4['serverUrl']=intUtil['stripTrailingSlash'](_0x5116f4['serverUrl']);_0x5116f4[_0x5300('0x55')]=intUtil[_0x5300('0x5e')](_0x5116f4[_0x5300('0x55')]);if(_0x1d0e6a&&_0x1d0e6a[_0x5300('0x72')]&&_0x1d0e6a[_0x5300('0x72')]!==_0x5300('0x73')){logger[_0x5300('0x1f')](_0x5300('0x74'),_0x5300('0x60'));_0x24fe1e[_0x5300('0x61')]=util[_0x5300('0x45')](_0x5300('0x75'),_0x5116f4[_0x5300('0x5d')],_0x24fe1e[_0x5300('0x62')],md5(_0x24fe1e['uniqueid']));}return getConnection(_0x5116f4)[_0x5300('0x26')](function(_0x3d0328){_0x11acae=_0x3d0328;return getUser(_0x5116f4,_0x196ea1[_0x5300('0x63')],_0x11acae);})[_0x5300('0x26')](function(_0x1106f0){_0x40582b=_0x1106f0;return getEndUser(_0x5116f4,_0x205bae,_0x24fe1e[_0x5300('0x76')],_0x24fe1e[_0x5300('0x77')],_0x11acae);})[_0x5300('0x26')](function(_0x853ce1){_0x348f6d=_0x853ce1;return getTicket(_0x5116f4,_0x40582b,_0x348f6d,_0x205bae,_0x24fe1e,_0x205bae[_0x5300('0x66')],_0x11acae,'outbound');})[_0x5300('0x26')](function(_0x1e477d){_0x756940=_0x1e477d;logger[_0x5300('0x1f')](_0x5300('0x78'),_0x756940['id']);logger[_0x5300('0x1f')](_0x5300('0x79'),_0x756940['id'],_0x196ea1[_0x5300('0x51')],_0x5116f4[_0x5300('0x4f')]);switch(_0x5116f4[_0x5300('0x4f')]){case _0x5300('0x67'):emit(util[_0x5300('0x45')](_0x5300('0x68'),_0x196ea1[_0x5300('0x51')]),_0x5300('0x69'),{'recordId':_0x756940['id']});break;case _0x5300('0x6a'):emit(util[_0x5300('0x45')](_0x5300('0x68'),_0x196ea1[_0x5300('0x51')]),_0x5300('0x6b'),{'uri':util[_0x5300('0x45')](_0x5300('0x6c'),_0x11acae[_0x5300('0x6d')],_0x756940['id'])});break;default:logger[_0x5300('0x6e')](_0x5300('0x74'),_0x5300('0x7a'));}})[_0x5300('0x70')](function(_0x481cee){logger[_0x5300('0x6e')](_0x5300('0x74'),_0x481cee);});};exports[_0x5300('0x7b')]=function(_0x1c3cb1,_0x7a72fb,_0x4ff900,_0x1b7782,_0x266871,_0x133447){var _0x292437,_0x32e407,_0x478279,_0x4c0bec;_0x133447[_0x5300('0x5d')]=intUtil['stripTrailingSlash'](_0x133447['serverUrl']);_0x133447['remoteUri']=intUtil[_0x5300('0x5e')](_0x133447[_0x5300('0x55')]);if(_0x266871&&_0x266871[_0x5300('0x5f')]){logger[_0x5300('0x1f')]('['+_0x7a72fb['lastevent'][_0x5300('0x7c')]()+']',_0x5300('0x60'));_0x7a72fb[_0x5300('0x61')]=util[_0x5300('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x133447[_0x5300('0x5d')],_0x7a72fb['uniqueid'],md5(_0x7a72fb[_0x5300('0x62')]));}else{_0x7a72fb[_0x5300('0x61')]='';}return getConnection(_0x133447)[_0x5300('0x26')](function(_0x1b1fc0){_0x4c0bec=_0x1b1fc0;if(!_[_0x5300('0x22')](_0x1b7782)){return getUser(_0x133447,_0x1b7782[_0x5300('0x51')],_0x4c0bec);}else{return getUser(_0x133447,null,_0x4c0bec);}})['then'](function(_0x2bc413){_0x292437=_0x2bc413;return getEndUser(_0x133447,_0x4ff900,_0x7a72fb[_0x5300('0x64')],_0x7a72fb['calleridnum'],_0x4c0bec);})[_0x5300('0x26')](function(_0x1077c0){_0x32e407=_0x1077c0;return getTicket(_0x133447,_0x292437,_0x32e407,_0x4ff900,_0x7a72fb,_0x4ff900[_0x5300('0x66')],_0x4c0bec);})[_0x5300('0x26')](function(_0x2d9b9d){_0x478279=_0x2d9b9d;logger[_0x5300('0x1f')]('['+_0x7a72fb[_0x5300('0x7d')][_0x5300('0x7c')]()+_0x5300('0x7e'),_0x478279['id']);logger[_0x5300('0x1f')]('['+_0x7a72fb[_0x5300('0x7d')][_0x5300('0x7c')]()+_0x5300('0x7f'),_0x133447[_0x5300('0x4f')]);})[_0x5300('0x70')](function(_0x13caa0){logger['error']('['+_0x7a72fb[_0x5300('0x7d')][_0x5300('0x7c')]()+']',_0x13caa0);});}; \ No newline at end of file +var _0x97dd=['Email','Agent\x20%s\x20found.','resolve','user_id','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','contact_lead','additionalSearchContact','$or','Contact','length','cloneDeep','additionalSearchLead','merge','Lead','account_contact_lead','Account','additionalSearchAccount','first','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Company','','Caller\x20-\x20%s','upperFirst','forEach','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','[OUTBOUND]','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','jsforce','util','./util','../../../../config/logger','redis','localhost','socket.io-emitter','emit','assign','getString','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','endUserType','contact','lead','account','WhatId','Case','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','execute','then','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x97dd,0x157));var _0xd97d=function(_0x55a8e1,_0x55cda7){_0x55a8e1=_0x55a8e1-0x0;var _0x402dc2=_0x97dd[_0x55a8e1];return _0x402dc2;};'use strict';var _=require(_0xd97d('0x0'));var rp=require('request-promise');var moment=require(_0xd97d('0x1'));var BPromise=require(_0xd97d('0x2'));var md5=require('md5');var jsforce=require(_0xd97d('0x3'));var util=require(_0xd97d('0x4'));var Redis=require('ioredis');var intUtil=require(_0xd97d('0x5'));var config=require('../../../../config/environment');var logger=require(_0xd97d('0x6'))('salesforce');config['redis']=_['defaults'](config[_0xd97d('0x7')],{'host':_0xd97d('0x8'),'port':0x18eb});var io=require(_0xd97d('0x9'))(new Redis(config[_0xd97d('0x7')]));function emit(_0x86e4ac,_0x280b14,_0x662dc9){io['to'](_0x86e4ac)[_0xd97d('0xa')](_0x280b14,_0x662dc9);}function getTicket(_0x35b226,_0x121ed5,_0x4d3604,_0x18a2cf,_0x34c819,_0x20f941,_0x436e81,_0xbfc790){var _0x109ac1=Object[_0xd97d('0xb')]({},{'OwnerId':_0x121ed5['id'],'Subject':intUtil[_0xd97d('0xc')](_0x18a2cf['Subjects'],_0x34c819,'\x20'),'Description':intUtil[_0xd97d('0xc')](_0x18a2cf[_0xd97d('0xd')],_0x34c819,'\x0a')},getCustomFields(_0x20f941,_0x34c819));if(_0x4d3604){if(_0x18a2cf[_0xd97d('0xe')]==='Task'){_0x109ac1[_0xd97d('0xf')]=moment[_0xd97d('0x10')]();_0x109ac1[_0xd97d('0x11')]=![];_0x109ac1['IsRecurrence']=![];if(_0x4d3604[_0xd97d('0x12')]===_0xd97d('0x13')||_0x4d3604[_0xd97d('0x12')]===_0xd97d('0x14')){_0x109ac1['WhoId']=_0x4d3604['id'];}else if(_0x4d3604[_0xd97d('0x12')]===_0xd97d('0x15')){_0x109ac1[_0xd97d('0x16')]=_0x4d3604['id'];}}else if(_0x18a2cf[_0xd97d('0xe')]===_0xd97d('0x17')){if(_0x4d3604[_0xd97d('0x12')]===_0xd97d('0x13')){_0x109ac1['ContactId']=_0x4d3604['id'];}else if(_0x4d3604[_0xd97d('0x12')]===_0xd97d('0x15')){_0x109ac1[_0xd97d('0x18')]=_0x4d3604['id'];}else if(_0x4d3604['endUserType']==='lead'&&_0x18a2cf[_0xd97d('0x19')]){_0x109ac1[_0x18a2cf[_0xd97d('0x19')]]=_0x4d3604['id'];}else{logger[_0xd97d('0x1a')](_0xd97d('0x1b'));}}}return _0x436e81[_0xd97d('0x1c')](_0x18a2cf[_0xd97d('0xe')])[_0xd97d('0x1d')](_0x109ac1);}function getUser(_0x47cc27,_0x5f28e7,_0x763639){if(!_[_0xd97d('0x1e')](_0x5f28e7)&&intUtil[_0xd97d('0x1f')](_0x5f28e7)){var _0x448266={'Email':_0x5f28e7};var _0x353b90={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x763639['sobject']('User')['find'](_0x448266,_0x353b90)[_0xd97d('0x20')]()[_0xd97d('0x21')](function(_0x4e78d7){if(_0x4e78d7['length']){var _0x479dbc=_[_0xd97d('0x22')](_0x4e78d7,function(_0x2727da){return _0x2727da[_0xd97d('0x23')]===_0x5f28e7;});if(_0x479dbc){logger[_0xd97d('0x1a')](_0xd97d('0x24'),_0x5f28e7);return BPromise[_0xd97d('0x25')]({'id':_0x479dbc['Id'],'name':_0x479dbc['Name']});}}else{logger[_0xd97d('0x1a')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x5f28e7);return _0x763639['identity']()[_0xd97d('0x21')](function(_0x3972cd){return BPromise[_0xd97d('0x25')]({'id':_0x3972cd[_0xd97d('0x26')],'name':_0x3972cd['display_name']});});}});}else{logger['info'](_0xd97d('0x27'),_0x5f28e7);return _0x763639[_0xd97d('0x28')]()[_0xd97d('0x21')](function(_0x5b088d){return BPromise[_0xd97d('0x25')]({'id':_0x5b088d[_0xd97d('0x26')],'name':_0x5b088d[_0xd97d('0x29')]});});}}function getEndUser(_0x4ad017,_0x1007f5,_0x180b46,_0x1857ff,_0x5496a6){var _0x356ed5={'$or':{'Phone':_0x1857ff}};var _0x4e7a1a={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xd97d('0x25')]()[_0xd97d('0x21')](function(){logger[_0xd97d('0x1a')](_0xd97d('0x2a'),_0x1857ff,_0x1007f5['moduleSearch']);switch(_0x1007f5['moduleSearch']){case _0xd97d('0x2b'):var _0x724290=_['cloneDeep'](_0x356ed5);if(_0x1007f5[_0xd97d('0x2c')]){var _0x1f36ee={};_0x1f36ee[_0x1007f5[_0xd97d('0x2c')]]=_0x1857ff;_['merge'](_0x724290[_0xd97d('0x2d')],_0x1f36ee);}return _0x5496a6['sobject'](_0xd97d('0x2e'))['find'](_0x724290,_0x4e7a1a)['execute']()[_0xd97d('0x21')](function(_0x4c9a4a){if(_0x4c9a4a&&_0x4c9a4a[_0xd97d('0x2f')]){return _0x4c9a4a;}else{var _0x154981=_[_0xd97d('0x30')](_0x356ed5);if(_0x1007f5[_0xd97d('0x31')]){var _0x331123={};_0x331123[_0x1007f5[_0xd97d('0x31')]]=_0x1857ff;_[_0xd97d('0x32')](_0x154981[_0xd97d('0x2d')],_0x331123);}return _0x5496a6['sobject'](_0xd97d('0x33'))[_0xd97d('0x22')](_0x154981,_0x4e7a1a);}});case _0xd97d('0x34'):var _0x151306=_['cloneDeep'](_0x356ed5);if(_0x1007f5['additionalSearchAccount']){var _0x1f36ee={};_0x1f36ee[_0x1007f5['additionalSearchAccount']]=_0x1857ff;_[_0xd97d('0x32')](_0x151306['$or'],_0x1f36ee);}return _0x5496a6[_0xd97d('0x1c')](_0xd97d('0x35'))[_0xd97d('0x22')](_0x151306,_0x4e7a1a)[_0xd97d('0x20')]()['then'](function(_0x32c0a){if(_0x32c0a&&_0x32c0a[_0xd97d('0x2f')]){return _0x32c0a;}else{var _0x1d04ba=_['cloneDeep'](_0x356ed5);if(_0x1007f5[_0xd97d('0x2c')]){var _0x2f8965={};_0x2f8965[_0x1007f5[_0xd97d('0x2c')]]=_0x1857ff;_['merge'](_0x1d04ba[_0xd97d('0x2d')],_0x2f8965);}return _0x5496a6['sobject'](_0xd97d('0x2e'))[_0xd97d('0x22')](_0x1d04ba,_0x4e7a1a)[_0xd97d('0x21')](function(_0x3b121f){if(_0x3b121f&&_0x3b121f[_0xd97d('0x2f')]){return _0x3b121f;}else{var _0xdce732=_[_0xd97d('0x30')](_0x356ed5);if(_0x1007f5[_0xd97d('0x31')]){var _0x1b764f={};_0x1b764f[_0x1007f5[_0xd97d('0x31')]]=_0x1857ff;_[_0xd97d('0x32')](_0xdce732['$or'],_0x1b764f);}return _0x5496a6[_0xd97d('0x1c')](_0xd97d('0x33'))[_0xd97d('0x22')](_0xdce732,_0x4e7a1a);}});}});case'contact':var _0x724290=_[_0xd97d('0x30')](_0x356ed5);if(_0x1007f5['additionalSearchContact']){var _0x1f36ee={};_0x1f36ee[_0x1007f5['additionalSearchContact']]=_0x1857ff;_['merge'](_0x724290[_0xd97d('0x2d')],_0x1f36ee);}return _0x5496a6['sobject'](_0xd97d('0x2e'))['find'](_0x724290,_0x4e7a1a)[_0xd97d('0x20')]();case _0xd97d('0x14'):var _0x4a3fea=_['cloneDeep'](_0x356ed5);if(_0x1007f5[_0xd97d('0x31')]){var _0x1f36ee={};_0x1f36ee[_0x1007f5['additionalSearchLead']]=_0x1857ff;_[_0xd97d('0x32')](_0x4a3fea[_0xd97d('0x2d')],_0x1f36ee);}return _0x5496a6[_0xd97d('0x1c')](_0xd97d('0x33'))['find'](_0x4a3fea,_0x4e7a1a);case _0xd97d('0x15'):var _0x151306=_['cloneDeep'](_0x356ed5);if(_0x1007f5[_0xd97d('0x36')]){var _0x1f36ee={};_0x1f36ee[_0x1007f5[_0xd97d('0x36')]]=_0x1857ff;_['merge'](_0x151306[_0xd97d('0x2d')],_0x1f36ee);}return _0x5496a6[_0xd97d('0x1c')](_0xd97d('0x35'))[_0xd97d('0x22')](_0x151306,_0x4e7a1a);default:return null;}})[_0xd97d('0x21')](function(_0x2ba8b1){if(_0x2ba8b1&&_0x2ba8b1['length']){var _0x3f2d54=_[_0xd97d('0x37')](_0x2ba8b1);if(_0x3f2d54){return BPromise[_0xd97d('0x25')]({'id':_0x3f2d54['Id'],'name':_0x3f2d54[_0xd97d('0x38')],'phone':_0x3f2d54[_0xd97d('0x39')],'endUserType':_0x3f2d54[_0xd97d('0x3a')][_0xd97d('0x3b')][_0xd97d('0x3c')]()});}}})[_0xd97d('0x21')](function(_0x2352e1){if(_0x2352e1){logger['info'](_0xd97d('0x3d'),_0x2352e1[_0xd97d('0x12')],_0x1857ff);return BPromise[_0xd97d('0x25')](_0x2352e1);}else{logger[_0xd97d('0x1a')](_0xd97d('0x3e'),_0x1857ff);var _0x1e93b4={'Phone':_0x1857ff};if(_0x1007f5[_0xd97d('0x3f')]){if(_0x1007f5['moduleCreate']===_0xd97d('0x13')){logger[_0xd97d('0x1a')](_0xd97d('0x40'),_0x1857ff,_0x1007f5['moduleCreate']);_0x1e93b4[_0xd97d('0x41')]=_0x180b46!==''?_0x180b46:util[_0xd97d('0x42')]('Caller\x20-\x20%s',_0x1857ff);}else if(_0x1007f5[_0xd97d('0x3f')]==='lead'){logger[_0xd97d('0x1a')](_0xd97d('0x40'),_0x1857ff,_0x1007f5['moduleCreate']);_0x1e93b4[_0xd97d('0x41')]=_0x180b46!==''?_0x180b46:util[_0xd97d('0x42')]('Caller\x20-\x20%s',_0x1857ff);_0x1e93b4[_0xd97d('0x43')]='No\x20Company';}else if(_0x1007f5['moduleCreate']===_0xd97d('0x15')){logger[_0xd97d('0x1a')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x1857ff,_0x1007f5[_0xd97d('0x3f')]);_0x1e93b4[_0xd97d('0x38')]=_0x180b46!==_0xd97d('0x44')?_0x180b46:util[_0xd97d('0x42')](_0xd97d('0x45'),_0x1857ff);}else{return null;}}return _0x5496a6[_0xd97d('0x1c')](_[_0xd97d('0x46')](_0x1007f5[_0xd97d('0x3f')]))[_0xd97d('0x1d')](_0x1e93b4)[_0xd97d('0x21')](function(_0x503524){return BPromise[_0xd97d('0x25')]({'id':_0x503524['id'],'endUserType':_0x1007f5[_0xd97d('0x3f')]});});}});}function getCustomFields(_0xea22dc,_0x335fce){var _0x7e7ecd={};if(_0xea22dc[_0xd97d('0x2f')]>0x0){_[_0xd97d('0x47')](_0xea22dc,function(_0x2fabf9){if(_['includes']([_0xd97d('0x48'),_0xd97d('0x49')],_0x2fabf9['type'])&&_0x2fabf9['idField']){_0x7e7ecd[_0x2fabf9[_0xd97d('0x4a')]]=_0x2fabf9[_0xd97d('0x4b')][_0xd97d('0x4c')]();}else if(_0x2fabf9[_0xd97d('0x3b')]===_0xd97d('0x4d')&&_0x2fabf9[_0xd97d('0x4e')]&&_0x2fabf9[_0xd97d('0x4a')]){_0x335fce[_0x2fabf9[_0xd97d('0x4e')]]&&(_0x7e7ecd[_0x2fabf9[_0xd97d('0x4a')]]=_0x335fce[_0x2fabf9[_0xd97d('0x4e')]]['toString']());}else if(_0x2fabf9[_0xd97d('0x3b')]===_0xd97d('0x4f')&&_0x2fabf9[_0xd97d('0x50')]&&_0x2fabf9[_0xd97d('0x50')][_0xd97d('0x51')]&&_0x2fabf9[_0xd97d('0x4a')]){_0x335fce[_0x2fabf9[_0xd97d('0x50')][_0xd97d('0x51')][_0xd97d('0x3c')]()]&&(_0x7e7ecd[_0x2fabf9['idField']]=_0x335fce[_0x2fabf9['Variable'][_0xd97d('0x51')][_0xd97d('0x3c')]()][_0xd97d('0x4c')]());}});}return _0x7e7ecd;}function getConnection(_0x59b0c0){var _0x76012=_0x59b0c0['password']['concat'](_0x59b0c0[_0xd97d('0x52')]);var _0x21c706=new jsforce[(_0xd97d('0x53'))]({'oauth2':{'loginUrl':_0x59b0c0[_0xd97d('0x54')]||_0xd97d('0x55'),'clientId':_0x59b0c0[_0xd97d('0x56')],'clientSecret':_0x59b0c0[_0xd97d('0x57')]}});return _0x21c706[_0xd97d('0x58')](_0x59b0c0[_0xd97d('0x59')],_0x76012)[_0xd97d('0x21')](function(){logger[_0xd97d('0x1a')](_0xd97d('0x5a'));return _0x21c706;});}exports[_0xd97d('0x5b')]=function(_0x213435,_0x42f0d1,_0x49573f,_0x2a9b99,_0xf7f0f,_0xdee7b1){var _0x30b2b1,_0x19c380,_0x225da1,_0x2e9403;_0xdee7b1[_0xd97d('0x5c')]=intUtil[_0xd97d('0x5d')](_0xdee7b1[_0xd97d('0x5c')]);_0xdee7b1[_0xd97d('0x54')]=intUtil[_0xd97d('0x5d')](_0xdee7b1[_0xd97d('0x54')]);if(_0xf7f0f&&_0xf7f0f[_0xd97d('0x5e')]){logger[_0xd97d('0x1a')](_0xd97d('0x5f'),_0xd97d('0x60'));_0x42f0d1[_0xd97d('0x61')]=util[_0xd97d('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xdee7b1[_0xd97d('0x5c')],_0x42f0d1[_0xd97d('0x62')],md5(_0x42f0d1[_0xd97d('0x62')]));}else{_0x42f0d1[_0xd97d('0x61')]='';}return getConnection(_0xdee7b1)[_0xd97d('0x21')](function(_0x247487){_0x2e9403=_0x247487;return getUser(_0xdee7b1,_0x2a9b99[_0xd97d('0x63')],_0x2e9403);})[_0xd97d('0x21')](function(_0x1cd07c){_0x30b2b1=_0x1cd07c;return getEndUser(_0xdee7b1,_0x49573f,_0x42f0d1[_0xd97d('0x64')],_0x42f0d1[_0xd97d('0x65')],_0x2e9403);})[_0xd97d('0x21')](function(_0x47a592){_0x19c380=_0x47a592;return getTicket(_0xdee7b1,_0x30b2b1,_0x19c380,_0x49573f,_0x42f0d1,_0x49573f[_0xd97d('0x66')],_0x2e9403,_0xd97d('0x5b'));})[_0xd97d('0x21')](function(_0x17aaef){_0x225da1=_0x17aaef;logger['info'](_0xd97d('0x67'),_0x225da1['id']);logger[_0xd97d('0x1a')](_0xd97d('0x68'),_0x225da1['id'],_0x2a9b99['name'],_0xdee7b1[_0xd97d('0x3b')]);switch(_0xdee7b1['type']){case _0xd97d('0x69'):emit(util[_0xd97d('0x42')](_0xd97d('0x6a'),_0x2a9b99[_0xd97d('0x51')]),_0xd97d('0x6b'),{'recordId':_0x225da1['id']});break;case _0xd97d('0x6c'):emit(util[_0xd97d('0x42')](_0xd97d('0x6a'),_0x2a9b99[_0xd97d('0x51')]),_0xd97d('0x6d'),{'uri':util[_0xd97d('0x42')](_0xd97d('0x6e'),_0x2e9403[_0xd97d('0x6f')],_0x225da1['id'])});break;default:logger[_0xd97d('0x70')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xd97d('0x71')](function(_0x38f506){logger[_0xd97d('0x70')](_0xd97d('0x5f'),_0x38f506);});};exports[_0xd97d('0x72')]=function(_0x30bbd,_0x1adbb2,_0x13718c,_0x43d4f9,_0x740922,_0x47e1e5,_0x207f48){var _0x40ff97,_0x186580,_0x2f4993,_0x18f1b7;_0x47e1e5[_0xd97d('0x5c')]=intUtil[_0xd97d('0x5d')](_0x47e1e5[_0xd97d('0x5c')]);_0x47e1e5[_0xd97d('0x54')]=intUtil[_0xd97d('0x5d')](_0x47e1e5[_0xd97d('0x54')]);if(_0x207f48&&_0x207f48[_0xd97d('0x73')]&&_0x207f48['recordingFormat']!==_0xd97d('0x74')){logger[_0xd97d('0x1a')]('[OUTBOUND]',_0xd97d('0x60'));_0x1adbb2[_0xd97d('0x61')]=util[_0xd97d('0x42')](_0xd97d('0x75'),_0x47e1e5[_0xd97d('0x5c')],_0x1adbb2[_0xd97d('0x62')],md5(_0x1adbb2[_0xd97d('0x62')]));}return getConnection(_0x47e1e5)[_0xd97d('0x21')](function(_0x40640e){_0x18f1b7=_0x40640e;return getUser(_0x47e1e5,_0x43d4f9[_0xd97d('0x63')],_0x18f1b7);})['then'](function(_0x188d5){_0x40ff97=_0x188d5;return getEndUser(_0x47e1e5,_0x13718c,_0x1adbb2[_0xd97d('0x76')],_0x1adbb2['destcalleridnum'],_0x18f1b7);})[_0xd97d('0x21')](function(_0x14a7cc){_0x186580=_0x14a7cc;return getTicket(_0x47e1e5,_0x40ff97,_0x186580,_0x13718c,_0x1adbb2,_0x13718c['Fields'],_0x18f1b7,_0xd97d('0x72'));})[_0xd97d('0x21')](function(_0x24945e){_0x2f4993=_0x24945e;logger[_0xd97d('0x1a')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x2f4993['id']);logger['info'](_0xd97d('0x77'),_0x2f4993['id'],_0x43d4f9['name'],_0x47e1e5['type']);switch(_0x47e1e5['type']){case'integrationTab':emit(util['format'](_0xd97d('0x6a'),_0x43d4f9['name']),_0xd97d('0x6b'),{'recordId':_0x2f4993['id']});break;case _0xd97d('0x6c'):emit(util['format'](_0xd97d('0x6a'),_0x43d4f9['name']),'trigger:browser:url',{'uri':util[_0xd97d('0x42')](_0xd97d('0x6e'),_0x18f1b7[_0xd97d('0x6f')],_0x2f4993['id'])});break;default:logger[_0xd97d('0x70')]('[OUTBOUND]',_0xd97d('0x78'));}})[_0xd97d('0x71')](function(_0x376f46){logger[_0xd97d('0x70')](_0xd97d('0x79'),_0x376f46);});};exports['unmanaged']=function(_0x2c7ea6,_0x226d8c,_0x3f19ff,_0x10b45a,_0x46582c,_0x2ca756){var _0x9c7f8d,_0x121eef,_0x28f2b0,_0x4db3cc;_0x2ca756[_0xd97d('0x5c')]=intUtil[_0xd97d('0x5d')](_0x2ca756[_0xd97d('0x5c')]);_0x2ca756[_0xd97d('0x54')]=intUtil[_0xd97d('0x5d')](_0x2ca756['remoteUri']);if(_0x46582c&&_0x46582c[_0xd97d('0x5e')]){logger['info']('['+_0x226d8c[_0xd97d('0x7a')][_0xd97d('0x7b')]()+']',_0xd97d('0x60'));_0x226d8c[_0xd97d('0x61')]=util['format'](_0xd97d('0x75'),_0x2ca756[_0xd97d('0x5c')],_0x226d8c[_0xd97d('0x62')],md5(_0x226d8c[_0xd97d('0x62')]));}else{_0x226d8c['recordingURL']='';}return getConnection(_0x2ca756)['then'](function(_0x2bc054){_0x4db3cc=_0x2bc054;if(!_[_0xd97d('0x1e')](_0x10b45a)){return getUser(_0x2ca756,_0x10b45a['name'],_0x4db3cc);}else{return getUser(_0x2ca756,null,_0x4db3cc);}})[_0xd97d('0x21')](function(_0x37acd0){_0x9c7f8d=_0x37acd0;return getEndUser(_0x2ca756,_0x3f19ff,_0x226d8c['calleridname'],_0x226d8c[_0xd97d('0x65')],_0x4db3cc);})[_0xd97d('0x21')](function(_0x3ede9d){_0x121eef=_0x3ede9d;return getTicket(_0x2ca756,_0x9c7f8d,_0x121eef,_0x3f19ff,_0x226d8c,_0x3f19ff[_0xd97d('0x66')],_0x4db3cc);})['then'](function(_0x1e3192){_0x28f2b0=_0x1e3192;logger[_0xd97d('0x1a')]('['+_0x226d8c[_0xd97d('0x7a')][_0xd97d('0x7b')]()+_0xd97d('0x7c'),_0x28f2b0['id']);logger[_0xd97d('0x1a')]('['+_0x226d8c[_0xd97d('0x7a')][_0xd97d('0x7b')]()+_0xd97d('0x7d'),_0x2ca756[_0xd97d('0x3b')]);})[_0xd97d('0x71')](function(_0x2e92b0){logger[_0xd97d('0x70')]('['+_0x226d8c[_0xd97d('0x7a')][_0xd97d('0x7b')]()+']',_0x2e92b0);});}; \ 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 8bfca1b..309cada 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 _0x474d=['sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','active','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','endUserId','catch','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','includes','string','picklist','type','nameField','content','idField','toLowerCase','toString','variable','variableName','customVariable','Variable','name','customField',']\x20getTicket\x20input\x20crm','assign','getString','Subjects',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','incident','Incident','ticketId','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','trigger:browser:url','username','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','sys_id','info','error','toUpperCase','message','validateEmail','userEmail'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x474d,0xbf));var _0xd474=function(_0x45241a,_0x302576){_0x45241a=_0x45241a-0x0;var _0x436239=_0x474d[_0x45241a];return _0x436239;};'use strict';var _=require(_0xd474('0x0'));var Promise=require('bluebird');var rp=require(_0xd474('0x1'));var util=require(_0xd474('0x2'));var md5=require(_0xd474('0x3'));var Redis=require(_0xd474('0x4'));var intUtil=require('./util');var config=require(_0xd474('0x5'));var logger=require(_0xd474('0x6'))(_0xd474('0x7'));config[_0xd474('0x8')]=_[_0xd474('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd474('0xa'))(new Redis(config['redis']));function getAdminUser(_0x462420,_0x347c2a,_0x47e258,_0x3d40b9,_0x54b134,_0x2cdc46){return new Promise(function(_0x3e4a80,_0x5437e7){var _0x2795de={'method':_0xd474('0xb'),'uri':_0x3d40b9+_0xd474('0xc')+'&'+_0x54b134+'&'+_0x2cdc46,'auth':_0x347c2a,'json':!![]};return rp(_0x2795de)['then'](function(_0x28df73){if(_0x28df73[_0xd474('0xd')][_0xd474('0xe')]>0x0){_0x47e258[_0xd474('0xf')]=_0x28df73['result'][0x0][_0xd474('0x10')];}logger[_0xd474('0x11')]('['+[_0x462420['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x47e258);_0x3e4a80(_0x47e258);})['catch'](function(_0xe3688f){logger[_0xd474('0x12')]('['+[_0x462420[_0xd474('0x13')]()]+']',_0xe3688f[_0xd474('0x14')]);_0x5437e7(_0xe3688f['message']);});});}function getUser(_0x1789ba,_0x34790c,_0x4d69bc,_0xf7bca2,_0x488636){return function(_0x26340d){logger[_0xd474('0x11')]('['+[_0x1789ba[_0xd474('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x26340d);return new Promise(function(_0x44ea70,_0x2518a5){if(intUtil[_0xd474('0x15')](_0x26340d[_0xd474('0x16')])){var _0x57f00a={'method':'GET','uri':_0x4d69bc+_0xd474('0x17')+_0x26340d[_0xd474('0x16')]+'&'+_0xf7bca2+'&'+_0x488636,'auth':_0x34790c,'json':!![]};logger['info']('['+[_0x1789ba[_0xd474('0x13')]()]+_0xd474('0x18'),_0x57f00a);return rp(_0x57f00a)[_0xd474('0x19')](function(_0x24f918){logger['info']('['+[_0x1789ba[_0xd474('0x13')]()]+_0xd474('0x1a'),_0x24f918);if(_0x24f918[_0xd474('0xd')]['length']>0x0&&String(_0x24f918[_0xd474('0xd')][0x0][_0xd474('0x1b')])===_0xd474('0x1c')){_0x26340d[_0xd474('0x1d')]=_0x24f918['result'][0x0][_0xd474('0x10')];}else{_0x26340d[_0xd474('0x1d')]=_0x26340d[_0xd474('0xf')];_0x26340d[_0xd474('0x16')]=_0x26340d['adminEmail'];}logger[_0xd474('0x11')]('['+[_0x1789ba[_0xd474('0x13')]()]+_0xd474('0x1e'),_0x26340d);_0x44ea70(_0x26340d);})['catch'](function(_0x591dd0){logger[_0xd474('0x12')]('['+[_0x1789ba[_0xd474('0x13')]()]+']',_0x591dd0['message']);_0x2518a5(_0x591dd0[_0xd474('0x14')]);});}else{logger['info']('['+[_0x1789ba[_0xd474('0x13')]()]+_0xd474('0x1f'));_0x26340d[_0xd474('0x1d')]=_0x26340d[_0xd474('0xf')];_0x26340d[_0xd474('0x16')]=_0x26340d[_0xd474('0x20')];_0x44ea70(_0x26340d);}});};}function createEndUser(_0x4c00e9,_0x3fa57e,_0x2f211d,_0x24b213,_0xa7dc19){logger['info']('['+[_0x4c00e9[_0xd474('0x13')]()]+_0xd474('0x21'),_0x2f211d);return new Promise(function(_0x18dca2,_0x15ab4b){var _0x4dd1bf={'method':_0xd474('0x22'),'uri':_0x24b213+_0xd474('0x23')+_0xa7dc19,'body':{'user_name':_0x2f211d[_0xd474('0x24')],'roles':_0xd474('0x25'),'first_name':_0x2f211d['endUserNumber'],'active':_0xd474('0x1c'),'date_format':_0xd474('0x26'),'phone':_0x2f211d[_0xd474('0x24')]},'auth':_0x3fa57e,'json':!![]};return rp(_0x4dd1bf)[_0xd474('0x19')](function(_0x52e201){logger[_0xd474('0x11')]('['+[_0x4c00e9[_0xd474('0x13')]()]+'],\x20EndUser\x20schema',_0x52e201[_0xd474('0xd')]);_0x2f211d[_0xd474('0x27')]=_0x52e201['result']['sys_id'];_0x18dca2(_0x2f211d);})[_0xd474('0x28')](function(_0x163e3f){logger[_0xd474('0x12')]('['+[_0x4c00e9[_0xd474('0x13')]()]+']',_0x163e3f[_0xd474('0x14')]);_0x15ab4b(_0x163e3f[_0xd474('0x14')]);});});}function getEndUser(_0x35666c,_0x51664c,_0x74efca,_0x3b25fa,_0x5a1740){return function(_0x2ec174){logger[_0xd474('0x11')]('['+[_0x35666c['toUpperCase']()]+_0xd474('0x29'),_0x2ec174);return new Promise(function(_0x1c5a52,_0x3026a4){var _0x5000d1={'method':_0xd474('0xb'),'uri':_0x74efca+_0xd474('0x2a')+_0x2ec174[_0xd474('0x24')]+'&'+_0x3b25fa+'&'+_0x5a1740,'auth':_0x51664c,'json':!![]};return rp(_0x5000d1)[_0xd474('0x19')](function(_0x4d21d5){if(_0x4d21d5[_0xd474('0xd')]['length']>0x0){_0x2ec174[_0xd474('0x27')]=_0x4d21d5[_0xd474('0xd')][0x0][_0xd474('0x10')];logger[_0xd474('0x11')]('['+[_0x35666c[_0xd474('0x13')]()]+_0xd474('0x2b'),_0x2ec174);_0x1c5a52(_0x2ec174);}else{return createEndUser(_0x35666c,_0x51664c,_0x2ec174,_0x74efca,_0x3b25fa)['then'](function(_0x19b089){logger[_0xd474('0x11')]('['+[_0x35666c['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x19b089);_0x1c5a52(_0x19b089);});}})[_0xd474('0x28')](function(_0x53e665){logger[_0xd474('0x12')]('['+[_0x35666c[_0xd474('0x13')]()]+']',_0x53e665['message']);_0x3026a4(_0x53e665[_0xd474('0x14')]);});});};}function getCustomFields(_0x69c691,_0x25aaca){var _0x1a2b9a={};if(_0x69c691['length']>0x0){_[_0xd474('0x2c')](_0x69c691,function(_0x35e2e0){if(_[_0xd474('0x2d')]([_0xd474('0x2e'),_0xd474('0x2f')],_0x35e2e0[_0xd474('0x30')])&&_0x35e2e0['nameField']&&!_0x35e2e0['customField']){_0x1a2b9a[_0x35e2e0[_0xd474('0x31')]['toLowerCase']()]=_0x35e2e0[_0xd474('0x32')]['toString']();}else if(_['includes'](['string',_0xd474('0x2f')],_0x35e2e0[_0xd474('0x30')])&&_0x35e2e0['idField']&&_0x35e2e0['customField']){_0x1a2b9a[_0x35e2e0[_0xd474('0x33')][_0xd474('0x34')]()]=_0x35e2e0[_0xd474('0x32')][_0xd474('0x35')]();}else if(_0x35e2e0[_0xd474('0x30')]===_0xd474('0x36')&&_0x35e2e0[_0xd474('0x37')]&&_0x35e2e0['idField']&&_0x35e2e0['customField']){_0x1a2b9a[_0x35e2e0[_0xd474('0x33')][_0xd474('0x34')]()]=_0x25aaca[_0x35e2e0[_0xd474('0x37')]]['toString']();}else if(_0x35e2e0['type']===_0xd474('0x38')&&_0x35e2e0[_0xd474('0x39')]&&_0x35e2e0[_0xd474('0x39')][_0xd474('0x3a')]&&_0x35e2e0[_0xd474('0x33')]&&_0x35e2e0[_0xd474('0x3b')]){_0x1a2b9a[_0x35e2e0[_0xd474('0x33')]['toLowerCase']()]=_0x25aaca[_0x35e2e0[_0xd474('0x39')][_0xd474('0x3a')][_0xd474('0x34')]()][_0xd474('0x35')]();}});}return _0x1a2b9a;}function getTicket(_0x1fadb7,_0xd1c480,_0x2c029f,_0x233b2a,_0x439008,_0x5a5eee){return function(_0x15e013){logger[_0xd474('0x11')]('['+[_0x1fadb7[_0xd474('0x13')]()]+_0xd474('0x3c'),_0x15e013);return new Promise(function(_0x4f5da7,_0xd7a5b4){var _0x114ef5=_0x1fadb7[_0xd474('0x34')]()==='outbound'?_0x15e013[_0xd474('0x1d')]:_0x15e013[_0xd474('0x27')];var _0x1c6bad={'method':_0xd474('0x22'),'uri':_0x2c029f+'incident'+'?'+_0x5a5eee,'body':Object[_0xd474('0x3d')]({},{'active':'true','caller_id':_0x114ef5,'assigned_to':_0x15e013[_0xd474('0x1d')],'short_description':intUtil[_0xd474('0x3e')](_0x233b2a[_0xd474('0x3f')],_0x439008,'\x20'),'description':intUtil['getString'](_0x233b2a['Descriptions'],_0x439008,'\x0a')},getCustomFields(_0x233b2a['Fields'],_0x439008)),'auth':_0xd1c480,'json':!![]};return rp(_0x1c6bad)[_0xd474('0x19')](function(_0x719cbb){logger[_0xd474('0x11')]('['+[_0x1fadb7[_0xd474('0x13')]()]+_0xd474('0x40'),_0x719cbb['result']);_0x15e013['ticketId']=_0x719cbb[_0xd474('0xd')][_0xd474('0x10')];_0x15e013[_0xd474('0x41')]=_0x719cbb['result'][_0xd474('0x42')];logger['info']('['+[_0x1fadb7[_0xd474('0x13')]()]+_0xd474('0x43'),_0x15e013);_0x4f5da7(_0x15e013);})[_0xd474('0x28')](function(_0x3b4d05){logger[_0xd474('0x12')]('['+[_0x1fadb7['toUpperCase']()]+']',_0x3b4d05[_0xd474('0x14')]);_0xd7a5b4(_0x3b4d05[_0xd474('0x14')]);});});};}function createRemoteTag(_0x5c7c61,_0x14b723,_0x505634,_0x49df96){return new Promise(function(_0x2939e5,_0x320912){var _0x587fd2={'method':_0xd474('0x22'),'uri':_0x505634+_0xd474('0x44')+'?'+_0x49df96,'body':{'short_description':_0x5c7c61,'global':!![],'active':!![],'name':_0x5c7c61},'auth':_0x14b723,'json':!![]};return rp(_0x587fd2)[_0xd474('0x19')](function(_0x3ba061){var _0x58854a=_0x3ba061[_0xd474('0xd')][_0xd474('0x10')];_0x2939e5(_0x58854a);});});}function getRemoteTag(_0x5dc698,_0x5de253,_0x2e42bb,_0x311b7e,_0x105789){return new Promise(function(_0xcf2b22,_0xe3a54e){var _0x4376c4={'method':_0xd474('0xb'),'uri':_0x2e42bb+_0xd474('0x44')+'?sysparm_query=name%3D'+_0x5dc698+'&'+_0x311b7e,'auth':_0x5de253,'json':!![]};return rp(_0x4376c4)[_0xd474('0x19')](function(_0x255e30){if(_0x255e30[_0xd474('0xd')][_0xd474('0xe')]>0x0){var _0x229edb=_0x255e30[_0xd474('0xd')][0x0][_0xd474('0x10')];_0xcf2b22(_0x229edb);}else{return createRemoteTag(_0x5dc698,_0x5de253,_0x2e42bb,_0x311b7e)[_0xd474('0x19')](function(_0x4b8a9e){_0xcf2b22(_0x4b8a9e);});}});});}function assignTagToIncident(_0x58fbba,_0x41eab9,_0x317d68,_0x35c12d,_0x6238fb){return new Promise(function(_0x20f56f,_0x5b068f){var _0x5b6bfd={'method':_0xd474('0x22'),'uri':_0x317d68+_0xd474('0x45')+'?'+_0x6238fb,'body':{'label':_0x58fbba,'table':_0xd474('0x46'),'id_type':_0xd474('0x47'),'table_key':_0x35c12d[_0xd474('0x48')],'title':_0xd474('0x49')+_0x35c12d[_0xd474('0x41')],'id_display':_0x35c12d[_0xd474('0x41')]},'auth':_0x41eab9,'json':!![]};return rp(_0x5b6bfd)[_0xd474('0x19')](function(_0x28366d){_0x20f56f();})[_0xd474('0x28')](function(){_0x20f56f();});});}function manageTags(_0x39a392,_0x7e84ed,_0x323933,_0x273533,_0x567d2e,_0x5393b3,_0xaf802d){return new Promise(function(_0x30fc3f,_0x2c6d91){var _0x41d094=[];_0x7e84ed[_0xd474('0x2c')](function(_0x34c51c){_0x41d094['push'](getRemoteTag(_0x34c51c,_0x323933,_0x273533,_0x5393b3,_0xaf802d));});return Promise[_0xd474('0x4a')](_0x41d094)[_0xd474('0x19')](function(_0x4be0c9){if(_0x4be0c9['length']){logger[_0xd474('0x11')]('['+[_0x39a392[_0xd474('0x13')]()]+_0xd474('0x4b'),_0x4be0c9);var _0x10637a=[];_0x4be0c9['forEach'](function(_0x514045){_0x10637a[_0xd474('0x4c')](assignTagToIncident(_0x514045,_0x323933,_0x273533,_0x567d2e,_0x5393b3));});return Promise[_0xd474('0x4a')](_0x10637a)[_0xd474('0x19')](function(){_0x30fc3f();})[_0xd474('0x28')](function(){_0x30fc3f();});}else{_0x30fc3f();}});});}function getTags(_0x3c7b18,_0x15bd6e,_0x3e191d,_0x5d4581,_0x1d1995,_0x5e7128){return function(_0x32fcaa){return new Promise(function(_0x12b906,_0x47a586){var _0x3cab11=[];var _0x5e5d6c=_0x5d4581['Tags'];if(_0x5e5d6c&&_0x5e5d6c[_0xd474('0xe')]>0x0){_0x3cab11=_['map'](_0x5e5d6c,_0xd474('0x3a'));}if(_0x3cab11[_0xd474('0xe')]>0x0){return manageTags(_0x3c7b18,_0x3cab11,_0x15bd6e,_0x3e191d,_0x32fcaa,_0x1d1995,_0x5e7128)[_0xd474('0x19')](function(){_0x12b906(_0x32fcaa);});}else{_0x12b906(_0x32fcaa);}});};}function emit(_0x2b7cbd,_0x40ac63,_0x394e08){var _0x563e61='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xd474('0x4d')+_0xd474('0x4e');var _0x3bdff1={'uri':_0x2b7cbd+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x394e08+_0x563e61};io['to'](util['format'](_0xd474('0x4f'),_0x40ac63))['emit'](_0xd474('0x50'),_0x3bdff1);}exports['cs']=function(_0x4478b3,_0x4b736d,_0x2727ac,_0x2501da,_0x1090e7,_0x3776e9,_0x143be1,_0x3de4ad){var _0xefc93f={};var _0x569aab={'user':_0x3776e9[_0xd474('0x51')],'pass':_0x3776e9['password']};var _0x5775c3=_0xd474('0x52');var _0x3a95ee='sysparm_display_value=true';_0x3776e9[_0xd474('0x53')]=intUtil[_0xd474('0x54')](_0x3776e9[_0xd474('0x53')]);_0x3776e9[_0xd474('0x55')]=intUtil[_0xd474('0x54')](_0x3776e9['serverUrl']);var _0x346348=util[_0xd474('0x56')](_0xd474('0x57'),_0x3776e9['remoteUri']);_0xefc93f[_0xd474('0x16')]=!_[_0xd474('0x58')](_0x2501da)?_0x2501da[_0xd474('0x59')]:null;_0xefc93f[_0xd474('0x20')]=_0x3776e9[_0xd474('0x59')];_0xefc93f[_0xd474('0x24')]=_0x3de4ad[_0xd474('0x34')]()===_0xd474('0x5a')?_0x4b736d[_0xd474('0x5b')]:_0x4b736d[_0xd474('0x5c')];_0xefc93f[_0xd474('0x5d')]=_0x3de4ad===_0xd474('0x5e')||_0x3de4ad==='unmanaged'?_0xd474('0x5e'):_0xd474('0x5a');var _0x24d329=util['format'](_0xd474('0x5f'),_0x3776e9[_0xd474('0x55')],_0x4b736d[_0xd474('0x60')],md5(_0x4b736d[_0xd474('0x60')]));if(_0x1090e7&&_0x1090e7['monitor_format']){logger['info'](_0xd474('0x61'),_0xd474('0x62'));_0x4b736d[_0xd474('0x63')]=_0x24d329;}else if(_0x143be1&&_0x143be1['recordingFormat']&&_0x143be1['recordingFormat']!==_0xd474('0x64')){logger['info'](_0xd474('0x65'),_0xd474('0x62'));_0x4b736d['recordingURL']=_0x24d329;}else{_0x4b736d['recordingURL']='';}return getAdminUser(_0x3de4ad,_0x569aab,_0xefc93f,_0x346348,_0x3a95ee,_0x5775c3)['then'](getUser(_0x3de4ad,_0x569aab,_0x346348,_0x3a95ee,_0x5775c3))[_0xd474('0x19')](getEndUser(_0x3de4ad,_0x569aab,_0x346348,_0x3a95ee,_0x5775c3))[_0xd474('0x19')](getTicket(_0x3de4ad,_0x569aab,_0x346348,_0x2727ac,_0x4b736d,_0x3a95ee))[_0xd474('0x19')](function(_0x5118a8){logger[_0xd474('0x11')](util[_0xd474('0x56')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5118a8['ticketId']));logger['info'](util[_0xd474('0x56')](_0xd474('0x66'),_0x3de4ad));if(_0x3de4ad!==_0xd474('0x67')){logger[_0xd474('0x11')]('['+[_0x3de4ad[_0xd474('0x13')]()]+']',_0xd474('0x68'));emit(_0x3776e9['remoteUri'],_0x2501da['name'],_0x5118a8['ticketId']);}})['catch'](function(_0x58dbc0){logger[_0xd474('0x12')]('['+[_0x3de4ad[_0xd474('0x13')]()]+_0xd474('0x69'),util[_0xd474('0x6a')](_0x58dbc0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6ece=['defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','endUserNumber','user','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','variableName','idField','customVariable','name','Variable',']\x20getTicket\x20input\x20crm','POST','incident','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','label_entry','Incident','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','ioredis','../../../../config/environment','../../../../config/logger','redis'];(function(_0x15bb28,_0x9ab4a7){var _0x3bad26=function(_0xefcbb3){while(--_0xefcbb3){_0x15bb28['push'](_0x15bb28['shift']());}};_0x3bad26(++_0x9ab4a7);}(_0x6ece,0x13f));var _0xe6ec=function(_0x58ec65,_0x46445e){_0x58ec65=_0x58ec65-0x0;var _0x7ecd05=_0x6ece[_0x58ec65];return _0x7ecd05;};'use strict';var _=require(_0xe6ec('0x0'));var Promise=require(_0xe6ec('0x1'));var rp=require('request-promise');var util=require(_0xe6ec('0x2'));var md5=require(_0xe6ec('0x3'));var Redis=require(_0xe6ec('0x4'));var intUtil=require('./util');var config=require(_0xe6ec('0x5'));var logger=require(_0xe6ec('0x6'))('servicenow');config[_0xe6ec('0x7')]=_[_0xe6ec('0x8')](config[_0xe6ec('0x7')],{'host':_0xe6ec('0x9'),'port':0x18eb});var io=require(_0xe6ec('0xa'))(new Redis(config[_0xe6ec('0x7')]));function getAdminUser(_0x39740c,_0x34392e,_0x3062ce,_0x412219,_0xd4dd31,_0x1550ef){return new Promise(function(_0x3cefcd,_0x58dd22){var _0x38dd61={'method':_0xe6ec('0xb'),'uri':_0x412219+_0xe6ec('0xc')+'&'+_0xd4dd31+'&'+_0x1550ef,'auth':_0x34392e,'json':!![]};return rp(_0x38dd61)[_0xe6ec('0xd')](function(_0x1171ab){if(_0x1171ab[_0xe6ec('0xe')][_0xe6ec('0xf')]>0x0){_0x3062ce[_0xe6ec('0x10')]=_0x1171ab['result'][0x0][_0xe6ec('0x11')];}logger[_0xe6ec('0x12')]('['+[_0x39740c[_0xe6ec('0x13')]()]+_0xe6ec('0x14'),_0x3062ce);_0x3cefcd(_0x3062ce);})[_0xe6ec('0x15')](function(_0x15f879){logger[_0xe6ec('0x16')]('['+[_0x39740c[_0xe6ec('0x13')]()]+']',_0x15f879[_0xe6ec('0x17')]);_0x58dd22(_0x15f879[_0xe6ec('0x17')]);});});}function getUser(_0x26390c,_0x5cd960,_0x6941cd,_0x22554a,_0x5ce067){return function(_0x37ab98){logger[_0xe6ec('0x12')]('['+[_0x26390c[_0xe6ec('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x37ab98);return new Promise(function(_0x4c2195,_0x3d8bd4){if(intUtil['validateEmail'](_0x37ab98[_0xe6ec('0x18')])){var _0x4347b0={'method':'GET','uri':_0x6941cd+_0xe6ec('0x19')+_0x37ab98[_0xe6ec('0x18')]+'&'+_0x22554a+'&'+_0x5ce067,'auth':_0x5cd960,'json':!![]};logger['info']('['+[_0x26390c[_0xe6ec('0x13')]()]+'],\x20getUser\x20rp\x20obj',_0x4347b0);return rp(_0x4347b0)[_0xe6ec('0xd')](function(_0x6331de){logger['info']('['+[_0x26390c[_0xe6ec('0x13')]()]+_0xe6ec('0x1a'),_0x6331de);if(_0x6331de[_0xe6ec('0xe')][_0xe6ec('0xf')]>0x0&&String(_0x6331de[_0xe6ec('0xe')][0x0][_0xe6ec('0x1b')])===_0xe6ec('0x1c')){_0x37ab98[_0xe6ec('0x1d')]=_0x6331de[_0xe6ec('0xe')][0x0]['sys_id'];}else{_0x37ab98[_0xe6ec('0x1d')]=_0x37ab98[_0xe6ec('0x10')];_0x37ab98[_0xe6ec('0x18')]=_0x37ab98['adminEmail'];}logger[_0xe6ec('0x12')]('['+[_0x26390c['toUpperCase']()]+_0xe6ec('0x1e'),_0x37ab98);_0x4c2195(_0x37ab98);})[_0xe6ec('0x15')](function(_0x3d62e3){logger[_0xe6ec('0x16')]('['+[_0x26390c[_0xe6ec('0x13')]()]+']',_0x3d62e3['message']);_0x3d8bd4(_0x3d62e3[_0xe6ec('0x17')]);});}else{logger[_0xe6ec('0x12')]('['+[_0x26390c['toUpperCase']()]+_0xe6ec('0x1f'));_0x37ab98[_0xe6ec('0x1d')]=_0x37ab98['adminId'];_0x37ab98[_0xe6ec('0x18')]=_0x37ab98[_0xe6ec('0x20')];_0x4c2195(_0x37ab98);}});};}function createEndUser(_0x3cb7ef,_0x50f122,_0x4a3451,_0xc2cc1b,_0xfbadfa){logger[_0xe6ec('0x12')]('['+[_0x3cb7ef[_0xe6ec('0x13')]()]+'],\x20createEndUser\x20input\x20crm',_0x4a3451);return new Promise(function(_0x69b27d,_0x521b06){var _0x1941ce={'method':'POST','uri':_0xc2cc1b+'sys_user?'+_0xfbadfa,'body':{'user_name':_0x4a3451[_0xe6ec('0x21')],'roles':_0xe6ec('0x22'),'first_name':_0x4a3451[_0xe6ec('0x21')],'active':_0xe6ec('0x1c'),'date_format':'System','phone':_0x4a3451['endUserNumber']},'auth':_0x50f122,'json':!![]};return rp(_0x1941ce)[_0xe6ec('0xd')](function(_0x48779e){logger[_0xe6ec('0x12')]('['+[_0x3cb7ef[_0xe6ec('0x13')]()]+'],\x20EndUser\x20schema',_0x48779e[_0xe6ec('0xe')]);_0x4a3451['endUserId']=_0x48779e[_0xe6ec('0xe')][_0xe6ec('0x11')];_0x69b27d(_0x4a3451);})['catch'](function(_0x298044){logger[_0xe6ec('0x16')]('['+[_0x3cb7ef[_0xe6ec('0x13')]()]+']',_0x298044[_0xe6ec('0x17')]);_0x521b06(_0x298044[_0xe6ec('0x17')]);});});}function getEndUser(_0x35f2cb,_0x247f47,_0x550e62,_0x256c23,_0x1dba30){return function(_0x5f1536){logger[_0xe6ec('0x12')]('['+[_0x35f2cb[_0xe6ec('0x13')]()]+_0xe6ec('0x23'),_0x5f1536);return new Promise(function(_0x41e4e6,_0x2e7351){var _0x2ed02b={'method':_0xe6ec('0xb'),'uri':_0x550e62+_0xe6ec('0x24')+_0x5f1536['endUserNumber']+'&'+_0x256c23+'&'+_0x1dba30,'auth':_0x247f47,'json':!![]};return rp(_0x2ed02b)[_0xe6ec('0xd')](function(_0xdb73a){if(_0xdb73a[_0xe6ec('0xe')][_0xe6ec('0xf')]>0x0){_0x5f1536[_0xe6ec('0x25')]=_0xdb73a[_0xe6ec('0xe')][0x0][_0xe6ec('0x11')];logger[_0xe6ec('0x12')]('['+[_0x35f2cb[_0xe6ec('0x13')]()]+_0xe6ec('0x26'),_0x5f1536);_0x41e4e6(_0x5f1536);}else{return createEndUser(_0x35f2cb,_0x247f47,_0x5f1536,_0x550e62,_0x256c23)[_0xe6ec('0xd')](function(_0xbaf03e){logger[_0xe6ec('0x12')]('['+[_0x35f2cb[_0xe6ec('0x13')]()]+'],\x20createEndUser\x20crm',_0xbaf03e);_0x41e4e6(_0xbaf03e);});}})['catch'](function(_0x7e21b0){logger[_0xe6ec('0x16')]('['+[_0x35f2cb[_0xe6ec('0x13')]()]+']',_0x7e21b0[_0xe6ec('0x17')]);_0x2e7351(_0x7e21b0[_0xe6ec('0x17')]);});});};}function getCustomFields(_0x16e288,_0x374031){var _0x549292={};if(_0x16e288[_0xe6ec('0xf')]>0x0){_[_0xe6ec('0x27')](_0x16e288,function(_0x2904ab){if(_[_0xe6ec('0x28')]([_0xe6ec('0x29'),_0xe6ec('0x2a')],_0x2904ab[_0xe6ec('0x2b')])&&_0x2904ab[_0xe6ec('0x2c')]&&!_0x2904ab[_0xe6ec('0x2d')]){_0x549292[_0x2904ab[_0xe6ec('0x2c')][_0xe6ec('0x2e')]()]=_0x2904ab[_0xe6ec('0x2f')][_0xe6ec('0x30')]();}else if(_[_0xe6ec('0x28')]([_0xe6ec('0x29'),_0xe6ec('0x2a')],_0x2904ab[_0xe6ec('0x2b')])&&_0x2904ab['idField']&&_0x2904ab[_0xe6ec('0x2d')]){_0x549292[_0x2904ab['idField'][_0xe6ec('0x2e')]()]=_0x2904ab[_0xe6ec('0x2f')][_0xe6ec('0x30')]();}else if(_0x2904ab[_0xe6ec('0x2b')]==='variable'&&_0x2904ab[_0xe6ec('0x31')]&&_0x2904ab[_0xe6ec('0x32')]&&_0x2904ab[_0xe6ec('0x2d')]){_0x549292[_0x2904ab['idField']['toLowerCase']()]=_0x374031[_0x2904ab[_0xe6ec('0x31')]][_0xe6ec('0x30')]();}else if(_0x2904ab[_0xe6ec('0x2b')]===_0xe6ec('0x33')&&_0x2904ab['Variable']&&_0x2904ab['Variable'][_0xe6ec('0x34')]&&_0x2904ab['idField']&&_0x2904ab['customField']){_0x549292[_0x2904ab[_0xe6ec('0x32')][_0xe6ec('0x2e')]()]=_0x374031[_0x2904ab[_0xe6ec('0x35')][_0xe6ec('0x34')][_0xe6ec('0x2e')]()][_0xe6ec('0x30')]();}});}return _0x549292;}function getTicket(_0x5383da,_0x4afb50,_0x17c68f,_0x468d27,_0x526c01,_0x3e3860){return function(_0x81fa34){logger[_0xe6ec('0x12')]('['+[_0x5383da[_0xe6ec('0x13')]()]+_0xe6ec('0x36'),_0x81fa34);return new Promise(function(_0x97804c,_0x583fcf){var _0x163e87=_0x5383da[_0xe6ec('0x2e')]()==='outbound'?_0x81fa34[_0xe6ec('0x1d')]:_0x81fa34['endUserId'];var _0x3a8117={'method':_0xe6ec('0x37'),'uri':_0x17c68f+_0xe6ec('0x38')+'?'+_0x3e3860,'body':Object[_0xe6ec('0x39')]({},{'active':_0xe6ec('0x1c'),'caller_id':_0x163e87,'assigned_to':_0x81fa34[_0xe6ec('0x1d')],'short_description':intUtil[_0xe6ec('0x3a')](_0x468d27[_0xe6ec('0x3b')],_0x526c01,'\x20'),'description':intUtil[_0xe6ec('0x3a')](_0x468d27[_0xe6ec('0x3c')],_0x526c01,'\x0a')},getCustomFields(_0x468d27['Fields'],_0x526c01)),'auth':_0x4afb50,'json':!![]};return rp(_0x3a8117)[_0xe6ec('0xd')](function(_0x5932e0){logger[_0xe6ec('0x12')]('['+[_0x5383da['toUpperCase']()]+_0xe6ec('0x3d'),_0x5932e0['result']);_0x81fa34[_0xe6ec('0x3e')]=_0x5932e0[_0xe6ec('0xe')]['sys_id'];_0x81fa34[_0xe6ec('0x3f')]=_0x5932e0['result'][_0xe6ec('0x40')];logger['info']('['+[_0x5383da[_0xe6ec('0x13')]()]+']\x20getTicket\x20crm',_0x81fa34);_0x97804c(_0x81fa34);})['catch'](function(_0x340988){logger[_0xe6ec('0x16')]('['+[_0x5383da[_0xe6ec('0x13')]()]+']',_0x340988[_0xe6ec('0x17')]);_0x583fcf(_0x340988[_0xe6ec('0x17')]);});});};}function createRemoteTag(_0x3acd7e,_0x46d394,_0x44dfdf,_0x117a01){return new Promise(function(_0x505cb6,_0x1b56de){var _0x388486={'method':_0xe6ec('0x37'),'uri':_0x44dfdf+_0xe6ec('0x41')+'?'+_0x117a01,'body':{'short_description':_0x3acd7e,'global':!![],'active':!![],'name':_0x3acd7e},'auth':_0x46d394,'json':!![]};return rp(_0x388486)['then'](function(_0x59390b){var _0x337d7a=_0x59390b[_0xe6ec('0xe')][_0xe6ec('0x11')];_0x505cb6(_0x337d7a);});});}function getRemoteTag(_0x441339,_0x43e566,_0x4d7413,_0x1d3e11,_0x146925){return new Promise(function(_0x226831,_0x46c4aa){var _0x5dfe16={'method':_0xe6ec('0xb'),'uri':_0x4d7413+'label'+'?sysparm_query=name%3D'+_0x441339+'&'+_0x1d3e11,'auth':_0x43e566,'json':!![]};return rp(_0x5dfe16)[_0xe6ec('0xd')](function(_0x5c8e53){if(_0x5c8e53[_0xe6ec('0xe')]['length']>0x0){var _0x3cbaa0=_0x5c8e53['result'][0x0][_0xe6ec('0x11')];_0x226831(_0x3cbaa0);}else{return createRemoteTag(_0x441339,_0x43e566,_0x4d7413,_0x1d3e11)[_0xe6ec('0xd')](function(_0x51041d){_0x226831(_0x51041d);});}});});}function assignTagToIncident(_0x1dfca2,_0x3122d4,_0x2e1ed4,_0x5b6041,_0x37ca1f){return new Promise(function(_0x4a69c7,_0x226428){var _0x46723b={'method':_0xe6ec('0x37'),'uri':_0x2e1ed4+_0xe6ec('0x42')+'?'+_0x37ca1f,'body':{'label':_0x1dfca2,'table':_0xe6ec('0x38'),'id_type':_0xe6ec('0x43'),'table_key':_0x5b6041[_0xe6ec('0x3e')],'title':_0xe6ec('0x44')+_0x5b6041['ticketNumber'],'id_display':_0x5b6041[_0xe6ec('0x3f')]},'auth':_0x3122d4,'json':!![]};return rp(_0x46723b)['then'](function(_0x2742c1){_0x4a69c7();})[_0xe6ec('0x15')](function(){_0x4a69c7();});});}function manageTags(_0x1627e2,_0xbc0866,_0x5112b1,_0x2d989a,_0x5ab612,_0x2e91e0,_0x65e7c){return new Promise(function(_0x2c7a57,_0x1f2437){var _0x5317f5=[];_0xbc0866[_0xe6ec('0x27')](function(_0x52e8ff){_0x5317f5['push'](getRemoteTag(_0x52e8ff,_0x5112b1,_0x2d989a,_0x2e91e0,_0x65e7c));});return Promise[_0xe6ec('0x45')](_0x5317f5)[_0xe6ec('0xd')](function(_0x2f5777){if(_0x2f5777[_0xe6ec('0xf')]){logger['info']('['+[_0x1627e2['toUpperCase']()]+_0xe6ec('0x46'),_0x2f5777);var _0x38852c=[];_0x2f5777[_0xe6ec('0x27')](function(_0x25dd3d){_0x38852c[_0xe6ec('0x47')](assignTagToIncident(_0x25dd3d,_0x5112b1,_0x2d989a,_0x5ab612,_0x2e91e0));});return Promise[_0xe6ec('0x45')](_0x38852c)[_0xe6ec('0xd')](function(){_0x2c7a57();})[_0xe6ec('0x15')](function(){_0x2c7a57();});}else{_0x2c7a57();}});});}function getTags(_0x54f0e1,_0x5c7216,_0x32463d,_0x2b2637,_0x2f477e,_0xd904f9){return function(_0x57313a){return new Promise(function(_0x41b56,_0x181b4e){var _0x598353=[];var _0x15f837=_0x2b2637[_0xe6ec('0x48')];if(_0x15f837&&_0x15f837[_0xe6ec('0xf')]>0x0){_0x598353=_[_0xe6ec('0x49')](_0x15f837,_0xe6ec('0x34'));}if(_0x598353['length']>0x0){return manageTags(_0x54f0e1,_0x598353,_0x5c7216,_0x32463d,_0x57313a,_0x2f477e,_0xd904f9)[_0xe6ec('0xd')](function(){_0x41b56(_0x57313a);});}else{_0x41b56(_0x57313a);}});};}function emit(_0x47cf12,_0xfd6c74,_0x39a780){var _0x1f7a16=_0xe6ec('0x4a')+_0xe6ec('0x4b')+_0xe6ec('0x4c')+_0xe6ec('0x4d');var _0x48d631={'uri':_0x47cf12+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x39a780+_0x1f7a16};io['to'](util[_0xe6ec('0x4e')](_0xe6ec('0x4f'),_0xfd6c74))['emit'](_0xe6ec('0x50'),_0x48d631);}exports['cs']=function(_0x4e29e3,_0x5549c3,_0xe27484,_0x21dc18,_0x15a8dc,_0x593d48,_0x27e2a7,_0x4b48e2){var _0x44cf87={};var _0x29873d={'user':_0x593d48[_0xe6ec('0x51')],'pass':_0x593d48[_0xe6ec('0x52')]};var _0x542e35=_0xe6ec('0x53');var _0x33b084='sysparm_display_value=true';_0x593d48['remoteUri']=intUtil['stripTrailingSlash'](_0x593d48[_0xe6ec('0x54')]);_0x593d48[_0xe6ec('0x55')]=intUtil[_0xe6ec('0x56')](_0x593d48[_0xe6ec('0x55')]);var _0x513db2=util[_0xe6ec('0x4e')](_0xe6ec('0x57'),_0x593d48['remoteUri']);_0x44cf87[_0xe6ec('0x18')]=!_[_0xe6ec('0x58')](_0x21dc18)?_0x21dc18['email']:null;_0x44cf87['adminEmail']=_0x593d48[_0xe6ec('0x59')];_0x44cf87[_0xe6ec('0x21')]=_0x4b48e2[_0xe6ec('0x2e')]()===_0xe6ec('0x5a')?_0x5549c3[_0xe6ec('0x5b')]:_0x5549c3[_0xe6ec('0x5c')];_0x44cf87['callDirection']=_0x4b48e2===_0xe6ec('0x5d')||_0x4b48e2===_0xe6ec('0x5e')?_0xe6ec('0x5d'):_0xe6ec('0x5a');var _0x300a64=util[_0xe6ec('0x4e')](_0xe6ec('0x5f'),_0x593d48[_0xe6ec('0x55')],_0x5549c3[_0xe6ec('0x60')],md5(_0x5549c3[_0xe6ec('0x60')]));if(_0x15a8dc&&_0x15a8dc[_0xe6ec('0x61')]){logger[_0xe6ec('0x12')](_0xe6ec('0x62'),'Recording\x20is\x20enabled!');_0x5549c3['recordingURL']=_0x300a64;}else if(_0x27e2a7&&_0x27e2a7[_0xe6ec('0x63')]&&_0x27e2a7[_0xe6ec('0x63')]!==_0xe6ec('0x64')){logger[_0xe6ec('0x12')](_0xe6ec('0x65'),_0xe6ec('0x66'));_0x5549c3['recordingURL']=_0x300a64;}else{_0x5549c3[_0xe6ec('0x67')]='';}return getAdminUser(_0x4b48e2,_0x29873d,_0x44cf87,_0x513db2,_0x33b084,_0x542e35)[_0xe6ec('0xd')](getUser(_0x4b48e2,_0x29873d,_0x513db2,_0x33b084,_0x542e35))[_0xe6ec('0xd')](getEndUser(_0x4b48e2,_0x29873d,_0x513db2,_0x33b084,_0x542e35))[_0xe6ec('0xd')](getTicket(_0x4b48e2,_0x29873d,_0x513db2,_0xe27484,_0x5549c3,_0x33b084))[_0xe6ec('0xd')](function(_0x67bf9a){logger['info'](util[_0xe6ec('0x4e')](_0xe6ec('0x68'),_0x67bf9a[_0xe6ec('0x3e')]));logger[_0xe6ec('0x12')](util[_0xe6ec('0x4e')](_0xe6ec('0x69'),_0x4b48e2));if(_0x4b48e2!==_0xe6ec('0x5e')){logger[_0xe6ec('0x12')]('['+[_0x4b48e2[_0xe6ec('0x13')]()]+']',_0xe6ec('0x6a'));emit(_0x593d48[_0xe6ec('0x54')],_0x21dc18[_0xe6ec('0x34')],_0x67bf9a[_0xe6ec('0x3e')]);}})[_0xe6ec('0x15')](function(_0x34d669){logger[_0xe6ec('0x16')]('['+[_0x4b48e2[_0xe6ec('0x13')]()]+_0xe6ec('0x6b'),util[_0xe6ec('0x6c')](_0x34d669,{'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 f9dae15..8ee303c 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 _0xb36f=['name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','idField','custom_fields','content','customVariable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Fields','Outbound','Ticket\x20created!','unmanaged','lastevent','toUpperCase','calleridnum','The\x20Enduser\x20ID\x20is:','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','description','date_start','replace','duration_hours','duration_minutes','parent_id','parent_name','direction','length','forEach','push','variableName','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','isNil','Getting\x20agent\x20with\x20name','get_entry_list','stringify','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find'];(function(_0xa70e7,_0x4482b7){var _0x5e6627=function(_0x364147){while(--_0x364147){_0xa70e7['push'](_0xa70e7['shift']());}};_0x5e6627(++_0x4482b7);}(_0xb36f,0x1a9));var _0xfb36=function(_0x870fae,_0x57d21b){_0x870fae=_0x870fae-0x0;var _0x15ddeb=_0xb36f[_0x870fae];return _0x15ddeb;};'use strict';var _=require(_0xfb36('0x0'));var rp=require(_0xfb36('0x1'));var BPromise=require(_0xfb36('0x2'));var md5=require(_0xfb36('0x3'));var util=require('util');var Redis=require(_0xfb36('0x4'));var intUtil=require(_0xfb36('0x5'));var config=require('../../../../config/environment');var logger=require(_0xfb36('0x6'))('sugarcrm');config[_0xfb36('0x7')]=_[_0xfb36('0x8')](config[_0xfb36('0x7')],{'host':_0xfb36('0x9'),'port':0x18eb});var io=require(_0xfb36('0xa'))(new Redis(config[_0xfb36('0x7')]));var def={'method':_0xfb36('0xb'),'json':!![]};function emit(_0x31f52e,_0x57d502,_0x4dbd62){io['to'](_0x31f52e)[_0xfb36('0xc')](_0x57d502,_0x4dbd62);}function getTicket(_0x2a7b0b,_0x543792,_0x3f4be9,_0x487d95,_0xc7f7d1,_0x2a3db7,_0x3cd770,_0x1ee8ac){logger[_0xfb36('0xd')](_0xfb36('0xe'));var _0x3a907f=new Date();var _0x2223b5=[{'name':_0xfb36('0xf'),'value':intUtil[_0xfb36('0x10')](_0x487d95[_0xfb36('0x11')],_0xc7f7d1,'\x20')},{'name':'assigned_user_id','value':_0x543792['id']},{'name':'created_by','value':_0x543792['id']},{'name':_0xfb36('0x12'),'value':intUtil[_0xfb36('0x10')](_0x487d95['Descriptions'],_0xc7f7d1,'\x0a')},{'name':_0xfb36('0x13'),'value':_0x3a907f['toISOString']()['slice'](0x0,0x13)[_0xfb36('0x14')]('T','\x20')},{'name':_0xfb36('0x15'),'value':'0'},{'name':_0xfb36('0x16'),'value':'15'},{'name':_0xfb36('0x17'),'value':_0x3f4be9['id']},{'name':'parent_type','value':'Contacts'},{'name':_0xfb36('0x18'),'value':_0x3f4be9[_0xfb36('0xf')]},{'name':_0xfb36('0x19'),'value':_0x1ee8ac}];if(_0x2a3db7[_0xfb36('0x1a')]){_[_0xfb36('0x1b')](_0x2a3db7,function(_0x24a5ff){if(_0xc7f7d1[_0x24a5ff['variableName']]){_0x2223b5[_0xfb36('0x1c')]({'name':_0x24a5ff['idField'],'value':_0xc7f7d1[_0x24a5ff[_0xfb36('0x1d')]]});}});}return request({'form':{'method':_0xfb36('0x1e'),'input_type':_0xfb36('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x3cd770['id'],'module_name':_0xfb36('0x20'),'name_value_list':_0x2223b5})}});}function getAuth(_0x13e63c){return util[_0xfb36('0x21')](_0xfb36('0x22'),new Buffer(_0x13e63c[_0xfb36('0x23')]+':X')[_0xfb36('0x24')]('base64'));}function getServerInfo(_0x4a53ba){return request({'form':{'method':'get_server_info','input_type':_0xfb36('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4a53ba['id']})}});}function getUser(_0x32e6c6,_0x199768,_0x4d41e8){if(!_[_0xfb36('0x25')](_0x199768)){logger[_0xfb36('0xd')](_0xfb36('0x26'),_0x199768);return request({'form':{'method':_0xfb36('0x27'),'input_type':_0xfb36('0x1f'),'response_type':_0xfb36('0x1f'),'rest_data':JSON[_0xfb36('0x28')]({'session':_0x4d41e8['id'],'module_name':_0xfb36('0x29'),'query':util[_0xfb36('0x21')](_0xfb36('0x2a'),_0x199768),'order_by':'','offset':'0','select_fields':['id',_0xfb36('0xf'),_0xfb36('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xfb36('0x2c')](function(_0x3af9d5){if(_0x3af9d5[_0xfb36('0x2d')]['length']){var _0x3acd05=_[_0xfb36('0x2e')](_0x3af9d5[_0xfb36('0x2d')],function(_0x3884b2){return _0x3884b2[_0xfb36('0x2f')]['user_name'][_0xfb36('0x30')]===_0x199768;});if(_0x3acd05){logger[_0xfb36('0xd')](_0xfb36('0x31'));return BPromise[_0xfb36('0x32')]({'id':_0x3acd05[_0xfb36('0x2f')]['id']['value'],'name':_0x3acd05[_0xfb36('0x2f')][_0xfb36('0xf')][_0xfb36('0x30')]});}}logger[_0xfb36('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xfb36('0x32')]({'id':_0x4d41e8['name_value_list'][_0xfb36('0x33')][_0xfb36('0x30')],'name':_0x4d41e8[_0xfb36('0x2f')][_0xfb36('0x2b')][_0xfb36('0x30')]});});}else{logger['info'](_0xfb36('0x34'));return BPromise['resolve']({'id':_0x4d41e8[_0xfb36('0x2f')][_0xfb36('0x33')]['value'],'name':_0x4d41e8[_0xfb36('0x2f')][_0xfb36('0x2b')]['value']});}}function getEndUser(_0x5bbad6,_0x103050,_0x1775ff,_0x53ca3a){logger[_0xfb36('0xd')](_0xfb36('0x35'),_0x1775ff);return request({'form':{'method':_0xfb36('0x27'),'input_type':_0xfb36('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x53ca3a['id'],'module_name':_0xfb36('0x36'),'query':util['format'](_0xfb36('0x37'),_0x1775ff),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xfb36('0x2c')](function(_0x486052){if(_0x486052[_0xfb36('0x2d')][_0xfb36('0x1a')]){var _0x5150a6=_['find'](_0x486052[_0xfb36('0x2d')],function(_0x14fb02){return _0x14fb02[_0xfb36('0x2f')][_0xfb36('0x38')][_0xfb36('0x30')]===_0x1775ff;});if(_0x5150a6){logger[_0xfb36('0xd')]('Enduser\x20found!');return BPromise[_0xfb36('0x32')]({'id':_0x5150a6[_0xfb36('0x2f')]['id']['value'],'name':_0x5150a6[_0xfb36('0x2f')][_0xfb36('0xf')]['value'],'phone':_0x5150a6['name_value_list'][_0xfb36('0x38')][_0xfb36('0x30')]});}}else{logger['info'](_0xfb36('0x39'));return request({'form':{'method':'set_entry','input_type':_0xfb36('0x1f'),'response_type':_0xfb36('0x1f'),'rest_data':JSON[_0xfb36('0x28')]({'session':_0x53ca3a['id'],'module_name':_0xfb36('0x36'),'name_value_list':[{'name':_0xfb36('0x3a'),'value':_0x103050!==_0xfb36('0x3b')?_0x103050:util[_0xfb36('0x21')](_0xfb36('0x3c'),_0x1775ff)},{'name':_0xfb36('0x38'),'value':_0x1775ff}]})}})[_0xfb36('0x2c')](function(_0x3ab257){logger[_0xfb36('0xd')](_0xfb36('0x3d'));return BPromise[_0xfb36('0x32')]({'id':_0x3ab257['id'],'name':_0x3ab257['entry_list']['first_name'][_0xfb36('0x30')],'phone':_0x3ab257[_0xfb36('0x2d')][_0xfb36('0x38')][_0xfb36('0x30')]});});}});}function request(_0x3f9ac1){logger['debug'](_0xfb36('0x3e'),JSON[_0xfb36('0x28')](_0x3f9ac1));return rp(_[_0xfb36('0x3f')](def,_0x3f9ac1));}function getTags(_0x29b08e,_0x285e8e){var _0xabd62=[];if(_0x29b08e&&_0x29b08e[_0xfb36('0x1a')]>0x0){_0xabd62=_[_0xfb36('0x40')](_0x29b08e,_0x285e8e);}return _0xabd62;}function getCustomFields(_0xd901e1,_0x5b2ebd){var _0x1b0c34=[];var _0x390597={'custom_fields':[]};if(_0xd901e1[_0xfb36('0x1a')]>0x0){_['forEach'](_0xd901e1,function(_0xea196){if(_0xea196[_0xfb36('0x41')]===_0xfb36('0x42')&&_0xea196[_0xfb36('0x43')]&&!_0xea196[_0xfb36('0x44')]){_0x390597[_0xea196[_0xfb36('0x43')][_0xfb36('0x45')]()]=_0xea196['content'][_0xfb36('0x24')]();}else if(_0xea196['type']==='string'&&_0xea196[_0xfb36('0x46')]&&_0xea196[_0xfb36('0x44')]){_0x390597[_0xfb36('0x47')][_0xfb36('0x1c')]({'id':_0xea196[_0xfb36('0x46')],'value':_0xea196[_0xfb36('0x48')][_0xfb36('0x24')]()});}else if(_0xea196[_0xfb36('0x41')]==='variable'&&_0xea196['variableName']&&_0xea196[_0xfb36('0x46')]&&_0xea196[_0xfb36('0x44')]){_0x5b2ebd[_0xea196[_0xfb36('0x1d')]]&&_0x390597['custom_fields'][_0xfb36('0x1c')]({'id':_0xea196[_0xfb36('0x46')],'value':_0x5b2ebd[_0xea196[_0xfb36('0x1d')]][_0xfb36('0x24')]()});}else if(_0xea196['type']===_0xfb36('0x49')&&_0xea196[_0xfb36('0x4a')]&&_0xea196[_0xfb36('0x4a')][_0xfb36('0xf')]&&_0xea196[_0xfb36('0x46')]&&_0xea196[_0xfb36('0x44')]){_0x5b2ebd[_0xea196[_0xfb36('0x4a')][_0xfb36('0xf')][_0xfb36('0x45')]()]&&_0x390597[_0xfb36('0x47')][_0xfb36('0x1c')]({'id':_0xea196[_0xfb36('0x46')],'value':_0x5b2ebd[_0xea196[_0xfb36('0x4a')]['name']['toLowerCase']()][_0xfb36('0x24')]()});}});}return _0x390597;}function getConnection(_0x2783a1){return request({'method':'POST','form':{'method':_0xfb36('0x4b'),'input_type':_0xfb36('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x2783a1['username'],'password':_0x2783a1[_0xfb36('0x4c')],'encryption':_0xfb36('0x4d')},'application':_0xfb36('0x4e')})}})[_0xfb36('0x2c')](function(_0x2b800e){var _0x154b3d=_0x2b800e;if(_0x154b3d['id']){def['sessionID']=_0x154b3d['id'];return BPromise[_0xfb36('0x32')](_0x154b3d);}else{throw new Error(util['format'](_0xfb36('0x4f'),_0x2783a1['id']));}});}function setRelationship(_0x1b859e,_0x4a05c3,_0x4a68e2,_0x403ac6){return request({'form':{'method':_0xfb36('0x50'),'input_type':_0xfb36('0x1f'),'response_type':_0xfb36('0x1f'),'rest_data':JSON[_0xfb36('0x28')]({'session':_0x1b859e['id'],'module_name':'Calls','module_id':_0x4a68e2['id'],'link_field_name':_0x403ac6,'related_ids':[_0x4a05c3['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xfb36('0x51')]=function(_0x213540,_0x27c0c8,_0x3d04ff,_0x2875f5,_0x495a60,_0x454216){var _0x4e904a,_0x3725da,_0xc2fb82,_0x654337;_0x454216[_0xfb36('0x52')]=intUtil['stripTrailingSlash'](_0x454216['remoteUri']);_0x454216[_0xfb36('0x53')]=intUtil[_0xfb36('0x54')](_0x454216[_0xfb36('0x53')]);def[_0xfb36('0x55')]=util[_0xfb36('0x21')](_0xfb36('0x56'),_0x454216[_0xfb36('0x52')]);if(_0x495a60&&_0x495a60[_0xfb36('0x57')]){logger[_0xfb36('0xd')](_0xfb36('0x58'),_0xfb36('0x59'));_0x27c0c8[_0xfb36('0x5a')]=util[_0xfb36('0x21')](_0xfb36('0x5b'),_0x454216[_0xfb36('0x53')],_0x27c0c8[_0xfb36('0x5c')],md5(_0x27c0c8['uniqueid']));}else{_0x27c0c8[_0xfb36('0x5a')]='';}return getConnection(_0x454216)[_0xfb36('0x2c')](function(_0x5d944e){_0x654337=_0x5d944e;return getUser(_0x454216,_0x2875f5[_0xfb36('0xf')],_0x654337);})['then'](function(_0x2ed9c4){_0x4e904a=_0x2ed9c4;logger[_0xfb36('0xd')](_0xfb36('0x5d'),_0x4e904a['id']);return getEndUser(_0x454216,_0x27c0c8['calleridname'],_0x27c0c8['calleridnum'],_0x654337);})[_0xfb36('0x2c')](function(_0x4cb4c3){_0x3725da=_0x4cb4c3;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3725da['id']);return getTicket(_0x454216,_0x4e904a,_0x3725da,_0x3d04ff,_0x27c0c8,_0x3d04ff['Fields'],_0x654337,_0xfb36('0x5e'));})[_0xfb36('0x2c')](function(_0x35ad8d){_0xc2fb82=_0x35ad8d;logger[_0xfb36('0xd')]('Ticket\x20created!');logger[_0xfb36('0xd')](_0xfb36('0x5f'),_0xc2fb82['id']);return setRelationship(_0x654337,_0x4e904a,_0xc2fb82,_0xfb36('0x60'));})[_0xfb36('0x2c')](function(){return setRelationship(_0x654337,_0x3725da,_0xc2fb82,_0xfb36('0x61'));})[_0xfb36('0x2c')](function(){return getServerInfo(_0x654337);})[_0xfb36('0x2c')](function(_0xfc40bc){var _0x47ab98=parseInt(_0xfc40bc[_0xfb36('0x62')]['charAt'](0x0));var _0x415c28=util[_0xfb36('0x21')](_0xfb36('0x63'),_0x454216['remoteUri'],_0xc2fb82['id']);if(_0x47ab98>0x6){_0x415c28=util[_0xfb36('0x21')](_0xfb36('0x64'),_0x454216['remoteUri'],_0xc2fb82['id']);}logger[_0xfb36('0xd')]('[QUEUE]',_0xfb36('0x65'));emit(util[_0xfb36('0x21')](_0xfb36('0x66'),_0x2875f5[_0xfb36('0xf')]),_0xfb36('0x67'),{'uri':_0x415c28});})[_0xfb36('0x68')](function(_0x196423){logger[_0xfb36('0x69')](_0xfb36('0x58'),JSON[_0xfb36('0x28')](_0x196423));});};exports[_0xfb36('0x6a')]=function(_0x339539,_0xc5a6e6,_0x453622,_0x316234,_0x1ef0e7,_0x29778b,_0x25cea8){var _0x3097b1,_0x3851b4,_0x29e052,_0x3bf484;_0x29778b[_0xfb36('0x52')]=intUtil[_0xfb36('0x54')](_0x29778b[_0xfb36('0x52')]);_0x29778b[_0xfb36('0x53')]=intUtil[_0xfb36('0x54')](_0x29778b[_0xfb36('0x53')]);def[_0xfb36('0x55')]=util[_0xfb36('0x21')](_0xfb36('0x56'),_0x29778b[_0xfb36('0x52')]);if(_0x25cea8&&_0x25cea8[_0xfb36('0x6b')]&&_0x25cea8[_0xfb36('0x6b')]!==_0xfb36('0x6c')){logger[_0xfb36('0xd')](_0xfb36('0x6d'),_0xfb36('0x59'));_0xc5a6e6[_0xfb36('0x5a')]=util[_0xfb36('0x21')](_0xfb36('0x5b'),_0x29778b[_0xfb36('0x53')],_0xc5a6e6[_0xfb36('0x5c')],md5(_0xc5a6e6[_0xfb36('0x5c')]));}return getConnection(_0x29778b)['then'](function(_0x40ecd7){_0x3bf484=_0x40ecd7;return getUser(_0x29778b,_0x316234[_0xfb36('0xf')],_0x3bf484);})[_0xfb36('0x2c')](function(_0x590622){_0x3097b1=_0x590622;logger['info'](_0xfb36('0x5d'),_0x3097b1['id']);return getEndUser(_0x29778b,_0xc5a6e6['destcalleridname'],_0xc5a6e6['destcalleridnum'],_0x3bf484);})['then'](function(_0x5aaaec){_0x3851b4=_0x5aaaec;logger[_0xfb36('0xd')]('The\x20Enduser\x20ID\x20is:',_0x3851b4['id']);return getTicket(_0x29778b,_0x3097b1,_0x3851b4,_0x453622,_0xc5a6e6,_0x453622[_0xfb36('0x6e')],_0x3bf484,_0xfb36('0x6f'));})['then'](function(_0x38a2d0){_0x29e052=_0x38a2d0;logger[_0xfb36('0xd')](_0xfb36('0x70'));logger[_0xfb36('0xd')](_0xfb36('0x5f'),_0x29e052['id']);return setRelationship(_0x3bf484,_0x3097b1,_0x29e052,'users');})[_0xfb36('0x2c')](function(){return setRelationship(_0x3bf484,_0x3851b4,_0x29e052,_0xfb36('0x61'));})['then'](function(){return getServerInfo(_0x3bf484);})[_0xfb36('0x2c')](function(_0x55e8bc){var _0x406eb4=parseInt(_0x55e8bc[_0xfb36('0x62')]['charAt'](0x0));var _0x23bc1f=util[_0xfb36('0x21')](_0xfb36('0x63'),_0x29778b[_0xfb36('0x52')],_0x29e052['id']);if(_0x406eb4>0x6){_0x23bc1f=util[_0xfb36('0x21')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x29778b['remoteUri'],_0x29e052['id']);}logger[_0xfb36('0xd')](_0xfb36('0x6d'),_0xfb36('0x65'));emit(util[_0xfb36('0x21')](_0xfb36('0x66'),_0x316234['name']),_0xfb36('0x67'),{'uri':_0x23bc1f});})['catch'](function(_0xd30f68){logger[_0xfb36('0x69')](_0xfb36('0x6d'),JSON[_0xfb36('0x28')](_0xd30f68));});};exports[_0xfb36('0x71')]=function(_0x202111,_0x2cb649,_0x3bb645,_0x16f33c,_0x201a67,_0x58f6a8){var _0x52d2cc,_0x4ff1ec,_0x3feca1,_0x121e31;_0x58f6a8[_0xfb36('0x52')]=intUtil[_0xfb36('0x54')](_0x58f6a8['remoteUri']);_0x58f6a8[_0xfb36('0x53')]=intUtil['stripTrailingSlash'](_0x58f6a8['serverUrl']);def[_0xfb36('0x55')]=util[_0xfb36('0x21')](_0xfb36('0x56'),_0x58f6a8[_0xfb36('0x52')]);if(_0x201a67&&_0x201a67[_0xfb36('0x57')]){logger[_0xfb36('0xd')]('['+_0x2cb649[_0xfb36('0x72')][_0xfb36('0x73')]()+']','Recording\x20is\x20enabled!');_0x2cb649['recordingURL']=util[_0xfb36('0x21')](_0xfb36('0x5b'),_0x58f6a8[_0xfb36('0x53')],_0x2cb649[_0xfb36('0x5c')],md5(_0x2cb649['uniqueid']));}else{_0x2cb649['recordingURL']='';}return getConnection(_0x58f6a8)[_0xfb36('0x2c')](function(_0x43e76c){_0x121e31=_0x43e76c;if(!_[_0xfb36('0x25')](_0x16f33c)){return getUser(_0x58f6a8,_0x16f33c[_0xfb36('0xf')],_0x121e31);}else{return getUser(_0x58f6a8,null,_0x121e31);}})[_0xfb36('0x2c')](function(_0x1fdc56){_0x52d2cc=_0x1fdc56;logger['info']('The\x20User\x20ID\x20is:',_0x52d2cc['id']);return getEndUser(_0x58f6a8,_0x2cb649['calleridname'],_0x2cb649[_0xfb36('0x74')],_0x121e31);})[_0xfb36('0x2c')](function(_0x3a766d){_0x4ff1ec=_0x3a766d;logger[_0xfb36('0xd')](_0xfb36('0x75'),_0x4ff1ec['id']);return getTicket(_0x58f6a8,_0x52d2cc,_0x4ff1ec,_0x3bb645,_0x2cb649,_0x3bb645[_0xfb36('0x6e')],_0x121e31,'Inbound');})[_0xfb36('0x2c')](function(_0x303b54){_0x3feca1=_0x303b54;logger[_0xfb36('0xd')](_0xfb36('0x70'));logger[_0xfb36('0xd')](_0xfb36('0x5f'),_0x3feca1['id']);return setRelationship(_0x121e31,_0x52d2cc,_0x3feca1,_0xfb36('0x60'));})['then'](function(){return setRelationship(_0x121e31,_0x4ff1ec,_0x3feca1,_0xfb36('0x61'));})['then'](function(){return getServerInfo(_0x121e31);})[_0xfb36('0x68')](function(_0x42b398){logger[_0xfb36('0x69')]('['+_0x2cb649['lastevent'][_0xfb36('0x73')]()+']',JSON[_0xfb36('0x28')](_0x42b398));});}; \ No newline at end of file +var _0x2ed3=['parent_type','parent_name','direction','forEach','idField','variableName','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','debug','[HTTP]','merge','map','string','customField','toLowerCase','custom_fields','push','content','toString','type','variable','customVariable','Variable','POST','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Fields','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','unmanaged','uri','lastevent','toUpperCase','md5','util','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','info','name','Subjects','assigned_user_id','created_by','description','getString','Descriptions','toISOString','slice','replace'];(function(_0x5909c3,_0x15ad7a){var _0x45795b=function(_0x3683a4){while(--_0x3683a4){_0x5909c3['push'](_0x5909c3['shift']());}};_0x45795b(++_0x15ad7a);}(_0x2ed3,0xd4));var _0x32ed=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x2ed3[_0x42bdad];return _0x122626;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0x32ed('0x0'));var util=require(_0x32ed('0x1'));var Redis=require('ioredis');var intUtil=require(_0x32ed('0x2'));var config=require(_0x32ed('0x3'));var logger=require('../../../../config/logger')(_0x32ed('0x4'));config[_0x32ed('0x5')]=_[_0x32ed('0x6')](config[_0x32ed('0x5')],{'host':_0x32ed('0x7'),'port':0x18eb});var io=require(_0x32ed('0x8'))(new Redis(config[_0x32ed('0x5')]));var def={'method':'POST','json':!![]};function emit(_0x17ca71,_0x933fb7,_0x4ed90a){io['to'](_0x17ca71)['emit'](_0x933fb7,_0x4ed90a);}function getTicket(_0x21ebb0,_0x256df1,_0x5178b5,_0x226b83,_0xc75f70,_0x58e792,_0x1f9c17,_0x2794b3){logger[_0x32ed('0x9')]('Creating\x20new\x20ticket...');var _0x550fe8=new Date();var _0x183a4f=[{'name':_0x32ed('0xa'),'value':intUtil['getString'](_0x226b83[_0x32ed('0xb')],_0xc75f70,'\x20')},{'name':_0x32ed('0xc'),'value':_0x256df1['id']},{'name':_0x32ed('0xd'),'value':_0x256df1['id']},{'name':_0x32ed('0xe'),'value':intUtil[_0x32ed('0xf')](_0x226b83[_0x32ed('0x10')],_0xc75f70,'\x0a')},{'name':'date_start','value':_0x550fe8[_0x32ed('0x11')]()[_0x32ed('0x12')](0x0,0x13)[_0x32ed('0x13')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x5178b5['id']},{'name':_0x32ed('0x14'),'value':'Contacts'},{'name':_0x32ed('0x15'),'value':_0x5178b5['name']},{'name':_0x32ed('0x16'),'value':_0x2794b3}];if(_0x58e792['length']){_[_0x32ed('0x17')](_0x58e792,function(_0x247aff){if(_0xc75f70[_0x247aff['variableName']]){_0x183a4f['push']({'name':_0x247aff[_0x32ed('0x18')],'value':_0xc75f70[_0x247aff[_0x32ed('0x19')]]});}});}return request({'form':{'method':_0x32ed('0x1a'),'input_type':'JSON','response_type':_0x32ed('0x1b'),'rest_data':JSON[_0x32ed('0x1c')]({'session':_0x1f9c17['id'],'module_name':'Calls','name_value_list':_0x183a4f})}});}function getAuth(_0x5f02f3){return util[_0x32ed('0x1d')](_0x32ed('0x1e'),new Buffer(_0x5f02f3[_0x32ed('0x1f')]+':X')['toString']('base64'));}function getServerInfo(_0x53d0e5){return request({'form':{'method':'get_server_info','input_type':_0x32ed('0x1b'),'response_type':_0x32ed('0x1b'),'rest_data':JSON['stringify']({'session':_0x53d0e5['id']})}});}function getUser(_0x2c48e5,_0x5e6d17,_0x521712){if(!_[_0x32ed('0x20')](_0x5e6d17)){logger['info'](_0x32ed('0x21'),_0x5e6d17);return request({'form':{'method':_0x32ed('0x22'),'input_type':_0x32ed('0x1b'),'response_type':_0x32ed('0x1b'),'rest_data':JSON[_0x32ed('0x1c')]({'session':_0x521712['id'],'module_name':'Employees','query':util[_0x32ed('0x1d')](_0x32ed('0x23'),_0x5e6d17),'order_by':'','offset':'0','select_fields':['id',_0x32ed('0xa'),_0x32ed('0x24')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x32ed('0x25')](function(_0x35a068){if(_0x35a068[_0x32ed('0x26')][_0x32ed('0x27')]){var _0xf58d5a=_['find'](_0x35a068[_0x32ed('0x26')],function(_0x5478ad){return _0x5478ad[_0x32ed('0x28')][_0x32ed('0x24')][_0x32ed('0x29')]===_0x5e6d17;});if(_0xf58d5a){logger[_0x32ed('0x9')](_0x32ed('0x2a'));return BPromise[_0x32ed('0x2b')]({'id':_0xf58d5a[_0x32ed('0x28')]['id'][_0x32ed('0x29')],'name':_0xf58d5a[_0x32ed('0x28')][_0x32ed('0xa')]['value']});}}logger[_0x32ed('0x9')](_0x32ed('0x2c'));return BPromise[_0x32ed('0x2b')]({'id':_0x521712[_0x32ed('0x28')][_0x32ed('0x2d')]['value'],'name':_0x521712['name_value_list']['user_name']['value']});});}else{logger[_0x32ed('0x9')](_0x32ed('0x2e'));return BPromise[_0x32ed('0x2b')]({'id':_0x521712[_0x32ed('0x28')][_0x32ed('0x2d')]['value'],'name':_0x521712['name_value_list'][_0x32ed('0x24')][_0x32ed('0x29')]});}}function getEndUser(_0x9a18b2,_0x754edf,_0x5725f3,_0x65593f){logger[_0x32ed('0x9')](_0x32ed('0x2f'),_0x5725f3);return request({'form':{'method':_0x32ed('0x22'),'input_type':_0x32ed('0x1b'),'response_type':_0x32ed('0x1b'),'rest_data':JSON['stringify']({'session':_0x65593f['id'],'module_name':_0x32ed('0x30'),'query':util['format'](_0x32ed('0x31'),_0x5725f3),'order_by':'','offset':'0','select_fields':['id','name',_0x32ed('0x32')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x32ed('0x25')](function(_0x3287df){if(_0x3287df[_0x32ed('0x26')][_0x32ed('0x27')]){var _0x5a60b1=_['find'](_0x3287df['entry_list'],function(_0x8144d6){return _0x8144d6[_0x32ed('0x28')]['phone_home'][_0x32ed('0x29')]===_0x5725f3;});if(_0x5a60b1){logger[_0x32ed('0x9')](_0x32ed('0x33'));return BPromise[_0x32ed('0x2b')]({'id':_0x5a60b1[_0x32ed('0x28')]['id']['value'],'name':_0x5a60b1[_0x32ed('0x28')][_0x32ed('0xa')][_0x32ed('0x29')],'phone':_0x5a60b1[_0x32ed('0x28')][_0x32ed('0x32')][_0x32ed('0x29')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x32ed('0x1a'),'input_type':_0x32ed('0x1b'),'response_type':_0x32ed('0x1b'),'rest_data':JSON['stringify']({'session':_0x65593f['id'],'module_name':_0x32ed('0x30'),'name_value_list':[{'name':_0x32ed('0x34'),'value':_0x754edf!==_0x32ed('0x35')?_0x754edf:util[_0x32ed('0x1d')](_0x32ed('0x36'),_0x5725f3)},{'name':_0x32ed('0x32'),'value':_0x5725f3}]})}})[_0x32ed('0x25')](function(_0x52c747){logger[_0x32ed('0x9')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x52c747['id'],'name':_0x52c747[_0x32ed('0x26')][_0x32ed('0x34')][_0x32ed('0x29')],'phone':_0x52c747[_0x32ed('0x26')][_0x32ed('0x32')]['value']});});}});}function request(_0x21986e){logger[_0x32ed('0x37')](_0x32ed('0x38'),JSON[_0x32ed('0x1c')](_0x21986e));return rp(_[_0x32ed('0x39')](def,_0x21986e));}function getTags(_0x1c4cad,_0x240853){var _0x1fec3f=[];if(_0x1c4cad&&_0x1c4cad[_0x32ed('0x27')]>0x0){_0x1fec3f=_[_0x32ed('0x3a')](_0x1c4cad,_0x240853);}return _0x1fec3f;}function getCustomFields(_0x41db96,_0x37bdc1){var _0x23233a=[];var _0x4f693f={'custom_fields':[]};if(_0x41db96['length']>0x0){_[_0x32ed('0x17')](_0x41db96,function(_0x1c4fca){if(_0x1c4fca['type']===_0x32ed('0x3b')&&_0x1c4fca['nameField']&&!_0x1c4fca[_0x32ed('0x3c')]){_0x4f693f[_0x1c4fca['nameField'][_0x32ed('0x3d')]()]=_0x1c4fca['content']['toString']();}else if(_0x1c4fca['type']===_0x32ed('0x3b')&&_0x1c4fca[_0x32ed('0x18')]&&_0x1c4fca[_0x32ed('0x3c')]){_0x4f693f[_0x32ed('0x3e')][_0x32ed('0x3f')]({'id':_0x1c4fca['idField'],'value':_0x1c4fca[_0x32ed('0x40')][_0x32ed('0x41')]()});}else if(_0x1c4fca[_0x32ed('0x42')]===_0x32ed('0x43')&&_0x1c4fca[_0x32ed('0x19')]&&_0x1c4fca[_0x32ed('0x18')]&&_0x1c4fca[_0x32ed('0x3c')]){_0x37bdc1[_0x1c4fca[_0x32ed('0x19')]]&&_0x4f693f['custom_fields']['push']({'id':_0x1c4fca['idField'],'value':_0x37bdc1[_0x1c4fca[_0x32ed('0x19')]][_0x32ed('0x41')]()});}else if(_0x1c4fca[_0x32ed('0x42')]===_0x32ed('0x44')&&_0x1c4fca[_0x32ed('0x45')]&&_0x1c4fca[_0x32ed('0x45')]['name']&&_0x1c4fca[_0x32ed('0x18')]&&_0x1c4fca[_0x32ed('0x3c')]){_0x37bdc1[_0x1c4fca[_0x32ed('0x45')]['name']['toLowerCase']()]&&_0x4f693f[_0x32ed('0x3e')]['push']({'id':_0x1c4fca['idField'],'value':_0x37bdc1[_0x1c4fca[_0x32ed('0x45')]['name'][_0x32ed('0x3d')]()][_0x32ed('0x41')]()});}});}return _0x4f693f;}function getConnection(_0x8a74fb){return request({'method':_0x32ed('0x46'),'form':{'method':_0x32ed('0x47'),'input_type':_0x32ed('0x1b'),'response_type':_0x32ed('0x1b'),'rest_data':JSON[_0x32ed('0x1c')]({'user_auth':{'user_name':_0x8a74fb[_0x32ed('0x48')],'password':_0x8a74fb[_0x32ed('0x49')],'encryption':_0x32ed('0x4a')},'application':_0x32ed('0x4b')})}})[_0x32ed('0x25')](function(_0x3b5724){var _0x40bbd7=_0x3b5724;if(_0x40bbd7['id']){def['sessionID']=_0x40bbd7['id'];return BPromise[_0x32ed('0x2b')](_0x40bbd7);}else{throw new Error(util[_0x32ed('0x1d')](_0x32ed('0x4c'),_0x8a74fb['id']));}});}function setRelationship(_0x2f3394,_0x298c4d,_0x53bb1b,_0x4746be){return request({'form':{'method':'set_relationship','input_type':_0x32ed('0x1b'),'response_type':_0x32ed('0x1b'),'rest_data':JSON[_0x32ed('0x1c')]({'session':_0x2f3394['id'],'module_name':'Calls','module_id':_0x53bb1b['id'],'link_field_name':_0x4746be,'related_ids':[_0x298c4d['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x32ed('0x4d')]=function(_0x550ed1,_0x2e0842,_0x5f166b,_0x5570fb,_0x333b6b,_0x203e78){var _0x55ac66,_0xf919fe,_0x439712,_0x30865b;_0x203e78[_0x32ed('0x4e')]=intUtil[_0x32ed('0x4f')](_0x203e78[_0x32ed('0x4e')]);_0x203e78['serverUrl']=intUtil[_0x32ed('0x4f')](_0x203e78[_0x32ed('0x50')]);def['uri']=util[_0x32ed('0x1d')](_0x32ed('0x51'),_0x203e78['remoteUri']);if(_0x333b6b&&_0x333b6b[_0x32ed('0x52')]){logger[_0x32ed('0x9')](_0x32ed('0x53'),'Recording\x20is\x20enabled!');_0x2e0842[_0x32ed('0x54')]=util[_0x32ed('0x1d')](_0x32ed('0x55'),_0x203e78[_0x32ed('0x50')],_0x2e0842[_0x32ed('0x56')],md5(_0x2e0842['uniqueid']));}else{_0x2e0842[_0x32ed('0x54')]='';}return getConnection(_0x203e78)['then'](function(_0x3a7d34){_0x30865b=_0x3a7d34;return getUser(_0x203e78,_0x5570fb['name'],_0x30865b);})[_0x32ed('0x25')](function(_0x3b3a97){_0x55ac66=_0x3b3a97;logger[_0x32ed('0x9')](_0x32ed('0x57'),_0x55ac66['id']);return getEndUser(_0x203e78,_0x2e0842[_0x32ed('0x58')],_0x2e0842[_0x32ed('0x59')],_0x30865b);})[_0x32ed('0x25')](function(_0x525bb2){_0xf919fe=_0x525bb2;logger[_0x32ed('0x9')](_0x32ed('0x5a'),_0xf919fe['id']);return getTicket(_0x203e78,_0x55ac66,_0xf919fe,_0x5f166b,_0x2e0842,_0x5f166b['Fields'],_0x30865b,_0x32ed('0x5b'));})[_0x32ed('0x25')](function(_0x3598f2){_0x439712=_0x3598f2;logger[_0x32ed('0x9')](_0x32ed('0x5c'));logger[_0x32ed('0x9')](_0x32ed('0x5d'),_0x439712['id']);return setRelationship(_0x30865b,_0x55ac66,_0x439712,_0x32ed('0x5e'));})[_0x32ed('0x25')](function(){return setRelationship(_0x30865b,_0xf919fe,_0x439712,_0x32ed('0x5f'));})[_0x32ed('0x25')](function(){return getServerInfo(_0x30865b);})['then'](function(_0x30965a){var _0x4861d5=parseInt(_0x30965a[_0x32ed('0x60')][_0x32ed('0x61')](0x0));var _0x31e07b=util[_0x32ed('0x1d')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x203e78[_0x32ed('0x4e')],_0x439712['id']);if(_0x4861d5>0x6){_0x31e07b=util[_0x32ed('0x1d')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x203e78['remoteUri'],_0x439712['id']);}logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x32ed('0x1d')](_0x32ed('0x62'),_0x5570fb[_0x32ed('0xa')]),_0x32ed('0x63'),{'uri':_0x31e07b});})['catch'](function(_0x11e3ad){logger[_0x32ed('0x64')]('[QUEUE]',JSON['stringify'](_0x11e3ad));});};exports[_0x32ed('0x65')]=function(_0x11551d,_0x59325f,_0x4fa75e,_0x4b7f36,_0x4ad0af,_0x26f3a0,_0x313c3e){var _0x4b0965,_0x26c613,_0x511c77,_0x5f4405;_0x26f3a0[_0x32ed('0x4e')]=intUtil[_0x32ed('0x4f')](_0x26f3a0[_0x32ed('0x4e')]);_0x26f3a0[_0x32ed('0x50')]=intUtil[_0x32ed('0x4f')](_0x26f3a0[_0x32ed('0x50')]);def['uri']=util[_0x32ed('0x1d')](_0x32ed('0x51'),_0x26f3a0[_0x32ed('0x4e')]);if(_0x313c3e&&_0x313c3e['recordingFormat']&&_0x313c3e[_0x32ed('0x66')]!==_0x32ed('0x67')){logger['info'](_0x32ed('0x68'),_0x32ed('0x69'));_0x59325f[_0x32ed('0x54')]=util['format'](_0x32ed('0x55'),_0x26f3a0[_0x32ed('0x50')],_0x59325f[_0x32ed('0x56')],md5(_0x59325f[_0x32ed('0x56')]));}return getConnection(_0x26f3a0)[_0x32ed('0x25')](function(_0x1900b7){_0x5f4405=_0x1900b7;return getUser(_0x26f3a0,_0x4b7f36[_0x32ed('0xa')],_0x5f4405);})['then'](function(_0x2eb70a){_0x4b0965=_0x2eb70a;logger[_0x32ed('0x9')](_0x32ed('0x57'),_0x4b0965['id']);return getEndUser(_0x26f3a0,_0x59325f[_0x32ed('0x6a')],_0x59325f[_0x32ed('0x6b')],_0x5f4405);})[_0x32ed('0x25')](function(_0x25956d){_0x26c613=_0x25956d;logger[_0x32ed('0x9')](_0x32ed('0x5a'),_0x26c613['id']);return getTicket(_0x26f3a0,_0x4b0965,_0x26c613,_0x4fa75e,_0x59325f,_0x4fa75e[_0x32ed('0x6c')],_0x5f4405,'Outbound');})[_0x32ed('0x25')](function(_0x32df2b){_0x511c77=_0x32df2b;logger[_0x32ed('0x9')](_0x32ed('0x5c'));logger[_0x32ed('0x9')](_0x32ed('0x5d'),_0x511c77['id']);return setRelationship(_0x5f4405,_0x4b0965,_0x511c77,_0x32ed('0x5e'));})[_0x32ed('0x25')](function(){return setRelationship(_0x5f4405,_0x26c613,_0x511c77,_0x32ed('0x5f'));})['then'](function(){return getServerInfo(_0x5f4405);})[_0x32ed('0x25')](function(_0x717935){var _0x5b671c=parseInt(_0x717935[_0x32ed('0x60')]['charAt'](0x0));var _0x53141d=util[_0x32ed('0x1d')](_0x32ed('0x6d'),_0x26f3a0[_0x32ed('0x4e')],_0x511c77['id']);if(_0x5b671c>0x6){_0x53141d=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x26f3a0['remoteUri'],_0x511c77['id']);}logger[_0x32ed('0x9')](_0x32ed('0x68'),_0x32ed('0x6e'));emit(util[_0x32ed('0x1d')](_0x32ed('0x62'),_0x4b7f36[_0x32ed('0xa')]),_0x32ed('0x63'),{'uri':_0x53141d});})[_0x32ed('0x6f')](function(_0xd1cf0){logger[_0x32ed('0x64')](_0x32ed('0x68'),JSON[_0x32ed('0x1c')](_0xd1cf0));});};exports[_0x32ed('0x70')]=function(_0x12e04e,_0x4d2c2e,_0x4648d7,_0x497c8e,_0x56c271,_0x1c2586){var _0x9884c,_0x2faff5,_0x4c0aad,_0x45b72a;_0x1c2586[_0x32ed('0x4e')]=intUtil[_0x32ed('0x4f')](_0x1c2586['remoteUri']);_0x1c2586[_0x32ed('0x50')]=intUtil[_0x32ed('0x4f')](_0x1c2586['serverUrl']);def[_0x32ed('0x71')]=util[_0x32ed('0x1d')](_0x32ed('0x51'),_0x1c2586[_0x32ed('0x4e')]);if(_0x56c271&&_0x56c271[_0x32ed('0x52')]){logger[_0x32ed('0x9')]('['+_0x4d2c2e[_0x32ed('0x72')][_0x32ed('0x73')]()+']','Recording\x20is\x20enabled!');_0x4d2c2e[_0x32ed('0x54')]=util['format'](_0x32ed('0x55'),_0x1c2586['serverUrl'],_0x4d2c2e['uniqueid'],md5(_0x4d2c2e[_0x32ed('0x56')]));}else{_0x4d2c2e[_0x32ed('0x54')]='';}return getConnection(_0x1c2586)['then'](function(_0x5d6b4c){_0x45b72a=_0x5d6b4c;if(!_[_0x32ed('0x20')](_0x497c8e)){return getUser(_0x1c2586,_0x497c8e['name'],_0x45b72a);}else{return getUser(_0x1c2586,null,_0x45b72a);}})[_0x32ed('0x25')](function(_0x2d31ba){_0x9884c=_0x2d31ba;logger['info'](_0x32ed('0x57'),_0x9884c['id']);return getEndUser(_0x1c2586,_0x4d2c2e[_0x32ed('0x58')],_0x4d2c2e['calleridnum'],_0x45b72a);})['then'](function(_0x84341a){_0x2faff5=_0x84341a;logger[_0x32ed('0x9')]('The\x20Enduser\x20ID\x20is:',_0x2faff5['id']);return getTicket(_0x1c2586,_0x9884c,_0x2faff5,_0x4648d7,_0x4d2c2e,_0x4648d7[_0x32ed('0x6c')],_0x45b72a,_0x32ed('0x5b'));})[_0x32ed('0x25')](function(_0x7f4794){_0x4c0aad=_0x7f4794;logger[_0x32ed('0x9')](_0x32ed('0x5c'));logger[_0x32ed('0x9')](_0x32ed('0x5d'),_0x4c0aad['id']);return setRelationship(_0x45b72a,_0x9884c,_0x4c0aad,_0x32ed('0x5e'));})[_0x32ed('0x25')](function(){return setRelationship(_0x45b72a,_0x2faff5,_0x4c0aad,_0x32ed('0x5f'));})['then'](function(){return getServerInfo(_0x45b72a);})[_0x32ed('0x6f')](function(_0xa5566){logger[_0x32ed('0x64')]('['+_0x4d2c2e[_0x32ed('0x72')]['toUpperCase']()+']',JSON[_0x32ed('0x1c')](_0xa5566));});}; \ 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 3bb26ca..7a87664 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 _0xf749=['lodash','getString','length','sortBy','type','string','push','content','variable','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','key','%s:\x20%s','keyContent','format','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test'];(function(_0x416ef5,_0x15f6f5){var _0x5b30d5=function(_0x14551a){while(--_0x14551a){_0x416ef5['push'](_0x416ef5['shift']());}};_0x5b30d5(++_0x15f6f5);}(_0xf749,0x1c0));var _0x9f74=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf749[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x9f74('0x0'));var util=require('util');exports[_0x9f74('0x1')]=function(_0x338b0a,_0x18a94c,_0xe1e6c){var _0x25d8bd=[];if(_0x338b0a[_0x9f74('0x2')]>0x0){var _0x57ba1d=_[_0x9f74('0x3')](_0x338b0a,['id']);for(var _0x4665ab=0x0;_0x4665ab<_0x57ba1d[_0x9f74('0x2')];_0x4665ab++){var _0x41e952=_0x57ba1d[_0x4665ab];if(_0x41e952[_0x9f74('0x4')]===_0x9f74('0x5')){_0x25d8bd[_0x9f74('0x6')](_0x41e952[_0x9f74('0x7')]);}else if(_0x41e952[_0x9f74('0x4')]===_0x9f74('0x8')&&_0x41e952[_0x9f74('0x9')]){_0x18a94c[_0x41e952[_0x9f74('0x9')]]&&_0x25d8bd['push'](_0x18a94c[_0x41e952[_0x9f74('0x9')]][_0x9f74('0xa')]());}else if(_0x41e952[_0x9f74('0x4')]==='customVariable'&&_0x41e952[_0x9f74('0xb')]&&_0x41e952[_0x9f74('0xb')][_0x9f74('0xc')]){_0x18a94c[_0x41e952['Variable'][_0x9f74('0xc')][_0x9f74('0xd')]()]&&_0x25d8bd[_0x9f74('0x6')](_0x18a94c[_0x41e952[_0x9f74('0xb')][_0x9f74('0xc')]['toLowerCase']()][_0x9f74('0xa')]());}else if(_0x41e952[_0x9f74('0x4')]===_0x9f74('0xe')){if(_0x41e952[_0x9f74('0xf')]===_0x9f74('0x5')&&_0x41e952[_0x9f74('0x10')]){_0x25d8bd[_0x9f74('0x6')](util['format'](_0x9f74('0x11'),_0x41e952[_0x9f74('0x10')],_0x41e952[_0x9f74('0x12')]));}else if(_0x41e952[_0x9f74('0xf')]===_0x9f74('0x8')&&_0x41e952[_0x9f74('0x9')]&&_0x41e952[_0x9f74('0x10')]){_0x18a94c[_0x41e952[_0x9f74('0x9')]]&&_0x25d8bd[_0x9f74('0x6')](util[_0x9f74('0x13')](_0x9f74('0x11'),_0x41e952[_0x9f74('0x10')],_0x18a94c[_0x41e952[_0x9f74('0x9')]]));}else if(_0x41e952[_0x9f74('0xf')]==='customVariable'&&_0x41e952[_0x9f74('0xb')]&&_0x41e952[_0x9f74('0xb')][_0x9f74('0xc')]&&_0x41e952[_0x9f74('0x10')]){_0x18a94c[_0x41e952[_0x9f74('0xb')]['name'][_0x9f74('0xd')]()]&&_0x25d8bd['push'](util[_0x9f74('0x13')]('%s:\x20%s',_0x41e952[_0x9f74('0x10')],_0x18a94c[_0x41e952[_0x9f74('0xb')][_0x9f74('0xc')][_0x9f74('0xd')]()]));}}}}return _0x25d8bd[_0x9f74('0x14')](_0xe1e6c);};exports[_0x9f74('0x15')]=function(_0x4c8c66){var _0x41cad1=_0x4c8c66[_0x9f74('0x16')](-0x1);if(_0x41cad1==='/'){_0x4c8c66=_0x4c8c66[_0x9f74('0x17')](0x0,_0x4c8c66[_0x9f74('0x18')](_0x41cad1));}return _0x4c8c66;};exports[_0x9f74('0x19')]=function(_0x3ab0f6){if(!_[_0x9f74('0x1a')](_0x3ab0f6)&&_0x3ab0f6!==''){var _0x7f50=/^(([^<>()\[\]\\.,;:\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 _0x7f50[_0x9f74('0x1b')](String(_0x3ab0f6)[_0x9f74('0xd')]());}else{return![];}}; \ No newline at end of file +var _0xc1a1=['keyValue','keyType','format','%s:\x20%s','key','keyContent','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','util','getString','length','sortBy','string','push','content','variable','variableName','toString','type','customVariable','Variable','name','toLowerCase'];(function(_0x4c4272,_0x1baa18){var _0x1b67ea=function(_0x4ae7f1){while(--_0x4ae7f1){_0x4c4272['push'](_0x4c4272['shift']());}};_0x1b67ea(++_0x1baa18);}(_0xc1a1,0x9f));var _0x1c1a=function(_0x652265,_0x21e1bd){_0x652265=_0x652265-0x0;var _0xeb5219=_0xc1a1[_0x652265];return _0xeb5219;};'use strict';var _=require('lodash');var util=require(_0x1c1a('0x0'));exports[_0x1c1a('0x1')]=function(_0x58000a,_0x525b88,_0x102572){var _0x15ffcd=[];if(_0x58000a[_0x1c1a('0x2')]>0x0){var _0x56ce92=_[_0x1c1a('0x3')](_0x58000a,['id']);for(var _0x5a5f7e=0x0;_0x5a5f7e<_0x56ce92[_0x1c1a('0x2')];_0x5a5f7e++){var _0x56f5d7=_0x56ce92[_0x5a5f7e];if(_0x56f5d7['type']===_0x1c1a('0x4')){_0x15ffcd[_0x1c1a('0x5')](_0x56f5d7[_0x1c1a('0x6')]);}else if(_0x56f5d7['type']===_0x1c1a('0x7')&&_0x56f5d7[_0x1c1a('0x8')]){_0x525b88[_0x56f5d7[_0x1c1a('0x8')]]&&_0x15ffcd[_0x1c1a('0x5')](_0x525b88[_0x56f5d7['variableName']][_0x1c1a('0x9')]());}else if(_0x56f5d7[_0x1c1a('0xa')]===_0x1c1a('0xb')&&_0x56f5d7[_0x1c1a('0xc')]&&_0x56f5d7[_0x1c1a('0xc')][_0x1c1a('0xd')]){_0x525b88[_0x56f5d7[_0x1c1a('0xc')][_0x1c1a('0xd')][_0x1c1a('0xe')]()]&&_0x15ffcd[_0x1c1a('0x5')](_0x525b88[_0x56f5d7[_0x1c1a('0xc')]['name']['toLowerCase']()][_0x1c1a('0x9')]());}else if(_0x56f5d7[_0x1c1a('0xa')]===_0x1c1a('0xf')){if(_0x56f5d7[_0x1c1a('0x10')]===_0x1c1a('0x4')&&_0x56f5d7['key']){_0x15ffcd[_0x1c1a('0x5')](util[_0x1c1a('0x11')](_0x1c1a('0x12'),_0x56f5d7[_0x1c1a('0x13')],_0x56f5d7[_0x1c1a('0x14')]));}else if(_0x56f5d7['keyType']===_0x1c1a('0x7')&&_0x56f5d7['variableName']&&_0x56f5d7[_0x1c1a('0x13')]){_0x525b88[_0x56f5d7['variableName']]&&_0x15ffcd['push'](util[_0x1c1a('0x11')](_0x1c1a('0x12'),_0x56f5d7['key'],_0x525b88[_0x56f5d7['variableName']]));}else if(_0x56f5d7[_0x1c1a('0x10')]===_0x1c1a('0xb')&&_0x56f5d7[_0x1c1a('0xc')]&&_0x56f5d7[_0x1c1a('0xc')][_0x1c1a('0xd')]&&_0x56f5d7[_0x1c1a('0x13')]){_0x525b88[_0x56f5d7[_0x1c1a('0xc')][_0x1c1a('0xd')][_0x1c1a('0xe')]()]&&_0x15ffcd['push'](util[_0x1c1a('0x11')]('%s:\x20%s',_0x56f5d7['key'],_0x525b88[_0x56f5d7[_0x1c1a('0xc')][_0x1c1a('0xd')][_0x1c1a('0xe')]()]));}}}}return _0x15ffcd[_0x1c1a('0x15')](_0x102572);};exports[_0x1c1a('0x16')]=function(_0x23fff6){var _0x5d7703=_0x23fff6[_0x1c1a('0x17')](-0x1);if(_0x5d7703==='/'){_0x23fff6=_0x23fff6[_0x1c1a('0x18')](0x0,_0x23fff6[_0x1c1a('0x19')](_0x5d7703));}return _0x23fff6;};exports[_0x1c1a('0x1a')]=function(_0x400151){if(!_[_0x1c1a('0x1b')](_0x400151)&&_0x400151!==''){var _0x230bae=/^(([^<>()\[\]\\.,;:\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 _0x230bae[_0x1c1a('0x1c')](String(_0x400151)[_0x1c1a('0xe')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 73336f9..14571b2 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(_0x384182,_0x4b9b3d){var _0x5461c8=function(_0x24d021){while(--_0x24d021){_0x384182['push'](_0x384182['shift']());}};_0x5461c8(++_0x4b9b3d);}(_0xe706,0xa3));var _0x6e70=function(_0x347379,_0x37de29){_0x347379=_0x347379-0x0;var _0x1e6dbf=_0xe706[_0x347379];return _0x1e6dbf;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 8223894..4951b92 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 _0x61d5=['password','username','authType','token','Basic\x20%s','base64','[HTTP]','stringify','GET','map','forEach','includes','type','nameField','customField','content','toString','string','picklist','custom_fields','push','idField','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','POST','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','replace','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','user:%s','trigger:browser:url','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','./util','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','Tags','name','getString','Subjects','Descriptions','Fields','then','ticket','Getting\x20agent\x20with\x20email','%s/search.json','count','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.'];(function(_0x5c7c1f,_0x34a205){var _0x2eae73=function(_0x4b814f){while(--_0x4b814f){_0x5c7c1f['push'](_0x5c7c1f['shift']());}};_0x2eae73(++_0x34a205);}(_0x61d5,0xb0));var _0x561d=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x61d5[_0x2a6809];return _0x11c371;};'use strict';var _=require('lodash');var rp=require(_0x561d('0x0'));var md5=require(_0x561d('0x1'));var util=require(_0x561d('0x2'));var Redis=require(_0x561d('0x3'));var intUtil=require(_0x561d('0x4'));var config=require('../../../../config/environment');var logger=require(_0x561d('0x5'))(_0x561d('0x6'));config[_0x561d('0x7')]=_[_0x561d('0x8')](config[_0x561d('0x7')],{'host':_0x561d('0x9'),'port':0x18eb});var io=require(_0x561d('0xa'))(new Redis(config[_0x561d('0x7')]));function emit(_0x632ef,_0x692559,_0x7cf900){io['to'](_0x632ef)[_0x561d('0xb')](_0x692559,_0x7cf900);}var headers={'Content-Type':_0x561d('0xc'),'Accept':_0x561d('0xc')};function getTicket(_0x3d9cb5,_0x5bb0b7,_0x262b08,_0x3edff9,_0x3d1ff9){logger[_0x561d('0xd')](_0x561d('0xe'));return request({'uri':util[_0x561d('0xf')](_0x561d('0x10'),_0x3d9cb5[_0x561d('0x11')]),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x262b08['id'],'submitter_id':_0x5bb0b7?_0x5bb0b7['id']:undefined,'assignee_id':_0x5bb0b7?_0x5bb0b7['id']:undefined,'tags':getTags(_0x3edff9[_0x561d('0x12')],_0x561d('0x13')),'subject':intUtil[_0x561d('0x14')](_0x3edff9[_0x561d('0x15')],_0x3d1ff9,'\x20'),'description':intUtil[_0x561d('0x14')](_0x3edff9[_0x561d('0x16')],_0x3d1ff9,'\x0a'),'comment':{'public':![],'body':intUtil[_0x561d('0x14')](_0x3edff9[_0x561d('0x16')],_0x3d1ff9,'\x0a')}},getCustomFields(_0x3edff9[_0x561d('0x17')],_0x3d1ff9))}})[_0x561d('0x18')](function(_0x3f9680){logger[_0x561d('0xd')]('Ticket\x20created!');return _0x3f9680[_0x561d('0x19')];});}function getUser(_0x1c1c80,_0x5158f3){if(intUtil['validateEmail'](_0x5158f3)){logger[_0x561d('0xd')](_0x561d('0x1a'),_0x5158f3);return request({'uri':util[_0x561d('0xf')](_0x561d('0x1b'),_0x1c1c80[_0x561d('0x11')]),'qs':{'query':util[_0x561d('0xf')]('type:user\x20role:agent\x20email:%s',_0x5158f3)}})[_0x561d('0x18')](function(_0x4abf0b){if(_0x4abf0b[_0x561d('0x1c')]){logger[_0x561d('0xd')](_0x561d('0x1d'));return _['find'](_0x4abf0b[_0x561d('0x1e')],{'email':_0x5158f3,'role':_0x561d('0x1f')});}else{logger['info'](_0x561d('0x20'));return request({'uri':util[_0x561d('0xf')](_0x561d('0x21'),_0x1c1c80['remoteUri'])})[_0x561d('0x18')](function(_0x82f32d){logger[_0x561d('0xd')](_0x561d('0x22'));return _0x82f32d[_0x561d('0x23')];});}});}else{logger['info'](_0x561d('0x20'));return request({'uri':util[_0x561d('0xf')](_0x561d('0x21'),_0x1c1c80[_0x561d('0x11')])})[_0x561d('0x18')](function(_0x5c420b){logger[_0x561d('0xd')]('Admin\x20account\x20selected.');return _0x5c420b['user'];});}}function getEndUser(_0x3c3958,_0x13d90c,_0x2f4e39){logger['info'](_0x561d('0x24'),_0x2f4e39);return request({'uri':util[_0x561d('0xf')](_0x561d('0x1b'),_0x3c3958[_0x561d('0x11')]),'qs':{'query':util[_0x561d('0xf')](_0x561d('0x25'),_0x2f4e39)}})[_0x561d('0x18')](function(_0x2cf958){var _0x35b8e9;if(_0x2cf958[_0x561d('0x1e')][_0x561d('0x26')]){_0x2cf958[_0x561d('0x1e')]=_[_0x561d('0x27')](_0x2cf958[_0x561d('0x1e')],{'suspended':![],'role':_0x561d('0x28')});if(_0x2cf958[_0x561d('0x1e')][_0x561d('0x26')]){_0x35b8e9=_['first'](_0x2cf958[_0x561d('0x1e')]);}}if(_0x35b8e9){logger['info'](_0x561d('0x29'));return _0x35b8e9;}else{logger['info'](_0x561d('0x2a'));return request({'uri':util[_0x561d('0xf')]('%s/users.json',_0x3c3958[_0x561d('0x11')]),'method':'POST','body':{'user':{'role':_0x561d('0x28'),'name':util[_0x561d('0xf')]('Caller\x20-\x20%s',_0x13d90c||_0x2f4e39),'phone':_0x2f4e39}}})[_0x561d('0x18')](function(_0x36302d){logger[_0x561d('0xd')](_0x561d('0x2b'));return _0x36302d[_0x561d('0x23')];});}});}function getAuth(_0x4dcde9){var _0x135ced;if(_0x4dcde9['authType']===_0x561d('0x2c')){_0x135ced=util[_0x561d('0xf')]('%s:%s',_0x4dcde9[_0x561d('0x2d')],_0x4dcde9[_0x561d('0x2c')]);}else if(_0x4dcde9[_0x561d('0x2e')]===_0x561d('0x2f')){_0x135ced=util[_0x561d('0xf')]('%s/token:%s',_0x4dcde9[_0x561d('0x2d')],_0x4dcde9[_0x561d('0x2f')]);}return util[_0x561d('0xf')](_0x561d('0x30'),new Buffer(_0x135ced)['toString'](_0x561d('0x31')));}function request(_0x188848){logger['debug'](_0x561d('0x32'),JSON[_0x561d('0x33')](_0x188848));return rp(_[_0x561d('0x8')](_0x188848,{'method':_0x561d('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x49a125,_0x3fa5e2){var _0x262b05=[];if(_0x49a125&&_0x49a125[_0x561d('0x26')]>0x0){_0x262b05=_[_0x561d('0x35')](_0x49a125,_0x3fa5e2);}return _0x262b05;}function getCustomFields(_0x3c8139,_0x58c6b3){var _0x52caaa=[];var _0x136356={'custom_fields':[]};if(_0x3c8139['length']>0x0){_[_0x561d('0x36')](_0x3c8139,function(_0x109f89){if(_[_0x561d('0x37')](['string','picklist'],_0x109f89[_0x561d('0x38')])&&_0x109f89[_0x561d('0x39')]&&!_0x109f89[_0x561d('0x3a')]){_0x136356[_0x109f89[_0x561d('0x39')]['toLowerCase']()]=_0x109f89[_0x561d('0x3b')][_0x561d('0x3c')]();}else if(_[_0x561d('0x37')]([_0x561d('0x3d'),_0x561d('0x3e')],_0x109f89[_0x561d('0x38')])&&_0x109f89['idField']&&_0x109f89['customField']){_0x136356[_0x561d('0x3f')][_0x561d('0x40')]({'id':_0x109f89[_0x561d('0x41')],'value':_0x109f89[_0x561d('0x3b')]['toString']()});}else if(_0x109f89[_0x561d('0x38')]===_0x561d('0x42')&&_0x109f89['variableName']&&_0x109f89['idField']&&_0x109f89[_0x561d('0x3a')]){_0x58c6b3[_0x109f89[_0x561d('0x43')]]&&_0x136356[_0x561d('0x3f')][_0x561d('0x40')]({'id':_0x109f89[_0x561d('0x41')],'value':_0x58c6b3[_0x109f89['variableName']]['toString']()});}else if(_0x109f89[_0x561d('0x38')]===_0x561d('0x44')&&_0x109f89[_0x561d('0x45')]&&_0x109f89['Variable'][_0x561d('0x13')]&&_0x109f89[_0x561d('0x41')]&&_0x109f89[_0x561d('0x3a')]){_0x58c6b3[_0x109f89[_0x561d('0x45')][_0x561d('0x13')][_0x561d('0x46')]()]&&_0x136356[_0x561d('0x3f')][_0x561d('0x40')]({'id':_0x109f89[_0x561d('0x41')],'value':_0x58c6b3[_0x109f89['Variable']['name'][_0x561d('0x46')]()]['toString']()});}});}return _0x136356;}exports[_0x561d('0x47')]=function(_0x4e4e75,_0x1b64cc,_0x110649,_0x519330,_0x31880c,_0x3d6863){var _0x59fb7b,_0x5e0278;_0x3d6863['remoteUri']=intUtil[_0x561d('0x48')](_0x3d6863['remoteUri']);_0x3d6863[_0x561d('0x49')]=intUtil[_0x561d('0x48')](_0x3d6863['serverUrl']);if(_0x31880c&&_0x31880c[_0x561d('0x4a')]){logger['info'](_0x561d('0x4b'),_0x561d('0x4c'));_0x1b64cc[_0x561d('0x4d')]=util[_0x561d('0xf')](_0x561d('0x4e'),_0x3d6863[_0x561d('0x49')],_0x1b64cc[_0x561d('0x4f')],md5(_0x1b64cc['uniqueid']));}else{_0x1b64cc[_0x561d('0x4d')]='';}headers[_0x561d('0x50')]=getAuth(_0x3d6863);return getUser(_0x3d6863,_0x519330['email'])[_0x561d('0x18')](function(_0x446878){_0x59fb7b=_0x446878;logger[_0x561d('0xd')](_0x561d('0x51'),_0x59fb7b['id']);return getEndUser(_0x3d6863,_0x1b64cc[_0x561d('0x52')],_0x1b64cc[_0x561d('0x53')]);})['then'](function(_0x57cca7){_0x5e0278=_0x57cca7;logger[_0x561d('0xd')](_0x561d('0x54'),_0x5e0278['id']);return getTicket(_0x3d6863,_0x59fb7b,_0x5e0278,_0x110649,_0x1b64cc);})['then'](function(_0x356cff){if(_0x356cff){logger['info'](_0x561d('0x55'),_0x356cff['id']);switch(_0x3d6863[_0x561d('0x38')]){case _0x561d('0x56'):logger[_0x561d('0xd')](_0x561d('0x4b'),_0x561d('0x57'));return request({'uri':util[_0x561d('0xf')](_0x561d('0x58'),_0x3d6863[_0x561d('0x11')],_0x59fb7b['id'],_0x356cff['id']),'method':_0x561d('0x59')});case _0x561d('0x5a'):logger['info'](_0x561d('0x4b'),_0x561d('0x5b'));emit(util[_0x561d('0xf')]('user:%s',_0x519330[_0x561d('0x13')]),'trigger:browser:url',{'uri':util[_0x561d('0xf')](_0x561d('0x5c'),_0x3d6863[_0x561d('0x11')][_0x561d('0x5d')]('/api/v2',''),_0x356cff['id'])});break;default:logger['error'](_0x561d('0x4b'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x2cf779){logger[_0x561d('0x5e')](_0x561d('0x5f'),util[_0x561d('0x60')](_0x2cf779,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x3ab1cf,_0x145165,_0x5a4a97,_0x4842f9,_0x640e87,_0x417399,_0x5a7ae0){var _0x326c0d,_0x237338;_0x417399[_0x561d('0x11')]=intUtil[_0x561d('0x48')](_0x417399[_0x561d('0x11')]);_0x417399[_0x561d('0x49')]=intUtil[_0x561d('0x48')](_0x417399['serverUrl']);if(_0x5a7ae0&&_0x5a7ae0[_0x561d('0x61')]&&_0x5a7ae0['recordingFormat']!==_0x561d('0x62')){logger[_0x561d('0xd')](_0x561d('0x63'),_0x561d('0x4c'));_0x145165[_0x561d('0x4d')]=util['format'](_0x561d('0x4e'),_0x417399[_0x561d('0x49')],_0x145165[_0x561d('0x4f')],md5(_0x145165['uniqueid']));}headers['Authorization']=getAuth(_0x417399);return getUser(_0x417399,_0x4842f9['email'])[_0x561d('0x18')](function(_0x30c422){_0x326c0d=_0x30c422;logger[_0x561d('0xd')](_0x561d('0x51'),_0x326c0d['id']);return getEndUser(_0x417399,_0x145165['destcalleridname'],_0x145165['destcalleridnum']);})['then'](function(_0x568612){_0x237338=_0x568612;logger[_0x561d('0xd')](_0x561d('0x54'),_0x237338['id']);return getTicket(_0x417399,_0x326c0d,_0x237338,_0x5a4a97,_0x145165);})[_0x561d('0x18')](function(_0x5c0299){if(_0x5c0299){logger[_0x561d('0xd')](_0x561d('0x55'),_0x5c0299['id']);switch(_0x417399[_0x561d('0x38')]){case'integrationTab':logger['info'](_0x561d('0x63'),_0x561d('0x57'));return request({'uri':util[_0x561d('0xf')](_0x561d('0x58'),_0x417399[_0x561d('0x11')],_0x326c0d['id'],_0x5c0299['id']),'method':'POST'});case _0x561d('0x5a'):logger[_0x561d('0xd')](_0x561d('0x63'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x561d('0xf')](_0x561d('0x64'),_0x4842f9['name']),_0x561d('0x65'),{'uri':util[_0x561d('0xf')](_0x561d('0x5c'),_0x417399[_0x561d('0x11')]['replace'](_0x561d('0x66'),''),_0x5c0299['id'])});break;default:logger[_0x561d('0x5e')]('[OUTBOUND]',_0x561d('0x67'));}}})[_0x561d('0x68')](function(_0x494391){logger['error'](_0x561d('0x69'),util['inspect'](_0x494391,{'showHidden':!![],'depth':null}));});};exports[_0x561d('0x6a')]=function(_0x37b189,_0x37ef09,_0x2d1081,_0x3aabb0,_0x214edd,_0x34ade6){var _0xe269d,_0x5d765e;_0x34ade6[_0x561d('0x11')]=intUtil[_0x561d('0x48')](_0x34ade6[_0x561d('0x11')]);_0x34ade6['serverUrl']=intUtil['stripTrailingSlash'](_0x34ade6['serverUrl']);if(_0x214edd&&_0x214edd[_0x561d('0x4a')]){logger[_0x561d('0xd')]('['+_0x37ef09[_0x561d('0x6b')][_0x561d('0x6c')]()+']',_0x561d('0x4c'));_0x37ef09['recordingURL']=util['format'](_0x561d('0x4e'),_0x34ade6[_0x561d('0x49')],_0x37ef09[_0x561d('0x4f')],md5(_0x37ef09['uniqueid']));}else{_0x37ef09[_0x561d('0x4d')]='';}headers[_0x561d('0x50')]=getAuth(_0x34ade6);return getUser(_0x34ade6)['then'](function(_0x3b206f){_0xe269d=_0x3b206f;logger[_0x561d('0xd')](_0x561d('0x51'),_0xe269d['id']);return getEndUser(_0x34ade6,_0x37ef09[_0x561d('0x52')],_0x37ef09[_0x561d('0x53')]);})[_0x561d('0x18')](function(_0x5485fb){_0x5d765e=_0x5485fb;logger[_0x561d('0xd')](_0x561d('0x54'),_0x5d765e['id']);return getTicket(_0x34ade6,_0xe269d,_0x5d765e,_0x2d1081,_0x37ef09);})[_0x561d('0x18')](function(_0x679aaa){if(_0x679aaa){logger['info'](_0x561d('0x55'),_0x679aaa['id']);}})[_0x561d('0x68')](function(_0x3f7d34){logger['error']('['+_0x37ef09[_0x561d('0x6b')][_0x561d('0x6c')]()+']'+_0x561d('0x6d'),util[_0x561d('0x60')](_0x3f7d34,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xfba4=['/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','./util','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','results','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','username','token','%s/token:%s','toString','[HTTP]','stringify','defaults','GET','forEach','includes','string','type','nameField','customField','toLowerCase','content','picklist','custom_fields','variable','variableName','idField','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[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','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace'];(function(_0x31b35d,_0x89e87c){var _0x36072e=function(_0x597d43){while(--_0x597d43){_0x31b35d['push'](_0x31b35d['shift']());}};_0x36072e(++_0x89e87c);}(_0xfba4,0xf8));var _0x4fba=function(_0x2ef8f1,_0x1280a3){_0x2ef8f1=_0x2ef8f1-0x0;var _0x17498d=_0xfba4[_0x2ef8f1];return _0x17498d;};'use strict';var _=require('lodash');var rp=require(_0x4fba('0x0'));var md5=require(_0x4fba('0x1'));var util=require(_0x4fba('0x2'));var Redis=require(_0x4fba('0x3'));var intUtil=require(_0x4fba('0x4'));var config=require('../../../../config/environment');var logger=require(_0x4fba('0x5'))(_0x4fba('0x6'));config[_0x4fba('0x7')]=_['defaults'](config['redis'],{'host':_0x4fba('0x8'),'port':0x18eb});var io=require(_0x4fba('0x9'))(new Redis(config[_0x4fba('0x7')]));function emit(_0x47e882,_0x3ec0c9,_0x2dedb6){io['to'](_0x47e882)[_0x4fba('0xa')](_0x3ec0c9,_0x2dedb6);}var headers={'Content-Type':_0x4fba('0xb'),'Accept':_0x4fba('0xb')};function getTicket(_0x2d65bf,_0x38c02d,_0x53094b,_0x5143ec,_0x372446){logger['info'](_0x4fba('0xc'));return request({'uri':util['format'](_0x4fba('0xd'),_0x2d65bf[_0x4fba('0xe')]),'method':_0x4fba('0xf'),'body':{'ticket':_['merge']({'requester_id':_0x53094b['id'],'submitter_id':_0x38c02d?_0x38c02d['id']:undefined,'assignee_id':_0x38c02d?_0x38c02d['id']:undefined,'tags':getTags(_0x5143ec[_0x4fba('0x10')],_0x4fba('0x11')),'subject':intUtil[_0x4fba('0x12')](_0x5143ec[_0x4fba('0x13')],_0x372446,'\x20'),'description':intUtil[_0x4fba('0x12')](_0x5143ec['Descriptions'],_0x372446,'\x0a'),'comment':{'public':![],'body':intUtil[_0x4fba('0x12')](_0x5143ec[_0x4fba('0x14')],_0x372446,'\x0a')}},getCustomFields(_0x5143ec[_0x4fba('0x15')],_0x372446))}})[_0x4fba('0x16')](function(_0x4a7615){logger[_0x4fba('0x17')](_0x4fba('0x18'));return _0x4a7615[_0x4fba('0x19')];});}function getUser(_0x131088,_0x9cc27f){if(intUtil[_0x4fba('0x1a')](_0x9cc27f)){logger[_0x4fba('0x17')](_0x4fba('0x1b'),_0x9cc27f);return request({'uri':util[_0x4fba('0x1c')](_0x4fba('0x1d'),_0x131088['remoteUri']),'qs':{'query':util[_0x4fba('0x1c')](_0x4fba('0x1e'),_0x9cc27f)}})[_0x4fba('0x16')](function(_0x391412){if(_0x391412[_0x4fba('0x1f')]){logger[_0x4fba('0x17')](_0x4fba('0x20'));return _['find'](_0x391412['results'],{'email':_0x9cc27f,'role':_0x4fba('0x21')});}else{logger[_0x4fba('0x17')](_0x4fba('0x22'));return request({'uri':util[_0x4fba('0x1c')](_0x4fba('0x23'),_0x131088[_0x4fba('0xe')])})[_0x4fba('0x16')](function(_0x4ec57d){logger[_0x4fba('0x17')](_0x4fba('0x24'));return _0x4ec57d[_0x4fba('0x25')];});}});}else{logger[_0x4fba('0x17')](_0x4fba('0x22'));return request({'uri':util[_0x4fba('0x1c')](_0x4fba('0x23'),_0x131088[_0x4fba('0xe')])})['then'](function(_0x3cf342){logger[_0x4fba('0x17')]('Admin\x20account\x20selected.');return _0x3cf342[_0x4fba('0x25')];});}}function getEndUser(_0x4365f6,_0x1b791c,_0x585568){logger[_0x4fba('0x17')](_0x4fba('0x26'),_0x585568);return request({'uri':util[_0x4fba('0x1c')](_0x4fba('0x1d'),_0x4365f6[_0x4fba('0xe')]),'qs':{'query':util['format'](_0x4fba('0x27'),_0x585568)}})['then'](function(_0x497773){var _0x53a491;if(_0x497773['results'][_0x4fba('0x28')]){_0x497773[_0x4fba('0x29')]=_[_0x4fba('0x2a')](_0x497773[_0x4fba('0x29')],{'suspended':![],'role':_0x4fba('0x2b')});if(_0x497773[_0x4fba('0x29')][_0x4fba('0x28')]){_0x53a491=_[_0x4fba('0x2c')](_0x497773[_0x4fba('0x29')]);}}if(_0x53a491){logger[_0x4fba('0x17')](_0x4fba('0x2d'));return _0x53a491;}else{logger['info'](_0x4fba('0x2e'));return request({'uri':util['format'](_0x4fba('0x2f'),_0x4365f6[_0x4fba('0xe')]),'method':_0x4fba('0xf'),'body':{'user':{'role':_0x4fba('0x2b'),'name':util[_0x4fba('0x1c')](_0x4fba('0x30'),_0x1b791c||_0x585568),'phone':_0x585568}}})[_0x4fba('0x16')](function(_0xbb2ca9){logger[_0x4fba('0x17')](_0x4fba('0x31'));return _0xbb2ca9[_0x4fba('0x25')];});}});}function getAuth(_0x1591f5){var _0x7f88d4;if(_0x1591f5[_0x4fba('0x32')]===_0x4fba('0x33')){_0x7f88d4=util[_0x4fba('0x1c')](_0x4fba('0x34'),_0x1591f5[_0x4fba('0x35')],_0x1591f5[_0x4fba('0x33')]);}else if(_0x1591f5[_0x4fba('0x32')]===_0x4fba('0x36')){_0x7f88d4=util[_0x4fba('0x1c')](_0x4fba('0x37'),_0x1591f5[_0x4fba('0x35')],_0x1591f5[_0x4fba('0x36')]);}return util[_0x4fba('0x1c')]('Basic\x20%s',new Buffer(_0x7f88d4)[_0x4fba('0x38')]('base64'));}function request(_0x566d05){logger['debug'](_0x4fba('0x39'),JSON[_0x4fba('0x3a')](_0x566d05));return rp(_[_0x4fba('0x3b')](_0x566d05,{'method':_0x4fba('0x3c'),'headers':headers,'json':!![]}));}function getTags(_0x50e9c4,_0x2fbe4b){var _0xdc0ef0=[];if(_0x50e9c4&&_0x50e9c4[_0x4fba('0x28')]>0x0){_0xdc0ef0=_['map'](_0x50e9c4,_0x2fbe4b);}return _0xdc0ef0;}function getCustomFields(_0x354421,_0xca96ae){var _0x409f55=[];var _0xd8ab92={'custom_fields':[]};if(_0x354421['length']>0x0){_[_0x4fba('0x3d')](_0x354421,function(_0x1d62a2){if(_[_0x4fba('0x3e')]([_0x4fba('0x3f'),'picklist'],_0x1d62a2[_0x4fba('0x40')])&&_0x1d62a2[_0x4fba('0x41')]&&!_0x1d62a2[_0x4fba('0x42')]){_0xd8ab92[_0x1d62a2[_0x4fba('0x41')][_0x4fba('0x43')]()]=_0x1d62a2[_0x4fba('0x44')][_0x4fba('0x38')]();}else if(_['includes']([_0x4fba('0x3f'),_0x4fba('0x45')],_0x1d62a2[_0x4fba('0x40')])&&_0x1d62a2['idField']&&_0x1d62a2[_0x4fba('0x42')]){_0xd8ab92[_0x4fba('0x46')]['push']({'id':_0x1d62a2['idField'],'value':_0x1d62a2[_0x4fba('0x44')]['toString']()});}else if(_0x1d62a2[_0x4fba('0x40')]===_0x4fba('0x47')&&_0x1d62a2[_0x4fba('0x48')]&&_0x1d62a2[_0x4fba('0x49')]&&_0x1d62a2['customField']){_0xca96ae[_0x1d62a2[_0x4fba('0x48')]]&&_0xd8ab92['custom_fields'][_0x4fba('0x4a')]({'id':_0x1d62a2['idField'],'value':_0xca96ae[_0x1d62a2[_0x4fba('0x48')]][_0x4fba('0x38')]()});}else if(_0x1d62a2[_0x4fba('0x40')]===_0x4fba('0x4b')&&_0x1d62a2['Variable']&&_0x1d62a2[_0x4fba('0x4c')][_0x4fba('0x11')]&&_0x1d62a2[_0x4fba('0x49')]&&_0x1d62a2['customField']){_0xca96ae[_0x1d62a2[_0x4fba('0x4c')][_0x4fba('0x11')][_0x4fba('0x43')]()]&&_0xd8ab92[_0x4fba('0x46')]['push']({'id':_0x1d62a2[_0x4fba('0x49')],'value':_0xca96ae[_0x1d62a2[_0x4fba('0x4c')][_0x4fba('0x11')][_0x4fba('0x43')]()][_0x4fba('0x38')]()});}});}return _0xd8ab92;}exports[_0x4fba('0x4d')]=function(_0x255b47,_0x58adf0,_0x4d6e75,_0x2b62f6,_0x1d9883,_0x2e5449){var _0x4ad422,_0x45d253;_0x2e5449[_0x4fba('0xe')]=intUtil[_0x4fba('0x4e')](_0x2e5449['remoteUri']);_0x2e5449[_0x4fba('0x4f')]=intUtil[_0x4fba('0x4e')](_0x2e5449['serverUrl']);if(_0x1d9883&&_0x1d9883[_0x4fba('0x50')]){logger['info'](_0x4fba('0x51'),_0x4fba('0x52'));_0x58adf0[_0x4fba('0x53')]=util[_0x4fba('0x1c')](_0x4fba('0x54'),_0x2e5449[_0x4fba('0x4f')],_0x58adf0[_0x4fba('0x55')],md5(_0x58adf0[_0x4fba('0x55')]));}else{_0x58adf0[_0x4fba('0x53')]='';}headers[_0x4fba('0x56')]=getAuth(_0x2e5449);return getUser(_0x2e5449,_0x2b62f6[_0x4fba('0x57')])['then'](function(_0xf198b){_0x4ad422=_0xf198b;logger[_0x4fba('0x17')](_0x4fba('0x58'),_0x4ad422['id']);return getEndUser(_0x2e5449,_0x58adf0[_0x4fba('0x59')],_0x58adf0[_0x4fba('0x5a')]);})['then'](function(_0x564dd6){_0x45d253=_0x564dd6;logger[_0x4fba('0x17')](_0x4fba('0x5b'),_0x45d253['id']);return getTicket(_0x2e5449,_0x4ad422,_0x45d253,_0x4d6e75,_0x58adf0);})['then'](function(_0x5503fa){if(_0x5503fa){logger[_0x4fba('0x17')](_0x4fba('0x5c'),_0x5503fa['id']);switch(_0x2e5449[_0x4fba('0x40')]){case _0x4fba('0x5d'):logger['info'](_0x4fba('0x51'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2e5449[_0x4fba('0xe')],_0x4ad422['id'],_0x5503fa['id']),'method':'POST'});case _0x4fba('0x5e'):logger[_0x4fba('0x17')]('[QUEUE]',_0x4fba('0x5f'));emit(util[_0x4fba('0x1c')](_0x4fba('0x60'),_0x2b62f6[_0x4fba('0x11')]),_0x4fba('0x61'),{'uri':util[_0x4fba('0x1c')](_0x4fba('0x62'),_0x2e5449[_0x4fba('0xe')][_0x4fba('0x63')](_0x4fba('0x64'),''),_0x5503fa['id'])});break;default:logger[_0x4fba('0x65')]('[QUEUE]',_0x4fba('0x66'));}}})[_0x4fba('0x67')](function(_0x3b3c0a){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x4fba('0x68')](_0x3b3c0a,{'showHidden':!![],'depth':null}));});};exports[_0x4fba('0x69')]=function(_0x56d31b,_0x19b50b,_0xd2ccf2,_0x1800c9,_0xe65f2,_0x37ce6f,_0x46f05c){var _0x3aa149,_0x36fc3b;_0x37ce6f[_0x4fba('0xe')]=intUtil[_0x4fba('0x4e')](_0x37ce6f[_0x4fba('0xe')]);_0x37ce6f['serverUrl']=intUtil['stripTrailingSlash'](_0x37ce6f[_0x4fba('0x4f')]);if(_0x46f05c&&_0x46f05c['recordingFormat']&&_0x46f05c[_0x4fba('0x6a')]!==_0x4fba('0x6b')){logger[_0x4fba('0x17')](_0x4fba('0x6c'),_0x4fba('0x52'));_0x19b50b[_0x4fba('0x53')]=util[_0x4fba('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x37ce6f[_0x4fba('0x4f')],_0x19b50b[_0x4fba('0x55')],md5(_0x19b50b[_0x4fba('0x55')]));}headers['Authorization']=getAuth(_0x37ce6f);return getUser(_0x37ce6f,_0x1800c9[_0x4fba('0x57')])['then'](function(_0x104609){_0x3aa149=_0x104609;logger[_0x4fba('0x17')](_0x4fba('0x58'),_0x3aa149['id']);return getEndUser(_0x37ce6f,_0x19b50b[_0x4fba('0x6d')],_0x19b50b['destcalleridnum']);})[_0x4fba('0x16')](function(_0x1cd0e8){_0x36fc3b=_0x1cd0e8;logger[_0x4fba('0x17')](_0x4fba('0x5b'),_0x36fc3b['id']);return getTicket(_0x37ce6f,_0x3aa149,_0x36fc3b,_0xd2ccf2,_0x19b50b);})['then'](function(_0x162baf){if(_0x162baf){logger[_0x4fba('0x17')](_0x4fba('0x5c'),_0x162baf['id']);switch(_0x37ce6f[_0x4fba('0x40')]){case _0x4fba('0x5d'):logger[_0x4fba('0x17')](_0x4fba('0x6c'),_0x4fba('0x6e'));return request({'uri':util[_0x4fba('0x1c')](_0x4fba('0x6f'),_0x37ce6f['remoteUri'],_0x3aa149['id'],_0x162baf['id']),'method':_0x4fba('0xf')});case'newTab':logger[_0x4fba('0x17')](_0x4fba('0x6c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x1800c9[_0x4fba('0x11')]),'trigger:browser:url',{'uri':util[_0x4fba('0x1c')](_0x4fba('0x62'),_0x37ce6f[_0x4fba('0xe')][_0x4fba('0x63')](_0x4fba('0x64'),''),_0x162baf['id'])});break;default:logger[_0x4fba('0x65')](_0x4fba('0x6c'),_0x4fba('0x66'));}}})[_0x4fba('0x67')](function(_0x27beb8){logger[_0x4fba('0x65')](_0x4fba('0x70'),util['inspect'](_0x27beb8,{'showHidden':!![],'depth':null}));});};exports[_0x4fba('0x71')]=function(_0x5744bd,_0x8ca35,_0x4d0878,_0x138070,_0x9978da,_0xeffcc6){var _0x3261ee,_0x3fa270;_0xeffcc6['remoteUri']=intUtil[_0x4fba('0x4e')](_0xeffcc6[_0x4fba('0xe')]);_0xeffcc6['serverUrl']=intUtil[_0x4fba('0x4e')](_0xeffcc6[_0x4fba('0x4f')]);if(_0x9978da&&_0x9978da[_0x4fba('0x50')]){logger[_0x4fba('0x17')]('['+_0x8ca35['lastevent'][_0x4fba('0x72')]()+']','Recording\x20is\x20enabled!');_0x8ca35[_0x4fba('0x53')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xeffcc6['serverUrl'],_0x8ca35[_0x4fba('0x55')],md5(_0x8ca35['uniqueid']));}else{_0x8ca35[_0x4fba('0x53')]='';}headers['Authorization']=getAuth(_0xeffcc6);return getUser(_0xeffcc6)[_0x4fba('0x16')](function(_0xe48ac9){_0x3261ee=_0xe48ac9;logger[_0x4fba('0x17')]('The\x20User\x20ID\x20is:',_0x3261ee['id']);return getEndUser(_0xeffcc6,_0x8ca35[_0x4fba('0x59')],_0x8ca35[_0x4fba('0x5a')]);})[_0x4fba('0x16')](function(_0x3efb7d){_0x3fa270=_0x3efb7d;logger[_0x4fba('0x17')]('The\x20Enduser\x20ID\x20is:',_0x3fa270['id']);return getTicket(_0xeffcc6,_0x3261ee,_0x3fa270,_0x4d0878,_0x8ca35);})[_0x4fba('0x16')](function(_0x4ed67d){if(_0x4ed67d){logger[_0x4fba('0x17')](_0x4fba('0x5c'),_0x4ed67d['id']);}})['catch'](function(_0x2d7ebb){logger[_0x4fba('0x65')]('['+_0x8ca35['lastevent'][_0x4fba('0x72')]()+']'+_0x4fba('0x73'),util['inspect'](_0x2d7ebb,{'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 986a928..33dc27a 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 _0xc188=['connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','agentcalledAt','Inbound','merge','/crm/v2/Calls','code','SUCCESS','log','err','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','/downloads?type=uniqueid&token=','host','zoho.eu','email','calleridname','calleridnum','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','recordingURL','/api/voice/recordings/','com','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','The\x20Call\x20ID\x20is:','lodash','request-promise','md5','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','debug','[HTTP]','stringify','length','includes','string','type','idField','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','refreshToken','clientId','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','details','enduserType','Error:\x20','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','format','lastevent','called','Call_Result','complete'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xc188,0xc8));var _0x8c18=function(_0x5153fb,_0x31b17e){_0x5153fb=_0x5153fb-0x0;var _0x29c717=_0xc188[_0x5153fb];return _0x29c717;};'use strict';var _=require(_0x8c18('0x0'));var rp=require(_0x8c18('0x1'));var md5=require(_0x8c18('0x2'));var util=require('util');var intUtil=require(_0x8c18('0x3'));var moment=require(_0x8c18('0x4'));var Redis=require(_0x8c18('0x5'));var BPromise=require('bluebird');var config=require(_0x8c18('0x6'));var logger=require(_0x8c18('0x7'))('zoho');config['redis']=_[_0x8c18('0x8')](config[_0x8c18('0x9')],{'host':_0x8c18('0xa'),'port':0x18eb});var io=require(_0x8c18('0xb'))(new Redis(config[_0x8c18('0x9')]));function emit(_0x21919e,_0x1bdd29,_0x50f449){io['to'](_0x21919e)['emit'](_0x1bdd29,_0x50f449);}function request(_0x1e780f){logger[_0x8c18('0xc')](_0x8c18('0xd'),JSON[_0x8c18('0xe')](_0x1e780f));return rp(_0x1e780f);}function getCustomFields(_0xc71302,_0x50ff20){var _0x25199a={};if(_0xc71302[_0x8c18('0xf')]>0x0){_['forEach'](_0xc71302,function(_0x4f6b59){if(_[_0x8c18('0x10')]([_0x8c18('0x11'),'picklist'],_0x4f6b59[_0x8c18('0x12')])&&_0x4f6b59[_0x8c18('0x13')]){_0x25199a[_0x4f6b59[_0x8c18('0x13')]]=_0x4f6b59['content'][_0x8c18('0x14')]();}else if(_0x4f6b59[_0x8c18('0x12')]===_0x8c18('0x15')&&_0x4f6b59[_0x8c18('0x16')]&&_0x4f6b59[_0x8c18('0x13')]&&_0x50ff20[_0x4f6b59[_0x8c18('0x16')]]){_0x25199a[_0x4f6b59[_0x8c18('0x13')]]=_0x50ff20[_0x4f6b59['variableName']][_0x8c18('0x14')]();}else if(_0x4f6b59[_0x8c18('0x12')]==='customVariable'&&_0x4f6b59[_0x8c18('0x17')]&&_0x4f6b59[_0x8c18('0x17')][_0x8c18('0x18')]&&_0x4f6b59[_0x8c18('0x13')]&&_0x50ff20[_0x4f6b59[_0x8c18('0x17')]['name'][_0x8c18('0x19')]()]){_0x25199a[_0x4f6b59[_0x8c18('0x13')]]=_0x50ff20[_0x4f6b59['Variable'][_0x8c18('0x18')][_0x8c18('0x19')]()][_0x8c18('0x14')]();}});}return _0x25199a;}function getName(_0x5e8084){if(_0x5e8084[_0x8c18('0x1a')]('\x20')>0x0){var _0x5242f3=_0x5e8084[_0x8c18('0x1b')](/ (.+)/);if(_0x5242f3[0x1]){return _0x5242f3;}}return[_0x5e8084,_0x5e8084];}var accountsTokens={};function getAccessToken(_0x3cd0ea){return new Promise(function(_0x5a6554,_0xbee7e9){if(!_[_0x8c18('0x1c')](accountsTokens[_0x3cd0ea['id']])&&!_[_0x8c18('0x1c')](accountsTokens[_0x3cd0ea['id']][_0x8c18('0x1d')])){if(moment()[_0x8c18('0x1e')](accountsTokens[_0x3cd0ea['id']][_0x8c18('0x1f')])){_0x5a6554(accountsTokens[_0x3cd0ea['id']][_0x8c18('0x1d')]);}}var _0x263aeb;switch(_0x3cd0ea['zone']){case'US':_0x263aeb=_0x8c18('0x20');break;case'AU':_0x263aeb=_0x8c18('0x21');break;case'EU':_0x263aeb=_0x8c18('0x22');break;case'IN':_0x263aeb=_0x8c18('0x23');break;case'CN':_0x263aeb='https://accounts.zoho.com.cn';break;default:_0x263aeb=_0x8c18('0x22');break;}var _0xa6e802={'method':'POST','uri':_0x263aeb+_0x8c18('0x24'),'qs':{'refresh_token':_0x3cd0ea[_0x8c18('0x25')],'client_id':_0x3cd0ea[_0x8c18('0x26')],'client_secret':_0x3cd0ea['clientSecret'],'grant_type':_0x8c18('0x27')},'json':!![]};return rp(_0xa6e802)[_0x8c18('0x28')](function(_0x33cef0){accountsTokens[_0x3cd0ea['id']]={'access_token':_0x33cef0['access_token'],'expires_in':moment()[_0x8c18('0x29')](_0x33cef0[_0x8c18('0x1f')],_0x8c18('0x2a'))};_0x5a6554(_0x33cef0[_0x8c18('0x1d')]);})[_0x8c18('0x2b')](function(_0xcae960){logger[_0x8c18('0x2c')](_0x8c18('0x2d'),_0xcae960[_0x8c18('0x2e')]);_0xbee7e9(_0xcae960);});});}function getUser(_0x12ffc6,_0x2a05dc,_0x146e0f,_0x470b8e){logger[_0x8c18('0x2f')]('Search\x20user');return request({'method':'GET','uri':util['format'](_0x8c18('0x30'),_0x2a05dc),'qs':{'type':_0x8c18('0x31')},'headers':{'Authorization':_0x8c18('0x32')+_0x12ffc6},'json':!![]})[_0x8c18('0x28')](function(_0x245059){if(_0x245059[_0x8c18('0x33')]){var _0x2335e2=-0x1;if(_[_0x8c18('0x34')](_0x245059[_0x8c18('0x33')])){if(!_[_0x8c18('0x1c')](_0x470b8e)){_0x2335e2=_[_0x8c18('0x35')](_0x245059[_0x8c18('0x33')],function(_0x674366){return _0x674366['email']===_0x470b8e;});}if(_0x2335e2>=0x0){logger['info']('Agent\x20found!');}else{logger['info'](_0x8c18('0x36'));_0x2335e2=_[_0x8c18('0x35')](_0x245059['users'],function(_0x5aaffc){return _0x5aaffc[_0x8c18('0x37')]['name']===_0x8c18('0x38');});}return _0x245059[_0x8c18('0x33')][_0x2335e2];}else{if(_0x245059[_0x8c18('0x39')][_0x8c18('0x37')][_0x8c18('0x18')]==='Administrator'){logger[_0x8c18('0x2f')](_0x8c18('0x36'));user=_0x245059['user'];return user;}else{logger[_0x8c18('0x2c')](_0x8c18('0x3a'),JSON[_0x8c18('0xe')](_0x245059));throw new Error(_0x8c18('0x3b')+JSON[_0x8c18('0xe')](_0x245059));}}}else{logger['error'](_0x8c18('0x3a'),JSON['stringify'](_0x245059));throw new Error(_0x8c18('0x3b')+JSON[_0x8c18('0xe')](_0x245059));}})[_0x8c18('0x2b')](function(_0x19b72b){console[_0x8c18('0x2c')](_0x19b72b);});}function getZohoUser(_0x1b2d62,_0x3c9afe){return new BPromise(function(_0xa33e4f,_0x4ebec3){request(_0x1b2d62)[_0x8c18('0x28')](function(_0x2c1c6a){var _0x3f9409=null;if(_0x2c1c6a){_0x3f9409=_0x2c1c6a[_0x8c18('0x3c')][0x0];_0x3f9409['enduserType']=_0x3c9afe;}_0xa33e4f(_0x3f9409);})[_0x8c18('0x2b')](function(_0x46cfb0){_0x4ebec3(_0x46cfb0);});});}function createEndUser(_0x3b4ac6,_0x523fbc,_0x147672,_0x305d3e,_0x163c6f,_0x365657){var _0x147672=getName(_0x147672);return request({'method':_0x8c18('0x3d'),'uri':_0x8c18('0x3e')+_0x523fbc+_0x8c18('0x3f')+_[_0x8c18('0x40')](_0x365657[_0x8c18('0x41')])+'s','body':{'data':[{'Last_Name':_0x147672[0x1],'First_Name':_0x147672[0x0],'Phone':_0x305d3e,'Owner':{'name':!_[_0x8c18('0x1c')](_0x163c6f[_0x8c18('0x42')][_0x8c18('0x18')])?_0x163c6f['role']['name']:!_[_0x8c18('0x1c')](_0x163c6f['first_name'])?_0x163c6f[_0x8c18('0x43')]+'\x20'+_0x163c6f['last_name']:_0x163c6f[_0x8c18('0x44')],'id':_0x163c6f['id']}}]},'headers':{'Authorization':_0x8c18('0x32')+_0x3b4ac6},'json':!![]})[_0x8c18('0x28')](function(_0x4ebafe){if(_0x4ebafe&&_0x4ebafe[_0x8c18('0x3c')][0x0]['code']==='SUCCESS'){var _0x3f3a22=_0x4ebafe[_0x8c18('0x3c')][0x0][_0x8c18('0x45')];_0x3f3a22[_0x8c18('0x46')]=_[_0x8c18('0x40')](_0x365657[_0x8c18('0x41')])+'s';return _0x3f3a22;}logger[_0x8c18('0x2c')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0x8c18('0x47')+JSON[_0x8c18('0xe')](data));})[_0x8c18('0x2b')](function(_0x14c245){console['log'](_0x8c18('0x48'),_0x14c245);});}function getEndUser(_0x25c250,_0x591dc3,_0x4e7f82,_0x5158fc,_0x2345f4,_0x155984,_0xdef9f2){var _0x242928={'method':_0x8c18('0x49'),'uri':'','headers':{'Authorization':_0x8c18('0x32')+_0x25c250},'json':!![]};switch(_0xdef9f2[_0x8c18('0x4a')]){case _0x8c18('0x4b'):_0x242928[_0x8c18('0x4c')]=_0x8c18('0x3e')+_0x591dc3+_0x8c18('0x4d')+_0x2345f4+'))';return getZohoUser(_0x242928,_0x8c18('0x4e'))[_0x8c18('0x28')](function(_0x3fec6e){if(_0x3fec6e)return _0x3fec6e;_0x242928[_0x8c18('0x4c')]=_0x8c18('0x3e')+_0x591dc3+_0x8c18('0x4f')+_0x2345f4+'))';return getZohoUser(_0x242928,_0x8c18('0x50'))['then'](function(_0x1cbd49){if(_0x1cbd49)return _0x1cbd49;if(_0xdef9f2[_0x8c18('0x41')]!=_0x8c18('0x51')){return createEndUser(_0x25c250,_0x591dc3,_0x5158fc,_0x2345f4,_0x155984,_0xdef9f2);}else{return{};}});});break;case'contact':_0x242928['uri']=_0x8c18('0x3e')+_0x591dc3+_0x8c18('0x4d')+_0x2345f4+'))';return getZohoUser(_0x242928,_0x8c18('0x4e'))[_0x8c18('0x28')](function(_0x262c2f){if(_0x262c2f)return _0x262c2f;if(_0xdef9f2[_0x8c18('0x41')]!=_0x8c18('0x51')){return createEndUser(_0x25c250,_0x591dc3,_0x5158fc,_0x2345f4,_0x155984,_0xdef9f2);}else{return{};}});break;case _0x8c18('0x52'):_0x242928[_0x8c18('0x4c')]='https://www.zohoapis.'+_0x591dc3+_0x8c18('0x4f')+_0x2345f4+'))';return getZohoUser(_0x242928,'Leads')[_0x8c18('0x28')](function(_0x183a59){if(_0x183a59)return _0x183a59;if(_0xdef9f2[_0x8c18('0x41')]!=_0x8c18('0x51')){return createEndUser(_0x25c250,_0x591dc3,_0x5158fc,_0x2345f4,_0x155984,_0xdef9f2);}else{return{};}});break;}}function getCall(_0x1909a0,_0x340155,_0x4e0269,_0x14abbf,_0x8866d4,_0x2ccd09,_0x492cd6,_0x435f6c){logger['info']('Creating\x20new\x20call...');var _0x3114f5={};_0x3114f5[_0x8c18('0x53')]={'name':!_[_0x8c18('0x1c')](_0x14abbf[_0x8c18('0x42')][_0x8c18('0x18')])&&!_['isNil'](_0x14abbf[_0x8c18('0x37')]['name'])&&_0x14abbf[_0x8c18('0x37')][_0x8c18('0x18')]===_0x8c18('0x54')?_0x14abbf[_0x8c18('0x42')][_0x8c18('0x18')]:!_['isNil'](_0x14abbf['first_name'])?_0x14abbf[_0x8c18('0x43')]+'\x20'+_0x14abbf[_0x8c18('0x44')]:_0x14abbf[_0x8c18('0x44')],'id':_0x14abbf['id']};_0x3114f5[_0x8c18('0x55')]=intUtil[_0x8c18('0x56')](_0x2ccd09[_0x8c18('0x57')],_0x492cd6,'\x20');_0x3114f5[_0x8c18('0x58')]=intUtil[_0x8c18('0x56')](_0x2ccd09[_0x8c18('0x59')],_0x492cd6,'\x0a');if(_0x8866d4[_0x8c18('0x46')]==='Contacts'){_0x3114f5[_0x8c18('0x5a')]={'name':!_[_0x8c18('0x1c')](_0x8866d4[_0x8c18('0x5b')])?_0x8866d4[_0x8c18('0x5b')]:!_[_0x8c18('0x1c')](_0x8866d4['First_Name'])?_0x8866d4[_0x8c18('0x5c')]+'\x20'+_0x8866d4[_0x8c18('0x5d')]:_0x8866d4[_0x8c18('0x5d')],'id':_0x8866d4['id']};}if(_0x8866d4[_0x8c18('0x46')]===_0x8c18('0x50')){_0x3114f5[_0x8c18('0x5e')]={'name':!_[_0x8c18('0x1c')](_0x8866d4[_0x8c18('0x5b')])?_0x8866d4['Full_Name']:!_[_0x8c18('0x1c')](_0x8866d4[_0x8c18('0x5c')])?_0x8866d4['First_Name']+'\x20'+_0x8866d4['Last_Name']:_0x8866d4[_0x8c18('0x5d')],'id':_0x8866d4['id']};_0x3114f5[_0x8c18('0x5f')]=_[_0x8c18('0x40')](_0x8866d4[_0x8c18('0x46')]);}if(_0x492cd6['talktime']){_0x3114f5[_0x8c18('0x60')]=moment[_0x8c18('0x61')](parseInt(_0x492cd6['talktime'])*0x3e8)['format'](_0x8c18('0x62'));}else if(_0x492cd6['answertime']&&_0x492cd6[_0x8c18('0x63')]){_0x3114f5[_0x8c18('0x60')]=moment[_0x8c18('0x61')](moment(_0x492cd6[_0x8c18('0x63')],_0x8c18('0x64'))[_0x8c18('0x65')](moment(_0x492cd6[_0x8c18('0x66')],_0x8c18('0x64'))))[_0x8c18('0x67')](_0x8c18('0x62'));}switch(_0x492cd6[_0x8c18('0x68')]){case _0x8c18('0x69'):_0x3114f5[_0x8c18('0x6a')]='Called';break;case _0x8c18('0x6b'):case _0x8c18('0x6c'):_0x3114f5[_0x8c18('0x6a')]=_0x8c18('0x6d');break;case _0x8c18('0x6e'):_0x3114f5[_0x8c18('0x6a')]=_0x8c18('0x6f');break;case _0x8c18('0x70'):_0x3114f5[_0x8c18('0x6a')]=_0x8c18('0x71');break;case _0x8c18('0x72'):_0x3114f5[_0x8c18('0x6a')]=_0x8c18('0x73');default:}_0x3114f5['Call_Start_Time']=(_0x435f6c===_0x8c18('0x74')?moment(_0x492cd6[_0x8c18('0x66')])[_0x8c18('0x67')](_0x8c18('0x64')):moment(_0x492cd6[_0x8c18('0x75')])[_0x8c18('0x67')](_0x8c18('0x64')))||moment()[_0x8c18('0x67')](_0x8c18('0x64'));_0x3114f5['Call_Type']=_0x435f6c||_0x8c18('0x76');_0x3114f5=_[_0x8c18('0x77')](_0x3114f5,getCustomFields(_0x2ccd09['Fields'],_0x492cd6));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x340155+_0x8c18('0x78'),'headers':{'Authorization':_0x8c18('0x32')+_0x1909a0},'body':{'data':[_0x3114f5]},'json':!![]})['then'](function(_0x1ebca4){if(_0x1ebca4&&_0x1ebca4['data'][0x0][_0x8c18('0x79')]===_0x8c18('0x7a')){logger[_0x8c18('0x2f')]('Call\x20created!');return{'id':_0x1ebca4['data'][0x0][_0x8c18('0x45')]['id']};}})[_0x8c18('0x2b')](function(_0x419fd7){logger[_0x8c18('0x2f')]('err',_0x419fd7[_0x8c18('0x2e')]);console[_0x8c18('0x7b')](_0x8c18('0x7c'),_0x419fd7);});}exports[_0x8c18('0x7d')]=function(_0x63331c,_0x5ea64f,_0x492ea1,_0x6c7bd7,_0x5a4f62,_0x51f181){var _0x36df6f,_0x33911e,_0x101ced;_0x51f181['host']=intUtil[_0x8c18('0x7e')](_0x51f181['host']);_0x51f181['serverUrl']=intUtil[_0x8c18('0x7e')](_0x51f181[_0x8c18('0x7f')]);if(_0x5a4f62&&_0x5a4f62[_0x8c18('0x80')]){logger['info'](_0x8c18('0x81'),_0x8c18('0x82'));_0x5ea64f['recordingURL']=_0x51f181[_0x8c18('0x7f')]+'/api/voice/recordings/'+_0x5ea64f[_0x8c18('0x83')]+_0x8c18('0x84')+md5(_0x5ea64f[_0x8c18('0x83')]);}else{_0x5ea64f['recordingURL']='';}var _0x4f2f40=_0x51f181[_0x8c18('0x85')]===_0x8c18('0x86')?'eu':'com';return getAccessToken(_0x51f181)[_0x8c18('0x28')](function(_0xf3e3df){_0x101ced=_0xf3e3df;return getUser(_0x101ced,_0x4f2f40,_0x51f181,_0x6c7bd7[_0x8c18('0x87')]);})[_0x8c18('0x28')](function(_0x35d6db){_0x36df6f=_0x35d6db;logger['info']('The\x20User\x20ID\x20is:',_0x36df6f['id']);return getEndUser(_0x101ced,_0x4f2f40,_0x51f181,_0x5ea64f[_0x8c18('0x88')],_0x5ea64f[_0x8c18('0x89')],_0x36df6f,_0x492ea1);})['then'](function(_0x49c5af){_0x33911e=_0x49c5af;return getCall(_0x101ced,_0x4f2f40,_0x51f181,_0x36df6f,_0x33911e,_0x492ea1,_0x5ea64f,_0x8c18('0x76'));})[_0x8c18('0x28')](function(_0xf3e375){if(_0xf3e375){logger[_0x8c18('0x2f')]('The\x20Call\x20ID\x20is:',_0xf3e375['id']);logger[_0x8c18('0x2f')](_0x8c18('0x81'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8c18('0x67')](_0x8c18('0x8a'),_0x6c7bd7['name']),_0x8c18('0x8b'),{'uri':_0x8c18('0x8c')+_0x51f181['host']+_0x8c18('0x8d')+_0xf3e375['id']});}})['catch'](function(_0xcd3b93){logger[_0x8c18('0x2c')](_0x8c18('0x81'),JSON[_0x8c18('0xe')](_0xcd3b93));});};exports[_0x8c18('0x74')]=function(_0x5b3b8b,_0x463314,_0x1c6ea7,_0x2bb1e8,_0x10f7e1,_0x5d0f9b,_0x3af068){var _0x212879,_0x24b6c0,_0x14eeb9;_0x5d0f9b['host']=intUtil['stripTrailingSlash'](_0x5d0f9b[_0x8c18('0x85')]);_0x5d0f9b[_0x8c18('0x7f')]=intUtil[_0x8c18('0x7e')](_0x5d0f9b[_0x8c18('0x7f')]);if(_0x3af068&&_0x3af068[_0x8c18('0x8e')]&&_0x3af068[_0x8c18('0x8e')]!=='none'){logger['info'](_0x8c18('0x8f'),_0x8c18('0x82'));_0x463314[_0x8c18('0x90')]=_0x5d0f9b[_0x8c18('0x7f')]+_0x8c18('0x91')+_0x463314[_0x8c18('0x83')]+_0x8c18('0x84')+md5(_0x463314[_0x8c18('0x83')]);}var _0xe55976=_0x5d0f9b[_0x8c18('0x85')]===_0x8c18('0x86')?'eu':_0x8c18('0x92');return getAccessToken(_0x5d0f9b)['then'](function(_0x1e201b){_0x14eeb9=_0x1e201b;return getUser(_0x14eeb9,_0xe55976,_0x5d0f9b,_0x2bb1e8[_0x8c18('0x87')]);})[_0x8c18('0x28')](function(_0xe696fa){_0x212879=_0xe696fa;logger['info'](_0x8c18('0x93'),_0x212879['id']);return getEndUser(_0x14eeb9,_0xe55976,_0x5d0f9b,_0x463314['destcalleridname'],_0x463314[_0x8c18('0x94')],_0x212879,_0x1c6ea7);})['then'](function(_0x5f5c0c){_0x24b6c0=_0x5f5c0c;return getCall(_0x14eeb9,_0xe55976,_0x5d0f9b,_0x212879,_0x24b6c0,_0x1c6ea7,_0x463314,_0x8c18('0x95'));})[_0x8c18('0x28')](function(_0x32ab2b){if(_0x32ab2b){logger[_0x8c18('0x2f')]('The\x20Call\x20ID\x20is:',_0x32ab2b['id']);logger['info'](_0x8c18('0x8f'),_0x8c18('0x96'));emit(util['format'](_0x8c18('0x8a'),_0x2bb1e8[_0x8c18('0x18')]),'trigger:browser:url',{'uri':_0x8c18('0x8c')+_0x5d0f9b[_0x8c18('0x85')]+'/crm/EntityInfo.do?module=Calls&id='+_0x32ab2b['id']});}})[_0x8c18('0x2b')](function(_0x403fed){logger[_0x8c18('0x2c')](_0x8c18('0x8f'),JSON[_0x8c18('0xe')](_0x403fed));});};exports[_0x8c18('0x97')]=function(_0x4f587a,_0x170d35,_0x593b06,_0x146a42,_0x5541bb,_0x134055){var _0x47d086,_0xfd1e5,_0x133491;_0x134055['host']=intUtil[_0x8c18('0x7e')](_0x134055[_0x8c18('0x85')]);_0x134055['serverUrl']=intUtil[_0x8c18('0x7e')](_0x134055[_0x8c18('0x7f')]);if(_0x5541bb&&_0x5541bb['monitor_format']){logger['info']('['+_0x170d35[_0x8c18('0x68')][_0x8c18('0x98')]()+']',_0x8c18('0x82'));_0x170d35[_0x8c18('0x90')]=_0x134055['serverUrl']+_0x8c18('0x91')+_0x170d35[_0x8c18('0x83')]+_0x8c18('0x84')+md5(_0x170d35['uniqueid']);}else{_0x170d35[_0x8c18('0x90')]='';}var _0x237c24=_0x134055[_0x8c18('0x85')]===_0x8c18('0x86')?'eu':_0x8c18('0x92');return getAccessToken(_0x134055)[_0x8c18('0x28')](function(_0x5db097){_0x133491=_0x5db097;return getUser(_0x133491,_0x237c24,_0x134055);})[_0x8c18('0x28')](function(_0x20d463){_0x47d086=_0x20d463;logger[_0x8c18('0x2f')](_0x8c18('0x93'),_0x47d086['id']);return getEndUser(_0x133491,_0x237c24,_0x134055,_0x170d35['calleridname'],_0x170d35['calleridnum'],_0x47d086,_0x593b06);})[_0x8c18('0x28')](function(_0x4eec45){_0xfd1e5=_0x4eec45;return getCall(_0x133491,_0x237c24,_0x134055,_0x47d086,_0xfd1e5,_0x593b06,_0x170d35,_0x8c18('0x76'));})['then'](function(_0x5da10e){if(_0x5da10e){logger[_0x8c18('0x2f')](_0x8c18('0x99'),_0x5da10e['id']);}})[_0x8c18('0x2b')](function(_0x31e74e){logger[_0x8c18('0x2c')]('['+_0x170d35[_0x8c18('0x68')][_0x8c18('0x98')]()+']',JSON[_0x8c18('0xe')](_0x31e74e));});}; \ No newline at end of file +var _0x3079=['then','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','last_name','code','SUCCESS','details','moduleCreate','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Creating\x20new\x20call...','Owner','administrator','first_name','Subject','getString','Subjects','Description','Descriptions','First_Name','Last_Name','What_Id','Full_Name','$se_module','talktime','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Called','Call_Result','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','calleridnum','[QUEUE]','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','/api/voice/recordings/','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','[OUTBOUND]','unmanaged','monitor_format','toUpperCase','lodash','request-promise','util','./util','moment','ioredis','bluebird','../../../../config/logger','zoho','redis','localhost','emit','debug','[HTTP]','stringify','forEach','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','refresh_token'];(function(_0x1c635a,_0x216a2d){var _0x3f1ce6=function(_0x382b50){while(--_0x382b50){_0x1c635a['push'](_0x1c635a['shift']());}};_0x3f1ce6(++_0x216a2d);}(_0x3079,0x112));var _0x9307=function(_0x13f9c3,_0x2036c0){_0x13f9c3=_0x13f9c3-0x0;var _0x22185a=_0x3079[_0x13f9c3];return _0x22185a;};'use strict';var _=require(_0x9307('0x0'));var rp=require(_0x9307('0x1'));var md5=require('md5');var util=require(_0x9307('0x2'));var intUtil=require(_0x9307('0x3'));var moment=require(_0x9307('0x4'));var Redis=require(_0x9307('0x5'));var BPromise=require(_0x9307('0x6'));var config=require('../../../../config/environment');var logger=require(_0x9307('0x7'))(_0x9307('0x8'));config[_0x9307('0x9')]=_['defaults'](config['redis'],{'host':_0x9307('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x4f511b,_0x1cc526,_0x23a58b){io['to'](_0x4f511b)[_0x9307('0xb')](_0x1cc526,_0x23a58b);}function request(_0x19015f){logger[_0x9307('0xc')](_0x9307('0xd'),JSON[_0x9307('0xe')](_0x19015f));return rp(_0x19015f);}function getCustomFields(_0x51da52,_0x2d02ef){var _0x294aa8={};if(_0x51da52['length']>0x0){_[_0x9307('0xf')](_0x51da52,function(_0x213aa9){if(_[_0x9307('0x10')](['string',_0x9307('0x11')],_0x213aa9[_0x9307('0x12')])&&_0x213aa9[_0x9307('0x13')]){_0x294aa8[_0x213aa9[_0x9307('0x13')]]=_0x213aa9[_0x9307('0x14')][_0x9307('0x15')]();}else if(_0x213aa9[_0x9307('0x12')]===_0x9307('0x16')&&_0x213aa9['variableName']&&_0x213aa9[_0x9307('0x13')]&&_0x2d02ef[_0x213aa9[_0x9307('0x17')]]){_0x294aa8[_0x213aa9[_0x9307('0x13')]]=_0x2d02ef[_0x213aa9['variableName']]['toString']();}else if(_0x213aa9[_0x9307('0x12')]===_0x9307('0x18')&&_0x213aa9[_0x9307('0x19')]&&_0x213aa9['Variable']['name']&&_0x213aa9[_0x9307('0x13')]&&_0x2d02ef[_0x213aa9['Variable'][_0x9307('0x1a')]['toLowerCase']()]){_0x294aa8[_0x213aa9['idField']]=_0x2d02ef[_0x213aa9[_0x9307('0x19')]['name'][_0x9307('0x1b')]()]['toString']();}});}return _0x294aa8;}function getName(_0x1fccfa){if(_0x1fccfa[_0x9307('0x1c')]('\x20')>0x0){var _0x191027=_0x1fccfa[_0x9307('0x1d')](/ (.+)/);if(_0x191027[0x1]){return _0x191027;}}return[_0x1fccfa,_0x1fccfa];}var accountsTokens={};function getAccessToken(_0x5f4dbf){return new Promise(function(_0xda3c18,_0x4f26a8){if(!_[_0x9307('0x1e')](accountsTokens[_0x5f4dbf['id']])&&!_[_0x9307('0x1e')](accountsTokens[_0x5f4dbf['id']][_0x9307('0x1f')])){if(moment()[_0x9307('0x20')](accountsTokens[_0x5f4dbf['id']][_0x9307('0x21')])){_0xda3c18(accountsTokens[_0x5f4dbf['id']][_0x9307('0x1f')]);}}var _0x1960e9;switch(_0x5f4dbf[_0x9307('0x22')]){case'US':_0x1960e9=_0x9307('0x23');break;case'AU':_0x1960e9='https://accounts.zoho.com.au';break;case'EU':_0x1960e9='https://accounts.zoho.eu';break;case'IN':_0x1960e9=_0x9307('0x24');break;case'CN':_0x1960e9=_0x9307('0x25');break;default:_0x1960e9=_0x9307('0x26');break;}var _0x565464={'method':_0x9307('0x27'),'uri':_0x1960e9+_0x9307('0x28'),'qs':{'refresh_token':_0x5f4dbf[_0x9307('0x29')],'client_id':_0x5f4dbf[_0x9307('0x2a')],'client_secret':_0x5f4dbf['clientSecret'],'grant_type':_0x9307('0x2b')},'json':!![]};return rp(_0x565464)[_0x9307('0x2c')](function(_0x19b79a){accountsTokens[_0x5f4dbf['id']]={'access_token':_0x19b79a['access_token'],'expires_in':moment()['add'](_0x19b79a[_0x9307('0x21')],'seconds')};_0xda3c18(_0x19b79a[_0x9307('0x1f')]);})[_0x9307('0x2d')](function(_0x3dcf14){logger[_0x9307('0x2e')](_0x9307('0x2f'),_0x3dcf14[_0x9307('0x30')]);_0x4f26a8(_0x3dcf14);});});}function getUser(_0x397855,_0x4bca19,_0x24190b,_0x5c88be){logger[_0x9307('0x31')]('Search\x20user');return request({'method':'GET','uri':util[_0x9307('0x32')](_0x9307('0x33'),_0x4bca19),'qs':{'type':_0x9307('0x34')},'headers':{'Authorization':_0x9307('0x35')+_0x397855},'json':!![]})['then'](function(_0x4020c4){if(_0x4020c4['users']){var _0x36f395=-0x1;if(_[_0x9307('0x36')](_0x4020c4[_0x9307('0x37')])){if(!_['isNil'](_0x5c88be)){_0x36f395=_[_0x9307('0x38')](_0x4020c4['users'],function(_0x49b895){return _0x49b895['email']===_0x5c88be;});}if(_0x36f395>=0x0){logger[_0x9307('0x31')](_0x9307('0x39'));}else{logger[_0x9307('0x31')](_0x9307('0x3a'));_0x36f395=_[_0x9307('0x38')](_0x4020c4[_0x9307('0x37')],function(_0x6f3531){return _0x6f3531[_0x9307('0x3b')]['name']===_0x9307('0x3c');});}return _0x4020c4[_0x9307('0x37')][_0x36f395];}else{if(_0x4020c4['user'][_0x9307('0x3b')]['name']===_0x9307('0x3c')){logger[_0x9307('0x31')](_0x9307('0x3a'));user=_0x4020c4['user'];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](_0x4020c4));throw new Error(_0x9307('0x3d')+JSON[_0x9307('0xe')](_0x4020c4));}}}else{logger[_0x9307('0x2e')](_0x9307('0x3e'),JSON[_0x9307('0xe')](_0x4020c4));throw new Error(_0x9307('0x3d')+JSON[_0x9307('0xe')](_0x4020c4));}})[_0x9307('0x2d')](function(_0x26cf6c){console['error'](_0x26cf6c);});}function getZohoUser(_0x59ee24,_0x3a176f){return new BPromise(function(_0x34c396,_0x29b089){request(_0x59ee24)['then'](function(_0x4343ce){var _0x573b00=null;if(_0x4343ce){_0x573b00=_0x4343ce[_0x9307('0x3f')][0x0];_0x573b00[_0x9307('0x40')]=_0x3a176f;}_0x34c396(_0x573b00);})['catch'](function(_0x3835cc){_0x29b089(_0x3835cc);});});}function createEndUser(_0x4b255b,_0x1068e0,_0x5e2fc0,_0x5b27d8,_0x3f445e,_0x414872){var _0x5e2fc0=getName(_0x5e2fc0);return request({'method':'POST','uri':_0x9307('0x41')+_0x1068e0+_0x9307('0x42')+_[_0x9307('0x43')](_0x414872['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x5e2fc0[0x1],'First_Name':_0x5e2fc0[0x0],'Phone':_0x5b27d8,'Owner':{'name':!_[_0x9307('0x1e')](_0x3f445e[_0x9307('0x44')][_0x9307('0x1a')])?_0x3f445e[_0x9307('0x44')][_0x9307('0x1a')]:!_[_0x9307('0x1e')](_0x3f445e['first_name'])?_0x3f445e['first_name']+'\x20'+_0x3f445e[_0x9307('0x45')]:_0x3f445e['last_name'],'id':_0x3f445e['id']}}]},'headers':{'Authorization':_0x9307('0x35')+_0x4b255b},'json':!![]})[_0x9307('0x2c')](function(_0x3b470f){if(_0x3b470f&&_0x3b470f[_0x9307('0x3f')][0x0][_0x9307('0x46')]===_0x9307('0x47')){var _0x29245d=_0x3b470f[_0x9307('0x3f')][0x0][_0x9307('0x48')];_0x29245d[_0x9307('0x40')]=_[_0x9307('0x43')](_0x414872[_0x9307('0x49')])+'s';return _0x29245d;}logger['error'](_0x9307('0x3e'),JSON[_0x9307('0xe')](data));throw new Error(_0x9307('0x4a')+JSON[_0x9307('0xe')](data));})[_0x9307('0x2d')](function(_0x41f88c){console[_0x9307('0x4b')](_0x9307('0x4c'),_0x41f88c);});}function getEndUser(_0x3b566d,_0x135e7f,_0x18bc0b,_0x4b2b6e,_0x2b86fd,_0x41b0bd,_0x3bea0e){var _0x5e79a1={'method':_0x9307('0x4d'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3b566d},'json':!![]};switch(_0x3bea0e[_0x9307('0x4e')]){case _0x9307('0x4f'):_0x5e79a1[_0x9307('0x50')]=_0x9307('0x41')+_0x135e7f+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2b86fd+'))';return getZohoUser(_0x5e79a1,'Contacts')[_0x9307('0x2c')](function(_0x249e8e){if(_0x249e8e)return _0x249e8e;_0x5e79a1['uri']=_0x9307('0x41')+_0x135e7f+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2b86fd+'))';return getZohoUser(_0x5e79a1,'Leads')[_0x9307('0x2c')](function(_0x367ae5){if(_0x367ae5)return _0x367ae5;if(_0x3bea0e[_0x9307('0x49')]!=_0x9307('0x51')){return createEndUser(_0x3b566d,_0x135e7f,_0x4b2b6e,_0x2b86fd,_0x41b0bd,_0x3bea0e);}else{return{};}});});break;case _0x9307('0x52'):_0x5e79a1[_0x9307('0x50')]='https://www.zohoapis.'+_0x135e7f+_0x9307('0x53')+_0x2b86fd+'))';return getZohoUser(_0x5e79a1,_0x9307('0x54'))[_0x9307('0x2c')](function(_0x25f8af){if(_0x25f8af)return _0x25f8af;if(_0x3bea0e[_0x9307('0x49')]!=_0x9307('0x51')){return createEndUser(_0x3b566d,_0x135e7f,_0x4b2b6e,_0x2b86fd,_0x41b0bd,_0x3bea0e);}else{return{};}});break;case _0x9307('0x55'):_0x5e79a1[_0x9307('0x50')]='https://www.zohoapis.'+_0x135e7f+_0x9307('0x56')+_0x2b86fd+'))';return getZohoUser(_0x5e79a1,_0x9307('0x57'))[_0x9307('0x2c')](function(_0x108a49){if(_0x108a49)return _0x108a49;if(_0x3bea0e[_0x9307('0x49')]!=_0x9307('0x51')){return createEndUser(_0x3b566d,_0x135e7f,_0x4b2b6e,_0x2b86fd,_0x41b0bd,_0x3bea0e);}else{return{};}});break;}}function getCall(_0x7ce31d,_0x295fde,_0x10634b,_0x10d6a1,_0x57000d,_0x105119,_0x2c0160,_0x187f23){logger['info'](_0x9307('0x58'));var _0x25feb6={};_0x25feb6[_0x9307('0x59')]={'name':!_[_0x9307('0x1e')](_0x10d6a1[_0x9307('0x44')][_0x9307('0x1a')])&&!_[_0x9307('0x1e')](_0x10d6a1[_0x9307('0x3b')][_0x9307('0x1a')])&&_0x10d6a1[_0x9307('0x3b')][_0x9307('0x1a')]===_0x9307('0x5a')?_0x10d6a1[_0x9307('0x44')][_0x9307('0x1a')]:!_[_0x9307('0x1e')](_0x10d6a1[_0x9307('0x5b')])?_0x10d6a1[_0x9307('0x5b')]+'\x20'+_0x10d6a1[_0x9307('0x45')]:_0x10d6a1[_0x9307('0x45')],'id':_0x10d6a1['id']};_0x25feb6[_0x9307('0x5c')]=intUtil[_0x9307('0x5d')](_0x105119[_0x9307('0x5e')],_0x2c0160,'\x20');_0x25feb6[_0x9307('0x5f')]=intUtil[_0x9307('0x5d')](_0x105119[_0x9307('0x60')],_0x2c0160,'\x0a');if(_0x57000d[_0x9307('0x40')]===_0x9307('0x54')){_0x25feb6['Who_Id']={'name':!_[_0x9307('0x1e')](_0x57000d['Full_Name'])?_0x57000d['Full_Name']:!_[_0x9307('0x1e')](_0x57000d[_0x9307('0x61')])?_0x57000d[_0x9307('0x61')]+'\x20'+_0x57000d[_0x9307('0x62')]:_0x57000d['Last_Name'],'id':_0x57000d['id']};}if(_0x57000d[_0x9307('0x40')]===_0x9307('0x57')){_0x25feb6[_0x9307('0x63')]={'name':!_['isNil'](_0x57000d[_0x9307('0x64')])?_0x57000d[_0x9307('0x64')]:!_['isNil'](_0x57000d['First_Name'])?_0x57000d[_0x9307('0x61')]+'\x20'+_0x57000d['Last_Name']:_0x57000d[_0x9307('0x62')],'id':_0x57000d['id']};_0x25feb6[_0x9307('0x65')]=_[_0x9307('0x43')](_0x57000d['enduserType']);}if(_0x2c0160[_0x9307('0x66')]){_0x25feb6[_0x9307('0x67')]=moment[_0x9307('0x68')](parseInt(_0x2c0160[_0x9307('0x66')])*0x3e8)[_0x9307('0x32')](_0x9307('0x69'));}else if(_0x2c0160['answertime']&&_0x2c0160[_0x9307('0x6a')]){_0x25feb6[_0x9307('0x67')]=moment[_0x9307('0x68')](moment(_0x2c0160['endtime'],_0x9307('0x6b'))[_0x9307('0x6c')](moment(_0x2c0160[_0x9307('0x6d')],'YYYY-MM-DDTHH:mm:ss')))[_0x9307('0x32')](_0x9307('0x69'));}switch(_0x2c0160[_0x9307('0x6e')]){case _0x9307('0x6f'):_0x25feb6['Call_Result']=_0x9307('0x70');break;case'complete':case'connect':_0x25feb6[_0x9307('0x71')]='Answered';break;case _0x9307('0x72'):_0x25feb6[_0x9307('0x71')]=_0x9307('0x73');break;case _0x9307('0x74'):_0x25feb6[_0x9307('0x71')]=_0x9307('0x75');break;case _0x9307('0x76'):_0x25feb6[_0x9307('0x71')]=_0x9307('0x77');default:}_0x25feb6['Call_Start_Time']=(_0x187f23==='outbound'?moment(_0x2c0160[_0x9307('0x6d')])[_0x9307('0x32')](_0x9307('0x6b')):moment(_0x2c0160[_0x9307('0x78')])[_0x9307('0x32')](_0x9307('0x6b')))||moment()['format'](_0x9307('0x6b'));_0x25feb6[_0x9307('0x79')]=_0x187f23||_0x9307('0x7a');_0x25feb6=_[_0x9307('0x7b')](_0x25feb6,getCustomFields(_0x105119['Fields'],_0x2c0160));return request({'method':_0x9307('0x27'),'uri':_0x9307('0x41')+_0x295fde+_0x9307('0x7c'),'headers':{'Authorization':_0x9307('0x35')+_0x7ce31d},'body':{'data':[_0x25feb6]},'json':!![]})[_0x9307('0x2c')](function(_0x5e867b){if(_0x5e867b&&_0x5e867b[_0x9307('0x3f')][0x0][_0x9307('0x46')]==='SUCCESS'){logger['info'](_0x9307('0x7d'));return{'id':_0x5e867b[_0x9307('0x3f')][0x0][_0x9307('0x48')]['id']};}})[_0x9307('0x2d')](function(_0x1c2212){logger[_0x9307('0x31')]('err',_0x1c2212[_0x9307('0x30')]);console[_0x9307('0x4b')](_0x9307('0x7e'),_0x1c2212);});}exports[_0x9307('0x7f')]=function(_0x4b73bc,_0x3011db,_0x5aa4f5,_0x311685,_0x25e768,_0xaa07fe){var _0x27744d,_0x25a5b0,_0x5eb9a3;_0xaa07fe[_0x9307('0x80')]=intUtil[_0x9307('0x81')](_0xaa07fe[_0x9307('0x80')]);_0xaa07fe['serverUrl']=intUtil[_0x9307('0x81')](_0xaa07fe['serverUrl']);if(_0x25e768&&_0x25e768['monitor_format']){logger[_0x9307('0x31')]('[QUEUE]',_0x9307('0x82'));_0x3011db[_0x9307('0x83')]=_0xaa07fe[_0x9307('0x84')]+'/api/voice/recordings/'+_0x3011db[_0x9307('0x85')]+_0x9307('0x86')+md5(_0x3011db[_0x9307('0x85')]);}else{_0x3011db[_0x9307('0x83')]='';}var _0x50047f=_0xaa07fe[_0x9307('0x80')]===_0x9307('0x87')?'eu':_0x9307('0x88');return getAccessToken(_0xaa07fe)[_0x9307('0x2c')](function(_0x15cebd){_0x5eb9a3=_0x15cebd;return getUser(_0x5eb9a3,_0x50047f,_0xaa07fe,_0x311685['email']);})[_0x9307('0x2c')](function(_0x18c86c){_0x27744d=_0x18c86c;logger[_0x9307('0x31')]('The\x20User\x20ID\x20is:',_0x27744d['id']);return getEndUser(_0x5eb9a3,_0x50047f,_0xaa07fe,_0x3011db[_0x9307('0x89')],_0x3011db[_0x9307('0x8a')],_0x27744d,_0x5aa4f5);})[_0x9307('0x2c')](function(_0x3cc958){_0x25a5b0=_0x3cc958;return getCall(_0x5eb9a3,_0x50047f,_0xaa07fe,_0x27744d,_0x25a5b0,_0x5aa4f5,_0x3011db,_0x9307('0x7a'));})[_0x9307('0x2c')](function(_0x5669a5){if(_0x5669a5){logger[_0x9307('0x31')]('The\x20Call\x20ID\x20is:',_0x5669a5['id']);logger[_0x9307('0x31')](_0x9307('0x8b'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9307('0x32')](_0x9307('0x8c'),_0x311685['name']),'trigger:browser:url',{'uri':_0x9307('0x8d')+_0xaa07fe['host']+_0x9307('0x8e')+_0x5669a5['id']});}})[_0x9307('0x2d')](function(_0x4b43ea){logger[_0x9307('0x2e')](_0x9307('0x8b'),JSON[_0x9307('0xe')](_0x4b43ea));});};exports[_0x9307('0x8f')]=function(_0x38aed,_0x4a346e,_0x533dab,_0x22343e,_0x174f50,_0x2a1f78,_0xc56931){var _0x30d373,_0x2eb8c2,_0x2e3d58;_0x2a1f78[_0x9307('0x80')]=intUtil[_0x9307('0x81')](_0x2a1f78[_0x9307('0x80')]);_0x2a1f78[_0x9307('0x84')]=intUtil[_0x9307('0x81')](_0x2a1f78['serverUrl']);if(_0xc56931&&_0xc56931[_0x9307('0x90')]&&_0xc56931[_0x9307('0x90')]!==_0x9307('0x91')){logger[_0x9307('0x31')]('[OUTBOUND]',_0x9307('0x82'));_0x4a346e[_0x9307('0x83')]=_0x2a1f78[_0x9307('0x84')]+_0x9307('0x92')+_0x4a346e[_0x9307('0x85')]+_0x9307('0x86')+md5(_0x4a346e['uniqueid']);}var _0x3de6f6=_0x2a1f78['host']===_0x9307('0x87')?'eu':_0x9307('0x88');return getAccessToken(_0x2a1f78)['then'](function(_0xa60585){_0x2e3d58=_0xa60585;return getUser(_0x2e3d58,_0x3de6f6,_0x2a1f78,_0x22343e[_0x9307('0x93')]);})[_0x9307('0x2c')](function(_0x55fea1){_0x30d373=_0x55fea1;logger[_0x9307('0x31')](_0x9307('0x94'),_0x30d373['id']);return getEndUser(_0x2e3d58,_0x3de6f6,_0x2a1f78,_0x4a346e[_0x9307('0x95')],_0x4a346e[_0x9307('0x96')],_0x30d373,_0x533dab);})[_0x9307('0x2c')](function(_0x315907){_0x2eb8c2=_0x315907;return getCall(_0x2e3d58,_0x3de6f6,_0x2a1f78,_0x30d373,_0x2eb8c2,_0x533dab,_0x4a346e,_0x9307('0x97'));})[_0x9307('0x2c')](function(_0x42d95b){if(_0x42d95b){logger['info'](_0x9307('0x98'),_0x42d95b['id']);logger[_0x9307('0x31')]('[OUTBOUND]',_0x9307('0x99'));emit(util[_0x9307('0x32')]('user:%s',_0x22343e['name']),_0x9307('0x9a'),{'uri':'https://crm.'+_0x2a1f78[_0x9307('0x80')]+_0x9307('0x8e')+_0x42d95b['id']});}})[_0x9307('0x2d')](function(_0x5afb6a){logger[_0x9307('0x2e')](_0x9307('0x9b'),JSON[_0x9307('0xe')](_0x5afb6a));});};exports[_0x9307('0x9c')]=function(_0x28557e,_0x15a632,_0x592047,_0x224b10,_0x447a03,_0x42a538){var _0x5a42a5,_0x5310ef,_0x46809c;_0x42a538['host']=intUtil['stripTrailingSlash'](_0x42a538[_0x9307('0x80')]);_0x42a538[_0x9307('0x84')]=intUtil[_0x9307('0x81')](_0x42a538['serverUrl']);if(_0x447a03&&_0x447a03[_0x9307('0x9d')]){logger['info']('['+_0x15a632['lastevent'][_0x9307('0x9e')]()+']','Recording\x20is\x20enabled!');_0x15a632[_0x9307('0x83')]=_0x42a538[_0x9307('0x84')]+'/api/voice/recordings/'+_0x15a632[_0x9307('0x85')]+_0x9307('0x86')+md5(_0x15a632[_0x9307('0x85')]);}else{_0x15a632[_0x9307('0x83')]='';}var _0x1fbc07=_0x42a538[_0x9307('0x80')]===_0x9307('0x87')?'eu':_0x9307('0x88');return getAccessToken(_0x42a538)[_0x9307('0x2c')](function(_0x374764){_0x46809c=_0x374764;return getUser(_0x46809c,_0x1fbc07,_0x42a538);})[_0x9307('0x2c')](function(_0x4b8073){_0x5a42a5=_0x4b8073;logger[_0x9307('0x31')]('The\x20User\x20ID\x20is:',_0x5a42a5['id']);return getEndUser(_0x46809c,_0x1fbc07,_0x42a538,_0x15a632[_0x9307('0x89')],_0x15a632[_0x9307('0x8a')],_0x5a42a5,_0x592047);})[_0x9307('0x2c')](function(_0x16ad54){_0x5310ef=_0x16ad54;return getCall(_0x46809c,_0x1fbc07,_0x42a538,_0x5a42a5,_0x5310ef,_0x592047,_0x15a632,'Inbound');})['then'](function(_0x48d82a){if(_0x48d82a){logger[_0x9307('0x31')](_0x9307('0x98'),_0x48d82a['id']);}})[_0x9307('0x2d')](function(_0x152446){logger['error']('['+_0x15a632[_0x9307('0x6e')]['toUpperCase']()+']',JSON[_0x9307('0xe')](_0x152446));});}; \ 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 7f51972..316f514 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 _0x17d1=['data2','Script','data3','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','../../../../config/logger','trigger'];(function(_0x37af6e,_0x2bad33){var _0x44df3d=function(_0x50b9b9){while(--_0x50b9b9){_0x37af6e['push'](_0x37af6e['shift']());}};_0x44df3d(++_0x2bad33);}(_0x17d1,0x196));var _0x117d=function(_0x8eb110,_0x5d99f4){_0x8eb110=_0x8eb110-0x0;var _0x2494b6=_0x17d1[_0x8eb110];return _0x2494b6;};'use strict';var util=require('util');var sh=require(_0x117d('0x0'));var Mustache=require(_0x117d('0x1'));var logger=require(_0x117d('0x2'))(_0x117d('0x3'));exports['exec']=function(_0x10357a,_0x276610){var _0x14c18f=_0x10357a['data2']?_0x10357a[_0x117d('0x4')]:_0x117d('0x5');var _0x439d59=_0x10357a[_0x117d('0x6')]?Mustache['render'](_0x10357a[_0x117d('0x6')],_0x276610):_0x276610;sh['exec'](_0x439d59,function(_0x429d88,_0xc677a4,_0x43f4d2){if(_0x429d88!==0x0){logger['error'](util[_0x117d('0x7')](_0x117d('0x8'),_0x14c18f,_0x439d59,_0x429d88,_0x43f4d2));}else{logger['info'](util[_0x117d('0x7')](_0x117d('0x9'),_0x14c18f,_0x439d59,_0xc677a4));}});}; \ No newline at end of file +var _0x5edb=['data2','Script','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','../../../../config/logger','trigger','exec'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5edb,0xc7));var _0xb5ed=function(_0x406c31,_0x5a2ba0){_0x406c31=_0x406c31-0x0;var _0x4c6efa=_0x5edb[_0x406c31];return _0x4c6efa;};'use strict';var util=require('util');var sh=require(_0xb5ed('0x0'));var Mustache=require(_0xb5ed('0x1'));var logger=require(_0xb5ed('0x2'))(_0xb5ed('0x3'));exports[_0xb5ed('0x4')]=function(_0x4d34ac,_0x1cf122){var _0x4494f3=_0x4d34ac[_0xb5ed('0x5')]?_0x4d34ac[_0xb5ed('0x5')]:_0xb5ed('0x6');var _0x328c54=_0x4d34ac['data3']?Mustache[_0xb5ed('0x7')](_0x4d34ac['data3'],_0x1cf122):_0x1cf122;sh['exec'](_0x328c54,function(_0x2205ad,_0x25bf1e,_0x573a81){if(_0x2205ad!==0x0){logger[_0xb5ed('0x8')](util[_0xb5ed('0x9')](_0xb5ed('0xa'),_0x4494f3,_0x328c54,_0x2205ad,_0x573a81));}else{logger['info'](util[_0xb5ed('0x9')](_0xb5ed('0xb'),_0x4494f3,_0x328c54,_0x25bf1e));}});}; \ 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 b92bb86..5dd9a26 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 _0x4b19=['trigger','toUpperCase','render','data2','data5','number','headers','data6','parse','error','stack','data1','GET','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','stringify','then','isNil',',\x20request\x20body:\x20','object','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','mustache','../../../../config/logger'];(function(_0x5b2661,_0x21c72b){var _0x4b0738=function(_0x506584){while(--_0x506584){_0x5b2661['push'](_0x5b2661['shift']());}};_0x4b0738(++_0x21c72b);}(_0x4b19,0x15a));var _0x94b1=function(_0xbf8b24,_0x15a25e){_0xbf8b24=_0xbf8b24-0x0;var _0x3c71c1=_0x4b19[_0xbf8b24];return _0x3c71c1;};'use strict';var rp=require(_0x94b1('0x0'));var util=require(_0x94b1('0x1'));var _=require('lodash');var Mustache=require(_0x94b1('0x2'));var logger=require(_0x94b1('0x3'))(_0x94b1('0x4'));exports['exec']=function(_0x351032,_0x2f3a33){var _0x4eec3a,_0x216cdc;var _0x49217b={'method':_0x351032['data1'][_0x94b1('0x5')](),'uri':Mustache[_0x94b1('0x6')](_0x351032[_0x94b1('0x7')],_0x2f3a33),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x351032[_0x94b1('0x8')])===_0x94b1('0x9')&&parseInt(_0x351032[_0x94b1('0x8')])>=0x1&&parseInt(_0x351032[_0x94b1('0x8')])<=0xa?parseInt(_0x351032[_0x94b1('0x8')])*0x3e8:0x5*0x3e8};try{_0x49217b[_0x94b1('0xa')]=_0x351032[_0x94b1('0xb')]?JSON[_0x94b1('0xc')](Mustache['render'](_0x351032['data6'],_0x2f3a33)):{};}catch(_0x4933fe){logger[_0x94b1('0xd')](_0x4933fe[_0x94b1('0xe')]);}switch(_0x351032[_0x94b1('0xf')][_0x94b1('0x5')]()){case _0x94b1('0x10'):case'DELETE':_0x4eec3a=null;_0x49217b['qs']=_0x2f3a33;break;case _0x94b1('0x11'):case _0x94b1('0x12'):if(_0x351032[_0x94b1('0x13')]){try{_0x4eec3a=JSON[_0x94b1('0xc')](Mustache['render'](_0x351032['data7'],_0x2f3a33));_0x49217b[_0x94b1('0x14')]=_0x4eec3a;}catch(_0x220585){logger[_0x94b1('0xd')](_0x220585[_0x94b1('0xe')]);logger[_0x94b1('0xd')](_0x94b1('0x15'));}}else{_0x4eec3a=_0x2f3a33;_0x49217b[_0x94b1('0x14')]=_0x4eec3a;}break;}logger[_0x94b1('0x16')](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x351032[_0x94b1('0xf')],_0x351032[_0x94b1('0x7')],JSON[_0x94b1('0x17')](_0x49217b)));rp(_0x49217b)[_0x94b1('0x18')](function(_0x4d98eb){_0x4eec3a=!_[_0x94b1('0x19')](_0x4eec3a)?_0x94b1('0x1a')+_0x4eec3a:'';_0x216cdc=typeof _0x4d98eb[_0x94b1('0x14')]===_0x94b1('0x1b')?JSON['stringify'](_0x4d98eb[_0x94b1('0x14')]):_0x4d98eb[_0x94b1('0x14')];logger[_0x94b1('0x16')](util[_0x94b1('0x1c')](_0x94b1('0x1d'),_0x351032[_0x94b1('0xf')],_0x351032[_0x94b1('0x7')],_0x4d98eb[_0x94b1('0x1e')],_0x216cdc));})[_0x94b1('0x1f')](function(_0x179c56){logger[_0x94b1('0xd')](util['format'](_0x94b1('0x20'),_0x351032[_0x94b1('0xf')],_0x351032['data2'],_0x179c56[_0x94b1('0x1e')],_0x179c56[_0x94b1('0x21')],_0x179c56[_0x94b1('0x22')]));});}; \ No newline at end of file +var _0xd195=['number','data6','parse','error','stack','GET','DELETE','POST','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','request-promise','util','lodash','mustache','trigger','exec','data1','toUpperCase','render','data5'];(function(_0x1d0113,_0x36f7d6){var _0x5c29e6=function(_0x75d19f){while(--_0x75d19f){_0x1d0113['push'](_0x1d0113['shift']());}};_0x5c29e6(++_0x36f7d6);}(_0xd195,0xb6));var _0x5d19=function(_0x25b98f,_0x45e6b8){_0x25b98f=_0x25b98f-0x0;var _0x207d50=_0xd195[_0x25b98f];return _0x207d50;};'use strict';var rp=require(_0x5d19('0x0'));var util=require(_0x5d19('0x1'));var _=require(_0x5d19('0x2'));var Mustache=require(_0x5d19('0x3'));var logger=require('../../../../config/logger')(_0x5d19('0x4'));exports[_0x5d19('0x5')]=function(_0x4215cf,_0x4bc26f){var _0x290f65,_0x4ab60f;var _0x482703={'method':_0x4215cf[_0x5d19('0x6')][_0x5d19('0x7')](),'uri':Mustache[_0x5d19('0x8')](_0x4215cf['data2'],_0x4bc26f),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4215cf[_0x5d19('0x9')])===_0x5d19('0xa')&&parseInt(_0x4215cf[_0x5d19('0x9')])>=0x1&&parseInt(_0x4215cf[_0x5d19('0x9')])<=0xa?parseInt(_0x4215cf[_0x5d19('0x9')])*0x3e8:0x5*0x3e8};try{_0x482703['headers']=_0x4215cf[_0x5d19('0xb')]?JSON[_0x5d19('0xc')](Mustache['render'](_0x4215cf[_0x5d19('0xb')],_0x4bc26f)):{};}catch(_0x219dd4){logger[_0x5d19('0xd')](_0x219dd4[_0x5d19('0xe')]);}switch(_0x4215cf[_0x5d19('0x6')]['toUpperCase']()){case _0x5d19('0xf'):case _0x5d19('0x10'):_0x290f65=null;_0x482703['qs']=_0x4bc26f;break;case _0x5d19('0x11'):case'PUT':if(_0x4215cf[_0x5d19('0x12')]){try{_0x290f65=JSON[_0x5d19('0xc')](Mustache[_0x5d19('0x8')](_0x4215cf['data7'],_0x4bc26f));_0x482703[_0x5d19('0x13')]=_0x290f65;}catch(_0x5289ba){logger[_0x5d19('0xd')](_0x5289ba[_0x5d19('0xe')]);logger[_0x5d19('0xd')](_0x5d19('0x14'));}}else{_0x290f65=_0x4bc26f;_0x482703['body']=_0x290f65;}break;}logger[_0x5d19('0x15')](util[_0x5d19('0x16')](_0x5d19('0x17'),_0x4215cf[_0x5d19('0x6')],_0x4215cf[_0x5d19('0x18')],JSON[_0x5d19('0x19')](_0x482703)));rp(_0x482703)[_0x5d19('0x1a')](function(_0x424737){_0x290f65=!_['isNil'](_0x290f65)?_0x5d19('0x1b')+_0x290f65:'';_0x4ab60f=typeof _0x424737[_0x5d19('0x13')]===_0x5d19('0x1c')?JSON[_0x5d19('0x19')](_0x424737['body']):_0x424737['body'];logger['info'](util['format'](_0x5d19('0x1d'),_0x4215cf[_0x5d19('0x6')],_0x4215cf[_0x5d19('0x18')],_0x424737[_0x5d19('0x1e')],_0x4ab60f));})['catch'](function(_0x5ef92f){logger[_0x5d19('0xd')](util[_0x5d19('0x16')](_0x5d19('0x1f'),_0x4215cf['data1'],_0x4215cf[_0x5d19('0x18')],_0x5ef92f['statusCode'],_0x5ef92f['name'],_0x5ef92f['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 53ff5f6..e0e2174 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 _0xb49c=['Request','request','then','debug','rpc','error','message','../../config/logger','routing','client','http'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xb49c,0x1a9));var _0xcb49=function(_0x13ee28,_0xc2000f){_0x13ee28=_0x13ee28-0x0;var _0xd37573=_0xb49c[_0x13ee28];return _0xd37573;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xcb49('0x0'))(_0xcb49('0x1'));var client=jayson[_0xcb49('0x2')][_0xcb49('0x3')]({'port':0x2329});client[_0xcb49('0x4')]=function(_0x4d3b25,_0x5c0839){return new BPromise(function(_0x218b17,_0x2bfa3e){return client[_0xcb49('0x5')](_0x4d3b25,_0x5c0839)[_0xcb49('0x6')](function(_0x4a4837){logger[_0xcb49('0x7')](_0xcb49('0x8'),_0xcb49('0x1'),_0x4d3b25,_0x5c0839,_0x4a4837);if(_0x4a4837[_0xcb49('0x9')]){logger[_0xcb49('0x9')](_0xcb49('0x8'),'routing',_0x4d3b25,_0x4a4837[_0xcb49('0x9')][_0xcb49('0xa')],_0x5c0839);return _0x2bfa3e(_0x4a4837[_0xcb49('0x9')][_0xcb49('0xa')]);}else{return _0x218b17(_0x4a4837['result']);}})['catch'](function(_0x5316bf){logger[_0xcb49('0x9')]('rpc',_0xcb49('0x1'),_0x4d3b25,_0x5316bf,_0x5c0839);return _0x2bfa3e(_0x5316bf);});});};module['exports']=client; \ No newline at end of file +var _0x0efe=['then','debug','error','rpc','message','jayson/promise','bluebird','../../config/logger','routing','client','Request','request'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0efe,0x101));var _0xe0ef=function(_0x2888f7,_0x1e6586){_0x2888f7=_0x2888f7-0x0;var _0x4f951f=_0x0efe[_0x2888f7];return _0x4f951f;};'use strict';var jayson=require(_0xe0ef('0x0'));var BPromise=require(_0xe0ef('0x1'));var logger=require(_0xe0ef('0x2'))(_0xe0ef('0x3'));var client=jayson[_0xe0ef('0x4')]['http']({'port':0x2329});client[_0xe0ef('0x5')]=function(_0xce7692,_0x26cda3){return new BPromise(function(_0xeec32e,_0x375edf){return client[_0xe0ef('0x6')](_0xce7692,_0x26cda3)[_0xe0ef('0x7')](function(_0x49dc49){logger[_0xe0ef('0x8')]('rpc',_0xe0ef('0x3'),_0xce7692,_0x26cda3,_0x49dc49);if(_0x49dc49[_0xe0ef('0x9')]){logger[_0xe0ef('0x9')](_0xe0ef('0xa'),'routing',_0xce7692,_0x49dc49[_0xe0ef('0x9')][_0xe0ef('0xb')],_0x26cda3);return _0x375edf(_0x49dc49['error']['message']);}else{return _0xeec32e(_0x49dc49['result']);}})['catch'](function(_0x5ecaf9){logger[_0xe0ef('0x9')](_0xe0ef('0xa'),'routing',_0xce7692,_0x5ecaf9,_0x26cda3);return _0x375edf(_0x5ecaf9);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index ca1cecb..5fa6887 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 _0xfaae=['resolve','then','getMailAccounts','refresh','getSettings','loginMailFrequency','catch','error','./server','./realtime','./lib/email','./rpc/mailAccount'];(function(_0x3bdfef,_0x3f405e){var _0x5a5549=function(_0x5d4e1f){while(--_0x5d4e1f){_0x3bdfef['push'](_0x3bdfef['shift']());}};_0x5a5549(++_0x3f405e);}(_0xfaae,0x104));var _0xefaa=function(_0x2375f1,_0x4ec76a){_0x2375f1=_0x2375f1-0x0;var _0x59f709=_0xfaae[_0x2375f1];return _0x59f709;};'use strict';var server=require(_0xefaa('0x0'));var Realtime=require(_0xefaa('0x1'));var EmailChannel=require(_0xefaa('0x2'));var mailAccount=require(_0xefaa('0x3'));var setting=require('./rpc/setting');var logger=require('../../config/logger')('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xefaa('0x4')]()[_0xefaa('0x5')](mailAccount[_0xefaa('0x6')]())['then'](realtime['initMailAccounts']())[_0xefaa('0x5')](function(){email[_0xefaa('0x7')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)[_0xefaa('0x5')](function(){return initRealtime();})[_0xefaa('0x5')](function(){return setting[_0xefaa('0x8')]();})[_0xefaa('0x5')](function(_0x2ff006){return setInterval(initRealtime,_0x2ff006[_0xefaa('0x9')]*0x3e8);})[_0xefaa('0xa')](function(_0x182b96){logger[_0xefaa('0xb')]('Email\x20service\x20initialization',_0x182b96);});}main(); \ No newline at end of file +var _0x4812=['refresh','mailAccounts','getSettings','loginMailFrequency','error','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts'];(function(_0x537e14,_0x3e1298){var _0x2f0523=function(_0x1bc091){while(--_0x1bc091){_0x537e14['push'](_0x537e14['shift']());}};_0x2f0523(++_0x3e1298);}(_0x4812,0xe5));var _0x2481=function(_0x174af4,_0x1eec81){_0x174af4=_0x174af4-0x0;var _0x49f3e1=_0x4812[_0x174af4];return _0x49f3e1;};'use strict';var server=require(_0x2481('0x0'));var Realtime=require(_0x2481('0x1'));var EmailChannel=require(_0x2481('0x2'));var mailAccount=require(_0x2481('0x3'));var setting=require(_0x2481('0x4'));var logger=require(_0x2481('0x5'))(_0x2481('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x2481('0x7')]()[_0x2481('0x8')](mailAccount[_0x2481('0x9')]())['then'](realtime[_0x2481('0xa')]())[_0x2481('0x8')](function(){email[_0x2481('0xb')](realtime[_0x2481('0xc')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x2481('0x8')](function(){return initRealtime();})[_0x2481('0x8')](function(){return setting[_0x2481('0xd')]();})[_0x2481('0x8')](function(_0x5aa915){return setInterval(initRealtime,_0x5aa915[_0x2481('0xe')]*0x3e8);})['catch'](function(_0x25807d){logger[_0x2481('0xf')]('Email\x20service\x20initialization',_0x25807d);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 1b4466f..7f91666 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 _0x474c=['ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','key','active','Imap','stringify','mailAccount:update','refresh','hasOwnProperty','service','custom','provider','box','handleImapBox','bind','handleImapEmail','end','error','handleImapError','isNil','disabled','status','connected','messages','total','firstName','lastName','from','notify','info','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','messageStatus','sendMail','smtp','Smtp','lastSync','verify','then','exports','moment','bluebird','md5'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x474c,0x6f));var _0xc474=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x474c[_0x1d50f2];return _0x3769b8;};'use strict';var _=require('lodash');var moment=require(_0xc474('0x0'));var BPromise=require(_0xc474('0x1'));var md5=require(_0xc474('0x2'));var Redis=require(_0xc474('0x3'));var config=require(_0xc474('0x4'));var logger=require(_0xc474('0x5'))(_0xc474('0x6'));config[_0xc474('0x7')]=_[_0xc474('0x8')](config[_0xc474('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0xc474('0x9'));var EmailSmtp=require(_0xc474('0xa'));var mailAccount=require(_0xc474('0xb'));var md5Accounts={};function EmailChannel(_0x367bf9){logger['info'](_0xc474('0xc'));this[_0xc474('0xd')]=_0x367bf9[_0xc474('0xd')];this[_0xc474('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0xc474('0xf')][_0xc474('0x10')]=function(_0x6d9fe){var _0x30a829=this[_0xc474('0xd')][_0x6d9fe];var _0x1185dd={'id':_0x30a829['id'],'name':_0x30a829[_0xc474('0x11')],'key':_0x30a829[_0xc474('0x12')],'active':_0x30a829[_0xc474('0x13')],'Imap':{'status':_0x30a829['Imap']['status'],'messageStatus':_0x30a829[_0xc474('0x14')]['messageStatus'],'total':_0x30a829[_0xc474('0x14')]['total']}};if(_['isNil'](md5Accounts[_0x6d9fe])){md5Accounts[_0x6d9fe]={};}var _0x261a68=md5(JSON[_0xc474('0x15')](_0x1185dd));if(md5Accounts[_0x6d9fe][_0xc474('0x2')]!==_0x261a68){md5Accounts[_0x6d9fe][_0xc474('0x2')]=_0x261a68;io[_0xc474('0x10')](_0xc474('0x16'),_0x1185dd);}};EmailChannel[_0xc474('0xf')][_0xc474('0x17')]=function(_0x300471){for(var _0x16e0c3 in _0x300471){if(_0x300471[_0xc474('0x18')](_0x16e0c3)){if(_0x300471[_0x16e0c3][_0xc474('0x14')]&&_0x300471[_0x16e0c3][_0xc474('0x13')]){var _0x3ece89=_0x300471[_0x16e0c3]['Imap'];if(!_0x3ece89[_0xc474('0x19')]&&_0x300471[_0x16e0c3]['provider']!==_0xc474('0x1a'))_0x3ece89[_0xc474('0x19')]=_0x300471[_0x16e0c3][_0xc474('0x1b')];if(!this['imapAccounts'][_0xc474('0x18')](_0x3ece89['id'])){this[_0xc474('0xe')][_0x3ece89['id']]=new EmailImap(_0x3ece89,_0x300471[_0x16e0c3][_0xc474('0x6')]);this['imapAccounts'][_0x3ece89['id']]['on'](_0xc474('0x1c'),this[_0xc474('0x1d')][_0xc474('0x1e')](this,_0x16e0c3));this[_0xc474('0xe')][_0x3ece89['id']]['on'](_0xc474('0x6'),this[_0xc474('0x1f')][_0xc474('0x1e')](this,_0x16e0c3));this[_0xc474('0xe')][_0x3ece89['id']]['on'](_0xc474('0x20'),this['handleImapEnd'][_0xc474('0x1e')](this,_0x16e0c3));this[_0xc474('0xe')][_0x3ece89['id']]['on'](_0xc474('0x21'),this[_0xc474('0x22')][_0xc474('0x1e')](this,_0x16e0c3));}}else{if(_[_0xc474('0x23')](this['mailAccounts'][_0x16e0c3][_0xc474('0x14')])){this[_0xc474('0xd')][_0x16e0c3][_0xc474('0x14')]={};}this['mailAccounts'][_0x16e0c3]['Imap']['status']=_0xc474('0x24');this['mailAccounts'][_0x16e0c3][_0xc474('0x14')]['messageStatus']='';this[_0xc474('0x10')](_0x16e0c3);}}}};EmailChannel['prototype'][_0xc474('0x1d')]=function(_0x5625ab,_0x372d2a){if(this['mailAccounts'][_0x5625ab]){this[_0xc474('0xd')][_0x5625ab]['Imap'][_0xc474('0x25')]=_0xc474('0x26');this[_0xc474('0xd')][_0x5625ab][_0xc474('0x14')]['messageStatus']=_0x372d2a[_0xc474('0x11')];if(_0x372d2a[_0xc474('0x27')]){this[_0xc474('0xd')][_0x5625ab][_0xc474('0x14')][_0xc474('0x28')]=_0x372d2a['messages']['total'];}return this[_0xc474('0x10')](_0x5625ab);}};EmailChannel[_0xc474('0xf')][_0xc474('0x1f')]=function(_0x128f6a,_0x4ee70a){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x4ee70a[_0xc474('0x29')],_0x4ee70a[_0xc474('0x2a')],_0x4ee70a[_0xc474('0x2b')],_0x128f6a);if(this[_0xc474('0xd')][_0x128f6a]){return mailAccount[_0xc474('0x2c')](_0x128f6a,_0x4ee70a)['then'](function(_0x4b1369){if(_0x4b1369){logger[_0xc474('0x2d')](_0xc474('0x2e'));}})[_0xc474('0x2f')](function(_0xb16e22){logger[_0xc474('0x21')](_0xc474('0x30'),JSON[_0xc474('0x15')](_0xb16e22));});}};EmailChannel[_0xc474('0xf')]['handleImapEnd']=function(_0x5579c6){if(this[_0xc474('0xd')][_0x5579c6]&&this['mailAccounts'][_0x5579c6][_0xc474('0x14')]){if(this[_0xc474('0xe')][this['mailAccounts'][_0x5579c6][_0xc474('0x14')]['id']]){delete this[_0xc474('0xe')][this[_0xc474('0xd')][_0x5579c6][_0xc474('0x14')]['id']];}this[_0xc474('0xd')][_0x5579c6]['Imap']['lastSync']=moment();this[_0xc474('0x10')](_0x5579c6);}};EmailChannel[_0xc474('0xf')][_0xc474('0x22')]=function(_0xa4a22c,_0x118417){if(this[_0xc474('0xd')][_0xa4a22c]){this[_0xc474('0xd')][_0xa4a22c]['Imap'][_0xc474('0x25')]=_0xc474('0x21');this['mailAccounts'][_0xa4a22c][_0xc474('0x14')][_0xc474('0x31')]=_0x118417;return this[_0xc474('0x10')](_0xa4a22c);}};EmailChannel[_0xc474('0xf')][_0xc474('0x32')]=function(_0x5e8b5a,_0x4c1673){return this[_0xc474('0x33')]['send'](_0x5e8b5a,_0x4c1673);};EmailChannel[_0xc474('0xf')]['verifySmtp']=function(_0x38a930){var _0x189fdd=this;if(this['mailAccounts'][_0x38a930['id']]){if(_[_0xc474('0x23')](this['mailAccounts'][_0x38a930['id']]['Smtp'])){this[_0xc474('0xd')][_0x38a930['id']][_0xc474('0x34')]={};}this[_0xc474('0xd')][_0x38a930['id']][_0xc474('0x34')][_0xc474('0x35')]=moment();return new BPromise(function(_0x45ff0f,_0x22b128){return _0x189fdd['smtp'][_0xc474('0x36')](_0x38a930)[_0xc474('0x37')](function(_0x3a9c4c){_0x189fdd[_0xc474('0xd')][_0x38a930['id']][_0xc474('0x34')][_0xc474('0x25')]='verified';_0x189fdd[_0xc474('0xd')][_0x38a930['id']][_0xc474('0x34')][_0xc474('0x31')]='';_0x189fdd[_0xc474('0x10')](_0x38a930['id']);_0x45ff0f(_0x3a9c4c);})[_0xc474('0x2f')](function(_0x50f3a5){_0x189fdd[_0xc474('0xd')][_0x38a930['id']][_0xc474('0x34')][_0xc474('0x25')]=_0xc474('0x21');_0x189fdd[_0xc474('0xd')][_0x38a930['id']]['Smtp']['messageStatus']=_0x50f3a5;_0x189fdd[_0xc474('0x10')](_0x38a930['id']);_0x22b128(_0x50f3a5);});});}return this[_0xc474('0x33')][_0xc474('0x36')](_0x38a930);};module[_0xc474('0x38')]=EmailChannel; \ No newline at end of file +var _0x0ace=['stringify','mailAccount:update','refresh','hasOwnProperty','active','service','custom','provider','box','handleImapBox','bind','handleImapEmail','handleImapEnd','handleImapError','disabled','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verified','catch','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./smtp','info','start\x20email\x20channel','imapAccounts','smtp','prototype','emit','mailAccounts','name','key','Imap','status','messageStatus','isNil'];(function(_0x58d488,_0x9afd95){var _0x3b8503=function(_0x5a0de6){while(--_0x5a0de6){_0x58d488['push'](_0x58d488['shift']());}};_0x3b8503(++_0x9afd95);}(_0x0ace,0x1cf));var _0xe0ac=function(_0x4370c7,_0x5dbfb0){_0x4370c7=_0x4370c7-0x0;var _0xce78a9=_0x0ace[_0x4370c7];return _0xce78a9;};'use strict';var _=require(_0xe0ac('0x0'));var moment=require(_0xe0ac('0x1'));var BPromise=require(_0xe0ac('0x2'));var md5=require(_0xe0ac('0x3'));var Redis=require(_0xe0ac('0x4'));var config=require(_0xe0ac('0x5'));var logger=require(_0xe0ac('0x6'))(_0xe0ac('0x7'));config[_0xe0ac('0x8')]=_['defaults'](config[_0xe0ac('0x8')],{'host':_0xe0ac('0x9'),'port':0x18eb});var io=require(_0xe0ac('0xa'))(new Redis(config[_0xe0ac('0x8')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xe0ac('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x1b2aa1){logger[_0xe0ac('0xc')](_0xe0ac('0xd'));this['mailAccounts']=_0x1b2aa1['mailAccounts'];this[_0xe0ac('0xe')]={};this[_0xe0ac('0xf')]=new EmailSmtp();}EmailChannel[_0xe0ac('0x10')][_0xe0ac('0x11')]=function(_0x169533){var _0x2f5664=this[_0xe0ac('0x12')][_0x169533];var _0x4e0425={'id':_0x2f5664['id'],'name':_0x2f5664[_0xe0ac('0x13')],'key':_0x2f5664[_0xe0ac('0x14')],'active':_0x2f5664['active'],'Imap':{'status':_0x2f5664[_0xe0ac('0x15')][_0xe0ac('0x16')],'messageStatus':_0x2f5664[_0xe0ac('0x15')][_0xe0ac('0x17')],'total':_0x2f5664[_0xe0ac('0x15')]['total']}};if(_[_0xe0ac('0x18')](md5Accounts[_0x169533])){md5Accounts[_0x169533]={};}var _0x565d49=md5(JSON[_0xe0ac('0x19')](_0x4e0425));if(md5Accounts[_0x169533]['md5']!==_0x565d49){md5Accounts[_0x169533]['md5']=_0x565d49;io[_0xe0ac('0x11')](_0xe0ac('0x1a'),_0x4e0425);}};EmailChannel[_0xe0ac('0x10')][_0xe0ac('0x1b')]=function(_0x576b62){for(var _0x5a91e0 in _0x576b62){if(_0x576b62[_0xe0ac('0x1c')](_0x5a91e0)){if(_0x576b62[_0x5a91e0][_0xe0ac('0x15')]&&_0x576b62[_0x5a91e0][_0xe0ac('0x1d')]){var _0x5122c1=_0x576b62[_0x5a91e0][_0xe0ac('0x15')];if(!_0x5122c1[_0xe0ac('0x1e')]&&_0x576b62[_0x5a91e0]['provider']!==_0xe0ac('0x1f'))_0x5122c1[_0xe0ac('0x1e')]=_0x576b62[_0x5a91e0][_0xe0ac('0x20')];if(!this[_0xe0ac('0xe')][_0xe0ac('0x1c')](_0x5122c1['id'])){this['imapAccounts'][_0x5122c1['id']]=new EmailImap(_0x5122c1,_0x576b62[_0x5a91e0][_0xe0ac('0x7')]);this[_0xe0ac('0xe')][_0x5122c1['id']]['on'](_0xe0ac('0x21'),this[_0xe0ac('0x22')][_0xe0ac('0x23')](this,_0x5a91e0));this['imapAccounts'][_0x5122c1['id']]['on'](_0xe0ac('0x7'),this[_0xe0ac('0x24')][_0xe0ac('0x23')](this,_0x5a91e0));this[_0xe0ac('0xe')][_0x5122c1['id']]['on']('end',this[_0xe0ac('0x25')][_0xe0ac('0x23')](this,_0x5a91e0));this['imapAccounts'][_0x5122c1['id']]['on']('error',this[_0xe0ac('0x26')][_0xe0ac('0x23')](this,_0x5a91e0));}}else{if(_['isNil'](this[_0xe0ac('0x12')][_0x5a91e0]['Imap'])){this[_0xe0ac('0x12')][_0x5a91e0][_0xe0ac('0x15')]={};}this[_0xe0ac('0x12')][_0x5a91e0][_0xe0ac('0x15')][_0xe0ac('0x16')]=_0xe0ac('0x27');this['mailAccounts'][_0x5a91e0]['Imap'][_0xe0ac('0x17')]='';this[_0xe0ac('0x11')](_0x5a91e0);}}}};EmailChannel[_0xe0ac('0x10')][_0xe0ac('0x22')]=function(_0xd18eac,_0x14afe1){if(this[_0xe0ac('0x12')][_0xd18eac]){this[_0xe0ac('0x12')][_0xd18eac]['Imap']['status']=_0xe0ac('0x28');this['mailAccounts'][_0xd18eac]['Imap'][_0xe0ac('0x17')]=_0x14afe1['name'];if(_0x14afe1[_0xe0ac('0x29')]){this[_0xe0ac('0x12')][_0xd18eac][_0xe0ac('0x15')]['total']=_0x14afe1[_0xe0ac('0x29')][_0xe0ac('0x2a')];}return this[_0xe0ac('0x11')](_0xd18eac);}};EmailChannel[_0xe0ac('0x10')][_0xe0ac('0x24')]=function(_0x4b6cdd,_0x436dd2){logger[_0xe0ac('0xc')](_0xe0ac('0x2b'),_0x436dd2[_0xe0ac('0x2c')],_0x436dd2[_0xe0ac('0x2d')],_0x436dd2[_0xe0ac('0x2e')],_0x4b6cdd);if(this['mailAccounts'][_0x4b6cdd]){return mailAccount[_0xe0ac('0x2f')](_0x4b6cdd,_0x436dd2)[_0xe0ac('0x30')](function(_0x2cae8b){if(_0x2cae8b){logger['info'](_0xe0ac('0x31'));}})['catch'](function(_0x50e304){logger[_0xe0ac('0x32')](_0xe0ac('0x33'),JSON['stringify'](_0x50e304));});}};EmailChannel['prototype'][_0xe0ac('0x25')]=function(_0x5a4539){if(this['mailAccounts'][_0x5a4539]&&this['mailAccounts'][_0x5a4539][_0xe0ac('0x15')]){if(this['imapAccounts'][this[_0xe0ac('0x12')][_0x5a4539]['Imap']['id']]){delete this[_0xe0ac('0xe')][this[_0xe0ac('0x12')][_0x5a4539][_0xe0ac('0x15')]['id']];}this[_0xe0ac('0x12')][_0x5a4539]['Imap'][_0xe0ac('0x34')]=moment();this[_0xe0ac('0x11')](_0x5a4539);}};EmailChannel[_0xe0ac('0x10')][_0xe0ac('0x26')]=function(_0x55e6fa,_0xec3ffd){if(this[_0xe0ac('0x12')][_0x55e6fa]){this[_0xe0ac('0x12')][_0x55e6fa][_0xe0ac('0x15')][_0xe0ac('0x16')]=_0xe0ac('0x32');this['mailAccounts'][_0x55e6fa][_0xe0ac('0x15')][_0xe0ac('0x17')]=_0xec3ffd;return this['emit'](_0x55e6fa);}};EmailChannel[_0xe0ac('0x10')][_0xe0ac('0x35')]=function(_0x3adbae,_0x418f8e){return this[_0xe0ac('0xf')][_0xe0ac('0x36')](_0x3adbae,_0x418f8e);};EmailChannel['prototype'][_0xe0ac('0x37')]=function(_0x114af3){var _0x12513e=this;if(this[_0xe0ac('0x12')][_0x114af3['id']]){if(_[_0xe0ac('0x18')](this[_0xe0ac('0x12')][_0x114af3['id']][_0xe0ac('0x38')])){this[_0xe0ac('0x12')][_0x114af3['id']][_0xe0ac('0x38')]={};}this[_0xe0ac('0x12')][_0x114af3['id']]['Smtp'][_0xe0ac('0x34')]=moment();return new BPromise(function(_0x20f029,_0x2cc246){return _0x12513e[_0xe0ac('0xf')]['verify'](_0x114af3)[_0xe0ac('0x30')](function(_0x225e9f){_0x12513e[_0xe0ac('0x12')][_0x114af3['id']][_0xe0ac('0x38')][_0xe0ac('0x16')]=_0xe0ac('0x39');_0x12513e['mailAccounts'][_0x114af3['id']][_0xe0ac('0x38')][_0xe0ac('0x17')]='';_0x12513e[_0xe0ac('0x11')](_0x114af3['id']);_0x20f029(_0x225e9f);})[_0xe0ac('0x3a')](function(_0x5d74bc){_0x12513e[_0xe0ac('0x12')][_0x114af3['id']][_0xe0ac('0x38')]['status']=_0xe0ac('0x32');_0x12513e['mailAccounts'][_0x114af3['id']][_0xe0ac('0x38')]['messageStatus']=_0x5d74bc;_0x12513e[_0xe0ac('0x11')](_0x114af3['id']);_0x2cc246(_0x5d74bc);});});}return this[_0xe0ac('0xf')][_0xe0ac('0x3b')](_0x114af3);};module[_0xe0ac('0x3c')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index f0992de..4d9d3af 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 _0x1321=['simpleParser','Iconv','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','imap','ready','bind','once','handleEnd','error','handleError','connect','inherits','prototype','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','handleReady','handleOpenBox','emit','box','readUnseen','end','search','handleReadUnseen','fetch','handleFetchMessage','handleFetchError','closeBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','handleFetchEnd','handleCloseBox','stringify','textCode','hasOwnProperty','exports','lodash','util','mailparser'];(function(_0x24b43c,_0x264bd0){var _0x37cf96=function(_0x3777de){while(--_0x3777de){_0x24b43c['push'](_0x24b43c['shift']());}};_0x37cf96(++_0x264bd0);}(_0x1321,0x171));var _0x1132=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x1321[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x1132('0x0'));var util=require(_0x1132('0x1'));var Imap=require('imap');var simpleParser=require(_0x1132('0x2'))[_0x1132('0x3')];var Iconv=require('iconv')[_0x1132('0x4')];var EventEmitter=require('events')[_0x1132('0x5')];var utils=require(_0x1132('0x6'));var logger=require(_0x1132('0x7'))(_0x1132('0x8'));function EmailImap(_0x399ad1,_0x5915fa){this[_0x1132('0x9')]=_0x399ad1['mailbox'];this[_0x1132('0xa')]=this[_0x1132('0xb')](_0x399ad1,_0x5915fa);this[_0x1132('0xc')]=new Imap(this[_0x1132('0xa')]);this['imap']['once'](_0x1132('0xd'),this['handleReady'][_0x1132('0xe')](this));this[_0x1132('0xc')][_0x1132('0xf')]('end',this[_0x1132('0x10')]['bind'](this));this[_0x1132('0xc')]['on'](_0x1132('0x11'),this[_0x1132('0x12')]['bind'](this));this[_0x1132('0xc')][_0x1132('0x13')]();}util[_0x1132('0x14')](EmailImap,EventEmitter);EmailImap[_0x1132('0x15')][_0x1132('0xb')]=function(_0x2cb889,_0x1c7a02){var _0x33d51b={'connTimeout':_0x2cb889['connTimeout']?_0x2cb889['connTimeout']*0x3e8:0x2710,'authTimeout':_0x2cb889[_0x1132('0x16')]?_0x2cb889[_0x1132('0x16')]*0x3e8:0x1388};if(_0x2cb889[_0x1132('0x17')]){_0x33d51b[_0x1132('0x18')]=_0x2cb889['user'];if(_0x2cb889[_0x1132('0x19')]){_0x33d51b[_0x1132('0x1a')]=utils[_0x1132('0x1b')](_0x2cb889[_0x1132('0x1c')][_0x1132('0x1d')],_0x2cb889[_0x1132('0x18')]);}else{_0x33d51b[_0x1132('0x1e')]=_0x2cb889[_0x1132('0x1e')];}}else{if(_0x2cb889[_0x1132('0x1f')]){_0x33d51b[_0x1132('0x18')]=_0x2cb889[_0x1132('0x18')];_0x33d51b[_0x1132('0x1e')]=_0x2cb889['password'];}}_0x33d51b['email']=_0x1c7a02||_0x2cb889[_0x1132('0x18')]||_0x1132('0x20');_0x33d51b[_0x1132('0x21')]=_0x2cb889[_0x1132('0x21')];_0x33d51b[_0x1132('0x22')]=_0x2cb889[_0x1132('0x22')]||0x3e1;if(_0x2cb889[_0x1132('0x23')]){_0x33d51b[_0x1132('0x23')]=!![];}else{_0x33d51b[_0x1132('0x23')]=![];_0x33d51b[_0x1132('0x24')]=_0x1132('0x25');}return _0x33d51b;};EmailImap[_0x1132('0x15')][_0x1132('0x26')]=function(){this[_0x1132('0xc')]['openBox'](this[_0x1132('0x9')],![],this[_0x1132('0x27')][_0x1132('0xe')](this));};EmailImap[_0x1132('0x15')]['handleOpenBox']=function(_0x2bc783,_0x330a96){if(_0x2bc783){this[_0x1132('0x12')](_0x2bc783,!![]);}else{this[_0x1132('0x28')](_0x1132('0x29'),_0x330a96);this[_0x1132('0x2a')]();}};EmailImap[_0x1132('0x15')]['handleCloseBox']=function(_0x535a9e){if(_0x535a9e){this[_0x1132('0x12')](_0x535a9e,!![]);}else{this[_0x1132('0xc')][_0x1132('0x2b')]();}};EmailImap['prototype'][_0x1132('0x2a')]=function(){this[_0x1132('0xc')][_0x1132('0x2c')](['UNSEEN'],this[_0x1132('0x2d')]['bind'](this));};EmailImap[_0x1132('0x15')]['handleReadUnseen']=function(_0xf7871d,_0x5883f8){if(_0xf7871d){this[_0x1132('0x12')](_0xf7871d,!![]);}else{if(_0x5883f8['length']){try{var _0x9931be=this[_0x1132('0xc')][_0x1132('0x2e')](_0x5883f8,{'bodies':'','markSeen':!![]});_0x9931be['on']('message',this[_0x1132('0x2f')]['bind'](this));_0x9931be[_0x1132('0xf')]('error',this[_0x1132('0x30')][_0x1132('0xe')](this));_0x9931be['once'](_0x1132('0x2b'),this['handleFetchEnd'][_0x1132('0xe')](this));}catch(_0x251a1b){logger[_0x1132('0x11')](_0x251a1b);}}else{this[_0x1132('0xc')][_0x1132('0x31')](!![],this['handleCloseBox'][_0x1132('0xe')](this));}}};EmailImap['prototype'][_0x1132('0x2f')]=function(_0x1bafb9){_0x1bafb9['on'](_0x1132('0x32'),this['handleMessageBody'][_0x1132('0xe')](this));_0x1bafb9['once'](_0x1132('0x33'),this[_0x1132('0x34')][_0x1132('0xe')](this));_0x1bafb9[_0x1132('0xf')](_0x1132('0x2b'),this[_0x1132('0x35')][_0x1132('0xe')](this));};EmailImap[_0x1132('0x15')][_0x1132('0x36')]=function(_0x4dbc27){simpleParser(_0x4dbc27,{'Iconv':Iconv},this[_0x1132('0x37')]['bind'](this));};EmailImap[_0x1132('0x15')][_0x1132('0x34')]=function(){};EmailImap[_0x1132('0x15')]['handleMessageEnd']=function(){};EmailImap[_0x1132('0x15')][_0x1132('0x37')]=function(_0x49fa92,_0x1ed4db){if(_0x49fa92){logger[_0x1132('0x11')](_0x49fa92);}else{var _0x1309f0=this;utils['parser'](this[_0x1132('0xa')],_0x1ed4db,function(_0x1e2cf4){_0x1309f0['emit'](_0x1132('0x8'),_0x1e2cf4);});}};EmailImap['prototype'][_0x1132('0x38')]=function(){this[_0x1132('0xc')][_0x1132('0x31')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x1132('0x15')][_0x1132('0x30')]=function(_0x4c7f5a){this[_0x1132('0x12')](_0x4c7f5a);this[_0x1132('0xc')][_0x1132('0x31')](!![],this[_0x1132('0x39')][_0x1132('0xe')](this));};EmailImap[_0x1132('0x15')][_0x1132('0x10')]=function(){this[_0x1132('0x28')](_0x1132('0x2b'));};EmailImap[_0x1132('0x15')][_0x1132('0x12')]=function(_0x148c82,_0x3c5740){logger['error'](_0x1132('0x12'),this['account'][_0x1132('0x8')],JSON[_0x1132('0x3a')](_0x148c82));var _0x2a6cf5='';if(_0x148c82){if(_0x148c82[_0x1132('0x3b')]){_0x2a6cf5=_0x148c82[_0x1132('0x3b')];}else{for(var _0x9351fa in _0x148c82){if(_0x148c82[_0x1132('0x3c')](_0x9351fa)){_0x2a6cf5+=_['upperFirst'](_0x9351fa)+':\x20'+_0x148c82[_0x9351fa]+'\x0a';}}}}if(_0x3c5740){this[_0x1132('0xc')]['end']();}else{this[_0x1132('0x28')](_0x1132('0x11'),_0x2a6cf5);this[_0x1132('0x28')](_0x1132('0x2b'));}};module[_0x1132('0x3d')]=EmailImap; \ No newline at end of file +var _0x93ec=['handleFetchEnd','closeBox','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','account','textCode','hasOwnProperty','upperFirst','exports','lodash','util','mailparser','iconv','Iconv','events','EventEmitter','../../../config/logger','email','getAccount','imap','once','handleReady','end','handleEnd','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','CloudProvider','data5','password','anonymous@xcally.com','port','tls','autotls','required','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','fetch','handleFetchMessage','handleFetchError'];(function(_0x1ffbc7,_0xc2d684){var _0x33b33f=function(_0x2097f6){while(--_0x2097f6){_0x1ffbc7['push'](_0x1ffbc7['shift']());}};_0x33b33f(++_0xc2d684);}(_0x93ec,0x16f));var _0xc93e=function(_0x2d5818,_0xc9aa8b){_0x2d5818=_0x2d5818-0x0;var _0x1d1e9d=_0x93ec[_0x2d5818];return _0x1d1e9d;};'use strict';var _=require(_0xc93e('0x0'));var util=require(_0xc93e('0x1'));var Imap=require('imap');var simpleParser=require(_0xc93e('0x2'))['simpleParser'];var Iconv=require(_0xc93e('0x3'))[_0xc93e('0x4')];var EventEmitter=require(_0xc93e('0x5'))[_0xc93e('0x6')];var utils=require('./utils');var logger=require(_0xc93e('0x7'))(_0xc93e('0x8'));function EmailImap(_0x2d072a,_0x591a7c){this['mailbox']=_0x2d072a['mailbox'];this['account']=this[_0xc93e('0x9')](_0x2d072a,_0x591a7c);this['imap']=new Imap(this['account']);this[_0xc93e('0xa')][_0xc93e('0xb')]('ready',this[_0xc93e('0xc')]['bind'](this));this[_0xc93e('0xa')][_0xc93e('0xb')](_0xc93e('0xd'),this[_0xc93e('0xe')][_0xc93e('0xf')](this));this[_0xc93e('0xa')]['on'](_0xc93e('0x10'),this[_0xc93e('0x11')][_0xc93e('0xf')](this));this[_0xc93e('0xa')][_0xc93e('0x12')]();}util[_0xc93e('0x13')](EmailImap,EventEmitter);EmailImap[_0xc93e('0x14')][_0xc93e('0x9')]=function(_0x1afa83,_0x5609c2){var _0x2bd25a={'connTimeout':_0x1afa83[_0xc93e('0x15')]?_0x1afa83[_0xc93e('0x15')]*0x3e8:0x2710,'authTimeout':_0x1afa83['authTimeout']?_0x1afa83[_0xc93e('0x16')]*0x3e8:0x1388};if(_0x1afa83[_0xc93e('0x17')]){_0x2bd25a[_0xc93e('0x18')]=_0x1afa83[_0xc93e('0x18')];if(_0x1afa83[_0xc93e('0x19')]){_0x2bd25a[_0xc93e('0x1a')]=utils['generateXOAuth2Token'](_0x1afa83[_0xc93e('0x1b')][_0xc93e('0x1c')],_0x1afa83[_0xc93e('0x18')]);}else{_0x2bd25a[_0xc93e('0x1d')]=_0x1afa83[_0xc93e('0x1d')];}}else{if(_0x1afa83['authentication']){_0x2bd25a[_0xc93e('0x18')]=_0x1afa83['user'];_0x2bd25a[_0xc93e('0x1d')]=_0x1afa83[_0xc93e('0x1d')];}}_0x2bd25a[_0xc93e('0x8')]=_0x5609c2||_0x1afa83[_0xc93e('0x18')]||_0xc93e('0x1e');_0x2bd25a['host']=_0x1afa83['host'];_0x2bd25a[_0xc93e('0x1f')]=_0x1afa83[_0xc93e('0x1f')]||0x3e1;if(_0x1afa83['tls']){_0x2bd25a[_0xc93e('0x20')]=!![];}else{_0x2bd25a[_0xc93e('0x20')]=![];_0x2bd25a[_0xc93e('0x21')]=_0xc93e('0x22');}return _0x2bd25a;};EmailImap[_0xc93e('0x14')][_0xc93e('0xc')]=function(){this[_0xc93e('0xa')][_0xc93e('0x23')](this['mailbox'],![],this[_0xc93e('0x24')][_0xc93e('0xf')](this));};EmailImap['prototype'][_0xc93e('0x24')]=function(_0x1f1734,_0x3957e0){if(_0x1f1734){this[_0xc93e('0x11')](_0x1f1734,!![]);}else{this[_0xc93e('0x25')](_0xc93e('0x26'),_0x3957e0);this[_0xc93e('0x27')]();}};EmailImap[_0xc93e('0x14')][_0xc93e('0x28')]=function(_0x209b38){if(_0x209b38){this['handleError'](_0x209b38,!![]);}else{this['imap']['end']();}};EmailImap[_0xc93e('0x14')][_0xc93e('0x27')]=function(){this['imap'][_0xc93e('0x29')]([_0xc93e('0x2a')],this['handleReadUnseen']['bind'](this));};EmailImap[_0xc93e('0x14')]['handleReadUnseen']=function(_0x3b8310,_0x497b84){if(_0x3b8310){this[_0xc93e('0x11')](_0x3b8310,!![]);}else{if(_0x497b84['length']){try{var _0x1d7748=this[_0xc93e('0xa')][_0xc93e('0x2b')](_0x497b84,{'bodies':'','markSeen':!![]});_0x1d7748['on']('message',this[_0xc93e('0x2c')][_0xc93e('0xf')](this));_0x1d7748[_0xc93e('0xb')](_0xc93e('0x10'),this[_0xc93e('0x2d')][_0xc93e('0xf')](this));_0x1d7748[_0xc93e('0xb')](_0xc93e('0xd'),this[_0xc93e('0x2e')][_0xc93e('0xf')](this));}catch(_0xd34476){logger[_0xc93e('0x10')](_0xd34476);}}else{this[_0xc93e('0xa')][_0xc93e('0x2f')](!![],this[_0xc93e('0x28')]['bind'](this));}}};EmailImap[_0xc93e('0x14')][_0xc93e('0x2c')]=function(_0x4610c1){_0x4610c1['on']('body',this[_0xc93e('0x30')][_0xc93e('0xf')](this));_0x4610c1['once'](_0xc93e('0x31'),this[_0xc93e('0x32')][_0xc93e('0xf')](this));_0x4610c1[_0xc93e('0xb')](_0xc93e('0xd'),this[_0xc93e('0x33')]['bind'](this));};EmailImap[_0xc93e('0x14')][_0xc93e('0x30')]=function(_0x1cab41){simpleParser(_0x1cab41,{'Iconv':Iconv},this['handleSimpleParser'][_0xc93e('0xf')](this));};EmailImap[_0xc93e('0x14')][_0xc93e('0x32')]=function(){};EmailImap[_0xc93e('0x14')]['handleMessageEnd']=function(){};EmailImap[_0xc93e('0x14')][_0xc93e('0x34')]=function(_0x1881cf,_0x2866bf){if(_0x1881cf){logger['error'](_0x1881cf);}else{var _0x8819ef=this;utils[_0xc93e('0x35')](this['account'],_0x2866bf,function(_0x4fe184){_0x8819ef[_0xc93e('0x25')](_0xc93e('0x8'),_0x4fe184);});}};EmailImap[_0xc93e('0x14')]['handleFetchEnd']=function(){this[_0xc93e('0xa')][_0xc93e('0x2f')](!![],this[_0xc93e('0x28')][_0xc93e('0xf')](this));};EmailImap['prototype'][_0xc93e('0x2d')]=function(_0x2ab456){this['handleError'](_0x2ab456);this['imap'][_0xc93e('0x2f')](!![],this['handleCloseBox'][_0xc93e('0xf')](this));};EmailImap[_0xc93e('0x14')]['handleEnd']=function(){this['emit'](_0xc93e('0xd'));};EmailImap[_0xc93e('0x14')][_0xc93e('0x11')]=function(_0x3932e2,_0x264d9a){logger['error'](_0xc93e('0x11'),this[_0xc93e('0x36')][_0xc93e('0x8')],JSON['stringify'](_0x3932e2));var _0x5f2cec='';if(_0x3932e2){if(_0x3932e2[_0xc93e('0x37')]){_0x5f2cec=_0x3932e2[_0xc93e('0x37')];}else{for(var _0x5a935f in _0x3932e2){if(_0x3932e2[_0xc93e('0x38')](_0x5a935f)){_0x5f2cec+=_[_0xc93e('0x39')](_0x5a935f)+':\x20'+_0x3932e2[_0x5a935f]+'\x0a';}}}}if(_0x264d9a){this[_0xc93e('0xa')]['end']();}else{this['emit'](_0xc93e('0x10'),_0x5f2cec);this[_0xc93e('0x25')]('end');}};module[_0xc93e('0x3a')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index c88dfdc..2aaf734 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 _0x9765=['compile','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use'];(function(_0x26a39c,_0x50d76d){var _0x487cc7=function(_0x24575e){while(--_0x24575e){_0x26a39c['push'](_0x26a39c['shift']());}};_0x487cc7(++_0x50d76d);}(_0x9765,0x12e));var _0x5976=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x9765[_0x4ae6ef];return _0x3cbb4e;};'use strict';var nodemailer=require(_0x5976('0x0'));var inlineBase64=require(_0x5976('0x1'));function EmailSmtp(){}EmailSmtp[_0x5976('0x2')][_0x5976('0x3')]=function(_0x392011,_0x1e352d){return new Promise(function(_0x1579b1,_0x15b859){var _0x579c56=nodemailer[_0x5976('0x4')](_0x392011);_0x579c56[_0x5976('0x5')](_0x5976('0x6'),inlineBase64());_0x579c56['sendMail'](_0x1e352d,function(_0x47b567,_0xa9ad46){if(_0x47b567){_0x15b859(_0x47b567[_0x5976('0x7')]());}else{_0x1579b1(_0xa9ad46);}});});};EmailSmtp[_0x5976('0x2')][_0x5976('0x8')]=function(_0x4753ca){return new Promise(function(_0x4145cb,_0xb1435e){var _0x22109d=nodemailer[_0x5976('0x4')](_0x4753ca);_0x22109d['verify'](function(_0x50707f,_0xea9d4){if(_0x50707f){_0xb1435e(_0x50707f[_0x5976('0x7')]());}else{if(_0xea9d4){_0x4145cb(_0xea9d4);}else{_0xb1435e(_0x5976('0x9'));}}});});};module[_0x5976('0xa')]=EmailSmtp; \ No newline at end of file +var _0x4e99=['nodemailer-plugin-inline-base64','prototype','createTransport','use','sendMail','toString','verify','exports','nodemailer'];(function(_0x527365,_0x36fb3a){var _0x5de073=function(_0x52a251){while(--_0x52a251){_0x527365['push'](_0x527365['shift']());}};_0x5de073(++_0x36fb3a);}(_0x4e99,0xaa));var _0x94e9=function(_0x1df1b0,_0x113423){_0x1df1b0=_0x1df1b0-0x0;var _0x13322c=_0x4e99[_0x1df1b0];return _0x13322c;};'use strict';var nodemailer=require(_0x94e9('0x0'));var inlineBase64=require(_0x94e9('0x1'));function EmailSmtp(){}EmailSmtp[_0x94e9('0x2')]['send']=function(_0x1bf480,_0x1dcb35){return new Promise(function(_0x27d024,_0x43cd6c){var _0x584d47=nodemailer[_0x94e9('0x3')](_0x1bf480);_0x584d47[_0x94e9('0x4')]('compile',inlineBase64());_0x584d47[_0x94e9('0x5')](_0x1dcb35,function(_0x1784b3,_0x21ba3f){if(_0x1784b3){_0x43cd6c(_0x1784b3[_0x94e9('0x6')]());}else{_0x27d024(_0x21ba3f);}});});};EmailSmtp['prototype']['verify']=function(_0x1911f5){return new Promise(function(_0x395108,_0x5c8a0e){var _0x5ae5f9=nodemailer[_0x94e9('0x3')](_0x1911f5);_0x5ae5f9[_0x94e9('0x7')](function(_0x1d4fec,_0x1c93bf){if(_0x1d4fec){_0x5c8a0e(_0x1d4fec[_0x94e9('0x6')]());}else{if(_0x1c93bf){_0x395108(_0x1c93bf);}else{_0x5c8a0e('Not\x20verifired');}}});});};module[_0x94e9('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 fdaf0ea..a9888f6 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 _0xfec3=['filename','attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','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','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','Attachments','Title','Data','

Empty\x20message

','generateXOAuth2Token','toString','base64','lodash','moment','randomstring','path','util','node-tnef','email','head','address','generate','@xcally.com','value','name','indexOf','length','slice','join','split','pop','anonymous','html','test','replace','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x36d75c[_0x3fec('0xf')](0x0,-0x1)[_0x3fec('0x10')]('\x20'):_0x398a22[_0x3fec('0xc')];}return'Anonymous';}function getLastName(_0x1918de){var _0x13f812=_['head'](_0x1918de[_0x3fec('0xb')]);if(_0x13f812&&_0x13f812[_0x3fec('0xc')]){var _0x4d581f=_0x13f812[_0x3fec('0xc')][_0x3fec('0x11')](/\s+/);return _0x4d581f[_0x3fec('0xe')]>0x1?_0x4d581f[_0x3fec('0x12')]():'';}return'';}function getMails(_0x5b71f5,_0x278f57){var _0x4654db='';for(var _0x563aad=0x0;_0x563aad<_0x278f57['value'][_0x3fec('0xe')];_0x563aad+=0x1){if(_0x278f57['value'][_0x563aad][_0x3fec('0x8')]!==_0x5b71f5){if(!_['isEmpty'](_0x4654db)){_0x4654db+=',';}_0x4654db+=_0x278f57[_0x3fec('0xb')][_0x563aad][_0x3fec('0xc')]||_0x278f57['value'][_0x563aad][_0x3fec('0x8')]||'';_0x4654db+='\x20<';_0x4654db+=_0x278f57[_0x3fec('0xb')][_0x563aad][_0x3fec('0x8')]?_0x278f57[_0x3fec('0xb')][_0x563aad][_0x3fec('0x8')]:_0x3fec('0x13')+random['generate'](0x6)+_0x3fec('0xa');_0x4654db+='>';}}return _0x4654db;}function parseEmail(_0x5bc097,_0x19771e,_0x23fb36){if(_0x19771e[_0x3fec('0x14')]){var _0x200659=/)<[^<]*)*<\/script>/gi;while(_0x200659[_0x3fec('0x15')](_0x19771e[_0x3fec('0x14')])){_0x19771e[_0x3fec('0x14')]=_0x19771e['html'][_0x3fec('0x16')](_0x200659,'');}if(_0x19771e[_0x3fec('0x14')]['includes'](_0x3fec('0x17'))){var _0x3ca8e3=[];_0x19771e['attachments'][_0x3fec('0x18')](_0x539769=>{_0x3ca8e3[_0x3fec('0x19')](_0x539769['filename']);});var _0x531e5c=/]+>/g;var _0x155616=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x353602=_0x19771e[_0x3fec('0x14')][_0x3fec('0x16')](_0x155616,_0x3fec('0x1a'));var _0x2e68ae=_0x353602['replace'](_0x531e5c,_0x3fec('0x1b'));for(let _0x11fc98=0x0;_0x11fc98<_0x3ca8e3[_0x3fec('0xe')];_0x11fc98++){var _0x3a0b28=_0x2e68ae[_0x3fec('0x16')](_0x3fec('0x1b'),_0x3fec('0x1c')+_0x3ca8e3[_0x11fc98]+_0x3fec('0x1d'));_0x2e68ae=_0x3a0b28;}_0x19771e[_0x3fec('0x14')]=_0x2e68ae;}_0x23fb36[_0x3fec('0x1e')]=_0x19771e[_0x3fec('0x14')];}else{_0x23fb36[_0x3fec('0x1e')]=_0x19771e[_0x3fec('0x1f')];}if(_0x23fb36[_0x3fec('0x1e')]){_0x23fb36['body']=_0x23fb36[_0x3fec('0x1e')][_0x3fec('0x16')](/0x0){var _0x5b064a=[_0x3fec('0x33'),_0x3fec('0x34'),_0x3fec('0x35')];for(var _0x106ce6=0x0;_0x106ce6<_0x19771e[_0x3fec('0x32')][_0x3fec('0xe')];_0x106ce6++){var _0x4dd8f2=_[_0x3fec('0xd')](_0x5b064a,_0x19771e[_0x3fec('0x32')][_0x106ce6][_0x3fec('0x36')]);if(_0x4dd8f2>=0x0){_0x23fb36[_0x3fec('0x37')]=!![];}}}return _0x23fb36;}exports[_0x3fec('0x38')]=function(_0x381a5f,_0x4354e9,_0x4ec21b){var _0x4801c6={'from':getAddress(_0x4354e9['from']),'firstName':getFirstName(_0x4354e9[_0x3fec('0x39')]),'lastName':getLastName(_0x4354e9[_0x3fec('0x39')]),'mapKey':_0x3fec('0x6'),'message':{'from':getMails(_0x381a5f[_0x3fec('0x6')],_0x4354e9[_0x3fec('0x39')]),'to':_0x381a5f['email'],'cc':'','subject':_0x4354e9[_0x3fec('0x3a')]||'','messageId':_0x4354e9[_0x3fec('0x3b')],'inReplyTo':_0x4354e9[_0x3fec('0x3c')],'sentAt':moment(_0x4354e9[_0x3fec('0x3d')])[_0x3fec('0x2c')](_0x3fec('0x3e')),'attach':![],'attachments':[]}};if(!_0x4354e9[_0x3fec('0x14')]&&!_0x4354e9[_0x3fec('0x1f')]){var _0x4f27a9=_[_0x3fec('0x3f')](_0x4354e9[_0x3fec('0x27')],{'contentType':'application/ms-tnef'});if(_0x4f27a9['length']){logger[_0x3fec('0x40')](util[_0x3fec('0x2c')](_0x3fec('0x41'),_0x4354e9[_0x3fec('0x3b')]));tnef[_0x3fec('0x42')](_[_0x3fec('0x43')](_0x4f27a9)['content'],function(_0x587971,_0x429ce5){if(_0x429ce5){_0x4354e9['html']=_0x429ce5[_0x3fec('0x44')]||'

Empty\x20message

';if(_0x429ce5['Attachments']){for(var _0x301d0f=0x0;_0x301d0f<_0x429ce5[_0x3fec('0x45')]['length'];_0x301d0f++){var _0x2bcbb8=_0x429ce5[_0x3fec('0x45')][_0x301d0f];_0x4801c6[_0x3fec('0x21')][_0x3fec('0x27')][_0x3fec('0x19')]({'filename':_0x2bcbb8[_0x3fec('0x46')],'content':Buffer['from'](_0x2bcbb8[_0x3fec('0x47')])});}}}_0x4ec21b(parseEmail(_0x381a5f,_0x4354e9,_0x4801c6));});}else{_0x4354e9['html']=_0x3fec('0x48');_0x4ec21b(parseEmail(_0x381a5f,_0x4354e9,_0x4801c6));}}else{_0x4ec21b(parseEmail(_0x381a5f,_0x4354e9,_0x4801c6));}};exports[_0x3fec('0x49')]=function(_0xe4d2ad,_0x3fe6aa){var _0xfebd55=['user='+(_0x3fe6aa||''),'auth=Bearer\x20'+_0xe4d2ad,'',''];return Buffer['from'](_0xfebd55[_0x3fec('0x10')](''),'utf-8')[_0x3fec('0x4a')](_0x3fec('0x4b'));}; \ No newline at end of file +var _0xe4df=['split','length','slice','join','Anonymous','pop','isEmpty','anonymous','html','test','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','../../../config/logger','email','../../../config/environment','head','value','address','generate','name','substring'];(function(_0x1f7201,_0x141b79){var _0x289fd2=function(_0x20ce23){while(--_0x20ce23){_0x1f7201['push'](_0x1f7201['shift']());}};_0x289fd2(++_0x141b79);}(_0xe4df,0xdf));var _0xfe4d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe4df[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xfe4d('0x0'));var moment=require(_0xfe4d('0x1'));var random=require(_0xfe4d('0x2'));var fs=require('fs');var path=require(_0xfe4d('0x3'));var util=require(_0xfe4d('0x4'));var tnef=require('node-tnef');var logger=require(_0xfe4d('0x5'))(_0xfe4d('0x6'));var config=require(_0xfe4d('0x7'));function getAddress(_0x38c887){var _0x5c0034=_[_0xfe4d('0x8')](_0x38c887[_0xfe4d('0x9')]);return _0x5c0034&&_0x5c0034[_0xfe4d('0xa')]?_0x5c0034['address']:'anonymous'+random[_0xfe4d('0xb')](0x6)+'@xcally.com';}function getFirstName(_0x576d8d){var _0x1ceab0=_[_0xfe4d('0x8')](_0x576d8d[_0xfe4d('0x9')]);if(_0x1ceab0&&_0x1ceab0[_0xfe4d('0xc')]){if(_0x1ceab0[_0xfe4d('0xc')]==_0x1ceab0[_0xfe4d('0xa')]){return _0x1ceab0['name'][_0xfe4d('0xd')](0x0,_0x1ceab0[_0xfe4d('0xc')]['indexOf']('@'));}var _0x586fc2=_0x1ceab0[_0xfe4d('0xc')][_0xfe4d('0xe')](/\s+/);return _0x586fc2[_0xfe4d('0xf')]>0x1?_0x586fc2[_0xfe4d('0x10')](0x0,-0x1)[_0xfe4d('0x11')]('\x20'):_0x1ceab0[_0xfe4d('0xc')];}return _0xfe4d('0x12');}function getLastName(_0x45bfb4){var _0x57613e=_[_0xfe4d('0x8')](_0x45bfb4['value']);if(_0x57613e&&_0x57613e['name']){var _0x22696c=_0x57613e['name'][_0xfe4d('0xe')](/\s+/);return _0x22696c[_0xfe4d('0xf')]>0x1?_0x22696c[_0xfe4d('0x13')]():'';}return'';}function getMails(_0x46dba,_0x2f4b0a){var _0x4f7898='';for(var _0x13da9f=0x0;_0x13da9f<_0x2f4b0a[_0xfe4d('0x9')][_0xfe4d('0xf')];_0x13da9f+=0x1){if(_0x2f4b0a['value'][_0x13da9f][_0xfe4d('0xa')]!==_0x46dba){if(!_[_0xfe4d('0x14')](_0x4f7898)){_0x4f7898+=',';}_0x4f7898+=_0x2f4b0a[_0xfe4d('0x9')][_0x13da9f][_0xfe4d('0xc')]||_0x2f4b0a['value'][_0x13da9f][_0xfe4d('0xa')]||'';_0x4f7898+='\x20<';_0x4f7898+=_0x2f4b0a[_0xfe4d('0x9')][_0x13da9f]['address']?_0x2f4b0a[_0xfe4d('0x9')][_0x13da9f][_0xfe4d('0xa')]:_0xfe4d('0x15')+random[_0xfe4d('0xb')](0x6)+'@xcally.com';_0x4f7898+='>';}}return _0x4f7898;}function parseEmail(_0x41c7af,_0x213190,_0xc266df){if(_0x213190[_0xfe4d('0x16')]){var _0x23e7d3=/)<[^<]*)*<\/script>/gi;while(_0x23e7d3[_0xfe4d('0x17')](_0x213190[_0xfe4d('0x16')])){_0x213190[_0xfe4d('0x16')]=_0x213190['html']['replace'](_0x23e7d3,'');}if(_0x213190['html']['includes'](_0xfe4d('0x18'))){var _0x49a0e9=[];_0x213190[_0xfe4d('0x19')][_0xfe4d('0x1a')](_0x202cc3=>{_0x49a0e9[_0xfe4d('0x1b')](_0x202cc3[_0xfe4d('0x1c')]);});var _0x26399d=/]+>/g;var _0x16f910=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5d4410=_0x213190[_0xfe4d('0x16')][_0xfe4d('0x1d')](_0x16f910,_0xfe4d('0x1e'));var _0x2b454a=_0x5d4410['replace'](_0x26399d,_0xfe4d('0x1f'));for(let _0x4d1107=0x0;_0x4d1107<_0x49a0e9[_0xfe4d('0xf')];_0x4d1107++){var _0x3d1336=_0x2b454a[_0xfe4d('0x1d')](_0xfe4d('0x1f'),_0xfe4d('0x20')+_0x49a0e9[_0x4d1107]+_0xfe4d('0x21'));_0x2b454a=_0x3d1336;}_0x213190['html']=_0x2b454a;}_0xc266df['body']=_0x213190[_0xfe4d('0x16')];}else{_0xc266df['body']=_0x213190['textAsHtml'];}if(_0xc266df[_0xfe4d('0x22')]){_0xc266df[_0xfe4d('0x22')]=_0xc266df[_0xfe4d('0x22')]['replace'](/0x0){var _0x771341=[_0xfe4d('0x32'),_0xfe4d('0x33'),_0xfe4d('0x34')];for(var _0x1c7930=0x0;_0x1c7930<_0x213190[_0xfe4d('0x31')]['length'];_0x1c7930++){var _0x3972a1=_[_0xfe4d('0x35')](_0x771341,_0x213190[_0xfe4d('0x31')][_0x1c7930][_0xfe4d('0x36')]);if(_0x3972a1>=0x0){_0xc266df[_0xfe4d('0x37')]=!![];}}}return _0xc266df;}exports[_0xfe4d('0x38')]=function(_0x260e15,_0x19174f,_0x562bc1){var _0x5c1a0d={'from':getAddress(_0x19174f[_0xfe4d('0x39')]),'firstName':getFirstName(_0x19174f[_0xfe4d('0x39')]),'lastName':getLastName(_0x19174f[_0xfe4d('0x39')]),'mapKey':_0xfe4d('0x6'),'message':{'from':getMails(_0x260e15['email'],_0x19174f[_0xfe4d('0x39')]),'to':_0x260e15[_0xfe4d('0x6')],'cc':'','subject':_0x19174f[_0xfe4d('0x3a')]||'','messageId':_0x19174f[_0xfe4d('0x3b')],'inReplyTo':_0x19174f[_0xfe4d('0x3c')],'sentAt':moment(_0x19174f[_0xfe4d('0x3d')])[_0xfe4d('0x2b')](_0xfe4d('0x3e')),'attach':![],'attachments':[]}};if(!_0x19174f[_0xfe4d('0x16')]&&!_0x19174f[_0xfe4d('0x3f')]){var _0x4e6a6f=_[_0xfe4d('0x40')](_0x19174f[_0xfe4d('0x19')],{'contentType':_0xfe4d('0x41')});if(_0x4e6a6f[_0xfe4d('0xf')]){logger[_0xfe4d('0x42')](util[_0xfe4d('0x2b')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x19174f[_0xfe4d('0x3b')]));tnef[_0xfe4d('0x43')](_['first'](_0x4e6a6f)['content'],function(_0x147777,_0x1b246e){if(_0x1b246e){_0x19174f[_0xfe4d('0x16')]=_0x1b246e[_0xfe4d('0x44')]||_0xfe4d('0x45');if(_0x1b246e[_0xfe4d('0x46')]){for(var _0x531d74=0x0;_0x531d74<_0x1b246e[_0xfe4d('0x46')][_0xfe4d('0xf')];_0x531d74++){var _0x234553=_0x1b246e[_0xfe4d('0x46')][_0x531d74];_0x5c1a0d['message'][_0xfe4d('0x19')]['push']({'filename':_0x234553[_0xfe4d('0x47')],'content':Buffer[_0xfe4d('0x39')](_0x234553[_0xfe4d('0x48')])});}}}_0x562bc1(parseEmail(_0x260e15,_0x19174f,_0x5c1a0d));});}else{_0x19174f[_0xfe4d('0x16')]=_0xfe4d('0x45');_0x562bc1(parseEmail(_0x260e15,_0x19174f,_0x5c1a0d));}}else{_0x562bc1(parseEmail(_0x260e15,_0x19174f,_0x5c1a0d));}};exports[_0xfe4d('0x49')]=function(_0x2d31ee,_0x2285be){var _0x583763=[_0xfe4d('0x4a')+(_0x2285be||''),_0xfe4d('0x4b')+_0x2d31ee,'',''];return Buffer[_0xfe4d('0x39')](_0x583763[_0xfe4d('0x11')](''),_0xfe4d('0x4c'))[_0xfe4d('0x4d')](_0xfe4d('0x4e'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 1a0ad94..b862ce1 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 _0xf00d=['key','Imap','Smtp','lodash','name'];(function(_0x14fa7e,_0x2e03df){var _0x117569=function(_0x477bcb){while(--_0x477bcb){_0x14fa7e['push'](_0x14fa7e['shift']());}};_0x117569(++_0x2e03df);}(_0xf00d,0xdf));var _0xdf00=function(_0x2dfcfa,_0x25975e){_0x2dfcfa=_0x2dfcfa-0x0;var _0x1cdd82=_0xf00d[_0x2dfcfa];return _0x1cdd82;};'use strict';var _=require(_0xdf00('0x0'));function MailAccount(_0x32d8ec){this['id']=_0x32d8ec['id']||0x0;this[_0xdf00('0x1')]=_0x32d8ec[_0xdf00('0x1')]||'Service';this[_0xdf00('0x2')]=_0x32d8ec[_0xdf00('0x2')]||'SERV';this['active']=_0x32d8ec['active']||![];this[_0xdf00('0x3')]=_0x32d8ec[_0xdf00('0x3')]||[];this['Smtp']=_0x32d8ec[_0xdf00('0x4')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x53d2=['Smtp','exports','lodash','name','Service','key','SERV','active','Imap'];(function(_0x543f21,_0x170a2e){var _0x1d1f3e=function(_0xf13c32){while(--_0xf13c32){_0x543f21['push'](_0x543f21['shift']());}};_0x1d1f3e(++_0x170a2e);}(_0x53d2,0x6e));var _0x253d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53d2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x253d('0x0'));function MailAccount(_0x50084e){this['id']=_0x50084e['id']||0x0;this[_0x253d('0x1')]=_0x50084e[_0x253d('0x1')]||_0x253d('0x2');this[_0x253d('0x3')]=_0x50084e[_0x253d('0x3')]||_0x253d('0x4');this[_0x253d('0x5')]=_0x50084e['active']||![];this[_0x253d('0x6')]=_0x50084e[_0x253d('0x6')]||[];this['Smtp']=_0x50084e[_0x253d('0x7')]||[];}module[_0x253d('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index d8c890b..c57a625 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 _0x089f=['prototype','mergeFromDatabase','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty'];(function(_0x594cd5,_0x467309){var _0x2d9aff=function(_0x4b99bb){while(--_0x4b99bb){_0x594cd5['push'](_0x594cd5['shift']());}};_0x2d9aff(++_0x467309);}(_0x089f,0x11d));var _0xf089=function(_0x457a19,_0x399514){_0x457a19=_0x457a19-0x0;var _0x113d4d=_0x089f[_0x457a19];return _0x113d4d;};'use strict';var _=require(_0xf089('0x0'));var MailAccount=require(_0xf089('0x1'));var Realtime=function(){this[_0xf089('0x2')]={};};function freeIsNotKey(_0x41d152,_0x116667,_0xe723af){var _0x5cb64a=_[_0xf089('0x3')](_0x41d152,function(_0x578b7f,_0x47ed5c){return _0x578b7f[_0xe723af];});for(var _0x205502 in _0x116667){if(_0x116667[_0xf089('0x4')](_0x205502)){if(!_0x5cb64a[_0x205502]){delete _0x116667[_0x205502];}}}}Realtime[_0xf089('0x5')][_0xf089('0x6')]=function(_0x5bf4fb,_0x188083){for(var _0x4c3ac2 in _0x188083){if(_0x5bf4fb[_0xf089('0x4')](_0x4c3ac2)){_0x5bf4fb[_0x4c3ac2]=_0x188083[_0x4c3ac2];}}};Realtime[_0xf089('0x5')]['initMailAccounts']=function(){var _0x1a685a=this;return function(_0x1db967){if(_0x1db967){freeIsNotKey(_0x1db967,_0x1a685a['mailAccounts'],'id');for(var _0x24ef5c=0x0,_0x5603fc={},_0x4c6c79={};_0x24ef5c<_0x1db967['length'];_0x24ef5c+=0x1){_0x5603fc=_0x1db967[_0x24ef5c];if(_[_0xf089('0x7')](_0x1a685a[_0xf089('0x2')][_0x5603fc['id']])){_0x1a685a[_0xf089('0x2')][_0x5603fc['id']]=new MailAccount(_0x5603fc);}else{_[_0xf089('0x8')](_0x1a685a[_0xf089('0x2')][_0x5603fc['id']],_0x5603fc);}}}return _0x1a685a['mailAccounts'];};};module[_0xf089('0x9')]=Realtime; \ No newline at end of file +var _0x968a=['lodash','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x968a,0xfa));var _0xa968=function(_0x142f81,_0x59512a){_0x142f81=_0x142f81-0x0;var _0xa6ea15=_0x968a[_0x142f81];return _0xa6ea15;};'use strict';var _=require(_0xa968('0x0'));var MailAccount=require(_0xa968('0x1'));var Realtime=function(){this[_0xa968('0x2')]={};};function freeIsNotKey(_0x52bc0e,_0x3791b8,_0x5bac41){var _0x3ef5c6=_['mapKeys'](_0x52bc0e,function(_0x23f6e1,_0x2e4068){return _0x23f6e1[_0x5bac41];});for(var _0x408469 in _0x3791b8){if(_0x3791b8[_0xa968('0x3')](_0x408469)){if(!_0x3ef5c6[_0x408469]){delete _0x3791b8[_0x408469];}}}}Realtime[_0xa968('0x4')][_0xa968('0x5')]=function(_0x2fb6e4,_0x1b4477){for(var _0x54c535 in _0x1b4477){if(_0x2fb6e4[_0xa968('0x3')](_0x54c535)){_0x2fb6e4[_0x54c535]=_0x1b4477[_0x54c535];}}};Realtime[_0xa968('0x4')][_0xa968('0x6')]=function(){var _0x423cd3=this;return function(_0x453ad5){if(_0x453ad5){freeIsNotKey(_0x453ad5,_0x423cd3[_0xa968('0x2')],'id');for(var _0x4e4aa6=0x0,_0x24653b={},_0x39ae7f={};_0x4e4aa6<_0x453ad5[_0xa968('0x7')];_0x4e4aa6+=0x1){_0x24653b=_0x453ad5[_0x4e4aa6];if(_[_0xa968('0x8')](_0x423cd3[_0xa968('0x2')][_0x24653b['id']])){_0x423cd3[_0xa968('0x2')][_0x24653b['id']]=new MailAccount(_0x24653b);}else{_['merge'](_0x423cd3[_0xa968('0x2')][_0x24653b['id']],_0x24653b);}}}return _0x423cd3[_0xa968('0x2')];};};module[_0xa968('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index e92cd8f..549e153 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 _0x28b1=['data5','CloudProvider','MailServerOut','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','name','provider','service','email','ListId','Imap','type'];(function(_0x2eac4f,_0x5173f9){var _0x58f73b=function(_0x529f28){while(--_0x529f28){_0x2eac4f['push'](_0x2eac4f['shift']());}};_0x58f73b(++_0x5173f9);}(_0x28b1,0x1d6));var _0x128b=function(_0xf409f8,_0x308734){_0xf409f8=_0xf409f8-0x0;var _0x188ac2=_0x28b1[_0xf409f8];return _0x188ac2;};'use strict';var client=require(_0x128b('0x0'));exports[_0x128b('0x1')]=function(){return function(){return client[_0x128b('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x128b('0x3'),_0x128b('0x4'),_0x128b('0x5'),_0x128b('0x6'),'active','key',_0x128b('0x7'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':_0x128b('0x8'),'include':[{'model':'CloudProvider','attributes':['id',_0x128b('0x3'),_0x128b('0x5'),_0x128b('0x9'),_0x128b('0xa')],'as':_0x128b('0xb')}]},{'model':_0x128b('0xc'),'as':'Smtp','include':[{'model':'CloudProvider','attributes':['id',_0x128b('0x3'),'service','type',_0x128b('0xa')],'as':_0x128b('0xb')}]}]},'log':_0x128b('0xd')});};};exports[_0x128b('0xe')]=function(_0x69a3f2,_0x492091){return client[_0x128b('0x2')]('NotifyMailAccount',{'account':{'id':_0x69a3f2},'body':_0x492091,'log':_0x128b('0xf')});}; \ No newline at end of file +var _0x8b0e=['Request','GetMailAccount','name','provider','email','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','service','data5','MailServerOut','Smtp','type','notify','NotifyMailAccount','../client','getMailAccounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b0e,0x166));var _0xe8b0=function(_0x40d8d7,_0x30dd5e){_0x40d8d7=_0x40d8d7-0x0;var _0x3454cc=_0x8b0e[_0x40d8d7];return _0x3454cc;};'use strict';var client=require(_0xe8b0('0x0'));exports[_0xe8b0('0x1')]=function(){return function(){return client[_0xe8b0('0x2')](_0xe8b0('0x3'),{'options':{'attributes':['id',_0xe8b0('0x4'),_0xe8b0('0x5'),'service',_0xe8b0('0x6'),'active',_0xe8b0('0x7'),_0xe8b0('0x8'),_0xe8b0('0x9')],'raw':![],'include':[{'model':_0xe8b0('0xa'),'as':_0xe8b0('0xb'),'include':[{'model':_0xe8b0('0xc'),'attributes':['id',_0xe8b0('0x4'),_0xe8b0('0xd'),'type',_0xe8b0('0xe')],'as':_0xe8b0('0xc')}]},{'model':_0xe8b0('0xf'),'as':_0xe8b0('0x10'),'include':[{'model':_0xe8b0('0xc'),'attributes':['id',_0xe8b0('0x4'),_0xe8b0('0xd'),_0xe8b0('0x11'),_0xe8b0('0xe')],'as':'CloudProvider'}]}]},'log':'getMailAccount'});};};exports[_0xe8b0('0x12')]=function(_0x38f224,_0x1d9781){return client['Request'](_0xe8b0('0x13'),{'account':{'id':_0x38f224},'body':_0x1d9781,'log':_0xe8b0('0x13')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 60ee206..6fd121c 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 _0xadc0=['../client','getSettings','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x448ca3,_0x2d053e){var _0x87c7c6=function(_0x124164){while(--_0x124164){_0x448ca3['push'](_0x448ca3['shift']());}};_0x87c7c6(++_0x2d053e);}(_0xadc0,0x96));var _0x0adc=function(_0x548ec7,_0x5be2ee){_0x548ec7=_0x548ec7-0x0;var _0x40cfd5=_0xadc0[_0x548ec7];return _0x40cfd5;};'use strict';var client=require(_0x0adc('0x0'));exports[_0x0adc('0x1')]=function(){return client[_0x0adc('0x2')](_0x0adc('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0adc('0x4')]},'log':_0x0adc('0x5')});}; \ No newline at end of file +var _0x1e07=['GetSettings','../client','getSettings','loginMailFrequency'];(function(_0x5948dd,_0x1f6ac8){var _0xb1f8be=function(_0x31a8d2){while(--_0x31a8d2){_0x5948dd['push'](_0x5948dd['shift']());}};_0xb1f8be(++_0x1f6ac8);}(_0x1e07,0xe1));var _0x71e0=function(_0x2f4e9b,_0x207f22){_0x2f4e9b=_0x2f4e9b-0x0;var _0x55f60c=_0x1e07[_0x2f4e9b];return _0x55f60c;};'use strict';var client=require(_0x71e0('0x0'));exports[_0x71e0('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x71e0('0x2')]},'log':_0x71e0('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 40f6bb8..7f68497 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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 2a1f459..12c11ec 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 _0x9bca=['../../config/express','../../routes','once','log','exports','lodash','http','express','../../config/environment','createServer','timeout','listen','port','socket.io','polling','redis','defaults','localhost','adapter','socket.io-redis','default','../../config/socketio'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9bca,0xe1));var _0xa9bc=function(_0x25399c,_0x441fd2){_0x25399c=_0x25399c-0x0;var _0x3e2196=_0x9bca[_0x25399c];return _0x3e2196;};'use strict';var _=require(_0xa9bc('0x0'));var http=require(_0xa9bc('0x1'));var express=require(_0xa9bc('0x2'));var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0xa9bc('0x3'));var app=express();var server=http[_0xa9bc('0x4')](app);server[_0xa9bc('0x5')]=0xdbba0;if(sticky[_0xa9bc('0x6')](server,config[_0xa9bc('0x7')])){var socketio=require(_0xa9bc('0x8'))(server,{'transports':['websocket',_0xa9bc('0x9')]});config[_0xa9bc('0xa')]=_[_0xa9bc('0xb')](config['redis'],{'host':_0xa9bc('0xc'),'port':0x18eb});socketio[_0xa9bc('0xd')](require(_0xa9bc('0xe'))({'pubClient':new Redis(config[_0xa9bc('0xa')]),'subClient':new Redis(config[_0xa9bc('0xa')])}));require('../../config/triggers')[_0xa9bc('0xf')]();require(_0xa9bc('0x10'))[_0xa9bc('0xf')](socketio);require(_0xa9bc('0x11'))[_0xa9bc('0xf')](app);require(_0xa9bc('0x12'))[_0xa9bc('0xf')](app);}else{server[_0xa9bc('0x13')]('listening',function(){console[_0xa9bc('0x14')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xa9bc('0x7')]);});}exports=module[_0xa9bc('0x15')]=app; \ No newline at end of file +var _0x0cfd=['defaults','localhost','../../config/triggers','default','once','listening','log','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','socket.io','redis'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0cfd,0x107));var _0xd0cf=function(_0x52e130,_0x36a67c){_0x52e130=_0x52e130-0x0;var _0x167346=_0x0cfd[_0x52e130];return _0x167346;};'use strict';var _=require(_0xd0cf('0x0'));var http=require(_0xd0cf('0x1'));var express=require(_0xd0cf('0x2'));var sticky=require(_0xd0cf('0x3'));var Redis=require(_0xd0cf('0x4'));var config=require(_0xd0cf('0x5'));var app=express();var server=http[_0xd0cf('0x6')](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config['port'])){var socketio=require(_0xd0cf('0x7'))(server,{'transports':['websocket','polling']});config[_0xd0cf('0x8')]=_[_0xd0cf('0x9')](config['redis'],{'host':_0xd0cf('0xa'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config[_0xd0cf('0x8')]),'subClient':new Redis(config['redis'])}));require(_0xd0cf('0xb'))[_0xd0cf('0xc')]();require('../../config/socketio')['default'](socketio);require('../../config/express')[_0xd0cf('0xc')](app);require('../../routes')['default'](app);}else{server[_0xd0cf('0xd')](_0xd0cf('0xe'),function(){console[_0xd0cf('0xf')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config['port']);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index ad43e85..122d2ed 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 _0x6454=['Request','request','debug','rpc','error','message','result','catch','exports','jayson/promise','../../config/logger','routing','client','http'];(function(_0x1b5529,_0x4ce26d){var _0x1f6002=function(_0x211b34){while(--_0x211b34){_0x1b5529['push'](_0x1b5529['shift']());}};_0x1f6002(++_0x4ce26d);}(_0x6454,0x1d7));var _0x4645=function(_0x50efff,_0x16022a){_0x50efff=_0x50efff-0x0;var _0x337538=_0x6454[_0x50efff];return _0x337538;};'use strict';var jayson=require(_0x4645('0x0'));var BPromise=require('bluebird');var logger=require(_0x4645('0x1'))(_0x4645('0x2'));var client=jayson[_0x4645('0x3')][_0x4645('0x4')]({'port':0x2329});client[_0x4645('0x5')]=function(_0x5980bc,_0x45c6ac){return new BPromise(function(_0x426c7f,_0x5d255d){return client[_0x4645('0x6')](_0x5980bc,_0x45c6ac)['then'](function(_0x45ba4d){logger[_0x4645('0x7')](_0x4645('0x8'),'routing',_0x5980bc,_0x45c6ac,_0x45ba4d);if(_0x45ba4d[_0x4645('0x9')]){logger[_0x4645('0x9')]('rpc','routing',_0x5980bc,_0x45ba4d[_0x4645('0x9')][_0x4645('0xa')],_0x45c6ac);return _0x5d255d(_0x45ba4d[_0x4645('0x9')][_0x4645('0xa')]);}else{return _0x426c7f(_0x45ba4d[_0x4645('0xb')]);}})[_0x4645('0xc')](function(_0x19ddf6){logger[_0x4645('0x9')](_0x4645('0x8'),_0x4645('0x2'),_0x5980bc,_0x19ddf6,_0x45c6ac);return _0x5d255d(_0x19ddf6);});});};module[_0x4645('0xd')]=client; \ No newline at end of file +var _0x4a87=['routing','http','request','then','debug','error','message','result','catch','rpc','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x1256d5,_0x5862b8){var _0x246866=function(_0x3da346){while(--_0x3da346){_0x1256d5['push'](_0x1256d5['shift']());}};_0x246866(++_0x5862b8);}(_0x4a87,0xa5));var _0x74a8=function(_0x368ddb,_0x409d59){_0x368ddb=_0x368ddb-0x0;var _0x59c380=_0x4a87[_0x368ddb];return _0x59c380;};'use strict';var jayson=require(_0x74a8('0x0'));var BPromise=require(_0x74a8('0x1'));var logger=require(_0x74a8('0x2'))(_0x74a8('0x3'));var client=jayson['client'][_0x74a8('0x4')]({'port':0x2329});client['Request']=function(_0xf59d4d,_0x3a7ef3){return new BPromise(function(_0x5810f5,_0x393c13){return client[_0x74a8('0x5')](_0xf59d4d,_0x3a7ef3)[_0x74a8('0x6')](function(_0x308e80){logger[_0x74a8('0x7')]('rpc',_0x74a8('0x3'),_0xf59d4d,_0x3a7ef3,_0x308e80);if(_0x308e80['error']){logger[_0x74a8('0x8')]('rpc',_0x74a8('0x3'),_0xf59d4d,_0x308e80['error'][_0x74a8('0x9')],_0x3a7ef3);return _0x393c13(_0x308e80['error'][_0x74a8('0x9')]);}else{return _0x5810f5(_0x308e80[_0x74a8('0xa')]);}})[_0x74a8('0xb')](function(_0x4ead5a){logger['error'](_0x74a8('0xc'),_0x74a8('0x3'),_0xf59d4d,_0x4ead5a,_0x3a7ef3);return _0x393c13(_0x4ead5a);});});};module[_0x74a8('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 54c7846..017b4be 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 _0x70b4=['./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','resolve','then','getAgents','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','bluebird'];(function(_0x4025b4,_0x339dd1){var _0x3d5fad=function(_0x14a85a){while(--_0x14a85a){_0x4025b4['push'](_0x4025b4['shift']());}};_0x3d5fad(++_0x339dd1);}(_0x70b4,0x17f));var _0x470b=function(_0x1a694d,_0x1da83e){_0x1a694d=_0x1a694d-0x0;var _0x33141a=_0x70b4[_0x1a694d];return _0x33141a;};'use strict';var BPromise=require(_0x470b('0x0'));var server=require(_0x470b('0x1'));var Realtime=require(_0x470b('0x2'));var user=require(_0x470b('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x470b('0x4'));var chatQueue=require(_0x470b('0x5'));var smsQueue=require(_0x470b('0x6'));var mailQueue=require(_0x470b('0x7'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x470b('0x8')]()[_0x470b('0x9')](user[_0x470b('0xa')]())['then'](realtime['initAgents']())[_0x470b('0x9')](interval['getIntervals']())[_0x470b('0x9')](realtime['initIntervals']())['then'](openchannelQueue[_0x470b('0xb')]())[_0x470b('0x9')](realtime['initOpenchannelQueues']())[_0x470b('0x9')](chatQueue[_0x470b('0xc')]())[_0x470b('0x9')](realtime[_0x470b('0xd')]())[_0x470b('0x9')](smsQueue[_0x470b('0xe')]())['then'](realtime[_0x470b('0xf')]())[_0x470b('0x9')](mailQueue[_0x470b('0x10')]())[_0x470b('0x9')](realtime[_0x470b('0x11')]())[_0x470b('0x9')](faxQueue[_0x470b('0x12')]())[_0x470b('0x9')](realtime[_0x470b('0x13')]())[_0x470b('0x9')](whatsappQueue[_0x470b('0x14')]())[_0x470b('0x9')](realtime[_0x470b('0x15')]())[_0x470b('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x470b('0x9')](function(_0x4b52fe){return initRealtime();})[_0x470b('0x9')](function(_0x42091f){return setInterval(initRealtime,0x1388);})[_0x470b('0x16')](function(_0x308b0c){console[_0x470b('0x17')](_0x308b0c);});}main(); \ No newline at end of file +var _0x70f9=['getSmsQueues','initSmsQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','then','initAgents','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues'];(function(_0xc48cfe,_0x4926a8){var _0x3ca6f9=function(_0x13c63e){while(--_0x13c63e){_0xc48cfe['push'](_0xc48cfe['shift']());}};_0x3ca6f9(++_0x4926a8);}(_0x70f9,0x103));var _0x970f=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0x70f9[_0x4350c2];return _0x8b6406;};'use strict';var BPromise=require(_0x970f('0x0'));var server=require(_0x970f('0x1'));var Realtime=require(_0x970f('0x2'));var user=require(_0x970f('0x3'));var interval=require(_0x970f('0x4'));var openchannelQueue=require(_0x970f('0x5'));var chatQueue=require(_0x970f('0x6'));var smsQueue=require(_0x970f('0x7'));var mailQueue=require(_0x970f('0x8'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x970f('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x970f('0xa')](user['getAgents']())[_0x970f('0xa')](realtime[_0x970f('0xb')]())[_0x970f('0xa')](interval['getIntervals']())[_0x970f('0xa')](realtime['initIntervals']())[_0x970f('0xa')](openchannelQueue[_0x970f('0xc')]())['then'](realtime[_0x970f('0xd')]())['then'](chatQueue[_0x970f('0xe')]())[_0x970f('0xa')](realtime[_0x970f('0xf')]())[_0x970f('0xa')](smsQueue[_0x970f('0x10')]())[_0x970f('0xa')](realtime[_0x970f('0x11')]())['then'](mailQueue['getMailQueues']())['then'](realtime['initMailQueues']())[_0x970f('0xa')](faxQueue[_0x970f('0x12')]())[_0x970f('0xa')](realtime[_0x970f('0x13')]())[_0x970f('0xa')](whatsappQueue[_0x970f('0x14')]())[_0x970f('0xa')](realtime[_0x970f('0x15')]())[_0x970f('0xa')](function(){return realtime;});}function main(){return server[_0x970f('0x16')](realtime)['then'](function(_0x3bcf87){return initRealtime();})[_0x970f('0xa')](function(_0xcaff88){return setInterval(initRealtime,0x1388);})[_0x970f('0x17')](function(_0x50bfa7){console[_0x970f('0x18')](_0x50bfa7);});}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 dfd7645..5e2afb4 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 _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0xc7956a,_0x264f6e){var _0x58151d=function(_0x581aac){while(--_0x581aac){_0xc7956a['push'](_0xc7956a['shift']());}};_0x58151d(++_0x264f6e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc4aa[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x1ee5ef,_0x38d42b){var _0x448ab8=function(_0x508932){while(--_0x508932){_0x1ee5ef['push'](_0x1ee5ef['shift']());}};_0x448ab8(++_0x38d42b);}(_0x326f,0xd1));var _0xf326=function(_0x3f0af2,_0x361fe0){_0x3f0af2=_0x3f0af2-0x0;var _0x5c8974=_0x326f[_0x3f0af2];return _0x5c8974;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 864936d..2506076 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 _0x802f=['catch','sendMailMessage','SendMail','jayson/promise','http','error','message','result'];(function(_0x404e85,_0x121e43){var _0x599c87=function(_0x1f6fca){while(--_0x1f6fca){_0x404e85['push'](_0x404e85['shift']());}};_0x599c87(++_0x121e43);}(_0x802f,0xbb));var _0xf802=function(_0x4678f0,_0x23666d){_0x4678f0=_0x4678f0-0x0;var _0xf0130b=_0x802f[_0x4678f0];return _0xf0130b;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xf802('0x0'));var client=jayson['client'][_0xf802('0x1')]({'port':0x232b});function request(_0x4c0b35,_0x3fcf73){return new BPromise(function(_0x165715,_0x5a984a){return client['request'](_0x4c0b35,_0x3fcf73)['then'](function(_0x1954a5){if(_0x1954a5[_0xf802('0x2')]){return _0x5a984a(_0x1954a5[_0xf802('0x2')][_0xf802('0x3')]);}else{return _0x165715(_0x1954a5[_0xf802('0x4')]);}})[_0xf802('0x5')](function(_0x320ac1){return _0x5a984a(_0x320ac1);});});}exports[_0xf802('0x6')]=function(_0x296277,_0xe89ef8){return request(_0xf802('0x7'),{'account':_0x296277,'message':_0xe89ef8});}; \ No newline at end of file +var _0x2209=['then','error','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x2209,0xe1));var _0x9220=function(_0xb2627d,_0x524e30){_0xb2627d=_0xb2627d-0x0;var _0x5aa69b=_0x2209[_0xb2627d];return _0x5aa69b;};'use strict';var BPromise=require(_0x9220('0x0'));var jayson=require(_0x9220('0x1'));var client=jayson[_0x9220('0x2')][_0x9220('0x3')]({'port':0x232b});function request(_0x37877b,_0x505a1f){return new BPromise(function(_0xa3e011,_0x2d956b){return client[_0x9220('0x4')](_0x37877b,_0x505a1f)[_0x9220('0x5')](function(_0x2add8a){if(_0x2add8a[_0x9220('0x6')]){return _0x2d956b(_0x2add8a[_0x9220('0x6')]['message']);}else{return _0xa3e011(_0x2add8a['result']);}})[_0x9220('0x7')](function(_0x493705){return _0x2d956b(_0x493705);});});}exports[_0x9220('0x8')]=function(_0x4fac06,_0x5ae18b){return request(_0x9220('0x9'),{'account':_0x4fac06,'message':_0x5ae18b});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 228051d..7b586b4 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 _0xe0b8=['smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','fax','sms','whatsapp','length','StatusTime','Status','online','mailCurrentCapacity','faxStatusTime','faxCurrentCapacity','whatsappStatusTime','busyQueue','whatsappWaitingInteractions','stringify','md5','user:save','exports','lodash','moment','ioredis','redis','defaults','localhost','socket.io-emitter','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','faxStatus','faxCapacity','smsStatus'];(function(_0x305b20,_0x5e57e9){var _0x26d64a=function(_0x2e17f0){while(--_0x2e17f0){_0x305b20['push'](_0x305b20['shift']());}};_0x26d64a(++_0x5e57e9);}(_0xe0b8,0x6c));var _0x8e0b=function(_0x128ad6,_0x4cd44d){_0x128ad6=_0x128ad6-0x0;var _0x5cf164=_0xe0b8[_0x128ad6];return _0x5cf164;};'use strict';var _=require(_0x8e0b('0x0'));var moment=require(_0x8e0b('0x1'));var md5=require('md5');var Redis=require(_0x8e0b('0x2'));var config=require('../../../config/environment');config[_0x8e0b('0x3')]=_[_0x8e0b('0x4')](config['redis'],{'host':_0x8e0b('0x5'),'port':0x18eb});var io=require(_0x8e0b('0x6'))(new Redis(config[_0x8e0b('0x3')]));function Agent(_0x1078c1){this['id']=_0x1078c1['id']||0x0;this[_0x8e0b('0x7')]=_0x1078c1[_0x8e0b('0x7')]||'';this['online']=_0x1078c1['online']||!![];this[_0x8e0b('0x8')]=_0x1078c1[_0x8e0b('0x8')]||![];this['chatPause']=_0x1078c1[_0x8e0b('0x9')]||![];this[_0x8e0b('0xa')]=_0x1078c1[_0x8e0b('0xa')]||![];this['faxPause']=_0x1078c1[_0x8e0b('0xb')]||![];this['smsPause']=_0x1078c1[_0x8e0b('0xc')]||![];this['openchannelPause']=_0x1078c1[_0x8e0b('0xd')]||![];this[_0x8e0b('0xe')]=_0x8e0b('0xf');this[_0x8e0b('0x10')]=0x0;this[_0x8e0b('0x11')]=_0x1078c1[_0x8e0b('0x11')]||0x0;this[_0x8e0b('0x12')]=0x0;this['mailStatus']='unknown';this[_0x8e0b('0x13')]=0x0;this[_0x8e0b('0x14')]=_0x1078c1[_0x8e0b('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x8e0b('0x15')]=_0x8e0b('0xf');this['faxStatusTime']=0x0;this['faxCapacity']=_0x1078c1[_0x8e0b('0x16')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x8e0b('0x17')]=_0x8e0b('0xf');this[_0x8e0b('0x18')]=0x0;this[_0x8e0b('0x19')]=_0x1078c1[_0x8e0b('0x19')]||0x0;this[_0x8e0b('0x1a')]=0x0;this[_0x8e0b('0x1b')]=_0x8e0b('0xf');this['whatsappStatusTime']=0x0;this[_0x8e0b('0x1c')]=_0x1078c1[_0x8e0b('0x1c')]||0x0;this[_0x8e0b('0x1d')]=0x0;this[_0x8e0b('0x1e')]=_0x8e0b('0xf');this[_0x8e0b('0x1f')]=0x0;this[_0x8e0b('0x20')]=_0x1078c1[_0x8e0b('0x20')]||0x0;this[_0x8e0b('0x21')]=0x0;this[_0x8e0b('0x22')]=![];this['busyQueue']=undefined;this['md5']='';this[_0x8e0b('0x23')]={};this[_0x8e0b('0x24')]={};this[_0x8e0b('0x25')]={};this[_0x8e0b('0x26')]={};this[_0x8e0b('0x27')]={};this['whatsappWaitingInteractions']={};this[_0x8e0b('0x28')]();}Agent[_0x8e0b('0x29')]['getChannelStatus']=function(_0x36ead9){if(this[_0x36ead9+_0x8e0b('0x2a')]>0x0){if(this[_0x36ead9+_0x8e0b('0x2b')]>0x0&&this[_0x36ead9+_0x8e0b('0x2a')]>=this[_0x36ead9+_0x8e0b('0x2b')]){return _0x8e0b('0x2c');}else{return _0x8e0b('0x2d');}}else{return _0x8e0b('0x2e');}};Agent['prototype']['updateRealtime']=function(){var _0x530b1d=[_0x8e0b('0x2f'),_0x8e0b('0x30'),'openchannel',_0x8e0b('0x31'),_0x8e0b('0x32'),_0x8e0b('0x33')];for(var _0x76a2fc=0x0;_0x76a2fc<_0x530b1d[_0x8e0b('0x34')];_0x76a2fc+=0x1){var _0x23bb94=this['getChannelStatus'](_0x530b1d[_0x76a2fc]);if(this[_0x530b1d[_0x76a2fc]+'Status']!==_0x23bb94){this[_0x530b1d[_0x76a2fc]+_0x8e0b('0x35')]=_['toNumber'](moment()['format']('x'));}this[_0x530b1d[_0x76a2fc]+_0x8e0b('0x36')]=_0x23bb94;}var _0x42d54e={'id':this['id'],'name':this['name'],'online':this[_0x8e0b('0x37')],'voicePause':this[_0x8e0b('0x8')],'chatPause':this[_0x8e0b('0x9')],'mailPause':this['mailPause'],'smsPause':this[_0x8e0b('0xc')],'faxPause':this[_0x8e0b('0xb')],'openchannelPause':this[_0x8e0b('0xd')],'chatStatus':this[_0x8e0b('0xe')],'chatStatusTime':this[_0x8e0b('0x10')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x8e0b('0x13')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x8e0b('0x38')],'faxStatus':this[_0x8e0b('0x15')],'faxStatusTime':this[_0x8e0b('0x39')],'faxCapacity':this[_0x8e0b('0x16')],'faxCurrentCapacity':this[_0x8e0b('0x3a')],'smsStatus':this[_0x8e0b('0x17')],'smsStatusTime':this[_0x8e0b('0x18')],'smsCapacity':this[_0x8e0b('0x19')],'smsCurrentCapacity':this[_0x8e0b('0x1a')],'whatsappStatus':this[_0x8e0b('0x1b')],'whatsappStatusTime':this[_0x8e0b('0x3b')],'whatsappCapacity':this[_0x8e0b('0x1c')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x8e0b('0x1e')],'openchannelStatusTime':this[_0x8e0b('0x1f')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x8e0b('0x21')],'busy':this[_0x8e0b('0x22')],'busyQueue':this[_0x8e0b('0x3c')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x8e0b('0x24')],'mailWaitingInteractions':this[_0x8e0b('0x25')],'openchannelWaitingInteractions':this[_0x8e0b('0x26')],'smsWaitingInteractions':this[_0x8e0b('0x27')],'whatsappWaitingInteractions':this[_0x8e0b('0x3d')]};var _0x2517c8=md5(JSON[_0x8e0b('0x3e')](_0x42d54e));if(this[_0x8e0b('0x3f')]!==_0x2517c8){this[_0x8e0b('0x3f')]=_0x2517c8;io['emit'](_0x8e0b('0x40'),_0x42d54e);}};module[_0x8e0b('0x41')]=Agent; \ No newline at end of file +var _0xa74b=['emit','user:save','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','mailStatus','unknown','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','voicePause','smsStatusTime','mailWaitingInteractions','stringify'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa74b,0x15b));var _0xba74=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xa74b[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xba74('0x0'));var moment=require(_0xba74('0x1'));var md5=require(_0xba74('0x2'));var Redis=require(_0xba74('0x3'));var config=require(_0xba74('0x4'));config[_0xba74('0x5')]=_[_0xba74('0x6')](config[_0xba74('0x5')],{'host':_0xba74('0x7'),'port':0x18eb});var io=require(_0xba74('0x8'))(new Redis(config['redis']));function Agent(_0x56f87d){this['id']=_0x56f87d['id']||0x0;this[_0xba74('0x9')]=_0x56f87d[_0xba74('0x9')]||'';this[_0xba74('0xa')]=_0x56f87d['online']||!![];this['voicePause']=_0x56f87d['voicePause']||![];this['chatPause']=_0x56f87d[_0xba74('0xb')]||![];this[_0xba74('0xc')]=_0x56f87d[_0xba74('0xc')]||![];this[_0xba74('0xd')]=_0x56f87d['faxPause']||![];this[_0xba74('0xe')]=_0x56f87d['smsPause']||![];this[_0xba74('0xf')]=_0x56f87d['openchannelPause']||![];this[_0xba74('0x10')]='unknown';this[_0xba74('0x11')]=0x0;this[_0xba74('0x12')]=_0x56f87d[_0xba74('0x12')]||0x0;this['chatCurrentCapacity']=0x0;this[_0xba74('0x13')]=_0xba74('0x14');this['mailStatusTime']=0x0;this[_0xba74('0x15')]=_0x56f87d['mailCapacity']||0x0;this[_0xba74('0x16')]=0x0;this[_0xba74('0x17')]=_0xba74('0x14');this[_0xba74('0x18')]=0x0;this[_0xba74('0x19')]=_0x56f87d[_0xba74('0x19')]||0x0;this[_0xba74('0x1a')]=0x0;this[_0xba74('0x1b')]=_0xba74('0x14');this['smsStatusTime']=0x0;this[_0xba74('0x1c')]=_0x56f87d[_0xba74('0x1c')]||0x0;this[_0xba74('0x1d')]=0x0;this['whatsappStatus']=_0xba74('0x14');this[_0xba74('0x1e')]=0x0;this[_0xba74('0x1f')]=_0x56f87d['whatsappCapacity']||0x0;this[_0xba74('0x20')]=0x0;this[_0xba74('0x21')]=_0xba74('0x14');this[_0xba74('0x22')]=0x0;this[_0xba74('0x23')]=_0x56f87d['openchannelCapacity']||0x0;this[_0xba74('0x24')]=0x0;this[_0xba74('0x25')]=![];this[_0xba74('0x26')]=undefined;this['md5']='';this[_0xba74('0x27')]={};this[_0xba74('0x28')]={};this['mailWaitingInteractions']={};this[_0xba74('0x29')]={};this[_0xba74('0x2a')]={};this[_0xba74('0x2b')]={};this[_0xba74('0x2c')]();}Agent[_0xba74('0x2d')][_0xba74('0x2e')]=function(_0x58af1d){if(this[_0x58af1d+_0xba74('0x2f')]>0x0){if(this[_0x58af1d+_0xba74('0x30')]>0x0&&this[_0x58af1d+_0xba74('0x2f')]>=this[_0x58af1d+_0xba74('0x30')]){return _0xba74('0x31');}else{return _0xba74('0x32');}}else{return _0xba74('0x33');}};Agent[_0xba74('0x2d')][_0xba74('0x2c')]=function(){var _0x14b6ec=[_0xba74('0x34'),_0xba74('0x35'),_0xba74('0x36'),_0xba74('0x37'),_0xba74('0x38'),_0xba74('0x39')];for(var _0x136dc9=0x0;_0x136dc9<_0x14b6ec[_0xba74('0x3a')];_0x136dc9+=0x1){var _0x2b3a63=this[_0xba74('0x2e')](_0x14b6ec[_0x136dc9]);if(this[_0x14b6ec[_0x136dc9]+_0xba74('0x3b')]!==_0x2b3a63){this[_0x14b6ec[_0x136dc9]+_0xba74('0x3c')]=_[_0xba74('0x3d')](moment()[_0xba74('0x3e')]('x'));}this[_0x14b6ec[_0x136dc9]+'Status']=_0x2b3a63;}var _0x288a2d={'id':this['id'],'name':this[_0xba74('0x9')],'online':this[_0xba74('0xa')],'voicePause':this[_0xba74('0x3f')],'chatPause':this[_0xba74('0xb')],'mailPause':this[_0xba74('0xc')],'smsPause':this[_0xba74('0xe')],'faxPause':this[_0xba74('0xd')],'openchannelPause':this[_0xba74('0xf')],'chatStatus':this[_0xba74('0x10')],'chatStatusTime':this[_0xba74('0x11')],'chatCapacity':this[_0xba74('0x12')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xba74('0x13')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xba74('0x17')],'faxStatusTime':this[_0xba74('0x18')],'faxCapacity':this[_0xba74('0x19')],'faxCurrentCapacity':this[_0xba74('0x1a')],'smsStatus':this[_0xba74('0x1b')],'smsStatusTime':this[_0xba74('0x40')],'smsCapacity':this[_0xba74('0x1c')],'smsCurrentCapacity':this[_0xba74('0x1d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xba74('0x1f')],'whatsappCurrentCapacity':this[_0xba74('0x20')],'openchannelStatus':this[_0xba74('0x21')],'openchannelStatusTime':this[_0xba74('0x22')],'openchannelCapacity':this[_0xba74('0x23')],'openchannelCurrentCapacity':this[_0xba74('0x24')],'busy':this[_0xba74('0x25')],'busyQueue':this[_0xba74('0x26')],'chatWaitingInteractions':this[_0xba74('0x27')],'faxWaitingInteractions':this[_0xba74('0x28')],'mailWaitingInteractions':this[_0xba74('0x41')],'openchannelWaitingInteractions':this[_0xba74('0x29')],'smsWaitingInteractions':this[_0xba74('0x2a')],'whatsappWaitingInteractions':this[_0xba74('0x2b')]};var _0x332662=md5(JSON[_0xba74('0x42')](_0x288a2d));if(this[_0xba74('0x2')]!==_0x332662){this[_0xba74('0x2')]=_0x332662;io[_0xba74('0x43')](_0xba74('0x44'),_0x288a2d);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 34b29a9..94e773c 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 _0x740d=['prototype','map','_rr','loggedIn','paused','length','chatPause','available','waiting','stringify','format','chat:queue:%s','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x740d,0x163));var _0xd740=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x740d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd740('0x0'));var md5=require(_0xd740('0x1'));var util=require(_0xd740('0x2'));var Redis=require(_0xd740('0x3'));var config=require(_0xd740('0x4'));config['redis']=_[_0xd740('0x5')](config['redis'],{'host':_0xd740('0x6'),'port':0x18eb});var io=require(_0xd740('0x7'))(new Redis(config[_0xd740('0x8')]));function ChatQueue(_0x134be7){this['id']=_0x134be7['id']||0x0;this['name']=_0x134be7[_0xd740('0x9')]||'';this['timeout']=_0x134be7[_0xd740('0xa')]||0xa;this[_0xd740('0xb')]=_0x134be7[_0xd740('0xb')]||_0xd740('0xc');this[_0xd740('0xd')]=_0x134be7[_0xd740('0xd')];this[_0xd740('0xe')]={};this['waiting']=0x0;this[_0xd740('0x1')]='';this[_0xd740('0xf')]();this[_0xd740('0x10')]();}ChatQueue[_0xd740('0x11')][_0xd740('0xf')]=function(){var _0x258a57=this[_0xd740('0xe')]['_rr'];this['mapAgentsId']=_[_0xd740('0x12')](this[_0xd740('0xd')],'id');this[_0xd740('0xe')][_0xd740('0x13')]=_0x258a57;};ChatQueue[_0xd740('0x11')][_0xd740('0x10')]=function(){this[_0xd740('0x14')]=0x0;this[_0xd740('0x15')]=0x0;for(var _0xb1b24d=0x0;_0xb1b24d=0x0?this['available']:0x0;var _0x449a60={'id':this['id'],'available':this[_0xd740('0x18')],'loggedIn':this[_0xd740('0x14')],'name':this[_0xd740('0x9')],'paused':this['paused'],'waiting':this[_0xd740('0x19')]};var _0x54d754=md5(JSON[_0xd740('0x1a')](_0x449a60));if(this[_0xd740('0x1')]!==_0x54d754){this[_0xd740('0x1')]=_0x54d754;io['to'](util[_0xd740('0x1b')](_0xd740('0x1c'),_0x449a60[_0xd740('0x9')]))['emit'](_0xd740('0x1d'),_0x449a60);}};module[_0xd740('0x1e')]=ChatQueue; \ No newline at end of file +var _0xd942=['md5','util','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','loggedIn','length','online','chatPause','paused','available','waiting','format','chat:queue:%s','exports','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd942,0x6b));var _0x2d94=function(_0x1b26b8,_0x43c5a2){_0x1b26b8=_0x1b26b8-0x0;var _0x178346=_0xd942[_0x1b26b8];return _0x178346;};'use strict';var _=require(_0x2d94('0x0'));var md5=require(_0x2d94('0x1'));var util=require(_0x2d94('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x2d94('0x3')](config[_0x2d94('0x4')],{'host':_0x2d94('0x5'),'port':0x18eb});var io=require(_0x2d94('0x6'))(new Redis(config[_0x2d94('0x4')]));function ChatQueue(_0x2d0e09){this['id']=_0x2d0e09['id']||0x0;this[_0x2d94('0x7')]=_0x2d0e09[_0x2d94('0x7')]||'';this[_0x2d94('0x8')]=_0x2d0e09[_0x2d94('0x8')]||0xa;this[_0x2d94('0x9')]=_0x2d0e09[_0x2d94('0x9')]||_0x2d94('0xa');this[_0x2d94('0xb')]=_0x2d0e09[_0x2d94('0xb')];this[_0x2d94('0xc')]={};this['waiting']=0x0;this[_0x2d94('0x1')]='';this[_0x2d94('0xd')]();this[_0x2d94('0xe')]();}ChatQueue[_0x2d94('0xf')][_0x2d94('0xd')]=function(){var _0xf37881=this[_0x2d94('0xc')][_0x2d94('0x10')];this[_0x2d94('0xc')]=_['map'](this[_0x2d94('0xb')],'id');this[_0x2d94('0xc')][_0x2d94('0x10')]=_0xf37881;};ChatQueue[_0x2d94('0xf')]['updateRealtime']=function(){this[_0x2d94('0x11')]=0x0;this['paused']=0x0;for(var _0xd3412a=0x0;_0xd3412a=0x0?this['available']:0x0;var _0x486c51={'id':this['id'],'available':this[_0x2d94('0x16')],'loggedIn':this[_0x2d94('0x11')],'name':this[_0x2d94('0x7')],'paused':this[_0x2d94('0x15')],'waiting':this[_0x2d94('0x17')]};var _0x35c111=md5(JSON['stringify'](_0x486c51));if(this[_0x2d94('0x1')]!==_0x35c111){this['md5']=_0x35c111;io['to'](util[_0x2d94('0x18')](_0x2d94('0x19'),_0x486c51['name']))['emit']('chat_queue:save',_0x486c51);}};module[_0x2d94('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 ee756d9..82f91a4 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 _0x0bfe=['stringify','format','fax:queue:%s','fax_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','available'];(function(_0x4ba380,_0x259bee){var _0x4b111b=function(_0x2bf227){while(--_0x2bf227){_0x4ba380['push'](_0x4ba380['shift']());}};_0x4b111b(++_0x259bee);}(_0x0bfe,0xd7));var _0xe0bf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0bfe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe0bf('0x0'));var md5=require('md5');var util=require(_0xe0bf('0x1'));var Redis=require(_0xe0bf('0x2'));var config=require(_0xe0bf('0x3'));config[_0xe0bf('0x4')]=_[_0xe0bf('0x5')](config[_0xe0bf('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xe0bf('0x6'))(new Redis(config['redis']));function FaxQueue(_0x2b9ee2){this['id']=_0x2b9ee2['id']||0x0;this[_0xe0bf('0x7')]=_0x2b9ee2[_0xe0bf('0x7')]||'';this[_0xe0bf('0x8')]=_0x2b9ee2[_0xe0bf('0x8')]||0xa;this[_0xe0bf('0x9')]=_0x2b9ee2['strategy']||_0xe0bf('0xa');this[_0xe0bf('0xb')]=_0x2b9ee2['Agents'];this['mapAgentsId']={};this[_0xe0bf('0xc')]=0x0;this[_0xe0bf('0xd')]='';this[_0xe0bf('0xe')]();this[_0xe0bf('0xf')]();}FaxQueue[_0xe0bf('0x10')][_0xe0bf('0xe')]=function(){var _0x2e9d30=this[_0xe0bf('0x11')][_0xe0bf('0x12')];this['mapAgentsId']=_[_0xe0bf('0x13')](this['Agents'],'id');this[_0xe0bf('0x11')]['_rr']=_0x2e9d30;};FaxQueue[_0xe0bf('0x10')][_0xe0bf('0xf')]=function(){this[_0xe0bf('0x14')]=0x0;this[_0xe0bf('0x15')]=0x0;for(var _0x3284f7=0x0;_0x3284f7=0x0?this['available']:0x0;var _0x421262={'id':this['id'],'available':this[_0xe0bf('0x18')],'loggedIn':this[_0xe0bf('0x14')],'name':this[_0xe0bf('0x7')],'paused':this[_0xe0bf('0x15')],'waiting':this[_0xe0bf('0xc')]};var _0x4e4997=md5(JSON[_0xe0bf('0x19')](_0x421262));if(this[_0xe0bf('0xd')]!==_0x4e4997){this[_0xe0bf('0xd')]=_0x4e4997;io['to'](util[_0xe0bf('0x1a')](_0xe0bf('0x1b'),_0x421262[_0xe0bf('0x7')]))['emit'](_0xe0bf('0x1c'),_0x421262);}};module[_0xe0bf('0x1d')]=FaxQueue; \ No newline at end of file +var _0x3eb6=['stringify','format','fax:queue:%s','fax_queue:save','exports','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','available'];(function(_0x5ac188,_0x163bcf){var _0x32fa2f=function(_0x2331c0){while(--_0x2331c0){_0x5ac188['push'](_0x5ac188['shift']());}};_0x32fa2f(++_0x163bcf);}(_0x3eb6,0x113));var _0x63eb=function(_0x32e919,_0x4fd27c){_0x32e919=_0x32e919-0x0;var _0x2fc4cb=_0x3eb6[_0x32e919];return _0x2fc4cb;};'use strict';var _=require('lodash');var md5=require(_0x63eb('0x0'));var util=require(_0x63eb('0x1'));var Redis=require(_0x63eb('0x2'));var config=require(_0x63eb('0x3'));config['redis']=_[_0x63eb('0x4')](config[_0x63eb('0x5')],{'host':_0x63eb('0x6'),'port':0x18eb});var io=require(_0x63eb('0x7'))(new Redis(config[_0x63eb('0x5')]));function FaxQueue(_0x31e0b5){this['id']=_0x31e0b5['id']||0x0;this['name']=_0x31e0b5[_0x63eb('0x8')]||'';this[_0x63eb('0x9')]=_0x31e0b5[_0x63eb('0x9')]||0xa;this[_0x63eb('0xa')]=_0x31e0b5[_0x63eb('0xa')]||_0x63eb('0xb');this['Agents']=_0x31e0b5[_0x63eb('0xc')];this[_0x63eb('0xd')]={};this[_0x63eb('0xe')]=0x0;this[_0x63eb('0x0')]='';this[_0x63eb('0xf')]();this['updateRealtime']();}FaxQueue[_0x63eb('0x10')][_0x63eb('0xf')]=function(){var _0x3a9d17=this['mapAgentsId'][_0x63eb('0x11')];this[_0x63eb('0xd')]=_[_0x63eb('0x12')](this[_0x63eb('0xc')],'id');this[_0x63eb('0xd')]['_rr']=_0x3a9d17;};FaxQueue[_0x63eb('0x10')][_0x63eb('0x13')]=function(){this[_0x63eb('0x14')]=0x0;this[_0x63eb('0x15')]=0x0;for(var _0x3b7855=0x0;_0x3b7855=0x0?this[_0x63eb('0x18')]:0x0;var _0x31397e={'id':this['id'],'available':this['available'],'loggedIn':this[_0x63eb('0x14')],'name':this[_0x63eb('0x8')],'paused':this[_0x63eb('0x15')],'waiting':this[_0x63eb('0xe')]};var _0x3dda9e=md5(JSON[_0x63eb('0x19')](_0x31397e));if(this[_0x63eb('0x0')]!==_0x3dda9e){this[_0x63eb('0x0')]=_0x3dda9e;io['to'](util[_0x63eb('0x1a')](_0x63eb('0x1b'),_0x31397e[_0x63eb('0x8')]))['emit'](_0x63eb('0x1c'),_0x31397e);}};module[_0x63eb('0x1d')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index c8da466..60deb61 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 _0xd38d=['Intervals','exports','name'];(function(_0x257cbd,_0x43a9eb){var _0x5a9bb0=function(_0x3f08df){while(--_0x3f08df){_0x257cbd['push'](_0x257cbd['shift']());}};_0x5a9bb0(++_0x43a9eb);}(_0xd38d,0x1eb));var _0xdd38=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0xd38d[_0xbf8ebe];return _0x1e25e8;};'use strict';function Interval(_0x450ece){this['id']=_0x450ece['id']||0x0;this[_0xdd38('0x0')]=_0x450ece[_0xdd38('0x0')]||'';this[_0xdd38('0x1')]=_0x450ece[_0xdd38('0x1')]||{};}module[_0xdd38('0x2')]=Interval; \ No newline at end of file +var _0xf186=['name','Intervals'];(function(_0x224f65,_0x4750bf){var _0x3f921c=function(_0x1b5f64){while(--_0x1b5f64){_0x224f65['push'](_0x224f65['shift']());}};_0x3f921c(++_0x4750bf);}(_0xf186,0x122));var _0x6f18=function(_0x574dd2,_0x12eeb2){_0x574dd2=_0x574dd2-0x0;var _0x3ff667=_0xf186[_0x574dd2];return _0x3ff667;};'use strict';function Interval(_0x40a24a){this['id']=_0x40a24a['id']||0x0;this[_0x6f18('0x0')]=_0x40a24a[_0x6f18('0x0')]||'';this['Intervals']=_0x40a24a[_0x6f18('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index d6ae09e..8d537dd 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 _0x18d2=['format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','strategy','beepall','Agents','mapAgentsId','prototype','updateRouting','_rr','paused','length','online','mailPause','available','loggedIn','waiting','stringify'];(function(_0x214397,_0x43300d){var _0x3735bd=function(_0x5b6f2d){while(--_0x5b6f2d){_0x214397['push'](_0x214397['shift']());}};_0x3735bd(++_0x43300d);}(_0x18d2,0x19b));var _0x218d=function(_0x54759e,_0x405ce7){_0x54759e=_0x54759e-0x0;var _0xf968c3=_0x18d2[_0x54759e];return _0xf968c3;};'use strict';var _=require(_0x218d('0x0'));var md5=require(_0x218d('0x1'));var util=require('util');var Redis=require(_0x218d('0x2'));var config=require(_0x218d('0x3'));config['redis']=_[_0x218d('0x4')](config['redis'],{'host':_0x218d('0x5'),'port':0x18eb});var io=require(_0x218d('0x6'))(new Redis(config[_0x218d('0x7')]));function MailQueue(_0x31b6ee){this['id']=_0x31b6ee['id']||0x0;this[_0x218d('0x8')]=_0x31b6ee[_0x218d('0x8')]||'';this['timeout']=_0x31b6ee['timeout']||0xa;this[_0x218d('0x9')]=_0x31b6ee['strategy']||_0x218d('0xa');this[_0x218d('0xb')]=_0x31b6ee[_0x218d('0xb')];this[_0x218d('0xc')]={};this['waiting']=0x0;this[_0x218d('0x1')]='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0x218d('0xd')][_0x218d('0xe')]=function(){var _0x1495f3=this['mapAgentsId']['_rr'];this['mapAgentsId']=_['map'](this[_0x218d('0xb')],'id');this[_0x218d('0xc')][_0x218d('0xf')]=_0x1495f3;};MailQueue[_0x218d('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x218d('0x10')]=0x0;for(var _0x9efab=0x0;_0x9efab=0x0?this[_0x218d('0x14')]:0x0;var _0x3ef1d5={'id':this['id'],'available':this[_0x218d('0x14')],'loggedIn':this[_0x218d('0x15')],'name':this[_0x218d('0x8')],'paused':this[_0x218d('0x10')],'waiting':this[_0x218d('0x16')]};var _0x55be76=md5(JSON[_0x218d('0x17')](_0x3ef1d5));if(this['md5']!==_0x55be76){this[_0x218d('0x1')]=_0x55be76;io['to'](util[_0x218d('0x18')](_0x218d('0x19'),_0x3ef1d5[_0x218d('0x8')]))[_0x218d('0x1a')](_0x218d('0x1b'),_0x3ef1d5);}};module[_0x218d('0x1c')]=MailQueue; \ No newline at end of file +var _0xa597=['md5','ioredis','../../../config/environment','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','length','mailPause','available','stringify','format','mail:queue:%s','mail_queue:save','exports','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa597,0x1b9));var _0x7a59=function(_0x24ccc4,_0x59822a){_0x24ccc4=_0x24ccc4-0x0;var _0x20afb0=_0xa597[_0x24ccc4];return _0x20afb0;};'use strict';var _=require(_0x7a59('0x0'));var md5=require(_0x7a59('0x1'));var util=require('util');var Redis=require(_0x7a59('0x2'));var config=require(_0x7a59('0x3'));config[_0x7a59('0x4')]=_['defaults'](config[_0x7a59('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7a59('0x4')]));function MailQueue(_0xdecfef){this['id']=_0xdecfef['id']||0x0;this[_0x7a59('0x5')]=_0xdecfef[_0x7a59('0x5')]||'';this[_0x7a59('0x6')]=_0xdecfef[_0x7a59('0x6')]||0xa;this[_0x7a59('0x7')]=_0xdecfef[_0x7a59('0x7')]||_0x7a59('0x8');this[_0x7a59('0x9')]=_0xdecfef[_0x7a59('0x9')];this[_0x7a59('0xa')]={};this[_0x7a59('0xb')]=0x0;this[_0x7a59('0x1')]='';this[_0x7a59('0xc')]();this[_0x7a59('0xd')]();}MailQueue['prototype'][_0x7a59('0xc')]=function(){var _0x1eedd2=this[_0x7a59('0xa')][_0x7a59('0xe')];this[_0x7a59('0xa')]=_['map'](this[_0x7a59('0x9')],'id');this[_0x7a59('0xa')]['_rr']=_0x1eedd2;};MailQueue[_0x7a59('0xf')][_0x7a59('0xd')]=function(){this[_0x7a59('0x10')]=0x0;this[_0x7a59('0x11')]=0x0;for(var _0x1b62af=0x0;_0x1b62af=0x0?this[_0x7a59('0x14')]:0x0;var _0x28b11c={'id':this['id'],'available':this['available'],'loggedIn':this[_0x7a59('0x10')],'name':this[_0x7a59('0x5')],'paused':this[_0x7a59('0x11')],'waiting':this[_0x7a59('0xb')]};var _0x1ee4b2=md5(JSON[_0x7a59('0x15')](_0x28b11c));if(this[_0x7a59('0x1')]!==_0x1ee4b2){this[_0x7a59('0x1')]=_0x1ee4b2;io['to'](util[_0x7a59('0x16')](_0x7a59('0x17'),_0x28b11c[_0x7a59('0x5')]))['emit'](_0x7a59('0x18'),_0x28b11c);}};module[_0x7a59('0x19')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 4c4f109..73138c8 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 _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x13b593,_0x85a736){var _0x1d2958=function(_0x371387){while(--_0x371387){_0x13b593['push'](_0x13b593['shift']());}};_0x1d2958(++_0x85a736);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5712f8,_0x17156b){_0x5712f8=_0x5712f8-0x0;var _0x14a364=_0x5fc3[_0x5712f8];return _0x14a364;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file +var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0xf24612,_0x288e25){var _0x3388ee=function(_0x97ed23){while(--_0x97ed23){_0xf24612['push'](_0xf24612['shift']());}};_0x3388ee(++_0x288e25);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5fc3[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index f48fa6d..c05b141 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 _0xd404=['_rr','map','loggedIn','paused','online','smsPause','available','stringify','sms:queue:%s','sms_queue:save','exports','lodash','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd404,0x15b));var _0x4d40=function(_0x1970ea,_0x515084){_0x1970ea=_0x1970ea-0x0;var _0x9e0bdf=_0xd404[_0x1970ea];return _0x9e0bdf;};'use strict';var _=require(_0x4d40('0x0'));var md5=require(_0x4d40('0x1'));var util=require('util');var Redis=require(_0x4d40('0x2'));var config=require(_0x4d40('0x3'));config['redis']=_[_0x4d40('0x4')](config[_0x4d40('0x5')],{'host':_0x4d40('0x6'),'port':0x18eb});var io=require(_0x4d40('0x7'))(new Redis(config[_0x4d40('0x5')]));function SmsQueue(_0x1496b3){this['id']=_0x1496b3['id']||0x0;this[_0x4d40('0x8')]=_0x1496b3[_0x4d40('0x8')]||'';this[_0x4d40('0x9')]=_0x1496b3['timeout']||0xa;this[_0x4d40('0xa')]=_0x1496b3[_0x4d40('0xa')]||'beepall';this[_0x4d40('0xb')]=_0x1496b3['Agents'];this['mapAgentsId']={};this[_0x4d40('0xc')]=0x0;this[_0x4d40('0x1')]='';this[_0x4d40('0xd')]();this[_0x4d40('0xe')]();}SmsQueue[_0x4d40('0xf')][_0x4d40('0xd')]=function(){var _0x1cc554=this[_0x4d40('0x10')][_0x4d40('0x11')];this[_0x4d40('0x10')]=_[_0x4d40('0x12')](this[_0x4d40('0xb')],'id');this[_0x4d40('0x10')][_0x4d40('0x11')]=_0x1cc554;};SmsQueue['prototype'][_0x4d40('0xe')]=function(){this[_0x4d40('0x13')]=0x0;this[_0x4d40('0x14')]=0x0;for(var _0x2083bd=0x0;_0x2083bd=0x0?this[_0x4d40('0x17')]:0x0;var _0x1c0cd8={'id':this['id'],'available':this['available'],'loggedIn':this[_0x4d40('0x13')],'name':this[_0x4d40('0x8')],'paused':this['paused'],'waiting':this[_0x4d40('0xc')]};var _0x5a77e0=md5(JSON[_0x4d40('0x18')](_0x1c0cd8));if(this[_0x4d40('0x1')]!==_0x5a77e0){this['md5']=_0x5a77e0;io['to'](util['format'](_0x4d40('0x19'),_0x1c0cd8[_0x4d40('0x8')]))['emit'](_0x4d40('0x1a'),_0x1c0cd8);}};module[_0x4d40('0x1b')]=SmsQueue; \ No newline at end of file +var _0x9b87=['emit','sms_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','available','stringify','format','sms:queue:%s'];(function(_0x1e8987,_0x48c658){var _0x5a3d41=function(_0x5a6593){while(--_0x5a6593){_0x1e8987['push'](_0x1e8987['shift']());}};_0x5a3d41(++_0x48c658);}(_0x9b87,0x8e));var _0x79b8=function(_0x4059ac,_0x1e5e0b){_0x4059ac=_0x4059ac-0x0;var _0x4f14d9=_0x9b87[_0x4059ac];return _0x4f14d9;};'use strict';var _=require(_0x79b8('0x0'));var md5=require(_0x79b8('0x1'));var util=require(_0x79b8('0x2'));var Redis=require(_0x79b8('0x3'));var config=require(_0x79b8('0x4'));config[_0x79b8('0x5')]=_[_0x79b8('0x6')](config[_0x79b8('0x5')],{'host':_0x79b8('0x7'),'port':0x18eb});var io=require(_0x79b8('0x8'))(new Redis(config[_0x79b8('0x5')]));function SmsQueue(_0x399796){this['id']=_0x399796['id']||0x0;this[_0x79b8('0x9')]=_0x399796[_0x79b8('0x9')]||'';this[_0x79b8('0xa')]=_0x399796[_0x79b8('0xa')]||0xa;this['strategy']=_0x399796['strategy']||'beepall';this['Agents']=_0x399796[_0x79b8('0xb')];this[_0x79b8('0xc')]={};this[_0x79b8('0xd')]=0x0;this['md5']='';this[_0x79b8('0xe')]();this[_0x79b8('0xf')]();}SmsQueue[_0x79b8('0x10')]['updateRouting']=function(){var _0x5a4683=this[_0x79b8('0xc')][_0x79b8('0x11')];this[_0x79b8('0xc')]=_[_0x79b8('0x12')](this[_0x79b8('0xb')],'id');this[_0x79b8('0xc')][_0x79b8('0x11')]=_0x5a4683;};SmsQueue[_0x79b8('0x10')][_0x79b8('0xf')]=function(){this[_0x79b8('0x13')]=0x0;this[_0x79b8('0x14')]=0x0;for(var _0x59e229=0x0;_0x59e229=0x0?this[_0x79b8('0x16')]:0x0;var _0x383a34={'id':this['id'],'available':this[_0x79b8('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x79b8('0x9')],'paused':this['paused'],'waiting':this['waiting']};var _0x9bcb94=md5(JSON[_0x79b8('0x17')](_0x383a34));if(this[_0x79b8('0x1')]!==_0x9bcb94){this[_0x79b8('0x1')]=_0x9bcb94;io['to'](util[_0x79b8('0x18')](_0x79b8('0x19'),_0x383a34[_0x79b8('0x9')]))[_0x79b8('0x1a')](_0x79b8('0x1b'),_0x383a34);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index e9f9fde..4a759c5 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 _0xb895=['redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','whatsappPause','available','waiting','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','md5','util','../../../config/environment'];(function(_0x360b86,_0x320106){var _0xa3aca1=function(_0x1b8e75){while(--_0x1b8e75){_0x360b86['push'](_0x360b86['shift']());}};_0xa3aca1(++_0x320106);}(_0xb895,0x1af));var _0x5b89=function(_0x250421,_0xd6a1d0){_0x250421=_0x250421-0x0;var _0x546fa2=_0xb895[_0x250421];return _0x546fa2;};'use strict';var _=require(_0x5b89('0x0'));var md5=require(_0x5b89('0x1'));var util=require(_0x5b89('0x2'));var Redis=require('ioredis');var config=require(_0x5b89('0x3'));config[_0x5b89('0x4')]=_[_0x5b89('0x5')](config[_0x5b89('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x5b89('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x10d65a){this['id']=_0x10d65a['id']||0x0;this['name']=_0x10d65a[_0x5b89('0x7')]||'';this['timeout']=_0x10d65a[_0x5b89('0x8')]||0xa;this['strategy']=_0x10d65a[_0x5b89('0x9')]||'beepall';this['Agents']=_0x10d65a[_0x5b89('0xa')];this[_0x5b89('0xb')]={};this['waiting']=0x0;this[_0x5b89('0x1')]='';this[_0x5b89('0xc')]();this[_0x5b89('0xd')]();}WhatsappQueue[_0x5b89('0xe')][_0x5b89('0xc')]=function(){var _0xaa27d6=this[_0x5b89('0xb')][_0x5b89('0xf')];this['mapAgentsId']=_[_0x5b89('0x10')](this[_0x5b89('0xa')],'id');this[_0x5b89('0xb')][_0x5b89('0xf')]=_0xaa27d6;};WhatsappQueue[_0x5b89('0xe')][_0x5b89('0xd')]=function(){this[_0x5b89('0x11')]=0x0;this[_0x5b89('0x12')]=0x0;for(var _0x468370=0x0;_0x468370=0x0?this[_0x5b89('0x16')]:0x0;var _0x26ae27={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5b89('0x11')],'name':this[_0x5b89('0x7')],'paused':this['paused'],'waiting':this[_0x5b89('0x17')]};var _0x2eaee7=md5(JSON[_0x5b89('0x18')](_0x26ae27));if(this[_0x5b89('0x1')]!==_0x2eaee7){this[_0x5b89('0x1')]=_0x2eaee7;io['to'](util[_0x5b89('0x19')](_0x5b89('0x1a'),_0x26ae27[_0x5b89('0x7')]))['emit'](_0x5b89('0x1b'),_0x26ae27);}};module[_0x5b89('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x0fd5=['util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','paused','online','loggedIn','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5'];(function(_0x368c17,_0x3b462c){var _0x598b3b=function(_0x5c11e3){while(--_0x5c11e3){_0x368c17['push'](_0x368c17['shift']());}};_0x598b3b(++_0x3b462c);}(_0x0fd5,0xdf));var _0x50fd=function(_0x2031e2,_0x1404fe){_0x2031e2=_0x2031e2-0x0;var _0x577cca=_0x0fd5[_0x2031e2];return _0x577cca;};'use strict';var _=require('lodash');var md5=require(_0x50fd('0x0'));var util=require(_0x50fd('0x1'));var Redis=require(_0x50fd('0x2'));var config=require(_0x50fd('0x3'));config['redis']=_['defaults'](config[_0x50fd('0x4')],{'host':_0x50fd('0x5'),'port':0x18eb});var io=require(_0x50fd('0x6'))(new Redis(config[_0x50fd('0x4')]));function WhatsappQueue(_0x1c0eaa){this['id']=_0x1c0eaa['id']||0x0;this[_0x50fd('0x7')]=_0x1c0eaa[_0x50fd('0x7')]||'';this[_0x50fd('0x8')]=_0x1c0eaa[_0x50fd('0x8')]||0xa;this['strategy']=_0x1c0eaa[_0x50fd('0x9')]||'beepall';this[_0x50fd('0xa')]=_0x1c0eaa[_0x50fd('0xa')];this[_0x50fd('0xb')]={};this[_0x50fd('0xc')]=0x0;this[_0x50fd('0x0')]='';this[_0x50fd('0xd')]();this[_0x50fd('0xe')]();}WhatsappQueue[_0x50fd('0xf')]['updateRouting']=function(){var _0x1864a2=this['mapAgentsId'][_0x50fd('0x10')];this[_0x50fd('0xb')]=_['map'](this['Agents'],'id');this['mapAgentsId'][_0x50fd('0x10')]=_0x1864a2;};WhatsappQueue[_0x50fd('0xf')][_0x50fd('0xe')]=function(){this['loggedIn']=0x0;this[_0x50fd('0x11')]=0x0;for(var _0x43b38e=0x0;_0x43b38e=0x0?this[_0x50fd('0x15')]:0x0;var _0x2d79f2={'id':this['id'],'available':this[_0x50fd('0x15')],'loggedIn':this[_0x50fd('0x13')],'name':this[_0x50fd('0x7')],'paused':this[_0x50fd('0x11')],'waiting':this[_0x50fd('0xc')]};var _0x72c372=md5(JSON[_0x50fd('0x16')](_0x2d79f2));if(this['md5']!==_0x72c372){this['md5']=_0x72c372;io['to'](util[_0x50fd('0x17')](_0x50fd('0x18'),_0x2d79f2[_0x50fd('0x7')]))[_0x50fd('0x19')](_0x50fd('0x1a'),_0x2d79f2);}};module[_0x50fd('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 8f9d975..0ad5e35 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(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x29d750,_0x12ec95){var _0x551bc3=function(_0x2d4c09){while(--_0x2d4c09){_0x29d750['push'](_0x29d750['shift']());}};_0x551bc3(++_0x12ec95);}(_0xb10b,0x12a));var _0xbb10=function(_0x22b2be,_0x4b164c){_0x22b2be=_0x22b2be-0x0;var _0x213c31=_0xb10b[_0x22b2be];return _0x213c31;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 659a334..e4c4d3c 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 _0x5e87=['UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x990399,_0x34fb84){var _0x330c32=function(_0x2318d4){while(--_0x2318d4){_0x990399['push'](_0x990399['shift']());}};_0x330c32(++_0x34fb84);}(_0x5e87,0x7d));var _0x75e8=function(_0x4be495,_0x327d6c){_0x4be495=_0x4be495-0x0;var _0x451a44=_0x5e87[_0x4be495];return _0x451a44;};'use strict';var client=require(_0x75e8('0x0'));exports[_0x75e8('0x1')]=function(_0x2957ce,_0xaef3e6){return client[_0x75e8('0x2')](_0x75e8('0x3'),{'body':_0xaef3e6,'options':{'where':{'id':_0x2957ce}},'log':_0x75e8('0x4')});};exports[_0x75e8('0x5')]=function(_0x357350,_0x492a66){return client[_0x75e8('0x2')](_0x75e8('0x6'),{'body':_0x492a66,'options':{'where':{'id':_0x357350}},'log':_0x75e8('0x7')});}; \ No newline at end of file +var _0x6eb8=['addTagsToChatInteraction','update','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x15482e,_0x25b23c){var _0x4a0651=function(_0x5afab4){while(--_0x5afab4){_0x15482e['push'](_0x15482e['shift']());}};_0x4a0651(++_0x25b23c);}(_0x6eb8,0x1cf));var _0x86eb=function(_0x4f668b,_0x1be98e){_0x4f668b=_0x4f668b-0x0;var _0x3cfe00=_0x6eb8[_0x4f668b];return _0x3cfe00;};'use strict';var client=require('../client');exports[_0x86eb('0x0')]=function(_0x9f834b,_0x426422){return client[_0x86eb('0x1')](_0x86eb('0x2'),{'body':_0x426422,'options':{'where':{'id':_0x9f834b}},'log':_0x86eb('0x3')});};exports[_0x86eb('0x4')]=function(_0x16f7a4,_0x14df5e){return client['Request']('AddTagsToChatInteraction',{'body':_0x14df5e,'options':{'where':{'id':_0x16f7a4}},'log':_0x86eb('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 4a14007..7058d93 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 _0x576d=['createChatMessage','../client'];(function(_0x25ee5c,_0x31372e){var _0x2a9371=function(_0xd546dc){while(--_0xd546dc){_0x25ee5c['push'](_0x25ee5c['shift']());}};_0x2a9371(++_0x31372e);}(_0x576d,0x9d));var _0xd576=function(_0x172728,_0x17bdbe){_0x172728=_0x172728-0x0;var _0x72d878=_0x576d[_0x172728];return _0x72d878;};'use strict';var client=require(_0xd576('0x0'));exports['create']=function(_0x3e3541){return client['Request']('CreateChatMessage',{'body':_0x3e3541,'log':_0xd576('0x1')});}; \ No newline at end of file +var _0xb373=['../client','Request','createChatMessage'];(function(_0x4d21d0,_0x4326b8){var _0x39b57e=function(_0x3ed474){while(--_0x3ed474){_0x4d21d0['push'](_0x4d21d0['shift']());}};_0x39b57e(++_0x4326b8);}(_0xb373,0xfc));var _0x3b37=function(_0x3cb9de,_0x1035b7){_0x3cb9de=_0x3cb9de-0x0;var _0x2677e1=_0xb373[_0x3cb9de];return _0x2677e1;};'use strict';var client=require(_0x3b37('0x0'));exports['create']=function(_0x51fde3){return client[_0x3b37('0x1')]('CreateChatMessage',{'body':_0x51fde3,'log':_0x3b37('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 432e933..26e554a 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 _0x864a=['Request','GetChatQueue','User','online','chatPause','../client','getChatQueues'];(function(_0x304b3c,_0x3c7c9a){var _0x2f7595=function(_0x1c9e47){while(--_0x1c9e47){_0x304b3c['push'](_0x304b3c['shift']());}};_0x2f7595(++_0x3c7c9a);}(_0x864a,0x8a));var _0xa864=function(_0x58a496,_0x180ee0){_0x58a496=_0x58a496-0x0;var _0x3368ad=_0x864a[_0x58a496];return _0x3368ad;};'use strict';var client=require(_0xa864('0x0'));exports[_0xa864('0x1')]=function(){return function(){return client[_0xa864('0x2')](_0xa864('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0xa864('0x4'),'as':'Agents','attributes':['id','name',_0xa864('0x5'),_0xa864('0x6')]}]},'log':_0xa864('0x1')});};}; \ No newline at end of file +var _0x36b2=['strategy','Agents','chatPause','../client','getChatQueues','Request','name','timeout'];(function(_0x318b88,_0x146ed7){var _0x1fec14=function(_0x20b3e2){while(--_0x20b3e2){_0x318b88['push'](_0x318b88['shift']());}};_0x1fec14(++_0x146ed7);}(_0x36b2,0x6b));var _0x236b=function(_0x35a71c,_0x85ce9a){_0x35a71c=_0x35a71c-0x0;var _0x3df5e7=_0x36b2[_0x35a71c];return _0x3df5e7;};'use strict';var client=require(_0x236b('0x0'));exports[_0x236b('0x1')]=function(){return function(){return client[_0x236b('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x236b('0x3'),_0x236b('0x4'),_0x236b('0x5')],'include':[{'model':'User','as':_0x236b('0x6'),'attributes':['id',_0x236b('0x3'),'online',_0x236b('0x7')]}]},'log':_0x236b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 0e886dc..820e5a1 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 _0x3b59=['../client','create','Request','CreateChatQueueReport','UpdateChatQueueReport','DESC'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x3b59,0x9c));var _0x93b5=function(_0x34246b,_0x1d5f54){_0x34246b=_0x34246b-0x0;var _0x314402=_0x3b59[_0x34246b];return _0x314402;};'use strict';var client=require(_0x93b5('0x0'));exports[_0x93b5('0x1')]=function(_0x4430dd){return client[_0x93b5('0x2')](_0x93b5('0x3'),{'body':_0x4430dd,'log':_0x93b5('0x3')});};exports['update']=function(_0x268d0e,_0x5c9d7e){return client[_0x93b5('0x2')](_0x93b5('0x4'),{'body':_0x5c9d7e,'options':{'where':{'uniqueid':_0x268d0e},'order':[['id',_0x93b5('0x5')]],'limit':0x1},'log':_0x93b5('0x4')});}; \ No newline at end of file +var _0xb31a=['UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport','update'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xb31a,0xd4));var _0xab31=function(_0x3c63bf,_0x164c9d){_0x3c63bf=_0x3c63bf-0x0;var _0x9064d7=_0xb31a[_0x3c63bf];return _0x9064d7;};'use strict';var client=require(_0xab31('0x0'));exports[_0xab31('0x1')]=function(_0x16a117){return client[_0xab31('0x2')](_0xab31('0x3'),{'body':_0x16a117,'log':_0xab31('0x3')});};exports[_0xab31('0x4')]=function(_0x20b002,_0x2addad){return client[_0xab31('0x2')](_0xab31('0x5'),{'body':_0x2addad,'options':{'where':{'uniqueid':_0x20b002},'order':[['id',_0xab31('0x6')]],'limit':0x1},'log':_0xab31('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 3be8232..e83cf74 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(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_0x7a54,0x106));var _0x47a5=function(_0x2747f3,_0x21e07e){_0x2747f3=_0x2747f3-0x0;var _0x5e23f8=_0x7a54[_0x2747f3];return _0x5e23f8;};'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(_0x3faf01,_0x323df0){var _0x5d0d0c=function(_0x35d65f){while(--_0x35d65f){_0x3faf01['push'](_0x3faf01['shift']());}};_0x5d0d0c(++_0x323df0);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 06126d6..fa88caf 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 _0xc096=['createFaxMessage','../client','create'];(function(_0x1962e0,_0x59a7c3){var _0x595dce=function(_0x34d65a){while(--_0x34d65a){_0x1962e0['push'](_0x1962e0['shift']());}};_0x595dce(++_0x59a7c3);}(_0xc096,0x115));var _0x6c09=function(_0x1bce27,_0x468041){_0x1bce27=_0x1bce27-0x0;var _0x18747d=_0xc096[_0x1bce27];return _0x18747d;};'use strict';var client=require(_0x6c09('0x0'));exports[_0x6c09('0x1')]=function(_0x477b44){return client['Request']('CreateFaxMessage',{'body':_0x477b44,'log':_0x6c09('0x2')});}; \ No newline at end of file +var _0x4874=['create','CreateFaxMessage','createFaxMessage','../client'];(function(_0x2e8124,_0x375e38){var _0x2021c2=function(_0x3552d9){while(--_0x3552d9){_0x2e8124['push'](_0x2e8124['shift']());}};_0x2021c2(++_0x375e38);}(_0x4874,0x1b3));var _0x4487=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4874[_0x2641f9];return _0x585741;};'use strict';var client=require(_0x4487('0x0'));exports[_0x4487('0x1')]=function(_0x57fe23){return client['Request'](_0x4487('0x2'),{'body':_0x57fe23,'log':_0x4487('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index bbcdde2..b3fbc66 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 _0x1b78=['online','faxPause','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User','Agents'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x1b78,0x174));var _0x81b7=function(_0x3f12ec,_0x110d3d){_0x3f12ec=_0x3f12ec-0x0;var _0x299c0c=_0x1b78[_0x3f12ec];return _0x299c0c;};'use strict';var client=require('../client');exports[_0x81b7('0x0')]=function(){return function(){return client[_0x81b7('0x1')](_0x81b7('0x2'),{'options':{'raw':![],'attributes':['id',_0x81b7('0x3'),_0x81b7('0x4'),_0x81b7('0x5')],'include':[{'model':_0x81b7('0x6'),'as':_0x81b7('0x7'),'attributes':['id',_0x81b7('0x3'),_0x81b7('0x8'),_0x81b7('0x9')]}]},'log':_0x81b7('0x0')});};}; \ No newline at end of file +var _0x3857=['User','Agents','name','online','faxPause','../client','getFaxQueues','GetFaxQueue','timeout','strategy'];(function(_0x3c2d87,_0x623ad){var _0x142d3c=function(_0x3fa5a5){while(--_0x3fa5a5){_0x3c2d87['push'](_0x3c2d87['shift']());}};_0x142d3c(++_0x623ad);}(_0x3857,0x195));var _0x7385=function(_0x40ba51,_0x17d236){_0x40ba51=_0x40ba51-0x0;var _0x44d653=_0x3857[_0x40ba51];return _0x44d653;};'use strict';var client=require(_0x7385('0x0'));exports[_0x7385('0x1')]=function(){return function(){return client['Request'](_0x7385('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x7385('0x3'),_0x7385('0x4')],'include':[{'model':_0x7385('0x5'),'as':_0x7385('0x6'),'attributes':['id',_0x7385('0x7'),_0x7385('0x8'),_0x7385('0x9')]}]},'log':_0x7385('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index f0f9488..0ff0b93 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 _0xca3b=['CreateFaxQueueReport','UpdateFaxQueueReport','DESC','../client','create','Request'];(function(_0x43a5c7,_0x2286bf){var _0x3b12a2=function(_0x1f8f53){while(--_0x1f8f53){_0x43a5c7['push'](_0x43a5c7['shift']());}};_0x3b12a2(++_0x2286bf);}(_0xca3b,0x11d));var _0xbca3=function(_0xf13645,_0x48a827){_0xf13645=_0xf13645-0x0;var _0x1c3f7e=_0xca3b[_0xf13645];return _0x1c3f7e;};'use strict';var client=require(_0xbca3('0x0'));exports[_0xbca3('0x1')]=function(_0x82f79a){return client[_0xbca3('0x2')](_0xbca3('0x3'),{'body':_0x82f79a,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x2e636f,_0x3e66f9){return client[_0xbca3('0x2')](_0xbca3('0x4'),{'body':_0x3e66f9,'options':{'where':{'uniqueid':_0x2e636f},'order':[['id',_0xbca3('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xc989=['../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0x80b77d,_0x3c7c6e){var _0x1e7793=function(_0x399657){while(--_0x399657){_0x80b77d['push'](_0x80b77d['shift']());}};_0x1e7793(++_0x3c7c6e);}(_0xc989,0x126));var _0x9c98=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc989[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0x9c98('0x0'));exports[_0x9c98('0x1')]=function(_0x4b441e){return client[_0x9c98('0x2')](_0x9c98('0x3'),{'body':_0x4b441e,'log':_0x9c98('0x3')});};exports[_0x9c98('0x4')]=function(_0xddd75c,_0x2d1cf5){return client[_0x9c98('0x2')](_0x9c98('0x5'),{'body':_0x2d1cf5,'options':{'where':{'uniqueid':_0xddd75c},'order':[['id',_0x9c98('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 8f9a005..c9ea840 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 _0x6598=['Intervals','name','getIntervals','Request','GetInterval'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x6598,0xac));var _0x8659=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0x6598[_0xdd2bfa];return _0x55397e;};'use strict';var client=require('../client');exports[_0x8659('0x0')]=function(){return function(){return client[_0x8659('0x1')](_0x8659('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x8659('0x3'),'attributes':['id',_0x8659('0x4'),'interval']}]},'log':_0x8659('0x0')});};}; \ No newline at end of file +var _0x02cf=['interval','../client','getIntervals','Request','GetInterval','name','Intervals'];(function(_0x4559e9,_0x361d01){var _0xf1198d=function(_0x574dba){while(--_0x574dba){_0x4559e9['push'](_0x4559e9['shift']());}};_0xf1198d(++_0x361d01);}(_0x02cf,0x1e4));var _0xf02c=function(_0x5180b7,_0x3c813e){_0x5180b7=_0x5180b7-0x0;var _0x377e0f=_0x02cf[_0x5180b7];return _0x377e0f;};'use strict';var client=require(_0xf02c('0x0'));exports[_0xf02c('0x1')]=function(){return function(){return client[_0xf02c('0x2')](_0xf02c('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xf02c('0x4')],'include':[{'model':'Interval','as':_0xf02c('0x5'),'attributes':['id',_0xf02c('0x4'),_0xf02c('0x6')]}]},'log':_0xf02c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 27c7401..a58b382 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 _0x66fa=['update','Request','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction','../client'];(function(_0x1ec0f8,_0x2fbfbd){var _0x777127=function(_0x113153){while(--_0x113153){_0x1ec0f8['push'](_0x1ec0f8['shift']());}};_0x777127(++_0x2fbfbd);}(_0x66fa,0x117));var _0xa66f=function(_0x35c3c6,_0x4cd872){_0x35c3c6=_0x35c3c6-0x0;var _0x2e0263=_0x66fa[_0x35c3c6];return _0x2e0263;};'use strict';var client=require(_0xa66f('0x0'));exports[_0xa66f('0x1')]=function(_0x52947a,_0x1fc161){return client[_0xa66f('0x2')](_0xa66f('0x3'),{'body':_0x1fc161,'options':{'where':{'id':_0x52947a}},'log':_0xa66f('0x4')});};exports[_0xa66f('0x5')]=function(_0x2a2abf,_0x3f4904){return client['Request']('AddTagsToMailInteraction',{'body':_0x3f4904,'options':{'where':{'id':_0x2a2abf}},'log':_0xa66f('0x6')});}; \ No newline at end of file +var _0x4137=['updateMailInteraction','addTags','AddTagsToMailInteraction','../client','update','Request','UpdateMailInteraction'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x4137,0xf8));var _0x7413=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4137[_0x178e48];return _0x440d7e;};'use strict';var client=require(_0x7413('0x0'));exports[_0x7413('0x1')]=function(_0x370399,_0x4f372c){return client[_0x7413('0x2')](_0x7413('0x3'),{'body':_0x4f372c,'options':{'where':{'id':_0x370399}},'log':_0x7413('0x4')});};exports[_0x7413('0x5')]=function(_0x258255,_0x3dc48a){return client[_0x7413('0x2')](_0x7413('0x6'),{'body':_0x3dc48a,'options':{'where':{'id':_0x258255}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index d9b991f..f902fb6 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 _0xbf99=['Request','create'];(function(_0xbcea1,_0x469f9f){var _0x17fb47=function(_0x48f5e7){while(--_0x48f5e7){_0xbcea1['push'](_0xbcea1['shift']());}};_0x17fb47(++_0x469f9f);}(_0xbf99,0x1ed));var _0x9bf9=function(_0x5501f3,_0x2a99a3){_0x5501f3=_0x5501f3-0x0;var _0x8a035a=_0xbf99[_0x5501f3];return _0x8a035a;};'use strict';var client=require('../client');exports[_0x9bf9('0x0')]=function(_0x4fa2bd){return client[_0x9bf9('0x1')]('CreateMailMessage',{'body':_0x4fa2bd,'log':'createMailMessage'});}; \ No newline at end of file +var _0xa056=['createMailMessage','../client','Request'];(function(_0x16b055,_0x5811ca){var _0x2c103c=function(_0x18635a){while(--_0x18635a){_0x16b055['push'](_0x16b055['shift']());}};_0x2c103c(++_0x5811ca);}(_0xa056,0x124));var _0x6a05=function(_0x56fda6,_0x5be31d){_0x56fda6=_0x56fda6-0x0;var _0x376e10=_0xa056[_0x56fda6];return _0x376e10;};'use strict';var client=require(_0x6a05('0x0'));exports['create']=function(_0x14d1cd){return client[_0x6a05('0x1')]('CreateMailMessage',{'body':_0x14d1cd,'log':_0x6a05('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 5463d23..8169059 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 _0xfd3a=['name','timeout','Agents','online','mailPause','getMailQueues','../client','Request','GetMailQueue'];(function(_0xc6379f,_0x5d0315){var _0x437fe8=function(_0x28d0d3){while(--_0x28d0d3){_0xc6379f['push'](_0xc6379f['shift']());}};_0x437fe8(++_0x5d0315);}(_0xfd3a,0x189));var _0xafd3=function(_0x2bcd82,_0x427da9){_0x2bcd82=_0x2bcd82-0x0;var _0x39216c=_0xfd3a[_0x2bcd82];return _0x39216c;};'use strict';var client=require(_0xafd3('0x0'));exports['getMailQueues']=function(){return function(){return client[_0xafd3('0x1')](_0xafd3('0x2'),{'options':{'raw':![],'attributes':['id',_0xafd3('0x3'),_0xafd3('0x4'),'strategy'],'include':[{'model':'User','as':_0xafd3('0x5'),'attributes':['id',_0xafd3('0x3'),_0xafd3('0x6'),_0xafd3('0x7')]}]},'log':_0xafd3('0x8')});};}; \ No newline at end of file +var _0xedf7=['GetMailQueue','timeout','strategy','User','online','mailPause','getMailQueues','Request'];(function(_0x5db968,_0x2b6308){var _0x50c8cf=function(_0x4627b3){while(--_0x4627b3){_0x5db968['push'](_0x5db968['shift']());}};_0x50c8cf(++_0x2b6308);}(_0xedf7,0x7e));var _0x7edf=function(_0x1e1360,_0x3274d1){_0x1e1360=_0x1e1360-0x0;var _0x382ccf=_0xedf7[_0x1e1360];return _0x382ccf;};'use strict';var client=require('../client');exports[_0x7edf('0x0')]=function(){return function(){return client[_0x7edf('0x1')](_0x7edf('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x7edf('0x3'),_0x7edf('0x4')],'include':[{'model':_0x7edf('0x5'),'as':'Agents','attributes':['id','name',_0x7edf('0x6'),_0x7edf('0x7')]}]},'log':_0x7edf('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index bc51fcd..7d1ece8 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 _0x4652=['../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0x2c3c23,_0x3609b5){var _0x24e0ee=function(_0x510410){while(--_0x510410){_0x2c3c23['push'](_0x2c3c23['shift']());}};_0x24e0ee(++_0x3609b5);}(_0x4652,0x11f));var _0x2465=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4652[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x2465('0x0'));exports[_0x2465('0x1')]=function(_0x899d60){return client[_0x2465('0x2')]('CreateMailQueueReport',{'body':_0x899d60,'log':_0x2465('0x3')});};exports[_0x2465('0x4')]=function(_0x4ff64c,_0x5548f7){return client[_0x2465('0x2')](_0x2465('0x5'),{'body':_0x5548f7,'options':{'where':{'uniqueid':_0x4ff64c},'order':[['id',_0x2465('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x3962=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','create'];(function(_0x1f83a5,_0x59843f){var _0x45edf0=function(_0x431e25){while(--_0x431e25){_0x1f83a5['push'](_0x1f83a5['shift']());}};_0x45edf0(++_0x59843f);}(_0x3962,0x17f));var _0x2396=function(_0x11e829,_0x8ac0fa){_0x11e829=_0x11e829-0x0;var _0x5a8a34=_0x3962[_0x11e829];return _0x5a8a34;};'use strict';var client=require('../client');exports[_0x2396('0x0')]=function(_0x4f002c){return client[_0x2396('0x1')](_0x2396('0x2'),{'body':_0x4f002c,'log':_0x2396('0x2')});};exports[_0x2396('0x3')]=function(_0x35c4ee,_0x2e64ec){return client[_0x2396('0x1')](_0x2396('0x4'),{'body':_0x2e64ec,'options':{'where':{'uniqueid':_0x35c4ee},'order':[['id',_0x2396('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index c5fac55..87084d7 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 _0x5f95=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','updateOpenchannelInteraction'];(function(_0x11f854,_0x2fc126){var _0x54fb77=function(_0x595164){while(--_0x595164){_0x11f854['push'](_0x11f854['shift']());}};_0x54fb77(++_0x2fc126);}(_0x5f95,0x11b));var _0x55f9=function(_0x168940,_0x259ce0){_0x168940=_0x168940-0x0;var _0x4bac44=_0x5f95[_0x168940];return _0x4bac44;};'use strict';var client=require(_0x55f9('0x0'));exports[_0x55f9('0x1')]=function(_0x5edf03,_0x19626e){return client[_0x55f9('0x2')]('UpdateOpenchannelInteraction',{'body':_0x19626e,'options':{'where':{'id':_0x5edf03}},'log':_0x55f9('0x3')});};exports[_0x55f9('0x4')]=function(_0x1ecc25,_0x3210e9){return client[_0x55f9('0x2')](_0x55f9('0x5'),{'body':_0x3210e9,'options':{'where':{'id':_0x1ecc25}},'log':_0x55f9('0x6')});}; \ No newline at end of file +var _0x0bc6=['addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction'];(function(_0xc56830,_0x273bee){var _0x559b2e=function(_0x2b3df3){while(--_0x2b3df3){_0xc56830['push'](_0xc56830['shift']());}};_0x559b2e(++_0x273bee);}(_0x0bc6,0x112));var _0x60bc=function(_0x14c2cf,_0x29a840){_0x14c2cf=_0x14c2cf-0x0;var _0x32b9f4=_0x0bc6[_0x14c2cf];return _0x32b9f4;};'use strict';var client=require(_0x60bc('0x0'));exports[_0x60bc('0x1')]=function(_0x504a4a,_0x443480){return client[_0x60bc('0x2')](_0x60bc('0x3'),{'body':_0x443480,'options':{'where':{'id':_0x504a4a}},'log':_0x60bc('0x4')});};exports['addTags']=function(_0x20cb0b,_0x2b59f8){return client[_0x60bc('0x2')](_0x60bc('0x5'),{'body':_0x2b59f8,'options':{'where':{'id':_0x20cb0b}},'log':_0x60bc('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index b8d6f5c..94c0833 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 _0x0339=['../client','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0xfbe06e,_0x2fb7ab){var _0x24e5b6=function(_0x48569f){while(--_0x48569f){_0xfbe06e['push'](_0xfbe06e['shift']());}};_0x24e5b6(++_0x2fb7ab);}(_0x0339,0x93));var _0x9033=function(_0x4d4c36,_0x2f410b){_0x4d4c36=_0x4d4c36-0x0;var _0x4c647c=_0x0339[_0x4d4c36];return _0x4c647c;};'use strict';var client=require(_0x9033('0x0'));exports['create']=function(_0x58132e){return client['Request'](_0x9033('0x1'),{'body':_0x58132e,'log':_0x9033('0x2')});}; \ No newline at end of file +var _0xac6f=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x5f382f,_0x3f1432){var _0x3bb11b=function(_0x4daf9b){while(--_0x4daf9b){_0x5f382f['push'](_0x5f382f['shift']());}};_0x3bb11b(++_0x3f1432);}(_0xac6f,0xa7));var _0xfac6=function(_0x3986d6,_0x25eade){_0x3986d6=_0x3986d6-0x0;var _0x46fa23=_0xac6f[_0x3986d6];return _0x46fa23;};'use strict';var client=require(_0xfac6('0x0'));exports['create']=function(_0x1d8c96){return client[_0xfac6('0x1')](_0xfac6('0x2'),{'body':_0x1d8c96,'log':_0xfac6('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 664e50b..f4e2a9f 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 _0x73e9=['strategy','User','Agents','name','online','getOpenchannelQueues','../client','Request','GetOpenchannelQueue','timeout'];(function(_0x3d1545,_0x3a3dec){var _0x3a1bd2=function(_0x3b2731){while(--_0x3b2731){_0x3d1545['push'](_0x3d1545['shift']());}};_0x3a1bd2(++_0x3a3dec);}(_0x73e9,0x132));var _0x973e=function(_0x16a7bc,_0x3ee4fb){_0x16a7bc=_0x16a7bc-0x0;var _0x54e51d=_0x73e9[_0x16a7bc];return _0x54e51d;};'use strict';var client=require(_0x973e('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x973e('0x1')](_0x973e('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x973e('0x3'),_0x973e('0x4')],'include':[{'model':_0x973e('0x5'),'as':_0x973e('0x6'),'attributes':['id',_0x973e('0x7'),_0x973e('0x8'),'openchannelPause']}]},'log':_0x973e('0x9')});};}; \ No newline at end of file +var _0x1912=['online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy','User','Agents'];(function(_0x3fab1b,_0x22a161){var _0x18c0e0=function(_0x2717c0){while(--_0x2717c0){_0x3fab1b['push'](_0x3fab1b['shift']());}};_0x18c0e0(++_0x22a161);}(_0x1912,0x192));var _0x2191=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x1912[_0x465a0c];return _0x1e202e;};'use strict';var client=require(_0x2191('0x0'));exports[_0x2191('0x1')]=function(){return function(){return client[_0x2191('0x2')](_0x2191('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x2191('0x4'),_0x2191('0x5')],'include':[{'model':_0x2191('0x6'),'as':_0x2191('0x7'),'attributes':['id','name',_0x2191('0x8'),_0x2191('0x9')]}]},'log':_0x2191('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 5abd839..f5cc5b9 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 _0x19bf=['../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x372620,_0x595dda){var _0x5d5dfa=function(_0x195681){while(--_0x195681){_0x372620['push'](_0x372620['shift']());}};_0x5d5dfa(++_0x595dda);}(_0x19bf,0x18f));var _0xf19b=function(_0x5cf7f4,_0x2df282){_0x5cf7f4=_0x5cf7f4-0x0;var _0x3b11ca=_0x19bf[_0x5cf7f4];return _0x3b11ca;};'use strict';var client=require(_0xf19b('0x0'));exports[_0xf19b('0x1')]=function(_0x3e9b96){return client[_0xf19b('0x2')](_0xf19b('0x3'),{'body':_0x3e9b96,'log':_0xf19b('0x3')});};exports[_0xf19b('0x4')]=function(_0x3d7f91,_0x7c175){return client[_0xf19b('0x2')](_0xf19b('0x5'),{'body':_0x7c175,'options':{'where':{'uniqueid':_0x3d7f91},'order':[['id',_0xf19b('0x6')]],'limit':0x1},'log':_0xf19b('0x5')});}; \ No newline at end of file +var _0xe8c6=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x7b634a,_0x2f6e7e){var _0x898456=function(_0x4554f6){while(--_0x4554f6){_0x7b634a['push'](_0x7b634a['shift']());}};_0x898456(++_0x2f6e7e);}(_0xe8c6,0x1bc));var _0x6e8c=function(_0x392c8d,_0x4f947a){_0x392c8d=_0x392c8d-0x0;var _0x53adda=_0xe8c6[_0x392c8d];return _0x53adda;};'use strict';var client=require('../client');exports[_0x6e8c('0x0')]=function(_0x3924da){return client[_0x6e8c('0x1')](_0x6e8c('0x2'),{'body':_0x3924da,'log':_0x6e8c('0x2')});};exports[_0x6e8c('0x3')]=function(_0x3794f6,_0x2bd74){return client[_0x6e8c('0x1')](_0x6e8c('0x4'),{'body':_0x2bd74,'options':{'where':{'uniqueid':_0x3794f6},'order':[['id',_0x6e8c('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index b7ae598..a567922 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 _0x5a93=['addTagsToSmsInteraction','update','Request','addTags','AddTagsToSmsInteraction'];(function(_0x51a290,_0x573bd4){var _0x144824=function(_0x1a514b){while(--_0x1a514b){_0x51a290['push'](_0x51a290['shift']());}};_0x144824(++_0x573bd4);}(_0x5a93,0xf6));var _0x35a9=function(_0x346ca7,_0x44a9c7){_0x346ca7=_0x346ca7-0x0;var _0x53844b=_0x5a93[_0x346ca7];return _0x53844b;};'use strict';var client=require('../client');exports[_0x35a9('0x0')]=function(_0x593017,_0x23ee4d){return client[_0x35a9('0x1')]('UpdateSmsInteraction',{'body':_0x23ee4d,'options':{'where':{'id':_0x593017}},'log':'updateSmsInteraction'});};exports[_0x35a9('0x2')]=function(_0xf10dcf,_0x3a23d6){return client['Request'](_0x35a9('0x3'),{'body':_0x3a23d6,'options':{'where':{'id':_0xf10dcf}},'log':_0x35a9('0x4')});}; \ No newline at end of file +var _0xcb99=['addTagsToSmsInteraction','../client','UpdateSmsInteraction','updateSmsInteraction','addTags','Request'];(function(_0x517d5d,_0x248fb6){var _0x1900bc=function(_0x14539f){while(--_0x14539f){_0x517d5d['push'](_0x517d5d['shift']());}};_0x1900bc(++_0x248fb6);}(_0xcb99,0x8b));var _0x9cb9=function(_0x293055,_0x10e0b1){_0x293055=_0x293055-0x0;var _0x19c83a=_0xcb99[_0x293055];return _0x19c83a;};'use strict';var client=require(_0x9cb9('0x0'));exports['update']=function(_0x30a555,_0x52af95){return client['Request'](_0x9cb9('0x1'),{'body':_0x52af95,'options':{'where':{'id':_0x30a555}},'log':_0x9cb9('0x2')});};exports[_0x9cb9('0x3')]=function(_0x51f2ee,_0x167735){return client[_0x9cb9('0x4')]('AddTagsToSmsInteraction',{'body':_0x167735,'options':{'where':{'id':_0x51f2ee}},'log':_0x9cb9('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 58f664b..3df6677 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 _0x3643=['create','Request','CreateSmsMessage','../client'];(function(_0x3830a5,_0x25e3e4){var _0x6d7bb5=function(_0x34beb5){while(--_0x34beb5){_0x3830a5['push'](_0x3830a5['shift']());}};_0x6d7bb5(++_0x25e3e4);}(_0x3643,0x14b));var _0x3364=function(_0x215ac9,_0x543b84){_0x215ac9=_0x215ac9-0x0;var _0x22d5a1=_0x3643[_0x215ac9];return _0x22d5a1;};'use strict';var client=require(_0x3364('0x0'));exports[_0x3364('0x1')]=function(_0x441348){return client[_0x3364('0x2')](_0x3364('0x3'),{'body':_0x441348,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x9fc8=['createSmsMessage','create','Request','CreateSmsMessage'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x9fc8,0xd5));var _0x89fc=function(_0x4dc027,_0x408187){_0x4dc027=_0x4dc027-0x0;var _0x9f0c04=_0x9fc8[_0x4dc027];return _0x9f0c04;};'use strict';var client=require('../client');exports[_0x89fc('0x0')]=function(_0x431f72){return client[_0x89fc('0x1')](_0x89fc('0x2'),{'body':_0x431f72,'log':_0x89fc('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index a12d3a0..2f00e82 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 _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x74dee0,_0x1074e1){var _0x969e85=function(_0x3dcac3){while(--_0x3dcac3){_0x74dee0['push'](_0x74dee0['shift']());}};_0x969e85(++_0x1074e1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1d70db,_0x142b63){_0x1d70db=_0x1d70db-0x0;var _0x3060c6=_0xcb91[_0x1d70db];return _0x3060c6;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x55df01,_0x62ec17){var _0x495fdc=function(_0x3f6828){while(--_0x3f6828){_0x55df01['push'](_0x55df01['shift']());}};_0x495fdc(++_0x62ec17);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 773ce1a..b12647c 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 _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x564caf,_0xa71832){var _0x47ba8c=function(_0x286fd5){while(--_0x286fd5){_0x564caf['push'](_0x564caf['shift']());}};_0x47ba8c(++_0xa71832);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x30b783,_0x5d86ac){var _0xf0a0=function(_0x57cece){while(--_0x57cece){_0x30b783['push'](_0x30b783['shift']());}};_0xf0a0(++_0x5d86ac);}(_0x55ca,0x126));var _0xa55c=function(_0x264b79,_0xc62859){_0x264b79=_0x264b79-0x0;var _0x548c85=_0x55ca[_0x264b79];return _0x548c85;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index d2dd261..b1b7a0d 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(_0x136a74,_0x580717){var _0x380919=function(_0x380c02){while(--_0x380c02){_0x136a74['push'](_0x136a74['shift']());}};_0x380919(++_0x580717);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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(_0x28661b,_0x31f4de){var _0x3cddf1=function(_0x18a9cb){while(--_0x18a9cb){_0x28661b['push'](_0x28661b['shift']());}};_0x3cddf1(++_0x31f4de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 9a9ea34..f025957 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 _0x6596=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x3fd21d,_0x4e5bec){var _0x1c7add=function(_0x13cddc){while(--_0x13cddc){_0x3fd21d['push'](_0x3fd21d['shift']());}};_0x1c7add(++_0x4e5bec);}(_0x6596,0x1d3));var _0x6659=function(_0x2340f7,_0x2d12a1){_0x2340f7=_0x2340f7-0x0;var _0x2c6539=_0x6596[_0x2340f7];return _0x2c6539;};'use strict';var client=require(_0x6659('0x0'));exports[_0x6659('0x1')]=function(_0x51eb88,_0x28cf44){return client[_0x6659('0x2')](_0x6659('0x3'),{'body':_0x28cf44,'options':{'where':{'id':_0x51eb88}},'log':_0x6659('0x4')});};exports[_0x6659('0x5')]=function(_0x67ac1d,_0x4bfd3c){return client['Request'](_0x6659('0x6'),{'body':_0x4bfd3c,'options':{'where':{'id':_0x67ac1d}},'log':_0x6659('0x7')});}; \ No newline at end of file +var _0x11e5=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','../client'];(function(_0x130939,_0x18de65){var _0xb6f6f5=function(_0x2905b3){while(--_0x2905b3){_0x130939['push'](_0x130939['shift']());}};_0xb6f6f5(++_0x18de65);}(_0x11e5,0x8b));var _0x511e=function(_0x38b2d9,_0x19fd42){_0x38b2d9=_0x38b2d9-0x0;var _0x23a3e1=_0x11e5[_0x38b2d9];return _0x23a3e1;};'use strict';var client=require(_0x511e('0x0'));exports['update']=function(_0xfd6709,_0x269c68){return client['Request'](_0x511e('0x1'),{'body':_0x269c68,'options':{'where':{'id':_0xfd6709}},'log':_0x511e('0x2')});};exports[_0x511e('0x3')]=function(_0x5cab33,_0x249e4d){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x249e4d,'options':{'where':{'id':_0x5cab33}},'log':_0x511e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 4bf5923..c523086 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 _0x17c0=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x17c0,0xf3));var _0x017c=function(_0x2a9f4,_0x25c14a){_0x2a9f4=_0x2a9f4-0x0;var _0x3c39e0=_0x17c0[_0x2a9f4];return _0x3c39e0;};'use strict';var client=require(_0x017c('0x0'));exports[_0x017c('0x1')]=function(_0x1294eb){return client[_0x017c('0x2')](_0x017c('0x3'),{'body':_0x1294eb,'log':_0x017c('0x4')});}; \ No newline at end of file +var _0x12b8=['createWhatsappMessage','create','Request'];(function(_0x1ce67b,_0x5d1e9f){var _0xc64cb0=function(_0x376ce4){while(--_0x376ce4){_0x1ce67b['push'](_0x1ce67b['shift']());}};_0xc64cb0(++_0x5d1e9f);}(_0x12b8,0x16f));var _0x812b=function(_0x7c3553,_0x58020e){_0x7c3553=_0x7c3553-0x0;var _0x3d2fc5=_0x12b8[_0x7c3553];return _0x3d2fc5;};'use strict';var client=require('../client');exports[_0x812b('0x0')]=function(_0x639a4){return client[_0x812b('0x1')]('CreateWhatsappMessage',{'body':_0x639a4,'log':_0x812b('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 8d539a5..2fe0aaf 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 _0x4878=['../client','getWhatsappQueues','Request','name','strategy','Agents','online','whatsappPause'];(function(_0x595790,_0x42f649){var _0x386928=function(_0x413b8d){while(--_0x413b8d){_0x595790['push'](_0x595790['shift']());}};_0x386928(++_0x42f649);}(_0x4878,0xc8));var _0x8487=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4878[_0x27af45];return _0x18df21;};'use strict';var client=require(_0x8487('0x0'));exports[_0x8487('0x1')]=function(){return function(){return client[_0x8487('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x8487('0x3'),'timeout',_0x8487('0x4')],'include':[{'model':'User','as':_0x8487('0x5'),'attributes':['id',_0x8487('0x3'),_0x8487('0x6'),_0x8487('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0xa578=['User','online','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy'];(function(_0x28b68e,_0x527118){var _0x4fefeb=function(_0x100412){while(--_0x100412){_0x28b68e['push'](_0x28b68e['shift']());}};_0x4fefeb(++_0x527118);}(_0xa578,0x135));var _0x8a57=function(_0x3e1562,_0x4150b3){_0x3e1562=_0x3e1562-0x0;var _0x3efda1=_0xa578[_0x3e1562];return _0x3efda1;};'use strict';var client=require('../client');exports[_0x8a57('0x0')]=function(){return function(){return client[_0x8a57('0x1')](_0x8a57('0x2'),{'options':{'raw':![],'attributes':['id',_0x8a57('0x3'),_0x8a57('0x4'),_0x8a57('0x5')],'include':[{'model':_0x8a57('0x6'),'as':'Agents','attributes':['id',_0x8a57('0x3'),_0x8a57('0x7'),_0x8a57('0x8')]}]},'log':_0x8a57('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index e89ecde..ea59de8 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 _0x0256=['Request','UpdateWhatsappQueueReport','DESC','create','CreateWhatsappQueueReport','update'];(function(_0x3ac946,_0x52a63a){var _0x10826c=function(_0x3c33ea){while(--_0x3c33ea){_0x3ac946['push'](_0x3ac946['shift']());}};_0x10826c(++_0x52a63a);}(_0x0256,0x195));var _0x6025=function(_0x3d4a6b,_0x20dbcb){_0x3d4a6b=_0x3d4a6b-0x0;var _0x55d64a=_0x0256[_0x3d4a6b];return _0x55d64a;};'use strict';var client=require('../client');exports[_0x6025('0x0')]=function(_0x2a2e25){return client['Request'](_0x6025('0x1'),{'body':_0x2a2e25,'log':_0x6025('0x1')});};exports[_0x6025('0x2')]=function(_0x455ae0,_0x3868b5){return client[_0x6025('0x3')](_0x6025('0x4'),{'body':_0x3868b5,'options':{'where':{'uniqueid':_0x455ae0},'order':[['id',_0x6025('0x5')]],'limit':0x1},'log':_0x6025('0x4')});}; \ No newline at end of file +var _0xc1a5=['update','DESC','UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x563b76,_0x51cfae){var _0x38d84d=function(_0x163f8b){while(--_0x163f8b){_0x563b76['push'](_0x563b76['shift']());}};_0x38d84d(++_0x51cfae);}(_0xc1a5,0x1b5));var _0x5c1a=function(_0x4606b8,_0x55cb73){_0x4606b8=_0x4606b8-0x0;var _0x3344a1=_0xc1a5[_0x4606b8];return _0x3344a1;};'use strict';var client=require(_0x5c1a('0x0'));exports[_0x5c1a('0x1')]=function(_0x4ef2bf){return client[_0x5c1a('0x2')](_0x5c1a('0x3'),{'body':_0x4ef2bf,'log':_0x5c1a('0x3')});};exports[_0x5c1a('0x4')]=function(_0x2b6980,_0x2a727c){return client[_0x5c1a('0x2')]('UpdateWhatsappQueueReport',{'body':_0x2a727c,'options':{'where':{'uniqueid':_0x2b6980},'order':[['id',_0x5c1a('0x5')]],'limit':0x1},'log':_0x5c1a('0x6')});}; \ 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 c96f42a..fc72a89 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 _0xbb4b=['find','agents','timeout','atimeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','util','../../../../config/logger','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','message','join','stop'];(function(_0x444e41,_0x23bd5d){var _0x28ac1a=function(_0x5eff34){while(--_0x5eff34){_0x444e41['push'](_0x444e41['shift']());}};_0x28ac1a(++_0x23bd5d);}(_0xbb4b,0x139));var _0xbbb4=function(_0x53efb5,_0x1e6181){_0x53efb5=_0x53efb5-0x0;var _0x1d41cc=_0xbb4b[_0x53efb5];return _0x1d41cc;};'use strict';var schema=require(_0xbbb4('0x0'));var _=require('lodash');var util=require(_0xbbb4('0x1'));var seqqueue=require('seq-queue');var logger=require(_0xbbb4('0x2'))('routing');var strategy=require(_0xbbb4('0x3'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xbbb4('0x4')},'timeout':{'type':_0xbbb4('0x5'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x30bd3a,_0x1ba834,_0x1ec64c){return logger[_0xbbb4('0x6')](util[_0xbbb4('0x7')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x30bd3a,_0x1ba834['name'],_0x1ec64c));}function handleFindAgent(_0x5ab66d){return function(_0xf820e0){return _0xf820e0[_0xbbb4('0x8')][_0xbbb4('0x9')]()===_0x5ab66d['toLowerCase']();};}exports['consequence']=function(_0x11941f,_0x1a1a65,_0x4e1239,_0x160c73){return function(_0x4dcd93){try{var _0xd38c07={'name':_0x1a1a65[0x0],'timeout':_0x1a1a65[0x1]};var _0xb7ee07=queue[_0xbbb4('0x0')](_0xd38c07,{'typecast':!![]});if(_0xb7ee07[_0xbbb4('0xa')]){logger[_0xbbb4('0xb')](_0xbbb4('0xc'),_0x11941f,_[_0xbbb4('0xd')](_0xb7ee07,_0xbbb4('0xe'))[_0xbbb4('0xf')](',\x20'));_0x4dcd93[_0xbbb4('0x10')]();}else{var _0x3d02c0=_[_0xbbb4('0x11')](_0x4e1239[_0xbbb4('0x12')],handleFindAgent(_0xd38c07[_0xbbb4('0x8')]));if(_0x3d02c0){var _0x4af643=(_0xd38c07[_0xbbb4('0x13')]||0xa)*0x3e8;var _0x4af167,_0x39b9ad;var _0x5859fc=seqqueue['createQueue'](_0x4af643);_0x5859fc['id']=_0x11941f;_0x5859fc[_0xbbb4('0x14')]=_0x4af643;_0x5859fc[_0xbbb4('0x15')]=_0x160c73[_0xbbb4('0x15')];writeLog(_0x11941f,_0x3d02c0,util[_0xbbb4('0x7')](_0xbbb4('0x16'),_0x4af643));_0x4e1239['rules'][_0x11941f]['on'](_0xbbb4('0x17'),function(){logger['info'](_0xbbb4('0x18'),_0x11941f);clearTimeout(_0x39b9ad);_0x39b9ad=undefined;_0x5859fc[_0xbbb4('0x19')]();if(_0x4e1239[_0xbbb4('0x1a')][_0x11941f]){delete _0x4e1239[_0xbbb4('0x1a')][_0x11941f];}_0x4dcd93[_0xbbb4('0x10')]();});_0x4e1239[_0xbbb4('0x1a')][_0x11941f]['on'](_0xbbb4('0x1b'),function(){if(_0x4e1239[_0xbbb4('0x1a')][_0x11941f]){delete _0x4e1239[_0xbbb4('0x1a')][_0x11941f];}});_0x39b9ad=setTimeout(function(){logger[_0xbbb4('0x6')](_0xbbb4('0x1c'),_0x11941f);clearTimeout(_0x39b9ad);_0x5859fc['close']();_0x4dcd93['next']();},_0x4af643);strategy[_0xbbb4('0x1d')](_0x5859fc,_0x3d02c0,_0x4e1239,_0x160c73);}else{logger['error'](_0xbbb4('0x1e'),_0x11941f,_0xd38c07[_0xbbb4('0x8')]);_0x4dcd93[_0xbbb4('0x10')]();}}}catch(_0x2738b9){console[_0xbbb4('0x1f')](_0x2738b9);logger[_0xbbb4('0xb')](_0xbbb4('0x20'),_0x11941f,_0x2738b9['stack']);_0x4dcd93[_0xbbb4('0x10')]();}};}; \ No newline at end of file +var _0xdd48=['end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','./strategy','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','channel','rules'];(function(_0x5bb057,_0x5a1d02){var _0x2dacb2=function(_0x23225c){while(--_0x23225c){_0x5bb057['push'](_0x5bb057['shift']());}};_0x2dacb2(++_0x5a1d02);}(_0xdd48,0x1d1));var _0x8dd4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xdd48[_0x21a9d9];return _0x46adce;};'use strict';var schema=require(_0x8dd4('0x0'));var _=require(_0x8dd4('0x1'));var util=require(_0x8dd4('0x2'));var seqqueue=require(_0x8dd4('0x3'));var logger=require(_0x8dd4('0x4'))('routing');var strategy=require(_0x8dd4('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x251eab,_0x3b1441,_0x3126c7){return logger[_0x8dd4('0x6')](util[_0x8dd4('0x7')](_0x8dd4('0x8'),_0x251eab,_0x3b1441['name'],_0x3126c7));}function handleFindAgent(_0x3bc261){return function(_0x35c689){return _0x35c689[_0x8dd4('0x9')][_0x8dd4('0xa')]()===_0x3bc261['toLowerCase']();};}exports[_0x8dd4('0xb')]=function(_0x4ed3e6,_0x2f97e3,_0x1682b2,_0x48613f){return function(_0x34078d){try{var _0x263a81={'name':_0x2f97e3[0x0],'timeout':_0x2f97e3[0x1]};var _0x144e78=queue[_0x8dd4('0x0')](_0x263a81,{'typecast':!![]});if(_0x144e78[_0x8dd4('0xc')]){logger[_0x8dd4('0xd')](_0x8dd4('0xe'),_0x4ed3e6,_[_0x8dd4('0xf')](_0x144e78,_0x8dd4('0x10'))[_0x8dd4('0x11')](',\x20'));_0x34078d[_0x8dd4('0x12')]();}else{var _0x102ea0=_[_0x8dd4('0x13')](_0x1682b2[_0x8dd4('0x14')],handleFindAgent(_0x263a81[_0x8dd4('0x9')]));if(_0x102ea0){var _0x4cf6e2=(_0x263a81[_0x8dd4('0x15')]||0xa)*0x3e8;var _0x34837f,_0x42d790;var _0x2187eb=seqqueue[_0x8dd4('0x16')](_0x4cf6e2);_0x2187eb['id']=_0x4ed3e6;_0x2187eb['atimeout']=_0x4cf6e2;_0x2187eb[_0x8dd4('0x17')]=_0x48613f[_0x8dd4('0x17')];writeLog(_0x4ed3e6,_0x102ea0,util[_0x8dd4('0x7')]('START:%s',_0x4cf6e2));_0x1682b2[_0x8dd4('0x18')][_0x4ed3e6]['on'](_0x8dd4('0x19'),function(){logger[_0x8dd4('0x6')](_0x8dd4('0x1a'),_0x4ed3e6);clearTimeout(_0x42d790);_0x42d790=undefined;_0x2187eb[_0x8dd4('0x1b')]();if(_0x1682b2[_0x8dd4('0x18')][_0x4ed3e6]){delete _0x1682b2[_0x8dd4('0x18')][_0x4ed3e6];}_0x34078d['stop']();});_0x1682b2['rules'][_0x4ed3e6]['on'](_0x8dd4('0x1c'),function(){if(_0x1682b2['rules'][_0x4ed3e6]){delete _0x1682b2[_0x8dd4('0x18')][_0x4ed3e6];}});_0x42d790=setTimeout(function(){logger[_0x8dd4('0x6')]('[%s][AGENT]\x20ROUTING\x20END',_0x4ed3e6);clearTimeout(_0x42d790);_0x2187eb[_0x8dd4('0x1b')]();_0x34078d[_0x8dd4('0x1d')]();},_0x4cf6e2);strategy[_0x8dd4('0x1e')](_0x2187eb,_0x102ea0,_0x1682b2,_0x48613f);}else{logger[_0x8dd4('0xd')](_0x8dd4('0x1f'),_0x4ed3e6,_0x263a81['name']);_0x34078d[_0x8dd4('0x12')]();}}}catch(_0x3bdce4){console[_0x8dd4('0x20')](_0x3bdce4);logger['error'](_0x8dd4('0x21'),_0x4ed3e6,_0x3bdce4[_0x8dd4('0x22')]);_0x34078d[_0x8dd4('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index b16f47e..923657d 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 _0x8027=['Failed','stringify','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','[%s][AMAZONLEX]\x20%s','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','then','info','error','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','toString','postText','message','amazonlex','providerName','providerResponse','create','dialogState'];(function(_0x58a21b,_0x522d50){var _0x2423e5=function(_0x5a3362){while(--_0x5a3362){_0x58a21b['push'](_0x58a21b['shift']());}};_0x2423e5(++_0x522d50);}(_0x8027,0x8f));var _0x7802=function(_0x1818f4,_0x598dd3){_0x1818f4=_0x1818f4-0x0;var _0x546d98=_0x8027[_0x1818f4];return _0x546d98;};'use strict';var _=require(_0x7802('0x0'));var moment=require(_0x7802('0x1'));var AWS=require(_0x7802('0x2'));var utils=require(_0x7802('0x3'));var logger=require('../../../../config/logger')(_0x7802('0x4'));var rpc={'chatMessage':require(_0x7802('0x5')),'openchannelMessage':require(_0x7802('0x6')),'mailMessage':require(_0x7802('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x7802('0x8')),'whatsappMessage':require(_0x7802('0x9'))};exports[_0x7802('0xa')]=function(_0x5064df,_0x350b25){return function(_0x5a83a9){try{if(!_['isNil'](this[_0x7802('0xb')][_0x7802('0xc')])){logger['info'](_0x7802('0xd'),_0x5064df,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x5a83a9[_0x7802('0xe')]();}var _0xbb05cd={'ContactId':this['contact']['id'],'sentAt':moment()[_0x7802('0xf')](_0x7802('0x10')),'direction':'out'};if(this[_0x7802('0x11')]==='sms'||this[_0x7802('0x11')]===_0x7802('0x12')){_0xbb05cd[_0x7802('0x13')]=this[_0x7802('0xb')][_0x7802('0x13')];}var _0x2810cc=this[_0x7802('0x11')];if(_0x2810cc===_0x7802('0x14')){_0xbb05cd['ChatWebsiteId']=this[_0x7802('0x15')]['id'];}else{_0xbb05cd[_[_0x7802('0x16')](_0x2810cc)+_0x7802('0x17')]=this['account']['id'];}_0xbb05cd[_[_0x7802('0x16')](_0x2810cc)+_0x7802('0x18')]=this[_0x7802('0xb')]['id'];if(this['interaction'][_0x7802('0x19')]){var _0x269a13=_0x350b25[0x4];if(!_[_0x7802('0x1a')](_0x269a13)){_0xbb05cd[_0x7802('0x1b')]=utils[_0x7802('0x1c')](_0x269a13,this);return rpc[_0x2810cc+_0x7802('0x1d')]['create'](_0xbb05cd)[_0x7802('0x1e')](function(_0x3b258c){logger[_0x7802('0x1f')](_0x7802('0xd'),_0x5064df,_0xbb05cd[_0x7802('0x1b')]);})['catch'](function(_0x5c48a4){logger[_0x7802('0x20')](_0x7802('0xd'),_0x5064df,JSON['stringify'](_0x5c48a4));})[_0x7802('0x21')](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x5064df);_0x5a83a9[_0x7802('0x22')]();});}else{logger[_0x7802('0x1f')](_0x7802('0x23'),_0x5064df);_0x5a83a9['stop']();}}else{var _0x57f925=this;var _0x4f4b26=new AWS[(_0x7802('0x24'))]({'accessKeyId':_0x350b25[0x0],'secretAccessKey':_0x350b25[0x1],'region':_0x350b25[0x2]});var _0x445485={'botAlias':'$LATEST','botName':_0x350b25[0x3],'inputText':this['message'][_0x7802('0x1b')],'userId':this[_0x7802('0x11')]+':'+this[_0x7802('0xb')]['id'][_0x7802('0x25')]()};_0x4f4b26[_0x7802('0x26')](_0x445485,function(_0x2e6f1d,_0x5b94ad){if(_0x2e6f1d){logger['error'](_0x7802('0xd'),_0x5064df,_0x2e6f1d['message']);_0x5a83a9[_0x7802('0xe')]();}else if(_0x5b94ad&&_0x5b94ad[_0x7802('0x27')]){_0x57f925[_0x7802('0x1b')][_0x7802('0x28')]=_0x5b94ad;_0xbb05cd[_0x7802('0x1b')]=_0x5b94ad[_0x7802('0x27')];_0xbb05cd[_0x7802('0x29')]=_0x7802('0x28');_0xbb05cd[_0x7802('0x2a')]=JSON['stringify'](_0x5b94ad);return rpc[_0x2810cc+'Message'][_0x7802('0x2b')](_0xbb05cd)[_0x7802('0x1e')](function(_0x202176){logger[_0x7802('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x5064df,_0xbb05cd['body']);if(_0x5b94ad[_0x7802('0x2c')]==_0x7802('0x2d')){_0x5a83a9['next']();}else{_0x5a83a9[_0x7802('0x22')]();}})['catch'](function(_0x392fc9){logger[_0x7802('0x20')](_0x7802('0xd'),_0x5064df,JSON[_0x7802('0x2e')](_0x392fc9));_0x5a83a9['next']();});}else{_0x5a83a9[_0x7802('0xe')]();}});}}catch(_0x389f21){logger[_0x7802('0x20')](_0x7802('0xd'),_0x5064df,JSON['stringify'](_0x389f21));_0x5a83a9[_0x7802('0x22')]();}};}; \ No newline at end of file +var _0x70f7=['YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','chat','ChatWebsiteId','AccountId','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','catch','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','LexRuntime','message','toString','postText','error','amazonlex','providerName','dialogState','stop','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format'];(function(_0x252782,_0x5b7839){var _0x5123ea=function(_0xbace4b){while(--_0xbace4b){_0x252782['push'](_0x252782['shift']());}};_0x5123ea(++_0x5b7839);}(_0x70f7,0xab));var _0x770f=function(_0x2bfe52,_0x43946e){_0x2bfe52=_0x2bfe52-0x0;var _0x1cf649=_0x70f7[_0x2bfe52];return _0x1cf649;};'use strict';var _=require('lodash');var moment=require(_0x770f('0x0'));var AWS=require(_0x770f('0x1'));var utils=require(_0x770f('0x2'));var logger=require(_0x770f('0x3'))(_0x770f('0x4'));var rpc={'chatMessage':require(_0x770f('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x770f('0x6')),'faxMessage':require(_0x770f('0x7')),'whatsappMessage':require(_0x770f('0x8'))};exports['consequence']=function(_0x3b56ad,_0x30754d){return function(_0x1162a7){try{if(!_[_0x770f('0x9')](this[_0x770f('0xa')][_0x770f('0xb')])){logger[_0x770f('0xc')]('[%s][AMAZONLEX]\x20%s',_0x3b56ad,_0x770f('0xd'));return _0x1162a7[_0x770f('0xe')]();}var _0x404483={'ContactId':this[_0x770f('0xf')]['id'],'sentAt':moment()[_0x770f('0x10')](_0x770f('0x11')),'direction':'out'};if(this[_0x770f('0x12')]===_0x770f('0x13')||this[_0x770f('0x12')]==='whatsapp'){_0x404483['phone']=this[_0x770f('0xa')][_0x770f('0x14')];}var _0x510fb3=this[_0x770f('0x12')];if(_0x510fb3===_0x770f('0x15')){_0x404483[_0x770f('0x16')]=this['account']['id'];}else{_0x404483[_['upperFirst'](_0x510fb3)+_0x770f('0x17')]=this['account']['id'];}_0x404483[_[_0x770f('0x18')](_0x510fb3)+_0x770f('0x19')]=this['interaction']['id'];if(this[_0x770f('0xa')][_0x770f('0x1a')]){var _0x1323df=_0x30754d[0x4];if(!_[_0x770f('0x1b')](_0x1323df)){_0x404483[_0x770f('0x1c')]=utils[_0x770f('0x1d')](_0x1323df,this);return rpc[_0x510fb3+_0x770f('0x1e')][_0x770f('0x1f')](_0x404483)[_0x770f('0x20')](function(_0x5aa3b6){logger['info'](_0x770f('0x21'),_0x3b56ad,_0x404483[_0x770f('0x1c')]);})[_0x770f('0x22')](function(_0x1be07b){logger['error'](_0x770f('0x21'),_0x3b56ad,JSON[_0x770f('0x23')](_0x1be07b));})[_0x770f('0x24')](function(){logger[_0x770f('0xc')](_0x770f('0x25'),_0x3b56ad);_0x1162a7['stop']();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3b56ad);_0x1162a7['stop']();}}else{var _0x4a19d1=this;var _0x38801d=new AWS[(_0x770f('0x26'))]({'accessKeyId':_0x30754d[0x0],'secretAccessKey':_0x30754d[0x1],'region':_0x30754d[0x2]});var _0xc2be65={'botAlias':'$LATEST','botName':_0x30754d[0x3],'inputText':this[_0x770f('0x27')][_0x770f('0x1c')],'userId':this[_0x770f('0x12')]+':'+this[_0x770f('0xa')]['id'][_0x770f('0x28')]()};_0x38801d[_0x770f('0x29')](_0xc2be65,function(_0x51f874,_0x3dbe60){if(_0x51f874){logger[_0x770f('0x2a')](_0x770f('0x21'),_0x3b56ad,_0x51f874[_0x770f('0x27')]);_0x1162a7[_0x770f('0xe')]();}else if(_0x3dbe60&&_0x3dbe60['message']){_0x4a19d1['body'][_0x770f('0x2b')]=_0x3dbe60;_0x404483[_0x770f('0x1c')]=_0x3dbe60[_0x770f('0x27')];_0x404483[_0x770f('0x2c')]=_0x770f('0x2b');_0x404483['providerResponse']=JSON[_0x770f('0x23')](_0x3dbe60);return rpc[_0x510fb3+'Message']['create'](_0x404483)[_0x770f('0x20')](function(_0x236b30){logger[_0x770f('0xc')](_0x770f('0x21'),_0x3b56ad,_0x404483[_0x770f('0x1c')]);if(_0x3dbe60[_0x770f('0x2d')]=='Failed'){_0x1162a7[_0x770f('0xe')]();}else{_0x1162a7[_0x770f('0x2e')]();}})[_0x770f('0x22')](function(_0x54aee2){logger[_0x770f('0x2a')](_0x770f('0x21'),_0x3b56ad,JSON[_0x770f('0x23')](_0x54aee2));_0x1162a7[_0x770f('0xe')]();});}else{_0x1162a7['next']();}});}}catch(_0x2c8147){logger['error'](_0x770f('0x21'),_0x3b56ad,JSON[_0x770f('0x23')](_0x2c8147));_0x1162a7['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 35a7b29..5288672 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 _0xc837=['channel','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','getMustacheRender','body','message','from','phone','read','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','inReplyTo','messageId','','replace','';_0x1beee6['headers']={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':'All','Precedence':'auto_reply'};return mailRpc[_0x7c83('0x34')](this['account'][_0x7c83('0x35')],_0x1beee6)[_0x7c83('0x36')](function(_0x3dd531){logger[_0x7c83('0x13')](_0x7c83('0x37'),_0x3f35c0);_0x1beee6['messageId']=_0x3dd531['message'][_0x7c83('0x2f')];return rpc[_0xdf70b1+_0x7c83('0x2d')]['create'](_0x1beee6);})[_0x7c83('0x36')](function(_0x155b42){logger['info']('[%s][AUTOREPLY]\x20%s',_0x3f35c0,JSON[_0x7c83('0x38')](_0x155b42));})[_0x7c83('0x39')](function(_0x5d8b93){logger[_0x7c83('0x3a')]('[RPC][%s][AUTOREPLY]\x20%s',_0x3f35c0,JSON['stringify'](_0x5d8b93));})['finally'](function(){Promise['resolve']()[_0x7c83('0x36')](function(){if(_0x1d8f9b[0x0]!=='2'||_0x181fee[_0x7c83('0x1b')])return;return rpc[_0xdf70b1+'Interaction'][_0x7c83('0x3b')](_0x181fee['id'],{'autoreplyExecuted':!![]})[_0x7c83('0x36')](function(_0x51042b){logger[_0x7c83('0x13')](_0x7c83('0x3c'),_0x3f35c0,JSON['stringify'](_0x51042b));})[_0x7c83('0x39')](function(_0x3f7eca){logger[_0x7c83('0x3a')](_0x7c83('0x3d'),_0x3f35c0,JSON[_0x7c83('0x38')](_0x3f7eca));});})[_0x7c83('0x36')](function(){_0xdc9b32['next']();});});}else{return rpc[this[_0x7c83('0x10')]+'Message']['create'](_0x1beee6)['then'](function(){logger[_0x7c83('0x13')](_0x7c83('0x14'),_0x3f35c0,_0x1beee6[_0x7c83('0x20')]);})['catch'](function(_0x532ff0){logger['error'](_0x7c83('0x14'),_0x3f35c0,JSON[_0x7c83('0x38')](_0x532ff0));})[_0x7c83('0x3e')](function(){Promise[_0x7c83('0x3f')]()[_0x7c83('0x36')](function(){if(_0x1d8f9b[0x0]!=='2'||_0x181fee['autoreplyExecuted'])return;return rpc[_0xdf70b1+_0x7c83('0x40')][_0x7c83('0x3b')](_0x181fee['id'],{'autoreplyExecuted':!![]})['then'](function(_0x58f9ce){logger[_0x7c83('0x13')](_0x7c83('0x3c'),_0x3f35c0,JSON['stringify'](_0x58f9ce));})[_0x7c83('0x39')](function(_0x43073f){logger[_0x7c83('0x3a')](_0x7c83('0x3d'),_0x3f35c0,JSON['stringify'](_0x43073f));});})[_0x7c83('0x36')](function(){_0xdc9b32['next']();});});}}}catch(_0x3df72d){logger[_0x7c83('0x3a')]('[%s][AUTOREPLY]\x20%s',_0x3f35c0,JSON['stringify'](_0x3df72d));_0xdc9b32[_0x7c83('0x41')]();}};}; \ No newline at end of file +var _0x8c02=['../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','info','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','out','channel','getMustacheRender','message','from','phone','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','html','','','headers','auto_reply','sendMailMessage','account','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','autoreplyExecuted','update','stop','lodash','./utils','routing'];(function(_0x1f68dd,_0x40414e){var _0x5b72c9=function(_0x57ed35){while(--_0x57ed35){_0x1f68dd['push'](_0x1f68dd['shift']());}};_0x5b72c9(++_0x40414e);}(_0x8c02,0xc9));var _0x28c0=function(_0x182526,_0x1f35fc){_0x182526=_0x182526-0x0;var _0x4ee6cb=_0x8c02[_0x182526];return _0x4ee6cb;};'use strict';var _=require(_0x28c0('0x0'));var moment=require('moment');var utils=require(_0x28c0('0x1'));var logger=require('../../../../config/logger')(_0x28c0('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x28c0('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x28c0('0x4')),'faxMessage':require(_0x28c0('0x5')),'whatsappMessage':require(_0x28c0('0x6')),'chatInteraction':require(_0x28c0('0x7')),'openchannelInteraction':require(_0x28c0('0x8')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x28c0('0x9')),'faxInteraction':require(_0x28c0('0xa')),'whatsappInteraction':require(_0x28c0('0xb'))};var mailRpc=require('../../mailRpc');exports[_0x28c0('0xc')]=function(_0x2f47da,_0x16a123,_0xe5a316,_0x19e997){return function(_0x3552fe){try{var _0x46a53f=this['channel'];if(_0x46a53f===_0x28c0('0xd')&&_0x19e997[_0x28c0('0xe')][_0x28c0('0xf')]){logger['info'](_0x28c0('0x10'),_0x2f47da,_0x28c0('0x11'));return _0x3552fe[_0x28c0('0x12')]();}if(_0x16a123[0x0]==='1'&&(_[_0x28c0('0x13')](this[_0x28c0('0x14')]['created'])||!this[_0x28c0('0x14')][_0x28c0('0x15')])){logger[_0x28c0('0x16')](_0x28c0('0x10'),_0x2f47da,_0x28c0('0x17'));return _0x3552fe[_0x28c0('0x12')]();}if(_0x16a123[0x0]==='2'&&this[_0x28c0('0x14')]['autoreplyExecuted']){logger[_0x28c0('0x16')](_0x28c0('0x18'),_0x2f47da,'One\x20Time\x20already\x20sent');return _0x3552fe[_0x28c0('0x12')]();}var _0x159892={'ContactId':this[_0x28c0('0x19')]['id'],'sentAt':moment()[_0x28c0('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x28c0('0x1b')};if(this[_0x28c0('0x1c')]===_0x28c0('0xd')){_0x159892[_0x28c0('0xe')]=utils['getMustacheRender'](_0x16a123[0x2],this);}else{_0x159892[_0x28c0('0xe')]=utils[_0x28c0('0x1d')](_0x16a123[0x1],this);}if(this[_0x28c0('0x1e')]){_0x159892['to']=this[_0x28c0('0x1e')]['from']||'';if(this[_0x28c0('0x1c')]===_0x28c0('0xd')&&_0x16a123[0x1]==='1'){_0x159892['cc']=this[_0x28c0('0x1e')]['cc']||'';}_0x159892[_0x28c0('0x1f')]=this['message']['to']||'';_0x159892['phone']=this[_0x28c0('0x1e')][_0x28c0('0x20')]||'';_0x159892['read']=!![];if(this[_0x28c0('0x1e')][_0x28c0('0x21')]){_0x159892[_0x28c0('0x21')]='';_0x159892[_0x28c0('0x21')]+=_[_0x28c0('0x22')](this['message'][_0x28c0('0x21')],_0x28c0('0x23'))?'':_0x28c0('0x24');_0x159892['subject']+=this[_0x28c0('0x1e')][_0x28c0('0x21')];}}if(this[_0x28c0('0x1c')]===_0x28c0('0x25')){_0x159892[_0x28c0('0x26')]=this['account']['id'];}else{_0x159892[_[_0x28c0('0x27')](this[_0x28c0('0x1c')])+_0x28c0('0x28')]=this['account']['id'];}_0x159892[_[_0x28c0('0x27')](this[_0x28c0('0x1c')])+_0x28c0('0x29')]=this['interaction']['id'];var _0x355c36=this[_0x28c0('0x14')];if(rpc[this[_0x28c0('0x1c')]+_0x28c0('0x2a')]){if(this['channel']===_0x28c0('0xd')){_0x159892[_0x28c0('0x2b')]=this[_0x28c0('0x1e')][_0x28c0('0x2c')];_0x159892[_0x28c0('0x2d')]=_0x28c0('0x2e')+_['replace'](_0x159892[_0x28c0('0xe')],']+(>|$)/g,''),'priorityTrue':_0x349048[0x1],'priorityFalse':_0x349048[0x2]};var _0x31199e=gotoif['validate'](_0x42ed84,{'typecast':!![]});if(_0x31199e[_0xcb09('0xe')]){logger['error'](_0xcb09('0xf'),_0x573aa0,_['map'](_0x31199e,'message')[_0xcb09('0x10')](',\x20'));_0xda51a3[_0xcb09('0x11')]();}else{try{var _0x1a195c=eval('('+_0x42ed84[_0xcb09('0x12')]+')');var _0x266f09=_0x1a195c?_0x42ed84[_0xcb09('0x13')]:_0x42ed84[_0xcb09('0x14')];logger[_0xcb09('0x15')](_0xcb09('0x16'),_0x573aa0,_0x42ed84[_0xcb09('0x12')],_0x1a195c,_0x266f09||'next');if(_0x266f09){var _0x22a3c6=_['findIndex'](_0xda51a3[_0xcb09('0x17')](),{'p':_0x266f09});if(_0x22a3c6>=0x0){logger[_0xcb09('0x15')](_0xcb09('0x18'),_0x573aa0,_0x266f09||_0xcb09('0x19'),_0x22a3c6);_0xda51a3[_0xcb09('0x19')](_0x22a3c6);}else{logger[_0xcb09('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x573aa0,_0x266f09||_0xcb09('0x19'));_0xda51a3[_0xcb09('0x11')]();}}else{_0xda51a3[_0xcb09('0x19')]();}}catch(_0x32373a){logger[_0xcb09('0x1a')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x573aa0,_0x32373a['message']);_0xda51a3['stop']();}}}catch(_0x20c233){logger[_0xcb09('0x1a')](_0xcb09('0xf'),_0x573aa0,JSON[_0xcb09('0x1b')](_0x20c233));_0xda51a3[_0xcb09('0x11')]();}};}; \ No newline at end of file +var _0x5793=['priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','lodash','html-to-text','./utils','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','error','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityTrue'];(function(_0x312d2f,_0x4ba8b1){var _0x48204d=function(_0x2fe228){while(--_0x2fe228){_0x312d2f['push'](_0x312d2f['shift']());}};_0x48204d(++_0x4ba8b1);}(_0x5793,0x15f));var _0x3579=function(_0x3050a9,_0x2352a8){_0x3050a9=_0x3050a9-0x0;var _0x38abaa=_0x5793[_0x3050a9];return _0x38abaa;};'use strict';var schema=require('validate');var _=require(_0x3579('0x0'));var htmlToText=require(_0x3579('0x1'));var utils=require(_0x3579('0x2'));var logger=require(_0x3579('0x3'))(_0x3579('0x4'));var gotoif=schema({'condition':{'type':_0x3579('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x3579('0x6'),'message':_0x3579('0x7')},'priorityFalse':{'type':'number','message':_0x3579('0x8')}});exports[_0x3579('0x9')]=function(_0xaebc82,_0x36a4d6){return function(_0x4c8fa2){try{var _0x145292={'condition':htmlToText[_0x3579('0xa')](utils[_0x3579('0xb')](_0x36a4d6[0x0],this),{'wordwrap':![]})[_0x3579('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x36a4d6[0x1],'priorityFalse':_0x36a4d6[0x2]};var _0x55e8bc=gotoif[_0x3579('0xd')](_0x145292,{'typecast':!![]});if(_0x55e8bc['length']){logger[_0x3579('0xe')](_0x3579('0xf'),_0xaebc82,_[_0x3579('0x10')](_0x55e8bc,_0x3579('0x11'))[_0x3579('0x12')](',\x20'));_0x4c8fa2['stop']();}else{try{var _0x1d2e7f=eval('('+_0x145292[_0x3579('0x13')]+')');var _0x5507a7=_0x1d2e7f?_0x145292[_0x3579('0x14')]:_0x145292[_0x3579('0x15')];logger[_0x3579('0x16')](_0x3579('0x17'),_0xaebc82,_0x145292[_0x3579('0x13')],_0x1d2e7f,_0x5507a7||_0x3579('0x18'));if(_0x5507a7){var _0x26c9e0=_['findIndex'](_0x4c8fa2[_0x3579('0x19')](),{'p':_0x5507a7});if(_0x26c9e0>=0x0){logger[_0x3579('0x16')](_0x3579('0x1a'),_0xaebc82,_0x5507a7||'next',_0x26c9e0);_0x4c8fa2[_0x3579('0x18')](_0x26c9e0);}else{logger['info'](_0x3579('0x1b'),_0xaebc82,_0x5507a7||_0x3579('0x18'));_0x4c8fa2[_0x3579('0x1c')]();}}else{_0x4c8fa2['next']();}}catch(_0x442a27){logger[_0x3579('0xe')](_0x3579('0x1d'),_0xaebc82,_0x442a27[_0x3579('0x11')]);_0x4c8fa2[_0x3579('0x1c')]();}}}catch(_0x26a8e2){logger['error'](_0x3579('0xf'),_0xaebc82,JSON[_0x3579('0x1e')](_0x26a8e2));_0x4c8fa2[_0x3579('0x1c')]();}};}; \ 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 9c54c06..f730345 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 _0x78c1=['validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','message','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop'];(function(_0x46e523,_0xe6fccb){var _0x5da0ee=function(_0x396682){while(--_0x396682){_0x46e523['push'](_0x46e523['shift']());}};_0x5da0ee(++_0xe6fccb);}(_0x78c1,0x143));var _0x178c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x78c1[_0x21a9d9];return _0x46adce;};'use strict';var schema=require(_0x178c('0x0'));var _=require(_0x178c('0x1'));var logger=require(_0x178c('0x2'))(_0x178c('0x3'));var gotop=schema({'priority':{'type':_0x178c('0x4'),'required':!![],'message':_0x178c('0x5')}});exports[_0x178c('0x6')]=function(_0x5d36e7,_0x3e017d){return function(_0x437f9d){try{var _0xb932e9={'priority':_0x3e017d[0x0]};var _0x804d8d=gotop['validate'](_0xb932e9,{'typecast':!![]});if(_0x804d8d[_0x178c('0x7')]){logger[_0x178c('0x8')](_0x178c('0x9'),_0x5d36e7,_['map'](_0x804d8d,_0x178c('0xa'))['join'](',\x20'));_0x437f9d['stop']();}else{logger[_0x178c('0xb')](_0x178c('0xc'),_0x5d36e7,_0xb932e9[_0x178c('0xd')]);if(_0xb932e9['priority']){var _0xaa3615=_[_0x178c('0xe')](_0x437f9d[_0x178c('0xf')](),{'p':_0xb932e9[_0x178c('0xd')]});if(_0xaa3615>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x5d36e7,_0xb932e9[_0x178c('0xd')]||_0x178c('0x10'),_0xaa3615);_0x437f9d[_0x178c('0x10')](_0xaa3615);}else{logger[_0x178c('0xb')](_0x178c('0x11'),_0x5d36e7,_0xb932e9[_0x178c('0xd')]||_0x178c('0x10'));_0x437f9d[_0x178c('0x12')]();}}else{_0x437f9d[_0x178c('0x10')]();}}}catch(_0x1bfa36){logger[_0x178c('0x8')]('[%s][GOTOP]\x20%s',_0x5d36e7,JSON['stringify'](_0x1bfa36));_0x437f9d[_0x178c('0x12')]();}};}; \ No newline at end of file +var _0x16ec=['next','stop','stringify','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][GOTOP]\x20%s','message','info','[%s][GOTOP]\x20priority\x20%s','findIndex','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x1a7382,_0x192eda){var _0x184d19=function(_0x3f73fc){while(--_0x3f73fc){_0x1a7382['push'](_0x1a7382['shift']());}};_0x184d19(++_0x192eda);}(_0x16ec,0xc9));var _0xc16e=function(_0x3bf865,_0x163c5a){_0x3bf865=_0x3bf865-0x0;var _0x2e35e9=_0x16ec[_0x3bf865];return _0x2e35e9;};'use strict';var schema=require('validate');var _=require(_0xc16e('0x0'));var logger=require(_0xc16e('0x1'))('routing');var gotop=schema({'priority':{'type':_0xc16e('0x2'),'required':!![],'message':_0xc16e('0x3')}});exports[_0xc16e('0x4')]=function(_0x23889d,_0x1f7113){return function(_0x470716){try{var _0x40c6a8={'priority':_0x1f7113[0x0]};var _0x1cc197=gotop[_0xc16e('0x5')](_0x40c6a8,{'typecast':!![]});if(_0x1cc197[_0xc16e('0x6')]){logger[_0xc16e('0x7')](_0xc16e('0x8'),_0x23889d,_['map'](_0x1cc197,_0xc16e('0x9'))['join'](',\x20'));_0x470716['stop']();}else{logger[_0xc16e('0xa')](_0xc16e('0xb'),_0x23889d,_0x40c6a8['priority']);if(_0x40c6a8['priority']){var _0x2ecd3b=_[_0xc16e('0xc')](_0x470716['rules'](),{'p':_0x40c6a8[_0xc16e('0xd')]});if(_0x2ecd3b>=0x0){logger['info'](_0xc16e('0xe'),_0x23889d,_0x40c6a8['priority']||'next',_0x2ecd3b);_0x470716[_0xc16e('0xf')](_0x2ecd3b);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x23889d,_0x40c6a8[_0xc16e('0xd')]||_0xc16e('0xf'));_0x470716[_0xc16e('0x10')]();}}else{_0x470716['next']();}}}catch(_0x384bc7){logger[_0xc16e('0x7')](_0xc16e('0x8'),_0x23889d,JSON[_0xc16e('0x11')](_0x384bc7));_0x470716[_0xc16e('0x10')]();}};}; \ 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 9454b2e..027ac77 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 _0x7f91=['error','stringify','stop','lodash','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','ChatWebsiteId','account','upperFirst','AccountId','channel','InteractionId','interaction','then','[%s][MESSAGE]\x20%s','body','next','catch'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x7f91,0x93));var _0x17f9=function(_0x263f81,_0x490cad){_0x263f81=_0x263f81-0x0;var _0xf2563=_0x7f91[_0x263f81];return _0xf2563;};'use strict';var _=require(_0x17f9('0x0'));var utils=require('./utils');var logger=require(_0x17f9('0x1'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x17f9('0x2')),'mailMessage':require(_0x17f9('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x17f9('0x4')),'whatsappMessage':require(_0x17f9('0x5'))};exports[_0x17f9('0x6')]=function(_0xb7c910,_0x1021ce){return function(_0x4ba671){try{var _0x5d0eb1={'body':utils[_0x17f9('0x7')](_0x1021ce[0x0],this),'ContactId':this[_0x17f9('0x8')]['id']};if(this['channel']==='chat'){_0x5d0eb1[_0x17f9('0x9')]=this[_0x17f9('0xa')]['id'];}else{_0x5d0eb1[_[_0x17f9('0xb')](this['channel'])+_0x17f9('0xc')]=this[_0x17f9('0xa')]['id'];}_0x5d0eb1[_[_0x17f9('0xb')](this[_0x17f9('0xd')])+_0x17f9('0xe')]=this[_0x17f9('0xf')]['id'];if(rpc[this[_0x17f9('0xd')]+'Message']){return rpc[this['channel']+'Message']['create'](_0x5d0eb1)[_0x17f9('0x10')](function(_0x2db3e9){logger['info'](_0x17f9('0x11'),_0xb7c910,_0x5d0eb1[_0x17f9('0x12')]);_0x4ba671[_0x17f9('0x13')]();})[_0x17f9('0x14')](function(_0x6c9ff8){logger[_0x17f9('0x15')](_0x17f9('0x11'),_0xb7c910,JSON[_0x17f9('0x16')](_0x6c9ff8));_0x4ba671[_0x17f9('0x17')]();});}}catch(_0x2f2033){logger[_0x17f9('0x15')](_0x17f9('0x11'),_0xb7c910,JSON[_0x17f9('0x16')](_0x2f2033));_0x4ba671[_0x17f9('0x17')]();}};}; \ No newline at end of file +var _0xb6b8=['channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','info','next','error','[%s][MESSAGE]\x20%s','stringify','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact'];(function(_0x4b679e,_0x1f1abc){var _0x1221c5=function(_0x2aca19){while(--_0x2aca19){_0x4b679e['push'](_0x4b679e['shift']());}};_0x1221c5(++_0x1f1abc);}(_0xb6b8,0xc5));var _0x8b6b=function(_0x23aa37,_0xce7f30){_0x23aa37=_0x23aa37-0x0;var _0x27c058=_0xb6b8[_0x23aa37];return _0x27c058;};'use strict';var _=require('lodash');var utils=require(_0x8b6b('0x0'));var logger=require(_0x8b6b('0x1'))(_0x8b6b('0x2'));var rpc={'chatMessage':require(_0x8b6b('0x3')),'openchannelMessage':require(_0x8b6b('0x4')),'mailMessage':require(_0x8b6b('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x8b6b('0x6')),'whatsappMessage':require(_0x8b6b('0x7'))};exports[_0x8b6b('0x8')]=function(_0x5db098,_0x144451){return function(_0x511688){try{var _0x56da2a={'body':utils[_0x8b6b('0x9')](_0x144451[0x0],this),'ContactId':this[_0x8b6b('0xa')]['id']};if(this[_0x8b6b('0xb')]===_0x8b6b('0xc')){_0x56da2a[_0x8b6b('0xd')]=this[_0x8b6b('0xe')]['id'];}else{_0x56da2a[_[_0x8b6b('0xf')](this[_0x8b6b('0xb')])+'AccountId']=this['account']['id'];}_0x56da2a[_['upperFirst'](this[_0x8b6b('0xb')])+_0x8b6b('0x10')]=this[_0x8b6b('0x11')]['id'];if(rpc[this['channel']+_0x8b6b('0x12')]){return rpc[this[_0x8b6b('0xb')]+'Message'][_0x8b6b('0x13')](_0x56da2a)['then'](function(_0x2674e3){logger[_0x8b6b('0x14')]('[%s][MESSAGE]\x20%s',_0x5db098,_0x56da2a['body']);_0x511688[_0x8b6b('0x15')]();})['catch'](function(_0x352c14){logger[_0x8b6b('0x16')](_0x8b6b('0x17'),_0x5db098,JSON[_0x8b6b('0x18')](_0x352c14));_0x511688[_0x8b6b('0x19')]();});}}catch(_0x532da5){logger[_0x8b6b('0x16')](_0x8b6b('0x17'),_0x5db098,JSON[_0x8b6b('0x18')](_0x532da5));_0x511688[_0x8b6b('0x19')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index cadeeb7..ca20691 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 _0x4033=['[%s][NOOP]\x20%s','getMustacheRender','stringify','./utils','../../../../config/logger','routing','consequence','info'];(function(_0x522f91,_0x34f48a){var _0x167152=function(_0x338ae){while(--_0x338ae){_0x522f91['push'](_0x522f91['shift']());}};_0x167152(++_0x34f48a);}(_0x4033,0x1bb));var _0x3403=function(_0x3055ab,_0x4d1f74){_0x3055ab=_0x3055ab-0x0;var _0x31d336=_0x4033[_0x3055ab];return _0x31d336;};'use strict';var utils=require(_0x3403('0x0'));var logger=require(_0x3403('0x1'))(_0x3403('0x2'));exports[_0x3403('0x3')]=function(_0x4c2345,_0x2dce2d){return function(_0x2d1853){try{logger[_0x3403('0x4')](_0x3403('0x5'),_0x4c2345,utils[_0x3403('0x6')](_0x2dce2d[0x0],this));_0x2d1853['next']();}catch(_0x32a4a7){logger['error'](_0x3403('0x5'),_0x4c2345,JSON[_0x3403('0x7')](_0x32a4a7));_0x2d1853['stop']();}};}; \ No newline at end of file +var _0x83ff=['getMustacheRender','next','error','stringify','stop','../../../../config/logger','routing','consequence','[%s][NOOP]\x20%s'];(function(_0x3d9b4d,_0x581243){var _0x2b579c=function(_0x271a7a){while(--_0x271a7a){_0x3d9b4d['push'](_0x3d9b4d['shift']());}};_0x2b579c(++_0x581243);}(_0x83ff,0x17f));var _0xf83f=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x83ff[_0x5d80de];return _0x1c7556;};'use strict';var utils=require('./utils');var logger=require(_0xf83f('0x0'))(_0xf83f('0x1'));exports[_0xf83f('0x2')]=function(_0x19edff,_0x143ca6){return function(_0x86ad00){try{logger['info'](_0xf83f('0x3'),_0x19edff,utils[_0xf83f('0x4')](_0x143ca6[0x0],this));_0x86ad00[_0xf83f('0x5')]();}catch(_0x490235){logger[_0xf83f('0x6')](_0xf83f('0x3'),_0x19edff,JSON[_0xf83f('0x7')](_0x490235));_0x86ad00[_0xf83f('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 755a332..0639159 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 _0x8652=['name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','body','update','timeout','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','createQueue','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','routing','redis','defaults','localhost','queue_id','account','queue','from','emit','clone','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','remove','pick','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]'];(function(_0x353a22,_0x313952){var _0x10ae9a=function(_0x5aa10a){while(--_0x5aa10a){_0x353a22['push'](_0x353a22['shift']());}};_0x10ae9a(++_0x313952);}(_0x8652,0xc0));var _0x2865=function(_0x3ee5df,_0x583073){_0x3ee5df=_0x3ee5df-0x0;var _0x446d24=_0x8652[_0x3ee5df];return _0x446d24;};'use strict';var schema=require(_0x2865('0x0'));var _=require(_0x2865('0x1'));var util=require(_0x2865('0x2'));var seqqueue=require(_0x2865('0x3'));var moment=require(_0x2865('0x4'));var Redis=require(_0x2865('0x5'));var config=require(_0x2865('0x6'));var logger=require('../../../../config/logger')(_0x2865('0x7'));var strategy=require('./strategy');config[_0x2865('0x8')]=_[_0x2865('0x9')](config[_0x2865('0x8')],{'host':_0x2865('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id',_0x2865('0xb'),_0x2865('0xc'),_0x2865('0xd'),_0x2865('0xe'),'joinAt'];function emit(_0x3366af,_0x110e1b,_0x2eeb63){io['to'](_0x3366af)[_0x2865('0xf')](_0x110e1b,_0x2eeb63);}function emitChannelQueueInteraction(_0x295e90,_0x53e9ae,_0x403eb0,_0x39cfb3,_0x36bcf0,_0x451b8b,_0x23f57e,_0x3ee42d){var _0x7b9a92=_[_0x2865('0x10')](_0x403eb0);_0x7b9a92['queue_id']=_0x3ee42d;_0x7b9a92[_0x2865('0xd')]=_0x53e9ae;_0x7b9a92[_0x2865('0xc')]=_0x39cfb3;_0x7b9a92['id']=_0x36bcf0;if(_0x451b8b){attributes[_0x2865('0x11')](_[_0x2865('0x12')](_0x295e90)+_0x2865('0x13'));_0x23f57e[util[_0x2865('0x14')](_0x2865('0x15'),_0x295e90)][_0x36bcf0]=_['pick'](_0x7b9a92,attributes);}else{delete _0x23f57e[util[_0x2865('0x14')](_0x2865('0x15'),_0x295e90)][_0x36bcf0];}emit(util['format']('%s:queue:%s',_0x295e90,_0x53e9ae),util['format']('%s_queue_waiting_interaction:%s',_0x295e90,_0x451b8b?'save':_0x2865('0x16')),_[_0x2865('0x17')](_0x7b9a92,attributes));}var rpc={'openchannelQueueReport':require(_0x2865('0x18')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x2865('0x19')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x2865('0x1a')),'whatsappQueueReport':require(_0x2865('0x1b'))};var queue=schema({'name':{'type':_0x2865('0x1c'),'required':!![],'message':_0x2865('0x1d')},'timeout':{'type':_0x2865('0x1e'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x25f25b,_0x47545d,_0x25e52c,_0x341c13){if(_0x25f25b&&_0x47545d&&_0x25e52c){_0x47545d[_0x2865('0x1f')]+=0x1;var _0xdf7741={'uniqueid':_0x25f25b,'from':_0x25e52c['body']?_0x25e52c['body'][_0x2865('0xe')]:'','joinAt':moment()[_0x2865('0x14')](_0x2865('0x20')),'ContactId':_0x25e52c[_0x2865('0x21')]?_0x25e52c[_0x2865('0x21')]['id']:null,'ListId':_0x25e52c['list']?_0x25e52c[_0x2865('0x22')]['id']:null};_0xdf7741[_[_0x2865('0x23')](_0x25e52c[_0x2865('0x24')])+_0x2865('0x25')]=_0x47545d['id']||null;_0xdf7741[_[_0x2865('0x23')](_0x25e52c[_0x2865('0x24')])+_0x2865('0x13')]=_0x25e52c['interaction']?_0x25e52c[_0x2865('0x26')]['id']:null;_0xdf7741[_['upperFirst'](_0x25e52c['channel'])+_0x2865('0x27')]=_0x25e52c['message']?_0x25e52c[_0x2865('0x28')]['id']:null;_0xdf7741[_[_0x2865('0x23')](_0x25e52c[_0x2865('0x24')])+(_0x25e52c['channel']!=='chat'?_0x2865('0x29'):_0x2865('0x2a'))]=_0x25e52c[_0x2865('0xc')]?_0x25e52c['account']['id']:null;logger[_0x2865('0x2b')](util[_0x2865('0x14')](_0x2865('0x2c'),_0x25f25b,_0x47545d[_0x2865('0x2d')]));emitChannelQueueInteraction(_0x25e52c['channel'],_0x47545d[_0x2865('0x2d')],_0xdf7741,_0x25e52c[_0x2865('0xc')][_0x2865('0x2d')],_0x25e52c[_0x2865('0x28')]['id'],!![],_0x341c13,_0x47545d['id']);if(rpc[_0x25e52c[_0x2865('0x24')]+_0x2865('0x2e')]){return rpc[_0x25e52c[_0x2865('0x24')]+'QueueReport'][_0x2865('0x2f')](_0xdf7741)[_0x2865('0x30')](function(_0x203d68){logger[_0x2865('0x31')](_0x2865('0x32'));});}}}function stopRouting(_0x1c244d,_0x5a1e8a,_0x4a3f3a,_0x59b768){if(_0x1c244d&&_0x5a1e8a){_0x5a1e8a[_0x2865('0x1f')]-=0x1;var _0x219266={'leaveAt':moment()[_0x2865('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x2865('0x14')](_0x2865('0x20')),'reason':_0x2865('0x33')};logger[_0x2865('0x2b')](util['format'](_0x2865('0x34'),_0x1c244d,_0x5a1e8a['name']));emitChannelQueueInteraction(_0x4a3f3a['channel'],_0x5a1e8a[_0x2865('0x2d')],_0x4a3f3a[_0x2865('0x35')],_0x4a3f3a[_0x2865('0xc')][_0x2865('0x2d')],_0x4a3f3a[_0x2865('0x28')]['id'],![],_0x59b768,_0x5a1e8a['id']);if(rpc[_0x4a3f3a[_0x2865('0x24')]+_0x2865('0x2e')]){return rpc[_0x4a3f3a[_0x2865('0x24')]+'QueueReport'][_0x2865('0x36')](_0x1c244d,_0x219266)[_0x2865('0x30')](function(_0x5b478a){logger[_0x2865('0x31')]('update\x20queue\x20report');});}}}function endRouting(_0x437e3a,_0x20e536,_0x1f3858,_0x4e2617){if(_0x437e3a&&_0x20e536){_0x20e536[_0x2865('0x1f')]-=0x1;var _0x2a10e8={'leaveAt':moment()['format'](_0x2865('0x20')),'exitAt':moment()[_0x2865('0x14')](_0x2865('0x20')),'reason':_0x2865('0x37')};logger['info'](util[_0x2865('0x14')]('[%s][END:QUEUE][NAME:%s]',_0x437e3a,_0x20e536[_0x2865('0x2d')]));emitChannelQueueInteraction(_0x1f3858[_0x2865('0x24')],_0x20e536[_0x2865('0x2d')],_0x1f3858['body'],_0x1f3858[_0x2865('0xc')][_0x2865('0x2d')],_0x1f3858['message']['id'],![],_0x4e2617);if(rpc[_0x1f3858[_0x2865('0x24')]+_0x2865('0x2e')]){return rpc[_0x1f3858[_0x2865('0x24')]+_0x2865('0x2e')][_0x2865('0x36')](_0x437e3a,_0x2a10e8)['catch'](function(_0x40ecf1){logger['error'](_0x2865('0x38'));});}}}function handleFindQueue(_0x33a0ee){return function(_0xd7c75){return _0xd7c75['name']['toLowerCase']()===_0x33a0ee[_0x2865('0x39')]();};}exports[_0x2865('0x3a')]=function(_0x490a19,_0x24699f,_0x1291f8,_0x32b20d){return function(_0x5ea019){try{var _0x1066d6={'name':_0x24699f[0x0],'timeout':_0x24699f[0x1]};var _0x458547=queue[_0x2865('0x0')](_0x1066d6,{'typecast':!![]});if(_0x458547[_0x2865('0x3b')]){logger[_0x2865('0x31')](_0x2865('0x3c'),_0x490a19,_[_0x2865('0x3d')](_0x458547,'message')[_0x2865('0x3e')](',\x20'));_0x5ea019[_0x2865('0x3f')]();}else{var _0x475165=_[_0x2865('0x40')](_0x1291f8[_0x32b20d['channel']+'Queues'],handleFindQueue(_0x1066d6[_0x2865('0x2d')]));if(_0x475165){startRouting(_0x490a19,_0x475165,_0x32b20d,_0x1291f8);var _0x42cd7a=(_0x475165[_0x2865('0x37')]||0xa)*0x3e8;var _0x3f281b=(_0x1066d6[_0x2865('0x37')]||0x14)*0x3e8;var _0x1de361;if(_0x42cd7a>_0x3f281b){_0x3f281b=_0x42cd7a;}var _0x327c24=seqqueue[_0x2865('0x41')](_0x42cd7a);_0x327c24['id']=_0x490a19;_0x327c24['atimeout']=_0x42cd7a;_0x327c24[_0x2865('0x42')]=_0x3f281b;_0x327c24[_0x2865('0x24')]=_0x32b20d[_0x2865('0x24')];_0x1291f8[_0x2865('0x43')][_0x490a19]['on']('end',function(){logger['info'](_0x2865('0x44'),_0x490a19);stopRouting(_0x490a19,_0x475165,_0x32b20d,_0x1291f8);clearTimeout(_0x1de361);_0x1de361=undefined;_0x327c24[_0x2865('0x45')](!![]);if(_0x1291f8[_0x2865('0x43')][_0x490a19]){delete _0x1291f8[_0x2865('0x43')][_0x490a19];}_0x5ea019[_0x2865('0x3f')]();});_0x1291f8['rules'][_0x490a19]['on'](_0x2865('0x46'),function(){if(_0x1291f8[_0x2865('0x43')][_0x490a19]){delete _0x1291f8['rules'][_0x490a19];}});_0x1de361=setTimeout(function(){logger['info'](_0x2865('0x47'),_0x490a19);endRouting(_0x490a19,_0x475165,_0x32b20d,_0x1291f8);clearTimeout(_0x1de361);_0x327c24['close'](!![]);_0x5ea019[_0x2865('0x48')]();},_0x3f281b);switch(_0x475165[_0x2865('0x49')]){case _0x2865('0x4a'):strategy[_0x2865('0x4a')](_0x327c24,_0x475165,_0x1291f8,_0x32b20d);break;default:strategy[_0x2865('0x4b')](_0x327c24,_0x475165,_0x1291f8,_0x32b20d);}}else{logger['error'](_0x2865('0x4c'),_0x490a19,_0x1066d6[_0x2865('0x2d')]);_0x5ea019[_0x2865('0x3f')]();}}}catch(_0x93831d){console[_0x2865('0x4d')](_0x93831d);logger[_0x2865('0x31')](_0x2865('0x3c'),_0x490a19,_0x93831d[_0x2865('0x4e')]);_0x5ea019[_0x2865('0x3f')]();}};}; \ No newline at end of file +var _0xf822=['contact','list','upperFirst','interaction','MessageId','message','channel','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','error','create\x20queue\x20report','accepted','update','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','Queues','createQueue','atimeout','end','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','seq-queue','moment','ioredis','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','queue_id','account','queue','from','emit','InteractionId','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x39c0aa,_0x40fecc){var _0x420864=function(_0x2dacc4){while(--_0x2dacc4){_0x39c0aa['push'](_0x39c0aa['shift']());}};_0x420864(++_0x40fecc);}(_0xf822,0xc3));var _0x2f82=function(_0x2f50b9,_0x31a19e){_0x2f50b9=_0x2f50b9-0x0;var _0xac1a3c=_0xf822[_0x2f50b9];return _0xac1a3c;};'use strict';var schema=require(_0x2f82('0x0'));var _=require(_0x2f82('0x1'));var util=require('util');var seqqueue=require(_0x2f82('0x2'));var moment=require(_0x2f82('0x3'));var Redis=require(_0x2f82('0x4'));var config=require(_0x2f82('0x5'));var logger=require('../../../../config/logger')('routing');var strategy=require('./strategy');config['redis']=_[_0x2f82('0x6')](config[_0x2f82('0x7')],{'host':_0x2f82('0x8'),'port':0x18eb});var io=require(_0x2f82('0x9'))(new Redis(config[_0x2f82('0x7')]));var attributes=['id',_0x2f82('0xa'),_0x2f82('0xb'),_0x2f82('0xc'),_0x2f82('0xd'),'joinAt'];function emit(_0x29d74a,_0x3bfd35,_0xaf6727){io['to'](_0x29d74a)[_0x2f82('0xe')](_0x3bfd35,_0xaf6727);}function emitChannelQueueInteraction(_0xd9941,_0x34c4b9,_0x7ad799,_0x20927f,_0x38759f,_0x4a459d,_0x8e9263,_0x22e24c){var _0x5f3116=_['clone'](_0x7ad799);_0x5f3116[_0x2f82('0xa')]=_0x22e24c;_0x5f3116[_0x2f82('0xc')]=_0x34c4b9;_0x5f3116[_0x2f82('0xb')]=_0x20927f;_0x5f3116['id']=_0x38759f;if(_0x4a459d){attributes['push'](_['capitalize'](_0xd9941)+_0x2f82('0xf'));_0x8e9263[util[_0x2f82('0x10')](_0x2f82('0x11'),_0xd9941)][_0x38759f]=_['pick'](_0x5f3116,attributes);}else{delete _0x8e9263[util[_0x2f82('0x10')](_0x2f82('0x11'),_0xd9941)][_0x38759f];}emit(util[_0x2f82('0x10')](_0x2f82('0x12'),_0xd9941,_0x34c4b9),util[_0x2f82('0x10')](_0x2f82('0x13'),_0xd9941,_0x4a459d?_0x2f82('0x14'):_0x2f82('0x15')),_['pick'](_0x5f3116,attributes));}var rpc={'openchannelQueueReport':require(_0x2f82('0x16')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x2f82('0x17')),'smsQueueReport':require(_0x2f82('0x18')),'faxQueueReport':require(_0x2f82('0x19')),'whatsappQueueReport':require(_0x2f82('0x1a'))};var queue=schema({'name':{'type':_0x2f82('0x1b'),'required':!![],'message':_0x2f82('0x1c')},'timeout':{'type':_0x2f82('0x1d'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x15fae5,_0x50ceaa,_0x5a0975,_0x7e9815){if(_0x15fae5&&_0x50ceaa&&_0x5a0975){_0x50ceaa[_0x2f82('0x1e')]+=0x1;var _0x22ea06={'uniqueid':_0x15fae5,'from':_0x5a0975[_0x2f82('0x1f')]?_0x5a0975[_0x2f82('0x1f')][_0x2f82('0xd')]:'','joinAt':moment()[_0x2f82('0x10')](_0x2f82('0x20')),'ContactId':_0x5a0975['contact']?_0x5a0975[_0x2f82('0x21')]['id']:null,'ListId':_0x5a0975[_0x2f82('0x22')]?_0x5a0975[_0x2f82('0x22')]['id']:null};_0x22ea06[_[_0x2f82('0x23')](_0x5a0975['channel'])+'QueueId']=_0x50ceaa['id']||null;_0x22ea06[_[_0x2f82('0x23')](_0x5a0975['channel'])+_0x2f82('0xf')]=_0x5a0975[_0x2f82('0x24')]?_0x5a0975[_0x2f82('0x24')]['id']:null;_0x22ea06[_[_0x2f82('0x23')](_0x5a0975['channel'])+_0x2f82('0x25')]=_0x5a0975[_0x2f82('0x26')]?_0x5a0975[_0x2f82('0x26')]['id']:null;_0x22ea06[_['upperFirst'](_0x5a0975[_0x2f82('0x27')])+(_0x5a0975[_0x2f82('0x27')]!==_0x2f82('0x28')?_0x2f82('0x29'):_0x2f82('0x2a'))]=_0x5a0975['account']?_0x5a0975[_0x2f82('0xb')]['id']:null;logger[_0x2f82('0x2b')](util[_0x2f82('0x10')](_0x2f82('0x2c'),_0x15fae5,_0x50ceaa['name']));emitChannelQueueInteraction(_0x5a0975[_0x2f82('0x27')],_0x50ceaa[_0x2f82('0x2d')],_0x22ea06,_0x5a0975[_0x2f82('0xb')]['name'],_0x5a0975[_0x2f82('0x26')]['id'],!![],_0x7e9815,_0x50ceaa['id']);if(rpc[_0x5a0975[_0x2f82('0x27')]+_0x2f82('0x2e')]){return rpc[_0x5a0975[_0x2f82('0x27')]+_0x2f82('0x2e')]['create'](_0x22ea06)['catch'](function(_0x2d6a7a){logger[_0x2f82('0x2f')](_0x2f82('0x30'));});}}}function stopRouting(_0x370699,_0x2c10b2,_0x1d93d6,_0x4b9666){if(_0x370699&&_0x2c10b2){_0x2c10b2[_0x2f82('0x1e')]-=0x1;var _0x488d83={'leaveAt':moment()[_0x2f82('0x10')](_0x2f82('0x20')),'acceptAt':moment()[_0x2f82('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x2f82('0x31')};logger['info'](util[_0x2f82('0x10')]('[%s][STOP:QUEUE][NAME:%s]',_0x370699,_0x2c10b2[_0x2f82('0x2d')]));emitChannelQueueInteraction(_0x1d93d6[_0x2f82('0x27')],_0x2c10b2[_0x2f82('0x2d')],_0x1d93d6[_0x2f82('0x1f')],_0x1d93d6[_0x2f82('0xb')][_0x2f82('0x2d')],_0x1d93d6[_0x2f82('0x26')]['id'],![],_0x4b9666,_0x2c10b2['id']);if(rpc[_0x1d93d6[_0x2f82('0x27')]+_0x2f82('0x2e')]){return rpc[_0x1d93d6[_0x2f82('0x27')]+_0x2f82('0x2e')][_0x2f82('0x32')](_0x370699,_0x488d83)[_0x2f82('0x33')](function(_0x3c9dc9){logger[_0x2f82('0x2f')](_0x2f82('0x34'));});}}}function endRouting(_0x3e658b,_0x114b66,_0x341aac,_0xa941e8){if(_0x3e658b&&_0x114b66){_0x114b66[_0x2f82('0x1e')]-=0x1;var _0x1aef0f={'leaveAt':moment()[_0x2f82('0x10')](_0x2f82('0x20')),'exitAt':moment()[_0x2f82('0x10')](_0x2f82('0x20')),'reason':_0x2f82('0x35')};logger[_0x2f82('0x2b')](util['format'](_0x2f82('0x36'),_0x3e658b,_0x114b66[_0x2f82('0x2d')]));emitChannelQueueInteraction(_0x341aac[_0x2f82('0x27')],_0x114b66[_0x2f82('0x2d')],_0x341aac[_0x2f82('0x1f')],_0x341aac[_0x2f82('0xb')]['name'],_0x341aac[_0x2f82('0x26')]['id'],![],_0xa941e8);if(rpc[_0x341aac[_0x2f82('0x27')]+_0x2f82('0x2e')]){return rpc[_0x341aac[_0x2f82('0x27')]+'QueueReport'][_0x2f82('0x32')](_0x3e658b,_0x1aef0f)[_0x2f82('0x33')](function(_0x514960){logger[_0x2f82('0x2f')](_0x2f82('0x34'));});}}}function handleFindQueue(_0x413f4c){return function(_0x459cbd){return _0x459cbd[_0x2f82('0x2d')][_0x2f82('0x37')]()===_0x413f4c[_0x2f82('0x37')]();};}exports[_0x2f82('0x38')]=function(_0x5d1252,_0x2027cb,_0x211778,_0x2c83fc){return function(_0x545eaf){try{var _0x1a454c={'name':_0x2027cb[0x0],'timeout':_0x2027cb[0x1]};var _0x3ea9e4=queue[_0x2f82('0x0')](_0x1a454c,{'typecast':!![]});if(_0x3ea9e4[_0x2f82('0x39')]){logger[_0x2f82('0x2f')](_0x2f82('0x3a'),_0x5d1252,_[_0x2f82('0x3b')](_0x3ea9e4,'message')['join'](',\x20'));_0x545eaf[_0x2f82('0x3c')]();}else{var _0x40771b=_['find'](_0x211778[_0x2c83fc[_0x2f82('0x27')]+_0x2f82('0x3d')],handleFindQueue(_0x1a454c[_0x2f82('0x2d')]));if(_0x40771b){startRouting(_0x5d1252,_0x40771b,_0x2c83fc,_0x211778);var _0x41528d=(_0x40771b[_0x2f82('0x35')]||0xa)*0x3e8;var _0xed0c68=(_0x1a454c[_0x2f82('0x35')]||0x14)*0x3e8;var _0x37f675;if(_0x41528d>_0xed0c68){_0xed0c68=_0x41528d;}var _0x36b9d6=seqqueue[_0x2f82('0x3e')](_0x41528d);_0x36b9d6['id']=_0x5d1252;_0x36b9d6[_0x2f82('0x3f')]=_0x41528d;_0x36b9d6['qtimeout']=_0xed0c68;_0x36b9d6[_0x2f82('0x27')]=_0x2c83fc[_0x2f82('0x27')];_0x211778['rules'][_0x5d1252]['on'](_0x2f82('0x40'),function(){logger['info']('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x5d1252);stopRouting(_0x5d1252,_0x40771b,_0x2c83fc,_0x211778);clearTimeout(_0x37f675);_0x37f675=undefined;_0x36b9d6[_0x2f82('0x41')](!![]);if(_0x211778[_0x2f82('0x42')][_0x5d1252]){delete _0x211778[_0x2f82('0x42')][_0x5d1252];}_0x545eaf[_0x2f82('0x3c')]();});_0x211778[_0x2f82('0x42')][_0x5d1252]['on'](_0x2f82('0x43'),function(){if(_0x211778[_0x2f82('0x42')][_0x5d1252]){delete _0x211778[_0x2f82('0x42')][_0x5d1252];}});_0x37f675=setTimeout(function(){logger[_0x2f82('0x2b')](_0x2f82('0x44'),_0x5d1252);endRouting(_0x5d1252,_0x40771b,_0x2c83fc,_0x211778);clearTimeout(_0x37f675);_0x36b9d6[_0x2f82('0x41')](!![]);_0x545eaf[_0x2f82('0x45')]();},_0xed0c68);switch(_0x40771b[_0x2f82('0x46')]){case _0x2f82('0x47'):strategy[_0x2f82('0x47')](_0x36b9d6,_0x40771b,_0x211778,_0x2c83fc);break;default:strategy[_0x2f82('0x48')](_0x36b9d6,_0x40771b,_0x211778,_0x2c83fc);}}else{logger[_0x2f82('0x2f')](_0x2f82('0x49'),_0x5d1252,_0x1a454c['name']);_0x545eaf['stop']();}}}catch(_0x4de2c6){console[_0x2f82('0x4a')](_0x4de2c6);logger[_0x2f82('0x2f')](_0x2f82('0x3a'),_0x5d1252,_0x4de2c6[_0x2f82('0x4b')]);_0x545eaf[_0x2f82('0x3c')]();}};}; \ 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 b96107d..73d0fc1 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 _0x7fbe=['notificationId','squeue','agent','realtime','push','bind','handleTimeout','drained','handleDrained','prototype','handleRun','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','saveWaitingNotification','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','./util','../../../../../config/logger','routing'];(function(_0x218994,_0x2cf487){var _0x3f350b=function(_0x2e2065){while(--_0x2e2065){_0x218994['push'](_0x218994['shift']());}};_0x3f350b(++_0x2cf487);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2fb16e,_0x161667){_0x2fb16e=_0x2fb16e-0x0;var _0x5e0882=_0x7fbe[_0x2fb16e];return _0x5e0882;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0xe7fb('0x0'));var logger=require(_0xe7fb('0x1'))(_0xe7fb('0x2'));var Agent=function(_0x1703d5,_0x517d3a,_0x47625b,_0x11d2c4){this[_0xe7fb('0x3')]=uuid['v4']();this[_0xe7fb('0x4')]=_0x1703d5;this[_0xe7fb('0x5')]=_0x517d3a;this[_0xe7fb('0x6')]=_0x47625b;this[_0xe7fb('0x2')]=_0x11d2c4;this[_0xe7fb('0x4')][_0xe7fb('0x7')](this['handleRun'][_0xe7fb('0x8')](this),this[_0xe7fb('0x9')][_0xe7fb('0x8')](this));this[_0xe7fb('0x4')]['on']('timeout',this['handleTimeout'][_0xe7fb('0x8')](this));this[_0xe7fb('0x4')]['on'](_0xe7fb('0xa'),this[_0xe7fb('0xb')][_0xe7fb('0x8')](this));};Agent[_0xe7fb('0xc')][_0xe7fb('0x7')]=function(){this[_0xe7fb('0x4')][_0xe7fb('0x7')](this[_0xe7fb('0xd')][_0xe7fb('0x8')](this),this[_0xe7fb('0x9')][_0xe7fb('0x8')](this));};Agent[_0xe7fb('0xc')][_0xe7fb('0xb')]=function(){this['handleTimeout'](!![]);};Agent[_0xe7fb('0xc')][_0xe7fb('0xd')]=function(){logger['debug'](_0xe7fb('0xe'),this[_0xe7fb('0x4')]['id'],this['agent']['id']);if(_[_0xe7fb('0xf')](this['realtime'][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']])){logger[_0xe7fb('0x11')](_0xe7fb('0x12'),this['squeue']['id'],this[_0xe7fb('0x5')]['id']);setTimeout(this['push'][_0xe7fb('0x8')](this),0x3e8);}else{if(this['routing'][_0xe7fb('0x13')]||util[_0xe7fb('0x14')](this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x6')]['agents'][this[_0xe7fb('0x5')]['id']],this['squeue'][_0xe7fb('0x15')],![])){this['realtime'][_0xe7fb('0x10')][this['agent']['id']][_0xe7fb('0x16')]=!![];this[_0xe7fb('0x6')]['agents'][this[_0xe7fb('0x5')]['id']][_0xe7fb('0x17')]=undefined;util[_0xe7fb('0x18')](this['realtime'],this[_0xe7fb('0x2')],this[_0xe7fb('0x5')],this['squeue']['channel']);util['showNotification'](this[_0xe7fb('0x3')],this['squeue']['id'],this['realtime'][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']],null,this[_0xe7fb('0x2')]);util['writeLog'](this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x6')][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']],_0xe7fb('0x19')+(this[_0xe7fb('0x2')][_0xe7fb('0x13')]?':FORCED':''));}else{logger['debug'](_0xe7fb('0x1a'),this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x5')]['id']);setTimeout(this['push'][_0xe7fb('0x8')](this),0x3e8);}}};Agent[_0xe7fb('0xc')][_0xe7fb('0x9')]=function(_0x5f265f){if(_[_0xe7fb('0xf')](this[_0xe7fb('0x6')][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']])){return logger['debug'](_0xe7fb('0x12'),this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x5')]['id']);}else{logger['debug']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xe7fb('0x4')]['id'],this['agent']['id']);util[_0xe7fb('0x1b')](this[_0xe7fb('0x3')],this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x6')]['agents'][this[_0xe7fb('0x5')]['id']],null,this[_0xe7fb('0x2')]);this[_0xe7fb('0x6')][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']]['busy']=![];this[_0xe7fb('0x6')][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']][_0xe7fb('0x17')]=undefined;util[_0xe7fb('0x1c')](this[_0xe7fb('0x6')],this[_0xe7fb('0x2')],this[_0xe7fb('0x5')],this[_0xe7fb('0x4')]['channel']);util[_0xe7fb('0x1d')](this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x6')]['agents'][this[_0xe7fb('0x5')]['id']],_0x5f265f?_0xe7fb('0x1e'):_0xe7fb('0x1f'));}if(!_0x5f265f){setTimeout(this[_0xe7fb('0x7')][_0xe7fb('0x8')](this),0x3e8);}};function agent(_0x35b828,_0xfeefb1,_0xc4e271,_0x195c35){return new Agent(_0x35b828,_0xfeefb1,_0xc4e271,_0x195c35);}module[_0xe7fb('0x20')]=agent; \ No newline at end of file +var _0x5089=['uuid','../../../../../config/logger','routing','notificationId','agent','realtime','push','handleRun','handleTimeout','bind','timeout','squeue','drained','handleDrained','prototype','debug','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','busyQueue','saveWaitingNotification','channel','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','lodash'];(function(_0x4df66f,_0xb81bc9){var _0x45ddcb=function(_0x4c4f94){while(--_0x4c4f94){_0x4df66f['push'](_0x4df66f['shift']());}};_0x45ddcb(++_0xb81bc9);}(_0x5089,0x1bb));var _0x9508=function(_0x29a29f,_0x155ce7){_0x29a29f=_0x29a29f-0x0;var _0x443ea3=_0x5089[_0x29a29f];return _0x443ea3;};'use strict';var _=require(_0x9508('0x0'));var uuid=require(_0x9508('0x1'));var util=require('./util');var logger=require(_0x9508('0x2'))(_0x9508('0x3'));var Agent=function(_0x7dd13d,_0x100d7e,_0x172549,_0x59d3ee){this[_0x9508('0x4')]=uuid['v4']();this['squeue']=_0x7dd13d;this[_0x9508('0x5')]=_0x100d7e;this[_0x9508('0x6')]=_0x172549;this[_0x9508('0x3')]=_0x59d3ee;this['squeue'][_0x9508('0x7')](this[_0x9508('0x8')]['bind'](this),this[_0x9508('0x9')][_0x9508('0xa')](this));this['squeue']['on'](_0x9508('0xb'),this['handleTimeout'][_0x9508('0xa')](this));this[_0x9508('0xc')]['on'](_0x9508('0xd'),this[_0x9508('0xe')][_0x9508('0xa')](this));};Agent[_0x9508('0xf')]['push']=function(){this[_0x9508('0xc')]['push'](this[_0x9508('0x8')][_0x9508('0xa')](this),this['handleTimeout'][_0x9508('0xa')](this));};Agent[_0x9508('0xf')][_0x9508('0xe')]=function(){this[_0x9508('0x9')](!![]);};Agent['prototype'][_0x9508('0x8')]=function(){logger[_0x9508('0x10')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x9508('0xc')]['id'],this['agent']['id']);if(_[_0x9508('0x11')](this[_0x9508('0x6')][_0x9508('0x12')][this[_0x9508('0x5')]['id']])){logger[_0x9508('0x10')](_0x9508('0x13'),this[_0x9508('0xc')]['id'],this[_0x9508('0x5')]['id']);setTimeout(this['push'][_0x9508('0xa')](this),0x3e8);}else{if(this[_0x9508('0x3')][_0x9508('0x14')]||util[_0x9508('0x15')](this[_0x9508('0xc')]['id'],this[_0x9508('0x6')]['agents'][this['agent']['id']],this[_0x9508('0xc')]['channel'],![])){this[_0x9508('0x6')]['agents'][this[_0x9508('0x5')]['id']][_0x9508('0x16')]=!![];this[_0x9508('0x6')][_0x9508('0x12')][this[_0x9508('0x5')]['id']][_0x9508('0x17')]=undefined;util[_0x9508('0x18')](this['realtime'],this['routing'],this[_0x9508('0x5')],this[_0x9508('0xc')][_0x9508('0x19')]);util[_0x9508('0x1a')](this[_0x9508('0x4')],this[_0x9508('0xc')]['id'],this['realtime']['agents'][this[_0x9508('0x5')]['id']],null,this['routing']);util['writeLog'](this[_0x9508('0xc')]['id'],this['realtime']['agents'][this[_0x9508('0x5')]['id']],_0x9508('0x1b')+(this['routing'][_0x9508('0x14')]?_0x9508('0x1c'):''));}else{logger[_0x9508('0x10')](_0x9508('0x1d'),this[_0x9508('0xc')]['id'],this[_0x9508('0x5')]['id']);setTimeout(this[_0x9508('0x7')][_0x9508('0xa')](this),0x3e8);}}};Agent[_0x9508('0xf')][_0x9508('0x9')]=function(_0x19a984){if(_['isNil'](this[_0x9508('0x6')][_0x9508('0x12')][this[_0x9508('0x5')]['id']])){return logger['debug'](_0x9508('0x13'),this[_0x9508('0xc')]['id'],this['agent']['id']);}else{logger[_0x9508('0x10')](_0x9508('0x1e'),this['squeue']['id'],this[_0x9508('0x5')]['id']);util[_0x9508('0x1f')](this[_0x9508('0x4')],this[_0x9508('0xc')]['id'],this['realtime']['agents'][this[_0x9508('0x5')]['id']],null,this[_0x9508('0x3')]);this[_0x9508('0x6')]['agents'][this['agent']['id']][_0x9508('0x16')]=![];this[_0x9508('0x6')][_0x9508('0x12')][this[_0x9508('0x5')]['id']][_0x9508('0x17')]=undefined;util[_0x9508('0x20')](this[_0x9508('0x6')],this[_0x9508('0x3')],this[_0x9508('0x5')],this[_0x9508('0xc')]['channel']);util[_0x9508('0x21')](this[_0x9508('0xc')]['id'],this['realtime'][_0x9508('0x12')][this[_0x9508('0x5')]['id']],_0x19a984?_0x9508('0x22'):_0x9508('0x23'));}if(!_0x19a984){setTimeout(this[_0x9508('0x7')][_0x9508('0xa')](this),0x3e8);}};function agent(_0x33e17c,_0x3700f1,_0xfb6676,_0x98ff75){return new Agent(_0x33e17c,_0x3700f1,_0xfb6676,_0x98ff75);}module[_0x9508('0x24')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index b7b5316..90c3aac 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 _0xf360=['handleDrained','prototype','isNil','Agents','length','agents','writeLog','RINGING','busy','busyQueue','name','showNotification','debug','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','STOP','TIMEOUT','removeWaitingNotification','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','queue','realtime','routing','push','handleRun','bind','handleTimeout','timeout','drained'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf360,0x123));var _0x0f36=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf360[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x0f36('0x0'));var uuid=require(_0x0f36('0x1'));var util=require(_0x0f36('0x2'));var logger=require(_0x0f36('0x3'))('routing');var Beepall=function(_0x41bbcb,_0x4ba8a3,_0xaf4975,_0xbc1a25){this[_0x0f36('0x4')]=uuid['v4']();this[_0x0f36('0x5')]=_0x41bbcb;this[_0x0f36('0x6')]=_0x4ba8a3;this[_0x0f36('0x7')]=_0xaf4975;this[_0x0f36('0x8')]=_0xbc1a25;this[_0x0f36('0x5')][_0x0f36('0x9')](this[_0x0f36('0xa')][_0x0f36('0xb')](this),this[_0x0f36('0xc')]['bind'](this));this[_0x0f36('0x5')]['on'](_0x0f36('0xd'),this[_0x0f36('0xc')]['bind'](this));this[_0x0f36('0x5')]['on'](_0x0f36('0xe'),this[_0x0f36('0xf')][_0x0f36('0xb')](this));};Beepall['prototype'][_0x0f36('0x9')]=function(){this[_0x0f36('0x5')][_0x0f36('0x9')](this['handleRun'][_0x0f36('0xb')](this),this[_0x0f36('0xc')]['bind'](this));};Beepall[_0x0f36('0x10')][_0x0f36('0xf')]=function(){this['handleTimeout'](!![]);};Beepall[_0x0f36('0x10')][_0x0f36('0xa')]=function(){var _0x51183e=!![];if(!_[_0x0f36('0x11')](this[_0x0f36('0x6')])&&!_[_0x0f36('0x11')](this[_0x0f36('0x6')][_0x0f36('0x12')])&&this[_0x0f36('0x6')][_0x0f36('0x12')][_0x0f36('0x13')]>0x0){for(var _0x420d71=0x0,_0x2503c5;_0x420d710x0){for(var _0x7e2f39=0x0,_0x69981b;_0x7e2f390x0&&_0x222d0a[_0x57cdbf+_0x64ee('0x28')]>=_0x222d0a[_0x57cdbf+_0x64ee('0x27')]){writeLog(_0x4a7243,_0x222d0a,_0x57cdbf[_0x64ee('0x29')]()+_0x64ee('0x2a'));return![];}}return!![];};exports['showNotification']=function(_0x35f655,_0x971aa7,_0x2a6e0d,_0x2479ce,_0x5e70a7){return sendNotification(!![],_0x35f655,_0x971aa7,_0x2a6e0d,_0x2479ce,_0x5e70a7);};exports[_0x64ee('0x2b')]=function(_0x4cea8b,_0x255efc,_0x15470b,_0x4b7c8d,_0x86702c){return sendNotification(![],_0x4cea8b,_0x255efc,_0x15470b,_0x4b7c8d,_0x86702c);};exports[_0x64ee('0x2c')]=function(_0x2f0d96,_0x5821fa,_0x3be242){var _0x1ee848=_0x5821fa[_0x64ee('0x2d')][_0x64ee('0x2e')];if(!_0x1ee848&&_0x3be242){_0x1ee848=_0x3be242['id'];}var _0x54aac2=_[_0x64ee('0x2f')](_0x2f0d96[_0x5821fa[_0x64ee('0x30')]+_0x64ee('0x31')],function(_0x14d56f){var _0x87c49d=_[_0x64ee('0x32')](_0x5821fa[_0x64ee('0x30')])+_0x64ee('0x33');return _0x14d56f[_0x87c49d]===_0x5821fa['interaction']['id'];});if(!_0x54aac2&&_0x1ee848){_0x54aac2=_[_0x64ee('0x2f')](_0x2f0d96[_0x64ee('0x34')][_0x1ee848][_0x5821fa[_0x64ee('0x30')]+_0x64ee('0x35')],function(_0x27a568){return _0x27a568['id']===_0x5821fa[_0x64ee('0x2d')]['id'];});}return _0x54aac2;};exports[_0x64ee('0x36')]=function(_0x5db685,_0x28ae59,_0x4199bb,_0x15356a){_0x5db685[_0x64ee('0x34')][_0x4199bb['id']][_0x15356a+'WaitingInteractions'][_0x28ae59[_0x64ee('0x19')]['id']]={'id':_0x28ae59[_0x64ee('0x2d')]['id']};};exports[_0x64ee('0x37')]=function(_0x4bbe62,_0x2612dd,_0x2541bd,_0x3e0dbd){delete _0x4bbe62[_0x64ee('0x34')][_0x2541bd['id']][_0x3e0dbd+_0x64ee('0x35')][_0x2612dd[_0x64ee('0x19')]['id']];};exports['writeLog']=writeLog; \ No newline at end of file +var _0xfa66=['util','../utils','../../../../../config/environment','routing','defaults','localhost','redis','format','user:%s','name','emit','user:save','split','account','notificationSound','notificationShake','queue','body','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','save','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','OFFLINE','Pause','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','some','QueuesWaitingInteractions','capitalize','InteractionId','agents','WaitingInteractions','removeWaitingNotification','writeLog','lodash'];(function(_0x520781,_0x1cde4e){var _0x1a8945=function(_0xe52dcf){while(--_0xe52dcf){_0x520781['push'](_0x520781['shift']());}};_0x1a8945(++_0x1cde4e);}(_0xfa66,0xc7));var _0x6fa6=function(_0x41e4d4,_0x292c36){_0x41e4d4=_0x41e4d4-0x0;var _0x5df3cb=_0xfa66[_0x41e4d4];return _0x5df3cb;};'use strict';var _=require(_0x6fa6('0x0'));var util=require(_0x6fa6('0x1'));var utils=require(_0x6fa6('0x2'));var Redis=require('ioredis');var config=require(_0x6fa6('0x3'));var logger=require('../../../../../config/logger')(_0x6fa6('0x4'));config['redis']=_[_0x6fa6('0x5')](config['redis'],{'host':_0x6fa6('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6fa6('0x7')]));function sendNotification(_0x160f2b,_0x443f4a,_0x43cd82,_0x103e03,_0x4c786e,_0x24a54f){io['to'](util[_0x6fa6('0x8')](_0x6fa6('0x9'),_0x103e03[_0x6fa6('0xa')]))[_0x6fa6('0xb')](_0x6fa6('0xc'),_0x103e03);var _0x5499d9=_0x24a54f||{};var _0xab4b53=_0x43cd82[_0x6fa6('0xd')]('.');var _0x4e012f={'uniqueid':_0x443f4a,'channel':_0xab4b53[0x0],'id':_0xab4b53[0x1],'title':_0xab4b53[0x0]+'\x20interaction','interactionId':_0xab4b53[0x2],'queue':_0x4c786e?_0x4c786e[_0x6fa6('0xa')]:null,'sound':_0x5499d9[_0x6fa6('0xe')][_0x6fa6('0xf')],'shake':_0x5499d9[_0x6fa6('0xe')][_0x6fa6('0x10')]};try{if(!_0x5499d9['body']){_0x5499d9['body']={};}if(_0x4c786e){_0x5499d9['body']['queue']=_0x4c786e;}else if(_0x5499d9['body'][_0x6fa6('0x11')]){delete _0x5499d9[_0x6fa6('0x12')][_0x6fa6('0x11')];}_0x4e012f[_0x6fa6('0x13')]=utils[_0x6fa6('0x14')](_0x5499d9[_0x6fa6('0xe')][_0x6fa6('0x15')],_0x5499d9);}catch(_0x30b982){_0x4e012f[_0x6fa6('0x13')]=_0x6fa6('0x16');logger[_0x6fa6('0x17')](util['format'](_0x6fa6('0x18'),_0x443f4a,_0x30b982[_0x6fa6('0x19')]));}io['to'](util[_0x6fa6('0x8')](_0x6fa6('0x9'),_0x103e03[_0x6fa6('0xa')]))['emit'](util['format']('notification:%s',_0x160f2b?_0x6fa6('0x1a'):'remove'),_0x4e012f);}function writeLog(_0x5c5042,_0x23ef1f,_0x4499e9){return logger[_0x6fa6('0x1b')](util['format'](_0x6fa6('0x1c'),_0x5c5042,_0x23ef1f[_0x6fa6('0xa')],_0x4499e9));}exports[_0x6fa6('0x1d')]=function(_0x8d7e2f,_0x5e9607,_0x2cdffe,_0x1259cc){if(_0x5e9607[_0x6fa6('0x1e')]){writeLog(_0x8d7e2f,_0x5e9607,_0x6fa6('0x1f'));return![];}if(!_0x5e9607['online']){writeLog(_0x8d7e2f,_0x5e9607,_0x6fa6('0x20'));return![];}if(_0x5e9607[_0x2cdffe+_0x6fa6('0x21')]){writeLog(_0x8d7e2f,_0x5e9607,'PAUSE');return![];}if(_0x1259cc&&_0x5e9607[_0x6fa6('0x22')](_0x2cdffe+_0x6fa6('0x23'))&&_0x5e9607['hasOwnProperty'](_0x2cdffe+_0x6fa6('0x24'))){if(_0x5e9607[_0x2cdffe+_0x6fa6('0x23')]>0x0&&_0x5e9607[_0x2cdffe+_0x6fa6('0x24')]>=_0x5e9607[_0x2cdffe+_0x6fa6('0x23')]){writeLog(_0x8d7e2f,_0x5e9607,_0x2cdffe['toUpperCase']()+_0x6fa6('0x25'));return![];}}return!![];};exports[_0x6fa6('0x26')]=function(_0x29d3bc,_0x1b04eb,_0x27d9be,_0x4ef1f1,_0x256ae8){return sendNotification(!![],_0x29d3bc,_0x1b04eb,_0x27d9be,_0x4ef1f1,_0x256ae8);};exports[_0x6fa6('0x27')]=function(_0xf1b330,_0x50a10b,_0x144038,_0x115fad,_0x538ccc){return sendNotification(![],_0xf1b330,_0x50a10b,_0x144038,_0x115fad,_0x538ccc);};exports[_0x6fa6('0x28')]=function(_0x40ea2e,_0x555f0f,_0x201afb){var _0x470b42=_0x555f0f[_0x6fa6('0x29')]['UserId'];if(!_0x470b42&&_0x201afb){_0x470b42=_0x201afb['id'];}var _0x328c87=_[_0x6fa6('0x2a')](_0x40ea2e[_0x555f0f['channel']+_0x6fa6('0x2b')],function(_0x5c8ecf){var _0x2aeea6=_[_0x6fa6('0x2c')](_0x555f0f['channel'])+_0x6fa6('0x2d');return _0x5c8ecf[_0x2aeea6]===_0x555f0f[_0x6fa6('0x29')]['id'];});if(!_0x328c87&&_0x470b42){_0x328c87=_[_0x6fa6('0x2a')](_0x40ea2e[_0x6fa6('0x2e')][_0x470b42][_0x555f0f['channel']+_0x6fa6('0x2f')],function(_0x22146a){return _0x22146a['id']===_0x555f0f[_0x6fa6('0x29')]['id'];});}return _0x328c87;};exports['saveWaitingNotification']=function(_0x4d07ec,_0x89d9cb,_0x47eb9b,_0x45d4f6){_0x4d07ec['agents'][_0x47eb9b['id']][_0x45d4f6+_0x6fa6('0x2f')][_0x89d9cb[_0x6fa6('0x19')]['id']]={'id':_0x89d9cb['interaction']['id']};};exports[_0x6fa6('0x30')]=function(_0x32fc44,_0x19c745,_0x196530,_0x546779){delete _0x32fc44[_0x6fa6('0x2e')][_0x196530['id']][_0x546779+'WaitingInteractions'][_0x19c745['message']['id']];};exports[_0x6fa6('0x31')]=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 939bed7..c1d93b3 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 _0xc534=['lodash','../../../../config/logger','routing','string','consequence','validate','length','error','[%s][SYSTEM]\x20%s','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','shelljs'];(function(_0x1e296b,_0x1999e1){var _0x2088c8=function(_0x3674f8){while(--_0x3674f8){_0x1e296b['push'](_0x1e296b['shift']());}};_0x2088c8(++_0x1999e1);}(_0xc534,0x1ca));var _0x4c53=function(_0x5568ed,_0x61f3be){_0x5568ed=_0x5568ed-0x0;var _0x406c98=_0xc534[_0x5568ed];return _0x406c98;};'use strict';var schema=require('validate');var sh=require(_0x4c53('0x0'));var _=require(_0x4c53('0x1'));var utils=require('./utils');var logger=require(_0x4c53('0x2'))(_0x4c53('0x3'));var system=schema({'command':{'type':_0x4c53('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x4c53('0x5')]=function(_0x50f2d0,_0x44d017){return function(_0x32b42){try{var _0x424af0={'command':_0x44d017[0x0]};var _0x4432cd=system[_0x4c53('0x6')](_0x424af0,{'typecast':!![]});if(_0x4432cd[_0x4c53('0x7')]){logger[_0x4c53('0x8')](_0x4c53('0x9'),_0x50f2d0,_['map'](_0x4432cd,_0x4c53('0xa'))[_0x4c53('0xb')](',\x20'));logger['info'](_0x4c53('0xc'),_0x50f2d0);_0x32b42[_0x4c53('0xd')]();}else{var _0x44f26c=this;var _0x476c2d=utils[_0x4c53('0xe')](_0x44d017[0x0],this);logger[_0x4c53('0xf')](_0x4c53('0x10'),_0x50f2d0,_0x476c2d);sh[_0x4c53('0x11')](_[_0x4c53('0x12')](_0x476c2d),function(_0x398b27,_0x449aaf){logger[_0x4c53('0xf')](_0x4c53('0x13'),_0x50f2d0,_0x398b27);if(_0x398b27==0x0){var _0x3988f9=_0x449aaf[_0x4c53('0x14')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x44d017[0x1])||_[_0x4c53('0x15')](_0x44d017[0x1])){logger['info'](_0x4c53('0x16'),_0x50f2d0);_0x44f26c[_0x4c53('0x17')][_0x44d017[0x1]]=_0x3988f9;}else{logger[_0x4c53('0xf')](_0x4c53('0x18'),_0x50f2d0,_0x44d017[0x1],_0x3988f9);_0x44f26c[_0x4c53('0x17')][_0x44d017[0x1]]=_0x3988f9;}}_0x32b42['next']();});}}catch(_0x1762b3){logger[_0x4c53('0x8')]('[%s][SYSTEM]\x20%s',_0x50f2d0,_[_0x4c53('0x19')](_0x1762b3)?JSON[_0x4c53('0x1a')](_0x1762b3):_0x1762b3);logger[_0x4c53('0xf')](_0x4c53('0xc'),_0x50f2d0);_0x32b42[_0x4c53('0xd')]();}};}; \ No newline at end of file +var _0x3422=['map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs','lodash','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][SYSTEM]\x20%s'];(function(_0x1a2e43,_0x645814){var _0x125fb4=function(_0x58875f){while(--_0x58875f){_0x1a2e43['push'](_0x1a2e43['shift']());}};_0x125fb4(++_0x645814);}(_0x3422,0x118));var _0x2342=function(_0x56ab57,_0x528151){_0x56ab57=_0x56ab57-0x0;var _0x53ac9b=_0x3422[_0x56ab57];return _0x53ac9b;};'use strict';var schema=require(_0x2342('0x0'));var sh=require(_0x2342('0x1'));var _=require(_0x2342('0x2'));var utils=require('./utils');var logger=require(_0x2342('0x3'))(_0x2342('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x2342('0x5')}});exports['consequence']=function(_0x226c0f,_0x5e1b7c){return function(_0x4e44ba){try{var _0x196c13={'command':_0x5e1b7c[0x0]};var _0x2f7ebd=system[_0x2342('0x0')](_0x196c13,{'typecast':!![]});if(_0x2f7ebd['length']){logger[_0x2342('0x6')](_0x2342('0x7'),_0x226c0f,_[_0x2342('0x8')](_0x2f7ebd,'message')[_0x2342('0x9')](',\x20'));logger[_0x2342('0xa')](_0x2342('0xb'),_0x226c0f);_0x4e44ba[_0x2342('0xc')]();}else{var _0x1c0baf=this;var _0x5bdbd0=utils[_0x2342('0xd')](_0x5e1b7c[0x0],this);logger[_0x2342('0xa')](_0x2342('0xe'),_0x226c0f,_0x5bdbd0);sh[_0x2342('0xf')](_[_0x2342('0x10')](_0x5bdbd0),function(_0x4e2f34,_0x1166a4){logger[_0x2342('0xa')](_0x2342('0x11'),_0x226c0f,_0x4e2f34);if(_0x4e2f34==0x0){var _0x337d54=_0x1166a4[_0x2342('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x2342('0x13')](_0x5e1b7c[0x1])||_[_0x2342('0x14')](_0x5e1b7c[0x1])){logger[_0x2342('0xa')]('[%s][SYSTEM]\x20no\x20variable',_0x226c0f);_0x1c0baf[_0x2342('0x15')][_0x5e1b7c[0x1]]=_0x337d54;}else{logger['info'](_0x2342('0x16'),_0x226c0f,_0x5e1b7c[0x1],_0x337d54);_0x1c0baf['body'][_0x5e1b7c[0x1]]=_0x337d54;}}_0x4e44ba['next']();});}}catch(_0x346098){logger[_0x2342('0x6')]('[%s][SYSTEM]\x20%s',_0x226c0f,_[_0x2342('0x17')](_0x346098)?JSON['stringify'](_0x346098):_0x346098);logger['info'](_0x2342('0xb'),_0x226c0f);_0x4e44ba[_0x2342('0xc')]();}};}; \ 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 f25336f..d6127e9 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 _0x964d=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','finally','isObject','stringify','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][TAG]\x20%s','info'];(function(_0x495066,_0x10bbb1){var _0x691671=function(_0x58848c){while(--_0x58848c){_0x495066['push'](_0x495066['shift']());}};_0x691671(++_0x10bbb1);}(_0x964d,0x1a2));var _0xd964=function(_0x2e758b,_0x5712f9){_0x2e758b=_0x2e758b-0x0;var _0x19ee8d=_0x964d[_0x2e758b];return _0x19ee8d;};'use strict';var schema=require(_0xd964('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xd964('0x1')),'openchannelInteraction':require(_0xd964('0x2')),'smsInteraction':require(_0xd964('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xd964('0x4')),'whatsappInteraction':require(_0xd964('0x5'))};var logger=require(_0xd964('0x6'))(_0xd964('0x7'));var tag=schema({'tag':{'type':_0xd964('0x8'),'required':!![],'message':_0xd964('0x9')}});exports['consequence']=function(_0x4043f2,_0x41198b,_0x870bbe,_0x3d8138){return function(_0x1e020b){try{var _0x41daf4={'tag':_0x41198b[0x0]};var _0x3f6f6d=tag[_0xd964('0x0')](_0x41daf4,{'typecast':!![]});if(_0x3f6f6d[_0xd964('0xa')]){logger[_0xd964('0xb')](_0xd964('0xc'),_0x4043f2,_['map'](_0x3f6f6d,'message')['join'](',\x20'));logger[_0xd964('0xd')](_0xd964('0xe'),_0x4043f2);_0x1e020b[_0xd964('0xf')]();}else{var _0x532810={'ids':[_0x41198b[0x0]]};if(rpc[_0x3d8138[_0xd964('0x10')]+'Interaction']){rpc[_0x3d8138[_0xd964('0x10')]+'Interaction']['addTags'](_0x3d8138[_0xd964('0x11')]['id'],_0x532810)[_0xd964('0x12')](function(_0x109773){logger['info'](_0xd964('0x13'),_0x4043f2,_0x41198b[0x1],_0x3d8138[_0xd964('0x10')],_0x3d8138[_0xd964('0x11')]['id']);})[_0xd964('0x14')](function(_0x2d0421){logger[_0xd964('0xb')]('[%s][TAG]\x20%s',_0x4043f2,JSON['stringify'](_0x2d0421));logger[_0xd964('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4043f2);})[_0xd964('0x15')](function(){_0x1e020b[_0xd964('0xf')]();});}}}catch(_0x26d5db){logger['error'](_0xd964('0xc'),_0x4043f2,_[_0xd964('0x16')](_0x26d5db)?JSON[_0xd964('0x17')](_0x26d5db):_0x26d5db);logger[_0xd964('0xd')](_0xd964('0xe'),_0x4043f2);_0x1e020b[_0xd964('0xf')]();}};}; \ No newline at end of file +var _0x01c5=['../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','finally','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction'];(function(_0x5ce5a7,_0x3208f0){var _0x22c008=function(_0x35a009){while(--_0x35a009){_0x5ce5a7['push'](_0x5ce5a7['shift']());}};_0x22c008(++_0x3208f0);}(_0x01c5,0xdb));var _0x501c=function(_0x2931f8,_0x4ae628){_0x2931f8=_0x2931f8-0x0;var _0x38bb71=_0x01c5[_0x2931f8];return _0x38bb71;};'use strict';var schema=require('validate');var _=require(_0x501c('0x0'));var rpc={'chatInteraction':require(_0x501c('0x1')),'openchannelInteraction':require(_0x501c('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x501c('0x3')),'faxInteraction':require(_0x501c('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x501c('0x5'))(_0x501c('0x6'));var tag=schema({'tag':{'type':_0x501c('0x7'),'required':!![],'message':_0x501c('0x8')}});exports[_0x501c('0x9')]=function(_0x2192be,_0x3166de,_0x543366,_0x541175){return function(_0x5c64d5){try{var _0x3879e1={'tag':_0x3166de[0x0]};var _0xbe4826=tag[_0x501c('0xa')](_0x3879e1,{'typecast':!![]});if(_0xbe4826[_0x501c('0xb')]){logger[_0x501c('0xc')](_0x501c('0xd'),_0x2192be,_[_0x501c('0xe')](_0xbe4826,'message')[_0x501c('0xf')](',\x20'));logger[_0x501c('0x10')](_0x501c('0x11'),_0x2192be);_0x5c64d5[_0x501c('0x12')]();}else{var _0x3dd2bd={'ids':[_0x3166de[0x0]]};if(rpc[_0x541175[_0x501c('0x13')]+_0x501c('0x14')]){rpc[_0x541175[_0x501c('0x13')]+'Interaction'][_0x501c('0x15')](_0x541175[_0x501c('0x16')]['id'],_0x3dd2bd)[_0x501c('0x17')](function(_0x27970e){logger['info'](_0x501c('0x18'),_0x2192be,_0x3166de[0x1],_0x541175['channel'],_0x541175[_0x501c('0x16')]['id']);})['catch'](function(_0x471fb2){logger[_0x501c('0xc')](_0x501c('0xd'),_0x2192be,JSON[_0x501c('0x19')](_0x471fb2));logger[_0x501c('0x10')](_0x501c('0x11'),_0x2192be);})[_0x501c('0x1a')](function(){_0x5c64d5[_0x501c('0x12')]();});}}}catch(_0x58c731){logger[_0x501c('0xc')](_0x501c('0xd'),_0x2192be,_[_0x501c('0x1b')](_0x58c731)?JSON[_0x501c('0x19')](_0x58c731):_0x58c731);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2192be);_0x5c64d5[_0x501c('0x12')]();}};}; \ 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 a2e87aa..d1f609c 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 _0xe496=['[%s][TVOX]\x20%s','../../../../config/logger','routing','lodash','consequence','replace','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','params','stringify','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error'];(function(_0x2d9048,_0x8aaca7){var _0x36f28a=function(_0x2eaefe){while(--_0x2eaefe){_0x2d9048['push'](_0x2d9048['shift']());}};_0x36f28a(++_0x8aaca7);}(_0xe496,0xda));var _0x6e49=function(_0x5d7742,_0x4738e5){_0x5d7742=_0x5d7742-0x0;var _0x202be5=_0xe496[_0x5d7742];return _0x202be5;};'use strict';var rp=require('request-promise');var logger=require(_0x6e49('0x0'))(_0x6e49('0x1'));var _=require(_0x6e49('0x2'));var arr=[];exports[_0x6e49('0x3')]=function(_0x5ef89c,_0x37fe6d){return function(_0x5337e1){var _0x5738e7=_0x37fe6d[0xa];var _0x2ff263=_0x37fe6d[0xb];var _0x112551=_0x37fe6d[0xc];var _0x4ec665=_0x37fe6d[0xd];var _0x2fc243=_0x37fe6d[0xe];var _0x192d81=_0x37fe6d[0xf][_0x6e49('0x4')](/\n/g,'\x20-\x20');var _0x336312=_0x37fe6d[0x10][_0x6e49('0x4')](/\n/g,'\x20');if(!arr[_0x6e49('0x5')](_0x2ff263)){arr[_0x6e49('0x6')](_0x2ff263);var _0x1347a3=_0x37fe6d[0x3];var _0x527dae=_0x37fe6d[0x4];var _0x28373c=_0x37fe6d[0x1];var _0x495bfa=_0x37fe6d[0x0];var _0x2d80bb={};_0x2d80bb[_0x6e49('0x7')]=_0x37fe6d[0x8]+_0x6e49('0x8')+_0x112551+'|'+_0x5738e7+'|'+_0x4ec665+'|'+_0x2ff263+'|'+_0x2fc243;_0x2d80bb[_0x6e49('0x9')]=_0x37fe6d[0x7]+'?params='+_0x112551+'|'+_0x5738e7+'|'+_0x4ec665+'|'+_0x2ff263+'|'+_0x2fc243+'|'+_0x192d81+'|'+_0x336312;_0x2d80bb[_0x6e49('0xa')]=_0x37fe6d[0x9];var _0x4d2e32={};_0x4d2e32[_0x6e49('0xb')]=_0x6e49('0xc');_0x4d2e32[_0x6e49('0xd')]='login';var _0x3e4e29=[];_0x3e4e29['push'](_0x37fe6d[0x2]);_0x3e4e29[_0x6e49('0x6')](_0x37fe6d[0x5]);_0x3e4e29[_0x6e49('0x6')](_0x37fe6d[0x6]);_0x4d2e32[_0x6e49('0xe')]=_0x3e4e29;_0x4d2e32['id']=0x1;var _0x1f3596=JSON[_0x6e49('0xf')](_0x4d2e32);var _0xc49b01={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x1347a3,'headers':{'Content-Type':_0x6e49('0x10')},'body':_0x1f3596};return rp(_0xc49b01)[_0x6e49('0x11')](function(_0x1005ad){const _0x2e46a4=JSON[_0x6e49('0x12')](_0x1005ad);if(!_0x2e46a4[_0x6e49('0x13')][_0x6e49('0x14')]){throw new Error(_0x6e49('0x15'));}var _0x51421f=_0x2ff263;var _0x46ad3e=_0x6e49('0x16')+_0x28373c+_0x6e49('0x17')+_0x495bfa+'&sessionId='+_0x51421f+_0x6e49('0x18')+JSON['stringify'](_0x2d80bb);var _0x4fb338=_0x527dae+'?'+_0x46ad3e;return rp(_0x4fb338);})[_0x6e49('0x11')](function(_0x3792cf){logger[_0x6e49('0x19')](_0x6e49('0x1a'),_0x5ef89c,_0x3792cf);_0x5337e1[_0x6e49('0x1b')]();})[_0x6e49('0x1c')](function(_0x2bfcaf){logger[_0x6e49('0x1d')](_0x6e49('0x1e'),_0x5ef89c,_['isObject'](_0x2bfcaf)?JSON[_0x6e49('0xf')](_0x2bfcaf):_0x2bfcaf);_0x5337e1['stop']();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x5ef89c);_0x5337e1['next']();}};}; \ No newline at end of file +var _0x03f8=['info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','routing','lodash','replace','\x20-\x20','includes','push','?params=','urlOnRing','2.0','login','params','utf8','POST','application/json-rpc','then','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','stringify','stop','catch','error','[%s][TVOX]\x20%s'];(function(_0x27b7be,_0x538e2d){var _0x1aa77e=function(_0x52a210){while(--_0x52a210){_0x27b7be['push'](_0x27b7be['shift']());}};_0x1aa77e(++_0x538e2d);}(_0x03f8,0x99));var _0x803f=function(_0x4dc7f8,_0x109c07){_0x4dc7f8=_0x4dc7f8-0x0;var _0xc113f9=_0x03f8[_0x4dc7f8];return _0xc113f9;};'use strict';var rp=require('request-promise');var logger=require(_0x803f('0x0'))(_0x803f('0x1'));var _=require(_0x803f('0x2'));var arr=[];exports['consequence']=function(_0xa9fb2d,_0x7e36bb){return function(_0x1282e7){var _0x2b0d8c=_0x7e36bb[0xa];var _0x25771c=_0x7e36bb[0xb];var _0x1b66d0=_0x7e36bb[0xc];var _0x3a8b7f=_0x7e36bb[0xd];var _0x3a8278=_0x7e36bb[0xe];var _0x4c12a6=_0x7e36bb[0xf][_0x803f('0x3')](/\n/g,_0x803f('0x4'));var _0x4f68e1=_0x7e36bb[0x10][_0x803f('0x3')](/\n/g,'\x20');if(!arr[_0x803f('0x5')](_0x25771c)){arr[_0x803f('0x6')](_0x25771c);var _0x230dc2=_0x7e36bb[0x3];var _0x260015=_0x7e36bb[0x4];var _0xe359ed=_0x7e36bb[0x1];var _0x33bff7=_0x7e36bb[0x0];var _0x14ac17={};_0x14ac17['urlOnAnswer']=_0x7e36bb[0x8]+_0x803f('0x7')+_0x1b66d0+'|'+_0x2b0d8c+'|'+_0x3a8b7f+'|'+_0x25771c+'|'+_0x3a8278;_0x14ac17[_0x803f('0x8')]=_0x7e36bb[0x7]+_0x803f('0x7')+_0x1b66d0+'|'+_0x2b0d8c+'|'+_0x3a8b7f+'|'+_0x25771c+'|'+_0x3a8278+'|'+_0x4c12a6+'|'+_0x4f68e1;_0x14ac17['title']=_0x7e36bb[0x9];var _0x3c4f89={};_0x3c4f89['jsonrpc']=_0x803f('0x9');_0x3c4f89['method']=_0x803f('0xa');var _0x142321=[];_0x142321[_0x803f('0x6')](_0x7e36bb[0x2]);_0x142321[_0x803f('0x6')](_0x7e36bb[0x5]);_0x142321[_0x803f('0x6')](_0x7e36bb[0x6]);_0x3c4f89[_0x803f('0xb')]=_0x142321;_0x3c4f89['id']=0x1;var _0x36a59f=JSON['stringify'](_0x3c4f89);var _0x2fa31d={'encoding':_0x803f('0xc'),'method':_0x803f('0xd'),'timeout':0x2710,'url':_0x230dc2,'headers':{'Content-Type':_0x803f('0xe')},'body':_0x36a59f};return rp(_0x2fa31d)[_0x803f('0xf')](function(_0x3bc418){const _0x111332=JSON[_0x803f('0x10')](_0x3bc418);if(!_0x111332[_0x803f('0x11')]['logged']){throw new Error(_0x803f('0x12'));}var _0x99a57c=_0x25771c;var _0x5dd51a=_0x803f('0x13')+_0xe359ed+_0x803f('0x14')+_0x33bff7+_0x803f('0x15')+_0x99a57c+'&data='+JSON[_0x803f('0x16')](_0x14ac17);var _0x2f0429=_0x260015+'?'+_0x5dd51a;return rp(_0x2f0429);})['then'](function(_0x169827){logger['info']('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0xa9fb2d,_0x169827);_0x1282e7[_0x803f('0x17')]();})[_0x803f('0x18')](function(_0x2aaba2){logger[_0x803f('0x19')](_0x803f('0x1a'),_0xa9fb2d,_['isObject'](_0x2aaba2)?JSON[_0x803f('0x16')](_0x2aaba2):_0x2aaba2);_0x1282e7[_0x803f('0x17')]();});}else{logger[_0x803f('0x1b')](_0x803f('0x1c'),_0xa9fb2d);_0x1282e7[_0x803f('0x1d')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 0931675..3d14b51 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0xf62c3,_0xb0e5f){var _0x2194e1=function(_0x1a84bb){while(--_0x1a84bb){_0xf62c3['push'](_0xf62c3['shift']());}};_0x2194e1(++_0xb0e5f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x311a9f,_0x3ad838){var _0x5440a4=function(_0x238876){while(--_0x238876){_0x311a9f['push'](_0x311a9f['shift']());}};_0x5440a4(++_0x3ad838);}(_0xe706,0xa3));var _0x6e70=function(_0x96f54d,_0x5e5d21){_0x96f54d=_0x96f54d-0x0;var _0xdb885c=_0xe706[_0x96f54d];return _0xdb885c;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 4930d17..884c1cc 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 _0xf76d=['capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','values','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','listen','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','join','app','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','./interval','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','.js','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','routing\x20is\x20empty','agent','agents','busy','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','stack','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf76d,0x1a7));var _0xdf76=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0xf76d[_0x519756];return _0x37047e;};'use strict';var _=require(_0xdf76('0x0'));var util=require(_0xdf76('0x1'));var path=require(_0xdf76('0x2'));var fs=require('fs');var jayson=require(_0xdf76('0x3'));var BPromise=require(_0xdf76('0x4'));var utils=require(_0xdf76('0x5'));var sUtils=require(_0xdf76('0x6'));var logger=require(_0xdf76('0x7'))('routing');var rpc={'openchannelQueueReport':require(_0xdf76('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xdf76('0x9')),'faxQueueReport':require(_0xdf76('0xa')),'whatsappQueueReport':require(_0xdf76('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x4c1455,_0x345568,_0x19ba59){return util[_0xdf76('0xc')](_0xdf76('0xd'),_0x4c1455,_0x345568||0x0,_0x19ba59||0x0);}function getIntervals(_0x211122,_0x594e02){var _0x678f75=[];if(!_[_0xdf76('0xe')](_0x594e02[_0xdf76('0xf')])&&!_[_0xdf76('0xe')](_0x211122[_0x594e02['IntervalId']])&&!_['isNil'](_0x211122[_0x594e02[_0xdf76('0xf')]][_0xdf76('0x10')])){_0x678f75=_[_0xdf76('0x11')](_0x211122[_0x594e02[_0xdf76('0xf')]]['Intervals'],'interval');}else if(!_['isNil'](_0x594e02[_0xdf76('0x12')])){_0x678f75=[_0x594e02[_0xdf76('0x12')]];}return _0x678f75;}exports['listen']=function(_0x4801d6){_0x4801d6[_0xdf76('0x13')]={};return new BPromise(function(_0xc68b6d,_0x148b50){var _0x16ac38={'Start':function(_0x1a27c9){var _0x4b86d8=this;return new Promise(function(_0x3658aa,_0x505305){if(_0x1a27c9){try{var _0x2458bd=[];var _0x21a3e4=getId(_0x1a27c9[_0xdf76('0x14')],_0x1a27c9[_0xdf76('0x15')]?_0x1a27c9['message']['id']:0x0,_0x1a27c9[_0xdf76('0x16')]?_0x1a27c9[_0xdf76('0x16')]['id']:0x0);var _0x31df92=sUtils[_0xdf76('0x17')](_0x4801d6,_0x1a27c9);if(!_0x31df92&&_0x1a27c9[_0xdf76('0x18')]&&_[_0xdf76('0x19')](_0x1a27c9['applications'])&&_0x1a27c9['applications'][_0xdf76('0x1a')]){for(var _0x4b0b7f=0x0;_0x4b0b7f<_0x1a27c9[_0xdf76('0x18')][_0xdf76('0x1a')];_0x4b0b7f+=0x1){var _0x3dd87d=_0x1a27c9['applications'][_0x4b0b7f];if(fs['existsSync'](path[_0xdf76('0x1b')](__dirname,'applications',_0x3dd87d[_0xdf76('0x1c')]+'.js'))){var _0x3a71bc=[];switch(_0x3dd87d['app']['toLowerCase']()){case _0xdf76('0x1d'):var _0x2283ff=_0x3dd87d[_0xdf76('0x1e')][_0xdf76('0x1f')](',');if(_0x1a27c9[_0xdf76('0x14')]===_0xdf76('0x20')){_0x3a71bc[_0xdf76('0x21')](_0x2283ff[0x0]);_0x3a71bc[_0xdf76('0x21')](_0x2283ff[0x1]);_0x3a71bc[_0xdf76('0x21')](_0x2283ff[_0xdf76('0x22')](0x2,_0x2283ff[_0xdf76('0x1a')])[_0xdf76('0x1b')](','));}else{_0x3a71bc[_0xdf76('0x21')](_0x2283ff[0x0]);_0x3a71bc[_0xdf76('0x21')](_0x2283ff[_0xdf76('0x22')](0x1,_0x2283ff['length'])[_0xdf76('0x1b')](','));}break;case _0xdf76('0x23'):var _0x52424b=_0x3dd87d[_0xdf76('0x1e')]['split'](',');_0x3a71bc[_0xdf76('0x21')](_0x52424b[0x0]);_0x3a71bc[_0xdf76('0x21')](_0x52424b[0x1]);_0x3a71bc[_0xdf76('0x21')](_0x52424b[_0xdf76('0x22')](0x2,_0x52424b[_0xdf76('0x1a')])[_0xdf76('0x1b')](','));break;case _0xdf76('0x24'):var _0x56e43b=_0x3dd87d[_0xdf76('0x1e')][_0xdf76('0x1f')](',');_0x3a71bc[_0xdf76('0x21')](_0x56e43b[0x0]);_0x3a71bc[_0xdf76('0x21')](_0x56e43b[0x1]);_0x3a71bc[_0xdf76('0x21')](_0x56e43b[0x2]);_0x3a71bc[_0xdf76('0x21')](_0x56e43b[0x3]);_0x3a71bc[_0xdf76('0x21')](_0x56e43b['slice'](0x4,_0x56e43b[_0xdf76('0x1a')])[_0xdf76('0x1b')](','));break;case _0xdf76('0x25'):var _0x3ff142=_0x3dd87d['appdata']['split'](',');_0x3a71bc[_0xdf76('0x21')](_0x3ff142[0x0]);_0x3a71bc[_0xdf76('0x21')](_0x3ff142[0x1]);_0x3a71bc[_0xdf76('0x21')](_0x3ff142[0x2]);_0x3a71bc['push'](_0x3ff142[0x3]);_0x3a71bc[_0xdf76('0x21')](_0x3ff142[_0xdf76('0x22')](0x4,_0x3ff142[_0xdf76('0x1a')])[_0xdf76('0x1b')](','));break;case _0xdf76('0x15'):_0x3a71bc[_0xdf76('0x21')](_0x3dd87d[_0xdf76('0x1e')]);break;case _0xdf76('0x26'):_0x3a71bc['push'](_0x3dd87d['TagId']);_0x3a71bc['push'](_0x3dd87d['appdata']);break;case'tvox':var _0x54aa3d=utils[_0xdf76('0x27')](_0x1a27c9[_0xdf76('0x28')][_0xdf76('0x29')],_0x1a27c9);var _0x3ca44c=_0x3dd87d[_0xdf76('0x1e')][_0xdf76('0x1f')](',');_0x3a71bc[_0xdf76('0x21')](_0x3ca44c[0x0]);_0x3a71bc[_0xdf76('0x21')](_0x3ca44c[0x1]);_0x3a71bc['push'](_0x3ca44c[0x2]);_0x3a71bc[_0xdf76('0x21')](_0x3ca44c[0x3]);_0x3a71bc[_0xdf76('0x21')](_0x3ca44c[0x4]);_0x3a71bc['push'](_0x3ca44c[0x5]);_0x3a71bc[_0xdf76('0x21')](_0x3ca44c[0x6]);_0x3a71bc[_0xdf76('0x21')](_0x3ca44c[0x7]);_0x3a71bc[_0xdf76('0x21')](_0x3ca44c[0x8]);_0x3a71bc['push'](_0x3ca44c[0x9]);_0x3a71bc[_0xdf76('0x21')](_0x3ca44c[0xa]);_0x3a71bc[_0xdf76('0x21')](_0x1a27c9['interaction']['id']);_0x3a71bc[_0xdf76('0x21')](_0x1a27c9[_0xdf76('0x15')]['id']);_0x3a71bc[_0xdf76('0x21')](_0x3dd87d[_0xdf76('0x2a')]);_0x3a71bc['push'](_0x1a27c9[_0xdf76('0x16')][_0xdf76('0x2b')]);_0x3a71bc['push'](_0x1a27c9[_0xdf76('0x2c')][_0xdf76('0x2c')]);_0x3a71bc[_0xdf76('0x21')](_0x54aa3d);break;default:_0x3a71bc=_[_0xdf76('0xe')](_0x3dd87d[_0xdf76('0x1e')])?[]:_0x3dd87d[_0xdf76('0x1e')][_0xdf76('0x1f')](',');}var _0x4a4812={'id':util[_0xdf76('0xc')]('%s:%s:%s',_0x21a3e4,_0x3dd87d['id'],_0x3dd87d['app']),'condition':require(_0xdf76('0x2d'))['condition'](_0x21a3e4,getIntervals(_0x4801d6[_0xdf76('0x2e')],_0x3dd87d),_0x4801d6),'consequence':require(_0xdf76('0x2f')+_0x3dd87d['app'])[_0xdf76('0x30')](_0x21a3e4,_0x3a71bc,_0x4801d6,_0x1a27c9),'p':_0x3dd87d[_0xdf76('0x31')]||0x0};logger[_0xdf76('0x32')](_0xdf76('0x33'),_0x4a4812['id'],_0xdf76('0x34'),getIntervals(_0x4801d6[_0xdf76('0x2e')],_0x3dd87d)[_0xdf76('0x1b')]('\x20|\x20'));_0x2458bd[_0xdf76('0x21')](_0x4a4812);}else{logger[_0xdf76('0x35')](_0xdf76('0x36'),path[_0xdf76('0x1b')](__dirname,_0xdf76('0x18'),_0x3dd87d[_0xdf76('0x1c')]+_0xdf76('0x37')));}}_0x4801d6[_0xdf76('0x13')][_0x21a3e4]=new RuleEngine(_0x2458bd);_0x4801d6[_0xdf76('0x13')][_0x21a3e4]['execute'](_0x1a27c9,function(_0x2469b4){logger['info']('Applications\x20executed',JSON['stringify'](_0x2469b4[_0xdf76('0x38')]));if(_0x4801d6[_0xdf76('0x13')][_0x21a3e4]){_0x4801d6[_0xdf76('0x13')][_0x21a3e4][_0xdf76('0x39')](_0xdf76('0x3a'));}});return _0x3658aa({'code':0xc8,'message':_0x1a27c9});}else{if(_0x31df92){logger[_0xdf76('0x32')](util['format'](_0xdf76('0x3b'),_0x21a3e4));}else{logger[_0xdf76('0x32')]('No\x20applications\x20to\x20execute');}return _0x3658aa({'code':0xc8,'message':_0x1a27c9});}}catch(_0x1d82aa){logger[_0xdf76('0x35')](_0x1d82aa['stack']);return _0x505305(_0x4b86d8[_0xdf76('0x35')](0x1f4,_0x1d82aa));}}return _0x505305(_0xdf76('0x3c'));});},'AcceptMessage':function(_0x2be25c){var _0x39b28d=this;return new Promise(function(_0x35794e,_0x25053b){if(_0x2be25c[_0xdf76('0x3d')]&&_0x2be25c['agent']['id']){if(_0x4801d6[_0xdf76('0x3e')][_0x2be25c[_0xdf76('0x3d')]['id']]){_0x4801d6[_0xdf76('0x3e')][_0x2be25c[_0xdf76('0x3d')]['id']][_0xdf76('0x3f')]=![];_0x4801d6[_0xdf76('0x3e')][_0x2be25c['agent']['id']]['busyQueue']=undefined;}}if(_0x2be25c[_0xdf76('0x15')]&&_0x2be25c[_0xdf76('0x15')]['id']){try{var _0xc695c6=getId(_0x2be25c[_0xdf76('0x14')],_0x2be25c[_0xdf76('0x15')]?_0x2be25c['message']['id']:0x0,_0x2be25c[_0xdf76('0x16')]?_0x2be25c[_0xdf76('0x16')]['id']:0x0);if(_0x4801d6['rules'][_0xc695c6]){_0x4801d6[_0xdf76('0x13')][_0xc695c6][_0xdf76('0x39')]('end');if(rpc[_0x2be25c['channel']+_0xdf76('0x40')]){rpc[_0x2be25c[_0xdf76('0x14')]+_0xdf76('0x40')]['update'](_0xc695c6,{'UserId':_0x2be25c[_0xdf76('0x15')][_0xdf76('0x41')]})[_0xdf76('0x42')](function(){logger[_0xdf76('0x35')](_0xdf76('0x43'));});}}return _0x35794e({'code':0xc8,'message':_0x2be25c});}catch(_0x1f704a){logger[_0xdf76('0x35')](_0x1f704a['stack']);return _0x25053b(_0x39b28d['error'](0x1f4,_0x1f704a));}}logger[_0xdf76('0x35')](_0xdf76('0x44'));return _0x25053b(_0x39b28d[_0xdf76('0x35')](0x1f4,_0xdf76('0x44')));});},'RejectMessage':function(_0x34a851){var _0x20c5c7=this;return new Promise(function(_0x5d9797,_0x6ea655){if(_0x34a851[_0xdf76('0x3d')]&&_0x34a851[_0xdf76('0x3d')]['id']){try{if(_0x4801d6[_0xdf76('0x3e')][_0x34a851['agent']['id']]){_0x4801d6[_0xdf76('0x3e')][_0x34a851[_0xdf76('0x3d')]['id']][_0xdf76('0x3f')]=![];_0x4801d6['agents'][_0x34a851[_0xdf76('0x3d')]['id']][_0xdf76('0x45')]=undefined;}return _0x5d9797({'code':0xc8,'message':_0x34a851});}catch(_0x5b8074){logger['error'](_0x5b8074[_0xdf76('0x46')]);return _0x6ea655(_0x20c5c7['error'](0x1f4,_0x5b8074));}}logger['error'](_0xdf76('0x44'));return _0x6ea655(_0x20c5c7[_0xdf76('0x35')](0x1f4,_0xdf76('0x44')));});},'AbandonInteraction':function(_0x25b4f3){var _0x38ac07=this;return new Promise(function(_0x524674,_0x2ce7f9){if(_0x25b4f3[_0xdf76('0x14')]&&_0x25b4f3['interaction']&&_0x25b4f3[_0xdf76('0x16')]['id']){try{var _0x164c2c=getId(_0x25b4f3[_0xdf76('0x14')],_0x25b4f3[_0xdf76('0x15')]?_0x25b4f3[_0xdf76('0x15')]['id']:0x0,_0x25b4f3[_0xdf76('0x16')]?_0x25b4f3[_0xdf76('0x16')]['id']:0x0);if(_0x4801d6['rules'][_0x164c2c]){_0x4801d6[_0xdf76('0x13')][_0x164c2c][_0xdf76('0x39')]('end');}return _0x524674({'code':0xc8,'message':_0x25b4f3});}catch(_0x583eff){logger[_0xdf76('0x35')](_0x583eff[_0xdf76('0x46')]);return _0x2ce7f9(_0x38ac07['error'](0x1f4,_0x583eff));}}logger[_0xdf76('0x35')](_0xdf76('0x44'));return _0x2ce7f9(_0x38ac07[_0xdf76('0x35')](0x1f4,_0xdf76('0x44')));});},'AgentCapacity':function(_0x209f7e){var _0x120ed9=this;return new Promise(function(_0x265e8d,_0xff39a1){if(_0x4801d6[_0xdf76('0x3e')][_0xdf76('0x47')](_0x209f7e['id'])){for(var _0x25d298 in _0x209f7e[_0xdf76('0x48')]){if(_0x209f7e[_0xdf76('0x48')]['hasOwnProperty'](_0x25d298)){if(_0x4801d6['agents'][_0x209f7e['id']][_0xdf76('0x47')](_0x25d298+_0xdf76('0x49'))){_0x4801d6[_0xdf76('0x3e')][_0x209f7e['id']][_0x25d298+_0xdf76('0x49')]=parseInt(_0x209f7e['capacity'][_0x25d298],0xa);}}}_0x4801d6['agents'][_0x209f7e['id']][_0xdf76('0x4a')]();return _0x265e8d({'code':0xc8,'message':_0x4801d6[_0xdf76('0x3e')][_0x209f7e['id']]});}else{return _0xff39a1(_0x120ed9['error'](0x1f4,_0xdf76('0x4b')));}});},'Agents':function(_0x3a5bbf){return new Promise(function(_0x31de94){var _0x493e64=_['values'](_0x4801d6[_0xdf76('0x3e')]);if(_0x3a5bbf&&_0x3a5bbf['id']){var _0x54d059=_['find'](_0x493e64,function(_0x4f755b){return _0x4f755b['id']===_0x3a5bbf['id'];});_0x31de94(_0x54d059);}else{_0x31de94({'count':_0x493e64['length'],'rows':_0x493e64});}});},'ChatQueues':function(){return new Promise(function(_0x58efe9){var _0x392b91=[];for(var _0x465222 in _0x4801d6[_0xdf76('0x4c')]){if(_0x4801d6[_0xdf76('0x4c')][_0xdf76('0x47')](_0x465222)){var _0x328e99=_0x4801d6['chatQueues'][_0x465222];var _0x5c38ae={'id':_0x328e99['id'],'available':_0x328e99[_0xdf76('0x4d')],'loggedIn':_0x328e99[_0xdf76('0x4e')],'name':_0x328e99[_0xdf76('0x4f')],'paused':_0x328e99[_0xdf76('0x50')],'waiting':_0x328e99[_0xdf76('0x51')]};_0x392b91['push'](_0x5c38ae);}}_0x58efe9({'count':_0x392b91[_0xdf76('0x1a')],'rows':_0x392b91});});},'MailQueues':function(){return new Promise(function(_0x30a47b){var _0x140ffa=[];for(var _0x331198 in _0x4801d6[_0xdf76('0x52')]){if(_0x4801d6[_0xdf76('0x52')]['hasOwnProperty'](_0x331198)){var _0x34f196=_0x4801d6[_0xdf76('0x52')][_0x331198];var _0x7a448f={'id':_0x34f196['id'],'available':_0x34f196[_0xdf76('0x4d')],'loggedIn':_0x34f196[_0xdf76('0x4e')],'name':_0x34f196[_0xdf76('0x4f')],'paused':_0x34f196['paused'],'waiting':_0x34f196[_0xdf76('0x51')]};_0x140ffa[_0xdf76('0x21')](_0x7a448f);}}_0x30a47b({'count':_0x140ffa[_0xdf76('0x1a')],'rows':_0x140ffa});});},'OpenchannelQueues':function(){return new Promise(function(_0x4cf4e8){var _0x3374dc=[];for(var _0x1ee9ea in _0x4801d6[_0xdf76('0x53')]){if(_0x4801d6['openchannelQueues'][_0xdf76('0x47')](_0x1ee9ea)){var _0x3535be=_0x4801d6[_0xdf76('0x53')][_0x1ee9ea];var _0xbbe82e={'id':_0x3535be['id'],'available':_0x3535be['available'],'loggedIn':_0x3535be[_0xdf76('0x4e')],'name':_0x3535be[_0xdf76('0x4f')],'paused':_0x3535be[_0xdf76('0x50')],'waiting':_0x3535be[_0xdf76('0x51')]};_0x3374dc['push'](_0xbbe82e);}}_0x4cf4e8({'count':_0x3374dc[_0xdf76('0x1a')],'rows':_0x3374dc});});},'SmsQueues':function(){return new Promise(function(_0x484d57){var _0x26b7aa=[];for(var _0x4634c5 in _0x4801d6[_0xdf76('0x54')]){if(_0x4801d6[_0xdf76('0x54')][_0xdf76('0x47')](_0x4634c5)){var _0x2205b7=_0x4801d6['smsQueues'][_0x4634c5];var _0x74ed08={'id':_0x2205b7['id'],'available':_0x2205b7[_0xdf76('0x4d')],'loggedIn':_0x2205b7[_0xdf76('0x4e')],'name':_0x2205b7[_0xdf76('0x4f')],'paused':_0x2205b7[_0xdf76('0x50')],'waiting':_0x2205b7[_0xdf76('0x51')]};_0x26b7aa[_0xdf76('0x21')](_0x74ed08);}}_0x484d57({'count':_0x26b7aa['length'],'rows':_0x26b7aa});});},'FaxQueues':function(){return new Promise(function(_0x3dc7a2){var _0x48b07e=[];for(var _0x4312b5 in _0x4801d6['faxQueues']){if(_0x4801d6[_0xdf76('0x55')][_0xdf76('0x47')](_0x4312b5)){var _0xe7a437=_0x4801d6[_0xdf76('0x55')][_0x4312b5];var _0x5caa1d={'id':_0xe7a437['id'],'available':_0xe7a437[_0xdf76('0x4d')],'loggedIn':_0xe7a437['loggedIn'],'name':_0xe7a437[_0xdf76('0x4f')],'paused':_0xe7a437[_0xdf76('0x50')],'waiting':_0xe7a437['waiting']};_0x48b07e['push'](_0x5caa1d);}}_0x3dc7a2({'count':_0x48b07e['length'],'rows':_0x48b07e});});},'WhatsappQueues':function(){return new Promise(function(_0x55f80a){var _0x1ff110=[];for(var _0x3618e1 in _0x4801d6[_0xdf76('0x56')]){if(_0x4801d6[_0xdf76('0x56')][_0xdf76('0x47')](_0x3618e1)){var _0x40f5d4=_0x4801d6['whatsappQueues'][_0x3618e1];var _0x14c8a8={'id':_0x40f5d4['id'],'available':_0x40f5d4[_0xdf76('0x4d')],'loggedIn':_0x40f5d4['loggedIn'],'name':_0x40f5d4[_0xdf76('0x4f')],'paused':_0x40f5d4['paused'],'waiting':_0x40f5d4[_0xdf76('0x51')]};_0x1ff110['push'](_0x14c8a8);}}_0x55f80a({'count':_0x1ff110['length'],'rows':_0x1ff110});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x296f45){var _0x654e70=_['values'](_0x4801d6[_0xdf76('0x57')]);_0x296f45({'count':_0x654e70[_0xdf76('0x1a')],'rows':_0x654e70});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x4477e0){var _0x5b1e7f=_['values'](_0x4801d6[_0xdf76('0x58')]);_0x4477e0({'count':_0x5b1e7f['length'],'rows':_0x5b1e7f});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x3516a4){var _0x3fc131=_[_0xdf76('0x59')](_0x4801d6[_0xdf76('0x5a')]);_0x3516a4({'count':_0x3fc131[_0xdf76('0x1a')],'rows':_0x3fc131});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2d7802){var _0x1a070b=_['values'](_0x4801d6[_0xdf76('0x5b')]);_0x2d7802({'count':_0x1a070b[_0xdf76('0x1a')],'rows':_0x1a070b});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x595472){var _0xbbe44d=_[_0xdf76('0x59')](_0x4801d6['faxQueuesWaitingInteractions']);_0x595472({'count':_0xbbe44d[_0xdf76('0x1a')],'rows':_0xbbe44d});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x9aca2f){var _0xa798b2=_[_0xdf76('0x59')](_0x4801d6[_0xdf76('0x5c')]);_0x9aca2f({'count':_0xa798b2[_0xdf76('0x1a')],'rows':_0xa798b2});});}};var _0x50b880=jayson[_0xdf76('0x5d')](_0x16ac38)[_0xdf76('0x5e')]();_0x50b880['on'](_0xdf76('0x35'),function(_0x6c8fc){logger[_0xdf76('0x35')](JSON[_0xdf76('0x5f')](_0x6c8fc));return _0x148b50(_0x6c8fc);});_0x50b880[_0xdf76('0x60')](0x232c,_0xdf76('0x61'),function(){console['log'](_0xdf76('0x62'),0x232c);return _0xc68b6d('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x7e53=['CurrentCapacity','updateRealtime','agent\x20not\x20found','find','chatQueues','loggedIn','name','paused','mailQueues','available','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','app','.js','appdata','mail','push','slice','join','dialogflow','split','amazonlex','tag','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','condition','intervals','./applications/','info','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','agent','agents','end','QueueReport','update','catch','message\x20is\x20empty','busy','busyQueue','capacity','hasOwnProperty'];(function(_0x151f38,_0x452dc3){var _0xeeac1f=function(_0xc127c5){while(--_0xc127c5){_0x151f38['push'](_0x151f38['shift']());}};_0xeeac1f(++_0x452dc3);}(_0x7e53,0xe5));var _0x37e5=function(_0x12ea57,_0x3336dc){_0x12ea57=_0x12ea57-0x0;var _0xf60ddf=_0x7e53[_0x12ea57];return _0xf60ddf;};'use strict';var _=require(_0x37e5('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0x37e5('0x1'));var BPromise=require(_0x37e5('0x2'));var utils=require(_0x37e5('0x3'));var sUtils=require(_0x37e5('0x4'));var logger=require(_0x37e5('0x5'))(_0x37e5('0x6'));var rpc={'openchannelQueueReport':require(_0x37e5('0x7')),'mailQueueReport':require(_0x37e5('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x37e5('0x9')),'faxQueueReport':require(_0x37e5('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x37e5('0xb'));function getId(_0x21ee72,_0x3fa767,_0x3717a9){return util[_0x37e5('0xc')]('%s.%s.%s',_0x21ee72,_0x3fa767||0x0,_0x3717a9||0x0);}function getIntervals(_0x2d35ce,_0x34dc75){var _0x866db5=[];if(!_[_0x37e5('0xd')](_0x34dc75[_0x37e5('0xe')])&&!_[_0x37e5('0xd')](_0x2d35ce[_0x34dc75['IntervalId']])&&!_['isNil'](_0x2d35ce[_0x34dc75[_0x37e5('0xe')]][_0x37e5('0xf')])){_0x866db5=_[_0x37e5('0x10')](_0x2d35ce[_0x34dc75[_0x37e5('0xe')]][_0x37e5('0xf')],_0x37e5('0x11'));}else if(!_[_0x37e5('0xd')](_0x34dc75[_0x37e5('0x11')])){_0x866db5=[_0x34dc75[_0x37e5('0x11')]];}return _0x866db5;}exports[_0x37e5('0x12')]=function(_0x324e21){_0x324e21[_0x37e5('0x13')]={};return new BPromise(function(_0x258eb4,_0x511098){var _0x5b7d6a={'Start':function(_0x52ad15){var _0x1e3538=this;return new Promise(function(_0x34f837,_0x43f014){if(_0x52ad15){try{var _0x17d17c=[];var _0x20a196=getId(_0x52ad15[_0x37e5('0x14')],_0x52ad15[_0x37e5('0x15')]?_0x52ad15[_0x37e5('0x15')]['id']:0x0,_0x52ad15[_0x37e5('0x16')]?_0x52ad15[_0x37e5('0x16')]['id']:0x0);var _0x42fe8a=sUtils[_0x37e5('0x17')](_0x324e21,_0x52ad15);if(!_0x42fe8a&&_0x52ad15[_0x37e5('0x18')]&&_[_0x37e5('0x19')](_0x52ad15[_0x37e5('0x18')])&&_0x52ad15[_0x37e5('0x18')][_0x37e5('0x1a')]){for(var _0x25ce86=0x0;_0x25ce86<_0x52ad15[_0x37e5('0x18')]['length'];_0x25ce86+=0x1){var _0x5ab8dc=_0x52ad15[_0x37e5('0x18')][_0x25ce86];if(fs[_0x37e5('0x1b')](path['join'](__dirname,_0x37e5('0x18'),_0x5ab8dc[_0x37e5('0x1c')]+_0x37e5('0x1d')))){var _0x3ae569=[];switch(_0x5ab8dc[_0x37e5('0x1c')]['toLowerCase']()){case'autoreply':var _0x28ae5d=_0x5ab8dc[_0x37e5('0x1e')]['split'](',');if(_0x52ad15['channel']===_0x37e5('0x1f')){_0x3ae569['push'](_0x28ae5d[0x0]);_0x3ae569[_0x37e5('0x20')](_0x28ae5d[0x1]);_0x3ae569[_0x37e5('0x20')](_0x28ae5d[_0x37e5('0x21')](0x2,_0x28ae5d[_0x37e5('0x1a')])[_0x37e5('0x22')](','));}else{_0x3ae569[_0x37e5('0x20')](_0x28ae5d[0x0]);_0x3ae569[_0x37e5('0x20')](_0x28ae5d[_0x37e5('0x21')](0x1,_0x28ae5d['length'])[_0x37e5('0x22')](','));}break;case _0x37e5('0x23'):var _0x4671ed=_0x5ab8dc[_0x37e5('0x1e')][_0x37e5('0x24')](',');_0x3ae569[_0x37e5('0x20')](_0x4671ed[0x0]);_0x3ae569[_0x37e5('0x20')](_0x4671ed[0x1]);_0x3ae569['push'](_0x4671ed[_0x37e5('0x21')](0x2,_0x4671ed[_0x37e5('0x1a')])[_0x37e5('0x22')](','));break;case'dialogflowv2':var _0x3da513=_0x5ab8dc[_0x37e5('0x1e')][_0x37e5('0x24')](',');_0x3ae569[_0x37e5('0x20')](_0x3da513[0x0]);_0x3ae569['push'](_0x3da513[0x1]);_0x3ae569[_0x37e5('0x20')](_0x3da513[0x2]);_0x3ae569[_0x37e5('0x20')](_0x3da513[0x3]);_0x3ae569[_0x37e5('0x20')](_0x3da513[_0x37e5('0x21')](0x4,_0x3da513[_0x37e5('0x1a')])[_0x37e5('0x22')](','));break;case _0x37e5('0x25'):var _0x52ba44=_0x5ab8dc['appdata'][_0x37e5('0x24')](',');_0x3ae569[_0x37e5('0x20')](_0x52ba44[0x0]);_0x3ae569['push'](_0x52ba44[0x1]);_0x3ae569['push'](_0x52ba44[0x2]);_0x3ae569[_0x37e5('0x20')](_0x52ba44[0x3]);_0x3ae569['push'](_0x52ba44[_0x37e5('0x21')](0x4,_0x52ba44['length'])[_0x37e5('0x22')](','));break;case _0x37e5('0x15'):_0x3ae569['push'](_0x5ab8dc['appdata']);break;case _0x37e5('0x26'):_0x3ae569['push'](_0x5ab8dc['TagId']);_0x3ae569[_0x37e5('0x20')](_0x5ab8dc[_0x37e5('0x1e')]);break;case _0x37e5('0x27'):var _0x4bd665=utils[_0x37e5('0x28')](_0x52ad15[_0x37e5('0x29')][_0x37e5('0x2a')],_0x52ad15);var _0x34762c=_0x5ab8dc[_0x37e5('0x1e')][_0x37e5('0x24')](',');_0x3ae569[_0x37e5('0x20')](_0x34762c[0x0]);_0x3ae569['push'](_0x34762c[0x1]);_0x3ae569['push'](_0x34762c[0x2]);_0x3ae569['push'](_0x34762c[0x3]);_0x3ae569[_0x37e5('0x20')](_0x34762c[0x4]);_0x3ae569[_0x37e5('0x20')](_0x34762c[0x5]);_0x3ae569[_0x37e5('0x20')](_0x34762c[0x6]);_0x3ae569[_0x37e5('0x20')](_0x34762c[0x7]);_0x3ae569[_0x37e5('0x20')](_0x34762c[0x8]);_0x3ae569[_0x37e5('0x20')](_0x34762c[0x9]);_0x3ae569[_0x37e5('0x20')](_0x34762c[0xa]);_0x3ae569[_0x37e5('0x20')](_0x52ad15[_0x37e5('0x16')]['id']);_0x3ae569[_0x37e5('0x20')](_0x52ad15[_0x37e5('0x15')]['id']);_0x3ae569['push'](_0x5ab8dc[_0x37e5('0x2b')]);_0x3ae569[_0x37e5('0x20')](_0x52ad15[_0x37e5('0x16')][_0x37e5('0x2c')]);_0x3ae569[_0x37e5('0x20')](_0x52ad15[_0x37e5('0x2d')][_0x37e5('0x2d')]);_0x3ae569[_0x37e5('0x20')](_0x4bd665);break;default:_0x3ae569=_[_0x37e5('0xd')](_0x5ab8dc['appdata'])?[]:_0x5ab8dc[_0x37e5('0x1e')]['split'](',');}var _0x19c0ce={'id':util[_0x37e5('0xc')](_0x37e5('0x2e'),_0x20a196,_0x5ab8dc['id'],_0x5ab8dc['app']),'condition':require('./interval')[_0x37e5('0x2f')](_0x20a196,getIntervals(_0x324e21[_0x37e5('0x30')],_0x5ab8dc),_0x324e21),'consequence':require(_0x37e5('0x31')+_0x5ab8dc['app'])['consequence'](_0x20a196,_0x3ae569,_0x324e21,_0x52ad15),'p':_0x5ab8dc['priority']||0x0};logger[_0x37e5('0x32')](_0x37e5('0x33'),_0x19c0ce['id'],'on\x20interval',getIntervals(_0x324e21[_0x37e5('0x30')],_0x5ab8dc)[_0x37e5('0x22')](_0x37e5('0x34')));_0x17d17c[_0x37e5('0x20')](_0x19c0ce);}else{logger[_0x37e5('0x35')](_0x37e5('0x36'),path[_0x37e5('0x22')](__dirname,_0x37e5('0x18'),_0x5ab8dc[_0x37e5('0x1c')]+_0x37e5('0x1d')));}}_0x324e21['rules'][_0x20a196]=new RuleEngine(_0x17d17c);_0x324e21[_0x37e5('0x13')][_0x20a196][_0x37e5('0x37')](_0x52ad15,function(_0x40a54a){logger[_0x37e5('0x32')](_0x37e5('0x38'),JSON['stringify'](_0x40a54a[_0x37e5('0x39')]));if(_0x324e21[_0x37e5('0x13')][_0x20a196]){_0x324e21[_0x37e5('0x13')][_0x20a196][_0x37e5('0x3a')](_0x37e5('0x3b'));}});return _0x34f837({'code':0xc8,'message':_0x52ad15});}else{if(_0x42fe8a){logger['info'](util[_0x37e5('0xc')](_0x37e5('0x3c'),_0x20a196));}else{logger['info'](_0x37e5('0x3d'));}return _0x34f837({'code':0xc8,'message':_0x52ad15});}}catch(_0x553557){logger['error'](_0x553557[_0x37e5('0x3e')]);return _0x43f014(_0x1e3538[_0x37e5('0x35')](0x1f4,_0x553557));}}return _0x43f014('routing\x20is\x20empty');});},'AcceptMessage':function(_0x582429){var _0x25d340=this;return new Promise(function(_0x1bfb10,_0x3cdfe0){if(_0x582429[_0x37e5('0x3f')]&&_0x582429['agent']['id']){if(_0x324e21[_0x37e5('0x40')][_0x582429[_0x37e5('0x3f')]['id']]){_0x324e21[_0x37e5('0x40')][_0x582429[_0x37e5('0x3f')]['id']]['busy']=![];_0x324e21['agents'][_0x582429[_0x37e5('0x3f')]['id']]['busyQueue']=undefined;}}if(_0x582429[_0x37e5('0x15')]&&_0x582429[_0x37e5('0x15')]['id']){try{var _0x2726a0=getId(_0x582429['channel'],_0x582429[_0x37e5('0x15')]?_0x582429[_0x37e5('0x15')]['id']:0x0,_0x582429[_0x37e5('0x16')]?_0x582429[_0x37e5('0x16')]['id']:0x0);if(_0x324e21[_0x37e5('0x13')][_0x2726a0]){_0x324e21[_0x37e5('0x13')][_0x2726a0][_0x37e5('0x3a')](_0x37e5('0x41'));if(rpc[_0x582429[_0x37e5('0x14')]+_0x37e5('0x42')]){rpc[_0x582429['channel']+_0x37e5('0x42')][_0x37e5('0x43')](_0x2726a0,{'UserId':_0x582429[_0x37e5('0x15')]['UserId']})[_0x37e5('0x44')](function(){logger[_0x37e5('0x35')]('error\x20update\x20queue\x20report');});}}return _0x1bfb10({'code':0xc8,'message':_0x582429});}catch(_0xbb7ace){logger[_0x37e5('0x35')](_0xbb7ace[_0x37e5('0x3e')]);return _0x3cdfe0(_0x25d340[_0x37e5('0x35')](0x1f4,_0xbb7ace));}}logger['error'](_0x37e5('0x45'));return _0x3cdfe0(_0x25d340[_0x37e5('0x35')](0x1f4,_0x37e5('0x45')));});},'RejectMessage':function(_0x4f9992){var _0x408366=this;return new Promise(function(_0x2bd678,_0x3c27c5){if(_0x4f9992[_0x37e5('0x3f')]&&_0x4f9992[_0x37e5('0x3f')]['id']){try{if(_0x324e21[_0x37e5('0x40')][_0x4f9992[_0x37e5('0x3f')]['id']]){_0x324e21['agents'][_0x4f9992[_0x37e5('0x3f')]['id']][_0x37e5('0x46')]=![];_0x324e21[_0x37e5('0x40')][_0x4f9992['agent']['id']][_0x37e5('0x47')]=undefined;}return _0x2bd678({'code':0xc8,'message':_0x4f9992});}catch(_0x5951c5){logger[_0x37e5('0x35')](_0x5951c5['stack']);return _0x3c27c5(_0x408366['error'](0x1f4,_0x5951c5));}}logger[_0x37e5('0x35')](_0x37e5('0x45'));return _0x3c27c5(_0x408366[_0x37e5('0x35')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x1bd743){var _0x3d0fe2=this;return new Promise(function(_0x46d2ec,_0x596b13){if(_0x1bd743['channel']&&_0x1bd743[_0x37e5('0x16')]&&_0x1bd743[_0x37e5('0x16')]['id']){try{var _0xf32267=getId(_0x1bd743[_0x37e5('0x14')],_0x1bd743['message']?_0x1bd743[_0x37e5('0x15')]['id']:0x0,_0x1bd743[_0x37e5('0x16')]?_0x1bd743[_0x37e5('0x16')]['id']:0x0);if(_0x324e21[_0x37e5('0x13')][_0xf32267]){_0x324e21['rules'][_0xf32267][_0x37e5('0x3a')]('end');}return _0x46d2ec({'code':0xc8,'message':_0x1bd743});}catch(_0x5ea166){logger[_0x37e5('0x35')](_0x5ea166[_0x37e5('0x3e')]);return _0x596b13(_0x3d0fe2[_0x37e5('0x35')](0x1f4,_0x5ea166));}}logger[_0x37e5('0x35')](_0x37e5('0x45'));return _0x596b13(_0x3d0fe2[_0x37e5('0x35')](0x1f4,_0x37e5('0x45')));});},'AgentCapacity':function(_0xf9fad8){var _0x5b535a=this;return new Promise(function(_0x33cf21,_0x1006f2){if(_0x324e21['agents']['hasOwnProperty'](_0xf9fad8['id'])){for(var _0x848112 in _0xf9fad8[_0x37e5('0x48')]){if(_0xf9fad8['capacity'][_0x37e5('0x49')](_0x848112)){if(_0x324e21['agents'][_0xf9fad8['id']][_0x37e5('0x49')](_0x848112+_0x37e5('0x4a'))){_0x324e21[_0x37e5('0x40')][_0xf9fad8['id']][_0x848112+_0x37e5('0x4a')]=parseInt(_0xf9fad8[_0x37e5('0x48')][_0x848112],0xa);}}}_0x324e21[_0x37e5('0x40')][_0xf9fad8['id']][_0x37e5('0x4b')]();return _0x33cf21({'code':0xc8,'message':_0x324e21[_0x37e5('0x40')][_0xf9fad8['id']]});}else{return _0x1006f2(_0x5b535a['error'](0x1f4,_0x37e5('0x4c')));}});},'Agents':function(_0x368f63){return new Promise(function(_0x2d7631){var _0x14ab56=_['values'](_0x324e21[_0x37e5('0x40')]);if(_0x368f63&&_0x368f63['id']){var _0x43508d=_[_0x37e5('0x4d')](_0x14ab56,function(_0x6281cb){return _0x6281cb['id']===_0x368f63['id'];});_0x2d7631(_0x43508d);}else{_0x2d7631({'count':_0x14ab56[_0x37e5('0x1a')],'rows':_0x14ab56});}});},'ChatQueues':function(){return new Promise(function(_0x286695){var _0xa8b28c=[];for(var _0x518487 in _0x324e21[_0x37e5('0x4e')]){if(_0x324e21[_0x37e5('0x4e')][_0x37e5('0x49')](_0x518487)){var _0x7ca553=_0x324e21['chatQueues'][_0x518487];var _0x1469fb={'id':_0x7ca553['id'],'available':_0x7ca553['available'],'loggedIn':_0x7ca553[_0x37e5('0x4f')],'name':_0x7ca553[_0x37e5('0x50')],'paused':_0x7ca553[_0x37e5('0x51')],'waiting':_0x7ca553['waiting']};_0xa8b28c[_0x37e5('0x20')](_0x1469fb);}}_0x286695({'count':_0xa8b28c[_0x37e5('0x1a')],'rows':_0xa8b28c});});},'MailQueues':function(){return new Promise(function(_0x3134ee){var _0x2ae523=[];for(var _0x2d947f in _0x324e21[_0x37e5('0x52')]){if(_0x324e21['mailQueues'][_0x37e5('0x49')](_0x2d947f)){var _0x311b15=_0x324e21[_0x37e5('0x52')][_0x2d947f];var _0x42056c={'id':_0x311b15['id'],'available':_0x311b15[_0x37e5('0x53')],'loggedIn':_0x311b15[_0x37e5('0x4f')],'name':_0x311b15[_0x37e5('0x50')],'paused':_0x311b15['paused'],'waiting':_0x311b15[_0x37e5('0x54')]};_0x2ae523[_0x37e5('0x20')](_0x42056c);}}_0x3134ee({'count':_0x2ae523['length'],'rows':_0x2ae523});});},'OpenchannelQueues':function(){return new Promise(function(_0x5d41bb){var _0x2da8f1=[];for(var _0x228dea in _0x324e21[_0x37e5('0x55')]){if(_0x324e21[_0x37e5('0x55')]['hasOwnProperty'](_0x228dea)){var _0x46df30=_0x324e21[_0x37e5('0x55')][_0x228dea];var _0x1c7402={'id':_0x46df30['id'],'available':_0x46df30['available'],'loggedIn':_0x46df30[_0x37e5('0x4f')],'name':_0x46df30[_0x37e5('0x50')],'paused':_0x46df30[_0x37e5('0x51')],'waiting':_0x46df30['waiting']};_0x2da8f1['push'](_0x1c7402);}}_0x5d41bb({'count':_0x2da8f1[_0x37e5('0x1a')],'rows':_0x2da8f1});});},'SmsQueues':function(){return new Promise(function(_0x1b12d9){var _0x30a563=[];for(var _0x222702 in _0x324e21[_0x37e5('0x56')]){if(_0x324e21[_0x37e5('0x56')][_0x37e5('0x49')](_0x222702)){var _0x2c8a15=_0x324e21['smsQueues'][_0x222702];var _0x2e7c5c={'id':_0x2c8a15['id'],'available':_0x2c8a15[_0x37e5('0x53')],'loggedIn':_0x2c8a15['loggedIn'],'name':_0x2c8a15[_0x37e5('0x50')],'paused':_0x2c8a15[_0x37e5('0x51')],'waiting':_0x2c8a15[_0x37e5('0x54')]};_0x30a563[_0x37e5('0x20')](_0x2e7c5c);}}_0x1b12d9({'count':_0x30a563['length'],'rows':_0x30a563});});},'FaxQueues':function(){return new Promise(function(_0x159381){var _0x38b130=[];for(var _0x84647b in _0x324e21['faxQueues']){if(_0x324e21[_0x37e5('0x57')][_0x37e5('0x49')](_0x84647b)){var _0x28c9b4=_0x324e21[_0x37e5('0x57')][_0x84647b];var _0x4bfc3e={'id':_0x28c9b4['id'],'available':_0x28c9b4['available'],'loggedIn':_0x28c9b4['loggedIn'],'name':_0x28c9b4[_0x37e5('0x50')],'paused':_0x28c9b4[_0x37e5('0x51')],'waiting':_0x28c9b4[_0x37e5('0x54')]};_0x38b130['push'](_0x4bfc3e);}}_0x159381({'count':_0x38b130['length'],'rows':_0x38b130});});},'WhatsappQueues':function(){return new Promise(function(_0x38d4e7){var _0x3baf5a=[];for(var _0x16f6dc in _0x324e21['whatsappQueues']){if(_0x324e21[_0x37e5('0x58')][_0x37e5('0x49')](_0x16f6dc)){var _0x55f055=_0x324e21[_0x37e5('0x58')][_0x16f6dc];var _0x42a276={'id':_0x55f055['id'],'available':_0x55f055['available'],'loggedIn':_0x55f055[_0x37e5('0x4f')],'name':_0x55f055['name'],'paused':_0x55f055[_0x37e5('0x51')],'waiting':_0x55f055[_0x37e5('0x54')]};_0x3baf5a[_0x37e5('0x20')](_0x42a276);}}_0x38d4e7({'count':_0x3baf5a[_0x37e5('0x1a')],'rows':_0x3baf5a});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x45c5f5){var _0x1b5b2c=_[_0x37e5('0x59')](_0x324e21[_0x37e5('0x5a')]);_0x45c5f5({'count':_0x1b5b2c[_0x37e5('0x1a')],'rows':_0x1b5b2c});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x287a7c){var _0x318e27=_['values'](_0x324e21[_0x37e5('0x5b')]);_0x287a7c({'count':_0x318e27[_0x37e5('0x1a')],'rows':_0x318e27});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x3aadbb){var _0x42743d=_['values'](_0x324e21[_0x37e5('0x5c')]);_0x3aadbb({'count':_0x42743d[_0x37e5('0x1a')],'rows':_0x42743d});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x364922){var _0x595a3d=_[_0x37e5('0x59')](_0x324e21[_0x37e5('0x5d')]);_0x364922({'count':_0x595a3d[_0x37e5('0x1a')],'rows':_0x595a3d});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x313ac9){var _0x46122c=_[_0x37e5('0x59')](_0x324e21[_0x37e5('0x5e')]);_0x313ac9({'count':_0x46122c['length'],'rows':_0x46122c});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x581647){var _0x1219b2=_[_0x37e5('0x59')](_0x324e21[_0x37e5('0x5f')]);_0x581647({'count':_0x1219b2[_0x37e5('0x1a')],'rows':_0x1219b2});});}};var _0x5dcf20=jayson[_0x37e5('0x60')](_0x5b7d6a)[_0x37e5('0x61')]();_0x5dcf20['on']('error',function(_0x3d89be){logger[_0x37e5('0x35')](JSON['stringify'](_0x3d89be));return _0x511098(_0x3d89be);});_0x5dcf20[_0x37e5('0x12')](0x232c,_0x37e5('0x62'),function(){console[_0x37e5('0x63')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x258eb4(_0x37e5('0x64')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index ba3fd0b..d9a442f 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 _0x19da=['stop','length','Command','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','bluebird','jayson/promise','lodash','routing','client','http','request','then','error','message','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED'];(function(_0x54fab5,_0x887e79){var _0x35e62c=function(_0x4b61d2){while(--_0x4b61d2){_0x54fab5['push'](_0x54fab5['shift']());}};_0x35e62c(++_0x887e79);}(_0x19da,0x1de));var _0xa19d=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0x19da[_0x4bb145];return _0x4db596;};'use strict';var util=require('util');var BPromise=require(_0xa19d('0x0'));var jayson=require(_0xa19d('0x1'));var _=require(_0xa19d('0x2'));var logger=require('../../../config/logger')(_0xa19d('0x3'));var client=jayson[_0xa19d('0x4')][_0xa19d('0x5')]({'port':0x232a});function request(_0x2600d5,_0x2c8f67){return new BPromise(function(_0x3e40d9,_0x5a43ff){return client[_0xa19d('0x6')](_0x2600d5,_0x2c8f67)[_0xa19d('0x7')](function(_0x1e1820){if(_0x1e1820[_0xa19d('0x8')]){return _0x5a43ff(_0x1e1820[_0xa19d('0x8')][_0xa19d('0x9')]);}else{return _0x3e40d9(_0x1e1820[_0xa19d('0xa')]);}})[_0xa19d('0xb')](function(_0x5148d5){return _0x5a43ff(_0x5148d5);});});}exports['condition']=function(_0x823124,_0x24ace4,_0x280a06){return function(_0x4c38a2){if(_0x280a06[_0xa19d('0xc')]&&!_0x280a06['rules'][_0x823124]){logger[_0xa19d('0xd')](_0xa19d('0xe'),_0x823124);return _0x4c38a2[_0xa19d('0xf')]();}var _0xb41580=[];for(var _0xeef0f1=0x0;_0xeef0f1<_0x24ace4[_0xa19d('0x10')];_0xeef0f1+=0x1){_0xb41580['push'](request(_0xa19d('0x11'),{'command':util['format'](_0xa19d('0x12'),_0x24ace4[_0xeef0f1])})['then'](function(_0x98ba78){return _0x98ba78&&_0x98ba78['message']&&_0x98ba78['message'][_0xa19d('0x13')](_0xa19d('0x14'))>=0x0?!![]:![];})[_0xa19d('0xb')](function(_0x512d4a){logger[_0xa19d('0x8')](_0xa19d('0x15'),_0x823124,_0x24ace4[_0xeef0f1]);}));}BPromise[_0xa19d('0x16')](_0xb41580)[_0xa19d('0x7')](function(_0x26c799){var _0x1cf692=_[_0xa19d('0x17')](_0x26c799);logger[_0xa19d('0xd')](_0xa19d('0x18'),_0x823124,_0x24ace4[_0xa19d('0x19')](_0xa19d('0x1a')),_0x1cf692);_0x4c38a2[_0xa19d('0x1b')](_0x1cf692);})[_0xa19d('0xb')](function(_0x52f070){console[_0xa19d('0x1c')](_0x52f070);logger[_0xa19d('0x8')](_0xa19d('0x18'),_0x823124,_0x24ace4['join'](_0xa19d('0x1a')),_0x52f070['stack']);_0x4c38a2['stop']();});};}; \ No newline at end of file +var _0x7d4c=['request','then','error','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','Command','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','bluebird','jayson/promise','lodash','../../../config/logger','routing','http'];(function(_0x5f3ab9,_0x99d12f){var _0x3f92c9=function(_0x294182){while(--_0x294182){_0x5f3ab9['push'](_0x5f3ab9['shift']());}};_0x3f92c9(++_0x99d12f);}(_0x7d4c,0x90));var _0xc7d4=function(_0x4c3070,_0xc2fb4c){_0x4c3070=_0x4c3070-0x0;var _0x536a44=_0x7d4c[_0x4c3070];return _0x536a44;};'use strict';var util=require('util');var BPromise=require(_0xc7d4('0x0'));var jayson=require(_0xc7d4('0x1'));var _=require(_0xc7d4('0x2'));var logger=require(_0xc7d4('0x3'))(_0xc7d4('0x4'));var client=jayson['client'][_0xc7d4('0x5')]({'port':0x232a});function request(_0x599a4c,_0x94075b){return new BPromise(function(_0xcf2342,_0x58f2eb){return client[_0xc7d4('0x6')](_0x599a4c,_0x94075b)[_0xc7d4('0x7')](function(_0x326ce5){if(_0x326ce5['error']){return _0x58f2eb(_0x326ce5[_0xc7d4('0x8')]['message']);}else{return _0xcf2342(_0x326ce5[_0xc7d4('0x9')]);}})[_0xc7d4('0xa')](function(_0x526640){return _0x58f2eb(_0x526640);});});}exports[_0xc7d4('0xb')]=function(_0x5c0d91,_0x4eef47,_0x38c443){return function(_0x4b7569){if(_0x38c443[_0xc7d4('0xc')]&&!_0x38c443['rules'][_0x5c0d91]){logger['info'](_0xc7d4('0xd'),_0x5c0d91);return _0x4b7569[_0xc7d4('0xe')]();}var _0x1d1d5f=[];for(var _0x33b3bc=0x0;_0x33b3bc<_0x4eef47['length'];_0x33b3bc+=0x1){_0x1d1d5f['push'](request(_0xc7d4('0xf'),{'command':util['format'](_0xc7d4('0x10'),_0x4eef47[_0x33b3bc])})[_0xc7d4('0x7')](function(_0x46edb6){return _0x46edb6&&_0x46edb6[_0xc7d4('0x11')]&&_0x46edb6[_0xc7d4('0x11')][_0xc7d4('0x12')](_0xc7d4('0x13'))>=0x0?!![]:![];})[_0xc7d4('0xa')](function(_0x1ed7b4){logger['error'](_0xc7d4('0x14'),_0x5c0d91,_0x4eef47[_0x33b3bc]);}));}BPromise[_0xc7d4('0x15')](_0x1d1d5f)[_0xc7d4('0x7')](function(_0x2eab58){var _0x4622ed=_[_0xc7d4('0x16')](_0x2eab58);logger[_0xc7d4('0x17')](_0xc7d4('0x18'),_0x5c0d91,_0x4eef47[_0xc7d4('0x19')](_0xc7d4('0x1a')),_0x4622ed);_0x4b7569[_0xc7d4('0x1b')](_0x4622ed);})['catch'](function(_0x4320f6){console[_0xc7d4('0x1c')](_0x4320f6);logger[_0xc7d4('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x5c0d91,_0x4eef47[_0xc7d4('0x19')]('\x20|\x20'),_0x4320f6[_0xc7d4('0x1d')]);_0x4b7569[_0xc7d4('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index b0a69cb..cec7c04 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 _0x1d2d=['called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','isNil','[%s][agents][agentringnoanswer]','info','agentringnoanswer','now','timeout','reason','holdtime','ringtime','push','error','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','talktime','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','[%s][agents][attendedtransfer]\x20agent:%s','transfertargetuniqueid','hangup','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','./utils','format','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','CreateVoiceAgentReport','request','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','lastevent'];(function(_0x55cbc1,_0x264087){var _0x56c770=function(_0x61089){while(--_0x61089){_0x55cbc1['push'](_0x55cbc1['shift']());}};_0x56c770(++_0x264087);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x5b7b1d,_0x1309b7){_0x5b7b1d=_0x5b7b1d-0x0;var _0x43ee4f=_0x1d2d[_0x5b7b1d];return _0x43ee4f;};'use strict';var _=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var utils=require(_0xd1d2('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0xd275bc,_0x3401a9){utils['info'](util[_0xd1d2('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0xd275bc['uniqueid'],_0xd275bc[_0xd1d2('0x4')],_0xd275bc[_0xd1d2('0x5')],_0xd275bc[_0xd1d2('0x6')],_0xd275bc[_0xd1d2('0x7')],_0xd275bc[_0xd1d2('0x8')],_0xd275bc[_0xd1d2('0x9')],_0xd275bc['lastevent']));if(_0xd275bc[_0xd1d2('0x5')]){utils[_0xd1d2('0xa')](_0xd275bc[_0xd1d2('0x5')])[_0xd1d2('0xb')](function(_0xdba345){if(_0xdba345){_0xd275bc[_0xd1d2('0xc')]=_0xdba345[_0xd1d2('0xc')];_0xd275bc[_0xd1d2('0xd')]=_0xd275bc[_0xd1d2('0xe')]?_0xdba345[_0xd1d2('0xf')]:![];_0xd275bc[_0xd1d2('0x10')]=_0xd275bc[_0xd1d2('0xd')]?_0xdba345[_0xd1d2('0x11')]:0x0;}utils['request'](_0xd1d2('0x12'),_0xd275bc);});}else{utils[_0xd1d2('0x13')](_0xd1d2('0x12'),_0xd275bc);}if(_0x3401a9){delete transfers[_0xd275bc[_0xd1d2('0x14')]];}else{delete agents[_0xd275bc[_0xd1d2('0x15')]];}}exports[_0xd1d2('0x16')]=function(_0x2df8a5){try{utils[_0xd1d2('0x17')](util[_0xd1d2('0x3')](_0xd1d2('0x18'),_0x2df8a5['uniqueid']),_0x2df8a5);agents[_0x2df8a5[_0xd1d2('0x15')]]=_0x2df8a5;agents[_0x2df8a5[_0xd1d2('0x15')]][_0xd1d2('0x19')]=utils['now']();agents[_0x2df8a5[_0xd1d2('0x15')]][_0xd1d2('0x1a')]=_0xd1d2('0x1b');agents[_0x2df8a5[_0xd1d2('0x15')]][_0xd1d2('0x9')]=null;agents[_0x2df8a5[_0xd1d2('0x15')]][_0xd1d2('0x1c')]=null;utils['info'](util['format'](_0xd1d2('0x1d'),_0x2df8a5['uniqueid'],agents[_0x2df8a5[_0xd1d2('0x15')]][_0xd1d2('0x6')],_0x2df8a5[_0xd1d2('0x15')]));}catch(_0x40d3dd){utils['error'](util['format'](_0xd1d2('0x18'),_0x2df8a5['uniqueid']),_0x40d3dd);}};exports['agentringnoanswer']=function(_0x1ab67c){try{if(!_[_0xd1d2('0x1e')](agents[_0x1ab67c[_0xd1d2('0x15')]])){utils[_0xd1d2('0x17')](util['format'](_0xd1d2('0x1f'),_0x1ab67c[_0xd1d2('0x14')]),_0x1ab67c);utils[_0xd1d2('0x20')](util['format']('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x1ab67c[_0xd1d2('0x14')],agents[_0x1ab67c[_0xd1d2('0x15')]][_0xd1d2('0x6')],_0x1ab67c[_0xd1d2('0x15')]));agents[_0x1ab67c[_0xd1d2('0x15')]][_0xd1d2('0x21')]=!![];agents[_0x1ab67c[_0xd1d2('0x15')]]['agentringnoanswerAt']=utils[_0xd1d2('0x22')]();agents[_0x1ab67c[_0xd1d2('0x15')]][_0xd1d2('0x1a')]=_0xd1d2('0x23');agents[_0x1ab67c[_0xd1d2('0x15')]][_0xd1d2('0x24')]=_0xd1d2('0x23');agents[_0x1ab67c[_0xd1d2('0x15')]][_0xd1d2('0x25')]=_0x1ab67c[_0xd1d2('0x26')]?parseInt(_0x1ab67c[_0xd1d2('0x26')])/0x3e8:0x0;agents[_0x1ab67c['destuniqueid']]['talktime']=0x0;unanswered[_0xd1d2('0x27')](_0x1ab67c[_0xd1d2('0x15')]);}}catch(_0x1e6072){utils[_0xd1d2('0x28')](util[_0xd1d2('0x3')]('[%s][agents][agentringnoanswer]',_0x1ab67c[_0xd1d2('0x14')]),_0x1e6072);}};exports[_0xd1d2('0x29')]=function(_0x383947){try{_['forIn'](agents,function(_0x19db00,_0x1db17f){if(_0x19db00[_0xd1d2('0x14')]==_0x383947['uniqueid']&&!_[_0xd1d2('0x2a')](unanswered,_0x19db00[_0xd1d2('0x15')])){utils[_0xd1d2('0x17')](util[_0xd1d2('0x3')](_0xd1d2('0x2b'),_0x383947[_0xd1d2('0x14')]),_0x383947);utils[_0xd1d2('0x20')](util[_0xd1d2('0x3')](_0xd1d2('0x2c'),_0x383947[_0xd1d2('0x14')],_0x19db00[_0xd1d2('0x6')],_0x19db00[_0xd1d2('0x15')]));_0x19db00[_0xd1d2('0x21')]=!![];_0x19db00[_0xd1d2('0x2d')]=utils[_0xd1d2('0x22')]();_0x19db00[_0xd1d2('0x1a')]=_0xd1d2('0x2e');_0x19db00[_0xd1d2('0x24')]='abandoned';_0x19db00[_0xd1d2('0x25')]=_0x383947[_0xd1d2('0x25')];_0x19db00[_0xd1d2('0x2f')]=0x0;writeDB(_0x19db00);}});}catch(_0x573d27){utils[_0xd1d2('0x28')](util['format']('[%s][agents][queuecallerabandon]',_0x383947[_0xd1d2('0x14')]),_0x573d27);}};exports[_0xd1d2('0x30')]=function(_0x1702be){try{if(agents[_0x1702be[_0xd1d2('0x15')]]){utils[_0xd1d2('0x17')](util[_0xd1d2('0x3')]('[%s][agents][agentconnect]',_0x1702be[_0xd1d2('0x14')]),_0x1702be);utils[_0xd1d2('0x20')](util['format'](_0xd1d2('0x31'),_0x1702be[_0xd1d2('0x14')],agents[_0x1702be[_0xd1d2('0x15')]][_0xd1d2('0x6')],_0x1702be['destuniqueid']));agents[_0x1702be['destuniqueid']][_0xd1d2('0x32')]=utils['now']();agents[_0x1702be['destuniqueid']]['connectedlinenum']=_0x1702be[_0xd1d2('0x9')];agents[_0x1702be['destuniqueid']][_0xd1d2('0x1c')]=_0x1702be['connectedlinename'];agents[_0x1702be['destuniqueid']]['holdtime']=_0x1702be[_0xd1d2('0x26')];agents[_0x1702be[_0xd1d2('0x15')]][_0xd1d2('0x1a')]=_0xd1d2('0x33');_[_0xd1d2('0x34')](agents,function(_0xb5bec2,_0x178f8b){if(_0xb5bec2[_0xd1d2('0x15')]!=_0x1702be[_0xd1d2('0x15')]&&_0xb5bec2[_0xd1d2('0x14')]==_0x1702be[_0xd1d2('0x14')]){_0xb5bec2[_0xd1d2('0x2f')]=0x0;_0xb5bec2[_0xd1d2('0x25')]=_0x1702be[_0xd1d2('0x26')];_0xb5bec2['agentringnoanswer']=!![];_0xb5bec2['agentringnoanswerAt']=utils[_0xd1d2('0x22')]();_0xb5bec2[_0xd1d2('0x1a')]=_0xd1d2('0x35');_0xb5bec2['reason']='answered_elsewhere';_0xb5bec2[_0xd1d2('0x36')]=_0x1702be[_0xd1d2('0x15')];_0xb5bec2['answeredelsewheremembername']=_0x1702be[_0xd1d2('0x6')];writeDB(_0xb5bec2);}});}}catch(_0x4c5d49){utils['error'](util[_0xd1d2('0x3')]('[%s][agents][agentconnect]',_0x1702be['uniqueid']),_0x4c5d49);}};exports[_0xd1d2('0xe')]=function(_0x320fa4){try{if(!_[_0xd1d2('0x1e')](agents[_0x320fa4['destuniqueid']])){utils[_0xd1d2('0x17')](util[_0xd1d2('0x3')](_0xd1d2('0x37'),_0x320fa4[_0xd1d2('0x14')]),_0x320fa4);utils['info'](util[_0xd1d2('0x3')](_0xd1d2('0x38'),_0x320fa4['uniqueid'],agents[_0x320fa4[_0xd1d2('0x15')]]['membername'],_0x320fa4[_0xd1d2('0x15')]));agents[_0x320fa4[_0xd1d2('0x15')]][_0xd1d2('0xe')]=!![];agents[_0x320fa4[_0xd1d2('0x15')]][_0xd1d2('0x39')]=utils['now']();agents[_0x320fa4['destuniqueid']][_0xd1d2('0x2f')]=utils[_0xd1d2('0x3a')](agents[_0x320fa4['destuniqueid']][_0xd1d2('0x39')],agents[_0x320fa4[_0xd1d2('0x15')]][_0xd1d2('0x32')]);agents[_0x320fa4[_0xd1d2('0x15')]][_0xd1d2('0x24')]=_0x320fa4[_0xd1d2('0x24')];agents[_0x320fa4[_0xd1d2('0x15')]]['lastevent']=_0xd1d2('0x3b');writeDB(agents[_0x320fa4[_0xd1d2('0x15')]]);}}catch(_0x5594f5){utils[_0xd1d2('0x28')](util[_0xd1d2('0x3')]('[%s][agents][agentcomplete]',_0x320fa4['uniqueid']),_0x5594f5);}};exports[_0xd1d2('0x3c')]=function(_0x182ea8){try{if(!_['isNil'](agents[_0x182ea8[_0xd1d2('0x3d')]])){utils[_0xd1d2('0x17')](util[_0xd1d2('0x3')](_0xd1d2('0x3e'),_0x182ea8[_0xd1d2('0x14')]),_0x182ea8);utils['info'](util['format'](_0xd1d2('0x3f'),_0x182ea8['uniqueid'],agents[_0x182ea8[_0xd1d2('0x3d')]][_0xd1d2('0x6')],agents[_0x182ea8['transfereruniqueid']][_0xd1d2('0x14')]));agents[_0x182ea8[_0xd1d2('0x3d')]]['transfer']=!![];agents[_0x182ea8['transfereruniqueid']][_0xd1d2('0x40')]=_0xd1d2('0x41');agents[_0x182ea8[_0xd1d2('0x3d')]][_0xd1d2('0x42')]=_0x182ea8[_0xd1d2('0x43')];agents[_0x182ea8[_0xd1d2('0x3d')]][_0xd1d2('0x44')]=agents[_0x182ea8[_0xd1d2('0x3d')]][_0xd1d2('0x14')];}}catch(_0x5e15cb){utils[_0xd1d2('0x28')](util['format']('[%s][agents][blindtransfer]',_0x182ea8[_0xd1d2('0x14')]),_0x5e15cb);}};exports[_0xd1d2('0x45')]=function(_0x2cde6b){try{utils[_0xd1d2('0x17')](util[_0xd1d2('0x3')](_0xd1d2('0x46'),_0x2cde6b[_0xd1d2('0x47')]),_0x2cde6b);if(_0x2cde6b[_0xd1d2('0x47')]==_0x2cde6b[_0xd1d2('0x48')]){if(!_[_0xd1d2('0x1e')](agents[_0x2cde6b[_0xd1d2('0x49')]])){utils[_0xd1d2('0x20')](util[_0xd1d2('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x2cde6b['origtransfereruniqueid'],agents[_0x2cde6b[_0xd1d2('0x49')]][_0xd1d2('0x6')]));agents[_0x2cde6b[_0xd1d2('0x49')]][_0xd1d2('0x4a')]=!![];agents[_0x2cde6b[_0xd1d2('0x49')]][_0xd1d2('0x40')]=_0xd1d2('0x4b');agents[_0x2cde6b[_0xd1d2('0x49')]][_0xd1d2('0x42')]=_0x2cde6b[_0xd1d2('0x4c')];agents[_0x2cde6b[_0xd1d2('0x49')]]['transferuniqueid']=_0x2cde6b['origtransfereruniqueid'];}if(_0x2cde6b[_0xd1d2('0x4d')]&&agents[_0x2cde6b[_0xd1d2('0x4d')]]){agents[_0x2cde6b[_0xd1d2('0x4d')]][_0xd1d2('0x4e')]=0x1;transfers[_0x2cde6b['transfereeuniqueid']]=_[_0xd1d2('0x4f')](agents[_0x2cde6b[_0xd1d2('0x4d')]]);transfers[_0x2cde6b[_0xd1d2('0x4d')]][_0xd1d2('0x8')]=agents[_0x2cde6b[_0xd1d2('0x49')]][_0xd1d2('0x8')];transfers[_0x2cde6b[_0xd1d2('0x4d')]]['calleridname']=agents[_0x2cde6b[_0xd1d2('0x49')]][_0xd1d2('0x50')];transfers[_0x2cde6b[_0xd1d2('0x4d')]]['agentcalledAt']=utils['now']();transfers[_0x2cde6b[_0xd1d2('0x4d')]][_0xd1d2('0x32')]=utils[_0xd1d2('0x22')]();transfers[_0x2cde6b[_0xd1d2('0x4d')]]['holdtime']=0x0;transfers[_0x2cde6b[_0xd1d2('0x4d')]][_0xd1d2('0x4e')]=0x2;}}else if(_0x2cde6b[_0xd1d2('0x49')]==_0x2cde6b['secondtransfererlinkedid']){if(!_[_0xd1d2('0x1e')](agents[_0x2cde6b[_0xd1d2('0x47')]])){utils['info'](util[_0xd1d2('0x3')](_0xd1d2('0x51'),_0x2cde6b[_0xd1d2('0x47')],agents[_0x2cde6b[_0xd1d2('0x47')]]['membername']));agents[_0x2cde6b[_0xd1d2('0x47')]][_0xd1d2('0x4a')]=!![];agents[_0x2cde6b[_0xd1d2('0x47')]][_0xd1d2('0x40')]=_0xd1d2('0x4b');agents[_0x2cde6b['origtransfereruniqueid']]['transferexten']=_0x2cde6b['secondtransfererexten'];agents[_0x2cde6b['origtransfereruniqueid']]['transferuniqueid']=_0x2cde6b[_0xd1d2('0x49')];}if(_0x2cde6b[_0xd1d2('0x52')]&&agents[_0x2cde6b[_0xd1d2('0x52')]]){agents[_0x2cde6b['transfertargetuniqueid']][_0xd1d2('0x4e')]=0x1;transfers[_0x2cde6b[_0xd1d2('0x52')]]=_[_0xd1d2('0x4f')](agents[_0x2cde6b['transfertargetuniqueid']]);transfers[_0x2cde6b[_0xd1d2('0x52')]][_0xd1d2('0x8')]=agents[_0x2cde6b[_0xd1d2('0x47')]][_0xd1d2('0x8')];transfers[_0x2cde6b[_0xd1d2('0x52')]][_0xd1d2('0x50')]=agents[_0x2cde6b['origtransfereruniqueid']][_0xd1d2('0x50')];transfers[_0x2cde6b[_0xd1d2('0x52')]]['agentcalledAt']=utils['now']();transfers[_0x2cde6b[_0xd1d2('0x52')]][_0xd1d2('0x32')]=utils[_0xd1d2('0x22')]();transfers[_0x2cde6b[_0xd1d2('0x52')]]['holdtime']=0x0;transfers[_0x2cde6b[_0xd1d2('0x52')]][_0xd1d2('0x4e')]=0x2;}}}catch(_0x3ebf2e){utils[_0xd1d2('0x28')](util['format'](_0xd1d2('0x46'),_0x2cde6b[_0xd1d2('0x47')]),_0x3ebf2e);}};exports[_0xd1d2('0x53')]=function(_0x572b55){try{utils[_0xd1d2('0x17')](util[_0xd1d2('0x3')]('[%s][agents][hangup]',_0x572b55[_0xd1d2('0x14')]),_0x572b55);if(agents[_0x572b55[_0xd1d2('0x14')]]&&agents[_0x572b55[_0xd1d2('0x14')]][_0xd1d2('0x24')]===_0xd1d2('0x23')){if(_0x572b55['cause']==='21'){agents[_0x572b55[_0xd1d2('0x14')]]['reason']='rejected';agents[_0x572b55['uniqueid']]['lastevent']=_0xd1d2('0x54');}utils['info'](util[_0xd1d2('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x572b55[_0xd1d2('0x14')],agents[_0x572b55[_0xd1d2('0x14')]][_0xd1d2('0x6')],agents[_0x572b55[_0xd1d2('0x14')]][_0xd1d2('0x24')],agents[_0x572b55[_0xd1d2('0x14')]]['lastevent']));writeDB(agents[_0x572b55[_0xd1d2('0x14')]]);var _0x25d042=unanswered[_0xd1d2('0x55')](_0x572b55[_0xd1d2('0x14')]);if(_0x25d042>-0x1){unanswered[_0xd1d2('0x56')](_0x25d042,0x1);}}if(transfers[_0x572b55[_0xd1d2('0x14')]]){transfers[_0x572b55[_0xd1d2('0x14')]][_0xd1d2('0xe')]=!![];transfers[_0x572b55[_0xd1d2('0x14')]][_0xd1d2('0x39')]=utils['now']();transfers[_0x572b55[_0xd1d2('0x14')]][_0xd1d2('0x2f')]=utils[_0xd1d2('0x3a')](transfers[_0x572b55[_0xd1d2('0x14')]]['agentcompleteAt'],transfers[_0x572b55[_0xd1d2('0x14')]][_0xd1d2('0x32')]);transfers[_0x572b55[_0xd1d2('0x14')]]['reason']=_0xd1d2('0x57');transfers[_0x572b55[_0xd1d2('0x14')]]['lastevent']='complete';utils[_0xd1d2('0x20')](util[_0xd1d2('0x3')](_0xd1d2('0x58'),_0x572b55[_0xd1d2('0x14')],transfers[_0x572b55[_0xd1d2('0x14')]][_0xd1d2('0x6')],transfers[_0x572b55[_0xd1d2('0x14')]]['reason'],transfers[_0x572b55[_0xd1d2('0x14')]][_0xd1d2('0x1a')]));writeDB(transfers[_0x572b55[_0xd1d2('0x14')]],!![]);}if(agents[_0x572b55[_0xd1d2('0x14')]]&&agents[_0x572b55[_0xd1d2('0x14')]][_0xd1d2('0x32')]){agents[_0x572b55[_0xd1d2('0x14')]][_0xd1d2('0xe')]=!![];agents[_0x572b55[_0xd1d2('0x14')]][_0xd1d2('0x39')]=utils[_0xd1d2('0x22')]();agents[_0x572b55[_0xd1d2('0x14')]][_0xd1d2('0x2f')]=utils[_0xd1d2('0x3a')](agents[_0x572b55['uniqueid']][_0xd1d2('0x39')],agents[_0x572b55[_0xd1d2('0x14')]][_0xd1d2('0x32')]);agents[_0x572b55[_0xd1d2('0x14')]][_0xd1d2('0x24')]=agents[_0x572b55[_0xd1d2('0x14')]][_0xd1d2('0x4a')]?_0xd1d2('0x4a'):_0xd1d2('0x57');agents[_0x572b55[_0xd1d2('0x14')]][_0xd1d2('0x1a')]=_0xd1d2('0x3b');utils[_0xd1d2('0x20')](util['format'](_0xd1d2('0x58'),_0x572b55[_0xd1d2('0x14')],agents[_0x572b55[_0xd1d2('0x14')]][_0xd1d2('0x6')],agents[_0x572b55[_0xd1d2('0x14')]][_0xd1d2('0x24')],agents[_0x572b55[_0xd1d2('0x14')]][_0xd1d2('0x1a')]));writeDB(agents[_0x572b55[_0xd1d2('0x14')]]);}}catch(_0x59c11a){utils[_0xd1d2('0x28')](util[_0xd1d2('0x3')]('[%s][agents][hangup]',_0x572b55[_0xd1d2('0x14')]),_0x59c11a);}}; \ No newline at end of file +var _0xe5b5=['[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','blind','transferexten','extension','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','transfertargetuniqueid','[%s][agents][attendedtransfer]','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','diffTime','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete','acwtime','agentacw','acwTimeout','request','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','ringtime','talktime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','abandoned','reason','holdtime','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentconnect]'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x596c43,_0x28647a){_0x596c43=_0x596c43-0x0;var _0x4e1315=_0xe5b5[_0x596c43];return _0x4e1315;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var utils=require(_0x5e5b('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3b3efd,_0x208070){utils[_0x5e5b('0x3')](util[_0x5e5b('0x4')](_0x5e5b('0x5'),_0x3b3efd[_0x5e5b('0x6')],_0x3b3efd[_0x5e5b('0x7')],_0x3b3efd[_0x5e5b('0x8')],_0x3b3efd[_0x5e5b('0x9')],_0x3b3efd[_0x5e5b('0xa')],_0x3b3efd[_0x5e5b('0xb')],_0x3b3efd[_0x5e5b('0xc')],_0x3b3efd[_0x5e5b('0xd')]));if(_0x3b3efd[_0x5e5b('0x8')]){utils[_0x5e5b('0xe')](_0x3b3efd[_0x5e5b('0x8')])[_0x5e5b('0xf')](function(_0x2aabb5){if(_0x2aabb5){_0x3b3efd[_0x5e5b('0x10')]=_0x2aabb5[_0x5e5b('0x10')];_0x3b3efd['agentacw']=_0x3b3efd[_0x5e5b('0x11')]?_0x2aabb5['acw']:![];_0x3b3efd[_0x5e5b('0x12')]=_0x3b3efd[_0x5e5b('0x13')]?_0x2aabb5[_0x5e5b('0x14')]:0x0;}utils[_0x5e5b('0x15')]('CreateVoiceAgentReport',_0x3b3efd);});}else{utils['request']('CreateVoiceAgentReport',_0x3b3efd);}if(_0x208070){delete transfers[_0x3b3efd[_0x5e5b('0x6')]];}else{delete agents[_0x3b3efd[_0x5e5b('0x16')]];}}exports[_0x5e5b('0x17')]=function(_0x1694ff){try{utils[_0x5e5b('0x18')](util[_0x5e5b('0x4')](_0x5e5b('0x19'),_0x1694ff['uniqueid']),_0x1694ff);agents[_0x1694ff[_0x5e5b('0x16')]]=_0x1694ff;agents[_0x1694ff[_0x5e5b('0x16')]]['agentcalledAt']=utils[_0x5e5b('0x1a')]();agents[_0x1694ff['destuniqueid']]['lastevent']=_0x5e5b('0x1b');agents[_0x1694ff[_0x5e5b('0x16')]][_0x5e5b('0xc')]=null;agents[_0x1694ff['destuniqueid']][_0x5e5b('0x1c')]=null;utils['info'](util[_0x5e5b('0x4')](_0x5e5b('0x1d'),_0x1694ff['uniqueid'],agents[_0x1694ff[_0x5e5b('0x16')]][_0x5e5b('0x9')],_0x1694ff[_0x5e5b('0x16')]));}catch(_0x538074){utils[_0x5e5b('0x1e')](util[_0x5e5b('0x4')]('[%s][agents][agentcalled]',_0x1694ff[_0x5e5b('0x6')]),_0x538074);}};exports[_0x5e5b('0x1f')]=function(_0x3c488e){try{if(!_[_0x5e5b('0x20')](agents[_0x3c488e[_0x5e5b('0x16')]])){utils[_0x5e5b('0x18')](util[_0x5e5b('0x4')](_0x5e5b('0x21'),_0x3c488e['uniqueid']),_0x3c488e);utils['info'](util[_0x5e5b('0x4')](_0x5e5b('0x22'),_0x3c488e[_0x5e5b('0x6')],agents[_0x3c488e[_0x5e5b('0x16')]][_0x5e5b('0x9')],_0x3c488e[_0x5e5b('0x16')]));agents[_0x3c488e[_0x5e5b('0x16')]][_0x5e5b('0x1f')]=!![];agents[_0x3c488e[_0x5e5b('0x16')]][_0x5e5b('0x23')]=utils[_0x5e5b('0x1a')]();agents[_0x3c488e['destuniqueid']][_0x5e5b('0xd')]=_0x5e5b('0x24');agents[_0x3c488e[_0x5e5b('0x16')]]['reason']=_0x5e5b('0x24');agents[_0x3c488e[_0x5e5b('0x16')]]['holdtime']=_0x3c488e[_0x5e5b('0x25')]?parseInt(_0x3c488e[_0x5e5b('0x25')])/0x3e8:0x0;agents[_0x3c488e[_0x5e5b('0x16')]][_0x5e5b('0x26')]=0x0;unanswered[_0x5e5b('0x27')](_0x3c488e[_0x5e5b('0x16')]);}}catch(_0x2cb695){utils[_0x5e5b('0x1e')](util[_0x5e5b('0x4')](_0x5e5b('0x21'),_0x3c488e[_0x5e5b('0x6')]),_0x2cb695);}};exports[_0x5e5b('0x28')]=function(_0x4ed688){try{_['forIn'](agents,function(_0x365f6f,_0x289f54){if(_0x365f6f[_0x5e5b('0x6')]==_0x4ed688[_0x5e5b('0x6')]&&!_[_0x5e5b('0x29')](unanswered,_0x365f6f['destuniqueid'])){utils[_0x5e5b('0x18')](util['format'](_0x5e5b('0x2a'),_0x4ed688[_0x5e5b('0x6')]),_0x4ed688);utils[_0x5e5b('0x3')](util[_0x5e5b('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x4ed688[_0x5e5b('0x6')],_0x365f6f[_0x5e5b('0x9')],_0x365f6f['destuniqueid']));_0x365f6f[_0x5e5b('0x1f')]=!![];_0x365f6f[_0x5e5b('0x23')]=utils[_0x5e5b('0x1a')]();_0x365f6f[_0x5e5b('0xd')]=_0x5e5b('0x2b');_0x365f6f[_0x5e5b('0x2c')]=_0x5e5b('0x2b');_0x365f6f[_0x5e5b('0x2d')]=_0x4ed688['holdtime'];_0x365f6f[_0x5e5b('0x26')]=0x0;writeDB(_0x365f6f);}});}catch(_0x37b5be){utils[_0x5e5b('0x1e')](util[_0x5e5b('0x4')](_0x5e5b('0x2a'),_0x4ed688[_0x5e5b('0x6')]),_0x37b5be);}};exports['agentconnect']=function(_0x5b2ba5){try{if(agents[_0x5b2ba5[_0x5e5b('0x16')]]){utils[_0x5e5b('0x18')](util[_0x5e5b('0x4')]('[%s][agents][agentconnect]',_0x5b2ba5[_0x5e5b('0x6')]),_0x5b2ba5);utils[_0x5e5b('0x3')](util[_0x5e5b('0x4')](_0x5e5b('0x2e'),_0x5b2ba5['uniqueid'],agents[_0x5b2ba5[_0x5e5b('0x16')]][_0x5e5b('0x9')],_0x5b2ba5['destuniqueid']));agents[_0x5b2ba5['destuniqueid']][_0x5e5b('0x2f')]=utils[_0x5e5b('0x1a')]();agents[_0x5b2ba5[_0x5e5b('0x16')]]['connectedlinenum']=_0x5b2ba5[_0x5e5b('0xc')];agents[_0x5b2ba5['destuniqueid']]['connectedlinename']=_0x5b2ba5[_0x5e5b('0x1c')];agents[_0x5b2ba5[_0x5e5b('0x16')]][_0x5e5b('0x2d')]=_0x5b2ba5[_0x5e5b('0x25')];agents[_0x5b2ba5[_0x5e5b('0x16')]][_0x5e5b('0xd')]=_0x5e5b('0x30');_[_0x5e5b('0x31')](agents,function(_0x1034fa,_0x53b88f){if(_0x1034fa[_0x5e5b('0x16')]!=_0x5b2ba5[_0x5e5b('0x16')]&&_0x1034fa['uniqueid']==_0x5b2ba5[_0x5e5b('0x6')]){_0x1034fa['talktime']=0x0;_0x1034fa[_0x5e5b('0x2d')]=_0x5b2ba5[_0x5e5b('0x25')];_0x1034fa[_0x5e5b('0x1f')]=!![];_0x1034fa[_0x5e5b('0x23')]=utils[_0x5e5b('0x1a')]();_0x1034fa[_0x5e5b('0xd')]=_0x5e5b('0x32');_0x1034fa[_0x5e5b('0x2c')]=_0x5e5b('0x32');_0x1034fa[_0x5e5b('0x33')]=_0x5b2ba5[_0x5e5b('0x16')];_0x1034fa['answeredelsewheremembername']=_0x5b2ba5[_0x5e5b('0x9')];writeDB(_0x1034fa);}});}}catch(_0x40e8ce){utils[_0x5e5b('0x1e')](util['format'](_0x5e5b('0x34'),_0x5b2ba5[_0x5e5b('0x6')]),_0x40e8ce);}};exports['agentcomplete']=function(_0x6672d9){try{if(!_[_0x5e5b('0x20')](agents[_0x6672d9['destuniqueid']])){utils[_0x5e5b('0x18')](util['format']('[%s][agents][agentcomplete]',_0x6672d9['uniqueid']),_0x6672d9);utils[_0x5e5b('0x3')](util['format'](_0x5e5b('0x35'),_0x6672d9['uniqueid'],agents[_0x6672d9[_0x5e5b('0x16')]][_0x5e5b('0x9')],_0x6672d9[_0x5e5b('0x16')]));agents[_0x6672d9[_0x5e5b('0x16')]][_0x5e5b('0x11')]=!![];agents[_0x6672d9[_0x5e5b('0x16')]][_0x5e5b('0x36')]=utils['now']();agents[_0x6672d9['destuniqueid']][_0x5e5b('0x26')]=utils['diffTime'](agents[_0x6672d9['destuniqueid']]['agentcompleteAt'],agents[_0x6672d9[_0x5e5b('0x16')]]['agentconnectAt']);agents[_0x6672d9[_0x5e5b('0x16')]][_0x5e5b('0x2c')]=_0x6672d9[_0x5e5b('0x2c')];agents[_0x6672d9[_0x5e5b('0x16')]][_0x5e5b('0xd')]=_0x5e5b('0x37');writeDB(agents[_0x6672d9['destuniqueid']]);}}catch(_0x26a0ff){utils[_0x5e5b('0x1e')](util['format'](_0x5e5b('0x38'),_0x6672d9['uniqueid']),_0x26a0ff);}};exports[_0x5e5b('0x39')]=function(_0x36d8fa){try{if(!_[_0x5e5b('0x20')](agents[_0x36d8fa[_0x5e5b('0x3a')]])){utils['debug'](util[_0x5e5b('0x4')](_0x5e5b('0x3b'),_0x36d8fa['uniqueid']),_0x36d8fa);utils[_0x5e5b('0x3')](util[_0x5e5b('0x4')](_0x5e5b('0x3c'),_0x36d8fa[_0x5e5b('0x6')],agents[_0x36d8fa[_0x5e5b('0x3a')]][_0x5e5b('0x9')],agents[_0x36d8fa['transfereruniqueid']][_0x5e5b('0x6')]));agents[_0x36d8fa[_0x5e5b('0x3a')]]['transfer']=!![];agents[_0x36d8fa[_0x5e5b('0x3a')]][_0x5e5b('0x3d')]=_0x5e5b('0x3e');agents[_0x36d8fa['transfereruniqueid']][_0x5e5b('0x3f')]=_0x36d8fa[_0x5e5b('0x40')];agents[_0x36d8fa[_0x5e5b('0x3a')]]['transferuniqueid']=agents[_0x36d8fa[_0x5e5b('0x3a')]][_0x5e5b('0x6')];}}catch(_0x239804){utils['error'](util['format'](_0x5e5b('0x3b'),_0x36d8fa['uniqueid']),_0x239804);}};exports['attendedtransfer']=function(_0x1dfe5d){try{utils[_0x5e5b('0x18')](util[_0x5e5b('0x4')]('[%s][agents][attendedtransfer]',_0x1dfe5d[_0x5e5b('0x41')]),_0x1dfe5d);if(_0x1dfe5d[_0x5e5b('0x41')]==_0x1dfe5d[_0x5e5b('0x42')]){if(!_[_0x5e5b('0x20')](agents[_0x1dfe5d[_0x5e5b('0x43')]])){utils[_0x5e5b('0x3')](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x1dfe5d[_0x5e5b('0x41')],agents[_0x1dfe5d[_0x5e5b('0x43')]][_0x5e5b('0x9')]));agents[_0x1dfe5d[_0x5e5b('0x43')]]['transfer']=!![];agents[_0x1dfe5d[_0x5e5b('0x43')]]['transfertype']=_0x5e5b('0x44');agents[_0x1dfe5d[_0x5e5b('0x43')]][_0x5e5b('0x3f')]=_0x1dfe5d[_0x5e5b('0x45')];agents[_0x1dfe5d[_0x5e5b('0x43')]][_0x5e5b('0x46')]=_0x1dfe5d[_0x5e5b('0x41')];}if(_0x1dfe5d[_0x5e5b('0x47')]&&agents[_0x1dfe5d['transfereeuniqueid']]){agents[_0x1dfe5d[_0x5e5b('0x47')]][_0x5e5b('0x48')]=0x1;transfers[_0x1dfe5d[_0x5e5b('0x47')]]=_[_0x5e5b('0x49')](agents[_0x1dfe5d[_0x5e5b('0x47')]]);transfers[_0x1dfe5d['transfereeuniqueid']][_0x5e5b('0xb')]=agents[_0x1dfe5d[_0x5e5b('0x43')]][_0x5e5b('0xb')];transfers[_0x1dfe5d[_0x5e5b('0x47')]][_0x5e5b('0x4a')]=agents[_0x1dfe5d['secondtransfereruniqueid']][_0x5e5b('0x4a')];transfers[_0x1dfe5d['transfereeuniqueid']][_0x5e5b('0x4b')]=utils['now']();transfers[_0x1dfe5d[_0x5e5b('0x47')]][_0x5e5b('0x2f')]=utils[_0x5e5b('0x1a')]();transfers[_0x1dfe5d[_0x5e5b('0x47')]][_0x5e5b('0x2d')]=0x0;transfers[_0x1dfe5d[_0x5e5b('0x47')]]['agententerreason']=0x2;}}else if(_0x1dfe5d[_0x5e5b('0x43')]==_0x1dfe5d[_0x5e5b('0x4c')]){if(!_[_0x5e5b('0x20')](agents[_0x1dfe5d[_0x5e5b('0x41')]])){utils['info'](util['format'](_0x5e5b('0x4d'),_0x1dfe5d[_0x5e5b('0x41')],agents[_0x1dfe5d['origtransfereruniqueid']][_0x5e5b('0x9')]));agents[_0x1dfe5d[_0x5e5b('0x41')]][_0x5e5b('0x4e')]=!![];agents[_0x1dfe5d[_0x5e5b('0x41')]][_0x5e5b('0x3d')]='ATTENDED';agents[_0x1dfe5d[_0x5e5b('0x41')]][_0x5e5b('0x3f')]=_0x1dfe5d['secondtransfererexten'];agents[_0x1dfe5d['origtransfereruniqueid']]['transferuniqueid']=_0x1dfe5d[_0x5e5b('0x43')];}if(_0x1dfe5d[_0x5e5b('0x4f')]&&agents[_0x1dfe5d[_0x5e5b('0x4f')]]){agents[_0x1dfe5d[_0x5e5b('0x4f')]][_0x5e5b('0x48')]=0x1;transfers[_0x1dfe5d['transfertargetuniqueid']]=_[_0x5e5b('0x49')](agents[_0x1dfe5d[_0x5e5b('0x4f')]]);transfers[_0x1dfe5d['transfertargetuniqueid']][_0x5e5b('0xb')]=agents[_0x1dfe5d['origtransfereruniqueid']]['calleridnum'];transfers[_0x1dfe5d[_0x5e5b('0x4f')]][_0x5e5b('0x4a')]=agents[_0x1dfe5d[_0x5e5b('0x41')]][_0x5e5b('0x4a')];transfers[_0x1dfe5d[_0x5e5b('0x4f')]][_0x5e5b('0x4b')]=utils[_0x5e5b('0x1a')]();transfers[_0x1dfe5d['transfertargetuniqueid']][_0x5e5b('0x2f')]=utils[_0x5e5b('0x1a')]();transfers[_0x1dfe5d[_0x5e5b('0x4f')]][_0x5e5b('0x2d')]=0x0;transfers[_0x1dfe5d[_0x5e5b('0x4f')]][_0x5e5b('0x48')]=0x2;}}}catch(_0x32874c){utils[_0x5e5b('0x1e')](util[_0x5e5b('0x4')](_0x5e5b('0x50'),_0x1dfe5d[_0x5e5b('0x41')]),_0x32874c);}};exports['hangup']=function(_0x2c8b25){try{utils[_0x5e5b('0x18')](util[_0x5e5b('0x4')](_0x5e5b('0x51'),_0x2c8b25[_0x5e5b('0x6')]),_0x2c8b25);if(agents[_0x2c8b25['uniqueid']]&&agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x2c')]===_0x5e5b('0x24')){if(_0x2c8b25[_0x5e5b('0x52')]==='21'){agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x2c')]='rejected';agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0xd')]=_0x5e5b('0x53');}utils['info'](util[_0x5e5b('0x4')](_0x5e5b('0x54'),_0x2c8b25[_0x5e5b('0x6')],agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x9')],agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x2c')],agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0xd')]));writeDB(agents[_0x2c8b25['uniqueid']]);var _0x19035d=unanswered['indexOf'](_0x2c8b25[_0x5e5b('0x6')]);if(_0x19035d>-0x1){unanswered[_0x5e5b('0x55')](_0x19035d,0x1);}}if(transfers[_0x2c8b25['uniqueid']]){transfers[_0x2c8b25['uniqueid']][_0x5e5b('0x11')]=!![];transfers[_0x2c8b25[_0x5e5b('0x6')]]['agentcompleteAt']=utils[_0x5e5b('0x1a')]();transfers[_0x2c8b25['uniqueid']]['talktime']=utils[_0x5e5b('0x56')](transfers[_0x2c8b25['uniqueid']][_0x5e5b('0x36')],transfers[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x2f')]);transfers[_0x2c8b25['uniqueid']][_0x5e5b('0x2c')]=_0x5e5b('0x57');transfers[_0x2c8b25[_0x5e5b('0x6')]]['lastevent']=_0x5e5b('0x37');utils[_0x5e5b('0x3')](util['format'](_0x5e5b('0x54'),_0x2c8b25['uniqueid'],transfers[_0x2c8b25['uniqueid']][_0x5e5b('0x9')],transfers[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x2c')],transfers[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0xd')]));writeDB(transfers[_0x2c8b25['uniqueid']],!![]);}if(agents[_0x2c8b25[_0x5e5b('0x6')]]&&agents[_0x2c8b25[_0x5e5b('0x6')]]['agentconnectAt']){agents[_0x2c8b25['uniqueid']][_0x5e5b('0x11')]=!![];agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x36')]=utils[_0x5e5b('0x1a')]();agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x26')]=utils['diffTime'](agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x36')],agents[_0x2c8b25[_0x5e5b('0x6')]]['agentconnectAt']);agents[_0x2c8b25['uniqueid']][_0x5e5b('0x2c')]=agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x4e')]?'transfer':_0x5e5b('0x57');agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0xd')]='complete';utils[_0x5e5b('0x3')](util[_0x5e5b('0x4')](_0x5e5b('0x54'),_0x2c8b25['uniqueid'],agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x9')],agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x2c')],agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0xd')]));writeDB(agents[_0x2c8b25['uniqueid']]);}}catch(_0x202d01){utils[_0x5e5b('0x1e')](util['format'](_0x5e5b('0x51'),_0x2c8b25['uniqueid']),_0x202d01);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index d788bef..05f465e 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 _0x09b1=['error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','billableseconds','localtwolinkedid','origtransfereruniqueid','transfereechannel','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','ContactId','xmd-cdrtype','[%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','appdata','set','toLowerCase','split','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','recording','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','DOCUMENTATION','newstate','[%s][calls][newstate]','isNil','info','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','linkedid','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber'];(function(_0x385b48,_0x2d961b){var _0xfd8dfe=function(_0xbf31fe){while(--_0xbf31fe){_0x385b48['push'](_0x385b48['shift']());}};_0xfd8dfe(++_0x2d961b);}(_0x09b1,0xa7));var _0x109b=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x09b1[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x109b('0x0'));var util=require(_0x109b('0x1'));var utils=require(_0x109b('0x2'));var transfers=require(_0x109b('0x3'));var dispositions=[_0x109b('0x4'),'FAILED',_0x109b('0x5'),_0x109b('0x4'),_0x109b('0x4'),_0x109b('0x4'),_0x109b('0x6'),_0x109b('0x7'),'FAILED',_0x109b('0x5'),_0x109b('0x5')];var channels={};function writeDB(_0x17e35d){var _0x3f9352;if(transfers[_0x109b('0x8')][_0x17e35d['uniqueid']]){_0x3f9352=_0x17e35d['uniqueid'];_0x17e35d[_0x109b('0x9')]=transfers[_0x109b('0x8')][_0x17e35d['uniqueid']]['transfereeuniqueid'];}utils['info'](util[_0x109b('0xa')](_0x109b('0xb'),_0x17e35d['uniqueid'],_0x17e35d[_0x109b('0xc')],_0x17e35d[_0x109b('0xd')],_0x17e35d[_0x109b('0xe')],_0x17e35d[_0x109b('0xf')],_0x17e35d['calleridnum'],_0x17e35d[_0x109b('0x10')],_0x17e35d[_0x109b('0x11')]));if(_0x17e35d[_0x109b('0x12')]){utils[_0x109b('0x13')](_0x17e35d[_0x109b('0x12')])[_0x109b('0x14')](function(_0x487920){if(_0x487920){_0x17e35d['UserId']=_0x487920['id'];}utils[_0x109b('0x15')](_0x109b('0x16'),_0x17e35d);});}else{utils[_0x109b('0x15')](_0x109b('0x16'),_0x17e35d);}if(channels[_0x17e35d[_0x109b('0x9')]]){delete channels[_0x17e35d['uniqueid']];}else if(_0x3f9352&&channels[_0x3f9352]){if(!transfers['blinds'][_0x3f9352][_0x109b('0x17')])delete transfers[_0x109b('0x8')][_0x3f9352];delete channels[_0x3f9352];}}exports['newchannel']=function(_0x2b58c2){try{utils[_0x109b('0x18')](util['format'](_0x109b('0x19'),_0x2b58c2[_0x109b('0x9')]),_0x2b58c2);if(_0x2b58c2[_0x109b('0x9')]==_0x2b58c2['linkedid']&&_0x2b58c2['channel']!=_0x109b('0x1a')){utils['info'](util['format'](_0x109b('0x1b'),_0x2b58c2[_0x109b('0x9')],_0x2b58c2[_0x109b('0x1c')],_0x2b58c2[_0x109b('0x1d')]));channels[_0x2b58c2[_0x109b('0x9')]]={'uniqueid':_0x2b58c2[_0x109b('0x9')],'accountcode':_0x2b58c2[_0x109b('0x12')],'source':_0x2b58c2[_0x109b('0x1e')],'destination':_0x2b58c2[_0x109b('0x1d')],'destinationcontext':_0x2b58c2[_0x109b('0x1c')],'channel':_0x2b58c2[_0x109b('0xc')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x109b('0x4'),'amaflags':_0x109b('0x1f')};}}catch(_0x36a161){utils['error'](util[_0x109b('0xa')](_0x109b('0x19'),_0x2b58c2[_0x109b('0x9')]),_0x36a161);}};exports[_0x109b('0x20')]=function(_0x236a90){try{utils['debug'](util[_0x109b('0xa')](_0x109b('0x21'),_0x236a90[_0x109b('0x9')]),_0x236a90);if(!_[_0x109b('0x22')](channels[_0x236a90[_0x109b('0x9')]])&&_0x236a90['channelstate']==0x6){utils[_0x109b('0x23')](util[_0x109b('0xa')](_0x109b('0x24'),_0x236a90[_0x109b('0x9')],_0x236a90[_0x109b('0x1c')],_0x236a90[_0x109b('0xc')]));if(_[_0x109b('0x22')](channels[_0x236a90[_0x109b('0x9')]][_0x109b('0x25')])){channels[_0x236a90[_0x109b('0x9')]][_0x109b('0x25')]=utils[_0x109b('0x26')]();}}else if(!_['isNil'](channels[_0x236a90[_0x109b('0x27')]])&&_0x236a90[_0x109b('0x28')]==0x6&&_0x236a90[_0x109b('0x1c')]!=_0x109b('0x29')){utils[_0x109b('0x23')](util['format'](_0x109b('0x2a'),_0x236a90[_0x109b('0x9')],_0x236a90[_0x109b('0x27')],_0x236a90[_0x109b('0x1c')],_0x236a90[_0x109b('0xc')]));channels[_0x236a90[_0x109b('0x27')]][_0x109b('0x12')]=_0x236a90[_0x109b('0x12')];channels[_0x236a90[_0x109b('0x27')]][_0x109b('0x2b')]=_0x236a90['channel'];if(_['isNil'](channels[_0x236a90[_0x109b('0x27')]][_0x109b('0x2c')])){channels[_0x236a90[_0x109b('0x27')]]['answertime']=utils['now']();}channels[_0x236a90['linkedid']][_0x109b('0x2d')]=dispositions[_[_0x109b('0x2e')](_0x236a90['channelstate'])]||'ANSWERED';}}catch(_0x54a259){utils[_0x109b('0x2f')](util[_0x109b('0xa')](_0x109b('0x21'),_0x236a90[_0x109b('0x9')]),_0x54a259);}};exports[_0x109b('0x30')]=function(_0x5433e9){try{if(!_[_0x109b('0x22')](channels[_0x5433e9[_0x109b('0x9')]])){utils[_0x109b('0x18')](util[_0x109b('0xa')](_0x109b('0x31'),_0x5433e9[_0x109b('0x9')]),_0x5433e9);if(_['isNil'](channels[_0x5433e9[_0x109b('0x9')]][_0x109b('0x32')])){channels[_0x5433e9[_0x109b('0x9')]][_0x109b('0x32')]=_0x5433e9[_0x109b('0x33')]+'\x20<'+_0x5433e9[_0x109b('0x1e')]+'>';}utils[_0x109b('0x23')](util[_0x109b('0xa')](_0x109b('0x34'),_0x5433e9[_0x109b('0x9')],channels[_0x5433e9[_0x109b('0x9')]][_0x109b('0x32')],_0x5433e9[_0x109b('0x35')]));channels[_0x5433e9[_0x109b('0x9')]][_0x109b('0x36')]=utils['now']();channels[_0x5433e9[_0x109b('0x9')]]['duration']=utils[_0x109b('0x37')](channels[_0x5433e9[_0x109b('0x9')]][_0x109b('0x36')],channels[_0x5433e9['uniqueid']]['starttime']);channels[_0x5433e9[_0x109b('0x9')]][_0x109b('0x38')]=channels[_0x5433e9['uniqueid']][_0x109b('0x2c')]?utils['diffTime'](channels[_0x5433e9[_0x109b('0x9')]][_0x109b('0x36')],channels[_0x5433e9[_0x109b('0x9')]][_0x109b('0x2c')]):0x0;writeDB(channels[_0x5433e9[_0x109b('0x9')]]);}}catch(_0x1046a7){utils[_0x109b('0x2f')](util[_0x109b('0xa')](_0x109b('0x31'),_0x5433e9['uniqueid']),_0x1046a7);}};exports['attendedtransfer']=function(_0xea5aa0){try{if(!_[_0x109b('0x22')](channels[_0xea5aa0[_0x109b('0x39')]])){utils['debug'](util[_0x109b('0xa')]('[%s][calls][attendedtransfer]',_0xea5aa0[_0x109b('0x3a')]),_0xea5aa0);if(channels[_0xea5aa0[_0x109b('0x39')]][_0x109b('0xc')]==_0xea5aa0[_0x109b('0x3b')]){utils[_0x109b('0x23')](util[_0x109b('0xa')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0xea5aa0['origtransfereruniqueid'],_0xea5aa0[_0x109b('0x39')],_0xea5aa0[_0x109b('0x3c')]));channels[_0xea5aa0[_0x109b('0x39')]][_0x109b('0x2b')]=_0xea5aa0[_0x109b('0x3c')];channels[_0xea5aa0[_0x109b('0x39')]]['userfield']=_0x109b('0x3d');}else if(channels[_0xea5aa0['localtwolinkedid']][_0x109b('0xc')]=_0xea5aa0[_0x109b('0x3e')]){utils[_0x109b('0x23')](util[_0x109b('0xa')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0xea5aa0[_0x109b('0x3a')],_0xea5aa0['localtwolinkedid'],_0xea5aa0['origtransfererchannel']));channels[_0xea5aa0[_0x109b('0x39')]]['destinationchannel']=_0xea5aa0[_0x109b('0x3f')];channels[_0xea5aa0[_0x109b('0x39')]]['userfield']=_0x109b('0x3d');}}}catch(_0x3811a4){utils[_0x109b('0x2f')](util[_0x109b('0xa')](_0x109b('0x40'),_0xea5aa0[_0x109b('0x3a')]),_0x3811a4);}};exports[_0x109b('0x41')]=function(_0x14aa3f){try{if(!_[_0x109b('0x22')](channels[_0x14aa3f[_0x109b('0x9')]])){utils[_0x109b('0x18')](util[_0x109b('0xa')](_0x109b('0x42'),_0x14aa3f['uniqueid']),_0x14aa3f);channels[_0x14aa3f[_0x109b('0x9')]][_0x109b('0x43')]=utils[_0x109b('0x26')]();utils[_0x109b('0x23')](util[_0x109b('0xa')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x14aa3f[_0x109b('0x9')],channels[_0x14aa3f['uniqueid']][_0x109b('0x43')]));}}catch(_0x308bd2){utils[_0x109b('0x2f')](util[_0x109b('0xa')](_0x109b('0x42'),_0x14aa3f[_0x109b('0x9')]),_0x308bd2);}};exports[_0x109b('0x44')]=function(_0x66eb2d){try{if(!_[_0x109b('0x22')](channels[_0x66eb2d[_0x109b('0x9')]])){utils[_0x109b('0x18')](util[_0x109b('0xa')](_0x109b('0x45'),_0x66eb2d[_0x109b('0x9')]),_0x66eb2d);if(!_['isNil'](channels[_0x66eb2d[_0x109b('0x9')]]['musiconholdstartAt'])){channels[_0x66eb2d['uniqueid']]['mohtime']+=utils['diffTime'](utils[_0x109b('0x26')](),channels[_0x66eb2d[_0x109b('0x9')]][_0x109b('0x43')]);utils[_0x109b('0x23')](util[_0x109b('0xa')](_0x109b('0x46'),_0x66eb2d[_0x109b('0x9')],channels[_0x66eb2d[_0x109b('0x9')]][_0x109b('0x47')]));delete channels[_0x66eb2d['uniqueid']]['musiconholdstartAt'];}}}catch(_0x5d9598){utils[_0x109b('0x2f')](util[_0x109b('0xa')](_0x109b('0x45'),_0x66eb2d['uniqueid']),_0x5d9598);}};exports[_0x109b('0x48')]=function(_0x3528ce){try{if(!_[_0x109b('0x22')](channels[_0x3528ce['uniqueid']])){utils[_0x109b('0x18')](util['format'](_0x109b('0x49'),_0x3528ce[_0x109b('0x9')]),_0x3528ce);if(!_[_0x109b('0x22')](_0x3528ce[_0x109b('0x4a')]['xmd-originatecalleridnum'])){utils[_0x109b('0x23')](util[_0x109b('0xa')](_0x109b('0x4b'),_0x3528ce['uniqueid'],_0x3528ce[_0x109b('0x4c')]));channels[_0x3528ce[_0x109b('0x9')]]['source']=_0x3528ce[_0x109b('0x4c')];}if(!_[_0x109b('0x22')](_0x3528ce[_0x109b('0x4a')]['xmd-phone'])){utils[_0x109b('0x23')](util[_0x109b('0xa')](_0x109b('0x4d'),_0x3528ce[_0x109b('0x9')],_0x3528ce['value']));channels[_0x3528ce[_0x109b('0x9')]]['destination']=_0x3528ce['value'];channels[_0x3528ce['uniqueid']]['callerid']='\x22'+_0x3528ce['value']+'\x22\x20<'+_0x3528ce['value']+'>';}if(!_['isNil'](_0x3528ce[_0x109b('0x4a')][_0x109b('0x4e')])||!_[_0x109b('0x22')](_0x3528ce[_0x109b('0x4a')][_0x109b('0x4f')])){utils[_0x109b('0x23')](util[_0x109b('0xa')](_0x109b('0x50'),_0x3528ce[_0x109b('0x9')],!_[_0x109b('0x22')](_0x3528ce[_0x109b('0x4a')][_0x109b('0x4e')])?_0x109b('0x4e'):_0x109b('0x4f'),_0x3528ce[_0x109b('0x4c')]));channels[_0x3528ce['uniqueid']][_0x109b('0x32')]=_0x3528ce[_0x109b('0x4c')];}if(!_['isNil'](_0x3528ce[_0x109b('0x4a')][_0x109b('0x51')])||!_['isNil'](_0x3528ce[_0x109b('0x4a')][_0x109b('0x52')])){utils[_0x109b('0x23')](util['format'](_0x109b('0x50'),_0x3528ce['uniqueid'],!_[_0x109b('0x22')](_0x3528ce['variable']['xmd-queue'])?_0x109b('0x51'):_0x109b('0x52'),_0x3528ce['value']));channels[_0x3528ce[_0x109b('0x9')]][_0x109b('0x53')]=_0x109b('0x54');channels[_0x3528ce[_0x109b('0x9')]][_0x109b('0x55')]=_0x3528ce['value'];channels[_0x3528ce[_0x109b('0x9')]]['queue']=!![];}if(!_[_0x109b('0x22')](_0x3528ce['variable'][_0x109b('0x56')])){utils[_0x109b('0x23')](util[_0x109b('0xa')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x3528ce[_0x109b('0x9')],_0x3528ce[_0x109b('0x4c')]));channels[_0x3528ce[_0x109b('0x9')]][_0x109b('0x57')]=_0x3528ce['value'];}if(!_[_0x109b('0x22')](_0x3528ce[_0x109b('0x4a')][_0x109b('0x58')])){utils[_0x109b('0x23')](util[_0x109b('0xa')](_0x109b('0x59'),_0x3528ce[_0x109b('0x9')],_0x3528ce[_0x109b('0x4c')]));channels[_0x3528ce[_0x109b('0x9')]]['type']=_0x3528ce[_0x109b('0x4c')];}if(!_['isNil'](_0x3528ce[_0x109b('0x4a')][_0x109b('0x5a')])){utils['info'](util[_0x109b('0xa')](_0x109b('0x5b'),_0x3528ce[_0x109b('0x9')],_0x3528ce[_0x109b('0x4c')]));channels[_0x3528ce['uniqueid']][_0x109b('0x5c')]=_0x3528ce[_0x109b('0x4c')];}if(!_[_0x109b('0x22')](_0x3528ce[_0x109b('0x4a')][_0x109b('0x5d')])){utils[_0x109b('0x23')](util[_0x109b('0xa')](_0x109b('0x5e'),_0x3528ce[_0x109b('0x9')],_0x3528ce['value']));channels[_0x3528ce[_0x109b('0x9')]]['sipcallid']=_0x3528ce[_0x109b('0x4c')];}}}catch(_0x2ed0c0){utils[_0x109b('0x2f')](util['format'](_0x109b('0x49'),_0x3528ce['uniqueid']),_0x2ed0c0);}};exports[_0x109b('0x5f')]=function(_0x4d2098){try{if(!_[_0x109b('0x22')](channels[_0x4d2098[_0x109b('0x9')]])){utils[_0x109b('0x18')](util['format'](_0x109b('0x60'),_0x4d2098[_0x109b('0x9')]),_0x4d2098);utils[_0x109b('0x23')](util['format']('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x4d2098[_0x109b('0x9')],_0x4d2098[_0x109b('0x61')],_0x4d2098[_0x109b('0x62')]));if(_0x4d2098[_0x109b('0x61')]['toLowerCase']()==_0x109b('0x63')&&_['startsWith'](_0x4d2098[_0x109b('0x62')][_0x109b('0x64')](),'cdr')){var _0x3cf373=_0x4d2098['appdata'][_0x109b('0x65')]('=');var _0x12cecb=_0x3cf373[0x0]['substring'](_0x3cf373[0x0][_0x109b('0x66')]('(')+0x1,_0x3cf373[0x0][_0x109b('0x66')](')'));var _0x4e0857=_0x3cf373[0x1];channels[_0x4d2098[_0x109b('0x9')]][_0x12cecb]=_0x4e0857;}if(!_[_0x109b('0x67')](['hangup',_0x109b('0x68'),_0x109b('0x69'),_0x109b('0x63'),_0x109b('0x6a')],_0x4d2098['application']['toLowerCase']())){channels[_0x4d2098[_0x109b('0x9')]][_0x109b('0x53')]=_0x4d2098[_0x109b('0x61')];channels[_0x4d2098[_0x109b('0x9')]][_0x109b('0x55')]=_0x4d2098[_0x109b('0x62')];}}}catch(_0x3bdb27){utils[_0x109b('0x2f')](util[_0x109b('0xa')](_0x109b('0x60'),_0x4d2098['uniqueid']),_0x3bdb27);}}; \ No newline at end of file +var _0x307e=['context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','answertime','disposition','ANSWERED','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','starttime','diffTime','attendedtransfer','localtwolinkedid','debug','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','toLowerCase','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getUserByInternal','accountcode','UserId','request','CreateVoiceCallReport','recording','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x307e,0xc9));var _0xe307=function(_0x4cc5fe,_0xb107ee){_0x4cc5fe=_0x4cc5fe-0x0;var _0x26309c=_0x307e[_0x4cc5fe];return _0x26309c;};'use strict';var _=require(_0xe307('0x0'));var util=require(_0xe307('0x1'));var utils=require(_0xe307('0x2'));var transfers=require(_0xe307('0x3'));var dispositions=[_0xe307('0x4'),'FAILED',_0xe307('0x5'),_0xe307('0x4'),'NO\x20ANSWER',_0xe307('0x4'),'ANSWERED',_0xe307('0x6'),_0xe307('0x5'),_0xe307('0x5'),'FAILED'];var channels={};function writeDB(_0x528e79){var _0x3645ea;if(transfers[_0xe307('0x7')][_0x528e79[_0xe307('0x8')]]){_0x3645ea=_0x528e79[_0xe307('0x8')];_0x528e79[_0xe307('0x8')]=transfers[_0xe307('0x7')][_0x528e79[_0xe307('0x8')]][_0xe307('0x9')];}utils[_0xe307('0xa')](util[_0xe307('0xb')](_0xe307('0xc'),_0x528e79[_0xe307('0x8')],_0x528e79[_0xe307('0xd')],_0x528e79[_0xe307('0xe')],_0x528e79[_0xe307('0xf')],_0x528e79[_0xe307('0x10')],_0x528e79[_0xe307('0x11')],_0x528e79[_0xe307('0x12')],_0x528e79[_0xe307('0x13')]));if(_0x528e79['accountcode']){utils[_0xe307('0x14')](_0x528e79[_0xe307('0x15')])['then'](function(_0x3faac5){if(_0x3faac5){_0x528e79[_0xe307('0x16')]=_0x3faac5['id'];}utils[_0xe307('0x17')](_0xe307('0x18'),_0x528e79);});}else{utils[_0xe307('0x17')](_0xe307('0x18'),_0x528e79);}if(channels[_0x528e79[_0xe307('0x8')]]){delete channels[_0x528e79['uniqueid']];}else if(_0x3645ea&&channels[_0x3645ea]){if(!transfers[_0xe307('0x7')][_0x3645ea][_0xe307('0x19')])delete transfers[_0xe307('0x7')][_0x3645ea];delete channels[_0x3645ea];}}exports[_0xe307('0x1a')]=function(_0x23e416){try{utils['debug'](util['format'](_0xe307('0x1b'),_0x23e416['uniqueid']),_0x23e416);if(_0x23e416[_0xe307('0x8')]==_0x23e416[_0xe307('0x1c')]&&_0x23e416[_0xe307('0xd')]!=_0xe307('0x1d')){utils[_0xe307('0xa')](util[_0xe307('0xb')](_0xe307('0x1e'),_0x23e416[_0xe307('0x8')],_0x23e416[_0xe307('0x1f')],_0x23e416[_0xe307('0x20')]));channels[_0x23e416[_0xe307('0x8')]]={'uniqueid':_0x23e416[_0xe307('0x8')],'accountcode':_0x23e416[_0xe307('0x15')],'source':_0x23e416[_0xe307('0x11')],'destination':_0x23e416[_0xe307('0x20')],'destinationcontext':_0x23e416['context'],'channel':_0x23e416[_0xe307('0xd')],'starttime':utils[_0xe307('0x21')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xe307('0x4'),'amaflags':_0xe307('0x22')};}}catch(_0x4fdf45){utils[_0xe307('0x23')](util[_0xe307('0xb')](_0xe307('0x1b'),_0x23e416[_0xe307('0x8')]),_0x4fdf45);}};exports[_0xe307('0x24')]=function(_0x51c015){try{utils['debug'](util[_0xe307('0xb')](_0xe307('0x25'),_0x51c015[_0xe307('0x8')]),_0x51c015);if(!_[_0xe307('0x26')](channels[_0x51c015[_0xe307('0x8')]])&&_0x51c015[_0xe307('0x27')]==0x6){utils[_0xe307('0xa')](util[_0xe307('0xb')](_0xe307('0x28'),_0x51c015['uniqueid'],_0x51c015[_0xe307('0x1f')],_0x51c015[_0xe307('0xd')]));if(_['isNil'](channels[_0x51c015[_0xe307('0x8')]]['systemanswertime'])){channels[_0x51c015['uniqueid']][_0xe307('0x29')]=utils[_0xe307('0x21')]();}}else if(!_[_0xe307('0x26')](channels[_0x51c015['linkedid']])&&_0x51c015[_0xe307('0x27')]==0x6&&_0x51c015['context']!=_0xe307('0x2a')){utils['info'](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x51c015['uniqueid'],_0x51c015[_0xe307('0x1c')],_0x51c015[_0xe307('0x1f')],_0x51c015['channel']));channels[_0x51c015[_0xe307('0x1c')]][_0xe307('0x15')]=_0x51c015[_0xe307('0x15')];channels[_0x51c015[_0xe307('0x1c')]]['destinationchannel']=_0x51c015[_0xe307('0xd')];if(_['isNil'](channels[_0x51c015['linkedid']][_0xe307('0x2b')])){channels[_0x51c015[_0xe307('0x1c')]][_0xe307('0x2b')]=utils[_0xe307('0x21')]();}channels[_0x51c015['linkedid']][_0xe307('0x2c')]=dispositions[_['toNumber'](_0x51c015[_0xe307('0x27')])]||_0xe307('0x2d');}}catch(_0x5d6290){utils[_0xe307('0x23')](util[_0xe307('0xb')](_0xe307('0x25'),_0x51c015[_0xe307('0x8')]),_0x5d6290);}};exports['hangup']=function(_0x4ccf57){try{if(!_[_0xe307('0x26')](channels[_0x4ccf57[_0xe307('0x8')]])){utils['debug'](util[_0xe307('0xb')](_0xe307('0x2e'),_0x4ccf57[_0xe307('0x8')]),_0x4ccf57);if(_['isNil'](channels[_0x4ccf57[_0xe307('0x8')]][_0xe307('0x2f')])){channels[_0x4ccf57['uniqueid']]['callerid']=_0x4ccf57['calleridname']+'\x20<'+_0x4ccf57[_0xe307('0x11')]+'>';}utils['info'](util[_0xe307('0xb')](_0xe307('0x30'),_0x4ccf57[_0xe307('0x8')],channels[_0x4ccf57[_0xe307('0x8')]]['callerid'],_0x4ccf57[_0xe307('0x31')]));channels[_0x4ccf57[_0xe307('0x8')]]['endtime']=utils['now']();channels[_0x4ccf57[_0xe307('0x8')]]['duration']=utils['diffTime'](channels[_0x4ccf57[_0xe307('0x8')]][_0xe307('0x32')],channels[_0x4ccf57[_0xe307('0x8')]][_0xe307('0x33')]);channels[_0x4ccf57[_0xe307('0x8')]]['billableseconds']=channels[_0x4ccf57['uniqueid']][_0xe307('0x2b')]?utils[_0xe307('0x34')](channels[_0x4ccf57[_0xe307('0x8')]]['endtime'],channels[_0x4ccf57[_0xe307('0x8')]][_0xe307('0x2b')]):0x0;writeDB(channels[_0x4ccf57['uniqueid']]);}}catch(_0x2c06c5){utils['error'](util[_0xe307('0xb')]('[%s][calls][hangup]',_0x4ccf57['uniqueid']),_0x2c06c5);}};exports[_0xe307('0x35')]=function(_0x4822f1){try{if(!_[_0xe307('0x26')](channels[_0x4822f1[_0xe307('0x36')]])){utils[_0xe307('0x37')](util[_0xe307('0xb')](_0xe307('0x38'),_0x4822f1[_0xe307('0x39')]),_0x4822f1);if(channels[_0x4822f1[_0xe307('0x36')]][_0xe307('0xd')]==_0x4822f1['transfereechannel']){utils[_0xe307('0xa')](util[_0xe307('0xb')](_0xe307('0x3a'),_0x4822f1[_0xe307('0x39')],_0x4822f1[_0xe307('0x36')],_0x4822f1[_0xe307('0x3b')]));channels[_0x4822f1[_0xe307('0x36')]][_0xe307('0x3c')]=_0x4822f1[_0xe307('0x3b')];channels[_0x4822f1['localtwolinkedid']][_0xe307('0x3d')]=_0xe307('0x3e');}else if(channels[_0x4822f1[_0xe307('0x36')]][_0xe307('0xd')]=_0x4822f1[_0xe307('0x3f')]){utils[_0xe307('0xa')](util[_0xe307('0xb')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x4822f1[_0xe307('0x39')],_0x4822f1['localtwolinkedid'],_0x4822f1[_0xe307('0x40')]));channels[_0x4822f1[_0xe307('0x36')]]['destinationchannel']=_0x4822f1['origtransfererchannel'];channels[_0x4822f1[_0xe307('0x36')]][_0xe307('0x3d')]=_0xe307('0x3e');}}}catch(_0x220c21){utils['error'](util[_0xe307('0xb')](_0xe307('0x38'),_0x4822f1[_0xe307('0x39')]),_0x220c21);}};exports[_0xe307('0x41')]=function(_0x42da2d){try{if(!_[_0xe307('0x26')](channels[_0x42da2d['uniqueid']])){utils[_0xe307('0x37')](util[_0xe307('0xb')](_0xe307('0x42'),_0x42da2d[_0xe307('0x8')]),_0x42da2d);channels[_0x42da2d[_0xe307('0x8')]][_0xe307('0x43')]=utils[_0xe307('0x21')]();utils[_0xe307('0xa')](util[_0xe307('0xb')](_0xe307('0x44'),_0x42da2d['uniqueid'],channels[_0x42da2d[_0xe307('0x8')]]['musiconholdstartAt']));}}catch(_0xcab77e){utils[_0xe307('0x23')](util[_0xe307('0xb')](_0xe307('0x42'),_0x42da2d[_0xe307('0x8')]),_0xcab77e);}};exports[_0xe307('0x45')]=function(_0x5223f9){try{if(!_[_0xe307('0x26')](channels[_0x5223f9['uniqueid']])){utils[_0xe307('0x37')](util[_0xe307('0xb')](_0xe307('0x46'),_0x5223f9['uniqueid']),_0x5223f9);if(!_['isNil'](channels[_0x5223f9[_0xe307('0x8')]][_0xe307('0x43')])){channels[_0x5223f9[_0xe307('0x8')]][_0xe307('0x47')]+=utils['diffTime'](utils[_0xe307('0x21')](),channels[_0x5223f9['uniqueid']][_0xe307('0x43')]);utils[_0xe307('0xa')](util[_0xe307('0xb')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x5223f9[_0xe307('0x8')],channels[_0x5223f9[_0xe307('0x8')]][_0xe307('0x47')]));delete channels[_0x5223f9[_0xe307('0x8')]]['musiconholdstartAt'];}}}catch(_0x1c9a07){utils[_0xe307('0x23')](util[_0xe307('0xb')](_0xe307('0x46'),_0x5223f9['uniqueid']),_0x1c9a07);}};exports[_0xe307('0x48')]=function(_0xdab91b){try{if(!_[_0xe307('0x26')](channels[_0xdab91b[_0xe307('0x8')]])){utils['debug'](util[_0xe307('0xb')](_0xe307('0x49'),_0xdab91b[_0xe307('0x8')]),_0xdab91b);if(!_[_0xe307('0x26')](_0xdab91b[_0xe307('0x4a')]['xmd-originatecalleridnum'])){utils[_0xe307('0xa')](util['format'](_0xe307('0x4b'),_0xdab91b[_0xe307('0x8')],_0xdab91b['value']));channels[_0xdab91b[_0xe307('0x8')]][_0xe307('0x4c')]=_0xdab91b[_0xe307('0x4d')];}if(!_[_0xe307('0x26')](_0xdab91b[_0xe307('0x4a')][_0xe307('0x4e')])){utils[_0xe307('0xa')](util[_0xe307('0xb')](_0xe307('0x4f'),_0xdab91b[_0xe307('0x8')],_0xdab91b[_0xe307('0x4d')]));channels[_0xdab91b['uniqueid']][_0xe307('0x50')]=_0xdab91b['value'];channels[_0xdab91b[_0xe307('0x8')]]['callerid']='\x22'+_0xdab91b['value']+_0xe307('0x51')+_0xdab91b[_0xe307('0x4d')]+'>';}if(!_[_0xe307('0x26')](_0xdab91b['variable'][_0xe307('0x52')])||!_[_0xe307('0x26')](_0xdab91b[_0xe307('0x4a')][_0xe307('0x53')])){utils['info'](util['format'](_0xe307('0x54'),_0xdab91b[_0xe307('0x8')],!_[_0xe307('0x26')](_0xdab91b[_0xe307('0x4a')][_0xe307('0x52')])?_0xe307('0x52'):_0xe307('0x53'),_0xdab91b[_0xe307('0x4d')]));channels[_0xdab91b[_0xe307('0x8')]][_0xe307('0x2f')]=_0xdab91b[_0xe307('0x4d')];}if(!_[_0xe307('0x26')](_0xdab91b['variable'][_0xe307('0x55')])||!_[_0xe307('0x26')](_0xdab91b['variable'][_0xe307('0x56')])){utils[_0xe307('0xa')](util[_0xe307('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0xdab91b[_0xe307('0x8')],!_[_0xe307('0x26')](_0xdab91b[_0xe307('0x4a')]['xmd-queue'])?'xmd-queue':_0xe307('0x56'),_0xdab91b[_0xe307('0x4d')]));channels[_0xdab91b[_0xe307('0x8')]][_0xe307('0x57')]=_0xe307('0x58');channels[_0xdab91b['uniqueid']][_0xe307('0x59')]=_0xdab91b[_0xe307('0x4d')];channels[_0xdab91b[_0xe307('0x8')]][_0xe307('0xe')]=!![];}if(!_[_0xe307('0x26')](_0xdab91b[_0xe307('0x4a')][_0xe307('0x5a')])){utils[_0xe307('0xa')](util['format'](_0xe307('0x5b'),_0xdab91b[_0xe307('0x8')],_0xdab91b['value']));channels[_0xdab91b[_0xe307('0x8')]][_0xe307('0x5c')]=_0xdab91b['value'];}if(!_['isNil'](_0xdab91b[_0xe307('0x4a')][_0xe307('0x5d')])){utils[_0xe307('0xa')](util[_0xe307('0xb')](_0xe307('0x5e'),_0xdab91b[_0xe307('0x8')],_0xdab91b['value']));channels[_0xdab91b['uniqueid']][_0xe307('0x5f')]=_0xdab91b[_0xe307('0x4d')];}if(!_['isNil'](_0xdab91b[_0xe307('0x4a')][_0xe307('0x60')])){utils['info'](util[_0xe307('0xb')](_0xe307('0x61'),_0xdab91b[_0xe307('0x8')],_0xdab91b[_0xe307('0x4d')]));channels[_0xdab91b[_0xe307('0x8')]][_0xe307('0x62')]=_0xdab91b['value'];}if(!_['isNil'](_0xdab91b[_0xe307('0x4a')][_0xe307('0x63')])){utils[_0xe307('0xa')](util[_0xe307('0xb')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0xdab91b[_0xe307('0x8')],_0xdab91b[_0xe307('0x4d')]));channels[_0xdab91b[_0xe307('0x8')]][_0xe307('0x63')]=_0xdab91b[_0xe307('0x4d')];}}}catch(_0x344f6c){utils[_0xe307('0x23')](util['format']('[%s][calls][varset]',_0xdab91b['uniqueid']),_0x344f6c);}};exports[_0xe307('0x64')]=function(_0x16912d){try{if(!_[_0xe307('0x26')](channels[_0x16912d[_0xe307('0x8')]])){utils[_0xe307('0x37')](util[_0xe307('0xb')](_0xe307('0x65'),_0x16912d[_0xe307('0x8')]),_0x16912d);utils[_0xe307('0xa')](util['format'](_0xe307('0x66'),_0x16912d[_0xe307('0x8')],_0x16912d[_0xe307('0x67')],_0x16912d[_0xe307('0x68')]));if(_0x16912d[_0xe307('0x67')]['toLowerCase']()==_0xe307('0x69')&&_[_0xe307('0x6a')](_0x16912d[_0xe307('0x68')]['toLowerCase'](),_0xe307('0x6b'))){var _0x3f3a1b=_0x16912d['appdata'][_0xe307('0x6c')]('=');var _0x37f9b5=_0x3f3a1b[0x0][_0xe307('0x6d')](_0x3f3a1b[0x0]['lastIndexOf']('(')+0x1,_0x3f3a1b[0x0][_0xe307('0x6e')](')'));var _0xe7beb6=_0x3f3a1b[0x1];channels[_0x16912d['uniqueid']][_0x37f9b5]=_0xe7beb6;}if(!_[_0xe307('0x6f')](['hangup',_0xe307('0x70'),_0xe307('0x71'),_0xe307('0x69'),_0xe307('0x72')],_0x16912d[_0xe307('0x67')][_0xe307('0x73')]())){channels[_0x16912d[_0xe307('0x8')]][_0xe307('0x57')]=_0x16912d[_0xe307('0x67')];channels[_0x16912d[_0xe307('0x8')]]['lastdata']=_0x16912d[_0xe307('0x68')];}}}catch(_0x4d4743){utils[_0xe307('0x23')](util['format'](_0xe307('0x65'),_0x16912d['uniqueid']),_0x4d4743);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index df88781..d5f56bd 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 _0xad71=['shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','managerevent','./utils','info','[core]\x20connected'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xad71,0x126));var _0x1ad7=function(_0x4bb6b1,_0x2342c0){_0x4bb6b1=_0x4bb6b1-0x0;var _0xa2bb1e=_0xad71[_0x4bb6b1];return _0xa2bb1e;};'use strict';var utils=require(_0x1ad7('0x0'));exports['connect']=function(){utils[_0x1ad7('0x1')](_0x1ad7('0x2'));};exports[_0x1ad7('0x3')]=function(){utils[_0x1ad7('0x1')](_0x1ad7('0x4'));};exports[_0x1ad7('0x5')]=function(){utils['info'](_0x1ad7('0x6'));};exports[_0x1ad7('0x7')]=function(_0x21960c){utils[_0x1ad7('0x7')](_0x1ad7('0x8'),_0x21960c);};exports[_0x1ad7('0x9')]=function(){utils[_0x1ad7('0x1')]('[core]\x20close');};exports[_0x1ad7('0xa')]=function(_0x23d1b){}; \ No newline at end of file +var _0xdeaf=['fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','managerevent','connect','info','[core]\x20connected','shutdown'];(function(_0x27f9bf,_0x419b67){var _0x40838e=function(_0x217da6){while(--_0x217da6){_0x27f9bf['push'](_0x27f9bf['shift']());}};_0x40838e(++_0x419b67);}(_0xdeaf,0x18c));var _0xfdea=function(_0x1f6b26,_0x44ad25){_0x1f6b26=_0x1f6b26-0x0;var _0x2f85e0=_0xdeaf[_0x1f6b26];return _0x2f85e0;};'use strict';var utils=require('./utils');exports[_0xfdea('0x0')]=function(){utils[_0xfdea('0x1')](_0xfdea('0x2'));};exports[_0xfdea('0x3')]=function(){utils[_0xfdea('0x1')]('[core]\x20shutdown');};exports[_0xfdea('0x4')]=function(){utils[_0xfdea('0x1')](_0xfdea('0x5'));};exports['error']=function(_0x1d51c3){utils[_0xfdea('0x6')](_0xfdea('0x7'),_0x1d51c3);};exports[_0xfdea('0x8')]=function(){utils[_0xfdea('0x1')]('[core]\x20close');};exports[_0xfdea('0x9')]=function(_0x2572ac){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 60cedeb..fdd4697 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 _0x6bfc=['uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','[%s][dials][dialend]','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','diffTime','holdtime','endtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s'];(function(_0x261609,_0x34172b){var _0x476c8a=function(_0x4ff6cf){while(--_0x4ff6cf){_0x261609['push'](_0x261609['shift']());}};_0x476c8a(++_0x34172b);}(_0x6bfc,0x158));var _0xc6bf=function(_0x1d5498,_0x4da3a8){_0x1d5498=_0x1d5498-0x0;var _0x59693f=_0x6bfc[_0x1d5498];return _0x59693f;};'use strict';var _=require(_0xc6bf('0x0'));var util=require(_0xc6bf('0x1'));var utils=require(_0xc6bf('0x2'));var dials={};function writeDB(_0x11595f){utils[_0xc6bf('0x3')](util[_0xc6bf('0x4')](_0xc6bf('0x5'),_0x11595f[_0xc6bf('0x6')],_0x11595f[_0xc6bf('0x7')],_0x11595f[_0xc6bf('0x8')],_0x11595f[_0xc6bf('0x9')],_0x11595f[_0xc6bf('0xa')],_0x11595f[_0xc6bf('0xb')]));utils['request'](_0xc6bf('0xc'),_0x11595f);delete dials[_0x11595f['uniqueid']];}exports['newexten']=function(_0x30b4ce){try{utils[_0xc6bf('0xd')](util['format'](_0xc6bf('0xe'),_0x30b4ce['uniqueid']),_0x30b4ce);utils['info'](util[_0xc6bf('0x4')](_0xc6bf('0xf'),_0x30b4ce['uniqueid'],_0x30b4ce[_0xc6bf('0x10')],_0x30b4ce[_0xc6bf('0x11')]));if(_0x30b4ce[_0xc6bf('0x10')][_0xc6bf('0x12')]()==_0xc6bf('0x13')&&_[_0xc6bf('0x14')](_0x30b4ce[_0xc6bf('0x11')][_0xc6bf('0x12')](),_0xc6bf('0x15'))){var _0x8ba52e=_0x30b4ce['appdata'][_0xc6bf('0x16')]('=');dials[_0x30b4ce['uniqueid']]={'routeId':_0x8ba52e[0x1]};}}catch(_0x4f48d5){utils[_0xc6bf('0x17')](util[_0xc6bf('0x4')](_0xc6bf('0xe'),_0x30b4ce['uniqueid']),_0x4f48d5);}};exports[_0xc6bf('0x18')]=function(_0x271616){try{utils['debug'](util[_0xc6bf('0x4')]('[%s][dials][varset]',_0x271616[_0xc6bf('0x6')]),_0x271616);if(!_[_0xc6bf('0x19')](_0x271616[_0xc6bf('0x1a')][_0xc6bf('0x1b')])){utils[_0xc6bf('0x3')](util[_0xc6bf('0x4')](_0xc6bf('0x1c'),_0x271616[_0xc6bf('0x6')],_0x271616[_0xc6bf('0x1d')]));dials[_0x271616[_0xc6bf('0x6')]]={'routeId':_0x271616[_0xc6bf('0x1d')]};}}catch(_0x5b3451){utils[_0xc6bf('0x17')](util[_0xc6bf('0x4')]('[%s][dials][varset]',_0x271616[_0xc6bf('0x6')]),_0x5b3451);}};exports[_0xc6bf('0x1e')]=function(_0x3a4c86){try{if(!_[_0xc6bf('0x19')](dials[_0x3a4c86[_0xc6bf('0x6')]])){utils[_0xc6bf('0xd')](util['format'](_0xc6bf('0x1f'),_0x3a4c86[_0xc6bf('0x6')]),_0x3a4c86);dials[_0x3a4c86['uniqueid']]=_[_0xc6bf('0x20')](dials[_0x3a4c86['uniqueid']],_0x3a4c86);dials[_0x3a4c86[_0xc6bf('0x6')]]['starttime']=utils[_0xc6bf('0x21')]();dials[_0x3a4c86[_0xc6bf('0x6')]][_0xc6bf('0x22')]='called';utils[_0xc6bf('0x3')](util[_0xc6bf('0x4')](_0xc6bf('0x23'),_0x3a4c86[_0xc6bf('0x6')],dials[_0x3a4c86[_0xc6bf('0x6')]][_0xc6bf('0x24')]));}}catch(_0x5b83e7){utils[_0xc6bf('0x17')](util[_0xc6bf('0x4')]('[%s][dials][dialbegin]',_0x3a4c86['uniqueid']),_0x5b83e7);}};exports['dialend']=function(_0x4f59f7){try{if(!_[_0xc6bf('0x19')](dials[_0x4f59f7['uniqueid']])){utils[_0xc6bf('0xd')](util['format'](_0xc6bf('0x25'),_0x4f59f7[_0xc6bf('0x6')]),_0x4f59f7);dials[_0x4f59f7[_0xc6bf('0x6')]][_0xc6bf('0xb')]=_0x4f59f7[_0xc6bf('0xb')];if(_0x4f59f7[_0xc6bf('0xb')]=='ANSWER'){dials[_0x4f59f7[_0xc6bf('0x6')]]=_[_0xc6bf('0x20')](dials[_0x4f59f7[_0xc6bf('0x6')]],_0x4f59f7);dials[_0x4f59f7[_0xc6bf('0x6')]][_0xc6bf('0x26')]=utils[_0xc6bf('0x21')]();dials[_0x4f59f7[_0xc6bf('0x6')]][_0xc6bf('0x22')]=_0xc6bf('0x27');utils['info'](util[_0xc6bf('0x4')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x4f59f7['uniqueid'],_0x4f59f7[_0xc6bf('0xb')],dials[_0x4f59f7[_0xc6bf('0x6')]][_0xc6bf('0x26')]));}else{utils[_0xc6bf('0x3')](util[_0xc6bf('0x4')](_0xc6bf('0x28'),_0x4f59f7[_0xc6bf('0x6')],_0x4f59f7['dialstatus']));}}}catch(_0x1a33e9){utils[_0xc6bf('0x17')](util[_0xc6bf('0x4')](_0xc6bf('0x25'),_0x4f59f7['uniqueid']),_0x1a33e9);}};exports[_0xc6bf('0x29')]=function(_0x5163b8){try{if(!_[_0xc6bf('0x19')](dials[_0x5163b8['uniqueid']])){utils['debug'](util[_0xc6bf('0x4')]('[%s][dials][hangup]',_0x5163b8['uniqueid']),_0x5163b8);utils[_0xc6bf('0x3')](util['format'](_0xc6bf('0x2a'),_0x5163b8[_0xc6bf('0x6')],_0x5163b8['calleridnum'],_0x5163b8[_0xc6bf('0x2b')],_0x5163b8['cause-txt']));dials[_0x5163b8[_0xc6bf('0x6')]]=_[_0xc6bf('0x20')](dials[_0x5163b8['uniqueid']],{'endtime':utils['now'](),'lastevent':_0xc6bf('0x2c')});dials[_0x5163b8[_0xc6bf('0x6')]][_0xc6bf('0x2d')]=utils[_0xc6bf('0x2e')](dials[_0x5163b8[_0xc6bf('0x6')]]['endtime'],dials[_0x5163b8[_0xc6bf('0x6')]][_0xc6bf('0x24')]);dials[_0x5163b8[_0xc6bf('0x6')]][_0xc6bf('0x2f')]=utils[_0xc6bf('0x2e')](dials[_0x5163b8['uniqueid']]['answertime']||dials[_0x5163b8[_0xc6bf('0x6')]][_0xc6bf('0x30')],dials[_0x5163b8[_0xc6bf('0x6')]][_0xc6bf('0x24')]);dials[_0x5163b8['uniqueid']][_0xc6bf('0x31')]=dials[_0x5163b8[_0xc6bf('0x6')]][_0xc6bf('0x26')]?utils[_0xc6bf('0x2e')](dials[_0x5163b8['uniqueid']][_0xc6bf('0x30')],dials[_0x5163b8['uniqueid']]['answertime']):0x0;writeDB(dials[_0x5163b8[_0xc6bf('0x6')]]);}}catch(_0x3e77b4){utils['error'](util[_0xc6bf('0x4')]('[%s][dials][hangup]',_0x5163b8['uniqueid']),_0x3e77b4);}}; \ No newline at end of file +var _0xdc4c=['uniqueid','application','toLowerCase','startsWith','appdata','cdr(routeid)','split','error','varset','debug','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','diffTime','endtime','holdtime','billableseconds','[%s][dials][hangup]','lodash','./utils','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','dialstring','calleridnum','connectedlinenum','dialstatus','format','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc4c,0x10f));var _0xcdc4=function(_0x404a0b,_0x369ea4){_0x404a0b=_0x404a0b-0x0;var _0x322f1a=_0xdc4c[_0x404a0b];return _0x322f1a;};'use strict';var _=require(_0xcdc4('0x0'));var util=require('util');var utils=require(_0xcdc4('0x1'));var dials={};function writeDB(_0x3a5636){utils['info'](util['format'](_0xcdc4('0x2'),_0x3a5636['uniqueid'],_0x3a5636['channel'],_0x3a5636[_0xcdc4('0x3')],_0x3a5636[_0xcdc4('0x4')],_0x3a5636[_0xcdc4('0x5')],_0x3a5636[_0xcdc4('0x6')]));utils['request']('CreateVoiceDialReport',_0x3a5636);delete dials[_0x3a5636['uniqueid']];}exports['newexten']=function(_0x5abccc){try{utils['debug'](util[_0xcdc4('0x7')](_0xcdc4('0x8'),_0x5abccc['uniqueid']),_0x5abccc);utils[_0xcdc4('0x9')](util[_0xcdc4('0x7')](_0xcdc4('0xa'),_0x5abccc[_0xcdc4('0xb')],_0x5abccc['application'],_0x5abccc['appdata']));if(_0x5abccc[_0xcdc4('0xc')][_0xcdc4('0xd')]()=='set'&&_[_0xcdc4('0xe')](_0x5abccc[_0xcdc4('0xf')][_0xcdc4('0xd')](),_0xcdc4('0x10'))){var _0x2931d2=_0x5abccc[_0xcdc4('0xf')][_0xcdc4('0x11')]('=');dials[_0x5abccc['uniqueid']]={'routeId':_0x2931d2[0x1]};}}catch(_0xa1f20a){utils[_0xcdc4('0x12')](util['format'](_0xcdc4('0x8'),_0x5abccc[_0xcdc4('0xb')]),_0xa1f20a);}};exports[_0xcdc4('0x13')]=function(_0x2e4bd9){try{utils[_0xcdc4('0x14')](util['format'](_0xcdc4('0x15'),_0x2e4bd9[_0xcdc4('0xb')]),_0x2e4bd9);if(!_[_0xcdc4('0x16')](_0x2e4bd9[_0xcdc4('0x17')]['outboundrouteid'])){utils['info'](util[_0xcdc4('0x7')](_0xcdc4('0x18'),_0x2e4bd9[_0xcdc4('0xb')],_0x2e4bd9['value']));dials[_0x2e4bd9[_0xcdc4('0xb')]]={'routeId':_0x2e4bd9[_0xcdc4('0x19')]};}}catch(_0x24f749){utils[_0xcdc4('0x12')](util['format'](_0xcdc4('0x15'),_0x2e4bd9[_0xcdc4('0xb')]),_0x24f749);}};exports[_0xcdc4('0x1a')]=function(_0x54b1ac){try{if(!_['isNil'](dials[_0x54b1ac['uniqueid']])){utils['debug'](util[_0xcdc4('0x7')](_0xcdc4('0x1b'),_0x54b1ac[_0xcdc4('0xb')]),_0x54b1ac);dials[_0x54b1ac[_0xcdc4('0xb')]]=_[_0xcdc4('0x1c')](dials[_0x54b1ac[_0xcdc4('0xb')]],_0x54b1ac);dials[_0x54b1ac['uniqueid']][_0xcdc4('0x1d')]=utils['now']();dials[_0x54b1ac[_0xcdc4('0xb')]][_0xcdc4('0x1e')]='called';utils[_0xcdc4('0x9')](util[_0xcdc4('0x7')](_0xcdc4('0x1f'),_0x54b1ac[_0xcdc4('0xb')],dials[_0x54b1ac[_0xcdc4('0xb')]][_0xcdc4('0x1d')]));}}catch(_0x559623){utils[_0xcdc4('0x12')](util[_0xcdc4('0x7')](_0xcdc4('0x1b'),_0x54b1ac['uniqueid']),_0x559623);}};exports[_0xcdc4('0x20')]=function(_0x502f87){try{if(!_[_0xcdc4('0x16')](dials[_0x502f87[_0xcdc4('0xb')]])){utils[_0xcdc4('0x14')](util[_0xcdc4('0x7')](_0xcdc4('0x21'),_0x502f87[_0xcdc4('0xb')]),_0x502f87);dials[_0x502f87[_0xcdc4('0xb')]][_0xcdc4('0x6')]=_0x502f87[_0xcdc4('0x6')];if(_0x502f87['dialstatus']==_0xcdc4('0x22')){dials[_0x502f87[_0xcdc4('0xb')]]=_[_0xcdc4('0x1c')](dials[_0x502f87['uniqueid']],_0x502f87);dials[_0x502f87[_0xcdc4('0xb')]][_0xcdc4('0x23')]=utils['now']();dials[_0x502f87[_0xcdc4('0xb')]][_0xcdc4('0x1e')]=_0xcdc4('0x24');utils[_0xcdc4('0x9')](util[_0xcdc4('0x7')](_0xcdc4('0x25'),_0x502f87[_0xcdc4('0xb')],_0x502f87[_0xcdc4('0x6')],dials[_0x502f87[_0xcdc4('0xb')]][_0xcdc4('0x23')]));}else{utils[_0xcdc4('0x9')](util['format'](_0xcdc4('0x26'),_0x502f87[_0xcdc4('0xb')],_0x502f87[_0xcdc4('0x6')]));}}}catch(_0x31ce03){utils['error'](util[_0xcdc4('0x7')](_0xcdc4('0x21'),_0x502f87['uniqueid']),_0x31ce03);}};exports[_0xcdc4('0x27')]=function(_0x33ebe1){try{if(!_[_0xcdc4('0x16')](dials[_0x33ebe1[_0xcdc4('0xb')]])){utils[_0xcdc4('0x14')](util[_0xcdc4('0x7')]('[%s][dials][hangup]',_0x33ebe1[_0xcdc4('0xb')]),_0x33ebe1);utils[_0xcdc4('0x9')](util[_0xcdc4('0x7')](_0xcdc4('0x28'),_0x33ebe1[_0xcdc4('0xb')],_0x33ebe1[_0xcdc4('0x4')],_0x33ebe1['calleridname'],_0x33ebe1[_0xcdc4('0x29')]));dials[_0x33ebe1[_0xcdc4('0xb')]]=_[_0xcdc4('0x1c')](dials[_0x33ebe1[_0xcdc4('0xb')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x33ebe1[_0xcdc4('0xb')]]['duration']=utils[_0xcdc4('0x2a')](dials[_0x33ebe1[_0xcdc4('0xb')]][_0xcdc4('0x2b')],dials[_0x33ebe1['uniqueid']][_0xcdc4('0x1d')]);dials[_0x33ebe1[_0xcdc4('0xb')]][_0xcdc4('0x2c')]=utils['diffTime'](dials[_0x33ebe1[_0xcdc4('0xb')]]['answertime']||dials[_0x33ebe1['uniqueid']][_0xcdc4('0x2b')],dials[_0x33ebe1[_0xcdc4('0xb')]][_0xcdc4('0x1d')]);dials[_0x33ebe1[_0xcdc4('0xb')]][_0xcdc4('0x2d')]=dials[_0x33ebe1[_0xcdc4('0xb')]][_0xcdc4('0x23')]?utils[_0xcdc4('0x2a')](dials[_0x33ebe1[_0xcdc4('0xb')]][_0xcdc4('0x2b')],dials[_0x33ebe1[_0xcdc4('0xb')]][_0xcdc4('0x23')]):0x0;writeDB(dials[_0x33ebe1[_0xcdc4('0xb')]]);}}catch(_0x1c8a75){utils['error'](util[_0xcdc4('0x7')](_0xcdc4('0x2e'),_0x33ebe1[_0xcdc4('0xb')]),_0x1c8a75);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 9e2f051..5c82348 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 _0xe70d=['[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','connect','fullybooted','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','error','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer'];(function(_0x11ced7,_0x29a8b0){var _0x4bed14=function(_0x2b62d0){while(--_0x2b62d0){_0x11ced7['push'](_0x11ced7['shift']());}};_0x4bed14(++_0x29a8b0);}(_0xe70d,0x1b7));var _0xde70=function(_0x4ac196,_0x526bca){_0x4ac196=_0x4ac196-0x0;var _0x32fce5=_0xe70d[_0x4ac196];return _0x32fce5;};var AsteriskManager=require(_0xde70('0x0'));var config=require(_0xde70('0x1'));var utils=require(_0xde70('0x2'));var util=require(_0xde70('0x3'));var isXDREnabled=config[_0xde70('0x4')]&&config[_0xde70('0x4')][_0xde70('0x5')]?!config[_0xde70('0x4')]['disabled']:!![];var isProduction=config[_0xde70('0x6')]===_0xde70('0x7')||![];var isLocalAsterisk=config[_0xde70('0x4')]&&config['xdr'][_0xde70('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0xde70('0x9')][_0xde70('0xa')],config[_0xde70('0x9')]['ip'],config[_0xde70('0x9')][_0xde70('0xb')],config['asterisk'][_0xde70('0xc')],!![]);ami[_0xde70('0xd')]();if(!isXDREnabled){utils[_0xde70('0xe')](_0xde70('0xf'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xde70('0xe')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xde70('0x10'));var calls=require(_0xde70('0x11'));var queues=require(_0xde70('0x12'));var recordings=require(_0xde70('0x13'));var members=require('./members.controller');var dials=require(_0xde70('0x14'));var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on'](_0xde70('0x15'),core[_0xde70('0x15')]);ami['on']('shutdown',core['shutdown']);ami['on'](_0xde70('0x16'),core[_0xde70('0x16')]);ami['on']('error',core['error']);ami['on'](_0xde70('0x17'),core[_0xde70('0x17')]);ami['on'](_0xde70('0x18'),core[_0xde70('0x18')]);ami['on'](_0xde70('0x19'),function(_0x470500){try{utils[_0xde70('0x1a')](util[_0xde70('0x1b')](_0xde70('0x1c'),_0x470500[_0xde70('0x1d')]),_0x470500);members[_0xde70('0x19')](_0x470500);}catch(_0x337f91){utils[_0xde70('0x1e')](util[_0xde70('0x1b')](_0xde70('0x1c'),_0x470500[_0xde70('0x1d')]),_0x337f91);}});ami['on'](_0xde70('0x1f'),function(_0x4d7d60){try{utils[_0xde70('0x1a')](util[_0xde70('0x1b')](_0xde70('0x20'),_0x4d7d60['uniqueid']),_0x4d7d60);agents[_0xde70('0x1f')](_0x4d7d60);}catch(_0x545260){utils['error'](util[_0xde70('0x1b')]('[%s][index][agentcalled]',_0x4d7d60[_0xde70('0x21')]),_0x545260);}});ami['on'](_0xde70('0x22'),function(_0x2efaf6){try{utils['debug'](util[_0xde70('0x1b')](_0xde70('0x23'),_0x2efaf6[_0xde70('0x21')]),_0x2efaf6);agents[_0xde70('0x22')](_0x2efaf6);}catch(_0x3635f0){utils[_0xde70('0x1e')](util[_0xde70('0x1b')](_0xde70('0x23'),_0x2efaf6['uniqueid']),_0x3635f0);}});ami['on'](_0xde70('0x24'),function(_0x27e7cc){try{utils[_0xde70('0x1a')](util[_0xde70('0x1b')](_0xde70('0x25'),_0x27e7cc['uniqueid']),_0x27e7cc);agents[_0xde70('0x24')](_0x27e7cc);queues['agentconnect'](_0x27e7cc);}catch(_0x312466){utils[_0xde70('0x1e')](util[_0xde70('0x1b')]('[%s][index][agentconnect]',_0x27e7cc['uniqueid']),_0x312466);}});ami['on'](_0xde70('0x26'),function(_0x129d87){try{utils[_0xde70('0x1a')](util[_0xde70('0x1b')]('[%s][index][agentcomplete]',_0x129d87[_0xde70('0x21')]),_0x129d87);agents['agentcomplete'](_0x129d87);queues[_0xde70('0x26')](_0x129d87);members['agentcomplete'](_0x129d87);}catch(_0x372804){utils[_0xde70('0x1e')](util[_0xde70('0x1b')]('[%s][index][agentcomplete]',_0x129d87[_0xde70('0x21')]),_0x372804);}});ami['on'](_0xde70('0x27'),function(_0x518d47){try{utils[_0xde70('0x1a')](util[_0xde70('0x1b')]('[%s][index][queuecallerabandon]',_0x518d47[_0xde70('0x21')]),_0x518d47);agents[_0xde70('0x27')](_0x518d47);queues[_0xde70('0x27')](_0x518d47);}catch(_0x4b037d){utils[_0xde70('0x1e')](util[_0xde70('0x1b')](_0xde70('0x28'),_0x518d47[_0xde70('0x21')]),_0x4b037d);}});ami['on'](_0xde70('0x29'),function(_0x582a5e){try{utils[_0xde70('0x1a')](util[_0xde70('0x1b')](_0xde70('0x2a'),_0x582a5e[_0xde70('0x21')]),_0x582a5e);queues[_0xde70('0x29')](_0x582a5e);recordings['queuecallerjoin'](_0x582a5e);}catch(_0x2ac9f0){utils[_0xde70('0x1e')](util[_0xde70('0x1b')](_0xde70('0x2a'),_0x582a5e[_0xde70('0x21')]),_0x2ac9f0);}});ami['on']('queuecallerleave',function(_0x36e04e){try{utils[_0xde70('0x1a')](util['format']('[%s][index][queuecallerleave]',_0x36e04e['uniqueid']),_0x36e04e);queues[_0xde70('0x2b')](_0x36e04e);}catch(_0x39e1b1){utils[_0xde70('0x1e')](util[_0xde70('0x1b')](_0xde70('0x2c'),_0x36e04e[_0xde70('0x21')]),_0x39e1b1);}});ami['on'](_0xde70('0x2d'),function(_0xfe6a53){try{utils[_0xde70('0x1a')](util[_0xde70('0x1b')](_0xde70('0x2e'),_0xfe6a53['uniqueid']),_0xfe6a53);queues[_0xde70('0x2d')](_0xfe6a53);calls[_0xde70('0x2d')](_0xfe6a53);}catch(_0x246e9a){utils[_0xde70('0x1e')](util['format']('[%s][index][musiconholdstart]',_0xfe6a53[_0xde70('0x21')]),_0x246e9a);}});ami['on'](_0xde70('0x2f'),function(_0x557ed7){try{utils[_0xde70('0x1a')](util['format'](_0xde70('0x30'),_0x557ed7['uniqueid']),_0x557ed7);queues[_0xde70('0x2f')](_0x557ed7);calls[_0xde70('0x2f')](_0x557ed7);}catch(_0x47817f){utils[_0xde70('0x1e')](util[_0xde70('0x1b')](_0xde70('0x30'),_0x557ed7[_0xde70('0x21')]),_0x47817f);}});ami['on'](_0xde70('0x31'),function(_0x161838){try{utils[_0xde70('0x1a')](util[_0xde70('0x1b')](_0xde70('0x32'),_0x161838[_0xde70('0x21')]),_0x161838);calls[_0xde70('0x31')](_0x161838);recordings[_0xde70('0x31')](_0x161838);}catch(_0x89ebd0){utils[_0xde70('0x1e')](util['format'](_0xde70('0x32'),_0x161838[_0xde70('0x21')]),_0x89ebd0);}});ami['on'](_0xde70('0x33'),function(_0x1a0a2a){try{utils[_0xde70('0x1a')](util[_0xde70('0x1b')](_0xde70('0x34'),_0x1a0a2a['uniqueid']),_0x1a0a2a);calls[_0xde70('0x33')](_0x1a0a2a);recordings[_0xde70('0x33')](_0x1a0a2a);dials[_0xde70('0x33')](_0x1a0a2a);agents[_0xde70('0x33')](_0x1a0a2a);queues[_0xde70('0x33')](_0x1a0a2a);}catch(_0x20eff2){utils[_0xde70('0x1e')](util[_0xde70('0x1b')](_0xde70('0x34'),_0x1a0a2a[_0xde70('0x21')]),_0x20eff2);}});ami['on'](_0xde70('0x35'),function(_0x330e38){try{utils[_0xde70('0x1a')](util[_0xde70('0x1b')](_0xde70('0x36'),_0x330e38[_0xde70('0x21')]),_0x330e38);members[_0xde70('0x35')](_0x330e38);}catch(_0x40a3e9){utils[_0xde70('0x1e')](util[_0xde70('0x1b')]('[%s][index][cdr]',_0x330e38[_0xde70('0x21')]),_0x40a3e9);}});ami['on'](_0xde70('0x37'),function(_0x1cd720){try{utils['debug'](util[_0xde70('0x1b')](_0xde70('0x38'),_0x1cd720[_0xde70('0x21')]),_0x1cd720);queues[_0xde70('0x37')](_0x1cd720);agents[_0xde70('0x37')](_0x1cd720);transfers['blindtransfer'](_0x1cd720);recordings[_0xde70('0x37')](_0x1cd720);}catch(_0xf6e703){utils[_0xde70('0x1e')](util[_0xde70('0x1b')](_0xde70('0x38'),_0x1cd720[_0xde70('0x21')]),_0xf6e703);}});ami['on'](_0xde70('0x39'),function(_0x1091fa){try{utils[_0xde70('0x1a')](util[_0xde70('0x1b')](_0xde70('0x3a'),_0x1091fa['origtransfereruniqueid']),_0x1091fa);queues[_0xde70('0x39')](_0x1091fa);transfers[_0xde70('0x39')](_0x1091fa);agents['attendedtransfer'](_0x1091fa);calls[_0xde70('0x39')](_0x1091fa);}catch(_0x240945){utils[_0xde70('0x1e')](util[_0xde70('0x1b')]('[%s][index][attendedtransfer]',_0x1091fa[_0xde70('0x3b')]),_0x240945);}});ami['on']('varset',function(_0x134583){try{utils[_0xde70('0x1a')](util[_0xde70('0x1b')](_0xde70('0x3c'),_0x134583['uniqueid']),_0x134583);queues['varset'](_0x134583);recordings[_0xde70('0x3d')](_0x134583);calls[_0xde70('0x3d')](_0x134583);dials['varset'](_0x134583);}catch(_0x415c03){utils[_0xde70('0x1e')](util['format'](_0xde70('0x3c'),_0x134583[_0xde70('0x21')]),_0x415c03);}});ami['on'](_0xde70('0x3e'),function(_0x16f044){try{utils[_0xde70('0x1a')](util[_0xde70('0x1b')](_0xde70('0x3f'),_0x16f044[_0xde70('0x21')]),_0x16f044);calls[_0xde70('0x3e')](_0x16f044);recordings['newexten'](_0x16f044);dials[_0xde70('0x3e')](_0x16f044);}catch(_0xec2037){utils[_0xde70('0x1e')](util[_0xde70('0x1b')]('[%s][index][newexten]',_0x16f044['uniqueid']),_0xec2037);}});ami['on']('newchannel',function(_0x268e3f){try{utils['debug'](util[_0xde70('0x1b')](_0xde70('0x40'),_0x268e3f[_0xde70('0x21')]),_0x268e3f);calls[_0xde70('0x41')](_0x268e3f);recordings['newchannel'](_0x268e3f);}catch(_0x50f4e1){utils[_0xde70('0x1e')](util['format'](_0xde70('0x40'),_0x268e3f[_0xde70('0x21')]),_0x50f4e1);}});ami['on'](_0xde70('0x42'),function(_0x522a78){try{utils[_0xde70('0x1a')](util[_0xde70('0x1b')](_0xde70('0x43'),_0x522a78[_0xde70('0x21')]),_0x522a78);dials['dialbegin'](_0x522a78);}catch(_0x528fe2){utils[_0xde70('0x1e')](util[_0xde70('0x1b')](_0xde70('0x44'),_0x522a78[_0xde70('0x21')]),_0x528fe2);}});ami['on'](_0xde70('0x45'),function(_0x206b6f){try{utils[_0xde70('0x1a')](util[_0xde70('0x1b')](_0xde70('0x46'),_0x206b6f[_0xde70('0x21')]),_0x206b6f);dials[_0xde70('0x45')](_0x206b6f);}catch(_0x33c974){utils[_0xde70('0x1e')](util[_0xde70('0x1b')](_0xde70('0x46'),_0x206b6f[_0xde70('0x21')]),_0x33c974);}});} \ No newline at end of file +var _0xa516=['varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','env','production','port','asterisk','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','[%s][index][devicestatechange]','device','devicestatechange','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','[%s][index][varset]'];(function(_0x1d9703,_0x11ab72){var _0x14c4d0=function(_0x3416e0){while(--_0x3416e0){_0x1d9703['push'](_0x1d9703['shift']());}};_0x14c4d0(++_0x11ab72);}(_0xa516,0x126));var _0x6a51=function(_0x50ce10,_0x19bd0d){_0x50ce10=_0x50ce10-0x0;var _0x741502=_0xa516[_0x50ce10];return _0x741502;};var AsteriskManager=require(_0x6a51('0x0'));var config=require('../../config/environment');var utils=require(_0x6a51('0x1'));var util=require(_0x6a51('0x2'));var isXDREnabled=config[_0x6a51('0x3')]&&config[_0x6a51('0x3')]['disabled']?!config[_0x6a51('0x3')][_0x6a51('0x4')]:!![];var isProduction=config[_0x6a51('0x5')]===_0x6a51('0x6')||![];var isLocalAsterisk=config[_0x6a51('0x3')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x6a51('0x7')],config[_0x6a51('0x8')]['ip'],config[_0x6a51('0x8')]['username'],config[_0x6a51('0x8')][_0x6a51('0x9')],!![]);ami[_0x6a51('0xa')]();if(!isXDREnabled){utils[_0x6a51('0xb')](_0x6a51('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x6a51('0xb')](_0x6a51('0xd'));}else{var agents=require(_0x6a51('0xe'));var calls=require('./calls.controller');var queues=require(_0x6a51('0xf'));var recordings=require('./recordings.controller');var members=require(_0x6a51('0x10'));var dials=require(_0x6a51('0x11'));var transfers=require('./transfers.controller');var core=require(_0x6a51('0x12'));ami['on'](_0x6a51('0x13'),core[_0x6a51('0x13')]);ami['on']('shutdown',core[_0x6a51('0x14')]);ami['on'](_0x6a51('0x15'),core[_0x6a51('0x15')]);ami['on'](_0x6a51('0x16'),core[_0x6a51('0x16')]);ami['on'](_0x6a51('0x17'),core['close']);ami['on'](_0x6a51('0x18'),core[_0x6a51('0x18')]);ami['on']('devicestatechange',function(_0x2e3a20){try{utils[_0x6a51('0x19')](util['format'](_0x6a51('0x1a'),_0x2e3a20[_0x6a51('0x1b')]),_0x2e3a20);members[_0x6a51('0x1c')](_0x2e3a20);}catch(_0x10fa62){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')]('[%s][index][devicestatechange]',_0x2e3a20['device']),_0x10fa62);}});ami['on'](_0x6a51('0x1e'),function(_0x499171){try{utils['debug'](util['format'](_0x6a51('0x1f'),_0x499171[_0x6a51('0x20')]),_0x499171);agents['agentcalled'](_0x499171);}catch(_0x3b2817){utils[_0x6a51('0x16')](util['format'](_0x6a51('0x1f'),_0x499171[_0x6a51('0x20')]),_0x3b2817);}});ami['on'](_0x6a51('0x21'),function(_0x348bdc){try{utils['debug'](util[_0x6a51('0x1d')](_0x6a51('0x22'),_0x348bdc[_0x6a51('0x20')]),_0x348bdc);agents['agentringnoanswer'](_0x348bdc);}catch(_0x557b96){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')]('[%s][index][agentringnoanswer]',_0x348bdc[_0x6a51('0x20')]),_0x557b96);}});ami['on']('agentconnect',function(_0xeecb3b){try{utils[_0x6a51('0x19')](util[_0x6a51('0x1d')](_0x6a51('0x23'),_0xeecb3b[_0x6a51('0x20')]),_0xeecb3b);agents[_0x6a51('0x24')](_0xeecb3b);queues[_0x6a51('0x24')](_0xeecb3b);}catch(_0x4be9df){utils['error'](util['format']('[%s][index][agentconnect]',_0xeecb3b['uniqueid']),_0x4be9df);}});ami['on'](_0x6a51('0x25'),function(_0x575ba7){try{utils[_0x6a51('0x19')](util[_0x6a51('0x1d')](_0x6a51('0x26'),_0x575ba7[_0x6a51('0x20')]),_0x575ba7);agents[_0x6a51('0x25')](_0x575ba7);queues[_0x6a51('0x25')](_0x575ba7);members['agentcomplete'](_0x575ba7);}catch(_0x432f97){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')](_0x6a51('0x26'),_0x575ba7['uniqueid']),_0x432f97);}});ami['on'](_0x6a51('0x27'),function(_0x46dbe5){try{utils[_0x6a51('0x19')](util['format'](_0x6a51('0x28'),_0x46dbe5[_0x6a51('0x20')]),_0x46dbe5);agents[_0x6a51('0x27')](_0x46dbe5);queues['queuecallerabandon'](_0x46dbe5);}catch(_0x2fc773){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')]('[%s][index][queuecallerabandon]',_0x46dbe5[_0x6a51('0x20')]),_0x2fc773);}});ami['on'](_0x6a51('0x29'),function(_0xda1105){try{utils['debug'](util[_0x6a51('0x1d')]('[%s][index][queuecallerjoin]',_0xda1105[_0x6a51('0x20')]),_0xda1105);queues[_0x6a51('0x29')](_0xda1105);recordings[_0x6a51('0x29')](_0xda1105);}catch(_0xd97afa){utils['error'](util[_0x6a51('0x1d')](_0x6a51('0x2a'),_0xda1105['uniqueid']),_0xd97afa);}});ami['on'](_0x6a51('0x2b'),function(_0x473a06){try{utils[_0x6a51('0x19')](util[_0x6a51('0x1d')](_0x6a51('0x2c'),_0x473a06['uniqueid']),_0x473a06);queues['queuecallerleave'](_0x473a06);}catch(_0x98d68c){utils[_0x6a51('0x16')](util['format'](_0x6a51('0x2c'),_0x473a06[_0x6a51('0x20')]),_0x98d68c);}});ami['on'](_0x6a51('0x2d'),function(_0x57763d){try{utils[_0x6a51('0x19')](util[_0x6a51('0x1d')](_0x6a51('0x2e'),_0x57763d[_0x6a51('0x20')]),_0x57763d);queues[_0x6a51('0x2d')](_0x57763d);calls[_0x6a51('0x2d')](_0x57763d);}catch(_0x3b1497){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')](_0x6a51('0x2e'),_0x57763d[_0x6a51('0x20')]),_0x3b1497);}});ami['on'](_0x6a51('0x2f'),function(_0x3ed45c){try{utils[_0x6a51('0x19')](util['format'](_0x6a51('0x30'),_0x3ed45c['uniqueid']),_0x3ed45c);queues[_0x6a51('0x2f')](_0x3ed45c);calls[_0x6a51('0x2f')](_0x3ed45c);}catch(_0x59a8c5){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')](_0x6a51('0x30'),_0x3ed45c['uniqueid']),_0x59a8c5);}});ami['on'](_0x6a51('0x31'),function(_0x416638){try{utils[_0x6a51('0x19')](util['format'](_0x6a51('0x32'),_0x416638[_0x6a51('0x20')]),_0x416638);calls['newstate'](_0x416638);recordings[_0x6a51('0x31')](_0x416638);}catch(_0x44dc01){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')](_0x6a51('0x32'),_0x416638[_0x6a51('0x20')]),_0x44dc01);}});ami['on'](_0x6a51('0x33'),function(_0x318450){try{utils[_0x6a51('0x19')](util[_0x6a51('0x1d')](_0x6a51('0x34'),_0x318450['uniqueid']),_0x318450);calls[_0x6a51('0x33')](_0x318450);recordings[_0x6a51('0x33')](_0x318450);dials[_0x6a51('0x33')](_0x318450);agents[_0x6a51('0x33')](_0x318450);queues[_0x6a51('0x33')](_0x318450);}catch(_0x5c02a8){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')]('[%s][index][hangup]',_0x318450[_0x6a51('0x20')]),_0x5c02a8);}});ami['on'](_0x6a51('0x35'),function(_0x51dd1e){try{utils[_0x6a51('0x19')](util[_0x6a51('0x1d')](_0x6a51('0x36'),_0x51dd1e[_0x6a51('0x20')]),_0x51dd1e);members[_0x6a51('0x35')](_0x51dd1e);}catch(_0x433cfe){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')]('[%s][index][cdr]',_0x51dd1e[_0x6a51('0x20')]),_0x433cfe);}});ami['on'](_0x6a51('0x37'),function(_0x57b0c8){try{utils[_0x6a51('0x19')](util[_0x6a51('0x1d')](_0x6a51('0x38'),_0x57b0c8[_0x6a51('0x20')]),_0x57b0c8);queues['blindtransfer'](_0x57b0c8);agents[_0x6a51('0x37')](_0x57b0c8);transfers[_0x6a51('0x37')](_0x57b0c8);recordings['blindtransfer'](_0x57b0c8);}catch(_0xbc32f7){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')](_0x6a51('0x38'),_0x57b0c8[_0x6a51('0x20')]),_0xbc32f7);}});ami['on']('attendedtransfer',function(_0x291ce6){try{utils[_0x6a51('0x19')](util['format'](_0x6a51('0x39'),_0x291ce6[_0x6a51('0x3a')]),_0x291ce6);queues[_0x6a51('0x3b')](_0x291ce6);transfers[_0x6a51('0x3b')](_0x291ce6);agents[_0x6a51('0x3b')](_0x291ce6);calls['attendedtransfer'](_0x291ce6);}catch(_0x245d3e){utils[_0x6a51('0x16')](util['format'](_0x6a51('0x39'),_0x291ce6[_0x6a51('0x3a')]),_0x245d3e);}});ami['on']('varset',function(_0x480255){try{utils[_0x6a51('0x19')](util[_0x6a51('0x1d')](_0x6a51('0x3c'),_0x480255['uniqueid']),_0x480255);queues[_0x6a51('0x3d')](_0x480255);recordings[_0x6a51('0x3d')](_0x480255);calls[_0x6a51('0x3d')](_0x480255);dials[_0x6a51('0x3d')](_0x480255);}catch(_0x4f4178){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')](_0x6a51('0x3c'),_0x480255[_0x6a51('0x20')]),_0x4f4178);}});ami['on'](_0x6a51('0x3e'),function(_0x2cd3de){try{utils[_0x6a51('0x19')](util['format'](_0x6a51('0x3f'),_0x2cd3de[_0x6a51('0x20')]),_0x2cd3de);calls[_0x6a51('0x3e')](_0x2cd3de);recordings['newexten'](_0x2cd3de);dials[_0x6a51('0x3e')](_0x2cd3de);}catch(_0x34155c){utils['error'](util[_0x6a51('0x1d')](_0x6a51('0x3f'),_0x2cd3de[_0x6a51('0x20')]),_0x34155c);}});ami['on'](_0x6a51('0x40'),function(_0x2c191c){try{utils[_0x6a51('0x19')](util[_0x6a51('0x1d')](_0x6a51('0x41'),_0x2c191c[_0x6a51('0x20')]),_0x2c191c);calls['newchannel'](_0x2c191c);recordings[_0x6a51('0x40')](_0x2c191c);}catch(_0x3f0a60){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')](_0x6a51('0x41'),_0x2c191c[_0x6a51('0x20')]),_0x3f0a60);}});ami['on'](_0x6a51('0x42'),function(_0xfd95c9){try{utils['debug'](util['format'](_0x6a51('0x43'),_0xfd95c9['uniqueid']),_0xfd95c9);dials['dialbegin'](_0xfd95c9);}catch(_0x5c21c6){utils[_0x6a51('0x16')](util['format'](_0x6a51('0x44'),_0xfd95c9[_0x6a51('0x20')]),_0x5c21c6);}});ami['on'](_0x6a51('0x45'),function(_0x28bd08){try{utils[_0x6a51('0x19')](util[_0x6a51('0x1d')]('[%s][index][dialend]',_0x28bd08[_0x6a51('0x20')]),_0x28bd08);dials[_0x6a51('0x45')](_0x28bd08);}catch(_0x2a1296){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')](_0x6a51('0x46'),_0x28bd08['uniqueid']),_0x2a1296);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 228bf12..b5cc796 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 _0xc694=['[%s][members][writeDB]','uniqueid','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','agentcomplete','[%s][members][agentcomplete]','info','queue','assign','cdr','[%s][members][cdr]','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','data1','lodash','util','./utils','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','split','request','catch','error'];(function(_0x51cabf,_0x2828db){var _0x517538=function(_0x24a966){while(--_0x24a966){_0x51cabf['push'](_0x51cabf['shift']());}};_0x517538(++_0x2828db);}(_0xc694,0x11e));var _0x4c69=function(_0x436add,_0x368cf0){_0x436add=_0x436add-0x0;var _0x413ba6=_0xc694[_0x436add];return _0x413ba6;};'use strict';var _=require(_0x4c69('0x0'));var util=require(_0x4c69('0x1'));var utils=require(_0x4c69('0x2'));var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x35fd24){utils['info'](util[_0x4c69('0x3')](_0x4c69('0x4'),_0x35fd24['uniqueid'],_0x35fd24[_0x4c69('0x5')],_0x35fd24[_0x4c69('0x6')],_0x35fd24[_0x4c69('0x7')],_0x35fd24[_0x4c69('0x8')],_0x35fd24[_0x4c69('0x9')]));if(_0x35fd24[_0x4c69('0x5')]){utils[_0x4c69('0xa')](_0x35fd24[_0x4c69('0x5')])[_0x4c69('0xb')](function(_0x15ea83){if(_0x15ea83){_0x35fd24[_0x4c69('0x8')]=_0x15ea83[_0x4c69('0xc')];_0x35fd24[_0x4c69('0xd')]=_0x15ea83[_0x4c69('0xd')];utils['request'](_0x4c69('0xe'),_0x35fd24);}else{utils[_0x4c69('0xf')](_0x35fd24[_0x4c69('0x5')][_0x4c69('0x10')]('/')[0x1])['then'](function(_0x32ef5a){if(_0x32ef5a){_0x35fd24[_0x4c69('0x8')]=_0x32ef5a['name'];_0x35fd24[_0x4c69('0xd')]=_0x32ef5a[_0x4c69('0xd')];utils[_0x4c69('0x11')]('CreateMemberReport',_0x35fd24);}});}})[_0x4c69('0x12')](function(_0x26931b){utils[_0x4c69('0x13')](util['format'](_0x4c69('0x14'),_0x35fd24[_0x4c69('0x15')]),_0x26931b);});}delete members[_0x35fd24['interface']];}function startsWith(_0x4da49f,_0x2b7bfa){return _[_0x4c69('0x16')](_0x4da49f,function(_0x2444d1){return _[_0x4c69('0x17')](_0x2b7bfa,_0x2444d1);});}exports[_0x4c69('0x18')]=function(_0x4e524a){try{utils[_0x4c69('0x19')](util[_0x4c69('0x3')](_0x4c69('0x1a'),members[_0x4e524a[_0x4c69('0x1b')]]?members[_0x4e524a[_0x4c69('0x1b')]]['uniqueid']:_0x4e524a[_0x4c69('0x1b')]),_0x4e524a);utils['info'](util['format'](_0x4c69('0x1c'),members[_0x4e524a[_0x4c69('0x1b')]]?members[_0x4e524a[_0x4c69('0x1b')]][_0x4c69('0x15')]:_0x4e524a[_0x4c69('0x1b')],_0x4e524a[_0x4c69('0x1d')],_0x4e524a['device']));switch(_0x4e524a[_0x4c69('0x1d')]){case _0x4c69('0x1e'):case _0x4c69('0x1f'):if(!startsWith(exclude,_0x4e524a[_0x4c69('0x1b')])){members[_0x4e524a[_0x4c69('0x1b')]]={'channel':_0x4c69('0x20'),'interface':_0x4e524a[_0x4c69('0x1b')],'type':_0x4c69('0x21'),'enterAt':utils[_0x4c69('0x22')](),'role':_0x4c69('0x23')};}break;case _0x4c69('0x24'):if(!_[_0x4c69('0x25')](members[_0x4e524a['device']])){members[_0x4e524a['device']][_0x4c69('0x26')]=utils[_0x4c69('0x22')]();members[_0x4e524a[_0x4c69('0x1b')]][_0x4c69('0x27')]=utils['diffTime'](members[_0x4e524a['device']][_0x4c69('0x26')],members[_0x4e524a[_0x4c69('0x1b')]]['enterAt']);if(members[_0x4e524a[_0x4c69('0x1b')]][_0x4c69('0x15')]){writeDB(members[_0x4e524a['device']]);}}break;default:break;}}catch(_0x52c505){utils[_0x4c69('0x13')](util[_0x4c69('0x3')](_0x4c69('0x1a'),members[_0x4e524a[_0x4c69('0x1b')]]?members[_0x4e524a[_0x4c69('0x1b')]][_0x4c69('0x15')]:_0x4e524a['device']),_0x52c505);}};exports[_0x4c69('0x28')]=function(_0x4adbf0){try{if(!_[_0x4c69('0x25')](members[_0x4adbf0[_0x4c69('0x5')]])){utils[_0x4c69('0x19')](util[_0x4c69('0x3')](_0x4c69('0x29'),_0x4adbf0[_0x4c69('0x15')]),_0x4adbf0);utils[_0x4c69('0x2a')](util[_0x4c69('0x3')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x4adbf0[_0x4c69('0x15')],_0x4adbf0[_0x4c69('0x5')],_0x4adbf0[_0x4c69('0x2b')]));members[_0x4adbf0[_0x4c69('0x5')]]=_[_0x4c69('0x2c')](members[_0x4adbf0['interface']],{'data4':_0x4adbf0[_0x4c69('0x2b')],'uniqueid':_0x4adbf0[_0x4c69('0x15')]});}}catch(_0x12e4e6){utils[_0x4c69('0x13')](util[_0x4c69('0x3')](_0x4c69('0x29'),_0x4adbf0['uniqueid']),_0x12e4e6);}};exports[_0x4c69('0x2d')]=function(_0xab9a86){try{utils[_0x4c69('0x19')](util[_0x4c69('0x3')](_0x4c69('0x2e'),_0xab9a86[_0x4c69('0x15')]),_0xab9a86);if(_0xab9a86[_0x4c69('0x6')]){var _0x379cef=_0xab9a86[_0x4c69('0x6')][_0x4c69('0x10')]('-')[0x0];if(!_[_0x4c69('0x25')](members[_0x379cef])){members[_0x379cef]=_[_0x4c69('0x2c')](members[_0x379cef],{'data1':members[_0x379cef]['data1']||_0xab9a86['type'],'data2':members[_0x379cef]['data2']||_0xab9a86['source'],'data3':members[_0x379cef][_0x4c69('0x2f')]||_0xab9a86['destination'],'uniqueid':members[_0x379cef][_0x4c69('0x15')]||_0xab9a86[_0x4c69('0x15')]});utils[_0x4c69('0x2a')](util[_0x4c69('0x3')](_0x4c69('0x30'),_0xab9a86[_0x4c69('0x15')],members[_0x379cef]['data1'],members[_0x379cef][_0x4c69('0x7')],members[_0x379cef][_0x4c69('0x2f')]));if(members[_0x379cef][_0x4c69('0x26')]){writeDB(members[_0x379cef]);}}}if(_0xab9a86['destinationchannel']){var _0x229f12=_0xab9a86[_0x4c69('0x31')][_0x4c69('0x10')]('-')[0x0];if(!_[_0x4c69('0x25')](members[_0x229f12])){members[_0x229f12]=_[_0x4c69('0x2c')](members[_0x229f12],{'data1':members[_0x229f12][_0x4c69('0x32')]||_0xab9a86[_0x4c69('0x9')],'data2':members[_0x229f12]['data2']||_0xab9a86['source'],'data3':members[_0x229f12]['data3']||_0xab9a86['destination'],'uniqueid':members[_0x229f12][_0x4c69('0x15')]||_0xab9a86['uniqueid']});utils[_0x4c69('0x2a')](util[_0x4c69('0x3')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xab9a86['uniqueid'],members[_0x229f12][_0x4c69('0x32')],members[_0x229f12]['data2'],members[_0x229f12][_0x4c69('0x2f')]));if(members[_0x229f12][_0x4c69('0x26')]){writeDB(members[_0x229f12]);}}}}catch(_0x1c0d0d){utils[_0x4c69('0x13')](util['format'](_0x4c69('0x2e'),_0xab9a86[_0x4c69('0x15')]),_0x1c0d0d);}}; \ No newline at end of file +var _0xaaa2=['INUSE','BUSY','voice','TALKING','now','isNil','exitAt','duration','agentcomplete','[%s][members][agentcomplete]','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','source','data3','destination','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Local/_attended@transfer','Queue:','format','uniqueid','interface','channel','data2','membername','type','getUserByInterface','name','request','CreateMemberReport','split','then','internal','catch','error','[%s][members][writeDB]','some','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state'];(function(_0x205cab,_0x4cfdef){var _0x4423ad=function(_0x10f799){while(--_0x10f799){_0x205cab['push'](_0x205cab['shift']());}};_0x4423ad(++_0x4cfdef);}(_0xaaa2,0xac));var _0x2aaa=function(_0x59fc23,_0x2c1ecf){_0x59fc23=_0x59fc23-0x0;var _0x51c7d3=_0xaaa2[_0x59fc23];return _0x51c7d3;};'use strict';var _=require(_0x2aaa('0x0'));var util=require(_0x2aaa('0x1'));var utils=require(_0x2aaa('0x2'));var members={};var exclude=[_0x2aaa('0x3'),_0x2aaa('0x4')];function writeDB(_0x10a7bf){utils['info'](util[_0x2aaa('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x10a7bf[_0x2aaa('0x6')],_0x10a7bf[_0x2aaa('0x7')],_0x10a7bf[_0x2aaa('0x8')],_0x10a7bf[_0x2aaa('0x9')],_0x10a7bf[_0x2aaa('0xa')],_0x10a7bf[_0x2aaa('0xb')]));if(_0x10a7bf['interface']){utils[_0x2aaa('0xc')](_0x10a7bf['interface'])['then'](function(_0x139ca7){if(_0x139ca7){_0x10a7bf['membername']=_0x139ca7[_0x2aaa('0xd')];_0x10a7bf['internal']=_0x139ca7['internal'];utils[_0x2aaa('0xe')](_0x2aaa('0xf'),_0x10a7bf);}else{utils['getUserByName'](_0x10a7bf[_0x2aaa('0x7')][_0x2aaa('0x10')]('/')[0x1])[_0x2aaa('0x11')](function(_0x501e2b){if(_0x501e2b){_0x10a7bf[_0x2aaa('0xa')]=_0x501e2b[_0x2aaa('0xd')];_0x10a7bf[_0x2aaa('0x12')]=_0x501e2b[_0x2aaa('0x12')];utils[_0x2aaa('0xe')](_0x2aaa('0xf'),_0x10a7bf);}});}})[_0x2aaa('0x13')](function(_0x104c12){utils[_0x2aaa('0x14')](util[_0x2aaa('0x5')](_0x2aaa('0x15'),_0x10a7bf[_0x2aaa('0x6')]),_0x104c12);});}delete members[_0x10a7bf['interface']];}function startsWith(_0x166321,_0x4df56b){return _[_0x2aaa('0x16')](_0x166321,function(_0x1a5573){return _['startsWith'](_0x4df56b,_0x1a5573);});}exports['devicestatechange']=function(_0x50a767){try{utils[_0x2aaa('0x17')](util[_0x2aaa('0x5')](_0x2aaa('0x18'),members[_0x50a767[_0x2aaa('0x19')]]?members[_0x50a767[_0x2aaa('0x19')]][_0x2aaa('0x6')]:_0x50a767[_0x2aaa('0x19')]),_0x50a767);utils['info'](util[_0x2aaa('0x5')](_0x2aaa('0x1a'),members[_0x50a767['device']]?members[_0x50a767[_0x2aaa('0x19')]]['uniqueid']:_0x50a767['device'],_0x50a767[_0x2aaa('0x1b')],_0x50a767[_0x2aaa('0x19')]));switch(_0x50a767[_0x2aaa('0x1b')]){case _0x2aaa('0x1c'):case _0x2aaa('0x1d'):if(!startsWith(exclude,_0x50a767[_0x2aaa('0x19')])){members[_0x50a767[_0x2aaa('0x19')]]={'channel':_0x2aaa('0x1e'),'interface':_0x50a767['device'],'type':_0x2aaa('0x1f'),'enterAt':utils[_0x2aaa('0x20')](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0x2aaa('0x21')](members[_0x50a767['device']])){members[_0x50a767[_0x2aaa('0x19')]][_0x2aaa('0x22')]=utils['now']();members[_0x50a767[_0x2aaa('0x19')]][_0x2aaa('0x23')]=utils['diffTime'](members[_0x50a767[_0x2aaa('0x19')]][_0x2aaa('0x22')],members[_0x50a767[_0x2aaa('0x19')]]['enterAt']);if(members[_0x50a767[_0x2aaa('0x19')]][_0x2aaa('0x6')]){writeDB(members[_0x50a767['device']]);}}break;default:break;}}catch(_0x565860){utils[_0x2aaa('0x14')](util[_0x2aaa('0x5')](_0x2aaa('0x18'),members[_0x50a767[_0x2aaa('0x19')]]?members[_0x50a767[_0x2aaa('0x19')]][_0x2aaa('0x6')]:_0x50a767[_0x2aaa('0x19')]),_0x565860);}};exports[_0x2aaa('0x24')]=function(_0x12cd47){try{if(!_[_0x2aaa('0x21')](members[_0x12cd47[_0x2aaa('0x7')]])){utils[_0x2aaa('0x17')](util['format'](_0x2aaa('0x25'),_0x12cd47['uniqueid']),_0x12cd47);utils[_0x2aaa('0x26')](util[_0x2aaa('0x5')](_0x2aaa('0x27'),_0x12cd47[_0x2aaa('0x6')],_0x12cd47[_0x2aaa('0x7')],_0x12cd47[_0x2aaa('0x28')]));members[_0x12cd47[_0x2aaa('0x7')]]=_[_0x2aaa('0x29')](members[_0x12cd47[_0x2aaa('0x7')]],{'data4':_0x12cd47[_0x2aaa('0x28')],'uniqueid':_0x12cd47['uniqueid']});}}catch(_0x484c04){utils['error'](util['format']('[%s][members][agentcomplete]',_0x12cd47[_0x2aaa('0x6')]),_0x484c04);}};exports[_0x2aaa('0x2a')]=function(_0x153851){try{utils[_0x2aaa('0x17')](util[_0x2aaa('0x5')](_0x2aaa('0x2b'),_0x153851[_0x2aaa('0x6')]),_0x153851);if(_0x153851[_0x2aaa('0x8')]){var _0x5e9fdf=_0x153851[_0x2aaa('0x8')][_0x2aaa('0x10')]('-')[0x0];if(!_['isNil'](members[_0x5e9fdf])){members[_0x5e9fdf]=_[_0x2aaa('0x29')](members[_0x5e9fdf],{'data1':members[_0x5e9fdf][_0x2aaa('0x2c')]||_0x153851['type'],'data2':members[_0x5e9fdf][_0x2aaa('0x9')]||_0x153851[_0x2aaa('0x2d')],'data3':members[_0x5e9fdf][_0x2aaa('0x2e')]||_0x153851[_0x2aaa('0x2f')],'uniqueid':members[_0x5e9fdf][_0x2aaa('0x6')]||_0x153851[_0x2aaa('0x6')]});utils[_0x2aaa('0x26')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x153851[_0x2aaa('0x6')],members[_0x5e9fdf]['data1'],members[_0x5e9fdf][_0x2aaa('0x9')],members[_0x5e9fdf][_0x2aaa('0x2e')]));if(members[_0x5e9fdf]['exitAt']){writeDB(members[_0x5e9fdf]);}}}if(_0x153851[_0x2aaa('0x30')]){var _0x2cab76=_0x153851[_0x2aaa('0x30')]['split']('-')[0x0];if(!_[_0x2aaa('0x21')](members[_0x2cab76])){members[_0x2cab76]=_[_0x2aaa('0x29')](members[_0x2cab76],{'data1':members[_0x2cab76][_0x2aaa('0x2c')]||_0x153851[_0x2aaa('0xb')],'data2':members[_0x2cab76]['data2']||_0x153851[_0x2aaa('0x2d')],'data3':members[_0x2cab76][_0x2aaa('0x2e')]||_0x153851[_0x2aaa('0x2f')],'uniqueid':members[_0x2cab76][_0x2aaa('0x6')]||_0x153851[_0x2aaa('0x6')]});utils[_0x2aaa('0x26')](util[_0x2aaa('0x5')](_0x2aaa('0x31'),_0x153851[_0x2aaa('0x6')],members[_0x2cab76][_0x2aaa('0x2c')],members[_0x2cab76][_0x2aaa('0x9')],members[_0x2cab76][_0x2aaa('0x2e')]));if(members[_0x2cab76][_0x2aaa('0x22')]){writeDB(members[_0x2cab76]);}}}}catch(_0x54a9c8){utils[_0x2aaa('0x14')](util[_0x2aaa('0x5')](_0x2aaa('0x2b'),_0x153851['uniqueid']),_0x54a9c8);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 6e0ecd3..56b7879 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 _0x8245=['[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','lastAssignedTo','transfer','TRANSFER','COMPLETEDBY','reason','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDED','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','[%s][queues][hangup]','variable','queuestatus','value','CONTINUE','queuecallerabandonAt','queuecallerexitAt','toUpperCase','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s'];(function(_0x30c4c4,_0x4c9f1d){var _0x1f2e38=function(_0x393f9c){while(--_0x393f9c){_0x30c4c4['push'](_0x30c4c4['shift']());}};_0x1f2e38(++_0x4c9f1d);}(_0x8245,0x104));var _0x5824=function(_0x43b747,_0x3ef2c9){_0x43b747=_0x43b747-0x0;var _0x2aa144=_0x8245[_0x43b747];return _0x2aa144;};'use strict';var _=require(_0x5824('0x0'));var util=require(_0x5824('0x1'));var utils=require(_0x5824('0x2'));var queues={};function writeDB(_0x3a3939){utils[_0x5824('0x3')](util['format'](_0x5824('0x4'),_0x3a3939[_0x5824('0x5')],_0x3a3939[_0x5824('0x6')],_0x3a3939[_0x5824('0x7')],_0x3a3939['lastAssignedTo'],_0x3a3939[_0x5824('0x8')],_0x3a3939[_0x5824('0x9')],_0x3a3939[_0x5824('0xa')]));if(_0x3a3939[_0x5824('0x7')]){utils[_0x5824('0xb')](_0x3a3939[_0x5824('0x7')])[_0x5824('0xc')](function(_0x3bad52){if(_0x3bad52){_0x3a3939[_0x5824('0xd')]=_0x3bad52['type'];}utils[_0x5824('0xe')](_0x5824('0xf'),_0x3a3939);});}else{utils['request'](_0x5824('0xf'),_0x3a3939);}if(_0x3a3939[_0x5824('0x10')]){delete queues[_0x3a3939[_0x5824('0x10')]];}else{delete queues[_0x3a3939[_0x5824('0x5')]];}}exports[_0x5824('0x11')]=function(_0x457ff6){try{utils[_0x5824('0x12')](util[_0x5824('0x13')](_0x5824('0x14'),_0x457ff6['uniqueid']),_0x457ff6);utils[_0x5824('0x3')](util[_0x5824('0x13')](_0x5824('0x15'),_0x457ff6[_0x5824('0x5')],_0x457ff6[_0x5824('0x7')],_0x457ff6[_0x5824('0x16')]));queues[_0x457ff6['uniqueid']]=_[_0x5824('0x17')](_0x457ff6,{'originalposition':_0x457ff6['position'],'queuecallerjoinAt':utils[_0x5824('0x18')](),'mohtime':0x0});}catch(_0x402280){utils[_0x5824('0x19')](util[_0x5824('0x13')](_0x5824('0x14'),_0x457ff6[_0x5824('0x5')]),_0x402280);}};exports['hangup']=function(_0xee79e0){try{if(!_[_0x5824('0x1a')](queues[_0xee79e0['uniqueid']])){utils['debug'](util[_0x5824('0x13')]('[%s][queues][hangup]',_0xee79e0[_0x5824('0x5')]),_0xee79e0);if(queues[_0xee79e0['uniqueid']][_0x5824('0x1b')]){if(!queues[_0xee79e0[_0x5824('0x5')]][_0x5824('0x1c')]&&!queues[_0xee79e0[_0x5824('0x5')]][_0x5824('0x1d')]){queues[_0xee79e0[_0x5824('0x5')]][_0x5824('0x1e')]=!![];queues[_0xee79e0['uniqueid']][_0x5824('0x1f')]=utils[_0x5824('0x18')]();queues[_0xee79e0['uniqueid']][_0x5824('0xa')]='COMPLETEDBYAGENT';}utils[_0x5824('0x3')](util[_0x5824('0x13')](_0x5824('0x20'),_0xee79e0['uniqueid'],queues[_0xee79e0[_0x5824('0x5')]][_0x5824('0x21')],queues[_0xee79e0[_0x5824('0x5')]]['queuecallerexitreason']));writeDB(queues[_0xee79e0['uniqueid']]);}else if(queues[_0xee79e0[_0x5824('0x5')]][_0x5824('0x10')]){utils[_0x5824('0x3')](util[_0x5824('0x13')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0xee79e0[_0x5824('0x5')],queues[_0xee79e0[_0x5824('0x5')]][_0x5824('0x21')],queues[_0xee79e0['uniqueid']][_0x5824('0x10')]));queues[queues[_0xee79e0[_0x5824('0x5')]][_0x5824('0x10')]]=queues[_0xee79e0[_0x5824('0x5')]];queues[queues[_0xee79e0['uniqueid']][_0x5824('0x10')]][_0x5824('0x22')]=0x2;delete queues[_0xee79e0[_0x5824('0x5')]];}}}catch(_0x11da7d){utils['error'](util[_0x5824('0x13')](_0x5824('0x23'),_0xee79e0['uniqueid']),_0x11da7d);}};exports['varset']=function(_0x48d015){try{utils[_0x5824('0x12')](util[_0x5824('0x13')]('[%s][queues][varset]',_0x48d015[_0x5824('0x5')]),_0x48d015);if(!_[_0x5824('0x1a')](_0x48d015[_0x5824('0x24')][_0x5824('0x25')])&&_0x48d015[_0x5824('0x26')]['toUpperCase']()!==_0x5824('0x27')){if(!_[_0x5824('0x1a')](queues[_0x48d015['uniqueid']])){queues[_0x48d015[_0x5824('0x5')]][_0x5824('0x1c')]=![];queues[_0x48d015[_0x5824('0x5')]][_0x5824('0x28')]=null;queues[_0x48d015[_0x5824('0x5')]][_0x5824('0x1d')]=!![];queues[_0x48d015[_0x5824('0x5')]][_0x5824('0x29')]=utils[_0x5824('0x18')]();queues[_0x48d015['uniqueid']]['queuecallerexitreason']=_0x48d015[_0x5824('0x26')][_0x5824('0x2a')]();utils[_0x5824('0x3')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x48d015['uniqueid'],queues[_0x48d015[_0x5824('0x5')]][_0x5824('0x21')],_0x48d015[_0x5824('0x26')],queues[_0x48d015['uniqueid']][_0x5824('0xa')]));writeDB(queues[_0x48d015['uniqueid']]);}}else if(!_[_0x5824('0x1a')](_0x48d015[_0x5824('0x24')][_0x5824('0x2b')])){if(!_[_0x5824('0x1a')](queues[_0x48d015[_0x5824('0x5')]])&&!queues[_0x48d015[_0x5824('0x5')]][_0x5824('0x1c')]){queues[_0x48d015[_0x5824('0x5')]][_0x5824('0x1c')]=![];queues[_0x48d015['uniqueid']]['queuecallerabandonAt']=null;queues[_0x48d015[_0x5824('0x5')]][_0x5824('0x1d')]=!![];queues[_0x48d015[_0x5824('0x5')]]['queuecallerexitAt']=utils['now']();queues[_0x48d015[_0x5824('0x5')]][_0x5824('0xa')]=_0x5824('0x2c');utils[_0x5824('0x3')](util[_0x5824('0x13')](_0x5824('0x2d'),_0x48d015['uniqueid'],queues[_0x48d015[_0x5824('0x5')]][_0x5824('0x21')],_0x48d015[_0x5824('0x26')],queues[_0x48d015[_0x5824('0x5')]][_0x5824('0xa')]));}}}catch(_0x534abc){utils[_0x5824('0x19')](util[_0x5824('0x13')]('[%s][queues][varset]',_0x48d015[_0x5824('0x5')]),_0x534abc);}};exports[_0x5824('0x1c')]=function(_0x4465a3){try{if(!_[_0x5824('0x1a')](queues[_0x4465a3['uniqueid']])){utils[_0x5824('0x12')](util[_0x5824('0x13')](_0x5824('0x2e'),_0x4465a3['uniqueid']),_0x4465a3);queues[_0x4465a3['uniqueid']][_0x5824('0x1d')]=![];queues[_0x4465a3[_0x5824('0x5')]][_0x5824('0x29')]=null;queues[_0x4465a3[_0x5824('0x5')]]['queuecallerabandon']=!![];queues[_0x4465a3[_0x5824('0x5')]][_0x5824('0x28')]=utils[_0x5824('0x18')]();queues[_0x4465a3[_0x5824('0x5')]]['queuecallerexitreason']=_0x5824('0x2f');utils[_0x5824('0x3')](util[_0x5824('0x13')](_0x5824('0x30'),_0x4465a3[_0x5824('0x5')],queues[_0x4465a3[_0x5824('0x5')]]['name'],queues[_0x4465a3[_0x5824('0x5')]][_0x5824('0xa')]));}}catch(_0x5bc3fc){utils[_0x5824('0x19')](util[_0x5824('0x13')](_0x5824('0x2e'),_0x4465a3[_0x5824('0x5')]),_0x5bc3fc);}};exports['queuecallerleave']=function(_0x30363c){try{if(!_['isNil'](queues[_0x30363c[_0x5824('0x5')]])){utils[_0x5824('0x12')](util[_0x5824('0x13')](_0x5824('0x31'),_0x30363c[_0x5824('0x5')]),_0x30363c);utils[_0x5824('0x3')](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x30363c[_0x5824('0x5')],queues[_0x30363c[_0x5824('0x5')]][_0x5824('0x21')],_0x30363c[_0x5824('0x32')],_0x30363c[_0x5824('0x33')]));queues[_0x30363c[_0x5824('0x5')]][_0x5824('0x34')]=!![];queues[_0x30363c[_0x5824('0x5')]][_0x5824('0x1b')]=utils[_0x5824('0x18')]();queues[_0x30363c[_0x5824('0x5')]][_0x5824('0x35')]=utils[_0x5824('0x36')](queues[_0x30363c[_0x5824('0x5')]][_0x5824('0x1b')],queues[_0x30363c[_0x5824('0x5')]][_0x5824('0x37')]);queues[_0x30363c['uniqueid']][_0x5824('0x16')]=_0x30363c['position'];queues[_0x30363c[_0x5824('0x5')]][_0x5824('0x38')]=_0x30363c[_0x5824('0x38')];queues[_0x30363c[_0x5824('0x5')]][_0x5824('0x32')]=_0x30363c[_0x5824('0x32')];queues[_0x30363c[_0x5824('0x5')]][_0x5824('0x33')]=_0x30363c[_0x5824('0x33')];}}catch(_0x53b1da){utils[_0x5824('0x19')](util[_0x5824('0x13')](_0x5824('0x31'),_0x30363c[_0x5824('0x5')]),_0x53b1da);}};exports['agentconnect']=function(_0x16365d){try{if(!_['isNil'](queues[_0x16365d['uniqueid']])){utils[_0x5824('0x12')](util[_0x5824('0x13')](_0x5824('0x39'),_0x16365d['uniqueid']),_0x16365d);utils[_0x5824('0x3')](util[_0x5824('0x13')](_0x5824('0x3a'),_0x16365d[_0x5824('0x5')],queues[_0x16365d['uniqueid']][_0x5824('0x21')],_0x16365d[_0x5824('0x3b')],_0x16365d[_0x5824('0x3c')]));queues[_0x16365d['uniqueid']]['queuecallerabandon']=![];queues[_0x16365d[_0x5824('0x5')]][_0x5824('0x1c')]=![];queues[_0x16365d[_0x5824('0x5')]]['queuecallerabandonAt']=null;queues[_0x16365d[_0x5824('0x5')]][_0x5824('0x1d')]=![];queues[_0x16365d[_0x5824('0x5')]]['queuecallerexitreason']=null;queues[_0x16365d[_0x5824('0x5')]][_0x5824('0x29')]=null;queues[_0x16365d[_0x5824('0x5')]][_0x5824('0x3d')]=!![];queues[_0x16365d[_0x5824('0x5')]][_0x5824('0x9')]=_0x16365d['destaccountcode'];queues[_0x16365d[_0x5824('0x5')]]['lastAssignedTo']=_0x16365d['membername'];}}catch(_0x2a4c72){utils['error'](util[_0x5824('0x13')](_0x5824('0x39'),_0x16365d[_0x5824('0x5')]),_0x2a4c72);}};exports[_0x5824('0x3e')]=function(_0xf057f4){try{if(!_['isNil'](queues[_0xf057f4[_0x5824('0x5')]])){if(queues[_0xf057f4[_0x5824('0x5')]]['queuecallerleaveAt']){utils['debug'](util[_0x5824('0x13')](_0x5824('0x3f'),_0xf057f4[_0x5824('0x5')]),_0xf057f4);queues[_0xf057f4[_0x5824('0x5')]][_0x5824('0x1c')]=![];queues[_0xf057f4[_0x5824('0x5')]][_0x5824('0x1c')]=![];queues[_0xf057f4['uniqueid']]['queuecallerabandonAt']=null;queues[_0xf057f4[_0x5824('0x5')]][_0x5824('0x1d')]=![];queues[_0xf057f4[_0x5824('0x5')]][_0x5824('0x29')]=null;queues[_0xf057f4[_0x5824('0x5')]][_0x5824('0x3d')]=!![];queues[_0xf057f4[_0x5824('0x5')]][_0x5824('0x40')]=_0xf057f4[_0x5824('0x3b')];queues[_0xf057f4[_0x5824('0x5')]]['queuecallercomplete']=!![];queues[_0xf057f4[_0x5824('0x5')]]['queuecallercompleteAt']=utils['now']();if(_0xf057f4['reason']==_0x5824('0x41')){if(!queues[_0xf057f4[_0x5824('0x5')]]['transfer']){queues[_0xf057f4[_0x5824('0x5')]]['queuecallerexitreason']=_0x5824('0x42');}}else{queues[_0xf057f4[_0x5824('0x5')]][_0x5824('0xa')]=_0x5824('0x43')+_0xf057f4[_0x5824('0x44')][_0x5824('0x2a')]();}utils['info'](util[_0x5824('0x13')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0xf057f4[_0x5824('0x5')],queues[_0xf057f4[_0x5824('0x5')]]['name'],_0xf057f4[_0x5824('0x3b')],queues[_0xf057f4[_0x5824('0x5')]][_0x5824('0xa')]));writeDB(queues[_0xf057f4[_0x5824('0x5')]]);}}}catch(_0x4f2930){utils[_0x5824('0x19')](util[_0x5824('0x13')](_0x5824('0x3f'),_0xf057f4['uniqueid']),_0x4f2930);}};exports['blindtransfer']=function(_0x2d0a65){try{if(!_[_0x5824('0x1a')](queues[_0x2d0a65[_0x5824('0x45')]])){utils[_0x5824('0x12')](util['format'](_0x5824('0x46'),_0x2d0a65[_0x5824('0x5')]),_0x2d0a65);queues[_0x2d0a65[_0x5824('0x45')]]['transfer']=!![];queues[_0x2d0a65['transfereeuniqueid']][_0x5824('0x47')]=_0x5824('0x48');queues[_0x2d0a65[_0x5824('0x45')]][_0x5824('0x49')]=_0x2d0a65[_0x5824('0x4a')];queues[_0x2d0a65[_0x5824('0x45')]][_0x5824('0x4b')]=_0x2d0a65[_0x5824('0x45')];queues[_0x2d0a65['transfereeuniqueid']]['queuecallerexitreason']=_0x5824('0x4c');utils['info'](util[_0x5824('0x13')](_0x5824('0x4d'),_0x2d0a65['uniqueid'],queues[_0x2d0a65[_0x5824('0x45')]][_0x5824('0x21')],_0x2d0a65[_0x5824('0x45')],_0x2d0a65[_0x5824('0x4a')]));}}catch(_0x54ff10){utils['error'](util[_0x5824('0x13')](_0x5824('0x46'),_0x2d0a65['uniqueid']),_0x54ff10);}};exports[_0x5824('0x4e')]=function(_0x41fb96){try{utils['debug'](util['format']('[%s][queues][attendedtransfer]',_0x41fb96[_0x5824('0x4f')]),_0x41fb96);if(_0x41fb96[_0x5824('0x4f')]==_0x41fb96[_0x5824('0x50')]){if(!_[_0x5824('0x1a')](queues[_0x41fb96[_0x5824('0x51')]])){utils['info'](util['format'](_0x5824('0x52'),_0x41fb96[_0x5824('0x4f')],queues[_0x41fb96[_0x5824('0x51')]][_0x5824('0x21')],_0x41fb96['origtransfererexten']));queues[_0x41fb96[_0x5824('0x51')]][_0x5824('0x41')]=!![];queues[_0x41fb96[_0x5824('0x51')]][_0x5824('0x47')]='ATTENDED';queues[_0x41fb96[_0x5824('0x51')]][_0x5824('0x49')]=_0x41fb96['origtransfererexten'];queues[_0x41fb96[_0x5824('0x51')]][_0x5824('0x4b')]=_0x41fb96[_0x5824('0x4f')];queues[_0x41fb96[_0x5824('0x51')]][_0x5824('0xa')]=_0x5824('0x53');}if(!_[_0x5824('0x1a')](queues[_0x41fb96[_0x5824('0x50')]])){if(_0x41fb96[_0x5824('0x54')]&&queues[_0x41fb96['transfereelinkedid']]){queues[_0x41fb96[_0x5824('0x54')]][_0x5824('0x22')]=0x1;queues[_0x41fb96[_0x5824('0x45')]]=_[_0x5824('0x55')](queues[_0x41fb96[_0x5824('0x54')]]);queues[_0x41fb96['transfereeuniqueid']]['transfereduniqueid']=_0x41fb96['transfertargetuniqueid'];queues[_0x41fb96[_0x5824('0x45')]]['queuecallerenterreason']=0x2;queues[_0x41fb96[_0x5824('0x45')]][_0x5824('0x8')]=queues[_0x41fb96[_0x5824('0x51')]]['calleridnum'];queues[_0x41fb96[_0x5824('0x45')]][_0x5824('0x56')]=queues[_0x41fb96['secondtransfererlinkedid']][_0x5824('0x56')];queues[_0x41fb96[_0x5824('0x45')]][_0x5824('0x37')]=utils['now']();queues[_0x41fb96[_0x5824('0x45')]][_0x5824('0x1b')]=utils[_0x5824('0x18')]();queues[_0x41fb96[_0x5824('0x45')]][_0x5824('0x35')]=0x0;queues[_0x41fb96['transfereeuniqueid']][_0x5824('0x57')]=0x0;utils['info'](util[_0x5824('0x13')](_0x5824('0x58'),_0x41fb96[_0x5824('0x4f')],queues[_0x41fb96['transfereeuniqueid']][_0x5824('0x21')],queues[_0x41fb96[_0x5824('0x45')]][_0x5824('0x8')],queues[_0x41fb96[_0x5824('0x45')]]['calleridname']));}else{utils[_0x5824('0x3')](util[_0x5824('0x13')](_0x5824('0x59'),_0x41fb96[_0x5824('0x4f')],queues[_0x41fb96[_0x5824('0x50')]][_0x5824('0x21')],_0x41fb96['secondtransfererlinkedid']));queues[_0x41fb96['origtransfererlinkedid']][_0x5824('0x10')]=_0x41fb96[_0x5824('0x51')];}}}else if(_0x41fb96[_0x5824('0x5a')]==_0x41fb96['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x41fb96[_0x5824('0x50')]])){utils[_0x5824('0x3')](util[_0x5824('0x13')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x41fb96[_0x5824('0x4f')],queues[_0x41fb96[_0x5824('0x50')]]['name'],_0x41fb96['secondtransfereruniqueid'],_0x41fb96[_0x5824('0x5b')]));queues[_0x41fb96[_0x5824('0x50')]][_0x5824('0x41')]=!![];queues[_0x41fb96[_0x5824('0x50')]][_0x5824('0x47')]=_0x5824('0x5c');queues[_0x41fb96['origtransfererlinkedid']][_0x5824('0x49')]=_0x41fb96[_0x5824('0x5b')];queues[_0x41fb96['origtransfererlinkedid']]['transferuniqueid']=_0x41fb96[_0x5824('0x5a')];queues[_0x41fb96[_0x5824('0x50')]][_0x5824('0xa')]='ATTENDEDTRANSFER';}if(!_[_0x5824('0x1a')](queues[_0x41fb96[_0x5824('0x51')]])){if(_0x41fb96[_0x5824('0x5d')]&&queues[_0x41fb96['transfertargetlinkedid']]){queues[_0x41fb96[_0x5824('0x5d')]]['queuecallerenterreason']=0x1;queues[_0x41fb96[_0x5824('0x5e')]]=_['clone'](queues[_0x41fb96[_0x5824('0x5d')]]);queues[_0x41fb96['transfertargetuniqueid']][_0x5824('0x10')]=_0x41fb96[_0x5824('0x5e')];queues[_0x41fb96[_0x5824('0x5e')]][_0x5824('0x22')]=0x2;queues[_0x41fb96[_0x5824('0x5e')]][_0x5824('0x8')]=queues[_0x41fb96['origtransfererlinkedid']][_0x5824('0x8')];queues[_0x41fb96['transfertargetuniqueid']][_0x5824('0x56')]=queues[_0x41fb96['origtransfererlinkedid']][_0x5824('0x56')];queues[_0x41fb96[_0x5824('0x5e')]][_0x5824('0x37')]=utils[_0x5824('0x18')]();queues[_0x41fb96[_0x5824('0x5e')]]['queuecallerleaveAt']=utils[_0x5824('0x18')]();queues[_0x41fb96['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x41fb96[_0x5824('0x5e')]]['mohtime']=0x0;utils[_0x5824('0x3')](util[_0x5824('0x13')](_0x5824('0x5f'),_0x41fb96[_0x5824('0x4f')],queues[_0x41fb96[_0x5824('0x5e')]][_0x5824('0x21')],queues[_0x41fb96['transfertargetuniqueid']][_0x5824('0x10')],queues[_0x41fb96[_0x5824('0x5e')]][_0x5824('0x8')],queues[_0x41fb96[_0x5824('0x5e')]][_0x5824('0x56')]));}else{utils[_0x5824('0x3')](util[_0x5824('0x13')](_0x5824('0x59'),_0x41fb96[_0x5824('0x4f')],queues[_0x41fb96[_0x5824('0x51')]][_0x5824('0x21')],_0x41fb96['origtransfererlinkedid']));queues[_0x41fb96[_0x5824('0x51')]][_0x5824('0x10')]=_0x41fb96['origtransfererlinkedid'];}}}}catch(_0x31a151){utils[_0x5824('0x19')](util[_0x5824('0x13')]('[%s][queues][attendedtransfer]',_0x41fb96[_0x5824('0x4f')]),_0x31a151);}};exports[_0x5824('0x60')]=function(_0x501060){try{if(!_[_0x5824('0x1a')](queues[_0x501060[_0x5824('0x5')]])){utils[_0x5824('0x12')](util[_0x5824('0x13')](_0x5824('0x61'),_0x501060[_0x5824('0x5')]),_0x501060);queues[_0x501060['uniqueid']][_0x5824('0x62')]=utils[_0x5824('0x18')]();utils['info'](util[_0x5824('0x13')](_0x5824('0x63'),_0x501060[_0x5824('0x5')],queues[_0x501060[_0x5824('0x5')]][_0x5824('0x21')],queues[_0x501060['uniqueid']]['musiconholdstartAt']));}}catch(_0x58ccee){utils[_0x5824('0x19')](util[_0x5824('0x13')](_0x5824('0x61'),_0x501060['uniqueid']),_0x58ccee);}};exports[_0x5824('0x64')]=function(_0x2cb2a4){try{if(!_['isNil'](queues[_0x2cb2a4[_0x5824('0x5')]])){if(!_[_0x5824('0x1a')](queues[_0x2cb2a4[_0x5824('0x5')]]['musiconholdstartAt'])){utils['debug'](util[_0x5824('0x13')]('[%s][queues][musiconholdstop]',_0x2cb2a4[_0x5824('0x5')]),_0x2cb2a4);queues[_0x2cb2a4['uniqueid']][_0x5824('0x57')]+=utils['diffTime'](utils[_0x5824('0x18')](),queues[_0x2cb2a4[_0x5824('0x5')]]['musiconholdstartAt']);utils[_0x5824('0x3')](util[_0x5824('0x13')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x2cb2a4[_0x5824('0x5')],queues[_0x2cb2a4[_0x5824('0x5')]][_0x5824('0x21')],queues[_0x2cb2a4['uniqueid']][_0x5824('0x57')]));delete queues[_0x2cb2a4[_0x5824('0x5')]][_0x5824('0x62')];}}}catch(_0x25295a){utils['error'](util[_0x5824('0x13')](_0x5824('0x65'),_0x2cb2a4[_0x5824('0x5')]),_0x25295a);}}; \ No newline at end of file +var _0xdfa1=['[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','transferuniqueid','extension','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','transfertargetlinkedid','queuecallerenterreason','mohtime','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','diffTime','[%s][queues][musiconholdstop]','util','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','queue','lastAssignedTo','calleridnum','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','uniqueid','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','error','[%s][queues][queuecallerjoin]','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','info','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','queuestatus','value','CONTINUE','queuecallerexitAt','queuecallerexitreason','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','queuecallerabandonAt','EXITWITHKEY','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','position','count','agentconnect'];(function(_0x110872,_0x5e2a88){var _0x4607aa=function(_0x135e70){while(--_0x135e70){_0x110872['push'](_0x110872['shift']());}};_0x4607aa(++_0x5e2a88);}(_0xdfa1,0xfc));var _0x1dfa=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdfa1[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x1dfa('0x0'));var utils=require('./utils');var queues={};function writeDB(_0x1fc41c){utils['info'](util[_0x1dfa('0x1')](_0x1dfa('0x2'),_0x1fc41c['uniqueid'],_0x1fc41c['channel'],_0x1fc41c[_0x1dfa('0x3')],_0x1fc41c[_0x1dfa('0x4')],_0x1fc41c[_0x1dfa('0x5')],_0x1fc41c['accountcode'],_0x1fc41c['queuecallerexitreason']));if(_0x1fc41c[_0x1dfa('0x3')]){utils[_0x1dfa('0x6')](_0x1fc41c[_0x1dfa('0x3')])[_0x1dfa('0x7')](function(_0x4cec83){if(_0x4cec83){_0x1fc41c[_0x1dfa('0x8')]=_0x4cec83['type'];}utils['request'](_0x1dfa('0x9'),_0x1fc41c);});}else{utils[_0x1dfa('0xa')](_0x1dfa('0x9'),_0x1fc41c);}if(_0x1fc41c['transfereduniqueid']){delete queues[_0x1fc41c[_0x1dfa('0xb')]];}else{delete queues[_0x1fc41c['uniqueid']];}}exports[_0x1dfa('0xc')]=function(_0x476811){try{utils[_0x1dfa('0xd')](util[_0x1dfa('0x1')]('[%s][queues][queuecallerjoin]',_0x476811[_0x1dfa('0xe')]),_0x476811);utils['info'](util[_0x1dfa('0x1')](_0x1dfa('0xf'),_0x476811['uniqueid'],_0x476811['queue'],_0x476811['position']));queues[_0x476811[_0x1dfa('0xe')]]=_['assign'](_0x476811,{'originalposition':_0x476811['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x52eb38){utils[_0x1dfa('0x10')](util[_0x1dfa('0x1')](_0x1dfa('0x11'),_0x476811[_0x1dfa('0xe')]),_0x52eb38);}};exports[_0x1dfa('0x12')]=function(_0x4ca95b){try{if(!_[_0x1dfa('0x13')](queues[_0x4ca95b['uniqueid']])){utils[_0x1dfa('0xd')](util[_0x1dfa('0x1')](_0x1dfa('0x14'),_0x4ca95b[_0x1dfa('0xe')]),_0x4ca95b);if(queues[_0x4ca95b[_0x1dfa('0xe')]][_0x1dfa('0x15')]){if(!queues[_0x4ca95b[_0x1dfa('0xe')]][_0x1dfa('0x16')]&&!queues[_0x4ca95b[_0x1dfa('0xe')]][_0x1dfa('0x17')]){queues[_0x4ca95b['uniqueid']][_0x1dfa('0x18')]=!![];queues[_0x4ca95b['uniqueid']][_0x1dfa('0x19')]=utils[_0x1dfa('0x1a')]();queues[_0x4ca95b[_0x1dfa('0xe')]]['queuecallerexitreason']=_0x1dfa('0x1b');}utils[_0x1dfa('0x1c')](util[_0x1dfa('0x1')](_0x1dfa('0x1d'),_0x4ca95b['uniqueid'],queues[_0x4ca95b[_0x1dfa('0xe')]][_0x1dfa('0x1e')],queues[_0x4ca95b[_0x1dfa('0xe')]]['queuecallerexitreason']));writeDB(queues[_0x4ca95b[_0x1dfa('0xe')]]);}else if(queues[_0x4ca95b[_0x1dfa('0xe')]][_0x1dfa('0xb')]){utils[_0x1dfa('0x1c')](util[_0x1dfa('0x1')](_0x1dfa('0x1f'),_0x4ca95b[_0x1dfa('0xe')],queues[_0x4ca95b[_0x1dfa('0xe')]][_0x1dfa('0x1e')],queues[_0x4ca95b[_0x1dfa('0xe')]][_0x1dfa('0xb')]));queues[queues[_0x4ca95b[_0x1dfa('0xe')]][_0x1dfa('0xb')]]=queues[_0x4ca95b[_0x1dfa('0xe')]];queues[queues[_0x4ca95b[_0x1dfa('0xe')]][_0x1dfa('0xb')]]['queuecallerenterreason']=0x2;delete queues[_0x4ca95b[_0x1dfa('0xe')]];}}}catch(_0x462f2f){utils['error'](util['format']('[%s][queues][hangup]',_0x4ca95b['uniqueid']),_0x462f2f);}};exports[_0x1dfa('0x20')]=function(_0x5a2d1c){try{utils[_0x1dfa('0xd')](util[_0x1dfa('0x1')](_0x1dfa('0x21'),_0x5a2d1c[_0x1dfa('0xe')]),_0x5a2d1c);if(!_['isNil'](_0x5a2d1c['variable'][_0x1dfa('0x22')])&&_0x5a2d1c[_0x1dfa('0x23')]['toUpperCase']()!==_0x1dfa('0x24')){if(!_[_0x1dfa('0x13')](queues[_0x5a2d1c[_0x1dfa('0xe')]])){queues[_0x5a2d1c['uniqueid']][_0x1dfa('0x16')]=![];queues[_0x5a2d1c['uniqueid']]['queuecallerabandonAt']=null;queues[_0x5a2d1c['uniqueid']]['queuecallerexit']=!![];queues[_0x5a2d1c[_0x1dfa('0xe')]][_0x1dfa('0x25')]=utils[_0x1dfa('0x1a')]();queues[_0x5a2d1c[_0x1dfa('0xe')]][_0x1dfa('0x26')]=_0x5a2d1c[_0x1dfa('0x23')]['toUpperCase']();utils[_0x1dfa('0x1c')](util['format'](_0x1dfa('0x27'),_0x5a2d1c[_0x1dfa('0xe')],queues[_0x5a2d1c[_0x1dfa('0xe')]][_0x1dfa('0x1e')],_0x5a2d1c[_0x1dfa('0x23')],queues[_0x5a2d1c[_0x1dfa('0xe')]]['queuecallerexitreason']));writeDB(queues[_0x5a2d1c[_0x1dfa('0xe')]]);}}else if(!_['isNil'](_0x5a2d1c[_0x1dfa('0x28')][_0x1dfa('0x29')])){if(!_[_0x1dfa('0x13')](queues[_0x5a2d1c[_0x1dfa('0xe')]])&&!queues[_0x5a2d1c[_0x1dfa('0xe')]]['queuecallerabandon']){queues[_0x5a2d1c[_0x1dfa('0xe')]]['queuecallerabandon']=![];queues[_0x5a2d1c['uniqueid']][_0x1dfa('0x2a')]=null;queues[_0x5a2d1c[_0x1dfa('0xe')]]['queuecallerexit']=!![];queues[_0x5a2d1c['uniqueid']]['queuecallerexitAt']=utils[_0x1dfa('0x1a')]();queues[_0x5a2d1c['uniqueid']][_0x1dfa('0x26')]=_0x1dfa('0x2b');utils['info'](util[_0x1dfa('0x1')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x5a2d1c[_0x1dfa('0xe')],queues[_0x5a2d1c[_0x1dfa('0xe')]][_0x1dfa('0x1e')],_0x5a2d1c[_0x1dfa('0x23')],queues[_0x5a2d1c['uniqueid']][_0x1dfa('0x26')]));}}}catch(_0x51f125){utils[_0x1dfa('0x10')](util['format'](_0x1dfa('0x21'),_0x5a2d1c['uniqueid']),_0x51f125);}};exports['queuecallerabandon']=function(_0x18e0ae){try{if(!_[_0x1dfa('0x13')](queues[_0x18e0ae[_0x1dfa('0xe')]])){utils[_0x1dfa('0xd')](util[_0x1dfa('0x1')]('[%s][queues][queuecallerabandon]',_0x18e0ae[_0x1dfa('0xe')]),_0x18e0ae);queues[_0x18e0ae[_0x1dfa('0xe')]][_0x1dfa('0x17')]=![];queues[_0x18e0ae[_0x1dfa('0xe')]]['queuecallerexitAt']=null;queues[_0x18e0ae['uniqueid']][_0x1dfa('0x16')]=!![];queues[_0x18e0ae[_0x1dfa('0xe')]]['queuecallerabandonAt']=utils[_0x1dfa('0x1a')]();queues[_0x18e0ae[_0x1dfa('0xe')]][_0x1dfa('0x26')]=_0x1dfa('0x2c');utils['info'](util[_0x1dfa('0x1')](_0x1dfa('0x2d'),_0x18e0ae[_0x1dfa('0xe')],queues[_0x18e0ae['uniqueid']][_0x1dfa('0x1e')],queues[_0x18e0ae['uniqueid']][_0x1dfa('0x26')]));}}catch(_0x4135c4){utils[_0x1dfa('0x10')](util['format'](_0x1dfa('0x2e'),_0x18e0ae[_0x1dfa('0xe')]),_0x4135c4);}};exports[_0x1dfa('0x2f')]=function(_0x29490f){try{if(!_['isNil'](queues[_0x29490f[_0x1dfa('0xe')]])){utils[_0x1dfa('0xd')](util['format'](_0x1dfa('0x30'),_0x29490f[_0x1dfa('0xe')]),_0x29490f);utils[_0x1dfa('0x1c')](util[_0x1dfa('0x1')](_0x1dfa('0x31'),_0x29490f[_0x1dfa('0xe')],queues[_0x29490f[_0x1dfa('0xe')]][_0x1dfa('0x1e')],_0x29490f[_0x1dfa('0x32')],_0x29490f[_0x1dfa('0x33')]));queues[_0x29490f['uniqueid']]['queuecallerleave']=!![];queues[_0x29490f[_0x1dfa('0xe')]][_0x1dfa('0x15')]=utils['now']();queues[_0x29490f['uniqueid']][_0x1dfa('0x34')]=utils['diffTime'](queues[_0x29490f[_0x1dfa('0xe')]][_0x1dfa('0x15')],queues[_0x29490f[_0x1dfa('0xe')]][_0x1dfa('0x35')]);queues[_0x29490f[_0x1dfa('0xe')]][_0x1dfa('0x36')]=_0x29490f[_0x1dfa('0x36')];queues[_0x29490f[_0x1dfa('0xe')]][_0x1dfa('0x37')]=_0x29490f['count'];queues[_0x29490f[_0x1dfa('0xe')]][_0x1dfa('0x32')]=_0x29490f[_0x1dfa('0x32')];queues[_0x29490f[_0x1dfa('0xe')]][_0x1dfa('0x33')]=_0x29490f['connectedlinename'];}}catch(_0x9d9534){utils['error'](util['format'](_0x1dfa('0x30'),_0x29490f[_0x1dfa('0xe')]),_0x9d9534);}};exports[_0x1dfa('0x38')]=function(_0x1b0fe8){try{if(!_[_0x1dfa('0x13')](queues[_0x1b0fe8['uniqueid']])){utils['debug'](util[_0x1dfa('0x1')](_0x1dfa('0x39'),_0x1b0fe8['uniqueid']),_0x1b0fe8);utils[_0x1dfa('0x1c')](util[_0x1dfa('0x1')](_0x1dfa('0x3a'),_0x1b0fe8[_0x1dfa('0xe')],queues[_0x1b0fe8['uniqueid']][_0x1dfa('0x1e')],_0x1b0fe8[_0x1dfa('0x3b')],_0x1b0fe8[_0x1dfa('0x3c')]));queues[_0x1b0fe8[_0x1dfa('0xe')]][_0x1dfa('0x16')]=![];queues[_0x1b0fe8[_0x1dfa('0xe')]][_0x1dfa('0x16')]=![];queues[_0x1b0fe8[_0x1dfa('0xe')]][_0x1dfa('0x2a')]=null;queues[_0x1b0fe8['uniqueid']]['queuecallerexit']=![];queues[_0x1b0fe8['uniqueid']][_0x1dfa('0x26')]=null;queues[_0x1b0fe8[_0x1dfa('0xe')]][_0x1dfa('0x25')]=null;queues[_0x1b0fe8[_0x1dfa('0xe')]][_0x1dfa('0x3d')]=!![];queues[_0x1b0fe8[_0x1dfa('0xe')]][_0x1dfa('0x3e')]=_0x1b0fe8[_0x1dfa('0x3c')];queues[_0x1b0fe8[_0x1dfa('0xe')]]['lastAssignedTo']=_0x1b0fe8[_0x1dfa('0x3b')];}}catch(_0x3f537e){utils[_0x1dfa('0x10')](util[_0x1dfa('0x1')]('[%s][queues][agentconnect]',_0x1b0fe8[_0x1dfa('0xe')]),_0x3f537e);}};exports[_0x1dfa('0x3f')]=function(_0x2c55db){try{if(!_[_0x1dfa('0x13')](queues[_0x2c55db[_0x1dfa('0xe')]])){if(queues[_0x2c55db[_0x1dfa('0xe')]][_0x1dfa('0x15')]){utils['debug'](util[_0x1dfa('0x1')](_0x1dfa('0x40'),_0x2c55db[_0x1dfa('0xe')]),_0x2c55db);queues[_0x2c55db[_0x1dfa('0xe')]]['queuecallerabandon']=![];queues[_0x2c55db['uniqueid']]['queuecallerabandon']=![];queues[_0x2c55db['uniqueid']][_0x1dfa('0x2a')]=null;queues[_0x2c55db['uniqueid']][_0x1dfa('0x17')]=![];queues[_0x2c55db['uniqueid']][_0x1dfa('0x25')]=null;queues[_0x2c55db['uniqueid']]['assigned']=!![];queues[_0x2c55db[_0x1dfa('0xe')]]['lastAssignedTo']=_0x2c55db['membername'];queues[_0x2c55db[_0x1dfa('0xe')]][_0x1dfa('0x18')]=!![];queues[_0x2c55db['uniqueid']]['queuecallercompleteAt']=utils[_0x1dfa('0x1a')]();if(_0x2c55db[_0x1dfa('0x41')]==_0x1dfa('0x42')){if(!queues[_0x2c55db['uniqueid']]['transfer']){queues[_0x2c55db[_0x1dfa('0xe')]][_0x1dfa('0x26')]=_0x1dfa('0x43');}}else{queues[_0x2c55db[_0x1dfa('0xe')]][_0x1dfa('0x26')]=_0x1dfa('0x44')+_0x2c55db['reason'][_0x1dfa('0x45')]();}utils['info'](util[_0x1dfa('0x1')](_0x1dfa('0x46'),_0x2c55db[_0x1dfa('0xe')],queues[_0x2c55db[_0x1dfa('0xe')]][_0x1dfa('0x1e')],_0x2c55db[_0x1dfa('0x3b')],queues[_0x2c55db['uniqueid']][_0x1dfa('0x26')]));writeDB(queues[_0x2c55db[_0x1dfa('0xe')]]);}}}catch(_0x1b12f5){utils[_0x1dfa('0x10')](util[_0x1dfa('0x1')]('[%s][queues][agentcomplete]',_0x2c55db[_0x1dfa('0xe')]),_0x1b12f5);}};exports[_0x1dfa('0x47')]=function(_0x175ce1){try{if(!_[_0x1dfa('0x13')](queues[_0x175ce1[_0x1dfa('0x48')]])){utils['debug'](util['format'](_0x1dfa('0x49'),_0x175ce1['uniqueid']),_0x175ce1);queues[_0x175ce1[_0x1dfa('0x48')]][_0x1dfa('0x42')]=!![];queues[_0x175ce1[_0x1dfa('0x48')]][_0x1dfa('0x4a')]=_0x1dfa('0x4b');queues[_0x175ce1[_0x1dfa('0x48')]][_0x1dfa('0x4c')]=_0x175ce1['extension'];queues[_0x175ce1['transfereeuniqueid']][_0x1dfa('0x4d')]=_0x175ce1[_0x1dfa('0x48')];queues[_0x175ce1['transfereeuniqueid']][_0x1dfa('0x26')]='BLINDTRANSFER';utils[_0x1dfa('0x1c')](util['format']('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x175ce1[_0x1dfa('0xe')],queues[_0x175ce1[_0x1dfa('0x48')]][_0x1dfa('0x1e')],_0x175ce1[_0x1dfa('0x48')],_0x175ce1[_0x1dfa('0x4e')]));}}catch(_0x3bbc46){utils[_0x1dfa('0x10')](util['format'](_0x1dfa('0x49'),_0x175ce1[_0x1dfa('0xe')]),_0x3bbc46);}};exports['attendedtransfer']=function(_0x19a5d7){try{utils['debug'](util[_0x1dfa('0x1')](_0x1dfa('0x4f'),_0x19a5d7[_0x1dfa('0x50')]),_0x19a5d7);if(_0x19a5d7[_0x1dfa('0x50')]==_0x19a5d7[_0x1dfa('0x51')]){if(!_['isNil'](queues[_0x19a5d7['secondtransfererlinkedid']])){utils[_0x1dfa('0x1c')](util['format'](_0x1dfa('0x52'),_0x19a5d7[_0x1dfa('0x50')],queues[_0x19a5d7[_0x1dfa('0x53')]][_0x1dfa('0x1e')],_0x19a5d7[_0x1dfa('0x54')]));queues[_0x19a5d7[_0x1dfa('0x53')]][_0x1dfa('0x42')]=!![];queues[_0x19a5d7[_0x1dfa('0x53')]][_0x1dfa('0x4a')]=_0x1dfa('0x55');queues[_0x19a5d7['secondtransfererlinkedid']][_0x1dfa('0x4c')]=_0x19a5d7[_0x1dfa('0x54')];queues[_0x19a5d7['secondtransfererlinkedid']][_0x1dfa('0x4d')]=_0x19a5d7[_0x1dfa('0x50')];queues[_0x19a5d7['secondtransfererlinkedid']][_0x1dfa('0x26')]=_0x1dfa('0x56');}if(!_[_0x1dfa('0x13')](queues[_0x19a5d7[_0x1dfa('0x51')]])){if(_0x19a5d7[_0x1dfa('0x57')]&&queues[_0x19a5d7['transfereelinkedid']]){queues[_0x19a5d7['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x19a5d7[_0x1dfa('0x48')]]=_[_0x1dfa('0x58')](queues[_0x19a5d7[_0x1dfa('0x57')]]);queues[_0x19a5d7['transfereeuniqueid']][_0x1dfa('0xb')]=_0x19a5d7[_0x1dfa('0x59')];queues[_0x19a5d7[_0x1dfa('0x48')]]['queuecallerenterreason']=0x2;queues[_0x19a5d7[_0x1dfa('0x48')]][_0x1dfa('0x5')]=queues[_0x19a5d7[_0x1dfa('0x53')]]['calleridnum'];queues[_0x19a5d7[_0x1dfa('0x48')]][_0x1dfa('0x5a')]=queues[_0x19a5d7[_0x1dfa('0x53')]]['calleridname'];queues[_0x19a5d7[_0x1dfa('0x48')]][_0x1dfa('0x35')]=utils['now']();queues[_0x19a5d7[_0x1dfa('0x48')]][_0x1dfa('0x15')]=utils[_0x1dfa('0x1a')]();queues[_0x19a5d7[_0x1dfa('0x48')]][_0x1dfa('0x34')]=0x0;queues[_0x19a5d7[_0x1dfa('0x48')]]['mohtime']=0x0;utils['info'](util[_0x1dfa('0x1')](_0x1dfa('0x5b'),_0x19a5d7['origtransfereruniqueid'],queues[_0x19a5d7[_0x1dfa('0x48')]]['name'],queues[_0x19a5d7['transfereeuniqueid']][_0x1dfa('0x5')],queues[_0x19a5d7[_0x1dfa('0x48')]][_0x1dfa('0x5a')]));}else{utils[_0x1dfa('0x1c')](util[_0x1dfa('0x1')](_0x1dfa('0x5c'),_0x19a5d7[_0x1dfa('0x50')],queues[_0x19a5d7['origtransfererlinkedid']][_0x1dfa('0x1e')],_0x19a5d7[_0x1dfa('0x53')]));queues[_0x19a5d7['origtransfererlinkedid']][_0x1dfa('0xb')]=_0x19a5d7[_0x1dfa('0x53')];}}}else if(_0x19a5d7[_0x1dfa('0x5d')]==_0x19a5d7['secondtransfererlinkedid']){if(!_[_0x1dfa('0x13')](queues[_0x19a5d7['origtransfererlinkedid']])){utils[_0x1dfa('0x1c')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x19a5d7[_0x1dfa('0x50')],queues[_0x19a5d7[_0x1dfa('0x51')]][_0x1dfa('0x1e')],_0x19a5d7[_0x1dfa('0x5d')],_0x19a5d7['secondtransfererexten']));queues[_0x19a5d7['origtransfererlinkedid']][_0x1dfa('0x42')]=!![];queues[_0x19a5d7[_0x1dfa('0x51')]][_0x1dfa('0x4a')]=_0x1dfa('0x55');queues[_0x19a5d7[_0x1dfa('0x51')]]['transferexten']=_0x19a5d7['secondtransfererexten'];queues[_0x19a5d7['origtransfererlinkedid']]['transferuniqueid']=_0x19a5d7[_0x1dfa('0x5d')];queues[_0x19a5d7[_0x1dfa('0x51')]][_0x1dfa('0x26')]=_0x1dfa('0x56');}if(!_[_0x1dfa('0x13')](queues[_0x19a5d7[_0x1dfa('0x53')]])){if(_0x19a5d7[_0x1dfa('0x5e')]&&queues[_0x19a5d7[_0x1dfa('0x5e')]]){queues[_0x19a5d7[_0x1dfa('0x5e')]][_0x1dfa('0x5f')]=0x1;queues[_0x19a5d7[_0x1dfa('0x59')]]=_['clone'](queues[_0x19a5d7[_0x1dfa('0x5e')]]);queues[_0x19a5d7[_0x1dfa('0x59')]][_0x1dfa('0xb')]=_0x19a5d7[_0x1dfa('0x59')];queues[_0x19a5d7['transfertargetuniqueid']][_0x1dfa('0x5f')]=0x2;queues[_0x19a5d7[_0x1dfa('0x59')]][_0x1dfa('0x5')]=queues[_0x19a5d7[_0x1dfa('0x51')]][_0x1dfa('0x5')];queues[_0x19a5d7[_0x1dfa('0x59')]][_0x1dfa('0x5a')]=queues[_0x19a5d7[_0x1dfa('0x51')]][_0x1dfa('0x5a')];queues[_0x19a5d7[_0x1dfa('0x59')]][_0x1dfa('0x35')]=utils[_0x1dfa('0x1a')]();queues[_0x19a5d7[_0x1dfa('0x59')]]['queuecallerleaveAt']=utils['now']();queues[_0x19a5d7[_0x1dfa('0x59')]]['holdtime']=0x0;queues[_0x19a5d7['transfertargetuniqueid']][_0x1dfa('0x60')]=0x0;utils[_0x1dfa('0x1c')](util[_0x1dfa('0x1')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x19a5d7['origtransfereruniqueid'],queues[_0x19a5d7[_0x1dfa('0x59')]][_0x1dfa('0x1e')],queues[_0x19a5d7[_0x1dfa('0x59')]]['transfereduniqueid'],queues[_0x19a5d7[_0x1dfa('0x59')]]['calleridnum'],queues[_0x19a5d7[_0x1dfa('0x59')]][_0x1dfa('0x5a')]));}else{utils[_0x1dfa('0x1c')](util['format'](_0x1dfa('0x5c'),_0x19a5d7['origtransfereruniqueid'],queues[_0x19a5d7['secondtransfererlinkedid']][_0x1dfa('0x1e')],_0x19a5d7[_0x1dfa('0x51')]));queues[_0x19a5d7[_0x1dfa('0x53')]][_0x1dfa('0xb')]=_0x19a5d7['origtransfererlinkedid'];}}}}catch(_0x534764){utils[_0x1dfa('0x10')](util[_0x1dfa('0x1')](_0x1dfa('0x4f'),_0x19a5d7['origtransfereruniqueid']),_0x534764);}};exports[_0x1dfa('0x61')]=function(_0x1a3695){try{if(!_[_0x1dfa('0x13')](queues[_0x1a3695[_0x1dfa('0xe')]])){utils[_0x1dfa('0xd')](util[_0x1dfa('0x1')](_0x1dfa('0x62'),_0x1a3695['uniqueid']),_0x1a3695);queues[_0x1a3695[_0x1dfa('0xe')]][_0x1dfa('0x63')]=utils[_0x1dfa('0x1a')]();utils[_0x1dfa('0x1c')](util[_0x1dfa('0x1')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x1a3695[_0x1dfa('0xe')],queues[_0x1a3695[_0x1dfa('0xe')]][_0x1dfa('0x1e')],queues[_0x1a3695[_0x1dfa('0xe')]][_0x1dfa('0x63')]));}}catch(_0x27b83c){utils[_0x1dfa('0x10')](util['format'](_0x1dfa('0x62'),_0x1a3695[_0x1dfa('0xe')]),_0x27b83c);}};exports[_0x1dfa('0x64')]=function(_0x39346a){try{if(!_[_0x1dfa('0x13')](queues[_0x39346a['uniqueid']])){if(!_[_0x1dfa('0x13')](queues[_0x39346a['uniqueid']][_0x1dfa('0x63')])){utils['debug'](util[_0x1dfa('0x1')]('[%s][queues][musiconholdstop]',_0x39346a['uniqueid']),_0x39346a);queues[_0x39346a['uniqueid']]['mohtime']+=utils[_0x1dfa('0x65')](utils[_0x1dfa('0x1a')](),queues[_0x39346a[_0x1dfa('0xe')]][_0x1dfa('0x63')]);utils[_0x1dfa('0x1c')](util[_0x1dfa('0x1')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x39346a[_0x1dfa('0xe')],queues[_0x39346a['uniqueid']][_0x1dfa('0x1e')],queues[_0x39346a[_0x1dfa('0xe')]]['mohtime']));delete queues[_0x39346a[_0x1dfa('0xe')]]['musiconholdstartAt'];}}}catch(_0x17093c){utils[_0x1dfa('0x10')](util['format'](_0x1dfa('0x66'),_0x39346a['uniqueid']),_0x17093c);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 60fadd6..4bab64a 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 _0xa2f6=['[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','value','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','blindtransfer','transferercalleridnum','transfereecalleridname','transfereruniqueid','recording','[%s][recordings][blindtransfer]','lodash','util','./utils','./transfers.controller','info','format','uniqueid','blinds','accountcode','getUserByInternal','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','transfer'];(function(_0x54c656,_0x2cb2d7){var _0x1cc8b1=function(_0x1642fe){while(--_0x1642fe){_0x54c656['push'](_0x54c656['shift']());}};_0x1cc8b1(++_0x2cb2d7);}(_0xa2f6,0x1c1));var _0x6a2f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa2f6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6a2f('0x0'));var util=require(_0x6a2f('0x1'));var utils=require(_0x6a2f('0x2'));var transfers=require(_0x6a2f('0x3'));var recordings={};function writeDB(_0x559d31){var _0x4d6229;utils[_0x6a2f('0x4')](util[_0x6a2f('0x5')]('[%s][recordings][writeDB]',_0x559d31[_0x6a2f('0x6')]));if(transfers[_0x6a2f('0x7')][_0x559d31['uniqueid']]){_0x4d6229=_0x559d31['uniqueid'];_0x559d31[_0x6a2f('0x6')]=transfers[_0x6a2f('0x7')][_0x559d31[_0x6a2f('0x6')]]['transfereeuniqueid'];}if(_0x559d31[_0x6a2f('0x8')]){utils[_0x6a2f('0x9')](_0x559d31['accountcode'])['then'](function(_0x5e6cd2){if(_0x5e6cd2){_0x559d31['membername']=_0x5e6cd2['name'];_0x559d31[_0x6a2f('0xa')]=_0x5e6cd2['id'];}utils[_0x6a2f('0xb')]('CreateVoiceRecording',_0x559d31);});}else{utils[_0x6a2f('0xb')](_0x6a2f('0xc'),_0x559d31);}if(_0x4d6229)delete transfers[_0x6a2f('0x7')][_0x4d6229];}exports[_0x6a2f('0xd')]=function(_0x34401e){try{utils[_0x6a2f('0xe')](util[_0x6a2f('0x5')](_0x6a2f('0xf'),_0x34401e['uniqueid']),_0x34401e);if(_0x34401e[_0x6a2f('0x6')]==_0x34401e[_0x6a2f('0x10')]){utils['info'](util[_0x6a2f('0x5')](_0x6a2f('0x11'),_0x34401e[_0x6a2f('0x6')],_0x34401e[_0x6a2f('0x12')],_0x34401e[_0x6a2f('0x13')]));recordings[_0x34401e[_0x6a2f('0x6')]]={'uniqueid':_0x34401e[_0x6a2f('0x6')],'accountcode':_0x34401e[_0x6a2f('0x8')],'exten':_0x34401e[_0x6a2f('0x13')],'context':_0x34401e['context'],'channel':_0x34401e[_0x6a2f('0x14')],'monitors':[]};}}catch(_0x714d74){utils[_0x6a2f('0x15')](util[_0x6a2f('0x5')](_0x6a2f('0xf'),_0x34401e[_0x6a2f('0x6')]),_0x714d74);}};exports[_0x6a2f('0x16')]=function(_0x4821fb){try{utils[_0x6a2f('0xe')](util[_0x6a2f('0x5')](_0x6a2f('0x17'),_0x4821fb[_0x6a2f('0x6')]),_0x4821fb);if(!_[_0x6a2f('0x18')](recordings[_0x4821fb['uniqueid']])&&_0x4821fb[_0x6a2f('0x19')]==0x6){utils[_0x6a2f('0x4')](util[_0x6a2f('0x5')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x4821fb[_0x6a2f('0x6')],_0x4821fb[_0x6a2f('0x12')],_0x4821fb[_0x6a2f('0x14')]));}else if(!_['isNil'](recordings[_0x4821fb[_0x6a2f('0x10')]])&&_0x4821fb[_0x6a2f('0x19')]==0x6&&_0x4821fb[_0x6a2f('0x12')]!=_0x6a2f('0x1a')){utils[_0x6a2f('0x4')](util[_0x6a2f('0x5')](_0x6a2f('0x1b'),_0x4821fb['uniqueid'],_0x4821fb[_0x6a2f('0x10')],_0x4821fb[_0x6a2f('0x12')],_0x4821fb[_0x6a2f('0x14')]));recordings[_0x4821fb[_0x6a2f('0x10')]][_0x6a2f('0x8')]=_0x4821fb[_0x6a2f('0x8')];}}catch(_0x24843f){utils[_0x6a2f('0x15')](util[_0x6a2f('0x5')](_0x6a2f('0x17'),_0x4821fb[_0x6a2f('0x6')]),_0x24843f);}};exports[_0x6a2f('0x1c')]=function(_0x17a99d){try{if(!_[_0x6a2f('0x18')](_0x17a99d[_0x6a2f('0x1d')])&&!_['isNil'](_0x17a99d[_0x6a2f('0x1d')]['mixmonitor_filename'])){utils['debug'](util['format']('[%s][recordings][varset]',_0x17a99d['uniqueid']),_0x17a99d);utils[_0x6a2f('0x4')](util[_0x6a2f('0x5')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x17a99d['uniqueid'],_0x17a99d['variable'],_0x17a99d[_0x6a2f('0x1e')]));if(_[_0x6a2f('0x1f')](_0x17a99d[_0x6a2f('0x1e')],_0x6a2f('0x20'))){_0x17a99d[_0x6a2f('0x1e')]=_0x17a99d[_0x6a2f('0x1e')][_0x6a2f('0x21')](_0x6a2f('0x20'),_0x6a2f('0x22'));}if(recordings[_0x17a99d['linkedid']]){var _0x174b95=_[_0x6a2f('0x23')](recordings[_0x17a99d['linkedid']][_0x6a2f('0x24')],{'value':_0x17a99d['value']});if(_[_0x6a2f('0x18')](_0x174b95)){recordings[_0x17a99d[_0x6a2f('0x10')]][_0x6a2f('0x24')][_0x6a2f('0x25')]({'value':_0x17a99d[_0x6a2f('0x1e')]});}}}}catch(_0x268e0b){utils['error'](util['format']('[%s][recordings][varset]',_0x17a99d[_0x6a2f('0x6')]),_0x268e0b);}};exports[_0x6a2f('0x26')]=function(_0x25b9ce){try{if(!_[_0x6a2f('0x18')](recordings[_0x25b9ce[_0x6a2f('0x6')]])){utils[_0x6a2f('0xe')](util[_0x6a2f('0x5')](_0x6a2f('0x27'),_0x25b9ce[_0x6a2f('0x6')]),_0x25b9ce);utils[_0x6a2f('0x4')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x25b9ce[_0x6a2f('0x6')],_0x25b9ce[_0x6a2f('0x28')],_0x25b9ce[_0x6a2f('0x29')],_0x25b9ce[_0x6a2f('0x2a')]));recordings[_0x25b9ce[_0x6a2f('0x6')]][_0x6a2f('0x28')]=_0x25b9ce[_0x6a2f('0x28')];recordings[_0x25b9ce[_0x6a2f('0x6')]][_0x6a2f('0x29')]=_0x25b9ce['calleridname'];recordings[_0x25b9ce[_0x6a2f('0x6')]][_0x6a2f('0x2b')]=_0x25b9ce['connectedlinenum'];recordings[_0x25b9ce[_0x6a2f('0x6')]][_0x6a2f('0x2c')]=_0x25b9ce[_0x6a2f('0x2c')];if(recordings[_0x25b9ce[_0x6a2f('0x6')]][_0x6a2f('0x2d')]=='outbound'&&recordings[_0x25b9ce[_0x6a2f('0x6')]][_0x6a2f('0x8')]){recordings[_0x25b9ce[_0x6a2f('0x6')]][_0x6a2f('0x2b')]=recordings[_0x25b9ce[_0x6a2f('0x6')]]['accountcode'];recordings[_0x25b9ce[_0x6a2f('0x6')]]['connectedlinename']='';}recordings[_0x25b9ce[_0x6a2f('0x6')]][_0x6a2f('0x24')][_0x6a2f('0x2e')](function(_0x5d6862){var _0x48b642=_[_0x6a2f('0x2f')](recordings[_0x25b9ce[_0x6a2f('0x6')]]);_0x48b642[_0x6a2f('0x1e')]=_0x5d6862[_0x6a2f('0x1e')];writeDB(_0x48b642);});delete recordings[_0x25b9ce[_0x6a2f('0x6')]];}}catch(_0x2f6b01){utils['error'](util[_0x6a2f('0x5')](_0x6a2f('0x27'),_0x25b9ce[_0x6a2f('0x6')]),_0x2f6b01);}};exports[_0x6a2f('0x30')]=function(_0x475a30){try{if(!_[_0x6a2f('0x18')](recordings[_0x475a30[_0x6a2f('0x6')]])){utils[_0x6a2f('0xe')](util[_0x6a2f('0x5')](_0x6a2f('0x31'),_0x475a30[_0x6a2f('0x6')]),_0x475a30);utils[_0x6a2f('0x4')](util[_0x6a2f('0x5')](_0x6a2f('0x32'),_0x475a30[_0x6a2f('0x6')],_0x475a30['application'],_0x475a30[_0x6a2f('0x33')]));if(_0x475a30[_0x6a2f('0x34')][_0x6a2f('0x35')]()=='set'&&_[_0x6a2f('0x36')](_0x475a30[_0x6a2f('0x33')][_0x6a2f('0x35')](),_0x6a2f('0x37'))){var _0x1c9cd5=_0x475a30['appdata'][_0x6a2f('0x38')]('=');var _0x374e62=_0x1c9cd5[0x0][_0x6a2f('0x39')](_0x1c9cd5[0x0][_0x6a2f('0x3a')]('(')+0x1,_0x1c9cd5[0x0][_0x6a2f('0x3a')](')'));var _0x303df8=_0x1c9cd5[0x1];recordings[_0x475a30[_0x6a2f('0x6')]][_0x374e62]=_0x303df8;}}}catch(_0x2117e1){utils[_0x6a2f('0x15')](util[_0x6a2f('0x5')]('[%s][recordings][newexten]',_0x475a30[_0x6a2f('0x6')]),_0x2117e1);}};exports[_0x6a2f('0x3b')]=function(_0x15eef4){try{if(!_[_0x6a2f('0x18')](recordings[_0x15eef4[_0x6a2f('0x6')]])){utils[_0x6a2f('0xe')](util[_0x6a2f('0x5')](_0x6a2f('0x3c'),_0x15eef4[_0x6a2f('0x6')]),_0x15eef4);utils[_0x6a2f('0x4')](util[_0x6a2f('0x5')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x15eef4[_0x6a2f('0x6')],_0x15eef4['queue']));recordings[_0x15eef4[_0x6a2f('0x6')]]['queue']=_0x15eef4[_0x6a2f('0x3d')];}}catch(_0x4260c9){utils[_0x6a2f('0x15')](util[_0x6a2f('0x5')](_0x6a2f('0x3c'),_0x15eef4[_0x6a2f('0x6')]),_0x4260c9);}};exports[_0x6a2f('0x3e')]=function(_0x37b7ec){try{utils['debug'](util[_0x6a2f('0x5')]('[%s][recordings][blindtransfer]',_0x37b7ec[_0x6a2f('0x6')]),_0x37b7ec);utils[_0x6a2f('0x4')](util[_0x6a2f('0x5')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x37b7ec[_0x6a2f('0x6')],_0x37b7ec[_0x6a2f('0x3f')],_0x37b7ec['transferercalleridname'],_0x37b7ec['transfereecalleridnum'],_0x37b7ec[_0x6a2f('0x40')]));if(recordings[_0x37b7ec[_0x6a2f('0x41')]]&&transfers['blinds'][_0x37b7ec['transfereruniqueid']]){transfers[_0x6a2f('0x7')][_0x37b7ec[_0x6a2f('0x41')]][_0x6a2f('0x42')]=!![];}}catch(_0xd1de54){utils[_0x6a2f('0x15')](util['format'](_0x6a2f('0x43'),_0x37b7ec[_0x6a2f('0x6')]),_0xd1de54);}}; \ No newline at end of file +var _0xd78e=['startsWith','cdr','split','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridname','transfereruniqueid','recording','lodash','./utils','info','[%s][recordings][writeDB]','uniqueid','blinds','accountcode','getUserByInternal','membername','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','debug','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set'];(function(_0x4a198c,_0x4a7e32){var _0x248f53=function(_0x184a95){while(--_0x184a95){_0x4a198c['push'](_0x4a198c['shift']());}};_0x248f53(++_0x4a7e32);}(_0xd78e,0x9d));var _0xed78=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0xd78e[_0x18b5e8];return _0x25baed;};'use strict';var _=require(_0xed78('0x0'));var util=require('util');var utils=require(_0xed78('0x1'));var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x2aab97){var _0x3a0bed;utils[_0xed78('0x2')](util['format'](_0xed78('0x3'),_0x2aab97[_0xed78('0x4')]));if(transfers[_0xed78('0x5')][_0x2aab97[_0xed78('0x4')]]){_0x3a0bed=_0x2aab97[_0xed78('0x4')];_0x2aab97[_0xed78('0x4')]=transfers[_0xed78('0x5')][_0x2aab97[_0xed78('0x4')]]['transfereeuniqueid'];}if(_0x2aab97[_0xed78('0x6')]){utils[_0xed78('0x7')](_0x2aab97[_0xed78('0x6')])['then'](function(_0x153ae9){if(_0x153ae9){_0x2aab97[_0xed78('0x8')]=_0x153ae9['name'];_0x2aab97[_0xed78('0x9')]=_0x153ae9['id'];}utils[_0xed78('0xa')](_0xed78('0xb'),_0x2aab97);});}else{utils[_0xed78('0xa')](_0xed78('0xb'),_0x2aab97);}if(_0x3a0bed)delete transfers[_0xed78('0x5')][_0x3a0bed];}exports[_0xed78('0xc')]=function(_0x1f2548){try{utils['debug'](util['format'](_0xed78('0xd'),_0x1f2548[_0xed78('0x4')]),_0x1f2548);if(_0x1f2548[_0xed78('0x4')]==_0x1f2548[_0xed78('0xe')]){utils[_0xed78('0x2')](util[_0xed78('0xf')](_0xed78('0x10'),_0x1f2548['uniqueid'],_0x1f2548[_0xed78('0x11')],_0x1f2548[_0xed78('0x12')]));recordings[_0x1f2548['uniqueid']]={'uniqueid':_0x1f2548[_0xed78('0x4')],'accountcode':_0x1f2548[_0xed78('0x6')],'exten':_0x1f2548[_0xed78('0x12')],'context':_0x1f2548[_0xed78('0x11')],'channel':_0x1f2548[_0xed78('0x13')],'monitors':[]};}}catch(_0x3b0070){utils[_0xed78('0x14')](util['format']('[%s][recordings][newchannel]',_0x1f2548[_0xed78('0x4')]),_0x3b0070);}};exports[_0xed78('0x15')]=function(_0x534ebf){try{utils[_0xed78('0x16')](util[_0xed78('0xf')](_0xed78('0x17'),_0x534ebf[_0xed78('0x4')]),_0x534ebf);if(!_[_0xed78('0x18')](recordings[_0x534ebf['uniqueid']])&&_0x534ebf['channelstate']==0x6){utils[_0xed78('0x2')](util[_0xed78('0xf')](_0xed78('0x19'),_0x534ebf[_0xed78('0x4')],_0x534ebf[_0xed78('0x11')],_0x534ebf[_0xed78('0x13')]));}else if(!_[_0xed78('0x18')](recordings[_0x534ebf[_0xed78('0xe')]])&&_0x534ebf[_0xed78('0x1a')]==0x6&&_0x534ebf[_0xed78('0x11')]!=_0xed78('0x1b')){utils[_0xed78('0x2')](util['format'](_0xed78('0x1c'),_0x534ebf['uniqueid'],_0x534ebf['linkedid'],_0x534ebf[_0xed78('0x11')],_0x534ebf[_0xed78('0x13')]));recordings[_0x534ebf[_0xed78('0xe')]][_0xed78('0x6')]=_0x534ebf['accountcode'];}}catch(_0x4c1d43){utils[_0xed78('0x14')](util[_0xed78('0xf')](_0xed78('0x17'),_0x534ebf['uniqueid']),_0x4c1d43);}};exports[_0xed78('0x1d')]=function(_0x3cd748){try{if(!_['isNil'](_0x3cd748['variable'])&&!_[_0xed78('0x18')](_0x3cd748[_0xed78('0x1e')][_0xed78('0x1f')])){utils['debug'](util[_0xed78('0xf')](_0xed78('0x20'),_0x3cd748[_0xed78('0x4')]),_0x3cd748);utils[_0xed78('0x2')](util[_0xed78('0xf')](_0xed78('0x21'),_0x3cd748[_0xed78('0x4')],_0x3cd748[_0xed78('0x1e')],_0x3cd748['value']));if(_[_0xed78('0x22')](_0x3cd748[_0xed78('0x23')],_0xed78('0x24'))){_0x3cd748[_0xed78('0x23')]=_0x3cd748[_0xed78('0x23')][_0xed78('0x25')]('.wav49',_0xed78('0x26'));}if(recordings[_0x3cd748[_0xed78('0xe')]]){var _0x1f463c=_[_0xed78('0x27')](recordings[_0x3cd748[_0xed78('0xe')]][_0xed78('0x28')],{'value':_0x3cd748['value']});if(_[_0xed78('0x18')](_0x1f463c)){recordings[_0x3cd748[_0xed78('0xe')]][_0xed78('0x28')][_0xed78('0x29')]({'value':_0x3cd748['value']});}}}}catch(_0x517ec2){utils['error'](util[_0xed78('0xf')](_0xed78('0x20'),_0x3cd748[_0xed78('0x4')]),_0x517ec2);}};exports[_0xed78('0x2a')]=function(_0x5e0fdb){try{if(!_[_0xed78('0x18')](recordings[_0x5e0fdb[_0xed78('0x4')]])){utils[_0xed78('0x16')](util['format'](_0xed78('0x2b'),_0x5e0fdb[_0xed78('0x4')]),_0x5e0fdb);utils[_0xed78('0x2')](util[_0xed78('0xf')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x5e0fdb[_0xed78('0x4')],_0x5e0fdb['calleridnum'],_0x5e0fdb[_0xed78('0x2c')],_0x5e0fdb[_0xed78('0x2d')]));recordings[_0x5e0fdb[_0xed78('0x4')]][_0xed78('0x2e')]=_0x5e0fdb['calleridnum'];recordings[_0x5e0fdb['uniqueid']][_0xed78('0x2c')]=_0x5e0fdb[_0xed78('0x2c')];recordings[_0x5e0fdb[_0xed78('0x4')]][_0xed78('0x2f')]=_0x5e0fdb['connectedlinenum'];recordings[_0x5e0fdb[_0xed78('0x4')]][_0xed78('0x30')]=_0x5e0fdb[_0xed78('0x30')];if(recordings[_0x5e0fdb['uniqueid']][_0xed78('0x31')]=='outbound'&&recordings[_0x5e0fdb[_0xed78('0x4')]][_0xed78('0x6')]){recordings[_0x5e0fdb[_0xed78('0x4')]][_0xed78('0x2f')]=recordings[_0x5e0fdb['uniqueid']][_0xed78('0x6')];recordings[_0x5e0fdb[_0xed78('0x4')]][_0xed78('0x30')]='';}recordings[_0x5e0fdb[_0xed78('0x4')]][_0xed78('0x28')][_0xed78('0x32')](function(_0x38bec6){var _0x596c71=_[_0xed78('0x33')](recordings[_0x5e0fdb[_0xed78('0x4')]]);_0x596c71[_0xed78('0x23')]=_0x38bec6['value'];writeDB(_0x596c71);});delete recordings[_0x5e0fdb[_0xed78('0x4')]];}}catch(_0x15fd5c){utils[_0xed78('0x14')](util['format'](_0xed78('0x2b'),_0x5e0fdb[_0xed78('0x4')]),_0x15fd5c);}};exports[_0xed78('0x34')]=function(_0x239d5c){try{if(!_['isNil'](recordings[_0x239d5c[_0xed78('0x4')]])){utils[_0xed78('0x16')](util[_0xed78('0xf')](_0xed78('0x35'),_0x239d5c[_0xed78('0x4')]),_0x239d5c);utils[_0xed78('0x2')](util[_0xed78('0xf')](_0xed78('0x36'),_0x239d5c[_0xed78('0x4')],_0x239d5c[_0xed78('0x37')],_0x239d5c[_0xed78('0x38')]));if(_0x239d5c['application'][_0xed78('0x39')]()==_0xed78('0x3a')&&_[_0xed78('0x3b')](_0x239d5c[_0xed78('0x38')]['toLowerCase'](),_0xed78('0x3c'))){var _0x248871=_0x239d5c[_0xed78('0x38')][_0xed78('0x3d')]('=');var _0x4a62a8=_0x248871[0x0]['substring'](_0x248871[0x0][_0xed78('0x3e')]('(')+0x1,_0x248871[0x0][_0xed78('0x3e')](')'));var _0x21c73d=_0x248871[0x1];recordings[_0x239d5c['uniqueid']][_0x4a62a8]=_0x21c73d;}}}catch(_0x1283ea){utils[_0xed78('0x14')](util[_0xed78('0xf')](_0xed78('0x35'),_0x239d5c['uniqueid']),_0x1283ea);}};exports['queuecallerjoin']=function(_0x10b0bc){try{if(!_[_0xed78('0x18')](recordings[_0x10b0bc[_0xed78('0x4')]])){utils[_0xed78('0x16')](util[_0xed78('0xf')](_0xed78('0x3f'),_0x10b0bc[_0xed78('0x4')]),_0x10b0bc);utils['info'](util[_0xed78('0xf')](_0xed78('0x40'),_0x10b0bc[_0xed78('0x4')],_0x10b0bc[_0xed78('0x41')]));recordings[_0x10b0bc[_0xed78('0x4')]][_0xed78('0x41')]=_0x10b0bc['queue'];}}catch(_0x24202e){utils['error'](util['format'](_0xed78('0x3f'),_0x10b0bc[_0xed78('0x4')]),_0x24202e);}};exports['blindtransfer']=function(_0x517be6){try{utils['debug'](util[_0xed78('0xf')](_0xed78('0x42'),_0x517be6['uniqueid']),_0x517be6);utils[_0xed78('0x2')](util[_0xed78('0xf')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x517be6[_0xed78('0x4')],_0x517be6[_0xed78('0x43')],_0x517be6[_0xed78('0x44')],_0x517be6['transfereecalleridnum'],_0x517be6[_0xed78('0x45')]));if(recordings[_0x517be6[_0xed78('0x46')]]&&transfers[_0xed78('0x5')][_0x517be6[_0xed78('0x46')]]){transfers[_0xed78('0x5')][_0x517be6[_0xed78('0x46')]][_0xed78('0x47')]=!![];}}catch(_0x1f1708){utils[_0xed78('0x14')](util[_0xed78('0xf')](_0xed78('0x42'),_0x517be6[_0xed78('0x4')]),_0x1f1708);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 34fb205..4e0c5df 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 _0xfb49=['isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','./utils','format','type','attended','origtransfereruniqueid','uniqueid','request','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext'];(function(_0x268830,_0x41a64b){var _0x4e7ec4=function(_0x2e56b2){while(--_0x2e56b2){_0x268830['push'](_0x268830['shift']());}};_0x4e7ec4(++_0x41a64b);}(_0xfb49,0x88));var _0x9fb4=function(_0x149083,_0x4047b6){_0x149083=_0x149083-0x0;var _0x4dc74e=_0xfb49[_0x149083];return _0x4dc74e;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x9fb4('0x0'));function writeDB(_0x5c02ca){utils['info'](util[_0x9fb4('0x1')]('[%s][transfers][writeDB]\x20type:%s',_0x5c02ca[_0x9fb4('0x2')]===_0x9fb4('0x3')?_0x5c02ca[_0x9fb4('0x4')]:_0x5c02ca[_0x9fb4('0x5')],_0x5c02ca['type']));utils[_0x9fb4('0x6')]('CreateVoiceTransferReport',_0x5c02ca);}exports[_0x9fb4('0x7')]={};exports[_0x9fb4('0x8')]=function(_0xfa21e2){try{utils[_0x9fb4('0x9')](util[_0x9fb4('0x1')](_0x9fb4('0xa'),_0xfa21e2[_0x9fb4('0x5')]),_0xfa21e2);utils[_0x9fb4('0xb')](util[_0x9fb4('0x1')](_0x9fb4('0xc'),_0xfa21e2['uniqueid'],_0xfa21e2[_0x9fb4('0xd')],_0xfa21e2[_0x9fb4('0xe')],_0xfa21e2[_0x9fb4('0xf')],_0xfa21e2[_0x9fb4('0x10')]));_0xfa21e2[_0x9fb4('0x2')]=_0x9fb4('0x11');exports['blinds'][_0xfa21e2[_0x9fb4('0x12')]]=_0xfa21e2;writeDB(_0xfa21e2);}catch(_0x98e579){utils['error'](util[_0x9fb4('0x1')]('[%s][transfers][blindtransfer]',_0xfa21e2[_0x9fb4('0x5')]),_0x98e579);}};exports[_0x9fb4('0x13')]=function(_0x6a51c0){try{utils['debug'](util[_0x9fb4('0x1')](_0x9fb4('0x14'),_0x6a51c0[_0x9fb4('0x4')]),_0x6a51c0);utils['info'](util[_0x9fb4('0x1')](_0x9fb4('0x15'),_0x6a51c0[_0x9fb4('0x4')],_0x6a51c0[_0x9fb4('0x16')],_0x6a51c0[_0x9fb4('0x17')],_0x6a51c0['transfertargetcalleridnum'],_0x6a51c0[_0x9fb4('0x18')]));_0x6a51c0=_[_0x9fb4('0x19')](_0x6a51c0,{'transfererchannel':_0x6a51c0['origtransfererchannel'],'transferercalleridnum':_0x6a51c0['origtransferercalleridnum'],'transferercalleridname':_0x6a51c0['origtransferercalleridname'],'transfererconnectedlinenum':_0x6a51c0['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x6a51c0[_0x9fb4('0x1a')],'transfereraccountcode':_0x6a51c0[_0x9fb4('0x1b')],'transferercontext':_0x6a51c0[_0x9fb4('0x1c')],'transfererexten':_0x6a51c0[_0x9fb4('0x1d')],'transfererlinkedid':_0x6a51c0[_0x9fb4('0x1e')],'context':_0x6a51c0[_0x9fb4('0x1f')],'extension':_0x6a51c0['origtransfererexten'],'type':_0x9fb4('0x3')});if(_[_0x9fb4('0x20')](_0x6a51c0[_0x9fb4('0x21')])){_0x6a51c0=_[_0x9fb4('0x19')](_0x6a51c0,{'transfereechannel':_0x6a51c0[_0x9fb4('0x22')],'transfereecalleridnum':_0x6a51c0['transfertargetcalleridnum'],'transfereecalleridname':_0x6a51c0[_0x9fb4('0x18')],'transfereeconnectedlinenum':_0x6a51c0[_0x9fb4('0x23')],'transfereeconnectedlinename':_0x6a51c0[_0x9fb4('0x24')],'transfereeaccountcode':_0x6a51c0[_0x9fb4('0x25')],'transfereecontext':_0x6a51c0[_0x9fb4('0x26')],'transfereeexten':_0x6a51c0[_0x9fb4('0x27')],'transfereelinkedid':_0x6a51c0[_0x9fb4('0x28')]});}writeDB(_0x6a51c0);}catch(_0x414402){utils[_0x9fb4('0x29')](util[_0x9fb4('0x1')]('[%s][transfers][attendedtransfer]',_0x6a51c0[_0x9fb4('0x4')]),_0x414402);}}; \ No newline at end of file +var _0x17f0=['[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','transfereruniqueid','error','origtransferercalleridnum','assign','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x17f0,0xc7));var _0x017f=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x17f0[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x017f('0x0'));var util=require(_0x017f('0x1'));var utils=require(_0x017f('0x2'));function writeDB(_0x5a5fd8){utils[_0x017f('0x3')](util[_0x017f('0x4')](_0x017f('0x5'),_0x5a5fd8[_0x017f('0x6')]===_0x017f('0x7')?_0x5a5fd8[_0x017f('0x8')]:_0x5a5fd8[_0x017f('0x9')],_0x5a5fd8[_0x017f('0x6')]));utils[_0x017f('0xa')](_0x017f('0xb'),_0x5a5fd8);}exports[_0x017f('0xc')]={};exports[_0x017f('0xd')]=function(_0x2fd6d9){try{utils[_0x017f('0xe')](util[_0x017f('0x4')](_0x017f('0xf'),_0x2fd6d9[_0x017f('0x9')]),_0x2fd6d9);utils[_0x017f('0x3')](util[_0x017f('0x4')](_0x017f('0x10'),_0x2fd6d9[_0x017f('0x9')],_0x2fd6d9[_0x017f('0x11')],_0x2fd6d9[_0x017f('0x12')],_0x2fd6d9['transfereecalleridnum'],_0x2fd6d9[_0x017f('0x13')]));_0x2fd6d9['type']=_0x017f('0x14');exports[_0x017f('0xc')][_0x2fd6d9[_0x017f('0x15')]]=_0x2fd6d9;writeDB(_0x2fd6d9);}catch(_0x47b50f){utils[_0x017f('0x16')](util[_0x017f('0x4')](_0x017f('0xf'),_0x2fd6d9[_0x017f('0x9')]),_0x47b50f);}};exports['attendedtransfer']=function(_0x1f4cd8){try{utils[_0x017f('0xe')](util[_0x017f('0x4')]('[%s][transfers][attendedtransfer]',_0x1f4cd8[_0x017f('0x8')]),_0x1f4cd8);utils[_0x017f('0x3')](util[_0x017f('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x1f4cd8[_0x017f('0x8')],_0x1f4cd8[_0x017f('0x17')],_0x1f4cd8['origtransferercalleridname'],_0x1f4cd8['transfertargetcalleridnum'],_0x1f4cd8['transfertargetcalleridname']));_0x1f4cd8=_[_0x017f('0x18')](_0x1f4cd8,{'transfererchannel':_0x1f4cd8['origtransfererchannel'],'transferercalleridnum':_0x1f4cd8['origtransferercalleridnum'],'transferercalleridname':_0x1f4cd8[_0x017f('0x19')],'transfererconnectedlinenum':_0x1f4cd8[_0x017f('0x1a')],'transfererconnectedlinename':_0x1f4cd8[_0x017f('0x1b')],'transfereraccountcode':_0x1f4cd8[_0x017f('0x1c')],'transferercontext':_0x1f4cd8[_0x017f('0x1d')],'transfererexten':_0x1f4cd8[_0x017f('0x1e')],'transfererlinkedid':_0x1f4cd8[_0x017f('0x1f')],'context':_0x1f4cd8[_0x017f('0x20')],'extension':_0x1f4cd8[_0x017f('0x21')],'type':_0x017f('0x7')});if(_[_0x017f('0x22')](_0x1f4cd8[_0x017f('0x23')])){_0x1f4cd8=_['assign'](_0x1f4cd8,{'transfereechannel':_0x1f4cd8[_0x017f('0x24')],'transfereecalleridnum':_0x1f4cd8[_0x017f('0x25')],'transfereecalleridname':_0x1f4cd8['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1f4cd8[_0x017f('0x26')],'transfereeconnectedlinename':_0x1f4cd8['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1f4cd8['transfertargetaccountcode'],'transfereecontext':_0x1f4cd8[_0x017f('0x27')],'transfereeexten':_0x1f4cd8[_0x017f('0x28')],'transfereelinkedid':_0x1f4cd8[_0x017f('0x29')]});}writeDB(_0x1f4cd8);}catch(_0x15a273){utils['error'](util[_0x017f('0x4')](_0x017f('0x2a'),_0x1f4cd8[_0x017f('0x8')]),_0x15a273);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 6eee0b2..e81eabe 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 _0x22a5=['bluebird','moment','util','http','../../config/logger','info','inspect','debug','error','request','catch','[utils][request]\x20name:%s','GetUser','name','interface','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','then','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]','getVoiceQueueByName','type','acwTimeout','addTime','add','format','subtractTime','seconds','YYYY-MM-DD\x20HH:mm:ss','diff','now','isAfter'];(function(_0x406155,_0xb1953c){var _0x3bbccf=function(_0xca7ac5){while(--_0xca7ac5){_0x406155['push'](_0x406155['shift']());}};_0x3bbccf(++_0xb1953c);}(_0x22a5,0xe4));var _0x522a=function(_0x43848c,_0x3ee562){_0x43848c=_0x43848c-0x0;var _0x496533=_0x22a5[_0x43848c];return _0x496533;};'use strict';var BPromise=require(_0x522a('0x0'));var jayson=require('jayson/promise');var moment=require(_0x522a('0x1'));var util=require(_0x522a('0x2'));var client=jayson['client'][_0x522a('0x3')]({'port':0x2329});var logger=require(_0x522a('0x4'))('xdr');exports[_0x522a('0x5')]=function(_0x10ab91,_0x49a9de){logger[_0x522a('0x5')](_0x10ab91,_0x49a9de?util[_0x522a('0x6')](_0x49a9de,{'showHidden':![],'depth':null}):'');};exports[_0x522a('0x7')]=function(_0x4ab47a,_0x220d35){logger[_0x522a('0x7')](_0x4ab47a,_0x220d35?util[_0x522a('0x6')](_0x220d35,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x4581f3,_0x20cf0f){logger[_0x522a('0x8')](_0x4581f3,_0x20cf0f?util[_0x522a('0x6')](_0x20cf0f,{'showHidden':![],'depth':null}):'');};exports[_0x522a('0x9')]=function(_0x43636c,_0x29298d){return client[_0x522a('0x9')](_0x43636c,{'body':_0x29298d})['then'](function(_0x11a2e3){logger['debug']('[utils][request]\x20name:%s',_0x43636c,_0x11a2e3?util[_0x522a('0x6')](_0x11a2e3,{'showHidden':![],'depth':null}):'');})[_0x522a('0xa')](function(_0x59dc42){logger[_0x522a('0x8')](_0x522a('0xb'),_0x43636c,_0x59dc42?util[_0x522a('0x6')](_0x59dc42,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5f3c3e){return client[_0x522a('0x9')](_0x522a('0xc'),{'options':{'raw':!![],'attributes':['id','internal',_0x522a('0xd'),_0x522a('0xe')],'where':_0x5f3c3e,'limit':0x1}})['then'](function(_0x2710d2){logger[_0x522a('0x7')]('[utils][getUser]\x20where:%s',JSON['stringify'](_0x5f3c3e),_0x2710d2?util[_0x522a('0x6')](_0x2710d2,{'showHidden':![],'depth':null}):'');return _0x2710d2['result'][_0x522a('0xf')]?_0x2710d2[_0x522a('0x10')][0x0]:null;});}exports[_0x522a('0x11')]=function(_0x2bdb94){return new BPromise(function(_0x4f988c,_0x5bd62c){if(_0x2bdb94){return getUser({'internal':_0x2bdb94})['then'](function(_0x21fda8){logger[_0x522a('0x5')](_0x522a('0x12'),_0x2bdb94,_0x21fda8?_0x522a('0x13'):_0x522a('0x14'));return _0x4f988c(_0x21fda8);})[_0x522a('0xa')](function(_0x257adf){logger[_0x522a('0x8')](_0x522a('0x15'),_0x257adf?util['inspect'](_0x257adf,{'showHidden':![],'depth':null}):'');return _0x4f988c(null);});}return _0x4f988c(null);});};exports['getUserByInterface']=function(_0x472bfa){return new BPromise(function(_0x3318d7,_0x22f634){if(_0x472bfa){return getUser({'interface':_0x472bfa})[_0x522a('0x16')](function(_0x497b38){logger[_0x522a('0x5')](_0x522a('0x17'),_0x472bfa,_0x497b38?'found':_0x522a('0x14'));return _0x3318d7(_0x497b38);})[_0x522a('0xa')](function(_0x2c4cb7){logger[_0x522a('0x8')]('[utils][getUserByInterface]',_0x2c4cb7?util[_0x522a('0x6')](_0x2c4cb7,{'showHidden':![],'depth':null}):'');return _0x3318d7(null);});}return _0x3318d7(null);});};exports[_0x522a('0x18')]=function(_0x3f3474){return new BPromise(function(_0x56f8d2,_0x121a2c){if(_0x3f3474){return getUser({'name':_0x3f3474})[_0x522a('0x16')](function(_0x3a8815){logger[_0x522a('0x5')]('[utils][getUserByName]\x20name:%s\x20%s',_0x3f3474,_0x3a8815?_0x522a('0x13'):_0x522a('0x14'));return _0x56f8d2(_0x3a8815);})[_0x522a('0xa')](function(_0x256218){logger[_0x522a('0x8')](_0x522a('0x19'),_0x256218?util[_0x522a('0x6')](_0x256218,{'showHidden':![],'depth':null}):'');return _0x56f8d2(null);});}return _0x56f8d2(null);});};exports[_0x522a('0x1a')]=function(_0x30e2c1){return new BPromise(function(_0x1a293c,_0x225e31){if(_0x30e2c1){return client[_0x522a('0x9')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x522a('0xd'),_0x522a('0x1b'),'acw',_0x522a('0x1c')],'where':{'name':_0x30e2c1},'limit':0x1}})['then'](function(_0x539b14){logger[_0x522a('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x30e2c1,_0x539b14?util[_0x522a('0x6')](_0x539b14,{'showHidden':![],'depth':null}):'');logger[_0x522a('0x5')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x30e2c1,_0x539b14?_0x522a('0x13'):_0x522a('0x14'));return _0x1a293c(_0x539b14['result'][_0x522a('0xf')]?_0x539b14['result'][0x0]:null);})[_0x522a('0xa')](function(_0x1c31db){logger[_0x522a('0x8')]('[utils][getVoiceQueueByName]',_0x1c31db?util[_0x522a('0x6')](_0x1c31db,{'showHidden':![],'depth':null}):'');return _0x1a293c(null);});}return _0x1a293c(null);});};exports[_0x522a('0x1d')]=function(_0x1567c2,_0x2f61da){return moment(_0x1567c2)[_0x522a('0x1e')](_0x2f61da,'seconds')[_0x522a('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x522a('0x20')]=function(_0x484baf,_0x528e6b){return moment(_0x484baf)['subtract'](_0x528e6b,_0x522a('0x21'))[_0x522a('0x1f')](_0x522a('0x22'));};exports['diffTime']=function(_0x55bc9e,_0x21d03d){return moment(_0x55bc9e)[_0x522a('0x23')](moment(_0x21d03d),_0x522a('0x21'));};exports['sumTime']=function(_0x750c98,_0x4d2057){return parseInt(_0x750c98,0xa)+parseInt(_0x4d2057,0xa);};exports[_0x522a('0x24')]=function(){return moment()[_0x522a('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');};exports['isAfter']=function(_0x45e8b8,_0x4cdc39){if(_0x4cdc39){return moment(_0x45e8b8)[_0x522a('0x25')](_0x4cdc39);}return!![];};exports['isBefore']=function(_0x3eb437,_0x332588){if(_0x332588){return moment(_0x3eb437)['isBefore'](_0x332588);}else if(_0x3eb437){return!![];}return![];}; \ No newline at end of file +var _0x462b=['name','interface','[utils][getUser]\x20where:%s','result','length','getUserByInternal','then','found','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','diffTime','diff','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','../../config/logger','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser','internal'];(function(_0x4dbdad,_0x594441){var _0x500d67=function(_0x2bce7e){while(--_0x2bce7e){_0x4dbdad['push'](_0x4dbdad['shift']());}};_0x500d67(++_0x594441);}(_0x462b,0x1da));var _0xb462=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x462b[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0xb462('0x0'));var jayson=require(_0xb462('0x1'));var moment=require(_0xb462('0x2'));var util=require(_0xb462('0x3'));var client=jayson['client'][_0xb462('0x4')]({'port':0x2329});var logger=require(_0xb462('0x5'))(_0xb462('0x6'));exports['info']=function(_0x37f37a,_0x5757d0){logger[_0xb462('0x7')](_0x37f37a,_0x5757d0?util[_0xb462('0x8')](_0x5757d0,{'showHidden':![],'depth':null}):'');};exports[_0xb462('0x9')]=function(_0x30182d,_0x3cb604){logger[_0xb462('0x9')](_0x30182d,_0x3cb604?util['inspect'](_0x3cb604,{'showHidden':![],'depth':null}):'');};exports[_0xb462('0xa')]=function(_0x993ae0,_0x42f1cb){logger[_0xb462('0xa')](_0x993ae0,_0x42f1cb?util[_0xb462('0x8')](_0x42f1cb,{'showHidden':![],'depth':null}):'');};exports[_0xb462('0xb')]=function(_0x56ae49,_0x4fdaf9){return client[_0xb462('0xb')](_0x56ae49,{'body':_0x4fdaf9})['then'](function(_0x359d77){logger[_0xb462('0x9')](_0xb462('0xc'),_0x56ae49,_0x359d77?util[_0xb462('0x8')](_0x359d77,{'showHidden':![],'depth':null}):'');})[_0xb462('0xd')](function(_0x3e96c2){logger[_0xb462('0xa')](_0xb462('0xc'),_0x56ae49,_0x3e96c2?util[_0xb462('0x8')](_0x3e96c2,{'showHidden':![],'depth':null}):'');});};function getUser(_0x14e6fc){return client['request'](_0xb462('0xe'),{'options':{'raw':!![],'attributes':['id',_0xb462('0xf'),_0xb462('0x10'),_0xb462('0x11')],'where':_0x14e6fc,'limit':0x1}})['then'](function(_0x337024){logger[_0xb462('0x9')](_0xb462('0x12'),JSON['stringify'](_0x14e6fc),_0x337024?util[_0xb462('0x8')](_0x337024,{'showHidden':![],'depth':null}):'');return _0x337024[_0xb462('0x13')][_0xb462('0x14')]?_0x337024[_0xb462('0x13')][0x0]:null;});}exports[_0xb462('0x15')]=function(_0x4b27fa){return new BPromise(function(_0x488554,_0x2dd2d9){if(_0x4b27fa){return getUser({'internal':_0x4b27fa})[_0xb462('0x16')](function(_0x2ac357){logger[_0xb462('0x7')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x4b27fa,_0x2ac357?_0xb462('0x17'):'notfound');return _0x488554(_0x2ac357);})[_0xb462('0xd')](function(_0x284d70){logger[_0xb462('0xa')]('[utils][getUserByInternal]',_0x284d70?util[_0xb462('0x8')](_0x284d70,{'showHidden':![],'depth':null}):'');return _0x488554(null);});}return _0x488554(null);});};exports[_0xb462('0x18')]=function(_0x2bd501){return new BPromise(function(_0x2c93a5,_0x46abeb){if(_0x2bd501){return getUser({'interface':_0x2bd501})[_0xb462('0x16')](function(_0x16ba1c){logger[_0xb462('0x7')](_0xb462('0x19'),_0x2bd501,_0x16ba1c?_0xb462('0x17'):_0xb462('0x1a'));return _0x2c93a5(_0x16ba1c);})[_0xb462('0xd')](function(_0x17915a){logger[_0xb462('0xa')](_0xb462('0x1b'),_0x17915a?util[_0xb462('0x8')](_0x17915a,{'showHidden':![],'depth':null}):'');return _0x2c93a5(null);});}return _0x2c93a5(null);});};exports[_0xb462('0x1c')]=function(_0x2cf4c7){return new BPromise(function(_0xceea72,_0x146a5e){if(_0x2cf4c7){return getUser({'name':_0x2cf4c7})['then'](function(_0x1e6cee){logger['info'](_0xb462('0x1d'),_0x2cf4c7,_0x1e6cee?_0xb462('0x17'):'notfound');return _0xceea72(_0x1e6cee);})[_0xb462('0xd')](function(_0x28c34d){logger['error']('[utils][getUserByName]',_0x28c34d?util['inspect'](_0x28c34d,{'showHidden':![],'depth':null}):'');return _0xceea72(null);});}return _0xceea72(null);});};exports[_0xb462('0x1e')]=function(_0x2ddb7e){return new BPromise(function(_0x1b34e7,_0x32a3b4){if(_0x2ddb7e){return client[_0xb462('0xb')](_0xb462('0x1f'),{'options':{'raw':!![],'attributes':['id',_0xb462('0x10'),_0xb462('0x20'),_0xb462('0x21'),'acwTimeout'],'where':{'name':_0x2ddb7e},'limit':0x1}})[_0xb462('0x16')](function(_0x1b2a5d){logger[_0xb462('0x9')](_0xb462('0x22'),_0x2ddb7e,_0x1b2a5d?util[_0xb462('0x8')](_0x1b2a5d,{'showHidden':![],'depth':null}):'');logger[_0xb462('0x7')](_0xb462('0x23'),_0x2ddb7e,_0x1b2a5d?'found':_0xb462('0x1a'));return _0x1b34e7(_0x1b2a5d[_0xb462('0x13')][_0xb462('0x14')]?_0x1b2a5d[_0xb462('0x13')][0x0]:null);})[_0xb462('0xd')](function(_0x4be8ed){logger[_0xb462('0xa')](_0xb462('0x24'),_0x4be8ed?util['inspect'](_0x4be8ed,{'showHidden':![],'depth':null}):'');return _0x1b34e7(null);});}return _0x1b34e7(null);});};exports[_0xb462('0x25')]=function(_0x39568e,_0x460d87){return moment(_0x39568e)[_0xb462('0x26')](_0x460d87,_0xb462('0x27'))['format'](_0xb462('0x28'));};exports[_0xb462('0x29')]=function(_0x540671,_0x481ea4){return moment(_0x540671)[_0xb462('0x2a')](_0x481ea4,_0xb462('0x27'))[_0xb462('0x2b')](_0xb462('0x28'));};exports[_0xb462('0x2c')]=function(_0xa413a5,_0x29bbc0){return moment(_0xa413a5)[_0xb462('0x2d')](moment(_0x29bbc0),_0xb462('0x27'));};exports[_0xb462('0x2e')]=function(_0x320ad2,_0x49911c){return parseInt(_0x320ad2,0xa)+parseInt(_0x49911c,0xa);};exports['now']=function(){return moment()[_0xb462('0x2b')](_0xb462('0x28'));};exports[_0xb462('0x2f')]=function(_0x3b8c8f,_0x5079a){if(_0x5079a){return moment(_0x3b8c8f)[_0xb462('0x2f')](_0x5079a);}return!![];};exports[_0xb462('0x30')]=function(_0x3f8a6f,_0x2af915){if(_0x2af915){return moment(_0x3f8a6f)[_0xb462('0x30')](_0x2af915);}else if(_0x3f8a6f){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 ff37646..e42755c 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 _0x2159=['name','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','agent_name','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','safeTemplate','./mask-sensitive-data','join','/var','client','role','ensureDir','then','catch','log','user','no-user','data','error','api','auth','set','client-side-logger','body','\x20body=%s','format','method','x-forwarded-for','headers','connection','remoteAddress','url','statusCode','responseTime'];(function(_0x340e63,_0x10c1b5){var _0x273eb6=function(_0x34fd3c){while(--_0x34fd3c){_0x340e63['push'](_0x340e63['shift']());}};_0x273eb6(++_0x10c1b5);}(_0x2159,0xe4));var _0x9215=function(_0x23db26,_0x5083b0){_0x23db26=_0x23db26-0x0;var _0x7d47a9=_0x2159[_0x23db26];return _0x7d47a9;};var fs=require(_0x9215('0x0'));var _=require(_0x9215('0x1'));var ewinston=require(_0x9215('0x2'));var path=require(_0x9215('0x3'));var util=require(_0x9215('0x4'));var fileLogger=require(_0x9215('0x5'))[_0x9215('0x6')];var safeTemplate=require('./safe-template')[_0x9215('0x7')];var maskSensitiveData=require(_0x9215('0x8'))['maskSensitiveData'];function ClientSideLogger(){function _0x3bc2e4(_0x94e18f){var _0x5eeff6=path[_0x9215('0x9')](_0x9215('0xa'),'log','xcally');var _0x11650f=path['join'](_0x9215('0xb'),_0x94e18f[_0x9215('0xc')]+'-'+_0x94e18f['name']);return fs[_0x9215('0xd')](path['join'](_0x5eeff6,_0x11650f))[_0x9215('0xe')](function(){var _0x18635c=fileLogger(_0x9215('0xb'),path[_0x9215('0x9')](_0x5eeff6,_0x11650f));return _0x18635c;})[_0x9215('0xf')](function(_0x5896de){throw _0x5896de;});}this[_0x9215('0x10')]=function(_0x5e5454,_0x11ac82,_0x432486,_0x2f62fd){return _0x3bc2e4(_0x5e5454['user'])['then'](function(_0x35e6b5){var _0x2f3fb1=_0x35e6b5[_0x11ac82];return _0x2f3fb1;})['then'](function(_0x69215c){var _0x291793=_0x5e5454[_0x9215('0x11')]?_0x5e5454[_0x9215('0x11')]['id']:_0x9215('0x12');var _0x54ce97=_0x2f62fd[_0x9215('0x13')];var _0x27be65=_0x2f62fd['timestamp'];var _0x5ccd87=new Date(Number(_0x27be65));return _0x69215c(_0x291793,_0x5ccd87,_0x432486,_0x54ce97);})[_0x9215('0xf')](function(_0x30ecc7){fileLogger('client')[_0x9215('0x14')](_0x30ecc7);});};}function setupLoggers(_0x46a3fc){return new Promise(function(_0x18568c){var _0x17dede=new ClientSideLogger();var _0x16d4c2=fileLogger(_0x9215('0x15'));var _0x32e63b=fileLogger(_0x9215('0x16'));_0x46a3fc[_0x9215('0x17')](_0x9215('0x18'),_0x17dede);_0x46a3fc['use'](ewinston['logger']({'winstonInstance':_0x16d4c2,'meta':![],'statusLevels':!![],'msg':function(_0x5902be,_0x32259a){var _0x3e2771='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0x5902be[_0x9215('0x19')])){_0x3e2771+=_0x9215('0x1a');var _0x262aee=_0x5902be['body'];maskSensitiveData(_0x262aee);}return safeTemplate(util[_0x9215('0x1b')](_0x3e2771,_0x5902be[_0x9215('0x1c')],_0x5902be['headers'][_0x9215('0x1d')]?_0x5902be[_0x9215('0x1e')][_0x9215('0x1d')]:_0x5902be[_0x9215('0x1f')][_0x9215('0x20')]||_0x5902be['ip'],_0x5902be[_0x9215('0x21')],_0x32259a[_0x9215('0x22')],_0x32259a[_0x9215('0x23')],_0x5902be[_0x9215('0x11')]?_0x5902be['user']['id']:null,_0x5902be['user']?_0x5902be[_0x9215('0x11')][_0x9215('0x24')]:null,_0x5902be[_0x9215('0x11')]?_0x5902be[_0x9215('0x11')]['role']:null,_0x262aee?util[_0x9215('0x25')](_0x262aee,![],null):''));}}));_0x46a3fc['use'](ewinston[_0x9215('0x26')]({'winstonInstance':_0x32e63b,'meta':![],'statusLevels':!![],'msg':function(_0x2860a9,_0x506373){var _0x3655b3=_0x9215('0x27');if(_0x2860a9[_0x9215('0x19')]&&_0x2860a9['body'][_0x9215('0x28')]&&_0x2860a9[_0x9215('0x19')]['agent_id']){_0x3655b3=_0x9215('0x29');}return util['format'](_0x3655b3,_0x2860a9[_0x9215('0x1c')],_0x2860a9[_0x9215('0x1e')][_0x9215('0x1d')]?_0x2860a9['headers']['x-forwarded-for']:_0x2860a9[_0x9215('0x1f')][_0x9215('0x20')]||_0x2860a9['ip'],_0x2860a9[_0x9215('0x21')],_0x506373[_0x9215('0x22')],_0x506373[_0x9215('0x23')],_0x2860a9[_0x9215('0x11')]?_0x2860a9[_0x9215('0x11')]['id']:null,_0x2860a9[_0x9215('0x11')]?_0x2860a9[_0x9215('0x11')][_0x9215('0x24')]:null,_0x2860a9[_0x9215('0x11')]?_0x2860a9[_0x9215('0x11')][_0x9215('0xc')]:null,_0x2860a9[_0x9215('0x19')]&&_0x2860a9[_0x9215('0x19')][_0x9215('0x28')]?_0x2860a9[_0x9215('0x19')][_0x9215('0x28')]:'other',_0x2860a9['body']&&_0x2860a9['body']['agent_id']?_0x2860a9['body']['agent_id']:'',_0x2860a9[_0x9215('0x19')]&&_0x2860a9[_0x9215('0x19')][_0x9215('0x2a')]?_0x2860a9[_0x9215('0x19')][_0x9215('0x2a')]:'');},'ignoreRoute':function(_0x23245b){var _0x17a27f=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x17a27f['test'](_0x23245b[_0x9215('0x21')]);}}));return _0x18568c();});}exports[_0x9215('0x2b')]=setupLoggers; \ No newline at end of file +var _0xed8b=['path','util','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','/var','log','join','role','ensureDir','then','client','catch','user','no-user','data','timestamp','api','auth','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','x-forwarded-for','headers','remoteAddress','url','statusCode','responseTime','name','inspect','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_name','test','setupLoggers','fs-extra'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xed8b,0x86));var _0xbed8=function(_0x4b6393,_0x2ce649){_0x4b6393=_0x4b6393-0x0;var _0x3bc1a4=_0xed8b[_0x4b6393];return _0x3bc1a4;};var fs=require(_0xbed8('0x0'));var _=require('lodash');var ewinston=require('express-winston');var path=require(_0xbed8('0x1'));var util=require(_0xbed8('0x2'));var fileLogger=require('./loggers')[_0xbed8('0x3')];var safeTemplate=require(_0xbed8('0x4'))[_0xbed8('0x5')];var maskSensitiveData=require(_0xbed8('0x6'))['maskSensitiveData'];function ClientSideLogger(){function _0x46502b(_0x2739a9){var _0x41a9f1=path['join'](_0xbed8('0x7'),_0xbed8('0x8'),'xcally');var _0x24a9a7=path[_0xbed8('0x9')]('client',_0x2739a9[_0xbed8('0xa')]+'-'+_0x2739a9['name']);return fs[_0xbed8('0xb')](path[_0xbed8('0x9')](_0x41a9f1,_0x24a9a7))[_0xbed8('0xc')](function(){var _0x4c0fec=fileLogger(_0xbed8('0xd'),path[_0xbed8('0x9')](_0x41a9f1,_0x24a9a7));return _0x4c0fec;})[_0xbed8('0xe')](function(_0x402505){throw _0x402505;});}this[_0xbed8('0x8')]=function(_0x211bda,_0x266279,_0x524310,_0x10da65){return _0x46502b(_0x211bda[_0xbed8('0xf')])[_0xbed8('0xc')](function(_0x40fb74){var _0x5ec4b2=_0x40fb74[_0x266279];return _0x5ec4b2;})[_0xbed8('0xc')](function(_0x9683e8){var _0x540375=_0x211bda[_0xbed8('0xf')]?_0x211bda['user']['id']:_0xbed8('0x10');var _0x2574b8=_0x10da65[_0xbed8('0x11')];var _0x1ebfb8=_0x10da65[_0xbed8('0x12')];var _0x3290f4=new Date(Number(_0x1ebfb8));return _0x9683e8(_0x540375,_0x3290f4,_0x524310,_0x2574b8);})[_0xbed8('0xe')](function(_0x210e37){fileLogger(_0xbed8('0xd'))['error'](_0x210e37);});};}function setupLoggers(_0xdcc7f0){return new Promise(function(_0x2f3c30){var _0x2755bb=new ClientSideLogger();var _0x36f523=fileLogger(_0xbed8('0x13'));var _0x47fec4=fileLogger(_0xbed8('0x14'));_0xdcc7f0['set'](_0xbed8('0x15'),_0x2755bb);_0xdcc7f0[_0xbed8('0x16')](ewinston[_0xbed8('0x17')]({'winstonInstance':_0x36f523,'meta':![],'statusLevels':!![],'msg':function(_0x46de85,_0xf6a3b0){var _0x22726a=_0xbed8('0x18');if(!_[_0xbed8('0x19')](_0x46de85[_0xbed8('0x1a')])){_0x22726a+=_0xbed8('0x1b');var _0x5789e7=_0x46de85[_0xbed8('0x1a')];maskSensitiveData(_0x5789e7);}return safeTemplate(util[_0xbed8('0x1c')](_0x22726a,_0x46de85[_0xbed8('0x1d')],_0x46de85['headers'][_0xbed8('0x1e')]?_0x46de85[_0xbed8('0x1f')]['x-forwarded-for']:_0x46de85['connection'][_0xbed8('0x20')]||_0x46de85['ip'],_0x46de85[_0xbed8('0x21')],_0xf6a3b0[_0xbed8('0x22')],_0xf6a3b0[_0xbed8('0x23')],_0x46de85['user']?_0x46de85[_0xbed8('0xf')]['id']:null,_0x46de85[_0xbed8('0xf')]?_0x46de85[_0xbed8('0xf')][_0xbed8('0x24')]:null,_0x46de85[_0xbed8('0xf')]?_0x46de85['user'][_0xbed8('0xa')]:null,_0x5789e7?util[_0xbed8('0x25')](_0x5789e7,![],null):''));}}));_0xdcc7f0[_0xbed8('0x16')](ewinston[_0xbed8('0x17')]({'winstonInstance':_0x47fec4,'meta':![],'statusLevels':!![],'msg':function(_0x49069f,_0x9e943){var _0x2b85d='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x49069f[_0xbed8('0x1a')]&&_0x49069f[_0xbed8('0x1a')][_0xbed8('0x26')]&&_0x49069f[_0xbed8('0x1a')][_0xbed8('0x27')]){_0x2b85d=_0xbed8('0x28');}return util['format'](_0x2b85d,_0x49069f[_0xbed8('0x1d')],_0x49069f[_0xbed8('0x1f')][_0xbed8('0x1e')]?_0x49069f[_0xbed8('0x1f')][_0xbed8('0x1e')]:_0x49069f['connection'][_0xbed8('0x20')]||_0x49069f['ip'],_0x49069f['url'],_0x9e943['statusCode'],_0x9e943[_0xbed8('0x23')],_0x49069f[_0xbed8('0xf')]?_0x49069f['user']['id']:null,_0x49069f['user']?_0x49069f['user'][_0xbed8('0x24')]:null,_0x49069f[_0xbed8('0xf')]?_0x49069f[_0xbed8('0xf')]['role']:null,_0x49069f[_0xbed8('0x1a')]&&_0x49069f[_0xbed8('0x1a')][_0xbed8('0x26')]?_0x49069f['body'][_0xbed8('0x26')]:_0xbed8('0x29'),_0x49069f[_0xbed8('0x1a')]&&_0x49069f[_0xbed8('0x1a')]['agent_id']?_0x49069f[_0xbed8('0x1a')][_0xbed8('0x27')]:'',_0x49069f[_0xbed8('0x1a')]&&_0x49069f[_0xbed8('0x1a')][_0xbed8('0x2a')]?_0x49069f[_0xbed8('0x1a')][_0xbed8('0x2a')]:'');},'ignoreRoute':function(_0x59bca7){var _0x29ce1f=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x29ce1f[_0xbed8('0x2b')](_0x59bca7[_0xbed8('0x21')]);}}));return _0x2f3c30();});}exports[_0xbed8('0x2c')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 7ddccd9..d0199a1 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x61d2=['minutes','isBefore','startOf','endOf','day','isBetween','timeCompare','format','includes','dowCompare','date','daysInMonth','max','min','domCompare','monthCompare','test','padStart','length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','toLowerCase','indexOf','slice','exports','concat','circularMonthInterval','clone','hours'];(function(_0x3b8108,_0x389284){var _0x34a9b5=function(_0x18d8ba){while(--_0x18d8ba){_0x3b8108['push'](_0x3b8108['shift']());}};_0x34a9b5(++_0x389284);}(_0x61d2,0xd2));var _0x261d=function(_0x3e0ae9,_0x27975b){_0x3e0ae9=_0x3e0ae9-0x0;var _0x4a2fd0=_0x61d2[_0x3e0ae9];return _0x4a2fd0;};var _=require(_0x261d('0x0'));var moment=require(_0x261d('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][_0x261d('0x2')](function(_0x57cf5e){return _0x57cf5e[_0x261d('0x3')];})[_0x261d('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x261d('0x5');var EINVALID_DATE=_0x261d('0x6');function throwIfDateNotValid(_0x2eb406){if(!_0x2eb406[_0x261d('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x2ea79c){var _0x34da21=_0x2ea79c[_0x261d('0x8')](':')[_0x261d('0x2')](function(_0x3a7932){return parseInt(_0x3a7932,0xa);});var _0x1dcb13=_0x34da21[0x0];var _0x2d0680=_0x34da21[0x1];if(_0x1dcb13<0x0||_0x1dcb13>0x17||_0x2d0680<0x0||_0x2d0680>0x3b){throw new Error(EINVALID_DATE);}return[_0x1dcb13,_0x2d0680];}function circularDoWInterval(_0x4d4ecb,_0x1538dd){if(_0x4d4ecb===_0x1538dd){return[_0x4d4ecb];}else{var _0x589dca=moment[_0x261d('0x9')]();moment[_0x261d('0x9')]('en');var _0x43190d=moment['weekdaysShort']()[_0x261d('0x2')](function(_0x36fa16){return _0x36fa16[_0x261d('0xa')]();});moment[_0x261d('0x9')](_0x589dca);var _0x49be9d=_0x43190d[_0x261d('0xb')](_0x4d4ecb);var _0xf207b6=_0x43190d[_0x261d('0xb')](_0x1538dd);if(_0xf207b6>_0x49be9d){return _0x43190d[_0x261d('0xc')](_0x49be9d,_0xf207b6+0x1);}else{var _0x115866=_0x43190d[_0x261d('0xc')](0x0,_0xf207b6+0x1);var _0x24dce4=_0x43190d[_0x261d('0xc')](_0x49be9d);return _0x24dce4['concat'](_0x115866);}}}module[_0x261d('0xd')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x1dc9ce,_0xf404d4){if(_0x1dc9ce===_0xf404d4){return[_0x1dc9ce];}else{var _0x17c423=moment['locale']();moment[_0x261d('0x9')]('en');var _0x1ced55=moment['monthsShort']()[_0x261d('0x2')](function(_0x112783){return _0x112783[_0x261d('0xa')]();});moment[_0x261d('0x9')](_0x17c423);var _0x492d54=_0x1ced55[_0x261d('0xb')](_0x1dc9ce);var _0x4c608e=_0x1ced55[_0x261d('0xb')](_0xf404d4);if(_0x4c608e>_0x492d54){return _0x1ced55[_0x261d('0xc')](_0x492d54,_0x4c608e+0x1);}else{var _0x4ee717=_0x1ced55[_0x261d('0xc')](0x0,_0x4c608e+0x1);var _0x5a572e=_0x1ced55['slice'](_0x492d54);return _0x5a572e[_0x261d('0xe')](_0x4ee717);}}}module[_0x261d('0xd')][_0x261d('0xf')]=circularMonthInterval;function parseDom(_0x14ebaf){var _0x199109=parseInt(_0x14ebaf,0xa);if(_0x199109<0x1||_0x199109>0x1f){throw new Error(EINVALID_DATE);}return _0x199109;}function timeCompare(_0x559eed,_0x39ab25,_0x134b4c){var _0x4ce568=_0x559eed[_0x261d('0x10')]();var _0x1fcf5a=extractTime(_0x39ab25);var _0x20aaed=_0x1fcf5a[0x0];var _0x251bf5=_0x1fcf5a[0x1];var _0x3b4782=_0x559eed[_0x261d('0x10')]()[_0x261d('0x11')](_0x20aaed)[_0x261d('0x12')](_0x251bf5);throwIfDateNotValid(_0x3b4782);var _0x52667d=extractTime(_0x134b4c);var _0x5ebccd=_0x52667d[0x0];var _0x293c34=_0x52667d[0x1];var _0x36a90a=_0x559eed[_0x261d('0x10')]()[_0x261d('0x11')](_0x5ebccd)[_0x261d('0x12')](_0x293c34);throwIfDateNotValid(_0x36a90a);if(_0x36a90a[_0x261d('0x13')](_0x3b4782)){var _0x55f599=_0x4ce568[_0x261d('0x10')]()[_0x261d('0x14')]('day');var _0x4f412c=_0x4ce568['clone']()[_0x261d('0x15')](_0x261d('0x16'));return _0x4ce568['isBetween'](_0x3b4782,_0x4f412c,undefined,'[]')||_0x4ce568[_0x261d('0x17')](_0x55f599,_0x36a90a,undefined,'[]');}else{return _0x4ce568[_0x261d('0x17')](_0x3b4782,_0x36a90a,undefined,'[]');}}module[_0x261d('0xd')][_0x261d('0x18')]=timeCompare;function dowCompare(_0x23d420,_0x5d3562,_0x13c485){var _0x3552dc=_0x23d420['locale']('en')[_0x261d('0x19')]('ddd')[_0x261d('0xa')]();return circularDoWInterval(_0x5d3562,_0x13c485)[_0x261d('0x1a')](_0x3552dc);}module[_0x261d('0xd')][_0x261d('0x1b')]=dowCompare;function domCompare(_0x467581,_0x1c6b78,_0x5d4242){var _0x3c426b=_0x467581[_0x261d('0x1c')]();if(_0x1c6b78===_0x5d4242){return _0x3c426b===_0x1c6b78;}else{var _0x54d2e7=_0x467581[_0x261d('0x1d')]();var _0x447aed=_0x1c6b78<_0x5d4242;let _0x20c81c=![];var _0x51f37f=0x0;var _0x1a8e62=0x0;if(_0x447aed){_0x51f37f=Math[_0x261d('0x1e')](0x1,_0x1c6b78);_0x1a8e62=Math[_0x261d('0x1f')](_0x5d4242,_0x54d2e7);_0x20c81c=_0x3c426b>=_0x51f37f&&_0x3c426b<=_0x1a8e62;}else{_0x51f37f=Math[_0x261d('0x1f')](_0x1c6b78,_0x54d2e7);_0x1a8e62=Math[_0x261d('0x1e')](0x1,_0x5d4242);_0x20c81c=_0x3c426b>=_0x51f37f||_0x3c426b<=_0x1a8e62;}return _0x20c81c;}}module['exports'][_0x261d('0x20')]=domCompare;function monthCompare(_0x4772dd,_0x2ad6e8,_0x307585){var _0x42b946=_0x4772dd[_0x261d('0x9')]('en')['format']('MMM')[_0x261d('0xa')]();return circularMonthInterval(_0x2ad6e8,_0x307585)[_0x261d('0x1a')](_0x42b946);}module[_0x261d('0xd')][_0x261d('0x21')]=monthCompare;function iftime(_0xc700fe,_0x4db2c8=moment['tz']['guess'](),_0x11ec89=moment()){if(!validateRx[_0x261d('0x22')](_0xc700fe)){throw new Error(EINVALID_STRING);}else{var _0x5efcfc=(moment['isMoment'](_0x11ec89)?_0x11ec89[_0x261d('0x10')]():moment(_0x11ec89))['tz'](_0x4db2c8)[_0x261d('0x9')]('en');throwIfDateNotValid(_0x5efcfc);var _0x3d6360=_0xc700fe[_0x261d('0x8')](',');var _0x403b19=_0x3d6360[0x0];var _0x3d00de=_0x3d6360[0x1];var _0x2ba727=_0x3d6360[0x2];var _0x2abd0f=_0x3d6360[0x3];let _0x24e261=!![];if(_0x403b19!=='*'){var _0x235aec=_0x403b19[_0x261d('0x8')]('-');var _0x357715=_[_0x261d('0x23')](_0x235aec[0x0],0x5,'0');var _0x470e0c=_0x235aec[_0x261d('0x24')]===0x2?_[_0x261d('0x23')](_0x235aec[0x1],0x5,'0'):_0x357715;_0x24e261=timeCompare(_0x5efcfc,_0x357715,_0x470e0c);}let _0x167834=!![];if(_0x3d00de!=='*'){var _0x42b774=_0x3d00de[_0x261d('0x8')]('-');var _0x110f7f=_0x42b774[0x0];var _0x147fec=_0x42b774['length']===0x2?_0x42b774[0x1]:_0x110f7f;_0x167834=dowCompare(_0x5efcfc,_0x110f7f,_0x147fec);}let _0x26f524=!![];if(_0x2ba727!=='*'){var _0x39556a=_0x2ba727[_0x261d('0x8')]('-');var _0x520275=parseDom(_0x39556a[0x0]);var _0x324887=_0x39556a[_0x261d('0x24')]===0x2?parseDom(_0x39556a[0x1]):_0x520275;_0x26f524=domCompare(_0x5efcfc,_0x520275,_0x324887);}let _0x1388af=!![];if(_0x2abd0f!=='*'){var _0x2ca051=_0x2abd0f[_0x261d('0x8')]('-');var _0x36d274=_0x2ca051[0x0];var _0x22811a=_0x2ca051[_0x261d('0x24')]===0x2?_0x2ca051[0x1]:_0x2ca051[0x0];_0x1388af=monthCompare(_0x5efcfc,_0x36d274,_0x22811a);}return _0x24e261&&_0x167834&&_0x26f524&&_0x1388af;}}module[_0x261d('0xd')][_0x261d('0x25')]=iftime; \ No newline at end of file +var _0x45a7=['monthsShort','toLowerCase','circularMonthInterval','clone','hours','minutes','isBefore','endOf','day','isBetween','timeCompare','format','exports','dowCompare','date','max','min','domCompare','includes','monthCompare','guess','test','isMoment','split','padStart','length','lodash','moment-timezone','map','source','isValid','locale','weekdaysShort','indexOf','slice','concat','circularDoWInterval'];(function(_0x12a27b,_0x23b3e8){var _0x43502b=function(_0x22344e){while(--_0x22344e){_0x12a27b['push'](_0x12a27b['shift']());}};_0x43502b(++_0x23b3e8);}(_0x45a7,0x11d));var _0x745a=function(_0x5c1353,_0x328298){_0x5c1353=_0x5c1353-0x0;var _0x31e2e6=_0x45a7[_0x5c1353];return _0x31e2e6;};var _=require(_0x745a('0x0'));var moment=require(_0x745a('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][_0x745a('0x2')](function(_0x39281d){return _0x39281d[_0x745a('0x3')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x2966c9){if(!_0x2966c9[_0x745a('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0xa72103){var _0x24ac4d=_0xa72103['split'](':')[_0x745a('0x2')](function(_0x59aa44){return parseInt(_0x59aa44,0xa);});var _0x59fe62=_0x24ac4d[0x0];var _0x59753c=_0x24ac4d[0x1];if(_0x59fe62<0x0||_0x59fe62>0x17||_0x59753c<0x0||_0x59753c>0x3b){throw new Error(EINVALID_DATE);}return[_0x59fe62,_0x59753c];}function circularDoWInterval(_0x1dd940,_0x43f160){if(_0x1dd940===_0x43f160){return[_0x1dd940];}else{var _0x2eeb77=moment[_0x745a('0x5')]();moment[_0x745a('0x5')]('en');var _0x24516b=moment[_0x745a('0x6')]()[_0x745a('0x2')](function(_0x1f6b7b){return _0x1f6b7b['toLowerCase']();});moment[_0x745a('0x5')](_0x2eeb77);var _0x1af996=_0x24516b[_0x745a('0x7')](_0x1dd940);var _0x4f12f0=_0x24516b[_0x745a('0x7')](_0x43f160);if(_0x4f12f0>_0x1af996){return _0x24516b[_0x745a('0x8')](_0x1af996,_0x4f12f0+0x1);}else{var _0x2fc80a=_0x24516b[_0x745a('0x8')](0x0,_0x4f12f0+0x1);var _0x2bec01=_0x24516b[_0x745a('0x8')](_0x1af996);return _0x2bec01[_0x745a('0x9')](_0x2fc80a);}}}module['exports'][_0x745a('0xa')]=circularDoWInterval;function circularMonthInterval(_0x27c2b1,_0x57dd8f){if(_0x27c2b1===_0x57dd8f){return[_0x27c2b1];}else{var _0x3fa6aa=moment[_0x745a('0x5')]();moment[_0x745a('0x5')]('en');var _0x24f310=moment[_0x745a('0xb')]()['map'](function(_0x15fadf){return _0x15fadf[_0x745a('0xc')]();});moment['locale'](_0x3fa6aa);var _0x382a8f=_0x24f310[_0x745a('0x7')](_0x27c2b1);var _0x274f6d=_0x24f310['indexOf'](_0x57dd8f);if(_0x274f6d>_0x382a8f){return _0x24f310['slice'](_0x382a8f,_0x274f6d+0x1);}else{var _0x8e3c6f=_0x24f310['slice'](0x0,_0x274f6d+0x1);var _0x209f31=_0x24f310['slice'](_0x382a8f);return _0x209f31[_0x745a('0x9')](_0x8e3c6f);}}}module['exports'][_0x745a('0xd')]=circularMonthInterval;function parseDom(_0x54f492){var _0x38d277=parseInt(_0x54f492,0xa);if(_0x38d277<0x1||_0x38d277>0x1f){throw new Error(EINVALID_DATE);}return _0x38d277;}function timeCompare(_0x25731f,_0x4f9f44,_0x592a55){var _0x38f810=_0x25731f[_0x745a('0xe')]();var _0x52ea63=extractTime(_0x4f9f44);var _0x28ec6d=_0x52ea63[0x0];var _0x2e5861=_0x52ea63[0x1];var _0x60821a=_0x25731f['clone']()[_0x745a('0xf')](_0x28ec6d)[_0x745a('0x10')](_0x2e5861);throwIfDateNotValid(_0x60821a);var _0x2b6142=extractTime(_0x592a55);var _0x17882f=_0x2b6142[0x0];var _0xcdf8c9=_0x2b6142[0x1];var _0x2843d1=_0x25731f[_0x745a('0xe')]()[_0x745a('0xf')](_0x17882f)[_0x745a('0x10')](_0xcdf8c9);throwIfDateNotValid(_0x2843d1);if(_0x2843d1[_0x745a('0x11')](_0x60821a)){var _0x5b67a6=_0x38f810[_0x745a('0xe')]()['startOf']('day');var _0x2dfb81=_0x38f810[_0x745a('0xe')]()[_0x745a('0x12')](_0x745a('0x13'));return _0x38f810[_0x745a('0x14')](_0x60821a,_0x2dfb81,undefined,'[]')||_0x38f810[_0x745a('0x14')](_0x5b67a6,_0x2843d1,undefined,'[]');}else{return _0x38f810[_0x745a('0x14')](_0x60821a,_0x2843d1,undefined,'[]');}}module['exports'][_0x745a('0x15')]=timeCompare;function dowCompare(_0x401a09,_0x1a3669,_0x5ae1ad){var _0x1d4433=_0x401a09[_0x745a('0x5')]('en')[_0x745a('0x16')]('ddd')['toLowerCase']();return circularDoWInterval(_0x1a3669,_0x5ae1ad)['includes'](_0x1d4433);}module[_0x745a('0x17')][_0x745a('0x18')]=dowCompare;function domCompare(_0x2cc93f,_0x7a1945,_0x813c3){var _0x1dcf1a=_0x2cc93f[_0x745a('0x19')]();if(_0x7a1945===_0x813c3){return _0x1dcf1a===_0x7a1945;}else{var _0x51b3b6=_0x2cc93f['daysInMonth']();var _0x569093=_0x7a1945<_0x813c3;let _0x422f47=![];var _0x59f68b=0x0;var _0x374449=0x0;if(_0x569093){_0x59f68b=Math[_0x745a('0x1a')](0x1,_0x7a1945);_0x374449=Math[_0x745a('0x1b')](_0x813c3,_0x51b3b6);_0x422f47=_0x1dcf1a>=_0x59f68b&&_0x1dcf1a<=_0x374449;}else{_0x59f68b=Math[_0x745a('0x1b')](_0x7a1945,_0x51b3b6);_0x374449=Math[_0x745a('0x1a')](0x1,_0x813c3);_0x422f47=_0x1dcf1a>=_0x59f68b||_0x1dcf1a<=_0x374449;}return _0x422f47;}}module['exports'][_0x745a('0x1c')]=domCompare;function monthCompare(_0xbbdbd8,_0x1f51bd,_0x708f94){var _0x53d370=_0xbbdbd8[_0x745a('0x5')]('en')[_0x745a('0x16')]('MMM')[_0x745a('0xc')]();return circularMonthInterval(_0x1f51bd,_0x708f94)[_0x745a('0x1d')](_0x53d370);}module[_0x745a('0x17')][_0x745a('0x1e')]=monthCompare;function iftime(_0x270fb2,_0x54068d=moment['tz'][_0x745a('0x1f')](),_0x533154=moment()){if(!validateRx[_0x745a('0x20')](_0x270fb2)){throw new Error(EINVALID_STRING);}else{var _0x1be643=(moment[_0x745a('0x21')](_0x533154)?_0x533154[_0x745a('0xe')]():moment(_0x533154))['tz'](_0x54068d)[_0x745a('0x5')]('en');throwIfDateNotValid(_0x1be643);var _0xd24b70=_0x270fb2[_0x745a('0x22')](',');var _0x3bc5b8=_0xd24b70[0x0];var _0x28550b=_0xd24b70[0x1];var _0xca163a=_0xd24b70[0x2];var _0x3e0083=_0xd24b70[0x3];let _0x619339=!![];if(_0x3bc5b8!=='*'){var _0xb5c13b=_0x3bc5b8[_0x745a('0x22')]('-');var _0x37330b=_[_0x745a('0x23')](_0xb5c13b[0x0],0x5,'0');var _0x3c05d5=_0xb5c13b[_0x745a('0x24')]===0x2?_['padStart'](_0xb5c13b[0x1],0x5,'0'):_0x37330b;_0x619339=timeCompare(_0x1be643,_0x37330b,_0x3c05d5);}let _0x556844=!![];if(_0x28550b!=='*'){var _0x2d1bd2=_0x28550b[_0x745a('0x22')]('-');var _0x553145=_0x2d1bd2[0x0];var _0x10d04d=_0x2d1bd2[_0x745a('0x24')]===0x2?_0x2d1bd2[0x1]:_0x553145;_0x556844=dowCompare(_0x1be643,_0x553145,_0x10d04d);}let _0x1924a5=!![];if(_0xca163a!=='*'){var _0x1eb91b=_0xca163a[_0x745a('0x22')]('-');var _0x3af768=parseDom(_0x1eb91b[0x0]);var _0x20a6e5=_0x1eb91b[_0x745a('0x24')]===0x2?parseDom(_0x1eb91b[0x1]):_0x3af768;_0x1924a5=domCompare(_0x1be643,_0x3af768,_0x20a6e5);}let _0x16ffeb=!![];if(_0x3e0083!=='*'){var _0x4147b2=_0x3e0083['split']('-');var _0x22fe3e=_0x4147b2[0x0];var _0x5b3eae=_0x4147b2[_0x745a('0x24')]===0x2?_0x4147b2[0x1]:_0x4147b2[0x0];_0x16ffeb=monthCompare(_0x1be643,_0x22fe3e,_0x5b3eae);}return _0x619339&&_0x556844&&_0x1924a5&&_0x16ffeb;}}module[_0x745a('0x17')]['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 42a6d67..0cb1c1d 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd1eb=['bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','%s-%s.log','message','replace','{{{','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','length','stringify','Logger','transports','Console','File','error','%s-%s','warn','consoleLogger','fileLogger','path','util','moment','../config/environment','debugLevel','info','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta'];(function(_0x35f770,_0x2bfb26){var _0x404268=function(_0x3e5cc4){while(--_0x3e5cc4){_0x35f770['push'](_0x35f770['shift']());}};_0x404268(++_0x2bfb26);}(_0xd1eb,0x152));var _0xbd1e=function(_0x3731bd,_0x54e22a){_0x3731bd=_0x3731bd-0x0;var _0x23f2dc=_0xd1eb[_0x3731bd];return _0x23f2dc;};'use strict';var path=require(_0xbd1e('0x0'));var util=require(_0xbd1e('0x1'));var moment=require(_0xbd1e('0x2'));var winston=require('winston');var config=require(_0xbd1e('0x3'));var debugLevel=config['debugLevel']?config[_0xbd1e('0x4')]['toLowerCase']():_0xbd1e('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':_0xbd1e('0x6'),'warn':_0xbd1e('0x7'),'info':_0xbd1e('0x8'),'print':_0xbd1e('0x9'),'success':_0xbd1e('0xa'),'http':_0xbd1e('0xb'),'verbose':_0xbd1e('0xc'),'debug':_0xbd1e('0xd'),'silly':_0xbd1e('0xe')};winston[_0xbd1e('0xf')](XC_LOG_COLORS);function getLogFileName(_0x2ac655,_0x8ebc72,_0x33a7f8){var _0x3efd6e=_0x2ac655||_0xbd1e('0x10');return path['join'](_0x3efd6e,util['format'](_0xbd1e('0x11'),_0x8ebc72,_0x33a7f8));}function formatter(_0x275752,_0x318649){_0x318649[_0xbd1e('0x12')]=_0x318649[_0xbd1e('0x12')][_0xbd1e('0x13')](/@@{/g,_0xbd1e('0x14'))[_0xbd1e('0x13')](/}@@/g,_0xbd1e('0x15'))[_0xbd1e('0x13')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xbd1e('0x16')](_0xbd1e('0x17'),moment()[_0xbd1e('0x16')](_0xbd1e('0x18')),_0x318649[_0xbd1e('0x19')][_0xbd1e('0x1a')](),_0x275752,_0x318649[_0xbd1e('0x12')]);}function fileFormat(_0x3034cb,_0x4b0741){_0x4b0741[_0xbd1e('0x12')]=_0x4b0741['message'][_0xbd1e('0x13')](/@@{/g,_0xbd1e('0x14'))['replace'](/}@@/g,_0xbd1e('0x15'))[_0xbd1e('0x13')](/@{/g,'{{')[_0xbd1e('0x13')](/}@/g,'}}');var _0x144aa8=_0x4b0741[_0xbd1e('0x1b')]&&Object['keys'](_0x4b0741[_0xbd1e('0x1b')])[_0xbd1e('0x1c')]?'\x0a\x09'+JSON[_0xbd1e('0x1d')](_0x4b0741[_0xbd1e('0x1b')]):'';return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x4b0741[_0xbd1e('0x19')][_0xbd1e('0x1a')](),_0x3034cb,_0x4b0741[_0xbd1e('0x12')],_0x144aa8);}function consoleLogger(){var _0xfc111c=new winston[(_0xbd1e('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xbd1e('0x1f'))][(_0xbd1e('0x20'))]({'level':'warn','json':![],'formatter':function(_0x5bd717){return formatter('',_0x5bd717);}})]});return _0xfc111c;}function fileLogger(_0x3d3627,_0x53293e){var _0x48ac6b=new winston[(_0xbd1e('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xbd1e('0x1f'))][(_0xbd1e('0x21'))]({'name':util[_0xbd1e('0x16')]('%s-%s',_0x3d3627,_0xbd1e('0x22')),'filename':getLogFileName(_0x53293e,_0x3d3627,_0xbd1e('0x22')),'level':_0xbd1e('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x19e64e){return fileFormat(_0x3d3627,_0x19e64e);}}),new winston[(_0xbd1e('0x1f'))][(_0xbd1e('0x21'))]({'name':util[_0xbd1e('0x16')](_0xbd1e('0x23'),_0x3d3627,debugLevel),'filename':getLogFileName(_0x53293e,_0x3d3627,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3cd9b8){return fileFormat(_0x3d3627,_0x3cd9b8);}}),new winston['transports']['Console']({'level':_0xbd1e('0x24'),'json':![],'formatter':function(_0x202051){return fileFormat(_0x3d3627,_0x202051);}})]});return _0x48ac6b;}exports[_0xbd1e('0x25')]=consoleLogger;exports[_0xbd1e('0x26')]=fileLogger; \ No newline at end of file +var _0x6d5f=['}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','keys','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6d5f,0x196));var _0xf6d5=function(_0x16b6e8,_0x15aa2c){_0x16b6e8=_0x16b6e8-0x0;var _0x597954=_0x6d5f[_0x16b6e8];return _0x597954;};'use strict';var path=require(_0xf6d5('0x0'));var util=require(_0xf6d5('0x1'));var moment=require(_0xf6d5('0x2'));var winston=require(_0xf6d5('0x3'));var config=require(_0xf6d5('0x4'));var debugLevel=config[_0xf6d5('0x5')]?config[_0xf6d5('0x5')][_0xf6d5('0x6')]():_0xf6d5('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':_0xf6d5('0x8'),'error':'red','warn':_0xf6d5('0x9'),'info':_0xf6d5('0xa'),'print':_0xf6d5('0xb'),'success':_0xf6d5('0xc'),'http':'gray','verbose':_0xf6d5('0xd'),'debug':_0xf6d5('0xe'),'silly':_0xf6d5('0xf')};winston[_0xf6d5('0x10')](XC_LOG_COLORS);function getLogFileName(_0x2c09a1,_0x4b51a5,_0x1c0429){var _0x3a939e=_0x2c09a1||_0xf6d5('0x11');return path[_0xf6d5('0x12')](_0x3a939e,util[_0xf6d5('0x13')](_0xf6d5('0x14'),_0x4b51a5,_0x1c0429));}function formatter(_0x365f52,_0x609cdd){_0x609cdd[_0xf6d5('0x15')]=_0x609cdd[_0xf6d5('0x15')][_0xf6d5('0x16')](/@@{/g,_0xf6d5('0x17'))[_0xf6d5('0x16')](/}@@/g,_0xf6d5('0x18'))[_0xf6d5('0x16')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xf6d5('0x13')](_0xf6d5('0x19'),moment()[_0xf6d5('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),_0x609cdd[_0xf6d5('0x1a')][_0xf6d5('0x1b')](),_0x365f52,_0x609cdd['message']);}function fileFormat(_0x311f93,_0x4f24de){_0x4f24de[_0xf6d5('0x15')]=_0x4f24de[_0xf6d5('0x15')][_0xf6d5('0x16')](/@@{/g,_0xf6d5('0x17'))[_0xf6d5('0x16')](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0xf6d5('0x16')](/}@/g,'}}');var _0x569336=_0x4f24de['meta']&&Object[_0xf6d5('0x1c')](_0x4f24de[_0xf6d5('0x1d')])[_0xf6d5('0x1e')]?'\x0a\x09'+JSON[_0xf6d5('0x1f')](_0x4f24de[_0xf6d5('0x1d')]):'';return util[_0xf6d5('0x13')](_0xf6d5('0x20'),moment()['format'](_0xf6d5('0x21')),_0x4f24de[_0xf6d5('0x1a')]['toUpperCase'](),_0x311f93,_0x4f24de['message'],_0x569336);}function consoleLogger(){var _0x460e3c=new winston[(_0xf6d5('0x22'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xf6d5('0x23'))][(_0xf6d5('0x24'))]({'level':_0xf6d5('0x25'),'json':![],'formatter':function(_0x5a61d8){return formatter('',_0x5a61d8);}})]});return _0x460e3c;}function fileLogger(_0x2d86e9,_0x59a632){var _0x40016b=new winston[(_0xf6d5('0x22'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xf6d5('0x23'))][(_0xf6d5('0x26'))]({'name':util[_0xf6d5('0x13')](_0xf6d5('0x27'),_0x2d86e9,'error'),'filename':getLogFileName(_0x59a632,_0x2d86e9,_0xf6d5('0x28')),'level':_0xf6d5('0x28'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1d34c7){return fileFormat(_0x2d86e9,_0x1d34c7);}}),new winston[(_0xf6d5('0x23'))]['File']({'name':util[_0xf6d5('0x13')](_0xf6d5('0x27'),_0x2d86e9,debugLevel),'filename':getLogFileName(_0x59a632,_0x2d86e9,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5ac1e0){return fileFormat(_0x2d86e9,_0x5ac1e0);}}),new winston['transports'][(_0xf6d5('0x24'))]({'level':_0xf6d5('0x25'),'json':![],'formatter':function(_0x7fb9c9){return fileFormat(_0x2d86e9,_0x7fb9c9);}})]});return _0x40016b;}exports[_0xf6d5('0x29')]=consoleLogger;exports[_0xf6d5('0x2a')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 7e3216d..203156e 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 _0xdb28=['registry','oldPassword','isPlainObject','length','isString','replace','@@{','}@@','exports','maskSensitiveData','lodash','username','password','newPassword','firstName','lastName','street','phone','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','secret'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdb28,0x106));var _0x8db2=function(_0x3b8d20,_0x5c4763){_0x3b8d20=_0x3b8d20-0x0;var _0x30d4fe=_0xdb28[_0x3b8d20];return _0x30d4fe;};var _=require(_0x8db2('0x0'));var sensitiveFields=[_0x8db2('0x1'),_0x8db2('0x2'),_0x8db2('0x3'),'apiKey',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'fax',_0x8db2('0x9'),_0x8db2('0xa'),'clientSecret','securityToken',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'authToken',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'calleridname',_0x8db2('0x15'),_0x8db2('0x16'),'vidaooApiKey',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'user','pass',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21')];function maskSensitiveData(_0x2f177a){const _0x3c96a7=/(?!^)[\s\S](?!$)/g;if(_[_0x8db2('0x22')](_0x2f177a)){for(const _0x16c8c2 in _0x2f177a){if(_['isArray'](_0x2f177a[_0x16c8c2])){for(let _0x13b0f5=0x0;_0x13b0f5<_0x2f177a[_0x16c8c2][_0x8db2('0x23')];_0x13b0f5++){maskSensitiveData(_0x2f177a[_0x16c8c2][_0x13b0f5]);}}else if(_['isPlainObject'](_0x2f177a[_0x16c8c2])){maskSensitiveData(_0x2f177a[_0x16c8c2]);}else if(_[_0x8db2('0x24')](_0x2f177a[_0x16c8c2])){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](/{{{/g,_0x8db2('0x26'))[_0x8db2('0x25')](/}}}/g,_0x8db2('0x27'))[_0x8db2('0x25')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x16c8c2)){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](_0x3c96a7,'*');}}}}}module[_0x8db2('0x28')][_0x8db2('0x29')]=maskSensitiveData; \ No newline at end of file +var _0x5f66=['consumerSecret','membername','calleridname','exten','privateKey','secretaccesskey','user','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','length','isPlainObject','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','lastName','street','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','consumerKey'];(function(_0x1eb72e,_0x177579){var _0x56d568=function(_0x151cf7){while(--_0x151cf7){_0x1eb72e['push'](_0x1eb72e['shift']());}};_0x56d568(++_0x177579);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};var _=require('lodash');var sensitiveFields=[_0x65f6('0x0'),'password',_0x65f6('0x1'),_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4'),_0x65f6('0x5'),'phone',_0x65f6('0x6'),'fax',_0x65f6('0x7'),_0x65f6('0x8'),'clientSecret','securityToken',_0x65f6('0x9'),_0x65f6('0xa'),_0x65f6('0xb'),_0x65f6('0xc'),_0x65f6('0xd'),_0x65f6('0xe'),'accessTokenSecret','authToken',_0x65f6('0xf'),_0x65f6('0x10'),_0x65f6('0x11'),_0x65f6('0x12'),'calleridnum',_0x65f6('0x13'),'vidaooApiKey','clientEmail',_0x65f6('0x14'),'accesskeyid',_0x65f6('0x15'),'key',_0x65f6('0x16'),_0x65f6('0x17'),_0x65f6('0x18'),_0x65f6('0x19'),_0x65f6('0x1a'),_0x65f6('0x1b'),_0x65f6('0x1c'),_0x65f6('0x1d')];function maskSensitiveData(_0x46dbc6){const _0x3440af=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x46dbc6)){for(const _0x19b9ff in _0x46dbc6){if(_['isArray'](_0x46dbc6[_0x19b9ff])){for(let _0x5dd324=0x0;_0x5dd324<_0x46dbc6[_0x19b9ff][_0x65f6('0x1e')];_0x5dd324++){maskSensitiveData(_0x46dbc6[_0x19b9ff][_0x5dd324]);}}else if(_[_0x65f6('0x1f')](_0x46dbc6[_0x19b9ff])){maskSensitiveData(_0x46dbc6[_0x19b9ff]);}else if(_[_0x65f6('0x20')](_0x46dbc6[_0x19b9ff])){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](/{{{/g,_0x65f6('0x22'))[_0x65f6('0x21')](/}}}/g,_0x65f6('0x23'))[_0x65f6('0x21')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x19b9ff)){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](_0x3440af,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 811a7cf..88c2cc5 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 _0x8603=['{\x20{\x20','\x20}\x20}','string','replace','isArray','keys','reduce','exports'];(function(_0x50afae,_0x3ce1d5){var _0x588d13=function(_0xb8085b){while(--_0xb8085b){_0x50afae['push'](_0x50afae['shift']());}};_0x588d13(++_0x3ce1d5);}(_0x8603,0x190));var _0x3860=function(_0x1d0035,_0x45354b){_0x1d0035=_0x1d0035-0x0;var _0x310e3a=_0x8603[_0x1d0035];return _0x310e3a;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2f848f){return _0x2f848f==='{{'?_0x3860('0x0'):_0x3860('0x1');}function safeTemplate(_0x51bfda){var _0x4961d6=_0x51bfda;if(typeof _0x51bfda===_0x3860('0x2')){_0x4961d6=_0x51bfda[_0x3860('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3860('0x4')](_0x51bfda)){_0x4961d6=_0x51bfda['map'](function(_0x2fc97a){return safeTemplate(_0x2fc97a);});}else if(_['isPlainObject'](_0x51bfda)){_0x4961d6=Object[_0x3860('0x5')](_0x51bfda)[_0x3860('0x6')](function(_0x1eca44,_0xd3ce26){_0x1eca44[_0xd3ce26]=safeTemplate(_0x51bfda[_0xd3ce26]);return _0x1eca44;},{});}return _0x4961d6;}module[_0x3860('0x7')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x13f6=['isArray','map','keys','reduce','lodash','string'];(function(_0x3d1b7d,_0x4ae2d5){var _0x3cb35e=function(_0x2fdf5d){while(--_0x2fdf5d){_0x3d1b7d['push'](_0x3d1b7d['shift']());}};_0x3cb35e(++_0x4ae2d5);}(_0x13f6,0x124));var _0x613f=function(_0x20d919,_0x106eb9){_0x20d919=_0x20d919-0x0;var _0x2726b0=_0x13f6[_0x20d919];return _0x2726b0;};var _=require(_0x613f('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x1844a4){return _0x1844a4==='{{'?'{\x20{\x20':'\x20}\x20}';}function safeTemplate(_0xd04cfd){var _0x13b50a=_0xd04cfd;if(typeof _0xd04cfd===_0x613f('0x1')){_0x13b50a=_0xd04cfd['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x613f('0x2')](_0xd04cfd)){_0x13b50a=_0xd04cfd[_0x613f('0x3')](function(_0x20af2f){return safeTemplate(_0x20af2f);});}else if(_['isPlainObject'](_0xd04cfd)){_0x13b50a=Object[_0x613f('0x4')](_0xd04cfd)[_0x613f('0x5')](function(_0x5618fa,_0x4b546b){_0x5618fa[_0x4b546b]=safeTemplate(_0xd04cfd[_0x4b546b]);return _0x5618fa;},{});}return _0x13b50a;}module['exports']['safeTemplate']=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index b41a98e..b969da9 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 _0xeb55=['env','string','then','readJSON','updated','Updating\x20app.json','writeJSON','exports','path','../config/environment','root','server/app.json','resolve','legacy-libs','isArray','findIndex','name','motion2','apps'];(function(_0x6f66f4,_0x1f410a){var _0x208926=function(_0xf5a87b){while(--_0xf5a87b){_0x6f66f4['push'](_0x6f66f4['shift']());}};_0x208926(++_0x1f410a);}(_0xeb55,0xec));var _0x5eb5=function(_0xff6aaf,_0x5cdc4f){_0xff6aaf=_0xff6aaf-0x0;var _0x2b6938=_0xeb55[_0xff6aaf];return _0x2b6938;};var fs=require('fs-extra');var path=require(_0x5eb5('0x0'));var config=require(_0x5eb5('0x1'));var root=config[_0x5eb5('0x2')];var APP_JSON_PATH=path['resolve'](root,_0x5eb5('0x3'));var NODEPATH=path[_0x5eb5('0x4')](root,_0x5eb5('0x5'));function setLegacyLibsNodeEnvPath(_0xf6c2cf){let _0xccfa5a=![];if(Array[_0x5eb5('0x6')](_0xf6c2cf['apps'])){var _0x3beeb2=_0xf6c2cf['apps'][_0x5eb5('0x7')](function(_0x455d3d){return _0x455d3d[_0x5eb5('0x8')]===_0x5eb5('0x9');});if(_0x3beeb2>-0x1){var _0x37f711=_0xf6c2cf[_0x5eb5('0xa')][_0x3beeb2];if(typeof _0x37f711[_0x5eb5('0xb')]['NODE_PATH']!==_0x5eb5('0xc')){_0x37f711['env']['NODE_PATH']=NODEPATH;_0xccfa5a=!![];}}return{'appConfig':_0xf6c2cf,'updated':_0xccfa5a};}}function updateAppConfig(_0x3260a6){return fs['pathExists'](APP_JSON_PATH)[_0x5eb5('0xd')](function(_0x44d9ec){if(_0x44d9ec){return fs[_0x5eb5('0xe')](APP_JSON_PATH)[_0x5eb5('0xd')](function(_0x2b1375){var _0x5cab0b=setLegacyLibsNodeEnvPath(_0x2b1375);if(_0x5cab0b[_0x5eb5('0xf')]){_0x3260a6['info'](_0x5eb5('0x10'));return fs[_0x5eb5('0x11')](APP_JSON_PATH,_0x2b1375,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0x5eb5('0x4')]();}});}module[_0x5eb5('0x12')]=updateAppConfig; \ No newline at end of file +var _0xf5a0=['then','updated','info','writeJSON','exports','fs-extra','path','../config/environment','root','resolve','legacy-libs','isArray','apps','name','env','NODE_PATH','pathExists'];(function(_0x5c619e,_0x1bccdf){var _0x445cf8=function(_0x2eaa64){while(--_0x2eaa64){_0x5c619e['push'](_0x5c619e['shift']());}};_0x445cf8(++_0x1bccdf);}(_0xf5a0,0x1d0));var _0x0f5a=function(_0x2deed4,_0x2793e8){_0x2deed4=_0x2deed4-0x0;var _0xfb91f4=_0xf5a0[_0x2deed4];return _0xfb91f4;};var fs=require(_0x0f5a('0x0'));var path=require(_0x0f5a('0x1'));var config=require(_0x0f5a('0x2'));var root=config[_0x0f5a('0x3')];var APP_JSON_PATH=path[_0x0f5a('0x4')](root,'server/app.json');var NODEPATH=path[_0x0f5a('0x4')](root,_0x0f5a('0x5'));function setLegacyLibsNodeEnvPath(_0x5c1ce6){let _0x123308=![];if(Array[_0x0f5a('0x6')](_0x5c1ce6[_0x0f5a('0x7')])){var _0x3c0fb7=_0x5c1ce6[_0x0f5a('0x7')]['findIndex'](function(_0x284fee){return _0x284fee[_0x0f5a('0x8')]==='motion2';});if(_0x3c0fb7>-0x1){var _0x4f684b=_0x5c1ce6[_0x0f5a('0x7')][_0x3c0fb7];if(typeof _0x4f684b[_0x0f5a('0x9')][_0x0f5a('0xa')]!=='string'){_0x4f684b[_0x0f5a('0x9')][_0x0f5a('0xa')]=NODEPATH;_0x123308=!![];}}return{'appConfig':_0x5c1ce6,'updated':_0x123308};}}function updateAppConfig(_0x227854){return fs[_0x0f5a('0xb')](APP_JSON_PATH)[_0x0f5a('0xc')](function(_0x4b71d2){if(_0x4b71d2){return fs['readJSON'](APP_JSON_PATH)[_0x0f5a('0xc')](function(_0x12f41a){var _0x29c600=setLegacyLibsNodeEnvPath(_0x12f41a);if(_0x29c600[_0x0f5a('0xd')]){_0x227854[_0x0f5a('0xe')]('Updating\x20app.json');return fs[_0x0f5a('0xf')](APP_JSON_PATH,_0x12f41a,{'spaces':0x2});}else{return Promise[_0x0f5a('0x4')]();}});}else{return Promise[_0x0f5a('0x4')]();}});}module[_0x0f5a('0x10')]=updateAppConfig; \ No newline at end of file